From: Andrea Bianco Date: Fri, 12 Mar 2021 18:13:31 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.21 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22my-avatar.png/%22?a=commitdiff_plain;h=8502f22b14b06872b52aa6a3368c2bf0c14142fb;p=motion2.git Built motion from commit (unavailable).|2.5.21 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 3e811c7..c66c82f 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-12T17:44:53.581Z", + "time": "2021-03-12T18:02:58.335Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 5725844..eb4923c 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-12T17:44:53.581Z", + "time": "2021-03-12T18:02:58.335Z", "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 026cb49..ff7e4f9 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 _0xf500=['integration','jscripty','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','STRING','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','action'];(function(_0x484023,_0x39e1ec){var _0xcef9df=function(_0x4f8841){while(--_0x4f8841){_0x484023['push'](_0x484023['shift']());}};_0xcef9df(++_0x39e1ec);}(_0xf500,0x131));var _0x0f50=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xf500[_0x47fd36];return _0x21a0fc;};'use strict';var Sequelize=require(_0x0f50('0x0'));module[_0x0f50('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1a7725){return this['getDataValue'](_0x0f50('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x0f50('0x3'),'motionbar',_0x0f50('0x4'),_0x0f50('0x5'),_0x0f50('0x6'),_0x0f50('0x7'),'script']],'msg':_0x0f50('0x8')}},'comment':_0x0f50('0x8')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x0f50('0x9')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x0f50('0xa')},'data3':{'type':Sequelize[_0x0f50('0xb')](0x1000),'comment':_0x0f50('0xc')},'data4':{'type':Sequelize[_0x0f50('0xb')](0x1000)},'data5':{'type':Sequelize[_0x0f50('0xb')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x0f50('0xd')]}}; \ No newline at end of file +var _0x6d3b=['TEXT','sequelize','action','STRING','contactManager','motionbar','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'];(function(_0x59598f,_0x3aba27){var _0x439c36=function(_0x1ed256){while(--_0x1ed256){_0x59598f['push'](_0x59598f['shift']());}};_0x439c36(++_0x3aba27);}(_0x6d3b,0x1a5));var _0xb6d3=function(_0xb4454a,_0x537bb4){_0xb4454a=_0xb4454a-0x0;var _0x46a7d1=_0x6d3b[_0xb4454a];return _0x46a7d1;};'use strict';var Sequelize=require(_0xb6d3('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1f1dad){return this['getDataValue'](_0xb6d3('0x1'));}},'action':{'type':Sequelize[_0xb6d3('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0xb6d3('0x3'),'integration',_0xb6d3('0x4'),'jscripty',_0xb6d3('0x5'),_0xb6d3('0x6'),_0xb6d3('0x7'),'script']],'msg':_0xb6d3('0x8')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xb6d3('0x2')](0x1000),'comment':_0xb6d3('0x9')},'data2':{'type':Sequelize[_0xb6d3('0x2')](0x1000),'comment':_0xb6d3('0xa')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0xb6d3('0x2')](0x1000)},'data5':{'type':Sequelize[_0xb6d3('0x2')](0x1000)},'data6':{'type':Sequelize[_0xb6d3('0x2')]},'data7':{'type':Sequelize[_0xb6d3('0xb')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index fe71be2..b91a078 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 _0xeff8=['querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','body','Action','find','params','catch','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js'];(function(_0x15d409,_0x16c2ee){var _0x379106=function(_0x3ab526){while(--_0x3ab526){_0x15d409['push'](_0x15d409['shift']());}};_0x379106(++_0x16c2ee);}(_0xeff8,0x186));var _0x8eff=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0xeff8[_0x4c0622];return _0x1799d8;};'use strict';var pdf=require(_0x8eff('0x0'));var emlformat=require(_0x8eff('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8eff('0x2'));var jsonpatch=require(_0x8eff('0x3'));var rp=require(_0x8eff('0x4'));var moment=require('moment');var BPromise=require(_0x8eff('0x5'));var Mustache=require(_0x8eff('0x6'));var util=require(_0x8eff('0x7'));var path=require(_0x8eff('0x8'));var sox=require('sox');var csv=require(_0x8eff('0x9'));var ejs=require(_0x8eff('0xa'));var fs=require('fs');var _=require(_0x8eff('0xb'));var squel=require(_0x8eff('0xc'));var crypto=require('crypto');var jsforce=require(_0x8eff('0xd'));var deskjs=require(_0x8eff('0xe'));var toCsv=require(_0x8eff('0x9'));var querystring=require(_0x8eff('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8eff('0x10'));var qs=require(_0x8eff('0x11'));var as=require(_0x8eff('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8eff('0x13'))(_0x8eff('0x14'));var utils=require('../../config/utils');var config=require(_0x8eff('0x15'));var licenseUtil=require(_0x8eff('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a399e,_0x45f280){_0x45f280=_0x45f280||0xcc;return function(_0x43c914){if(_0x43c914){return _0x4a399e[_0x8eff('0x17')](_0x45f280);}return _0x4a399e[_0x8eff('0x18')](_0x45f280)[_0x8eff('0x19')]();};}function respondWithResult(_0x56efdf,_0x3e7c01){_0x3e7c01=_0x3e7c01||0xc8;return function(_0x212a2e){if(_0x212a2e){return _0x56efdf[_0x8eff('0x18')](_0x3e7c01)[_0x8eff('0x1a')](_0x212a2e);}};}function respondWithFilteredResult(_0x228eb1,_0x4cfc91){return function(_0x16202e){if(_0x16202e){var _0xdbb753=_0x16202e['count'],_0x16a4eb=_0x4cfc91[_0x8eff('0x1b')],_0x427902=_0x4cfc91[_0x8eff('0x1b')]+_0x4cfc91[_0x8eff('0x1c')],_0x137344;if(_0x427902>=_0xdbb753){_0x427902=_0xdbb753;_0x137344=0xc8;}else{_0x137344=0xce;}_0x228eb1[_0x8eff('0x18')](_0x137344);return _0x228eb1[_0x8eff('0x1d')](_0x8eff('0x1e'),_0x16a4eb+'-'+_0x427902+'/'+_0xdbb753)[_0x8eff('0x1a')](_0x16202e);}return null;};}function patchUpdates(_0x399d96){return function(_0x1b003c){try{jsonpatch[_0x8eff('0x1f')](_0x1b003c,_0x399d96,!![]);}catch(_0x453c7a){return BPromise[_0x8eff('0x20')](_0x453c7a);}return _0x1b003c[_0x8eff('0x21')]();};}function saveUpdates(_0x2a7337,_0xdbb7b5){return function(_0x183a53){if(_0x183a53){return _0x183a53['update'](_0x2a7337)[_0x8eff('0x22')](function(_0x4d3e84){return _0x4d3e84;});}return null;};}function removeEntity(_0x5a2492,_0x1c4ad3){return function(_0x5ea31f){if(_0x5ea31f){return _0x5ea31f[_0x8eff('0x23')]()[_0x8eff('0x22')](function(){_0x5a2492[_0x8eff('0x18')](0xcc)[_0x8eff('0x19')]();});}};}function handleEntityNotFound(_0x1ee09c,_0x4e891c){return function(_0x179814){if(!_0x179814){_0x1ee09c[_0x8eff('0x17')](0x194);}return _0x179814;};}function handleError(_0x50784c,_0x15b66f){_0x15b66f=_0x15b66f||0x1f4;return function(_0x5ec3d7){logger[_0x8eff('0x24')](_0x5ec3d7[_0x8eff('0x25')]);if(_0x5ec3d7[_0x8eff('0x26')]){delete _0x5ec3d7[_0x8eff('0x26')];}_0x50784c[_0x8eff('0x18')](_0x15b66f)[_0x8eff('0x27')](_0x5ec3d7);};}exports['update']=function(_0x3e1607,_0x323ffa){if(_0x3e1607[_0x8eff('0x28')]['id']){delete _0x3e1607[_0x8eff('0x28')]['id'];}return db[_0x8eff('0x29')][_0x8eff('0x2a')]({'where':{'id':_0x3e1607['params']['id']}})['then'](handleEntityNotFound(_0x323ffa,null))[_0x8eff('0x22')](saveUpdates(_0x3e1607[_0x8eff('0x28')],null))[_0x8eff('0x22')](respondWithResult(_0x323ffa,null))['catch'](handleError(_0x323ffa,null));};exports[_0x8eff('0x23')]=function(_0x2f8ad9,_0x229e0d){return db[_0x8eff('0x29')][_0x8eff('0x2a')]({'where':{'id':_0x2f8ad9[_0x8eff('0x2b')]['id']}})[_0x8eff('0x22')](handleEntityNotFound(_0x229e0d,null))[_0x8eff('0x22')](removeEntity(_0x229e0d,null))[_0x8eff('0x2c')](handleError(_0x229e0d,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(_0x480a80,_0xcc023c){var _0x5a5b8d=function(_0x18e512){while(--_0x18e512){_0x480a80['push'](_0x480a80['shift']());}};_0x5a5b8d(++_0xcc023c);}(_0x1b65,0x1b4));var _0x51b6=function(_0x13ef3f,_0x54b026){_0x13ef3f=_0x13ef3f-0x0;var _0x2fe438=_0x1b65[_0x13ef3f];return _0x2fe438;};'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 e2f0063..9bcafa1 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 _0xb058=['./action.attributes','exports','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x129885,_0x1bc0d7){var _0x1523d3=function(_0x21aac4){while(--_0x21aac4){_0x129885['push'](_0x129885['shift']());}};_0x1523d3(++_0x1bc0d7);}(_0xb058,0x128));var _0x8b05=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0xb058[_0x49c057];return _0xd8f0e6;};'use strict';var _=require('lodash');var util=require(_0x8b05('0x0'));var logger=require(_0x8b05('0x1'))('api');var moment=require(_0x8b05('0x2'));var BPromise=require(_0x8b05('0x3'));var rp=require(_0x8b05('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8b05('0x5'));module[_0x8b05('0x6')]=function(_0x4bad3b,_0x1461e7){return _0x4bad3b['define']('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ed9=['./action.attributes','exports','define','Action','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x252ef1,_0x2e0041){var _0x25817c=function(_0x243776){while(--_0x243776){_0x252ef1['push'](_0x252ef1['shift']());}};_0x25817c(++_0x2e0041);}(_0x3ed9,0xbf));var _0x93ed=function(_0x1c7137,_0x4c7c26){_0x1c7137=_0x1c7137-0x0;var _0xeb4432=_0x3ed9[_0x1c7137];return _0xeb4432;};'use strict';var _=require('lodash');var util=require(_0x93ed('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x93ed('0x1'));var BPromise=require(_0x93ed('0x2'));var rp=require(_0x93ed('0x3'));var fs=require('fs');var path=require(_0x93ed('0x4'));var rimraf=require(_0x93ed('0x5'));var config=require(_0x93ed('0x6'));var attributes=require(_0x93ed('0x7'));module[_0x93ed('0x8')]=function(_0x5ee9f8,_0x2df082){return _0x5ee9f8[_0x93ed('0x9')](_0x93ed('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 219f6b2..1487001 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x398eba,_0x3110e4){var _0x53dc97=function(_0x5f0133){while(--_0x5f0133){_0x398eba['push'](_0x398eba['shift']());}};_0x53dc97(++_0x3110e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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','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(_0x53c943,_0x541552){var _0x7e8c26=function(_0x165602){while(--_0x165602){_0x53c943['push'](_0x53c943['shift']());}};_0x7e8c26(++_0x541552);}(_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 diff --git a/server/api/action/index.js b/server/api/action/index.js index 0046cb4..fcfc3df 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 _0xc4ae=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','update','delete','isAuthenticated','destroy'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xc4ae,0x78));var _0xec4a=function(_0x2f39c0,_0x21ca06){_0x2f39c0=_0x2f39c0-0x0;var _0x5579f6=_0xc4ae[_0x2f39c0];return _0x5579f6;};'use strict';var multer=require(_0xec4a('0x0'));var util=require(_0xec4a('0x1'));var path=require(_0xec4a('0x2'));var timeout=require(_0xec4a('0x3'));var express=require(_0xec4a('0x4'));var router=express[_0xec4a('0x5')]();var auth=require(_0xec4a('0x6'));var interaction=require(_0xec4a('0x7'));var config=require(_0xec4a('0x8'));var controller=require(_0xec4a('0x9'));router[_0xec4a('0xa')](_0xec4a('0xb'),auth['isAuthenticated'](),controller[_0xec4a('0xc')]);router[_0xec4a('0xd')]('/:id',auth[_0xec4a('0xe')](),controller[_0xec4a('0xf')]);module[_0xec4a('0x10')]=router; \ No newline at end of file +var _0xcb7e=['../../components/interaction/service','../../config/environment','./action.controller','put','update','delete','isAuthenticated','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcb7e,0xaf));var _0xecb7=function(_0x5c6bea,_0x32035c){_0x5c6bea=_0x5c6bea-0x0;var _0x5aefa8=_0xcb7e[_0x5c6bea];return _0x5aefa8;};'use strict';var multer=require(_0xecb7('0x0'));var util=require(_0xecb7('0x1'));var path=require('path');var timeout=require(_0xecb7('0x2'));var express=require(_0xecb7('0x3'));var router=express['Router']();var auth=require(_0xecb7('0x4'));var interaction=require(_0xecb7('0x5'));var config=require(_0xecb7('0x6'));var controller=require(_0xecb7('0x7'));router[_0xecb7('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xecb7('0x9')]);router[_0xecb7('0xa')]('/:id',auth[_0xecb7('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 07daf59..75eb49d 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 _0x6959=['sequelize','STRING','TEXT'];(function(_0x109b6c,_0x1e3d85){var _0x4bbc99=function(_0x572521){while(--_0x572521){_0x109b6c['push'](_0x109b6c['shift']());}};_0x4bbc99(++_0x1e3d85);}(_0x6959,0x16b));var _0x9695=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6959[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x9695('0x0'));module['exports']={'name':{'type':Sequelize[_0x9695('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9695('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x9695('0x1')]},'conditions':{'type':Sequelize[_0x9695('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x6f57=['sequelize','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6f57,0xc0));var _0x76f5=function(_0x1000ba,_0x40dfd3){_0x1000ba=_0x1000ba-0x0;var _0x3382dc=_0x6f57[_0x1000ba];return _0x3382dc;};'use strict';var Sequelize=require(_0x76f5('0x0'));module['exports']={'name':{'type':Sequelize[_0x76f5('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x76f5('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 94caa6c..e2cbef7 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 _0x725e=['send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','name','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','count','includeAll','findAll','rows','catch','show','include','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','join','left_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','table','MetricId','metric','field','function','format','replace','groupBy','orderBy','alias','joins','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','right_join','COUNT(%s)','GROUP_CONCAT(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','AnalyticMetric','from','DESC','web','%s-%s.%s','randomstring','generate','output','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','COUNT(DISTINCT\x20%s)','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','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','sendStatus','end','status','offset','set','Content-Range','json','apply','save','then','destroy','get','CustomReports','error','stack'];(function(_0x57b405,_0x2d1d1d){var _0x4e6680=function(_0x16aecc){while(--_0x16aecc){_0x57b405['push'](_0x57b405['shift']());}};_0x4e6680(++_0x2d1d1d);}(_0x725e,0x12a));var _0xe725=function(_0x55f6b3,_0x452907){_0x55f6b3=_0x55f6b3-0x0;var _0x1dd332=_0x725e[_0x55f6b3];return _0x1dd332;};'use strict';var pdf=require(_0xe725('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe725('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe725('0x2'));var moment=require(_0xe725('0x3'));var BPromise=require(_0xe725('0x4'));var Mustache=require(_0xe725('0x5'));var util=require('util');var path=require(_0xe725('0x6'));var sox=require(_0xe725('0x7'));var csv=require(_0xe725('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe725('0x9'));var jsforce=require(_0xe725('0xa'));var deskjs=require(_0xe725('0xb'));var toCsv=require(_0xe725('0x8'));var querystring=require(_0xe725('0xc'));var Papa=require(_0xe725('0xd'));var Redis=require(_0xe725('0xe'));var authService=require(_0xe725('0xf'));var qs=require(_0xe725('0x10'));var as=require(_0xe725('0x11'));var hardwareService=require(_0xe725('0x12'));var logger=require(_0xe725('0x13'))(_0xe725('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe725('0x15'));var db=require(_0xe725('0x16'))['db'];var dbH=require(_0xe725('0x16'))['dbH'];function respondWithStatusCode(_0x405fa4,_0x19bdd1){_0x19bdd1=_0x19bdd1||0xcc;return function(_0x2e103f){if(_0x2e103f){return _0x405fa4[_0xe725('0x17')](_0x19bdd1);}return _0x405fa4['status'](_0x19bdd1)[_0xe725('0x18')]();};}function respondWithResult(_0x63764d,_0xd6140d){_0xd6140d=_0xd6140d||0xc8;return function(_0xfc6010){if(_0xfc6010){return _0x63764d[_0xe725('0x19')](_0xd6140d)['json'](_0xfc6010);}};}function respondWithFilteredResult(_0x29fde8,_0x1dfa6b){return function(_0x15d79a){if(_0x15d79a){var _0xfe0c2d=_0x15d79a['count'],_0x45330e=_0x1dfa6b[_0xe725('0x1a')],_0xee5a26=_0x1dfa6b['offset']+_0x1dfa6b['limit'],_0x1dea8d;if(_0xee5a26>=_0xfe0c2d){_0xee5a26=_0xfe0c2d;_0x1dea8d=0xc8;}else{_0x1dea8d=0xce;}_0x29fde8[_0xe725('0x19')](_0x1dea8d);return _0x29fde8[_0xe725('0x1b')](_0xe725('0x1c'),_0x45330e+'-'+_0xee5a26+'/'+_0xfe0c2d)[_0xe725('0x1d')](_0x15d79a);}return null;};}function patchUpdates(_0x212a1b){return function(_0x46e20a){try{jsonpatch[_0xe725('0x1e')](_0x46e20a,_0x212a1b,!![]);}catch(_0x45d977){return BPromise['reject'](_0x45d977);}return _0x46e20a[_0xe725('0x1f')]();};}function saveUpdates(_0x3e8743,_0x14944b){return function(_0x588fef){if(_0x588fef){return _0x588fef['update'](_0x3e8743)[_0xe725('0x20')](function(_0x5eed28){return _0x5eed28;});}return null;};}function removeEntity(_0x580db9,_0x55b669){return function(_0x566739){if(_0x566739){return _0x566739[_0xe725('0x21')]()[_0xe725('0x20')](function(){var _0xd2cb82=_0x566739[_0xe725('0x22')]({'plain':!![]});var _0x453518=_0xe725('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x453518,'resourceId':_0xd2cb82['id']}})['then'](function(){return _0x566739;});})[_0xe725('0x20')](function(){_0x580db9['status'](0xcc)[_0xe725('0x18')]();});}};}function handleEntityNotFound(_0x3d73c3,_0x52e1c4){return function(_0x1ef958){if(!_0x1ef958){_0x3d73c3[_0xe725('0x17')](0x194);}return _0x1ef958;};}function handleError(_0x2cdfc0,_0x4e171c){_0x4e171c=_0x4e171c||0x1f4;return function(_0x273a1a){logger[_0xe725('0x24')](_0x273a1a[_0xe725('0x25')]);if(_0x273a1a['name']){delete _0x273a1a['name'];}_0x2cdfc0[_0xe725('0x19')](_0x4e171c)[_0xe725('0x26')](_0x273a1a);};}exports[_0xe725('0x27')]=function(_0xed9f9b,_0x104ac8){var _0x2cce6d={},_0xb28e03={},_0x24172d={'count':0x0,'rows':[]};var _0x233f7c=_[_0xe725('0x28')](db[_0xe725('0x29')][_0xe725('0x2a')],function(_0xd5cf04){return{'name':_0xd5cf04[_0xe725('0x2b')],'type':_0xd5cf04[_0xe725('0x2c')][_0xe725('0x2d')]};});_0xb28e03['model']=_[_0xe725('0x28')](_0x233f7c,_0xe725('0x2e'));_0xb28e03[_0xe725('0x2f')]=_[_0xe725('0x30')](_0xed9f9b['query']);_0xb28e03['filters']=_[_0xe725('0x31')](_0xb28e03[_0xe725('0x32')],_0xb28e03[_0xe725('0x2f')]);_0x2cce6d[_0xe725('0x33')]=_[_0xe725('0x31')](_0xb28e03[_0xe725('0x32')],qs[_0xe725('0x34')](_0xed9f9b[_0xe725('0x2f')][_0xe725('0x34')]));_0x2cce6d['attributes']=_0x2cce6d[_0xe725('0x33')][_0xe725('0x35')]?_0x2cce6d[_0xe725('0x33')]:_0xb28e03[_0xe725('0x32')];if(!_0xed9f9b['query'][_0xe725('0x36')](_0xe725('0x37'))){_0x2cce6d['limit']=qs[_0xe725('0x38')](_0xed9f9b[_0xe725('0x2f')][_0xe725('0x38')]);_0x2cce6d[_0xe725('0x1a')]=qs[_0xe725('0x1a')](_0xed9f9b[_0xe725('0x2f')][_0xe725('0x1a')]);}_0x2cce6d[_0xe725('0x39')]=qs[_0xe725('0x3a')](_0xed9f9b[_0xe725('0x2f')][_0xe725('0x3a')]);_0x2cce6d[_0xe725('0x3b')]=qs[_0xe725('0x3c')](_[_0xe725('0x3d')](_0xed9f9b[_0xe725('0x2f')],_0xb28e03['filters']),_0x233f7c);if(_0xed9f9b[_0xe725('0x2f')][_0xe725('0x3e')]){_0x2cce6d[_0xe725('0x3b')]=_['merge'](_0x2cce6d[_0xe725('0x3b')],{'$or':_['map'](_0x233f7c,function(_0x1c6ee0){if(_0x1c6ee0['type']!==_0xe725('0x3f')){var _0x30f23f={};_0x30f23f[_0x1c6ee0[_0xe725('0x2e')]]={'$like':'%'+_0xed9f9b[_0xe725('0x2f')][_0xe725('0x3e')]+'%'};return _0x30f23f;}})});}_0x2cce6d=_['merge']({},_0x2cce6d,_0xed9f9b['options']);var _0xc94acc={'where':_0x2cce6d[_0xe725('0x3b')]};return db['AnalyticCustomReport']['count'](_0xc94acc)[_0xe725('0x20')](function(_0x3ba772){_0x24172d[_0xe725('0x40')]=_0x3ba772;if(_0xed9f9b[_0xe725('0x2f')][_0xe725('0x41')]){_0x2cce6d['include']=[{'all':!![]}];}return db[_0xe725('0x29')][_0xe725('0x42')](_0x2cce6d);})['then'](function(_0x100de){_0x24172d[_0xe725('0x43')]=_0x100de;return _0x24172d;})[_0xe725('0x20')](respondWithFilteredResult(_0x104ac8,_0x2cce6d))[_0xe725('0x44')](handleError(_0x104ac8,null));};exports[_0xe725('0x45')]=function(_0x550a7f,_0x39c9cc){var _0x23e77c={'raw':![],'where':{'id':_0x550a7f['params']['id']}},_0x4ab92d={};_0x4ab92d[_0xe725('0x32')]=_['keys'](db['AnalyticCustomReport'][_0xe725('0x2a')]);_0x4ab92d[_0xe725('0x2f')]=_[_0xe725('0x30')](_0x550a7f[_0xe725('0x2f')]);_0x4ab92d[_0xe725('0x3c')]=_[_0xe725('0x31')](_0x4ab92d[_0xe725('0x32')],_0x4ab92d[_0xe725('0x2f')]);_0x23e77c[_0xe725('0x33')]=_[_0xe725('0x31')](_0x4ab92d['model'],qs[_0xe725('0x34')](_0x550a7f[_0xe725('0x2f')][_0xe725('0x34')]));_0x23e77c[_0xe725('0x33')]=_0x23e77c[_0xe725('0x33')][_0xe725('0x35')]?_0x23e77c[_0xe725('0x33')]:_0x4ab92d[_0xe725('0x32')];if(_0x550a7f[_0xe725('0x2f')][_0xe725('0x41')]){_0x23e77c[_0xe725('0x46')]=[{'all':!![]}];}_0x23e77c=_[_0xe725('0x47')]({},_0x23e77c,_0x550a7f[_0xe725('0x48')]);return db['AnalyticCustomReport'][_0xe725('0x49')](_0x23e77c)[_0xe725('0x20')](handleEntityNotFound(_0x39c9cc,null))[_0xe725('0x20')](respondWithResult(_0x39c9cc,null))[_0xe725('0x44')](handleError(_0x39c9cc,null));};exports[_0xe725('0x4a')]=function(_0x20f17f,_0x8de98c){return db[_0xe725('0x29')][_0xe725('0x4a')](_0x20f17f[_0xe725('0x4b')],{})[_0xe725('0x20')](function(_0x4eb980){var _0x512332=_0x20f17f['user'][_0xe725('0x22')]({'plain':!![]});if(!_0x512332)throw new Error(_0xe725('0x4c'));if(_0x512332[_0xe725('0x4d')]===_0xe725('0x4e')){var _0x17b2e3=_0x4eb980[_0xe725('0x22')]({'plain':!![]});var _0x28ae7c=_0xe725('0x4f');return db[_0xe725('0x50')][_0xe725('0x49')]({'where':{'name':_0x28ae7c,'userProfileId':_0x512332['userProfileId']},'raw':!![]})['then'](function(_0x3046af){if(_0x3046af&&_0x3046af[_0xe725('0x51')]===0x0){return db[_0xe725('0x52')][_0xe725('0x4a')]({'name':_0x17b2e3[_0xe725('0x2e')],'resourceId':_0x17b2e3['id'],'type':_0xe725('0x23'),'sectionId':_0x3046af['id']},{})[_0xe725('0x20')](function(){return _0x4eb980;});}else{return _0x4eb980;}})['catch'](function(_0x298712){logger[_0xe725('0x24')](_0xe725('0x53'),_0x298712);throw _0x298712;});}return _0x4eb980;})[_0xe725('0x20')](respondWithResult(_0x8de98c,0xc9))[_0xe725('0x44')](handleError(_0x8de98c,null));};exports[_0xe725('0x54')]=function(_0x32691a,_0x5c8ed4){if(_0x32691a['body']['id']){delete _0x32691a[_0xe725('0x4b')]['id'];}return db[_0xe725('0x29')][_0xe725('0x49')]({'where':{'id':_0x32691a[_0xe725('0x55')]['id']}})[_0xe725('0x20')](handleEntityNotFound(_0x5c8ed4,null))[_0xe725('0x20')](saveUpdates(_0x32691a[_0xe725('0x4b')],null))[_0xe725('0x20')](respondWithResult(_0x5c8ed4,null))[_0xe725('0x44')](handleError(_0x5c8ed4,null));};exports[_0xe725('0x21')]=function(_0x13f672,_0x53d4d0){return db['AnalyticCustomReport'][_0xe725('0x49')]({'where':{'id':_0x13f672['params']['id']}})['then'](handleEntityNotFound(_0x53d4d0,null))[_0xe725('0x20')](removeEntity(_0x53d4d0,null))['catch'](handleError(_0x53d4d0,null));};exports['preview']=function(_0x3774b0,_0x52da9f){var _0x1298e9=0xa;var _0x10dfb2=[_0xe725('0x56'),_0xe725('0x57'),'right_join',_0xe725('0x58')];var _0x508f61={'SUM':_0xe725('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe725('0x5a'),'MIN':_0xe725('0x5b'),'AVG':_0xe725('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xe725('0x5d'),'GROUP_CONCAT DESC':_0xe725('0x5e')};var _0x38a2c1={'SEC_TO_TIME':_0xe725('0x5f'),'DATE':_0xe725('0x60'),'HOUR':_0xe725('0x61'),'ROUND':_0xe725('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x167d7d=function(_0x57f940){return!_['includes']([_0xe725('0x63'),_0xe725('0x64'),_0xe725('0x65'),'IS\x20NOT\x20EMPTY'],_0x57f940);};var _0x2b27a4=function(_0x3481ba){if(!_0x3481ba||!_0x3481ba[_0xe725('0x66')][_0xe725('0x35')]){return'';}for(var _0x354357='(',_0x471237=0x0;_0x471237<_0x3481ba[_0xe725('0x66')][_0xe725('0x35')];_0x471237+=0x1){_0x471237>0x0&&(_0x354357+='\x20'+_0x3481ba[_0xe725('0x67')]+'\x20');_0x354357+=_0x3481ba[_0xe725('0x66')][_0x471237][_0xe725('0x68')]?_0x2b27a4(_0x3481ba['rules'][_0x471237][_0xe725('0x68')]):_0x3481ba[_0xe725('0x66')][_0x471237]['field']+'\x20'+_0x3481ba[_0xe725('0x66')][_0x471237][_0xe725('0x69')]+(_0x167d7d(_0x3481ba[_0xe725('0x66')][_0x471237]['condition'])?'\x20'+_0x3481ba['rules'][_0x471237][_0xe725('0x6a')]:'');}return _0x354357+')';};var _0x5cb381={'where':{'id':_0x3774b0['params']['id']}},_0x302293,_0x1080f9,_0x592de4,_0x5bf597,_0x3cd382;_0x5cb381=_[_0xe725('0x47')]({},_0x5cb381,_0x3774b0['options']);return db[_0xe725('0x29')]['find'](_0x5cb381)[_0xe725('0x20')](function(_0x55d7b4){if(_0x55d7b4){_0x302293=_0x55d7b4;return _0x55d7b4[_0xe725('0x6b')]();}return null;})[_0xe725('0x20')](function(_0x121022){if(_0x121022){if(!_0x121022[_0xe725('0x35')]){throw new db[(_0xe725('0x6c'))][(_0xe725('0x6d'))](_0xe725('0x6e'),0x193);}_0x1080f9=_0x121022;return db['AnalyticMetric'][_0xe725('0x42')]({'raw':!![]});}return null;})[_0xe725('0x20')](function(_0x32713e){if(_0x32713e){_0x592de4=_[_0xe725('0x6f')](_0x32713e,'id');var _0x5eab3e;var _0x21b909=squel[_0xe725('0x70')]();_0x21b909['from'](_0x302293[_0xe725('0x71')]);for(var _0x2b0d07=0x0;_0x2b0d07<_0x1080f9['length'];_0x2b0d07+=0x1){_0x5eab3e=_0x1080f9[_0x2b0d07]['MetricId']?_0x592de4[_0x1080f9[_0x2b0d07][_0xe725('0x72')]][_0xe725('0x73')]:_0x1080f9[_0x2b0d07][_0xe725('0x74')];_0x5eab3e=_0x1080f9[_0x2b0d07][_0xe725('0x75')]?_['replace'](_0x508f61[_0x1080f9[_0x2b0d07][_0xe725('0x75')]],'%s',_0x5eab3e):_0x5eab3e;_0x5eab3e=_0x1080f9[_0x2b0d07][_0xe725('0x76')]?_[_0xe725('0x77')](_0x38a2c1[_0x1080f9[_0x2b0d07]['format']],'%s',_0x5eab3e):_0x5eab3e;if(_0x1080f9[_0x2b0d07][_0xe725('0x78')]){_0x21b909[_0xe725('0x68')](_0x5eab3e);}_0x1080f9[_0x2b0d07][_0xe725('0x79')]&&_0x21b909['order'](_0x5eab3e,_0x1080f9[_0x2b0d07][_0xe725('0x79')]==='DESC'?![]:!![]);_0x21b909[_0xe725('0x74')](_0x5eab3e,_0x1080f9[_0x2b0d07][_0xe725('0x7a')]||_0x5eab3e);}if(_0x302293[_0xe725('0x7b')]){_0x302293[_0xe725('0x7b')]=JSON['parse'](_0x302293[_0xe725('0x7b')]);for(var _0x524450=0x0;_0x524450<_0x302293[_0xe725('0x7b')][_0xe725('0x35')];_0x524450+=0x1){if(_0x302293[_0xe725('0x7b')][_0x524450][_0xe725('0x2c')]&&_[_0xe725('0x7c')](_0x10dfb2,_0x302293['joins'][_0x524450][_0xe725('0x2c')])&&_0x302293['joins'][_0x524450][_0xe725('0x7d')]&&_0x302293[_0xe725('0x7b')][_0x524450][_0xe725('0x7e')]&&_0x302293['joins'][_0x524450]['foreignKey']){_0x21b909[_0x302293[_0xe725('0x7b')][_0x524450]['type']](_0x302293[_0xe725('0x7b')][_0x524450]['foreignTable'],null,util['format'](_0xe725('0x7f'),_0x302293[_0xe725('0x71')],_0x302293['joins'][_0x524450]['parentKey'],_0x302293['joins'][_0x524450][_0xe725('0x7e')],_0x302293[_0xe725('0x7b')][_0x524450][_0xe725('0x80')]));}}}if(_0x302293[_0xe725('0x81')]){_0x302293[_0xe725('0x81')]=JSON[_0xe725('0x82')](_0x302293[_0xe725('0x81')]);_0x21b909['where'](_0x2b27a4(_0x302293[_0xe725('0x81')][_0xe725('0x68')]));}_0x3cd382=_0x21b909[_0xe725('0x83')]();_0x21b909[_0xe725('0x38')](_0x1298e9);_0x21b909['offset'](0x0);logger[_0xe725('0x84')](_0xe725('0x85'),_0x21b909[_0xe725('0x86')]());return dbH[_0xe725('0x87')][_0xe725('0x2f')](_0x21b909[_0xe725('0x86')](),{'type':dbH[_0xe725('0x87')][_0xe725('0x88')][_0xe725('0x89')]});}})[_0xe725('0x20')](respondWithResult(_0x52da9f,null))['catch'](handleError(_0x52da9f,null));};function runReport(_0x5af73b,_0x5d81b4,_0x1e3160){var _0x43a662=_0x5d81b4[_0xe725('0x2e')];var _0x1a017f=0xa;var _0x200e01=[_0xe725('0x56'),_0xe725('0x57'),_0xe725('0x8a'),_0xe725('0x58')];var _0x365f6a={'SUM':'SUM(%s)','COUNT':_0xe725('0x8b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe725('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xe725('0x8c'),'GROUP_CONCAT ASC':_0xe725('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x19f4b5={'SEC_TO_TIME':_0xe725('0x5f'),'DATE':_0xe725('0x60'),'HOUR':_0xe725('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xe725('0x8d')};var _0x401ec7=function(_0x2af53c){return!_[_0xe725('0x7c')]([_0xe725('0x63'),_0xe725('0x64'),_0xe725('0x65'),_0xe725('0x8e')],_0x2af53c);};var _0xa838a5=function(_0x1d2d6f){if(!_0x1d2d6f||!_0x1d2d6f['rules'][_0xe725('0x35')]){return'';}for(var _0x2607c6='(',_0x1ede9c=0x0;_0x1ede9c<_0x1d2d6f[_0xe725('0x66')][_0xe725('0x35')];_0x1ede9c+=0x1){_0x1ede9c>0x0&&(_0x2607c6+='\x20'+_0x1d2d6f['operator']+'\x20');_0x2607c6+=_0x1d2d6f[_0xe725('0x66')][_0x1ede9c][_0xe725('0x68')]?_0xa838a5(_0x1d2d6f['rules'][_0x1ede9c][_0xe725('0x68')]):_0x1d2d6f[_0xe725('0x66')][_0x1ede9c][_0xe725('0x74')]+'\x20'+_0x1d2d6f['rules'][_0x1ede9c][_0xe725('0x69')]+(_0x401ec7(_0x1d2d6f[_0xe725('0x66')][_0x1ede9c][_0xe725('0x69')])?'\x20'+_0x1d2d6f[_0xe725('0x66')][_0x1ede9c]['value']:'');}return _0x2607c6+')';};var _0x35a86a={'where':{'id':_0x5af73b['id']}},_0x2b8c75,_0x534202,_0x327d94,_0x1cdfb1,_0x268ddc;_0x35a86a=_['merge']({},_0x35a86a,_0x1e3160);return db[_0xe725('0x29')][_0xe725('0x49')](_0x35a86a)[_0xe725('0x20')](function(_0x2c91e4){if(_0x2c91e4){_0x2b8c75=_0x2c91e4;return _0x2c91e4[_0xe725('0x6b')]();}return null;})[_0xe725('0x20')](function(_0x5684b8){if(_0x5684b8){if(!_0x5684b8[_0xe725('0x35')]){throw new db[(_0xe725('0x6c'))][(_0xe725('0x6d'))](_0xe725('0x6e'),0x193);}_0x534202=_0x5684b8;return db[_0xe725('0x8f')][_0xe725('0x42')]({'raw':!![]});}return null;})[_0xe725('0x20')](function(_0x42b636){if(_0x42b636){_0x327d94=_[_0xe725('0x6f')](_0x42b636,'id');var _0x10a5d6;var _0x3cff14=squel[_0xe725('0x70')]();_0x3cff14[_0xe725('0x90')](_0x2b8c75['table']);for(var _0x436aed=0x0;_0x436aed<_0x534202['length'];_0x436aed+=0x1){_0x10a5d6=_0x534202[_0x436aed][_0xe725('0x72')]?_0x327d94[_0x534202[_0x436aed][_0xe725('0x72')]][_0xe725('0x73')]:_0x534202[_0x436aed]['field'];_0x10a5d6=_0x534202[_0x436aed][_0xe725('0x75')]?_[_0xe725('0x77')](_0x365f6a[_0x534202[_0x436aed]['function']],'%s',_0x10a5d6):_0x10a5d6;_0x10a5d6=_0x534202[_0x436aed][_0xe725('0x76')]?_['replace'](_0x19f4b5[_0x534202[_0x436aed][_0xe725('0x76')]],'%s',_0x10a5d6):_0x10a5d6;if(_0x534202[_0x436aed][_0xe725('0x78')]){_0x3cff14['group'](_0x10a5d6);}_0x534202[_0x436aed]['orderBy']&&_0x3cff14[_0xe725('0x39')](_0x10a5d6,_0x534202[_0x436aed]['orderBy']===_0xe725('0x91')?![]:!![]);_0x3cff14[_0xe725('0x74')](_0x10a5d6,_0x534202[_0x436aed]['alias']||_0x10a5d6);}if(_0x2b8c75[_0xe725('0x7b')]){_0x2b8c75[_0xe725('0x7b')]=JSON[_0xe725('0x82')](_0x2b8c75['joins']);for(var _0x53bd9f=0x0;_0x53bd9f<_0x2b8c75[_0xe725('0x7b')][_0xe725('0x35')];_0x53bd9f+=0x1){if(_0x2b8c75[_0xe725('0x7b')][_0x53bd9f]['type']&&_[_0xe725('0x7c')](_0x200e01,_0x2b8c75[_0xe725('0x7b')][_0x53bd9f][_0xe725('0x2c')])&&_0x2b8c75['joins'][_0x53bd9f]['parentKey']&&_0x2b8c75[_0xe725('0x7b')][_0x53bd9f][_0xe725('0x7e')]&&_0x2b8c75[_0xe725('0x7b')][_0x53bd9f][_0xe725('0x80')]){_0x3cff14[_0x2b8c75[_0xe725('0x7b')][_0x53bd9f][_0xe725('0x2c')]](_0x2b8c75[_0xe725('0x7b')][_0x53bd9f]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2b8c75[_0xe725('0x71')],_0x2b8c75[_0xe725('0x7b')][_0x53bd9f][_0xe725('0x7d')],_0x2b8c75[_0xe725('0x7b')][_0x53bd9f][_0xe725('0x7e')],_0x2b8c75[_0xe725('0x7b')][_0x53bd9f][_0xe725('0x80')]));}}}if(_0x2b8c75[_0xe725('0x81')]){_0x2b8c75[_0xe725('0x81')]=JSON[_0xe725('0x82')](_0x2b8c75['conditions']);_0x3cff14[_0xe725('0x3b')](_0xa838a5(_0x2b8c75[_0xe725('0x81')]['group']));}_0x268ddc=_0x3cff14[_0xe725('0x83')]();_0x3cff14[_0xe725('0x38')](_0x1a017f);_0x3cff14[_0xe725('0x1a')](0x0);return;}})[_0xe725('0x20')](function(){if(_0x5d81b4['output']===_0xe725('0x92')){return null;}var _0x41b7e1=_[_0xe725('0x47')](_0x5d81b4,{'name':_0x5d81b4['fullPath']||_0x5d81b4[_0xe725('0x2e')]||_0x2b8c75[_0xe725('0x2e')],'basename':_0x43a662,'savename':util['format'](_0xe725('0x93'),_0x5d81b4[_0xe725('0x2e')]||_0x2b8c75[_0xe725('0x2e')],require(_0xe725('0x94'))[_0xe725('0x95')](0x4),_0x5d81b4[_0xe725('0x96')]||_0xe725('0x97')),'reportId':_0x2b8c75['id'],'reportType':_0xe725('0x98')});return db[_0xe725('0x99')][_0xe725('0x4a')](_0x41b7e1,{'raw':!![]});})[_0xe725('0x20')](function(_0x4e1d2d){if(_0x2b8c75['table']===_0xe725('0x9a')){_0x268ddc[_0xe725('0x3b')](_0x2b8c75['table']+_0xe725('0x9b'),_0x5d81b4['startDate'],_0x5d81b4[_0xe725('0x9c')]);}else{_0x268ddc['where'](_0x2b8c75['table']+_0xe725('0x9d'),_0x5d81b4[_0xe725('0x9e')],_0x5d81b4[_0xe725('0x9c')]);}if(_0x4e1d2d){logger[_0xe725('0x9f')]('Run\x20Query:',_0x268ddc[_0xe725('0x86')]());require(_0xe725('0xa0'))['fork'](path[_0xe725('0x56')](__dirname,_0xe725('0xa1'),_0x4e1d2d[_0xe725('0x96')]),[_0x4e1d2d['id'],_0x268ddc['toString'](),path['join'](__dirname,_0xe725('0xa2'),_0x4e1d2d[_0xe725('0xa3')]),_0x43a662]);return _0x4e1d2d;}else{var _0x48b6b7=squel[_0xe725('0x70')]();_0x48b6b7['from']('('+_0x268ddc[_0xe725('0x86')]()+')',_0xe725('0xa4'));_0x48b6b7[_0xe725('0x74')](_0xe725('0xa5'),_0xe725('0x40'));_0x268ddc['limit'](_0x5d81b4['limit']||_0x1a017f);_0x268ddc[_0xe725('0x1a')](_0x5d81b4[_0xe725('0x1a')]||0x0);return dbH['sequelize'][_0xe725('0x2f')](_0x48b6b7[_0xe725('0x86')](),{'type':dbH[_0xe725('0x87')]['QueryTypes'][_0xe725('0x89')]})[_0xe725('0x20')](function(_0x36d696){if(!_0x36d696[_0xe725('0x35')]){_0x1cdfb1=0x0;}else{_0x1cdfb1=_0x36d696[0x0][_0xe725('0x40')]||0x0;}return dbH['sequelize'][_0xe725('0x2f')](_0x268ddc['toString'](),{'type':dbH[_0xe725('0x87')][_0xe725('0x88')][_0xe725('0x89')]});})[_0xe725('0x20')](function(_0xf4ae5){return{'rows':_0xf4ae5||[],'count':_0x1cdfb1};});}});}exports['run']=function(_0x4c5281,_0x3377f0){return runReport(_0x4c5281[_0xe725('0x55')],_0x4c5281['query'],_0x4c5281['options'])[_0xe725('0x20')](respondWithResult(_0x3377f0,null))[_0xe725('0x44')](handleError(_0x3377f0,null));};exports[_0xe725('0xa6')]=runReport;exports[_0xe725('0x2f')]=function(_0x261890,_0x197c5d){var _0x550760=0xa;var _0xdc9b12=[_0xe725('0x56'),'left_join',_0xe725('0x8a'),'cross_join'];var _0x499362={'SUM':_0xe725('0x59'),'COUNT':_0xe725('0x8b'),'COUNT DISTINCT':_0xe725('0xa7'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xe725('0x5c'),'GROUP_CONCAT':_0xe725('0x8c'),'GROUP_CONCAT ASC':_0xe725('0x5d'),'GROUP_CONCAT DESC':_0xe725('0x5e')};var _0x436192={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xe725('0x61'),'ROUND':_0xe725('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x23427c=function(_0x586f95){return!_[_0xe725('0x7c')]([_0xe725('0x63'),_0xe725('0x64'),_0xe725('0x65'),_0xe725('0x8e')],_0x586f95);};var _0x7f7a51=function(_0x49e2fe){if(!_0x49e2fe||!_0x49e2fe['rules'][_0xe725('0x35')]){return'';}for(var _0x351f7f='(',_0x3185d0=0x0;_0x3185d0<_0x49e2fe[_0xe725('0x66')][_0xe725('0x35')];_0x3185d0+=0x1){_0x3185d0>0x0&&(_0x351f7f+='\x20'+_0x49e2fe[_0xe725('0x67')]+'\x20');_0x351f7f+=_0x49e2fe[_0xe725('0x66')][_0x3185d0][_0xe725('0x68')]?_0x7f7a51(_0x49e2fe[_0xe725('0x66')][_0x3185d0]['group']):_0x49e2fe['rules'][_0x3185d0][_0xe725('0x74')]+'\x20'+_0x49e2fe[_0xe725('0x66')][_0x3185d0]['condition']+(_0x23427c(_0x49e2fe[_0xe725('0x66')][_0x3185d0][_0xe725('0x69')])?'\x20'+_0x49e2fe[_0xe725('0x66')][_0x3185d0][_0xe725('0x6a')]:'');}return _0x351f7f+')';};var _0x19357d={'where':{'id':_0x261890['params']['id']}},_0x1e714d,_0x134ff4,_0x273195,_0x3e5b61,_0x17c330;_0x19357d=_[_0xe725('0x47')]({},_0x19357d,_0x261890[_0xe725('0x48')]);return db['AnalyticCustomReport'][_0xe725('0x49')](_0x19357d)[_0xe725('0x20')](function(_0x533f3d){if(_0x533f3d){_0x1e714d=_0x533f3d;return _0x533f3d[_0xe725('0x6b')]();}return null;})[_0xe725('0x20')](function(_0x2b82a3){if(_0x2b82a3){if(!_0x2b82a3[_0xe725('0x35')]){throw new db['Sequelize']['ValidationErrorItem'](_0xe725('0x6e'),0x193);}_0x134ff4=_0x2b82a3;return db[_0xe725('0x8f')]['findAll']({'raw':!![]});}return null;})[_0xe725('0x20')](function(_0x290ff5){if(_0x290ff5){_0x273195=_[_0xe725('0x6f')](_0x290ff5,'id');var _0xfeb0d3;var _0x2a2777=squel[_0xe725('0x70')]();_0x2a2777[_0xe725('0x90')](_0x1e714d['table']);for(var _0x1a270d=0x0;_0x1a270d<_0x134ff4['length'];_0x1a270d+=0x1){_0xfeb0d3=_0x134ff4[_0x1a270d]['MetricId']?_0x273195[_0x134ff4[_0x1a270d][_0xe725('0x72')]]['metric']:_0x134ff4[_0x1a270d]['field'];_0xfeb0d3=_0x134ff4[_0x1a270d][_0xe725('0x75')]?_[_0xe725('0x77')](_0x499362[_0x134ff4[_0x1a270d]['function']],'%s',_0xfeb0d3):_0xfeb0d3;_0xfeb0d3=_0x134ff4[_0x1a270d][_0xe725('0x76')]?_['replace'](_0x436192[_0x134ff4[_0x1a270d][_0xe725('0x76')]],'%s',_0xfeb0d3):_0xfeb0d3;if(_0x134ff4[_0x1a270d]['groupBy']){_0x2a2777[_0xe725('0x68')](_0xfeb0d3);}_0x134ff4[_0x1a270d][_0xe725('0x79')]&&_0x2a2777[_0xe725('0x39')](_0xfeb0d3,_0x134ff4[_0x1a270d][_0xe725('0x79')]==='DESC'?![]:!![]);_0x2a2777['field'](_0xfeb0d3,_0x134ff4[_0x1a270d][_0xe725('0x7a')]||_0xfeb0d3);}if(_0x1e714d['joins']){_0x1e714d[_0xe725('0x7b')]=JSON[_0xe725('0x82')](_0x1e714d[_0xe725('0x7b')]);for(var _0x40629d=0x0;_0x40629d<_0x1e714d[_0xe725('0x7b')]['length'];_0x40629d+=0x1){if(_0x1e714d[_0xe725('0x7b')][_0x40629d][_0xe725('0x2c')]&&_[_0xe725('0x7c')](_0xdc9b12,_0x1e714d[_0xe725('0x7b')][_0x40629d][_0xe725('0x2c')])&&_0x1e714d['joins'][_0x40629d]['parentKey']&&_0x1e714d[_0xe725('0x7b')][_0x40629d][_0xe725('0x7e')]&&_0x1e714d['joins'][_0x40629d][_0xe725('0x80')]){_0x2a2777[_0x1e714d[_0xe725('0x7b')][_0x40629d][_0xe725('0x2c')]](_0x1e714d[_0xe725('0x7b')][_0x40629d][_0xe725('0x7e')],null,util[_0xe725('0x76')](_0xe725('0x7f'),_0x1e714d[_0xe725('0x71')],_0x1e714d[_0xe725('0x7b')][_0x40629d]['parentKey'],_0x1e714d[_0xe725('0x7b')][_0x40629d][_0xe725('0x7e')],_0x1e714d[_0xe725('0x7b')][_0x40629d][_0xe725('0x80')]));}}}if(_0x1e714d[_0xe725('0x81')]){_0x1e714d[_0xe725('0x81')]=JSON[_0xe725('0x82')](_0x1e714d[_0xe725('0x81')]);_0x2a2777[_0xe725('0x3b')](_0x7f7a51(_0x1e714d[_0xe725('0x81')][_0xe725('0x68')]));}_0x17c330=_0x2a2777[_0xe725('0x83')]();_0x2a2777[_0xe725('0x38')](_0x550760);_0x2a2777['offset'](0x0);logger[_0xe725('0x84')](_0xe725('0x85'),_0x2a2777[_0xe725('0x86')]());return dbH[_0xe725('0x87')][_0xe725('0x2f')](_0x2a2777[_0xe725('0x86')](),{'type':dbH['sequelize'][_0xe725('0x88')][_0xe725('0x89')]});}})[_0xe725('0x20')](function(){return{'sql':_0x17c330[_0xe725('0x86')]()};})[_0xe725('0x20')](respondWithResult(_0x197c5d,null))[_0xe725('0x44')](handleError(_0x197c5d,null));}; \ No newline at end of file +var _0x1179=['reject','save','update','then','destroy','get','CustomReports','UserProfileResource','sendStatus','stack','name','AnalyticCustomReport','rawAttributes','fieldName','type','key','map','keys','filters','intersection','query','attributes','fields','length','model','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','params','includeAll','find','create','body','Reports','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','rules','operator','field','condition','value','getFields','Sequelize','AnalyticMetric','select','from','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','table','conditions','group','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','IS\x20NOT\x20EMPTY','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','includes','%s.%s\x20=\x20%s.%s','output','web','randomstring','csv','custom','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','savename','countTable','COUNT(*)','run','runReport','right_join','IS\x20NOT\x20NULL','groupBy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','dbH','status','end','offset','limit','set','Content-Range','json','apply'];(function(_0x2c74e5,_0x2f9a66){var _0x3ea53c=function(_0x5bf845){while(--_0x5bf845){_0x2c74e5['push'](_0x2c74e5['shift']());}};_0x3ea53c(++_0x2f9a66);}(_0x1179,0x7e));var _0x9117=function(_0x47415b,_0x2edd0b){_0x47415b=_0x47415b-0x0;var _0x33f971=_0x1179[_0x47415b];return _0x33f971;};'use strict';var pdf=require(_0x9117('0x0'));var emlformat=require(_0x9117('0x1'));var rimraf=require(_0x9117('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9117('0x3'));var rp=require(_0x9117('0x4'));var moment=require(_0x9117('0x5'));var BPromise=require(_0x9117('0x6'));var Mustache=require(_0x9117('0x7'));var util=require(_0x9117('0x8'));var path=require(_0x9117('0x9'));var sox=require(_0x9117('0xa'));var csv=require(_0x9117('0xb'));var ejs=require(_0x9117('0xc'));var fs=require('fs');var _=require(_0x9117('0xd'));var squel=require('squel');var crypto=require(_0x9117('0xe'));var jsforce=require(_0x9117('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9117('0x10'));var Redis=require('ioredis');var authService=require(_0x9117('0x11'));var qs=require(_0x9117('0x12'));var as=require(_0x9117('0x13'));var hardwareService=require(_0x9117('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x9117('0x15'));var config=require(_0x9117('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9117('0x17'))['db'];var dbH=require(_0x9117('0x17'))[_0x9117('0x18')];function respondWithStatusCode(_0x171eec,_0x4b849b){_0x4b849b=_0x4b849b||0xcc;return function(_0x3581ce){if(_0x3581ce){return _0x171eec['sendStatus'](_0x4b849b);}return _0x171eec[_0x9117('0x19')](_0x4b849b)[_0x9117('0x1a')]();};}function respondWithResult(_0x710109,_0x22b51b){_0x22b51b=_0x22b51b||0xc8;return function(_0x130e98){if(_0x130e98){return _0x710109[_0x9117('0x19')](_0x22b51b)['json'](_0x130e98);}};}function respondWithFilteredResult(_0x384f9f,_0x402194){return function(_0x3f71fd){if(_0x3f71fd){var _0x4f30a0=_0x3f71fd['count'],_0x562a35=_0x402194[_0x9117('0x1b')],_0x562b14=_0x402194[_0x9117('0x1b')]+_0x402194[_0x9117('0x1c')],_0x45c484;if(_0x562b14>=_0x4f30a0){_0x562b14=_0x4f30a0;_0x45c484=0xc8;}else{_0x45c484=0xce;}_0x384f9f[_0x9117('0x19')](_0x45c484);return _0x384f9f[_0x9117('0x1d')](_0x9117('0x1e'),_0x562a35+'-'+_0x562b14+'/'+_0x4f30a0)[_0x9117('0x1f')](_0x3f71fd);}return null;};}function patchUpdates(_0x4ddc6d){return function(_0x3f404c){try{jsonpatch[_0x9117('0x20')](_0x3f404c,_0x4ddc6d,!![]);}catch(_0x1436bd){return BPromise[_0x9117('0x21')](_0x1436bd);}return _0x3f404c[_0x9117('0x22')]();};}function saveUpdates(_0x5a1246,_0x24fdfe){return function(_0x25b53c){if(_0x25b53c){return _0x25b53c[_0x9117('0x23')](_0x5a1246)[_0x9117('0x24')](function(_0x416043){return _0x416043;});}return null;};}function removeEntity(_0x4bc3b1,_0x2f8766){return function(_0x503f94){if(_0x503f94){return _0x503f94[_0x9117('0x25')]()[_0x9117('0x24')](function(){var _0x4be2f=_0x503f94[_0x9117('0x26')]({'plain':!![]});var _0x13d414=_0x9117('0x27');return db[_0x9117('0x28')][_0x9117('0x25')]({'where':{'type':_0x13d414,'resourceId':_0x4be2f['id']}})['then'](function(){return _0x503f94;});})[_0x9117('0x24')](function(){_0x4bc3b1[_0x9117('0x19')](0xcc)[_0x9117('0x1a')]();});}};}function handleEntityNotFound(_0x59f478,_0x26844c){return function(_0x2835dd){if(!_0x2835dd){_0x59f478[_0x9117('0x29')](0x194);}return _0x2835dd;};}function handleError(_0x485757,_0x448b3d){_0x448b3d=_0x448b3d||0x1f4;return function(_0x59c9c1){logger['error'](_0x59c9c1[_0x9117('0x2a')]);if(_0x59c9c1[_0x9117('0x2b')]){delete _0x59c9c1[_0x9117('0x2b')];}_0x485757['status'](_0x448b3d)['send'](_0x59c9c1);};}exports['index']=function(_0x4ab041,_0x21f3e0){var _0x2bde23={},_0x332e0e={},_0x16e354={'count':0x0,'rows':[]};var _0x1980b5=_['map'](db[_0x9117('0x2c')][_0x9117('0x2d')],function(_0x4b5c61){return{'name':_0x4b5c61[_0x9117('0x2e')],'type':_0x4b5c61[_0x9117('0x2f')][_0x9117('0x30')]};});_0x332e0e['model']=_[_0x9117('0x31')](_0x1980b5,_0x9117('0x2b'));_0x332e0e['query']=_[_0x9117('0x32')](_0x4ab041['query']);_0x332e0e[_0x9117('0x33')]=_[_0x9117('0x34')](_0x332e0e['model'],_0x332e0e[_0x9117('0x35')]);_0x2bde23[_0x9117('0x36')]=_[_0x9117('0x34')](_0x332e0e['model'],qs[_0x9117('0x37')](_0x4ab041[_0x9117('0x35')][_0x9117('0x37')]));_0x2bde23[_0x9117('0x36')]=_0x2bde23['attributes'][_0x9117('0x38')]?_0x2bde23[_0x9117('0x36')]:_0x332e0e[_0x9117('0x39')];if(!_0x4ab041[_0x9117('0x35')][_0x9117('0x3a')]('nolimit')){_0x2bde23[_0x9117('0x1c')]=qs['limit'](_0x4ab041[_0x9117('0x35')][_0x9117('0x1c')]);_0x2bde23[_0x9117('0x1b')]=qs[_0x9117('0x1b')](_0x4ab041[_0x9117('0x35')][_0x9117('0x1b')]);}_0x2bde23[_0x9117('0x3b')]=qs[_0x9117('0x3c')](_0x4ab041[_0x9117('0x35')]['sort']);_0x2bde23[_0x9117('0x3d')]=qs[_0x9117('0x33')](_[_0x9117('0x3e')](_0x4ab041['query'],_0x332e0e['filters']),_0x1980b5);if(_0x4ab041[_0x9117('0x35')][_0x9117('0x3f')]){_0x2bde23[_0x9117('0x3d')]=_[_0x9117('0x40')](_0x2bde23[_0x9117('0x3d')],{'$or':_['map'](_0x1980b5,function(_0x20bc15){if(_0x20bc15[_0x9117('0x2f')]!==_0x9117('0x41')){var _0x2b7fe5={};_0x2b7fe5[_0x20bc15[_0x9117('0x2b')]]={'$like':'%'+_0x4ab041[_0x9117('0x35')][_0x9117('0x3f')]+'%'};return _0x2b7fe5;}})});}_0x2bde23=_['merge']({},_0x2bde23,_0x4ab041[_0x9117('0x42')]);var _0x1868a1={'where':_0x2bde23[_0x9117('0x3d')]};return db[_0x9117('0x2c')][_0x9117('0x43')](_0x1868a1)[_0x9117('0x24')](function(_0xd95829){_0x16e354[_0x9117('0x43')]=_0xd95829;if(_0x4ab041[_0x9117('0x35')]['includeAll']){_0x2bde23[_0x9117('0x44')]=[{'all':!![]}];}return db[_0x9117('0x2c')][_0x9117('0x45')](_0x2bde23);})[_0x9117('0x24')](function(_0x52d264){_0x16e354[_0x9117('0x46')]=_0x52d264;return _0x16e354;})[_0x9117('0x24')](respondWithFilteredResult(_0x21f3e0,_0x2bde23))[_0x9117('0x47')](handleError(_0x21f3e0,null));};exports['show']=function(_0x31b9c8,_0x277aac){var _0x4c43ac={'raw':![],'where':{'id':_0x31b9c8[_0x9117('0x48')]['id']}},_0x5b52cf={};_0x5b52cf[_0x9117('0x39')]=_['keys'](db[_0x9117('0x2c')][_0x9117('0x2d')]);_0x5b52cf['query']=_[_0x9117('0x32')](_0x31b9c8[_0x9117('0x35')]);_0x5b52cf[_0x9117('0x33')]=_[_0x9117('0x34')](_0x5b52cf['model'],_0x5b52cf[_0x9117('0x35')]);_0x4c43ac[_0x9117('0x36')]=_[_0x9117('0x34')](_0x5b52cf['model'],qs['fields'](_0x31b9c8['query']['fields']));_0x4c43ac['attributes']=_0x4c43ac[_0x9117('0x36')]['length']?_0x4c43ac[_0x9117('0x36')]:_0x5b52cf[_0x9117('0x39')];if(_0x31b9c8['query'][_0x9117('0x49')]){_0x4c43ac[_0x9117('0x44')]=[{'all':!![]}];}_0x4c43ac=_[_0x9117('0x40')]({},_0x4c43ac,_0x31b9c8[_0x9117('0x42')]);return db[_0x9117('0x2c')][_0x9117('0x4a')](_0x4c43ac)['then'](handleEntityNotFound(_0x277aac,null))[_0x9117('0x24')](respondWithResult(_0x277aac,null))[_0x9117('0x47')](handleError(_0x277aac,null));};exports['create']=function(_0x1cc5a6,_0xc8a0ec){return db['AnalyticCustomReport'][_0x9117('0x4b')](_0x1cc5a6[_0x9117('0x4c')],{})[_0x9117('0x24')](function(_0x147dee){var _0x254a0f=_0x1cc5a6['user']['get']({'plain':!![]});if(!_0x254a0f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x254a0f['role']==='user'){var _0x46e7de=_0x147dee[_0x9117('0x26')]({'plain':!![]});var _0x25dad3=_0x9117('0x4d');return db[_0x9117('0x4e')]['find']({'where':{'name':_0x25dad3,'userProfileId':_0x254a0f['userProfileId']},'raw':!![]})['then'](function(_0x1a1808){if(_0x1a1808&&_0x1a1808['autoAssociation']===0x0){return db[_0x9117('0x28')]['create']({'name':_0x46e7de[_0x9117('0x2b')],'resourceId':_0x46e7de['id'],'type':_0x9117('0x27'),'sectionId':_0x1a1808['id']},{})['then'](function(){return _0x147dee;});}else{return _0x147dee;}})['catch'](function(_0x53ac45){logger[_0x9117('0x4f')](_0x9117('0x50'),_0x53ac45);throw _0x53ac45;});}return _0x147dee;})[_0x9117('0x24')](respondWithResult(_0xc8a0ec,0xc9))['catch'](handleError(_0xc8a0ec,null));};exports[_0x9117('0x23')]=function(_0x3b6ac5,_0x5a9b9d){if(_0x3b6ac5[_0x9117('0x4c')]['id']){delete _0x3b6ac5[_0x9117('0x4c')]['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x3b6ac5[_0x9117('0x48')]['id']}})[_0x9117('0x24')](handleEntityNotFound(_0x5a9b9d,null))[_0x9117('0x24')](saveUpdates(_0x3b6ac5[_0x9117('0x4c')],null))[_0x9117('0x24')](respondWithResult(_0x5a9b9d,null))[_0x9117('0x47')](handleError(_0x5a9b9d,null));};exports[_0x9117('0x25')]=function(_0x2695b2,_0x5e8658){return db['AnalyticCustomReport'][_0x9117('0x4a')]({'where':{'id':_0x2695b2[_0x9117('0x48')]['id']}})[_0x9117('0x24')](handleEntityNotFound(_0x5e8658,null))[_0x9117('0x24')](removeEntity(_0x5e8658,null))[_0x9117('0x47')](handleError(_0x5e8658,null));};exports[_0x9117('0x51')]=function(_0x51de32,_0x4e743d){var _0x4fd343=0xa;var _0x3f03f7=['join',_0x9117('0x52'),'right_join',_0x9117('0x53')];var _0x3ece4c={'SUM':_0x9117('0x54'),'COUNT':_0x9117('0x55'),'COUNT DISTINCT':_0x9117('0x56'),'MAX':_0x9117('0x57'),'MIN':_0x9117('0x58'),'AVG':_0x9117('0x59'),'GROUP_CONCAT':_0x9117('0x5a'),'GROUP_CONCAT ASC':_0x9117('0x5b'),'GROUP_CONCAT DESC':_0x9117('0x5c')};var _0x2f4641={'SEC_TO_TIME':_0x9117('0x5d'),'DATE':_0x9117('0x5e'),'HOUR':_0x9117('0x5f'),'ROUND':_0x9117('0x60'),'UNIX_TIMESTAMP':_0x9117('0x61')};var _0x32cd13=function(_0x4380ae){return!_['includes']([_0x9117('0x62'),'IS\x20NOT\x20NULL',_0x9117('0x63'),'IS\x20NOT\x20EMPTY'],_0x4380ae);};var _0x508e03=function(_0x4ceb72){if(!_0x4ceb72||!_0x4ceb72[_0x9117('0x64')][_0x9117('0x38')]){return'';}for(var _0x357e98='(',_0x285f18=0x0;_0x285f18<_0x4ceb72[_0x9117('0x64')][_0x9117('0x38')];_0x285f18+=0x1){_0x285f18>0x0&&(_0x357e98+='\x20'+_0x4ceb72[_0x9117('0x65')]+'\x20');_0x357e98+=_0x4ceb72[_0x9117('0x64')][_0x285f18]['group']?_0x508e03(_0x4ceb72[_0x9117('0x64')][_0x285f18]['group']):_0x4ceb72[_0x9117('0x64')][_0x285f18][_0x9117('0x66')]+'\x20'+_0x4ceb72['rules'][_0x285f18]['condition']+(_0x32cd13(_0x4ceb72[_0x9117('0x64')][_0x285f18][_0x9117('0x67')])?'\x20'+_0x4ceb72[_0x9117('0x64')][_0x285f18][_0x9117('0x68')]:'');}return _0x357e98+')';};var _0x161f24={'where':{'id':_0x51de32[_0x9117('0x48')]['id']}},_0x352c53,_0x3d6dab,_0x5c73c2,_0xcc678f,_0xa04cd4;_0x161f24=_[_0x9117('0x40')]({},_0x161f24,_0x51de32['options']);return db[_0x9117('0x2c')][_0x9117('0x4a')](_0x161f24)[_0x9117('0x24')](function(_0x33424f){if(_0x33424f){_0x352c53=_0x33424f;return _0x33424f[_0x9117('0x69')]();}return null;})['then'](function(_0x6593b0){if(_0x6593b0){if(!_0x6593b0[_0x9117('0x38')]){throw new db[(_0x9117('0x6a'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3d6dab=_0x6593b0;return db[_0x9117('0x6b')][_0x9117('0x45')]({'raw':!![]});}return null;})['then'](function(_0x33f762){if(_0x33f762){_0x5c73c2=_['keyBy'](_0x33f762,'id');var _0x3ce21f;var _0x4be3ea=squel[_0x9117('0x6c')]();_0x4be3ea[_0x9117('0x6d')](_0x352c53['table']);for(var _0x5927c8=0x0;_0x5927c8<_0x3d6dab[_0x9117('0x38')];_0x5927c8+=0x1){_0x3ce21f=_0x3d6dab[_0x5927c8][_0x9117('0x6e')]?_0x5c73c2[_0x3d6dab[_0x5927c8][_0x9117('0x6e')]][_0x9117('0x6f')]:_0x3d6dab[_0x5927c8][_0x9117('0x66')];_0x3ce21f=_0x3d6dab[_0x5927c8]['function']?_['replace'](_0x3ece4c[_0x3d6dab[_0x5927c8][_0x9117('0x70')]],'%s',_0x3ce21f):_0x3ce21f;_0x3ce21f=_0x3d6dab[_0x5927c8]['format']?_[_0x9117('0x71')](_0x2f4641[_0x3d6dab[_0x5927c8][_0x9117('0x72')]],'%s',_0x3ce21f):_0x3ce21f;if(_0x3d6dab[_0x5927c8]['groupBy']){_0x4be3ea['group'](_0x3ce21f);}_0x3d6dab[_0x5927c8][_0x9117('0x73')]&&_0x4be3ea['order'](_0x3ce21f,_0x3d6dab[_0x5927c8][_0x9117('0x73')]===_0x9117('0x74')?![]:!![]);_0x4be3ea[_0x9117('0x66')](_0x3ce21f,_0x3d6dab[_0x5927c8][_0x9117('0x75')]||_0x3ce21f);}if(_0x352c53[_0x9117('0x76')]){_0x352c53[_0x9117('0x76')]=JSON[_0x9117('0x77')](_0x352c53['joins']);for(var _0x36337b=0x0;_0x36337b<_0x352c53[_0x9117('0x76')][_0x9117('0x38')];_0x36337b+=0x1){if(_0x352c53[_0x9117('0x76')][_0x36337b]['type']&&_['includes'](_0x3f03f7,_0x352c53[_0x9117('0x76')][_0x36337b][_0x9117('0x2f')])&&_0x352c53[_0x9117('0x76')][_0x36337b][_0x9117('0x78')]&&_0x352c53[_0x9117('0x76')][_0x36337b][_0x9117('0x79')]&&_0x352c53[_0x9117('0x76')][_0x36337b][_0x9117('0x7a')]){_0x4be3ea[_0x352c53[_0x9117('0x76')][_0x36337b][_0x9117('0x2f')]](_0x352c53['joins'][_0x36337b][_0x9117('0x79')],null,util[_0x9117('0x72')]('%s.%s\x20=\x20%s.%s',_0x352c53[_0x9117('0x7b')],_0x352c53['joins'][_0x36337b]['parentKey'],_0x352c53[_0x9117('0x76')][_0x36337b][_0x9117('0x79')],_0x352c53['joins'][_0x36337b][_0x9117('0x7a')]));}}}if(_0x352c53[_0x9117('0x7c')]){_0x352c53['conditions']=JSON['parse'](_0x352c53[_0x9117('0x7c')]);_0x4be3ea[_0x9117('0x3d')](_0x508e03(_0x352c53[_0x9117('0x7c')][_0x9117('0x7d')]));}_0xa04cd4=_0x4be3ea[_0x9117('0x7e')]();_0x4be3ea[_0x9117('0x1c')](_0x4fd343);_0x4be3ea[_0x9117('0x1b')](0x0);logger[_0x9117('0x7f')](_0x9117('0x80'),_0x4be3ea[_0x9117('0x81')]());return dbH[_0x9117('0x82')][_0x9117('0x35')](_0x4be3ea[_0x9117('0x81')](),{'type':dbH[_0x9117('0x82')][_0x9117('0x83')][_0x9117('0x84')]});}})[_0x9117('0x24')](respondWithResult(_0x4e743d,null))[_0x9117('0x47')](handleError(_0x4e743d,null));};function runReport(_0x2263ef,_0x1923e2,_0x5ace92){var _0x2bb259=_0x1923e2[_0x9117('0x2b')];var _0x3caf0=0xa;var _0x46f226=[_0x9117('0x85'),_0x9117('0x52'),'right_join',_0x9117('0x53')];var _0x5a2026={'SUM':_0x9117('0x54'),'COUNT':_0x9117('0x55'),'COUNT DISTINCT':_0x9117('0x56'),'MAX':_0x9117('0x57'),'MIN':_0x9117('0x58'),'AVG':_0x9117('0x59'),'GROUP_CONCAT':_0x9117('0x5a'),'GROUP_CONCAT ASC':_0x9117('0x5b'),'GROUP_CONCAT DESC':_0x9117('0x5c')};var _0x51c060={'SEC_TO_TIME':_0x9117('0x5d'),'DATE':_0x9117('0x5e'),'HOUR':_0x9117('0x5f'),'ROUND':_0x9117('0x60'),'UNIX_TIMESTAMP':_0x9117('0x61')};var _0x1fa731=function(_0x13278a){return!_['includes']([_0x9117('0x62'),'IS\x20NOT\x20NULL',_0x9117('0x63'),_0x9117('0x86')],_0x13278a);};var _0x53bea0=function(_0x410532){if(!_0x410532||!_0x410532[_0x9117('0x64')]['length']){return'';}for(var _0x600600='(',_0x4c7149=0x0;_0x4c7149<_0x410532[_0x9117('0x64')][_0x9117('0x38')];_0x4c7149+=0x1){_0x4c7149>0x0&&(_0x600600+='\x20'+_0x410532[_0x9117('0x65')]+'\x20');_0x600600+=_0x410532[_0x9117('0x64')][_0x4c7149][_0x9117('0x7d')]?_0x53bea0(_0x410532[_0x9117('0x64')][_0x4c7149]['group']):_0x410532[_0x9117('0x64')][_0x4c7149]['field']+'\x20'+_0x410532[_0x9117('0x64')][_0x4c7149]['condition']+(_0x1fa731(_0x410532[_0x9117('0x64')][_0x4c7149]['condition'])?'\x20'+_0x410532['rules'][_0x4c7149][_0x9117('0x68')]:'');}return _0x600600+')';};var _0x55285a={'where':{'id':_0x2263ef['id']}},_0x287cf6,_0x1c8533,_0x2d8770,_0x4c9d27,_0x2c4f26;_0x55285a=_[_0x9117('0x40')]({},_0x55285a,_0x5ace92);return db[_0x9117('0x2c')]['find'](_0x55285a)['then'](function(_0x36b549){if(_0x36b549){_0x287cf6=_0x36b549;return _0x36b549['getFields']();}return null;})[_0x9117('0x24')](function(_0x589000){if(_0x589000){if(!_0x589000[_0x9117('0x38')]){throw new db[(_0x9117('0x6a'))][(_0x9117('0x87'))](_0x9117('0x88'),0x193);}_0x1c8533=_0x589000;return db['AnalyticMetric'][_0x9117('0x45')]({'raw':!![]});}return null;})['then'](function(_0x3bd355){if(_0x3bd355){_0x2d8770=_[_0x9117('0x89')](_0x3bd355,'id');var _0x10df32;var _0x37718e=squel[_0x9117('0x6c')]();_0x37718e[_0x9117('0x6d')](_0x287cf6[_0x9117('0x7b')]);for(var _0x434f15=0x0;_0x434f15<_0x1c8533[_0x9117('0x38')];_0x434f15+=0x1){_0x10df32=_0x1c8533[_0x434f15][_0x9117('0x6e')]?_0x2d8770[_0x1c8533[_0x434f15][_0x9117('0x6e')]][_0x9117('0x6f')]:_0x1c8533[_0x434f15][_0x9117('0x66')];_0x10df32=_0x1c8533[_0x434f15][_0x9117('0x70')]?_[_0x9117('0x71')](_0x5a2026[_0x1c8533[_0x434f15][_0x9117('0x70')]],'%s',_0x10df32):_0x10df32;_0x10df32=_0x1c8533[_0x434f15][_0x9117('0x72')]?_[_0x9117('0x71')](_0x51c060[_0x1c8533[_0x434f15][_0x9117('0x72')]],'%s',_0x10df32):_0x10df32;if(_0x1c8533[_0x434f15]['groupBy']){_0x37718e['group'](_0x10df32);}_0x1c8533[_0x434f15][_0x9117('0x73')]&&_0x37718e[_0x9117('0x3b')](_0x10df32,_0x1c8533[_0x434f15]['orderBy']===_0x9117('0x74')?![]:!![]);_0x37718e[_0x9117('0x66')](_0x10df32,_0x1c8533[_0x434f15][_0x9117('0x75')]||_0x10df32);}if(_0x287cf6[_0x9117('0x76')]){_0x287cf6['joins']=JSON[_0x9117('0x77')](_0x287cf6[_0x9117('0x76')]);for(var _0x31fd3b=0x0;_0x31fd3b<_0x287cf6[_0x9117('0x76')][_0x9117('0x38')];_0x31fd3b+=0x1){if(_0x287cf6[_0x9117('0x76')][_0x31fd3b][_0x9117('0x2f')]&&_[_0x9117('0x8a')](_0x46f226,_0x287cf6[_0x9117('0x76')][_0x31fd3b][_0x9117('0x2f')])&&_0x287cf6[_0x9117('0x76')][_0x31fd3b]['parentKey']&&_0x287cf6[_0x9117('0x76')][_0x31fd3b][_0x9117('0x79')]&&_0x287cf6['joins'][_0x31fd3b][_0x9117('0x7a')]){_0x37718e[_0x287cf6['joins'][_0x31fd3b]['type']](_0x287cf6[_0x9117('0x76')][_0x31fd3b]['foreignTable'],null,util[_0x9117('0x72')](_0x9117('0x8b'),_0x287cf6[_0x9117('0x7b')],_0x287cf6[_0x9117('0x76')][_0x31fd3b][_0x9117('0x78')],_0x287cf6[_0x9117('0x76')][_0x31fd3b][_0x9117('0x79')],_0x287cf6['joins'][_0x31fd3b][_0x9117('0x7a')]));}}}if(_0x287cf6[_0x9117('0x7c')]){_0x287cf6[_0x9117('0x7c')]=JSON[_0x9117('0x77')](_0x287cf6[_0x9117('0x7c')]);_0x37718e[_0x9117('0x3d')](_0x53bea0(_0x287cf6[_0x9117('0x7c')]['group']));}_0x2c4f26=_0x37718e[_0x9117('0x7e')]();_0x37718e['limit'](_0x3caf0);_0x37718e[_0x9117('0x1b')](0x0);return;}})[_0x9117('0x24')](function(){if(_0x1923e2[_0x9117('0x8c')]===_0x9117('0x8d')){return null;}var _0x5d9e62=_[_0x9117('0x40')](_0x1923e2,{'name':_0x1923e2['fullPath']||_0x1923e2[_0x9117('0x2b')]||_0x287cf6['name'],'basename':_0x2bb259,'savename':util[_0x9117('0x72')]('%s-%s.%s',_0x1923e2[_0x9117('0x2b')]||_0x287cf6[_0x9117('0x2b')],require(_0x9117('0x8e'))['generate'](0x4),_0x1923e2['output']||_0x9117('0x8f')),'reportId':_0x287cf6['id'],'reportType':_0x9117('0x90')});return db[_0x9117('0x91')][_0x9117('0x4b')](_0x5d9e62,{'raw':!![]});})[_0x9117('0x24')](function(_0x2415c1){if(_0x287cf6[_0x9117('0x7b')]==='cdr'){_0x2c4f26[_0x9117('0x3d')](_0x287cf6[_0x9117('0x7b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1923e2[_0x9117('0x92')],_0x1923e2[_0x9117('0x93')]);}else{_0x2c4f26['where'](_0x287cf6[_0x9117('0x7b')]+_0x9117('0x94'),_0x1923e2[_0x9117('0x92')],_0x1923e2[_0x9117('0x93')]);}if(_0x2415c1){logger[_0x9117('0x95')]('Run\x20Query:',_0x2c4f26[_0x9117('0x81')]());require(_0x9117('0x96'))['fork'](path[_0x9117('0x85')](__dirname,'../../components/export/',_0x2415c1[_0x9117('0x8c')]),[_0x2415c1['id'],_0x2c4f26[_0x9117('0x81')](),path[_0x9117('0x85')](__dirname,'../../files/reports',_0x2415c1[_0x9117('0x97')]),_0x2bb259]);return _0x2415c1;}else{var _0x97797b=squel[_0x9117('0x6c')]();_0x97797b[_0x9117('0x6d')]('('+_0x2c4f26[_0x9117('0x81')]()+')',_0x9117('0x98'));_0x97797b[_0x9117('0x66')](_0x9117('0x99'),'count');_0x2c4f26[_0x9117('0x1c')](_0x1923e2[_0x9117('0x1c')]||_0x3caf0);_0x2c4f26[_0x9117('0x1b')](_0x1923e2[_0x9117('0x1b')]||0x0);return dbH['sequelize']['query'](_0x97797b[_0x9117('0x81')](),{'type':dbH[_0x9117('0x82')]['QueryTypes']['SELECT']})[_0x9117('0x24')](function(_0xceae03){if(!_0xceae03[_0x9117('0x38')]){_0x4c9d27=0x0;}else{_0x4c9d27=_0xceae03[0x0][_0x9117('0x43')]||0x0;}return dbH[_0x9117('0x82')][_0x9117('0x35')](_0x2c4f26[_0x9117('0x81')](),{'type':dbH[_0x9117('0x82')][_0x9117('0x83')]['SELECT']});})[_0x9117('0x24')](function(_0x4e1b6d){return{'rows':_0x4e1b6d||[],'count':_0x4c9d27};});}});}exports[_0x9117('0x9a')]=function(_0x1404b3,_0xe557e1){return runReport(_0x1404b3[_0x9117('0x48')],_0x1404b3['query'],_0x1404b3[_0x9117('0x42')])[_0x9117('0x24')](respondWithResult(_0xe557e1,null))[_0x9117('0x47')](handleError(_0xe557e1,null));};exports[_0x9117('0x9b')]=runReport;exports[_0x9117('0x35')]=function(_0x315150,_0x1017e1){var _0x71e46c=0xa;var _0x1bdf6c=[_0x9117('0x85'),'left_join',_0x9117('0x9c'),_0x9117('0x53')];var _0x5a5b07={'SUM':_0x9117('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9117('0x56'),'MAX':_0x9117('0x57'),'MIN':_0x9117('0x58'),'AVG':_0x9117('0x59'),'GROUP_CONCAT':_0x9117('0x5a'),'GROUP_CONCAT ASC':_0x9117('0x5b'),'GROUP_CONCAT DESC':_0x9117('0x5c')};var _0x491bcc={'SEC_TO_TIME':_0x9117('0x5d'),'DATE':_0x9117('0x5e'),'HOUR':_0x9117('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9117('0x61')};var _0xd59469=function(_0xcf9288){return!_[_0x9117('0x8a')]([_0x9117('0x62'),_0x9117('0x9d'),_0x9117('0x63'),_0x9117('0x86')],_0xcf9288);};var _0x36223c=function(_0x14c398){if(!_0x14c398||!_0x14c398['rules'][_0x9117('0x38')]){return'';}for(var _0x29b1f5='(',_0x5acccf=0x0;_0x5acccf<_0x14c398['rules']['length'];_0x5acccf+=0x1){_0x5acccf>0x0&&(_0x29b1f5+='\x20'+_0x14c398[_0x9117('0x65')]+'\x20');_0x29b1f5+=_0x14c398[_0x9117('0x64')][_0x5acccf]['group']?_0x36223c(_0x14c398[_0x9117('0x64')][_0x5acccf][_0x9117('0x7d')]):_0x14c398[_0x9117('0x64')][_0x5acccf][_0x9117('0x66')]+'\x20'+_0x14c398['rules'][_0x5acccf][_0x9117('0x67')]+(_0xd59469(_0x14c398[_0x9117('0x64')][_0x5acccf][_0x9117('0x67')])?'\x20'+_0x14c398[_0x9117('0x64')][_0x5acccf][_0x9117('0x68')]:'');}return _0x29b1f5+')';};var _0x94f585={'where':{'id':_0x315150['params']['id']}},_0x556af6,_0x3db825,_0x4fde18,_0x4f8416,_0x3f68aa;_0x94f585=_['merge']({},_0x94f585,_0x315150[_0x9117('0x42')]);return db[_0x9117('0x2c')]['find'](_0x94f585)[_0x9117('0x24')](function(_0x5553dc){if(_0x5553dc){_0x556af6=_0x5553dc;return _0x5553dc[_0x9117('0x69')]();}return null;})[_0x9117('0x24')](function(_0x37417e){if(_0x37417e){if(!_0x37417e['length']){throw new db[(_0x9117('0x6a'))][(_0x9117('0x87'))](_0x9117('0x88'),0x193);}_0x3db825=_0x37417e;return db['AnalyticMetric'][_0x9117('0x45')]({'raw':!![]});}return null;})[_0x9117('0x24')](function(_0x5165d7){if(_0x5165d7){_0x4fde18=_[_0x9117('0x89')](_0x5165d7,'id');var _0x281bf4;var _0x49163f=squel[_0x9117('0x6c')]();_0x49163f[_0x9117('0x6d')](_0x556af6[_0x9117('0x7b')]);for(var _0x165273=0x0;_0x165273<_0x3db825[_0x9117('0x38')];_0x165273+=0x1){_0x281bf4=_0x3db825[_0x165273][_0x9117('0x6e')]?_0x4fde18[_0x3db825[_0x165273]['MetricId']][_0x9117('0x6f')]:_0x3db825[_0x165273][_0x9117('0x66')];_0x281bf4=_0x3db825[_0x165273][_0x9117('0x70')]?_[_0x9117('0x71')](_0x5a5b07[_0x3db825[_0x165273][_0x9117('0x70')]],'%s',_0x281bf4):_0x281bf4;_0x281bf4=_0x3db825[_0x165273][_0x9117('0x72')]?_[_0x9117('0x71')](_0x491bcc[_0x3db825[_0x165273][_0x9117('0x72')]],'%s',_0x281bf4):_0x281bf4;if(_0x3db825[_0x165273][_0x9117('0x9e')]){_0x49163f[_0x9117('0x7d')](_0x281bf4);}_0x3db825[_0x165273]['orderBy']&&_0x49163f['order'](_0x281bf4,_0x3db825[_0x165273][_0x9117('0x73')]==='DESC'?![]:!![]);_0x49163f['field'](_0x281bf4,_0x3db825[_0x165273]['alias']||_0x281bf4);}if(_0x556af6['joins']){_0x556af6[_0x9117('0x76')]=JSON[_0x9117('0x77')](_0x556af6[_0x9117('0x76')]);for(var _0x1faaa8=0x0;_0x1faaa8<_0x556af6[_0x9117('0x76')]['length'];_0x1faaa8+=0x1){if(_0x556af6[_0x9117('0x76')][_0x1faaa8]['type']&&_[_0x9117('0x8a')](_0x1bdf6c,_0x556af6[_0x9117('0x76')][_0x1faaa8]['type'])&&_0x556af6['joins'][_0x1faaa8][_0x9117('0x78')]&&_0x556af6[_0x9117('0x76')][_0x1faaa8]['foreignTable']&&_0x556af6[_0x9117('0x76')][_0x1faaa8][_0x9117('0x7a')]){_0x49163f[_0x556af6[_0x9117('0x76')][_0x1faaa8]['type']](_0x556af6[_0x9117('0x76')][_0x1faaa8][_0x9117('0x79')],null,util[_0x9117('0x72')](_0x9117('0x8b'),_0x556af6[_0x9117('0x7b')],_0x556af6[_0x9117('0x76')][_0x1faaa8][_0x9117('0x78')],_0x556af6['joins'][_0x1faaa8][_0x9117('0x79')],_0x556af6[_0x9117('0x76')][_0x1faaa8][_0x9117('0x7a')]));}}}if(_0x556af6['conditions']){_0x556af6['conditions']=JSON['parse'](_0x556af6['conditions']);_0x49163f[_0x9117('0x3d')](_0x36223c(_0x556af6[_0x9117('0x7c')]['group']));}_0x3f68aa=_0x49163f['clone']();_0x49163f[_0x9117('0x1c')](_0x71e46c);_0x49163f[_0x9117('0x1b')](0x0);logger[_0x9117('0x7f')](_0x9117('0x80'),_0x49163f[_0x9117('0x81')]());return dbH[_0x9117('0x82')]['query'](_0x49163f[_0x9117('0x81')](),{'type':dbH[_0x9117('0x82')][_0x9117('0x83')]['SELECT']});}})[_0x9117('0x24')](function(){return{'sql':_0x3f68aa['toString']()};})[_0x9117('0x24')](respondWithResult(_0x1017e1,null))[_0x9117('0x47')](handleError(_0x1017e1,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index a3544c8..8a2fbc2 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 _0x5e91=['lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport'];(function(_0xf7e7e4,_0x317d54){var _0x1c7009=function(_0x536d99){while(--_0x536d99){_0xf7e7e4['push'](_0xf7e7e4['shift']());}};_0x1c7009(++_0x317d54);}(_0x5e91,0x1b8));var _0x15e9=function(_0x18b6a6,_0xe0ee41){_0x18b6a6=_0x18b6a6-0x0;var _0x109350=_0x5e91[_0x18b6a6];return _0x109350;};'use strict';var _=require(_0x15e9('0x0'));var util=require('util');var logger=require(_0x15e9('0x1'))(_0x15e9('0x2'));var moment=require('moment');var BPromise=require(_0x15e9('0x3'));var rp=require(_0x15e9('0x4'));var fs=require('fs');var path=require(_0x15e9('0x5'));var rimraf=require('rimraf');var config=require(_0x15e9('0x6'));var attributes=require(_0x15e9('0x7'));module[_0x15e9('0x8')]=function(_0x2c91e5,_0x1db645){return _0x2c91e5[_0x15e9('0x9')](_0x15e9('0xa'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8708=['AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticCustomReport.attributes','exports','define'];(function(_0x3beab6,_0x4d46b1){var _0x543aba=function(_0x58dbc4){while(--_0x58dbc4){_0x3beab6['push'](_0x3beab6['shift']());}};_0x543aba(++_0x4d46b1);}(_0x8708,0x1f0));var _0x8870=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x8708[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require(_0x8870('0x0'));var logger=require(_0x8870('0x1'))(_0x8870('0x2'));var moment=require(_0x8870('0x3'));var BPromise=require(_0x8870('0x4'));var rp=require(_0x8870('0x5'));var fs=require('fs');var path=require(_0x8870('0x6'));var rimraf=require(_0x8870('0x7'));var config=require('../../config/environment');var attributes=require(_0x8870('0x8'));module[_0x8870('0x9')]=function(_0xd007dc,_0x55a620){return _0xd007dc[_0x8870('0xa')](_0x8870('0xb'),attributes,{'tableName':_0x8870('0xc'),'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 cc9fea4..eb9c854 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 _0xbb09=['result','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x3734bc,_0xf0ad5f){var _0x5d965c=function(_0x2573a8){while(--_0x2573a8){_0x3734bc['push'](_0x3734bc['shift']());}};_0x5d965c(++_0xf0ad5f);}(_0xbb09,0x1aa));var _0x9bb0=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0xbb09[_0xcd0918];return _0x250704;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9bb0('0x0'));var db=require(_0x9bb0('0x1'))['db'];var utils=require(_0x9bb0('0x2'));var logger=require(_0x9bb0('0x3'))(_0x9bb0('0x4'));var config=require(_0x9bb0('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x9bb0('0x6')][_0x9bb0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x416dba,_0xb21679,_0x12c864){return new BPromise(function(_0x42f7db,_0x379504){return client[_0x9bb0('0x8')](_0x416dba,_0x12c864)[_0x9bb0('0x9')](function(_0x3f50b3){logger[_0x9bb0('0xa')](_0x9bb0('0xb'),_0xb21679,_0x9bb0('0xc'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0xb21679,'request\x20sent',JSON['stringify'](_0x3f50b3));if(_0x3f50b3[_0x9bb0('0xd')]){if(_0x3f50b3[_0x9bb0('0xd')][_0x9bb0('0xe')]===0x1f4){logger[_0x9bb0('0xd')](_0x9bb0('0xb'),_0xb21679,_0x3f50b3[_0x9bb0('0xd')][_0x9bb0('0xf')]);return _0x379504(_0x3f50b3[_0x9bb0('0xd')][_0x9bb0('0xf')]);}logger[_0x9bb0('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0xb21679,_0x3f50b3[_0x9bb0('0xd')][_0x9bb0('0xf')]);return _0x42f7db(_0x3f50b3['error']['message']);}else{logger[_0x9bb0('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0xb21679,_0x9bb0('0xc'));_0x42f7db(_0x3f50b3[_0x9bb0('0x10')][_0x9bb0('0xf')]);}})['catch'](function(_0x2f183c){logger['error'](_0x9bb0('0xb'),_0xb21679,_0x2f183c);_0x379504(_0x2f183c);});});} \ No newline at end of file +var _0xfd1c=['error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4c804d,_0x1dc974){var _0x233e42=function(_0x134326){while(--_0x134326){_0x4c804d['push'](_0x4c804d['shift']());}};_0x233e42(++_0x1dc974);}(_0xfd1c,0x1d0));var _0xcfd1=function(_0x44f974,_0x4db616){_0x44f974=_0x44f974-0x0;var _0x805dbd=_0xfd1c[_0x44f974];return _0x805dbd;};'use strict';var _=require(_0xcfd1('0x0'));var util=require('util');var moment=require(_0xcfd1('0x1'));var BPromise=require(_0xcfd1('0x2'));var rs=require(_0xcfd1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcfd1('0x4'))['db'];var utils=require(_0xcfd1('0x5'));var logger=require(_0xcfd1('0x6'))(_0xcfd1('0x7'));var config=require('../../config/environment');var jayson=require(_0xcfd1('0x8'));var client=jayson[_0xcfd1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50cca1,_0x5a7433,_0x2b734f){return new BPromise(function(_0x5eab4a,_0x23f080){return client[_0xcfd1('0xa')](_0x50cca1,_0x2b734f)[_0xcfd1('0xb')](function(_0x5672eb){logger[_0xcfd1('0xc')](_0xcfd1('0xd'),_0x5a7433,_0xcfd1('0xe'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x5a7433,'request\x20sent',JSON[_0xcfd1('0xf')](_0x5672eb));if(_0x5672eb['error']){if(_0x5672eb[_0xcfd1('0x10')]['code']===0x1f4){logger[_0xcfd1('0x10')](_0xcfd1('0xd'),_0x5a7433,_0x5672eb['error'][_0xcfd1('0x11')]);return _0x23f080(_0x5672eb['error'][_0xcfd1('0x11')]);}logger[_0xcfd1('0x10')](_0xcfd1('0xd'),_0x5a7433,_0x5672eb[_0xcfd1('0x10')]['message']);return _0x5eab4a(_0x5672eb[_0xcfd1('0x10')][_0xcfd1('0x11')]);}else{logger[_0xcfd1('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5a7433,_0xcfd1('0xe'));_0x5eab4a(_0x5672eb[_0xcfd1('0x12')]['message']);}})[_0xcfd1('0x13')](function(_0x185df4){logger[_0xcfd1('0x10')](_0xcfd1('0xd'),_0x5a7433,_0x185df4);_0x23f080(_0x185df4);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 9080496..1f0587a 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 _0xf978=['preview','/:id/run','run','query','post','create','/:id','update','delete','exports','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','show','/:id/preview'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0xf978,0xfa));var _0x8f97=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xf978[_0x1a36a5];return _0x746243;};'use strict';var multer=require(_0x8f97('0x0'));var util=require('util');var path=require(_0x8f97('0x1'));var timeout=require(_0x8f97('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8f97('0x3'));var config=require(_0x8f97('0x4'));var controller=require(_0x8f97('0x5'));router[_0x8f97('0x6')]('/',auth[_0x8f97('0x7')](),controller['index']);router[_0x8f97('0x6')]('/:id',auth[_0x8f97('0x7')](),controller[_0x8f97('0x8')]);router[_0x8f97('0x6')](_0x8f97('0x9'),auth[_0x8f97('0x7')](),controller[_0x8f97('0xa')]);router[_0x8f97('0x6')](_0x8f97('0xb'),auth[_0x8f97('0x7')](),controller[_0x8f97('0xc')]);router[_0x8f97('0x6')]('/:id/query',auth[_0x8f97('0x7')](),controller[_0x8f97('0xd')]);router[_0x8f97('0xe')]('/',auth[_0x8f97('0x7')](),controller[_0x8f97('0xf')]);router['put'](_0x8f97('0x10'),auth['isAuthenticated'](),controller[_0x8f97('0x11')]);router[_0x8f97('0x12')](_0x8f97('0x10'),auth[_0x8f97('0x7')](),controller['destroy']);module[_0x8f97('0x13')]=router; \ No newline at end of file +var _0x504e=['index','/:id','show','get','preview','/:id/run','/:id/query','query','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated'];(function(_0x406c5d,_0xe62967){var _0x2611f1=function(_0x471eff){while(--_0x471eff){_0x406c5d['push'](_0x406c5d['shift']());}};_0x2611f1(++_0xe62967);}(_0x504e,0x1dc));var _0xe504=function(_0x3f00c1,_0x1eb590){_0x3f00c1=_0x3f00c1-0x0;var _0x2a7893=_0x504e[_0x3f00c1];return _0x2a7893;};'use strict';var multer=require(_0xe504('0x0'));var util=require(_0xe504('0x1'));var path=require(_0xe504('0x2'));var timeout=require(_0xe504('0x3'));var express=require(_0xe504('0x4'));var router=express['Router']();var auth=require(_0xe504('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe504('0x6'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0xe504('0x7')](),controller[_0xe504('0x8')]);router['get'](_0xe504('0x9'),auth[_0xe504('0x7')](),controller[_0xe504('0xa')]);router[_0xe504('0xb')]('/:id/preview',auth[_0xe504('0x7')](),controller[_0xe504('0xc')]);router[_0xe504('0xb')](_0xe504('0xd'),auth['isAuthenticated'](),controller['run']);router[_0xe504('0xb')](_0xe504('0xe'),auth[_0xe504('0x7')](),controller[_0xe504('0xf')]);router[_0xe504('0x10')]('/',auth['isAuthenticated'](),controller[_0xe504('0x11')]);router[_0xe504('0x12')](_0xe504('0x9'),auth[_0xe504('0x7')](),controller[_0xe504('0x13')]);router[_0xe504('0x14')](_0xe504('0x9'),auth[_0xe504('0x7')](),controller[_0xe504('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index a61e8ef..f6ba096 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 _0x78c5=['TEXT','sequelize','STRING'];(function(_0x3ad7ad,_0x291a8d){var _0x225a60=function(_0xca7354){while(--_0xca7354){_0x3ad7ad['push'](_0x3ad7ad['shift']());}};_0x225a60(++_0x291a8d);}(_0x78c5,0xc1));var _0x578c=function(_0x2040dd,_0x156a63){_0x2040dd=_0x2040dd-0x0;var _0x27688f=_0x78c5[_0x2040dd];return _0x27688f;};'use strict';var Sequelize=require(_0x578c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x578c('0x1')]},'parent':{'type':Sequelize[_0x578c('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x578c('0x2')]},'joins':{'type':Sequelize[_0x578c('0x2')]}}; \ No newline at end of file +var _0x8f63=['sequelize','exports','STRING','TEXT'];(function(_0x131f57,_0xbdcdd5){var _0x33fc1d=function(_0x23abbc){while(--_0x23abbc){_0x131f57['push'](_0x131f57['shift']());}};_0x33fc1d(++_0xbdcdd5);}(_0x8f63,0xc4));var _0x38f6=function(_0x3b76e9,_0x39efb2){_0x3b76e9=_0x3b76e9-0x0;var _0x43489c=_0x8f63[_0x3b76e9];return _0x43489c;};'use strict';var Sequelize=require(_0x38f6('0x0'));module[_0x38f6('0x1')]={'name':{'type':Sequelize[_0x38f6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x38f6('0x2')]},'parent':{'type':Sequelize[_0x38f6('0x2')]},'table':{'type':Sequelize[_0x38f6('0x2')]},'conditions':{'type':Sequelize[_0x38f6('0x3')]},'joins':{'type':Sequelize[_0x38f6('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 945d296..1ee8b11 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 _0xd32a=['query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SEC_TO_TIME(%s)','HOUR(%s)','IS\x20NULL','web','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','join','../../components/export/','output','savename','countTable','COUNT(*)','SELECT','run','runReport','ValidationErrorItem','debug','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key'];(function(_0x2a1da9,_0x4ecf18){var _0x9be406=function(_0x57f9be){while(--_0x57f9be){_0x2a1da9['push'](_0x2a1da9['shift']());}};_0x9be406(++_0x4ecf18);}(_0xd32a,0x1bc));var _0xad32=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xd32a[_0x17406a];return _0x1501ff;};'use strict';var pdf=require(_0xad32('0x0'));var emlformat=require(_0xad32('0x1'));var rimraf=require(_0xad32('0x2'));var zipdir=require(_0xad32('0x3'));var jsonpatch=require(_0xad32('0x4'));var rp=require('request-promise');var moment=require(_0xad32('0x5'));var BPromise=require(_0xad32('0x6'));var Mustache=require('mustache');var util=require(_0xad32('0x7'));var path=require(_0xad32('0x8'));var sox=require(_0xad32('0x9'));var csv=require(_0xad32('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xad32('0xb'));var crypto=require(_0xad32('0xc'));var jsforce=require(_0xad32('0xd'));var deskjs=require(_0xad32('0xe'));var toCsv=require('to-csv');var querystring=require(_0xad32('0xf'));var Papa=require(_0xad32('0x10'));var Redis=require(_0xad32('0x11'));var authService=require(_0xad32('0x12'));var qs=require(_0xad32('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad32('0x14'));var logger=require(_0xad32('0x15'))(_0xad32('0x16'));var utils=require('../../config/utils');var config=require(_0xad32('0x17'));var licenseUtil=require(_0xad32('0x18'));var db=require(_0xad32('0x19'))['db'];var dbH=require(_0xad32('0x19'))[_0xad32('0x1a')];function respondWithStatusCode(_0x208a52,_0x20f75e){_0x20f75e=_0x20f75e||0xcc;return function(_0x2d8a16){if(_0x2d8a16){return _0x208a52['sendStatus'](_0x20f75e);}return _0x208a52[_0xad32('0x1b')](_0x20f75e)[_0xad32('0x1c')]();};}function respondWithResult(_0x46be53,_0x2e5d00){_0x2e5d00=_0x2e5d00||0xc8;return function(_0x680222){if(_0x680222){return _0x46be53[_0xad32('0x1b')](_0x2e5d00)[_0xad32('0x1d')](_0x680222);}};}function respondWithFilteredResult(_0x5b83e4,_0x559ded){return function(_0x1ff13c){if(_0x1ff13c){var _0x2b15f8=_0x1ff13c[_0xad32('0x1e')],_0x242633=_0x559ded[_0xad32('0x1f')],_0x1cc3b6=_0x559ded[_0xad32('0x1f')]+_0x559ded[_0xad32('0x20')],_0x464bf6;if(_0x1cc3b6>=_0x2b15f8){_0x1cc3b6=_0x2b15f8;_0x464bf6=0xc8;}else{_0x464bf6=0xce;}_0x5b83e4['status'](_0x464bf6);return _0x5b83e4[_0xad32('0x21')](_0xad32('0x22'),_0x242633+'-'+_0x1cc3b6+'/'+_0x2b15f8)[_0xad32('0x1d')](_0x1ff13c);}return null;};}function patchUpdates(_0x44020c){return function(_0xc7017a){try{jsonpatch[_0xad32('0x23')](_0xc7017a,_0x44020c,!![]);}catch(_0x489a2c){return BPromise[_0xad32('0x24')](_0x489a2c);}return _0xc7017a[_0xad32('0x25')]();};}function saveUpdates(_0x2e641f,_0x6bd39c){return function(_0x7f4500){if(_0x7f4500){return _0x7f4500[_0xad32('0x26')](_0x2e641f)[_0xad32('0x27')](function(_0x597b68){return _0x597b68;});}return null;};}function removeEntity(_0xfe01b1,_0x423ff6){return function(_0x566c2c){if(_0x566c2c){return _0x566c2c[_0xad32('0x28')]()[_0xad32('0x27')](function(){var _0x52637d=_0x566c2c[_0xad32('0x29')]({'plain':!![]});var _0x3eae5b=_0xad32('0x2a');return db[_0xad32('0x2b')][_0xad32('0x28')]({'where':{'type':_0x3eae5b,'resourceId':_0x52637d['id']}})[_0xad32('0x27')](function(){return _0x566c2c;});})['then'](function(){_0xfe01b1[_0xad32('0x1b')](0xcc)[_0xad32('0x1c')]();});}};}function handleEntityNotFound(_0x715ea5,_0x456b92){return function(_0x2dac97){if(!_0x2dac97){_0x715ea5['sendStatus'](0x194);}return _0x2dac97;};}function handleError(_0x236514,_0x149999){_0x149999=_0x149999||0x1f4;return function(_0x184aad){logger['error'](_0x184aad[_0xad32('0x2c')]);if(_0x184aad['name']){delete _0x184aad[_0xad32('0x2d')];}_0x236514['status'](_0x149999)[_0xad32('0x2e')](_0x184aad);};}exports[_0xad32('0x2f')]=function(_0x542107,_0x3d4aa5){var _0x52d933={},_0x222aed={},_0x2e1121={'count':0x0,'rows':[]};var _0x1329f4=_[_0xad32('0x30')](db[_0xad32('0x31')][_0xad32('0x32')],function(_0x54dfde){return{'name':_0x54dfde[_0xad32('0x33')],'type':_0x54dfde[_0xad32('0x34')][_0xad32('0x35')]};});_0x222aed['model']=_['map'](_0x1329f4,_0xad32('0x2d'));_0x222aed[_0xad32('0x36')]=_[_0xad32('0x37')](_0x542107[_0xad32('0x36')]);_0x222aed[_0xad32('0x38')]=_[_0xad32('0x39')](_0x222aed['model'],_0x222aed[_0xad32('0x36')]);_0x52d933['attributes']=_['intersection'](_0x222aed[_0xad32('0x3a')],qs['fields'](_0x542107[_0xad32('0x36')][_0xad32('0x3b')]));_0x52d933[_0xad32('0x3c')]=_0x52d933[_0xad32('0x3c')][_0xad32('0x3d')]?_0x52d933[_0xad32('0x3c')]:_0x222aed[_0xad32('0x3a')];if(!_0x542107['query']['hasOwnProperty'](_0xad32('0x3e'))){_0x52d933[_0xad32('0x20')]=qs[_0xad32('0x20')](_0x542107[_0xad32('0x36')][_0xad32('0x20')]);_0x52d933['offset']=qs[_0xad32('0x1f')](_0x542107[_0xad32('0x36')][_0xad32('0x1f')]);}_0x52d933[_0xad32('0x3f')]=qs[_0xad32('0x40')](_0x542107[_0xad32('0x36')][_0xad32('0x40')]);_0x52d933[_0xad32('0x41')]=qs[_0xad32('0x38')](_[_0xad32('0x42')](_0x542107[_0xad32('0x36')],_0x222aed[_0xad32('0x38')]),_0x1329f4);if(_0x542107['query']['filter']){_0x52d933[_0xad32('0x41')]=_['merge'](_0x52d933['where'],{'$or':_[_0xad32('0x30')](_0x1329f4,function(_0x344cf6){if(_0x344cf6['type']!==_0xad32('0x43')){var _0xcffb21={};_0xcffb21[_0x344cf6[_0xad32('0x2d')]]={'$like':'%'+_0x542107[_0xad32('0x36')]['filter']+'%'};return _0xcffb21;}})});}_0x52d933=_[_0xad32('0x44')]({},_0x52d933,_0x542107[_0xad32('0x45')]);var _0x31d8e4={'where':_0x52d933[_0xad32('0x41')]};return db['AnalyticDefaultReport'][_0xad32('0x1e')](_0x31d8e4)[_0xad32('0x27')](function(_0x30c015){_0x2e1121['count']=_0x30c015;if(_0x542107[_0xad32('0x36')][_0xad32('0x46')]){_0x52d933['include']=[{'all':!![]}];}return db[_0xad32('0x31')][_0xad32('0x47')](_0x52d933);})[_0xad32('0x27')](function(_0x2f9750){_0x2e1121['rows']=_0x2f9750;return _0x2e1121;})['then'](respondWithFilteredResult(_0x3d4aa5,_0x52d933))[_0xad32('0x48')](handleError(_0x3d4aa5,null));};exports[_0xad32('0x49')]=function(_0x7d0ff0,_0x959090){var _0x398f06={'raw':!![],'where':{'id':_0x7d0ff0[_0xad32('0x4a')]['id']}},_0x40e7dd={};_0x40e7dd['model']=_[_0xad32('0x37')](db['AnalyticDefaultReport']['rawAttributes']);_0x40e7dd['query']=_[_0xad32('0x37')](_0x7d0ff0[_0xad32('0x36')]);_0x40e7dd[_0xad32('0x38')]=_['intersection'](_0x40e7dd[_0xad32('0x3a')],_0x40e7dd['query']);_0x398f06[_0xad32('0x3c')]=_[_0xad32('0x39')](_0x40e7dd[_0xad32('0x3a')],qs[_0xad32('0x3b')](_0x7d0ff0[_0xad32('0x36')]['fields']));_0x398f06[_0xad32('0x3c')]=_0x398f06[_0xad32('0x3c')][_0xad32('0x3d')]?_0x398f06[_0xad32('0x3c')]:_0x40e7dd[_0xad32('0x3a')];if(_0x7d0ff0[_0xad32('0x36')][_0xad32('0x46')]){_0x398f06['include']=[{'all':!![]}];}_0x398f06=_[_0xad32('0x44')]({},_0x398f06,_0x7d0ff0[_0xad32('0x45')]);return db[_0xad32('0x31')][_0xad32('0x4b')](_0x398f06)[_0xad32('0x27')](handleEntityNotFound(_0x959090,null))['then'](respondWithResult(_0x959090,null))[_0xad32('0x48')](handleError(_0x959090,null));};exports['create']=function(_0x1da04d,_0x4d9910){return db['AnalyticDefaultReport'][_0xad32('0x4c')](_0x1da04d[_0xad32('0x4d')],{})[_0xad32('0x27')](function(_0x4c32ee){var _0x12cf88=_0x1da04d[_0xad32('0x4e')][_0xad32('0x29')]({'plain':!![]});if(!_0x12cf88)throw new Error(_0xad32('0x4f'));if(_0x12cf88['role']===_0xad32('0x4e')){var _0x2a94b8=_0x4c32ee[_0xad32('0x29')]({'plain':!![]});var _0x532e02=_0xad32('0x50');return db[_0xad32('0x51')][_0xad32('0x4b')]({'where':{'name':_0x532e02,'userProfileId':_0x12cf88['userProfileId']},'raw':!![]})['then'](function(_0x3ebe76){if(_0x3ebe76&&_0x3ebe76[_0xad32('0x52')]===0x0){return db[_0xad32('0x2b')][_0xad32('0x4c')]({'name':_0x2a94b8['name'],'resourceId':_0x2a94b8['id'],'type':_0xad32('0x2a'),'sectionId':_0x3ebe76['id']},{})['then'](function(){return _0x4c32ee;});}else{return _0x4c32ee;}})['catch'](function(_0x29ef68){logger[_0xad32('0x53')](_0xad32('0x54'),_0x29ef68);throw _0x29ef68;});}return _0x4c32ee;})[_0xad32('0x27')](respondWithResult(_0x4d9910,0xc9))[_0xad32('0x48')](handleError(_0x4d9910,null));};exports[_0xad32('0x26')]=function(_0x53cbf1,_0x25ff83){if(_0x53cbf1[_0xad32('0x4d')]['id']){delete _0x53cbf1[_0xad32('0x4d')]['id'];}return db[_0xad32('0x31')][_0xad32('0x4b')]({'where':{'id':_0x53cbf1['params']['id']}})[_0xad32('0x27')](handleEntityNotFound(_0x25ff83,null))['then'](saveUpdates(_0x53cbf1[_0xad32('0x4d')],null))[_0xad32('0x27')](respondWithResult(_0x25ff83,null))[_0xad32('0x48')](handleError(_0x25ff83,null));};exports[_0xad32('0x28')]=function(_0x48ec6f,_0x3dc47a){return db['AnalyticDefaultReport'][_0xad32('0x4b')]({'where':{'id':_0x48ec6f[_0xad32('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3dc47a,null))['then'](removeEntity(_0x3dc47a,null))[_0xad32('0x48')](handleError(_0x3dc47a,null));};exports['preview']=function(_0x168ab9,_0xf92a6f){var _0xddd80f=0xa;var _0x272ff9=['join',_0xad32('0x55'),_0xad32('0x56'),_0xad32('0x57')];var _0x41b18c={'SUM':_0xad32('0x58'),'COUNT':_0xad32('0x59'),'COUNT DISTINCT':_0xad32('0x5a'),'MAX':_0xad32('0x5b'),'MIN':_0xad32('0x5c'),'AVG':_0xad32('0x5d'),'GROUP_CONCAT':_0xad32('0x5e'),'GROUP_CONCAT ASC':_0xad32('0x5f'),'GROUP_CONCAT DESC':_0xad32('0x60')};var _0x17ab51={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xad32('0x61'),'HOUR':'HOUR(%s)','ROUND':_0xad32('0x62'),'UNIX_TIMESTAMP':_0xad32('0x63')};var _0x48a2bc=function(_0x567311){return!_[_0xad32('0x64')](['IS\x20NULL',_0xad32('0x65'),_0xad32('0x66'),_0xad32('0x67')],_0x567311);};var _0x25f23b=function(_0x1fab25){if(!_0x1fab25||!_0x1fab25[_0xad32('0x68')][_0xad32('0x3d')]){return'';}for(var _0x283a37='(',_0x5d9afb=0x0;_0x5d9afb<_0x1fab25[_0xad32('0x68')][_0xad32('0x3d')];_0x5d9afb+=0x1){_0x5d9afb>0x0&&(_0x283a37+='\x20'+_0x1fab25[_0xad32('0x69')]+'\x20');_0x283a37+=_0x1fab25['rules'][_0x5d9afb][_0xad32('0x6a')]?_0x25f23b(_0x1fab25[_0xad32('0x68')][_0x5d9afb][_0xad32('0x6a')]):_0x1fab25['rules'][_0x5d9afb][_0xad32('0x6b')]+'\x20'+_0x1fab25[_0xad32('0x68')][_0x5d9afb][_0xad32('0x6c')]+(_0x48a2bc(_0x1fab25[_0xad32('0x68')][_0x5d9afb][_0xad32('0x6c')])?'\x20'+_0x1fab25['rules'][_0x5d9afb][_0xad32('0x6d')]:'');}return _0x283a37+')';};var _0x1080f5={'where':{'id':_0x168ab9[_0xad32('0x4a')]['id']}},_0xc4e828,_0x6f92af,_0x3670f9,_0x52f305,_0x4e2610;_0x1080f5=_[_0xad32('0x44')]({},_0x1080f5,_0x168ab9['options']);return db[_0xad32('0x31')][_0xad32('0x4b')](_0x1080f5)[_0xad32('0x27')](function(_0x270479){if(_0x270479){_0xc4e828=_0x270479;return _0x270479[_0xad32('0x6e')]();}return null;})[_0xad32('0x27')](function(_0xf6cda8){if(_0xf6cda8){if(!_0xf6cda8[_0xad32('0x3d')]){throw new db[(_0xad32('0x6f'))]['ValidationErrorItem'](_0xad32('0x70'),0x193);}_0x6f92af=_0xf6cda8;return db[_0xad32('0x71')][_0xad32('0x47')]({'raw':!![]});}return null;})[_0xad32('0x27')](function(_0xea1438){if(_0xea1438){_0x3670f9=_[_0xad32('0x72')](_0xea1438,'id');var _0x22399a;var _0x1fece2=squel[_0xad32('0x73')]();_0x1fece2[_0xad32('0x74')](_0xc4e828[_0xad32('0x75')]);for(var _0x993331=0x0;_0x993331<_0x6f92af[_0xad32('0x3d')];_0x993331+=0x1){_0x22399a=_0x6f92af[_0x993331][_0xad32('0x76')]?_0x3670f9[_0x6f92af[_0x993331][_0xad32('0x76')]][_0xad32('0x77')]:_0x6f92af[_0x993331][_0xad32('0x6b')];_0x22399a=_0x6f92af[_0x993331]['function']?_[_0xad32('0x78')](_0x41b18c[_0x6f92af[_0x993331][_0xad32('0x79')]],'%s',_0x22399a):_0x22399a;_0x22399a=_0x6f92af[_0x993331][_0xad32('0x7a')]?_[_0xad32('0x78')](_0x17ab51[_0x6f92af[_0x993331][_0xad32('0x7a')]],'%s',_0x22399a):_0x22399a;if(_0x6f92af[_0x993331][_0xad32('0x7b')]){_0x1fece2[_0xad32('0x6a')](_0x22399a);}_0x6f92af[_0x993331][_0xad32('0x7c')]&&_0x1fece2[_0xad32('0x3f')](_0x22399a,_0x6f92af[_0x993331]['orderBy']===_0xad32('0x7d')?![]:!![]);_0x1fece2[_0xad32('0x6b')](_0x22399a,_0x6f92af[_0x993331][_0xad32('0x7e')]||_0x22399a);}if(_0xc4e828[_0xad32('0x7f')]){_0xc4e828[_0xad32('0x7f')]=JSON[_0xad32('0x80')](_0xc4e828[_0xad32('0x7f')]);for(var _0x47febb=0x0;_0x47febb<_0xc4e828[_0xad32('0x7f')][_0xad32('0x3d')];_0x47febb+=0x1){if(_0xc4e828[_0xad32('0x7f')][_0x47febb][_0xad32('0x34')]&&_[_0xad32('0x64')](_0x272ff9,_0xc4e828['joins'][_0x47febb][_0xad32('0x34')])&&_0xc4e828[_0xad32('0x7f')][_0x47febb][_0xad32('0x81')]&&_0xc4e828[_0xad32('0x7f')][_0x47febb][_0xad32('0x82')]&&_0xc4e828[_0xad32('0x7f')][_0x47febb][_0xad32('0x83')]){_0x1fece2[_0xc4e828[_0xad32('0x7f')][_0x47febb][_0xad32('0x34')]](_0xc4e828[_0xad32('0x7f')][_0x47febb][_0xad32('0x82')],null,util[_0xad32('0x7a')](_0xad32('0x84'),_0xc4e828['table'],_0xc4e828['joins'][_0x47febb]['parentKey'],_0xc4e828[_0xad32('0x7f')][_0x47febb][_0xad32('0x82')],_0xc4e828[_0xad32('0x7f')][_0x47febb][_0xad32('0x83')]));}}}if(_0xc4e828[_0xad32('0x85')]){_0xc4e828['conditions']=JSON[_0xad32('0x80')](_0xc4e828[_0xad32('0x85')]);_0x1fece2[_0xad32('0x41')](_0x25f23b(_0xc4e828[_0xad32('0x85')][_0xad32('0x6a')]));}_0x4e2610=_0x1fece2[_0xad32('0x86')]();_0x1fece2[_0xad32('0x20')](_0xddd80f);_0x1fece2[_0xad32('0x1f')](0x0);logger['debug'](_0xad32('0x87'),_0x1fece2[_0xad32('0x88')]());return dbH[_0xad32('0x89')]['query'](_0x1fece2['toString'](),{'type':dbH[_0xad32('0x89')][_0xad32('0x8a')]['SELECT']});}})[_0xad32('0x27')](respondWithResult(_0xf92a6f,null))['catch'](handleError(_0xf92a6f,null));};function runReport(_0x465675,_0x4b763d,_0x59c896){var _0x263659=_0x4b763d[_0xad32('0x2d')];var _0x39ee66=0xa;var _0x262d28=['join',_0xad32('0x55'),'right_join','cross_join'];var _0x264353={'SUM':_0xad32('0x58'),'COUNT':_0xad32('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xad32('0x5b'),'MIN':_0xad32('0x5c'),'AVG':_0xad32('0x5d'),'GROUP_CONCAT':_0xad32('0x5e'),'GROUP_CONCAT ASC':_0xad32('0x5f'),'GROUP_CONCAT DESC':_0xad32('0x60')};var _0x58e228={'SEC_TO_TIME':_0xad32('0x8b'),'DATE':_0xad32('0x61'),'HOUR':_0xad32('0x8c'),'ROUND':_0xad32('0x62'),'UNIX_TIMESTAMP':_0xad32('0x63')};var _0x2687cd=function(_0x5462e5){return!_[_0xad32('0x64')]([_0xad32('0x8d'),_0xad32('0x65'),_0xad32('0x66'),'IS\x20NOT\x20EMPTY'],_0x5462e5);};var _0x36d2a1=function(_0xaeed42){if(!_0xaeed42||!_0xaeed42['rules'][_0xad32('0x3d')]){return'';}for(var _0x1073f2='(',_0x572233=0x0;_0x572233<_0xaeed42[_0xad32('0x68')][_0xad32('0x3d')];_0x572233+=0x1){_0x572233>0x0&&(_0x1073f2+='\x20'+_0xaeed42['operator']+'\x20');_0x1073f2+=_0xaeed42[_0xad32('0x68')][_0x572233][_0xad32('0x6a')]?_0x36d2a1(_0xaeed42[_0xad32('0x68')][_0x572233][_0xad32('0x6a')]):_0xaeed42['rules'][_0x572233]['field']+'\x20'+_0xaeed42[_0xad32('0x68')][_0x572233][_0xad32('0x6c')]+(_0x2687cd(_0xaeed42[_0xad32('0x68')][_0x572233][_0xad32('0x6c')])?'\x20'+_0xaeed42[_0xad32('0x68')][_0x572233][_0xad32('0x6d')]:'');}return _0x1073f2+')';};var _0x434fd6={'where':{'id':_0x465675['id']}},_0x4eb777,_0x320bcd,_0x122a4a,_0x1b47f9,_0x1ef327;_0x434fd6=_[_0xad32('0x44')]({},_0x434fd6,_0x59c896);return db[_0xad32('0x31')][_0xad32('0x4b')](_0x434fd6)['then'](function(_0x148e31){if(_0x148e31){_0x4eb777=_0x148e31;return _0x148e31[_0xad32('0x6e')]();}return null;})[_0xad32('0x27')](function(_0x26742d){if(_0x26742d){if(!_0x26742d[_0xad32('0x3d')]){throw new db[(_0xad32('0x6f'))]['ValidationErrorItem'](_0xad32('0x70'),0x193);}_0x320bcd=_0x26742d;return db[_0xad32('0x71')]['findAll']({'raw':!![]});}return null;})[_0xad32('0x27')](function(_0xde86e0){if(_0xde86e0){_0x122a4a=_[_0xad32('0x72')](_0xde86e0,'id');var _0x33bda7;var _0x5ef0cd=squel[_0xad32('0x73')]();_0x5ef0cd[_0xad32('0x74')](_0x4eb777['table']);for(var _0x4da14f=0x0;_0x4da14f<_0x320bcd[_0xad32('0x3d')];_0x4da14f+=0x1){_0x33bda7=_0x320bcd[_0x4da14f][_0xad32('0x76')]?_0x122a4a[_0x320bcd[_0x4da14f][_0xad32('0x76')]][_0xad32('0x77')]:_0x320bcd[_0x4da14f][_0xad32('0x6b')];_0x33bda7=_0x320bcd[_0x4da14f][_0xad32('0x79')]?_[_0xad32('0x78')](_0x264353[_0x320bcd[_0x4da14f][_0xad32('0x79')]],'%s',_0x33bda7):_0x33bda7;_0x33bda7=_0x320bcd[_0x4da14f][_0xad32('0x7a')]?_[_0xad32('0x78')](_0x58e228[_0x320bcd[_0x4da14f]['format']],'%s',_0x33bda7):_0x33bda7;if(_0x320bcd[_0x4da14f][_0xad32('0x7b')]){_0x5ef0cd[_0xad32('0x6a')](_0x33bda7);}_0x320bcd[_0x4da14f]['orderBy']&&_0x5ef0cd[_0xad32('0x3f')](_0x33bda7,_0x320bcd[_0x4da14f][_0xad32('0x7c')]==='DESC'?![]:!![]);_0x5ef0cd[_0xad32('0x6b')](_0x33bda7,_0x320bcd[_0x4da14f]['alias']||_0x33bda7);}if(_0x4eb777[_0xad32('0x7f')]){_0x4eb777[_0xad32('0x7f')]=JSON[_0xad32('0x80')](_0x4eb777[_0xad32('0x7f')]);for(var _0x1d0805=0x0;_0x1d0805<_0x4eb777[_0xad32('0x7f')]['length'];_0x1d0805+=0x1){if(_0x4eb777[_0xad32('0x7f')][_0x1d0805][_0xad32('0x34')]&&_[_0xad32('0x64')](_0x262d28,_0x4eb777[_0xad32('0x7f')][_0x1d0805][_0xad32('0x34')])&&_0x4eb777[_0xad32('0x7f')][_0x1d0805][_0xad32('0x81')]&&_0x4eb777[_0xad32('0x7f')][_0x1d0805][_0xad32('0x82')]&&_0x4eb777[_0xad32('0x7f')][_0x1d0805][_0xad32('0x83')]){_0x5ef0cd[_0x4eb777[_0xad32('0x7f')][_0x1d0805]['type']](_0x4eb777[_0xad32('0x7f')][_0x1d0805]['foreignTable'],null,util[_0xad32('0x7a')](_0xad32('0x84'),_0x4eb777['table'],_0x4eb777[_0xad32('0x7f')][_0x1d0805]['parentKey'],_0x4eb777[_0xad32('0x7f')][_0x1d0805]['foreignTable'],_0x4eb777[_0xad32('0x7f')][_0x1d0805][_0xad32('0x83')]));}}}if(_0x4eb777[_0xad32('0x85')]){_0x4eb777[_0xad32('0x85')]=JSON['parse'](_0x4eb777[_0xad32('0x85')]);_0x5ef0cd[_0xad32('0x41')](_0x36d2a1(_0x4eb777[_0xad32('0x85')][_0xad32('0x6a')]));}_0x1ef327=_0x5ef0cd[_0xad32('0x86')]();_0x5ef0cd[_0xad32('0x20')](_0x39ee66);_0x5ef0cd[_0xad32('0x1f')](0x0);return;}})['then'](function(){if(_0x4b763d['output']===_0xad32('0x8e')){return null;}var _0x108c9c=_[_0xad32('0x44')](_0x4b763d,{'name':_0x4b763d['fullPath']||_0x4b763d['name']||_0x4eb777['name'],'basename':_0x263659,'savename':util[_0xad32('0x7a')](_0xad32('0x8f'),_0x4b763d[_0xad32('0x2d')]||_0x4eb777[_0xad32('0x2d')],require(_0xad32('0x90'))[_0xad32('0x91')](0x4),_0x4b763d['output']||_0xad32('0x92')),'reportId':_0x4eb777['id'],'reportType':_0xad32('0x93')});return db[_0xad32('0x94')][_0xad32('0x4c')](_0x108c9c,{'raw':!![]});})[_0xad32('0x27')](function(_0x501c99){if(_0x4eb777[_0xad32('0x75')]===_0xad32('0x95')){_0x1ef327['where'](_0x4eb777[_0xad32('0x75')]+_0xad32('0x96'),_0x4b763d[_0xad32('0x97')],_0x4b763d['endDate']);}else{_0x1ef327[_0xad32('0x41')](_0x4eb777[_0xad32('0x75')]+_0xad32('0x98'),_0x4b763d[_0xad32('0x97')],_0x4b763d['endDate']);}if(_0x501c99){logger['info'](_0xad32('0x99'),_0x1ef327[_0xad32('0x88')]());require(_0xad32('0x9a'))['fork'](path[_0xad32('0x9b')](__dirname,_0xad32('0x9c'),_0x501c99[_0xad32('0x9d')]),[_0x501c99['id'],_0x1ef327['toString'](),path[_0xad32('0x9b')](__dirname,'../../files/reports',_0x501c99[_0xad32('0x9e')]),_0x263659]);return _0x501c99;}else{var _0x18b523=squel[_0xad32('0x73')]();_0x18b523[_0xad32('0x74')]('('+_0x1ef327[_0xad32('0x88')]()+')',_0xad32('0x9f'));_0x18b523[_0xad32('0x6b')](_0xad32('0xa0'),_0xad32('0x1e'));_0x1ef327['limit'](_0x4b763d[_0xad32('0x20')]||_0x39ee66);_0x1ef327[_0xad32('0x1f')](_0x4b763d[_0xad32('0x1f')]||0x0);return dbH[_0xad32('0x89')][_0xad32('0x36')](_0x18b523['toString'](),{'type':dbH[_0xad32('0x89')][_0xad32('0x8a')]['SELECT']})[_0xad32('0x27')](function(_0x16e6e0){if(!_0x16e6e0[_0xad32('0x3d')]){_0x1b47f9=0x0;}else{_0x1b47f9=_0x16e6e0[0x0]['count']||0x0;}return dbH[_0xad32('0x89')][_0xad32('0x36')](_0x1ef327['toString'](),{'type':dbH[_0xad32('0x89')][_0xad32('0x8a')][_0xad32('0xa1')]});})[_0xad32('0x27')](function(_0x4fee0a){return{'rows':_0x4fee0a||[],'count':_0x1b47f9};});}});}exports[_0xad32('0xa2')]=function(_0x591e64,_0x100735){return runReport(_0x591e64[_0xad32('0x4a')],_0x591e64[_0xad32('0x36')],_0x591e64[_0xad32('0x45')])[_0xad32('0x27')](respondWithResult(_0x100735,null))['catch'](handleError(_0x100735,null));};exports[_0xad32('0xa3')]=runReport;exports['query']=function(_0x17c9ba,_0x58bb5f){var _0x39a403=0xa;var _0x537ef2=[_0xad32('0x9b'),_0xad32('0x55'),_0xad32('0x56'),_0xad32('0x57')];var _0x3fb704={'SUM':_0xad32('0x58'),'COUNT':_0xad32('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xad32('0x5b'),'MIN':_0xad32('0x5c'),'AVG':_0xad32('0x5d'),'GROUP_CONCAT':_0xad32('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xad32('0x60')};var _0x3f0326={'SEC_TO_TIME':_0xad32('0x8b'),'DATE':'DATE(%s)','HOUR':_0xad32('0x8c'),'ROUND':_0xad32('0x62'),'UNIX_TIMESTAMP':_0xad32('0x63')};var _0x4b13c4=function(_0x336a86){return!_['includes']([_0xad32('0x8d'),'IS\x20NOT\x20NULL',_0xad32('0x66'),_0xad32('0x67')],_0x336a86);};var _0x251528=function(_0x27d297){if(!_0x27d297||!_0x27d297[_0xad32('0x68')][_0xad32('0x3d')]){return'';}for(var _0x3a6e9c='(',_0x434cc9=0x0;_0x434cc9<_0x27d297['rules'][_0xad32('0x3d')];_0x434cc9+=0x1){_0x434cc9>0x0&&(_0x3a6e9c+='\x20'+_0x27d297[_0xad32('0x69')]+'\x20');_0x3a6e9c+=_0x27d297[_0xad32('0x68')][_0x434cc9][_0xad32('0x6a')]?_0x251528(_0x27d297[_0xad32('0x68')][_0x434cc9][_0xad32('0x6a')]):_0x27d297[_0xad32('0x68')][_0x434cc9][_0xad32('0x6b')]+'\x20'+_0x27d297['rules'][_0x434cc9][_0xad32('0x6c')]+(_0x4b13c4(_0x27d297[_0xad32('0x68')][_0x434cc9][_0xad32('0x6c')])?'\x20'+_0x27d297[_0xad32('0x68')][_0x434cc9]['value']:'');}return _0x3a6e9c+')';};var _0x3fa2e3={'where':{'id':_0x17c9ba[_0xad32('0x4a')]['id']}},_0x418f8e,_0x1a2578,_0x3d4060,_0xe1aba5,_0x2093c7;_0x3fa2e3=_[_0xad32('0x44')]({},_0x3fa2e3,_0x17c9ba[_0xad32('0x45')]);return db['AnalyticDefaultReport'][_0xad32('0x4b')](_0x3fa2e3)[_0xad32('0x27')](function(_0x551d0d){if(_0x551d0d){_0x418f8e=_0x551d0d;return _0x551d0d[_0xad32('0x6e')]();}return null;})[_0xad32('0x27')](function(_0x4654b8){if(_0x4654b8){if(!_0x4654b8[_0xad32('0x3d')]){throw new db[(_0xad32('0x6f'))][(_0xad32('0xa4'))](_0xad32('0x70'),0x193);}_0x1a2578=_0x4654b8;return db[_0xad32('0x71')][_0xad32('0x47')]({'raw':!![]});}return null;})[_0xad32('0x27')](function(_0x187021){if(_0x187021){_0x3d4060=_[_0xad32('0x72')](_0x187021,'id');var _0x16dd2d;var _0x4616c1=squel[_0xad32('0x73')]();_0x4616c1['from'](_0x418f8e['table']);for(var _0x5c103e=0x0;_0x5c103e<_0x1a2578[_0xad32('0x3d')];_0x5c103e+=0x1){_0x16dd2d=_0x1a2578[_0x5c103e][_0xad32('0x76')]?_0x3d4060[_0x1a2578[_0x5c103e][_0xad32('0x76')]][_0xad32('0x77')]:_0x1a2578[_0x5c103e]['field'];_0x16dd2d=_0x1a2578[_0x5c103e]['function']?_[_0xad32('0x78')](_0x3fb704[_0x1a2578[_0x5c103e]['function']],'%s',_0x16dd2d):_0x16dd2d;_0x16dd2d=_0x1a2578[_0x5c103e][_0xad32('0x7a')]?_[_0xad32('0x78')](_0x3f0326[_0x1a2578[_0x5c103e][_0xad32('0x7a')]],'%s',_0x16dd2d):_0x16dd2d;if(_0x1a2578[_0x5c103e][_0xad32('0x7b')]){_0x4616c1[_0xad32('0x6a')](_0x16dd2d);}_0x1a2578[_0x5c103e][_0xad32('0x7c')]&&_0x4616c1['order'](_0x16dd2d,_0x1a2578[_0x5c103e][_0xad32('0x7c')]===_0xad32('0x7d')?![]:!![]);_0x4616c1['field'](_0x16dd2d,_0x1a2578[_0x5c103e][_0xad32('0x7e')]||_0x16dd2d);}if(_0x418f8e[_0xad32('0x7f')]){_0x418f8e[_0xad32('0x7f')]=JSON['parse'](_0x418f8e[_0xad32('0x7f')]);for(var _0x4599b7=0x0;_0x4599b7<_0x418f8e[_0xad32('0x7f')][_0xad32('0x3d')];_0x4599b7+=0x1){if(_0x418f8e[_0xad32('0x7f')][_0x4599b7][_0xad32('0x34')]&&_[_0xad32('0x64')](_0x537ef2,_0x418f8e[_0xad32('0x7f')][_0x4599b7]['type'])&&_0x418f8e[_0xad32('0x7f')][_0x4599b7][_0xad32('0x81')]&&_0x418f8e['joins'][_0x4599b7][_0xad32('0x82')]&&_0x418f8e[_0xad32('0x7f')][_0x4599b7]['foreignKey']){_0x4616c1[_0x418f8e[_0xad32('0x7f')][_0x4599b7][_0xad32('0x34')]](_0x418f8e[_0xad32('0x7f')][_0x4599b7]['foreignTable'],null,util[_0xad32('0x7a')]('%s.%s\x20=\x20%s.%s',_0x418f8e[_0xad32('0x75')],_0x418f8e[_0xad32('0x7f')][_0x4599b7]['parentKey'],_0x418f8e[_0xad32('0x7f')][_0x4599b7][_0xad32('0x82')],_0x418f8e[_0xad32('0x7f')][_0x4599b7][_0xad32('0x83')]));}}}if(_0x418f8e[_0xad32('0x85')]){_0x418f8e[_0xad32('0x85')]=JSON[_0xad32('0x80')](_0x418f8e[_0xad32('0x85')]);_0x4616c1[_0xad32('0x41')](_0x251528(_0x418f8e[_0xad32('0x85')]['group']));}_0x2093c7=_0x4616c1[_0xad32('0x86')]();_0x4616c1[_0xad32('0x20')](_0x39a403);_0x4616c1['offset'](0x0);logger[_0xad32('0xa5')](_0xad32('0x87'),_0x4616c1['toString']());return dbH[_0xad32('0x89')][_0xad32('0x36')](_0x4616c1['toString'](),{'type':dbH[_0xad32('0x89')]['QueryTypes'][_0xad32('0xa1')]});}})[_0xad32('0x27')](function(){return{'sql':_0x2093c7[_0xad32('0x88')]()};})[_0xad32('0x27')](respondWithResult(_0x58bb5f,null))[_0xad32('0x48')](handleError(_0x58bb5f,null));}; \ No newline at end of file +var _0xe078=['intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','sequelize','toString','QueryTypes','join','left_join','right_join','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','getFields','keyBy','output','fullPath','%s-%s.%s','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','MAX(%s)','debug','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','end','error','stack','name','index','map','AnalyticDefaultReport','fieldName','type','key','model','keys','query'];(function(_0x535ba1,_0xd6b72f){var _0x4d463f=function(_0x22937b){while(--_0x22937b){_0x535ba1['push'](_0x535ba1['shift']());}};_0x4d463f(++_0xd6b72f);}(_0xe078,0x70));var _0x8e07=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xe078[_0xdea41a];return _0x15d0d8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8e07('0x0'));var rimraf=require(_0x8e07('0x1'));var zipdir=require(_0x8e07('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8e07('0x3'));var moment=require(_0x8e07('0x4'));var BPromise=require(_0x8e07('0x5'));var Mustache=require('mustache');var util=require(_0x8e07('0x6'));var path=require(_0x8e07('0x7'));var sox=require(_0x8e07('0x8'));var csv=require(_0x8e07('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8e07('0xa'));var crypto=require(_0x8e07('0xb'));var jsforce=require(_0x8e07('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8e07('0x9'));var querystring=require(_0x8e07('0xd'));var Papa=require(_0x8e07('0xe'));var Redis=require('ioredis');var authService=require(_0x8e07('0xf'));var qs=require(_0x8e07('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e07('0x11'))('api');var utils=require(_0x8e07('0x12'));var config=require(_0x8e07('0x13'));var licenseUtil=require(_0x8e07('0x14'));var db=require(_0x8e07('0x15'))['db'];var dbH=require(_0x8e07('0x15'))[_0x8e07('0x16')];function respondWithStatusCode(_0x4fc93f,_0x34cecf){_0x34cecf=_0x34cecf||0xcc;return function(_0x435014){if(_0x435014){return _0x4fc93f[_0x8e07('0x17')](_0x34cecf);}return _0x4fc93f[_0x8e07('0x18')](_0x34cecf)['end']();};}function respondWithResult(_0x25cda1,_0x25674c){_0x25674c=_0x25674c||0xc8;return function(_0x24a4e6){if(_0x24a4e6){return _0x25cda1['status'](_0x25674c)['json'](_0x24a4e6);}};}function respondWithFilteredResult(_0x504acc,_0x59d0d5){return function(_0x597585){if(_0x597585){var _0x3d8731=_0x597585[_0x8e07('0x19')],_0x4124a6=_0x59d0d5[_0x8e07('0x1a')],_0x477a21=_0x59d0d5[_0x8e07('0x1a')]+_0x59d0d5['limit'],_0x14f561;if(_0x477a21>=_0x3d8731){_0x477a21=_0x3d8731;_0x14f561=0xc8;}else{_0x14f561=0xce;}_0x504acc['status'](_0x14f561);return _0x504acc['set'](_0x8e07('0x1b'),_0x4124a6+'-'+_0x477a21+'/'+_0x3d8731)[_0x8e07('0x1c')](_0x597585);}return null;};}function patchUpdates(_0x342a80){return function(_0x546eb7){try{jsonpatch[_0x8e07('0x1d')](_0x546eb7,_0x342a80,!![]);}catch(_0x518e18){return BPromise[_0x8e07('0x1e')](_0x518e18);}return _0x546eb7[_0x8e07('0x1f')]();};}function saveUpdates(_0x42ffc3,_0x1b0ae3){return function(_0x362d6c){if(_0x362d6c){return _0x362d6c[_0x8e07('0x20')](_0x42ffc3)[_0x8e07('0x21')](function(_0x18c06e){return _0x18c06e;});}return null;};}function removeEntity(_0x2965f7,_0x134332){return function(_0x16bc6f){if(_0x16bc6f){return _0x16bc6f[_0x8e07('0x22')]()[_0x8e07('0x21')](function(){var _0x1b5fb0=_0x16bc6f[_0x8e07('0x23')]({'plain':!![]});var _0x440933=_0x8e07('0x24');return db[_0x8e07('0x25')][_0x8e07('0x22')]({'where':{'type':_0x440933,'resourceId':_0x1b5fb0['id']}})[_0x8e07('0x21')](function(){return _0x16bc6f;});})[_0x8e07('0x21')](function(){_0x2965f7['status'](0xcc)[_0x8e07('0x26')]();});}};}function handleEntityNotFound(_0x3032f6,_0x5ef9d9){return function(_0x51412e){if(!_0x51412e){_0x3032f6[_0x8e07('0x17')](0x194);}return _0x51412e;};}function handleError(_0x982931,_0x3747d7){_0x3747d7=_0x3747d7||0x1f4;return function(_0xfcc892){logger[_0x8e07('0x27')](_0xfcc892[_0x8e07('0x28')]);if(_0xfcc892[_0x8e07('0x29')]){delete _0xfcc892['name'];}_0x982931[_0x8e07('0x18')](_0x3747d7)['send'](_0xfcc892);};}exports[_0x8e07('0x2a')]=function(_0x4ef93c,_0x4d2eff){var _0x1686f0={},_0x693101={},_0x392cdc={'count':0x0,'rows':[]};var _0x45b14e=_[_0x8e07('0x2b')](db[_0x8e07('0x2c')]['rawAttributes'],function(_0x17fd17){return{'name':_0x17fd17[_0x8e07('0x2d')],'type':_0x17fd17[_0x8e07('0x2e')][_0x8e07('0x2f')]};});_0x693101[_0x8e07('0x30')]=_[_0x8e07('0x2b')](_0x45b14e,'name');_0x693101['query']=_[_0x8e07('0x31')](_0x4ef93c[_0x8e07('0x32')]);_0x693101['filters']=_['intersection'](_0x693101[_0x8e07('0x30')],_0x693101[_0x8e07('0x32')]);_0x1686f0['attributes']=_[_0x8e07('0x33')](_0x693101[_0x8e07('0x30')],qs['fields'](_0x4ef93c[_0x8e07('0x32')][_0x8e07('0x34')]));_0x1686f0[_0x8e07('0x35')]=_0x1686f0['attributes'][_0x8e07('0x36')]?_0x1686f0['attributes']:_0x693101[_0x8e07('0x30')];if(!_0x4ef93c[_0x8e07('0x32')][_0x8e07('0x37')](_0x8e07('0x38'))){_0x1686f0[_0x8e07('0x39')]=qs[_0x8e07('0x39')](_0x4ef93c[_0x8e07('0x32')]['limit']);_0x1686f0[_0x8e07('0x1a')]=qs['offset'](_0x4ef93c[_0x8e07('0x32')][_0x8e07('0x1a')]);}_0x1686f0[_0x8e07('0x3a')]=qs['sort'](_0x4ef93c[_0x8e07('0x32')][_0x8e07('0x3b')]);_0x1686f0['where']=qs[_0x8e07('0x3c')](_[_0x8e07('0x3d')](_0x4ef93c[_0x8e07('0x32')],_0x693101['filters']),_0x45b14e);if(_0x4ef93c['query']['filter']){_0x1686f0[_0x8e07('0x3e')]=_[_0x8e07('0x3f')](_0x1686f0[_0x8e07('0x3e')],{'$or':_[_0x8e07('0x2b')](_0x45b14e,function(_0x13a088){if(_0x13a088[_0x8e07('0x2e')]!==_0x8e07('0x40')){var _0x10d531={};_0x10d531[_0x13a088['name']]={'$like':'%'+_0x4ef93c['query'][_0x8e07('0x41')]+'%'};return _0x10d531;}})});}_0x1686f0=_[_0x8e07('0x3f')]({},_0x1686f0,_0x4ef93c[_0x8e07('0x42')]);var _0x269fc8={'where':_0x1686f0[_0x8e07('0x3e')]};return db[_0x8e07('0x2c')][_0x8e07('0x19')](_0x269fc8)[_0x8e07('0x21')](function(_0x5463e1){_0x392cdc[_0x8e07('0x19')]=_0x5463e1;if(_0x4ef93c[_0x8e07('0x32')][_0x8e07('0x43')]){_0x1686f0[_0x8e07('0x44')]=[{'all':!![]}];}return db[_0x8e07('0x2c')][_0x8e07('0x45')](_0x1686f0);})['then'](function(_0x35eb51){_0x392cdc['rows']=_0x35eb51;return _0x392cdc;})[_0x8e07('0x21')](respondWithFilteredResult(_0x4d2eff,_0x1686f0))[_0x8e07('0x46')](handleError(_0x4d2eff,null));};exports[_0x8e07('0x47')]=function(_0x3dd5e9,_0x226dd1){var _0x940129={'raw':!![],'where':{'id':_0x3dd5e9[_0x8e07('0x48')]['id']}},_0x1947f4={};_0x1947f4[_0x8e07('0x30')]=_['keys'](db[_0x8e07('0x2c')]['rawAttributes']);_0x1947f4[_0x8e07('0x32')]=_[_0x8e07('0x31')](_0x3dd5e9[_0x8e07('0x32')]);_0x1947f4['filters']=_[_0x8e07('0x33')](_0x1947f4[_0x8e07('0x30')],_0x1947f4[_0x8e07('0x32')]);_0x940129[_0x8e07('0x35')]=_['intersection'](_0x1947f4[_0x8e07('0x30')],qs[_0x8e07('0x34')](_0x3dd5e9['query'][_0x8e07('0x34')]));_0x940129[_0x8e07('0x35')]=_0x940129['attributes'][_0x8e07('0x36')]?_0x940129[_0x8e07('0x35')]:_0x1947f4[_0x8e07('0x30')];if(_0x3dd5e9[_0x8e07('0x32')][_0x8e07('0x43')]){_0x940129[_0x8e07('0x44')]=[{'all':!![]}];}_0x940129=_[_0x8e07('0x3f')]({},_0x940129,_0x3dd5e9['options']);return db['AnalyticDefaultReport'][_0x8e07('0x49')](_0x940129)[_0x8e07('0x21')](handleEntityNotFound(_0x226dd1,null))['then'](respondWithResult(_0x226dd1,null))[_0x8e07('0x46')](handleError(_0x226dd1,null));};exports[_0x8e07('0x4a')]=function(_0x2b6c82,_0x340fdd){return db[_0x8e07('0x2c')][_0x8e07('0x4a')](_0x2b6c82[_0x8e07('0x4b')],{})[_0x8e07('0x21')](function(_0x3e76e2){var _0x2721c3=_0x2b6c82[_0x8e07('0x4c')][_0x8e07('0x23')]({'plain':!![]});if(!_0x2721c3)throw new Error(_0x8e07('0x4d'));if(_0x2721c3[_0x8e07('0x4e')]===_0x8e07('0x4c')){var _0x188b47=_0x3e76e2['get']({'plain':!![]});var _0x359e38=_0x8e07('0x4f');return db[_0x8e07('0x50')][_0x8e07('0x49')]({'where':{'name':_0x359e38,'userProfileId':_0x2721c3[_0x8e07('0x51')]},'raw':!![]})['then'](function(_0xaf52e1){if(_0xaf52e1&&_0xaf52e1['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x188b47[_0x8e07('0x29')],'resourceId':_0x188b47['id'],'type':_0x8e07('0x24'),'sectionId':_0xaf52e1['id']},{})['then'](function(){return _0x3e76e2;});}else{return _0x3e76e2;}})[_0x8e07('0x46')](function(_0x44cce8){logger['error'](_0x8e07('0x52'),_0x44cce8);throw _0x44cce8;});}return _0x3e76e2;})[_0x8e07('0x21')](respondWithResult(_0x340fdd,0xc9))[_0x8e07('0x46')](handleError(_0x340fdd,null));};exports[_0x8e07('0x20')]=function(_0xf78b02,_0xbca082){if(_0xf78b02['body']['id']){delete _0xf78b02[_0x8e07('0x4b')]['id'];}return db[_0x8e07('0x2c')][_0x8e07('0x49')]({'where':{'id':_0xf78b02[_0x8e07('0x48')]['id']}})[_0x8e07('0x21')](handleEntityNotFound(_0xbca082,null))['then'](saveUpdates(_0xf78b02[_0x8e07('0x4b')],null))['then'](respondWithResult(_0xbca082,null))[_0x8e07('0x46')](handleError(_0xbca082,null));};exports[_0x8e07('0x22')]=function(_0x4b12a6,_0x29ad90){return db[_0x8e07('0x2c')][_0x8e07('0x49')]({'where':{'id':_0x4b12a6[_0x8e07('0x48')]['id']}})['then'](handleEntityNotFound(_0x29ad90,null))[_0x8e07('0x21')](removeEntity(_0x29ad90,null))[_0x8e07('0x46')](handleError(_0x29ad90,null));};exports['preview']=function(_0xbd5e1,_0x5e827d){var _0x1e3df2=0xa;var _0x2af747=['join','left_join','right_join',_0x8e07('0x53')];var _0x8b5241={'SUM':_0x8e07('0x54'),'COUNT':_0x8e07('0x55'),'COUNT DISTINCT':_0x8e07('0x56'),'MAX':'MAX(%s)','MIN':_0x8e07('0x57'),'AVG':_0x8e07('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x8e07('0x59'),'GROUP_CONCAT DESC':_0x8e07('0x5a')};var _0xde9300={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x8e07('0x5b'),'HOUR':_0x8e07('0x5c'),'ROUND':_0x8e07('0x5d'),'UNIX_TIMESTAMP':_0x8e07('0x5e')};var _0x3003e4=function(_0x4eeaf7){return!_[_0x8e07('0x5f')]([_0x8e07('0x60'),_0x8e07('0x61'),_0x8e07('0x62'),_0x8e07('0x63')],_0x4eeaf7);};var _0x398a51=function(_0x1ce07e){if(!_0x1ce07e||!_0x1ce07e[_0x8e07('0x64')][_0x8e07('0x36')]){return'';}for(var _0x4ea057='(',_0x56abbd=0x0;_0x56abbd<_0x1ce07e[_0x8e07('0x64')]['length'];_0x56abbd+=0x1){_0x56abbd>0x0&&(_0x4ea057+='\x20'+_0x1ce07e[_0x8e07('0x65')]+'\x20');_0x4ea057+=_0x1ce07e[_0x8e07('0x64')][_0x56abbd][_0x8e07('0x66')]?_0x398a51(_0x1ce07e[_0x8e07('0x64')][_0x56abbd][_0x8e07('0x66')]):_0x1ce07e[_0x8e07('0x64')][_0x56abbd][_0x8e07('0x67')]+'\x20'+_0x1ce07e['rules'][_0x56abbd][_0x8e07('0x68')]+(_0x3003e4(_0x1ce07e[_0x8e07('0x64')][_0x56abbd][_0x8e07('0x68')])?'\x20'+_0x1ce07e['rules'][_0x56abbd][_0x8e07('0x69')]:'');}return _0x4ea057+')';};var _0x4541c4={'where':{'id':_0xbd5e1[_0x8e07('0x48')]['id']}},_0x202236,_0xa825e3,_0x213b6e,_0x327e0a,_0x5e2de3;_0x4541c4=_[_0x8e07('0x3f')]({},_0x4541c4,_0xbd5e1[_0x8e07('0x42')]);return db[_0x8e07('0x2c')][_0x8e07('0x49')](_0x4541c4)['then'](function(_0xfd8ae1){if(_0xfd8ae1){_0x202236=_0xfd8ae1;return _0xfd8ae1['getFields']();}return null;})['then'](function(_0xf84ece){if(_0xf84ece){if(!_0xf84ece['length']){throw new db[(_0x8e07('0x6a'))][(_0x8e07('0x6b'))](_0x8e07('0x6c'),0x193);}_0xa825e3=_0xf84ece;return db[_0x8e07('0x6d')][_0x8e07('0x45')]({'raw':!![]});}return null;})['then'](function(_0xedff0){if(_0xedff0){_0x213b6e=_['keyBy'](_0xedff0,'id');var _0x24e6c9;var _0x34e0de=squel[_0x8e07('0x6e')]();_0x34e0de[_0x8e07('0x6f')](_0x202236[_0x8e07('0x70')]);for(var _0x5e83e4=0x0;_0x5e83e4<_0xa825e3[_0x8e07('0x36')];_0x5e83e4+=0x1){_0x24e6c9=_0xa825e3[_0x5e83e4][_0x8e07('0x71')]?_0x213b6e[_0xa825e3[_0x5e83e4]['MetricId']][_0x8e07('0x72')]:_0xa825e3[_0x5e83e4]['field'];_0x24e6c9=_0xa825e3[_0x5e83e4][_0x8e07('0x73')]?_[_0x8e07('0x74')](_0x8b5241[_0xa825e3[_0x5e83e4][_0x8e07('0x73')]],'%s',_0x24e6c9):_0x24e6c9;_0x24e6c9=_0xa825e3[_0x5e83e4][_0x8e07('0x75')]?_[_0x8e07('0x74')](_0xde9300[_0xa825e3[_0x5e83e4][_0x8e07('0x75')]],'%s',_0x24e6c9):_0x24e6c9;if(_0xa825e3[_0x5e83e4][_0x8e07('0x76')]){_0x34e0de[_0x8e07('0x66')](_0x24e6c9);}_0xa825e3[_0x5e83e4][_0x8e07('0x77')]&&_0x34e0de['order'](_0x24e6c9,_0xa825e3[_0x5e83e4][_0x8e07('0x77')]===_0x8e07('0x78')?![]:!![]);_0x34e0de[_0x8e07('0x67')](_0x24e6c9,_0xa825e3[_0x5e83e4][_0x8e07('0x79')]||_0x24e6c9);}if(_0x202236[_0x8e07('0x7a')]){_0x202236[_0x8e07('0x7a')]=JSON[_0x8e07('0x7b')](_0x202236[_0x8e07('0x7a')]);for(var _0x2b4f0c=0x0;_0x2b4f0c<_0x202236['joins'][_0x8e07('0x36')];_0x2b4f0c+=0x1){if(_0x202236['joins'][_0x2b4f0c][_0x8e07('0x2e')]&&_[_0x8e07('0x5f')](_0x2af747,_0x202236[_0x8e07('0x7a')][_0x2b4f0c]['type'])&&_0x202236[_0x8e07('0x7a')][_0x2b4f0c][_0x8e07('0x7c')]&&_0x202236[_0x8e07('0x7a')][_0x2b4f0c][_0x8e07('0x7d')]&&_0x202236[_0x8e07('0x7a')][_0x2b4f0c][_0x8e07('0x7e')]){_0x34e0de[_0x202236[_0x8e07('0x7a')][_0x2b4f0c][_0x8e07('0x2e')]](_0x202236['joins'][_0x2b4f0c][_0x8e07('0x7d')],null,util['format'](_0x8e07('0x7f'),_0x202236[_0x8e07('0x70')],_0x202236['joins'][_0x2b4f0c][_0x8e07('0x7c')],_0x202236[_0x8e07('0x7a')][_0x2b4f0c]['foreignTable'],_0x202236[_0x8e07('0x7a')][_0x2b4f0c][_0x8e07('0x7e')]));}}}if(_0x202236[_0x8e07('0x80')]){_0x202236[_0x8e07('0x80')]=JSON['parse'](_0x202236['conditions']);_0x34e0de['where'](_0x398a51(_0x202236[_0x8e07('0x80')][_0x8e07('0x66')]));}_0x5e2de3=_0x34e0de[_0x8e07('0x81')]();_0x34e0de[_0x8e07('0x39')](_0x1e3df2);_0x34e0de['offset'](0x0);logger['debug'](_0x8e07('0x82'),_0x34e0de['toString']());return dbH[_0x8e07('0x83')][_0x8e07('0x32')](_0x34e0de[_0x8e07('0x84')](),{'type':dbH[_0x8e07('0x83')][_0x8e07('0x85')]['SELECT']});}})[_0x8e07('0x21')](respondWithResult(_0x5e827d,null))['catch'](handleError(_0x5e827d,null));};function runReport(_0x21d995,_0x3f1a75,_0x48a559){var _0x25daca=_0x3f1a75[_0x8e07('0x29')];var _0x34d39e=0xa;var _0x435316=[_0x8e07('0x86'),_0x8e07('0x87'),_0x8e07('0x88'),'cross_join'];var _0x2c2343={'SUM':_0x8e07('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x8e07('0x56'),'MAX':'MAX(%s)','MIN':_0x8e07('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x8e07('0x89'),'GROUP_CONCAT ASC':_0x8e07('0x59'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xbea1f7={'SEC_TO_TIME':_0x8e07('0x8a'),'DATE':_0x8e07('0x5b'),'HOUR':_0x8e07('0x5c'),'ROUND':_0x8e07('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5e70ea=function(_0x44c068){return!_[_0x8e07('0x5f')]([_0x8e07('0x60'),'IS\x20NOT\x20NULL',_0x8e07('0x62'),_0x8e07('0x63')],_0x44c068);};var _0x3093ff=function(_0x5e0420){if(!_0x5e0420||!_0x5e0420['rules'][_0x8e07('0x36')]){return'';}for(var _0x4d0150='(',_0x9547fe=0x0;_0x9547fe<_0x5e0420[_0x8e07('0x64')][_0x8e07('0x36')];_0x9547fe+=0x1){_0x9547fe>0x0&&(_0x4d0150+='\x20'+_0x5e0420[_0x8e07('0x65')]+'\x20');_0x4d0150+=_0x5e0420[_0x8e07('0x64')][_0x9547fe][_0x8e07('0x66')]?_0x3093ff(_0x5e0420[_0x8e07('0x64')][_0x9547fe][_0x8e07('0x66')]):_0x5e0420['rules'][_0x9547fe]['field']+'\x20'+_0x5e0420[_0x8e07('0x64')][_0x9547fe][_0x8e07('0x68')]+(_0x5e70ea(_0x5e0420[_0x8e07('0x64')][_0x9547fe]['condition'])?'\x20'+_0x5e0420[_0x8e07('0x64')][_0x9547fe]['value']:'');}return _0x4d0150+')';};var _0x4a4e8a={'where':{'id':_0x21d995['id']}},_0x1f401a,_0x2ef321,_0x50e403,_0x4cdaf6,_0x2bc453;_0x4a4e8a=_[_0x8e07('0x3f')]({},_0x4a4e8a,_0x48a559);return db[_0x8e07('0x2c')][_0x8e07('0x49')](_0x4a4e8a)[_0x8e07('0x21')](function(_0x483c71){if(_0x483c71){_0x1f401a=_0x483c71;return _0x483c71[_0x8e07('0x8b')]();}return null;})[_0x8e07('0x21')](function(_0x43cbd0){if(_0x43cbd0){if(!_0x43cbd0[_0x8e07('0x36')]){throw new db['Sequelize'][(_0x8e07('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2ef321=_0x43cbd0;return db[_0x8e07('0x6d')][_0x8e07('0x45')]({'raw':!![]});}return null;})[_0x8e07('0x21')](function(_0x4fddaf){if(_0x4fddaf){_0x50e403=_[_0x8e07('0x8c')](_0x4fddaf,'id');var _0x5eba2b;var _0xdfa51=squel['select']();_0xdfa51['from'](_0x1f401a[_0x8e07('0x70')]);for(var _0x49a92c=0x0;_0x49a92c<_0x2ef321[_0x8e07('0x36')];_0x49a92c+=0x1){_0x5eba2b=_0x2ef321[_0x49a92c]['MetricId']?_0x50e403[_0x2ef321[_0x49a92c][_0x8e07('0x71')]][_0x8e07('0x72')]:_0x2ef321[_0x49a92c]['field'];_0x5eba2b=_0x2ef321[_0x49a92c]['function']?_[_0x8e07('0x74')](_0x2c2343[_0x2ef321[_0x49a92c][_0x8e07('0x73')]],'%s',_0x5eba2b):_0x5eba2b;_0x5eba2b=_0x2ef321[_0x49a92c][_0x8e07('0x75')]?_[_0x8e07('0x74')](_0xbea1f7[_0x2ef321[_0x49a92c]['format']],'%s',_0x5eba2b):_0x5eba2b;if(_0x2ef321[_0x49a92c][_0x8e07('0x76')]){_0xdfa51[_0x8e07('0x66')](_0x5eba2b);}_0x2ef321[_0x49a92c]['orderBy']&&_0xdfa51[_0x8e07('0x3a')](_0x5eba2b,_0x2ef321[_0x49a92c][_0x8e07('0x77')]==='DESC'?![]:!![]);_0xdfa51['field'](_0x5eba2b,_0x2ef321[_0x49a92c][_0x8e07('0x79')]||_0x5eba2b);}if(_0x1f401a[_0x8e07('0x7a')]){_0x1f401a['joins']=JSON[_0x8e07('0x7b')](_0x1f401a['joins']);for(var _0x2bb93b=0x0;_0x2bb93b<_0x1f401a['joins']['length'];_0x2bb93b+=0x1){if(_0x1f401a['joins'][_0x2bb93b][_0x8e07('0x2e')]&&_[_0x8e07('0x5f')](_0x435316,_0x1f401a['joins'][_0x2bb93b][_0x8e07('0x2e')])&&_0x1f401a[_0x8e07('0x7a')][_0x2bb93b][_0x8e07('0x7c')]&&_0x1f401a[_0x8e07('0x7a')][_0x2bb93b][_0x8e07('0x7d')]&&_0x1f401a[_0x8e07('0x7a')][_0x2bb93b][_0x8e07('0x7e')]){_0xdfa51[_0x1f401a[_0x8e07('0x7a')][_0x2bb93b][_0x8e07('0x2e')]](_0x1f401a[_0x8e07('0x7a')][_0x2bb93b][_0x8e07('0x7d')],null,util[_0x8e07('0x75')](_0x8e07('0x7f'),_0x1f401a[_0x8e07('0x70')],_0x1f401a[_0x8e07('0x7a')][_0x2bb93b]['parentKey'],_0x1f401a['joins'][_0x2bb93b][_0x8e07('0x7d')],_0x1f401a[_0x8e07('0x7a')][_0x2bb93b][_0x8e07('0x7e')]));}}}if(_0x1f401a[_0x8e07('0x80')]){_0x1f401a[_0x8e07('0x80')]=JSON[_0x8e07('0x7b')](_0x1f401a[_0x8e07('0x80')]);_0xdfa51['where'](_0x3093ff(_0x1f401a[_0x8e07('0x80')][_0x8e07('0x66')]));}_0x2bc453=_0xdfa51[_0x8e07('0x81')]();_0xdfa51[_0x8e07('0x39')](_0x34d39e);_0xdfa51['offset'](0x0);return;}})['then'](function(){if(_0x3f1a75[_0x8e07('0x8d')]==='web'){return null;}var _0x2d3bd1=_[_0x8e07('0x3f')](_0x3f1a75,{'name':_0x3f1a75[_0x8e07('0x8e')]||_0x3f1a75[_0x8e07('0x29')]||_0x1f401a[_0x8e07('0x29')],'basename':_0x25daca,'savename':util[_0x8e07('0x75')](_0x8e07('0x8f'),_0x3f1a75[_0x8e07('0x29')]||_0x1f401a[_0x8e07('0x29')],require('randomstring')[_0x8e07('0x90')](0x4),_0x3f1a75[_0x8e07('0x8d')]||'csv'),'reportId':_0x1f401a['id'],'reportType':'default'});return db['AnalyticExtractedReport']['create'](_0x2d3bd1,{'raw':!![]});})['then'](function(_0x30c911){if(_0x1f401a['table']===_0x8e07('0x91')){_0x2bc453['where'](_0x1f401a['table']+_0x8e07('0x92'),_0x3f1a75[_0x8e07('0x93')],_0x3f1a75['endDate']);}else{_0x2bc453[_0x8e07('0x3e')](_0x1f401a[_0x8e07('0x70')]+_0x8e07('0x94'),_0x3f1a75[_0x8e07('0x93')],_0x3f1a75[_0x8e07('0x95')]);}if(_0x30c911){logger[_0x8e07('0x96')](_0x8e07('0x97'),_0x2bc453[_0x8e07('0x84')]());require(_0x8e07('0x98'))[_0x8e07('0x99')](path[_0x8e07('0x86')](__dirname,_0x8e07('0x9a'),_0x30c911[_0x8e07('0x8d')]),[_0x30c911['id'],_0x2bc453[_0x8e07('0x84')](),path[_0x8e07('0x86')](__dirname,_0x8e07('0x9b'),_0x30c911[_0x8e07('0x9c')]),_0x25daca]);return _0x30c911;}else{var _0x5b56ea=squel[_0x8e07('0x6e')]();_0x5b56ea[_0x8e07('0x6f')]('('+_0x2bc453[_0x8e07('0x84')]()+')',_0x8e07('0x9d'));_0x5b56ea[_0x8e07('0x67')](_0x8e07('0x9e'),_0x8e07('0x19'));_0x2bc453[_0x8e07('0x39')](_0x3f1a75[_0x8e07('0x39')]||_0x34d39e);_0x2bc453[_0x8e07('0x1a')](_0x3f1a75[_0x8e07('0x1a')]||0x0);return dbH[_0x8e07('0x83')]['query'](_0x5b56ea['toString'](),{'type':dbH[_0x8e07('0x83')][_0x8e07('0x85')]['SELECT']})['then'](function(_0x150523){if(!_0x150523[_0x8e07('0x36')]){_0x4cdaf6=0x0;}else{_0x4cdaf6=_0x150523[0x0][_0x8e07('0x19')]||0x0;}return dbH[_0x8e07('0x83')][_0x8e07('0x32')](_0x2bc453[_0x8e07('0x84')](),{'type':dbH[_0x8e07('0x83')][_0x8e07('0x85')]['SELECT']});})[_0x8e07('0x21')](function(_0x3981b2){return{'rows':_0x3981b2||[],'count':_0x4cdaf6};});}});}exports[_0x8e07('0x9f')]=function(_0xe0fd9,_0x162409){return runReport(_0xe0fd9[_0x8e07('0x48')],_0xe0fd9[_0x8e07('0x32')],_0xe0fd9[_0x8e07('0x42')])['then'](respondWithResult(_0x162409,null))[_0x8e07('0x46')](handleError(_0x162409,null));};exports[_0x8e07('0xa0')]=runReport;exports['query']=function(_0x1667c8,_0x5afcfc){var _0x1e1b11=0xa;var _0x31eebb=[_0x8e07('0x86'),_0x8e07('0x87'),_0x8e07('0x88'),'cross_join'];var _0x2d9647={'SUM':_0x8e07('0x54'),'COUNT':_0x8e07('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x8e07('0xa1'),'MIN':_0x8e07('0x57'),'AVG':_0x8e07('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x8e07('0x59'),'GROUP_CONCAT DESC':_0x8e07('0x5a')};var _0x3fee27={'SEC_TO_TIME':_0x8e07('0x8a'),'DATE':'DATE(%s)','HOUR':_0x8e07('0x5c'),'ROUND':_0x8e07('0x5d'),'UNIX_TIMESTAMP':_0x8e07('0x5e')};var _0x543b0c=function(_0x54c371){return!_[_0x8e07('0x5f')](['IS\x20NULL',_0x8e07('0x61'),_0x8e07('0x62'),'IS\x20NOT\x20EMPTY'],_0x54c371);};var _0x3b51e5=function(_0x22f155){if(!_0x22f155||!_0x22f155[_0x8e07('0x64')][_0x8e07('0x36')]){return'';}for(var _0x2b0b83='(',_0x34c01e=0x0;_0x34c01e<_0x22f155[_0x8e07('0x64')][_0x8e07('0x36')];_0x34c01e+=0x1){_0x34c01e>0x0&&(_0x2b0b83+='\x20'+_0x22f155[_0x8e07('0x65')]+'\x20');_0x2b0b83+=_0x22f155[_0x8e07('0x64')][_0x34c01e]['group']?_0x3b51e5(_0x22f155['rules'][_0x34c01e][_0x8e07('0x66')]):_0x22f155[_0x8e07('0x64')][_0x34c01e]['field']+'\x20'+_0x22f155[_0x8e07('0x64')][_0x34c01e][_0x8e07('0x68')]+(_0x543b0c(_0x22f155[_0x8e07('0x64')][_0x34c01e]['condition'])?'\x20'+_0x22f155[_0x8e07('0x64')][_0x34c01e][_0x8e07('0x69')]:'');}return _0x2b0b83+')';};var _0x4d47e8={'where':{'id':_0x1667c8[_0x8e07('0x48')]['id']}},_0x1ed6bf,_0x5c80f2,_0x2d428b,_0x3aa277,_0x312ca8;_0x4d47e8=_[_0x8e07('0x3f')]({},_0x4d47e8,_0x1667c8['options']);return db[_0x8e07('0x2c')][_0x8e07('0x49')](_0x4d47e8)[_0x8e07('0x21')](function(_0x5242c4){if(_0x5242c4){_0x1ed6bf=_0x5242c4;return _0x5242c4[_0x8e07('0x8b')]();}return null;})[_0x8e07('0x21')](function(_0x440c29){if(_0x440c29){if(!_0x440c29[_0x8e07('0x36')]){throw new db[(_0x8e07('0x6a'))][(_0x8e07('0x6b'))](_0x8e07('0x6c'),0x193);}_0x5c80f2=_0x440c29;return db[_0x8e07('0x6d')][_0x8e07('0x45')]({'raw':!![]});}return null;})[_0x8e07('0x21')](function(_0x18b3c6){if(_0x18b3c6){_0x2d428b=_['keyBy'](_0x18b3c6,'id');var _0x59b2f4;var _0x189872=squel['select']();_0x189872['from'](_0x1ed6bf[_0x8e07('0x70')]);for(var _0x3a2f43=0x0;_0x3a2f43<_0x5c80f2[_0x8e07('0x36')];_0x3a2f43+=0x1){_0x59b2f4=_0x5c80f2[_0x3a2f43][_0x8e07('0x71')]?_0x2d428b[_0x5c80f2[_0x3a2f43][_0x8e07('0x71')]][_0x8e07('0x72')]:_0x5c80f2[_0x3a2f43][_0x8e07('0x67')];_0x59b2f4=_0x5c80f2[_0x3a2f43][_0x8e07('0x73')]?_[_0x8e07('0x74')](_0x2d9647[_0x5c80f2[_0x3a2f43][_0x8e07('0x73')]],'%s',_0x59b2f4):_0x59b2f4;_0x59b2f4=_0x5c80f2[_0x3a2f43][_0x8e07('0x75')]?_[_0x8e07('0x74')](_0x3fee27[_0x5c80f2[_0x3a2f43][_0x8e07('0x75')]],'%s',_0x59b2f4):_0x59b2f4;if(_0x5c80f2[_0x3a2f43]['groupBy']){_0x189872[_0x8e07('0x66')](_0x59b2f4);}_0x5c80f2[_0x3a2f43]['orderBy']&&_0x189872[_0x8e07('0x3a')](_0x59b2f4,_0x5c80f2[_0x3a2f43][_0x8e07('0x77')]===_0x8e07('0x78')?![]:!![]);_0x189872[_0x8e07('0x67')](_0x59b2f4,_0x5c80f2[_0x3a2f43][_0x8e07('0x79')]||_0x59b2f4);}if(_0x1ed6bf[_0x8e07('0x7a')]){_0x1ed6bf[_0x8e07('0x7a')]=JSON[_0x8e07('0x7b')](_0x1ed6bf[_0x8e07('0x7a')]);for(var _0x17ee2e=0x0;_0x17ee2e<_0x1ed6bf[_0x8e07('0x7a')][_0x8e07('0x36')];_0x17ee2e+=0x1){if(_0x1ed6bf[_0x8e07('0x7a')][_0x17ee2e][_0x8e07('0x2e')]&&_['includes'](_0x31eebb,_0x1ed6bf[_0x8e07('0x7a')][_0x17ee2e]['type'])&&_0x1ed6bf[_0x8e07('0x7a')][_0x17ee2e][_0x8e07('0x7c')]&&_0x1ed6bf[_0x8e07('0x7a')][_0x17ee2e]['foreignTable']&&_0x1ed6bf[_0x8e07('0x7a')][_0x17ee2e][_0x8e07('0x7e')]){_0x189872[_0x1ed6bf[_0x8e07('0x7a')][_0x17ee2e][_0x8e07('0x2e')]](_0x1ed6bf['joins'][_0x17ee2e][_0x8e07('0x7d')],null,util[_0x8e07('0x75')]('%s.%s\x20=\x20%s.%s',_0x1ed6bf[_0x8e07('0x70')],_0x1ed6bf['joins'][_0x17ee2e][_0x8e07('0x7c')],_0x1ed6bf[_0x8e07('0x7a')][_0x17ee2e][_0x8e07('0x7d')],_0x1ed6bf['joins'][_0x17ee2e][_0x8e07('0x7e')]));}}}if(_0x1ed6bf[_0x8e07('0x80')]){_0x1ed6bf[_0x8e07('0x80')]=JSON[_0x8e07('0x7b')](_0x1ed6bf[_0x8e07('0x80')]);_0x189872['where'](_0x3b51e5(_0x1ed6bf[_0x8e07('0x80')][_0x8e07('0x66')]));}_0x312ca8=_0x189872['clone']();_0x189872[_0x8e07('0x39')](_0x1e1b11);_0x189872['offset'](0x0);logger[_0x8e07('0xa2')]('Limited\x20Query:',_0x189872['toString']());return dbH['sequelize'][_0x8e07('0x32')](_0x189872['toString'](),{'type':dbH[_0x8e07('0x83')]['QueryTypes']['SELECT']});}})['then'](function(){return{'sql':_0x312ca8[_0x8e07('0x84')]()};})['then'](respondWithResult(_0x5afcfc,null))[_0x8e07('0x46')](handleError(_0x5afcfc,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 6e16427..91f036f 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 _0x5dad=['path','rimraf','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','moment'];(function(_0x259374,_0x36d9bb){var _0x6c0b6a=function(_0xe32466){while(--_0xe32466){_0x259374['push'](_0x259374['shift']());}};_0x6c0b6a(++_0x36d9bb);}(_0x5dad,0x128));var _0xd5da=function(_0x49f956,_0x41d49c){_0x49f956=_0x49f956-0x0;var _0x18b8b4=_0x5dad[_0x49f956];return _0x18b8b4;};'use strict';var _=require(_0xd5da('0x0'));var util=require(_0xd5da('0x1'));var logger=require(_0xd5da('0x2'))('api');var moment=require(_0xd5da('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd5da('0x4'));var rimraf=require(_0xd5da('0x5'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0xd5da('0x6')]=function(_0x1f8203,_0x324e2d){return _0x1f8203[_0xd5da('0x7')](_0xd5da('0x8'),attributes,{'tableName':_0xd5da('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a38=['path','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x411641,_0x411c9f){var _0x4ec173=function(_0x20e04d){while(--_0x20e04d){_0x411641['push'](_0x411641['shift']());}};_0x4ec173(++_0x411c9f);}(_0x5a38,0xaf));var _0x85a3=function(_0x4c184d,_0x4278ab){_0x4c184d=_0x4c184d-0x0;var _0x23d997=_0x5a38[_0x4c184d];return _0x23d997;};'use strict';var _=require(_0x85a3('0x0'));var util=require(_0x85a3('0x1'));var logger=require(_0x85a3('0x2'))(_0x85a3('0x3'));var moment=require(_0x85a3('0x4'));var BPromise=require(_0x85a3('0x5'));var rp=require(_0x85a3('0x6'));var fs=require('fs');var path=require(_0x85a3('0x7'));var rimraf=require('rimraf');var config=require(_0x85a3('0x8'));var attributes=require(_0x85a3('0x9'));module[_0x85a3('0xa')]=function(_0x14a796,_0x381bc9){return _0x14a796[_0x85a3('0xb')](_0x85a3('0xc'),attributes,{'tableName':_0x85a3('0xd'),'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 efc92ac..cdc3ece 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 _0x0cfa=['client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x64a51,_0x1c61b7){var _0x1eba45=function(_0x230cf8){while(--_0x230cf8){_0x64a51['push'](_0x64a51['shift']());}};_0x1eba45(++_0x1c61b7);}(_0x0cfa,0x73));var _0xa0cf=function(_0x3f0681,_0xe1e89c){_0x3f0681=_0x3f0681-0x0;var _0x5338e0=_0x0cfa[_0x3f0681];return _0x5338e0;};'use strict';var _=require(_0xa0cf('0x0'));var util=require(_0xa0cf('0x1'));var moment=require(_0xa0cf('0x2'));var BPromise=require(_0xa0cf('0x3'));var rs=require(_0xa0cf('0x4'));var fs=require('fs');var Redis=require(_0xa0cf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa0cf('0x6'));var logger=require('../../config/logger')(_0xa0cf('0x7'));var config=require(_0xa0cf('0x8'));var jayson=require(_0xa0cf('0x9'));var client=jayson[_0xa0cf('0xa')][_0xa0cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3235b4,_0xa63ed,_0x1e3ad1){return new BPromise(function(_0x2dbef8,_0x4e2b85){return client[_0xa0cf('0xc')](_0x3235b4,_0x1e3ad1)[_0xa0cf('0xd')](function(_0x1ba1b7){logger[_0xa0cf('0xe')](_0xa0cf('0xf'),_0xa63ed,'request\x20sent');logger[_0xa0cf('0x10')](_0xa0cf('0x11'),_0xa63ed,'request\x20sent',JSON[_0xa0cf('0x12')](_0x1ba1b7));if(_0x1ba1b7[_0xa0cf('0x13')]){if(_0x1ba1b7[_0xa0cf('0x13')][_0xa0cf('0x14')]===0x1f4){logger[_0xa0cf('0x13')](_0xa0cf('0xf'),_0xa63ed,_0x1ba1b7[_0xa0cf('0x13')][_0xa0cf('0x15')]);return _0x4e2b85(_0x1ba1b7[_0xa0cf('0x13')][_0xa0cf('0x15')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0xa63ed,_0x1ba1b7[_0xa0cf('0x13')][_0xa0cf('0x15')]);return _0x2dbef8(_0x1ba1b7[_0xa0cf('0x13')][_0xa0cf('0x15')]);}else{logger[_0xa0cf('0xe')](_0xa0cf('0xf'),_0xa63ed,_0xa0cf('0x16'));_0x2dbef8(_0x1ba1b7[_0xa0cf('0x17')]['message']);}})[_0xa0cf('0x18')](function(_0x594304){logger['error'](_0xa0cf('0xf'),_0xa63ed,_0x594304);_0x4e2b85(_0x594304);});});} \ No newline at end of file +var _0xb16f=['error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','request','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x97c6ea,_0x4cffce){var _0x2d7f50=function(_0x54010e){while(--_0x54010e){_0x97c6ea['push'](_0x97c6ea['shift']());}};_0x2d7f50(++_0x4cffce);}(_0xb16f,0xf6));var _0xfb16=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0xb16f[_0x15ca1a];return _0x507626;};'use strict';var _=require(_0xfb16('0x0'));var util=require(_0xfb16('0x1'));var moment=require(_0xfb16('0x2'));var BPromise=require('bluebird');var rs=require(_0xfb16('0x3'));var fs=require('fs');var Redis=require(_0xfb16('0x4'));var db=require(_0xfb16('0x5'))['db'];var utils=require(_0xfb16('0x6'));var logger=require('../../config/logger')(_0xfb16('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3cdd5e,_0x4de946,_0x1e615f){return new BPromise(function(_0x4b5296,_0x119b28){return client[_0xfb16('0x8')](_0x3cdd5e,_0x1e615f)['then'](function(_0x4fc6bf){logger['info'](_0xfb16('0x9'),_0x4de946,_0xfb16('0xa'));logger[_0xfb16('0xb')](_0xfb16('0xc'),_0x4de946,_0xfb16('0xa'),JSON[_0xfb16('0xd')](_0x4fc6bf));if(_0x4fc6bf[_0xfb16('0xe')]){if(_0x4fc6bf[_0xfb16('0xe')][_0xfb16('0xf')]===0x1f4){logger[_0xfb16('0xe')](_0xfb16('0x9'),_0x4de946,_0x4fc6bf['error'][_0xfb16('0x10')]);return _0x119b28(_0x4fc6bf['error']['message']);}logger[_0xfb16('0xe')](_0xfb16('0x9'),_0x4de946,_0x4fc6bf[_0xfb16('0xe')]['message']);return _0x4b5296(_0x4fc6bf[_0xfb16('0xe')][_0xfb16('0x10')]);}else{logger[_0xfb16('0x11')](_0xfb16('0x9'),_0x4de946,_0xfb16('0xa'));_0x4b5296(_0x4fc6bf[_0xfb16('0x12')][_0xfb16('0x10')]);}})[_0xfb16('0x13')](function(_0x384f74){logger[_0xfb16('0xe')](_0xfb16('0x9'),_0x4de946,_0x384f74);_0x119b28(_0x384f74);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 6119b06..5ba1713 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 _0x1360=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1360,0x14b));var _0x0136=function(_0x16f2df,_0x23470a){_0x16f2df=_0x16f2df-0x0;var _0x5975f1=_0x1360[_0x16f2df];return _0x5975f1;};'use strict';var multer=require(_0x0136('0x0'));var util=require('util');var path=require(_0x0136('0x1'));var timeout=require(_0x0136('0x2'));var express=require(_0x0136('0x3'));var router=express[_0x0136('0x4')]();var auth=require(_0x0136('0x5'));var interaction=require(_0x0136('0x6'));var config=require(_0x0136('0x7'));var controller=require(_0x0136('0x8'));router[_0x0136('0x9')]('/',auth[_0x0136('0xa')](),controller['index']);router['get'](_0x0136('0xb'),auth[_0x0136('0xa')](),controller[_0x0136('0xc')]);router['get'](_0x0136('0xd'),auth[_0x0136('0xa')](),controller[_0x0136('0xe')]);router[_0x0136('0x9')](_0x0136('0xf'),auth[_0x0136('0xa')](),controller[_0x0136('0x10')]);router['get'](_0x0136('0x11'),auth['isAuthenticated'](),controller['query']);router['post']('/',auth[_0x0136('0xa')](),controller[_0x0136('0x12')]);router[_0x0136('0x13')](_0x0136('0xb'),auth[_0x0136('0xa')](),controller[_0x0136('0x14')]);router[_0x0136('0x15')]('/:id',auth[_0x0136('0xa')](),controller[_0x0136('0x16')]);module[_0x0136('0x17')]=router; \ No newline at end of file +var _0x6f01=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','run','/:id/query','query','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x6f01,0x102));var _0x16f0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6f01[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x16f0('0x0'));var util=require(_0x16f0('0x1'));var path=require(_0x16f0('0x2'));var timeout=require(_0x16f0('0x3'));var express=require(_0x16f0('0x4'));var router=express[_0x16f0('0x5')]();var auth=require(_0x16f0('0x6'));var interaction=require(_0x16f0('0x7'));var config=require(_0x16f0('0x8'));var controller=require(_0x16f0('0x9'));router[_0x16f0('0xa')]('/',auth[_0x16f0('0xb')](),controller[_0x16f0('0xc')]);router[_0x16f0('0xa')](_0x16f0('0xd'),auth[_0x16f0('0xb')](),controller[_0x16f0('0xe')]);router[_0x16f0('0xa')](_0x16f0('0xf'),auth[_0x16f0('0xb')](),controller['preview']);router[_0x16f0('0xa')](_0x16f0('0x10'),auth['isAuthenticated'](),controller[_0x16f0('0x11')]);router[_0x16f0('0xa')](_0x16f0('0x12'),auth[_0x16f0('0xb')](),controller[_0x16f0('0x13')]);router['post']('/',auth[_0x16f0('0xb')](),controller[_0x16f0('0x14')]);router['put']('/:id',auth[_0x16f0('0xb')](),controller[_0x16f0('0x15')]);router['delete'](_0x16f0('0xd'),auth[_0x16f0('0xb')](),controller[_0x16f0('0x16')]);module[_0x16f0('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 59e9f74..369c822 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 _0x3640=['ENUM','pdf','xlsx','csv','DATE','manual','scheduled','INTEGER','UNSIGNED','sequelize','STRING'];(function(_0x4c1c6a,_0x4c1ef5){var _0x59a9df=function(_0x6825f8){while(--_0x6825f8){_0x4c1c6a['push'](_0x4c1c6a['shift']());}};_0x59a9df(++_0x4c1ef5);}(_0x3640,0x82));var _0x0364=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x3640[_0x13ea00];return _0x1f7347;};'use strict';var Sequelize=require(_0x0364('0x0'));var moment=require('moment');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x0364('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x0364('0x2')]('csv',_0x0364('0x3'),_0x0364('0x4')),'allowNull':![],'defaultValue':_0x0364('0x5')},'savename':{'type':Sequelize[_0x0364('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x0364('0x6')]},'endDate':{'type':Sequelize[_0x0364('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x0364('0x7'),_0x0364('0x8')),'allowNull':![],'defaultValue':_0x0364('0x7')},'reportId':{'type':Sequelize[_0x0364('0x9')](0xb)[_0x0364('0xa')]},'reportType':{'type':Sequelize[_0x0364('0x1')]}}; \ No newline at end of file +var _0x8b1c=['exports','ENUM','csv','pdf','STRING','DATE','Loading','manual','scheduled','INTEGER','sequelize','moment'];(function(_0x2dc7c9,_0x3a15f8){var _0x3e6536=function(_0x312829){while(--_0x312829){_0x2dc7c9['push'](_0x2dc7c9['shift']());}};_0x3e6536(++_0x3a15f8);}(_0x8b1c,0xfa));var _0xc8b1=function(_0x589ae0,_0x46d0e8){_0x589ae0=_0x589ae0-0x0;var _0x23eedd=_0x8b1c[_0x589ae0];return _0x23eedd;};'use strict';var Sequelize=require(_0xc8b1('0x0'));var moment=require(_0xc8b1('0x1'));module[_0xc8b1('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xc8b1('0x3')](_0xc8b1('0x4'),_0xc8b1('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0xc8b1('0x4')},'savename':{'type':Sequelize[_0xc8b1('0x6')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xc8b1('0x7')]},'status':{'type':Sequelize[_0xc8b1('0x6')],'defaultValue':_0xc8b1('0x8')},'type':{'type':Sequelize[_0xc8b1('0x3')](_0xc8b1('0x9'),_0xc8b1('0xa')),'allowNull':![],'defaultValue':_0xc8b1('0x9')},'reportId':{'type':Sequelize[_0xc8b1('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xc8b1('0x6')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 519f4e3..0cd5c95 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 _0x04a7=['reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','rows','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','catch','download','basename','savename','existsSync','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','format','%s.%s','output','toLowerCase','html-pdf','zip-dir','fast-json-patch','request-promise','moment','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','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x2ed804,_0x136085){var _0x1b3839=function(_0x54d89c){while(--_0x54d89c){_0x2ed804['push'](_0x2ed804['shift']());}};_0x1b3839(++_0x136085);}(_0x04a7,0x98));var _0x704a=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0x04a7[_0x2a67fe];return _0x57e726;};'use strict';var pdf=require(_0x704a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x704a('0x1'));var jsonpatch=require(_0x704a('0x2'));var rp=require(_0x704a('0x3'));var moment=require(_0x704a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x704a('0x5'));var util=require('util');var path=require(_0x704a('0x6'));var sox=require(_0x704a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x704a('0x8'));var squel=require(_0x704a('0x9'));var crypto=require(_0x704a('0xa'));var jsforce=require(_0x704a('0xb'));var deskjs=require(_0x704a('0xc'));var toCsv=require(_0x704a('0xd'));var querystring=require('querystring');var Papa=require(_0x704a('0xe'));var Redis=require(_0x704a('0xf'));var authService=require(_0x704a('0x10'));var qs=require(_0x704a('0x11'));var as=require(_0x704a('0x12'));var hardwareService=require(_0x704a('0x13'));var logger=require(_0x704a('0x14'))(_0x704a('0x15'));var utils=require(_0x704a('0x16'));var config=require(_0x704a('0x17'));var licenseUtil=require(_0x704a('0x18'));var db=require(_0x704a('0x19'))['db'];function respondWithStatusCode(_0xfe750f,_0x4ae269){_0x4ae269=_0x4ae269||0xcc;return function(_0x250d59){if(_0x250d59){return _0xfe750f[_0x704a('0x1a')](_0x4ae269);}return _0xfe750f[_0x704a('0x1b')](_0x4ae269)[_0x704a('0x1c')]();};}function respondWithResult(_0x3f8da5,_0x5bd495){_0x5bd495=_0x5bd495||0xc8;return function(_0x17491b){if(_0x17491b){return _0x3f8da5['status'](_0x5bd495)[_0x704a('0x1d')](_0x17491b);}};}function respondWithFilteredResult(_0xdfd2d8,_0x361157){return function(_0x26ad6a){if(_0x26ad6a){var _0x26f01c=_0x26ad6a[_0x704a('0x1e')],_0x2a6bf3=_0x361157[_0x704a('0x1f')],_0x1e2627=_0x361157[_0x704a('0x1f')]+_0x361157[_0x704a('0x20')],_0x4d02c4;if(_0x1e2627>=_0x26f01c){_0x1e2627=_0x26f01c;_0x4d02c4=0xc8;}else{_0x4d02c4=0xce;}_0xdfd2d8[_0x704a('0x1b')](_0x4d02c4);return _0xdfd2d8[_0x704a('0x21')]('Content-Range',_0x2a6bf3+'-'+_0x1e2627+'/'+_0x26f01c)[_0x704a('0x1d')](_0x26ad6a);}return null;};}function patchUpdates(_0x41fbf4){return function(_0x35bb05){try{jsonpatch['apply'](_0x35bb05,_0x41fbf4,!![]);}catch(_0x4cc93f){return BPromise[_0x704a('0x22')](_0x4cc93f);}return _0x35bb05[_0x704a('0x23')]();};}function saveUpdates(_0x36fd3b,_0x3cbde3){return function(_0x1bdf58){if(_0x1bdf58){return _0x1bdf58[_0x704a('0x24')](_0x36fd3b)['then'](function(_0xdad10f){return _0xdad10f;});}return null;};}function removeEntity(_0x1f901,_0x234b82){return function(_0x118d20){if(_0x118d20){return _0x118d20[_0x704a('0x25')]()[_0x704a('0x26')](function(){var _0x990558=_0x118d20[_0x704a('0x27')]({'plain':!![]});var _0xf746a0='ExtractedReports';return db[_0x704a('0x28')]['destroy']({'where':{'type':_0xf746a0,'resourceId':_0x990558['id']}})[_0x704a('0x26')](function(){return _0x118d20;});})[_0x704a('0x26')](function(){_0x1f901['status'](0xcc)[_0x704a('0x1c')]();});}};}function handleEntityNotFound(_0x1fba21,_0x451d9a){return function(_0x2479ac){if(!_0x2479ac){_0x1fba21[_0x704a('0x1a')](0x194);}return _0x2479ac;};}function handleError(_0x3e45fc,_0x52f4a0){_0x52f4a0=_0x52f4a0||0x1f4;return function(_0x5b078c){logger[_0x704a('0x29')](_0x5b078c[_0x704a('0x2a')]);if(_0x5b078c['name']){delete _0x5b078c[_0x704a('0x2b')];}_0x3e45fc['status'](_0x52f4a0)[_0x704a('0x2c')](_0x5b078c);};}exports[_0x704a('0x2d')]=function(_0x1ec3ee,_0x2e8800){var _0x24f226={},_0x1b7dd7={},_0x3c2502={'count':0x0,'rows':[]};var _0x115a80=_['map'](db[_0x704a('0x2e')][_0x704a('0x2f')],function(_0x4ac83e){return{'name':_0x4ac83e[_0x704a('0x30')],'type':_0x4ac83e[_0x704a('0x31')][_0x704a('0x32')]};});_0x1b7dd7[_0x704a('0x33')]=_['map'](_0x115a80,_0x704a('0x2b'));_0x1b7dd7[_0x704a('0x34')]=_[_0x704a('0x35')](_0x1ec3ee[_0x704a('0x34')]);_0x1b7dd7[_0x704a('0x36')]=_[_0x704a('0x37')](_0x1b7dd7[_0x704a('0x33')],_0x1b7dd7['query']);_0x24f226[_0x704a('0x38')]=_[_0x704a('0x37')](_0x1b7dd7['model'],qs[_0x704a('0x39')](_0x1ec3ee['query'][_0x704a('0x39')]));_0x24f226['attributes']=_0x24f226[_0x704a('0x38')]['length']?_0x24f226[_0x704a('0x38')]:_0x1b7dd7['model'];if(!_0x1ec3ee[_0x704a('0x34')][_0x704a('0x3a')]('nolimit')){_0x24f226[_0x704a('0x20')]=qs['limit'](_0x1ec3ee[_0x704a('0x34')]['limit']);_0x24f226[_0x704a('0x1f')]=qs['offset'](_0x1ec3ee['query'][_0x704a('0x1f')]);}_0x24f226[_0x704a('0x3b')]=qs[_0x704a('0x3c')](_0x1ec3ee[_0x704a('0x34')][_0x704a('0x3c')]);_0x24f226[_0x704a('0x3d')]=qs[_0x704a('0x36')](_[_0x704a('0x3e')](_0x1ec3ee[_0x704a('0x34')],_0x1b7dd7[_0x704a('0x36')]),_0x115a80);if(_0x1ec3ee[_0x704a('0x34')][_0x704a('0x3f')]){_0x24f226[_0x704a('0x3d')]=_['merge'](_0x24f226[_0x704a('0x3d')],{'$or':_['map'](_0x115a80,function(_0x11cee1){if(_0x11cee1[_0x704a('0x31')]!=='VIRTUAL'){var _0x1281a8={};_0x1281a8[_0x11cee1['name']]={'$like':'%'+_0x1ec3ee[_0x704a('0x34')][_0x704a('0x3f')]+'%'};return _0x1281a8;}})});}_0x24f226=_[_0x704a('0x40')]({},_0x24f226,_0x1ec3ee['options']);var _0x10b714={'where':_0x24f226[_0x704a('0x3d')]};return db[_0x704a('0x2e')]['count'](_0x10b714)['then'](function(_0x5c7f90){_0x3c2502['count']=_0x5c7f90;if(_0x1ec3ee[_0x704a('0x34')][_0x704a('0x41')]){_0x24f226[_0x704a('0x42')]=[{'all':!![]}];}return db[_0x704a('0x2e')]['findAll'](_0x24f226);})[_0x704a('0x26')](function(_0x34a79a){_0x3c2502[_0x704a('0x43')]=_0x34a79a;return _0x3c2502;})[_0x704a('0x26')](respondWithFilteredResult(_0x2e8800,_0x24f226))['catch'](handleError(_0x2e8800,null));};exports['show']=function(_0x227960,_0x459cd5){var _0x1b0cdf={'raw':!![],'where':{'id':_0x227960[_0x704a('0x44')]['id']}},_0x3e4ec9={};_0x3e4ec9[_0x704a('0x33')]=_['keys'](db[_0x704a('0x2e')][_0x704a('0x2f')]);_0x3e4ec9[_0x704a('0x34')]=_['keys'](_0x227960[_0x704a('0x34')]);_0x3e4ec9[_0x704a('0x36')]=_[_0x704a('0x37')](_0x3e4ec9[_0x704a('0x33')],_0x3e4ec9['query']);_0x1b0cdf[_0x704a('0x38')]=_[_0x704a('0x37')](_0x3e4ec9['model'],qs['fields'](_0x227960['query'][_0x704a('0x39')]));_0x1b0cdf[_0x704a('0x38')]=_0x1b0cdf[_0x704a('0x38')][_0x704a('0x45')]?_0x1b0cdf['attributes']:_0x3e4ec9['model'];if(_0x227960[_0x704a('0x34')][_0x704a('0x41')]){_0x1b0cdf[_0x704a('0x42')]=[{'all':!![]}];}_0x1b0cdf=_[_0x704a('0x40')]({},_0x1b0cdf,_0x227960[_0x704a('0x46')]);return db[_0x704a('0x2e')][_0x704a('0x47')](_0x1b0cdf)[_0x704a('0x26')](handleEntityNotFound(_0x459cd5,null))[_0x704a('0x26')](respondWithResult(_0x459cd5,null))['catch'](handleError(_0x459cd5,null));};exports[_0x704a('0x48')]=function(_0x443471,_0x1b91e1){return db[_0x704a('0x2e')][_0x704a('0x48')](_0x443471[_0x704a('0x49')],{})[_0x704a('0x26')](function(_0x53e49a){var _0x2ad7da=_0x443471[_0x704a('0x4a')][_0x704a('0x27')]({'plain':!![]});if(!_0x2ad7da)throw new Error(_0x704a('0x4b'));if(_0x2ad7da[_0x704a('0x4c')]==='user'){var _0x50e280=_0x53e49a[_0x704a('0x27')]({'plain':!![]});var _0x20a8af='ExtractedReports';return db['UserProfileSection']['find']({'where':{'name':_0x20a8af,'userProfileId':_0x2ad7da[_0x704a('0x4d')]},'raw':!![]})['then'](function(_0x319001){if(_0x319001&&_0x319001[_0x704a('0x4e')]===0x0){return db['UserProfileResource'][_0x704a('0x48')]({'name':_0x50e280[_0x704a('0x2b')],'resourceId':_0x50e280['id'],'type':_0x319001[_0x704a('0x2b')],'sectionId':_0x319001['id']},{})[_0x704a('0x26')](function(){return _0x53e49a;});}else{return _0x53e49a;}})[_0x704a('0x4f')](function(_0x28032b){logger[_0x704a('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28032b);throw _0x28032b;});}return _0x53e49a;})[_0x704a('0x26')](respondWithResult(_0x1b91e1,0xc9))[_0x704a('0x4f')](handleError(_0x1b91e1,null));};exports[_0x704a('0x24')]=function(_0x5f15a0,_0x2dff63){if(_0x5f15a0[_0x704a('0x49')]['id']){delete _0x5f15a0[_0x704a('0x49')]['id'];}return db[_0x704a('0x2e')][_0x704a('0x47')]({'where':{'id':_0x5f15a0[_0x704a('0x44')]['id']}})[_0x704a('0x26')](handleEntityNotFound(_0x2dff63,null))['then'](saveUpdates(_0x5f15a0[_0x704a('0x49')],null))['then'](respondWithResult(_0x2dff63,null))[_0x704a('0x4f')](handleError(_0x2dff63,null));};exports[_0x704a('0x25')]=function(_0x9b02c1,_0x313841){return db[_0x704a('0x2e')][_0x704a('0x47')]({'where':{'id':_0x9b02c1['params']['id']}})[_0x704a('0x26')](handleEntityNotFound(_0x313841,null))[_0x704a('0x26')](removeEntity(_0x313841,null))[_0x704a('0x4f')](handleError(_0x313841,null));};exports[_0x704a('0x50')]=function(_0x219ab0,_0x1299a8,_0x3a3664){return db[_0x704a('0x2e')]['find']({'where':{'id':_0x219ab0['params']['id']},'attributes':[_0x704a('0x2b'),_0x704a('0x51'),_0x704a('0x52'),'output'],'raw':!![]})[_0x704a('0x26')](handleEntityNotFound(_0x1299a8,null))['then'](function(_0xf6f63f){if(_0xf6f63f){if(!fs[_0x704a('0x53')](path[_0x704a('0x54')](config[_0x704a('0x55')],_0x704a('0x56'),_0xf6f63f['savename']))){throw new db['Sequelize'][(_0x704a('0x57'))](_0x704a('0x58'));}if(_0x219ab0[_0x704a('0x34')]['exists']){return _0x1299a8[_0x704a('0x1a')](0xc8);}return _0x1299a8[_0x704a('0x50')](path['join'](config[_0x704a('0x55')],'server/files/reports',_0xf6f63f['savename']),util[_0x704a('0x59')](_0x704a('0x5a'),_0xf6f63f[_0x704a('0x51')]||_0xf6f63f[_0x704a('0x2b')],_0xf6f63f[_0x704a('0x5b')][_0x704a('0x5c')]()));}})[_0x704a('0x4f')](handleError(_0x1299a8,null));}; \ No newline at end of file +var _0xf6e8=['fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','get','ExtractedReports','UserProfileResource','destroy','error','stack','name','send','map','AnalyticExtractedReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','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','download','basename','savename','output','join','root','server/files/reports','Sequelize','ValidationError','format','toLowerCase','html-pdf','zip-dir'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf6e8,0x115));var _0x8f6e=function(_0x26f20b,_0x12eef9){_0x26f20b=_0x26f20b-0x0;var _0x5d4dac=_0xf6e8[_0x26f20b];return _0x5d4dac;};'use strict';var pdf=require(_0x8f6e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8f6e('0x1'));var jsonpatch=require(_0x8f6e('0x2'));var rp=require(_0x8f6e('0x3'));var moment=require(_0x8f6e('0x4'));var BPromise=require(_0x8f6e('0x5'));var Mustache=require('mustache');var util=require(_0x8f6e('0x6'));var path=require(_0x8f6e('0x7'));var sox=require(_0x8f6e('0x8'));var csv=require('to-csv');var ejs=require(_0x8f6e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8f6e('0xa'));var crypto=require(_0x8f6e('0xb'));var jsforce=require(_0x8f6e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8f6e('0xd'));var querystring=require(_0x8f6e('0xe'));var Papa=require(_0x8f6e('0xf'));var Redis=require('ioredis');var authService=require(_0x8f6e('0x10'));var qs=require(_0x8f6e('0x11'));var as=require(_0x8f6e('0x12'));var hardwareService=require(_0x8f6e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x8f6e('0x14'));var config=require(_0x8f6e('0x15'));var licenseUtil=require(_0x8f6e('0x16'));var db=require(_0x8f6e('0x17'))['db'];function respondWithStatusCode(_0xffa53b,_0x74780c){_0x74780c=_0x74780c||0xcc;return function(_0x4c8e5b){if(_0x4c8e5b){return _0xffa53b[_0x8f6e('0x18')](_0x74780c);}return _0xffa53b[_0x8f6e('0x19')](_0x74780c)[_0x8f6e('0x1a')]();};}function respondWithResult(_0x2cd896,_0x2e3f67){_0x2e3f67=_0x2e3f67||0xc8;return function(_0xeee466){if(_0xeee466){return _0x2cd896['status'](_0x2e3f67)[_0x8f6e('0x1b')](_0xeee466);}};}function respondWithFilteredResult(_0x4e271e,_0x69ed03){return function(_0x242f38){if(_0x242f38){var _0x448e44=_0x242f38[_0x8f6e('0x1c')],_0x5ce9c8=_0x69ed03['offset'],_0x34e5ab=_0x69ed03[_0x8f6e('0x1d')]+_0x69ed03[_0x8f6e('0x1e')],_0x159188;if(_0x34e5ab>=_0x448e44){_0x34e5ab=_0x448e44;_0x159188=0xc8;}else{_0x159188=0xce;}_0x4e271e['status'](_0x159188);return _0x4e271e['set'](_0x8f6e('0x1f'),_0x5ce9c8+'-'+_0x34e5ab+'/'+_0x448e44)[_0x8f6e('0x1b')](_0x242f38);}return null;};}function patchUpdates(_0x35c52c){return function(_0x1f2354){try{jsonpatch[_0x8f6e('0x20')](_0x1f2354,_0x35c52c,!![]);}catch(_0x2ab8d9){return BPromise['reject'](_0x2ab8d9);}return _0x1f2354[_0x8f6e('0x21')]();};}function saveUpdates(_0x168ec0,_0x3441c3){return function(_0x121fea){if(_0x121fea){return _0x121fea[_0x8f6e('0x22')](_0x168ec0)[_0x8f6e('0x23')](function(_0x3bd36b){return _0x3bd36b;});}return null;};}function removeEntity(_0x329e36,_0x5afe27){return function(_0x5249ce){if(_0x5249ce){return _0x5249ce['destroy']()[_0x8f6e('0x23')](function(){var _0x81f42c=_0x5249ce[_0x8f6e('0x24')]({'plain':!![]});var _0x4e3ba8=_0x8f6e('0x25');return db[_0x8f6e('0x26')][_0x8f6e('0x27')]({'where':{'type':_0x4e3ba8,'resourceId':_0x81f42c['id']}})[_0x8f6e('0x23')](function(){return _0x5249ce;});})[_0x8f6e('0x23')](function(){_0x329e36[_0x8f6e('0x19')](0xcc)[_0x8f6e('0x1a')]();});}};}function handleEntityNotFound(_0x438f33,_0x3d4d5d){return function(_0x27f3b3){if(!_0x27f3b3){_0x438f33['sendStatus'](0x194);}return _0x27f3b3;};}function handleError(_0x47744c,_0x46f4c4){_0x46f4c4=_0x46f4c4||0x1f4;return function(_0x2cd7ce){logger[_0x8f6e('0x28')](_0x2cd7ce[_0x8f6e('0x29')]);if(_0x2cd7ce['name']){delete _0x2cd7ce[_0x8f6e('0x2a')];}_0x47744c[_0x8f6e('0x19')](_0x46f4c4)[_0x8f6e('0x2b')](_0x2cd7ce);};}exports['index']=function(_0x46646,_0x3053d5){var _0x46b361={},_0x1e1c94={},_0x1e083b={'count':0x0,'rows':[]};var _0x2be217=_[_0x8f6e('0x2c')](db[_0x8f6e('0x2d')][_0x8f6e('0x2e')],function(_0x2121df){return{'name':_0x2121df['fieldName'],'type':_0x2121df[_0x8f6e('0x2f')][_0x8f6e('0x30')]};});_0x1e1c94[_0x8f6e('0x31')]=_[_0x8f6e('0x2c')](_0x2be217,_0x8f6e('0x2a'));_0x1e1c94['query']=_[_0x8f6e('0x32')](_0x46646[_0x8f6e('0x33')]);_0x1e1c94[_0x8f6e('0x34')]=_[_0x8f6e('0x35')](_0x1e1c94[_0x8f6e('0x31')],_0x1e1c94['query']);_0x46b361[_0x8f6e('0x36')]=_[_0x8f6e('0x35')](_0x1e1c94[_0x8f6e('0x31')],qs[_0x8f6e('0x37')](_0x46646[_0x8f6e('0x33')][_0x8f6e('0x37')]));_0x46b361[_0x8f6e('0x36')]=_0x46b361[_0x8f6e('0x36')][_0x8f6e('0x38')]?_0x46b361[_0x8f6e('0x36')]:_0x1e1c94[_0x8f6e('0x31')];if(!_0x46646[_0x8f6e('0x33')]['hasOwnProperty'](_0x8f6e('0x39'))){_0x46b361[_0x8f6e('0x1e')]=qs[_0x8f6e('0x1e')](_0x46646[_0x8f6e('0x33')][_0x8f6e('0x1e')]);_0x46b361['offset']=qs[_0x8f6e('0x1d')](_0x46646[_0x8f6e('0x33')][_0x8f6e('0x1d')]);}_0x46b361[_0x8f6e('0x3a')]=qs[_0x8f6e('0x3b')](_0x46646[_0x8f6e('0x33')][_0x8f6e('0x3b')]);_0x46b361['where']=qs[_0x8f6e('0x34')](_[_0x8f6e('0x3c')](_0x46646[_0x8f6e('0x33')],_0x1e1c94[_0x8f6e('0x34')]),_0x2be217);if(_0x46646['query'][_0x8f6e('0x3d')]){_0x46b361[_0x8f6e('0x3e')]=_[_0x8f6e('0x3f')](_0x46b361['where'],{'$or':_[_0x8f6e('0x2c')](_0x2be217,function(_0x37e7a6){if(_0x37e7a6[_0x8f6e('0x2f')]!==_0x8f6e('0x40')){var _0x5c224c={};_0x5c224c[_0x37e7a6[_0x8f6e('0x2a')]]={'$like':'%'+_0x46646[_0x8f6e('0x33')]['filter']+'%'};return _0x5c224c;}})});}_0x46b361=_[_0x8f6e('0x3f')]({},_0x46b361,_0x46646[_0x8f6e('0x41')]);var _0x3a29f2={'where':_0x46b361[_0x8f6e('0x3e')]};return db[_0x8f6e('0x2d')][_0x8f6e('0x1c')](_0x3a29f2)[_0x8f6e('0x23')](function(_0x30321d){_0x1e083b['count']=_0x30321d;if(_0x46646[_0x8f6e('0x33')][_0x8f6e('0x42')]){_0x46b361[_0x8f6e('0x43')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x8f6e('0x44')](_0x46b361);})['then'](function(_0x2008ac){_0x1e083b[_0x8f6e('0x45')]=_0x2008ac;return _0x1e083b;})[_0x8f6e('0x23')](respondWithFilteredResult(_0x3053d5,_0x46b361))['catch'](handleError(_0x3053d5,null));};exports['show']=function(_0x235b38,_0x548b59){var _0x418cdf={'raw':!![],'where':{'id':_0x235b38[_0x8f6e('0x46')]['id']}},_0x1a1969={};_0x1a1969[_0x8f6e('0x31')]=_[_0x8f6e('0x32')](db['AnalyticExtractedReport'][_0x8f6e('0x2e')]);_0x1a1969[_0x8f6e('0x33')]=_[_0x8f6e('0x32')](_0x235b38[_0x8f6e('0x33')]);_0x1a1969['filters']=_[_0x8f6e('0x35')](_0x1a1969[_0x8f6e('0x31')],_0x1a1969['query']);_0x418cdf[_0x8f6e('0x36')]=_['intersection'](_0x1a1969['model'],qs['fields'](_0x235b38[_0x8f6e('0x33')][_0x8f6e('0x37')]));_0x418cdf[_0x8f6e('0x36')]=_0x418cdf[_0x8f6e('0x36')]['length']?_0x418cdf[_0x8f6e('0x36')]:_0x1a1969['model'];if(_0x235b38[_0x8f6e('0x33')][_0x8f6e('0x42')]){_0x418cdf[_0x8f6e('0x43')]=[{'all':!![]}];}_0x418cdf=_[_0x8f6e('0x3f')]({},_0x418cdf,_0x235b38['options']);return db[_0x8f6e('0x2d')][_0x8f6e('0x47')](_0x418cdf)[_0x8f6e('0x23')](handleEntityNotFound(_0x548b59,null))[_0x8f6e('0x23')](respondWithResult(_0x548b59,null))['catch'](handleError(_0x548b59,null));};exports[_0x8f6e('0x48')]=function(_0x4154b5,_0x195ab1){return db[_0x8f6e('0x2d')][_0x8f6e('0x48')](_0x4154b5[_0x8f6e('0x49')],{})[_0x8f6e('0x23')](function(_0x40fe85){var _0x4952a1=_0x4154b5[_0x8f6e('0x4a')][_0x8f6e('0x24')]({'plain':!![]});if(!_0x4952a1)throw new Error(_0x8f6e('0x4b'));if(_0x4952a1[_0x8f6e('0x4c')]===_0x8f6e('0x4a')){var _0x35511d=_0x40fe85[_0x8f6e('0x24')]({'plain':!![]});var _0x4e4a8d=_0x8f6e('0x25');return db[_0x8f6e('0x4d')][_0x8f6e('0x47')]({'where':{'name':_0x4e4a8d,'userProfileId':_0x4952a1[_0x8f6e('0x4e')]},'raw':!![]})[_0x8f6e('0x23')](function(_0x323c99){if(_0x323c99&&_0x323c99[_0x8f6e('0x4f')]===0x0){return db[_0x8f6e('0x26')]['create']({'name':_0x35511d[_0x8f6e('0x2a')],'resourceId':_0x35511d['id'],'type':_0x323c99[_0x8f6e('0x2a')],'sectionId':_0x323c99['id']},{})[_0x8f6e('0x23')](function(){return _0x40fe85;});}else{return _0x40fe85;}})[_0x8f6e('0x50')](function(_0x2b672d){logger[_0x8f6e('0x28')](_0x8f6e('0x51'),_0x2b672d);throw _0x2b672d;});}return _0x40fe85;})['then'](respondWithResult(_0x195ab1,0xc9))[_0x8f6e('0x50')](handleError(_0x195ab1,null));};exports['update']=function(_0x5ebbed,_0x491afc){if(_0x5ebbed[_0x8f6e('0x49')]['id']){delete _0x5ebbed['body']['id'];}return db[_0x8f6e('0x2d')][_0x8f6e('0x47')]({'where':{'id':_0x5ebbed[_0x8f6e('0x46')]['id']}})['then'](handleEntityNotFound(_0x491afc,null))[_0x8f6e('0x23')](saveUpdates(_0x5ebbed[_0x8f6e('0x49')],null))[_0x8f6e('0x23')](respondWithResult(_0x491afc,null))[_0x8f6e('0x50')](handleError(_0x491afc,null));};exports[_0x8f6e('0x27')]=function(_0x18dbec,_0x3cf6e9){return db[_0x8f6e('0x2d')]['find']({'where':{'id':_0x18dbec[_0x8f6e('0x46')]['id']}})[_0x8f6e('0x23')](handleEntityNotFound(_0x3cf6e9,null))['then'](removeEntity(_0x3cf6e9,null))[_0x8f6e('0x50')](handleError(_0x3cf6e9,null));};exports[_0x8f6e('0x52')]=function(_0x329c25,_0x177419,_0x20bbab){return db[_0x8f6e('0x2d')][_0x8f6e('0x47')]({'where':{'id':_0x329c25[_0x8f6e('0x46')]['id']},'attributes':['name',_0x8f6e('0x53'),_0x8f6e('0x54'),_0x8f6e('0x55')],'raw':!![]})[_0x8f6e('0x23')](handleEntityNotFound(_0x177419,null))['then'](function(_0x4490dc){if(_0x4490dc){if(!fs['existsSync'](path[_0x8f6e('0x56')](config[_0x8f6e('0x57')],_0x8f6e('0x58'),_0x4490dc[_0x8f6e('0x54')]))){throw new db[(_0x8f6e('0x59'))][(_0x8f6e('0x5a'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x329c25[_0x8f6e('0x33')]['exists']){return _0x177419['sendStatus'](0xc8);}return _0x177419[_0x8f6e('0x52')](path[_0x8f6e('0x56')](config['root'],_0x8f6e('0x58'),_0x4490dc[_0x8f6e('0x54')]),util[_0x8f6e('0x5b')]('%s.%s',_0x4490dc['basename']||_0x4490dc[_0x8f6e('0x2a')],_0x4490dc[_0x8f6e('0x55')][_0x8f6e('0x5c')]()));}})[_0x8f6e('0x50')](handleError(_0x177419,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 4324a6a..83a8cfd 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 _0x209c=['../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define','lodash','util'];(function(_0x34232c,_0x18e61d){var _0x4d4f4e=function(_0x1aeb3d){while(--_0x1aeb3d){_0x34232c['push'](_0x34232c['shift']());}};_0x4d4f4e(++_0x18e61d);}(_0x209c,0x103));var _0xc209=function(_0x55646e,_0x20ecf7){_0x55646e=_0x55646e-0x0;var _0x285811=_0x209c[_0x55646e];return _0x285811;};'use strict';var _=require(_0xc209('0x0'));var util=require(_0xc209('0x1'));var logger=require(_0xc209('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc209('0x3'));var rp=require(_0xc209('0x4'));var fs=require('fs');var path=require(_0xc209('0x5'));var rimraf=require('rimraf');var config=require(_0xc209('0x6'));var attributes=require('./analyticExtractedReport.attributes');module[_0xc209('0x7')]=function(_0x46d20e,_0x402ddf){return _0x46d20e[_0xc209('0x8')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ef0=['../../config/logger','api','bluebird','request-promise','rimraf','./analyticExtractedReport.attributes','exports','analytics_extracted_reports','lodash','util'];(function(_0x4b6556,_0x2f3d5f){var _0xedee65=function(_0x1a6a6e){while(--_0x1a6a6e){_0x4b6556['push'](_0x4b6556['shift']());}};_0xedee65(++_0x2f3d5f);}(_0x1ef0,0x1de));var _0x01ef=function(_0x16b944,_0x546984){_0x16b944=_0x16b944-0x0;var _0x5b594d=_0x1ef0[_0x16b944];return _0x5b594d;};'use strict';var _=require(_0x01ef('0x0'));var util=require(_0x01ef('0x1'));var logger=require(_0x01ef('0x2'))(_0x01ef('0x3'));var moment=require('moment');var BPromise=require(_0x01ef('0x4'));var rp=require(_0x01ef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x01ef('0x6'));var config=require('../../config/environment');var attributes=require(_0x01ef('0x7'));module[_0x01ef('0x8')]=function(_0xd3fc36,_0x538aeb){return _0xd3fc36['define']('AnalyticExtractedReport',attributes,{'tableName':_0x01ef('0x9'),'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 152873a..4b8ecb2 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 _0xdaf6=['request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x46399b,_0x2c9591){var _0x58aebe=function(_0x2f1349){while(--_0x2f1349){_0x46399b['push'](_0x46399b['shift']());}};_0x58aebe(++_0x2c9591);}(_0xdaf6,0x1da));var _0x6daf=function(_0x1c83c2,_0x495560){_0x1c83c2=_0x1c83c2-0x0;var _0x3223d0=_0xdaf6[_0x1c83c2];return _0x3223d0;};'use strict';var _=require(_0x6daf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6daf('0x1'));var rs=require(_0x6daf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6daf('0x3'))['db'];var utils=require(_0x6daf('0x4'));var logger=require('../../config/logger')(_0x6daf('0x5'));var config=require(_0x6daf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6daf('0x7')][_0x6daf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e4cbb,_0x2c79b0,_0x3deba8){return new BPromise(function(_0x1f8c79,_0xe9f7c2){return client[_0x6daf('0x9')](_0x1e4cbb,_0x3deba8)[_0x6daf('0xa')](function(_0x4de8df){logger['info'](_0x6daf('0xb'),_0x2c79b0,_0x6daf('0xc'));logger[_0x6daf('0xd')](_0x6daf('0xe'),_0x2c79b0,_0x6daf('0xc'),JSON['stringify'](_0x4de8df));if(_0x4de8df[_0x6daf('0xf')]){if(_0x4de8df[_0x6daf('0xf')][_0x6daf('0x10')]===0x1f4){logger['error'](_0x6daf('0xb'),_0x2c79b0,_0x4de8df[_0x6daf('0xf')][_0x6daf('0x11')]);return _0xe9f7c2(_0x4de8df['error']['message']);}logger[_0x6daf('0xf')](_0x6daf('0xb'),_0x2c79b0,_0x4de8df[_0x6daf('0xf')]['message']);return _0x1f8c79(_0x4de8df[_0x6daf('0xf')][_0x6daf('0x11')]);}else{logger[_0x6daf('0x12')](_0x6daf('0xb'),_0x2c79b0,_0x6daf('0xc'));_0x1f8c79(_0x4de8df[_0x6daf('0x13')]['message']);}})[_0x6daf('0x14')](function(_0x49385c){logger[_0x6daf('0xf')](_0x6daf('0xb'),_0x2c79b0,_0x49385c);_0xe9f7c2(_0x49385c);});});} \ No newline at end of file +var _0x2556=['AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x3f140e,_0x54a9a3){var _0x216dad=function(_0x549a03){while(--_0x549a03){_0x3f140e['push'](_0x3f140e['shift']());}};_0x216dad(++_0x54a9a3);}(_0x2556,0x1ed));var _0x6255=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x2556[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x6255('0x0'));var util=require('util');var moment=require(_0x6255('0x1'));var BPromise=require(_0x6255('0x2'));var rs=require(_0x6255('0x3'));var fs=require('fs');var Redis=require(_0x6255('0x4'));var db=require(_0x6255('0x5'))['db'];var utils=require(_0x6255('0x6'));var logger=require(_0x6255('0x7'))(_0x6255('0x8'));var config=require(_0x6255('0x9'));var jayson=require(_0x6255('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c8485,_0x42c2d7,_0x318795){return new BPromise(function(_0x3b6296,_0x3d5c8d){return client[_0x6255('0xb')](_0x5c8485,_0x318795)[_0x6255('0xc')](function(_0x45f1a4){logger['info'](_0x6255('0xd'),_0x42c2d7,_0x6255('0xe'));logger['debug'](_0x6255('0xf'),_0x42c2d7,_0x6255('0xe'),JSON[_0x6255('0x10')](_0x45f1a4));if(_0x45f1a4['error']){if(_0x45f1a4[_0x6255('0x11')][_0x6255('0x12')]===0x1f4){logger[_0x6255('0x11')](_0x6255('0xd'),_0x42c2d7,_0x45f1a4[_0x6255('0x11')]['message']);return _0x3d5c8d(_0x45f1a4['error'][_0x6255('0x13')]);}logger[_0x6255('0x11')](_0x6255('0xd'),_0x42c2d7,_0x45f1a4[_0x6255('0x11')]['message']);return _0x3b6296(_0x45f1a4[_0x6255('0x11')][_0x6255('0x13')]);}else{logger[_0x6255('0x14')](_0x6255('0xd'),_0x42c2d7,_0x6255('0xe'));_0x3b6296(_0x45f1a4['result']['message']);}})[_0x6255('0x15')](function(_0x174c8e){logger[_0x6255('0x11')](_0x6255('0xd'),_0x42c2d7,_0x174c8e);_0x3d5c8d(_0x174c8e);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 4e0594f..ea0b835 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 _0x657b=['download','post','create','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','index','/:id','isAuthenticated','show','/:id/download'];(function(_0x267be9,_0x198757){var _0x431e75=function(_0x46b519){while(--_0x46b519){_0x267be9['push'](_0x267be9['shift']());}};_0x431e75(++_0x198757);}(_0x657b,0x77));var _0xb657=function(_0x1be4c0,_0x2e9b80){_0x1be4c0=_0x1be4c0-0x0;var _0x45c4ca=_0x657b[_0x1be4c0];return _0x45c4ca;};'use strict';var multer=require(_0xb657('0x0'));var util=require(_0xb657('0x1'));var path=require(_0xb657('0x2'));var timeout=require('connect-timeout');var express=require(_0xb657('0x3'));var router=express[_0xb657('0x4')]();var auth=require(_0xb657('0x5'));var interaction=require(_0xb657('0x6'));var config=require('../../config/environment');var controller=require(_0xb657('0x7'));router[_0xb657('0x8')]('/',auth['isAuthenticated'](),controller[_0xb657('0x9')]);router['get'](_0xb657('0xa'),auth[_0xb657('0xb')](),controller[_0xb657('0xc')]);router[_0xb657('0x8')](_0xb657('0xd'),auth[_0xb657('0xb')](),controller[_0xb657('0xe')]);router[_0xb657('0xf')]('/',auth['isAuthenticated'](),controller[_0xb657('0x10')]);router['put'](_0xb657('0xa'),auth[_0xb657('0xb')](),controller['update']);router[_0xb657('0x11')](_0xb657('0xa'),auth[_0xb657('0xb')](),controller['destroy']);module[_0xb657('0x12')]=router; \ No newline at end of file +var _0xcaa3=['./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcaa3,0xcb));var _0x3caa=function(_0x4ac60a,_0x503a99){_0x4ac60a=_0x4ac60a-0x0;var _0x4b22e8=_0xcaa3[_0x4ac60a];return _0x4b22e8;};'use strict';var multer=require(_0x3caa('0x0'));var util=require(_0x3caa('0x1'));var path=require(_0x3caa('0x2'));var timeout=require(_0x3caa('0x3'));var express=require(_0x3caa('0x4'));var router=express[_0x3caa('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3caa('0x6'));var controller=require(_0x3caa('0x7'));router[_0x3caa('0x8')]('/',auth[_0x3caa('0x9')](),controller[_0x3caa('0xa')]);router['get'](_0x3caa('0xb'),auth[_0x3caa('0x9')](),controller[_0x3caa('0xc')]);router['get'](_0x3caa('0xd'),auth[_0x3caa('0x9')](),controller[_0x3caa('0xe')]);router[_0x3caa('0xf')]('/',auth[_0x3caa('0x9')](),controller[_0x3caa('0x10')]);router[_0x3caa('0x11')](_0x3caa('0xb'),auth[_0x3caa('0x9')](),controller[_0x3caa('0x12')]);router[_0x3caa('0x13')](_0x3caa('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x3caa('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index b771a59..c20f5ef 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 _0x326f=['STRING','BOOLEAN','sequelize'];(function(_0x159902,_0x2f808c){var _0x128878=function(_0x5ee91e){while(--_0x5ee91e){_0x159902['push'](_0x159902['shift']());}};_0x128878(++_0x2f808c);}(_0x326f,0xd1));var _0xf326=function(_0x27feba,_0x3474ba){_0x27feba=_0x27feba-0x0;var _0x4b2467=_0x326f[_0x27feba];return _0x4b2467;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xf326('0x1')]},'function':{'type':Sequelize[_0xf326('0x1')]},'format':{'type':Sequelize[_0xf326('0x1')]},'groupBy':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xf326('0x1')]},'custom':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x1261=['exports','TEXT','STRING','BOOLEAN'];(function(_0x56c9d8,_0x7ce617){var _0x41e432=function(_0x54c91d){while(--_0x54c91d){_0x56c9d8['push'](_0x56c9d8['shift']());}};_0x41e432(++_0x7ce617);}(_0x1261,0x144));var _0x1126=function(_0x2be240,_0x1e119d){_0x2be240=_0x2be240-0x0;var _0x123543=_0x1261[_0x2be240];return _0x123543;};'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 256cefb..04d3884 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 _0x6491=['send','index','map','AnalyticFieldReport','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','options','count','includeAll','rows','catch','show','keys','length','find','create','body','bulkCreate','bulkDestroy','ids','addFields','findOne','params','CustomReportId','findAll','fast-json-patch','request-promise','moment','bluebird','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/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','set','save','update','then','destroy','end','sendStatus','error','stack','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6491,0x73));var _0x1649=function(_0x32a0f4,_0x1f97c3){_0x32a0f4=_0x32a0f4-0x0;var _0x85ba50=_0x6491[_0x32a0f4];return _0x85ba50;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1649('0x0'));var rp=require(_0x1649('0x1'));var moment=require(_0x1649('0x2'));var BPromise=require(_0x1649('0x3'));var Mustache=require('mustache');var util=require(_0x1649('0x4'));var path=require(_0x1649('0x5'));var sox=require(_0x1649('0x6'));var csv=require(_0x1649('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1649('0x8'));var crypto=require(_0x1649('0x9'));var jsforce=require(_0x1649('0xa'));var deskjs=require(_0x1649('0xb'));var toCsv=require(_0x1649('0x7'));var querystring=require(_0x1649('0xc'));var Papa=require(_0x1649('0xd'));var Redis=require(_0x1649('0xe'));var authService=require(_0x1649('0xf'));var qs=require(_0x1649('0x10'));var as=require(_0x1649('0x11'));var hardwareService=require(_0x1649('0x12'));var logger=require(_0x1649('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x1649('0x14'));var licenseUtil=require(_0x1649('0x15'));var db=require(_0x1649('0x16'))['db'];function respondWithStatusCode(_0x424222,_0x4df4db){_0x4df4db=_0x4df4db||0xcc;return function(_0x14b9f5){if(_0x14b9f5){return _0x424222['sendStatus'](_0x4df4db);}return _0x424222[_0x1649('0x17')](_0x4df4db)['end']();};}function respondWithResult(_0x44faa3,_0x769279){_0x769279=_0x769279||0xc8;return function(_0x1d3cd1){if(_0x1d3cd1){return _0x44faa3[_0x1649('0x17')](_0x769279)[_0x1649('0x18')](_0x1d3cd1);}};}function respondWithFilteredResult(_0x1c4045,_0x28f6ee){return function(_0x5e52fe){if(_0x5e52fe){var _0x44c62b=_0x5e52fe['count'],_0x207722=_0x28f6ee[_0x1649('0x19')],_0x204f1b=_0x28f6ee['offset']+_0x28f6ee[_0x1649('0x1a')],_0x4d888f;if(_0x204f1b>=_0x44c62b){_0x204f1b=_0x44c62b;_0x4d888f=0xc8;}else{_0x4d888f=0xce;}_0x1c4045[_0x1649('0x17')](_0x4d888f);return _0x1c4045[_0x1649('0x1b')]('Content-Range',_0x207722+'-'+_0x204f1b+'/'+_0x44c62b)[_0x1649('0x18')](_0x5e52fe);}return null;};}function patchUpdates(_0x4c940d){return function(_0x414321){try{jsonpatch['apply'](_0x414321,_0x4c940d,!![]);}catch(_0xbc50f){return BPromise['reject'](_0xbc50f);}return _0x414321[_0x1649('0x1c')]();};}function saveUpdates(_0x5e0e34,_0x1a0fcd){return function(_0x14014c){if(_0x14014c){return _0x14014c[_0x1649('0x1d')](_0x5e0e34)[_0x1649('0x1e')](function(_0x450e29){return _0x450e29;});}return null;};}function removeEntity(_0x2084fc,_0xbdb11c){return function(_0x14b044){if(_0x14b044){return _0x14b044[_0x1649('0x1f')]()[_0x1649('0x1e')](function(){_0x2084fc[_0x1649('0x17')](0xcc)[_0x1649('0x20')]();});}};}function handleEntityNotFound(_0x227202,_0x5747d4){return function(_0x595edc){if(!_0x595edc){_0x227202[_0x1649('0x21')](0x194);}return _0x595edc;};}function handleError(_0x9da2ad,_0x42d09f){_0x42d09f=_0x42d09f||0x1f4;return function(_0x526aa5){logger[_0x1649('0x22')](_0x526aa5[_0x1649('0x23')]);if(_0x526aa5[_0x1649('0x24')]){delete _0x526aa5[_0x1649('0x24')];}_0x9da2ad[_0x1649('0x17')](_0x42d09f)[_0x1649('0x25')](_0x526aa5);};}exports[_0x1649('0x26')]=function(_0x1f45ed,_0x178490){var _0x5b7982={},_0x531234={},_0x181014={'count':0x0,'rows':[]};var _0x1afe47=_[_0x1649('0x27')](db[_0x1649('0x28')][_0x1649('0x29')],function(_0x4c3903){return{'name':_0x4c3903[_0x1649('0x2a')],'type':_0x4c3903['type'][_0x1649('0x2b')]};});_0x531234[_0x1649('0x2c')]=_[_0x1649('0x27')](_0x1afe47,_0x1649('0x24'));_0x531234[_0x1649('0x2d')]=_['keys'](_0x1f45ed[_0x1649('0x2d')]);_0x531234['filters']=_[_0x1649('0x2e')](_0x531234[_0x1649('0x2c')],_0x531234[_0x1649('0x2d')]);_0x5b7982[_0x1649('0x2f')]=_[_0x1649('0x2e')](_0x531234[_0x1649('0x2c')],qs[_0x1649('0x30')](_0x1f45ed[_0x1649('0x2d')][_0x1649('0x30')]));_0x5b7982[_0x1649('0x2f')]=_0x5b7982[_0x1649('0x2f')]['length']?_0x5b7982[_0x1649('0x2f')]:_0x531234[_0x1649('0x2c')];if(!_0x1f45ed[_0x1649('0x2d')]['hasOwnProperty'](_0x1649('0x31'))){_0x5b7982[_0x1649('0x1a')]=qs[_0x1649('0x1a')](_0x1f45ed[_0x1649('0x2d')]['limit']);_0x5b7982['offset']=qs[_0x1649('0x19')](_0x1f45ed[_0x1649('0x2d')]['offset']);}_0x5b7982[_0x1649('0x32')]=qs[_0x1649('0x33')](_0x1f45ed[_0x1649('0x2d')][_0x1649('0x33')]);_0x5b7982['where']=qs['filters'](_[_0x1649('0x34')](_0x1f45ed[_0x1649('0x2d')],_0x531234[_0x1649('0x35')]),_0x1afe47);if(_0x1f45ed[_0x1649('0x2d')]['filter']){_0x5b7982[_0x1649('0x36')]=_[_0x1649('0x37')](_0x5b7982['where'],{'$or':_[_0x1649('0x27')](_0x1afe47,function(_0x1443d6){if(_0x1443d6['type']!==_0x1649('0x38')){var _0xe875da={};_0xe875da[_0x1443d6['name']]={'$like':'%'+_0x1f45ed[_0x1649('0x2d')]['filter']+'%'};return _0xe875da;}})});}_0x5b7982=_['merge']({},_0x5b7982,_0x1f45ed[_0x1649('0x39')]);var _0x1d8bea={'where':_0x5b7982[_0x1649('0x36')]};return db[_0x1649('0x28')][_0x1649('0x3a')](_0x1d8bea)[_0x1649('0x1e')](function(_0x282386){_0x181014[_0x1649('0x3a')]=_0x282386;if(_0x1f45ed['query'][_0x1649('0x3b')]){_0x5b7982['include']=[{'all':!![]}];}return db[_0x1649('0x28')]['findAll'](_0x5b7982);})[_0x1649('0x1e')](function(_0x54ada1){_0x181014[_0x1649('0x3c')]=_0x54ada1;return _0x181014;})['then'](respondWithFilteredResult(_0x178490,_0x5b7982))[_0x1649('0x3d')](handleError(_0x178490,null));};exports[_0x1649('0x3e')]=function(_0x478173,_0x30df47){var _0x3cbb09={'raw':![],'where':{'id':_0x478173['params']['id']}},_0x3fa81f={};_0x3fa81f['model']=_[_0x1649('0x3f')](db[_0x1649('0x28')][_0x1649('0x29')]);_0x3fa81f['query']=_[_0x1649('0x3f')](_0x478173[_0x1649('0x2d')]);_0x3fa81f[_0x1649('0x35')]=_[_0x1649('0x2e')](_0x3fa81f[_0x1649('0x2c')],_0x3fa81f[_0x1649('0x2d')]);_0x3cbb09[_0x1649('0x2f')]=_[_0x1649('0x2e')](_0x3fa81f['model'],qs[_0x1649('0x30')](_0x478173[_0x1649('0x2d')]['fields']));_0x3cbb09[_0x1649('0x2f')]=_0x3cbb09[_0x1649('0x2f')][_0x1649('0x40')]?_0x3cbb09[_0x1649('0x2f')]:_0x3fa81f[_0x1649('0x2c')];if(_0x478173[_0x1649('0x2d')][_0x1649('0x3b')]){_0x3cbb09['include']=[{'all':!![]}];}_0x3cbb09=_['merge']({},_0x3cbb09,_0x478173[_0x1649('0x39')]);return db[_0x1649('0x28')][_0x1649('0x41')](_0x3cbb09)[_0x1649('0x1e')](handleEntityNotFound(_0x30df47,null))[_0x1649('0x1e')](respondWithResult(_0x30df47,null))[_0x1649('0x3d')](handleError(_0x30df47,null));};exports[_0x1649('0x42')]=function(_0x283f2b,_0x341ef7){return db[_0x1649('0x28')][_0x1649('0x42')](_0x283f2b[_0x1649('0x43')],{})[_0x1649('0x1e')](respondWithResult(_0x341ef7,0xc9))['catch'](handleError(_0x341ef7,null));};exports['bulkCreate']=function(_0x29b852,_0x5856b1){return db['AnalyticFieldReport'][_0x1649('0x44')](_0x29b852[_0x1649('0x43')],{'raw':![],'individualHooks':!![]})[_0x1649('0x1e')](respondWithResult(_0x5856b1,0xc9))['catch'](handleError(_0x5856b1,null));};exports['update']=function(_0xcaa69f,_0x52e187){if(_0xcaa69f[_0x1649('0x43')]['id']){delete _0xcaa69f[_0x1649('0x43')]['id'];}return db['AnalyticFieldReport'][_0x1649('0x41')]({'where':{'id':_0xcaa69f['params']['id']}})[_0x1649('0x1e')](handleEntityNotFound(_0x52e187,null))[_0x1649('0x1e')](saveUpdates(_0xcaa69f['body'],null))[_0x1649('0x1e')](respondWithResult(_0x52e187,null))[_0x1649('0x3d')](handleError(_0x52e187,null));};exports[_0x1649('0x1f')]=function(_0x493974,_0x45392e){return db[_0x1649('0x28')][_0x1649('0x41')]({'where':{'id':_0x493974['params']['id']}})[_0x1649('0x1e')](handleEntityNotFound(_0x45392e,null))[_0x1649('0x1e')](removeEntity(_0x45392e,null))[_0x1649('0x3d')](handleError(_0x45392e,null));};exports[_0x1649('0x45')]=function(_0xb717b3,_0x144c41){return db[_0x1649('0x28')][_0x1649('0x1f')]({'where':{'id':_0xb717b3[_0x1649('0x2d')][_0x1649('0x46')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x144c41,0xcc))[_0x1649('0x3d')](handleError(_0x144c41,null));};exports[_0x1649('0x47')]=function(_0xe9b0ca,_0x459297,_0x3645b2){return db['AnalyticCustomReport'][_0x1649('0x48')]({'where':{'id':_0xe9b0ca[_0x1649('0x49')]['id']}})['then'](handleEntityNotFound(_0x459297,null))[_0x1649('0x1e')](function(_0x18bfae){if(_0x18bfae){return db['sequelize']['transaction'](function(_0x4575e9){return db['AnalyticFieldReport'][_0x1649('0x1f')]({'where':{'CustomReportId':_0xe9b0ca['params']['id']},'transaction':_0x4575e9})[_0x1649('0x1e')](function(_0xcac0b3){var _0x10f26d=_[_0x1649('0x27')](_0xe9b0ca[_0x1649('0x43')],function(_0x1f0f8f){delete _0x1f0f8f['id'];_0x1f0f8f[_0x1649('0x4a')]=_0xe9b0ca['params']['id'];return _0x1f0f8f;});return db[_0x1649('0x28')][_0x1649('0x44')](_0x10f26d,{'transaction':_0x4575e9});});})['then'](function(){return db[_0x1649('0x28')][_0x1649('0x4b')]({'where':{'CustomReportId':_0xe9b0ca[_0x1649('0x49')]['id']}});});}})['then'](respondWithResult(_0x459297,null))['catch'](handleError(_0x459297,null));}; \ No newline at end of file +var _0x20f8=['squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','reject','update','destroy','then','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','AnalyticFieldReport','includeAll','include','findAll','rows','catch','params','find','create','body','bulkCreate','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0x20f8,0x17f));var _0x820f=function(_0x2ff287,_0x104113){_0x2ff287=_0x2ff287-0x0;var _0xebae31=_0x20f8[_0x2ff287];return _0xebae31;};'use strict';var pdf=require(_0x820f('0x0'));var emlformat=require(_0x820f('0x1'));var rimraf=require(_0x820f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x820f('0x3'));var rp=require(_0x820f('0x4'));var moment=require('moment');var BPromise=require(_0x820f('0x5'));var Mustache=require(_0x820f('0x6'));var util=require(_0x820f('0x7'));var path=require(_0x820f('0x8'));var sox=require('sox');var csv=require(_0x820f('0x9'));var ejs=require(_0x820f('0xa'));var fs=require('fs');var _=require(_0x820f('0xb'));var squel=require(_0x820f('0xc'));var crypto=require('crypto');var jsforce=require(_0x820f('0xd'));var deskjs=require(_0x820f('0xe'));var toCsv=require(_0x820f('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x820f('0xf'));var authService=require(_0x820f('0x10'));var qs=require(_0x820f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x820f('0x12'));var logger=require(_0x820f('0x13'))(_0x820f('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x820f('0x15'));var db=require(_0x820f('0x16'))['db'];function respondWithStatusCode(_0x14b8d2,_0x411a84){_0x411a84=_0x411a84||0xcc;return function(_0x511761){if(_0x511761){return _0x14b8d2[_0x820f('0x17')](_0x411a84);}return _0x14b8d2[_0x820f('0x18')](_0x411a84)['end']();};}function respondWithResult(_0x299f85,_0x380377){_0x380377=_0x380377||0xc8;return function(_0x3dbe5a){if(_0x3dbe5a){return _0x299f85['status'](_0x380377)[_0x820f('0x19')](_0x3dbe5a);}};}function respondWithFilteredResult(_0x58e33a,_0x1e42a6){return function(_0x13401e){if(_0x13401e){var _0x49eda3=_0x13401e[_0x820f('0x1a')],_0x28ef28=_0x1e42a6['offset'],_0x2031a6=_0x1e42a6[_0x820f('0x1b')]+_0x1e42a6[_0x820f('0x1c')],_0x11d0f5;if(_0x2031a6>=_0x49eda3){_0x2031a6=_0x49eda3;_0x11d0f5=0xc8;}else{_0x11d0f5=0xce;}_0x58e33a[_0x820f('0x18')](_0x11d0f5);return _0x58e33a[_0x820f('0x1d')]('Content-Range',_0x28ef28+'-'+_0x2031a6+'/'+_0x49eda3)[_0x820f('0x19')](_0x13401e);}return null;};}function patchUpdates(_0x345e09){return function(_0xf08824){try{jsonpatch['apply'](_0xf08824,_0x345e09,!![]);}catch(_0x446a33){return BPromise[_0x820f('0x1e')](_0x446a33);}return _0xf08824['save']();};}function saveUpdates(_0xf1c50,_0x301225){return function(_0x474ecb){if(_0x474ecb){return _0x474ecb[_0x820f('0x1f')](_0xf1c50)['then'](function(_0x8a1087){return _0x8a1087;});}return null;};}function removeEntity(_0x2b80e2,_0x91389){return function(_0xe4c308){if(_0xe4c308){return _0xe4c308[_0x820f('0x20')]()[_0x820f('0x21')](function(){_0x2b80e2[_0x820f('0x18')](0xcc)[_0x820f('0x22')]();});}};}function handleEntityNotFound(_0x492335,_0x23a6da){return function(_0x53feac){if(!_0x53feac){_0x492335[_0x820f('0x17')](0x194);}return _0x53feac;};}function handleError(_0x2f66d7,_0x4439bc){_0x4439bc=_0x4439bc||0x1f4;return function(_0x3cef13){logger['error'](_0x3cef13[_0x820f('0x23')]);if(_0x3cef13[_0x820f('0x24')]){delete _0x3cef13[_0x820f('0x24')];}_0x2f66d7['status'](_0x4439bc)[_0x820f('0x25')](_0x3cef13);};}exports[_0x820f('0x26')]=function(_0x20cbab,_0x219b34){var _0x237e73={},_0x25e264={},_0xf777fc={'count':0x0,'rows':[]};var _0x58ff68=_[_0x820f('0x27')](db['AnalyticFieldReport'][_0x820f('0x28')],function(_0x13f589){return{'name':_0x13f589[_0x820f('0x29')],'type':_0x13f589[_0x820f('0x2a')][_0x820f('0x2b')]};});_0x25e264[_0x820f('0x2c')]=_[_0x820f('0x27')](_0x58ff68,_0x820f('0x24'));_0x25e264[_0x820f('0x2d')]=_[_0x820f('0x2e')](_0x20cbab[_0x820f('0x2d')]);_0x25e264[_0x820f('0x2f')]=_[_0x820f('0x30')](_0x25e264[_0x820f('0x2c')],_0x25e264[_0x820f('0x2d')]);_0x237e73[_0x820f('0x31')]=_[_0x820f('0x30')](_0x25e264[_0x820f('0x2c')],qs[_0x820f('0x32')](_0x20cbab[_0x820f('0x2d')]['fields']));_0x237e73[_0x820f('0x31')]=_0x237e73[_0x820f('0x31')][_0x820f('0x33')]?_0x237e73[_0x820f('0x31')]:_0x25e264[_0x820f('0x2c')];if(!_0x20cbab[_0x820f('0x2d')][_0x820f('0x34')]('nolimit')){_0x237e73[_0x820f('0x1c')]=qs[_0x820f('0x1c')](_0x20cbab[_0x820f('0x2d')]['limit']);_0x237e73[_0x820f('0x1b')]=qs[_0x820f('0x1b')](_0x20cbab['query']['offset']);}_0x237e73[_0x820f('0x35')]=qs[_0x820f('0x36')](_0x20cbab[_0x820f('0x2d')][_0x820f('0x36')]);_0x237e73['where']=qs['filters'](_[_0x820f('0x37')](_0x20cbab[_0x820f('0x2d')],_0x25e264[_0x820f('0x2f')]),_0x58ff68);if(_0x20cbab[_0x820f('0x2d')][_0x820f('0x38')]){_0x237e73['where']=_[_0x820f('0x39')](_0x237e73[_0x820f('0x3a')],{'$or':_[_0x820f('0x27')](_0x58ff68,function(_0x5ae182){if(_0x5ae182[_0x820f('0x2a')]!==_0x820f('0x3b')){var _0x294d81={};_0x294d81[_0x5ae182[_0x820f('0x24')]]={'$like':'%'+_0x20cbab['query'][_0x820f('0x38')]+'%'};return _0x294d81;}})});}_0x237e73=_[_0x820f('0x39')]({},_0x237e73,_0x20cbab[_0x820f('0x3c')]);var _0x11e28c={'where':_0x237e73['where']};return db[_0x820f('0x3d')][_0x820f('0x1a')](_0x11e28c)['then'](function(_0x4fceff){_0xf777fc[_0x820f('0x1a')]=_0x4fceff;if(_0x20cbab[_0x820f('0x2d')][_0x820f('0x3e')]){_0x237e73[_0x820f('0x3f')]=[{'all':!![]}];}return db[_0x820f('0x3d')][_0x820f('0x40')](_0x237e73);})[_0x820f('0x21')](function(_0x2ce3ca){_0xf777fc[_0x820f('0x41')]=_0x2ce3ca;return _0xf777fc;})[_0x820f('0x21')](respondWithFilteredResult(_0x219b34,_0x237e73))[_0x820f('0x42')](handleError(_0x219b34,null));};exports['show']=function(_0x369c27,_0x1a1e9e){var _0x30dfad={'raw':![],'where':{'id':_0x369c27[_0x820f('0x43')]['id']}},_0x35a1a1={};_0x35a1a1[_0x820f('0x2c')]=_[_0x820f('0x2e')](db[_0x820f('0x3d')][_0x820f('0x28')]);_0x35a1a1[_0x820f('0x2d')]=_[_0x820f('0x2e')](_0x369c27[_0x820f('0x2d')]);_0x35a1a1[_0x820f('0x2f')]=_[_0x820f('0x30')](_0x35a1a1[_0x820f('0x2c')],_0x35a1a1[_0x820f('0x2d')]);_0x30dfad['attributes']=_[_0x820f('0x30')](_0x35a1a1['model'],qs[_0x820f('0x32')](_0x369c27[_0x820f('0x2d')]['fields']));_0x30dfad['attributes']=_0x30dfad[_0x820f('0x31')][_0x820f('0x33')]?_0x30dfad[_0x820f('0x31')]:_0x35a1a1['model'];if(_0x369c27[_0x820f('0x2d')][_0x820f('0x3e')]){_0x30dfad['include']=[{'all':!![]}];}_0x30dfad=_[_0x820f('0x39')]({},_0x30dfad,_0x369c27[_0x820f('0x3c')]);return db[_0x820f('0x3d')][_0x820f('0x44')](_0x30dfad)[_0x820f('0x21')](handleEntityNotFound(_0x1a1e9e,null))['then'](respondWithResult(_0x1a1e9e,null))['catch'](handleError(_0x1a1e9e,null));};exports[_0x820f('0x45')]=function(_0x5365ce,_0x1fe333){return db[_0x820f('0x3d')][_0x820f('0x45')](_0x5365ce[_0x820f('0x46')],{})[_0x820f('0x21')](respondWithResult(_0x1fe333,0xc9))[_0x820f('0x42')](handleError(_0x1fe333,null));};exports[_0x820f('0x47')]=function(_0x5e3c1e,_0x357bc6){return db[_0x820f('0x3d')][_0x820f('0x47')](_0x5e3c1e['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x357bc6,0xc9))[_0x820f('0x42')](handleError(_0x357bc6,null));};exports[_0x820f('0x1f')]=function(_0x271c11,_0x2162e8){if(_0x271c11[_0x820f('0x46')]['id']){delete _0x271c11[_0x820f('0x46')]['id'];}return db[_0x820f('0x3d')]['find']({'where':{'id':_0x271c11['params']['id']}})[_0x820f('0x21')](handleEntityNotFound(_0x2162e8,null))[_0x820f('0x21')](saveUpdates(_0x271c11[_0x820f('0x46')],null))[_0x820f('0x21')](respondWithResult(_0x2162e8,null))[_0x820f('0x42')](handleError(_0x2162e8,null));};exports[_0x820f('0x20')]=function(_0x4039f6,_0x57c8b1){return db['AnalyticFieldReport'][_0x820f('0x44')]({'where':{'id':_0x4039f6[_0x820f('0x43')]['id']}})['then'](handleEntityNotFound(_0x57c8b1,null))[_0x820f('0x21')](removeEntity(_0x57c8b1,null))[_0x820f('0x42')](handleError(_0x57c8b1,null));};exports[_0x820f('0x48')]=function(_0x363f3f,_0x534cc9){return db[_0x820f('0x3d')][_0x820f('0x20')]({'where':{'id':_0x363f3f[_0x820f('0x2d')]['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x534cc9,0xcc))['catch'](handleError(_0x534cc9,null));};exports[_0x820f('0x49')]=function(_0x3f855b,_0x2dcc91,_0x2e12e0){return db[_0x820f('0x4a')][_0x820f('0x4b')]({'where':{'id':_0x3f855b['params']['id']}})[_0x820f('0x21')](handleEntityNotFound(_0x2dcc91,null))[_0x820f('0x21')](function(_0x108a08){if(_0x108a08){return db[_0x820f('0x4c')][_0x820f('0x4d')](function(_0x2cd4c4){return db['AnalyticFieldReport'][_0x820f('0x20')]({'where':{'CustomReportId':_0x3f855b[_0x820f('0x43')]['id']},'transaction':_0x2cd4c4})['then'](function(_0x29959c){var _0x3c5733=_[_0x820f('0x27')](_0x3f855b[_0x820f('0x46')],function(_0x54a022){delete _0x54a022['id'];_0x54a022[_0x820f('0x4e')]=_0x3f855b[_0x820f('0x43')]['id'];return _0x54a022;});return db['AnalyticFieldReport'][_0x820f('0x47')](_0x3c5733,{'transaction':_0x2cd4c4});});})[_0x820f('0x21')](function(){return db[_0x820f('0x3d')]['findAll']({'where':{'CustomReportId':_0x3f855b[_0x820f('0x43')]['id']}});});}})[_0x820f('0x21')](respondWithResult(_0x2dcc91,null))['catch'](handleError(_0x2dcc91,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 06a49fa..3ee57f9 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 _0xbbbb=['analytics_report_fields','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x5e9de6,_0x29f316){var _0x53462d=function(_0x42d8d2){while(--_0x42d8d2){_0x5e9de6['push'](_0x5e9de6['shift']());}};_0x53462d(++_0x29f316);}(_0xbbbb,0x1e1));var _0xbbbb=function(_0x1c1c96,_0x509bde){_0x1c1c96=_0x1c1c96-0x0;var _0x47a5db=_0xbbbb[_0x1c1c96];return _0x47a5db;};'use strict';var _=require(_0xbbbb('0x0'));var util=require(_0xbbbb('0x1'));var logger=require('../../config/logger')(_0xbbbb('0x2'));var moment=require(_0xbbbb('0x3'));var BPromise=require(_0xbbbb('0x4'));var rp=require(_0xbbbb('0x5'));var fs=require('fs');var path=require(_0xbbbb('0x6'));var rimraf=require(_0xbbbb('0x7'));var config=require(_0xbbbb('0x8'));var attributes=require('./analyticFieldReport.attributes');module[_0xbbbb('0x9')]=function(_0x364c58,_0x2df4de){return _0x364c58[_0xbbbb('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0xbbbb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d0e=['api','moment','bluebird','request-promise','path','rimraf','./analyticFieldReport.attributes','exports','lodash','util','../../config/logger'];(function(_0x324b3c,_0x26aa90){var _0xf69c8c=function(_0xc1a2c9){while(--_0xc1a2c9){_0x324b3c['push'](_0x324b3c['shift']());}};_0xf69c8c(++_0x26aa90);}(_0x1d0e,0x1cb));var _0xe1d0=function(_0x2360ca,_0x228d00){_0x2360ca=_0x2360ca-0x0;var _0x2b209a=_0x1d0e[_0x2360ca];return _0x2b209a;};'use strict';var _=require(_0xe1d0('0x0'));var util=require(_0xe1d0('0x1'));var logger=require(_0xe1d0('0x2'))(_0xe1d0('0x3'));var moment=require(_0xe1d0('0x4'));var BPromise=require(_0xe1d0('0x5'));var rp=require(_0xe1d0('0x6'));var fs=require('fs');var path=require(_0xe1d0('0x7'));var rimraf=require(_0xe1d0('0x8'));var config=require('../../config/environment');var attributes=require(_0xe1d0('0x9'));module[_0xe1d0('0xa')]=function(_0x5414f4,_0x521897){return _0x5414f4['define']('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 662725a..602bb1e 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 _0x0e7a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird'];(function(_0xebc87,_0x1b6f8c){var _0x22f029=function(_0x2f6f4c){while(--_0x2f6f4c){_0xebc87['push'](_0xebc87['shift']());}};_0x22f029(++_0x1b6f8c);}(_0x0e7a,0xd9));var _0xa0e7=function(_0x28fe48,_0xfb3584){_0x28fe48=_0x28fe48-0x0;var _0x16e31a=_0x0e7a[_0x28fe48];return _0x16e31a;};'use strict';var _=require(_0xa0e7('0x0'));var util=require(_0xa0e7('0x1'));var moment=require('moment');var BPromise=require(_0xa0e7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa0e7('0x3'));var db=require(_0xa0e7('0x4'))['db'];var utils=require(_0xa0e7('0x5'));var logger=require(_0xa0e7('0x6'))(_0xa0e7('0x7'));var config=require('../../config/environment');var jayson=require(_0xa0e7('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x306e48,_0x39e8e9,_0x427779){return new BPromise(function(_0xdadfb2,_0x3abde9){return client['request'](_0x306e48,_0x427779)[_0xa0e7('0x9')](function(_0x3acd16){logger[_0xa0e7('0xa')](_0xa0e7('0xb'),_0x39e8e9,_0xa0e7('0xc'));logger[_0xa0e7('0xd')](_0xa0e7('0xe'),_0x39e8e9,_0xa0e7('0xc'),JSON['stringify'](_0x3acd16));if(_0x3acd16[_0xa0e7('0xf')]){if(_0x3acd16[_0xa0e7('0xf')][_0xa0e7('0x10')]===0x1f4){logger[_0xa0e7('0xf')](_0xa0e7('0xb'),_0x39e8e9,_0x3acd16['error']['message']);return _0x3abde9(_0x3acd16[_0xa0e7('0xf')][_0xa0e7('0x11')]);}logger[_0xa0e7('0xf')](_0xa0e7('0xb'),_0x39e8e9,_0x3acd16[_0xa0e7('0xf')][_0xa0e7('0x11')]);return _0xdadfb2(_0x3acd16[_0xa0e7('0xf')][_0xa0e7('0x11')]);}else{logger[_0xa0e7('0xa')](_0xa0e7('0xb'),_0x39e8e9,_0xa0e7('0xc'));_0xdadfb2(_0x3acd16[_0xa0e7('0x12')]['message']);}})[_0xa0e7('0x13')](function(_0x1fa6d2){logger[_0xa0e7('0xf')](_0xa0e7('0xb'),_0x39e8e9,_0x1fa6d2);_0x3abde9(_0x1fa6d2);});});} \ No newline at end of file +var _0x2ec1=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4dd483,_0x515c1c){var _0xe522d5=function(_0x5e97d2){while(--_0x5e97d2){_0x4dd483['push'](_0x4dd483['shift']());}};_0xe522d5(++_0x515c1c);}(_0x2ec1,0x85));var _0x12ec=function(_0x246426,_0x505c21){_0x246426=_0x246426-0x0;var _0x320fcf=_0x2ec1[_0x246426];return _0x320fcf;};'use strict';var _=require(_0x12ec('0x0'));var util=require(_0x12ec('0x1'));var moment=require(_0x12ec('0x2'));var BPromise=require(_0x12ec('0x3'));var rs=require(_0x12ec('0x4'));var fs=require('fs');var Redis=require(_0x12ec('0x5'));var db=require(_0x12ec('0x6'))['db'];var utils=require(_0x12ec('0x7'));var logger=require(_0x12ec('0x8'))('rpc');var config=require(_0x12ec('0x9'));var jayson=require(_0x12ec('0xa'));var client=jayson[_0x12ec('0xb')][_0x12ec('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b3bd4,_0x418b82,_0x49068c){return new BPromise(function(_0x47039a,_0x29ecc9){return client[_0x12ec('0xd')](_0x4b3bd4,_0x49068c)[_0x12ec('0xe')](function(_0x4453ec){logger[_0x12ec('0xf')](_0x12ec('0x10'),_0x418b82,_0x12ec('0x11'));logger[_0x12ec('0x12')](_0x12ec('0x13'),_0x418b82,_0x12ec('0x11'),JSON[_0x12ec('0x14')](_0x4453ec));if(_0x4453ec['error']){if(_0x4453ec[_0x12ec('0x15')][_0x12ec('0x16')]===0x1f4){logger[_0x12ec('0x15')](_0x12ec('0x10'),_0x418b82,_0x4453ec[_0x12ec('0x15')]['message']);return _0x29ecc9(_0x4453ec['error'][_0x12ec('0x17')]);}logger[_0x12ec('0x15')](_0x12ec('0x10'),_0x418b82,_0x4453ec['error']['message']);return _0x47039a(_0x4453ec[_0x12ec('0x15')][_0x12ec('0x17')]);}else{logger[_0x12ec('0xf')](_0x12ec('0x10'),_0x418b82,_0x12ec('0x11'));_0x47039a(_0x4453ec[_0x12ec('0x18')]['message']);}})[_0x12ec('0x19')](function(_0x2952c3){logger[_0x12ec('0x15')](_0x12ec('0x10'),_0x418b82,_0x2952c3);_0x29ecc9(_0x2952c3);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 13a7f5d..bc12056 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 _0x9957=['../../config/environment','get','isAuthenticated','index','/:id','post','/create_many','bulkCreate','/:id/create_many','put','update','delete','/destroy_many','bulkDestroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./analyticFieldReport.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0xc')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0xc')](_0x7995('0xd'),auth[_0x7995('0x9')](),controller[_0x7995('0xe')]);router[_0x7995('0xc')](_0x7995('0xf'),auth[_0x7995('0x9')](),controller['addFields']);router[_0x7995('0x10')](_0x7995('0xb'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0x13'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x12')](_0x7995('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=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(_0x472ee7,_0x302242){var _0x6aa3f3=function(_0x43beda){while(--_0x43beda){_0x472ee7['push'](_0x472ee7['shift']());}};_0x6aa3f3(++_0x302242);}(_0x5fc3,0xa8));var _0x35fc=function(_0x246115,_0x398123){_0x246115=_0x246115-0x0;var _0x385878=_0x5fc3[_0x246115];return _0x385878;};'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 8f75917..bde1f3a 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 _0x05e3=['STRING','TEXT','sequelize','exports'];(function(_0x1a0fc7,_0x27606b){var _0xc57388=function(_0x3f4f97){while(--_0x3f4f97){_0x1a0fc7['push'](_0x1a0fc7['shift']());}};_0xc57388(++_0x27606b);}(_0x05e3,0x86));var _0x305e=function(_0x1e48d4,_0x4a8aa5){_0x1e48d4=_0x1e48d4-0x0;var _0x52cfbc=_0x05e3[_0x1e48d4];return _0x52cfbc;};'use strict';var Sequelize=require(_0x305e('0x0'));module[_0x305e('0x1')]={'name':{'type':Sequelize[_0x305e('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x305e('0x3')]},'description':{'type':Sequelize[_0x305e('0x2')]}}; \ No newline at end of file +var _0x4273=['TEXT','sequelize','exports','STRING'];(function(_0x40894e,_0x3fc95a){var _0x119c25=function(_0x4c9ca5){while(--_0x4c9ca5){_0x40894e['push'](_0x40894e['shift']());}};_0x119c25(++_0x3fc95a);}(_0x4273,0xc5));var _0x3427=function(_0xfcc0c0,_0x33727e){_0xfcc0c0=_0xfcc0c0-0x0;var _0x1f7221=_0x4273[_0xfcc0c0];return _0x1f7221;};'use strict';var Sequelize=require(_0x3427('0x0'));module[_0x3427('0x1')]={'name':{'type':Sequelize[_0x3427('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x3427('0x2')]},'metric':{'type':Sequelize[_0x3427('0x3')]},'description':{'type':Sequelize[_0x3427('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index db2afee..d169d69 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 _0xd110=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','get','Metrics','UserProfileResource','destroy','then','error','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','intersection','attributes','query','hasOwnProperty','order','sort','where','filters','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','squel','jsforce','desk.js'];(function(_0x2659fd,_0x1b6f77){var _0x19950e=function(_0xede35b){while(--_0xede35b){_0x2659fd['push'](_0x2659fd['shift']());}};_0x19950e(++_0x1b6f77);}(_0xd110,0x13a));var _0x0d11=function(_0x51d61e,_0x22709f){_0x51d61e=_0x51d61e-0x0;var _0x35bbbc=_0xd110[_0x51d61e];return _0x35bbbc;};'use strict';var pdf=require(_0x0d11('0x0'));var emlformat=require(_0x0d11('0x1'));var rimraf=require(_0x0d11('0x2'));var zipdir=require(_0x0d11('0x3'));var jsonpatch=require(_0x0d11('0x4'));var rp=require('request-promise');var moment=require(_0x0d11('0x5'));var BPromise=require(_0x0d11('0x6'));var Mustache=require(_0x0d11('0x7'));var util=require('util');var path=require(_0x0d11('0x8'));var sox=require(_0x0d11('0x9'));var csv=require('to-csv');var ejs=require(_0x0d11('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0d11('0xb'));var crypto=require('crypto');var jsforce=require(_0x0d11('0xc'));var deskjs=require(_0x0d11('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0d11('0xe'));var Papa=require(_0x0d11('0xf'));var Redis=require(_0x0d11('0x10'));var authService=require(_0x0d11('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0d11('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d11('0x13'))(_0x0d11('0x14'));var utils=require(_0x0d11('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0d11('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13af56,_0x5add0e){_0x5add0e=_0x5add0e||0xcc;return function(_0x488c2b){if(_0x488c2b){return _0x13af56[_0x0d11('0x17')](_0x5add0e);}return _0x13af56[_0x0d11('0x18')](_0x5add0e)[_0x0d11('0x19')]();};}function respondWithResult(_0x57f346,_0x3b0c06){_0x3b0c06=_0x3b0c06||0xc8;return function(_0x2bb7f4){if(_0x2bb7f4){return _0x57f346[_0x0d11('0x18')](_0x3b0c06)[_0x0d11('0x1a')](_0x2bb7f4);}};}function respondWithFilteredResult(_0x1ee8fd,_0x143b9a){return function(_0x153f54){if(_0x153f54){var _0xc4fcde=_0x153f54[_0x0d11('0x1b')],_0x21ea14=_0x143b9a[_0x0d11('0x1c')],_0x3c04f4=_0x143b9a['offset']+_0x143b9a[_0x0d11('0x1d')],_0x11321a;if(_0x3c04f4>=_0xc4fcde){_0x3c04f4=_0xc4fcde;_0x11321a=0xc8;}else{_0x11321a=0xce;}_0x1ee8fd[_0x0d11('0x18')](_0x11321a);return _0x1ee8fd[_0x0d11('0x1e')](_0x0d11('0x1f'),_0x21ea14+'-'+_0x3c04f4+'/'+_0xc4fcde)[_0x0d11('0x1a')](_0x153f54);}return null;};}function patchUpdates(_0x4810ec){return function(_0x518cb7){try{jsonpatch['apply'](_0x518cb7,_0x4810ec,!![]);}catch(_0xa1778a){return BPromise[_0x0d11('0x20')](_0xa1778a);}return _0x518cb7[_0x0d11('0x21')]();};}function saveUpdates(_0x3d46f7,_0x27a22b){return function(_0x26c2d3){if(_0x26c2d3){return _0x26c2d3[_0x0d11('0x22')](_0x3d46f7)['then'](function(_0x451eb0){return _0x451eb0;});}return null;};}function removeEntity(_0x24b35b,_0x5782a4){return function(_0x20d37c){if(_0x20d37c){return _0x20d37c['destroy']()['then'](function(){var _0x4e32bd=_0x20d37c[_0x0d11('0x23')]({'plain':!![]});var _0xbdba40=_0x0d11('0x24');return db[_0x0d11('0x25')][_0x0d11('0x26')]({'where':{'type':_0xbdba40,'resourceId':_0x4e32bd['id']}})['then'](function(){return _0x20d37c;});})[_0x0d11('0x27')](function(){_0x24b35b[_0x0d11('0x18')](0xcc)[_0x0d11('0x19')]();});}};}function handleEntityNotFound(_0x145e24,_0x111246){return function(_0x14f8af){if(!_0x14f8af){_0x145e24['sendStatus'](0x194);}return _0x14f8af;};}function handleError(_0x2f983a,_0x5977eb){_0x5977eb=_0x5977eb||0x1f4;return function(_0x794eb0){logger[_0x0d11('0x28')](_0x794eb0[_0x0d11('0x29')]);if(_0x794eb0['name']){delete _0x794eb0[_0x0d11('0x2a')];}_0x2f983a['status'](_0x5977eb)[_0x0d11('0x2b')](_0x794eb0);};}exports[_0x0d11('0x2c')]=function(_0x38cf74,_0xddf64f){var _0x1b4cf1={},_0x361ab4={},_0x35d6d5={'count':0x0,'rows':[]};var _0x303563=_[_0x0d11('0x2d')](db[_0x0d11('0x2e')]['rawAttributes'],function(_0x4f130d){return{'name':_0x4f130d[_0x0d11('0x2f')],'type':_0x4f130d[_0x0d11('0x30')][_0x0d11('0x31')]};});_0x361ab4[_0x0d11('0x32')]=_['map'](_0x303563,'name');_0x361ab4['query']=_['keys'](_0x38cf74['query']);_0x361ab4['filters']=_[_0x0d11('0x33')](_0x361ab4[_0x0d11('0x32')],_0x361ab4['query']);_0x1b4cf1[_0x0d11('0x34')]=_[_0x0d11('0x33')](_0x361ab4[_0x0d11('0x32')],qs['fields'](_0x38cf74[_0x0d11('0x35')]['fields']));_0x1b4cf1[_0x0d11('0x34')]=_0x1b4cf1['attributes']['length']?_0x1b4cf1[_0x0d11('0x34')]:_0x361ab4[_0x0d11('0x32')];if(!_0x38cf74[_0x0d11('0x35')][_0x0d11('0x36')]('nolimit')){_0x1b4cf1[_0x0d11('0x1d')]=qs[_0x0d11('0x1d')](_0x38cf74[_0x0d11('0x35')][_0x0d11('0x1d')]);_0x1b4cf1[_0x0d11('0x1c')]=qs['offset'](_0x38cf74['query'][_0x0d11('0x1c')]);}_0x1b4cf1[_0x0d11('0x37')]=qs[_0x0d11('0x38')](_0x38cf74['query']['sort']);_0x1b4cf1[_0x0d11('0x39')]=qs['filters'](_['pick'](_0x38cf74[_0x0d11('0x35')],_0x361ab4[_0x0d11('0x3a')]),_0x303563);if(_0x38cf74[_0x0d11('0x35')]['filter']){_0x1b4cf1[_0x0d11('0x39')]=_['merge'](_0x1b4cf1[_0x0d11('0x39')],{'$or':_[_0x0d11('0x2d')](_0x303563,function(_0x13d7ab){if(_0x13d7ab[_0x0d11('0x30')]!==_0x0d11('0x3b')){var _0x3262a3={};_0x3262a3[_0x13d7ab['name']]={'$like':'%'+_0x38cf74['query'][_0x0d11('0x3c')]+'%'};return _0x3262a3;}})});}_0x1b4cf1=_[_0x0d11('0x3d')]({},_0x1b4cf1,_0x38cf74[_0x0d11('0x3e')]);var _0x27f641={'where':_0x1b4cf1[_0x0d11('0x39')]};return db['AnalyticMetric'][_0x0d11('0x1b')](_0x27f641)[_0x0d11('0x27')](function(_0x5f2187){_0x35d6d5['count']=_0x5f2187;if(_0x38cf74[_0x0d11('0x35')][_0x0d11('0x3f')]){_0x1b4cf1[_0x0d11('0x40')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x1b4cf1);})[_0x0d11('0x27')](function(_0xc75cae){_0x35d6d5[_0x0d11('0x41')]=_0xc75cae;return _0x35d6d5;})[_0x0d11('0x27')](respondWithFilteredResult(_0xddf64f,_0x1b4cf1))[_0x0d11('0x42')](handleError(_0xddf64f,null));};exports[_0x0d11('0x43')]=function(_0x3bbb60,_0x46eae8){var _0x52a38c={'raw':!![],'where':{'id':_0x3bbb60[_0x0d11('0x44')]['id']}},_0x541aff={};_0x541aff['model']=_[_0x0d11('0x45')](db['AnalyticMetric'][_0x0d11('0x46')]);_0x541aff[_0x0d11('0x35')]=_['keys'](_0x3bbb60[_0x0d11('0x35')]);_0x541aff['filters']=_['intersection'](_0x541aff[_0x0d11('0x32')],_0x541aff[_0x0d11('0x35')]);_0x52a38c[_0x0d11('0x34')]=_[_0x0d11('0x33')](_0x541aff['model'],qs['fields'](_0x3bbb60[_0x0d11('0x35')]['fields']));_0x52a38c[_0x0d11('0x34')]=_0x52a38c['attributes'][_0x0d11('0x47')]?_0x52a38c[_0x0d11('0x34')]:_0x541aff['model'];if(_0x3bbb60[_0x0d11('0x35')]['includeAll']){_0x52a38c[_0x0d11('0x40')]=[{'all':!![]}];}_0x52a38c=_['merge']({},_0x52a38c,_0x3bbb60[_0x0d11('0x3e')]);return db[_0x0d11('0x2e')][_0x0d11('0x48')](_0x52a38c)[_0x0d11('0x27')](handleEntityNotFound(_0x46eae8,null))['then'](respondWithResult(_0x46eae8,null))[_0x0d11('0x42')](handleError(_0x46eae8,null));};exports[_0x0d11('0x49')]=function(_0x228db6,_0x8a09a4){return db[_0x0d11('0x2e')][_0x0d11('0x49')](_0x228db6[_0x0d11('0x4a')],{})['then'](function(_0x5d9d2a){var _0x3f6b9b=_0x228db6[_0x0d11('0x4b')][_0x0d11('0x23')]({'plain':!![]});if(!_0x3f6b9b)throw new Error(_0x0d11('0x4c'));if(_0x3f6b9b[_0x0d11('0x4d')]==='user'){var _0x14be2a=_0x5d9d2a[_0x0d11('0x23')]({'plain':!![]});var _0x2d5f08='Metrics';return db[_0x0d11('0x4e')][_0x0d11('0x48')]({'where':{'name':_0x2d5f08,'userProfileId':_0x3f6b9b[_0x0d11('0x4f')]},'raw':!![]})['then'](function(_0x5c8559){if(_0x5c8559&&_0x5c8559[_0x0d11('0x50')]===0x0){return db[_0x0d11('0x25')][_0x0d11('0x49')]({'name':_0x14be2a['name'],'resourceId':_0x14be2a['id'],'type':_0x5c8559[_0x0d11('0x2a')],'sectionId':_0x5c8559['id']},{})[_0x0d11('0x27')](function(){return _0x5d9d2a;});}else{return _0x5d9d2a;}})['catch'](function(_0xae65a8){logger[_0x0d11('0x28')](_0x0d11('0x51'),_0xae65a8);throw _0xae65a8;});}return _0x5d9d2a;})[_0x0d11('0x27')](respondWithResult(_0x8a09a4,0xc9))[_0x0d11('0x42')](handleError(_0x8a09a4,null));};exports[_0x0d11('0x22')]=function(_0x39978a,_0x4c92f9){if(_0x39978a[_0x0d11('0x4a')]['id']){delete _0x39978a[_0x0d11('0x4a')]['id'];}return db[_0x0d11('0x2e')][_0x0d11('0x48')]({'where':{'id':_0x39978a['params']['id']}})[_0x0d11('0x27')](handleEntityNotFound(_0x4c92f9,null))[_0x0d11('0x27')](saveUpdates(_0x39978a['body'],null))[_0x0d11('0x27')](respondWithResult(_0x4c92f9,null))[_0x0d11('0x42')](handleError(_0x4c92f9,null));};exports[_0x0d11('0x26')]=function(_0x13a493,_0x17d964){return db[_0x0d11('0x2e')][_0x0d11('0x48')]({'where':{'id':_0x13a493['params']['id']}})[_0x0d11('0x27')](handleEntityNotFound(_0x17d964,null))[_0x0d11('0x27')](removeEntity(_0x17d964,null))['catch'](handleError(_0x17d964,null));}; \ No newline at end of file +var _0x75eb=['end','count','offset','limit','status','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','util','lodash','crypto','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x1cfb37,_0x19d0d6){var _0x1f9a1f=function(_0xafc910){while(--_0xafc910){_0x1cfb37['push'](_0x1cfb37['shift']());}};_0x1f9a1f(++_0x19d0d6);}(_0x75eb,0xd5));var _0xb75e=function(_0x41d44e,_0x5f2c1c){_0x41d44e=_0x41d44e-0x0;var _0x6b3ad5=_0x75eb[_0x41d44e];return _0x6b3ad5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb75e('0x0'));var rimraf=require(_0xb75e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb75e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb75e('0x3'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb75e('0x4'));var squel=require('squel');var crypto=require(_0xb75e('0x5'));var jsforce=require('jsforce');var deskjs=require(_0xb75e('0x6'));var toCsv=require(_0xb75e('0x7'));var querystring=require(_0xb75e('0x8'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb75e('0x9'));var hardwareService=require(_0xb75e('0xa'));var logger=require(_0xb75e('0xb'))(_0xb75e('0xc'));var utils=require(_0xb75e('0xd'));var config=require(_0xb75e('0xe'));var licenseUtil=require(_0xb75e('0xf'));var db=require(_0xb75e('0x10'))['db'];function respondWithStatusCode(_0x25e766,_0xf14b73){_0xf14b73=_0xf14b73||0xcc;return function(_0x4a279c){if(_0x4a279c){return _0x25e766[_0xb75e('0x11')](_0xf14b73);}return _0x25e766['status'](_0xf14b73)[_0xb75e('0x12')]();};}function respondWithResult(_0x31a36a,_0x58d271){_0x58d271=_0x58d271||0xc8;return function(_0x68c472){if(_0x68c472){return _0x31a36a['status'](_0x58d271)['json'](_0x68c472);}};}function respondWithFilteredResult(_0x584bcd,_0x5c5659){return function(_0x11e291){if(_0x11e291){var _0x2decb7=_0x11e291[_0xb75e('0x13')],_0x47c668=_0x5c5659['offset'],_0x1d4003=_0x5c5659[_0xb75e('0x14')]+_0x5c5659[_0xb75e('0x15')],_0x5b51b8;if(_0x1d4003>=_0x2decb7){_0x1d4003=_0x2decb7;_0x5b51b8=0xc8;}else{_0x5b51b8=0xce;}_0x584bcd[_0xb75e('0x16')](_0x5b51b8);return _0x584bcd[_0xb75e('0x17')](_0xb75e('0x18'),_0x47c668+'-'+_0x1d4003+'/'+_0x2decb7)[_0xb75e('0x19')](_0x11e291);}return null;};}function patchUpdates(_0x135eac){return function(_0x1428d2){try{jsonpatch[_0xb75e('0x1a')](_0x1428d2,_0x135eac,!![]);}catch(_0x245cdc){return BPromise[_0xb75e('0x1b')](_0x245cdc);}return _0x1428d2[_0xb75e('0x1c')]();};}function saveUpdates(_0x2afe62,_0x3bafe1){return function(_0x5ee1f8){if(_0x5ee1f8){return _0x5ee1f8[_0xb75e('0x1d')](_0x2afe62)[_0xb75e('0x1e')](function(_0x12aa99){return _0x12aa99;});}return null;};}function removeEntity(_0x246e2d,_0x3d4470){return function(_0x32cc40){if(_0x32cc40){return _0x32cc40[_0xb75e('0x1f')]()[_0xb75e('0x1e')](function(){var _0xca05c2=_0x32cc40[_0xb75e('0x20')]({'plain':!![]});var _0x59a367=_0xb75e('0x21');return db[_0xb75e('0x22')][_0xb75e('0x1f')]({'where':{'type':_0x59a367,'resourceId':_0xca05c2['id']}})[_0xb75e('0x1e')](function(){return _0x32cc40;});})['then'](function(){_0x246e2d[_0xb75e('0x16')](0xcc)[_0xb75e('0x12')]();});}};}function handleEntityNotFound(_0x2314ce,_0x356290){return function(_0x43e64c){if(!_0x43e64c){_0x2314ce[_0xb75e('0x11')](0x194);}return _0x43e64c;};}function handleError(_0x3895ff,_0x3446c2){_0x3446c2=_0x3446c2||0x1f4;return function(_0x21947a){logger['error'](_0x21947a[_0xb75e('0x23')]);if(_0x21947a[_0xb75e('0x24')]){delete _0x21947a[_0xb75e('0x24')];}_0x3895ff['status'](_0x3446c2)[_0xb75e('0x25')](_0x21947a);};}exports[_0xb75e('0x26')]=function(_0x34dc04,_0x9fb9dc){var _0x4eea00={},_0x496c88={},_0x2cc6f8={'count':0x0,'rows':[]};var _0x20e8c1=_[_0xb75e('0x27')](db[_0xb75e('0x28')][_0xb75e('0x29')],function(_0x49a474){return{'name':_0x49a474[_0xb75e('0x2a')],'type':_0x49a474[_0xb75e('0x2b')][_0xb75e('0x2c')]};});_0x496c88[_0xb75e('0x2d')]=_[_0xb75e('0x27')](_0x20e8c1,_0xb75e('0x24'));_0x496c88[_0xb75e('0x2e')]=_[_0xb75e('0x2f')](_0x34dc04[_0xb75e('0x2e')]);_0x496c88[_0xb75e('0x30')]=_[_0xb75e('0x31')](_0x496c88[_0xb75e('0x2d')],_0x496c88['query']);_0x4eea00[_0xb75e('0x32')]=_[_0xb75e('0x31')](_0x496c88[_0xb75e('0x2d')],qs[_0xb75e('0x33')](_0x34dc04[_0xb75e('0x2e')]['fields']));_0x4eea00['attributes']=_0x4eea00[_0xb75e('0x32')][_0xb75e('0x34')]?_0x4eea00[_0xb75e('0x32')]:_0x496c88[_0xb75e('0x2d')];if(!_0x34dc04[_0xb75e('0x2e')]['hasOwnProperty'](_0xb75e('0x35'))){_0x4eea00[_0xb75e('0x15')]=qs[_0xb75e('0x15')](_0x34dc04[_0xb75e('0x2e')][_0xb75e('0x15')]);_0x4eea00[_0xb75e('0x14')]=qs[_0xb75e('0x14')](_0x34dc04[_0xb75e('0x2e')][_0xb75e('0x14')]);}_0x4eea00[_0xb75e('0x36')]=qs['sort'](_0x34dc04[_0xb75e('0x2e')][_0xb75e('0x37')]);_0x4eea00['where']=qs[_0xb75e('0x30')](_[_0xb75e('0x38')](_0x34dc04[_0xb75e('0x2e')],_0x496c88['filters']),_0x20e8c1);if(_0x34dc04[_0xb75e('0x2e')][_0xb75e('0x39')]){_0x4eea00[_0xb75e('0x3a')]=_['merge'](_0x4eea00[_0xb75e('0x3a')],{'$or':_[_0xb75e('0x27')](_0x20e8c1,function(_0x1f42cf){if(_0x1f42cf[_0xb75e('0x2b')]!=='VIRTUAL'){var _0x48e44a={};_0x48e44a[_0x1f42cf[_0xb75e('0x24')]]={'$like':'%'+_0x34dc04[_0xb75e('0x2e')][_0xb75e('0x39')]+'%'};return _0x48e44a;}})});}_0x4eea00=_[_0xb75e('0x3b')]({},_0x4eea00,_0x34dc04[_0xb75e('0x3c')]);var _0x2d2c35={'where':_0x4eea00[_0xb75e('0x3a')]};return db['AnalyticMetric']['count'](_0x2d2c35)[_0xb75e('0x1e')](function(_0x369daf){_0x2cc6f8[_0xb75e('0x13')]=_0x369daf;if(_0x34dc04[_0xb75e('0x2e')][_0xb75e('0x3d')]){_0x4eea00[_0xb75e('0x3e')]=[{'all':!![]}];}return db[_0xb75e('0x28')][_0xb75e('0x3f')](_0x4eea00);})[_0xb75e('0x1e')](function(_0x118007){_0x2cc6f8[_0xb75e('0x40')]=_0x118007;return _0x2cc6f8;})[_0xb75e('0x1e')](respondWithFilteredResult(_0x9fb9dc,_0x4eea00))[_0xb75e('0x41')](handleError(_0x9fb9dc,null));};exports['show']=function(_0x3ea8b4,_0xf2bc08){var _0x59a66f={'raw':!![],'where':{'id':_0x3ea8b4['params']['id']}},_0x5893e5={};_0x5893e5[_0xb75e('0x2d')]=_[_0xb75e('0x2f')](db[_0xb75e('0x28')]['rawAttributes']);_0x5893e5[_0xb75e('0x2e')]=_[_0xb75e('0x2f')](_0x3ea8b4[_0xb75e('0x2e')]);_0x5893e5['filters']=_['intersection'](_0x5893e5[_0xb75e('0x2d')],_0x5893e5[_0xb75e('0x2e')]);_0x59a66f[_0xb75e('0x32')]=_[_0xb75e('0x31')](_0x5893e5['model'],qs[_0xb75e('0x33')](_0x3ea8b4[_0xb75e('0x2e')][_0xb75e('0x33')]));_0x59a66f[_0xb75e('0x32')]=_0x59a66f['attributes'][_0xb75e('0x34')]?_0x59a66f[_0xb75e('0x32')]:_0x5893e5['model'];if(_0x3ea8b4['query'][_0xb75e('0x3d')]){_0x59a66f['include']=[{'all':!![]}];}_0x59a66f=_[_0xb75e('0x3b')]({},_0x59a66f,_0x3ea8b4['options']);return db[_0xb75e('0x28')][_0xb75e('0x42')](_0x59a66f)['then'](handleEntityNotFound(_0xf2bc08,null))[_0xb75e('0x1e')](respondWithResult(_0xf2bc08,null))['catch'](handleError(_0xf2bc08,null));};exports[_0xb75e('0x43')]=function(_0x27aa1b,_0x36a283){return db[_0xb75e('0x28')]['create'](_0x27aa1b[_0xb75e('0x44')],{})[_0xb75e('0x1e')](function(_0x46c7d8){var _0x423e91=_0x27aa1b['user'][_0xb75e('0x20')]({'plain':!![]});if(!_0x423e91)throw new Error(_0xb75e('0x45'));if(_0x423e91['role']===_0xb75e('0x46')){var _0x15a496=_0x46c7d8[_0xb75e('0x20')]({'plain':!![]});var _0x3b02a4='Metrics';return db[_0xb75e('0x47')][_0xb75e('0x42')]({'where':{'name':_0x3b02a4,'userProfileId':_0x423e91[_0xb75e('0x48')]},'raw':!![]})['then'](function(_0x2a1096){if(_0x2a1096&&_0x2a1096[_0xb75e('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0x15a496[_0xb75e('0x24')],'resourceId':_0x15a496['id'],'type':_0x2a1096[_0xb75e('0x24')],'sectionId':_0x2a1096['id']},{})[_0xb75e('0x1e')](function(){return _0x46c7d8;});}else{return _0x46c7d8;}})[_0xb75e('0x41')](function(_0x424d10){logger[_0xb75e('0x4a')](_0xb75e('0x4b'),_0x424d10);throw _0x424d10;});}return _0x46c7d8;})[_0xb75e('0x1e')](respondWithResult(_0x36a283,0xc9))[_0xb75e('0x41')](handleError(_0x36a283,null));};exports[_0xb75e('0x1d')]=function(_0x395f49,_0x4b6c12){if(_0x395f49['body']['id']){delete _0x395f49['body']['id'];}return db[_0xb75e('0x28')][_0xb75e('0x42')]({'where':{'id':_0x395f49[_0xb75e('0x4c')]['id']}})[_0xb75e('0x1e')](handleEntityNotFound(_0x4b6c12,null))[_0xb75e('0x1e')](saveUpdates(_0x395f49[_0xb75e('0x44')],null))[_0xb75e('0x1e')](respondWithResult(_0x4b6c12,null))[_0xb75e('0x41')](handleError(_0x4b6c12,null));};exports[_0xb75e('0x1f')]=function(_0x20194a,_0xbdae73){return db[_0xb75e('0x28')][_0xb75e('0x42')]({'where':{'id':_0x20194a['params']['id']}})['then'](handleEntityNotFound(_0xbdae73,null))[_0xb75e('0x1e')](removeEntity(_0xbdae73,null))[_0xb75e('0x41')](handleError(_0xbdae73,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 93a7285..d6d1292 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 _0x25f7=['moment','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','analytics_metrics','lodash','util','../../config/logger'];(function(_0x41ed37,_0xbcd1d4){var _0x13f7ea=function(_0x270235){while(--_0x270235){_0x41ed37['push'](_0x41ed37['shift']());}};_0x13f7ea(++_0xbcd1d4);}(_0x25f7,0x1a1));var _0x725f=function(_0x57b2c6,_0x3c2c91){_0x57b2c6=_0x57b2c6-0x0;var _0x34aa8f=_0x25f7[_0x57b2c6];return _0x34aa8f;};'use strict';var _=require(_0x725f('0x0'));var util=require(_0x725f('0x1'));var logger=require(_0x725f('0x2'))('api');var moment=require(_0x725f('0x3'));var BPromise=require('bluebird');var rp=require(_0x725f('0x4'));var fs=require('fs');var path=require(_0x725f('0x5'));var rimraf=require(_0x725f('0x6'));var config=require(_0x725f('0x7'));var attributes=require(_0x725f('0x8'));module['exports']=function(_0x75f935,_0x5ba934){return _0x75f935['define']('AnalyticMetric',attributes,{'tableName':_0x725f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50bc=['../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x50bc,0x161));var _0xc50b=function(_0x42a8e4,_0x11b170){_0x42a8e4=_0x42a8e4-0x0;var _0x13e10a=_0x50bc[_0x42a8e4];return _0x13e10a;};'use strict';var _=require(_0xc50b('0x0'));var util=require('util');var logger=require(_0xc50b('0x1'))(_0xc50b('0x2'));var moment=require(_0xc50b('0x3'));var BPromise=require(_0xc50b('0x4'));var rp=require(_0xc50b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc50b('0x6'));var config=require(_0xc50b('0x7'));var attributes=require(_0xc50b('0x8'));module[_0xc50b('0x9')]=function(_0x20e4c4,_0x20f88e){return _0x20e4c4[_0xc50b('0xa')](_0xc50b('0xb'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 13147fc..db72f91 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 _0xf4be=['rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x34dd3c,_0x12616c){var _0x19beab=function(_0x327c96){while(--_0x327c96){_0x34dd3c['push'](_0x34dd3c['shift']());}};_0x19beab(++_0x12616c);}(_0xf4be,0x179));var _0xef4b=function(_0xe2662e,_0x31e008){_0xe2662e=_0xe2662e-0x0;var _0xc1f11f=_0xf4be[_0xe2662e];return _0xc1f11f;};'use strict';var _=require(_0xef4b('0x0'));var util=require(_0xef4b('0x1'));var moment=require('moment');var BPromise=require(_0xef4b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef4b('0x3'));var db=require(_0xef4b('0x4'))['db'];var utils=require(_0xef4b('0x5'));var logger=require(_0xef4b('0x6'))(_0xef4b('0x7'));var config=require(_0xef4b('0x8'));var jayson=require(_0xef4b('0x9'));var client=jayson[_0xef4b('0xa')][_0xef4b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ada21,_0x3a8693,_0x18fdb4){return new BPromise(function(_0x578be5,_0x35b329){return client[_0xef4b('0xc')](_0x2ada21,_0x18fdb4)[_0xef4b('0xd')](function(_0x2ef13b){logger['info'](_0xef4b('0xe'),_0x3a8693,_0xef4b('0xf'));logger[_0xef4b('0x10')](_0xef4b('0x11'),_0x3a8693,'request\x20sent',JSON[_0xef4b('0x12')](_0x2ef13b));if(_0x2ef13b[_0xef4b('0x13')]){if(_0x2ef13b['error'][_0xef4b('0x14')]===0x1f4){logger[_0xef4b('0x13')](_0xef4b('0xe'),_0x3a8693,_0x2ef13b[_0xef4b('0x13')]['message']);return _0x35b329(_0x2ef13b[_0xef4b('0x13')][_0xef4b('0x15')]);}logger[_0xef4b('0x13')](_0xef4b('0xe'),_0x3a8693,_0x2ef13b[_0xef4b('0x13')]['message']);return _0x578be5(_0x2ef13b[_0xef4b('0x13')][_0xef4b('0x15')]);}else{logger[_0xef4b('0x16')](_0xef4b('0xe'),_0x3a8693,'request\x20sent');_0x578be5(_0x2ef13b['result'][_0xef4b('0x15')]);}})[_0xef4b('0x17')](function(_0x43f274){logger[_0xef4b('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x3a8693,_0x43f274);_0x35b329(_0x43f274);});});} \ No newline at end of file +var _0xfd45=['stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x756b0e,_0x52fe0c){var _0x1f9546=function(_0x356492){while(--_0x356492){_0x756b0e['push'](_0x756b0e['shift']());}};_0x1f9546(++_0x52fe0c);}(_0xfd45,0x6f));var _0x5fd4=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xfd45[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x5fd4('0x0'));var util=require('util');var moment=require(_0x5fd4('0x1'));var BPromise=require(_0x5fd4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5fd4('0x3'));var db=require(_0x5fd4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5fd4('0x5'));var config=require(_0x5fd4('0x6'));var jayson=require(_0x5fd4('0x7'));var client=jayson[_0x5fd4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c9953,_0x2ce3f8,_0x2eb4ac){return new BPromise(function(_0x5eb783,_0x4f6708){return client['request'](_0x2c9953,_0x2eb4ac)[_0x5fd4('0x9')](function(_0x5dea48){logger[_0x5fd4('0xa')](_0x5fd4('0xb'),_0x2ce3f8,'request\x20sent');logger[_0x5fd4('0xc')](_0x5fd4('0xd'),_0x2ce3f8,_0x5fd4('0xe'),JSON[_0x5fd4('0xf')](_0x5dea48));if(_0x5dea48[_0x5fd4('0x10')]){if(_0x5dea48['error'][_0x5fd4('0x11')]===0x1f4){logger[_0x5fd4('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x2ce3f8,_0x5dea48[_0x5fd4('0x10')]['message']);return _0x4f6708(_0x5dea48[_0x5fd4('0x10')][_0x5fd4('0x12')]);}logger[_0x5fd4('0x10')](_0x5fd4('0xb'),_0x2ce3f8,_0x5dea48['error']['message']);return _0x5eb783(_0x5dea48[_0x5fd4('0x10')][_0x5fd4('0x12')]);}else{logger['info'](_0x5fd4('0xb'),_0x2ce3f8,'request\x20sent');_0x5eb783(_0x5dea48[_0x5fd4('0x13')]['message']);}})[_0x5fd4('0x14')](function(_0xa81ba9){logger[_0x5fd4('0x10')](_0x5fd4('0xb'),_0x2ce3f8,_0xa81ba9);_0x4f6708(_0xa81ba9);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 4b976cd..b816556 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 _0xf494=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util'];(function(_0x30543a,_0x21bb37){var _0x18bbfa=function(_0x3b7290){while(--_0x3b7290){_0x30543a['push'](_0x30543a['shift']());}};_0x18bbfa(++_0x21bb37);}(_0xf494,0x1c6));var _0x4f49=function(_0x1c0d45,_0x3a9ee9){_0x1c0d45=_0x1c0d45-0x0;var _0x2ab11e=_0xf494[_0x1c0d45];return _0x2ab11e;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var auth=require(_0x4f49('0x5'));var interaction=require(_0x4f49('0x6'));var config=require(_0x4f49('0x7'));var controller=require(_0x4f49('0x8'));router[_0x4f49('0x9')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0xb')]);router[_0x4f49('0x9')](_0x4f49('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4f49('0xd')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0xe')]);router[_0x4f49('0xf')](_0x4f49('0xc'),auth[_0x4f49('0xa')](),controller[_0x4f49('0x10')]);router[_0x4f49('0x11')]('/:id',auth[_0x4f49('0xa')](),controller[_0x4f49('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4137=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show','create','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0xab92b5,_0x184d79){var _0x3a758c=function(_0x3eae35){while(--_0x3eae35){_0xab92b5['push'](_0xab92b5['shift']());}};_0x3a758c(++_0x184d79);}(_0x4137,0xf8));var _0x7413=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4137[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var auth=require(_0x7413('0x6'));var interaction=require(_0x7413('0x7'));var config=require(_0x7413('0x8'));var controller=require(_0x7413('0x9'));router[_0x7413('0xa')]('/',auth[_0x7413('0xb')](),controller['index']);router[_0x7413('0xa')](_0x7413('0xc'),auth[_0x7413('0xb')](),controller[_0x7413('0xd')]);router['post']('/',auth[_0x7413('0xb')](),controller[_0x7413('0xe')]);router['put'](_0x7413('0xc'),auth[_0x7413('0xb')](),controller['update']);router[_0x7413('0xf')](_0x7413('0xc'),auth[_0x7413('0xb')](),controller[_0x7413('0x10')]);module[_0x7413('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 9e64afb..96205cf 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xc908=['exports','TEXT'];(function(_0x40e83f,_0x4f467a){var _0x17207f=function(_0xbeb1f0){while(--_0xbeb1f0){_0x40e83f['push'](_0x40e83f['shift']());}};_0x17207f(++_0x4f467a);}(_0xc908,0x1aa));var _0x8c90=function(_0x102b0c,_0x33dee4){_0x102b0c=_0x102b0c-0x0;var _0x9b15ca=_0xc908[_0x102b0c];return _0x9b15ca;};'use strict';var Sequelize=require('sequelize');module[_0x8c90('0x0')]={'tree':{'type':Sequelize[_0x8c90('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 91feb72..a4a99ac 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 _0x0dac=['reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','merge','where','type','VIRTUAL','filter','options','AnalyticTreeReport','count','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set'];(function(_0x42a3dd,_0x352869){var _0x34c485=function(_0x11deb2){while(--_0x11deb2){_0x42a3dd['push'](_0x42a3dd['shift']());}};_0x34c485(++_0x352869);}(_0x0dac,0x1a3));var _0xc0da=function(_0x889d9,_0x548eba){_0x889d9=_0x889d9-0x0;var _0x46dee2=_0x0dac[_0x889d9];return _0x46dee2;};'use strict';var pdf=require(_0xc0da('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc0da('0x1'));var zipdir=require(_0xc0da('0x2'));var jsonpatch=require(_0xc0da('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc0da('0x4'));var Mustache=require(_0xc0da('0x5'));var util=require(_0xc0da('0x6'));var path=require(_0xc0da('0x7'));var sox=require(_0xc0da('0x8'));var csv=require(_0xc0da('0x9'));var ejs=require(_0xc0da('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc0da('0xb'));var crypto=require(_0xc0da('0xc'));var jsforce=require(_0xc0da('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc0da('0xe'));var Papa=require(_0xc0da('0xf'));var Redis=require(_0xc0da('0x10'));var authService=require(_0xc0da('0x11'));var qs=require(_0xc0da('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc0da('0x13'));var logger=require(_0xc0da('0x14'))(_0xc0da('0x15'));var utils=require(_0xc0da('0x16'));var config=require(_0xc0da('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc0da('0x18'))['db'];function respondWithStatusCode(_0x390869,_0x49cdb2){_0x49cdb2=_0x49cdb2||0xcc;return function(_0x262724){if(_0x262724){return _0x390869[_0xc0da('0x19')](_0x49cdb2);}return _0x390869['status'](_0x49cdb2)['end']();};}function respondWithResult(_0x35d23e,_0x260c97){_0x260c97=_0x260c97||0xc8;return function(_0xdaf4c1){if(_0xdaf4c1){return _0x35d23e[_0xc0da('0x1a')](_0x260c97)[_0xc0da('0x1b')](_0xdaf4c1);}};}function respondWithFilteredResult(_0x5dddfe,_0x58f0c7){return function(_0x26ec0f){if(_0x26ec0f){var _0x3d1b48=_0x26ec0f['count'],_0x30cce4=_0x58f0c7[_0xc0da('0x1c')],_0x1df95b=_0x58f0c7[_0xc0da('0x1c')]+_0x58f0c7[_0xc0da('0x1d')],_0x4691ba;if(_0x1df95b>=_0x3d1b48){_0x1df95b=_0x3d1b48;_0x4691ba=0xc8;}else{_0x4691ba=0xce;}_0x5dddfe[_0xc0da('0x1a')](_0x4691ba);return _0x5dddfe[_0xc0da('0x1e')]('Content-Range',_0x30cce4+'-'+_0x1df95b+'/'+_0x3d1b48)['json'](_0x26ec0f);}return null;};}function patchUpdates(_0x4ff031){return function(_0x7f290d){try{jsonpatch['apply'](_0x7f290d,_0x4ff031,!![]);}catch(_0x31f830){return BPromise[_0xc0da('0x1f')](_0x31f830);}return _0x7f290d[_0xc0da('0x20')]();};}function saveUpdates(_0x2b34fd,_0x5af594){return function(_0x21e008){if(_0x21e008){return _0x21e008[_0xc0da('0x21')](_0x2b34fd)[_0xc0da('0x22')](function(_0x13542f){return _0x13542f;});}return null;};}function removeEntity(_0x53d52d,_0x6aa738){return function(_0x1a0bff){if(_0x1a0bff){return _0x1a0bff['destroy']()[_0xc0da('0x22')](function(){_0x53d52d[_0xc0da('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bba43,_0x62cec5){return function(_0x28bc87){if(!_0x28bc87){_0x2bba43['sendStatus'](0x194);}return _0x28bc87;};}function handleError(_0x33bc8a,_0x2bea57){_0x2bea57=_0x2bea57||0x1f4;return function(_0x371fe6){logger[_0xc0da('0x23')](_0x371fe6[_0xc0da('0x24')]);if(_0x371fe6[_0xc0da('0x25')]){delete _0x371fe6[_0xc0da('0x25')];}_0x33bc8a['status'](_0x2bea57)[_0xc0da('0x26')](_0x371fe6);};}exports[_0xc0da('0x27')]=function(_0x12ba31,_0x538f78){var _0x2773b1={},_0x1126eb={},_0x2cf34b={'count':0x0,'rows':[]};var _0x29b990=_[_0xc0da('0x28')](db['AnalyticTreeReport'][_0xc0da('0x29')],function(_0x58171f){return{'name':_0x58171f[_0xc0da('0x2a')],'type':_0x58171f['type'][_0xc0da('0x2b')]};});_0x1126eb[_0xc0da('0x2c')]=_[_0xc0da('0x28')](_0x29b990,'name');_0x1126eb[_0xc0da('0x2d')]=_[_0xc0da('0x2e')](_0x12ba31[_0xc0da('0x2d')]);_0x1126eb[_0xc0da('0x2f')]=_[_0xc0da('0x30')](_0x1126eb[_0xc0da('0x2c')],_0x1126eb['query']);_0x2773b1['attributes']=_['intersection'](_0x1126eb[_0xc0da('0x2c')],qs[_0xc0da('0x31')](_0x12ba31[_0xc0da('0x2d')]['fields']));_0x2773b1[_0xc0da('0x32')]=_0x2773b1[_0xc0da('0x32')][_0xc0da('0x33')]?_0x2773b1[_0xc0da('0x32')]:_0x1126eb['model'];if(!_0x12ba31[_0xc0da('0x2d')][_0xc0da('0x34')]('nolimit')){_0x2773b1[_0xc0da('0x1d')]=qs[_0xc0da('0x1d')](_0x12ba31[_0xc0da('0x2d')]['limit']);_0x2773b1[_0xc0da('0x1c')]=qs[_0xc0da('0x1c')](_0x12ba31[_0xc0da('0x2d')][_0xc0da('0x1c')]);}_0x2773b1[_0xc0da('0x35')]=qs[_0xc0da('0x36')](_0x12ba31[_0xc0da('0x2d')][_0xc0da('0x36')]);_0x2773b1['where']=qs[_0xc0da('0x2f')](_[_0xc0da('0x37')](_0x12ba31[_0xc0da('0x2d')],_0x1126eb[_0xc0da('0x2f')]),_0x29b990);if(_0x12ba31['query']['filter']){_0x2773b1['where']=_[_0xc0da('0x38')](_0x2773b1[_0xc0da('0x39')],{'$or':_[_0xc0da('0x28')](_0x29b990,function(_0x9d86d3){if(_0x9d86d3[_0xc0da('0x3a')]!==_0xc0da('0x3b')){var _0x4c33b1={};_0x4c33b1[_0x9d86d3[_0xc0da('0x25')]]={'$like':'%'+_0x12ba31['query'][_0xc0da('0x3c')]+'%'};return _0x4c33b1;}})});}_0x2773b1=_['merge']({},_0x2773b1,_0x12ba31[_0xc0da('0x3d')]);var _0x5e02f9={'where':_0x2773b1[_0xc0da('0x39')]};return db[_0xc0da('0x3e')][_0xc0da('0x3f')](_0x5e02f9)[_0xc0da('0x22')](function(_0x1e2f3d){_0x2cf34b['count']=_0x1e2f3d;if(_0x12ba31[_0xc0da('0x2d')]['includeAll']){_0x2773b1[_0xc0da('0x40')]=[{'all':!![]}];}return db[_0xc0da('0x3e')][_0xc0da('0x41')](_0x2773b1);})['then'](function(_0x24698c){_0x2cf34b[_0xc0da('0x42')]=_0x24698c;return _0x2cf34b;})[_0xc0da('0x22')](respondWithFilteredResult(_0x538f78,_0x2773b1))[_0xc0da('0x43')](handleError(_0x538f78,null));};exports[_0xc0da('0x44')]=function(_0x1768e5,_0xa1689){var _0x541e4f={'raw':!![],'where':{'id':_0x1768e5[_0xc0da('0x45')]['id']}},_0x41f486={};_0x41f486['model']=_[_0xc0da('0x2e')](db[_0xc0da('0x3e')][_0xc0da('0x29')]);_0x41f486[_0xc0da('0x2d')]=_['keys'](_0x1768e5['query']);_0x41f486[_0xc0da('0x2f')]=_[_0xc0da('0x30')](_0x41f486[_0xc0da('0x2c')],_0x41f486['query']);_0x541e4f[_0xc0da('0x32')]=_[_0xc0da('0x30')](_0x41f486[_0xc0da('0x2c')],qs[_0xc0da('0x31')](_0x1768e5[_0xc0da('0x2d')]['fields']));_0x541e4f[_0xc0da('0x32')]=_0x541e4f['attributes'][_0xc0da('0x33')]?_0x541e4f[_0xc0da('0x32')]:_0x41f486[_0xc0da('0x2c')];if(_0x1768e5[_0xc0da('0x2d')][_0xc0da('0x46')]){_0x541e4f[_0xc0da('0x40')]=[{'all':!![]}];}_0x541e4f=_[_0xc0da('0x38')]({},_0x541e4f,_0x1768e5[_0xc0da('0x3d')]);return db[_0xc0da('0x3e')][_0xc0da('0x47')](_0x541e4f)[_0xc0da('0x22')](handleEntityNotFound(_0xa1689,null))['then'](respondWithResult(_0xa1689,null))['catch'](handleError(_0xa1689,null));};exports[_0xc0da('0x48')]=function(_0xd7d63b,_0x2dc1d5){return db[_0xc0da('0x3e')][_0xc0da('0x48')](_0xd7d63b['body'],{})[_0xc0da('0x22')](respondWithResult(_0x2dc1d5,0xc9))[_0xc0da('0x43')](handleError(_0x2dc1d5,null));};exports['update']=function(_0x47d034,_0x417996){if(_0x47d034[_0xc0da('0x49')]['id']){delete _0x47d034[_0xc0da('0x49')]['id'];}return db[_0xc0da('0x3e')][_0xc0da('0x47')]({'where':{'id':_0x47d034['params']['id']}})[_0xc0da('0x22')](handleEntityNotFound(_0x417996,null))[_0xc0da('0x22')](saveUpdates(_0x47d034[_0xc0da('0x49')],null))[_0xc0da('0x22')](respondWithResult(_0x417996,null))['catch'](handleError(_0x417996,null));};exports[_0xc0da('0x4a')]=function(_0x20cab0,_0xdb5545){return db[_0xc0da('0x3e')][_0xc0da('0x47')]({'where':{'id':_0x20cab0[_0xc0da('0x45')]['id']}})[_0xc0da('0x22')](handleEntityNotFound(_0xdb5545,null))['then'](removeEntity(_0xdb5545,null))[_0xc0da('0x43')](handleError(_0xdb5545,null));}; \ No newline at end of file +var _0x3faa=['end','json','count','offset','limit','status','set','Content-Range','save','update','then','destroy','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','AnalyticTreeReport','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','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'];(function(_0x5779f1,_0x32ce04){var _0x423ab8=function(_0x5da09b){while(--_0x5da09b){_0x5779f1['push'](_0x5779f1['shift']());}};_0x423ab8(++_0x32ce04);}(_0x3faa,0x1d8));var _0xa3fa=function(_0x2cecae,_0x406ec0){_0x2cecae=_0x2cecae-0x0;var _0x3dfb3d=_0x3faa[_0x2cecae];return _0x3dfb3d;};'use strict';var pdf=require(_0xa3fa('0x0'));var emlformat=require(_0xa3fa('0x1'));var rimraf=require(_0xa3fa('0x2'));var zipdir=require(_0xa3fa('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa3fa('0x4'));var BPromise=require(_0xa3fa('0x5'));var Mustache=require('mustache');var util=require(_0xa3fa('0x6'));var path=require(_0xa3fa('0x7'));var sox=require(_0xa3fa('0x8'));var csv=require(_0xa3fa('0x9'));var ejs=require(_0xa3fa('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa3fa('0xb'));var toCsv=require(_0xa3fa('0x9'));var querystring=require(_0xa3fa('0xc'));var Papa=require(_0xa3fa('0xd'));var Redis=require(_0xa3fa('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa3fa('0xf'));var as=require(_0xa3fa('0x10'));var hardwareService=require(_0xa3fa('0x11'));var logger=require(_0xa3fa('0x12'))(_0xa3fa('0x13'));var utils=require(_0xa3fa('0x14'));var config=require(_0xa3fa('0x15'));var licenseUtil=require(_0xa3fa('0x16'));var db=require(_0xa3fa('0x17'))['db'];function respondWithStatusCode(_0xb10f6f,_0x295f30){_0x295f30=_0x295f30||0xcc;return function(_0x157eca){if(_0x157eca){return _0xb10f6f[_0xa3fa('0x18')](_0x295f30);}return _0xb10f6f['status'](_0x295f30)[_0xa3fa('0x19')]();};}function respondWithResult(_0x40233d,_0x44d20c){_0x44d20c=_0x44d20c||0xc8;return function(_0x4900f0){if(_0x4900f0){return _0x40233d['status'](_0x44d20c)[_0xa3fa('0x1a')](_0x4900f0);}};}function respondWithFilteredResult(_0x281bcf,_0x8d3806){return function(_0xf70c1d){if(_0xf70c1d){var _0x59c4e8=_0xf70c1d[_0xa3fa('0x1b')],_0x33b463=_0x8d3806['offset'],_0x4bb419=_0x8d3806[_0xa3fa('0x1c')]+_0x8d3806[_0xa3fa('0x1d')],_0x2cff4d;if(_0x4bb419>=_0x59c4e8){_0x4bb419=_0x59c4e8;_0x2cff4d=0xc8;}else{_0x2cff4d=0xce;}_0x281bcf[_0xa3fa('0x1e')](_0x2cff4d);return _0x281bcf[_0xa3fa('0x1f')](_0xa3fa('0x20'),_0x33b463+'-'+_0x4bb419+'/'+_0x59c4e8)[_0xa3fa('0x1a')](_0xf70c1d);}return null;};}function patchUpdates(_0x67bbad){return function(_0x505f92){try{jsonpatch['apply'](_0x505f92,_0x67bbad,!![]);}catch(_0x44ea20){return BPromise['reject'](_0x44ea20);}return _0x505f92[_0xa3fa('0x21')]();};}function saveUpdates(_0x1e70d0,_0x87186c){return function(_0x2b94b6){if(_0x2b94b6){return _0x2b94b6[_0xa3fa('0x22')](_0x1e70d0)[_0xa3fa('0x23')](function(_0x3cb62b){return _0x3cb62b;});}return null;};}function removeEntity(_0x383861,_0x1f0807){return function(_0x2c37be){if(_0x2c37be){return _0x2c37be[_0xa3fa('0x24')]()[_0xa3fa('0x23')](function(){_0x383861['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x199ba5,_0x39703b){return function(_0x3d1e0d){if(!_0x3d1e0d){_0x199ba5[_0xa3fa('0x18')](0x194);}return _0x3d1e0d;};}function handleError(_0x1c9732,_0xcf76b2){_0xcf76b2=_0xcf76b2||0x1f4;return function(_0x1cd59a){logger['error'](_0x1cd59a[_0xa3fa('0x25')]);if(_0x1cd59a[_0xa3fa('0x26')]){delete _0x1cd59a[_0xa3fa('0x26')];}_0x1c9732[_0xa3fa('0x1e')](_0xcf76b2)[_0xa3fa('0x27')](_0x1cd59a);};}exports[_0xa3fa('0x28')]=function(_0x5aebc0,_0x54a97d){var _0x98514b={},_0x2be297={},_0x327297={'count':0x0,'rows':[]};var _0x10bc32=_['map'](db['AnalyticTreeReport'][_0xa3fa('0x29')],function(_0x4ebba4){return{'name':_0x4ebba4['fieldName'],'type':_0x4ebba4[_0xa3fa('0x2a')][_0xa3fa('0x2b')]};});_0x2be297[_0xa3fa('0x2c')]=_[_0xa3fa('0x2d')](_0x10bc32,_0xa3fa('0x26'));_0x2be297[_0xa3fa('0x2e')]=_[_0xa3fa('0x2f')](_0x5aebc0[_0xa3fa('0x2e')]);_0x2be297[_0xa3fa('0x30')]=_[_0xa3fa('0x31')](_0x2be297['model'],_0x2be297[_0xa3fa('0x2e')]);_0x98514b['attributes']=_['intersection'](_0x2be297[_0xa3fa('0x2c')],qs[_0xa3fa('0x32')](_0x5aebc0[_0xa3fa('0x2e')][_0xa3fa('0x32')]));_0x98514b[_0xa3fa('0x33')]=_0x98514b[_0xa3fa('0x33')]['length']?_0x98514b[_0xa3fa('0x33')]:_0x2be297[_0xa3fa('0x2c')];if(!_0x5aebc0[_0xa3fa('0x2e')]['hasOwnProperty'](_0xa3fa('0x34'))){_0x98514b[_0xa3fa('0x1d')]=qs[_0xa3fa('0x1d')](_0x5aebc0[_0xa3fa('0x2e')][_0xa3fa('0x1d')]);_0x98514b[_0xa3fa('0x1c')]=qs[_0xa3fa('0x1c')](_0x5aebc0['query'][_0xa3fa('0x1c')]);}_0x98514b[_0xa3fa('0x35')]=qs[_0xa3fa('0x36')](_0x5aebc0[_0xa3fa('0x2e')][_0xa3fa('0x36')]);_0x98514b[_0xa3fa('0x37')]=qs['filters'](_[_0xa3fa('0x38')](_0x5aebc0[_0xa3fa('0x2e')],_0x2be297[_0xa3fa('0x30')]),_0x10bc32);if(_0x5aebc0['query'][_0xa3fa('0x39')]){_0x98514b[_0xa3fa('0x37')]=_[_0xa3fa('0x3a')](_0x98514b[_0xa3fa('0x37')],{'$or':_['map'](_0x10bc32,function(_0x520c64){if(_0x520c64[_0xa3fa('0x2a')]!=='VIRTUAL'){var _0x42a671={};_0x42a671[_0x520c64[_0xa3fa('0x26')]]={'$like':'%'+_0x5aebc0[_0xa3fa('0x2e')][_0xa3fa('0x39')]+'%'};return _0x42a671;}})});}_0x98514b=_[_0xa3fa('0x3a')]({},_0x98514b,_0x5aebc0['options']);var _0x27d80d={'where':_0x98514b[_0xa3fa('0x37')]};return db[_0xa3fa('0x3b')]['count'](_0x27d80d)[_0xa3fa('0x23')](function(_0x19cbfa){_0x327297[_0xa3fa('0x1b')]=_0x19cbfa;if(_0x5aebc0[_0xa3fa('0x2e')][_0xa3fa('0x3c')]){_0x98514b[_0xa3fa('0x3d')]=[{'all':!![]}];}return db[_0xa3fa('0x3b')][_0xa3fa('0x3e')](_0x98514b);})['then'](function(_0x4c5775){_0x327297[_0xa3fa('0x3f')]=_0x4c5775;return _0x327297;})[_0xa3fa('0x23')](respondWithFilteredResult(_0x54a97d,_0x98514b))[_0xa3fa('0x40')](handleError(_0x54a97d,null));};exports['show']=function(_0x3c67f8,_0x244c01){var _0x198624={'raw':!![],'where':{'id':_0x3c67f8[_0xa3fa('0x41')]['id']}},_0xdc9973={};_0xdc9973['model']=_[_0xa3fa('0x2f')](db[_0xa3fa('0x3b')][_0xa3fa('0x29')]);_0xdc9973[_0xa3fa('0x2e')]=_['keys'](_0x3c67f8['query']);_0xdc9973[_0xa3fa('0x30')]=_['intersection'](_0xdc9973[_0xa3fa('0x2c')],_0xdc9973[_0xa3fa('0x2e')]);_0x198624[_0xa3fa('0x33')]=_[_0xa3fa('0x31')](_0xdc9973[_0xa3fa('0x2c')],qs[_0xa3fa('0x32')](_0x3c67f8[_0xa3fa('0x2e')]['fields']));_0x198624['attributes']=_0x198624[_0xa3fa('0x33')][_0xa3fa('0x42')]?_0x198624[_0xa3fa('0x33')]:_0xdc9973['model'];if(_0x3c67f8[_0xa3fa('0x2e')]['includeAll']){_0x198624[_0xa3fa('0x3d')]=[{'all':!![]}];}_0x198624=_[_0xa3fa('0x3a')]({},_0x198624,_0x3c67f8[_0xa3fa('0x43')]);return db['AnalyticTreeReport'][_0xa3fa('0x44')](_0x198624)[_0xa3fa('0x23')](handleEntityNotFound(_0x244c01,null))['then'](respondWithResult(_0x244c01,null))[_0xa3fa('0x40')](handleError(_0x244c01,null));};exports[_0xa3fa('0x45')]=function(_0x18156,_0x34e51e){return db[_0xa3fa('0x3b')][_0xa3fa('0x45')](_0x18156[_0xa3fa('0x46')],{})[_0xa3fa('0x23')](respondWithResult(_0x34e51e,0xc9))[_0xa3fa('0x40')](handleError(_0x34e51e,null));};exports[_0xa3fa('0x22')]=function(_0x14d247,_0x348d6f){if(_0x14d247[_0xa3fa('0x46')]['id']){delete _0x14d247[_0xa3fa('0x46')]['id'];}return db[_0xa3fa('0x3b')][_0xa3fa('0x44')]({'where':{'id':_0x14d247[_0xa3fa('0x41')]['id']}})['then'](handleEntityNotFound(_0x348d6f,null))[_0xa3fa('0x23')](saveUpdates(_0x14d247['body'],null))['then'](respondWithResult(_0x348d6f,null))[_0xa3fa('0x40')](handleError(_0x348d6f,null));};exports[_0xa3fa('0x24')]=function(_0x5180dc,_0x1a7eec){return db[_0xa3fa('0x3b')][_0xa3fa('0x44')]({'where':{'id':_0x5180dc[_0xa3fa('0x41')]['id']}})['then'](handleEntityNotFound(_0x1a7eec,null))[_0xa3fa('0x23')](removeEntity(_0x1a7eec,null))[_0xa3fa('0x40')](handleError(_0x1a7eec,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index c0dd557..6014626 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 _0xf2e3=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','lodash'];(function(_0x480696,_0x28cdac){var _0x4bcd07=function(_0x5cfed8){while(--_0x5cfed8){_0x480696['push'](_0x480696['shift']());}};_0x4bcd07(++_0x28cdac);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf2e3[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var logger=require(_0x3f2e('0x1'))(_0x3f2e('0x2'));var moment=require(_0x3f2e('0x3'));var BPromise=require(_0x3f2e('0x4'));var rp=require(_0x3f2e('0x5'));var fs=require('fs');var path=require(_0x3f2e('0x6'));var rimraf=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var attributes=require(_0x3f2e('0x9'));module['exports']=function(_0x33a3b7,_0xdd6b3e){return _0x33a3b7[_0x3f2e('0xa')](_0x3f2e('0xb'),attributes,{'tableName':_0x3f2e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cff=['lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees'];(function(_0x5346d5,_0x2033bd){var _0x4d11ea=function(_0x7ff691){while(--_0x7ff691){_0x5346d5['push'](_0x5346d5['shift']());}};_0x4d11ea(++_0x2033bd);}(_0x4cff,0x14a));var _0xf4cf=function(_0x1ba320,_0x53d11e){_0x1ba320=_0x1ba320-0x0;var _0x3b97b8=_0x4cff[_0x1ba320];return _0x3b97b8;};'use strict';var _=require(_0xf4cf('0x0'));var util=require(_0xf4cf('0x1'));var logger=require('../../config/logger')(_0xf4cf('0x2'));var moment=require('moment');var BPromise=require(_0xf4cf('0x3'));var rp=require(_0xf4cf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf4cf('0x5'));var config=require(_0xf4cf('0x6'));var attributes=require(_0xf4cf('0x7'));module[_0xf4cf('0x8')]=function(_0x4634f6,_0x33c9d7){return _0x4634f6['define'](_0xf4cf('0x9'),attributes,{'tableName':_0xf4cf('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 6148183..78df1aa 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 _0x1ccd=['request\x20sent','stringify','error','code','message','info','result','catch','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','AnalyticTreeReport,\x20%s,\x20%s'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x1ccd,0x14b));var _0xd1cc=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0x1ccd[_0x27beea];return _0x122645;};'use strict';var _=require('lodash');var util=require(_0xd1cc('0x0'));var moment=require(_0xd1cc('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1cc('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xd1cc('0x3'))(_0xd1cc('0x4'));var config=require(_0xd1cc('0x5'));var jayson=require(_0xd1cc('0x6'));var client=jayson[_0xd1cc('0x7')][_0xd1cc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45b565,_0x113d9f,_0x403b96){return new BPromise(function(_0x45b318,_0x4eafe8){return client['request'](_0x45b565,_0x403b96)[_0xd1cc('0x9')](function(_0x459156){logger['info'](_0xd1cc('0xa'),_0x113d9f,_0xd1cc('0xb'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x113d9f,_0xd1cc('0xb'),JSON[_0xd1cc('0xc')](_0x459156));if(_0x459156[_0xd1cc('0xd')]){if(_0x459156['error'][_0xd1cc('0xe')]===0x1f4){logger['error'](_0xd1cc('0xa'),_0x113d9f,_0x459156[_0xd1cc('0xd')][_0xd1cc('0xf')]);return _0x4eafe8(_0x459156[_0xd1cc('0xd')][_0xd1cc('0xf')]);}logger[_0xd1cc('0xd')](_0xd1cc('0xa'),_0x113d9f,_0x459156[_0xd1cc('0xd')][_0xd1cc('0xf')]);return _0x45b318(_0x459156[_0xd1cc('0xd')]['message']);}else{logger[_0xd1cc('0x10')]('AnalyticTreeReport,\x20%s,\x20%s',_0x113d9f,_0xd1cc('0xb'));_0x45b318(_0x459156[_0xd1cc('0x11')][_0xd1cc('0xf')]);}})[_0xd1cc('0x12')](function(_0x1ba804){logger[_0xd1cc('0xd')](_0xd1cc('0xa'),_0x113d9f,_0x1ba804);_0x4eafe8(_0x1ba804);});});} \ No newline at end of file +var _0xa27b=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x53dfc7,_0x398ada){var _0xf24c18=function(_0x3fa984){while(--_0x3fa984){_0x53dfc7['push'](_0x53dfc7['shift']());}};_0xf24c18(++_0x398ada);}(_0xa27b,0x124));var _0xba27=function(_0x3e87c7,_0x5da288){_0x3e87c7=_0x3e87c7-0x0;var _0x4175f4=_0xa27b[_0x3e87c7];return _0x4175f4;};'use strict';var _=require(_0xba27('0x0'));var util=require(_0xba27('0x1'));var moment=require(_0xba27('0x2'));var BPromise=require(_0xba27('0x3'));var rs=require(_0xba27('0x4'));var fs=require('fs');var Redis=require(_0xba27('0x5'));var db=require(_0xba27('0x6'))['db'];var utils=require(_0xba27('0x7'));var logger=require('../../config/logger')(_0xba27('0x8'));var config=require(_0xba27('0x9'));var jayson=require(_0xba27('0xa'));var client=jayson[_0xba27('0xb')][_0xba27('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55aaa8,_0x5bee2d,_0x2dba3e){return new BPromise(function(_0xc1b28c,_0x23c584){return client[_0xba27('0xd')](_0x55aaa8,_0x2dba3e)[_0xba27('0xe')](function(_0x340a3a){logger[_0xba27('0xf')](_0xba27('0x10'),_0x5bee2d,_0xba27('0x11'));logger[_0xba27('0x12')](_0xba27('0x13'),_0x5bee2d,_0xba27('0x11'),JSON['stringify'](_0x340a3a));if(_0x340a3a[_0xba27('0x14')]){if(_0x340a3a[_0xba27('0x14')][_0xba27('0x15')]===0x1f4){logger['error'](_0xba27('0x10'),_0x5bee2d,_0x340a3a[_0xba27('0x14')]['message']);return _0x23c584(_0x340a3a['error']['message']);}logger[_0xba27('0x14')](_0xba27('0x10'),_0x5bee2d,_0x340a3a[_0xba27('0x14')][_0xba27('0x16')]);return _0xc1b28c(_0x340a3a['error'][_0xba27('0x16')]);}else{logger[_0xba27('0xf')](_0xba27('0x10'),_0x5bee2d,_0xba27('0x11'));_0xc1b28c(_0x340a3a[_0xba27('0x17')][_0xba27('0x16')]);}})[_0xba27('0x18')](function(_0x1ae4b2){logger[_0xba27('0x14')]('AnalyticTreeReport,\x20%s,\x20%s',_0x5bee2d,_0x1ae4b2);_0x23c584(_0x1ae4b2);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 0e47755..a2799ff 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 _0xabc6=['../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router'];(function(_0x488bec,_0x13b2b9){var _0x550d3f=function(_0x1fbbc3){while(--_0x1fbbc3){_0x488bec['push'](_0x488bec['shift']());}};_0x550d3f(++_0x13b2b9);}(_0xabc6,0xcc));var _0x6abc=function(_0x540133,_0x41783f){_0x540133=_0x540133-0x0;var _0x26b6e9=_0xabc6[_0x540133];return _0x26b6e9;};'use strict';var multer=require('multer');var util=require(_0x6abc('0x0'));var path=require(_0x6abc('0x1'));var timeout=require(_0x6abc('0x2'));var express=require(_0x6abc('0x3'));var router=express[_0x6abc('0x4')]();var auth=require(_0x6abc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6abc('0x6'));var controller=require(_0x6abc('0x7'));router[_0x6abc('0x8')]('/',auth['isAuthenticated'](),controller[_0x6abc('0x9')]);router[_0x6abc('0x8')](_0x6abc('0xa'),auth[_0x6abc('0xb')](),controller[_0x6abc('0xc')]);router[_0x6abc('0xd')]('/',auth['isAuthenticated'](),controller[_0x6abc('0xe')]);router[_0x6abc('0xf')](_0x6abc('0xa'),auth[_0x6abc('0xb')](),controller[_0x6abc('0x10')]);router[_0x6abc('0x11')]('/:id',auth[_0x6abc('0xb')](),controller['destroy']);module[_0x6abc('0x12')]=router; \ No newline at end of file +var _0xc238=['Router','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','exports','util','path','connect-timeout'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xc238,0x141));var _0x8c23=function(_0x5a7587,_0xaf5db7){_0x5a7587=_0x5a7587-0x0;var _0x880cbc=_0xc238[_0x5a7587];return _0x880cbc;};'use strict';var multer=require('multer');var util=require(_0x8c23('0x0'));var path=require(_0x8c23('0x1'));var timeout=require(_0x8c23('0x2'));var express=require('express');var router=express[_0x8c23('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8c23('0x4'));var config=require('../../config/environment');var controller=require(_0x8c23('0x5'));router[_0x8c23('0x6')]('/',auth[_0x8c23('0x7')](),controller[_0x8c23('0x8')]);router['get']('/:id',auth[_0x8c23('0x7')](),controller[_0x8c23('0x9')]);router[_0x8c23('0xa')]('/',auth[_0x8c23('0x7')](),controller[_0x8c23('0xb')]);router[_0x8c23('0xc')]('/:id',auth[_0x8c23('0x7')](),controller[_0x8c23('0xd')]);router[_0x8c23('0xe')](_0x8c23('0xf'),auth[_0x8c23('0x7')](),controller[_0x8c23('0x10')]);module[_0x8c23('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 5c54423..09e1410 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 _0x099b=['exports','STRING','sequelize'];(function(_0x2e3d4a,_0x58b040){var _0x2469af=function(_0x2d60fd){while(--_0x2d60fd){_0x2e3d4a['push'](_0x2e3d4a['shift']());}};_0x2469af(++_0x58b040);}(_0x099b,0xd4));var _0xb099=function(_0x1866b2,_0x9bbc1d){_0x1866b2=_0x1866b2-0x0;var _0x448d44=_0x099b[_0x1866b2];return _0x448d44;};'use strict';var Sequelize=require(_0xb099('0x0'));module[_0xb099('0x1')]={'name':{'type':Sequelize[_0xb099('0x2')]},'basename':{'type':Sequelize[_0xb099('0x2')]},'type':{'type':Sequelize[_0xb099('0x2')]}}; \ No newline at end of file +var _0xbf0d=['STRING','sequelize'];(function(_0x5eb40c,_0x5cc988){var _0x57765b=function(_0x50952e){while(--_0x50952e){_0x5eb40c['push'](_0x5eb40c['shift']());}};_0x57765b(++_0x5cc988);}(_0xbf0d,0x177));var _0xdbf0=function(_0x5a36a4,_0x41101e){_0x5a36a4=_0x5a36a4-0x0;var _0x3553e9=_0xbf0d[_0x5a36a4];return _0x3553e9;};'use strict';var Sequelize=require(_0xdbf0('0x0'));module['exports']={'name':{'type':Sequelize[_0xdbf0('0x1')]},'basename':{'type':Sequelize[_0xdbf0('0x1')]},'type':{'type':Sequelize[_0xdbf0('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 8ab7b4a..5d1d60e 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 _0x9748=['options','include','findAll','show','params','rawAttributes','find','catch','clone','includeAll','get','omit','createdAt','updatedAt','body','create','update','file','originalname','filename','mimetype','download','findOne','join','root','server/files/attachments/','basename','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','then','destroy','error','name','send','index','Attachment','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x197561,_0x153c9c){var _0x1eb5e3=function(_0x477846){while(--_0x477846){_0x197561['push'](_0x197561['shift']());}};_0x1eb5e3(++_0x153c9c);}(_0x9748,0x17f));var _0x8974=function(_0x2609f6,_0x590086){_0x2609f6=_0x2609f6-0x0;var _0x30daed=_0x9748[_0x2609f6];return _0x30daed;};'use strict';var pdf=require(_0x8974('0x0'));var emlformat=require(_0x8974('0x1'));var rimraf=require(_0x8974('0x2'));var zipdir=require(_0x8974('0x3'));var jsonpatch=require(_0x8974('0x4'));var rp=require('request-promise');var moment=require(_0x8974('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8974('0x6'));var util=require(_0x8974('0x7'));var path=require(_0x8974('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8974('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8974('0xa'));var crypto=require(_0x8974('0xb'));var jsforce=require(_0x8974('0xc'));var deskjs=require(_0x8974('0xd'));var toCsv=require(_0x8974('0xe'));var querystring=require(_0x8974('0xf'));var Papa=require(_0x8974('0x10'));var Redis=require('ioredis');var authService=require(_0x8974('0x11'));var qs=require(_0x8974('0x12'));var as=require(_0x8974('0x13'));var hardwareService=require(_0x8974('0x14'));var logger=require(_0x8974('0x15'))('api');var utils=require(_0x8974('0x16'));var config=require(_0x8974('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8974('0x18'))['db'];function respondWithStatusCode(_0x216604,_0x524f1d){_0x524f1d=_0x524f1d||0xcc;return function(_0x402458){if(_0x402458){return _0x216604[_0x8974('0x19')](_0x524f1d);}return _0x216604[_0x8974('0x1a')](_0x524f1d)[_0x8974('0x1b')]();};}function respondWithResult(_0x36530d,_0x5d2cff){_0x5d2cff=_0x5d2cff||0xc8;return function(_0x16a0d2){if(_0x16a0d2){return _0x36530d[_0x8974('0x1a')](_0x5d2cff)[_0x8974('0x1c')](_0x16a0d2);}};}function respondWithFilteredResult(_0x328c94,_0x193573){return function(_0x43b5b6){if(_0x43b5b6){var _0x790607=_0x43b5b6[_0x8974('0x1d')],_0x147c92=_0x193573[_0x8974('0x1e')],_0xe2747c=_0x193573[_0x8974('0x1e')]+_0x193573[_0x8974('0x1f')],_0x5e2793;if(_0xe2747c>=_0x790607){_0xe2747c=_0x790607;_0x5e2793=0xc8;}else{_0x5e2793=0xce;}_0x328c94['status'](_0x5e2793);return _0x328c94[_0x8974('0x20')](_0x8974('0x21'),_0x147c92+'-'+_0xe2747c+'/'+_0x790607)[_0x8974('0x1c')](_0x43b5b6);}return null;};}function patchUpdates(_0x235e93){return function(_0xc3b330){try{jsonpatch[_0x8974('0x22')](_0xc3b330,_0x235e93,!![]);}catch(_0x547ba6){return BPromise['reject'](_0x547ba6);}return _0xc3b330['save']();};}function saveUpdates(_0x56ae45,_0x52ab7c){return function(_0x179260){if(_0x179260){return _0x179260['update'](_0x56ae45)[_0x8974('0x23')](function(_0x5bb8a5){return _0x5bb8a5;});}return null;};}function removeEntity(_0x62cc24,_0x536dbb){return function(_0x300d66){if(_0x300d66){return _0x300d66[_0x8974('0x24')]()[_0x8974('0x23')](function(){_0x62cc24[_0x8974('0x1a')](0xcc)[_0x8974('0x1b')]();});}};}function handleEntityNotFound(_0x490d44,_0x309cf0){return function(_0x3ede66){if(!_0x3ede66){_0x490d44['sendStatus'](0x194);}return _0x3ede66;};}function handleError(_0x575d92,_0x2d144a){_0x2d144a=_0x2d144a||0x1f4;return function(_0x5d26e0){logger[_0x8974('0x25')](_0x5d26e0['stack']);if(_0x5d26e0['name']){delete _0x5d26e0[_0x8974('0x26')];}_0x575d92['status'](_0x2d144a)[_0x8974('0x27')](_0x5d26e0);};}exports[_0x8974('0x28')]=function(_0x33ef25,_0x20f071){var _0xb16c12={},_0x24af30={},_0x2930e9={'count':0x0,'rows':[]};var _0x458721=_['map'](db[_0x8974('0x29')]['rawAttributes'],function(_0x5675c7){return{'name':_0x5675c7[_0x8974('0x2a')],'type':_0x5675c7[_0x8974('0x2b')]['key']};});_0x24af30[_0x8974('0x2c')]=_[_0x8974('0x2d')](_0x458721,_0x8974('0x26'));_0x24af30[_0x8974('0x2e')]=_[_0x8974('0x2f')](_0x33ef25[_0x8974('0x2e')]);_0x24af30[_0x8974('0x30')]=_[_0x8974('0x31')](_0x24af30[_0x8974('0x2c')],_0x24af30['query']);_0xb16c12[_0x8974('0x32')]=_['intersection'](_0x24af30['model'],qs[_0x8974('0x33')](_0x33ef25['query'][_0x8974('0x33')]));_0xb16c12[_0x8974('0x32')]=_0xb16c12[_0x8974('0x32')][_0x8974('0x34')]?_0xb16c12[_0x8974('0x32')]:_0x24af30[_0x8974('0x2c')];if(!_0x33ef25[_0x8974('0x2e')][_0x8974('0x35')](_0x8974('0x36'))){_0xb16c12[_0x8974('0x1f')]=qs['limit'](_0x33ef25[_0x8974('0x2e')][_0x8974('0x1f')]);_0xb16c12['offset']=qs[_0x8974('0x1e')](_0x33ef25[_0x8974('0x2e')][_0x8974('0x1e')]);}_0xb16c12[_0x8974('0x37')]=qs[_0x8974('0x38')](_0x33ef25[_0x8974('0x2e')][_0x8974('0x38')]);_0xb16c12[_0x8974('0x39')]=qs[_0x8974('0x30')](_[_0x8974('0x3a')](_0x33ef25['query'],_0x24af30[_0x8974('0x30')]),_0x458721);if(_0x33ef25[_0x8974('0x2e')][_0x8974('0x3b')]){_0xb16c12[_0x8974('0x39')]=_[_0x8974('0x3c')](_0xb16c12[_0x8974('0x39')],{'$or':_[_0x8974('0x2d')](_0x458721,function(_0x340f0a){if(_0x340f0a[_0x8974('0x2b')]!==_0x8974('0x3d')){var _0xc08eb1={};_0xc08eb1[_0x340f0a[_0x8974('0x26')]]={'$like':'%'+_0x33ef25[_0x8974('0x2e')][_0x8974('0x3b')]+'%'};return _0xc08eb1;}})});}_0xb16c12=_[_0x8974('0x3c')]({},_0xb16c12,_0x33ef25[_0x8974('0x3e')]);var _0x115b80={'where':_0xb16c12[_0x8974('0x39')]};return db[_0x8974('0x29')][_0x8974('0x1d')](_0x115b80)['then'](function(_0x2234c2){_0x2930e9[_0x8974('0x1d')]=_0x2234c2;if(_0x33ef25[_0x8974('0x2e')]['includeAll']){_0xb16c12[_0x8974('0x3f')]=[{'all':!![]}];}return db[_0x8974('0x29')][_0x8974('0x40')](_0xb16c12);})[_0x8974('0x23')](function(_0x2d0e2b){_0x2930e9['rows']=_0x2d0e2b;return _0x2930e9;})[_0x8974('0x23')](respondWithFilteredResult(_0x20f071,_0xb16c12))['catch'](handleError(_0x20f071,null));};exports[_0x8974('0x41')]=function(_0x5e1272,_0x33542e){var _0x11b916={'raw':!![],'where':{'id':_0x5e1272[_0x8974('0x42')]['id']}},_0x5f6991={};_0x5f6991[_0x8974('0x2c')]=_[_0x8974('0x2f')](db[_0x8974('0x29')][_0x8974('0x43')]);_0x5f6991['query']=_[_0x8974('0x2f')](_0x5e1272[_0x8974('0x2e')]);_0x5f6991[_0x8974('0x30')]=_['intersection'](_0x5f6991[_0x8974('0x2c')],_0x5f6991[_0x8974('0x2e')]);_0x11b916[_0x8974('0x32')]=_[_0x8974('0x31')](_0x5f6991[_0x8974('0x2c')],qs[_0x8974('0x33')](_0x5e1272[_0x8974('0x2e')][_0x8974('0x33')]));_0x11b916[_0x8974('0x32')]=_0x11b916[_0x8974('0x32')]['length']?_0x11b916[_0x8974('0x32')]:_0x5f6991[_0x8974('0x2c')];if(_0x5e1272[_0x8974('0x2e')]['includeAll']){_0x11b916[_0x8974('0x3f')]=[{'all':!![]}];}_0x11b916=_[_0x8974('0x3c')]({},_0x11b916,_0x5e1272[_0x8974('0x3e')]);return db[_0x8974('0x29')][_0x8974('0x44')](_0x11b916)[_0x8974('0x23')](handleEntityNotFound(_0x33542e,null))['then'](respondWithResult(_0x33542e,null))[_0x8974('0x45')](handleError(_0x33542e,null));};exports[_0x8974('0x46')]=function(_0x12017a,_0x5e9bce){var _0x1c2738={'where':{'id':_0x12017a['params']['id']}},_0x36e592={};_0x36e592['model']=_[_0x8974('0x2f')](db[_0x8974('0x29')][_0x8974('0x43')]);_0x1c2738[_0x8974('0x32')]=_[_0x8974('0x31')](_0x36e592[_0x8974('0x2c')],qs['fields'](_0x12017a[_0x8974('0x2e')]['fields']));_0x1c2738['attributes']=_0x1c2738[_0x8974('0x32')][_0x8974('0x34')]?_0x1c2738[_0x8974('0x32')]:_0x36e592[_0x8974('0x2c')];if(_0x12017a[_0x8974('0x2e')][_0x8974('0x47')]){_0x1c2738[_0x8974('0x3f')]=[{'all':!![]}];}_0x1c2738=_[_0x8974('0x3c')]({},_0x1c2738,_0x12017a['options']);return db[_0x8974('0x29')][_0x8974('0x44')](_0x1c2738)[_0x8974('0x23')](handleEntityNotFound(_0x5e9bce,null))[_0x8974('0x23')](function(_0x523344){if(_0x523344){var _0x1d1639=_0x523344[_0x8974('0x48')]({'plain':!![]});_0x1d1639=qs[_0x8974('0x49')](_0x1d1639,['id',_0x8974('0x4a'),_0x8974('0x4b')]);_0x12017a[_0x8974('0x4c')]=_[_0x8974('0x49')](_0x12017a[_0x8974('0x4c')],['id',_0x8974('0x4a'),_0x8974('0x4b')]);return db[_0x8974('0x29')][_0x8974('0x4d')](_[_0x8974('0x3c')](_0x1d1639,_0x12017a[_0x8974('0x4c')]),{'include':_0x12017a[_0x8974('0x2e')][_0x8974('0x47')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x5e9bce,0xc9))[_0x8974('0x45')](handleError(_0x5e9bce,null));};exports[_0x8974('0x4e')]=function(_0x477201,_0x38a829){if(_0x477201[_0x8974('0x4c')]['id']){delete _0x477201['body']['id'];}return db[_0x8974('0x29')]['find']({'where':{'id':_0x477201[_0x8974('0x42')]['id']}})[_0x8974('0x23')](handleEntityNotFound(_0x38a829,null))[_0x8974('0x23')](saveUpdates(_0x477201['body'],null))['then'](respondWithResult(_0x38a829,null))[_0x8974('0x45')](handleError(_0x38a829,null));};exports[_0x8974('0x24')]=function(_0x8f6b2b,_0x1176da){return db[_0x8974('0x29')][_0x8974('0x44')]({'where':{'id':_0x8f6b2b[_0x8974('0x42')]['id']}})['then'](handleEntityNotFound(_0x1176da,null))[_0x8974('0x23')](removeEntity(_0x1176da,null))['catch'](handleError(_0x1176da,null));};exports[_0x8974('0x4d')]=function(_0x1fa255,_0x99a00,_0x300900){_0x1fa255['body'][_0x8974('0x26')]=_0x1fa255[_0x8974('0x4f')][_0x8974('0x50')];_0x1fa255[_0x8974('0x4c')]['basename']=_0x1fa255[_0x8974('0x4f')][_0x8974('0x51')];_0x1fa255[_0x8974('0x4c')]['type']=_0x1fa255[_0x8974('0x4f')][_0x8974('0x52')];return db[_0x8974('0x29')][_0x8974('0x4d')](_0x1fa255[_0x8974('0x4c')])[_0x8974('0x23')](respondWithResult(_0x99a00,0xc9))[_0x8974('0x45')](handleError(_0x99a00,null));};exports[_0x8974('0x53')]=function(_0x20f875,_0x215535,_0x2c8c2b){return db['Attachment'][_0x8974('0x54')]({'where':{'id':_0x20f875[_0x8974('0x42')]['id']},'raw':!![]})[_0x8974('0x23')](handleEntityNotFound(_0x215535,null))[_0x8974('0x23')](function(_0x35dbfe){if(_0x35dbfe){return _0x215535['download'](path[_0x8974('0x55')](config[_0x8974('0x56')],_0x8974('0x57'),_0x35dbfe[_0x8974('0x58')]));}})[_0x8974('0x45')](handleError(_0x215535,null));}; \ No newline at end of file +var _0x3941=['key','model','query','filters','intersection','attributes','fields','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','keys','options','find','clone','rawAttributes','length','get','omit','createdAt','body','params','create','originalname','filename','mimetype','download','findOne','join','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Attachment','fieldName','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3941,0x7d));var _0x1394=function(_0x12bfe1,_0x10804d){_0x12bfe1=_0x12bfe1-0x0;var _0x3e8542=_0x3941[_0x12bfe1];return _0x3e8542;};'use strict';var pdf=require(_0x1394('0x0'));var emlformat=require(_0x1394('0x1'));var rimraf=require(_0x1394('0x2'));var zipdir=require(_0x1394('0x3'));var jsonpatch=require(_0x1394('0x4'));var rp=require(_0x1394('0x5'));var moment=require(_0x1394('0x6'));var BPromise=require(_0x1394('0x7'));var Mustache=require(_0x1394('0x8'));var util=require(_0x1394('0x9'));var path=require('path');var sox=require(_0x1394('0xa'));var csv=require('to-csv');var ejs=require(_0x1394('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1394('0xc'));var crypto=require(_0x1394('0xd'));var jsforce=require(_0x1394('0xe'));var deskjs=require(_0x1394('0xf'));var toCsv=require(_0x1394('0x10'));var querystring=require(_0x1394('0x11'));var Papa=require('papaparse');var Redis=require(_0x1394('0x12'));var authService=require(_0x1394('0x13'));var qs=require(_0x1394('0x14'));var as=require(_0x1394('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1394('0x16'));var utils=require(_0x1394('0x17'));var config=require(_0x1394('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x425ee7,_0x255801){_0x255801=_0x255801||0xcc;return function(_0x59cfb4){if(_0x59cfb4){return _0x425ee7['sendStatus'](_0x255801);}return _0x425ee7[_0x1394('0x19')](_0x255801)[_0x1394('0x1a')]();};}function respondWithResult(_0x2c22a2,_0x543217){_0x543217=_0x543217||0xc8;return function(_0xf7175a){if(_0xf7175a){return _0x2c22a2[_0x1394('0x19')](_0x543217)[_0x1394('0x1b')](_0xf7175a);}};}function respondWithFilteredResult(_0x3bf04c,_0x57a917){return function(_0x26d411){if(_0x26d411){var _0x46d676=_0x26d411[_0x1394('0x1c')],_0xa68176=_0x57a917[_0x1394('0x1d')],_0x142c00=_0x57a917[_0x1394('0x1d')]+_0x57a917['limit'],_0x5bc8cb;if(_0x142c00>=_0x46d676){_0x142c00=_0x46d676;_0x5bc8cb=0xc8;}else{_0x5bc8cb=0xce;}_0x3bf04c[_0x1394('0x19')](_0x5bc8cb);return _0x3bf04c['set'](_0x1394('0x1e'),_0xa68176+'-'+_0x142c00+'/'+_0x46d676)['json'](_0x26d411);}return null;};}function patchUpdates(_0x1cabc6){return function(_0x2a7693){try{jsonpatch[_0x1394('0x1f')](_0x2a7693,_0x1cabc6,!![]);}catch(_0x2308d4){return BPromise[_0x1394('0x20')](_0x2308d4);}return _0x2a7693[_0x1394('0x21')]();};}function saveUpdates(_0x385b19,_0x5df0b3){return function(_0x50a08a){if(_0x50a08a){return _0x50a08a[_0x1394('0x22')](_0x385b19)[_0x1394('0x23')](function(_0x3fa7e3){return _0x3fa7e3;});}return null;};}function removeEntity(_0x418e5d,_0x1cf97f){return function(_0x146ac8){if(_0x146ac8){return _0x146ac8[_0x1394('0x24')]()[_0x1394('0x23')](function(){_0x418e5d[_0x1394('0x19')](0xcc)[_0x1394('0x1a')]();});}};}function handleEntityNotFound(_0x2ca3b9,_0x44fd8f){return function(_0x3bf797){if(!_0x3bf797){_0x2ca3b9[_0x1394('0x25')](0x194);}return _0x3bf797;};}function handleError(_0x39c8c7,_0x2ac53c){_0x2ac53c=_0x2ac53c||0x1f4;return function(_0x50188a){logger[_0x1394('0x26')](_0x50188a[_0x1394('0x27')]);if(_0x50188a[_0x1394('0x28')]){delete _0x50188a[_0x1394('0x28')];}_0x39c8c7[_0x1394('0x19')](_0x2ac53c)[_0x1394('0x29')](_0x50188a);};}exports[_0x1394('0x2a')]=function(_0x348344,_0x1b03c3){var _0x2869ba={},_0x217891={},_0x2c0892={'count':0x0,'rows':[]};var _0x25b9fa=_[_0x1394('0x2b')](db[_0x1394('0x2c')]['rawAttributes'],function(_0x18a5e4){return{'name':_0x18a5e4[_0x1394('0x2d')],'type':_0x18a5e4[_0x1394('0x2e')][_0x1394('0x2f')]};});_0x217891[_0x1394('0x30')]=_['map'](_0x25b9fa,_0x1394('0x28'));_0x217891[_0x1394('0x31')]=_['keys'](_0x348344[_0x1394('0x31')]);_0x217891[_0x1394('0x32')]=_[_0x1394('0x33')](_0x217891[_0x1394('0x30')],_0x217891[_0x1394('0x31')]);_0x2869ba[_0x1394('0x34')]=_['intersection'](_0x217891[_0x1394('0x30')],qs[_0x1394('0x35')](_0x348344[_0x1394('0x31')][_0x1394('0x35')]));_0x2869ba['attributes']=_0x2869ba[_0x1394('0x34')]['length']?_0x2869ba[_0x1394('0x34')]:_0x217891[_0x1394('0x30')];if(!_0x348344[_0x1394('0x31')]['hasOwnProperty'](_0x1394('0x36'))){_0x2869ba[_0x1394('0x37')]=qs[_0x1394('0x37')](_0x348344[_0x1394('0x31')][_0x1394('0x37')]);_0x2869ba[_0x1394('0x1d')]=qs[_0x1394('0x1d')](_0x348344['query']['offset']);}_0x2869ba[_0x1394('0x38')]=qs['sort'](_0x348344[_0x1394('0x31')][_0x1394('0x39')]);_0x2869ba['where']=qs[_0x1394('0x32')](_[_0x1394('0x3a')](_0x348344[_0x1394('0x31')],_0x217891[_0x1394('0x32')]),_0x25b9fa);if(_0x348344[_0x1394('0x31')][_0x1394('0x3b')]){_0x2869ba[_0x1394('0x3c')]=_[_0x1394('0x3d')](_0x2869ba[_0x1394('0x3c')],{'$or':_['map'](_0x25b9fa,function(_0x266b48){if(_0x266b48[_0x1394('0x2e')]!==_0x1394('0x3e')){var _0x453b83={};_0x453b83[_0x266b48[_0x1394('0x28')]]={'$like':'%'+_0x348344[_0x1394('0x31')][_0x1394('0x3b')]+'%'};return _0x453b83;}})});}_0x2869ba=_['merge']({},_0x2869ba,_0x348344['options']);var _0x3a92fc={'where':_0x2869ba[_0x1394('0x3c')]};return db[_0x1394('0x2c')][_0x1394('0x1c')](_0x3a92fc)[_0x1394('0x23')](function(_0x5b8c22){_0x2c0892[_0x1394('0x1c')]=_0x5b8c22;if(_0x348344[_0x1394('0x31')][_0x1394('0x3f')]){_0x2869ba[_0x1394('0x40')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x2869ba);})[_0x1394('0x23')](function(_0x259b9b){_0x2c0892[_0x1394('0x41')]=_0x259b9b;return _0x2c0892;})[_0x1394('0x23')](respondWithFilteredResult(_0x1b03c3,_0x2869ba))[_0x1394('0x42')](handleError(_0x1b03c3,null));};exports[_0x1394('0x43')]=function(_0x3a88f4,_0x2c5429){var _0x51bbc4={'raw':!![],'where':{'id':_0x3a88f4['params']['id']}},_0x22c6f0={};_0x22c6f0['model']=_['keys'](db[_0x1394('0x2c')]['rawAttributes']);_0x22c6f0[_0x1394('0x31')]=_[_0x1394('0x44')](_0x3a88f4[_0x1394('0x31')]);_0x22c6f0['filters']=_[_0x1394('0x33')](_0x22c6f0[_0x1394('0x30')],_0x22c6f0[_0x1394('0x31')]);_0x51bbc4[_0x1394('0x34')]=_['intersection'](_0x22c6f0[_0x1394('0x30')],qs[_0x1394('0x35')](_0x3a88f4[_0x1394('0x31')][_0x1394('0x35')]));_0x51bbc4[_0x1394('0x34')]=_0x51bbc4[_0x1394('0x34')]['length']?_0x51bbc4[_0x1394('0x34')]:_0x22c6f0[_0x1394('0x30')];if(_0x3a88f4[_0x1394('0x31')][_0x1394('0x3f')]){_0x51bbc4[_0x1394('0x40')]=[{'all':!![]}];}_0x51bbc4=_[_0x1394('0x3d')]({},_0x51bbc4,_0x3a88f4[_0x1394('0x45')]);return db[_0x1394('0x2c')][_0x1394('0x46')](_0x51bbc4)[_0x1394('0x23')](handleEntityNotFound(_0x2c5429,null))[_0x1394('0x23')](respondWithResult(_0x2c5429,null))[_0x1394('0x42')](handleError(_0x2c5429,null));};exports[_0x1394('0x47')]=function(_0x3b7edd,_0x473423){var _0x1435be={'where':{'id':_0x3b7edd['params']['id']}},_0xe69ad8={};_0xe69ad8[_0x1394('0x30')]=_[_0x1394('0x44')](db[_0x1394('0x2c')][_0x1394('0x48')]);_0x1435be[_0x1394('0x34')]=_[_0x1394('0x33')](_0xe69ad8[_0x1394('0x30')],qs[_0x1394('0x35')](_0x3b7edd[_0x1394('0x31')][_0x1394('0x35')]));_0x1435be[_0x1394('0x34')]=_0x1435be['attributes'][_0x1394('0x49')]?_0x1435be[_0x1394('0x34')]:_0xe69ad8[_0x1394('0x30')];if(_0x3b7edd['query'][_0x1394('0x3f')]){_0x1435be[_0x1394('0x40')]=[{'all':!![]}];}_0x1435be=_[_0x1394('0x3d')]({},_0x1435be,_0x3b7edd[_0x1394('0x45')]);return db['Attachment'][_0x1394('0x46')](_0x1435be)[_0x1394('0x23')](handleEntityNotFound(_0x473423,null))[_0x1394('0x23')](function(_0xb78e7a){if(_0xb78e7a){var _0x580c64=_0xb78e7a[_0x1394('0x4a')]({'plain':!![]});_0x580c64=qs[_0x1394('0x4b')](_0x580c64,['id',_0x1394('0x4c'),'updatedAt']);_0x3b7edd[_0x1394('0x4d')]=_[_0x1394('0x4b')](_0x3b7edd[_0x1394('0x4d')],['id','createdAt','updatedAt']);return db[_0x1394('0x2c')]['create'](_[_0x1394('0x3d')](_0x580c64,_0x3b7edd['body']),{'include':_0x3b7edd['query'][_0x1394('0x3f')]?[{'all':!![]}]:undefined});}})[_0x1394('0x23')](respondWithResult(_0x473423,0xc9))['catch'](handleError(_0x473423,null));};exports[_0x1394('0x22')]=function(_0x385384,_0x4e9b62){if(_0x385384[_0x1394('0x4d')]['id']){delete _0x385384[_0x1394('0x4d')]['id'];}return db[_0x1394('0x2c')][_0x1394('0x46')]({'where':{'id':_0x385384[_0x1394('0x4e')]['id']}})[_0x1394('0x23')](handleEntityNotFound(_0x4e9b62,null))[_0x1394('0x23')](saveUpdates(_0x385384[_0x1394('0x4d')],null))['then'](respondWithResult(_0x4e9b62,null))[_0x1394('0x42')](handleError(_0x4e9b62,null));};exports[_0x1394('0x24')]=function(_0x4a847d,_0x1665cb){return db[_0x1394('0x2c')][_0x1394('0x46')]({'where':{'id':_0x4a847d[_0x1394('0x4e')]['id']}})[_0x1394('0x23')](handleEntityNotFound(_0x1665cb,null))[_0x1394('0x23')](removeEntity(_0x1665cb,null))[_0x1394('0x42')](handleError(_0x1665cb,null));};exports[_0x1394('0x4f')]=function(_0x36b244,_0x3a8afb,_0x1f29bc){_0x36b244[_0x1394('0x4d')]['name']=_0x36b244['file'][_0x1394('0x50')];_0x36b244[_0x1394('0x4d')]['basename']=_0x36b244['file'][_0x1394('0x51')];_0x36b244[_0x1394('0x4d')]['type']=_0x36b244['file'][_0x1394('0x52')];return db[_0x1394('0x2c')][_0x1394('0x4f')](_0x36b244[_0x1394('0x4d')])[_0x1394('0x23')](respondWithResult(_0x3a8afb,0xc9))[_0x1394('0x42')](handleError(_0x3a8afb,null));};exports[_0x1394('0x53')]=function(_0x374a9e,_0xcc9d5,_0x4d297e){return db[_0x1394('0x2c')][_0x1394('0x54')]({'where':{'id':_0x374a9e[_0x1394('0x4e')]['id']},'raw':!![]})[_0x1394('0x23')](handleEntityNotFound(_0xcc9d5,null))[_0x1394('0x23')](function(_0x351234){if(_0x351234){return _0xcc9d5[_0x1394('0x53')](path[_0x1394('0x55')](config['root'],'server/files/attachments/',_0x351234['basename']));}})[_0x1394('0x42')](handleError(_0xcc9d5,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index ae44a03..8d15926 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 _0x505d=['./attachment.attributes','exports','Attachment','attachments','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4f650c,_0x1c5643){var _0x2bb8d1=function(_0x3755a9){while(--_0x3755a9){_0x4f650c['push'](_0x4f650c['shift']());}};_0x2bb8d1(++_0x1c5643);}(_0x505d,0x93));var _0xd505=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x505d[_0x934425];return _0x31d596;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd505('0x0'))(_0xd505('0x1'));var moment=require(_0xd505('0x2'));var BPromise=require(_0xd505('0x3'));var rp=require(_0xd505('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd505('0x5'));var config=require(_0xd505('0x6'));var attributes=require(_0xd505('0x7'));module[_0xd505('0x8')]=function(_0x4ab634,_0x3a2863){return _0x4ab634['define'](_0xd505('0x9'),attributes,{'tableName':_0xd505('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20d8=['request-promise','path','rimraf','../../config/environment','exports','Attachment','attachments','lodash','util','../../config/logger','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x20d8,0xee));var _0x820d=function(_0x2c4d06,_0x6c0296){_0x2c4d06=_0x2c4d06-0x0;var _0x5268d3=_0x20d8[_0x2c4d06];return _0x5268d3;};'use strict';var _=require(_0x820d('0x0'));var util=require(_0x820d('0x1'));var logger=require(_0x820d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x820d('0x3'));var rp=require(_0x820d('0x4'));var fs=require('fs');var path=require(_0x820d('0x5'));var rimraf=require(_0x820d('0x6'));var config=require(_0x820d('0x7'));var attributes=require('./attachment.attributes');module[_0x820d('0x8')]=function(_0x160735,_0x3b801d){return _0x160735['define'](_0x820d('0x9'),attributes,{'tableName':_0x820d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index e192174..129aa36 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 _0xdb72=['body','options','raw','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateAttachment','Attachment','create'];(function(_0x1ec6b3,_0x4d613c){var _0x7f842c=function(_0x3e1c27){while(--_0x3e1c27){_0x1ec6b3['push'](_0x1ec6b3['shift']());}};_0x7f842c(++_0x4d613c);}(_0xdb72,0x121));var _0x2db7=function(_0x5ec3e2,_0x5294df){_0x5ec3e2=_0x5ec3e2-0x0;var _0x152654=_0xdb72[_0x5ec3e2];return _0x152654;};'use strict';var _=require(_0x2db7('0x0'));var util=require('util');var moment=require(_0x2db7('0x1'));var BPromise=require(_0x2db7('0x2'));var rs=require(_0x2db7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2db7('0x4'));var logger=require(_0x2db7('0x5'))('rpc');var config=require(_0x2db7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2db7('0x7')][_0x2db7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x594fcf,_0x161f6c,_0x40221e){return new BPromise(function(_0x76dd92,_0x367908){return client[_0x2db7('0x9')](_0x594fcf,_0x40221e)['then'](function(_0x301318){logger[_0x2db7('0xa')](_0x2db7('0xb'),_0x161f6c,_0x2db7('0xc'));logger[_0x2db7('0xd')](_0x2db7('0xe'),_0x161f6c,_0x2db7('0xc'),JSON[_0x2db7('0xf')](_0x301318));if(_0x301318[_0x2db7('0x10')]){if(_0x301318['error']['code']===0x1f4){logger[_0x2db7('0x10')](_0x2db7('0xb'),_0x161f6c,_0x301318['error'][_0x2db7('0x11')]);return _0x367908(_0x301318[_0x2db7('0x10')][_0x2db7('0x11')]);}logger[_0x2db7('0x10')](_0x2db7('0xb'),_0x161f6c,_0x301318[_0x2db7('0x10')][_0x2db7('0x11')]);return _0x76dd92(_0x301318['error']['message']);}else{logger[_0x2db7('0xa')](_0x2db7('0xb'),_0x161f6c,_0x2db7('0xc'));_0x76dd92(_0x301318[_0x2db7('0x12')]['message']);}})[_0x2db7('0x13')](function(_0x271485){logger[_0x2db7('0x10')]('Attachment,\x20%s,\x20%s',_0x161f6c,_0x271485);_0x367908(_0x271485);});});}exports[_0x2db7('0x14')]=function(_0x365d61){var _0x4efae7=this;return new Promise(function(_0x150724,_0xc259fe){return db[_0x2db7('0x15')][_0x2db7('0x16')](_0x365d61[_0x2db7('0x17')],{'raw':_0x365d61[_0x2db7('0x18')]?_0x365d61[_0x2db7('0x18')][_0x2db7('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x113a23){logger[_0x2db7('0xa')]('CreateAttachment',_0x365d61);logger[_0x2db7('0xd')](_0x2db7('0x14'),_0x365d61,JSON['stringify'](_0x113a23));_0x150724(_0x113a23);})[_0x2db7('0x13')](function(_0x28e243){logger['error'](_0x2db7('0x14'),_0x28e243[_0x2db7('0x11')],_0x365d61);_0xc259fe(_0x4efae7[_0x2db7('0x10')](0x1f4,_0x28e243[_0x2db7('0x11')]));});});}; \ No newline at end of file +var _0xb327=['request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateAttachment','Attachment','create','options','info','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','Attachment,\x20%s,\x20%s'];(function(_0x42c6dd,_0x5478f7){var _0x252c80=function(_0x2cacb1){while(--_0x2cacb1){_0x42c6dd['push'](_0x42c6dd['shift']());}};_0x252c80(++_0x5478f7);}(_0xb327,0x75));var _0x7b32=function(_0x3c1c72,_0x26205e){_0x3c1c72=_0x3c1c72-0x0;var _0x3d6710=_0xb327[_0x3c1c72];return _0x3d6710;};'use strict';var _=require('lodash');var util=require(_0x7b32('0x0'));var moment=require(_0x7b32('0x1'));var BPromise=require(_0x7b32('0x2'));var rs=require(_0x7b32('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b32('0x4'))['db'];var utils=require(_0x7b32('0x5'));var logger=require(_0x7b32('0x6'))(_0x7b32('0x7'));var config=require('../../config/environment');var jayson=require(_0x7b32('0x8'));var client=jayson[_0x7b32('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x589539,_0x480110,_0x18dc69){return new BPromise(function(_0x58914e,_0xb256b5){return client[_0x7b32('0xa')](_0x589539,_0x18dc69)[_0x7b32('0xb')](function(_0x34da3d){logger['info'](_0x7b32('0xc'),_0x480110,_0x7b32('0xd'));logger[_0x7b32('0xe')](_0x7b32('0xf'),_0x480110,'request\x20sent',JSON[_0x7b32('0x10')](_0x34da3d));if(_0x34da3d[_0x7b32('0x11')]){if(_0x34da3d[_0x7b32('0x11')][_0x7b32('0x12')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x480110,_0x34da3d[_0x7b32('0x11')][_0x7b32('0x13')]);return _0xb256b5(_0x34da3d[_0x7b32('0x11')]['message']);}logger[_0x7b32('0x11')]('Attachment,\x20%s,\x20%s',_0x480110,_0x34da3d[_0x7b32('0x11')][_0x7b32('0x13')]);return _0x58914e(_0x34da3d[_0x7b32('0x11')]['message']);}else{logger['info'](_0x7b32('0xc'),_0x480110,'request\x20sent');_0x58914e(_0x34da3d['result'][_0x7b32('0x13')]);}})[_0x7b32('0x14')](function(_0xcd0a6){logger[_0x7b32('0x11')](_0x7b32('0xc'),_0x480110,_0xcd0a6);_0xb256b5(_0xcd0a6);});});}exports[_0x7b32('0x15')]=function(_0x182d90){var _0x4c87f3=this;return new Promise(function(_0x7d1fa5,_0x5e84d6){return db[_0x7b32('0x16')][_0x7b32('0x17')](_0x182d90['body'],{'raw':_0x182d90[_0x7b32('0x18')]?_0x182d90[_0x7b32('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x7b32('0xb')](function(_0x2d3664){logger[_0x7b32('0x19')](_0x7b32('0x15'),_0x182d90);logger[_0x7b32('0xe')](_0x7b32('0x15'),_0x182d90,JSON[_0x7b32('0x10')](_0x2d3664));_0x7d1fa5(_0x2d3664);})[_0x7b32('0x14')](function(_0x4ffaea){logger['error']('CreateAttachment',_0x4ffaea[_0x7b32('0x13')],_0x182d90);_0x5e84d6(_0x4c87f3[_0x7b32('0x11')](0x1f4,_0x4ffaea[_0x7b32('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index f841c01..963788f 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 _0xfe36=['delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','download','/:id/clone','clone','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','replace','post','single','put','update'];(function(_0x594ece,_0x2a1f27){var _0x471bc4=function(_0x31941c){while(--_0x31941c){_0x594ece['push'](_0x594ece['shift']());}};_0x471bc4(++_0x2a1f27);}(_0xfe36,0x1b6));var _0x6fe3=function(_0x412a74,_0x586182){_0x412a74=_0x412a74-0x0;var _0x9d2ce7=_0xfe36[_0x412a74];return _0x9d2ce7;};'use strict';var multer=require(_0x6fe3('0x0'));var util=require(_0x6fe3('0x1'));var path=require('path');var timeout=require(_0x6fe3('0x2'));var express=require(_0x6fe3('0x3'));var router=express[_0x6fe3('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6fe3('0x5'));var config=require(_0x6fe3('0x6'));var controller=require(_0x6fe3('0x7'));router[_0x6fe3('0x8')]('/',auth[_0x6fe3('0x9')](),controller[_0x6fe3('0xa')]);router['get']('/:id',auth[_0x6fe3('0x9')](),controller[_0x6fe3('0xb')]);router[_0x6fe3('0x8')]('/:id/download',auth[_0x6fe3('0x9')](),controller[_0x6fe3('0xc')]);router['post'](_0x6fe3('0xd'),auth[_0x6fe3('0x9')](),controller[_0x6fe3('0xe')]);var upload=multer({'storage':multer[_0x6fe3('0xf')]({'destination':function(_0x5ae712,_0x165b73,_0x16f433){_0x16f433(null,path['join'](config[_0x6fe3('0x10')],_0x6fe3('0x11')));},'filename':function(_0x316c7d,_0x11f048,_0x11095d){_0x11095d(null,util[_0x6fe3('0x12')](_0x6fe3('0x13'),Date[_0x6fe3('0x14')](),_0x11f048[_0x6fe3('0x15')][_0x6fe3('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x6fe3('0x17')]('/',upload[_0x6fe3('0x18')]('file'),controller['create']);router[_0x6fe3('0x19')]('/:id',auth[_0x6fe3('0x9')](),controller[_0x6fe3('0x1a')]);router[_0x6fe3('0x1b')](_0x6fe3('0x1c'),auth['isAuthenticated'](),controller[_0x6fe3('0x1d')]);module[_0x6fe3('0x1e')]=router; \ No newline at end of file +var _0x8a9a=['../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','/:id/clone','diskStorage','root','server/files/attachments/','format','now','originalname','replace','file','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x26d311,_0x3f7749){var _0x3894da=function(_0x11290d){while(--_0x11290d){_0x26d311['push'](_0x26d311['shift']());}};_0x3894da(++_0x3f7749);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x8a9a[_0x2b7764];return _0x848dcb;};'use strict';var multer=require('multer');var util=require(_0xa8a9('0x0'));var path=require(_0xa8a9('0x1'));var timeout=require(_0xa8a9('0x2'));var express=require(_0xa8a9('0x3'));var router=express[_0xa8a9('0x4')]();var auth=require(_0xa8a9('0x5'));var interaction=require(_0xa8a9('0x6'));var config=require(_0xa8a9('0x7'));var controller=require(_0xa8a9('0x8'));router[_0xa8a9('0x9')]('/',auth[_0xa8a9('0xa')](),controller[_0xa8a9('0xb')]);router['get'](_0xa8a9('0xc'),auth['isAuthenticated'](),controller[_0xa8a9('0xd')]);router[_0xa8a9('0x9')](_0xa8a9('0xe'),auth[_0xa8a9('0xa')](),controller[_0xa8a9('0xf')]);router['post'](_0xa8a9('0x10'),auth[_0xa8a9('0xa')](),controller['clone']);var upload=multer({'storage':multer[_0xa8a9('0x11')]({'destination':function(_0x4f4af8,_0x242d74,_0x30af18){_0x30af18(null,path['join'](config[_0xa8a9('0x12')],_0xa8a9('0x13')));},'filename':function(_0x4477a5,_0x28d881,_0x35b204){_0x35b204(null,util[_0xa8a9('0x14')]('%s-%s',Date[_0xa8a9('0x15')](),_0x28d881[_0xa8a9('0x16')][_0xa8a9('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload['single'](_0xa8a9('0x18')),controller[_0xa8a9('0x19')]);router[_0xa8a9('0x1a')]('/:id',auth[_0xa8a9('0xa')](),controller[_0xa8a9('0x1b')]);router['delete']('/:id',auth[_0xa8a9('0xa')](),controller[_0xa8a9('0x1c')]);module[_0xa8a9('0x1d')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 7dec281..17bab2f 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 _0x8b0f=['authenticate','google','/login','email','use','clientSecret','Setting','findOne','allowedLoginAttempts','blockDuration','User','find','map','value','admin','user','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','minutes','clearBlockUser','then','getLicense','Strategy','../../mysqldb','../../components/auth/service','signToken','login'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8b0f,0x12f));var _0xf8b0=function(_0x9d73b3,_0x13af62){_0x9d73b3=_0x9d73b3-0x0;var _0x47608d=_0x8b0f[_0x9d73b3];return _0x47608d;};'use strict';var _=require('lodash');var passport=require('passport');var GoogleStrategy=require('passport-google-oauth20')[_0xf8b0('0x0')];var moment=require('moment');var db=require(_0xf8b0('0x1'))['db'];var config=require('../../config/environment');var signToken=require(_0xf8b0('0x2'))[_0xf8b0('0x3')];var utils=require('../../config/utils');exports[_0xf8b0('0x4')]=passport[_0xf8b0('0x5')](_0xf8b0('0x6'),{'failureRedirect':_0xf8b0('0x7'),'scope':['profile',_0xf8b0('0x8')],'session':![]});exports['callback']=passport[_0xf8b0('0x5')]('google',{'failureRedirect':_0xf8b0('0x7'),'session':![]});passport[_0xf8b0('0x9')](new GoogleStrategy({'clientID':config[_0xf8b0('0x6')]?config[_0xf8b0('0x6')]['clientID']:'id','clientSecret':config[_0xf8b0('0x6')]?config['google'][_0xf8b0('0xa')]:'secret','callbackURL':config[_0xf8b0('0x6')]?config[_0xf8b0('0x6')]['callbackURL']:''},function(_0x2ce1d1,_0x39acd2,_0x17e226,_0x54fcf1){var _0x15ae8c,_0x2bb3e0;return db[_0xf8b0('0xb')][_0xf8b0('0xc')]({'where':{'id':0x1},'attributes':[_0xf8b0('0xd'),_0xf8b0('0xe')],'raw':!![]})['then'](function(_0x5ba7bd){_0x15ae8c=_0x5ba7bd;return db[_0xf8b0('0xf')][_0xf8b0('0x10')]({'where':{'email':_[_0xf8b0('0x11')](_0x17e226['emails'],_0xf8b0('0x12')),'role':{'$or':[_0xf8b0('0x13'),_0xf8b0('0x14'),'agent']}}});})['then'](function(_0x3f80de){_0x2bb3e0=_0x3f80de;if(_0x2bb3e0){if(_0x2bb3e0[_0xf8b0('0x15')]){return _0x54fcf1(_0xf8b0('0x16'));}else if(_0x15ae8c[_0xf8b0('0xe')]>0x0){if(_0x2bb3e0['blocked']){if(moment(_0x2bb3e0[_0xf8b0('0x17')])['add'](_0x15ae8c[_0xf8b0('0xe')],_0xf8b0('0x18'))>moment()){return _0x54fcf1(_0xf8b0('0x16'));}else{return utils[_0xf8b0('0x19')](_0x2bb3e0,0x0,![],null)[_0xf8b0('0x1a')](function(){return utils[_0xf8b0('0x1b')](_0x2bb3e0);})[_0xf8b0('0x1a')](function(){return _0x54fcf1(null,_0x2bb3e0);});}}else{return utils[_0xf8b0('0x1b')](_0x2bb3e0)['then'](function(){return _0x54fcf1(null,_0x2bb3e0);});}}else{return utils[_0xf8b0('0x1b')](_0x2bb3e0)[_0xf8b0('0x1a')](function(){return _0x54fcf1(null,_0x2bb3e0);});}}return _0x54fcf1(_0xf8b0('0x16'));})['catch'](function(_0x475c05){_0x54fcf1(_0x475c05);});})); \ No newline at end of file +var _0x7be4=['Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','minutes','getLicense','passport','Strategy','moment','../../mysqldb','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','email','callback','use','clientID','clientSecret','callbackURL','blockDuration','then','User','find','map','value','admin','user','agent','disabled'];(function(_0x1aa9ac,_0x4c4c7d){var _0x705dfb=function(_0x187d9e){while(--_0x187d9e){_0x1aa9ac['push'](_0x1aa9ac['shift']());}};_0x705dfb(++_0x4c4c7d);}(_0x7be4,0x1f4));var _0x47be=function(_0x5353e7,_0x40a232){_0x5353e7=_0x5353e7-0x0;var _0x6623b0=_0x7be4[_0x5353e7];return _0x6623b0;};'use strict';var _=require('lodash');var passport=require(_0x47be('0x0'));var GoogleStrategy=require('passport-google-oauth20')[_0x47be('0x1')];var moment=require(_0x47be('0x2'));var db=require(_0x47be('0x3'))['db'];var config=require('../../config/environment');var signToken=require(_0x47be('0x4'))[_0x47be('0x5')];var utils=require(_0x47be('0x6'));exports[_0x47be('0x7')]=passport[_0x47be('0x8')](_0x47be('0x9'),{'failureRedirect':_0x47be('0xa'),'scope':['profile',_0x47be('0xb')],'session':![]});exports[_0x47be('0xc')]=passport[_0x47be('0x8')](_0x47be('0x9'),{'failureRedirect':_0x47be('0xa'),'session':![]});passport[_0x47be('0xd')](new GoogleStrategy({'clientID':config[_0x47be('0x9')]?config['google'][_0x47be('0xe')]:'id','clientSecret':config[_0x47be('0x9')]?config[_0x47be('0x9')][_0x47be('0xf')]:'secret','callbackURL':config[_0x47be('0x9')]?config['google'][_0x47be('0x10')]:''},function(_0x5f5235,_0x5048ba,_0x38b321,_0x544e11){var _0x3ab8b5,_0x5b7d75;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x47be('0x11')],'raw':!![]})[_0x47be('0x12')](function(_0x58fdc8){_0x3ab8b5=_0x58fdc8;return db[_0x47be('0x13')][_0x47be('0x14')]({'where':{'email':_[_0x47be('0x15')](_0x38b321['emails'],_0x47be('0x16')),'role':{'$or':[_0x47be('0x17'),_0x47be('0x18'),_0x47be('0x19')]}}});})[_0x47be('0x12')](function(_0x13f545){_0x5b7d75=_0x13f545;if(_0x5b7d75){if(_0x5b7d75[_0x47be('0x1a')]){return _0x544e11(_0x47be('0x1b'));}else if(_0x3ab8b5[_0x47be('0x11')]>0x0){if(_0x5b7d75['blocked']){if(moment(_0x5b7d75[_0x47be('0x1c')])['add'](_0x3ab8b5[_0x47be('0x11')],_0x47be('0x1d'))>moment()){return _0x544e11(_0x47be('0x1b'));}else{return utils['clearBlockUser'](_0x5b7d75,0x0,![],null)[_0x47be('0x12')](function(){return utils['getLicense'](_0x5b7d75);})[_0x47be('0x12')](function(){return _0x544e11(null,_0x5b7d75);});}}else{return utils[_0x47be('0x1e')](_0x5b7d75)['then'](function(){return _0x544e11(null,_0x5b7d75);});}}else{return utils[_0x47be('0x1e')](_0x5b7d75)['then'](function(){return _0x544e11(null,_0x5b7d75);});}}return _0x544e11(_0x47be('0x1b'));})['catch'](function(_0x275ff5){_0x544e11(_0x275ff5);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 8f831a9..a465aa8 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 _0xcf1c=['../user/user.controller.js','../../components/auth/service','get','callback','login','setTokenCookie','exports','express','passport','./authGoogle.controller'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0xcf1c,0x18d));var _0xccf1=function(_0x5bfa44,_0x76dacc){_0x5bfa44=_0x5bfa44-0x0;var _0x43815f=_0xcf1c[_0x5bfa44];return _0x43815f;};'use strict';var express=require(_0xccf1('0x0'));var passport=require(_0xccf1('0x1'));var router=express['Router']();var controller=require(_0xccf1('0x2'));var userController=require(_0xccf1('0x3'));var authService=require(_0xccf1('0x4'));router[_0xccf1('0x5')]('/',controller['login']);router['get']('/callback',controller[_0xccf1('0x6')],authService['isMiddleware'],userController[_0xccf1('0x7')],authService[_0xccf1('0x8')]);module[_0xccf1('0x9')]=router; \ No newline at end of file +var _0x777f=['get','login','/callback','callback','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service'];(function(_0xe67a24,_0x36daf9){var _0x20b237=function(_0x476e7f){while(--_0x476e7f){_0xe67a24['push'](_0xe67a24['shift']());}};_0x20b237(++_0x36daf9);}(_0x777f,0x9f));var _0xf777=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0x777f[_0x352e09];return _0x1b7094;};'use strict';var express=require(_0xf777('0x0'));var passport=require(_0xf777('0x1'));var router=express[_0xf777('0x2')]();var controller=require(_0xf777('0x3'));var userController=require(_0xf777('0x4'));var authService=require(_0xf777('0x5'));router[_0xf777('0x6')]('/',controller[_0xf777('0x7')]);router['get'](_0xf777('0x8'),controller[_0xf777('0x9')],authService['isMiddleware'],userController['login'],authService['setTokenCookie']);module[_0xf777('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 f82eb4d..0a221a6 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 _0xcaf2=['port','secure','authentication','auth','pass','merge','\x22%s\x22\x20<%s>','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','login','authenticate','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','Email\x20parameter\x20is\x20missing','body','trim','User','This\x20email\x20is\x20not\x20registered.','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','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','Password\x20reset!','util','passport-local','Strategy','lodash','randomstring','../../mysqldb','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host'];(function(_0x1220dc,_0x448145){var _0x264ada=function(_0x171972){while(--_0x171972){_0x1220dc['push'](_0x1220dc['shift']());}};_0x264ada(++_0x448145);}(_0xcaf2,0x8a));var _0x2caf=function(_0x45ed90,_0x111e0b){_0x45ed90=_0x45ed90-0x0;var _0x47a846=_0xcaf2[_0x45ed90];return _0x47a846;};'use strict';var util=require(_0x2caf('0x0'));var passport=require('passport');var LocalStrategy=require(_0x2caf('0x1'))[_0x2caf('0x2')];var jayson=require('jayson/promise');var _=require(_0x2caf('0x3'));var rs=require(_0x2caf('0x4'));var moment=require('moment');var db=require(_0x2caf('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x2caf('0x6'));var client=jayson[_0x2caf('0x7')][_0x2caf('0x8')]({'port':0x232b});function localAuthenticate(_0x599ce7,_0xc44e4e,_0x314486,_0x4667c6){var _0x34e792,_0x5611aa;return db[_0x2caf('0x9')][_0x2caf('0xa')]({'where':{'id':0x1},'attributes':[_0x2caf('0xb'),_0x2caf('0xc')],'raw':!![]})[_0x2caf('0xd')](function(_0x438434){_0x34e792=_0x438434;return _0x599ce7[_0x2caf('0xa')]({'attributes':['id',_0x2caf('0xe'),_0x2caf('0xf'),'salt',_0x2caf('0x10'),_0x2caf('0x11'),_0x2caf('0x12'),_0x2caf('0x13'),_0x2caf('0x14')],'where':{'name':_0xc44e4e,'role':{'$or':[_0x2caf('0x15'),_0x2caf('0x16'),_0x2caf('0x17')]}}});})['then'](function(_0x7258b1){if(!_0x7258b1||_0x7258b1&&_0x7258b1[_0x2caf('0xe')]!==_0xc44e4e){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5611aa=_0x7258b1;return _0x5611aa;}})['then'](function(){_0x5611aa['authenticate'](_0x314486,function(_0x27bca8,_0x4da5ba){var _0x388e05=_0x5611aa[_0x2caf('0x14')]+0x1;if(_0x27bca8){return _0x4667c6(_0x27bca8);}else if(!_0x4da5ba){if(_0x5611aa[_0x2caf('0x11')]){return _0x4667c6(null,![],{'message':_0x2caf('0x18')});}else if(_0x34e792['allowedLoginAttempts']>0x0){if(_0x5611aa[_0x2caf('0x12')]){if(_0x34e792['blockDuration']>0x0){if(moment(_0x5611aa[_0x2caf('0x13')])['add'](_0x34e792['blockDuration'],_0x2caf('0x19'))>moment()){return _0x4667c6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x2caf('0x1a')](_0x5611aa,_0x388e05,![],null)[_0x2caf('0xd')](function(){return _0x4667c6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x4667c6(null,![],{'message':_0x2caf('0x18')});}}else{if(_0x388e05>=_0x34e792[_0x2caf('0xb')]){return utils[_0x2caf('0x1a')](_0x5611aa,0x0,!![],moment())[_0x2caf('0xd')](function(){return _0x4667c6(null,![],{'message':_0x2caf('0x18')});});}else{return utils['clearBlockUser'](_0x5611aa,_0x388e05,![],null)[_0x2caf('0xd')](function(){return _0x4667c6(null,![],{'message':_0x2caf('0x18')});});}}}else{return _0x4667c6(null,![],{'message':_0x2caf('0x18')});}}else{if(_0x5611aa[_0x2caf('0x11')]){return _0x4667c6(null,![],{'message':_0x2caf('0x18')});}else if(_0x34e792[_0x2caf('0xb')]>0x0){if(_0x5611aa[_0x2caf('0x12')]){if(_0x34e792[_0x2caf('0xc')]>0x0){if(moment(_0x5611aa[_0x2caf('0x13')])[_0x2caf('0x1b')](_0x34e792[_0x2caf('0xc')],'minutes')>moment()){return _0x4667c6(null,![],{'message':_0x2caf('0x18')});}else{return utils[_0x2caf('0x1a')](_0x5611aa,0x0,![],null)[_0x2caf('0xd')](function(){return utils[_0x2caf('0x1c')](_0x5611aa);})[_0x2caf('0xd')](function(){return _0x4667c6(null,_0x5611aa);});}}else{return _0x4667c6(null,![],{'message':_0x2caf('0x18')});}}else{return utils[_0x2caf('0x1a')](_0x5611aa,0x0,![],null)[_0x2caf('0xd')](function(){return utils[_0x2caf('0x1c')](_0x5611aa);})[_0x2caf('0xd')](function(){return _0x4667c6(null,_0x5611aa);})['catch'](function(_0x6a32ac){return _0x4667c6(null,![],_0x6a32ac);});}}else{if(_0x5611aa[_0x2caf('0x12')]){return _0x4667c6(null,![],{'message':_0x2caf('0x18')});}else{return utils[_0x2caf('0x1c')](_0x5611aa)[_0x2caf('0xd')](function(){return _0x4667c6(null,_0x5611aa);});}}}});})[_0x2caf('0x1d')](function(_0x13e8d9){return _0x4667c6(null,![],_0x13e8d9);});}function sendServiceMail(_0x135977){return db[_0x2caf('0x1e')][_0x2caf('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x2caf('0xe'),_0x2caf('0x20')],'include':[{'model':db[_0x2caf('0x21')],'as':'Smtp'}]})[_0x2caf('0xd')](function(_0xda0ec5){if(!_0xda0ec5){throw new Error(_0x2caf('0x22'));}var _0x25bbfc={'tls':{'rejectUnauthorized':![]}};if(_0xda0ec5[_0x2caf('0x23')][_0x2caf('0x24')]){_0x25bbfc[_0x2caf('0x24')]=_0xda0ec5['Smtp'][_0x2caf('0x24')];}else{_0x25bbfc[_0x2caf('0x25')]=_0xda0ec5['Smtp'][_0x2caf('0x25')];_0x25bbfc[_0x2caf('0x26')]=_0xda0ec5[_0x2caf('0x23')]['port'];_0x25bbfc[_0x2caf('0x27')]=_0xda0ec5['Smtp']['secure'];}if(_0xda0ec5[_0x2caf('0x23')][_0x2caf('0x28')]){_0x25bbfc[_0x2caf('0x29')]={'user':_0xda0ec5[_0x2caf('0x23')][_0x2caf('0x16')],'pass':_0xda0ec5[_0x2caf('0x23')][_0x2caf('0x2a')]};}var _0x34d8fe={'account':_0x25bbfc,'message':_[_0x2caf('0x2b')]({'from':util['format'](_0x2caf('0x2c'),_0xda0ec5[_0x2caf('0xe')],_0xda0ec5[_0x2caf('0x20')]||_0xda0ec5[_0x2caf('0x23')][_0x2caf('0x16')])},_0x135977)};return client[_0x2caf('0x2d')](_0x2caf('0x2e'),_0x34d8fe);})[_0x2caf('0xd')](function(_0x398de1){if(_0x398de1[_0x2caf('0x2f')]){throw new Error(util[_0x2caf('0x30')](_0x2caf('0x31'),_0x398de1['error']['message']||JSON[_0x2caf('0x32')](_0x398de1[_0x2caf('0x2f')])));}return!![];});}function handleError(_0x3b5a32,_0x2f1369,_0x4e32d6){return _0x3b5a32[_0x2caf('0x33')](_0x2f1369||0x1f4)[_0x2caf('0x34')]({'message':_0x4e32d6?_0x4e32d6[_0x2caf('0x35')]||_0x4e32d6:''});}exports[_0x2caf('0x36')]=function(_0x373009,_0x3177f9,_0x2ac0b2){passport[_0x2caf('0x37')]('local',function(_0x5d8e20,_0x72d80e,_0x863fca){var _0x177254=_0x5d8e20||_0x863fca;if(_0x177254){return handleError(_0x3177f9,0x191,_0x177254);}if(!_0x72d80e){return handleError(_0x3177f9,0x194,{'message':_0x2caf('0x38')});}else{var _0x43c40f={'payload':{'id':_0x72d80e['id'],'role':_0x72d80e[_0x2caf('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x2caf('0x39')](_0x43c40f)[_0x2caf('0xd')](function(_0x2e84fd){_0x3177f9[_0x2caf('0x3a')]({'id':_0x72d80e['id'],'token':_0x2e84fd,'statusCall':'','isAlreadyLogged':_0x72d80e[_0x2caf('0x3b')]});});}})(_0x373009,_0x3177f9,_0x2ac0b2);};exports['forgot']=function(_0x35ad7f,_0x3cfd28,_0x3dc8f2){if(!_0x35ad7f['body'][_0x2caf('0x20')]){return handleError(_0x3cfd28,0x1f4,{'message':_0x2caf('0x3c')});}var _0x179597=rs['generate']();_0x35ad7f[_0x2caf('0x3d')][_0x2caf('0x20')]=_0x35ad7f['body'][_0x2caf('0x20')][_0x2caf('0x3e')]()['toLowerCase']();var _0xe5fcbf;return db[_0x2caf('0x9')][_0x2caf('0xa')]({'where':{'id':0x1},'attributes':[_0x2caf('0xb'),_0x2caf('0xc')],'raw':!![]})[_0x2caf('0xd')](function(_0x1ea1a4){_0xe5fcbf=_0x1ea1a4;return db[_0x2caf('0x3f')]['find']({'where':{'email':_0x35ad7f[_0x2caf('0x3d')]['email']}});})[_0x2caf('0xd')](function(_0x41dd0a){if(!_0x41dd0a){throw new Error(_0x2caf('0x40'));}if(_0x41dd0a['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x41dd0a[_0x2caf('0x12')]){if(moment(_0x41dd0a['blockedAt'])[_0x2caf('0x1b')](_0xe5fcbf[_0x2caf('0xc')],_0x2caf('0x19'))>moment()){throw new Error(_0x2caf('0x41'));}else{_0x41dd0a[_0x2caf('0x12')]=![];_0x41dd0a[_0x2caf('0x13')]=null;}}_0x41dd0a[_0x2caf('0x42')]=_0x179597;_0x41dd0a[_0x2caf('0x43')]=Date[_0x2caf('0x44')]()+0x36ee80;return _0x41dd0a[_0x2caf('0x45')]();})[_0x2caf('0xd')](function(){return sendServiceMail({'to':_0x35ad7f[_0x2caf('0x3d')][_0x2caf('0x20')],'subject':_0x2caf('0x46'),'text':_0x2caf('0x47')+_0x2caf('0x48')+_0x2caf('0x49')+_0x35ad7f[_0x2caf('0x4a')][_0x2caf('0x25')]+_0x2caf('0x4b')+_0x179597+'\x0a\x0a'+_0x2caf('0x4c')});})['then'](function(){_0x3cfd28[_0x2caf('0x33')](0xc8)[_0x2caf('0x34')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x44bca0){return handleError(_0x3cfd28,0x1f4,_0x44bca0);});};exports[_0x2caf('0x4d')]=function(_0x5a822d,_0x35f96b,_0x3222b3){return db[_0x2caf('0x3f')][_0x2caf('0x1f')]({'where':{'resetPasswordToken':_0x5a822d[_0x2caf('0x4e')][_0x2caf('0x4f')],'resetPasswordExpires':{'$gt':Date[_0x2caf('0x44')]()}}})[_0x2caf('0xd')](function(_0x901625){if(!_0x901625){throw new Error(_0x2caf('0x50'));}return db[_0x2caf('0x9')][_0x2caf('0xa')]({'attributes':['id',_0x2caf('0x51'),'enforcePasswordHistory',_0x2caf('0x52')]})[_0x2caf('0xd')](function(_0x21c298){if(_0x21c298['securePassword'])authService[_0x2caf('0x53')](_0x5a822d[_0x2caf('0x3d')][_0x2caf('0xf')]);if(!_0x21c298[_0x2caf('0x54')]||!_0x901625[_0x2caf('0x55')])return _0x901625;authService[_0x2caf('0x56')](_0x5a822d[_0x2caf('0x3d')][_0x2caf('0xf')],_0x901625[_0x2caf('0x55')],_0x21c298[_0x2caf('0x52')]);return _0x901625;})['then'](function(){_0x901625[_0x2caf('0xf')]=_0x5a822d[_0x2caf('0x3d')][_0x2caf('0xf')];_0x901625['resetPasswordToken']=null;_0x901625[_0x2caf('0x43')]=null;return _0x901625[_0x2caf('0x45')]();});})[_0x2caf('0xd')](function(){_0x35f96b['status'](0xc8)[_0x2caf('0x34')]({'message':_0x2caf('0x57')});})[_0x2caf('0x1d')](function(_0x22668a){return handleError(_0x35f96b,0x1f4,_0x22668a);});};passport['use'](new LocalStrategy({'usernameField':_0x2caf('0xe'),'passwordField':_0x2caf('0xf')},function(_0x3822a6,_0x52f76b,_0x377111){return localAuthenticate(db[_0x2caf('0x3f')],_0x3822a6,_0x52f76b,_0x377111);})); \ No newline at end of file +var _0xfcf0=['authenticate','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','clearBlockUser','getLicense','catch','MailAccount','find','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','Smtp','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','email','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','status','send','message','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','generate','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','minutes','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','xCally\x20Motion\x20Password\x20Reset','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','password','salt','role','blockedAt','loginAttempts','user','agent','name'];(function(_0x4e9bed,_0x17175b){var _0x3d7b07=function(_0x26a115){while(--_0x26a115){_0x4e9bed['push'](_0x4e9bed['shift']());}};_0x3d7b07(++_0x17175b);}(_0xfcf0,0x138));var _0x0fcf=function(_0x172133,_0x10246b){_0x172133=_0x172133-0x0;var _0x2460e5=_0xfcf0[_0x172133];return _0x2460e5;};'use strict';var util=require(_0x0fcf('0x0'));var passport=require(_0x0fcf('0x1'));var LocalStrategy=require('passport-local')[_0x0fcf('0x2')];var jayson=require(_0x0fcf('0x3'));var _=require(_0x0fcf('0x4'));var rs=require(_0x0fcf('0x5'));var moment=require('moment');var db=require(_0x0fcf('0x6'))['db'];var authService=require(_0x0fcf('0x7'));var utils=require(_0x0fcf('0x8'));var client=jayson[_0x0fcf('0x9')][_0x0fcf('0xa')]({'port':0x232b});function localAuthenticate(_0x1a7b03,_0x61bbb9,_0x2dfdf8,_0x50c575){var _0x1388d1,_0x6ced94;return db[_0x0fcf('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0x0fcf('0xc'),_0x0fcf('0xd')],'raw':!![]})[_0x0fcf('0xe')](function(_0x4b3923){_0x1388d1=_0x4b3923;return _0x1a7b03[_0x0fcf('0xf')]({'attributes':['id','name',_0x0fcf('0x10'),_0x0fcf('0x11'),_0x0fcf('0x12'),'disabled','blocked',_0x0fcf('0x13'),_0x0fcf('0x14')],'where':{'name':_0x61bbb9,'role':{'$or':['admin',_0x0fcf('0x15'),_0x0fcf('0x16')]}}});})[_0x0fcf('0xe')](function(_0x26b169){if(!_0x26b169||_0x26b169&&_0x26b169[_0x0fcf('0x17')]!==_0x61bbb9){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x6ced94=_0x26b169;return _0x6ced94;}})[_0x0fcf('0xe')](function(){_0x6ced94[_0x0fcf('0x18')](_0x2dfdf8,function(_0x1fcb47,_0x5e867f){var _0x3c09c4=_0x6ced94[_0x0fcf('0x14')]+0x1;if(_0x1fcb47){return _0x50c575(_0x1fcb47);}else if(!_0x5e867f){if(_0x6ced94[_0x0fcf('0x19')]){return _0x50c575(null,![],{'message':_0x0fcf('0x1a')});}else if(_0x1388d1['allowedLoginAttempts']>0x0){if(_0x6ced94[_0x0fcf('0x1b')]){if(_0x1388d1[_0x0fcf('0xd')]>0x0){if(moment(_0x6ced94[_0x0fcf('0x13')])[_0x0fcf('0x1c')](_0x1388d1[_0x0fcf('0xd')],'minutes')>moment()){return _0x50c575(null,![],{'message':_0x0fcf('0x1a')});}else{return utils[_0x0fcf('0x1d')](_0x6ced94,_0x3c09c4,![],null)['then'](function(){return _0x50c575(null,![],{'message':_0x0fcf('0x1a')});});}}else{return _0x50c575(null,![],{'message':_0x0fcf('0x1a')});}}else{if(_0x3c09c4>=_0x1388d1['allowedLoginAttempts']){return utils[_0x0fcf('0x1d')](_0x6ced94,0x0,!![],moment())['then'](function(){return _0x50c575(null,![],{'message':_0x0fcf('0x1a')});});}else{return utils[_0x0fcf('0x1d')](_0x6ced94,_0x3c09c4,![],null)['then'](function(){return _0x50c575(null,![],{'message':_0x0fcf('0x1a')});});}}}else{return _0x50c575(null,![],{'message':_0x0fcf('0x1a')});}}else{if(_0x6ced94[_0x0fcf('0x19')]){return _0x50c575(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x1388d1[_0x0fcf('0xc')]>0x0){if(_0x6ced94[_0x0fcf('0x1b')]){if(_0x1388d1[_0x0fcf('0xd')]>0x0){if(moment(_0x6ced94[_0x0fcf('0x13')])[_0x0fcf('0x1c')](_0x1388d1[_0x0fcf('0xd')],'minutes')>moment()){return _0x50c575(null,![],{'message':_0x0fcf('0x1a')});}else{return utils[_0x0fcf('0x1d')](_0x6ced94,0x0,![],null)[_0x0fcf('0xe')](function(){return utils[_0x0fcf('0x1e')](_0x6ced94);})[_0x0fcf('0xe')](function(){return _0x50c575(null,_0x6ced94);});}}else{return _0x50c575(null,![],{'message':_0x0fcf('0x1a')});}}else{return utils[_0x0fcf('0x1d')](_0x6ced94,0x0,![],null)[_0x0fcf('0xe')](function(){return utils[_0x0fcf('0x1e')](_0x6ced94);})['then'](function(){return _0x50c575(null,_0x6ced94);})[_0x0fcf('0x1f')](function(_0xc107a){return _0x50c575(null,![],_0xc107a);});}}else{if(_0x6ced94[_0x0fcf('0x1b')]){return _0x50c575(null,![],{'message':_0x0fcf('0x1a')});}else{return utils[_0x0fcf('0x1e')](_0x6ced94)[_0x0fcf('0xe')](function(){return _0x50c575(null,_0x6ced94);});}}}});})[_0x0fcf('0x1f')](function(_0x527d43){return _0x50c575(null,![],_0x527d43);});}function sendServiceMail(_0x137e10){return db[_0x0fcf('0x20')][_0x0fcf('0x21')]({'where':{'service':!![]},'attributes':['id',_0x0fcf('0x17'),'email'],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]})[_0x0fcf('0xe')](function(_0x50b7df){if(!_0x50b7df){throw new Error(_0x0fcf('0x22'));}var _0x9ccae3={'tls':{'rejectUnauthorized':![]}};if(_0x50b7df['Smtp'][_0x0fcf('0x23')]){_0x9ccae3[_0x0fcf('0x23')]=_0x50b7df[_0x0fcf('0x24')][_0x0fcf('0x23')];}else{_0x9ccae3[_0x0fcf('0x25')]=_0x50b7df[_0x0fcf('0x24')]['host'];_0x9ccae3[_0x0fcf('0x26')]=_0x50b7df[_0x0fcf('0x24')][_0x0fcf('0x26')];_0x9ccae3[_0x0fcf('0x27')]=_0x50b7df[_0x0fcf('0x24')][_0x0fcf('0x27')];}if(_0x50b7df['Smtp'][_0x0fcf('0x28')]){_0x9ccae3[_0x0fcf('0x29')]={'user':_0x50b7df[_0x0fcf('0x24')][_0x0fcf('0x15')],'pass':_0x50b7df[_0x0fcf('0x24')][_0x0fcf('0x2a')]};}var _0x260d6a={'account':_0x9ccae3,'message':_[_0x0fcf('0x2b')]({'from':util[_0x0fcf('0x2c')](_0x0fcf('0x2d'),_0x50b7df[_0x0fcf('0x17')],_0x50b7df[_0x0fcf('0x2e')]||_0x50b7df[_0x0fcf('0x24')][_0x0fcf('0x15')])},_0x137e10)};return client['request']('SendMail',_0x260d6a);})[_0x0fcf('0xe')](function(_0x4ccbdf){if(_0x4ccbdf['error']){throw new Error(util[_0x0fcf('0x2c')](_0x0fcf('0x2f'),_0x4ccbdf[_0x0fcf('0x30')]['message']||JSON['stringify'](_0x4ccbdf[_0x0fcf('0x30')])));}return!![];});}function handleError(_0x15db0d,_0x148e09,_0x5a0462){return _0x15db0d[_0x0fcf('0x31')](_0x148e09||0x1f4)[_0x0fcf('0x32')]({'message':_0x5a0462?_0x5a0462[_0x0fcf('0x33')]||_0x5a0462:''});}exports['login']=function(_0x4c75e6,_0x536d21,_0x3c24cb){passport[_0x0fcf('0x18')](_0x0fcf('0x34'),function(_0x3ae8fa,_0x370699,_0x4be8eb){var _0x394cdf=_0x3ae8fa||_0x4be8eb;if(_0x394cdf){return handleError(_0x536d21,0x191,_0x394cdf);}if(!_0x370699){return handleError(_0x536d21,0x194,{'message':_0x0fcf('0x35')});}else{var _0xb4087={'payload':{'id':_0x370699['id'],'role':_0x370699['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0xb4087)[_0x0fcf('0xe')](function(_0xe97d6b){_0x536d21[_0x0fcf('0x36')]({'id':_0x370699['id'],'token':_0xe97d6b,'statusCall':'','isAlreadyLogged':_0x370699[_0x0fcf('0x37')]});});}})(_0x4c75e6,_0x536d21,_0x3c24cb);};exports[_0x0fcf('0x38')]=function(_0x4c6669,_0x1dc2f7,_0x2d947b){if(!_0x4c6669[_0x0fcf('0x39')][_0x0fcf('0x2e')]){return handleError(_0x1dc2f7,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x5f3800=rs[_0x0fcf('0x3a')]();_0x4c6669[_0x0fcf('0x39')]['email']=_0x4c6669[_0x0fcf('0x39')][_0x0fcf('0x2e')]['trim']()[_0x0fcf('0x3b')]();var _0xfc2f2b;return db[_0x0fcf('0xb')][_0x0fcf('0xf')]({'where':{'id':0x1},'attributes':[_0x0fcf('0xc'),'blockDuration'],'raw':!![]})[_0x0fcf('0xe')](function(_0x4f89da){_0xfc2f2b=_0x4f89da;return db['User']['find']({'where':{'email':_0x4c6669[_0x0fcf('0x39')]['email']}});})['then'](function(_0x239bba){if(!_0x239bba){throw new Error(_0x0fcf('0x3c'));}if(_0x239bba[_0x0fcf('0x19')]){throw new Error(_0x0fcf('0x3d'));}if(_0x239bba[_0x0fcf('0x1b')]){if(moment(_0x239bba[_0x0fcf('0x13')])[_0x0fcf('0x1c')](_0xfc2f2b[_0x0fcf('0xd')],_0x0fcf('0x3e'))>moment()){throw new Error(_0x0fcf('0x3f'));}else{_0x239bba['blocked']=![];_0x239bba[_0x0fcf('0x13')]=null;}}_0x239bba[_0x0fcf('0x40')]=_0x5f3800;_0x239bba[_0x0fcf('0x41')]=Date['now']()+0x36ee80;return _0x239bba['save']();})[_0x0fcf('0xe')](function(){return sendServiceMail({'to':_0x4c6669[_0x0fcf('0x39')][_0x0fcf('0x2e')],'subject':_0x0fcf('0x42'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x0fcf('0x43')+_0x4c6669[_0x0fcf('0x44')][_0x0fcf('0x25')]+_0x0fcf('0x45')+_0x5f3800+'\x0a\x0a'+_0x0fcf('0x46')});})[_0x0fcf('0xe')](function(){_0x1dc2f7[_0x0fcf('0x31')](0xc8)[_0x0fcf('0x32')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x259c91){return handleError(_0x1dc2f7,0x1f4,_0x259c91);});};exports[_0x0fcf('0x47')]=function(_0x28d2f4,_0x486d01,_0x5f1791){return db[_0x0fcf('0x48')]['find']({'where':{'resetPasswordToken':_0x28d2f4[_0x0fcf('0x49')][_0x0fcf('0x4a')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x0fcf('0xe')](function(_0x22d67d){if(!_0x22d67d){throw new Error(_0x0fcf('0x4b'));}return db[_0x0fcf('0xb')]['findOne']({'attributes':['id',_0x0fcf('0x4c'),_0x0fcf('0x4d'),_0x0fcf('0x4e')]})[_0x0fcf('0xe')](function(_0x41392f){if(_0x41392f[_0x0fcf('0x4c')])authService[_0x0fcf('0x4f')](_0x28d2f4[_0x0fcf('0x39')][_0x0fcf('0x10')]);if(!_0x41392f[_0x0fcf('0x4d')]||!_0x22d67d[_0x0fcf('0x50')])return _0x22d67d;authService[_0x0fcf('0x51')](_0x28d2f4[_0x0fcf('0x39')][_0x0fcf('0x10')],_0x22d67d['previousPasswords'],_0x41392f[_0x0fcf('0x4e')]);return _0x22d67d;})['then'](function(){_0x22d67d[_0x0fcf('0x10')]=_0x28d2f4[_0x0fcf('0x39')][_0x0fcf('0x10')];_0x22d67d[_0x0fcf('0x40')]=null;_0x22d67d[_0x0fcf('0x41')]=null;return _0x22d67d['save']();});})[_0x0fcf('0xe')](function(){_0x486d01['status'](0xc8)[_0x0fcf('0x32')]({'message':_0x0fcf('0x52')});})['catch'](function(_0x25c8ad){return handleError(_0x486d01,0x1f4,_0x25c8ad);});};passport[_0x0fcf('0x53')](new LocalStrategy({'usernameField':'name','passwordField':_0x0fcf('0x10')},function(_0x2e9226,_0x2e57b8,_0xe94027){return localAuthenticate(db[_0x0fcf('0x48')],_0x2e9226,_0x2e57b8,_0xe94027);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 0ed5a34..87feb1d 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 _0x19c6=['login','/forgot','forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller','post'];(function(_0x3e2fee,_0x1a8be3){var _0x170717=function(_0x4bb50f){while(--_0x4bb50f){_0x3e2fee['push'](_0x3e2fee['shift']());}};_0x170717(++_0x1a8be3);}(_0x19c6,0x1aa));var _0x619c=function(_0x32a3a4,_0x5c4905){_0x32a3a4=_0x32a3a4-0x0;var _0x1a9fd9=_0x19c6[_0x32a3a4];return _0x1a9fd9;};'use strict';var express=require(_0x619c('0x0'));var router=express[_0x619c('0x1')]();var controller=require(_0x619c('0x2'));router[_0x619c('0x3')]('/',controller[_0x619c('0x4')]);router['post'](_0x619c('0x5'),controller[_0x619c('0x6')]);router[_0x619c('0x3')](_0x619c('0x7'),controller[_0x619c('0x8')]);module[_0x619c('0x9')]=router; \ No newline at end of file +var _0x011b=['reset','exports','express','Router','./authLocal.controller','post','forgot','/reset/:token'];(function(_0x3982a7,_0x564520){var _0xf43e5=function(_0x32fe77){while(--_0x32fe77){_0x3982a7['push'](_0x3982a7['shift']());}};_0xf43e5(++_0x564520);}(_0x011b,0x18a));var _0xb011=function(_0xc97e97,_0x37d80){_0xc97e97=_0xc97e97-0x0;var _0x4fc6f5=_0x011b[_0xc97e97];return _0x4fc6f5;};'use strict';var express=require(_0xb011('0x0'));var router=express[_0xb011('0x1')]();var controller=require(_0xb011('0x2'));router[_0xb011('0x3')]('/',controller['login']);router[_0xb011('0x3')]('/forgot',controller[_0xb011('0x4')]);router[_0xb011('0x3')](_0xb011('0x5'),controller[_0xb011('0x6')]);module[_0xb011('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 0ed9462..0d1401d 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 _0xedbc=['STRING','BOOLEAN','INTEGER','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xedbc,0x113));var _0xcedb=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xedbc[_0x1b2ff7];return _0x31656a;};'use strict';var Sequelize=require('sequelize');module[_0xcedb('0x0')]={'name':{'type':Sequelize[_0xcedb('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xcedb('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xcedb('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xcedb('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xbd84=['exports','STRING','BOOLEAN'];(function(_0x46cc50,_0x42c5e7){var _0x367a5a=function(_0x2fe645){while(--_0x2fe645){_0x46cc50['push'](_0x46cc50['shift']());}};_0x367a5a(++_0x42c5e7);}(_0xbd84,0x1b9));var _0x4bd8=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xbd84[_0xe73080];return _0x12cbc4;};'use strict';var Sequelize=require('sequelize');module[_0x4bd8('0x0')]={'name':{'type':Sequelize[_0x4bd8('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x4bd8('0x1')]},'description':{'type':Sequelize[_0x4bd8('0x1')]},'status':{'type':Sequelize[_0x4bd8('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 0e7179e..1e1aca8 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(_0x2f2211,_0x5e9ad7){var _0x5e0e9b=function(_0x547fc1){while(--_0x547fc1){_0x2f2211['push'](_0x2f2211['shift']());}};_0x5e0e9b(++_0x5e9ad7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x25cd0a,_0x4287ec){var _0x186f1f=function(_0x304838){while(--_0x304838){_0x25cd0a['push'](_0x25cd0a['shift']());}};_0x186f1f(++_0x4287ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 1fe2970..286176e 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 _0x8c98=['exports','Automation','tools_automations','api','moment','bluebird','request-promise','path','rimraf','./automation.attributes'];(function(_0x5aad72,_0xd9698b){var _0x53f803=function(_0x1cc443){while(--_0x1cc443){_0x5aad72['push'](_0x5aad72['shift']());}};_0x53f803(++_0xd9698b);}(_0x8c98,0x193));var _0x88c9=function(_0x440a9d,_0x4aa70d){_0x440a9d=_0x440a9d-0x0;var _0x2c14f6=_0x8c98[_0x440a9d];return _0x2c14f6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x88c9('0x0'));var moment=require(_0x88c9('0x1'));var BPromise=require(_0x88c9('0x2'));var rp=require(_0x88c9('0x3'));var fs=require('fs');var path=require(_0x88c9('0x4'));var rimraf=require(_0x88c9('0x5'));var config=require('../../config/environment');var attributes=require(_0x88c9('0x6'));module[_0x88c9('0x7')]=function(_0x11dbd9,_0x1c67a9){return _0x11dbd9['define'](_0x88c9('0x8'),attributes,{'tableName':_0x88c9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebe6=['Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x40f801,_0x3e92b6){var _0x16e5b4=function(_0x37dfd8){while(--_0x37dfd8){_0x40f801['push'](_0x40f801['shift']());}};_0x16e5b4(++_0x3e92b6);}(_0xebe6,0x13a));var _0x6ebe=function(_0x34145e,_0x689e31){_0x34145e=_0x34145e-0x0;var _0x27ed04=_0xebe6[_0x34145e];return _0x27ed04;};'use strict';var _=require(_0x6ebe('0x0'));var util=require(_0x6ebe('0x1'));var logger=require(_0x6ebe('0x2'))(_0x6ebe('0x3'));var moment=require(_0x6ebe('0x4'));var BPromise=require(_0x6ebe('0x5'));var rp=require(_0x6ebe('0x6'));var fs=require('fs');var path=require(_0x6ebe('0x7'));var rimraf=require(_0x6ebe('0x8'));var config=require(_0x6ebe('0x9'));var attributes=require('./automation.attributes');module['exports']=function(_0x1c3c2c,_0x2a63a5){return _0x1c3c2c[_0x6ebe('0xa')](_0x6ebe('0xb'),attributes,{'tableName':_0x6ebe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 403bf4d..9a23a35 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 _0xb130=['Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','client','http','request','then','info'];(function(_0xb34f19,_0x51ce09){var _0x537c62=function(_0x582986){while(--_0x582986){_0xb34f19['push'](_0xb34f19['shift']());}};_0x537c62(++_0x51ce09);}(_0xb130,0x1ec));var _0x0b13=function(_0x3cf4d3,_0x48065e){_0x3cf4d3=_0x3cf4d3-0x0;var _0x4e547b=_0xb130[_0x3cf4d3];return _0x4e547b;};'use strict';var _=require(_0x0b13('0x0'));var util=require(_0x0b13('0x1'));var moment=require(_0x0b13('0x2'));var BPromise=require(_0x0b13('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b13('0x4'));var db=require(_0x0b13('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0b13('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0b13('0x7')][_0x0b13('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xdedbd3,_0x5dbfda,_0x4bce41){return new BPromise(function(_0x270426,_0x561d7b){return client[_0x0b13('0x9')](_0xdedbd3,_0x4bce41)[_0x0b13('0xa')](function(_0x56ca41){logger[_0x0b13('0xb')](_0x0b13('0xc'),_0x5dbfda,_0x0b13('0xd'));logger[_0x0b13('0xe')](_0x0b13('0xf'),_0x5dbfda,'request\x20sent',JSON['stringify'](_0x56ca41));if(_0x56ca41[_0x0b13('0x10')]){if(_0x56ca41[_0x0b13('0x10')][_0x0b13('0x11')]===0x1f4){logger['error'](_0x0b13('0xc'),_0x5dbfda,_0x56ca41[_0x0b13('0x10')][_0x0b13('0x12')]);return _0x561d7b(_0x56ca41[_0x0b13('0x10')][_0x0b13('0x12')]);}logger[_0x0b13('0x10')]('Automation,\x20%s,\x20%s',_0x5dbfda,_0x56ca41[_0x0b13('0x10')][_0x0b13('0x12')]);return _0x270426(_0x56ca41[_0x0b13('0x10')][_0x0b13('0x12')]);}else{logger[_0x0b13('0xb')](_0x0b13('0xc'),_0x5dbfda,_0x0b13('0xd'));_0x270426(_0x56ca41[_0x0b13('0x13')]['message']);}})[_0x0b13('0x14')](function(_0x27ff00){logger['error'](_0x0b13('0xc'),_0x5dbfda,_0x27ff00);_0x561d7b(_0x27ff00);});});} \ No newline at end of file +var _0x772d=['result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3e989f,_0x55eb84){var _0x5fd2b1=function(_0x5ac9ae){while(--_0x5ac9ae){_0x3e989f['push'](_0x3e989f['shift']());}};_0x5fd2b1(++_0x55eb84);}(_0x772d,0x87));var _0xd772=function(_0x9f43bb,_0x153ed9){_0x9f43bb=_0x9f43bb-0x0;var _0x4185bb=_0x772d[_0x9f43bb];return _0x4185bb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd772('0x0'));var BPromise=require(_0xd772('0x1'));var rs=require(_0xd772('0x2'));var fs=require('fs');var Redis=require(_0xd772('0x3'));var db=require(_0xd772('0x4'))['db'];var utils=require(_0xd772('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xd772('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd772('0x7')][_0xd772('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a4bc5,_0x4bafd8,_0x36bb07){return new BPromise(function(_0xaf624a,_0x1a5157){return client['request'](_0x3a4bc5,_0x36bb07)[_0xd772('0x9')](function(_0x4d2463){logger[_0xd772('0xa')](_0xd772('0xb'),_0x4bafd8,_0xd772('0xc'));logger['debug'](_0xd772('0xd'),_0x4bafd8,_0xd772('0xc'),JSON[_0xd772('0xe')](_0x4d2463));if(_0x4d2463[_0xd772('0xf')]){if(_0x4d2463[_0xd772('0xf')]['code']===0x1f4){logger[_0xd772('0xf')](_0xd772('0xb'),_0x4bafd8,_0x4d2463['error'][_0xd772('0x10')]);return _0x1a5157(_0x4d2463[_0xd772('0xf')][_0xd772('0x10')]);}logger[_0xd772('0xf')]('Automation,\x20%s,\x20%s',_0x4bafd8,_0x4d2463['error'][_0xd772('0x10')]);return _0xaf624a(_0x4d2463[_0xd772('0xf')][_0xd772('0x10')]);}else{logger[_0xd772('0xa')](_0xd772('0xb'),_0x4bafd8,_0xd772('0xc'));_0xaf624a(_0x4d2463[_0xd772('0x11')][_0xd772('0x10')]);}})[_0xd772('0x12')](function(_0x539fc3){logger[_0xd772('0xf')]('Automation,\x20%s,\x20%s',_0x4bafd8,_0x539fc3);_0x1a5157(_0x539fc3);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 73170ec..946d1ad 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 _0x9deb=['getConditions','/:id/actions','getActions','post','addConditions','addActions','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show'];(function(_0x43044e,_0x5725d6){var _0x1c6b54=function(_0x5d1a1b){while(--_0x5d1a1b){_0x43044e['push'](_0x43044e['shift']());}};_0x1c6b54(++_0x5725d6);}(_0x9deb,0x105));var _0xb9de=function(_0x3835b5,_0x423301){_0x3835b5=_0x3835b5-0x0;var _0x23d8d6=_0x9deb[_0x3835b5];return _0x23d8d6;};'use strict';var multer=require(_0xb9de('0x0'));var util=require(_0xb9de('0x1'));var path=require(_0xb9de('0x2'));var timeout=require(_0xb9de('0x3'));var express=require(_0xb9de('0x4'));var router=express['Router']();var auth=require(_0xb9de('0x5'));var interaction=require(_0xb9de('0x6'));var config=require(_0xb9de('0x7'));var controller=require(_0xb9de('0x8'));router[_0xb9de('0x9')]('/',auth[_0xb9de('0xa')](),controller[_0xb9de('0xb')]);router[_0xb9de('0x9')](_0xb9de('0xc'),auth[_0xb9de('0xa')](),controller[_0xb9de('0xd')]);router['get']('/:id/conditions',auth[_0xb9de('0xa')](),controller[_0xb9de('0xe')]);router[_0xb9de('0x9')](_0xb9de('0xf'),auth[_0xb9de('0xa')](),controller[_0xb9de('0x10')]);router[_0xb9de('0x11')]('/',auth[_0xb9de('0xa')](),controller['create']);router[_0xb9de('0x11')]('/:id/conditions',auth[_0xb9de('0xa')](),controller[_0xb9de('0x12')]);router[_0xb9de('0x11')](_0xb9de('0xf'),auth[_0xb9de('0xa')](),controller[_0xb9de('0x13')]);router[_0xb9de('0x14')](_0xb9de('0xc'),auth[_0xb9de('0xa')](),controller[_0xb9de('0x15')]);router[_0xb9de('0x16')](_0xb9de('0xc'),auth['isAuthenticated'](),controller[_0xb9de('0x17')]);module[_0xb9de('0x18')]=router; \ No newline at end of file +var _0x5c41=['express','Router','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','get','show','/:id/conditions','getConditions','/:id/actions','getActions','create','post','addConditions','addActions','delete','/:id','exports'];(function(_0x10ead8,_0x2cdd51){var _0x3e1efe=function(_0x2e085f){while(--_0x2e085f){_0x10ead8['push'](_0x10ead8['shift']());}};_0x3e1efe(++_0x2cdd51);}(_0x5c41,0xb4));var _0x15c4=function(_0x210dab,_0x48faf1){_0x210dab=_0x210dab-0x0;var _0x5bd41f=_0x5c41[_0x210dab];return _0x5bd41f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x15c4('0x0'));var router=express[_0x15c4('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x15c4('0x2'));var config=require(_0x15c4('0x3'));var controller=require(_0x15c4('0x4'));router['get']('/',auth[_0x15c4('0x5')](),controller[_0x15c4('0x6')]);router[_0x15c4('0x7')]('/:id',auth[_0x15c4('0x5')](),controller[_0x15c4('0x8')]);router['get'](_0x15c4('0x9'),auth[_0x15c4('0x5')](),controller[_0x15c4('0xa')]);router['get'](_0x15c4('0xb'),auth['isAuthenticated'](),controller[_0x15c4('0xc')]);router['post']('/',auth[_0x15c4('0x5')](),controller[_0x15c4('0xd')]);router[_0x15c4('0xe')](_0x15c4('0x9'),auth['isAuthenticated'](),controller[_0x15c4('0xf')]);router[_0x15c4('0xe')]('/:id/actions',auth[_0x15c4('0x5')](),controller[_0x15c4('0x10')]);router['put']('/:id',auth[_0x15c4('0x5')](),controller['update']);router[_0x15c4('0x11')](_0x15c4('0x12'),auth[_0x15c4('0x5')](),controller['destroy']);module[_0x15c4('0x13')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index a8a36d2..8584c6f 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 _0x1897=['#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#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)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','never','onlyIfOpen','always','Active/Disactive\x20AMD'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0x1897,0x1f2));var _0x7189=function(_0xd4a3b4,_0x2f50cb){_0xd4a3b4=_0xd4a3b4-0x0;var _0x2a35c9=_0x1897[_0xd4a3b4];return _0x2a35c9;};'use strict';var Sequelize=require(_0x7189('0x0'));module['exports']={'name':{'type':Sequelize[_0x7189('0x1')],'unique':_0x7189('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x7189('0x3')),'allowNull':![],'defaultValue':_0x7189('0x3')},'description':{'type':Sequelize[_0x7189('0x1')]},'active':{'type':Sequelize[_0x7189('0x4')],'defaultValue':0x0,'comment':_0x7189('0x5')},'limitCalls':{'type':Sequelize[_0x7189('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x7189('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x7189('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x7189('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7189('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x7189('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7189('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7189('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x7189('0x6')](0x3)[_0x7189('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7189('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x7189('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7189('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7189('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7189('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x7189('0x6')](0x3)[_0x7189('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7189('0xd')},'dialTimezone':{'type':Sequelize[_0x7189('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x7189('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x7189('0xf')]('always',_0x7189('0x10'),_0x7189('0x11')),'defaultValue':_0x7189('0x12')},'dialAMDActive':{'type':Sequelize[_0x7189('0x4')],'defaultValue':0x0,'comment':_0x7189('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x7189('0x6')](0x9)[_0x7189('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7189('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x7189('0x6')](0x9)[_0x7189('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7189('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7189('0x6')](0x9)[_0x7189('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7189('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7189('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7189('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x7189('0x6')](0x9)[_0x7189('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7189('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7189('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7189('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7189('0x6')](0x9)[_0x7189('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7189('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7189('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7189('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7189('0x6')](0x9)[_0x7189('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7189('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7189('0xf')](_0x7189('0x1d'),'ASC'),'defaultValue':_0x7189('0x1d')},'dialPrefix':{'type':Sequelize[_0x7189('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7189('0x6')](0x3)[_0x7189('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7189('0x1e')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x7189('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7189('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7189('0x6')](0x5)[_0x7189('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7189('0x1f')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7189('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7189('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7189('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7189('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7189('0x6')](0x5)[_0x7189('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7189('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x7189('0x6')](0x3)[_0x7189('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7189('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7189('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7189('0x6')](0x5)[_0x7189('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7189('0x24')}}; \ No newline at end of file +var _0xa82d=['Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','never','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)'];(function(_0x120d55,_0xe7f868){var _0x266408=function(_0x486835){while(--_0x486835){_0x120d55['push'](_0x120d55['shift']());}};_0x266408(++_0xe7f868);}(_0xa82d,0x101));var _0xda82=function(_0x301c46,_0x286435){_0x301c46=_0x301c46-0x0;var _0x5e8efd=_0xa82d[_0x301c46];return _0x5e8efd;};'use strict';var Sequelize=require(_0xda82('0x0'));module['exports']={'name':{'type':Sequelize[_0xda82('0x1')],'unique':_0xda82('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xda82('0x3')](_0xda82('0x4')),'allowNull':![],'defaultValue':_0xda82('0x4')},'description':{'type':Sequelize[_0xda82('0x1')]},'active':{'type':Sequelize[_0xda82('0x5')],'defaultValue':0x0,'comment':_0xda82('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xda82('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xda82('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xda82('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xda82('0x8')](0x3)[_0xda82('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xda82('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xda82('0x8')](0x3)[_0xda82('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xda82('0x8')](0x5)[_0xda82('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xda82('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xda82('0x8')](0x3)[_0xda82('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xda82('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xda82('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xda82('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xda82('0x8')](0x3)[_0xda82('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xda82('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xda82('0xd')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xda82('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xda82('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xda82('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xda82('0x3')]('always',_0xda82('0xe'),_0xda82('0xf')),'defaultValue':_0xda82('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xda82('0x8')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xda82('0x11')},'dialAMDGreeting':{'type':Sequelize[_0xda82('0x8')](0x9)[_0xda82('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xda82('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xda82('0x8')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xda82('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xda82('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xda82('0x8')](0x9)[_0xda82('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xda82('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xda82('0x8')](0x9)[_0xda82('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xda82('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xda82('0x8')](0x9)[_0xda82('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xda82('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xda82('0x8')](0x5)[_0xda82('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xda82('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0xda82('0x17')),'defaultValue':_0xda82('0x18')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xda82('0x19')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xda82('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xda82('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xda82('0x1b')},'dialDropMaxRetry':{'type':Sequelize[_0xda82('0x8')](0x3)[_0xda82('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xda82('0x1c')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xda82('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xda82('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xda82('0x8')](0x3)[_0xda82('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xda82('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xda82('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xda82('0x1f')},'dialMachineMaxRetry':{'type':Sequelize[_0xda82('0x8')](0x3)[_0xda82('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xda82('0x20')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xda82('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xda82('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xda82('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xda82('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xda82('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xda82('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index a5cdf20..f916de8 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 _0xb515=['bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','count','offset','set','Content-Range','json','apply','reject','then','destroy','get','IvrCampaigns','UserProfileResource','sendStatus','error','stack','send','map','Campaign','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','length','create','body','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','createdAt','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','update','getHoppers','CmHopper','sort','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','ids','omit','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','deletedAt\x20IS\x20NULL','cm_contacts','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0xb515,0x195));var _0x5b51=function(_0x3e2489,_0x41d9dd){_0x3e2489=_0x3e2489-0x0;var _0x2254ce=_0xb515[_0x3e2489];return _0x2254ce;};'use strict';var pdf=require(_0x5b51('0x0'));var emlformat=require(_0x5b51('0x1'));var rimraf=require(_0x5b51('0x2'));var zipdir=require(_0x5b51('0x3'));var jsonpatch=require(_0x5b51('0x4'));var rp=require('request-promise');var moment=require(_0x5b51('0x5'));var BPromise=require(_0x5b51('0x6'));var Mustache=require('mustache');var util=require(_0x5b51('0x7'));var path=require(_0x5b51('0x8'));var sox=require('sox');var csv=require(_0x5b51('0x9'));var ejs=require(_0x5b51('0xa'));var fs=require('fs');var _=require(_0x5b51('0xb'));var squel=require('squel');var crypto=require(_0x5b51('0xc'));var jsforce=require(_0x5b51('0xd'));var deskjs=require(_0x5b51('0xe'));var toCsv=require(_0x5b51('0x9'));var querystring=require(_0x5b51('0xf'));var Papa=require('papaparse');var Redis=require(_0x5b51('0x10'));var authService=require(_0x5b51('0x11'));var qs=require(_0x5b51('0x12'));var as=require(_0x5b51('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b51('0x14'))(_0x5b51('0x15'));var utils=require(_0x5b51('0x16'));var config=require(_0x5b51('0x17'));var licenseUtil=require(_0x5b51('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4269e4,_0x1ef072){_0x1ef072=_0x1ef072||0xcc;return function(_0x54fc48){if(_0x54fc48){return _0x4269e4['sendStatus'](_0x1ef072);}return _0x4269e4['status'](_0x1ef072)[_0x5b51('0x19')]();};}function respondWithResult(_0x362146,_0x4294d4){_0x4294d4=_0x4294d4||0xc8;return function(_0x3dfd6a){if(_0x3dfd6a){return _0x362146[_0x5b51('0x1a')](_0x4294d4)['json'](_0x3dfd6a);}};}function respondWithFilteredResult(_0x521481,_0xbe613a){return function(_0x45aa98){if(_0x45aa98){var _0x1df894=_0x45aa98[_0x5b51('0x1b')],_0x52dcb0=_0xbe613a[_0x5b51('0x1c')],_0x5ea4e7=_0xbe613a[_0x5b51('0x1c')]+_0xbe613a['limit'],_0x391b61;if(_0x5ea4e7>=_0x1df894){_0x5ea4e7=_0x1df894;_0x391b61=0xc8;}else{_0x391b61=0xce;}_0x521481[_0x5b51('0x1a')](_0x391b61);return _0x521481[_0x5b51('0x1d')](_0x5b51('0x1e'),_0x52dcb0+'-'+_0x5ea4e7+'/'+_0x1df894)[_0x5b51('0x1f')](_0x45aa98);}return null;};}function patchUpdates(_0x2c1af2){return function(_0x57b183){try{jsonpatch[_0x5b51('0x20')](_0x57b183,_0x2c1af2,!![]);}catch(_0x26f0d8){return BPromise[_0x5b51('0x21')](_0x26f0d8);}return _0x57b183['save']();};}function saveUpdates(_0x433446,_0x35e799){return function(_0x20e65e){if(_0x20e65e){return _0x20e65e['update'](_0x433446)[_0x5b51('0x22')](function(_0x10484a){return _0x10484a;});}return null;};}function removeEntity(_0x208c58,_0x5309ae){return function(_0x272573){if(_0x272573){return _0x272573[_0x5b51('0x23')]()['then'](function(){var _0x26b9f6=_0x272573[_0x5b51('0x24')]({'plain':!![]});var _0x320dad=_0x5b51('0x25');return db[_0x5b51('0x26')][_0x5b51('0x23')]({'where':{'type':_0x320dad,'resourceId':_0x26b9f6['id']}})[_0x5b51('0x22')](function(){return _0x272573;});})[_0x5b51('0x22')](function(){_0x208c58[_0x5b51('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa5a494,_0x3c0f9c){return function(_0x44b06f){if(!_0x44b06f){_0xa5a494[_0x5b51('0x27')](0x194);}return _0x44b06f;};}function handleError(_0x307127,_0x180754){_0x180754=_0x180754||0x1f4;return function(_0x2c645c){logger[_0x5b51('0x28')](_0x2c645c[_0x5b51('0x29')]);if(_0x2c645c['name']){delete _0x2c645c['name'];}_0x307127['status'](_0x180754)[_0x5b51('0x2a')](_0x2c645c);};}exports['index']=function(_0x2991a7,_0x473d59){var _0x347d30={},_0x7ad155={},_0x53aa81={'count':0x0,'rows':[]};var _0x151acf=_[_0x5b51('0x2b')](db[_0x5b51('0x2c')][_0x5b51('0x2d')],function(_0xea5318){return{'name':_0xea5318[_0x5b51('0x2e')],'type':_0xea5318[_0x5b51('0x2f')][_0x5b51('0x30')]};});_0x7ad155[_0x5b51('0x31')]=_['map'](_0x151acf,_0x5b51('0x32'));_0x7ad155[_0x5b51('0x33')]=_[_0x5b51('0x34')](_0x2991a7[_0x5b51('0x33')]);_0x7ad155['filters']=_[_0x5b51('0x35')](_0x7ad155[_0x5b51('0x31')],_0x7ad155[_0x5b51('0x33')]);_0x347d30[_0x5b51('0x36')]=_['intersection'](_0x7ad155[_0x5b51('0x31')],qs[_0x5b51('0x37')](_0x2991a7[_0x5b51('0x33')]['fields']));_0x347d30[_0x5b51('0x36')]=_0x347d30['attributes']['length']?_0x347d30[_0x5b51('0x36')]:_0x7ad155[_0x5b51('0x31')];if(!_0x2991a7[_0x5b51('0x33')][_0x5b51('0x38')](_0x5b51('0x39'))){_0x347d30[_0x5b51('0x3a')]=qs[_0x5b51('0x3a')](_0x2991a7['query'][_0x5b51('0x3a')]);_0x347d30[_0x5b51('0x1c')]=qs[_0x5b51('0x1c')](_0x2991a7[_0x5b51('0x33')]['offset']);}_0x347d30[_0x5b51('0x3b')]=qs['sort'](_0x2991a7[_0x5b51('0x33')]['sort']);_0x347d30[_0x5b51('0x3c')]=qs[_0x5b51('0x3d')](_[_0x5b51('0x3e')](_0x2991a7['query'],_0x7ad155[_0x5b51('0x3d')]),_0x151acf);if(_0x2991a7[_0x5b51('0x33')]['filter']){_0x347d30['where']=_[_0x5b51('0x3f')](_0x347d30[_0x5b51('0x3c')],{'$or':_[_0x5b51('0x2b')](_0x151acf,function(_0x5e0209){if(_0x5e0209[_0x5b51('0x2f')]!==_0x5b51('0x40')){var _0x5972b7={};_0x5972b7[_0x5e0209[_0x5b51('0x32')]]={'$like':'%'+_0x2991a7['query'][_0x5b51('0x41')]+'%'};return _0x5972b7;}})});}_0x347d30=_[_0x5b51('0x3f')]({},_0x347d30,_0x2991a7[_0x5b51('0x42')]);var _0x5a62b7={'where':_0x347d30[_0x5b51('0x3c')]};return db['Campaign'][_0x5b51('0x1b')](_0x5a62b7)['then'](function(_0x5ea1cf){_0x53aa81[_0x5b51('0x1b')]=_0x5ea1cf;if(_0x2991a7[_0x5b51('0x33')][_0x5b51('0x43')]){_0x347d30[_0x5b51('0x44')]=[{'all':!![]}];}return db[_0x5b51('0x2c')]['findAll'](_0x347d30);})[_0x5b51('0x22')](function(_0x43416d){_0x53aa81[_0x5b51('0x45')]=_0x43416d;return _0x53aa81;})[_0x5b51('0x22')](respondWithFilteredResult(_0x473d59,_0x347d30))[_0x5b51('0x46')](handleError(_0x473d59,null));};exports[_0x5b51('0x47')]=function(_0x54b814,_0x15348b){var _0x5dec67={'raw':![],'where':{'id':_0x54b814[_0x5b51('0x48')]['id']}},_0x1ee42a={};_0x1ee42a[_0x5b51('0x31')]=_[_0x5b51('0x34')](db[_0x5b51('0x2c')][_0x5b51('0x2d')]);_0x1ee42a['query']=_[_0x5b51('0x34')](_0x54b814[_0x5b51('0x33')]);_0x1ee42a[_0x5b51('0x3d')]=_['intersection'](_0x1ee42a[_0x5b51('0x31')],_0x1ee42a['query']);_0x5dec67['attributes']=_[_0x5b51('0x35')](_0x1ee42a[_0x5b51('0x31')],qs[_0x5b51('0x37')](_0x54b814['query']['fields']));_0x5dec67[_0x5b51('0x36')]=_0x5dec67[_0x5b51('0x36')][_0x5b51('0x49')]?_0x5dec67[_0x5b51('0x36')]:_0x1ee42a[_0x5b51('0x31')];if(_0x54b814[_0x5b51('0x33')][_0x5b51('0x43')]){_0x5dec67['include']=[{'all':!![]}];}_0x5dec67=_[_0x5b51('0x3f')]({},_0x5dec67,_0x54b814[_0x5b51('0x42')]);return db[_0x5b51('0x2c')]['find'](_0x5dec67)['then'](handleEntityNotFound(_0x15348b,null))[_0x5b51('0x22')](respondWithResult(_0x15348b,null))[_0x5b51('0x46')](handleError(_0x15348b,null));};exports[_0x5b51('0x4a')]=function(_0x4218be,_0x48b9c5){return db[_0x5b51('0x2c')]['create'](_0x4218be[_0x5b51('0x4b')],{})[_0x5b51('0x22')](function(_0x3999e1){var _0x4a5c72=_0x4218be['user'][_0x5b51('0x24')]({'plain':!![]});if(!_0x4a5c72)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a5c72[_0x5b51('0x4c')]==='user'){var _0x229867=_0x3999e1['get']({'plain':!![]});var _0x41d4b1=_0x5b51('0x25');return db[_0x5b51('0x4d')]['find']({'where':{'name':_0x41d4b1,'userProfileId':_0x4a5c72['userProfileId']},'raw':!![]})[_0x5b51('0x22')](function(_0x380dc1){if(_0x380dc1&&_0x380dc1['autoAssociation']===0x0){return db[_0x5b51('0x26')]['create']({'name':_0x229867[_0x5b51('0x32')],'resourceId':_0x229867['id'],'type':_0x380dc1['name'],'sectionId':_0x380dc1['id']},{})[_0x5b51('0x22')](function(){return _0x3999e1;});}else{return _0x3999e1;}})[_0x5b51('0x46')](function(_0x79bb75){logger['error'](_0x5b51('0x4e'),_0x79bb75);throw _0x79bb75;});}return _0x3999e1;})[_0x5b51('0x22')](respondWithResult(_0x48b9c5,0xc9))[_0x5b51('0x46')](handleError(_0x48b9c5,null));};exports['clone']=function(_0x47b271,_0x43f516){var _0xb0bcc9={'where':{'id':_0x47b271['params']['id']}},_0x29f3d1={};_0x29f3d1[_0x5b51('0x31')]=_[_0x5b51('0x34')](db[_0x5b51('0x2c')][_0x5b51('0x2d')]);_0xb0bcc9[_0x5b51('0x36')]=_[_0x5b51('0x35')](_0x29f3d1[_0x5b51('0x31')],qs['fields'](_0x47b271[_0x5b51('0x33')]['fields']));_0xb0bcc9[_0x5b51('0x36')]=_0xb0bcc9['attributes'][_0x5b51('0x49')]?_0xb0bcc9[_0x5b51('0x36')]:_0x29f3d1['model'];if(_0x47b271['query'][_0x5b51('0x43')]){_0xb0bcc9['include']=[{'all':!![]}];}_0xb0bcc9=_[_0x5b51('0x3f')]({},_0xb0bcc9,_0x47b271[_0x5b51('0x42')]);return db[_0x5b51('0x2c')][_0x5b51('0x4f')](_0xb0bcc9)[_0x5b51('0x22')](handleEntityNotFound(_0x43f516,null))[_0x5b51('0x22')](function(_0x52f0f6){if(_0x52f0f6){var _0x5f409d=_0x52f0f6[_0x5b51('0x24')]({'plain':!![]});_0x5f409d=qs['omit'](_0x5f409d,['id',_0x5b51('0x50'),_0x5b51('0x51')]);_0x47b271[_0x5b51('0x4b')]=_['omit'](_0x47b271[_0x5b51('0x4b')],['id','createdAt','updatedAt']);return db[_0x5b51('0x2c')]['create'](_[_0x5b51('0x3f')](_0x5f409d,_0x47b271[_0x5b51('0x4b')]),{'include':_0x47b271[_0x5b51('0x33')][_0x5b51('0x43')]?[{'all':!![]}]:undefined})[_0x5b51('0x22')](function(_0x5bc84f){var _0x456b70=_0x47b271[_0x5b51('0x52')][_0x5b51('0x24')]({'plain':!![]});if(!_0x456b70)throw new Error(_0x5b51('0x53'));if(_0x456b70[_0x5b51('0x4c')]==='user'){var _0x1903ab=_0x5bc84f[_0x5b51('0x24')]({'plain':!![]});var _0x42af07=_0x5b51('0x25');return db['UserProfileSection'][_0x5b51('0x4f')]({'where':{'name':_0x42af07,'userProfileId':_0x456b70[_0x5b51('0x54')]},'raw':!![]})[_0x5b51('0x22')](function(_0x5c3664){if(_0x5c3664&&_0x5c3664[_0x5b51('0x55')]===0x0){return db[_0x5b51('0x26')][_0x5b51('0x4a')]({'name':_0x1903ab['name'],'resourceId':_0x1903ab['id'],'type':_0x5c3664[_0x5b51('0x32')],'sectionId':_0x5c3664['id']},{})[_0x5b51('0x22')](function(){return _0x5bc84f;});}else{return _0x5bc84f;}})[_0x5b51('0x46')](function(_0x1ddf61){logger[_0x5b51('0x28')](_0x5b51('0x4e'),_0x1ddf61);throw _0x1ddf61;});}return _0x5bc84f;});}})[_0x5b51('0x22')](respondWithResult(_0x43f516,0xc9))[_0x5b51('0x46')](handleError(_0x43f516,null));};exports[_0x5b51('0x56')]=function(_0x32290b,_0x7e1414){if(_0x32290b[_0x5b51('0x4b')]['id']){delete _0x32290b[_0x5b51('0x4b')]['id'];}return db[_0x5b51('0x2c')][_0x5b51('0x4f')]({'where':{'id':_0x32290b[_0x5b51('0x48')]['id']}})['then'](handleEntityNotFound(_0x7e1414,null))[_0x5b51('0x22')](saveUpdates(_0x32290b[_0x5b51('0x4b')],null))['then'](respondWithResult(_0x7e1414,null))[_0x5b51('0x46')](handleError(_0x7e1414,null));};exports[_0x5b51('0x23')]=function(_0x1b365e,_0x4f852d){return db[_0x5b51('0x2c')][_0x5b51('0x4f')]({'where':{'id':_0x1b365e[_0x5b51('0x48')]['id']}})[_0x5b51('0x22')](handleEntityNotFound(_0x4f852d,null))[_0x5b51('0x22')](removeEntity(_0x4f852d,null))[_0x5b51('0x46')](handleError(_0x4f852d,null));};exports[_0x5b51('0x57')]=function(_0xf551ec,_0x3b2275,_0x5a3b57){var _0x513944={'raw':!![],'where':{}};var _0x50692d={};var _0x382132={'count':0x0,'rows':[]};return db[_0x5b51('0x2c')]['findOne']({'where':{'id':_0xf551ec['params']['id']}})['then'](handleEntityNotFound(_0x3b2275,null))[_0x5b51('0x22')](function(_0x3abc39){if(_0x3abc39){_0x50692d[_0x5b51('0x31')]=_[_0x5b51('0x34')](db[_0x5b51('0x58')][_0x5b51('0x2d')]);_0x50692d[_0x5b51('0x33')]=_[_0x5b51('0x34')](_0xf551ec[_0x5b51('0x33')]);_0x50692d['filters']=_[_0x5b51('0x35')](_0x50692d[_0x5b51('0x31')],_0x50692d[_0x5b51('0x33')]);_0x513944[_0x5b51('0x36')]=_[_0x5b51('0x35')](_0x50692d[_0x5b51('0x31')],qs[_0x5b51('0x37')](_0xf551ec[_0x5b51('0x33')][_0x5b51('0x37')]));_0x513944['attributes']=_0x513944[_0x5b51('0x36')][_0x5b51('0x49')]?_0x513944[_0x5b51('0x36')]:_0x50692d[_0x5b51('0x31')];if(!_0xf551ec[_0x5b51('0x33')][_0x5b51('0x38')](_0x5b51('0x39'))){_0x513944[_0x5b51('0x3a')]=qs[_0x5b51('0x3a')](_0xf551ec[_0x5b51('0x33')]['limit']);_0x513944['offset']=qs['offset'](_0xf551ec['query'][_0x5b51('0x1c')]);}_0x513944[_0x5b51('0x3b')]=qs[_0x5b51('0x59')](_0xf551ec[_0x5b51('0x33')][_0x5b51('0x59')]);_0x513944[_0x5b51('0x3c')]=qs['filters'](_[_0x5b51('0x3e')](_0xf551ec[_0x5b51('0x33')],_0x50692d[_0x5b51('0x3d')]));_0x513944[_0x5b51('0x3c')][_0x5b51('0x5a')]=_0x3abc39['id'];if(_0xf551ec['query'][_0x5b51('0x41')]){_0x513944['where']=_[_0x5b51('0x3f')](_0x513944['where'],{'$or':_[_0x5b51('0x2b')](_0x513944['attributes'],function(_0x3aeb7b){var _0x66b8e={};_0x66b8e[_0x3aeb7b]={'$like':'%'+_0xf551ec[_0x5b51('0x33')][_0x5b51('0x41')]+'%'};return _0x66b8e;})});}_0x513944=_[_0x5b51('0x3f')]({},_0x513944,_0xf551ec[_0x5b51('0x42')]);return db['CmHopper'][_0x5b51('0x1b')]({'where':_0x513944[_0x5b51('0x3c')]})['then'](function(_0x2dec87){_0x382132[_0x5b51('0x1b')]=_0x2dec87;if(_0xf551ec[_0x5b51('0x33')][_0x5b51('0x43')]){_0x513944['include']=[{'all':!![]}];}return db[_0x5b51('0x58')][_0x5b51('0x5b')](_0x513944);})[_0x5b51('0x22')](function(_0x540fe5){_0x382132[_0x5b51('0x45')]=_0x540fe5;return _0x382132;});}})[_0x5b51('0x22')](respondWithFilteredResult(_0x3b2275,_0x513944))[_0x5b51('0x46')](handleError(_0x3b2275,null));};exports[_0x5b51('0x5c')]=function(_0x15ee36,_0x2c701d,_0x520cee){var _0x1f30a5={'raw':!![],'where':{}};var _0x350767={};var _0xd2394e={'count':0x0,'rows':[]};return db[_0x5b51('0x2c')]['findOne']({'where':{'id':_0x15ee36[_0x5b51('0x48')]['id']}})[_0x5b51('0x22')](handleEntityNotFound(_0x2c701d,null))[_0x5b51('0x22')](function(_0x3e6fc3){if(_0x3e6fc3){_0x350767[_0x5b51('0x31')]=_[_0x5b51('0x34')](db[_0x5b51('0x5d')][_0x5b51('0x2d')]);_0x350767[_0x5b51('0x33')]=_[_0x5b51('0x34')](_0x15ee36[_0x5b51('0x33')]);_0x350767[_0x5b51('0x3d')]=_[_0x5b51('0x35')](_0x350767[_0x5b51('0x31')],_0x350767[_0x5b51('0x33')]);_0x1f30a5['attributes']=_[_0x5b51('0x35')](_0x350767[_0x5b51('0x31')],qs[_0x5b51('0x37')](_0x15ee36[_0x5b51('0x33')]['fields']));_0x1f30a5[_0x5b51('0x36')]=_0x1f30a5[_0x5b51('0x36')][_0x5b51('0x49')]?_0x1f30a5[_0x5b51('0x36')]:_0x350767['model'];if(!_0x15ee36[_0x5b51('0x33')][_0x5b51('0x38')](_0x5b51('0x39'))){_0x1f30a5['limit']=qs[_0x5b51('0x3a')](_0x15ee36[_0x5b51('0x33')][_0x5b51('0x3a')]);_0x1f30a5[_0x5b51('0x1c')]=qs[_0x5b51('0x1c')](_0x15ee36['query'][_0x5b51('0x1c')]);}_0x1f30a5[_0x5b51('0x3b')]=qs[_0x5b51('0x59')](_0x15ee36['query'][_0x5b51('0x59')]);_0x1f30a5['where']=qs[_0x5b51('0x3d')](_[_0x5b51('0x3e')](_0x15ee36[_0x5b51('0x33')],_0x350767['filters']));_0x1f30a5['where'][_0x5b51('0x5a')]=_0x3e6fc3['id'];if(_0x15ee36[_0x5b51('0x33')][_0x5b51('0x41')]){_0x1f30a5['where']=_[_0x5b51('0x3f')](_0x1f30a5[_0x5b51('0x3c')],{'$or':_[_0x5b51('0x2b')](_0x1f30a5[_0x5b51('0x36')],function(_0x5ba971){var _0x43572a={};_0x43572a[_0x5ba971]={'$like':'%'+_0x15ee36['query'][_0x5b51('0x41')]+'%'};return _0x43572a;})});}_0x1f30a5=_[_0x5b51('0x3f')]({},_0x1f30a5,_0x15ee36[_0x5b51('0x42')]);return db[_0x5b51('0x5d')]['count']({'where':_0x1f30a5[_0x5b51('0x3c')]})[_0x5b51('0x22')](function(_0x5a631c){_0xd2394e[_0x5b51('0x1b')]=_0x5a631c;if(_0x15ee36['query']['includeAll']){_0x1f30a5['include']=[{'all':!![]}];}return db[_0x5b51('0x5d')][_0x5b51('0x5b')](_0x1f30a5);})[_0x5b51('0x22')](function(_0x3a408a){_0xd2394e[_0x5b51('0x45')]=_0x3a408a;return _0xd2394e;});}})[_0x5b51('0x22')](respondWithFilteredResult(_0x2c701d,_0x1f30a5))[_0x5b51('0x46')](handleError(_0x2c701d,null));};exports[_0x5b51('0x5e')]=function(_0x547b75,_0x5e5e60,_0x356fb9){var _0x2c84a2={'raw':!![],'where':{}};var _0x27e77b={};var _0x436ff7={'count':0x0,'rows':[]};return db[_0x5b51('0x2c')][_0x5b51('0x5f')]({'where':{'id':_0x547b75[_0x5b51('0x48')]['id']}})[_0x5b51('0x22')](handleEntityNotFound(_0x5e5e60,null))[_0x5b51('0x22')](function(_0x5d486b){if(_0x5d486b){_0x27e77b['model']=_[_0x5b51('0x34')](db[_0x5b51('0x60')][_0x5b51('0x2d')]);_0x27e77b[_0x5b51('0x33')]=_['keys'](_0x547b75['query']);_0x27e77b[_0x5b51('0x3d')]=_[_0x5b51('0x35')](_0x27e77b['model'],_0x27e77b[_0x5b51('0x33')]);_0x2c84a2[_0x5b51('0x36')]=_[_0x5b51('0x35')](_0x27e77b[_0x5b51('0x31')],qs['fields'](_0x547b75[_0x5b51('0x33')]['fields']));_0x2c84a2[_0x5b51('0x36')]=_0x2c84a2['attributes']['length']?_0x2c84a2[_0x5b51('0x36')]:_0x27e77b[_0x5b51('0x31')];if(!_0x547b75['query'][_0x5b51('0x38')](_0x5b51('0x39'))){_0x2c84a2[_0x5b51('0x3a')]=qs['limit'](_0x547b75['query'][_0x5b51('0x3a')]);_0x2c84a2[_0x5b51('0x1c')]=qs[_0x5b51('0x1c')](_0x547b75[_0x5b51('0x33')]['offset']);}_0x2c84a2[_0x5b51('0x3b')]=qs['sort'](_0x547b75[_0x5b51('0x33')][_0x5b51('0x59')]);_0x2c84a2[_0x5b51('0x3c')]=qs[_0x5b51('0x3d')](_[_0x5b51('0x3e')](_0x547b75[_0x5b51('0x33')],_0x27e77b[_0x5b51('0x3d')]));_0x2c84a2[_0x5b51('0x3c')][_0x5b51('0x5a')]=_0x5d486b['id'];if(_0x547b75[_0x5b51('0x33')][_0x5b51('0x41')]){_0x2c84a2[_0x5b51('0x3c')]=_[_0x5b51('0x3f')](_0x2c84a2['where'],{'$or':_[_0x5b51('0x2b')](_0x2c84a2[_0x5b51('0x36')],function(_0x2443f5){var _0x29820e={};_0x29820e[_0x2443f5]={'$like':'%'+_0x547b75[_0x5b51('0x33')]['filter']+'%'};return _0x29820e;})});}_0x2c84a2=_[_0x5b51('0x3f')]({},_0x2c84a2,_0x547b75[_0x5b51('0x42')]);return db[_0x5b51('0x60')][_0x5b51('0x1b')]({'where':_0x2c84a2[_0x5b51('0x3c')]})['then'](function(_0x2e3b81){_0x436ff7[_0x5b51('0x1b')]=_0x2e3b81;if(_0x547b75[_0x5b51('0x33')][_0x5b51('0x43')]){_0x2c84a2[_0x5b51('0x44')]=[{'all':!![]}];}return db[_0x5b51('0x60')][_0x5b51('0x5b')](_0x2c84a2);})[_0x5b51('0x22')](function(_0x177828){_0x436ff7[_0x5b51('0x45')]=_0x177828;return _0x436ff7;});}})[_0x5b51('0x22')](respondWithFilteredResult(_0x5e5e60,_0x2c84a2))[_0x5b51('0x46')](handleError(_0x5e5e60,null));};exports[_0x5b51('0x61')]=function(_0x142046,_0x8d77f3,_0x41154c){var _0xbe74ad={'raw':!![],'where':{}};var _0x1e840d={};var _0x56379d={'count':0x0,'rows':[]};return db[_0x5b51('0x2c')][_0x5b51('0x5f')]({'where':{'id':_0x142046[_0x5b51('0x48')]['id']}})[_0x5b51('0x22')](handleEntityNotFound(_0x8d77f3,null))['then'](function(_0x2828d9){if(_0x2828d9){_0x1e840d[_0x5b51('0x31')]=_[_0x5b51('0x34')](db[_0x5b51('0x62')][_0x5b51('0x2d')]);_0x1e840d[_0x5b51('0x33')]=_[_0x5b51('0x34')](_0x142046[_0x5b51('0x33')]);_0x1e840d[_0x5b51('0x3d')]=_[_0x5b51('0x35')](_0x1e840d[_0x5b51('0x31')],_0x1e840d[_0x5b51('0x33')]);_0xbe74ad[_0x5b51('0x36')]=_[_0x5b51('0x35')](_0x1e840d[_0x5b51('0x31')],qs[_0x5b51('0x37')](_0x142046['query']['fields']));_0xbe74ad['attributes']=_0xbe74ad[_0x5b51('0x36')][_0x5b51('0x49')]?_0xbe74ad[_0x5b51('0x36')]:_0x1e840d['model'];if(!_0x142046[_0x5b51('0x33')][_0x5b51('0x38')](_0x5b51('0x39'))){_0xbe74ad['limit']=qs['limit'](_0x142046[_0x5b51('0x33')][_0x5b51('0x3a')]);_0xbe74ad['offset']=qs[_0x5b51('0x1c')](_0x142046[_0x5b51('0x33')][_0x5b51('0x1c')]);}_0xbe74ad[_0x5b51('0x3b')]=qs['sort'](_0x142046[_0x5b51('0x33')][_0x5b51('0x59')]);_0xbe74ad[_0x5b51('0x3c')]=qs[_0x5b51('0x3d')](_['pick'](_0x142046[_0x5b51('0x33')],_0x1e840d[_0x5b51('0x3d')]));_0xbe74ad[_0x5b51('0x3c')][_0x5b51('0x5a')]=_0x2828d9['id'];if(_0x142046['query'][_0x5b51('0x41')]){_0xbe74ad[_0x5b51('0x3c')]=_[_0x5b51('0x3f')](_0xbe74ad[_0x5b51('0x3c')],{'$or':_[_0x5b51('0x2b')](_0xbe74ad['attributes'],function(_0x9a4d0e){var _0x13742e={};_0x13742e[_0x9a4d0e]={'$like':'%'+_0x142046[_0x5b51('0x33')][_0x5b51('0x41')]+'%'};return _0x13742e;})});}_0xbe74ad=_[_0x5b51('0x3f')]({},_0xbe74ad,_0x142046['options']);return db[_0x5b51('0x62')][_0x5b51('0x1b')]({'where':_0xbe74ad[_0x5b51('0x3c')]})['then'](function(_0x1b97b4){_0x56379d[_0x5b51('0x1b')]=_0x1b97b4;if(_0x142046[_0x5b51('0x33')][_0x5b51('0x43')]){_0xbe74ad[_0x5b51('0x44')]=[{'all':!![]}];}return db[_0x5b51('0x62')]['findAll'](_0xbe74ad);})['then'](function(_0x22175e){_0x56379d[_0x5b51('0x45')]=_0x22175e;return _0x56379d;});}})[_0x5b51('0x22')](respondWithFilteredResult(_0x8d77f3,_0xbe74ad))[_0x5b51('0x46')](handleError(_0x8d77f3,null));};exports['getLists']=function(_0x4ee793,_0x29878a,_0x5b487e){var _0xfde6a6={};var _0x2c93b6={};var _0x901484;var _0x734184;return db['Campaign'][_0x5b51('0x5f')]({'where':{'id':_0x4ee793[_0x5b51('0x48')]['id']}})[_0x5b51('0x22')](handleEntityNotFound(_0x29878a,null))[_0x5b51('0x22')](function(_0x306f9a){if(_0x306f9a){_0x901484=_0x306f9a;_0x2c93b6['model']=_[_0x5b51('0x34')](db[_0x5b51('0x63')][_0x5b51('0x2d')]);_0x2c93b6[_0x5b51('0x33')]=_[_0x5b51('0x34')](_0x4ee793[_0x5b51('0x33')]);_0x2c93b6[_0x5b51('0x3d')]=_['intersection'](_0x2c93b6['model'],_0x2c93b6[_0x5b51('0x33')]);_0xfde6a6[_0x5b51('0x36')]=_['intersection'](_0x2c93b6[_0x5b51('0x31')],qs[_0x5b51('0x37')](_0x4ee793[_0x5b51('0x33')][_0x5b51('0x37')]));_0xfde6a6[_0x5b51('0x36')]=_0xfde6a6[_0x5b51('0x36')][_0x5b51('0x49')]?_0xfde6a6['attributes']:_0x2c93b6[_0x5b51('0x31')];_0xfde6a6[_0x5b51('0x3b')]=qs[_0x5b51('0x59')](_0x4ee793[_0x5b51('0x33')]['sort']);_0xfde6a6[_0x5b51('0x3c')]=qs['filters'](_[_0x5b51('0x3e')](_0x4ee793[_0x5b51('0x33')],_0x2c93b6[_0x5b51('0x3d')]));if(_0x4ee793['query'][_0x5b51('0x41')]){_0xfde6a6['where']=_['merge'](_0xfde6a6[_0x5b51('0x3c')],{'$or':_[_0x5b51('0x2b')](_0xfde6a6[_0x5b51('0x36')],function(_0x4c405b){var _0x88ccbd={};_0x88ccbd[_0x4c405b]={'$like':'%'+_0x4ee793[_0x5b51('0x33')]['filter']+'%'};return _0x88ccbd;})});}_0xfde6a6=_[_0x5b51('0x3f')]({},_0xfde6a6,_0x4ee793[_0x5b51('0x42')]);return _0x901484[_0x5b51('0x64')](_0xfde6a6);}})['then'](function(_0x6a3d64){if(_0x6a3d64){_0x734184=_0x6a3d64['length'];if(!_0x4ee793[_0x5b51('0x33')][_0x5b51('0x38')](_0x5b51('0x39'))){_0xfde6a6[_0x5b51('0x3a')]=qs[_0x5b51('0x3a')](_0x4ee793[_0x5b51('0x33')][_0x5b51('0x3a')]);_0xfde6a6['offset']=qs[_0x5b51('0x1c')](_0x4ee793['query']['offset']);}return _0x901484['getLists'](_0xfde6a6);}})[_0x5b51('0x22')](function(_0x215b43){if(_0x215b43){return _0x215b43?{'count':_0x734184,'rows':_0x215b43}:null;}})[_0x5b51('0x22')](respondWithResult(_0x29878a,null))['catch'](handleError(_0x29878a,null));};exports['addLists']=function(_0x3493ee,_0x292a0d,_0x3898ce){var _0x2cd845,_0x525662;return db[_0x5b51('0x2c')][_0x5b51('0x4f')]({'where':{'id':_0x3493ee[_0x5b51('0x48')]['id']}})[_0x5b51('0x22')](handleEntityNotFound(_0x292a0d,null))[_0x5b51('0x22')](function(_0x15a8af){if(_0x15a8af){_0x525662=_0x15a8af;return _0x15a8af['addLists'](_0x3493ee[_0x5b51('0x4b')][_0x5b51('0x65')],_[_0x5b51('0x66')](_0x3493ee[_0x5b51('0x4b')],[_0x5b51('0x65'),'id'])||{});}return null;})[_0x5b51('0x67')](function(_0x54f338){var _0x4f10b8;_0x2cd845=_0x54f338||[];var _0x474259=[];if(_0x54f338){for(var _0xae7be6=0x0;_0xae7be6<_0x54f338[_0x5b51('0x49')];_0xae7be6+=0x1){var _0x47764b=_0x54f338[_0xae7be6]['get']({'plain':!![]});_0x525662[_0x5b51('0x68')]=_0x3493ee[_0x5b51('0x4b')][_0x5b51('0x68')]?_0x3493ee[_0x5b51('0x4b')][_0x5b51('0x68')]:_0x525662['dialCheckDuplicateType'];switch(_0x525662[_0x5b51('0x68')]){case _0x5b51('0x69'):_0x4f10b8=squel[_0x5b51('0x6a')]()[_0x5b51('0x6b')]('cm_hopper')[_0x5b51('0x6c')]([_0x5b51('0x6d'),_0x5b51('0x6e'),_0x5b51('0x6f'),_0x5b51('0x70'),'CampaignId','createdAt',_0x5b51('0x51')],squel[_0x5b51('0x71')]()['field']('phone',_0x5b51('0x6d'))[_0x5b51('0x72')](_0x5b51('0x73'),_0x5b51('0x6e'))[_0x5b51('0x72')]('id',_0x5b51('0x6f'))['field'](_0x47764b[_0x5b51('0x74')]['toString'](),'ListId')[_0x5b51('0x72')](_0x3493ee[_0x5b51('0x48')]['id'][_0x5b51('0x75')](),_0x5b51('0x5a'))['field'](_0x5b51('0x73'),_0x5b51('0x50'))['field']('NOW()',_0x5b51('0x51'))['from']('cm_contacts')[_0x5b51('0x3c')]('deletedAt\x20IS\x20NULL')['where'](_0x5b51('0x76'),_0x47764b[_0x5b51('0x74')][_0x5b51('0x75')]())['where'](_0x5b51('0x77'))[_0x5b51('0x3c')](_0x5b51('0x78'),squel[_0x5b51('0x71')]()[_0x5b51('0x72')]('COALESCE(calleridnum,\x27\x27)')[_0x5b51('0x79')](_0x5b51('0x7a'))[_0x5b51('0x3c')](_0x5b51('0x7b'),_0x3493ee[_0x5b51('0x48')]['id'][_0x5b51('0x75')]()))[_0x5b51('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x5b51('0x71')]()[_0x5b51('0x72')](_0x5b51('0x7c'))[_0x5b51('0x79')](_0x5b51('0x7d'))[_0x5b51('0x3c')](_0x5b51('0x7b'),_0x3493ee[_0x5b51('0x48')]['id'][_0x5b51('0x75')]())))[_0x5b51('0x75')]();break;case _0x5b51('0x7e'):_0x4f10b8=squel[_0x5b51('0x6a')]()[_0x5b51('0x6b')](_0x5b51('0x7d'))[_0x5b51('0x6c')](['phone',_0x5b51('0x6e'),_0x5b51('0x6f'),_0x5b51('0x70'),_0x5b51('0x5a'),_0x5b51('0x50'),_0x5b51('0x51')],squel[_0x5b51('0x71')]()[_0x5b51('0x72')]('phone',_0x5b51('0x6d'))['field'](_0x5b51('0x73'),'scheduledAt')[_0x5b51('0x72')]('id',_0x5b51('0x6f'))[_0x5b51('0x72')](_0x47764b['CmListId']['toString'](),_0x5b51('0x70'))[_0x5b51('0x72')](_0x3493ee[_0x5b51('0x48')]['id'][_0x5b51('0x75')](),_0x5b51('0x5a'))[_0x5b51('0x72')](_0x5b51('0x73'),'createdAt')[_0x5b51('0x72')](_0x5b51('0x73'),_0x5b51('0x51'))[_0x5b51('0x79')]('cm_contacts')[_0x5b51('0x3c')](_0x5b51('0x7f'))[_0x5b51('0x3c')]('ListId\x20=\x20?',_0x47764b['CmListId']['toString']())[_0x5b51('0x3c')](_0x5b51('0x77'))[_0x5b51('0x3c')](_0x5b51('0x78'),squel[_0x5b51('0x71')]()['field']('COALESCE(phone,\x27\x27)')[_0x5b51('0x79')]('cm_hopper')[_0x5b51('0x3c')]('CampaignId\x20=\x20?',_0x3493ee['params']['id'][_0x5b51('0x75')]())))[_0x5b51('0x75')]();break;default:_0x4f10b8=squel['insert']()[_0x5b51('0x6b')](_0x5b51('0x7d'))[_0x5b51('0x6c')]([_0x5b51('0x6d'),_0x5b51('0x6e'),_0x5b51('0x6f'),_0x5b51('0x70'),_0x5b51('0x5a'),_0x5b51('0x50'),_0x5b51('0x51')],squel['select']()[_0x5b51('0x72')](_0x5b51('0x6d'),_0x5b51('0x6d'))[_0x5b51('0x72')](_0x5b51('0x73'),_0x5b51('0x6e'))[_0x5b51('0x72')]('id',_0x5b51('0x6f'))[_0x5b51('0x72')](_0x47764b[_0x5b51('0x74')]['toString'](),_0x5b51('0x70'))[_0x5b51('0x72')](_0x3493ee[_0x5b51('0x48')]['id'][_0x5b51('0x75')](),_0x5b51('0x5a'))[_0x5b51('0x72')](_0x5b51('0x73'),_0x5b51('0x50'))['field']('NOW()',_0x5b51('0x51'))['from'](_0x5b51('0x80'))[_0x5b51('0x3c')](_0x5b51('0x7f'))['where'](_0x5b51('0x76'),_0x47764b[_0x5b51('0x74')][_0x5b51('0x75')]())['where'](_0x5b51('0x77')))[_0x5b51('0x75')]();}_0x474259[_0x5b51('0x81')](db[_0x5b51('0x82')][_0x5b51('0x33')](_0x4f10b8));}return BPromise[_0x5b51('0x83')](_0x474259);}})['then'](function(){return _0x2cd845;})[_0x5b51('0x22')](respondWithResult(_0x292a0d,null))['catch'](handleError(_0x292a0d,null));};exports['removeLists']=function(_0x152dd0,_0x22a2af,_0x2dc8ae){return db[_0x5b51('0x2c')][_0x5b51('0x4f')]({'where':{'id':_0x152dd0[_0x5b51('0x48')]['id']}})[_0x5b51('0x22')](handleEntityNotFound(_0x22a2af,null))[_0x5b51('0x22')](function(_0x1e7b2a){if(_0x1e7b2a){return _0x1e7b2a[_0x5b51('0x84')](_0x152dd0['query'][_0x5b51('0x65')]);}})['then'](function(_0x3ad403){if(_0x3ad403){return db[_0x5b51('0x58')][_0x5b51('0x23')]({'where':{'ListId':_0x152dd0[_0x5b51('0x33')]['ids'],'CampaignId':_0x152dd0[_0x5b51('0x48')]['id']}})['then'](function(){return _0x3ad403;});}})['then'](respondWithStatusCode(_0x22a2af,null))[_0x5b51('0x46')](handleError(_0x22a2af,null));};exports[_0x5b51('0x85')]=function(_0x5e2302,_0x403db8,_0x4b72fc){var _0x5b11d7={};var _0x32c422={};var _0x583484;var _0x566bfd;return db[_0x5b51('0x2c')][_0x5b51('0x5f')]({'where':{'id':_0x5e2302[_0x5b51('0x48')]['id']}})['then'](handleEntityNotFound(_0x403db8,null))['then'](function(_0x2d0e68){if(_0x2d0e68){_0x583484=_0x2d0e68;_0x32c422[_0x5b51('0x31')]=_[_0x5b51('0x34')](db['CmList'][_0x5b51('0x2d')]);_0x32c422[_0x5b51('0x33')]=_[_0x5b51('0x34')](_0x5e2302['query']);_0x32c422[_0x5b51('0x3d')]=_['intersection'](_0x32c422[_0x5b51('0x31')],_0x32c422[_0x5b51('0x33')]);_0x5b11d7[_0x5b51('0x36')]=_['intersection'](_0x32c422['model'],qs[_0x5b51('0x37')](_0x5e2302['query'][_0x5b51('0x37')]));_0x5b11d7[_0x5b51('0x36')]=_0x5b11d7[_0x5b51('0x36')]['length']?_0x5b11d7[_0x5b51('0x36')]:_0x32c422['model'];_0x5b11d7[_0x5b51('0x3b')]=qs['sort'](_0x5e2302[_0x5b51('0x33')]['sort']);_0x5b11d7[_0x5b51('0x3c')]=qs[_0x5b51('0x3d')](_[_0x5b51('0x3e')](_0x5e2302[_0x5b51('0x33')],_0x32c422[_0x5b51('0x3d')]));if(_0x5e2302[_0x5b51('0x33')][_0x5b51('0x41')]){_0x5b11d7[_0x5b51('0x3c')]=_[_0x5b51('0x3f')](_0x5b11d7[_0x5b51('0x3c')],{'$or':_[_0x5b51('0x2b')](_0x5b11d7[_0x5b51('0x36')],function(_0x32c29a){var _0x14a1e9={};_0x14a1e9[_0x32c29a]={'$like':'%'+_0x5e2302[_0x5b51('0x33')][_0x5b51('0x41')]+'%'};return _0x14a1e9;})});}_0x5b11d7=_['merge']({},_0x5b11d7,_0x5e2302['options']);return _0x583484[_0x5b51('0x85')](_0x5b11d7);}})[_0x5b51('0x22')](function(_0x187046){if(_0x187046){_0x566bfd=_0x187046[_0x5b51('0x49')];if(!_0x5e2302[_0x5b51('0x33')][_0x5b51('0x38')](_0x5b51('0x39'))){_0x5b11d7[_0x5b51('0x3a')]=qs[_0x5b51('0x3a')](_0x5e2302[_0x5b51('0x33')][_0x5b51('0x3a')]);_0x5b11d7['offset']=qs[_0x5b51('0x1c')](_0x5e2302[_0x5b51('0x33')][_0x5b51('0x1c')]);}return _0x583484[_0x5b51('0x85')](_0x5b11d7);}})['then'](function(_0x35bef8){if(_0x35bef8){return _0x35bef8?{'count':_0x566bfd,'rows':_0x35bef8}:null;}})[_0x5b51('0x22')](respondWithResult(_0x403db8,null))[_0x5b51('0x46')](handleError(_0x403db8,null));};exports['addBlackLists']=function(_0x3a2507,_0x6cc5bd,_0xb1e217){var _0x54f47f,_0x59e48d;return db['Campaign'][_0x5b51('0x4f')]({'where':{'id':_0x3a2507[_0x5b51('0x48')]['id']}})[_0x5b51('0x22')](handleEntityNotFound(_0x6cc5bd,null))[_0x5b51('0x22')](function(_0x65a387){if(_0x65a387){_0x59e48d=_0x65a387;return _0x65a387[_0x5b51('0x86')](_0x3a2507[_0x5b51('0x4b')][_0x5b51('0x65')],_[_0x5b51('0x66')](_0x3a2507[_0x5b51('0x4b')],[_0x5b51('0x65'),'id'])||{});}return null;})[_0x5b51('0x67')](function(_0x2e235f){var _0x2b3116;_0x54f47f=_0x2e235f||[];var _0x56fa7d=[];if(_0x2e235f){for(var _0x4af46a=0x0;_0x4af46a<_0x2e235f[_0x5b51('0x49')];_0x4af46a+=0x1){var _0x1da33=_0x2e235f[_0x4af46a][_0x5b51('0x24')]({'plain':!![]});_0x2b3116=squel[_0x5b51('0x6a')]()[_0x5b51('0x6b')](_0x5b51('0x87'))[_0x5b51('0x6c')]([_0x5b51('0x6d'),_0x5b51('0x6f'),_0x5b51('0x70'),_0x5b51('0x5a'),'createdAt',_0x5b51('0x51')],squel['select']()[_0x5b51('0x72')](_0x5b51('0x6d'),_0x5b51('0x6d'))[_0x5b51('0x72')]('id',_0x5b51('0x6f'))['field'](_0x1da33[_0x5b51('0x74')][_0x5b51('0x75')](),_0x5b51('0x70'))['field'](_0x3a2507[_0x5b51('0x48')]['id'][_0x5b51('0x75')](),'CampaignId')[_0x5b51('0x72')](_0x5b51('0x73'),_0x5b51('0x50'))['field'](_0x5b51('0x73'),_0x5b51('0x51'))[_0x5b51('0x79')](_0x5b51('0x80'))[_0x5b51('0x3c')](_0x5b51('0x7f'))[_0x5b51('0x3c')](_0x5b51('0x76'),_0x1da33[_0x5b51('0x74')][_0x5b51('0x75')]())[_0x5b51('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0x5b51('0x75')]();_0x56fa7d[_0x5b51('0x81')](db[_0x5b51('0x82')][_0x5b51('0x33')](_0x2b3116));}return BPromise[_0x5b51('0x83')](_0x56fa7d);}})[_0x5b51('0x22')](function(){return _0x54f47f;})[_0x5b51('0x22')](respondWithResult(_0x6cc5bd,null))[_0x5b51('0x46')](handleError(_0x6cc5bd,null));};exports['removeBlackLists']=function(_0x25e748,_0xca6a8d,_0x4f49ab){return db[_0x5b51('0x2c')][_0x5b51('0x4f')]({'where':{'id':_0x25e748[_0x5b51('0x48')]['id']}})['then'](handleEntityNotFound(_0xca6a8d,null))['then'](function(_0x41c1d8){if(_0x41c1d8){return _0x41c1d8[_0x5b51('0x88')](_0x25e748[_0x5b51('0x33')][_0x5b51('0x65')]);}})['then'](function(_0x170984){if(_0x170984){return db[_0x5b51('0x62')][_0x5b51('0x23')]({'where':{'ListId':_0x25e748[_0x5b51('0x33')][_0x5b51('0x65')],'CampaignId':_0x25e748['params']['id']}})[_0x5b51('0x22')](function(){return _0x170984;});}})[_0x5b51('0x22')](respondWithStatusCode(_0xca6a8d,null))[_0x5b51('0x46')](handleError(_0xca6a8d,null));}; \ No newline at end of file +var _0x8a26=['ContactId','CmListId','ListId','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','select','COALESCE(phone,\x27\x27)','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','sox','to-csv','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../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','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','error','Campaign','fieldName','type','key','map','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','clone','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','order','getHopperFinals','CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','field'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x8a26,0x1a8));var _0x68a2=function(_0x46cb3e,_0x38eb6f){_0x46cb3e=_0x46cb3e-0x0;var _0x2a19b5=_0x8a26[_0x46cb3e];return _0x2a19b5;};'use strict';var pdf=require(_0x68a2('0x0'));var emlformat=require(_0x68a2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x68a2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x68a2('0x3'));var moment=require(_0x68a2('0x4'));var BPromise=require(_0x68a2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x68a2('0x6'));var csv=require(_0x68a2('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x68a2('0x8'));var deskjs=require(_0x68a2('0x9'));var toCsv=require(_0x68a2('0x7'));var querystring=require(_0x68a2('0xa'));var Papa=require(_0x68a2('0xb'));var Redis=require(_0x68a2('0xc'));var authService=require(_0x68a2('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x68a2('0xe'));var hardwareService=require(_0x68a2('0xf'));var logger=require(_0x68a2('0x10'))('api');var utils=require(_0x68a2('0x11'));var config=require(_0x68a2('0x12'));var licenseUtil=require(_0x68a2('0x13'));var db=require(_0x68a2('0x14'))['db'];function respondWithStatusCode(_0x235d8b,_0x81ca02){_0x81ca02=_0x81ca02||0xcc;return function(_0x395888){if(_0x395888){return _0x235d8b[_0x68a2('0x15')](_0x81ca02);}return _0x235d8b[_0x68a2('0x16')](_0x81ca02)[_0x68a2('0x17')]();};}function respondWithResult(_0x184e94,_0x1037c3){_0x1037c3=_0x1037c3||0xc8;return function(_0x413312){if(_0x413312){return _0x184e94[_0x68a2('0x16')](_0x1037c3)[_0x68a2('0x18')](_0x413312);}};}function respondWithFilteredResult(_0x40e7b2,_0x4d7925){return function(_0x371fb5){if(_0x371fb5){var _0xac0079=_0x371fb5[_0x68a2('0x19')],_0x25640c=_0x4d7925['offset'],_0x481da5=_0x4d7925[_0x68a2('0x1a')]+_0x4d7925[_0x68a2('0x1b')],_0x22a1f6;if(_0x481da5>=_0xac0079){_0x481da5=_0xac0079;_0x22a1f6=0xc8;}else{_0x22a1f6=0xce;}_0x40e7b2[_0x68a2('0x16')](_0x22a1f6);return _0x40e7b2[_0x68a2('0x1c')](_0x68a2('0x1d'),_0x25640c+'-'+_0x481da5+'/'+_0xac0079)[_0x68a2('0x18')](_0x371fb5);}return null;};}function patchUpdates(_0x17c125){return function(_0x3a8293){try{jsonpatch[_0x68a2('0x1e')](_0x3a8293,_0x17c125,!![]);}catch(_0x21eb38){return BPromise[_0x68a2('0x1f')](_0x21eb38);}return _0x3a8293[_0x68a2('0x20')]();};}function saveUpdates(_0x1cd6ce,_0x84aeb8){return function(_0x3b8cc7){if(_0x3b8cc7){return _0x3b8cc7[_0x68a2('0x21')](_0x1cd6ce)['then'](function(_0x5369d5){return _0x5369d5;});}return null;};}function removeEntity(_0x2f5bcd,_0xcbd25d){return function(_0x211ceb){if(_0x211ceb){return _0x211ceb['destroy']()[_0x68a2('0x22')](function(){var _0x1404fe=_0x211ceb[_0x68a2('0x23')]({'plain':!![]});var _0x536d5e=_0x68a2('0x24');return db[_0x68a2('0x25')][_0x68a2('0x26')]({'where':{'type':_0x536d5e,'resourceId':_0x1404fe['id']}})['then'](function(){return _0x211ceb;});})['then'](function(){_0x2f5bcd[_0x68a2('0x16')](0xcc)[_0x68a2('0x17')]();});}};}function handleEntityNotFound(_0x3dccf1,_0x48bba4){return function(_0xcb9187){if(!_0xcb9187){_0x3dccf1[_0x68a2('0x15')](0x194);}return _0xcb9187;};}function handleError(_0x225953,_0x33e4b7){_0x33e4b7=_0x33e4b7||0x1f4;return function(_0x41598f){logger[_0x68a2('0x27')](_0x41598f['stack']);if(_0x41598f['name']){delete _0x41598f['name'];}_0x225953[_0x68a2('0x16')](_0x33e4b7)['send'](_0x41598f);};}exports['index']=function(_0x56167e,_0x2143b1){var _0x155a9d={},_0x187ea3={},_0x613b40={'count':0x0,'rows':[]};var _0x421dc1=_['map'](db[_0x68a2('0x28')]['rawAttributes'],function(_0x12de69){return{'name':_0x12de69[_0x68a2('0x29')],'type':_0x12de69[_0x68a2('0x2a')][_0x68a2('0x2b')]};});_0x187ea3['model']=_[_0x68a2('0x2c')](_0x421dc1,_0x68a2('0x2d'));_0x187ea3[_0x68a2('0x2e')]=_[_0x68a2('0x2f')](_0x56167e[_0x68a2('0x2e')]);_0x187ea3[_0x68a2('0x30')]=_[_0x68a2('0x31')](_0x187ea3[_0x68a2('0x32')],_0x187ea3[_0x68a2('0x2e')]);_0x155a9d['attributes']=_[_0x68a2('0x31')](_0x187ea3[_0x68a2('0x32')],qs[_0x68a2('0x33')](_0x56167e[_0x68a2('0x2e')][_0x68a2('0x33')]));_0x155a9d['attributes']=_0x155a9d[_0x68a2('0x34')][_0x68a2('0x35')]?_0x155a9d['attributes']:_0x187ea3[_0x68a2('0x32')];if(!_0x56167e[_0x68a2('0x2e')][_0x68a2('0x36')]('nolimit')){_0x155a9d[_0x68a2('0x1b')]=qs['limit'](_0x56167e['query'][_0x68a2('0x1b')]);_0x155a9d[_0x68a2('0x1a')]=qs[_0x68a2('0x1a')](_0x56167e['query'][_0x68a2('0x1a')]);}_0x155a9d['order']=qs[_0x68a2('0x37')](_0x56167e[_0x68a2('0x2e')][_0x68a2('0x37')]);_0x155a9d[_0x68a2('0x38')]=qs[_0x68a2('0x30')](_[_0x68a2('0x39')](_0x56167e[_0x68a2('0x2e')],_0x187ea3[_0x68a2('0x30')]),_0x421dc1);if(_0x56167e['query'][_0x68a2('0x3a')]){_0x155a9d[_0x68a2('0x38')]=_['merge'](_0x155a9d[_0x68a2('0x38')],{'$or':_[_0x68a2('0x2c')](_0x421dc1,function(_0x5259a1){if(_0x5259a1[_0x68a2('0x2a')]!==_0x68a2('0x3b')){var _0x2d87bf={};_0x2d87bf[_0x5259a1[_0x68a2('0x2d')]]={'$like':'%'+_0x56167e['query'][_0x68a2('0x3a')]+'%'};return _0x2d87bf;}})});}_0x155a9d=_[_0x68a2('0x3c')]({},_0x155a9d,_0x56167e[_0x68a2('0x3d')]);var _0x1d8a03={'where':_0x155a9d[_0x68a2('0x38')]};return db[_0x68a2('0x28')]['count'](_0x1d8a03)[_0x68a2('0x22')](function(_0x274b18){_0x613b40[_0x68a2('0x19')]=_0x274b18;if(_0x56167e[_0x68a2('0x2e')][_0x68a2('0x3e')]){_0x155a9d[_0x68a2('0x3f')]=[{'all':!![]}];}return db[_0x68a2('0x28')][_0x68a2('0x40')](_0x155a9d);})[_0x68a2('0x22')](function(_0x18a207){_0x613b40[_0x68a2('0x41')]=_0x18a207;return _0x613b40;})[_0x68a2('0x22')](respondWithFilteredResult(_0x2143b1,_0x155a9d))[_0x68a2('0x42')](handleError(_0x2143b1,null));};exports[_0x68a2('0x43')]=function(_0x548fb2,_0x1dad14){var _0x22f0b7={'raw':![],'where':{'id':_0x548fb2[_0x68a2('0x44')]['id']}},_0x4d9c41={};_0x4d9c41[_0x68a2('0x32')]=_['keys'](db[_0x68a2('0x28')][_0x68a2('0x45')]);_0x4d9c41[_0x68a2('0x2e')]=_[_0x68a2('0x2f')](_0x548fb2[_0x68a2('0x2e')]);_0x4d9c41[_0x68a2('0x30')]=_[_0x68a2('0x31')](_0x4d9c41['model'],_0x4d9c41[_0x68a2('0x2e')]);_0x22f0b7['attributes']=_[_0x68a2('0x31')](_0x4d9c41[_0x68a2('0x32')],qs[_0x68a2('0x33')](_0x548fb2[_0x68a2('0x2e')][_0x68a2('0x33')]));_0x22f0b7[_0x68a2('0x34')]=_0x22f0b7[_0x68a2('0x34')][_0x68a2('0x35')]?_0x22f0b7['attributes']:_0x4d9c41[_0x68a2('0x32')];if(_0x548fb2[_0x68a2('0x2e')]['includeAll']){_0x22f0b7[_0x68a2('0x3f')]=[{'all':!![]}];}_0x22f0b7=_[_0x68a2('0x3c')]({},_0x22f0b7,_0x548fb2[_0x68a2('0x3d')]);return db[_0x68a2('0x28')][_0x68a2('0x46')](_0x22f0b7)[_0x68a2('0x22')](handleEntityNotFound(_0x1dad14,null))['then'](respondWithResult(_0x1dad14,null))[_0x68a2('0x42')](handleError(_0x1dad14,null));};exports[_0x68a2('0x47')]=function(_0x2e9e5e,_0x2eaa46){return db[_0x68a2('0x28')][_0x68a2('0x47')](_0x2e9e5e[_0x68a2('0x48')],{})[_0x68a2('0x22')](function(_0x3a5b54){var _0x3bf29c=_0x2e9e5e['user'][_0x68a2('0x23')]({'plain':!![]});if(!_0x3bf29c)throw new Error(_0x68a2('0x49'));if(_0x3bf29c[_0x68a2('0x4a')]===_0x68a2('0x4b')){var _0x596009=_0x3a5b54[_0x68a2('0x23')]({'plain':!![]});var _0x23a44c=_0x68a2('0x24');return db[_0x68a2('0x4c')][_0x68a2('0x46')]({'where':{'name':_0x23a44c,'userProfileId':_0x3bf29c['userProfileId']},'raw':!![]})[_0x68a2('0x22')](function(_0x5adc5a){if(_0x5adc5a&&_0x5adc5a[_0x68a2('0x4d')]===0x0){return db[_0x68a2('0x25')][_0x68a2('0x47')]({'name':_0x596009[_0x68a2('0x2d')],'resourceId':_0x596009['id'],'type':_0x5adc5a[_0x68a2('0x2d')],'sectionId':_0x5adc5a['id']},{})['then'](function(){return _0x3a5b54;});}else{return _0x3a5b54;}})[_0x68a2('0x42')](function(_0x4d48d8){logger[_0x68a2('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d48d8);throw _0x4d48d8;});}return _0x3a5b54;})[_0x68a2('0x22')](respondWithResult(_0x2eaa46,0xc9))[_0x68a2('0x42')](handleError(_0x2eaa46,null));};exports[_0x68a2('0x4e')]=function(_0x431bf5,_0x38f770){var _0x3f60f7={'where':{'id':_0x431bf5[_0x68a2('0x44')]['id']}},_0x42b005={};_0x42b005[_0x68a2('0x32')]=_[_0x68a2('0x2f')](db[_0x68a2('0x28')][_0x68a2('0x45')]);_0x3f60f7[_0x68a2('0x34')]=_[_0x68a2('0x31')](_0x42b005[_0x68a2('0x32')],qs['fields'](_0x431bf5[_0x68a2('0x2e')]['fields']));_0x3f60f7[_0x68a2('0x34')]=_0x3f60f7[_0x68a2('0x34')][_0x68a2('0x35')]?_0x3f60f7[_0x68a2('0x34')]:_0x42b005[_0x68a2('0x32')];if(_0x431bf5['query'][_0x68a2('0x3e')]){_0x3f60f7[_0x68a2('0x3f')]=[{'all':!![]}];}_0x3f60f7=_['merge']({},_0x3f60f7,_0x431bf5['options']);return db[_0x68a2('0x28')][_0x68a2('0x46')](_0x3f60f7)[_0x68a2('0x22')](handleEntityNotFound(_0x38f770,null))[_0x68a2('0x22')](function(_0x4126fd){if(_0x4126fd){var _0x115426=_0x4126fd[_0x68a2('0x23')]({'plain':!![]});_0x115426=qs[_0x68a2('0x4f')](_0x115426,['id',_0x68a2('0x50'),'updatedAt']);_0x431bf5['body']=_[_0x68a2('0x4f')](_0x431bf5[_0x68a2('0x48')],['id',_0x68a2('0x50'),_0x68a2('0x51')]);return db[_0x68a2('0x28')]['create'](_[_0x68a2('0x3c')](_0x115426,_0x431bf5[_0x68a2('0x48')]),{'include':_0x431bf5[_0x68a2('0x2e')][_0x68a2('0x3e')]?[{'all':!![]}]:undefined})[_0x68a2('0x22')](function(_0x28de51){var _0x32b018=_0x431bf5['user'][_0x68a2('0x23')]({'plain':!![]});if(!_0x32b018)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x32b018[_0x68a2('0x4a')]===_0x68a2('0x4b')){var _0x3f58a8=_0x28de51['get']({'plain':!![]});var _0x1991ce=_0x68a2('0x24');return db['UserProfileSection'][_0x68a2('0x46')]({'where':{'name':_0x1991ce,'userProfileId':_0x32b018['userProfileId']},'raw':!![]})[_0x68a2('0x22')](function(_0x3a318f){if(_0x3a318f&&_0x3a318f[_0x68a2('0x4d')]===0x0){return db[_0x68a2('0x25')][_0x68a2('0x47')]({'name':_0x3f58a8[_0x68a2('0x2d')],'resourceId':_0x3f58a8['id'],'type':_0x3a318f[_0x68a2('0x2d')],'sectionId':_0x3a318f['id']},{})['then'](function(){return _0x28de51;});}else{return _0x28de51;}})[_0x68a2('0x42')](function(_0x4725e3){logger[_0x68a2('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4725e3);throw _0x4725e3;});}return _0x28de51;});}})[_0x68a2('0x22')](respondWithResult(_0x38f770,0xc9))['catch'](handleError(_0x38f770,null));};exports['update']=function(_0x488132,_0x3f9138){if(_0x488132[_0x68a2('0x48')]['id']){delete _0x488132[_0x68a2('0x48')]['id'];}return db[_0x68a2('0x28')]['find']({'where':{'id':_0x488132['params']['id']}})[_0x68a2('0x22')](handleEntityNotFound(_0x3f9138,null))[_0x68a2('0x22')](saveUpdates(_0x488132[_0x68a2('0x48')],null))[_0x68a2('0x22')](respondWithResult(_0x3f9138,null))[_0x68a2('0x42')](handleError(_0x3f9138,null));};exports[_0x68a2('0x26')]=function(_0x49923e,_0x4e27c0){return db[_0x68a2('0x28')][_0x68a2('0x46')]({'where':{'id':_0x49923e[_0x68a2('0x44')]['id']}})[_0x68a2('0x22')](handleEntityNotFound(_0x4e27c0,null))[_0x68a2('0x22')](removeEntity(_0x4e27c0,null))[_0x68a2('0x42')](handleError(_0x4e27c0,null));};exports[_0x68a2('0x52')]=function(_0x1dd549,_0x2463f9,_0xa3a50a){var _0x300d19={'raw':!![],'where':{}};var _0x5741df={};var _0x496b5d={'count':0x0,'rows':[]};return db['Campaign'][_0x68a2('0x53')]({'where':{'id':_0x1dd549[_0x68a2('0x44')]['id']}})[_0x68a2('0x22')](handleEntityNotFound(_0x2463f9,null))[_0x68a2('0x22')](function(_0x2ce664){if(_0x2ce664){_0x5741df['model']=_[_0x68a2('0x2f')](db[_0x68a2('0x54')][_0x68a2('0x45')]);_0x5741df[_0x68a2('0x2e')]=_[_0x68a2('0x2f')](_0x1dd549[_0x68a2('0x2e')]);_0x5741df[_0x68a2('0x30')]=_[_0x68a2('0x31')](_0x5741df['model'],_0x5741df[_0x68a2('0x2e')]);_0x300d19['attributes']=_[_0x68a2('0x31')](_0x5741df[_0x68a2('0x32')],qs[_0x68a2('0x33')](_0x1dd549[_0x68a2('0x2e')][_0x68a2('0x33')]));_0x300d19['attributes']=_0x300d19['attributes'][_0x68a2('0x35')]?_0x300d19[_0x68a2('0x34')]:_0x5741df['model'];if(!_0x1dd549[_0x68a2('0x2e')][_0x68a2('0x36')]('nolimit')){_0x300d19[_0x68a2('0x1b')]=qs[_0x68a2('0x1b')](_0x1dd549[_0x68a2('0x2e')]['limit']);_0x300d19[_0x68a2('0x1a')]=qs[_0x68a2('0x1a')](_0x1dd549[_0x68a2('0x2e')]['offset']);}_0x300d19['order']=qs[_0x68a2('0x37')](_0x1dd549[_0x68a2('0x2e')][_0x68a2('0x37')]);_0x300d19['where']=qs['filters'](_[_0x68a2('0x39')](_0x1dd549[_0x68a2('0x2e')],_0x5741df[_0x68a2('0x30')]));_0x300d19[_0x68a2('0x38')][_0x68a2('0x55')]=_0x2ce664['id'];if(_0x1dd549['query'][_0x68a2('0x3a')]){_0x300d19[_0x68a2('0x38')]=_[_0x68a2('0x3c')](_0x300d19[_0x68a2('0x38')],{'$or':_[_0x68a2('0x2c')](_0x300d19['attributes'],function(_0xfacd21){var _0x500d7d={};_0x500d7d[_0xfacd21]={'$like':'%'+_0x1dd549['query'][_0x68a2('0x3a')]+'%'};return _0x500d7d;})});}_0x300d19=_['merge']({},_0x300d19,_0x1dd549[_0x68a2('0x3d')]);return db[_0x68a2('0x54')][_0x68a2('0x19')]({'where':_0x300d19[_0x68a2('0x38')]})[_0x68a2('0x22')](function(_0x247d6c){_0x496b5d[_0x68a2('0x19')]=_0x247d6c;if(_0x1dd549[_0x68a2('0x2e')]['includeAll']){_0x300d19[_0x68a2('0x3f')]=[{'all':!![]}];}return db[_0x68a2('0x54')]['findAll'](_0x300d19);})[_0x68a2('0x22')](function(_0x2a3e86){_0x496b5d[_0x68a2('0x41')]=_0x2a3e86;return _0x496b5d;});}})[_0x68a2('0x22')](respondWithFilteredResult(_0x2463f9,_0x300d19))[_0x68a2('0x42')](handleError(_0x2463f9,null));};exports[_0x68a2('0x56')]=function(_0x4d4073,_0x54f6b5,_0x496f11){var _0x1327ca={'raw':!![],'where':{}};var _0x3e126e={};var _0x6c56dc={'count':0x0,'rows':[]};return db[_0x68a2('0x28')][_0x68a2('0x53')]({'where':{'id':_0x4d4073[_0x68a2('0x44')]['id']}})[_0x68a2('0x22')](handleEntityNotFound(_0x54f6b5,null))[_0x68a2('0x22')](function(_0x5d1001){if(_0x5d1001){_0x3e126e[_0x68a2('0x32')]=_['keys'](db[_0x68a2('0x57')][_0x68a2('0x45')]);_0x3e126e[_0x68a2('0x2e')]=_['keys'](_0x4d4073[_0x68a2('0x2e')]);_0x3e126e['filters']=_['intersection'](_0x3e126e[_0x68a2('0x32')],_0x3e126e['query']);_0x1327ca['attributes']=_[_0x68a2('0x31')](_0x3e126e[_0x68a2('0x32')],qs[_0x68a2('0x33')](_0x4d4073[_0x68a2('0x2e')][_0x68a2('0x33')]));_0x1327ca[_0x68a2('0x34')]=_0x1327ca[_0x68a2('0x34')][_0x68a2('0x35')]?_0x1327ca[_0x68a2('0x34')]:_0x3e126e[_0x68a2('0x32')];if(!_0x4d4073[_0x68a2('0x2e')]['hasOwnProperty']('nolimit')){_0x1327ca[_0x68a2('0x1b')]=qs[_0x68a2('0x1b')](_0x4d4073['query'][_0x68a2('0x1b')]);_0x1327ca[_0x68a2('0x1a')]=qs['offset'](_0x4d4073[_0x68a2('0x2e')]['offset']);}_0x1327ca[_0x68a2('0x58')]=qs['sort'](_0x4d4073[_0x68a2('0x2e')]['sort']);_0x1327ca[_0x68a2('0x38')]=qs[_0x68a2('0x30')](_[_0x68a2('0x39')](_0x4d4073[_0x68a2('0x2e')],_0x3e126e[_0x68a2('0x30')]));_0x1327ca[_0x68a2('0x38')][_0x68a2('0x55')]=_0x5d1001['id'];if(_0x4d4073[_0x68a2('0x2e')][_0x68a2('0x3a')]){_0x1327ca[_0x68a2('0x38')]=_[_0x68a2('0x3c')](_0x1327ca['where'],{'$or':_[_0x68a2('0x2c')](_0x1327ca[_0x68a2('0x34')],function(_0x4d0b8a){var _0x344ef3={};_0x344ef3[_0x4d0b8a]={'$like':'%'+_0x4d4073['query'][_0x68a2('0x3a')]+'%'};return _0x344ef3;})});}_0x1327ca=_[_0x68a2('0x3c')]({},_0x1327ca,_0x4d4073[_0x68a2('0x3d')]);return db[_0x68a2('0x57')][_0x68a2('0x19')]({'where':_0x1327ca['where']})[_0x68a2('0x22')](function(_0xbd362e){_0x6c56dc[_0x68a2('0x19')]=_0xbd362e;if(_0x4d4073[_0x68a2('0x2e')][_0x68a2('0x3e')]){_0x1327ca[_0x68a2('0x3f')]=[{'all':!![]}];}return db[_0x68a2('0x57')][_0x68a2('0x40')](_0x1327ca);})['then'](function(_0x169eac){_0x6c56dc[_0x68a2('0x41')]=_0x169eac;return _0x6c56dc;});}})['then'](respondWithFilteredResult(_0x54f6b5,_0x1327ca))[_0x68a2('0x42')](handleError(_0x54f6b5,null));};exports[_0x68a2('0x59')]=function(_0x47d64c,_0x42c577,_0x2ef4d8){var _0x10ca9c={'raw':!![],'where':{}};var _0x455cb5={};var _0x401866={'count':0x0,'rows':[]};return db['Campaign'][_0x68a2('0x53')]({'where':{'id':_0x47d64c[_0x68a2('0x44')]['id']}})[_0x68a2('0x22')](handleEntityNotFound(_0x42c577,null))['then'](function(_0x37f553){if(_0x37f553){_0x455cb5[_0x68a2('0x32')]=_[_0x68a2('0x2f')](db[_0x68a2('0x5a')][_0x68a2('0x45')]);_0x455cb5[_0x68a2('0x2e')]=_[_0x68a2('0x2f')](_0x47d64c[_0x68a2('0x2e')]);_0x455cb5[_0x68a2('0x30')]=_[_0x68a2('0x31')](_0x455cb5['model'],_0x455cb5[_0x68a2('0x2e')]);_0x10ca9c[_0x68a2('0x34')]=_['intersection'](_0x455cb5[_0x68a2('0x32')],qs[_0x68a2('0x33')](_0x47d64c[_0x68a2('0x2e')][_0x68a2('0x33')]));_0x10ca9c[_0x68a2('0x34')]=_0x10ca9c[_0x68a2('0x34')][_0x68a2('0x35')]?_0x10ca9c['attributes']:_0x455cb5[_0x68a2('0x32')];if(!_0x47d64c['query'][_0x68a2('0x36')](_0x68a2('0x5b'))){_0x10ca9c[_0x68a2('0x1b')]=qs[_0x68a2('0x1b')](_0x47d64c[_0x68a2('0x2e')][_0x68a2('0x1b')]);_0x10ca9c['offset']=qs[_0x68a2('0x1a')](_0x47d64c['query'][_0x68a2('0x1a')]);}_0x10ca9c['order']=qs[_0x68a2('0x37')](_0x47d64c['query'][_0x68a2('0x37')]);_0x10ca9c['where']=qs[_0x68a2('0x30')](_['pick'](_0x47d64c[_0x68a2('0x2e')],_0x455cb5['filters']));_0x10ca9c[_0x68a2('0x38')][_0x68a2('0x55')]=_0x37f553['id'];if(_0x47d64c['query'][_0x68a2('0x3a')]){_0x10ca9c[_0x68a2('0x38')]=_[_0x68a2('0x3c')](_0x10ca9c['where'],{'$or':_[_0x68a2('0x2c')](_0x10ca9c[_0x68a2('0x34')],function(_0x5aff3e){var _0x813931={};_0x813931[_0x5aff3e]={'$like':'%'+_0x47d64c['query']['filter']+'%'};return _0x813931;})});}_0x10ca9c=_['merge']({},_0x10ca9c,_0x47d64c['options']);return db[_0x68a2('0x5a')][_0x68a2('0x19')]({'where':_0x10ca9c[_0x68a2('0x38')]})[_0x68a2('0x22')](function(_0x26d554){_0x401866[_0x68a2('0x19')]=_0x26d554;if(_0x47d64c[_0x68a2('0x2e')][_0x68a2('0x3e')]){_0x10ca9c[_0x68a2('0x3f')]=[{'all':!![]}];}return db[_0x68a2('0x5a')]['findAll'](_0x10ca9c);})[_0x68a2('0x22')](function(_0x3ebdf2){_0x401866[_0x68a2('0x41')]=_0x3ebdf2;return _0x401866;});}})[_0x68a2('0x22')](respondWithFilteredResult(_0x42c577,_0x10ca9c))[_0x68a2('0x42')](handleError(_0x42c577,null));};exports[_0x68a2('0x5c')]=function(_0x396496,_0x13df47,_0x512995){var _0x3ef5df={'raw':!![],'where':{}};var _0xeb3595={};var _0x47f27d={'count':0x0,'rows':[]};return db[_0x68a2('0x28')][_0x68a2('0x53')]({'where':{'id':_0x396496[_0x68a2('0x44')]['id']}})[_0x68a2('0x22')](handleEntityNotFound(_0x13df47,null))['then'](function(_0x1c5093){if(_0x1c5093){_0xeb3595[_0x68a2('0x32')]=_[_0x68a2('0x2f')](db[_0x68a2('0x5d')][_0x68a2('0x45')]);_0xeb3595[_0x68a2('0x2e')]=_[_0x68a2('0x2f')](_0x396496['query']);_0xeb3595['filters']=_['intersection'](_0xeb3595[_0x68a2('0x32')],_0xeb3595[_0x68a2('0x2e')]);_0x3ef5df[_0x68a2('0x34')]=_[_0x68a2('0x31')](_0xeb3595[_0x68a2('0x32')],qs[_0x68a2('0x33')](_0x396496[_0x68a2('0x2e')][_0x68a2('0x33')]));_0x3ef5df[_0x68a2('0x34')]=_0x3ef5df['attributes'][_0x68a2('0x35')]?_0x3ef5df[_0x68a2('0x34')]:_0xeb3595[_0x68a2('0x32')];if(!_0x396496['query']['hasOwnProperty']('nolimit')){_0x3ef5df[_0x68a2('0x1b')]=qs[_0x68a2('0x1b')](_0x396496[_0x68a2('0x2e')][_0x68a2('0x1b')]);_0x3ef5df[_0x68a2('0x1a')]=qs[_0x68a2('0x1a')](_0x396496[_0x68a2('0x2e')][_0x68a2('0x1a')]);}_0x3ef5df[_0x68a2('0x58')]=qs[_0x68a2('0x37')](_0x396496[_0x68a2('0x2e')]['sort']);_0x3ef5df[_0x68a2('0x38')]=qs[_0x68a2('0x30')](_[_0x68a2('0x39')](_0x396496['query'],_0xeb3595[_0x68a2('0x30')]));_0x3ef5df[_0x68a2('0x38')][_0x68a2('0x55')]=_0x1c5093['id'];if(_0x396496['query'][_0x68a2('0x3a')]){_0x3ef5df[_0x68a2('0x38')]=_[_0x68a2('0x3c')](_0x3ef5df[_0x68a2('0x38')],{'$or':_['map'](_0x3ef5df[_0x68a2('0x34')],function(_0x481334){var _0x33e9f9={};_0x33e9f9[_0x481334]={'$like':'%'+_0x396496['query'][_0x68a2('0x3a')]+'%'};return _0x33e9f9;})});}_0x3ef5df=_['merge']({},_0x3ef5df,_0x396496['options']);return db[_0x68a2('0x5d')][_0x68a2('0x19')]({'where':_0x3ef5df[_0x68a2('0x38')]})[_0x68a2('0x22')](function(_0x5bf5be){_0x47f27d['count']=_0x5bf5be;if(_0x396496['query'][_0x68a2('0x3e')]){_0x3ef5df[_0x68a2('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x68a2('0x40')](_0x3ef5df);})[_0x68a2('0x22')](function(_0x343519){_0x47f27d['rows']=_0x343519;return _0x47f27d;});}})[_0x68a2('0x22')](respondWithFilteredResult(_0x13df47,_0x3ef5df))['catch'](handleError(_0x13df47,null));};exports[_0x68a2('0x5e')]=function(_0xfc8fce,_0x556cc8,_0x400afc){var _0x3caadd={};var _0x1c9702={};var _0x262c9c;var _0x239f2a;return db[_0x68a2('0x28')]['findOne']({'where':{'id':_0xfc8fce[_0x68a2('0x44')]['id']}})[_0x68a2('0x22')](handleEntityNotFound(_0x556cc8,null))[_0x68a2('0x22')](function(_0x206692){if(_0x206692){_0x262c9c=_0x206692;_0x1c9702['model']=_[_0x68a2('0x2f')](db[_0x68a2('0x5f')][_0x68a2('0x45')]);_0x1c9702[_0x68a2('0x2e')]=_[_0x68a2('0x2f')](_0xfc8fce['query']);_0x1c9702[_0x68a2('0x30')]=_[_0x68a2('0x31')](_0x1c9702[_0x68a2('0x32')],_0x1c9702[_0x68a2('0x2e')]);_0x3caadd[_0x68a2('0x34')]=_[_0x68a2('0x31')](_0x1c9702['model'],qs['fields'](_0xfc8fce[_0x68a2('0x2e')][_0x68a2('0x33')]));_0x3caadd['attributes']=_0x3caadd[_0x68a2('0x34')]['length']?_0x3caadd[_0x68a2('0x34')]:_0x1c9702[_0x68a2('0x32')];_0x3caadd[_0x68a2('0x58')]=qs[_0x68a2('0x37')](_0xfc8fce[_0x68a2('0x2e')][_0x68a2('0x37')]);_0x3caadd[_0x68a2('0x38')]=qs[_0x68a2('0x30')](_[_0x68a2('0x39')](_0xfc8fce[_0x68a2('0x2e')],_0x1c9702[_0x68a2('0x30')]));if(_0xfc8fce[_0x68a2('0x2e')]['filter']){_0x3caadd['where']=_[_0x68a2('0x3c')](_0x3caadd[_0x68a2('0x38')],{'$or':_[_0x68a2('0x2c')](_0x3caadd[_0x68a2('0x34')],function(_0x6128e8){var _0x151ed9={};_0x151ed9[_0x6128e8]={'$like':'%'+_0xfc8fce[_0x68a2('0x2e')][_0x68a2('0x3a')]+'%'};return _0x151ed9;})});}_0x3caadd=_['merge']({},_0x3caadd,_0xfc8fce[_0x68a2('0x3d')]);return _0x262c9c['getLists'](_0x3caadd);}})[_0x68a2('0x22')](function(_0x5d10e3){if(_0x5d10e3){_0x239f2a=_0x5d10e3[_0x68a2('0x35')];if(!_0xfc8fce[_0x68a2('0x2e')]['hasOwnProperty'](_0x68a2('0x5b'))){_0x3caadd['limit']=qs[_0x68a2('0x1b')](_0xfc8fce[_0x68a2('0x2e')][_0x68a2('0x1b')]);_0x3caadd[_0x68a2('0x1a')]=qs[_0x68a2('0x1a')](_0xfc8fce[_0x68a2('0x2e')][_0x68a2('0x1a')]);}return _0x262c9c[_0x68a2('0x5e')](_0x3caadd);}})[_0x68a2('0x22')](function(_0x42c836){if(_0x42c836){return _0x42c836?{'count':_0x239f2a,'rows':_0x42c836}:null;}})['then'](respondWithResult(_0x556cc8,null))[_0x68a2('0x42')](handleError(_0x556cc8,null));};exports[_0x68a2('0x60')]=function(_0x43c0f5,_0x33dccd,_0x57c374){var _0x24bc6d,_0x12b7a7;return db['Campaign'][_0x68a2('0x46')]({'where':{'id':_0x43c0f5[_0x68a2('0x44')]['id']}})[_0x68a2('0x22')](handleEntityNotFound(_0x33dccd,null))[_0x68a2('0x22')](function(_0x431753){if(_0x431753){_0x12b7a7=_0x431753;return _0x431753[_0x68a2('0x60')](_0x43c0f5[_0x68a2('0x48')][_0x68a2('0x61')],_[_0x68a2('0x4f')](_0x43c0f5['body'],[_0x68a2('0x61'),'id'])||{});}return null;})[_0x68a2('0x62')](function(_0x5a5888){var _0x435494;_0x24bc6d=_0x5a5888||[];var _0x1e86fc=[];if(_0x5a5888){for(var _0x2b0260=0x0;_0x2b0260<_0x5a5888[_0x68a2('0x35')];_0x2b0260+=0x1){var _0x4e5e21=_0x5a5888[_0x2b0260]['get']({'plain':!![]});_0x12b7a7['dialCheckDuplicateType']=_0x43c0f5[_0x68a2('0x48')]['dialCheckDuplicateType']?_0x43c0f5['body'][_0x68a2('0x63')]:_0x12b7a7[_0x68a2('0x63')];switch(_0x12b7a7['dialCheckDuplicateType']){case _0x68a2('0x64'):_0x435494=squel[_0x68a2('0x65')]()[_0x68a2('0x66')](_0x68a2('0x67'))[_0x68a2('0x68')]([_0x68a2('0x69'),_0x68a2('0x6a'),'ContactId','ListId',_0x68a2('0x55'),_0x68a2('0x50'),_0x68a2('0x51')],squel['select']()['field']('phone',_0x68a2('0x69'))[_0x68a2('0x6b')]('NOW()','scheduledAt')[_0x68a2('0x6b')]('id',_0x68a2('0x6c'))[_0x68a2('0x6b')](_0x4e5e21[_0x68a2('0x6d')]['toString'](),_0x68a2('0x6e'))[_0x68a2('0x6b')](_0x43c0f5['params']['id'][_0x68a2('0x6f')](),_0x68a2('0x55'))[_0x68a2('0x6b')]('NOW()',_0x68a2('0x50'))[_0x68a2('0x6b')](_0x68a2('0x70'),_0x68a2('0x51'))[_0x68a2('0x71')](_0x68a2('0x72'))[_0x68a2('0x38')](_0x68a2('0x73'))[_0x68a2('0x38')](_0x68a2('0x74'),_0x4e5e21['CmListId']['toString']())[_0x68a2('0x38')]('phone\x20IS\x20NOT\x20NULL')[_0x68a2('0x38')](_0x68a2('0x75'),squel['select']()[_0x68a2('0x6b')](_0x68a2('0x76'))[_0x68a2('0x71')](_0x68a2('0x77'))['where'](_0x68a2('0x78'),_0x43c0f5['params']['id'][_0x68a2('0x6f')]()))[_0x68a2('0x38')](_0x68a2('0x75'),squel[_0x68a2('0x79')]()[_0x68a2('0x6b')](_0x68a2('0x7a'))[_0x68a2('0x71')](_0x68a2('0x67'))[_0x68a2('0x38')](_0x68a2('0x78'),_0x43c0f5[_0x68a2('0x44')]['id'][_0x68a2('0x6f')]())))[_0x68a2('0x6f')]();break;case _0x68a2('0x7b'):_0x435494=squel['insert']()['into']('cm_hopper')['fromQuery']([_0x68a2('0x69'),_0x68a2('0x6a'),'ContactId',_0x68a2('0x6e'),_0x68a2('0x55'),'createdAt',_0x68a2('0x51')],squel[_0x68a2('0x79')]()[_0x68a2('0x6b')]('phone',_0x68a2('0x69'))['field']('NOW()','scheduledAt')['field']('id','ContactId')[_0x68a2('0x6b')](_0x4e5e21[_0x68a2('0x6d')][_0x68a2('0x6f')](),_0x68a2('0x6e'))[_0x68a2('0x6b')](_0x43c0f5[_0x68a2('0x44')]['id'][_0x68a2('0x6f')](),'CampaignId')[_0x68a2('0x6b')](_0x68a2('0x70'),_0x68a2('0x50'))['field']('NOW()','updatedAt')['from'](_0x68a2('0x72'))['where'](_0x68a2('0x73'))[_0x68a2('0x38')]('ListId\x20=\x20?',_0x4e5e21[_0x68a2('0x6d')][_0x68a2('0x6f')]())[_0x68a2('0x38')](_0x68a2('0x7c'))[_0x68a2('0x38')](_0x68a2('0x75'),squel['select']()['field'](_0x68a2('0x7a'))[_0x68a2('0x71')](_0x68a2('0x67'))[_0x68a2('0x38')](_0x68a2('0x78'),_0x43c0f5[_0x68a2('0x44')]['id'][_0x68a2('0x6f')]())))['toString']();break;default:_0x435494=squel['insert']()[_0x68a2('0x66')]('cm_hopper')[_0x68a2('0x68')]([_0x68a2('0x69'),_0x68a2('0x6a'),'ContactId',_0x68a2('0x6e'),_0x68a2('0x55'),_0x68a2('0x50'),'updatedAt'],squel['select']()['field'](_0x68a2('0x69'),_0x68a2('0x69'))[_0x68a2('0x6b')](_0x68a2('0x70'),_0x68a2('0x6a'))['field']('id',_0x68a2('0x6c'))[_0x68a2('0x6b')](_0x4e5e21['CmListId']['toString'](),'ListId')[_0x68a2('0x6b')](_0x43c0f5['params']['id'][_0x68a2('0x6f')](),_0x68a2('0x55'))[_0x68a2('0x6b')]('NOW()',_0x68a2('0x50'))[_0x68a2('0x6b')](_0x68a2('0x70'),_0x68a2('0x51'))[_0x68a2('0x71')](_0x68a2('0x72'))['where'](_0x68a2('0x73'))[_0x68a2('0x38')](_0x68a2('0x74'),_0x4e5e21['CmListId'][_0x68a2('0x6f')]())[_0x68a2('0x38')](_0x68a2('0x7c')))[_0x68a2('0x6f')]();}_0x1e86fc[_0x68a2('0x7d')](db[_0x68a2('0x7e')]['query'](_0x435494));}return BPromise['all'](_0x1e86fc);}})[_0x68a2('0x22')](function(){return _0x24bc6d;})[_0x68a2('0x22')](respondWithResult(_0x33dccd,null))[_0x68a2('0x42')](handleError(_0x33dccd,null));};exports[_0x68a2('0x7f')]=function(_0x11143f,_0x93d97f,_0x1155c8){return db[_0x68a2('0x28')][_0x68a2('0x46')]({'where':{'id':_0x11143f[_0x68a2('0x44')]['id']}})['then'](handleEntityNotFound(_0x93d97f,null))['then'](function(_0x1b274c){if(_0x1b274c){return _0x1b274c['removeLists'](_0x11143f[_0x68a2('0x2e')][_0x68a2('0x61')]);}})[_0x68a2('0x22')](function(_0x51246c){if(_0x51246c){return db[_0x68a2('0x54')]['destroy']({'where':{'ListId':_0x11143f[_0x68a2('0x2e')][_0x68a2('0x61')],'CampaignId':_0x11143f[_0x68a2('0x44')]['id']}})[_0x68a2('0x22')](function(){return _0x51246c;});}})[_0x68a2('0x22')](respondWithStatusCode(_0x93d97f,null))[_0x68a2('0x42')](handleError(_0x93d97f,null));};exports[_0x68a2('0x80')]=function(_0xacd138,_0x5525bb,_0x5bf032){var _0x3473af={};var _0x7ced58={};var _0x17f782;var _0x3c28c0;return db[_0x68a2('0x28')][_0x68a2('0x53')]({'where':{'id':_0xacd138['params']['id']}})[_0x68a2('0x22')](handleEntityNotFound(_0x5525bb,null))[_0x68a2('0x22')](function(_0x40fd21){if(_0x40fd21){_0x17f782=_0x40fd21;_0x7ced58[_0x68a2('0x32')]=_[_0x68a2('0x2f')](db['CmList'][_0x68a2('0x45')]);_0x7ced58[_0x68a2('0x2e')]=_[_0x68a2('0x2f')](_0xacd138[_0x68a2('0x2e')]);_0x7ced58['filters']=_[_0x68a2('0x31')](_0x7ced58[_0x68a2('0x32')],_0x7ced58[_0x68a2('0x2e')]);_0x3473af['attributes']=_[_0x68a2('0x31')](_0x7ced58[_0x68a2('0x32')],qs[_0x68a2('0x33')](_0xacd138[_0x68a2('0x2e')][_0x68a2('0x33')]));_0x3473af[_0x68a2('0x34')]=_0x3473af['attributes'][_0x68a2('0x35')]?_0x3473af[_0x68a2('0x34')]:_0x7ced58[_0x68a2('0x32')];_0x3473af[_0x68a2('0x58')]=qs[_0x68a2('0x37')](_0xacd138[_0x68a2('0x2e')][_0x68a2('0x37')]);_0x3473af[_0x68a2('0x38')]=qs[_0x68a2('0x30')](_[_0x68a2('0x39')](_0xacd138[_0x68a2('0x2e')],_0x7ced58[_0x68a2('0x30')]));if(_0xacd138[_0x68a2('0x2e')][_0x68a2('0x3a')]){_0x3473af[_0x68a2('0x38')]=_[_0x68a2('0x3c')](_0x3473af[_0x68a2('0x38')],{'$or':_[_0x68a2('0x2c')](_0x3473af[_0x68a2('0x34')],function(_0x241149){var _0xef2374={};_0xef2374[_0x241149]={'$like':'%'+_0xacd138['query'][_0x68a2('0x3a')]+'%'};return _0xef2374;})});}_0x3473af=_[_0x68a2('0x3c')]({},_0x3473af,_0xacd138[_0x68a2('0x3d')]);return _0x17f782[_0x68a2('0x80')](_0x3473af);}})[_0x68a2('0x22')](function(_0x5da7cf){if(_0x5da7cf){_0x3c28c0=_0x5da7cf[_0x68a2('0x35')];if(!_0xacd138['query'][_0x68a2('0x36')](_0x68a2('0x5b'))){_0x3473af[_0x68a2('0x1b')]=qs[_0x68a2('0x1b')](_0xacd138['query'][_0x68a2('0x1b')]);_0x3473af[_0x68a2('0x1a')]=qs[_0x68a2('0x1a')](_0xacd138[_0x68a2('0x2e')][_0x68a2('0x1a')]);}return _0x17f782['getBlackLists'](_0x3473af);}})['then'](function(_0x28b265){if(_0x28b265){return _0x28b265?{'count':_0x3c28c0,'rows':_0x28b265}:null;}})[_0x68a2('0x22')](respondWithResult(_0x5525bb,null))[_0x68a2('0x42')](handleError(_0x5525bb,null));};exports[_0x68a2('0x81')]=function(_0x3e9379,_0x365b14,_0x5a2458){var _0x18685f,_0x1eb63a;return db[_0x68a2('0x28')][_0x68a2('0x46')]({'where':{'id':_0x3e9379[_0x68a2('0x44')]['id']}})[_0x68a2('0x22')](handleEntityNotFound(_0x365b14,null))[_0x68a2('0x22')](function(_0x79082){if(_0x79082){_0x1eb63a=_0x79082;return _0x79082[_0x68a2('0x81')](_0x3e9379[_0x68a2('0x48')][_0x68a2('0x61')],_[_0x68a2('0x4f')](_0x3e9379[_0x68a2('0x48')],[_0x68a2('0x61'),'id'])||{});}return null;})['spread'](function(_0x539726){var _0xf3bc1e;_0x18685f=_0x539726||[];var _0x289937=[];if(_0x539726){for(var _0x541191=0x0;_0x541191<_0x539726['length'];_0x541191+=0x1){var _0x444ca4=_0x539726[_0x541191][_0x68a2('0x23')]({'plain':!![]});_0xf3bc1e=squel[_0x68a2('0x65')]()['into'](_0x68a2('0x82'))[_0x68a2('0x68')]([_0x68a2('0x69'),'ContactId',_0x68a2('0x6e'),_0x68a2('0x55'),_0x68a2('0x50'),_0x68a2('0x51')],squel['select']()[_0x68a2('0x6b')]('phone',_0x68a2('0x69'))[_0x68a2('0x6b')]('id',_0x68a2('0x6c'))[_0x68a2('0x6b')](_0x444ca4['CmListId']['toString'](),_0x68a2('0x6e'))['field'](_0x3e9379[_0x68a2('0x44')]['id'][_0x68a2('0x6f')](),_0x68a2('0x55'))['field'](_0x68a2('0x70'),_0x68a2('0x50'))[_0x68a2('0x6b')]('NOW()','updatedAt')['from'](_0x68a2('0x72'))[_0x68a2('0x38')]('deletedAt\x20IS\x20NULL')[_0x68a2('0x38')](_0x68a2('0x74'),_0x444ca4['CmListId']['toString']())[_0x68a2('0x38')]('phone\x20IS\x20NOT\x20NULL'))[_0x68a2('0x6f')]();_0x289937[_0x68a2('0x7d')](db[_0x68a2('0x7e')]['query'](_0xf3bc1e));}return BPromise[_0x68a2('0x83')](_0x289937);}})['then'](function(){return _0x18685f;})['then'](respondWithResult(_0x365b14,null))['catch'](handleError(_0x365b14,null));};exports[_0x68a2('0x84')]=function(_0x16b3e8,_0x3bacf0,_0x232991){return db[_0x68a2('0x28')][_0x68a2('0x46')]({'where':{'id':_0x16b3e8['params']['id']}})['then'](handleEntityNotFound(_0x3bacf0,null))[_0x68a2('0x22')](function(_0x5915a0){if(_0x5915a0){return _0x5915a0[_0x68a2('0x84')](_0x16b3e8[_0x68a2('0x2e')]['ids']);}})['then'](function(_0x6f2818){if(_0x6f2818){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x16b3e8['query'][_0x68a2('0x61')],'CampaignId':_0x16b3e8[_0x68a2('0x44')]['id']}})[_0x68a2('0x22')](function(){return _0x6f2818;});}})['then'](respondWithStatusCode(_0x3bacf0,null))['catch'](handleError(_0x3bacf0,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 9e3c688..56062d6 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 _0x957b=['util','../../config/logger','moment','bluebird','../../config/environment','./campaign.attributes','exports','define','Campaign','campaigns','lodash'];(function(_0x19cb36,_0x4bab45){var _0x1b901c=function(_0x41152b){while(--_0x41152b){_0x19cb36['push'](_0x19cb36['shift']());}};_0x1b901c(++_0x4bab45);}(_0x957b,0x133));var _0xb957=function(_0x45de6b,_0x94b851){_0x45de6b=_0x45de6b-0x0;var _0x2aa35c=_0x957b[_0x45de6b];return _0x2aa35c;};'use strict';var _=require(_0xb957('0x0'));var util=require(_0xb957('0x1'));var logger=require(_0xb957('0x2'))('api');var moment=require(_0xb957('0x3'));var BPromise=require(_0xb957('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb957('0x5'));var attributes=require(_0xb957('0x6'));module[_0xb957('0x7')]=function(_0x71547b,_0x4d48a4){return _0x71547b[_0xb957('0x8')](_0xb957('0x9'),attributes,{'tableName':_0xb957('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaabc=['exports','define','campaigns','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./campaign.attributes'];(function(_0x4aaa4f,_0x424175){var _0x7215=function(_0x448937){while(--_0x448937){_0x4aaa4f['push'](_0x4aaa4f['shift']());}};_0x7215(++_0x424175);}(_0xaabc,0x121));var _0xcaab=function(_0x4c2c23,_0x3d8d28){_0x4c2c23=_0x4c2c23-0x0;var _0x5c992e=_0xaabc[_0x4c2c23];return _0x5c992e;};'use strict';var _=require('lodash');var util=require(_0xcaab('0x0'));var logger=require(_0xcaab('0x1'))(_0xcaab('0x2'));var moment=require(_0xcaab('0x3'));var BPromise=require(_0xcaab('0x4'));var rp=require(_0xcaab('0x5'));var fs=require('fs');var path=require(_0xcaab('0x6'));var rimraf=require(_0xcaab('0x7'));var config=require(_0xcaab('0x8'));var attributes=require(_0xcaab('0x9'));module[_0xcaab('0xa')]=function(_0x5884cc,_0x1cab60){return _0x5884cc[_0xcaab('0xb')]('Campaign',attributes,{'tableName':_0xcaab('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 a7a66a9..ea90385 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(_0x3310e6,_0x1de094){var _0x31f569=function(_0x1dff8b){while(--_0x1dff8b){_0x3310e6['push'](_0x3310e6['shift']());}};_0x31f569(++_0x1de094);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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 _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x6213d,_0x43e754){var _0x5cfd61=function(_0x274517){while(--_0x274517){_0x6213d['push'](_0x6213d['shift']());}};_0x5cfd61(++_0x43e754);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 59344bf..a21158f 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 _0x7286=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','getHoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','/:id/clone','clone','addLists','addBlackLists','delete','destroy','removeLists','removeBlackLists','exports','multer'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x7286,0xca));var _0x6728=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x7286[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0x6728('0x0'));var util=require(_0x6728('0x1'));var path=require(_0x6728('0x2'));var timeout=require(_0x6728('0x3'));var express=require(_0x6728('0x4'));var router=express['Router']();var auth=require(_0x6728('0x5'));var interaction=require(_0x6728('0x6'));var config=require(_0x6728('0x7'));var controller=require('./campaign.controller');router[_0x6728('0x8')]('/',auth[_0x6728('0x9')](),controller['index']);router[_0x6728('0x8')](_0x6728('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x6728('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x6728('0xb')]);router[_0x6728('0x8')](_0x6728('0xc'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x6728('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x6728('0xd')]);router['get'](_0x6728('0xe'),auth[_0x6728('0x9')](),controller[_0x6728('0xf')]);router[_0x6728('0x8')](_0x6728('0x10'),auth['isAuthenticated'](),controller[_0x6728('0x11')]);router[_0x6728('0x8')](_0x6728('0x12'),auth[_0x6728('0x9')](),controller['getBlackLists']);router[_0x6728('0x13')]('/',auth[_0x6728('0x9')](),controller['create']);router[_0x6728('0x13')](_0x6728('0x14'),auth[_0x6728('0x9')](),controller[_0x6728('0x15')]);router[_0x6728('0x13')](_0x6728('0x10'),auth[_0x6728('0x9')](),controller[_0x6728('0x16')]);router[_0x6728('0x13')]('/:id/blacklists',auth[_0x6728('0x9')](),controller[_0x6728('0x17')]);router['put'](_0x6728('0xa'),auth[_0x6728('0x9')](),controller['update']);router[_0x6728('0x18')](_0x6728('0xa'),auth[_0x6728('0x9')](),controller[_0x6728('0x19')]);router['delete'](_0x6728('0x10'),auth[_0x6728('0x9')](),controller[_0x6728('0x1a')]);router[_0x6728('0x18')](_0x6728('0x12'),auth[_0x6728('0x9')](),controller[_0x6728('0x1b')]);module[_0x6728('0x1c')]=router; \ No newline at end of file +var _0x02e4=['post','create','/:id/clone','clone','/:id/blacklists','addBlackLists','/:id','update','delete','destroy','removeLists','removeBlackLists','multer','util','express','Router','../../components/auth/service','../../config/environment','./campaign.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getBlackLists'];(function(_0x18a6df,_0x921d3){var _0x3d58e5=function(_0x498b18){while(--_0x498b18){_0x18a6df['push'](_0x18a6df['shift']());}};_0x3d58e5(++_0x921d3);}(_0x02e4,0xb1));var _0x402e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x02e4[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x402e('0x0'));var util=require(_0x402e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x402e('0x2'));var router=express[_0x402e('0x3')]();var auth=require(_0x402e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x402e('0x5'));var controller=require(_0x402e('0x6'));router[_0x402e('0x7')]('/',auth['isAuthenticated'](),controller[_0x402e('0x8')]);router[_0x402e('0x7')]('/:id',auth[_0x402e('0x9')](),controller[_0x402e('0xa')]);router[_0x402e('0x7')](_0x402e('0xb'),auth[_0x402e('0x9')](),controller[_0x402e('0xc')]);router['get'](_0x402e('0xd'),auth[_0x402e('0x9')](),controller[_0x402e('0xe')]);router['get'](_0x402e('0xf'),auth[_0x402e('0x9')](),controller[_0x402e('0x10')]);router[_0x402e('0x7')](_0x402e('0x11'),auth['isAuthenticated'](),controller[_0x402e('0x12')]);router[_0x402e('0x7')](_0x402e('0x13'),auth[_0x402e('0x9')](),controller['getLists']);router[_0x402e('0x7')]('/:id/blacklists',auth[_0x402e('0x9')](),controller[_0x402e('0x14')]);router[_0x402e('0x15')]('/',auth[_0x402e('0x9')](),controller[_0x402e('0x16')]);router[_0x402e('0x15')](_0x402e('0x17'),auth['isAuthenticated'](),controller[_0x402e('0x18')]);router[_0x402e('0x15')]('/:id/lists',auth[_0x402e('0x9')](),controller['addLists']);router[_0x402e('0x15')](_0x402e('0x19'),auth[_0x402e('0x9')](),controller[_0x402e('0x1a')]);router['put'](_0x402e('0x1b'),auth[_0x402e('0x9')](),controller[_0x402e('0x1c')]);router[_0x402e('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0x402e('0x1e')]);router['delete'](_0x402e('0x13'),auth['isAuthenticated'](),controller[_0x402e('0x1f')]);router[_0x402e('0x1d')](_0x402e('0x19'),auth['isAuthenticated'](),controller[_0x402e('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 75c0d25..baa55f2 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 _0xdcdc=['getDataValue','sequelize','TEXT','STRING'];(function(_0x158da6,_0x3cb06d){var _0x429c30=function(_0x2d5895){while(--_0x2d5895){_0x158da6['push'](_0x158da6['shift']());}};_0x429c30(++_0x3cb06d);}(_0xdcdc,0xf1));var _0xcdcd=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xdcdc[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xcdcd('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xcdcd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xcdcd('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xcdcd('0x3')]('key');}}}; \ No newline at end of file +var _0xe46a=['VIRTUAL','getDataValue','key','exports','STRING','TEXT'];(function(_0x2710dc,_0x304810){var _0x532d50=function(_0x2fe696){while(--_0x2fe696){_0x2710dc['push'](_0x2710dc['shift']());}};_0x532d50(++_0x304810);}(_0xe46a,0xbd));var _0xae46=function(_0x5c8c8a,_0x23d156){_0x5c8c8a=_0x5c8c8a-0x0;var _0x517931=_0xe46a[_0x5c8c8a];return _0x517931;};'use strict';var Sequelize=require('sequelize');module[_0xae46('0x0')]={'key':{'type':Sequelize[_0xae46('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xae46('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xae46('0x3')],'get':function(){return this[_0xae46('0x4')](_0xae46('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 24a9b44..f0680d6 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 _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(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 +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(_0x3bd6cd,_0x5eaa2a){var _0x36435a=function(_0x2fdc5d){while(--_0x2fdc5d){_0x3bd6cd['push'](_0x3bd6cd['shift']());}};_0x36435a(++_0x5eaa2a);}(_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'];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 diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index d5ee1de..bae1592 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 _0x4322=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci'];(function(_0x56ddd3,_0x5a931d){var _0x62cf7b=function(_0xda0fef){while(--_0xda0fef){_0x56ddd3['push'](_0x56ddd3['shift']());}};_0x62cf7b(++_0x5a931d);}(_0x4322,0x174));var _0x2432=function(_0x961771,_0x470110){_0x961771=_0x961771-0x0;var _0x293eae=_0x4322[_0x961771];return _0x293eae;};'use strict';var _=require(_0x2432('0x0'));var util=require('util');var logger=require(_0x2432('0x1'))(_0x2432('0x2'));var moment=require(_0x2432('0x3'));var BPromise=require(_0x2432('0x4'));var rp=require(_0x2432('0x5'));var fs=require('fs');var path=require(_0x2432('0x6'));var rimraf=require(_0x2432('0x7'));var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x689fbb,_0x11d670){return _0x689fbb['define'](_0x2432('0x8'),attributes,{'tableName':_0x2432('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2432('0xa'),'collate':_0x2432('0xb')});}; \ No newline at end of file +var _0x502a=['path','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','lodash','util','api','moment'];(function(_0x5a58d9,_0x31d811){var _0x517a23=function(_0x315316){while(--_0x315316){_0x5a58d9['push'](_0x5a58d9['shift']());}};_0x517a23(++_0x31d811);}(_0x502a,0xd8));var _0xa502=function(_0x3ba40e,_0x5b1f9d){_0x3ba40e=_0x3ba40e-0x0;var _0x3eb626=_0x502a[_0x3ba40e];return _0x3eb626;};'use strict';var _=require(_0xa502('0x0'));var util=require(_0xa502('0x1'));var logger=require('../../config/logger')(_0xa502('0x2'));var moment=require(_0xa502('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa502('0x4'));var rimraf=require('rimraf');var config=require(_0xa502('0x5'));var attributes=require(_0xa502('0x6'));module[_0xa502('0x7')]=function(_0x1cb2e4,_0x136d51){return _0x1cb2e4['define'](_0xa502('0x8'),attributes,{'tableName':_0xa502('0x9'),'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 7d31f19..24360c7 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 _0xf8df=['info','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','message','CannedAnswer,\x20%s,\x20%s'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xf8df,0x70));var _0xff8d=function(_0x8cda52,_0x5b61c4){_0x8cda52=_0x8cda52-0x0;var _0x18a593=_0xf8df[_0x8cda52];return _0x18a593;};'use strict';var _=require('lodash');var util=require(_0xff8d('0x0'));var moment=require(_0xff8d('0x1'));var BPromise=require(_0xff8d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff8d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xff8d('0x4'));var logger=require(_0xff8d('0x5'))(_0xff8d('0x6'));var config=require(_0xff8d('0x7'));var jayson=require(_0xff8d('0x8'));var client=jayson[_0xff8d('0x9')][_0xff8d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e4b82,_0x28ac85,_0x3766ec){return new BPromise(function(_0x573fd7,_0x2279c3){return client[_0xff8d('0xb')](_0x5e4b82,_0x3766ec)[_0xff8d('0xc')](function(_0x153df7){logger['info']('CannedAnswer,\x20%s,\x20%s',_0x28ac85,_0xff8d('0xd'));logger[_0xff8d('0xe')](_0xff8d('0xf'),_0x28ac85,_0xff8d('0xd'),JSON[_0xff8d('0x10')](_0x153df7));if(_0x153df7[_0xff8d('0x11')]){if(_0x153df7[_0xff8d('0x11')]['code']===0x1f4){logger[_0xff8d('0x11')]('CannedAnswer,\x20%s,\x20%s',_0x28ac85,_0x153df7['error']['message']);return _0x2279c3(_0x153df7['error'][_0xff8d('0x12')]);}logger[_0xff8d('0x11')](_0xff8d('0x13'),_0x28ac85,_0x153df7[_0xff8d('0x11')][_0xff8d('0x12')]);return _0x573fd7(_0x153df7['error'][_0xff8d('0x12')]);}else{logger[_0xff8d('0x14')](_0xff8d('0x13'),_0x28ac85,_0xff8d('0xd'));_0x573fd7(_0x153df7['result'][_0xff8d('0x12')]);}})[_0xff8d('0x15')](function(_0xf88155){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x28ac85,_0xf88155);_0x2279c3(_0xf88155);});});} \ No newline at end of file +var _0x6334=['bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x16ee3f,_0xef69da){var _0xb29a4e=function(_0x33811d){while(--_0x33811d){_0x16ee3f['push'](_0x16ee3f['shift']());}};_0xb29a4e(++_0xef69da);}(_0x6334,0xf5));var _0x4633=function(_0x24a737,_0x3ff299){_0x24a737=_0x24a737-0x0;var _0x37b618=_0x6334[_0x24a737];return _0x37b618;};'use strict';var _=require(_0x4633('0x0'));var util=require('util');var moment=require(_0x4633('0x1'));var BPromise=require(_0x4633('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4633('0x3'))['db'];var utils=require(_0x4633('0x4'));var logger=require('../../config/logger')(_0x4633('0x5'));var config=require(_0x4633('0x6'));var jayson=require(_0x4633('0x7'));var client=jayson[_0x4633('0x8')][_0x4633('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc96fab,_0x30e188,_0xe55130){return new BPromise(function(_0x4861fd,_0x3852ba){return client['request'](_0xc96fab,_0xe55130)['then'](function(_0x4d00df){logger[_0x4633('0xa')](_0x4633('0xb'),_0x30e188,_0x4633('0xc'));logger['debug']('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x30e188,_0x4633('0xc'),JSON[_0x4633('0xd')](_0x4d00df));if(_0x4d00df[_0x4633('0xe')]){if(_0x4d00df[_0x4633('0xe')][_0x4633('0xf')]===0x1f4){logger[_0x4633('0xe')]('CannedAnswer,\x20%s,\x20%s',_0x30e188,_0x4d00df[_0x4633('0xe')][_0x4633('0x10')]);return _0x3852ba(_0x4d00df[_0x4633('0xe')][_0x4633('0x10')]);}logger[_0x4633('0xe')](_0x4633('0xb'),_0x30e188,_0x4d00df[_0x4633('0xe')][_0x4633('0x10')]);return _0x4861fd(_0x4d00df[_0x4633('0xe')][_0x4633('0x10')]);}else{logger[_0x4633('0xa')](_0x4633('0xb'),_0x30e188,_0x4633('0xc'));_0x4861fd(_0x4d00df[_0x4633('0x11')][_0x4633('0x10')]);}})[_0x4633('0x12')](function(_0xd39e9b){logger[_0x4633('0xe')](_0x4633('0xb'),_0x30e188,_0xd39e9b);_0x3852ba(_0xd39e9b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 436741d..1585ce1 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 _0x91e7=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x344e3c,_0x46f1f9){var _0x4943c9=function(_0x39c4e8){while(--_0x39c4e8){_0x344e3c['push'](_0x344e3c['shift']());}};_0x4943c9(++_0x46f1f9);}(_0x91e7,0xf9));var _0x791e=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0x91e7[_0x4226d6];return _0x19655b;};'use strict';var multer=require('multer');var util=require(_0x791e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x791e('0x1'));var router=express[_0x791e('0x2')]();var auth=require(_0x791e('0x3'));var interaction=require(_0x791e('0x4'));var config=require(_0x791e('0x5'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0x791e('0x6')](),controller[_0x791e('0x7')]);router[_0x791e('0x8')](_0x791e('0x9'),auth['isAuthenticated'](),controller[_0x791e('0xa')]);router[_0x791e('0xb')]('/',auth['isAuthenticated'](),controller[_0x791e('0xc')]);router[_0x791e('0xd')](_0x791e('0x9'),auth[_0x791e('0x6')](),controller[_0x791e('0xe')]);router[_0x791e('0xf')](_0x791e('0x9'),auth[_0x791e('0x6')](),controller[_0x791e('0x10')]);module['exports']=router; \ No newline at end of file +var _0x38c7=['destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','index','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x1aeb4a,_0x4c78b8){var _0x1e9bdb=function(_0x3b8e9a){while(--_0x3b8e9a){_0x1aeb4a['push'](_0x1aeb4a['shift']());}};_0x1e9bdb(++_0x4c78b8);}(_0x38c7,0x68));var _0x738c=function(_0x555a26,_0x5cc218){_0x555a26=_0x555a26-0x0;var _0x49a39a=_0x38c7[_0x555a26];return _0x49a39a;};'use strict';var multer=require(_0x738c('0x0'));var util=require('util');var path=require(_0x738c('0x1'));var timeout=require(_0x738c('0x2'));var express=require(_0x738c('0x3'));var router=express['Router']();var auth=require(_0x738c('0x4'));var interaction=require(_0x738c('0x5'));var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x738c('0x6')]);router['get'](_0x738c('0x7'),auth[_0x738c('0x8')](),controller[_0x738c('0x9')]);router[_0x738c('0xa')]('/',auth[_0x738c('0x8')](),controller[_0x738c('0xb')]);router[_0x738c('0xc')](_0x738c('0x7'),auth[_0x738c('0x8')](),controller[_0x738c('0xd')]);router[_0x738c('0xe')](_0x738c('0x7'),auth[_0x738c('0x8')](),controller[_0x738c('0xf')]);module[_0x738c('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 02a64a7..f1cbdcc 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 _0x4e62=['1970-01-01\x2000:00:01','STRING','INTEGER','exports','DATE'];(function(_0x4aa2cc,_0x191f15){var _0x163dde=function(_0x4adcbb){while(--_0x4adcbb){_0x4aa2cc['push'](_0x4aa2cc['shift']());}};_0x163dde(++_0x191f15);}(_0x4e62,0x193));var _0x24e6=function(_0x3bec33,_0xc3915f){_0x3bec33=_0x3bec33-0x0;var _0x4872fd=_0x4e62[_0x3bec33];return _0x4872fd;};'use strict';var Sequelize=require('sequelize');module[_0x24e6('0x0')]={'calldate':{'type':Sequelize[_0x24e6('0x1')],'allowNull':![],'defaultValue':_0x24e6('0x2')},'clid':{'type':Sequelize[_0x24e6('0x3')]},'src':{'type':Sequelize[_0x24e6('0x3')]},'dst':{'type':Sequelize[_0x24e6('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x24e6('0x3')]},'dstchannel':{'type':Sequelize[_0x24e6('0x3')]},'lastapp':{'type':Sequelize[_0x24e6('0x3')]},'lastdata':{'type':Sequelize[_0x24e6('0x3')]},'duration':{'type':Sequelize[_0x24e6('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x24e6('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x24e6('0x3')]},'amaflags':{'type':Sequelize[_0x24e6('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x24e6('0x3')]},'userfield':{'type':Sequelize[_0x24e6('0x3')]},'uniqueid':{'type':Sequelize[_0x24e6('0x3')]},'linkedid':{'type':Sequelize[_0x24e6('0x3')]},'sequence':{'type':Sequelize[_0x24e6('0x3')]},'peeraccount':{'type':Sequelize[_0x24e6('0x3')]},'type':{'type':Sequelize[_0x24e6('0x3')]},'tag':{'type':Sequelize[_0x24e6('0x3')]}}; \ No newline at end of file +var _0x7695=['INTEGER','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x380a7e,_0x1bbdc4){var _0x4ec06b=function(_0x2636a5){while(--_0x2636a5){_0x380a7e['push'](_0x380a7e['shift']());}};_0x4ec06b(++_0x1bbdc4);}(_0x7695,0x10a));var _0x5769=function(_0x11ca5b,_0xf8a872){_0x11ca5b=_0x11ca5b-0x0;var _0x24d14a=_0x7695[_0x11ca5b];return _0x24d14a;};'use strict';var Sequelize=require('sequelize');module[_0x5769('0x0')]={'calldate':{'type':Sequelize[_0x5769('0x1')],'allowNull':![],'defaultValue':_0x5769('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x5769('0x3')]},'dst':{'type':Sequelize[_0x5769('0x3')]},'dcontext':{'type':Sequelize[_0x5769('0x3')]},'channel':{'type':Sequelize[_0x5769('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x5769('0x3')]},'lastdata':{'type':Sequelize[_0x5769('0x3')]},'duration':{'type':Sequelize[_0x5769('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x5769('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5769('0x3')]},'amaflags':{'type':Sequelize[_0x5769('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x5769('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x5769('0x3')]},'sequence':{'type':Sequelize[_0x5769('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5769('0x3')]},'tag':{'type':Sequelize[_0x5769('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 0800a26..c6c6ab2 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 _0xebd9=['hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','count','includeAll','rows','catch','show','params','keys','include','merge','options','find','create','body','update','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','set','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x4950e2,_0x56ec2d){var _0x4d4fb5=function(_0x571b36){while(--_0x571b36){_0x4950e2['push'](_0x4950e2['shift']());}};_0x4d4fb5(++_0x56ec2d);}(_0xebd9,0x104));var _0x9ebd=function(_0x146866,_0x286b1e){_0x146866=_0x146866-0x0;var _0x26b63b=_0xebd9[_0x146866];return _0x26b63b;};'use strict';var pdf=require(_0x9ebd('0x0'));var emlformat=require(_0x9ebd('0x1'));var rimraf=require(_0x9ebd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ebd('0x3'));var rp=require(_0x9ebd('0x4'));var moment=require(_0x9ebd('0x5'));var BPromise=require(_0x9ebd('0x6'));var Mustache=require(_0x9ebd('0x7'));var util=require(_0x9ebd('0x8'));var path=require('path');var sox=require(_0x9ebd('0x9'));var csv=require(_0x9ebd('0xa'));var ejs=require(_0x9ebd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9ebd('0xc'));var crypto=require(_0x9ebd('0xd'));var jsforce=require(_0x9ebd('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9ebd('0xf'));var Papa=require(_0x9ebd('0x10'));var Redis=require(_0x9ebd('0x11'));var authService=require(_0x9ebd('0x12'));var qs=require(_0x9ebd('0x13'));var as=require(_0x9ebd('0x14'));var hardwareService=require(_0x9ebd('0x15'));var logger=require(_0x9ebd('0x16'))(_0x9ebd('0x17'));var utils=require(_0x9ebd('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9ebd('0x19'))['db'];function respondWithStatusCode(_0x2d9a65,_0x5670e3){_0x5670e3=_0x5670e3||0xcc;return function(_0x5e209e){if(_0x5e209e){return _0x2d9a65['sendStatus'](_0x5670e3);}return _0x2d9a65[_0x9ebd('0x1a')](_0x5670e3)[_0x9ebd('0x1b')]();};}function respondWithResult(_0x5b68ad,_0x5ae8e0){_0x5ae8e0=_0x5ae8e0||0xc8;return function(_0x97f78){if(_0x97f78){return _0x5b68ad[_0x9ebd('0x1a')](_0x5ae8e0)[_0x9ebd('0x1c')](_0x97f78);}};}function respondWithFilteredResult(_0x508d40,_0x4e8e8e){return function(_0x230eec){if(_0x230eec){var _0x25756a=_0x230eec['count'],_0x2c2da5=_0x4e8e8e[_0x9ebd('0x1d')],_0x217881=_0x4e8e8e[_0x9ebd('0x1d')]+_0x4e8e8e[_0x9ebd('0x1e')],_0x230230;if(_0x217881>=_0x25756a){_0x217881=_0x25756a;_0x230230=0xc8;}else{_0x230230=0xce;}_0x508d40[_0x9ebd('0x1a')](_0x230230);return _0x508d40[_0x9ebd('0x1f')]('Content-Range',_0x2c2da5+'-'+_0x217881+'/'+_0x25756a)[_0x9ebd('0x1c')](_0x230eec);}return null;};}function patchUpdates(_0x5cf3a0){return function(_0x28e88b){try{jsonpatch[_0x9ebd('0x20')](_0x28e88b,_0x5cf3a0,!![]);}catch(_0x5f09e6){return BPromise[_0x9ebd('0x21')](_0x5f09e6);}return _0x28e88b[_0x9ebd('0x22')]();};}function saveUpdates(_0xde4cf,_0x3dc414){return function(_0x5976e1){if(_0x5976e1){return _0x5976e1['update'](_0xde4cf)[_0x9ebd('0x23')](function(_0x5b2b86){return _0x5b2b86;});}return null;};}function removeEntity(_0x5b706c,_0x45c0f4){return function(_0x2ca47d){if(_0x2ca47d){return _0x2ca47d[_0x9ebd('0x24')]()[_0x9ebd('0x23')](function(){_0x5b706c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x415b0e,_0x127a74){return function(_0x22b2f3){if(!_0x22b2f3){_0x415b0e[_0x9ebd('0x25')](0x194);}return _0x22b2f3;};}function handleError(_0x122ef5,_0x1b1c24){_0x1b1c24=_0x1b1c24||0x1f4;return function(_0x4cf105){logger[_0x9ebd('0x26')](_0x4cf105[_0x9ebd('0x27')]);if(_0x4cf105['name']){delete _0x4cf105[_0x9ebd('0x28')];}_0x122ef5[_0x9ebd('0x1a')](_0x1b1c24)[_0x9ebd('0x29')](_0x4cf105);};}exports[_0x9ebd('0x2a')]=function(_0x3c0ea0,_0x3c181e){var _0x274c88={},_0x398244={},_0x14ce33={'count':0x0,'rows':[]};var _0x5c8f57=_[_0x9ebd('0x2b')](db[_0x9ebd('0x2c')][_0x9ebd('0x2d')],function(_0x29cfb7){return{'name':_0x29cfb7[_0x9ebd('0x2e')],'type':_0x29cfb7[_0x9ebd('0x2f')][_0x9ebd('0x30')]};});_0x398244[_0x9ebd('0x31')]=_[_0x9ebd('0x2b')](_0x5c8f57,_0x9ebd('0x28'));_0x398244[_0x9ebd('0x32')]=_['keys'](_0x3c0ea0[_0x9ebd('0x32')]);_0x398244[_0x9ebd('0x33')]=_[_0x9ebd('0x34')](_0x398244[_0x9ebd('0x31')],_0x398244[_0x9ebd('0x32')]);_0x274c88[_0x9ebd('0x35')]=_[_0x9ebd('0x34')](_0x398244[_0x9ebd('0x31')],qs[_0x9ebd('0x36')](_0x3c0ea0['query'][_0x9ebd('0x36')]));_0x274c88[_0x9ebd('0x35')]=_0x274c88[_0x9ebd('0x35')][_0x9ebd('0x37')]?_0x274c88[_0x9ebd('0x35')]:_0x398244[_0x9ebd('0x31')];if(!_0x3c0ea0[_0x9ebd('0x32')][_0x9ebd('0x38')](_0x9ebd('0x39'))){_0x274c88[_0x9ebd('0x1e')]=qs[_0x9ebd('0x1e')](_0x3c0ea0[_0x9ebd('0x32')][_0x9ebd('0x1e')]);_0x274c88[_0x9ebd('0x1d')]=qs['offset'](_0x3c0ea0[_0x9ebd('0x32')][_0x9ebd('0x1d')]);}_0x274c88[_0x9ebd('0x3a')]=qs[_0x9ebd('0x3b')](_0x3c0ea0['query'][_0x9ebd('0x3b')]);_0x274c88[_0x9ebd('0x3c')]=qs['filters'](_[_0x9ebd('0x3d')](_0x3c0ea0[_0x9ebd('0x32')],_0x398244[_0x9ebd('0x33')]),_0x5c8f57);if(_0x3c0ea0['query'][_0x9ebd('0x3e')]){_0x274c88[_0x9ebd('0x3c')]=_['merge'](_0x274c88[_0x9ebd('0x3c')],{'$or':_[_0x9ebd('0x2b')](_0x5c8f57,function(_0x1a9075){if(_0x1a9075[_0x9ebd('0x2f')]!==_0x9ebd('0x3f')){var _0x69aae3={};_0x69aae3[_0x1a9075[_0x9ebd('0x28')]]={'$like':'%'+_0x3c0ea0['query'][_0x9ebd('0x3e')]+'%'};return _0x69aae3;}})});}_0x274c88=_['merge']({},_0x274c88,_0x3c0ea0['options']);var _0x16b958={'where':_0x274c88['where']};return db[_0x9ebd('0x2c')][_0x9ebd('0x40')](_0x16b958)['then'](function(_0x63f56d){_0x14ce33['count']=_0x63f56d;if(_0x3c0ea0[_0x9ebd('0x32')][_0x9ebd('0x41')]){_0x274c88['include']=[{'all':!![]}];}return db[_0x9ebd('0x2c')]['findAll'](_0x274c88);})['then'](function(_0x1bfe41){_0x14ce33[_0x9ebd('0x42')]=_0x1bfe41;return _0x14ce33;})[_0x9ebd('0x23')](respondWithFilteredResult(_0x3c181e,_0x274c88))[_0x9ebd('0x43')](handleError(_0x3c181e,null));};exports[_0x9ebd('0x44')]=function(_0x106f2d,_0x3d31da){var _0x486582={'raw':!![],'where':{'id':_0x106f2d[_0x9ebd('0x45')]['id']}},_0x4c9fc3={};_0x4c9fc3[_0x9ebd('0x31')]=_[_0x9ebd('0x46')](db[_0x9ebd('0x2c')]['rawAttributes']);_0x4c9fc3[_0x9ebd('0x32')]=_[_0x9ebd('0x46')](_0x106f2d['query']);_0x4c9fc3['filters']=_[_0x9ebd('0x34')](_0x4c9fc3['model'],_0x4c9fc3[_0x9ebd('0x32')]);_0x486582[_0x9ebd('0x35')]=_[_0x9ebd('0x34')](_0x4c9fc3['model'],qs[_0x9ebd('0x36')](_0x106f2d[_0x9ebd('0x32')][_0x9ebd('0x36')]));_0x486582[_0x9ebd('0x35')]=_0x486582[_0x9ebd('0x35')]['length']?_0x486582[_0x9ebd('0x35')]:_0x4c9fc3[_0x9ebd('0x31')];if(_0x106f2d[_0x9ebd('0x32')][_0x9ebd('0x41')]){_0x486582[_0x9ebd('0x47')]=[{'all':!![]}];}_0x486582=_[_0x9ebd('0x48')]({},_0x486582,_0x106f2d[_0x9ebd('0x49')]);return db[_0x9ebd('0x2c')][_0x9ebd('0x4a')](_0x486582)[_0x9ebd('0x23')](handleEntityNotFound(_0x3d31da,null))[_0x9ebd('0x23')](respondWithResult(_0x3d31da,null))[_0x9ebd('0x43')](handleError(_0x3d31da,null));};exports[_0x9ebd('0x4b')]=function(_0x5d4ba6,_0x315e7d){return db['Cdr'][_0x9ebd('0x4b')](_0x5d4ba6[_0x9ebd('0x4c')],{})[_0x9ebd('0x23')](respondWithResult(_0x315e7d,0xc9))[_0x9ebd('0x43')](handleError(_0x315e7d,null));};exports[_0x9ebd('0x4d')]=function(_0x1c57c1,_0x324b5f){if(_0x1c57c1[_0x9ebd('0x4c')]['id']){delete _0x1c57c1[_0x9ebd('0x4c')]['id'];}return db[_0x9ebd('0x2c')][_0x9ebd('0x4a')]({'where':{'id':_0x1c57c1['params']['id']}})[_0x9ebd('0x23')](handleEntityNotFound(_0x324b5f,null))[_0x9ebd('0x23')](saveUpdates(_0x1c57c1[_0x9ebd('0x4c')],null))[_0x9ebd('0x23')](respondWithResult(_0x324b5f,null))[_0x9ebd('0x43')](handleError(_0x324b5f,null));};exports[_0x9ebd('0x24')]=function(_0x464c7b,_0x1cc83b){return db[_0x9ebd('0x2c')][_0x9ebd('0x4a')]({'where':{'id':_0x464c7b['params']['id']}})[_0x9ebd('0x23')](handleEntityNotFound(_0x1cc83b,null))['then'](removeEntity(_0x1cc83b,null))[_0x9ebd('0x43')](handleError(_0x1cc83b,null));};exports[_0x9ebd('0x4e')]=function(_0x2fa163,_0x41fc1e){return db[_0x9ebd('0x2c')]['describe']()[_0x9ebd('0x23')](respondWithResult(_0x41fc1e,null))[_0x9ebd('0x43')](handleError(_0x41fc1e,null));}; \ No newline at end of file +var _0xf581=['send','index','map','Cdr','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','limit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','fields','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name'];(function(_0x3227ae,_0x317a3f){var _0x4dc194=function(_0x50df98){while(--_0x50df98){_0x3227ae['push'](_0x3227ae['shift']());}};_0x4dc194(++_0x317a3f);}(_0xf581,0x152));var _0x1f58=function(_0x54fd6b,_0x3f3faa){_0x54fd6b=_0x54fd6b-0x0;var _0xfa3b5e=_0xf581[_0x54fd6b];return _0xfa3b5e;};'use strict';var pdf=require(_0x1f58('0x0'));var emlformat=require(_0x1f58('0x1'));var rimraf=require(_0x1f58('0x2'));var zipdir=require(_0x1f58('0x3'));var jsonpatch=require(_0x1f58('0x4'));var rp=require(_0x1f58('0x5'));var moment=require(_0x1f58('0x6'));var BPromise=require(_0x1f58('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1f58('0x8'));var sox=require(_0x1f58('0x9'));var csv=require(_0x1f58('0xa'));var ejs=require(_0x1f58('0xb'));var fs=require('fs');var _=require(_0x1f58('0xc'));var squel=require(_0x1f58('0xd'));var crypto=require(_0x1f58('0xe'));var jsforce=require(_0x1f58('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1f58('0xa'));var querystring=require(_0x1f58('0x10'));var Papa=require(_0x1f58('0x11'));var Redis=require('ioredis');var authService=require(_0x1f58('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1f58('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f58('0x14'))(_0x1f58('0x15'));var utils=require(_0x1f58('0x16'));var config=require(_0x1f58('0x17'));var licenseUtil=require(_0x1f58('0x18'));var db=require(_0x1f58('0x19'))['db'];function respondWithStatusCode(_0x45729f,_0x40289b){_0x40289b=_0x40289b||0xcc;return function(_0x5415e9){if(_0x5415e9){return _0x45729f[_0x1f58('0x1a')](_0x40289b);}return _0x45729f[_0x1f58('0x1b')](_0x40289b)[_0x1f58('0x1c')]();};}function respondWithResult(_0x3c017d,_0x58844a){_0x58844a=_0x58844a||0xc8;return function(_0xe2e496){if(_0xe2e496){return _0x3c017d[_0x1f58('0x1b')](_0x58844a)[_0x1f58('0x1d')](_0xe2e496);}};}function respondWithFilteredResult(_0x46b467,_0x155e71){return function(_0x4f9644){if(_0x4f9644){var _0x44ea16=_0x4f9644[_0x1f58('0x1e')],_0x4f3cf7=_0x155e71[_0x1f58('0x1f')],_0x3a1548=_0x155e71[_0x1f58('0x1f')]+_0x155e71['limit'],_0x5adeb2;if(_0x3a1548>=_0x44ea16){_0x3a1548=_0x44ea16;_0x5adeb2=0xc8;}else{_0x5adeb2=0xce;}_0x46b467[_0x1f58('0x1b')](_0x5adeb2);return _0x46b467[_0x1f58('0x20')](_0x1f58('0x21'),_0x4f3cf7+'-'+_0x3a1548+'/'+_0x44ea16)[_0x1f58('0x1d')](_0x4f9644);}return null;};}function patchUpdates(_0x59bc4f){return function(_0x5606d0){try{jsonpatch[_0x1f58('0x22')](_0x5606d0,_0x59bc4f,!![]);}catch(_0x6947b4){return BPromise[_0x1f58('0x23')](_0x6947b4);}return _0x5606d0[_0x1f58('0x24')]();};}function saveUpdates(_0x5c5933,_0x3497f2){return function(_0x3ae2e1){if(_0x3ae2e1){return _0x3ae2e1[_0x1f58('0x25')](_0x5c5933)[_0x1f58('0x26')](function(_0x1ca53f){return _0x1ca53f;});}return null;};}function removeEntity(_0x23068b,_0x48e923){return function(_0x51ebbb){if(_0x51ebbb){return _0x51ebbb['destroy']()[_0x1f58('0x26')](function(){_0x23068b[_0x1f58('0x1b')](0xcc)[_0x1f58('0x1c')]();});}};}function handleEntityNotFound(_0x3249ff,_0x516833){return function(_0xa4c2d6){if(!_0xa4c2d6){_0x3249ff['sendStatus'](0x194);}return _0xa4c2d6;};}function handleError(_0x410e11,_0x58eb0e){_0x58eb0e=_0x58eb0e||0x1f4;return function(_0x46a1db){logger[_0x1f58('0x27')](_0x46a1db[_0x1f58('0x28')]);if(_0x46a1db[_0x1f58('0x29')]){delete _0x46a1db[_0x1f58('0x29')];}_0x410e11[_0x1f58('0x1b')](_0x58eb0e)[_0x1f58('0x2a')](_0x46a1db);};}exports[_0x1f58('0x2b')]=function(_0x19c2f7,_0x3ef2c5){var _0x26beeb={},_0x4ca6ad={},_0x6c4fe7={'count':0x0,'rows':[]};var _0x2fa875=_[_0x1f58('0x2c')](db[_0x1f58('0x2d')]['rawAttributes'],function(_0x29d3a9){return{'name':_0x29d3a9[_0x1f58('0x2e')],'type':_0x29d3a9[_0x1f58('0x2f')]['key']};});_0x4ca6ad[_0x1f58('0x30')]=_[_0x1f58('0x2c')](_0x2fa875,_0x1f58('0x29'));_0x4ca6ad[_0x1f58('0x31')]=_[_0x1f58('0x32')](_0x19c2f7[_0x1f58('0x31')]);_0x4ca6ad[_0x1f58('0x33')]=_[_0x1f58('0x34')](_0x4ca6ad[_0x1f58('0x30')],_0x4ca6ad[_0x1f58('0x31')]);_0x26beeb[_0x1f58('0x35')]=_[_0x1f58('0x34')](_0x4ca6ad[_0x1f58('0x30')],qs['fields'](_0x19c2f7[_0x1f58('0x31')]['fields']));_0x26beeb[_0x1f58('0x35')]=_0x26beeb[_0x1f58('0x35')][_0x1f58('0x36')]?_0x26beeb[_0x1f58('0x35')]:_0x4ca6ad['model'];if(!_0x19c2f7[_0x1f58('0x31')][_0x1f58('0x37')]('nolimit')){_0x26beeb[_0x1f58('0x38')]=qs[_0x1f58('0x38')](_0x19c2f7[_0x1f58('0x31')]['limit']);_0x26beeb[_0x1f58('0x1f')]=qs[_0x1f58('0x1f')](_0x19c2f7[_0x1f58('0x31')][_0x1f58('0x1f')]);}_0x26beeb[_0x1f58('0x39')]=qs[_0x1f58('0x3a')](_0x19c2f7[_0x1f58('0x31')][_0x1f58('0x3a')]);_0x26beeb[_0x1f58('0x3b')]=qs['filters'](_[_0x1f58('0x3c')](_0x19c2f7[_0x1f58('0x31')],_0x4ca6ad[_0x1f58('0x33')]),_0x2fa875);if(_0x19c2f7[_0x1f58('0x31')]['filter']){_0x26beeb[_0x1f58('0x3b')]=_[_0x1f58('0x3d')](_0x26beeb[_0x1f58('0x3b')],{'$or':_[_0x1f58('0x2c')](_0x2fa875,function(_0x1900e8){if(_0x1900e8[_0x1f58('0x2f')]!=='VIRTUAL'){var _0x2b557b={};_0x2b557b[_0x1900e8[_0x1f58('0x29')]]={'$like':'%'+_0x19c2f7[_0x1f58('0x31')][_0x1f58('0x3e')]+'%'};return _0x2b557b;}})});}_0x26beeb=_['merge']({},_0x26beeb,_0x19c2f7[_0x1f58('0x3f')]);var _0x1ffcfd={'where':_0x26beeb[_0x1f58('0x3b')]};return db['Cdr']['count'](_0x1ffcfd)[_0x1f58('0x26')](function(_0x47946f){_0x6c4fe7[_0x1f58('0x1e')]=_0x47946f;if(_0x19c2f7['query'][_0x1f58('0x40')]){_0x26beeb[_0x1f58('0x41')]=[{'all':!![]}];}return db[_0x1f58('0x2d')][_0x1f58('0x42')](_0x26beeb);})[_0x1f58('0x26')](function(_0xf3ff52){_0x6c4fe7['rows']=_0xf3ff52;return _0x6c4fe7;})[_0x1f58('0x26')](respondWithFilteredResult(_0x3ef2c5,_0x26beeb))[_0x1f58('0x43')](handleError(_0x3ef2c5,null));};exports[_0x1f58('0x44')]=function(_0x5e4ec2,_0x4d5577){var _0x1e933e={'raw':!![],'where':{'id':_0x5e4ec2[_0x1f58('0x45')]['id']}},_0x368166={};_0x368166[_0x1f58('0x30')]=_[_0x1f58('0x32')](db[_0x1f58('0x2d')]['rawAttributes']);_0x368166[_0x1f58('0x31')]=_['keys'](_0x5e4ec2[_0x1f58('0x31')]);_0x368166[_0x1f58('0x33')]=_[_0x1f58('0x34')](_0x368166[_0x1f58('0x30')],_0x368166[_0x1f58('0x31')]);_0x1e933e['attributes']=_['intersection'](_0x368166['model'],qs[_0x1f58('0x46')](_0x5e4ec2[_0x1f58('0x31')][_0x1f58('0x46')]));_0x1e933e[_0x1f58('0x35')]=_0x1e933e[_0x1f58('0x35')][_0x1f58('0x36')]?_0x1e933e[_0x1f58('0x35')]:_0x368166[_0x1f58('0x30')];if(_0x5e4ec2['query']['includeAll']){_0x1e933e[_0x1f58('0x41')]=[{'all':!![]}];}_0x1e933e=_[_0x1f58('0x3d')]({},_0x1e933e,_0x5e4ec2[_0x1f58('0x3f')]);return db[_0x1f58('0x2d')][_0x1f58('0x47')](_0x1e933e)[_0x1f58('0x26')](handleEntityNotFound(_0x4d5577,null))['then'](respondWithResult(_0x4d5577,null))[_0x1f58('0x43')](handleError(_0x4d5577,null));};exports['create']=function(_0x2a7f98,_0x53ff13){return db[_0x1f58('0x2d')][_0x1f58('0x48')](_0x2a7f98[_0x1f58('0x49')],{})[_0x1f58('0x26')](respondWithResult(_0x53ff13,0xc9))[_0x1f58('0x43')](handleError(_0x53ff13,null));};exports[_0x1f58('0x25')]=function(_0x395931,_0x187c97){if(_0x395931[_0x1f58('0x49')]['id']){delete _0x395931[_0x1f58('0x49')]['id'];}return db[_0x1f58('0x2d')][_0x1f58('0x47')]({'where':{'id':_0x395931[_0x1f58('0x45')]['id']}})[_0x1f58('0x26')](handleEntityNotFound(_0x187c97,null))[_0x1f58('0x26')](saveUpdates(_0x395931[_0x1f58('0x49')],null))[_0x1f58('0x26')](respondWithResult(_0x187c97,null))[_0x1f58('0x43')](handleError(_0x187c97,null));};exports[_0x1f58('0x4a')]=function(_0x8f325f,_0x55b59a){return db[_0x1f58('0x2d')][_0x1f58('0x47')]({'where':{'id':_0x8f325f[_0x1f58('0x45')]['id']}})[_0x1f58('0x26')](handleEntityNotFound(_0x55b59a,null))['then'](removeEntity(_0x55b59a,null))['catch'](handleError(_0x55b59a,null));};exports[_0x1f58('0x4b')]=function(_0x3170e7,_0xf31ef4){return db[_0x1f58('0x2d')][_0x1f58('0x4b')]()['then'](respondWithResult(_0xf31ef4,null))[_0x1f58('0x43')](handleError(_0xf31ef4,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index c960942..2f80f34 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 _0x4c60=['../../config/logger','api','bluebird','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition','src','uniqueid','lodash','util'];(function(_0x3a18eb,_0xc994e0){var _0x43dbf3=function(_0x37e6f6){while(--_0x37e6f6){_0x3a18eb['push'](_0x3a18eb['shift']());}};_0x43dbf3(++_0xc994e0);}(_0x4c60,0xc1));var _0x04c6=function(_0x17180f,_0x21ecbc){_0x17180f=_0x17180f-0x0;var _0x53ead4=_0x4c60[_0x17180f];return _0x53ead4;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var logger=require(_0x04c6('0x2'))(_0x04c6('0x3'));var moment=require('moment');var BPromise=require(_0x04c6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x04c6('0x5'));module[_0x04c6('0x6')]=function(_0x2054da,_0x12bd5d){return _0x2054da[_0x04c6('0x7')](_0x04c6('0x8'),attributes,{'tableName':_0x04c6('0x9'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x04c6('0xa')]},{'name':_0x04c6('0xb'),'fields':[_0x04c6('0xb')]},{'name':_0x04c6('0xc'),'fields':['disposition']},{'name':'dst','fields':['dst']},{'name':_0x04c6('0xd'),'fields':['src']},{'name':_0x04c6('0xe'),'fields':[_0x04c6('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x71ab=['exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes'];(function(_0x5d32ea,_0x2a9b4e){var _0x5de719=function(_0x559463){while(--_0x559463){_0x5d32ea['push'](_0x5d32ea['shift']());}};_0x5de719(++_0x2a9b4e);}(_0x71ab,0x64));var _0xb71a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x71ab[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));module[_0xb71a('0x8')]=function(_0x38d931,_0x22c072){return _0x38d931[_0xb71a('0x9')](_0xb71a('0xa'),attributes,{'tableName':_0xb71a('0xb'),'paranoid':![],'indexes':[{'name':_0xb71a('0xc'),'fields':[_0xb71a('0xc')]},{'name':_0xb71a('0xd'),'fields':[_0xb71a('0xd')]},{'name':_0xb71a('0xe'),'fields':[_0xb71a('0xe')]},{'name':'dst','fields':[_0xb71a('0xf')]},{'name':'src','fields':[_0xb71a('0x10')]},{'name':_0xb71a('0x11'),'fields':[_0xb71a('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index faa3d56..57497af 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 _0x5ce1=['client','then','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x5ce1,0xd1));var _0x15ce=function(_0x1a3a4e,_0x50b487){_0x1a3a4e=_0x1a3a4e-0x0;var _0x3905ca=_0x5ce1[_0x1a3a4e];return _0x3905ca;};'use strict';var _=require(_0x15ce('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x15ce('0x1'));var rs=require(_0x15ce('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15ce('0x3'));var logger=require('../../config/logger')(_0x15ce('0x4'));var config=require(_0x15ce('0x5'));var jayson=require(_0x15ce('0x6'));var client=jayson[_0x15ce('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x399c80,_0x3d6501,_0x47688d){return new BPromise(function(_0x3c6df4,_0xee0479){return client['request'](_0x399c80,_0x47688d)[_0x15ce('0x8')](function(_0x1a3d2a){logger['info'](_0x15ce('0x9'),_0x3d6501,'request\x20sent');logger[_0x15ce('0xa')](_0x15ce('0xb'),_0x3d6501,_0x15ce('0xc'),JSON[_0x15ce('0xd')](_0x1a3d2a));if(_0x1a3d2a[_0x15ce('0xe')]){if(_0x1a3d2a[_0x15ce('0xe')]['code']===0x1f4){logger[_0x15ce('0xe')](_0x15ce('0x9'),_0x3d6501,_0x1a3d2a[_0x15ce('0xe')][_0x15ce('0xf')]);return _0xee0479(_0x1a3d2a[_0x15ce('0xe')]['message']);}logger['error'](_0x15ce('0x9'),_0x3d6501,_0x1a3d2a['error'][_0x15ce('0xf')]);return _0x3c6df4(_0x1a3d2a[_0x15ce('0xe')][_0x15ce('0xf')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x3d6501,_0x15ce('0xc'));_0x3c6df4(_0x1a3d2a[_0x15ce('0x10')][_0x15ce('0xf')]);}})[_0x15ce('0x11')](function(_0x37ba29){logger[_0x15ce('0xe')]('Cdr,\x20%s,\x20%s',_0x3d6501,_0x37ba29);_0xee0479(_0x37ba29);});});} \ No newline at end of file +var _0x09de=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x3527d2,_0x1c0b3c){var _0x3a28b7=function(_0x9bf4fd){while(--_0x9bf4fd){_0x3527d2['push'](_0x3527d2['shift']());}};_0x3a28b7(++_0x1c0b3c);}(_0x09de,0xbc));var _0xe09d=function(_0x3c59fc,_0x10dbd2){_0x3c59fc=_0x3c59fc-0x0;var _0x2b78d4=_0x09de[_0x3c59fc];return _0x2b78d4;};'use strict';var _=require(_0xe09d('0x0'));var util=require(_0xe09d('0x1'));var moment=require('moment');var BPromise=require(_0xe09d('0x2'));var rs=require(_0xe09d('0x3'));var fs=require('fs');var Redis=require(_0xe09d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe09d('0x5'));var logger=require(_0xe09d('0x6'))(_0xe09d('0x7'));var config=require(_0xe09d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe09d('0x9')][_0xe09d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17da0b,_0x3041f6,_0x299880){return new BPromise(function(_0x50823c,_0x290793){return client[_0xe09d('0xb')](_0x17da0b,_0x299880)[_0xe09d('0xc')](function(_0x44c92e){logger['info'](_0xe09d('0xd'),_0x3041f6,_0xe09d('0xe'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x3041f6,_0xe09d('0xe'),JSON[_0xe09d('0xf')](_0x44c92e));if(_0x44c92e[_0xe09d('0x10')]){if(_0x44c92e['error'][_0xe09d('0x11')]===0x1f4){logger[_0xe09d('0x10')](_0xe09d('0xd'),_0x3041f6,_0x44c92e[_0xe09d('0x10')]['message']);return _0x290793(_0x44c92e['error'][_0xe09d('0x12')]);}logger['error'](_0xe09d('0xd'),_0x3041f6,_0x44c92e[_0xe09d('0x10')]['message']);return _0x50823c(_0x44c92e['error'][_0xe09d('0x12')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x3041f6,_0xe09d('0xe'));_0x50823c(_0x44c92e[_0xe09d('0x13')]['message']);}})[_0xe09d('0x14')](function(_0x4c8fdf){logger[_0xe09d('0x10')]('Cdr,\x20%s,\x20%s',_0x3041f6,_0x4c8fdf);_0x290793(_0x4c8fdf);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index f238aef..726b3ca 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 _0x35d5=['get','show','/:id','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','isAuthenticated','describe'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x35d5,0xf0));var _0x535d=function(_0xad50e0,_0x42923a){_0xad50e0=_0xad50e0-0x0;var _0x1166df=_0x35d5[_0xad50e0];return _0x1166df;};'use strict';var multer=require(_0x535d('0x0'));var util=require('util');var path=require(_0x535d('0x1'));var timeout=require(_0x535d('0x2'));var express=require(_0x535d('0x3'));var router=express[_0x535d('0x4')]();var auth=require(_0x535d('0x5'));var interaction=require(_0x535d('0x6'));var config=require(_0x535d('0x7'));var controller=require('./cdr.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x535d('0x8')]);router['get'](_0x535d('0x9'),auth[_0x535d('0xa')](),controller[_0x535d('0xb')]);router[_0x535d('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x535d('0xd')]);router['post']('/',auth[_0x535d('0xa')](),controller['create']);router['put'](_0x535d('0xe'),auth[_0x535d('0xa')](),controller['update']);router[_0x535d('0xf')](_0x535d('0xe'),auth[_0x535d('0xa')](),controller[_0x535d('0x10')]);module[_0x535d('0x11')]=router; \ No newline at end of file +var _0x8f41=['update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','index','describe','/:id','show','post','put'];(function(_0x3dfabb,_0x58a0db){var _0x54103d=function(_0x287da5){while(--_0x287da5){_0x3dfabb['push'](_0x3dfabb['shift']());}};_0x54103d(++_0x58a0db);}(_0x8f41,0x144));var _0x18f4=function(_0x2b1283,_0x4ff5ed){_0x2b1283=_0x2b1283-0x0;var _0x3fa744=_0x8f41[_0x2b1283];return _0x3fa744;};'use strict';var multer=require(_0x18f4('0x0'));var util=require(_0x18f4('0x1'));var path=require(_0x18f4('0x2'));var timeout=require('connect-timeout');var express=require(_0x18f4('0x3'));var router=express[_0x18f4('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x18f4('0x5'));var config=require(_0x18f4('0x6'));var controller=require(_0x18f4('0x7'));router[_0x18f4('0x8')]('/',auth[_0x18f4('0x9')](),controller[_0x18f4('0xa')]);router[_0x18f4('0x8')]('/describe',auth[_0x18f4('0x9')](),controller[_0x18f4('0xb')]);router['get'](_0x18f4('0xc'),auth['isAuthenticated'](),controller[_0x18f4('0xd')]);router[_0x18f4('0xe')]('/',auth[_0x18f4('0x9')](),controller['create']);router[_0x18f4('0xf')](_0x18f4('0xc'),auth['isAuthenticated'](),controller[_0x18f4('0x10')]);router[_0x18f4('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x18f4('0x12')]);module[_0x18f4('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 50cfecb..3b32f40 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 _0x9cb1=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x9cb1,0xd0));var _0x19cb=function(_0xddb6b4,_0x36c947){_0xddb6b4=_0xddb6b4-0x0;var _0x4cbc03=_0x9cb1[_0xddb6b4];return _0x4cbc03;};'use strict';var Sequelize=require(_0x19cb('0x0'));module[_0x19cb('0x1')]={'priority':{'type':Sequelize[_0x19cb('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x19cb('0x3')],'allowNull':![],'defaultValue':_0x19cb('0x4')},'appdata':{'type':Sequelize[_0x19cb('0x5')]()},'description':{'type':Sequelize[_0x19cb('0x3')]},'interval':{'type':Sequelize[_0x19cb('0x3')],'defaultValue':_0x19cb('0x6')}}; \ No newline at end of file +var _0xd3e7=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x2ede5a,_0x28bdef){var _0x4d8fae=function(_0x144983){while(--_0x144983){_0x2ede5a['push'](_0x2ede5a['shift']());}};_0x4d8fae(++_0x28bdef);}(_0xd3e7,0x1df));var _0x7d3e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd3e7[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x7d3e('0x0'));module[_0x7d3e('0x1')]={'priority':{'type':Sequelize[_0x7d3e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7d3e('0x3')],'allowNull':![],'defaultValue':_0x7d3e('0x4')},'appdata':{'type':Sequelize[_0x7d3e('0x5')]()},'description':{'type':Sequelize[_0x7d3e('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 3b83660..de6b897 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 _0x2054=['destroy','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','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','update','then','error','stack','name','send','show','params','ChatApplication','rawAttributes','query','keys','filters','intersection','model','attributes','fields','includeAll','find','catch','body'];(function(_0x25780e,_0x30e7a8){var _0x5c34ba=function(_0x58a1f4){while(--_0x58a1f4){_0x25780e['push'](_0x25780e['shift']());}};_0x5c34ba(++_0x30e7a8);}(_0x2054,0x1b3));var _0x4205=function(_0xbec196,_0x1e46a6){_0xbec196=_0xbec196-0x0;var _0x10972b=_0x2054[_0xbec196];return _0x10972b;};'use strict';var pdf=require(_0x4205('0x0'));var emlformat=require(_0x4205('0x1'));var rimraf=require(_0x4205('0x2'));var zipdir=require(_0x4205('0x3'));var jsonpatch=require(_0x4205('0x4'));var rp=require(_0x4205('0x5'));var moment=require(_0x4205('0x6'));var BPromise=require(_0x4205('0x7'));var Mustache=require(_0x4205('0x8'));var util=require(_0x4205('0x9'));var path=require(_0x4205('0xa'));var sox=require(_0x4205('0xb'));var csv=require(_0x4205('0xc'));var ejs=require(_0x4205('0xd'));var fs=require('fs');var _=require(_0x4205('0xe'));var squel=require(_0x4205('0xf'));var crypto=require(_0x4205('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x4205('0x11'));var toCsv=require('to-csv');var querystring=require(_0x4205('0x12'));var Papa=require(_0x4205('0x13'));var Redis=require(_0x4205('0x14'));var authService=require(_0x4205('0x15'));var qs=require(_0x4205('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4205('0x17'));var logger=require(_0x4205('0x18'))(_0x4205('0x19'));var utils=require(_0x4205('0x1a'));var config=require(_0x4205('0x1b'));var licenseUtil=require(_0x4205('0x1c'));var db=require(_0x4205('0x1d'))['db'];function respondWithStatusCode(_0x2baaf7,_0x2f5039){_0x2f5039=_0x2f5039||0xcc;return function(_0x37ae22){if(_0x37ae22){return _0x2baaf7[_0x4205('0x1e')](_0x2f5039);}return _0x2baaf7[_0x4205('0x1f')](_0x2f5039)[_0x4205('0x20')]();};}function respondWithResult(_0x16cc4b,_0x1f1e1b){_0x1f1e1b=_0x1f1e1b||0xc8;return function(_0x213ceb){if(_0x213ceb){return _0x16cc4b[_0x4205('0x1f')](_0x1f1e1b)['json'](_0x213ceb);}};}function respondWithFilteredResult(_0x4a3960,_0xd4ae92){return function(_0x4b7a9f){if(_0x4b7a9f){var _0x39fcac=_0x4b7a9f[_0x4205('0x21')],_0x4ada9c=_0xd4ae92[_0x4205('0x22')],_0x449e86=_0xd4ae92[_0x4205('0x22')]+_0xd4ae92[_0x4205('0x23')],_0xf779a;if(_0x449e86>=_0x39fcac){_0x449e86=_0x39fcac;_0xf779a=0xc8;}else{_0xf779a=0xce;}_0x4a3960['status'](_0xf779a);return _0x4a3960['set'](_0x4205('0x24'),_0x4ada9c+'-'+_0x449e86+'/'+_0x39fcac)[_0x4205('0x25')](_0x4b7a9f);}return null;};}function patchUpdates(_0x1c3e62){return function(_0x349b20){try{jsonpatch[_0x4205('0x26')](_0x349b20,_0x1c3e62,!![]);}catch(_0x181d43){return BPromise[_0x4205('0x27')](_0x181d43);}return _0x349b20['save']();};}function saveUpdates(_0x1736f2,_0x2cc8cd){return function(_0xee301f){if(_0xee301f){return _0xee301f[_0x4205('0x28')](_0x1736f2)[_0x4205('0x29')](function(_0x320d4a){return _0x320d4a;});}return null;};}function removeEntity(_0x3f5e95,_0x56c8a9){return function(_0x27c66a){if(_0x27c66a){return _0x27c66a['destroy']()[_0x4205('0x29')](function(){_0x3f5e95[_0x4205('0x1f')](0xcc)[_0x4205('0x20')]();});}};}function handleEntityNotFound(_0x323c5b,_0x5b9c9a){return function(_0xa2eb22){if(!_0xa2eb22){_0x323c5b['sendStatus'](0x194);}return _0xa2eb22;};}function handleError(_0x29d585,_0x407ac0){_0x407ac0=_0x407ac0||0x1f4;return function(_0x3f58ce){logger[_0x4205('0x2a')](_0x3f58ce[_0x4205('0x2b')]);if(_0x3f58ce[_0x4205('0x2c')]){delete _0x3f58ce[_0x4205('0x2c')];}_0x29d585[_0x4205('0x1f')](_0x407ac0)[_0x4205('0x2d')](_0x3f58ce);};}exports[_0x4205('0x2e')]=function(_0x1e5e6c,_0x28b728){var _0x472b38={'raw':!![],'where':{'id':_0x1e5e6c[_0x4205('0x2f')]['id']}},_0x4a7d38={};_0x4a7d38['model']=_['keys'](db[_0x4205('0x30')][_0x4205('0x31')]);_0x4a7d38[_0x4205('0x32')]=_[_0x4205('0x33')](_0x1e5e6c[_0x4205('0x32')]);_0x4a7d38[_0x4205('0x34')]=_[_0x4205('0x35')](_0x4a7d38[_0x4205('0x36')],_0x4a7d38[_0x4205('0x32')]);_0x472b38[_0x4205('0x37')]=_['intersection'](_0x4a7d38['model'],qs[_0x4205('0x38')](_0x1e5e6c['query'][_0x4205('0x38')]));_0x472b38[_0x4205('0x37')]=_0x472b38[_0x4205('0x37')]['length']?_0x472b38[_0x4205('0x37')]:_0x4a7d38[_0x4205('0x36')];if(_0x1e5e6c[_0x4205('0x32')][_0x4205('0x39')]){_0x472b38['include']=[{'all':!![]}];}_0x472b38=_['merge']({},_0x472b38,_0x1e5e6c['options']);return db['ChatApplication'][_0x4205('0x3a')](_0x472b38)[_0x4205('0x29')](handleEntityNotFound(_0x28b728,null))['then'](respondWithResult(_0x28b728,null))[_0x4205('0x3b')](handleError(_0x28b728,null));};exports[_0x4205('0x28')]=function(_0x2b737d,_0x513243){if(_0x2b737d[_0x4205('0x3c')]['id']){delete _0x2b737d[_0x4205('0x3c')]['id'];}return db[_0x4205('0x30')][_0x4205('0x3a')]({'where':{'id':_0x2b737d[_0x4205('0x2f')]['id']}})[_0x4205('0x29')](handleEntityNotFound(_0x513243,null))['then'](saveUpdates(_0x2b737d[_0x4205('0x3c')],null))['then'](respondWithResult(_0x513243,null))[_0x4205('0x3b')](handleError(_0x513243,null));};exports[_0x4205('0x3d')]=function(_0x361d18,_0x128307){return db[_0x4205('0x30')][_0x4205('0x3a')]({'where':{'id':_0x361d18[_0x4205('0x2f')]['id']}})[_0x4205('0x29')](handleEntityNotFound(_0x128307,null))[_0x4205('0x29')](removeEntity(_0x128307,null))[_0x4205('0x3b')](handleError(_0x128307,null));}; \ No newline at end of file +var _0xe65c=['rimraf','zip-dir','fast-json-patch','moment','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','status','json','count','offset','limit','set','Content-Range','then','destroy','sendStatus','stack','send','show','params','model','ChatApplication','query','keys','filters','intersection','attributes','fields','includeAll','options','find','update','body','html-pdf','eml-format'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe65c,0x19e));var _0xce65=function(_0x11f0e3,_0x5170bc){_0x11f0e3=_0x11f0e3-0x0;var _0x2892e8=_0xe65c[_0x11f0e3];return _0x2892e8;};'use strict';var pdf=require(_0xce65('0x0'));var emlformat=require(_0xce65('0x1'));var rimraf=require(_0xce65('0x2'));var zipdir=require(_0xce65('0x3'));var jsonpatch=require(_0xce65('0x4'));var rp=require('request-promise');var moment=require(_0xce65('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xce65('0x6'));var util=require(_0xce65('0x7'));var path=require('path');var sox=require(_0xce65('0x8'));var csv=require(_0xce65('0x9'));var ejs=require(_0xce65('0xa'));var fs=require('fs');var _=require(_0xce65('0xb'));var squel=require(_0xce65('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xce65('0xd'));var toCsv=require(_0xce65('0x9'));var querystring=require(_0xce65('0xe'));var Papa=require(_0xce65('0xf'));var Redis=require(_0xce65('0x10'));var authService=require(_0xce65('0x11'));var qs=require(_0xce65('0x12'));var as=require(_0xce65('0x13'));var hardwareService=require(_0xce65('0x14'));var logger=require(_0xce65('0x15'))('api');var utils=require(_0xce65('0x16'));var config=require(_0xce65('0x17'));var licenseUtil=require(_0xce65('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5caa71,_0x2d8252){_0x2d8252=_0x2d8252||0xcc;return function(_0x4b9072){if(_0x4b9072){return _0x5caa71['sendStatus'](_0x2d8252);}return _0x5caa71['status'](_0x2d8252)['end']();};}function respondWithResult(_0x47d1eb,_0xf6ba1b){_0xf6ba1b=_0xf6ba1b||0xc8;return function(_0x385f11){if(_0x385f11){return _0x47d1eb[_0xce65('0x19')](_0xf6ba1b)[_0xce65('0x1a')](_0x385f11);}};}function respondWithFilteredResult(_0x367d5c,_0x5a9a1b){return function(_0x1ba62b){if(_0x1ba62b){var _0x4a10a1=_0x1ba62b[_0xce65('0x1b')],_0x326bd4=_0x5a9a1b['offset'],_0x506422=_0x5a9a1b[_0xce65('0x1c')]+_0x5a9a1b[_0xce65('0x1d')],_0x3b864d;if(_0x506422>=_0x4a10a1){_0x506422=_0x4a10a1;_0x3b864d=0xc8;}else{_0x3b864d=0xce;}_0x367d5c[_0xce65('0x19')](_0x3b864d);return _0x367d5c[_0xce65('0x1e')](_0xce65('0x1f'),_0x326bd4+'-'+_0x506422+'/'+_0x4a10a1)[_0xce65('0x1a')](_0x1ba62b);}return null;};}function patchUpdates(_0x3b5607){return function(_0x42bdf2){try{jsonpatch['apply'](_0x42bdf2,_0x3b5607,!![]);}catch(_0x580dcb){return BPromise['reject'](_0x580dcb);}return _0x42bdf2['save']();};}function saveUpdates(_0x1115f6,_0x17f9d1){return function(_0x513859){if(_0x513859){return _0x513859['update'](_0x1115f6)[_0xce65('0x20')](function(_0x590924){return _0x590924;});}return null;};}function removeEntity(_0x123ecb,_0x30423a){return function(_0x4d7f40){if(_0x4d7f40){return _0x4d7f40[_0xce65('0x21')]()[_0xce65('0x20')](function(){_0x123ecb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54491d,_0xd8dcb7){return function(_0x5da5e6){if(!_0x5da5e6){_0x54491d[_0xce65('0x22')](0x194);}return _0x5da5e6;};}function handleError(_0x58fcdd,_0x5ea9b0){_0x5ea9b0=_0x5ea9b0||0x1f4;return function(_0x3a88a9){logger['error'](_0x3a88a9[_0xce65('0x23')]);if(_0x3a88a9['name']){delete _0x3a88a9['name'];}_0x58fcdd[_0xce65('0x19')](_0x5ea9b0)[_0xce65('0x24')](_0x3a88a9);};}exports[_0xce65('0x25')]=function(_0x58ee16,_0x1f33c6){var _0x261753={'raw':!![],'where':{'id':_0x58ee16[_0xce65('0x26')]['id']}},_0x1f4b3b={};_0x1f4b3b[_0xce65('0x27')]=_['keys'](db[_0xce65('0x28')]['rawAttributes']);_0x1f4b3b[_0xce65('0x29')]=_[_0xce65('0x2a')](_0x58ee16[_0xce65('0x29')]);_0x1f4b3b[_0xce65('0x2b')]=_[_0xce65('0x2c')](_0x1f4b3b[_0xce65('0x27')],_0x1f4b3b[_0xce65('0x29')]);_0x261753[_0xce65('0x2d')]=_[_0xce65('0x2c')](_0x1f4b3b['model'],qs[_0xce65('0x2e')](_0x58ee16[_0xce65('0x29')][_0xce65('0x2e')]));_0x261753['attributes']=_0x261753['attributes']['length']?_0x261753[_0xce65('0x2d')]:_0x1f4b3b[_0xce65('0x27')];if(_0x58ee16[_0xce65('0x29')][_0xce65('0x2f')]){_0x261753['include']=[{'all':!![]}];}_0x261753=_['merge']({},_0x261753,_0x58ee16[_0xce65('0x30')]);return db['ChatApplication'][_0xce65('0x31')](_0x261753)[_0xce65('0x20')](handleEntityNotFound(_0x1f33c6,null))[_0xce65('0x20')](respondWithResult(_0x1f33c6,null))['catch'](handleError(_0x1f33c6,null));};exports[_0xce65('0x32')]=function(_0x4c4a65,_0x408696){if(_0x4c4a65[_0xce65('0x33')]['id']){delete _0x4c4a65[_0xce65('0x33')]['id'];}return db[_0xce65('0x28')][_0xce65('0x31')]({'where':{'id':_0x4c4a65[_0xce65('0x26')]['id']}})[_0xce65('0x20')](handleEntityNotFound(_0x408696,null))[_0xce65('0x20')](saveUpdates(_0x4c4a65[_0xce65('0x33')],null))[_0xce65('0x20')](respondWithResult(_0x408696,null))['catch'](handleError(_0x408696,null));};exports['destroy']=function(_0x5a5f6b,_0x3348fc){return db['ChatApplication'][_0xce65('0x31')]({'where':{'id':_0x5a5f6b[_0xce65('0x26')]['id']}})[_0xce65('0x20')](handleEntityNotFound(_0x3348fc,null))['then'](removeEntity(_0x3348fc,null))['catch'](handleError(_0x3348fc,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index eaf6f2d..a29140f 100644 --- a/server/api/chatApplication/chatApplication.model.js +++ b/server/api/chatApplication/chatApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 f13d8b9..c511e4f 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 _0xdb60=['result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','error','code','ChatApplication,\x20%s,\x20%s','message'];(function(_0x325122,_0x5d267c){var _0x58138f=function(_0x24b375){while(--_0x24b375){_0x325122['push'](_0x325122['shift']());}};_0x58138f(++_0x5d267c);}(_0xdb60,0xd3));var _0x0db6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdb60[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0db6('0x0'));var util=require('util');var moment=require(_0x0db6('0x1'));var BPromise=require(_0x0db6('0x2'));var rs=require(_0x0db6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0db6('0x4'));var logger=require(_0x0db6('0x5'))('rpc');var config=require(_0x0db6('0x6'));var jayson=require(_0x0db6('0x7'));var client=jayson[_0x0db6('0x8')][_0x0db6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b02f6,_0x220308,_0x49656d){return new BPromise(function(_0x1c051b,_0x48e6a7){return client[_0x0db6('0xa')](_0x5b02f6,_0x49656d)['then'](function(_0x3e4c40){logger[_0x0db6('0xb')]('ChatApplication,\x20%s,\x20%s',_0x220308,_0x0db6('0xc'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x220308,'request\x20sent',JSON['stringify'](_0x3e4c40));if(_0x3e4c40[_0x0db6('0xd')]){if(_0x3e4c40[_0x0db6('0xd')][_0x0db6('0xe')]===0x1f4){logger[_0x0db6('0xd')](_0x0db6('0xf'),_0x220308,_0x3e4c40[_0x0db6('0xd')]['message']);return _0x48e6a7(_0x3e4c40[_0x0db6('0xd')][_0x0db6('0x10')]);}logger[_0x0db6('0xd')](_0x0db6('0xf'),_0x220308,_0x3e4c40[_0x0db6('0xd')][_0x0db6('0x10')]);return _0x1c051b(_0x3e4c40['error'][_0x0db6('0x10')]);}else{logger['info'](_0x0db6('0xf'),_0x220308,'request\x20sent');_0x1c051b(_0x3e4c40[_0x0db6('0x11')][_0x0db6('0x10')]);}})[_0x0db6('0x12')](function(_0x4c2432){logger[_0x0db6('0xd')](_0x0db6('0xf'),_0x220308,_0x4c2432);_0x48e6a7(_0x4c2432);});});} \ No newline at end of file +var _0x4fab=['debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ChatApplication,\x20%s,\x20%s','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1ae3f1,_0x3bb221){var _0x328e33=function(_0x4e46eb){while(--_0x4e46eb){_0x1ae3f1['push'](_0x1ae3f1['shift']());}};_0x328e33(++_0x3bb221);}(_0x4fab,0xc8));var _0xb4fa=function(_0x1a6ad4,_0x753e8a){_0x1a6ad4=_0x1a6ad4-0x0;var _0xe68db5=_0x4fab[_0x1a6ad4];return _0xe68db5;};'use strict';var _=require(_0xb4fa('0x0'));var util=require(_0xb4fa('0x1'));var moment=require('moment');var BPromise=require(_0xb4fa('0x2'));var rs=require(_0xb4fa('0x3'));var fs=require('fs');var Redis=require(_0xb4fa('0x4'));var db=require(_0xb4fa('0x5'))['db'];var utils=require(_0xb4fa('0x6'));var logger=require(_0xb4fa('0x7'))(_0xb4fa('0x8'));var config=require(_0xb4fa('0x9'));var jayson=require(_0xb4fa('0xa'));var client=jayson[_0xb4fa('0xb')][_0xb4fa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f4225,_0x169eba,_0x3291fc){return new BPromise(function(_0x2b4578,_0xd46a9){return client[_0xb4fa('0xd')](_0x3f4225,_0x3291fc)[_0xb4fa('0xe')](function(_0x50d37a){logger[_0xb4fa('0xf')]('ChatApplication,\x20%s,\x20%s',_0x169eba,'request\x20sent');logger[_0xb4fa('0x10')](_0xb4fa('0x11'),_0x169eba,_0xb4fa('0x12'),JSON[_0xb4fa('0x13')](_0x50d37a));if(_0x50d37a[_0xb4fa('0x14')]){if(_0x50d37a[_0xb4fa('0x14')]['code']===0x1f4){logger[_0xb4fa('0x14')]('ChatApplication,\x20%s,\x20%s',_0x169eba,_0x50d37a['error'][_0xb4fa('0x15')]);return _0xd46a9(_0x50d37a[_0xb4fa('0x14')][_0xb4fa('0x15')]);}logger['error'](_0xb4fa('0x16'),_0x169eba,_0x50d37a[_0xb4fa('0x14')]['message']);return _0x2b4578(_0x50d37a[_0xb4fa('0x14')][_0xb4fa('0x15')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x169eba,'request\x20sent');_0x2b4578(_0x50d37a[_0xb4fa('0x17')][_0xb4fa('0x15')]);}})['catch'](function(_0x42ba80){logger[_0xb4fa('0x14')]('ChatApplication,\x20%s,\x20%s',_0x169eba,_0x42ba80);_0xd46a9(_0x42ba80);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 50ed117..d0e0a8a 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 _0x5f95=['isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./chatApplication.controller','get','/:id'];(function(_0x34af0b,_0x253206){var _0x49e017=function(_0x4d1c5a){while(--_0x4d1c5a){_0x34af0b['push'](_0x34af0b['shift']());}};_0x49e017(++_0x253206);}(_0x5f95,0xb7));var _0x55f9=function(_0x4ab3f6,_0x354c1b){_0x4ab3f6=_0x4ab3f6-0x0;var _0x26e8d3=_0x5f95[_0x4ab3f6];return _0x26e8d3;};'use strict';var multer=require(_0x55f9('0x0'));var util=require(_0x55f9('0x1'));var path=require(_0x55f9('0x2'));var timeout=require(_0x55f9('0x3'));var express=require(_0x55f9('0x4'));var router=express['Router']();var auth=require(_0x55f9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x55f9('0x6'));router[_0x55f9('0x7')](_0x55f9('0x8'),auth[_0x55f9('0x9')](),controller[_0x55f9('0xa')]);router[_0x55f9('0xb')](_0x55f9('0x8'),auth['isAuthenticated'](),controller[_0x55f9('0xc')]);router[_0x55f9('0xd')](_0x55f9('0x8'),auth[_0x55f9('0x9')](),controller[_0x55f9('0xe')]);module[_0x55f9('0xf')]=router; \ No newline at end of file +var _0x3b44=['exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','isAuthenticated','show','/:id','update','delete','destroy'];(function(_0x1beaba,_0x5a9ea9){var _0x19d1ea=function(_0x5e78ab){while(--_0x5e78ab){_0x1beaba['push'](_0x1beaba['shift']());}};_0x19d1ea(++_0x5a9ea9);}(_0x3b44,0x1f1));var _0x43b4=function(_0x1e819d,_0x412173){_0x1e819d=_0x1e819d-0x0;var _0x514d24=_0x3b44[_0x1e819d];return _0x514d24;};'use strict';var multer=require(_0x43b4('0x0'));var util=require('util');var path=require(_0x43b4('0x1'));var timeout=require('connect-timeout');var express=require(_0x43b4('0x2'));var router=express[_0x43b4('0x3')]();var auth=require(_0x43b4('0x4'));var interaction=require(_0x43b4('0x5'));var config=require(_0x43b4('0x6'));var controller=require(_0x43b4('0x7'));router[_0x43b4('0x8')]('/:id',auth[_0x43b4('0x9')](),controller[_0x43b4('0xa')]);router['put'](_0x43b4('0xb'),auth[_0x43b4('0x9')](),controller[_0x43b4('0xc')]);router[_0x43b4('0xd')](_0x43b4('0xb'),auth[_0x43b4('0x9')](),controller[_0x43b4('0xe')]);module[_0x43b4('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 7a9524d..7fc0b6b 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 _0x0817=['STRING','BOOLEAN','exports'];(function(_0x11731f,_0x2271b5){var _0x14587c=function(_0x31e014){while(--_0x31e014){_0x11731f['push'](_0x11731f['shift']());}};_0x14587c(++_0x2271b5);}(_0x0817,0x1b5));var _0x7081=function(_0x496195,_0x4552e){_0x496195=_0x496195-0x0;var _0x414b17=_0x0817[_0x496195];return _0x414b17;};'use strict';var Sequelize=require('sequelize');module[_0x7081('0x0')]={'name':{'type':Sequelize[_0x7081('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x7081('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd387=['exports','STRING','BOOLEAN','sequelize'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xd387,0x67));var _0x7d38=function(_0x1e012e,_0x3ccaae){_0x1e012e=_0x1e012e-0x0;var _0x55bdba=_0xd387[_0x1e012e];return _0x55bdba;};'use strict';var Sequelize=require(_0x7d38('0x0'));module[_0x7d38('0x1')]={'name':{'type':Sequelize[_0x7d38('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7d38('0x2')]},'write':{'type':Sequelize[_0x7d38('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 f92ffa8..81e17bb 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 _0xbdc2=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatGroup.socket','register','jayson/promise','client','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filters','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','create','body','catch','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','filter','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','order','pick','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xbdc2,0x148));var _0x2bdc=function(_0x1e82b6,_0x4d8f82){_0x1e82b6=_0x1e82b6-0x0;var _0x5eaa3c=_0xbdc2[_0x1e82b6];return _0x5eaa3c;};'use strict';var pdf=require(_0x2bdc('0x0'));var emlformat=require(_0x2bdc('0x1'));var rimraf=require(_0x2bdc('0x2'));var zipdir=require(_0x2bdc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2bdc('0x4'));var BPromise=require(_0x2bdc('0x5'));var Mustache=require('mustache');var util=require(_0x2bdc('0x6'));var path=require(_0x2bdc('0x7'));var sox=require('sox');var csv=require(_0x2bdc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2bdc('0x9'));var squel=require(_0x2bdc('0xa'));var crypto=require(_0x2bdc('0xb'));var jsforce=require(_0x2bdc('0xc'));var deskjs=require(_0x2bdc('0xd'));var toCsv=require(_0x2bdc('0x8'));var querystring=require(_0x2bdc('0xe'));var Papa=require(_0x2bdc('0xf'));var Redis=require(_0x2bdc('0x10'));var authService=require(_0x2bdc('0x11'));var qs=require(_0x2bdc('0x12'));var as=require(_0x2bdc('0x13'));var hardwareService=require(_0x2bdc('0x14'));var logger=require('../../config/logger')(_0x2bdc('0x15'));var utils=require('../../config/utils');var config=require(_0x2bdc('0x16'));var licenseUtil=require(_0x2bdc('0x17'));var db=require(_0x2bdc('0x18'))['db'];config['redis']=_[_0x2bdc('0x19')](config['redis'],{'host':_0x2bdc('0x1a'),'port':0x18eb});var socket=require(_0x2bdc('0x1b'))(new Redis(config[_0x2bdc('0x1c')]));require(_0x2bdc('0x1d'))[_0x2bdc('0x1e')](socket);var jayson=require(_0x2bdc('0x1f'));var client=jayson[_0x2bdc('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40128d,_0x79c8d5,_0x2b13ea,_0x514444){return new BPromise(function(_0x3ad58f,_0x583426){var _0x426720=_0x514444||client;return _0x426720['request'](_0x40128d,_0x2b13ea)[_0x2bdc('0x21')](function(_0xc48492){logger[_0x2bdc('0x22')]('ChatGroup,\x20%s,\x20%s',_0x79c8d5,_0x2bdc('0x23'));logger[_0x2bdc('0x24')](_0x2bdc('0x25'),_0x79c8d5,'request\x20sent',JSON[_0x2bdc('0x26')](_0xc48492));if(_0xc48492[_0x2bdc('0x27')]){if(_0xc48492['error'][_0x2bdc('0x28')]===0x1f4){logger[_0x2bdc('0x27')](_0x2bdc('0x29'),_0x79c8d5,_0xc48492[_0x2bdc('0x27')][_0x2bdc('0x2a')]);return _0x583426(_0xc48492[_0x2bdc('0x27')]['message']);}logger[_0x2bdc('0x27')](_0x2bdc('0x29'),_0x79c8d5,_0xc48492[_0x2bdc('0x27')][_0x2bdc('0x2a')]);return _0x3ad58f(_0xc48492[_0x2bdc('0x27')]['message']);}else{logger[_0x2bdc('0x22')](_0x2bdc('0x29'),_0x79c8d5,_0x2bdc('0x23'));_0x3ad58f(_0xc48492[_0x2bdc('0x2b')][_0x2bdc('0x2a')]);}})['catch'](function(_0xbb00da){logger[_0x2bdc('0x27')](_0x2bdc('0x29'),_0x79c8d5,_0xbb00da);_0x583426(_0xbb00da);});});}function respondWithStatusCode(_0x536f5b,_0x34cfb0){_0x34cfb0=_0x34cfb0||0xcc;return function(_0x3f7fc8){if(_0x3f7fc8){return _0x536f5b[_0x2bdc('0x2c')](_0x34cfb0);}return _0x536f5b['status'](_0x34cfb0)[_0x2bdc('0x2d')]();};}function respondWithResult(_0x3cc8e5,_0x39efba){_0x39efba=_0x39efba||0xc8;return function(_0x570c6){if(_0x570c6){return _0x3cc8e5['status'](_0x39efba)[_0x2bdc('0x2e')](_0x570c6);}};}function respondWithFilteredResult(_0x4eb7b9,_0x2a0545){return function(_0x366a05){if(_0x366a05){var _0x3327cd=_0x366a05['count'],_0xdf8b6f=_0x2a0545[_0x2bdc('0x2f')],_0x560f43=_0x2a0545[_0x2bdc('0x2f')]+_0x2a0545[_0x2bdc('0x30')],_0x4ce40b;if(_0x560f43>=_0x3327cd){_0x560f43=_0x3327cd;_0x4ce40b=0xc8;}else{_0x4ce40b=0xce;}_0x4eb7b9[_0x2bdc('0x31')](_0x4ce40b);return _0x4eb7b9[_0x2bdc('0x32')](_0x2bdc('0x33'),_0xdf8b6f+'-'+_0x560f43+'/'+_0x3327cd)[_0x2bdc('0x2e')](_0x366a05);}return null;};}function patchUpdates(_0x116fcf){return function(_0x3ae8f6){try{jsonpatch[_0x2bdc('0x34')](_0x3ae8f6,_0x116fcf,!![]);}catch(_0x144815){return BPromise[_0x2bdc('0x35')](_0x144815);}return _0x3ae8f6[_0x2bdc('0x36')]();};}function saveUpdates(_0x5f0bbd,_0x555a50){return function(_0x2dd8a1){if(_0x2dd8a1){return _0x2dd8a1[_0x2bdc('0x37')](_0x5f0bbd)[_0x2bdc('0x21')](function(_0x246d7c){return _0x246d7c;});}return null;};}function removeEntity(_0x3ef662,_0x17817f){return function(_0x2ce3d3){if(_0x2ce3d3){return _0x2ce3d3[_0x2bdc('0x38')]()[_0x2bdc('0x21')](function(){_0x3ef662[_0x2bdc('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b70ef,_0x461865){return function(_0xcc5084){if(!_0xcc5084){_0x2b70ef[_0x2bdc('0x2c')](0x194);}return _0xcc5084;};}function handleError(_0x2ea42b,_0x2627aa){_0x2627aa=_0x2627aa||0x1f4;return function(_0x1df7f){logger['error'](_0x1df7f[_0x2bdc('0x39')]);if(_0x1df7f['name']){delete _0x1df7f[_0x2bdc('0x3a')];}_0x2ea42b['status'](_0x2627aa)[_0x2bdc('0x3b')](_0x1df7f);};}exports[_0x2bdc('0x3c')]=function(_0x311eea,_0x3f0adf){var _0x5ee39e={},_0x15248c={},_0x22b453={'count':0x0,'rows':[]};var _0x4c57e3=_[_0x2bdc('0x3d')](db[_0x2bdc('0x3e')][_0x2bdc('0x3f')],function(_0x379232){return{'name':_0x379232[_0x2bdc('0x40')],'type':_0x379232['type']['key']};});_0x15248c['model']=_['map'](_0x4c57e3,_0x2bdc('0x3a'));_0x15248c[_0x2bdc('0x41')]=_[_0x2bdc('0x42')](_0x311eea[_0x2bdc('0x41')]);_0x15248c['filters']=_[_0x2bdc('0x43')](_0x15248c[_0x2bdc('0x44')],_0x15248c[_0x2bdc('0x41')]);_0x5ee39e[_0x2bdc('0x45')]=_['intersection'](_0x15248c[_0x2bdc('0x44')],qs[_0x2bdc('0x46')](_0x311eea[_0x2bdc('0x41')][_0x2bdc('0x46')]));_0x5ee39e[_0x2bdc('0x45')]=_0x5ee39e['attributes'][_0x2bdc('0x47')]?_0x5ee39e[_0x2bdc('0x45')]:_0x15248c[_0x2bdc('0x44')];if(!_0x311eea[_0x2bdc('0x41')][_0x2bdc('0x48')]('nolimit')){_0x5ee39e[_0x2bdc('0x30')]=qs[_0x2bdc('0x30')](_0x311eea[_0x2bdc('0x41')][_0x2bdc('0x30')]);_0x5ee39e[_0x2bdc('0x2f')]=qs['offset'](_0x311eea[_0x2bdc('0x41')]['offset']);}_0x5ee39e['order']=qs['sort'](_0x311eea[_0x2bdc('0x41')][_0x2bdc('0x49')]);_0x5ee39e[_0x2bdc('0x4a')]=qs['filters'](_['pick'](_0x311eea[_0x2bdc('0x41')],_0x15248c[_0x2bdc('0x4b')]),_0x4c57e3);if(_0x311eea[_0x2bdc('0x41')]['filter']){_0x5ee39e[_0x2bdc('0x4a')]=_[_0x2bdc('0x4c')](_0x5ee39e[_0x2bdc('0x4a')],{'$or':_[_0x2bdc('0x3d')](_0x4c57e3,function(_0x179b10){if(_0x179b10[_0x2bdc('0x4d')]!==_0x2bdc('0x4e')){var _0x4c1500={};_0x4c1500[_0x179b10[_0x2bdc('0x3a')]]={'$like':'%'+_0x311eea[_0x2bdc('0x41')]['filter']+'%'};return _0x4c1500;}})});}_0x5ee39e=_['merge']({},_0x5ee39e,_0x311eea[_0x2bdc('0x4f')]);var _0x3207ca={'where':_0x5ee39e[_0x2bdc('0x4a')]};return db['ChatGroup'][_0x2bdc('0x50')](_0x3207ca)[_0x2bdc('0x21')](function(_0x459e80){_0x22b453[_0x2bdc('0x50')]=_0x459e80;if(_0x311eea[_0x2bdc('0x41')][_0x2bdc('0x51')]){_0x5ee39e[_0x2bdc('0x52')]=[{'all':!![]}];}return db[_0x2bdc('0x3e')][_0x2bdc('0x53')](_0x5ee39e);})[_0x2bdc('0x21')](function(_0x3a0fb6){_0x22b453[_0x2bdc('0x54')]=_0x3a0fb6;return _0x22b453;})[_0x2bdc('0x21')](respondWithFilteredResult(_0x3f0adf,_0x5ee39e))['catch'](handleError(_0x3f0adf,null));};exports[_0x2bdc('0x55')]=function(_0x3c3a3b,_0x2e3222){var _0x1a6a33={'raw':!![],'where':{'id':_0x3c3a3b[_0x2bdc('0x56')]['id']}},_0x105639={};_0x105639['model']=_[_0x2bdc('0x42')](db[_0x2bdc('0x3e')][_0x2bdc('0x3f')]);_0x105639[_0x2bdc('0x41')]=_[_0x2bdc('0x42')](_0x3c3a3b[_0x2bdc('0x41')]);_0x105639[_0x2bdc('0x4b')]=_[_0x2bdc('0x43')](_0x105639[_0x2bdc('0x44')],_0x105639[_0x2bdc('0x41')]);_0x1a6a33[_0x2bdc('0x45')]=_[_0x2bdc('0x43')](_0x105639[_0x2bdc('0x44')],qs[_0x2bdc('0x46')](_0x3c3a3b[_0x2bdc('0x41')]['fields']));_0x1a6a33[_0x2bdc('0x45')]=_0x1a6a33['attributes'][_0x2bdc('0x47')]?_0x1a6a33[_0x2bdc('0x45')]:_0x105639['model'];if(_0x3c3a3b[_0x2bdc('0x41')][_0x2bdc('0x51')]){_0x1a6a33[_0x2bdc('0x52')]=[{'all':!![]}];}_0x1a6a33=_[_0x2bdc('0x4c')]({},_0x1a6a33,_0x3c3a3b['options']);return db[_0x2bdc('0x3e')]['find'](_0x1a6a33)[_0x2bdc('0x21')](handleEntityNotFound(_0x2e3222,null))['then'](respondWithResult(_0x2e3222,null))['catch'](handleError(_0x2e3222,null));};exports['create']=function(_0x426aed,_0x4cc03c){return db[_0x2bdc('0x3e')][_0x2bdc('0x57')](_0x426aed[_0x2bdc('0x58')],{})[_0x2bdc('0x21')](respondWithResult(_0x4cc03c,0xc9))[_0x2bdc('0x59')](handleError(_0x4cc03c,null));};exports['update']=function(_0x57f50d,_0x1317d6){if(_0x57f50d[_0x2bdc('0x58')]['id']){delete _0x57f50d[_0x2bdc('0x58')]['id'];}return db[_0x2bdc('0x3e')][_0x2bdc('0x5a')]({'where':{'id':_0x57f50d[_0x2bdc('0x56')]['id']}})[_0x2bdc('0x21')](handleEntityNotFound(_0x1317d6,null))['then'](saveUpdates(_0x57f50d['body'],null))[_0x2bdc('0x21')](respondWithResult(_0x1317d6,null))[_0x2bdc('0x59')](handleError(_0x1317d6,null));};exports['destroy']=function(_0xc5aa1d,_0x1fc289){return db[_0x2bdc('0x3e')]['find']({'where':{'id':_0xc5aa1d[_0x2bdc('0x56')]['id']}})['then'](handleEntityNotFound(_0x1fc289,null))[_0x2bdc('0x21')](removeEntity(_0x1fc289,null))[_0x2bdc('0x59')](handleError(_0x1fc289,null));};exports[_0x2bdc('0x5b')]=function(_0x2f3b52,_0x51e547){return db[_0x2bdc('0x3e')][_0x2bdc('0x5b')]()['then'](respondWithResult(_0x51e547,null))[_0x2bdc('0x59')](handleError(_0x51e547,null));};exports[_0x2bdc('0x5c')]=function(_0x304c0c,_0x1bb615,_0x4fbd72){return db[_0x2bdc('0x5d')][_0x2bdc('0x50')]({'where':{'ChatGroupId':_0x304c0c['params']['id'],'ToId':_0x304c0c[_0x2bdc('0x5e')]['id'],'read':![]}})[_0x2bdc('0x21')](function(_0x556559){return{'id':_[_0x2bdc('0x5f')](_0x304c0c[_0x2bdc('0x56')]['id']),'count':_0x556559};})[_0x2bdc('0x21')](respondWithResult(_0x1bb615,null))[_0x2bdc('0x59')](handleError(_0x1bb615,null));};exports[_0x2bdc('0x60')]=function(_0x2ed6af,_0x10cdec,_0x3dc8cc){return db['ChatGroup']['find']({'where':{'id':_0x2ed6af[_0x2bdc('0x56')]['id']}})[_0x2bdc('0x21')](handleEntityNotFound(_0x10cdec,null))[_0x2bdc('0x21')](function(_0x302479){if(_0x302479){return _0x302479[_0x2bdc('0x60')](_0x2ed6af[_0x2bdc('0x58')][_0x2bdc('0x61')],_[_0x2bdc('0x62')](_0x2ed6af['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x10cdec,null))['catch'](handleError(_0x10cdec,null));};exports[_0x2bdc('0x63')]=function(_0x155720,_0x1ff47b,_0x345b3b){var _0x466aed={};var _0x16ba7b={};var _0x2823ae;var _0x26a039;return db[_0x2bdc('0x3e')][_0x2bdc('0x64')]({'where':{'id':_0x155720[_0x2bdc('0x56')]['id']}})[_0x2bdc('0x21')](handleEntityNotFound(_0x1ff47b,null))[_0x2bdc('0x21')](function(_0x2e574c){if(_0x2e574c){_0x2823ae=_0x2e574c;_0x16ba7b[_0x2bdc('0x44')]=_['keys'](db[_0x2bdc('0x65')][_0x2bdc('0x3f')]);_0x16ba7b[_0x2bdc('0x41')]=_[_0x2bdc('0x42')](_0x155720[_0x2bdc('0x41')]);_0x16ba7b[_0x2bdc('0x4b')]=_[_0x2bdc('0x43')](_0x16ba7b['model'],_0x16ba7b[_0x2bdc('0x41')]);_0x466aed[_0x2bdc('0x45')]=_[_0x2bdc('0x43')](_0x16ba7b['model'],qs[_0x2bdc('0x46')](_0x155720['query'][_0x2bdc('0x46')]));_0x466aed[_0x2bdc('0x45')]=_0x466aed[_0x2bdc('0x45')][_0x2bdc('0x47')]?_0x466aed[_0x2bdc('0x45')]:_0x16ba7b[_0x2bdc('0x44')];_0x466aed['order']=qs['sort'](_0x155720['query']['sort']);_0x466aed[_0x2bdc('0x4a')]=qs[_0x2bdc('0x4b')](_['pick'](_0x155720[_0x2bdc('0x41')],_0x16ba7b[_0x2bdc('0x4b')]));if(_0x155720[_0x2bdc('0x41')][_0x2bdc('0x66')]){_0x466aed[_0x2bdc('0x4a')]=_[_0x2bdc('0x4c')](_0x466aed[_0x2bdc('0x4a')],{'$or':_[_0x2bdc('0x3d')](_0x466aed[_0x2bdc('0x45')],function(_0x21df6d){var _0x1d2202={};_0x1d2202[_0x21df6d]={'$like':'%'+_0x155720['query'][_0x2bdc('0x66')]+'%'};return _0x1d2202;})});}_0x466aed=_[_0x2bdc('0x4c')]({},_0x466aed,_0x155720['options']);return _0x2823ae[_0x2bdc('0x63')](_0x466aed);}})['then'](function(_0x4a8ed0){if(_0x4a8ed0){_0x26a039=_0x4a8ed0[_0x2bdc('0x47')];if(!_0x155720[_0x2bdc('0x41')][_0x2bdc('0x48')](_0x2bdc('0x67'))){_0x466aed[_0x2bdc('0x30')]=qs[_0x2bdc('0x30')](_0x155720['query'][_0x2bdc('0x30')]);_0x466aed[_0x2bdc('0x2f')]=qs['offset'](_0x155720['query'][_0x2bdc('0x2f')]);}return _0x2823ae['getMembers'](_0x466aed);}})['then'](function(_0x4d3604){if(_0x4d3604){return _0x4d3604?{'count':_0x26a039,'rows':_0x4d3604}:null;}})[_0x2bdc('0x21')](respondWithResult(_0x1ff47b,null))['catch'](handleError(_0x1ff47b,null));};exports[_0x2bdc('0x68')]=function(_0x45d580,_0x4ec71a,_0xf6d604){return db['ChatGroup'][_0x2bdc('0x5a')]({'where':{'id':_0x45d580[_0x2bdc('0x56')]['id']}})[_0x2bdc('0x21')](handleEntityNotFound(_0x4ec71a,null))[_0x2bdc('0x21')](function(_0x5cd809){if(_0x5cd809){return _0x5cd809[_0x2bdc('0x68')](_0x45d580[_0x2bdc('0x41')]['ids']);}})[_0x2bdc('0x21')](respondWithStatusCode(_0x4ec71a,null))[_0x2bdc('0x59')](handleError(_0x4ec71a,null));};exports[_0x2bdc('0x69')]=function(_0x29d72e,_0x10d51a,_0x42952e){if(_0x29d72e[_0x2bdc('0x58')]['id']){delete _0x29d72e[_0x2bdc('0x58')]['id'];}return db[_0x2bdc('0x3e')]['find']({'where':{'id':_0x29d72e['params']['id']}})['then'](handleEntityNotFound(_0x10d51a,null))[_0x2bdc('0x21')](function(_0x3b4b09){if(_0x3b4b09){_0x29d72e[_0x2bdc('0x58')][_0x2bdc('0x6a')]=_0x3b4b09['id'];return db['ChatInternalMessage'][_0x2bdc('0x57')](_0x29d72e[_0x2bdc('0x58')]);}})[_0x2bdc('0x21')](respondWithResult(_0x10d51a,null))[_0x2bdc('0x59')](handleError(_0x10d51a,null));};exports[_0x2bdc('0x6b')]=function(_0x512795,_0x20693b,_0x329aab){var _0x40281a={};var _0x5d6bac={};var _0x58b36e;var _0x5f0563;return db[_0x2bdc('0x3e')][_0x2bdc('0x64')]({'where':{'id':_0x512795[_0x2bdc('0x56')]['id']}})[_0x2bdc('0x21')](handleEntityNotFound(_0x20693b,null))['then'](function(_0x5e520d){if(_0x5e520d){_0x58b36e=_0x5e520d;_0x5d6bac[_0x2bdc('0x44')]=_[_0x2bdc('0x42')](db[_0x2bdc('0x5d')][_0x2bdc('0x3f')]);_0x5d6bac[_0x2bdc('0x41')]=_[_0x2bdc('0x42')](_0x512795[_0x2bdc('0x41')]);_0x5d6bac[_0x2bdc('0x4b')]=_[_0x2bdc('0x43')](_0x5d6bac[_0x2bdc('0x44')],_0x5d6bac[_0x2bdc('0x41')]);_0x40281a[_0x2bdc('0x45')]=_[_0x2bdc('0x43')](_0x5d6bac[_0x2bdc('0x44')],qs['fields'](_0x512795[_0x2bdc('0x41')][_0x2bdc('0x46')]));_0x40281a[_0x2bdc('0x45')]=_0x40281a[_0x2bdc('0x45')][_0x2bdc('0x47')]?_0x40281a[_0x2bdc('0x45')]:_0x5d6bac[_0x2bdc('0x44')];_0x40281a[_0x2bdc('0x6c')]=qs[_0x2bdc('0x49')](_0x512795[_0x2bdc('0x41')]['sort']);_0x40281a['where']=qs[_0x2bdc('0x4b')](_[_0x2bdc('0x6d')](_0x512795['query'],_0x5d6bac[_0x2bdc('0x4b')]));if(_0x512795[_0x2bdc('0x41')][_0x2bdc('0x66')]){_0x40281a[_0x2bdc('0x4a')]=_['merge'](_0x40281a[_0x2bdc('0x4a')],{'$or':_[_0x2bdc('0x3d')](_0x40281a[_0x2bdc('0x45')],function(_0x3577aa){var _0x1bdf23={};_0x1bdf23[_0x3577aa]={'$like':'%'+_0x512795[_0x2bdc('0x41')]['filter']+'%'};return _0x1bdf23;})});}if(_0x512795['query'][_0x2bdc('0x6e')]){var _0x196711=_0x512795[_0x2bdc('0x41')][_0x2bdc('0x6e')][_0x2bdc('0x6f')](',');var _0x353671={};_0x353671[_0x196711[0x0]]={'$gte':moment(_0x196711[0x1])[_0x2bdc('0x70')](_0x2bdc('0x71'))};_0x40281a['where']=_['merge'](_0x40281a[_0x2bdc('0x4a')],_0x353671);}_0x40281a=_[_0x2bdc('0x4c')]({},_0x40281a,_0x512795['options']);return _0x58b36e[_0x2bdc('0x6b')](_0x40281a);}})[_0x2bdc('0x21')](function(_0x3a767d){if(_0x3a767d){_0x5f0563=_0x3a767d['length'];if(!_0x512795[_0x2bdc('0x41')]['hasOwnProperty'](_0x2bdc('0x67'))){_0x40281a[_0x2bdc('0x30')]=qs[_0x2bdc('0x30')](_0x512795[_0x2bdc('0x41')][_0x2bdc('0x30')]);_0x40281a[_0x2bdc('0x2f')]=qs[_0x2bdc('0x2f')](_0x512795[_0x2bdc('0x41')][_0x2bdc('0x2f')]);}return _0x58b36e[_0x2bdc('0x6b')](_0x40281a);}})[_0x2bdc('0x21')](function(_0x243719){if(_0x243719){return _0x243719?{'count':_0x5f0563,'rows':_0x243719}:null;}})[_0x2bdc('0x21')](respondWithResult(_0x20693b,null))['catch'](handleError(_0x20693b,null));}; \ No newline at end of file +var _0xb931=['getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','order','options','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','register','jayson/promise','client','http','request','info','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatGroup,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','count','offset','Content-Range','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','ChatGroup','includeAll','findAll','show','params','find','create','body','describe'];(function(_0x36bc6f,_0x3c99f4){var _0x2f151e=function(_0x13bb57){while(--_0x13bb57){_0x36bc6f['push'](_0x36bc6f['shift']());}};_0x2f151e(++_0x3c99f4);}(_0xb931,0x155));var _0x1b93=function(_0x527129,_0x4843d7){_0x527129=_0x527129-0x0;var _0x1c2a80=_0xb931[_0x527129];return _0x1c2a80;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1b93('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1b93('0x1'));var moment=require(_0x1b93('0x2'));var BPromise=require(_0x1b93('0x3'));var Mustache=require(_0x1b93('0x4'));var util=require(_0x1b93('0x5'));var path=require(_0x1b93('0x6'));var sox=require(_0x1b93('0x7'));var csv=require(_0x1b93('0x8'));var ejs=require(_0x1b93('0x9'));var fs=require('fs');var _=require(_0x1b93('0xa'));var squel=require(_0x1b93('0xb'));var crypto=require(_0x1b93('0xc'));var jsforce=require(_0x1b93('0xd'));var deskjs=require(_0x1b93('0xe'));var toCsv=require(_0x1b93('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1b93('0xf'));var authService=require(_0x1b93('0x10'));var qs=require(_0x1b93('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b93('0x12'));var logger=require('../../config/logger')(_0x1b93('0x13'));var utils=require(_0x1b93('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b93('0x15'))['db'];config[_0x1b93('0x16')]=_[_0x1b93('0x17')](config['redis'],{'host':_0x1b93('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1b93('0x16')]));require(_0x1b93('0x19'))[_0x1b93('0x1a')](socket);var jayson=require(_0x1b93('0x1b'));var client=jayson[_0x1b93('0x1c')][_0x1b93('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4a0bb6,_0x140515,_0x267527,_0x240b8f){return new BPromise(function(_0x23d687,_0x4d4c47){var _0x294be5=_0x240b8f||client;return _0x294be5[_0x1b93('0x1e')](_0x4a0bb6,_0x267527)['then'](function(_0x446cc2){logger[_0x1b93('0x1f')]('ChatGroup,\x20%s,\x20%s',_0x140515,'request\x20sent');logger[_0x1b93('0x20')](_0x1b93('0x21'),_0x140515,_0x1b93('0x22'),JSON[_0x1b93('0x23')](_0x446cc2));if(_0x446cc2[_0x1b93('0x24')]){if(_0x446cc2['error'][_0x1b93('0x25')]===0x1f4){logger[_0x1b93('0x24')]('ChatGroup,\x20%s,\x20%s',_0x140515,_0x446cc2['error'][_0x1b93('0x26')]);return _0x4d4c47(_0x446cc2[_0x1b93('0x24')][_0x1b93('0x26')]);}logger[_0x1b93('0x24')](_0x1b93('0x27'),_0x140515,_0x446cc2[_0x1b93('0x24')]['message']);return _0x23d687(_0x446cc2[_0x1b93('0x24')][_0x1b93('0x26')]);}else{logger[_0x1b93('0x1f')]('ChatGroup,\x20%s,\x20%s',_0x140515,_0x1b93('0x22'));_0x23d687(_0x446cc2[_0x1b93('0x28')][_0x1b93('0x26')]);}})[_0x1b93('0x29')](function(_0x25561b){logger[_0x1b93('0x24')](_0x1b93('0x27'),_0x140515,_0x25561b);_0x4d4c47(_0x25561b);});});}function respondWithStatusCode(_0x309ac5,_0x14626a){_0x14626a=_0x14626a||0xcc;return function(_0x24f04e){if(_0x24f04e){return _0x309ac5[_0x1b93('0x2a')](_0x14626a);}return _0x309ac5[_0x1b93('0x2b')](_0x14626a)[_0x1b93('0x2c')]();};}function respondWithResult(_0x590828,_0x2f92a0){_0x2f92a0=_0x2f92a0||0xc8;return function(_0x5ce57b){if(_0x5ce57b){return _0x590828['status'](_0x2f92a0)[_0x1b93('0x2d')](_0x5ce57b);}};}function respondWithFilteredResult(_0x195c77,_0x28c014){return function(_0x2501ee){if(_0x2501ee){var _0x20b035=_0x2501ee[_0x1b93('0x2e')],_0xc47d69=_0x28c014[_0x1b93('0x2f')],_0x59983e=_0x28c014[_0x1b93('0x2f')]+_0x28c014['limit'],_0x5af450;if(_0x59983e>=_0x20b035){_0x59983e=_0x20b035;_0x5af450=0xc8;}else{_0x5af450=0xce;}_0x195c77[_0x1b93('0x2b')](_0x5af450);return _0x195c77['set'](_0x1b93('0x30'),_0xc47d69+'-'+_0x59983e+'/'+_0x20b035)[_0x1b93('0x2d')](_0x2501ee);}return null;};}function patchUpdates(_0x38755c){return function(_0x5e3ec1){try{jsonpatch['apply'](_0x5e3ec1,_0x38755c,!![]);}catch(_0xa0f296){return BPromise['reject'](_0xa0f296);}return _0x5e3ec1[_0x1b93('0x31')]();};}function saveUpdates(_0x1805ad,_0x2d8b3b){return function(_0x49c445){if(_0x49c445){return _0x49c445[_0x1b93('0x32')](_0x1805ad)[_0x1b93('0x33')](function(_0x1b5cac){return _0x1b5cac;});}return null;};}function removeEntity(_0x2ef0fe,_0x3c557b){return function(_0x113528){if(_0x113528){return _0x113528[_0x1b93('0x34')]()[_0x1b93('0x33')](function(){_0x2ef0fe[_0x1b93('0x2b')](0xcc)[_0x1b93('0x2c')]();});}};}function handleEntityNotFound(_0x3efd5e,_0x52302d){return function(_0x5b55dc){if(!_0x5b55dc){_0x3efd5e[_0x1b93('0x2a')](0x194);}return _0x5b55dc;};}function handleError(_0x6816b8,_0x1109b4){_0x1109b4=_0x1109b4||0x1f4;return function(_0x102da3){logger[_0x1b93('0x24')](_0x102da3[_0x1b93('0x35')]);if(_0x102da3[_0x1b93('0x36')]){delete _0x102da3['name'];}_0x6816b8['status'](_0x1109b4)['send'](_0x102da3);};}exports[_0x1b93('0x37')]=function(_0x457674,_0x55d921){var _0x50a610={},_0x4a581f={},_0x20d4aa={'count':0x0,'rows':[]};var _0x47e0a8=_[_0x1b93('0x38')](db['ChatGroup'][_0x1b93('0x39')],function(_0x3da1b5){return{'name':_0x3da1b5[_0x1b93('0x3a')],'type':_0x3da1b5[_0x1b93('0x3b')][_0x1b93('0x3c')]};});_0x4a581f[_0x1b93('0x3d')]=_['map'](_0x47e0a8,_0x1b93('0x36'));_0x4a581f['query']=_[_0x1b93('0x3e')](_0x457674['query']);_0x4a581f[_0x1b93('0x3f')]=_[_0x1b93('0x40')](_0x4a581f[_0x1b93('0x3d')],_0x4a581f[_0x1b93('0x41')]);_0x50a610[_0x1b93('0x42')]=_[_0x1b93('0x40')](_0x4a581f[_0x1b93('0x3d')],qs[_0x1b93('0x43')](_0x457674[_0x1b93('0x41')][_0x1b93('0x43')]));_0x50a610[_0x1b93('0x42')]=_0x50a610[_0x1b93('0x42')][_0x1b93('0x44')]?_0x50a610[_0x1b93('0x42')]:_0x4a581f['model'];if(!_0x457674[_0x1b93('0x41')][_0x1b93('0x45')](_0x1b93('0x46'))){_0x50a610['limit']=qs[_0x1b93('0x47')](_0x457674[_0x1b93('0x41')][_0x1b93('0x47')]);_0x50a610[_0x1b93('0x2f')]=qs[_0x1b93('0x2f')](_0x457674['query']['offset']);}_0x50a610['order']=qs[_0x1b93('0x48')](_0x457674['query']['sort']);_0x50a610[_0x1b93('0x49')]=qs[_0x1b93('0x3f')](_[_0x1b93('0x4a')](_0x457674[_0x1b93('0x41')],_0x4a581f[_0x1b93('0x3f')]),_0x47e0a8);if(_0x457674[_0x1b93('0x41')][_0x1b93('0x4b')]){_0x50a610['where']=_['merge'](_0x50a610[_0x1b93('0x49')],{'$or':_[_0x1b93('0x38')](_0x47e0a8,function(_0x50102c){if(_0x50102c[_0x1b93('0x3b')]!==_0x1b93('0x4c')){var _0x51bc26={};_0x51bc26[_0x50102c[_0x1b93('0x36')]]={'$like':'%'+_0x457674['query'][_0x1b93('0x4b')]+'%'};return _0x51bc26;}})});}_0x50a610=_[_0x1b93('0x4d')]({},_0x50a610,_0x457674['options']);var _0x7bc33f={'where':_0x50a610[_0x1b93('0x49')]};return db[_0x1b93('0x4e')][_0x1b93('0x2e')](_0x7bc33f)['then'](function(_0x25929d){_0x20d4aa[_0x1b93('0x2e')]=_0x25929d;if(_0x457674[_0x1b93('0x41')][_0x1b93('0x4f')]){_0x50a610['include']=[{'all':!![]}];}return db[_0x1b93('0x4e')][_0x1b93('0x50')](_0x50a610);})['then'](function(_0x11e5e7){_0x20d4aa['rows']=_0x11e5e7;return _0x20d4aa;})[_0x1b93('0x33')](respondWithFilteredResult(_0x55d921,_0x50a610))[_0x1b93('0x29')](handleError(_0x55d921,null));};exports[_0x1b93('0x51')]=function(_0x1df9d4,_0x4a6918){var _0x337de4={'raw':!![],'where':{'id':_0x1df9d4[_0x1b93('0x52')]['id']}},_0x4476f1={};_0x4476f1[_0x1b93('0x3d')]=_[_0x1b93('0x3e')](db['ChatGroup'][_0x1b93('0x39')]);_0x4476f1['query']=_['keys'](_0x1df9d4[_0x1b93('0x41')]);_0x4476f1[_0x1b93('0x3f')]=_[_0x1b93('0x40')](_0x4476f1[_0x1b93('0x3d')],_0x4476f1[_0x1b93('0x41')]);_0x337de4['attributes']=_[_0x1b93('0x40')](_0x4476f1[_0x1b93('0x3d')],qs[_0x1b93('0x43')](_0x1df9d4[_0x1b93('0x41')][_0x1b93('0x43')]));_0x337de4['attributes']=_0x337de4[_0x1b93('0x42')]['length']?_0x337de4[_0x1b93('0x42')]:_0x4476f1['model'];if(_0x1df9d4['query'][_0x1b93('0x4f')]){_0x337de4['include']=[{'all':!![]}];}_0x337de4=_[_0x1b93('0x4d')]({},_0x337de4,_0x1df9d4['options']);return db['ChatGroup'][_0x1b93('0x53')](_0x337de4)[_0x1b93('0x33')](handleEntityNotFound(_0x4a6918,null))['then'](respondWithResult(_0x4a6918,null))[_0x1b93('0x29')](handleError(_0x4a6918,null));};exports[_0x1b93('0x54')]=function(_0x22da10,_0x5a06ef){return db[_0x1b93('0x4e')][_0x1b93('0x54')](_0x22da10['body'],{})[_0x1b93('0x33')](respondWithResult(_0x5a06ef,0xc9))[_0x1b93('0x29')](handleError(_0x5a06ef,null));};exports[_0x1b93('0x32')]=function(_0x2c1436,_0x5e3921){if(_0x2c1436[_0x1b93('0x55')]['id']){delete _0x2c1436[_0x1b93('0x55')]['id'];}return db[_0x1b93('0x4e')][_0x1b93('0x53')]({'where':{'id':_0x2c1436['params']['id']}})[_0x1b93('0x33')](handleEntityNotFound(_0x5e3921,null))['then'](saveUpdates(_0x2c1436['body'],null))['then'](respondWithResult(_0x5e3921,null))[_0x1b93('0x29')](handleError(_0x5e3921,null));};exports[_0x1b93('0x34')]=function(_0x2f5c5b,_0xd0f2d2){return db[_0x1b93('0x4e')][_0x1b93('0x53')]({'where':{'id':_0x2f5c5b[_0x1b93('0x52')]['id']}})[_0x1b93('0x33')](handleEntityNotFound(_0xd0f2d2,null))[_0x1b93('0x33')](removeEntity(_0xd0f2d2,null))['catch'](handleError(_0xd0f2d2,null));};exports[_0x1b93('0x56')]=function(_0xcc189e,_0x5382f0){return db['ChatGroup'][_0x1b93('0x56')]()[_0x1b93('0x33')](respondWithResult(_0x5382f0,null))[_0x1b93('0x29')](handleError(_0x5382f0,null));};exports[_0x1b93('0x57')]=function(_0x13edd6,_0x20965e,_0x2050da){return db[_0x1b93('0x58')]['count']({'where':{'ChatGroupId':_0x13edd6[_0x1b93('0x52')]['id'],'ToId':_0x13edd6[_0x1b93('0x59')]['id'],'read':![]}})[_0x1b93('0x33')](function(_0xb36fcb){return{'id':_[_0x1b93('0x5a')](_0x13edd6[_0x1b93('0x52')]['id']),'count':_0xb36fcb};})[_0x1b93('0x33')](respondWithResult(_0x20965e,null))[_0x1b93('0x29')](handleError(_0x20965e,null));};exports['addMembers']=function(_0x38cf79,_0x2eef55,_0x82a3ba){return db[_0x1b93('0x4e')][_0x1b93('0x53')]({'where':{'id':_0x38cf79['params']['id']}})[_0x1b93('0x33')](handleEntityNotFound(_0x2eef55,null))['then'](function(_0x4e021c){if(_0x4e021c){return _0x4e021c[_0x1b93('0x5b')](_0x38cf79[_0x1b93('0x55')][_0x1b93('0x5c')],_[_0x1b93('0x5d')](_0x38cf79['body'],[_0x1b93('0x5c'),'id'])||{});}})['then'](respondWithResult(_0x2eef55,null))['catch'](handleError(_0x2eef55,null));};exports[_0x1b93('0x5e')]=function(_0x599349,_0xc5dcfb,_0xc4c87b){var _0x37e5e6={};var _0x156718={};var _0x1c197e;var _0x3e09aa;return db[_0x1b93('0x4e')][_0x1b93('0x5f')]({'where':{'id':_0x599349['params']['id']}})[_0x1b93('0x33')](handleEntityNotFound(_0xc5dcfb,null))[_0x1b93('0x33')](function(_0x3b58de){if(_0x3b58de){_0x1c197e=_0x3b58de;_0x156718[_0x1b93('0x3d')]=_[_0x1b93('0x3e')](db[_0x1b93('0x60')][_0x1b93('0x39')]);_0x156718[_0x1b93('0x41')]=_['keys'](_0x599349[_0x1b93('0x41')]);_0x156718[_0x1b93('0x3f')]=_['intersection'](_0x156718[_0x1b93('0x3d')],_0x156718[_0x1b93('0x41')]);_0x37e5e6['attributes']=_['intersection'](_0x156718['model'],qs[_0x1b93('0x43')](_0x599349[_0x1b93('0x41')]['fields']));_0x37e5e6[_0x1b93('0x42')]=_0x37e5e6[_0x1b93('0x42')][_0x1b93('0x44')]?_0x37e5e6[_0x1b93('0x42')]:_0x156718['model'];_0x37e5e6[_0x1b93('0x61')]=qs[_0x1b93('0x48')](_0x599349[_0x1b93('0x41')]['sort']);_0x37e5e6[_0x1b93('0x49')]=qs['filters'](_['pick'](_0x599349[_0x1b93('0x41')],_0x156718['filters']));if(_0x599349[_0x1b93('0x41')]['filter']){_0x37e5e6[_0x1b93('0x49')]=_[_0x1b93('0x4d')](_0x37e5e6[_0x1b93('0x49')],{'$or':_['map'](_0x37e5e6[_0x1b93('0x42')],function(_0x4554ad){var _0x16a9d0={};_0x16a9d0[_0x4554ad]={'$like':'%'+_0x599349[_0x1b93('0x41')][_0x1b93('0x4b')]+'%'};return _0x16a9d0;})});}_0x37e5e6=_[_0x1b93('0x4d')]({},_0x37e5e6,_0x599349[_0x1b93('0x62')]);return _0x1c197e[_0x1b93('0x5e')](_0x37e5e6);}})[_0x1b93('0x33')](function(_0x28e817){if(_0x28e817){_0x3e09aa=_0x28e817['length'];if(!_0x599349[_0x1b93('0x41')][_0x1b93('0x45')]('nolimit')){_0x37e5e6[_0x1b93('0x47')]=qs[_0x1b93('0x47')](_0x599349['query'][_0x1b93('0x47')]);_0x37e5e6[_0x1b93('0x2f')]=qs['offset'](_0x599349[_0x1b93('0x41')][_0x1b93('0x2f')]);}return _0x1c197e['getMembers'](_0x37e5e6);}})['then'](function(_0x541bc9){if(_0x541bc9){return _0x541bc9?{'count':_0x3e09aa,'rows':_0x541bc9}:null;}})[_0x1b93('0x33')](respondWithResult(_0xc5dcfb,null))[_0x1b93('0x29')](handleError(_0xc5dcfb,null));};exports[_0x1b93('0x63')]=function(_0x23e10,_0x117513,_0x472d6d){return db[_0x1b93('0x4e')][_0x1b93('0x53')]({'where':{'id':_0x23e10[_0x1b93('0x52')]['id']}})[_0x1b93('0x33')](handleEntityNotFound(_0x117513,null))[_0x1b93('0x33')](function(_0xb0d3){if(_0xb0d3){return _0xb0d3[_0x1b93('0x63')](_0x23e10[_0x1b93('0x41')][_0x1b93('0x5c')]);}})[_0x1b93('0x33')](respondWithStatusCode(_0x117513,null))[_0x1b93('0x29')](handleError(_0x117513,null));};exports[_0x1b93('0x64')]=function(_0x41d8db,_0x7b6cc3,_0x29d92a){if(_0x41d8db[_0x1b93('0x55')]['id']){delete _0x41d8db['body']['id'];}return db[_0x1b93('0x4e')][_0x1b93('0x53')]({'where':{'id':_0x41d8db['params']['id']}})[_0x1b93('0x33')](handleEntityNotFound(_0x7b6cc3,null))[_0x1b93('0x33')](function(_0x40657c){if(_0x40657c){_0x41d8db['body'][_0x1b93('0x65')]=_0x40657c['id'];return db['ChatInternalMessage'][_0x1b93('0x54')](_0x41d8db['body']);}})[_0x1b93('0x33')](respondWithResult(_0x7b6cc3,null))['catch'](handleError(_0x7b6cc3,null));};exports[_0x1b93('0x66')]=function(_0x10c3d0,_0x24f0ac,_0x55742b){var _0x414cbf={};var _0x3a8ce7={};var _0x19e8df;var _0x5742a9;return db[_0x1b93('0x4e')][_0x1b93('0x5f')]({'where':{'id':_0x10c3d0[_0x1b93('0x52')]['id']}})[_0x1b93('0x33')](handleEntityNotFound(_0x24f0ac,null))[_0x1b93('0x33')](function(_0x3e7cd0){if(_0x3e7cd0){_0x19e8df=_0x3e7cd0;_0x3a8ce7['model']=_[_0x1b93('0x3e')](db[_0x1b93('0x58')][_0x1b93('0x39')]);_0x3a8ce7[_0x1b93('0x41')]=_[_0x1b93('0x3e')](_0x10c3d0[_0x1b93('0x41')]);_0x3a8ce7[_0x1b93('0x3f')]=_[_0x1b93('0x40')](_0x3a8ce7[_0x1b93('0x3d')],_0x3a8ce7[_0x1b93('0x41')]);_0x414cbf['attributes']=_[_0x1b93('0x40')](_0x3a8ce7[_0x1b93('0x3d')],qs[_0x1b93('0x43')](_0x10c3d0[_0x1b93('0x41')][_0x1b93('0x43')]));_0x414cbf['attributes']=_0x414cbf[_0x1b93('0x42')]['length']?_0x414cbf[_0x1b93('0x42')]:_0x3a8ce7['model'];_0x414cbf['order']=qs[_0x1b93('0x48')](_0x10c3d0[_0x1b93('0x41')][_0x1b93('0x48')]);_0x414cbf[_0x1b93('0x49')]=qs['filters'](_['pick'](_0x10c3d0[_0x1b93('0x41')],_0x3a8ce7[_0x1b93('0x3f')]));if(_0x10c3d0['query'][_0x1b93('0x4b')]){_0x414cbf['where']=_[_0x1b93('0x4d')](_0x414cbf[_0x1b93('0x49')],{'$or':_[_0x1b93('0x38')](_0x414cbf['attributes'],function(_0x17f07c){var _0x4c0e03={};_0x4c0e03[_0x17f07c]={'$like':'%'+_0x10c3d0[_0x1b93('0x41')][_0x1b93('0x4b')]+'%'};return _0x4c0e03;})});}if(_0x10c3d0['query'][_0x1b93('0x67')]){var _0x53f05c=_0x10c3d0[_0x1b93('0x41')]['$gte'][_0x1b93('0x68')](',');var _0x5599ef={};_0x5599ef[_0x53f05c[0x0]]={'$gte':moment(_0x53f05c[0x1])[_0x1b93('0x69')](_0x1b93('0x6a'))};_0x414cbf[_0x1b93('0x49')]=_[_0x1b93('0x4d')](_0x414cbf[_0x1b93('0x49')],_0x5599ef);}_0x414cbf=_[_0x1b93('0x4d')]({},_0x414cbf,_0x10c3d0['options']);return _0x19e8df[_0x1b93('0x66')](_0x414cbf);}})['then'](function(_0x2f18d1){if(_0x2f18d1){_0x5742a9=_0x2f18d1['length'];if(!_0x10c3d0['query'][_0x1b93('0x45')](_0x1b93('0x46'))){_0x414cbf[_0x1b93('0x47')]=qs[_0x1b93('0x47')](_0x10c3d0[_0x1b93('0x41')][_0x1b93('0x47')]);_0x414cbf[_0x1b93('0x2f')]=qs['offset'](_0x10c3d0[_0x1b93('0x41')][_0x1b93('0x2f')]);}return _0x19e8df[_0x1b93('0x66')](_0x414cbf);}})['then'](function(_0x4acf53){if(_0x4acf53){return _0x4acf53?{'count':_0x5742a9,'rows':_0x4acf53}:null;}})['then'](respondWithResult(_0x24f0ac,null))[_0x1b93('0x29')](handleError(_0x24f0ac,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 5f39a05..d41ad59 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','ChatGroup'];(function(_0x27ab8c,_0x42376a){var _0x1e65dc=function(_0x1604ba){while(--_0x1604ba){_0x27ab8c['push'](_0x27ab8c['shift']());}};_0x1e65dc(++_0x42376a);}(_0x2ef3,0xba));var _0x32ef=function(_0x17eed6,_0x3a5c30){_0x17eed6=_0x17eed6-0x0;var _0x3a7048=_0x2ef3[_0x17eed6];return _0x3a7048;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var ChatGroup=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x32ef('0x3')](0x0);var events={'afterCreate':_0x32ef('0x4'),'afterUpdate':_0x32ef('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38f865){return function(_0x38b7f3,_0x524ab6,_0x402857){ChatGroupEvents[_0x32ef('0x6')](_0x38f865+':'+_0x38b7f3['id'],_0x38b7f3);ChatGroupEvents['emit'](_0x38f865,_0x38b7f3);_0x402857(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x32ef('0x7')](e,emitEvent(event));}}module[_0x32ef('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x0b0e=['ChatGroup','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x2e4330,_0x21ce96){var _0x1dd00c=function(_0xa66525){while(--_0xa66525){_0x2e4330['push'](_0x2e4330['shift']());}};_0x1dd00c(++_0x21ce96);}(_0x0b0e,0x187));var _0xe0b0=function(_0x38a3d6,_0x52e305){_0x38a3d6=_0x38a3d6-0x0;var _0x3768d7=_0x0b0e[_0x38a3d6];return _0x3768d7;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatGroupEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatGroupEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatGroup[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 286ee36..8962c6d 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 _0xe41f=['../../config/logger','api','path','rimraf','../../config/environment','./chatGroup.attributes','ChatGroup','chat_groups','lodash','util'];(function(_0x51ba06,_0x4ed036){var _0x32a797=function(_0x110c95){while(--_0x110c95){_0x51ba06['push'](_0x51ba06['shift']());}};_0x32a797(++_0x4ed036);}(_0xe41f,0x13e));var _0xfe41=function(_0x31fde1,_0x45b005){_0x31fde1=_0x31fde1-0x0;var _0x218cd6=_0xe41f[_0x31fde1];return _0x218cd6;};'use strict';var _=require(_0xfe41('0x0'));var util=require(_0xfe41('0x1'));var logger=require(_0xfe41('0x2'))(_0xfe41('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe41('0x4'));var rimraf=require(_0xfe41('0x5'));var config=require(_0xfe41('0x6'));var attributes=require(_0xfe41('0x7'));module['exports']=function(_0x52d56e,_0x2e8e86){return _0x52d56e['define'](_0xfe41('0x8'),attributes,{'tableName':_0xfe41('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a2a=['chat_groups','lodash','util','../../config/logger','api','path','rimraf','./chatGroup.attributes','exports','define'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x5a2a,0x1c3));var _0xa5a2=function(_0x25c74e,_0x406515){_0x25c74e=_0x25c74e-0x0;var _0x2971af=_0x5a2a[_0x25c74e];return _0x2971af;};'use strict';var _=require(_0xa5a2('0x0'));var util=require(_0xa5a2('0x1'));var logger=require(_0xa5a2('0x2'))(_0xa5a2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5a2('0x4'));var rimraf=require(_0xa5a2('0x5'));var config=require('../../config/environment');var attributes=require(_0xa5a2('0x6'));module[_0xa5a2('0x7')]=function(_0x2e97d3,_0x55728b){return _0x2e97d3[_0xa5a2('0x8')]('ChatGroup',attributes,{'tableName':_0xa5a2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index b7b3c13..ce58440 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 _0xf55e=['jayson/promise','client','http','defaults','redis','localhost','./chatGroup.socket','request','info','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatGroup,\x20%s,\x20%s','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x151d1a,_0x3fef8f){var _0x923294=function(_0x2942b4){while(--_0x2942b4){_0x151d1a['push'](_0x151d1a['shift']());}};_0x923294(++_0x3fef8f);}(_0xf55e,0x119));var _0xef55=function(_0x5ab56f,_0x5978f3){_0x5ab56f=_0x5ab56f-0x0;var _0x1d0a82=_0xf55e[_0x5ab56f];return _0x1d0a82;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xef55('0x0'));var rs=require(_0xef55('0x1'));var fs=require('fs');var Redis=require(_0xef55('0x2'));var db=require(_0xef55('0x3'))['db'];var utils=require(_0xef55('0x4'));var logger=require(_0xef55('0x5'))(_0xef55('0x6'));var config=require('../../config/environment');var jayson=require(_0xef55('0x7'));var client=jayson[_0xef55('0x8')][_0xef55('0x9')]({'port':0x232a});config['redis']=_[_0xef55('0xa')](config[_0xef55('0xb')],{'host':_0xef55('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xef55('0xb')]));require(_0xef55('0xd'))['register'](socket);function respondWithRpcPromise(_0x3c2446,_0x4bded8,_0x129119){return new BPromise(function(_0x398683,_0x34dfa2){return client[_0xef55('0xe')](_0x3c2446,_0x129119)['then'](function(_0x48d69a){logger[_0xef55('0xf')]('ChatGroup,\x20%s,\x20%s',_0x4bded8,'request\x20sent');logger[_0xef55('0x10')](_0xef55('0x11'),_0x4bded8,_0xef55('0x12'),JSON['stringify'](_0x48d69a));if(_0x48d69a[_0xef55('0x13')]){if(_0x48d69a['error'][_0xef55('0x14')]===0x1f4){logger['error'](_0xef55('0x15'),_0x4bded8,_0x48d69a[_0xef55('0x13')][_0xef55('0x16')]);return _0x34dfa2(_0x48d69a[_0xef55('0x13')]['message']);}logger[_0xef55('0x13')]('ChatGroup,\x20%s,\x20%s',_0x4bded8,_0x48d69a['error'][_0xef55('0x16')]);return _0x398683(_0x48d69a[_0xef55('0x13')]['message']);}else{logger['info'](_0xef55('0x15'),_0x4bded8,'request\x20sent');_0x398683(_0x48d69a[_0xef55('0x17')][_0xef55('0x16')]);}})['catch'](function(_0x2062d5){logger[_0xef55('0x13')]('ChatGroup,\x20%s,\x20%s',_0x4bded8,_0x2062d5);_0x34dfa2(_0x2062d5);});});} \ No newline at end of file +var _0x2def=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util'];(function(_0xc3b8b8,_0x278eeb){var _0x19d547=function(_0x3b06e1){while(--_0x3b06e1){_0xc3b8b8['push'](_0xc3b8b8['shift']());}};_0x19d547(++_0x278eeb);}(_0x2def,0xde));var _0xf2de=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x2def[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xf2de('0x0'));var util=require(_0xf2de('0x1'));var moment=require(_0xf2de('0x2'));var BPromise=require(_0xf2de('0x3'));var rs=require(_0xf2de('0x4'));var fs=require('fs');var Redis=require(_0xf2de('0x5'));var db=require(_0xf2de('0x6'))['db'];var utils=require(_0xf2de('0x7'));var logger=require(_0xf2de('0x8'))('rpc');var config=require(_0xf2de('0x9'));var jayson=require(_0xf2de('0xa'));var client=jayson['client'][_0xf2de('0xb')]({'port':0x232a});config['redis']=_[_0xf2de('0xc')](config['redis'],{'host':_0xf2de('0xd'),'port':0x18eb});var socket=require(_0xf2de('0xe'))(new Redis(config[_0xf2de('0xf')]));require(_0xf2de('0x10'))[_0xf2de('0x11')](socket);function respondWithRpcPromise(_0x184683,_0x39210c,_0x12232e){return new BPromise(function(_0x5705ed,_0x447663){return client['request'](_0x184683,_0x12232e)[_0xf2de('0x12')](function(_0x2526ba){logger[_0xf2de('0x13')](_0xf2de('0x14'),_0x39210c,_0xf2de('0x15'));logger[_0xf2de('0x16')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x39210c,_0xf2de('0x15'),JSON[_0xf2de('0x17')](_0x2526ba));if(_0x2526ba[_0xf2de('0x18')]){if(_0x2526ba[_0xf2de('0x18')]['code']===0x1f4){logger[_0xf2de('0x18')](_0xf2de('0x14'),_0x39210c,_0x2526ba[_0xf2de('0x18')][_0xf2de('0x19')]);return _0x447663(_0x2526ba[_0xf2de('0x18')][_0xf2de('0x19')]);}logger[_0xf2de('0x18')](_0xf2de('0x14'),_0x39210c,_0x2526ba['error'][_0xf2de('0x19')]);return _0x5705ed(_0x2526ba['error'][_0xf2de('0x19')]);}else{logger[_0xf2de('0x13')](_0xf2de('0x14'),_0x39210c,_0xf2de('0x15'));_0x5705ed(_0x2526ba[_0xf2de('0x1a')][_0xf2de('0x19')]);}})[_0xf2de('0x1b')](function(_0x57848e){logger[_0xf2de('0x18')](_0xf2de('0x14'),_0x39210c,_0x57848e);_0x447663(_0x57848e);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 9e050b9..79baf99 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 _0xc958=['emit','removeListener','chatGroup:','remove','update'];(function(_0x33ecb1,_0x5a61f7){var _0x2b9c0e=function(_0x1b7b85){while(--_0x1b7b85){_0x33ecb1['push'](_0x33ecb1['shift']());}};_0x2b9c0e(++_0x5a61f7);}(_0xc958,0x1c5));var _0x8c95=function(_0x2c20ff,_0x4c6d88){_0x2c20ff=_0x2c20ff-0x0;var _0x454183=_0xc958[_0x2c20ff];return _0x454183;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0x8c95('0x0'),_0x8c95('0x1')];function createListener(_0x360b51,_0x1fcda8){return function(_0x3f7284){_0x1fcda8[_0x8c95('0x2')](_0x360b51,_0x3f7284);};}function removeListener(_0x57401a,_0x5ab8f8){return function(){ChatGroupEvents[_0x8c95('0x3')](_0x57401a,_0x5ab8f8);};}exports['register']=function(_0x2255a7){for(var _0x2ccea1=0x0,_0x49766b=events['length'];_0x2ccea1<_0x49766b;_0x2ccea1++){var _0x211e60=events[_0x2ccea1];var _0x28b347=createListener(_0x8c95('0x4')+_0x211e60,_0x2255a7);ChatGroupEvents['on'](_0x211e60,_0x28b347);}}; \ No newline at end of file +var _0xe841=['update','emit','removeListener','length','chatGroup:','remove'];(function(_0x26f236,_0x5cd362){var _0x4d43e7=function(_0x574535){while(--_0x574535){_0x26f236['push'](_0x26f236['shift']());}};_0x4d43e7(++_0x5cd362);}(_0xe841,0x10d));var _0x1e84=function(_0x3320cc,_0x5dd6b0){_0x3320cc=_0x3320cc-0x0;var _0x43b502=_0xe841[_0x3320cc];return _0x43b502;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0x1e84('0x0'),_0x1e84('0x1')];function createListener(_0x5cd78c,_0x338921){return function(_0x22228a){_0x338921[_0x1e84('0x2')](_0x5cd78c,_0x22228a);};}function removeListener(_0x227675,_0x317890){return function(){ChatGroupEvents[_0x1e84('0x3')](_0x227675,_0x317890);};}exports['register']=function(_0x40bb50){for(var _0x32dfca=0x0,_0x1bd032=events[_0x1e84('0x4')];_0x32dfca<_0x1bd032;_0x32dfca++){var _0x5f2ab3=events[_0x32dfca];var _0x1e41c7=createListener(_0x1e84('0x5')+_0x5f2ab3,_0x40bb50);ChatGroupEvents['on'](_0x5f2ab3,_0x1e41c7);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 9d71729..ffa9901 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 _0x5905=['show','getUnread','/:id/members','getMembers','/:id/messages','getMessages','addMembers','post','put','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5e1aa5,_0x35d6e9){var _0x2c4704=function(_0x57ae32){while(--_0x57ae32){_0x5e1aa5['push'](_0x5e1aa5['shift']());}};_0x2c4704(++_0x35d6e9);}(_0x5905,0xee));var _0x5590=function(_0x4f0ec1,_0x3a5fd2){_0x4f0ec1=_0x4f0ec1-0x0;var _0x4332a1=_0x5905[_0x4f0ec1];return _0x4332a1;};'use strict';var multer=require(_0x5590('0x0'));var util=require(_0x5590('0x1'));var path=require(_0x5590('0x2'));var timeout=require(_0x5590('0x3'));var express=require('express');var router=express[_0x5590('0x4')]();var auth=require(_0x5590('0x5'));var interaction=require(_0x5590('0x6'));var config=require('../../config/environment');var controller=require(_0x5590('0x7'));router[_0x5590('0x8')]('/',auth[_0x5590('0x9')](),controller[_0x5590('0xa')]);router['get'](_0x5590('0xb'),auth[_0x5590('0x9')](),controller[_0x5590('0xc')]);router[_0x5590('0x8')](_0x5590('0xd'),auth['isAuthenticated'](),controller[_0x5590('0xe')]);router[_0x5590('0x8')]('/:id/unread',auth[_0x5590('0x9')](),controller[_0x5590('0xf')]);router[_0x5590('0x8')](_0x5590('0x10'),auth['isAuthenticated'](),controller[_0x5590('0x11')]);router[_0x5590('0x8')](_0x5590('0x12'),auth['isAuthenticated'](),controller[_0x5590('0x13')]);router['post']('/',auth[_0x5590('0x9')](),controller['create']);router['post'](_0x5590('0x10'),auth[_0x5590('0x9')](),controller[_0x5590('0x14')]);router[_0x5590('0x15')](_0x5590('0x12'),auth[_0x5590('0x9')](),controller['addMessage']);router[_0x5590('0x16')](_0x5590('0xd'),auth[_0x5590('0x9')](),controller[_0x5590('0x17')]);router[_0x5590('0x18')](_0x5590('0xd'),auth[_0x5590('0x9')](),controller[_0x5590('0x19')]);router['delete'](_0x5590('0x10'),auth[_0x5590('0x9')](),controller[_0x5590('0x1a')]);module[_0x5590('0x1b')]=router; \ No newline at end of file +var _0xfd42=['addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','create'];(function(_0x225f50,_0x48a77d){var _0x19d003=function(_0x58965d){while(--_0x58965d){_0x225f50['push'](_0x225f50['shift']());}};_0x19d003(++_0x48a77d);}(_0xfd42,0x147));var _0x2fd4=function(_0x54cad1,_0x26f2fb){_0x54cad1=_0x54cad1-0x0;var _0xbfd5a9=_0xfd42[_0x54cad1];return _0xbfd5a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2fd4('0x0'));var timeout=require(_0x2fd4('0x1'));var express=require(_0x2fd4('0x2'));var router=express[_0x2fd4('0x3')]();var auth=require(_0x2fd4('0x4'));var interaction=require(_0x2fd4('0x5'));var config=require(_0x2fd4('0x6'));var controller=require('./chatGroup.controller');router['get']('/',auth[_0x2fd4('0x7')](),controller[_0x2fd4('0x8')]);router[_0x2fd4('0x9')](_0x2fd4('0xa'),auth['isAuthenticated'](),controller[_0x2fd4('0xb')]);router['get'](_0x2fd4('0xc'),auth['isAuthenticated'](),controller[_0x2fd4('0xd')]);router[_0x2fd4('0x9')](_0x2fd4('0xe'),auth[_0x2fd4('0x7')](),controller[_0x2fd4('0xf')]);router[_0x2fd4('0x9')](_0x2fd4('0x10'),auth[_0x2fd4('0x7')](),controller['getMembers']);router[_0x2fd4('0x9')](_0x2fd4('0x11'),auth[_0x2fd4('0x7')](),controller[_0x2fd4('0x12')]);router[_0x2fd4('0x13')]('/',auth[_0x2fd4('0x7')](),controller[_0x2fd4('0x14')]);router[_0x2fd4('0x13')](_0x2fd4('0x10'),auth['isAuthenticated'](),controller[_0x2fd4('0x15')]);router[_0x2fd4('0x13')](_0x2fd4('0x11'),auth[_0x2fd4('0x7')](),controller[_0x2fd4('0x16')]);router[_0x2fd4('0x17')](_0x2fd4('0xc'),auth[_0x2fd4('0x7')](),controller[_0x2fd4('0x18')]);router[_0x2fd4('0x19')](_0x2fd4('0xc'),auth['isAuthenticated'](),controller[_0x2fd4('0x1a')]);router[_0x2fd4('0x19')](_0x2fd4('0x10'),auth[_0x2fd4('0x7')](),controller[_0x2fd4('0x1b')]);module[_0x2fd4('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index efd54c3..9c6d6d2 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 _0x4df8=['STRING','TEXT','long','out','ENUM','star','thumb','DATE'];(function(_0x47242d,_0x13f993){var _0x30273a=function(_0x322cd2){while(--_0x322cd2){_0x47242d['push'](_0x47242d['shift']());}};_0x30273a(++_0x13f993);}(_0x4df8,0xac));var _0x84df=function(_0x261365,_0x57e053){_0x261365=_0x261365-0x0;var _0x17fe23=_0x4df8[_0x261365];return _0x17fe23;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x84df('0x0')](_0x84df('0x1'),_0x84df('0x2')),'defaultValue':_0x84df('0x1')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x84df('0x3')]},'disposition':{'type':Sequelize[_0x84df('0x4')]},'secondDisposition':{'type':Sequelize[_0x84df('0x4')]},'thirdDisposition':{'type':Sequelize[_0x84df('0x4')]},'note':{'type':Sequelize[_0x84df('0x4')]},'browserName':{'type':Sequelize[_0x84df('0x4')]},'browserVersion':{'type':Sequelize[_0x84df('0x4')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x84df('0x4')]},'deviceModel':{'type':Sequelize[_0x84df('0x4')]},'deviceVendor':{'type':Sequelize[_0x84df('0x4')]},'deviceType':{'type':Sequelize[_0x84df('0x4')]},'referer':{'type':Sequelize[_0x84df('0x5')]},'customerIp':{'type':Sequelize[_0x84df('0x4')]},'formData':{'type':Sequelize[_0x84df('0x5')](_0x84df('0x6'))},'read1stAt':{'type':Sequelize[_0x84df('0x3')]},'lastMsgAt':{'type':Sequelize[_0x84df('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x84df('0x0')]('in',_0x84df('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x84df('0x4')]},'customerPort':{'type':Sequelize[_0x84df('0x4')]},'vidaooSessionId':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xdb0d=['STRING','long','DATE','out','sequelize','exports','INTEGER','ENUM','star','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb0d,0x90));var _0xddb0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdb0d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xddb0('0x0'));module[_0xddb0('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xddb0('0x2')]},'ratingType':{'type':Sequelize[_0xddb0('0x3')](_0xddb0('0x4'),'thumb'),'defaultValue':_0xddb0('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xddb0('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xddb0('0x6')]},'thirdDisposition':{'type':Sequelize[_0xddb0('0x6')]},'note':{'type':Sequelize[_0xddb0('0x6')]},'browserName':{'type':Sequelize[_0xddb0('0x6')]},'browserVersion':{'type':Sequelize[_0xddb0('0x6')]},'osName':{'type':Sequelize[_0xddb0('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xddb0('0x6')]},'deviceVendor':{'type':Sequelize[_0xddb0('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0xddb0('0x5')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xddb0('0x7'))},'read1stAt':{'type':Sequelize[_0xddb0('0x8')]},'lastMsgAt':{'type':Sequelize[_0xddb0('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xddb0('0x3')]('in',_0xddb0('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xddb0('0x6')]},'customerPort':{'type':Sequelize[_0xddb0('0x6')]},'vidaooSessionId':{'type':Sequelize[_0xddb0('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 4a58069..0e1ce19 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 _0x7fd0=['sequelize','toString','merge','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','rows','keys','rawAttributes','includeAll','include','options','destroy','params','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','MotionCWB:','follow','ValidationError','join_url','out','ChatMessage','create','Sequelize','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','Unauthorized','attachId','download','join','root','close','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','CmContact','%s%d','agentAlias','System','agentIdentifier','website_alias','agent_alias','fullname','[%s]\x20%s:\x20%s\x0a','createdAt','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','hasOwnProperty','includeAgent','push','alias','addTags','emit','chatInteractionTags:save','removeTags','unix','files','tmp','server','attachments','transcript-%d-%s.zip','firstName','lastName','Account','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','N.A.','closedAt','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','views','downloadInteraction.html','toFile','transcript-','.pdf','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','status','json','count','offset','limit','set','apply','reject','save','update','then','end','sendStatus','stack','name','send','Users','map','TagIds','split','forEach','Tags','catch','index','ChatInteraction','key','model','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','chat_websites','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','type','body','buildExpression','some','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','parse','$gte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','agent','i.ChatWebsiteId\x20IS\x20NULL','role'];(function(_0x5ea62c,_0x437ce3){var _0x1755f4=function(_0x28fd95){while(--_0x28fd95){_0x5ea62c['push'](_0x5ea62c['shift']());}};_0x1755f4(++_0x437ce3);}(_0x7fd0,0x1c7));var _0x07fd=function(_0x274819,_0x13107a){_0x274819=_0x274819-0x0;var _0x1a71ce=_0x7fd0[_0x274819];return _0x1a71ce;};'use strict';var pdf=require(_0x07fd('0x0'));var emlformat=require(_0x07fd('0x1'));var rimraf=require(_0x07fd('0x2'));var zipdir=require(_0x07fd('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x07fd('0x4'));var moment=require('moment');var BPromise=require(_0x07fd('0x5'));var Mustache=require('mustache');var util=require(_0x07fd('0x6'));var path=require('path');var sox=require(_0x07fd('0x7'));var csv=require('to-csv');var ejs=require(_0x07fd('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x07fd('0x9'));var crypto=require(_0x07fd('0xa'));var jsforce=require(_0x07fd('0xb'));var deskjs=require(_0x07fd('0xc'));var toCsv=require(_0x07fd('0xd'));var querystring=require(_0x07fd('0xe'));var Papa=require(_0x07fd('0xf'));var Redis=require(_0x07fd('0x10'));var authService=require(_0x07fd('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x07fd('0x12'));var logger=require(_0x07fd('0x13'))(_0x07fd('0x14'));var utils=require(_0x07fd('0x15'));var config=require(_0x07fd('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x07fd('0x17')]=_[_0x07fd('0x18')](config[_0x07fd('0x17')],{'host':_0x07fd('0x19'),'port':0x18eb});var socket=require(_0x07fd('0x1a'))(new Redis(config[_0x07fd('0x17')]));require('./chatInteraction.socket')[_0x07fd('0x1b')](socket);var jayson=require(_0x07fd('0x1c'));var client=jayson[_0x07fd('0x1d')]['http']({'port':0x232b});var client9004=jayson[_0x07fd('0x1d')][_0x07fd('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x33d8df,_0x17e2b5,_0xcfefcc,_0x3006c9){return new BPromise(function(_0x90865e,_0x421595){var _0x408f63=_0x3006c9||client;return _0x408f63[_0x07fd('0x1f')](_0x33d8df,_0xcfefcc)['then'](function(_0x34bdbd){logger['info'](_0x07fd('0x20'),_0x17e2b5,_0x07fd('0x21'));logger['debug'](_0x07fd('0x22'),_0x17e2b5,'request\x20sent',JSON['stringify'](_0x34bdbd));if(_0x34bdbd['error']){if(_0x34bdbd[_0x07fd('0x23')][_0x07fd('0x24')]===0x1f4){logger[_0x07fd('0x23')](_0x07fd('0x20'),_0x17e2b5,_0x34bdbd[_0x07fd('0x23')][_0x07fd('0x25')]);return _0x421595(_0x34bdbd[_0x07fd('0x23')][_0x07fd('0x25')]);}logger['error'](_0x07fd('0x20'),_0x17e2b5,_0x34bdbd[_0x07fd('0x23')][_0x07fd('0x25')]);return _0x90865e(_0x34bdbd[_0x07fd('0x23')]['message']);}else{logger[_0x07fd('0x26')](_0x07fd('0x20'),_0x17e2b5,_0x07fd('0x21'));_0x90865e(_0x34bdbd[_0x07fd('0x27')][_0x07fd('0x25')]);}})['catch'](function(_0x4cb97b){logger[_0x07fd('0x23')](_0x07fd('0x20'),_0x17e2b5,_0x4cb97b);_0x421595(_0x4cb97b);});});}function respondWithStatusCode(_0x41d570,_0xb7a498){_0xb7a498=_0xb7a498||0xcc;return function(_0x241779){if(_0x241779){return _0x41d570['sendStatus'](_0xb7a498);}return _0x41d570['status'](_0xb7a498)['end']();};}function respondWithResult(_0x23a444,_0x1a8d44){_0x1a8d44=_0x1a8d44||0xc8;return function(_0x4c147f){if(_0x4c147f){return _0x23a444[_0x07fd('0x28')](_0x1a8d44)[_0x07fd('0x29')](_0x4c147f);}};}function respondWithFilteredResult(_0x4f3b72,_0x27b432){return function(_0x5ad3f1){if(_0x5ad3f1){var _0x23d0b2=_0x5ad3f1[_0x07fd('0x2a')],_0x1d03e4=_0x27b432[_0x07fd('0x2b')],_0x391c8f=_0x27b432[_0x07fd('0x2b')]+_0x27b432[_0x07fd('0x2c')],_0x4c2cb7;if(_0x391c8f>=_0x23d0b2){_0x391c8f=_0x23d0b2;_0x4c2cb7=0xc8;}else{_0x4c2cb7=0xce;}_0x4f3b72[_0x07fd('0x28')](_0x4c2cb7);return _0x4f3b72[_0x07fd('0x2d')]('Content-Range',_0x1d03e4+'-'+_0x391c8f+'/'+_0x23d0b2)[_0x07fd('0x29')](_0x5ad3f1);}return null;};}function patchUpdates(_0x5123e7){return function(_0x2fbe53){try{jsonpatch[_0x07fd('0x2e')](_0x2fbe53,_0x5123e7,!![]);}catch(_0x4ec686){return BPromise[_0x07fd('0x2f')](_0x4ec686);}return _0x2fbe53[_0x07fd('0x30')]();};}function saveUpdates(_0x1434a2,_0x48c25f){return function(_0x47dd6f){if(_0x47dd6f){return _0x47dd6f[_0x07fd('0x31')](_0x1434a2)[_0x07fd('0x32')](function(_0x3f8795){return _0x3f8795;});}return null;};}function removeEntity(_0x3e512c,_0x4b1afc){return function(_0x432d8c){if(_0x432d8c){return _0x432d8c['destroy']()[_0x07fd('0x32')](function(){_0x3e512c[_0x07fd('0x28')](0xcc)[_0x07fd('0x33')]();});}};}function handleEntityNotFound(_0x4ac4c7,_0x1d44eb){return function(_0x1cfdb8){if(!_0x1cfdb8){_0x4ac4c7[_0x07fd('0x34')](0x194);}return _0x1cfdb8;};}function handleError(_0x36bc57,_0x286c0c){_0x286c0c=_0x286c0c||0x1f4;return function(_0x3b5d3d){logger[_0x07fd('0x23')](_0x3b5d3d[_0x07fd('0x35')]);if(_0x3b5d3d[_0x07fd('0x36')]){delete _0x3b5d3d['name'];}_0x36bc57[_0x07fd('0x28')](_0x286c0c)[_0x07fd('0x37')](_0x3b5d3d);};}function getInteractionUsers(_0x2802f5,_0x428ff6){return new BPromise(function(_0x435840,_0x497c8d){try{if(_0x428ff6[_0x2802f5['id']]){_0x2802f5[_0x07fd('0x38')]=_[_0x07fd('0x39')](_0x428ff6[_0x2802f5['id']],function(_0x2ef9d6){return{'id':_0x2ef9d6['id'],'fullname':_0x2ef9d6['fullname']};});}}catch(_0x5a388c){_0x497c8d(_0x5a388c);}_0x435840(_0x2802f5);});}function getInteractionTags(_0x2e57ac,_0xd9f7a8){return new BPromise(function(_0x3e578d,_0xe7c80e){try{if(_0x2e57ac[_0x07fd('0x3a')]){_0x2e57ac['Tags']=[];_0x2e57ac[_0x07fd('0x3a')][_0x07fd('0x3b')](',')[_0x07fd('0x3c')](function(_0x59fd7a){_0x2e57ac[_0x07fd('0x3d')]['push'](_0xd9f7a8[_0x59fd7a]);});}delete _0x2e57ac['TagIds'];}catch(_0x3e52c9){_0xe7c80e(_0x3e52c9);}_0x3e578d(_0x2e57ac);});}function updateChatInteraction(_0x43affd,_0x37411b,_0x4d6225){return new BPromise(function(_0x5e4606,_0x3436da){return getInteractionUsers(_0x43affd,_0x4d6225)[_0x07fd('0x32')](function(_0x822f5f){return getInteractionTags(_0x822f5f,_0x37411b);})[_0x07fd('0x32')](function(_0x1e1f93){_0x5e4606(_0x1e1f93);})[_0x07fd('0x3e')](function(_0x24dc0e){_0x3436da(_0x24dc0e);});});}exports[_0x07fd('0x3f')]=function(_0x541bfe,_0x11e6b6){var _0x90ded4={},_0x236c38={},_0x2d0501={'count':0x0,'rows':[]};var _0x4b7bf=_['map'](db[_0x07fd('0x40')]['rawAttributes'],function(_0x4ef6f2){return{'name':_0x4ef6f2['fieldName'],'type':_0x4ef6f2['type'][_0x07fd('0x41')]};});_0x236c38[_0x07fd('0x42')]=_[_0x07fd('0x39')](_0x4b7bf,'name');_0x236c38['query']=_['keys'](_0x541bfe['query']);_0x236c38[_0x07fd('0x43')]=_[_0x07fd('0x44')](_0x236c38[_0x07fd('0x42')],_0x236c38[_0x07fd('0x45')]);_0x90ded4[_0x07fd('0x46')]=_[_0x07fd('0x44')](_0x236c38[_0x07fd('0x42')],qs[_0x07fd('0x47')](_0x541bfe[_0x07fd('0x45')][_0x07fd('0x47')]));_0x90ded4[_0x07fd('0x46')]=_0x90ded4[_0x07fd('0x46')][_0x07fd('0x48')]?_0x90ded4[_0x07fd('0x46')]:_0x236c38[_0x07fd('0x42')];if(!_0x541bfe[_0x07fd('0x45')]['hasOwnProperty'](_0x07fd('0x49'))){_0x90ded4['limit']=qs[_0x07fd('0x2c')](_0x541bfe[_0x07fd('0x45')]['limit']);_0x90ded4['offset']=qs['offset'](_0x541bfe[_0x07fd('0x45')][_0x07fd('0x2b')]);}_0x90ded4[_0x07fd('0x4a')]=qs[_0x07fd('0x4b')](_0x541bfe['query'][_0x07fd('0x4b')]);_0x90ded4[_0x07fd('0x4c')]=qs[_0x07fd('0x43')](_[_0x07fd('0x4d')](_0x541bfe[_0x07fd('0x45')],_0x236c38[_0x07fd('0x43')]),_0x4b7bf);var _0x595066=[];var _0x53cae4=squel[_0x07fd('0x4e')]()[_0x07fd('0x4f')]('id')[_0x07fd('0x4f')](_0x07fd('0x36'))[_0x07fd('0x4f')](_0x07fd('0x50'))[_0x07fd('0x51')]('tools_tags');var _0x686be4=squel[_0x07fd('0x4e')]()[_0x07fd('0x4f')](_0x07fd('0x52'))['field'](_0x07fd('0x53'))[_0x07fd('0x4f')](_0x07fd('0x54'))[_0x07fd('0x51')](_0x07fd('0x55'),'ui')[_0x07fd('0x56')]('users','u',_0x07fd('0x57'));var _0x19c4d1=squel[_0x07fd('0x4e')]()[_0x07fd('0x51')](_0x07fd('0x58'),'i')[_0x07fd('0x56')](_0x07fd('0x59'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x07fd('0x5a'),'o',_0x07fd('0x5b'))[_0x07fd('0x56')](_0x07fd('0x5c'),'a','a.id\x20=\x20i.ChatWebsiteId')['left_join']('chat_messages','me',_0x07fd('0x5d'))[_0x07fd('0x56')](_0x07fd('0x5e'),'it',_0x07fd('0x5f'))[_0x07fd('0x56')](_0x07fd('0x60'),'t',_0x07fd('0x61'));var _0x51052d=squel[_0x07fd('0x62')]();var _0x2c8be1=[];var _0x4b9d6f=squel[_0x07fd('0x62')]();var _0x4820f7;if(_0x541bfe[_0x07fd('0x45')][_0x07fd('0x63')]){_0x4820f7=as[_0x07fd('0x64')](_0x541bfe[_0x07fd('0x45')][_0x07fd('0x63')]);var _0x385a90=_0x4820f7[_0x07fd('0x65')];for(var _0x81a13a=0x0;_0x81a13a<_0x4820f7['conditions'][_0x07fd('0x48')];_0x81a13a++){var _0x2e3f4d=_0x4820f7[_0x07fd('0x66')][_0x81a13a];var _0x4fccff='i';var _0x4a90a2=_[_0x07fd('0x67')](_0x4b7bf,[_0x07fd('0x36'),_0x2e3f4d[_0x07fd('0x4f')]]);if(!_0x4a90a2){switch(_0x2e3f4d[_0x07fd('0x4f')]){case _0x07fd('0x68'):if(_0x2e3f4d[_0x07fd('0x69')]==0x1){_0x19c4d1[_0x07fd('0x6a')]('`'+_0x2e3f4d[_0x07fd('0x4f')]+_0x07fd('0x6b'));}else{_0x19c4d1[_0x07fd('0x6a')]('`'+_0x2e3f4d['field']+'`\x20>\x200');}break;case _0x07fd('0x6c'):if(_0x2e3f4d[_0x07fd('0x6d')]===_0x07fd('0x6e')){if(_0x2e3f4d[_0x07fd('0x69')][_0x07fd('0x3b')]('\x20')[_0x07fd('0x48')]>0x1){_0x51052d[_0x385a90](_0x07fd('0x6f'),qs[_0x07fd('0x70')](_0x2e3f4d[_0x07fd('0x69')]),null);}else{var _0x1ee229='%'+_0x2e3f4d['value']+'%';_0x51052d[_0x385a90](_0x07fd('0x71'),_0x1ee229,_0x1ee229,_0x1ee229);}}else{_0x4a90a2=_[_0x07fd('0x67')](_0x4b7bf,[_0x07fd('0x36'),'ContactId']);_0x2e3f4d[_0x07fd('0x4f')]=_0x07fd('0x72');_0x40ee0f=as['buildExpression'](_0x4fccff,_0x4a90a2['type'],_0x2e3f4d);_0x51052d[_0x385a90](_0x40ee0f[_0x07fd('0x73')],_0x40ee0f[_0x07fd('0x69')][_0x07fd('0x74')],_0x40ee0f[_0x07fd('0x69')][_0x07fd('0x33')]);}break;case _0x07fd('0x75'):var _0x199754=_0x2e3f4d['value'][_0x07fd('0x3b')](',')[_0x07fd('0x39')](function(_0x1076ac){return Number(_0x1076ac);});_0x199754[_0x07fd('0x3c')](function(_0xe76319){_0x4b9d6f['or'](_0x07fd('0x76'),'%,'+_0xe76319+',%');});_0x2c8be1=_[_0x07fd('0x77')](_0x2c8be1,_0x199754);break;case _0x07fd('0x78'):if(_0x2e3f4d[_0x07fd('0x6d')]===_0x07fd('0x6e')){_0x51052d[_0x385a90]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2e3f4d[_0x07fd('0x69')]+'%',null);}else{_0x4a90a2=_[_0x07fd('0x67')](_0x4b7bf,[_0x07fd('0x36'),_0x07fd('0x79')]);_0x2e3f4d[_0x07fd('0x4f')]=_0x07fd('0x79');_0x40ee0f=as['buildExpression'](_0x4fccff,_0x4a90a2[_0x07fd('0x7a')],_0x2e3f4d);_0x51052d[_0x385a90](_0x40ee0f[_0x07fd('0x73')],_0x40ee0f['value'][_0x07fd('0x74')],_0x40ee0f['value'][_0x07fd('0x33')]);}break;case _0x07fd('0x7b'):_0x40ee0f=as['buildExpression']('me',null,_0x2e3f4d);_0x51052d[_0x385a90](_0x40ee0f['text'],_0x40ee0f['value'][_0x07fd('0x74')],_0x40ee0f[_0x07fd('0x69')][_0x07fd('0x33')]);break;}}else{var _0x40ee0f=as[_0x07fd('0x7c')](_0x4fccff,_0x4a90a2[_0x07fd('0x7a')],_0x2e3f4d);_0x51052d[_0x385a90](_0x40ee0f[_0x07fd('0x73')],_0x40ee0f[_0x07fd('0x69')][_0x07fd('0x74')],_0x40ee0f['value']['end']);}}}else{var _0x14aea8=_(_0x541bfe[_0x07fd('0x45')])['keys']()[_0x07fd('0x39')](function(_0x2d60e8){return _[_0x07fd('0x7d')](_0x4b7bf,[_0x07fd('0x36'),_0x2d60e8])?_0x2d60e8:undefined;})['compact']()[_0x07fd('0x69')]();if(!_[_0x07fd('0x7e')](_0x14aea8)){_0x14aea8[_0x07fd('0x3c')](function(_0x2af0ef){if(_0x2af0ef===_0x07fd('0x7f')){_0x19c4d1[_0x07fd('0x4c')](_0x07fd('0x80'),[][_0x07fd('0x81')](_0x541bfe['query'][_0x2af0ef]));}else if(_0x2af0ef==='createdAt'){var _0x31e69e=JSON[_0x07fd('0x82')](_0x541bfe[_0x07fd('0x45')][_0x2af0ef])[_0x07fd('0x83')];var _0x4eca5b=JSON[_0x07fd('0x82')](_0x541bfe['query'][_0x2af0ef])['$lte'];_0x19c4d1[_0x07fd('0x4c')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x31e69e,_0x4eca5b);}else{if(_0x541bfe[_0x07fd('0x45')][_0x2af0ef]===_0x07fd('0x84')){_0x19c4d1[_0x07fd('0x4c')]('i.'+_0x2af0ef+_0x07fd('0x85'));}else{_0x19c4d1['where']('i.'+_0x2af0ef+_0x07fd('0x86'),_0x541bfe[_0x07fd('0x45')][_0x2af0ef]);}}});}if(_0x541bfe[_0x07fd('0x45')][_0x07fd('0x87')]){if(_0x541bfe[_0x07fd('0x45')]['read']==0x1){_0x19c4d1[_0x07fd('0x6a')](_0x07fd('0x88'));}else{_0x19c4d1[_0x07fd('0x6a')](_0x07fd('0x89'));}}if(_0x541bfe[_0x07fd('0x45')]['tag']){_0x2c8be1=_[_0x07fd('0x8a')](_0x541bfe[_0x07fd('0x45')][_0x07fd('0x8b')])?_0x541bfe[_0x07fd('0x45')][_0x07fd('0x8b')]:new Array(_0x541bfe['query'][_0x07fd('0x8b')]);_0x2c8be1['forEach'](function(_0x43aeb8){_0x4b9d6f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x43aeb8+',%');});}if(_0x541bfe[_0x07fd('0x45')][_0x07fd('0x8c')]){var _0x214291=_0x541bfe[_0x07fd('0x45')][_0x07fd('0x8c')][_0x07fd('0x8d')]('\x5c','\x5c\x5c')[_0x07fd('0x8d')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x214291)){_0x51052d['or'](_0x07fd('0x8e'),_0x214291+'%');}else{_0x51052d['or'](_0x07fd('0x8f'),qs[_0x07fd('0x70')](_0x214291))['or'](_0x07fd('0x90'),_0x214291+'%');}}}_0x19c4d1['where'](_0x51052d);_0x19c4d1[_0x07fd('0x91')](_0x07fd('0x92'));var _0xac3e17={'type':db['Sequelize'][_0x07fd('0x93')][_0x07fd('0x94')],'raw':!![]};var _0x97ad3a=_0x19c4d1[_0x07fd('0x95')]();_0x97ad3a[_0x07fd('0x4f')](_0x07fd('0x92'));_0x97ad3a[_0x07fd('0x4f')](_0x07fd('0x96'),_0x07fd('0x68'));if(_0x90ded4[_0x07fd('0x4a')]){_0x90ded4[_0x07fd('0x4a')][_0x07fd('0x3c')](function(_0x5cb64f){var _0x500c9a=_0x5cb64f[0x0]===_0x07fd('0x97')?_0x5cb64f[0x0]:'i.'+_0x5cb64f[0x0];_0x19c4d1['order'](_0x500c9a,_0x5cb64f[0x1]===_0x07fd('0x98')?![]:!![]);});}if(!_[_0x07fd('0x7e')](_0x2c8be1)){_0x19c4d1[_0x07fd('0x6a')](_0x4b9d6f);_0x97ad3a[_0x07fd('0x4c')]('t.id\x20IN\x20?',_0x2c8be1);}BPromise[_0x07fd('0x99')]()[_0x07fd('0x32')](function(){if(!_0x4820f7){if(_0x541bfe[_0x07fd('0x45')]['ChatWebsiteId'])return;_0x97ad3a[_0x07fd('0x4c')](_0x07fd('0x9a'));_0x19c4d1[_0x07fd('0x4c')](_0x07fd('0x9a'));return;}if(_0x541bfe[_0x07fd('0x9b')]['role']!==_0x07fd('0x9c'))return;return _0x541bfe['user']['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x07fd('0x32')](function(_0x4b0561){if(_['isEmpty'](_0x4b0561)){_0x97ad3a[_0x07fd('0x4c')](_0x07fd('0x9d'));_0x19c4d1[_0x07fd('0x4c')](_0x07fd('0x9d'));}else{_0x97ad3a[_0x07fd('0x4c')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x4b0561,'id'));_0x19c4d1[_0x07fd('0x4c')](_0x07fd('0x80'),_[_0x07fd('0x39')](_0x4b0561,'id'));}});})[_0x07fd('0x32')](function(){if(_0x541bfe[_0x07fd('0x9b')][_0x07fd('0x9e')]===_0x07fd('0x9c')&&!_0x4820f7&&!_0x541bfe[_0x07fd('0x45')][_0x07fd('0x7f')])return[];return db[_0x07fd('0x9f')][_0x07fd('0x45')](_0x97ad3a[_0x07fd('0xa0')](),_0xac3e17);})[_0x07fd('0x32')](function(_0x513648){_0x2d0501['count']=_0x513648[_0x07fd('0x48')];if(_0x2d0501[_0x07fd('0x2a')]===0x0)return[];return db[_0x07fd('0x9f')][_0x07fd('0x45')](_0x53cae4[_0x07fd('0xa0')](),_0xac3e17)[_0x07fd('0x32')](function(_0xfc3d7d){_0x595066=_['keyBy'](_0xfc3d7d,'id');_0xac3e17=_[_0x07fd('0xa1')](_0xac3e17,{'model':db[_0x07fd('0x40')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x541bfe[_0x07fd('0x45')][_0x07fd('0x47')]){_0x90ded4[_0x07fd('0x46')][_0x07fd('0x3c')](function(_0x45d0af){_0x19c4d1[_0x07fd('0x4f')]('i.'+_0x45d0af);});}else{_0x19c4d1[_0x07fd('0x4f')](_0x07fd('0x96'),_0x07fd('0x68'));_0x19c4d1[_0x07fd('0x4f')](_0x07fd('0xa2'),_0x07fd('0xa3'));_0x19c4d1[_0x07fd('0x4f')]('a.mandatoryDisposition',_0x07fd('0xa4'));_0x19c4d1[_0x07fd('0x4f')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x07fd('0x97'));_0x19c4d1[_0x07fd('0x4f')](_0x07fd('0xa5'));_0x19c4d1[_0x07fd('0x4f')](_0x07fd('0xa6'),'Contact.firstName');_0x19c4d1[_0x07fd('0x4f')](_0x07fd('0xa7'),'Contact.lastName');_0x19c4d1[_0x07fd('0x4f')](_0x07fd('0xa8'),_0x07fd('0xa9'));_0x19c4d1[_0x07fd('0x4f')](_0x07fd('0xaa'),_0x07fd('0xab'));_0x19c4d1[_0x07fd('0x4f')](_0x07fd('0xac'),'Contact.mobile');_0x19c4d1[_0x07fd('0x4f')](_0x07fd('0xad'),'Contact.fax');_0x19c4d1[_0x07fd('0x4f')]('o.fullname',_0x07fd('0xae'));_0x19c4d1['field'](_0x07fd('0xaf'),_0x07fd('0xb0'));_0x19c4d1[_0x07fd('0x4f')](_0x07fd('0xb1'),_0x07fd('0x3a'));}if(_0x90ded4[_0x07fd('0x2c')])_0x19c4d1['limit'](_0x90ded4['limit']);if(_0x90ded4[_0x07fd('0x2b')])_0x19c4d1[_0x07fd('0x2b')](_0x90ded4[_0x07fd('0x2b')]);return db[_0x07fd('0x9f')][_0x07fd('0x45')](_0x19c4d1[_0x07fd('0xa0')](),_0xac3e17);})['then'](function(_0x4a7923){_0x686be4[_0x07fd('0x4c')]('ui.ChatInteractionId\x20IN\x20?',_[_0x07fd('0x39')](_0x4a7923,'id'));return db['sequelize'][_0x07fd('0x45')](_0x686be4[_0x07fd('0xa0')](),_0xac3e17)[_0x07fd('0x32')](function(_0x390b94){var _0x37e8ab=_['groupBy'](_0x390b94,'ChatInteractionId');var _0x393afb=[];_0x4a7923[_0x07fd('0x3c')](function(_0x580254){_0x393afb['push'](updateChatInteraction(_0x580254,_0x595066,_0x37e8ab));});return BPromise['all'](_0x393afb);});});})['then'](function(_0x5a590d){_0x2d0501[_0x07fd('0xb2')]=_0x5a590d;return _0x2d0501;})['then'](respondWithFilteredResult(_0x11e6b6,_0x90ded4))[_0x07fd('0x3e')](handleError(_0x11e6b6,null));};exports['show']=function(_0x121da1,_0x174086){var _0x5c92d8={'raw':![],'where':{'id':_0x121da1['params']['id']}},_0x1ad880={};_0x1ad880[_0x07fd('0x42')]=_[_0x07fd('0xb3')](db['ChatInteraction'][_0x07fd('0xb4')]);_0x1ad880[_0x07fd('0x45')]=_[_0x07fd('0xb3')](_0x121da1[_0x07fd('0x45')]);_0x1ad880[_0x07fd('0x43')]=_[_0x07fd('0x44')](_0x1ad880['model'],_0x1ad880[_0x07fd('0x45')]);_0x5c92d8['attributes']=_[_0x07fd('0x44')](_0x1ad880['model'],qs['fields'](_0x121da1[_0x07fd('0x45')][_0x07fd('0x47')]));_0x5c92d8['attributes']=_0x5c92d8[_0x07fd('0x46')]['length']?_0x5c92d8[_0x07fd('0x46')]:_0x1ad880[_0x07fd('0x42')];if(_0x121da1[_0x07fd('0x45')][_0x07fd('0xb5')]){_0x5c92d8[_0x07fd('0xb6')]=[{'all':!![]}];}_0x5c92d8=_['merge']({},_0x5c92d8,_0x121da1[_0x07fd('0xb7')]);return db[_0x07fd('0x40')][_0x07fd('0x67')](_0x5c92d8)[_0x07fd('0x32')](handleEntityNotFound(_0x174086,null))[_0x07fd('0x32')](respondWithResult(_0x174086,null))[_0x07fd('0x3e')](handleError(_0x174086,null));};exports['create']=function(_0x20c1b6,_0x21cd3d){return db['ChatInteraction']['create'](_0x20c1b6[_0x07fd('0x7b')],{})[_0x07fd('0x32')](respondWithResult(_0x21cd3d,0xc9))[_0x07fd('0x3e')](handleError(_0x21cd3d,null));};exports[_0x07fd('0x31')]=function(_0xca47e0,_0x4493a0){if(_0xca47e0[_0x07fd('0x7b')]['id']){delete _0xca47e0[_0x07fd('0x7b')]['id'];}return db[_0x07fd('0x40')][_0x07fd('0x67')]({'where':{'id':_0xca47e0['params']['id']}})[_0x07fd('0x32')](handleEntityNotFound(_0x4493a0,null))[_0x07fd('0x32')](saveUpdates(_0xca47e0[_0x07fd('0x7b')],null))[_0x07fd('0x32')](respondWithResult(_0x4493a0,null))[_0x07fd('0x3e')](handleError(_0x4493a0,null));};exports[_0x07fd('0xb8')]=function(_0x23c5e5,_0x109857){return db['ChatInteraction'][_0x07fd('0x67')]({'where':{'id':_0x23c5e5[_0x07fd('0xb9')]['id']}})['then'](handleEntityNotFound(_0x109857,null))[_0x07fd('0x32')](removeEntity(_0x109857,null))['catch'](handleError(_0x109857,null));};exports[_0x07fd('0xba')]=function(_0x527552,_0x47fe98){return db[_0x07fd('0x40')][_0x07fd('0xba')]()['then'](respondWithResult(_0x47fe98,null))[_0x07fd('0x3e')](handleError(_0x47fe98,null));};exports[_0x07fd('0xbb')]=function(_0x51022d,_0x4997ed){var _0x406689=_0x51022d[_0x07fd('0xb9')]['id'];var _0x83f397;var _0xcadd17;var _0x491d4d;return db[_0x07fd('0x40')][_0x07fd('0xbc')]({'where':{'id':_0x406689}})[_0x07fd('0x32')](function(_0x4e59a2){_0x83f397=_0x4e59a2;return db[_0x07fd('0xbd')][_0x07fd('0xbc')]({'where':{'id':_0x4e59a2['ChatWebsiteId']},'attributes':['id',_0x07fd('0xbe'),_0x07fd('0xbf')],'raw':!![]});})[_0x07fd('0x32')](function(_0x78d353){if(_0x78d353&&_0x78d353['vidaooApiKey']&&_0x78d353[_0x07fd('0xbf')]){_0xcadd17=_0x78d353;var _0x813f39={'rejectUnauthorized':![],'method':_0x07fd('0xc0'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x78d353['vidaooApiKey']},'body':{'name':_0x07fd('0xc1')+_0x406689},'redirect':_0x07fd('0xc2'),'json':!![]};return rp(_0x813f39);}else{throw new db['Sequelize'][(_0x07fd('0xc3'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x07fd('0x32')](function(_0x1bc8a9){_0x491d4d=_0x1bc8a9;if(_0x491d4d['id']){var _0x145251={'body':_0x491d4d[_0x07fd('0xc4')],'ChatWebsiteId':_0xcadd17['id'],'ChatInteractionId':_0x83f397['id'],'direction':_0x07fd('0xc5'),'UserId':_0x51022d[_0x07fd('0x9b')]['id']};return db[_0x07fd('0xc6')][_0x07fd('0xc7')](_0x145251,{});}else{throw new db[(_0x07fd('0xc8'))][(_0x07fd('0xc3'))](_0x07fd('0xc9'));}})['then'](function(){return _0x83f397[_0x07fd('0xca')]({'vidaooSessionId':_0x491d4d['id']});})[_0x07fd('0x32')](respondWithResult(_0x4997ed,null))['catch'](handleError(_0x4997ed,null));};exports['customUpdate']=function(_0x29d4da,_0x2ffbdf){if(_0x29d4da['body']['id']){delete _0x29d4da[_0x07fd('0x7b')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x29d4da['params']['id']}})['then'](handleEntityNotFound(_0x2ffbdf,null))['then'](saveUpdates(_0x29d4da[_0x07fd('0x7b')],null))[_0x07fd('0x32')](respondWithResult(_0x2ffbdf,null))['catch'](handleError(_0x2ffbdf,null));};exports[_0x07fd('0xcb')]=function(_0x18ba11,_0x1fb6ec,_0x419342){if(_0x18ba11[_0x07fd('0x7b')]['id']){delete _0x18ba11[_0x07fd('0x7b')]['id'];}return db[_0x07fd('0x40')][_0x07fd('0x67')]({'where':{'id':_0x18ba11[_0x07fd('0xb9')]['id']}})[_0x07fd('0x32')](function(_0x313a35){if(!_0x313a35){logger[_0x07fd('0x23')](_0x07fd('0xcc'),'abandon',0x194,_0x07fd('0xcd'));_0x1fb6ec[_0x07fd('0x34')](0x194);}else{if(_0x313a35[_0x07fd('0x79')]){throw new db[(_0x07fd('0xc8'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x313a35;})[_0x07fd('0x32')](function(_0x36b79f){if(_0x36b79f){return _0x36b79f[_0x07fd('0x31')]({'closed':_0x18ba11[_0x07fd('0x7b')][_0x07fd('0xce')],'disposition':_0x18ba11['body'][_0x07fd('0xcf')]})[_0x07fd('0x32')](function(_0x5d7853){return _0x5d7853;});}})['then'](function(_0x4b3c15){return respondWithRpcPromise(_0x07fd('0xd0'),_0x07fd('0xcb'),_0x18ba11[_0x07fd('0x7b')],client9004);})['then'](respondWithResult(_0x1fb6ec,null))['catch'](handleError(_0x1fb6ec,null));};exports[_0x07fd('0xd1')]=function(_0x583b30,_0x3c77ae,_0x5bfc04){_0x583b30['body'][_0x07fd('0x36')]=_0x583b30[_0x07fd('0xd2')][_0x07fd('0xd3')];_0x583b30['body'][_0x07fd('0xd4')]=_0x583b30['file'][_0x07fd('0xd5')];_0x583b30[_0x07fd('0x7b')]['type']=_0x583b30[_0x07fd('0xd2')][_0x07fd('0xd6')];return db[_0x07fd('0xd7')][_0x07fd('0xc7')](_0x583b30[_0x07fd('0x7b')])[_0x07fd('0x32')](respondWithResult(_0x3c77ae,0xc9))[_0x07fd('0x3e')](handleError(_0x3c77ae,null));};exports['attachmentDownload']=function(_0x55531b,_0x3d805a,_0x14725d){return db['ChatInteraction'][_0x07fd('0xbc')]({'where':{'id':_0x55531b['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3d805a,null))[_0x07fd('0x32')](function(_0x33298d){if(_0x33298d){if(_0x33298d[_0x07fd('0xce')]){return _0x3d805a[_0x07fd('0x28')](0x193)[_0x07fd('0x29')]({'status':0x193,'message':_0x07fd('0xd8')});}return db['Attachment'][_0x07fd('0xbc')]({'where':{'id':_0x55531b[_0x07fd('0x45')][_0x07fd('0xd9')]},'raw':!![]})[_0x07fd('0x32')](handleEntityNotFound(_0x3d805a,null));}})[_0x07fd('0x32')](function(_0x1ae949){if(_0x1ae949){return _0x3d805a[_0x07fd('0xda')](path[_0x07fd('0xdb')](config[_0x07fd('0xdc')],'server/files/attachments/',_0x1ae949[_0x07fd('0xd4')]));}})['catch'](handleError(_0x3d805a,null));};exports[_0x07fd('0xdd')]=function(_0x2cd7ed,_0x5de018){var _0x160fac=null;var _0x1df2e3=null;var _0x2d609c=null;var _0x279dd6=null;if(_0x2cd7ed['body']['id']){delete _0x2cd7ed['body']['id'];}if(_0x2cd7ed[_0x07fd('0x7b')]['mailTranscript']){_0x279dd6=path[_0x07fd('0xdb')](config[_0x07fd('0xdc')],_0x07fd('0xde'),util[_0x07fd('0xdf')](_0x07fd('0xe0'),Date[_0x07fd('0xe1')]()));_0x2cd7ed['body'][_0x07fd('0xe2')]=_0x279dd6;}return db[_0x07fd('0x40')][_0x07fd('0x67')]({'where':{'id':_0x2cd7ed[_0x07fd('0xb9')]['id']},'include':[{'model':db[_0x07fd('0xc6')],'as':_0x07fd('0xe3'),'include':[{'model':db['User'],'as':_0x07fd('0x78')}]}]})[_0x07fd('0x32')](handleEntityNotFound(_0x5de018,null))[_0x07fd('0x32')](saveUpdates(_0x2cd7ed[_0x07fd('0x7b')],null))[_0x07fd('0x32')](function(_0x413cb6){if(_0x413cb6){_0x160fac=_0x413cb6;return db[_0x07fd('0xbd')]['find']({'where':{'id':_0x160fac[_0x07fd('0x7f')]}});}})['then'](function(_0x15aef4){if(_0x15aef4){_0x2d609c=_0x15aef4;return db[_0x07fd('0xe4')][_0x07fd('0x67')]({'where':{'id':_0x160fac[_0x07fd('0x72')]}});}})[_0x07fd('0x32')](function(_0xeea5a5){if(_0xeea5a5){_0x1df2e3=_0xeea5a5;if(_0x279dd6){var _0x14fddc=null;for(var _0x448a64=0x1;_0x448a64<_0x160fac[_0x07fd('0xe3')][_0x07fd('0x48')];++_0x448a64){_0x14fddc=_0x160fac[_0x07fd('0xe3')][_0x448a64];var _0x4993e6=_0x14fddc['UserId']?util[_0x07fd('0xdf')](_0x07fd('0xe5'),_0x2d609c[_0x07fd('0xe6')],_0x14fddc[_0x07fd('0x79')]):_0x07fd('0xe7');var _0x5dd250=_0x2cd7ed[_0x07fd('0x7b')]['customer']||util[_0x07fd('0xdf')](_0x07fd('0xe5'),'Visitor',_0x14fddc[_0x07fd('0x72')]);switch(_0x2d609c[_0x07fd('0xe8')]){case _0x07fd('0xe9'):_0x4993e6=_0x14fddc['UserId']?util[_0x07fd('0xdf')](_0x07fd('0xe5'),_0x2d609c[_0x07fd('0xe6')],_0x14fddc['UserId']):_0x07fd('0xe7');break;case _0x07fd('0xea'):_0x4993e6=_0x14fddc[_0x07fd('0x79')]?_0x14fddc['User']['alias']||_0x14fddc['User'][_0x07fd('0xeb')]:'System';break;case'agent_fullname':_0x4993e6=_0x14fddc['UserId']?_0x14fddc['User']['fullname']:'System';break;default:_0x4993e6=_0x14fddc[_0x07fd('0x79')]?util[_0x07fd('0xdf')](_0x07fd('0xe5'),_0x2d609c[_0x07fd('0xe6')],_0x14fddc[_0x07fd('0x79')]):_0x07fd('0xe7');}var _0x47101a=util[_0x07fd('0xdf')](_0x07fd('0xec'),moment(_0x14fddc[_0x07fd('0xed')])[_0x07fd('0xdf')]('MM/DD/YYYY\x20HH:mm:ss'),_0x14fddc['direction']==='in'?_0x5dd250:_0x4993e6,_0x14fddc['body']);if(!_0x14fddc[_0x07fd('0xee')]){fs[_0x07fd('0xef')](_0x279dd6,_0x47101a);}}return db[_0x07fd('0xf0')][_0x07fd('0xbc')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}}})[_0x07fd('0x32')](function(_0x4d414b){if(_0x4d414b&&_0x4d414b[_0x07fd('0xf1')]&&_0x2cd7ed['body']){var _0x15daff={'tls':{'rejectUnauthorized':![]}};if(_0x4d414b['Smtp'][_0x07fd('0xf2')]){_0x15daff[_0x07fd('0xf2')]=_0x4d414b[_0x07fd('0xf1')]['service'];}else{_0x15daff[_0x07fd('0xf3')]=_0x4d414b['Smtp'][_0x07fd('0xf3')];_0x15daff['port']=_0x4d414b[_0x07fd('0xf1')][_0x07fd('0xf4')];_0x15daff[_0x07fd('0xf5')]=_0x4d414b[_0x07fd('0xf1')][_0x07fd('0xf5')];}if(_0x4d414b['Smtp']['authentication']){_0x15daff[_0x07fd('0xf6')]={'user':_0x4d414b['Smtp'][_0x07fd('0x9b')],'pass':_0x4d414b[_0x07fd('0xf1')][_0x07fd('0xf7')]};}return respondWithRpcPromise(_0x07fd('0xf8'),_0x07fd('0xf9'),{'account':_0x15daff,'message':{'from':util[_0x07fd('0xdf')](_0x07fd('0xfa'),_0x4d414b[_0x07fd('0x36')],_0x4d414b[_0x07fd('0xfb')]||_0x4d414b[_0x07fd('0xf1')][_0x07fd('0x9b')]),'to':_0x2cd7ed['body'][_0x07fd('0xfc')],'subject':_0x07fd('0xfd'),'text':util[_0x07fd('0xdf')](_0x07fd('0xfe'),_0x2cd7ed[_0x07fd('0x7b')][_0x07fd('0xfc')]),'attachments':[{'path':_0x279dd6}]}})[_0x07fd('0x32')](function(){return _0x160fac;})['catch'](function(_0x3b8516){console[_0x07fd('0x23')](_0x3b8516);});}else{return _0x160fac;}})[_0x07fd('0x32')](respondWithStatusCode(_0x5de018,0xc8))[_0x07fd('0x3e')](handleError(_0x5de018,null));};exports[_0x07fd('0xff')]=function(_0x973bbe,_0xe01bef,_0x40b92a){return db[_0x07fd('0xc6')]['find']({'where':{'id':_0x973bbe['params']['id']}})[_0x07fd('0x32')](handleEntityNotFound(_0xe01bef,null))[_0x07fd('0x32')](function(_0x2a01dc){if(_0x2a01dc){return _0x2a01dc[_0x07fd('0xff')](_0x973bbe['body'][_0x07fd('0x100')],_[_0x07fd('0x101')](_0x973bbe['body'],[_0x07fd('0x100'),'id'])||{});}})[_0x07fd('0x32')](respondWithResult(_0xe01bef,null))[_0x07fd('0x3e')](handleError(_0xe01bef,null));};exports[_0x07fd('0x102')]=function(_0x5106e9,_0x11914e,_0x4d8bca){var _0x437f5b={'raw':![],'where':{}};var _0x3bf24e={};var _0xd7c9f4={'count':0x0,'rows':[]};return db[_0x07fd('0x40')][_0x07fd('0xbc')]({'where':{'id':_0x5106e9['params']['id']}})['then'](handleEntityNotFound(_0x11914e,null))[_0x07fd('0x32')](function(_0x361ba2){if(_0x361ba2){_0x3bf24e['model']=_['keys'](db['ChatMessage'][_0x07fd('0xb4')]);_0x3bf24e['query']=_[_0x07fd('0xb3')](_0x5106e9[_0x07fd('0x45')]);_0x3bf24e[_0x07fd('0x43')]=_['intersection'](_0x3bf24e[_0x07fd('0x42')],_0x3bf24e[_0x07fd('0x45')]);_0x437f5b['attributes']=_[_0x07fd('0x44')](_0x3bf24e[_0x07fd('0x42')],qs[_0x07fd('0x47')](_0x5106e9[_0x07fd('0x45')][_0x07fd('0x47')]));_0x437f5b[_0x07fd('0x46')]=_0x437f5b['attributes'][_0x07fd('0x48')]?_0x437f5b[_0x07fd('0x46')]:_0x3bf24e[_0x07fd('0x42')];if(!_0x5106e9[_0x07fd('0x45')]['hasOwnProperty']('nolimit')){_0x437f5b[_0x07fd('0x2c')]=qs['limit'](_0x5106e9['query'][_0x07fd('0x2c')]);_0x437f5b[_0x07fd('0x2b')]=qs[_0x07fd('0x2b')](_0x5106e9[_0x07fd('0x45')][_0x07fd('0x2b')]);}_0x437f5b['order']=qs['sort'](_0x5106e9[_0x07fd('0x45')][_0x07fd('0x4b')]);_0x437f5b[_0x07fd('0x4c')]=qs[_0x07fd('0x43')](_[_0x07fd('0x4d')](_0x5106e9[_0x07fd('0x45')],_0x3bf24e[_0x07fd('0x43')]));_0x437f5b[_0x07fd('0x4c')][_0x07fd('0x103')]=_0x361ba2['id'];if(_0x5106e9['query'][_0x07fd('0x8c')]){_0x437f5b[_0x07fd('0x4c')]=_[_0x07fd('0xa1')](_0x437f5b[_0x07fd('0x4c')],{'$or':_[_0x07fd('0x39')](_0x437f5b['attributes'],function(_0x487415){var _0x596abe={};_0x596abe[_0x487415]={'$like':'%'+_0x5106e9[_0x07fd('0x45')][_0x07fd('0x8c')]+'%'};return _0x596abe;})});}if(_0x5106e9[_0x07fd('0x45')][_0x07fd('0x83')]){var _0x5e1652=_0x5106e9[_0x07fd('0x45')]['$gte'][_0x07fd('0x3b')](',');var _0x481f0c={};_0x481f0c[_0x5e1652[0x0]]={'$gte':moment(_0x5e1652[0x1])[_0x07fd('0xdf')](_0x07fd('0x104'))};_0x437f5b[_0x07fd('0x4c')]=_[_0x07fd('0xa1')](_0x437f5b[_0x07fd('0x4c')],_0x481f0c);}_0x437f5b=_[_0x07fd('0xa1')]({},_0x437f5b,_0x5106e9[_0x07fd('0xb7')]);return db[_0x07fd('0xc6')][_0x07fd('0x2a')]({'where':_0x437f5b['where']})['then'](function(_0x55a9cc){_0xd7c9f4[_0x07fd('0x2a')]=_0x55a9cc;if(_0x5106e9[_0x07fd('0x45')]['includeAll']){_0x437f5b[_0x07fd('0xb6')]=[{'all':!![]}];}return db[_0x07fd('0xc6')][_0x07fd('0x105')](_0x437f5b);})['then'](function(_0x2ae7f6){_0xd7c9f4['rows']=_0x2ae7f6;return _0xd7c9f4;});}})['then'](respondWithFilteredResult(_0x11914e,_0x437f5b))[_0x07fd('0x3e')](handleError(_0x11914e,null));};exports[_0x07fd('0x106')]=function(_0xe82c2,_0x44317a,_0x591a61){var _0x4e643a={'where':{}},_0x2e26e8={},_0x2764da={'count':0x0,'rows':[]};return db[_0x07fd('0x40')]['findOne']({'where':{'id':_0xe82c2[_0x07fd('0xb9')]['id']}})[_0x07fd('0x32')](handleEntityNotFound(_0x44317a,null))[_0x07fd('0x32')](function(_0x31f701){if(_0x31f701){_0x2e26e8[_0x07fd('0x42')]=_[_0x07fd('0xb3')](db[_0x07fd('0xc6')][_0x07fd('0xb4')]);_0x2e26e8['query']=_[_0x07fd('0xb3')](_0xe82c2['query']);_0x2e26e8[_0x07fd('0x43')]=_[_0x07fd('0x44')](_0x2e26e8[_0x07fd('0x42')],_0x2e26e8[_0x07fd('0x45')]);_0x4e643a[_0x07fd('0x46')]=_['intersection'](_0x2e26e8['model'],qs[_0x07fd('0x47')](_0xe82c2[_0x07fd('0x45')][_0x07fd('0x47')]));_0x4e643a[_0x07fd('0x46')]=_0x4e643a[_0x07fd('0x46')][_0x07fd('0x48')]?_0x4e643a['attributes']:_0x2e26e8[_0x07fd('0x42')];if(!_0xe82c2[_0x07fd('0x45')][_0x07fd('0x107')](_0x07fd('0x49'))){_0x4e643a['limit']=qs[_0x07fd('0x2c')](_0xe82c2[_0x07fd('0x45')][_0x07fd('0x2c')]);_0x4e643a[_0x07fd('0x2b')]=qs[_0x07fd('0x2b')](_0xe82c2[_0x07fd('0x45')][_0x07fd('0x2b')]);}_0x4e643a[_0x07fd('0x4a')]=qs[_0x07fd('0x4b')](_0xe82c2[_0x07fd('0x45')][_0x07fd('0x4b')]);_0x4e643a[_0x07fd('0x4c')]=qs[_0x07fd('0x43')](_[_0x07fd('0x4d')](_0xe82c2['query'],_0x2e26e8[_0x07fd('0x43')]));_0x4e643a['where'][_0x07fd('0x103')]=_0x31f701['id'];if(_0xe82c2[_0x07fd('0x45')][_0x07fd('0x8c')]){_0x4e643a[_0x07fd('0x4c')]=_[_0x07fd('0xa1')](_0x4e643a[_0x07fd('0x4c')],{'$or':_[_0x07fd('0x39')](_0x4e643a[_0x07fd('0x46')],function(_0x23de16){var _0x42ff9b={};_0x42ff9b[_0x23de16]={'$like':'%'+_0xe82c2[_0x07fd('0x45')][_0x07fd('0x8c')]+'%'};return _0x42ff9b;})});}_0x4e643a[_0x07fd('0x4c')][_0x07fd('0xee')]=![];if(_0xe82c2[_0x07fd('0x45')]['id']){_0x4e643a['where']['id']={'$gt':_0xe82c2[_0x07fd('0x45')]['id']};}_0x4e643a=_[_0x07fd('0xa1')]({},_0x4e643a,_0xe82c2['options']);return db['ChatMessage'][_0x07fd('0x2a')]({'where':_0x4e643a[_0x07fd('0x4c')]})[_0x07fd('0x32')](function(_0x21f2b1){_0x2764da[_0x07fd('0x2a')]=_0x21f2b1;_0x4e643a[_0x07fd('0xb6')]=[];if(_0xe82c2[_0x07fd('0x45')][_0x07fd('0x108')]){_0x4e643a[_0x07fd('0xb6')][_0x07fd('0x109')]({'model':db[_0x07fd('0x78')],'as':'User','attributes':['id',_0x07fd('0xeb'),_0x07fd('0x10a')]});}if(_0xe82c2['query'][_0x07fd('0xb5')]){_0x4e643a['include']=[{'all':!![]}];}return db[_0x07fd('0xc6')][_0x07fd('0x105')](_0x4e643a);})[_0x07fd('0x32')](function(_0x31ee76){_0x2764da[_0x07fd('0xb2')]=_0x31ee76;return _0x2764da;});}})['then'](respondWithFilteredResult(_0x44317a,_0x4e643a))[_0x07fd('0x3e')](handleError(_0x44317a,null));};exports[_0x07fd('0x10b')]=function(_0x2d6d48,_0x5dda2b,_0x3e4020){return db[_0x07fd('0x40')][_0x07fd('0x67')]({'where':{'id':_0x2d6d48['params']['id']}})[_0x07fd('0x32')](handleEntityNotFound(_0x5dda2b,null))[_0x07fd('0x32')](function(_0x1b2370){if(_0x1b2370){return _0x1b2370['setTags'](_0x2d6d48[_0x07fd('0x7b')][_0x07fd('0x100')],_[_0x07fd('0x101')](_0x2d6d48[_0x07fd('0x7b')],[_0x07fd('0x100'),'id'])||{})['spread'](function(){return db[_0x07fd('0x75')]['findAll']({'attributes':['id',_0x07fd('0x36'),_0x07fd('0x50')],'where':{'id':_0x2d6d48[_0x07fd('0x7b')][_0x07fd('0x100')]}});})[_0x07fd('0x32')](function(_0x4aa199){socket[_0x07fd('0x10c')](_0x07fd('0x10d'),{'id':Number(_0x2d6d48[_0x07fd('0xb9')]['id']),'tags':_0x4aa199||[]});return{'id':Number(_0x2d6d48[_0x07fd('0xb9')]['id']),'tags':_0x4aa199||[]};});}})['then'](respondWithResult(_0x5dda2b,null))['catch'](handleError(_0x5dda2b,null));};exports[_0x07fd('0x10e')]=function(_0x582c5f,_0x5ea103,_0x578ab1){return db['ChatInteraction']['find']({'where':{'id':_0x582c5f['params']['id']}})[_0x07fd('0x32')](handleEntityNotFound(_0x5ea103,null))[_0x07fd('0x32')](function(_0xabc074){if(_0xabc074){return _0xabc074[_0x07fd('0x10e')](_0x582c5f[_0x07fd('0x45')][_0x07fd('0x100')]);}})[_0x07fd('0x32')](respondWithStatusCode(_0x5ea103,null))['catch'](handleError(_0x5ea103,null));};exports[_0x07fd('0xda')]=function(_0x324e77,_0x4897a4){var _0x1eaf5d=moment()[_0x07fd('0x10f')]()['toString']();var _0x39832b=path['join'](config[_0x07fd('0xdc')],'server',_0x07fd('0x110'),_0x07fd('0x111'));var _0x573895=path[_0x07fd('0xdb')](config['root'],_0x07fd('0x112'),'files',_0x07fd('0x113'));var _0x39fce0=path['join'](_0x39832b,_0x1eaf5d);var _0x47c373=util[_0x07fd('0xdf')](_0x07fd('0x114'),_0x324e77['params']['id'],_0x1eaf5d);var _0x428a48=path['join'](_0x39832b,_0x47c373);var _0x221282=[];_0x221282[_0x07fd('0x109')]({'model':db[_0x07fd('0x78')],'as':'User','attributes':['id',_0x07fd('0xeb')],'raw':!![]});_0x221282[_0x07fd('0x109')]({'model':db[_0x07fd('0xe4')],'as':'Contact','attributes':['id',_0x07fd('0x115'),_0x07fd('0x116')],'raw':!![]});if(_0x324e77[_0x07fd('0x45')][_0x07fd('0x113')]){_0x221282[_0x07fd('0x109')]({'model':db['Attachment'],'as':_0x07fd('0xd7'),'raw':!![]});}var _0x46dbdd=[{'model':db[_0x07fd('0xc6')],'as':_0x07fd('0xe3'),'attributes':['id',_0x07fd('0x7b'),_0x07fd('0xed'),'direction',_0x07fd('0xee'),'read'],'include':_0x221282}];_0x46dbdd[_0x07fd('0x109')]({'model':db[_0x07fd('0xbd')],'as':_0x07fd('0x117'),'attributes':['id','name']});_0x46dbdd['push']({'model':db['User'],'as':_0x07fd('0x118'),'attributes':['id','fullname']});return db[_0x07fd('0x40')][_0x07fd('0x67')]({'where':{'id':_0x324e77['params']['id']},'include':_0x46dbdd})[_0x07fd('0x32')](handleEntityNotFound(_0x4897a4,null))['then'](function(_0x268331){if(_0x268331){var _0x104f98=_0x268331[_0x07fd('0x119')]({'plain':!![]});fs[_0x07fd('0x11a')](_0x39fce0);var _0xe31339={'format':'A4','border':_0x07fd('0x11b'),'header':{'height':_0x07fd('0x11c'),'contents':{'first':_0x07fd('0x11d')}},'footer':{'height':_0x07fd('0x11e'),'contents':{'default':util[_0x07fd('0xdf')](_0x07fd('0x11f'),util[_0x07fd('0xdf')](_0x07fd('0x120'),_0x07fd('0x121'),_0x104f98['id']),moment()[_0x07fd('0xdf')]('YYYY-MM-DD')[_0x07fd('0xa0')]())}}};var _0x52c754={'channel':_0x07fd('0x121'),'account':_0x104f98['Account'][_0x07fd('0x36')],'agent':_0x104f98[_0x07fd('0x118')]?_0x104f98[_0x07fd('0x118')]['fullname']:_0x07fd('0x122'),'createdAt':moment(_0x104f98[_0x07fd('0xed')])[_0x07fd('0xdf')](_0x07fd('0x104'))['toString'](),'closedAt':_0x104f98[_0x07fd('0xce')]?moment(_0x104f98[_0x07fd('0x123')])[_0x07fd('0xdf')]('YYYY-MM-DD\x20HH:mm:ss')[_0x07fd('0xa0')]():'','disposition':_0x104f98[_0x07fd('0xcf')],'chatInfo':{'browser':_0x104f98['browserName'],'os':_0x104f98[_0x07fd('0x124')],'referer':_0x104f98[_0x07fd('0x125')],'customerIp':_0x104f98[_0x07fd('0x126')],'customerPort':_0x104f98[_0x07fd('0x127')]?_0x104f98[_0x07fd('0x127')]:_0x07fd('0x122')},'messages':_(_0x104f98[_0x07fd('0xe3')])[_0x07fd('0x128')]()[_0x07fd('0x8c')]({'secret':![]})['map'](function(_0x3bbaf3){if(_0x3bbaf3[_0x07fd('0xd7')]){var _0x5052ad=path[_0x07fd('0xdb')](_0x573895,_0x3bbaf3[_0x07fd('0xd7')][_0x07fd('0xd4')]);if(fs[_0x07fd('0x129')](_0x5052ad)){fs[_0x07fd('0x12a')](_0x5052ad)[_0x07fd('0x12b')](fs[_0x07fd('0x12c')](path['join'](_0x39fce0,_0x3bbaf3[_0x07fd('0xd7')][_0x07fd('0xd4')])));}}return{'date':moment(_0x3bbaf3[_0x07fd('0xed')])[_0x07fd('0xdf')](_0x07fd('0x104'))[_0x07fd('0xa0')](),'sender':_0x3bbaf3['direction']===_0x07fd('0xc5')?_0x3bbaf3['User']?_0x3bbaf3[_0x07fd('0x78')]['fullname']:_0x07fd('0xe7'):_0x3bbaf3[_0x07fd('0x6c')][_0x07fd('0x115')]+(_0x3bbaf3['Contact'][_0x07fd('0x116')]?'\x20'+_0x3bbaf3[_0x07fd('0x6c')]['lastName']:''),'body':_0x3bbaf3['Attachment']?_0x3bbaf3[_0x07fd('0xd7')]['basename']:_0x3bbaf3[_0x07fd('0x7b')],'direction':_0x3bbaf3['direction']===_0x07fd('0xc5')?'A':'C','secret':_0x3bbaf3[_0x07fd('0xee')],'read':_0x3bbaf3['read'],'attachment':_0x3bbaf3[_0x07fd('0xd7')]};})[_0x07fd('0x69')]()};return ejs['renderFile'](path['join'](config['root'],_0x07fd('0x112'),_0x07fd('0x12d'),_0x07fd('0x12e')),{'interaction':_0x52c754})['then'](function(_0x238736){return new BPromise(function(_0x23370b,_0x271f93){pdf['create'](_0x238736,_0xe31339)[_0x07fd('0x12f')](path[_0x07fd('0xdb')](_0x39fce0,_0x07fd('0x130')+_0x104f98['id']+'-'+_0x1eaf5d+_0x07fd('0x131')),function(_0x365816,_0x3a4e6d){if(_0x365816)return _0x271f93(_0x365816);_0x23370b(_0x3a4e6d);});});})[_0x07fd('0x32')](function(){return new BPromise(function(_0x466e0f,_0x28f2c2){zipdir(_0x39fce0,{'saveTo':_0x428a48},function(_0x1c1769,_0x4e8532){if(_0x1c1769)return _0x28f2c2(_0x1c1769);return _0x466e0f(_0x4e8532);});})[_0x07fd('0x32')](function(){return new BPromise(function(_0xa3701,_0x2b6bec){rimraf(_0x39fce0,function(_0x560ee0){if(_0x560ee0)_0x2b6bec(_0x560ee0);return _0xa3701();});});})[_0x07fd('0x32')](function(){return _0x4897a4[_0x07fd('0xda')](_0x428a48,_0x47c373,function(_0xa35327){if(_0xa35327){console['log']('err',_0xa35327);}else{fs[_0x07fd('0x132')](_0x428a48);}});});});}else{return _0x4897a4['sendStatus'](0xc8);}})[_0x07fd('0x3e')](handleError(_0x4897a4,null));}; \ No newline at end of file +var _0xd389=['\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','agent','user','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','role','toString','sequelize','keyBy','merge','ChatInteraction','a.key','Account.key','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','params','keys','includeAll','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','follow','ValidationError','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','file','filename','mimetype','Attachment','attachmentDownload','attachId','download','join','root','server/files/attachments/','basename','close','server/files/chat/upload/','format','now','pathTranscript','Messages','CmContact','%s%d','agentAlias','customer','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','System','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','email','mailTranscript','Mail\x20Transcript','addMessage','ids','omit','getMessages','rawAttributes','$gte','YYYY-MM-DD\x20HH:mm:ss','ChatMessage','findAll','includeAgent','setTags','spread','emit','chatInteractionTags:save','removeTags','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','Account','Owner','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\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','N.A.','closedAt','disposition','browserName','osName','customerIp','customerPort','createReadStream','pipe','createWriteStream','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatInteraction.socket','jayson/promise','http','client','request','info','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','save','update','then','destroy','end','stack','name','send','map','fullname','TagIds','Tags','split','push','index','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.ChatInteractionId','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','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','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','ChatWebsiteId','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null'];(function(_0x5f3b21,_0x699518){var _0x2241c9=function(_0x226a85){while(--_0x226a85){_0x5f3b21['push'](_0x5f3b21['shift']());}};_0x2241c9(++_0x699518);}(_0xd389,0x1e9));var _0x9d38=function(_0x523885,_0x18a451){_0x523885=_0x523885-0x0;var _0x442904=_0xd389[_0x523885];return _0x442904;};'use strict';var pdf=require(_0x9d38('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9d38('0x1'));var zipdir=require(_0x9d38('0x2'));var jsonpatch=require(_0x9d38('0x3'));var rp=require('request-promise');var moment=require(_0x9d38('0x4'));var BPromise=require(_0x9d38('0x5'));var Mustache=require(_0x9d38('0x6'));var util=require(_0x9d38('0x7'));var path=require(_0x9d38('0x8'));var sox=require(_0x9d38('0x9'));var csv=require(_0x9d38('0xa'));var ejs=require(_0x9d38('0xb'));var fs=require('fs');var _=require(_0x9d38('0xc'));var squel=require(_0x9d38('0xd'));var crypto=require(_0x9d38('0xe'));var jsforce=require(_0x9d38('0xf'));var deskjs=require(_0x9d38('0x10'));var toCsv=require(_0x9d38('0xa'));var querystring=require('querystring');var Papa=require(_0x9d38('0x11'));var Redis=require(_0x9d38('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9d38('0x13'));var as=require(_0x9d38('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d38('0x15'))(_0x9d38('0x16'));var utils=require('../../config/utils');var config=require(_0x9d38('0x17'));var licenseUtil=require(_0x9d38('0x18'));var db=require('../../mysqldb')['db'];config[_0x9d38('0x19')]=_[_0x9d38('0x1a')](config[_0x9d38('0x19')],{'host':_0x9d38('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9d38('0x19')]));require(_0x9d38('0x1c'))['register'](socket);var jayson=require(_0x9d38('0x1d'));var client=jayson['client'][_0x9d38('0x1e')]({'port':0x232b});var client9004=jayson[_0x9d38('0x1f')][_0x9d38('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x1a4d47,_0x3c4b05,_0x4ef979,_0x1c672f){return new BPromise(function(_0x4ced74,_0x132b76){var _0x337176=_0x1c672f||client;return _0x337176[_0x9d38('0x20')](_0x1a4d47,_0x4ef979)['then'](function(_0x4d6809){logger[_0x9d38('0x21')]('ChatInteraction,\x20%s,\x20%s',_0x3c4b05,'request\x20sent');logger[_0x9d38('0x22')](_0x9d38('0x23'),_0x3c4b05,_0x9d38('0x24'),JSON[_0x9d38('0x25')](_0x4d6809));if(_0x4d6809['error']){if(_0x4d6809[_0x9d38('0x26')]['code']===0x1f4){logger[_0x9d38('0x26')](_0x9d38('0x27'),_0x3c4b05,_0x4d6809[_0x9d38('0x26')]['message']);return _0x132b76(_0x4d6809[_0x9d38('0x26')][_0x9d38('0x28')]);}logger['error'](_0x9d38('0x27'),_0x3c4b05,_0x4d6809[_0x9d38('0x26')][_0x9d38('0x28')]);return _0x4ced74(_0x4d6809[_0x9d38('0x26')][_0x9d38('0x28')]);}else{logger[_0x9d38('0x21')]('ChatInteraction,\x20%s,\x20%s',_0x3c4b05,_0x9d38('0x24'));_0x4ced74(_0x4d6809[_0x9d38('0x29')][_0x9d38('0x28')]);}})[_0x9d38('0x2a')](function(_0x346b85){logger['error'](_0x9d38('0x27'),_0x3c4b05,_0x346b85);_0x132b76(_0x346b85);});});}function respondWithStatusCode(_0x1b0ee9,_0x2bc2ff){_0x2bc2ff=_0x2bc2ff||0xcc;return function(_0x38c02b){if(_0x38c02b){return _0x1b0ee9[_0x9d38('0x2b')](_0x2bc2ff);}return _0x1b0ee9[_0x9d38('0x2c')](_0x2bc2ff)['end']();};}function respondWithResult(_0x1da3c5,_0x28709d){_0x28709d=_0x28709d||0xc8;return function(_0x1160d3){if(_0x1160d3){return _0x1da3c5[_0x9d38('0x2c')](_0x28709d)[_0x9d38('0x2d')](_0x1160d3);}};}function respondWithFilteredResult(_0x2c5c9c,_0x39ee8e){return function(_0x531031){if(_0x531031){var _0x22f08d=_0x531031[_0x9d38('0x2e')],_0x9f2352=_0x39ee8e[_0x9d38('0x2f')],_0x224531=_0x39ee8e[_0x9d38('0x2f')]+_0x39ee8e[_0x9d38('0x30')],_0x26b560;if(_0x224531>=_0x22f08d){_0x224531=_0x22f08d;_0x26b560=0xc8;}else{_0x26b560=0xce;}_0x2c5c9c[_0x9d38('0x2c')](_0x26b560);return _0x2c5c9c['set'](_0x9d38('0x31'),_0x9f2352+'-'+_0x224531+'/'+_0x22f08d)['json'](_0x531031);}return null;};}function patchUpdates(_0x36a3c7){return function(_0x5bf8ad){try{jsonpatch['apply'](_0x5bf8ad,_0x36a3c7,!![]);}catch(_0x4b6c09){return BPromise['reject'](_0x4b6c09);}return _0x5bf8ad[_0x9d38('0x32')]();};}function saveUpdates(_0x54416d,_0x51abfa){return function(_0x4d7c91){if(_0x4d7c91){return _0x4d7c91[_0x9d38('0x33')](_0x54416d)[_0x9d38('0x34')](function(_0x1e659d){return _0x1e659d;});}return null;};}function removeEntity(_0x42d290,_0x53f08f){return function(_0x4ad5e9){if(_0x4ad5e9){return _0x4ad5e9[_0x9d38('0x35')]()[_0x9d38('0x34')](function(){_0x42d290[_0x9d38('0x2c')](0xcc)[_0x9d38('0x36')]();});}};}function handleEntityNotFound(_0x264f97,_0xbc42fb){return function(_0xe4a6d){if(!_0xe4a6d){_0x264f97['sendStatus'](0x194);}return _0xe4a6d;};}function handleError(_0xf5bfee,_0x1e3e72){_0x1e3e72=_0x1e3e72||0x1f4;return function(_0x6c0016){logger[_0x9d38('0x26')](_0x6c0016[_0x9d38('0x37')]);if(_0x6c0016['name']){delete _0x6c0016[_0x9d38('0x38')];}_0xf5bfee['status'](_0x1e3e72)[_0x9d38('0x39')](_0x6c0016);};}function getInteractionUsers(_0xb1dd61,_0x48acf3){return new BPromise(function(_0x2ed77e,_0x21bfde){try{if(_0x48acf3[_0xb1dd61['id']]){_0xb1dd61['Users']=_[_0x9d38('0x3a')](_0x48acf3[_0xb1dd61['id']],function(_0x1dd3a6){return{'id':_0x1dd3a6['id'],'fullname':_0x1dd3a6[_0x9d38('0x3b')]};});}}catch(_0x50ca98){_0x21bfde(_0x50ca98);}_0x2ed77e(_0xb1dd61);});}function getInteractionTags(_0x2fd98d,_0x467458){return new BPromise(function(_0x591cb1,_0x11ce95){try{if(_0x2fd98d[_0x9d38('0x3c')]){_0x2fd98d[_0x9d38('0x3d')]=[];_0x2fd98d['TagIds'][_0x9d38('0x3e')](',')['forEach'](function(_0x344291){_0x2fd98d[_0x9d38('0x3d')][_0x9d38('0x3f')](_0x467458[_0x344291]);});}delete _0x2fd98d[_0x9d38('0x3c')];}catch(_0x2842ed){_0x11ce95(_0x2842ed);}_0x591cb1(_0x2fd98d);});}function updateChatInteraction(_0x56048a,_0x4866df,_0x121464){return new BPromise(function(_0x4cebfa,_0x4a64a5){return getInteractionUsers(_0x56048a,_0x121464)[_0x9d38('0x34')](function(_0x29e48d){return getInteractionTags(_0x29e48d,_0x4866df);})[_0x9d38('0x34')](function(_0x40f1d6){_0x4cebfa(_0x40f1d6);})[_0x9d38('0x2a')](function(_0x3867be){_0x4a64a5(_0x3867be);});});}exports[_0x9d38('0x40')]=function(_0x573eb5,_0x5693ec){var _0x21cd4a={},_0x110cd3={},_0xedfa79={'count':0x0,'rows':[]};var _0x3727a5=_[_0x9d38('0x3a')](db['ChatInteraction']['rawAttributes'],function(_0x55b665){return{'name':_0x55b665[_0x9d38('0x41')],'type':_0x55b665[_0x9d38('0x42')][_0x9d38('0x43')]};});_0x110cd3[_0x9d38('0x44')]=_['map'](_0x3727a5,_0x9d38('0x38'));_0x110cd3[_0x9d38('0x45')]=_['keys'](_0x573eb5[_0x9d38('0x45')]);_0x110cd3[_0x9d38('0x46')]=_[_0x9d38('0x47')](_0x110cd3[_0x9d38('0x44')],_0x110cd3[_0x9d38('0x45')]);_0x21cd4a['attributes']=_[_0x9d38('0x47')](_0x110cd3[_0x9d38('0x44')],qs['fields'](_0x573eb5[_0x9d38('0x45')][_0x9d38('0x48')]));_0x21cd4a[_0x9d38('0x49')]=_0x21cd4a[_0x9d38('0x49')][_0x9d38('0x4a')]?_0x21cd4a[_0x9d38('0x49')]:_0x110cd3[_0x9d38('0x44')];if(!_0x573eb5[_0x9d38('0x45')][_0x9d38('0x4b')](_0x9d38('0x4c'))){_0x21cd4a[_0x9d38('0x30')]=qs[_0x9d38('0x30')](_0x573eb5[_0x9d38('0x45')][_0x9d38('0x30')]);_0x21cd4a[_0x9d38('0x2f')]=qs[_0x9d38('0x2f')](_0x573eb5[_0x9d38('0x45')][_0x9d38('0x2f')]);}_0x21cd4a['order']=qs['sort'](_0x573eb5['query'][_0x9d38('0x4d')]);_0x21cd4a[_0x9d38('0x4e')]=qs[_0x9d38('0x46')](_[_0x9d38('0x4f')](_0x573eb5[_0x9d38('0x45')],_0x110cd3['filters']),_0x3727a5);var _0x2060a3=[];var _0x3ded0e=squel[_0x9d38('0x50')]()[_0x9d38('0x51')]('id')[_0x9d38('0x51')](_0x9d38('0x38'))[_0x9d38('0x51')](_0x9d38('0x52'))[_0x9d38('0x53')](_0x9d38('0x54'));var _0x3ff49d=squel['select']()[_0x9d38('0x51')]('u.id')['field']('u.fullname')['field'](_0x9d38('0x55'))[_0x9d38('0x53')]('user_has_chat_interactions','ui')[_0x9d38('0x56')]('users','u',_0x9d38('0x57'));var _0x1b325d=squel[_0x9d38('0x50')]()[_0x9d38('0x53')](_0x9d38('0x58'),'i')[_0x9d38('0x56')](_0x9d38('0x59'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x9d38('0x56')](_0x9d38('0x5a'),'o',_0x9d38('0x5b'))[_0x9d38('0x56')](_0x9d38('0x5c'),'a',_0x9d38('0x5d'))[_0x9d38('0x56')](_0x9d38('0x5e'),'me',_0x9d38('0x5f'))['left_join'](_0x9d38('0x60'),'it','it.ChatInteractionId\x20=\x20i.id')['left_join'](_0x9d38('0x54'),'t',_0x9d38('0x61'));var _0x5a5973=squel[_0x9d38('0x62')]();var _0x1cf47b=[];var _0x5e84ab=squel[_0x9d38('0x62')]();var _0x309339;if(_0x573eb5[_0x9d38('0x45')]['search']){_0x309339=as['parseSearch'](_0x573eb5[_0x9d38('0x45')][_0x9d38('0x63')]);var _0x2a9749=_0x309339[_0x9d38('0x64')];for(var _0xe0e82f=0x0;_0xe0e82f<_0x309339[_0x9d38('0x65')][_0x9d38('0x4a')];_0xe0e82f++){var _0x224b8d=_0x309339['conditions'][_0xe0e82f];var _0xfdb1a7='i';var _0x1e7653=_[_0x9d38('0x66')](_0x3727a5,[_0x9d38('0x38'),_0x224b8d[_0x9d38('0x51')]]);if(!_0x1e7653){switch(_0x224b8d[_0x9d38('0x51')]){case _0x9d38('0x67'):if(_0x224b8d[_0x9d38('0x68')]==0x1){_0x1b325d[_0x9d38('0x69')]('`'+_0x224b8d['field']+_0x9d38('0x6a'));}else{_0x1b325d[_0x9d38('0x69')]('`'+_0x224b8d[_0x9d38('0x51')]+_0x9d38('0x6b'));}break;case'Contact':if(_0x224b8d[_0x9d38('0x6c')]===_0x9d38('0x6d')){if(_0x224b8d['value'][_0x9d38('0x3e')]('\x20')[_0x9d38('0x4a')]>0x1){_0x5a5973[_0x2a9749](_0x9d38('0x6e'),qs[_0x9d38('0x6f')](_0x224b8d[_0x9d38('0x68')]),null);}else{var _0x315509='%'+_0x224b8d['value']+'%';_0x5a5973[_0x2a9749]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x315509,_0x315509,_0x315509);}}else{_0x1e7653=_[_0x9d38('0x66')](_0x3727a5,[_0x9d38('0x38'),_0x9d38('0x70')]);_0x224b8d[_0x9d38('0x51')]=_0x9d38('0x70');_0x314df9=as[_0x9d38('0x71')](_0xfdb1a7,_0x1e7653['type'],_0x224b8d);_0x5a5973[_0x2a9749](_0x314df9[_0x9d38('0x72')],_0x314df9[_0x9d38('0x68')][_0x9d38('0x73')],_0x314df9['value'][_0x9d38('0x36')]);}break;case _0x9d38('0x74'):var _0x453e23=_0x224b8d[_0x9d38('0x68')]['split'](',')[_0x9d38('0x3a')](function(_0x205fbf){return Number(_0x205fbf);});_0x453e23[_0x9d38('0x75')](function(_0x3dfdb1){_0x5e84ab['or'](_0x9d38('0x76'),'%,'+_0x3dfdb1+',%');});_0x1cf47b=_['union'](_0x1cf47b,_0x453e23);break;case _0x9d38('0x77'):if(_0x224b8d[_0x9d38('0x6c')]===_0x9d38('0x6d')){_0x5a5973[_0x2a9749](_0x9d38('0x78'),'%'+_0x224b8d[_0x9d38('0x68')]+'%',null);}else{_0x1e7653=_[_0x9d38('0x66')](_0x3727a5,[_0x9d38('0x38'),_0x9d38('0x79')]);_0x224b8d[_0x9d38('0x51')]=_0x9d38('0x79');_0x314df9=as[_0x9d38('0x71')](_0xfdb1a7,_0x1e7653[_0x9d38('0x42')],_0x224b8d);_0x5a5973[_0x2a9749](_0x314df9['text'],_0x314df9[_0x9d38('0x68')]['start'],_0x314df9[_0x9d38('0x68')]['end']);}break;case _0x9d38('0x7a'):_0x314df9=as[_0x9d38('0x71')]('me',null,_0x224b8d);_0x5a5973[_0x2a9749](_0x314df9['text'],_0x314df9[_0x9d38('0x68')]['start'],_0x314df9['value']['end']);break;}}else{var _0x314df9=as[_0x9d38('0x71')](_0xfdb1a7,_0x1e7653[_0x9d38('0x42')],_0x224b8d);_0x5a5973[_0x2a9749](_0x314df9[_0x9d38('0x72')],_0x314df9['value'][_0x9d38('0x73')],_0x314df9[_0x9d38('0x68')][_0x9d38('0x36')]);}}}else{var _0x3943b7=_(_0x573eb5[_0x9d38('0x45')])['keys']()[_0x9d38('0x3a')](function(_0x5c2275){return _[_0x9d38('0x7b')](_0x3727a5,[_0x9d38('0x38'),_0x5c2275])?_0x5c2275:undefined;})[_0x9d38('0x7c')]()['value']();if(!_[_0x9d38('0x7d')](_0x3943b7)){_0x3943b7['forEach'](function(_0x26aa72){if(_0x26aa72===_0x9d38('0x7e')){_0x1b325d['where']('i.ChatWebsiteId\x20IN\x20?',[][_0x9d38('0x7f')](_0x573eb5[_0x9d38('0x45')][_0x26aa72]));}else if(_0x26aa72===_0x9d38('0x80')){var _0x5b91a8=JSON[_0x9d38('0x81')](_0x573eb5[_0x9d38('0x45')][_0x26aa72])['$gte'];var _0x5c8430=JSON['parse'](_0x573eb5['query'][_0x26aa72])[_0x9d38('0x82')];_0x1b325d[_0x9d38('0x4e')](_0x9d38('0x83'),_0x5b91a8,_0x5c8430);}else{if(_0x573eb5[_0x9d38('0x45')][_0x26aa72]===_0x9d38('0x84')){_0x1b325d['where']('i.'+_0x26aa72+_0x9d38('0x85'));}else{_0x1b325d['where']('i.'+_0x26aa72+_0x9d38('0x86'),_0x573eb5[_0x9d38('0x45')][_0x26aa72]);}}});}if(_0x573eb5[_0x9d38('0x45')][_0x9d38('0x87')]){if(_0x573eb5[_0x9d38('0x45')][_0x9d38('0x87')]==0x1){_0x1b325d[_0x9d38('0x69')](_0x9d38('0x88'));}else{_0x1b325d[_0x9d38('0x69')]('`unreadMessages`\x20>\x200');}}if(_0x573eb5[_0x9d38('0x45')][_0x9d38('0x89')]){_0x1cf47b=_[_0x9d38('0x8a')](_0x573eb5['query'][_0x9d38('0x89')])?_0x573eb5[_0x9d38('0x45')][_0x9d38('0x89')]:new Array(_0x573eb5[_0x9d38('0x45')][_0x9d38('0x89')]);_0x1cf47b[_0x9d38('0x75')](function(_0x394c33){_0x5e84ab['or'](_0x9d38('0x76'),'%,'+_0x394c33+',%');});}if(_0x573eb5['query'][_0x9d38('0x8b')]){var _0x2b9b3a=_0x573eb5[_0x9d38('0x45')]['filter'][_0x9d38('0x8c')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x9d38('0x8d')](_0x2b9b3a)){_0x5a5973['or']('i.id\x20LIKE\x20?',_0x2b9b3a+'%');}else{_0x5a5973['or'](_0x9d38('0x8e'),qs['getFullTextValue'](_0x2b9b3a))['or'](_0x9d38('0x8f'),_0x2b9b3a+'%');}}}_0x1b325d['where'](_0x5a5973);_0x1b325d['group'](_0x9d38('0x90'));var _0x3711f4={'type':db[_0x9d38('0x91')][_0x9d38('0x92')][_0x9d38('0x93')],'raw':!![]};var _0xe693dc=_0x1b325d['clone']();_0xe693dc['field'](_0x9d38('0x90'));_0xe693dc[_0x9d38('0x51')](_0x9d38('0x94'),_0x9d38('0x67'));if(_0x21cd4a[_0x9d38('0x95')]){_0x21cd4a[_0x9d38('0x95')][_0x9d38('0x75')](function(_0x48d7e9){var _0x93f281=_0x48d7e9[0x0]===_0x9d38('0x96')?_0x48d7e9[0x0]:'i.'+_0x48d7e9[0x0];_0x1b325d['order'](_0x93f281,_0x48d7e9[0x1]===_0x9d38('0x97')?![]:!![]);});}if(!_[_0x9d38('0x7d')](_0x1cf47b)){_0x1b325d[_0x9d38('0x69')](_0x5e84ab);_0xe693dc[_0x9d38('0x4e')](_0x9d38('0x98'),_0x1cf47b);}BPromise['resolve']()[_0x9d38('0x34')](function(){if(!_0x309339){if(_0x573eb5[_0x9d38('0x45')][_0x9d38('0x7e')])return;_0xe693dc['where'](_0x9d38('0x99'));_0x1b325d[_0x9d38('0x4e')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x573eb5['user']['role']!==_0x9d38('0x9a'))return;return _0x573eb5[_0x9d38('0x9b')]['getChatWebsites']({'attributes':['id'],'raw':!![]})['then'](function(_0x21d0e2){if(_[_0x9d38('0x7d')](_0x21d0e2)){_0xe693dc['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x1b325d['where'](_0x9d38('0x9c'));}else{_0xe693dc[_0x9d38('0x4e')](_0x9d38('0x9d'),_[_0x9d38('0x3a')](_0x21d0e2,'id'));_0x1b325d['where'](_0x9d38('0x9d'),_['map'](_0x21d0e2,'id'));}});})['then'](function(){if(_0x573eb5[_0x9d38('0x9b')][_0x9d38('0x9e')]===_0x9d38('0x9a')&&!_0x309339&&!_0x573eb5['query'][_0x9d38('0x7e')])return[];return db['sequelize'][_0x9d38('0x45')](_0xe693dc[_0x9d38('0x9f')](),_0x3711f4);})[_0x9d38('0x34')](function(_0x58e6de){_0xedfa79['count']=_0x58e6de[_0x9d38('0x4a')];if(_0xedfa79[_0x9d38('0x2e')]===0x0)return[];return db[_0x9d38('0xa0')][_0x9d38('0x45')](_0x3ded0e[_0x9d38('0x9f')](),_0x3711f4)[_0x9d38('0x34')](function(_0x2a1e10){_0x2060a3=_[_0x9d38('0xa1')](_0x2a1e10,'id');_0x3711f4=_[_0x9d38('0xa2')](_0x3711f4,{'model':db[_0x9d38('0xa3')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x573eb5['query'][_0x9d38('0x48')]){_0x21cd4a[_0x9d38('0x49')][_0x9d38('0x75')](function(_0x2ca90e){_0x1b325d['field']('i.'+_0x2ca90e);});}else{_0x1b325d[_0x9d38('0x51')](_0x9d38('0x94'),_0x9d38('0x67'));_0x1b325d[_0x9d38('0x51')](_0x9d38('0xa4'),_0x9d38('0xa5'));_0x1b325d[_0x9d38('0x51')]('a.mandatoryDisposition',_0x9d38('0xa6'));_0x1b325d[_0x9d38('0x51')]('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',_0x9d38('0x96'));_0x1b325d['field'](_0x9d38('0xa7'));_0x1b325d['field']('c.firstName',_0x9d38('0xa8'));_0x1b325d[_0x9d38('0x51')](_0x9d38('0xa9'),_0x9d38('0xaa'));_0x1b325d[_0x9d38('0x51')]('c.email',_0x9d38('0xab'));_0x1b325d[_0x9d38('0x51')]('c.phone',_0x9d38('0xac'));_0x1b325d[_0x9d38('0x51')](_0x9d38('0xad'),_0x9d38('0xae'));_0x1b325d['field'](_0x9d38('0xaf'),_0x9d38('0xb0'));_0x1b325d[_0x9d38('0x51')]('o.fullname',_0x9d38('0xb1'));_0x1b325d[_0x9d38('0x51')](_0x9d38('0xb2'),_0x9d38('0xb3'));_0x1b325d[_0x9d38('0x51')](_0x9d38('0xb4'),_0x9d38('0x3c'));}if(_0x21cd4a[_0x9d38('0x30')])_0x1b325d[_0x9d38('0x30')](_0x21cd4a[_0x9d38('0x30')]);if(_0x21cd4a[_0x9d38('0x2f')])_0x1b325d[_0x9d38('0x2f')](_0x21cd4a[_0x9d38('0x2f')]);return db[_0x9d38('0xa0')][_0x9d38('0x45')](_0x1b325d[_0x9d38('0x9f')](),_0x3711f4);})[_0x9d38('0x34')](function(_0x157f0f){_0x3ff49d[_0x9d38('0x4e')](_0x9d38('0xb5'),_['map'](_0x157f0f,'id'));return db[_0x9d38('0xa0')][_0x9d38('0x45')](_0x3ff49d[_0x9d38('0x9f')](),_0x3711f4)[_0x9d38('0x34')](function(_0x399edd){var _0x1e394b=_[_0x9d38('0xb6')](_0x399edd,_0x9d38('0xb7'));var _0x6018d4=[];_0x157f0f[_0x9d38('0x75')](function(_0x715183){_0x6018d4[_0x9d38('0x3f')](updateChatInteraction(_0x715183,_0x2060a3,_0x1e394b));});return BPromise[_0x9d38('0xb8')](_0x6018d4);});});})[_0x9d38('0x34')](function(_0x24dd22){_0xedfa79[_0x9d38('0xb9')]=_0x24dd22;return _0xedfa79;})['then'](respondWithFilteredResult(_0x5693ec,_0x21cd4a))['catch'](handleError(_0x5693ec,null));};exports[_0x9d38('0xba')]=function(_0x3eed25,_0x425b9f){var _0x3996a4={'raw':![],'where':{'id':_0x3eed25[_0x9d38('0xbb')]['id']}},_0x1c36c0={};_0x1c36c0[_0x9d38('0x44')]=_[_0x9d38('0xbc')](db[_0x9d38('0xa3')]['rawAttributes']);_0x1c36c0[_0x9d38('0x45')]=_[_0x9d38('0xbc')](_0x3eed25[_0x9d38('0x45')]);_0x1c36c0[_0x9d38('0x46')]=_[_0x9d38('0x47')](_0x1c36c0['model'],_0x1c36c0[_0x9d38('0x45')]);_0x3996a4[_0x9d38('0x49')]=_[_0x9d38('0x47')](_0x1c36c0[_0x9d38('0x44')],qs[_0x9d38('0x48')](_0x3eed25[_0x9d38('0x45')][_0x9d38('0x48')]));_0x3996a4[_0x9d38('0x49')]=_0x3996a4[_0x9d38('0x49')]['length']?_0x3996a4[_0x9d38('0x49')]:_0x1c36c0[_0x9d38('0x44')];if(_0x3eed25[_0x9d38('0x45')][_0x9d38('0xbd')]){_0x3996a4[_0x9d38('0xbe')]=[{'all':!![]}];}_0x3996a4=_[_0x9d38('0xa2')]({},_0x3996a4,_0x3eed25[_0x9d38('0xbf')]);return db['ChatInteraction'][_0x9d38('0x66')](_0x3996a4)[_0x9d38('0x34')](handleEntityNotFound(_0x425b9f,null))[_0x9d38('0x34')](respondWithResult(_0x425b9f,null))[_0x9d38('0x2a')](handleError(_0x425b9f,null));};exports[_0x9d38('0xc0')]=function(_0x753eb2,_0x35f83b){return db[_0x9d38('0xa3')][_0x9d38('0xc0')](_0x753eb2[_0x9d38('0x7a')],{})['then'](respondWithResult(_0x35f83b,0xc9))[_0x9d38('0x2a')](handleError(_0x35f83b,null));};exports[_0x9d38('0x33')]=function(_0x39d99b,_0x5d3689){if(_0x39d99b['body']['id']){delete _0x39d99b[_0x9d38('0x7a')]['id'];}return db[_0x9d38('0xa3')][_0x9d38('0x66')]({'where':{'id':_0x39d99b[_0x9d38('0xbb')]['id']}})['then'](handleEntityNotFound(_0x5d3689,null))[_0x9d38('0x34')](saveUpdates(_0x39d99b['body'],null))['then'](respondWithResult(_0x5d3689,null))[_0x9d38('0x2a')](handleError(_0x5d3689,null));};exports[_0x9d38('0x35')]=function(_0xd02217,_0x10eff0){return db[_0x9d38('0xa3')][_0x9d38('0x66')]({'where':{'id':_0xd02217[_0x9d38('0xbb')]['id']}})[_0x9d38('0x34')](handleEntityNotFound(_0x10eff0,null))[_0x9d38('0x34')](removeEntity(_0x10eff0,null))['catch'](handleError(_0x10eff0,null));};exports[_0x9d38('0xc1')]=function(_0x202672,_0x4faad1){return db[_0x9d38('0xa3')][_0x9d38('0xc1')]()[_0x9d38('0x34')](respondWithResult(_0x4faad1,null))['catch'](handleError(_0x4faad1,null));};exports[_0x9d38('0xc2')]=function(_0x6ef5cd,_0x44bca2){var _0x4a6e7e=_0x6ef5cd[_0x9d38('0xbb')]['id'];var _0x181ac3;var _0x39e173;var _0x53389d;return db['ChatInteraction'][_0x9d38('0xc3')]({'where':{'id':_0x4a6e7e}})[_0x9d38('0x34')](function(_0x153ce4){_0x181ac3=_0x153ce4;return db[_0x9d38('0xc4')][_0x9d38('0xc3')]({'where':{'id':_0x153ce4[_0x9d38('0x7e')]},'attributes':['id',_0x9d38('0xc5'),_0x9d38('0xc6')],'raw':!![]});})['then'](function(_0x18b7d3){if(_0x18b7d3&&_0x18b7d3[_0x9d38('0xc5')]&&_0x18b7d3[_0x9d38('0xc6')]){_0x39e173=_0x18b7d3;var _0xced318={'rejectUnauthorized':![],'method':_0x9d38('0xc7'),'uri':_0x9d38('0xc8'),'headers':{'X-APIKEY':_0x18b7d3[_0x9d38('0xc5')]},'body':{'name':'MotionCWB:'+_0x4a6e7e},'redirect':_0x9d38('0xc9'),'json':!![]};return rp(_0xced318);}else{throw new db['Sequelize'][(_0x9d38('0xca'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x9d38('0x34')](function(_0x2b34d2){_0x53389d=_0x2b34d2;if(_0x53389d['id']){var _0x5b9218={'body':_0x53389d['join_url'],'ChatWebsiteId':_0x39e173['id'],'ChatInteractionId':_0x181ac3['id'],'direction':_0x9d38('0xcb'),'UserId':_0x6ef5cd[_0x9d38('0x9b')]['id']};return db['ChatMessage']['create'](_0x5b9218,{});}else{throw new db[(_0x9d38('0x91'))]['ValidationError'](_0x9d38('0xcc'));}})[_0x9d38('0x34')](function(){return _0x181ac3[_0x9d38('0xcd')]({'vidaooSessionId':_0x53389d['id']});})['then'](respondWithResult(_0x44bca2,null))[_0x9d38('0x2a')](handleError(_0x44bca2,null));};exports[_0x9d38('0xce')]=function(_0x1a5a3e,_0x317623){if(_0x1a5a3e[_0x9d38('0x7a')]['id']){delete _0x1a5a3e['body']['id'];}return db[_0x9d38('0xa3')]['find']({'where':{'id':_0x1a5a3e[_0x9d38('0xbb')]['id']}})['then'](handleEntityNotFound(_0x317623,null))[_0x9d38('0x34')](saveUpdates(_0x1a5a3e[_0x9d38('0x7a')],null))['then'](respondWithResult(_0x317623,null))['catch'](handleError(_0x317623,null));};exports[_0x9d38('0xcf')]=function(_0x192766,_0x29d9a4,_0x405dea){if(_0x192766[_0x9d38('0x7a')]['id']){delete _0x192766[_0x9d38('0x7a')]['id'];}return db[_0x9d38('0xa3')][_0x9d38('0x66')]({'where':{'id':_0x192766[_0x9d38('0xbb')]['id']}})['then'](function(_0x43f270){if(!_0x43f270){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0x9d38('0xd0'));_0x29d9a4[_0x9d38('0x2b')](0x194);}else{if(_0x43f270[_0x9d38('0x79')]){throw new db[(_0x9d38('0x91'))][(_0x9d38('0xca'))](_0x9d38('0xd1'));}}return _0x43f270;})[_0x9d38('0x34')](function(_0x3d6d86){if(_0x3d6d86){return _0x3d6d86[_0x9d38('0x33')]({'closed':_0x192766[_0x9d38('0x7a')][_0x9d38('0xd2')],'disposition':_0x192766[_0x9d38('0x7a')]['disposition']})[_0x9d38('0x34')](function(_0x4c7342){return _0x4c7342;});}})[_0x9d38('0x34')](function(_0x45ec4d){return respondWithRpcPromise(_0x9d38('0xd3'),_0x9d38('0xcf'),_0x192766[_0x9d38('0x7a')],client9004);})[_0x9d38('0x34')](respondWithResult(_0x29d9a4,null))['catch'](handleError(_0x29d9a4,null));};exports[_0x9d38('0xd4')]=function(_0x3421ae,_0x129443,_0x3ab96e){_0x3421ae['body'][_0x9d38('0x38')]=_0x3421ae['file']['originalname'];_0x3421ae[_0x9d38('0x7a')]['basename']=_0x3421ae[_0x9d38('0xd5')][_0x9d38('0xd6')];_0x3421ae['body']['type']=_0x3421ae[_0x9d38('0xd5')][_0x9d38('0xd7')];return db[_0x9d38('0xd8')][_0x9d38('0xc0')](_0x3421ae['body'])[_0x9d38('0x34')](respondWithResult(_0x129443,0xc9))[_0x9d38('0x2a')](handleError(_0x129443,null));};exports[_0x9d38('0xd9')]=function(_0x433f64,_0x9b2ec6,_0x3ebe1b){return db[_0x9d38('0xa3')]['findOne']({'where':{'id':_0x433f64['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x9b2ec6,null))['then'](function(_0x5ce734){if(_0x5ce734){if(_0x5ce734[_0x9d38('0xd2')]){return _0x9b2ec6['status'](0x193)[_0x9d38('0x2d')]({'status':0x193,'message':'Unauthorized'});}return db[_0x9d38('0xd8')]['findOne']({'where':{'id':_0x433f64[_0x9d38('0x45')][_0x9d38('0xda')]},'raw':!![]})[_0x9d38('0x34')](handleEntityNotFound(_0x9b2ec6,null));}})['then'](function(_0x42b879){if(_0x42b879){return _0x9b2ec6[_0x9d38('0xdb')](path[_0x9d38('0xdc')](config[_0x9d38('0xdd')],_0x9d38('0xde'),_0x42b879[_0x9d38('0xdf')]));}})[_0x9d38('0x2a')](handleError(_0x9b2ec6,null));};exports[_0x9d38('0xe0')]=function(_0x547dfc,_0x4b6d24){var _0x56e11b=null;var _0x3ef667=null;var _0x404f8d=null;var _0x5d567f=null;if(_0x547dfc[_0x9d38('0x7a')]['id']){delete _0x547dfc[_0x9d38('0x7a')]['id'];}if(_0x547dfc[_0x9d38('0x7a')]['mailTranscript']){_0x5d567f=path[_0x9d38('0xdc')](config[_0x9d38('0xdd')],_0x9d38('0xe1'),util[_0x9d38('0xe2')]('transcript-%s.txt',Date[_0x9d38('0xe3')]()));_0x547dfc[_0x9d38('0x7a')][_0x9d38('0xe4')]=_0x5d567f;}return db['ChatInteraction'][_0x9d38('0x66')]({'where':{'id':_0x547dfc['params']['id']},'include':[{'model':db['ChatMessage'],'as':_0x9d38('0xe5'),'include':[{'model':db[_0x9d38('0x77')],'as':'User'}]}]})[_0x9d38('0x34')](handleEntityNotFound(_0x4b6d24,null))[_0x9d38('0x34')](saveUpdates(_0x547dfc['body'],null))['then'](function(_0x48ce82){if(_0x48ce82){_0x56e11b=_0x48ce82;return db['ChatWebsite']['find']({'where':{'id':_0x56e11b[_0x9d38('0x7e')]}});}})[_0x9d38('0x34')](function(_0x1823b6){if(_0x1823b6){_0x404f8d=_0x1823b6;return db[_0x9d38('0xe6')][_0x9d38('0x66')]({'where':{'id':_0x56e11b[_0x9d38('0x70')]}});}})[_0x9d38('0x34')](function(_0x3fb7fe){if(_0x3fb7fe){_0x3ef667=_0x3fb7fe;if(_0x5d567f){var _0x1b1e8c=null;for(var _0x270c0b=0x1;_0x270c0b<_0x56e11b[_0x9d38('0xe5')][_0x9d38('0x4a')];++_0x270c0b){_0x1b1e8c=_0x56e11b[_0x9d38('0xe5')][_0x270c0b];var _0x5f2633=_0x1b1e8c[_0x9d38('0x79')]?util[_0x9d38('0xe2')](_0x9d38('0xe7'),_0x404f8d[_0x9d38('0xe8')],_0x1b1e8c[_0x9d38('0x79')]):'System';var _0xc3070e=_0x547dfc[_0x9d38('0x7a')][_0x9d38('0xe9')]||util[_0x9d38('0xe2')](_0x9d38('0xe7'),'Visitor',_0x1b1e8c['ContactId']);switch(_0x404f8d[_0x9d38('0xea')]){case _0x9d38('0xeb'):_0x5f2633=_0x1b1e8c[_0x9d38('0x79')]?util[_0x9d38('0xe2')](_0x9d38('0xe7'),_0x404f8d['agentAlias'],_0x1b1e8c[_0x9d38('0x79')]):'System';break;case _0x9d38('0xec'):_0x5f2633=_0x1b1e8c[_0x9d38('0x79')]?_0x1b1e8c[_0x9d38('0x77')][_0x9d38('0xed')]||_0x1b1e8c[_0x9d38('0x77')]['fullname']:'System';break;case _0x9d38('0xee'):_0x5f2633=_0x1b1e8c['UserId']?_0x1b1e8c[_0x9d38('0x77')][_0x9d38('0x3b')]:_0x9d38('0xef');break;default:_0x5f2633=_0x1b1e8c['UserId']?util[_0x9d38('0xe2')](_0x9d38('0xe7'),_0x404f8d['agentAlias'],_0x1b1e8c['UserId']):_0x9d38('0xef');}var _0x2fa2c5=util[_0x9d38('0xe2')](_0x9d38('0xf0'),moment(_0x1b1e8c[_0x9d38('0x80')])['format'](_0x9d38('0xf1')),_0x1b1e8c[_0x9d38('0xf2')]==='in'?_0xc3070e:_0x5f2633,_0x1b1e8c[_0x9d38('0x7a')]);if(!_0x1b1e8c[_0x9d38('0xf3')]){fs[_0x9d38('0xf4')](_0x5d567f,_0x2fa2c5);}}return db[_0x9d38('0xf5')][_0x9d38('0xc3')]({'where':{'service':!![]},'include':[{'model':db[_0x9d38('0xf6')],'as':_0x9d38('0xf7'),'raw':!![]}]});}}})['then'](function(_0x5574b4){if(_0x5574b4&&_0x5574b4[_0x9d38('0xf7')]&&_0x547dfc['body']){var _0x51113a={'tls':{'rejectUnauthorized':![]}};if(_0x5574b4[_0x9d38('0xf7')][_0x9d38('0xf8')]){_0x51113a[_0x9d38('0xf8')]=_0x5574b4['Smtp'][_0x9d38('0xf8')];}else{_0x51113a[_0x9d38('0xf9')]=_0x5574b4[_0x9d38('0xf7')][_0x9d38('0xf9')];_0x51113a[_0x9d38('0xfa')]=_0x5574b4['Smtp']['port'];_0x51113a[_0x9d38('0xfb')]=_0x5574b4[_0x9d38('0xf7')][_0x9d38('0xfb')];}if(_0x5574b4[_0x9d38('0xf7')][_0x9d38('0xfc')]){_0x51113a[_0x9d38('0xfd')]={'user':_0x5574b4[_0x9d38('0xf7')]['user'],'pass':_0x5574b4[_0x9d38('0xf7')]['pass']};}return respondWithRpcPromise(_0x9d38('0xfe'),_0x9d38('0xff'),{'account':_0x51113a,'message':{'from':util[_0x9d38('0xe2')](_0x9d38('0x100'),_0x5574b4[_0x9d38('0x38')],_0x5574b4[_0x9d38('0x101')]||_0x5574b4[_0x9d38('0xf7')][_0x9d38('0x9b')]),'to':_0x547dfc[_0x9d38('0x7a')][_0x9d38('0x102')],'subject':_0x9d38('0x103'),'text':util[_0x9d38('0xe2')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x547dfc['body'][_0x9d38('0x102')]),'attachments':[{'path':_0x5d567f}]}})['then'](function(){return _0x56e11b;})[_0x9d38('0x2a')](function(_0x13f3c6){console[_0x9d38('0x26')](_0x13f3c6);});}else{return _0x56e11b;}})[_0x9d38('0x34')](respondWithStatusCode(_0x4b6d24,0xc8))[_0x9d38('0x2a')](handleError(_0x4b6d24,null));};exports[_0x9d38('0x104')]=function(_0x15dacb,_0xe851c3,_0x5ef4ba){return db['ChatMessage'][_0x9d38('0x66')]({'where':{'id':_0x15dacb['params']['id']}})[_0x9d38('0x34')](handleEntityNotFound(_0xe851c3,null))[_0x9d38('0x34')](function(_0x50b09b){if(_0x50b09b){return _0x50b09b[_0x9d38('0x104')](_0x15dacb[_0x9d38('0x7a')][_0x9d38('0x105')],_[_0x9d38('0x106')](_0x15dacb[_0x9d38('0x7a')],[_0x9d38('0x105'),'id'])||{});}})['then'](respondWithResult(_0xe851c3,null))['catch'](handleError(_0xe851c3,null));};exports[_0x9d38('0x107')]=function(_0x3ca9c7,_0x3b8b2e,_0x2c8fd4){var _0x410662={'raw':![],'where':{}};var _0xe63e3a={};var _0x35bf4a={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x9d38('0xc3')]({'where':{'id':_0x3ca9c7[_0x9d38('0xbb')]['id']}})[_0x9d38('0x34')](handleEntityNotFound(_0x3b8b2e,null))[_0x9d38('0x34')](function(_0x3f76a3){if(_0x3f76a3){_0xe63e3a[_0x9d38('0x44')]=_['keys'](db['ChatMessage'][_0x9d38('0x108')]);_0xe63e3a[_0x9d38('0x45')]=_['keys'](_0x3ca9c7[_0x9d38('0x45')]);_0xe63e3a[_0x9d38('0x46')]=_[_0x9d38('0x47')](_0xe63e3a[_0x9d38('0x44')],_0xe63e3a['query']);_0x410662[_0x9d38('0x49')]=_[_0x9d38('0x47')](_0xe63e3a[_0x9d38('0x44')],qs[_0x9d38('0x48')](_0x3ca9c7[_0x9d38('0x45')][_0x9d38('0x48')]));_0x410662['attributes']=_0x410662['attributes'][_0x9d38('0x4a')]?_0x410662[_0x9d38('0x49')]:_0xe63e3a[_0x9d38('0x44')];if(!_0x3ca9c7['query'][_0x9d38('0x4b')](_0x9d38('0x4c'))){_0x410662[_0x9d38('0x30')]=qs[_0x9d38('0x30')](_0x3ca9c7[_0x9d38('0x45')]['limit']);_0x410662[_0x9d38('0x2f')]=qs[_0x9d38('0x2f')](_0x3ca9c7[_0x9d38('0x45')][_0x9d38('0x2f')]);}_0x410662['order']=qs[_0x9d38('0x4d')](_0x3ca9c7['query'][_0x9d38('0x4d')]);_0x410662[_0x9d38('0x4e')]=qs['filters'](_[_0x9d38('0x4f')](_0x3ca9c7[_0x9d38('0x45')],_0xe63e3a[_0x9d38('0x46')]));_0x410662[_0x9d38('0x4e')][_0x9d38('0xb7')]=_0x3f76a3['id'];if(_0x3ca9c7[_0x9d38('0x45')][_0x9d38('0x8b')]){_0x410662[_0x9d38('0x4e')]=_[_0x9d38('0xa2')](_0x410662[_0x9d38('0x4e')],{'$or':_[_0x9d38('0x3a')](_0x410662[_0x9d38('0x49')],function(_0x182389){var _0x185508={};_0x185508[_0x182389]={'$like':'%'+_0x3ca9c7[_0x9d38('0x45')][_0x9d38('0x8b')]+'%'};return _0x185508;})});}if(_0x3ca9c7[_0x9d38('0x45')][_0x9d38('0x109')]){var _0x3515c3=_0x3ca9c7['query'][_0x9d38('0x109')]['split'](',');var _0x381f95={};_0x381f95[_0x3515c3[0x0]]={'$gte':moment(_0x3515c3[0x1])[_0x9d38('0xe2')](_0x9d38('0x10a'))};_0x410662[_0x9d38('0x4e')]=_[_0x9d38('0xa2')](_0x410662[_0x9d38('0x4e')],_0x381f95);}_0x410662=_[_0x9d38('0xa2')]({},_0x410662,_0x3ca9c7['options']);return db[_0x9d38('0x10b')]['count']({'where':_0x410662[_0x9d38('0x4e')]})[_0x9d38('0x34')](function(_0x337ce7){_0x35bf4a['count']=_0x337ce7;if(_0x3ca9c7[_0x9d38('0x45')]['includeAll']){_0x410662['include']=[{'all':!![]}];}return db[_0x9d38('0x10b')][_0x9d38('0x10c')](_0x410662);})[_0x9d38('0x34')](function(_0x33ef1e){_0x35bf4a[_0x9d38('0xb9')]=_0x33ef1e;return _0x35bf4a;});}})[_0x9d38('0x34')](respondWithFilteredResult(_0x3b8b2e,_0x410662))[_0x9d38('0x2a')](handleError(_0x3b8b2e,null));};exports['getMyMessages']=function(_0x12fea9,_0x715c7d,_0x1df62d){var _0x88eaed={'where':{}},_0x54a923={},_0x2baa91={'count':0x0,'rows':[]};return db[_0x9d38('0xa3')]['findOne']({'where':{'id':_0x12fea9[_0x9d38('0xbb')]['id']}})[_0x9d38('0x34')](handleEntityNotFound(_0x715c7d,null))[_0x9d38('0x34')](function(_0x6f3fe9){if(_0x6f3fe9){_0x54a923[_0x9d38('0x44')]=_[_0x9d38('0xbc')](db['ChatMessage'][_0x9d38('0x108')]);_0x54a923['query']=_['keys'](_0x12fea9['query']);_0x54a923[_0x9d38('0x46')]=_[_0x9d38('0x47')](_0x54a923[_0x9d38('0x44')],_0x54a923[_0x9d38('0x45')]);_0x88eaed[_0x9d38('0x49')]=_[_0x9d38('0x47')](_0x54a923[_0x9d38('0x44')],qs[_0x9d38('0x48')](_0x12fea9['query']['fields']));_0x88eaed[_0x9d38('0x49')]=_0x88eaed['attributes'][_0x9d38('0x4a')]?_0x88eaed[_0x9d38('0x49')]:_0x54a923['model'];if(!_0x12fea9[_0x9d38('0x45')][_0x9d38('0x4b')](_0x9d38('0x4c'))){_0x88eaed['limit']=qs[_0x9d38('0x30')](_0x12fea9[_0x9d38('0x45')][_0x9d38('0x30')]);_0x88eaed[_0x9d38('0x2f')]=qs[_0x9d38('0x2f')](_0x12fea9['query'][_0x9d38('0x2f')]);}_0x88eaed[_0x9d38('0x95')]=qs[_0x9d38('0x4d')](_0x12fea9['query']['sort']);_0x88eaed[_0x9d38('0x4e')]=qs[_0x9d38('0x46')](_[_0x9d38('0x4f')](_0x12fea9[_0x9d38('0x45')],_0x54a923[_0x9d38('0x46')]));_0x88eaed['where'][_0x9d38('0xb7')]=_0x6f3fe9['id'];if(_0x12fea9['query'][_0x9d38('0x8b')]){_0x88eaed[_0x9d38('0x4e')]=_[_0x9d38('0xa2')](_0x88eaed[_0x9d38('0x4e')],{'$or':_[_0x9d38('0x3a')](_0x88eaed[_0x9d38('0x49')],function(_0x22d427){var _0x1d40e7={};_0x1d40e7[_0x22d427]={'$like':'%'+_0x12fea9[_0x9d38('0x45')][_0x9d38('0x8b')]+'%'};return _0x1d40e7;})});}_0x88eaed[_0x9d38('0x4e')][_0x9d38('0xf3')]=![];if(_0x12fea9['query']['id']){_0x88eaed[_0x9d38('0x4e')]['id']={'$gt':_0x12fea9['query']['id']};}_0x88eaed=_[_0x9d38('0xa2')]({},_0x88eaed,_0x12fea9['options']);return db[_0x9d38('0x10b')][_0x9d38('0x2e')]({'where':_0x88eaed[_0x9d38('0x4e')]})[_0x9d38('0x34')](function(_0x19e93c){_0x2baa91[_0x9d38('0x2e')]=_0x19e93c;_0x88eaed['include']=[];if(_0x12fea9[_0x9d38('0x45')][_0x9d38('0x10d')]){_0x88eaed['include'][_0x9d38('0x3f')]({'model':db['User'],'as':_0x9d38('0x77'),'attributes':['id',_0x9d38('0x3b'),_0x9d38('0xed')]});}if(_0x12fea9[_0x9d38('0x45')]['includeAll']){_0x88eaed[_0x9d38('0xbe')]=[{'all':!![]}];}return db[_0x9d38('0x10b')][_0x9d38('0x10c')](_0x88eaed);})[_0x9d38('0x34')](function(_0x4e23c3){_0x2baa91['rows']=_0x4e23c3;return _0x2baa91;});}})['then'](respondWithFilteredResult(_0x715c7d,_0x88eaed))['catch'](handleError(_0x715c7d,null));};exports['addTags']=function(_0x58dfd5,_0x10b5cf,_0x274788){return db[_0x9d38('0xa3')][_0x9d38('0x66')]({'where':{'id':_0x58dfd5[_0x9d38('0xbb')]['id']}})[_0x9d38('0x34')](handleEntityNotFound(_0x10b5cf,null))[_0x9d38('0x34')](function(_0x1d1801){if(_0x1d1801){return _0x1d1801[_0x9d38('0x10e')](_0x58dfd5['body'][_0x9d38('0x105')],_['omit'](_0x58dfd5['body'],[_0x9d38('0x105'),'id'])||{})[_0x9d38('0x10f')](function(){return db['Tag']['findAll']({'attributes':['id','name',_0x9d38('0x52')],'where':{'id':_0x58dfd5[_0x9d38('0x7a')]['ids']}});})['then'](function(_0x330f27){socket[_0x9d38('0x110')](_0x9d38('0x111'),{'id':Number(_0x58dfd5[_0x9d38('0xbb')]['id']),'tags':_0x330f27||[]});return{'id':Number(_0x58dfd5[_0x9d38('0xbb')]['id']),'tags':_0x330f27||[]};});}})[_0x9d38('0x34')](respondWithResult(_0x10b5cf,null))[_0x9d38('0x2a')](handleError(_0x10b5cf,null));};exports['removeTags']=function(_0x2c5e55,_0x19296f,_0xe299c5){return db['ChatInteraction'][_0x9d38('0x66')]({'where':{'id':_0x2c5e55[_0x9d38('0xbb')]['id']}})[_0x9d38('0x34')](handleEntityNotFound(_0x19296f,null))[_0x9d38('0x34')](function(_0x329efe){if(_0x329efe){return _0x329efe[_0x9d38('0x112')](_0x2c5e55[_0x9d38('0x45')][_0x9d38('0x105')]);}})[_0x9d38('0x34')](respondWithStatusCode(_0x19296f,null))[_0x9d38('0x2a')](handleError(_0x19296f,null));};exports[_0x9d38('0xdb')]=function(_0x377bf5,_0xfdd0ed){var _0x12909d=moment()['unix']()['toString']();var _0xd227e9=path[_0x9d38('0xdc')](config[_0x9d38('0xdd')],_0x9d38('0x113'),_0x9d38('0x114'),_0x9d38('0x115'));var _0x395ba4=path[_0x9d38('0xdc')](config[_0x9d38('0xdd')],'server',_0x9d38('0x114'),_0x9d38('0x116'));var _0x3f75b0=path['join'](_0xd227e9,_0x12909d);var _0x1360ae=util['format'](_0x9d38('0x117'),_0x377bf5[_0x9d38('0xbb')]['id'],_0x12909d);var _0x45bccc=path[_0x9d38('0xdc')](_0xd227e9,_0x1360ae);var _0x5e2db3=[];_0x5e2db3['push']({'model':db[_0x9d38('0x77')],'as':_0x9d38('0x77'),'attributes':['id',_0x9d38('0x3b')],'raw':!![]});_0x5e2db3[_0x9d38('0x3f')]({'model':db['CmContact'],'as':_0x9d38('0x118'),'attributes':['id',_0x9d38('0x119'),_0x9d38('0x11a')],'raw':!![]});if(_0x377bf5[_0x9d38('0x45')][_0x9d38('0x116')]){_0x5e2db3[_0x9d38('0x3f')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x200ee1=[{'model':db[_0x9d38('0x10b')],'as':_0x9d38('0xe5'),'attributes':['id',_0x9d38('0x7a'),_0x9d38('0x80'),_0x9d38('0xf2'),_0x9d38('0xf3'),_0x9d38('0x87')],'include':_0x5e2db3}];_0x200ee1[_0x9d38('0x3f')]({'model':db[_0x9d38('0xc4')],'as':_0x9d38('0x11b'),'attributes':['id','name']});_0x200ee1['push']({'model':db[_0x9d38('0x77')],'as':_0x9d38('0x11c'),'attributes':['id',_0x9d38('0x3b')]});return db['ChatInteraction'][_0x9d38('0x66')]({'where':{'id':_0x377bf5[_0x9d38('0xbb')]['id']},'include':_0x200ee1})['then'](handleEntityNotFound(_0xfdd0ed,null))['then'](function(_0x5c612e){if(_0x5c612e){var _0x4892bf=_0x5c612e[_0x9d38('0x11d')]({'plain':!![]});fs[_0x9d38('0x11e')](_0x3f75b0);var _0x136581={'format':'A4','border':'10px','header':{'height':_0x9d38('0x11f'),'contents':{'first':_0x9d38('0x120')}},'footer':{'height':_0x9d38('0x121'),'contents':{'default':util[_0x9d38('0xe2')](_0x9d38('0x122'),util[_0x9d38('0xe2')]('%s\x20#%d',_0x9d38('0x123'),_0x4892bf['id']),moment()[_0x9d38('0xe2')](_0x9d38('0x124'))[_0x9d38('0x9f')]())}}};var _0x26e2c7={'channel':_0x9d38('0x123'),'account':_0x4892bf[_0x9d38('0x11b')]['name'],'agent':_0x4892bf[_0x9d38('0x11c')]?_0x4892bf[_0x9d38('0x11c')][_0x9d38('0x3b')]:_0x9d38('0x125'),'createdAt':moment(_0x4892bf['createdAt'])[_0x9d38('0xe2')](_0x9d38('0x10a'))['toString'](),'closedAt':_0x4892bf['closed']?moment(_0x4892bf[_0x9d38('0x126')])[_0x9d38('0xe2')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9d38('0x9f')]():'','disposition':_0x4892bf[_0x9d38('0x127')],'chatInfo':{'browser':_0x4892bf[_0x9d38('0x128')],'os':_0x4892bf[_0x9d38('0x129')],'referer':_0x4892bf['referer'],'customerIp':_0x4892bf[_0x9d38('0x12a')],'customerPort':_0x4892bf[_0x9d38('0x12b')]?_0x4892bf[_0x9d38('0x12b')]:_0x9d38('0x125')},'messages':_(_0x4892bf[_0x9d38('0xe5')])['tail']()[_0x9d38('0x8b')]({'secret':![]})['map'](function(_0x1bbb67){if(_0x1bbb67[_0x9d38('0xd8')]){var _0xb78f27=path['join'](_0x395ba4,_0x1bbb67[_0x9d38('0xd8')][_0x9d38('0xdf')]);if(fs['existsSync'](_0xb78f27)){fs[_0x9d38('0x12c')](_0xb78f27)[_0x9d38('0x12d')](fs[_0x9d38('0x12e')](path['join'](_0x3f75b0,_0x1bbb67[_0x9d38('0xd8')]['basename'])));}}return{'date':moment(_0x1bbb67['createdAt'])[_0x9d38('0xe2')](_0x9d38('0x10a'))['toString'](),'sender':_0x1bbb67['direction']===_0x9d38('0xcb')?_0x1bbb67['User']?_0x1bbb67[_0x9d38('0x77')]['fullname']:_0x9d38('0xef'):_0x1bbb67['Contact'][_0x9d38('0x119')]+(_0x1bbb67[_0x9d38('0x118')][_0x9d38('0x11a')]?'\x20'+_0x1bbb67[_0x9d38('0x118')][_0x9d38('0x11a')]:''),'body':_0x1bbb67[_0x9d38('0xd8')]?_0x1bbb67['Attachment']['basename']:_0x1bbb67[_0x9d38('0x7a')],'direction':_0x1bbb67[_0x9d38('0xf2')]===_0x9d38('0xcb')?'A':'C','secret':_0x1bbb67[_0x9d38('0xf3')],'read':_0x1bbb67[_0x9d38('0x87')],'attachment':_0x1bbb67[_0x9d38('0xd8')]};})[_0x9d38('0x68')]()};return ejs[_0x9d38('0x12f')](path[_0x9d38('0xdc')](config[_0x9d38('0xdd')],_0x9d38('0x113'),_0x9d38('0x130'),_0x9d38('0x131')),{'interaction':_0x26e2c7})[_0x9d38('0x34')](function(_0x5036b8){return new BPromise(function(_0x7650d7,_0x1eb4a5){pdf[_0x9d38('0xc0')](_0x5036b8,_0x136581)[_0x9d38('0x132')](path[_0x9d38('0xdc')](_0x3f75b0,_0x9d38('0x133')+_0x4892bf['id']+'-'+_0x12909d+_0x9d38('0x134')),function(_0x5e8cc1,_0x394f14){if(_0x5e8cc1)return _0x1eb4a5(_0x5e8cc1);_0x7650d7(_0x394f14);});});})[_0x9d38('0x34')](function(){return new BPromise(function(_0x2fdb65,_0x5e8be6){zipdir(_0x3f75b0,{'saveTo':_0x45bccc},function(_0x2e1ef4,_0x285953){if(_0x2e1ef4)return _0x5e8be6(_0x2e1ef4);return _0x2fdb65(_0x285953);});})['then'](function(){return new BPromise(function(_0x5527aa,_0x28a38d){rimraf(_0x3f75b0,function(_0x5b60ed){if(_0x5b60ed)_0x28a38d(_0x5b60ed);return _0x5527aa();});});})[_0x9d38('0x34')](function(){return _0xfdd0ed[_0x9d38('0xdb')](_0x45bccc,_0x1360ae,function(_0x5b3b26){if(_0x5b3b26){console[_0x9d38('0x135')]('err',_0x5b3b26);}else{fs[_0x9d38('0x136')](_0x45bccc);}});});});}else{return _0xfdd0ed['sendStatus'](0xc8);}})[_0x9d38('0x2a')](handleError(_0xfdd0ed,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 493e852..5efcb67 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 _0xc7ce=['length','emit','catch','hasOwnProperty','../../mysqldb','ChatInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','unreadMessages'];(function(_0x2fba41,_0x2e3156){var _0x5b4d59=function(_0x32e545){while(--_0x32e545){_0x2fba41['push'](_0x2fba41['shift']());}};_0x5b4d59(++_0x2e3156);}(_0xc7ce,0x1e4));var _0xec7c=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xc7ce[_0x13d07a];return _0x5ee0ee;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xec7c('0x0'))['db'][_0xec7c('0x1')];var ChatMessage=require(_0xec7c('0x0'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xec7c('0x2')](0x0);var events={'afterCreate':_0xec7c('0x3'),'afterUpdate':_0xec7c('0x4'),'afterDestroy':_0xec7c('0x5')};function emitEvent(_0xc3ef9b){return function(_0x182e8b,_0x1a74af,_0x628687){_0x182e8b[_0xec7c('0x6')]({'attributes':['id'],'raw':!![]})[_0xec7c('0x7')](function(_0xefce34){_0x182e8b[_0xec7c('0x8')](_0xec7c('0x9'),_0xefce34['map'](function(_0x225269){return{'id':_0x225269['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x182e8b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xea69d5){_0x182e8b[_0xec7c('0x8')](_0xec7c('0xa'),_0xea69d5[_0xec7c('0xb')]);ChatInteractionEvents['emit'](_0xc3ef9b+':'+_0x182e8b['id'],_0x182e8b);ChatInteractionEvents[_0xec7c('0xc')](_0xc3ef9b,_0x182e8b);_0x628687(null);})[_0xec7c('0xd')](_0x628687(null));};}for(var e in events){if(events[_0xec7c('0xe')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x4549=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','save','update','remove','setDataValue','Users','findAll','then'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x4549,0x14e));var _0x9454=function(_0x2cd55b,_0x513cb9){_0x2cd55b=_0x2cd55b-0x0;var _0x3bbe00=_0x4549[_0x2cd55b];return _0x3bbe00;};'use strict';var EventEmitter=require(_0x9454('0x0'));var ChatInteraction=require(_0x9454('0x1'))['db'][_0x9454('0x2')];var ChatMessage=require(_0x9454('0x1'))['db'][_0x9454('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9454('0x4'),'afterUpdate':_0x9454('0x5'),'afterDestroy':_0x9454('0x6')};function emitEvent(_0x560e25){return function(_0x3e7e45,_0x596481,_0x405755){_0x3e7e45['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x1e5085){_0x3e7e45[_0x9454('0x7')](_0x9454('0x8'),_0x1e5085['map'](function(_0xe23bfe){return{'id':_0xe23bfe['id']};}));return ChatMessage[_0x9454('0x9')]({'where':{'ChatInteractionId':_0x3e7e45['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9454('0xa')](function(_0x3b305a){_0x3e7e45['setDataValue']('unreadMessages',_0x3b305a['length']);ChatInteractionEvents[_0x9454('0xb')](_0x560e25+':'+_0x3e7e45['id'],_0x3e7e45);ChatInteractionEvents['emit'](_0x560e25,_0x3e7e45);_0x405755(null);})['catch'](_0x405755(null));};}for(var e in events){if(events[_0x9454('0xc')](e)){var event=events[e];ChatInteraction[_0x9454('0xd')](e,emitEvent(event));}}module[_0x9454('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 2ac0a6b..dc23c34 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 _0xdd3f=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','api','moment','path','rimraf','../../config/environment','exports','define','chat_interactions'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xdd3f,0xa6));var _0xfdd3=function(_0x5e6af8,_0x46f7d9){_0x5e6af8=_0x5e6af8-0x0;var _0x52f062=_0xdd3f[_0x5e6af8];return _0x52f062;};'use strict';var _=require(_0xfdd3('0x0'));var util=require(_0xfdd3('0x1'));var logger=require('../../config/logger')(_0xfdd3('0x2'));var moment=require(_0xfdd3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdd3('0x4'));var rimraf=require(_0xfdd3('0x5'));var config=require(_0xfdd3('0x6'));var attributes=require('./chatInteraction.attributes');module[_0xfdd3('0x7')]=function(_0x3c8fed,_0x180fca){return _0x3c8fed[_0xfdd3('0x8')]('ChatInteraction',attributes,{'tableName':_0xfdd3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x54c834,_0x4c871c,_0x37d3b1){if(_0x54c834[_0xfdd3('0xa')](_0xfdd3('0xb'))){_0x54c834[_0xfdd3('0xc')]=moment()[_0xfdd3('0xd')](_0xfdd3('0xe'));}_0x37d3b1(null,_0x54c834);}},'charset':'utf8mb4','collate':_0xfdd3('0xf')});}; \ No newline at end of file +var _0xe77e=['utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4'];(function(_0x301c34,_0x15701e){var _0x1a8c5a=function(_0x297b4f){while(--_0x297b4f){_0x301c34['push'](_0x301c34['shift']());}};_0x1a8c5a(++_0x15701e);}(_0xe77e,0x1bb));var _0xee77=function(_0x2c0c92,_0x29de8d){_0x2c0c92=_0x2c0c92-0x0;var _0x16df60=_0xe77e[_0x2c0c92];return _0x16df60;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xee77('0x0'))('api');var moment=require(_0xee77('0x1'));var BPromise=require(_0xee77('0x2'));var rp=require(_0xee77('0x3'));var fs=require('fs');var path=require(_0xee77('0x4'));var rimraf=require(_0xee77('0x5'));var config=require(_0xee77('0x6'));var attributes=require(_0xee77('0x7'));module[_0xee77('0x8')]=function(_0x5fdb96,_0x4624e9){return _0x5fdb96['define'](_0xee77('0x9'),attributes,{'tableName':_0xee77('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3a7c2a,_0x2b7a7e,_0x3a99ed){if(_0x3a7c2a[_0xee77('0xb')]('closed')){_0x3a7c2a[_0xee77('0xc')]=moment()[_0xee77('0xd')](_0xee77('0xe'));}_0x3a99ed(null,_0x3a7c2a);}},'charset':_0xee77('0xf'),'collate':_0xee77('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index bb7a4ff..21b3bd0 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 _0xf3b5=['bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','limit','catch','AddTagsToChatInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment'];(function(_0x2c7d09,_0x40d900){var _0x3dd9ff=function(_0x414bf0){while(--_0x414bf0){_0x2c7d09['push'](_0x2c7d09['shift']());}};_0x3dd9ff(++_0x40d900);}(_0xf3b5,0x11c));var _0x5f3b=function(_0x2f97fc,_0x3ae9be){_0x2f97fc=_0x2f97fc-0x0;var _0x58b535=_0xf3b5[_0x2f97fc];return _0x58b535;};'use strict';var _=require(_0x5f3b('0x0'));var util=require(_0x5f3b('0x1'));var moment=require(_0x5f3b('0x2'));var BPromise=require(_0x5f3b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f3b('0x4'));var db=require(_0x5f3b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5f3b('0x6'));var config=require(_0x5f3b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5f3b('0x8')][_0x5f3b('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5f3b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5f3b('0xb'))(new Redis(config['redis']));require(_0x5f3b('0xc'))[_0x5f3b('0xd')](socket);function respondWithRpcPromise(_0x3d20ce,_0x25a2df,_0x58ca7d){return new BPromise(function(_0x295b19,_0x486869){return client[_0x5f3b('0xe')](_0x3d20ce,_0x58ca7d)[_0x5f3b('0xf')](function(_0x12249a){logger[_0x5f3b('0x10')](_0x5f3b('0x11'),_0x25a2df,_0x5f3b('0x12'));logger[_0x5f3b('0x13')](_0x5f3b('0x14'),_0x25a2df,'request\x20sent',JSON[_0x5f3b('0x15')](_0x12249a));if(_0x12249a['error']){if(_0x12249a[_0x5f3b('0x16')][_0x5f3b('0x17')]===0x1f4){logger[_0x5f3b('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x25a2df,_0x12249a[_0x5f3b('0x16')]['message']);return _0x486869(_0x12249a['error']['message']);}logger[_0x5f3b('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x25a2df,_0x12249a[_0x5f3b('0x16')]['message']);return _0x295b19(_0x12249a[_0x5f3b('0x16')][_0x5f3b('0x18')]);}else{logger['info'](_0x5f3b('0x11'),_0x25a2df,'request\x20sent');_0x295b19(_0x12249a[_0x5f3b('0x19')][_0x5f3b('0x18')]);}})['catch'](function(_0x24cb1f){logger[_0x5f3b('0x16')](_0x5f3b('0x11'),_0x25a2df,_0x24cb1f);_0x486869(_0x24cb1f);});});}exports[_0x5f3b('0x1a')]=function(_0x2bdbcc){var _0x620a15=this;return new Promise(function(_0x1367da,_0x36dd7b){return db[_0x5f3b('0x1b')][_0x5f3b('0x1c')](_0x2bdbcc[_0x5f3b('0x1d')],{'raw':_0x2bdbcc[_0x5f3b('0x1e')]?_0x2bdbcc[_0x5f3b('0x1e')][_0x5f3b('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bdbcc[_0x5f3b('0x1e')]?_0x2bdbcc[_0x5f3b('0x1e')][_0x5f3b('0x20')]||null:null,'attributes':_0x2bdbcc[_0x5f3b('0x1e')]?_0x2bdbcc[_0x5f3b('0x1e')]['attributes']||null:null,'limit':_0x2bdbcc[_0x5f3b('0x1e')]?_0x2bdbcc[_0x5f3b('0x1e')][_0x5f3b('0x21')]||null:null})[_0x5f3b('0xf')](function(_0x52760a){logger['info']('UpdateChatInteraction',_0x2bdbcc);logger[_0x5f3b('0x13')](_0x5f3b('0x1a'),_0x2bdbcc,JSON['stringify'](_0x52760a));_0x1367da(_0x52760a);})[_0x5f3b('0x22')](function(_0x1cf2e0){logger['error'](_0x5f3b('0x1a'),_0x1cf2e0[_0x5f3b('0x18')],_0x2bdbcc);_0x36dd7b(_0x620a15[_0x5f3b('0x16')](0x1f4,_0x1cf2e0['message']));});});};exports[_0x5f3b('0x23')]=function(_0x310fd5){return new Promise(function(_0x5c4228,_0x18bf97){return db[_0x5f3b('0x1b')][_0x5f3b('0x24')]({'where':_0x310fd5[_0x5f3b('0x1e')]?_0x310fd5[_0x5f3b('0x1e')][_0x5f3b('0x20')]||null:null})[_0x5f3b('0xf')](function(_0x59e7ee){if(_0x59e7ee){return _0x59e7ee[_0x5f3b('0x25')](_0x310fd5[_0x5f3b('0x1d')][_0x5f3b('0x26')],_[_0x5f3b('0x27')](_0x310fd5[_0x5f3b('0x1d')],[_0x5f3b('0x26'),'id'])||{});}})['spread'](function(_0x4dd8cc){logger[_0x5f3b('0x10')](_0x5f3b('0x28'),_0x310fd5);logger[_0x5f3b('0x13')](_0x5f3b('0x28'),_0x310fd5,JSON['stringify'](_0x4dd8cc));_0x5c4228(_0x4dd8cc);})[_0x5f3b('0x22')](function(_0x12b464){logger[_0x5f3b('0x16')](_0x5f3b('0x28'),_0x12b464[_0x5f3b('0x18')],_0x310fd5);_0x18bf97(_this['error'](0x1f4,_0x12b464[_0x5f3b('0x18')]));});});}; \ No newline at end of file +var _0x021a=['rpc','../../config/environment','jayson/promise','http','defaults','socket.io-emitter','./chatInteraction.socket','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','debug','catch','AddTagsToChatInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x192d25,_0x2148e2){var _0x33d7af=function(_0x44bca5){while(--_0x44bca5){_0x192d25['push'](_0x192d25['shift']());}};_0x33d7af(++_0x2148e2);}(_0x021a,0x11e));var _0xa021=function(_0x1f54d7,_0xafc682){_0x1f54d7=_0x1f54d7-0x0;var _0x355fc0=_0x021a[_0x1f54d7];return _0x355fc0;};'use strict';var _=require(_0xa021('0x0'));var util=require(_0xa021('0x1'));var moment=require(_0xa021('0x2'));var BPromise=require(_0xa021('0x3'));var rs=require(_0xa021('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa021('0x5'))['db'];var utils=require(_0xa021('0x6'));var logger=require(_0xa021('0x7'))(_0xa021('0x8'));var config=require(_0xa021('0x9'));var jayson=require(_0xa021('0xa'));var client=jayson['client'][_0xa021('0xb')]({'port':0x232a});config['redis']=_[_0xa021('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa021('0xd'))(new Redis(config['redis']));require(_0xa021('0xe'))['register'](socket);function respondWithRpcPromise(_0x3e6ba2,_0x39253a,_0x4c8221){return new BPromise(function(_0x46f193,_0x2053dd){return client['request'](_0x3e6ba2,_0x4c8221)[_0xa021('0xf')](function(_0x2541a2){logger[_0xa021('0x10')](_0xa021('0x11'),_0x39253a,_0xa021('0x12'));logger['debug'](_0xa021('0x13'),_0x39253a,'request\x20sent',JSON[_0xa021('0x14')](_0x2541a2));if(_0x2541a2['error']){if(_0x2541a2[_0xa021('0x15')][_0xa021('0x16')]===0x1f4){logger[_0xa021('0x15')](_0xa021('0x11'),_0x39253a,_0x2541a2[_0xa021('0x15')]['message']);return _0x2053dd(_0x2541a2[_0xa021('0x15')]['message']);}logger[_0xa021('0x15')](_0xa021('0x11'),_0x39253a,_0x2541a2['error'][_0xa021('0x17')]);return _0x46f193(_0x2541a2[_0xa021('0x15')][_0xa021('0x17')]);}else{logger[_0xa021('0x10')](_0xa021('0x11'),_0x39253a,_0xa021('0x12'));_0x46f193(_0x2541a2[_0xa021('0x18')][_0xa021('0x17')]);}})['catch'](function(_0x3604e5){logger[_0xa021('0x15')](_0xa021('0x11'),_0x39253a,_0x3604e5);_0x2053dd(_0x3604e5);});});}exports[_0xa021('0x19')]=function(_0x4385e1){var _0x2b98b8=this;return new Promise(function(_0x14bc83,_0x246143){return db[_0xa021('0x1a')][_0xa021('0x1b')](_0x4385e1[_0xa021('0x1c')],{'raw':_0x4385e1['options']?_0x4385e1[_0xa021('0x1d')][_0xa021('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4385e1[_0xa021('0x1d')]?_0x4385e1[_0xa021('0x1d')][_0xa021('0x1f')]||null:null,'attributes':_0x4385e1[_0xa021('0x1d')]?_0x4385e1[_0xa021('0x1d')][_0xa021('0x20')]||null:null,'limit':_0x4385e1['options']?_0x4385e1[_0xa021('0x1d')][_0xa021('0x21')]||null:null})[_0xa021('0xf')](function(_0x2832b5){logger['info'](_0xa021('0x19'),_0x4385e1);logger[_0xa021('0x22')]('UpdateChatInteraction',_0x4385e1,JSON['stringify'](_0x2832b5));_0x14bc83(_0x2832b5);})[_0xa021('0x23')](function(_0x5e1baa){logger['error']('UpdateChatInteraction',_0x5e1baa['message'],_0x4385e1);_0x246143(_0x2b98b8[_0xa021('0x15')](0x1f4,_0x5e1baa[_0xa021('0x17')]));});});};exports[_0xa021('0x24')]=function(_0x610bee){return new Promise(function(_0xba9fe5,_0x597291){return db['ChatInteraction'][_0xa021('0x25')]({'where':_0x610bee[_0xa021('0x1d')]?_0x610bee[_0xa021('0x1d')]['where']||null:null})[_0xa021('0xf')](function(_0x3f7838){if(_0x3f7838){return _0x3f7838[_0xa021('0x26')](_0x610bee[_0xa021('0x1c')][_0xa021('0x27')],_[_0xa021('0x28')](_0x610bee[_0xa021('0x1c')],[_0xa021('0x27'),'id'])||{});}})['spread'](function(_0x3c5f8b){logger['info'](_0xa021('0x29'),_0x610bee);logger[_0xa021('0x22')](_0xa021('0x29'),_0x610bee,JSON['stringify'](_0x3c5f8b));_0xba9fe5(_0x3c5f8b);})[_0xa021('0x23')](function(_0xf6f443){logger['error'](_0xa021('0x29'),_0xf6f443[_0xa021('0x17')],_0x610bee);_0x597291(_this['error'](0x1f4,_0xf6f443[_0xa021('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 5431a85..63667ed 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 _0x95b0=['update','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x2d3d9f,_0x370391){var _0x5a77eb=function(_0x2f3ce7){while(--_0x2f3ce7){_0x2d3d9f['push'](_0x2d3d9f['shift']());}};_0x5a77eb(++_0x370391);}(_0x95b0,0x194));var _0x095b=function(_0x48f195,_0x3d5a1f){_0x48f195=_0x48f195-0x0;var _0x1fe4d4=_0x95b0[_0x48f195];return _0x1fe4d4;};'use strict';var ChatInteractionEvents=require(_0x095b('0x0'));var events=['save','remove',_0x095b('0x1')];function createListener(_0x3f2d76,_0x33efe2){return function(_0x2ddd50){_0x33efe2['emit'](_0x3f2d76,_0x2ddd50);};}function removeListener(_0x2a4820,_0x5aaf5b){return function(){ChatInteractionEvents['removeListener'](_0x2a4820,_0x5aaf5b);};}exports[_0x095b('0x2')]=function(_0x35f06a){for(var _0x376775=0x0,_0x33fd85=events[_0x095b('0x3')];_0x376775<_0x33fd85;_0x376775++){var _0x4567a7=events[_0x376775];var _0xc12b5c=createListener(_0x095b('0x4')+_0x4567a7,_0x35f06a);ChatInteractionEvents['on'](_0x4567a7,_0xc12b5c);}}; \ No newline at end of file +var _0xa55b=['length','chatInteraction:','save','emit','removeListener'];(function(_0xeefac3,_0x356766){var _0x1c4c9a=function(_0x40dd13){while(--_0x40dd13){_0xeefac3['push'](_0xeefac3['shift']());}};_0x1c4c9a(++_0x356766);}(_0xa55b,0x16a));var _0xba55=function(_0x1f8182,_0x4e7309){_0x1f8182=_0x1f8182-0x0;var _0x5f25e5=_0xa55b[_0x1f8182];return _0x5f25e5;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xba55('0x0'),'remove','update'];function createListener(_0x2d5137,_0x31222b){return function(_0x3da2e1){_0x31222b[_0xba55('0x1')](_0x2d5137,_0x3da2e1);};}function removeListener(_0x42f4ff,_0x1b173f){return function(){ChatInteractionEvents[_0xba55('0x2')](_0x42f4ff,_0x1b173f);};}exports['register']=function(_0x11944e){for(var _0x151c15=0x0,_0x5d7432=events[_0xba55('0x3')];_0x151c15<_0x5d7432;_0x151c15++){var _0x3610ac=events[_0x151c15];var _0x57d241=createListener(_0xba55('0x4')+_0x3610ac,_0x11944e);ChatInteractionEvents['on'](_0x3610ac,_0x57d241);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 2381a2c..384c945 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 _0x7eb1=['file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','/:id','chatinteraction:update','update','put','customUpdate','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy','destroy','delete','removeTags','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','getMyMessages','download','post','create','diskStorage','root','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','single'];(function(_0xc1a77e,_0x2dcb95){var _0x15114e=function(_0x9d0295){while(--_0x9d0295){_0xc1a77e['push'](_0xc1a77e['shift']());}};_0x15114e(++_0x2dcb95);}(_0x7eb1,0x79));var _0x17eb=function(_0x5d340a,_0x2441da){_0x5d340a=_0x5d340a-0x0;var _0x435564=_0x7eb1[_0x5d340a];return _0x435564;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x17eb('0x0'));var express=require(_0x17eb('0x1'));var router=express[_0x17eb('0x2')]();var auth=require(_0x17eb('0x3'));var interaction=require(_0x17eb('0x4'));var config=require(_0x17eb('0x5'));var controller=require('./chatInteraction.controller');router[_0x17eb('0x6')]('/',auth['isAuthenticated'](),controller[_0x17eb('0x7')]);router[_0x17eb('0x6')](_0x17eb('0x8'),auth[_0x17eb('0x9')](),controller[_0x17eb('0xa')]);router[_0x17eb('0x6')]('/:id',auth[_0x17eb('0xb')](),controller[_0x17eb('0xc')]);router['get'](_0x17eb('0xd'),auth[_0x17eb('0xb')](),controller['attachmentDownload']);router[_0x17eb('0x6')](_0x17eb('0xe'),auth[_0x17eb('0x9')](),controller[_0x17eb('0xf')]);router[_0x17eb('0x6')]('/:id/my_messages',auth[_0x17eb('0xb')](),controller[_0x17eb('0x10')]);router[_0x17eb('0x6')]('/:id/download',auth[_0x17eb('0x9')](),controller[_0x17eb('0x11')]);router[_0x17eb('0x12')]('/',auth[_0x17eb('0x9')](),controller[_0x17eb('0x13')]);router[_0x17eb('0x12')]('/:id/vidaoo',auth[_0x17eb('0x9')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x17eb('0x14')]({'destination':function(_0x402f7d,_0x1f2d7a,_0x1c8310){_0x1c8310(null,path['join'](config[_0x17eb('0x15')],_0x17eb('0x16')));},'filename':function(_0x12c3b1,_0x3899fa,_0x5a4ba4){_0x5a4ba4(null,util[_0x17eb('0x17')]('%s-%s',Date[_0x17eb('0x18')](),_0x3899fa[_0x17eb('0x19')][_0x17eb('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x17eb('0x12')](_0x17eb('0x1b'),upload[_0x17eb('0x1c')](_0x17eb('0x1d')),controller[_0x17eb('0x1e')]);router['post'](_0x17eb('0xe'),auth[_0x17eb('0xb')](),controller[_0x17eb('0x1f')]);router[_0x17eb('0x12')](_0x17eb('0x20'),auth[_0x17eb('0x9')](),interaction[_0x17eb('0x21')](_0x17eb('0x22'),_0x17eb('0x23')),controller['addTags']);router['put'](_0x17eb('0x24'),auth[_0x17eb('0x9')](),interaction['tracked'](_0x17eb('0x22'),_0x17eb('0x25')),controller[_0x17eb('0x26')]);router[_0x17eb('0x27')]('/:id/custom_update',controller[_0x17eb('0x28')]);router['put'](_0x17eb('0x29'),auth[_0x17eb('0xb')](),controller[_0x17eb('0x2a')]);router[_0x17eb('0x27')](_0x17eb('0x2b'),controller[_0x17eb('0x2c')]);router['delete']('/:id',auth[_0x17eb('0x9')](),interaction[_0x17eb('0x21')](_0x17eb('0x22'),_0x17eb('0x2d')),controller[_0x17eb('0x2e')]);router[_0x17eb('0x2f')]('/:id/tags',auth[_0x17eb('0x9')](),controller[_0x17eb('0x30')]);module[_0x17eb('0x31')]=router; \ No newline at end of file +var _0xa0df=['/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','%s-%s','now','originalname','/:id/attachment_upload','file','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download'];(function(_0x4adc05,_0x185bea){var _0x2aa66f=function(_0x49da90){while(--_0x49da90){_0x4adc05['push'](_0x4adc05['shift']());}};_0x2aa66f(++_0x185bea);}(_0xa0df,0x19f));var _0xfa0d=function(_0x4dd00f,_0x5daf71){_0x4dd00f=_0x4dd00f-0x0;var _0x1e51c1=_0xa0df[_0x4dd00f];return _0x1e51c1;};'use strict';var multer=require(_0xfa0d('0x0'));var util=require(_0xfa0d('0x1'));var path=require(_0xfa0d('0x2'));var timeout=require(_0xfa0d('0x3'));var express=require(_0xfa0d('0x4'));var router=express[_0xfa0d('0x5')]();var auth=require(_0xfa0d('0x6'));var interaction=require(_0xfa0d('0x7'));var config=require('../../config/environment');var controller=require(_0xfa0d('0x8'));router[_0xfa0d('0x9')]('/',auth[_0xfa0d('0xa')](),controller[_0xfa0d('0xb')]);router[_0xfa0d('0x9')](_0xfa0d('0xc'),auth[_0xfa0d('0xa')](),controller['describe']);router[_0xfa0d('0x9')](_0xfa0d('0xd'),auth[_0xfa0d('0xe')](),controller[_0xfa0d('0xf')]);router[_0xfa0d('0x9')](_0xfa0d('0x10'),auth[_0xfa0d('0xe')](),controller['attachmentDownload']);router[_0xfa0d('0x9')](_0xfa0d('0x11'),auth[_0xfa0d('0xa')](),controller[_0xfa0d('0x12')]);router[_0xfa0d('0x9')](_0xfa0d('0x13'),auth['isChatInteractionAuthorized'](),controller[_0xfa0d('0x14')]);router[_0xfa0d('0x9')](_0xfa0d('0x15'),auth[_0xfa0d('0xa')](),controller[_0xfa0d('0x16')]);router[_0xfa0d('0x17')]('/',auth[_0xfa0d('0xa')](),controller[_0xfa0d('0x18')]);router[_0xfa0d('0x17')](_0xfa0d('0x19'),auth['isAuthenticated'](),controller[_0xfa0d('0x1a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2a8b74,_0x3b2133,_0x58d0f2){_0x58d0f2(null,path[_0xfa0d('0x1b')](config[_0xfa0d('0x1c')],_0xfa0d('0x1d')));},'filename':function(_0x431a7c,_0x44ce36,_0x5f5298){_0x5f5298(null,util['format'](_0xfa0d('0x1e'),Date[_0xfa0d('0x1f')](),_0x44ce36[_0xfa0d('0x20')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xfa0d('0x17')](_0xfa0d('0x21'),upload['single'](_0xfa0d('0x22')),controller['attachmentUpload']);router[_0xfa0d('0x17')](_0xfa0d('0x11'),auth[_0xfa0d('0xe')](),controller[_0xfa0d('0x23')]);router[_0xfa0d('0x17')]('/:id/tags',auth[_0xfa0d('0xa')](),interaction[_0xfa0d('0x24')](_0xfa0d('0x25'),_0xfa0d('0x26')),controller[_0xfa0d('0x27')]);router[_0xfa0d('0x28')](_0xfa0d('0xd'),auth['isAuthenticated'](),interaction[_0xfa0d('0x24')](_0xfa0d('0x25'),_0xfa0d('0x29')),controller[_0xfa0d('0x2a')]);router[_0xfa0d('0x28')](_0xfa0d('0x2b'),controller['customUpdate']);router[_0xfa0d('0x28')](_0xfa0d('0x2c'),auth[_0xfa0d('0xe')](),controller[_0xfa0d('0x2d')]);router[_0xfa0d('0x28')](_0xfa0d('0x2e'),controller[_0xfa0d('0x2f')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0xfa0d('0x24')](_0xfa0d('0x25'),_0xfa0d('0x30')),controller[_0xfa0d('0x31')]);router[_0xfa0d('0x32')](_0xfa0d('0x33'),auth['isAuthenticated'](),controller[_0xfa0d('0x34')]);module[_0xfa0d('0x35')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index d0a7586..d47b122 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 _0x0295=['sequelize','medium'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0295,0x1f0));var _0x5029=function(_0x165cc3,_0x1b2d7d){_0x165cc3=_0x165cc3-0x0;var _0x2d5eea=_0x0295[_0x165cc3];return _0x2d5eea;};'use strict';var Sequelize=require(_0x5029('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x5029('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1a85=['BOOLEAN','TEXT','medium'];(function(_0x29df9a,_0x42aff3){var _0x3a8e96=function(_0x70fbe7){while(--_0x70fbe7){_0x29df9a['push'](_0x29df9a['shift']());}};_0x3a8e96(++_0x42aff3);}(_0x1a85,0x178));var _0x51a8=function(_0xcf807,_0x4c736b){_0xcf807=_0xcf807-0x0;var _0x2ef9e9=_0x1a85[_0xcf807];return _0x2ef9e9;};'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 diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 9e36add..93d8959 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 _0x9c8b=['request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','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','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','map','type','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','ChatInternalMessage','includeAll','include','rows','show','params','rawAttributes','fields','options','find','catch','update','body','describe','get','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','agent','admin','role','userpic','internal','online','lastLoginAt','showWebBar','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','html-pdf','rimraf','zip-dir','fast-json-patch'];(function(_0x44cd73,_0x7aa481){var _0x122583=function(_0x115093){while(--_0x115093){_0x44cd73['push'](_0x44cd73['shift']());}};_0x122583(++_0x7aa481);}(_0x9c8b,0x1bc));var _0xb9c8=function(_0x4fb19f,_0x1d997c){_0x4fb19f=_0x4fb19f-0x0;var _0x55a3ad=_0x9c8b[_0x4fb19f];return _0x55a3ad;};'use strict';var pdf=require(_0xb9c8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb9c8('0x1'));var zipdir=require(_0xb9c8('0x2'));var jsonpatch=require(_0xb9c8('0x3'));var rp=require(_0xb9c8('0x4'));var moment=require(_0xb9c8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb9c8('0x6'));var util=require(_0xb9c8('0x7'));var path=require(_0xb9c8('0x8'));var sox=require(_0xb9c8('0x9'));var csv=require('to-csv');var ejs=require(_0xb9c8('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb9c8('0xb'));var crypto=require(_0xb9c8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb9c8('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb9c8('0xe'));var Papa=require(_0xb9c8('0xf'));var Redis=require(_0xb9c8('0x10'));var authService=require(_0xb9c8('0x11'));var qs=require(_0xb9c8('0x12'));var as=require(_0xb9c8('0x13'));var hardwareService=require(_0xb9c8('0x14'));var logger=require(_0xb9c8('0x15'))('api');var utils=require(_0xb9c8('0x16'));var config=require(_0xb9c8('0x17'));var licenseUtil=require(_0xb9c8('0x18'));var db=require(_0xb9c8('0x19'))['db'];config['redis']=_[_0xb9c8('0x1a')](config[_0xb9c8('0x1b')],{'host':_0xb9c8('0x1c'),'port':0x18eb});var socket=require(_0xb9c8('0x1d'))(new Redis(config[_0xb9c8('0x1b')]));require(_0xb9c8('0x1e'))['register'](socket);function respondWithStatusCode(_0x3ab36e,_0x35a5bc){_0x35a5bc=_0x35a5bc||0xcc;return function(_0x4202ee){if(_0x4202ee){return _0x3ab36e[_0xb9c8('0x1f')](_0x35a5bc);}return _0x3ab36e[_0xb9c8('0x20')](_0x35a5bc)[_0xb9c8('0x21')]();};}function respondWithResult(_0x513b38,_0x3eb3ae){_0x3eb3ae=_0x3eb3ae||0xc8;return function(_0x1202df){if(_0x1202df){return _0x513b38[_0xb9c8('0x20')](_0x3eb3ae)['json'](_0x1202df);}};}function respondWithFilteredResult(_0x18dfc1,_0x552723){return function(_0x3ea254){if(_0x3ea254){var _0x398646=_0x3ea254[_0xb9c8('0x22')],_0x500db9=_0x552723[_0xb9c8('0x23')],_0x1048f2=_0x552723[_0xb9c8('0x23')]+_0x552723[_0xb9c8('0x24')],_0x8f97fd;if(_0x1048f2>=_0x398646){_0x1048f2=_0x398646;_0x8f97fd=0xc8;}else{_0x8f97fd=0xce;}_0x18dfc1[_0xb9c8('0x20')](_0x8f97fd);return _0x18dfc1[_0xb9c8('0x25')](_0xb9c8('0x26'),_0x500db9+'-'+_0x1048f2+'/'+_0x398646)[_0xb9c8('0x27')](_0x3ea254);}return null;};}function patchUpdates(_0x250ed6){return function(_0x242ab2){try{jsonpatch['apply'](_0x242ab2,_0x250ed6,!![]);}catch(_0x221f65){return BPromise[_0xb9c8('0x28')](_0x221f65);}return _0x242ab2[_0xb9c8('0x29')]();};}function saveUpdates(_0x524b22,_0x2daf63){return function(_0x1fc5bd){if(_0x1fc5bd){return _0x1fc5bd['update'](_0x524b22)[_0xb9c8('0x2a')](function(_0x2c6450){return _0x2c6450;});}return null;};}function removeEntity(_0x3b6dab,_0x87b7c6){return function(_0x5f374f){if(_0x5f374f){return _0x5f374f[_0xb9c8('0x2b')]()[_0xb9c8('0x2a')](function(){_0x3b6dab[_0xb9c8('0x20')](0xcc)[_0xb9c8('0x21')]();});}};}function handleEntityNotFound(_0x2e947a,_0x2e7e0f){return function(_0x416e07){if(!_0x416e07){_0x2e947a[_0xb9c8('0x1f')](0x194);}return _0x416e07;};}function handleError(_0x2aafc6,_0x2d1f2d){_0x2d1f2d=_0x2d1f2d||0x1f4;return function(_0x1a38c7){logger[_0xb9c8('0x2c')](_0x1a38c7[_0xb9c8('0x2d')]);if(_0x1a38c7[_0xb9c8('0x2e')]){delete _0x1a38c7['name'];}_0x2aafc6[_0xb9c8('0x20')](_0x2d1f2d)[_0xb9c8('0x2f')](_0x1a38c7);};}exports[_0xb9c8('0x30')]=function(_0x419439,_0x38b2d9){var _0x5b2275={},_0x5b36af={},_0x583933={'count':0x0,'rows':[]};var _0x1cc32a=_[_0xb9c8('0x31')](db['ChatInternalMessage']['rawAttributes'],function(_0x4c3c55){return{'name':_0x4c3c55['fieldName'],'type':_0x4c3c55[_0xb9c8('0x32')]['key']};});_0x5b36af[_0xb9c8('0x33')]=_['map'](_0x1cc32a,_0xb9c8('0x2e'));_0x5b36af[_0xb9c8('0x34')]=_[_0xb9c8('0x35')](_0x419439[_0xb9c8('0x34')]);_0x5b36af[_0xb9c8('0x36')]=_[_0xb9c8('0x37')](_0x5b36af['model'],_0x5b36af['query']);_0x5b2275['attributes']=_[_0xb9c8('0x37')](_0x5b36af[_0xb9c8('0x33')],qs['fields'](_0x419439[_0xb9c8('0x34')]['fields']));_0x5b2275[_0xb9c8('0x38')]=_0x5b2275[_0xb9c8('0x38')][_0xb9c8('0x39')]?_0x5b2275['attributes']:_0x5b36af[_0xb9c8('0x33')];if(!_0x419439[_0xb9c8('0x34')]['hasOwnProperty'](_0xb9c8('0x3a'))){_0x5b2275['limit']=qs[_0xb9c8('0x24')](_0x419439[_0xb9c8('0x34')][_0xb9c8('0x24')]);_0x5b2275[_0xb9c8('0x23')]=qs['offset'](_0x419439['query'][_0xb9c8('0x23')]);}_0x5b2275[_0xb9c8('0x3b')]=qs[_0xb9c8('0x3c')](_0x419439[_0xb9c8('0x34')][_0xb9c8('0x3c')]);_0x5b2275[_0xb9c8('0x3d')]=qs[_0xb9c8('0x36')](_['pick'](_0x419439['query'],_0x5b36af['filters']),_0x1cc32a);if(_0x419439[_0xb9c8('0x34')][_0xb9c8('0x3e')]){_0x5b2275[_0xb9c8('0x3d')]=_[_0xb9c8('0x3f')](_0x5b2275[_0xb9c8('0x3d')],{'$or':_[_0xb9c8('0x31')](_0x1cc32a,function(_0x194a8d){if(_0x194a8d[_0xb9c8('0x32')]!==_0xb9c8('0x40')){var _0x2fab0a={};_0x2fab0a[_0x194a8d['name']]={'$like':'%'+_0x419439[_0xb9c8('0x34')][_0xb9c8('0x3e')]+'%'};return _0x2fab0a;}})});}_0x5b2275=_[_0xb9c8('0x3f')]({},_0x5b2275,_0x419439['options']);var _0x163c4d={'where':_0x5b2275['where']};return db[_0xb9c8('0x41')][_0xb9c8('0x22')](_0x163c4d)[_0xb9c8('0x2a')](function(_0x58093e){_0x583933[_0xb9c8('0x22')]=_0x58093e;if(_0x419439[_0xb9c8('0x34')][_0xb9c8('0x42')]){_0x5b2275[_0xb9c8('0x43')]=[{'all':!![]}];}return db[_0xb9c8('0x41')]['findAll'](_0x5b2275);})[_0xb9c8('0x2a')](function(_0x7c7c85){_0x583933[_0xb9c8('0x44')]=_0x7c7c85;return _0x583933;})['then'](respondWithFilteredResult(_0x38b2d9,_0x5b2275))['catch'](handleError(_0x38b2d9,null));};exports[_0xb9c8('0x45')]=function(_0x565a71,_0x1542a1){var _0x253c9c={'raw':!![],'where':{'id':_0x565a71[_0xb9c8('0x46')]['id']}},_0x4fd3f8={};_0x4fd3f8[_0xb9c8('0x33')]=_['keys'](db[_0xb9c8('0x41')][_0xb9c8('0x47')]);_0x4fd3f8[_0xb9c8('0x34')]=_['keys'](_0x565a71['query']);_0x4fd3f8['filters']=_['intersection'](_0x4fd3f8['model'],_0x4fd3f8[_0xb9c8('0x34')]);_0x253c9c[_0xb9c8('0x38')]=_['intersection'](_0x4fd3f8[_0xb9c8('0x33')],qs['fields'](_0x565a71[_0xb9c8('0x34')][_0xb9c8('0x48')]));_0x253c9c[_0xb9c8('0x38')]=_0x253c9c[_0xb9c8('0x38')][_0xb9c8('0x39')]?_0x253c9c[_0xb9c8('0x38')]:_0x4fd3f8[_0xb9c8('0x33')];if(_0x565a71[_0xb9c8('0x34')][_0xb9c8('0x42')]){_0x253c9c[_0xb9c8('0x43')]=[{'all':!![]}];}_0x253c9c=_['merge']({},_0x253c9c,_0x565a71[_0xb9c8('0x49')]);return db['ChatInternalMessage'][_0xb9c8('0x4a')](_0x253c9c)[_0xb9c8('0x2a')](handleEntityNotFound(_0x1542a1,null))[_0xb9c8('0x2a')](respondWithResult(_0x1542a1,null))[_0xb9c8('0x4b')](handleError(_0x1542a1,null));};exports['create']=function(_0xcdd75d,_0x5d9366){return db['ChatInternalMessage']['create'](_0xcdd75d['body'],{})[_0xb9c8('0x2a')](respondWithResult(_0x5d9366,0xc9))[_0xb9c8('0x4b')](handleError(_0x5d9366,null));};exports[_0xb9c8('0x4c')]=function(_0x3b45db,_0x7007b0){if(_0x3b45db[_0xb9c8('0x4d')]['id']){delete _0x3b45db[_0xb9c8('0x4d')]['id'];}return db[_0xb9c8('0x41')]['find']({'where':{'id':_0x3b45db['params']['id']}})['then'](handleEntityNotFound(_0x7007b0,null))['then'](saveUpdates(_0x3b45db['body'],null))[_0xb9c8('0x2a')](respondWithResult(_0x7007b0,null))[_0xb9c8('0x4b')](handleError(_0x7007b0,null));};exports[_0xb9c8('0x2b')]=function(_0x38439e,_0x33750a){return db['ChatInternalMessage']['find']({'where':{'id':_0x38439e[_0xb9c8('0x46')]['id']}})[_0xb9c8('0x2a')](handleEntityNotFound(_0x33750a,null))[_0xb9c8('0x2a')](removeEntity(_0x33750a,null))[_0xb9c8('0x4b')](handleError(_0x33750a,null));};exports[_0xb9c8('0x4e')]=function(_0x4ac633,_0x3c7997){return db[_0xb9c8('0x41')][_0xb9c8('0x4e')]()[_0xb9c8('0x2a')](respondWithResult(_0x3c7997,null))[_0xb9c8('0x4b')](handleError(_0x3c7997,null));};function wrapUser(_0x2dd9d2){return function(_0x48cbe3){var _0x219c3d=_0x2dd9d2[_0xb9c8('0x4f')]({'plain':!![]});_0x219c3d[_0xb9c8('0x50')]=[];if(_0x48cbe3){_0x219c3d['lastMessageAt']=_0x48cbe3[_0xb9c8('0x51')];_0x219c3d[_0xb9c8('0x52')]=_0x48cbe3;}else{_0x219c3d[_0xb9c8('0x53')]=moment(0x0)[_0xb9c8('0x54')](_0xb9c8('0x55'));_0x219c3d['lastMessage']={};}return _0x219c3d;};}exports[_0xb9c8('0x56')]=function(_0x12ce1e,_0x1e5b28,_0x29b1b5){var _0x2642cd=[];return db[_0xb9c8('0x57')][_0xb9c8('0x58')]({'where':{'role':[_0xb9c8('0x59'),_0xb9c8('0x5a'),'user']},'attributes':['id','fullname','name',_0xb9c8('0x5b'),_0xb9c8('0x5c'),_0xb9c8('0x5d'),_0xb9c8('0x5e'),_0xb9c8('0x5f'),'allowmessenger',_0xb9c8('0x60')],'order':qs['sort']('-online'),'include':[{'model':db[_0xb9c8('0x61')],'as':_0xb9c8('0x62'),'attributes':['id',_0xb9c8('0x2e'),_0xb9c8('0x32')],'through':{'attributes':[]}}]})['then'](function(_0x3b28d9){if(_0x3b28d9){var _0x562a5b=_0x12ce1e[_0xb9c8('0x63')][_0xb9c8('0x4f')]({'plain':!![]});if(!_0x562a5b)throw new Error(_0xb9c8('0x64'));if(_0x562a5b['role']==='user'){return db['UserProfileSection'][_0xb9c8('0x4a')]({'where':{'name':'Agents','userProfileId':_0x562a5b[_0xb9c8('0x65')]},'raw':!![]})['then'](function(_0x5f5869){if(_0x5f5869){if(_0x5f5869[_0xb9c8('0x66')]===0x0){return db[_0xb9c8('0x67')][_0xb9c8('0x58')]({'where':{'sectionId':_0x5f5869['id']},'raw':!![]})['then'](function(_0x1dc489){var _0x18cd00=[];if(_[_0xb9c8('0x68')](_0x1dc489)){_0x18cd00=_[_0xb9c8('0x3e')](_0x3b28d9,function(_0x48c4ba){if(_0x48c4ba[_0xb9c8('0x5b')]!=='agent'){return _0x48c4ba;}});return _0x18cd00;}else{for(var _0x4ea61c=0x0;_0x4ea61c<_0x3b28d9[_0xb9c8('0x39')];_0x4ea61c++){var _0x1c08a0=_0x3b28d9[_0x4ea61c];if(_0x1c08a0[_0xb9c8('0x5b')]===_0xb9c8('0x59')){var _0x3077d4=_[_0xb9c8('0x4a')](_0x1dc489,function(_0x583408){return _0x583408[_0xb9c8('0x69')]===_0x1c08a0['id'];});if(_0x3077d4)_0x18cd00[_0xb9c8('0x6a')](_0x1c08a0);}else{_0x18cd00[_0xb9c8('0x6a')](_0x1c08a0);}}return _0x18cd00;}});}else{return _0x3b28d9;}}else{var _0x4d7d29=_[_0xb9c8('0x3e')](_0x3b28d9,function(_0x341c0e){if(_0x341c0e['role']!==_0xb9c8('0x59')){return _0x341c0e;}});return _0x4d7d29;}});}else{return _0x3b28d9;}}})[_0xb9c8('0x2a')](function(_0x3b3b0e){var _0x4c9e6a=[];if(_0x3b3b0e){_0x2642cd=_0x3b3b0e;for(var _0x46cd5b=0x0;_0x46cd5b<_0x3b3b0e[_0xb9c8('0x39')];_0x46cd5b+=0x1){_0x2642cd[_0x46cd5b][_0xb9c8('0x50')]=[];_0x4c9e6a[_0xb9c8('0x6a')](db['ChatInternalMessage'][_0xb9c8('0x4a')]({'where':{'FromId':[_0x12ce1e[_0xb9c8('0x63')]['id'],_0x3b3b0e[_0x46cd5b]['id']],'ToId':[_0x12ce1e[_0xb9c8('0x63')]['id'],_0x3b3b0e[_0x46cd5b]['id']],'ChatGroupId':null},'attributes':['id',_0xb9c8('0x51'),_0xb9c8('0x6b'),_0xb9c8('0x6c'),_0xb9c8('0x6d'),_0xb9c8('0x4d')],'order':qs[_0xb9c8('0x3c')](_0xb9c8('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xb9c8('0x2a')](wrapUser(_0x3b3b0e[_0x46cd5b])));}return BPromise[_0xb9c8('0x6f')](_0x4c9e6a);}return[];})[_0xb9c8('0x2a')](function(_0x46690a){return{'rows':_0x46690a,'count':_0x46690a[_0xb9c8('0x39')]};})[_0xb9c8('0x2a')](respondWithResult(_0x1e5b28,null))[_0xb9c8('0x4b')](handleError(_0x1e5b28,null));}; \ No newline at end of file +var _0xa8d5=['map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','options','ChatInternalMessage','count','includeAll','include','rows','catch','show','create','find','describe','get','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','findAll','agent','user','fullname','role','userpic','internal','online','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','resourceId','push','FromId','ToId','read','-createdAt','all','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','Content-Range','reject','update','then','destroy','error','name','send','rawAttributes','model'];(function(_0x5815bb,_0x45f4bd){var _0x37605e=function(_0x2ba016){while(--_0x2ba016){_0x5815bb['push'](_0x5815bb['shift']());}};_0x37605e(++_0x45f4bd);}(_0xa8d5,0x112));var _0x5a8d=function(_0x4eff02,_0x1da79d){_0x4eff02=_0x4eff02-0x0;var _0x501909=_0xa8d5[_0x4eff02];return _0x501909;};'use strict';var pdf=require(_0x5a8d('0x0'));var emlformat=require(_0x5a8d('0x1'));var rimraf=require(_0x5a8d('0x2'));var zipdir=require(_0x5a8d('0x3'));var jsonpatch=require(_0x5a8d('0x4'));var rp=require(_0x5a8d('0x5'));var moment=require(_0x5a8d('0x6'));var BPromise=require(_0x5a8d('0x7'));var Mustache=require(_0x5a8d('0x8'));var util=require('util');var path=require(_0x5a8d('0x9'));var sox=require(_0x5a8d('0xa'));var csv=require(_0x5a8d('0xb'));var ejs=require(_0x5a8d('0xc'));var fs=require('fs');var _=require(_0x5a8d('0xd'));var squel=require(_0x5a8d('0xe'));var crypto=require('crypto');var jsforce=require(_0x5a8d('0xf'));var deskjs=require(_0x5a8d('0x10'));var toCsv=require(_0x5a8d('0xb'));var querystring=require(_0x5a8d('0x11'));var Papa=require('papaparse');var Redis=require(_0x5a8d('0x12'));var authService=require(_0x5a8d('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a8d('0x14'));var logger=require(_0x5a8d('0x15'))(_0x5a8d('0x16'));var utils=require('../../config/utils');var config=require(_0x5a8d('0x17'));var licenseUtil=require(_0x5a8d('0x18'));var db=require(_0x5a8d('0x19'))['db'];config[_0x5a8d('0x1a')]=_[_0x5a8d('0x1b')](config[_0x5a8d('0x1a')],{'host':_0x5a8d('0x1c'),'port':0x18eb});var socket=require(_0x5a8d('0x1d'))(new Redis(config[_0x5a8d('0x1a')]));require('./chatInternalMessage.socket')[_0x5a8d('0x1e')](socket);function respondWithStatusCode(_0x1e736c,_0x2be572){_0x2be572=_0x2be572||0xcc;return function(_0x122bc2){if(_0x122bc2){return _0x1e736c[_0x5a8d('0x1f')](_0x2be572);}return _0x1e736c[_0x5a8d('0x20')](_0x2be572)[_0x5a8d('0x21')]();};}function respondWithResult(_0x523c1b,_0x4fb84d){_0x4fb84d=_0x4fb84d||0xc8;return function(_0x3788a0){if(_0x3788a0){return _0x523c1b[_0x5a8d('0x20')](_0x4fb84d)[_0x5a8d('0x22')](_0x3788a0);}};}function respondWithFilteredResult(_0x47ce2a,_0x3750f8){return function(_0x56f733){if(_0x56f733){var _0x135be0=_0x56f733['count'],_0x5be3fa=_0x3750f8[_0x5a8d('0x23')],_0x543fc5=_0x3750f8['offset']+_0x3750f8[_0x5a8d('0x24')],_0x1ea40c;if(_0x543fc5>=_0x135be0){_0x543fc5=_0x135be0;_0x1ea40c=0xc8;}else{_0x1ea40c=0xce;}_0x47ce2a['status'](_0x1ea40c);return _0x47ce2a['set'](_0x5a8d('0x25'),_0x5be3fa+'-'+_0x543fc5+'/'+_0x135be0)[_0x5a8d('0x22')](_0x56f733);}return null;};}function patchUpdates(_0x55820f){return function(_0x338c63){try{jsonpatch['apply'](_0x338c63,_0x55820f,!![]);}catch(_0xcf7a4c){return BPromise[_0x5a8d('0x26')](_0xcf7a4c);}return _0x338c63['save']();};}function saveUpdates(_0x51c673,_0x43db0c){return function(_0x3521f6){if(_0x3521f6){return _0x3521f6[_0x5a8d('0x27')](_0x51c673)[_0x5a8d('0x28')](function(_0x239039){return _0x239039;});}return null;};}function removeEntity(_0x1c4963,_0x5f474a){return function(_0x79997a){if(_0x79997a){return _0x79997a[_0x5a8d('0x29')]()[_0x5a8d('0x28')](function(){_0x1c4963[_0x5a8d('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1831c2,_0x447793){return function(_0x8ad66f){if(!_0x8ad66f){_0x1831c2[_0x5a8d('0x1f')](0x194);}return _0x8ad66f;};}function handleError(_0x5805b9,_0x5176fd){_0x5176fd=_0x5176fd||0x1f4;return function(_0x4c87db){logger[_0x5a8d('0x2a')](_0x4c87db['stack']);if(_0x4c87db['name']){delete _0x4c87db[_0x5a8d('0x2b')];}_0x5805b9['status'](_0x5176fd)[_0x5a8d('0x2c')](_0x4c87db);};}exports['index']=function(_0x2aa0d4,_0x47240e){var _0x24d55b={},_0x8a7ca3={},_0x513fc8={'count':0x0,'rows':[]};var _0x5e1132=_['map'](db['ChatInternalMessage'][_0x5a8d('0x2d')],function(_0x358e85){return{'name':_0x358e85['fieldName'],'type':_0x358e85['type']['key']};});_0x8a7ca3[_0x5a8d('0x2e')]=_[_0x5a8d('0x2f')](_0x5e1132,'name');_0x8a7ca3['query']=_[_0x5a8d('0x30')](_0x2aa0d4[_0x5a8d('0x31')]);_0x8a7ca3['filters']=_[_0x5a8d('0x32')](_0x8a7ca3[_0x5a8d('0x2e')],_0x8a7ca3[_0x5a8d('0x31')]);_0x24d55b[_0x5a8d('0x33')]=_[_0x5a8d('0x32')](_0x8a7ca3[_0x5a8d('0x2e')],qs[_0x5a8d('0x34')](_0x2aa0d4[_0x5a8d('0x31')][_0x5a8d('0x34')]));_0x24d55b[_0x5a8d('0x33')]=_0x24d55b[_0x5a8d('0x33')][_0x5a8d('0x35')]?_0x24d55b[_0x5a8d('0x33')]:_0x8a7ca3[_0x5a8d('0x2e')];if(!_0x2aa0d4[_0x5a8d('0x31')][_0x5a8d('0x36')](_0x5a8d('0x37'))){_0x24d55b[_0x5a8d('0x24')]=qs[_0x5a8d('0x24')](_0x2aa0d4[_0x5a8d('0x31')]['limit']);_0x24d55b[_0x5a8d('0x23')]=qs['offset'](_0x2aa0d4[_0x5a8d('0x31')][_0x5a8d('0x23')]);}_0x24d55b[_0x5a8d('0x38')]=qs[_0x5a8d('0x39')](_0x2aa0d4[_0x5a8d('0x31')][_0x5a8d('0x39')]);_0x24d55b['where']=qs[_0x5a8d('0x3a')](_[_0x5a8d('0x3b')](_0x2aa0d4[_0x5a8d('0x31')],_0x8a7ca3[_0x5a8d('0x3a')]),_0x5e1132);if(_0x2aa0d4[_0x5a8d('0x31')]['filter']){_0x24d55b[_0x5a8d('0x3c')]=_[_0x5a8d('0x3d')](_0x24d55b[_0x5a8d('0x3c')],{'$or':_[_0x5a8d('0x2f')](_0x5e1132,function(_0x538ba){if(_0x538ba[_0x5a8d('0x3e')]!==_0x5a8d('0x3f')){var _0x23f768={};_0x23f768[_0x538ba['name']]={'$like':'%'+_0x2aa0d4[_0x5a8d('0x31')][_0x5a8d('0x40')]+'%'};return _0x23f768;}})});}_0x24d55b=_[_0x5a8d('0x3d')]({},_0x24d55b,_0x2aa0d4[_0x5a8d('0x41')]);var _0x26f5b1={'where':_0x24d55b[_0x5a8d('0x3c')]};return db[_0x5a8d('0x42')][_0x5a8d('0x43')](_0x26f5b1)['then'](function(_0x46778b){_0x513fc8[_0x5a8d('0x43')]=_0x46778b;if(_0x2aa0d4[_0x5a8d('0x31')][_0x5a8d('0x44')]){_0x24d55b[_0x5a8d('0x45')]=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x24d55b);})['then'](function(_0x1a8b05){_0x513fc8[_0x5a8d('0x46')]=_0x1a8b05;return _0x513fc8;})[_0x5a8d('0x28')](respondWithFilteredResult(_0x47240e,_0x24d55b))[_0x5a8d('0x47')](handleError(_0x47240e,null));};exports[_0x5a8d('0x48')]=function(_0x60be01,_0x4aa390){var _0x47c886={'raw':!![],'where':{'id':_0x60be01['params']['id']}},_0x41b558={};_0x41b558[_0x5a8d('0x2e')]=_[_0x5a8d('0x30')](db['ChatInternalMessage'][_0x5a8d('0x2d')]);_0x41b558[_0x5a8d('0x31')]=_[_0x5a8d('0x30')](_0x60be01[_0x5a8d('0x31')]);_0x41b558[_0x5a8d('0x3a')]=_[_0x5a8d('0x32')](_0x41b558[_0x5a8d('0x2e')],_0x41b558[_0x5a8d('0x31')]);_0x47c886[_0x5a8d('0x33')]=_[_0x5a8d('0x32')](_0x41b558[_0x5a8d('0x2e')],qs['fields'](_0x60be01[_0x5a8d('0x31')][_0x5a8d('0x34')]));_0x47c886['attributes']=_0x47c886['attributes'][_0x5a8d('0x35')]?_0x47c886['attributes']:_0x41b558['model'];if(_0x60be01[_0x5a8d('0x31')][_0x5a8d('0x44')]){_0x47c886[_0x5a8d('0x45')]=[{'all':!![]}];}_0x47c886=_['merge']({},_0x47c886,_0x60be01[_0x5a8d('0x41')]);return db[_0x5a8d('0x42')]['find'](_0x47c886)[_0x5a8d('0x28')](handleEntityNotFound(_0x4aa390,null))[_0x5a8d('0x28')](respondWithResult(_0x4aa390,null))[_0x5a8d('0x47')](handleError(_0x4aa390,null));};exports[_0x5a8d('0x49')]=function(_0x3da1f1,_0x31408d){return db['ChatInternalMessage'][_0x5a8d('0x49')](_0x3da1f1['body'],{})['then'](respondWithResult(_0x31408d,0xc9))[_0x5a8d('0x47')](handleError(_0x31408d,null));};exports[_0x5a8d('0x27')]=function(_0x5ab015,_0x4388de){if(_0x5ab015['body']['id']){delete _0x5ab015['body']['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x5ab015['params']['id']}})[_0x5a8d('0x28')](handleEntityNotFound(_0x4388de,null))[_0x5a8d('0x28')](saveUpdates(_0x5ab015['body'],null))[_0x5a8d('0x28')](respondWithResult(_0x4388de,null))[_0x5a8d('0x47')](handleError(_0x4388de,null));};exports[_0x5a8d('0x29')]=function(_0x4262c4,_0x1f0d4a){return db[_0x5a8d('0x42')][_0x5a8d('0x4a')]({'where':{'id':_0x4262c4['params']['id']}})[_0x5a8d('0x28')](handleEntityNotFound(_0x1f0d4a,null))['then'](removeEntity(_0x1f0d4a,null))[_0x5a8d('0x47')](handleError(_0x1f0d4a,null));};exports[_0x5a8d('0x4b')]=function(_0x1b4922,_0xf0bf94){return db['ChatInternalMessage'][_0x5a8d('0x4b')]()[_0x5a8d('0x28')](respondWithResult(_0xf0bf94,null))[_0x5a8d('0x47')](handleError(_0xf0bf94,null));};function wrapUser(_0x48d02c){return function(_0x309442){var _0x1296a7=_0x48d02c[_0x5a8d('0x4c')]({'plain':!![]});_0x1296a7[_0x5a8d('0x4d')]=[];if(_0x309442){_0x1296a7[_0x5a8d('0x4e')]=_0x309442[_0x5a8d('0x4f')];_0x1296a7['lastMessage']=_0x309442;}else{_0x1296a7[_0x5a8d('0x4e')]=moment(0x0)[_0x5a8d('0x50')](_0x5a8d('0x51'));_0x1296a7[_0x5a8d('0x52')]={};}return _0x1296a7;};}exports[_0x5a8d('0x53')]=function(_0x256c10,_0x4cc475,_0x4f57c2){var _0xd03782=[];return db[_0x5a8d('0x54')][_0x5a8d('0x55')]({'where':{'role':[_0x5a8d('0x56'),'admin',_0x5a8d('0x57')]},'attributes':['id',_0x5a8d('0x58'),'name',_0x5a8d('0x59'),_0x5a8d('0x5a'),_0x5a8d('0x5b'),_0x5a8d('0x5c'),'lastLoginAt','allowmessenger','showWebBar'],'order':qs[_0x5a8d('0x39')](_0x5a8d('0x5d')),'include':[{'model':db[_0x5a8d('0x5e')],'as':_0x5a8d('0x5f'),'attributes':['id',_0x5a8d('0x2b'),_0x5a8d('0x3e')],'through':{'attributes':[]}}]})[_0x5a8d('0x28')](function(_0x5b89af){if(_0x5b89af){var _0x5718cb=_0x256c10[_0x5a8d('0x57')][_0x5a8d('0x4c')]({'plain':!![]});if(!_0x5718cb)throw new Error(_0x5a8d('0x60'));if(_0x5718cb[_0x5a8d('0x59')]===_0x5a8d('0x57')){return db['UserProfileSection'][_0x5a8d('0x4a')]({'where':{'name':_0x5a8d('0x61'),'userProfileId':_0x5718cb[_0x5a8d('0x62')]},'raw':!![]})[_0x5a8d('0x28')](function(_0x6a08cb){if(_0x6a08cb){if(_0x6a08cb[_0x5a8d('0x63')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x6a08cb['id']},'raw':!![]})[_0x5a8d('0x28')](function(_0x571e70){var _0x129f78=[];if(_['isEmpty'](_0x571e70)){_0x129f78=_[_0x5a8d('0x40')](_0x5b89af,function(_0x5976a7){if(_0x5976a7[_0x5a8d('0x59')]!==_0x5a8d('0x56')){return _0x5976a7;}});return _0x129f78;}else{for(var _0x43233a=0x0;_0x43233a<_0x5b89af[_0x5a8d('0x35')];_0x43233a++){var _0x1bfe9f=_0x5b89af[_0x43233a];if(_0x1bfe9f[_0x5a8d('0x59')]===_0x5a8d('0x56')){var _0x1cd529=_[_0x5a8d('0x4a')](_0x571e70,function(_0x4328ab){return _0x4328ab[_0x5a8d('0x64')]===_0x1bfe9f['id'];});if(_0x1cd529)_0x129f78[_0x5a8d('0x65')](_0x1bfe9f);}else{_0x129f78[_0x5a8d('0x65')](_0x1bfe9f);}}return _0x129f78;}});}else{return _0x5b89af;}}else{var _0x580537=_['filter'](_0x5b89af,function(_0x3f3d88){if(_0x3f3d88[_0x5a8d('0x59')]!==_0x5a8d('0x56')){return _0x3f3d88;}});return _0x580537;}});}else{return _0x5b89af;}}})[_0x5a8d('0x28')](function(_0x474904){var _0x4be31d=[];if(_0x474904){_0xd03782=_0x474904;for(var _0x446e82=0x0;_0x446e82<_0x474904['length'];_0x446e82+=0x1){_0xd03782[_0x446e82][_0x5a8d('0x4d')]=[];_0x4be31d['push'](db[_0x5a8d('0x42')][_0x5a8d('0x4a')]({'where':{'FromId':[_0x256c10[_0x5a8d('0x57')]['id'],_0x474904[_0x446e82]['id']],'ToId':[_0x256c10[_0x5a8d('0x57')]['id'],_0x474904[_0x446e82]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x5a8d('0x66'),_0x5a8d('0x67'),_0x5a8d('0x68'),'body'],'order':qs['sort'](_0x5a8d('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x5a8d('0x28')](wrapUser(_0x474904[_0x446e82])));}return BPromise[_0x5a8d('0x6a')](_0x4be31d);}return[];})[_0x5a8d('0x28')](function(_0x1ac61d){return{'rows':_0x1ac61d,'count':_0x1ac61d[_0x5a8d('0x35')]};})[_0x5a8d('0x28')](respondWithResult(_0x4cc475,null))['catch'](handleError(_0x4cc475,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 42a0643..c5b5513 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 _0x8b04=['events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x8b04,0x130));var _0x48b0=function(_0x44b74f,_0x3ce55e){_0x44b74f=_0x44b74f-0x0;var _0x552b22=_0x8b04[_0x44b74f];return _0x552b22;};'use strict';var EventEmitter=require(_0x48b0('0x0'));var ChatInternalMessage=require(_0x48b0('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x48b0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x48b0('0x3'),'afterDestroy':_0x48b0('0x4')};function emitEvent(_0xc0b19b){return function(_0x468c90,_0x423a40,_0x1f1bb2){ChatInternalMessageEvents[_0x48b0('0x5')](_0xc0b19b+':'+_0x468c90['id'],_0x468c90);ChatInternalMessageEvents[_0x48b0('0x5')](_0xc0b19b,_0x468c90);_0x1f1bb2(null);};}for(var e in events){if(events[_0x48b0('0x6')](e)){var event=events[e];ChatInternalMessage[_0x48b0('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x78d8=['setMaxListeners','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatInternalMessage'];(function(_0x319fc1,_0x29179b){var _0xb768af=function(_0x3509ac){while(--_0x3509ac){_0x319fc1['push'](_0x319fc1['shift']());}};_0xb768af(++_0x29179b);}(_0x78d8,0x15c));var _0x878d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x78d8[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x878d('0x0'))['db'][_0x878d('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x878d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x49a28f){return function(_0x45ee75,_0x1d2022,_0x217e08){ChatInternalMessageEvents[_0x878d('0x3')](_0x49a28f+':'+_0x45ee75['id'],_0x45ee75);ChatInternalMessageEvents[_0x878d('0x3')](_0x49a28f,_0x45ee75);_0x217e08(null);};}for(var e in events){if(events[_0x878d('0x4')](e)){var event=events[e];ChatInternalMessage[_0x878d('0x5')](e,emitEvent(event));}}module[_0x878d('0x6')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index aad07bb..34046be 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 _0xd8b0=['define','chat_internal_messages','utf8mb4','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x359468,_0x3532a0){var _0x255420=function(_0x5a1fc9){while(--_0x5a1fc9){_0x359468['push'](_0x359468['shift']());}};_0x255420(++_0x3532a0);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatInternalMessage',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0d8b('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbaf0=['define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0xf90bb2,_0x3a0681){var _0x115506=function(_0x28af0c){while(--_0x28af0c){_0xf90bb2['push'](_0xf90bb2['shift']());}};_0x115506(++_0x3a0681);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0baf('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index cfa8ccc..b01c61d 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 _0x1a61=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x15ca63,_0x204506){var _0x25678f=function(_0x780500){while(--_0x780500){_0x15ca63['push'](_0x15ca63['shift']());}};_0x25678f(++_0x204506);}(_0x1a61,0xca));var _0x11a6=function(_0x49a536,_0x9b6f8c){_0x49a536=_0x49a536-0x0;var _0x49b4c6=_0x1a61[_0x49a536];return _0x49b4c6;};'use strict';var _=require('lodash');var util=require(_0x11a6('0x0'));var moment=require('moment');var BPromise=require(_0x11a6('0x1'));var rs=require(_0x11a6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x11a6('0x3'));var logger=require(_0x11a6('0x4'))(_0x11a6('0x5'));var config=require(_0x11a6('0x6'));var jayson=require(_0x11a6('0x7'));var client=jayson[_0x11a6('0x8')][_0x11a6('0x9')]({'port':0x232a});config[_0x11a6('0xa')]=_[_0x11a6('0xb')](config[_0x11a6('0xa')],{'host':_0x11a6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x11a6('0xa')]));require(_0x11a6('0xd'))['register'](socket);function respondWithRpcPromise(_0x28fed4,_0x1338b5,_0x50a928){return new BPromise(function(_0xa8c414,_0xdf1076){return client[_0x11a6('0xe')](_0x28fed4,_0x50a928)[_0x11a6('0xf')](function(_0x1f0d49){logger[_0x11a6('0x10')](_0x11a6('0x11'),_0x1338b5,_0x11a6('0x12'));logger[_0x11a6('0x13')](_0x11a6('0x14'),_0x1338b5,_0x11a6('0x12'),JSON[_0x11a6('0x15')](_0x1f0d49));if(_0x1f0d49[_0x11a6('0x16')]){if(_0x1f0d49[_0x11a6('0x16')][_0x11a6('0x17')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x1338b5,_0x1f0d49['error'][_0x11a6('0x18')]);return _0xdf1076(_0x1f0d49['error']['message']);}logger[_0x11a6('0x16')](_0x11a6('0x11'),_0x1338b5,_0x1f0d49[_0x11a6('0x16')][_0x11a6('0x18')]);return _0xa8c414(_0x1f0d49[_0x11a6('0x16')][_0x11a6('0x18')]);}else{logger[_0x11a6('0x10')](_0x11a6('0x11'),_0x1338b5,_0x11a6('0x12'));_0xa8c414(_0x1f0d49[_0x11a6('0x19')][_0x11a6('0x18')]);}})['catch'](function(_0x3f63d4){logger[_0x11a6('0x16')](_0x11a6('0x11'),_0x1338b5,_0x3f63d4);_0xdf1076(_0x3f63d4);});});} \ No newline at end of file +var _0xda8c=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x8d20cd,_0x14458b){var _0x1d30d4=function(_0x72a016){while(--_0x72a016){_0x8d20cd['push'](_0x8d20cd['shift']());}};_0x1d30d4(++_0x14458b);}(_0xda8c,0x10b));var _0xcda8=function(_0x322160,_0x59ac1a){_0x322160=_0x322160-0x0;var _0x2bcfca=_0xda8c[_0x322160];return _0x2bcfca;};'use strict';var _=require(_0xcda8('0x0'));var util=require('util');var moment=require(_0xcda8('0x1'));var BPromise=require(_0xcda8('0x2'));var rs=require(_0xcda8('0x3'));var fs=require('fs');var Redis=require(_0xcda8('0x4'));var db=require(_0xcda8('0x5'))['db'];var utils=require(_0xcda8('0x6'));var logger=require(_0xcda8('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcda8('0x8'));var client=jayson['client'][_0xcda8('0x9')]({'port':0x232a});config[_0xcda8('0xa')]=_[_0xcda8('0xb')](config[_0xcda8('0xa')],{'host':_0xcda8('0xc'),'port':0x18eb});var socket=require(_0xcda8('0xd'))(new Redis(config['redis']));require(_0xcda8('0xe'))[_0xcda8('0xf')](socket);function respondWithRpcPromise(_0x2d2078,_0x47d3f2,_0x2616c5){return new BPromise(function(_0x2f64a5,_0x3c4582){return client[_0xcda8('0x10')](_0x2d2078,_0x2616c5)[_0xcda8('0x11')](function(_0x4e8a83){logger[_0xcda8('0x12')](_0xcda8('0x13'),_0x47d3f2,'request\x20sent');logger[_0xcda8('0x14')](_0xcda8('0x15'),_0x47d3f2,_0xcda8('0x16'),JSON[_0xcda8('0x17')](_0x4e8a83));if(_0x4e8a83['error']){if(_0x4e8a83[_0xcda8('0x18')][_0xcda8('0x19')]===0x1f4){logger[_0xcda8('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x47d3f2,_0x4e8a83[_0xcda8('0x18')][_0xcda8('0x1a')]);return _0x3c4582(_0x4e8a83[_0xcda8('0x18')][_0xcda8('0x1a')]);}logger[_0xcda8('0x18')](_0xcda8('0x13'),_0x47d3f2,_0x4e8a83[_0xcda8('0x18')]['message']);return _0x2f64a5(_0x4e8a83[_0xcda8('0x18')][_0xcda8('0x1a')]);}else{logger['info'](_0xcda8('0x13'),_0x47d3f2,_0xcda8('0x16'));_0x2f64a5(_0x4e8a83[_0xcda8('0x1b')][_0xcda8('0x1a')]);}})[_0xcda8('0x1c')](function(_0x469347){logger[_0xcda8('0x18')](_0xcda8('0x13'),_0x47d3f2,_0x469347);_0x3c4582(_0x469347);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index e0e476f..0ce1a9b 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 _0xa2ab=['save','remove','emit','removeListener','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x2343ef,_0x4ca540){var _0x308fea=function(_0x5e8663){while(--_0x5e8663){_0x2343ef['push'](_0x2343ef['shift']());}};_0x308fea(++_0x4ca540);}(_0xa2ab,0xa7));var _0xba2a=function(_0x44f9c0,_0x391085){_0x44f9c0=_0x44f9c0-0x0;var _0x241aa7=_0xa2ab[_0x44f9c0];return _0x241aa7;};'use strict';var ChatInternalMessageEvents=require(_0xba2a('0x0'));var events=[_0xba2a('0x1'),_0xba2a('0x2'),'update'];function createListener(_0x297229,_0x385aac){return function(_0x3c1bf2){_0x385aac[_0xba2a('0x3')](_0x297229,_0x3c1bf2);};}function removeListener(_0x24423b,_0x1b27f8){return function(){ChatInternalMessageEvents[_0xba2a('0x4')](_0x24423b,_0x1b27f8);};}exports['register']=function(_0x12f994){for(var _0x42e864=0x0,_0x3eb9f9=events['length'];_0x42e864<_0x3eb9f9;_0x42e864++){var _0xd09a60=events[_0x42e864];var _0xf818d1=createListener(_0xba2a('0x5')+_0xd09a60,_0x12f994);ChatInternalMessageEvents['on'](_0xd09a60,_0xf818d1);}}; \ No newline at end of file +var _0x0f69=['chatInternalMessage:','remove','emit','removeListener','length'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x0f69,0x173));var _0x90f6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0f69[_0xfae23b];return _0x200640;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0x90f6('0x0'),'update'];function createListener(_0x3716f4,_0xac4ba6){return function(_0x4a1481){_0xac4ba6[_0x90f6('0x1')](_0x3716f4,_0x4a1481);};}function removeListener(_0x86022b,_0x4adecb){return function(){ChatInternalMessageEvents[_0x90f6('0x2')](_0x86022b,_0x4adecb);};}exports['register']=function(_0x1840a5){for(var _0x3dfd95=0x0,_0x45657d=events[_0x90f6('0x3')];_0x3dfd95<_0x45657d;_0x3dfd95++){var _0x3bc2eb=events[_0x3dfd95];var _0x42044f=createListener(_0x90f6('0x4')+_0x3bc2eb,_0x1840a5);ChatInternalMessageEvents['on'](_0x3bc2eb,_0x42044f);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 28e0127..6eff17b 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(_0x418913,_0x405155){var _0x486897=function(_0xc72d07){while(--_0xc72d07){_0x418913['push'](_0x418913['shift']());}};_0x486897(++_0x405155);}(_0xb7e7,0x121));var _0x7b7e=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xb7e7[_0x342700];return _0x53406f;};'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(_0x28b8ef,_0x10c343){var _0x56b3d9=function(_0x29db37){while(--_0x29db37){_0x28b8ef['push'](_0x28b8ef['shift']());}};_0x56b3d9(++_0x10c343);}(_0xb7e7,0x121));var _0x7b7e=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xb7e7[_0x55abd9];return _0x3e5669;};'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 844bab1..d3b7c11 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 _0xe5bf=['DATE','STRING','TEXT','medium','BOOLEAN','out'];(function(_0x37a6bc,_0x399f61){var _0x1f0ba8=function(_0xcc5bd3){while(--_0xcc5bd3){_0x37a6bc['push'](_0x37a6bc['shift']());}};_0x1f0ba8(++_0x399f61);}(_0xe5bf,0x1a6));var _0xfe5b=function(_0x2a44b6,_0x4cd7c6){_0x2a44b6=_0x2a44b6-0x0;var _0x117625=_0xe5bf[_0x2a44b6];return _0x117625;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xfe5b('0x0')](_0xfe5b('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xfe5b('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xfe5b('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xfe5b('0x4')]},'providerName':{'type':Sequelize[_0xfe5b('0x5')]},'providerResponse':{'type':Sequelize[_0xfe5b('0x0')]}}; \ No newline at end of file +var _0xa146=['BOOLEAN','ENUM','out','STRING','exports','medium'];(function(_0x12f44c,_0x505031){var _0x2ed0a2=function(_0x68f210){while(--_0x68f210){_0x12f44c['push'](_0x12f44c['shift']());}};_0x2ed0a2(++_0x505031);}(_0xa146,0x19c));var _0x6a14=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xa146[_0x5f1391];return _0x50ebe3;};'use strict';var Sequelize=require('sequelize');module[_0x6a14('0x0')]={'body':{'type':Sequelize['TEXT'](_0x6a14('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x6a14('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x6a14('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6a14('0x3')]('in',_0x6a14('0x4')),'defaultValue':_0x6a14('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x6a14('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 3548e9b..6176353 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 _0x71e2=['count','includeAll','include','rows','show','params','keys','rawAttributes','body','find','describe','chat-interactions','accept','chat','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','ChatInteractionId','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','manual','channel','event','EventManager','formData','agent','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','redis','./chatMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','offset','limit','Content-Range','apply','reject','save','update','destroy','end','stack','index','map','ChatMessage','key','name','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options'];(function(_0x2c9ede,_0x4ca8c5){var _0x1a8110=function(_0xaa7cc4){while(--_0xaa7cc4){_0x2c9ede['push'](_0x2c9ede['shift']());}};_0x1a8110(++_0x4ca8c5);}(_0x71e2,0x99));var _0x271e=function(_0x53d72e,_0x2f3280){_0x53d72e=_0x53d72e-0x0;var _0x23786a=_0x71e2[_0x53d72e];return _0x23786a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x271e('0x0'));var rimraf=require(_0x271e('0x1'));var zipdir=require(_0x271e('0x2'));var jsonpatch=require(_0x271e('0x3'));var rp=require('request-promise');var moment=require(_0x271e('0x4'));var BPromise=require(_0x271e('0x5'));var Mustache=require(_0x271e('0x6'));var util=require('util');var path=require('path');var sox=require(_0x271e('0x7'));var csv=require('to-csv');var ejs=require(_0x271e('0x8'));var fs=require('fs');var _=require(_0x271e('0x9'));var squel=require(_0x271e('0xa'));var crypto=require(_0x271e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x271e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x271e('0xd'));var Papa=require(_0x271e('0xe'));var Redis=require(_0x271e('0xf'));var authService=require(_0x271e('0x10'));var qs=require(_0x271e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x271e('0x12'));var logger=require(_0x271e('0x13'))('api');var utils=require(_0x271e('0x14'));var config=require(_0x271e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x271e('0x16'))['db'];config['redis']=_[_0x271e('0x17')](config['redis'],{'host':_0x271e('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x271e('0x19')]));require(_0x271e('0x1a'))[_0x271e('0x1b')](socket);var jayson=require(_0x271e('0x1c'));var client=jayson[_0x271e('0x1d')][_0x271e('0x1e')]({'port':0x232c});var client9002=jayson[_0x271e('0x1d')][_0x271e('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x130301,_0xcc969c,_0x46a083,_0x43edfb){return new BPromise(function(_0x346583,_0x310e42){var _0x56d965=_0x43edfb||client;return _0x56d965[_0x271e('0x1f')](_0x130301,_0x46a083)[_0x271e('0x20')](function(_0x598e9f){logger['info']('ChatMessage,\x20%s,\x20%s',_0xcc969c,_0x271e('0x21'));logger['debug'](_0x271e('0x22'),_0xcc969c,_0x271e('0x21'),JSON[_0x271e('0x23')](_0x598e9f));if(_0x598e9f[_0x271e('0x24')]){if(_0x598e9f['error'][_0x271e('0x25')]===0x1f4){logger[_0x271e('0x24')](_0x271e('0x26'),_0xcc969c,_0x598e9f[_0x271e('0x24')]['message']);return _0x310e42(_0x598e9f[_0x271e('0x24')]['message']);}logger['error']('ChatMessage,\x20%s,\x20%s',_0xcc969c,_0x598e9f['error'][_0x271e('0x27')]);return _0x346583(_0x598e9f['error'][_0x271e('0x27')]);}else{logger[_0x271e('0x28')](_0x271e('0x26'),_0xcc969c,_0x271e('0x21'));_0x346583(_0x598e9f[_0x271e('0x29')][_0x271e('0x27')]);}})[_0x271e('0x2a')](function(_0xb30011){logger[_0x271e('0x24')](_0x271e('0x26'),_0xcc969c,_0xb30011);_0x310e42(_0xb30011);});});}function respondWithStatusCode(_0x8c880a,_0x3fb8de){_0x3fb8de=_0x3fb8de||0xcc;return function(_0x30e47b){if(_0x30e47b){return _0x8c880a[_0x271e('0x2b')](_0x3fb8de);}return _0x8c880a['status'](_0x3fb8de)['end']();};}function respondWithResult(_0x489aa1,_0x2fafb9){_0x2fafb9=_0x2fafb9||0xc8;return function(_0x2d1217){if(_0x2d1217){return _0x489aa1[_0x271e('0x2c')](_0x2fafb9)['json'](_0x2d1217);}};}function respondWithFilteredResult(_0x3abdc4,_0x1b1c40){return function(_0x3ed2c0){if(_0x3ed2c0){var _0x3c6363=_0x3ed2c0['count'],_0x1dd6f0=_0x1b1c40[_0x271e('0x2d')],_0x37da51=_0x1b1c40['offset']+_0x1b1c40[_0x271e('0x2e')],_0x2cf272;if(_0x37da51>=_0x3c6363){_0x37da51=_0x3c6363;_0x2cf272=0xc8;}else{_0x2cf272=0xce;}_0x3abdc4[_0x271e('0x2c')](_0x2cf272);return _0x3abdc4['set'](_0x271e('0x2f'),_0x1dd6f0+'-'+_0x37da51+'/'+_0x3c6363)['json'](_0x3ed2c0);}return null;};}function patchUpdates(_0x3752ec){return function(_0x3e62f7){try{jsonpatch[_0x271e('0x30')](_0x3e62f7,_0x3752ec,!![]);}catch(_0x5964f6){return BPromise[_0x271e('0x31')](_0x5964f6);}return _0x3e62f7[_0x271e('0x32')]();};}function saveUpdates(_0xbedef0,_0x44f644){return function(_0x206083){if(_0x206083){return _0x206083[_0x271e('0x33')](_0xbedef0)[_0x271e('0x20')](function(_0x2b0707){return _0x2b0707;});}return null;};}function removeEntity(_0x176b89,_0x206a88){return function(_0x4867bc){if(_0x4867bc){return _0x4867bc[_0x271e('0x34')]()[_0x271e('0x20')](function(){_0x176b89[_0x271e('0x2c')](0xcc)[_0x271e('0x35')]();});}};}function handleEntityNotFound(_0x2dbc0e,_0x27aace){return function(_0x1624f6){if(!_0x1624f6){_0x2dbc0e['sendStatus'](0x194);}return _0x1624f6;};}function handleError(_0x5cd180,_0x452d57){_0x452d57=_0x452d57||0x1f4;return function(_0x122f0b){logger['error'](_0x122f0b[_0x271e('0x36')]);if(_0x122f0b['name']){delete _0x122f0b['name'];}_0x5cd180[_0x271e('0x2c')](_0x452d57)['send'](_0x122f0b);};}exports[_0x271e('0x37')]=function(_0x90b54b,_0x38fffd){var _0x5d08ee={},_0x11aa1e={},_0x57ba4e={'count':0x0,'rows':[]};var _0x424336=_[_0x271e('0x38')](db[_0x271e('0x39')]['rawAttributes'],function(_0x328dd7){return{'name':_0x328dd7['fieldName'],'type':_0x328dd7['type'][_0x271e('0x3a')]};});_0x11aa1e['model']=_[_0x271e('0x38')](_0x424336,_0x271e('0x3b'));_0x11aa1e[_0x271e('0x3c')]=_['keys'](_0x90b54b[_0x271e('0x3c')]);_0x11aa1e[_0x271e('0x3d')]=_[_0x271e('0x3e')](_0x11aa1e[_0x271e('0x3f')],_0x11aa1e['query']);_0x5d08ee['attributes']=_[_0x271e('0x3e')](_0x11aa1e['model'],qs[_0x271e('0x40')](_0x90b54b[_0x271e('0x3c')][_0x271e('0x40')]));_0x5d08ee['attributes']=_0x5d08ee[_0x271e('0x41')][_0x271e('0x42')]?_0x5d08ee['attributes']:_0x11aa1e[_0x271e('0x3f')];if(!_0x90b54b[_0x271e('0x3c')][_0x271e('0x43')](_0x271e('0x44'))){_0x5d08ee[_0x271e('0x2e')]=qs[_0x271e('0x2e')](_0x90b54b[_0x271e('0x3c')]['limit']);_0x5d08ee[_0x271e('0x2d')]=qs['offset'](_0x90b54b[_0x271e('0x3c')]['offset']);}_0x5d08ee[_0x271e('0x45')]=qs[_0x271e('0x46')](_0x90b54b[_0x271e('0x3c')]['sort']);_0x5d08ee[_0x271e('0x47')]=qs[_0x271e('0x3d')](_[_0x271e('0x48')](_0x90b54b[_0x271e('0x3c')],_0x11aa1e[_0x271e('0x3d')]),_0x424336);if(_0x90b54b['query'][_0x271e('0x49')]){_0x5d08ee[_0x271e('0x47')]=_[_0x271e('0x4a')](_0x5d08ee['where'],{'$or':_['map'](_0x424336,function(_0x2f3975){if(_0x2f3975[_0x271e('0x4b')]!=='VIRTUAL'){var _0x270c07={};_0x270c07[_0x2f3975['name']]={'$like':'%'+_0x90b54b[_0x271e('0x3c')][_0x271e('0x49')]+'%'};return _0x270c07;}})});}_0x5d08ee=_[_0x271e('0x4a')]({},_0x5d08ee,_0x90b54b[_0x271e('0x4c')]);var _0x575075={'where':_0x5d08ee[_0x271e('0x47')]};return db[_0x271e('0x39')][_0x271e('0x4d')](_0x575075)['then'](function(_0x54a366){_0x57ba4e['count']=_0x54a366;if(_0x90b54b[_0x271e('0x3c')][_0x271e('0x4e')]){_0x5d08ee[_0x271e('0x4f')]=[{'all':!![]}];}return db[_0x271e('0x39')]['findAll'](_0x5d08ee);})['then'](function(_0x1ffdeb){_0x57ba4e[_0x271e('0x50')]=_0x1ffdeb;return _0x57ba4e;})[_0x271e('0x20')](respondWithFilteredResult(_0x38fffd,_0x5d08ee))['catch'](handleError(_0x38fffd,null));};exports[_0x271e('0x51')]=function(_0x1fda38,_0x359763){var _0x31d47a={'raw':!![],'where':{'id':_0x1fda38[_0x271e('0x52')]['id']}},_0x4f259a={};_0x4f259a[_0x271e('0x3f')]=_[_0x271e('0x53')](db[_0x271e('0x39')][_0x271e('0x54')]);_0x4f259a[_0x271e('0x3c')]=_[_0x271e('0x53')](_0x1fda38[_0x271e('0x3c')]);_0x4f259a[_0x271e('0x3d')]=_[_0x271e('0x3e')](_0x4f259a[_0x271e('0x3f')],_0x4f259a[_0x271e('0x3c')]);_0x31d47a[_0x271e('0x41')]=_['intersection'](_0x4f259a[_0x271e('0x3f')],qs['fields'](_0x1fda38[_0x271e('0x3c')]['fields']));_0x31d47a[_0x271e('0x41')]=_0x31d47a[_0x271e('0x41')][_0x271e('0x42')]?_0x31d47a[_0x271e('0x41')]:_0x4f259a[_0x271e('0x3f')];if(_0x1fda38[_0x271e('0x3c')][_0x271e('0x4e')]){_0x31d47a[_0x271e('0x4f')]=[{'all':!![]}];}_0x31d47a=_[_0x271e('0x4a')]({},_0x31d47a,_0x1fda38[_0x271e('0x4c')]);return db[_0x271e('0x39')]['find'](_0x31d47a)[_0x271e('0x20')](handleEntityNotFound(_0x359763,null))['then'](respondWithResult(_0x359763,null))['catch'](handleError(_0x359763,null));};exports['create']=function(_0x3fbf0b,_0x2a855b){return db[_0x271e('0x39')]['create'](_0x3fbf0b['body'],{})['then'](respondWithResult(_0x2a855b,0xc9))['catch'](handleError(_0x2a855b,null));};exports['update']=function(_0x509444,_0x3d35dc){if(_0x509444[_0x271e('0x55')]['id']){delete _0x509444[_0x271e('0x55')]['id'];}return db['ChatMessage'][_0x271e('0x56')]({'where':{'id':_0x509444[_0x271e('0x52')]['id']}})[_0x271e('0x20')](handleEntityNotFound(_0x3d35dc,null))['then'](saveUpdates(_0x509444[_0x271e('0x55')],null))['then'](respondWithResult(_0x3d35dc,null))[_0x271e('0x2a')](handleError(_0x3d35dc,null));};exports['destroy']=function(_0x276ded,_0x161ae9){return db['ChatMessage'][_0x271e('0x56')]({'where':{'id':_0x276ded[_0x271e('0x52')]['id']}})['then'](handleEntityNotFound(_0x161ae9,null))[_0x271e('0x20')](removeEntity(_0x161ae9,null))['catch'](handleError(_0x161ae9,null));};exports['describe']=function(_0xbe5083,_0x1582d4){return db[_0x271e('0x39')][_0x271e('0x57')]()[_0x271e('0x20')](respondWithResult(_0x1582d4,null))[_0x271e('0x2a')](handleError(_0x1582d4,null));};var interaction_log=require('../../config/logger')(_0x271e('0x58'));exports[_0x271e('0x59')]=function(_0x431ba2,_0x443b49,_0x191401){var _0x1af47c={'agent':{},'channel':_0x271e('0x5a')};if(_0x431ba2[_0x271e('0x55')]['id']){delete _0x431ba2[_0x271e('0x55')]['id'];}_0x431ba2['body']['read']=!![];_0x431ba2[_0x271e('0x55')]['readAt']=moment()[_0x271e('0x5b')](_0x271e('0x5c'));_0x431ba2['body']['UserId']=_0x431ba2['body'][_0x271e('0x5d')]||_0x431ba2[_0x271e('0x5e')]['id'];_0x1af47c['agent']['id']=_0x431ba2['body'][_0x271e('0x5d')];return db[_0x271e('0x39')]['find']({'where':{'id':_0x431ba2['params']['id'],'UserId':null},'include':[{'model':db[_0x271e('0x5f')],'as':_0x271e('0x60')}]})[_0x271e('0x20')](handleEntityNotFound(_0x443b49,null))[_0x271e('0x20')](saveUpdates(_0x431ba2[_0x271e('0x55')],null))[_0x271e('0x20')](function(_0x1ac4bf){if(_0x1ac4bf){_0x1af47c[_0x271e('0x27')]=_0x1ac4bf['get']({'plain':!![]});return db['ChatInteraction'][_0x271e('0x56')]({'where':{'id':_0x1ac4bf[_0x271e('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x443b49,null))[_0x271e('0x20')](function(_0x134905){if(_0x134905){return _0x134905['update']({'UserId':_0x431ba2[_0x271e('0x55')][_0x271e('0x5d')],'read1stAt':_['isNil'](_0x134905['read1stAt'])?moment()[_0x271e('0x5b')](_0x271e('0x5c')):undefined});}return null;})[_0x271e('0x20')](function(_0x20aa8f){if(_0x20aa8f){_0x1af47c[_0x271e('0x62')]=_0x20aa8f[_0x271e('0x63')]({'plain':!![]});interaction_log[_0x271e('0x28')](_0x271e('0x64'),_0x431ba2[_0x271e('0x5e')]['id'],_0x431ba2[_0x271e('0x5e')][_0x271e('0x3b')],_0x431ba2[_0x271e('0x5e')][_0x271e('0x65')],_0x1af47c[_0x271e('0x62')]['id'],_0x431ba2['body']?JSON['stringify'](_0x431ba2[_0x271e('0x55')]):_0x271e('0x66'));return respondWithRpcPromise('AcceptMessage',_0x271e('0x67'),_0x1af47c);}return null;})[_0x271e('0x20')](function(_0x56ee2a){if(_0x56ee2a){if(_0x431ba2[_0x271e('0x55')][_0x271e('0x68')]){_0x1af47c[_0x271e('0x27')]['interface']=util['format']('SIP/%s',_0x431ba2[_0x271e('0x5e')]['name']);_0x1af47c[_0x271e('0x27')][_0x271e('0x69')]=_0x1af47c['channel'];_0x1af47c[_0x271e('0x27')][_0x271e('0x6a')]=_0x271e('0x59');return respondWithRpcPromise('EventManager',_0x271e('0x6b'),{'event':'acceptmessage','message':_['merge'](_0x1af47c[_0x271e('0x27')],JSON['parse'](_0x1af47c[_0x271e('0x62')][_0x271e('0x6c')]))},client9002)[_0x271e('0x20')](function(){return _0x1af47c;});}return _0x1af47c;}return null;})[_0x271e('0x20')](respondWithResult(_0x443b49,null))['catch'](handleError(_0x443b49,null));};var interaction_log=require(_0x271e('0x13'))(_0x271e('0x58'));exports[_0x271e('0x31')]=function(_0x11b586,_0x27201e,_0x4377d7){var _0x27734e={'agent':{},'channel':'chat'};if(_0x11b586[_0x271e('0x55')]['id']){delete _0x11b586[_0x271e('0x55')]['id'];}_0x11b586['body'][_0x271e('0x5d')]=_0x11b586[_0x271e('0x55')][_0x271e('0x5d')]||_0x11b586[_0x271e('0x5e')]['id'];_0x27734e[_0x271e('0x6d')]['id']=_0x11b586['body'][_0x271e('0x5d')];return db['ChatMessage']['find']({'where':{'id':_0x11b586['params']['id'],'UserId':null}})[_0x271e('0x20')](handleEntityNotFound(_0x27201e,null))[_0x271e('0x20')](function(_0x31ad11){if(_0x31ad11){_0x27734e[_0x271e('0x27')]=_0x31ad11[_0x271e('0x63')]({'plain':!![]});return db[_0x271e('0x6e')][_0x271e('0x56')]({'where':{'id':_0x31ad11['ChatInteractionId']}});}return null;})[_0x271e('0x20')](handleEntityNotFound(_0x27201e,null))[_0x271e('0x20')](function(_0x5b8c4e){if(_0x5b8c4e){_0x27734e[_0x271e('0x62')]=_0x5b8c4e['get']({'plain':!![]});interaction_log[_0x271e('0x28')](_0x271e('0x6f'),_0x11b586['user']['id'],_0x11b586[_0x271e('0x5e')]['name'],_0x11b586[_0x271e('0x5e')][_0x271e('0x65')],_0x27734e['interaction']['id'],_0x11b586[_0x271e('0x55')]?JSON['stringify'](_0x11b586[_0x271e('0x55')]):'null');return respondWithRpcPromise(_0x271e('0x70'),_0x271e('0x71'),_0x27734e);}return null;})['then'](function(_0x56d427){if(_0x56d427){_0x56d427[_0x271e('0x27')][_0x271e('0x72')]=util['format']('SIP/%s',_0x11b586[_0x271e('0x5e')][_0x271e('0x3b')]);_0x56d427[_0x271e('0x27')][_0x271e('0x69')]=_0x27734e[_0x271e('0x69')];_0x56d427[_0x271e('0x27')][_0x271e('0x6a')]=_0x271e('0x31');respondWithRpcPromise(_0x271e('0x6b'),'EventManager',{'event':'rejectmessage','message':_0x56d427[_0x271e('0x27')]},client9002);return _0x27734e;}return null;})[_0x271e('0x20')](respondWithResult(_0x27201e,null))['catch'](handleError(_0x27201e,null));}; \ No newline at end of file +var _0xefed=['null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','acceptmessage','formData','get','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','EventManager','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','json','offset','limit','Content-Range','apply','reject','update','destroy','end','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','ChatMessage','count','includeAll','include','rows','show','params','options','find','create','body','describe','chat-interactions','accept','chat','readAt','format','UserId','user','agent','CmContact','Contact','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify'];(function(_0x193897,_0x53ea9f){var _0xbc691b=function(_0x411515){while(--_0x411515){_0x193897['push'](_0x193897['shift']());}};_0xbc691b(++_0x53ea9f);}(_0xefed,0x18a));var _0xdefe=function(_0x3452eb,_0x44035e){_0x3452eb=_0x3452eb-0x0;var _0x4244fd=_0xefed[_0x3452eb];return _0x4244fd;};'use strict';var pdf=require(_0xdefe('0x0'));var emlformat=require(_0xdefe('0x1'));var rimraf=require(_0xdefe('0x2'));var zipdir=require(_0xdefe('0x3'));var jsonpatch=require(_0xdefe('0x4'));var rp=require(_0xdefe('0x5'));var moment=require(_0xdefe('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xdefe('0x7'));var util=require('util');var path=require(_0xdefe('0x8'));var sox=require(_0xdefe('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xdefe('0xa'));var squel=require(_0xdefe('0xb'));var crypto=require('crypto');var jsforce=require(_0xdefe('0xc'));var deskjs=require(_0xdefe('0xd'));var toCsv=require(_0xdefe('0xe'));var querystring=require(_0xdefe('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdefe('0x10'));var qs=require(_0xdefe('0x11'));var as=require(_0xdefe('0x12'));var hardwareService=require(_0xdefe('0x13'));var logger=require(_0xdefe('0x14'))(_0xdefe('0x15'));var utils=require(_0xdefe('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdefe('0x17'))['db'];config[_0xdefe('0x18')]=_[_0xdefe('0x19')](config['redis'],{'host':_0xdefe('0x1a'),'port':0x18eb});var socket=require(_0xdefe('0x1b'))(new Redis(config[_0xdefe('0x18')]));require(_0xdefe('0x1c'))[_0xdefe('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xdefe('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb71e0f,_0x5a1751,_0x4c2b88,_0x25cd19){return new BPromise(function(_0x53f872,_0x2570bf){var _0x47d802=_0x25cd19||client;return _0x47d802[_0xdefe('0x1f')](_0xb71e0f,_0x4c2b88)[_0xdefe('0x20')](function(_0x1a9046){logger['info'](_0xdefe('0x21'),_0x5a1751,_0xdefe('0x22'));logger[_0xdefe('0x23')](_0xdefe('0x24'),_0x5a1751,_0xdefe('0x22'),JSON['stringify'](_0x1a9046));if(_0x1a9046[_0xdefe('0x25')]){if(_0x1a9046[_0xdefe('0x25')][_0xdefe('0x26')]===0x1f4){logger[_0xdefe('0x25')](_0xdefe('0x21'),_0x5a1751,_0x1a9046[_0xdefe('0x25')][_0xdefe('0x27')]);return _0x2570bf(_0x1a9046[_0xdefe('0x25')][_0xdefe('0x27')]);}logger[_0xdefe('0x25')](_0xdefe('0x21'),_0x5a1751,_0x1a9046[_0xdefe('0x25')][_0xdefe('0x27')]);return _0x53f872(_0x1a9046['error'][_0xdefe('0x27')]);}else{logger[_0xdefe('0x28')]('ChatMessage,\x20%s,\x20%s',_0x5a1751,_0xdefe('0x22'));_0x53f872(_0x1a9046[_0xdefe('0x29')]['message']);}})[_0xdefe('0x2a')](function(_0x508963){logger[_0xdefe('0x25')](_0xdefe('0x21'),_0x5a1751,_0x508963);_0x2570bf(_0x508963);});});}function respondWithStatusCode(_0x1dc33b,_0x3165d9){_0x3165d9=_0x3165d9||0xcc;return function(_0x1d1517){if(_0x1d1517){return _0x1dc33b['sendStatus'](_0x3165d9);}return _0x1dc33b[_0xdefe('0x2b')](_0x3165d9)['end']();};}function respondWithResult(_0x4358f2,_0x398a77){_0x398a77=_0x398a77||0xc8;return function(_0x4bc4dc){if(_0x4bc4dc){return _0x4358f2['status'](_0x398a77)[_0xdefe('0x2c')](_0x4bc4dc);}};}function respondWithFilteredResult(_0x403dfe,_0x40f4e0){return function(_0x1e7cdc){if(_0x1e7cdc){var _0x30a0c5=_0x1e7cdc['count'],_0x54125b=_0x40f4e0['offset'],_0x2a01ca=_0x40f4e0[_0xdefe('0x2d')]+_0x40f4e0[_0xdefe('0x2e')],_0x20076c;if(_0x2a01ca>=_0x30a0c5){_0x2a01ca=_0x30a0c5;_0x20076c=0xc8;}else{_0x20076c=0xce;}_0x403dfe[_0xdefe('0x2b')](_0x20076c);return _0x403dfe['set'](_0xdefe('0x2f'),_0x54125b+'-'+_0x2a01ca+'/'+_0x30a0c5)[_0xdefe('0x2c')](_0x1e7cdc);}return null;};}function patchUpdates(_0x6c7236){return function(_0x1932f5){try{jsonpatch[_0xdefe('0x30')](_0x1932f5,_0x6c7236,!![]);}catch(_0x1d9704){return BPromise[_0xdefe('0x31')](_0x1d9704);}return _0x1932f5['save']();};}function saveUpdates(_0x5ba4b8,_0x5d15dc){return function(_0x10eed5){if(_0x10eed5){return _0x10eed5[_0xdefe('0x32')](_0x5ba4b8)['then'](function(_0xde9fd6){return _0xde9fd6;});}return null;};}function removeEntity(_0x1cb4b4,_0x1ed941){return function(_0x3d3465){if(_0x3d3465){return _0x3d3465[_0xdefe('0x33')]()[_0xdefe('0x20')](function(){_0x1cb4b4['status'](0xcc)[_0xdefe('0x34')]();});}};}function handleEntityNotFound(_0xc5101c,_0x417ab5){return function(_0x579d46){if(!_0x579d46){_0xc5101c[_0xdefe('0x35')](0x194);}return _0x579d46;};}function handleError(_0x205cfa,_0x48a6e5){_0x48a6e5=_0x48a6e5||0x1f4;return function(_0x11c0ff){logger[_0xdefe('0x25')](_0x11c0ff[_0xdefe('0x36')]);if(_0x11c0ff[_0xdefe('0x37')]){delete _0x11c0ff[_0xdefe('0x37')];}_0x205cfa[_0xdefe('0x2b')](_0x48a6e5)[_0xdefe('0x38')](_0x11c0ff);};}exports[_0xdefe('0x39')]=function(_0xc63a46,_0x265ac5){var _0xe70741={},_0x1c4512={},_0xfee6c7={'count':0x0,'rows':[]};var _0x284bb7=_['map'](db['ChatMessage'][_0xdefe('0x3a')],function(_0x262aaf){return{'name':_0x262aaf[_0xdefe('0x3b')],'type':_0x262aaf[_0xdefe('0x3c')][_0xdefe('0x3d')]};});_0x1c4512[_0xdefe('0x3e')]=_[_0xdefe('0x3f')](_0x284bb7,_0xdefe('0x37'));_0x1c4512[_0xdefe('0x40')]=_[_0xdefe('0x41')](_0xc63a46['query']);_0x1c4512[_0xdefe('0x42')]=_[_0xdefe('0x43')](_0x1c4512[_0xdefe('0x3e')],_0x1c4512[_0xdefe('0x40')]);_0xe70741[_0xdefe('0x44')]=_[_0xdefe('0x43')](_0x1c4512['model'],qs[_0xdefe('0x45')](_0xc63a46[_0xdefe('0x40')][_0xdefe('0x45')]));_0xe70741['attributes']=_0xe70741[_0xdefe('0x44')][_0xdefe('0x46')]?_0xe70741[_0xdefe('0x44')]:_0x1c4512['model'];if(!_0xc63a46[_0xdefe('0x40')][_0xdefe('0x47')]('nolimit')){_0xe70741[_0xdefe('0x2e')]=qs['limit'](_0xc63a46['query']['limit']);_0xe70741[_0xdefe('0x2d')]=qs[_0xdefe('0x2d')](_0xc63a46[_0xdefe('0x40')]['offset']);}_0xe70741[_0xdefe('0x48')]=qs[_0xdefe('0x49')](_0xc63a46[_0xdefe('0x40')][_0xdefe('0x49')]);_0xe70741[_0xdefe('0x4a')]=qs[_0xdefe('0x42')](_[_0xdefe('0x4b')](_0xc63a46['query'],_0x1c4512[_0xdefe('0x42')]),_0x284bb7);if(_0xc63a46[_0xdefe('0x40')][_0xdefe('0x4c')]){_0xe70741['where']=_[_0xdefe('0x4d')](_0xe70741['where'],{'$or':_['map'](_0x284bb7,function(_0x1936d0){if(_0x1936d0[_0xdefe('0x3c')]!==_0xdefe('0x4e')){var _0x105f91={};_0x105f91[_0x1936d0[_0xdefe('0x37')]]={'$like':'%'+_0xc63a46[_0xdefe('0x40')]['filter']+'%'};return _0x105f91;}})});}_0xe70741=_[_0xdefe('0x4d')]({},_0xe70741,_0xc63a46['options']);var _0x21ad3b={'where':_0xe70741['where']};return db[_0xdefe('0x4f')][_0xdefe('0x50')](_0x21ad3b)[_0xdefe('0x20')](function(_0x2b9c60){_0xfee6c7[_0xdefe('0x50')]=_0x2b9c60;if(_0xc63a46[_0xdefe('0x40')][_0xdefe('0x51')]){_0xe70741[_0xdefe('0x52')]=[{'all':!![]}];}return db[_0xdefe('0x4f')]['findAll'](_0xe70741);})[_0xdefe('0x20')](function(_0x13b89c){_0xfee6c7[_0xdefe('0x53')]=_0x13b89c;return _0xfee6c7;})[_0xdefe('0x20')](respondWithFilteredResult(_0x265ac5,_0xe70741))['catch'](handleError(_0x265ac5,null));};exports[_0xdefe('0x54')]=function(_0x18a3f8,_0x676df1){var _0x742362={'raw':!![],'where':{'id':_0x18a3f8[_0xdefe('0x55')]['id']}},_0x24012a={};_0x24012a[_0xdefe('0x3e')]=_[_0xdefe('0x41')](db[_0xdefe('0x4f')][_0xdefe('0x3a')]);_0x24012a['query']=_[_0xdefe('0x41')](_0x18a3f8[_0xdefe('0x40')]);_0x24012a[_0xdefe('0x42')]=_[_0xdefe('0x43')](_0x24012a[_0xdefe('0x3e')],_0x24012a[_0xdefe('0x40')]);_0x742362[_0xdefe('0x44')]=_[_0xdefe('0x43')](_0x24012a[_0xdefe('0x3e')],qs['fields'](_0x18a3f8['query'][_0xdefe('0x45')]));_0x742362['attributes']=_0x742362[_0xdefe('0x44')][_0xdefe('0x46')]?_0x742362[_0xdefe('0x44')]:_0x24012a['model'];if(_0x18a3f8[_0xdefe('0x40')][_0xdefe('0x51')]){_0x742362[_0xdefe('0x52')]=[{'all':!![]}];}_0x742362=_[_0xdefe('0x4d')]({},_0x742362,_0x18a3f8[_0xdefe('0x56')]);return db[_0xdefe('0x4f')][_0xdefe('0x57')](_0x742362)[_0xdefe('0x20')](handleEntityNotFound(_0x676df1,null))['then'](respondWithResult(_0x676df1,null))[_0xdefe('0x2a')](handleError(_0x676df1,null));};exports[_0xdefe('0x58')]=function(_0x410710,_0xa49781){return db[_0xdefe('0x4f')][_0xdefe('0x58')](_0x410710[_0xdefe('0x59')],{})[_0xdefe('0x20')](respondWithResult(_0xa49781,0xc9))[_0xdefe('0x2a')](handleError(_0xa49781,null));};exports['update']=function(_0x50d6af,_0x57b774){if(_0x50d6af['body']['id']){delete _0x50d6af[_0xdefe('0x59')]['id'];}return db[_0xdefe('0x4f')][_0xdefe('0x57')]({'where':{'id':_0x50d6af['params']['id']}})[_0xdefe('0x20')](handleEntityNotFound(_0x57b774,null))[_0xdefe('0x20')](saveUpdates(_0x50d6af[_0xdefe('0x59')],null))[_0xdefe('0x20')](respondWithResult(_0x57b774,null))[_0xdefe('0x2a')](handleError(_0x57b774,null));};exports[_0xdefe('0x33')]=function(_0x4e9c86,_0x40efb4){return db[_0xdefe('0x4f')][_0xdefe('0x57')]({'where':{'id':_0x4e9c86['params']['id']}})[_0xdefe('0x20')](handleEntityNotFound(_0x40efb4,null))['then'](removeEntity(_0x40efb4,null))[_0xdefe('0x2a')](handleError(_0x40efb4,null));};exports[_0xdefe('0x5a')]=function(_0x33d1c3,_0x4321c0){return db[_0xdefe('0x4f')][_0xdefe('0x5a')]()['then'](respondWithResult(_0x4321c0,null))[_0xdefe('0x2a')](handleError(_0x4321c0,null));};var interaction_log=require(_0xdefe('0x14'))(_0xdefe('0x5b'));exports[_0xdefe('0x5c')]=function(_0x12caf5,_0x1fca19,_0x1cb4a0){var _0x4b31a1={'agent':{},'channel':_0xdefe('0x5d')};if(_0x12caf5[_0xdefe('0x59')]['id']){delete _0x12caf5[_0xdefe('0x59')]['id'];}_0x12caf5[_0xdefe('0x59')]['read']=!![];_0x12caf5[_0xdefe('0x59')][_0xdefe('0x5e')]=moment()[_0xdefe('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x12caf5[_0xdefe('0x59')][_0xdefe('0x60')]=_0x12caf5[_0xdefe('0x59')][_0xdefe('0x60')]||_0x12caf5[_0xdefe('0x61')]['id'];_0x4b31a1[_0xdefe('0x62')]['id']=_0x12caf5[_0xdefe('0x59')][_0xdefe('0x60')];return db[_0xdefe('0x4f')][_0xdefe('0x57')]({'where':{'id':_0x12caf5[_0xdefe('0x55')]['id'],'UserId':null},'include':[{'model':db[_0xdefe('0x63')],'as':_0xdefe('0x64')}]})[_0xdefe('0x20')](handleEntityNotFound(_0x1fca19,null))[_0xdefe('0x20')](saveUpdates(_0x12caf5['body'],null))[_0xdefe('0x20')](function(_0x307335){if(_0x307335){_0x4b31a1[_0xdefe('0x27')]=_0x307335['get']({'plain':!![]});return db[_0xdefe('0x65')][_0xdefe('0x57')]({'where':{'id':_0x307335[_0xdefe('0x66')]}});}return null;})[_0xdefe('0x20')](handleEntityNotFound(_0x1fca19,null))[_0xdefe('0x20')](function(_0x169a24){if(_0x169a24){return _0x169a24[_0xdefe('0x32')]({'UserId':_0x12caf5['body'][_0xdefe('0x60')],'read1stAt':_[_0xdefe('0x67')](_0x169a24[_0xdefe('0x68')])?moment()[_0xdefe('0x5f')](_0xdefe('0x69')):undefined});}return null;})['then'](function(_0x497bea){if(_0x497bea){_0x4b31a1[_0xdefe('0x6a')]=_0x497bea['get']({'plain':!![]});interaction_log[_0xdefe('0x28')](_0xdefe('0x6b'),_0x12caf5[_0xdefe('0x61')]['id'],_0x12caf5[_0xdefe('0x61')][_0xdefe('0x37')],_0x12caf5[_0xdefe('0x61')][_0xdefe('0x6c')],_0x4b31a1[_0xdefe('0x6a')]['id'],_0x12caf5[_0xdefe('0x59')]?JSON[_0xdefe('0x6d')](_0x12caf5[_0xdefe('0x59')]):_0xdefe('0x6e'));return respondWithRpcPromise(_0xdefe('0x6f'),_0xdefe('0x70'),_0x4b31a1);}return null;})[_0xdefe('0x20')](function(_0x329523){if(_0x329523){if(_0x12caf5[_0xdefe('0x59')][_0xdefe('0x71')]){_0x4b31a1[_0xdefe('0x27')]['interface']=util[_0xdefe('0x5f')](_0xdefe('0x72'),_0x12caf5['user']['name']);_0x4b31a1[_0xdefe('0x27')][_0xdefe('0x73')]=_0x4b31a1[_0xdefe('0x73')];_0x4b31a1[_0xdefe('0x27')][_0xdefe('0x74')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0xdefe('0x75'),'message':_[_0xdefe('0x4d')](_0x4b31a1[_0xdefe('0x27')],JSON['parse'](_0x4b31a1[_0xdefe('0x6a')][_0xdefe('0x76')]))},client9002)[_0xdefe('0x20')](function(){return _0x4b31a1;});}return _0x4b31a1;}return null;})['then'](respondWithResult(_0x1fca19,null))[_0xdefe('0x2a')](handleError(_0x1fca19,null));};var interaction_log=require(_0xdefe('0x14'))(_0xdefe('0x5b'));exports[_0xdefe('0x31')]=function(_0xed8021,_0x2353dc,_0x17003c){var _0x500f83={'agent':{},'channel':_0xdefe('0x5d')};if(_0xed8021['body']['id']){delete _0xed8021[_0xdefe('0x59')]['id'];}_0xed8021[_0xdefe('0x59')][_0xdefe('0x60')]=_0xed8021[_0xdefe('0x59')][_0xdefe('0x60')]||_0xed8021['user']['id'];_0x500f83[_0xdefe('0x62')]['id']=_0xed8021[_0xdefe('0x59')][_0xdefe('0x60')];return db[_0xdefe('0x4f')][_0xdefe('0x57')]({'where':{'id':_0xed8021[_0xdefe('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2353dc,null))[_0xdefe('0x20')](function(_0x2a2103){if(_0x2a2103){_0x500f83[_0xdefe('0x27')]=_0x2a2103[_0xdefe('0x77')]({'plain':!![]});return db['ChatInteraction'][_0xdefe('0x57')]({'where':{'id':_0x2a2103[_0xdefe('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x2353dc,null))[_0xdefe('0x20')](function(_0x1aa844){if(_0x1aa844){_0x500f83[_0xdefe('0x6a')]=_0x1aa844[_0xdefe('0x77')]({'plain':!![]});interaction_log[_0xdefe('0x28')](_0xdefe('0x78'),_0xed8021[_0xdefe('0x61')]['id'],_0xed8021[_0xdefe('0x61')]['name'],_0xed8021[_0xdefe('0x61')][_0xdefe('0x6c')],_0x500f83[_0xdefe('0x6a')]['id'],_0xed8021[_0xdefe('0x59')]?JSON['stringify'](_0xed8021['body']):'null');return respondWithRpcPromise(_0xdefe('0x79'),_0xdefe('0x7a'),_0x500f83);}return null;})['then'](function(_0x3e290f){if(_0x3e290f){_0x3e290f[_0xdefe('0x27')][_0xdefe('0x7b')]=util[_0xdefe('0x5f')](_0xdefe('0x72'),_0xed8021[_0xdefe('0x61')]['name']);_0x3e290f[_0xdefe('0x27')][_0xdefe('0x73')]=_0x500f83[_0xdefe('0x73')];_0x3e290f['message'][_0xdefe('0x74')]=_0xdefe('0x31');respondWithRpcPromise(_0xdefe('0x7c'),_0xdefe('0x7c'),{'event':_0xdefe('0x7d'),'message':_0x3e290f[_0xdefe('0x27')]},client9002);return _0x500f83;}return null;})[_0xdefe('0x20')](respondWithResult(_0x2353dc,null))['catch'](handleError(_0x2353dc,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index b0a6cc6..981328c 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 _0x6439=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x6439,0xba));var _0x9643=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x6439[_0x2d2c16];return _0x53f2fb;};'use strict';var EventEmitter=require(_0x9643('0x0'));var ChatMessage=require(_0x9643('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x9643('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9643('0x3')};function emitEvent(_0x14f9c8){return function(_0xbdc6e3,_0x17e6c8,_0x4766eb){ChatMessageEvents[_0x9643('0x4')](_0x14f9c8+':'+_0xbdc6e3['id'],_0xbdc6e3);ChatMessageEvents[_0x9643('0x4')](_0x14f9c8,_0xbdc6e3);_0x4766eb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x9643('0x5')](e,emitEvent(event));}}module[_0x9643('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0x2774=['hasOwnProperty','hook','exports','setMaxListeners','save','update','remove','emit'];(function(_0x70459,_0x11f2ff){var _0x4f16b5=function(_0x2a78c1){while(--_0x2a78c1){_0x70459['push'](_0x70459['shift']());}};_0x4f16b5(++_0x11f2ff);}(_0x2774,0x103));var _0x4277=function(_0x3798af,_0x2726ac){_0x3798af=_0x3798af-0x0;var _0x4a3aeb=_0x2774[_0x3798af];return _0x4a3aeb;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x4277('0x0')](0x0);var events={'afterCreate':_0x4277('0x1'),'afterUpdate':_0x4277('0x2'),'afterDestroy':_0x4277('0x3')};function emitEvent(_0x161a70){return function(_0x403ff5,_0x49e9c4,_0x364e0a){ChatMessageEvents[_0x4277('0x4')](_0x161a70+':'+_0x403ff5['id'],_0x403ff5);ChatMessageEvents[_0x4277('0x4')](_0x161a70,_0x403ff5);_0x364e0a(null);};}for(var e in events){if(events[_0x4277('0x5')](e)){var event=events[e];ChatMessage[_0x4277('0x6')](e,emitEvent(event));}}module[_0x4277('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 00d9ccf..18ca79e 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 _0x67a8=['fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x67a8,0x133));var _0x867a=function(_0x22df14,_0x5bd7ea){_0x22df14=_0x22df14-0x0;var _0x52977b=_0x67a8[_0x22df14];return _0x52977b;};'use strict';var _=require(_0x867a('0x0'));var util=require('util');var logger=require(_0x867a('0x1'))(_0x867a('0x2'));var moment=require(_0x867a('0x3'));var BPromise=require(_0x867a('0x4'));var rp=require(_0x867a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x867a('0x6'));var config=require(_0x867a('0x7'));var attributes=require(_0x867a('0x8'));module[_0x867a('0x9')]=function(_0x70f02d,_0x39c976){return _0x70f02d[_0x867a('0xa')](_0x867a('0xb'),attributes,{'tableName':_0x867a('0xc'),'paranoid':![],'indexes':[{'name':_0x867a('0xd'),'fields':[_0x867a('0xe')],'type':_0x867a('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ba57c,_0x3814b6,_0x643db7){var _0x9e3af9=_0x70f02d[_0x867a('0x10')];var _0x390295=_0x4ba57c[_0x867a('0x11')]({'plain':!![]});if(_0x390295[_0x867a('0x12')][_0x867a('0x13')]()==='in'||_0x390295['direction'][_0x867a('0x13')]()===_0x867a('0x14')&&!_0x390295[_0x867a('0x15')]&&!_[_0x867a('0x16')](_0x390295[_0x867a('0x17')])){_0x9e3af9[_0x867a('0x18')][_0x867a('0x19')]({'where':{'id':_0x390295['ChatInteractionId']}})[_0x867a('0x1a')](function(_0x2495a4){if(_0x2495a4){_0x2495a4[_0x867a('0x1b')]({'lastMsgAt':_0x390295[_0x867a('0x1c')],'lastMsgDirection':_0x390295[_0x867a('0x12')][_0x867a('0x13')]()});}})[_0x867a('0x1d')](function(_0x154807){console[_0x867a('0x1e')](_0x154807);});}_0x643db7();}},'charset':'utf8mb4','collate':_0x867a('0x1f')});}; \ No newline at end of file +var _0xb064=['findOne','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','out','secret','UserId'];(function(_0x2a1b33,_0x409f50){var _0x4c50e7=function(_0x13e16d){while(--_0x13e16d){_0x2a1b33['push'](_0x2a1b33['shift']());}};_0x4c50e7(++_0x409f50);}(_0xb064,0x19c));var _0x4b06=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xb064[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x4b06('0x0'));var util=require('util');var logger=require(_0x4b06('0x1'))(_0x4b06('0x2'));var moment=require(_0x4b06('0x3'));var BPromise=require(_0x4b06('0x4'));var rp=require(_0x4b06('0x5'));var fs=require('fs');var path=require(_0x4b06('0x6'));var rimraf=require('rimraf');var config=require(_0x4b06('0x7'));var attributes=require('./chatMessage.attributes');module[_0x4b06('0x8')]=function(_0x2ea5a2,_0x52f463){return _0x2ea5a2[_0x4b06('0x9')]('ChatMessage',attributes,{'tableName':_0x4b06('0xa'),'paranoid':![],'indexes':[{'name':_0x4b06('0xb'),'fields':[_0x4b06('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x24b02f,_0x3ae1c7,_0x12d730){var _0x3f1ce9=_0x2ea5a2[_0x4b06('0xd')];var _0x2849d7=_0x24b02f[_0x4b06('0xe')]({'plain':!![]});if(_0x2849d7[_0x4b06('0xf')][_0x4b06('0x10')]()==='in'||_0x2849d7[_0x4b06('0xf')][_0x4b06('0x10')]()===_0x4b06('0x11')&&!_0x2849d7[_0x4b06('0x12')]&&!_['isNil'](_0x2849d7[_0x4b06('0x13')])){_0x3f1ce9['ChatInteraction'][_0x4b06('0x14')]({'where':{'id':_0x2849d7['ChatInteractionId']}})['then'](function(_0x184b26){if(_0x184b26){_0x184b26[_0x4b06('0x15')]({'lastMsgAt':_0x2849d7[_0x4b06('0x16')],'lastMsgDirection':_0x2849d7['direction'][_0x4b06('0x10')]()});}})[_0x4b06('0x17')](function(_0x4f3ecd){console[_0x4b06('0x18')](_0x4f3ecd);});}_0x12d730();}},'charset':_0x4b06('0x19'),'collate':_0x4b06('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 5521950..5ae6331 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 _0x5b3e=['register','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message','result','CreateChatMessage','ChatMessage','create','body','options','raw','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','./chatMessage.socket'];(function(_0xaf2921,_0x4b2f0d){var _0x2a140e=function(_0x412666){while(--_0x412666){_0xaf2921['push'](_0xaf2921['shift']());}};_0x2a140e(++_0x4b2f0d);}(_0x5b3e,0x15e));var _0xe5b3=function(_0x2fa381,_0x235fd5){_0x2fa381=_0x2fa381-0x0;var _0x27438b=_0x5b3e[_0x2fa381];return _0x27438b;};'use strict';var _=require(_0xe5b3('0x0'));var util=require(_0xe5b3('0x1'));var moment=require(_0xe5b3('0x2'));var BPromise=require('bluebird');var rs=require(_0xe5b3('0x3'));var fs=require('fs');var Redis=require(_0xe5b3('0x4'));var db=require(_0xe5b3('0x5'))['db'];var utils=require(_0xe5b3('0x6'));var logger=require(_0xe5b3('0x7'))(_0xe5b3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe5b3('0x9')]({'port':0x232a});config[_0xe5b3('0xa')]=_[_0xe5b3('0xb')](config[_0xe5b3('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe5b3('0xc'))[_0xe5b3('0xd')](socket);function respondWithRpcPromise(_0x2412ef,_0x5d44d8,_0x465eb5){return new BPromise(function(_0x25d531,_0x47f2c5){return client[_0xe5b3('0xe')](_0x2412ef,_0x465eb5)[_0xe5b3('0xf')](function(_0x429954){logger[_0xe5b3('0x10')]('ChatMessage,\x20%s,\x20%s',_0x5d44d8,_0xe5b3('0x11'));logger[_0xe5b3('0x12')](_0xe5b3('0x13'),_0x5d44d8,_0xe5b3('0x11'),JSON['stringify'](_0x429954));if(_0x429954[_0xe5b3('0x14')]){if(_0x429954['error'][_0xe5b3('0x15')]===0x1f4){logger[_0xe5b3('0x14')](_0xe5b3('0x16'),_0x5d44d8,_0x429954['error'][_0xe5b3('0x17')]);return _0x47f2c5(_0x429954['error'][_0xe5b3('0x17')]);}logger[_0xe5b3('0x14')](_0xe5b3('0x16'),_0x5d44d8,_0x429954[_0xe5b3('0x14')][_0xe5b3('0x17')]);return _0x25d531(_0x429954[_0xe5b3('0x14')]['message']);}else{logger[_0xe5b3('0x10')](_0xe5b3('0x16'),_0x5d44d8,_0xe5b3('0x11'));_0x25d531(_0x429954[_0xe5b3('0x18')][_0xe5b3('0x17')]);}})['catch'](function(_0x16eaf7){logger[_0xe5b3('0x14')](_0xe5b3('0x16'),_0x5d44d8,_0x16eaf7);_0x47f2c5(_0x16eaf7);});});}exports[_0xe5b3('0x19')]=function(_0x1084b0){var _0x919454=this;return new Promise(function(_0x1d31b3,_0x5bf16f){return db[_0xe5b3('0x1a')][_0xe5b3('0x1b')](_0x1084b0[_0xe5b3('0x1c')],{'raw':_0x1084b0[_0xe5b3('0x1d')]?_0x1084b0[_0xe5b3('0x1d')][_0xe5b3('0x1e')]===undefined?!![]:![]:!![]})[_0xe5b3('0xf')](function(_0x4cd9d8){logger[_0xe5b3('0x10')](_0xe5b3('0x19'),_0x1084b0);logger[_0xe5b3('0x12')](_0xe5b3('0x19'),_0x1084b0,JSON[_0xe5b3('0x1f')](_0x4cd9d8));_0x1d31b3(_0x4cd9d8);})[_0xe5b3('0x20')](function(_0x205562){logger[_0xe5b3('0x14')]('CreateChatMessage',_0x205562[_0xe5b3('0x17')],_0x1084b0);_0x5bf16f(_0x919454[_0xe5b3('0x14')](0x1f4,_0x205562[_0xe5b3('0x17')]));});});}; \ No newline at end of file +var _0x7f79=['catch','create','body','options','raw','CreateChatMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x212d76,_0x5340dc){var _0x26d573=function(_0x49470a){while(--_0x49470a){_0x212d76['push'](_0x212d76['shift']());}};_0x26d573(++_0x5340dc);}(_0x7f79,0xd8));var _0x97f7=function(_0x5afb65,_0x1dd6a7){_0x5afb65=_0x5afb65-0x0;var _0x5d84e5=_0x7f79[_0x5afb65];return _0x5d84e5;};'use strict';var _=require(_0x97f7('0x0'));var util=require(_0x97f7('0x1'));var moment=require(_0x97f7('0x2'));var BPromise=require(_0x97f7('0x3'));var rs=require(_0x97f7('0x4'));var fs=require('fs');var Redis=require(_0x97f7('0x5'));var db=require(_0x97f7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x97f7('0x7'))(_0x97f7('0x8'));var config=require(_0x97f7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x97f7('0xa')][_0x97f7('0xb')]({'port':0x232a});config[_0x97f7('0xc')]=_[_0x97f7('0xd')](config[_0x97f7('0xc')],{'host':_0x97f7('0xe'),'port':0x18eb});var socket=require(_0x97f7('0xf'))(new Redis(config[_0x97f7('0xc')]));require(_0x97f7('0x10'))['register'](socket);function respondWithRpcPromise(_0x3021d0,_0x235d77,_0x49a873){return new BPromise(function(_0x12afd3,_0x395347){return client[_0x97f7('0x11')](_0x3021d0,_0x49a873)[_0x97f7('0x12')](function(_0x4a2edb){logger[_0x97f7('0x13')](_0x97f7('0x14'),_0x235d77,_0x97f7('0x15'));logger[_0x97f7('0x16')](_0x97f7('0x17'),_0x235d77,_0x97f7('0x15'),JSON[_0x97f7('0x18')](_0x4a2edb));if(_0x4a2edb[_0x97f7('0x19')]){if(_0x4a2edb[_0x97f7('0x19')][_0x97f7('0x1a')]===0x1f4){logger[_0x97f7('0x19')]('ChatMessage,\x20%s,\x20%s',_0x235d77,_0x4a2edb['error'][_0x97f7('0x1b')]);return _0x395347(_0x4a2edb[_0x97f7('0x19')][_0x97f7('0x1b')]);}logger[_0x97f7('0x19')](_0x97f7('0x14'),_0x235d77,_0x4a2edb['error']['message']);return _0x12afd3(_0x4a2edb[_0x97f7('0x19')][_0x97f7('0x1b')]);}else{logger[_0x97f7('0x13')](_0x97f7('0x14'),_0x235d77,_0x97f7('0x15'));_0x12afd3(_0x4a2edb[_0x97f7('0x1c')][_0x97f7('0x1b')]);}})[_0x97f7('0x1d')](function(_0x1b5b6e){logger[_0x97f7('0x19')](_0x97f7('0x14'),_0x235d77,_0x1b5b6e);_0x395347(_0x1b5b6e);});});}exports['CreateChatMessage']=function(_0x4e9d8e){var _0x498129=this;return new Promise(function(_0x5cf588,_0x47a770){return db['ChatMessage'][_0x97f7('0x1e')](_0x4e9d8e[_0x97f7('0x1f')],{'raw':_0x4e9d8e[_0x97f7('0x20')]?_0x4e9d8e[_0x97f7('0x20')][_0x97f7('0x21')]===undefined?!![]:![]:!![]})[_0x97f7('0x12')](function(_0x2fc836){logger[_0x97f7('0x13')](_0x97f7('0x22'),_0x4e9d8e);logger['debug'](_0x97f7('0x22'),_0x4e9d8e,JSON[_0x97f7('0x18')](_0x2fc836));_0x5cf588(_0x2fc836);})[_0x97f7('0x1d')](function(_0x364c5d){logger[_0x97f7('0x19')](_0x97f7('0x22'),_0x364c5d[_0x97f7('0x1b')],_0x4e9d8e);_0x47a770(_0x498129[_0x97f7('0x19')](0x1f4,_0x364c5d['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 12beb74..8c38d3d 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 _0xb016=['register','./chatMessage.events','save','emit'];(function(_0x4d6ac0,_0x201628){var _0x5296c4=function(_0x3d0b3d){while(--_0x3d0b3d){_0x4d6ac0['push'](_0x4d6ac0['shift']());}};_0x5296c4(++_0x201628);}(_0xb016,0x159));var _0x6b01=function(_0x42c376,_0x55517f){_0x42c376=_0x42c376-0x0;var _0x4edc9d=_0xb016[_0x42c376];return _0x4edc9d;};'use strict';var ChatMessageEvents=require(_0x6b01('0x0'));var events=[_0x6b01('0x1'),'remove','update'];function createListener(_0xf74fa1,_0x531b6a){return function(_0x160a7d){_0x531b6a[_0x6b01('0x2')](_0xf74fa1,_0x160a7d);};}function removeListener(_0x161b59,_0x3b9de1){return function(){ChatMessageEvents['removeListener'](_0x161b59,_0x3b9de1);};}exports[_0x6b01('0x3')]=function(_0x65407a){for(var _0x192b2d=0x0,_0x5759a1=events['length'];_0x192b2d<_0x5759a1;_0x192b2d++){var _0x374aab=events[_0x192b2d];var _0x39f9fa=createListener('chatMessage:'+_0x374aab,_0x65407a);ChatMessageEvents['on'](_0x374aab,_0x39f9fa);}}; \ No newline at end of file +var _0x4888=['save','remove','update','emit','removeListener','register'];(function(_0xf3252a,_0x4d7de2){var _0x27d704=function(_0x275f7e){while(--_0x275f7e){_0xf3252a['push'](_0xf3252a['shift']());}};_0x27d704(++_0x4d7de2);}(_0x4888,0x198));var _0x8488=function(_0x4fcabf,_0x3536af){_0x4fcabf=_0x4fcabf-0x0;var _0xe9651=_0x4888[_0x4fcabf];return _0xe9651;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x8488('0x0'),_0x8488('0x1'),_0x8488('0x2')];function createListener(_0x13b2f0,_0x257275){return function(_0xacc8f0){_0x257275[_0x8488('0x3')](_0x13b2f0,_0xacc8f0);};}function removeListener(_0x571e4b,_0x267093){return function(){ChatMessageEvents[_0x8488('0x4')](_0x571e4b,_0x267093);};}exports[_0x8488('0x5')]=function(_0x421292){for(var _0x326887=0x0,_0x19e508=events['length'];_0x326887<_0x19e508;_0x326887++){var _0x5b30a7=events[_0x326887];var _0x56aad0=createListener('chatMessage:'+_0x5b30a7,_0x421292);ChatMessageEvents['on'](_0x5b30a7,_0x56aad0);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index aabb2d6..482fdbb 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 _0xbb88=['express','Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','/describe','/:id','post','tracked','chat','chatmessage:create','create','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','connect-timeout'];(function(_0x403947,_0x3877d9){var _0x2b8e1a=function(_0x2bc7f3){while(--_0x2bc7f3){_0x403947['push'](_0x403947['shift']());}};_0x2b8e1a(++_0x3877d9);}(_0xbb88,0x11e));var _0x8bb8=function(_0x1423b4,_0x28c659){_0x1423b4=_0x1423b4-0x0;var _0x19f0fc=_0xbb88[_0x1423b4];return _0x19f0fc;};'use strict';var multer=require(_0x8bb8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8bb8('0x1'));var express=require(_0x8bb8('0x2'));var router=express[_0x8bb8('0x3')]();var auth=require(_0x8bb8('0x4'));var interaction=require(_0x8bb8('0x5'));var config=require('../../config/environment');var controller=require(_0x8bb8('0x6'));router[_0x8bb8('0x7')]('/',auth[_0x8bb8('0x8')](),controller[_0x8bb8('0x9')]);router[_0x8bb8('0x7')](_0x8bb8('0xa'),auth[_0x8bb8('0x8')](),controller['describe']);router[_0x8bb8('0x7')](_0x8bb8('0xb'),auth[_0x8bb8('0x8')](),controller['show']);router[_0x8bb8('0xc')]('/',auth[_0x8bb8('0x8')](),interaction[_0x8bb8('0xd')](_0x8bb8('0xe'),_0x8bb8('0xf')),controller[_0x8bb8('0x10')]);router[_0x8bb8('0x11')]('/:id',controller['update']);router[_0x8bb8('0x11')](_0x8bb8('0x12'),auth[_0x8bb8('0x8')](),controller['accept']);router[_0x8bb8('0x11')](_0x8bb8('0x13'),auth[_0x8bb8('0x8')](),controller[_0x8bb8('0x14')]);router[_0x8bb8('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x8bb8('0x16')]);module[_0x8bb8('0x17')]=router; \ No newline at end of file +var _0x7077=['post','tracked','chat','chatmessage:create','create','update','put','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x23e9ff,_0x58d71c){var _0x3fb849=function(_0x2c22a8){while(--_0x2c22a8){_0x23e9ff['push'](_0x23e9ff['shift']());}};_0x3fb849(++_0x58d71c);}(_0x7077,0xe3));var _0x7707=function(_0x180f83,_0x49e400){_0x180f83=_0x180f83-0x0;var _0x351cea=_0x7077[_0x180f83];return _0x351cea;};'use strict';var multer=require(_0x7707('0x0'));var util=require(_0x7707('0x1'));var path=require(_0x7707('0x2'));var timeout=require(_0x7707('0x3'));var express=require(_0x7707('0x4'));var router=express[_0x7707('0x5')]();var auth=require(_0x7707('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7707('0x7'));var controller=require(_0x7707('0x8'));router[_0x7707('0x9')]('/',auth[_0x7707('0xa')](),controller[_0x7707('0xb')]);router[_0x7707('0x9')](_0x7707('0xc'),auth[_0x7707('0xa')](),controller[_0x7707('0xd')]);router[_0x7707('0x9')](_0x7707('0xe'),auth[_0x7707('0xa')](),controller[_0x7707('0xf')]);router[_0x7707('0x10')]('/',auth[_0x7707('0xa')](),interaction[_0x7707('0x11')](_0x7707('0x12'),_0x7707('0x13')),controller[_0x7707('0x14')]);router['put'](_0x7707('0xe'),controller[_0x7707('0x15')]);router[_0x7707('0x16')]('/:id/accept',auth[_0x7707('0xa')](),controller['accept']);router[_0x7707('0x16')](_0x7707('0x17'),auth['isAuthenticated'](),controller[_0x7707('0x18')]);router['delete'](_0x7707('0xe'),auth[_0x7707('0xa')](),controller[_0x7707('0x19')]);module[_0x7707('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 455a722..d2aa9d0 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 _0xd383=['sequelize','exports','TEXT','medium'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xd383,0x100));var _0x3d38=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xd383[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require(_0x3d38('0x0'));module[_0x3d38('0x1')]={'body':{'type':Sequelize[_0x3d38('0x2')](_0x3d38('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x6d70=['sequelize','exports','TEXT','medium'];(function(_0x375d19,_0x3a0fa4){var _0x20ce2=function(_0x2be0ef){while(--_0x2be0ef){_0x375d19['push'](_0x375d19['shift']());}};_0x20ce2(++_0x3a0fa4);}(_0x6d70,0xe8));var _0x06d7=function(_0x535fc2,_0x823367){_0x535fc2=_0x535fc2-0x0;var _0x22c8a3=_0x6d70[_0x535fc2];return _0x22c8a3;};'use strict';var Sequelize=require(_0x06d7('0x0'));module[_0x06d7('0x1')]={'body':{'type':Sequelize[_0x06d7('0x2')](_0x06d7('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 26b0b0c..524cbf9 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 _0x94e6=['index','map','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','ChatOfflineMessage','include','findAll','rows','show','params','includeAll','find','catch','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send'];(function(_0x1b93de,_0x353881){var _0x3e1d5e=function(_0x5616bd){while(--_0x5616bd){_0x1b93de['push'](_0x1b93de['shift']());}};_0x3e1d5e(++_0x353881);}(_0x94e6,0x194));var _0x694e=function(_0x1920fc,_0x2d78b0){_0x1920fc=_0x1920fc-0x0;var _0x3c9c16=_0x94e6[_0x1920fc];return _0x3c9c16;};'use strict';var pdf=require(_0x694e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x694e('0x1'));var zipdir=require(_0x694e('0x2'));var jsonpatch=require(_0x694e('0x3'));var rp=require(_0x694e('0x4'));var moment=require(_0x694e('0x5'));var BPromise=require(_0x694e('0x6'));var Mustache=require('mustache');var util=require(_0x694e('0x7'));var path=require(_0x694e('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x694e('0x9'));var fs=require('fs');var _=require(_0x694e('0xa'));var squel=require(_0x694e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x694e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x694e('0xd'));var authService=require(_0x694e('0xe'));var qs=require(_0x694e('0xf'));var as=require(_0x694e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x694e('0x11'))(_0x694e('0x12'));var utils=require('../../config/utils');var config=require(_0x694e('0x13'));var licenseUtil=require(_0x694e('0x14'));var db=require(_0x694e('0x15'))['db'];function respondWithStatusCode(_0x184613,_0x5c0035){_0x5c0035=_0x5c0035||0xcc;return function(_0x32ce10){if(_0x32ce10){return _0x184613['sendStatus'](_0x5c0035);}return _0x184613[_0x694e('0x16')](_0x5c0035)[_0x694e('0x17')]();};}function respondWithResult(_0x2c7eec,_0x3a4a60){_0x3a4a60=_0x3a4a60||0xc8;return function(_0x1532f6){if(_0x1532f6){return _0x2c7eec[_0x694e('0x16')](_0x3a4a60)[_0x694e('0x18')](_0x1532f6);}};}function respondWithFilteredResult(_0x21b683,_0x42d3f6){return function(_0x1f4df1){if(_0x1f4df1){var _0x327f83=_0x1f4df1[_0x694e('0x19')],_0x46d46c=_0x42d3f6[_0x694e('0x1a')],_0x8771fa=_0x42d3f6[_0x694e('0x1a')]+_0x42d3f6[_0x694e('0x1b')],_0x4e608d;if(_0x8771fa>=_0x327f83){_0x8771fa=_0x327f83;_0x4e608d=0xc8;}else{_0x4e608d=0xce;}_0x21b683[_0x694e('0x16')](_0x4e608d);return _0x21b683[_0x694e('0x1c')](_0x694e('0x1d'),_0x46d46c+'-'+_0x8771fa+'/'+_0x327f83)[_0x694e('0x18')](_0x1f4df1);}return null;};}function patchUpdates(_0x1e3a21){return function(_0x42a46c){try{jsonpatch[_0x694e('0x1e')](_0x42a46c,_0x1e3a21,!![]);}catch(_0x4ef505){return BPromise[_0x694e('0x1f')](_0x4ef505);}return _0x42a46c['save']();};}function saveUpdates(_0x29601b,_0x46868d){return function(_0x4b191b){if(_0x4b191b){return _0x4b191b[_0x694e('0x20')](_0x29601b)[_0x694e('0x21')](function(_0x385158){return _0x385158;});}return null;};}function removeEntity(_0x469a7a,_0x22d614){return function(_0x308e24){if(_0x308e24){return _0x308e24[_0x694e('0x22')]()[_0x694e('0x21')](function(){_0x469a7a[_0x694e('0x16')](0xcc)[_0x694e('0x17')]();});}};}function handleEntityNotFound(_0x415eb0,_0x508b9b){return function(_0x5e2332){if(!_0x5e2332){_0x415eb0[_0x694e('0x23')](0x194);}return _0x5e2332;};}function handleError(_0x294798,_0x4ea16c){_0x4ea16c=_0x4ea16c||0x1f4;return function(_0x1e8647){logger[_0x694e('0x24')](_0x1e8647[_0x694e('0x25')]);if(_0x1e8647[_0x694e('0x26')]){delete _0x1e8647[_0x694e('0x26')];}_0x294798[_0x694e('0x16')](_0x4ea16c)[_0x694e('0x27')](_0x1e8647);};}exports[_0x694e('0x28')]=function(_0x5bd749,_0x315ef3){var _0x3ef315={},_0xe34d77={},_0x34690a={'count':0x0,'rows':[]};var _0xbce4e7=_[_0x694e('0x29')](db['ChatOfflineMessage'][_0x694e('0x2a')],function(_0x50bdf2){return{'name':_0x50bdf2[_0x694e('0x2b')],'type':_0x50bdf2[_0x694e('0x2c')][_0x694e('0x2d')]};});_0xe34d77['model']=_[_0x694e('0x29')](_0xbce4e7,'name');_0xe34d77['query']=_[_0x694e('0x2e')](_0x5bd749[_0x694e('0x2f')]);_0xe34d77[_0x694e('0x30')]=_['intersection'](_0xe34d77[_0x694e('0x31')],_0xe34d77['query']);_0x3ef315[_0x694e('0x32')]=_[_0x694e('0x33')](_0xe34d77['model'],qs[_0x694e('0x34')](_0x5bd749[_0x694e('0x2f')][_0x694e('0x34')]));_0x3ef315[_0x694e('0x32')]=_0x3ef315['attributes'][_0x694e('0x35')]?_0x3ef315['attributes']:_0xe34d77[_0x694e('0x31')];if(!_0x5bd749[_0x694e('0x2f')][_0x694e('0x36')]('nolimit')){_0x3ef315[_0x694e('0x1b')]=qs[_0x694e('0x1b')](_0x5bd749[_0x694e('0x2f')][_0x694e('0x1b')]);_0x3ef315[_0x694e('0x1a')]=qs[_0x694e('0x1a')](_0x5bd749[_0x694e('0x2f')][_0x694e('0x1a')]);}_0x3ef315['order']=qs[_0x694e('0x37')](_0x5bd749[_0x694e('0x2f')][_0x694e('0x37')]);_0x3ef315[_0x694e('0x38')]=qs['filters'](_[_0x694e('0x39')](_0x5bd749[_0x694e('0x2f')],_0xe34d77[_0x694e('0x30')]),_0xbce4e7);if(_0x5bd749[_0x694e('0x2f')][_0x694e('0x3a')]){_0x3ef315[_0x694e('0x38')]=_[_0x694e('0x3b')](_0x3ef315[_0x694e('0x38')],{'$or':_[_0x694e('0x29')](_0xbce4e7,function(_0x5a4e72){if(_0x5a4e72['type']!==_0x694e('0x3c')){var _0x264ded={};_0x264ded[_0x5a4e72[_0x694e('0x26')]]={'$like':'%'+_0x5bd749[_0x694e('0x2f')][_0x694e('0x3a')]+'%'};return _0x264ded;}})});}_0x3ef315=_['merge']({},_0x3ef315,_0x5bd749[_0x694e('0x3d')]);var _0x474971={'where':_0x3ef315[_0x694e('0x38')]};return db[_0x694e('0x3e')][_0x694e('0x19')](_0x474971)[_0x694e('0x21')](function(_0x33d53c){_0x34690a[_0x694e('0x19')]=_0x33d53c;if(_0x5bd749[_0x694e('0x2f')]['includeAll']){_0x3ef315[_0x694e('0x3f')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x694e('0x40')](_0x3ef315);})['then'](function(_0x2ad921){_0x34690a[_0x694e('0x41')]=_0x2ad921;return _0x34690a;})[_0x694e('0x21')](respondWithFilteredResult(_0x315ef3,_0x3ef315))['catch'](handleError(_0x315ef3,null));};exports[_0x694e('0x42')]=function(_0x3bd1f8,_0x150201){var _0x3dd5a5={'raw':!![],'where':{'id':_0x3bd1f8[_0x694e('0x43')]['id']}},_0x2b672b={};_0x2b672b['model']=_[_0x694e('0x2e')](db['ChatOfflineMessage']['rawAttributes']);_0x2b672b['query']=_[_0x694e('0x2e')](_0x3bd1f8[_0x694e('0x2f')]);_0x2b672b[_0x694e('0x30')]=_[_0x694e('0x33')](_0x2b672b[_0x694e('0x31')],_0x2b672b['query']);_0x3dd5a5[_0x694e('0x32')]=_[_0x694e('0x33')](_0x2b672b[_0x694e('0x31')],qs[_0x694e('0x34')](_0x3bd1f8[_0x694e('0x2f')][_0x694e('0x34')]));_0x3dd5a5[_0x694e('0x32')]=_0x3dd5a5[_0x694e('0x32')]['length']?_0x3dd5a5['attributes']:_0x2b672b[_0x694e('0x31')];if(_0x3bd1f8[_0x694e('0x2f')][_0x694e('0x44')]){_0x3dd5a5['include']=[{'all':!![]}];}_0x3dd5a5=_[_0x694e('0x3b')]({},_0x3dd5a5,_0x3bd1f8[_0x694e('0x3d')]);return db[_0x694e('0x3e')][_0x694e('0x45')](_0x3dd5a5)[_0x694e('0x21')](handleEntityNotFound(_0x150201,null))[_0x694e('0x21')](respondWithResult(_0x150201,null))[_0x694e('0x46')](handleError(_0x150201,null));};exports[_0x694e('0x47')]=function(_0x57d12f,_0x306264){return db[_0x694e('0x3e')][_0x694e('0x47')](_0x57d12f['body'],{})[_0x694e('0x21')](respondWithResult(_0x306264,0xc9))[_0x694e('0x46')](handleError(_0x306264,null));};exports[_0x694e('0x20')]=function(_0xd03793,_0x48ebac){if(_0xd03793[_0x694e('0x48')]['id']){delete _0xd03793[_0x694e('0x48')]['id'];}return db[_0x694e('0x3e')]['find']({'where':{'id':_0xd03793[_0x694e('0x43')]['id']}})[_0x694e('0x21')](handleEntityNotFound(_0x48ebac,null))[_0x694e('0x21')](saveUpdates(_0xd03793['body'],null))[_0x694e('0x21')](respondWithResult(_0x48ebac,null))[_0x694e('0x46')](handleError(_0x48ebac,null));};exports[_0x694e('0x22')]=function(_0x30ccc4,_0x537e23){return db['ChatOfflineMessage'][_0x694e('0x45')]({'where':{'id':_0x30ccc4[_0x694e('0x43')]['id']}})[_0x694e('0x21')](handleEntityNotFound(_0x537e23,null))[_0x694e('0x21')](removeEntity(_0x537e23,null))[_0x694e('0x46')](handleError(_0x537e23,null));};exports[_0x694e('0x49')]=function(_0x10a402,_0x378c4e){return db[_0x694e('0x3e')][_0x694e('0x49')]()[_0x694e('0x21')](respondWithResult(_0x378c4e,null))[_0x694e('0x46')](handleError(_0x378c4e,null));}; \ No newline at end of file +var _0x34b7=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','save','then','error','stack','name','send','index','map','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','intersection','includeAll','find','create','body','update','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x5a306a,_0x3bdfdf){var _0x5ec858=function(_0x43d10d){while(--_0x43d10d){_0x5a306a['push'](_0x5a306a['shift']());}};_0x5ec858(++_0x3bdfdf);}(_0x34b7,0x16e));var _0x734b=function(_0x3b14ad,_0x5e4401){_0x3b14ad=_0x3b14ad-0x0;var _0x392677=_0x34b7[_0x3b14ad];return _0x392677;};'use strict';var pdf=require(_0x734b('0x0'));var emlformat=require(_0x734b('0x1'));var rimraf=require(_0x734b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x734b('0x3'));var rp=require(_0x734b('0x4'));var moment=require(_0x734b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x734b('0x6'));var util=require(_0x734b('0x7'));var path=require(_0x734b('0x8'));var sox=require(_0x734b('0x9'));var csv=require(_0x734b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x734b('0xb'));var crypto=require(_0x734b('0xc'));var jsforce=require(_0x734b('0xd'));var deskjs=require(_0x734b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x734b('0xf'));var Papa=require(_0x734b('0x10'));var Redis=require(_0x734b('0x11'));var authService=require(_0x734b('0x12'));var qs=require(_0x734b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x734b('0x14'));var logger=require(_0x734b('0x15'))(_0x734b('0x16'));var utils=require(_0x734b('0x17'));var config=require(_0x734b('0x18'));var licenseUtil=require(_0x734b('0x19'));var db=require(_0x734b('0x1a'))['db'];function respondWithStatusCode(_0x2147cd,_0x47138f){_0x47138f=_0x47138f||0xcc;return function(_0x286887){if(_0x286887){return _0x2147cd[_0x734b('0x1b')](_0x47138f);}return _0x2147cd[_0x734b('0x1c')](_0x47138f)[_0x734b('0x1d')]();};}function respondWithResult(_0xc04145,_0x57b6e9){_0x57b6e9=_0x57b6e9||0xc8;return function(_0x40d887){if(_0x40d887){return _0xc04145[_0x734b('0x1c')](_0x57b6e9)[_0x734b('0x1e')](_0x40d887);}};}function respondWithFilteredResult(_0x544913,_0xc1ec33){return function(_0x1e1b0e){if(_0x1e1b0e){var _0x28e5ca=_0x1e1b0e[_0x734b('0x1f')],_0x3cc29b=_0xc1ec33[_0x734b('0x20')],_0x2041fa=_0xc1ec33[_0x734b('0x20')]+_0xc1ec33['limit'],_0x4d3f07;if(_0x2041fa>=_0x28e5ca){_0x2041fa=_0x28e5ca;_0x4d3f07=0xc8;}else{_0x4d3f07=0xce;}_0x544913[_0x734b('0x1c')](_0x4d3f07);return _0x544913[_0x734b('0x21')](_0x734b('0x22'),_0x3cc29b+'-'+_0x2041fa+'/'+_0x28e5ca)[_0x734b('0x1e')](_0x1e1b0e);}return null;};}function patchUpdates(_0x575713){return function(_0xb77a50){try{jsonpatch['apply'](_0xb77a50,_0x575713,!![]);}catch(_0x1a06e2){return BPromise['reject'](_0x1a06e2);}return _0xb77a50[_0x734b('0x23')]();};}function saveUpdates(_0xbaac1f,_0x21ebb3){return function(_0x4bd9ed){if(_0x4bd9ed){return _0x4bd9ed['update'](_0xbaac1f)[_0x734b('0x24')](function(_0x2b5949){return _0x2b5949;});}return null;};}function removeEntity(_0x1ad33f,_0x5183b3){return function(_0x5cb9e3){if(_0x5cb9e3){return _0x5cb9e3['destroy']()[_0x734b('0x24')](function(){_0x1ad33f[_0x734b('0x1c')](0xcc)[_0x734b('0x1d')]();});}};}function handleEntityNotFound(_0x3b470a,_0x12fda3){return function(_0x522e27){if(!_0x522e27){_0x3b470a['sendStatus'](0x194);}return _0x522e27;};}function handleError(_0xc576de,_0x3a8777){_0x3a8777=_0x3a8777||0x1f4;return function(_0x532e97){logger[_0x734b('0x25')](_0x532e97[_0x734b('0x26')]);if(_0x532e97[_0x734b('0x27')]){delete _0x532e97['name'];}_0xc576de[_0x734b('0x1c')](_0x3a8777)[_0x734b('0x28')](_0x532e97);};}exports[_0x734b('0x29')]=function(_0x4f2efb,_0x2284a7){var _0x225af5={},_0x605e5e={},_0x17abc1={'count':0x0,'rows':[]};var _0x2fb2b6=_[_0x734b('0x2a')](db[_0x734b('0x2b')][_0x734b('0x2c')],function(_0x2ae725){return{'name':_0x2ae725[_0x734b('0x2d')],'type':_0x2ae725[_0x734b('0x2e')][_0x734b('0x2f')]};});_0x605e5e[_0x734b('0x30')]=_['map'](_0x2fb2b6,_0x734b('0x27'));_0x605e5e[_0x734b('0x31')]=_[_0x734b('0x32')](_0x4f2efb[_0x734b('0x31')]);_0x605e5e[_0x734b('0x33')]=_['intersection'](_0x605e5e['model'],_0x605e5e[_0x734b('0x31')]);_0x225af5[_0x734b('0x34')]=_['intersection'](_0x605e5e[_0x734b('0x30')],qs[_0x734b('0x35')](_0x4f2efb['query'][_0x734b('0x35')]));_0x225af5[_0x734b('0x34')]=_0x225af5[_0x734b('0x34')][_0x734b('0x36')]?_0x225af5[_0x734b('0x34')]:_0x605e5e[_0x734b('0x30')];if(!_0x4f2efb[_0x734b('0x31')][_0x734b('0x37')](_0x734b('0x38'))){_0x225af5[_0x734b('0x39')]=qs['limit'](_0x4f2efb[_0x734b('0x31')]['limit']);_0x225af5[_0x734b('0x20')]=qs[_0x734b('0x20')](_0x4f2efb['query']['offset']);}_0x225af5['order']=qs[_0x734b('0x3a')](_0x4f2efb[_0x734b('0x31')][_0x734b('0x3a')]);_0x225af5[_0x734b('0x3b')]=qs['filters'](_[_0x734b('0x3c')](_0x4f2efb[_0x734b('0x31')],_0x605e5e[_0x734b('0x33')]),_0x2fb2b6);if(_0x4f2efb['query'][_0x734b('0x3d')]){_0x225af5[_0x734b('0x3b')]=_[_0x734b('0x3e')](_0x225af5[_0x734b('0x3b')],{'$or':_['map'](_0x2fb2b6,function(_0xf1bd04){if(_0xf1bd04[_0x734b('0x2e')]!==_0x734b('0x3f')){var _0x47d256={};_0x47d256[_0xf1bd04[_0x734b('0x27')]]={'$like':'%'+_0x4f2efb[_0x734b('0x31')][_0x734b('0x3d')]+'%'};return _0x47d256;}})});}_0x225af5=_[_0x734b('0x3e')]({},_0x225af5,_0x4f2efb[_0x734b('0x40')]);var _0x2f1149={'where':_0x225af5[_0x734b('0x3b')]};return db[_0x734b('0x2b')][_0x734b('0x1f')](_0x2f1149)[_0x734b('0x24')](function(_0x44948d){_0x17abc1['count']=_0x44948d;if(_0x4f2efb[_0x734b('0x31')]['includeAll']){_0x225af5[_0x734b('0x41')]=[{'all':!![]}];}return db[_0x734b('0x2b')][_0x734b('0x42')](_0x225af5);})[_0x734b('0x24')](function(_0x2f9c57){_0x17abc1['rows']=_0x2f9c57;return _0x17abc1;})[_0x734b('0x24')](respondWithFilteredResult(_0x2284a7,_0x225af5))[_0x734b('0x43')](handleError(_0x2284a7,null));};exports[_0x734b('0x44')]=function(_0x1fe3cf,_0x4cf65f){var _0x1135bb={'raw':!![],'where':{'id':_0x1fe3cf[_0x734b('0x45')]['id']}},_0x399b04={};_0x399b04[_0x734b('0x30')]=_[_0x734b('0x32')](db[_0x734b('0x2b')][_0x734b('0x2c')]);_0x399b04[_0x734b('0x31')]=_[_0x734b('0x32')](_0x1fe3cf[_0x734b('0x31')]);_0x399b04[_0x734b('0x33')]=_['intersection'](_0x399b04[_0x734b('0x30')],_0x399b04[_0x734b('0x31')]);_0x1135bb[_0x734b('0x34')]=_[_0x734b('0x46')](_0x399b04[_0x734b('0x30')],qs['fields'](_0x1fe3cf[_0x734b('0x31')]['fields']));_0x1135bb[_0x734b('0x34')]=_0x1135bb[_0x734b('0x34')][_0x734b('0x36')]?_0x1135bb[_0x734b('0x34')]:_0x399b04[_0x734b('0x30')];if(_0x1fe3cf[_0x734b('0x31')][_0x734b('0x47')]){_0x1135bb[_0x734b('0x41')]=[{'all':!![]}];}_0x1135bb=_['merge']({},_0x1135bb,_0x1fe3cf[_0x734b('0x40')]);return db['ChatOfflineMessage'][_0x734b('0x48')](_0x1135bb)[_0x734b('0x24')](handleEntityNotFound(_0x4cf65f,null))[_0x734b('0x24')](respondWithResult(_0x4cf65f,null))[_0x734b('0x43')](handleError(_0x4cf65f,null));};exports['create']=function(_0x1a08db,_0xd3323c){return db['ChatOfflineMessage'][_0x734b('0x49')](_0x1a08db[_0x734b('0x4a')],{})[_0x734b('0x24')](respondWithResult(_0xd3323c,0xc9))[_0x734b('0x43')](handleError(_0xd3323c,null));};exports[_0x734b('0x4b')]=function(_0x14e26a,_0x5a852a){if(_0x14e26a['body']['id']){delete _0x14e26a[_0x734b('0x4a')]['id'];}return db[_0x734b('0x2b')][_0x734b('0x48')]({'where':{'id':_0x14e26a[_0x734b('0x45')]['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x5a852a,null))[_0x734b('0x24')](saveUpdates(_0x14e26a[_0x734b('0x4a')],null))[_0x734b('0x24')](respondWithResult(_0x5a852a,null))[_0x734b('0x43')](handleError(_0x5a852a,null));};exports[_0x734b('0x4c')]=function(_0x5771e6,_0x5ee359){return db[_0x734b('0x2b')][_0x734b('0x48')]({'where':{'id':_0x5771e6['params']['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x5ee359,null))[_0x734b('0x24')](removeEntity(_0x5ee359,null))['catch'](handleError(_0x5ee359,null));};exports[_0x734b('0x4d')]=function(_0xd749e5,_0x29e8a1){return db[_0x734b('0x2b')]['describe']()[_0x734b('0x24')](respondWithResult(_0x29e8a1,null))[_0x734b('0x43')](handleError(_0x29e8a1,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index a5ffba6..33d92ab 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 _0xd13e=['lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x54f7c0,_0x27af83){var _0x245d03=function(_0x1ad6c4){while(--_0x1ad6c4){_0x54f7c0['push'](_0x54f7c0['shift']());}};_0x245d03(++_0x27af83);}(_0xd13e,0x193));var _0xed13=function(_0x2acd72,_0x1a5f72){_0x2acd72=_0x2acd72-0x0;var _0x2f19b2=_0xd13e[_0x2acd72];return _0x2f19b2;};'use strict';var _=require(_0xed13('0x0'));var util=require(_0xed13('0x1'));var logger=require(_0xed13('0x2'))(_0xed13('0x3'));var moment=require('moment');var BPromise=require(_0xed13('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed13('0x5'));var rimraf=require('rimraf');var config=require(_0xed13('0x6'));var attributes=require(_0xed13('0x7'));module['exports']=function(_0x50de44,_0x5142bd){return _0x50de44[_0xed13('0x8')](_0xed13('0x9'),attributes,{'tableName':_0xed13('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xed13('0xb'),'collate':_0xed13('0xc')});}; \ No newline at end of file +var _0x2d17=['api','moment','request-promise','path','../../config/environment','exports','define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x57b92d,_0x115886){var _0x402359=function(_0x47369a){while(--_0x47369a){_0x57b92d['push'](_0x57b92d['shift']());}};_0x402359(++_0x115886);}(_0x2d17,0x17e));var _0x72d1=function(_0x2103f2,_0x4c7913){_0x2103f2=_0x2103f2-0x0;var _0x2b8999=_0x2d17[_0x2103f2];return _0x2b8999;};'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('./chatOfflineMessage.attributes');module[_0x72d1('0x7')]=function(_0x50f551,_0x139ba0){return _0x50f551[_0x72d1('0x8')]('ChatOfflineMessage',attributes,{'tableName':_0x72d1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x72d1('0xa'),'collate':_0x72d1('0xb')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index a38ba3e..5a5eb6b 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 _0x0304=['../../config/logger','rpc','jayson/promise','http','request','then','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x5c1c7a,_0x52fd2b){var _0x4990f0=function(_0xbc008e){while(--_0xbc008e){_0x5c1c7a['push'](_0x5c1c7a['shift']());}};_0x4990f0(++_0x52fd2b);}(_0x0304,0x79));var _0x4030=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x0304[_0x4d613c];return _0x301fe3;};'use strict';var _=require('lodash');var util=require(_0x4030('0x0'));var moment=require(_0x4030('0x1'));var BPromise=require(_0x4030('0x2'));var rs=require(_0x4030('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4030('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4030('0x5'))(_0x4030('0x6'));var config=require('../../config/environment');var jayson=require(_0x4030('0x7'));var client=jayson['client'][_0x4030('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3bbf5a,_0x5ebcae,_0x43ca45){return new BPromise(function(_0x3e0d8a,_0x4e738c){return client[_0x4030('0x9')](_0x3bbf5a,_0x43ca45)[_0x4030('0xa')](function(_0x5d2700){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x5ebcae,'request\x20sent');logger['debug'](_0x4030('0xb'),_0x5ebcae,_0x4030('0xc'),JSON[_0x4030('0xd')](_0x5d2700));if(_0x5d2700[_0x4030('0xe')]){if(_0x5d2700['error'][_0x4030('0xf')]===0x1f4){logger[_0x4030('0xe')](_0x4030('0x10'),_0x5ebcae,_0x5d2700[_0x4030('0xe')][_0x4030('0x11')]);return _0x4e738c(_0x5d2700['error'][_0x4030('0x11')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x5ebcae,_0x5d2700[_0x4030('0xe')][_0x4030('0x11')]);return _0x3e0d8a(_0x5d2700[_0x4030('0xe')][_0x4030('0x11')]);}else{logger[_0x4030('0x12')](_0x4030('0x10'),_0x5ebcae,'request\x20sent');_0x3e0d8a(_0x5d2700[_0x4030('0x13')]['message']);}})[_0x4030('0x14')](function(_0x584892){logger[_0x4030('0xe')](_0x4030('0x10'),_0x5ebcae,_0x584892);_0x4e738c(_0x584892);});});} \ No newline at end of file +var _0xde8e=['code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x22d109,_0x3611c1){var _0x435e08=function(_0x5ec347){while(--_0x5ec347){_0x22d109['push'](_0x22d109['shift']());}};_0x435e08(++_0x3611c1);}(_0xde8e,0x1b3));var _0xede8=function(_0x623e7,_0x1bef7d){_0x623e7=_0x623e7-0x0;var _0x121131=_0xde8e[_0x623e7];return _0x121131;};'use strict';var _=require(_0xede8('0x0'));var util=require(_0xede8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xede8('0x2'));var fs=require('fs');var Redis=require(_0xede8('0x3'));var db=require(_0xede8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xede8('0x5'));var jayson=require(_0xede8('0x6'));var client=jayson[_0xede8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ecb4a,_0x1e2a22,_0x148f95){return new BPromise(function(_0x215591,_0x36897b){return client[_0xede8('0x8')](_0x1ecb4a,_0x148f95)['then'](function(_0x691765){logger[_0xede8('0x9')](_0xede8('0xa'),_0x1e2a22,_0xede8('0xb'));logger[_0xede8('0xc')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x1e2a22,_0xede8('0xb'),JSON[_0xede8('0xd')](_0x691765));if(_0x691765[_0xede8('0xe')]){if(_0x691765['error'][_0xede8('0xf')]===0x1f4){logger[_0xede8('0xe')](_0xede8('0xa'),_0x1e2a22,_0x691765[_0xede8('0xe')]['message']);return _0x36897b(_0x691765['error'][_0xede8('0x10')]);}logger[_0xede8('0xe')](_0xede8('0xa'),_0x1e2a22,_0x691765[_0xede8('0xe')][_0xede8('0x10')]);return _0x215591(_0x691765[_0xede8('0xe')][_0xede8('0x10')]);}else{logger[_0xede8('0x9')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1e2a22,_0xede8('0xb'));_0x215591(_0x691765['result']['message']);}})[_0xede8('0x11')](function(_0x2c9c55){logger['error'](_0xede8('0xa'),_0x1e2a22,_0x2c9c55);_0x36897b(_0x2c9c55);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 180e677..1e8a534 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 _0x244e=['../../config/environment','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3d1706,_0x50f460){var _0x128252=function(_0x1eae8f){while(--_0x1eae8f){_0x3d1706['push'](_0x3d1706['shift']());}};_0x128252(++_0x50f460);}(_0x244e,0xea));var _0xe244=function(_0xf8c90c,_0x29d757){_0xf8c90c=_0xf8c90c-0x0;var _0x37c757=_0x244e[_0xf8c90c];return _0x37c757;};'use strict';var multer=require(_0xe244('0x0'));var util=require(_0xe244('0x1'));var path=require(_0xe244('0x2'));var timeout=require(_0xe244('0x3'));var express=require(_0xe244('0x4'));var router=express[_0xe244('0x5')]();var auth=require(_0xe244('0x6'));var interaction=require(_0xe244('0x7'));var config=require(_0xe244('0x8'));var controller=require(_0xe244('0x9'));router[_0xe244('0xa')]('/',auth['isAuthenticated'](),controller[_0xe244('0xb')]);router['get'](_0xe244('0xc'),auth[_0xe244('0xd')](),controller[_0xe244('0xe')]);router[_0xe244('0xa')](_0xe244('0xf'),auth[_0xe244('0xd')](),controller[_0xe244('0x10')]);router[_0xe244('0x11')]('/',auth[_0xe244('0xd')](),controller['create']);router[_0xe244('0x12')](_0xe244('0xf'),auth['isAuthenticated'](),controller[_0xe244('0x13')]);router['delete'](_0xe244('0xf'),auth['isAuthenticated'](),controller[_0xe244('0x14')]);module[_0xe244('0x15')]=router; \ No newline at end of file +var _0x3af2=['show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x3af2,0xc4));var _0x23af=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0x3af2[_0x14a862];return _0x245eb5;};'use strict';var multer=require('multer');var util=require(_0x23af('0x0'));var path=require(_0x23af('0x1'));var timeout=require(_0x23af('0x2'));var express=require(_0x23af('0x3'));var router=express[_0x23af('0x4')]();var auth=require(_0x23af('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x23af('0x6'));var controller=require(_0x23af('0x7'));router['get']('/',auth[_0x23af('0x8')](),controller[_0x23af('0x9')]);router[_0x23af('0xa')](_0x23af('0xb'),auth[_0x23af('0x8')](),controller[_0x23af('0xc')]);router[_0x23af('0xa')](_0x23af('0xd'),auth[_0x23af('0x8')](),controller[_0x23af('0xe')]);router[_0x23af('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x23af('0x10')](_0x23af('0xd'),auth[_0x23af('0x8')](),controller[_0x23af('0x11')]);router[_0x23af('0x12')](_0x23af('0xd'),auth['isAuthenticated'](),controller[_0x23af('0x13')]);module[_0x23af('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 281126e..d8ccc78 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 _0x9b88=['INTEGER','sequelize','STRING','mouseOver','timeout'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x9b88,0x1c8));var _0x89b8=function(_0x40433a,_0x2c9bd9){_0x40433a=_0x40433a-0x0;var _0x41d7f4=_0x9b88[_0x40433a];return _0x41d7f4;};'use strict';var Sequelize=require(_0x89b8('0x0'));module['exports']={'name':{'type':Sequelize[_0x89b8('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x89b8('0x2'),_0x89b8('0x3')),'defaultValue':_0x89b8('0x2')},'selector':{'type':Sequelize[_0x89b8('0x1')]},'timeout':{'type':Sequelize[_0x89b8('0x4')]}}; \ No newline at end of file +var _0x4172=['STRING','ENUM','mouseOver','timeout','INTEGER','sequelize','exports'];(function(_0x578275,_0xe7ae46){var _0xf78041=function(_0x13148c){while(--_0x13148c){_0x578275['push'](_0x578275['shift']());}};_0xf78041(++_0xe7ae46);}(_0x4172,0x1a2));var _0x2417=function(_0x3a4004,_0x2d4107){_0x3a4004=_0x3a4004-0x0;var _0x44f976=_0x4172[_0x3a4004];return _0x44f976;};'use strict';var Sequelize=require(_0x2417('0x0'));module[_0x2417('0x1')]={'name':{'type':Sequelize[_0x2417('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2417('0x3')](_0x2417('0x4'),_0x2417('0x5')),'defaultValue':_0x2417('0x4')},'selector':{'type':Sequelize[_0x2417('0x2')]},'timeout':{'type':Sequelize[_0x2417('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 63add1b..582c84d 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 _0xf5b8=['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','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','keys','query','filters','intersection','model','attributes','fields','length','includeAll','include','options','ChatProactiveAction','find','catch','create','body','html-pdf','eml-format'];(function(_0x19691f,_0x159737){var _0x5677b6=function(_0x41a9b2){while(--_0x41a9b2){_0x19691f['push'](_0x19691f['shift']());}};_0x5677b6(++_0x159737);}(_0xf5b8,0x17e));var _0x8f5b=function(_0x3ec6c9,_0x456ebd){_0x3ec6c9=_0x3ec6c9-0x0;var _0x4c71e2=_0xf5b8[_0x3ec6c9];return _0x4c71e2;};'use strict';var pdf=require(_0x8f5b('0x0'));var emlformat=require(_0x8f5b('0x1'));var rimraf=require(_0x8f5b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f5b('0x3'));var rp=require(_0x8f5b('0x4'));var moment=require(_0x8f5b('0x5'));var BPromise=require(_0x8f5b('0x6'));var Mustache=require(_0x8f5b('0x7'));var util=require(_0x8f5b('0x8'));var path=require(_0x8f5b('0x9'));var sox=require(_0x8f5b('0xa'));var csv=require(_0x8f5b('0xb'));var ejs=require(_0x8f5b('0xc'));var fs=require('fs');var _=require(_0x8f5b('0xd'));var squel=require(_0x8f5b('0xe'));var crypto=require(_0x8f5b('0xf'));var jsforce=require(_0x8f5b('0x10'));var deskjs=require(_0x8f5b('0x11'));var toCsv=require(_0x8f5b('0xb'));var querystring=require(_0x8f5b('0x12'));var Papa=require('papaparse');var Redis=require(_0x8f5b('0x13'));var authService=require(_0x8f5b('0x14'));var qs=require(_0x8f5b('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f5b('0x16'));var logger=require(_0x8f5b('0x17'))('api');var utils=require(_0x8f5b('0x18'));var config=require(_0x8f5b('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8f5b('0x1a'))['db'];function respondWithStatusCode(_0x44699e,_0x45c81f){_0x45c81f=_0x45c81f||0xcc;return function(_0x2b0b5b){if(_0x2b0b5b){return _0x44699e[_0x8f5b('0x1b')](_0x45c81f);}return _0x44699e[_0x8f5b('0x1c')](_0x45c81f)[_0x8f5b('0x1d')]();};}function respondWithResult(_0x3de88a,_0x5a395c){_0x5a395c=_0x5a395c||0xc8;return function(_0x4d9e76){if(_0x4d9e76){return _0x3de88a['status'](_0x5a395c)[_0x8f5b('0x1e')](_0x4d9e76);}};}function respondWithFilteredResult(_0x14b6a0,_0x271761){return function(_0x51c613){if(_0x51c613){var _0x1ab2ec=_0x51c613[_0x8f5b('0x1f')],_0x5cf45f=_0x271761[_0x8f5b('0x20')],_0x3c9cf2=_0x271761[_0x8f5b('0x20')]+_0x271761[_0x8f5b('0x21')],_0x4bf89a;if(_0x3c9cf2>=_0x1ab2ec){_0x3c9cf2=_0x1ab2ec;_0x4bf89a=0xc8;}else{_0x4bf89a=0xce;}_0x14b6a0['status'](_0x4bf89a);return _0x14b6a0[_0x8f5b('0x22')](_0x8f5b('0x23'),_0x5cf45f+'-'+_0x3c9cf2+'/'+_0x1ab2ec)[_0x8f5b('0x1e')](_0x51c613);}return null;};}function patchUpdates(_0x400ad3){return function(_0x256f3d){try{jsonpatch[_0x8f5b('0x24')](_0x256f3d,_0x400ad3,!![]);}catch(_0x2fff4c){return BPromise[_0x8f5b('0x25')](_0x2fff4c);}return _0x256f3d[_0x8f5b('0x26')]();};}function saveUpdates(_0x5c507a,_0x55f5ed){return function(_0x3f7b2d){if(_0x3f7b2d){return _0x3f7b2d[_0x8f5b('0x27')](_0x5c507a)[_0x8f5b('0x28')](function(_0x454074){return _0x454074;});}return null;};}function removeEntity(_0x478504,_0xab2027){return function(_0x44bf02){if(_0x44bf02){return _0x44bf02[_0x8f5b('0x29')]()[_0x8f5b('0x28')](function(){_0x478504[_0x8f5b('0x1c')](0xcc)[_0x8f5b('0x1d')]();});}};}function handleEntityNotFound(_0x38f933,_0x5228df){return function(_0x25764c){if(!_0x25764c){_0x38f933[_0x8f5b('0x1b')](0x194);}return _0x25764c;};}function handleError(_0x113e0b,_0x1b252b){_0x1b252b=_0x1b252b||0x1f4;return function(_0x527778){logger[_0x8f5b('0x2a')](_0x527778[_0x8f5b('0x2b')]);if(_0x527778[_0x8f5b('0x2c')]){delete _0x527778[_0x8f5b('0x2c')];}_0x113e0b['status'](_0x1b252b)[_0x8f5b('0x2d')](_0x527778);};}exports[_0x8f5b('0x2e')]=function(_0x393adf,_0x4ca275){var _0x3fe468={'raw':!![],'where':{'id':_0x393adf[_0x8f5b('0x2f')]['id']}},_0x15efff={};_0x15efff['model']=_[_0x8f5b('0x30')](db['ChatProactiveAction']['rawAttributes']);_0x15efff[_0x8f5b('0x31')]=_['keys'](_0x393adf[_0x8f5b('0x31')]);_0x15efff[_0x8f5b('0x32')]=_[_0x8f5b('0x33')](_0x15efff[_0x8f5b('0x34')],_0x15efff[_0x8f5b('0x31')]);_0x3fe468[_0x8f5b('0x35')]=_[_0x8f5b('0x33')](_0x15efff[_0x8f5b('0x34')],qs['fields'](_0x393adf[_0x8f5b('0x31')][_0x8f5b('0x36')]));_0x3fe468[_0x8f5b('0x35')]=_0x3fe468[_0x8f5b('0x35')][_0x8f5b('0x37')]?_0x3fe468[_0x8f5b('0x35')]:_0x15efff['model'];if(_0x393adf['query'][_0x8f5b('0x38')]){_0x3fe468[_0x8f5b('0x39')]=[{'all':!![]}];}_0x3fe468=_['merge']({},_0x3fe468,_0x393adf[_0x8f5b('0x3a')]);return db[_0x8f5b('0x3b')][_0x8f5b('0x3c')](_0x3fe468)[_0x8f5b('0x28')](handleEntityNotFound(_0x4ca275,null))[_0x8f5b('0x28')](respondWithResult(_0x4ca275,null))[_0x8f5b('0x3d')](handleError(_0x4ca275,null));};exports[_0x8f5b('0x3e')]=function(_0xff7845,_0x7286bd){return db[_0x8f5b('0x3b')][_0x8f5b('0x3e')](_0xff7845[_0x8f5b('0x3f')],{})[_0x8f5b('0x28')](respondWithResult(_0x7286bd,0xc9))[_0x8f5b('0x3d')](handleError(_0x7286bd,null));};exports[_0x8f5b('0x27')]=function(_0x42f666,_0x5c722f){if(_0x42f666['body']['id']){delete _0x42f666[_0x8f5b('0x3f')]['id'];}return db[_0x8f5b('0x3b')][_0x8f5b('0x3c')]({'where':{'id':_0x42f666[_0x8f5b('0x2f')]['id']}})['then'](handleEntityNotFound(_0x5c722f,null))[_0x8f5b('0x28')](saveUpdates(_0x42f666['body'],null))[_0x8f5b('0x28')](respondWithResult(_0x5c722f,null))[_0x8f5b('0x3d')](handleError(_0x5c722f,null));};exports[_0x8f5b('0x29')]=function(_0x54c892,_0x580426){return db[_0x8f5b('0x3b')][_0x8f5b('0x3c')]({'where':{'id':_0x54c892['params']['id']}})[_0x8f5b('0x28')](handleEntityNotFound(_0x580426,null))['then'](removeEntity(_0x580426,null))[_0x8f5b('0x3d')](handleError(_0x580426,null));}; \ No newline at end of file +var _0x7f6b=['end','json','count','offset','limit','set','Content-Range','apply','save','update','then','status','name','send','show','params','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','model','attributes','fields','includeAll','include','options','find','catch','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x216f98,_0x470c7f){var _0xea6b36=function(_0x38f18c){while(--_0x38f18c){_0x216f98['push'](_0x216f98['shift']());}};_0xea6b36(++_0x470c7f);}(_0x7f6b,0x94));var _0xb7f6=function(_0x3c8259,_0x4a2d5b){_0x3c8259=_0x3c8259-0x0;var _0x2e639f=_0x7f6b[_0x3c8259];return _0x2e639f;};'use strict';var pdf=require(_0xb7f6('0x0'));var emlformat=require(_0xb7f6('0x1'));var rimraf=require(_0xb7f6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb7f6('0x3'));var rp=require(_0xb7f6('0x4'));var moment=require(_0xb7f6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb7f6('0x6'));var util=require('util');var path=require(_0xb7f6('0x7'));var sox=require(_0xb7f6('0x8'));var csv=require('to-csv');var ejs=require(_0xb7f6('0x9'));var fs=require('fs');var _=require(_0xb7f6('0xa'));var squel=require(_0xb7f6('0xb'));var crypto=require(_0xb7f6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb7f6('0xd'));var toCsv=require(_0xb7f6('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb7f6('0xf'));var authService=require(_0xb7f6('0x10'));var qs=require(_0xb7f6('0x11'));var as=require(_0xb7f6('0x12'));var hardwareService=require(_0xb7f6('0x13'));var logger=require(_0xb7f6('0x14'))('api');var utils=require(_0xb7f6('0x15'));var config=require(_0xb7f6('0x16'));var licenseUtil=require(_0xb7f6('0x17'));var db=require(_0xb7f6('0x18'))['db'];function respondWithStatusCode(_0x383d29,_0x54f0eb){_0x54f0eb=_0x54f0eb||0xcc;return function(_0x50c923){if(_0x50c923){return _0x383d29[_0xb7f6('0x19')](_0x54f0eb);}return _0x383d29['status'](_0x54f0eb)[_0xb7f6('0x1a')]();};}function respondWithResult(_0x3f542c,_0x361b31){_0x361b31=_0x361b31||0xc8;return function(_0x173466){if(_0x173466){return _0x3f542c['status'](_0x361b31)[_0xb7f6('0x1b')](_0x173466);}};}function respondWithFilteredResult(_0x14a8c7,_0x190178){return function(_0x31124b){if(_0x31124b){var _0x1e9714=_0x31124b[_0xb7f6('0x1c')],_0x94d49=_0x190178[_0xb7f6('0x1d')],_0x44b6b0=_0x190178['offset']+_0x190178[_0xb7f6('0x1e')],_0x3aa1fa;if(_0x44b6b0>=_0x1e9714){_0x44b6b0=_0x1e9714;_0x3aa1fa=0xc8;}else{_0x3aa1fa=0xce;}_0x14a8c7['status'](_0x3aa1fa);return _0x14a8c7[_0xb7f6('0x1f')](_0xb7f6('0x20'),_0x94d49+'-'+_0x44b6b0+'/'+_0x1e9714)[_0xb7f6('0x1b')](_0x31124b);}return null;};}function patchUpdates(_0x1e91eb){return function(_0xe8c70c){try{jsonpatch[_0xb7f6('0x21')](_0xe8c70c,_0x1e91eb,!![]);}catch(_0x2fba0b){return BPromise['reject'](_0x2fba0b);}return _0xe8c70c[_0xb7f6('0x22')]();};}function saveUpdates(_0x4e86d6,_0x8a0c99){return function(_0x492237){if(_0x492237){return _0x492237[_0xb7f6('0x23')](_0x4e86d6)[_0xb7f6('0x24')](function(_0x1b5289){return _0x1b5289;});}return null;};}function removeEntity(_0x5c769b,_0x1dc59a){return function(_0x3dd5d1){if(_0x3dd5d1){return _0x3dd5d1['destroy']()[_0xb7f6('0x24')](function(){_0x5c769b[_0xb7f6('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13caab,_0x45b201){return function(_0x3f77b7){if(!_0x3f77b7){_0x13caab[_0xb7f6('0x19')](0x194);}return _0x3f77b7;};}function handleError(_0x501ae3,_0x7628ae){_0x7628ae=_0x7628ae||0x1f4;return function(_0x196d81){logger['error'](_0x196d81['stack']);if(_0x196d81[_0xb7f6('0x26')]){delete _0x196d81[_0xb7f6('0x26')];}_0x501ae3[_0xb7f6('0x25')](_0x7628ae)[_0xb7f6('0x27')](_0x196d81);};}exports[_0xb7f6('0x28')]=function(_0x20234f,_0x4216ca){var _0xfba517={'raw':!![],'where':{'id':_0x20234f[_0xb7f6('0x29')]['id']}},_0x3b2d5b={};_0x3b2d5b['model']=_[_0xb7f6('0x2a')](db[_0xb7f6('0x2b')][_0xb7f6('0x2c')]);_0x3b2d5b[_0xb7f6('0x2d')]=_[_0xb7f6('0x2a')](_0x20234f[_0xb7f6('0x2d')]);_0x3b2d5b[_0xb7f6('0x2e')]=_[_0xb7f6('0x2f')](_0x3b2d5b[_0xb7f6('0x30')],_0x3b2d5b['query']);_0xfba517[_0xb7f6('0x31')]=_[_0xb7f6('0x2f')](_0x3b2d5b[_0xb7f6('0x30')],qs['fields'](_0x20234f[_0xb7f6('0x2d')][_0xb7f6('0x32')]));_0xfba517['attributes']=_0xfba517[_0xb7f6('0x31')]['length']?_0xfba517[_0xb7f6('0x31')]:_0x3b2d5b[_0xb7f6('0x30')];if(_0x20234f[_0xb7f6('0x2d')][_0xb7f6('0x33')]){_0xfba517[_0xb7f6('0x34')]=[{'all':!![]}];}_0xfba517=_['merge']({},_0xfba517,_0x20234f[_0xb7f6('0x35')]);return db['ChatProactiveAction'][_0xb7f6('0x36')](_0xfba517)['then'](handleEntityNotFound(_0x4216ca,null))['then'](respondWithResult(_0x4216ca,null))[_0xb7f6('0x37')](handleError(_0x4216ca,null));};exports['create']=function(_0x4e1e58,_0x1a8a8d){return db[_0xb7f6('0x2b')][_0xb7f6('0x38')](_0x4e1e58['body'],{})[_0xb7f6('0x24')](respondWithResult(_0x1a8a8d,0xc9))[_0xb7f6('0x37')](handleError(_0x1a8a8d,null));};exports[_0xb7f6('0x23')]=function(_0x366a5a,_0x4a2b31){if(_0x366a5a[_0xb7f6('0x39')]['id']){delete _0x366a5a[_0xb7f6('0x39')]['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x366a5a[_0xb7f6('0x29')]['id']}})['then'](handleEntityNotFound(_0x4a2b31,null))[_0xb7f6('0x24')](saveUpdates(_0x366a5a['body'],null))[_0xb7f6('0x24')](respondWithResult(_0x4a2b31,null))[_0xb7f6('0x37')](handleError(_0x4a2b31,null));};exports['destroy']=function(_0x4ad277,_0x188a18){return db[_0xb7f6('0x2b')][_0xb7f6('0x36')]({'where':{'id':_0x4ad277[_0xb7f6('0x29')]['id']}})[_0xb7f6('0x24')](handleEntityNotFound(_0x188a18,null))['then'](removeEntity(_0x188a18,null))[_0xb7f6('0x37')](handleError(_0x188a18,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index cf052b5..e83ede7 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 _0x5a49=['chat_proactive_actions','lodash','util','bluebird','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define'];(function(_0x102417,_0x3da93c){var _0x463857=function(_0x8df1dd){while(--_0x8df1dd){_0x102417['push'](_0x102417['shift']());}};_0x463857(++_0x3da93c);}(_0x5a49,0x19b));var _0x95a4=function(_0x19d946,_0xa71230){_0x19d946=_0x19d946-0x0;var _0x2464dc=_0x5a49[_0x19d946];return _0x2464dc;};'use strict';var _=require(_0x95a4('0x0'));var util=require(_0x95a4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x95a4('0x2'));var rp=require(_0x95a4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95a4('0x4'));var config=require(_0x95a4('0x5'));var attributes=require(_0x95a4('0x6'));module[_0x95a4('0x7')]=function(_0x53a6a2,_0x9a92da){return _0x53a6a2[_0x95a4('0x8')]('ChatProactiveAction',attributes,{'tableName':_0x95a4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0b4=['util','api','moment','request-promise','path','rimraf','exports','define','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xa0b4,0xa4));var _0x4a0b=function(_0x5030ed,_0x1bb8d7){_0x5030ed=_0x5030ed-0x0;var _0x3eda42=_0xa0b4[_0x5030ed];return _0x3eda42;};'use strict';var _=require(_0x4a0b('0x0'));var util=require(_0x4a0b('0x1'));var logger=require('../../config/logger')(_0x4a0b('0x2'));var moment=require(_0x4a0b('0x3'));var BPromise=require('bluebird');var rp=require(_0x4a0b('0x4'));var fs=require('fs');var path=require(_0x4a0b('0x5'));var rimraf=require(_0x4a0b('0x6'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0x4a0b('0x7')]=function(_0x2805c1,_0x57b326){return _0x2805c1[_0x4a0b('0x8')](_0x4a0b('0x9'),attributes,{'tableName':_0x4a0b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index f715a66..755bb79 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 _0xbf7e=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash'];(function(_0x2a79b3,_0x1f35c8){var _0x592b1f=function(_0x2ae82c){while(--_0x2ae82c){_0x2a79b3['push'](_0x2a79b3['shift']());}};_0x592b1f(++_0x1f35c8);}(_0xbf7e,0x11d));var _0xebf7=function(_0x1b5c53,_0x463d41){_0x1b5c53=_0x1b5c53-0x0;var _0x304149=_0xbf7e[_0x1b5c53];return _0x304149;};'use strict';var _=require(_0xebf7('0x0'));var util=require(_0xebf7('0x1'));var moment=require(_0xebf7('0x2'));var BPromise=require(_0xebf7('0x3'));var rs=require(_0xebf7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xebf7('0x5'))['db'];var utils=require(_0xebf7('0x6'));var logger=require('../../config/logger')(_0xebf7('0x7'));var config=require(_0xebf7('0x8'));var jayson=require(_0xebf7('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x210962,_0x13f33b,_0x5e63db){return new BPromise(function(_0x2f57f3,_0x2391d2){return client[_0xebf7('0xa')](_0x210962,_0x5e63db)[_0xebf7('0xb')](function(_0x207f6f){logger[_0xebf7('0xc')](_0xebf7('0xd'),_0x13f33b,_0xebf7('0xe'));logger[_0xebf7('0xf')](_0xebf7('0x10'),_0x13f33b,'request\x20sent',JSON[_0xebf7('0x11')](_0x207f6f));if(_0x207f6f['error']){if(_0x207f6f['error'][_0xebf7('0x12')]===0x1f4){logger[_0xebf7('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x13f33b,_0x207f6f[_0xebf7('0x13')]['message']);return _0x2391d2(_0x207f6f[_0xebf7('0x13')]['message']);}logger['error'](_0xebf7('0xd'),_0x13f33b,_0x207f6f[_0xebf7('0x13')][_0xebf7('0x14')]);return _0x2f57f3(_0x207f6f[_0xebf7('0x13')][_0xebf7('0x14')]);}else{logger[_0xebf7('0xc')](_0xebf7('0xd'),_0x13f33b,_0xebf7('0xe'));_0x2f57f3(_0x207f6f['result']['message']);}})[_0xebf7('0x15')](function(_0x2d4d78){logger[_0xebf7('0x13')](_0xebf7('0xd'),_0x13f33b,_0x2d4d78);_0x2391d2(_0x2d4d78);});});} \ No newline at end of file +var _0x8ec4=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','message','result','lodash'];(function(_0x2ff834,_0x3e41f1){var _0x4bafcc=function(_0x17f786){while(--_0x17f786){_0x2ff834['push'](_0x2ff834['shift']());}};_0x4bafcc(++_0x3e41f1);}(_0x8ec4,0x1cb));var _0x48ec=function(_0x5a0ead,_0x2ca0ea){_0x5a0ead=_0x5a0ead-0x0;var _0x3e02de=_0x8ec4[_0x5a0ead];return _0x3e02de;};'use strict';var _=require(_0x48ec('0x0'));var util=require(_0x48ec('0x1'));var moment=require('moment');var BPromise=require(_0x48ec('0x2'));var rs=require(_0x48ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x48ec('0x4'))['db'];var utils=require(_0x48ec('0x5'));var logger=require(_0x48ec('0x6'))(_0x48ec('0x7'));var config=require(_0x48ec('0x8'));var jayson=require(_0x48ec('0x9'));var client=jayson['client'][_0x48ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d6081,_0x2bce8a,_0x227ee7){return new BPromise(function(_0x18d7f5,_0x263e11){return client[_0x48ec('0xb')](_0x3d6081,_0x227ee7)['then'](function(_0x48be14){logger[_0x48ec('0xc')](_0x48ec('0xd'),_0x2bce8a,_0x48ec('0xe'));logger[_0x48ec('0xf')](_0x48ec('0x10'),_0x2bce8a,_0x48ec('0xe'),JSON['stringify'](_0x48be14));if(_0x48be14[_0x48ec('0x11')]){if(_0x48be14[_0x48ec('0x11')]['code']===0x1f4){logger['error'](_0x48ec('0xd'),_0x2bce8a,_0x48be14['error'][_0x48ec('0x12')]);return _0x263e11(_0x48be14[_0x48ec('0x11')][_0x48ec('0x12')]);}logger['error'](_0x48ec('0xd'),_0x2bce8a,_0x48be14[_0x48ec('0x11')][_0x48ec('0x12')]);return _0x18d7f5(_0x48be14['error']['message']);}else{logger[_0x48ec('0xc')](_0x48ec('0xd'),_0x2bce8a,_0x48ec('0xe'));_0x18d7f5(_0x48be14[_0x48ec('0x13')][_0x48ec('0x12')]);}})['catch'](function(_0x115341){logger[_0x48ec('0x11')](_0x48ec('0xd'),_0x2bce8a,_0x115341);_0x263e11(_0x115341);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 3eac4df..40d1fb4 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 _0x8a75=['update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put'];(function(_0x45d868,_0x18d354){var _0x1262ce=function(_0x59fdd9){while(--_0x59fdd9){_0x45d868['push'](_0x45d868['shift']());}};_0x1262ce(++_0x18d354);}(_0x8a75,0x194));var _0x58a7=function(_0x2b6a66,_0x4e807f){_0x2b6a66=_0x2b6a66-0x0;var _0x5b3167=_0x8a75[_0x2b6a66];return _0x5b3167;};'use strict';var multer=require(_0x58a7('0x0'));var util=require(_0x58a7('0x1'));var path=require(_0x58a7('0x2'));var timeout=require('connect-timeout');var express=require(_0x58a7('0x3'));var router=express[_0x58a7('0x4')]();var auth=require(_0x58a7('0x5'));var interaction=require(_0x58a7('0x6'));var config=require(_0x58a7('0x7'));var controller=require(_0x58a7('0x8'));router[_0x58a7('0x9')](_0x58a7('0xa'),auth[_0x58a7('0xb')](),controller[_0x58a7('0xc')]);router[_0x58a7('0xd')]('/',auth[_0x58a7('0xb')](),controller[_0x58a7('0xe')]);router[_0x58a7('0xf')]('/:id',auth[_0x58a7('0xb')](),controller[_0x58a7('0x10')]);router[_0x58a7('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x58a7('0x12')]);module[_0x58a7('0x13')]=router; \ No newline at end of file +var _0x3a67=['create','update','destroy','exports','multer','util','express','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','post'];(function(_0x3901c9,_0x57eda4){var _0x3dad80=function(_0xbff6a9){while(--_0xbff6a9){_0x3901c9['push'](_0x3901c9['shift']());}};_0x3dad80(++_0x57eda4);}(_0x3a67,0x11c));var _0x73a6=function(_0x67d9d6,_0x1f046a){_0x67d9d6=_0x67d9d6-0x0;var _0x4412db=_0x3a67[_0x67d9d6];return _0x4412db;};'use strict';var multer=require(_0x73a6('0x0'));var util=require(_0x73a6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x73a6('0x2'));var router=express['Router']();var auth=require(_0x73a6('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x73a6('0x4'));var controller=require('./chatProactiveAction.controller');router[_0x73a6('0x5')](_0x73a6('0x6'),auth[_0x73a6('0x7')](),controller[_0x73a6('0x8')]);router[_0x73a6('0x9')]('/',auth[_0x73a6('0x7')](),controller[_0x73a6('0xa')]);router['put'](_0x73a6('0x6'),auth[_0x73a6('0x7')](),controller[_0x73a6('0xb')]);router['delete'](_0x73a6('0x6'),auth[_0x73a6('0x7')](),controller[_0x73a6('0xc')]);module[_0x73a6('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 4dc4ad0..056682c 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 _0xb13d=['name','ENUM','rrmemory','beepall','roundrobin','STRING'];(function(_0x2e35a6,_0x5ef737){var _0x450c20=function(_0x4c68cf){while(--_0x4c68cf){_0x2e35a6['push'](_0x2e35a6['shift']());}};_0x450c20(++_0x5ef737);}(_0xb13d,0xf5));var _0xdb13=function(_0x4b3b91,_0x1e3599){_0x4b3b91=_0x4b3b91-0x0;var _0x266528=_0xb13d[_0x4b3b91];return _0x266528;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdb13('0x0')],'unique':_0xdb13('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdb13('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdb13('0x2')](_0xdb13('0x3'),_0xdb13('0x4'),_0xdb13('0x5'))}}; \ No newline at end of file +var _0x8402=['roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM','beepall'];(function(_0x133ec9,_0x35a25e){var _0x511a86=function(_0x3545ec){while(--_0x3545ec){_0x133ec9['push'](_0x133ec9['shift']());}};_0x511a86(++_0x35a25e);}(_0x8402,0x199));var _0x2840=function(_0x4ff54d,_0x371b61){_0x4ff54d=_0x4ff54d-0x0;var _0x3984e7=_0x8402[_0x4ff54d];return _0x3984e7;};'use strict';var Sequelize=require(_0x2840('0x0'));module[_0x2840('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2840('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2840('0x3')]},'timeout':{'type':Sequelize[_0x2840('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2840('0x5')]('rrmemory',_0x2840('0x6'),_0x2840('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 9199168..61d90de 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 _0x1e89=['length','hasOwnProperty','nolimit','order','sort','filters','pick','where','filter','includeAll','include','findAll','rows','show','params','keys','rawAttributes','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserChatQueue','ChatQueueId','User','findAndCountAll','updatedAt','format','%s/%s','chatPause','createdAt','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','each','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','transaction','removeAgents','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','util','path','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','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','save','update','then','destroy','get','ChatQueues','UserProfileResource','end','stack','name','send','index','map','ChatQueue','fieldName','type','model','query','intersection','attributes','fields'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x1e89,0xee));var _0x91e8=function(_0x2cc8d6,_0x929873){_0x2cc8d6=_0x2cc8d6-0x0;var _0x1fa8ba=_0x1e89[_0x2cc8d6];return _0x1fa8ba;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x91e8('0x0'));var rimraf=require(_0x91e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x91e8('0x2'));var moment=require(_0x91e8('0x3'));var BPromise=require(_0x91e8('0x4'));var Mustache=require('mustache');var util=require(_0x91e8('0x5'));var path=require(_0x91e8('0x6'));var sox=require(_0x91e8('0x7'));var csv=require(_0x91e8('0x8'));var ejs=require(_0x91e8('0x9'));var fs=require('fs');var _=require(_0x91e8('0xa'));var squel=require('squel');var crypto=require(_0x91e8('0xb'));var jsforce=require(_0x91e8('0xc'));var deskjs=require(_0x91e8('0xd'));var toCsv=require(_0x91e8('0x8'));var querystring=require(_0x91e8('0xe'));var Papa=require(_0x91e8('0xf'));var Redis=require(_0x91e8('0x10'));var authService=require(_0x91e8('0x11'));var qs=require(_0x91e8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91e8('0x13'));var logger=require(_0x91e8('0x14'))(_0x91e8('0x15'));var utils=require(_0x91e8('0x16'));var config=require(_0x91e8('0x17'));var licenseUtil=require(_0x91e8('0x18'));var db=require('../../mysqldb')['db'];config[_0x91e8('0x19')]=_[_0x91e8('0x1a')](config['redis'],{'host':_0x91e8('0x1b'),'port':0x18eb});var socket=require(_0x91e8('0x1c'))(new Redis(config[_0x91e8('0x19')]));require('./chatQueue.socket')['register'](socket);var jayson=require(_0x91e8('0x1d'));var client=jayson[_0x91e8('0x1e')][_0x91e8('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1fbebc,_0x450beb,_0x25db81,_0x4a9b0c){return new BPromise(function(_0x16db0f,_0x559491){var _0x2bf36f=_0x4a9b0c||client;return _0x2bf36f[_0x91e8('0x20')](_0x1fbebc,_0x25db81)['then'](function(_0x28973a){logger[_0x91e8('0x21')]('ChatQueue,\x20%s,\x20%s',_0x450beb,_0x91e8('0x22'));logger[_0x91e8('0x23')](_0x91e8('0x24'),_0x450beb,_0x91e8('0x22'),JSON[_0x91e8('0x25')](_0x28973a));if(_0x28973a['error']){if(_0x28973a[_0x91e8('0x26')][_0x91e8('0x27')]===0x1f4){logger[_0x91e8('0x26')](_0x91e8('0x28'),_0x450beb,_0x28973a[_0x91e8('0x26')][_0x91e8('0x29')]);return _0x559491(_0x28973a['error'][_0x91e8('0x29')]);}logger[_0x91e8('0x26')](_0x91e8('0x28'),_0x450beb,_0x28973a[_0x91e8('0x26')][_0x91e8('0x29')]);return _0x16db0f(_0x28973a[_0x91e8('0x26')]['message']);}else{logger[_0x91e8('0x21')]('ChatQueue,\x20%s,\x20%s',_0x450beb,_0x91e8('0x22'));_0x16db0f(_0x28973a['result'][_0x91e8('0x29')]);}})[_0x91e8('0x2a')](function(_0x737303){logger[_0x91e8('0x26')](_0x91e8('0x28'),_0x450beb,_0x737303);_0x559491(_0x737303);});});}function respondWithStatusCode(_0x548e2e,_0x4aa4e){_0x4aa4e=_0x4aa4e||0xcc;return function(_0x1e8623){if(_0x1e8623){return _0x548e2e[_0x91e8('0x2b')](_0x4aa4e);}return _0x548e2e['status'](_0x4aa4e)['end']();};}function respondWithResult(_0x363579,_0x6b21be){_0x6b21be=_0x6b21be||0xc8;return function(_0x598f32){if(_0x598f32){return _0x363579[_0x91e8('0x2c')](_0x6b21be)[_0x91e8('0x2d')](_0x598f32);}};}function respondWithFilteredResult(_0x164445,_0xe6db03){return function(_0x2195f5){if(_0x2195f5){var _0x46cc61=_0x2195f5[_0x91e8('0x2e')],_0x4f5629=_0xe6db03['offset'],_0x4599aa=_0xe6db03[_0x91e8('0x2f')]+_0xe6db03[_0x91e8('0x30')],_0x29ce95;if(_0x4599aa>=_0x46cc61){_0x4599aa=_0x46cc61;_0x29ce95=0xc8;}else{_0x29ce95=0xce;}_0x164445[_0x91e8('0x2c')](_0x29ce95);return _0x164445[_0x91e8('0x31')](_0x91e8('0x32'),_0x4f5629+'-'+_0x4599aa+'/'+_0x46cc61)[_0x91e8('0x2d')](_0x2195f5);}return null;};}function patchUpdates(_0x17ced6){return function(_0x2c0fcc){try{jsonpatch['apply'](_0x2c0fcc,_0x17ced6,!![]);}catch(_0x131af3){return BPromise['reject'](_0x131af3);}return _0x2c0fcc[_0x91e8('0x33')]();};}function saveUpdates(_0x6b62bd,_0x59f912){return function(_0x30e3ea){if(_0x30e3ea){return _0x30e3ea[_0x91e8('0x34')](_0x6b62bd)[_0x91e8('0x35')](function(_0x7bd23b){return _0x7bd23b;});}return null;};}function removeEntity(_0x35cc90,_0x24150b){return function(_0x5a6ba3){if(_0x5a6ba3){return _0x5a6ba3[_0x91e8('0x36')]()[_0x91e8('0x35')](function(){var _0x37e568=_0x5a6ba3[_0x91e8('0x37')]({'plain':!![]});var _0x40ad0c=_0x91e8('0x38');return db[_0x91e8('0x39')][_0x91e8('0x36')]({'where':{'type':_0x40ad0c,'resourceId':_0x37e568['id']}})[_0x91e8('0x35')](function(){return _0x5a6ba3;});})['then'](function(){_0x35cc90[_0x91e8('0x2c')](0xcc)[_0x91e8('0x3a')]();});}};}function handleEntityNotFound(_0x3d2b99,_0x5d5a1e){return function(_0x414249){if(!_0x414249){_0x3d2b99[_0x91e8('0x2b')](0x194);}return _0x414249;};}function handleError(_0x40208d,_0x4ce5c1){_0x4ce5c1=_0x4ce5c1||0x1f4;return function(_0x19ed96){logger[_0x91e8('0x26')](_0x19ed96[_0x91e8('0x3b')]);if(_0x19ed96[_0x91e8('0x3c')]){delete _0x19ed96[_0x91e8('0x3c')];}_0x40208d['status'](_0x4ce5c1)[_0x91e8('0x3d')](_0x19ed96);};}exports[_0x91e8('0x3e')]=function(_0x2c8c24,_0x2194a0){var _0x45fdb8={},_0x56a495={},_0x3fa3cd={'count':0x0,'rows':[]};var _0x2df565=_[_0x91e8('0x3f')](db[_0x91e8('0x40')]['rawAttributes'],function(_0x11b052){return{'name':_0x11b052[_0x91e8('0x41')],'type':_0x11b052[_0x91e8('0x42')]['key']};});_0x56a495[_0x91e8('0x43')]=_[_0x91e8('0x3f')](_0x2df565,_0x91e8('0x3c'));_0x56a495[_0x91e8('0x44')]=_['keys'](_0x2c8c24[_0x91e8('0x44')]);_0x56a495['filters']=_[_0x91e8('0x45')](_0x56a495[_0x91e8('0x43')],_0x56a495['query']);_0x45fdb8[_0x91e8('0x46')]=_[_0x91e8('0x45')](_0x56a495[_0x91e8('0x43')],qs[_0x91e8('0x47')](_0x2c8c24[_0x91e8('0x44')]['fields']));_0x45fdb8[_0x91e8('0x46')]=_0x45fdb8[_0x91e8('0x46')][_0x91e8('0x48')]?_0x45fdb8['attributes']:_0x56a495[_0x91e8('0x43')];if(!_0x2c8c24['query'][_0x91e8('0x49')](_0x91e8('0x4a'))){_0x45fdb8['limit']=qs[_0x91e8('0x30')](_0x2c8c24[_0x91e8('0x44')][_0x91e8('0x30')]);_0x45fdb8['offset']=qs[_0x91e8('0x2f')](_0x2c8c24[_0x91e8('0x44')][_0x91e8('0x2f')]);}_0x45fdb8[_0x91e8('0x4b')]=qs[_0x91e8('0x4c')](_0x2c8c24['query'][_0x91e8('0x4c')]);_0x45fdb8['where']=qs[_0x91e8('0x4d')](_[_0x91e8('0x4e')](_0x2c8c24[_0x91e8('0x44')],_0x56a495[_0x91e8('0x4d')]),_0x2df565);if(_0x2c8c24[_0x91e8('0x44')]['filter']){_0x45fdb8[_0x91e8('0x4f')]=_['merge'](_0x45fdb8['where'],{'$or':_[_0x91e8('0x3f')](_0x2df565,function(_0x17beed){if(_0x17beed[_0x91e8('0x42')]!=='VIRTUAL'){var _0x4bc6b0={};_0x4bc6b0[_0x17beed['name']]={'$like':'%'+_0x2c8c24[_0x91e8('0x44')][_0x91e8('0x50')]+'%'};return _0x4bc6b0;}})});}_0x45fdb8=_['merge']({},_0x45fdb8,_0x2c8c24['options']);var _0x4313e2={'where':_0x45fdb8[_0x91e8('0x4f')]};return db[_0x91e8('0x40')][_0x91e8('0x2e')](_0x4313e2)[_0x91e8('0x35')](function(_0x7637b){_0x3fa3cd['count']=_0x7637b;if(_0x2c8c24[_0x91e8('0x44')][_0x91e8('0x51')]){_0x45fdb8[_0x91e8('0x52')]=[{'all':!![]}];}return db[_0x91e8('0x40')][_0x91e8('0x53')](_0x45fdb8);})[_0x91e8('0x35')](function(_0x2676ac){_0x3fa3cd[_0x91e8('0x54')]=_0x2676ac;return _0x3fa3cd;})[_0x91e8('0x35')](respondWithFilteredResult(_0x2194a0,_0x45fdb8))[_0x91e8('0x2a')](handleError(_0x2194a0,null));};exports[_0x91e8('0x55')]=function(_0xda2f72,_0x251dd9){var _0x39dfaa={'raw':!![],'where':{'id':_0xda2f72[_0x91e8('0x56')]['id']}},_0x53d762={};_0x53d762[_0x91e8('0x43')]=_[_0x91e8('0x57')](db[_0x91e8('0x40')][_0x91e8('0x58')]);_0x53d762['query']=_['keys'](_0xda2f72[_0x91e8('0x44')]);_0x53d762[_0x91e8('0x4d')]=_[_0x91e8('0x45')](_0x53d762[_0x91e8('0x43')],_0x53d762[_0x91e8('0x44')]);_0x39dfaa[_0x91e8('0x46')]=_['intersection'](_0x53d762['model'],qs[_0x91e8('0x47')](_0xda2f72[_0x91e8('0x44')][_0x91e8('0x47')]));_0x39dfaa[_0x91e8('0x46')]=_0x39dfaa[_0x91e8('0x46')][_0x91e8('0x48')]?_0x39dfaa[_0x91e8('0x46')]:_0x53d762[_0x91e8('0x43')];if(_0xda2f72[_0x91e8('0x44')][_0x91e8('0x51')]){_0x39dfaa[_0x91e8('0x52')]=[{'all':!![]}];}_0x39dfaa=_[_0x91e8('0x59')]({},_0x39dfaa,_0xda2f72[_0x91e8('0x5a')]);return db['ChatQueue'][_0x91e8('0x5b')](_0x39dfaa)[_0x91e8('0x35')](handleEntityNotFound(_0x251dd9,null))[_0x91e8('0x35')](respondWithResult(_0x251dd9,null))[_0x91e8('0x2a')](handleError(_0x251dd9,null));};exports[_0x91e8('0x5c')]=function(_0x7abe4e,_0x12d1e7){return db[_0x91e8('0x40')][_0x91e8('0x5c')](_0x7abe4e['body'],{})[_0x91e8('0x35')](function(_0x1e6383){var _0x2d8cf8=_0x7abe4e[_0x91e8('0x5d')][_0x91e8('0x37')]({'plain':!![]});if(!_0x2d8cf8)throw new Error(_0x91e8('0x5e'));if(_0x2d8cf8[_0x91e8('0x5f')]===_0x91e8('0x5d')){var _0x1b031f=_0x1e6383['get']({'plain':!![]});var _0x252a42='ChatQueues';return db[_0x91e8('0x60')][_0x91e8('0x5b')]({'where':{'name':_0x252a42,'userProfileId':_0x2d8cf8[_0x91e8('0x61')]},'raw':!![]})[_0x91e8('0x35')](function(_0x2f84a8){if(_0x2f84a8&&_0x2f84a8[_0x91e8('0x62')]===0x0){return db['UserProfileResource'][_0x91e8('0x5c')]({'name':_0x1b031f[_0x91e8('0x3c')],'resourceId':_0x1b031f['id'],'type':_0x2f84a8['name'],'sectionId':_0x2f84a8['id']},{})[_0x91e8('0x35')](function(){return _0x1e6383;});}else{return _0x1e6383;}})[_0x91e8('0x2a')](function(_0x1d7f5e){logger[_0x91e8('0x26')](_0x91e8('0x63'),_0x1d7f5e);throw _0x1d7f5e;});}return _0x1e6383;})[_0x91e8('0x35')](respondWithResult(_0x12d1e7,0xc9))[_0x91e8('0x2a')](handleError(_0x12d1e7,null));};exports[_0x91e8('0x34')]=function(_0x29fb14,_0x3b5440){if(_0x29fb14[_0x91e8('0x64')]['id']){delete _0x29fb14[_0x91e8('0x64')]['id'];}return db['ChatQueue'][_0x91e8('0x5b')]({'where':{'id':_0x29fb14['params']['id']}})[_0x91e8('0x35')](handleEntityNotFound(_0x3b5440,null))[_0x91e8('0x35')](saveUpdates(_0x29fb14[_0x91e8('0x64')],null))[_0x91e8('0x35')](respondWithResult(_0x3b5440,null))[_0x91e8('0x2a')](handleError(_0x3b5440,null));};exports[_0x91e8('0x36')]=function(_0x2bfe6d,_0x385bad){return db[_0x91e8('0x40')][_0x91e8('0x5b')]({'where':{'id':_0x2bfe6d[_0x91e8('0x56')]['id']}})[_0x91e8('0x35')](handleEntityNotFound(_0x385bad,null))[_0x91e8('0x35')](removeEntity(_0x385bad,null))[_0x91e8('0x2a')](handleError(_0x385bad,null));};exports[_0x91e8('0x65')]=function(_0x20e1be,_0x52393f){return db[_0x91e8('0x40')][_0x91e8('0x65')]()[_0x91e8('0x35')](respondWithResult(_0x52393f,null))[_0x91e8('0x2a')](handleError(_0x52393f,null));};exports[_0x91e8('0x66')]=function(_0x1911b1,_0x3ee148,_0xfb30ed){var _0x28ec20={'raw':!![],'where':{}},_0x27fa38={},_0x5bca32;return db[_0x91e8('0x40')]['findOne']({'where':{'id':_0x1911b1['params']['id']}})['then'](handleEntityNotFound(_0x3ee148,null))[_0x91e8('0x35')](function(_0x457122){if(_0x457122){_0x5bca32=_0x457122[_0x91e8('0x37')]({'plain':!![]});_0x27fa38[_0x91e8('0x43')]=_[_0x91e8('0x57')](db[_0x91e8('0x67')][_0x91e8('0x58')]);_0x27fa38[_0x91e8('0x44')]=_[_0x91e8('0x57')](_0x1911b1[_0x91e8('0x44')]);_0x27fa38[_0x91e8('0x4d')]=_['intersection'](_0x27fa38[_0x91e8('0x43')],_0x27fa38[_0x91e8('0x44')]);_0x28ec20[_0x91e8('0x46')]=_['intersection'](_0x27fa38[_0x91e8('0x43')],qs[_0x91e8('0x47')](_0x1911b1[_0x91e8('0x44')][_0x91e8('0x47')]));_0x28ec20[_0x91e8('0x46')]=_0x28ec20[_0x91e8('0x46')][_0x91e8('0x48')]?_0x28ec20['attributes']:_0x27fa38['model'];if(!_0x1911b1[_0x91e8('0x44')][_0x91e8('0x49')](_0x91e8('0x4a'))){_0x28ec20[_0x91e8('0x30')]=qs[_0x91e8('0x30')](_0x1911b1[_0x91e8('0x44')][_0x91e8('0x30')]);_0x28ec20[_0x91e8('0x2f')]=qs[_0x91e8('0x2f')](_0x1911b1[_0x91e8('0x44')][_0x91e8('0x2f')]);}_0x28ec20[_0x91e8('0x4b')]=qs[_0x91e8('0x4c')](_0x1911b1['query'][_0x91e8('0x4c')]);_0x28ec20[_0x91e8('0x4f')]=qs[_0x91e8('0x4d')](_[_0x91e8('0x4e')](_0x1911b1[_0x91e8('0x44')],_0x27fa38[_0x91e8('0x4d')]));_0x28ec20['where'][_0x91e8('0x68')]=_0x457122['id'];if(_0x1911b1['query'][_0x91e8('0x50')]){_0x28ec20[_0x91e8('0x4f')]=_[_0x91e8('0x59')](_0x28ec20[_0x91e8('0x4f')],{'$or':_[_0x91e8('0x3f')](_0x28ec20[_0x91e8('0x46')],function(_0x2ae088){var _0xbedd0={};_0xbedd0[_0x2ae088]={'$like':'%'+_0x1911b1['query'][_0x91e8('0x50')]+'%'};return _0xbedd0;})});}_0x28ec20=_['merge']({},_0x28ec20,_0x1911b1[_0x91e8('0x5a')]);return db[_0x91e8('0x67')]['findAll'](_0x28ec20);}})[_0x91e8('0x35')](function(_0x18c92e){if(_0x18c92e){return db[_0x91e8('0x69')][_0x91e8('0x6a')]({'where':{'id':_[_0x91e8('0x3f')](_0x18c92e,'UserId'),'role':'agent'},'attributes':['id',_0x91e8('0x3c'),'chatPause',_0x91e8('0x6b'),'createdAt']});}})['then'](function(_0xc7c4f5){if(_0xc7c4f5){return{'count':_0xc7c4f5[_0x91e8('0x2e')],'rows':_[_0x91e8('0x3f')](_0xc7c4f5[_0x91e8('0x54')],function(_0x3513a6){return{'membername':_0x3513a6['name'],'UserId':_0x3513a6['id'],'queue_name':_0x5bca32[_0x91e8('0x3c')],'ChatQueueId':_0x5bca32['id'],'interface':util[_0x91e8('0x6c')](_0x91e8('0x6d'),'SIP',_0x3513a6[_0x91e8('0x3c')]),'penalty':0x0,'paused':_0x3513a6[_0x91e8('0x6e')],'createdAt':_0x3513a6[_0x91e8('0x6f')],'updatedAt':_0x3513a6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x91e8('0x35')](respondWithFilteredResult(_0x3ee148,_0x28ec20))['catch'](handleError(_0x3ee148,null));};exports[_0x91e8('0x70')]=function(_0x81cad7,_0x393c7c,_0x3722c0){var _0x56341b={};var _0x48c416={};var _0x32a51f;var _0x539062;return db[_0x91e8('0x40')][_0x91e8('0x71')]({'where':{'id':_0x81cad7[_0x91e8('0x56')]['id']}})[_0x91e8('0x35')](handleEntityNotFound(_0x393c7c,null))[_0x91e8('0x35')](function(_0x3a5cdd){if(_0x3a5cdd){_0x32a51f=_0x3a5cdd;_0x48c416['model']=_[_0x91e8('0x57')](db[_0x91e8('0x72')][_0x91e8('0x58')]);_0x48c416[_0x91e8('0x44')]=_[_0x91e8('0x57')](_0x81cad7['query']);_0x48c416[_0x91e8('0x4d')]=_['intersection'](_0x48c416['model'],_0x48c416['query']);_0x56341b[_0x91e8('0x46')]=_['intersection'](_0x48c416[_0x91e8('0x43')],qs['fields'](_0x81cad7[_0x91e8('0x44')][_0x91e8('0x47')]));_0x56341b[_0x91e8('0x46')]=_0x56341b[_0x91e8('0x46')][_0x91e8('0x48')]?_0x56341b[_0x91e8('0x46')]:_0x48c416[_0x91e8('0x43')];_0x56341b[_0x91e8('0x4b')]=qs[_0x91e8('0x4c')](_0x81cad7[_0x91e8('0x44')][_0x91e8('0x4c')]);_0x56341b[_0x91e8('0x4f')]=qs[_0x91e8('0x4d')](_['pick'](_0x81cad7['query'],_0x48c416['filters']));if(_0x81cad7[_0x91e8('0x44')][_0x91e8('0x50')]){_0x56341b[_0x91e8('0x4f')]=_[_0x91e8('0x59')](_0x56341b[_0x91e8('0x4f')],{'$or':_[_0x91e8('0x3f')](_0x56341b[_0x91e8('0x46')],function(_0x451e62){var _0x336829={};_0x336829[_0x451e62]={'$like':'%'+_0x81cad7[_0x91e8('0x44')][_0x91e8('0x50')]+'%'};return _0x336829;})});}_0x56341b=_['merge']({},_0x56341b,_0x81cad7[_0x91e8('0x5a')]);return _0x32a51f[_0x91e8('0x70')](_0x56341b);}})[_0x91e8('0x35')](function(_0x7074e){if(_0x7074e){_0x539062=_0x7074e['length'];if(!_0x81cad7[_0x91e8('0x44')]['hasOwnProperty'](_0x91e8('0x4a'))){_0x56341b[_0x91e8('0x30')]=qs[_0x91e8('0x30')](_0x81cad7[_0x91e8('0x44')][_0x91e8('0x30')]);_0x56341b[_0x91e8('0x2f')]=qs[_0x91e8('0x2f')](_0x81cad7[_0x91e8('0x44')]['offset']);}return _0x32a51f[_0x91e8('0x70')](_0x56341b);}})['then'](function(_0x4695f7){if(_0x4695f7){return _0x4695f7?{'count':_0x539062,'rows':_0x4695f7}:null;}})['then'](respondWithResult(_0x393c7c,null))['catch'](handleError(_0x393c7c,null));};exports[_0x91e8('0x73')]=function(_0x474660,_0x46a101,_0x1bd120){var _0x57977e=_0x474660[_0x91e8('0x64')][_0x91e8('0x74')];return db[_0x91e8('0x72')]['findAll']({'where':{'id':_0x57977e},'attributes':['id'],'include':[{'model':db['User'],'as':_0x91e8('0x75'),'attributes':['id','name',_0x91e8('0x76'),_0x91e8('0x77'),_0x91e8('0x78')],'raw':!![]}]})['then'](function(_0x68c91d){if(_0x68c91d){var _0x58d42b=_[_0x91e8('0x79')](_0x68c91d,function(_0x5c00c6){var _0x3add73=_0x5c00c6[_0x91e8('0x37')]({'plain':!![]});return _0x3add73[_0x91e8('0x75')];});return db[_0x91e8('0x40')][_0x91e8('0x5b')]({'where':{'id':_0x474660[_0x91e8('0x56')]['id']}})[_0x91e8('0x35')](function(_0x474f50){return db['sequelize']['transaction'](function(_0x5c97b3){return _0x474f50[_0x91e8('0x73')](_0x57977e,{'transaction':_0x5c97b3})[_0x91e8('0x35')](function(){return BPromise[_0x91e8('0x7a')](_0x58d42b,function(_0x622630){return db[_0x91e8('0x67')]['findOrCreate']({'where':{'UserId':_0x622630['id'],'ChatQueueId':_0x474660[_0x91e8('0x56')]['id']},'transaction':_0x5c97b3});});})[_0x91e8('0x35')](function(){_0x58d42b[_0x91e8('0x7b')](function(_0x560dcc){socket[_0x91e8('0x7c')](_0x91e8('0x7d'),{'UserId':_0x560dcc['id'],'ChatQueueId':_0x474f50['id']});});});});});}})[_0x91e8('0x35')](respondWithStatusCode(_0x46a101,null))[_0x91e8('0x2a')](handleError(_0x46a101,null));};exports[_0x91e8('0x7e')]=function(_0x584664,_0x1e7334,_0x4c8395){return db[_0x91e8('0x72')]['findAll']({'where':{'id':_0x584664[_0x91e8('0x44')][_0x91e8('0x74')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x91e8('0x75'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1e7334,null))['then'](function(_0x31e736){var _0x1850a7=_[_0x91e8('0x3f')](_0x31e736,'id');var _0x18d12a=[];var _0x245f9c=[];var _0x51c921=squel[_0x91e8('0x7f')]();_0x51c921[_0x91e8('0x80')](_0x91e8('0x81'))[_0x91e8('0x82')]('team_has_chat_queues','tq')[_0x91e8('0x83')](_0x91e8('0x84'),'ut',_0x91e8('0x85'))[_0x91e8('0x4f')](_0x91e8('0x86'),_0x584664[_0x91e8('0x56')]['id']);for(var _0x2c5b47=0x0;_0x2c5b47<_0x31e736[_0x91e8('0x48')];_0x2c5b47+=0x1){let _0x15df23=_0x31e736[_0x2c5b47];for(var _0xaa733c=0x0;_0xaa733c<_0x15df23[_0x91e8('0x75')][_0x91e8('0x48')];_0xaa733c+=0x1){let _0x3d474c=_0x15df23[_0x91e8('0x75')][_0xaa733c];var _0x1e02e6=_0x51c921['clone']();_0x1e02e6[_0x91e8('0x4f')](_0x91e8('0x87'),_0x3d474c['id']);_0x245f9c[_0x91e8('0x88')](db['sequelize'][_0x91e8('0x44')](_0x1e02e6[_0x91e8('0x89')](),{'type':db[_0x91e8('0x8a')][_0x91e8('0x8b')][_0x91e8('0x8c')]})[_0x91e8('0x35')](function(_0x5a8a51){if(_0x5a8a51[_0x91e8('0x48')]===0x1){return _0x3d474c['id'];}else{var _0x2232af=_[_0x91e8('0x8d')](_[_0x91e8('0x3f')](_0x5a8a51,_0x91e8('0x8e')),function(_0xd1816e){return _[_0x91e8('0x8f')](_0x1850a7,_0xd1816e);});if(_0x2232af){return _0x3d474c['id'];}}}));}}return BPromise[_0x91e8('0x90')](_0x245f9c)['then'](function(_0x286ff8){_0x18d12a=_(_0x18d12a)['union'](_0x286ff8)[_0x91e8('0x91')]()[_0x91e8('0x92')]();return db[_0x91e8('0x40')]['find']({'where':{'id':_0x584664[_0x91e8('0x56')]['id']}})['then'](function(_0x1a4568){return db[_0x91e8('0x8a')][_0x91e8('0x93')](function(_0x5732e0){return _0x1a4568[_0x91e8('0x7e')](_0x584664[_0x91e8('0x44')][_0x91e8('0x74')],{'transaction':_0x5732e0})[_0x91e8('0x35')](function(){if(!_['isEmpty'](_0x18d12a)){return _0x1a4568[_0x91e8('0x94')](_0x18d12a,{'transaction':_0x5732e0});}})[_0x91e8('0x35')](function(){_0x18d12a['forEach'](function(_0x5c2028){socket[_0x91e8('0x7c')]('userChatQueue:remove',{'UserId':_0x5c2028,'ChatQueueId':_0x1a4568['id']});});});});});});})[_0x91e8('0x35')](respondWithStatusCode(_0x1e7334,null))['catch'](handleError(_0x1e7334,null));};exports['addAgents']=function(_0x49ce14,_0x3bf12,_0x3ecef7){return db['ChatQueue']['find']({'where':{'id':_0x49ce14[_0x91e8('0x56')]['id']}})[_0x91e8('0x35')](handleEntityNotFound(_0x3bf12,null))['then'](function(_0x1503c5){if(_0x1503c5){return _0x1503c5[_0x91e8('0x95')](_0x49ce14['body']['ids'],_[_0x91e8('0x96')](_0x49ce14['body'],['ids','id'])||{})[_0x91e8('0x97')](function(_0x1e1281){for(var _0x3bb841=0x0;_0x3bb841<_0x49ce14[_0x91e8('0x64')][_0x91e8('0x74')][_0x91e8('0x48')];_0x3bb841+=0x1){socket[_0x91e8('0x7c')](_0x91e8('0x7d'),{'UserId':_0x49ce14[_0x91e8('0x64')][_0x91e8('0x74')][_0x3bb841],'ChatQueueId':_0x49ce14[_0x91e8('0x56')]['id']});}return _0x1e1281;});}})[_0x91e8('0x35')](respondWithResult(_0x3bf12,null))[_0x91e8('0x2a')](handleError(_0x3bf12,null));};exports[_0x91e8('0x94')]=function(_0x7b4284,_0x1fdf0f,_0x1593c9){return db[_0x91e8('0x40')][_0x91e8('0x5b')]({'where':{'id':_0x7b4284[_0x91e8('0x56')]['id']}})['then'](handleEntityNotFound(_0x1fdf0f,null))[_0x91e8('0x35')](function(_0x4689cf){if(_0x4689cf){return _0x4689cf[_0x91e8('0x94')](_0x7b4284['query'][_0x91e8('0x74')])['then'](function(){if(_[_0x91e8('0x98')](_0x7b4284[_0x91e8('0x44')][_0x91e8('0x74')])){for(var _0x3bc58e=0x0;_0x3bc58e<_0x7b4284['query'][_0x91e8('0x74')][_0x91e8('0x48')];_0x3bc58e+=0x1){socket['emit'](_0x91e8('0x99'),{'UserId':Number(_0x7b4284['query'][_0x91e8('0x74')][_0x3bc58e]),'ChatQueueId':Number(_0x7b4284[_0x91e8('0x56')]['id'])});}}else{socket[_0x91e8('0x7c')](_0x91e8('0x99'),{'UserId':Number(_0x7b4284[_0x91e8('0x44')]['ids']),'ChatQueueId':Number(_0x7b4284[_0x91e8('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x1fdf0f,null))[_0x91e8('0x2a')](handleError(_0x1fdf0f,null));};exports['getAgents']=function(_0x430394,_0x3ed462,_0x162c45){var _0x34a29e={};var _0x2a5df0={};var _0x20b213;var _0x5657e1;return db['ChatQueue'][_0x91e8('0x71')]({'where':{'id':_0x430394[_0x91e8('0x56')]['id']}})['then'](handleEntityNotFound(_0x3ed462,null))['then'](function(_0x2f1322){if(_0x2f1322){_0x20b213=_0x2f1322;_0x2a5df0[_0x91e8('0x43')]=_['keys'](db[_0x91e8('0x69')][_0x91e8('0x58')]);_0x2a5df0[_0x91e8('0x44')]=_[_0x91e8('0x57')](_0x430394[_0x91e8('0x44')]);_0x2a5df0['filters']=_[_0x91e8('0x45')](_0x2a5df0[_0x91e8('0x43')],_0x2a5df0[_0x91e8('0x44')]);_0x34a29e[_0x91e8('0x46')]=_[_0x91e8('0x45')](_0x2a5df0[_0x91e8('0x43')],qs['fields'](_0x430394['query'][_0x91e8('0x47')]));_0x34a29e[_0x91e8('0x46')]=_0x34a29e[_0x91e8('0x46')][_0x91e8('0x48')]?_0x34a29e[_0x91e8('0x46')]:_0x2a5df0['model'];_0x34a29e[_0x91e8('0x4b')]=qs['sort'](_0x430394['query'][_0x91e8('0x4c')]);_0x34a29e[_0x91e8('0x4f')]=qs[_0x91e8('0x4d')](_[_0x91e8('0x4e')](_0x430394[_0x91e8('0x44')],_0x2a5df0[_0x91e8('0x4d')]));if(_0x430394['query'][_0x91e8('0x50')]){_0x34a29e[_0x91e8('0x4f')]=_[_0x91e8('0x59')](_0x34a29e['where'],{'$or':_[_0x91e8('0x3f')](_0x34a29e['attributes'],function(_0x427511){var _0x523a8a={};_0x523a8a[_0x427511]={'$like':'%'+_0x430394[_0x91e8('0x44')][_0x91e8('0x50')]+'%'};return _0x523a8a;})});}_0x34a29e=_[_0x91e8('0x59')]({},_0x34a29e,_0x430394[_0x91e8('0x5a')]);return _0x20b213['getAgents'](_0x34a29e);}})['then'](function(_0x5957b0){if(_0x5957b0){_0x5657e1=_0x5957b0[_0x91e8('0x48')];if(!_0x430394[_0x91e8('0x44')][_0x91e8('0x49')](_0x91e8('0x4a'))){_0x34a29e[_0x91e8('0x30')]=qs[_0x91e8('0x30')](_0x430394[_0x91e8('0x44')][_0x91e8('0x30')]);_0x34a29e['offset']=qs[_0x91e8('0x2f')](_0x430394[_0x91e8('0x44')][_0x91e8('0x2f')]);}return _0x20b213[_0x91e8('0x9a')](_0x34a29e);}})[_0x91e8('0x35')](function(_0x4c0c9d){if(_0x4c0c9d){return _0x4c0c9d?{'count':_0x5657e1,'rows':_0x4c0c9d}:null;}})[_0x91e8('0x35')](respondWithResult(_0x3ed462,null))[_0x91e8('0x2a')](handleError(_0x3ed462,null));}; \ No newline at end of file +var _0xe243=['addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from','user_has_teams','ChatQueueId\x20=\x20?','clone','push','QueryTypes','every','TeamId','includes','all','union','compact','value','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','jayson/promise','client','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','end','status','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','ChatQueue','include','findAll','rows','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','pick','User','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team'];(function(_0x581c10,_0x26e292){var _0x48da43=function(_0x347e56){while(--_0x347e56){_0x581c10['push'](_0x581c10['shift']());}};_0x48da43(++_0x26e292);}(_0xe243,0x1ed));var _0x3e24=function(_0x3fccbb,_0x473396){_0x3fccbb=_0x3fccbb-0x0;var _0x11df6e=_0xe243[_0x3fccbb];return _0x11df6e;};'use strict';var pdf=require(_0x3e24('0x0'));var emlformat=require(_0x3e24('0x1'));var rimraf=require(_0x3e24('0x2'));var zipdir=require(_0x3e24('0x3'));var jsonpatch=require(_0x3e24('0x4'));var rp=require(_0x3e24('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3e24('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x3e24('0x7'));var ejs=require(_0x3e24('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3e24('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x3e24('0xa'));var toCsv=require(_0x3e24('0x7'));var querystring=require(_0x3e24('0xb'));var Papa=require(_0x3e24('0xc'));var Redis=require(_0x3e24('0xd'));var authService=require(_0x3e24('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3e24('0xf'));var hardwareService=require(_0x3e24('0x10'));var logger=require(_0x3e24('0x11'))(_0x3e24('0x12'));var utils=require(_0x3e24('0x13'));var config=require(_0x3e24('0x14'));var licenseUtil=require(_0x3e24('0x15'));var db=require(_0x3e24('0x16'))['db'];config[_0x3e24('0x17')]=_[_0x3e24('0x18')](config[_0x3e24('0x17')],{'host':_0x3e24('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3e24('0x17')]));require(_0x3e24('0x1a'))[_0x3e24('0x1b')](socket);var jayson=require(_0x3e24('0x1c'));var client=jayson[_0x3e24('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eab6f,_0xc9d40f,_0x28e587,_0x5684b4){return new BPromise(function(_0x3f6462,_0x473b66){var _0x9be76e=_0x5684b4||client;return _0x9be76e[_0x3e24('0x1e')](_0x2eab6f,_0x28e587)[_0x3e24('0x1f')](function(_0x27d006){logger['info'](_0x3e24('0x20'),_0xc9d40f,_0x3e24('0x21'));logger[_0x3e24('0x22')](_0x3e24('0x23'),_0xc9d40f,_0x3e24('0x21'),JSON['stringify'](_0x27d006));if(_0x27d006['error']){if(_0x27d006['error']['code']===0x1f4){logger[_0x3e24('0x24')](_0x3e24('0x20'),_0xc9d40f,_0x27d006['error']['message']);return _0x473b66(_0x27d006[_0x3e24('0x24')][_0x3e24('0x25')]);}logger[_0x3e24('0x24')](_0x3e24('0x20'),_0xc9d40f,_0x27d006['error']['message']);return _0x3f6462(_0x27d006[_0x3e24('0x24')]['message']);}else{logger[_0x3e24('0x26')](_0x3e24('0x20'),_0xc9d40f,_0x3e24('0x21'));_0x3f6462(_0x27d006[_0x3e24('0x27')][_0x3e24('0x25')]);}})[_0x3e24('0x28')](function(_0x2b58a2){logger[_0x3e24('0x24')](_0x3e24('0x20'),_0xc9d40f,_0x2b58a2);_0x473b66(_0x2b58a2);});});}function respondWithStatusCode(_0x2535bd,_0x5a0fde){_0x5a0fde=_0x5a0fde||0xcc;return function(_0x3ea177){if(_0x3ea177){return _0x2535bd['sendStatus'](_0x5a0fde);}return _0x2535bd['status'](_0x5a0fde)[_0x3e24('0x29')]();};}function respondWithResult(_0x2c0fda,_0x1a4057){_0x1a4057=_0x1a4057||0xc8;return function(_0x28044b){if(_0x28044b){return _0x2c0fda[_0x3e24('0x2a')](_0x1a4057)['json'](_0x28044b);}};}function respondWithFilteredResult(_0x371ef3,_0x430eb2){return function(_0x3f0a1a){if(_0x3f0a1a){var _0x1a245a=_0x3f0a1a[_0x3e24('0x2b')],_0x3d07c5=_0x430eb2[_0x3e24('0x2c')],_0x42c765=_0x430eb2[_0x3e24('0x2c')]+_0x430eb2[_0x3e24('0x2d')],_0x330124;if(_0x42c765>=_0x1a245a){_0x42c765=_0x1a245a;_0x330124=0xc8;}else{_0x330124=0xce;}_0x371ef3['status'](_0x330124);return _0x371ef3['set'](_0x3e24('0x2e'),_0x3d07c5+'-'+_0x42c765+'/'+_0x1a245a)[_0x3e24('0x2f')](_0x3f0a1a);}return null;};}function patchUpdates(_0x17239f){return function(_0xba5e54){try{jsonpatch[_0x3e24('0x30')](_0xba5e54,_0x17239f,!![]);}catch(_0x2a4d0c){return BPromise[_0x3e24('0x31')](_0x2a4d0c);}return _0xba5e54[_0x3e24('0x32')]();};}function saveUpdates(_0x4dfd5a,_0x4d9f53){return function(_0x51f87d){if(_0x51f87d){return _0x51f87d[_0x3e24('0x33')](_0x4dfd5a)['then'](function(_0x7cdafe){return _0x7cdafe;});}return null;};}function removeEntity(_0x2a7913,_0x239888){return function(_0x17a854){if(_0x17a854){return _0x17a854[_0x3e24('0x34')]()[_0x3e24('0x1f')](function(){var _0x539c3a=_0x17a854[_0x3e24('0x35')]({'plain':!![]});var _0x475bc0=_0x3e24('0x36');return db[_0x3e24('0x37')][_0x3e24('0x34')]({'where':{'type':_0x475bc0,'resourceId':_0x539c3a['id']}})[_0x3e24('0x1f')](function(){return _0x17a854;});})[_0x3e24('0x1f')](function(){_0x2a7913[_0x3e24('0x2a')](0xcc)[_0x3e24('0x29')]();});}};}function handleEntityNotFound(_0x241847,_0x48f172){return function(_0x36ed12){if(!_0x36ed12){_0x241847[_0x3e24('0x38')](0x194);}return _0x36ed12;};}function handleError(_0x44ecda,_0x21f55f){_0x21f55f=_0x21f55f||0x1f4;return function(_0x4ff35b){logger['error'](_0x4ff35b[_0x3e24('0x39')]);if(_0x4ff35b[_0x3e24('0x3a')]){delete _0x4ff35b[_0x3e24('0x3a')];}_0x44ecda[_0x3e24('0x2a')](_0x21f55f)[_0x3e24('0x3b')](_0x4ff35b);};}exports[_0x3e24('0x3c')]=function(_0x107cdb,_0x2d8812){var _0x27bfc9={},_0xc83227={},_0x39ce1e={'count':0x0,'rows':[]};var _0x45cbf8=_[_0x3e24('0x3d')](db['ChatQueue'][_0x3e24('0x3e')],function(_0x1f31b6){return{'name':_0x1f31b6[_0x3e24('0x3f')],'type':_0x1f31b6[_0x3e24('0x40')][_0x3e24('0x41')]};});_0xc83227[_0x3e24('0x42')]=_[_0x3e24('0x3d')](_0x45cbf8,_0x3e24('0x3a'));_0xc83227[_0x3e24('0x43')]=_[_0x3e24('0x44')](_0x107cdb[_0x3e24('0x43')]);_0xc83227[_0x3e24('0x45')]=_[_0x3e24('0x46')](_0xc83227[_0x3e24('0x42')],_0xc83227['query']);_0x27bfc9[_0x3e24('0x47')]=_[_0x3e24('0x46')](_0xc83227[_0x3e24('0x42')],qs[_0x3e24('0x48')](_0x107cdb[_0x3e24('0x43')][_0x3e24('0x48')]));_0x27bfc9[_0x3e24('0x47')]=_0x27bfc9[_0x3e24('0x47')][_0x3e24('0x49')]?_0x27bfc9[_0x3e24('0x47')]:_0xc83227[_0x3e24('0x42')];if(!_0x107cdb['query']['hasOwnProperty'](_0x3e24('0x4a'))){_0x27bfc9[_0x3e24('0x2d')]=qs[_0x3e24('0x2d')](_0x107cdb[_0x3e24('0x43')][_0x3e24('0x2d')]);_0x27bfc9[_0x3e24('0x2c')]=qs['offset'](_0x107cdb[_0x3e24('0x43')]['offset']);}_0x27bfc9[_0x3e24('0x4b')]=qs[_0x3e24('0x4c')](_0x107cdb['query'][_0x3e24('0x4c')]);_0x27bfc9[_0x3e24('0x4d')]=qs[_0x3e24('0x45')](_['pick'](_0x107cdb['query'],_0xc83227[_0x3e24('0x45')]),_0x45cbf8);if(_0x107cdb['query'][_0x3e24('0x4e')]){_0x27bfc9[_0x3e24('0x4d')]=_[_0x3e24('0x4f')](_0x27bfc9[_0x3e24('0x4d')],{'$or':_[_0x3e24('0x3d')](_0x45cbf8,function(_0x213a98){if(_0x213a98[_0x3e24('0x40')]!==_0x3e24('0x50')){var _0x3a6113={};_0x3a6113[_0x213a98['name']]={'$like':'%'+_0x107cdb[_0x3e24('0x43')][_0x3e24('0x4e')]+'%'};return _0x3a6113;}})});}_0x27bfc9=_[_0x3e24('0x4f')]({},_0x27bfc9,_0x107cdb[_0x3e24('0x51')]);var _0x171267={'where':_0x27bfc9[_0x3e24('0x4d')]};return db[_0x3e24('0x52')][_0x3e24('0x2b')](_0x171267)[_0x3e24('0x1f')](function(_0x1d5b40){_0x39ce1e['count']=_0x1d5b40;if(_0x107cdb[_0x3e24('0x43')]['includeAll']){_0x27bfc9[_0x3e24('0x53')]=[{'all':!![]}];}return db[_0x3e24('0x52')][_0x3e24('0x54')](_0x27bfc9);})[_0x3e24('0x1f')](function(_0x2afeb9){_0x39ce1e[_0x3e24('0x55')]=_0x2afeb9;return _0x39ce1e;})[_0x3e24('0x1f')](respondWithFilteredResult(_0x2d8812,_0x27bfc9))[_0x3e24('0x28')](handleError(_0x2d8812,null));};exports[_0x3e24('0x56')]=function(_0x13bb6c,_0x13d6f2){var _0x436766={'raw':!![],'where':{'id':_0x13bb6c[_0x3e24('0x57')]['id']}},_0x553fba={};_0x553fba[_0x3e24('0x42')]=_[_0x3e24('0x44')](db[_0x3e24('0x52')][_0x3e24('0x3e')]);_0x553fba[_0x3e24('0x43')]=_['keys'](_0x13bb6c[_0x3e24('0x43')]);_0x553fba[_0x3e24('0x45')]=_[_0x3e24('0x46')](_0x553fba[_0x3e24('0x42')],_0x553fba[_0x3e24('0x43')]);_0x436766[_0x3e24('0x47')]=_[_0x3e24('0x46')](_0x553fba['model'],qs['fields'](_0x13bb6c['query'][_0x3e24('0x48')]));_0x436766[_0x3e24('0x47')]=_0x436766['attributes'][_0x3e24('0x49')]?_0x436766[_0x3e24('0x47')]:_0x553fba[_0x3e24('0x42')];if(_0x13bb6c[_0x3e24('0x43')][_0x3e24('0x58')]){_0x436766['include']=[{'all':!![]}];}_0x436766=_[_0x3e24('0x4f')]({},_0x436766,_0x13bb6c[_0x3e24('0x51')]);return db['ChatQueue'][_0x3e24('0x59')](_0x436766)['then'](handleEntityNotFound(_0x13d6f2,null))['then'](respondWithResult(_0x13d6f2,null))[_0x3e24('0x28')](handleError(_0x13d6f2,null));};exports['create']=function(_0x498a57,_0x10718d){return db[_0x3e24('0x52')][_0x3e24('0x5a')](_0x498a57[_0x3e24('0x5b')],{})['then'](function(_0x365e1b){var _0x190770=_0x498a57[_0x3e24('0x5c')][_0x3e24('0x35')]({'plain':!![]});if(!_0x190770)throw new Error(_0x3e24('0x5d'));if(_0x190770[_0x3e24('0x5e')]==='user'){var _0x3b20fd=_0x365e1b['get']({'plain':!![]});var _0x10da72=_0x3e24('0x36');return db[_0x3e24('0x5f')]['find']({'where':{'name':_0x10da72,'userProfileId':_0x190770[_0x3e24('0x60')]},'raw':!![]})[_0x3e24('0x1f')](function(_0x23013f){if(_0x23013f&&_0x23013f['autoAssociation']===0x0){return db[_0x3e24('0x37')][_0x3e24('0x5a')]({'name':_0x3b20fd[_0x3e24('0x3a')],'resourceId':_0x3b20fd['id'],'type':_0x23013f[_0x3e24('0x3a')],'sectionId':_0x23013f['id']},{})[_0x3e24('0x1f')](function(){return _0x365e1b;});}else{return _0x365e1b;}})[_0x3e24('0x28')](function(_0x376b50){logger[_0x3e24('0x24')](_0x3e24('0x61'),_0x376b50);throw _0x376b50;});}return _0x365e1b;})[_0x3e24('0x1f')](respondWithResult(_0x10718d,0xc9))[_0x3e24('0x28')](handleError(_0x10718d,null));};exports['update']=function(_0x56ed51,_0x4463d2){if(_0x56ed51[_0x3e24('0x5b')]['id']){delete _0x56ed51[_0x3e24('0x5b')]['id'];}return db[_0x3e24('0x52')]['find']({'where':{'id':_0x56ed51[_0x3e24('0x57')]['id']}})['then'](handleEntityNotFound(_0x4463d2,null))[_0x3e24('0x1f')](saveUpdates(_0x56ed51[_0x3e24('0x5b')],null))[_0x3e24('0x1f')](respondWithResult(_0x4463d2,null))[_0x3e24('0x28')](handleError(_0x4463d2,null));};exports[_0x3e24('0x34')]=function(_0x277f29,_0xa01e71){return db[_0x3e24('0x52')][_0x3e24('0x59')]({'where':{'id':_0x277f29[_0x3e24('0x57')]['id']}})['then'](handleEntityNotFound(_0xa01e71,null))[_0x3e24('0x1f')](removeEntity(_0xa01e71,null))[_0x3e24('0x28')](handleError(_0xa01e71,null));};exports[_0x3e24('0x62')]=function(_0x3b78cb,_0x1c1424){return db[_0x3e24('0x52')][_0x3e24('0x62')]()['then'](respondWithResult(_0x1c1424,null))[_0x3e24('0x28')](handleError(_0x1c1424,null));};exports[_0x3e24('0x63')]=function(_0x2f3c77,_0x1902db,_0xa64de0){var _0x445239={'raw':!![],'where':{}},_0x9e241e={},_0x24cab8;return db[_0x3e24('0x52')][_0x3e24('0x64')]({'where':{'id':_0x2f3c77[_0x3e24('0x57')]['id']}})[_0x3e24('0x1f')](handleEntityNotFound(_0x1902db,null))[_0x3e24('0x1f')](function(_0x3a14c8){if(_0x3a14c8){_0x24cab8=_0x3a14c8[_0x3e24('0x35')]({'plain':!![]});_0x9e241e['model']=_['keys'](db[_0x3e24('0x65')][_0x3e24('0x3e')]);_0x9e241e[_0x3e24('0x43')]=_['keys'](_0x2f3c77[_0x3e24('0x43')]);_0x9e241e[_0x3e24('0x45')]=_[_0x3e24('0x46')](_0x9e241e['model'],_0x9e241e[_0x3e24('0x43')]);_0x445239[_0x3e24('0x47')]=_[_0x3e24('0x46')](_0x9e241e[_0x3e24('0x42')],qs[_0x3e24('0x48')](_0x2f3c77['query'][_0x3e24('0x48')]));_0x445239[_0x3e24('0x47')]=_0x445239[_0x3e24('0x47')]['length']?_0x445239[_0x3e24('0x47')]:_0x9e241e[_0x3e24('0x42')];if(!_0x2f3c77[_0x3e24('0x43')][_0x3e24('0x66')](_0x3e24('0x4a'))){_0x445239[_0x3e24('0x2d')]=qs[_0x3e24('0x2d')](_0x2f3c77[_0x3e24('0x43')][_0x3e24('0x2d')]);_0x445239[_0x3e24('0x2c')]=qs['offset'](_0x2f3c77[_0x3e24('0x43')][_0x3e24('0x2c')]);}_0x445239[_0x3e24('0x4b')]=qs[_0x3e24('0x4c')](_0x2f3c77[_0x3e24('0x43')][_0x3e24('0x4c')]);_0x445239['where']=qs[_0x3e24('0x45')](_[_0x3e24('0x67')](_0x2f3c77[_0x3e24('0x43')],_0x9e241e[_0x3e24('0x45')]));_0x445239[_0x3e24('0x4d')]['ChatQueueId']=_0x3a14c8['id'];if(_0x2f3c77[_0x3e24('0x43')][_0x3e24('0x4e')]){_0x445239['where']=_['merge'](_0x445239[_0x3e24('0x4d')],{'$or':_['map'](_0x445239['attributes'],function(_0x5a408a){var _0x3efbfb={};_0x3efbfb[_0x5a408a]={'$like':'%'+_0x2f3c77[_0x3e24('0x43')][_0x3e24('0x4e')]+'%'};return _0x3efbfb;})});}_0x445239=_[_0x3e24('0x4f')]({},_0x445239,_0x2f3c77['options']);return db[_0x3e24('0x65')]['findAll'](_0x445239);}})['then'](function(_0x433794){if(_0x433794){return db[_0x3e24('0x68')]['findAndCountAll']({'where':{'id':_[_0x3e24('0x3d')](_0x433794,_0x3e24('0x69')),'role':_0x3e24('0x6a')},'attributes':['id',_0x3e24('0x3a'),_0x3e24('0x6b'),_0x3e24('0x6c'),_0x3e24('0x6d')]});}})['then'](function(_0x2e8db9){if(_0x2e8db9){return{'count':_0x2e8db9['count'],'rows':_[_0x3e24('0x3d')](_0x2e8db9['rows'],function(_0x28b520){return{'membername':_0x28b520[_0x3e24('0x3a')],'UserId':_0x28b520['id'],'queue_name':_0x24cab8[_0x3e24('0x3a')],'ChatQueueId':_0x24cab8['id'],'interface':util[_0x3e24('0x6e')](_0x3e24('0x6f'),_0x3e24('0x70'),_0x28b520['name']),'penalty':0x0,'paused':_0x28b520[_0x3e24('0x6b')],'createdAt':_0x28b520['createdAt'],'updatedAt':_0x28b520[_0x3e24('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3e24('0x1f')](respondWithFilteredResult(_0x1902db,_0x445239))[_0x3e24('0x28')](handleError(_0x1902db,null));};exports[_0x3e24('0x71')]=function(_0x4bb777,_0x5de624,_0x1b94d6){var _0x593abe={};var _0x3c70c0={};var _0x1c6b16;var _0x3da8e8;return db[_0x3e24('0x52')][_0x3e24('0x64')]({'where':{'id':_0x4bb777[_0x3e24('0x57')]['id']}})['then'](handleEntityNotFound(_0x5de624,null))['then'](function(_0x269b04){if(_0x269b04){_0x1c6b16=_0x269b04;_0x3c70c0['model']=_[_0x3e24('0x44')](db[_0x3e24('0x72')]['rawAttributes']);_0x3c70c0['query']=_[_0x3e24('0x44')](_0x4bb777['query']);_0x3c70c0[_0x3e24('0x45')]=_[_0x3e24('0x46')](_0x3c70c0[_0x3e24('0x42')],_0x3c70c0[_0x3e24('0x43')]);_0x593abe[_0x3e24('0x47')]=_[_0x3e24('0x46')](_0x3c70c0['model'],qs['fields'](_0x4bb777[_0x3e24('0x43')]['fields']));_0x593abe[_0x3e24('0x47')]=_0x593abe[_0x3e24('0x47')][_0x3e24('0x49')]?_0x593abe[_0x3e24('0x47')]:_0x3c70c0[_0x3e24('0x42')];_0x593abe[_0x3e24('0x4b')]=qs['sort'](_0x4bb777['query'][_0x3e24('0x4c')]);_0x593abe[_0x3e24('0x4d')]=qs['filters'](_[_0x3e24('0x67')](_0x4bb777[_0x3e24('0x43')],_0x3c70c0[_0x3e24('0x45')]));if(_0x4bb777[_0x3e24('0x43')][_0x3e24('0x4e')]){_0x593abe[_0x3e24('0x4d')]=_[_0x3e24('0x4f')](_0x593abe[_0x3e24('0x4d')],{'$or':_['map'](_0x593abe['attributes'],function(_0x4e0811){var _0x40184f={};_0x40184f[_0x4e0811]={'$like':'%'+_0x4bb777[_0x3e24('0x43')][_0x3e24('0x4e')]+'%'};return _0x40184f;})});}_0x593abe=_['merge']({},_0x593abe,_0x4bb777[_0x3e24('0x51')]);return _0x1c6b16[_0x3e24('0x71')](_0x593abe);}})[_0x3e24('0x1f')](function(_0xfc01af){if(_0xfc01af){_0x3da8e8=_0xfc01af[_0x3e24('0x49')];if(!_0x4bb777[_0x3e24('0x43')]['hasOwnProperty'](_0x3e24('0x4a'))){_0x593abe[_0x3e24('0x2d')]=qs['limit'](_0x4bb777[_0x3e24('0x43')][_0x3e24('0x2d')]);_0x593abe[_0x3e24('0x2c')]=qs[_0x3e24('0x2c')](_0x4bb777[_0x3e24('0x43')][_0x3e24('0x2c')]);}return _0x1c6b16['getTeams'](_0x593abe);}})[_0x3e24('0x1f')](function(_0x1b0c17){if(_0x1b0c17){return _0x1b0c17?{'count':_0x3da8e8,'rows':_0x1b0c17}:null;}})[_0x3e24('0x1f')](respondWithResult(_0x5de624,null))[_0x3e24('0x28')](handleError(_0x5de624,null));};exports[_0x3e24('0x73')]=function(_0x3f8bc6,_0x1c8d18,_0x20cc17){var _0x27adc7=_0x3f8bc6[_0x3e24('0x5b')][_0x3e24('0x74')];return db[_0x3e24('0x72')]['findAll']({'where':{'id':_0x27adc7},'attributes':['id'],'include':[{'model':db[_0x3e24('0x68')],'as':_0x3e24('0x75'),'attributes':['id','name',_0x3e24('0x76'),_0x3e24('0x77'),_0x3e24('0x78')],'raw':!![]}]})[_0x3e24('0x1f')](function(_0x4aee7c){if(_0x4aee7c){var _0x2ebd03=_[_0x3e24('0x79')](_0x4aee7c,function(_0x86dcbc){var _0x2c62c0=_0x86dcbc[_0x3e24('0x35')]({'plain':!![]});return _0x2c62c0[_0x3e24('0x75')];});return db[_0x3e24('0x52')]['find']({'where':{'id':_0x3f8bc6[_0x3e24('0x57')]['id']}})['then'](function(_0x16687d){return db[_0x3e24('0x7a')][_0x3e24('0x7b')](function(_0x1874f0){return _0x16687d[_0x3e24('0x73')](_0x27adc7,{'transaction':_0x1874f0})[_0x3e24('0x1f')](function(){return BPromise[_0x3e24('0x7c')](_0x2ebd03,function(_0x4bb3c2){return db[_0x3e24('0x65')][_0x3e24('0x7d')]({'where':{'UserId':_0x4bb3c2['id'],'ChatQueueId':_0x3f8bc6['params']['id']},'transaction':_0x1874f0});});})[_0x3e24('0x1f')](function(){_0x2ebd03[_0x3e24('0x7e')](function(_0x17a572){socket[_0x3e24('0x7f')](_0x3e24('0x80'),{'UserId':_0x17a572['id'],'ChatQueueId':_0x16687d['id']});});});});});}})[_0x3e24('0x1f')](respondWithStatusCode(_0x1c8d18,null))[_0x3e24('0x28')](handleError(_0x1c8d18,null));};exports[_0x3e24('0x81')]=function(_0x151409,_0x107aed,_0x334963){return db['Team'][_0x3e24('0x54')]({'where':{'id':_0x151409[_0x3e24('0x43')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x3e24('0x1f')](handleEntityNotFound(_0x107aed,null))['then'](function(_0x4bdc48){var _0x33aeaa=_[_0x3e24('0x3d')](_0x4bdc48,'id');var _0x42c4fc=[];var _0x510e71=[];var _0x252393=squel['select']();_0x252393[_0x3e24('0x82')](_0x3e24('0x83'))[_0x3e24('0x84')]('team_has_chat_queues','tq')['join'](_0x3e24('0x85'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3e24('0x4d')](_0x3e24('0x86'),_0x151409['params']['id']);for(var _0xb345b1=0x0;_0xb345b1<_0x4bdc48[_0x3e24('0x49')];_0xb345b1+=0x1){let _0x1b02a3=_0x4bdc48[_0xb345b1];for(var _0x1b10de=0x0;_0x1b10de<_0x1b02a3[_0x3e24('0x75')][_0x3e24('0x49')];_0x1b10de+=0x1){let _0x25fa23=_0x1b02a3[_0x3e24('0x75')][_0x1b10de];var _0x1b8094=_0x252393[_0x3e24('0x87')]();_0x1b8094[_0x3e24('0x4d')]('ut.UserId\x20=\x20?',_0x25fa23['id']);_0x510e71[_0x3e24('0x88')](db[_0x3e24('0x7a')][_0x3e24('0x43')](_0x1b8094['toString'](),{'type':db[_0x3e24('0x7a')][_0x3e24('0x89')]['SELECT']})[_0x3e24('0x1f')](function(_0x325e19){if(_0x325e19[_0x3e24('0x49')]===0x1){return _0x25fa23['id'];}else{var _0x1e72ae=_[_0x3e24('0x8a')](_['map'](_0x325e19,_0x3e24('0x8b')),function(_0x13455){return _[_0x3e24('0x8c')](_0x33aeaa,_0x13455);});if(_0x1e72ae){return _0x25fa23['id'];}}}));}}return BPromise[_0x3e24('0x8d')](_0x510e71)[_0x3e24('0x1f')](function(_0x238d3f){_0x42c4fc=_(_0x42c4fc)[_0x3e24('0x8e')](_0x238d3f)[_0x3e24('0x8f')]()[_0x3e24('0x90')]();return db['ChatQueue'][_0x3e24('0x59')]({'where':{'id':_0x151409['params']['id']}})[_0x3e24('0x1f')](function(_0x4836b1){return db['sequelize'][_0x3e24('0x7b')](function(_0x19d325){return _0x4836b1[_0x3e24('0x81')](_0x151409[_0x3e24('0x43')][_0x3e24('0x74')],{'transaction':_0x19d325})['then'](function(){if(!_['isEmpty'](_0x42c4fc)){return _0x4836b1[_0x3e24('0x91')](_0x42c4fc,{'transaction':_0x19d325});}})[_0x3e24('0x1f')](function(){_0x42c4fc[_0x3e24('0x7e')](function(_0x4b9523){socket[_0x3e24('0x7f')](_0x3e24('0x92'),{'UserId':_0x4b9523,'ChatQueueId':_0x4836b1['id']});});});});});});})[_0x3e24('0x1f')](respondWithStatusCode(_0x107aed,null))[_0x3e24('0x28')](handleError(_0x107aed,null));};exports['addAgents']=function(_0x2337e1,_0x97fb81,_0x4ad86d){return db[_0x3e24('0x52')][_0x3e24('0x59')]({'where':{'id':_0x2337e1['params']['id']}})['then'](handleEntityNotFound(_0x97fb81,null))['then'](function(_0x34e2b9){if(_0x34e2b9){return _0x34e2b9[_0x3e24('0x93')](_0x2337e1[_0x3e24('0x5b')][_0x3e24('0x74')],_[_0x3e24('0x94')](_0x2337e1[_0x3e24('0x5b')],[_0x3e24('0x74'),'id'])||{})[_0x3e24('0x95')](function(_0x463b20){for(var _0x16fbbf=0x0;_0x16fbbf<_0x2337e1[_0x3e24('0x5b')][_0x3e24('0x74')]['length'];_0x16fbbf+=0x1){socket[_0x3e24('0x7f')]('userChatQueue:save',{'UserId':_0x2337e1[_0x3e24('0x5b')][_0x3e24('0x74')][_0x16fbbf],'ChatQueueId':_0x2337e1[_0x3e24('0x57')]['id']});}return _0x463b20;});}})[_0x3e24('0x1f')](respondWithResult(_0x97fb81,null))[_0x3e24('0x28')](handleError(_0x97fb81,null));};exports['removeAgents']=function(_0x54d374,_0xc4139a,_0x3a67f5){return db[_0x3e24('0x52')]['find']({'where':{'id':_0x54d374[_0x3e24('0x57')]['id']}})[_0x3e24('0x1f')](handleEntityNotFound(_0xc4139a,null))[_0x3e24('0x1f')](function(_0x5da860){if(_0x5da860){return _0x5da860[_0x3e24('0x91')](_0x54d374[_0x3e24('0x43')][_0x3e24('0x74')])[_0x3e24('0x1f')](function(){if(_[_0x3e24('0x96')](_0x54d374[_0x3e24('0x43')][_0x3e24('0x74')])){for(var _0x57bd64=0x0;_0x57bd64<_0x54d374[_0x3e24('0x43')]['ids'][_0x3e24('0x49')];_0x57bd64+=0x1){socket[_0x3e24('0x7f')]('userChatQueue:remove',{'UserId':Number(_0x54d374['query']['ids'][_0x57bd64]),'ChatQueueId':Number(_0x54d374[_0x3e24('0x57')]['id'])});}}else{socket['emit'](_0x3e24('0x92'),{'UserId':Number(_0x54d374['query'][_0x3e24('0x74')]),'ChatQueueId':Number(_0x54d374[_0x3e24('0x57')]['id'])});}});}})[_0x3e24('0x1f')](respondWithStatusCode(_0xc4139a,null))[_0x3e24('0x28')](handleError(_0xc4139a,null));};exports[_0x3e24('0x97')]=function(_0x960f9a,_0x5ced16,_0x214fd1){var _0x2d9b74={};var _0x5b491d={};var _0x268b94;var _0x1c0112;return db[_0x3e24('0x52')]['findOne']({'where':{'id':_0x960f9a['params']['id']}})[_0x3e24('0x1f')](handleEntityNotFound(_0x5ced16,null))[_0x3e24('0x1f')](function(_0x3789ca){if(_0x3789ca){_0x268b94=_0x3789ca;_0x5b491d[_0x3e24('0x42')]=_[_0x3e24('0x44')](db['User'][_0x3e24('0x3e')]);_0x5b491d[_0x3e24('0x43')]=_[_0x3e24('0x44')](_0x960f9a[_0x3e24('0x43')]);_0x5b491d[_0x3e24('0x45')]=_[_0x3e24('0x46')](_0x5b491d[_0x3e24('0x42')],_0x5b491d[_0x3e24('0x43')]);_0x2d9b74[_0x3e24('0x47')]=_[_0x3e24('0x46')](_0x5b491d[_0x3e24('0x42')],qs['fields'](_0x960f9a['query'][_0x3e24('0x48')]));_0x2d9b74[_0x3e24('0x47')]=_0x2d9b74[_0x3e24('0x47')]['length']?_0x2d9b74[_0x3e24('0x47')]:_0x5b491d[_0x3e24('0x42')];_0x2d9b74['order']=qs[_0x3e24('0x4c')](_0x960f9a[_0x3e24('0x43')][_0x3e24('0x4c')]);_0x2d9b74[_0x3e24('0x4d')]=qs[_0x3e24('0x45')](_[_0x3e24('0x67')](_0x960f9a[_0x3e24('0x43')],_0x5b491d[_0x3e24('0x45')]));if(_0x960f9a[_0x3e24('0x43')][_0x3e24('0x4e')]){_0x2d9b74[_0x3e24('0x4d')]=_[_0x3e24('0x4f')](_0x2d9b74[_0x3e24('0x4d')],{'$or':_[_0x3e24('0x3d')](_0x2d9b74[_0x3e24('0x47')],function(_0x1ea75a){var _0x3af42f={};_0x3af42f[_0x1ea75a]={'$like':'%'+_0x960f9a['query']['filter']+'%'};return _0x3af42f;})});}_0x2d9b74=_[_0x3e24('0x4f')]({},_0x2d9b74,_0x960f9a['options']);return _0x268b94[_0x3e24('0x97')](_0x2d9b74);}})['then'](function(_0x2fad19){if(_0x2fad19){_0x1c0112=_0x2fad19[_0x3e24('0x49')];if(!_0x960f9a[_0x3e24('0x43')][_0x3e24('0x66')](_0x3e24('0x4a'))){_0x2d9b74[_0x3e24('0x2d')]=qs[_0x3e24('0x2d')](_0x960f9a['query']['limit']);_0x2d9b74[_0x3e24('0x2c')]=qs['offset'](_0x960f9a['query'][_0x3e24('0x2c')]);}return _0x268b94['getAgents'](_0x2d9b74);}})[_0x3e24('0x1f')](function(_0x5b7fdd){if(_0x5b7fdd){return _0x5b7fdd?{'count':_0x1c0112,'rows':_0x5b7fdd}:null;}})[_0x3e24('0x1f')](respondWithResult(_0x5ced16,null))[_0x3e24('0x28')](handleError(_0x5ced16,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index a14873c..72204b8 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 _0xbaf0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatQueue'];(function(_0x258c5e,_0x407908){var _0x4ce92e=function(_0x1fd85e){while(--_0x1fd85e){_0x258c5e['push'](_0x258c5e['shift']());}};_0x4ce92e(++_0x407908);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x0baf('0x0'))['db'][_0x0baf('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x0baf('0x2')](0x0);var events={'afterCreate':_0x0baf('0x3'),'afterUpdate':_0x0baf('0x4'),'afterDestroy':_0x0baf('0x5')};function emitEvent(_0x5a3e42){return function(_0x232cc7,_0x1c383e,_0x2d3fa5){ChatQueueEvents[_0x0baf('0x6')](_0x5a3e42+':'+_0x232cc7['id'],_0x232cc7);ChatQueueEvents[_0x0baf('0x6')](_0x5a3e42,_0x232cc7);_0x2d3fa5(null);};}for(var e in events){if(events[_0x0baf('0x7')](e)){var event=events[e];ChatQueue[_0x0baf('0x8')](e,emitEvent(event));}}module[_0x0baf('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0xbaf0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatQueue'];(function(_0x5e0664,_0x4307dc){var _0x51ed02=function(_0x4b5b88){while(--_0x4b5b88){_0x5e0664['push'](_0x5e0664['shift']());}};_0x51ed02(++_0x4307dc);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x0baf('0x0'))['db'][_0x0baf('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x0baf('0x2')](0x0);var events={'afterCreate':_0x0baf('0x3'),'afterUpdate':_0x0baf('0x4'),'afterDestroy':_0x0baf('0x5')};function emitEvent(_0x5a3e42){return function(_0x232cc7,_0x1c383e,_0x2d3fa5){ChatQueueEvents[_0x0baf('0x6')](_0x5a3e42+':'+_0x232cc7['id'],_0x232cc7);ChatQueueEvents[_0x0baf('0x6')](_0x5a3e42,_0x232cc7);_0x2d3fa5(null);};}for(var e in events){if(events[_0x0baf('0x7')](e)){var event=events[e];ChatQueue[_0x0baf('0x8')](e,emitEvent(event));}}module[_0x0baf('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 7046c42..d8d3e7b 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 _0x3d66=['../../config/environment','./chatQueue.attributes','exports','define','chat_queues','util','api','path'];(function(_0x1dcb01,_0xea9123){var _0x1ab6c7=function(_0x728920){while(--_0x728920){_0x1dcb01['push'](_0x1dcb01['shift']());}};_0x1ab6c7(++_0xea9123);}(_0x3d66,0xdd));var _0x63d6=function(_0x530ef9,_0x54f342){_0x530ef9=_0x530ef9-0x0;var _0x1483dd=_0x3d66[_0x530ef9];return _0x1483dd;};'use strict';var _=require('lodash');var util=require(_0x63d6('0x0'));var logger=require('../../config/logger')(_0x63d6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x63d6('0x2'));var rimraf=require('rimraf');var config=require(_0x63d6('0x3'));var attributes=require(_0x63d6('0x4'));module[_0x63d6('0x5')]=function(_0x5ae146,_0x26725c){return _0x5ae146[_0x63d6('0x6')]('ChatQueue',attributes,{'tableName':_0x63d6('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf42e=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatQueue.attributes','define','chat_queues','lodash'];(function(_0xcb5193,_0x2dce94){var _0x3cf658=function(_0x27720a){while(--_0x27720a){_0xcb5193['push'](_0xcb5193['shift']());}};_0x3cf658(++_0x2dce94);}(_0xf42e,0x1d3));var _0xef42=function(_0x2a0da3,_0x3a9a33){_0x2a0da3=_0x2a0da3-0x0;var _0x4c898e=_0xf42e[_0x2a0da3];return _0x4c898e;};'use strict';var _=require(_0xef42('0x0'));var util=require(_0xef42('0x1'));var logger=require(_0xef42('0x2'))(_0xef42('0x3'));var moment=require(_0xef42('0x4'));var BPromise=require(_0xef42('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef42('0x6'));var rimraf=require(_0xef42('0x7'));var config=require(_0xef42('0x8'));var attributes=require(_0xef42('0x9'));module['exports']=function(_0x17fbf0,_0xbed448){return _0x17fbf0[_0xef42('0xa')]('ChatQueue',attributes,{'tableName':_0xef42('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 73ca306..251e86b 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 _0xb03e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','attributes','include','map','model','ShowChatQueue','find','where','util'];(function(_0x356b84,_0x38bdb8){var _0x4d0e82=function(_0x59496b){while(--_0x59496b){_0x356b84['push'](_0x356b84['shift']());}};_0x4d0e82(++_0x38bdb8);}(_0xb03e,0x1eb));var _0xeb03=function(_0x247455,_0xc4993a){_0x247455=_0x247455-0x0;var _0x57dda0=_0xb03e[_0x247455];return _0x57dda0;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var moment=require(_0xeb03('0x1'));var BPromise=require(_0xeb03('0x2'));var rs=require(_0xeb03('0x3'));var fs=require('fs');var Redis=require(_0xeb03('0x4'));var db=require(_0xeb03('0x5'))['db'];var utils=require(_0xeb03('0x6'));var logger=require(_0xeb03('0x7'))(_0xeb03('0x8'));var config=require(_0xeb03('0x9'));var jayson=require(_0xeb03('0xa'));var client=jayson[_0xeb03('0xb')]['http']({'port':0x232a});config[_0xeb03('0xc')]=_[_0xeb03('0xd')](config[_0xeb03('0xc')],{'host':_0xeb03('0xe'),'port':0x18eb});var socket=require(_0xeb03('0xf'))(new Redis(config[_0xeb03('0xc')]));require('./chatQueue.socket')[_0xeb03('0x10')](socket);function respondWithRpcPromise(_0x99f4e2,_0x14cfa0,_0x4f5013){return new BPromise(function(_0x31af2c,_0x48af4f){return client[_0xeb03('0x11')](_0x99f4e2,_0x4f5013)[_0xeb03('0x12')](function(_0x3de728){logger[_0xeb03('0x13')](_0xeb03('0x14'),_0x14cfa0,_0xeb03('0x15'));logger[_0xeb03('0x16')](_0xeb03('0x17'),_0x14cfa0,_0xeb03('0x15'),JSON[_0xeb03('0x18')](_0x3de728));if(_0x3de728[_0xeb03('0x19')]){if(_0x3de728[_0xeb03('0x19')]['code']===0x1f4){logger[_0xeb03('0x19')](_0xeb03('0x14'),_0x14cfa0,_0x3de728[_0xeb03('0x19')][_0xeb03('0x1a')]);return _0x48af4f(_0x3de728['error'][_0xeb03('0x1a')]);}logger[_0xeb03('0x19')](_0xeb03('0x14'),_0x14cfa0,_0x3de728['error'][_0xeb03('0x1a')]);return _0x31af2c(_0x3de728[_0xeb03('0x19')][_0xeb03('0x1a')]);}else{logger[_0xeb03('0x13')](_0xeb03('0x14'),_0x14cfa0,_0xeb03('0x15'));_0x31af2c(_0x3de728[_0xeb03('0x1b')][_0xeb03('0x1a')]);}})[_0xeb03('0x1c')](function(_0x469d25){logger[_0xeb03('0x19')](_0xeb03('0x14'),_0x14cfa0,_0x469d25);_0x48af4f(_0x469d25);});});}exports[_0xeb03('0x1d')]=function(_0x19bddf){var _0x4d307c=this;return new Promise(function(_0x1bea3f,_0x3855dd){return db[_0xeb03('0x1e')][_0xeb03('0x1f')]({'raw':_0x19bddf[_0xeb03('0x20')]?_0x19bddf[_0xeb03('0x20')][_0xeb03('0x21')]===undefined?!![]:![]:!![],'where':_0x19bddf[_0xeb03('0x20')]?_0x19bddf[_0xeb03('0x20')]['where']||null:null,'attributes':_0x19bddf[_0xeb03('0x20')]?_0x19bddf[_0xeb03('0x20')][_0xeb03('0x22')]||null:null,'limit':_0x19bddf[_0xeb03('0x20')]?_0x19bddf[_0xeb03('0x20')]['limit']||null:null,'include':_0x19bddf[_0xeb03('0x20')]?_0x19bddf[_0xeb03('0x20')][_0xeb03('0x23')]?_[_0xeb03('0x24')](_0x19bddf[_0xeb03('0x20')][_0xeb03('0x23')],function(_0xb04f34){return{'model':db[_0xb04f34[_0xeb03('0x25')]],'as':_0xb04f34['as'],'attributes':_0xb04f34[_0xeb03('0x22')],'include':_0xb04f34['include']?_[_0xeb03('0x24')](_0xb04f34[_0xeb03('0x23')],function(_0x2683f9){return{'model':db[_0x2683f9[_0xeb03('0x25')]],'as':_0x2683f9['as'],'attributes':_0x2683f9['attributes'],'include':_0x2683f9['include']?_[_0xeb03('0x24')](_0x2683f9['include'],function(_0x31a622){return{'model':db[_0x31a622[_0xeb03('0x25')]],'as':_0x31a622['as'],'attributes':_0x31a622[_0xeb03('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd4c8ec){logger['info']('GetChatQueue',_0x19bddf);logger['debug']('GetChatQueue',_0x19bddf,JSON[_0xeb03('0x18')](_0xd4c8ec));_0x1bea3f(_0xd4c8ec);})[_0xeb03('0x1c')](function(_0x5d0cc1){logger['error']('GetChatQueue',_0x5d0cc1['message'],_0x19bddf);_0x3855dd(_0x4d307c[_0xeb03('0x19')](0x1f4,_0x5d0cc1[_0xeb03('0x1a')]));});});};exports[_0xeb03('0x26')]=function(_0x2d2ddd){var _0x19fa35=this;return new Promise(function(_0x5234dc,_0x13efc6){return db['ChatQueue'][_0xeb03('0x27')]({'raw':_0x2d2ddd[_0xeb03('0x20')]?_0x2d2ddd[_0xeb03('0x20')][_0xeb03('0x21')]===undefined?!![]:![]:!![],'where':_0x2d2ddd[_0xeb03('0x20')]?_0x2d2ddd[_0xeb03('0x20')][_0xeb03('0x28')]||null:null,'attributes':_0x2d2ddd[_0xeb03('0x20')]?_0x2d2ddd['options'][_0xeb03('0x22')]||null:null,'include':_0x2d2ddd['options']?_0x2d2ddd[_0xeb03('0x20')][_0xeb03('0x23')]?_[_0xeb03('0x24')](_0x2d2ddd[_0xeb03('0x20')][_0xeb03('0x23')],function(_0x4375fe){return{'model':db[_0x4375fe['model']],'as':_0x4375fe['as'],'attributes':_0x4375fe[_0xeb03('0x22')],'include':_0x4375fe['include']?_['map'](_0x4375fe['include'],function(_0x164530){return{'model':db[_0x164530[_0xeb03('0x25')]],'as':_0x164530['as'],'attributes':_0x164530[_0xeb03('0x22')],'include':_0x164530[_0xeb03('0x23')]?_[_0xeb03('0x24')](_0x164530['include'],function(_0x23f8ca){return{'model':db[_0x23f8ca[_0xeb03('0x25')]],'as':_0x23f8ca['as'],'attributes':_0x23f8ca[_0xeb03('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4efbb7){logger[_0xeb03('0x13')](_0xeb03('0x26'),_0x2d2ddd);logger[_0xeb03('0x16')]('ShowChatQueue',_0x2d2ddd,JSON[_0xeb03('0x18')](_0x4efbb7));_0x5234dc(_0x4efbb7);})[_0xeb03('0x1c')](function(_0x57b2ab){logger['error'](_0xeb03('0x26'),_0x57b2ab[_0xeb03('0x1a')],_0x2d2ddd);_0x13efc6(_0x19fa35['error'](0x1f4,_0x57b2ab[_0xeb03('0x1a')]));});});}; \ No newline at end of file +var _0x326b=['ioredis','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','options','where','attributes','limit','include','map','model','ShowChatQueue','lodash','util','moment','bluebird','randomstring'];(function(_0xe222a4,_0x386e8f){var _0x191723=function(_0x41564f){while(--_0x41564f){_0xe222a4['push'](_0xe222a4['shift']());}};_0x191723(++_0x386e8f);}(_0x326b,0x1dc));var _0xb326=function(_0x2b31a8,_0x28b862){_0x2b31a8=_0x2b31a8-0x0;var _0x1175a5=_0x326b[_0x2b31a8];return _0x1175a5;};'use strict';var _=require(_0xb326('0x0'));var util=require(_0xb326('0x1'));var moment=require(_0xb326('0x2'));var BPromise=require(_0xb326('0x3'));var rs=require(_0xb326('0x4'));var fs=require('fs');var Redis=require(_0xb326('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb326('0x6'));var logger=require('../../config/logger')(_0xb326('0x7'));var config=require('../../config/environment');var jayson=require(_0xb326('0x8'));var client=jayson['client'][_0xb326('0x9')]({'port':0x232a});config[_0xb326('0xa')]=_[_0xb326('0xb')](config[_0xb326('0xa')],{'host':_0xb326('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb326('0xd'))[_0xb326('0xe')](socket);function respondWithRpcPromise(_0x32d2ac,_0x260031,_0x322423){return new BPromise(function(_0x424d8c,_0x29263b){return client[_0xb326('0xf')](_0x32d2ac,_0x322423)[_0xb326('0x10')](function(_0x51f41b){logger[_0xb326('0x11')](_0xb326('0x12'),_0x260031,_0xb326('0x13'));logger[_0xb326('0x14')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x260031,_0xb326('0x13'),JSON[_0xb326('0x15')](_0x51f41b));if(_0x51f41b[_0xb326('0x16')]){if(_0x51f41b[_0xb326('0x16')][_0xb326('0x17')]===0x1f4){logger[_0xb326('0x16')](_0xb326('0x12'),_0x260031,_0x51f41b[_0xb326('0x16')][_0xb326('0x18')]);return _0x29263b(_0x51f41b[_0xb326('0x16')][_0xb326('0x18')]);}logger[_0xb326('0x16')](_0xb326('0x12'),_0x260031,_0x51f41b['error'][_0xb326('0x18')]);return _0x424d8c(_0x51f41b[_0xb326('0x16')]['message']);}else{logger[_0xb326('0x11')](_0xb326('0x12'),_0x260031,_0xb326('0x13'));_0x424d8c(_0x51f41b[_0xb326('0x19')][_0xb326('0x18')]);}})[_0xb326('0x1a')](function(_0x464412){logger['error'](_0xb326('0x12'),_0x260031,_0x464412);_0x29263b(_0x464412);});});}exports[_0xb326('0x1b')]=function(_0x5daf57){var _0x56f164=this;return new Promise(function(_0x3bf4f6,_0x29dce5){return db[_0xb326('0x1c')]['findAll']({'raw':_0x5daf57[_0xb326('0x1d')]?_0x5daf57['options']['raw']===undefined?!![]:![]:!![],'where':_0x5daf57[_0xb326('0x1d')]?_0x5daf57['options'][_0xb326('0x1e')]||null:null,'attributes':_0x5daf57[_0xb326('0x1d')]?_0x5daf57[_0xb326('0x1d')][_0xb326('0x1f')]||null:null,'limit':_0x5daf57['options']?_0x5daf57[_0xb326('0x1d')][_0xb326('0x20')]||null:null,'include':_0x5daf57[_0xb326('0x1d')]?_0x5daf57[_0xb326('0x1d')][_0xb326('0x21')]?_['map'](_0x5daf57[_0xb326('0x1d')]['include'],function(_0x3ccc75){return{'model':db[_0x3ccc75['model']],'as':_0x3ccc75['as'],'attributes':_0x3ccc75[_0xb326('0x1f')],'include':_0x3ccc75[_0xb326('0x21')]?_[_0xb326('0x22')](_0x3ccc75[_0xb326('0x21')],function(_0x1b1902){return{'model':db[_0x1b1902['model']],'as':_0x1b1902['as'],'attributes':_0x1b1902[_0xb326('0x1f')],'include':_0x1b1902[_0xb326('0x21')]?_[_0xb326('0x22')](_0x1b1902[_0xb326('0x21')],function(_0x171cf8){return{'model':db[_0x171cf8[_0xb326('0x23')]],'as':_0x171cf8['as'],'attributes':_0x171cf8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x54c301){logger['info']('GetChatQueue',_0x5daf57);logger['debug'](_0xb326('0x1b'),_0x5daf57,JSON['stringify'](_0x54c301));_0x3bf4f6(_0x54c301);})[_0xb326('0x1a')](function(_0x303cdf){logger['error'](_0xb326('0x1b'),_0x303cdf[_0xb326('0x18')],_0x5daf57);_0x29dce5(_0x56f164['error'](0x1f4,_0x303cdf[_0xb326('0x18')]));});});};exports[_0xb326('0x24')]=function(_0x3d5d1f){var _0x15e136=this;return new Promise(function(_0x2e464e,_0x1e6ca8){return db[_0xb326('0x1c')]['find']({'raw':_0x3d5d1f['options']?_0x3d5d1f[_0xb326('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3d5d1f[_0xb326('0x1d')]?_0x3d5d1f[_0xb326('0x1d')][_0xb326('0x1e')]||null:null,'attributes':_0x3d5d1f[_0xb326('0x1d')]?_0x3d5d1f[_0xb326('0x1d')][_0xb326('0x1f')]||null:null,'include':_0x3d5d1f[_0xb326('0x1d')]?_0x3d5d1f[_0xb326('0x1d')][_0xb326('0x21')]?_['map'](_0x3d5d1f[_0xb326('0x1d')][_0xb326('0x21')],function(_0x33cb0d){return{'model':db[_0x33cb0d[_0xb326('0x23')]],'as':_0x33cb0d['as'],'attributes':_0x33cb0d[_0xb326('0x1f')],'include':_0x33cb0d[_0xb326('0x21')]?_[_0xb326('0x22')](_0x33cb0d[_0xb326('0x21')],function(_0x4df372){return{'model':db[_0x4df372[_0xb326('0x23')]],'as':_0x4df372['as'],'attributes':_0x4df372[_0xb326('0x1f')],'include':_0x4df372[_0xb326('0x21')]?_[_0xb326('0x22')](_0x4df372[_0xb326('0x21')],function(_0x43795f){return{'model':db[_0x43795f['model']],'as':_0x43795f['as'],'attributes':_0x43795f[_0xb326('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb326('0x10')](function(_0x944ae7){logger['info'](_0xb326('0x24'),_0x3d5d1f);logger[_0xb326('0x14')](_0xb326('0x24'),_0x3d5d1f,JSON[_0xb326('0x15')](_0x944ae7));_0x2e464e(_0x944ae7);})['catch'](function(_0x104778){logger['error'](_0xb326('0x24'),_0x104778['message'],_0x3d5d1f);_0x1e6ca8(_0x15e136[_0xb326('0x16')](0x1f4,_0x104778[_0xb326('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 6152ab9..2c962d0 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x41930d,_0x478ed3){var _0x455ade=function(_0x24cb07){while(--_0x24cb07){_0x41930d['push'](_0x41930d['shift']());}};_0x455ade(++_0x478ed3);}(_0xb10b,0x12a));var _0xbb10=function(_0x440464,_0xb7afd8){_0x440464=_0x440464-0x0;var _0x2f4043=_0xb10b[_0x440464];return _0x2f4043;};'use strict';var ChatQueueEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatQueueEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatQueueEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x59039e,_0x5583e4){var _0x90cc20=function(_0x16a2fe){while(--_0x16a2fe){_0x59039e['push'](_0x59039e['shift']());}};_0x90cc20(++_0x5583e4);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3e91a9,_0x53c466){_0x3e91a9=_0x3e91a9-0x0;var _0x25c9ad=_0x0b0e[_0x3e91a9];return _0x25c9ad;};'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 diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 701f12b..2000e27 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 _0xb0e9=['update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','show','/:id/members','/:id/teams','/:id/users','post','create','addTeams','addAgents','put','/:id'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xb0e9,0x1d0));var _0x9b0e=function(_0x470d05,_0x1ccea9){_0x470d05=_0x470d05-0x0;var _0x355c9f=_0xb0e9[_0x470d05];return _0x355c9f;};'use strict';var multer=require(_0x9b0e('0x0'));var util=require(_0x9b0e('0x1'));var path=require(_0x9b0e('0x2'));var timeout=require(_0x9b0e('0x3'));var express=require(_0x9b0e('0x4'));var router=express['Router']();var auth=require(_0x9b0e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9b0e('0x6'));var controller=require(_0x9b0e('0x7'));router[_0x9b0e('0x8')]('/',auth[_0x9b0e('0x9')](),controller[_0x9b0e('0xa')]);router['get'](_0x9b0e('0xb'),auth[_0x9b0e('0x9')](),controller['describe']);router[_0x9b0e('0x8')]('/:id',auth[_0x9b0e('0x9')](),controller[_0x9b0e('0xc')]);router['get'](_0x9b0e('0xd'),auth[_0x9b0e('0x9')](),controller['getMembers']);router['get'](_0x9b0e('0xe'),auth['isAuthenticated'](),controller['getTeams']);router[_0x9b0e('0x8')](_0x9b0e('0xf'),auth['isAuthenticated'](),controller['getAgents']);router[_0x9b0e('0x10')]('/',auth[_0x9b0e('0x9')](),controller[_0x9b0e('0x11')]);router[_0x9b0e('0x10')](_0x9b0e('0xe'),auth[_0x9b0e('0x9')](),controller[_0x9b0e('0x12')]);router[_0x9b0e('0x10')](_0x9b0e('0xf'),auth[_0x9b0e('0x9')](),controller[_0x9b0e('0x13')]);router[_0x9b0e('0x14')](_0x9b0e('0x15'),auth[_0x9b0e('0x9')](),controller[_0x9b0e('0x16')]);router[_0x9b0e('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x9b0e('0x18')]);router[_0x9b0e('0x17')](_0x9b0e('0xe'),auth[_0x9b0e('0x9')](),controller[_0x9b0e('0x19')]);router[_0x9b0e('0x17')](_0x9b0e('0xf'),auth['isAuthenticated'](),controller[_0x9b0e('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x3ca4=['getMembers','/:id/teams','getTeams','/:id/users','addTeams','post','addAgents','put','/:id','update','destroy','delete','removeAgents','multer','express','Router','../../components/auth/service','../../config/environment','./chatQueue.controller','get','index','/describe','isAuthenticated','show','/:id/members'];(function(_0x55eedd,_0x2c2e12){var _0x36e41c=function(_0x8b1188){while(--_0x8b1188){_0x55eedd['push'](_0x55eedd['shift']());}};_0x36e41c(++_0x2c2e12);}(_0x3ca4,0x16b));var _0x43ca=function(_0x4fa6f3,_0x19a656){_0x4fa6f3=_0x4fa6f3-0x0;var _0x3ffbad=_0x3ca4[_0x4fa6f3];return _0x3ffbad;};'use strict';var multer=require(_0x43ca('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x43ca('0x1'));var router=express[_0x43ca('0x2')]();var auth=require(_0x43ca('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x43ca('0x4'));var controller=require(_0x43ca('0x5'));router[_0x43ca('0x6')]('/',auth['isAuthenticated'](),controller[_0x43ca('0x7')]);router['get'](_0x43ca('0x8'),auth[_0x43ca('0x9')](),controller['describe']);router[_0x43ca('0x6')]('/:id',auth[_0x43ca('0x9')](),controller[_0x43ca('0xa')]);router[_0x43ca('0x6')](_0x43ca('0xb'),auth['isAuthenticated'](),controller[_0x43ca('0xc')]);router[_0x43ca('0x6')](_0x43ca('0xd'),auth[_0x43ca('0x9')](),controller[_0x43ca('0xe')]);router['get'](_0x43ca('0xf'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x43ca('0x9')](),controller['create']);router['post'](_0x43ca('0xd'),auth[_0x43ca('0x9')](),controller[_0x43ca('0x10')]);router[_0x43ca('0x11')](_0x43ca('0xf'),auth[_0x43ca('0x9')](),controller[_0x43ca('0x12')]);router[_0x43ca('0x13')](_0x43ca('0x14'),auth[_0x43ca('0x9')](),controller[_0x43ca('0x15')]);router['delete']('/:id',auth[_0x43ca('0x9')](),controller[_0x43ca('0x16')]);router[_0x43ca('0x17')](_0x43ca('0xd'),auth[_0x43ca('0x9')](),controller['removeTeams']);router[_0x43ca('0x17')](_0x43ca('0xf'),auth[_0x43ca('0x9')](),controller[_0x43ca('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 450753d..5fbfc3f 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 _0xed4e=['exports','STRING','DATE','moment','sequelize'];(function(_0x867b0a,_0x587ccf){var _0x137438=function(_0xbeafa6){while(--_0xbeafa6){_0x867b0a['push'](_0x867b0a['shift']());}};_0x137438(++_0x587ccf);}(_0xed4e,0x139));var _0xeed4=function(_0x430c16,_0x29ffe0){_0x430c16=_0x430c16-0x0;var _0x31913d=_0xed4e[_0x430c16];return _0x31913d;};'use strict';var moment=require(_0xeed4('0x0'));var Sequelize=require(_0xeed4('0x1'));module[_0xeed4('0x2')]={'uniqueid':{'type':Sequelize[_0xeed4('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xeed4('0x3')]},'joinAt':{'type':Sequelize[_0xeed4('0x4')]},'leaveAt':{'type':Sequelize[_0xeed4('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xeed4('0x4')]},'reason':{'type':Sequelize[_0xeed4('0x3')]}}; \ No newline at end of file +var _0x3699=['DATE','sequelize','exports','STRING'];(function(_0x2dd3d6,_0x3ec6c8){var _0x9f1058=function(_0x65d8f5){while(--_0x65d8f5){_0x2dd3d6['push'](_0x2dd3d6['shift']());}};_0x9f1058(++_0x3ec6c8);}(_0x3699,0x1e5));var _0x9369=function(_0x3f83c8,_0x58cfbc){_0x3f83c8=_0x3f83c8-0x0;var _0x2d8a17=_0x3699[_0x3f83c8];return _0x2d8a17;};'use strict';var moment=require('moment');var Sequelize=require(_0x9369('0x0'));module[_0x9369('0x1')]={'uniqueid':{'type':Sequelize[_0x9369('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9369('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x9369('0x3')]},'exitAt':{'type':Sequelize[_0x9369('0x3')]},'reason':{'type':Sequelize[_0x9369('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index c095d3a..97fdbf0 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 _0xefd9=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','count','rows','catch','show','params','keys','attributes','fields','includeAll','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x4a685e,_0x121f90){var _0x3420e6=function(_0x138506){while(--_0x138506){_0x4a685e['push'](_0x4a685e['shift']());}};_0x3420e6(++_0x121f90);}(_0xefd9,0x19d));var _0x9efd=function(_0x34321d,_0x30bbe9){_0x34321d=_0x34321d-0x0;var _0x4a9af1=_0xefd9[_0x34321d];return _0x4a9af1;};'use strict';var pdf=require(_0x9efd('0x0'));var emlformat=require(_0x9efd('0x1'));var rimraf=require(_0x9efd('0x2'));var zipdir=require(_0x9efd('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9efd('0x4'));var moment=require(_0x9efd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9efd('0x6'));var util=require(_0x9efd('0x7'));var path=require(_0x9efd('0x8'));var sox=require(_0x9efd('0x9'));var csv=require(_0x9efd('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9efd('0xb'));var squel=require(_0x9efd('0xc'));var crypto=require(_0x9efd('0xd'));var jsforce=require(_0x9efd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9efd('0xa'));var querystring=require(_0x9efd('0xf'));var Papa=require(_0x9efd('0x10'));var Redis=require('ioredis');var authService=require(_0x9efd('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9efd('0x12'));var hardwareService=require(_0x9efd('0x13'));var logger=require(_0x9efd('0x14'))(_0x9efd('0x15'));var utils=require(_0x9efd('0x16'));var config=require(_0x9efd('0x17'));var licenseUtil=require(_0x9efd('0x18'));var db=require(_0x9efd('0x19'))['db'];function respondWithStatusCode(_0x28c280,_0x2b0e06){_0x2b0e06=_0x2b0e06||0xcc;return function(_0x161259){if(_0x161259){return _0x28c280[_0x9efd('0x1a')](_0x2b0e06);}return _0x28c280[_0x9efd('0x1b')](_0x2b0e06)[_0x9efd('0x1c')]();};}function respondWithResult(_0xa9ba9e,_0x5811af){_0x5811af=_0x5811af||0xc8;return function(_0x366c05){if(_0x366c05){return _0xa9ba9e[_0x9efd('0x1b')](_0x5811af)['json'](_0x366c05);}};}function respondWithFilteredResult(_0x439dfa,_0x3d1fbe){return function(_0xf3803c){if(_0xf3803c){var _0x55f4a2=_0xf3803c['count'],_0x34bf5b=_0x3d1fbe[_0x9efd('0x1d')],_0x1f2443=_0x3d1fbe[_0x9efd('0x1d')]+_0x3d1fbe[_0x9efd('0x1e')],_0x423a6b;if(_0x1f2443>=_0x55f4a2){_0x1f2443=_0x55f4a2;_0x423a6b=0xc8;}else{_0x423a6b=0xce;}_0x439dfa[_0x9efd('0x1b')](_0x423a6b);return _0x439dfa['set'](_0x9efd('0x1f'),_0x34bf5b+'-'+_0x1f2443+'/'+_0x55f4a2)['json'](_0xf3803c);}return null;};}function patchUpdates(_0x526e72){return function(_0x5f3cb6){try{jsonpatch[_0x9efd('0x20')](_0x5f3cb6,_0x526e72,!![]);}catch(_0x148e3c){return BPromise['reject'](_0x148e3c);}return _0x5f3cb6['save']();};}function saveUpdates(_0x387df2,_0x4fd373){return function(_0x4fa617){if(_0x4fa617){return _0x4fa617[_0x9efd('0x21')](_0x387df2)[_0x9efd('0x22')](function(_0x5078bd){return _0x5078bd;});}return null;};}function removeEntity(_0x32b610,_0x14dc60){return function(_0x34e80e){if(_0x34e80e){return _0x34e80e[_0x9efd('0x23')]()['then'](function(){_0x32b610[_0x9efd('0x1b')](0xcc)[_0x9efd('0x1c')]();});}};}function handleEntityNotFound(_0x52bcd3,_0x5eadab){return function(_0x168d97){if(!_0x168d97){_0x52bcd3['sendStatus'](0x194);}return _0x168d97;};}function handleError(_0x4bf9d0,_0x6216d9){_0x6216d9=_0x6216d9||0x1f4;return function(_0x5d00ab){logger[_0x9efd('0x24')](_0x5d00ab[_0x9efd('0x25')]);if(_0x5d00ab[_0x9efd('0x26')]){delete _0x5d00ab[_0x9efd('0x26')];}_0x4bf9d0[_0x9efd('0x1b')](_0x6216d9)[_0x9efd('0x27')](_0x5d00ab);};}exports[_0x9efd('0x28')]=function(_0x1c2ce1,_0x254f59){var _0x452402={},_0x2b886d={},_0x2b94d1={'count':0x0,'rows':[]};var _0x37f0bb=_[_0x9efd('0x29')](db[_0x9efd('0x2a')][_0x9efd('0x2b')],function(_0x518088){return{'name':_0x518088[_0x9efd('0x2c')],'type':_0x518088[_0x9efd('0x2d')][_0x9efd('0x2e')]};});_0x2b886d[_0x9efd('0x2f')]=_[_0x9efd('0x29')](_0x37f0bb,_0x9efd('0x26'));_0x2b886d[_0x9efd('0x30')]=_['keys'](_0x1c2ce1['query']);_0x2b886d['filters']=_[_0x9efd('0x31')](_0x2b886d[_0x9efd('0x2f')],_0x2b886d[_0x9efd('0x30')]);_0x452402['attributes']=_[_0x9efd('0x31')](_0x2b886d['model'],qs['fields'](_0x1c2ce1[_0x9efd('0x30')]['fields']));_0x452402['attributes']=_0x452402['attributes'][_0x9efd('0x32')]?_0x452402['attributes']:_0x2b886d[_0x9efd('0x2f')];if(!_0x1c2ce1[_0x9efd('0x30')][_0x9efd('0x33')](_0x9efd('0x34'))){_0x452402[_0x9efd('0x1e')]=qs[_0x9efd('0x1e')](_0x1c2ce1[_0x9efd('0x30')][_0x9efd('0x1e')]);_0x452402['offset']=qs[_0x9efd('0x1d')](_0x1c2ce1[_0x9efd('0x30')][_0x9efd('0x1d')]);}_0x452402[_0x9efd('0x35')]=qs['sort'](_0x1c2ce1[_0x9efd('0x30')][_0x9efd('0x36')]);_0x452402[_0x9efd('0x37')]=qs[_0x9efd('0x38')](_['pick'](_0x1c2ce1[_0x9efd('0x30')],_0x2b886d['filters']),_0x37f0bb);if(_0x1c2ce1[_0x9efd('0x30')][_0x9efd('0x39')]){_0x452402[_0x9efd('0x37')]=_['merge'](_0x452402[_0x9efd('0x37')],{'$or':_['map'](_0x37f0bb,function(_0x4b39ae){if(_0x4b39ae[_0x9efd('0x2d')]!=='VIRTUAL'){var _0xabdb4b={};_0xabdb4b[_0x4b39ae[_0x9efd('0x26')]]={'$like':'%'+_0x1c2ce1[_0x9efd('0x30')][_0x9efd('0x39')]+'%'};return _0xabdb4b;}})});}_0x452402=_[_0x9efd('0x3a')]({},_0x452402,_0x1c2ce1[_0x9efd('0x3b')]);var _0x206581={'where':_0x452402['where']};return db['ChatQueueReport']['count'](_0x206581)[_0x9efd('0x22')](function(_0x51470a){_0x2b94d1[_0x9efd('0x3c')]=_0x51470a;if(_0x1c2ce1['query']['includeAll']){_0x452402['include']=[{'all':!![]}];}return db[_0x9efd('0x2a')]['findAll'](_0x452402);})[_0x9efd('0x22')](function(_0x24d421){_0x2b94d1[_0x9efd('0x3d')]=_0x24d421;return _0x2b94d1;})[_0x9efd('0x22')](respondWithFilteredResult(_0x254f59,_0x452402))[_0x9efd('0x3e')](handleError(_0x254f59,null));};exports[_0x9efd('0x3f')]=function(_0x11e8d7,_0xa56617){var _0x6ae3eb={'raw':!![],'where':{'id':_0x11e8d7[_0x9efd('0x40')]['id']}},_0x46b4f1={};_0x46b4f1[_0x9efd('0x2f')]=_[_0x9efd('0x41')](db[_0x9efd('0x2a')]['rawAttributes']);_0x46b4f1[_0x9efd('0x30')]=_[_0x9efd('0x41')](_0x11e8d7[_0x9efd('0x30')]);_0x46b4f1['filters']=_['intersection'](_0x46b4f1[_0x9efd('0x2f')],_0x46b4f1[_0x9efd('0x30')]);_0x6ae3eb[_0x9efd('0x42')]=_[_0x9efd('0x31')](_0x46b4f1[_0x9efd('0x2f')],qs[_0x9efd('0x43')](_0x11e8d7[_0x9efd('0x30')][_0x9efd('0x43')]));_0x6ae3eb[_0x9efd('0x42')]=_0x6ae3eb[_0x9efd('0x42')]['length']?_0x6ae3eb[_0x9efd('0x42')]:_0x46b4f1[_0x9efd('0x2f')];if(_0x11e8d7[_0x9efd('0x30')][_0x9efd('0x44')]){_0x6ae3eb['include']=[{'all':!![]}];}_0x6ae3eb=_['merge']({},_0x6ae3eb,_0x11e8d7[_0x9efd('0x3b')]);return db['ChatQueueReport']['find'](_0x6ae3eb)['then'](handleEntityNotFound(_0xa56617,null))[_0x9efd('0x22')](respondWithResult(_0xa56617,null))[_0x9efd('0x3e')](handleError(_0xa56617,null));};exports[_0x9efd('0x45')]=function(_0x3f7fc6,_0x2fb046){return db[_0x9efd('0x2a')][_0x9efd('0x45')](_0x3f7fc6[_0x9efd('0x46')],{})[_0x9efd('0x22')](respondWithResult(_0x2fb046,0xc9))[_0x9efd('0x3e')](handleError(_0x2fb046,null));};exports[_0x9efd('0x21')]=function(_0x3051b0,_0x3fff0d){if(_0x3051b0[_0x9efd('0x46')]['id']){delete _0x3051b0['body']['id'];}return db[_0x9efd('0x2a')]['find']({'where':{'id':_0x3051b0['params']['id']}})[_0x9efd('0x22')](handleEntityNotFound(_0x3fff0d,null))['then'](saveUpdates(_0x3051b0[_0x9efd('0x46')],null))['then'](respondWithResult(_0x3fff0d,null))[_0x9efd('0x3e')](handleError(_0x3fff0d,null));};exports[_0x9efd('0x23')]=function(_0x39d461,_0x36735b){return db[_0x9efd('0x2a')]['find']({'where':{'id':_0x39d461[_0x9efd('0x40')]['id']}})[_0x9efd('0x22')](handleEntityNotFound(_0x36735b,null))[_0x9efd('0x22')](removeEntity(_0x36735b,null))[_0x9efd('0x3e')](handleError(_0x36735b,null));};exports['describe']=function(_0x1de3dc,_0x3325a2){return db['ChatQueueReport'][_0x9efd('0x47')]()['then'](respondWithResult(_0x3325a2,null))['catch'](handleError(_0x3325a2,null));}; \ No newline at end of file +var _0xbb28=['json','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','pick','filter','where','merge','VIRTUAL','options','ChatQueueReport','count','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','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/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x2c534a,_0x18a19e){var _0x3f5c99=function(_0x4c085f){while(--_0x4c085f){_0x2c534a['push'](_0x2c534a['shift']());}};_0x3f5c99(++_0x18a19e);}(_0xbb28,0x116));var _0x8bb2=function(_0x5ea785,_0xaaaeec){_0x5ea785=_0x5ea785-0x0;var _0x25810e=_0xbb28[_0x5ea785];return _0x25810e;};'use strict';var pdf=require(_0x8bb2('0x0'));var emlformat=require(_0x8bb2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8bb2('0x2'));var jsonpatch=require(_0x8bb2('0x3'));var rp=require(_0x8bb2('0x4'));var moment=require(_0x8bb2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8bb2('0x6'));var path=require(_0x8bb2('0x7'));var sox=require(_0x8bb2('0x8'));var csv=require(_0x8bb2('0x9'));var ejs=require(_0x8bb2('0xa'));var fs=require('fs');var _=require(_0x8bb2('0xb'));var squel=require(_0x8bb2('0xc'));var crypto=require(_0x8bb2('0xd'));var jsforce=require(_0x8bb2('0xe'));var deskjs=require(_0x8bb2('0xf'));var toCsv=require(_0x8bb2('0x9'));var querystring=require(_0x8bb2('0x10'));var Papa=require(_0x8bb2('0x11'));var Redis=require('ioredis');var authService=require(_0x8bb2('0x12'));var qs=require(_0x8bb2('0x13'));var as=require(_0x8bb2('0x14'));var hardwareService=require(_0x8bb2('0x15'));var logger=require(_0x8bb2('0x16'))('api');var utils=require(_0x8bb2('0x17'));var config=require(_0x8bb2('0x18'));var licenseUtil=require(_0x8bb2('0x19'));var db=require(_0x8bb2('0x1a'))['db'];function respondWithStatusCode(_0x308fcf,_0x1238b8){_0x1238b8=_0x1238b8||0xcc;return function(_0xed3529){if(_0xed3529){return _0x308fcf[_0x8bb2('0x1b')](_0x1238b8);}return _0x308fcf['status'](_0x1238b8)[_0x8bb2('0x1c')]();};}function respondWithResult(_0x4aee1a,_0x2ba46a){_0x2ba46a=_0x2ba46a||0xc8;return function(_0x219192){if(_0x219192){return _0x4aee1a[_0x8bb2('0x1d')](_0x2ba46a)[_0x8bb2('0x1e')](_0x219192);}};}function respondWithFilteredResult(_0x48a14e,_0x30d9a5){return function(_0x457fd1){if(_0x457fd1){var _0x4af390=_0x457fd1['count'],_0x570380=_0x30d9a5['offset'],_0x3d6c98=_0x30d9a5[_0x8bb2('0x1f')]+_0x30d9a5['limit'],_0x101db6;if(_0x3d6c98>=_0x4af390){_0x3d6c98=_0x4af390;_0x101db6=0xc8;}else{_0x101db6=0xce;}_0x48a14e[_0x8bb2('0x1d')](_0x101db6);return _0x48a14e[_0x8bb2('0x20')](_0x8bb2('0x21'),_0x570380+'-'+_0x3d6c98+'/'+_0x4af390)[_0x8bb2('0x1e')](_0x457fd1);}return null;};}function patchUpdates(_0x5c0d48){return function(_0x4c5cfe){try{jsonpatch['apply'](_0x4c5cfe,_0x5c0d48,!![]);}catch(_0x72e9f2){return BPromise[_0x8bb2('0x22')](_0x72e9f2);}return _0x4c5cfe[_0x8bb2('0x23')]();};}function saveUpdates(_0x280907,_0x10bbf7){return function(_0x595972){if(_0x595972){return _0x595972[_0x8bb2('0x24')](_0x280907)[_0x8bb2('0x25')](function(_0x183df1){return _0x183df1;});}return null;};}function removeEntity(_0x3028b2,_0x40834c){return function(_0x22d412){if(_0x22d412){return _0x22d412[_0x8bb2('0x26')]()[_0x8bb2('0x25')](function(){_0x3028b2['status'](0xcc)[_0x8bb2('0x1c')]();});}};}function handleEntityNotFound(_0x14aed6,_0x31579f){return function(_0x443583){if(!_0x443583){_0x14aed6[_0x8bb2('0x1b')](0x194);}return _0x443583;};}function handleError(_0x511f66,_0xfa41b6){_0xfa41b6=_0xfa41b6||0x1f4;return function(_0x3c053c){logger[_0x8bb2('0x27')](_0x3c053c[_0x8bb2('0x28')]);if(_0x3c053c['name']){delete _0x3c053c[_0x8bb2('0x29')];}_0x511f66[_0x8bb2('0x1d')](_0xfa41b6)['send'](_0x3c053c);};}exports[_0x8bb2('0x2a')]=function(_0x180529,_0x5b9480){var _0x43013e={},_0x560ec1={},_0x515330={'count':0x0,'rows':[]};var _0x4ec304=_[_0x8bb2('0x2b')](db['ChatQueueReport'][_0x8bb2('0x2c')],function(_0x568214){return{'name':_0x568214[_0x8bb2('0x2d')],'type':_0x568214[_0x8bb2('0x2e')]['key']};});_0x560ec1['model']=_[_0x8bb2('0x2b')](_0x4ec304,_0x8bb2('0x29'));_0x560ec1[_0x8bb2('0x2f')]=_['keys'](_0x180529[_0x8bb2('0x2f')]);_0x560ec1[_0x8bb2('0x30')]=_[_0x8bb2('0x31')](_0x560ec1[_0x8bb2('0x32')],_0x560ec1[_0x8bb2('0x2f')]);_0x43013e[_0x8bb2('0x33')]=_[_0x8bb2('0x31')](_0x560ec1['model'],qs[_0x8bb2('0x34')](_0x180529['query'][_0x8bb2('0x34')]));_0x43013e[_0x8bb2('0x33')]=_0x43013e[_0x8bb2('0x33')]['length']?_0x43013e[_0x8bb2('0x33')]:_0x560ec1[_0x8bb2('0x32')];if(!_0x180529[_0x8bb2('0x2f')][_0x8bb2('0x35')](_0x8bb2('0x36'))){_0x43013e['limit']=qs[_0x8bb2('0x37')](_0x180529[_0x8bb2('0x2f')][_0x8bb2('0x37')]);_0x43013e[_0x8bb2('0x1f')]=qs[_0x8bb2('0x1f')](_0x180529[_0x8bb2('0x2f')][_0x8bb2('0x1f')]);}_0x43013e[_0x8bb2('0x38')]=qs['sort'](_0x180529[_0x8bb2('0x2f')]['sort']);_0x43013e['where']=qs[_0x8bb2('0x30')](_[_0x8bb2('0x39')](_0x180529[_0x8bb2('0x2f')],_0x560ec1[_0x8bb2('0x30')]),_0x4ec304);if(_0x180529['query'][_0x8bb2('0x3a')]){_0x43013e[_0x8bb2('0x3b')]=_[_0x8bb2('0x3c')](_0x43013e[_0x8bb2('0x3b')],{'$or':_['map'](_0x4ec304,function(_0x2b4eb3){if(_0x2b4eb3['type']!==_0x8bb2('0x3d')){var _0x3292d8={};_0x3292d8[_0x2b4eb3[_0x8bb2('0x29')]]={'$like':'%'+_0x180529['query']['filter']+'%'};return _0x3292d8;}})});}_0x43013e=_[_0x8bb2('0x3c')]({},_0x43013e,_0x180529[_0x8bb2('0x3e')]);var _0x41a7f6={'where':_0x43013e[_0x8bb2('0x3b')]};return db[_0x8bb2('0x3f')][_0x8bb2('0x40')](_0x41a7f6)[_0x8bb2('0x25')](function(_0x23b8b5){_0x515330[_0x8bb2('0x40')]=_0x23b8b5;if(_0x180529['query'][_0x8bb2('0x41')]){_0x43013e[_0x8bb2('0x42')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x8bb2('0x43')](_0x43013e);})[_0x8bb2('0x25')](function(_0x203975){_0x515330[_0x8bb2('0x44')]=_0x203975;return _0x515330;})['then'](respondWithFilteredResult(_0x5b9480,_0x43013e))[_0x8bb2('0x45')](handleError(_0x5b9480,null));};exports['show']=function(_0x33a7db,_0x115845){var _0x5c70dc={'raw':!![],'where':{'id':_0x33a7db[_0x8bb2('0x46')]['id']}},_0x467295={};_0x467295[_0x8bb2('0x32')]=_[_0x8bb2('0x47')](db[_0x8bb2('0x3f')][_0x8bb2('0x2c')]);_0x467295['query']=_['keys'](_0x33a7db[_0x8bb2('0x2f')]);_0x467295[_0x8bb2('0x30')]=_[_0x8bb2('0x31')](_0x467295['model'],_0x467295['query']);_0x5c70dc['attributes']=_[_0x8bb2('0x31')](_0x467295['model'],qs[_0x8bb2('0x34')](_0x33a7db[_0x8bb2('0x2f')]['fields']));_0x5c70dc[_0x8bb2('0x33')]=_0x5c70dc[_0x8bb2('0x33')][_0x8bb2('0x48')]?_0x5c70dc[_0x8bb2('0x33')]:_0x467295[_0x8bb2('0x32')];if(_0x33a7db[_0x8bb2('0x2f')]['includeAll']){_0x5c70dc[_0x8bb2('0x42')]=[{'all':!![]}];}_0x5c70dc=_[_0x8bb2('0x3c')]({},_0x5c70dc,_0x33a7db[_0x8bb2('0x3e')]);return db[_0x8bb2('0x3f')][_0x8bb2('0x49')](_0x5c70dc)[_0x8bb2('0x25')](handleEntityNotFound(_0x115845,null))[_0x8bb2('0x25')](respondWithResult(_0x115845,null))[_0x8bb2('0x45')](handleError(_0x115845,null));};exports[_0x8bb2('0x4a')]=function(_0x4308ba,_0x1858c9){return db[_0x8bb2('0x3f')][_0x8bb2('0x4a')](_0x4308ba[_0x8bb2('0x4b')],{})['then'](respondWithResult(_0x1858c9,0xc9))[_0x8bb2('0x45')](handleError(_0x1858c9,null));};exports[_0x8bb2('0x24')]=function(_0x32d618,_0x26e006){if(_0x32d618['body']['id']){delete _0x32d618[_0x8bb2('0x4b')]['id'];}return db[_0x8bb2('0x3f')][_0x8bb2('0x49')]({'where':{'id':_0x32d618[_0x8bb2('0x46')]['id']}})[_0x8bb2('0x25')](handleEntityNotFound(_0x26e006,null))['then'](saveUpdates(_0x32d618['body'],null))[_0x8bb2('0x25')](respondWithResult(_0x26e006,null))[_0x8bb2('0x45')](handleError(_0x26e006,null));};exports[_0x8bb2('0x26')]=function(_0x4e2562,_0x8d9ee1){return db[_0x8bb2('0x3f')]['find']({'where':{'id':_0x4e2562[_0x8bb2('0x46')]['id']}})[_0x8bb2('0x25')](handleEntityNotFound(_0x8d9ee1,null))[_0x8bb2('0x25')](removeEntity(_0x8d9ee1,null))[_0x8bb2('0x45')](handleError(_0x8d9ee1,null));};exports['describe']=function(_0x1483ad,_0x52f83d){return db[_0x8bb2('0x3f')][_0x8bb2('0x4c')]()['then'](respondWithResult(_0x52f83d,null))[_0x8bb2('0x45')](handleError(_0x52f83d,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index d3626c9..55d42ed 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 _0x69dc=['exports','define','report_chat_queue','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes'];(function(_0x161ab6,_0x51ee5c){var _0x437d12=function(_0x38002d){while(--_0x38002d){_0x161ab6['push'](_0x161ab6['shift']());}};_0x437d12(++_0x51ee5c);}(_0x69dc,0x1b6));var _0xc69d=function(_0x475d85,_0x50fe4d){_0x475d85=_0x475d85-0x0;var _0x2ddb85=_0x69dc[_0x475d85];return _0x2ddb85;};'use strict';var _=require(_0xc69d('0x0'));var util=require(_0xc69d('0x1'));var logger=require('../../config/logger')(_0xc69d('0x2'));var moment=require(_0xc69d('0x3'));var BPromise=require(_0xc69d('0x4'));var rp=require(_0xc69d('0x5'));var fs=require('fs');var path=require(_0xc69d('0x6'));var rimraf=require(_0xc69d('0x7'));var config=require(_0xc69d('0x8'));var attributes=require(_0xc69d('0x9'));module[_0xc69d('0xa')]=function(_0x2172c9,_0x436428){return _0x2172c9[_0xc69d('0xb')]('ChatQueueReport',attributes,{'tableName':_0xc69d('0xc'),'paranoid':![],'indexes':[{'name':_0xc69d('0xd'),'fields':[_0xc69d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d38=['ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x2d38,0xff));var _0x82d3=function(_0x1781d6,_0x4c8455){_0x1781d6=_0x1781d6-0x0;var _0x352034=_0x2d38[_0x1781d6];return _0x352034;};'use strict';var _=require('lodash');var util=require(_0x82d3('0x0'));var logger=require(_0x82d3('0x1'))(_0x82d3('0x2'));var moment=require(_0x82d3('0x3'));var BPromise=require('bluebird');var rp=require(_0x82d3('0x4'));var fs=require('fs');var path=require(_0x82d3('0x5'));var rimraf=require(_0x82d3('0x6'));var config=require(_0x82d3('0x7'));var attributes=require(_0x82d3('0x8'));module[_0x82d3('0x9')]=function(_0x1d3997,_0x4e50b4){return _0x1d3997[_0x82d3('0xa')](_0x82d3('0xb'),attributes,{'tableName':_0x82d3('0xc'),'paranoid':![],'indexes':[{'name':_0x82d3('0xd'),'fields':[_0x82d3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 6b471db..75ee339 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 _0x5fe5=['request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateChatQueueReport','create','body','options','raw','debug','stringify','UpdateChatQueueReport','ChatQueueReport','update','where','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x5fe5,0x13c));var _0x55fe=function(_0x9a3e0f,_0x2f796d){_0x9a3e0f=_0x9a3e0f-0x0;var _0x3d2a9a=_0x5fe5[_0x9a3e0f];return _0x3d2a9a;};'use strict';var _=require(_0x55fe('0x0'));var util=require(_0x55fe('0x1'));var moment=require(_0x55fe('0x2'));var BPromise=require(_0x55fe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x55fe('0x4'))['db'];var utils=require(_0x55fe('0x5'));var logger=require(_0x55fe('0x6'))(_0x55fe('0x7'));var config=require('../../config/environment');var jayson=require(_0x55fe('0x8'));var client=jayson['client'][_0x55fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cd610,_0x39471c,_0x1c0653){return new BPromise(function(_0x1781c5,_0x5e9fa9){return client[_0x55fe('0xa')](_0x4cd610,_0x1c0653)[_0x55fe('0xb')](function(_0x42d20e){logger[_0x55fe('0xc')](_0x55fe('0xd'),_0x39471c,_0x55fe('0xe'));logger['debug'](_0x55fe('0xf'),_0x39471c,_0x55fe('0xe'),JSON['stringify'](_0x42d20e));if(_0x42d20e[_0x55fe('0x10')]){if(_0x42d20e[_0x55fe('0x10')][_0x55fe('0x11')]===0x1f4){logger['error'](_0x55fe('0xd'),_0x39471c,_0x42d20e[_0x55fe('0x10')][_0x55fe('0x12')]);return _0x5e9fa9(_0x42d20e['error'][_0x55fe('0x12')]);}logger[_0x55fe('0x10')](_0x55fe('0xd'),_0x39471c,_0x42d20e['error'][_0x55fe('0x12')]);return _0x1781c5(_0x42d20e[_0x55fe('0x10')][_0x55fe('0x12')]);}else{logger[_0x55fe('0xc')](_0x55fe('0xd'),_0x39471c,'request\x20sent');_0x1781c5(_0x42d20e[_0x55fe('0x13')][_0x55fe('0x12')]);}})[_0x55fe('0x14')](function(_0x37297b){logger['error'](_0x55fe('0xd'),_0x39471c,_0x37297b);_0x5e9fa9(_0x37297b);});});}exports[_0x55fe('0x15')]=function(_0x497f8d){var _0x17565d=this;return new Promise(function(_0x4ed768,_0x29671a){return db['ChatQueueReport'][_0x55fe('0x16')](_0x497f8d[_0x55fe('0x17')],{'raw':_0x497f8d[_0x55fe('0x18')]?_0x497f8d['options'][_0x55fe('0x19')]===undefined?!![]:![]:!![]})[_0x55fe('0xb')](function(_0x56b527){logger['info']('CreateChatQueueReport',_0x497f8d);logger[_0x55fe('0x1a')](_0x55fe('0x15'),_0x497f8d,JSON[_0x55fe('0x1b')](_0x56b527));_0x4ed768(_0x56b527);})['catch'](function(_0x154bee){logger[_0x55fe('0x10')](_0x55fe('0x15'),_0x154bee['message'],_0x497f8d);_0x29671a(_0x17565d[_0x55fe('0x10')](0x1f4,_0x154bee[_0x55fe('0x12')]));});});};exports[_0x55fe('0x1c')]=function(_0x1fdbad){var _0x586d20=this;return new Promise(function(_0x3d5165,_0x49bc53){return db[_0x55fe('0x1d')][_0x55fe('0x1e')](_0x1fdbad[_0x55fe('0x17')],{'raw':_0x1fdbad[_0x55fe('0x18')]?_0x1fdbad[_0x55fe('0x18')][_0x55fe('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fdbad[_0x55fe('0x18')]?_0x1fdbad['options'][_0x55fe('0x1f')]||null:null,'attributes':_0x1fdbad[_0x55fe('0x18')]?_0x1fdbad[_0x55fe('0x18')]['attributes']||null:null,'limit':_0x1fdbad[_0x55fe('0x18')]?_0x1fdbad[_0x55fe('0x18')][_0x55fe('0x20')]||null:null})['then'](function(_0x27328e){logger['info']('UpdateChatQueueReport',_0x1fdbad);logger['debug']('UpdateChatQueueReport',_0x1fdbad,JSON[_0x55fe('0x1b')](_0x27328e));_0x3d5165(_0x27328e);})[_0x55fe('0x14')](function(_0x1dfc75){logger[_0x55fe('0x10')](_0x55fe('0x1c'),_0x1dfc75[_0x55fe('0x12')],_0x1fdbad);_0x49bc53(_0x586d20[_0x55fe('0x10')](0x1f4,_0x1dfc75[_0x55fe('0x12')]));});});}; \ No newline at end of file +var _0x253f=['stringify','error','code','message','result','catch','ChatQueueReport','body','options','raw','CreateChatQueueReport','UpdateChatQueueReport','update','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x2f52f6,_0x463684){var _0xc2dc78=function(_0x5ea46e){while(--_0x5ea46e){_0x2f52f6['push'](_0x2f52f6['shift']());}};_0xc2dc78(++_0x463684);}(_0x253f,0xe7));var _0xf253=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x253f[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0xf253('0x0'));var util=require('util');var moment=require(_0xf253('0x1'));var BPromise=require(_0xf253('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf253('0x3'));var db=require(_0xf253('0x4'))['db'];var utils=require(_0xf253('0x5'));var logger=require(_0xf253('0x6'))(_0xf253('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf253('0x8')][_0xf253('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31c842,_0x34f1ad,_0x18c0d3){return new BPromise(function(_0x2fd8a6,_0x8fb9b0){return client[_0xf253('0xa')](_0x31c842,_0x18c0d3)[_0xf253('0xb')](function(_0x402209){logger[_0xf253('0xc')](_0xf253('0xd'),_0x34f1ad,_0xf253('0xe'));logger[_0xf253('0xf')](_0xf253('0x10'),_0x34f1ad,_0xf253('0xe'),JSON[_0xf253('0x11')](_0x402209));if(_0x402209[_0xf253('0x12')]){if(_0x402209[_0xf253('0x12')][_0xf253('0x13')]===0x1f4){logger[_0xf253('0x12')](_0xf253('0xd'),_0x34f1ad,_0x402209[_0xf253('0x12')][_0xf253('0x14')]);return _0x8fb9b0(_0x402209['error']['message']);}logger[_0xf253('0x12')](_0xf253('0xd'),_0x34f1ad,_0x402209['error']['message']);return _0x2fd8a6(_0x402209[_0xf253('0x12')]['message']);}else{logger[_0xf253('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x34f1ad,'request\x20sent');_0x2fd8a6(_0x402209[_0xf253('0x15')][_0xf253('0x14')]);}})[_0xf253('0x16')](function(_0x52f053){logger['error'](_0xf253('0xd'),_0x34f1ad,_0x52f053);_0x8fb9b0(_0x52f053);});});}exports['CreateChatQueueReport']=function(_0x83f3fc){var _0x54aeba=this;return new Promise(function(_0x287c35,_0x1eb390){return db[_0xf253('0x17')]['create'](_0x83f3fc[_0xf253('0x18')],{'raw':_0x83f3fc['options']?_0x83f3fc[_0xf253('0x19')][_0xf253('0x1a')]===undefined?!![]:![]:!![]})[_0xf253('0xb')](function(_0x43b559){logger[_0xf253('0xc')](_0xf253('0x1b'),_0x83f3fc);logger['debug'](_0xf253('0x1b'),_0x83f3fc,JSON[_0xf253('0x11')](_0x43b559));_0x287c35(_0x43b559);})[_0xf253('0x16')](function(_0x501996){logger[_0xf253('0x12')](_0xf253('0x1b'),_0x501996[_0xf253('0x14')],_0x83f3fc);_0x1eb390(_0x54aeba[_0xf253('0x12')](0x1f4,_0x501996[_0xf253('0x14')]));});});};exports[_0xf253('0x1c')]=function(_0x37dbf8){var _0x591f04=this;return new Promise(function(_0x120ccf,_0x51858d){return db[_0xf253('0x17')][_0xf253('0x1d')](_0x37dbf8['body'],{'raw':_0x37dbf8[_0xf253('0x19')]?_0x37dbf8[_0xf253('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37dbf8[_0xf253('0x19')]?_0x37dbf8[_0xf253('0x19')]['where']||null:null,'attributes':_0x37dbf8[_0xf253('0x19')]?_0x37dbf8[_0xf253('0x19')]['attributes']||null:null,'limit':_0x37dbf8['options']?_0x37dbf8[_0xf253('0x19')][_0xf253('0x1e')]||null:null})[_0xf253('0xb')](function(_0x3c2b0c){logger[_0xf253('0xc')](_0xf253('0x1c'),_0x37dbf8);logger['debug']('UpdateChatQueueReport',_0x37dbf8,JSON[_0xf253('0x11')](_0x3c2b0c));_0x120ccf(_0x3c2b0c);})[_0xf253('0x16')](function(_0x2a8246){logger[_0xf253('0x12')](_0xf253('0x1c'),_0x2a8246['message'],_0x37dbf8);_0x51858d(_0x591f04['error'](0x1f4,_0x2a8246['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index e8d1608..abef56f 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 _0x2405=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x373a31,_0x506e31){var _0x141311=function(_0x51365b){while(--_0x51365b){_0x373a31['push'](_0x373a31['shift']());}};_0x141311(++_0x506e31);}(_0x2405,0xee));var _0x5240=function(_0x45ec0b,_0x260c5d){_0x45ec0b=_0x45ec0b-0x0;var _0x99a3d8=_0x2405[_0x45ec0b];return _0x99a3d8;};'use strict';var multer=require(_0x5240('0x0'));var util=require('util');var path=require(_0x5240('0x1'));var timeout=require('connect-timeout');var express=require(_0x5240('0x2'));var router=express[_0x5240('0x3')]();var auth=require(_0x5240('0x4'));var interaction=require(_0x5240('0x5'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x5240('0x6')]('/',auth[_0x5240('0x7')](),controller['index']);router[_0x5240('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x5240('0x6')](_0x5240('0x8'),auth[_0x5240('0x7')](),controller[_0x5240('0x9')]);router[_0x5240('0xa')]('/',auth['isAuthenticated'](),controller[_0x5240('0xb')]);router[_0x5240('0xc')](_0x5240('0x8'),auth[_0x5240('0x7')](),controller[_0x5240('0xd')]);router[_0x5240('0xe')](_0x5240('0x8'),auth[_0x5240('0x7')](),controller[_0x5240('0xf')]);module[_0x5240('0x10')]=router; \ No newline at end of file +var _0xaa31=['create','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post'];(function(_0x644f7d,_0x2ff81c){var _0x276d5b=function(_0x3d362d){while(--_0x3d362d){_0x644f7d['push'](_0x644f7d['shift']());}};_0x276d5b(++_0x2ff81c);}(_0xaa31,0x10d));var _0x1aa3=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xaa31[_0x5a9c0c];return _0x53c77d;};'use strict';var multer=require(_0x1aa3('0x0'));var util=require('util');var path=require(_0x1aa3('0x1'));var timeout=require(_0x1aa3('0x2'));var express=require(_0x1aa3('0x3'));var router=express[_0x1aa3('0x4')]();var auth=require(_0x1aa3('0x5'));var interaction=require(_0x1aa3('0x6'));var config=require(_0x1aa3('0x7'));var controller=require(_0x1aa3('0x8'));router[_0x1aa3('0x9')]('/',auth[_0x1aa3('0xa')](),controller['index']);router['get'](_0x1aa3('0xb'),auth['isAuthenticated'](),controller[_0x1aa3('0xc')]);router[_0x1aa3('0x9')](_0x1aa3('0xd'),auth[_0x1aa3('0xa')](),controller[_0x1aa3('0xe')]);router[_0x1aa3('0xf')]('/',auth[_0x1aa3('0xa')](),controller[_0x1aa3('0x10')]);router['put'](_0x1aa3('0xd'),auth[_0x1aa3('0xa')](),controller[_0x1aa3('0x11')]);router['delete']('/:id',auth[_0x1aa3('0xa')](),controller['destroy']);module[_0x1aa3('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index b51db09..d0c8b8c 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 _0x89c8=['queue','DATE','sequelize','exports','STRING','ENUM','agent'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x89c8,0x72));var _0x889c=function(_0x12a770,_0x493835){_0x12a770=_0x12a770-0x0;var _0x50a8b4=_0x89c8[_0x12a770];return _0x50a8b4;};'use strict';var moment=require('moment');var Sequelize=require(_0x889c('0x0'));module[_0x889c('0x1')]={'uniqueid':{'type':Sequelize[_0x889c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x889c('0x3')]('account',_0x889c('0x4'),_0x889c('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x889c('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x9f79=['STRING','ENUM','agent','queue','NOW','sequelize','exports'];(function(_0x21c0de,_0x4a9720){var _0x32229e=function(_0x275c29){while(--_0x275c29){_0x21c0de['push'](_0x21c0de['shift']());}};_0x32229e(++_0x4a9720);}(_0x9f79,0x1d3));var _0x99f7=function(_0x5c56f7,_0x217295){_0x5c56f7=_0x5c56f7-0x0;var _0x208ad4=_0x9f79[_0x5c56f7];return _0x208ad4;};'use strict';var moment=require('moment');var Sequelize=require(_0x99f7('0x0'));module[_0x99f7('0x1')]={'uniqueid':{'type':Sequelize[_0x99f7('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x99f7('0x3')]('account',_0x99f7('0x4'),_0x99f7('0x5')),'allowNull':![],'defaultValue':_0x99f7('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x99f7('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 57d21f3..438f121 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 _0x8785=['ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','set','Content-Range','reject','update','then','error','stack','name','send','map','ChatTransferReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','include','findAll','catch','show','params','includeAll','create','body','find','destroy','describe','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8785,0x1dc));var _0x5878=function(_0x5766ef,_0x5e45f3){_0x5766ef=_0x5766ef-0x0;var _0x1dc03e=_0x8785[_0x5766ef];return _0x1dc03e;};'use strict';var pdf=require(_0x5878('0x0'));var emlformat=require(_0x5878('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5878('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5878('0x3'));var BPromise=require(_0x5878('0x4'));var Mustache=require(_0x5878('0x5'));var util=require(_0x5878('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x5878('0x7'));var ejs=require(_0x5878('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5878('0x9'));var crypto=require(_0x5878('0xa'));var jsforce=require(_0x5878('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5878('0x7'));var querystring=require(_0x5878('0xc'));var Papa=require(_0x5878('0xd'));var Redis=require(_0x5878('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5878('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5878('0x10'))(_0x5878('0x11'));var utils=require(_0x5878('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x5878('0x13'));var db=require(_0x5878('0x14'))['db'];function respondWithStatusCode(_0x315b01,_0x4f26da){_0x4f26da=_0x4f26da||0xcc;return function(_0x54e2fd){if(_0x54e2fd){return _0x315b01['sendStatus'](_0x4f26da);}return _0x315b01[_0x5878('0x15')](_0x4f26da)[_0x5878('0x16')]();};}function respondWithResult(_0x47011a,_0x41b541){_0x41b541=_0x41b541||0xc8;return function(_0x20594d){if(_0x20594d){return _0x47011a[_0x5878('0x15')](_0x41b541)[_0x5878('0x17')](_0x20594d);}};}function respondWithFilteredResult(_0x273dcd,_0x54b06e){return function(_0x51e698){if(_0x51e698){var _0x17d639=_0x51e698['count'],_0x2f79f5=_0x54b06e[_0x5878('0x18')],_0x5b8eed=_0x54b06e[_0x5878('0x18')]+_0x54b06e['limit'],_0x4f908e;if(_0x5b8eed>=_0x17d639){_0x5b8eed=_0x17d639;_0x4f908e=0xc8;}else{_0x4f908e=0xce;}_0x273dcd[_0x5878('0x15')](_0x4f908e);return _0x273dcd[_0x5878('0x19')](_0x5878('0x1a'),_0x2f79f5+'-'+_0x5b8eed+'/'+_0x17d639)['json'](_0x51e698);}return null;};}function patchUpdates(_0x1e830b){return function(_0x59f784){try{jsonpatch['apply'](_0x59f784,_0x1e830b,!![]);}catch(_0x2953bb){return BPromise[_0x5878('0x1b')](_0x2953bb);}return _0x59f784['save']();};}function saveUpdates(_0x20afb4,_0x3ba888){return function(_0x360ca4){if(_0x360ca4){return _0x360ca4[_0x5878('0x1c')](_0x20afb4)[_0x5878('0x1d')](function(_0x54704d){return _0x54704d;});}return null;};}function removeEntity(_0x1fd7f7,_0x53eccf){return function(_0x298185){if(_0x298185){return _0x298185['destroy']()[_0x5878('0x1d')](function(){_0x1fd7f7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48d70b,_0x5e0eb8){return function(_0x507e45){if(!_0x507e45){_0x48d70b['sendStatus'](0x194);}return _0x507e45;};}function handleError(_0x30f99e,_0x5458ff){_0x5458ff=_0x5458ff||0x1f4;return function(_0x52e7d6){logger[_0x5878('0x1e')](_0x52e7d6[_0x5878('0x1f')]);if(_0x52e7d6[_0x5878('0x20')]){delete _0x52e7d6[_0x5878('0x20')];}_0x30f99e[_0x5878('0x15')](_0x5458ff)[_0x5878('0x21')](_0x52e7d6);};}exports['index']=function(_0x4afaa6,_0x1dd60d){var _0x346f01={},_0x33a5af={},_0x179fc8={'count':0x0,'rows':[]};var _0xd7b32b=_[_0x5878('0x22')](db[_0x5878('0x23')][_0x5878('0x24')],function(_0x44bbfd){return{'name':_0x44bbfd['fieldName'],'type':_0x44bbfd[_0x5878('0x25')][_0x5878('0x26')]};});_0x33a5af[_0x5878('0x27')]=_['map'](_0xd7b32b,_0x5878('0x20'));_0x33a5af['query']=_[_0x5878('0x28')](_0x4afaa6[_0x5878('0x29')]);_0x33a5af[_0x5878('0x2a')]=_[_0x5878('0x2b')](_0x33a5af['model'],_0x33a5af[_0x5878('0x29')]);_0x346f01[_0x5878('0x2c')]=_[_0x5878('0x2b')](_0x33a5af[_0x5878('0x27')],qs[_0x5878('0x2d')](_0x4afaa6[_0x5878('0x29')][_0x5878('0x2d')]));_0x346f01['attributes']=_0x346f01[_0x5878('0x2c')][_0x5878('0x2e')]?_0x346f01['attributes']:_0x33a5af[_0x5878('0x27')];if(!_0x4afaa6['query'][_0x5878('0x2f')](_0x5878('0x30'))){_0x346f01[_0x5878('0x31')]=qs[_0x5878('0x31')](_0x4afaa6[_0x5878('0x29')][_0x5878('0x31')]);_0x346f01[_0x5878('0x18')]=qs[_0x5878('0x18')](_0x4afaa6[_0x5878('0x29')][_0x5878('0x18')]);}_0x346f01[_0x5878('0x32')]=qs['sort'](_0x4afaa6[_0x5878('0x29')][_0x5878('0x33')]);_0x346f01['where']=qs[_0x5878('0x2a')](_[_0x5878('0x34')](_0x4afaa6[_0x5878('0x29')],_0x33a5af[_0x5878('0x2a')]),_0xd7b32b);if(_0x4afaa6[_0x5878('0x29')][_0x5878('0x35')]){_0x346f01[_0x5878('0x36')]=_[_0x5878('0x37')](_0x346f01[_0x5878('0x36')],{'$or':_['map'](_0xd7b32b,function(_0x3e6620){if(_0x3e6620['type']!==_0x5878('0x38')){var _0x53b0cf={};_0x53b0cf[_0x3e6620[_0x5878('0x20')]]={'$like':'%'+_0x4afaa6[_0x5878('0x29')][_0x5878('0x35')]+'%'};return _0x53b0cf;}})});}_0x346f01=_[_0x5878('0x37')]({},_0x346f01,_0x4afaa6[_0x5878('0x39')]);var _0x5d832a={'where':_0x346f01['where']};return db[_0x5878('0x23')][_0x5878('0x3a')](_0x5d832a)[_0x5878('0x1d')](function(_0x3ef53a){_0x179fc8[_0x5878('0x3a')]=_0x3ef53a;if(_0x4afaa6[_0x5878('0x29')]['includeAll']){_0x346f01[_0x5878('0x3b')]=[{'all':!![]}];}return db[_0x5878('0x23')][_0x5878('0x3c')](_0x346f01);})[_0x5878('0x1d')](function(_0xd5c546){_0x179fc8['rows']=_0xd5c546;return _0x179fc8;})['then'](respondWithFilteredResult(_0x1dd60d,_0x346f01))[_0x5878('0x3d')](handleError(_0x1dd60d,null));};exports[_0x5878('0x3e')]=function(_0x42db54,_0x103599){var _0x52516={'raw':!![],'where':{'id':_0x42db54[_0x5878('0x3f')]['id']}},_0x29fe7d={};_0x29fe7d['model']=_[_0x5878('0x28')](db[_0x5878('0x23')][_0x5878('0x24')]);_0x29fe7d[_0x5878('0x29')]=_[_0x5878('0x28')](_0x42db54[_0x5878('0x29')]);_0x29fe7d[_0x5878('0x2a')]=_['intersection'](_0x29fe7d['model'],_0x29fe7d[_0x5878('0x29')]);_0x52516[_0x5878('0x2c')]=_['intersection'](_0x29fe7d[_0x5878('0x27')],qs[_0x5878('0x2d')](_0x42db54['query'][_0x5878('0x2d')]));_0x52516[_0x5878('0x2c')]=_0x52516[_0x5878('0x2c')]['length']?_0x52516[_0x5878('0x2c')]:_0x29fe7d[_0x5878('0x27')];if(_0x42db54[_0x5878('0x29')][_0x5878('0x40')]){_0x52516[_0x5878('0x3b')]=[{'all':!![]}];}_0x52516=_[_0x5878('0x37')]({},_0x52516,_0x42db54['options']);return db[_0x5878('0x23')]['find'](_0x52516)[_0x5878('0x1d')](handleEntityNotFound(_0x103599,null))[_0x5878('0x1d')](respondWithResult(_0x103599,null))['catch'](handleError(_0x103599,null));};exports[_0x5878('0x41')]=function(_0x50fab0,_0x83b3c2){return db[_0x5878('0x23')]['create'](_0x50fab0[_0x5878('0x42')],{})['then'](respondWithResult(_0x83b3c2,0xc9))['catch'](handleError(_0x83b3c2,null));};exports[_0x5878('0x1c')]=function(_0x489dd0,_0x5105e5){if(_0x489dd0['body']['id']){delete _0x489dd0['body']['id'];}return db[_0x5878('0x23')][_0x5878('0x43')]({'where':{'id':_0x489dd0[_0x5878('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5105e5,null))[_0x5878('0x1d')](saveUpdates(_0x489dd0['body'],null))[_0x5878('0x1d')](respondWithResult(_0x5105e5,null))[_0x5878('0x3d')](handleError(_0x5105e5,null));};exports[_0x5878('0x44')]=function(_0xf05746,_0x58df3e){return db['ChatTransferReport'][_0x5878('0x43')]({'where':{'id':_0xf05746[_0x5878('0x3f')]['id']}})['then'](handleEntityNotFound(_0x58df3e,null))[_0x5878('0x1d')](removeEntity(_0x58df3e,null))[_0x5878('0x3d')](handleError(_0x58df3e,null));};exports[_0x5878('0x45')]=function(_0x29803e,_0x29d118){return db[_0x5878('0x23')][_0x5878('0x45')]()['then'](respondWithResult(_0x29d118,null))[_0x5878('0x3d')](handleError(_0x29d118,null));}; \ No newline at end of file +var _0xc294=['sox','to-csv','ejs','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','map','ChatTransferReport','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','fields','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util'];(function(_0xe1b5f6,_0x210c09){var _0x44636e=function(_0x3a3212){while(--_0x3a3212){_0xe1b5f6['push'](_0xe1b5f6['shift']());}};_0x44636e(++_0x210c09);}(_0xc294,0x8a));var _0x4c29=function(_0x54e631,_0x3b8396){_0x54e631=_0x54e631-0x0;var _0x3c6b6a=_0xc294[_0x54e631];return _0x3c6b6a;};'use strict';var pdf=require(_0x4c29('0x0'));var emlformat=require(_0x4c29('0x1'));var rimraf=require(_0x4c29('0x2'));var zipdir=require(_0x4c29('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4c29('0x4'));var BPromise=require(_0x4c29('0x5'));var Mustache=require(_0x4c29('0x6'));var util=require(_0x4c29('0x7'));var path=require('path');var sox=require(_0x4c29('0x8'));var csv=require(_0x4c29('0x9'));var ejs=require(_0x4c29('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4c29('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4c29('0xc'));var Papa=require(_0x4c29('0xd'));var Redis=require(_0x4c29('0xe'));var authService=require(_0x4c29('0xf'));var qs=require(_0x4c29('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4c29('0x11'));var logger=require(_0x4c29('0x12'))(_0x4c29('0x13'));var utils=require(_0x4c29('0x14'));var config=require(_0x4c29('0x15'));var licenseUtil=require(_0x4c29('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f04e1,_0x293df1){_0x293df1=_0x293df1||0xcc;return function(_0x1d2dc5){if(_0x1d2dc5){return _0x5f04e1[_0x4c29('0x17')](_0x293df1);}return _0x5f04e1['status'](_0x293df1)[_0x4c29('0x18')]();};}function respondWithResult(_0xc82d6b,_0x50da5e){_0x50da5e=_0x50da5e||0xc8;return function(_0x21234f){if(_0x21234f){return _0xc82d6b[_0x4c29('0x19')](_0x50da5e)[_0x4c29('0x1a')](_0x21234f);}};}function respondWithFilteredResult(_0x48e65c,_0x4f3325){return function(_0x10cd68){if(_0x10cd68){var _0x3f9eb5=_0x10cd68['count'],_0xde1d2a=_0x4f3325[_0x4c29('0x1b')],_0x57e4f6=_0x4f3325[_0x4c29('0x1b')]+_0x4f3325[_0x4c29('0x1c')],_0x4aaf1e;if(_0x57e4f6>=_0x3f9eb5){_0x57e4f6=_0x3f9eb5;_0x4aaf1e=0xc8;}else{_0x4aaf1e=0xce;}_0x48e65c[_0x4c29('0x19')](_0x4aaf1e);return _0x48e65c[_0x4c29('0x1d')](_0x4c29('0x1e'),_0xde1d2a+'-'+_0x57e4f6+'/'+_0x3f9eb5)[_0x4c29('0x1a')](_0x10cd68);}return null;};}function patchUpdates(_0x2e351d){return function(_0x49b9c9){try{jsonpatch[_0x4c29('0x1f')](_0x49b9c9,_0x2e351d,!![]);}catch(_0x43f76b){return BPromise[_0x4c29('0x20')](_0x43f76b);}return _0x49b9c9[_0x4c29('0x21')]();};}function saveUpdates(_0x187f7b,_0x168281){return function(_0x4494c5){if(_0x4494c5){return _0x4494c5[_0x4c29('0x22')](_0x187f7b)[_0x4c29('0x23')](function(_0x473a90){return _0x473a90;});}return null;};}function removeEntity(_0x12518e,_0x3a9b0a){return function(_0x415f85){if(_0x415f85){return _0x415f85[_0x4c29('0x24')]()[_0x4c29('0x23')](function(){_0x12518e[_0x4c29('0x19')](0xcc)[_0x4c29('0x18')]();});}};}function handleEntityNotFound(_0x8b17d6,_0xfbe61a){return function(_0x345357){if(!_0x345357){_0x8b17d6[_0x4c29('0x17')](0x194);}return _0x345357;};}function handleError(_0x5ec45b,_0xd03dbb){_0xd03dbb=_0xd03dbb||0x1f4;return function(_0x9777a){logger[_0x4c29('0x25')](_0x9777a[_0x4c29('0x26')]);if(_0x9777a['name']){delete _0x9777a['name'];}_0x5ec45b[_0x4c29('0x19')](_0xd03dbb)['send'](_0x9777a);};}exports['index']=function(_0x2c3967,_0x1aef09){var _0x3140c5={},_0x8503ab={},_0x1233d2={'count':0x0,'rows':[]};var _0x2e658a=_[_0x4c29('0x27')](db[_0x4c29('0x28')][_0x4c29('0x29')],function(_0x3db694){return{'name':_0x3db694[_0x4c29('0x2a')],'type':_0x3db694[_0x4c29('0x2b')]['key']};});_0x8503ab[_0x4c29('0x2c')]=_[_0x4c29('0x27')](_0x2e658a,_0x4c29('0x2d'));_0x8503ab['query']=_[_0x4c29('0x2e')](_0x2c3967[_0x4c29('0x2f')]);_0x8503ab[_0x4c29('0x30')]=_[_0x4c29('0x31')](_0x8503ab[_0x4c29('0x2c')],_0x8503ab[_0x4c29('0x2f')]);_0x3140c5[_0x4c29('0x32')]=_['intersection'](_0x8503ab[_0x4c29('0x2c')],qs['fields'](_0x2c3967[_0x4c29('0x2f')]['fields']));_0x3140c5[_0x4c29('0x32')]=_0x3140c5[_0x4c29('0x32')][_0x4c29('0x33')]?_0x3140c5['attributes']:_0x8503ab[_0x4c29('0x2c')];if(!_0x2c3967[_0x4c29('0x2f')][_0x4c29('0x34')](_0x4c29('0x35'))){_0x3140c5['limit']=qs[_0x4c29('0x1c')](_0x2c3967['query'][_0x4c29('0x1c')]);_0x3140c5[_0x4c29('0x1b')]=qs[_0x4c29('0x1b')](_0x2c3967[_0x4c29('0x2f')][_0x4c29('0x1b')]);}_0x3140c5[_0x4c29('0x36')]=qs[_0x4c29('0x37')](_0x2c3967[_0x4c29('0x2f')][_0x4c29('0x37')]);_0x3140c5['where']=qs['filters'](_[_0x4c29('0x38')](_0x2c3967[_0x4c29('0x2f')],_0x8503ab['filters']),_0x2e658a);if(_0x2c3967[_0x4c29('0x2f')]['filter']){_0x3140c5[_0x4c29('0x39')]=_[_0x4c29('0x3a')](_0x3140c5[_0x4c29('0x39')],{'$or':_[_0x4c29('0x27')](_0x2e658a,function(_0x24cd96){if(_0x24cd96[_0x4c29('0x2b')]!==_0x4c29('0x3b')){var _0x56b9a8={};_0x56b9a8[_0x24cd96[_0x4c29('0x2d')]]={'$like':'%'+_0x2c3967[_0x4c29('0x2f')]['filter']+'%'};return _0x56b9a8;}})});}_0x3140c5=_[_0x4c29('0x3a')]({},_0x3140c5,_0x2c3967[_0x4c29('0x3c')]);var _0x48e8c5={'where':_0x3140c5[_0x4c29('0x39')]};return db[_0x4c29('0x28')][_0x4c29('0x3d')](_0x48e8c5)[_0x4c29('0x23')](function(_0x408f7e){_0x1233d2[_0x4c29('0x3d')]=_0x408f7e;if(_0x2c3967[_0x4c29('0x2f')][_0x4c29('0x3e')]){_0x3140c5['include']=[{'all':!![]}];}return db[_0x4c29('0x28')][_0x4c29('0x3f')](_0x3140c5);})[_0x4c29('0x23')](function(_0x30b057){_0x1233d2[_0x4c29('0x40')]=_0x30b057;return _0x1233d2;})[_0x4c29('0x23')](respondWithFilteredResult(_0x1aef09,_0x3140c5))[_0x4c29('0x41')](handleError(_0x1aef09,null));};exports[_0x4c29('0x42')]=function(_0x98c67f,_0x505961){var _0x307f83={'raw':!![],'where':{'id':_0x98c67f[_0x4c29('0x43')]['id']}},_0x2903ed={};_0x2903ed[_0x4c29('0x2c')]=_['keys'](db[_0x4c29('0x28')][_0x4c29('0x29')]);_0x2903ed[_0x4c29('0x2f')]=_['keys'](_0x98c67f['query']);_0x2903ed['filters']=_[_0x4c29('0x31')](_0x2903ed['model'],_0x2903ed[_0x4c29('0x2f')]);_0x307f83[_0x4c29('0x32')]=_['intersection'](_0x2903ed[_0x4c29('0x2c')],qs[_0x4c29('0x44')](_0x98c67f[_0x4c29('0x2f')][_0x4c29('0x44')]));_0x307f83['attributes']=_0x307f83[_0x4c29('0x32')]['length']?_0x307f83[_0x4c29('0x32')]:_0x2903ed[_0x4c29('0x2c')];if(_0x98c67f[_0x4c29('0x2f')][_0x4c29('0x3e')]){_0x307f83['include']=[{'all':!![]}];}_0x307f83=_['merge']({},_0x307f83,_0x98c67f[_0x4c29('0x3c')]);return db[_0x4c29('0x28')][_0x4c29('0x45')](_0x307f83)[_0x4c29('0x23')](handleEntityNotFound(_0x505961,null))[_0x4c29('0x23')](respondWithResult(_0x505961,null))[_0x4c29('0x41')](handleError(_0x505961,null));};exports[_0x4c29('0x46')]=function(_0x61915b,_0x4ce219){return db[_0x4c29('0x28')][_0x4c29('0x46')](_0x61915b[_0x4c29('0x47')],{})[_0x4c29('0x23')](respondWithResult(_0x4ce219,0xc9))[_0x4c29('0x41')](handleError(_0x4ce219,null));};exports[_0x4c29('0x22')]=function(_0x144286,_0x57aedb){if(_0x144286[_0x4c29('0x47')]['id']){delete _0x144286[_0x4c29('0x47')]['id'];}return db[_0x4c29('0x28')][_0x4c29('0x45')]({'where':{'id':_0x144286[_0x4c29('0x43')]['id']}})['then'](handleEntityNotFound(_0x57aedb,null))[_0x4c29('0x23')](saveUpdates(_0x144286[_0x4c29('0x47')],null))[_0x4c29('0x23')](respondWithResult(_0x57aedb,null))[_0x4c29('0x41')](handleError(_0x57aedb,null));};exports[_0x4c29('0x24')]=function(_0x5d2b5d,_0x27684a){return db[_0x4c29('0x28')]['find']({'where':{'id':_0x5d2b5d[_0x4c29('0x43')]['id']}})['then'](handleEntityNotFound(_0x27684a,null))[_0x4c29('0x23')](removeEntity(_0x27684a,null))['catch'](handleError(_0x27684a,null));};exports[_0x4c29('0x48')]=function(_0x377c28,_0x449afc){return db['ChatTransferReport']['describe']()['then'](respondWithResult(_0x449afc,null))['catch'](handleError(_0x449afc,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 1cb8d90..6dbafe1 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 _0xfa1e=['../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','request-promise','rimraf'];(function(_0x5475f6,_0x386c9c){var _0x5b07b5=function(_0x37a293){while(--_0x37a293){_0x5475f6['push'](_0x5475f6['shift']());}};_0x5b07b5(++_0x386c9c);}(_0xfa1e,0x102));var _0xefa1=function(_0x737a1f,_0x235fef){_0x737a1f=_0x737a1f-0x0;var _0x16eba1=_0xfa1e[_0x737a1f];return _0x16eba1;};'use strict';var _=require(_0xefa1('0x0'));var util=require(_0xefa1('0x1'));var logger=require(_0xefa1('0x2'))(_0xefa1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xefa1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xefa1('0x5'));var config=require(_0xefa1('0x6'));var attributes=require(_0xefa1('0x7'));module[_0xefa1('0x8')]=function(_0x22315d,_0x599473){return _0x22315d['define'](_0xefa1('0x9'),attributes,{'tableName':_0xefa1('0xa'),'paranoid':![],'indexes':[{'name':_0xefa1('0xb'),'fields':[_0xefa1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x57b7=['moment','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x57b7,0x184));var _0x757b=function(_0x37c2e5,_0x22eed2){_0x37c2e5=_0x37c2e5-0x0;var _0x5a1564=_0x57b7[_0x37c2e5];return _0x5a1564;};'use strict';var _=require(_0x757b('0x0'));var util=require(_0x757b('0x1'));var logger=require(_0x757b('0x2'))(_0x757b('0x3'));var moment=require(_0x757b('0x4'));var BPromise=require('bluebird');var rp=require(_0x757b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x757b('0x6'));var config=require(_0x757b('0x7'));var attributes=require(_0x757b('0x8'));module[_0x757b('0x9')]=function(_0x40c404,_0x3bb6f6){return _0x40c404[_0x757b('0xa')](_0x757b('0xb'),attributes,{'tableName':_0x757b('0xc'),'paranoid':![],'indexes':[{'name':_0x757b('0xd'),'fields':[_0x757b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 434c592..a68bded 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 _0x470a=['request','then','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','http'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x470a,0x6b));var _0xa470=function(_0x5ad4b0,_0x71797b){_0x5ad4b0=_0x5ad4b0-0x0;var _0xaf210c=_0x470a[_0x5ad4b0];return _0xaf210c;};'use strict';var _=require(_0xa470('0x0'));var util=require(_0xa470('0x1'));var moment=require('moment');var BPromise=require(_0xa470('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa470('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa470('0x4'));var logger=require(_0xa470('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa470('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x119f28,_0x460071,_0x3f407a){return new BPromise(function(_0x4292aa,_0x311566){return client[_0xa470('0x7')](_0x119f28,_0x3f407a)[_0xa470('0x8')](function(_0x49c96a){logger['info'](_0xa470('0x9'),_0x460071,'request\x20sent');logger[_0xa470('0xa')](_0xa470('0xb'),_0x460071,_0xa470('0xc'),JSON[_0xa470('0xd')](_0x49c96a));if(_0x49c96a[_0xa470('0xe')]){if(_0x49c96a[_0xa470('0xe')]['code']===0x1f4){logger['error'](_0xa470('0x9'),_0x460071,_0x49c96a[_0xa470('0xe')]['message']);return _0x311566(_0x49c96a[_0xa470('0xe')][_0xa470('0xf')]);}logger[_0xa470('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x460071,_0x49c96a[_0xa470('0xe')]['message']);return _0x4292aa(_0x49c96a[_0xa470('0xe')][_0xa470('0xf')]);}else{logger[_0xa470('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x460071,'request\x20sent');_0x4292aa(_0x49c96a[_0xa470('0x11')][_0xa470('0xf')]);}})[_0xa470('0x12')](function(_0x315cb0){logger['error'](_0xa470('0x9'),_0x460071,_0x315cb0);_0x311566(_0x315cb0);});});} \ No newline at end of file +var _0x6804=['ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error'];(function(_0xe2c034,_0x59f144){var _0x425964=function(_0x52df93){while(--_0x52df93){_0xe2c034['push'](_0xe2c034['shift']());}};_0x425964(++_0x59f144);}(_0x6804,0x158));var _0x4680=function(_0xad4443,_0xb429dc){_0xad4443=_0xad4443-0x0;var _0x5ac221=_0x6804[_0xad4443];return _0x5ac221;};'use strict';var _=require(_0x4680('0x0'));var util=require(_0x4680('0x1'));var moment=require('moment');var BPromise=require(_0x4680('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4680('0x3'))['db'];var utils=require(_0x4680('0x4'));var logger=require('../../config/logger')(_0x4680('0x5'));var config=require(_0x4680('0x6'));var jayson=require(_0x4680('0x7'));var client=jayson[_0x4680('0x8')][_0x4680('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55b93d,_0xe204de,_0xd39227){return new BPromise(function(_0x1a6e76,_0x326092){return client[_0x4680('0xa')](_0x55b93d,_0xd39227)[_0x4680('0xb')](function(_0x3282b9){logger[_0x4680('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0xe204de,_0x4680('0xd'));logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0xe204de,'request\x20sent',JSON[_0x4680('0xe')](_0x3282b9));if(_0x3282b9[_0x4680('0xf')]){if(_0x3282b9[_0x4680('0xf')]['code']===0x1f4){logger[_0x4680('0xf')](_0x4680('0x10'),_0xe204de,_0x3282b9[_0x4680('0xf')][_0x4680('0x11')]);return _0x326092(_0x3282b9[_0x4680('0xf')][_0x4680('0x11')]);}logger[_0x4680('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0xe204de,_0x3282b9['error'][_0x4680('0x11')]);return _0x1a6e76(_0x3282b9[_0x4680('0xf')][_0x4680('0x11')]);}else{logger[_0x4680('0xc')](_0x4680('0x10'),_0xe204de,_0x4680('0xd'));_0x1a6e76(_0x3282b9[_0x4680('0x12')]['message']);}})[_0x4680('0x13')](function(_0x3d8eab){logger['error'](_0x4680('0x10'),_0xe204de,_0x3d8eab);_0x326092(_0x3d8eab);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 5b2933d..0135b62 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 _0x5f66=['describe','get','/:id','show','create','put','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated','index'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var auth=require(_0x65f6('0x4'));var interaction=require(_0x65f6('0x5'));var config=require('../../config/environment');var controller=require(_0x65f6('0x6'));router['get']('/',auth[_0x65f6('0x7')](),controller[_0x65f6('0x8')]);router['get']('/describe',auth[_0x65f6('0x7')](),controller[_0x65f6('0x9')]);router[_0x65f6('0xa')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller[_0x65f6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller['update']);router[_0x65f6('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x65f6('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb7e7=['multer','path','express','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x4da992,_0xed3a63){var _0x4a9456=function(_0x404768){while(--_0x404768){_0x4da992['push'](_0x4da992['shift']());}};_0x4a9456(++_0xed3a63);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0xb7e7[_0x1b7368];return _0x25d54c;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['put'](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);module[_0x7b7e('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index c1afb67..a3b99a1 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 _0xe6c5=['#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','stringify','input','getDataValue','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate'];(function(_0x4199d7,_0x40b622){var _0xe4fb49=function(_0x39affa){while(--_0x39affa){_0x4199d7['push'](_0x4199d7['shift']());}};_0xe4fb49(++_0x40b622);}(_0xe6c5,0x67));var _0x5e6c=function(_0x49bab0,_0x46fba6){_0x49bab0=_0x49bab0-0x0;var _0x55a024=_0xe6c5[_0x49bab0];return _0x55a024;};'use strict';var Sequelize=require(_0x5e6c('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x5e6c('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x5e6c('0x1')],'allowNull':![],'unique':_0x5e6c('0x2')},'description':{'type':Sequelize[_0x5e6c('0x1')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x5e6c('0x3')},'mapKeyOffline':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':_0x5e6c('0x3')},'key':{'type':Sequelize[_0x5e6c('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x5e6c('0x4')},'customerAlias':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x5e6c('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x5e6c('0x1')],'allowNull':![],'defaultValue':_0x5e6c('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x5e6c('0x1')],'allowNull':![],'defaultValue':_0x5e6c('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x5e6c('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x5e6c('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x5e6c('0x9')](_0x5e6c('0xa'),_0x5e6c('0xb')),'defaultValue':_0x5e6c('0xa')},'header_online':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':_0x5e6c('0xc')},'start_chat_button':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':_0x5e6c('0xd')},'header_offline':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':_0x5e6c('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x5e6c('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x5e6c('0xf')]},'closingQuestion':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':_0x5e6c('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':_0x5e6c('0x11')},'noteTitle':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':_0x5e6c('0x12')},'placeholderMessage':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':_0x5e6c('0x13')},'closingMessage':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':_0x5e6c('0x14')},'closingMessageButton':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x5e6c('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x5e6c('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':_0x5e6c('0x15')},'ratingType':{'type':Sequelize[_0x5e6c('0x9')](_0x5e6c('0x16'),_0x5e6c('0x17')),'defaultValue':_0x5e6c('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x5e6c('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x5e6c('0x18')]({'items':[{'type':_0x5e6c('0x19'),'variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x5e6c('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x5e6c('0x3'),'type':_0x5e6c('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x5e6c('0x1a')](_0x5e6c('0x1b'))?JSON['parse'](this[_0x5e6c('0x1a')]('onlineForm')):{};},'set':function(_0xb0b9a2){return this[_0x5e6c('0x1c')](_0x5e6c('0x1b'),JSON[_0x5e6c('0x18')](_0xb0b9a2));}},'offlineForm':{'type':Sequelize[_0x5e6c('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x5e6c('0x19'),'props':{'title':_0x5e6c('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x5e6c('0x3'),'type':_0x5e6c('0x3')},'variable':null},{'type':_0x5e6c('0x1d'),'config':{'placeholder':_0x5e6c('0x1e')},'props':{'title':_0x5e6c('0x1e'),'helpText':_0x5e6c('0x1f')}}],'fromKey':0x0});},'get':function(){return this[_0x5e6c('0x1a')](_0x5e6c('0x20'))?JSON[_0x5e6c('0x21')](this['getDataValue']('offlineForm')):{};},'set':function(_0x4b9b70){return this[_0x5e6c('0x1c')]('offlineForm',JSON[_0x5e6c('0x18')](_0x4b9b70));}},'token':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':function(){return rs[_0x5e6c('0x22')]();}},'autoclose':{'type':Sequelize[_0x5e6c('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x5e6c('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x5e6c('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x5e6c('0x1')]},'waitingTitle':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':_0x5e6c('0x23')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5e6c('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':_0x5e6c('0x25')},'offlineMessageBody':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':_0x5e6c('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x5e6c('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x5e6c('0x27')},'sendUnmanaged':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':_0x5e6c('0xd')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x5e6c('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x5e6c('0x1')]},'notificationTemplate':{'type':Sequelize[_0x5e6c('0xf')],'defaultValue':function(){return _0x5e6c('0x28');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x5e6c('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x5e6c('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x5e6c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':_0x5e6c('0x2a')},'verticalAlignment':{'type':Sequelize[_0x5e6c('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':_0x5e6c('0x2b')},'defaultTitle':{'type':Sequelize[_0x5e6c('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x5e6c('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5e6c('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x5e6c('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5e6c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':_0x5e6c('0x2d')},'systemAvatar':{'type':Sequelize[_0x5e6c('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5e6c('0x7')],'comment':_0x5e6c('0x2e')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x21dd02){if(!_0x21dd02)this['setDataValue'](_0x5e6c('0x2f'),null);this['setDataValue'](_0x5e6c('0x30'),_0x21dd02);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x5e6c('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xe314=['name','text','getDataValue','parse','onlineForm','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','star','thumb','input'];(function(_0x5199af,_0x1eb67c){var _0x381974=function(_0x456a88){while(--_0x456a88){_0x5199af['push'](_0x5199af['shift']());}};_0x381974(++_0x1eb67c);}(_0xe314,0x7c));var _0x4e31=function(_0x5a05b8,_0x290752){_0x5a05b8=_0x5a05b8-0x0;var _0x2a0914=_0xe314[_0x5a05b8];return _0x2a0914;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x4e31('0x0'));module[_0x4e31('0x1')]={'name':{'type':Sequelize[_0x4e31('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x4e31('0x2')],'allowNull':![],'unique':_0x4e31('0x3')},'description':{'type':Sequelize[_0x4e31('0x2')]},'mapKey':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':_0x4e31('0x4')},'mapKeyOffline':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':_0x4e31('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x4e31('0x5')},'customerAlias':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x4e31('0x2')],'allowNull':![],'defaultValue':_0x4e31('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x4e31('0x2')],'allowNull':![],'defaultValue':_0x4e31('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4e31('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x4e31('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x4e31('0x2')]},'animation':{'type':Sequelize[_0x4e31('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x4e31('0xa'),_0x4e31('0xb')),'defaultValue':_0x4e31('0xa')},'header_online':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':_0x4e31('0xc')},'start_chat_button':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':_0x4e31('0xd')},'offline_chat_button':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':_0x4e31('0xe')},'header_offline':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':_0x4e31('0xf')},'download_transcript':{'type':Sequelize[_0x4e31('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x4e31('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':_0x4e31('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x4e31('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x4e31('0x11')]},'closingQuestion':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':_0x4e31('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4e31('0x13')},'noteTitle':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':_0x4e31('0x14')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4e31('0x15')},'closingMessage':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':_0x4e31('0x16')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x4e31('0xe')},'skipMessageButton':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':_0x4e31('0x17')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x4e31('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x4e31('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x4e31('0x18')},'ratingType':{'type':Sequelize[_0x4e31('0x19')](_0x4e31('0x1a'),_0x4e31('0x1b')),'defaultValue':_0x4e31('0x1a')},'ratingStarsNumber':{'type':Sequelize[_0x4e31('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x4e31('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x4e31('0x1c'),'variable':null,'config':{'placeholder':_0x4e31('0x1d'),'type':_0x4e31('0x1e'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x4e31('0x1c'),'props':{'title':_0x4e31('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x4e31('0x4'),'type':_0x4e31('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x4e31('0x1f')]('onlineForm')?JSON[_0x4e31('0x20')](this[_0x4e31('0x1f')](_0x4e31('0x21'))):{};},'set':function(_0x53c3e0){return this[_0x4e31('0x22')](_0x4e31('0x21'),JSON[_0x4e31('0x23')](_0x53c3e0));}},'offlineForm':{'type':Sequelize[_0x4e31('0x11')],'defaultValue':function(){return JSON[_0x4e31('0x23')]({'items':[{'type':_0x4e31('0x1c'),'props':{'title':_0x4e31('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x4e31('0x4'),'type':_0x4e31('0x4')},'variable':null},{'type':_0x4e31('0x24'),'config':{'placeholder':_0x4e31('0x25')},'props':{'title':'Comments','helpText':_0x4e31('0x26')}}],'fromKey':0x0});},'get':function(){return this[_0x4e31('0x1f')]('offlineForm')?JSON[_0x4e31('0x20')](this[_0x4e31('0x1f')]('offlineForm')):{};},'set':function(_0x2fb71b){return this['setDataValue'](_0x4e31('0x27'),JSON[_0x4e31('0x23')](_0x2fb71b));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x4e31('0x28')]();}},'autoclose':{'type':Sequelize[_0x4e31('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x4e31('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x4e31('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x4e31('0x2')]},'forwardOffline':{'type':Sequelize[_0x4e31('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x4e31('0x2')]},'waitingTitle':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':_0x4e31('0x29')},'waitingMessage':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':_0x4e31('0x2a')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x4e31('0x2b')},'enableUnmanagedNote':{'type':Sequelize[_0x4e31('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':_0x4e31('0x17')},'sendUnmanaged':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':_0x4e31('0xe')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x4e31('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x4e31('0x2')]},'notificationTemplate':{'type':Sequelize[_0x4e31('0x11')],'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[_0x4e31('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x4e31('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x4e31('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':_0x4e31('0x2c')},'verticalAlignment':{'type':Sequelize[_0x4e31('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x4e31('0x2d')},'defaultTitle':{'type':Sequelize[_0x4e31('0x2')]},'customerAvatar':{'type':Sequelize[_0x4e31('0x11')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x4e31('0x2')],'allowNull':![],'defaultValue':_0x4e31('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x4e31('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4e31('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4e31('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4e31('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':_0x4e31('0x2f')},'systemAvatar':{'type':Sequelize[_0x4e31('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4e31('0x8')],'comment':_0x4e31('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x4e31('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x33839e){if(!_0x33839e)this['setDataValue'](_0x4e31('0x31'),null);this[_0x4e31('0x22')](_0x4e31('0x32'),_0x33839e);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 410cf81..1130587 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 _0x9376=['where','pick','filter','merge','includeAll','findAll','rows','show','params','options','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','ChatWebsiteId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','include','removeAnswers','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','root','server/files/images/logos/default_logo.svg','sitepic','getLicense','custom','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','isNil','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','setUA','user-agent','getResult','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','account','applications','list','orderBy','priority','Applications','ListId','contact','headers','cf-connecting-ip','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','format','%s\x20%s','version','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','update','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','EventManager','offline','CompanyId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','ChatOfflineMessage','MailAccount','findOne','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','timezone','interval','iftime\x20%s','true','ONLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','getSnippet','Interval','Intervals','../../config/license/util','License','server/files/chat/iframe.js','remote','x-real-ip','connection','remoteAddress','virtual','verticalAlignment','textColor','addApplications','sequelize','ChatApplication','bulkCreate','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','false','items','fromKey','getOfflineMessages','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','jayson/promise','client','http','request','info','request\x20sent','debug','error','code','message','ChatWebsite,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x59158c,_0x13be62){var _0xc0283f=function(_0x155e09){while(--_0x155e09){_0x59158c['push'](_0x59158c['shift']());}};_0xc0283f(++_0x13be62);}(_0x9376,0x1e9));var _0x6937=function(_0x124c6a,_0x57b9e4){_0x124c6a=_0x124c6a-0x0;var _0x2d1e86=_0x9376[_0x124c6a];return _0x2d1e86;};'use strict';var pdf=require(_0x6937('0x0'));var emlformat=require(_0x6937('0x1'));var rimraf=require(_0x6937('0x2'));var zipdir=require(_0x6937('0x3'));var jsonpatch=require(_0x6937('0x4'));var rp=require(_0x6937('0x5'));var moment=require(_0x6937('0x6'));var BPromise=require(_0x6937('0x7'));var Mustache=require('mustache');var util=require(_0x6937('0x8'));var path=require(_0x6937('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6937('0xa'));var fs=require('fs');var _=require(_0x6937('0xb'));var squel=require(_0x6937('0xc'));var crypto=require('crypto');var jsforce=require(_0x6937('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6937('0xe'));var Papa=require(_0x6937('0xf'));var Redis=require(_0x6937('0x10'));var authService=require(_0x6937('0x11'));var qs=require(_0x6937('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6937('0x13'));var logger=require(_0x6937('0x14'))('api');var utils=require(_0x6937('0x15'));var config=require(_0x6937('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6937('0x17'))['db'];config['redis']=_[_0x6937('0x18')](config[_0x6937('0x19')],{'host':_0x6937('0x1a'),'port':0x18eb});var socket=require(_0x6937('0x1b'))(new Redis(config[_0x6937('0x19')]));require('./chatWebsite.socket')['register'](socket);var jayson=require(_0x6937('0x1c'));var client=jayson[_0x6937('0x1d')][_0x6937('0x1e')]({'port':0x232c});var client9002=jayson[_0x6937('0x1d')]['http']({'port':0x232a});var client9003=jayson[_0x6937('0x1d')][_0x6937('0x1e')]({'port':0x232b});function respondWithRpcPromise(_0x2fe21f,_0x3dd5bc,_0x40ea84,_0xb26b5e){return new BPromise(function(_0x48a8aa,_0x526b3c){var _0x36a522=_0xb26b5e||client;return _0x36a522[_0x6937('0x1f')](_0x2fe21f,_0x40ea84)['then'](function(_0x147223){logger[_0x6937('0x20')]('ChatWebsite,\x20%s,\x20%s',_0x3dd5bc,_0x6937('0x21'));logger[_0x6937('0x22')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x3dd5bc,'request\x20sent',JSON['stringify'](_0x147223));if(_0x147223[_0x6937('0x23')]){if(_0x147223[_0x6937('0x23')][_0x6937('0x24')]===0x1f4){logger[_0x6937('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x3dd5bc,_0x147223[_0x6937('0x23')][_0x6937('0x25')]);return _0x526b3c(_0x147223[_0x6937('0x23')]['message']);}logger[_0x6937('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x3dd5bc,_0x147223[_0x6937('0x23')][_0x6937('0x25')]);return _0x48a8aa(_0x147223['error'][_0x6937('0x25')]);}else{logger[_0x6937('0x20')](_0x6937('0x26'),_0x3dd5bc,_0x6937('0x21'));_0x48a8aa(_0x147223[_0x6937('0x27')][_0x6937('0x25')]);}})[_0x6937('0x28')](function(_0x17cba1){logger[_0x6937('0x23')](_0x6937('0x26'),_0x3dd5bc,_0x17cba1);_0x526b3c(_0x17cba1);});});}function respondWithStatusCode(_0x23895d,_0x4a84ae){_0x4a84ae=_0x4a84ae||0xcc;return function(_0x5a82ef){if(_0x5a82ef){return _0x23895d[_0x6937('0x29')](_0x4a84ae);}return _0x23895d[_0x6937('0x2a')](_0x4a84ae)[_0x6937('0x2b')]();};}function respondWithResult(_0x39e09d,_0x30f369){_0x30f369=_0x30f369||0xc8;return function(_0x48d4f2){if(_0x48d4f2){return _0x39e09d[_0x6937('0x2a')](_0x30f369)[_0x6937('0x2c')](_0x48d4f2);}};}function respondWithFilteredResult(_0xb37650,_0x301f21){return function(_0x3f836){if(_0x3f836){var _0x4a2290=_0x3f836[_0x6937('0x2d')],_0x33b077=_0x301f21[_0x6937('0x2e')],_0x465a2a=_0x301f21['offset']+_0x301f21[_0x6937('0x2f')],_0x5c2d82;if(_0x465a2a>=_0x4a2290){_0x465a2a=_0x4a2290;_0x5c2d82=0xc8;}else{_0x5c2d82=0xce;}_0xb37650[_0x6937('0x2a')](_0x5c2d82);return _0xb37650[_0x6937('0x30')](_0x6937('0x31'),_0x33b077+'-'+_0x465a2a+'/'+_0x4a2290)[_0x6937('0x2c')](_0x3f836);}return null;};}function patchUpdates(_0x4b1652){return function(_0x55cc53){try{jsonpatch['apply'](_0x55cc53,_0x4b1652,!![]);}catch(_0x11b14a){return BPromise[_0x6937('0x32')](_0x11b14a);}return _0x55cc53[_0x6937('0x33')]();};}function saveUpdates(_0x21a3b6,_0x4a4b53){return function(_0x54b42b){if(_0x54b42b){return _0x54b42b['update'](_0x21a3b6)[_0x6937('0x34')](function(_0x5b99a8){return _0x5b99a8;});}return null;};}function removeEntity(_0x4f0bdf,_0x54fd2e){return function(_0x3133c0){if(_0x3133c0){return _0x3133c0[_0x6937('0x35')]()[_0x6937('0x34')](function(){var _0x518b52=_0x3133c0['get']({'plain':!![]});var _0x351676='ChatWebsites';return db[_0x6937('0x36')][_0x6937('0x35')]({'where':{'type':_0x351676,'resourceId':_0x518b52['id']}})['then'](function(){return _0x3133c0;});})[_0x6937('0x34')](function(){_0x4f0bdf[_0x6937('0x2a')](0xcc)[_0x6937('0x2b')]();});}};}function handleEntityNotFound(_0xb479e9,_0x331886){return function(_0xbdf042){if(!_0xbdf042){_0xb479e9[_0x6937('0x29')](0x194);}return _0xbdf042;};}function handleError(_0x53f5b2,_0x4e13a1){_0x4e13a1=_0x4e13a1||0x1f4;return function(_0x3b8d5e){logger[_0x6937('0x23')](_0x3b8d5e[_0x6937('0x37')]);if(_0x3b8d5e[_0x6937('0x38')]){delete _0x3b8d5e[_0x6937('0x38')];}_0x53f5b2['status'](_0x4e13a1)[_0x6937('0x39')](_0x3b8d5e);};}exports[_0x6937('0x3a')]=function(_0x55f426,_0xccd89c){var _0x1747e4={'include':[{'model':db[_0x6937('0x3b')],'as':_0x6937('0x3c')}]},_0x139278={},_0x26b501={'count':0x0,'rows':[]};var _0x2394a8=_[_0x6937('0x3d')](db[_0x6937('0x3e')][_0x6937('0x3f')],function(_0x2b27c7){return{'name':_0x2b27c7['fieldName'],'type':_0x2b27c7[_0x6937('0x40')]['key']};});_0x139278[_0x6937('0x41')]=_[_0x6937('0x3d')](_0x2394a8,'name');_0x139278[_0x6937('0x42')]=_[_0x6937('0x43')](_0x55f426['query']);_0x139278[_0x6937('0x44')]=_['intersection'](_0x139278[_0x6937('0x41')],_0x139278[_0x6937('0x42')]);_0x1747e4[_0x6937('0x45')]=_[_0x6937('0x46')](_0x139278[_0x6937('0x41')],qs[_0x6937('0x47')](_0x55f426[_0x6937('0x42')][_0x6937('0x47')]));_0x1747e4[_0x6937('0x45')]=_0x1747e4[_0x6937('0x45')][_0x6937('0x48')]?_0x1747e4[_0x6937('0x45')]:_0x139278[_0x6937('0x41')];if(!_0x55f426[_0x6937('0x42')][_0x6937('0x49')](_0x6937('0x4a'))){_0x1747e4[_0x6937('0x2f')]=qs[_0x6937('0x2f')](_0x55f426[_0x6937('0x42')][_0x6937('0x2f')]);_0x1747e4['offset']=qs[_0x6937('0x2e')](_0x55f426[_0x6937('0x42')]['offset']);}_0x1747e4[_0x6937('0x4b')]=qs[_0x6937('0x4c')](_0x55f426[_0x6937('0x42')]['sort']);_0x1747e4[_0x6937('0x4d')]=qs['filters'](_[_0x6937('0x4e')](_0x55f426[_0x6937('0x42')],_0x139278['filters']),_0x2394a8);if(_0x55f426[_0x6937('0x42')][_0x6937('0x4f')]){_0x1747e4[_0x6937('0x4d')]=_[_0x6937('0x50')](_0x1747e4[_0x6937('0x4d')],{'$or':_['map'](_0x2394a8,function(_0x23e9b3){if(_0x23e9b3[_0x6937('0x40')]!=='VIRTUAL'){var _0x5ae104={};_0x5ae104[_0x23e9b3[_0x6937('0x38')]]={'$like':'%'+_0x55f426[_0x6937('0x42')]['filter']+'%'};return _0x5ae104;}})});}_0x1747e4=_[_0x6937('0x50')]({},_0x1747e4,_0x55f426['options']);var _0x39ec51={'where':_0x1747e4[_0x6937('0x4d')]};return db['ChatWebsite'][_0x6937('0x2d')](_0x39ec51)[_0x6937('0x34')](function(_0x11cad5){_0x26b501[_0x6937('0x2d')]=_0x11cad5;if(_0x55f426[_0x6937('0x42')][_0x6937('0x51')]){_0x1747e4['include']=[{'all':!![]}];}return db['ChatWebsite'][_0x6937('0x52')](_0x1747e4);})['then'](function(_0x21f5bb){_0x26b501[_0x6937('0x53')]=_0x21f5bb;return _0x26b501;})[_0x6937('0x34')](respondWithFilteredResult(_0xccd89c,_0x1747e4))[_0x6937('0x28')](handleError(_0xccd89c,null));};exports[_0x6937('0x54')]=function(_0x492596,_0x423531){var _0x1464e3={'raw':![],'where':{'id':_0x492596[_0x6937('0x55')]['id']},'include':[{'model':db[_0x6937('0x3b')],'as':_0x6937('0x3c')}]},_0x32ddf2={};_0x32ddf2['model']=_[_0x6937('0x43')](db[_0x6937('0x3e')][_0x6937('0x3f')]);_0x32ddf2[_0x6937('0x42')]=_['keys'](_0x492596['query']);_0x32ddf2[_0x6937('0x44')]=_['intersection'](_0x32ddf2[_0x6937('0x41')],_0x32ddf2[_0x6937('0x42')]);_0x1464e3[_0x6937('0x45')]=_[_0x6937('0x46')](_0x32ddf2[_0x6937('0x41')],qs[_0x6937('0x47')](_0x492596[_0x6937('0x42')][_0x6937('0x47')]));_0x1464e3[_0x6937('0x45')]=_0x1464e3[_0x6937('0x45')][_0x6937('0x48')]?_0x1464e3['attributes']:_0x32ddf2[_0x6937('0x41')];if(_0x492596['query'][_0x6937('0x51')]){_0x1464e3['include']=[{'all':!![]}];}_0x1464e3=_['merge']({},_0x1464e3,_0x492596[_0x6937('0x56')]);return db[_0x6937('0x3e')]['find'](_0x1464e3)[_0x6937('0x34')](handleEntityNotFound(_0x423531,null))[_0x6937('0x34')](respondWithResult(_0x423531,null))[_0x6937('0x28')](handleError(_0x423531,null));};exports[_0x6937('0x57')]=function(_0x269db7,_0x57d768){return db[_0x6937('0x3e')][_0x6937('0x57')](_0x269db7['body'],{})[_0x6937('0x34')](function(_0x3d2e77){var _0x51cac1=_0x269db7['user'][_0x6937('0x58')]({'plain':!![]});if(!_0x51cac1)throw new Error(_0x6937('0x59'));if(_0x51cac1[_0x6937('0x5a')]===_0x6937('0x5b')){var _0x180a98=_0x3d2e77['get']({'plain':!![]});var _0x59caae='ChatWebsites';return db[_0x6937('0x5c')][_0x6937('0x5d')]({'where':{'name':_0x59caae,'userProfileId':_0x51cac1[_0x6937('0x5e')]},'raw':!![]})['then'](function(_0x41f1e8){if(_0x41f1e8&&_0x41f1e8[_0x6937('0x5f')]===0x0){return db[_0x6937('0x36')][_0x6937('0x57')]({'name':_0x180a98[_0x6937('0x38')],'resourceId':_0x180a98['id'],'type':_0x41f1e8['name'],'sectionId':_0x41f1e8['id']},{})[_0x6937('0x34')](function(){return _0x3d2e77;});}else{return _0x3d2e77;}})[_0x6937('0x28')](function(_0x197cd0){logger[_0x6937('0x23')](_0x6937('0x60'),_0x197cd0);throw _0x197cd0;});}return _0x3d2e77;})[_0x6937('0x34')](respondWithResult(_0x57d768,0xc9))[_0x6937('0x28')](handleError(_0x57d768,null));};exports['update']=function(_0x1b5e36,_0x4c012c){if(_0x1b5e36[_0x6937('0x61')]['id']){delete _0x1b5e36[_0x6937('0x61')]['id'];}return db[_0x6937('0x3e')][_0x6937('0x5d')]({'where':{'id':_0x1b5e36[_0x6937('0x55')]['id']},'include':[{'model':db[_0x6937('0x3b')],'as':_0x6937('0x3c')}]})[_0x6937('0x34')](handleEntityNotFound(_0x4c012c,null))[_0x6937('0x34')](saveUpdates(_0x1b5e36[_0x6937('0x61')],null))[_0x6937('0x34')](respondWithResult(_0x4c012c,null))[_0x6937('0x28')](handleError(_0x4c012c,null));};exports[_0x6937('0x35')]=function(_0x3a2f52,_0x26a7a3){return db[_0x6937('0x3e')][_0x6937('0x5d')]({'where':{'id':_0x3a2f52[_0x6937('0x55')]['id']}})[_0x6937('0x34')](handleEntityNotFound(_0x26a7a3,null))[_0x6937('0x34')](removeEntity(_0x26a7a3,null))[_0x6937('0x28')](handleError(_0x26a7a3,null));};exports[_0x6937('0x62')]=function(_0x307c5d,_0x3f9835){return db[_0x6937('0x3e')]['describe']()[_0x6937('0x34')](respondWithResult(_0x3f9835,null))['catch'](handleError(_0x3f9835,null));};exports[_0x6937('0x63')]=function(_0x2fa9f9,_0x54ca35,_0x1b709a){if(_0x2fa9f9[_0x6937('0x61')]['id']){delete _0x2fa9f9['body']['id'];}return db[_0x6937('0x3e')][_0x6937('0x5d')]({'where':{'id':_0x2fa9f9[_0x6937('0x55')]['id']}})[_0x6937('0x34')](handleEntityNotFound(_0x54ca35,null))[_0x6937('0x34')](function(_0x516e9c){if(_0x516e9c){_0x2fa9f9[_0x6937('0x61')]['ChatWebsiteId']=_0x516e9c['id'];return db[_0x6937('0x64')]['create'](_0x2fa9f9[_0x6937('0x61')]);}})[_0x6937('0x34')](respondWithResult(_0x54ca35,null))['catch'](handleError(_0x54ca35,null));};exports[_0x6937('0x65')]=function(_0x10ffa5,_0x39c796,_0x544402){var _0xfbb69f={'raw':![],'where':{}};var _0x1a7f15={};var _0x4d9d8f={'count':0x0,'rows':[]};return db[_0x6937('0x3e')]['findOne']({'where':{'id':_0x10ffa5[_0x6937('0x55')]['id']}})[_0x6937('0x34')](handleEntityNotFound(_0x39c796,null))['then'](function(_0x28e7a5){if(_0x28e7a5){_0x1a7f15[_0x6937('0x41')]=_[_0x6937('0x43')](db[_0x6937('0x64')]['rawAttributes']);_0x1a7f15[_0x6937('0x42')]=_[_0x6937('0x43')](_0x10ffa5[_0x6937('0x42')]);_0x1a7f15[_0x6937('0x44')]=_[_0x6937('0x46')](_0x1a7f15[_0x6937('0x41')],_0x1a7f15[_0x6937('0x42')]);_0xfbb69f[_0x6937('0x45')]=_[_0x6937('0x46')](_0x1a7f15[_0x6937('0x41')],qs[_0x6937('0x47')](_0x10ffa5[_0x6937('0x42')][_0x6937('0x47')]));_0xfbb69f[_0x6937('0x45')]=_0xfbb69f[_0x6937('0x45')][_0x6937('0x48')]?_0xfbb69f[_0x6937('0x45')]:_0x1a7f15[_0x6937('0x41')];if(!_0x10ffa5[_0x6937('0x42')][_0x6937('0x49')](_0x6937('0x4a'))){_0xfbb69f[_0x6937('0x2f')]=qs[_0x6937('0x2f')](_0x10ffa5[_0x6937('0x42')]['limit']);_0xfbb69f['offset']=qs[_0x6937('0x2e')](_0x10ffa5[_0x6937('0x42')][_0x6937('0x2e')]);}_0xfbb69f['order']=qs['sort'](_0x10ffa5[_0x6937('0x42')][_0x6937('0x4c')]);_0xfbb69f[_0x6937('0x4d')]=qs['filters'](_[_0x6937('0x4e')](_0x10ffa5[_0x6937('0x42')],_0x1a7f15['filters']));_0xfbb69f['where'][_0x6937('0x66')]=_0x28e7a5['id'];if(_0x10ffa5[_0x6937('0x42')][_0x6937('0x4f')]){_0xfbb69f[_0x6937('0x4d')]=_[_0x6937('0x50')](_0xfbb69f[_0x6937('0x4d')],{'$or':_[_0x6937('0x3d')](_0xfbb69f[_0x6937('0x45')],function(_0x5ce40a){var _0x115afb={};_0x115afb[_0x5ce40a]={'$like':'%'+_0x10ffa5[_0x6937('0x42')][_0x6937('0x4f')]+'%'};return _0x115afb;})});}_0xfbb69f=_[_0x6937('0x50')]({},_0xfbb69f,_0x10ffa5[_0x6937('0x56')]);return db[_0x6937('0x64')]['count']({'where':_0xfbb69f['where']})[_0x6937('0x34')](function(_0x1df24c){_0x4d9d8f[_0x6937('0x2d')]=_0x1df24c;if(_0x10ffa5[_0x6937('0x42')][_0x6937('0x51')]){_0xfbb69f['include']=[{'all':!![]}];}return db['Disposition'][_0x6937('0x52')](_0xfbb69f);})['then'](function(_0x5945f2){_0x4d9d8f[_0x6937('0x53')]=_0x5945f2;return _0x4d9d8f;});}})[_0x6937('0x34')](respondWithFilteredResult(_0x39c796,_0xfbb69f))[_0x6937('0x28')](handleError(_0x39c796,null));};exports[_0x6937('0x67')]=function(_0x6f12d,_0x3940e7,_0x13dfd0){return db[_0x6937('0x3e')][_0x6937('0x5d')]({'where':{'id':_0x6f12d[_0x6937('0x55')]['id']}})[_0x6937('0x34')](handleEntityNotFound(_0x3940e7,null))[_0x6937('0x34')](function(_0xf7ed16){if(_0xf7ed16){return _0xf7ed16['removeDispositions'](_0x6f12d[_0x6937('0x42')][_0x6937('0x68')]);}})[_0x6937('0x34')](respondWithStatusCode(_0x3940e7,null))[_0x6937('0x28')](handleError(_0x3940e7,null));};exports[_0x6937('0x69')]=function(_0x44333b,_0x3d6acd,_0xcec696){if(_0x44333b[_0x6937('0x61')]['id']){delete _0x44333b[_0x6937('0x61')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x44333b[_0x6937('0x55')]['id']}})[_0x6937('0x34')](handleEntityNotFound(_0x3d6acd,null))[_0x6937('0x34')](function(_0x4642ff){if(_0x4642ff){_0x44333b['body']['ChatWebsiteId']=_0x4642ff['id'];return db[_0x6937('0x6a')][_0x6937('0x57')](_0x44333b[_0x6937('0x61')]);}})[_0x6937('0x34')](respondWithResult(_0x3d6acd,null))[_0x6937('0x28')](handleError(_0x3d6acd,null));};exports[_0x6937('0x6b')]=function(_0x431684,_0x2b8996,_0x5e9e01){var _0x592838={'raw':![],'where':{}};var _0x1d10f5={};var _0x1acb0c={'count':0x0,'rows':[]};return db[_0x6937('0x3e')]['findOne']({'where':{'id':_0x431684['params']['id']}})[_0x6937('0x34')](handleEntityNotFound(_0x2b8996,null))['then'](function(_0x4b37df){if(_0x4b37df){_0x1d10f5[_0x6937('0x41')]=_[_0x6937('0x43')](db[_0x6937('0x6a')]['rawAttributes']);_0x1d10f5['query']=_['keys'](_0x431684[_0x6937('0x42')]);_0x1d10f5['filters']=_[_0x6937('0x46')](_0x1d10f5[_0x6937('0x41')],_0x1d10f5[_0x6937('0x42')]);_0x592838[_0x6937('0x45')]=_[_0x6937('0x46')](_0x1d10f5['model'],qs[_0x6937('0x47')](_0x431684[_0x6937('0x42')][_0x6937('0x47')]));_0x592838['attributes']=_0x592838[_0x6937('0x45')]['length']?_0x592838[_0x6937('0x45')]:_0x1d10f5[_0x6937('0x41')];if(!_0x431684['query'][_0x6937('0x49')]('nolimit')){_0x592838['limit']=qs[_0x6937('0x2f')](_0x431684[_0x6937('0x42')][_0x6937('0x2f')]);_0x592838[_0x6937('0x2e')]=qs[_0x6937('0x2e')](_0x431684[_0x6937('0x42')][_0x6937('0x2e')]);}_0x592838['order']=qs[_0x6937('0x4c')](_0x431684[_0x6937('0x42')][_0x6937('0x4c')]);_0x592838[_0x6937('0x4d')]=qs[_0x6937('0x44')](_['pick'](_0x431684[_0x6937('0x42')],_0x1d10f5['filters']));_0x592838[_0x6937('0x4d')][_0x6937('0x66')]=_0x4b37df['id'];if(_0x431684[_0x6937('0x42')][_0x6937('0x4f')]){_0x592838[_0x6937('0x4d')]=_['merge'](_0x592838[_0x6937('0x4d')],{'$or':_[_0x6937('0x3d')](_0x592838['attributes'],function(_0x371849){var _0x2fb3c5={};_0x2fb3c5[_0x371849]={'$like':'%'+_0x431684[_0x6937('0x42')][_0x6937('0x4f')]+'%'};return _0x2fb3c5;})});}_0x592838=_[_0x6937('0x50')]({},_0x592838,_0x431684['options']);return db[_0x6937('0x6a')][_0x6937('0x2d')]({'where':_0x592838[_0x6937('0x4d')]})[_0x6937('0x34')](function(_0x4dc303){_0x1acb0c[_0x6937('0x2d')]=_0x4dc303;if(_0x431684[_0x6937('0x42')][_0x6937('0x51')]){_0x592838[_0x6937('0x6c')]=[{'all':!![]}];}return db[_0x6937('0x6a')][_0x6937('0x52')](_0x592838);})['then'](function(_0x4e7d48){_0x1acb0c[_0x6937('0x53')]=_0x4e7d48;return _0x1acb0c;});}})[_0x6937('0x34')](respondWithFilteredResult(_0x2b8996,_0x592838))[_0x6937('0x28')](handleError(_0x2b8996,null));};exports['removeAnswers']=function(_0x3aa902,_0x4d4ff2,_0x5224ed){return db[_0x6937('0x3e')][_0x6937('0x5d')]({'where':{'id':_0x3aa902[_0x6937('0x55')]['id']}})[_0x6937('0x34')](handleEntityNotFound(_0x4d4ff2,null))[_0x6937('0x34')](function(_0x3f5f7b){if(_0x3f5f7b){return _0x3f5f7b[_0x6937('0x6d')](_0x3aa902[_0x6937('0x42')][_0x6937('0x68')]);}})['then'](respondWithStatusCode(_0x4d4ff2,null))[_0x6937('0x28')](handleError(_0x4d4ff2,null));};exports['addLogo']=function(_0x25df82,_0x285bfa,_0x3bd205){_0x25df82['body']['sitepic']=_0x25df82['file'][_0x6937('0x6e')];return db[_0x6937('0x3e')][_0x6937('0x5d')]({'where':{'id':_0x25df82[_0x6937('0x55')]['id']}})['then'](handleEntityNotFound(_0x285bfa,null))[_0x6937('0x34')](saveUpdates(_0x25df82[_0x6937('0x61')],null))[_0x6937('0x34')](respondWithResult(_0x285bfa,null))[_0x6937('0x28')](handleError(_0x285bfa,null));};exports[_0x6937('0x6f')]=function(_0x318297,_0x3186cf,_0x27ae2a){_0x318297[_0x6937('0x61')][_0x6937('0x70')]=_0x318297[_0x6937('0x71')]['filename'];return db[_0x6937('0x3e')]['find']({'where':{'id':_0x318297['params']['id']}})[_0x6937('0x34')](handleEntityNotFound(_0x3186cf,null))[_0x6937('0x34')](saveUpdates(_0x318297[_0x6937('0x61')],null))[_0x6937('0x34')](respondWithResult(_0x3186cf,null))[_0x6937('0x28')](handleError(_0x3186cf,null));};exports[_0x6937('0x72')]=function(_0x2bfc4a,_0x2c0886,_0x4e014d){_0x2bfc4a[_0x6937('0x61')][_0x6937('0x73')]=_0x2bfc4a[_0x6937('0x71')][_0x6937('0x6e')];return db[_0x6937('0x3e')][_0x6937('0x5d')]({'where':{'id':_0x2bfc4a[_0x6937('0x55')]['id']}})[_0x6937('0x34')](handleEntityNotFound(_0x2c0886,null))['then'](saveUpdates(_0x2bfc4a[_0x6937('0x61')],null))[_0x6937('0x34')](respondWithResult(_0x2c0886,null))['catch'](handleError(_0x2c0886,null));};exports[_0x6937('0x74')]=function(_0x2e52a1,_0x21d3b7,_0xf59002){_0x2e52a1[_0x6937('0x61')]['systemAvatar']=_0x2e52a1[_0x6937('0x71')][_0x6937('0x6e')];return db[_0x6937('0x3e')][_0x6937('0x5d')]({'where':{'id':_0x2e52a1['params']['id']}})['then'](handleEntityNotFound(_0x21d3b7,null))['then'](saveUpdates(_0x2e52a1[_0x6937('0x61')],null))['then'](respondWithResult(_0x21d3b7,null))[_0x6937('0x28')](handleError(_0x21d3b7,null));};exports['getLogo']=function(_0x3df8c4,_0x449a33,_0x3b3cc8){var _0x307002=path['join'](config[_0x6937('0x75')],_0x6937('0x76'));var _0x1f490c={'where':{'id':_0x3df8c4[_0x6937('0x55')]['id']},'attributes':['id',_0x6937('0x77')],'raw':!![]};var _0x643db8=![];return require('../../config/license/util')[_0x6937('0x78')]()['then'](function(_0x8e0537){if(_0x8e0537){_0x643db8=_0x8e0537[_0x6937('0x79')];}})[_0x6937('0x34')](function(){return db[_0x6937('0x3e')]['find'](_0x1f490c);})[_0x6937('0x34')](handleEntityNotFound(_0x449a33,null))[_0x6937('0x34')](function(_0x690a3){if(_0x690a3){if(!_['isNil'](_0x690a3[_0x6937('0x77')])){if(fs[_0x6937('0x7a')](path[_0x6937('0x7b')](config[_0x6937('0x75')],_0x6937('0x7c'),_0x690a3[_0x6937('0x77')]))&&_0x643db8){_0x307002=path['join'](config[_0x6937('0x75')],_0x6937('0x7c'),_0x690a3['sitepic']);}}return _0x449a33[_0x6937('0x7d')](_0x307002);}})[_0x6937('0x28')](handleError(_0x449a33,null));};exports[_0x6937('0x7e')]=function(_0x48be9b,_0x117bb2,_0xa51471){var _0x39e882=path[_0x6937('0x7b')](config[_0x6937('0x75')],_0x6937('0x7f'));var _0x54f01b={'where':{'id':_0x48be9b[_0x6937('0x55')]['id']},'attributes':['id',_0x6937('0x70')],'raw':!![]};return db[_0x6937('0x3e')][_0x6937('0x5d')](_0x54f01b)['then'](handleEntityNotFound(_0x117bb2,null))[_0x6937('0x34')](function(_0x3d417e){if(_0x3d417e){if(!_['isNil'](_0x3d417e['agentAvatar'])){if(fs[_0x6937('0x7a')](path[_0x6937('0x7b')](config[_0x6937('0x75')],'server/files/images/avatars/',_0x3d417e[_0x6937('0x70')]))){_0x39e882=path[_0x6937('0x7b')](config[_0x6937('0x75')],_0x6937('0x80'),_0x3d417e[_0x6937('0x70')]);}}return _0x117bb2['download'](_0x39e882);}})['catch'](handleError(_0x117bb2,null));};exports[_0x6937('0x81')]=function(_0x3497a8,_0x135cad,_0x5b22ae){var _0x3ae84e=path[_0x6937('0x7b')](config['root'],_0x6937('0x82'));var _0x1f45d6={'where':{'id':_0x3497a8['params']['id']},'attributes':['id',_0x6937('0x73'),'showCustomerAvatar'],'raw':!![]};return db[_0x6937('0x3e')][_0x6937('0x5d')](_0x1f45d6)['then'](handleEntityNotFound(_0x135cad,null))['then'](function(_0x3a6b64){if(_0x3a6b64){if(!_[_0x6937('0x83')](_0x3a6b64['customerAvatar'])){if(fs[_0x6937('0x7a')](path[_0x6937('0x7b')](config[_0x6937('0x75')],_0x6937('0x80'),_0x3a6b64['customerAvatar']))&&_0x3a6b64[_0x6937('0x84')]){_0x3ae84e=path[_0x6937('0x7b')](config[_0x6937('0x75')],_0x6937('0x80'),_0x3a6b64[_0x6937('0x73')]);}}return _0x135cad[_0x6937('0x7d')](_0x3ae84e);}})[_0x6937('0x28')](handleError(_0x135cad,null));};exports[_0x6937('0x85')]=function(_0x38cce4,_0x10ddf8,_0x20b74a){var _0x241bee=path[_0x6937('0x7b')](config[_0x6937('0x75')],_0x6937('0x86'));var _0x49ee7b={'where':{'id':_0x38cce4[_0x6937('0x55')]['id']},'attributes':['id',_0x6937('0x87')],'raw':!![]};return db['ChatWebsite'][_0x6937('0x5d')](_0x49ee7b)[_0x6937('0x34')](handleEntityNotFound(_0x10ddf8,null))[_0x6937('0x34')](function(_0x5d5a7d){if(_0x5d5a7d){if(!_['isNil'](_0x5d5a7d[_0x6937('0x87')])){if(fs[_0x6937('0x7a')](path[_0x6937('0x7b')](config[_0x6937('0x75')],'server/files/images/avatars/',_0x5d5a7d[_0x6937('0x87')]))){_0x241bee=path[_0x6937('0x7b')](config[_0x6937('0x75')],'server/files/images/avatars/',_0x5d5a7d['systemAvatar']);}}return _0x10ddf8[_0x6937('0x7d')](_0x241bee);}})[_0x6937('0x28')](handleError(_0x10ddf8,null));};exports[_0x6937('0x88')]=function(_0x4b7662,_0x28f5fe,_0x1819dd){var _0x3b3626=require(_0x6937('0x89'));var _0x27da51=new _0x3b3626();var _0x120642=_0x27da51[_0x6937('0x8a')](_0x4b7662['headers'][_0x6937('0x8b')])[_0x6937('0x8c')]();var _0x223622={'body':_0x4b7662[_0x6937('0x61')],'channel':'chat'};var _0x4eb971=[];var _0x30cf77=[];var _0x44d70b={};var _0x272e08=![];return db['CmContact'][_0x6937('0x62')]()[_0x6937('0x34')](function(_0x55dce0){if(!_0x55dce0){throw new db[(_0x6937('0x8d'))][(_0x6937('0x8e'))](_0x6937('0x8f'));}_0x4eb971=_[_0x6937('0x90')](_['keys'](_0x55dce0),[_0x6937('0x91'),_0x6937('0x92')]);_0x30cf77=_[_0x6937('0x90')](_['keys'](_0x55dce0),['createdAt',_0x6937('0x92'),'CompanyId','ListId']);if(_0x4b7662[_0x6937('0x61')]['id']){delete _0x4b7662[_0x6937('0x61')]['id'];}if(_[_0x6937('0x83')](_0x4b7662[_0x6937('0x61')][_0x6937('0x93')])){throw new db[(_0x6937('0x8d'))][(_0x6937('0x8e'))]('from\x20is\x20mandatory');}if(_[_0x6937('0x83')](_0x4b7662['body'][_0x6937('0x61')])||_0x4b7662[_0x6937('0x61')][_0x6937('0x61')]===''){throw new db[(_0x6937('0x8d'))][(_0x6937('0x8e'))](_0x6937('0x94'));}if(_[_0x6937('0x83')](_0x4b7662['body'][_0x6937('0x95')])){throw new db[(_0x6937('0x8d'))][(_0x6937('0x8e'))](_0x6937('0x96')+_0x30cf77);}if(!_['includes'](_0x30cf77,_0x4b7662[_0x6937('0x61')]['mapKey'])){throw new db[(_0x6937('0x8d'))][(_0x6937('0x8e'))](_0x6937('0x97')+_0x30cf77);}_0x44d70b[_0x4b7662[_0x6937('0x61')]['mapKey']]=_0x4b7662[_0x6937('0x61')][_0x6937('0x93')];})[_0x6937('0x34')](function(){return db[_0x6937('0x3e')]['find']({'where':{'id':_0x4b7662['params']['id']},'include':[{'model':db[_0x6937('0x98')],'as':_0x6937('0x99'),'include':[{'model':db[_0x6937('0x9a')],'as':_0x6937('0x9b'),'where':_0x44d70b,'limit':0x1,'order':[[_0x6937('0x92'),_0x6937('0x9c')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0x6937('0x34')](handleEntityNotFound(_0x28f5fe,null))[_0x6937('0x34')](function(_0x16055e){if(_0x16055e&&_0x16055e[_0x6937('0x99')]){_0x223622[_0x6937('0x9d')]=_0x16055e;_0x223622[_0x6937('0x9e')]=_0x16055e['Applications'];_0x223622[_0x6937('0x9f')]=_0x16055e[_0x6937('0x99')];_0x223622[_0x6937('0x9e')]=_[_0x6937('0xa0')](_0x223622['applications'],[_0x6937('0xa1')],['asc']);if(_0x223622['account'][_0x6937('0xa2')]){delete _0x223622[_0x6937('0x9d')][_0x6937('0xa2')];}if(_0x223622['account'][_0x6937('0x99')]&&_0x223622[_0x6937('0x9d')][_0x6937('0x99')][_0x6937('0x9b')][_0x6937('0x48')]){return _0x223622[_0x6937('0x9d')][_0x6937('0x99')]['Contacts'][0x0];}var _0x398668=_[_0x6937('0x18')](_0x4b7662[_0x6937('0x61')],{'firstName':_0x4b7662[_0x6937('0x61')][_0x6937('0x93')],'ListId':_0x16055e[_0x6937('0xa3')]});_0x398668[_0x4b7662['body'][_0x6937('0x95')]]=_0x4b7662[_0x6937('0x61')][_0x6937('0x93')];return db['CmContact']['create'](_0x398668,{'fields':_0x4eb971,'raw':!![]});}})[_0x6937('0x34')](handleEntityNotFound(_0x28f5fe,null))[_0x6937('0x34')](function(_0x254577){_0x223622[_0x6937('0xa4')]=_0x254577;var _0x54a58b=_0x4b7662[_0x6937('0x61')]['customerIp'];if(_0x4b7662[_0x6937('0xa5')][_0x6937('0xa6')]){_0x54a58b=_0x4b7662['headers']['cf-connecting-ip'];}else if(_0x4b7662[_0x6937('0xa5')][_0x6937('0xa7')]){_0x54a58b=_['first'](_0x4b7662[_0x6937('0xa5')]['x-forwarded-for']['split'](','));}if(_0x254577){var _0x3df6b8={'ContactId':_0x254577['id'],'ChatWebsiteId':_0x4b7662[_0x6937('0x55')]['id'],'from':(_0x254577[_0x6937('0xa8')]||'')+'\x20'+(_0x254577[_0x6937('0xa9')]||''),'customerIp':_0x54a58b,'customerPort':_0x4b7662[_0x6937('0xa5')][_0x6937('0xaa')]?_0x4b7662[_0x6937('0xa5')][_0x6937('0xaa')]:null,'referer':_0x4b7662[_0x6937('0x61')][_0x6937('0xab')],'browserName':_0x120642[_0x6937('0xac')][_0x6937('0x38')]&&_0x120642[_0x6937('0xac')]['version']?util[_0x6937('0xad')](_0x6937('0xae'),_0x120642['browser'][_0x6937('0x38')],_0x120642[_0x6937('0xac')][_0x6937('0xaf')]):'unknown','browserVersion':_0x120642[_0x6937('0xac')][_0x6937('0xaf')]||'unknown','osName':util['format'](_0x6937('0xae'),_0x120642['os'][_0x6937('0x38')],_0x120642['os'][_0x6937('0xaf')]),'osVersion':_0x120642['os'][_0x6937('0xaf')],'deviceModel':_0x120642['device']['model']&&_0x120642[_0x6937('0xb0')][_0x6937('0xb1')]?util[_0x6937('0xad')](_0x6937('0xb2'),_0x120642[_0x6937('0xb0')][_0x6937('0x41')],_0x120642[_0x6937('0xb0')][_0x6937('0xb1')],_0x120642[_0x6937('0xb0')][_0x6937('0x40')]):null,'deviceVendor':_0x120642['device'][_0x6937('0xb1')],'deviceType':_0x120642[_0x6937('0xb0')][_0x6937('0x40')],'formData':JSON[_0x6937('0xb3')](_0x4b7662[_0x6937('0x61')])};var _0x30188c={'ChatWebsiteId':_0x4b7662[_0x6937('0x55')]['id'],'closed':![]};if(_0x4b7662['body']['threadId']){_0x30188c[_0x6937('0xb4')]=_0x4b7662['body'][_0x6937('0xb4')];return db[_0x6937('0xb5')]['find']({'where':_0x30188c})[_0x6937('0x34')](function(_0x4a0f7a){if(_0x4a0f7a){return[_0x4a0f7a,![]];}_0x3df6b8[_0x6937('0xb4')]=_0x4b7662[_0x6937('0x61')]['threadId'];_0x3df6b8['externalUrl']=_0x4b7662['body'][_0x6937('0xb6')];return db['ChatInteraction'][_0x6937('0x57')](_0x3df6b8)[_0x6937('0x34')](function(_0x626588){return[_0x626588,!![]];});});}_0x30188c[_0x6937('0xb7')]=_0x254577['id'];if(_0x4b7662[_0x6937('0x61')]['interaction']&&_0x4b7662[_0x6937('0x61')][_0x6937('0xb8')]['id']){_0x30188c['id']=_0x4b7662['body'][_0x6937('0xb8')]['id'];return db['ChatInteraction']['find']({'where':_0x30188c})[_0x6937('0x34')](function(_0x3b0361){if(_0x3b0361){return[_0x3b0361,![]];}return db['ChatInteraction'][_0x6937('0x57')](_0x3df6b8)['then'](function(_0x580bd2){return[_0x580bd2,!![]];});});}return db[_0x6937('0xb5')][_0x6937('0x57')](_0x3df6b8)[_0x6937('0x34')](function(_0x73a78){return[_0x73a78,!![]];});}})['spread'](function(_0x2f8b48,_0x4c7d90){if(_0x2f8b48){_0x272e08=_0x4c7d90;if(!_0x4c7d90){var _0x261f35={'from':(_0x223622[_0x6937('0xa4')]['firstName']||'')+'\x20'+(_0x223622[_0x6937('0xa4')]['lastName']||'')};if(_0x4b7662[_0x6937('0x61')][_0x6937('0xb4')]&&_0x4b7662[_0x6937('0x61')]['messageId']&&_0x4b7662[_0x6937('0x61')][_0x6937('0xb4')]!=_0x4b7662[_0x6937('0x61')][_0x6937('0xb9')]){_0x261f35[_0x6937('0xb4')]=_0x4b7662[_0x6937('0x61')][_0x6937('0xb9')];}return _0x2f8b48[_0x6937('0xba')](_0x261f35);}else{return _0x2f8b48;}}})[_0x6937('0x34')](function(_0x3ac8d2){_0x223622[_0x6937('0xb8')]=_0x3ac8d2[_0x6937('0x58')]({'plain':!![]});_0x223622['interaction'][_0x6937('0xbb')]=_0x272e08;if(_0x223622['interaction'][_0x6937('0xbb')]){if(_0x223622[_0x6937('0x9d')][_0x6937('0xbc')]){_0x223622[_0x6937('0x9e')][_0x6937('0xbd')]({'id':0x0,'priority':_0x223622['applications'][_0x6937('0x48')]+0x1,'app':_0x6937('0xbe'),'appdata':_0x6937('0xbf'),'interval':_0x6937('0xc0')});}}return db[_0x6937('0xc1')][_0x6937('0x57')]({'body':_0x4b7662[_0x6937('0x61')][_0x6937('0x61')],'ChatWebsiteId':_0x4b7662[_0x6937('0x55')]['id'],'ChatInteractionId':_0x3ac8d2['id'],'direction':'in','ContactId':_0x223622[_0x6937('0xa4')]['id'],'AttachmentId':_0x4b7662[_0x6937('0x61')][_0x6937('0xc2')]});})[_0x6937('0x34')](function(_0x1fcf56){_0x223622[_0x6937('0x25')]=_0x1fcf56;if(_0x223622[_0x6937('0xb8')][_0x6937('0xc3')]){return db[_0x6937('0xc4')][_0x6937('0x5d')]({'attributes':['id','name'],'where':{'id':_0x223622[_0x6937('0xb8')][_0x6937('0xc3')]}})[_0x6937('0x34')](function(_0xd0e6e1){if(_0xd0e6e1){_0x223622[_0x6937('0x9e')][_0x6937('0xc5')]({'id':0x0,'priority':0x0,'app':_0x6937('0xc6'),'appdata':_0xd0e6e1['name']+','+(_0x223622['account'][_0x6937('0xc7')]||0xa),'interval':_0x6937('0xc0')});_0x223622['forcedOwnership']=!![];}return respondWithRpcPromise(_0x6937('0xc8'),'startRouting',_0x223622);});}return respondWithRpcPromise(_0x6937('0xc8'),'startRouting',_0x223622);})[_0x6937('0x34')](function(_0x22d039){respondWithRpcPromise(_0x6937('0xc9'),_0x6937('0xc9'),{'event':_0x6937('0x88'),'message':_0x22d039},client9002);return _0x22d039;})[_0x6937('0x34')](respondWithResult(_0x28f5fe,null))['catch'](handleError(_0x28f5fe,null));};exports[_0x6937('0xca')]=function(_0x158455,_0x317fef,_0x345661){var _0x23611a,_0xaf8f8e,_0x352431;var _0x102ad8=[];var _0x345325=[];var _0x51ecf2={};return db[_0x6937('0x9a')][_0x6937('0x62')]()[_0x6937('0x34')](function(_0x5b5d72){if(!_0x5b5d72){throw new db['Sequelize']['ValidationError'](_0x6937('0x8f'));}_0x345325=_[_0x6937('0x90')](_[_0x6937('0x43')](_0x5b5d72),[_0x6937('0x91'),_0x6937('0x92')]);_0x102ad8=_[_0x6937('0x90')](_[_0x6937('0x43')](_0x5b5d72),[_0x6937('0x91'),_0x6937('0x92'),_0x6937('0xcb'),_0x6937('0xa3')]);if(_0x158455[_0x6937('0x61')]['id']){delete _0x158455[_0x6937('0x61')]['id'];}if(_[_0x6937('0x83')](_0x158455[_0x6937('0x61')][_0x6937('0x93')])){throw _0x317fef[_0x6937('0x2a')](0x1f4)[_0x6937('0x39')](new db['Sequelize']['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x6937('0x83')](_0x158455['body'][_0x6937('0x61')])||_0x158455[_0x6937('0x61')][_0x6937('0x61')]===''){throw _0x317fef[_0x6937('0x2a')](0x1f4)[_0x6937('0x39')](new db[(_0x6937('0x8d'))]['ValidationError'](_0x6937('0x94')));}if(_['isNil'](_0x158455[_0x6937('0x61')][_0x6937('0xcc')])){throw _0x317fef['status'](0x1f4)[_0x6937('0x39')](new db[(_0x6937('0x8d'))]['ValidationError'](_0x6937('0xcd')+_0x102ad8));}if(!_['includes'](_0x102ad8,_0x158455['body'][_0x6937('0xcc')])){throw _0x317fef['status'](0x1f4)[_0x6937('0x39')](new db['Sequelize'][(_0x6937('0x8e'))](_0x6937('0xce')+_0x102ad8));}_0x51ecf2[_0x158455[_0x6937('0x61')][_0x6937('0xcc')]]=_0x158455['body'][_0x6937('0x93')];})[_0x6937('0x34')](function(){return db[_0x6937('0x3e')]['find']({'where':{'id':_0x158455[_0x6937('0x55')]['id']},'include':[{'model':db[_0x6937('0x98')],'as':_0x6937('0x99')}]});})['then'](handleEntityNotFound(_0x317fef,null))[_0x6937('0x34')](function(_0x4558d4){if(_0x4558d4&&_0x4558d4[_0x6937('0x99')]){_0xaf8f8e=_0x4558d4;var _0x5a7226=_[_0x6937('0x18')](_0x158455[_0x6937('0x61')],{'firstName':_0x158455['body'][_0x6937('0x93')],'phone':_0x158455[_0x6937('0x61')]['from'],'ListId':_0x4558d4[_0x6937('0xa3')]});_0x5a7226[_0x158455[_0x6937('0x61')]['mapKeyOffline']]=_0x158455['body']['from'];return db[_0x6937('0x9a')]['findOrCreate']({'where':_0x51ecf2,'defaults':_0x5a7226});}})['spread'](function(_0x3a357b){if(_0x3a357b){_0x352431=_0x3a357b;var _0xc971df=fs[_0x6937('0xcf')](path[_0x6937('0x7b')](config[_0x6937('0x75')],_0x6937('0xd0')),_0x6937('0xd1'));var _0x2c5014=ejs[_0x6937('0xd2')](_0xc971df,{'body':_['toPairs'](_0x158455[_0x6937('0x61')][_0x6937('0x61')]),'bodyTitle':_0xaf8f8e['offlineMessageBody']});return db[_0x6937('0xd3')]['create']({'body':_0x2c5014,'ContactId':_0x3a357b['id'],'ChatWebsiteId':_0xaf8f8e['id']});}})[_0x6937('0x34')](function(_0x595cf2){if(_0x595cf2){_0x23611a=_0x595cf2;return db[_0x6937('0xd4')][_0x6937('0xd5')]({'where':{'service':!![]},'include':[{'model':db[_0x6937('0xd6')],'as':_0x6937('0xd7'),'raw':!![]}]});}})[_0x6937('0x34')](function(_0x4231a1){if(_0x4231a1&&_0x4231a1[_0x6937('0xd7')]&&_0xaf8f8e[_0x6937('0xd8')]){var _0x11571d={'tls':{'rejectUnauthorized':![]}};if(_0x4231a1[_0x6937('0xd7')][_0x6937('0xd9')]){_0x11571d[_0x6937('0xd9')]=_0x4231a1[_0x6937('0xd7')][_0x6937('0xd9')];}else{_0x11571d[_0x6937('0xda')]=_0x4231a1[_0x6937('0xd7')]['host'];_0x11571d['port']=_0x4231a1['Smtp'][_0x6937('0xdb')];_0x11571d[_0x6937('0xdc')]=_0x4231a1['Smtp'][_0x6937('0xdc')];}if(_0x4231a1['Smtp'][_0x6937('0xdd')]){_0x11571d[_0x6937('0xde')]={'user':_0x4231a1[_0x6937('0xd7')][_0x6937('0x5b')],'pass':_0x4231a1[_0x6937('0xd7')][_0x6937('0xdf')]};}return respondWithRpcPromise(_0x6937('0xe0'),_0x6937('0xe1'),{'account':_0x11571d,'message':{'from':util[_0x6937('0xad')](_0x6937('0xe2'),_0x4231a1[_0x6937('0x38')],_0x4231a1[_0x6937('0xe3')]||_0x4231a1[_0x6937('0xd7')][_0x6937('0x5b')]),'to':_0xaf8f8e[_0x6937('0xd8')],'subject':_0xaf8f8e[_0x6937('0xe4')],'text':_0x23611a[_0x6937('0x61')]}},client9003)['then'](function(){return _0x23611a;})[_0x6937('0x28')](function(_0x7d6866){console[_0x6937('0x23')](_0x7d6866);});}})[_0x6937('0x34')](function(){if(_0x23611a){return _0x23611a;}})[_0x6937('0x34')](respondWithResult(_0x317fef,null))[_0x6937('0x28')](handleError(_0x317fef,null));};exports[_0x6937('0xe5')]=function(_0xa2f68d,_0x3b794f,_0x267ab5){return db['ChatInteraction'][_0x6937('0x5d')]({'where':{'id':_0xa2f68d[_0x6937('0x55')]['id']}})[_0x6937('0x34')](handleEntityNotFound(_0x3b794f,null))[_0x6937('0x34')](function(_0x360c0a){if(_0x360c0a){return _0x360c0a[_0x6937('0xe5')](_0xa2f68d[_0x6937('0x61')][_0x6937('0x68')],_[_0x6937('0xe6')](_0xa2f68d[_0x6937('0x61')],[_0x6937('0x68'),'id'])||{});}})['then'](respondWithResult(_0x3b794f,null))[_0x6937('0x28')](handleError(_0x3b794f,null));};exports[_0x6937('0xe7')]=function(_0x37d459,_0x4d5540,_0x58e653){var _0x15ac3d={'raw':![],'where':{}};var _0x2f0139={};var _0x52ecfc={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x6937('0xd5')]({'where':{'id':_0x37d459[_0x6937('0x55')]['id']}})[_0x6937('0x34')](handleEntityNotFound(_0x4d5540,null))[_0x6937('0x34')](function(_0x16d7d8){if(_0x16d7d8){_0x2f0139[_0x6937('0x41')]=_[_0x6937('0x43')](db['ChatInteraction'][_0x6937('0x3f')]);_0x2f0139['query']=_['keys'](_0x37d459[_0x6937('0x42')]);_0x2f0139['filters']=_[_0x6937('0x46')](_0x2f0139['model'],_0x2f0139[_0x6937('0x42')]);_0x15ac3d[_0x6937('0x45')]=_[_0x6937('0x46')](_0x2f0139['model'],qs[_0x6937('0x47')](_0x37d459[_0x6937('0x42')][_0x6937('0x47')]));_0x15ac3d[_0x6937('0x45')]=_0x15ac3d[_0x6937('0x45')][_0x6937('0x48')]?_0x15ac3d[_0x6937('0x45')]:_0x2f0139['model'];if(!_0x37d459['query'][_0x6937('0x49')]('nolimit')){_0x15ac3d[_0x6937('0x2f')]=qs[_0x6937('0x2f')](_0x37d459[_0x6937('0x42')][_0x6937('0x2f')]);_0x15ac3d[_0x6937('0x2e')]=qs[_0x6937('0x2e')](_0x37d459[_0x6937('0x42')][_0x6937('0x2e')]);}_0x15ac3d[_0x6937('0x4b')]=qs[_0x6937('0x4c')](_0x37d459['query'][_0x6937('0x4c')]);_0x15ac3d[_0x6937('0x4d')]=qs['filters'](_[_0x6937('0x4e')](_0x37d459[_0x6937('0x42')],_0x2f0139['filters']));_0x15ac3d['where'][_0x6937('0x66')]=_0x16d7d8['id'];if(_0x37d459['query'][_0x6937('0x4f')]){_0x15ac3d[_0x6937('0x4d')]=_[_0x6937('0x50')](_0x15ac3d[_0x6937('0x4d')],{'$or':_[_0x6937('0x3d')](_0x15ac3d[_0x6937('0x45')],function(_0x58d6d7){var _0x24835d={};_0x24835d[_0x58d6d7]={'$like':'%'+_0x37d459['query'][_0x6937('0x4f')]+'%'};return _0x24835d;})});}_0x15ac3d=_[_0x6937('0x50')]({},_0x15ac3d,_0x37d459[_0x6937('0x56')]);return db[_0x6937('0xb5')]['count']({'where':_0x15ac3d['where']})[_0x6937('0x34')](function(_0x32144c){_0x52ecfc[_0x6937('0x2d')]=_0x32144c;if(_0x37d459['query'][_0x6937('0x51')]){_0x15ac3d[_0x6937('0x6c')]=[{'model':db['CmContact'],'as':_0x6937('0xe8'),'required':![]},{'model':db[_0x6937('0xc4')],'as':_0x6937('0xe9'),'attributes':[_0x6937('0x38'),_0x6937('0xea'),_0x6937('0xeb')],'required':![]},{'model':db[_0x6937('0xec')],'as':_0x6937('0xed'),'attributes':['id','name',_0x6937('0xee')],'where':_0x37d459[_0x6937('0x42')][_0x6937('0xef')]?{'id':_0x37d459[_0x6937('0x42')][_0x6937('0xef')]}:undefined,'required':_0x37d459[_0x6937('0x42')][_0x6937('0xef')]?!![]:![]}];}return db[_0x6937('0xb5')][_0x6937('0x52')](_0x15ac3d);})[_0x6937('0x34')](function(_0x1c1524){_0x52ecfc['rows']=_0x1c1524;return _0x52ecfc;});}})['then'](respondWithFilteredResult(_0x4d5540,_0x15ac3d))[_0x6937('0x28')](handleError(_0x4d5540,null));};function iftimePromise(_0x69ea31,_0x42f6f0){return respondWithRpcPromise(_0x6937('0xf0'),'getSnippet',{'command':_0x42f6f0[_0x6937('0xf1')]?util[_0x6937('0xad')]('iftime\x20%s,%s',_0x69ea31[_0x6937('0xf2')],_0x42f6f0[_0x6937('0xf1')]):util[_0x6937('0xad')](_0x6937('0xf3'),_0x69ea31[_0x6937('0xf2')])},client9002)[_0x6937('0x34')](function(_0x538d14){var _0x31660f=_0x538d14&&_0x538d14['indexOf'](_0x6937('0xf4'))>=0x0?!![]:![];logger[_0x6937('0x20')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x42f6f0['id'],_0x69ea31['id'],_0x69ea31[_0x6937('0xf2')],_0x31660f?_0x6937('0xf5'):'OFFLINE',_0x42f6f0[_0x6937('0xf1')]?_0x42f6f0[_0x6937('0xf1')]:_0x6937('0xf6'));return _0x31660f;})['catch'](function(_0x3c6a1a){logger[_0x6937('0x23')](_0x6937('0xf7'),_0x42f6f0['id'],_0x69ea31['id'],_0x69ea31[_0x6937('0xf2')],util[_0x6937('0xf8')](_0x3c6a1a,{'showHidden':![],'depth':null}),_0x42f6f0[_0x6937('0xf1')]?_0x42f6f0[_0x6937('0xf1')]:_0x6937('0xf6'));return![];});}exports[_0x6937('0xf9')]=function(_0x12dbb6,_0x2882d6,_0x11348f){var _0x49be9f=0x0;var _0x52710d=0x0;var _0xfe1260=![];var _0x3430a5;var _0x94e3a8;return db[_0x6937('0x3e')][_0x6937('0x5d')]({'where':{'id':_0x12dbb6[_0x6937('0x55')]['id']},'include':[{'model':db[_0x6937('0xfa')],'as':_0x6937('0xfa'),'include':[{'model':db[_0x6937('0xfa')],'as':_0x6937('0xfb'),'attributes':['id',_0x6937('0xf2')],'raw':!![]}]}]})[_0x6937('0x34')](handleEntityNotFound(_0x2882d6,null))[_0x6937('0x34')](function(_0x3e52f0){if(_0x3e52f0){_0x3430a5=_0x3e52f0;return _0x3e52f0['getProactiveActions']({'raw':!![]});}})[_0x6937('0x34')](function(_0x3bf872){if(_0x3430a5){if(_0x3bf872){_0x94e3a8=_0x3bf872;}}return require(_0x6937('0xfc'))[_0x6937('0x78')]();})[_0x6937('0x34')](function(_0x5d5bea){if(_0x5d5bea){_0x52710d=_0x5d5bea['virtual'];_0xfe1260=_0x5d5bea['custom'];}})[_0x6937('0x34')](function(){return db[_0x6937('0xb5')][_0x6937('0x2d')]({'where':{'closed':![]}});})[_0x6937('0x34')](function(_0x23222c){_0x49be9f=_0x23222c;if(_0x52710d&&_0x23222c>_0x52710d){return db[_0x6937('0xfd')][_0x6937('0xd5')]({'where':{'id':0x1}})[_0x6937('0x34')](function(_0x50ef93){if(_0x50ef93){_0x50ef93['increment']('chatLicenseExceeded');}});}})[_0x6937('0x34')](function(){if(_0x3430a5[_0x6937('0xfa')]&&_0x3430a5[_0x6937('0xfa')][_0x6937('0xfb')]){var _0x995730=[];for(var _0x5d1a47=0x0;_0x5d1a47<_0x3430a5[_0x6937('0xfa')]['Intervals']['length'];_0x5d1a47++){var _0x4e8ddc=_0x3430a5['Interval']['Intervals'][_0x5d1a47][_0x6937('0x58')]({'plain':!![]});_0x995730[_0x6937('0xbd')](iftimePromise(_0x4e8ddc,_0x3430a5));}return BPromise['all'](_0x995730)['then'](function(_0x501338){return _['some'](_0x501338);});}else{return!![];}})[_0x6937('0x34')](function(_0x3de222){var _0x3a8167=fs[_0x6937('0xcf')](path['join'](config['root'],_0x6937('0xfe')),_0x6937('0xd1'));var _0x29e0f6={'remote':_0x3430a5[_0x6937('0xff')],'query':querystring['stringify'](_[_0x6937('0x50')](_0x3430a5[_0x6937('0x58')]({'plain':!![]}),{'customerIp':_0x12dbb6[_0x6937('0xa5')][_0x6937('0xa7')]||_0x12dbb6[_0x6937('0xa5')][_0x6937('0x100')]||_0x12dbb6[_0x6937('0x101')][_0x6937('0x102')]||_0x12dbb6['ip'],'referer':_0x12dbb6[_0x6937('0xa5')]['referer'],'openedInteractions':_0x49be9f,'maxInteractions':_0x52710d,'virtual':_0xfe1260[_0x6937('0x103')],'online':_0x3de222,'custom':_0xfe1260}))['replace'](/'/g,'\x5c\x27')};_0x2882d6['send'](ejs[_0x6937('0xd2')](Mustache[_0x6937('0xd2')](_0x3a8167,_0x29e0f6),{'proactiveActions':_0x94e3a8,'alignment':_0x3430a5['alignment'],'verticalAlignment':_0x3430a5[_0x6937('0x104')],'div_color':_0x3430a5[_0x6937('0xee')],'text_color':_0x3430a5[_0x6937('0x105')]}));})[_0x6937('0x28')](handleError(_0x2882d6,null));};exports[_0x6937('0x106')]=function(_0x24d276,_0x44fdfa,_0x3cce3b){return db[_0x6937('0x3e')][_0x6937('0xd5')]({'where':{'id':_0x24d276[_0x6937('0x55')]['id']}})[_0x6937('0x34')](handleEntityNotFound(_0x44fdfa,null))[_0x6937('0x34')](function(_0x244b89){if(_0x244b89){return db[_0x6937('0x107')]['transaction'](function(_0xfa4611){return db[_0x6937('0x108')]['destroy']({'where':{'ChatWebsiteId':_0x24d276[_0x6937('0x55')]['id']},'transaction':_0xfa4611})['then'](function(_0x4d012a){var _0x307ae5=_[_0x6937('0x3d')](_0x24d276[_0x6937('0x61')],function(_0x35d05b){_0x35d05b['ChatWebsiteId']=_0x24d276[_0x6937('0x55')]['id'];return _0x35d05b;});return db[_0x6937('0x108')][_0x6937('0x109')](_0x307ae5,{'transaction':_0xfa4611});});})[_0x6937('0x34')](function(){return db[_0x6937('0x108')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x24d276[_0x6937('0x55')]['id']},'order':_0x6937('0xa1')});});}})[_0x6937('0x34')](respondWithResult(_0x44fdfa,null))[_0x6937('0x28')](handleError(_0x44fdfa,null));};exports[_0x6937('0x10a')]=function(_0x339d92,_0x118a06,_0x47920d){var _0x53ca57={};var _0x4d3cec={};var _0x2e988c;var _0x445ab7;return db[_0x6937('0x3e')]['findOne']({'where':{'id':_0x339d92[_0x6937('0x55')]['id']}})[_0x6937('0x34')](handleEntityNotFound(_0x118a06,null))['then'](function(_0x142b8c){if(_0x142b8c){_0x2e988c=_0x142b8c;_0x4d3cec[_0x6937('0x41')]=_['keys'](db['ChatApplication'][_0x6937('0x3f')]);_0x4d3cec[_0x6937('0x42')]=_[_0x6937('0x43')](_0x339d92['query']);_0x4d3cec[_0x6937('0x44')]=_[_0x6937('0x46')](_0x4d3cec['model'],_0x4d3cec[_0x6937('0x42')]);_0x53ca57['attributes']=_[_0x6937('0x46')](_0x4d3cec[_0x6937('0x41')],qs[_0x6937('0x47')](_0x339d92['query'][_0x6937('0x47')]));_0x53ca57[_0x6937('0x45')]=_0x53ca57[_0x6937('0x45')]['length']?_0x53ca57[_0x6937('0x45')]:_0x4d3cec[_0x6937('0x41')];_0x53ca57[_0x6937('0x4b')]=qs['sort'](_0x339d92['query']['sort']);_0x53ca57[_0x6937('0x4d')]=qs[_0x6937('0x44')](_[_0x6937('0x4e')](_0x339d92[_0x6937('0x42')],_0x4d3cec['filters']));if(_0x339d92['query'][_0x6937('0x4f')]){_0x53ca57['where']=_[_0x6937('0x50')](_0x53ca57[_0x6937('0x4d')],{'$or':_['map'](_0x53ca57['attributes'],function(_0x20e5a6){var _0x1e1583={};_0x1e1583[_0x20e5a6]={'$like':'%'+_0x339d92[_0x6937('0x42')][_0x6937('0x4f')]+'%'};return _0x1e1583;})});}_0x53ca57=_[_0x6937('0x50')]({},_0x53ca57,_0x339d92[_0x6937('0x56')]);return _0x2e988c[_0x6937('0x10a')](_0x53ca57);}})[_0x6937('0x34')](function(_0x5cd6f1){if(_0x5cd6f1){_0x445ab7=_0x5cd6f1[_0x6937('0x48')];if(!_0x339d92[_0x6937('0x42')][_0x6937('0x49')](_0x6937('0x4a'))){_0x53ca57[_0x6937('0x2f')]=qs['limit'](_0x339d92['query']['limit']);_0x53ca57[_0x6937('0x2e')]=qs['offset'](_0x339d92['query'][_0x6937('0x2e')]);}return _0x2e988c[_0x6937('0x10a')](_0x53ca57);}})[_0x6937('0x34')](function(_0x4e52ca){if(_0x4e52ca){return _0x4e52ca?{'count':_0x445ab7,'rows':_0x4e52ca}:null;}})[_0x6937('0x34')](respondWithResult(_0x118a06,null))[_0x6937('0x28')](handleError(_0x118a06,null));};exports[_0x6937('0x10b')]=function(_0x55a400,_0x27c375,_0x588327){return db[_0x6937('0x10c')][_0x6937('0x5d')]({'where':{'id':_0x55a400['params']['id']}})[_0x6937('0x34')](handleEntityNotFound(_0x27c375,null))[_0x6937('0x34')](function(_0x5bb3e5){if(_0x5bb3e5){return _0x5bb3e5['addProactiveActions'](_0x55a400[_0x6937('0x61')][_0x6937('0x68')],_[_0x6937('0xe6')](_0x55a400[_0x6937('0x61')],[_0x6937('0x68'),'id'])||{});}})[_0x6937('0x34')](respondWithResult(_0x27c375,null))['catch'](handleError(_0x27c375,null));};exports[_0x6937('0x10d')]=function(_0x3afa28,_0x1690f2,_0x1df2bf){var _0x1b6739={};var _0x44f35a={};var _0x53dd4c;var _0x1e8ef3;return db[_0x6937('0x3e')][_0x6937('0xd5')]({'where':{'id':_0x3afa28['params']['id']}})[_0x6937('0x34')](handleEntityNotFound(_0x1690f2,null))[_0x6937('0x34')](function(_0x23a778){if(_0x23a778){_0x53dd4c=_0x23a778;_0x44f35a[_0x6937('0x41')]=_[_0x6937('0x43')](db[_0x6937('0x10e')]['rawAttributes']);_0x44f35a[_0x6937('0x42')]=_[_0x6937('0x43')](_0x3afa28[_0x6937('0x42')]);_0x44f35a[_0x6937('0x44')]=_['intersection'](_0x44f35a[_0x6937('0x41')],_0x44f35a[_0x6937('0x42')]);_0x1b6739[_0x6937('0x45')]=_[_0x6937('0x46')](_0x44f35a['model'],qs[_0x6937('0x47')](_0x3afa28[_0x6937('0x42')]['fields']));_0x1b6739[_0x6937('0x45')]=_0x1b6739[_0x6937('0x45')][_0x6937('0x48')]?_0x1b6739[_0x6937('0x45')]:_0x44f35a['model'];_0x1b6739[_0x6937('0x4b')]=qs[_0x6937('0x4c')](_0x3afa28[_0x6937('0x42')][_0x6937('0x4c')]);_0x1b6739[_0x6937('0x4d')]=qs[_0x6937('0x44')](_[_0x6937('0x4e')](_0x3afa28[_0x6937('0x42')],_0x44f35a['filters']));if(_0x3afa28[_0x6937('0x42')][_0x6937('0x4f')]){_0x1b6739[_0x6937('0x4d')]=_['merge'](_0x1b6739[_0x6937('0x4d')],{'$or':_[_0x6937('0x3d')](_0x1b6739['attributes'],function(_0x2c8565){var _0xdf1574={};_0xdf1574[_0x2c8565]={'$like':'%'+_0x3afa28[_0x6937('0x42')]['filter']+'%'};return _0xdf1574;})});}_0x1b6739=_[_0x6937('0x50')]({},_0x1b6739,_0x3afa28[_0x6937('0x56')]);return _0x53dd4c['getProactiveActions'](_0x1b6739);}})[_0x6937('0x34')](function(_0x554fe0){if(_0x554fe0){_0x1e8ef3=_0x554fe0[_0x6937('0x48')];if(!_0x3afa28[_0x6937('0x42')][_0x6937('0x49')](_0x6937('0x4a'))){_0x1b6739[_0x6937('0x2f')]=qs[_0x6937('0x2f')](_0x3afa28[_0x6937('0x42')][_0x6937('0x2f')]);_0x1b6739[_0x6937('0x2e')]=qs['offset'](_0x3afa28['query'][_0x6937('0x2e')]);}return _0x53dd4c['getProactiveActions'](_0x1b6739);}})[_0x6937('0x34')](function(_0x2fa496){if(_0x2fa496){return _0x2fa496?{'count':_0x1e8ef3,'rows':_0x2fa496}:null;}})[_0x6937('0x34')](respondWithResult(_0x1690f2,null))[_0x6937('0x28')](handleError(_0x1690f2,null));};exports['getFields']=function(_0x527f7f,_0x5c320e,_0xae8089){var _0x1b26a7=_0x527f7f[_0x6937('0x42')]['online']===_0x6937('0x10f')?'offlineForm':'onlineForm';return db[_0x6937('0x3e')]['find']({'attributes':['id',_0x1b26a7],'where':{'id':_0x527f7f[_0x6937('0x55')]['id']}})[_0x6937('0x34')](handleEntityNotFound(_0x5c320e,null))[_0x6937('0x34')](function(_0x268a6f){if(_0x268a6f){var _0x35fa11=_0x268a6f[_0x1b26a7];var _0x255766=_0x35fa11&&_0x35fa11[_0x6937('0x110')]?_0x35fa11['items']:[];_0x5c320e['send']({'fromKey':_[_0x6937('0x83')](_0x35fa11[_0x6937('0x111')])?undefined:_0x35fa11[_0x6937('0x111')],'count':_0x255766[_0x6937('0x48')],'rows':_0x255766});}})['catch'](handleError(_0x5c320e,null));};exports[_0x6937('0x112')]=function(_0x55db7e,_0x18b7e8,_0x452a6a){var _0x2fd206={'raw':![],'where':{}};var _0x341fb9={};var _0x12ea9c={'count':0x0,'rows':[]};return db[_0x6937('0x3e')][_0x6937('0xd5')]({'where':{'id':_0x55db7e[_0x6937('0x55')]['id']}})[_0x6937('0x34')](handleEntityNotFound(_0x18b7e8,null))[_0x6937('0x34')](function(_0x4546a1){if(_0x4546a1){_0x341fb9[_0x6937('0x41')]=_['keys'](db[_0x6937('0xd3')][_0x6937('0x3f')]);_0x341fb9[_0x6937('0x42')]=_['keys'](_0x55db7e[_0x6937('0x42')]);_0x341fb9[_0x6937('0x44')]=_[_0x6937('0x46')](_0x341fb9['model'],_0x341fb9[_0x6937('0x42')]);_0x2fd206[_0x6937('0x45')]=_[_0x6937('0x46')](_0x341fb9[_0x6937('0x41')],qs[_0x6937('0x47')](_0x55db7e[_0x6937('0x42')][_0x6937('0x47')]));_0x2fd206['attributes']=_0x2fd206[_0x6937('0x45')][_0x6937('0x48')]?_0x2fd206[_0x6937('0x45')]:_0x341fb9['model'];if(!_0x55db7e['query'][_0x6937('0x49')](_0x6937('0x4a'))){_0x2fd206[_0x6937('0x2f')]=qs[_0x6937('0x2f')](_0x55db7e[_0x6937('0x42')]['limit']);_0x2fd206[_0x6937('0x2e')]=qs[_0x6937('0x2e')](_0x55db7e['query']['offset']);}_0x2fd206[_0x6937('0x4b')]=qs[_0x6937('0x4c')](_0x55db7e[_0x6937('0x42')][_0x6937('0x4c')]);_0x2fd206[_0x6937('0x4d')]=qs[_0x6937('0x44')](_['pick'](_0x55db7e[_0x6937('0x42')],_0x341fb9[_0x6937('0x44')]));_0x2fd206[_0x6937('0x4d')][_0x6937('0x66')]=_0x4546a1['id'];if(_0x55db7e[_0x6937('0x42')][_0x6937('0x4f')]){_0x2fd206[_0x6937('0x4d')]=_[_0x6937('0x50')](_0x2fd206[_0x6937('0x4d')],{'$or':_[_0x6937('0x3d')](_0x2fd206[_0x6937('0x45')],function(_0x6f5079){var _0x5eccfa={};_0x5eccfa[_0x6f5079]={'$like':'%'+_0x55db7e[_0x6937('0x42')][_0x6937('0x4f')]+'%'};return _0x5eccfa;})});}_0x2fd206=_[_0x6937('0x50')]({},_0x2fd206,_0x55db7e['options']);return db['ChatOfflineMessage'][_0x6937('0x2d')]({'where':_0x2fd206['where']})['then'](function(_0x539275){_0x12ea9c[_0x6937('0x2d')]=_0x539275;if(_0x55db7e[_0x6937('0x42')][_0x6937('0x51')]){_0x2fd206[_0x6937('0x6c')]=[{'all':!![]}];}else{_0x2fd206['include']=[{'model':db['CmContact'],'as':_0x6937('0xe8'),'required':![]}];}return db[_0x6937('0xd3')]['findAll'](_0x2fd206);})['then'](function(_0xd697de){_0x12ea9c[_0x6937('0x53')]=_0xd697de;return _0x12ea9c;});}})[_0x6937('0x34')](respondWithFilteredResult(_0x18b7e8,_0x2fd206))[_0x6937('0x28')](handleError(_0x18b7e8,null));};exports[_0x6937('0x113')]=function(_0x1d47d5,_0x192f23,_0x441c75){return db['ChatWebsite'][_0x6937('0x5d')]({'where':{'id':_0x1d47d5[_0x6937('0x55')]['id']}})[_0x6937('0x34')](handleEntityNotFound(_0x192f23,null))[_0x6937('0x34')](function(_0x282773){if(_0x282773){return _0x282773[_0x6937('0x113')](_0x1d47d5[_0x6937('0x61')][_0x6937('0x68')],_[_0x6937('0xe6')](_0x1d47d5[_0x6937('0x61')],[_0x6937('0x68'),'id'])||{})[_0x6937('0x114')](function(_0x1d52e7){for(var _0x587b3a=0x0;_0x587b3a<_0x1d47d5['body'][_0x6937('0x68')][_0x6937('0x48')];_0x587b3a+=0x1){socket[_0x6937('0x115')](_0x6937('0x116'),{'UserId':_0x1d47d5[_0x6937('0x61')][_0x6937('0x68')][_0x587b3a],'ChatWebsiteId':_0x1d47d5[_0x6937('0x55')]['id']});}return _0x1d52e7;});}})[_0x6937('0x34')](respondWithResult(_0x192f23,null))[_0x6937('0x28')](handleError(_0x192f23,null));};exports[_0x6937('0x117')]=function(_0x8f3324,_0x2bdd25,_0x4c4bc5){return db[_0x6937('0x3e')][_0x6937('0x5d')]({'where':{'id':_0x8f3324[_0x6937('0x55')]['id']}})['then'](handleEntityNotFound(_0x2bdd25,null))[_0x6937('0x34')](function(_0x42b39f){if(_0x42b39f){return _0x42b39f['removeAgents'](_0x8f3324[_0x6937('0x42')][_0x6937('0x68')])[_0x6937('0x34')](function(){if(_[_0x6937('0x118')](_0x8f3324[_0x6937('0x42')][_0x6937('0x68')])){for(var _0x59a3df=0x0;_0x59a3df<_0x8f3324['query'][_0x6937('0x68')]['length'];_0x59a3df+=0x1){socket['emit'](_0x6937('0x119'),{'UserId':Number(_0x8f3324[_0x6937('0x42')][_0x6937('0x68')][_0x59a3df]),'ChatWebsiteId':Number(_0x8f3324[_0x6937('0x55')]['id'])});}}else{socket['emit'](_0x6937('0x119'),{'UserId':Number(_0x8f3324[_0x6937('0x42')][_0x6937('0x68')]),'ChatWebsiteId':Number(_0x8f3324[_0x6937('0x55')]['id'])});}});}})[_0x6937('0x34')](respondWithStatusCode(_0x2bdd25,null))['catch'](handleError(_0x2bdd25,null));};exports[_0x6937('0x11a')]=function(_0x59d8cb,_0x51104f,_0x3ac83e){var _0x939a6={};var _0x44d103={};var _0x1de72f;var _0x13c8ac;return db[_0x6937('0x3e')]['findOne']({'where':{'id':_0x59d8cb[_0x6937('0x55')]['id']}})['then'](handleEntityNotFound(_0x51104f,null))['then'](function(_0x47043c){if(_0x47043c){_0x1de72f=_0x47043c;_0x44d103['model']=_[_0x6937('0x43')](db[_0x6937('0xc4')][_0x6937('0x3f')]);_0x44d103[_0x6937('0x42')]=_[_0x6937('0x43')](_0x59d8cb[_0x6937('0x42')]);_0x44d103[_0x6937('0x44')]=_[_0x6937('0x46')](_0x44d103[_0x6937('0x41')],_0x44d103[_0x6937('0x42')]);_0x939a6[_0x6937('0x45')]=_[_0x6937('0x46')](_0x44d103[_0x6937('0x41')],qs[_0x6937('0x47')](_0x59d8cb['query'][_0x6937('0x47')]));_0x939a6['attributes']=_0x939a6[_0x6937('0x45')][_0x6937('0x48')]?_0x939a6['attributes']:_0x44d103[_0x6937('0x41')];_0x939a6['order']=qs['sort'](_0x59d8cb[_0x6937('0x42')][_0x6937('0x4c')]);_0x939a6['where']=qs[_0x6937('0x44')](_[_0x6937('0x4e')](_0x59d8cb[_0x6937('0x42')],_0x44d103['filters']));if(_0x59d8cb[_0x6937('0x42')][_0x6937('0x4f')]){_0x939a6[_0x6937('0x4d')]=_[_0x6937('0x50')](_0x939a6[_0x6937('0x4d')],{'$or':_['map'](_0x939a6[_0x6937('0x45')],function(_0xe4d3e1){var _0x107ff7={};_0x107ff7[_0xe4d3e1]={'$like':'%'+_0x59d8cb['query'][_0x6937('0x4f')]+'%'};return _0x107ff7;})});}_0x939a6=_[_0x6937('0x50')]({},_0x939a6,_0x59d8cb[_0x6937('0x56')]);return _0x1de72f['getAgents'](_0x939a6);}})[_0x6937('0x34')](function(_0x1abbe5){if(_0x1abbe5){_0x13c8ac=_0x1abbe5['length'];if(!_0x59d8cb[_0x6937('0x42')][_0x6937('0x49')](_0x6937('0x4a'))){_0x939a6[_0x6937('0x2f')]=qs[_0x6937('0x2f')](_0x59d8cb[_0x6937('0x42')][_0x6937('0x2f')]);_0x939a6['offset']=qs[_0x6937('0x2e')](_0x59d8cb[_0x6937('0x42')][_0x6937('0x2e')]);}return _0x1de72f['getAgents'](_0x939a6);}})[_0x6937('0x34')](function(_0x3a6270){if(_0x3a6270){return _0x3a6270?{'count':_0x13c8ac,'rows':_0x3a6270}:null;}})[_0x6937('0x34')](respondWithResult(_0x51104f,null))['catch'](handleError(_0x51104f,null));}; \ No newline at end of file +var _0x87f7=['DESC','ChatApplication','Applications','list','applications','orderBy','priority','asc','account','Contacts','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','firstName','lastName','messageId','created','autoclose','push','close','*,*,*,*','ChatMessage','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','offline','difference','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','render','toPairs','offlineMessageBody','MailAccount','MailServerOut','Smtp','service','host','port','authentication','auth','sendMail','\x22%s\x22\x20<%s>','omit','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','Command','timezone','interval','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','No\x20timezone','getSnippet','Interval','Intervals','getProactiveActions','License','increment','chatLicenseExceeded','some','readFileSync','server/files/chat/iframe.js','utf8','remote','x-real-ip','connection','remoteAddress','virtual','replace','textColor','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Contact','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','register','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','ChatWebsites','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','include','rows','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','ChatWebsiteId','Disposition','getDispositions','findOne','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','root','server/files/images/logos/','join','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','download','getSystemAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','CmContact','describe','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List'];(function(_0x3022d0,_0x23a64a){var _0x251a90=function(_0x4811d8){while(--_0x4811d8){_0x3022d0['push'](_0x3022d0['shift']());}};_0x251a90(++_0x23a64a);}(_0x87f7,0x7b));var _0x787f=function(_0x179615,_0x1ad062){_0x179615=_0x179615-0x0;var _0x5421b0=_0x87f7[_0x179615];return _0x5421b0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x787f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x787f('0x1'));var rp=require(_0x787f('0x2'));var moment=require('moment');var BPromise=require(_0x787f('0x3'));var Mustache=require(_0x787f('0x4'));var util=require(_0x787f('0x5'));var path=require(_0x787f('0x6'));var sox=require(_0x787f('0x7'));var csv=require(_0x787f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x787f('0x9'));var crypto=require('crypto');var jsforce=require(_0x787f('0xa'));var deskjs=require(_0x787f('0xb'));var toCsv=require(_0x787f('0x8'));var querystring=require(_0x787f('0xc'));var Papa=require(_0x787f('0xd'));var Redis=require(_0x787f('0xe'));var authService=require(_0x787f('0xf'));var qs=require(_0x787f('0x10'));var as=require(_0x787f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x787f('0x12'))(_0x787f('0x13'));var utils=require(_0x787f('0x14'));var config=require(_0x787f('0x15'));var licenseUtil=require(_0x787f('0x16'));var db=require(_0x787f('0x17'))['db'];config[_0x787f('0x18')]=_[_0x787f('0x19')](config[_0x787f('0x18')],{'host':_0x787f('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x787f('0x1b'))[_0x787f('0x1c')](socket);var jayson=require(_0x787f('0x1d'));var client=jayson[_0x787f('0x1e')][_0x787f('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x787f('0x1f')]({'port':0x232a});var client9003=jayson['client'][_0x787f('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0x54dd96,_0x1210cf,_0x50e3f7,_0x43a8bd){return new BPromise(function(_0x5c2a93,_0x258786){var _0x491941=_0x43a8bd||client;return _0x491941['request'](_0x54dd96,_0x50e3f7)[_0x787f('0x20')](function(_0x2369f7){logger[_0x787f('0x21')](_0x787f('0x22'),_0x1210cf,'request\x20sent');logger[_0x787f('0x23')](_0x787f('0x24'),_0x1210cf,_0x787f('0x25'),JSON[_0x787f('0x26')](_0x2369f7));if(_0x2369f7['error']){if(_0x2369f7[_0x787f('0x27')][_0x787f('0x28')]===0x1f4){logger[_0x787f('0x27')](_0x787f('0x22'),_0x1210cf,_0x2369f7[_0x787f('0x27')]['message']);return _0x258786(_0x2369f7[_0x787f('0x27')][_0x787f('0x29')]);}logger['error'](_0x787f('0x22'),_0x1210cf,_0x2369f7[_0x787f('0x27')][_0x787f('0x29')]);return _0x5c2a93(_0x2369f7['error'][_0x787f('0x29')]);}else{logger[_0x787f('0x21')]('ChatWebsite,\x20%s,\x20%s',_0x1210cf,_0x787f('0x25'));_0x5c2a93(_0x2369f7['result']['message']);}})[_0x787f('0x2a')](function(_0x49d92b){logger[_0x787f('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x1210cf,_0x49d92b);_0x258786(_0x49d92b);});});}function respondWithStatusCode(_0x20901b,_0x57a1d5){_0x57a1d5=_0x57a1d5||0xcc;return function(_0x3a1154){if(_0x3a1154){return _0x20901b[_0x787f('0x2b')](_0x57a1d5);}return _0x20901b[_0x787f('0x2c')](_0x57a1d5)[_0x787f('0x2d')]();};}function respondWithResult(_0x14ced5,_0x3e3647){_0x3e3647=_0x3e3647||0xc8;return function(_0x54b696){if(_0x54b696){return _0x14ced5[_0x787f('0x2c')](_0x3e3647)[_0x787f('0x2e')](_0x54b696);}};}function respondWithFilteredResult(_0x1c7ed3,_0x2de2d0){return function(_0x4880c1){if(_0x4880c1){var _0x331875=_0x4880c1[_0x787f('0x2f')],_0x3caa08=_0x2de2d0[_0x787f('0x30')],_0x2136f1=_0x2de2d0[_0x787f('0x30')]+_0x2de2d0[_0x787f('0x31')],_0x3362ec;if(_0x2136f1>=_0x331875){_0x2136f1=_0x331875;_0x3362ec=0xc8;}else{_0x3362ec=0xce;}_0x1c7ed3['status'](_0x3362ec);return _0x1c7ed3[_0x787f('0x32')](_0x787f('0x33'),_0x3caa08+'-'+_0x2136f1+'/'+_0x331875)[_0x787f('0x2e')](_0x4880c1);}return null;};}function patchUpdates(_0xe9e276){return function(_0x78a2cb){try{jsonpatch[_0x787f('0x34')](_0x78a2cb,_0xe9e276,!![]);}catch(_0x3bab84){return BPromise[_0x787f('0x35')](_0x3bab84);}return _0x78a2cb[_0x787f('0x36')]();};}function saveUpdates(_0x14c1ac,_0x2d1965){return function(_0x9d9445){if(_0x9d9445){return _0x9d9445[_0x787f('0x37')](_0x14c1ac)[_0x787f('0x20')](function(_0x2406a7){return _0x2406a7;});}return null;};}function removeEntity(_0x2b8ca6,_0x218575){return function(_0x55f17a){if(_0x55f17a){return _0x55f17a['destroy']()[_0x787f('0x20')](function(){var _0x2e36d6=_0x55f17a['get']({'plain':!![]});var _0xf67fc3=_0x787f('0x38');return db['UserProfileResource']['destroy']({'where':{'type':_0xf67fc3,'resourceId':_0x2e36d6['id']}})[_0x787f('0x20')](function(){return _0x55f17a;});})[_0x787f('0x20')](function(){_0x2b8ca6[_0x787f('0x2c')](0xcc)[_0x787f('0x2d')]();});}};}function handleEntityNotFound(_0xfc32c8,_0x362f67){return function(_0x5b2562){if(!_0x5b2562){_0xfc32c8[_0x787f('0x2b')](0x194);}return _0x5b2562;};}function handleError(_0xa0f050,_0x93f990){_0x93f990=_0x93f990||0x1f4;return function(_0x553547){logger[_0x787f('0x27')](_0x553547[_0x787f('0x39')]);if(_0x553547[_0x787f('0x3a')]){delete _0x553547[_0x787f('0x3a')];}_0xa0f050[_0x787f('0x2c')](_0x93f990)[_0x787f('0x3b')](_0x553547);};}exports[_0x787f('0x3c')]=function(_0x390000,_0x3e46d3){var _0x68fb67={'include':[{'model':db[_0x787f('0x3d')],'as':_0x787f('0x3e')}]},_0x1049dd={},_0x1d7e54={'count':0x0,'rows':[]};var _0x5015de=_[_0x787f('0x3f')](db[_0x787f('0x40')][_0x787f('0x41')],function(_0x361937){return{'name':_0x361937['fieldName'],'type':_0x361937[_0x787f('0x42')][_0x787f('0x43')]};});_0x1049dd[_0x787f('0x44')]=_[_0x787f('0x3f')](_0x5015de,_0x787f('0x3a'));_0x1049dd['query']=_[_0x787f('0x45')](_0x390000[_0x787f('0x46')]);_0x1049dd['filters']=_['intersection'](_0x1049dd[_0x787f('0x44')],_0x1049dd[_0x787f('0x46')]);_0x68fb67[_0x787f('0x47')]=_[_0x787f('0x48')](_0x1049dd[_0x787f('0x44')],qs['fields'](_0x390000['query'][_0x787f('0x49')]));_0x68fb67[_0x787f('0x47')]=_0x68fb67[_0x787f('0x47')][_0x787f('0x4a')]?_0x68fb67[_0x787f('0x47')]:_0x1049dd[_0x787f('0x44')];if(!_0x390000['query'][_0x787f('0x4b')](_0x787f('0x4c'))){_0x68fb67['limit']=qs[_0x787f('0x31')](_0x390000['query'][_0x787f('0x31')]);_0x68fb67['offset']=qs[_0x787f('0x30')](_0x390000['query'][_0x787f('0x30')]);}_0x68fb67[_0x787f('0x4d')]=qs[_0x787f('0x4e')](_0x390000[_0x787f('0x46')][_0x787f('0x4e')]);_0x68fb67[_0x787f('0x4f')]=qs[_0x787f('0x50')](_['pick'](_0x390000[_0x787f('0x46')],_0x1049dd[_0x787f('0x50')]),_0x5015de);if(_0x390000[_0x787f('0x46')][_0x787f('0x51')]){_0x68fb67[_0x787f('0x4f')]=_[_0x787f('0x52')](_0x68fb67[_0x787f('0x4f')],{'$or':_[_0x787f('0x3f')](_0x5015de,function(_0x27d236){if(_0x27d236[_0x787f('0x42')]!=='VIRTUAL'){var _0x38babf={};_0x38babf[_0x27d236[_0x787f('0x3a')]]={'$like':'%'+_0x390000[_0x787f('0x46')][_0x787f('0x51')]+'%'};return _0x38babf;}})});}_0x68fb67=_['merge']({},_0x68fb67,_0x390000['options']);var _0x3a1ff7={'where':_0x68fb67[_0x787f('0x4f')]};return db[_0x787f('0x40')][_0x787f('0x2f')](_0x3a1ff7)[_0x787f('0x20')](function(_0xbe9f4){_0x1d7e54[_0x787f('0x2f')]=_0xbe9f4;if(_0x390000['query']['includeAll']){_0x68fb67[_0x787f('0x53')]=[{'all':!![]}];}return db[_0x787f('0x40')]['findAll'](_0x68fb67);})[_0x787f('0x20')](function(_0x364df8){_0x1d7e54[_0x787f('0x54')]=_0x364df8;return _0x1d7e54;})[_0x787f('0x20')](respondWithFilteredResult(_0x3e46d3,_0x68fb67))[_0x787f('0x2a')](handleError(_0x3e46d3,null));};exports[_0x787f('0x55')]=function(_0x305aaa,_0x537b57){var _0x508588={'raw':![],'where':{'id':_0x305aaa[_0x787f('0x56')]['id']},'include':[{'model':db[_0x787f('0x3d')],'as':_0x787f('0x3e')}]},_0x3df770={};_0x3df770[_0x787f('0x44')]=_[_0x787f('0x45')](db[_0x787f('0x40')][_0x787f('0x41')]);_0x3df770[_0x787f('0x46')]=_[_0x787f('0x45')](_0x305aaa['query']);_0x3df770[_0x787f('0x50')]=_[_0x787f('0x48')](_0x3df770[_0x787f('0x44')],_0x3df770[_0x787f('0x46')]);_0x508588[_0x787f('0x47')]=_[_0x787f('0x48')](_0x3df770[_0x787f('0x44')],qs['fields'](_0x305aaa[_0x787f('0x46')][_0x787f('0x49')]));_0x508588[_0x787f('0x47')]=_0x508588[_0x787f('0x47')]['length']?_0x508588[_0x787f('0x47')]:_0x3df770[_0x787f('0x44')];if(_0x305aaa[_0x787f('0x46')][_0x787f('0x57')]){_0x508588[_0x787f('0x53')]=[{'all':!![]}];}_0x508588=_[_0x787f('0x52')]({},_0x508588,_0x305aaa[_0x787f('0x58')]);return db[_0x787f('0x40')][_0x787f('0x59')](_0x508588)[_0x787f('0x20')](handleEntityNotFound(_0x537b57,null))[_0x787f('0x20')](respondWithResult(_0x537b57,null))[_0x787f('0x2a')](handleError(_0x537b57,null));};exports[_0x787f('0x5a')]=function(_0x161e0c,_0x3a5072){return db[_0x787f('0x40')]['create'](_0x161e0c[_0x787f('0x5b')],{})[_0x787f('0x20')](function(_0x410a81){var _0x18c871=_0x161e0c[_0x787f('0x5c')]['get']({'plain':!![]});if(!_0x18c871)throw new Error(_0x787f('0x5d'));if(_0x18c871[_0x787f('0x5e')]===_0x787f('0x5c')){var _0x595dce=_0x410a81[_0x787f('0x5f')]({'plain':!![]});var _0x50ad63=_0x787f('0x38');return db[_0x787f('0x60')][_0x787f('0x59')]({'where':{'name':_0x50ad63,'userProfileId':_0x18c871['userProfileId']},'raw':!![]})['then'](function(_0x29963a){if(_0x29963a&&_0x29963a[_0x787f('0x61')]===0x0){return db[_0x787f('0x62')][_0x787f('0x5a')]({'name':_0x595dce[_0x787f('0x3a')],'resourceId':_0x595dce['id'],'type':_0x29963a[_0x787f('0x3a')],'sectionId':_0x29963a['id']},{})['then'](function(){return _0x410a81;});}else{return _0x410a81;}})[_0x787f('0x2a')](function(_0xd884ed){logger[_0x787f('0x27')](_0x787f('0x63'),_0xd884ed);throw _0xd884ed;});}return _0x410a81;})[_0x787f('0x20')](respondWithResult(_0x3a5072,0xc9))['catch'](handleError(_0x3a5072,null));};exports['update']=function(_0x3fd99e,_0x4421f7){if(_0x3fd99e[_0x787f('0x5b')]['id']){delete _0x3fd99e[_0x787f('0x5b')]['id'];}return db[_0x787f('0x40')]['find']({'where':{'id':_0x3fd99e['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x787f('0x20')](handleEntityNotFound(_0x4421f7,null))['then'](saveUpdates(_0x3fd99e[_0x787f('0x5b')],null))[_0x787f('0x20')](respondWithResult(_0x4421f7,null))[_0x787f('0x2a')](handleError(_0x4421f7,null));};exports[_0x787f('0x64')]=function(_0x27bf34,_0x287b15){return db[_0x787f('0x40')][_0x787f('0x59')]({'where':{'id':_0x27bf34['params']['id']}})[_0x787f('0x20')](handleEntityNotFound(_0x287b15,null))[_0x787f('0x20')](removeEntity(_0x287b15,null))[_0x787f('0x2a')](handleError(_0x287b15,null));};exports['describe']=function(_0x5f001b,_0x335514){return db[_0x787f('0x40')]['describe']()[_0x787f('0x20')](respondWithResult(_0x335514,null))[_0x787f('0x2a')](handleError(_0x335514,null));};exports['addDisposition']=function(_0x32c39d,_0x1dca89,_0x5bd1b7){if(_0x32c39d[_0x787f('0x5b')]['id']){delete _0x32c39d[_0x787f('0x5b')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x32c39d[_0x787f('0x56')]['id']}})['then'](handleEntityNotFound(_0x1dca89,null))[_0x787f('0x20')](function(_0x59822d){if(_0x59822d){_0x32c39d[_0x787f('0x5b')][_0x787f('0x65')]=_0x59822d['id'];return db[_0x787f('0x66')]['create'](_0x32c39d[_0x787f('0x5b')]);}})['then'](respondWithResult(_0x1dca89,null))[_0x787f('0x2a')](handleError(_0x1dca89,null));};exports[_0x787f('0x67')]=function(_0x233f9f,_0x3bcb44,_0x27d11c){var _0x321b50={'raw':![],'where':{}};var _0x4f2b11={};var _0x16610c={'count':0x0,'rows':[]};return db[_0x787f('0x40')][_0x787f('0x68')]({'where':{'id':_0x233f9f[_0x787f('0x56')]['id']}})[_0x787f('0x20')](handleEntityNotFound(_0x3bcb44,null))['then'](function(_0x23b9b8){if(_0x23b9b8){_0x4f2b11[_0x787f('0x44')]=_[_0x787f('0x45')](db[_0x787f('0x66')][_0x787f('0x41')]);_0x4f2b11[_0x787f('0x46')]=_['keys'](_0x233f9f[_0x787f('0x46')]);_0x4f2b11[_0x787f('0x50')]=_[_0x787f('0x48')](_0x4f2b11['model'],_0x4f2b11[_0x787f('0x46')]);_0x321b50['attributes']=_[_0x787f('0x48')](_0x4f2b11[_0x787f('0x44')],qs['fields'](_0x233f9f[_0x787f('0x46')][_0x787f('0x49')]));_0x321b50[_0x787f('0x47')]=_0x321b50['attributes'][_0x787f('0x4a')]?_0x321b50[_0x787f('0x47')]:_0x4f2b11[_0x787f('0x44')];if(!_0x233f9f[_0x787f('0x46')][_0x787f('0x4b')](_0x787f('0x4c'))){_0x321b50[_0x787f('0x31')]=qs[_0x787f('0x31')](_0x233f9f['query'][_0x787f('0x31')]);_0x321b50[_0x787f('0x30')]=qs['offset'](_0x233f9f['query'][_0x787f('0x30')]);}_0x321b50[_0x787f('0x4d')]=qs[_0x787f('0x4e')](_0x233f9f[_0x787f('0x46')][_0x787f('0x4e')]);_0x321b50['where']=qs[_0x787f('0x50')](_[_0x787f('0x69')](_0x233f9f['query'],_0x4f2b11[_0x787f('0x50')]));_0x321b50[_0x787f('0x4f')][_0x787f('0x65')]=_0x23b9b8['id'];if(_0x233f9f[_0x787f('0x46')][_0x787f('0x51')]){_0x321b50[_0x787f('0x4f')]=_[_0x787f('0x52')](_0x321b50[_0x787f('0x4f')],{'$or':_[_0x787f('0x3f')](_0x321b50['attributes'],function(_0x2ef2d4){var _0x462942={};_0x462942[_0x2ef2d4]={'$like':'%'+_0x233f9f[_0x787f('0x46')][_0x787f('0x51')]+'%'};return _0x462942;})});}_0x321b50=_[_0x787f('0x52')]({},_0x321b50,_0x233f9f[_0x787f('0x58')]);return db[_0x787f('0x66')][_0x787f('0x2f')]({'where':_0x321b50[_0x787f('0x4f')]})[_0x787f('0x20')](function(_0x615b8d){_0x16610c[_0x787f('0x2f')]=_0x615b8d;if(_0x233f9f[_0x787f('0x46')][_0x787f('0x57')]){_0x321b50[_0x787f('0x53')]=[{'all':!![]}];}return db[_0x787f('0x66')][_0x787f('0x6a')](_0x321b50);})[_0x787f('0x20')](function(_0x2ef9db){_0x16610c[_0x787f('0x54')]=_0x2ef9db;return _0x16610c;});}})[_0x787f('0x20')](respondWithFilteredResult(_0x3bcb44,_0x321b50))['catch'](handleError(_0x3bcb44,null));};exports[_0x787f('0x6b')]=function(_0x5f035a,_0x391161,_0x1a4c4d){return db[_0x787f('0x40')][_0x787f('0x59')]({'where':{'id':_0x5f035a[_0x787f('0x56')]['id']}})[_0x787f('0x20')](handleEntityNotFound(_0x391161,null))['then'](function(_0x5b6d87){if(_0x5b6d87){return _0x5b6d87['removeDispositions'](_0x5f035a['query'][_0x787f('0x6c')]);}})[_0x787f('0x20')](respondWithStatusCode(_0x391161,null))[_0x787f('0x2a')](handleError(_0x391161,null));};exports[_0x787f('0x6d')]=function(_0x1c59ca,_0x449be0,_0x53541f){if(_0x1c59ca[_0x787f('0x5b')]['id']){delete _0x1c59ca[_0x787f('0x5b')]['id'];}return db[_0x787f('0x40')][_0x787f('0x59')]({'where':{'id':_0x1c59ca[_0x787f('0x56')]['id']}})['then'](handleEntityNotFound(_0x449be0,null))['then'](function(_0x1798f3){if(_0x1798f3){_0x1c59ca[_0x787f('0x5b')]['ChatWebsiteId']=_0x1798f3['id'];return db[_0x787f('0x6e')]['create'](_0x1c59ca['body']);}})['then'](respondWithResult(_0x449be0,null))[_0x787f('0x2a')](handleError(_0x449be0,null));};exports['getAnswers']=function(_0x5e9daf,_0x599ba6,_0x326fa8){var _0x1a335e={'raw':![],'where':{}};var _0x3dccfb={};var _0x55f616={'count':0x0,'rows':[]};return db[_0x787f('0x40')][_0x787f('0x68')]({'where':{'id':_0x5e9daf[_0x787f('0x56')]['id']}})[_0x787f('0x20')](handleEntityNotFound(_0x599ba6,null))[_0x787f('0x20')](function(_0x48809b){if(_0x48809b){_0x3dccfb[_0x787f('0x44')]=_['keys'](db[_0x787f('0x6e')][_0x787f('0x41')]);_0x3dccfb[_0x787f('0x46')]=_[_0x787f('0x45')](_0x5e9daf[_0x787f('0x46')]);_0x3dccfb[_0x787f('0x50')]=_['intersection'](_0x3dccfb['model'],_0x3dccfb['query']);_0x1a335e['attributes']=_[_0x787f('0x48')](_0x3dccfb[_0x787f('0x44')],qs[_0x787f('0x49')](_0x5e9daf[_0x787f('0x46')]['fields']));_0x1a335e['attributes']=_0x1a335e[_0x787f('0x47')][_0x787f('0x4a')]?_0x1a335e[_0x787f('0x47')]:_0x3dccfb[_0x787f('0x44')];if(!_0x5e9daf['query'][_0x787f('0x4b')](_0x787f('0x4c'))){_0x1a335e[_0x787f('0x31')]=qs[_0x787f('0x31')](_0x5e9daf['query'][_0x787f('0x31')]);_0x1a335e[_0x787f('0x30')]=qs[_0x787f('0x30')](_0x5e9daf[_0x787f('0x46')][_0x787f('0x30')]);}_0x1a335e[_0x787f('0x4d')]=qs['sort'](_0x5e9daf[_0x787f('0x46')][_0x787f('0x4e')]);_0x1a335e[_0x787f('0x4f')]=qs[_0x787f('0x50')](_[_0x787f('0x69')](_0x5e9daf['query'],_0x3dccfb[_0x787f('0x50')]));_0x1a335e[_0x787f('0x4f')][_0x787f('0x65')]=_0x48809b['id'];if(_0x5e9daf['query'][_0x787f('0x51')]){_0x1a335e[_0x787f('0x4f')]=_[_0x787f('0x52')](_0x1a335e['where'],{'$or':_['map'](_0x1a335e['attributes'],function(_0x15875e){var _0x28fd1d={};_0x28fd1d[_0x15875e]={'$like':'%'+_0x5e9daf[_0x787f('0x46')][_0x787f('0x51')]+'%'};return _0x28fd1d;})});}_0x1a335e=_[_0x787f('0x52')]({},_0x1a335e,_0x5e9daf[_0x787f('0x58')]);return db[_0x787f('0x6e')][_0x787f('0x2f')]({'where':_0x1a335e[_0x787f('0x4f')]})[_0x787f('0x20')](function(_0x51df20){_0x55f616[_0x787f('0x2f')]=_0x51df20;if(_0x5e9daf[_0x787f('0x46')][_0x787f('0x57')]){_0x1a335e[_0x787f('0x53')]=[{'all':!![]}];}return db[_0x787f('0x6e')][_0x787f('0x6a')](_0x1a335e);})[_0x787f('0x20')](function(_0x28dc9b){_0x55f616[_0x787f('0x54')]=_0x28dc9b;return _0x55f616;});}})[_0x787f('0x20')](respondWithFilteredResult(_0x599ba6,_0x1a335e))[_0x787f('0x2a')](handleError(_0x599ba6,null));};exports[_0x787f('0x6f')]=function(_0x5f1ac9,_0x3e0587,_0x29b750){return db['ChatWebsite'][_0x787f('0x59')]({'where':{'id':_0x5f1ac9['params']['id']}})[_0x787f('0x20')](handleEntityNotFound(_0x3e0587,null))[_0x787f('0x20')](function(_0x392fac){if(_0x392fac){return _0x392fac[_0x787f('0x6f')](_0x5f1ac9[_0x787f('0x46')][_0x787f('0x6c')]);}})[_0x787f('0x20')](respondWithStatusCode(_0x3e0587,null))[_0x787f('0x2a')](handleError(_0x3e0587,null));};exports['addLogo']=function(_0x5c48d8,_0x5c307e,_0xecb8c3){_0x5c48d8[_0x787f('0x5b')][_0x787f('0x70')]=_0x5c48d8[_0x787f('0x71')][_0x787f('0x72')];return db['ChatWebsite'][_0x787f('0x59')]({'where':{'id':_0x5c48d8['params']['id']}})['then'](handleEntityNotFound(_0x5c307e,null))['then'](saveUpdates(_0x5c48d8[_0x787f('0x5b')],null))[_0x787f('0x20')](respondWithResult(_0x5c307e,null))['catch'](handleError(_0x5c307e,null));};exports[_0x787f('0x73')]=function(_0x28ee94,_0x58be1c,_0x2f555f){_0x28ee94[_0x787f('0x5b')][_0x787f('0x74')]=_0x28ee94[_0x787f('0x71')][_0x787f('0x72')];return db[_0x787f('0x40')][_0x787f('0x59')]({'where':{'id':_0x28ee94['params']['id']}})[_0x787f('0x20')](handleEntityNotFound(_0x58be1c,null))[_0x787f('0x20')](saveUpdates(_0x28ee94[_0x787f('0x5b')],null))[_0x787f('0x20')](respondWithResult(_0x58be1c,null))['catch'](handleError(_0x58be1c,null));};exports[_0x787f('0x75')]=function(_0x4b2eec,_0xfac8aa,_0x21549f){_0x4b2eec['body'][_0x787f('0x76')]=_0x4b2eec[_0x787f('0x71')]['filename'];return db[_0x787f('0x40')]['find']({'where':{'id':_0x4b2eec[_0x787f('0x56')]['id']}})[_0x787f('0x20')](handleEntityNotFound(_0xfac8aa,null))['then'](saveUpdates(_0x4b2eec[_0x787f('0x5b')],null))['then'](respondWithResult(_0xfac8aa,null))['catch'](handleError(_0xfac8aa,null));};exports[_0x787f('0x77')]=function(_0x2dbd1c,_0x5ce312,_0x207ec2){_0x2dbd1c[_0x787f('0x5b')][_0x787f('0x78')]=_0x2dbd1c['file'][_0x787f('0x72')];return db[_0x787f('0x40')][_0x787f('0x59')]({'where':{'id':_0x2dbd1c[_0x787f('0x56')]['id']}})['then'](handleEntityNotFound(_0x5ce312,null))[_0x787f('0x20')](saveUpdates(_0x2dbd1c['body'],null))[_0x787f('0x20')](respondWithResult(_0x5ce312,null))[_0x787f('0x2a')](handleError(_0x5ce312,null));};exports[_0x787f('0x79')]=function(_0x22606b,_0x272f8d,_0x484434){var _0x1323de=path['join'](config['root'],_0x787f('0x7a'));var _0x457c6d={'where':{'id':_0x22606b[_0x787f('0x56')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x2018d3=![];return require('../../config/license/util')[_0x787f('0x7b')]()['then'](function(_0x355c12){if(_0x355c12){_0x2018d3=_0x355c12[_0x787f('0x7c')];}})['then'](function(){return db[_0x787f('0x40')]['find'](_0x457c6d);})[_0x787f('0x20')](handleEntityNotFound(_0x272f8d,null))[_0x787f('0x20')](function(_0x4ce8f3){if(_0x4ce8f3){if(!_[_0x787f('0x7d')](_0x4ce8f3[_0x787f('0x70')])){if(fs[_0x787f('0x7e')](path['join'](config[_0x787f('0x7f')],_0x787f('0x80'),_0x4ce8f3[_0x787f('0x70')]))&&_0x2018d3){_0x1323de=path[_0x787f('0x81')](config[_0x787f('0x7f')],'server/files/images/logos/',_0x4ce8f3[_0x787f('0x70')]);}}return _0x272f8d['download'](_0x1323de);}})[_0x787f('0x2a')](handleError(_0x272f8d,null));};exports[_0x787f('0x82')]=function(_0x1bf35f,_0x1c38b8,_0x13a45a){var _0x231bc6=path[_0x787f('0x81')](config['root'],_0x787f('0x83'));var _0xc6181f={'where':{'id':_0x1bf35f[_0x787f('0x56')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x787f('0x40')][_0x787f('0x59')](_0xc6181f)[_0x787f('0x20')](handleEntityNotFound(_0x1c38b8,null))[_0x787f('0x20')](function(_0x51e020){if(_0x51e020){if(!_[_0x787f('0x7d')](_0x51e020['agentAvatar'])){if(fs[_0x787f('0x7e')](path[_0x787f('0x81')](config[_0x787f('0x7f')],'server/files/images/avatars/',_0x51e020['agentAvatar']))){_0x231bc6=path['join'](config[_0x787f('0x7f')],_0x787f('0x84'),_0x51e020[_0x787f('0x74')]);}}return _0x1c38b8['download'](_0x231bc6);}})[_0x787f('0x2a')](handleError(_0x1c38b8,null));};exports[_0x787f('0x85')]=function(_0x102a64,_0x10120a,_0x18c8bd){var _0x1e820c=path[_0x787f('0x81')](config['root'],_0x787f('0x86'));var _0x164e1d={'where':{'id':_0x102a64['params']['id']},'attributes':['id',_0x787f('0x76'),_0x787f('0x87')],'raw':!![]};return db[_0x787f('0x40')][_0x787f('0x59')](_0x164e1d)[_0x787f('0x20')](handleEntityNotFound(_0x10120a,null))['then'](function(_0x27cd4a){if(_0x27cd4a){if(!_[_0x787f('0x7d')](_0x27cd4a[_0x787f('0x76')])){if(fs['existsSync'](path[_0x787f('0x81')](config['root'],_0x787f('0x84'),_0x27cd4a[_0x787f('0x76')]))&&_0x27cd4a[_0x787f('0x87')]){_0x1e820c=path[_0x787f('0x81')](config[_0x787f('0x7f')],_0x787f('0x84'),_0x27cd4a['customerAvatar']);}}return _0x10120a[_0x787f('0x88')](_0x1e820c);}})['catch'](handleError(_0x10120a,null));};exports[_0x787f('0x89')]=function(_0x536f1b,_0x5d0603,_0x34c825){var _0xb101ec=path[_0x787f('0x81')](config[_0x787f('0x7f')],'server/files/images/avatars/system_avatar.png');var _0x1002d9={'where':{'id':_0x536f1b[_0x787f('0x56')]['id']},'attributes':['id',_0x787f('0x78')],'raw':!![]};return db[_0x787f('0x40')][_0x787f('0x59')](_0x1002d9)[_0x787f('0x20')](handleEntityNotFound(_0x5d0603,null))[_0x787f('0x20')](function(_0x1dd212){if(_0x1dd212){if(!_['isNil'](_0x1dd212[_0x787f('0x78')])){if(fs[_0x787f('0x7e')](path['join'](config[_0x787f('0x7f')],_0x787f('0x84'),_0x1dd212[_0x787f('0x78')]))){_0xb101ec=path[_0x787f('0x81')](config[_0x787f('0x7f')],_0x787f('0x84'),_0x1dd212['systemAvatar']);}}return _0x5d0603[_0x787f('0x88')](_0xb101ec);}})[_0x787f('0x2a')](handleError(_0x5d0603,null));};exports[_0x787f('0x8a')]=function(_0x4cbe85,_0x118106,_0x2f8570){var _0x544704=require(_0x787f('0x8b'));var _0x9a5580=new _0x544704();var _0x183f94=_0x9a5580[_0x787f('0x8c')](_0x4cbe85[_0x787f('0x8d')][_0x787f('0x8e')])[_0x787f('0x8f')]();var _0x46ba19={'body':_0x4cbe85[_0x787f('0x5b')],'channel':'chat'};var _0x129c0d=[];var _0x340170=[];var _0xe335e={};var _0x299877=![];return db[_0x787f('0x90')][_0x787f('0x91')]()[_0x787f('0x20')](function(_0xbd3964){if(!_0xbd3964){throw new db[(_0x787f('0x92'))]['ValidationError'](_0x787f('0x93'));}_0x129c0d=_['difference'](_[_0x787f('0x45')](_0xbd3964),[_0x787f('0x94'),'updatedAt']);_0x340170=_['difference'](_[_0x787f('0x45')](_0xbd3964),[_0x787f('0x94'),_0x787f('0x95'),_0x787f('0x96'),_0x787f('0x97')]);if(_0x4cbe85[_0x787f('0x5b')]['id']){delete _0x4cbe85[_0x787f('0x5b')]['id'];}if(_[_0x787f('0x7d')](_0x4cbe85[_0x787f('0x5b')][_0x787f('0x98')])){throw new db[(_0x787f('0x92'))][(_0x787f('0x99'))]('from\x20is\x20mandatory');}if(_[_0x787f('0x7d')](_0x4cbe85[_0x787f('0x5b')][_0x787f('0x5b')])||_0x4cbe85[_0x787f('0x5b')][_0x787f('0x5b')]===''){throw new db[(_0x787f('0x92'))][(_0x787f('0x99'))](_0x787f('0x9a'));}if(_['isNil'](_0x4cbe85[_0x787f('0x5b')][_0x787f('0x9b')])){throw new db['Sequelize'][(_0x787f('0x99'))](_0x787f('0x9c')+_0x340170);}if(!_[_0x787f('0x9d')](_0x340170,_0x4cbe85[_0x787f('0x5b')]['mapKey'])){throw new db[(_0x787f('0x92'))][(_0x787f('0x99'))](_0x787f('0x9e')+_0x340170);}_0xe335e[_0x4cbe85[_0x787f('0x5b')][_0x787f('0x9b')]]=_0x4cbe85['body'][_0x787f('0x98')];})[_0x787f('0x20')](function(){return db[_0x787f('0x40')][_0x787f('0x59')]({'where':{'id':_0x4cbe85[_0x787f('0x56')]['id']},'include':[{'model':db[_0x787f('0x9f')],'as':_0x787f('0xa0'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0xe335e,'limit':0x1,'order':[[_0x787f('0x95'),_0x787f('0xa1')]]}]},{'model':db[_0x787f('0xa2')],'as':_0x787f('0xa3')}]});})['then'](handleEntityNotFound(_0x118106,null))['then'](function(_0x438260){if(_0x438260&&_0x438260['List']){_0x46ba19['account']=_0x438260;_0x46ba19['applications']=_0x438260['Applications'];_0x46ba19[_0x787f('0xa4')]=_0x438260[_0x787f('0xa0')];_0x46ba19[_0x787f('0xa5')]=_[_0x787f('0xa6')](_0x46ba19[_0x787f('0xa5')],[_0x787f('0xa7')],[_0x787f('0xa8')]);if(_0x46ba19[_0x787f('0xa9')][_0x787f('0xa3')]){delete _0x46ba19[_0x787f('0xa9')]['Applications'];}if(_0x46ba19[_0x787f('0xa9')][_0x787f('0xa0')]&&_0x46ba19[_0x787f('0xa9')]['List']['Contacts']['length']){return _0x46ba19[_0x787f('0xa9')][_0x787f('0xa0')][_0x787f('0xaa')][0x0];}var _0x250bbb=_[_0x787f('0x19')](_0x4cbe85['body'],{'firstName':_0x4cbe85[_0x787f('0x5b')][_0x787f('0x98')],'ListId':_0x438260[_0x787f('0x97')]});_0x250bbb[_0x4cbe85[_0x787f('0x5b')][_0x787f('0x9b')]]=_0x4cbe85[_0x787f('0x5b')][_0x787f('0x98')];return db[_0x787f('0x90')][_0x787f('0x5a')](_0x250bbb,{'fields':_0x129c0d,'raw':!![]});}})[_0x787f('0x20')](handleEntityNotFound(_0x118106,null))['then'](function(_0x3cb422){_0x46ba19[_0x787f('0xab')]=_0x3cb422;var _0x4306dc=_0x4cbe85['body'][_0x787f('0xac')];if(_0x4cbe85[_0x787f('0x8d')][_0x787f('0xad')]){_0x4306dc=_0x4cbe85['headers'][_0x787f('0xad')];}else if(_0x4cbe85[_0x787f('0x8d')][_0x787f('0xae')]){_0x4306dc=_[_0x787f('0xaf')](_0x4cbe85['headers'][_0x787f('0xae')]['split'](','));}if(_0x3cb422){var _0x3f6434={'ContactId':_0x3cb422['id'],'ChatWebsiteId':_0x4cbe85[_0x787f('0x56')]['id'],'from':(_0x3cb422['firstName']||'')+'\x20'+(_0x3cb422['lastName']||''),'customerIp':_0x4306dc,'customerPort':_0x4cbe85['headers'][_0x787f('0xb0')]?_0x4cbe85[_0x787f('0x8d')]['x-real-port']:null,'referer':_0x4cbe85[_0x787f('0x5b')][_0x787f('0xb1')],'browserName':_0x183f94[_0x787f('0xb2')][_0x787f('0x3a')]&&_0x183f94['browser'][_0x787f('0xb3')]?util[_0x787f('0xb4')]('%s\x20%s',_0x183f94['browser'][_0x787f('0x3a')],_0x183f94[_0x787f('0xb2')][_0x787f('0xb3')]):_0x787f('0xb5'),'browserVersion':_0x183f94[_0x787f('0xb2')][_0x787f('0xb3')]||'unknown','osName':util[_0x787f('0xb4')](_0x787f('0xb6'),_0x183f94['os'][_0x787f('0x3a')],_0x183f94['os'][_0x787f('0xb3')]),'osVersion':_0x183f94['os'][_0x787f('0xb3')],'deviceModel':_0x183f94[_0x787f('0xb7')]['model']&&_0x183f94['device'][_0x787f('0xb8')]?util[_0x787f('0xb4')](_0x787f('0xb9'),_0x183f94['device'][_0x787f('0x44')],_0x183f94['device'][_0x787f('0xb8')],_0x183f94[_0x787f('0xb7')]['type']):null,'deviceVendor':_0x183f94[_0x787f('0xb7')][_0x787f('0xb8')],'deviceType':_0x183f94['device'][_0x787f('0x42')],'formData':JSON[_0x787f('0x26')](_0x4cbe85[_0x787f('0x5b')])};var _0x268b10={'ChatWebsiteId':_0x4cbe85['params']['id'],'closed':![]};if(_0x4cbe85['body'][_0x787f('0xba')]){_0x268b10[_0x787f('0xba')]=_0x4cbe85[_0x787f('0x5b')]['threadId'];return db[_0x787f('0xbb')]['find']({'where':_0x268b10})[_0x787f('0x20')](function(_0x500c6e){if(_0x500c6e){return[_0x500c6e,![]];}_0x3f6434[_0x787f('0xba')]=_0x4cbe85[_0x787f('0x5b')][_0x787f('0xba')];_0x3f6434[_0x787f('0xbc')]=_0x4cbe85[_0x787f('0x5b')]['externalUrl'];return db[_0x787f('0xbb')][_0x787f('0x5a')](_0x3f6434)[_0x787f('0x20')](function(_0x400948){return[_0x400948,!![]];});});}_0x268b10[_0x787f('0xbd')]=_0x3cb422['id'];if(_0x4cbe85[_0x787f('0x5b')][_0x787f('0xbe')]&&_0x4cbe85[_0x787f('0x5b')][_0x787f('0xbe')]['id']){_0x268b10['id']=_0x4cbe85[_0x787f('0x5b')][_0x787f('0xbe')]['id'];return db[_0x787f('0xbb')]['find']({'where':_0x268b10})[_0x787f('0x20')](function(_0x177fb9){if(_0x177fb9){return[_0x177fb9,![]];}return db[_0x787f('0xbb')]['create'](_0x3f6434)[_0x787f('0x20')](function(_0x3c705a){return[_0x3c705a,!![]];});});}return db[_0x787f('0xbb')][_0x787f('0x5a')](_0x3f6434)[_0x787f('0x20')](function(_0x3890d7){return[_0x3890d7,!![]];});}})['spread'](function(_0x3c5c09,_0x432ba0){if(_0x3c5c09){_0x299877=_0x432ba0;if(!_0x432ba0){var _0x35b008={'from':(_0x46ba19[_0x787f('0xab')][_0x787f('0xbf')]||'')+'\x20'+(_0x46ba19['contact'][_0x787f('0xc0')]||'')};if(_0x4cbe85['body']['threadId']&&_0x4cbe85[_0x787f('0x5b')][_0x787f('0xc1')]&&_0x4cbe85[_0x787f('0x5b')]['threadId']!=_0x4cbe85['body']['messageId']){_0x35b008[_0x787f('0xba')]=_0x4cbe85[_0x787f('0x5b')][_0x787f('0xc1')];}return _0x3c5c09['update'](_0x35b008);}else{return _0x3c5c09;}}})[_0x787f('0x20')](function(_0x2e7f13){_0x46ba19[_0x787f('0xbe')]=_0x2e7f13[_0x787f('0x5f')]({'plain':!![]});_0x46ba19[_0x787f('0xbe')][_0x787f('0xc2')]=_0x299877;if(_0x46ba19[_0x787f('0xbe')][_0x787f('0xc2')]){if(_0x46ba19['account'][_0x787f('0xc3')]){_0x46ba19[_0x787f('0xa5')][_0x787f('0xc4')]({'id':0x0,'priority':_0x46ba19[_0x787f('0xa5')][_0x787f('0x4a')]+0x1,'app':_0x787f('0xc5'),'appdata':'unmanaged','interval':_0x787f('0xc6')});}}return db[_0x787f('0xc7')][_0x787f('0x5a')]({'body':_0x4cbe85[_0x787f('0x5b')][_0x787f('0x5b')],'ChatWebsiteId':_0x4cbe85[_0x787f('0x56')]['id'],'ChatInteractionId':_0x2e7f13['id'],'direction':'in','ContactId':_0x46ba19[_0x787f('0xab')]['id'],'AttachmentId':_0x4cbe85[_0x787f('0x5b')]['AttachmentId']});})[_0x787f('0x20')](function(_0x13b41c){_0x46ba19[_0x787f('0x29')]=_0x13b41c;if(_0x46ba19[_0x787f('0xbe')][_0x787f('0xc8')]){return db[_0x787f('0xc9')]['find']({'attributes':['id','name'],'where':{'id':_0x46ba19['interaction'][_0x787f('0xc8')]}})[_0x787f('0x20')](function(_0x5b3999){if(_0x5b3999){_0x46ba19[_0x787f('0xa5')][_0x787f('0xca')]({'id':0x0,'priority':0x0,'app':_0x787f('0xcb'),'appdata':_0x5b3999[_0x787f('0x3a')]+','+(_0x46ba19[_0x787f('0xa9')]['waitForTheAssignedAgent']||0xa),'interval':_0x787f('0xc6')});_0x46ba19[_0x787f('0xcc')]=!![];}return respondWithRpcPromise(_0x787f('0xcd'),'startRouting',_0x46ba19);});}return respondWithRpcPromise('Start',_0x787f('0xce'),_0x46ba19);})[_0x787f('0x20')](function(_0x16c28c){respondWithRpcPromise('EventManager','EventManager',{'event':'notify','message':_0x16c28c},client9002);return _0x16c28c;})[_0x787f('0x20')](respondWithResult(_0x118106,null))[_0x787f('0x2a')](handleError(_0x118106,null));};exports[_0x787f('0xcf')]=function(_0xa94c37,_0xce0d53,_0x2f131f){var _0x277124,_0x2db8c3,_0xf319f9;var _0x405f51=[];var _0x268099=[];var _0xcc8bb1={};return db[_0x787f('0x90')]['describe']()[_0x787f('0x20')](function(_0x4130f6){if(!_0x4130f6){throw new db[(_0x787f('0x92'))]['ValidationError']('no\x20available\x20attributes');}_0x268099=_[_0x787f('0xd0')](_['keys'](_0x4130f6),[_0x787f('0x94'),_0x787f('0x95')]);_0x405f51=_[_0x787f('0xd0')](_[_0x787f('0x45')](_0x4130f6),[_0x787f('0x94'),'updatedAt',_0x787f('0x96'),_0x787f('0x97')]);if(_0xa94c37[_0x787f('0x5b')]['id']){delete _0xa94c37['body']['id'];}if(_[_0x787f('0x7d')](_0xa94c37[_0x787f('0x5b')][_0x787f('0x98')])){throw _0xce0d53[_0x787f('0x2c')](0x1f4)[_0x787f('0x3b')](new db['Sequelize'][(_0x787f('0x99'))](_0x787f('0xd1')));}if(_[_0x787f('0x7d')](_0xa94c37[_0x787f('0x5b')][_0x787f('0x5b')])||_0xa94c37[_0x787f('0x5b')][_0x787f('0x5b')]===''){throw _0xce0d53['status'](0x1f4)['send'](new db[(_0x787f('0x92'))]['ValidationError'](_0x787f('0x9a')));}if(_[_0x787f('0x7d')](_0xa94c37[_0x787f('0x5b')][_0x787f('0xd2')])){throw _0xce0d53[_0x787f('0x2c')](0x1f4)[_0x787f('0x3b')](new db[(_0x787f('0x92'))][(_0x787f('0x99'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x405f51));}if(!_[_0x787f('0x9d')](_0x405f51,_0xa94c37[_0x787f('0x5b')]['mapKeyOffline'])){throw _0xce0d53[_0x787f('0x2c')](0x1f4)[_0x787f('0x3b')](new db['Sequelize'][(_0x787f('0x99'))](_0x787f('0xd3')+_0x405f51));}_0xcc8bb1[_0xa94c37[_0x787f('0x5b')]['mapKeyOffline']]=_0xa94c37[_0x787f('0x5b')][_0x787f('0x98')];})['then'](function(){return db[_0x787f('0x40')][_0x787f('0x59')]({'where':{'id':_0xa94c37[_0x787f('0x56')]['id']},'include':[{'model':db[_0x787f('0x9f')],'as':_0x787f('0xa0')}]});})[_0x787f('0x20')](handleEntityNotFound(_0xce0d53,null))[_0x787f('0x20')](function(_0x45fd26){if(_0x45fd26&&_0x45fd26[_0x787f('0xa0')]){_0x2db8c3=_0x45fd26;var _0x31531d=_[_0x787f('0x19')](_0xa94c37['body'],{'firstName':_0xa94c37[_0x787f('0x5b')][_0x787f('0x98')],'phone':_0xa94c37[_0x787f('0x5b')][_0x787f('0x98')],'ListId':_0x45fd26[_0x787f('0x97')]});_0x31531d[_0xa94c37[_0x787f('0x5b')][_0x787f('0xd2')]]=_0xa94c37[_0x787f('0x5b')]['from'];return db[_0x787f('0x90')][_0x787f('0xd4')]({'where':_0xcc8bb1,'defaults':_0x31531d});}})['spread'](function(_0x4ba0d3){if(_0x4ba0d3){_0xf319f9=_0x4ba0d3;var _0xac716a=fs['readFileSync'](path['join'](config['root'],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x42ed46=ejs[_0x787f('0xd5')](_0xac716a,{'body':_[_0x787f('0xd6')](_0xa94c37['body'][_0x787f('0x5b')]),'bodyTitle':_0x2db8c3[_0x787f('0xd7')]});return db['ChatOfflineMessage']['create']({'body':_0x42ed46,'ContactId':_0x4ba0d3['id'],'ChatWebsiteId':_0x2db8c3['id']});}})[_0x787f('0x20')](function(_0x5575a8){if(_0x5575a8){_0x277124=_0x5575a8;return db[_0x787f('0xd8')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x787f('0xd9')],'as':_0x787f('0xda'),'raw':!![]}]});}})['then'](function(_0x30f8d1){if(_0x30f8d1&&_0x30f8d1[_0x787f('0xda')]&&_0x2db8c3['forwardOfflineAddress']){var _0x11fab6={'tls':{'rejectUnauthorized':![]}};if(_0x30f8d1[_0x787f('0xda')][_0x787f('0xdb')]){_0x11fab6['service']=_0x30f8d1['Smtp'][_0x787f('0xdb')];}else{_0x11fab6[_0x787f('0xdc')]=_0x30f8d1[_0x787f('0xda')]['host'];_0x11fab6[_0x787f('0xdd')]=_0x30f8d1[_0x787f('0xda')][_0x787f('0xdd')];_0x11fab6['secure']=_0x30f8d1[_0x787f('0xda')]['secure'];}if(_0x30f8d1[_0x787f('0xda')][_0x787f('0xde')]){_0x11fab6[_0x787f('0xdf')]={'user':_0x30f8d1[_0x787f('0xda')]['user'],'pass':_0x30f8d1[_0x787f('0xda')]['pass']};}return respondWithRpcPromise('SendMail',_0x787f('0xe0'),{'account':_0x11fab6,'message':{'from':util[_0x787f('0xb4')](_0x787f('0xe1'),_0x30f8d1[_0x787f('0x3a')],_0x30f8d1['email']||_0x30f8d1['Smtp'][_0x787f('0x5c')]),'to':_0x2db8c3['forwardOfflineAddress'],'subject':_0x2db8c3['offlineMessageSubject'],'text':_0x277124[_0x787f('0x5b')]}},client9003)[_0x787f('0x20')](function(){return _0x277124;})[_0x787f('0x2a')](function(_0x319e2a){console[_0x787f('0x27')](_0x319e2a);});}})[_0x787f('0x20')](function(){if(_0x277124){return _0x277124;}})[_0x787f('0x20')](respondWithResult(_0xce0d53,null))[_0x787f('0x2a')](handleError(_0xce0d53,null));};exports['addInteraction']=function(_0x44c652,_0x1cc0e7,_0x3ee4a4){return db[_0x787f('0xbb')]['find']({'where':{'id':_0x44c652[_0x787f('0x56')]['id']}})['then'](handleEntityNotFound(_0x1cc0e7,null))[_0x787f('0x20')](function(_0x161a13){if(_0x161a13){return _0x161a13['addInteraction'](_0x44c652[_0x787f('0x5b')]['ids'],_[_0x787f('0xe2')](_0x44c652['body'],['ids','id'])||{});}})[_0x787f('0x20')](respondWithResult(_0x1cc0e7,null))['catch'](handleError(_0x1cc0e7,null));};exports[_0x787f('0xe3')]=function(_0x3c52bf,_0x384b92,_0x33f605){var _0x4bb0d2={'raw':![],'where':{}};var _0xf96f62={};var _0x23bca7={'count':0x0,'rows':[]};return db[_0x787f('0x40')][_0x787f('0x68')]({'where':{'id':_0x3c52bf[_0x787f('0x56')]['id']}})[_0x787f('0x20')](handleEntityNotFound(_0x384b92,null))[_0x787f('0x20')](function(_0x4d423f){if(_0x4d423f){_0xf96f62[_0x787f('0x44')]=_['keys'](db[_0x787f('0xbb')][_0x787f('0x41')]);_0xf96f62[_0x787f('0x46')]=_['keys'](_0x3c52bf['query']);_0xf96f62['filters']=_['intersection'](_0xf96f62[_0x787f('0x44')],_0xf96f62['query']);_0x4bb0d2[_0x787f('0x47')]=_[_0x787f('0x48')](_0xf96f62[_0x787f('0x44')],qs['fields'](_0x3c52bf['query']['fields']));_0x4bb0d2[_0x787f('0x47')]=_0x4bb0d2['attributes'][_0x787f('0x4a')]?_0x4bb0d2[_0x787f('0x47')]:_0xf96f62['model'];if(!_0x3c52bf[_0x787f('0x46')]['hasOwnProperty'](_0x787f('0x4c'))){_0x4bb0d2[_0x787f('0x31')]=qs[_0x787f('0x31')](_0x3c52bf[_0x787f('0x46')][_0x787f('0x31')]);_0x4bb0d2[_0x787f('0x30')]=qs[_0x787f('0x30')](_0x3c52bf[_0x787f('0x46')][_0x787f('0x30')]);}_0x4bb0d2[_0x787f('0x4d')]=qs[_0x787f('0x4e')](_0x3c52bf['query']['sort']);_0x4bb0d2['where']=qs['filters'](_['pick'](_0x3c52bf[_0x787f('0x46')],_0xf96f62[_0x787f('0x50')]));_0x4bb0d2[_0x787f('0x4f')][_0x787f('0x65')]=_0x4d423f['id'];if(_0x3c52bf[_0x787f('0x46')][_0x787f('0x51')]){_0x4bb0d2[_0x787f('0x4f')]=_[_0x787f('0x52')](_0x4bb0d2[_0x787f('0x4f')],{'$or':_['map'](_0x4bb0d2[_0x787f('0x47')],function(_0x16a5cb){var _0x431ca6={};_0x431ca6[_0x16a5cb]={'$like':'%'+_0x3c52bf[_0x787f('0x46')]['filter']+'%'};return _0x431ca6;})});}_0x4bb0d2=_[_0x787f('0x52')]({},_0x4bb0d2,_0x3c52bf[_0x787f('0x58')]);return db[_0x787f('0xbb')][_0x787f('0x2f')]({'where':_0x4bb0d2[_0x787f('0x4f')]})[_0x787f('0x20')](function(_0x196c05){_0x23bca7[_0x787f('0x2f')]=_0x196c05;if(_0x3c52bf[_0x787f('0x46')][_0x787f('0x57')]){_0x4bb0d2[_0x787f('0x53')]=[{'model':db[_0x787f('0x90')],'as':'Contact','required':![]},{'model':db[_0x787f('0xc9')],'as':_0x787f('0xe4'),'attributes':['name',_0x787f('0xe5'),_0x787f('0xe6')],'required':![]},{'model':db[_0x787f('0xe7')],'as':_0x787f('0xe8'),'attributes':['id',_0x787f('0x3a'),_0x787f('0xe9')],'where':_0x3c52bf[_0x787f('0x46')][_0x787f('0xea')]?{'id':_0x3c52bf['query'][_0x787f('0xea')]}:undefined,'required':_0x3c52bf[_0x787f('0x46')][_0x787f('0xea')]?!![]:![]}];}return db[_0x787f('0xbb')][_0x787f('0x6a')](_0x4bb0d2);})[_0x787f('0x20')](function(_0x5861b6){_0x23bca7[_0x787f('0x54')]=_0x5861b6;return _0x23bca7;});}})[_0x787f('0x20')](respondWithFilteredResult(_0x384b92,_0x4bb0d2))[_0x787f('0x2a')](handleError(_0x384b92,null));};function iftimePromise(_0x4c67f5,_0x378df3){return respondWithRpcPromise(_0x787f('0xeb'),'getSnippet',{'command':_0x378df3[_0x787f('0xec')]?util[_0x787f('0xb4')]('iftime\x20%s,%s',_0x4c67f5[_0x787f('0xed')],_0x378df3[_0x787f('0xec')]):util[_0x787f('0xb4')](_0x787f('0xee'),_0x4c67f5[_0x787f('0xed')])},client9002)[_0x787f('0x20')](function(_0x1980d9){var _0x242545=_0x1980d9&&_0x1980d9[_0x787f('0xef')]('true')>=0x0?!![]:![];logger['info'](_0x787f('0xf0'),_0x378df3['id'],_0x4c67f5['id'],_0x4c67f5['interval'],_0x242545?'ONLINE':'OFFLINE',_0x378df3['timezone']?_0x378df3[_0x787f('0xec')]:_0x787f('0xf1'));return _0x242545;})['catch'](function(_0x21cbf7){logger['error'](_0x787f('0xf0'),_0x378df3['id'],_0x4c67f5['id'],_0x4c67f5[_0x787f('0xed')],util['inspect'](_0x21cbf7,{'showHidden':![],'depth':null}),_0x378df3['timezone']?_0x378df3['timezone']:'No\x20timezone');return![];});}exports[_0x787f('0xf2')]=function(_0x4dc319,_0x75505f,_0x404dea){var _0x305d07=0x0;var _0x18a179=0x0;var _0x44f461=![];var _0x3cf83d;var _0x1fbf1d;return db[_0x787f('0x40')][_0x787f('0x59')]({'where':{'id':_0x4dc319[_0x787f('0x56')]['id']},'include':[{'model':db[_0x787f('0xf3')],'as':_0x787f('0xf3'),'include':[{'model':db['Interval'],'as':_0x787f('0xf4'),'attributes':['id',_0x787f('0xed')],'raw':!![]}]}]})[_0x787f('0x20')](handleEntityNotFound(_0x75505f,null))['then'](function(_0x151cfb){if(_0x151cfb){_0x3cf83d=_0x151cfb;return _0x151cfb[_0x787f('0xf5')]({'raw':!![]});}})[_0x787f('0x20')](function(_0x47f90a){if(_0x3cf83d){if(_0x47f90a){_0x1fbf1d=_0x47f90a;}}return require(_0x787f('0x16'))[_0x787f('0x7b')]();})[_0x787f('0x20')](function(_0x408719){if(_0x408719){_0x18a179=_0x408719['virtual'];_0x44f461=_0x408719[_0x787f('0x7c')];}})[_0x787f('0x20')](function(){return db['ChatInteraction'][_0x787f('0x2f')]({'where':{'closed':![]}});})[_0x787f('0x20')](function(_0xe3a95c){_0x305d07=_0xe3a95c;if(_0x18a179&&_0xe3a95c>_0x18a179){return db[_0x787f('0xf6')][_0x787f('0x68')]({'where':{'id':0x1}})[_0x787f('0x20')](function(_0x270775){if(_0x270775){_0x270775[_0x787f('0xf7')](_0x787f('0xf8'));}});}})['then'](function(){if(_0x3cf83d[_0x787f('0xf3')]&&_0x3cf83d['Interval']['Intervals']){var _0x59f090=[];for(var _0xe95b57=0x0;_0xe95b57<_0x3cf83d['Interval'][_0x787f('0xf4')][_0x787f('0x4a')];_0xe95b57++){var _0x495a47=_0x3cf83d[_0x787f('0xf3')][_0x787f('0xf4')][_0xe95b57]['get']({'plain':!![]});_0x59f090[_0x787f('0xc4')](iftimePromise(_0x495a47,_0x3cf83d));}return BPromise['all'](_0x59f090)['then'](function(_0x3c2733){return _[_0x787f('0xf9')](_0x3c2733);});}else{return!![];}})['then'](function(_0x45651d){var _0x229bf2=fs[_0x787f('0xfa')](path[_0x787f('0x81')](config[_0x787f('0x7f')],_0x787f('0xfb')),_0x787f('0xfc'));var _0x45d607={'remote':_0x3cf83d[_0x787f('0xfd')],'query':querystring['stringify'](_[_0x787f('0x52')](_0x3cf83d[_0x787f('0x5f')]({'plain':!![]}),{'customerIp':_0x4dc319[_0x787f('0x8d')][_0x787f('0xae')]||_0x4dc319[_0x787f('0x8d')][_0x787f('0xfe')]||_0x4dc319[_0x787f('0xff')][_0x787f('0x100')]||_0x4dc319['ip'],'referer':_0x4dc319['headers'][_0x787f('0xb1')],'openedInteractions':_0x305d07,'maxInteractions':_0x18a179,'virtual':_0x44f461[_0x787f('0x101')],'online':_0x45651d,'custom':_0x44f461}))[_0x787f('0x102')](/'/g,'\x5c\x27')};_0x75505f[_0x787f('0x3b')](ejs[_0x787f('0xd5')](Mustache[_0x787f('0xd5')](_0x229bf2,_0x45d607),{'proactiveActions':_0x1fbf1d,'alignment':_0x3cf83d['alignment'],'verticalAlignment':_0x3cf83d['verticalAlignment'],'div_color':_0x3cf83d['color'],'text_color':_0x3cf83d[_0x787f('0x103')]}));})[_0x787f('0x2a')](handleError(_0x75505f,null));};exports['addApplications']=function(_0x2a5edc,_0x5d0829,_0x175339){return db['ChatWebsite'][_0x787f('0x68')]({'where':{'id':_0x2a5edc[_0x787f('0x56')]['id']}})['then'](handleEntityNotFound(_0x5d0829,null))[_0x787f('0x20')](function(_0x385d99){if(_0x385d99){return db[_0x787f('0x104')][_0x787f('0x105')](function(_0x503445){return db[_0x787f('0xa2')][_0x787f('0x64')]({'where':{'ChatWebsiteId':_0x2a5edc[_0x787f('0x56')]['id']},'transaction':_0x503445})[_0x787f('0x20')](function(_0xd3a41e){var _0x56f658=_[_0x787f('0x3f')](_0x2a5edc[_0x787f('0x5b')],function(_0x402ca5){_0x402ca5[_0x787f('0x65')]=_0x2a5edc[_0x787f('0x56')]['id'];return _0x402ca5;});return db[_0x787f('0xa2')][_0x787f('0x106')](_0x56f658,{'transaction':_0x503445});});})[_0x787f('0x20')](function(){return db[_0x787f('0xa2')][_0x787f('0x107')]({'where':{'ChatWebsiteId':_0x2a5edc[_0x787f('0x56')]['id']},'order':_0x787f('0xa7')});});}})['then'](respondWithResult(_0x5d0829,null))[_0x787f('0x2a')](handleError(_0x5d0829,null));};exports[_0x787f('0x108')]=function(_0x3895f3,_0xcc2cfc,_0x57c274){var _0x2d9686={};var _0x212120={};var _0x35e7f4;var _0x2d63c9;return db['ChatWebsite'][_0x787f('0x68')]({'where':{'id':_0x3895f3[_0x787f('0x56')]['id']}})[_0x787f('0x20')](handleEntityNotFound(_0xcc2cfc,null))[_0x787f('0x20')](function(_0x29b006){if(_0x29b006){_0x35e7f4=_0x29b006;_0x212120[_0x787f('0x44')]=_[_0x787f('0x45')](db[_0x787f('0xa2')][_0x787f('0x41')]);_0x212120[_0x787f('0x46')]=_[_0x787f('0x45')](_0x3895f3['query']);_0x212120[_0x787f('0x50')]=_[_0x787f('0x48')](_0x212120['model'],_0x212120[_0x787f('0x46')]);_0x2d9686['attributes']=_['intersection'](_0x212120[_0x787f('0x44')],qs[_0x787f('0x49')](_0x3895f3[_0x787f('0x46')][_0x787f('0x49')]));_0x2d9686[_0x787f('0x47')]=_0x2d9686[_0x787f('0x47')][_0x787f('0x4a')]?_0x2d9686['attributes']:_0x212120[_0x787f('0x44')];_0x2d9686['order']=qs[_0x787f('0x4e')](_0x3895f3[_0x787f('0x46')][_0x787f('0x4e')]);_0x2d9686[_0x787f('0x4f')]=qs[_0x787f('0x50')](_['pick'](_0x3895f3[_0x787f('0x46')],_0x212120['filters']));if(_0x3895f3[_0x787f('0x46')][_0x787f('0x51')]){_0x2d9686[_0x787f('0x4f')]=_[_0x787f('0x52')](_0x2d9686[_0x787f('0x4f')],{'$or':_[_0x787f('0x3f')](_0x2d9686[_0x787f('0x47')],function(_0x25d83d){var _0x4860bf={};_0x4860bf[_0x25d83d]={'$like':'%'+_0x3895f3[_0x787f('0x46')][_0x787f('0x51')]+'%'};return _0x4860bf;})});}_0x2d9686=_[_0x787f('0x52')]({},_0x2d9686,_0x3895f3[_0x787f('0x58')]);return _0x35e7f4[_0x787f('0x108')](_0x2d9686);}})[_0x787f('0x20')](function(_0x41f5c2){if(_0x41f5c2){_0x2d63c9=_0x41f5c2[_0x787f('0x4a')];if(!_0x3895f3[_0x787f('0x46')]['hasOwnProperty'](_0x787f('0x4c'))){_0x2d9686[_0x787f('0x31')]=qs[_0x787f('0x31')](_0x3895f3[_0x787f('0x46')][_0x787f('0x31')]);_0x2d9686['offset']=qs[_0x787f('0x30')](_0x3895f3['query'][_0x787f('0x30')]);}return _0x35e7f4[_0x787f('0x108')](_0x2d9686);}})['then'](function(_0x343e3b){if(_0x343e3b){return _0x343e3b?{'count':_0x2d63c9,'rows':_0x343e3b}:null;}})[_0x787f('0x20')](respondWithResult(_0xcc2cfc,null))[_0x787f('0x2a')](handleError(_0xcc2cfc,null));};exports[_0x787f('0x109')]=function(_0x69da45,_0x16fe0e,_0x23dae3){return db[_0x787f('0x10a')]['find']({'where':{'id':_0x69da45[_0x787f('0x56')]['id']}})[_0x787f('0x20')](handleEntityNotFound(_0x16fe0e,null))[_0x787f('0x20')](function(_0x182136){if(_0x182136){return _0x182136[_0x787f('0x109')](_0x69da45[_0x787f('0x5b')][_0x787f('0x6c')],_['omit'](_0x69da45[_0x787f('0x5b')],[_0x787f('0x6c'),'id'])||{});}})[_0x787f('0x20')](respondWithResult(_0x16fe0e,null))['catch'](handleError(_0x16fe0e,null));};exports['getProactiveActions']=function(_0x371a25,_0x21cc66,_0x458a3b){var _0x1e0b93={};var _0x411a98={};var _0x377ffb;var _0x4fe86f;return db[_0x787f('0x40')][_0x787f('0x68')]({'where':{'id':_0x371a25[_0x787f('0x56')]['id']}})[_0x787f('0x20')](handleEntityNotFound(_0x21cc66,null))[_0x787f('0x20')](function(_0x540b75){if(_0x540b75){_0x377ffb=_0x540b75;_0x411a98[_0x787f('0x44')]=_['keys'](db['ChatProactiveAction'][_0x787f('0x41')]);_0x411a98[_0x787f('0x46')]=_[_0x787f('0x45')](_0x371a25[_0x787f('0x46')]);_0x411a98[_0x787f('0x50')]=_[_0x787f('0x48')](_0x411a98[_0x787f('0x44')],_0x411a98[_0x787f('0x46')]);_0x1e0b93[_0x787f('0x47')]=_['intersection'](_0x411a98[_0x787f('0x44')],qs['fields'](_0x371a25[_0x787f('0x46')]['fields']));_0x1e0b93[_0x787f('0x47')]=_0x1e0b93['attributes']['length']?_0x1e0b93[_0x787f('0x47')]:_0x411a98[_0x787f('0x44')];_0x1e0b93[_0x787f('0x4d')]=qs[_0x787f('0x4e')](_0x371a25[_0x787f('0x46')][_0x787f('0x4e')]);_0x1e0b93['where']=qs[_0x787f('0x50')](_['pick'](_0x371a25[_0x787f('0x46')],_0x411a98[_0x787f('0x50')]));if(_0x371a25[_0x787f('0x46')][_0x787f('0x51')]){_0x1e0b93['where']=_[_0x787f('0x52')](_0x1e0b93['where'],{'$or':_['map'](_0x1e0b93['attributes'],function(_0x3663f0){var _0x2bd3d0={};_0x2bd3d0[_0x3663f0]={'$like':'%'+_0x371a25['query'][_0x787f('0x51')]+'%'};return _0x2bd3d0;})});}_0x1e0b93=_[_0x787f('0x52')]({},_0x1e0b93,_0x371a25['options']);return _0x377ffb[_0x787f('0xf5')](_0x1e0b93);}})[_0x787f('0x20')](function(_0x13ca9d){if(_0x13ca9d){_0x4fe86f=_0x13ca9d[_0x787f('0x4a')];if(!_0x371a25[_0x787f('0x46')][_0x787f('0x4b')](_0x787f('0x4c'))){_0x1e0b93[_0x787f('0x31')]=qs[_0x787f('0x31')](_0x371a25[_0x787f('0x46')][_0x787f('0x31')]);_0x1e0b93[_0x787f('0x30')]=qs[_0x787f('0x30')](_0x371a25[_0x787f('0x46')][_0x787f('0x30')]);}return _0x377ffb[_0x787f('0xf5')](_0x1e0b93);}})[_0x787f('0x20')](function(_0x23d2c2){if(_0x23d2c2){return _0x23d2c2?{'count':_0x4fe86f,'rows':_0x23d2c2}:null;}})[_0x787f('0x20')](respondWithResult(_0x21cc66,null))[_0x787f('0x2a')](handleError(_0x21cc66,null));};exports[_0x787f('0x10b')]=function(_0x17d3fd,_0x21300a,_0x2a33a6){var _0x19d60c=_0x17d3fd[_0x787f('0x46')]['online']===_0x787f('0x10c')?_0x787f('0x10d'):_0x787f('0x10e');return db[_0x787f('0x40')]['find']({'attributes':['id',_0x19d60c],'where':{'id':_0x17d3fd[_0x787f('0x56')]['id']}})[_0x787f('0x20')](handleEntityNotFound(_0x21300a,null))[_0x787f('0x20')](function(_0xb9c3d2){if(_0xb9c3d2){var _0x26cc33=_0xb9c3d2[_0x19d60c];var _0x24ff04=_0x26cc33&&_0x26cc33[_0x787f('0x10f')]?_0x26cc33[_0x787f('0x10f')]:[];_0x21300a[_0x787f('0x3b')]({'fromKey':_[_0x787f('0x7d')](_0x26cc33[_0x787f('0x110')])?undefined:_0x26cc33[_0x787f('0x110')],'count':_0x24ff04[_0x787f('0x4a')],'rows':_0x24ff04});}})[_0x787f('0x2a')](handleError(_0x21300a,null));};exports[_0x787f('0x111')]=function(_0x2061df,_0x3c01fa,_0x541fe3){var _0x10dbcd={'raw':![],'where':{}};var _0x45e552={};var _0x47d000={'count':0x0,'rows':[]};return db[_0x787f('0x40')][_0x787f('0x68')]({'where':{'id':_0x2061df[_0x787f('0x56')]['id']}})['then'](handleEntityNotFound(_0x3c01fa,null))[_0x787f('0x20')](function(_0x39bdd7){if(_0x39bdd7){_0x45e552[_0x787f('0x44')]=_[_0x787f('0x45')](db['ChatOfflineMessage'][_0x787f('0x41')]);_0x45e552['query']=_[_0x787f('0x45')](_0x2061df[_0x787f('0x46')]);_0x45e552[_0x787f('0x50')]=_[_0x787f('0x48')](_0x45e552['model'],_0x45e552[_0x787f('0x46')]);_0x10dbcd[_0x787f('0x47')]=_['intersection'](_0x45e552[_0x787f('0x44')],qs['fields'](_0x2061df[_0x787f('0x46')][_0x787f('0x49')]));_0x10dbcd['attributes']=_0x10dbcd[_0x787f('0x47')][_0x787f('0x4a')]?_0x10dbcd[_0x787f('0x47')]:_0x45e552[_0x787f('0x44')];if(!_0x2061df['query'][_0x787f('0x4b')](_0x787f('0x4c'))){_0x10dbcd[_0x787f('0x31')]=qs[_0x787f('0x31')](_0x2061df['query']['limit']);_0x10dbcd[_0x787f('0x30')]=qs[_0x787f('0x30')](_0x2061df[_0x787f('0x46')][_0x787f('0x30')]);}_0x10dbcd['order']=qs[_0x787f('0x4e')](_0x2061df[_0x787f('0x46')]['sort']);_0x10dbcd[_0x787f('0x4f')]=qs['filters'](_[_0x787f('0x69')](_0x2061df[_0x787f('0x46')],_0x45e552[_0x787f('0x50')]));_0x10dbcd['where'][_0x787f('0x65')]=_0x39bdd7['id'];if(_0x2061df[_0x787f('0x46')][_0x787f('0x51')]){_0x10dbcd[_0x787f('0x4f')]=_[_0x787f('0x52')](_0x10dbcd[_0x787f('0x4f')],{'$or':_[_0x787f('0x3f')](_0x10dbcd[_0x787f('0x47')],function(_0x226d26){var _0x870946={};_0x870946[_0x226d26]={'$like':'%'+_0x2061df['query'][_0x787f('0x51')]+'%'};return _0x870946;})});}_0x10dbcd=_[_0x787f('0x52')]({},_0x10dbcd,_0x2061df[_0x787f('0x58')]);return db[_0x787f('0x112')]['count']({'where':_0x10dbcd[_0x787f('0x4f')]})['then'](function(_0x7271d){_0x47d000['count']=_0x7271d;if(_0x2061df[_0x787f('0x46')][_0x787f('0x57')]){_0x10dbcd[_0x787f('0x53')]=[{'all':!![]}];}else{_0x10dbcd[_0x787f('0x53')]=[{'model':db[_0x787f('0x90')],'as':_0x787f('0x113'),'required':![]}];}return db[_0x787f('0x112')]['findAll'](_0x10dbcd);})[_0x787f('0x20')](function(_0x5d2a21){_0x47d000['rows']=_0x5d2a21;return _0x47d000;});}})['then'](respondWithFilteredResult(_0x3c01fa,_0x10dbcd))[_0x787f('0x2a')](handleError(_0x3c01fa,null));};exports[_0x787f('0x114')]=function(_0xd5bf68,_0x444368,_0x289a27){return db[_0x787f('0x40')][_0x787f('0x59')]({'where':{'id':_0xd5bf68['params']['id']}})[_0x787f('0x20')](handleEntityNotFound(_0x444368,null))[_0x787f('0x20')](function(_0x1664e3){if(_0x1664e3){return _0x1664e3[_0x787f('0x114')](_0xd5bf68[_0x787f('0x5b')][_0x787f('0x6c')],_[_0x787f('0xe2')](_0xd5bf68['body'],[_0x787f('0x6c'),'id'])||{})[_0x787f('0x115')](function(_0x4e4f75){for(var _0x1a1ec8=0x0;_0x1a1ec8<_0xd5bf68[_0x787f('0x5b')]['ids'][_0x787f('0x4a')];_0x1a1ec8+=0x1){socket[_0x787f('0x116')](_0x787f('0x117'),{'UserId':_0xd5bf68['body'][_0x787f('0x6c')][_0x1a1ec8],'ChatWebsiteId':_0xd5bf68[_0x787f('0x56')]['id']});}return _0x4e4f75;});}})[_0x787f('0x20')](respondWithResult(_0x444368,null))[_0x787f('0x2a')](handleError(_0x444368,null));};exports[_0x787f('0x118')]=function(_0x4e108b,_0x43c243,_0x508108){return db[_0x787f('0x40')][_0x787f('0x59')]({'where':{'id':_0x4e108b[_0x787f('0x56')]['id']}})[_0x787f('0x20')](handleEntityNotFound(_0x43c243,null))['then'](function(_0x565cc7){if(_0x565cc7){return _0x565cc7[_0x787f('0x118')](_0x4e108b['query'][_0x787f('0x6c')])[_0x787f('0x20')](function(){if(_[_0x787f('0x119')](_0x4e108b[_0x787f('0x46')][_0x787f('0x6c')])){for(var _0x51fe91=0x0;_0x51fe91<_0x4e108b[_0x787f('0x46')][_0x787f('0x6c')][_0x787f('0x4a')];_0x51fe91+=0x1){socket[_0x787f('0x116')](_0x787f('0x11a'),{'UserId':Number(_0x4e108b[_0x787f('0x46')]['ids'][_0x51fe91]),'ChatWebsiteId':Number(_0x4e108b[_0x787f('0x56')]['id'])});}}else{socket[_0x787f('0x116')](_0x787f('0x11a'),{'UserId':Number(_0x4e108b[_0x787f('0x46')][_0x787f('0x6c')]),'ChatWebsiteId':Number(_0x4e108b[_0x787f('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x43c243,null))[_0x787f('0x2a')](handleError(_0x43c243,null));};exports[_0x787f('0x11b')]=function(_0x3a570b,_0x128473,_0x1c5504){var _0x485871={};var _0x43f740={};var _0x42e288;var _0x1de35b;return db['ChatWebsite'][_0x787f('0x68')]({'where':{'id':_0x3a570b[_0x787f('0x56')]['id']}})[_0x787f('0x20')](handleEntityNotFound(_0x128473,null))[_0x787f('0x20')](function(_0x271005){if(_0x271005){_0x42e288=_0x271005;_0x43f740['model']=_[_0x787f('0x45')](db['User']['rawAttributes']);_0x43f740['query']=_[_0x787f('0x45')](_0x3a570b[_0x787f('0x46')]);_0x43f740[_0x787f('0x50')]=_['intersection'](_0x43f740['model'],_0x43f740['query']);_0x485871[_0x787f('0x47')]=_['intersection'](_0x43f740['model'],qs[_0x787f('0x49')](_0x3a570b[_0x787f('0x46')][_0x787f('0x49')]));_0x485871[_0x787f('0x47')]=_0x485871[_0x787f('0x47')][_0x787f('0x4a')]?_0x485871[_0x787f('0x47')]:_0x43f740[_0x787f('0x44')];_0x485871['order']=qs[_0x787f('0x4e')](_0x3a570b[_0x787f('0x46')][_0x787f('0x4e')]);_0x485871[_0x787f('0x4f')]=qs[_0x787f('0x50')](_[_0x787f('0x69')](_0x3a570b[_0x787f('0x46')],_0x43f740[_0x787f('0x50')]));if(_0x3a570b[_0x787f('0x46')][_0x787f('0x51')]){_0x485871[_0x787f('0x4f')]=_['merge'](_0x485871[_0x787f('0x4f')],{'$or':_[_0x787f('0x3f')](_0x485871[_0x787f('0x47')],function(_0x136753){var _0x5a3bd8={};_0x5a3bd8[_0x136753]={'$like':'%'+_0x3a570b['query']['filter']+'%'};return _0x5a3bd8;})});}_0x485871=_['merge']({},_0x485871,_0x3a570b[_0x787f('0x58')]);return _0x42e288[_0x787f('0x11b')](_0x485871);}})[_0x787f('0x20')](function(_0x4f4ce9){if(_0x4f4ce9){_0x1de35b=_0x4f4ce9[_0x787f('0x4a')];if(!_0x3a570b['query'][_0x787f('0x4b')](_0x787f('0x4c'))){_0x485871[_0x787f('0x31')]=qs['limit'](_0x3a570b['query']['limit']);_0x485871[_0x787f('0x30')]=qs['offset'](_0x3a570b['query'][_0x787f('0x30')]);}return _0x42e288[_0x787f('0x11b')](_0x485871);}})[_0x787f('0x20')](function(_0x2a28e1){if(_0x2a28e1){return _0x2a28e1?{'count':_0x1de35b,'rows':_0x2a28e1}:null;}})['then'](respondWithResult(_0x128473,null))[_0x787f('0x2a')](handleError(_0x128473,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 2d5f92a..ce0e19f 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 _0x66d9=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','emit'];(function(_0x427a12,_0xebba1b){var _0x46c7fc=function(_0x2baad6){while(--_0x2baad6){_0x427a12['push'](_0x427a12['shift']());}};_0x46c7fc(++_0xebba1b);}(_0x66d9,0x1e9));var _0x966d=function(_0x2a5022,_0x25f7b7){_0x2a5022=_0x2a5022-0x0;var _0x45f5a5=_0x66d9[_0x2a5022];return _0x45f5a5;};'use strict';var EventEmitter=require(_0x966d('0x0'));var ChatWebsite=require(_0x966d('0x1'))['db'][_0x966d('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x966d('0x3')](0x0);var events={'afterCreate':_0x966d('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc9a88b){return function(_0x34a638,_0x4e120a,_0x581424){ChatWebsiteEvents['emit'](_0xc9a88b+':'+_0x34a638['id'],_0x34a638);ChatWebsiteEvents[_0x966d('0x5')](_0xc9a88b,_0x34a638);_0x581424(null);};}for(var e in events){if(events[_0x966d('0x6')](e)){var event=events[e];ChatWebsite[_0x966d('0x7')](e,emitEvent(event));}}module[_0x966d('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0xb458=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','update','remove'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xb458,0x103));var _0x8b45=function(_0x173d3d,_0x53b34c){_0x173d3d=_0x173d3d-0x0;var _0x5ec073=_0xb458[_0x173d3d];return _0x5ec073;};'use strict';var EventEmitter=require(_0x8b45('0x0'));var ChatWebsite=require(_0x8b45('0x1'))['db'][_0x8b45('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8b45('0x3'),'afterDestroy':_0x8b45('0x4')};function emitEvent(_0x141a44){return function(_0x13a8c6,_0x5d51e4,_0x333bc7){ChatWebsiteEvents['emit'](_0x141a44+':'+_0x13a8c6['id'],_0x13a8c6);ChatWebsiteEvents['emit'](_0x141a44,_0x13a8c6);_0x333bc7(null);};}for(var e in events){if(events[_0x8b45('0x5')](e)){var event=events[e];ChatWebsite[_0x8b45('0x6')](e,emitEvent(event));}}module[_0x8b45('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index b9ccc5d..796a19c 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 _0xd404=['util','api','moment','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','chat_websites','lodash'];(function(_0x7feb90,_0x28e700){var _0x3c5b33=function(_0x113cfa){while(--_0x113cfa){_0x7feb90['push'](_0x7feb90['shift']());}};_0x3c5b33(++_0x28e700);}(_0xd404,0x15b));var _0x4d40=function(_0xc9cd80,_0x478ec3){_0xc9cd80=_0xc9cd80-0x0;var _0x1ef492=_0xd404[_0xc9cd80];return _0x1ef492;};'use strict';var _=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var logger=require('../../config/logger')(_0x4d40('0x2'));var moment=require(_0x4d40('0x3'));var BPromise=require('bluebird');var rp=require(_0x4d40('0x4'));var fs=require('fs');var path=require(_0x4d40('0x5'));var rimraf=require(_0x4d40('0x6'));var config=require(_0x4d40('0x7'));var attributes=require(_0x4d40('0x8'));module[_0x4d40('0x9')]=function(_0xc2a9db,_0x24a237){return _0xc2a9db[_0x4d40('0xa')]('ChatWebsite',attributes,{'tableName':_0x4d40('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7a0=['path','rimraf','../../config/environment','exports','define','ChatWebsite','chat_websites','lodash','util','api','bluebird','request-promise'];(function(_0x5da0d9,_0x49ee54){var _0x4b6d2f=function(_0x9832cf){while(--_0x9832cf){_0x5da0d9['push'](_0x5da0d9['shift']());}};_0x4b6d2f(++_0x49ee54);}(_0xd7a0,0x163));var _0x0d7a=function(_0x48f42a,_0x564fea){_0x48f42a=_0x48f42a-0x0;var _0xe06e95=_0xd7a0[_0x48f42a];return _0xe06e95;};'use strict';var _=require(_0x0d7a('0x0'));var util=require(_0x0d7a('0x1'));var logger=require('../../config/logger')(_0x0d7a('0x2'));var moment=require('moment');var BPromise=require(_0x0d7a('0x3'));var rp=require(_0x0d7a('0x4'));var fs=require('fs');var path=require(_0x0d7a('0x5'));var rimraf=require(_0x0d7a('0x6'));var config=require(_0x0d7a('0x7'));var attributes=require('./chatWebsite.attributes');module[_0x0d7a('0x8')]=function(_0x37c000,_0x321114){return _0x37c000[_0x0d7a('0x9')](_0x0d7a('0xa'),attributes,{'tableName':_0x0d7a('0xb'),'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 f139267..5951cc0 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x2ef3,0xba));var _0x32ef=function(_0x37fc7b,_0x32d15c){_0x37fc7b=_0x37fc7b-0x0;var _0x413fdf=_0x2ef3[_0x37fc7b];return _0x413fdf;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});} \ No newline at end of file +var _0x2542=['register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket'];(function(_0x3846de,_0x1148c0){var _0x5ad648=function(_0x2c7a95){while(--_0x2c7a95){_0x3846de['push'](_0x3846de['shift']());}};_0x5ad648(++_0x1148c0);}(_0x2542,0x169));var _0x2254=function(_0x4c9c3a,_0x5401bf){_0x4c9c3a=_0x4c9c3a-0x0;var _0x37c0eb=_0x2542[_0x4c9c3a];return _0x37c0eb;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});config[_0x2254('0xb')]=_[_0x2254('0xc')](config[_0x2254('0xb')],{'host':_0x2254('0xd'),'port':0x18eb});var socket=require(_0x2254('0xe'))(new Redis(config[_0x2254('0xb')]));require(_0x2254('0xf'))[_0x2254('0x10')](socket);function respondWithRpcPromise(_0x1ae415,_0x38fb2b,_0x5b1ab9){return new BPromise(function(_0x336e14,_0x2655ea){return client[_0x2254('0x11')](_0x1ae415,_0x5b1ab9)[_0x2254('0x12')](function(_0x575d58){logger['info'](_0x2254('0x13'),_0x38fb2b,_0x2254('0x14'));logger[_0x2254('0x15')](_0x2254('0x16'),_0x38fb2b,_0x2254('0x14'),JSON[_0x2254('0x17')](_0x575d58));if(_0x575d58['error']){if(_0x575d58[_0x2254('0x18')][_0x2254('0x19')]===0x1f4){logger['error'](_0x2254('0x13'),_0x38fb2b,_0x575d58[_0x2254('0x18')][_0x2254('0x1a')]);return _0x2655ea(_0x575d58[_0x2254('0x18')][_0x2254('0x1a')]);}logger[_0x2254('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x38fb2b,_0x575d58[_0x2254('0x18')]['message']);return _0x336e14(_0x575d58[_0x2254('0x18')][_0x2254('0x1a')]);}else{logger[_0x2254('0x1b')](_0x2254('0x13'),_0x38fb2b,_0x2254('0x14'));_0x336e14(_0x575d58[_0x2254('0x1c')]['message']);}})['catch'](function(_0x5ec98d){logger[_0x2254('0x18')](_0x2254('0x13'),_0x38fb2b,_0x5ec98d);_0x2655ea(_0x5ec98d);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 35bbb33..8f17b53 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(_0x5ff464,_0x5038d7){var _0x347182=function(_0xeef52c){while(--_0xeef52c){_0x5ff464['push'](_0x5ff464['shift']());}};_0x347182(++_0x5038d7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3cafb1,_0x108175){_0x3cafb1=_0x3cafb1-0x0;var _0x1bb09c=_0x5f2f[_0x3cafb1];return _0x1bb09c;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x5aa023,_0x1cf1d2){var _0x31ceb5=function(_0x40f643){while(--_0x40f643){_0x5aa023['push'](_0x5aa023['shift']());}};_0x31ceb5(++_0x1cf1d2);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f6af9,_0x553094){_0x3f6af9=_0x3f6af9-0x0;var _0x6cc311=_0xb10b[_0x3f6af9];return _0x6cc311;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index aacc712..6c336a7 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 _0x6d50=['../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/:id','show','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','/:id/proactive_actions','getProactiveActions','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','file','addLogo','server/files/images/avatars/','originalname','single','addAvatar','/:id/customer_avatar','addCustomerAvatar','/:id/notify','addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','update','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x29b32a,_0x7eddac){var _0x521f25=function(_0x5a7781){while(--_0x5a7781){_0x29b32a['push'](_0x29b32a['shift']());}};_0x521f25(++_0x7eddac);}(_0x6d50,0xed));var _0x06d5=function(_0x9b507d,_0x229fdd){_0x9b507d=_0x9b507d-0x0;var _0x503ddc=_0x6d50[_0x9b507d];return _0x503ddc;};'use strict';var multer=require('multer');var util=require(_0x06d5('0x0'));var path=require(_0x06d5('0x1'));var timeout=require(_0x06d5('0x2'));var express=require(_0x06d5('0x3'));var router=express[_0x06d5('0x4')]();var auth=require(_0x06d5('0x5'));var interaction=require(_0x06d5('0x6'));var config=require(_0x06d5('0x7'));var controller=require(_0x06d5('0x8'));router[_0x06d5('0x9')]('/',auth[_0x06d5('0xa')](),controller[_0x06d5('0xb')]);router['get']('/describe',auth[_0x06d5('0xa')](),controller['describe']);router[_0x06d5('0x9')](_0x06d5('0xc'),auth['isAuthenticated'](),controller[_0x06d5('0xd')]);router[_0x06d5('0x9')]('/:id/dispositions',auth[_0x06d5('0xa')](),controller[_0x06d5('0xe')]);router[_0x06d5('0x9')](_0x06d5('0xf'),auth[_0x06d5('0xa')](),controller['getAnswers']);router['get'](_0x06d5('0x10'),controller[_0x06d5('0x11')]);router['get'](_0x06d5('0x12'),controller['getAvatar']);router[_0x06d5('0x9')]('/:id/customer_avatar',controller[_0x06d5('0x13')]);router[_0x06d5('0x9')](_0x06d5('0x14'),controller['getSystemAvatar']);router['get'](_0x06d5('0x15'),auth['isAuthenticated'](),controller[_0x06d5('0x16')]);router['get'](_0x06d5('0x17'),controller['getSnippet']);router[_0x06d5('0x9')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router['get'](_0x06d5('0x18'),auth['isAuthenticated'](),controller[_0x06d5('0x19')]);router[_0x06d5('0x9')]('/:id/fields',controller['getFields']);router[_0x06d5('0x9')]('/:id/offline_messages',auth[_0x06d5('0xa')](),controller[_0x06d5('0x1a')]);router['get'](_0x06d5('0x1b'),auth[_0x06d5('0xa')](),controller[_0x06d5('0x1c')]);router[_0x06d5('0x1d')]('/',auth[_0x06d5('0xa')](),controller[_0x06d5('0x1e')]);router[_0x06d5('0x1d')](_0x06d5('0x1f'),auth['isAuthenticated'](),controller[_0x06d5('0x20')]);router[_0x06d5('0x1d')](_0x06d5('0xf'),auth[_0x06d5('0xa')](),controller[_0x06d5('0x21')]);var upload=multer({'storage':multer[_0x06d5('0x22')]({'destination':function(_0x4e87cd,_0x1f82e4,_0x4b0b21){_0x4b0b21(null,path[_0x06d5('0x23')](config[_0x06d5('0x24')],_0x06d5('0x25')));},'filename':function(_0x561f9c,_0x67c6eb,_0x4a3a52){_0x4a3a52(null,util[_0x06d5('0x26')](_0x06d5('0x27'),Date[_0x06d5('0x28')](),_0x67c6eb['originalname']));}})});router[_0x06d5('0x1d')](_0x06d5('0x10'),upload['single'](_0x06d5('0x29')),controller[_0x06d5('0x2a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5b72ea,_0x57026a,_0x58f315){_0x58f315(null,path[_0x06d5('0x23')](config[_0x06d5('0x24')],_0x06d5('0x2b')));},'filename':function(_0x456855,_0x1cd186,_0x1c3471){_0x1c3471(null,util[_0x06d5('0x26')](_0x06d5('0x27'),Date['now'](),_0x1cd186[_0x06d5('0x2c')]));}})});router['post'](_0x06d5('0x12'),upload[_0x06d5('0x2d')](_0x06d5('0x29')),controller[_0x06d5('0x2e')]);var upload=multer({'storage':multer[_0x06d5('0x22')]({'destination':function(_0x51343a,_0x504864,_0x5b705b){_0x5b705b(null,path[_0x06d5('0x23')](config[_0x06d5('0x24')],_0x06d5('0x2b')));},'filename':function(_0x2def6a,_0x279c63,_0x28a23f){_0x28a23f(null,util[_0x06d5('0x26')](_0x06d5('0x27'),Date[_0x06d5('0x28')](),_0x279c63['originalname']));}})});router[_0x06d5('0x1d')](_0x06d5('0x2f'),upload['single']('file'),controller[_0x06d5('0x30')]);var upload=multer({'storage':multer[_0x06d5('0x22')]({'destination':function(_0x166346,_0x570a0a,_0x43d143){_0x43d143(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x34d7e0,_0x3ed5ac,_0x284df5){_0x284df5(null,util[_0x06d5('0x26')](_0x06d5('0x27'),Date[_0x06d5('0x28')](),_0x3ed5ac[_0x06d5('0x2c')]));}})});router[_0x06d5('0x1d')]('/:id/system_avatar',upload[_0x06d5('0x2d')](_0x06d5('0x29')),controller['addSystemAvatar']);router[_0x06d5('0x1d')](_0x06d5('0x31'),controller['notify']);router[_0x06d5('0x1d')]('/:id/offline',controller['offline']);router['post']('/:id/interactions',auth[_0x06d5('0xa')](),controller[_0x06d5('0x32')]);router['post'](_0x06d5('0x33'),auth[_0x06d5('0xa')](),controller[_0x06d5('0x34')]);router['post'](_0x06d5('0x18'),auth['isAuthenticated'](),controller[_0x06d5('0x35')]);router[_0x06d5('0x1d')](_0x06d5('0x1b'),auth['isAuthenticated'](),controller[_0x06d5('0x36')]);router['put']('/:id',auth[_0x06d5('0xa')](),controller[_0x06d5('0x37')]);router[_0x06d5('0x38')]('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x06d5('0x39')]);router['delete'](_0x06d5('0xf'),auth['isAuthenticated'](),controller[_0x06d5('0x3a')]);router[_0x06d5('0x38')](_0x06d5('0x1b'),auth[_0x06d5('0xa')](),controller[_0x06d5('0x3b')]);module[_0x06d5('0x3c')]=router; \ No newline at end of file +var _0x8253=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','/:id/snippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getOfflineMessages','/:id/users','getAgents','post','addDisposition','addAnswer','diskStorage','server/files/images/logos/','format','now','originalname','/:id/logo','single','file','addLogo','join','root','addAvatar','server/files/images/avatars/','%s-%s','addCustomerAvatar','addSystemAvatar','notify','/:id/offline','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8253,0xfd));var _0x3825=function(_0x2c5ec9,_0x4d69fe){_0x2c5ec9=_0x2c5ec9-0x0;var _0x460637=_0x8253[_0x2c5ec9];return _0x460637;};'use strict';var multer=require(_0x3825('0x0'));var util=require(_0x3825('0x1'));var path=require(_0x3825('0x2'));var timeout=require('connect-timeout');var express=require(_0x3825('0x3'));var router=express['Router']();var auth=require(_0x3825('0x4'));var interaction=require(_0x3825('0x5'));var config=require(_0x3825('0x6'));var controller=require(_0x3825('0x7'));router[_0x3825('0x8')]('/',auth[_0x3825('0x9')](),controller[_0x3825('0xa')]);router['get'](_0x3825('0xb'),auth[_0x3825('0x9')](),controller[_0x3825('0xc')]);router['get'](_0x3825('0xd'),auth[_0x3825('0x9')](),controller['show']);router[_0x3825('0x8')](_0x3825('0xe'),auth[_0x3825('0x9')](),controller[_0x3825('0xf')]);router['get'](_0x3825('0x10'),auth[_0x3825('0x9')](),controller['getAnswers']);router['get']('/:id/logo',controller[_0x3825('0x11')]);router['get'](_0x3825('0x12'),controller[_0x3825('0x13')]);router[_0x3825('0x8')](_0x3825('0x14'),controller[_0x3825('0x15')]);router[_0x3825('0x8')](_0x3825('0x16'),controller['getSystemAvatar']);router['get'](_0x3825('0x17'),auth[_0x3825('0x9')](),controller['getInteractions']);router['get'](_0x3825('0x18'),controller['getSnippet']);router[_0x3825('0x8')](_0x3825('0x19'),auth[_0x3825('0x9')](),controller[_0x3825('0x1a')]);router[_0x3825('0x8')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x3825('0x1b')]);router[_0x3825('0x8')](_0x3825('0x1c'),controller['getFields']);router['get']('/:id/offline_messages',auth[_0x3825('0x9')](),controller[_0x3825('0x1d')]);router[_0x3825('0x8')](_0x3825('0x1e'),auth['isAuthenticated'](),controller[_0x3825('0x1f')]);router[_0x3825('0x20')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3825('0x20')](_0x3825('0xe'),auth[_0x3825('0x9')](),controller[_0x3825('0x21')]);router[_0x3825('0x20')](_0x3825('0x10'),auth[_0x3825('0x9')](),controller[_0x3825('0x22')]);var upload=multer({'storage':multer[_0x3825('0x23')]({'destination':function(_0x2ab372,_0x4ad49c,_0x5ec332){_0x5ec332(null,path['join'](config['root'],_0x3825('0x24')));},'filename':function(_0x2ac62c,_0x459765,_0x2ab5a6){_0x2ab5a6(null,util[_0x3825('0x25')]('%s-%s',Date[_0x3825('0x26')](),_0x459765[_0x3825('0x27')]));}})});router[_0x3825('0x20')](_0x3825('0x28'),upload[_0x3825('0x29')](_0x3825('0x2a')),controller[_0x3825('0x2b')]);var upload=multer({'storage':multer[_0x3825('0x23')]({'destination':function(_0x5011ea,_0x260d70,_0x1e59ae){_0x1e59ae(null,path[_0x3825('0x2c')](config[_0x3825('0x2d')],'server/files/images/avatars/'));},'filename':function(_0x1319a8,_0x190565,_0x296985){_0x296985(null,util['format']('%s-%s',Date[_0x3825('0x26')](),_0x190565[_0x3825('0x27')]));}})});router['post']('/:id/avatar',upload['single'](_0x3825('0x2a')),controller[_0x3825('0x2e')]);var upload=multer({'storage':multer[_0x3825('0x23')]({'destination':function(_0x7eff4e,_0x55cf9f,_0x11e015){_0x11e015(null,path['join'](config[_0x3825('0x2d')],_0x3825('0x2f')));},'filename':function(_0x6ffa78,_0x47fe7c,_0x6bebad){_0x6bebad(null,util[_0x3825('0x25')](_0x3825('0x30'),Date[_0x3825('0x26')](),_0x47fe7c[_0x3825('0x27')]));}})});router[_0x3825('0x20')](_0x3825('0x14'),upload[_0x3825('0x29')]('file'),controller[_0x3825('0x31')]);var upload=multer({'storage':multer[_0x3825('0x23')]({'destination':function(_0x2f0bde,_0x1abf1b,_0x1ec5f4){_0x1ec5f4(null,path[_0x3825('0x2c')](config['root'],_0x3825('0x2f')));},'filename':function(_0x53decf,_0x361cd7,_0x2e8dad){_0x2e8dad(null,util[_0x3825('0x25')](_0x3825('0x30'),Date[_0x3825('0x26')](),_0x361cd7[_0x3825('0x27')]));}})});router['post'](_0x3825('0x16'),upload[_0x3825('0x29')](_0x3825('0x2a')),controller[_0x3825('0x32')]);router['post']('/:id/notify',controller[_0x3825('0x33')]);router[_0x3825('0x20')](_0x3825('0x34'),controller['offline']);router['post'](_0x3825('0x17'),auth[_0x3825('0x9')](),controller['addInteraction']);router[_0x3825('0x20')](_0x3825('0x19'),auth[_0x3825('0x9')](),controller[_0x3825('0x35')]);router[_0x3825('0x20')](_0x3825('0x36'),auth[_0x3825('0x9')](),controller[_0x3825('0x37')]);router[_0x3825('0x20')]('/:id/users',auth['isAuthenticated'](),controller[_0x3825('0x38')]);router['put'](_0x3825('0xd'),auth[_0x3825('0x9')](),controller[_0x3825('0x39')]);router[_0x3825('0x3a')](_0x3825('0xd'),auth[_0x3825('0x9')](),controller[_0x3825('0x3b')]);router[_0x3825('0x3a')]('/:id/dispositions',auth[_0x3825('0x9')](),controller[_0x3825('0x3c')]);router[_0x3825('0x3a')](_0x3825('0x10'),auth['isAuthenticated'](),controller[_0x3825('0x3d')]);router[_0x3825('0x3a')]('/:id/users',auth[_0x3825('0x9')](),controller[_0x3825('0x3e')]);module[_0x3825('0x3f')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index d3e4f53..d9a39ff 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 _0xb39f=['STRING','ENUM','sequelize','exports'];(function(_0x311263,_0x148ea){var _0x19324f=function(_0x4d2c42){while(--_0x4d2c42){_0x311263['push'](_0x311263['shift']());}};_0x19324f(++_0x148ea);}(_0xb39f,0x1e6));var _0xfb39=function(_0x3a293f,_0x54c3c6){_0x3a293f=_0x3a293f-0x0;var _0x1861ee=_0xb39f[_0x3a293f];return _0x1861ee;};'use strict';var Sequelize=require(_0xfb39('0x0'));module[_0xfb39('0x1')]={'name':{'type':Sequelize[_0xfb39('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xfb39('0x3')]('AmazonAWS','Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xfb39('0x2')]}}; \ No newline at end of file +var _0x1f2d=['ENUM','Google','sequelize','exports','STRING'];(function(_0x7dccb0,_0x43a10a){var _0xd1c773=function(_0xeb84e1){while(--_0xeb84e1){_0x7dccb0['push'](_0x7dccb0['shift']());}};_0xd1c773(++_0x43a10a);}(_0x1f2d,0x1c4));var _0xd1f2=function(_0x1f6e71,_0x19360b){_0x1f6e71=_0x1f6e71-0x0;var _0x2271aa=_0x1f2d[_0x1f6e71];return _0x2271aa;};'use strict';var Sequelize=require(_0xd1f2('0x0'));module[_0xd1f2('0x1')]={'name':{'type':Sequelize[_0xd1f2('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xd1f2('0x3')]('AmazonAWS',_0xd1f2('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xd1f2('0x2')]},'data2':{'type':Sequelize[_0xd1f2('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 0e13203..78da4f7 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 _0x04bc=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','map','CloudProvider','fieldName','type','model','query','keys','filters','intersection'];(function(_0x2ec42,_0x4b0f37){var _0x5497ca=function(_0x45898f){while(--_0x45898f){_0x2ec42['push'](_0x2ec42['shift']());}};_0x5497ca(++_0x4b0f37);}(_0x04bc,0x1ba));var _0xc04b=function(_0x322617,_0x42bfcc){_0x322617=_0x322617-0x0;var _0x4b4285=_0x04bc[_0x322617];return _0x4b4285;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc04b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc04b('0x1'));var jsonpatch=require(_0xc04b('0x2'));var rp=require(_0xc04b('0x3'));var moment=require(_0xc04b('0x4'));var BPromise=require(_0xc04b('0x5'));var Mustache=require(_0xc04b('0x6'));var util=require('util');var path=require(_0xc04b('0x7'));var sox=require('sox');var csv=require(_0xc04b('0x8'));var ejs=require(_0xc04b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc04b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc04b('0xb'));var Papa=require(_0xc04b('0xc'));var Redis=require(_0xc04b('0xd'));var authService=require(_0xc04b('0xe'));var qs=require(_0xc04b('0xf'));var as=require(_0xc04b('0x10'));var hardwareService=require(_0xc04b('0x11'));var logger=require(_0xc04b('0x12'))(_0xc04b('0x13'));var utils=require(_0xc04b('0x14'));var config=require(_0xc04b('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x292c99,_0x672eb8){_0x672eb8=_0x672eb8||0xcc;return function(_0x48266e){if(_0x48266e){return _0x292c99[_0xc04b('0x16')](_0x672eb8);}return _0x292c99[_0xc04b('0x17')](_0x672eb8)[_0xc04b('0x18')]();};}function respondWithResult(_0x181f30,_0x53470c){_0x53470c=_0x53470c||0xc8;return function(_0x544e98){if(_0x544e98){return _0x181f30['status'](_0x53470c)[_0xc04b('0x19')](_0x544e98);}};}function respondWithFilteredResult(_0x2d9c23,_0x55c079){return function(_0xbd27d2){if(_0xbd27d2){var _0x6d2a55=_0xbd27d2[_0xc04b('0x1a')],_0x58c787=_0x55c079['offset'],_0x1d3af5=_0x55c079[_0xc04b('0x1b')]+_0x55c079[_0xc04b('0x1c')],_0x469557;if(_0x1d3af5>=_0x6d2a55){_0x1d3af5=_0x6d2a55;_0x469557=0xc8;}else{_0x469557=0xce;}_0x2d9c23[_0xc04b('0x17')](_0x469557);return _0x2d9c23['set']('Content-Range',_0x58c787+'-'+_0x1d3af5+'/'+_0x6d2a55)[_0xc04b('0x19')](_0xbd27d2);}return null;};}function patchUpdates(_0x40a76c){return function(_0x54b2cd){try{jsonpatch[_0xc04b('0x1d')](_0x54b2cd,_0x40a76c,!![]);}catch(_0x37d081){return BPromise[_0xc04b('0x1e')](_0x37d081);}return _0x54b2cd[_0xc04b('0x1f')]();};}function saveUpdates(_0x166feb,_0xf05134){return function(_0x476c70){if(_0x476c70){return _0x476c70[_0xc04b('0x20')](_0x166feb)[_0xc04b('0x21')](function(_0x812f33){return _0x812f33;});}return null;};}function removeEntity(_0x416cc5,_0x4a3e02){return function(_0x1cf75c){if(_0x1cf75c){return _0x1cf75c[_0xc04b('0x22')]()['then'](function(){_0x416cc5[_0xc04b('0x17')](0xcc)[_0xc04b('0x18')]();});}};}function handleEntityNotFound(_0x253c2e,_0x2ae8df){return function(_0x412594){if(!_0x412594){_0x253c2e['sendStatus'](0x194);}return _0x412594;};}function handleError(_0x4d1029,_0x445255){_0x445255=_0x445255||0x1f4;return function(_0x2dad95){logger[_0xc04b('0x23')](_0x2dad95[_0xc04b('0x24')]);if(_0x2dad95['name']){delete _0x2dad95[_0xc04b('0x25')];}_0x4d1029[_0xc04b('0x17')](_0x445255)[_0xc04b('0x26')](_0x2dad95);};}exports['index']=function(_0x202c4e,_0x321a5e){var _0x17644={},_0x1d12b8={},_0x2c3077={'count':0x0,'rows':[]};var _0x59baf6=_[_0xc04b('0x27')](db[_0xc04b('0x28')]['rawAttributes'],function(_0x291634){return{'name':_0x291634[_0xc04b('0x29')],'type':_0x291634[_0xc04b('0x2a')]['key']};});_0x1d12b8[_0xc04b('0x2b')]=_[_0xc04b('0x27')](_0x59baf6,_0xc04b('0x25'));_0x1d12b8[_0xc04b('0x2c')]=_[_0xc04b('0x2d')](_0x202c4e[_0xc04b('0x2c')]);_0x1d12b8[_0xc04b('0x2e')]=_[_0xc04b('0x2f')](_0x1d12b8[_0xc04b('0x2b')],_0x1d12b8[_0xc04b('0x2c')]);_0x17644[_0xc04b('0x30')]=_[_0xc04b('0x2f')](_0x1d12b8[_0xc04b('0x2b')],qs[_0xc04b('0x31')](_0x202c4e[_0xc04b('0x2c')]['fields']));_0x17644[_0xc04b('0x30')]=_0x17644[_0xc04b('0x30')][_0xc04b('0x32')]?_0x17644[_0xc04b('0x30')]:_0x1d12b8['model'];if(!_0x202c4e[_0xc04b('0x2c')][_0xc04b('0x33')](_0xc04b('0x34'))){_0x17644[_0xc04b('0x1c')]=qs[_0xc04b('0x1c')](_0x202c4e[_0xc04b('0x2c')][_0xc04b('0x1c')]);_0x17644[_0xc04b('0x1b')]=qs[_0xc04b('0x1b')](_0x202c4e['query']['offset']);}_0x17644[_0xc04b('0x35')]=qs[_0xc04b('0x36')](_0x202c4e['query'][_0xc04b('0x36')]);_0x17644[_0xc04b('0x37')]=qs['filters'](_[_0xc04b('0x38')](_0x202c4e[_0xc04b('0x2c')],_0x1d12b8[_0xc04b('0x2e')]),_0x59baf6);if(_0x202c4e[_0xc04b('0x2c')][_0xc04b('0x39')]){_0x17644[_0xc04b('0x37')]=_[_0xc04b('0x3a')](_0x17644[_0xc04b('0x37')],{'$or':_[_0xc04b('0x27')](_0x59baf6,function(_0x246da2){if(_0x246da2[_0xc04b('0x2a')]!==_0xc04b('0x3b')){var _0x522248={};_0x522248[_0x246da2['name']]={'$like':'%'+_0x202c4e['query'][_0xc04b('0x39')]+'%'};return _0x522248;}})});}_0x17644=_[_0xc04b('0x3a')]({},_0x17644,_0x202c4e[_0xc04b('0x3c')]);var _0x3a29a1={'where':_0x17644['where']};return db['CloudProvider'][_0xc04b('0x1a')](_0x3a29a1)[_0xc04b('0x21')](function(_0x521bda){_0x2c3077[_0xc04b('0x1a')]=_0x521bda;if(_0x202c4e[_0xc04b('0x2c')][_0xc04b('0x3d')]){_0x17644[_0xc04b('0x3e')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x17644);})[_0xc04b('0x21')](function(_0x39ee25){_0x2c3077[_0xc04b('0x3f')]=_0x39ee25;return _0x2c3077;})[_0xc04b('0x21')](respondWithFilteredResult(_0x321a5e,_0x17644))[_0xc04b('0x40')](handleError(_0x321a5e,null));};exports['show']=function(_0x21cd72,_0x331b24){var _0x3a4a7b={'raw':!![],'where':{'id':_0x21cd72[_0xc04b('0x41')]['id']}},_0x4c1fd8={};_0x4c1fd8[_0xc04b('0x2b')]=_['keys'](db['CloudProvider'][_0xc04b('0x42')]);_0x4c1fd8['query']=_['keys'](_0x21cd72[_0xc04b('0x2c')]);_0x4c1fd8['filters']=_[_0xc04b('0x2f')](_0x4c1fd8[_0xc04b('0x2b')],_0x4c1fd8[_0xc04b('0x2c')]);_0x3a4a7b['attributes']=_[_0xc04b('0x2f')](_0x4c1fd8[_0xc04b('0x2b')],qs[_0xc04b('0x31')](_0x21cd72[_0xc04b('0x2c')][_0xc04b('0x31')]));_0x3a4a7b[_0xc04b('0x30')]=_0x3a4a7b['attributes']['length']?_0x3a4a7b['attributes']:_0x4c1fd8[_0xc04b('0x2b')];if(_0x21cd72['query'][_0xc04b('0x3d')]){_0x3a4a7b[_0xc04b('0x3e')]=[{'all':!![]}];}_0x3a4a7b=_[_0xc04b('0x3a')]({},_0x3a4a7b,_0x21cd72[_0xc04b('0x3c')]);return db[_0xc04b('0x28')]['find'](_0x3a4a7b)[_0xc04b('0x21')](handleEntityNotFound(_0x331b24,null))['then'](respondWithResult(_0x331b24,null))[_0xc04b('0x40')](handleError(_0x331b24,null));};exports[_0xc04b('0x43')]=function(_0x187220,_0x16d401){return db[_0xc04b('0x28')][_0xc04b('0x43')](_0x187220[_0xc04b('0x44')],{})['then'](respondWithResult(_0x16d401,0xc9))[_0xc04b('0x40')](handleError(_0x16d401,null));};exports[_0xc04b('0x20')]=function(_0x2e9622,_0x70e78b){if(_0x2e9622[_0xc04b('0x44')]['id']){delete _0x2e9622[_0xc04b('0x44')]['id'];}return db[_0xc04b('0x28')][_0xc04b('0x45')]({'where':{'id':_0x2e9622[_0xc04b('0x41')]['id']}})[_0xc04b('0x21')](handleEntityNotFound(_0x70e78b,null))['then'](saveUpdates(_0x2e9622[_0xc04b('0x44')],null))[_0xc04b('0x21')](respondWithResult(_0x70e78b,null))[_0xc04b('0x40')](handleError(_0x70e78b,null));};exports[_0xc04b('0x22')]=function(_0xe6a08b,_0x2fd914){return db[_0xc04b('0x28')][_0xc04b('0x45')]({'where':{'id':_0xe6a08b[_0xc04b('0x41')]['id']}})[_0xc04b('0x21')](handleEntityNotFound(_0x2fd914,null))[_0xc04b('0x21')](removeEntity(_0x2fd914,null))[_0xc04b('0x40')](handleError(_0x2fd914,null));}; \ No newline at end of file +var _0xcce8=['count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','name','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x13b9c4,_0x370d96){var _0x526352=function(_0x4edbd8){while(--_0x4edbd8){_0x13b9c4['push'](_0x13b9c4['shift']());}};_0x526352(++_0x370d96);}(_0xcce8,0x1a5));var _0x8cce=function(_0x4b4831,_0xfa5c6){_0x4b4831=_0x4b4831-0x0;var _0x2d5b38=_0xcce8[_0x4b4831];return _0x2d5b38;};'use strict';var pdf=require(_0x8cce('0x0'));var emlformat=require(_0x8cce('0x1'));var rimraf=require(_0x8cce('0x2'));var zipdir=require(_0x8cce('0x3'));var jsonpatch=require(_0x8cce('0x4'));var rp=require(_0x8cce('0x5'));var moment=require(_0x8cce('0x6'));var BPromise=require(_0x8cce('0x7'));var Mustache=require(_0x8cce('0x8'));var util=require(_0x8cce('0x9'));var path=require('path');var sox=require(_0x8cce('0xa'));var csv=require(_0x8cce('0xb'));var ejs=require(_0x8cce('0xc'));var fs=require('fs');var _=require(_0x8cce('0xd'));var squel=require(_0x8cce('0xe'));var crypto=require(_0x8cce('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8cce('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8cce('0x11'));var qs=require(_0x8cce('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8cce('0x13'));var logger=require(_0x8cce('0x14'))(_0x8cce('0x15'));var utils=require('../../config/utils');var config=require(_0x8cce('0x16'));var licenseUtil=require(_0x8cce('0x17'));var db=require(_0x8cce('0x18'))['db'];function respondWithStatusCode(_0x3ce0b5,_0x54f76c){_0x54f76c=_0x54f76c||0xcc;return function(_0x2e1eeb){if(_0x2e1eeb){return _0x3ce0b5[_0x8cce('0x19')](_0x54f76c);}return _0x3ce0b5[_0x8cce('0x1a')](_0x54f76c)[_0x8cce('0x1b')]();};}function respondWithResult(_0x4c7018,_0x2ebd26){_0x2ebd26=_0x2ebd26||0xc8;return function(_0x59b900){if(_0x59b900){return _0x4c7018['status'](_0x2ebd26)[_0x8cce('0x1c')](_0x59b900);}};}function respondWithFilteredResult(_0x556f59,_0x4548a1){return function(_0x3e13e5){if(_0x3e13e5){var _0x13fa21=_0x3e13e5[_0x8cce('0x1d')],_0x17706c=_0x4548a1[_0x8cce('0x1e')],_0xdbbfe3=_0x4548a1[_0x8cce('0x1e')]+_0x4548a1[_0x8cce('0x1f')],_0x251edd;if(_0xdbbfe3>=_0x13fa21){_0xdbbfe3=_0x13fa21;_0x251edd=0xc8;}else{_0x251edd=0xce;}_0x556f59['status'](_0x251edd);return _0x556f59[_0x8cce('0x20')](_0x8cce('0x21'),_0x17706c+'-'+_0xdbbfe3+'/'+_0x13fa21)['json'](_0x3e13e5);}return null;};}function patchUpdates(_0x2d3a73){return function(_0x1f7ce2){try{jsonpatch[_0x8cce('0x22')](_0x1f7ce2,_0x2d3a73,!![]);}catch(_0x107958){return BPromise[_0x8cce('0x23')](_0x107958);}return _0x1f7ce2['save']();};}function saveUpdates(_0x17c30d,_0x221fe2){return function(_0x397181){if(_0x397181){return _0x397181[_0x8cce('0x24')](_0x17c30d)['then'](function(_0x321099){return _0x321099;});}return null;};}function removeEntity(_0x49af29,_0x38a5a5){return function(_0x2aa625){if(_0x2aa625){return _0x2aa625[_0x8cce('0x25')]()[_0x8cce('0x26')](function(){_0x49af29['status'](0xcc)[_0x8cce('0x1b')]();});}};}function handleEntityNotFound(_0x20bedb,_0x244bb7){return function(_0x246122){if(!_0x246122){_0x20bedb[_0x8cce('0x19')](0x194);}return _0x246122;};}function handleError(_0x4beb00,_0x2613c9){_0x2613c9=_0x2613c9||0x1f4;return function(_0x3e191d){logger[_0x8cce('0x27')](_0x3e191d['stack']);if(_0x3e191d['name']){delete _0x3e191d[_0x8cce('0x28')];}_0x4beb00['status'](_0x2613c9)['send'](_0x3e191d);};}exports[_0x8cce('0x29')]=function(_0x393957,_0x2c2fe9){var _0x2b82b8={},_0x419c2b={},_0x3e655c={'count':0x0,'rows':[]};var _0x2694e8=_[_0x8cce('0x2a')](db[_0x8cce('0x2b')][_0x8cce('0x2c')],function(_0x4cb528){return{'name':_0x4cb528[_0x8cce('0x2d')],'type':_0x4cb528[_0x8cce('0x2e')][_0x8cce('0x2f')]};});_0x419c2b[_0x8cce('0x30')]=_[_0x8cce('0x2a')](_0x2694e8,'name');_0x419c2b[_0x8cce('0x31')]=_[_0x8cce('0x32')](_0x393957[_0x8cce('0x31')]);_0x419c2b[_0x8cce('0x33')]=_[_0x8cce('0x34')](_0x419c2b[_0x8cce('0x30')],_0x419c2b[_0x8cce('0x31')]);_0x2b82b8[_0x8cce('0x35')]=_[_0x8cce('0x34')](_0x419c2b[_0x8cce('0x30')],qs['fields'](_0x393957[_0x8cce('0x31')][_0x8cce('0x36')]));_0x2b82b8['attributes']=_0x2b82b8[_0x8cce('0x35')][_0x8cce('0x37')]?_0x2b82b8[_0x8cce('0x35')]:_0x419c2b[_0x8cce('0x30')];if(!_0x393957[_0x8cce('0x31')][_0x8cce('0x38')](_0x8cce('0x39'))){_0x2b82b8[_0x8cce('0x1f')]=qs[_0x8cce('0x1f')](_0x393957[_0x8cce('0x31')]['limit']);_0x2b82b8[_0x8cce('0x1e')]=qs[_0x8cce('0x1e')](_0x393957[_0x8cce('0x31')]['offset']);}_0x2b82b8[_0x8cce('0x3a')]=qs['sort'](_0x393957[_0x8cce('0x31')][_0x8cce('0x3b')]);_0x2b82b8[_0x8cce('0x3c')]=qs['filters'](_[_0x8cce('0x3d')](_0x393957[_0x8cce('0x31')],_0x419c2b[_0x8cce('0x33')]),_0x2694e8);if(_0x393957[_0x8cce('0x31')]['filter']){_0x2b82b8['where']=_[_0x8cce('0x3e')](_0x2b82b8[_0x8cce('0x3c')],{'$or':_[_0x8cce('0x2a')](_0x2694e8,function(_0x1a094d){if(_0x1a094d[_0x8cce('0x2e')]!==_0x8cce('0x3f')){var _0xace26d={};_0xace26d[_0x1a094d[_0x8cce('0x28')]]={'$like':'%'+_0x393957[_0x8cce('0x31')][_0x8cce('0x40')]+'%'};return _0xace26d;}})});}_0x2b82b8=_[_0x8cce('0x3e')]({},_0x2b82b8,_0x393957[_0x8cce('0x41')]);var _0x5766ab={'where':_0x2b82b8[_0x8cce('0x3c')]};return db[_0x8cce('0x2b')]['count'](_0x5766ab)['then'](function(_0x38152e){_0x3e655c[_0x8cce('0x1d')]=_0x38152e;if(_0x393957['query'][_0x8cce('0x42')]){_0x2b82b8['include']=[{'all':!![]}];}return db[_0x8cce('0x2b')][_0x8cce('0x43')](_0x2b82b8);})['then'](function(_0x434091){_0x3e655c[_0x8cce('0x44')]=_0x434091;return _0x3e655c;})[_0x8cce('0x26')](respondWithFilteredResult(_0x2c2fe9,_0x2b82b8))[_0x8cce('0x45')](handleError(_0x2c2fe9,null));};exports['show']=function(_0x44494f,_0x208922){var _0x3942cf={'raw':!![],'where':{'id':_0x44494f[_0x8cce('0x46')]['id']}},_0x3d6ca3={};_0x3d6ca3[_0x8cce('0x30')]=_[_0x8cce('0x32')](db['CloudProvider']['rawAttributes']);_0x3d6ca3['query']=_[_0x8cce('0x32')](_0x44494f[_0x8cce('0x31')]);_0x3d6ca3[_0x8cce('0x33')]=_[_0x8cce('0x34')](_0x3d6ca3[_0x8cce('0x30')],_0x3d6ca3[_0x8cce('0x31')]);_0x3942cf[_0x8cce('0x35')]=_[_0x8cce('0x34')](_0x3d6ca3[_0x8cce('0x30')],qs[_0x8cce('0x36')](_0x44494f[_0x8cce('0x31')][_0x8cce('0x36')]));_0x3942cf[_0x8cce('0x35')]=_0x3942cf[_0x8cce('0x35')]['length']?_0x3942cf[_0x8cce('0x35')]:_0x3d6ca3[_0x8cce('0x30')];if(_0x44494f[_0x8cce('0x31')]['includeAll']){_0x3942cf[_0x8cce('0x47')]=[{'all':!![]}];}_0x3942cf=_[_0x8cce('0x3e')]({},_0x3942cf,_0x44494f[_0x8cce('0x41')]);return db[_0x8cce('0x2b')][_0x8cce('0x48')](_0x3942cf)[_0x8cce('0x26')](handleEntityNotFound(_0x208922,null))[_0x8cce('0x26')](respondWithResult(_0x208922,null))[_0x8cce('0x45')](handleError(_0x208922,null));};exports['create']=function(_0x2955c9,_0x112600){return db['CloudProvider'][_0x8cce('0x49')](_0x2955c9['body'],{})['then'](respondWithResult(_0x112600,0xc9))[_0x8cce('0x45')](handleError(_0x112600,null));};exports[_0x8cce('0x24')]=function(_0x48beff,_0x36d1c5){if(_0x48beff[_0x8cce('0x4a')]['id']){delete _0x48beff[_0x8cce('0x4a')]['id'];}return db[_0x8cce('0x2b')][_0x8cce('0x48')]({'where':{'id':_0x48beff[_0x8cce('0x46')]['id']}})[_0x8cce('0x26')](handleEntityNotFound(_0x36d1c5,null))[_0x8cce('0x26')](saveUpdates(_0x48beff[_0x8cce('0x4a')],null))['then'](respondWithResult(_0x36d1c5,null))[_0x8cce('0x45')](handleError(_0x36d1c5,null));};exports[_0x8cce('0x25')]=function(_0x4d76e8,_0x1b4b24){return db[_0x8cce('0x2b')][_0x8cce('0x48')]({'where':{'id':_0x4d76e8[_0x8cce('0x46')]['id']}})[_0x8cce('0x26')](handleEntityNotFound(_0x1b4b24,null))[_0x8cce('0x26')](removeEntity(_0x1b4b24,null))[_0x8cce('0x45')](handleError(_0x1b4b24,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index fdb5d96..c32e01d 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 _0x7ec4=['cloud_providers','lodash','api','moment','request-promise','path','../../config/environment','./cloudProvider.attributes','exports','define'];(function(_0x21d36e,_0x5dc096){var _0x4cc307=function(_0x4ae995){while(--_0x4ae995){_0x21d36e['push'](_0x21d36e['shift']());}};_0x4cc307(++_0x5dc096);}(_0x7ec4,0xfb));var _0x47ec=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7ec4[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x47ec('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x47ec('0x1'));var moment=require(_0x47ec('0x2'));var BPromise=require('bluebird');var rp=require(_0x47ec('0x3'));var fs=require('fs');var path=require(_0x47ec('0x4'));var rimraf=require('rimraf');var config=require(_0x47ec('0x5'));var attributes=require(_0x47ec('0x6'));module[_0x47ec('0x7')]=function(_0x245a9b,_0x39a7ac){return _0x245a9b[_0x47ec('0x8')]('CloudProvider',attributes,{'tableName':_0x47ec('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3b3=['define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','path','./cloudProvider.attributes','exports'];(function(_0x337175,_0xb7ec76){var _0x28c4ab=function(_0x1d3f3e){while(--_0x1d3f3e){_0x337175['push'](_0x337175['shift']());}};_0x28c4ab(++_0xb7ec76);}(_0xa3b3,0xf3));var _0x3a3b=function(_0x1f76ea,_0x58cd9e){_0x1f76ea=_0x1f76ea-0x0;var _0x44db2a=_0xa3b3[_0x1f76ea];return _0x44db2a;};'use strict';var _=require(_0x3a3b('0x0'));var util=require(_0x3a3b('0x1'));var logger=require(_0x3a3b('0x2'))(_0x3a3b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3a3b('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3a3b('0x5'));module[_0x3a3b('0x6')]=function(_0x1de07d,_0x187b65){return _0x1de07d[_0x3a3b('0x7')](_0x3a3b('0x8'),attributes,{'tableName':_0x3a3b('0x9'),'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 70fdb14..680666e 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 _0x4f7f=['error','code','message','result','catch','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x17ec16,_0x2436e3){var _0x1f59f5=function(_0x165b75){while(--_0x165b75){_0x17ec16['push'](_0x17ec16['shift']());}};_0x1f59f5(++_0x2436e3);}(_0x4f7f,0x1e5));var _0xf4f7=function(_0x228c2e,_0x182b1f){_0x228c2e=_0x228c2e-0x0;var _0xd71cb0=_0x4f7f[_0x228c2e];return _0xd71cb0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf4f7('0x0'));var BPromise=require(_0xf4f7('0x1'));var rs=require(_0xf4f7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf4f7('0x3'));var config=require(_0xf4f7('0x4'));var jayson=require(_0xf4f7('0x5'));var client=jayson[_0xf4f7('0x6')][_0xf4f7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x508b9c,_0x3cc9d5,_0x5fb17b){return new BPromise(function(_0x50d37e,_0x36e2de){return client[_0xf4f7('0x8')](_0x508b9c,_0x5fb17b)[_0xf4f7('0x9')](function(_0x54060a){logger[_0xf4f7('0xa')](_0xf4f7('0xb'),_0x3cc9d5,_0xf4f7('0xc'));logger['debug'](_0xf4f7('0xd'),_0x3cc9d5,_0xf4f7('0xc'),JSON[_0xf4f7('0xe')](_0x54060a));if(_0x54060a[_0xf4f7('0xf')]){if(_0x54060a['error'][_0xf4f7('0x10')]===0x1f4){logger[_0xf4f7('0xf')](_0xf4f7('0xb'),_0x3cc9d5,_0x54060a[_0xf4f7('0xf')][_0xf4f7('0x11')]);return _0x36e2de(_0x54060a[_0xf4f7('0xf')][_0xf4f7('0x11')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x3cc9d5,_0x54060a[_0xf4f7('0xf')][_0xf4f7('0x11')]);return _0x50d37e(_0x54060a[_0xf4f7('0xf')][_0xf4f7('0x11')]);}else{logger[_0xf4f7('0xa')](_0xf4f7('0xb'),_0x3cc9d5,'request\x20sent');_0x50d37e(_0x54060a[_0xf4f7('0x12')][_0xf4f7('0x11')]);}})[_0xf4f7('0x13')](function(_0x4c7243){logger['error'](_0xf4f7('0xb'),_0x3cc9d5,_0x4c7243);_0x36e2de(_0x4c7243);});});} \ No newline at end of file +var _0x947f=['jayson/promise','http','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4239c8,_0x2c0c6e){var _0x40323b=function(_0x598d03){while(--_0x598d03){_0x4239c8['push'](_0x4239c8['shift']());}};_0x40323b(++_0x2c0c6e);}(_0x947f,0x16b));var _0xf947=function(_0x10791d,_0x2562b6){_0x10791d=_0x10791d-0x0;var _0x1b4f9c=_0x947f[_0x10791d];return _0x1b4f9c;};'use strict';var _=require(_0xf947('0x0'));var util=require(_0xf947('0x1'));var moment=require(_0xf947('0x2'));var BPromise=require(_0xf947('0x3'));var rs=require(_0xf947('0x4'));var fs=require('fs');var Redis=require(_0xf947('0x5'));var db=require(_0xf947('0x6'))['db'];var utils=require(_0xf947('0x7'));var logger=require(_0xf947('0x8'))(_0xf947('0x9'));var config=require(_0xf947('0xa'));var jayson=require(_0xf947('0xb'));var client=jayson['client'][_0xf947('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x45acc2,_0xfd21c1,_0x5894a5){return new BPromise(function(_0x6a36d8,_0x14ccb4){return client['request'](_0x45acc2,_0x5894a5)['then'](function(_0xbcf352){logger[_0xf947('0xd')](_0xf947('0xe'),_0xfd21c1,_0xf947('0xf'));logger[_0xf947('0x10')](_0xf947('0x11'),_0xfd21c1,_0xf947('0xf'),JSON['stringify'](_0xbcf352));if(_0xbcf352[_0xf947('0x12')]){if(_0xbcf352['error'][_0xf947('0x13')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0xfd21c1,_0xbcf352['error'][_0xf947('0x14')]);return _0x14ccb4(_0xbcf352[_0xf947('0x12')][_0xf947('0x14')]);}logger['error'](_0xf947('0xe'),_0xfd21c1,_0xbcf352[_0xf947('0x12')][_0xf947('0x14')]);return _0x6a36d8(_0xbcf352[_0xf947('0x12')][_0xf947('0x14')]);}else{logger[_0xf947('0xd')]('CloudProvider,\x20%s,\x20%s',_0xfd21c1,'request\x20sent');_0x6a36d8(_0xbcf352[_0xf947('0x15')][_0xf947('0x14')]);}})['catch'](function(_0x17352b){logger['error'](_0xf947('0xe'),_0xfd21c1,_0x17352b);_0x14ccb4(_0x17352b);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 60d7bed..5717393 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 _0xec53=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','create','update'];(function(_0x24011e,_0x40600b){var _0x116b91=function(_0x4afadb){while(--_0x4afadb){_0x24011e['push'](_0x24011e['shift']());}};_0x116b91(++_0x40600b);}(_0xec53,0xab));var _0x3ec5=function(_0x48fc15,_0x1df671){_0x48fc15=_0x48fc15-0x0;var _0x2b7c6a=_0xec53[_0x48fc15];return _0x2b7c6a;};'use strict';var multer=require('multer');var util=require(_0x3ec5('0x0'));var path=require(_0x3ec5('0x1'));var timeout=require(_0x3ec5('0x2'));var express=require(_0x3ec5('0x3'));var router=express[_0x3ec5('0x4')]();var auth=require(_0x3ec5('0x5'));var interaction=require(_0x3ec5('0x6'));var config=require(_0x3ec5('0x7'));var controller=require(_0x3ec5('0x8'));router[_0x3ec5('0x9')]('/',auth[_0x3ec5('0xa')](),controller[_0x3ec5('0xb')]);router[_0x3ec5('0x9')](_0x3ec5('0xc'),auth[_0x3ec5('0xa')](),controller[_0x3ec5('0xd')]);router['post']('/',auth[_0x3ec5('0xa')](),controller[_0x3ec5('0xe')]);router['put'](_0x3ec5('0xc'),auth[_0x3ec5('0xa')](),controller[_0x3ec5('0xf')]);router['delete']('/:id',auth[_0x3ec5('0xa')](),controller['destroy']);module[_0x3ec5('0x10')]=router; \ No newline at end of file +var _0xd75b=['isAuthenticated','show','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','index','/:id'];(function(_0x595c4e,_0x444249){var _0x1e224c=function(_0x3c46d0){while(--_0x3c46d0){_0x595c4e['push'](_0x595c4e['shift']());}};_0x1e224c(++_0x444249);}(_0xd75b,0x17e));var _0xbd75=function(_0x259dca,_0x5aea7f){_0x259dca=_0x259dca-0x0;var _0x2bf2fe=_0xd75b[_0x259dca];return _0x2bf2fe;};'use strict';var multer=require(_0xbd75('0x0'));var util=require(_0xbd75('0x1'));var path=require(_0xbd75('0x2'));var timeout=require(_0xbd75('0x3'));var express=require(_0xbd75('0x4'));var router=express['Router']();var auth=require(_0xbd75('0x5'));var interaction=require(_0xbd75('0x6'));var config=require('../../config/environment');var controller=require('./cloudProvider.controller');router[_0xbd75('0x7')]('/',auth['isAuthenticated'](),controller[_0xbd75('0x8')]);router[_0xbd75('0x7')](_0xbd75('0x9'),auth[_0xbd75('0xa')](),controller[_0xbd75('0xb')]);router['post']('/',auth[_0xbd75('0xa')](),controller['create']);router['put'](_0xbd75('0x9'),auth['isAuthenticated'](),controller[_0xbd75('0xc')]);router[_0xbd75('0xd')]('/:id',auth[_0xbd75('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index f0c0af6..63f56b3 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 _0x651e=['STRING','sequelize'];(function(_0x385d6e,_0x4b0df8){var _0x5e2bd7=function(_0x2addb9){while(--_0x2addb9){_0x385d6e['push'](_0x385d6e['shift']());}};_0x5e2bd7(++_0x4b0df8);}(_0x651e,0xcb));var _0xe651=function(_0xf2794b,_0x1ac692){_0xf2794b=_0xf2794b-0x0;var _0x2d149f=_0x651e[_0xf2794b];return _0x2d149f;};'use strict';var Sequelize=require(_0xe651('0x0'));module['exports']={'name':{'type':Sequelize[_0xe651('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xe651('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xe651('0x1')]},'phone':{'type':Sequelize[_0xe651('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe651('0x1')]},'street':{'type':Sequelize[_0xe651('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xe651('0x1')]},'email':{'type':Sequelize[_0xe651('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xe651('0x1')]},'sStreet':{'type':Sequelize[_0xe651('0x1')]},'sPostalCode':{'type':Sequelize[_0xe651('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe651('0x1')]}}; \ No newline at end of file +var _0x96bd=['exports','STRING','name','sequelize'];(function(_0x149882,_0x39b6be){var _0x43c6ee=function(_0x42d925){while(--_0x42d925){_0x149882['push'](_0x149882['shift']());}};_0x43c6ee(++_0x39b6be);}(_0x96bd,0x9b));var _0xd96b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x96bd[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xd96b('0x0'));module[_0xd96b('0x1')]={'name':{'type':Sequelize[_0xd96b('0x2')],'unique':_0xd96b('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd96b('0x2')]},'companyId':{'type':Sequelize[_0xd96b('0x2')]},'website':{'type':Sequelize[_0xd96b('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd96b('0x2')]},'street':{'type':Sequelize[_0xd96b('0x2')]},'postalCode':{'type':Sequelize[_0xd96b('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xd96b('0x2')]},'sPostalCode':{'type':Sequelize[_0xd96b('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xd96b('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index b3e809c..32c8eaf 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 _0x12ce=['filter','merge','options','count','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','addContacts','omit','ids','getContacts','findOne','CmContact','length','pick','map','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','Content-Range','apply','reject','save','then','get','Companies','UserProfileResource','sendStatus','error','stack','name','send','CmCompany','describe','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where'];(function(_0x2799d6,_0x2d2e6e){var _0x256be5=function(_0x5446c5){while(--_0x5446c5){_0x2799d6['push'](_0x2799d6['shift']());}};_0x256be5(++_0x2d2e6e);}(_0x12ce,0x74));var _0xe12c=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x12ce[_0x5c351c];return _0x26f3b3;};'use strict';var pdf=require(_0xe12c('0x0'));var emlformat=require(_0xe12c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe12c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe12c('0x3'));var moment=require(_0xe12c('0x4'));var BPromise=require(_0xe12c('0x5'));var Mustache=require(_0xe12c('0x6'));var util=require(_0xe12c('0x7'));var path=require(_0xe12c('0x8'));var sox=require('sox');var csv=require(_0xe12c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe12c('0xa'));var crypto=require(_0xe12c('0xb'));var jsforce=require(_0xe12c('0xc'));var deskjs=require(_0xe12c('0xd'));var toCsv=require(_0xe12c('0x9'));var querystring=require(_0xe12c('0xe'));var Papa=require('papaparse');var Redis=require(_0xe12c('0xf'));var authService=require(_0xe12c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe12c('0x11'));var hardwareService=require(_0xe12c('0x12'));var logger=require(_0xe12c('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xe12c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe12c('0x15'))['db'];function respondWithStatusCode(_0x521f4b,_0x428233){_0x428233=_0x428233||0xcc;return function(_0x461206){if(_0x461206){return _0x521f4b['sendStatus'](_0x428233);}return _0x521f4b['status'](_0x428233)[_0xe12c('0x16')]();};}function respondWithResult(_0x593777,_0x3bc2f1){_0x3bc2f1=_0x3bc2f1||0xc8;return function(_0x5d74ca){if(_0x5d74ca){return _0x593777[_0xe12c('0x17')](_0x3bc2f1)[_0xe12c('0x18')](_0x5d74ca);}};}function respondWithFilteredResult(_0x93308,_0x21baeb){return function(_0x499c89){if(_0x499c89){var _0x2f3b94=_0x499c89['count'],_0x3611f3=_0x21baeb['offset'],_0x4a095b=_0x21baeb[_0xe12c('0x19')]+_0x21baeb[_0xe12c('0x1a')],_0x166b18;if(_0x4a095b>=_0x2f3b94){_0x4a095b=_0x2f3b94;_0x166b18=0xc8;}else{_0x166b18=0xce;}_0x93308[_0xe12c('0x17')](_0x166b18);return _0x93308[_0xe12c('0x1b')](_0xe12c('0x1c'),_0x3611f3+'-'+_0x4a095b+'/'+_0x2f3b94)['json'](_0x499c89);}return null;};}function patchUpdates(_0x197126){return function(_0x53b2ba){try{jsonpatch[_0xe12c('0x1d')](_0x53b2ba,_0x197126,!![]);}catch(_0x144b81){return BPromise[_0xe12c('0x1e')](_0x144b81);}return _0x53b2ba[_0xe12c('0x1f')]();};}function saveUpdates(_0x324d5d,_0x9c631d){return function(_0x5b951f){if(_0x5b951f){return _0x5b951f['update'](_0x324d5d)['then'](function(_0x5a9cc4){return _0x5a9cc4;});}return null;};}function removeEntity(_0xe1a798,_0x229e6d){return function(_0x344619){if(_0x344619){return _0x344619['destroy']()[_0xe12c('0x20')](function(){var _0x3c58d3=_0x344619[_0xe12c('0x21')]({'plain':!![]});var _0x1f0396=_0xe12c('0x22');return db[_0xe12c('0x23')]['destroy']({'where':{'type':_0x1f0396,'resourceId':_0x3c58d3['id']}})[_0xe12c('0x20')](function(){return _0x344619;});})['then'](function(){_0xe1a798['status'](0xcc)[_0xe12c('0x16')]();});}};}function handleEntityNotFound(_0x3c60fc,_0x3946a1){return function(_0x2aab73){if(!_0x2aab73){_0x3c60fc[_0xe12c('0x24')](0x194);}return _0x2aab73;};}function handleError(_0x3c9c99,_0xe5e444){_0xe5e444=_0xe5e444||0x1f4;return function(_0x4d87da){logger[_0xe12c('0x25')](_0x4d87da[_0xe12c('0x26')]);if(_0x4d87da[_0xe12c('0x27')]){delete _0x4d87da['name'];}_0x3c9c99[_0xe12c('0x17')](_0xe5e444)[_0xe12c('0x28')](_0x4d87da);};}exports['index']=function(_0x3242b0,_0x1b8e5f){var _0x5b7540={},_0x1d9ae7={},_0x4e615b={'count':0x0,'rows':[]};return db[_0xe12c('0x29')][_0xe12c('0x2a')]()['then'](function(_0x1109a5){_0x1d9ae7['model']=_[_0xe12c('0x2b')](_0x1109a5);_0x1d9ae7[_0xe12c('0x2c')]=_['keys'](_0x3242b0['query']);_0x1d9ae7[_0xe12c('0x2d')]=_[_0xe12c('0x2e')](_0x1d9ae7[_0xe12c('0x2f')],_0x1d9ae7[_0xe12c('0x2c')]);_0x5b7540[_0xe12c('0x30')]=_[_0xe12c('0x2e')](_0x1d9ae7[_0xe12c('0x2f')],qs[_0xe12c('0x31')](_0x3242b0[_0xe12c('0x2c')][_0xe12c('0x31')]));_0x5b7540['attributes']=_0x5b7540[_0xe12c('0x30')]['length']?_0x5b7540[_0xe12c('0x30')]:_0x1d9ae7[_0xe12c('0x2f')];if(!_0x3242b0[_0xe12c('0x2c')][_0xe12c('0x32')](_0xe12c('0x33'))){_0x5b7540[_0xe12c('0x1a')]=qs[_0xe12c('0x1a')](_0x3242b0[_0xe12c('0x2c')]['limit']);_0x5b7540[_0xe12c('0x19')]=qs[_0xe12c('0x19')](_0x3242b0[_0xe12c('0x2c')][_0xe12c('0x19')]);}_0x5b7540['order']=qs[_0xe12c('0x34')](_0x3242b0['query'][_0xe12c('0x34')]);_0x5b7540[_0xe12c('0x35')]=qs[_0xe12c('0x2d')](_['pick'](_0x3242b0[_0xe12c('0x2c')],_0x1d9ae7[_0xe12c('0x2d')]),_0x1109a5);if(_0x3242b0[_0xe12c('0x2c')][_0xe12c('0x36')]){_0x5b7540['where']=_[_0xe12c('0x37')](_0x5b7540[_0xe12c('0x35')],{'$or':_['map'](_0x5b7540[_0xe12c('0x30')],function(_0x46a4cc){var _0xf5113b={};_0xf5113b[_0x46a4cc]={'$like':'%'+_0x3242b0[_0xe12c('0x2c')][_0xe12c('0x36')]+'%'};return _0xf5113b;})});}_0x5b7540=_[_0xe12c('0x37')]({},_0x5b7540,_0x3242b0[_0xe12c('0x38')]);var _0x2ce63c={'where':_0x5b7540[_0xe12c('0x35')]};return db['CmCompany'][_0xe12c('0x39')](_0x2ce63c)['then'](function(_0x596f58){_0x4e615b[_0xe12c('0x39')]=_0x596f58;if(_0x3242b0['query'][_0xe12c('0x3a')]){_0x5b7540[_0xe12c('0x3b')]=[{'all':!![]}];}return db[_0xe12c('0x29')][_0xe12c('0x3c')](_0x5b7540);})['then'](function(_0x963417){_0x4e615b[_0xe12c('0x3d')]=_0x963417;return _0x4e615b;})['then'](respondWithFilteredResult(_0x1b8e5f,_0x5b7540))[_0xe12c('0x3e')](handleError(_0x1b8e5f,null));})[_0xe12c('0x3e')](handleError(_0x1b8e5f,null));};exports['show']=function(_0x51d22b,_0x54c99b){var _0x32c05f={'raw':![],'where':{'id':_0x51d22b[_0xe12c('0x3f')]['id']}},_0x2a2a9f={};_0x2a2a9f[_0xe12c('0x2f')]=_[_0xe12c('0x2b')](db[_0xe12c('0x29')][_0xe12c('0x40')]);_0x2a2a9f[_0xe12c('0x2c')]=_[_0xe12c('0x2b')](_0x51d22b[_0xe12c('0x2c')]);_0x2a2a9f[_0xe12c('0x2d')]=_[_0xe12c('0x2e')](_0x2a2a9f[_0xe12c('0x2f')],_0x2a2a9f['query']);_0x32c05f[_0xe12c('0x30')]=_[_0xe12c('0x2e')](_0x2a2a9f[_0xe12c('0x2f')],qs[_0xe12c('0x31')](_0x51d22b['query']['fields']));_0x32c05f[_0xe12c('0x30')]=_0x32c05f[_0xe12c('0x30')]['length']?_0x32c05f[_0xe12c('0x30')]:_0x2a2a9f['model'];if(_0x51d22b[_0xe12c('0x2c')][_0xe12c('0x3a')]){_0x32c05f['include']=[{'all':!![]}];}_0x32c05f=_[_0xe12c('0x37')]({},_0x32c05f,_0x51d22b[_0xe12c('0x38')]);return db['CmCompany'][_0xe12c('0x41')](_0x32c05f)[_0xe12c('0x20')](handleEntityNotFound(_0x54c99b,null))[_0xe12c('0x20')](respondWithResult(_0x54c99b,null))[_0xe12c('0x3e')](handleError(_0x54c99b,null));};exports[_0xe12c('0x42')]=function(_0x3bba5,_0x48365c){return db[_0xe12c('0x29')][_0xe12c('0x42')](_0x3bba5[_0xe12c('0x43')],{})['then'](function(_0x225d4e){var _0x564ded=_0x3bba5['user'][_0xe12c('0x21')]({'plain':!![]});if(!_0x564ded)throw new Error(_0xe12c('0x44'));if(_0x564ded[_0xe12c('0x45')]==='user'){var _0x1892b6=_0x225d4e[_0xe12c('0x21')]({'plain':!![]});var _0x2f5329=_0xe12c('0x22');return db[_0xe12c('0x46')][_0xe12c('0x41')]({'where':{'name':_0x2f5329,'userProfileId':_0x564ded[_0xe12c('0x47')]},'raw':!![]})[_0xe12c('0x20')](function(_0xd1f806){if(_0xd1f806&&_0xd1f806[_0xe12c('0x48')]===0x0){return db[_0xe12c('0x23')][_0xe12c('0x42')]({'name':_0x1892b6['name'],'resourceId':_0x1892b6['id'],'type':_0xd1f806[_0xe12c('0x27')],'sectionId':_0xd1f806['id']},{})['then'](function(){return _0x225d4e;});}else{return _0x225d4e;}})[_0xe12c('0x3e')](function(_0x150012){logger['error'](_0xe12c('0x49'),_0x150012);throw _0x150012;});}return _0x225d4e;})[_0xe12c('0x20')](respondWithResult(_0x48365c,0xc9))[_0xe12c('0x3e')](handleError(_0x48365c,null));};exports[_0xe12c('0x4a')]=function(_0x10be23,_0x1eed81){if(_0x10be23[_0xe12c('0x43')]['id']){delete _0x10be23[_0xe12c('0x43')]['id'];}return db[_0xe12c('0x29')][_0xe12c('0x41')]({'where':{'id':_0x10be23[_0xe12c('0x3f')]['id']}})[_0xe12c('0x20')](handleEntityNotFound(_0x1eed81,null))[_0xe12c('0x20')](saveUpdates(_0x10be23[_0xe12c('0x43')],null))[_0xe12c('0x20')](respondWithResult(_0x1eed81,null))[_0xe12c('0x3e')](handleError(_0x1eed81,null));};exports[_0xe12c('0x4b')]=function(_0x298284,_0xaf88b7){return db[_0xe12c('0x29')]['find']({'where':{'id':_0x298284[_0xe12c('0x3f')]['id']}})[_0xe12c('0x20')](handleEntityNotFound(_0xaf88b7,null))['then'](removeEntity(_0xaf88b7,null))['catch'](handleError(_0xaf88b7,null));};exports[_0xe12c('0x2a')]=function(_0x270d61,_0x377a12){return db[_0xe12c('0x29')]['describe']()[_0xe12c('0x20')](respondWithResult(_0x377a12,null))['catch'](handleError(_0x377a12,null));};exports[_0xe12c('0x4c')]=function(_0x1c3775,_0x423329,_0x3b50ae){return db['CmContact'][_0xe12c('0x41')]({'where':{'id':_0x1c3775[_0xe12c('0x3f')]['id']}})[_0xe12c('0x20')](handleEntityNotFound(_0x423329,null))[_0xe12c('0x20')](function(_0x64ebb6){if(_0x64ebb6){return _0x64ebb6['addContacts'](_0x1c3775[_0xe12c('0x43')]['ids'],_[_0xe12c('0x4d')](_0x1c3775[_0xe12c('0x43')],[_0xe12c('0x4e'),'id'])||{});}})[_0xe12c('0x20')](respondWithResult(_0x423329,null))['catch'](handleError(_0x423329,null));};exports[_0xe12c('0x4f')]=function(_0x2140d7,_0x16f123,_0x2abbf5){var _0x2a8285={};var _0x37fc3f={};var _0x42333a;var _0x1bf63d;return db[_0xe12c('0x29')][_0xe12c('0x50')]({'where':{'id':_0x2140d7[_0xe12c('0x3f')]['id']}})[_0xe12c('0x20')](handleEntityNotFound(_0x16f123,null))['then'](function(_0x438010){if(_0x438010){_0x42333a=_0x438010;_0x37fc3f[_0xe12c('0x2f')]=_[_0xe12c('0x2b')](db[_0xe12c('0x51')][_0xe12c('0x40')]);_0x37fc3f[_0xe12c('0x2c')]=_['keys'](_0x2140d7[_0xe12c('0x2c')]);_0x37fc3f[_0xe12c('0x2d')]=_[_0xe12c('0x2e')](_0x37fc3f[_0xe12c('0x2f')],_0x37fc3f[_0xe12c('0x2c')]);_0x2a8285[_0xe12c('0x30')]=_[_0xe12c('0x2e')](_0x37fc3f['model'],qs[_0xe12c('0x31')](_0x2140d7[_0xe12c('0x2c')][_0xe12c('0x31')]));_0x2a8285[_0xe12c('0x30')]=_0x2a8285[_0xe12c('0x30')][_0xe12c('0x52')]?_0x2a8285[_0xe12c('0x30')]:_0x37fc3f[_0xe12c('0x2f')];_0x2a8285['order']=qs[_0xe12c('0x34')](_0x2140d7[_0xe12c('0x2c')][_0xe12c('0x34')]);_0x2a8285[_0xe12c('0x35')]=qs[_0xe12c('0x2d')](_[_0xe12c('0x53')](_0x2140d7['query'],_0x37fc3f[_0xe12c('0x2d')]));if(_0x2140d7[_0xe12c('0x2c')][_0xe12c('0x36')]){_0x2a8285['where']=_['merge'](_0x2a8285[_0xe12c('0x35')],{'$or':_[_0xe12c('0x54')](_0x2a8285[_0xe12c('0x30')],function(_0x3dd723){var _0x71138c={};_0x71138c[_0x3dd723]={'$like':'%'+_0x2140d7[_0xe12c('0x2c')][_0xe12c('0x36')]+'%'};return _0x71138c;})});}_0x2a8285=_['merge']({},_0x2a8285,_0x2140d7[_0xe12c('0x38')]);return _0x42333a[_0xe12c('0x4f')](_0x2a8285);}})[_0xe12c('0x20')](function(_0x5f278c){if(_0x5f278c){_0x1bf63d=_0x5f278c['length'];if(!_0x2140d7[_0xe12c('0x2c')][_0xe12c('0x32')](_0xe12c('0x33'))){_0x2a8285[_0xe12c('0x1a')]=qs[_0xe12c('0x1a')](_0x2140d7[_0xe12c('0x2c')][_0xe12c('0x1a')]);_0x2a8285[_0xe12c('0x19')]=qs['offset'](_0x2140d7[_0xe12c('0x2c')][_0xe12c('0x19')]);}return _0x42333a[_0xe12c('0x4f')](_0x2a8285);}})['then'](function(_0x5e7961){if(_0x5e7961){return _0x5e7961?{'count':_0x1bf63d,'rows':_0x5e7961}:null;}})[_0xe12c('0x20')](respondWithResult(_0x16f123,null))['catch'](handleError(_0x16f123,null));}; \ No newline at end of file +var _0x6aee=['lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','apply','reject','save','destroy','get','Companies','then','sendStatus','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','options','include','findAll','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','addContacts','ids','omit','getContacts','findOne','rawAttributes','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox'];(function(_0x13610a,_0x4f866c){var _0x150ecc=function(_0x383f46){while(--_0x383f46){_0x13610a['push'](_0x13610a['shift']());}};_0x150ecc(++_0x4f866c);}(_0x6aee,0x13f));var _0xe6ae=function(_0x382c64,_0x22d880){_0x382c64=_0x382c64-0x0;var _0x36591c=_0x6aee[_0x382c64];return _0x36591c;};'use strict';var pdf=require(_0xe6ae('0x0'));var emlformat=require(_0xe6ae('0x1'));var rimraf=require(_0xe6ae('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe6ae('0x3'));var moment=require(_0xe6ae('0x4'));var BPromise=require(_0xe6ae('0x5'));var Mustache=require('mustache');var util=require(_0xe6ae('0x6'));var path=require(_0xe6ae('0x7'));var sox=require(_0xe6ae('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe6ae('0x9'));var squel=require('squel');var crypto=require(_0xe6ae('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe6ae('0xb'));var Papa=require('papaparse');var Redis=require(_0xe6ae('0xc'));var authService=require(_0xe6ae('0xd'));var qs=require(_0xe6ae('0xe'));var as=require(_0xe6ae('0xf'));var hardwareService=require(_0xe6ae('0x10'));var logger=require(_0xe6ae('0x11'))(_0xe6ae('0x12'));var utils=require(_0xe6ae('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe6ae('0x14'));var db=require(_0xe6ae('0x15'))['db'];function respondWithStatusCode(_0x4bf7c1,_0x311bde){_0x311bde=_0x311bde||0xcc;return function(_0x1b5e30){if(_0x1b5e30){return _0x4bf7c1['sendStatus'](_0x311bde);}return _0x4bf7c1['status'](_0x311bde)[_0xe6ae('0x16')]();};}function respondWithResult(_0x53bc5b,_0x22885f){_0x22885f=_0x22885f||0xc8;return function(_0x2fceb7){if(_0x2fceb7){return _0x53bc5b[_0xe6ae('0x17')](_0x22885f)[_0xe6ae('0x18')](_0x2fceb7);}};}function respondWithFilteredResult(_0x10a743,_0x39b77e){return function(_0x43ef3f){if(_0x43ef3f){var _0x42303b=_0x43ef3f[_0xe6ae('0x19')],_0x373af2=_0x39b77e[_0xe6ae('0x1a')],_0x2e5563=_0x39b77e['offset']+_0x39b77e[_0xe6ae('0x1b')],_0x50d86b;if(_0x2e5563>=_0x42303b){_0x2e5563=_0x42303b;_0x50d86b=0xc8;}else{_0x50d86b=0xce;}_0x10a743[_0xe6ae('0x17')](_0x50d86b);return _0x10a743[_0xe6ae('0x1c')]('Content-Range',_0x373af2+'-'+_0x2e5563+'/'+_0x42303b)[_0xe6ae('0x18')](_0x43ef3f);}return null;};}function patchUpdates(_0x3a1193){return function(_0x4be3d4){try{jsonpatch[_0xe6ae('0x1d')](_0x4be3d4,_0x3a1193,!![]);}catch(_0x21bd45){return BPromise[_0xe6ae('0x1e')](_0x21bd45);}return _0x4be3d4[_0xe6ae('0x1f')]();};}function saveUpdates(_0x17685d,_0x20c78c){return function(_0x50ee3e){if(_0x50ee3e){return _0x50ee3e['update'](_0x17685d)['then'](function(_0x3009ad){return _0x3009ad;});}return null;};}function removeEntity(_0x214083,_0x10ce61){return function(_0x4281b5){if(_0x4281b5){return _0x4281b5[_0xe6ae('0x20')]()['then'](function(){var _0x2902a6=_0x4281b5[_0xe6ae('0x21')]({'plain':!![]});var _0x1b692a=_0xe6ae('0x22');return db['UserProfileResource'][_0xe6ae('0x20')]({'where':{'type':_0x1b692a,'resourceId':_0x2902a6['id']}})[_0xe6ae('0x23')](function(){return _0x4281b5;});})['then'](function(){_0x214083[_0xe6ae('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e035f,_0x99f6e9){return function(_0x57490f){if(!_0x57490f){_0x2e035f[_0xe6ae('0x24')](0x194);}return _0x57490f;};}function handleError(_0x35a60a,_0x4206be){_0x4206be=_0x4206be||0x1f4;return function(_0x2f50b3){logger[_0xe6ae('0x25')](_0x2f50b3[_0xe6ae('0x26')]);if(_0x2f50b3[_0xe6ae('0x27')]){delete _0x2f50b3[_0xe6ae('0x27')];}_0x35a60a[_0xe6ae('0x17')](_0x4206be)[_0xe6ae('0x28')](_0x2f50b3);};}exports[_0xe6ae('0x29')]=function(_0x1bc121,_0x211f13){var _0xf9340f={},_0x85af30={},_0x4bdd3a={'count':0x0,'rows':[]};return db[_0xe6ae('0x2a')][_0xe6ae('0x2b')]()[_0xe6ae('0x23')](function(_0x593dda){_0x85af30[_0xe6ae('0x2c')]=_[_0xe6ae('0x2d')](_0x593dda);_0x85af30['query']=_['keys'](_0x1bc121[_0xe6ae('0x2e')]);_0x85af30[_0xe6ae('0x2f')]=_[_0xe6ae('0x30')](_0x85af30[_0xe6ae('0x2c')],_0x85af30[_0xe6ae('0x2e')]);_0xf9340f['attributes']=_['intersection'](_0x85af30[_0xe6ae('0x2c')],qs[_0xe6ae('0x31')](_0x1bc121[_0xe6ae('0x2e')][_0xe6ae('0x31')]));_0xf9340f[_0xe6ae('0x32')]=_0xf9340f[_0xe6ae('0x32')]['length']?_0xf9340f['attributes']:_0x85af30[_0xe6ae('0x2c')];if(!_0x1bc121['query'][_0xe6ae('0x33')](_0xe6ae('0x34'))){_0xf9340f[_0xe6ae('0x1b')]=qs[_0xe6ae('0x1b')](_0x1bc121[_0xe6ae('0x2e')][_0xe6ae('0x1b')]);_0xf9340f[_0xe6ae('0x1a')]=qs[_0xe6ae('0x1a')](_0x1bc121[_0xe6ae('0x2e')]['offset']);}_0xf9340f[_0xe6ae('0x35')]=qs[_0xe6ae('0x36')](_0x1bc121[_0xe6ae('0x2e')][_0xe6ae('0x36')]);_0xf9340f['where']=qs[_0xe6ae('0x2f')](_[_0xe6ae('0x37')](_0x1bc121['query'],_0x85af30[_0xe6ae('0x2f')]),_0x593dda);if(_0x1bc121['query'][_0xe6ae('0x38')]){_0xf9340f[_0xe6ae('0x39')]=_[_0xe6ae('0x3a')](_0xf9340f['where'],{'$or':_[_0xe6ae('0x3b')](_0xf9340f[_0xe6ae('0x32')],function(_0xe8ad1a){var _0x2ad0fc={};_0x2ad0fc[_0xe8ad1a]={'$like':'%'+_0x1bc121[_0xe6ae('0x2e')][_0xe6ae('0x38')]+'%'};return _0x2ad0fc;})});}_0xf9340f=_[_0xe6ae('0x3a')]({},_0xf9340f,_0x1bc121[_0xe6ae('0x3c')]);var _0xb57c3c={'where':_0xf9340f['where']};return db[_0xe6ae('0x2a')][_0xe6ae('0x19')](_0xb57c3c)[_0xe6ae('0x23')](function(_0x1615c3){_0x4bdd3a['count']=_0x1615c3;if(_0x1bc121[_0xe6ae('0x2e')]['includeAll']){_0xf9340f[_0xe6ae('0x3d')]=[{'all':!![]}];}return db[_0xe6ae('0x2a')][_0xe6ae('0x3e')](_0xf9340f);})[_0xe6ae('0x23')](function(_0xfe5e41){_0x4bdd3a['rows']=_0xfe5e41;return _0x4bdd3a;})['then'](respondWithFilteredResult(_0x211f13,_0xf9340f))[_0xe6ae('0x3f')](handleError(_0x211f13,null));})[_0xe6ae('0x3f')](handleError(_0x211f13,null));};exports[_0xe6ae('0x40')]=function(_0x48f506,_0x283f7d){var _0x15be3c={'raw':![],'where':{'id':_0x48f506[_0xe6ae('0x41')]['id']}},_0x304a28={};_0x304a28[_0xe6ae('0x2c')]=_['keys'](db[_0xe6ae('0x2a')]['rawAttributes']);_0x304a28[_0xe6ae('0x2e')]=_[_0xe6ae('0x2d')](_0x48f506['query']);_0x304a28[_0xe6ae('0x2f')]=_[_0xe6ae('0x30')](_0x304a28[_0xe6ae('0x2c')],_0x304a28[_0xe6ae('0x2e')]);_0x15be3c[_0xe6ae('0x32')]=_[_0xe6ae('0x30')](_0x304a28[_0xe6ae('0x2c')],qs['fields'](_0x48f506[_0xe6ae('0x2e')]['fields']));_0x15be3c[_0xe6ae('0x32')]=_0x15be3c[_0xe6ae('0x32')][_0xe6ae('0x42')]?_0x15be3c[_0xe6ae('0x32')]:_0x304a28[_0xe6ae('0x2c')];if(_0x48f506['query'][_0xe6ae('0x43')]){_0x15be3c['include']=[{'all':!![]}];}_0x15be3c=_[_0xe6ae('0x3a')]({},_0x15be3c,_0x48f506[_0xe6ae('0x3c')]);return db[_0xe6ae('0x2a')][_0xe6ae('0x44')](_0x15be3c)['then'](handleEntityNotFound(_0x283f7d,null))['then'](respondWithResult(_0x283f7d,null))[_0xe6ae('0x3f')](handleError(_0x283f7d,null));};exports[_0xe6ae('0x45')]=function(_0x598056,_0x17cd2a){return db[_0xe6ae('0x2a')][_0xe6ae('0x45')](_0x598056[_0xe6ae('0x46')],{})[_0xe6ae('0x23')](function(_0x43c6c0){var _0x3766a9=_0x598056[_0xe6ae('0x47')][_0xe6ae('0x21')]({'plain':!![]});if(!_0x3766a9)throw new Error(_0xe6ae('0x48'));if(_0x3766a9['role']===_0xe6ae('0x47')){var _0x40c5d3=_0x43c6c0['get']({'plain':!![]});var _0x3cd2d7=_0xe6ae('0x22');return db['UserProfileSection'][_0xe6ae('0x44')]({'where':{'name':_0x3cd2d7,'userProfileId':_0x3766a9[_0xe6ae('0x49')]},'raw':!![]})[_0xe6ae('0x23')](function(_0x1d7ff9){if(_0x1d7ff9&&_0x1d7ff9[_0xe6ae('0x4a')]===0x0){return db[_0xe6ae('0x4b')][_0xe6ae('0x45')]({'name':_0x40c5d3[_0xe6ae('0x27')],'resourceId':_0x40c5d3['id'],'type':_0x1d7ff9[_0xe6ae('0x27')],'sectionId':_0x1d7ff9['id']},{})[_0xe6ae('0x23')](function(){return _0x43c6c0;});}else{return _0x43c6c0;}})[_0xe6ae('0x3f')](function(_0x364d53){logger[_0xe6ae('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x364d53);throw _0x364d53;});}return _0x43c6c0;})[_0xe6ae('0x23')](respondWithResult(_0x17cd2a,0xc9))[_0xe6ae('0x3f')](handleError(_0x17cd2a,null));};exports['update']=function(_0x1149f7,_0x189768){if(_0x1149f7['body']['id']){delete _0x1149f7[_0xe6ae('0x46')]['id'];}return db[_0xe6ae('0x2a')]['find']({'where':{'id':_0x1149f7[_0xe6ae('0x41')]['id']}})['then'](handleEntityNotFound(_0x189768,null))[_0xe6ae('0x23')](saveUpdates(_0x1149f7[_0xe6ae('0x46')],null))[_0xe6ae('0x23')](respondWithResult(_0x189768,null))['catch'](handleError(_0x189768,null));};exports['destroy']=function(_0x34432c,_0x30cbad){return db[_0xe6ae('0x2a')][_0xe6ae('0x44')]({'where':{'id':_0x34432c[_0xe6ae('0x41')]['id']}})[_0xe6ae('0x23')](handleEntityNotFound(_0x30cbad,null))[_0xe6ae('0x23')](removeEntity(_0x30cbad,null))[_0xe6ae('0x3f')](handleError(_0x30cbad,null));};exports[_0xe6ae('0x2b')]=function(_0x4e9946,_0x5ef3c4){return db[_0xe6ae('0x2a')][_0xe6ae('0x2b')]()[_0xe6ae('0x23')](respondWithResult(_0x5ef3c4,null))[_0xe6ae('0x3f')](handleError(_0x5ef3c4,null));};exports[_0xe6ae('0x4c')]=function(_0x37b605,_0x52f4a8,_0x14ac79){return db['CmContact'][_0xe6ae('0x44')]({'where':{'id':_0x37b605[_0xe6ae('0x41')]['id']}})[_0xe6ae('0x23')](handleEntityNotFound(_0x52f4a8,null))[_0xe6ae('0x23')](function(_0x29e3be){if(_0x29e3be){return _0x29e3be['addContacts'](_0x37b605['body'][_0xe6ae('0x4d')],_[_0xe6ae('0x4e')](_0x37b605[_0xe6ae('0x46')],[_0xe6ae('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x52f4a8,null))[_0xe6ae('0x3f')](handleError(_0x52f4a8,null));};exports[_0xe6ae('0x4f')]=function(_0x18bbbf,_0x46caa1,_0x3efb59){var _0x14ba2b={};var _0x5c6407={};var _0x57f68a;var _0x49ca6c;return db[_0xe6ae('0x2a')][_0xe6ae('0x50')]({'where':{'id':_0x18bbbf[_0xe6ae('0x41')]['id']}})['then'](handleEntityNotFound(_0x46caa1,null))[_0xe6ae('0x23')](function(_0x3b5f8f){if(_0x3b5f8f){_0x57f68a=_0x3b5f8f;_0x5c6407[_0xe6ae('0x2c')]=_[_0xe6ae('0x2d')](db['CmContact'][_0xe6ae('0x51')]);_0x5c6407[_0xe6ae('0x2e')]=_['keys'](_0x18bbbf[_0xe6ae('0x2e')]);_0x5c6407['filters']=_[_0xe6ae('0x30')](_0x5c6407[_0xe6ae('0x2c')],_0x5c6407[_0xe6ae('0x2e')]);_0x14ba2b[_0xe6ae('0x32')]=_[_0xe6ae('0x30')](_0x5c6407[_0xe6ae('0x2c')],qs[_0xe6ae('0x31')](_0x18bbbf['query'][_0xe6ae('0x31')]));_0x14ba2b[_0xe6ae('0x32')]=_0x14ba2b[_0xe6ae('0x32')][_0xe6ae('0x42')]?_0x14ba2b[_0xe6ae('0x32')]:_0x5c6407[_0xe6ae('0x2c')];_0x14ba2b[_0xe6ae('0x35')]=qs[_0xe6ae('0x36')](_0x18bbbf[_0xe6ae('0x2e')][_0xe6ae('0x36')]);_0x14ba2b[_0xe6ae('0x39')]=qs[_0xe6ae('0x2f')](_[_0xe6ae('0x37')](_0x18bbbf[_0xe6ae('0x2e')],_0x5c6407['filters']));if(_0x18bbbf['query'][_0xe6ae('0x38')]){_0x14ba2b[_0xe6ae('0x39')]=_[_0xe6ae('0x3a')](_0x14ba2b[_0xe6ae('0x39')],{'$or':_[_0xe6ae('0x3b')](_0x14ba2b[_0xe6ae('0x32')],function(_0x3f2c0a){var _0x27f127={};_0x27f127[_0x3f2c0a]={'$like':'%'+_0x18bbbf[_0xe6ae('0x2e')][_0xe6ae('0x38')]+'%'};return _0x27f127;})});}_0x14ba2b=_[_0xe6ae('0x3a')]({},_0x14ba2b,_0x18bbbf[_0xe6ae('0x3c')]);return _0x57f68a[_0xe6ae('0x4f')](_0x14ba2b);}})[_0xe6ae('0x23')](function(_0x5b59b5){if(_0x5b59b5){_0x49ca6c=_0x5b59b5[_0xe6ae('0x42')];if(!_0x18bbbf[_0xe6ae('0x2e')][_0xe6ae('0x33')](_0xe6ae('0x34'))){_0x14ba2b[_0xe6ae('0x1b')]=qs[_0xe6ae('0x1b')](_0x18bbbf[_0xe6ae('0x2e')]['limit']);_0x14ba2b[_0xe6ae('0x1a')]=qs['offset'](_0x18bbbf[_0xe6ae('0x2e')][_0xe6ae('0x1a')]);}return _0x57f68a['getContacts'](_0x14ba2b);}})[_0xe6ae('0x23')](function(_0x51f8b2){if(_0x51f8b2){return _0x51f8b2?{'count':_0x49ca6c,'rows':_0x51f8b2}:null;}})['then'](respondWithResult(_0x46caa1,null))[_0xe6ae('0x3f')](handleError(_0x46caa1,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 3db5e17..c9379e5 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 _0x291c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','CmCompany','cm_companies','lodash'];(function(_0x4bdc6e,_0x2a8cb1){var _0x4eb14a=function(_0x279133){while(--_0x279133){_0x4bdc6e['push'](_0x4bdc6e['shift']());}};_0x4eb14a(++_0x2a8cb1);}(_0x291c,0x137));var _0xc291=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x291c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc291('0x0'));var util=require(_0xc291('0x1'));var logger=require(_0xc291('0x2'))(_0xc291('0x3'));var moment=require(_0xc291('0x4'));var BPromise=require(_0xc291('0x5'));var rp=require(_0xc291('0x6'));var fs=require('fs');var path=require(_0xc291('0x7'));var rimraf=require(_0xc291('0x8'));var config=require(_0xc291('0x9'));var attributes=require(_0xc291('0xa'));module['exports']=function(_0x2c96a8,_0x5f2563){return _0x2c96a8['define'](_0xc291('0xb'),attributes,{'tableName':_0xc291('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9e8=['rimraf','./cmCompany.attributes','exports','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3b31b0,_0x520f66){var _0x1d1520=function(_0x256409){while(--_0x256409){_0x3b31b0['push'](_0x3b31b0['shift']());}};_0x1d1520(++_0x520f66);}(_0xe9e8,0x179));var _0x8e9e=function(_0x24fee7,_0x144bd9){_0x24fee7=_0x24fee7-0x0;var _0x513e6f=_0xe9e8[_0x24fee7];return _0x513e6f;};'use strict';var _=require(_0x8e9e('0x0'));var util=require(_0x8e9e('0x1'));var logger=require(_0x8e9e('0x2'))(_0x8e9e('0x3'));var moment=require(_0x8e9e('0x4'));var BPromise=require(_0x8e9e('0x5'));var rp=require(_0x8e9e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e9e('0x7'));var config=require('../../config/environment');var attributes=require(_0x8e9e('0x8'));module[_0x8e9e('0x9')]=function(_0x3b5e8d,_0x5de00e){return _0x3b5e8d['define'](_0x8e9e('0xa'),attributes,{'tableName':_0x8e9e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 6b83604..a821f1d 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 _0x164b=['moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util'];(function(_0x419785,_0xf6f426){var _0x324ae1=function(_0x4eb655){while(--_0x4eb655){_0x419785['push'](_0x419785['shift']());}};_0x324ae1(++_0xf6f426);}(_0x164b,0x106));var _0xb164=function(_0xdc6b85,_0x45fcf5){_0xdc6b85=_0xdc6b85-0x0;var _0x3839a0=_0x164b[_0xdc6b85];return _0x3839a0;};'use strict';var _=require(_0xb164('0x0'));var util=require(_0xb164('0x1'));var moment=require(_0xb164('0x2'));var BPromise=require(_0xb164('0x3'));var rs=require(_0xb164('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb164('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb164('0x6'));var config=require(_0xb164('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb164('0x8')][_0xb164('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ad0f4,_0x1b8232,_0x52bcdc){return new BPromise(function(_0x338bc8,_0xc00efc){return client[_0xb164('0xa')](_0x4ad0f4,_0x52bcdc)[_0xb164('0xb')](function(_0x11f571){logger[_0xb164('0xc')]('CmCompany,\x20%s,\x20%s',_0x1b8232,'request\x20sent');logger['debug'](_0xb164('0xd'),_0x1b8232,'request\x20sent',JSON[_0xb164('0xe')](_0x11f571));if(_0x11f571['error']){if(_0x11f571[_0xb164('0xf')][_0xb164('0x10')]===0x1f4){logger[_0xb164('0xf')]('CmCompany,\x20%s,\x20%s',_0x1b8232,_0x11f571[_0xb164('0xf')]['message']);return _0xc00efc(_0x11f571[_0xb164('0xf')]['message']);}logger[_0xb164('0xf')](_0xb164('0x11'),_0x1b8232,_0x11f571[_0xb164('0xf')][_0xb164('0x12')]);return _0x338bc8(_0x11f571[_0xb164('0xf')][_0xb164('0x12')]);}else{logger[_0xb164('0xc')](_0xb164('0x11'),_0x1b8232,_0xb164('0x13'));_0x338bc8(_0x11f571[_0xb164('0x14')][_0xb164('0x12')]);}})[_0xb164('0x15')](function(_0x35add6){logger[_0xb164('0xf')]('CmCompany,\x20%s,\x20%s',_0x1b8232,_0x35add6);_0xc00efc(_0x35add6);});});} \ No newline at end of file +var _0x869e=['CmCompany,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','jayson/promise','client','http','request','then'];(function(_0x4d3924,_0x327b56){var _0x844555=function(_0x387a6d){while(--_0x387a6d){_0x4d3924['push'](_0x4d3924['shift']());}};_0x844555(++_0x327b56);}(_0x869e,0x193));var _0xe869=function(_0x1979b9,_0xf6ef85){_0x1979b9=_0x1979b9-0x0;var _0x1e24b9=_0x869e[_0x1979b9];return _0x1e24b9;};'use strict';var _=require(_0xe869('0x0'));var util=require(_0xe869('0x1'));var moment=require(_0xe869('0x2'));var BPromise=require(_0xe869('0x3'));var rs=require(_0xe869('0x4'));var fs=require('fs');var Redis=require(_0xe869('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe869('0x6'));var client=jayson[_0xe869('0x7')][_0xe869('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x208791,_0x4e73d0,_0x131a48){return new BPromise(function(_0x48b95c,_0x5e821f){return client[_0xe869('0x9')](_0x208791,_0x131a48)[_0xe869('0xa')](function(_0x1f38d2){logger['info'](_0xe869('0xb'),_0x4e73d0,_0xe869('0xc'));logger['debug']('CmCompany,\x20%s,\x20%s,\x20%s',_0x4e73d0,_0xe869('0xc'),JSON['stringify'](_0x1f38d2));if(_0x1f38d2['error']){if(_0x1f38d2[_0xe869('0xd')][_0xe869('0xe')]===0x1f4){logger[_0xe869('0xd')](_0xe869('0xb'),_0x4e73d0,_0x1f38d2[_0xe869('0xd')]['message']);return _0x5e821f(_0x1f38d2['error'][_0xe869('0xf')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0x4e73d0,_0x1f38d2['error']['message']);return _0x48b95c(_0x1f38d2[_0xe869('0xd')][_0xe869('0xf')]);}else{logger[_0xe869('0x10')](_0xe869('0xb'),_0x4e73d0,_0xe869('0xc'));_0x48b95c(_0x1f38d2['result'][_0xe869('0xf')]);}})[_0xe869('0x11')](function(_0x3821f6){logger[_0xe869('0xd')](_0xe869('0xb'),_0x4e73d0,_0x3821f6);_0x5e821f(_0x3821f6);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 07c6c62..acefad8 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 _0xe2fe=['destroy','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','/describe','get','show','/:id/contacts','post','put','/:id','update','delete'];(function(_0x545ab1,_0x268752){var _0x207f40=function(_0x24ec58){while(--_0x24ec58){_0x545ab1['push'](_0x545ab1['shift']());}};_0x207f40(++_0x268752);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'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']('/',auth[_0xee2f('0x7')](),controller[_0xee2f('0x8')]);router['get'](_0xee2f('0x9'),auth[_0xee2f('0x7')](),controller['describe']);router[_0xee2f('0xa')]('/:id',auth[_0xee2f('0x7')](),controller[_0xee2f('0xb')]);router['get'](_0xee2f('0xc'),auth[_0xee2f('0x7')](),controller['getContacts']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xee2f('0xd')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router[_0xee2f('0xe')](_0xee2f('0xf'),auth[_0xee2f('0x7')](),controller[_0xee2f('0x10')]);router[_0xee2f('0x11')](_0xee2f('0xf'),auth['isAuthenticated'](),controller[_0xee2f('0x12')]);module['exports']=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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xe3da,0x1cd));var _0xae3d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe3da[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var 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 8c9173d..da7eda7 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 _0x11f5=['DATE','NOW','lodash','exports','STRING','INTEGER'];(function(_0x4ca83c,_0x34ebce){var _0xadd149=function(_0x4797df){while(--_0x4797df){_0x4ca83c['push'](_0x4ca83c['shift']());}};_0xadd149(++_0x34ebce);}(_0x11f5,0x1ee));var _0x511f=function(_0x49930e,_0x1a088e){_0x49930e=_0x49930e-0x0;var _0x2bcc2f=_0x11f5[_0x49930e];return _0x2bcc2f;};'use strict';var _=require(_0x511f('0x0'));var Sequelize=require('sequelize');module[_0x511f('0x1')]={'firstName':{'type':Sequelize[_0x511f('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x511f('0x2')]},'street':{'type':Sequelize[_0x511f('0x2')]},'postalCode':{'type':Sequelize[_0x511f('0x2')]},'city':{'type':Sequelize[_0x511f('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x511f('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x511f('0x2')]},'email':{'type':Sequelize[_0x511f('0x2')]},'url':{'type':Sequelize[_0x511f('0x2')]},'facebook':{'type':Sequelize[_0x511f('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x511f('0x2')]},'teams':{'type':Sequelize[_0x511f('0x2')]},'viber':{'type':Sequelize[_0x511f('0x2')]},'line':{'type':Sequelize[_0x511f('0x2')]},'wechat':{'type':Sequelize[_0x511f('0x2')]},'telegram':{'type':Sequelize[_0x511f('0x2')]},'UserId':{'type':Sequelize[_0x511f('0x3')]},'priority':{'type':Sequelize[_0x511f('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x511f('0x4')],'defaultValue':Sequelize[_0x511f('0x5')]}}; \ No newline at end of file +var _0x400e=['lodash','sequelize','STRING','INTEGER','UNSIGNED','DATE','NOW'];(function(_0x2f62a3,_0x55062d){var _0x257293=function(_0x2fd31d){while(--_0x2fd31d){_0x2f62a3['push'](_0x2f62a3['shift']());}};_0x257293(++_0x55062d);}(_0x400e,0x15e));var _0xe400=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x400e[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xe400('0x0'));var Sequelize=require(_0xe400('0x1'));module['exports']={'firstName':{'type':Sequelize[_0xe400('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xe400('0x2')]},'street':{'type':Sequelize[_0xe400('0x2')]},'postalCode':{'type':Sequelize[_0xe400('0x2')]},'city':{'type':Sequelize[_0xe400('0x2')]},'country':{'type':Sequelize[_0xe400('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xe400('0x2')]},'mobile':{'type':Sequelize[_0xe400('0x2')]},'fax':{'type':Sequelize[_0xe400('0x2')]},'email':{'type':Sequelize[_0xe400('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xe400('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xe400('0x2')]},'skype':{'type':Sequelize[_0xe400('0x2')]},'teams':{'type':Sequelize[_0xe400('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xe400('0x3')]},'priority':{'type':Sequelize[_0xe400('0x3')](0x2)[_0xe400('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe400('0x5')],'defaultValue':Sequelize[_0xe400('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index b37fb82..a3002fe 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 _0xe87e=['No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','fork','CompanyId','File\x20uploaded\x20correctly!','pid','createReadStream','parse','meta','import','binding','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','getJourney','mail','chat','sms','whatsapp','voice','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','fullname','alias','findAndCountAll','startCase','Website','closed','closedAt','disposition','thirdDisposition','UserId','Account','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','substatus','openchannel','externalUrl','threadId','Interaction','flatten','reverse','slice','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmContact.socket','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','error','name','send','index','CmContact','describe','keys','length','startsWith','cf_','push','trimStart','all','fieldType','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','field','from','select','cm_contacts','left_join','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','tools_tags','t.id\x20=\x20ct.TagId','where','expr','search','parseSearch','sqlOperator','conditions','find','Tag','value','split','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','castTo','DATE','buildExpression','type','text','isNil','Contact','isEmpty','forEach','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','isArray','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.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','c.id','Sequelize','clone','DESC','having','t.id\x20IN\x20?','resolve','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','c.firstName','c.lastName','c.phone','c.fax','c.ListId','c.createdAt','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','destroy','params','tags','columnName','displayName','CmCustomField','findAll','custom','values','body','get','mergeWith','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','info','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','CmHopperFinal','CmHopperHistory','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','create','bulkCreate','each','duplicates','$or','findOrCreate','spread','show','color','$and','omit','format','cf_%d','table','setFields','id\x20=\x20?','toParam','phone','getTags','findOne','rawAttributes','merge','options','nolimit','setTags','getHoppers','include','getHopperHistories','ContactId','getHopperFinals','getJscriptySessions','JscriptySessionReport','includeAll','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName'];(function(_0x140896,_0x1a4f03){var _0x29f376=function(_0x8ef14c){while(--_0x8ef14c){_0x140896['push'](_0x140896['shift']());}};_0x29f376(++_0x1a4f03);}(_0xe87e,0x17d));var _0xee87=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0xe87e[_0x261522];return _0x98a25a;};'use strict';var pdf=require(_0xee87('0x0'));var emlformat=require(_0xee87('0x1'));var rimraf=require(_0xee87('0x2'));var zipdir=require(_0xee87('0x3'));var jsonpatch=require(_0xee87('0x4'));var rp=require('request-promise');var moment=require(_0xee87('0x5'));var BPromise=require(_0xee87('0x6'));var Mustache=require(_0xee87('0x7'));var util=require(_0xee87('0x8'));var path=require(_0xee87('0x9'));var sox=require(_0xee87('0xa'));var csv=require(_0xee87('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xee87('0xc'));var crypto=require(_0xee87('0xd'));var jsforce=require(_0xee87('0xe'));var deskjs=require(_0xee87('0xf'));var toCsv=require(_0xee87('0xb'));var querystring=require('querystring');var Papa=require(_0xee87('0x10'));var Redis=require(_0xee87('0x11'));var authService=require(_0xee87('0x12'));var qs=require(_0xee87('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee87('0x14'));var logger=require(_0xee87('0x15'))('api');var utils=require(_0xee87('0x16'));var config=require(_0xee87('0x17'));var licenseUtil=require(_0xee87('0x18'));var db=require(_0xee87('0x19'))['db'];config[_0xee87('0x1a')]=_[_0xee87('0x1b')](config[_0xee87('0x1a')],{'host':_0xee87('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xee87('0x1a')]));require(_0xee87('0x1d'))['register'](socket);function respondWithStatusCode(_0x4be77d,_0x37780f){_0x37780f=_0x37780f||0xcc;return function(_0x1d082a){if(_0x1d082a){return _0x4be77d['sendStatus'](_0x37780f);}return _0x4be77d[_0xee87('0x1e')](_0x37780f)[_0xee87('0x1f')]();};}function respondWithResult(_0x67df24,_0x2d1ae0){_0x2d1ae0=_0x2d1ae0||0xc8;return function(_0x5d80e7){if(_0x5d80e7){return _0x67df24[_0xee87('0x1e')](_0x2d1ae0)['json'](_0x5d80e7);}};}function respondWithFilteredResult(_0x2f7ad3,_0x305924){return function(_0x1fa2be){if(_0x1fa2be){var _0x5f378c=_0x1fa2be[_0xee87('0x20')],_0x48a330=_0x305924['offset'],_0x2a1feb=_0x305924[_0xee87('0x21')]+_0x305924[_0xee87('0x22')],_0xcde20a;if(_0x2a1feb>=_0x5f378c){_0x2a1feb=_0x5f378c;_0xcde20a=0xc8;}else{_0xcde20a=0xce;}_0x2f7ad3[_0xee87('0x1e')](_0xcde20a);return _0x2f7ad3[_0xee87('0x23')](_0xee87('0x24'),_0x48a330+'-'+_0x2a1feb+'/'+_0x5f378c)[_0xee87('0x25')](_0x1fa2be);}return null;};}function patchUpdates(_0x11c939){return function(_0x504d15){try{jsonpatch[_0xee87('0x26')](_0x504d15,_0x11c939,!![]);}catch(_0x443f31){return BPromise[_0xee87('0x27')](_0x443f31);}return _0x504d15[_0xee87('0x28')]();};}function saveUpdates(_0x3176c6,_0xd7236d){return function(_0x3cee83){if(_0x3cee83){return _0x3cee83[_0xee87('0x29')](_0x3176c6)[_0xee87('0x2a')](function(_0x49e9f5){return _0x49e9f5;});}return null;};}function removeEntity(_0x5cc9a3,_0x415073){return function(_0xbe7239){if(_0xbe7239){return _0xbe7239['destroy']()[_0xee87('0x2a')](function(){_0x5cc9a3[_0xee87('0x1e')](0xcc)[_0xee87('0x1f')]();});}};}function handleEntityNotFound(_0x55236e,_0x4f5c11){return function(_0x18dd0d){if(!_0x18dd0d){_0x55236e['sendStatus'](0x194);}return _0x18dd0d;};}function handleError(_0x36e381,_0x49bf41){_0x49bf41=_0x49bf41||0x1f4;return function(_0x2d2bae){logger[_0xee87('0x2b')](_0x2d2bae['stack']);if(_0x2d2bae[_0xee87('0x2c')]){delete _0x2d2bae[_0xee87('0x2c')];}_0x36e381[_0xee87('0x1e')](_0x49bf41)[_0xee87('0x2d')](_0x2d2bae);};}exports[_0xee87('0x2e')]=function(_0x5ac56a,_0x3eb538){var _0x439b55={},_0x3f3cd7={},_0x3daec7={'count':0x0,'rows':[]};return db[_0xee87('0x2f')][_0xee87('0x30')]()[_0xee87('0x2a')](function(_0x5bbd08){var _0x301651=[];for(var _0x21b9bb=0x0;_0x21b9bb0x1){_0x11c919['or'](_0xee87('0x6d'),qs[_0xee87('0x6e')](_0x58dbdb),null);}else{if(qs[_0xee87('0x6f')](_0x58dbdb)){_0x11c919['or'](_0xee87('0x70'),_0x58dbdb+'%');_0x11c919['or'](_0xee87('0x71'),_0x58dbdb+'%');_0x11c919['or']('c.mobile\x20LIKE\x20?',_0x58dbdb+'%');_0x11c919['or'](_0xee87('0x72'),_0x58dbdb+'%');}else if(qs[_0xee87('0x73')](_0x58dbdb)){_0x11c919['or'](_0xee87('0x74'),_0x58dbdb+'%');}else{_0x11c919['or'](_0xee87('0x75'),'%'+_0x58dbdb+'%');_0x11c919['or']('c.lastName\x20LIKE\x20?','%'+_0x58dbdb+'%');_0x11c919['or'](_0xee87('0x74'),'%'+_0x58dbdb+'%');}}}}_0x105c15['where'](_0x11c919);_0x105c15[_0xee87('0x76')](_0xee87('0x77'));var _0x71f12d={'type':db[_0xee87('0x78')]['QueryTypes']['SELECT'],'raw':!![]};var _0x342a8b=_0x105c15[_0xee87('0x79')]()['field'](_0xee87('0x77'));if(_0x439b55[_0xee87('0x40')]){_0x439b55[_0xee87('0x40')][_0xee87('0x64')](function(_0x4c4dfb){_0x105c15['order']('c.'+_0x4c4dfb[0x0],_0x4c4dfb[0x1]===_0xee87('0x7a')?![]:!![]);});}if(!_[_0xee87('0x63')](_0x153c7e)){_0x105c15[_0xee87('0x7b')](_0x24408b);_0x342a8b[_0xee87('0x4d')](_0xee87('0x7c'),_0x153c7e);}BPromise[_0xee87('0x7d')]()[_0xee87('0x2a')](function(){if(!_0x16447f)return;if(_0x5ac56a[_0xee87('0x7e')][_0xee87('0x7f')]!==_0xee87('0x80'))return;if(!_[_0xee87('0x81')](_0x16447f[_0xee87('0x52')],['field',_0xee87('0x5a')])){return _0x5ac56a['user'][_0xee87('0x82')]({'attributes':['id'],'raw':!![]})[_0xee87('0x2a')](function(_0x304f07){if(_[_0xee87('0x63')](_0x304f07)){_0x342a8b[_0xee87('0x4d')](_0xee87('0x83'));_0x105c15[_0xee87('0x4d')](_0xee87('0x83'));}else{_0x342a8b[_0xee87('0x4d')](_0xee87('0x66'),_['map'](_0x304f07,'id'));_0x105c15[_0xee87('0x4d')]('c.ListId\x20IN\x20?',_[_0xee87('0x57')](_0x304f07,'id'));}});}})['then'](function(){if(_0x5ac56a[_0xee87('0x7e')][_0xee87('0x7f')]==='agent'&&!_0x16447f&&!_0x5ac56a['query'][_0xee87('0x65')])return[];return db[_0xee87('0x84')][_0xee87('0x3a')](_0x342a8b[_0xee87('0x85')](),_0x71f12d);})[_0xee87('0x2a')](function(_0x5b4887){_0x3daec7[_0xee87('0x20')]=_0x5b4887['length'];if(_0x3daec7['count']===0x0)return[];return db['sequelize'][_0xee87('0x3a')](_0x33deba[_0xee87('0x85')](),_0x71f12d)[_0xee87('0x2a')](function(_0x3bccae){_0x54d210=_['keyBy'](_0x3bccae,'id');_0x71f12d=_['merge'](_0x71f12d,{'model':db[_0xee87('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5ac56a[_0xee87('0x3a')][_0xee87('0x3e')]){_0x439b55['attributes'][_0xee87('0x64')](function(_0x1cd34c){_0x105c15['field']('c.'+_0x1cd34c);});}else{_0x105c15[_0xee87('0x43')](_0xee87('0x77'));_0x105c15[_0xee87('0x43')](_0xee87('0x86'));_0x105c15['field'](_0xee87('0x87'));_0x105c15[_0xee87('0x43')](_0xee87('0x88'));_0x105c15['field']('c.mobile');_0x105c15[_0xee87('0x43')](_0xee87('0x89'));_0x105c15[_0xee87('0x43')]('c.email');_0x105c15['field'](_0xee87('0x8a'));_0x105c15[_0xee87('0x43')](_0xee87('0x8b'));_0x105c15[_0xee87('0x43')](_0xee87('0x8c'));_0x105c15['field']('c.CompanyId');_0x105c15[_0xee87('0x43')](_0xee87('0x8d'),_0xee87('0x8e'));}if(_0x439b55['limit'])_0x105c15[_0xee87('0x22')](_0x439b55[_0xee87('0x22')]);if(_0x439b55['offset'])_0x105c15[_0xee87('0x21')](_0x439b55[_0xee87('0x21')]);return db[_0xee87('0x84')][_0xee87('0x3a')](_0x105c15['toString'](),_0x71f12d);});})[_0xee87('0x2a')](function(_0x259205){_0x259205[_0xee87('0x64')](function(_0xa9c023){if(_0xa9c023[_0xee87('0x8e')]){_0xa9c023['Tags']=[];_0xa9c023[_0xee87('0x8e')][_0xee87('0x56')](',')['forEach'](function(_0x527425){_0xa9c023[_0xee87('0x8f')]['push'](_0x54d210[_0x527425]);});}delete _0xa9c023[_0xee87('0x8e')];});_0x3daec7[_0xee87('0x90')]=_0x259205;return _0x3daec7;})['then'](respondWithFilteredResult(_0x3eb538,_0x439b55));})[_0xee87('0x91')](handleError(_0x3eb538,null));};exports[_0xee87('0x92')]=function(_0xc6dded,_0x226aef){return db[_0xee87('0x2f')][_0xee87('0x53')]({'where':{'id':_0xc6dded[_0xee87('0x93')]['id']}})[_0xee87('0x2a')](handleEntityNotFound(_0x226aef,null))['then'](removeEntity(_0x226aef,null))[_0xee87('0x91')](handleError(_0x226aef,null));};exports[_0xee87('0x30')]=function(_0x335697,_0x1a8281){return db[_0xee87('0x2f')]['describe']()[_0xee87('0x2a')](function(_0x286d35){delete _0x286d35[_0xee87('0x94')];for(var _0x3a066a=0x0;_0x3a066a=_0x28bb0e){_0x615537=_0x28bb0e;_0x3d32e1=0xc8;}else{_0x3d32e1=0xce;}_0x3e8378['status'](_0x3d32e1);return _0x3e8378[_0xaf25('0x21')](_0xaf25('0x22'),_0x10ed9a+'-'+_0x615537+'/'+_0x28bb0e)[_0xaf25('0x1d')](_0x2c815a);}return null;};}function patchUpdates(_0x3d8a3a){return function(_0x35e9e8){try{jsonpatch[_0xaf25('0x23')](_0x35e9e8,_0x3d8a3a,!![]);}catch(_0x176a52){return BPromise[_0xaf25('0x24')](_0x176a52);}return _0x35e9e8[_0xaf25('0x25')]();};}function saveUpdates(_0x29f08c,_0x8063a5){return function(_0x340e62){if(_0x340e62){return _0x340e62[_0xaf25('0x26')](_0x29f08c)[_0xaf25('0x27')](function(_0x3389be){return _0x3389be;});}return null;};}function removeEntity(_0xb72350,_0x4ceb4f){return function(_0x3bdfdb){if(_0x3bdfdb){return _0x3bdfdb[_0xaf25('0x28')]()[_0xaf25('0x27')](function(){_0xb72350[_0xaf25('0x29')](0xcc)[_0xaf25('0x1c')]();});}};}function handleEntityNotFound(_0x41c32a,_0x47acaf){return function(_0x55ee96){if(!_0x55ee96){_0x41c32a[_0xaf25('0x1b')](0x194);}return _0x55ee96;};}function handleError(_0x12de62,_0x4663b3){_0x4663b3=_0x4663b3||0x1f4;return function(_0x4ae366){logger['error'](_0x4ae366[_0xaf25('0x2a')]);if(_0x4ae366['name']){delete _0x4ae366[_0xaf25('0x2b')];}_0x12de62['status'](_0x4663b3)[_0xaf25('0x2c')](_0x4ae366);};}exports[_0xaf25('0x2d')]=function(_0x253254,_0x50cb67){var _0x1d7c2d={},_0x12ef43={},_0x59a689={'count':0x0,'rows':[]};return db[_0xaf25('0x2e')][_0xaf25('0x2f')]()['then'](function(_0x596314){var _0x4bac76=[];for(var _0x2e4e2c=0x0;_0x2e4e2c0x1){_0xddd79f['or'](_0xaf25('0x69'),qs[_0xaf25('0x6a')](_0x4bbb7a),null);}else{if(qs[_0xaf25('0x6b')](_0x4bbb7a)){_0xddd79f['or'](_0xaf25('0x6c'),_0x4bbb7a+'%');_0xddd79f['or'](_0xaf25('0x6d'),_0x4bbb7a+'%');_0xddd79f['or']('c.mobile\x20LIKE\x20?',_0x4bbb7a+'%');_0xddd79f['or']('c.fax\x20LIKE\x20?',_0x4bbb7a+'%');}else if(qs[_0xaf25('0x6e')](_0x4bbb7a)){_0xddd79f['or'](_0xaf25('0x6f'),_0x4bbb7a+'%');}else{_0xddd79f['or'](_0xaf25('0x70'),'%'+_0x4bbb7a+'%');_0xddd79f['or'](_0xaf25('0x71'),'%'+_0x4bbb7a+'%');_0xddd79f['or'](_0xaf25('0x6f'),'%'+_0x4bbb7a+'%');}}}}_0x17b8d9[_0xaf25('0x43')](_0xddd79f);_0x17b8d9[_0xaf25('0x72')](_0xaf25('0x73'));var _0x1de97a={'type':db[_0xaf25('0x74')]['QueryTypes'][_0xaf25('0x75')],'raw':!![]};var _0x598324=_0x17b8d9[_0xaf25('0x76')]()[_0xaf25('0x44')]('c.id');if(_0x1d7c2d[_0xaf25('0x41')]){_0x1d7c2d['order'][_0xaf25('0x56')](function(_0x597c36){_0x17b8d9[_0xaf25('0x41')]('c.'+_0x597c36[0x0],_0x597c36[0x1]===_0xaf25('0x77')?![]:!![]);});}if(!_[_0xaf25('0x63')](_0x31c1e9)){_0x17b8d9[_0xaf25('0x78')](_0x2367b3);_0x598324['where'](_0xaf25('0x79'),_0x31c1e9);}BPromise[_0xaf25('0x7a')]()[_0xaf25('0x27')](function(){if(!_0x52f4f1)return;if(_0x253254[_0xaf25('0x7b')][_0xaf25('0x7c')]!==_0xaf25('0x7d'))return;if(!_['some'](_0x52f4f1[_0xaf25('0x53')],['field','User'])){return _0x253254[_0xaf25('0x7b')][_0xaf25('0x7e')]({'attributes':['id'],'raw':!![]})[_0xaf25('0x27')](function(_0x3bdc1b){if(_['isEmpty'](_0x3bdc1b)){_0x598324['where'](_0xaf25('0x7f'));_0x17b8d9[_0xaf25('0x43')](_0xaf25('0x7f'));}else{_0x598324[_0xaf25('0x43')]('c.ListId\x20IN\x20?',_[_0xaf25('0x55')](_0x3bdc1b,'id'));_0x17b8d9[_0xaf25('0x43')](_0xaf25('0x80'),_['map'](_0x3bdc1b,'id'));}});}})['then'](function(){if(_0x253254[_0xaf25('0x7b')][_0xaf25('0x7c')]===_0xaf25('0x7d')&&!_0x52f4f1&&!_0x253254[_0xaf25('0x3a')][_0xaf25('0x64')])return[];return db['sequelize']['query'](_0x598324[_0xaf25('0x81')](),_0x1de97a);})[_0xaf25('0x27')](function(_0x41e268){_0x59a689[_0xaf25('0x1e')]=_0x41e268[_0xaf25('0x31')];if(_0x59a689[_0xaf25('0x1e')]===0x0)return[];return db[_0xaf25('0x82')][_0xaf25('0x3a')](_0x1b97de[_0xaf25('0x81')](),_0x1de97a)[_0xaf25('0x27')](function(_0x49c93a){_0x8fb792=_['keyBy'](_0x49c93a,'id');_0x1de97a=_['merge'](_0x1de97a,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x253254['query'][_0xaf25('0x3e')]){_0x1d7c2d[_0xaf25('0x3d')][_0xaf25('0x56')](function(_0x514360){_0x17b8d9[_0xaf25('0x44')]('c.'+_0x514360);});}else{_0x17b8d9[_0xaf25('0x44')](_0xaf25('0x73'));_0x17b8d9[_0xaf25('0x44')](_0xaf25('0x83'));_0x17b8d9[_0xaf25('0x44')](_0xaf25('0x84'));_0x17b8d9['field'](_0xaf25('0x85'));_0x17b8d9[_0xaf25('0x44')](_0xaf25('0x86'));_0x17b8d9[_0xaf25('0x44')](_0xaf25('0x87'));_0x17b8d9[_0xaf25('0x44')]('c.email');_0x17b8d9[_0xaf25('0x44')](_0xaf25('0x88'));_0x17b8d9[_0xaf25('0x44')](_0xaf25('0x89'));_0x17b8d9[_0xaf25('0x44')]('c.deletedAt');_0x17b8d9[_0xaf25('0x44')](_0xaf25('0x8a'));_0x17b8d9[_0xaf25('0x44')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xaf25('0x8b'));}if(_0x1d7c2d[_0xaf25('0x20')])_0x17b8d9[_0xaf25('0x20')](_0x1d7c2d['limit']);if(_0x1d7c2d[_0xaf25('0x1f')])_0x17b8d9[_0xaf25('0x1f')](_0x1d7c2d[_0xaf25('0x1f')]);return db['sequelize'][_0xaf25('0x3a')](_0x17b8d9['toString'](),_0x1de97a);});})['then'](function(_0x210ce2){_0x210ce2[_0xaf25('0x56')](function(_0x57f3ce){if(_0x57f3ce[_0xaf25('0x8b')]){_0x57f3ce[_0xaf25('0x8c')]=[];_0x57f3ce['TagIds'][_0xaf25('0x8d')](',')[_0xaf25('0x56')](function(_0x1f01f1){_0x57f3ce[_0xaf25('0x8c')]['push'](_0x8fb792[_0x1f01f1]);});}delete _0x57f3ce['TagIds'];});_0x59a689[_0xaf25('0x8e')]=_0x210ce2;return _0x59a689;})['then'](respondWithFilteredResult(_0x50cb67,_0x1d7c2d));})['catch'](handleError(_0x50cb67,null));};exports[_0xaf25('0x28')]=function(_0x345ec8,_0x248521){return db[_0xaf25('0x2e')][_0xaf25('0x54')]({'where':{'id':_0x345ec8[_0xaf25('0x8f')]['id']}})['then'](handleEntityNotFound(_0x248521,null))['then'](removeEntity(_0x248521,null))[_0xaf25('0x90')](handleError(_0x248521,null));};exports[_0xaf25('0x2f')]=function(_0x547fba,_0x24ee50){return db[_0xaf25('0x2e')]['describe']()[_0xaf25('0x27')](function(_0x426d6a){delete _0x426d6a['tags'];for(var _0x392d8b=0x0;_0x392d8b{}\s\\|]/g,'-');_0x191642(null,util[_0xffd6('0x20')]('%s-%s%s',path[_0xffd6('0x21')](_0x352974['originalname'],path[_0xffd6('0x22')](_0x352974[_0xffd6('0x1e')])),Date[_0xffd6('0x23')](),path['extname'](_0x352974['originalname'])));}})});router['post'](_0xffd6('0x24'),upload[_0xffd6('0x25')](_0xffd6('0x26')),controller['uploadCsv']);var upload=multer({'storage':multer[_0xffd6('0x27')]({'destination':function(_0x239eaf,_0x12352c,_0xdec862){_0xdec862(null,path[_0xffd6('0x28')](config['root'],_0xffd6('0x1d')));},'filename':function(_0x216009,_0x4e2741,_0xb11654){_0x4e2741[_0xffd6('0x1e')]=_0x4e2741[_0xffd6('0x1e')][_0xffd6('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xb11654(null,util[_0xffd6('0x20')](_0xffd6('0x29'),path[_0xffd6('0x21')](_0x4e2741[_0xffd6('0x1e')],path['extname'](_0x4e2741[_0xffd6('0x1e')])),Date[_0xffd6('0x23')](),path[_0xffd6('0x22')](_0x4e2741[_0xffd6('0x1e')])));}})});router[_0xffd6('0x16')](_0xffd6('0x2a'),upload['single'](_0xffd6('0x26')),controller[_0xffd6('0x2b')]);router[_0xffd6('0x16')](_0xffd6('0x2c'),auth[_0xffd6('0x9')](),controller[_0xffd6('0x2d')]);router[_0xffd6('0x2e')](_0xffd6('0x2f'),auth[_0xffd6('0x9')](),controller[_0xffd6('0x30')]);router[_0xffd6('0x31')](_0xffd6('0x2f'),auth['isAuthenticated'](),controller[_0xffd6('0x32')]);module[_0xffd6('0x33')]=router; \ No newline at end of file +var _0x6ae2=['put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/tags','getTags','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','post','/merge','merge','create','/create_many','bulkCreate','setTags','diskStorage','join','root','server/files/tmp','originalname','format','basename','extname','single','file','%s-%s%s','now','/upload','upload','/upload/:id','import'];(function(_0x2f075b,_0x107899){var _0x20ffbf=function(_0x3bbe2e){while(--_0x3bbe2e){_0x2f075b['push'](_0x2f075b['shift']());}};_0x20ffbf(++_0x107899);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x5f0eb9,_0x34711f){_0x5f0eb9=_0x5f0eb9-0x0;var _0x34991b=_0x6ae2[_0x5f0eb9];return _0x34991b;};'use strict';var multer=require(_0x26ae('0x0'));var util=require(_0x26ae('0x1'));var path=require(_0x26ae('0x2'));var timeout=require(_0x26ae('0x3'));var express=require(_0x26ae('0x4'));var router=express[_0x26ae('0x5')]();var auth=require(_0x26ae('0x6'));var interaction=require(_0x26ae('0x7'));var config=require(_0x26ae('0x8'));var controller=require('./cmContact.controller');router[_0x26ae('0x9')]('/',auth[_0x26ae('0xa')](),controller['index']);router['get'](_0x26ae('0xb'),auth[_0x26ae('0xa')](),controller[_0x26ae('0xc')]);router[_0x26ae('0x9')](_0x26ae('0xd'),auth[_0x26ae('0xa')](),controller[_0x26ae('0xe')]);router[_0x26ae('0x9')](_0x26ae('0xf'),auth[_0x26ae('0xa')](),controller[_0x26ae('0x10')]);router[_0x26ae('0x9')]('/:id/hoppers',auth[_0x26ae('0xa')](),controller['getHoppers']);router[_0x26ae('0x9')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x26ae('0x11')]);router[_0x26ae('0x9')](_0x26ae('0x12'),auth[_0x26ae('0xa')](),controller[_0x26ae('0x13')]);router[_0x26ae('0x9')](_0x26ae('0x14'),auth[_0x26ae('0xa')](),controller[_0x26ae('0x15')]);router[_0x26ae('0x9')](_0x26ae('0x16'),auth[_0x26ae('0xa')](),controller['getJourney']);router[_0x26ae('0x17')](_0x26ae('0x18'),auth['isAuthenticated'](),controller[_0x26ae('0x19')]);router[_0x26ae('0x17')]('/',auth[_0x26ae('0xa')](),controller[_0x26ae('0x1a')]);router[_0x26ae('0x17')](_0x26ae('0x1b'),auth[_0x26ae('0xa')](),controller[_0x26ae('0x1c')]);router[_0x26ae('0x17')](_0x26ae('0xf'),auth[_0x26ae('0xa')](),controller[_0x26ae('0x1d')]);var upload=multer({'storage':multer[_0x26ae('0x1e')]({'destination':function(_0x12d56e,_0x417eaa,_0x45c918){_0x45c918(null,path[_0x26ae('0x1f')](config[_0x26ae('0x20')],_0x26ae('0x21')));},'filename':function(_0x162c16,_0x334153,_0x4e73ea){_0x334153['originalname']=_0x334153[_0x26ae('0x22')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4e73ea(null,util[_0x26ae('0x23')]('%s-%s%s',path[_0x26ae('0x24')](_0x334153[_0x26ae('0x22')],path[_0x26ae('0x25')](_0x334153['originalname'])),Date['now'](),path[_0x26ae('0x25')](_0x334153[_0x26ae('0x22')])));}})});router[_0x26ae('0x17')]('/csv',upload[_0x26ae('0x26')](_0x26ae('0x27')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x26ae('0x1e')]({'destination':function(_0x2658ed,_0x19eacc,_0x4a0045){_0x4a0045(null,path[_0x26ae('0x1f')](config['root'],_0x26ae('0x21')));},'filename':function(_0x1ac4e6,_0x76c2b3,_0x4cef91){_0x76c2b3[_0x26ae('0x22')]=_0x76c2b3['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4cef91(null,util[_0x26ae('0x23')](_0x26ae('0x28'),path['basename'](_0x76c2b3[_0x26ae('0x22')],path[_0x26ae('0x25')](_0x76c2b3[_0x26ae('0x22')])),Date[_0x26ae('0x29')](),path[_0x26ae('0x25')](_0x76c2b3['originalname'])));}})});router[_0x26ae('0x17')](_0x26ae('0x2a'),upload[_0x26ae('0x26')](_0x26ae('0x27')),controller[_0x26ae('0x2b')]);router['post'](_0x26ae('0x2c'),auth[_0x26ae('0xa')](),controller[_0x26ae('0x2d')]);router[_0x26ae('0x2e')](_0x26ae('0xd'),auth[_0x26ae('0xa')](),controller[_0x26ae('0x2f')]);router[_0x26ae('0x30')]('/:id',auth[_0x26ae('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index da764ab..8e4a7fb 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 _0xde64=['values','setDataValue','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','STRING','name','long','type','select','parse'];(function(_0x574864,_0x42d63d){var _0x348db3=function(_0x45f235){while(--_0x45f235){_0x574864['push'](_0x574864['shift']());}};_0x348db3(++_0x42d63d);}(_0xde64,0x17c));var _0x4de6=function(_0x518314,_0x28f9a6){_0x518314=_0x518314-0x0;var _0x1da88a=_0xde64[_0x518314];return _0x1da88a;};'use strict';var Sequelize=require(_0x4de6('0x0'));var _=require(_0x4de6('0x1'));module[_0x4de6('0x2')]={'name':{'type':Sequelize[_0x4de6('0x3')],'get':function(_0x252bfc){return this[_0x4de6('0x4')]('alias');}},'alias':{'type':Sequelize[_0x4de6('0x5')],'allowNull':![],'set':function(_0x3bd290){this['setDataValue']('alias',_0x3bd290?_0x3bd290:this[_0x4de6('0x4')](_0x4de6('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x4de6('0x7')),'get':function(){if(this[_0x4de6('0x4')](_0x4de6('0x8'))===_0x4de6('0x9')){return JSON[_0x4de6('0xa')](this[_0x4de6('0x4')]('values'));}else{return this[_0x4de6('0x4')](_0x4de6('0xb'));}},'set':function(_0x1dbeed){if(Array['isArray'](_0x1dbeed)){this[_0x4de6('0xc')](_0x4de6('0xb'),JSON[_0x4de6('0xd')](_0x1dbeed));}else{this[_0x4de6('0xc')](_0x4de6('0xb'),_0x1dbeed);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x4de6('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x4de6('0xf')](_0x4de6('0x10'))}}; \ No newline at end of file +var _0x31af=['alias','name','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','getDataValue','STRING','setDataValue'];(function(_0x59a8a1,_0x5122fc){var _0x1dec66=function(_0x31b3dd){while(--_0x31b3dd){_0x59a8a1['push'](_0x59a8a1['shift']());}};_0x1dec66(++_0x5122fc);}(_0x31af,0xde));var _0xf31a=function(_0x45125a,_0x51384b){_0x45125a=_0x45125a-0x0;var _0x4d53ab=_0x31af[_0x45125a];return _0x4d53ab;};'use strict';var Sequelize=require(_0xf31a('0x0'));var _=require(_0xf31a('0x1'));module[_0xf31a('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5f5639){return this[_0xf31a('0x3')]('alias');}},'alias':{'type':Sequelize[_0xf31a('0x4')],'allowNull':![],'set':function(_0x1853d7){this[_0xf31a('0x5')](_0xf31a('0x6'),_0x1853d7?_0x1853d7:this['getDataValue'](_0xf31a('0x7')));}},'type':{'type':Sequelize[_0xf31a('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xf31a('0x8')](_0xf31a('0x9')),'get':function(){if(this['getDataValue'](_0xf31a('0xa'))===_0xf31a('0xb')){return JSON[_0xf31a('0xc')](this[_0xf31a('0x3')]('values'));}else{return this[_0xf31a('0x3')](_0xf31a('0xd'));}},'set':function(_0xcff55c){if(Array[_0xf31a('0xe')](_0xcff55c)){this[_0xf31a('0x5')]('values',JSON[_0xf31a('0xf')](_0xcff55c));}else{this[_0xf31a('0x5')](_0xf31a('0xd'),_0xcff55c);}}},'required':{'type':Sequelize[_0xf31a('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf31a('0x11')](_0xf31a('0x12'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index aaf42a3..6d84714 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 _0xb077=['intersection','attributes','fields','length','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','CmCustomField','findAll','rows','catch','show','params','find','update','body','create','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','addColumn','cm_contacts','format','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','limit','set','Content-Range','json','apply','reject','then','destroy','name','send','index','map','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters'];(function(_0x5962a5,_0x4946f3){var _0x12919d=function(_0x4a543f){while(--_0x4a543f){_0x5962a5['push'](_0x5962a5['shift']());}};_0x12919d(++_0x4946f3);}(_0xb077,0x7f));var _0x7b07=function(_0x1c1e49,_0x43c1b8){_0x1c1e49=_0x1c1e49-0x0;var _0x475fc9=_0xb077[_0x1c1e49];return _0x475fc9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7b07('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b07('0x1'));var jsonpatch=require(_0x7b07('0x2'));var rp=require(_0x7b07('0x3'));var moment=require('moment');var BPromise=require(_0x7b07('0x4'));var Mustache=require(_0x7b07('0x5'));var util=require(_0x7b07('0x6'));var path=require(_0x7b07('0x7'));var sox=require(_0x7b07('0x8'));var csv=require(_0x7b07('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7b07('0xa'));var squel=require(_0x7b07('0xb'));var crypto=require(_0x7b07('0xc'));var jsforce=require(_0x7b07('0xd'));var deskjs=require(_0x7b07('0xe'));var toCsv=require(_0x7b07('0x9'));var querystring=require(_0x7b07('0xf'));var Papa=require('papaparse');var Redis=require(_0x7b07('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7b07('0x11'));var as=require(_0x7b07('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b07('0x13'))(_0x7b07('0x14'));var utils=require(_0x7b07('0x15'));var config=require(_0x7b07('0x16'));var licenseUtil=require(_0x7b07('0x17'));var db=require(_0x7b07('0x18'))['db'];function respondWithStatusCode(_0x4aa887,_0x3f24bd){_0x3f24bd=_0x3f24bd||0xcc;return function(_0x5985ba){if(_0x5985ba){return _0x4aa887[_0x7b07('0x19')](_0x3f24bd);}return _0x4aa887['status'](_0x3f24bd)[_0x7b07('0x1a')]();};}function respondWithResult(_0x163b2a,_0x377316){_0x377316=_0x377316||0xc8;return function(_0x2ff4f5){if(_0x2ff4f5){return _0x163b2a['status'](_0x377316)['json'](_0x2ff4f5);}};}function respondWithFilteredResult(_0x3ef92c,_0x4b90bf){return function(_0xcd70f3){if(_0xcd70f3){var _0x3b6a27=_0xcd70f3['count'],_0x4b82ba=_0x4b90bf['offset'],_0x2667a1=_0x4b90bf['offset']+_0x4b90bf[_0x7b07('0x1b')],_0x5391f4;if(_0x2667a1>=_0x3b6a27){_0x2667a1=_0x3b6a27;_0x5391f4=0xc8;}else{_0x5391f4=0xce;}_0x3ef92c['status'](_0x5391f4);return _0x3ef92c[_0x7b07('0x1c')](_0x7b07('0x1d'),_0x4b82ba+'-'+_0x2667a1+'/'+_0x3b6a27)[_0x7b07('0x1e')](_0xcd70f3);}return null;};}function patchUpdates(_0xef65fc){return function(_0x31935e){try{jsonpatch[_0x7b07('0x1f')](_0x31935e,_0xef65fc,!![]);}catch(_0x385c44){return BPromise[_0x7b07('0x20')](_0x385c44);}return _0x31935e['save']();};}function saveUpdates(_0x18a672,_0x4d06aa){return function(_0x84741a){if(_0x84741a){return _0x84741a['update'](_0x18a672)[_0x7b07('0x21')](function(_0x59dbee){return _0x59dbee;});}return null;};}function removeEntity(_0x35b06d,_0x240e60){return function(_0x155d1b){if(_0x155d1b){return _0x155d1b[_0x7b07('0x22')]()[_0x7b07('0x21')](function(){_0x35b06d['status'](0xcc)[_0x7b07('0x1a')]();});}};}function handleEntityNotFound(_0x346043,_0x285a63){return function(_0x587cae){if(!_0x587cae){_0x346043[_0x7b07('0x19')](0x194);}return _0x587cae;};}function handleError(_0x2d9061,_0x4284e5){_0x4284e5=_0x4284e5||0x1f4;return function(_0x12c208){logger['error'](_0x12c208['stack']);if(_0x12c208[_0x7b07('0x23')]){delete _0x12c208[_0x7b07('0x23')];}_0x2d9061['status'](_0x4284e5)[_0x7b07('0x24')](_0x12c208);};}exports[_0x7b07('0x25')]=function(_0x5cad2c,_0x2c9595){var _0x1c8c37={},_0x1585bf={},_0x5c5883={'count':0x0,'rows':[]};var _0x374344=_[_0x7b07('0x26')](db['CmCustomField'][_0x7b07('0x27')],function(_0x58cb00){return{'name':_0x58cb00[_0x7b07('0x28')],'type':_0x58cb00[_0x7b07('0x29')]['key']};});_0x1585bf[_0x7b07('0x2a')]=_[_0x7b07('0x2b')](_[_0x7b07('0x26')](_0x374344,_0x7b07('0x23')),[_0x7b07('0x23')]);_0x1585bf[_0x7b07('0x2c')]=_[_0x7b07('0x2d')](_0x5cad2c[_0x7b07('0x2c')]);_0x1585bf[_0x7b07('0x2e')]=_[_0x7b07('0x2f')](_0x1585bf['model'],_0x1585bf[_0x7b07('0x2c')]);_0x1c8c37[_0x7b07('0x30')]=_[_0x7b07('0x2f')](_0x1585bf[_0x7b07('0x2a')],qs[_0x7b07('0x31')](_0x5cad2c['query']['fields']));_0x1c8c37[_0x7b07('0x30')]=_0x1c8c37[_0x7b07('0x30')][_0x7b07('0x32')]?_0x1c8c37[_0x7b07('0x30')]:_0x1585bf[_0x7b07('0x2a')];if(!_0x5cad2c['query']['hasOwnProperty']('nolimit')){_0x1c8c37[_0x7b07('0x1b')]=qs[_0x7b07('0x1b')](_0x5cad2c[_0x7b07('0x2c')][_0x7b07('0x1b')]);_0x1c8c37[_0x7b07('0x33')]=qs[_0x7b07('0x33')](_0x5cad2c[_0x7b07('0x2c')][_0x7b07('0x33')]);}_0x1c8c37[_0x7b07('0x34')]=qs[_0x7b07('0x35')](_0x5cad2c[_0x7b07('0x2c')][_0x7b07('0x35')]);_0x1c8c37[_0x7b07('0x36')]=qs[_0x7b07('0x2e')](_[_0x7b07('0x37')](_0x5cad2c[_0x7b07('0x2c')],_0x1585bf[_0x7b07('0x2e')]),_0x374344);if(_0x5cad2c[_0x7b07('0x2c')][_0x7b07('0x38')]){_0x1c8c37[_0x7b07('0x36')]=_[_0x7b07('0x39')](_0x1c8c37[_0x7b07('0x36')],{'$or':_['map'](_0x374344,function(_0x1ccdf6){if(_0x1ccdf6[_0x7b07('0x29')]!==_0x7b07('0x3a')){var _0x103555={};_0x103555[_0x1ccdf6['name']]={'$like':'%'+_0x5cad2c[_0x7b07('0x2c')][_0x7b07('0x38')]+'%'};return _0x103555;}})});}_0x1c8c37=_[_0x7b07('0x39')]({},_0x1c8c37,_0x5cad2c[_0x7b07('0x3b')]);var _0x180dea={'where':_0x1c8c37['where']};return db['CmCustomField'][_0x7b07('0x3c')](_0x180dea)[_0x7b07('0x21')](function(_0x7ba148){_0x5c5883[_0x7b07('0x3c')]=_0x7ba148;if(_0x5cad2c[_0x7b07('0x2c')][_0x7b07('0x3d')]){_0x1c8c37[_0x7b07('0x3e')]=[{'all':!![]}];}return db[_0x7b07('0x3f')][_0x7b07('0x40')](_0x1c8c37);})[_0x7b07('0x21')](function(_0x290f9b){_0x5c5883[_0x7b07('0x41')]=_0x290f9b;return _0x5c5883;})[_0x7b07('0x21')](respondWithFilteredResult(_0x2c9595,_0x1c8c37))[_0x7b07('0x42')](handleError(_0x2c9595,null));};exports[_0x7b07('0x43')]=function(_0x2351ef,_0x201ee1){var _0x4a076c={'raw':!![],'where':{'id':_0x2351ef[_0x7b07('0x44')]['id']}},_0x160b1f={};_0x160b1f[_0x7b07('0x2a')]=_[_0x7b07('0x2d')](db[_0x7b07('0x3f')][_0x7b07('0x27')]);_0x160b1f[_0x7b07('0x2c')]=_['keys'](_0x2351ef['query']);_0x160b1f[_0x7b07('0x2e')]=_['intersection'](_0x160b1f['model'],_0x160b1f[_0x7b07('0x2c')]);_0x4a076c[_0x7b07('0x30')]=_['intersection'](_0x160b1f[_0x7b07('0x2a')],qs[_0x7b07('0x31')](_0x2351ef['query'][_0x7b07('0x31')]));_0x4a076c[_0x7b07('0x30')]=_0x4a076c[_0x7b07('0x30')][_0x7b07('0x32')]?_0x4a076c[_0x7b07('0x30')]:_0x160b1f['model'];if(_0x2351ef[_0x7b07('0x2c')][_0x7b07('0x3d')]){_0x4a076c[_0x7b07('0x3e')]=[{'all':!![]}];}_0x4a076c=_['merge']({},_0x4a076c,_0x2351ef[_0x7b07('0x3b')]);return db[_0x7b07('0x3f')][_0x7b07('0x45')](_0x4a076c)[_0x7b07('0x21')](handleEntityNotFound(_0x201ee1,null))[_0x7b07('0x21')](respondWithResult(_0x201ee1,null))[_0x7b07('0x42')](handleError(_0x201ee1,null));};exports[_0x7b07('0x46')]=function(_0x3e511f,_0x967e0a){if(_0x3e511f['body']['id']){delete _0x3e511f[_0x7b07('0x47')]['id'];}return db[_0x7b07('0x3f')][_0x7b07('0x45')]({'where':{'id':_0x3e511f[_0x7b07('0x44')]['id']}})[_0x7b07('0x21')](handleEntityNotFound(_0x967e0a,null))['then'](saveUpdates(_0x3e511f[_0x7b07('0x47')],null))[_0x7b07('0x21')](respondWithResult(_0x967e0a,null))[_0x7b07('0x42')](handleError(_0x967e0a,null));};exports[_0x7b07('0x22')]=function(_0x149c9c,_0x3efc36){return db[_0x7b07('0x3f')][_0x7b07('0x45')]({'where':{'id':_0x149c9c[_0x7b07('0x44')]['id']}})[_0x7b07('0x21')](handleEntityNotFound(_0x3efc36,null))[_0x7b07('0x21')](removeEntity(_0x3efc36,null))[_0x7b07('0x42')](handleError(_0x3efc36,null));};exports[_0x7b07('0x48')]=function(_0x50eac2,_0x5d45c0){var _0x3a89e6;return db['sequelize'][_0x7b07('0x49')](function(_0x50f141){return db[_0x7b07('0x3f')]['create'](_0x50eac2[_0x7b07('0x47')],{'transaction':_0x50f141})[_0x7b07('0x21')](function(_0x532896){_0x3a89e6=_0x532896;var _0x5ee74a={'type':db[_0x7b07('0x4a')][_0x7b07('0x4b')],'transaction':_0x50f141};switch(_0x50eac2['body'][_0x7b07('0x29')]){case _0x7b07('0x4c'):_0x5ee74a[_0x7b07('0x29')]=db[_0x7b07('0x4a')][_0x7b07('0x4b')];break;case _0x7b07('0x4d'):_0x5ee74a[_0x7b07('0x29')]=db[_0x7b07('0x4a')][_0x7b07('0x4e')];break;case _0x7b07('0x4f'):_0x5ee74a[_0x7b07('0x29')]=db[_0x7b07('0x4a')][_0x7b07('0x50')];_0x5ee74a[_0x7b07('0x51')]=![];break;default:}return db[_0x7b07('0x52')]['queryInterface'][_0x7b07('0x53')](_0x7b07('0x54'),util[_0x7b07('0x55')](_0x7b07('0x56'),_0x3a89e6['id']),_0x5ee74a);})[_0x7b07('0x21')](function(){return _0x3a89e6;});})[_0x7b07('0x21')](respondWithResult(_0x5d45c0,0xc9))[_0x7b07('0x42')](handleError(_0x5d45c0,null));}; \ No newline at end of file +var _0xb2be=['../../config/utils','sendStatus','status','json','offset','set','Content-Range','apply','update','then','destroy','end','error','stack','name','index','map','CmCustomField','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','attributes','intersection','fields','length','limit','order','where','pick','merge','type','filter','options','count','includeAll','findAll','rows','catch','show','params','include','find','body','create','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','sequelize','addColumn','cm_contacts','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x440d84,_0x361d47){var _0x2c3d17=function(_0x433dc5){while(--_0x433dc5){_0x440d84['push'](_0x440d84['shift']());}};_0x2c3d17(++_0x361d47);}(_0xb2be,0x1da));var _0xeb2b=function(_0x4851ff,_0x1c9a8d){_0x4851ff=_0x4851ff-0x0;var _0x26773b=_0xb2be[_0x4851ff];return _0x26773b;};'use strict';var pdf=require(_0xeb2b('0x0'));var emlformat=require(_0xeb2b('0x1'));var rimraf=require(_0xeb2b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb2b('0x3'));var rp=require(_0xeb2b('0x4'));var moment=require(_0xeb2b('0x5'));var BPromise=require(_0xeb2b('0x6'));var Mustache=require(_0xeb2b('0x7'));var util=require(_0xeb2b('0x8'));var path=require(_0xeb2b('0x9'));var sox=require(_0xeb2b('0xa'));var csv=require(_0xeb2b('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeb2b('0xc'));var squel=require(_0xeb2b('0xd'));var crypto=require(_0xeb2b('0xe'));var jsforce=require(_0xeb2b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xeb2b('0xb'));var querystring=require(_0xeb2b('0x10'));var Papa=require(_0xeb2b('0x11'));var Redis=require(_0xeb2b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xeb2b('0x13'));var as=require(_0xeb2b('0x14'));var hardwareService=require(_0xeb2b('0x15'));var logger=require(_0xeb2b('0x16'))(_0xeb2b('0x17'));var utils=require(_0xeb2b('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f72ab,_0x526bae){_0x526bae=_0x526bae||0xcc;return function(_0x2862da){if(_0x2862da){return _0x4f72ab[_0xeb2b('0x19')](_0x526bae);}return _0x4f72ab[_0xeb2b('0x1a')](_0x526bae)['end']();};}function respondWithResult(_0x1e58da,_0x238c21){_0x238c21=_0x238c21||0xc8;return function(_0x35cbdb){if(_0x35cbdb){return _0x1e58da[_0xeb2b('0x1a')](_0x238c21)[_0xeb2b('0x1b')](_0x35cbdb);}};}function respondWithFilteredResult(_0x18eb99,_0x563e7a){return function(_0x3a1fcd){if(_0x3a1fcd){var _0x2b5f07=_0x3a1fcd['count'],_0x55cd70=_0x563e7a[_0xeb2b('0x1c')],_0x1581f3=_0x563e7a['offset']+_0x563e7a['limit'],_0x2f4db2;if(_0x1581f3>=_0x2b5f07){_0x1581f3=_0x2b5f07;_0x2f4db2=0xc8;}else{_0x2f4db2=0xce;}_0x18eb99['status'](_0x2f4db2);return _0x18eb99[_0xeb2b('0x1d')](_0xeb2b('0x1e'),_0x55cd70+'-'+_0x1581f3+'/'+_0x2b5f07)[_0xeb2b('0x1b')](_0x3a1fcd);}return null;};}function patchUpdates(_0x4444c9){return function(_0x208f28){try{jsonpatch[_0xeb2b('0x1f')](_0x208f28,_0x4444c9,!![]);}catch(_0x495963){return BPromise['reject'](_0x495963);}return _0x208f28['save']();};}function saveUpdates(_0x227109,_0x1d9ef9){return function(_0x45a69f){if(_0x45a69f){return _0x45a69f[_0xeb2b('0x20')](_0x227109)[_0xeb2b('0x21')](function(_0x95eb4b){return _0x95eb4b;});}return null;};}function removeEntity(_0x63c95a,_0xdac870){return function(_0x258aba){if(_0x258aba){return _0x258aba[_0xeb2b('0x22')]()[_0xeb2b('0x21')](function(){_0x63c95a['status'](0xcc)[_0xeb2b('0x23')]();});}};}function handleEntityNotFound(_0x54b5f0,_0x24c2b5){return function(_0x4180a8){if(!_0x4180a8){_0x54b5f0[_0xeb2b('0x19')](0x194);}return _0x4180a8;};}function handleError(_0xbb1b12,_0x3f0615){_0x3f0615=_0x3f0615||0x1f4;return function(_0xcdef6c){logger[_0xeb2b('0x24')](_0xcdef6c[_0xeb2b('0x25')]);if(_0xcdef6c[_0xeb2b('0x26')]){delete _0xcdef6c['name'];}_0xbb1b12[_0xeb2b('0x1a')](_0x3f0615)['send'](_0xcdef6c);};}exports[_0xeb2b('0x27')]=function(_0x1353fa,_0x3fd392){var _0x479077={},_0x2c397a={},_0x5167db={'count':0x0,'rows':[]};var _0x52b26a=_[_0xeb2b('0x28')](db[_0xeb2b('0x29')][_0xeb2b('0x2a')],function(_0x2dfcdd){return{'name':_0x2dfcdd[_0xeb2b('0x2b')],'type':_0x2dfcdd['type'][_0xeb2b('0x2c')]};});_0x2c397a[_0xeb2b('0x2d')]=_[_0xeb2b('0x2e')](_[_0xeb2b('0x28')](_0x52b26a,_0xeb2b('0x26')),[_0xeb2b('0x26')]);_0x2c397a[_0xeb2b('0x2f')]=_[_0xeb2b('0x30')](_0x1353fa['query']);_0x2c397a[_0xeb2b('0x31')]=_['intersection'](_0x2c397a[_0xeb2b('0x2d')],_0x2c397a['query']);_0x479077[_0xeb2b('0x32')]=_[_0xeb2b('0x33')](_0x2c397a['model'],qs[_0xeb2b('0x34')](_0x1353fa[_0xeb2b('0x2f')]['fields']));_0x479077[_0xeb2b('0x32')]=_0x479077[_0xeb2b('0x32')][_0xeb2b('0x35')]?_0x479077[_0xeb2b('0x32')]:_0x2c397a['model'];if(!_0x1353fa[_0xeb2b('0x2f')]['hasOwnProperty']('nolimit')){_0x479077[_0xeb2b('0x36')]=qs[_0xeb2b('0x36')](_0x1353fa['query'][_0xeb2b('0x36')]);_0x479077[_0xeb2b('0x1c')]=qs[_0xeb2b('0x1c')](_0x1353fa[_0xeb2b('0x2f')]['offset']);}_0x479077[_0xeb2b('0x37')]=qs['sort'](_0x1353fa[_0xeb2b('0x2f')]['sort']);_0x479077[_0xeb2b('0x38')]=qs[_0xeb2b('0x31')](_[_0xeb2b('0x39')](_0x1353fa[_0xeb2b('0x2f')],_0x2c397a[_0xeb2b('0x31')]),_0x52b26a);if(_0x1353fa[_0xeb2b('0x2f')]['filter']){_0x479077[_0xeb2b('0x38')]=_[_0xeb2b('0x3a')](_0x479077[_0xeb2b('0x38')],{'$or':_[_0xeb2b('0x28')](_0x52b26a,function(_0x5ecc3f){if(_0x5ecc3f[_0xeb2b('0x3b')]!=='VIRTUAL'){var _0x5cf4ac={};_0x5cf4ac[_0x5ecc3f[_0xeb2b('0x26')]]={'$like':'%'+_0x1353fa[_0xeb2b('0x2f')][_0xeb2b('0x3c')]+'%'};return _0x5cf4ac;}})});}_0x479077=_['merge']({},_0x479077,_0x1353fa[_0xeb2b('0x3d')]);var _0x4a924d={'where':_0x479077[_0xeb2b('0x38')]};return db[_0xeb2b('0x29')][_0xeb2b('0x3e')](_0x4a924d)[_0xeb2b('0x21')](function(_0x206739){_0x5167db[_0xeb2b('0x3e')]=_0x206739;if(_0x1353fa[_0xeb2b('0x2f')][_0xeb2b('0x3f')]){_0x479077['include']=[{'all':!![]}];}return db[_0xeb2b('0x29')][_0xeb2b('0x40')](_0x479077);})[_0xeb2b('0x21')](function(_0x419520){_0x5167db[_0xeb2b('0x41')]=_0x419520;return _0x5167db;})['then'](respondWithFilteredResult(_0x3fd392,_0x479077))[_0xeb2b('0x42')](handleError(_0x3fd392,null));};exports[_0xeb2b('0x43')]=function(_0x50ab68,_0x371c6b){var _0x1b5b65={'raw':!![],'where':{'id':_0x50ab68[_0xeb2b('0x44')]['id']}},_0x4149d5={};_0x4149d5['model']=_[_0xeb2b('0x30')](db[_0xeb2b('0x29')][_0xeb2b('0x2a')]);_0x4149d5['query']=_[_0xeb2b('0x30')](_0x50ab68[_0xeb2b('0x2f')]);_0x4149d5[_0xeb2b('0x31')]=_['intersection'](_0x4149d5[_0xeb2b('0x2d')],_0x4149d5[_0xeb2b('0x2f')]);_0x1b5b65[_0xeb2b('0x32')]=_[_0xeb2b('0x33')](_0x4149d5[_0xeb2b('0x2d')],qs['fields'](_0x50ab68[_0xeb2b('0x2f')][_0xeb2b('0x34')]));_0x1b5b65[_0xeb2b('0x32')]=_0x1b5b65[_0xeb2b('0x32')][_0xeb2b('0x35')]?_0x1b5b65[_0xeb2b('0x32')]:_0x4149d5['model'];if(_0x50ab68['query'][_0xeb2b('0x3f')]){_0x1b5b65[_0xeb2b('0x45')]=[{'all':!![]}];}_0x1b5b65=_[_0xeb2b('0x3a')]({},_0x1b5b65,_0x50ab68[_0xeb2b('0x3d')]);return db['CmCustomField'][_0xeb2b('0x46')](_0x1b5b65)[_0xeb2b('0x21')](handleEntityNotFound(_0x371c6b,null))[_0xeb2b('0x21')](respondWithResult(_0x371c6b,null))[_0xeb2b('0x42')](handleError(_0x371c6b,null));};exports[_0xeb2b('0x20')]=function(_0xbea07d,_0x5b9267){if(_0xbea07d[_0xeb2b('0x47')]['id']){delete _0xbea07d[_0xeb2b('0x47')]['id'];}return db['CmCustomField'][_0xeb2b('0x46')]({'where':{'id':_0xbea07d[_0xeb2b('0x44')]['id']}})[_0xeb2b('0x21')](handleEntityNotFound(_0x5b9267,null))[_0xeb2b('0x21')](saveUpdates(_0xbea07d[_0xeb2b('0x47')],null))[_0xeb2b('0x21')](respondWithResult(_0x5b9267,null))['catch'](handleError(_0x5b9267,null));};exports[_0xeb2b('0x22')]=function(_0x3d26c6,_0xf123e6){return db[_0xeb2b('0x29')][_0xeb2b('0x46')]({'where':{'id':_0x3d26c6[_0xeb2b('0x44')]['id']}})[_0xeb2b('0x21')](handleEntityNotFound(_0xf123e6,null))['then'](removeEntity(_0xf123e6,null))[_0xeb2b('0x42')](handleError(_0xf123e6,null));};exports[_0xeb2b('0x48')]=function(_0x245522,_0x2a41fc){var _0x43015a;return db['sequelize']['transaction'](function(_0x2e9309){return db[_0xeb2b('0x29')][_0xeb2b('0x48')](_0x245522['body'],{'transaction':_0x2e9309})[_0xeb2b('0x21')](function(_0x2b5977){_0x43015a=_0x2b5977;var _0x4b34c5={'type':db[_0xeb2b('0x49')][_0xeb2b('0x4a')],'transaction':_0x2e9309};switch(_0x245522[_0xeb2b('0x47')][_0xeb2b('0x3b')]){case _0xeb2b('0x4b'):_0x4b34c5[_0xeb2b('0x3b')]=db[_0xeb2b('0x49')][_0xeb2b('0x4a')];break;case _0xeb2b('0x4c'):_0x4b34c5['type']=db[_0xeb2b('0x49')][_0xeb2b('0x4d')];break;case _0xeb2b('0x4e'):_0x4b34c5['type']=db[_0xeb2b('0x49')]['BOOLEAN'];_0x4b34c5[_0xeb2b('0x4f')]=![];break;default:}return db[_0xeb2b('0x50')]['queryInterface'][_0xeb2b('0x51')](_0xeb2b('0x52'),util['format']('cf_%d',_0x43015a['id']),_0x4b34c5);})['then'](function(){return _0x43015a;});})['then'](respondWithResult(_0x2a41fc,0xc9))[_0xeb2b('0x42')](handleError(_0x2a41fc,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index aa249c1..6db924d 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 _0x7dbb=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','cm_custom_fields','lodash'];(function(_0x3146da,_0x277a70){var _0x1070de=function(_0x43a1b1){while(--_0x43a1b1){_0x3146da['push'](_0x3146da['shift']());}};_0x1070de(++_0x277a70);}(_0x7dbb,0x1ac));var _0xb7db=function(_0x2cc875,_0x5dbfb7){_0x2cc875=_0x2cc875-0x0;var _0x52a467=_0x7dbb[_0x2cc875];return _0x52a467;};'use strict';var _=require(_0xb7db('0x0'));var util=require('util');var logger=require(_0xb7db('0x1'))(_0xb7db('0x2'));var moment=require(_0xb7db('0x3'));var BPromise=require(_0xb7db('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7db('0x5'));var rimraf=require(_0xb7db('0x6'));var config=require(_0xb7db('0x7'));var attributes=require('./cmCustomField.attributes');module[_0xb7db('0x8')]=function(_0x152abc,_0x33d44e){return _0x152abc[_0xb7db('0x9')]('CmCustomField',attributes,{'tableName':_0xb7db('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c8b=['../../config/logger','moment','exports','define','CmCustomField','util'];(function(_0x26c8d7,_0x15dabc){var _0xa258eb=function(_0x5a28d8){while(--_0x5a28d8){_0x26c8d7['push'](_0x26c8d7['shift']());}};_0xa258eb(++_0x15dabc);}(_0x2c8b,0x83));var _0xb2c8=function(_0x48dbaa,_0x11f18e){_0x48dbaa=_0x48dbaa-0x0;var _0x10cdeb=_0x2c8b[_0x48dbaa];return _0x10cdeb;};'use strict';var _=require('lodash');var util=require(_0xb2c8('0x0'));var logger=require(_0xb2c8('0x1'))('api');var moment=require(_0xb2c8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0xb2c8('0x3')]=function(_0x40948a,_0x1f7eef){return _0x40948a[_0xb2c8('0x4')](_0xb2c8('0x5'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index e847931..6776d34 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 _0x5b02=['client','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x39fd11,_0x5d7883){var _0x302799=function(_0x4a0615){while(--_0x4a0615){_0x39fd11['push'](_0x39fd11['shift']());}};_0x302799(++_0x5d7883);}(_0x5b02,0xe9));var _0x25b0=function(_0x53d037,_0x378145){_0x53d037=_0x53d037-0x0;var _0x4c4072=_0x5b02[_0x53d037];return _0x4c4072;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var moment=require(_0x25b0('0x2'));var BPromise=require(_0x25b0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x25b0('0x5'))(_0x25b0('0x6'));var config=require(_0x25b0('0x7'));var jayson=require(_0x25b0('0x8'));var client=jayson[_0x25b0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d82c6,_0xd8276d,_0x49ef3a){return new BPromise(function(_0x412954,_0x4d3e71){return client['request'](_0x1d82c6,_0x49ef3a)[_0x25b0('0xa')](function(_0x45429b){logger[_0x25b0('0xb')]('CmCustomField,\x20%s,\x20%s',_0xd8276d,_0x25b0('0xc'));logger[_0x25b0('0xd')](_0x25b0('0xe'),_0xd8276d,_0x25b0('0xc'),JSON[_0x25b0('0xf')](_0x45429b));if(_0x45429b[_0x25b0('0x10')]){if(_0x45429b[_0x25b0('0x10')][_0x25b0('0x11')]===0x1f4){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x4d3e71(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x412954(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}else{logger[_0x25b0('0xb')]('CmCustomField,\x20%s,\x20%s',_0xd8276d,'request\x20sent');_0x412954(_0x45429b[_0x25b0('0x14')]['message']);}})[_0x25b0('0x15')](function(_0x1d009f){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x1d009f);_0x4d3e71(_0x1d009f);});});} \ No newline at end of file +var _0x7bae=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x7bae,0x13b));var _0xe7ba=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x7bae[_0x2b10c6];return _0x3789d2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7ba('0x0'));var BPromise=require(_0xe7ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ba('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var config=require(_0xe7ba('0x6'));var jayson=require(_0xe7ba('0x7'));var client=jayson[_0xe7ba('0x8')][_0xe7ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5e59,_0x10b307,_0x34fb18){return new BPromise(function(_0x160565,_0x27b1d5){return client[_0xe7ba('0xa')](_0x3c5e59,_0x34fb18)[_0xe7ba('0xb')](function(_0x588f08){logger[_0xe7ba('0xc')](_0xe7ba('0xd'),_0x10b307,_0xe7ba('0xe'));logger[_0xe7ba('0xf')](_0xe7ba('0x10'),_0x10b307,_0xe7ba('0xe'),JSON[_0xe7ba('0x11')](_0x588f08));if(_0x588f08[_0xe7ba('0x12')]){if(_0x588f08[_0xe7ba('0x12')]['code']===0x1f4){logger[_0xe7ba('0x12')]('CmCustomField,\x20%s,\x20%s',_0x10b307,_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);return _0x27b1d5(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}logger[_0xe7ba('0x12')](_0xe7ba('0xd'),_0x10b307,_0x588f08['error']['message']);return _0x160565(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}else{logger[_0xe7ba('0xc')]('CmCustomField,\x20%s,\x20%s',_0x10b307,_0xe7ba('0xe'));_0x160565(_0x588f08['result']['message']);}})['catch'](function(_0x393f75){logger['error'](_0xe7ba('0xd'),_0x10b307,_0x393f75);_0x27b1d5(_0x393f75);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index cf83c35..06e06a8 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 _0x4eab=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x4b3963,_0x5e15c7){var _0x2c2b17=function(_0x6f0d46){while(--_0x6f0d46){_0x4b3963['push'](_0x4b3963['shift']());}};_0x2c2b17(++_0x5e15c7);}(_0x4eab,0x194));var _0xb4ea=function(_0x376331,_0x379880){_0x376331=_0x376331-0x0;var _0x4c0a9c=_0x4eab[_0x376331];return _0x4c0a9c;};'use strict';var multer=require(_0xb4ea('0x0'));var util=require(_0xb4ea('0x1'));var path=require(_0xb4ea('0x2'));var timeout=require(_0xb4ea('0x3'));var express=require(_0xb4ea('0x4'));var router=express[_0xb4ea('0x5')]();var auth=require(_0xb4ea('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb4ea('0x7'));var controller=require(_0xb4ea('0x8'));router[_0xb4ea('0x9')]('/',auth[_0xb4ea('0xa')](),controller[_0xb4ea('0xb')]);router['get'](_0xb4ea('0xc'),auth['isAuthenticated'](),controller[_0xb4ea('0xd')]);router[_0xb4ea('0xe')]('/',auth[_0xb4ea('0xa')](),controller[_0xb4ea('0xf')]);router[_0xb4ea('0x10')](_0xb4ea('0xc'),auth[_0xb4ea('0xa')](),controller[_0xb4ea('0x11')]);router['delete']('/:id',auth[_0xb4ea('0xa')](),controller[_0xb4ea('0x12')]);module[_0xb4ea('0x13')]=router; \ No newline at end of file +var _0xf59f=['/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','get'];(function(_0x171e67,_0x309c7c){var _0x2ad59a=function(_0x57f13d){while(--_0x57f13d){_0x171e67['push'](_0x171e67['shift']());}};_0x2ad59a(++_0x309c7c);}(_0xf59f,0x182));var _0xff59=function(_0x24049c,_0x407bfb){_0x24049c=_0x24049c-0x0;var _0xb15763=_0xf59f[_0x24049c];return _0xb15763;};'use strict';var multer=require(_0xff59('0x0'));var util=require(_0xff59('0x1'));var path=require(_0xff59('0x2'));var timeout=require(_0xff59('0x3'));var express=require(_0xff59('0x4'));var router=express[_0xff59('0x5')]();var auth=require(_0xff59('0x6'));var interaction=require(_0xff59('0x7'));var config=require(_0xff59('0x8'));var controller=require(_0xff59('0x9'));router['get']('/',auth[_0xff59('0xa')](),controller[_0xff59('0xb')]);router[_0xff59('0xc')](_0xff59('0xd'),auth['isAuthenticated'](),controller[_0xff59('0xe')]);router[_0xff59('0xf')]('/',auth[_0xff59('0xa')](),controller[_0xff59('0x10')]);router[_0xff59('0x11')](_0xff59('0xd'),auth['isAuthenticated'](),controller[_0xff59('0x12')]);router['delete'](_0xff59('0xd'),auth['isAuthenticated'](),controller[_0xff59('0x13')]);module[_0xff59('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index e99136c..2ddbf35 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 _0xc949=['STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','exports'];(function(_0x2b26a1,_0x50b92a){var _0x428118=function(_0x312513){while(--_0x312513){_0x2b26a1['push'](_0x2b26a1['shift']());}};_0x428118(++_0x50b92a);}(_0xc949,0x181));var _0x9c94=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xc949[_0x2bf141];return _0x48277b;};'use strict';var moment=require(_0x9c94('0x0'));var Sequelize=require('sequelize');module[_0x9c94('0x1')]={'phone':{'type':Sequelize[_0x9c94('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x9c94('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x9c94('0x4')],'defaultValue':moment()['format'](_0x9c94('0x5'))},'countbusyretry':{'type':Sequelize[_0x9c94('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9c94('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x9c94('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9c94('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9c94('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x9c94('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x9c94('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x9c94('0x6')],'unique':_0x9c94('0x8')},'ListId':{'type':Sequelize[_0x9c94('0x6')],'unique':_0x9c94('0x8')},'UserId':{'type':Sequelize[_0x9c94('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x9c94('0x6')],'unique':_0x9c94('0x8')},'CampaignId':{'type':Sequelize[_0x9c94('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9c94('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9c94('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9c94('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9c94('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x46ed=['moment','sequelize','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue'];(function(_0x5e9018,_0x5d3a28){var _0x2062e2=function(_0x4aa0d8){while(--_0x4aa0d8){_0x5e9018['push'](_0x5e9018['shift']());}};_0x2062e2(++_0x5d3a28);}(_0x46ed,0x168));var _0xd46e=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x46ed[_0x1928c9];return _0x51b5fb;};'use strict';var moment=require(_0xd46e('0x0'));var Sequelize=require(_0xd46e('0x1'));module['exports']={'phone':{'type':Sequelize[_0xd46e('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xd46e('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xd46e('0x4')],'defaultValue':moment()['format'](_0xd46e('0x5'))},'countbusyretry':{'type':Sequelize[_0xd46e('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd46e('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xd46e('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd46e('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd46e('0x4')]},'priority':{'type':Sequelize[_0xd46e('0x6')](0x2)[_0xd46e('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xd46e('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xd46e('0x6')],'unique':_0xd46e('0x8')},'ListId':{'type':Sequelize[_0xd46e('0x6')],'unique':_0xd46e('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xd46e('0x6')],'unique':_0xd46e('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xd46e('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd46e('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd46e('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd46e('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd46e('0x6')],'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 3f86242..02bb778 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 _0x4bde=['entity\x20not\x20found','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','CmHopper','rawAttributes','type','key','model','query','keys','filters','intersection','$and','$or','$gt','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$notLike','$like','$overlap','$any','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','filter','options','includeAll','include','findAll','catch','show','merge','find','create','body','update','describe','params','VoiceQueueId','CampaignId','omit','createdAt','updatedAt','state','statedesc','deleted','campaign','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','sequelize','transaction','format','direction','prev','isEmpty','hopperIds','scheduledAt','ASC','DESC','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','Queue','dialActive','getOpenContacts','count','isNumber','CmHopper,\x20%s,\x20%s,\x20%s'];(function(_0x198ac0,_0x3f5079){var _0x3d78f1=function(_0x445f84){while(--_0x445f84){_0x198ac0['push'](_0x198ac0['shift']());}};_0x3d78f1(++_0x3f5079);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x1cf41c,_0x1ff134){_0x1cf41c=_0x1cf41c-0x0;var _0x5990c1=_0x4bde[_0x1cf41c];return _0x5990c1;};'use strict';var pdf=require(_0xe4bd('0x0'));var emlformat=require(_0xe4bd('0x1'));var rimraf=require(_0xe4bd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe4bd('0x3'));var rp=require(_0xe4bd('0x4'));var moment=require(_0xe4bd('0x5'));var BPromise=require(_0xe4bd('0x6'));var Mustache=require('mustache');var util=require(_0xe4bd('0x7'));var path=require(_0xe4bd('0x8'));var sox=require(_0xe4bd('0x9'));var csv=require(_0xe4bd('0xa'));var ejs=require(_0xe4bd('0xb'));var fs=require('fs');var _=require(_0xe4bd('0xc'));var squel=require('squel');var crypto=require(_0xe4bd('0xd'));var jsforce=require(_0xe4bd('0xe'));var deskjs=require(_0xe4bd('0xf'));var toCsv=require(_0xe4bd('0xa'));var querystring=require(_0xe4bd('0x10'));var Papa=require(_0xe4bd('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe4bd('0x12'));var hardwareService=require(_0xe4bd('0x13'));var logger=require(_0xe4bd('0x14'))('api');var utils=require(_0xe4bd('0x15'));var config=require(_0xe4bd('0x16'));var licenseUtil=require(_0xe4bd('0x17'));var db=require(_0xe4bd('0x18'))['db'];function respondWithStatusCode(_0x507e85,_0x7949ea){_0x7949ea=_0x7949ea||0xcc;return function(_0x5188e9){if(_0x5188e9){return _0x507e85[_0xe4bd('0x19')](_0x7949ea);}return _0x507e85['status'](_0x7949ea)[_0xe4bd('0x1a')]();};}function respondWithResult(_0x15b9f9,_0x25b993){_0x25b993=_0x25b993||0xc8;return function(_0x23e94c){if(_0x23e94c){return _0x15b9f9[_0xe4bd('0x1b')](_0x25b993)[_0xe4bd('0x1c')](_0x23e94c);}};}function respondWithFilteredResult(_0x15c3f0,_0x44ef1d){return function(_0x193221){if(_0x193221){var _0x2476f=_0x193221['count'],_0x355922=_0x44ef1d[_0xe4bd('0x1d')],_0x4337f7=_0x44ef1d[_0xe4bd('0x1d')]+_0x44ef1d['limit'],_0x470cd1;if(_0x4337f7>=_0x2476f){_0x4337f7=_0x2476f;_0x470cd1=0xc8;}else{_0x470cd1=0xce;}_0x15c3f0[_0xe4bd('0x1b')](_0x470cd1);return _0x15c3f0[_0xe4bd('0x1e')]('Content-Range',_0x355922+'-'+_0x4337f7+'/'+_0x2476f)[_0xe4bd('0x1c')](_0x193221);}return null;};}function patchUpdates(_0x56d572){return function(_0x5a9337){try{jsonpatch[_0xe4bd('0x1f')](_0x5a9337,_0x56d572,!![]);}catch(_0x339fb7){return BPromise[_0xe4bd('0x20')](_0x339fb7);}return _0x5a9337[_0xe4bd('0x21')]();};}function saveUpdates(_0x10a234,_0x12a646){return function(_0x1615c2){if(_0x1615c2){return _0x1615c2['update'](_0x10a234)[_0xe4bd('0x22')](function(_0x185db8){return _0x185db8;});}return null;};}function removeEntity(_0x5bd480,_0x2a5f40){return function(_0x3e8142){if(_0x3e8142){return _0x3e8142[_0xe4bd('0x23')]()[_0xe4bd('0x22')](function(){_0x5bd480[_0xe4bd('0x1b')](0xcc)[_0xe4bd('0x1a')]();});}};}function handleEntityNotFound(_0x10d9fc,_0x1e2abf){return function(_0x35d0ef){if(!_0x35d0ef){_0x10d9fc['sendStatus'](0x194);}return _0x35d0ef;};}function handleError(_0x1ab72b,_0x2ebf25){_0x2ebf25=_0x2ebf25||0x1f4;return function(_0x5d8a8e){logger[_0xe4bd('0x24')](_0x5d8a8e[_0xe4bd('0x25')]);if(_0x5d8a8e[_0xe4bd('0x26')]){delete _0x5d8a8e[_0xe4bd('0x26')];}_0x1ab72b[_0xe4bd('0x1b')](_0x2ebf25)[_0xe4bd('0x27')](_0x5d8a8e);};}exports[_0xe4bd('0x28')]=function(_0x3d8fc8,_0x534fdb){var _0x3eb927={},_0x234b73={},_0x1e04e7={'count':0x0,'rows':[]};var _0xa0babe=_[_0xe4bd('0x29')](db[_0xe4bd('0x2a')][_0xe4bd('0x2b')],function(_0x13d93a){return{'name':_0x13d93a['fieldName'],'type':_0x13d93a[_0xe4bd('0x2c')][_0xe4bd('0x2d')]};});_0x234b73[_0xe4bd('0x2e')]=_[_0xe4bd('0x29')](_0xa0babe,_0xe4bd('0x26'));_0x234b73[_0xe4bd('0x2f')]=_[_0xe4bd('0x30')](_0x3d8fc8[_0xe4bd('0x2f')]);_0x234b73[_0xe4bd('0x31')]=_[_0xe4bd('0x32')](_0x234b73[_0xe4bd('0x2e')],_0x234b73[_0xe4bd('0x2f')]);_0x234b73['filters']=_['concat'](_0x234b73[_0xe4bd('0x31')],[_0xe4bd('0x33'),_0xe4bd('0x34'),_0xe4bd('0x35'),'$gte',_0xe4bd('0x36'),_0xe4bd('0x37'),_0xe4bd('0x38'),_0xe4bd('0x39'),_0xe4bd('0x3a'),_0xe4bd('0x3b'),_0xe4bd('0x3c'),'$in','$notIn','$like',_0xe4bd('0x3d'),'$iLike','$notILike',_0xe4bd('0x3e'),_0xe4bd('0x3f'),'$contains','$contained',_0xe4bd('0x40')]);_0x3eb927[_0xe4bd('0x41')]=_['intersection'](_0x234b73[_0xe4bd('0x2e')],qs[_0xe4bd('0x42')](_0x3d8fc8[_0xe4bd('0x2f')][_0xe4bd('0x42')]));_0x3eb927[_0xe4bd('0x41')]=_0x3eb927[_0xe4bd('0x41')][_0xe4bd('0x43')]?_0x3eb927[_0xe4bd('0x41')]:_0x234b73[_0xe4bd('0x2e')];if(!_0x3d8fc8[_0xe4bd('0x2f')][_0xe4bd('0x44')](_0xe4bd('0x45'))){_0x3eb927[_0xe4bd('0x46')]=qs[_0xe4bd('0x46')](_0x3d8fc8['query'][_0xe4bd('0x46')]);_0x3eb927[_0xe4bd('0x1d')]=qs['offset'](_0x3d8fc8[_0xe4bd('0x2f')]['offset']);}_0x3eb927[_0xe4bd('0x47')]=qs[_0xe4bd('0x48')](_0x3d8fc8[_0xe4bd('0x2f')]['sort']);_0x3eb927['where']=qs[_0xe4bd('0x31')](_[_0xe4bd('0x49')](_0x3d8fc8[_0xe4bd('0x2f')],_0x234b73[_0xe4bd('0x31')]),_0xa0babe);if(_0x3d8fc8['query']['filter']){_0x3eb927[_0xe4bd('0x4a')]=_['merge'](_0x3eb927[_0xe4bd('0x4a')],{'$or':_[_0xe4bd('0x29')](_0xa0babe,function(_0x2874d6){if(_0x2874d6['type']!=='VIRTUAL'){var _0x14517f={};_0x14517f[_0x2874d6[_0xe4bd('0x26')]]={'$like':'%'+_0x3d8fc8[_0xe4bd('0x2f')][_0xe4bd('0x4b')]+'%'};return _0x14517f;}})});}_0x3eb927=_['merge']({},_0x3eb927,_0x3d8fc8[_0xe4bd('0x4c')]);var _0x116177={'where':_0x3eb927[_0xe4bd('0x4a')]};return db[_0xe4bd('0x2a')]['count'](_0x116177)[_0xe4bd('0x22')](function(_0x1e0811){_0x1e04e7['count']=_0x1e0811;if(_0x3d8fc8[_0xe4bd('0x2f')][_0xe4bd('0x4d')]){_0x3eb927[_0xe4bd('0x4e')]=[{'all':!![]}];}return db[_0xe4bd('0x2a')][_0xe4bd('0x4f')](_0x3eb927);})[_0xe4bd('0x22')](function(_0x3eb867){_0x1e04e7['rows']=_0x3eb867;return _0x1e04e7;})[_0xe4bd('0x22')](respondWithFilteredResult(_0x534fdb,_0x3eb927))[_0xe4bd('0x50')](handleError(_0x534fdb,null));};exports[_0xe4bd('0x51')]=function(_0x1d1225,_0x1d6b4e){var _0x2a4fbc={'raw':!![],'where':{'id':_0x1d1225['params']['id']}},_0x371f4c={};_0x371f4c['model']=_[_0xe4bd('0x30')](db[_0xe4bd('0x2a')][_0xe4bd('0x2b')]);_0x371f4c['query']=_['keys'](_0x1d1225[_0xe4bd('0x2f')]);_0x371f4c['filters']=_[_0xe4bd('0x32')](_0x371f4c[_0xe4bd('0x2e')],_0x371f4c['query']);_0x2a4fbc[_0xe4bd('0x41')]=_[_0xe4bd('0x32')](_0x371f4c[_0xe4bd('0x2e')],qs[_0xe4bd('0x42')](_0x1d1225[_0xe4bd('0x2f')][_0xe4bd('0x42')]));_0x2a4fbc[_0xe4bd('0x41')]=_0x2a4fbc['attributes']['length']?_0x2a4fbc[_0xe4bd('0x41')]:_0x371f4c[_0xe4bd('0x2e')];if(_0x1d1225[_0xe4bd('0x2f')][_0xe4bd('0x4d')]){_0x2a4fbc[_0xe4bd('0x4e')]=[{'all':!![]}];}_0x2a4fbc=_[_0xe4bd('0x52')]({},_0x2a4fbc,_0x1d1225[_0xe4bd('0x4c')]);return db['CmHopper'][_0xe4bd('0x53')](_0x2a4fbc)[_0xe4bd('0x22')](handleEntityNotFound(_0x1d6b4e,null))['then'](respondWithResult(_0x1d6b4e,null))['catch'](handleError(_0x1d6b4e,null));};exports[_0xe4bd('0x54')]=function(_0x2220d0,_0x3038c4){return db['CmHopper'][_0xe4bd('0x54')](_0x2220d0[_0xe4bd('0x55')],{})['then'](respondWithResult(_0x3038c4,0xc9))[_0xe4bd('0x50')](handleError(_0x3038c4,null));};exports[_0xe4bd('0x56')]=function(_0x252a97,_0x581b40){if(_0x252a97[_0xe4bd('0x55')]['id']){delete _0x252a97[_0xe4bd('0x55')]['id'];}return db[_0xe4bd('0x2a')][_0xe4bd('0x53')]({'where':{'id':_0x252a97['params']['id']}})[_0xe4bd('0x22')](handleEntityNotFound(_0x581b40,null))[_0xe4bd('0x22')](saveUpdates(_0x252a97[_0xe4bd('0x55')],null))[_0xe4bd('0x22')](respondWithResult(_0x581b40,null))[_0xe4bd('0x50')](handleError(_0x581b40,null));};exports[_0xe4bd('0x57')]=function(_0xde3bea,_0x3a00da){return db[_0xe4bd('0x2a')][_0xe4bd('0x57')]()[_0xe4bd('0x22')](respondWithResult(_0x3a00da,null))[_0xe4bd('0x50')](handleError(_0x3a00da,null));};exports['destroy']=function(_0x475df6,_0x519b4a){var _0x151db6;return db[_0xe4bd('0x2a')][_0xe4bd('0x53')]({'where':{'id':_0x475df6[_0xe4bd('0x58')]['id']}})[_0xe4bd('0x22')](handleEntityNotFound(_0x519b4a,null))[_0xe4bd('0x22')](function(_0x3e9315){if(_0x3e9315){return _0x3e9315[_0xe4bd('0x23')]()[_0xe4bd('0x22')](function(_0x479327){return _0x479327;});}})[_0xe4bd('0x22')](function(_0x198fdd){_0x151db6=_0x198fdd;if(_0x198fdd){if(_0x198fdd[_0xe4bd('0x59')]||_0x198fdd[_0xe4bd('0x5a')]){return db[_0x198fdd[_0xe4bd('0x59')]?'VoiceQueue':'Campaign'][_0xe4bd('0x53')]({'where':{'id':_0x198fdd['VoiceQueueId']?_0x198fdd['VoiceQueueId']:_0x198fdd[_0xe4bd('0x5a')]},'attributes':['id',_0xe4bd('0x26')],'raw':!![]});}}})[_0xe4bd('0x22')](function(_0x3059a5){var _0x3e644a={};if(_0x3059a5){_[_0xe4bd('0x52')](_0x3e644a,_[_0xe4bd('0x5b')](_0x151db6['dataValues'],[_0xe4bd('0x5c'),_0xe4bd('0x5d'),'id']));_0x3e644a[_0xe4bd('0x5e')]=0x15;_0x3e644a[_0xe4bd('0x5f')]=_0xe4bd('0x60');_0x3e644a[_0xe4bd('0x61')]=_0x3059a5[_0xe4bd('0x26')];_0x3e644a['membername']=_0x475df6[_0xe4bd('0x62')][_0xe4bd('0x26')];_0x3e644a[_0xe4bd('0x63')]=_0x475df6[_0xe4bd('0x62')]['id'];_0x3e644a[_0xe4bd('0x60')]=!![];_0x3e644a[_0xe4bd('0x64')]=moment()['format'](_0xe4bd('0x65'));_0x3e644a[_0xe4bd('0x66')]=_0x151db6[_0xe4bd('0x67')];_0x3e644a[_0xe4bd('0x68')]=_0x151db6[_0xe4bd('0x59')]?_0xe4bd('0x69'):'ivr';return db[_0xe4bd('0x6a')][_0xe4bd('0x53')]({'where':{'id':_0x3e644a[_0xe4bd('0x6b')]},'attributes':[_0xe4bd('0x6c'),_0xe4bd('0x6d')]})[_0xe4bd('0x22')](function(_0x9fa4b7){if(!_['isNil'](_0x519b4a)&&!_[_0xe4bd('0x6e')](_0x9fa4b7[_0xe4bd('0x6c')])){_0x3e644a[_0xe4bd('0x6f')]=_0x9fa4b7['firstName'];if(!_[_0xe4bd('0x6e')](_0x9fa4b7[_0xe4bd('0x6d')])){_0x3e644a[_0xe4bd('0x6f')]+='\x20'+_0x9fa4b7[_0xe4bd('0x6d')];}}})[_0xe4bd('0x70')](function(){return db['CmHopperFinal'][_0xe4bd('0x54')](_0x3e644a);});}})['then'](function(){return _0x519b4a[_0xe4bd('0x1b')](0xcc)[_0xe4bd('0x1a')]();})['catch'](handleError(_0x519b4a,null));};exports[_0xe4bd('0x71')]=function(_0x249ec5,_0x42550f,_0x3a2e66){var _0x53f045=[];return db[_0xe4bd('0x6a')]['describe']()[_0xe4bd('0x22')](function(_0x226da5){_0x53f045=_[_0xe4bd('0x30')](_0x226da5);return _0x249ec5['user'][_0xe4bd('0x72')]({'where':{'type':_0xe4bd('0x73'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xe4bd('0x74')],'raw':!![]});})[_0xe4bd('0x22')](function(_0x45d022){if(_0x45d022&&_0x45d022['length']){return db[_0xe4bd('0x75')][_0xe4bd('0x76')](function(_0x487c5c){var _0x43b93a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe4bd('0x77')](_0xe4bd('0x65'))},'VoiceQueueId':{'$in':_[_0xe4bd('0x29')](_0x45d022,'id')},'$or':[{'UserId':null},{'UserId':_0x249ec5[_0xe4bd('0x62')]['id']}]};var _0x355b11=[];if(_0x249ec5[_0xe4bd('0x55')][_0xe4bd('0x78')]&&_0x249ec5[_0xe4bd('0x55')]['direction']===_0xe4bd('0x79')){if(!_[_0xe4bd('0x7a')](_0x249ec5['body'][_0xe4bd('0x7b')])){_0x43b93a['id']={'$in':_0x249ec5[_0xe4bd('0x55')][_0xe4bd('0x7b')]};}_0x355b11=[['priority','ASC'],[_0xe4bd('0x7c'),_0x45d022[0x0][_0xe4bd('0x74')]===_0xe4bd('0x7d')?_0xe4bd('0x7e'):_0xe4bd('0x7d')],db['sequelize']['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xe4bd('0x7e')]];}else{if(!_[_0xe4bd('0x7a')](_0x249ec5[_0xe4bd('0x55')][_0xe4bd('0x7b')])){_0x43b93a['id']={'$notIn':_0x249ec5[_0xe4bd('0x55')][_0xe4bd('0x7b')]};}_0x355b11=[[_0xe4bd('0x7f'),_0xe4bd('0x7e')],['scheduledAt',_0x45d022[0x0][_0xe4bd('0x74')]],db[_0xe4bd('0x75')]['literal'](_0xe4bd('0x80')),['id',_0xe4bd('0x7d')]];}return db[_0xe4bd('0x2a')][_0xe4bd('0x81')]({'attributes':['id',_0xe4bd('0x82')],'where':_0x43b93a,'order':_0x355b11,'transaction':_0x487c5c,'lock':_0x487c5c[_0xe4bd('0x83')][_0xe4bd('0x84')],'include':[{'model':db['CmContact'],'as':_0xe4bd('0x85'),'attributes':_0x53f045,'include':[{'model':db[_0xe4bd('0x86')],'as':_0xe4bd('0x87'),'attributes':['id',_0xe4bd('0x26')]}]},{'model':db[_0xe4bd('0x88')],'as':'List','attributes':['id',_0xe4bd('0x26')]},{'model':db['VoiceQueue'],'as':_0xe4bd('0x89'),'attributes':['id','name',_0xe4bd('0x8a')]}]})[_0xe4bd('0x22')](function(_0xe704dc){if(_0xe704dc){return _0xe704dc['update']({'UserId':_0x249ec5[_0xe4bd('0x62')]['id']},{'transaction':_0x487c5c});}});});}})[_0xe4bd('0x22')](handleEntityNotFound(_0x42550f,null))[_0xe4bd('0x22')](respondWithResult(_0x42550f,null))['catch'](handleError(_0x42550f,null));};exports[_0xe4bd('0x8b')]=function(_0x11ff12,_0x1e24bf,_0x5797a9){return _0x11ff12[_0xe4bd('0x62')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xe4bd('0x22')](function(_0x5d400d){if(_0x5d400d&&_0x5d400d[_0xe4bd('0x43')]){return db[_0xe4bd('0x2a')][_0xe4bd('0x8c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe4bd('0x77')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xe4bd('0x29')](_0x5d400d,'id')},'$or':[{'UserId':null},{'UserId':_0x11ff12[_0xe4bd('0x62')]['id']}]}});}return 0x0;})[_0xe4bd('0x22')](function(_0x2e4c96){if(!_[_0xe4bd('0x6e')](_0x2e4c96)&&_[_0xe4bd('0x8d')](_0x2e4c96)){return _0x1e24bf[_0xe4bd('0x1b')](0xc8)[_0xe4bd('0x1c')]({'contacts':_0x2e4c96});}else{logger[_0xe4bd('0x24')](_0xe4bd('0x8e'),_0xe4bd('0x8b'),0x194,_0xe4bd('0x8f'));_0x1e24bf[_0xe4bd('0x19')](0x194);}})['catch'](handleError(_0x1e24bf,null));}; \ No newline at end of file +var _0x1399=['fields','length','hasOwnProperty','nolimit','offset','sort','where','filter','merge','type','includeAll','include','rows','params','options','find','catch','create','body','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','sequelize','transaction','direction','isEmpty','hopperIds','priority','ASC','dialOrderByScheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','CmContact','Contact','Company','CmList','List','Queue','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','count','limit','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','CmHopper','rawAttributes','key','model','keys','query','filters','intersection','concat','$or','$gt','$lt','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','attributes'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x1399,0x16c));var _0x9139=function(_0x46dc29,_0x18c45a){_0x46dc29=_0x46dc29-0x0;var _0x4bbb8d=_0x1399[_0x46dc29];return _0x4bbb8d;};'use strict';var pdf=require(_0x9139('0x0'));var emlformat=require(_0x9139('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9139('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9139('0x3'));var moment=require(_0x9139('0x4'));var BPromise=require(_0x9139('0x5'));var Mustache=require(_0x9139('0x6'));var util=require(_0x9139('0x7'));var path=require(_0x9139('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9139('0x9'));var fs=require('fs');var _=require(_0x9139('0xa'));var squel=require(_0x9139('0xb'));var crypto=require('crypto');var jsforce=require(_0x9139('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9139('0xd'));var Papa=require(_0x9139('0xe'));var Redis=require('ioredis');var authService=require(_0x9139('0xf'));var qs=require(_0x9139('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9139('0x11'))(_0x9139('0x12'));var utils=require(_0x9139('0x13'));var config=require(_0x9139('0x14'));var licenseUtil=require(_0x9139('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52b32d,_0x511ec9){_0x511ec9=_0x511ec9||0xcc;return function(_0x417637){if(_0x417637){return _0x52b32d['sendStatus'](_0x511ec9);}return _0x52b32d[_0x9139('0x16')](_0x511ec9)[_0x9139('0x17')]();};}function respondWithResult(_0x375ada,_0x262009){_0x262009=_0x262009||0xc8;return function(_0x5936d2){if(_0x5936d2){return _0x375ada[_0x9139('0x16')](_0x262009)['json'](_0x5936d2);}};}function respondWithFilteredResult(_0x58307f,_0x52c57b){return function(_0x159e50){if(_0x159e50){var _0x3e2bad=_0x159e50[_0x9139('0x18')],_0x1cd24e=_0x52c57b['offset'],_0x3fadf7=_0x52c57b['offset']+_0x52c57b[_0x9139('0x19')],_0x18801b;if(_0x3fadf7>=_0x3e2bad){_0x3fadf7=_0x3e2bad;_0x18801b=0xc8;}else{_0x18801b=0xce;}_0x58307f[_0x9139('0x16')](_0x18801b);return _0x58307f['set']('Content-Range',_0x1cd24e+'-'+_0x3fadf7+'/'+_0x3e2bad)[_0x9139('0x1a')](_0x159e50);}return null;};}function patchUpdates(_0x2c97b6){return function(_0x56add4){try{jsonpatch[_0x9139('0x1b')](_0x56add4,_0x2c97b6,!![]);}catch(_0x1ef57b){return BPromise[_0x9139('0x1c')](_0x1ef57b);}return _0x56add4[_0x9139('0x1d')]();};}function saveUpdates(_0xd2eb33,_0x6f901b){return function(_0x2672d0){if(_0x2672d0){return _0x2672d0[_0x9139('0x1e')](_0xd2eb33)[_0x9139('0x1f')](function(_0x355c71){return _0x355c71;});}return null;};}function removeEntity(_0x1bac18,_0x269f8a){return function(_0x5a3e2e){if(_0x5a3e2e){return _0x5a3e2e[_0x9139('0x20')]()[_0x9139('0x1f')](function(){_0x1bac18[_0x9139('0x16')](0xcc)[_0x9139('0x17')]();});}};}function handleEntityNotFound(_0x934732,_0x1a7350){return function(_0x4b7fe0){if(!_0x4b7fe0){_0x934732[_0x9139('0x21')](0x194);}return _0x4b7fe0;};}function handleError(_0x31c22d,_0x5b73ca){_0x5b73ca=_0x5b73ca||0x1f4;return function(_0x3ed4da){logger[_0x9139('0x22')](_0x3ed4da[_0x9139('0x23')]);if(_0x3ed4da['name']){delete _0x3ed4da[_0x9139('0x24')];}_0x31c22d[_0x9139('0x16')](_0x5b73ca)['send'](_0x3ed4da);};}exports[_0x9139('0x25')]=function(_0x39e8cf,_0x452d9a){var _0x55e95f={},_0x1c4cda={},_0x22e11e={'count':0x0,'rows':[]};var _0x2a35fd=_[_0x9139('0x26')](db[_0x9139('0x27')][_0x9139('0x28')],function(_0xfe6854){return{'name':_0xfe6854['fieldName'],'type':_0xfe6854['type'][_0x9139('0x29')]};});_0x1c4cda[_0x9139('0x2a')]=_[_0x9139('0x26')](_0x2a35fd,'name');_0x1c4cda['query']=_[_0x9139('0x2b')](_0x39e8cf[_0x9139('0x2c')]);_0x1c4cda[_0x9139('0x2d')]=_[_0x9139('0x2e')](_0x1c4cda[_0x9139('0x2a')],_0x1c4cda['query']);_0x1c4cda['filters']=_[_0x9139('0x2f')](_0x1c4cda['filters'],['$and',_0x9139('0x30'),_0x9139('0x31'),'$gte',_0x9139('0x32'),_0x9139('0x33'),'$ne',_0x9139('0x34'),_0x9139('0x35'),_0x9139('0x36'),_0x9139('0x37'),_0x9139('0x38'),_0x9139('0x39'),_0x9139('0x3a'),_0x9139('0x3b'),_0x9139('0x3c'),_0x9139('0x3d'),_0x9139('0x3a'),'$overlap',_0x9139('0x3e'),_0x9139('0x3f'),'$any']);_0x55e95f[_0x9139('0x40')]=_[_0x9139('0x2e')](_0x1c4cda[_0x9139('0x2a')],qs['fields'](_0x39e8cf[_0x9139('0x2c')][_0x9139('0x41')]));_0x55e95f[_0x9139('0x40')]=_0x55e95f[_0x9139('0x40')][_0x9139('0x42')]?_0x55e95f[_0x9139('0x40')]:_0x1c4cda[_0x9139('0x2a')];if(!_0x39e8cf[_0x9139('0x2c')][_0x9139('0x43')](_0x9139('0x44'))){_0x55e95f['limit']=qs[_0x9139('0x19')](_0x39e8cf[_0x9139('0x2c')][_0x9139('0x19')]);_0x55e95f[_0x9139('0x45')]=qs[_0x9139('0x45')](_0x39e8cf[_0x9139('0x2c')][_0x9139('0x45')]);}_0x55e95f['order']=qs[_0x9139('0x46')](_0x39e8cf['query'][_0x9139('0x46')]);_0x55e95f[_0x9139('0x47')]=qs[_0x9139('0x2d')](_['pick'](_0x39e8cf[_0x9139('0x2c')],_0x1c4cda[_0x9139('0x2d')]),_0x2a35fd);if(_0x39e8cf[_0x9139('0x2c')][_0x9139('0x48')]){_0x55e95f[_0x9139('0x47')]=_[_0x9139('0x49')](_0x55e95f[_0x9139('0x47')],{'$or':_[_0x9139('0x26')](_0x2a35fd,function(_0x118d53){if(_0x118d53[_0x9139('0x4a')]!=='VIRTUAL'){var _0xf14393={};_0xf14393[_0x118d53[_0x9139('0x24')]]={'$like':'%'+_0x39e8cf[_0x9139('0x2c')]['filter']+'%'};return _0xf14393;}})});}_0x55e95f=_['merge']({},_0x55e95f,_0x39e8cf['options']);var _0x465f49={'where':_0x55e95f[_0x9139('0x47')]};return db[_0x9139('0x27')][_0x9139('0x18')](_0x465f49)[_0x9139('0x1f')](function(_0x5cbd03){_0x22e11e[_0x9139('0x18')]=_0x5cbd03;if(_0x39e8cf[_0x9139('0x2c')][_0x9139('0x4b')]){_0x55e95f[_0x9139('0x4c')]=[{'all':!![]}];}return db[_0x9139('0x27')]['findAll'](_0x55e95f);})[_0x9139('0x1f')](function(_0x42f7b6){_0x22e11e[_0x9139('0x4d')]=_0x42f7b6;return _0x22e11e;})[_0x9139('0x1f')](respondWithFilteredResult(_0x452d9a,_0x55e95f))['catch'](handleError(_0x452d9a,null));};exports['show']=function(_0x39d3dc,_0x4311d2){var _0x5571bf={'raw':!![],'where':{'id':_0x39d3dc[_0x9139('0x4e')]['id']}},_0x5003db={};_0x5003db[_0x9139('0x2a')]=_['keys'](db[_0x9139('0x27')][_0x9139('0x28')]);_0x5003db['query']=_[_0x9139('0x2b')](_0x39d3dc['query']);_0x5003db['filters']=_[_0x9139('0x2e')](_0x5003db[_0x9139('0x2a')],_0x5003db[_0x9139('0x2c')]);_0x5571bf[_0x9139('0x40')]=_[_0x9139('0x2e')](_0x5003db['model'],qs[_0x9139('0x41')](_0x39d3dc[_0x9139('0x2c')][_0x9139('0x41')]));_0x5571bf['attributes']=_0x5571bf[_0x9139('0x40')][_0x9139('0x42')]?_0x5571bf[_0x9139('0x40')]:_0x5003db[_0x9139('0x2a')];if(_0x39d3dc[_0x9139('0x2c')][_0x9139('0x4b')]){_0x5571bf[_0x9139('0x4c')]=[{'all':!![]}];}_0x5571bf=_[_0x9139('0x49')]({},_0x5571bf,_0x39d3dc[_0x9139('0x4f')]);return db[_0x9139('0x27')][_0x9139('0x50')](_0x5571bf)['then'](handleEntityNotFound(_0x4311d2,null))[_0x9139('0x1f')](respondWithResult(_0x4311d2,null))[_0x9139('0x51')](handleError(_0x4311d2,null));};exports[_0x9139('0x52')]=function(_0x4b6f63,_0x1fe453){return db[_0x9139('0x27')]['create'](_0x4b6f63[_0x9139('0x53')],{})[_0x9139('0x1f')](respondWithResult(_0x1fe453,0xc9))[_0x9139('0x51')](handleError(_0x1fe453,null));};exports['update']=function(_0x8ecdc4,_0xbce82d){if(_0x8ecdc4[_0x9139('0x53')]['id']){delete _0x8ecdc4[_0x9139('0x53')]['id'];}return db['CmHopper'][_0x9139('0x50')]({'where':{'id':_0x8ecdc4[_0x9139('0x4e')]['id']}})[_0x9139('0x1f')](handleEntityNotFound(_0xbce82d,null))['then'](saveUpdates(_0x8ecdc4[_0x9139('0x53')],null))[_0x9139('0x1f')](respondWithResult(_0xbce82d,null))[_0x9139('0x51')](handleError(_0xbce82d,null));};exports[_0x9139('0x54')]=function(_0x19ef6f,_0x363368){return db[_0x9139('0x27')]['describe']()[_0x9139('0x1f')](respondWithResult(_0x363368,null))[_0x9139('0x51')](handleError(_0x363368,null));};exports['destroy']=function(_0x1717f3,_0x1e1290){var _0x3d6627;return db[_0x9139('0x27')][_0x9139('0x50')]({'where':{'id':_0x1717f3['params']['id']}})[_0x9139('0x1f')](handleEntityNotFound(_0x1e1290,null))[_0x9139('0x1f')](function(_0x4f7ef8){if(_0x4f7ef8){return _0x4f7ef8['destroy']()[_0x9139('0x1f')](function(_0x32d717){return _0x32d717;});}})[_0x9139('0x1f')](function(_0x4b580c){_0x3d6627=_0x4b580c;if(_0x4b580c){if(_0x4b580c[_0x9139('0x55')]||_0x4b580c['CampaignId']){return db[_0x4b580c['VoiceQueueId']?_0x9139('0x56'):_0x9139('0x57')][_0x9139('0x50')]({'where':{'id':_0x4b580c[_0x9139('0x55')]?_0x4b580c['VoiceQueueId']:_0x4b580c[_0x9139('0x58')]},'attributes':['id',_0x9139('0x24')],'raw':!![]});}}})[_0x9139('0x1f')](function(_0x4a74d2){var _0x18421a={};if(_0x4a74d2){_[_0x9139('0x49')](_0x18421a,_[_0x9139('0x59')](_0x3d6627[_0x9139('0x5a')],[_0x9139('0x5b'),_0x9139('0x5c'),'id']));_0x18421a[_0x9139('0x5d')]=0x15;_0x18421a[_0x9139('0x5e')]=_0x9139('0x5f');_0x18421a[_0x9139('0x60')]=_0x4a74d2[_0x9139('0x24')];_0x18421a[_0x9139('0x61')]=_0x1717f3[_0x9139('0x62')][_0x9139('0x24')];_0x18421a['UserId']=_0x1717f3[_0x9139('0x62')]['id'];_0x18421a[_0x9139('0x5f')]=!![];_0x18421a[_0x9139('0x63')]=moment()[_0x9139('0x64')](_0x9139('0x65'));_0x18421a['calleridnum']=_0x3d6627[_0x9139('0x66')];_0x18421a[_0x9139('0x67')]=_0x3d6627[_0x9139('0x55')]?_0x9139('0x68'):_0x9139('0x69');return db['CmContact']['find']({'where':{'id':_0x18421a[_0x9139('0x6a')]},'attributes':[_0x9139('0x6b'),'lastName']})[_0x9139('0x1f')](function(_0xd20c65){if(!_[_0x9139('0x6c')](_0x1e1290)&&!_[_0x9139('0x6c')](_0xd20c65[_0x9139('0x6b')])){_0x18421a[_0x9139('0x6d')]=_0xd20c65[_0x9139('0x6b')];if(!_[_0x9139('0x6c')](_0xd20c65[_0x9139('0x6e')])){_0x18421a['calleridname']+='\x20'+_0xd20c65[_0x9139('0x6e')];}}})[_0x9139('0x6f')](function(){return db[_0x9139('0x70')][_0x9139('0x52')](_0x18421a);});}})['then'](function(){return _0x1e1290['status'](0xcc)[_0x9139('0x17')]();})[_0x9139('0x51')](handleError(_0x1e1290,null));};exports[_0x9139('0x71')]=function(_0x2eb415,_0x4b17c1,_0x43b2f1){var _0x32bf47=[];return db['CmContact'][_0x9139('0x54')]()[_0x9139('0x1f')](function(_0x3c1bcf){_0x32bf47=_[_0x9139('0x2b')](_0x3c1bcf);return _0x2eb415[_0x9139('0x62')][_0x9139('0x72')]({'where':{'type':_0x9139('0x73'),'dialActive':!![],'dialMethod':_0x9139('0x74')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})['then'](function(_0x4fb7d2){if(_0x4fb7d2&&_0x4fb7d2[_0x9139('0x42')]){return db[_0x9139('0x75')][_0x9139('0x76')](function(_0x4eefd8){var _0x42f66c={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9139('0x64')](_0x9139('0x65'))},'VoiceQueueId':{'$in':_[_0x9139('0x26')](_0x4fb7d2,'id')},'$or':[{'UserId':null},{'UserId':_0x2eb415[_0x9139('0x62')]['id']}]};var _0x3aacdb=[];if(_0x2eb415['body'][_0x9139('0x77')]&&_0x2eb415['body'][_0x9139('0x77')]==='prev'){if(!_[_0x9139('0x78')](_0x2eb415[_0x9139('0x53')]['hopperIds'])){_0x42f66c['id']={'$in':_0x2eb415['body'][_0x9139('0x79')]};}_0x3aacdb=[[_0x9139('0x7a'),_0x9139('0x7b')],['scheduledAt',_0x4fb7d2[0x0][_0x9139('0x7c')]===_0x9139('0x7b')?_0x9139('0x7d'):_0x9139('0x7b')],db['sequelize']['literal'](_0x9139('0x7e')),['id',_0x9139('0x7d')]];}else{if(!_['isEmpty'](_0x2eb415[_0x9139('0x53')][_0x9139('0x79')])){_0x42f66c['id']={'$notIn':_0x2eb415[_0x9139('0x53')][_0x9139('0x79')]};}_0x3aacdb=[[_0x9139('0x7a'),_0x9139('0x7d')],[_0x9139('0x7f'),_0x4fb7d2[0x0][_0x9139('0x7c')]],db[_0x9139('0x75')][_0x9139('0x80')](_0x9139('0x81')),['id',_0x9139('0x7b')]];}return db[_0x9139('0x27')]['findOne']({'attributes':['id',_0x9139('0x82')],'where':_0x42f66c,'order':_0x3aacdb,'transaction':_0x4eefd8,'lock':_0x4eefd8[_0x9139('0x83')][_0x9139('0x84')],'include':[{'model':db[_0x9139('0x85')],'as':_0x9139('0x86'),'attributes':_0x32bf47,'include':[{'model':db['CmCompany'],'as':_0x9139('0x87'),'attributes':['id','name']}]},{'model':db[_0x9139('0x88')],'as':_0x9139('0x89'),'attributes':['id',_0x9139('0x24')]},{'model':db['VoiceQueue'],'as':_0x9139('0x8a'),'attributes':['id',_0x9139('0x24'),'dialActive']}]})[_0x9139('0x1f')](function(_0x1c31a3){if(_0x1c31a3){return _0x1c31a3[_0x9139('0x1e')]({'UserId':_0x2eb415[_0x9139('0x62')]['id']},{'transaction':_0x4eefd8});}});});}})[_0x9139('0x1f')](handleEntityNotFound(_0x4b17c1,null))[_0x9139('0x1f')](respondWithResult(_0x4b17c1,null))[_0x9139('0x51')](handleError(_0x4b17c1,null));};exports[_0x9139('0x8b')]=function(_0x143841,_0x4fc904,_0x2e321e){return _0x143841[_0x9139('0x62')][_0x9139('0x72')]({'where':{'type':_0x9139('0x73'),'dialActive':!![],'dialMethod':_0x9139('0x74')},'attributes':['id'],'raw':!![]})['then'](function(_0x2bff78){if(_0x2bff78&&_0x2bff78[_0x9139('0x42')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9139('0x64')](_0x9139('0x65'))},'VoiceQueueId':{'$in':_[_0x9139('0x26')](_0x2bff78,'id')},'$or':[{'UserId':null},{'UserId':_0x143841[_0x9139('0x62')]['id']}]}});}return 0x0;})['then'](function(_0x1daad3){if(!_[_0x9139('0x6c')](_0x1daad3)&&_[_0x9139('0x8c')](_0x1daad3)){return _0x4fc904[_0x9139('0x16')](0xc8)[_0x9139('0x1a')]({'contacts':_0x1daad3});}else{logger[_0x9139('0x22')](_0x9139('0x8d'),_0x9139('0x8b'),0x194,_0x9139('0x8e'));_0x4fc904[_0x9139('0x21')](0x194);}})[_0x9139('0x51')](handleError(_0x4fc904,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 42f3910..6e02526 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 _0x9972=['CmHopper','scheduledat','phone','priority','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9972,0x154));var _0x2997=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9972[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2997('0x0'))(_0x2997('0x1'));var moment=require(_0x2997('0x2'));var BPromise=require(_0x2997('0x3'));var rp=require(_0x2997('0x4'));var fs=require('fs');var path=require(_0x2997('0x5'));var rimraf=require(_0x2997('0x6'));var config=require(_0x2997('0x7'));var attributes=require('./cmHopper.attributes');module[_0x2997('0x8')]=function(_0x2f64ca,_0x1977d5){return _0x2f64ca[_0x2997('0x9')](_0x2997('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x2997('0xb'),'fields':[_0x2997('0xb')]},{'name':_0x2997('0xc'),'fields':[_0x2997('0xc')]},{'name':_0x2997('0xd'),'fields':[_0x2997('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3cba=['../../config/environment','./cmHopper.attributes','exports','define','cm_hopper','scheduledat','phone','priority','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0xcfb0ef,_0x1d5ab5){var _0x53f938=function(_0x219d1d){while(--_0x219d1d){_0xcfb0ef['push'](_0xcfb0ef['shift']());}};_0x53f938(++_0x1d5ab5);}(_0x3cba,0x1b5));var _0xa3cb=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x3cba[_0x3a2a3c];return _0x50ac9a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa3cb('0x0'))(_0xa3cb('0x1'));var moment=require('moment');var BPromise=require(_0xa3cb('0x2'));var rp=require(_0xa3cb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa3cb('0x4'));var config=require(_0xa3cb('0x5'));var attributes=require(_0xa3cb('0x6'));module[_0xa3cb('0x7')]=function(_0x17e883,_0x49edcb){return _0x17e883[_0xa3cb('0x8')]('CmHopper',attributes,{'tableName':_0xa3cb('0x9'),'paranoid':![],'indexes':[{'name':_0xa3cb('0xa'),'fields':[_0xa3cb('0xa')]},{'name':_0xa3cb('0xb'),'fields':[_0xa3cb('0xb')]},{'name':_0xa3cb('0xc'),'fields':[_0xa3cb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 729c318..7abe3c5 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 _0x6b43=['client','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','map','include','catch','ShowCmHopper','find','model','CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','destroy','CmContact','describe','transaction','Contact','keys','User','Agent','name','voicePause','length','push','UserId','all','GetContactDialer','sequelize','CmHopperFinal','MoveContactManagedDialer','literal','`scheduledat`\x20>=\x20','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','CountReScheduled','GetContactRecallMe','order','LOCK','UPDATE','GetCmHopperPreview','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x153c6a,_0x2a217a){var _0xce898f=function(_0x84c97c){while(--_0x84c97c){_0x153c6a['push'](_0x153c6a['shift']());}};_0xce898f(++_0x2a217a);}(_0x6b43,0x80));var _0x36b4=function(_0x209213,_0x16a917){_0x209213=_0x209213-0x0;var _0xd194c0=_0x6b43[_0x209213];return _0xd194c0;};'use strict';var _=require('lodash');var util=require(_0x36b4('0x0'));var moment=require(_0x36b4('0x1'));var BPromise=require('bluebird');var rs=require(_0x36b4('0x2'));var fs=require('fs');var Redis=require(_0x36b4('0x3'));var db=require(_0x36b4('0x4'))['db'];var utils=require(_0x36b4('0x5'));var logger=require('../../config/logger')(_0x36b4('0x6'));var config=require('../../config/environment');var jayson=require(_0x36b4('0x7'));var client=jayson[_0x36b4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x247641,_0x51c5bb,_0x3c2976){return new BPromise(function(_0x1e6541,_0x4911dc){return client[_0x36b4('0x9')](_0x247641,_0x3c2976)[_0x36b4('0xa')](function(_0x281925){logger[_0x36b4('0xb')](_0x36b4('0xc'),_0x51c5bb,_0x36b4('0xd'));logger[_0x36b4('0xe')](_0x36b4('0xf'),_0x51c5bb,_0x36b4('0xd'),JSON[_0x36b4('0x10')](_0x281925));if(_0x281925[_0x36b4('0x11')]){if(_0x281925[_0x36b4('0x11')]['code']===0x1f4){logger[_0x36b4('0x11')](_0x36b4('0xc'),_0x51c5bb,_0x281925[_0x36b4('0x11')][_0x36b4('0x12')]);return _0x4911dc(_0x281925[_0x36b4('0x11')][_0x36b4('0x12')]);}logger[_0x36b4('0x11')](_0x36b4('0xc'),_0x51c5bb,_0x281925[_0x36b4('0x11')][_0x36b4('0x12')]);return _0x1e6541(_0x281925[_0x36b4('0x11')][_0x36b4('0x12')]);}else{logger[_0x36b4('0xb')](_0x36b4('0xc'),_0x51c5bb,_0x36b4('0xd'));_0x1e6541(_0x281925[_0x36b4('0x13')]['message']);}})['catch'](function(_0x4a48ee){logger[_0x36b4('0x11')](_0x36b4('0xc'),_0x51c5bb,_0x4a48ee);_0x4911dc(_0x4a48ee);});});}exports[_0x36b4('0x14')]=function(_0x254cc0){var _0x44a159=this;return new Promise(function(_0x410706,_0x1d8934){return db[_0x36b4('0x15')][_0x36b4('0x16')]({'raw':_0x254cc0['options']?_0x254cc0[_0x36b4('0x17')][_0x36b4('0x18')]===undefined?!![]:![]:!![],'where':_0x254cc0['options']?_0x254cc0[_0x36b4('0x17')][_0x36b4('0x19')]||null:null,'attributes':_0x254cc0[_0x36b4('0x17')]?_0x254cc0[_0x36b4('0x17')][_0x36b4('0x1a')]||null:null,'limit':_0x254cc0[_0x36b4('0x17')]?_0x254cc0[_0x36b4('0x17')][_0x36b4('0x1b')]||null:null,'include':_0x254cc0[_0x36b4('0x17')]?_0x254cc0[_0x36b4('0x17')]['include']?_[_0x36b4('0x1c')](_0x254cc0[_0x36b4('0x17')]['include'],function(_0x40b909){return{'model':db[_0x40b909['model']],'as':_0x40b909['as'],'attributes':_0x40b909['attributes'],'include':_0x40b909['include']?_[_0x36b4('0x1c')](_0x40b909[_0x36b4('0x1d')],function(_0x17253e){return{'model':db[_0x17253e['model']],'as':_0x17253e['as'],'attributes':_0x17253e['attributes'],'include':_0x17253e[_0x36b4('0x1d')]?_[_0x36b4('0x1c')](_0x17253e[_0x36b4('0x1d')],function(_0x4bdf00){return{'model':db[_0x4bdf00['model']],'as':_0x4bdf00['as'],'attributes':_0x4bdf00[_0x36b4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x36b4('0xa')](function(_0x50275c){logger[_0x36b4('0xb')](_0x36b4('0x14'),_0x254cc0);logger['debug'](_0x36b4('0x14'),_0x254cc0,JSON[_0x36b4('0x10')](_0x50275c));_0x410706(_0x50275c);})[_0x36b4('0x1e')](function(_0x2e626d){logger['error'](_0x36b4('0x14'),_0x2e626d[_0x36b4('0x12')],_0x254cc0);_0x1d8934(_0x44a159[_0x36b4('0x11')](0x1f4,_0x2e626d['message']));});});};exports[_0x36b4('0x1f')]=function(_0x7abb60){var _0x4109f5=this;return new Promise(function(_0x27f321,_0x3c0da2){return db['CmHopper'][_0x36b4('0x20')]({'raw':_0x7abb60[_0x36b4('0x17')]?_0x7abb60['options'][_0x36b4('0x18')]===undefined?!![]:![]:!![],'where':_0x7abb60[_0x36b4('0x17')]?_0x7abb60[_0x36b4('0x17')]['where']||null:null,'attributes':_0x7abb60[_0x36b4('0x17')]?_0x7abb60[_0x36b4('0x17')][_0x36b4('0x1a')]||null:null,'include':_0x7abb60['options']?_0x7abb60[_0x36b4('0x17')][_0x36b4('0x1d')]?_[_0x36b4('0x1c')](_0x7abb60['options']['include'],function(_0x32632b){return{'model':db[_0x32632b[_0x36b4('0x21')]],'as':_0x32632b['as'],'attributes':_0x32632b[_0x36b4('0x1a')],'include':_0x32632b[_0x36b4('0x1d')]?_['map'](_0x32632b[_0x36b4('0x1d')],function(_0x29ac2c){return{'model':db[_0x29ac2c['model']],'as':_0x29ac2c['as'],'attributes':_0x29ac2c[_0x36b4('0x1a')],'include':_0x29ac2c[_0x36b4('0x1d')]?_[_0x36b4('0x1c')](_0x29ac2c['include'],function(_0x5328f2){return{'model':db[_0x5328f2['model']],'as':_0x5328f2['as'],'attributes':_0x5328f2[_0x36b4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x36b4('0xa')](function(_0x3594dc){logger[_0x36b4('0xb')](_0x36b4('0x1f'),_0x7abb60);logger[_0x36b4('0xe')](_0x36b4('0x1f'),_0x7abb60,JSON[_0x36b4('0x10')](_0x3594dc));_0x27f321(_0x3594dc);})[_0x36b4('0x1e')](function(_0x14cd2b){logger[_0x36b4('0x11')](_0x36b4('0x1f'),_0x14cd2b['message'],_0x7abb60);_0x3c0da2(_0x4109f5['error'](0x1f4,_0x14cd2b['message']));});});};exports[_0x36b4('0x22')]=function(_0x11224d){var _0x508a6b=this;return new Promise(function(_0x4af6ad,_0x4f5481){return db['CmHopper'][_0x36b4('0x23')](_0x11224d[_0x36b4('0x24')],{'raw':_0x11224d[_0x36b4('0x17')]?_0x11224d[_0x36b4('0x17')][_0x36b4('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2ec1e7){logger['info'](_0x36b4('0x22'),_0x11224d);logger[_0x36b4('0xe')](_0x36b4('0x22'),_0x11224d,JSON[_0x36b4('0x10')](_0x2ec1e7));_0x4af6ad(_0x2ec1e7);})[_0x36b4('0x1e')](function(_0x56b773){logger[_0x36b4('0x11')](_0x36b4('0x22'),_0x56b773['message'],_0x11224d);_0x4f5481(_0x508a6b[_0x36b4('0x11')](0x1f4,_0x56b773['message']));});});};exports[_0x36b4('0x25')]=function(_0x51e751){var _0x1a95d9=this;return new Promise(function(_0x592e1d,_0x4c6755){return db[_0x36b4('0x15')][_0x36b4('0x26')](_0x51e751[_0x36b4('0x24')],{'raw':_0x51e751[_0x36b4('0x17')]?_0x51e751[_0x36b4('0x17')][_0x36b4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51e751[_0x36b4('0x17')]?_0x51e751[_0x36b4('0x17')][_0x36b4('0x19')]||null:null,'attributes':_0x51e751[_0x36b4('0x17')]?_0x51e751['options'][_0x36b4('0x1a')]||null:null,'limit':_0x51e751[_0x36b4('0x17')]?_0x51e751['options'][_0x36b4('0x1b')]||null:null})['then'](function(_0x2312ef){logger[_0x36b4('0xb')](_0x36b4('0x25'),_0x51e751);logger[_0x36b4('0xe')]('UpdateCmHopper',_0x51e751,JSON[_0x36b4('0x10')](_0x2312ef));_0x592e1d(_0x2312ef);})['catch'](function(_0x257de5){logger[_0x36b4('0x11')](_0x36b4('0x25'),_0x257de5[_0x36b4('0x12')],_0x51e751);_0x4c6755(_0x1a95d9[_0x36b4('0x11')](0x1f4,_0x257de5[_0x36b4('0x12')]));});});};exports[_0x36b4('0x27')]=function(_0x4167d4){var _0x483493=this;return new Promise(function(_0x4dd9d9,_0x462975){return db[_0x36b4('0x15')][_0x36b4('0x28')]({'where':_0x4167d4[_0x36b4('0x17')]?_0x4167d4[_0x36b4('0x17')][_0x36b4('0x19')]||null:null})['then'](function(_0x56aad4){logger[_0x36b4('0xb')](_0x36b4('0x27'),_0x4167d4);logger[_0x36b4('0xe')](_0x36b4('0x27'),_0x4167d4,JSON[_0x36b4('0x10')](_0x56aad4));_0x4dd9d9(_0x56aad4);})['catch'](function(_0x1326ad){logger[_0x36b4('0x11')](_0x36b4('0x27'),_0x1326ad[_0x36b4('0x12')],_0x4167d4);_0x462975(_0x483493[_0x36b4('0x11')](0x1f4,_0x1326ad[_0x36b4('0x12')]));});});};exports['GetContactDialer']=function(_0x31898d){var _0x470350=this;return new Promise(function(_0x2e48e8,_0x10784c){return db[_0x36b4('0x29')][_0x36b4('0x2a')]()['then'](function(_0x444388){return db['sequelize'][_0x36b4('0x2b')](function(_0x1f8dc0){return db['CmHopper']['findAll']({'where':_0x31898d['options']?_0x31898d[_0x36b4('0x17')][_0x36b4('0x19')]||null:null,'attributes':_0x31898d[_0x36b4('0x17')]?_0x31898d[_0x36b4('0x17')][_0x36b4('0x1a')]||null:null,'limit':_0x31898d[_0x36b4('0x17')]?_0x31898d['options'][_0x36b4('0x1b')]||null:null,'order':_0x31898d[_0x36b4('0x17')]?_0x31898d[_0x36b4('0x17')]['order']||null:null,'transaction':_0x1f8dc0,'lock':_0x1f8dc0['LOCK']['UPDATE'],'include':[{'model':db[_0x36b4('0x29')],'as':_0x36b4('0x2c'),'attributes':_[_0x36b4('0x2d')](_0x444388)},{'model':db[_0x36b4('0x2e')],'as':_0x36b4('0x2f'),'attributes':['id',_0x36b4('0x30'),_0x36b4('0x31')]}]})[_0x36b4('0xa')](function(_0x25042e){var _0x1835f4=[];var _0x12172b=[];for(var _0x6a1cf2=0x0;_0x6a1cf2<_0x25042e[_0x36b4('0x32')];_0x6a1cf2+=0x1){if(!_0x12172b['includes'](_0x25042e[_0x6a1cf2]['UserId'])){_0x12172b[_0x36b4('0x33')](_0x25042e[_0x6a1cf2][_0x36b4('0x34')]);_0x1835f4[_0x36b4('0x33')](_0x25042e[_0x6a1cf2][_0x36b4('0x26')](_0x31898d[_0x36b4('0x24')],{'transaction':_0x1f8dc0}));}}return BPromise[_0x36b4('0x35')](_0x1835f4);});})[_0x36b4('0xa')](function(_0x14e212){logger[_0x36b4('0xb')](_0x36b4('0x36'),_0x31898d);logger['debug']('GetContactDialer',_0x31898d,JSON[_0x36b4('0x10')](_0x14e212));_0x2e48e8(_0x14e212);})['catch'](function(_0x41fa00){logger['error'](_0x36b4('0x36'),_0x41fa00[_0x36b4('0x12')],_0x31898d);_0x10784c(_0x470350['error'](0x1f4,_0x41fa00[_0x36b4('0x12')]));});});});};exports['MoveContactManagedDialer']=function(_0x2c256f){var _0x53dc12=this;return new Promise(function(_0x66d120,_0x434b9c){return db[_0x36b4('0x37')][_0x36b4('0x2b')](function(_0x211240){return db[_0x36b4('0x38')][_0x36b4('0x23')](_0x2c256f[_0x36b4('0x24')],{'raw':_0x2c256f['options']?_0x2c256f['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x211240})['then'](function(){return db[_0x36b4('0x15')]['destroy']({'where':_0x2c256f['options']?_0x2c256f[_0x36b4('0x17')][_0x36b4('0x19')]||null:null,'transaction':_0x211240});});})['then'](function(_0x4b7ea6){logger[_0x36b4('0xb')](_0x36b4('0x39'),_0x2c256f);logger[_0x36b4('0xe')](_0x36b4('0x39'),_0x2c256f,JSON['stringify'](_0x4b7ea6));_0x66d120(_0x4b7ea6);})['catch'](function(_0x1df669){logger[_0x36b4('0x11')](_0x36b4('0x39'),_0x1df669[_0x36b4('0x12')],_0x2c256f);_0x434b9c(_0x53dc12['error'](0x1f4,_0x1df669[_0x36b4('0x12')]));});});};exports['CountReScheduled']=function(_0x97dda4){var _0x422e53=this;return new Promise(function(_0x483e91,_0xe57e0c){return db['CmHopper'][_0x36b4('0x16')]({'raw':_0x97dda4['options']?_0x97dda4[_0x36b4('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x97dda4[_0x36b4('0x17')]?_0x97dda4[_0x36b4('0x17')][_0x36b4('0x19')]||null:null,'attributes':[[db[_0x36b4('0x37')]['fn']('COUNT',db[_0x36b4('0x37')]['fn']('IF',db[_0x36b4('0x37')][_0x36b4('0x3a')](_0x36b4('0x3b')+util['format'](_0x36b4('0x3c'),moment()['format'](_0x36b4('0x3d')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x36b4('0xa')](function(_0x9a1660){logger[_0x36b4('0xb')]('CountReScheduled',_0x97dda4);logger[_0x36b4('0xe')](_0x36b4('0x3e'),_0x97dda4,JSON[_0x36b4('0x10')](_0x9a1660));_0x483e91(_0x9a1660);})[_0x36b4('0x1e')](function(_0x45468e){logger[_0x36b4('0x11')](_0x36b4('0x3e'),_0x45468e[_0x36b4('0x12')],_0x97dda4);_0xe57e0c(_0x422e53['error'](0x1f4,_0x45468e[_0x36b4('0x12')]));});});};exports[_0x36b4('0x3f')]=function(_0x141a69){var _0x11fc0d=this;return new Promise(function(_0x1e8cd8,_0x43478e){return db['CmContact'][_0x36b4('0x2a')]()['then'](function(_0x140b44){return db[_0x36b4('0x37')][_0x36b4('0x2b')](function(_0x4100a2){return db[_0x36b4('0x15')]['findAll']({'where':_0x141a69[_0x36b4('0x17')]?_0x141a69[_0x36b4('0x17')][_0x36b4('0x19')]||null:null,'attributes':_0x141a69['options']?_0x141a69[_0x36b4('0x17')][_0x36b4('0x1a')]||null:null,'limit':0x1,'order':_0x141a69[_0x36b4('0x17')]?_0x141a69[_0x36b4('0x17')][_0x36b4('0x40')]||null:null,'group':db['CmHopper'][_0x36b4('0x34')],'transaction':_0x4100a2,'lock':_0x4100a2[_0x36b4('0x41')][_0x36b4('0x42')],'include':_0x141a69[_0x36b4('0x17')]?_0x141a69[_0x36b4('0x17')]['include']?_[_0x36b4('0x1c')](_0x141a69['options'][_0x36b4('0x1d')],function(_0x539f96){return{'model':db[_0x539f96[_0x36b4('0x21')]],'as':_0x539f96['as'],'attributes':_0x539f96[_0x36b4('0x1a')],'include':_0x539f96[_0x36b4('0x1d')]?_[_0x36b4('0x1c')](_0x539f96[_0x36b4('0x1d')],function(_0x4ce386){return{'model':db[_0x4ce386[_0x36b4('0x21')]],'as':_0x4ce386['as'],'attributes':_0x4ce386[_0x36b4('0x1a')],'include':_0x4ce386[_0x36b4('0x1d')]?_[_0x36b4('0x1c')](_0x4ce386[_0x36b4('0x1d')],function(_0x259b88){return{'model':db[_0x259b88[_0x36b4('0x21')]],'as':_0x259b88['as'],'attributes':_0x259b88[_0x36b4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x36b4('0xa')](function(_0x1f166f){var _0x4baed0=[];for(var _0x5cacb3=0x0;_0x5cacb3<_0x1f166f[_0x36b4('0x32')];_0x5cacb3+=0x1){_0x4baed0[_0x36b4('0x33')](_0x1f166f[_0x5cacb3][_0x36b4('0x26')](_0x141a69[_0x36b4('0x24')],{'transaction':_0x4100a2}));}return BPromise['all'](_0x4baed0);});})[_0x36b4('0xa')](function(_0x2a0a53){logger[_0x36b4('0xb')](_0x36b4('0x3f'),_0x141a69);logger[_0x36b4('0xe')](_0x36b4('0x3f'),_0x141a69,JSON['stringify'](_0x2a0a53));_0x1e8cd8(_0x2a0a53);})[_0x36b4('0x1e')](function(_0x35711e){logger[_0x36b4('0x11')]('GetContactRecallMe',_0x35711e[_0x36b4('0x12')],_0x141a69);_0x43478e(_0x11fc0d[_0x36b4('0x11')](0x1f4,_0x35711e['message']));});});});};exports[_0x36b4('0x43')]=function(_0x41a2e0){var _0x1c844c=this;return new Promise(function(_0x34c898,_0x1a1108){db['CmContact'][_0x36b4('0x2a')]()[_0x36b4('0xa')](function(_0x17840a){return db['CmHopper'][_0x36b4('0x16')]({'raw':_0x41a2e0[_0x36b4('0x17')]?_0x41a2e0[_0x36b4('0x17')][_0x36b4('0x18')]===undefined?!![]:![]:!![],'where':_0x41a2e0[_0x36b4('0x17')]?_0x41a2e0[_0x36b4('0x17')][_0x36b4('0x19')]||null:null,'attributes':_0x41a2e0[_0x36b4('0x17')]?_0x41a2e0[_0x36b4('0x17')]['attributes']||null:null,'limit':_0x41a2e0[_0x36b4('0x17')]?_0x41a2e0[_0x36b4('0x17')][_0x36b4('0x1b')]||null:null,'include':_0x41a2e0[_0x36b4('0x17')]?_0x41a2e0[_0x36b4('0x17')][_0x36b4('0x1d')]?_['map'](_0x41a2e0[_0x36b4('0x17')]['include'],function(_0x13bf9d){return{'model':db[_0x13bf9d[_0x36b4('0x21')]],'as':_0x13bf9d['as'],'attributes':_0x13bf9d['as']===_0x36b4('0x2c')?_['keys'](_0x17840a):_0x13bf9d[_0x36b4('0x1a')],'include':_0x13bf9d[_0x36b4('0x1d')]?_['map'](_0x13bf9d['include'],function(_0x17c694){return{'model':db[_0x17c694['model']],'as':_0x17c694['as'],'attributes':_0x17c694['attributes'],'include':_0x17c694['include']?_['map'](_0x17c694[_0x36b4('0x1d')],function(_0x397156){return{'model':db[_0x397156[_0x36b4('0x21')]],'as':_0x397156['as'],'attributes':_0x397156[_0x36b4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x36b4('0xa')](function(_0x2f797f){logger[_0x36b4('0xb')](_0x36b4('0x14'),_0x41a2e0);logger[_0x36b4('0xe')](_0x36b4('0x14'),_0x41a2e0,JSON[_0x36b4('0x10')](_0x2f797f));_0x34c898(_0x2f797f);})[_0x36b4('0x1e')](function(_0xa5f566){logger[_0x36b4('0x11')]('GetCmHopper',_0xa5f566[_0x36b4('0x12')],_0x41a2e0);_0x1a1108(_0x1c844c[_0x36b4('0x11')](0x1f4,_0xa5f566['message']));});});});}; \ No newline at end of file +var _0x37fb=['voicePause','includes','push','UserId','all','MoveContactManagedDialer','CmHopperFinal','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','CountReScheduled','GetContactRecallMe','length','GetCmHopperPreview','keys','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','GetCmHopper','findAll','options','raw','attributes','limit','include','map','model','then','ShowCmHopper','CmHopper','find','where','create','body','CreateCmHopper','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','order','LOCK','UPDATE','CmContact','Contact','Agent','name'];(function(_0x4cf7c9,_0x10915e){var _0x574ddb=function(_0x2b852b){while(--_0x2b852b){_0x4cf7c9['push'](_0x4cf7c9['shift']());}};_0x574ddb(++_0x10915e);}(_0x37fb,0x184));var _0xb37f=function(_0x4c4342,_0x4823a4){_0x4c4342=_0x4c4342-0x0;var _0x148dbc=_0x37fb[_0x4c4342];return _0x148dbc;};'use strict';var _=require(_0xb37f('0x0'));var util=require(_0xb37f('0x1'));var moment=require(_0xb37f('0x2'));var BPromise=require(_0xb37f('0x3'));var rs=require(_0xb37f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb37f('0x5'));var logger=require(_0xb37f('0x6'))(_0xb37f('0x7'));var config=require(_0xb37f('0x8'));var jayson=require(_0xb37f('0x9'));var client=jayson[_0xb37f('0xa')][_0xb37f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x510414,_0x9213ed,_0x356ae1){return new BPromise(function(_0x4c3f44,_0x2a58f5){return client[_0xb37f('0xc')](_0x510414,_0x356ae1)['then'](function(_0x1bbcc7){logger[_0xb37f('0xd')]('CmHopper,\x20%s,\x20%s',_0x9213ed,_0xb37f('0xe'));logger[_0xb37f('0xf')](_0xb37f('0x10'),_0x9213ed,'request\x20sent',JSON[_0xb37f('0x11')](_0x1bbcc7));if(_0x1bbcc7['error']){if(_0x1bbcc7[_0xb37f('0x12')][_0xb37f('0x13')]===0x1f4){logger[_0xb37f('0x12')](_0xb37f('0x14'),_0x9213ed,_0x1bbcc7[_0xb37f('0x12')][_0xb37f('0x15')]);return _0x2a58f5(_0x1bbcc7[_0xb37f('0x12')]['message']);}logger[_0xb37f('0x12')](_0xb37f('0x14'),_0x9213ed,_0x1bbcc7[_0xb37f('0x12')][_0xb37f('0x15')]);return _0x4c3f44(_0x1bbcc7[_0xb37f('0x12')]['message']);}else{logger['info'](_0xb37f('0x14'),_0x9213ed,_0xb37f('0xe'));_0x4c3f44(_0x1bbcc7[_0xb37f('0x16')][_0xb37f('0x15')]);}})[_0xb37f('0x17')](function(_0x5c2333){logger[_0xb37f('0x12')](_0xb37f('0x14'),_0x9213ed,_0x5c2333);_0x2a58f5(_0x5c2333);});});}exports[_0xb37f('0x18')]=function(_0x4b8e9f){var _0x50e859=this;return new Promise(function(_0x2ac076,_0x4f4080){return db['CmHopper'][_0xb37f('0x19')]({'raw':_0x4b8e9f[_0xb37f('0x1a')]?_0x4b8e9f[_0xb37f('0x1a')][_0xb37f('0x1b')]===undefined?!![]:![]:!![],'where':_0x4b8e9f[_0xb37f('0x1a')]?_0x4b8e9f[_0xb37f('0x1a')]['where']||null:null,'attributes':_0x4b8e9f[_0xb37f('0x1a')]?_0x4b8e9f['options'][_0xb37f('0x1c')]||null:null,'limit':_0x4b8e9f['options']?_0x4b8e9f[_0xb37f('0x1a')][_0xb37f('0x1d')]||null:null,'include':_0x4b8e9f[_0xb37f('0x1a')]?_0x4b8e9f[_0xb37f('0x1a')][_0xb37f('0x1e')]?_[_0xb37f('0x1f')](_0x4b8e9f[_0xb37f('0x1a')][_0xb37f('0x1e')],function(_0x51b55f){return{'model':db[_0x51b55f[_0xb37f('0x20')]],'as':_0x51b55f['as'],'attributes':_0x51b55f['attributes'],'include':_0x51b55f[_0xb37f('0x1e')]?_[_0xb37f('0x1f')](_0x51b55f[_0xb37f('0x1e')],function(_0x5de0d4){return{'model':db[_0x5de0d4[_0xb37f('0x20')]],'as':_0x5de0d4['as'],'attributes':_0x5de0d4[_0xb37f('0x1c')],'include':_0x5de0d4[_0xb37f('0x1e')]?_['map'](_0x5de0d4[_0xb37f('0x1e')],function(_0x1c8f4e){return{'model':db[_0x1c8f4e['model']],'as':_0x1c8f4e['as'],'attributes':_0x1c8f4e[_0xb37f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb37f('0x21')](function(_0x11763d){logger[_0xb37f('0xd')](_0xb37f('0x18'),_0x4b8e9f);logger['debug'](_0xb37f('0x18'),_0x4b8e9f,JSON[_0xb37f('0x11')](_0x11763d));_0x2ac076(_0x11763d);})['catch'](function(_0x527d97){logger['error'](_0xb37f('0x18'),_0x527d97[_0xb37f('0x15')],_0x4b8e9f);_0x4f4080(_0x50e859[_0xb37f('0x12')](0x1f4,_0x527d97[_0xb37f('0x15')]));});});};exports[_0xb37f('0x22')]=function(_0xa9aeab){var _0x40405f=this;return new Promise(function(_0x1056aa,_0x5bdb52){return db[_0xb37f('0x23')][_0xb37f('0x24')]({'raw':_0xa9aeab[_0xb37f('0x1a')]?_0xa9aeab['options'][_0xb37f('0x1b')]===undefined?!![]:![]:!![],'where':_0xa9aeab[_0xb37f('0x1a')]?_0xa9aeab['options'][_0xb37f('0x25')]||null:null,'attributes':_0xa9aeab['options']?_0xa9aeab[_0xb37f('0x1a')][_0xb37f('0x1c')]||null:null,'include':_0xa9aeab['options']?_0xa9aeab['options'][_0xb37f('0x1e')]?_[_0xb37f('0x1f')](_0xa9aeab['options']['include'],function(_0xbfbfb6){return{'model':db[_0xbfbfb6['model']],'as':_0xbfbfb6['as'],'attributes':_0xbfbfb6[_0xb37f('0x1c')],'include':_0xbfbfb6[_0xb37f('0x1e')]?_['map'](_0xbfbfb6[_0xb37f('0x1e')],function(_0xaca404){return{'model':db[_0xaca404[_0xb37f('0x20')]],'as':_0xaca404['as'],'attributes':_0xaca404[_0xb37f('0x1c')],'include':_0xaca404[_0xb37f('0x1e')]?_[_0xb37f('0x1f')](_0xaca404['include'],function(_0x1edb7c){return{'model':db[_0x1edb7c[_0xb37f('0x20')]],'as':_0x1edb7c['as'],'attributes':_0x1edb7c[_0xb37f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb37f('0x21')](function(_0x51cb0c){logger[_0xb37f('0xd')](_0xb37f('0x22'),_0xa9aeab);logger[_0xb37f('0xf')](_0xb37f('0x22'),_0xa9aeab,JSON[_0xb37f('0x11')](_0x51cb0c));_0x1056aa(_0x51cb0c);})[_0xb37f('0x17')](function(_0x273f29){logger[_0xb37f('0x12')](_0xb37f('0x22'),_0x273f29[_0xb37f('0x15')],_0xa9aeab);_0x5bdb52(_0x40405f['error'](0x1f4,_0x273f29[_0xb37f('0x15')]));});});};exports['CreateCmHopper']=function(_0x58ff2f){var _0xd48125=this;return new Promise(function(_0xb79482,_0x35b8a0){return db[_0xb37f('0x23')][_0xb37f('0x26')](_0x58ff2f[_0xb37f('0x27')],{'raw':_0x58ff2f[_0xb37f('0x1a')]?_0x58ff2f[_0xb37f('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xb37f('0x21')](function(_0x472947){logger[_0xb37f('0xd')]('CreateCmHopper',_0x58ff2f);logger[_0xb37f('0xf')](_0xb37f('0x28'),_0x58ff2f,JSON[_0xb37f('0x11')](_0x472947));_0xb79482(_0x472947);})['catch'](function(_0x2459c5){logger[_0xb37f('0x12')](_0xb37f('0x28'),_0x2459c5[_0xb37f('0x15')],_0x58ff2f);_0x35b8a0(_0xd48125['error'](0x1f4,_0x2459c5[_0xb37f('0x15')]));});});};exports[_0xb37f('0x29')]=function(_0x1d6294){var _0xeeefa9=this;return new Promise(function(_0x450f08,_0x2b2a59){return db['CmHopper'][_0xb37f('0x2a')](_0x1d6294[_0xb37f('0x27')],{'raw':_0x1d6294[_0xb37f('0x1a')]?_0x1d6294['options'][_0xb37f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d6294['options']?_0x1d6294['options']['where']||null:null,'attributes':_0x1d6294[_0xb37f('0x1a')]?_0x1d6294[_0xb37f('0x1a')][_0xb37f('0x1c')]||null:null,'limit':_0x1d6294[_0xb37f('0x1a')]?_0x1d6294[_0xb37f('0x1a')][_0xb37f('0x1d')]||null:null})['then'](function(_0x54fc08){logger['info'](_0xb37f('0x29'),_0x1d6294);logger['debug']('UpdateCmHopper',_0x1d6294,JSON['stringify'](_0x54fc08));_0x450f08(_0x54fc08);})['catch'](function(_0x1e06c5){logger['error']('UpdateCmHopper',_0x1e06c5[_0xb37f('0x15')],_0x1d6294);_0x2b2a59(_0xeeefa9[_0xb37f('0x12')](0x1f4,_0x1e06c5['message']));});});};exports[_0xb37f('0x2b')]=function(_0x287980){var _0x2b1023=this;return new Promise(function(_0x24cddc,_0x279df9){return db[_0xb37f('0x23')][_0xb37f('0x2c')]({'where':_0x287980[_0xb37f('0x1a')]?_0x287980[_0xb37f('0x1a')][_0xb37f('0x25')]||null:null})[_0xb37f('0x21')](function(_0x52b277){logger[_0xb37f('0xd')](_0xb37f('0x2b'),_0x287980);logger['debug'](_0xb37f('0x2b'),_0x287980,JSON[_0xb37f('0x11')](_0x52b277));_0x24cddc(_0x52b277);})['catch'](function(_0x3f1fd3){logger[_0xb37f('0x12')](_0xb37f('0x2b'),_0x3f1fd3[_0xb37f('0x15')],_0x287980);_0x279df9(_0x2b1023[_0xb37f('0x12')](0x1f4,_0x3f1fd3['message']));});});};exports[_0xb37f('0x2d')]=function(_0x1037fd){var _0x10ff2f=this;return new Promise(function(_0x1f9d5d,_0x101699){return db['CmContact'][_0xb37f('0x2e')]()['then'](function(_0x3bd9b9){return db[_0xb37f('0x2f')][_0xb37f('0x30')](function(_0x33376c){return db['CmHopper']['findAll']({'where':_0x1037fd[_0xb37f('0x1a')]?_0x1037fd[_0xb37f('0x1a')][_0xb37f('0x25')]||null:null,'attributes':_0x1037fd[_0xb37f('0x1a')]?_0x1037fd[_0xb37f('0x1a')][_0xb37f('0x1c')]||null:null,'limit':_0x1037fd['options']?_0x1037fd[_0xb37f('0x1a')][_0xb37f('0x1d')]||null:null,'order':_0x1037fd[_0xb37f('0x1a')]?_0x1037fd[_0xb37f('0x1a')][_0xb37f('0x31')]||null:null,'transaction':_0x33376c,'lock':_0x33376c[_0xb37f('0x32')][_0xb37f('0x33')],'include':[{'model':db[_0xb37f('0x34')],'as':_0xb37f('0x35'),'attributes':_['keys'](_0x3bd9b9)},{'model':db['User'],'as':_0xb37f('0x36'),'attributes':['id',_0xb37f('0x37'),_0xb37f('0x38')]}]})[_0xb37f('0x21')](function(_0x27a463){var _0xad8eec=[];var _0x1921a9=[];for(var _0x365ae4=0x0;_0x365ae4<_0x27a463['length'];_0x365ae4+=0x1){if(!_0x1921a9[_0xb37f('0x39')](_0x27a463[_0x365ae4]['UserId'])){_0x1921a9[_0xb37f('0x3a')](_0x27a463[_0x365ae4][_0xb37f('0x3b')]);_0xad8eec['push'](_0x27a463[_0x365ae4]['update'](_0x1037fd[_0xb37f('0x27')],{'transaction':_0x33376c}));}}return BPromise[_0xb37f('0x3c')](_0xad8eec);});})['then'](function(_0x1c6daa){logger[_0xb37f('0xd')]('GetContactDialer',_0x1037fd);logger['debug']('GetContactDialer',_0x1037fd,JSON['stringify'](_0x1c6daa));_0x1f9d5d(_0x1c6daa);})['catch'](function(_0x30b764){logger[_0xb37f('0x12')]('GetContactDialer',_0x30b764[_0xb37f('0x15')],_0x1037fd);_0x101699(_0x10ff2f[_0xb37f('0x12')](0x1f4,_0x30b764[_0xb37f('0x15')]));});});});};exports[_0xb37f('0x3d')]=function(_0x2aaaa4){var _0x4d19e4=this;return new Promise(function(_0x2ae301,_0x3410b0){return db[_0xb37f('0x2f')][_0xb37f('0x30')](function(_0x189fd5){return db[_0xb37f('0x3e')][_0xb37f('0x26')](_0x2aaaa4[_0xb37f('0x27')],{'raw':_0x2aaaa4[_0xb37f('0x1a')]?_0x2aaaa4[_0xb37f('0x1a')][_0xb37f('0x1b')]===undefined?!![]:![]:!![],'transaction':_0x189fd5})[_0xb37f('0x21')](function(){return db['CmHopper'][_0xb37f('0x2c')]({'where':_0x2aaaa4['options']?_0x2aaaa4[_0xb37f('0x1a')][_0xb37f('0x25')]||null:null,'transaction':_0x189fd5});});})[_0xb37f('0x21')](function(_0x5286ff){logger[_0xb37f('0xd')](_0xb37f('0x3d'),_0x2aaaa4);logger['debug']('MoveContactManagedDialer',_0x2aaaa4,JSON[_0xb37f('0x11')](_0x5286ff));_0x2ae301(_0x5286ff);})['catch'](function(_0x4a42df){logger['error'](_0xb37f('0x3d'),_0x4a42df['message'],_0x2aaaa4);_0x3410b0(_0x4d19e4[_0xb37f('0x12')](0x1f4,_0x4a42df[_0xb37f('0x15')]));});});};exports['CountReScheduled']=function(_0x22fad6){var _0xb8e60b=this;return new Promise(function(_0xb785f2,_0x459e3e){return db[_0xb37f('0x23')][_0xb37f('0x19')]({'raw':_0x22fad6[_0xb37f('0x1a')]?_0x22fad6[_0xb37f('0x1a')][_0xb37f('0x1b')]===undefined?!![]:![]:!![],'where':_0x22fad6[_0xb37f('0x1a')]?_0x22fad6[_0xb37f('0x1a')][_0xb37f('0x25')]||null:null,'attributes':[[db[_0xb37f('0x2f')]['fn'](_0xb37f('0x3f'),db[_0xb37f('0x2f')]['fn']('IF',db[_0xb37f('0x2f')]['literal'](_0xb37f('0x40')+util[_0xb37f('0x41')](_0xb37f('0x42'),moment()['format'](_0xb37f('0x43')))+'\x20,\x201,\x20null'))),_0xb37f('0x44')]]})['then'](function(_0xa4fb13){logger[_0xb37f('0xd')](_0xb37f('0x45'),_0x22fad6);logger[_0xb37f('0xf')]('CountReScheduled',_0x22fad6,JSON[_0xb37f('0x11')](_0xa4fb13));_0xb785f2(_0xa4fb13);})[_0xb37f('0x17')](function(_0x1e4148){logger[_0xb37f('0x12')](_0xb37f('0x45'),_0x1e4148[_0xb37f('0x15')],_0x22fad6);_0x459e3e(_0xb8e60b['error'](0x1f4,_0x1e4148[_0xb37f('0x15')]));});});};exports[_0xb37f('0x46')]=function(_0x5b4327){var _0x26e773=this;return new Promise(function(_0xc76c24,_0x5b8c7f){return db[_0xb37f('0x34')][_0xb37f('0x2e')]()[_0xb37f('0x21')](function(_0x8b931){return db[_0xb37f('0x2f')][_0xb37f('0x30')](function(_0xfb892b){return db['CmHopper'][_0xb37f('0x19')]({'where':_0x5b4327[_0xb37f('0x1a')]?_0x5b4327[_0xb37f('0x1a')][_0xb37f('0x25')]||null:null,'attributes':_0x5b4327['options']?_0x5b4327[_0xb37f('0x1a')][_0xb37f('0x1c')]||null:null,'limit':0x1,'order':_0x5b4327[_0xb37f('0x1a')]?_0x5b4327[_0xb37f('0x1a')][_0xb37f('0x31')]||null:null,'group':db[_0xb37f('0x23')][_0xb37f('0x3b')],'transaction':_0xfb892b,'lock':_0xfb892b[_0xb37f('0x32')][_0xb37f('0x33')],'include':_0x5b4327[_0xb37f('0x1a')]?_0x5b4327[_0xb37f('0x1a')]['include']?_['map'](_0x5b4327[_0xb37f('0x1a')][_0xb37f('0x1e')],function(_0x528ff0){return{'model':db[_0x528ff0['model']],'as':_0x528ff0['as'],'attributes':_0x528ff0[_0xb37f('0x1c')],'include':_0x528ff0[_0xb37f('0x1e')]?_['map'](_0x528ff0[_0xb37f('0x1e')],function(_0x2981cf){return{'model':db[_0x2981cf[_0xb37f('0x20')]],'as':_0x2981cf['as'],'attributes':_0x2981cf[_0xb37f('0x1c')],'include':_0x2981cf[_0xb37f('0x1e')]?_[_0xb37f('0x1f')](_0x2981cf['include'],function(_0x489724){return{'model':db[_0x489724[_0xb37f('0x20')]],'as':_0x489724['as'],'attributes':_0x489724[_0xb37f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb37f('0x21')](function(_0x16ec46){var _0x491baf=[];for(var _0x4a5c0b=0x0;_0x4a5c0b<_0x16ec46[_0xb37f('0x47')];_0x4a5c0b+=0x1){_0x491baf[_0xb37f('0x3a')](_0x16ec46[_0x4a5c0b][_0xb37f('0x2a')](_0x5b4327['body'],{'transaction':_0xfb892b}));}return BPromise['all'](_0x491baf);});})[_0xb37f('0x21')](function(_0x3811e9){logger[_0xb37f('0xd')](_0xb37f('0x46'),_0x5b4327);logger['debug'](_0xb37f('0x46'),_0x5b4327,JSON['stringify'](_0x3811e9));_0xc76c24(_0x3811e9);})[_0xb37f('0x17')](function(_0x596c86){logger[_0xb37f('0x12')](_0xb37f('0x46'),_0x596c86['message'],_0x5b4327);_0x5b8c7f(_0x26e773[_0xb37f('0x12')](0x1f4,_0x596c86['message']));});});});};exports[_0xb37f('0x48')]=function(_0x3657e5){var _0x41b5a7=this;return new Promise(function(_0x5d13f3,_0x4a9666){db['CmContact'][_0xb37f('0x2e')]()[_0xb37f('0x21')](function(_0x32f1c7){return db[_0xb37f('0x23')][_0xb37f('0x19')]({'raw':_0x3657e5[_0xb37f('0x1a')]?_0x3657e5[_0xb37f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3657e5['options']?_0x3657e5['options']['where']||null:null,'attributes':_0x3657e5[_0xb37f('0x1a')]?_0x3657e5[_0xb37f('0x1a')][_0xb37f('0x1c')]||null:null,'limit':_0x3657e5[_0xb37f('0x1a')]?_0x3657e5[_0xb37f('0x1a')][_0xb37f('0x1d')]||null:null,'include':_0x3657e5[_0xb37f('0x1a')]?_0x3657e5['options']['include']?_['map'](_0x3657e5['options'][_0xb37f('0x1e')],function(_0x391a56){return{'model':db[_0x391a56[_0xb37f('0x20')]],'as':_0x391a56['as'],'attributes':_0x391a56['as']==='Contact'?_[_0xb37f('0x49')](_0x32f1c7):_0x391a56[_0xb37f('0x1c')],'include':_0x391a56[_0xb37f('0x1e')]?_[_0xb37f('0x1f')](_0x391a56['include'],function(_0x233335){return{'model':db[_0x233335[_0xb37f('0x20')]],'as':_0x233335['as'],'attributes':_0x233335[_0xb37f('0x1c')],'include':_0x233335[_0xb37f('0x1e')]?_[_0xb37f('0x1f')](_0x233335['include'],function(_0x375981){return{'model':db[_0x375981['model']],'as':_0x375981['as'],'attributes':_0x375981[_0xb37f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb37f('0x21')](function(_0x189067){logger[_0xb37f('0xd')](_0xb37f('0x18'),_0x3657e5);logger[_0xb37f('0xf')](_0xb37f('0x18'),_0x3657e5,JSON[_0xb37f('0x11')](_0x189067));_0x5d13f3(_0x189067);})['catch'](function(_0x45a8b8){logger[_0xb37f('0x12')](_0xb37f('0x18'),_0x45a8b8[_0xb37f('0x15')],_0x3657e5);_0x4a9666(_0x41b5a7[_0xb37f('0x12')](0x1f4,_0x45a8b8['message']));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 2809d4a..c7cbb6b 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 _0xc113=['post','/preview','getPreview','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show'];(function(_0x5c95eb,_0x3cf961){var _0x22f196=function(_0x95b6db){while(--_0x95b6db){_0x5c95eb['push'](_0x5c95eb['shift']());}};_0x22f196(++_0x3cf961);}(_0xc113,0x1ab));var _0x3c11=function(_0x5ed34b,_0xc563f3){_0x5ed34b=_0x5ed34b-0x0;var _0x426f5b=_0xc113[_0x5ed34b];return _0x426f5b;};'use strict';var multer=require(_0x3c11('0x0'));var util=require(_0x3c11('0x1'));var path=require(_0x3c11('0x2'));var timeout=require(_0x3c11('0x3'));var express=require(_0x3c11('0x4'));var router=express[_0x3c11('0x5')]();var auth=require(_0x3c11('0x6'));var interaction=require(_0x3c11('0x7'));var config=require(_0x3c11('0x8'));var controller=require('./cmHopper.controller');router[_0x3c11('0x9')]('/',auth[_0x3c11('0xa')](),controller['index']);router[_0x3c11('0x9')](_0x3c11('0xb'),auth[_0x3c11('0xa')](),controller['describe']);router[_0x3c11('0x9')]('/opencontacts',auth['isAuthenticated'](),controller['getOpenContacts']);router[_0x3c11('0x9')](_0x3c11('0xc'),auth['isAuthenticated'](),controller[_0x3c11('0xd')]);router[_0x3c11('0xe')]('/',auth[_0x3c11('0xa')](),controller['create']);router[_0x3c11('0xe')](_0x3c11('0xf'),auth[_0x3c11('0xa')](),controller[_0x3c11('0x10')]);router[_0x3c11('0x11')]('/:id',auth[_0x3c11('0xa')](),controller[_0x3c11('0x12')]);router['delete'](_0x3c11('0xc'),auth[_0x3c11('0xa')](),controller[_0x3c11('0x13')]);module[_0x3c11('0x14')]=router; \ No newline at end of file +var _0x75e3=['util','path','express','Router','../../components/auth/service','get','index','isAuthenticated','describe','getOpenContacts','/:id','show','post','/preview','getPreview','put','update','delete','destroy','exports'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x75e3,0x104));var _0x375e=function(_0xa7e289,_0x453e27){_0xa7e289=_0xa7e289-0x0;var _0x34a2ff=_0x75e3[_0xa7e289];return _0x34a2ff;};'use strict';var multer=require('multer');var util=require(_0x375e('0x0'));var path=require(_0x375e('0x1'));var timeout=require('connect-timeout');var express=require(_0x375e('0x2'));var router=express[_0x375e('0x3')]();var auth=require(_0x375e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopper.controller');router[_0x375e('0x5')]('/',auth['isAuthenticated'](),controller[_0x375e('0x6')]);router['get']('/describe',auth[_0x375e('0x7')](),controller[_0x375e('0x8')]);router[_0x375e('0x5')]('/opencontacts',auth[_0x375e('0x7')](),controller[_0x375e('0x9')]);router[_0x375e('0x5')](_0x375e('0xa'),auth[_0x375e('0x7')](),controller[_0x375e('0xb')]);router[_0x375e('0xc')]('/',auth[_0x375e('0x7')](),controller['create']);router[_0x375e('0xc')](_0x375e('0xd'),auth[_0x375e('0x7')](),controller[_0x375e('0xe')]);router[_0x375e('0xf')](_0x375e('0xa'),auth['isAuthenticated'](),controller[_0x375e('0x10')]);router[_0x375e('0x11')](_0x375e('0xa'),auth[_0x375e('0x7')](),controller[_0x375e('0x12')]);module[_0x375e('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index c2abb62..79aed6e 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 _0x079c=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x5d2023,_0x4548c0){var _0xaed23=function(_0x3143ad){while(--_0x3143ad){_0x5d2023['push'](_0x5d2023['shift']());}};_0xaed23(++_0x4548c0);}(_0x079c,0x19c));var _0xc079=function(_0x44c9ad,_0xd57d6e){_0x44c9ad=_0x44c9ad-0x0;var _0x317211=_0x079c[_0x44c9ad];return _0x317211;};'use strict';var moment=require(_0xc079('0x0'));var Sequelize=require(_0xc079('0x1'));module[_0xc079('0x2')]={'phone':{'type':Sequelize[_0xc079('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xc079('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xc079('0x4')],'unique':_0xc079('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x028e=['STRING','INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0xb8d37c,_0x10a6a4){var _0x400f4b=function(_0x479ae1){while(--_0x479ae1){_0xb8d37c['push'](_0xb8d37c['shift']());}};_0x400f4b(++_0x10a6a4);}(_0x028e,0x1ef));var _0xe028=function(_0x40afaf,_0x4c8cc3){_0x40afaf=_0x40afaf-0x0;var _0x49fe2e=_0x028e[_0x40afaf];return _0x49fe2e;};'use strict';var moment=require(_0xe028('0x0'));var Sequelize=require(_0xe028('0x1'));module[_0xe028('0x2')]={'phone':{'type':Sequelize[_0xe028('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xe028('0x4')],'unique':_0xe028('0x5')},'ListId':{'type':Sequelize[_0xe028('0x4')],'unique':_0xe028('0x5')},'VoiceQueueId':{'type':Sequelize[_0xe028('0x4')],'unique':_0xe028('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 2c3847c..2a8cf07 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 _0x4c40=['params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','stack','name','send','map','CmHopperBlack','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','keys','options','body','find'];(function(_0x354da4,_0x54eec9){var _0x42c80f=function(_0x29f012){while(--_0x29f012){_0x354da4['push'](_0x354da4['shift']());}};_0x42c80f(++_0x54eec9);}(_0x4c40,0x1a7));var _0x04c4=function(_0x41eb6c,_0x37d623){_0x41eb6c=_0x41eb6c-0x0;var _0x366ffd=_0x4c40[_0x41eb6c];return _0x366ffd;};'use strict';var pdf=require(_0x04c4('0x0'));var emlformat=require(_0x04c4('0x1'));var rimraf=require(_0x04c4('0x2'));var zipdir=require(_0x04c4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x04c4('0x4'));var moment=require(_0x04c4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x04c4('0x6'));var util=require(_0x04c4('0x7'));var path=require(_0x04c4('0x8'));var sox=require(_0x04c4('0x9'));var csv=require(_0x04c4('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x04c4('0xb'));var squel=require(_0x04c4('0xc'));var crypto=require('crypto');var jsforce=require(_0x04c4('0xd'));var deskjs=require(_0x04c4('0xe'));var toCsv=require(_0x04c4('0xa'));var querystring=require(_0x04c4('0xf'));var Papa=require(_0x04c4('0x10'));var Redis=require(_0x04c4('0x11'));var authService=require(_0x04c4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x04c4('0x13'));var hardwareService=require(_0x04c4('0x14'));var logger=require(_0x04c4('0x15'))(_0x04c4('0x16'));var utils=require('../../config/utils');var config=require(_0x04c4('0x17'));var licenseUtil=require(_0x04c4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d1df5,_0x20d39f){_0x20d39f=_0x20d39f||0xcc;return function(_0x2f897a){if(_0x2f897a){return _0x4d1df5[_0x04c4('0x19')](_0x20d39f);}return _0x4d1df5[_0x04c4('0x1a')](_0x20d39f)[_0x04c4('0x1b')]();};}function respondWithResult(_0xfcb78d,_0x5c967a){_0x5c967a=_0x5c967a||0xc8;return function(_0x2cd291){if(_0x2cd291){return _0xfcb78d[_0x04c4('0x1a')](_0x5c967a)[_0x04c4('0x1c')](_0x2cd291);}};}function respondWithFilteredResult(_0x32e9c8,_0x16473a){return function(_0x53ee41){if(_0x53ee41){var _0x493ce1=_0x53ee41[_0x04c4('0x1d')],_0x2ce0f0=_0x16473a[_0x04c4('0x1e')],_0x4b336b=_0x16473a['offset']+_0x16473a[_0x04c4('0x1f')],_0x1afef7;if(_0x4b336b>=_0x493ce1){_0x4b336b=_0x493ce1;_0x1afef7=0xc8;}else{_0x1afef7=0xce;}_0x32e9c8[_0x04c4('0x1a')](_0x1afef7);return _0x32e9c8[_0x04c4('0x20')](_0x04c4('0x21'),_0x2ce0f0+'-'+_0x4b336b+'/'+_0x493ce1)[_0x04c4('0x1c')](_0x53ee41);}return null;};}function patchUpdates(_0xf4deb9){return function(_0x4aa66c){try{jsonpatch['apply'](_0x4aa66c,_0xf4deb9,!![]);}catch(_0x3299b9){return BPromise[_0x04c4('0x22')](_0x3299b9);}return _0x4aa66c['save']();};}function saveUpdates(_0x176661,_0xe0c6fa){return function(_0x352388){if(_0x352388){return _0x352388[_0x04c4('0x23')](_0x176661)[_0x04c4('0x24')](function(_0x3cf8da){return _0x3cf8da;});}return null;};}function removeEntity(_0xe0c02a,_0x5cff57){return function(_0x3da4a4){if(_0x3da4a4){return _0x3da4a4['destroy']()[_0x04c4('0x24')](function(){_0xe0c02a[_0x04c4('0x1a')](0xcc)[_0x04c4('0x1b')]();});}};}function handleEntityNotFound(_0x1261ef,_0x4880d9){return function(_0x3ce9fb){if(!_0x3ce9fb){_0x1261ef[_0x04c4('0x19')](0x194);}return _0x3ce9fb;};}function handleError(_0x4d5d8e,_0x15e170){_0x15e170=_0x15e170||0x1f4;return function(_0x59f301){logger['error'](_0x59f301[_0x04c4('0x25')]);if(_0x59f301[_0x04c4('0x26')]){delete _0x59f301[_0x04c4('0x26')];}_0x4d5d8e[_0x04c4('0x1a')](_0x15e170)[_0x04c4('0x27')](_0x59f301);};}exports['index']=function(_0x515fbe,_0x2883fa){var _0x13d4e2={},_0x1ca5df={},_0x3b7a7c={'count':0x0,'rows':[]};var _0x381729=_[_0x04c4('0x28')](db[_0x04c4('0x29')]['rawAttributes'],function(_0x87463c){return{'name':_0x87463c[_0x04c4('0x2a')],'type':_0x87463c[_0x04c4('0x2b')]['key']};});_0x1ca5df[_0x04c4('0x2c')]=_['map'](_0x381729,_0x04c4('0x26'));_0x1ca5df['query']=_['keys'](_0x515fbe[_0x04c4('0x2d')]);_0x1ca5df['filters']=_[_0x04c4('0x2e')](_0x1ca5df[_0x04c4('0x2c')],_0x1ca5df[_0x04c4('0x2d')]);_0x13d4e2[_0x04c4('0x2f')]=_[_0x04c4('0x2e')](_0x1ca5df[_0x04c4('0x2c')],qs[_0x04c4('0x30')](_0x515fbe[_0x04c4('0x2d')][_0x04c4('0x30')]));_0x13d4e2[_0x04c4('0x2f')]=_0x13d4e2[_0x04c4('0x2f')][_0x04c4('0x31')]?_0x13d4e2[_0x04c4('0x2f')]:_0x1ca5df[_0x04c4('0x2c')];if(!_0x515fbe[_0x04c4('0x2d')][_0x04c4('0x32')]('nolimit')){_0x13d4e2[_0x04c4('0x1f')]=qs[_0x04c4('0x1f')](_0x515fbe['query'][_0x04c4('0x1f')]);_0x13d4e2[_0x04c4('0x1e')]=qs[_0x04c4('0x1e')](_0x515fbe[_0x04c4('0x2d')][_0x04c4('0x1e')]);}_0x13d4e2['order']=qs[_0x04c4('0x33')](_0x515fbe['query']['sort']);_0x13d4e2['where']=qs[_0x04c4('0x34')](_[_0x04c4('0x35')](_0x515fbe[_0x04c4('0x2d')],_0x1ca5df[_0x04c4('0x34')]),_0x381729);if(_0x515fbe['query'][_0x04c4('0x36')]){_0x13d4e2[_0x04c4('0x37')]=_['merge'](_0x13d4e2['where'],{'$or':_[_0x04c4('0x28')](_0x381729,function(_0x48c403){if(_0x48c403[_0x04c4('0x2b')]!=='VIRTUAL'){var _0xa8fd76={};_0xa8fd76[_0x48c403['name']]={'$like':'%'+_0x515fbe[_0x04c4('0x2d')]['filter']+'%'};return _0xa8fd76;}})});}_0x13d4e2=_[_0x04c4('0x38')]({},_0x13d4e2,_0x515fbe['options']);var _0x4a7b03={'where':_0x13d4e2['where']};return db[_0x04c4('0x29')][_0x04c4('0x1d')](_0x4a7b03)[_0x04c4('0x24')](function(_0x44534c){_0x3b7a7c['count']=_0x44534c;if(_0x515fbe[_0x04c4('0x2d')][_0x04c4('0x39')]){_0x13d4e2[_0x04c4('0x3a')]=[{'all':!![]}];}return db[_0x04c4('0x29')][_0x04c4('0x3b')](_0x13d4e2);})[_0x04c4('0x24')](function(_0x1158e3){_0x3b7a7c[_0x04c4('0x3c')]=_0x1158e3;return _0x3b7a7c;})[_0x04c4('0x24')](respondWithFilteredResult(_0x2883fa,_0x13d4e2))[_0x04c4('0x3d')](handleError(_0x2883fa,null));};exports[_0x04c4('0x3e')]=function(_0x106b27,_0x260dfe){var _0x4b465b={'raw':!![],'where':{'id':_0x106b27['params']['id']}},_0x1d9775={};_0x1d9775[_0x04c4('0x2c')]=_[_0x04c4('0x3f')](db[_0x04c4('0x29')]['rawAttributes']);_0x1d9775[_0x04c4('0x2d')]=_[_0x04c4('0x3f')](_0x106b27[_0x04c4('0x2d')]);_0x1d9775[_0x04c4('0x34')]=_[_0x04c4('0x2e')](_0x1d9775[_0x04c4('0x2c')],_0x1d9775[_0x04c4('0x2d')]);_0x4b465b[_0x04c4('0x2f')]=_[_0x04c4('0x2e')](_0x1d9775[_0x04c4('0x2c')],qs[_0x04c4('0x30')](_0x106b27[_0x04c4('0x2d')]['fields']));_0x4b465b[_0x04c4('0x2f')]=_0x4b465b[_0x04c4('0x2f')][_0x04c4('0x31')]?_0x4b465b[_0x04c4('0x2f')]:_0x1d9775['model'];if(_0x106b27['query']['includeAll']){_0x4b465b[_0x04c4('0x3a')]=[{'all':!![]}];}_0x4b465b=_['merge']({},_0x4b465b,_0x106b27[_0x04c4('0x40')]);return db[_0x04c4('0x29')]['find'](_0x4b465b)[_0x04c4('0x24')](handleEntityNotFound(_0x260dfe,null))[_0x04c4('0x24')](respondWithResult(_0x260dfe,null))['catch'](handleError(_0x260dfe,null));};exports['update']=function(_0x16b782,_0x569267){if(_0x16b782[_0x04c4('0x41')]['id']){delete _0x16b782[_0x04c4('0x41')]['id'];}return db['CmHopperBlack'][_0x04c4('0x42')]({'where':{'id':_0x16b782[_0x04c4('0x43')]['id']}})[_0x04c4('0x24')](handleEntityNotFound(_0x569267,null))[_0x04c4('0x24')](saveUpdates(_0x16b782[_0x04c4('0x41')],null))[_0x04c4('0x24')](respondWithResult(_0x569267,null))[_0x04c4('0x3d')](handleError(_0x569267,null));};exports[_0x04c4('0x44')]=function(_0x2e777e,_0x4f5339){return db[_0x04c4('0x29')]['find']({'where':{'id':_0x2e777e['params']['id']}})['then'](handleEntityNotFound(_0x4f5339,null))[_0x04c4('0x24')](removeEntity(_0x4f5339,null))[_0x04c4('0x3d')](handleError(_0x4f5339,null));};exports[_0x04c4('0x45')]=function(_0x309e0f,_0x1437dc){return db[_0x04c4('0x29')][_0x04c4('0x45')]()[_0x04c4('0x24')](respondWithResult(_0x1437dc,null))[_0x04c4('0x3d')](handleError(_0x1437dc,null));}; \ No newline at end of file +var _0x2e23=['rawAttributes','fieldName','type','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','params','fields','include','find','catch','body','describe','html-pdf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','CmHopperBlack'];(function(_0x3cd822,_0x495929){var _0x2f55d1=function(_0x599b5c){while(--_0x599b5c){_0x3cd822['push'](_0x3cd822['shift']());}};_0x2f55d1(++_0x495929);}(_0x2e23,0xe5));var _0x32e2=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2e23[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x32e2('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x32e2('0x1'));var jsonpatch=require(_0x32e2('0x2'));var rp=require('request-promise');var moment=require(_0x32e2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x32e2('0x4'));var util=require(_0x32e2('0x5'));var path=require(_0x32e2('0x6'));var sox=require('sox');var csv=require(_0x32e2('0x7'));var ejs=require(_0x32e2('0x8'));var fs=require('fs');var _=require(_0x32e2('0x9'));var squel=require(_0x32e2('0xa'));var crypto=require(_0x32e2('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x32e2('0x7'));var querystring=require(_0x32e2('0xc'));var Papa=require(_0x32e2('0xd'));var Redis=require(_0x32e2('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x32e2('0xf'));var as=require(_0x32e2('0x10'));var hardwareService=require(_0x32e2('0x11'));var logger=require(_0x32e2('0x12'))(_0x32e2('0x13'));var utils=require(_0x32e2('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d3e21,_0xf3cbb1){_0xf3cbb1=_0xf3cbb1||0xcc;return function(_0x2e30b8){if(_0x2e30b8){return _0x1d3e21[_0x32e2('0x15')](_0xf3cbb1);}return _0x1d3e21[_0x32e2('0x16')](_0xf3cbb1)[_0x32e2('0x17')]();};}function respondWithResult(_0x1b1335,_0x2b411f){_0x2b411f=_0x2b411f||0xc8;return function(_0x2891d2){if(_0x2891d2){return _0x1b1335[_0x32e2('0x16')](_0x2b411f)['json'](_0x2891d2);}};}function respondWithFilteredResult(_0xda025,_0x1e7b56){return function(_0x5bd8e1){if(_0x5bd8e1){var _0x21fbe3=_0x5bd8e1[_0x32e2('0x18')],_0x1fc369=_0x1e7b56[_0x32e2('0x19')],_0x1171e8=_0x1e7b56[_0x32e2('0x19')]+_0x1e7b56[_0x32e2('0x1a')],_0x4324de;if(_0x1171e8>=_0x21fbe3){_0x1171e8=_0x21fbe3;_0x4324de=0xc8;}else{_0x4324de=0xce;}_0xda025[_0x32e2('0x16')](_0x4324de);return _0xda025[_0x32e2('0x1b')](_0x32e2('0x1c'),_0x1fc369+'-'+_0x1171e8+'/'+_0x21fbe3)['json'](_0x5bd8e1);}return null;};}function patchUpdates(_0x442973){return function(_0x27e622){try{jsonpatch[_0x32e2('0x1d')](_0x27e622,_0x442973,!![]);}catch(_0x5e75c5){return BPromise[_0x32e2('0x1e')](_0x5e75c5);}return _0x27e622['save']();};}function saveUpdates(_0xd53b4a,_0x5d8c14){return function(_0x3ba2f4){if(_0x3ba2f4){return _0x3ba2f4[_0x32e2('0x1f')](_0xd53b4a)[_0x32e2('0x20')](function(_0x3c514b){return _0x3c514b;});}return null;};}function removeEntity(_0x1067bf,_0xd195cc){return function(_0x25b00c){if(_0x25b00c){return _0x25b00c[_0x32e2('0x21')]()[_0x32e2('0x20')](function(){_0x1067bf[_0x32e2('0x16')](0xcc)[_0x32e2('0x17')]();});}};}function handleEntityNotFound(_0x20885b,_0x303439){return function(_0x16ff49){if(!_0x16ff49){_0x20885b[_0x32e2('0x15')](0x194);}return _0x16ff49;};}function handleError(_0x431bfa,_0x4a6d83){_0x4a6d83=_0x4a6d83||0x1f4;return function(_0x3eeb7c){logger['error'](_0x3eeb7c[_0x32e2('0x22')]);if(_0x3eeb7c[_0x32e2('0x23')]){delete _0x3eeb7c['name'];}_0x431bfa['status'](_0x4a6d83)[_0x32e2('0x24')](_0x3eeb7c);};}exports['index']=function(_0x4e9868,_0x27806f){var _0x529b76={},_0x25cf54={},_0x5ca9ef={'count':0x0,'rows':[]};var _0x1a242c=_[_0x32e2('0x25')](db[_0x32e2('0x26')][_0x32e2('0x27')],function(_0x6742ae){return{'name':_0x6742ae[_0x32e2('0x28')],'type':_0x6742ae[_0x32e2('0x29')]['key']};});_0x25cf54[_0x32e2('0x2a')]=_[_0x32e2('0x25')](_0x1a242c,_0x32e2('0x23'));_0x25cf54[_0x32e2('0x2b')]=_[_0x32e2('0x2c')](_0x4e9868[_0x32e2('0x2b')]);_0x25cf54['filters']=_[_0x32e2('0x2d')](_0x25cf54['model'],_0x25cf54[_0x32e2('0x2b')]);_0x529b76[_0x32e2('0x2e')]=_[_0x32e2('0x2d')](_0x25cf54[_0x32e2('0x2a')],qs['fields'](_0x4e9868['query']['fields']));_0x529b76[_0x32e2('0x2e')]=_0x529b76[_0x32e2('0x2e')][_0x32e2('0x2f')]?_0x529b76[_0x32e2('0x2e')]:_0x25cf54[_0x32e2('0x2a')];if(!_0x4e9868[_0x32e2('0x2b')][_0x32e2('0x30')](_0x32e2('0x31'))){_0x529b76[_0x32e2('0x1a')]=qs[_0x32e2('0x1a')](_0x4e9868[_0x32e2('0x2b')][_0x32e2('0x1a')]);_0x529b76[_0x32e2('0x19')]=qs[_0x32e2('0x19')](_0x4e9868['query']['offset']);}_0x529b76[_0x32e2('0x32')]=qs[_0x32e2('0x33')](_0x4e9868[_0x32e2('0x2b')]['sort']);_0x529b76['where']=qs[_0x32e2('0x34')](_['pick'](_0x4e9868[_0x32e2('0x2b')],_0x25cf54[_0x32e2('0x34')]),_0x1a242c);if(_0x4e9868[_0x32e2('0x2b')][_0x32e2('0x35')]){_0x529b76[_0x32e2('0x36')]=_['merge'](_0x529b76[_0x32e2('0x36')],{'$or':_['map'](_0x1a242c,function(_0x3782d2){if(_0x3782d2[_0x32e2('0x29')]!==_0x32e2('0x37')){var _0x1190ab={};_0x1190ab[_0x3782d2[_0x32e2('0x23')]]={'$like':'%'+_0x4e9868[_0x32e2('0x2b')][_0x32e2('0x35')]+'%'};return _0x1190ab;}})});}_0x529b76=_[_0x32e2('0x38')]({},_0x529b76,_0x4e9868[_0x32e2('0x39')]);var _0x11da9c={'where':_0x529b76[_0x32e2('0x36')]};return db[_0x32e2('0x26')]['count'](_0x11da9c)[_0x32e2('0x20')](function(_0x1fc91e){_0x5ca9ef[_0x32e2('0x18')]=_0x1fc91e;if(_0x4e9868[_0x32e2('0x2b')][_0x32e2('0x3a')]){_0x529b76['include']=[{'all':!![]}];}return db[_0x32e2('0x26')][_0x32e2('0x3b')](_0x529b76);})[_0x32e2('0x20')](function(_0xcb3b77){_0x5ca9ef['rows']=_0xcb3b77;return _0x5ca9ef;})[_0x32e2('0x20')](respondWithFilteredResult(_0x27806f,_0x529b76))['catch'](handleError(_0x27806f,null));};exports['show']=function(_0x18186f,_0x39afa1){var _0x4217af={'raw':!![],'where':{'id':_0x18186f[_0x32e2('0x3c')]['id']}},_0x19174f={};_0x19174f[_0x32e2('0x2a')]=_[_0x32e2('0x2c')](db['CmHopperBlack']['rawAttributes']);_0x19174f[_0x32e2('0x2b')]=_[_0x32e2('0x2c')](_0x18186f['query']);_0x19174f[_0x32e2('0x34')]=_[_0x32e2('0x2d')](_0x19174f['model'],_0x19174f[_0x32e2('0x2b')]);_0x4217af['attributes']=_['intersection'](_0x19174f['model'],qs[_0x32e2('0x3d')](_0x18186f[_0x32e2('0x2b')][_0x32e2('0x3d')]));_0x4217af['attributes']=_0x4217af['attributes'][_0x32e2('0x2f')]?_0x4217af[_0x32e2('0x2e')]:_0x19174f[_0x32e2('0x2a')];if(_0x18186f['query']['includeAll']){_0x4217af[_0x32e2('0x3e')]=[{'all':!![]}];}_0x4217af=_[_0x32e2('0x38')]({},_0x4217af,_0x18186f[_0x32e2('0x39')]);return db[_0x32e2('0x26')][_0x32e2('0x3f')](_0x4217af)[_0x32e2('0x20')](handleEntityNotFound(_0x39afa1,null))['then'](respondWithResult(_0x39afa1,null))[_0x32e2('0x40')](handleError(_0x39afa1,null));};exports[_0x32e2('0x1f')]=function(_0x4772d4,_0x4304e6){if(_0x4772d4['body']['id']){delete _0x4772d4['body']['id'];}return db[_0x32e2('0x26')]['find']({'where':{'id':_0x4772d4[_0x32e2('0x3c')]['id']}})[_0x32e2('0x20')](handleEntityNotFound(_0x4304e6,null))[_0x32e2('0x20')](saveUpdates(_0x4772d4[_0x32e2('0x41')],null))['then'](respondWithResult(_0x4304e6,null))[_0x32e2('0x40')](handleError(_0x4304e6,null));};exports[_0x32e2('0x21')]=function(_0x1e888c,_0x3df8b4){return db[_0x32e2('0x26')]['find']({'where':{'id':_0x1e888c[_0x32e2('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3df8b4,null))['then'](removeEntity(_0x3df8b4,null))[_0x32e2('0x40')](handleError(_0x3df8b4,null));};exports['describe']=function(_0x3bfa3f,_0x529ffa){return db[_0x32e2('0x26')][_0x32e2('0x42')]()[_0x32e2('0x20')](respondWithResult(_0x529ffa,null))[_0x32e2('0x40')](handleError(_0x529ffa,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 7464ac6..e788612 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 _0xc2b3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api'];(function(_0x3f779b,_0x184825){var _0x31abde=function(_0x28799a){while(--_0x28799a){_0x3f779b['push'](_0x3f779b['shift']());}};_0x31abde(++_0x184825);}(_0xc2b3,0x191));var _0x3c2b=function(_0x302ef0,_0x558788){_0x302ef0=_0x302ef0-0x0;var _0x1db0a0=_0xc2b3[_0x302ef0];return _0x1db0a0;};'use strict';var _=require(_0x3c2b('0x0'));var util=require(_0x3c2b('0x1'));var logger=require(_0x3c2b('0x2'))(_0x3c2b('0x3'));var moment=require(_0x3c2b('0x4'));var BPromise=require(_0x3c2b('0x5'));var rp=require(_0x3c2b('0x6'));var fs=require('fs');var path=require(_0x3c2b('0x7'));var rimraf=require(_0x3c2b('0x8'));var config=require(_0x3c2b('0x9'));var attributes=require(_0x3c2b('0xa'));module[_0x3c2b('0xb')]=function(_0x352ba1,_0x4fcc8a){return _0x352ba1[_0x3c2b('0xc')](_0x3c2b('0xd'),attributes,{'tableName':_0x3c2b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35da=['path','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x48301c,_0x127f0b){var _0x3a34e1=function(_0x43f397){while(--_0x43f397){_0x48301c['push'](_0x48301c['shift']());}};_0x3a34e1(++_0x127f0b);}(_0x35da,0x102));var _0xa35d=function(_0x2082af,_0xb25312){_0x2082af=_0x2082af-0x0;var _0x1d82b6=_0x35da[_0x2082af];return _0x1d82b6;};'use strict';var _=require(_0xa35d('0x0'));var util=require(_0xa35d('0x1'));var logger=require(_0xa35d('0x2'))(_0xa35d('0x3'));var moment=require('moment');var BPromise=require(_0xa35d('0x4'));var rp=require(_0xa35d('0x5'));var fs=require('fs');var path=require(_0xa35d('0x6'));var rimraf=require(_0xa35d('0x7'));var config=require(_0xa35d('0x8'));var attributes=require(_0xa35d('0x9'));module['exports']=function(_0x39c425,_0x1a87b0){return _0x39c425[_0xa35d('0xa')](_0xa35d('0xb'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index e883e38..2711a45 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 _0x8721=['model','UpdateCmHopperBlack','CmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','util','moment','ioredis','rpc','../../config/environment','jayson/promise','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetCmHopperBlack','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x1e84a7,_0x2dd151){var _0x10e96c=function(_0x36f816){while(--_0x36f816){_0x1e84a7['push'](_0x1e84a7['shift']());}};_0x10e96c(++_0x2dd151);}(_0x8721,0xd9));var _0x1872=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8721[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x1872('0x0'));var util=require(_0x1872('0x1'));var moment=require(_0x1872('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1872('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1872('0x4'));var config=require(_0x1872('0x5'));var jayson=require(_0x1872('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2dc064,_0x3b80c8,_0x4230d7){return new BPromise(function(_0x4d019e,_0x2aaad6){return client[_0x1872('0x7')](_0x2dc064,_0x4230d7)[_0x1872('0x8')](function(_0x2c2b48){logger[_0x1872('0x9')](_0x1872('0xa'),_0x3b80c8,_0x1872('0xb'));logger[_0x1872('0xc')](_0x1872('0xd'),_0x3b80c8,_0x1872('0xb'),JSON[_0x1872('0xe')](_0x2c2b48));if(_0x2c2b48['error']){if(_0x2c2b48[_0x1872('0xf')][_0x1872('0x10')]===0x1f4){logger[_0x1872('0xf')](_0x1872('0xa'),_0x3b80c8,_0x2c2b48['error'][_0x1872('0x11')]);return _0x2aaad6(_0x2c2b48[_0x1872('0xf')][_0x1872('0x11')]);}logger[_0x1872('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x3b80c8,_0x2c2b48['error'][_0x1872('0x11')]);return _0x4d019e(_0x2c2b48[_0x1872('0xf')][_0x1872('0x11')]);}else{logger[_0x1872('0x9')](_0x1872('0xa'),_0x3b80c8,_0x1872('0xb'));_0x4d019e(_0x2c2b48['result']['message']);}})[_0x1872('0x12')](function(_0x3299df){logger[_0x1872('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x3b80c8,_0x3299df);_0x2aaad6(_0x3299df);});});}exports[_0x1872('0x13')]=function(_0x487791){var _0x444306=this;return new Promise(function(_0x34899d,_0x32147c){return db['CmHopperBlack'][_0x1872('0x14')]({'raw':_0x487791['options']?_0x487791[_0x1872('0x15')][_0x1872('0x16')]===undefined?!![]:![]:!![],'where':_0x487791[_0x1872('0x15')]?_0x487791[_0x1872('0x15')][_0x1872('0x17')]||null:null,'attributes':_0x487791['options']?_0x487791[_0x1872('0x15')][_0x1872('0x18')]||null:null,'limit':_0x487791[_0x1872('0x15')]?_0x487791[_0x1872('0x15')][_0x1872('0x19')]||null:null,'include':_0x487791[_0x1872('0x15')]?_0x487791[_0x1872('0x15')][_0x1872('0x1a')]?_[_0x1872('0x1b')](_0x487791['options']['include'],function(_0x5f29f5){return{'model':db[_0x5f29f5[_0x1872('0x1c')]],'as':_0x5f29f5['as'],'attributes':_0x5f29f5[_0x1872('0x18')],'include':_0x5f29f5[_0x1872('0x1a')]?_[_0x1872('0x1b')](_0x5f29f5['include'],function(_0x323592){return{'model':db[_0x323592[_0x1872('0x1c')]],'as':_0x323592['as'],'attributes':_0x323592[_0x1872('0x18')],'include':_0x323592['include']?_[_0x1872('0x1b')](_0x323592['include'],function(_0x43e178){return{'model':db[_0x43e178[_0x1872('0x1c')]],'as':_0x43e178['as'],'attributes':_0x43e178[_0x1872('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x430b95){logger[_0x1872('0x9')]('GetCmHopperBlack',_0x487791);logger['debug'](_0x1872('0x13'),_0x487791,JSON['stringify'](_0x430b95));_0x34899d(_0x430b95);})['catch'](function(_0x333961){logger['error'](_0x1872('0x13'),_0x333961[_0x1872('0x11')],_0x487791);_0x32147c(_0x444306['error'](0x1f4,_0x333961[_0x1872('0x11')]));});});};exports[_0x1872('0x1d')]=function(_0x30ad4f){var _0x558234=this;return new Promise(function(_0x221ac8,_0x903d29){return db[_0x1872('0x1e')][_0x1872('0x1f')](_0x30ad4f[_0x1872('0x20')],{'raw':_0x30ad4f['options']?_0x30ad4f[_0x1872('0x15')][_0x1872('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30ad4f[_0x1872('0x15')]?_0x30ad4f[_0x1872('0x15')][_0x1872('0x17')]||null:null,'attributes':_0x30ad4f[_0x1872('0x15')]?_0x30ad4f['options'][_0x1872('0x18')]||null:null,'limit':_0x30ad4f[_0x1872('0x15')]?_0x30ad4f[_0x1872('0x15')][_0x1872('0x19')]||null:null})[_0x1872('0x8')](function(_0x333f8c){logger[_0x1872('0x9')](_0x1872('0x1d'),_0x30ad4f);logger['debug']('UpdateCmHopperBlack',_0x30ad4f,JSON[_0x1872('0xe')](_0x333f8c));_0x221ac8(_0x333f8c);})[_0x1872('0x12')](function(_0xdd3b4a){logger[_0x1872('0xf')](_0x1872('0x1d'),_0xdd3b4a[_0x1872('0x11')],_0x30ad4f);_0x903d29(_0x558234['error'](0x1f4,_0xdd3b4a[_0x1872('0x11')]));});});};exports[_0x1872('0x21')]=function(_0x55093a){var _0x497a4d=this;return new Promise(function(_0x5f5c60,_0x3bcd0b){return db[_0x1872('0x1e')][_0x1872('0x22')]({'where':_0x55093a['options']?_0x55093a[_0x1872('0x15')][_0x1872('0x17')]||null:null})[_0x1872('0x8')](function(_0xde9918){logger[_0x1872('0x9')](_0x1872('0x21'),_0x55093a);logger['debug'](_0x1872('0x21'),_0x55093a,JSON[_0x1872('0xe')](_0xde9918));_0x5f5c60(_0xde9918);})[_0x1872('0x12')](function(_0x3bd1da){logger[_0x1872('0xf')](_0x1872('0x21'),_0x3bd1da[_0x1872('0x11')],_0x55093a);_0x3bcd0b(_0x497a4d[_0x1872('0xf')](0x1f4,_0x3bd1da['message']));});});}; \ No newline at end of file +var _0x45aa=['CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','attributes','limit','map','include','model','UpdateCmHopperBlack','update','body','where','DestroyCmHopperBlack','destroy','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info'];(function(_0x534262,_0x19b290){var _0x5f337d=function(_0xcc67f2){while(--_0xcc67f2){_0x534262['push'](_0x534262['shift']());}};_0x5f337d(++_0x19b290);}(_0x45aa,0x142));var _0xa45a=function(_0x6969fd,_0x452037){_0x6969fd=_0x6969fd-0x0;var _0x1965f6=_0x45aa[_0x6969fd];return _0x1965f6;};'use strict';var _=require(_0xa45a('0x0'));var util=require(_0xa45a('0x1'));var moment=require(_0xa45a('0x2'));var BPromise=require('bluebird');var rs=require(_0xa45a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa45a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa45a('0x5'));var config=require(_0xa45a('0x6'));var jayson=require(_0xa45a('0x7'));var client=jayson[_0xa45a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4315ad,_0x253f3e,_0x510a6d){return new BPromise(function(_0x5af86e,_0x1bebb5){return client['request'](_0x4315ad,_0x510a6d)[_0xa45a('0x9')](function(_0x7cb38d){logger[_0xa45a('0xa')](_0xa45a('0xb'),_0x253f3e,'request\x20sent');logger[_0xa45a('0xc')](_0xa45a('0xd'),_0x253f3e,_0xa45a('0xe'),JSON[_0xa45a('0xf')](_0x7cb38d));if(_0x7cb38d[_0xa45a('0x10')]){if(_0x7cb38d['error'][_0xa45a('0x11')]===0x1f4){logger[_0xa45a('0x10')](_0xa45a('0xb'),_0x253f3e,_0x7cb38d['error']['message']);return _0x1bebb5(_0x7cb38d[_0xa45a('0x10')][_0xa45a('0x12')]);}logger[_0xa45a('0x10')](_0xa45a('0xb'),_0x253f3e,_0x7cb38d['error'][_0xa45a('0x12')]);return _0x5af86e(_0x7cb38d[_0xa45a('0x10')][_0xa45a('0x12')]);}else{logger[_0xa45a('0xa')](_0xa45a('0xb'),_0x253f3e,_0xa45a('0xe'));_0x5af86e(_0x7cb38d[_0xa45a('0x13')][_0xa45a('0x12')]);}})[_0xa45a('0x14')](function(_0x4f4f4d){logger[_0xa45a('0x10')](_0xa45a('0xb'),_0x253f3e,_0x4f4f4d);_0x1bebb5(_0x4f4f4d);});});}exports[_0xa45a('0x15')]=function(_0x338ef1){var _0x555b0c=this;return new Promise(function(_0x1ba19f,_0x3ab462){return db[_0xa45a('0x16')][_0xa45a('0x17')]({'raw':_0x338ef1[_0xa45a('0x18')]?_0x338ef1[_0xa45a('0x18')][_0xa45a('0x19')]===undefined?!![]:![]:!![],'where':_0x338ef1[_0xa45a('0x18')]?_0x338ef1[_0xa45a('0x18')]['where']||null:null,'attributes':_0x338ef1[_0xa45a('0x18')]?_0x338ef1[_0xa45a('0x18')][_0xa45a('0x1a')]||null:null,'limit':_0x338ef1[_0xa45a('0x18')]?_0x338ef1[_0xa45a('0x18')][_0xa45a('0x1b')]||null:null,'include':_0x338ef1['options']?_0x338ef1[_0xa45a('0x18')]['include']?_[_0xa45a('0x1c')](_0x338ef1['options'][_0xa45a('0x1d')],function(_0x4e47e4){return{'model':db[_0x4e47e4[_0xa45a('0x1e')]],'as':_0x4e47e4['as'],'attributes':_0x4e47e4['attributes'],'include':_0x4e47e4[_0xa45a('0x1d')]?_[_0xa45a('0x1c')](_0x4e47e4[_0xa45a('0x1d')],function(_0x3bc0d5){return{'model':db[_0x3bc0d5[_0xa45a('0x1e')]],'as':_0x3bc0d5['as'],'attributes':_0x3bc0d5['attributes'],'include':_0x3bc0d5[_0xa45a('0x1d')]?_['map'](_0x3bc0d5[_0xa45a('0x1d')],function(_0x12ea92){return{'model':db[_0x12ea92[_0xa45a('0x1e')]],'as':_0x12ea92['as'],'attributes':_0x12ea92['attributes']};}):[]};}):[]};}):[]:[]})[_0xa45a('0x9')](function(_0x3a4975){logger['info'](_0xa45a('0x15'),_0x338ef1);logger[_0xa45a('0xc')](_0xa45a('0x15'),_0x338ef1,JSON[_0xa45a('0xf')](_0x3a4975));_0x1ba19f(_0x3a4975);})[_0xa45a('0x14')](function(_0x17a70c){logger[_0xa45a('0x10')](_0xa45a('0x15'),_0x17a70c[_0xa45a('0x12')],_0x338ef1);_0x3ab462(_0x555b0c[_0xa45a('0x10')](0x1f4,_0x17a70c[_0xa45a('0x12')]));});});};exports[_0xa45a('0x1f')]=function(_0x45061b){var _0x5f17ff=this;return new Promise(function(_0x4ad045,_0x18b42d){return db[_0xa45a('0x16')][_0xa45a('0x20')](_0x45061b[_0xa45a('0x21')],{'raw':_0x45061b[_0xa45a('0x18')]?_0x45061b[_0xa45a('0x18')][_0xa45a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45061b[_0xa45a('0x18')]?_0x45061b[_0xa45a('0x18')][_0xa45a('0x22')]||null:null,'attributes':_0x45061b[_0xa45a('0x18')]?_0x45061b['options']['attributes']||null:null,'limit':_0x45061b[_0xa45a('0x18')]?_0x45061b[_0xa45a('0x18')]['limit']||null:null})['then'](function(_0x2c6375){logger[_0xa45a('0xa')](_0xa45a('0x1f'),_0x45061b);logger['debug']('UpdateCmHopperBlack',_0x45061b,JSON[_0xa45a('0xf')](_0x2c6375));_0x4ad045(_0x2c6375);})[_0xa45a('0x14')](function(_0x24f080){logger[_0xa45a('0x10')]('UpdateCmHopperBlack',_0x24f080[_0xa45a('0x12')],_0x45061b);_0x18b42d(_0x5f17ff['error'](0x1f4,_0x24f080[_0xa45a('0x12')]));});});};exports[_0xa45a('0x23')]=function(_0xd5c08e){var _0x3fa924=this;return new Promise(function(_0x4ebd11,_0x43aeab){return db[_0xa45a('0x16')][_0xa45a('0x24')]({'where':_0xd5c08e[_0xa45a('0x18')]?_0xd5c08e['options'][_0xa45a('0x22')]||null:null})[_0xa45a('0x9')](function(_0x22fa85){logger[_0xa45a('0xa')]('DestroyCmHopperBlack',_0xd5c08e);logger[_0xa45a('0xc')](_0xa45a('0x23'),_0xd5c08e,JSON[_0xa45a('0xf')](_0x22fa85));_0x4ebd11(_0x22fa85);})[_0xa45a('0x14')](function(_0x43b00f){logger['error']('DestroyCmHopperBlack',_0x43b00f['message'],_0xd5c08e);_0x43aeab(_0x3fa924['error'](0x1f4,_0x43b00f[_0xa45a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 95b1f71..75e6621 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 _0x4bc3=['get','isAuthenticated','index','/describe','/:id','show','put','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller'];(function(_0x3d73ba,_0x356e23){var _0x47e406=function(_0x90df31){while(--_0x90df31){_0x3d73ba['push'](_0x3d73ba['shift']());}};_0x47e406(++_0x356e23);}(_0x4bc3,0x16e));var _0x34bc=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x4bc3[_0x32f7d7];return _0x133d09;};'use strict';var multer=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var path=require('path');var timeout=require(_0x34bc('0x2'));var express=require(_0x34bc('0x3'));var router=express['Router']();var auth=require(_0x34bc('0x4'));var interaction=require(_0x34bc('0x5'));var config=require(_0x34bc('0x6'));var controller=require(_0x34bc('0x7'));router[_0x34bc('0x8')]('/',auth[_0x34bc('0x9')](),controller[_0x34bc('0xa')]);router['get'](_0x34bc('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x34bc('0x8')](_0x34bc('0xc'),auth[_0x34bc('0x9')](),controller[_0x34bc('0xd')]);router[_0x34bc('0xe')](_0x34bc('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x34bc('0xf')](_0x34bc('0xc'),auth[_0x34bc('0x9')](),controller['destroy']);module[_0x34bc('0x10')]=router; \ No newline at end of file +var _0xac9d=['../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0xac9d,0x14d));var _0xdac9=function(_0x514299,_0x44a553){_0x514299=_0x514299-0x0;var _0x453188=_0xac9d[_0x514299];return _0x453188;};'use strict';var multer=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var path=require(_0xdac9('0x2'));var timeout=require(_0xdac9('0x3'));var express=require(_0xdac9('0x4'));var router=express[_0xdac9('0x5')]();var auth=require(_0xdac9('0x6'));var interaction=require(_0xdac9('0x7'));var config=require('../../config/environment');var controller=require(_0xdac9('0x8'));router['get']('/',auth[_0xdac9('0x9')](),controller[_0xdac9('0xa')]);router[_0xdac9('0xb')](_0xdac9('0xc'),auth[_0xdac9('0x9')](),controller[_0xdac9('0xd')]);router['get'](_0xdac9('0xe'),auth['isAuthenticated'](),controller[_0xdac9('0xf')]);router[_0xdac9('0x10')](_0xdac9('0xe'),auth[_0xdac9('0x9')](),controller[_0xdac9('0x11')]);router[_0xdac9('0x12')](_0xdac9('0xe'),auth[_0xdac9('0x9')](),controller[_0xdac9('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index fadba1a..ac0d166 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 _0x954d=['STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','INTEGER'];(function(_0x4801c8,_0x470ce5){var _0x353fc7=function(_0x2d53b3){while(--_0x2d53b3){_0x4801c8['push'](_0x4801c8['shift']());}};_0x353fc7(++_0x470ce5);}(_0x954d,0x196));var _0xd954=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x954d[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'state':{'type':Sequelize[_0xd954('0x0')](0x2)},'statedesc':{'type':Sequelize[_0xd954('0x1')]},'scheduledat':{'type':Sequelize[_0xd954('0x2')]},'countbusyretry':{'type':Sequelize[_0xd954('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd954('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd954('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd954('0x1')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd954('0x1')]},'starttime':{'type':Sequelize[_0xd954('0x2')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xd954('0x2')]},'droptime':{'type':Sequelize[_0xd954('0x2')]},'endtime':{'type':Sequelize[_0xd954('0x2')]},'ringtime':{'type':Sequelize[_0xd954('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd954('0x0')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd954('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd954('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xd954('0x1')]},'campaigntype':{'type':Sequelize[_0xd954('0x1')]},'membername':{'type':Sequelize[_0xd954('0x1')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd954('0x1')]},'dispositionat':{'type':Sequelize[_0xd954('0x2')],'set':function(_0x11ff2e){var _0x1ded7b=this[_0xd954('0x3')](_0xd954('0x4'));if(_0x1ded7b&&_0x11ff2e){this[_0xd954('0x5')](_0xd954('0x6'),moment(_0x11ff2e)[_0xd954('0x7')](moment(_0x1ded7b),_0xd954('0x8')));}return this['setDataValue'](_0xd954('0x9'),_0x11ff2e);}},'amd':{'type':Sequelize[_0xd954('0xa')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xd954('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xd954('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xd954('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd954('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xd954('0x1')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd954('0x2')]},'recallme':{'type':Sequelize[_0xd954('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xd954('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd954('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd954('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd954('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd954('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xad9b=['endtime','setDataValue','followuptime','seconds','dispositionat','BOOLEAN','sequelize','exports','INTEGER','STRING','DATE','getDataValue'];(function(_0x5089fb,_0x3796d7){var _0x4f480e=function(_0xbc2692){while(--_0xbc2692){_0x5089fb['push'](_0x5089fb['shift']());}};_0x4f480e(++_0x3796d7);}(_0xad9b,0x10e));var _0xbad9=function(_0x6211d0,_0x159eaa){_0x6211d0=_0x6211d0-0x0;var _0x217ada=_0xad9b[_0x6211d0];return _0x217ada;};'use strict';var Sequelize=require(_0xbad9('0x0'));var moment=require('moment');module[_0xbad9('0x1')]={'state':{'type':Sequelize[_0xbad9('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xbad9('0x3')]},'scheduledat':{'type':Sequelize[_0xbad9('0x4')]},'countbusyretry':{'type':Sequelize[_0xbad9('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbad9('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbad9('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xbad9('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xbad9('0x4')]},'responsetime':{'type':Sequelize[_0xbad9('0x4')]},'answertime':{'type':Sequelize[_0xbad9('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xbad9('0x4')]},'ringtime':{'type':Sequelize[_0xbad9('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xbad9('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbad9('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbad9('0x3')]},'campaign':{'type':Sequelize[_0xbad9('0x3')]},'campaigntype':{'type':Sequelize[_0xbad9('0x3')]},'membername':{'type':Sequelize[_0xbad9('0x3')]},'reason':{'type':Sequelize[_0xbad9('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xbad9('0x3')]},'thirdDisposition':{'type':Sequelize[_0xbad9('0x3')]},'dispositionat':{'type':Sequelize[_0xbad9('0x4')],'set':function(_0x25cfb5){var _0x2bb7d4=this[_0xbad9('0x5')](_0xbad9('0x6'));if(_0x2bb7d4&&_0x25cfb5){this[_0xbad9('0x7')](_0xbad9('0x8'),moment(_0x25cfb5)['diff'](moment(_0x2bb7d4),_0xbad9('0x9')));}return this[_0xbad9('0x7')](_0xbad9('0xa'),_0x25cfb5);}},'amd':{'type':Sequelize[_0xbad9('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xbad9('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xbad9('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xbad9('0x4')]},'callback':{'type':Sequelize[_0xbad9('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbad9('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbad9('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xbad9('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xbad9('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xbad9('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbad9('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbad9('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbad9('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbad9('0x2')],'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 74bc07c..b2abdb1 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 _0xa8a8=['status','json','count','offset','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','CmHopperFinal','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','type','filter','includeAll','include','rows','catch','show','rawAttributes','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','params','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','state\x20=\x204','checkContactHopper','CmHopper','findOne','CampaignId','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x508ab2,_0x437475){var _0x147b98=function(_0xf57444){while(--_0xf57444){_0x508ab2['push'](_0x508ab2['shift']());}};_0x147b98(++_0x437475);}(_0xa8a8,0xec));var _0x8a8a=function(_0xb3bbb9,_0x3f47a6){_0xb3bbb9=_0xb3bbb9-0x0;var _0x4e89bd=_0xa8a8[_0xb3bbb9];return _0x4e89bd;};'use strict';var pdf=require(_0x8a8a('0x0'));var emlformat=require(_0x8a8a('0x1'));var rimraf=require(_0x8a8a('0x2'));var zipdir=require(_0x8a8a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a8a('0x4'));var moment=require(_0x8a8a('0x5'));var BPromise=require(_0x8a8a('0x6'));var Mustache=require(_0x8a8a('0x7'));var util=require(_0x8a8a('0x8'));var path=require(_0x8a8a('0x9'));var sox=require(_0x8a8a('0xa'));var csv=require(_0x8a8a('0xb'));var ejs=require(_0x8a8a('0xc'));var fs=require('fs');var _=require(_0x8a8a('0xd'));var squel=require(_0x8a8a('0xe'));var crypto=require(_0x8a8a('0xf'));var jsforce=require(_0x8a8a('0x10'));var deskjs=require(_0x8a8a('0x11'));var toCsv=require(_0x8a8a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8a8a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8a8a('0x13'));var as=require(_0x8a8a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a8a('0x15'))(_0x8a8a('0x16'));var utils=require(_0x8a8a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8a8a('0x18'));var db=require(_0x8a8a('0x19'))['db'];function respondWithStatusCode(_0x330796,_0x234481){_0x234481=_0x234481||0xcc;return function(_0x4a1b91){if(_0x4a1b91){return _0x330796[_0x8a8a('0x1a')](_0x234481);}return _0x330796['status'](_0x234481)[_0x8a8a('0x1b')]();};}function respondWithResult(_0xb2a3bc,_0x787eec){_0x787eec=_0x787eec||0xc8;return function(_0x2f6e33){if(_0x2f6e33){return _0xb2a3bc[_0x8a8a('0x1c')](_0x787eec)[_0x8a8a('0x1d')](_0x2f6e33);}};}function respondWithFilteredResult(_0x16d38d,_0x51ce75){return function(_0x1ed3be){if(_0x1ed3be){var _0x568b83=_0x1ed3be[_0x8a8a('0x1e')],_0x1f36b6=_0x51ce75[_0x8a8a('0x1f')],_0x3046ae=_0x51ce75['offset']+_0x51ce75[_0x8a8a('0x20')],_0x46a4f4;if(_0x3046ae>=_0x568b83){_0x3046ae=_0x568b83;_0x46a4f4=0xc8;}else{_0x46a4f4=0xce;}_0x16d38d[_0x8a8a('0x1c')](_0x46a4f4);return _0x16d38d[_0x8a8a('0x21')](_0x8a8a('0x22'),_0x1f36b6+'-'+_0x3046ae+'/'+_0x568b83)[_0x8a8a('0x1d')](_0x1ed3be);}return null;};}function patchUpdates(_0x22e611){return function(_0x4d7a45){try{jsonpatch['apply'](_0x4d7a45,_0x22e611,!![]);}catch(_0x5181b2){return BPromise['reject'](_0x5181b2);}return _0x4d7a45['save']();};}function saveUpdates(_0x3a9b2f,_0x45095b){return function(_0xe0f449){if(_0xe0f449){return _0xe0f449[_0x8a8a('0x23')](_0x3a9b2f)[_0x8a8a('0x24')](function(_0x2f6af2){return _0x2f6af2;});}return null;};}function removeEntity(_0x242bac,_0xe0321c){return function(_0x25d5d4){if(_0x25d5d4){return _0x25d5d4[_0x8a8a('0x25')]()[_0x8a8a('0x24')](function(){_0x242bac[_0x8a8a('0x1c')](0xcc)[_0x8a8a('0x1b')]();});}};}function handleEntityNotFound(_0x625c1b,_0x442c00){return function(_0x545a38){if(!_0x545a38){_0x625c1b[_0x8a8a('0x1a')](0x194);}return _0x545a38;};}function handleError(_0x16c55b,_0x268b2f){_0x268b2f=_0x268b2f||0x1f4;return function(_0x7662e){logger[_0x8a8a('0x26')](_0x7662e[_0x8a8a('0x27')]);if(_0x7662e[_0x8a8a('0x28')]){delete _0x7662e['name'];}_0x16c55b[_0x8a8a('0x1c')](_0x268b2f)[_0x8a8a('0x29')](_0x7662e);};}exports[_0x8a8a('0x2a')]=function(_0x54ff7e,_0x58f42b){var _0x2dafcd={},_0x129d11={},_0x5c70bd={'count':0x0,'rows':[]};var _0x4d8760=_['map'](db[_0x8a8a('0x2b')]['rawAttributes'],function(_0x10b916){return{'name':_0x10b916[_0x8a8a('0x2c')],'type':_0x10b916['type'][_0x8a8a('0x2d')]};});_0x129d11[_0x8a8a('0x2e')]=_[_0x8a8a('0x2f')](_0x4d8760,_0x8a8a('0x28'));_0x129d11[_0x8a8a('0x30')]=_[_0x8a8a('0x31')](_0x54ff7e[_0x8a8a('0x30')]);_0x129d11[_0x8a8a('0x32')]=_['intersection'](_0x129d11['model'],_0x129d11['query']);_0x2dafcd[_0x8a8a('0x33')]=_[_0x8a8a('0x34')](_0x129d11['model'],qs[_0x8a8a('0x35')](_0x54ff7e[_0x8a8a('0x30')]['fields']));_0x2dafcd[_0x8a8a('0x33')]=_0x2dafcd[_0x8a8a('0x33')][_0x8a8a('0x36')]?_0x2dafcd['attributes']:_0x129d11['model'];if(!_0x54ff7e[_0x8a8a('0x30')]['hasOwnProperty'](_0x8a8a('0x37'))){_0x2dafcd[_0x8a8a('0x20')]=qs[_0x8a8a('0x20')](_0x54ff7e[_0x8a8a('0x30')][_0x8a8a('0x20')]);_0x2dafcd[_0x8a8a('0x1f')]=qs[_0x8a8a('0x1f')](_0x54ff7e[_0x8a8a('0x30')][_0x8a8a('0x1f')]);}_0x2dafcd[_0x8a8a('0x38')]=qs[_0x8a8a('0x39')](_0x54ff7e[_0x8a8a('0x30')][_0x8a8a('0x39')]);_0x2dafcd[_0x8a8a('0x3a')]=qs[_0x8a8a('0x32')](_[_0x8a8a('0x3b')](_0x54ff7e[_0x8a8a('0x30')],_0x129d11[_0x8a8a('0x32')]),_0x4d8760);if(_0x54ff7e['query']['filter']){_0x2dafcd['where']=_[_0x8a8a('0x3c')](_0x2dafcd[_0x8a8a('0x3a')],{'$or':_[_0x8a8a('0x2f')](_0x4d8760,function(_0x117a5c){if(_0x117a5c[_0x8a8a('0x3d')]!=='VIRTUAL'){var _0x4ee92e={};_0x4ee92e[_0x117a5c[_0x8a8a('0x28')]]={'$like':'%'+_0x54ff7e['query'][_0x8a8a('0x3e')]+'%'};return _0x4ee92e;}})});}_0x2dafcd=_['merge']({},_0x2dafcd,_0x54ff7e['options']);var _0x1b33eb={'where':_0x2dafcd[_0x8a8a('0x3a')]};return db[_0x8a8a('0x2b')][_0x8a8a('0x1e')](_0x1b33eb)[_0x8a8a('0x24')](function(_0x3a0e91){_0x5c70bd[_0x8a8a('0x1e')]=_0x3a0e91;if(_0x54ff7e['query'][_0x8a8a('0x3f')]){_0x2dafcd[_0x8a8a('0x40')]=[{'all':!![]}];}return db[_0x8a8a('0x2b')]['findAll'](_0x2dafcd);})[_0x8a8a('0x24')](function(_0x323f89){_0x5c70bd[_0x8a8a('0x41')]=_0x323f89;return _0x5c70bd;})['then'](respondWithFilteredResult(_0x58f42b,_0x2dafcd))[_0x8a8a('0x42')](handleError(_0x58f42b,null));};exports[_0x8a8a('0x43')]=function(_0x14c138,_0x19fd7a){var _0x1a29f9={'raw':!![],'where':{'id':_0x14c138['params']['id']}},_0x3e5b15={};_0x3e5b15['model']=_[_0x8a8a('0x31')](db['CmHopperFinal'][_0x8a8a('0x44')]);_0x3e5b15[_0x8a8a('0x30')]=_['keys'](_0x14c138['query']);_0x3e5b15[_0x8a8a('0x32')]=_[_0x8a8a('0x34')](_0x3e5b15[_0x8a8a('0x2e')],_0x3e5b15[_0x8a8a('0x30')]);_0x1a29f9['attributes']=_[_0x8a8a('0x34')](_0x3e5b15['model'],qs[_0x8a8a('0x35')](_0x14c138[_0x8a8a('0x30')]['fields']));_0x1a29f9[_0x8a8a('0x33')]=_0x1a29f9[_0x8a8a('0x33')][_0x8a8a('0x36')]?_0x1a29f9['attributes']:_0x3e5b15[_0x8a8a('0x2e')];if(_0x14c138[_0x8a8a('0x30')][_0x8a8a('0x3f')]){_0x1a29f9['include']=[{'all':!![]}];}_0x1a29f9=_['merge']({},_0x1a29f9,_0x14c138[_0x8a8a('0x45')]);return db[_0x8a8a('0x2b')][_0x8a8a('0x46')](_0x1a29f9)['then'](handleEntityNotFound(_0x19fd7a,null))[_0x8a8a('0x24')](respondWithResult(_0x19fd7a,null))[_0x8a8a('0x42')](handleError(_0x19fd7a,null));};exports[_0x8a8a('0x47')]=function(_0xcf230e,_0x2d4c11){return db[_0x8a8a('0x2b')][_0x8a8a('0x47')]()[_0x8a8a('0x24')](respondWithResult(_0x2d4c11,null))[_0x8a8a('0x42')](handleError(_0x2d4c11,null));};exports[_0x8a8a('0x23')]=function(_0x150b42,_0x53dd4b){if(_0x150b42[_0x8a8a('0x48')][_0x8a8a('0x49')]){delete _0x150b42[_0x8a8a('0x48')][_0x8a8a('0x49')];}return db[_0x8a8a('0x2b')][_0x8a8a('0x46')]({'where':{'uniqueid':_0x150b42['params']['id']}})[_0x8a8a('0x24')](handleEntityNotFound(_0x53dd4b,null))[_0x8a8a('0x24')](saveUpdates(_0x150b42[_0x8a8a('0x48')],null))[_0x8a8a('0x24')](respondWithResult(_0x53dd4b,null))['catch'](handleError(_0x53dd4b,null));};exports[_0x8a8a('0x4a')]=function(_0x3333ff,_0x44e00c,_0x5220c0){return db['CmHopperFinal'][_0x8a8a('0x4b')]({'raw':![],'where':{'VoiceQueueId':_0x3333ff[_0x8a8a('0x4c')]['id']},'attributes':[[db[_0x8a8a('0x4d')]['fn'](_0x8a8a('0x4e'),db[_0x8a8a('0x4d')]['fn']('IF',db[_0x8a8a('0x4d')][_0x8a8a('0x4f')](_0x8a8a('0x50')))),_0x8a8a('0x51')],[db['sequelize']['fn']('COUNT',db[_0x8a8a('0x4d')]['fn']('IF',db[_0x8a8a('0x4d')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x8a8a('0x52')],[db['sequelize']['fn'](_0x8a8a('0x4e'),db['sequelize']['fn']('IF',db[_0x8a8a('0x4d')][_0x8a8a('0x4f')](_0x8a8a('0x53')))),_0x8a8a('0x54')],[db[_0x8a8a('0x4d')]['fn'](_0x8a8a('0x4e'),db[_0x8a8a('0x4d')]['fn']('IF',db[_0x8a8a('0x4d')][_0x8a8a('0x4f')](_0x8a8a('0x55')))),'congestionContacts'],[db[_0x8a8a('0x4d')]['fn'](_0x8a8a('0x4e'),db[_0x8a8a('0x4d')]['fn']('IF',db[_0x8a8a('0x4d')][_0x8a8a('0x4f')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x8a8a('0x56')],[db[_0x8a8a('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8a8a('0x4d')][_0x8a8a('0x4f')](_0x8a8a('0x57')))),_0x8a8a('0x58')],[db[_0x8a8a('0x4d')]['fn'](_0x8a8a('0x4e'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x8a8a('0x59')))),'reCallContacts'],[db[_0x8a8a('0x4d')]['fn'](_0x8a8a('0x4e'),db['sequelize']['fn']('IF',db[_0x8a8a('0x4d')][_0x8a8a('0x4f')](_0x8a8a('0x5a')))),_0x8a8a('0x5b')]]})['then'](handleEntityNotFound(_0x44e00c,null))[_0x8a8a('0x24')](respondWithResult(_0x44e00c,null))['catch'](handleError(_0x44e00c,null));};exports[_0x8a8a('0x5c')]=function(_0x829117,_0x57a8b2,_0x254e4c){return db[_0x8a8a('0x2b')][_0x8a8a('0x4b')]({'raw':![],'where':{'CampaignId':_0x829117[_0x8a8a('0x4c')]['id']},'attributes':[[db['sequelize']['fn'](_0x8a8a('0x4e'),db[_0x8a8a('0x4d')]['fn']('IF',db[_0x8a8a('0x4d')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x8a8a('0x51')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8a8a('0x4d')][_0x8a8a('0x4f')]('`state`\x20=\x203,\x201,\x20null'))),_0x8a8a('0x52')],[db['sequelize']['fn']('COUNT',db[_0x8a8a('0x4d')]['fn']('IF',db[_0x8a8a('0x4d')]['literal'](_0x8a8a('0x53')))),_0x8a8a('0x54')],[db[_0x8a8a('0x4d')]['fn'](_0x8a8a('0x4e'),db[_0x8a8a('0x4d')]['fn']('IF',db[_0x8a8a('0x4d')]['literal'](_0x8a8a('0x55')))),_0x8a8a('0x5d')],[db['sequelize']['fn'](_0x8a8a('0x4e'),db[_0x8a8a('0x4d')]['fn']('IF',db[_0x8a8a('0x4d')][_0x8a8a('0x4f')](_0x8a8a('0x5e')))),_0x8a8a('0x56')],[db[_0x8a8a('0x4d')]['fn'](_0x8a8a('0x4e'),db[_0x8a8a('0x4d')]['fn']('IF',db[_0x8a8a('0x4d')]['literal'](_0x8a8a('0x57')))),_0x8a8a('0x58')],[db['sequelize']['fn'](_0x8a8a('0x4e'),db[_0x8a8a('0x4d')]['fn']('IF',db[_0x8a8a('0x4d')][_0x8a8a('0x4f')](_0x8a8a('0x59')))),'reCallContacts'],[db[_0x8a8a('0x4d')]['fn'](_0x8a8a('0x4e'),db[_0x8a8a('0x4d')]['fn']('IF',db[_0x8a8a('0x4d')][_0x8a8a('0x4f')](_0x8a8a('0x5a')))),_0x8a8a('0x5b')]]})['then'](handleEntityNotFound(_0x57a8b2,null))[_0x8a8a('0x24')](respondWithResult(_0x57a8b2,null))[_0x8a8a('0x42')](handleError(_0x57a8b2,null));};exports[_0x8a8a('0x5f')]=function(_0x50a069,_0x2f5ef0,_0x54c7c1){return db[_0x8a8a('0x60')][_0x8a8a('0x46')]({'where':{'id':_0x50a069['params']['id']}})[_0x8a8a('0x24')](handleEntityNotFound(_0x2f5ef0,null))[_0x8a8a('0x24')](function(_0x2449a9){var _0x25ec2f;if(_0x2449a9){_0x25ec2f=squel[_0x8a8a('0x61')]()[_0x8a8a('0x62')](_0x8a8a('0x63'))[_0x8a8a('0x64')]([_0x8a8a('0x65'),_0x8a8a('0x66'),_0x8a8a('0x67'),_0x8a8a('0x68'),_0x8a8a('0x69'),_0x8a8a('0x6a'),_0x8a8a('0x6b')],squel[_0x8a8a('0x6c')]()[_0x8a8a('0x6d')](_0x8a8a('0x6e'),'phone')[_0x8a8a('0x6d')]('NOW()',_0x8a8a('0x66'))[_0x8a8a('0x6d')](_0x8a8a('0x6f'),'ContactId')['field'](_0x8a8a('0x70'),_0x8a8a('0x68'))[_0x8a8a('0x6d')]('ANY_VALUE(VoiceQueueId)','VoiceQueueId')[_0x8a8a('0x6d')](_0x8a8a('0x71'),_0x8a8a('0x6a'))[_0x8a8a('0x6d')](_0x8a8a('0x71'),_0x8a8a('0x6b'))[_0x8a8a('0x72')](_0x8a8a('0x73'))['where'](_0x8a8a('0x74'),_0x50a069[_0x8a8a('0x4c')]['id']['toString']())[_0x8a8a('0x3a')](_0x8a8a('0x75'),_0x50a069[_0x8a8a('0x48')][_0x8a8a('0x76')][_0x8a8a('0x77')]())[_0x8a8a('0x3a')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x8a8a('0x3a')](_0x8a8a('0x78'),squel[_0x8a8a('0x6c')]()[_0x8a8a('0x6d')](_0x8a8a('0x65'))['from'](_0x8a8a('0x63'))[_0x8a8a('0x3a')](_0x8a8a('0x74'),_0x50a069[_0x8a8a('0x4c')]['id'][_0x8a8a('0x77')]()))[_0x8a8a('0x3a')](_0x8a8a('0x78'),squel[_0x8a8a('0x6c')]()[_0x8a8a('0x6d')](_0x8a8a('0x79'))['from'](_0x8a8a('0x73'))[_0x8a8a('0x3a')](_0x8a8a('0x74'),_0x50a069[_0x8a8a('0x4c')]['id'][_0x8a8a('0x77')]())['where']('state\x20=\x204'))[_0x8a8a('0x7a')](_0x8a8a('0x67')))[_0x8a8a('0x77')]();return db['sequelize'][_0x8a8a('0x30')](_0x25ec2f);}return[];})[_0x8a8a('0x24')](respondWithResult(_0x2f5ef0,null))[_0x8a8a('0x42')](handleError(_0x2f5ef0,null));};exports[_0x8a8a('0x7b')]=function(_0x5675ec,_0x13504b,_0x90bb92){return db[_0x8a8a('0x7c')]['find']({'where':{'id':_0x5675ec['params']['id']}})['then'](handleEntityNotFound(_0x13504b,null))[_0x8a8a('0x24')](function(_0x57f22c){var _0x20540c;if(_0x57f22c){_0x20540c=squel['insert']()['into'](_0x8a8a('0x63'))['fromQuery'](['phone','scheduledAt',_0x8a8a('0x67'),'ListId','CampaignId',_0x8a8a('0x6a'),'updatedAt'],squel[_0x8a8a('0x6c')]()['field'](_0x8a8a('0x6e'),_0x8a8a('0x65'))[_0x8a8a('0x6d')](_0x8a8a('0x71'),'scheduledAt')[_0x8a8a('0x6d')](_0x8a8a('0x6f'),'ContactId')[_0x8a8a('0x6d')](_0x8a8a('0x70'),_0x8a8a('0x68'))[_0x8a8a('0x6d')]('ANY_VALUE(CampaignId)','CampaignId')[_0x8a8a('0x6d')](_0x8a8a('0x71'),_0x8a8a('0x6a'))['field'](_0x8a8a('0x71'),_0x8a8a('0x6b'))[_0x8a8a('0x72')]('cm_hopper_final')[_0x8a8a('0x3a')](_0x8a8a('0x7d'),_0x5675ec[_0x8a8a('0x4c')]['id'][_0x8a8a('0x77')]())[_0x8a8a('0x3a')]('state\x20=\x20?',_0x5675ec[_0x8a8a('0x48')][_0x8a8a('0x76')][_0x8a8a('0x77')]())[_0x8a8a('0x3a')](_0x8a8a('0x7e'))[_0x8a8a('0x3a')](_0x8a8a('0x78'),squel['select']()['field'](_0x8a8a('0x65'))[_0x8a8a('0x72')](_0x8a8a('0x63'))['where'](_0x8a8a('0x7d'),_0x5675ec[_0x8a8a('0x4c')]['id'][_0x8a8a('0x77')]()))[_0x8a8a('0x3a')](_0x8a8a('0x78'),squel[_0x8a8a('0x6c')]()[_0x8a8a('0x6d')](_0x8a8a('0x79'))[_0x8a8a('0x72')](_0x8a8a('0x73'))['where'](_0x8a8a('0x7d'),_0x5675ec[_0x8a8a('0x4c')]['id'][_0x8a8a('0x77')]())['where'](_0x8a8a('0x7f')))[_0x8a8a('0x7a')](_0x8a8a('0x67')))['toString']();return db['sequelize'][_0x8a8a('0x30')](_0x20540c);}return[];})[_0x8a8a('0x24')](respondWithResult(_0x13504b,null))[_0x8a8a('0x42')](handleError(_0x13504b,null));};exports[_0x8a8a('0x80')]=function(_0x51c5ce,_0x2fa27b,_0x368294){return db[_0x8a8a('0x81')][_0x8a8a('0x82')]({'where':{'VoiceQueueId':_0x51c5ce['body']['VoiceQueueId'],'CampaignId':_0x51c5ce[_0x8a8a('0x48')][_0x8a8a('0x83')],'ContactId':_0x51c5ce[_0x8a8a('0x48')]['ContactId']}})[_0x8a8a('0x24')](handleEntityNotFound(_0x2fa27b,null))[_0x8a8a('0x24')](function(_0x2affff){if(_0x2affff){return _0x2affff;}return null;})[_0x8a8a('0x24')](respondWithResult(_0x2fa27b,null))[_0x8a8a('0x42')](handleError(_0x2fa27b,null));}; \ No newline at end of file +var _0x867f=['destroy','end','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','length','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','scheduledAt','VoiceQueueId','createdAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(VoiceQueueId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','phone','select','calleridnum','from','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','ListId','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','../../mysqldb','status','json','offset','limit','Content-Range','apply','save','update','then'];(function(_0xa60b9,_0x41ab8d){var _0xa3dc1a=function(_0x32928f){while(--_0x32928f){_0xa60b9['push'](_0xa60b9['shift']());}};_0xa3dc1a(++_0x41ab8d);}(_0x867f,0xe6));var _0xf867=function(_0x22cea4,_0x54f16a){_0x22cea4=_0x22cea4-0x0;var _0x59d75b=_0x867f[_0x22cea4];return _0x59d75b;};'use strict';var pdf=require(_0xf867('0x0'));var emlformat=require(_0xf867('0x1'));var rimraf=require(_0xf867('0x2'));var zipdir=require(_0xf867('0x3'));var jsonpatch=require(_0xf867('0x4'));var rp=require(_0xf867('0x5'));var moment=require(_0xf867('0x6'));var BPromise=require(_0xf867('0x7'));var Mustache=require(_0xf867('0x8'));var util=require('util');var path=require('path');var sox=require(_0xf867('0x9'));var csv=require(_0xf867('0xa'));var ejs=require(_0xf867('0xb'));var fs=require('fs');var _=require(_0xf867('0xc'));var squel=require(_0xf867('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf867('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf867('0xf'));var Papa=require(_0xf867('0x10'));var Redis=require(_0xf867('0x11'));var authService=require(_0xf867('0x12'));var qs=require(_0xf867('0x13'));var as=require(_0xf867('0x14'));var hardwareService=require(_0xf867('0x15'));var logger=require(_0xf867('0x16'))('api');var utils=require(_0xf867('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf867('0x18'))['db'];function respondWithStatusCode(_0x1792ae,_0x20fe34){_0x20fe34=_0x20fe34||0xcc;return function(_0x56740c){if(_0x56740c){return _0x1792ae['sendStatus'](_0x20fe34);}return _0x1792ae[_0xf867('0x19')](_0x20fe34)['end']();};}function respondWithResult(_0x352f0b,_0x49ff40){_0x49ff40=_0x49ff40||0xc8;return function(_0x48ff28){if(_0x48ff28){return _0x352f0b[_0xf867('0x19')](_0x49ff40)[_0xf867('0x1a')](_0x48ff28);}};}function respondWithFilteredResult(_0x7a143e,_0x13973b){return function(_0x38fed9){if(_0x38fed9){var _0x1e5161=_0x38fed9['count'],_0x1b02e5=_0x13973b[_0xf867('0x1b')],_0x3e8442=_0x13973b['offset']+_0x13973b[_0xf867('0x1c')],_0x33c10b;if(_0x3e8442>=_0x1e5161){_0x3e8442=_0x1e5161;_0x33c10b=0xc8;}else{_0x33c10b=0xce;}_0x7a143e['status'](_0x33c10b);return _0x7a143e['set'](_0xf867('0x1d'),_0x1b02e5+'-'+_0x3e8442+'/'+_0x1e5161)['json'](_0x38fed9);}return null;};}function patchUpdates(_0x4b4ad4){return function(_0x2092af){try{jsonpatch[_0xf867('0x1e')](_0x2092af,_0x4b4ad4,!![]);}catch(_0x55068f){return BPromise['reject'](_0x55068f);}return _0x2092af[_0xf867('0x1f')]();};}function saveUpdates(_0x23e7dd,_0x1456ce){return function(_0x44b097){if(_0x44b097){return _0x44b097[_0xf867('0x20')](_0x23e7dd)[_0xf867('0x21')](function(_0x3430ad){return _0x3430ad;});}return null;};}function removeEntity(_0x34db74,_0x586a25){return function(_0x568aba){if(_0x568aba){return _0x568aba[_0xf867('0x22')]()['then'](function(){_0x34db74[_0xf867('0x19')](0xcc)[_0xf867('0x23')]();});}};}function handleEntityNotFound(_0x4da34b,_0x419b6f){return function(_0x169f15){if(!_0x169f15){_0x4da34b['sendStatus'](0x194);}return _0x169f15;};}function handleError(_0x231076,_0x42a431){_0x42a431=_0x42a431||0x1f4;return function(_0x167e70){logger[_0xf867('0x24')](_0x167e70[_0xf867('0x25')]);if(_0x167e70[_0xf867('0x26')]){delete _0x167e70[_0xf867('0x26')];}_0x231076[_0xf867('0x19')](_0x42a431)[_0xf867('0x27')](_0x167e70);};}exports[_0xf867('0x28')]=function(_0x28b44a,_0x1f8aa1){var _0xa40271={},_0x234fa0={},_0x327a13={'count':0x0,'rows':[]};var _0x3ed616=_['map'](db[_0xf867('0x29')][_0xf867('0x2a')],function(_0x39218a){return{'name':_0x39218a[_0xf867('0x2b')],'type':_0x39218a[_0xf867('0x2c')][_0xf867('0x2d')]};});_0x234fa0[_0xf867('0x2e')]=_['map'](_0x3ed616,_0xf867('0x26'));_0x234fa0[_0xf867('0x2f')]=_[_0xf867('0x30')](_0x28b44a[_0xf867('0x2f')]);_0x234fa0[_0xf867('0x31')]=_[_0xf867('0x32')](_0x234fa0[_0xf867('0x2e')],_0x234fa0[_0xf867('0x2f')]);_0xa40271['attributes']=_[_0xf867('0x32')](_0x234fa0['model'],qs[_0xf867('0x33')](_0x28b44a['query'][_0xf867('0x33')]));_0xa40271[_0xf867('0x34')]=_0xa40271[_0xf867('0x34')]['length']?_0xa40271[_0xf867('0x34')]:_0x234fa0[_0xf867('0x2e')];if(!_0x28b44a['query']['hasOwnProperty'](_0xf867('0x35'))){_0xa40271['limit']=qs[_0xf867('0x1c')](_0x28b44a[_0xf867('0x2f')][_0xf867('0x1c')]);_0xa40271[_0xf867('0x1b')]=qs['offset'](_0x28b44a['query'][_0xf867('0x1b')]);}_0xa40271[_0xf867('0x36')]=qs[_0xf867('0x37')](_0x28b44a['query'][_0xf867('0x37')]);_0xa40271[_0xf867('0x38')]=qs['filters'](_[_0xf867('0x39')](_0x28b44a['query'],_0x234fa0[_0xf867('0x31')]),_0x3ed616);if(_0x28b44a[_0xf867('0x2f')][_0xf867('0x3a')]){_0xa40271['where']=_[_0xf867('0x3b')](_0xa40271['where'],{'$or':_[_0xf867('0x3c')](_0x3ed616,function(_0x2b4ac9){if(_0x2b4ac9[_0xf867('0x2c')]!==_0xf867('0x3d')){var _0x193bd0={};_0x193bd0[_0x2b4ac9[_0xf867('0x26')]]={'$like':'%'+_0x28b44a[_0xf867('0x2f')][_0xf867('0x3a')]+'%'};return _0x193bd0;}})});}_0xa40271=_['merge']({},_0xa40271,_0x28b44a['options']);var _0x4a877={'where':_0xa40271[_0xf867('0x38')]};return db[_0xf867('0x29')][_0xf867('0x3e')](_0x4a877)[_0xf867('0x21')](function(_0x462df6){_0x327a13[_0xf867('0x3e')]=_0x462df6;if(_0x28b44a['query'][_0xf867('0x3f')]){_0xa40271[_0xf867('0x40')]=[{'all':!![]}];}return db[_0xf867('0x29')][_0xf867('0x41')](_0xa40271);})[_0xf867('0x21')](function(_0x3e35d2){_0x327a13[_0xf867('0x42')]=_0x3e35d2;return _0x327a13;})[_0xf867('0x21')](respondWithFilteredResult(_0x1f8aa1,_0xa40271))[_0xf867('0x43')](handleError(_0x1f8aa1,null));};exports['show']=function(_0x2ba547,_0x4e31d8){var _0x31212a={'raw':!![],'where':{'id':_0x2ba547[_0xf867('0x44')]['id']}},_0x3f7394={};_0x3f7394['model']=_[_0xf867('0x30')](db[_0xf867('0x29')][_0xf867('0x2a')]);_0x3f7394[_0xf867('0x2f')]=_[_0xf867('0x30')](_0x2ba547[_0xf867('0x2f')]);_0x3f7394['filters']=_[_0xf867('0x32')](_0x3f7394[_0xf867('0x2e')],_0x3f7394[_0xf867('0x2f')]);_0x31212a[_0xf867('0x34')]=_[_0xf867('0x32')](_0x3f7394['model'],qs[_0xf867('0x33')](_0x2ba547['query'][_0xf867('0x33')]));_0x31212a[_0xf867('0x34')]=_0x31212a['attributes'][_0xf867('0x45')]?_0x31212a[_0xf867('0x34')]:_0x3f7394[_0xf867('0x2e')];if(_0x2ba547[_0xf867('0x2f')][_0xf867('0x3f')]){_0x31212a[_0xf867('0x40')]=[{'all':!![]}];}_0x31212a=_['merge']({},_0x31212a,_0x2ba547[_0xf867('0x46')]);return db['CmHopperFinal'][_0xf867('0x47')](_0x31212a)[_0xf867('0x21')](handleEntityNotFound(_0x4e31d8,null))[_0xf867('0x21')](respondWithResult(_0x4e31d8,null))[_0xf867('0x43')](handleError(_0x4e31d8,null));};exports[_0xf867('0x48')]=function(_0x395c7c,_0x221fb8){return db['CmHopperFinal']['describe']()[_0xf867('0x21')](respondWithResult(_0x221fb8,null))[_0xf867('0x43')](handleError(_0x221fb8,null));};exports[_0xf867('0x20')]=function(_0x5ca8a7,_0x384757){if(_0x5ca8a7[_0xf867('0x49')][_0xf867('0x4a')]){delete _0x5ca8a7['body'][_0xf867('0x4a')];}return db['CmHopperFinal'][_0xf867('0x47')]({'where':{'uniqueid':_0x5ca8a7[_0xf867('0x44')]['id']}})[_0xf867('0x21')](handleEntityNotFound(_0x384757,null))[_0xf867('0x21')](saveUpdates(_0x5ca8a7[_0xf867('0x49')],null))[_0xf867('0x21')](respondWithResult(_0x384757,null))[_0xf867('0x43')](handleError(_0x384757,null));};exports[_0xf867('0x4b')]=function(_0x58cf29,_0x4bc9c5,_0x1c1c90){return db[_0xf867('0x29')][_0xf867('0x41')]({'raw':![],'where':{'VoiceQueueId':_0x58cf29[_0xf867('0x44')]['id']},'attributes':[[db[_0xf867('0x4c')]['fn'](_0xf867('0x4d'),db[_0xf867('0x4c')]['fn']('IF',db['sequelize'][_0xf867('0x4e')](_0xf867('0x4f')))),_0xf867('0x50')],[db[_0xf867('0x4c')]['fn']('COUNT',db[_0xf867('0x4c')]['fn']('IF',db[_0xf867('0x4c')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0xf867('0x4c')]['fn'](_0xf867('0x4d'),db['sequelize']['fn']('IF',db[_0xf867('0x4c')][_0xf867('0x4e')]('`state`\x20=\x205,\x201,\x20null'))),_0xf867('0x51')],[db[_0xf867('0x4c')]['fn']('COUNT',db[_0xf867('0x4c')]['fn']('IF',db[_0xf867('0x4c')][_0xf867('0x4e')](_0xf867('0x52')))),_0xf867('0x53')],[db['sequelize']['fn']('COUNT',db[_0xf867('0x4c')]['fn']('IF',db[_0xf867('0x4c')][_0xf867('0x4e')](_0xf867('0x54')))),_0xf867('0x55')],[db[_0xf867('0x4c')]['fn']('COUNT',db[_0xf867('0x4c')]['fn']('IF',db[_0xf867('0x4c')][_0xf867('0x4e')](_0xf867('0x56')))),_0xf867('0x57')],[db[_0xf867('0x4c')]['fn'](_0xf867('0x4d'),db[_0xf867('0x4c')]['fn']('IF',db[_0xf867('0x4c')][_0xf867('0x4e')](_0xf867('0x58')))),'reCallContacts'],[db[_0xf867('0x4c')]['fn'](_0xf867('0x4d'),db[_0xf867('0x4c')]['fn']('IF',db['sequelize'][_0xf867('0x4e')](_0xf867('0x59')))),_0xf867('0x5a')]]})[_0xf867('0x21')](handleEntityNotFound(_0x4bc9c5,null))['then'](respondWithResult(_0x4bc9c5,null))['catch'](handleError(_0x4bc9c5,null));};exports[_0xf867('0x5b')]=function(_0x649555,_0x1295ef,_0x72fc06){return db['CmHopperFinal'][_0xf867('0x41')]({'raw':![],'where':{'CampaignId':_0x649555['params']['id']},'attributes':[[db[_0xf867('0x4c')]['fn'](_0xf867('0x4d'),db[_0xf867('0x4c')]['fn']('IF',db['sequelize'][_0xf867('0x4e')](_0xf867('0x4f')))),'noSuchContacts'],[db['sequelize']['fn'](_0xf867('0x4d'),db[_0xf867('0x4c')]['fn']('IF',db[_0xf867('0x4c')][_0xf867('0x4e')](_0xf867('0x5c')))),_0xf867('0x5d')],[db[_0xf867('0x4c')]['fn']('COUNT',db[_0xf867('0x4c')]['fn']('IF',db[_0xf867('0x4c')][_0xf867('0x4e')](_0xf867('0x5e')))),_0xf867('0x51')],[db[_0xf867('0x4c')]['fn'](_0xf867('0x4d'),db[_0xf867('0x4c')]['fn']('IF',db[_0xf867('0x4c')][_0xf867('0x4e')](_0xf867('0x52')))),_0xf867('0x53')],[db[_0xf867('0x4c')]['fn']('COUNT',db[_0xf867('0x4c')]['fn']('IF',db[_0xf867('0x4c')]['literal'](_0xf867('0x54')))),_0xf867('0x55')],[db[_0xf867('0x4c')]['fn']('COUNT',db[_0xf867('0x4c')]['fn']('IF',db[_0xf867('0x4c')]['literal'](_0xf867('0x56')))),_0xf867('0x57')],[db[_0xf867('0x4c')]['fn']('COUNT',db[_0xf867('0x4c')]['fn']('IF',db[_0xf867('0x4c')][_0xf867('0x4e')](_0xf867('0x58')))),_0xf867('0x5f')],[db['sequelize']['fn'](_0xf867('0x4d'),db['sequelize']['fn']('IF',db['sequelize'][_0xf867('0x4e')](_0xf867('0x59')))),_0xf867('0x5a')]]})[_0xf867('0x21')](handleEntityNotFound(_0x1295ef,null))[_0xf867('0x21')](respondWithResult(_0x1295ef,null))[_0xf867('0x43')](handleError(_0x1295ef,null));};exports[_0xf867('0x60')]=function(_0xb3e7bc,_0x178053,_0xf0fe5c){return db[_0xf867('0x61')]['find']({'where':{'id':_0xb3e7bc[_0xf867('0x44')]['id']}})[_0xf867('0x21')](handleEntityNotFound(_0x178053,null))[_0xf867('0x21')](function(_0x898fe5){var _0x4c682f;if(_0x898fe5){_0x4c682f=squel[_0xf867('0x62')]()['into'](_0xf867('0x63'))['fromQuery'](['phone',_0xf867('0x64'),'ContactId','ListId',_0xf867('0x65'),_0xf867('0x66'),'updatedAt'],squel['select']()[_0xf867('0x67')](_0xf867('0x68'),'phone')[_0xf867('0x67')](_0xf867('0x69'),_0xf867('0x64'))['field'](_0xf867('0x6a'),_0xf867('0x6b'))['field']('ANY_VALUE(ListId)','ListId')[_0xf867('0x67')](_0xf867('0x6c'),_0xf867('0x65'))['field'](_0xf867('0x69'),'createdAt')[_0xf867('0x67')](_0xf867('0x69'),_0xf867('0x6d'))['from'](_0xf867('0x6e'))[_0xf867('0x38')](_0xf867('0x6f'),_0xb3e7bc[_0xf867('0x44')]['id'][_0xf867('0x70')]())['where'](_0xf867('0x71'),_0xb3e7bc[_0xf867('0x49')][_0xf867('0x72')][_0xf867('0x70')]())[_0xf867('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xf867('0x38')](_0xf867('0x73'),squel['select']()[_0xf867('0x67')](_0xf867('0x74'))['from'](_0xf867('0x63'))[_0xf867('0x38')](_0xf867('0x6f'),_0xb3e7bc[_0xf867('0x44')]['id'][_0xf867('0x70')]()))[_0xf867('0x38')](_0xf867('0x73'),squel[_0xf867('0x75')]()['field'](_0xf867('0x76'))[_0xf867('0x77')]('cm_hopper_final')[_0xf867('0x38')](_0xf867('0x6f'),_0xb3e7bc[_0xf867('0x44')]['id'][_0xf867('0x70')]())[_0xf867('0x38')](_0xf867('0x78')))[_0xf867('0x79')](_0xf867('0x6b')))[_0xf867('0x70')]();return db[_0xf867('0x4c')]['query'](_0x4c682f);}return[];})['then'](respondWithResult(_0x178053,null))[_0xf867('0x43')](handleError(_0x178053,null));};exports[_0xf867('0x7a')]=function(_0x2de5f2,_0x436afa,_0x23c830){return db[_0xf867('0x7b')]['find']({'where':{'id':_0x2de5f2['params']['id']}})[_0xf867('0x21')](handleEntityNotFound(_0x436afa,null))[_0xf867('0x21')](function(_0x1f9a22){var _0x5752b0;if(_0x1f9a22){_0x5752b0=squel[_0xf867('0x62')]()[_0xf867('0x7c')](_0xf867('0x63'))['fromQuery'](['phone',_0xf867('0x64'),_0xf867('0x6b'),_0xf867('0x7d'),_0xf867('0x7e'),_0xf867('0x66'),_0xf867('0x6d')],squel['select']()['field']('ANY_VALUE(calleridnum)',_0xf867('0x74'))['field']('NOW()',_0xf867('0x64'))[_0xf867('0x67')]('ANY_VALUE(ContactId)',_0xf867('0x6b'))['field'](_0xf867('0x7f'),_0xf867('0x7d'))[_0xf867('0x67')](_0xf867('0x80'),_0xf867('0x7e'))[_0xf867('0x67')](_0xf867('0x69'),_0xf867('0x66'))[_0xf867('0x67')](_0xf867('0x69'),'updatedAt')[_0xf867('0x77')](_0xf867('0x6e'))[_0xf867('0x38')](_0xf867('0x81'),_0x2de5f2[_0xf867('0x44')]['id'][_0xf867('0x70')]())[_0xf867('0x38')](_0xf867('0x71'),_0x2de5f2['body'][_0xf867('0x72')]['toString']())[_0xf867('0x38')](_0xf867('0x82'))[_0xf867('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xf867('0x75')]()[_0xf867('0x67')](_0xf867('0x74'))[_0xf867('0x77')](_0xf867('0x63'))[_0xf867('0x38')]('CampaignId\x20=\x20?',_0x2de5f2[_0xf867('0x44')]['id'][_0xf867('0x70')]()))[_0xf867('0x38')](_0xf867('0x73'),squel[_0xf867('0x75')]()[_0xf867('0x67')](_0xf867('0x76'))['from'](_0xf867('0x6e'))[_0xf867('0x38')](_0xf867('0x81'),_0x2de5f2[_0xf867('0x44')]['id']['toString']())[_0xf867('0x38')](_0xf867('0x78')))[_0xf867('0x79')](_0xf867('0x6b')))[_0xf867('0x70')]();return db['sequelize'][_0xf867('0x2f')](_0x5752b0);}return[];})[_0xf867('0x21')](respondWithResult(_0x436afa,null))['catch'](handleError(_0x436afa,null));};exports['checkContactHopper']=function(_0x42c46a,_0x2cae4f,_0x152718){return db['CmHopper'][_0xf867('0x83')]({'where':{'VoiceQueueId':_0x42c46a[_0xf867('0x49')][_0xf867('0x65')],'CampaignId':_0x42c46a[_0xf867('0x49')][_0xf867('0x7e')],'ContactId':_0x42c46a[_0xf867('0x49')][_0xf867('0x6b')]}})['then'](handleEntityNotFound(_0x2cae4f,null))[_0xf867('0x21')](function(_0x416d88){if(_0x416d88){return _0x416d88;}return null;})[_0xf867('0x21')](respondWithResult(_0x2cae4f,null))[_0xf867('0x43')](handleError(_0x2cae4f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 08b4312..2791e5f 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 _0x554f=['rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x310ae0,_0x2baa3a){var _0x4d6830=function(_0x4bd455){while(--_0x4bd455){_0x310ae0['push'](_0x310ae0['shift']());}};_0x4d6830(++_0x2baa3a);}(_0x554f,0x18e));var _0xf554=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x554f[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xf554('0x0'));var util=require(_0xf554('0x1'));var logger=require(_0xf554('0x2'))(_0xf554('0x3'));var moment=require(_0xf554('0x4'));var BPromise=require('bluebird');var rp=require(_0xf554('0x5'));var fs=require('fs');var path=require(_0xf554('0x6'));var rimraf=require(_0xf554('0x7'));var config=require(_0xf554('0x8'));var attributes=require(_0xf554('0x9'));module[_0xf554('0xa')]=function(_0x52c10c,_0x41b1d1){return _0x52c10c[_0xf554('0xb')]('CmHopperFinal',attributes,{'tableName':_0xf554('0xc'),'paranoid':![],'indexes':[{'name':_0xf554('0xd'),'fields':[_0xf554('0xd')]},{'name':_0xf554('0xe'),'fields':[_0xf554('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x60e8=['bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','api','moment'];(function(_0x79b33d,_0x3ec05a){var _0x3fe279=function(_0x86267d){while(--_0x86267d){_0x79b33d['push'](_0x79b33d['shift']());}};_0x3fe279(++_0x3ec05a);}(_0x60e8,0xea));var _0x860e=function(_0x5ef41f,_0x3c24ac){_0x5ef41f=_0x5ef41f-0x0;var _0x1d1d3c=_0x60e8[_0x5ef41f];return _0x1d1d3c;};'use strict';var _=require(_0x860e('0x0'));var util=require(_0x860e('0x1'));var logger=require('../../config/logger')(_0x860e('0x2'));var moment=require(_0x860e('0x3'));var BPromise=require(_0x860e('0x4'));var rp=require(_0x860e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x860e('0x6'));var config=require(_0x860e('0x7'));var attributes=require(_0x860e('0x8'));module['exports']=function(_0x29a658,_0x4f6667){return _0x29a658[_0x860e('0x9')](_0x860e('0xa'),attributes,{'tableName':_0x860e('0xb'),'paranoid':![],'indexes':[{'name':_0x860e('0xc'),'fields':[_0x860e('0xc')]},{'name':_0x860e('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 689c0fe..b83b433 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 _0xcf4e=['then','info','CmHopperFinal,\x20%s,\x20%s','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CmHopperFinal','create','body','options','CreateCmHopperFinal','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x2a4ade,_0x5e1f6c){var _0x14c2d0=function(_0x59899d){while(--_0x59899d){_0x2a4ade['push'](_0x2a4ade['shift']());}};_0x14c2d0(++_0x5e1f6c);}(_0xcf4e,0x1d3));var _0xecf4=function(_0x5728c4,_0x4f9abb){_0x5728c4=_0x5728c4-0x0;var _0x54e082=_0xcf4e[_0x5728c4];return _0x54e082;};'use strict';var _=require(_0xecf4('0x0'));var util=require(_0xecf4('0x1'));var moment=require(_0xecf4('0x2'));var BPromise=require(_0xecf4('0x3'));var rs=require(_0xecf4('0x4'));var fs=require('fs');var Redis=require(_0xecf4('0x5'));var db=require(_0xecf4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xecf4('0x7'))(_0xecf4('0x8'));var config=require(_0xecf4('0x9'));var jayson=require(_0xecf4('0xa'));var client=jayson[_0xecf4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57a9b5,_0x148643,_0x3bbf23){return new BPromise(function(_0x566fd5,_0x24f639){return client[_0xecf4('0xc')](_0x57a9b5,_0x3bbf23)[_0xecf4('0xd')](function(_0x1f0542){logger[_0xecf4('0xe')](_0xecf4('0xf'),_0x148643,'request\x20sent');logger[_0xecf4('0x10')](_0xecf4('0x11'),_0x148643,_0xecf4('0x12'),JSON[_0xecf4('0x13')](_0x1f0542));if(_0x1f0542[_0xecf4('0x14')]){if(_0x1f0542['error'][_0xecf4('0x15')]===0x1f4){logger[_0xecf4('0x14')](_0xecf4('0xf'),_0x148643,_0x1f0542[_0xecf4('0x14')][_0xecf4('0x16')]);return _0x24f639(_0x1f0542[_0xecf4('0x14')][_0xecf4('0x16')]);}logger[_0xecf4('0x14')](_0xecf4('0xf'),_0x148643,_0x1f0542[_0xecf4('0x14')]['message']);return _0x566fd5(_0x1f0542['error'][_0xecf4('0x16')]);}else{logger[_0xecf4('0xe')]('CmHopperFinal,\x20%s,\x20%s',_0x148643,_0xecf4('0x12'));_0x566fd5(_0x1f0542[_0xecf4('0x17')]['message']);}})['catch'](function(_0x42a1ac){logger['error'](_0xecf4('0xf'),_0x148643,_0x42a1ac);_0x24f639(_0x42a1ac);});});}exports['CreateCmHopperFinal']=function(_0x3ea4e4){var _0x59a103=this;return new Promise(function(_0x4d8542,_0x1df6d5){return db[_0xecf4('0x18')][_0xecf4('0x19')](_0x3ea4e4[_0xecf4('0x1a')],{'raw':_0x3ea4e4[_0xecf4('0x1b')]?_0x3ea4e4[_0xecf4('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xecf4('0xd')](function(_0x58aaeb){logger['info'](_0xecf4('0x1c'),_0x3ea4e4);logger[_0xecf4('0x10')](_0xecf4('0x1c'),_0x3ea4e4,JSON['stringify'](_0x58aaeb));_0x4d8542(_0x58aaeb);})[_0xecf4('0x1d')](function(_0x1f1879){logger['error'](_0xecf4('0x1c'),_0x1f1879[_0xecf4('0x16')],_0x3ea4e4);_0x1df6d5(_0x59a103[_0xecf4('0x14')](0x1f4,_0x1f1879[_0xecf4('0x16')]));});});}; \ No newline at end of file +var _0x5535=['http','request','then','info','CmHopperFinal,\x20%s,\x20%s','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x2b007a,_0x41477e){var _0x456455=function(_0x4f1948){while(--_0x4f1948){_0x2b007a['push'](_0x2b007a['shift']());}};_0x456455(++_0x41477e);}(_0x5535,0x1b7));var _0x5553=function(_0x2fad2a,_0x1b47fd){_0x2fad2a=_0x2fad2a-0x0;var _0x4a1069=_0x5535[_0x2fad2a];return _0x4a1069;};'use strict';var _=require('lodash');var util=require(_0x5553('0x0'));var moment=require('moment');var BPromise=require(_0x5553('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5553('0x2'));var db=require(_0x5553('0x3'))['db'];var utils=require(_0x5553('0x4'));var logger=require('../../config/logger')(_0x5553('0x5'));var config=require(_0x5553('0x6'));var jayson=require(_0x5553('0x7'));var client=jayson[_0x5553('0x8')][_0x5553('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2257fa,_0x53d943,_0x4b95fc){return new BPromise(function(_0x3f6344,_0x2905f8){return client[_0x5553('0xa')](_0x2257fa,_0x4b95fc)[_0x5553('0xb')](function(_0x388ac8){logger[_0x5553('0xc')](_0x5553('0xd'),_0x53d943,'request\x20sent');logger[_0x5553('0xe')](_0x5553('0xf'),_0x53d943,'request\x20sent',JSON[_0x5553('0x10')](_0x388ac8));if(_0x388ac8[_0x5553('0x11')]){if(_0x388ac8[_0x5553('0x11')][_0x5553('0x12')]===0x1f4){logger['error'](_0x5553('0xd'),_0x53d943,_0x388ac8[_0x5553('0x11')][_0x5553('0x13')]);return _0x2905f8(_0x388ac8[_0x5553('0x11')][_0x5553('0x13')]);}logger[_0x5553('0x11')](_0x5553('0xd'),_0x53d943,_0x388ac8[_0x5553('0x11')][_0x5553('0x13')]);return _0x3f6344(_0x388ac8[_0x5553('0x11')][_0x5553('0x13')]);}else{logger[_0x5553('0xc')]('CmHopperFinal,\x20%s,\x20%s',_0x53d943,_0x5553('0x14'));_0x3f6344(_0x388ac8['result']['message']);}})[_0x5553('0x15')](function(_0x250f19){logger[_0x5553('0x11')](_0x5553('0xd'),_0x53d943,_0x250f19);_0x2905f8(_0x250f19);});});}exports[_0x5553('0x16')]=function(_0x37e87b){var _0x512da0=this;return new Promise(function(_0x1a3fe5,_0x3d2283){return db[_0x5553('0x17')][_0x5553('0x18')](_0x37e87b[_0x5553('0x19')],{'raw':_0x37e87b[_0x5553('0x1a')]?_0x37e87b[_0x5553('0x1a')][_0x5553('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4957d8){logger[_0x5553('0xc')](_0x5553('0x16'),_0x37e87b);logger[_0x5553('0xe')](_0x5553('0x16'),_0x37e87b,JSON[_0x5553('0x10')](_0x4957d8));_0x1a3fe5(_0x4957d8);})[_0x5553('0x15')](function(_0x3484e8){logger[_0x5553('0x11')](_0x5553('0x16'),_0x3484e8[_0x5553('0x13')],_0x37e87b);_0x3d2283(_0x512da0[_0x5553('0x11')](0x1f4,_0x3484e8['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index c1e6e7e..05c50a4 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 _0x1fb4=['isAuthenticated','describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','util','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','/describe'];(function(_0x64e3c1,_0x14da00){var _0x44adc8=function(_0x2529ce){while(--_0x2529ce){_0x64e3c1['push'](_0x64e3c1['shift']());}};_0x44adc8(++_0x14da00);}(_0x1fb4,0x8b));var _0x41fb=function(_0x54b5b6,_0x30cd7e){_0x54b5b6=_0x54b5b6-0x0;var _0x29a9cf=_0x1fb4[_0x54b5b6];return _0x29a9cf;};'use strict';var multer=require(_0x41fb('0x0'));var util=require(_0x41fb('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(_0x41fb('0x2'));var config=require(_0x41fb('0x3'));var controller=require(_0x41fb('0x4'));router[_0x41fb('0x5')]('/',auth['isAuthenticated'](),controller[_0x41fb('0x6')]);router['get'](_0x41fb('0x7'),auth[_0x41fb('0x8')](),controller[_0x41fb('0x9')]);router[_0x41fb('0x5')](_0x41fb('0xa'),auth[_0x41fb('0x8')](),controller[_0x41fb('0xb')]);router[_0x41fb('0x5')]('/voice/queue/countAttributes/:id',auth[_0x41fb('0x8')](),controller[_0x41fb('0xc')]);router[_0x41fb('0x5')](_0x41fb('0xd'),auth[_0x41fb('0x8')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x41fb('0xe')](_0x41fb('0xf'),auth[_0x41fb('0x8')](),controller[_0x41fb('0x10')]);router[_0x41fb('0xe')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x41fb('0xe')](_0x41fb('0x11'),auth[_0x41fb('0x8')](),controller[_0x41fb('0x12')]);router[_0x41fb('0x13')]('/:id',auth[_0x41fb('0x8')](),controller['update']);module[_0x41fb('0x14')]=router; \ No newline at end of file +var _0xdc66=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','describe','get','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','util','path','connect-timeout','express'];(function(_0x4de247,_0x462cb0){var _0x12ad45=function(_0x3e6ce8){while(--_0x3e6ce8){_0x4de247['push'](_0x4de247['shift']());}};_0x12ad45(++_0x462cb0);}(_0xdc66,0x130));var _0x6dc6=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0xdc66[_0x445101];return _0x3c3d04;};'use strict';var multer=require('multer');var util=require(_0x6dc6('0x0'));var path=require(_0x6dc6('0x1'));var timeout=require(_0x6dc6('0x2'));var express=require(_0x6dc6('0x3'));var router=express[_0x6dc6('0x4')]();var auth=require(_0x6dc6('0x5'));var interaction=require(_0x6dc6('0x6'));var config=require(_0x6dc6('0x7'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0x6dc6('0x8')](),controller[_0x6dc6('0x9')]);router['get']('/describe',auth[_0x6dc6('0x8')](),controller[_0x6dc6('0xa')]);router[_0x6dc6('0xb')](_0x6dc6('0xc'),auth[_0x6dc6('0x8')](),controller[_0x6dc6('0xd')]);router['get'](_0x6dc6('0xe'),auth[_0x6dc6('0x8')](),controller[_0x6dc6('0xf')]);router[_0x6dc6('0xb')](_0x6dc6('0x10'),auth[_0x6dc6('0x8')](),controller[_0x6dc6('0x11')]);router[_0x6dc6('0x12')](_0x6dc6('0x13'),auth[_0x6dc6('0x8')](),controller[_0x6dc6('0x14')]);router['post'](_0x6dc6('0x15'),auth[_0x6dc6('0x8')](),controller[_0x6dc6('0x16')]);router[_0x6dc6('0x12')](_0x6dc6('0x17'),auth[_0x6dc6('0x8')](),controller[_0x6dc6('0x18')]);router[_0x6dc6('0x19')]('/:id',auth[_0x6dc6('0x8')](),controller[_0x6dc6('0x1a')]);module[_0x6dc6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 020722e..17319e9 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 _0x3b0d=['INTEGER','STRING','DATE','BOOLEAN','exports'];(function(_0x18be96,_0x15e628){var _0x4b9baa=function(_0x2791b9){while(--_0x2791b9){_0x18be96['push'](_0x18be96['shift']());}};_0x4b9baa(++_0x15e628);}(_0x3b0d,0xf4));var _0xd3b0=function(_0x360fc7,_0x5cd3e7){_0x360fc7=_0x360fc7-0x0;var _0x42f8ee=_0x3b0d[_0x360fc7];return _0x42f8ee;};'use strict';var Sequelize=require('sequelize');module[_0xd3b0('0x0')]={'state':{'type':Sequelize[_0xd3b0('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xd3b0('0x2')]},'scheduledat':{'type':Sequelize[_0xd3b0('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd3b0('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd3b0('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xd3b0('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd3b0('0x2')]},'calleridname':{'type':Sequelize[_0xd3b0('0x2')]},'starttime':{'type':Sequelize[_0xd3b0('0x3')]},'responsetime':{'type':Sequelize[_0xd3b0('0x3')]},'answertime':{'type':Sequelize[_0xd3b0('0x3')]},'droptime':{'type':Sequelize[_0xd3b0('0x3')]},'endtime':{'type':Sequelize[_0xd3b0('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd3b0('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd3b0('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd3b0('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd3b0('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xd3b0('0x2')]},'amd':{'type':Sequelize[_0xd3b0('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xd3b0('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd3b0('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd3b0('0x3')]},'recallme':{'type':Sequelize[_0xd3b0('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xd3b0('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xd3b0('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd3b0('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd3b0('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd3b0('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd3b0('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb401=['DATE','BOOLEAN','sequelize','INTEGER','STRING'];(function(_0xe8ba3b,_0x32c511){var _0x416cdc=function(_0x3eb9a5){while(--_0x3eb9a5){_0xe8ba3b['push'](_0xe8ba3b['shift']());}};_0x416cdc(++_0x32c511);}(_0xb401,0x1a6));var _0x1b40=function(_0x6cbee,_0x55a318){_0x6cbee=_0x6cbee-0x0;var _0x4218ec=_0xb401[_0x6cbee];return _0x4218ec;};'use strict';var Sequelize=require(_0x1b40('0x0'));module['exports']={'state':{'type':Sequelize[_0x1b40('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x1b40('0x2')]},'scheduledat':{'type':Sequelize[_0x1b40('0x3')]},'countbusyretry':{'type':Sequelize[_0x1b40('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1b40('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1b40('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1b40('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1b40('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x1b40('0x2')]},'originatecalleridname':{'type':Sequelize[_0x1b40('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1b40('0x2')]},'starttime':{'type':Sequelize[_0x1b40('0x3')]},'responsetime':{'type':Sequelize[_0x1b40('0x3')]},'answertime':{'type':Sequelize[_0x1b40('0x3')]},'droptime':{'type':Sequelize[_0x1b40('0x3')]},'endtime':{'type':Sequelize[_0x1b40('0x3')]},'ringtime':{'type':Sequelize[_0x1b40('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1b40('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1b40('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1b40('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x1b40('0x2')]},'campaigntype':{'type':Sequelize[_0x1b40('0x2')]},'membername':{'type':Sequelize[_0x1b40('0x2')]},'reason':{'type':Sequelize[_0x1b40('0x2')]},'amd':{'type':Sequelize[_0x1b40('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1b40('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1b40('0x3')]},'recallme':{'type':Sequelize[_0x1b40('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x1b40('0x3')]},'edited':{'type':Sequelize[_0x1b40('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1b40('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1b40('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1b40('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 12ee3e1..c73e1cf 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 _0x66e0=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','keys','query','intersection','model','fields','attributes','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','params','length','includeAll','create','body','catch','describe','uniqueid','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0xd1b61f,_0x3e2285){var _0xa0052e=function(_0x15e310){while(--_0x15e310){_0xd1b61f['push'](_0xd1b61f['shift']());}};_0xa0052e(++_0x3e2285);}(_0x66e0,0xcd));var _0x066e=function(_0x25adb7,_0x5056cc){_0x25adb7=_0x25adb7-0x0;var _0x816f73=_0x66e0[_0x25adb7];return _0x816f73;};'use strict';var pdf=require(_0x066e('0x0'));var emlformat=require(_0x066e('0x1'));var rimraf=require(_0x066e('0x2'));var zipdir=require(_0x066e('0x3'));var jsonpatch=require(_0x066e('0x4'));var rp=require(_0x066e('0x5'));var moment=require('moment');var BPromise=require(_0x066e('0x6'));var Mustache=require(_0x066e('0x7'));var util=require(_0x066e('0x8'));var path=require(_0x066e('0x9'));var sox=require(_0x066e('0xa'));var csv=require(_0x066e('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x066e('0xc'));var toCsv=require(_0x066e('0xb'));var querystring=require(_0x066e('0xd'));var Papa=require(_0x066e('0xe'));var Redis=require(_0x066e('0xf'));var authService=require(_0x066e('0x10'));var qs=require(_0x066e('0x11'));var as=require(_0x066e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x066e('0x13'))(_0x066e('0x14'));var utils=require(_0x066e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x066e('0x16'));var db=require(_0x066e('0x17'))['db'];function respondWithStatusCode(_0x5e5725,_0x16730d){_0x16730d=_0x16730d||0xcc;return function(_0x171a0e){if(_0x171a0e){return _0x5e5725[_0x066e('0x18')](_0x16730d);}return _0x5e5725[_0x066e('0x19')](_0x16730d)[_0x066e('0x1a')]();};}function respondWithResult(_0x5743c2,_0x136155){_0x136155=_0x136155||0xc8;return function(_0x32ea9){if(_0x32ea9){return _0x5743c2[_0x066e('0x19')](_0x136155)[_0x066e('0x1b')](_0x32ea9);}};}function respondWithFilteredResult(_0x22a460,_0x1885d8){return function(_0x14d31f){if(_0x14d31f){var _0xe5507d=_0x14d31f['count'],_0x2a0987=_0x1885d8[_0x066e('0x1c')],_0x33385c=_0x1885d8['offset']+_0x1885d8[_0x066e('0x1d')],_0x492d59;if(_0x33385c>=_0xe5507d){_0x33385c=_0xe5507d;_0x492d59=0xc8;}else{_0x492d59=0xce;}_0x22a460[_0x066e('0x19')](_0x492d59);return _0x22a460[_0x066e('0x1e')](_0x066e('0x1f'),_0x2a0987+'-'+_0x33385c+'/'+_0xe5507d)[_0x066e('0x1b')](_0x14d31f);}return null;};}function patchUpdates(_0x5823ea){return function(_0x3a9d29){try{jsonpatch['apply'](_0x3a9d29,_0x5823ea,!![]);}catch(_0x2be81e){return BPromise['reject'](_0x2be81e);}return _0x3a9d29[_0x066e('0x20')]();};}function saveUpdates(_0x4d24be,_0x163e9a){return function(_0x260226){if(_0x260226){return _0x260226[_0x066e('0x21')](_0x4d24be)[_0x066e('0x22')](function(_0x1e345b){return _0x1e345b;});}return null;};}function removeEntity(_0x36bf1f,_0x4e00ba){return function(_0x44b4a0){if(_0x44b4a0){return _0x44b4a0[_0x066e('0x23')]()['then'](function(){_0x36bf1f['status'](0xcc)[_0x066e('0x1a')]();});}};}function handleEntityNotFound(_0x496bb4,_0x349ff9){return function(_0x2fcf23){if(!_0x2fcf23){_0x496bb4[_0x066e('0x18')](0x194);}return _0x2fcf23;};}function handleError(_0x165fdf,_0x184b15){_0x184b15=_0x184b15||0x1f4;return function(_0x39a278){logger[_0x066e('0x24')](_0x39a278[_0x066e('0x25')]);if(_0x39a278[_0x066e('0x26')]){delete _0x39a278['name'];}_0x165fdf[_0x066e('0x19')](_0x184b15)[_0x066e('0x27')](_0x39a278);};}exports[_0x066e('0x28')]=function(_0x44f0ae,_0x474a19){var _0x17f9f7={},_0x156529={},_0x3f5b6e={'count':0x0,'rows':[]};var _0x4ffbea=_[_0x066e('0x29')](db[_0x066e('0x2a')][_0x066e('0x2b')],function(_0x2f10ba){return{'name':_0x2f10ba[_0x066e('0x2c')],'type':_0x2f10ba[_0x066e('0x2d')]['key']};});_0x156529['model']=_[_0x066e('0x29')](_0x4ffbea,'name');_0x156529['query']=_[_0x066e('0x2e')](_0x44f0ae[_0x066e('0x2f')]);_0x156529['filters']=_[_0x066e('0x30')](_0x156529[_0x066e('0x31')],_0x156529[_0x066e('0x2f')]);_0x17f9f7['attributes']=_[_0x066e('0x30')](_0x156529['model'],qs[_0x066e('0x32')](_0x44f0ae[_0x066e('0x2f')][_0x066e('0x32')]));_0x17f9f7[_0x066e('0x33')]=_0x17f9f7[_0x066e('0x33')]['length']?_0x17f9f7['attributes']:_0x156529[_0x066e('0x31')];if(!_0x44f0ae['query'][_0x066e('0x34')]('nolimit')){_0x17f9f7[_0x066e('0x1d')]=qs['limit'](_0x44f0ae[_0x066e('0x2f')][_0x066e('0x1d')]);_0x17f9f7['offset']=qs[_0x066e('0x1c')](_0x44f0ae[_0x066e('0x2f')][_0x066e('0x1c')]);}_0x17f9f7['order']=qs[_0x066e('0x35')](_0x44f0ae['query'][_0x066e('0x35')]);_0x17f9f7[_0x066e('0x36')]=qs[_0x066e('0x37')](_[_0x066e('0x38')](_0x44f0ae[_0x066e('0x2f')],_0x156529[_0x066e('0x37')]),_0x4ffbea);if(_0x44f0ae[_0x066e('0x2f')][_0x066e('0x39')]){_0x17f9f7[_0x066e('0x36')]=_[_0x066e('0x3a')](_0x17f9f7['where'],{'$or':_[_0x066e('0x29')](_0x4ffbea,function(_0x122280){if(_0x122280[_0x066e('0x2d')]!==_0x066e('0x3b')){var _0x438edc={};_0x438edc[_0x122280[_0x066e('0x26')]]={'$like':'%'+_0x44f0ae[_0x066e('0x2f')][_0x066e('0x39')]+'%'};return _0x438edc;}})});}_0x17f9f7=_[_0x066e('0x3a')]({},_0x17f9f7,_0x44f0ae[_0x066e('0x3c')]);var _0x50ce31={'where':_0x17f9f7[_0x066e('0x36')]};return db[_0x066e('0x2a')]['count'](_0x50ce31)['then'](function(_0x179ec0){_0x3f5b6e[_0x066e('0x3d')]=_0x179ec0;if(_0x44f0ae[_0x066e('0x2f')]['includeAll']){_0x17f9f7[_0x066e('0x3e')]=[{'all':!![]}];}return db[_0x066e('0x2a')][_0x066e('0x3f')](_0x17f9f7);})['then'](function(_0x1527d9){_0x3f5b6e[_0x066e('0x40')]=_0x1527d9;return _0x3f5b6e;})[_0x066e('0x22')](respondWithFilteredResult(_0x474a19,_0x17f9f7))['catch'](handleError(_0x474a19,null));};exports[_0x066e('0x41')]=function(_0x2b5b03,_0x1fbfe6){var _0x46ffbf={'raw':!![],'where':{'id':_0x2b5b03[_0x066e('0x42')]['id']}},_0xe5d71e={};_0xe5d71e[_0x066e('0x31')]=_[_0x066e('0x2e')](db[_0x066e('0x2a')][_0x066e('0x2b')]);_0xe5d71e[_0x066e('0x2f')]=_[_0x066e('0x2e')](_0x2b5b03['query']);_0xe5d71e[_0x066e('0x37')]=_[_0x066e('0x30')](_0xe5d71e[_0x066e('0x31')],_0xe5d71e[_0x066e('0x2f')]);_0x46ffbf[_0x066e('0x33')]=_['intersection'](_0xe5d71e['model'],qs[_0x066e('0x32')](_0x2b5b03[_0x066e('0x2f')][_0x066e('0x32')]));_0x46ffbf[_0x066e('0x33')]=_0x46ffbf[_0x066e('0x33')][_0x066e('0x43')]?_0x46ffbf['attributes']:_0xe5d71e['model'];if(_0x2b5b03[_0x066e('0x2f')][_0x066e('0x44')]){_0x46ffbf['include']=[{'all':!![]}];}_0x46ffbf=_[_0x066e('0x3a')]({},_0x46ffbf,_0x2b5b03[_0x066e('0x3c')]);return db[_0x066e('0x2a')]['find'](_0x46ffbf)[_0x066e('0x22')](handleEntityNotFound(_0x1fbfe6,null))[_0x066e('0x22')](respondWithResult(_0x1fbfe6,null))['catch'](handleError(_0x1fbfe6,null));};exports['create']=function(_0x3b520a,_0x50e7c1){return db[_0x066e('0x2a')][_0x066e('0x45')](_0x3b520a[_0x066e('0x46')],{})[_0x066e('0x22')](respondWithResult(_0x50e7c1,0xc9))[_0x066e('0x47')](handleError(_0x50e7c1,null));};exports['describe']=function(_0x25d141,_0x390005){return db[_0x066e('0x2a')][_0x066e('0x48')]()[_0x066e('0x22')](respondWithResult(_0x390005,null))[_0x066e('0x47')](handleError(_0x390005,null));};exports[_0x066e('0x21')]=function(_0x487523,_0x2b2e08){if(_0x487523['body'][_0x066e('0x49')]){delete _0x487523[_0x066e('0x46')][_0x066e('0x49')];}return db[_0x066e('0x2a')][_0x066e('0x4a')]({'where':{'uniqueid':_0x487523['params']['id']}})[_0x066e('0x22')](handleEntityNotFound(_0x2b2e08,null))[_0x066e('0x22')](saveUpdates(_0x487523[_0x066e('0x46')],null))[_0x066e('0x22')](respondWithResult(_0x2b2e08,null))[_0x066e('0x47')](handleError(_0x2b2e08,null));}; \ No newline at end of file +var _0x3c68=['uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','count','limit','apply','reject','update','then','destroy','sendStatus','error','name','CmHopperHistory','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','nolimit','offset','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','length','find','create','body','describe'];(function(_0xa522f,_0x5debbc){var _0x2083b0=function(_0x288f01){while(--_0x288f01){_0xa522f['push'](_0xa522f['shift']());}};_0x2083b0(++_0x5debbc);}(_0x3c68,0x89));var _0x83c6=function(_0x112185,_0xe07e86){_0x112185=_0x112185-0x0;var _0x560395=_0x3c68[_0x112185];return _0x560395;};'use strict';var pdf=require(_0x83c6('0x0'));var emlformat=require(_0x83c6('0x1'));var rimraf=require(_0x83c6('0x2'));var zipdir=require(_0x83c6('0x3'));var jsonpatch=require(_0x83c6('0x4'));var rp=require('request-promise');var moment=require(_0x83c6('0x5'));var BPromise=require(_0x83c6('0x6'));var Mustache=require(_0x83c6('0x7'));var util=require(_0x83c6('0x8'));var path=require(_0x83c6('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x83c6('0xa'));var fs=require('fs');var _=require(_0x83c6('0xb'));var squel=require('squel');var crypto=require(_0x83c6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x83c6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x83c6('0xe'));var Papa=require(_0x83c6('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x83c6('0x10'));var as=require(_0x83c6('0x11'));var hardwareService=require(_0x83c6('0x12'));var logger=require(_0x83c6('0x13'))(_0x83c6('0x14'));var utils=require(_0x83c6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x83c6('0x16'));var db=require(_0x83c6('0x17'))['db'];function respondWithStatusCode(_0x18fafb,_0xb3603){_0xb3603=_0xb3603||0xcc;return function(_0x38f1aa){if(_0x38f1aa){return _0x18fafb['sendStatus'](_0xb3603);}return _0x18fafb[_0x83c6('0x18')](_0xb3603)['end']();};}function respondWithResult(_0x2d5f19,_0x47704b){_0x47704b=_0x47704b||0xc8;return function(_0x12da2a){if(_0x12da2a){return _0x2d5f19[_0x83c6('0x18')](_0x47704b)['json'](_0x12da2a);}};}function respondWithFilteredResult(_0x58bceb,_0x51f4f8){return function(_0x43f6b2){if(_0x43f6b2){var _0x8e3076=_0x43f6b2[_0x83c6('0x19')],_0x24006c=_0x51f4f8['offset'],_0x1e506a=_0x51f4f8['offset']+_0x51f4f8[_0x83c6('0x1a')],_0x1a6a89;if(_0x1e506a>=_0x8e3076){_0x1e506a=_0x8e3076;_0x1a6a89=0xc8;}else{_0x1a6a89=0xce;}_0x58bceb[_0x83c6('0x18')](_0x1a6a89);return _0x58bceb['set']('Content-Range',_0x24006c+'-'+_0x1e506a+'/'+_0x8e3076)['json'](_0x43f6b2);}return null;};}function patchUpdates(_0x1bf02f){return function(_0x36bd2e){try{jsonpatch[_0x83c6('0x1b')](_0x36bd2e,_0x1bf02f,!![]);}catch(_0x1340d6){return BPromise[_0x83c6('0x1c')](_0x1340d6);}return _0x36bd2e['save']();};}function saveUpdates(_0x1fa3d0,_0x1f1ad1){return function(_0x15e296){if(_0x15e296){return _0x15e296[_0x83c6('0x1d')](_0x1fa3d0)[_0x83c6('0x1e')](function(_0x3e02e1){return _0x3e02e1;});}return null;};}function removeEntity(_0x43a353,_0x583b11){return function(_0x5e2a1c){if(_0x5e2a1c){return _0x5e2a1c[_0x83c6('0x1f')]()[_0x83c6('0x1e')](function(){_0x43a353['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d9bd1,_0x1eab30){return function(_0x158074){if(!_0x158074){_0x4d9bd1[_0x83c6('0x20')](0x194);}return _0x158074;};}function handleError(_0x481e61,_0x11fda9){_0x11fda9=_0x11fda9||0x1f4;return function(_0x3e18bc){logger[_0x83c6('0x21')](_0x3e18bc['stack']);if(_0x3e18bc[_0x83c6('0x22')]){delete _0x3e18bc['name'];}_0x481e61[_0x83c6('0x18')](_0x11fda9)['send'](_0x3e18bc);};}exports['index']=function(_0x1535d5,_0x2e50ea){var _0x922eba={},_0x3b7860={},_0xaf65b4={'count':0x0,'rows':[]};var _0x403ebe=_['map'](db[_0x83c6('0x23')][_0x83c6('0x24')],function(_0x393cc1){return{'name':_0x393cc1[_0x83c6('0x25')],'type':_0x393cc1[_0x83c6('0x26')][_0x83c6('0x27')]};});_0x3b7860[_0x83c6('0x28')]=_[_0x83c6('0x29')](_0x403ebe,'name');_0x3b7860[_0x83c6('0x2a')]=_[_0x83c6('0x2b')](_0x1535d5[_0x83c6('0x2a')]);_0x3b7860[_0x83c6('0x2c')]=_['intersection'](_0x3b7860[_0x83c6('0x28')],_0x3b7860[_0x83c6('0x2a')]);_0x922eba[_0x83c6('0x2d')]=_[_0x83c6('0x2e')](_0x3b7860[_0x83c6('0x28')],qs[_0x83c6('0x2f')](_0x1535d5[_0x83c6('0x2a')][_0x83c6('0x2f')]));_0x922eba[_0x83c6('0x2d')]=_0x922eba[_0x83c6('0x2d')]['length']?_0x922eba[_0x83c6('0x2d')]:_0x3b7860[_0x83c6('0x28')];if(!_0x1535d5[_0x83c6('0x2a')]['hasOwnProperty'](_0x83c6('0x30'))){_0x922eba[_0x83c6('0x1a')]=qs[_0x83c6('0x1a')](_0x1535d5[_0x83c6('0x2a')]['limit']);_0x922eba['offset']=qs['offset'](_0x1535d5['query'][_0x83c6('0x31')]);}_0x922eba[_0x83c6('0x32')]=qs[_0x83c6('0x33')](_0x1535d5[_0x83c6('0x2a')]['sort']);_0x922eba[_0x83c6('0x34')]=qs[_0x83c6('0x2c')](_['pick'](_0x1535d5['query'],_0x3b7860['filters']),_0x403ebe);if(_0x1535d5[_0x83c6('0x2a')][_0x83c6('0x35')]){_0x922eba['where']=_['merge'](_0x922eba[_0x83c6('0x34')],{'$or':_[_0x83c6('0x29')](_0x403ebe,function(_0x5abffa){if(_0x5abffa['type']!==_0x83c6('0x36')){var _0x570d1f={};_0x570d1f[_0x5abffa['name']]={'$like':'%'+_0x1535d5[_0x83c6('0x2a')][_0x83c6('0x35')]+'%'};return _0x570d1f;}})});}_0x922eba=_[_0x83c6('0x37')]({},_0x922eba,_0x1535d5[_0x83c6('0x38')]);var _0x4f32e9={'where':_0x922eba[_0x83c6('0x34')]};return db[_0x83c6('0x23')][_0x83c6('0x19')](_0x4f32e9)[_0x83c6('0x1e')](function(_0x41eafe){_0xaf65b4[_0x83c6('0x19')]=_0x41eafe;if(_0x1535d5[_0x83c6('0x2a')][_0x83c6('0x39')]){_0x922eba['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x83c6('0x3a')](_0x922eba);})[_0x83c6('0x1e')](function(_0x36dc2d){_0xaf65b4['rows']=_0x36dc2d;return _0xaf65b4;})[_0x83c6('0x1e')](respondWithFilteredResult(_0x2e50ea,_0x922eba))[_0x83c6('0x3b')](handleError(_0x2e50ea,null));};exports[_0x83c6('0x3c')]=function(_0x369f52,_0x4043e6){var _0x764fce={'raw':!![],'where':{'id':_0x369f52[_0x83c6('0x3d')]['id']}},_0x33ecb6={};_0x33ecb6[_0x83c6('0x28')]=_[_0x83c6('0x2b')](db[_0x83c6('0x23')][_0x83c6('0x24')]);_0x33ecb6['query']=_[_0x83c6('0x2b')](_0x369f52[_0x83c6('0x2a')]);_0x33ecb6[_0x83c6('0x2c')]=_['intersection'](_0x33ecb6[_0x83c6('0x28')],_0x33ecb6[_0x83c6('0x2a')]);_0x764fce[_0x83c6('0x2d')]=_[_0x83c6('0x2e')](_0x33ecb6[_0x83c6('0x28')],qs['fields'](_0x369f52['query'][_0x83c6('0x2f')]));_0x764fce[_0x83c6('0x2d')]=_0x764fce['attributes'][_0x83c6('0x3e')]?_0x764fce[_0x83c6('0x2d')]:_0x33ecb6['model'];if(_0x369f52[_0x83c6('0x2a')][_0x83c6('0x39')]){_0x764fce['include']=[{'all':!![]}];}_0x764fce=_[_0x83c6('0x37')]({},_0x764fce,_0x369f52['options']);return db[_0x83c6('0x23')][_0x83c6('0x3f')](_0x764fce)[_0x83c6('0x1e')](handleEntityNotFound(_0x4043e6,null))[_0x83c6('0x1e')](respondWithResult(_0x4043e6,null))[_0x83c6('0x3b')](handleError(_0x4043e6,null));};exports[_0x83c6('0x40')]=function(_0x828ff2,_0x583dc0){return db['CmHopperHistory'][_0x83c6('0x40')](_0x828ff2[_0x83c6('0x41')],{})[_0x83c6('0x1e')](respondWithResult(_0x583dc0,0xc9))[_0x83c6('0x3b')](handleError(_0x583dc0,null));};exports[_0x83c6('0x42')]=function(_0x1e50b5,_0xd100f9){return db[_0x83c6('0x23')][_0x83c6('0x42')]()[_0x83c6('0x1e')](respondWithResult(_0xd100f9,null))[_0x83c6('0x3b')](handleError(_0xd100f9,null));};exports[_0x83c6('0x1d')]=function(_0x3c8a2c,_0x1e04bf){if(_0x3c8a2c['body'][_0x83c6('0x43')]){delete _0x3c8a2c[_0x83c6('0x41')][_0x83c6('0x43')];}return db[_0x83c6('0x23')][_0x83c6('0x3f')]({'where':{'uniqueid':_0x3c8a2c[_0x83c6('0x3d')]['id']}})[_0x83c6('0x1e')](handleEntityNotFound(_0x1e04bf,null))[_0x83c6('0x1e')](saveUpdates(_0x3c8a2c[_0x83c6('0x41')],null))[_0x83c6('0x1e')](respondWithResult(_0x1e04bf,null))[_0x83c6('0x3b')](handleError(_0x1e04bf,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index a617577..5b5b84b 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 _0xdb6e=['endtime','uniqueid','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xdb6e,0x128));var _0xedb6=function(_0x3523cb,_0x511b5c){_0x3523cb=_0x3523cb-0x0;var _0x54efd9=_0xdb6e[_0x3523cb];return _0x54efd9;};'use strict';var _=require(_0xedb6('0x0'));var util=require(_0xedb6('0x1'));var logger=require('../../config/logger')(_0xedb6('0x2'));var moment=require(_0xedb6('0x3'));var BPromise=require('bluebird');var rp=require(_0xedb6('0x4'));var fs=require('fs');var path=require(_0xedb6('0x5'));var rimraf=require(_0xedb6('0x6'));var config=require(_0xedb6('0x7'));var attributes=require(_0xedb6('0x8'));module['exports']=function(_0x4252ff,_0x9bfac4){return _0x4252ff[_0xedb6('0x9')](_0xedb6('0xa'),attributes,{'tableName':_0xedb6('0xb'),'paranoid':![],'indexes':[{'name':_0xedb6('0xc'),'fields':[_0xedb6('0xc')]},{'name':'uniqueid','fields':[_0xedb6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5a12=['rimraf','exports','define','CmHopperHistory','endtime','uniqueid','util','../../config/logger','bluebird'];(function(_0xbb6739,_0x37e0af){var _0x3259a4=function(_0x1ee2eb){while(--_0x1ee2eb){_0xbb6739['push'](_0xbb6739['shift']());}};_0x3259a4(++_0x37e0af);}(_0x5a12,0x138));var _0x25a1=function(_0x2cd888,_0x38c3ea){_0x2cd888=_0x2cd888-0x0;var _0x3b0ee9=_0x5a12[_0x2cd888];return _0x3b0ee9;};'use strict';var _=require('lodash');var util=require(_0x25a1('0x0'));var logger=require(_0x25a1('0x1'))('api');var moment=require('moment');var BPromise=require(_0x25a1('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x25a1('0x3'));var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0x25a1('0x4')]=function(_0x49d8e1,_0x3b1fdd){return _0x49d8e1[_0x25a1('0x5')](_0x25a1('0x6'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x25a1('0x7'),'fields':[_0x25a1('0x7')]},{'name':'uniqueid','fields':[_0x25a1('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 963fd40..56828f5 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 _0x9cf9=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','debug','AvgHandleTime','findAll','where','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','COUNT','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x20556c,_0x5338f4){var _0x512fc5=function(_0x1104fa){while(--_0x1104fa){_0x20556c['push'](_0x20556c['shift']());}};_0x512fc5(++_0x5338f4);}(_0x9cf9,0x87));var _0x99cf=function(_0x5ee603,_0xef4534){_0x5ee603=_0x5ee603-0x0;var _0x3534f7=_0x9cf9[_0x5ee603];return _0x3534f7;};'use strict';var _=require(_0x99cf('0x0'));var util=require(_0x99cf('0x1'));var moment=require('moment');var BPromise=require(_0x99cf('0x2'));var rs=require(_0x99cf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99cf('0x4'))['db'];var utils=require(_0x99cf('0x5'));var logger=require(_0x99cf('0x6'))(_0x99cf('0x7'));var config=require(_0x99cf('0x8'));var jayson=require(_0x99cf('0x9'));var client=jayson[_0x99cf('0xa')][_0x99cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfd03f6,_0x1b480c,_0x492d0b){return new BPromise(function(_0x582842,_0x8789ee){return client[_0x99cf('0xc')](_0xfd03f6,_0x492d0b)[_0x99cf('0xd')](function(_0x17c04e){logger[_0x99cf('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x1b480c,'request\x20sent');logger['debug'](_0x99cf('0xf'),_0x1b480c,_0x99cf('0x10'),JSON[_0x99cf('0x11')](_0x17c04e));if(_0x17c04e[_0x99cf('0x12')]){if(_0x17c04e['error']['code']===0x1f4){logger[_0x99cf('0x12')](_0x99cf('0x13'),_0x1b480c,_0x17c04e[_0x99cf('0x12')][_0x99cf('0x14')]);return _0x8789ee(_0x17c04e[_0x99cf('0x12')][_0x99cf('0x14')]);}logger[_0x99cf('0x12')](_0x99cf('0x13'),_0x1b480c,_0x17c04e[_0x99cf('0x12')][_0x99cf('0x14')]);return _0x582842(_0x17c04e[_0x99cf('0x12')][_0x99cf('0x14')]);}else{logger['info'](_0x99cf('0x13'),_0x1b480c,_0x99cf('0x10'));_0x582842(_0x17c04e[_0x99cf('0x15')][_0x99cf('0x14')]);}})[_0x99cf('0x16')](function(_0x473b1f){logger[_0x99cf('0x12')](_0x99cf('0x13'),_0x1b480c,_0x473b1f);_0x8789ee(_0x473b1f);});});}exports[_0x99cf('0x17')]=function(_0xc698d9){var _0x5bf472=this;return new Promise(function(_0xd31a7b,_0x55a325){return db[_0x99cf('0x18')][_0x99cf('0x19')](_0xc698d9[_0x99cf('0x1a')],{'raw':_0xc698d9[_0x99cf('0x1b')]?_0xc698d9[_0x99cf('0x1b')][_0x99cf('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x561cf8){logger['info'](_0x99cf('0x17'),_0xc698d9);logger[_0x99cf('0x1d')](_0x99cf('0x17'),_0xc698d9,JSON[_0x99cf('0x11')](_0x561cf8));_0xd31a7b(_0x561cf8);})[_0x99cf('0x16')](function(_0x2fae10){logger[_0x99cf('0x12')](_0x99cf('0x17'),_0x2fae10[_0x99cf('0x14')],_0xc698d9);_0x55a325(_0x5bf472['error'](0x1f4,_0x2fae10[_0x99cf('0x14')]));});});};exports[_0x99cf('0x1e')]=function(_0x2a122f){var _0x59365f=this;return new Promise(function(_0x1bff03,_0x2ab8ce){return db[_0x99cf('0x18')][_0x99cf('0x1f')]({'raw':_0x2a122f[_0x99cf('0x1b')]?_0x2a122f[_0x99cf('0x1b')][_0x99cf('0x1c')]===undefined?!![]:![]:!![],'where':_0x2a122f[_0x99cf('0x1b')]?_0x2a122f['options'][_0x99cf('0x20')]||null:null,'attributes':[[db[_0x99cf('0x21')]['fn']('COUNT',db[_0x99cf('0x21')][_0x99cf('0x22')]('id')),_0x99cf('0x23')],[db['sequelize']['fn']('COUNT',db[_0x99cf('0x21')]['fn']('IF',db[_0x99cf('0x21')][_0x99cf('0x24')](_0x99cf('0x25')))),_0x99cf('0x26')],[db['sequelize']['fn'](_0x99cf('0x27'),db[_0x99cf('0x21')]['fn']('IF',db[_0x99cf('0x21')][_0x99cf('0x24')](_0x99cf('0x28')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x99cf('0x21')]['fn'](_0x99cf('0x27'),db['sequelize']['fn']('IF',db['sequelize'][_0x99cf('0x24')](_0x99cf('0x29')))),_0x99cf('0x2a')],[db[_0x99cf('0x21')]['fn'](_0x99cf('0x2b'),db[_0x99cf('0x21')]['fn']('IF',db['sequelize'][_0x99cf('0x24')](_0x99cf('0x2c')))),'predictiveIntervalAvgHoldtime'],[db[_0x99cf('0x21')]['fn'](_0x99cf('0x2b'),db[_0x99cf('0x21')]['fn']('IF',db[_0x99cf('0x21')][_0x99cf('0x24')](_0x99cf('0x2d')))),_0x99cf('0x2e')]]})[_0x99cf('0xd')](function(_0x3c5cfd){logger[_0x99cf('0xe')]('AvgHandleTime',_0x2a122f);logger['debug'](_0x99cf('0x1e'),_0x2a122f,JSON[_0x99cf('0x11')](_0x3c5cfd));_0x1bff03(_0x3c5cfd);})[_0x99cf('0x16')](function(_0x40183e){logger[_0x99cf('0x12')]('AvgHandleTime',_0x40183e[_0x99cf('0x14')],_0x2a122f);_0x2ab8ce(_0x59365f[_0x99cf('0x12')](0x1f4,_0x40183e[_0x99cf('0x14')]));});});};exports[_0x99cf('0x2f')]=function(_0x280a10){var _0x55d477=this;return new Promise(function(_0x36b7cf,_0x4fb8cf){return db[_0x99cf('0x18')][_0x99cf('0x1f')]({'raw':_0x280a10['options']?_0x280a10[_0x99cf('0x1b')][_0x99cf('0x1c')]===undefined?!![]:![]:!![],'where':_0x280a10[_0x99cf('0x1b')]?_0x280a10[_0x99cf('0x1b')]['where']||null:null,'attributes':[[_0x99cf('0x30'),_0x99cf('0x31')],[db['sequelize']['fn'](_0x99cf('0x27'),db[_0x99cf('0x21')]['fn']('IF',db[_0x99cf('0x21')][_0x99cf('0x24')]('`state`\x20=\x200,\x201,\x20null'))),_0x99cf('0x32')],[db[_0x99cf('0x21')]['fn'](_0x99cf('0x27'),db[_0x99cf('0x21')]['fn']('IF',db[_0x99cf('0x21')][_0x99cf('0x24')](_0x99cf('0x33')))),_0x99cf('0x34')],[db[_0x99cf('0x21')]['fn'](_0x99cf('0x27'),db[_0x99cf('0x21')]['fn']('IF',db[_0x99cf('0x21')][_0x99cf('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0x99cf('0x35')],[db[_0x99cf('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x99cf('0x21')]['literal'](_0x99cf('0x36')))),_0x99cf('0x37')],[db[_0x99cf('0x21')]['fn'](_0x99cf('0x27'),db[_0x99cf('0x21')]['fn']('IF',db[_0x99cf('0x21')]['literal'](_0x99cf('0x38')))),_0x99cf('0x39')],[db[_0x99cf('0x21')]['fn'](_0x99cf('0x27'),db[_0x99cf('0x21')]['fn']('IF',db[_0x99cf('0x21')][_0x99cf('0x24')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x99cf('0x3a')],[db[_0x99cf('0x21')]['fn'](_0x99cf('0x27'),db[_0x99cf('0x21')]['fn']('IF',db['sequelize'][_0x99cf('0x24')](_0x99cf('0x3b')))),'outboundDropCallsDayCallersExit'],[db[_0x99cf('0x21')]['fn'](_0x99cf('0x27'),db[_0x99cf('0x21')]['fn']('IF',db[_0x99cf('0x21')]['literal'](_0x99cf('0x3c')))),'outboundUnknownCallsDay'],[db[_0x99cf('0x21')]['fn'](_0x99cf('0x27'),db[_0x99cf('0x21')]['fn']('IF',db[_0x99cf('0x21')][_0x99cf('0x24')](_0x99cf('0x3d')))),_0x99cf('0x3e')],[db[_0x99cf('0x21')]['fn'](_0x99cf('0x27'),db['sequelize']['fn']('IF',db[_0x99cf('0x21')][_0x99cf('0x24')](_0x99cf('0x3f')))),_0x99cf('0x40')],[db['sequelize']['fn']('COUNT',db[_0x99cf('0x21')]['fn']('IF',db[_0x99cf('0x21')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0x99cf('0x41')],[db[_0x99cf('0x21')]['fn'](_0x99cf('0x27'),db[_0x99cf('0x21')]['fn']('IF',db['sequelize'][_0x99cf('0x24')](_0x99cf('0x42')))),_0x99cf('0x43')],[db[_0x99cf('0x21')]['fn'](_0x99cf('0x27'),db[_0x99cf('0x21')]['fn']('IF',db[_0x99cf('0x21')][_0x99cf('0x24')]('`state`\x20=\x2020,\x201,\x20null'))),_0x99cf('0x41')],[db['sequelize']['fn'](_0x99cf('0x27'),db[_0x99cf('0x21')]['fn']('IF',db[_0x99cf('0x21')][_0x99cf('0x24')](_0x99cf('0x44')))),'outboundReCallsDay']],'group':[_0x99cf('0x30')]})[_0x99cf('0xd')](function(_0x3b82c9){logger[_0x99cf('0xe')](_0x99cf('0x2f'),_0x280a10);logger[_0x99cf('0x1d')](_0x99cf('0x2f'),_0x280a10,JSON[_0x99cf('0x11')](_0x3b82c9));_0x36b7cf(_0x3b82c9);})[_0x99cf('0x16')](function(_0x129336){logger[_0x99cf('0x12')](_0x99cf('0x2f'),_0x129336[_0x99cf('0x14')],_0x280a10);_0x4fb8cf(_0x55d477[_0x99cf('0x12')](0x1f4,_0x129336['message']));});});};exports['GetCampaignHopperHistory']=function(_0x627d1b){var _0x27141b=this;return new Promise(function(_0x242afe,_0x1f3d0f){return db[_0x99cf('0x18')]['findAll']({'raw':_0x627d1b[_0x99cf('0x1b')]?_0x627d1b[_0x99cf('0x1b')][_0x99cf('0x1c')]===undefined?!![]:![]:!![],'where':_0x627d1b[_0x99cf('0x1b')]?_0x627d1b[_0x99cf('0x1b')][_0x99cf('0x20')]||null:null,'attributes':[[_0x99cf('0x30'),_0x99cf('0x31')],[db[_0x99cf('0x21')]['fn'](_0x99cf('0x27'),db[_0x99cf('0x21')][_0x99cf('0x22')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn']('COUNT',db[_0x99cf('0x21')]['fn']('IF',db[_0x99cf('0x21')][_0x99cf('0x24')](_0x99cf('0x25')))),'ivrAnswerCallsDay']],'group':['campaign']})[_0x99cf('0xd')](function(_0x4e8f2c){logger[_0x99cf('0xe')](_0x99cf('0x45'),_0x627d1b);logger['debug']('GetCampaignHopperHistory',_0x627d1b,JSON[_0x99cf('0x11')](_0x4e8f2c));_0x242afe(_0x4e8f2c);})['catch'](function(_0x35b0b2){logger['error']('GetCampaignHopperHistory',_0x35b0b2[_0x99cf('0x14')],_0x627d1b);_0x1f3d0f(_0x27141b[_0x99cf('0x12')](0x1f4,_0x35b0b2[_0x99cf('0x14')]));});});}; \ No newline at end of file +var _0x0e73=['`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','findAll','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','CreateCmHopperHistory','CmHopperHistory','create','options','raw','catch','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','name'];(function(_0x3cd5a3,_0x5e9555){var _0x4288be=function(_0x388b01){while(--_0x388b01){_0x3cd5a3['push'](_0x3cd5a3['shift']());}};_0x4288be(++_0x5e9555);}(_0x0e73,0x9e));var _0x30e7=function(_0x2103dd,_0x2cb8f6){_0x2103dd=_0x2103dd-0x0;var _0x457cf6=_0x0e73[_0x2103dd];return _0x457cf6;};'use strict';var _=require(_0x30e7('0x0'));var util=require(_0x30e7('0x1'));var moment=require(_0x30e7('0x2'));var BPromise=require(_0x30e7('0x3'));var rs=require(_0x30e7('0x4'));var fs=require('fs');var Redis=require(_0x30e7('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x30e7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x30e7('0x7'));var client=jayson[_0x30e7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f4269,_0x48449b,_0x4a71aa){return new BPromise(function(_0x2629ea,_0xfe6e9c){return client[_0x30e7('0x9')](_0x4f4269,_0x4a71aa)[_0x30e7('0xa')](function(_0x4fd49e){logger[_0x30e7('0xb')](_0x30e7('0xc'),_0x48449b,'request\x20sent');logger[_0x30e7('0xd')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x48449b,'request\x20sent',JSON[_0x30e7('0xe')](_0x4fd49e));if(_0x4fd49e[_0x30e7('0xf')]){if(_0x4fd49e[_0x30e7('0xf')][_0x30e7('0x10')]===0x1f4){logger[_0x30e7('0xf')](_0x30e7('0xc'),_0x48449b,_0x4fd49e[_0x30e7('0xf')]['message']);return _0xfe6e9c(_0x4fd49e[_0x30e7('0xf')][_0x30e7('0x11')]);}logger[_0x30e7('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x48449b,_0x4fd49e[_0x30e7('0xf')]['message']);return _0x2629ea(_0x4fd49e[_0x30e7('0xf')][_0x30e7('0x11')]);}else{logger[_0x30e7('0xb')](_0x30e7('0xc'),_0x48449b,_0x30e7('0x12'));_0x2629ea(_0x4fd49e[_0x30e7('0x13')][_0x30e7('0x11')]);}})['catch'](function(_0x3af4ff){logger[_0x30e7('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x48449b,_0x3af4ff);_0xfe6e9c(_0x3af4ff);});});}exports[_0x30e7('0x14')]=function(_0x1869fc){var _0x8e3263=this;return new Promise(function(_0x393826,_0x54d00d){return db[_0x30e7('0x15')][_0x30e7('0x16')](_0x1869fc['body'],{'raw':_0x1869fc[_0x30e7('0x17')]?_0x1869fc[_0x30e7('0x17')][_0x30e7('0x18')]===undefined?!![]:![]:!![]})[_0x30e7('0xa')](function(_0x41519d){logger['info'](_0x30e7('0x14'),_0x1869fc);logger[_0x30e7('0xd')](_0x30e7('0x14'),_0x1869fc,JSON[_0x30e7('0xe')](_0x41519d));_0x393826(_0x41519d);})[_0x30e7('0x19')](function(_0x3830ad){logger[_0x30e7('0xf')](_0x30e7('0x14'),_0x3830ad['message'],_0x1869fc);_0x54d00d(_0x8e3263['error'](0x1f4,_0x3830ad[_0x30e7('0x11')]));});});};exports['AvgHandleTime']=function(_0x2720f4){var _0x1ff48e=this;return new Promise(function(_0x23f11a,_0x3cc226){return db[_0x30e7('0x15')]['findAll']({'raw':_0x2720f4[_0x30e7('0x17')]?_0x2720f4[_0x30e7('0x17')][_0x30e7('0x18')]===undefined?!![]:![]:!![],'where':_0x2720f4[_0x30e7('0x17')]?_0x2720f4[_0x30e7('0x17')][_0x30e7('0x1a')]||null:null,'attributes':[[db[_0x30e7('0x1b')]['fn'](_0x30e7('0x1c'),db['sequelize'][_0x30e7('0x1d')]('id')),_0x30e7('0x1e')],[db[_0x30e7('0x1b')]['fn'](_0x30e7('0x1c'),db[_0x30e7('0x1b')]['fn']('IF',db[_0x30e7('0x1b')][_0x30e7('0x1f')](_0x30e7('0x20')))),_0x30e7('0x21')],[db[_0x30e7('0x1b')]['fn'](_0x30e7('0x1c'),db[_0x30e7('0x1b')]['fn']('IF',db['sequelize']['literal'](_0x30e7('0x22')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x30e7('0x1b')]['fn'](_0x30e7('0x1c'),db[_0x30e7('0x1b')]['fn']('IF',db['sequelize'][_0x30e7('0x1f')](_0x30e7('0x23')))),_0x30e7('0x24')],[db[_0x30e7('0x1b')]['fn']('AVG',db[_0x30e7('0x1b')]['fn']('IF',db[_0x30e7('0x1b')][_0x30e7('0x1f')](_0x30e7('0x25')))),_0x30e7('0x26')],[db[_0x30e7('0x1b')]['fn'](_0x30e7('0x27'),db[_0x30e7('0x1b')]['fn']('IF',db['sequelize'][_0x30e7('0x1f')](_0x30e7('0x28')))),_0x30e7('0x29')]]})[_0x30e7('0xa')](function(_0x292598){logger[_0x30e7('0xb')](_0x30e7('0x2a'),_0x2720f4);logger[_0x30e7('0xd')](_0x30e7('0x2a'),_0x2720f4,JSON[_0x30e7('0xe')](_0x292598));_0x23f11a(_0x292598);})[_0x30e7('0x19')](function(_0x2213ce){logger[_0x30e7('0xf')](_0x30e7('0x2a'),_0x2213ce[_0x30e7('0x11')],_0x2720f4);_0x3cc226(_0x1ff48e[_0x30e7('0xf')](0x1f4,_0x2213ce['message']));});});};exports[_0x30e7('0x2b')]=function(_0x109c2e){var _0x5a6440=this;return new Promise(function(_0x377691,_0x5251bc){return db['CmHopperHistory']['findAll']({'raw':_0x109c2e[_0x30e7('0x17')]?_0x109c2e[_0x30e7('0x17')][_0x30e7('0x18')]===undefined?!![]:![]:!![],'where':_0x109c2e['options']?_0x109c2e[_0x30e7('0x17')]['where']||null:null,'attributes':[[_0x30e7('0x2c'),_0x30e7('0x2d')],[db[_0x30e7('0x1b')]['fn'](_0x30e7('0x1c'),db[_0x30e7('0x1b')]['fn']('IF',db[_0x30e7('0x1b')][_0x30e7('0x1f')]('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0x30e7('0x1c'),db[_0x30e7('0x1b')]['fn']('IF',db[_0x30e7('0x1b')][_0x30e7('0x1f')](_0x30e7('0x2e')))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0x30e7('0x1c'),db[_0x30e7('0x1b')]['fn']('IF',db['sequelize'][_0x30e7('0x1f')](_0x30e7('0x20')))),_0x30e7('0x2f')],[db[_0x30e7('0x1b')]['fn'](_0x30e7('0x1c'),db[_0x30e7('0x1b')]['fn']('IF',db[_0x30e7('0x1b')][_0x30e7('0x1f')](_0x30e7('0x30')))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0x30e7('0x1c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x30e7('0x31')))),'outboundCongestionCallsDay'],[db[_0x30e7('0x1b')]['fn'](_0x30e7('0x1c'),db[_0x30e7('0x1b')]['fn']('IF',db[_0x30e7('0x1b')][_0x30e7('0x1f')](_0x30e7('0x32')))),_0x30e7('0x33')],[db['sequelize']['fn'](_0x30e7('0x1c'),db[_0x30e7('0x1b')]['fn']('IF',db[_0x30e7('0x1b')][_0x30e7('0x1f')](_0x30e7('0x34')))),_0x30e7('0x35')],[db[_0x30e7('0x1b')]['fn']('COUNT',db[_0x30e7('0x1b')]['fn']('IF',db['sequelize'][_0x30e7('0x1f')](_0x30e7('0x36')))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0x30e7('0x1c'),db['sequelize']['fn']('IF',db[_0x30e7('0x1b')]['literal']('`state`\x20=\x2013,\x201,\x20null'))),_0x30e7('0x37')],[db[_0x30e7('0x1b')]['fn'](_0x30e7('0x1c'),db[_0x30e7('0x1b')]['fn']('IF',db['sequelize'][_0x30e7('0x1f')](_0x30e7('0x38')))),_0x30e7('0x39')],[db[_0x30e7('0x1b')]['fn'](_0x30e7('0x1c'),db[_0x30e7('0x1b')]['fn']('IF',db[_0x30e7('0x1b')][_0x30e7('0x1f')](_0x30e7('0x3a')))),_0x30e7('0x3b')],[db[_0x30e7('0x1b')]['fn'](_0x30e7('0x1c'),db[_0x30e7('0x1b')]['fn']('IF',db[_0x30e7('0x1b')][_0x30e7('0x1f')](_0x30e7('0x3c')))),_0x30e7('0x3d')],[db[_0x30e7('0x1b')]['fn'](_0x30e7('0x1c'),db[_0x30e7('0x1b')]['fn']('IF',db['sequelize'][_0x30e7('0x1f')]('`state`\x20=\x2020,\x201,\x20null'))),_0x30e7('0x3b')],[db[_0x30e7('0x1b')]['fn'](_0x30e7('0x1c'),db[_0x30e7('0x1b')]['fn']('IF',db[_0x30e7('0x1b')][_0x30e7('0x1f')](_0x30e7('0x3e')))),_0x30e7('0x3f')]],'group':[_0x30e7('0x2c')]})[_0x30e7('0xa')](function(_0x3f2b69){logger['info'](_0x30e7('0x2b'),_0x109c2e);logger[_0x30e7('0xd')](_0x30e7('0x2b'),_0x109c2e,JSON['stringify'](_0x3f2b69));_0x377691(_0x3f2b69);})[_0x30e7('0x19')](function(_0x1a7179){logger['error'](_0x30e7('0x2b'),_0x1a7179[_0x30e7('0x11')],_0x109c2e);_0x5251bc(_0x5a6440[_0x30e7('0xf')](0x1f4,_0x1a7179['message']));});});};exports['GetCampaignHopperHistory']=function(_0xa03ddd){var _0x2a4d2e=this;return new Promise(function(_0x5d6e0e,_0x7ec01f){return db[_0x30e7('0x15')][_0x30e7('0x40')]({'raw':_0xa03ddd[_0x30e7('0x17')]?_0xa03ddd[_0x30e7('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xa03ddd[_0x30e7('0x17')]?_0xa03ddd[_0x30e7('0x17')][_0x30e7('0x1a')]||null:null,'attributes':[[_0x30e7('0x2c'),_0x30e7('0x2d')],[db[_0x30e7('0x1b')]['fn'](_0x30e7('0x1c'),db[_0x30e7('0x1b')]['col']('id')),_0x30e7('0x41')],[db['sequelize']['fn'](_0x30e7('0x1c'),db[_0x30e7('0x1b')]['fn']('IF',db[_0x30e7('0x1b')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x30e7('0x42')]],'group':['campaign']})['then'](function(_0x128508){logger['info'](_0x30e7('0x43'),_0xa03ddd);logger[_0x30e7('0xd')]('GetCampaignHopperHistory',_0xa03ddd,JSON[_0x30e7('0xe')](_0x128508));_0x5d6e0e(_0x128508);})['catch'](function(_0x55a059){logger[_0x30e7('0xf')](_0x30e7('0x43'),_0x55a059[_0x30e7('0x11')],_0xa03ddd);_0x7ec01f(_0x2a4d2e[_0x30e7('0xf')](0x1f4,_0x55a059[_0x30e7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index a427c86..eae4a8e 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 _0xaaf5=['isAuthenticated','index','describe','/:id','show','create','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x3a9f5b,_0xec3068){var _0x346c36=function(_0x58ee43){while(--_0x58ee43){_0x3a9f5b['push'](_0x3a9f5b['shift']());}};_0x346c36(++_0xec3068);}(_0xaaf5,0x14d));var _0x5aaf=function(_0xe946de,_0x2e81f4){_0xe946de=_0xe946de-0x0;var _0x27dc2f=_0xaaf5[_0xe946de];return _0x27dc2f;};'use strict';var multer=require(_0x5aaf('0x0'));var util=require(_0x5aaf('0x1'));var path=require(_0x5aaf('0x2'));var timeout=require(_0x5aaf('0x3'));var express=require(_0x5aaf('0x4'));var router=express[_0x5aaf('0x5')]();var auth=require(_0x5aaf('0x6'));var interaction=require(_0x5aaf('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0x5aaf('0x8')]('/',auth[_0x5aaf('0x9')](),controller[_0x5aaf('0xa')]);router[_0x5aaf('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x5aaf('0xb')]);router[_0x5aaf('0x8')](_0x5aaf('0xc'),auth[_0x5aaf('0x9')](),controller[_0x5aaf('0xd')]);router['post']('/',auth[_0x5aaf('0x9')](),controller[_0x5aaf('0xe')]);router[_0x5aaf('0xf')](_0x5aaf('0xc'),auth['isAuthenticated'](),controller[_0x5aaf('0x10')]);module[_0x5aaf('0x11')]=router; \ No newline at end of file +var _0x1e2f=['/describe','describe','show','post','create','put','/:id','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated'];(function(_0x395b58,_0x23518d){var _0x43c80a=function(_0x4f5687){while(--_0x4f5687){_0x395b58['push'](_0x395b58['shift']());}};_0x43c80a(++_0x23518d);}(_0x1e2f,0x1ee));var _0xf1e2=function(_0x53709b,_0x110418){_0x53709b=_0x53709b-0x0;var _0x29df85=_0x1e2f[_0x53709b];return _0x29df85;};'use strict';var multer=require(_0xf1e2('0x0'));var util=require(_0xf1e2('0x1'));var path=require(_0xf1e2('0x2'));var timeout=require(_0xf1e2('0x3'));var express=require(_0xf1e2('0x4'));var router=express[_0xf1e2('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf1e2('0x6'));var controller=require(_0xf1e2('0x7'));router[_0xf1e2('0x8')]('/',auth[_0xf1e2('0x9')](),controller['index']);router[_0xf1e2('0x8')](_0xf1e2('0xa'),auth[_0xf1e2('0x9')](),controller[_0xf1e2('0xb')]);router['get']('/:id',auth[_0xf1e2('0x9')](),controller[_0xf1e2('0xc')]);router[_0xf1e2('0xd')]('/',auth[_0xf1e2('0x9')](),controller[_0xf1e2('0xe')]);router[_0xf1e2('0xf')](_0xf1e2('0x10'),auth['isAuthenticated'](),controller['update']);module[_0xf1e2('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 0d731bf..e753405 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 _0x6dbe=['exports','STRING','name','sequelize'];(function(_0x57d16f,_0x56cb81){var _0x1ac1f2=function(_0x3a4c53){while(--_0x3a4c53){_0x57d16f['push'](_0x57d16f['shift']());}};_0x1ac1f2(++_0x56cb81);}(_0x6dbe,0x1c3));var _0xe6db=function(_0x2812db,_0x2cc1af){_0x2812db=_0x2812db-0x0;var _0x482822=_0x6dbe[_0x2812db];return _0x482822;};'use strict';var Sequelize=require(_0xe6db('0x0'));module[_0xe6db('0x1')]={'name':{'type':Sequelize[_0xe6db('0x2')],'unique':_0xe6db('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe6db('0x2')]},'dialPrefix':{'type':Sequelize[_0xe6db('0x2')]}}; \ No newline at end of file +var _0x209d=['name','STRING','sequelize'];(function(_0x4119d5,_0x35227f){var _0x4ff581=function(_0x11772e){while(--_0x11772e){_0x4119d5['push'](_0x4119d5['shift']());}};_0x4ff581(++_0x35227f);}(_0x209d,0xe6));var _0xd209=function(_0x33b341,_0x2d3eda){_0x33b341=_0x33b341-0x0;var _0x3c0630=_0x209d[_0x33b341];return _0x3c0630;};'use strict';var Sequelize=require(_0xd209('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xd209('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd209('0x2')]},'dialPrefix':{'type':Sequelize[_0xd209('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 0e9c3d0..30b13df 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(_0x32d989,_0x4244ca){var _0x34dd3=function(_0x27194f){while(--_0x27194f){_0x32d989['push'](_0x32d989['shift']());}};_0x34dd3(++_0x4244ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x3aab06,_0x5d93e8){var _0x5727af=function(_0x541563){while(--_0x541563){_0x3aab06['push'](_0x3aab06['shift']());}};_0x5727af(++_0x5d93e8);}(_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'];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 d66a87c..4415eb3 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 _0xb76a=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','CmList','setMaxListeners'];(function(_0x410341,_0x4cd4b2){var _0x4d23d2=function(_0x1b66a3){while(--_0x1b66a3){_0x410341['push'](_0x410341['shift']());}};_0x4d23d2(++_0x4cd4b2);}(_0xb76a,0xf8));var _0xab76=function(_0x3a6abb,_0x5ba0a9){_0x3a6abb=_0x3a6abb-0x0;var _0x195949=_0xb76a[_0x3a6abb];return _0x195949;};'use strict';var EventEmitter=require(_0xab76('0x0'));var CmList=require(_0xab76('0x1'))['db'][_0xab76('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xab76('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xab76('0x4'),'afterDestroy':_0xab76('0x5')};function emitEvent(_0x289f9e){return function(_0x4358de,_0x237abb,_0x5c687e){CmListEvents['emit'](_0x289f9e+':'+_0x4358de['id'],_0x4358de);CmListEvents[_0xab76('0x6')](_0x289f9e,_0x4358de);_0x5c687e(null);};}for(var e in events){if(events[_0xab76('0x7')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0xab76('0x8')]=CmListEvents; \ No newline at end of file +var _0x6245=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x4a0b4f,_0x56ca2d){var _0x390d54=function(_0x3dca2e){while(--_0x3dca2e){_0x4a0b4f['push'](_0x4a0b4f['shift']());}};_0x390d54(++_0x56ca2d);}(_0x6245,0x10c));var _0x5624=function(_0x6b6340,_0x6302c4){_0x6b6340=_0x6b6340-0x0;var _0x3609bf=_0x6245[_0x6b6340];return _0x3609bf;};'use strict';var EventEmitter=require(_0x5624('0x0'));var CmList=require(_0x5624('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x5624('0x2')](0x0);var events={'afterCreate':_0x5624('0x3'),'afterUpdate':_0x5624('0x4'),'afterDestroy':_0x5624('0x5')};function emitEvent(_0x17fbce){return function(_0x271095,_0x84214d,_0x11ff59){CmListEvents[_0x5624('0x6')](_0x17fbce+':'+_0x271095['id'],_0x271095);CmListEvents['emit'](_0x17fbce,_0x271095);_0x11ff59(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x5624('0x7')](e,emitEvent(event));}}module[_0x5624('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index b9db091..71acab0 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 _0xd817=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','CmList','cm_lists'];(function(_0x587d32,_0x45a0c5){var _0x5552f8=function(_0x5f2ff2){while(--_0x5f2ff2){_0x587d32['push'](_0x587d32['shift']());}};_0x5552f8(++_0x45a0c5);}(_0xd817,0xc0));var _0x7d81=function(_0x396e83,_0x2d51e2){_0x396e83=_0x396e83-0x0;var _0x4a42cc=_0xd817[_0x396e83];return _0x4a42cc;};'use strict';var _=require(_0x7d81('0x0'));var util=require(_0x7d81('0x1'));var logger=require(_0x7d81('0x2'))(_0x7d81('0x3'));var moment=require(_0x7d81('0x4'));var BPromise=require(_0x7d81('0x5'));var rp=require(_0x7d81('0x6'));var fs=require('fs');var path=require(_0x7d81('0x7'));var rimraf=require('rimraf');var config=require(_0x7d81('0x8'));var attributes=require('./cmList.attributes');module[_0x7d81('0x9')]=function(_0x3d284f,_0x45942b){return _0x3d284f['define'](_0x7d81('0xa'),attributes,{'tableName':_0x7d81('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc780=['lodash','util','../../config/logger','api','request-promise','path','rimraf','./cmList.attributes','CmList'];(function(_0x2b440d,_0x589937){var _0x1b01fc=function(_0x46047f){while(--_0x46047f){_0x2b440d['push'](_0x2b440d['shift']());}};_0x1b01fc(++_0x589937);}(_0xc780,0x99));var _0x0c78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc780[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0c78('0x0'));var util=require(_0x0c78('0x1'));var logger=require(_0x0c78('0x2'))(_0x0c78('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0c78('0x4'));var fs=require('fs');var path=require(_0x0c78('0x5'));var rimraf=require(_0x0c78('0x6'));var config=require('../../config/environment');var attributes=require(_0x0c78('0x7'));module['exports']=function(_0x31ad86,_0x473659){return _0x31ad86['define'](_0x0c78('0x8'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index ff7a30b..262329d 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 _0x5e34=['../../config/environment','http','redis','defaults','socket.io-emitter','./cmList.socket','register','then','info','request\x20sent','stringify','error','code','CmList,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x16fb6f,_0xf5a039){var _0x50062f=function(_0x228017){while(--_0x228017){_0x16fb6f['push'](_0x16fb6f['shift']());}};_0x50062f(++_0xf5a039);}(_0x5e34,0x148));var _0x45e3=function(_0x109d9b,_0x1fe96a){_0x109d9b=_0x109d9b-0x0;var _0x2bb8f4=_0x5e34[_0x109d9b];return _0x2bb8f4;};'use strict';var _=require(_0x45e3('0x0'));var util=require('util');var moment=require(_0x45e3('0x1'));var BPromise=require(_0x45e3('0x2'));var rs=require(_0x45e3('0x3'));var fs=require('fs');var Redis=require(_0x45e3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x45e3('0x5'));var logger=require(_0x45e3('0x6'))(_0x45e3('0x7'));var config=require(_0x45e3('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x45e3('0x9')]({'port':0x232a});config[_0x45e3('0xa')]=_[_0x45e3('0xb')](config[_0x45e3('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x45e3('0xc'))(new Redis(config[_0x45e3('0xa')]));require(_0x45e3('0xd'))[_0x45e3('0xe')](socket);function respondWithRpcPromise(_0x195eaa,_0x3d153a,_0x7bfcac){return new BPromise(function(_0x196e1a,_0x42a848){return client['request'](_0x195eaa,_0x7bfcac)[_0x45e3('0xf')](function(_0x2ad890){logger[_0x45e3('0x10')]('CmList,\x20%s,\x20%s',_0x3d153a,_0x45e3('0x11'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x3d153a,'request\x20sent',JSON[_0x45e3('0x12')](_0x2ad890));if(_0x2ad890[_0x45e3('0x13')]){if(_0x2ad890[_0x45e3('0x13')][_0x45e3('0x14')]===0x1f4){logger['error'](_0x45e3('0x15'),_0x3d153a,_0x2ad890[_0x45e3('0x13')][_0x45e3('0x16')]);return _0x42a848(_0x2ad890[_0x45e3('0x13')][_0x45e3('0x16')]);}logger[_0x45e3('0x13')]('CmList,\x20%s,\x20%s',_0x3d153a,_0x2ad890['error'][_0x45e3('0x16')]);return _0x196e1a(_0x2ad890[_0x45e3('0x13')]['message']);}else{logger[_0x45e3('0x10')](_0x45e3('0x15'),_0x3d153a,_0x45e3('0x11'));_0x196e1a(_0x2ad890[_0x45e3('0x17')][_0x45e3('0x16')]);}})['catch'](function(_0x3499ef){logger['error']('CmList,\x20%s,\x20%s',_0x3d153a,_0x3499ef);_0x42a848(_0x3499ef);});});} \ No newline at end of file +var _0x8b0f=['request\x20sent','debug','error','code','CmList,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','request','then'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x8b0f,0x1bc));var _0xf8b0=function(_0x552314,_0x5c1ee6){_0x552314=_0x552314-0x0;var _0x45bd58=_0x8b0f[_0x552314];return _0x45bd58;};'use strict';var _=require(_0xf8b0('0x0'));var util=require(_0xf8b0('0x1'));var moment=require(_0xf8b0('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8b0('0x3'));var fs=require('fs');var Redis=require(_0xf8b0('0x4'));var db=require(_0xf8b0('0x5'))['db'];var utils=require(_0xf8b0('0x6'));var logger=require(_0xf8b0('0x7'))(_0xf8b0('0x8'));var config=require(_0xf8b0('0x9'));var jayson=require(_0xf8b0('0xa'));var client=jayson[_0xf8b0('0xb')][_0xf8b0('0xc')]({'port':0x232a});config[_0xf8b0('0xd')]=_[_0xf8b0('0xe')](config[_0xf8b0('0xd')],{'host':_0xf8b0('0xf'),'port':0x18eb});var socket=require(_0xf8b0('0x10'))(new Redis(config['redis']));require(_0xf8b0('0x11'))['register'](socket);function respondWithRpcPromise(_0x50885e,_0x2df7ae,_0x484111){return new BPromise(function(_0x10f4a5,_0x33f666){return client[_0xf8b0('0x12')](_0x50885e,_0x484111)[_0xf8b0('0x13')](function(_0xdd090c){logger['info']('CmList,\x20%s,\x20%s',_0x2df7ae,_0xf8b0('0x14'));logger[_0xf8b0('0x15')]('CmList,\x20%s,\x20%s,\x20%s',_0x2df7ae,_0xf8b0('0x14'),JSON['stringify'](_0xdd090c));if(_0xdd090c[_0xf8b0('0x16')]){if(_0xdd090c[_0xf8b0('0x16')][_0xf8b0('0x17')]===0x1f4){logger[_0xf8b0('0x16')](_0xf8b0('0x18'),_0x2df7ae,_0xdd090c['error'][_0xf8b0('0x19')]);return _0x33f666(_0xdd090c['error'][_0xf8b0('0x19')]);}logger[_0xf8b0('0x16')]('CmList,\x20%s,\x20%s',_0x2df7ae,_0xdd090c['error'][_0xf8b0('0x19')]);return _0x10f4a5(_0xdd090c['error'][_0xf8b0('0x19')]);}else{logger[_0xf8b0('0x1a')](_0xf8b0('0x18'),_0x2df7ae,_0xf8b0('0x14'));_0x10f4a5(_0xdd090c[_0xf8b0('0x1b')][_0xf8b0('0x19')]);}})[_0xf8b0('0x1c')](function(_0x1dda9){logger[_0xf8b0('0x16')](_0xf8b0('0x18'),_0x2df7ae,_0x1dda9);_0x33f666(_0x1dda9);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 9444e6e..2164bbf 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 _0x815b=['./cmList.events','save','remove','update','removeListener','register'];(function(_0x4d4c4b,_0x21a222){var _0x358af4=function(_0x507754){while(--_0x507754){_0x4d4c4b['push'](_0x4d4c4b['shift']());}};_0x358af4(++_0x21a222);}(_0x815b,0xb4));var _0xb815=function(_0xa5ae2,_0x95b340){_0xa5ae2=_0xa5ae2-0x0;var _0x5a6416=_0x815b[_0xa5ae2];return _0x5a6416;};'use strict';var CmListEvents=require(_0xb815('0x0'));var events=[_0xb815('0x1'),_0xb815('0x2'),_0xb815('0x3')];function createListener(_0x6314c,_0x592cd5){return function(_0x1e70fa){_0x592cd5['emit'](_0x6314c,_0x1e70fa);};}function removeListener(_0x5b4516,_0x16c25e){return function(){CmListEvents[_0xb815('0x4')](_0x5b4516,_0x16c25e);};}exports[_0xb815('0x5')]=function(_0x5a5c18){for(var _0x466899=0x0,_0x3f7a40=events['length'];_0x466899<_0x3f7a40;_0x466899++){var _0xeba45d=events[_0x466899];var _0x479b09=createListener('cmList:'+_0xeba45d,_0x5a5c18);CmListEvents['on'](_0xeba45d,_0x479b09);}}; \ No newline at end of file +var _0x0e76=['emit','register','length','cmList:','./cmList.events','update'];(function(_0x2c534a,_0x18a19e){var _0x3f5c99=function(_0x4c085f){while(--_0x4c085f){_0x2c534a['push'](_0x2c534a['shift']());}};_0x3f5c99(++_0x18a19e);}(_0x0e76,0xc4));var _0x60e7=function(_0x5bacf1,_0x5bae9a){_0x5bacf1=_0x5bacf1-0x0;var _0x4b65d3=_0x0e76[_0x5bacf1];return _0x4b65d3;};'use strict';var CmListEvents=require(_0x60e7('0x0'));var events=['save','remove',_0x60e7('0x1')];function createListener(_0x4d71bb,_0x21402c){return function(_0x6f8f6e){_0x21402c[_0x60e7('0x2')](_0x4d71bb,_0x6f8f6e);};}function removeListener(_0xd3886,_0x2f1ad1){return function(){CmListEvents['removeListener'](_0xd3886,_0x2f1ad1);};}exports[_0x60e7('0x3')]=function(_0x35b628){for(var _0x1fb45c=0x0,_0xba29ef=events[_0x60e7('0x4')];_0x1fb45c<_0xba29ef;_0x1fb45c++){var _0x194535=events[_0x1fb45c];var _0x4a15f2=createListener(_0x60e7('0x5')+_0x194535,_0x35b628);CmListEvents['on'](_0x194535,_0x4a15f2);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 9ece04f..06f1708 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 023c215..87e9b50 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(_0x146c9c,_0x49116b){var _0x34abf5=function(_0x3e077c){while(--_0x3e077c){_0x146c9c['push'](_0x146c9c['shift']());}};_0x34abf5(++_0x49116b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x1cde6d,_0x52b8ba){var _0xe4e1a5=function(_0x4f7561){while(--_0x4f7561){_0x1cde6d['push'](_0x1cde6d['shift']());}};_0xe4e1a5(++_0x52b8ba);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index e9b0225..7e0830d 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 _0x0e37=['Content-Range','reject','save','update','destroy','then','sendStatus','stack','name','send','body','Condition','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','limit','set'];(function(_0x19cad9,_0x185d21){var _0x169d40=function(_0x550282){while(--_0x550282){_0x19cad9['push'](_0x19cad9['shift']());}};_0x169d40(++_0x185d21);}(_0x0e37,0x11c));var _0x70e3=function(_0x43fb6a,_0x44cb86){_0x43fb6a=_0x43fb6a-0x0;var _0x28cb41=_0x0e37[_0x43fb6a];return _0x28cb41;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x70e3('0x0'));var rimraf=require(_0x70e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x70e3('0x2'));var rp=require(_0x70e3('0x3'));var moment=require(_0x70e3('0x4'));var BPromise=require(_0x70e3('0x5'));var Mustache=require(_0x70e3('0x6'));var util=require(_0x70e3('0x7'));var path=require(_0x70e3('0x8'));var sox=require(_0x70e3('0x9'));var csv=require(_0x70e3('0xa'));var ejs=require(_0x70e3('0xb'));var fs=require('fs');var _=require(_0x70e3('0xc'));var squel=require(_0x70e3('0xd'));var crypto=require(_0x70e3('0xe'));var jsforce=require(_0x70e3('0xf'));var deskjs=require(_0x70e3('0x10'));var toCsv=require(_0x70e3('0xa'));var querystring=require('querystring');var Papa=require(_0x70e3('0x11'));var Redis=require(_0x70e3('0x12'));var authService=require(_0x70e3('0x13'));var qs=require(_0x70e3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x70e3('0x15'));var logger=require(_0x70e3('0x16'))(_0x70e3('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x70e3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16a81a,_0x51e8e5){_0x51e8e5=_0x51e8e5||0xcc;return function(_0x3631fd){if(_0x3631fd){return _0x16a81a['sendStatus'](_0x51e8e5);}return _0x16a81a[_0x70e3('0x19')](_0x51e8e5)[_0x70e3('0x1a')]();};}function respondWithResult(_0xac1555,_0x336aaf){_0x336aaf=_0x336aaf||0xc8;return function(_0xe14d32){if(_0xe14d32){return _0xac1555[_0x70e3('0x19')](_0x336aaf)[_0x70e3('0x1b')](_0xe14d32);}};}function respondWithFilteredResult(_0x4c0902,_0x1e6740){return function(_0x3af599){if(_0x3af599){var _0x27747a=_0x3af599['count'],_0x499bad=_0x1e6740[_0x70e3('0x1c')],_0x283e76=_0x1e6740['offset']+_0x1e6740[_0x70e3('0x1d')],_0x4d8a87;if(_0x283e76>=_0x27747a){_0x283e76=_0x27747a;_0x4d8a87=0xc8;}else{_0x4d8a87=0xce;}_0x4c0902[_0x70e3('0x19')](_0x4d8a87);return _0x4c0902[_0x70e3('0x1e')](_0x70e3('0x1f'),_0x499bad+'-'+_0x283e76+'/'+_0x27747a)[_0x70e3('0x1b')](_0x3af599);}return null;};}function patchUpdates(_0x48ff54){return function(_0x1da21b){try{jsonpatch['apply'](_0x1da21b,_0x48ff54,!![]);}catch(_0x4099eb){return BPromise[_0x70e3('0x20')](_0x4099eb);}return _0x1da21b[_0x70e3('0x21')]();};}function saveUpdates(_0x1fe67f,_0x17449a){return function(_0x2ff9cf){if(_0x2ff9cf){return _0x2ff9cf[_0x70e3('0x22')](_0x1fe67f)['then'](function(_0x2a2f00){return _0x2a2f00;});}return null;};}function removeEntity(_0x57d2c1,_0x289c56){return function(_0x552cf){if(_0x552cf){return _0x552cf[_0x70e3('0x23')]()[_0x70e3('0x24')](function(){_0x57d2c1[_0x70e3('0x19')](0xcc)[_0x70e3('0x1a')]();});}};}function handleEntityNotFound(_0x13dc87,_0x571c58){return function(_0x5c80e9){if(!_0x5c80e9){_0x13dc87[_0x70e3('0x25')](0x194);}return _0x5c80e9;};}function handleError(_0x5b5d47,_0x1f9120){_0x1f9120=_0x1f9120||0x1f4;return function(_0xe043f4){logger['error'](_0xe043f4[_0x70e3('0x26')]);if(_0xe043f4[_0x70e3('0x27')]){delete _0xe043f4[_0x70e3('0x27')];}_0x5b5d47[_0x70e3('0x19')](_0x1f9120)[_0x70e3('0x28')](_0xe043f4);};}exports[_0x70e3('0x22')]=function(_0xe3a50c,_0x5af0b6){if(_0xe3a50c[_0x70e3('0x29')]['id']){delete _0xe3a50c[_0x70e3('0x29')]['id'];}return db[_0x70e3('0x2a')][_0x70e3('0x2b')]({'where':{'id':_0xe3a50c[_0x70e3('0x2c')]['id']}})[_0x70e3('0x24')](handleEntityNotFound(_0x5af0b6,null))['then'](saveUpdates(_0xe3a50c[_0x70e3('0x29')],null))[_0x70e3('0x24')](respondWithResult(_0x5af0b6,null))['catch'](handleError(_0x5af0b6,null));};exports[_0x70e3('0x23')]=function(_0x309310,_0x37f987){return db[_0x70e3('0x2a')][_0x70e3('0x2b')]({'where':{'id':_0x309310[_0x70e3('0x2c')]['id']}})[_0x70e3('0x24')](handleEntityNotFound(_0x37f987,null))[_0x70e3('0x24')](removeEntity(_0x37f987,null))['catch'](handleError(_0x37f987,null));}; \ No newline at end of file +var _0x887e=['status','count','offset','limit','Content-Range','json','apply','then','name','send','body','params','catch','destroy','Condition','find','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end'];(function(_0x390d4b,_0x30adf8){var _0x2ca333=function(_0x3d5af5){while(--_0x3d5af5){_0x390d4b['push'](_0x390d4b['shift']());}};_0x2ca333(++_0x30adf8);}(_0x887e,0x88));var _0xe887=function(_0x4d440e,_0x392fd5){_0x4d440e=_0x4d440e-0x0;var _0x4e43e9=_0x887e[_0x4d440e];return _0x4e43e9;};'use strict';var pdf=require(_0xe887('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe887('0x1'));var zipdir=require(_0xe887('0x2'));var jsonpatch=require(_0xe887('0x3'));var rp=require('request-promise');var moment=require(_0xe887('0x4'));var BPromise=require(_0xe887('0x5'));var Mustache=require(_0xe887('0x6'));var util=require('util');var path=require('path');var sox=require(_0xe887('0x7'));var csv=require(_0xe887('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe887('0x9'));var squel=require(_0xe887('0xa'));var crypto=require(_0xe887('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe887('0xc'));var toCsv=require(_0xe887('0x8'));var querystring=require(_0xe887('0xd'));var Papa=require(_0xe887('0xe'));var Redis=require(_0xe887('0xf'));var authService=require(_0xe887('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe887('0x11'));var hardwareService=require(_0xe887('0x12'));var logger=require(_0xe887('0x13'))('api');var utils=require(_0xe887('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe887('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x554545,_0x4ba04e){_0x4ba04e=_0x4ba04e||0xcc;return function(_0x1e6f34){if(_0x1e6f34){return _0x554545[_0xe887('0x16')](_0x4ba04e);}return _0x554545['status'](_0x4ba04e)[_0xe887('0x17')]();};}function respondWithResult(_0x3e63c4,_0x80654d){_0x80654d=_0x80654d||0xc8;return function(_0x329b){if(_0x329b){return _0x3e63c4[_0xe887('0x18')](_0x80654d)['json'](_0x329b);}};}function respondWithFilteredResult(_0x1c9fcc,_0x2d6b43){return function(_0x1679ec){if(_0x1679ec){var _0x1e8cad=_0x1679ec[_0xe887('0x19')],_0xe1a0db=_0x2d6b43[_0xe887('0x1a')],_0x5f2690=_0x2d6b43[_0xe887('0x1a')]+_0x2d6b43[_0xe887('0x1b')],_0x39902d;if(_0x5f2690>=_0x1e8cad){_0x5f2690=_0x1e8cad;_0x39902d=0xc8;}else{_0x39902d=0xce;}_0x1c9fcc[_0xe887('0x18')](_0x39902d);return _0x1c9fcc['set'](_0xe887('0x1c'),_0xe1a0db+'-'+_0x5f2690+'/'+_0x1e8cad)[_0xe887('0x1d')](_0x1679ec);}return null;};}function patchUpdates(_0x5a46d2){return function(_0x5f45a8){try{jsonpatch[_0xe887('0x1e')](_0x5f45a8,_0x5a46d2,!![]);}catch(_0x4ddfee){return BPromise['reject'](_0x4ddfee);}return _0x5f45a8['save']();};}function saveUpdates(_0x2e00f2,_0x206640){return function(_0x4a92d5){if(_0x4a92d5){return _0x4a92d5['update'](_0x2e00f2)['then'](function(_0x2af923){return _0x2af923;});}return null;};}function removeEntity(_0x2747f4,_0x2ec019){return function(_0x1d02e4){if(_0x1d02e4){return _0x1d02e4['destroy']()[_0xe887('0x1f')](function(){_0x2747f4[_0xe887('0x18')](0xcc)[_0xe887('0x17')]();});}};}function handleEntityNotFound(_0x6548d2,_0x187696){return function(_0x4a78a9){if(!_0x4a78a9){_0x6548d2[_0xe887('0x16')](0x194);}return _0x4a78a9;};}function handleError(_0xc99ed8,_0x529cc3){_0x529cc3=_0x529cc3||0x1f4;return function(_0x4fe858){logger['error'](_0x4fe858['stack']);if(_0x4fe858[_0xe887('0x20')]){delete _0x4fe858[_0xe887('0x20')];}_0xc99ed8[_0xe887('0x18')](_0x529cc3)[_0xe887('0x21')](_0x4fe858);};}exports['update']=function(_0x2b1aac,_0x2b8c56){if(_0x2b1aac[_0xe887('0x22')]['id']){delete _0x2b1aac['body']['id'];}return db['Condition']['find']({'where':{'id':_0x2b1aac[_0xe887('0x23')]['id']}})[_0xe887('0x1f')](handleEntityNotFound(_0x2b8c56,null))[_0xe887('0x1f')](saveUpdates(_0x2b1aac['body'],null))[_0xe887('0x1f')](respondWithResult(_0x2b8c56,null))[_0xe887('0x24')](handleError(_0x2b8c56,null));};exports[_0xe887('0x25')]=function(_0x595f96,_0x2c1e50){return db[_0xe887('0x26')][_0xe887('0x27')]({'where':{'id':_0x595f96['params']['id']}})[_0xe887('0x1f')](handleEntityNotFound(_0x2c1e50,null))[_0xe887('0x1f')](removeEntity(_0x2c1e50,null))[_0xe887('0x24')](handleError(_0x2c1e50,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index c63a484..35a4ab6 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 _0xba37=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions'];(function(_0x175fe2,_0x29108f){var _0x561a8a=function(_0x1cf82c){while(--_0x1cf82c){_0x175fe2['push'](_0x175fe2['shift']());}};_0x561a8a(++_0x29108f);}(_0xba37,0x68));var _0x7ba3=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xba37[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x7ba3('0x0'));var util=require('util');var logger=require(_0x7ba3('0x1'))(_0x7ba3('0x2'));var moment=require(_0x7ba3('0x3'));var BPromise=require(_0x7ba3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ba3('0x5'));var rimraf=require(_0x7ba3('0x6'));var config=require(_0x7ba3('0x7'));var attributes=require(_0x7ba3('0x8'));module[_0x7ba3('0x9')]=function(_0x2b9e49,_0x192098){return _0x2b9e49[_0x7ba3('0xa')](_0x7ba3('0xb'),attributes,{'tableName':_0x7ba3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x108e=['api','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','util'];(function(_0x2f43c6,_0x1d3d61){var _0x217ba4=function(_0x3e3a13){while(--_0x3e3a13){_0x2f43c6['push'](_0x2f43c6['shift']());}};_0x217ba4(++_0x1d3d61);}(_0x108e,0xb3));var _0xe108=function(_0x14a36e,_0x4ac086){_0x14a36e=_0x14a36e-0x0;var _0x25eedb=_0x108e[_0x14a36e];return _0x25eedb;};'use strict';var _=require('lodash');var util=require(_0xe108('0x0'));var logger=require('../../config/logger')(_0xe108('0x1'));var moment=require('moment');var BPromise=require(_0xe108('0x2'));var rp=require(_0xe108('0x3'));var fs=require('fs');var path=require(_0xe108('0x4'));var rimraf=require(_0xe108('0x5'));var config=require(_0xe108('0x6'));var attributes=require(_0xe108('0x7'));module[_0xe108('0x8')]=function(_0x355e84,_0x3e8648){return _0x355e84[_0xe108('0x9')](_0xe108('0xa'),attributes,{'tableName':_0xe108('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 88de229..4e6182b 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 _0xf7f2=['result','catch','util','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf7f2,0x11f));var _0x2f7f=function(_0x365143,_0x46fd86){_0x365143=_0x365143-0x0;var _0x45bb49=_0xf7f2[_0x365143];return _0x45bb49;};'use strict';var _=require('lodash');var util=require(_0x2f7f('0x0'));var moment=require('moment');var BPromise=require(_0x2f7f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f7f('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2f7f('0x3'));var config=require(_0x2f7f('0x4'));var jayson=require(_0x2f7f('0x5'));var client=jayson[_0x2f7f('0x6')][_0x2f7f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x10a58f,_0x16dd38,_0x202688){return new BPromise(function(_0x3d1fde,_0x150077){return client[_0x2f7f('0x8')](_0x10a58f,_0x202688)[_0x2f7f('0x9')](function(_0x4d57ce){logger[_0x2f7f('0xa')](_0x2f7f('0xb'),_0x16dd38,_0x2f7f('0xc'));logger['debug'](_0x2f7f('0xd'),_0x16dd38,'request\x20sent',JSON[_0x2f7f('0xe')](_0x4d57ce));if(_0x4d57ce[_0x2f7f('0xf')]){if(_0x4d57ce[_0x2f7f('0xf')]['code']===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x16dd38,_0x4d57ce[_0x2f7f('0xf')][_0x2f7f('0x10')]);return _0x150077(_0x4d57ce[_0x2f7f('0xf')][_0x2f7f('0x10')]);}logger[_0x2f7f('0xf')](_0x2f7f('0xb'),_0x16dd38,_0x4d57ce[_0x2f7f('0xf')][_0x2f7f('0x10')]);return _0x3d1fde(_0x4d57ce[_0x2f7f('0xf')][_0x2f7f('0x10')]);}else{logger['info'](_0x2f7f('0xb'),_0x16dd38,_0x2f7f('0xc'));_0x3d1fde(_0x4d57ce[_0x2f7f('0x11')][_0x2f7f('0x10')]);}})[_0x2f7f('0x12')](function(_0x5e73e3){logger['error'](_0x2f7f('0xb'),_0x16dd38,_0x5e73e3);_0x150077(_0x5e73e3);});});} \ No newline at end of file +var _0x763e=['request\x20sent','stringify','error','code','message','Condition,\x20%s,\x20%s','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','debug'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x763e,0xd9));var _0xe763=function(_0x1cceee,_0x210e60){_0x1cceee=_0x1cceee-0x0;var _0x51d522=_0x763e[_0x1cceee];return _0x51d522;};'use strict';var _=require(_0xe763('0x0'));var util=require('util');var moment=require(_0xe763('0x1'));var BPromise=require(_0xe763('0x2'));var rs=require(_0xe763('0x3'));var fs=require('fs');var Redis=require(_0xe763('0x4'));var db=require(_0xe763('0x5'))['db'];var utils=require(_0xe763('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe763('0x7'));var jayson=require(_0xe763('0x8'));var client=jayson[_0xe763('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc6cc,_0x540085,_0x2eb299){return new BPromise(function(_0x433b61,_0x101255){return client['request'](_0x4dc6cc,_0x2eb299)['then'](function(_0x337197){logger['info']('Condition,\x20%s,\x20%s',_0x540085,'request\x20sent');logger[_0xe763('0xa')]('Condition,\x20%s,\x20%s,\x20%s',_0x540085,_0xe763('0xb'),JSON[_0xe763('0xc')](_0x337197));if(_0x337197[_0xe763('0xd')]){if(_0x337197[_0xe763('0xd')][_0xe763('0xe')]===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x540085,_0x337197[_0xe763('0xd')][_0xe763('0xf')]);return _0x101255(_0x337197[_0xe763('0xd')][_0xe763('0xf')]);}logger[_0xe763('0xd')](_0xe763('0x10'),_0x540085,_0x337197['error'][_0xe763('0xf')]);return _0x433b61(_0x337197[_0xe763('0xd')][_0xe763('0xf')]);}else{logger[_0xe763('0x11')](_0xe763('0x10'),_0x540085,'request\x20sent');_0x433b61(_0x337197['result'][_0xe763('0xf')]);}})[_0xe763('0x12')](function(_0x131a42){logger['error'](_0xe763('0x10'),_0x540085,_0x131a42);_0x101255(_0x131a42);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 021a203..9dbcad3 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 _0xb7be=['isAuthenticated','update','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./condition.controller','put'];(function(_0x2b33f1,_0x59732a){var _0x23212b=function(_0x2b9e53){while(--_0x2b9e53){_0x2b33f1['push'](_0x2b33f1['shift']());}};_0x23212b(++_0x59732a);}(_0xb7be,0x7c));var _0xeb7b=function(_0x472656,_0x6672a9){_0x472656=_0x472656-0x0;var _0x4b1e44=_0xb7be[_0x472656];return _0x4b1e44;};'use strict';var multer=require('multer');var util=require(_0xeb7b('0x0'));var path=require(_0xeb7b('0x1'));var timeout=require('connect-timeout');var express=require(_0xeb7b('0x2'));var router=express[_0xeb7b('0x3')]();var auth=require(_0xeb7b('0x4'));var interaction=require(_0xeb7b('0x5'));var config=require('../../config/environment');var controller=require(_0xeb7b('0x6'));router[_0xeb7b('0x7')]('/:id',auth[_0xeb7b('0x8')](),controller[_0xeb7b('0x9')]);router[_0xeb7b('0xa')]('/:id',auth[_0xeb7b('0x8')](),controller['destroy']);module[_0xeb7b('0xb')]=router; \ No newline at end of file +var _0x964c=['../../components/interaction/service','../../config/environment','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x142c6b,_0x32fdf3){var _0xc7bc21=function(_0x55e3d3){while(--_0x55e3d3){_0x142c6b['push'](_0x142c6b['shift']());}};_0xc7bc21(++_0x32fdf3);}(_0x964c,0x6a));var _0xc964=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x964c[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xc964('0x0'));var util=require(_0xc964('0x1'));var path=require(_0xc964('0x2'));var timeout=require('connect-timeout');var express=require(_0xc964('0x3'));var router=express[_0xc964('0x4')]();var auth=require(_0xc964('0x5'));var interaction=require(_0xc964('0x6'));var config=require(_0xc964('0x7'));var controller=require('./condition.controller');router['put'](_0xc964('0x8'),auth[_0xc964('0x9')](),controller[_0xc964('0xa')]);router[_0xc964('0xb')](_0xc964('0x8'),auth[_0xc964('0x9')](),controller[_0xc964('0xc')]);module[_0xc964('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index a09c685..b603690 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 _0xc13c=['exports','STRING'];(function(_0x75f91c,_0x45494a){var _0x3df6d2=function(_0x51d962){while(--_0x51d962){_0x75f91c['push'](_0x75f91c['shift']());}};_0x3df6d2(++_0x45494a);}(_0xc13c,0x15c));var _0xcc13=function(_0x53ea1a,_0x3d291a){_0x53ea1a=_0x53ea1a-0x0;var _0x479f23=_0xc13c[_0x53ea1a];return _0x479f23;};'use strict';var Sequelize=require('sequelize');module[_0xcc13('0x0')]={'name':{'type':Sequelize[_0xcc13('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0xcc13('0x1')]}}; \ No newline at end of file +var _0x1dcc=['STRING','name','sequelize','exports'];(function(_0x3638d3,_0x5be44a){var _0x573888=function(_0x1fe561){while(--_0x1fe561){_0x3638d3['push'](_0x3638d3['shift']());}};_0x573888(++_0x5be44a);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x424eb2,_0x520616){_0x424eb2=_0x424eb2-0x0;var _0x3177fe=_0x1dcc[_0x424eb2];return _0x3177fe;};'use strict';var Sequelize=require(_0xc1dc('0x0'));module[_0xc1dc('0x1')]={'name':{'type':Sequelize[_0xc1dc('0x2')],'allowNull':![],'unique':_0xc1dc('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 15f67a0..27ecc01 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 _0x43f2=['clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','pick','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','CustomDashboards','UserProfileResource','then','error','stack','name','send','index','map','Dashboard','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','clone','options','omit','createdAt','updatedAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','attrUrl','attrs','value','https://','custom','attrPath'];(function(_0x11d0d5,_0x2edcd4){var _0x34ec5a=function(_0x3a0b15){while(--_0x3a0b15){_0x11d0d5['push'](_0x11d0d5['shift']());}};_0x34ec5a(++_0x2edcd4);}(_0x43f2,0x91));var _0x243f=function(_0x8d82c2,_0x247cde){_0x8d82c2=_0x8d82c2-0x0;var _0x5353d1=_0x43f2[_0x8d82c2];return _0x5353d1;};'use strict';var pdf=require(_0x243f('0x0'));var emlformat=require(_0x243f('0x1'));var rimraf=require(_0x243f('0x2'));var zipdir=require(_0x243f('0x3'));var jsonpatch=require(_0x243f('0x4'));var rp=require('request-promise');var moment=require(_0x243f('0x5'));var BPromise=require(_0x243f('0x6'));var Mustache=require(_0x243f('0x7'));var util=require(_0x243f('0x8'));var path=require(_0x243f('0x9'));var sox=require(_0x243f('0xa'));var csv=require(_0x243f('0xb'));var ejs=require(_0x243f('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x243f('0xd'));var crypto=require('crypto');var jsforce=require(_0x243f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x243f('0xb'));var querystring=require('querystring');var Papa=require(_0x243f('0xf'));var Redis=require('ioredis');var authService=require(_0x243f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x243f('0x11'));var logger=require(_0x243f('0x12'))(_0x243f('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x243f('0x14')](config[_0x243f('0x15')],{'host':_0x243f('0x16'),'port':0x18eb});var socket=require(_0x243f('0x17'))(new Redis(config[_0x243f('0x15')]));require(_0x243f('0x18'))[_0x243f('0x19')](socket);function respondWithStatusCode(_0x35bae4,_0x24ea6d){_0x24ea6d=_0x24ea6d||0xcc;return function(_0x2d107a){if(_0x2d107a){return _0x35bae4[_0x243f('0x1a')](_0x24ea6d);}return _0x35bae4['status'](_0x24ea6d)[_0x243f('0x1b')]();};}function respondWithResult(_0x917522,_0x3851da){_0x3851da=_0x3851da||0xc8;return function(_0x40b0d2){if(_0x40b0d2){return _0x917522[_0x243f('0x1c')](_0x3851da)[_0x243f('0x1d')](_0x40b0d2);}};}function respondWithFilteredResult(_0x49c320,_0x164e14){return function(_0x4956c0){if(_0x4956c0){var _0x8b149a=_0x4956c0[_0x243f('0x1e')],_0x28e439=_0x164e14[_0x243f('0x1f')],_0x819d02=_0x164e14[_0x243f('0x1f')]+_0x164e14[_0x243f('0x20')],_0x2b601a;if(_0x819d02>=_0x8b149a){_0x819d02=_0x8b149a;_0x2b601a=0xc8;}else{_0x2b601a=0xce;}_0x49c320['status'](_0x2b601a);return _0x49c320[_0x243f('0x21')](_0x243f('0x22'),_0x28e439+'-'+_0x819d02+'/'+_0x8b149a)[_0x243f('0x1d')](_0x4956c0);}return null;};}function patchUpdates(_0x3fda5b){return function(_0x355fb6){try{jsonpatch[_0x243f('0x23')](_0x355fb6,_0x3fda5b,!![]);}catch(_0x5e0628){return BPromise[_0x243f('0x24')](_0x5e0628);}return _0x355fb6[_0x243f('0x25')]();};}function saveUpdates(_0x3cb952,_0x4d711e){return function(_0x45c2ec){if(_0x45c2ec){return _0x45c2ec[_0x243f('0x26')](_0x3cb952)['then'](function(_0x38bdb5){return _0x38bdb5;});}return null;};}function removeEntity(_0x189a44,_0xf81b2a){return function(_0x3e0f8){if(_0x3e0f8){return _0x3e0f8[_0x243f('0x27')]()['then'](function(){var _0x67df9c=_0x3e0f8[_0x243f('0x28')]({'plain':!![]});var _0x40daac=_0x243f('0x29');return db[_0x243f('0x2a')][_0x243f('0x27')]({'where':{'type':_0x40daac,'resourceId':_0x67df9c['id']}})['then'](function(){return _0x3e0f8;});})[_0x243f('0x2b')](function(){_0x189a44[_0x243f('0x1c')](0xcc)[_0x243f('0x1b')]();});}};}function handleEntityNotFound(_0x503849,_0x1912b8){return function(_0x500ec2){if(!_0x500ec2){_0x503849[_0x243f('0x1a')](0x194);}return _0x500ec2;};}function handleError(_0x4f0d34,_0x49b990){_0x49b990=_0x49b990||0x1f4;return function(_0x17c800){logger[_0x243f('0x2c')](_0x17c800[_0x243f('0x2d')]);if(_0x17c800['name']){delete _0x17c800[_0x243f('0x2e')];}_0x4f0d34[_0x243f('0x1c')](_0x49b990)[_0x243f('0x2f')](_0x17c800);};}exports[_0x243f('0x30')]=function(_0x2440f6,_0x499732){var _0x3b8760={},_0x51cfdd={},_0x4bbf80={'count':0x0,'rows':[]};var _0x5968a6=_[_0x243f('0x31')](db[_0x243f('0x32')][_0x243f('0x33')],function(_0x54ec57){return{'name':_0x54ec57['fieldName'],'type':_0x54ec57[_0x243f('0x34')]['key']};});_0x51cfdd[_0x243f('0x35')]=_['map'](_0x5968a6,_0x243f('0x2e'));_0x51cfdd[_0x243f('0x36')]=_[_0x243f('0x37')](_0x2440f6[_0x243f('0x36')]);_0x51cfdd[_0x243f('0x38')]=_[_0x243f('0x39')](_0x51cfdd['model'],_0x51cfdd[_0x243f('0x36')]);_0x3b8760[_0x243f('0x3a')]=_[_0x243f('0x39')](_0x51cfdd['model'],qs[_0x243f('0x3b')](_0x2440f6[_0x243f('0x36')][_0x243f('0x3b')]));_0x3b8760['attributes']=_0x3b8760['attributes'][_0x243f('0x3c')]?_0x3b8760[_0x243f('0x3a')]:_0x51cfdd['model'];if(!_0x2440f6[_0x243f('0x36')][_0x243f('0x3d')](_0x243f('0x3e'))){_0x3b8760[_0x243f('0x20')]=qs[_0x243f('0x20')](_0x2440f6[_0x243f('0x36')][_0x243f('0x20')]);_0x3b8760[_0x243f('0x1f')]=qs[_0x243f('0x1f')](_0x2440f6[_0x243f('0x36')][_0x243f('0x1f')]);}_0x3b8760[_0x243f('0x3f')]=qs['sort'](_0x2440f6[_0x243f('0x36')][_0x243f('0x40')]);_0x3b8760[_0x243f('0x41')]=qs[_0x243f('0x38')](_['pick'](_0x2440f6[_0x243f('0x36')],_0x51cfdd['filters']),_0x5968a6);if(_0x2440f6['query'][_0x243f('0x42')]){_0x3b8760[_0x243f('0x41')]=_[_0x243f('0x43')](_0x3b8760[_0x243f('0x41')],{'$or':_[_0x243f('0x31')](_0x5968a6,function(_0x10f9a6){if(_0x10f9a6[_0x243f('0x34')]!==_0x243f('0x44')){var _0x32947e={};_0x32947e[_0x10f9a6['name']]={'$like':'%'+_0x2440f6[_0x243f('0x36')][_0x243f('0x42')]+'%'};return _0x32947e;}})});}_0x3b8760=_[_0x243f('0x43')]({},_0x3b8760,_0x2440f6['options']);var _0x2194b8={'where':_0x3b8760[_0x243f('0x41')]};return db['Dashboard'][_0x243f('0x1e')](_0x2194b8)[_0x243f('0x2b')](function(_0x513c16){_0x4bbf80['count']=_0x513c16;if(_0x2440f6['query'][_0x243f('0x45')]){_0x3b8760[_0x243f('0x46')]=[{'all':!![]}];}return db[_0x243f('0x32')][_0x243f('0x47')](_0x3b8760);})[_0x243f('0x2b')](function(_0x31bd89){_0x4bbf80['rows']=_0x31bd89;return _0x4bbf80;})['then'](respondWithFilteredResult(_0x499732,_0x3b8760))[_0x243f('0x48')](handleError(_0x499732,null));};exports[_0x243f('0x49')]=function(_0x2677dc,_0x4f1e6c){var _0x24f551={'raw':![],'where':{'id':_0x2677dc[_0x243f('0x4a')]['id']}},_0x37abf4={};_0x37abf4[_0x243f('0x35')]=_[_0x243f('0x37')](db[_0x243f('0x32')][_0x243f('0x33')]);_0x37abf4[_0x243f('0x36')]=_[_0x243f('0x37')](_0x2677dc[_0x243f('0x36')]);_0x37abf4[_0x243f('0x38')]=_[_0x243f('0x39')](_0x37abf4[_0x243f('0x35')],_0x37abf4[_0x243f('0x36')]);_0x24f551[_0x243f('0x3a')]=_['intersection'](_0x37abf4[_0x243f('0x35')],qs[_0x243f('0x3b')](_0x2677dc['query'][_0x243f('0x3b')]));_0x24f551[_0x243f('0x3a')]=_0x24f551[_0x243f('0x3a')]['length']?_0x24f551[_0x243f('0x3a')]:_0x37abf4['model'];if(_0x2677dc['query'][_0x243f('0x45')]){_0x24f551[_0x243f('0x46')]=[{'all':!![]}];}_0x24f551=_['merge']({},_0x24f551,_0x2677dc['options']);return db[_0x243f('0x32')][_0x243f('0x4b')](_0x24f551)[_0x243f('0x2b')](handleEntityNotFound(_0x4f1e6c,null))[_0x243f('0x2b')](respondWithResult(_0x4f1e6c,null))[_0x243f('0x48')](handleError(_0x4f1e6c,null));};exports[_0x243f('0x4c')]=function(_0x36ecd0,_0x4bf059){return db['Dashboard'][_0x243f('0x4c')](_0x36ecd0[_0x243f('0x4d')],{})['then'](function(_0x496c19){var _0x15c55c=_0x36ecd0[_0x243f('0x4e')][_0x243f('0x28')]({'plain':!![]});if(!_0x15c55c)throw new Error(_0x243f('0x4f'));if(_0x15c55c['role']===_0x243f('0x4e')){var _0x3445c3=_0x496c19[_0x243f('0x28')]({'plain':!![]});var _0x21b6d6=_0x243f('0x29');return db['UserProfileSection'][_0x243f('0x4b')]({'where':{'name':_0x21b6d6,'userProfileId':_0x15c55c[_0x243f('0x50')]},'raw':!![]})[_0x243f('0x2b')](function(_0x4e12a9){if(_0x4e12a9&&_0x4e12a9[_0x243f('0x51')]===0x0){return db[_0x243f('0x2a')][_0x243f('0x4c')]({'name':_0x3445c3['name'],'resourceId':_0x3445c3['id'],'type':_0x4e12a9[_0x243f('0x2e')],'sectionId':_0x4e12a9['id']},{})[_0x243f('0x2b')](function(){return _0x496c19;});}else{return _0x496c19;}})[_0x243f('0x48')](function(_0x2953ff){logger[_0x243f('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2953ff);throw _0x2953ff;});}return _0x496c19;})[_0x243f('0x2b')](respondWithResult(_0x4bf059,0xc9))[_0x243f('0x48')](handleError(_0x4bf059,null));};exports[_0x243f('0x52')]=function(_0x1a23f2,_0x5ba17a){var _0x5e7f37={'where':{'id':_0x1a23f2['params']['id']}},_0x2ad60d={};_0x2ad60d[_0x243f('0x35')]=_[_0x243f('0x37')](db[_0x243f('0x32')][_0x243f('0x33')]);_0x5e7f37[_0x243f('0x3a')]=_[_0x243f('0x39')](_0x2ad60d['model'],qs[_0x243f('0x3b')](_0x1a23f2['query'][_0x243f('0x3b')]));_0x5e7f37['attributes']=_0x5e7f37[_0x243f('0x3a')][_0x243f('0x3c')]?_0x5e7f37['attributes']:_0x2ad60d[_0x243f('0x35')];if(_0x1a23f2[_0x243f('0x36')][_0x243f('0x45')]){_0x5e7f37['include']=[{'all':!![]}];}_0x5e7f37=_[_0x243f('0x43')]({},_0x5e7f37,_0x1a23f2[_0x243f('0x53')]);return db[_0x243f('0x32')][_0x243f('0x4b')](_0x5e7f37)['then'](handleEntityNotFound(_0x5ba17a,null))[_0x243f('0x2b')](function(_0x2fdf3f){if(_0x2fdf3f){var _0x5e57be=_0x2fdf3f[_0x243f('0x28')]({'plain':!![]});_0x5e57be=qs[_0x243f('0x54')](_0x5e57be,['id',_0x243f('0x55'),_0x243f('0x56')]);_0x1a23f2[_0x243f('0x4d')]=_['omit'](_0x1a23f2[_0x243f('0x4d')],['id',_0x243f('0x55'),'updatedAt']);return db[_0x243f('0x32')]['create'](_['merge'](_0x5e57be,_0x1a23f2[_0x243f('0x4d')]),{'include':_0x1a23f2[_0x243f('0x36')][_0x243f('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x9708d0){var _0x4da79c=_0x1a23f2['user'][_0x243f('0x28')]({'plain':!![]});if(!_0x4da79c)throw new Error(_0x243f('0x4f'));if(_0x4da79c['role']==='user'){var _0x4c28da=_0x9708d0[_0x243f('0x28')]({'plain':!![]});var _0x256f7a=_0x243f('0x29');return db[_0x243f('0x57')][_0x243f('0x4b')]({'where':{'name':_0x256f7a,'userProfileId':_0x4da79c[_0x243f('0x50')]},'raw':!![]})[_0x243f('0x2b')](function(_0x5bd01e){if(_0x5bd01e&&_0x5bd01e[_0x243f('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x4c28da[_0x243f('0x2e')],'resourceId':_0x4c28da['id'],'type':_0x5bd01e['name'],'sectionId':_0x5bd01e['id']},{})['then'](function(){return _0x9708d0;});}else{return _0x9708d0;}})['catch'](function(_0x2d7e12){logger[_0x243f('0x2c')](_0x243f('0x58'),_0x2d7e12);throw _0x2d7e12;});}return _0x9708d0;});}})[_0x243f('0x2b')](respondWithResult(_0x5ba17a,0xc9))[_0x243f('0x48')](handleError(_0x5ba17a,null));};exports[_0x243f('0x26')]=function(_0x46c80b,_0x5e64e4){if(_0x46c80b[_0x243f('0x4d')]['id']){delete _0x46c80b[_0x243f('0x4d')]['id'];}return db[_0x243f('0x32')]['find']({'where':{'id':_0x46c80b[_0x243f('0x4a')]['id']}})[_0x243f('0x2b')](handleEntityNotFound(_0x5e64e4,null))[_0x243f('0x2b')](saveUpdates(_0x46c80b[_0x243f('0x4d')],null))[_0x243f('0x2b')](respondWithResult(_0x5e64e4,null))['catch'](handleError(_0x5e64e4,null));};exports[_0x243f('0x27')]=function(_0x2138e7,_0x3022d3){return db[_0x243f('0x32')][_0x243f('0x4b')]({'where':{'id':_0x2138e7[_0x243f('0x4a')]['id']}})[_0x243f('0x2b')](handleEntityNotFound(_0x3022d3,null))[_0x243f('0x2b')](removeEntity(_0x3022d3,null))[_0x243f('0x48')](handleError(_0x3022d3,null));};function widgetAttributes(_0x1dd76b){try{switch(_0x1dd76b['type']){case'iframe':return[{'name':'attrUrl','value':_0x1dd76b[_0x243f('0x59')]||(_0x1dd76b[_0x243f('0x5a')]&&_0x1dd76b['attrs'][0x0]?_0x1dd76b['attrs'][0x0][_0x243f('0x5b')]:undefined)||_0x243f('0x5c')}];case _0x243f('0x5d'):return[{'name':'attrPath','value':_0x1dd76b[_0x243f('0x5e')]||(_0x1dd76b['attrs']&&_0x1dd76b[_0x243f('0x5a')][0x0]?_0x1dd76b[_0x243f('0x5a')][0x0]['value']:undefined)||''}];case _0x243f('0x5f'):return[{'name':_0x243f('0x60'),'value':_0x1dd76b[_0x243f('0x60')]||(_0x1dd76b[_0x243f('0x5a')]&&_0x1dd76b[_0x243f('0x5a')][0x0]?_0x1dd76b[_0x243f('0x5a')][0x0][_0x243f('0x5b')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x1dd76b[_0x243f('0x61')]||(_0x1dd76b[_0x243f('0x5a')]&&_0x1dd76b[_0x243f('0x5a')][0x1]?_0x1dd76b['attrs'][0x1][_0x243f('0x5b')]:undefined)||_0x243f('0x62')},{'name':_0x243f('0x63'),'value':_0x1dd76b['attrFontSize']||(_0x1dd76b[_0x243f('0x5a')]&&_0x1dd76b[_0x243f('0x5a')][0x2]?_0x1dd76b['attrs'][0x2]['value']:undefined)||0xc}];case _0x243f('0x64'):return[{'name':_0x243f('0x65'),'value':_0x1dd76b[_0x243f('0x65')]||(_0x1dd76b[_0x243f('0x5a')]&&_0x1dd76b[_0x243f('0x5a')][0x0]?_0x1dd76b[_0x243f('0x5a')][0x0][_0x243f('0x5b')]:undefined)||_0x243f('0x66')},{'name':_0x243f('0x67'),'value':_0x1dd76b[_0x243f('0x67')]||(_0x1dd76b[_0x243f('0x5a')]&&_0x1dd76b[_0x243f('0x5a')][0x1]?_0x1dd76b['attrs'][0x1][_0x243f('0x5b')]:undefined)||[]},{'name':_0x243f('0x63'),'value':_0x1dd76b['attrFontSize']||(_0x1dd76b[_0x243f('0x5a')]&&_0x1dd76b[_0x243f('0x5a')][0x2]?_0x1dd76b[_0x243f('0x5a')][0x2][_0x243f('0x5b')]:undefined)||0x14}];case _0x243f('0x68'):case _0x243f('0x69'):return[{'name':_0x243f('0x6a'),'value':_0x1dd76b['attrSerie1']||(_0x1dd76b[_0x243f('0x5a')]&&_0x1dd76b['attrs'][0x0]?_0x1dd76b[_0x243f('0x5a')][0x0][_0x243f('0x5b')]:undefined)||'total'},{'name':_0x243f('0x6b'),'value':_0x1dd76b['attrSerie2']||(_0x1dd76b[_0x243f('0x5a')]&&_0x1dd76b[_0x243f('0x5a')][0x1]?_0x1dd76b[_0x243f('0x5a')][0x1]['value']:undefined)||null},{'name':_0x243f('0x6c'),'value':_0x1dd76b['attrSerie3']||(_0x1dd76b[_0x243f('0x5a')]&&_0x1dd76b[_0x243f('0x5a')][0x2]?_0x1dd76b[_0x243f('0x5a')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x1dd76b[_0x243f('0x67')]||(_0x1dd76b[_0x243f('0x5a')]&&_0x1dd76b['attrs'][0x3]?_0x1dd76b[_0x243f('0x5a')][0x3][_0x243f('0x5b')]:undefined)||[]}];case _0x243f('0x6d'):return[{'name':_0x243f('0x6e'),'type':_0x1dd76b[_0x243f('0x6f')]||(_0x1dd76b['attrs']&&_0x1dd76b[_0x243f('0x5a')][0x0]?_0x1dd76b[_0x243f('0x5a')][0x0][_0x243f('0x34')]:undefined)||null,'value':_0x1dd76b['attrReport']||(_0x1dd76b[_0x243f('0x5a')]&&_0x1dd76b[_0x243f('0x5a')][0x0]?_0x1dd76b[_0x243f('0x5a')][0x0][_0x243f('0x5b')]:undefined)||null},{'name':_0x243f('0x70'),'value':_0x1dd76b[_0x243f('0x70')]||(_0x1dd76b[_0x243f('0x5a')]&&_0x1dd76b[_0x243f('0x5a')][0x1]?_0x1dd76b['attrs'][0x1][_0x243f('0x5b')]:undefined)||0x0}];default:return[];}}catch(_0x80f1f1){logger['error']('widgetAttributes:\x20%s',JSON[_0x243f('0x71')](_0x80f1f1));return[];}}exports[_0x243f('0x72')]=function(_0x2c1f8b,_0x37c432,_0x5d2bad){if(_0x2c1f8b['body']['id']){delete _0x2c1f8b[_0x243f('0x4d')]['id'];}return db[_0x243f('0x32')][_0x243f('0x4b')]({'where':{'id':_0x2c1f8b[_0x243f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x37c432,null))['then'](function(_0xcbdc55){if(_0xcbdc55){_0x2c1f8b[_0x243f('0x4d')][_0x243f('0x73')]=_0xcbdc55['id'];_0x2c1f8b[_0x243f('0x4d')][_0x243f('0x5a')]=widgetAttributes(_0x2c1f8b[_0x243f('0x4d')]);return db[_0x243f('0x74')][_0x243f('0x4c')](_0x2c1f8b[_0x243f('0x4d')]);}})[_0x243f('0x2b')](respondWithResult(_0x37c432,null))[_0x243f('0x48')](handleError(_0x37c432,null));};exports[_0x243f('0x75')]=function(_0x3de05e,_0xbcb0f6,_0x52feb2){var _0x261da4={};var _0x3c7277={};var _0x32d2d7;var _0x4b8c02;return db['Dashboard'][_0x243f('0x76')]({'where':{'id':_0x3de05e[_0x243f('0x4a')]['id']}})['then'](handleEntityNotFound(_0xbcb0f6,null))[_0x243f('0x2b')](function(_0x2402bc){if(_0x2402bc){_0x32d2d7=_0x2402bc;_0x3c7277[_0x243f('0x35')]=_[_0x243f('0x37')](db[_0x243f('0x74')][_0x243f('0x33')]);_0x3c7277['query']=_['keys'](_0x3de05e[_0x243f('0x36')]);_0x3c7277[_0x243f('0x38')]=_[_0x243f('0x39')](_0x3c7277[_0x243f('0x35')],_0x3c7277[_0x243f('0x36')]);_0x261da4[_0x243f('0x3a')]=_[_0x243f('0x39')](_0x3c7277[_0x243f('0x35')],qs[_0x243f('0x3b')](_0x3de05e[_0x243f('0x36')]['fields']));_0x261da4[_0x243f('0x3a')]=_0x261da4[_0x243f('0x3a')][_0x243f('0x3c')]?_0x261da4[_0x243f('0x3a')]:_0x3c7277[_0x243f('0x35')];_0x261da4['order']=qs[_0x243f('0x40')](_0x3de05e[_0x243f('0x36')][_0x243f('0x40')]);_0x261da4[_0x243f('0x41')]=qs['filters'](_[_0x243f('0x77')](_0x3de05e[_0x243f('0x36')],_0x3c7277[_0x243f('0x38')]));if(_0x3de05e[_0x243f('0x36')]['filter']){_0x261da4['where']=_[_0x243f('0x43')](_0x261da4[_0x243f('0x41')],{'$or':_[_0x243f('0x31')](_0x261da4[_0x243f('0x3a')],function(_0x1eb4b2){var _0x2646ae={};_0x2646ae[_0x1eb4b2]={'$like':'%'+_0x3de05e[_0x243f('0x36')][_0x243f('0x42')]+'%'};return _0x2646ae;})});}_0x261da4=_[_0x243f('0x43')]({},_0x261da4,_0x3de05e[_0x243f('0x53')]);return _0x32d2d7[_0x243f('0x75')](_0x261da4);}})[_0x243f('0x2b')](function(_0xb16c19){if(_0xb16c19){_0x4b8c02=_0xb16c19[_0x243f('0x3c')];if(!_0x3de05e[_0x243f('0x36')][_0x243f('0x3d')]('nolimit')){_0x261da4[_0x243f('0x20')]=qs[_0x243f('0x20')](_0x3de05e['query'][_0x243f('0x20')]);_0x261da4[_0x243f('0x1f')]=qs[_0x243f('0x1f')](_0x3de05e[_0x243f('0x36')]['offset']);}return _0x32d2d7['getItems'](_0x261da4);}})['then'](function(_0x57c964){if(_0x57c964){return _0x57c964?{'count':_0x4b8c02,'rows':_0x57c964}:null;}})[_0x243f('0x2b')](respondWithResult(_0xbcb0f6,null))[_0x243f('0x48')](handleError(_0xbcb0f6,null));}; \ No newline at end of file +var _0x5787=['CustomDashboards','UserProfileResource','end','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','where','pick','merge','filter','options','count','rows','catch','params','length','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','sort','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','./dashboard.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','update','then','destroy'];(function(_0x2c1a56,_0x5343c1){var _0x3568b6=function(_0x481530){while(--_0x481530){_0x2c1a56['push'](_0x2c1a56['shift']());}};_0x3568b6(++_0x5343c1);}(_0x5787,0xce));var _0x7578=function(_0x20119e,_0xace4e1){_0x20119e=_0x20119e-0x0;var _0x34d2a4=_0x5787[_0x20119e];return _0x34d2a4;};'use strict';var pdf=require(_0x7578('0x0'));var emlformat=require(_0x7578('0x1'));var rimraf=require(_0x7578('0x2'));var zipdir=require(_0x7578('0x3'));var jsonpatch=require(_0x7578('0x4'));var rp=require(_0x7578('0x5'));var moment=require(_0x7578('0x6'));var BPromise=require(_0x7578('0x7'));var Mustache=require(_0x7578('0x8'));var util=require('util');var path=require(_0x7578('0x9'));var sox=require(_0x7578('0xa'));var csv=require(_0x7578('0xb'));var ejs=require(_0x7578('0xc'));var fs=require('fs');var _=require(_0x7578('0xd'));var squel=require(_0x7578('0xe'));var crypto=require(_0x7578('0xf'));var jsforce=require(_0x7578('0x10'));var deskjs=require(_0x7578('0x11'));var toCsv=require(_0x7578('0xb'));var querystring=require(_0x7578('0x12'));var Papa=require('papaparse');var Redis=require(_0x7578('0x13'));var authService=require(_0x7578('0x14'));var qs=require(_0x7578('0x15'));var as=require(_0x7578('0x16'));var hardwareService=require(_0x7578('0x17'));var logger=require(_0x7578('0x18'))(_0x7578('0x19'));var utils=require(_0x7578('0x1a'));var config=require(_0x7578('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x7578('0x1c')]=_[_0x7578('0x1d')](config[_0x7578('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7578('0x1c')]));require(_0x7578('0x1e'))[_0x7578('0x1f')](socket);function respondWithStatusCode(_0x4d6f95,_0xdee223){_0xdee223=_0xdee223||0xcc;return function(_0x519df6){if(_0x519df6){return _0x4d6f95[_0x7578('0x20')](_0xdee223);}return _0x4d6f95[_0x7578('0x21')](_0xdee223)['end']();};}function respondWithResult(_0x38aab9,_0x58661a){_0x58661a=_0x58661a||0xc8;return function(_0x433115){if(_0x433115){return _0x38aab9['status'](_0x58661a)[_0x7578('0x22')](_0x433115);}};}function respondWithFilteredResult(_0x4416db,_0x1d70f7){return function(_0x3b6144){if(_0x3b6144){var _0x456b4e=_0x3b6144['count'],_0x24b5c5=_0x1d70f7[_0x7578('0x23')],_0x2b50ff=_0x1d70f7[_0x7578('0x23')]+_0x1d70f7[_0x7578('0x24')],_0x161df1;if(_0x2b50ff>=_0x456b4e){_0x2b50ff=_0x456b4e;_0x161df1=0xc8;}else{_0x161df1=0xce;}_0x4416db['status'](_0x161df1);return _0x4416db[_0x7578('0x25')](_0x7578('0x26'),_0x24b5c5+'-'+_0x2b50ff+'/'+_0x456b4e)['json'](_0x3b6144);}return null;};}function patchUpdates(_0x5f30ab){return function(_0x3d6bee){try{jsonpatch['apply'](_0x3d6bee,_0x5f30ab,!![]);}catch(_0x5a37e4){return BPromise['reject'](_0x5a37e4);}return _0x3d6bee['save']();};}function saveUpdates(_0x105595,_0x4e5986){return function(_0x4a5937){if(_0x4a5937){return _0x4a5937[_0x7578('0x27')](_0x105595)[_0x7578('0x28')](function(_0x8db87a){return _0x8db87a;});}return null;};}function removeEntity(_0x1ac4bd,_0xacdefc){return function(_0x75e98b){if(_0x75e98b){return _0x75e98b[_0x7578('0x29')]()['then'](function(){var _0x3ad139=_0x75e98b['get']({'plain':!![]});var _0x2a3fe5=_0x7578('0x2a');return db[_0x7578('0x2b')][_0x7578('0x29')]({'where':{'type':_0x2a3fe5,'resourceId':_0x3ad139['id']}})[_0x7578('0x28')](function(){return _0x75e98b;});})[_0x7578('0x28')](function(){_0x1ac4bd[_0x7578('0x21')](0xcc)[_0x7578('0x2c')]();});}};}function handleEntityNotFound(_0x4a66cb,_0x4c0d92){return function(_0x5c2ec7){if(!_0x5c2ec7){_0x4a66cb[_0x7578('0x20')](0x194);}return _0x5c2ec7;};}function handleError(_0x5dce5c,_0x1dd61c){_0x1dd61c=_0x1dd61c||0x1f4;return function(_0x207435){logger[_0x7578('0x2d')](_0x207435[_0x7578('0x2e')]);if(_0x207435[_0x7578('0x2f')]){delete _0x207435[_0x7578('0x2f')];}_0x5dce5c[_0x7578('0x21')](_0x1dd61c)[_0x7578('0x30')](_0x207435);};}exports[_0x7578('0x31')]=function(_0x225c6c,_0x29e117){var _0xc6cf3b={},_0x3479db={},_0x1fd597={'count':0x0,'rows':[]};var _0x468090=_[_0x7578('0x32')](db[_0x7578('0x33')][_0x7578('0x34')],function(_0x46aa9e){return{'name':_0x46aa9e[_0x7578('0x35')],'type':_0x46aa9e[_0x7578('0x36')][_0x7578('0x37')]};});_0x3479db[_0x7578('0x38')]=_[_0x7578('0x32')](_0x468090,_0x7578('0x2f'));_0x3479db[_0x7578('0x39')]=_[_0x7578('0x3a')](_0x225c6c['query']);_0x3479db[_0x7578('0x3b')]=_[_0x7578('0x3c')](_0x3479db[_0x7578('0x38')],_0x3479db[_0x7578('0x39')]);_0xc6cf3b['attributes']=_[_0x7578('0x3c')](_0x3479db[_0x7578('0x38')],qs[_0x7578('0x3d')](_0x225c6c[_0x7578('0x39')][_0x7578('0x3d')]));_0xc6cf3b[_0x7578('0x3e')]=_0xc6cf3b['attributes']['length']?_0xc6cf3b[_0x7578('0x3e')]:_0x3479db['model'];if(!_0x225c6c[_0x7578('0x39')][_0x7578('0x3f')]('nolimit')){_0xc6cf3b[_0x7578('0x24')]=qs[_0x7578('0x24')](_0x225c6c['query'][_0x7578('0x24')]);_0xc6cf3b[_0x7578('0x23')]=qs[_0x7578('0x23')](_0x225c6c[_0x7578('0x39')][_0x7578('0x23')]);}_0xc6cf3b[_0x7578('0x40')]=qs['sort'](_0x225c6c['query']['sort']);_0xc6cf3b[_0x7578('0x41')]=qs['filters'](_[_0x7578('0x42')](_0x225c6c[_0x7578('0x39')],_0x3479db[_0x7578('0x3b')]),_0x468090);if(_0x225c6c[_0x7578('0x39')]['filter']){_0xc6cf3b[_0x7578('0x41')]=_[_0x7578('0x43')](_0xc6cf3b[_0x7578('0x41')],{'$or':_[_0x7578('0x32')](_0x468090,function(_0x381a86){if(_0x381a86[_0x7578('0x36')]!=='VIRTUAL'){var _0x513e3f={};_0x513e3f[_0x381a86[_0x7578('0x2f')]]={'$like':'%'+_0x225c6c[_0x7578('0x39')][_0x7578('0x44')]+'%'};return _0x513e3f;}})});}_0xc6cf3b=_[_0x7578('0x43')]({},_0xc6cf3b,_0x225c6c[_0x7578('0x45')]);var _0x1f0628={'where':_0xc6cf3b[_0x7578('0x41')]};return db[_0x7578('0x33')]['count'](_0x1f0628)[_0x7578('0x28')](function(_0x50d3d5){_0x1fd597[_0x7578('0x46')]=_0x50d3d5;if(_0x225c6c[_0x7578('0x39')]['includeAll']){_0xc6cf3b['include']=[{'all':!![]}];}return db[_0x7578('0x33')]['findAll'](_0xc6cf3b);})[_0x7578('0x28')](function(_0x20cc31){_0x1fd597[_0x7578('0x47')]=_0x20cc31;return _0x1fd597;})[_0x7578('0x28')](respondWithFilteredResult(_0x29e117,_0xc6cf3b))[_0x7578('0x48')](handleError(_0x29e117,null));};exports['show']=function(_0x26e34a,_0x183515){var _0x19159e={'raw':![],'where':{'id':_0x26e34a[_0x7578('0x49')]['id']}},_0x48c58d={};_0x48c58d[_0x7578('0x38')]=_[_0x7578('0x3a')](db[_0x7578('0x33')][_0x7578('0x34')]);_0x48c58d[_0x7578('0x39')]=_[_0x7578('0x3a')](_0x26e34a['query']);_0x48c58d[_0x7578('0x3b')]=_[_0x7578('0x3c')](_0x48c58d[_0x7578('0x38')],_0x48c58d[_0x7578('0x39')]);_0x19159e['attributes']=_[_0x7578('0x3c')](_0x48c58d[_0x7578('0x38')],qs['fields'](_0x26e34a[_0x7578('0x39')][_0x7578('0x3d')]));_0x19159e[_0x7578('0x3e')]=_0x19159e[_0x7578('0x3e')][_0x7578('0x4a')]?_0x19159e['attributes']:_0x48c58d[_0x7578('0x38')];if(_0x26e34a[_0x7578('0x39')][_0x7578('0x4b')]){_0x19159e[_0x7578('0x4c')]=[{'all':!![]}];}_0x19159e=_[_0x7578('0x43')]({},_0x19159e,_0x26e34a[_0x7578('0x45')]);return db[_0x7578('0x33')][_0x7578('0x4d')](_0x19159e)[_0x7578('0x28')](handleEntityNotFound(_0x183515,null))[_0x7578('0x28')](respondWithResult(_0x183515,null))[_0x7578('0x48')](handleError(_0x183515,null));};exports[_0x7578('0x4e')]=function(_0x2df5da,_0x5143ac){return db[_0x7578('0x33')][_0x7578('0x4e')](_0x2df5da[_0x7578('0x4f')],{})[_0x7578('0x28')](function(_0x2cd1d3){var _0x5e2ec6=_0x2df5da['user']['get']({'plain':!![]});if(!_0x5e2ec6)throw new Error(_0x7578('0x50'));if(_0x5e2ec6[_0x7578('0x51')]===_0x7578('0x52')){var _0x18aaba=_0x2cd1d3[_0x7578('0x53')]({'plain':!![]});var _0x17049b=_0x7578('0x2a');return db[_0x7578('0x54')]['find']({'where':{'name':_0x17049b,'userProfileId':_0x5e2ec6[_0x7578('0x55')]},'raw':!![]})[_0x7578('0x28')](function(_0x1c8d1e){if(_0x1c8d1e&&_0x1c8d1e[_0x7578('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x18aaba[_0x7578('0x2f')],'resourceId':_0x18aaba['id'],'type':_0x1c8d1e['name'],'sectionId':_0x1c8d1e['id']},{})[_0x7578('0x28')](function(){return _0x2cd1d3;});}else{return _0x2cd1d3;}})[_0x7578('0x48')](function(_0x103f34){logger[_0x7578('0x2d')](_0x7578('0x57'),_0x103f34);throw _0x103f34;});}return _0x2cd1d3;})[_0x7578('0x28')](respondWithResult(_0x5143ac,0xc9))['catch'](handleError(_0x5143ac,null));};exports[_0x7578('0x58')]=function(_0x569a2e,_0x10d535){var _0x549fc3={'where':{'id':_0x569a2e[_0x7578('0x49')]['id']}},_0x4e27c0={};_0x4e27c0[_0x7578('0x38')]=_[_0x7578('0x3a')](db['Dashboard'][_0x7578('0x34')]);_0x549fc3['attributes']=_[_0x7578('0x3c')](_0x4e27c0[_0x7578('0x38')],qs[_0x7578('0x3d')](_0x569a2e[_0x7578('0x39')][_0x7578('0x3d')]));_0x549fc3[_0x7578('0x3e')]=_0x549fc3['attributes'][_0x7578('0x4a')]?_0x549fc3['attributes']:_0x4e27c0[_0x7578('0x38')];if(_0x569a2e[_0x7578('0x39')][_0x7578('0x4b')]){_0x549fc3[_0x7578('0x4c')]=[{'all':!![]}];}_0x549fc3=_[_0x7578('0x43')]({},_0x549fc3,_0x569a2e[_0x7578('0x45')]);return db[_0x7578('0x33')]['find'](_0x549fc3)[_0x7578('0x28')](handleEntityNotFound(_0x10d535,null))['then'](function(_0x15a0d8){if(_0x15a0d8){var _0x256dcd=_0x15a0d8['get']({'plain':!![]});_0x256dcd=qs[_0x7578('0x59')](_0x256dcd,['id',_0x7578('0x5a'),_0x7578('0x5b')]);_0x569a2e[_0x7578('0x4f')]=_['omit'](_0x569a2e['body'],['id',_0x7578('0x5a'),_0x7578('0x5b')]);return db[_0x7578('0x33')][_0x7578('0x4e')](_['merge'](_0x256dcd,_0x569a2e[_0x7578('0x4f')]),{'include':_0x569a2e['query'][_0x7578('0x4b')]?[{'all':!![]}]:undefined})[_0x7578('0x28')](function(_0x1536f8){var _0x4df0c3=_0x569a2e[_0x7578('0x52')][_0x7578('0x53')]({'plain':!![]});if(!_0x4df0c3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4df0c3[_0x7578('0x51')]===_0x7578('0x52')){var _0x51c49a=_0x1536f8[_0x7578('0x53')]({'plain':!![]});var _0x5f2fd0=_0x7578('0x2a');return db['UserProfileSection'][_0x7578('0x4d')]({'where':{'name':_0x5f2fd0,'userProfileId':_0x4df0c3[_0x7578('0x55')]},'raw':!![]})[_0x7578('0x28')](function(_0x2d9f85){if(_0x2d9f85&&_0x2d9f85[_0x7578('0x56')]===0x0){return db[_0x7578('0x2b')][_0x7578('0x4e')]({'name':_0x51c49a[_0x7578('0x2f')],'resourceId':_0x51c49a['id'],'type':_0x2d9f85['name'],'sectionId':_0x2d9f85['id']},{})[_0x7578('0x28')](function(){return _0x1536f8;});}else{return _0x1536f8;}})[_0x7578('0x48')](function(_0x51dfb5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51dfb5);throw _0x51dfb5;});}return _0x1536f8;});}})[_0x7578('0x28')](respondWithResult(_0x10d535,0xc9))[_0x7578('0x48')](handleError(_0x10d535,null));};exports[_0x7578('0x27')]=function(_0x176b65,_0x12ab9d){if(_0x176b65[_0x7578('0x4f')]['id']){delete _0x176b65[_0x7578('0x4f')]['id'];}return db['Dashboard'][_0x7578('0x4d')]({'where':{'id':_0x176b65[_0x7578('0x49')]['id']}})['then'](handleEntityNotFound(_0x12ab9d,null))['then'](saveUpdates(_0x176b65[_0x7578('0x4f')],null))['then'](respondWithResult(_0x12ab9d,null))[_0x7578('0x48')](handleError(_0x12ab9d,null));};exports[_0x7578('0x29')]=function(_0x38a413,_0x19a7e3){return db[_0x7578('0x33')][_0x7578('0x4d')]({'where':{'id':_0x38a413[_0x7578('0x49')]['id']}})[_0x7578('0x28')](handleEntityNotFound(_0x19a7e3,null))[_0x7578('0x28')](removeEntity(_0x19a7e3,null))['catch'](handleError(_0x19a7e3,null));};function widgetAttributes(_0x227f7c){try{switch(_0x227f7c[_0x7578('0x36')]){case'iframe':return[{'name':_0x7578('0x5c'),'value':_0x227f7c[_0x7578('0x5c')]||(_0x227f7c['attrs']&&_0x227f7c[_0x7578('0x5d')][0x0]?_0x227f7c['attrs'][0x0][_0x7578('0x5e')]:undefined)||_0x7578('0x5f')}];case _0x7578('0x60'):return[{'name':_0x7578('0x61'),'value':_0x227f7c[_0x7578('0x61')]||(_0x227f7c[_0x7578('0x5d')]&&_0x227f7c[_0x7578('0x5d')][0x0]?_0x227f7c[_0x7578('0x5d')][0x0]['value']:undefined)||''}];case _0x7578('0x62'):return[{'name':'attrHourFormat','value':_0x227f7c[_0x7578('0x63')]||(_0x227f7c[_0x7578('0x5d')]&&_0x227f7c[_0x7578('0x5d')][0x0]?_0x227f7c[_0x7578('0x5d')][0x0][_0x7578('0x5e')]:undefined)||_0x7578('0x64')},{'name':_0x7578('0x65'),'value':_0x227f7c[_0x7578('0x65')]||(_0x227f7c[_0x7578('0x5d')]&&_0x227f7c[_0x7578('0x5d')][0x1]?_0x227f7c[_0x7578('0x5d')][0x1]['value']:undefined)||_0x7578('0x66')},{'name':_0x7578('0x67'),'value':_0x227f7c[_0x7578('0x67')]||(_0x227f7c['attrs']&&_0x227f7c['attrs'][0x2]?_0x227f7c[_0x7578('0x5d')][0x2][_0x7578('0x5e')]:undefined)||0xc}];case _0x7578('0x68'):return[{'name':_0x7578('0x69'),'value':_0x227f7c[_0x7578('0x69')]||(_0x227f7c[_0x7578('0x5d')]&&_0x227f7c[_0x7578('0x5d')][0x0]?_0x227f7c['attrs'][0x0][_0x7578('0x5e')]:undefined)||_0x7578('0x6a')},{'name':'attrVoiceQueues','value':_0x227f7c[_0x7578('0x6b')]||(_0x227f7c[_0x7578('0x5d')]&&_0x227f7c[_0x7578('0x5d')][0x1]?_0x227f7c[_0x7578('0x5d')][0x1][_0x7578('0x5e')]:undefined)||[]},{'name':_0x7578('0x67'),'value':_0x227f7c[_0x7578('0x67')]||(_0x227f7c['attrs']&&_0x227f7c['attrs'][0x2]?_0x227f7c['attrs'][0x2][_0x7578('0x5e')]:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0x7578('0x6c'),'value':_0x227f7c[_0x7578('0x6c')]||(_0x227f7c[_0x7578('0x5d')]&&_0x227f7c[_0x7578('0x5d')][0x0]?_0x227f7c[_0x7578('0x5d')][0x0][_0x7578('0x5e')]:undefined)||'total'},{'name':_0x7578('0x6d'),'value':_0x227f7c[_0x7578('0x6d')]||(_0x227f7c[_0x7578('0x5d')]&&_0x227f7c['attrs'][0x1]?_0x227f7c[_0x7578('0x5d')][0x1]['value']:undefined)||null},{'name':_0x7578('0x6e'),'value':_0x227f7c[_0x7578('0x6e')]||(_0x227f7c[_0x7578('0x5d')]&&_0x227f7c[_0x7578('0x5d')][0x2]?_0x227f7c['attrs'][0x2][_0x7578('0x5e')]:undefined)||null},{'name':_0x7578('0x6b'),'value':_0x227f7c['attrVoiceQueues']||(_0x227f7c['attrs']&&_0x227f7c[_0x7578('0x5d')][0x3]?_0x227f7c[_0x7578('0x5d')][0x3][_0x7578('0x5e')]:undefined)||[]}];case _0x7578('0x6f'):return[{'name':_0x7578('0x70'),'type':_0x227f7c[_0x7578('0x71')]||(_0x227f7c[_0x7578('0x5d')]&&_0x227f7c[_0x7578('0x5d')][0x0]?_0x227f7c[_0x7578('0x5d')][0x0][_0x7578('0x36')]:undefined)||null,'value':_0x227f7c['attrReport']||(_0x227f7c['attrs']&&_0x227f7c[_0x7578('0x5d')][0x0]?_0x227f7c[_0x7578('0x5d')][0x0][_0x7578('0x5e')]:undefined)||null},{'name':_0x7578('0x72'),'value':_0x227f7c[_0x7578('0x72')]||(_0x227f7c[_0x7578('0x5d')]&&_0x227f7c[_0x7578('0x5d')][0x1]?_0x227f7c['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x5d1b59){logger[_0x7578('0x2d')](_0x7578('0x73'),JSON[_0x7578('0x74')](_0x5d1b59));return[];}}exports[_0x7578('0x75')]=function(_0x1f9eaf,_0x53b7a9,_0x270545){if(_0x1f9eaf['body']['id']){delete _0x1f9eaf[_0x7578('0x4f')]['id'];}return db[_0x7578('0x33')][_0x7578('0x4d')]({'where':{'id':_0x1f9eaf[_0x7578('0x49')]['id']}})[_0x7578('0x28')](handleEntityNotFound(_0x53b7a9,null))[_0x7578('0x28')](function(_0x589056){if(_0x589056){_0x1f9eaf[_0x7578('0x4f')][_0x7578('0x76')]=_0x589056['id'];_0x1f9eaf[_0x7578('0x4f')][_0x7578('0x5d')]=widgetAttributes(_0x1f9eaf['body']);return db[_0x7578('0x77')]['create'](_0x1f9eaf[_0x7578('0x4f')]);}})[_0x7578('0x28')](respondWithResult(_0x53b7a9,null))['catch'](handleError(_0x53b7a9,null));};exports[_0x7578('0x78')]=function(_0x2541ce,_0x1c98b8,_0x49fbca){var _0x3068b3={};var _0x50629f={};var _0x227d28;var _0x1f64c8;return db[_0x7578('0x33')][_0x7578('0x79')]({'where':{'id':_0x2541ce['params']['id']}})[_0x7578('0x28')](handleEntityNotFound(_0x1c98b8,null))[_0x7578('0x28')](function(_0x5805f2){if(_0x5805f2){_0x227d28=_0x5805f2;_0x50629f['model']=_[_0x7578('0x3a')](db[_0x7578('0x77')][_0x7578('0x34')]);_0x50629f['query']=_[_0x7578('0x3a')](_0x2541ce[_0x7578('0x39')]);_0x50629f[_0x7578('0x3b')]=_[_0x7578('0x3c')](_0x50629f[_0x7578('0x38')],_0x50629f[_0x7578('0x39')]);_0x3068b3[_0x7578('0x3e')]=_[_0x7578('0x3c')](_0x50629f[_0x7578('0x38')],qs['fields'](_0x2541ce['query'][_0x7578('0x3d')]));_0x3068b3['attributes']=_0x3068b3[_0x7578('0x3e')]['length']?_0x3068b3[_0x7578('0x3e')]:_0x50629f['model'];_0x3068b3[_0x7578('0x40')]=qs[_0x7578('0x7a')](_0x2541ce[_0x7578('0x39')][_0x7578('0x7a')]);_0x3068b3['where']=qs['filters'](_[_0x7578('0x42')](_0x2541ce[_0x7578('0x39')],_0x50629f['filters']));if(_0x2541ce[_0x7578('0x39')][_0x7578('0x44')]){_0x3068b3[_0x7578('0x41')]=_[_0x7578('0x43')](_0x3068b3[_0x7578('0x41')],{'$or':_[_0x7578('0x32')](_0x3068b3[_0x7578('0x3e')],function(_0x16eb01){var _0x69f087={};_0x69f087[_0x16eb01]={'$like':'%'+_0x2541ce[_0x7578('0x39')][_0x7578('0x44')]+'%'};return _0x69f087;})});}_0x3068b3=_[_0x7578('0x43')]({},_0x3068b3,_0x2541ce[_0x7578('0x45')]);return _0x227d28['getItems'](_0x3068b3);}})[_0x7578('0x28')](function(_0x532a1d){if(_0x532a1d){_0x1f64c8=_0x532a1d[_0x7578('0x4a')];if(!_0x2541ce[_0x7578('0x39')][_0x7578('0x3f')](_0x7578('0x7b'))){_0x3068b3[_0x7578('0x24')]=qs[_0x7578('0x24')](_0x2541ce['query']['limit']);_0x3068b3[_0x7578('0x23')]=qs['offset'](_0x2541ce['query'][_0x7578('0x23')]);}return _0x227d28[_0x7578('0x78')](_0x3068b3);}})[_0x7578('0x28')](function(_0x308873){if(_0x308873){return _0x308873?{'count':_0x1f64c8,'rows':_0x308873}:null;}})[_0x7578('0x28')](respondWithResult(_0x1c98b8,null))[_0x7578('0x48')](handleError(_0x1c98b8,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 5a7a8ca..9b5c85f 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 _0xce1c=['events','../../mysqldb','Dashboard','setMaxListeners','emit','exports'];(function(_0x2e4a0f,_0x3a9bb6){var _0x25a3cd=function(_0x1c614f){while(--_0x1c614f){_0x2e4a0f['push'](_0x2e4a0f['shift']());}};_0x25a3cd(++_0x3a9bb6);}(_0xce1c,0x162));var _0xcce1=function(_0xc72a72,_0xfaaf35){_0xc72a72=_0xc72a72-0x0;var _0x20f9a9=_0xce1c[_0xc72a72];return _0x20f9a9;};'use strict';var EventEmitter=require(_0xcce1('0x0'));var Dashboard=require(_0xcce1('0x1'))['db'][_0xcce1('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xcce1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5b2e24){return function(_0x320af2,_0x582641,_0xf77506){DashboardEvents['emit'](_0x5b2e24+':'+_0x320af2['id'],_0x320af2);DashboardEvents[_0xcce1('0x4')](_0x5b2e24,_0x320af2);_0xf77506(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xcce1('0x5')]=DashboardEvents; \ No newline at end of file +var _0x574d=['hasOwnProperty','hook','events','../../mysqldb','Dashboard','setMaxListeners','save','remove','emit'];(function(_0x550700,_0x38deaa){var _0x33944a=function(_0x1d1119){while(--_0x1d1119){_0x550700['push'](_0x550700['shift']());}};_0x33944a(++_0x38deaa);}(_0x574d,0x6e));var _0xd574=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x574d[_0x273c39];return _0x46d6b5;};'use strict';var EventEmitter=require(_0xd574('0x0'));var Dashboard=require(_0xd574('0x1'))['db'][_0xd574('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xd574('0x3')](0x0);var events={'afterCreate':_0xd574('0x4'),'afterUpdate':'update','afterDestroy':_0xd574('0x5')};function emitEvent(_0x599d31){return function(_0x21f967,_0x49dd60,_0x597283){DashboardEvents[_0xd574('0x6')](_0x599d31+':'+_0x21f967['id'],_0x21f967);DashboardEvents[_0xd574('0x6')](_0x599d31,_0x21f967);_0x597283(null);};}for(var e in events){if(events[_0xd574('0x7')](e)){var event=events[e];Dashboard[_0xd574('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 6cb7f75..2636296 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 _0x1c63=['rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','lodash','util','moment','bluebird','request-promise','path'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x1c63,0x1b6));var _0x31c6=function(_0x1598fb,_0x29645f){_0x1598fb=_0x1598fb-0x0;var _0x4fae38=_0x1c63[_0x1598fb];return _0x4fae38;};'use strict';var _=require(_0x31c6('0x0'));var util=require(_0x31c6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x31c6('0x2'));var BPromise=require(_0x31c6('0x3'));var rp=require(_0x31c6('0x4'));var fs=require('fs');var path=require(_0x31c6('0x5'));var rimraf=require(_0x31c6('0x6'));var config=require(_0x31c6('0x7'));var attributes=require(_0x31c6('0x8'));module[_0x31c6('0x9')]=function(_0x49016a,_0x53762a){return _0x49016a[_0x31c6('0xa')](_0x31c6('0xb'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa37e=['../../config/environment','./dashboard.attributes','exports','define','lodash','../../config/logger','api','moment','request-promise'];(function(_0x908eb6,_0x59199b){var _0x511a09=function(_0x376c8b){while(--_0x376c8b){_0x908eb6['push'](_0x908eb6['shift']());}};_0x511a09(++_0x59199b);}(_0xa37e,0x148));var _0xea37=function(_0x39e4c4,_0x39b905){_0x39e4c4=_0x39e4c4-0x0;var _0x5c399f=_0xa37e[_0x39e4c4];return _0x5c399f;};'use strict';var _=require(_0xea37('0x0'));var util=require('util');var logger=require(_0xea37('0x1'))(_0xea37('0x2'));var moment=require(_0xea37('0x3'));var BPromise=require('bluebird');var rp=require(_0xea37('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xea37('0x5'));var attributes=require(_0xea37('0x6'));module[_0xea37('0x7')]=function(_0x56613d,_0x5c2738){return _0x56613d[_0xea37('0x8')]('Dashboard',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 2d81412..6825a76 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 _0x7619=['Dashboard,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','request','then','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x30a191,_0x38b23b){var _0xf6f720=function(_0x127ac0){while(--_0x127ac0){_0x30a191['push'](_0x30a191['shift']());}};_0xf6f720(++_0x38b23b);}(_0x7619,0x101));var _0x9761=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7619[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9761('0x0'));var util=require('util');var moment=require(_0x9761('0x1'));var BPromise=require(_0x9761('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9761('0x3'))['db'];var utils=require(_0x9761('0x4'));var logger=require(_0x9761('0x5'))('rpc');var config=require(_0x9761('0x6'));var jayson=require(_0x9761('0x7'));var client=jayson[_0x9761('0x8')]['http']({'port':0x232a});config[_0x9761('0x9')]=_[_0x9761('0xa')](config[_0x9761('0x9')],{'host':_0x9761('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9761('0x9')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x52c82d,_0x20ee09,_0x4c8052){return new BPromise(function(_0x3148a1,_0x162447){return client[_0x9761('0xc')](_0x52c82d,_0x4c8052)[_0x9761('0xd')](function(_0x394bcf){logger['info']('Dashboard,\x20%s,\x20%s',_0x20ee09,_0x9761('0xe'));logger['debug'](_0x9761('0xf'),_0x20ee09,_0x9761('0xe'),JSON[_0x9761('0x10')](_0x394bcf));if(_0x394bcf[_0x9761('0x11')]){if(_0x394bcf[_0x9761('0x11')][_0x9761('0x12')]===0x1f4){logger['error'](_0x9761('0x13'),_0x20ee09,_0x394bcf['error'][_0x9761('0x14')]);return _0x162447(_0x394bcf['error'][_0x9761('0x14')]);}logger[_0x9761('0x11')](_0x9761('0x13'),_0x20ee09,_0x394bcf['error'][_0x9761('0x14')]);return _0x3148a1(_0x394bcf[_0x9761('0x11')][_0x9761('0x14')]);}else{logger['info'](_0x9761('0x13'),_0x20ee09,_0x9761('0xe'));_0x3148a1(_0x394bcf[_0x9761('0x15')]['message']);}})[_0x9761('0x16')](function(_0x56fb70){logger[_0x9761('0x11')](_0x9761('0x13'),_0x20ee09,_0x56fb70);_0x162447(_0x56fb70);});});} \ No newline at end of file +var _0x57c7=['request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','./dashboard.socket'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x57c7,0x12c));var _0x757c=function(_0x44db1f,_0x28676d){_0x44db1f=_0x44db1f-0x0;var _0x3a364f=_0x57c7[_0x44db1f];return _0x3a364f;};'use strict';var _=require(_0x757c('0x0'));var util=require(_0x757c('0x1'));var moment=require(_0x757c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x757c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x757c('0x4'));var logger=require(_0x757c('0x5'))('rpc');var config=require(_0x757c('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x757c('0x7')]({'port':0x232a});config[_0x757c('0x8')]=_[_0x757c('0x9')](config[_0x757c('0x8')],{'host':_0x757c('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x757c('0x8')]));require(_0x757c('0xb'))['register'](socket);function respondWithRpcPromise(_0x143d66,_0x4e39ca,_0x58d68c){return new BPromise(function(_0x5f43c3,_0x3187b5){return client[_0x757c('0xc')](_0x143d66,_0x58d68c)[_0x757c('0xd')](function(_0x104193){logger[_0x757c('0xe')](_0x757c('0xf'),_0x4e39ca,_0x757c('0x10'));logger[_0x757c('0x11')](_0x757c('0x12'),_0x4e39ca,'request\x20sent',JSON[_0x757c('0x13')](_0x104193));if(_0x104193[_0x757c('0x14')]){if(_0x104193[_0x757c('0x14')]['code']===0x1f4){logger[_0x757c('0x14')]('Dashboard,\x20%s,\x20%s',_0x4e39ca,_0x104193[_0x757c('0x14')][_0x757c('0x15')]);return _0x3187b5(_0x104193['error'][_0x757c('0x15')]);}logger[_0x757c('0x14')](_0x757c('0xf'),_0x4e39ca,_0x104193['error'][_0x757c('0x15')]);return _0x5f43c3(_0x104193[_0x757c('0x14')][_0x757c('0x15')]);}else{logger['info'](_0x757c('0xf'),_0x4e39ca,_0x757c('0x10'));_0x5f43c3(_0x104193[_0x757c('0x16')][_0x757c('0x15')]);}})[_0x757c('0x17')](function(_0x9b9679){logger[_0x757c('0x14')]('Dashboard,\x20%s,\x20%s',_0x4e39ca,_0x9b9679);_0x3187b5(_0x9b9679);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index ece689d..ae2eb96 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 _0x8612=['save','remove','update','removeListener','register','length','dashboard:'];(function(_0x4629ba,_0x216410){var _0x876bfd=function(_0x409fd1){while(--_0x409fd1){_0x4629ba['push'](_0x4629ba['shift']());}};_0x876bfd(++_0x216410);}(_0x8612,0xe7));var _0x2861=function(_0x341d43,_0x412ccf){_0x341d43=_0x341d43-0x0;var _0x2c91b7=_0x8612[_0x341d43];return _0x2c91b7;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x2861('0x0'),_0x2861('0x1'),_0x2861('0x2')];function createListener(_0x1c78e0,_0x52fab9){return function(_0x5807db){_0x52fab9['emit'](_0x1c78e0,_0x5807db);};}function removeListener(_0x2bfdbf,_0x167821){return function(){DashboardEvents[_0x2861('0x3')](_0x2bfdbf,_0x167821);};}exports[_0x2861('0x4')]=function(_0x3e7246){for(var _0x5f363a=0x0,_0x331e1c=events[_0x2861('0x5')];_0x5f363a<_0x331e1c;_0x5f363a++){var _0x8982bc=events[_0x5f363a];var _0x25f3f6=createListener(_0x2861('0x6')+_0x8982bc,_0x3e7246);DashboardEvents['on'](_0x8982bc,_0x25f3f6);}}; \ No newline at end of file +var _0xf855=['dashboard:','./dashboard.events','save','remove','update','removeListener','register','length'];(function(_0x48245e,_0x178e51){var _0x4e5e30=function(_0x428bfd){while(--_0x428bfd){_0x48245e['push'](_0x48245e['shift']());}};_0x4e5e30(++_0x178e51);}(_0xf855,0x131));var _0x5f85=function(_0xe7e109,_0x8ea54d){_0xe7e109=_0xe7e109-0x0;var _0x4b993b=_0xf855[_0xe7e109];return _0x4b993b;};'use strict';var DashboardEvents=require(_0x5f85('0x0'));var events=[_0x5f85('0x1'),_0x5f85('0x2'),_0x5f85('0x3')];function createListener(_0xec9af2,_0x5782fe){return function(_0x13b31a){_0x5782fe['emit'](_0xec9af2,_0x13b31a);};}function removeListener(_0x22d9c4,_0x42f4e8){return function(){DashboardEvents[_0x5f85('0x4')](_0x22d9c4,_0x42f4e8);};}exports[_0x5f85('0x5')]=function(_0x164e65){for(var _0x6b20cc=0x0,_0x142b7c=events[_0x5f85('0x6')];_0x6b20cc<_0x142b7c;_0x6b20cc++){var _0xf37059=events[_0x6b20cc];var _0x2f4027=createListener(_0x5f85('0x7')+_0xf37059,_0x164e65);DashboardEvents['on'](_0xf37059,_0x2f4027);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index b2621ad..c1b7fac 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['isAuthenticated','/:id','show','create','post','/:id/clone','/:id/items','addItem','put','delete','destroy','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0xcb91[_0x1cd47d];return _0x29d52f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./dashboard.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/:id/items',auth[_0x1cb9('0x7')](),controller['getItems']);router['post']('/',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xa')]);router[_0x1cb9('0xb')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),controller['clone']);router[_0x1cb9('0xb')](_0x1cb9('0xd'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xe')]);router[_0x1cb9('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1cb9('0x10')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file +var _0xcb91=['isAuthenticated','/:id','show','create','post','/:id/clone','/:id/items','addItem','put','delete','destroy','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x3207a4,_0x1b9024){var _0x5c8dff=function(_0x4611b9){while(--_0x4611b9){_0x3207a4['push'](_0x3207a4['shift']());}};_0x5c8dff(++_0x1b9024);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x257a28,_0x2cd00d){_0x257a28=_0x257a28-0x0;var _0x13bccc=_0xcb91[_0x257a28];return _0x13bccc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./dashboard.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/:id/items',auth[_0x1cb9('0x7')](),controller['getItems']);router['post']('/',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xa')]);router[_0x1cb9('0xb')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),controller['clone']);router[_0x1cb9('0xb')](_0x1cb9('0xd'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xe')]);router[_0x1cb9('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1cb9('0x10')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 68016f2..b8b790f 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 _0x52b5=['squel','lodash','exports','STRING','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#2196f3','sequelize'];(function(_0x4e88c5,_0x3df743){var _0x1494df=function(_0x2fe123){while(--_0x2fe123){_0x4e88c5['push'](_0x4e88c5['shift']());}};_0x1494df(++_0x3df743);}(_0x52b5,0x185));var _0x552b=function(_0x3a6f37,_0x48314b){_0x3a6f37=_0x3a6f37-0x0;var _0x16a05a=_0x52b5[_0x3a6f37];return _0x16a05a;};'use strict';var Sequelize=require(_0x552b('0x0'));var squel=require(_0x552b('0x1'));var _=require(_0x552b('0x2'));module[_0x552b('0x3')]={'title':{'type':Sequelize[_0x552b('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x552b('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x552b('0x5')),'get':function(){try{return JSON[_0x552b('0x6')](this[_0x552b('0x7')](_0x552b('0x8')));}catch(_0x290189){return[];}},'set':function(_0x4f1878){try{this['setDataValue'](_0x552b('0x8'),JSON[_0x552b('0x9')](_0x4f1878));}catch(_0x319493){this[_0x552b('0xa')](_0x552b('0x8'),JSON[_0x552b('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x552b('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x552b('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x552b('0x4')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x552b('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x552b('0x4')]},'titleFontSize':{'type':Sequelize[_0x552b('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0x8470=['long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','lodash','exports','STRING','TEXT'];(function(_0xf67a90,_0x2eb2f3){var _0x648b2=function(_0x298232){while(--_0x298232){_0xf67a90['push'](_0xf67a90['shift']());}};_0x648b2(++_0x2eb2f3);}(_0x8470,0xcd));var _0x0847=function(_0xee0ed4,_0x363639){_0xee0ed4=_0xee0ed4-0x0;var _0x299b24=_0x8470[_0xee0ed4];return _0x299b24;};'use strict';var Sequelize=require(_0x0847('0x0'));var squel=require('squel');var _=require(_0x0847('0x1'));module[_0x0847('0x2')]={'title':{'type':Sequelize[_0x0847('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x0847('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x0847('0x4')](_0x0847('0x5')),'get':function(){try{return JSON[_0x0847('0x6')](this[_0x0847('0x7')](_0x0847('0x8')));}catch(_0x1f4aa6){return[];}},'set':function(_0x73cddf){try{this['setDataValue'](_0x0847('0x8'),JSON['stringify'](_0x73cddf));}catch(_0x17337e){this[_0x0847('0x9')](_0x0847('0x8'),JSON[_0x0847('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x0847('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x0847('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x0847('0xb')]},'col':{'type':Sequelize[_0x0847('0xb')]},'background':{'type':Sequelize[_0x0847('0x3')],'allowNull':![],'defaultValue':_0x0847('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x0847('0x3')],'allowNull':![],'defaultValue':_0x0847('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x0847('0x3')]},'titleFontSize':{'type':Sequelize[_0x0847('0xb')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 8bc58d2..51e396f 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 _0xe8c7=['sox','to-csv','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','count','offset','set','Content-Range','save','then','destroy','stack','name','send','show','params','model','keys','DashboardItem','query','filters','attributes','intersection','fields','length','includeAll','include','options','find','type','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','catch','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1b7543,_0x40ba53){var _0x5db777=function(_0x145cd1){while(--_0x145cd1){_0x1b7543['push'](_0x1b7543['shift']());}};_0x5db777(++_0x40ba53);}(_0xe8c7,0x144));var _0x7e8c=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xe8c7[_0x3e112d];return _0x531c31;};'use strict';var pdf=require(_0x7e8c('0x0'));var emlformat=require(_0x7e8c('0x1'));var rimraf=require(_0x7e8c('0x2'));var zipdir=require(_0x7e8c('0x3'));var jsonpatch=require(_0x7e8c('0x4'));var rp=require(_0x7e8c('0x5'));var moment=require(_0x7e8c('0x6'));var BPromise=require(_0x7e8c('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7e8c('0x8'));var csv=require(_0x7e8c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7e8c('0xa'));var crypto=require('crypto');var jsforce=require(_0x7e8c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7e8c('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7e8c('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x7e8c('0xd'));var as=require(_0x7e8c('0xe'));var hardwareService=require(_0x7e8c('0xf'));var logger=require(_0x7e8c('0x10'))(_0x7e8c('0x11'));var utils=require(_0x7e8c('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x7e8c('0x13'));var db=require(_0x7e8c('0x14'))['db'];config[_0x7e8c('0x15')]=_['defaults'](config[_0x7e8c('0x15')],{'host':_0x7e8c('0x16'),'port':0x18eb});var socket=require(_0x7e8c('0x17'))(new Redis(config['redis']));require(_0x7e8c('0x18'))[_0x7e8c('0x19')](socket);function respondWithStatusCode(_0x444e34,_0x3b7869){_0x3b7869=_0x3b7869||0xcc;return function(_0x2f6bea){if(_0x2f6bea){return _0x444e34[_0x7e8c('0x1a')](_0x3b7869);}return _0x444e34['status'](_0x3b7869)[_0x7e8c('0x1b')]();};}function respondWithResult(_0x428a8a,_0x3766fb){_0x3766fb=_0x3766fb||0xc8;return function(_0x1912dc){if(_0x1912dc){return _0x428a8a[_0x7e8c('0x1c')](_0x3766fb)['json'](_0x1912dc);}};}function respondWithFilteredResult(_0x1a4001,_0x3d7355){return function(_0x3889cc){if(_0x3889cc){var _0x136638=_0x3889cc[_0x7e8c('0x1d')],_0xeb13a=_0x3d7355['offset'],_0x4443a1=_0x3d7355[_0x7e8c('0x1e')]+_0x3d7355['limit'],_0x92fec6;if(_0x4443a1>=_0x136638){_0x4443a1=_0x136638;_0x92fec6=0xc8;}else{_0x92fec6=0xce;}_0x1a4001[_0x7e8c('0x1c')](_0x92fec6);return _0x1a4001[_0x7e8c('0x1f')](_0x7e8c('0x20'),_0xeb13a+'-'+_0x4443a1+'/'+_0x136638)['json'](_0x3889cc);}return null;};}function patchUpdates(_0xae4a18){return function(_0x35e31a){try{jsonpatch['apply'](_0x35e31a,_0xae4a18,!![]);}catch(_0x259dfe){return BPromise['reject'](_0x259dfe);}return _0x35e31a[_0x7e8c('0x21')]();};}function saveUpdates(_0x4f7d07,_0x34b789){return function(_0x5d69ef){if(_0x5d69ef){return _0x5d69ef['update'](_0x4f7d07)[_0x7e8c('0x22')](function(_0x343f0b){return _0x343f0b;});}return null;};}function removeEntity(_0x479093,_0x3ab802){return function(_0x4322cb){if(_0x4322cb){return _0x4322cb[_0x7e8c('0x23')]()['then'](function(){_0x479093['status'](0xcc)[_0x7e8c('0x1b')]();});}};}function handleEntityNotFound(_0x54bcb2,_0x432387){return function(_0xc46879){if(!_0xc46879){_0x54bcb2[_0x7e8c('0x1a')](0x194);}return _0xc46879;};}function handleError(_0x493fc3,_0x206e19){_0x206e19=_0x206e19||0x1f4;return function(_0x52fbe3){logger['error'](_0x52fbe3[_0x7e8c('0x24')]);if(_0x52fbe3[_0x7e8c('0x25')]){delete _0x52fbe3['name'];}_0x493fc3[_0x7e8c('0x1c')](_0x206e19)[_0x7e8c('0x26')](_0x52fbe3);};}exports[_0x7e8c('0x27')]=function(_0x44c8b0,_0x1e2a9c){var _0xaedad6={'raw':![],'where':{'id':_0x44c8b0[_0x7e8c('0x28')]['id']}},_0x11994f={};_0x11994f[_0x7e8c('0x29')]=_[_0x7e8c('0x2a')](db[_0x7e8c('0x2b')]['rawAttributes']);_0x11994f[_0x7e8c('0x2c')]=_[_0x7e8c('0x2a')](_0x44c8b0[_0x7e8c('0x2c')]);_0x11994f[_0x7e8c('0x2d')]=_['intersection'](_0x11994f[_0x7e8c('0x29')],_0x11994f[_0x7e8c('0x2c')]);_0xaedad6[_0x7e8c('0x2e')]=_[_0x7e8c('0x2f')](_0x11994f[_0x7e8c('0x29')],qs[_0x7e8c('0x30')](_0x44c8b0[_0x7e8c('0x2c')][_0x7e8c('0x30')]));_0xaedad6['attributes']=_0xaedad6[_0x7e8c('0x2e')][_0x7e8c('0x31')]?_0xaedad6[_0x7e8c('0x2e')]:_0x11994f[_0x7e8c('0x29')];if(_0x44c8b0[_0x7e8c('0x2c')][_0x7e8c('0x32')]){_0xaedad6[_0x7e8c('0x33')]=[{'all':!![]}];}_0xaedad6=_['merge']({},_0xaedad6,_0x44c8b0[_0x7e8c('0x34')]);return db[_0x7e8c('0x2b')][_0x7e8c('0x35')](_0xaedad6)[_0x7e8c('0x22')](handleEntityNotFound(_0x1e2a9c,null))[_0x7e8c('0x22')](respondWithResult(_0x1e2a9c,null))['catch'](handleError(_0x1e2a9c,null));};exports[_0x7e8c('0x23')]=function(_0x313303,_0x1e7620){return db['DashboardItem'][_0x7e8c('0x35')]({'where':{'id':_0x313303[_0x7e8c('0x28')]['id']}})[_0x7e8c('0x22')](handleEntityNotFound(_0x1e7620,null))['then'](removeEntity(_0x1e7620,null))['catch'](handleError(_0x1e7620,null));};function widgetAttributes(_0x3e2515){try{switch(_0x3e2515[_0x7e8c('0x36')]){case'iframe':return[{'name':_0x7e8c('0x37'),'value':_0x3e2515[_0x7e8c('0x37')]||(_0x3e2515['attrs']&&_0x3e2515[_0x7e8c('0x38')][0x0]?_0x3e2515['attrs'][0x0]['value']:undefined)||'https://'}];case _0x7e8c('0x39'):return[{'name':'attrPath','value':_0x3e2515[_0x7e8c('0x3a')]||(_0x3e2515[_0x7e8c('0x38')]&&_0x3e2515[_0x7e8c('0x38')][0x0]?_0x3e2515['attrs'][0x0][_0x7e8c('0x3b')]:undefined)||''}];case _0x7e8c('0x3c'):return[{'name':_0x7e8c('0x3d'),'value':_0x3e2515[_0x7e8c('0x3d')]||(_0x3e2515[_0x7e8c('0x38')]&&_0x3e2515[_0x7e8c('0x38')][0x0]?_0x3e2515[_0x7e8c('0x38')][0x0]['value']:undefined)||_0x7e8c('0x3e')},{'name':_0x7e8c('0x3f'),'value':_0x3e2515[_0x7e8c('0x3f')]||(_0x3e2515['attrs']&&_0x3e2515[_0x7e8c('0x38')][0x1]?_0x3e2515['attrs'][0x1][_0x7e8c('0x3b')]:undefined)||_0x7e8c('0x40')},{'name':_0x7e8c('0x41'),'value':_0x3e2515[_0x7e8c('0x41')]||(_0x3e2515['attrs']&&_0x3e2515['attrs'][0x2]?_0x3e2515['attrs'][0x2][_0x7e8c('0x3b')]:undefined)||0xc}];case'counter':return[{'name':_0x7e8c('0x42'),'value':_0x3e2515[_0x7e8c('0x42')]||(_0x3e2515['attrs']&&_0x3e2515[_0x7e8c('0x38')][0x0]?_0x3e2515['attrs'][0x0][_0x7e8c('0x3b')]:undefined)||_0x7e8c('0x43')},{'name':_0x7e8c('0x44'),'value':_0x3e2515[_0x7e8c('0x44')]||(_0x3e2515['attrs']&&_0x3e2515[_0x7e8c('0x38')][0x1]?_0x3e2515[_0x7e8c('0x38')][0x1][_0x7e8c('0x3b')]:undefined)||[]},{'name':_0x7e8c('0x41'),'value':_0x3e2515[_0x7e8c('0x41')]||(_0x3e2515[_0x7e8c('0x38')]&&_0x3e2515[_0x7e8c('0x38')][0x2]?_0x3e2515[_0x7e8c('0x38')][0x2][_0x7e8c('0x3b')]:undefined)||0x14}];case'multibar-chart':case _0x7e8c('0x45'):return[{'name':'attrSerie1','value':_0x3e2515[_0x7e8c('0x46')]||(_0x3e2515['attrs']&&_0x3e2515['attrs'][0x0]?_0x3e2515[_0x7e8c('0x38')][0x0]['value']:undefined)||'total'},{'name':_0x7e8c('0x47'),'value':_0x3e2515[_0x7e8c('0x47')]||(_0x3e2515[_0x7e8c('0x38')]&&_0x3e2515[_0x7e8c('0x38')][0x1]?_0x3e2515[_0x7e8c('0x38')][0x1][_0x7e8c('0x3b')]:undefined)||null},{'name':_0x7e8c('0x48'),'value':_0x3e2515['attrSerie3']||(_0x3e2515[_0x7e8c('0x38')]&&_0x3e2515[_0x7e8c('0x38')][0x2]?_0x3e2515[_0x7e8c('0x38')][0x2][_0x7e8c('0x3b')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x3e2515[_0x7e8c('0x44')]||(_0x3e2515[_0x7e8c('0x38')]&&_0x3e2515[_0x7e8c('0x38')][0x3]?_0x3e2515['attrs'][0x3][_0x7e8c('0x3b')]:undefined)||[]}];case'web-report':return[{'name':_0x7e8c('0x49'),'type':_0x3e2515[_0x7e8c('0x4a')]||(_0x3e2515[_0x7e8c('0x38')]&&_0x3e2515['attrs'][0x0]?_0x3e2515['attrs'][0x0][_0x7e8c('0x36')]:undefined)||null,'value':_0x3e2515[_0x7e8c('0x49')]||(_0x3e2515[_0x7e8c('0x38')]&&_0x3e2515['attrs'][0x0]?_0x3e2515[_0x7e8c('0x38')][0x0][_0x7e8c('0x3b')]:undefined)||null},{'name':_0x7e8c('0x4b'),'value':_0x3e2515['attrRefresh']||(_0x3e2515[_0x7e8c('0x38')]&&_0x3e2515[_0x7e8c('0x38')][0x1]?_0x3e2515[_0x7e8c('0x38')][0x1][_0x7e8c('0x3b')]:undefined)||0x0}];default:return[];}}catch(_0x5a4965){logger[_0x7e8c('0x4c')](_0x7e8c('0x4d'),JSON[_0x7e8c('0x4e')](_0x5a4965));return[];}}exports[_0x7e8c('0x4f')]=function(_0x51c37c,_0x7e0c9b){if(_0x51c37c[_0x7e8c('0x50')]){_0x51c37c[_0x7e8c('0x50')]['attrs']=widgetAttributes(_0x51c37c[_0x7e8c('0x50')]);}return db[_0x7e8c('0x2b')]['create'](_0x51c37c[_0x7e8c('0x50')],{})['then'](respondWithResult(_0x7e0c9b,0xc9))[_0x7e8c('0x51')](handleError(_0x7e0c9b,null));};exports[_0x7e8c('0x52')]=function(_0x27a81f,_0x4e5e9f){if(_0x27a81f['body']['id']){delete _0x27a81f[_0x7e8c('0x50')]['id'];}_0x27a81f['body'][_0x7e8c('0x38')]=widgetAttributes(_0x27a81f[_0x7e8c('0x50')]);return db['DashboardItem'][_0x7e8c('0x35')]({'where':{'id':_0x27a81f[_0x7e8c('0x28')]['id']}})['then'](handleEntityNotFound(_0x4e5e9f,null))[_0x7e8c('0x22')](saveUpdates(_0x27a81f[_0x7e8c('0x50')],null))[_0x7e8c('0x22')](respondWithResult(_0x4e5e9f,null))['catch'](handleError(_0x4e5e9f,null));}; \ No newline at end of file +var _0xa0e2=['attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','type','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','html-pdf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','sendStatus','error','name','send','params','model','keys','DashboardItem','rawAttributes','filters','intersection','query','fields','attributes','length','merge','options','find','catch','destroy','attrs','value','https://','custom','attrPath','clock'];(function(_0x1d00b6,_0x2c2ec9){var _0x5e2a86=function(_0x2f7cde){while(--_0x2f7cde){_0x1d00b6['push'](_0x1d00b6['shift']());}};_0x5e2a86(++_0x2c2ec9);}(_0xa0e2,0x112));var _0x2a0e=function(_0x403ae5,_0x364433){_0x403ae5=_0x403ae5-0x0;var _0x496fe1=_0xa0e2[_0x403ae5];return _0x496fe1;};'use strict';var pdf=require(_0x2a0e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2a0e('0x1'));var rp=require('request-promise');var moment=require(_0x2a0e('0x2'));var BPromise=require(_0x2a0e('0x3'));var Mustache=require(_0x2a0e('0x4'));var util=require(_0x2a0e('0x5'));var path=require(_0x2a0e('0x6'));var sox=require(_0x2a0e('0x7'));var csv=require(_0x2a0e('0x8'));var ejs=require(_0x2a0e('0x9'));var fs=require('fs');var _=require(_0x2a0e('0xa'));var squel=require(_0x2a0e('0xb'));var crypto=require('crypto');var jsforce=require(_0x2a0e('0xc'));var deskjs=require(_0x2a0e('0xd'));var toCsv=require(_0x2a0e('0x8'));var querystring=require('querystring');var Papa=require(_0x2a0e('0xe'));var Redis=require('ioredis');var authService=require(_0x2a0e('0xf'));var qs=require(_0x2a0e('0x10'));var as=require(_0x2a0e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a0e('0x12'))(_0x2a0e('0x13'));var utils=require(_0x2a0e('0x14'));var config=require(_0x2a0e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a0e('0x16'))['db'];config[_0x2a0e('0x17')]=_[_0x2a0e('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2a0e('0x19'))(new Redis(config['redis']));require(_0x2a0e('0x1a'))[_0x2a0e('0x1b')](socket);function respondWithStatusCode(_0x56294e,_0x45d8c7){_0x45d8c7=_0x45d8c7||0xcc;return function(_0x4d6322){if(_0x4d6322){return _0x56294e['sendStatus'](_0x45d8c7);}return _0x56294e[_0x2a0e('0x1c')](_0x45d8c7)[_0x2a0e('0x1d')]();};}function respondWithResult(_0x49521f,_0xd2ff3b){_0xd2ff3b=_0xd2ff3b||0xc8;return function(_0x336382){if(_0x336382){return _0x49521f[_0x2a0e('0x1c')](_0xd2ff3b)[_0x2a0e('0x1e')](_0x336382);}};}function respondWithFilteredResult(_0x536964,_0x5c55a8){return function(_0xc4f1ff){if(_0xc4f1ff){var _0x4c0838=_0xc4f1ff[_0x2a0e('0x1f')],_0x38b6ab=_0x5c55a8[_0x2a0e('0x20')],_0x199f09=_0x5c55a8[_0x2a0e('0x20')]+_0x5c55a8[_0x2a0e('0x21')],_0x1db50a;if(_0x199f09>=_0x4c0838){_0x199f09=_0x4c0838;_0x1db50a=0xc8;}else{_0x1db50a=0xce;}_0x536964[_0x2a0e('0x1c')](_0x1db50a);return _0x536964[_0x2a0e('0x22')](_0x2a0e('0x23'),_0x38b6ab+'-'+_0x199f09+'/'+_0x4c0838)[_0x2a0e('0x1e')](_0xc4f1ff);}return null;};}function patchUpdates(_0x3793a8){return function(_0x189550){try{jsonpatch[_0x2a0e('0x24')](_0x189550,_0x3793a8,!![]);}catch(_0x3da5c7){return BPromise['reject'](_0x3da5c7);}return _0x189550[_0x2a0e('0x25')]();};}function saveUpdates(_0xb84a97,_0x3f6c21){return function(_0x2a7c4e){if(_0x2a7c4e){return _0x2a7c4e[_0x2a0e('0x26')](_0xb84a97)[_0x2a0e('0x27')](function(_0x3b387a){return _0x3b387a;});}return null;};}function removeEntity(_0x2e1c61,_0x471473){return function(_0x427f10){if(_0x427f10){return _0x427f10['destroy']()[_0x2a0e('0x27')](function(){_0x2e1c61['status'](0xcc)[_0x2a0e('0x1d')]();});}};}function handleEntityNotFound(_0x5cbb8c,_0x4e5dd1){return function(_0x1b7115){if(!_0x1b7115){_0x5cbb8c[_0x2a0e('0x28')](0x194);}return _0x1b7115;};}function handleError(_0x2cbc85,_0x24dc27){_0x24dc27=_0x24dc27||0x1f4;return function(_0x42e8b1){logger[_0x2a0e('0x29')](_0x42e8b1['stack']);if(_0x42e8b1[_0x2a0e('0x2a')]){delete _0x42e8b1[_0x2a0e('0x2a')];}_0x2cbc85['status'](_0x24dc27)[_0x2a0e('0x2b')](_0x42e8b1);};}exports['show']=function(_0x168097,_0x3a7285){var _0x16dfef={'raw':![],'where':{'id':_0x168097[_0x2a0e('0x2c')]['id']}},_0x387811={};_0x387811[_0x2a0e('0x2d')]=_[_0x2a0e('0x2e')](db[_0x2a0e('0x2f')][_0x2a0e('0x30')]);_0x387811['query']=_[_0x2a0e('0x2e')](_0x168097['query']);_0x387811[_0x2a0e('0x31')]=_[_0x2a0e('0x32')](_0x387811[_0x2a0e('0x2d')],_0x387811[_0x2a0e('0x33')]);_0x16dfef['attributes']=_[_0x2a0e('0x32')](_0x387811['model'],qs['fields'](_0x168097[_0x2a0e('0x33')][_0x2a0e('0x34')]));_0x16dfef['attributes']=_0x16dfef[_0x2a0e('0x35')][_0x2a0e('0x36')]?_0x16dfef[_0x2a0e('0x35')]:_0x387811['model'];if(_0x168097[_0x2a0e('0x33')]['includeAll']){_0x16dfef['include']=[{'all':!![]}];}_0x16dfef=_[_0x2a0e('0x37')]({},_0x16dfef,_0x168097[_0x2a0e('0x38')]);return db[_0x2a0e('0x2f')][_0x2a0e('0x39')](_0x16dfef)[_0x2a0e('0x27')](handleEntityNotFound(_0x3a7285,null))[_0x2a0e('0x27')](respondWithResult(_0x3a7285,null))[_0x2a0e('0x3a')](handleError(_0x3a7285,null));};exports[_0x2a0e('0x3b')]=function(_0x5312c0,_0x48f3f6){return db['DashboardItem'][_0x2a0e('0x39')]({'where':{'id':_0x5312c0[_0x2a0e('0x2c')]['id']}})[_0x2a0e('0x27')](handleEntityNotFound(_0x48f3f6,null))[_0x2a0e('0x27')](removeEntity(_0x48f3f6,null))[_0x2a0e('0x3a')](handleError(_0x48f3f6,null));};function widgetAttributes(_0x2d586c){try{switch(_0x2d586c['type']){case'iframe':return[{'name':'attrUrl','value':_0x2d586c['attrUrl']||(_0x2d586c['attrs']&&_0x2d586c[_0x2a0e('0x3c')][0x0]?_0x2d586c['attrs'][0x0][_0x2a0e('0x3d')]:undefined)||_0x2a0e('0x3e')}];case _0x2a0e('0x3f'):return[{'name':_0x2a0e('0x40'),'value':_0x2d586c[_0x2a0e('0x40')]||(_0x2d586c['attrs']&&_0x2d586c[_0x2a0e('0x3c')][0x0]?_0x2d586c[_0x2a0e('0x3c')][0x0][_0x2a0e('0x3d')]:undefined)||''}];case _0x2a0e('0x41'):return[{'name':'attrHourFormat','value':_0x2d586c[_0x2a0e('0x42')]||(_0x2d586c[_0x2a0e('0x3c')]&&_0x2d586c[_0x2a0e('0x3c')][0x0]?_0x2d586c[_0x2a0e('0x3c')][0x0][_0x2a0e('0x3d')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x2d586c[_0x2a0e('0x43')]||(_0x2d586c[_0x2a0e('0x3c')]&&_0x2d586c[_0x2a0e('0x3c')][0x1]?_0x2d586c[_0x2a0e('0x3c')][0x1][_0x2a0e('0x3d')]:undefined)||'0.00'},{'name':_0x2a0e('0x44'),'value':_0x2d586c[_0x2a0e('0x44')]||(_0x2d586c['attrs']&&_0x2d586c[_0x2a0e('0x3c')][0x2]?_0x2d586c[_0x2a0e('0x3c')][0x2][_0x2a0e('0x3d')]:undefined)||0xc}];case _0x2a0e('0x45'):return[{'name':_0x2a0e('0x46'),'value':_0x2d586c[_0x2a0e('0x46')]||(_0x2d586c[_0x2a0e('0x3c')]&&_0x2d586c[_0x2a0e('0x3c')][0x0]?_0x2d586c[_0x2a0e('0x3c')][0x0]['value']:undefined)||_0x2a0e('0x47')},{'name':_0x2a0e('0x48'),'value':_0x2d586c[_0x2a0e('0x48')]||(_0x2d586c[_0x2a0e('0x3c')]&&_0x2d586c[_0x2a0e('0x3c')][0x1]?_0x2d586c[_0x2a0e('0x3c')][0x1][_0x2a0e('0x3d')]:undefined)||[]},{'name':'attrFontSize','value':_0x2d586c['attrFontSize']||(_0x2d586c[_0x2a0e('0x3c')]&&_0x2d586c[_0x2a0e('0x3c')][0x2]?_0x2d586c[_0x2a0e('0x3c')][0x2][_0x2a0e('0x3d')]:undefined)||0x14}];case _0x2a0e('0x49'):case'pie-chart':return[{'name':_0x2a0e('0x4a'),'value':_0x2d586c[_0x2a0e('0x4a')]||(_0x2d586c[_0x2a0e('0x3c')]&&_0x2d586c[_0x2a0e('0x3c')][0x0]?_0x2d586c['attrs'][0x0][_0x2a0e('0x3d')]:undefined)||_0x2a0e('0x47')},{'name':_0x2a0e('0x4b'),'value':_0x2d586c[_0x2a0e('0x4b')]||(_0x2d586c['attrs']&&_0x2d586c['attrs'][0x1]?_0x2d586c[_0x2a0e('0x3c')][0x1]['value']:undefined)||null},{'name':_0x2a0e('0x4c'),'value':_0x2d586c[_0x2a0e('0x4c')]||(_0x2d586c[_0x2a0e('0x3c')]&&_0x2d586c[_0x2a0e('0x3c')][0x2]?_0x2d586c[_0x2a0e('0x3c')][0x2]['value']:undefined)||null},{'name':_0x2a0e('0x48'),'value':_0x2d586c[_0x2a0e('0x48')]||(_0x2d586c[_0x2a0e('0x3c')]&&_0x2d586c[_0x2a0e('0x3c')][0x3]?_0x2d586c['attrs'][0x3]['value']:undefined)||[]}];case _0x2a0e('0x4d'):return[{'name':_0x2a0e('0x4e'),'type':_0x2d586c['reportType']||(_0x2d586c[_0x2a0e('0x3c')]&&_0x2d586c[_0x2a0e('0x3c')][0x0]?_0x2d586c[_0x2a0e('0x3c')][0x0][_0x2a0e('0x4f')]:undefined)||null,'value':_0x2d586c['attrReport']||(_0x2d586c[_0x2a0e('0x3c')]&&_0x2d586c[_0x2a0e('0x3c')][0x0]?_0x2d586c[_0x2a0e('0x3c')][0x0][_0x2a0e('0x3d')]:undefined)||null},{'name':_0x2a0e('0x50'),'value':_0x2d586c['attrRefresh']||(_0x2d586c[_0x2a0e('0x3c')]&&_0x2d586c[_0x2a0e('0x3c')][0x1]?_0x2d586c[_0x2a0e('0x3c')][0x1][_0x2a0e('0x3d')]:undefined)||0x0}];default:return[];}}catch(_0xed3528){logger[_0x2a0e('0x29')](_0x2a0e('0x51'),JSON[_0x2a0e('0x52')](_0xed3528));return[];}}exports[_0x2a0e('0x53')]=function(_0x5471d9,_0x46e425){if(_0x5471d9[_0x2a0e('0x54')]){_0x5471d9['body'][_0x2a0e('0x3c')]=widgetAttributes(_0x5471d9[_0x2a0e('0x54')]);}return db[_0x2a0e('0x2f')][_0x2a0e('0x53')](_0x5471d9[_0x2a0e('0x54')],{})[_0x2a0e('0x27')](respondWithResult(_0x46e425,0xc9))[_0x2a0e('0x3a')](handleError(_0x46e425,null));};exports[_0x2a0e('0x26')]=function(_0x99c4e9,_0x11a6f7){if(_0x99c4e9[_0x2a0e('0x54')]['id']){delete _0x99c4e9[_0x2a0e('0x54')]['id'];}_0x99c4e9[_0x2a0e('0x54')][_0x2a0e('0x3c')]=widgetAttributes(_0x99c4e9[_0x2a0e('0x54')]);return db[_0x2a0e('0x2f')][_0x2a0e('0x39')]({'where':{'id':_0x99c4e9[_0x2a0e('0x2c')]['id']}})[_0x2a0e('0x27')](handleEntityNotFound(_0x11a6f7,null))['then'](saveUpdates(_0x99c4e9[_0x2a0e('0x54')],null))[_0x2a0e('0x27')](respondWithResult(_0x11a6f7,null))[_0x2a0e('0x3a')](handleError(_0x11a6f7,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index a42abb1..4623c0c 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 _0xcecb=['events','setMaxListeners','save','update','remove','emit'];(function(_0xd9f102,_0x5a0d28){var _0x2652e4=function(_0x5021a1){while(--_0x5021a1){_0xd9f102['push'](_0xd9f102['shift']());}};_0x2652e4(++_0x5a0d28);}(_0xcecb,0xfc));var _0xbcec=function(_0x17cfb8,_0x48fd7f){_0x17cfb8=_0x17cfb8-0x0;var _0x481555=_0xcecb[_0x17cfb8];return _0x481555;};'use strict';var EventEmitter=require(_0xbcec('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xbcec('0x1')](0x0);var events={'afterCreate':_0xbcec('0x2'),'afterUpdate':_0xbcec('0x3'),'afterDestroy':_0xbcec('0x4')};function emitEvent(_0xb3aba8){return function(_0x499a60,_0x5e9a87,_0xcaca65){DashboardItemEvents[_0xbcec('0x5')](_0xb3aba8+':'+_0x499a60['id'],_0x499a60);DashboardItemEvents['emit'](_0xb3aba8,_0x499a60);_0xcaca65(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xd3fe=['setMaxListeners','save','update','remove','emit','hook','exports','../../mysqldb','DashboardItem'];(function(_0x2c0ac2,_0x41923c){var _0x1b9f94=function(_0x53af45){while(--_0x53af45){_0x2c0ac2['push'](_0x2c0ac2['shift']());}};_0x1b9f94(++_0x41923c);}(_0xd3fe,0xb2));var _0xed3f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3fe[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xed3f('0x0'))['db'][_0xed3f('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xed3f('0x2')](0x0);var events={'afterCreate':_0xed3f('0x3'),'afterUpdate':_0xed3f('0x4'),'afterDestroy':_0xed3f('0x5')};function emitEvent(_0x23c5dd){return function(_0x1d6d87,_0x131012,_0x729c2f){DashboardItemEvents[_0xed3f('0x6')](_0x23c5dd+':'+_0x1d6d87['id'],_0x1d6d87);DashboardItemEvents[_0xed3f('0x6')](_0x23c5dd,_0x1d6d87);_0x729c2f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xed3f('0x7')](e,emitEvent(event));}}module[_0xed3f('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 234cb1c..12e3fea 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 _0x3e6b=['exports','DashboardItem','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./dashboardItem.attributes'];(function(_0x1e7aec,_0x468cd3){var _0x19b3f9=function(_0x293fe5){while(--_0x293fe5){_0x1e7aec['push'](_0x1e7aec['shift']());}};_0x19b3f9(++_0x468cd3);}(_0x3e6b,0x18e));var _0xb3e6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3e6b[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xb3e6('0x0'));var util=require('util');var logger=require(_0xb3e6('0x1'))(_0xb3e6('0x2'));var moment=require(_0xb3e6('0x3'));var BPromise=require(_0xb3e6('0x4'));var rp=require(_0xb3e6('0x5'));var fs=require('fs');var path=require(_0xb3e6('0x6'));var rimraf=require(_0xb3e6('0x7'));var config=require('../../config/environment');var attributes=require(_0xb3e6('0x8'));module[_0xb3e6('0x9')]=function(_0x3b4cef,_0x4c253c){return _0x3b4cef['define'](_0xb3e6('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb9d=['request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports','dashboard_items','lodash','../../config/logger','moment','bluebird'];(function(_0xc40620,_0x3b2d17){var _0x3ea6f9=function(_0x186426){while(--_0x186426){_0xc40620['push'](_0xc40620['shift']());}};_0x3ea6f9(++_0x3b2d17);}(_0xcb9d,0x1f0));var _0xdcb9=function(_0x43e372,_0x189ca3){_0x43e372=_0x43e372-0x0;var _0x5f3063=_0xcb9d[_0x43e372];return _0x5f3063;};'use strict';var _=require(_0xdcb9('0x0'));var util=require('util');var logger=require(_0xdcb9('0x1'))('api');var moment=require(_0xdcb9('0x2'));var BPromise=require(_0xdcb9('0x3'));var rp=require(_0xdcb9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdcb9('0x5'));var config=require(_0xdcb9('0x6'));var attributes=require(_0xdcb9('0x7'));module[_0xdcb9('0x8')]=function(_0x564496,_0x8f7e3f){return _0x564496['define']('DashboardItem',attributes,{'tableName':_0xdcb9('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 2903d3f..50a63af 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 _0xa1ee=['debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request\x20sent'];(function(_0x369c70,_0x5892f0){var _0xb7e463=function(_0x3822c8){while(--_0x3822c8){_0x369c70['push'](_0x369c70['shift']());}};_0xb7e463(++_0x5892f0);}(_0xa1ee,0x1ed));var _0xea1e=function(_0xb7b878,_0x5c3b92){_0xb7b878=_0xb7b878-0x0;var _0x3c84b9=_0xa1ee[_0xb7b878];return _0x3c84b9;};'use strict';var _=require(_0xea1e('0x0'));var util=require(_0xea1e('0x1'));var moment=require(_0xea1e('0x2'));var BPromise=require(_0xea1e('0x3'));var rs=require(_0xea1e('0x4'));var fs=require('fs');var Redis=require(_0xea1e('0x5'));var db=require(_0xea1e('0x6'))['db'];var utils=require(_0xea1e('0x7'));var logger=require(_0xea1e('0x8'))(_0xea1e('0x9'));var config=require(_0xea1e('0xa'));var jayson=require(_0xea1e('0xb'));var client=jayson[_0xea1e('0xc')]['http']({'port':0x232a});config[_0xea1e('0xd')]=_[_0xea1e('0xe')](config[_0xea1e('0xd')],{'host':_0xea1e('0xf'),'port':0x18eb});var socket=require(_0xea1e('0x10'))(new Redis(config['redis']));require(_0xea1e('0x11'))[_0xea1e('0x12')](socket);function respondWithRpcPromise(_0x3c139c,_0x205401,_0x3d6e99){return new BPromise(function(_0xde3790,_0x58bbca){return client['request'](_0x3c139c,_0x3d6e99)['then'](function(_0x2b473b){logger['info']('DashboardItem,\x20%s,\x20%s',_0x205401,_0xea1e('0x13'));logger[_0xea1e('0x14')](_0xea1e('0x15'),_0x205401,'request\x20sent',JSON[_0xea1e('0x16')](_0x2b473b));if(_0x2b473b[_0xea1e('0x17')]){if(_0x2b473b[_0xea1e('0x17')][_0xea1e('0x18')]===0x1f4){logger[_0xea1e('0x17')](_0xea1e('0x19'),_0x205401,_0x2b473b[_0xea1e('0x17')][_0xea1e('0x1a')]);return _0x58bbca(_0x2b473b[_0xea1e('0x17')][_0xea1e('0x1a')]);}logger['error'](_0xea1e('0x19'),_0x205401,_0x2b473b[_0xea1e('0x17')][_0xea1e('0x1a')]);return _0xde3790(_0x2b473b[_0xea1e('0x17')][_0xea1e('0x1a')]);}else{logger['info'](_0xea1e('0x19'),_0x205401,_0xea1e('0x13'));_0xde3790(_0x2b473b['result'][_0xea1e('0x1a')]);}})['catch'](function(_0x3c8132){logger[_0xea1e('0x17')](_0xea1e('0x19'),_0x205401,_0x3c8132);_0x58bbca(_0x3c8132);});});} \ No newline at end of file +var _0xcf69=['code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./dashboardItem.socket','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x4179b3,_0x2eaff2){var _0x5b5c7e=function(_0x568341){while(--_0x568341){_0x4179b3['push'](_0x4179b3['shift']());}};_0x5b5c7e(++_0x2eaff2);}(_0xcf69,0x194));var _0x9cf6=function(_0x310d9e,_0x885baa){_0x310d9e=_0x310d9e-0x0;var _0x57551c=_0xcf69[_0x310d9e];return _0x57551c;};'use strict';var _=require('lodash');var util=require(_0x9cf6('0x0'));var moment=require(_0x9cf6('0x1'));var BPromise=require(_0x9cf6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cf6('0x3'));var db=require(_0x9cf6('0x4'))['db'];var utils=require(_0x9cf6('0x5'));var logger=require(_0x9cf6('0x6'))('rpc');var config=require(_0x9cf6('0x7'));var jayson=require(_0x9cf6('0x8'));var client=jayson[_0x9cf6('0x9')]['http']({'port':0x232a});config[_0x9cf6('0xa')]=_[_0x9cf6('0xb')](config[_0x9cf6('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x9cf6('0xc'))(new Redis(config[_0x9cf6('0xa')]));require(_0x9cf6('0xd'))['register'](socket);function respondWithRpcPromise(_0x153ccb,_0x5517a8,_0x54ccb0){return new BPromise(function(_0x457f87,_0x59f64c){return client[_0x9cf6('0xe')](_0x153ccb,_0x54ccb0)[_0x9cf6('0xf')](function(_0x27ec78){logger['info'](_0x9cf6('0x10'),_0x5517a8,_0x9cf6('0x11'));logger[_0x9cf6('0x12')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x5517a8,'request\x20sent',JSON[_0x9cf6('0x13')](_0x27ec78));if(_0x27ec78[_0x9cf6('0x14')]){if(_0x27ec78[_0x9cf6('0x14')][_0x9cf6('0x15')]===0x1f4){logger[_0x9cf6('0x14')]('DashboardItem,\x20%s,\x20%s',_0x5517a8,_0x27ec78[_0x9cf6('0x14')][_0x9cf6('0x16')]);return _0x59f64c(_0x27ec78['error'][_0x9cf6('0x16')]);}logger[_0x9cf6('0x14')]('DashboardItem,\x20%s,\x20%s',_0x5517a8,_0x27ec78[_0x9cf6('0x14')][_0x9cf6('0x16')]);return _0x457f87(_0x27ec78[_0x9cf6('0x14')][_0x9cf6('0x16')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x5517a8,_0x9cf6('0x11'));_0x457f87(_0x27ec78[_0x9cf6('0x17')][_0x9cf6('0x16')]);}})[_0x9cf6('0x18')](function(_0x1b5cc6){logger['error'](_0x9cf6('0x10'),_0x5517a8,_0x1b5cc6);_0x59f64c(_0x1b5cc6);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 685ce11..faaab0f 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 _0xb671=['dashboardItem:','./dashboardItem.events','save','remove','emit','removeListener','length'];(function(_0x565faf,_0x5f3718){var _0x42292f=function(_0x514b49){while(--_0x514b49){_0x565faf['push'](_0x565faf['shift']());}};_0x42292f(++_0x5f3718);}(_0xb671,0xbe));var _0x1b67=function(_0x52a4ef,_0x204784){_0x52a4ef=_0x52a4ef-0x0;var _0x2e9959=_0xb671[_0x52a4ef];return _0x2e9959;};'use strict';var DashboardItemEvents=require(_0x1b67('0x0'));var events=[_0x1b67('0x1'),_0x1b67('0x2'),'update'];function createListener(_0x3daade,_0x37eee6){return function(_0x506b98){_0x37eee6[_0x1b67('0x3')](_0x3daade,_0x506b98);};}function removeListener(_0xd2cf9f,_0x39c573){return function(){DashboardItemEvents[_0x1b67('0x4')](_0xd2cf9f,_0x39c573);};}exports['register']=function(_0x2fa80e){for(var _0xb74bf1=0x0,_0x282efe=events[_0x1b67('0x5')];_0xb74bf1<_0x282efe;_0xb74bf1++){var _0x41030b=events[_0xb74bf1];var _0xdfa539=createListener(_0x1b67('0x6')+_0x41030b,_0x2fa80e);DashboardItemEvents['on'](_0x41030b,_0xdfa539);}}; \ No newline at end of file +var _0x888a=['register','length','./dashboardItem.events','save','remove','update','emit','removeListener'];(function(_0x116fe0,_0x4b338d){var _0x19b42f=function(_0x37c04d){while(--_0x37c04d){_0x116fe0['push'](_0x116fe0['shift']());}};_0x19b42f(++_0x4b338d);}(_0x888a,0x1ea));var _0xa888=function(_0x145a04,_0x17b857){_0x145a04=_0x145a04-0x0;var _0x4f26a3=_0x888a[_0x145a04];return _0x4f26a3;};'use strict';var DashboardItemEvents=require(_0xa888('0x0'));var events=[_0xa888('0x1'),_0xa888('0x2'),_0xa888('0x3')];function createListener(_0x772a08,_0x2d5b05){return function(_0x49ba67){_0x2d5b05[_0xa888('0x4')](_0x772a08,_0x49ba67);};}function removeListener(_0x3e7553,_0x1e2b26){return function(){DashboardItemEvents[_0xa888('0x5')](_0x3e7553,_0x1e2b26);};}exports[_0xa888('0x6')]=function(_0x4f25ef){for(var _0x214aec=0x0,_0x27318f=events[_0xa888('0x7')];_0x214aec<_0x27318f;_0x214aec++){var _0x5bcccb=events[_0x214aec];var _0x4c3e52=createListener('dashboardItem:'+_0x5bcccb,_0x4f25ef);DashboardItemEvents['on'](_0x5bcccb,_0x4c3e52);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 69b7fd0..2a514c1 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 _0xdc97=['../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service'];(function(_0x18b1f7,_0xd806e1){var _0x5dfbf3=function(_0x142980){while(--_0x142980){_0x18b1f7['push'](_0x18b1f7['shift']());}};_0x5dfbf3(++_0xd806e1);}(_0xdc97,0x13b));var _0x7dc9=function(_0xd1a5f8,_0x59cf10){_0xd1a5f8=_0xd1a5f8-0x0;var _0xcd1932=_0xdc97[_0xd1a5f8];return _0xcd1932;};'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 +var _0x5fc3=['put','isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0x5fc3[_0x3cb6dc];return _0x47ec89;};'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')](_0x35fc('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x35fc('0xa')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xb')]);router[_0x35fc('0xc')](_0x35fc('0x9'),auth[_0x35fc('0xd')](),controller[_0x35fc('0xe')]);router[_0x35fc('0xf')](_0x35fc('0x9'),auth['isAuthenticated'](),controller[_0x35fc('0x10')]);module[_0x35fc('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 3ae31c3..4ee4582 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 _0xebbe=['ENUM','first','third','STRING','sequelize'];(function(_0x3a4e81,_0x453b4e){var _0x572874=function(_0x2956aa){while(--_0x2956aa){_0x3a4e81['push'](_0x3a4e81['shift']());}};_0x572874(++_0x453b4e);}(_0xebbe,0xdb));var _0xeebb=function(_0x4c16e1,_0x15984b){_0x4c16e1=_0x4c16e1-0x0;var _0x4068f0=_0xebbe[_0x4c16e1];return _0x4068f0;};'use strict';var Sequelize=require(_0xeebb('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xeebb('0x1')](_0xeebb('0x2'),'second',_0xeebb('0x3')),'allowNull':![],'defaultValue':_0xeebb('0x2')},'description':{'type':Sequelize[_0xeebb('0x4')]}}; \ No newline at end of file +var _0xf484=['sequelize','first','second','STRING'];(function(_0x3a8caf,_0x261b45){var _0x333562=function(_0x44443e){while(--_0x44443e){_0x3a8caf['push'](_0x3a8caf['shift']());}};_0x333562(++_0x261b45);}(_0xf484,0x104));var _0x4f48=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf484[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x4f48('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x4f48('0x1'),_0x4f48('0x2'),'third'),'allowNull':![],'defaultValue':_0x4f48('0x1')},'description':{'type':Sequelize[_0x4f48('0x3')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 8975d53..1545787 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 _0x9821=['../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xe92cd3,_0x126931){var _0x50fd6f=function(_0x52c3dd){while(--_0x52c3dd){_0xe92cd3['push'](_0xe92cd3['shift']());}};_0x50fd6f(++_0x126931);}(_0x9821,0x8e));var _0x1982=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x9821[_0x231e16];return _0x570a7c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1982('0x0'));var rimraf=require(_0x1982('0x1'));var zipdir=require(_0x1982('0x2'));var jsonpatch=require(_0x1982('0x3'));var rp=require(_0x1982('0x4'));var moment=require(_0x1982('0x5'));var BPromise=require(_0x1982('0x6'));var Mustache=require(_0x1982('0x7'));var util=require('util');var path=require(_0x1982('0x8'));var sox=require(_0x1982('0x9'));var csv=require(_0x1982('0xa'));var ejs=require(_0x1982('0xb'));var fs=require('fs');var _=require(_0x1982('0xc'));var squel=require('squel');var crypto=require(_0x1982('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1982('0xe'));var toCsv=require(_0x1982('0xa'));var querystring=require(_0x1982('0xf'));var Papa=require(_0x1982('0x10'));var Redis=require(_0x1982('0x11'));var authService=require(_0x1982('0x12'));var qs=require(_0x1982('0x13'));var as=require(_0x1982('0x14'));var hardwareService=require(_0x1982('0x15'));var logger=require(_0x1982('0x16'))(_0x1982('0x17'));var utils=require('../../config/utils');var config=require(_0x1982('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1982('0x19'))['db'];function respondWithStatusCode(_0x43f36c,_0x1d1dce){_0x1d1dce=_0x1d1dce||0xcc;return function(_0x319b1c){if(_0x319b1c){return _0x43f36c[_0x1982('0x1a')](_0x1d1dce);}return _0x43f36c['status'](_0x1d1dce)[_0x1982('0x1b')]();};}function respondWithResult(_0x3cdc6b,_0x3d106c){_0x3d106c=_0x3d106c||0xc8;return function(_0x1225a9){if(_0x1225a9){return _0x3cdc6b[_0x1982('0x1c')](_0x3d106c)[_0x1982('0x1d')](_0x1225a9);}};}function respondWithFilteredResult(_0x394824,_0x1000ff){return function(_0x3d238f){if(_0x3d238f){var _0x410aa7=_0x3d238f[_0x1982('0x1e')],_0x5f4606=_0x1000ff['offset'],_0x3a69a0=_0x1000ff[_0x1982('0x1f')]+_0x1000ff[_0x1982('0x20')],_0x1e4205;if(_0x3a69a0>=_0x410aa7){_0x3a69a0=_0x410aa7;_0x1e4205=0xc8;}else{_0x1e4205=0xce;}_0x394824[_0x1982('0x1c')](_0x1e4205);return _0x394824[_0x1982('0x21')](_0x1982('0x22'),_0x5f4606+'-'+_0x3a69a0+'/'+_0x410aa7)[_0x1982('0x1d')](_0x3d238f);}return null;};}function patchUpdates(_0x1cf432){return function(_0x419804){try{jsonpatch[_0x1982('0x23')](_0x419804,_0x1cf432,!![]);}catch(_0x28fdc8){return BPromise[_0x1982('0x24')](_0x28fdc8);}return _0x419804[_0x1982('0x25')]();};}function saveUpdates(_0x58678d,_0x717407){return function(_0x2a812f){if(_0x2a812f){return _0x2a812f[_0x1982('0x26')](_0x58678d)[_0x1982('0x27')](function(_0x4f1d42){return _0x4f1d42;});}return null;};}function removeEntity(_0x30edc5,_0x3ab4ca){return function(_0x7a7e3){if(_0x7a7e3){return _0x7a7e3[_0x1982('0x28')]()['then'](function(){var _0x42c41c=_0x7a7e3[_0x1982('0x29')]({'plain':!![]});var _0x8e27c8=_0x1982('0x2a');return db[_0x1982('0x2b')][_0x1982('0x28')]({'where':{'type':_0x8e27c8,'resourceId':_0x42c41c['id']}})[_0x1982('0x27')](function(){return _0x7a7e3;});})[_0x1982('0x27')](function(){_0x30edc5[_0x1982('0x1c')](0xcc)[_0x1982('0x1b')]();});}};}function handleEntityNotFound(_0x3c08c5,_0xecd134){return function(_0x3800a8){if(!_0x3800a8){_0x3c08c5[_0x1982('0x1a')](0x194);}return _0x3800a8;};}function handleError(_0x42af2a,_0x5adf35){_0x5adf35=_0x5adf35||0x1f4;return function(_0x1c3cee){logger[_0x1982('0x2c')](_0x1c3cee[_0x1982('0x2d')]);if(_0x1c3cee['name']){delete _0x1c3cee[_0x1982('0x2e')];}_0x42af2a[_0x1982('0x1c')](_0x5adf35)[_0x1982('0x2f')](_0x1c3cee);};}exports[_0x1982('0x30')]=function(_0x100902,_0x3a6a7e){var _0x457bb1={},_0x4316f1={},_0x4e884a={'count':0x0,'rows':[]};var _0x11d1a6=_[_0x1982('0x31')](db[_0x1982('0x32')][_0x1982('0x33')],function(_0xc8700c){return{'name':_0xc8700c['fieldName'],'type':_0xc8700c[_0x1982('0x34')]['key']};});_0x4316f1['model']=_['map'](_0x11d1a6,_0x1982('0x2e'));_0x4316f1[_0x1982('0x35')]=_[_0x1982('0x36')](_0x100902[_0x1982('0x35')]);_0x4316f1[_0x1982('0x37')]=_[_0x1982('0x38')](_0x4316f1[_0x1982('0x39')],_0x4316f1['query']);_0x457bb1[_0x1982('0x3a')]=_['intersection'](_0x4316f1[_0x1982('0x39')],qs[_0x1982('0x3b')](_0x100902[_0x1982('0x35')][_0x1982('0x3b')]));_0x457bb1['attributes']=_0x457bb1[_0x1982('0x3a')][_0x1982('0x3c')]?_0x457bb1[_0x1982('0x3a')]:_0x4316f1[_0x1982('0x39')];if(!_0x100902[_0x1982('0x35')]['hasOwnProperty'](_0x1982('0x3d'))){_0x457bb1[_0x1982('0x20')]=qs[_0x1982('0x20')](_0x100902['query'][_0x1982('0x20')]);_0x457bb1[_0x1982('0x1f')]=qs[_0x1982('0x1f')](_0x100902['query']['offset']);}_0x457bb1['order']=qs['sort'](_0x100902[_0x1982('0x35')][_0x1982('0x3e')]);_0x457bb1[_0x1982('0x3f')]=qs[_0x1982('0x37')](_[_0x1982('0x40')](_0x100902['query'],_0x4316f1[_0x1982('0x37')]),_0x11d1a6);if(_0x100902['query'][_0x1982('0x41')]){_0x457bb1['where']=_[_0x1982('0x42')](_0x457bb1[_0x1982('0x3f')],{'$or':_[_0x1982('0x31')](_0x11d1a6,function(_0x4a330b){if(_0x4a330b[_0x1982('0x34')]!==_0x1982('0x43')){var _0x190345={};_0x190345[_0x4a330b[_0x1982('0x2e')]]={'$like':'%'+_0x100902[_0x1982('0x35')][_0x1982('0x41')]+'%'};return _0x190345;}})});}_0x457bb1=_[_0x1982('0x42')]({},_0x457bb1,_0x100902[_0x1982('0x44')]);var _0x4d81f9={'where':_0x457bb1['where']};return db[_0x1982('0x32')]['count'](_0x4d81f9)[_0x1982('0x27')](function(_0x51b793){_0x4e884a[_0x1982('0x1e')]=_0x51b793;if(_0x100902['query'][_0x1982('0x45')]){_0x457bb1[_0x1982('0x46')]=[{'all':!![]}];}return db[_0x1982('0x32')]['findAll'](_0x457bb1);})[_0x1982('0x27')](function(_0x30c987){_0x4e884a[_0x1982('0x47')]=_0x30c987;return _0x4e884a;})[_0x1982('0x27')](respondWithFilteredResult(_0x3a6a7e,_0x457bb1))[_0x1982('0x48')](handleError(_0x3a6a7e,null));};exports['show']=function(_0x3a091f,_0x9c62f2){var _0x19e3c7={'raw':!![],'where':{'id':_0x3a091f[_0x1982('0x49')]['id']}},_0x26efbc={};_0x26efbc['model']=_['keys'](db[_0x1982('0x32')][_0x1982('0x33')]);_0x26efbc[_0x1982('0x35')]=_['keys'](_0x3a091f[_0x1982('0x35')]);_0x26efbc[_0x1982('0x37')]=_[_0x1982('0x38')](_0x26efbc[_0x1982('0x39')],_0x26efbc[_0x1982('0x35')]);_0x19e3c7[_0x1982('0x3a')]=_[_0x1982('0x38')](_0x26efbc['model'],qs[_0x1982('0x3b')](_0x3a091f[_0x1982('0x35')][_0x1982('0x3b')]));_0x19e3c7['attributes']=_0x19e3c7[_0x1982('0x3a')][_0x1982('0x3c')]?_0x19e3c7[_0x1982('0x3a')]:_0x26efbc[_0x1982('0x39')];if(_0x3a091f['query'][_0x1982('0x45')]){_0x19e3c7[_0x1982('0x46')]=[{'all':!![]}];}_0x19e3c7=_['merge']({},_0x19e3c7,_0x3a091f[_0x1982('0x44')]);return db['Disposition'][_0x1982('0x4a')](_0x19e3c7)[_0x1982('0x27')](handleEntityNotFound(_0x9c62f2,null))[_0x1982('0x27')](respondWithResult(_0x9c62f2,null))[_0x1982('0x48')](handleError(_0x9c62f2,null));};exports['create']=function(_0x21fba2,_0x40ec64){return db[_0x1982('0x32')][_0x1982('0x4b')](_0x21fba2[_0x1982('0x4c')],{})[_0x1982('0x27')](function(_0x2f3828){var _0x3a98b1=_0x21fba2[_0x1982('0x4d')][_0x1982('0x29')]({'plain':!![]});if(!_0x3a98b1)throw new Error(_0x1982('0x4e'));if(_0x3a98b1[_0x1982('0x4f')]===_0x1982('0x4d')){var _0x47a9ee=_0x2f3828[_0x1982('0x29')]({'plain':!![]});var _0x3c1f1a=_0x1982('0x2a');return db[_0x1982('0x50')][_0x1982('0x4a')]({'where':{'name':_0x3c1f1a,'userProfileId':_0x3a98b1[_0x1982('0x51')]},'raw':!![]})[_0x1982('0x27')](function(_0x30336f){if(_0x30336f&&_0x30336f['autoAssociation']===0x0){return db[_0x1982('0x2b')][_0x1982('0x4b')]({'name':_0x47a9ee[_0x1982('0x2e')],'resourceId':_0x47a9ee['id'],'type':_0x30336f[_0x1982('0x2e')],'sectionId':_0x30336f['id']},{})['then'](function(){return _0x2f3828;});}else{return _0x2f3828;}})[_0x1982('0x48')](function(_0x5a2069){logger[_0x1982('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a2069);throw _0x5a2069;});}return _0x2f3828;})[_0x1982('0x27')](respondWithResult(_0x40ec64,0xc9))[_0x1982('0x48')](handleError(_0x40ec64,null));};exports[_0x1982('0x26')]=function(_0x53affd,_0x5da7cc){if(_0x53affd[_0x1982('0x4c')]['id']){delete _0x53affd[_0x1982('0x4c')]['id'];}return db[_0x1982('0x32')]['find']({'where':{'id':_0x53affd[_0x1982('0x49')]['id']}})[_0x1982('0x27')](handleEntityNotFound(_0x5da7cc,null))[_0x1982('0x27')](saveUpdates(_0x53affd[_0x1982('0x4c')],null))[_0x1982('0x27')](respondWithResult(_0x5da7cc,null))[_0x1982('0x48')](handleError(_0x5da7cc,null));};exports[_0x1982('0x28')]=function(_0x34705c,_0x3f9357){return db['Disposition'][_0x1982('0x4a')]({'where':{'id':_0x34705c[_0x1982('0x49')]['id']}})['then'](handleEntityNotFound(_0x3f9357,null))['then'](removeEntity(_0x3f9357,null))[_0x1982('0x48')](handleError(_0x3f9357,null));}; \ No newline at end of file +var _0x351e=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','Disposition','include','findAll','catch','show','keys','rawAttributes','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Dispositions','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','fieldName','type','model','query','filters','attributes','intersection','fields','length'];(function(_0x46a50c,_0x3a7f4a){var _0x4274db=function(_0x213af1){while(--_0x213af1){_0x46a50c['push'](_0x46a50c['shift']());}};_0x4274db(++_0x3a7f4a);}(_0x351e,0x107));var _0xe351=function(_0x28d60f,_0x33ee75){_0x28d60f=_0x28d60f-0x0;var _0x360841=_0x351e[_0x28d60f];return _0x360841;};'use strict';var pdf=require(_0xe351('0x0'));var emlformat=require(_0xe351('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe351('0x2'));var rp=require(_0xe351('0x3'));var moment=require('moment');var BPromise=require(_0xe351('0x4'));var Mustache=require('mustache');var util=require(_0xe351('0x5'));var path=require(_0xe351('0x6'));var sox=require(_0xe351('0x7'));var csv=require(_0xe351('0x8'));var ejs=require(_0xe351('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe351('0xa'));var jsforce=require(_0xe351('0xb'));var deskjs=require(_0xe351('0xc'));var toCsv=require(_0xe351('0x8'));var querystring=require(_0xe351('0xd'));var Papa=require(_0xe351('0xe'));var Redis=require(_0xe351('0xf'));var authService=require(_0xe351('0x10'));var qs=require(_0xe351('0x11'));var as=require(_0xe351('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe351('0x13'))(_0xe351('0x14'));var utils=require('../../config/utils');var config=require(_0xe351('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bfe6d,_0x44a903){_0x44a903=_0x44a903||0xcc;return function(_0x12846c){if(_0x12846c){return _0x1bfe6d[_0xe351('0x16')](_0x44a903);}return _0x1bfe6d[_0xe351('0x17')](_0x44a903)[_0xe351('0x18')]();};}function respondWithResult(_0x57d0ae,_0x290f4a){_0x290f4a=_0x290f4a||0xc8;return function(_0x223023){if(_0x223023){return _0x57d0ae[_0xe351('0x17')](_0x290f4a)['json'](_0x223023);}};}function respondWithFilteredResult(_0x3293f5,_0x1effbe){return function(_0x34e44e){if(_0x34e44e){var _0x541b01=_0x34e44e[_0xe351('0x19')],_0x17d130=_0x1effbe[_0xe351('0x1a')],_0x2baf8f=_0x1effbe['offset']+_0x1effbe[_0xe351('0x1b')],_0x4827c3;if(_0x2baf8f>=_0x541b01){_0x2baf8f=_0x541b01;_0x4827c3=0xc8;}else{_0x4827c3=0xce;}_0x3293f5[_0xe351('0x17')](_0x4827c3);return _0x3293f5[_0xe351('0x1c')](_0xe351('0x1d'),_0x17d130+'-'+_0x2baf8f+'/'+_0x541b01)[_0xe351('0x1e')](_0x34e44e);}return null;};}function patchUpdates(_0x288856){return function(_0xac0344){try{jsonpatch[_0xe351('0x1f')](_0xac0344,_0x288856,!![]);}catch(_0x35c3ff){return BPromise[_0xe351('0x20')](_0x35c3ff);}return _0xac0344['save']();};}function saveUpdates(_0xbc7b27,_0x3426af){return function(_0x136324){if(_0x136324){return _0x136324[_0xe351('0x21')](_0xbc7b27)[_0xe351('0x22')](function(_0x3e6968){return _0x3e6968;});}return null;};}function removeEntity(_0x52806c,_0xaae5fa){return function(_0x4a0279){if(_0x4a0279){return _0x4a0279['destroy']()[_0xe351('0x22')](function(){var _0x56b203=_0x4a0279[_0xe351('0x23')]({'plain':!![]});var _0x2addf1='Dispositions';return db[_0xe351('0x24')][_0xe351('0x25')]({'where':{'type':_0x2addf1,'resourceId':_0x56b203['id']}})['then'](function(){return _0x4a0279;});})[_0xe351('0x22')](function(){_0x52806c[_0xe351('0x17')](0xcc)[_0xe351('0x18')]();});}};}function handleEntityNotFound(_0x47a289,_0x2eaa6f){return function(_0x532e5b){if(!_0x532e5b){_0x47a289[_0xe351('0x16')](0x194);}return _0x532e5b;};}function handleError(_0xa35e28,_0x57bbd2){_0x57bbd2=_0x57bbd2||0x1f4;return function(_0x19224a){logger[_0xe351('0x26')](_0x19224a[_0xe351('0x27')]);if(_0x19224a[_0xe351('0x28')]){delete _0x19224a[_0xe351('0x28')];}_0xa35e28[_0xe351('0x17')](_0x57bbd2)[_0xe351('0x29')](_0x19224a);};}exports[_0xe351('0x2a')]=function(_0x4397cb,_0xae750d){var _0x10a7b6={},_0x4a2a14={},_0x142e2d={'count':0x0,'rows':[]};var _0x10028f=_[_0xe351('0x2b')](db['Disposition']['rawAttributes'],function(_0x51c897){return{'name':_0x51c897[_0xe351('0x2c')],'type':_0x51c897[_0xe351('0x2d')]['key']};});_0x4a2a14[_0xe351('0x2e')]=_[_0xe351('0x2b')](_0x10028f,_0xe351('0x28'));_0x4a2a14[_0xe351('0x2f')]=_['keys'](_0x4397cb['query']);_0x4a2a14[_0xe351('0x30')]=_['intersection'](_0x4a2a14[_0xe351('0x2e')],_0x4a2a14['query']);_0x10a7b6[_0xe351('0x31')]=_[_0xe351('0x32')](_0x4a2a14[_0xe351('0x2e')],qs[_0xe351('0x33')](_0x4397cb[_0xe351('0x2f')]['fields']));_0x10a7b6[_0xe351('0x31')]=_0x10a7b6[_0xe351('0x31')][_0xe351('0x34')]?_0x10a7b6[_0xe351('0x31')]:_0x4a2a14[_0xe351('0x2e')];if(!_0x4397cb[_0xe351('0x2f')][_0xe351('0x35')](_0xe351('0x36'))){_0x10a7b6['limit']=qs[_0xe351('0x1b')](_0x4397cb[_0xe351('0x2f')][_0xe351('0x1b')]);_0x10a7b6[_0xe351('0x1a')]=qs[_0xe351('0x1a')](_0x4397cb[_0xe351('0x2f')][_0xe351('0x1a')]);}_0x10a7b6['order']=qs[_0xe351('0x37')](_0x4397cb['query'][_0xe351('0x37')]);_0x10a7b6[_0xe351('0x38')]=qs[_0xe351('0x30')](_[_0xe351('0x39')](_0x4397cb[_0xe351('0x2f')],_0x4a2a14[_0xe351('0x30')]),_0x10028f);if(_0x4397cb[_0xe351('0x2f')][_0xe351('0x3a')]){_0x10a7b6[_0xe351('0x38')]=_[_0xe351('0x3b')](_0x10a7b6[_0xe351('0x38')],{'$or':_[_0xe351('0x2b')](_0x10028f,function(_0x1db321){if(_0x1db321['type']!=='VIRTUAL'){var _0x11401c={};_0x11401c[_0x1db321[_0xe351('0x28')]]={'$like':'%'+_0x4397cb[_0xe351('0x2f')]['filter']+'%'};return _0x11401c;}})});}_0x10a7b6=_[_0xe351('0x3b')]({},_0x10a7b6,_0x4397cb[_0xe351('0x3c')]);var _0x5d78d8={'where':_0x10a7b6[_0xe351('0x38')]};return db[_0xe351('0x3d')][_0xe351('0x19')](_0x5d78d8)[_0xe351('0x22')](function(_0x32e0cc){_0x142e2d[_0xe351('0x19')]=_0x32e0cc;if(_0x4397cb[_0xe351('0x2f')]['includeAll']){_0x10a7b6[_0xe351('0x3e')]=[{'all':!![]}];}return db[_0xe351('0x3d')][_0xe351('0x3f')](_0x10a7b6);})[_0xe351('0x22')](function(_0x22b0fe){_0x142e2d['rows']=_0x22b0fe;return _0x142e2d;})[_0xe351('0x22')](respondWithFilteredResult(_0xae750d,_0x10a7b6))[_0xe351('0x40')](handleError(_0xae750d,null));};exports[_0xe351('0x41')]=function(_0x1d897e,_0xafbd02){var _0x2a3360={'raw':!![],'where':{'id':_0x1d897e['params']['id']}},_0x1cd60e={};_0x1cd60e[_0xe351('0x2e')]=_[_0xe351('0x42')](db[_0xe351('0x3d')][_0xe351('0x43')]);_0x1cd60e[_0xe351('0x2f')]=_[_0xe351('0x42')](_0x1d897e[_0xe351('0x2f')]);_0x1cd60e['filters']=_['intersection'](_0x1cd60e[_0xe351('0x2e')],_0x1cd60e['query']);_0x2a3360[_0xe351('0x31')]=_[_0xe351('0x32')](_0x1cd60e[_0xe351('0x2e')],qs['fields'](_0x1d897e[_0xe351('0x2f')][_0xe351('0x33')]));_0x2a3360[_0xe351('0x31')]=_0x2a3360[_0xe351('0x31')][_0xe351('0x34')]?_0x2a3360['attributes']:_0x1cd60e['model'];if(_0x1d897e[_0xe351('0x2f')][_0xe351('0x44')]){_0x2a3360['include']=[{'all':!![]}];}_0x2a3360=_[_0xe351('0x3b')]({},_0x2a3360,_0x1d897e[_0xe351('0x3c')]);return db[_0xe351('0x3d')][_0xe351('0x45')](_0x2a3360)[_0xe351('0x22')](handleEntityNotFound(_0xafbd02,null))['then'](respondWithResult(_0xafbd02,null))[_0xe351('0x40')](handleError(_0xafbd02,null));};exports[_0xe351('0x46')]=function(_0x4f44c3,_0x4a1005){return db[_0xe351('0x3d')][_0xe351('0x46')](_0x4f44c3['body'],{})['then'](function(_0x45acaa){var _0x2908ea=_0x4f44c3['user'][_0xe351('0x23')]({'plain':!![]});if(!_0x2908ea)throw new Error(_0xe351('0x47'));if(_0x2908ea[_0xe351('0x48')]===_0xe351('0x49')){var _0x257e8b=_0x45acaa[_0xe351('0x23')]({'plain':!![]});var _0x52baaf=_0xe351('0x4a');return db[_0xe351('0x4b')][_0xe351('0x45')]({'where':{'name':_0x52baaf,'userProfileId':_0x2908ea['userProfileId']},'raw':!![]})[_0xe351('0x22')](function(_0x3b72ec){if(_0x3b72ec&&_0x3b72ec['autoAssociation']===0x0){return db[_0xe351('0x24')]['create']({'name':_0x257e8b[_0xe351('0x28')],'resourceId':_0x257e8b['id'],'type':_0x3b72ec['name'],'sectionId':_0x3b72ec['id']},{})['then'](function(){return _0x45acaa;});}else{return _0x45acaa;}})['catch'](function(_0x2a5110){logger[_0xe351('0x26')](_0xe351('0x4c'),_0x2a5110);throw _0x2a5110;});}return _0x45acaa;})[_0xe351('0x22')](respondWithResult(_0x4a1005,0xc9))[_0xe351('0x40')](handleError(_0x4a1005,null));};exports['update']=function(_0x5deb49,_0x111430){if(_0x5deb49[_0xe351('0x4d')]['id']){delete _0x5deb49[_0xe351('0x4d')]['id'];}return db[_0xe351('0x3d')]['find']({'where':{'id':_0x5deb49[_0xe351('0x4e')]['id']}})[_0xe351('0x22')](handleEntityNotFound(_0x111430,null))[_0xe351('0x22')](saveUpdates(_0x5deb49[_0xe351('0x4d')],null))['then'](respondWithResult(_0x111430,null))['catch'](handleError(_0x111430,null));};exports['destroy']=function(_0x331a6f,_0x4eadbb){return db[_0xe351('0x3d')][_0xe351('0x45')]({'where':{'id':_0x331a6f['params']['id']}})[_0xe351('0x22')](handleEntityNotFound(_0x4eadbb,null))[_0xe351('0x22')](removeEntity(_0x4eadbb,null))[_0xe351('0x40')](handleError(_0x4eadbb,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index b49acc6..1701e7f 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 _0xdcfa=['Disposition','name_voice','ListId','name_chat','ChatWebsiteId','name','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define'];(function(_0x5d5715,_0x5430b0){var _0x1cad4f=function(_0xa4c263){while(--_0xa4c263){_0x5d5715['push'](_0x5d5715['shift']());}};_0x1cad4f(++_0x5430b0);}(_0xdcfa,0xad));var _0xadcf=function(_0x466b27,_0x1dc646){_0x466b27=_0x466b27-0x0;var _0x99df0c=_0xdcfa[_0x466b27];return _0x99df0c;};'use strict';var _=require(_0xadcf('0x0'));var util=require('util');var logger=require(_0xadcf('0x1'))('api');var moment=require(_0xadcf('0x2'));var BPromise=require(_0xadcf('0x3'));var rp=require(_0xadcf('0x4'));var fs=require('fs');var path=require(_0xadcf('0x5'));var rimraf=require(_0xadcf('0x6'));var config=require(_0xadcf('0x7'));var attributes=require(_0xadcf('0x8'));module[_0xadcf('0x9')]=function(_0x706348,_0x355ffd){return _0x706348[_0xadcf('0xa')](_0xadcf('0xb'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xadcf('0xc'),'fields':['name',_0xadcf('0xd')]},{'unique':!![],'name':_0xadcf('0xe'),'fields':['name',_0xadcf('0xf')]},{'unique':!![],'name':'name_mail','fields':[_0xadcf('0x10'),'MailAccountId']},{'unique':!![],'name':_0xadcf('0x11'),'fields':[_0xadcf('0x10'),'SmsAccountId']},{'unique':!![],'name':_0xadcf('0x12'),'fields':[_0xadcf('0x10'),_0xadcf('0x13')]},{'unique':!![],'name':_0xadcf('0x14'),'fields':[_0xadcf('0x10'),_0xadcf('0x15')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xadcf('0x10'),_0xadcf('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x02a7=['MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId'];(function(_0x40d090,_0xd00a78){var _0x524e66=function(_0x285fae){while(--_0x285fae){_0x40d090['push'](_0x40d090['shift']());}};_0x524e66(++_0xd00a78);}(_0x02a7,0x7a));var _0x702a=function(_0x40c54c,_0x4e4694){_0x40c54c=_0x40c54c-0x0;var _0x2f5d81=_0x02a7[_0x40c54c];return _0x2f5d81;};'use strict';var _=require('lodash');var util=require(_0x702a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x702a('0x1'));var BPromise=require(_0x702a('0x2'));var rp=require(_0x702a('0x3'));var fs=require('fs');var path=require(_0x702a('0x4'));var rimraf=require(_0x702a('0x5'));var config=require(_0x702a('0x6'));var attributes=require(_0x702a('0x7'));module['exports']=function(_0x1bcfe5,_0x5b7d8c){return _0x1bcfe5[_0x702a('0x8')](_0x702a('0x9'),attributes,{'tableName':_0x702a('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x702a('0xb'),'fields':[_0x702a('0xc'),_0x702a('0xd')]},{'unique':!![],'name':_0x702a('0xe'),'fields':['name',_0x702a('0xf')]},{'unique':!![],'name':'name_mail','fields':['name',_0x702a('0x10')]},{'unique':!![],'name':_0x702a('0x11'),'fields':[_0x702a('0xc'),_0x702a('0x12')]},{'unique':!![],'name':'name_fax','fields':[_0x702a('0xc'),_0x702a('0x13')]},{'unique':!![],'name':_0x702a('0x14'),'fields':[_0x702a('0xc'),_0x702a('0x15')]},{'unique':!![],'name':_0x702a('0x16'),'fields':[_0x702a('0xc'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index ed36a2a..da3283f 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 _0xb481=['info','Disposition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then'];(function(_0x348fc3,_0x54220c){var _0x4ab986=function(_0x553310){while(--_0x553310){_0x348fc3['push'](_0x348fc3['shift']());}};_0x4ab986(++_0x54220c);}(_0xb481,0x1ec));var _0x1b48=function(_0x3233c3,_0x15e5fa){_0x3233c3=_0x3233c3-0x0;var _0x36029b=_0xb481[_0x3233c3];return _0x36029b;};'use strict';var _=require(_0x1b48('0x0'));var util=require(_0x1b48('0x1'));var moment=require(_0x1b48('0x2'));var BPromise=require(_0x1b48('0x3'));var rs=require(_0x1b48('0x4'));var fs=require('fs');var Redis=require(_0x1b48('0x5'));var db=require(_0x1b48('0x6'))['db'];var utils=require(_0x1b48('0x7'));var logger=require(_0x1b48('0x8'))(_0x1b48('0x9'));var config=require(_0x1b48('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1b48('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf2517e,_0x59695a,_0x457a33){return new BPromise(function(_0x4a671d,_0x1b2fab){return client[_0x1b48('0xc')](_0xf2517e,_0x457a33)[_0x1b48('0xd')](function(_0x3d2a88){logger[_0x1b48('0xe')](_0x1b48('0xf'),_0x59695a,_0x1b48('0x10'));logger[_0x1b48('0x11')]('Disposition,\x20%s,\x20%s,\x20%s',_0x59695a,_0x1b48('0x10'),JSON[_0x1b48('0x12')](_0x3d2a88));if(_0x3d2a88['error']){if(_0x3d2a88['error']['code']===0x1f4){logger[_0x1b48('0x13')](_0x1b48('0xf'),_0x59695a,_0x3d2a88[_0x1b48('0x13')][_0x1b48('0x14')]);return _0x1b2fab(_0x3d2a88['error'][_0x1b48('0x14')]);}logger[_0x1b48('0x13')](_0x1b48('0xf'),_0x59695a,_0x3d2a88[_0x1b48('0x13')][_0x1b48('0x14')]);return _0x4a671d(_0x3d2a88[_0x1b48('0x13')]['message']);}else{logger[_0x1b48('0xe')]('Disposition,\x20%s,\x20%s',_0x59695a,'request\x20sent');_0x4a671d(_0x3d2a88[_0x1b48('0x15')][_0x1b48('0x14')]);}})[_0x1b48('0x16')](function(_0x50763d){logger[_0x1b48('0x13')](_0x1b48('0xf'),_0x59695a,_0x50763d);_0x1b2fab(_0x50763d);});});} \ No newline at end of file +var _0x2238=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0xd037b1,_0x25bb1c){var _0x3f0ac4=function(_0x2d7695){while(--_0x2d7695){_0xd037b1['push'](_0xd037b1['shift']());}};_0x3f0ac4(++_0x25bb1c);}(_0x2238,0x174));var _0x8223=function(_0x3248ce,_0x21afc1){_0x3248ce=_0x3248ce-0x0;var _0x102982=_0x2238[_0x3248ce];return _0x102982;};'use strict';var _=require(_0x8223('0x0'));var util=require(_0x8223('0x1'));var moment=require(_0x8223('0x2'));var BPromise=require(_0x8223('0x3'));var rs=require(_0x8223('0x4'));var fs=require('fs');var Redis=require(_0x8223('0x5'));var db=require(_0x8223('0x6'))['db'];var utils=require(_0x8223('0x7'));var logger=require('../../config/logger')(_0x8223('0x8'));var config=require('../../config/environment');var jayson=require(_0x8223('0x9'));var client=jayson[_0x8223('0xa')][_0x8223('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4daab0,_0x2fc04b,_0x1b9b72){return new BPromise(function(_0x4cd820,_0xc533c4){return client[_0x8223('0xc')](_0x4daab0,_0x1b9b72)[_0x8223('0xd')](function(_0x14b23a){logger[_0x8223('0xe')](_0x8223('0xf'),_0x2fc04b,_0x8223('0x10'));logger[_0x8223('0x11')]('Disposition,\x20%s,\x20%s,\x20%s',_0x2fc04b,_0x8223('0x10'),JSON['stringify'](_0x14b23a));if(_0x14b23a['error']){if(_0x14b23a[_0x8223('0x12')][_0x8223('0x13')]===0x1f4){logger[_0x8223('0x12')](_0x8223('0xf'),_0x2fc04b,_0x14b23a['error'][_0x8223('0x14')]);return _0xc533c4(_0x14b23a['error'][_0x8223('0x14')]);}logger[_0x8223('0x12')]('Disposition,\x20%s,\x20%s',_0x2fc04b,_0x14b23a[_0x8223('0x12')]['message']);return _0x4cd820(_0x14b23a[_0x8223('0x12')][_0x8223('0x14')]);}else{logger[_0x8223('0xe')](_0x8223('0xf'),_0x2fc04b,_0x8223('0x10'));_0x4cd820(_0x14b23a[_0x8223('0x15')][_0x8223('0x14')]);}})[_0x8223('0x16')](function(_0x15af9c){logger['error'](_0x8223('0xf'),_0x2fc04b,_0x15af9c);_0xc533c4(_0x15af9c);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 11e5369..08b6822 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 _0x1413=['post','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','show'];(function(_0xfddf54,_0x2a42af){var _0x44c56a=function(_0x31fbe8){while(--_0x31fbe8){_0xfddf54['push'](_0xfddf54['shift']());}};_0x44c56a(++_0x2a42af);}(_0x1413,0x196));var _0x3141=function(_0x7bde68,_0x159435){_0x7bde68=_0x7bde68-0x0;var _0x590bea=_0x1413[_0x7bde68];return _0x590bea;};'use strict';var multer=require(_0x3141('0x0'));var util=require(_0x3141('0x1'));var path=require(_0x3141('0x2'));var timeout=require(_0x3141('0x3'));var express=require(_0x3141('0x4'));var router=express[_0x3141('0x5')]();var auth=require(_0x3141('0x6'));var interaction=require(_0x3141('0x7'));var config=require(_0x3141('0x8'));var controller=require(_0x3141('0x9'));router[_0x3141('0xa')]('/',auth[_0x3141('0xb')](),controller[_0x3141('0xc')]);router[_0x3141('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x3141('0xd')]);router[_0x3141('0xe')]('/',auth[_0x3141('0xb')](),controller['create']);router[_0x3141('0xf')](_0x3141('0x10'),auth[_0x3141('0xb')](),controller[_0x3141('0x11')]);router[_0x3141('0x12')](_0x3141('0x10'),auth[_0x3141('0xb')](),controller['destroy']);module[_0x3141('0x13')]=router; \ No newline at end of file +var _0x935a=['isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','multer','util','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x211597,_0x4673c0){var _0x5c97e4=function(_0x37c130){while(--_0x37c130){_0x211597['push'](_0x211597['shift']());}};_0x5c97e4(++_0x4673c0);}(_0x935a,0x1cc));var _0xa935=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x935a[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xa935('0x0'));var util=require(_0xa935('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa935('0x2')]();var auth=require(_0xa935('0x3'));var interaction=require(_0xa935('0x4'));var config=require('../../config/environment');var controller=require('./disposition.controller');router['get']('/',auth[_0xa935('0x5')](),controller[_0xa935('0x6')]);router[_0xa935('0x7')](_0xa935('0x8'),auth[_0xa935('0x5')](),controller[_0xa935('0x9')]);router[_0xa935('0xa')]('/',auth[_0xa935('0x5')](),controller[_0xa935('0xb')]);router[_0xa935('0xc')]('/:id',auth[_0xa935('0x5')](),controller['update']);router[_0xa935('0xd')](_0xa935('0x8'),auth[_0xa935('0x5')](),controller[_0xa935('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 9710b0b..b6f5fe4 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 _0xbaae=['BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','INTEGER','SIP','DADHI','KHOMP'];(function(_0xe19091,_0x200b1e){var _0x10ef46=function(_0x196473){while(--_0x196473){_0xe19091['push'](_0xe19091['shift']());}};_0x10ef46(++_0x200b1e);}(_0xbaae,0x14f));var _0xebaa=function(_0x15efcc,_0x340f97){_0x15efcc=_0x15efcc-0x0;var _0x19acd2=_0xbaae[_0x15efcc];return _0x19acd2;};'use strict';var Sequelize=require(_0xebaa('0x0'));module[_0xebaa('0x1')]={'name':{'type':Sequelize[_0xebaa('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xebaa('0x3')](_0xebaa('0x4'),'no'),'defaultValue':_0xebaa('0x4')},'headerinfo':{'type':Sequelize[_0xebaa('0x2')],'defaultValue':_0xebaa('0x5')},'localstationid':{'type':Sequelize[_0xebaa('0x2')],'unique':_0xebaa('0x6')},'minrate':{'type':Sequelize['ENUM'](_0xebaa('0x7'),_0xebaa('0x8'),_0xebaa('0x9'),_0xebaa('0xa'),'12000','14400'),'defaultValue':_0xebaa('0x8')},'maxrate':{'type':Sequelize[_0xebaa('0x3')](_0xebaa('0x7'),_0xebaa('0x8'),_0xebaa('0x9'),'9600',_0xebaa('0xb'),'14400'),'defaultValue':_0xebaa('0xc')},'modem':{'type':Sequelize[_0xebaa('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xebaa('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xebaa('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xebaa('0x3')](_0xebaa('0xe'),'IAX',_0xebaa('0xf'),_0xebaa('0x10')),'defaultValue':_0xebaa('0xe')},'key':{'type':Sequelize[_0xebaa('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xebaa('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xebaa('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xebaa('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xebaa('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xebaa('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xebaa('0x11')],'defaultValue':![],'comment':_0xebaa('0x12'),'set':function(_0x508fb9){if(!_0x508fb9)this[_0xebaa('0x13')](_0xebaa('0x14'),null);this[_0xebaa('0x13')](_0xebaa('0x15'),_0x508fb9);}}}; \ No newline at end of file +var _0xb971=['4800','2400','14400','v17,v27,v29','INTEGER','SIP','IAX','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','7200','9600','12000'];(function(_0x23724f,_0x19e182){var _0x17c793=function(_0x7934bc){while(--_0x7934bc){_0x23724f['push'](_0x23724f['shift']());}};_0x17c793(++_0x19e182);}(_0xb971,0x109));var _0x1b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb971[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1b97('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1b97('0x0')]},'ecm':{'type':Sequelize[_0x1b97('0x1')](_0x1b97('0x2'),'no'),'defaultValue':_0x1b97('0x2')},'headerinfo':{'type':Sequelize[_0x1b97('0x0')],'defaultValue':_0x1b97('0x3')},'localstationid':{'type':Sequelize[_0x1b97('0x0')],'unique':_0x1b97('0x4')},'minrate':{'type':Sequelize[_0x1b97('0x1')]('2400','4800',_0x1b97('0x5'),_0x1b97('0x6'),_0x1b97('0x7'),'14400'),'defaultValue':_0x1b97('0x8')},'maxrate':{'type':Sequelize[_0x1b97('0x1')](_0x1b97('0x9'),_0x1b97('0x8'),_0x1b97('0x5'),'9600',_0x1b97('0x7'),_0x1b97('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x1b97('0xb')},'gateway':{'type':Sequelize[_0x1b97('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x1b97('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x1b97('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x1b97('0x1')](_0x1b97('0xd'),_0x1b97('0xe'),'DADHI','KHOMP'),'defaultValue':_0x1b97('0xd')},'key':{'type':Sequelize[_0x1b97('0x0')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x1b97('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1b97('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1b97('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1b97('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1b97('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1b97('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x1b97('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x23ba41){if(!_0x23ba41)this[_0x1b97('0x12')](_0x1b97('0x13'),null);this[_0x1b97('0x12')](_0x1b97('0x14'),_0x23ba41);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index ab7d481..1da56b2 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 _0xb43b=['moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','request','then','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','count','offset','limit','set','apply','reject','save','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','options','includeAll','findAll','show','include','find','create','user','role','FaxAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','addDisposition','FaxAccountId','Disposition','hasOwnProperty','nolimit','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Wait','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','List','updatedAt','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','Contacts','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','info','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x268afe,_0x50bb60){var _0x288d0b=function(_0x5ec113){while(--_0x5ec113){_0x268afe['push'](_0x268afe['shift']());}};_0x288d0b(++_0x50bb60);}(_0xb43b,0xbf));var _0xbb43=function(_0x1bb936,_0xd9e0b3){_0x1bb936=_0x1bb936-0x0;var _0x20ada0=_0xb43b[_0x1bb936];return _0x20ada0;};'use strict';var pdf=require(_0xbb43('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb43('0x1'));var zipdir=require(_0xbb43('0x2'));var jsonpatch=require(_0xbb43('0x3'));var rp=require(_0xbb43('0x4'));var moment=require(_0xbb43('0x5'));var BPromise=require(_0xbb43('0x6'));var Mustache=require(_0xbb43('0x7'));var util=require(_0xbb43('0x8'));var path=require(_0xbb43('0x9'));var sox=require(_0xbb43('0xa'));var csv=require(_0xbb43('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbb43('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbb43('0xd'));var deskjs=require(_0xbb43('0xe'));var toCsv=require(_0xbb43('0xb'));var querystring=require(_0xbb43('0xf'));var Papa=require(_0xbb43('0x10'));var Redis=require('ioredis');var authService=require(_0xbb43('0x11'));var qs=require(_0xbb43('0x12'));var as=require(_0xbb43('0x13'));var hardwareService=require(_0xbb43('0x14'));var logger=require('../../config/logger')(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xbb43('0x17')]=_['defaults'](config[_0xbb43('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb43('0x18'))(new Redis(config[_0xbb43('0x17')]));require(_0xbb43('0x19'))[_0xbb43('0x1a')](socket);var jayson=require(_0xbb43('0x1b'));var client=jayson['client'][_0xbb43('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xbb43('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x32425c,_0x15182b,_0x10c91b,_0x3be44b){return new BPromise(function(_0x126f61,_0x3c4a5a){var _0x209c9c=_0x3be44b||client;return _0x209c9c[_0xbb43('0x1d')](_0x32425c,_0x10c91b)[_0xbb43('0x1e')](function(_0xe15a1b){logger['info'](_0xbb43('0x1f'),_0x15182b,'request\x20sent');logger[_0xbb43('0x20')](_0xbb43('0x21'),_0x15182b,_0xbb43('0x22'),JSON[_0xbb43('0x23')](_0xe15a1b));if(_0xe15a1b['error']){if(_0xe15a1b[_0xbb43('0x24')][_0xbb43('0x25')]===0x1f4){logger[_0xbb43('0x24')](_0xbb43('0x1f'),_0x15182b,_0xe15a1b[_0xbb43('0x24')][_0xbb43('0x26')]);return _0x3c4a5a(_0xe15a1b[_0xbb43('0x24')][_0xbb43('0x26')]);}logger[_0xbb43('0x24')](_0xbb43('0x1f'),_0x15182b,_0xe15a1b[_0xbb43('0x24')][_0xbb43('0x26')]);return _0x126f61(_0xe15a1b[_0xbb43('0x24')][_0xbb43('0x26')]);}else{logger['info'](_0xbb43('0x1f'),_0x15182b,_0xbb43('0x22'));_0x126f61(_0xe15a1b['result'][_0xbb43('0x26')]);}})[_0xbb43('0x27')](function(_0x25279b){logger['error']('FaxAccount,\x20%s,\x20%s',_0x15182b,_0x25279b);_0x3c4a5a(_0x25279b);});});}function respondWithStatusCode(_0x20f223,_0x16da8a){_0x16da8a=_0x16da8a||0xcc;return function(_0x5b21b6){if(_0x5b21b6){return _0x20f223['sendStatus'](_0x16da8a);}return _0x20f223[_0xbb43('0x28')](_0x16da8a)[_0xbb43('0x29')]();};}function respondWithResult(_0x268fb5,_0x4bb859){_0x4bb859=_0x4bb859||0xc8;return function(_0x27bb65){if(_0x27bb65){return _0x268fb5[_0xbb43('0x28')](_0x4bb859)[_0xbb43('0x2a')](_0x27bb65);}};}function respondWithFilteredResult(_0x1a6e2b,_0x5d613c){return function(_0x2a4766){if(_0x2a4766){var _0x170e7a=_0x2a4766[_0xbb43('0x2b')],_0x821beb=_0x5d613c[_0xbb43('0x2c')],_0x293d66=_0x5d613c['offset']+_0x5d613c[_0xbb43('0x2d')],_0x34b679;if(_0x293d66>=_0x170e7a){_0x293d66=_0x170e7a;_0x34b679=0xc8;}else{_0x34b679=0xce;}_0x1a6e2b[_0xbb43('0x28')](_0x34b679);return _0x1a6e2b[_0xbb43('0x2e')]('Content-Range',_0x821beb+'-'+_0x293d66+'/'+_0x170e7a)[_0xbb43('0x2a')](_0x2a4766);}return null;};}function patchUpdates(_0x847c71){return function(_0x9384d8){try{jsonpatch[_0xbb43('0x2f')](_0x9384d8,_0x847c71,!![]);}catch(_0x2b3350){return BPromise[_0xbb43('0x30')](_0x2b3350);}return _0x9384d8[_0xbb43('0x31')]();};}function saveUpdates(_0xa86300,_0xd579d8){return function(_0x5c50d5){if(_0x5c50d5){return _0x5c50d5['update'](_0xa86300)['then'](function(_0x4fc4bc){return _0x4fc4bc;});}return null;};}function removeEntity(_0x352249,_0x1186fd){return function(_0x15c3e5){if(_0x15c3e5){return _0x15c3e5[_0xbb43('0x32')]()[_0xbb43('0x1e')](function(){var _0xa153c9=_0x15c3e5[_0xbb43('0x33')]({'plain':!![]});var _0x3082b3='FaxAccounts';return db[_0xbb43('0x34')][_0xbb43('0x32')]({'where':{'type':_0x3082b3,'resourceId':_0xa153c9['id']}})[_0xbb43('0x1e')](function(){return _0x15c3e5;});})[_0xbb43('0x1e')](function(){_0x352249['status'](0xcc)[_0xbb43('0x29')]();});}};}function handleEntityNotFound(_0x42ae94,_0x34a492){return function(_0x119f8f){if(!_0x119f8f){_0x42ae94['sendStatus'](0x194);}return _0x119f8f;};}function handleError(_0x37b8c5,_0x4ab8e5){_0x4ab8e5=_0x4ab8e5||0x1f4;return function(_0x3ba581){logger[_0xbb43('0x24')](_0x3ba581[_0xbb43('0x35')]);if(_0x3ba581[_0xbb43('0x36')]){delete _0x3ba581[_0xbb43('0x36')];}_0x37b8c5[_0xbb43('0x28')](_0x4ab8e5)[_0xbb43('0x37')](_0x3ba581);};}exports[_0xbb43('0x38')]=function(_0xc087aa,_0xa48590){var _0xfeaa38={'include':[{'model':db[_0xbb43('0x39')],'as':_0xbb43('0x3a')}]},_0x234021={},_0x4f1d19={'count':0x0,'rows':[]};var _0x363e1a=_[_0xbb43('0x3b')](db[_0xbb43('0x3c')][_0xbb43('0x3d')],function(_0x21e03d){return{'name':_0x21e03d[_0xbb43('0x3e')],'type':_0x21e03d[_0xbb43('0x3f')][_0xbb43('0x40')]};});_0x234021[_0xbb43('0x41')]=_[_0xbb43('0x3b')](_0x363e1a,_0xbb43('0x36'));_0x234021[_0xbb43('0x42')]=_[_0xbb43('0x43')](_0xc087aa['query']);_0x234021[_0xbb43('0x44')]=_[_0xbb43('0x45')](_0x234021[_0xbb43('0x41')],_0x234021[_0xbb43('0x42')]);_0xfeaa38[_0xbb43('0x46')]=_[_0xbb43('0x45')](_0x234021['model'],qs[_0xbb43('0x47')](_0xc087aa[_0xbb43('0x42')]['fields']));_0xfeaa38['attributes']=_0xfeaa38[_0xbb43('0x46')][_0xbb43('0x48')]?_0xfeaa38[_0xbb43('0x46')]:_0x234021[_0xbb43('0x41')];if(!_0xc087aa[_0xbb43('0x42')]['hasOwnProperty']('nolimit')){_0xfeaa38[_0xbb43('0x2d')]=qs[_0xbb43('0x2d')](_0xc087aa[_0xbb43('0x42')][_0xbb43('0x2d')]);_0xfeaa38[_0xbb43('0x2c')]=qs[_0xbb43('0x2c')](_0xc087aa[_0xbb43('0x42')][_0xbb43('0x2c')]);}_0xfeaa38[_0xbb43('0x49')]=qs[_0xbb43('0x4a')](_0xc087aa['query']['sort']);_0xfeaa38[_0xbb43('0x4b')]=qs[_0xbb43('0x44')](_['pick'](_0xc087aa[_0xbb43('0x42')],_0x234021[_0xbb43('0x44')]),_0x363e1a);if(_0xc087aa[_0xbb43('0x42')][_0xbb43('0x4c')]){_0xfeaa38[_0xbb43('0x4b')]=_[_0xbb43('0x4d')](_0xfeaa38[_0xbb43('0x4b')],{'$or':_['map'](_0x363e1a,function(_0x225983){if(_0x225983[_0xbb43('0x3f')]!=='VIRTUAL'){var _0x109e04={};_0x109e04[_0x225983[_0xbb43('0x36')]]={'$like':'%'+_0xc087aa['query'][_0xbb43('0x4c')]+'%'};return _0x109e04;}})});}_0xfeaa38=_[_0xbb43('0x4d')]({},_0xfeaa38,_0xc087aa[_0xbb43('0x4e')]);var _0x15fab6={'where':_0xfeaa38[_0xbb43('0x4b')]};return db[_0xbb43('0x3c')][_0xbb43('0x2b')](_0x15fab6)[_0xbb43('0x1e')](function(_0x3643f0){_0x4f1d19[_0xbb43('0x2b')]=_0x3643f0;if(_0xc087aa[_0xbb43('0x42')][_0xbb43('0x4f')]){_0xfeaa38['include']=[{'all':!![]}];}return db[_0xbb43('0x3c')][_0xbb43('0x50')](_0xfeaa38);})[_0xbb43('0x1e')](function(_0x7089bb){_0x4f1d19['rows']=_0x7089bb;return _0x4f1d19;})[_0xbb43('0x1e')](respondWithFilteredResult(_0xa48590,_0xfeaa38))['catch'](handleError(_0xa48590,null));};exports[_0xbb43('0x51')]=function(_0x4d463f,_0x21f78b){var _0x322a77={'raw':![],'where':{'id':_0x4d463f['params']['id']},'include':[{'model':db[_0xbb43('0x39')],'as':_0xbb43('0x3a')}]},_0x26586c={};_0x26586c[_0xbb43('0x41')]=_['keys'](db[_0xbb43('0x3c')][_0xbb43('0x3d')]);_0x26586c['query']=_[_0xbb43('0x43')](_0x4d463f['query']);_0x26586c[_0xbb43('0x44')]=_[_0xbb43('0x45')](_0x26586c['model'],_0x26586c[_0xbb43('0x42')]);_0x322a77[_0xbb43('0x46')]=_[_0xbb43('0x45')](_0x26586c['model'],qs[_0xbb43('0x47')](_0x4d463f['query'][_0xbb43('0x47')]));_0x322a77[_0xbb43('0x46')]=_0x322a77[_0xbb43('0x46')]['length']?_0x322a77[_0xbb43('0x46')]:_0x26586c[_0xbb43('0x41')];if(_0x4d463f['query']['includeAll']){_0x322a77[_0xbb43('0x52')]=[{'all':!![]}];}_0x322a77=_[_0xbb43('0x4d')]({},_0x322a77,_0x4d463f['options']);return db['FaxAccount'][_0xbb43('0x53')](_0x322a77)['then'](handleEntityNotFound(_0x21f78b,null))[_0xbb43('0x1e')](respondWithResult(_0x21f78b,null))[_0xbb43('0x27')](handleError(_0x21f78b,null));};exports[_0xbb43('0x54')]=function(_0x4c8a38,_0x5978c9){return db['FaxAccount']['create'](_0x4c8a38['body'],{})[_0xbb43('0x1e')](function(_0x31d265){var _0x2a726d=_0x4c8a38[_0xbb43('0x55')][_0xbb43('0x33')]({'plain':!![]});if(!_0x2a726d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a726d[_0xbb43('0x56')]==='user'){var _0x6e7c04=_0x31d265['get']({'plain':!![]});var _0x2ad30b=_0xbb43('0x57');return db[_0xbb43('0x58')][_0xbb43('0x53')]({'where':{'name':_0x2ad30b,'userProfileId':_0x2a726d['userProfileId']},'raw':!![]})[_0xbb43('0x1e')](function(_0x511e60){if(_0x511e60&&_0x511e60[_0xbb43('0x59')]===0x0){return db[_0xbb43('0x34')]['create']({'name':_0x6e7c04[_0xbb43('0x36')],'resourceId':_0x6e7c04['id'],'type':_0x511e60[_0xbb43('0x36')],'sectionId':_0x511e60['id']},{})['then'](function(){return _0x31d265;});}else{return _0x31d265;}})[_0xbb43('0x27')](function(_0x13e1e3){logger[_0xbb43('0x24')](_0xbb43('0x5a'),_0x13e1e3);throw _0x13e1e3;});}return _0x31d265;})[_0xbb43('0x1e')](respondWithResult(_0x5978c9,0xc9))[_0xbb43('0x27')](handleError(_0x5978c9,null));};exports[_0xbb43('0x5b')]=function(_0x161556,_0x598d9d){if(_0x161556[_0xbb43('0x5c')]['id']){delete _0x161556['body']['id'];}return db[_0xbb43('0x3c')][_0xbb43('0x53')]({'where':{'id':_0x161556['params']['id']},'include':[{'model':db[_0xbb43('0x39')],'as':_0xbb43('0x3a')}]})[_0xbb43('0x1e')](handleEntityNotFound(_0x598d9d,null))[_0xbb43('0x1e')](saveUpdates(_0x161556[_0xbb43('0x5c')],null))[_0xbb43('0x1e')](respondWithResult(_0x598d9d,null))[_0xbb43('0x27')](handleError(_0x598d9d,null));};exports[_0xbb43('0x32')]=function(_0x4bef87,_0x3e57ef){return db[_0xbb43('0x3c')][_0xbb43('0x53')]({'where':{'id':_0x4bef87[_0xbb43('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3e57ef,null))[_0xbb43('0x1e')](removeEntity(_0x3e57ef,null))['catch'](handleError(_0x3e57ef,null));};exports[_0xbb43('0x5e')]=function(_0x5102fb,_0x3a8d9d){return db[_0xbb43('0x3c')][_0xbb43('0x5e')]()[_0xbb43('0x1e')](respondWithResult(_0x3a8d9d,null))[_0xbb43('0x27')](handleError(_0x3a8d9d,null));};exports[_0xbb43('0x5f')]=function(_0x349699,_0x244971,_0x251ed2){if(_0x349699[_0xbb43('0x5c')]['id']){delete _0x349699['body']['id'];}return db[_0xbb43('0x3c')]['find']({'where':{'id':_0x349699[_0xbb43('0x5d')]['id']}})[_0xbb43('0x1e')](handleEntityNotFound(_0x244971,null))[_0xbb43('0x1e')](function(_0x2547aa){if(_0x2547aa){_0x349699[_0xbb43('0x5c')][_0xbb43('0x60')]=_0x2547aa['id'];return db[_0xbb43('0x61')][_0xbb43('0x54')](_0x349699['body']);}})[_0xbb43('0x1e')](respondWithResult(_0x244971,null))['catch'](handleError(_0x244971,null));};exports['getDispositions']=function(_0x189d92,_0x4be7f7,_0x7b2e43){var _0x212dc9={'raw':![],'where':{}};var _0x4eb58f={};var _0x221727={'count':0x0,'rows':[]};return db[_0xbb43('0x3c')]['findOne']({'where':{'id':_0x189d92[_0xbb43('0x5d')]['id']}})[_0xbb43('0x1e')](handleEntityNotFound(_0x4be7f7,null))[_0xbb43('0x1e')](function(_0x14678c){if(_0x14678c){_0x4eb58f[_0xbb43('0x41')]=_[_0xbb43('0x43')](db[_0xbb43('0x61')][_0xbb43('0x3d')]);_0x4eb58f[_0xbb43('0x42')]=_[_0xbb43('0x43')](_0x189d92[_0xbb43('0x42')]);_0x4eb58f[_0xbb43('0x44')]=_[_0xbb43('0x45')](_0x4eb58f[_0xbb43('0x41')],_0x4eb58f[_0xbb43('0x42')]);_0x212dc9[_0xbb43('0x46')]=_[_0xbb43('0x45')](_0x4eb58f[_0xbb43('0x41')],qs[_0xbb43('0x47')](_0x189d92[_0xbb43('0x42')][_0xbb43('0x47')]));_0x212dc9[_0xbb43('0x46')]=_0x212dc9[_0xbb43('0x46')][_0xbb43('0x48')]?_0x212dc9[_0xbb43('0x46')]:_0x4eb58f[_0xbb43('0x41')];if(!_0x189d92[_0xbb43('0x42')][_0xbb43('0x62')](_0xbb43('0x63'))){_0x212dc9[_0xbb43('0x2d')]=qs['limit'](_0x189d92[_0xbb43('0x42')][_0xbb43('0x2d')]);_0x212dc9[_0xbb43('0x2c')]=qs[_0xbb43('0x2c')](_0x189d92[_0xbb43('0x42')][_0xbb43('0x2c')]);}_0x212dc9['order']=qs[_0xbb43('0x4a')](_0x189d92[_0xbb43('0x42')]['sort']);_0x212dc9['where']=qs['filters'](_[_0xbb43('0x64')](_0x189d92[_0xbb43('0x42')],_0x4eb58f[_0xbb43('0x44')]));_0x212dc9[_0xbb43('0x4b')]['FaxAccountId']=_0x14678c['id'];if(_0x189d92['query'][_0xbb43('0x4c')]){_0x212dc9['where']=_[_0xbb43('0x4d')](_0x212dc9[_0xbb43('0x4b')],{'$or':_['map'](_0x212dc9[_0xbb43('0x46')],function(_0x20c318){var _0x31ffa0={};_0x31ffa0[_0x20c318]={'$like':'%'+_0x189d92['query'][_0xbb43('0x4c')]+'%'};return _0x31ffa0;})});}_0x212dc9=_['merge']({},_0x212dc9,_0x189d92[_0xbb43('0x4e')]);return db[_0xbb43('0x61')]['count']({'where':_0x212dc9[_0xbb43('0x4b')]})[_0xbb43('0x1e')](function(_0x1a4aa8){_0x221727[_0xbb43('0x2b')]=_0x1a4aa8;if(_0x189d92[_0xbb43('0x42')]['includeAll']){_0x212dc9['include']=[{'all':!![]}];}return db[_0xbb43('0x61')][_0xbb43('0x50')](_0x212dc9);})[_0xbb43('0x1e')](function(_0x3322c0){_0x221727[_0xbb43('0x65')]=_0x3322c0;return _0x221727;});}})[_0xbb43('0x1e')](respondWithFilteredResult(_0x4be7f7,_0x212dc9))[_0xbb43('0x27')](handleError(_0x4be7f7,null));};exports[_0xbb43('0x66')]=function(_0x4bf7c8,_0x22c358,_0x4f613a){return db[_0xbb43('0x3c')][_0xbb43('0x53')]({'where':{'id':_0x4bf7c8['params']['id']}})[_0xbb43('0x1e')](handleEntityNotFound(_0x22c358,null))[_0xbb43('0x1e')](function(_0xbcc283){if(_0xbcc283){return _0xbcc283[_0xbb43('0x66')](_0x4bf7c8[_0xbb43('0x42')][_0xbb43('0x67')]);}})['then'](respondWithStatusCode(_0x22c358,null))[_0xbb43('0x27')](handleError(_0x22c358,null));};exports[_0xbb43('0x68')]=function(_0x4a957b,_0x250021,_0x544e30){if(_0x4a957b[_0xbb43('0x5c')]['id']){delete _0x4a957b[_0xbb43('0x5c')]['id'];}return db[_0xbb43('0x3c')][_0xbb43('0x53')]({'where':{'id':_0x4a957b[_0xbb43('0x5d')]['id']}})[_0xbb43('0x1e')](handleEntityNotFound(_0x250021,null))[_0xbb43('0x1e')](function(_0x2042a4){if(_0x2042a4){_0x4a957b[_0xbb43('0x5c')][_0xbb43('0x60')]=_0x2042a4['id'];return db[_0xbb43('0x69')]['create'](_0x4a957b[_0xbb43('0x5c')]);}})['then'](respondWithResult(_0x250021,null))[_0xbb43('0x27')](handleError(_0x250021,null));};exports[_0xbb43('0x6a')]=function(_0x1788b1,_0x21bea1,_0x244a14){var _0x5395c8={'raw':![],'where':{}};var _0x10498d={};var _0x22add9={'count':0x0,'rows':[]};return db[_0xbb43('0x3c')][_0xbb43('0x6b')]({'where':{'id':_0x1788b1[_0xbb43('0x5d')]['id']}})['then'](handleEntityNotFound(_0x21bea1,null))[_0xbb43('0x1e')](function(_0x48efd9){if(_0x48efd9){_0x10498d[_0xbb43('0x41')]=_[_0xbb43('0x43')](db[_0xbb43('0x69')][_0xbb43('0x3d')]);_0x10498d[_0xbb43('0x42')]=_['keys'](_0x1788b1[_0xbb43('0x42')]);_0x10498d['filters']=_[_0xbb43('0x45')](_0x10498d['model'],_0x10498d[_0xbb43('0x42')]);_0x5395c8['attributes']=_[_0xbb43('0x45')](_0x10498d[_0xbb43('0x41')],qs[_0xbb43('0x47')](_0x1788b1['query'][_0xbb43('0x47')]));_0x5395c8['attributes']=_0x5395c8[_0xbb43('0x46')][_0xbb43('0x48')]?_0x5395c8['attributes']:_0x10498d[_0xbb43('0x41')];if(!_0x1788b1[_0xbb43('0x42')][_0xbb43('0x62')](_0xbb43('0x63'))){_0x5395c8['limit']=qs[_0xbb43('0x2d')](_0x1788b1[_0xbb43('0x42')]['limit']);_0x5395c8['offset']=qs['offset'](_0x1788b1[_0xbb43('0x42')]['offset']);}_0x5395c8[_0xbb43('0x49')]=qs[_0xbb43('0x4a')](_0x1788b1[_0xbb43('0x42')]['sort']);_0x5395c8['where']=qs[_0xbb43('0x44')](_[_0xbb43('0x64')](_0x1788b1[_0xbb43('0x42')],_0x10498d[_0xbb43('0x44')]));_0x5395c8['where'][_0xbb43('0x60')]=_0x48efd9['id'];if(_0x1788b1[_0xbb43('0x42')][_0xbb43('0x4c')]){_0x5395c8['where']=_[_0xbb43('0x4d')](_0x5395c8[_0xbb43('0x4b')],{'$or':_[_0xbb43('0x3b')](_0x5395c8[_0xbb43('0x46')],function(_0x316478){var _0x516291={};_0x516291[_0x316478]={'$like':'%'+_0x1788b1[_0xbb43('0x42')]['filter']+'%'};return _0x516291;})});}_0x5395c8=_[_0xbb43('0x4d')]({},_0x5395c8,_0x1788b1[_0xbb43('0x4e')]);return db[_0xbb43('0x69')][_0xbb43('0x2b')]({'where':_0x5395c8['where']})[_0xbb43('0x1e')](function(_0x56b945){_0x22add9[_0xbb43('0x2b')]=_0x56b945;if(_0x1788b1[_0xbb43('0x42')]['includeAll']){_0x5395c8[_0xbb43('0x52')]=[{'all':!![]}];}return db[_0xbb43('0x69')][_0xbb43('0x50')](_0x5395c8);})[_0xbb43('0x1e')](function(_0x5569ef){_0x22add9['rows']=_0x5569ef;return _0x22add9;});}})['then'](respondWithFilteredResult(_0x21bea1,_0x5395c8))[_0xbb43('0x27')](handleError(_0x21bea1,null));};exports[_0xbb43('0x6c')]=function(_0x4ed06a,_0x3537d8,_0x27db99){return db[_0xbb43('0x3c')][_0xbb43('0x53')]({'where':{'id':_0x4ed06a[_0xbb43('0x5d')]['id']}})[_0xbb43('0x1e')](handleEntityNotFound(_0x3537d8,null))[_0xbb43('0x1e')](function(_0xf3db56){if(_0xf3db56){return _0xf3db56[_0xbb43('0x6c')](_0x4ed06a['query'][_0xbb43('0x67')]);}})[_0xbb43('0x1e')](respondWithStatusCode(_0x3537d8,null))[_0xbb43('0x27')](handleError(_0x3537d8,null));};exports[_0xbb43('0x6d')]=function(_0x2a95cb,_0x2d9e0f,_0x1d6eda){return db[_0xbb43('0x6e')][_0xbb43('0x53')]({'where':{'id':_0x2a95cb[_0xbb43('0x5d')]['id']}})[_0xbb43('0x1e')](handleEntityNotFound(_0x2d9e0f,null))['then'](function(_0x3299f8){if(_0x3299f8){return _0x3299f8[_0xbb43('0x6d')](_0x2a95cb['body'][_0xbb43('0x67')],_[_0xbb43('0x6f')](_0x2a95cb[_0xbb43('0x5c')],['ids','id'])||{});}})['then'](respondWithResult(_0x2d9e0f,null))[_0xbb43('0x27')](handleError(_0x2d9e0f,null));};exports[_0xbb43('0x70')]=function(_0x3e6c48,_0x187f44,_0x10a641){var _0xb43624={'raw':![],'where':{}};var _0x1584a6={};var _0xebceea={'count':0x0,'rows':[]};return db['FaxAccount'][_0xbb43('0x6b')]({'where':{'id':_0x3e6c48[_0xbb43('0x5d')]['id']}})[_0xbb43('0x1e')](handleEntityNotFound(_0x187f44,null))[_0xbb43('0x1e')](function(_0x1a377d){if(_0x1a377d){_0x1584a6['model']=_['keys'](db[_0xbb43('0x6e')][_0xbb43('0x3d')]);_0x1584a6[_0xbb43('0x42')]=_[_0xbb43('0x43')](_0x3e6c48['query']);_0x1584a6[_0xbb43('0x44')]=_['intersection'](_0x1584a6['model'],_0x1584a6['query']);_0xb43624[_0xbb43('0x46')]=_[_0xbb43('0x45')](_0x1584a6[_0xbb43('0x41')],qs['fields'](_0x3e6c48[_0xbb43('0x42')][_0xbb43('0x47')]));_0xb43624[_0xbb43('0x46')]=_0xb43624['attributes'][_0xbb43('0x48')]?_0xb43624['attributes']:_0x1584a6[_0xbb43('0x41')];if(!_0x3e6c48[_0xbb43('0x42')][_0xbb43('0x62')](_0xbb43('0x63'))){_0xb43624[_0xbb43('0x2d')]=qs['limit'](_0x3e6c48[_0xbb43('0x42')][_0xbb43('0x2d')]);_0xb43624['offset']=qs[_0xbb43('0x2c')](_0x3e6c48['query']['offset']);}_0xb43624[_0xbb43('0x49')]=qs['sort'](_0x3e6c48[_0xbb43('0x42')][_0xbb43('0x4a')]);_0xb43624[_0xbb43('0x4b')]=qs[_0xbb43('0x44')](_['pick'](_0x3e6c48['query'],_0x1584a6[_0xbb43('0x44')]));_0xb43624[_0xbb43('0x4b')][_0xbb43('0x60')]=_0x1a377d['id'];if(_0x3e6c48[_0xbb43('0x42')]['filter']){_0xb43624[_0xbb43('0x4b')]=_[_0xbb43('0x4d')](_0xb43624[_0xbb43('0x4b')],{'$or':_[_0xbb43('0x3b')](_0xb43624['attributes'],function(_0x29755f){var _0x31922b={};_0x31922b[_0x29755f]={'$like':'%'+_0x3e6c48['query'][_0xbb43('0x4c')]+'%'};return _0x31922b;})});}_0xb43624=_['merge']({},_0xb43624,_0x3e6c48[_0xbb43('0x4e')]);return db[_0xbb43('0x6e')][_0xbb43('0x2b')]({'where':_0xb43624[_0xbb43('0x4b')]})['then'](function(_0x3aabcf){_0xebceea[_0xbb43('0x2b')]=_0x3aabcf;if(_0x3e6c48[_0xbb43('0x42')][_0xbb43('0x4f')]){_0xb43624[_0xbb43('0x52')]=[{'model':db[_0xbb43('0x71')],'as':'Contact','required':![]},{'model':db[_0xbb43('0x72')],'as':_0xbb43('0x73'),'attributes':[_0xbb43('0x36'),_0xbb43('0x74'),_0xbb43('0x75')],'required':![]},{'model':db['Tag'],'as':_0xbb43('0x76'),'attributes':['id',_0xbb43('0x36'),_0xbb43('0x77')],'where':_0x3e6c48['query'][_0xbb43('0x78')]?{'id':_0x3e6c48[_0xbb43('0x42')][_0xbb43('0x78')]}:undefined,'required':_0x3e6c48[_0xbb43('0x42')][_0xbb43('0x78')]?!![]:![]}];}return db[_0xbb43('0x6e')][_0xbb43('0x50')](_0xb43624);})[_0xbb43('0x1e')](function(_0x457739){_0xebceea[_0xbb43('0x65')]=_0x457739;return _0xebceea;});}})[_0xbb43('0x1e')](respondWithFilteredResult(_0x187f44,_0xb43624))[_0xbb43('0x27')](handleError(_0x187f44,null));};exports[_0xbb43('0x79')]=function(_0x1b1cc0,_0x10a6d2,_0x12332b){return db[_0xbb43('0x3c')][_0xbb43('0x6b')]({'where':{'id':_0x1b1cc0[_0xbb43('0x5d')]['id']}})[_0xbb43('0x1e')](handleEntityNotFound(_0x10a6d2,null))[_0xbb43('0x1e')](function(_0x52e0ab){if(_0x52e0ab){return db[_0xbb43('0x7a')][_0xbb43('0x7b')](function(_0x248a03){return db[_0xbb43('0x7c')][_0xbb43('0x32')]({'where':{'FaxAccountId':_0x1b1cc0['params']['id']},'transaction':_0x248a03})[_0xbb43('0x1e')](function(_0xf01572){var _0x915de4=_[_0xbb43('0x3b')](_0x1b1cc0[_0xbb43('0x5c')],function(_0x51d08e){_0x51d08e['FaxAccountId']=_0x1b1cc0[_0xbb43('0x5d')]['id'];return _0x51d08e;});return db[_0xbb43('0x7c')][_0xbb43('0x7d')](_0x915de4,{'transaction':_0x248a03});});})['then'](function(){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x1b1cc0[_0xbb43('0x5d')]['id']},'order':_0xbb43('0x7e')});});}})['then'](respondWithResult(_0x10a6d2,null))[_0xbb43('0x27')](handleError(_0x10a6d2,null));};exports[_0xbb43('0x7f')]=function(_0x3f07fc,_0x19c52c,_0x55ca8d){var _0x30cc03={};var _0x445590={};var _0x17229e;var _0x3caca5;return db[_0xbb43('0x3c')]['findOne']({'where':{'id':_0x3f07fc[_0xbb43('0x5d')]['id']}})[_0xbb43('0x1e')](handleEntityNotFound(_0x19c52c,null))[_0xbb43('0x1e')](function(_0x5004e5){if(_0x5004e5){_0x17229e=_0x5004e5;_0x445590[_0xbb43('0x41')]=_[_0xbb43('0x43')](db[_0xbb43('0x7c')][_0xbb43('0x3d')]);_0x445590[_0xbb43('0x42')]=_[_0xbb43('0x43')](_0x3f07fc[_0xbb43('0x42')]);_0x445590['filters']=_['intersection'](_0x445590['model'],_0x445590[_0xbb43('0x42')]);_0x30cc03[_0xbb43('0x46')]=_[_0xbb43('0x45')](_0x445590[_0xbb43('0x41')],qs[_0xbb43('0x47')](_0x3f07fc['query']['fields']));_0x30cc03[_0xbb43('0x46')]=_0x30cc03['attributes'][_0xbb43('0x48')]?_0x30cc03['attributes']:_0x445590['model'];_0x30cc03[_0xbb43('0x49')]=qs[_0xbb43('0x4a')](_0x3f07fc['query'][_0xbb43('0x4a')]);_0x30cc03['where']=qs[_0xbb43('0x44')](_['pick'](_0x3f07fc['query'],_0x445590['filters']));if(_0x3f07fc[_0xbb43('0x42')][_0xbb43('0x4c')]){_0x30cc03[_0xbb43('0x4b')]=_[_0xbb43('0x4d')](_0x30cc03[_0xbb43('0x4b')],{'$or':_['map'](_0x30cc03[_0xbb43('0x46')],function(_0x24d79d){var _0x2560b3={};_0x2560b3[_0x24d79d]={'$like':'%'+_0x3f07fc[_0xbb43('0x42')][_0xbb43('0x4c')]+'%'};return _0x2560b3;})});}_0x30cc03=_[_0xbb43('0x4d')]({},_0x30cc03,_0x3f07fc[_0xbb43('0x4e')]);return _0x17229e['getApplications'](_0x30cc03);}})[_0xbb43('0x1e')](function(_0x4b8799){if(_0x4b8799){_0x3caca5=_0x4b8799[_0xbb43('0x48')];if(!_0x3f07fc[_0xbb43('0x42')][_0xbb43('0x62')]('nolimit')){_0x30cc03[_0xbb43('0x2d')]=qs[_0xbb43('0x2d')](_0x3f07fc[_0xbb43('0x42')]['limit']);_0x30cc03[_0xbb43('0x2c')]=qs[_0xbb43('0x2c')](_0x3f07fc[_0xbb43('0x42')][_0xbb43('0x2c')]);}return _0x17229e[_0xbb43('0x7f')](_0x30cc03);}})['then'](function(_0x2dd09c){if(_0x2dd09c){return _0x2dd09c?{'count':_0x3caca5,'rows':_0x2dd09c}:null;}})['then'](respondWithResult(_0x19c52c,null))[_0xbb43('0x27')](handleError(_0x19c52c,null));};function Extension(_0x2458cc,_0x45ba96,_0x3aed08,_0xb9869e){this['context']=_0xbb43('0x80');this[_0xbb43('0x81')]=_0x2458cc[_0xbb43('0x82')];this[_0xbb43('0x83')]=_0xb9869e;this[_0xbb43('0x3f')]=_0xbb43('0x84');this[_0xbb43('0x85')]=_0xbb43('0x86');this[_0xbb43('0x60')]=_0x2458cc['id'];this['priority']=_0x45ba96;this[_0xbb43('0x87')]=_0x3aed08;}function createExtensionsReciveFax(_0x3aafec){var _0x2e2ab5=0x1;var _0x5dccd1=[];_0x5dccd1[_0xbb43('0x88')](new Extension(_0x3aafec,_0x2e2ab5,'',_0xbb43('0x89')));_0x2e2ab5+=0x1;_0x5dccd1[_0xbb43('0x88')](new Extension(_0x3aafec,_0x2e2ab5,_0xbb43('0x8a'),_0xbb43('0x8b')));_0x2e2ab5+=0x1;for(var _0xcec4e7 in _0x3aafec){if(_0x3aafec[_0xbb43('0x62')](_0xcec4e7)&&(_0xcec4e7===_0xbb43('0x8c')||_0xcec4e7===_0xbb43('0x82')||_0xcec4e7===_0xbb43('0x8d')||_0xcec4e7===_0xbb43('0x8e')||_0xcec4e7===_0xbb43('0x8f')||_0xcec4e7===_0xbb43('0x90')||_0xcec4e7===_0xbb43('0x91')||_0xcec4e7===_0xbb43('0x92')||_0xcec4e7===_0xbb43('0x93'))){_0x5dccd1[_0xbb43('0x88')](new Extension(_0x3aafec,_0x2e2ab5,'FAXOPT('+_0xcec4e7+')='+_0x3aafec[_0xcec4e7],_0xbb43('0x8b')));_0x2e2ab5+=0x1;}}_0x5dccd1[_0xbb43('0x88')](new Extension(_0x3aafec,_0x2e2ab5,'6',_0xbb43('0x94')));_0x2e2ab5+=0x1;_0x5dccd1['push'](new Extension(_0x3aafec,_0x2e2ab5,'/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',_0xbb43('0x95')));_0x2e2ab5=0x0;return _0x5dccd1;}exports[_0xbb43('0x96')]=function(_0x599d64,_0x4c005b,_0x338754){var _0x949b26;return db[_0xbb43('0x7a')][_0xbb43('0x7b')](function(_0x2ff011){return db['FaxAccount'][_0xbb43('0x54')](_0x599d64['body'],{'transaction':_0x2ff011})['then'](function(_0x4a955a){_0x949b26=_0x4a955a[_0xbb43('0x33')]({'plain':!![]});return db[_0xbb43('0x97')]['bulkCreate'](createExtensionsReciveFax(_0x949b26),{'transaction':_0x2ff011});});})[_0xbb43('0x1e')](function(){return _0x949b26;})[_0xbb43('0x1e')](respondWithResult(_0x4c005b,null))[_0xbb43('0x27')](handleError(_0x4c005b,null));};exports[_0xbb43('0x98')]=function(_0x1f4e5c,_0x47fddb,_0x2c1a04){var _0x298251;return db[_0xbb43('0x7a')][_0xbb43('0x7b')](function(_0x5948be){return db[_0xbb43('0x3c')]['update'](_0x1f4e5c[_0xbb43('0x5c')],{'where':{'id':_0x1f4e5c[_0xbb43('0x5c')]['id']},'transaction':_0x5948be})[_0xbb43('0x1e')](function(_0x45cb88){return db[_0xbb43('0x97')][_0xbb43('0x32')]({'where':{'FaxAccountId':_0x1f4e5c[_0xbb43('0x5c')]['id']},'transaction':_0x5948be})[_0xbb43('0x1e')](function(_0xf759b5){return db[_0xbb43('0x97')][_0xbb43('0x7d')](createExtensionsReciveFax(_[_0xbb43('0x6f')](_0x1f4e5c[_0xbb43('0x5c')],[_0xbb43('0x99'),_0xbb43('0x40'),_0xbb43('0x9a'),'updatedAt','TrunkId',_0xbb43('0x9b')])),{'transaction':_0x5948be});});});})[_0xbb43('0x1e')](function(){return db['FaxAccount'][_0xbb43('0x9c')](_0x1f4e5c[_0xbb43('0x5c')]['id']);})[_0xbb43('0x1e')](respondWithResult(_0x47fddb,null))[_0xbb43('0x27')](handleError(_0x47fddb,null));};exports[_0xbb43('0x9d')]=function(_0x5caa02,_0x1a534c,_0x5291bb){var _0x4ea141={'raw':!![],'where':{}};var _0x22c655={};var _0x4e926d={'count':0x0,'rows':[]};return db[_0xbb43('0x3c')]['findOne']({'where':{'id':_0x5caa02[_0xbb43('0x5d')]['id']}})[_0xbb43('0x1e')](handleEntityNotFound(_0x1a534c,null))[_0xbb43('0x1e')](function(_0x40057f){if(_0x40057f){_0x22c655['model']=_[_0xbb43('0x43')](db[_0xbb43('0x9e')][_0xbb43('0x3d')]);_0x22c655[_0xbb43('0x42')]=_['keys'](_0x5caa02[_0xbb43('0x42')]);_0x22c655[_0xbb43('0x44')]=_[_0xbb43('0x45')](_0x22c655['model'],_0x22c655[_0xbb43('0x42')]);_0x4ea141[_0xbb43('0x46')]=_[_0xbb43('0x45')](_0x22c655[_0xbb43('0x41')],qs[_0xbb43('0x47')](_0x5caa02['query'][_0xbb43('0x47')]));_0x4ea141['attributes']=_0x4ea141['attributes'][_0xbb43('0x48')]?_0x4ea141['attributes']:_0x22c655[_0xbb43('0x41')];if(!_0x5caa02[_0xbb43('0x42')][_0xbb43('0x62')](_0xbb43('0x63'))){_0x4ea141[_0xbb43('0x2d')]=qs['limit'](_0x5caa02[_0xbb43('0x42')][_0xbb43('0x2d')]);_0x4ea141['offset']=qs[_0xbb43('0x2c')](_0x5caa02[_0xbb43('0x42')][_0xbb43('0x2c')]);}_0x4ea141[_0xbb43('0x49')]=qs[_0xbb43('0x4a')](_0x5caa02[_0xbb43('0x42')]['sort']);_0x4ea141[_0xbb43('0x4b')]=qs[_0xbb43('0x44')](_[_0xbb43('0x64')](_0x5caa02[_0xbb43('0x42')],_0x22c655[_0xbb43('0x44')]));_0x4ea141[_0xbb43('0x4b')][_0xbb43('0x60')]=_0x40057f['id'];if(_0x5caa02[_0xbb43('0x42')]['filter']){_0x4ea141[_0xbb43('0x4b')]=_[_0xbb43('0x4d')](_0x4ea141['where'],{'$or':_[_0xbb43('0x3b')](_0x4ea141[_0xbb43('0x46')],function(_0xab4bd0){var _0x1ba615={};_0x1ba615[_0xab4bd0]={'$like':'%'+_0x5caa02[_0xbb43('0x42')][_0xbb43('0x4c')]+'%'};return _0x1ba615;})});}if(_0x5caa02[_0xbb43('0x42')][_0xbb43('0x9f')]){var _0x10dead=_0x5caa02[_0xbb43('0x42')][_0xbb43('0x9f')][_0xbb43('0xa0')](',');var _0x3c50b7={};_0x3c50b7[_0x10dead[0x0]]={'$gte':moment(_0x10dead[0x1])['format'](_0xbb43('0xa1'))};_0x4ea141[_0xbb43('0x4b')]=_['merge'](_0x4ea141[_0xbb43('0x4b')],_0x3c50b7);}_0x4ea141=_['merge']({},_0x4ea141,_0x5caa02[_0xbb43('0x4e')]);return db[_0xbb43('0x9e')][_0xbb43('0x2b')]({'where':_0x4ea141[_0xbb43('0x4b')]})[_0xbb43('0x1e')](function(_0x3995a7){_0x4e926d[_0xbb43('0x2b')]=_0x3995a7;if(_0x5caa02[_0xbb43('0x42')][_0xbb43('0x4f')]){_0x4ea141[_0xbb43('0x52')]=[{'all':!![]}];}return db[_0xbb43('0x9e')][_0xbb43('0x50')](_0x4ea141);})['then'](function(_0x5765a7){_0x4e926d[_0xbb43('0x65')]=_0x5765a7;return _0x4e926d;});}})[_0xbb43('0x1e')](respondWithFilteredResult(_0x1a534c,_0x4ea141))['catch'](handleError(_0x1a534c,null));};exports[_0xbb43('0x37')]=function(_0x509406,_0x4f440e,_0x5a6e9d){var _0x140520,_0x406b9f={},_0x2a4e37;if(_0x509406[_0xbb43('0x5c')]['to']){_0x2a4e37=_0x509406[_0xbb43('0x5c')]['to'][0x0];}return db[_0xbb43('0x3c')][_0xbb43('0x53')]({'where':{'id':_0x509406[_0xbb43('0x5d')]['id']},'include':[{'model':db['CmList'],'as':_0xbb43('0xa2'),'include':[{'model':db[_0xbb43('0x71')],'as':'Contacts','where':{'fax':_0x2a4e37},'limit':0x1,'order':[[_0xbb43('0xa3'),_0xbb43('0xa4')]]}]}]})[_0xbb43('0x1e')](handleEntityNotFound(_0x4f440e,null))[_0xbb43('0x1e')](function(_0x1ea37a){_0x140520=_0x1ea37a;if(_0x509406[_0xbb43('0x5c')][_0xbb43('0xa5')]&&_0x509406[_0xbb43('0x5c')][_0xbb43('0xa5')]['length']){for(var _0x522e8c=0x0;_0x522e8c<_0x509406[_0xbb43('0x5c')]['attachments']['length'];_0x522e8c+=0x1){_0x509406[_0xbb43('0x5c')][_0xbb43('0xa5')][_0x522e8c]={'filename':_0x509406[_0xbb43('0x5c')][_0xbb43('0xa5')][_0x522e8c]['name'],'id':_0x509406[_0xbb43('0x5c')]['attachments'][_0x522e8c]['id'],'path':path[_0xbb43('0xa6')](config['root'],_0xbb43('0xa7'),_0x509406['body'][_0xbb43('0xa5')][_0x522e8c][_0xbb43('0xa8')])};}}return respondWithRpcPromise(_0xbb43('0xa9'),_0xbb43('0xa9'),{'FaxAccountId':_['isNil'](_0x509406[_0xbb43('0x5d')]['id'])?undefined:_0x509406[_0xbb43('0x5d')]['id'],'path':_[_0xbb43('0xaa')](_0x509406[_0xbb43('0x5c')][_0xbb43('0xa5')][0x0][_0xbb43('0x9')])?undefined:_0x509406['body'][_0xbb43('0xa5')][0x0]['path'],'fax':_[_0xbb43('0xaa')](_0x509406[_0xbb43('0x5c')]['to'][0x0])?undefined:_0x509406[_0xbb43('0x5c')]['to'][0x0]},client9002);})['then'](function(){if(_0x140520){if(_[_0xbb43('0xaa')](_0x509406[_0xbb43('0x5c')]['from'])){_0x509406[_0xbb43('0x5c')][_0xbb43('0xab')]=util[_0xbb43('0xac')](_0xbb43('0xad'),_0x140520[_0xbb43('0x36')],_0x140520[_0xbb43('0xae')]);}if(_0x140520['List']){if(_0x140520[_0xbb43('0xa2')][_0xbb43('0xaf')]['length']){return _0x140520[_0xbb43('0xa2')]['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0xbb43('0xb0')](_0x509406['body'],{'firstName':_0x509406[_0xbb43('0x5c')]['to'][0x0],'phone':_0x509406[_0xbb43('0x5c')]['to'][0x0],'fax':_0x509406[_0xbb43('0x5c')]['to'][0x0],'ListId':_0x140520[_0xbb43('0x9b')]}));}}else{throw new Error(_0xbb43('0xb1'));}}else{throw new Error(_0xbb43('0xb2'));}})[_0xbb43('0x1e')](function(_0x284ef3){if(_0x284ef3){return db['FaxInteraction'][_0xbb43('0x53')]({'where':{'ContactId':_0x284ef3['id'],'closed':![],'FaxAccountId':_0x140520['id']}})[_0xbb43('0x1e')](function(_0x117803){if(_0x117803){return[_0x117803,![]];}return db[_0xbb43('0x6e')][_0xbb43('0x54')]({'UserId':_0x509406[_0xbb43('0x55')]['id'],'ContactId':_0x284ef3['id'],'FaxAccountId':_0x140520['id'],'fax':_0x509406[_0xbb43('0x5c')]['to'][0x0],'firstMsgDirection':_0xbb43('0xb3'),'Messages':[_[_0xbb43('0x4d')](_0x509406[_0xbb43('0x5c')],{'read':![],'body':_0x509406[_0xbb43('0x5c')][_0xbb43('0xa5')][0x0][_0xbb43('0xb4')],'FaxAccountId':_0x140520['id'],'UserId':_0x509406[_0xbb43('0x55')]['id'],'ContactId':_0x284ef3['id'],'AttachmentId':_0x509406['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xbb43('0x9e')],'as':_0xbb43('0xb5')}]})[_0xbb43('0x1e')](function(_0x31086a){return[_0x31086a,!![]];});});}else{throw new Error(_0xbb43('0xb6'));}})[_0xbb43('0xb7')](function(_0x5ee0f4,_0x240efd){if(_0x240efd){return _0x5ee0f4;}return db[_0xbb43('0x9e')][_0xbb43('0x54')]({'direction':_0xbb43('0xb3'),'read':![],'body':_0x509406[_0xbb43('0x5c')][_0xbb43('0xa5')][0x0][_0xbb43('0xb4')],'FaxAccountId':_0x140520['id'],'FaxInteractionId':_0x5ee0f4['id'],'UserId':_0x509406[_0xbb43('0x55')]['id'],'ContactId':_0x5ee0f4[_0xbb43('0xb8')],'AttachmentId':_0x509406['body']['attachments'][0x0]['id']})[_0xbb43('0x1e')](function(_0x1c381f){_0x5ee0f4[_0xbb43('0xb9')][_0xbb43('0xb5')]=[];_0x5ee0f4['dataValues'][_0xbb43('0xb5')]['push'](_0x1c381f['dataValues']);return _0x5ee0f4;});})[_0xbb43('0x1e')](function(_0x4337b2){respondWithRpcPromise(_0xbb43('0xba'),_0xbb43('0xba'),{'FaxAccountId':_[_0xbb43('0xaa')](_0x509406[_0xbb43('0x5d')]['id'])?undefined:_0x509406[_0xbb43('0x5d')]['id'],'path':_[_0xbb43('0xaa')](_0x509406[_0xbb43('0x5c')]['attachments'][0x0][_0xbb43('0x9')])?undefined:_0x509406[_0xbb43('0x5c')][_0xbb43('0xa5')][0x0]['path'],'fax':_['isNil'](_0x509406[_0xbb43('0x5c')]['to'][0x0])?undefined:_0x509406[_0xbb43('0x5c')]['to'][0x0],'AttachmentId':_0x509406[_0xbb43('0x5c')][_0xbb43('0xa5')][0x0]['id']},client9002)[_0xbb43('0x1e')](function(_0x284867){logger[_0xbb43('0xbb')](_0xbb43('0xbc'),_0x284867);})['catch'](function(_0x1505f4){logger[_0xbb43('0xbb')]('SendFaxRpc,\x20%s',_0x1505f4);});return _0x4337b2;})['then'](respondWithResult(_0x4f440e,null))[_0xbb43('0x27')](handleError(_0x4f440e,null));};exports[_0xbb43('0xbd')]=function(_0x5e7f6c,_0x4bcc06,_0x2624c3){return db[_0xbb43('0x3c')]['find']({'where':{'id':_0x5e7f6c[_0xbb43('0x5d')]['id']}})[_0xbb43('0x1e')](handleEntityNotFound(_0x4bcc06,null))[_0xbb43('0x1e')](function(_0x31663f){if(_0x31663f){return _0x31663f['addAgents'](_0x5e7f6c[_0xbb43('0x5c')]['ids'],_[_0xbb43('0x6f')](_0x5e7f6c['body'],[_0xbb43('0x67'),'id'])||{})[_0xbb43('0xb7')](function(_0x52220a){for(var _0x185e5a=0x0;_0x185e5a<_0x5e7f6c['body'][_0xbb43('0x67')][_0xbb43('0x48')];_0x185e5a+=0x1){socket[_0xbb43('0xbe')](_0xbb43('0xbf'),{'UserId':_0x5e7f6c['body'][_0xbb43('0x67')][_0x185e5a],'FaxAccountId':_0x5e7f6c[_0xbb43('0x5d')]['id']});}return _0x52220a;});}})['then'](respondWithResult(_0x4bcc06,null))[_0xbb43('0x27')](handleError(_0x4bcc06,null));};exports[_0xbb43('0xc0')]=function(_0x3238e2,_0x1bbc8c,_0x3cf8c7){return db[_0xbb43('0x3c')][_0xbb43('0x53')]({'where':{'id':_0x3238e2[_0xbb43('0x5d')]['id']}})[_0xbb43('0x1e')](handleEntityNotFound(_0x1bbc8c,null))['then'](function(_0x10ced4){if(_0x10ced4){return _0x10ced4[_0xbb43('0xc0')](_0x3238e2['query'][_0xbb43('0x67')])[_0xbb43('0x1e')](function(){if(_[_0xbb43('0xc1')](_0x3238e2['query'][_0xbb43('0x67')])){for(var _0x5e6b07=0x0;_0x5e6b07<_0x3238e2[_0xbb43('0x42')][_0xbb43('0x67')]['length'];_0x5e6b07+=0x1){socket['emit'](_0xbb43('0xc2'),{'UserId':Number(_0x3238e2[_0xbb43('0x42')][_0xbb43('0x67')][_0x5e6b07]),'FaxAccountId':Number(_0x3238e2[_0xbb43('0x5d')]['id'])});}}else{socket['emit'](_0xbb43('0xc2'),{'UserId':Number(_0x3238e2[_0xbb43('0x42')][_0xbb43('0x67')]),'FaxAccountId':Number(_0x3238e2['params']['id'])});}});}})[_0xbb43('0x1e')](respondWithStatusCode(_0x1bbc8c,null))[_0xbb43('0x27')](handleError(_0x1bbc8c,null));};exports[_0xbb43('0xc3')]=function(_0x15449c,_0x1be912,_0x54f32b){var _0x1ea79a={};var _0x5addc8={};var _0x3f8a98;var _0x32d305;return db[_0xbb43('0x3c')][_0xbb43('0x6b')]({'where':{'id':_0x15449c[_0xbb43('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1be912,null))[_0xbb43('0x1e')](function(_0x5a3601){if(_0x5a3601){_0x3f8a98=_0x5a3601;_0x5addc8[_0xbb43('0x41')]=_[_0xbb43('0x43')](db['User'][_0xbb43('0x3d')]);_0x5addc8[_0xbb43('0x42')]=_[_0xbb43('0x43')](_0x15449c[_0xbb43('0x42')]);_0x5addc8[_0xbb43('0x44')]=_['intersection'](_0x5addc8['model'],_0x5addc8[_0xbb43('0x42')]);_0x1ea79a[_0xbb43('0x46')]=_['intersection'](_0x5addc8[_0xbb43('0x41')],qs['fields'](_0x15449c['query']['fields']));_0x1ea79a[_0xbb43('0x46')]=_0x1ea79a[_0xbb43('0x46')][_0xbb43('0x48')]?_0x1ea79a['attributes']:_0x5addc8[_0xbb43('0x41')];_0x1ea79a[_0xbb43('0x49')]=qs[_0xbb43('0x4a')](_0x15449c[_0xbb43('0x42')][_0xbb43('0x4a')]);_0x1ea79a[_0xbb43('0x4b')]=qs[_0xbb43('0x44')](_['pick'](_0x15449c[_0xbb43('0x42')],_0x5addc8[_0xbb43('0x44')]));if(_0x15449c[_0xbb43('0x42')][_0xbb43('0x4c')]){_0x1ea79a['where']=_[_0xbb43('0x4d')](_0x1ea79a[_0xbb43('0x4b')],{'$or':_[_0xbb43('0x3b')](_0x1ea79a[_0xbb43('0x46')],function(_0x2b23ef){var _0x18401c={};_0x18401c[_0x2b23ef]={'$like':'%'+_0x15449c[_0xbb43('0x42')][_0xbb43('0x4c')]+'%'};return _0x18401c;})});}_0x1ea79a=_['merge']({},_0x1ea79a,_0x15449c['options']);return _0x3f8a98['getAgents'](_0x1ea79a);}})[_0xbb43('0x1e')](function(_0x20524a){if(_0x20524a){_0x32d305=_0x20524a[_0xbb43('0x48')];if(!_0x15449c[_0xbb43('0x42')][_0xbb43('0x62')]('nolimit')){_0x1ea79a[_0xbb43('0x2d')]=qs[_0xbb43('0x2d')](_0x15449c['query']['limit']);_0x1ea79a['offset']=qs['offset'](_0x15449c[_0xbb43('0x42')][_0xbb43('0x2c')]);}return _0x3f8a98['getAgents'](_0x1ea79a);}})[_0xbb43('0x1e')](function(_0x5ad3f1){if(_0x5ad3f1){return _0x5ad3f1?{'count':_0x32d305,'rows':_0x5ad3f1}:null;}})[_0xbb43('0x1e')](respondWithResult(_0x1be912,null))[_0xbb43('0x27')](handleError(_0x1be912,null));}; \ No newline at end of file +var _0xadb8=['internal','Tag','Tags','tag','addApplications','sequelize','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','exten','localstationid','app','system','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','ecm','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','transaction','VoiceExtension','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','Contacts','DESC','attachments','join','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','ListId','Send\x20Fax\x20failed','user','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','removeAgents','isArray','userFaxAccount:remove','User','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./faxAccount.socket','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','offset','limit','Content-Range','apply','reject','save','then','destroy','get','FaxAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','map','FaxAccount','fieldName','type','key','model','query','filters','intersection','fields','attributes','sort','where','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','keys','rawAttributes','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','order','pick','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xadb8,0x1d0));var _0x8adb=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xadb8[_0x3e112d];return _0x531c31;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8adb('0x1'));var rp=require(_0x8adb('0x2'));var moment=require(_0x8adb('0x3'));var BPromise=require(_0x8adb('0x4'));var Mustache=require(_0x8adb('0x5'));var util=require(_0x8adb('0x6'));var path=require(_0x8adb('0x7'));var sox=require('sox');var csv=require(_0x8adb('0x8'));var ejs=require(_0x8adb('0x9'));var fs=require('fs');var _=require(_0x8adb('0xa'));var squel=require(_0x8adb('0xb'));var crypto=require(_0x8adb('0xc'));var jsforce=require(_0x8adb('0xd'));var deskjs=require(_0x8adb('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8adb('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8adb('0x10'));var logger=require(_0x8adb('0x11'))(_0x8adb('0x12'));var utils=require(_0x8adb('0x13'));var config=require(_0x8adb('0x14'));var licenseUtil=require(_0x8adb('0x15'));var db=require(_0x8adb('0x16'))['db'];config[_0x8adb('0x17')]=_[_0x8adb('0x18')](config[_0x8adb('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8adb('0x19'))['register'](socket);var jayson=require(_0x8adb('0x1a'));var client=jayson[_0x8adb('0x1b')][_0x8adb('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x8adb('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x117054,_0x1096fb,_0x3f1ca7,_0x224e6c){return new BPromise(function(_0x13659c,_0x5baa07){var _0xc01052=_0x224e6c||client;return _0xc01052[_0x8adb('0x1d')](_0x117054,_0x3f1ca7)['then'](function(_0x5a0e22){logger[_0x8adb('0x1e')](_0x8adb('0x1f'),_0x1096fb,_0x8adb('0x20'));logger[_0x8adb('0x21')](_0x8adb('0x22'),_0x1096fb,_0x8adb('0x20'),JSON[_0x8adb('0x23')](_0x5a0e22));if(_0x5a0e22[_0x8adb('0x24')]){if(_0x5a0e22[_0x8adb('0x24')][_0x8adb('0x25')]===0x1f4){logger[_0x8adb('0x24')](_0x8adb('0x1f'),_0x1096fb,_0x5a0e22['error']['message']);return _0x5baa07(_0x5a0e22[_0x8adb('0x24')][_0x8adb('0x26')]);}logger['error'](_0x8adb('0x1f'),_0x1096fb,_0x5a0e22[_0x8adb('0x24')][_0x8adb('0x26')]);return _0x13659c(_0x5a0e22[_0x8adb('0x24')][_0x8adb('0x26')]);}else{logger[_0x8adb('0x1e')]('FaxAccount,\x20%s,\x20%s',_0x1096fb,_0x8adb('0x20'));_0x13659c(_0x5a0e22[_0x8adb('0x27')][_0x8adb('0x26')]);}})['catch'](function(_0x5c8c18){logger[_0x8adb('0x24')](_0x8adb('0x1f'),_0x1096fb,_0x5c8c18);_0x5baa07(_0x5c8c18);});});}function respondWithStatusCode(_0xd49f8f,_0x297213){_0x297213=_0x297213||0xcc;return function(_0x15ee75){if(_0x15ee75){return _0xd49f8f['sendStatus'](_0x297213);}return _0xd49f8f[_0x8adb('0x28')](_0x297213)[_0x8adb('0x29')]();};}function respondWithResult(_0x18f94e,_0x44f242){_0x44f242=_0x44f242||0xc8;return function(_0x42c6cc){if(_0x42c6cc){return _0x18f94e[_0x8adb('0x28')](_0x44f242)[_0x8adb('0x2a')](_0x42c6cc);}};}function respondWithFilteredResult(_0x5c5a7b,_0x410daf){return function(_0x3b6c55){if(_0x3b6c55){var _0x3e0ccf=_0x3b6c55['count'],_0x824eda=_0x410daf[_0x8adb('0x2b')],_0x48fd77=_0x410daf[_0x8adb('0x2b')]+_0x410daf[_0x8adb('0x2c')],_0x3ed9e9;if(_0x48fd77>=_0x3e0ccf){_0x48fd77=_0x3e0ccf;_0x3ed9e9=0xc8;}else{_0x3ed9e9=0xce;}_0x5c5a7b[_0x8adb('0x28')](_0x3ed9e9);return _0x5c5a7b['set'](_0x8adb('0x2d'),_0x824eda+'-'+_0x48fd77+'/'+_0x3e0ccf)['json'](_0x3b6c55);}return null;};}function patchUpdates(_0x260e63){return function(_0x5ac5d5){try{jsonpatch[_0x8adb('0x2e')](_0x5ac5d5,_0x260e63,!![]);}catch(_0x1661a3){return BPromise[_0x8adb('0x2f')](_0x1661a3);}return _0x5ac5d5[_0x8adb('0x30')]();};}function saveUpdates(_0x309236,_0xbbb350){return function(_0x4c2cfd){if(_0x4c2cfd){return _0x4c2cfd['update'](_0x309236)[_0x8adb('0x31')](function(_0x46fc72){return _0x46fc72;});}return null;};}function removeEntity(_0x429d5a,_0x77e99f){return function(_0x3ecaaf){if(_0x3ecaaf){return _0x3ecaaf[_0x8adb('0x32')]()[_0x8adb('0x31')](function(){var _0xdabe8e=_0x3ecaaf[_0x8adb('0x33')]({'plain':!![]});var _0x44f190=_0x8adb('0x34');return db[_0x8adb('0x35')][_0x8adb('0x32')]({'where':{'type':_0x44f190,'resourceId':_0xdabe8e['id']}})['then'](function(){return _0x3ecaaf;});})[_0x8adb('0x31')](function(){_0x429d5a[_0x8adb('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47783d,_0x51bc44){return function(_0x10c535){if(!_0x10c535){_0x47783d[_0x8adb('0x36')](0x194);}return _0x10c535;};}function handleError(_0x6c8b25,_0x108a80){_0x108a80=_0x108a80||0x1f4;return function(_0x365290){logger['error'](_0x365290[_0x8adb('0x37')]);if(_0x365290['name']){delete _0x365290[_0x8adb('0x38')];}_0x6c8b25[_0x8adb('0x28')](_0x108a80)['send'](_0x365290);};}exports[_0x8adb('0x39')]=function(_0x525afd,_0x233256){var _0x494afd={'include':[{'model':db[_0x8adb('0x3a')],'as':'mandatoryDispositionPause'}]},_0x40c7ab={},_0x25b361={'count':0x0,'rows':[]};var _0x54aab3=_[_0x8adb('0x3b')](db[_0x8adb('0x3c')]['rawAttributes'],function(_0x1f6481){return{'name':_0x1f6481[_0x8adb('0x3d')],'type':_0x1f6481[_0x8adb('0x3e')][_0x8adb('0x3f')]};});_0x40c7ab[_0x8adb('0x40')]=_[_0x8adb('0x3b')](_0x54aab3,_0x8adb('0x38'));_0x40c7ab[_0x8adb('0x41')]=_['keys'](_0x525afd['query']);_0x40c7ab[_0x8adb('0x42')]=_[_0x8adb('0x43')](_0x40c7ab[_0x8adb('0x40')],_0x40c7ab[_0x8adb('0x41')]);_0x494afd['attributes']=_[_0x8adb('0x43')](_0x40c7ab['model'],qs[_0x8adb('0x44')](_0x525afd[_0x8adb('0x41')][_0x8adb('0x44')]));_0x494afd[_0x8adb('0x45')]=_0x494afd['attributes']['length']?_0x494afd[_0x8adb('0x45')]:_0x40c7ab['model'];if(!_0x525afd[_0x8adb('0x41')]['hasOwnProperty']('nolimit')){_0x494afd[_0x8adb('0x2c')]=qs[_0x8adb('0x2c')](_0x525afd['query'][_0x8adb('0x2c')]);_0x494afd[_0x8adb('0x2b')]=qs[_0x8adb('0x2b')](_0x525afd[_0x8adb('0x41')][_0x8adb('0x2b')]);}_0x494afd['order']=qs[_0x8adb('0x46')](_0x525afd['query'][_0x8adb('0x46')]);_0x494afd[_0x8adb('0x47')]=qs['filters'](_['pick'](_0x525afd[_0x8adb('0x41')],_0x40c7ab['filters']),_0x54aab3);if(_0x525afd[_0x8adb('0x41')][_0x8adb('0x48')]){_0x494afd[_0x8adb('0x47')]=_[_0x8adb('0x49')](_0x494afd['where'],{'$or':_[_0x8adb('0x3b')](_0x54aab3,function(_0x44d658){if(_0x44d658['type']!=='VIRTUAL'){var _0x826c52={};_0x826c52[_0x44d658[_0x8adb('0x38')]]={'$like':'%'+_0x525afd[_0x8adb('0x41')]['filter']+'%'};return _0x826c52;}})});}_0x494afd=_[_0x8adb('0x49')]({},_0x494afd,_0x525afd[_0x8adb('0x4a')]);var _0x2b0790={'where':_0x494afd[_0x8adb('0x47')]};return db[_0x8adb('0x3c')][_0x8adb('0x4b')](_0x2b0790)[_0x8adb('0x31')](function(_0xf0aab8){_0x25b361[_0x8adb('0x4b')]=_0xf0aab8;if(_0x525afd[_0x8adb('0x41')][_0x8adb('0x4c')]){_0x494afd[_0x8adb('0x4d')]=[{'all':!![]}];}return db['FaxAccount'][_0x8adb('0x4e')](_0x494afd);})[_0x8adb('0x31')](function(_0x35ef9d){_0x25b361[_0x8adb('0x4f')]=_0x35ef9d;return _0x25b361;})[_0x8adb('0x31')](respondWithFilteredResult(_0x233256,_0x494afd))[_0x8adb('0x50')](handleError(_0x233256,null));};exports[_0x8adb('0x51')]=function(_0x2e8da9,_0x276af8){var _0x2033aa={'raw':![],'where':{'id':_0x2e8da9[_0x8adb('0x52')]['id']},'include':[{'model':db[_0x8adb('0x3a')],'as':_0x8adb('0x53')}]},_0x52daa7={};_0x52daa7[_0x8adb('0x40')]=_[_0x8adb('0x54')](db[_0x8adb('0x3c')][_0x8adb('0x55')]);_0x52daa7[_0x8adb('0x41')]=_['keys'](_0x2e8da9[_0x8adb('0x41')]);_0x52daa7[_0x8adb('0x42')]=_[_0x8adb('0x43')](_0x52daa7[_0x8adb('0x40')],_0x52daa7['query']);_0x2033aa[_0x8adb('0x45')]=_[_0x8adb('0x43')](_0x52daa7[_0x8adb('0x40')],qs[_0x8adb('0x44')](_0x2e8da9['query'][_0x8adb('0x44')]));_0x2033aa[_0x8adb('0x45')]=_0x2033aa[_0x8adb('0x45')][_0x8adb('0x56')]?_0x2033aa[_0x8adb('0x45')]:_0x52daa7[_0x8adb('0x40')];if(_0x2e8da9[_0x8adb('0x41')][_0x8adb('0x4c')]){_0x2033aa[_0x8adb('0x4d')]=[{'all':!![]}];}_0x2033aa=_[_0x8adb('0x49')]({},_0x2033aa,_0x2e8da9[_0x8adb('0x4a')]);return db[_0x8adb('0x3c')]['find'](_0x2033aa)[_0x8adb('0x31')](handleEntityNotFound(_0x276af8,null))['then'](respondWithResult(_0x276af8,null))['catch'](handleError(_0x276af8,null));};exports[_0x8adb('0x57')]=function(_0x714af1,_0x58473b){return db[_0x8adb('0x3c')][_0x8adb('0x57')](_0x714af1[_0x8adb('0x58')],{})[_0x8adb('0x31')](function(_0x545a47){var _0x1689b8=_0x714af1['user'][_0x8adb('0x33')]({'plain':!![]});if(!_0x1689b8)throw new Error(_0x8adb('0x59'));if(_0x1689b8[_0x8adb('0x5a')]==='user'){var _0x3142c3=_0x545a47['get']({'plain':!![]});var _0xb73009=_0x8adb('0x34');return db[_0x8adb('0x5b')]['find']({'where':{'name':_0xb73009,'userProfileId':_0x1689b8[_0x8adb('0x5c')]},'raw':!![]})[_0x8adb('0x31')](function(_0x256a20){if(_0x256a20&&_0x256a20[_0x8adb('0x5d')]===0x0){return db['UserProfileResource'][_0x8adb('0x57')]({'name':_0x3142c3[_0x8adb('0x38')],'resourceId':_0x3142c3['id'],'type':_0x256a20['name'],'sectionId':_0x256a20['id']},{})[_0x8adb('0x31')](function(){return _0x545a47;});}else{return _0x545a47;}})[_0x8adb('0x50')](function(_0x43730e){logger['error'](_0x8adb('0x5e'),_0x43730e);throw _0x43730e;});}return _0x545a47;})[_0x8adb('0x31')](respondWithResult(_0x58473b,0xc9))[_0x8adb('0x50')](handleError(_0x58473b,null));};exports[_0x8adb('0x5f')]=function(_0x4d46b6,_0x45b47a){if(_0x4d46b6['body']['id']){delete _0x4d46b6['body']['id'];}return db['FaxAccount'][_0x8adb('0x60')]({'where':{'id':_0x4d46b6[_0x8adb('0x52')]['id']},'include':[{'model':db[_0x8adb('0x3a')],'as':'mandatoryDispositionPause'}]})[_0x8adb('0x31')](handleEntityNotFound(_0x45b47a,null))['then'](saveUpdates(_0x4d46b6[_0x8adb('0x58')],null))[_0x8adb('0x31')](respondWithResult(_0x45b47a,null))[_0x8adb('0x50')](handleError(_0x45b47a,null));};exports[_0x8adb('0x32')]=function(_0x25e520,_0x3191a3){return db[_0x8adb('0x3c')][_0x8adb('0x60')]({'where':{'id':_0x25e520[_0x8adb('0x52')]['id']}})['then'](handleEntityNotFound(_0x3191a3,null))[_0x8adb('0x31')](removeEntity(_0x3191a3,null))[_0x8adb('0x50')](handleError(_0x3191a3,null));};exports[_0x8adb('0x61')]=function(_0x3e3634,_0x561b3f){return db[_0x8adb('0x3c')]['describe']()[_0x8adb('0x31')](respondWithResult(_0x561b3f,null))[_0x8adb('0x50')](handleError(_0x561b3f,null));};exports[_0x8adb('0x62')]=function(_0x4121b8,_0x5da656,_0x1a28e9){if(_0x4121b8[_0x8adb('0x58')]['id']){delete _0x4121b8['body']['id'];}return db['FaxAccount']['find']({'where':{'id':_0x4121b8[_0x8adb('0x52')]['id']}})[_0x8adb('0x31')](handleEntityNotFound(_0x5da656,null))[_0x8adb('0x31')](function(_0x551dd9){if(_0x551dd9){_0x4121b8['body'][_0x8adb('0x63')]=_0x551dd9['id'];return db[_0x8adb('0x64')][_0x8adb('0x57')](_0x4121b8['body']);}})[_0x8adb('0x31')](respondWithResult(_0x5da656,null))[_0x8adb('0x50')](handleError(_0x5da656,null));};exports[_0x8adb('0x65')]=function(_0x1a02df,_0x1476a6,_0x29b5d7){var _0x5e81a0={'raw':![],'where':{}};var _0x10c3bd={};var _0x53078f={'count':0x0,'rows':[]};return db['FaxAccount'][_0x8adb('0x66')]({'where':{'id':_0x1a02df[_0x8adb('0x52')]['id']}})[_0x8adb('0x31')](handleEntityNotFound(_0x1476a6,null))['then'](function(_0x4f9b71){if(_0x4f9b71){_0x10c3bd[_0x8adb('0x40')]=_[_0x8adb('0x54')](db[_0x8adb('0x64')][_0x8adb('0x55')]);_0x10c3bd[_0x8adb('0x41')]=_['keys'](_0x1a02df[_0x8adb('0x41')]);_0x10c3bd['filters']=_['intersection'](_0x10c3bd['model'],_0x10c3bd[_0x8adb('0x41')]);_0x5e81a0['attributes']=_[_0x8adb('0x43')](_0x10c3bd[_0x8adb('0x40')],qs[_0x8adb('0x44')](_0x1a02df['query'][_0x8adb('0x44')]));_0x5e81a0[_0x8adb('0x45')]=_0x5e81a0[_0x8adb('0x45')]['length']?_0x5e81a0['attributes']:_0x10c3bd[_0x8adb('0x40')];if(!_0x1a02df[_0x8adb('0x41')][_0x8adb('0x67')](_0x8adb('0x68'))){_0x5e81a0[_0x8adb('0x2c')]=qs['limit'](_0x1a02df[_0x8adb('0x41')][_0x8adb('0x2c')]);_0x5e81a0[_0x8adb('0x2b')]=qs[_0x8adb('0x2b')](_0x1a02df['query'][_0x8adb('0x2b')]);}_0x5e81a0[_0x8adb('0x69')]=qs[_0x8adb('0x46')](_0x1a02df[_0x8adb('0x41')][_0x8adb('0x46')]);_0x5e81a0[_0x8adb('0x47')]=qs['filters'](_[_0x8adb('0x6a')](_0x1a02df[_0x8adb('0x41')],_0x10c3bd['filters']));_0x5e81a0[_0x8adb('0x47')][_0x8adb('0x63')]=_0x4f9b71['id'];if(_0x1a02df[_0x8adb('0x41')][_0x8adb('0x48')]){_0x5e81a0[_0x8adb('0x47')]=_['merge'](_0x5e81a0[_0x8adb('0x47')],{'$or':_[_0x8adb('0x3b')](_0x5e81a0[_0x8adb('0x45')],function(_0x2fb4df){var _0x144be3={};_0x144be3[_0x2fb4df]={'$like':'%'+_0x1a02df['query'][_0x8adb('0x48')]+'%'};return _0x144be3;})});}_0x5e81a0=_[_0x8adb('0x49')]({},_0x5e81a0,_0x1a02df[_0x8adb('0x4a')]);return db['Disposition'][_0x8adb('0x4b')]({'where':_0x5e81a0[_0x8adb('0x47')]})[_0x8adb('0x31')](function(_0x53da56){_0x53078f[_0x8adb('0x4b')]=_0x53da56;if(_0x1a02df[_0x8adb('0x41')][_0x8adb('0x4c')]){_0x5e81a0[_0x8adb('0x4d')]=[{'all':!![]}];}return db[_0x8adb('0x64')][_0x8adb('0x4e')](_0x5e81a0);})[_0x8adb('0x31')](function(_0x4a5316){_0x53078f['rows']=_0x4a5316;return _0x53078f;});}})[_0x8adb('0x31')](respondWithFilteredResult(_0x1476a6,_0x5e81a0))[_0x8adb('0x50')](handleError(_0x1476a6,null));};exports[_0x8adb('0x6b')]=function(_0x43d5c8,_0x4b3755,_0x18311e){return db[_0x8adb('0x3c')][_0x8adb('0x60')]({'where':{'id':_0x43d5c8[_0x8adb('0x52')]['id']}})[_0x8adb('0x31')](handleEntityNotFound(_0x4b3755,null))[_0x8adb('0x31')](function(_0x12089f){if(_0x12089f){return _0x12089f[_0x8adb('0x6b')](_0x43d5c8[_0x8adb('0x41')][_0x8adb('0x6c')]);}})[_0x8adb('0x31')](respondWithStatusCode(_0x4b3755,null))['catch'](handleError(_0x4b3755,null));};exports[_0x8adb('0x6d')]=function(_0x2dac21,_0x323d88,_0x37ee91){if(_0x2dac21[_0x8adb('0x58')]['id']){delete _0x2dac21[_0x8adb('0x58')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x2dac21[_0x8adb('0x52')]['id']}})[_0x8adb('0x31')](handleEntityNotFound(_0x323d88,null))[_0x8adb('0x31')](function(_0x428052){if(_0x428052){_0x2dac21[_0x8adb('0x58')][_0x8adb('0x63')]=_0x428052['id'];return db[_0x8adb('0x6e')][_0x8adb('0x57')](_0x2dac21['body']);}})['then'](respondWithResult(_0x323d88,null))[_0x8adb('0x50')](handleError(_0x323d88,null));};exports['getAnswers']=function(_0x4aab88,_0x4afa20,_0x2c960a){var _0x4fb4c9={'raw':![],'where':{}};var _0x37ade9={};var _0x34d34c={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x4aab88['params']['id']}})['then'](handleEntityNotFound(_0x4afa20,null))[_0x8adb('0x31')](function(_0x61c23e){if(_0x61c23e){_0x37ade9[_0x8adb('0x40')]=_[_0x8adb('0x54')](db[_0x8adb('0x6e')][_0x8adb('0x55')]);_0x37ade9['query']=_[_0x8adb('0x54')](_0x4aab88[_0x8adb('0x41')]);_0x37ade9[_0x8adb('0x42')]=_[_0x8adb('0x43')](_0x37ade9[_0x8adb('0x40')],_0x37ade9['query']);_0x4fb4c9['attributes']=_[_0x8adb('0x43')](_0x37ade9[_0x8adb('0x40')],qs['fields'](_0x4aab88['query'][_0x8adb('0x44')]));_0x4fb4c9[_0x8adb('0x45')]=_0x4fb4c9[_0x8adb('0x45')][_0x8adb('0x56')]?_0x4fb4c9[_0x8adb('0x45')]:_0x37ade9[_0x8adb('0x40')];if(!_0x4aab88['query'][_0x8adb('0x67')](_0x8adb('0x68'))){_0x4fb4c9['limit']=qs[_0x8adb('0x2c')](_0x4aab88[_0x8adb('0x41')]['limit']);_0x4fb4c9[_0x8adb('0x2b')]=qs[_0x8adb('0x2b')](_0x4aab88[_0x8adb('0x41')][_0x8adb('0x2b')]);}_0x4fb4c9[_0x8adb('0x69')]=qs['sort'](_0x4aab88[_0x8adb('0x41')][_0x8adb('0x46')]);_0x4fb4c9['where']=qs['filters'](_[_0x8adb('0x6a')](_0x4aab88['query'],_0x37ade9[_0x8adb('0x42')]));_0x4fb4c9[_0x8adb('0x47')][_0x8adb('0x63')]=_0x61c23e['id'];if(_0x4aab88[_0x8adb('0x41')]['filter']){_0x4fb4c9['where']=_['merge'](_0x4fb4c9[_0x8adb('0x47')],{'$or':_[_0x8adb('0x3b')](_0x4fb4c9['attributes'],function(_0x349128){var _0x3ada16={};_0x3ada16[_0x349128]={'$like':'%'+_0x4aab88[_0x8adb('0x41')][_0x8adb('0x48')]+'%'};return _0x3ada16;})});}_0x4fb4c9=_['merge']({},_0x4fb4c9,_0x4aab88['options']);return db[_0x8adb('0x6e')][_0x8adb('0x4b')]({'where':_0x4fb4c9[_0x8adb('0x47')]})[_0x8adb('0x31')](function(_0x461581){_0x34d34c[_0x8adb('0x4b')]=_0x461581;if(_0x4aab88[_0x8adb('0x41')][_0x8adb('0x4c')]){_0x4fb4c9[_0x8adb('0x4d')]=[{'all':!![]}];}return db[_0x8adb('0x6e')][_0x8adb('0x4e')](_0x4fb4c9);})[_0x8adb('0x31')](function(_0x4e4b5e){_0x34d34c['rows']=_0x4e4b5e;return _0x34d34c;});}})[_0x8adb('0x31')](respondWithFilteredResult(_0x4afa20,_0x4fb4c9))[_0x8adb('0x50')](handleError(_0x4afa20,null));};exports[_0x8adb('0x6f')]=function(_0x2e025c,_0x5b3072,_0x4fd475){return db[_0x8adb('0x3c')]['find']({'where':{'id':_0x2e025c[_0x8adb('0x52')]['id']}})[_0x8adb('0x31')](handleEntityNotFound(_0x5b3072,null))[_0x8adb('0x31')](function(_0x588937){if(_0x588937){return _0x588937[_0x8adb('0x6f')](_0x2e025c[_0x8adb('0x41')][_0x8adb('0x6c')]);}})[_0x8adb('0x31')](respondWithStatusCode(_0x5b3072,null))[_0x8adb('0x50')](handleError(_0x5b3072,null));};exports[_0x8adb('0x70')]=function(_0xcaaed5,_0x40b381,_0x1bb4f1){return db[_0x8adb('0x71')]['find']({'where':{'id':_0xcaaed5[_0x8adb('0x52')]['id']}})[_0x8adb('0x31')](handleEntityNotFound(_0x40b381,null))['then'](function(_0x3afba9){if(_0x3afba9){return _0x3afba9[_0x8adb('0x70')](_0xcaaed5[_0x8adb('0x58')]['ids'],_[_0x8adb('0x72')](_0xcaaed5[_0x8adb('0x58')],['ids','id'])||{});}})[_0x8adb('0x31')](respondWithResult(_0x40b381,null))[_0x8adb('0x50')](handleError(_0x40b381,null));};exports[_0x8adb('0x73')]=function(_0xcc94a8,_0x2fab14,_0x446f52){var _0x85d4c6={'raw':![],'where':{}};var _0x3e2f23={};var _0x5243cf={'count':0x0,'rows':[]};return db[_0x8adb('0x3c')][_0x8adb('0x66')]({'where':{'id':_0xcc94a8[_0x8adb('0x52')]['id']}})[_0x8adb('0x31')](handleEntityNotFound(_0x2fab14,null))['then'](function(_0x5f4dc3){if(_0x5f4dc3){_0x3e2f23['model']=_[_0x8adb('0x54')](db[_0x8adb('0x71')]['rawAttributes']);_0x3e2f23[_0x8adb('0x41')]=_['keys'](_0xcc94a8[_0x8adb('0x41')]);_0x3e2f23[_0x8adb('0x42')]=_[_0x8adb('0x43')](_0x3e2f23[_0x8adb('0x40')],_0x3e2f23[_0x8adb('0x41')]);_0x85d4c6[_0x8adb('0x45')]=_[_0x8adb('0x43')](_0x3e2f23[_0x8adb('0x40')],qs['fields'](_0xcc94a8[_0x8adb('0x41')]['fields']));_0x85d4c6['attributes']=_0x85d4c6[_0x8adb('0x45')][_0x8adb('0x56')]?_0x85d4c6['attributes']:_0x3e2f23[_0x8adb('0x40')];if(!_0xcc94a8[_0x8adb('0x41')][_0x8adb('0x67')](_0x8adb('0x68'))){_0x85d4c6['limit']=qs[_0x8adb('0x2c')](_0xcc94a8[_0x8adb('0x41')]['limit']);_0x85d4c6[_0x8adb('0x2b')]=qs[_0x8adb('0x2b')](_0xcc94a8[_0x8adb('0x41')][_0x8adb('0x2b')]);}_0x85d4c6[_0x8adb('0x69')]=qs['sort'](_0xcc94a8[_0x8adb('0x41')][_0x8adb('0x46')]);_0x85d4c6[_0x8adb('0x47')]=qs[_0x8adb('0x42')](_[_0x8adb('0x6a')](_0xcc94a8['query'],_0x3e2f23[_0x8adb('0x42')]));_0x85d4c6[_0x8adb('0x47')][_0x8adb('0x63')]=_0x5f4dc3['id'];if(_0xcc94a8[_0x8adb('0x41')][_0x8adb('0x48')]){_0x85d4c6['where']=_['merge'](_0x85d4c6[_0x8adb('0x47')],{'$or':_[_0x8adb('0x3b')](_0x85d4c6[_0x8adb('0x45')],function(_0xf03e2){var _0x387112={};_0x387112[_0xf03e2]={'$like':'%'+_0xcc94a8[_0x8adb('0x41')][_0x8adb('0x48')]+'%'};return _0x387112;})});}_0x85d4c6=_[_0x8adb('0x49')]({},_0x85d4c6,_0xcc94a8[_0x8adb('0x4a')]);return db['FaxInteraction'][_0x8adb('0x4b')]({'where':_0x85d4c6[_0x8adb('0x47')]})[_0x8adb('0x31')](function(_0x5d957d){_0x5243cf[_0x8adb('0x4b')]=_0x5d957d;if(_0xcc94a8[_0x8adb('0x41')][_0x8adb('0x4c')]){_0x85d4c6[_0x8adb('0x4d')]=[{'model':db[_0x8adb('0x74')],'as':_0x8adb('0x75'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x8adb('0x38'),'fullname',_0x8adb('0x76')],'required':![]},{'model':db[_0x8adb('0x77')],'as':_0x8adb('0x78'),'attributes':['id',_0x8adb('0x38'),'color'],'where':_0xcc94a8['query'][_0x8adb('0x79')]?{'id':_0xcc94a8['query']['tag']}:undefined,'required':_0xcc94a8[_0x8adb('0x41')][_0x8adb('0x79')]?!![]:![]}];}return db[_0x8adb('0x71')]['findAll'](_0x85d4c6);})[_0x8adb('0x31')](function(_0x2dedf3){_0x5243cf[_0x8adb('0x4f')]=_0x2dedf3;return _0x5243cf;});}})[_0x8adb('0x31')](respondWithFilteredResult(_0x2fab14,_0x85d4c6))[_0x8adb('0x50')](handleError(_0x2fab14,null));};exports[_0x8adb('0x7a')]=function(_0x25fffb,_0x1c0a03,_0x56d73c){return db[_0x8adb('0x3c')][_0x8adb('0x66')]({'where':{'id':_0x25fffb[_0x8adb('0x52')]['id']}})[_0x8adb('0x31')](handleEntityNotFound(_0x1c0a03,null))['then'](function(_0x46c072){if(_0x46c072){return db[_0x8adb('0x7b')]['transaction'](function(_0xf72f72){return db[_0x8adb('0x7c')]['destroy']({'where':{'FaxAccountId':_0x25fffb[_0x8adb('0x52')]['id']},'transaction':_0xf72f72})[_0x8adb('0x31')](function(_0x2a2060){var _0x297410=_[_0x8adb('0x3b')](_0x25fffb[_0x8adb('0x58')],function(_0xdac51c){_0xdac51c[_0x8adb('0x63')]=_0x25fffb[_0x8adb('0x52')]['id'];return _0xdac51c;});return db[_0x8adb('0x7c')][_0x8adb('0x7d')](_0x297410,{'transaction':_0xf72f72});});})[_0x8adb('0x31')](function(){return db[_0x8adb('0x7c')][_0x8adb('0x7e')]({'where':{'FaxAccountId':_0x25fffb[_0x8adb('0x52')]['id']},'order':'priority'});});}})[_0x8adb('0x31')](respondWithResult(_0x1c0a03,null))['catch'](handleError(_0x1c0a03,null));};exports[_0x8adb('0x7f')]=function(_0x3c1bcd,_0x2cfc9c,_0x5bc127){var _0x2be6f3={};var _0x2c3493={};var _0x3704a0;var _0x5bb96b;return db[_0x8adb('0x3c')][_0x8adb('0x66')]({'where':{'id':_0x3c1bcd['params']['id']}})[_0x8adb('0x31')](handleEntityNotFound(_0x2cfc9c,null))[_0x8adb('0x31')](function(_0x14e537){if(_0x14e537){_0x3704a0=_0x14e537;_0x2c3493[_0x8adb('0x40')]=_[_0x8adb('0x54')](db[_0x8adb('0x7c')][_0x8adb('0x55')]);_0x2c3493[_0x8adb('0x41')]=_[_0x8adb('0x54')](_0x3c1bcd['query']);_0x2c3493[_0x8adb('0x42')]=_[_0x8adb('0x43')](_0x2c3493['model'],_0x2c3493[_0x8adb('0x41')]);_0x2be6f3['attributes']=_[_0x8adb('0x43')](_0x2c3493[_0x8adb('0x40')],qs[_0x8adb('0x44')](_0x3c1bcd['query'][_0x8adb('0x44')]));_0x2be6f3[_0x8adb('0x45')]=_0x2be6f3['attributes']['length']?_0x2be6f3[_0x8adb('0x45')]:_0x2c3493[_0x8adb('0x40')];_0x2be6f3[_0x8adb('0x69')]=qs['sort'](_0x3c1bcd[_0x8adb('0x41')]['sort']);_0x2be6f3[_0x8adb('0x47')]=qs[_0x8adb('0x42')](_[_0x8adb('0x6a')](_0x3c1bcd[_0x8adb('0x41')],_0x2c3493[_0x8adb('0x42')]));if(_0x3c1bcd[_0x8adb('0x41')][_0x8adb('0x48')]){_0x2be6f3['where']=_[_0x8adb('0x49')](_0x2be6f3[_0x8adb('0x47')],{'$or':_['map'](_0x2be6f3[_0x8adb('0x45')],function(_0x1fa08c){var _0x363b77={};_0x363b77[_0x1fa08c]={'$like':'%'+_0x3c1bcd['query'][_0x8adb('0x48')]+'%'};return _0x363b77;})});}_0x2be6f3=_[_0x8adb('0x49')]({},_0x2be6f3,_0x3c1bcd['options']);return _0x3704a0[_0x8adb('0x7f')](_0x2be6f3);}})[_0x8adb('0x31')](function(_0x241c4c){if(_0x241c4c){_0x5bb96b=_0x241c4c[_0x8adb('0x56')];if(!_0x3c1bcd['query'][_0x8adb('0x67')](_0x8adb('0x68'))){_0x2be6f3['limit']=qs[_0x8adb('0x2c')](_0x3c1bcd[_0x8adb('0x41')][_0x8adb('0x2c')]);_0x2be6f3[_0x8adb('0x2b')]=qs[_0x8adb('0x2b')](_0x3c1bcd[_0x8adb('0x41')][_0x8adb('0x2b')]);}return _0x3704a0[_0x8adb('0x7f')](_0x2be6f3);}})[_0x8adb('0x31')](function(_0x522876){if(_0x522876){return _0x522876?{'count':_0x5bb96b,'rows':_0x522876}:null;}})['then'](respondWithResult(_0x2cfc9c,null))['catch'](handleError(_0x2cfc9c,null));};function Extension(_0x24e082,_0x2a76df,_0x2c417d,_0x329e1e){this[_0x8adb('0x80')]='from-voip-provider';this[_0x8adb('0x81')]=_0x24e082[_0x8adb('0x82')];this[_0x8adb('0x83')]=_0x329e1e;this[_0x8adb('0x3e')]=_0x8adb('0x84');this['description']=_0x8adb('0x85');this['FaxAccountId']=_0x24e082['id'];this[_0x8adb('0x86')]=_0x2a76df;this[_0x8adb('0x87')]=_0x2c417d;}function createExtensionsReciveFax(_0x56126f){var _0x49a7c3=0x1;var _0x254352=[];_0x254352[_0x8adb('0x88')](new Extension(_0x56126f,_0x49a7c3,'',_0x8adb('0x89')));_0x49a7c3+=0x1;_0x254352[_0x8adb('0x88')](new Extension(_0x56126f,_0x49a7c3,_0x8adb('0x8a'),'Set'));_0x49a7c3+=0x1;for(var _0x32cbc8 in _0x56126f){if(_0x56126f['hasOwnProperty'](_0x32cbc8)&&(_0x32cbc8===_0x8adb('0x8b')||_0x32cbc8==='localstationid'||_0x32cbc8===_0x8adb('0x8c')||_0x32cbc8==='faxdetect'||_0x32cbc8===_0x8adb('0x8d')||_0x32cbc8===_0x8adb('0x8e')||_0x32cbc8===_0x8adb('0x8f')||_0x32cbc8===_0x8adb('0x90')||_0x32cbc8===_0x8adb('0x91'))){_0x254352[_0x8adb('0x88')](new Extension(_0x56126f,_0x49a7c3,_0x8adb('0x92')+_0x32cbc8+')='+_0x56126f[_0x32cbc8],_0x8adb('0x93')));_0x49a7c3+=0x1;}}_0x254352[_0x8adb('0x88')](new Extension(_0x56126f,_0x49a7c3,'6',_0x8adb('0x94')));_0x49a7c3+=0x1;_0x254352[_0x8adb('0x88')](new Extension(_0x56126f,_0x49a7c3,_0x8adb('0x95'),'ReceiveFax'));_0x49a7c3=0x0;return _0x254352;}exports['addAccountApplications']=function(_0x554626,_0x2dedf1,_0x4d215a){var _0x4f7dab;return db[_0x8adb('0x7b')][_0x8adb('0x96')](function(_0x2fc467){return db[_0x8adb('0x3c')]['create'](_0x554626[_0x8adb('0x58')],{'transaction':_0x2fc467})[_0x8adb('0x31')](function(_0x204438){_0x4f7dab=_0x204438['get']({'plain':!![]});return db['VoiceExtension'][_0x8adb('0x7d')](createExtensionsReciveFax(_0x4f7dab),{'transaction':_0x2fc467});});})[_0x8adb('0x31')](function(){return _0x4f7dab;})['then'](respondWithResult(_0x2dedf1,null))[_0x8adb('0x50')](handleError(_0x2dedf1,null));};exports['updateAccountApplications']=function(_0x4d10fd,_0x3d2ebb,_0x28eaed){var _0x358f64;return db[_0x8adb('0x7b')][_0x8adb('0x96')](function(_0x44c269){return db[_0x8adb('0x3c')][_0x8adb('0x5f')](_0x4d10fd['body'],{'where':{'id':_0x4d10fd[_0x8adb('0x58')]['id']},'transaction':_0x44c269})[_0x8adb('0x31')](function(_0x56c235){return db[_0x8adb('0x97')][_0x8adb('0x32')]({'where':{'FaxAccountId':_0x4d10fd[_0x8adb('0x58')]['id']},'transaction':_0x44c269})['then'](function(_0x27a7fe){return db[_0x8adb('0x97')][_0x8adb('0x7d')](createExtensionsReciveFax(_[_0x8adb('0x72')](_0x4d10fd[_0x8adb('0x58')],['tech',_0x8adb('0x3f'),_0x8adb('0x98'),_0x8adb('0x99'),_0x8adb('0x9a'),'ListId'])),{'transaction':_0x44c269});});});})[_0x8adb('0x31')](function(){return db[_0x8adb('0x3c')][_0x8adb('0x9b')](_0x4d10fd[_0x8adb('0x58')]['id']);})[_0x8adb('0x31')](respondWithResult(_0x3d2ebb,null))[_0x8adb('0x50')](handleError(_0x3d2ebb,null));};exports[_0x8adb('0x9c')]=function(_0x45a256,_0x1259ee,_0x2d5188){var _0x119eb9={'raw':!![],'where':{}};var _0x1e4f31={};var _0x3e5fc8={'count':0x0,'rows':[]};return db[_0x8adb('0x3c')][_0x8adb('0x66')]({'where':{'id':_0x45a256[_0x8adb('0x52')]['id']}})[_0x8adb('0x31')](handleEntityNotFound(_0x1259ee,null))[_0x8adb('0x31')](function(_0x528c95){if(_0x528c95){_0x1e4f31[_0x8adb('0x40')]=_['keys'](db[_0x8adb('0x9d')]['rawAttributes']);_0x1e4f31[_0x8adb('0x41')]=_[_0x8adb('0x54')](_0x45a256[_0x8adb('0x41')]);_0x1e4f31[_0x8adb('0x42')]=_[_0x8adb('0x43')](_0x1e4f31[_0x8adb('0x40')],_0x1e4f31[_0x8adb('0x41')]);_0x119eb9[_0x8adb('0x45')]=_[_0x8adb('0x43')](_0x1e4f31['model'],qs[_0x8adb('0x44')](_0x45a256[_0x8adb('0x41')][_0x8adb('0x44')]));_0x119eb9[_0x8adb('0x45')]=_0x119eb9[_0x8adb('0x45')][_0x8adb('0x56')]?_0x119eb9[_0x8adb('0x45')]:_0x1e4f31[_0x8adb('0x40')];if(!_0x45a256[_0x8adb('0x41')][_0x8adb('0x67')](_0x8adb('0x68'))){_0x119eb9[_0x8adb('0x2c')]=qs[_0x8adb('0x2c')](_0x45a256[_0x8adb('0x41')][_0x8adb('0x2c')]);_0x119eb9[_0x8adb('0x2b')]=qs[_0x8adb('0x2b')](_0x45a256[_0x8adb('0x41')][_0x8adb('0x2b')]);}_0x119eb9[_0x8adb('0x69')]=qs['sort'](_0x45a256[_0x8adb('0x41')][_0x8adb('0x46')]);_0x119eb9['where']=qs['filters'](_['pick'](_0x45a256[_0x8adb('0x41')],_0x1e4f31['filters']));_0x119eb9['where'][_0x8adb('0x63')]=_0x528c95['id'];if(_0x45a256['query'][_0x8adb('0x48')]){_0x119eb9[_0x8adb('0x47')]=_[_0x8adb('0x49')](_0x119eb9[_0x8adb('0x47')],{'$or':_[_0x8adb('0x3b')](_0x119eb9[_0x8adb('0x45')],function(_0x2c8d26){var _0xe9b76={};_0xe9b76[_0x2c8d26]={'$like':'%'+_0x45a256['query']['filter']+'%'};return _0xe9b76;})});}if(_0x45a256[_0x8adb('0x41')][_0x8adb('0x9e')]){var _0x41c44c=_0x45a256['query'][_0x8adb('0x9e')][_0x8adb('0x9f')](',');var _0xf354d={};_0xf354d[_0x41c44c[0x0]]={'$gte':moment(_0x41c44c[0x1])[_0x8adb('0xa0')](_0x8adb('0xa1'))};_0x119eb9[_0x8adb('0x47')]=_[_0x8adb('0x49')](_0x119eb9[_0x8adb('0x47')],_0xf354d);}_0x119eb9=_[_0x8adb('0x49')]({},_0x119eb9,_0x45a256[_0x8adb('0x4a')]);return db[_0x8adb('0x9d')][_0x8adb('0x4b')]({'where':_0x119eb9['where']})[_0x8adb('0x31')](function(_0x7641cc){_0x3e5fc8[_0x8adb('0x4b')]=_0x7641cc;if(_0x45a256[_0x8adb('0x41')][_0x8adb('0x4c')]){_0x119eb9[_0x8adb('0x4d')]=[{'all':!![]}];}return db[_0x8adb('0x9d')][_0x8adb('0x4e')](_0x119eb9);})[_0x8adb('0x31')](function(_0x2a4faf){_0x3e5fc8[_0x8adb('0x4f')]=_0x2a4faf;return _0x3e5fc8;});}})[_0x8adb('0x31')](respondWithFilteredResult(_0x1259ee,_0x119eb9))[_0x8adb('0x50')](handleError(_0x1259ee,null));};exports[_0x8adb('0xa2')]=function(_0x7d3042,_0x4d63e0,_0x4e43aa){var _0x4e1506,_0x365b79={},_0x1e57cb;if(_0x7d3042['body']['to']){_0x1e57cb=_0x7d3042['body']['to'][0x0];}return db[_0x8adb('0x3c')][_0x8adb('0x60')]({'where':{'id':_0x7d3042['params']['id']},'include':[{'model':db[_0x8adb('0xa3')],'as':_0x8adb('0xa4'),'include':[{'model':db[_0x8adb('0x74')],'as':_0x8adb('0xa5'),'where':{'fax':_0x1e57cb},'limit':0x1,'order':[['updatedAt',_0x8adb('0xa6')]]}]}]})[_0x8adb('0x31')](handleEntityNotFound(_0x4d63e0,null))['then'](function(_0x4d1698){_0x4e1506=_0x4d1698;if(_0x7d3042[_0x8adb('0x58')]['attachments']&&_0x7d3042[_0x8adb('0x58')][_0x8adb('0xa7')][_0x8adb('0x56')]){for(var _0x5ccc0b=0x0;_0x5ccc0b<_0x7d3042[_0x8adb('0x58')]['attachments'][_0x8adb('0x56')];_0x5ccc0b+=0x1){_0x7d3042[_0x8adb('0x58')]['attachments'][_0x5ccc0b]={'filename':_0x7d3042[_0x8adb('0x58')]['attachments'][_0x5ccc0b][_0x8adb('0x38')],'id':_0x7d3042['body'][_0x8adb('0xa7')][_0x5ccc0b]['id'],'path':path[_0x8adb('0xa8')](config[_0x8adb('0xa9')],'server/files/attachments',_0x7d3042[_0x8adb('0x58')]['attachments'][_0x5ccc0b][_0x8adb('0xaa')])};}}return respondWithRpcPromise(_0x8adb('0xab'),_0x8adb('0xab'),{'FaxAccountId':_[_0x8adb('0xac')](_0x7d3042[_0x8adb('0x52')]['id'])?undefined:_0x7d3042[_0x8adb('0x52')]['id'],'path':_['isNil'](_0x7d3042[_0x8adb('0x58')][_0x8adb('0xa7')][0x0][_0x8adb('0x7')])?undefined:_0x7d3042[_0x8adb('0x58')][_0x8adb('0xa7')][0x0]['path'],'fax':_[_0x8adb('0xac')](_0x7d3042[_0x8adb('0x58')]['to'][0x0])?undefined:_0x7d3042['body']['to'][0x0]},client9002);})[_0x8adb('0x31')](function(){if(_0x4e1506){if(_['isNil'](_0x7d3042[_0x8adb('0x58')][_0x8adb('0xad')])){_0x7d3042['body'][_0x8adb('0xad')]=util[_0x8adb('0xa0')](_0x8adb('0xae'),_0x4e1506[_0x8adb('0x38')],_0x4e1506['fax']);}if(_0x4e1506[_0x8adb('0xa4')]){if(_0x4e1506[_0x8adb('0xa4')][_0x8adb('0xa5')][_0x8adb('0x56')]){return _0x4e1506['List'][_0x8adb('0xa5')][0x0];}else{return db['CmContact']['create'](_[_0x8adb('0x18')](_0x7d3042[_0x8adb('0x58')],{'firstName':_0x7d3042[_0x8adb('0x58')]['to'][0x0],'phone':_0x7d3042[_0x8adb('0x58')]['to'][0x0],'fax':_0x7d3042[_0x8adb('0x58')]['to'][0x0],'ListId':_0x4e1506[_0x8adb('0xaf')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x8adb('0xb0'));}})[_0x8adb('0x31')](function(_0x433acd){if(_0x433acd){return db['FaxInteraction']['find']({'where':{'ContactId':_0x433acd['id'],'closed':![],'FaxAccountId':_0x4e1506['id']}})[_0x8adb('0x31')](function(_0x46e12c){if(_0x46e12c){return[_0x46e12c,![]];}return db[_0x8adb('0x71')]['create']({'UserId':_0x7d3042[_0x8adb('0xb1')]['id'],'ContactId':_0x433acd['id'],'FaxAccountId':_0x4e1506['id'],'fax':_0x7d3042[_0x8adb('0x58')]['to'][0x0],'firstMsgDirection':_0x8adb('0xb2'),'Messages':[_[_0x8adb('0x49')](_0x7d3042['body'],{'read':![],'body':_0x7d3042['body']['attachments'][0x0][_0x8adb('0xb3')],'FaxAccountId':_0x4e1506['id'],'UserId':_0x7d3042[_0x8adb('0xb1')]['id'],'ContactId':_0x433acd['id'],'AttachmentId':_0x7d3042[_0x8adb('0x58')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x8adb('0x9d')],'as':_0x8adb('0xb4')}]})[_0x8adb('0x31')](function(_0x31bc9e){return[_0x31bc9e,!![]];});});}else{throw new Error(_0x8adb('0xb5'));}})['spread'](function(_0x4ca8bb,_0x395e49){if(_0x395e49){return _0x4ca8bb;}return db['FaxMessage']['create']({'direction':'out','read':![],'body':_0x7d3042[_0x8adb('0x58')][_0x8adb('0xa7')][0x0][_0x8adb('0xb3')],'FaxAccountId':_0x4e1506['id'],'FaxInteractionId':_0x4ca8bb['id'],'UserId':_0x7d3042[_0x8adb('0xb1')]['id'],'ContactId':_0x4ca8bb[_0x8adb('0xb6')],'AttachmentId':_0x7d3042[_0x8adb('0x58')]['attachments'][0x0]['id']})[_0x8adb('0x31')](function(_0xd64812){_0x4ca8bb[_0x8adb('0xb7')]['Messages']=[];_0x4ca8bb[_0x8adb('0xb7')][_0x8adb('0xb4')][_0x8adb('0x88')](_0xd64812[_0x8adb('0xb7')]);return _0x4ca8bb;});})['then'](function(_0x1fd9ce){respondWithRpcPromise(_0x8adb('0xb8'),_0x8adb('0xb8'),{'FaxAccountId':_[_0x8adb('0xac')](_0x7d3042[_0x8adb('0x52')]['id'])?undefined:_0x7d3042[_0x8adb('0x52')]['id'],'path':_[_0x8adb('0xac')](_0x7d3042[_0x8adb('0x58')][_0x8adb('0xa7')][0x0][_0x8adb('0x7')])?undefined:_0x7d3042['body'][_0x8adb('0xa7')][0x0][_0x8adb('0x7')],'fax':_[_0x8adb('0xac')](_0x7d3042[_0x8adb('0x58')]['to'][0x0])?undefined:_0x7d3042[_0x8adb('0x58')]['to'][0x0],'AttachmentId':_0x7d3042['body'][_0x8adb('0xa7')][0x0]['id']},client9002)[_0x8adb('0x31')](function(_0x1f2124){logger[_0x8adb('0x1e')](_0x8adb('0xb9'),_0x1f2124);})[_0x8adb('0x50')](function(_0x495182){logger['info'](_0x8adb('0xb9'),_0x495182);});return _0x1fd9ce;})[_0x8adb('0x31')](respondWithResult(_0x4d63e0,null))[_0x8adb('0x50')](handleError(_0x4d63e0,null));};exports[_0x8adb('0xba')]=function(_0x7f2309,_0x452202,_0x558943){return db[_0x8adb('0x3c')][_0x8adb('0x60')]({'where':{'id':_0x7f2309[_0x8adb('0x52')]['id']}})['then'](handleEntityNotFound(_0x452202,null))['then'](function(_0x16beeb){if(_0x16beeb){return _0x16beeb[_0x8adb('0xba')](_0x7f2309[_0x8adb('0x58')][_0x8adb('0x6c')],_[_0x8adb('0x72')](_0x7f2309['body'],['ids','id'])||{})[_0x8adb('0xbb')](function(_0x5ae928){for(var _0xe1522f=0x0;_0xe1522f<_0x7f2309['body'][_0x8adb('0x6c')][_0x8adb('0x56')];_0xe1522f+=0x1){socket[_0x8adb('0xbc')]('userFaxAccount:save',{'UserId':_0x7f2309[_0x8adb('0x58')][_0x8adb('0x6c')][_0xe1522f],'FaxAccountId':_0x7f2309[_0x8adb('0x52')]['id']});}return _0x5ae928;});}})['then'](respondWithResult(_0x452202,null))[_0x8adb('0x50')](handleError(_0x452202,null));};exports[_0x8adb('0xbd')]=function(_0x15dff1,_0x1abd51,_0x4133a8){return db[_0x8adb('0x3c')]['find']({'where':{'id':_0x15dff1['params']['id']}})[_0x8adb('0x31')](handleEntityNotFound(_0x1abd51,null))[_0x8adb('0x31')](function(_0x29866d){if(_0x29866d){return _0x29866d[_0x8adb('0xbd')](_0x15dff1[_0x8adb('0x41')]['ids'])[_0x8adb('0x31')](function(){if(_[_0x8adb('0xbe')](_0x15dff1[_0x8adb('0x41')][_0x8adb('0x6c')])){for(var _0x5cccd9=0x0;_0x5cccd9<_0x15dff1['query']['ids']['length'];_0x5cccd9+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x15dff1[_0x8adb('0x41')][_0x8adb('0x6c')][_0x5cccd9]),'FaxAccountId':Number(_0x15dff1[_0x8adb('0x52')]['id'])});}}else{socket[_0x8adb('0xbc')](_0x8adb('0xbf'),{'UserId':Number(_0x15dff1[_0x8adb('0x41')]['ids']),'FaxAccountId':Number(_0x15dff1[_0x8adb('0x52')]['id'])});}});}})['then'](respondWithStatusCode(_0x1abd51,null))[_0x8adb('0x50')](handleError(_0x1abd51,null));};exports['getAgents']=function(_0x1f8f94,_0x30a410,_0x53d639){var _0x4d4fe3={};var _0x406d6a={};var _0xac3e94;var _0x1c6956;return db[_0x8adb('0x3c')][_0x8adb('0x66')]({'where':{'id':_0x1f8f94[_0x8adb('0x52')]['id']}})['then'](handleEntityNotFound(_0x30a410,null))[_0x8adb('0x31')](function(_0x254a3b){if(_0x254a3b){_0xac3e94=_0x254a3b;_0x406d6a[_0x8adb('0x40')]=_[_0x8adb('0x54')](db[_0x8adb('0xc0')][_0x8adb('0x55')]);_0x406d6a[_0x8adb('0x41')]=_[_0x8adb('0x54')](_0x1f8f94[_0x8adb('0x41')]);_0x406d6a['filters']=_[_0x8adb('0x43')](_0x406d6a['model'],_0x406d6a[_0x8adb('0x41')]);_0x4d4fe3['attributes']=_['intersection'](_0x406d6a[_0x8adb('0x40')],qs[_0x8adb('0x44')](_0x1f8f94[_0x8adb('0x41')][_0x8adb('0x44')]));_0x4d4fe3[_0x8adb('0x45')]=_0x4d4fe3[_0x8adb('0x45')][_0x8adb('0x56')]?_0x4d4fe3[_0x8adb('0x45')]:_0x406d6a[_0x8adb('0x40')];_0x4d4fe3['order']=qs['sort'](_0x1f8f94[_0x8adb('0x41')]['sort']);_0x4d4fe3[_0x8adb('0x47')]=qs[_0x8adb('0x42')](_['pick'](_0x1f8f94[_0x8adb('0x41')],_0x406d6a[_0x8adb('0x42')]));if(_0x1f8f94['query'][_0x8adb('0x48')]){_0x4d4fe3[_0x8adb('0x47')]=_[_0x8adb('0x49')](_0x4d4fe3[_0x8adb('0x47')],{'$or':_['map'](_0x4d4fe3[_0x8adb('0x45')],function(_0x252368){var _0x317fde={};_0x317fde[_0x252368]={'$like':'%'+_0x1f8f94[_0x8adb('0x41')]['filter']+'%'};return _0x317fde;})});}_0x4d4fe3=_[_0x8adb('0x49')]({},_0x4d4fe3,_0x1f8f94['options']);return _0xac3e94[_0x8adb('0xc1')](_0x4d4fe3);}})[_0x8adb('0x31')](function(_0x4a98db){if(_0x4a98db){_0x1c6956=_0x4a98db[_0x8adb('0x56')];if(!_0x1f8f94['query'][_0x8adb('0x67')](_0x8adb('0x68'))){_0x4d4fe3['limit']=qs[_0x8adb('0x2c')](_0x1f8f94['query'][_0x8adb('0x2c')]);_0x4d4fe3[_0x8adb('0x2b')]=qs[_0x8adb('0x2b')](_0x1f8f94[_0x8adb('0x41')]['offset']);}return _0xac3e94[_0x8adb('0xc1')](_0x4d4fe3);}})[_0x8adb('0x31')](function(_0x3bcbf8){if(_0x3bcbf8){return _0x3bcbf8?{'count':_0x1c6956,'rows':_0x3bcbf8}:null;}})[_0x8adb('0x31')](respondWithResult(_0x30a410,null))[_0x8adb('0x50')](handleError(_0x30a410,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 4e49437..eb7bf2e 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 _0x7116=['save','update','remove','emit','hasOwnProperty','hook','events','FaxAccount','setMaxListeners'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7116,0xb1));var _0x6711=function(_0x5f6852,_0x54e345){_0x5f6852=_0x5f6852-0x0;var _0x328ab6=_0x7116[_0x5f6852];return _0x328ab6;};'use strict';var EventEmitter=require(_0x6711('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x6711('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x6711('0x2')](0x0);var events={'afterCreate':_0x6711('0x3'),'afterUpdate':_0x6711('0x4'),'afterDestroy':_0x6711('0x5')};function emitEvent(_0x4decc4){return function(_0x41a5c1,_0x44e200,_0x488eaf){FaxAccountEvents[_0x6711('0x6')](_0x4decc4+':'+_0x41a5c1['id'],_0x41a5c1);FaxAccountEvents[_0x6711('0x6')](_0x4decc4,_0x41a5c1);_0x488eaf(null);};}for(var e in events){if(events[_0x6711('0x7')](e)){var event=events[e];FaxAccount[_0x6711('0x8')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x3be5=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','FaxAccount'];(function(_0x56e42c,_0x110b60){var _0x146992=function(_0x3702e3){while(--_0x3702e3){_0x56e42c['push'](_0x56e42c['shift']());}};_0x146992(++_0x110b60);}(_0x3be5,0x1d3));var _0x53be=function(_0x1cd54e,_0x14c119){_0x1cd54e=_0x1cd54e-0x0;var _0x552cf9=_0x3be5[_0x1cd54e];return _0x552cf9;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0x53be('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x53be('0x1')](0x0);var events={'afterCreate':_0x53be('0x2'),'afterUpdate':_0x53be('0x3'),'afterDestroy':_0x53be('0x4')};function emitEvent(_0x353bbd){return function(_0x322bd7,_0x38d8b5,_0x25dc49){FaxAccountEvents[_0x53be('0x5')](_0x353bbd+':'+_0x322bd7['id'],_0x322bd7);FaxAccountEvents[_0x53be('0x5')](_0x353bbd,_0x322bd7);_0x25dc49(null);};}for(var e in events){if(events[_0x53be('0x6')](e)){var event=events[e];FaxAccount[_0x53be('0x7')](e,emitEvent(event));}}module[_0x53be('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 9e5d905..d7d593f 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 _0x4e33=['../../config/logger','api','bluebird','request-promise','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4e33,0x1d5));var _0x34e3=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0x4e33[_0x50bf5a];return _0x4ddc1d;};'use strict';var _=require(_0x34e3('0x0'));var util=require('util');var logger=require(_0x34e3('0x1'))(_0x34e3('0x2'));var moment=require('moment');var BPromise=require(_0x34e3('0x3'));var rp=require(_0x34e3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x34e3('0x5'));var attributes=require(_0x34e3('0x6'));module[_0x34e3('0x7')]=function(_0x19b8db,_0xc32112){return _0x19b8db[_0x34e3('0x8')]('FaxAccount',attributes,{'tableName':_0x34e3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f5a=['../../config/environment','./faxAccount.attributes','exports','FaxAccount','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x46d8b2,_0x3829c4){var _0x1a351f=function(_0x279ce5){while(--_0x279ce5){_0x46d8b2['push'](_0x46d8b2['shift']());}};_0x1a351f(++_0x3829c4);}(_0x1f5a,0xd0));var _0xa1f5=function(_0x5c43f9,_0x2d839a){_0x5c43f9=_0x5c43f9-0x0;var _0x1adb41=_0x1f5a[_0x5c43f9];return _0x1adb41;};'use strict';var _=require(_0xa1f5('0x0'));var util=require(_0xa1f5('0x1'));var logger=require('../../config/logger')(_0xa1f5('0x2'));var moment=require(_0xa1f5('0x3'));var BPromise=require(_0xa1f5('0x4'));var rp=require(_0xa1f5('0x5'));var fs=require('fs');var path=require(_0xa1f5('0x6'));var rimraf=require(_0xa1f5('0x7'));var config=require(_0xa1f5('0x8'));var attributes=require(_0xa1f5('0x9'));module[_0xa1f5('0xa')]=function(_0x5b6725,_0x336a6f){return _0x5b6725['define'](_0xa1f5('0xb'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 3cee660..d7487af 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 _0x5a17=['body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','orderBy','asc','length','defaults','contact','FaxInteraction','find','create','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','ListId','body','isNil','from','ValidationError','from\x20is\x20mandatory'];(function(_0x17e241,_0x1e34fa){var _0x49b0c7=function(_0x15c9b9){while(--_0x15c9b9){_0x17e241['push'](_0x17e241['shift']());}};_0x49b0c7(++_0x1e34fa);}(_0x5a17,0x84));var _0x75a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a17[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x75a1('0x0'));var util=require('util');var moment=require(_0x75a1('0x1'));var BPromise=require(_0x75a1('0x2'));var rs=require(_0x75a1('0x3'));var fs=require('fs');var Redis=require(_0x75a1('0x4'));var db=require(_0x75a1('0x5'))['db'];var utils=require(_0x75a1('0x6'));var logger=require(_0x75a1('0x7'))(_0x75a1('0x8'));var config=require(_0x75a1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x75a1('0xa')][_0x75a1('0xb')]({'port':0x232c});config[_0x75a1('0xc')]=_['defaults'](config[_0x75a1('0xc')],{'host':_0x75a1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x75a1('0xc')]));require('./faxAccount.socket')[_0x75a1('0xe')](socket);function respondWithRpcPromise(_0x5c6b22,_0x1406f8,_0x17f1ed){return new BPromise(function(_0x4e6e63,_0xe83e0e){return client[_0x75a1('0xf')](_0x5c6b22,_0x17f1ed)[_0x75a1('0x10')](function(_0x7e58da){logger[_0x75a1('0x11')](_0x75a1('0x12'),_0x1406f8,_0x75a1('0x13'));logger[_0x75a1('0x14')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1406f8,_0x75a1('0x13'),JSON[_0x75a1('0x15')](_0x7e58da));if(_0x7e58da[_0x75a1('0x16')]){if(_0x7e58da['error']['code']===0x1f4){logger[_0x75a1('0x16')]('FaxAccount,\x20%s,\x20%s',_0x1406f8,_0x7e58da[_0x75a1('0x16')]['message']);return _0xe83e0e(_0x7e58da[_0x75a1('0x16')][_0x75a1('0x17')]);}logger[_0x75a1('0x16')](_0x75a1('0x12'),_0x1406f8,_0x7e58da[_0x75a1('0x16')][_0x75a1('0x17')]);return _0x4e6e63(_0x7e58da['error'][_0x75a1('0x17')]);}else{logger[_0x75a1('0x11')](_0x75a1('0x12'),_0x1406f8,_0x75a1('0x13'));_0x4e6e63(_0x7e58da[_0x75a1('0x18')][_0x75a1('0x17')]);}})['catch'](function(_0x3de960){logger[_0x75a1('0x16')](_0x75a1('0x12'),_0x1406f8,_0x3de960);_0xe83e0e(_0x3de960);});});}exports[_0x75a1('0x19')]=function(_0x31f147){var _0x176316=this;return new Promise(function(_0x3ba20e,_0x1b31e3){return db[_0x75a1('0x1a')][_0x75a1('0x1b')]({'raw':_0x31f147[_0x75a1('0x1c')]?_0x31f147[_0x75a1('0x1c')][_0x75a1('0x1d')]===undefined?!![]:![]:!![],'where':_0x31f147[_0x75a1('0x1c')]?_0x31f147[_0x75a1('0x1c')][_0x75a1('0x1e')]||null:null,'attributes':_0x31f147[_0x75a1('0x1c')]?_0x31f147['options'][_0x75a1('0x1f')]||null:null,'limit':_0x31f147[_0x75a1('0x1c')]?_0x31f147['options'][_0x75a1('0x20')]||null:null,'include':_0x31f147[_0x75a1('0x1c')]?_0x31f147['options'][_0x75a1('0x21')]?_[_0x75a1('0x22')](_0x31f147[_0x75a1('0x1c')][_0x75a1('0x21')],function(_0x895d78){return{'model':db[_0x895d78[_0x75a1('0x23')]],'as':_0x895d78['as'],'attributes':_0x895d78[_0x75a1('0x1f')],'include':_0x895d78[_0x75a1('0x21')]?_[_0x75a1('0x22')](_0x895d78['include'],function(_0x5b4562){return{'model':db[_0x5b4562['model']],'as':_0x5b4562['as'],'attributes':_0x5b4562[_0x75a1('0x1f')],'include':_0x5b4562[_0x75a1('0x21')]?_['map'](_0x5b4562['include'],function(_0x17cd17){return{'model':db[_0x17cd17['model']],'as':_0x17cd17['as'],'attributes':_0x17cd17[_0x75a1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x75a1('0x10')](function(_0x270e2e){logger['info']('GetFaxAccount',_0x31f147);logger[_0x75a1('0x14')](_0x75a1('0x19'),_0x31f147,JSON[_0x75a1('0x15')](_0x270e2e));_0x3ba20e(_0x270e2e);})[_0x75a1('0x24')](function(_0x21adae){logger[_0x75a1('0x16')](_0x75a1('0x19'),_0x21adae[_0x75a1('0x17')],_0x31f147);_0x1b31e3(_0x176316[_0x75a1('0x16')](0x1f4,_0x21adae['message']));});});};exports['NotifyFaxAccount']=function(_0x43c580,_0xcdb70c,_0x9e479b){var _0x5902d4=this;return new Promise(function(_0x122aae,_0x1e3cb1){var _0xa071c9={'body':_0x43c580['body'],'channel':_0x75a1('0x25')};var _0x209409=[];var _0x141475=[];var _0x4739ac={};return db[_0x75a1('0x26')][_0x75a1('0x27')]()[_0x75a1('0x10')](function(_0x56a2f8){if(!_0x56a2f8){throw new db[(_0x75a1('0x28'))]['ValidationError'](_0x75a1('0x29'));}_0x209409=_['difference'](_[_0x75a1('0x2a')](_0x56a2f8),[_0x75a1('0x2b'),_0x75a1('0x2c')]);_0x141475=_[_0x75a1('0x2d')](_[_0x75a1('0x2a')](_0x56a2f8),[_0x75a1('0x2b'),_0x75a1('0x2c'),'CompanyId',_0x75a1('0x2e')]);if(_0x43c580['body']['id']){delete _0x43c580[_0x75a1('0x2f')]['id'];}if(_[_0x75a1('0x30')](_0x43c580[_0x75a1('0x2f')][_0x75a1('0x31')])){throw new db[(_0x75a1('0x28'))][(_0x75a1('0x32'))](_0x75a1('0x33'));}if(_[_0x75a1('0x30')](_0x43c580[_0x75a1('0x2f')][_0x75a1('0x2f')])||_0x43c580[_0x75a1('0x2f')]['body']===''){throw new db[(_0x75a1('0x28'))][(_0x75a1('0x32'))](_0x75a1('0x34'));}if(_[_0x75a1('0x30')](_0x43c580[_0x75a1('0x2f')]['mapKey'])){throw new db['Sequelize'][(_0x75a1('0x32'))](_0x75a1('0x35')+_0x141475);}if(!_[_0x75a1('0x36')](_0x141475,_0x43c580[_0x75a1('0x2f')]['mapKey'])){throw new db[(_0x75a1('0x28'))]['ValidationError'](_0x75a1('0x37')+_0x141475);}_0x4739ac[_0x43c580[_0x75a1('0x2f')][_0x75a1('0x38')]]=_0x43c580[_0x75a1('0x2f')][_0x75a1('0x31')];})[_0x75a1('0x10')](function(){return db[_0x75a1('0x1a')]['find']({'where':{'id':_0x43c580[_0x75a1('0x39')]['id']},'include':[{'model':db[_0x75a1('0x3a')],'as':_0x75a1('0x3b'),'include':[{'model':db[_0x75a1('0x26')],'as':_0x75a1('0x3c'),'where':_0x4739ac,'limit':0x1,'order':[['updatedAt',_0x75a1('0x3d')]]}]},{'model':db[_0x75a1('0x3e')],'as':_0x75a1('0x3f')}]});})[_0x75a1('0x10')](function(_0x2fc3ae){if(_0x2fc3ae&&_0x2fc3ae['List']){var _0x485f8=_0x2fc3ae[_0x75a1('0x40')]({'plain':!![]});_0xa071c9[_0x75a1('0x39')]=_0x485f8;_0xa071c9[_0x75a1('0x41')]=_0x485f8['Applications'];_0xa071c9['list']=_0x485f8['List'];_0xa071c9['applications']=_[_0x75a1('0x42')](_0xa071c9[_0x75a1('0x41')],['priority'],[_0x75a1('0x43')]);if(_0xa071c9[_0x75a1('0x39')][_0x75a1('0x3f')]){delete _0xa071c9['account'][_0x75a1('0x3f')];}if(_0xa071c9[_0x75a1('0x39')]['List']&&_0xa071c9[_0x75a1('0x39')][_0x75a1('0x3b')]['Contacts'][_0x75a1('0x44')]){return _0xa071c9[_0x75a1('0x39')][_0x75a1('0x3b')]['Contacts'][0x0];}var _0x2532fa=_[_0x75a1('0x45')](_0x43c580[_0x75a1('0x2f')],{'firstName':_0x43c580[_0x75a1('0x2f')][_0x75a1('0x31')],'ListId':_0x485f8[_0x75a1('0x2e')]});_0x2532fa[_0x43c580[_0x75a1('0x2f')][_0x75a1('0x38')]]=_0x43c580[_0x75a1('0x2f')]['from'];return db[_0x75a1('0x26')]['create'](_0x2532fa,{'fields':_0x209409,'raw':!![]});}})[_0x75a1('0x10')](function(_0x472c60){_0xa071c9[_0x75a1('0x46')]=_0x472c60;if(_0x472c60){var _0x2b4931={'ContactId':_0x472c60['id'],'FaxAccountId':_0x43c580['account']['id'],'fax':_0x472c60['fax']};return db[_0x75a1('0x47')][_0x75a1('0x48')]({'where':{'ContactId':_0x472c60['id'],'closed':![],'FaxAccountId':_0x43c580['account']['id']}})[_0x75a1('0x10')](function(_0x20b032){if(_0x20b032){return[_0x20b032,![]];}return db['FaxInteraction'][_0x75a1('0x49')](_0x2b4931)[_0x75a1('0x10')](function(_0x3797d4){return[_0x3797d4,!![]];});});}else{throw new Error(_0x75a1('0x4a'));}})[_0x75a1('0x4b')](function(_0x5c0ab7,_0x4cdc22){var _0x3960fa=_0x5c0ab7[_0x75a1('0x40')]({'plain':!![]});if(_0x4cdc22){if(_0xa071c9[_0x75a1('0x39')][_0x75a1('0x4c')]){_0xa071c9['applications'][_0x75a1('0x4d')]({'id':0x0,'priority':_0xa071c9[_0x75a1('0x41')][_0x75a1('0x44')]+0x1,'app':_0x75a1('0x4e'),'appdata':_0x75a1('0x4f'),'interval':_0x75a1('0x50')});}_0x3960fa['created']=!![];}else{_0x3960fa[_0x75a1('0x51')]=![];}_0xa071c9[_0x75a1('0x52')]=_0x3960fa;return db[_0x75a1('0x53')]['create']({'body':_0x43c580[_0x75a1('0x2f')]['body'],'FaxAccountId':_0x43c580[_0x75a1('0x39')]['id'],'FaxInteractionId':_0x5c0ab7['id'],'direction':'in','ContactId':_0x5c0ab7[_0x75a1('0x54')],'AttachmentId':_0x43c580['body']['AttachmentId']});})[_0x75a1('0x10')](function(_0x1a3c66){_0xa071c9[_0x75a1('0x17')]=_0x1a3c66;if(_0xa071c9[_0x75a1('0x52')]['UserId']){return db['User'][_0x75a1('0x48')]({'attributes':['id',_0x75a1('0x55')],'where':{'id':_0xa071c9['interaction'][_0x75a1('0x56')]}})[_0x75a1('0x10')](function(_0x157f2b){if(_0x157f2b){_0xa071c9[_0x75a1('0x41')][_0x75a1('0x57')]({'id':0x0,'priority':0x0,'app':_0x75a1('0x58'),'appdata':_0x157f2b['name']+','+(_0xa071c9[_0x75a1('0x39')][_0x75a1('0x59')]||0xa),'interval':_0x75a1('0x50')});}return respondWithRpcPromise(_0x75a1('0x5a'),_0x75a1('0x5b'),_0xa071c9);});}return respondWithRpcPromise(_0x75a1('0x5a'),'startRouting',_0xa071c9);})[_0x75a1('0x10')](function(_0x50751e){_0x122aae(_0x50751e);})[_0x75a1('0x24')](function(_0xa709ce){_0x1e3cb1(_0x5902d4[_0x75a1('0x16')](0x1f4,_0xa709ce[_0x75a1('0x17')]));});});}; \ No newline at end of file +var _0xc7a2=['util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','include','map','model','then','body','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','find','account','CmList','List','DESC','FaxApplication','get','applications','list','orderBy','priority','asc','Applications','Contacts','length','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash'];(function(_0x129d14,_0x3b677a){var _0x5e3498=function(_0x5abf2a){while(--_0x5abf2a){_0x129d14['push'](_0x129d14['shift']());}};_0x5e3498(++_0x3b677a);}(_0xc7a2,0xbd));var _0x2c7a=function(_0x317e30,_0x32ad66){_0x317e30=_0x317e30-0x0;var _0x203788=_0xc7a2[_0x317e30];return _0x203788;};'use strict';var _=require(_0x2c7a('0x0'));var util=require(_0x2c7a('0x1'));var moment=require('moment');var BPromise=require(_0x2c7a('0x2'));var rs=require(_0x2c7a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c7a('0x4'))['db'];var utils=require(_0x2c7a('0x5'));var logger=require('../../config/logger')(_0x2c7a('0x6'));var config=require(_0x2c7a('0x7'));var jayson=require(_0x2c7a('0x8'));var client=jayson[_0x2c7a('0x9')]['http']({'port':0x232c});config['redis']=_[_0x2c7a('0xa')](config[_0x2c7a('0xb')],{'host':_0x2c7a('0xc'),'port':0x18eb});var socket=require(_0x2c7a('0xd'))(new Redis(config[_0x2c7a('0xb')]));require(_0x2c7a('0xe'))[_0x2c7a('0xf')](socket);function respondWithRpcPromise(_0x552a80,_0x2c9cb3,_0x257119){return new BPromise(function(_0x4bf56a,_0x2b8990){return client[_0x2c7a('0x10')](_0x552a80,_0x257119)['then'](function(_0x5b6777){logger[_0x2c7a('0x11')](_0x2c7a('0x12'),_0x2c9cb3,_0x2c7a('0x13'));logger[_0x2c7a('0x14')](_0x2c7a('0x15'),_0x2c9cb3,_0x2c7a('0x13'),JSON[_0x2c7a('0x16')](_0x5b6777));if(_0x5b6777[_0x2c7a('0x17')]){if(_0x5b6777[_0x2c7a('0x17')][_0x2c7a('0x18')]===0x1f4){logger[_0x2c7a('0x17')](_0x2c7a('0x12'),_0x2c9cb3,_0x5b6777[_0x2c7a('0x17')][_0x2c7a('0x19')]);return _0x2b8990(_0x5b6777[_0x2c7a('0x17')][_0x2c7a('0x19')]);}logger[_0x2c7a('0x17')](_0x2c7a('0x12'),_0x2c9cb3,_0x5b6777[_0x2c7a('0x17')]['message']);return _0x4bf56a(_0x5b6777['error'][_0x2c7a('0x19')]);}else{logger[_0x2c7a('0x11')](_0x2c7a('0x12'),_0x2c9cb3,'request\x20sent');_0x4bf56a(_0x5b6777[_0x2c7a('0x1a')]['message']);}})[_0x2c7a('0x1b')](function(_0x2871f7){logger[_0x2c7a('0x17')]('FaxAccount,\x20%s,\x20%s',_0x2c9cb3,_0x2871f7);_0x2b8990(_0x2871f7);});});}exports[_0x2c7a('0x1c')]=function(_0x118c9c){var _0x4772d5=this;return new Promise(function(_0x395072,_0x32bbfe){return db[_0x2c7a('0x1d')]['findAll']({'raw':_0x118c9c[_0x2c7a('0x1e')]?_0x118c9c[_0x2c7a('0x1e')][_0x2c7a('0x1f')]===undefined?!![]:![]:!![],'where':_0x118c9c[_0x2c7a('0x1e')]?_0x118c9c[_0x2c7a('0x1e')][_0x2c7a('0x20')]||null:null,'attributes':_0x118c9c[_0x2c7a('0x1e')]?_0x118c9c[_0x2c7a('0x1e')][_0x2c7a('0x21')]||null:null,'limit':_0x118c9c[_0x2c7a('0x1e')]?_0x118c9c[_0x2c7a('0x1e')]['limit']||null:null,'include':_0x118c9c['options']?_0x118c9c[_0x2c7a('0x1e')][_0x2c7a('0x22')]?_[_0x2c7a('0x23')](_0x118c9c[_0x2c7a('0x1e')]['include'],function(_0x3fd6d7){return{'model':db[_0x3fd6d7[_0x2c7a('0x24')]],'as':_0x3fd6d7['as'],'attributes':_0x3fd6d7[_0x2c7a('0x21')],'include':_0x3fd6d7[_0x2c7a('0x22')]?_[_0x2c7a('0x23')](_0x3fd6d7[_0x2c7a('0x22')],function(_0x2c8f19){return{'model':db[_0x2c8f19[_0x2c7a('0x24')]],'as':_0x2c8f19['as'],'attributes':_0x2c8f19[_0x2c7a('0x21')],'include':_0x2c8f19[_0x2c7a('0x22')]?_[_0x2c7a('0x23')](_0x2c8f19[_0x2c7a('0x22')],function(_0x5b4121){return{'model':db[_0x5b4121[_0x2c7a('0x24')]],'as':_0x5b4121['as'],'attributes':_0x5b4121[_0x2c7a('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2c7a('0x25')](function(_0x16433c){logger[_0x2c7a('0x11')](_0x2c7a('0x1c'),_0x118c9c);logger[_0x2c7a('0x14')](_0x2c7a('0x1c'),_0x118c9c,JSON[_0x2c7a('0x16')](_0x16433c));_0x395072(_0x16433c);})[_0x2c7a('0x1b')](function(_0x3921b6){logger[_0x2c7a('0x17')](_0x2c7a('0x1c'),_0x3921b6['message'],_0x118c9c);_0x32bbfe(_0x4772d5[_0x2c7a('0x17')](0x1f4,_0x3921b6[_0x2c7a('0x19')]));});});};exports['NotifyFaxAccount']=function(_0x4c0f8f,_0x126761,_0x20e4e3){var _0x2274d3=this;return new Promise(function(_0x3aef97,_0x2ba04a){var _0x4f29b4={'body':_0x4c0f8f[_0x2c7a('0x26')],'channel':'fax'};var _0xafc80e=[];var _0x3ea79f=[];var _0x4ca227={};return db[_0x2c7a('0x27')][_0x2c7a('0x28')]()[_0x2c7a('0x25')](function(_0x26c4f1){if(!_0x26c4f1){throw new db[(_0x2c7a('0x29'))]['ValidationError'](_0x2c7a('0x2a'));}_0xafc80e=_[_0x2c7a('0x2b')](_[_0x2c7a('0x2c')](_0x26c4f1),[_0x2c7a('0x2d'),_0x2c7a('0x2e')]);_0x3ea79f=_[_0x2c7a('0x2b')](_[_0x2c7a('0x2c')](_0x26c4f1),[_0x2c7a('0x2d'),_0x2c7a('0x2e'),_0x2c7a('0x2f'),_0x2c7a('0x30')]);if(_0x4c0f8f[_0x2c7a('0x26')]['id']){delete _0x4c0f8f[_0x2c7a('0x26')]['id'];}if(_['isNil'](_0x4c0f8f['body'][_0x2c7a('0x31')])){throw new db[(_0x2c7a('0x29'))][(_0x2c7a('0x32'))](_0x2c7a('0x33'));}if(_[_0x2c7a('0x34')](_0x4c0f8f['body'][_0x2c7a('0x26')])||_0x4c0f8f[_0x2c7a('0x26')][_0x2c7a('0x26')]===''){throw new db['Sequelize'][(_0x2c7a('0x32'))](_0x2c7a('0x35'));}if(_[_0x2c7a('0x34')](_0x4c0f8f[_0x2c7a('0x26')]['mapKey'])){throw new db[(_0x2c7a('0x29'))][(_0x2c7a('0x32'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3ea79f);}if(!_[_0x2c7a('0x36')](_0x3ea79f,_0x4c0f8f[_0x2c7a('0x26')]['mapKey'])){throw new db[(_0x2c7a('0x29'))][(_0x2c7a('0x32'))](_0x2c7a('0x37')+_0x3ea79f);}_0x4ca227[_0x4c0f8f[_0x2c7a('0x26')][_0x2c7a('0x38')]]=_0x4c0f8f[_0x2c7a('0x26')][_0x2c7a('0x31')];})['then'](function(){return db[_0x2c7a('0x1d')][_0x2c7a('0x39')]({'where':{'id':_0x4c0f8f[_0x2c7a('0x3a')]['id']},'include':[{'model':db[_0x2c7a('0x3b')],'as':_0x2c7a('0x3c'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4ca227,'limit':0x1,'order':[[_0x2c7a('0x2e'),_0x2c7a('0x3d')]]}]},{'model':db[_0x2c7a('0x3e')],'as':'Applications'}]});})[_0x2c7a('0x25')](function(_0x2bff70){if(_0x2bff70&&_0x2bff70[_0x2c7a('0x3c')]){var _0xb1da6=_0x2bff70[_0x2c7a('0x3f')]({'plain':!![]});_0x4f29b4[_0x2c7a('0x3a')]=_0xb1da6;_0x4f29b4[_0x2c7a('0x40')]=_0xb1da6['Applications'];_0x4f29b4[_0x2c7a('0x41')]=_0xb1da6['List'];_0x4f29b4[_0x2c7a('0x40')]=_[_0x2c7a('0x42')](_0x4f29b4['applications'],[_0x2c7a('0x43')],[_0x2c7a('0x44')]);if(_0x4f29b4['account'][_0x2c7a('0x45')]){delete _0x4f29b4['account']['Applications'];}if(_0x4f29b4[_0x2c7a('0x3a')]['List']&&_0x4f29b4[_0x2c7a('0x3a')]['List'][_0x2c7a('0x46')][_0x2c7a('0x47')]){return _0x4f29b4[_0x2c7a('0x3a')][_0x2c7a('0x3c')]['Contacts'][0x0];}var _0xcc6b30=_[_0x2c7a('0xa')](_0x4c0f8f['body'],{'firstName':_0x4c0f8f[_0x2c7a('0x26')]['from'],'ListId':_0xb1da6[_0x2c7a('0x30')]});_0xcc6b30[_0x4c0f8f[_0x2c7a('0x26')]['mapKey']]=_0x4c0f8f['body'][_0x2c7a('0x31')];return db[_0x2c7a('0x27')][_0x2c7a('0x48')](_0xcc6b30,{'fields':_0xafc80e,'raw':!![]});}})['then'](function(_0x230c05){_0x4f29b4[_0x2c7a('0x49')]=_0x230c05;if(_0x230c05){var _0x2957fc={'ContactId':_0x230c05['id'],'FaxAccountId':_0x4c0f8f[_0x2c7a('0x3a')]['id'],'fax':_0x230c05[_0x2c7a('0x4a')]};return db['FaxInteraction'][_0x2c7a('0x39')]({'where':{'ContactId':_0x230c05['id'],'closed':![],'FaxAccountId':_0x4c0f8f[_0x2c7a('0x3a')]['id']}})[_0x2c7a('0x25')](function(_0x2052d0){if(_0x2052d0){return[_0x2052d0,![]];}return db[_0x2c7a('0x4b')][_0x2c7a('0x48')](_0x2957fc)['then'](function(_0x2ff385){return[_0x2ff385,!![]];});});}else{throw new Error(_0x2c7a('0x4c'));}})[_0x2c7a('0x4d')](function(_0x60c889,_0x48f695){var _0x2a54e8=_0x60c889['get']({'plain':!![]});if(_0x48f695){if(_0x4f29b4[_0x2c7a('0x3a')][_0x2c7a('0x4e')]){_0x4f29b4[_0x2c7a('0x40')]['push']({'id':0x0,'priority':_0x4f29b4[_0x2c7a('0x40')][_0x2c7a('0x47')]+0x1,'app':_0x2c7a('0x4f'),'appdata':_0x2c7a('0x50'),'interval':_0x2c7a('0x51')});}_0x2a54e8[_0x2c7a('0x52')]=!![];}else{_0x2a54e8[_0x2c7a('0x52')]=![];}_0x4f29b4[_0x2c7a('0x53')]=_0x2a54e8;return db[_0x2c7a('0x54')][_0x2c7a('0x48')]({'body':_0x4c0f8f[_0x2c7a('0x26')]['body'],'FaxAccountId':_0x4c0f8f[_0x2c7a('0x3a')]['id'],'FaxInteractionId':_0x60c889['id'],'direction':'in','ContactId':_0x60c889[_0x2c7a('0x55')],'AttachmentId':_0x4c0f8f[_0x2c7a('0x26')][_0x2c7a('0x56')]});})[_0x2c7a('0x25')](function(_0x1adbc6){_0x4f29b4['message']=_0x1adbc6;if(_0x4f29b4['interaction'][_0x2c7a('0x57')]){return db[_0x2c7a('0x58')][_0x2c7a('0x39')]({'attributes':['id',_0x2c7a('0x59')],'where':{'id':_0x4f29b4[_0x2c7a('0x53')][_0x2c7a('0x57')]}})[_0x2c7a('0x25')](function(_0x2b1074){if(_0x2b1074){_0x4f29b4['applications'][_0x2c7a('0x5a')]({'id':0x0,'priority':0x0,'app':_0x2c7a('0x5b'),'appdata':_0x2b1074[_0x2c7a('0x59')]+','+(_0x4f29b4[_0x2c7a('0x3a')][_0x2c7a('0x5c')]||0xa),'interval':_0x2c7a('0x51')});}return respondWithRpcPromise(_0x2c7a('0x5d'),_0x2c7a('0x5e'),_0x4f29b4);});}return respondWithRpcPromise(_0x2c7a('0x5d'),_0x2c7a('0x5e'),_0x4f29b4);})['then'](function(_0x3a0db1){_0x3aef97(_0x3a0db1);})['catch'](function(_0x14d575){_0x2ba04a(_0x2274d3['error'](0x1f4,_0x14d575[_0x2c7a('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index b42966a..10304a5 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 _0x6050=['remove','update','emit','faxAccount:','./faxAccount.events','save'];(function(_0x5c43e1,_0x4c1705){var _0x397fa7=function(_0x4485e8){while(--_0x4485e8){_0x5c43e1['push'](_0x5c43e1['shift']());}};_0x397fa7(++_0x4c1705);}(_0x6050,0x196));var _0x0605=function(_0x5d35bf,_0x58629d){_0x5d35bf=_0x5d35bf-0x0;var _0x328e50=_0x6050[_0x5d35bf];return _0x328e50;};'use strict';var FaxAccountEvents=require(_0x0605('0x0'));var events=[_0x0605('0x1'),_0x0605('0x2'),_0x0605('0x3')];function createListener(_0x1b0075,_0x19c419){return function(_0x523a28){_0x19c419[_0x0605('0x4')](_0x1b0075,_0x523a28);};}function removeListener(_0x4576f4,_0x43403d){return function(){FaxAccountEvents['removeListener'](_0x4576f4,_0x43403d);};}exports['register']=function(_0x4aca21){for(var _0xd78d96=0x0,_0x578623=events['length'];_0xd78d96<_0x578623;_0xd78d96++){var _0x5660ad=events[_0xd78d96];var _0x1629bf=createListener(_0x0605('0x5')+_0x5660ad,_0x4aca21);FaxAccountEvents['on'](_0x5660ad,_0x1629bf);}}; \ No newline at end of file +var _0xc1c6=['length','faxAccount:','./faxAccount.events','save','remove','emit','register'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x50868a,_0x1f6a35){_0x50868a=_0x50868a-0x0;var _0x3d5e5f=_0xc1c6[_0x50868a];return _0x3d5e5f;};'use strict';var FaxAccountEvents=require(_0x6c1c('0x0'));var events=[_0x6c1c('0x1'),_0x6c1c('0x2'),'update'];function createListener(_0x114c93,_0x4c33ca){return function(_0x426398){_0x4c33ca[_0x6c1c('0x3')](_0x114c93,_0x426398);};}function removeListener(_0x265d2c,_0x59f799){return function(){FaxAccountEvents['removeListener'](_0x265d2c,_0x59f799);};}exports[_0x6c1c('0x4')]=function(_0x524a6b){for(var _0x50c1bb=0x0,_0x582bec=events[_0x6c1c('0x5')];_0x50c1bb<_0x582bec;_0x50c1bb++){var _0x2eb1ba=events[_0x50c1bb];var _0x38369d=createListener(_0x6c1c('0x6')+_0x2eb1ba,_0x524a6b);FaxAccountEvents['on'](_0x2eb1ba,_0x38369d);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index bea6919..3a9ac79 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 _0xd088=['./faxAccount.controller','get','index','isAuthenticated','/:id','show','/:id/dispositions','/:id/canned_answers','getApplications','/:id/messages','getMessages','/:id/users','post','create','addAnswer','/:id/interactions','addInteraction','/:id/applications','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','addAgents','put','update','delete','destroy','removeAnswers','removeAgents','multer','util','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x2ec1d9,_0x19dcd9){var _0x3a6dad=function(_0x2bc06e){while(--_0x2bc06e){_0x2ec1d9['push'](_0x2ec1d9['shift']());}};_0x3a6dad(++_0x19dcd9);}(_0xd088,0x190));var _0x8d08=function(_0x3f82d2,_0x42494a){_0x3f82d2=_0x3f82d2-0x0;var _0x195d28=_0xd088[_0x3f82d2];return _0x195d28;};'use strict';var multer=require(_0x8d08('0x0'));var util=require(_0x8d08('0x1'));var path=require(_0x8d08('0x2'));var timeout=require('connect-timeout');var express=require(_0x8d08('0x3'));var router=express[_0x8d08('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8d08('0x5'));var config=require(_0x8d08('0x6'));var controller=require(_0x8d08('0x7'));router[_0x8d08('0x8')]('/',auth['isAuthenticated'](),controller[_0x8d08('0x9')]);router[_0x8d08('0x8')]('/describe',auth[_0x8d08('0xa')](),controller['describe']);router[_0x8d08('0x8')](_0x8d08('0xb'),auth['isAuthenticated'](),controller[_0x8d08('0xc')]);router[_0x8d08('0x8')](_0x8d08('0xd'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0x8d08('0xe'),auth[_0x8d08('0xa')](),controller['getAnswers']);router[_0x8d08('0x8')]('/:id/interactions',auth[_0x8d08('0xa')](),controller['getInteractions']);router[_0x8d08('0x8')]('/:id/applications',auth[_0x8d08('0xa')](),controller[_0x8d08('0xf')]);router[_0x8d08('0x8')](_0x8d08('0x10'),auth[_0x8d08('0xa')](),controller[_0x8d08('0x11')]);router['get'](_0x8d08('0x12'),auth[_0x8d08('0xa')](),controller['getAgents']);router[_0x8d08('0x13')]('/',auth[_0x8d08('0xa')](),controller[_0x8d08('0x14')]);router[_0x8d08('0x13')](_0x8d08('0xd'),auth[_0x8d08('0xa')](),controller['addDisposition']);router[_0x8d08('0x13')](_0x8d08('0xe'),auth[_0x8d08('0xa')](),controller[_0x8d08('0x15')]);router[_0x8d08('0x13')](_0x8d08('0x16'),auth[_0x8d08('0xa')](),controller[_0x8d08('0x17')]);router[_0x8d08('0x13')](_0x8d08('0x18'),auth[_0x8d08('0xa')](),controller[_0x8d08('0x19')]);router[_0x8d08('0x13')](_0x8d08('0x1a'),auth[_0x8d08('0xa')](),controller['addAccountApplications']);router[_0x8d08('0x13')](_0x8d08('0x1b'),auth[_0x8d08('0xa')](),controller[_0x8d08('0x1c')]);router[_0x8d08('0x13')](_0x8d08('0x1d'),auth['isAuthenticated'](),controller['send']);router[_0x8d08('0x13')](_0x8d08('0x12'),auth[_0x8d08('0xa')](),controller[_0x8d08('0x1e')]);router[_0x8d08('0x1f')](_0x8d08('0xb'),auth['isAuthenticated'](),controller[_0x8d08('0x20')]);router[_0x8d08('0x21')]('/:id',auth[_0x8d08('0xa')](),controller[_0x8d08('0x22')]);router[_0x8d08('0x21')](_0x8d08('0xd'),auth[_0x8d08('0xa')](),controller['removeDispositions']);router[_0x8d08('0x21')](_0x8d08('0xe'),auth[_0x8d08('0xa')](),controller[_0x8d08('0x23')]);router[_0x8d08('0x21')](_0x8d08('0x12'),auth[_0x8d08('0xa')](),controller[_0x8d08('0x24')]);module['exports']=router; \ No newline at end of file +var _0xd44b=['path','connect-timeout','express','Router','../../config/environment','./faxAccount.controller','get','isAuthenticated','/:id','/:id/dispositions','getDispositions','/:id/interactions','/:id/applications','/:id/users','post','create','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','addAgents','put','update','delete','destroy','/:id/canned_answers','removeAgents','multer','util'];(function(_0x30f5bb,_0x4db4bd){var _0x1cfc00=function(_0x20f833){while(--_0x20f833){_0x30f5bb['push'](_0x30f5bb['shift']());}};_0x1cfc00(++_0x4db4bd);}(_0xd44b,0x106));var _0xbd44=function(_0x3611eb,_0x1f3b09){_0x3611eb=_0x3611eb-0x0;var _0x1eb100=_0xd44b[_0x3611eb];return _0x1eb100;};'use strict';var multer=require(_0xbd44('0x0'));var util=require(_0xbd44('0x1'));var path=require(_0xbd44('0x2'));var timeout=require(_0xbd44('0x3'));var express=require(_0xbd44('0x4'));var router=express[_0xbd44('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbd44('0x6'));var controller=require(_0xbd44('0x7'));router[_0xbd44('0x8')]('/',auth[_0xbd44('0x9')](),controller['index']);router[_0xbd44('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xbd44('0xa'),auth[_0xbd44('0x9')](),controller['show']);router[_0xbd44('0x8')](_0xbd44('0xb'),auth[_0xbd44('0x9')](),controller[_0xbd44('0xc')]);router['get']('/:id/canned_answers',auth[_0xbd44('0x9')](),controller['getAnswers']);router[_0xbd44('0x8')](_0xbd44('0xd'),auth[_0xbd44('0x9')](),controller['getInteractions']);router[_0xbd44('0x8')](_0xbd44('0xe'),auth[_0xbd44('0x9')](),controller['getApplications']);router['get']('/:id/messages',auth[_0xbd44('0x9')](),controller['getMessages']);router[_0xbd44('0x8')](_0xbd44('0xf'),auth[_0xbd44('0x9')](),controller['getAgents']);router[_0xbd44('0x10')]('/',auth[_0xbd44('0x9')](),controller[_0xbd44('0x11')]);router['post'](_0xbd44('0xb'),auth['isAuthenticated'](),controller[_0xbd44('0x12')]);router[_0xbd44('0x10')]('/:id/canned_answers',auth[_0xbd44('0x9')](),controller[_0xbd44('0x13')]);router['post']('/:id/interactions',auth[_0xbd44('0x9')](),controller[_0xbd44('0x14')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xbd44('0x15')]);router[_0xbd44('0x10')](_0xbd44('0x16'),auth[_0xbd44('0x9')](),controller['addAccountApplications']);router[_0xbd44('0x10')](_0xbd44('0x17'),auth[_0xbd44('0x9')](),controller[_0xbd44('0x18')]);router[_0xbd44('0x10')](_0xbd44('0x19'),auth[_0xbd44('0x9')](),controller['send']);router[_0xbd44('0x10')](_0xbd44('0xf'),auth[_0xbd44('0x9')](),controller[_0xbd44('0x1a')]);router[_0xbd44('0x1b')](_0xbd44('0xa'),auth[_0xbd44('0x9')](),controller[_0xbd44('0x1c')]);router[_0xbd44('0x1d')](_0xbd44('0xa'),auth['isAuthenticated'](),controller[_0xbd44('0x1e')]);router[_0xbd44('0x1d')](_0xbd44('0xb'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xbd44('0x1d')](_0xbd44('0x1f'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0xbd44('0x1d')](_0xbd44('0xf'),auth[_0xbd44('0x9')](),controller[_0xbd44('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index d0b6e2d..d2536c9 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 _0xb89c=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x2a7b34,_0x5da7bd){var _0x24f313=function(_0x379929){while(--_0x379929){_0x2a7b34['push'](_0x2a7b34['shift']());}};_0x24f313(++_0x5da7bd);}(_0xb89c,0x198));var _0xcb89=function(_0x209936,_0x220f80){_0x209936=_0x209936-0x0;var _0x138291=_0xb89c[_0x209936];return _0x138291;};'use strict';var Sequelize=require(_0xcb89('0x0'));module[_0xcb89('0x1')]={'priority':{'type':Sequelize[_0xcb89('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xcb89('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xcb89('0x4')]()},'description':{'type':Sequelize[_0xcb89('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xcb89('0x5')}}; \ No newline at end of file +var _0xfcbb=['exports','INTEGER','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x3e182f,_0x380ec7){var _0x23edc9=function(_0x3ca65e){while(--_0x3ca65e){_0x3e182f['push'](_0x3e182f['shift']());}};_0x23edc9(++_0x380ec7);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x4b1c77,_0x1e81d6){_0x4b1c77=_0x4b1c77-0x0;var _0x31c928=_0xfcbb[_0x4b1c77];return _0x31c928;};'use strict';var Sequelize=require(_0xbfcb('0x0'));module[_0xbfcb('0x1')]={'priority':{'type':Sequelize[_0xbfcb('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xbfcb('0x3')]()},'description':{'type':Sequelize[_0xbfcb('0x4')]},'interval':{'type':Sequelize[_0xbfcb('0x4')],'defaultValue':_0xbfcb('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 89725e1..fe2fde3 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 _0xfc96=['destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','update','html-pdf','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then'];(function(_0x954b3a,_0x10a7c1){var _0x3a313e=function(_0x1070ad){while(--_0x1070ad){_0x954b3a['push'](_0x954b3a['shift']());}};_0x3a313e(++_0x10a7c1);}(_0xfc96,0x197));var _0x6fc9=function(_0x2d20f1,_0x1b1b6c){_0x2d20f1=_0x2d20f1-0x0;var _0x133427=_0xfc96[_0x2d20f1];return _0x133427;};'use strict';var pdf=require(_0x6fc9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6fc9('0x1'));var zipdir=require(_0x6fc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6fc9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6fc9('0x4'));var util=require(_0x6fc9('0x5'));var path=require(_0x6fc9('0x6'));var sox=require(_0x6fc9('0x7'));var csv=require(_0x6fc9('0x8'));var ejs=require(_0x6fc9('0x9'));var fs=require('fs');var _=require(_0x6fc9('0xa'));var squel=require(_0x6fc9('0xb'));var crypto=require(_0x6fc9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6fc9('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6fc9('0xe'));var Papa=require('papaparse');var Redis=require(_0x6fc9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6fc9('0x10'));var as=require(_0x6fc9('0x11'));var hardwareService=require(_0x6fc9('0x12'));var logger=require(_0x6fc9('0x13'))(_0x6fc9('0x14'));var utils=require(_0x6fc9('0x15'));var config=require(_0x6fc9('0x16'));var licenseUtil=require(_0x6fc9('0x17'));var db=require(_0x6fc9('0x18'))['db'];function respondWithStatusCode(_0x518e8f,_0x3d07ce){_0x3d07ce=_0x3d07ce||0xcc;return function(_0xaa791c){if(_0xaa791c){return _0x518e8f[_0x6fc9('0x19')](_0x3d07ce);}return _0x518e8f[_0x6fc9('0x1a')](_0x3d07ce)[_0x6fc9('0x1b')]();};}function respondWithResult(_0x5c1193,_0xceca83){_0xceca83=_0xceca83||0xc8;return function(_0x4495c3){if(_0x4495c3){return _0x5c1193[_0x6fc9('0x1a')](_0xceca83)[_0x6fc9('0x1c')](_0x4495c3);}};}function respondWithFilteredResult(_0x582079,_0x385a27){return function(_0x359f49){if(_0x359f49){var _0x6b9c62=_0x359f49[_0x6fc9('0x1d')],_0x382b04=_0x385a27[_0x6fc9('0x1e')],_0x3c5f93=_0x385a27['offset']+_0x385a27['limit'],_0x8519fc;if(_0x3c5f93>=_0x6b9c62){_0x3c5f93=_0x6b9c62;_0x8519fc=0xc8;}else{_0x8519fc=0xce;}_0x582079[_0x6fc9('0x1a')](_0x8519fc);return _0x582079[_0x6fc9('0x1f')](_0x6fc9('0x20'),_0x382b04+'-'+_0x3c5f93+'/'+_0x6b9c62)['json'](_0x359f49);}return null;};}function patchUpdates(_0x1d921b){return function(_0x462631){try{jsonpatch[_0x6fc9('0x21')](_0x462631,_0x1d921b,!![]);}catch(_0x40bba1){return BPromise[_0x6fc9('0x22')](_0x40bba1);}return _0x462631[_0x6fc9('0x23')]();};}function saveUpdates(_0x11716f,_0x5261fa){return function(_0x1d8bf8){if(_0x1d8bf8){return _0x1d8bf8['update'](_0x11716f)[_0x6fc9('0x24')](function(_0x3a93a5){return _0x3a93a5;});}return null;};}function removeEntity(_0x42ab6f,_0x230c30){return function(_0x3615ac){if(_0x3615ac){return _0x3615ac[_0x6fc9('0x25')]()[_0x6fc9('0x24')](function(){_0x42ab6f[_0x6fc9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b9e25,_0x13e47b){return function(_0x4e92b4){if(!_0x4e92b4){_0x2b9e25[_0x6fc9('0x19')](0x194);}return _0x4e92b4;};}function handleError(_0x5ae0fc,_0x35a2b9){_0x35a2b9=_0x35a2b9||0x1f4;return function(_0x3ea630){logger[_0x6fc9('0x26')](_0x3ea630[_0x6fc9('0x27')]);if(_0x3ea630[_0x6fc9('0x28')]){delete _0x3ea630[_0x6fc9('0x28')];}_0x5ae0fc['status'](_0x35a2b9)[_0x6fc9('0x29')](_0x3ea630);};}exports[_0x6fc9('0x2a')]=function(_0x365176,_0x229b3b){var _0x1beadd={},_0x8e5be9={},_0x3206c3={'count':0x0,'rows':[]};var _0x4e3df8=_[_0x6fc9('0x2b')](db[_0x6fc9('0x2c')][_0x6fc9('0x2d')],function(_0x2b268c){return{'name':_0x2b268c[_0x6fc9('0x2e')],'type':_0x2b268c[_0x6fc9('0x2f')][_0x6fc9('0x30')]};});_0x8e5be9[_0x6fc9('0x31')]=_['map'](_0x4e3df8,_0x6fc9('0x28'));_0x8e5be9['query']=_[_0x6fc9('0x32')](_0x365176[_0x6fc9('0x33')]);_0x8e5be9[_0x6fc9('0x34')]=_[_0x6fc9('0x35')](_0x8e5be9[_0x6fc9('0x31')],_0x8e5be9[_0x6fc9('0x33')]);_0x1beadd[_0x6fc9('0x36')]=_['intersection'](_0x8e5be9[_0x6fc9('0x31')],qs['fields'](_0x365176[_0x6fc9('0x33')][_0x6fc9('0x37')]));_0x1beadd[_0x6fc9('0x36')]=_0x1beadd[_0x6fc9('0x36')][_0x6fc9('0x38')]?_0x1beadd[_0x6fc9('0x36')]:_0x8e5be9['model'];if(!_0x365176['query']['hasOwnProperty'](_0x6fc9('0x39'))){_0x1beadd['limit']=qs[_0x6fc9('0x3a')](_0x365176[_0x6fc9('0x33')][_0x6fc9('0x3a')]);_0x1beadd[_0x6fc9('0x1e')]=qs[_0x6fc9('0x1e')](_0x365176['query'][_0x6fc9('0x1e')]);}_0x1beadd['order']=qs['sort'](_0x365176['query']['sort']);_0x1beadd[_0x6fc9('0x3b')]=qs['filters'](_[_0x6fc9('0x3c')](_0x365176[_0x6fc9('0x33')],_0x8e5be9[_0x6fc9('0x34')]),_0x4e3df8);if(_0x365176[_0x6fc9('0x33')][_0x6fc9('0x3d')]){_0x1beadd['where']=_[_0x6fc9('0x3e')](_0x1beadd[_0x6fc9('0x3b')],{'$or':_[_0x6fc9('0x2b')](_0x4e3df8,function(_0x54011e){if(_0x54011e[_0x6fc9('0x2f')]!=='VIRTUAL'){var _0x5b937d={};_0x5b937d[_0x54011e[_0x6fc9('0x28')]]={'$like':'%'+_0x365176[_0x6fc9('0x33')][_0x6fc9('0x3d')]+'%'};return _0x5b937d;}})});}_0x1beadd=_[_0x6fc9('0x3e')]({},_0x1beadd,_0x365176[_0x6fc9('0x3f')]);var _0x4cbbc4={'where':_0x1beadd['where']};return db[_0x6fc9('0x2c')][_0x6fc9('0x1d')](_0x4cbbc4)[_0x6fc9('0x24')](function(_0x5aa77b){_0x3206c3[_0x6fc9('0x1d')]=_0x5aa77b;if(_0x365176[_0x6fc9('0x33')][_0x6fc9('0x40')]){_0x1beadd[_0x6fc9('0x41')]=[{'all':!![]}];}return db[_0x6fc9('0x2c')]['findAll'](_0x1beadd);})[_0x6fc9('0x24')](function(_0x137551){_0x3206c3[_0x6fc9('0x42')]=_0x137551;return _0x3206c3;})['then'](respondWithFilteredResult(_0x229b3b,_0x1beadd))[_0x6fc9('0x43')](handleError(_0x229b3b,null));};exports[_0x6fc9('0x44')]=function(_0x2e24dc,_0x3dbd48){var _0x277632={'raw':!![],'where':{'id':_0x2e24dc[_0x6fc9('0x45')]['id']}},_0xe677a9={};_0xe677a9[_0x6fc9('0x31')]=_[_0x6fc9('0x32')](db[_0x6fc9('0x2c')][_0x6fc9('0x2d')]);_0xe677a9[_0x6fc9('0x33')]=_['keys'](_0x2e24dc[_0x6fc9('0x33')]);_0xe677a9[_0x6fc9('0x34')]=_['intersection'](_0xe677a9['model'],_0xe677a9[_0x6fc9('0x33')]);_0x277632['attributes']=_['intersection'](_0xe677a9[_0x6fc9('0x31')],qs[_0x6fc9('0x37')](_0x2e24dc[_0x6fc9('0x33')]['fields']));_0x277632[_0x6fc9('0x36')]=_0x277632[_0x6fc9('0x36')][_0x6fc9('0x38')]?_0x277632['attributes']:_0xe677a9[_0x6fc9('0x31')];if(_0x2e24dc[_0x6fc9('0x33')]['includeAll']){_0x277632['include']=[{'all':!![]}];}_0x277632=_['merge']({},_0x277632,_0x2e24dc['options']);return db['FaxApplication'][_0x6fc9('0x46')](_0x277632)['then'](handleEntityNotFound(_0x3dbd48,null))[_0x6fc9('0x24')](respondWithResult(_0x3dbd48,null))[_0x6fc9('0x43')](handleError(_0x3dbd48,null));};exports[_0x6fc9('0x47')]=function(_0x17f627,_0x3532b9){return db['FaxApplication']['create'](_0x17f627[_0x6fc9('0x48')],{})['then'](respondWithResult(_0x3532b9,0xc9))[_0x6fc9('0x43')](handleError(_0x3532b9,null));};exports[_0x6fc9('0x49')]=function(_0x57c9f5,_0x276ef4){if(_0x57c9f5[_0x6fc9('0x48')]['id']){delete _0x57c9f5['body']['id'];}return db[_0x6fc9('0x2c')][_0x6fc9('0x46')]({'where':{'id':_0x57c9f5[_0x6fc9('0x45')]['id']}})[_0x6fc9('0x24')](handleEntityNotFound(_0x276ef4,null))[_0x6fc9('0x24')](saveUpdates(_0x57c9f5[_0x6fc9('0x48')],null))[_0x6fc9('0x24')](respondWithResult(_0x276ef4,null))['catch'](handleError(_0x276ef4,null));};exports[_0x6fc9('0x25')]=function(_0x58c7e0,_0x2fbb51){return db[_0x6fc9('0x2c')]['find']({'where':{'id':_0x58c7e0[_0x6fc9('0x45')]['id']}})['then'](handleEntityNotFound(_0x2fbb51,null))[_0x6fc9('0x24')](removeEntity(_0x2fbb51,null))[_0x6fc9('0x43')](handleError(_0x2fbb51,null));}; \ No newline at end of file +var _0xd022=['where','filter','merge','includeAll','findAll','rows','catch','params','include','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','then','error','stack','name','index','FaxApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','order','pick'];(function(_0x5de214,_0x107e9d){var _0x4df627=function(_0x4199e1){while(--_0x4199e1){_0x5de214['push'](_0x5de214['shift']());}};_0x4df627(++_0x107e9d);}(_0xd022,0x1b0));var _0x2d02=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd022[_0xfae23b];return _0x200640;};'use strict';var pdf=require(_0x2d02('0x0'));var emlformat=require(_0x2d02('0x1'));var rimraf=require(_0x2d02('0x2'));var zipdir=require(_0x2d02('0x3'));var jsonpatch=require(_0x2d02('0x4'));var rp=require(_0x2d02('0x5'));var moment=require(_0x2d02('0x6'));var BPromise=require(_0x2d02('0x7'));var Mustache=require(_0x2d02('0x8'));var util=require('util');var path=require(_0x2d02('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2d02('0xa'));var fs=require('fs');var _=require(_0x2d02('0xb'));var squel=require(_0x2d02('0xc'));var crypto=require(_0x2d02('0xd'));var jsforce=require(_0x2d02('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2d02('0xf'));var Papa=require(_0x2d02('0x10'));var Redis=require(_0x2d02('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2d02('0x12'));var as=require(_0x2d02('0x13'));var hardwareService=require(_0x2d02('0x14'));var logger=require('../../config/logger')(_0x2d02('0x15'));var utils=require(_0x2d02('0x16'));var config=require(_0x2d02('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x557421,_0x2bdb49){_0x2bdb49=_0x2bdb49||0xcc;return function(_0x44c7af){if(_0x44c7af){return _0x557421[_0x2d02('0x18')](_0x2bdb49);}return _0x557421[_0x2d02('0x19')](_0x2bdb49)[_0x2d02('0x1a')]();};}function respondWithResult(_0x45814b,_0x5eae63){_0x5eae63=_0x5eae63||0xc8;return function(_0x365f48){if(_0x365f48){return _0x45814b['status'](_0x5eae63)[_0x2d02('0x1b')](_0x365f48);}};}function respondWithFilteredResult(_0x316d8c,_0x54c610){return function(_0x349d7f){if(_0x349d7f){var _0x26bb5b=_0x349d7f[_0x2d02('0x1c')],_0x43cd08=_0x54c610[_0x2d02('0x1d')],_0x14eca9=_0x54c610['offset']+_0x54c610['limit'],_0x2c1957;if(_0x14eca9>=_0x26bb5b){_0x14eca9=_0x26bb5b;_0x2c1957=0xc8;}else{_0x2c1957=0xce;}_0x316d8c[_0x2d02('0x19')](_0x2c1957);return _0x316d8c[_0x2d02('0x1e')](_0x2d02('0x1f'),_0x43cd08+'-'+_0x14eca9+'/'+_0x26bb5b)[_0x2d02('0x1b')](_0x349d7f);}return null;};}function patchUpdates(_0x318205){return function(_0x4077d1){try{jsonpatch['apply'](_0x4077d1,_0x318205,!![]);}catch(_0x32ae9c){return BPromise['reject'](_0x32ae9c);}return _0x4077d1[_0x2d02('0x20')]();};}function saveUpdates(_0x1126f6,_0x5bc1c0){return function(_0x1bf00c){if(_0x1bf00c){return _0x1bf00c[_0x2d02('0x21')](_0x1126f6)[_0x2d02('0x22')](function(_0x1b3a3f){return _0x1b3a3f;});}return null;};}function removeEntity(_0xfd0357,_0xc145dc){return function(_0x1ed0ac){if(_0x1ed0ac){return _0x1ed0ac['destroy']()[_0x2d02('0x22')](function(){_0xfd0357['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x488b5a,_0x4c2a27){return function(_0x2f8472){if(!_0x2f8472){_0x488b5a[_0x2d02('0x18')](0x194);}return _0x2f8472;};}function handleError(_0x2b5910,_0x4cab2a){_0x4cab2a=_0x4cab2a||0x1f4;return function(_0x6757bc){logger[_0x2d02('0x23')](_0x6757bc[_0x2d02('0x24')]);if(_0x6757bc[_0x2d02('0x25')]){delete _0x6757bc['name'];}_0x2b5910[_0x2d02('0x19')](_0x4cab2a)['send'](_0x6757bc);};}exports[_0x2d02('0x26')]=function(_0x2bd109,_0x3f45d3){var _0x3822d2={},_0x556d6f={},_0x45e0d6={'count':0x0,'rows':[]};var _0x111406=_['map'](db[_0x2d02('0x27')][_0x2d02('0x28')],function(_0x1b3c37){return{'name':_0x1b3c37[_0x2d02('0x29')],'type':_0x1b3c37[_0x2d02('0x2a')][_0x2d02('0x2b')]};});_0x556d6f[_0x2d02('0x2c')]=_[_0x2d02('0x2d')](_0x111406,_0x2d02('0x25'));_0x556d6f[_0x2d02('0x2e')]=_[_0x2d02('0x2f')](_0x2bd109[_0x2d02('0x2e')]);_0x556d6f[_0x2d02('0x30')]=_['intersection'](_0x556d6f['model'],_0x556d6f[_0x2d02('0x2e')]);_0x3822d2['attributes']=_[_0x2d02('0x31')](_0x556d6f[_0x2d02('0x2c')],qs[_0x2d02('0x32')](_0x2bd109[_0x2d02('0x2e')]['fields']));_0x3822d2['attributes']=_0x3822d2['attributes'][_0x2d02('0x33')]?_0x3822d2[_0x2d02('0x34')]:_0x556d6f[_0x2d02('0x2c')];if(!_0x2bd109[_0x2d02('0x2e')][_0x2d02('0x35')](_0x2d02('0x36'))){_0x3822d2[_0x2d02('0x37')]=qs[_0x2d02('0x37')](_0x2bd109['query'][_0x2d02('0x37')]);_0x3822d2[_0x2d02('0x1d')]=qs[_0x2d02('0x1d')](_0x2bd109['query'][_0x2d02('0x1d')]);}_0x3822d2[_0x2d02('0x38')]=qs['sort'](_0x2bd109[_0x2d02('0x2e')]['sort']);_0x3822d2['where']=qs['filters'](_[_0x2d02('0x39')](_0x2bd109['query'],_0x556d6f[_0x2d02('0x30')]),_0x111406);if(_0x2bd109[_0x2d02('0x2e')]['filter']){_0x3822d2[_0x2d02('0x3a')]=_['merge'](_0x3822d2[_0x2d02('0x3a')],{'$or':_[_0x2d02('0x2d')](_0x111406,function(_0x622d18){if(_0x622d18['type']!=='VIRTUAL'){var _0x5680ed={};_0x5680ed[_0x622d18[_0x2d02('0x25')]]={'$like':'%'+_0x2bd109[_0x2d02('0x2e')][_0x2d02('0x3b')]+'%'};return _0x5680ed;}})});}_0x3822d2=_[_0x2d02('0x3c')]({},_0x3822d2,_0x2bd109['options']);var _0x34e9f3={'where':_0x3822d2[_0x2d02('0x3a')]};return db[_0x2d02('0x27')]['count'](_0x34e9f3)[_0x2d02('0x22')](function(_0x475b35){_0x45e0d6[_0x2d02('0x1c')]=_0x475b35;if(_0x2bd109[_0x2d02('0x2e')][_0x2d02('0x3d')]){_0x3822d2['include']=[{'all':!![]}];}return db['FaxApplication'][_0x2d02('0x3e')](_0x3822d2);})[_0x2d02('0x22')](function(_0x240cc9){_0x45e0d6[_0x2d02('0x3f')]=_0x240cc9;return _0x45e0d6;})['then'](respondWithFilteredResult(_0x3f45d3,_0x3822d2))[_0x2d02('0x40')](handleError(_0x3f45d3,null));};exports['show']=function(_0x30a3b5,_0x5adec9){var _0x21aa40={'raw':!![],'where':{'id':_0x30a3b5[_0x2d02('0x41')]['id']}},_0x1f2f79={};_0x1f2f79[_0x2d02('0x2c')]=_[_0x2d02('0x2f')](db[_0x2d02('0x27')][_0x2d02('0x28')]);_0x1f2f79[_0x2d02('0x2e')]=_[_0x2d02('0x2f')](_0x30a3b5['query']);_0x1f2f79[_0x2d02('0x30')]=_[_0x2d02('0x31')](_0x1f2f79[_0x2d02('0x2c')],_0x1f2f79[_0x2d02('0x2e')]);_0x21aa40[_0x2d02('0x34')]=_[_0x2d02('0x31')](_0x1f2f79[_0x2d02('0x2c')],qs[_0x2d02('0x32')](_0x30a3b5['query'][_0x2d02('0x32')]));_0x21aa40['attributes']=_0x21aa40[_0x2d02('0x34')][_0x2d02('0x33')]?_0x21aa40[_0x2d02('0x34')]:_0x1f2f79[_0x2d02('0x2c')];if(_0x30a3b5[_0x2d02('0x2e')][_0x2d02('0x3d')]){_0x21aa40[_0x2d02('0x42')]=[{'all':!![]}];}_0x21aa40=_[_0x2d02('0x3c')]({},_0x21aa40,_0x30a3b5['options']);return db['FaxApplication']['find'](_0x21aa40)[_0x2d02('0x22')](handleEntityNotFound(_0x5adec9,null))['then'](respondWithResult(_0x5adec9,null))['catch'](handleError(_0x5adec9,null));};exports[_0x2d02('0x43')]=function(_0x455c5f,_0xe14fe1){return db[_0x2d02('0x27')][_0x2d02('0x43')](_0x455c5f[_0x2d02('0x44')],{})[_0x2d02('0x22')](respondWithResult(_0xe14fe1,0xc9))[_0x2d02('0x40')](handleError(_0xe14fe1,null));};exports[_0x2d02('0x21')]=function(_0x3a7b19,_0x27f7cc){if(_0x3a7b19[_0x2d02('0x44')]['id']){delete _0x3a7b19[_0x2d02('0x44')]['id'];}return db[_0x2d02('0x27')][_0x2d02('0x45')]({'where':{'id':_0x3a7b19[_0x2d02('0x41')]['id']}})['then'](handleEntityNotFound(_0x27f7cc,null))[_0x2d02('0x22')](saveUpdates(_0x3a7b19['body'],null))[_0x2d02('0x22')](respondWithResult(_0x27f7cc,null))['catch'](handleError(_0x27f7cc,null));};exports['destroy']=function(_0x3e7b48,_0x28be70){return db[_0x2d02('0x27')][_0x2d02('0x45')]({'where':{'id':_0x3e7b48[_0x2d02('0x41')]['id']}})[_0x2d02('0x22')](handleEntityNotFound(_0x28be70,null))[_0x2d02('0x22')](removeEntity(_0x28be70,null))[_0x2d02('0x40')](handleError(_0x28be70,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index e0fdc7b..0288cec 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 _0x570e=['FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./faxApplication.attributes','define'];(function(_0x5af9b6,_0x230bbd){var _0x2599b8=function(_0x2137b5){while(--_0x2137b5){_0x5af9b6['push'](_0x5af9b6['shift']());}};_0x2599b8(++_0x230bbd);}(_0x570e,0x149));var _0xe570=function(_0x10ec04,_0x45ca9d){_0x10ec04=_0x10ec04-0x0;var _0x46eca4=_0x570e[_0x10ec04];return _0x46eca4;};'use strict';var _=require('lodash');var util=require(_0xe570('0x0'));var logger=require(_0xe570('0x1'))(_0xe570('0x2'));var moment=require(_0xe570('0x3'));var BPromise=require('bluebird');var rp=require(_0xe570('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe570('0x5'));var config=require(_0xe570('0x6'));var attributes=require(_0xe570('0x7'));module['exports']=function(_0x2aca6d,_0x2c63e5){return _0x2aca6d[_0xe570('0x8')](_0xe570('0x9'),attributes,{'tableName':_0xe570('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe570('0xb'),'collate':_0xe570('0xc')});}; \ No newline at end of file +var _0x51a8=['api','moment','bluebird','path','rimraf','FaxApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x384f2d,_0x57b235){var _0x25e86f=function(_0x56e2c7){while(--_0x56e2c7){_0x384f2d['push'](_0x384f2d['shift']());}};_0x25e86f(++_0x57b235);}(_0x51a8,0x1b8));var _0x851a=function(_0x391635,_0x11fd25){_0x391635=_0x391635-0x0;var _0x205959=_0x51a8[_0x391635];return _0x205959;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x851a('0x0'));var moment=require(_0x851a('0x1'));var BPromise=require(_0x851a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x851a('0x3'));var rimraf=require(_0x851a('0x4'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module['exports']=function(_0x5b12ad,_0x248af8){return _0x5b12ad['define'](_0x851a('0x5'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x851a('0x6'),'collate':_0x851a('0x7')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index d78d3fb..dc1fb90 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 _0x1ed1=['options','raw','where','attributes','limit','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateFaxApplication','FaxApplication','body'];(function(_0x23e6a0,_0x498803){var _0x433cd8=function(_0x7738fa){while(--_0x7738fa){_0x23e6a0['push'](_0x23e6a0['shift']());}};_0x433cd8(++_0x498803);}(_0x1ed1,0x1d6));var _0x11ed=function(_0x4b9d7d,_0x2ad527){_0x4b9d7d=_0x4b9d7d-0x0;var _0x31fbf4=_0x1ed1[_0x4b9d7d];return _0x31fbf4;};'use strict';var _=require('lodash');var util=require(_0x11ed('0x0'));var moment=require(_0x11ed('0x1'));var BPromise=require(_0x11ed('0x2'));var rs=require(_0x11ed('0x3'));var fs=require('fs');var Redis=require(_0x11ed('0x4'));var db=require(_0x11ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x11ed('0x6'))('rpc');var config=require(_0x11ed('0x7'));var jayson=require(_0x11ed('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x430df3,_0x579ab0,_0x580b3e){return new BPromise(function(_0x4a391d,_0x1f4f64){return client[_0x11ed('0x9')](_0x430df3,_0x580b3e)[_0x11ed('0xa')](function(_0x33356d){logger[_0x11ed('0xb')](_0x11ed('0xc'),_0x579ab0,_0x11ed('0xd'));logger[_0x11ed('0xe')](_0x11ed('0xf'),_0x579ab0,_0x11ed('0xd'),JSON[_0x11ed('0x10')](_0x33356d));if(_0x33356d[_0x11ed('0x11')]){if(_0x33356d[_0x11ed('0x11')]['code']===0x1f4){logger[_0x11ed('0x11')](_0x11ed('0xc'),_0x579ab0,_0x33356d[_0x11ed('0x11')][_0x11ed('0x12')]);return _0x1f4f64(_0x33356d[_0x11ed('0x11')][_0x11ed('0x12')]);}logger[_0x11ed('0x11')](_0x11ed('0xc'),_0x579ab0,_0x33356d[_0x11ed('0x11')][_0x11ed('0x12')]);return _0x4a391d(_0x33356d[_0x11ed('0x11')][_0x11ed('0x12')]);}else{logger[_0x11ed('0xb')]('FaxApplication,\x20%s,\x20%s',_0x579ab0,_0x11ed('0xd'));_0x4a391d(_0x33356d[_0x11ed('0x13')][_0x11ed('0x12')]);}})['catch'](function(_0x400914){logger['error'](_0x11ed('0xc'),_0x579ab0,_0x400914);_0x1f4f64(_0x400914);});});}exports[_0x11ed('0x14')]=function(_0x2d1b17){var _0xd8230c=this;return new Promise(function(_0x10f67f,_0x2b019f){return db[_0x11ed('0x15')]['update'](_0x2d1b17[_0x11ed('0x16')],{'raw':_0x2d1b17[_0x11ed('0x17')]?_0x2d1b17[_0x11ed('0x17')][_0x11ed('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d1b17[_0x11ed('0x17')]?_0x2d1b17[_0x11ed('0x17')][_0x11ed('0x19')]||null:null,'attributes':_0x2d1b17[_0x11ed('0x17')]?_0x2d1b17[_0x11ed('0x17')][_0x11ed('0x1a')]||null:null,'limit':_0x2d1b17[_0x11ed('0x17')]?_0x2d1b17[_0x11ed('0x17')][_0x11ed('0x1b')]||null:null})[_0x11ed('0xa')](function(_0x370b40){logger[_0x11ed('0xb')](_0x11ed('0x14'),_0x2d1b17);logger['debug'](_0x11ed('0x14'),_0x2d1b17,JSON[_0x11ed('0x10')](_0x370b40));_0x10f67f(_0x370b40);})[_0x11ed('0x1c')](function(_0x32168e){logger[_0x11ed('0x11')](_0x11ed('0x14'),_0x32168e[_0x11ed('0x12')],_0x2d1b17);_0x2b019f(_0xd8230c[_0x11ed('0x11')](0x1f4,_0x32168e[_0x11ed('0x12')]));});});}; \ No newline at end of file +var _0x30ed=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','update','options','raw','attributes','limit','lodash','util','moment','bluebird','randomstring'];(function(_0x4d992e,_0x1df863){var _0x53a8e3=function(_0x58c101){while(--_0x58c101){_0x4d992e['push'](_0x4d992e['shift']());}};_0x53a8e3(++_0x1df863);}(_0x30ed,0x7b));var _0xd30e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x30ed[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd30e('0x0'));var util=require(_0xd30e('0x1'));var moment=require(_0xd30e('0x2'));var BPromise=require(_0xd30e('0x3'));var rs=require(_0xd30e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd30e('0x5'))['db'];var utils=require(_0xd30e('0x6'));var logger=require(_0xd30e('0x7'))(_0xd30e('0x8'));var config=require(_0xd30e('0x9'));var jayson=require(_0xd30e('0xa'));var client=jayson[_0xd30e('0xb')][_0xd30e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xaedf5,_0x408b01,_0x1f3a15){return new BPromise(function(_0x52887c,_0x5754a8){return client[_0xd30e('0xd')](_0xaedf5,_0x1f3a15)[_0xd30e('0xe')](function(_0x291c3d){logger[_0xd30e('0xf')]('FaxApplication,\x20%s,\x20%s',_0x408b01,'request\x20sent');logger['debug'](_0xd30e('0x10'),_0x408b01,_0xd30e('0x11'),JSON[_0xd30e('0x12')](_0x291c3d));if(_0x291c3d['error']){if(_0x291c3d[_0xd30e('0x13')][_0xd30e('0x14')]===0x1f4){logger[_0xd30e('0x13')](_0xd30e('0x15'),_0x408b01,_0x291c3d[_0xd30e('0x13')][_0xd30e('0x16')]);return _0x5754a8(_0x291c3d[_0xd30e('0x13')][_0xd30e('0x16')]);}logger['error'](_0xd30e('0x15'),_0x408b01,_0x291c3d['error'][_0xd30e('0x16')]);return _0x52887c(_0x291c3d[_0xd30e('0x13')][_0xd30e('0x16')]);}else{logger[_0xd30e('0xf')](_0xd30e('0x15'),_0x408b01,_0xd30e('0x11'));_0x52887c(_0x291c3d[_0xd30e('0x17')]['message']);}})[_0xd30e('0x18')](function(_0x58b0c0){logger['error'](_0xd30e('0x15'),_0x408b01,_0x58b0c0);_0x5754a8(_0x58b0c0);});});}exports[_0xd30e('0x19')]=function(_0x6e36b8){var _0x40b5a1=this;return new Promise(function(_0x1d51d2,_0x4988ee){return db[_0xd30e('0x1a')][_0xd30e('0x1b')](_0x6e36b8['body'],{'raw':_0x6e36b8[_0xd30e('0x1c')]?_0x6e36b8[_0xd30e('0x1c')][_0xd30e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6e36b8['options']?_0x6e36b8['options']['where']||null:null,'attributes':_0x6e36b8['options']?_0x6e36b8['options'][_0xd30e('0x1e')]||null:null,'limit':_0x6e36b8[_0xd30e('0x1c')]?_0x6e36b8[_0xd30e('0x1c')][_0xd30e('0x1f')]||null:null})['then'](function(_0x3116d9){logger[_0xd30e('0xf')](_0xd30e('0x19'),_0x6e36b8);logger['debug']('UpdateFaxApplication',_0x6e36b8,JSON[_0xd30e('0x12')](_0x3116d9));_0x1d51d2(_0x3116d9);})[_0xd30e('0x18')](function(_0x242587){logger['error'](_0xd30e('0x19'),_0x242587[_0xd30e('0x16')],_0x6e36b8);_0x4988ee(_0x40b5a1[_0xd30e('0x13')](0x1f4,_0x242587['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 24f58d0..fadd7b1 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 _0xbd51=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','get','isAuthenticated','index','/:id','show','post'];(function(_0x4567d5,_0x4f0948){var _0x317ad6=function(_0x162937){while(--_0x162937){_0x4567d5['push'](_0x4567d5['shift']());}};_0x317ad6(++_0x4f0948);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x3357e5,_0x3110f1){_0x3357e5=_0x3357e5-0x0;var _0xb007a0=_0xbd51[_0x3357e5];return _0xb007a0;};'use strict';var multer=require(_0x1bd5('0x0'));var util=require('util');var path=require(_0x1bd5('0x1'));var timeout=require(_0x1bd5('0x2'));var express=require(_0x1bd5('0x3'));var router=express[_0x1bd5('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxApplication.controller');router[_0x1bd5('0x5')]('/',auth[_0x1bd5('0x6')](),controller[_0x1bd5('0x7')]);router['get'](_0x1bd5('0x8'),auth[_0x1bd5('0x6')](),controller[_0x1bd5('0x9')]);router[_0x1bd5('0xa')]('/',auth[_0x1bd5('0x6')](),controller['create']);router[_0x1bd5('0xb')]('/:id',auth[_0x1bd5('0x6')](),controller[_0x1bd5('0xc')]);router[_0x1bd5('0xd')](_0x1bd5('0x8'),auth[_0x1bd5('0x6')](),controller[_0x1bd5('0xe')]);module['exports']=router; \ No newline at end of file +var _0x6aa7=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxApplication.controller','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','path'];(function(_0x2e21e5,_0x49f0f7){var _0x16435a=function(_0x2d3880){while(--_0x2d3880){_0x2e21e5['push'](_0x2e21e5['shift']());}};_0x16435a(++_0x49f0f7);}(_0x6aa7,0x178));var _0x76aa=function(_0xb08ff2,_0x3d399a){_0xb08ff2=_0xb08ff2-0x0;var _0x135a9d=_0x6aa7[_0xb08ff2];return _0x135a9d;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x76aa('0x5'));var config=require(_0x76aa('0x6'));var controller=require(_0x76aa('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x76aa('0x8')]);router['get'](_0x76aa('0x9'),auth[_0x76aa('0xa')](),controller[_0x76aa('0xb')]);router['post']('/',auth[_0x76aa('0xa')](),controller[_0x76aa('0xc')]);router[_0x76aa('0xd')]('/:id',auth[_0x76aa('0xa')](),controller[_0x76aa('0xe')]);router[_0x76aa('0xf')](_0x76aa('0x9'),auth[_0x76aa('0xa')](),controller[_0x76aa('0x10')]);module[_0x76aa('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index db6a2ba..6108459 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 _0x4b47=['DATE','STRING','ENUM','out','sequelize','BOOLEAN'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x4b47,0x1b4));var _0x74b4=function(_0xe23a35,_0x330d9c){_0xe23a35=_0xe23a35-0x0;var _0x263648=_0x4b47[_0xe23a35];return _0x263648;};'use strict';var Sequelize=require(_0x74b4('0x0'));module['exports']={'closed':{'type':Sequelize[_0x74b4('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x74b4('0x2')]},'disposition':{'type':Sequelize[_0x74b4('0x3')]},'secondDisposition':{'type':Sequelize[_0x74b4('0x3')]},'thirdDisposition':{'type':Sequelize[_0x74b4('0x3')]},'note':{'type':Sequelize[_0x74b4('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x74b4('0x4')]('in',_0x74b4('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x6075=['BOOLEAN','DATE','STRING','out','ENUM','exports'];(function(_0x6db560,_0x430dc4){var _0x52b13d=function(_0x42dd72){while(--_0x42dd72){_0x6db560['push'](_0x6db560['shift']());}};_0x52b13d(++_0x430dc4);}(_0x6075,0x191));var _0x5607=function(_0x29a020,_0x388eb9){_0x29a020=_0x29a020-0x0;var _0x3ee40b=_0x6075[_0x29a020];return _0x3ee40b;};'use strict';var Sequelize=require('sequelize');module[_0x5607('0x0')]={'closed':{'type':Sequelize[_0x5607('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5607('0x2')]},'disposition':{'type':Sequelize[_0x5607('0x3')]},'secondDisposition':{'type':Sequelize[_0x5607('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5607('0x3')]},'note':{'type':Sequelize[_0x5607('0x3')]},'read1stAt':{'type':Sequelize[_0x5607('0x2')]},'fax':{'type':Sequelize[_0x5607('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x5607('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5607('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x5607('0x5')]('in','out'),'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 433da3f..2f1251e 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 _0x78d7=['agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','c.mobile','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','push','all','rows','show','params','includeAll','options','create','body','describe','addMessage','FaxMessage','ids','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','omit','spread','Tag','faxInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','existsSync','pipe','createWriteStream','basename','log','err','sendStatus','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','status','offset','limit','Content-Range','json','reject','update','then','destroy','end','error','stack','name','map','TagIds','Tags','split','forEach','catch','index','FaxInteraction','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','left_join','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','compact','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role'];(function(_0x49d6e4,_0x1af05e){var _0x3a142f=function(_0xe69ceb){while(--_0xe69ceb){_0x49d6e4['push'](_0x49d6e4['shift']());}};_0x3a142f(++_0x1af05e);}(_0x78d7,0x1e7));var _0x778d=function(_0xefa4cc,_0x7305ad){_0xefa4cc=_0xefa4cc-0x0;var _0x365575=_0x78d7[_0xefa4cc];return _0x365575;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x778d('0x0'));var rimraf=require(_0x778d('0x1'));var zipdir=require(_0x778d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x778d('0x3'));var moment=require(_0x778d('0x4'));var BPromise=require(_0x778d('0x5'));var Mustache=require('mustache');var util=require(_0x778d('0x6'));var path=require(_0x778d('0x7'));var sox=require('sox');var csv=require(_0x778d('0x8'));var ejs=require(_0x778d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x778d('0xa'));var crypto=require(_0x778d('0xb'));var jsforce=require(_0x778d('0xc'));var deskjs=require(_0x778d('0xd'));var toCsv=require(_0x778d('0x8'));var querystring=require(_0x778d('0xe'));var Papa=require(_0x778d('0xf'));var Redis=require('ioredis');var authService=require(_0x778d('0x10'));var qs=require(_0x778d('0x11'));var as=require(_0x778d('0x12'));var hardwareService=require(_0x778d('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x778d('0x14'));var licenseUtil=require(_0x778d('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x778d('0x16')](config[_0x778d('0x17')],{'host':_0x778d('0x18'),'port':0x18eb});var socket=require(_0x778d('0x19'))(new Redis(config[_0x778d('0x17')]));require(_0x778d('0x1a'))[_0x778d('0x1b')](socket);function respondWithStatusCode(_0x9c509c,_0x4a1b12){_0x4a1b12=_0x4a1b12||0xcc;return function(_0x56bf28){if(_0x56bf28){return _0x9c509c['sendStatus'](_0x4a1b12);}return _0x9c509c[_0x778d('0x1c')](_0x4a1b12)['end']();};}function respondWithResult(_0xb1d401,_0x3cd8b2){_0x3cd8b2=_0x3cd8b2||0xc8;return function(_0x37deb6){if(_0x37deb6){return _0xb1d401['status'](_0x3cd8b2)['json'](_0x37deb6);}};}function respondWithFilteredResult(_0x3964b4,_0x5815b5){return function(_0x3c4a2f){if(_0x3c4a2f){var _0xb0fc9d=_0x3c4a2f['count'],_0x2f81f3=_0x5815b5['offset'],_0x34a9ec=_0x5815b5[_0x778d('0x1d')]+_0x5815b5[_0x778d('0x1e')],_0x12999b;if(_0x34a9ec>=_0xb0fc9d){_0x34a9ec=_0xb0fc9d;_0x12999b=0xc8;}else{_0x12999b=0xce;}_0x3964b4[_0x778d('0x1c')](_0x12999b);return _0x3964b4['set'](_0x778d('0x1f'),_0x2f81f3+'-'+_0x34a9ec+'/'+_0xb0fc9d)[_0x778d('0x20')](_0x3c4a2f);}return null;};}function patchUpdates(_0x3bfcb2){return function(_0x3dbb8a){try{jsonpatch['apply'](_0x3dbb8a,_0x3bfcb2,!![]);}catch(_0x8229ac){return BPromise[_0x778d('0x21')](_0x8229ac);}return _0x3dbb8a['save']();};}function saveUpdates(_0x194123,_0x4fe3de){return function(_0x3340dd){if(_0x3340dd){return _0x3340dd[_0x778d('0x22')](_0x194123)[_0x778d('0x23')](function(_0x10ac21){return _0x10ac21;});}return null;};}function removeEntity(_0x2d052f,_0x298c63){return function(_0x26a3cd){if(_0x26a3cd){return _0x26a3cd[_0x778d('0x24')]()[_0x778d('0x23')](function(){_0x2d052f['status'](0xcc)[_0x778d('0x25')]();});}};}function handleEntityNotFound(_0xc675e3,_0x3264c4){return function(_0x3ebcc5){if(!_0x3ebcc5){_0xc675e3['sendStatus'](0x194);}return _0x3ebcc5;};}function handleError(_0x40675d,_0x31b390){_0x31b390=_0x31b390||0x1f4;return function(_0x4c36db){logger[_0x778d('0x26')](_0x4c36db[_0x778d('0x27')]);if(_0x4c36db[_0x778d('0x28')]){delete _0x4c36db[_0x778d('0x28')];}_0x40675d[_0x778d('0x1c')](_0x31b390)['send'](_0x4c36db);};}function getInteractionUsers(_0x1a7a82,_0x2a7737){return new BPromise(function(_0x45e775,_0xf3a32c){try{if(_0x2a7737[_0x1a7a82['id']]){_0x1a7a82['Users']=_[_0x778d('0x29')](_0x2a7737[_0x1a7a82['id']],function(_0x411f5f){return{'id':_0x411f5f['id'],'fullname':_0x411f5f['fullname']};});}}catch(_0x58fb0b){_0xf3a32c(_0x58fb0b);}_0x45e775(_0x1a7a82);});}function getInteractionTags(_0x491309,_0x5d15e2){return new BPromise(function(_0x35fab6,_0xf3ceb1){try{if(_0x491309[_0x778d('0x2a')]){_0x491309[_0x778d('0x2b')]=[];_0x491309[_0x778d('0x2a')][_0x778d('0x2c')](',')[_0x778d('0x2d')](function(_0xd2e6a0){_0x491309[_0x778d('0x2b')]['push'](_0x5d15e2[_0xd2e6a0]);});}delete _0x491309[_0x778d('0x2a')];}catch(_0x762a24){_0xf3ceb1(_0x762a24);}_0x35fab6(_0x491309);});}function updateFaxInteraction(_0x1d8911,_0x4fcafd,_0x4df448){return new BPromise(function(_0x4e6ea9,_0x19803e){return getInteractionUsers(_0x1d8911,_0x4df448)[_0x778d('0x23')](function(_0x5236d8){return getInteractionTags(_0x5236d8,_0x4fcafd);})['then'](function(_0x453106){_0x4e6ea9(_0x453106);})[_0x778d('0x2e')](function(_0x384758){_0x19803e(_0x384758);});});}exports[_0x778d('0x2f')]=function(_0x306a38,_0x4b1c94){var _0x5906d2={},_0x32e46e={},_0x321425={'count':0x0,'rows':[]};var _0x519744=_[_0x778d('0x29')](db[_0x778d('0x30')][_0x778d('0x31')],function(_0x6c86f2){return{'name':_0x6c86f2[_0x778d('0x32')],'type':_0x6c86f2['type']['key']};});_0x32e46e['model']=_[_0x778d('0x29')](_0x519744,_0x778d('0x28'));_0x32e46e[_0x778d('0x33')]=_[_0x778d('0x34')](_0x306a38[_0x778d('0x33')]);_0x32e46e[_0x778d('0x35')]=_[_0x778d('0x36')](_0x32e46e[_0x778d('0x37')],_0x32e46e[_0x778d('0x33')]);_0x5906d2[_0x778d('0x38')]=_[_0x778d('0x36')](_0x32e46e[_0x778d('0x37')],qs['fields'](_0x306a38[_0x778d('0x33')][_0x778d('0x39')]));_0x5906d2[_0x778d('0x38')]=_0x5906d2[_0x778d('0x38')]['length']?_0x5906d2[_0x778d('0x38')]:_0x32e46e[_0x778d('0x37')];if(!_0x306a38[_0x778d('0x33')][_0x778d('0x3a')](_0x778d('0x3b'))){_0x5906d2[_0x778d('0x1e')]=qs[_0x778d('0x1e')](_0x306a38[_0x778d('0x33')][_0x778d('0x1e')]);_0x5906d2[_0x778d('0x1d')]=qs[_0x778d('0x1d')](_0x306a38[_0x778d('0x33')][_0x778d('0x1d')]);}_0x5906d2[_0x778d('0x3c')]=qs['sort'](_0x306a38[_0x778d('0x33')][_0x778d('0x3d')]);_0x5906d2[_0x778d('0x3e')]=qs[_0x778d('0x35')](_[_0x778d('0x3f')](_0x306a38[_0x778d('0x33')],_0x32e46e[_0x778d('0x35')]),_0x519744);var _0x25c1fb=[];var _0x57a684=squel['select']()[_0x778d('0x40')]('id')[_0x778d('0x40')]('name')[_0x778d('0x40')](_0x778d('0x41'))[_0x778d('0x42')](_0x778d('0x43'));var _0x5d96cb=squel[_0x778d('0x44')]()[_0x778d('0x40')](_0x778d('0x45'))['field'](_0x778d('0x46'))[_0x778d('0x40')]('ui.FaxInteractionId')[_0x778d('0x42')](_0x778d('0x47'),'ui')['left_join'](_0x778d('0x48'),'u',_0x778d('0x49'));var _0x4af5ca=squel[_0x778d('0x44')]()[_0x778d('0x42')](_0x778d('0x4a'),'i')['left_join'](_0x778d('0x4b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x778d('0x4c')](_0x778d('0x48'),'o','o.id\x20=\x20i.UserId')[_0x778d('0x4c')](_0x778d('0x4d'),'a','a.id\x20=\x20i.FaxAccountId')[_0x778d('0x4c')](_0x778d('0x4e'),'me',_0x778d('0x4f'))['left_join'](_0x778d('0x50'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x778d('0x4c')](_0x778d('0x43'),'t',_0x778d('0x51'));var _0x4fe171=squel[_0x778d('0x52')]();var _0x185388=[];var _0x5303f2=squel[_0x778d('0x52')]();var _0x33a5d3;if(_0x306a38['query'][_0x778d('0x53')]){_0x33a5d3=as['parseSearch'](_0x306a38[_0x778d('0x33')]['search']);var _0x4fd2e3=_0x33a5d3[_0x778d('0x54')];for(var _0x2d263c=0x0;_0x2d263c<_0x33a5d3[_0x778d('0x55')][_0x778d('0x56')];_0x2d263c++){var _0x553137=_0x33a5d3['conditions'][_0x2d263c];var _0x134f68='i';var _0x18d0e9=_[_0x778d('0x57')](_0x519744,[_0x778d('0x28'),_0x553137[_0x778d('0x40')]]);if(!_0x18d0e9){switch(_0x553137[_0x778d('0x40')]){case _0x778d('0x58'):if(_0x553137[_0x778d('0x59')]==0x1){_0x4af5ca['having']('`'+_0x553137[_0x778d('0x40')]+'`\x20=\x200');}else{_0x4af5ca[_0x778d('0x5a')]('`'+_0x553137[_0x778d('0x40')]+_0x778d('0x5b'));}break;case _0x778d('0x5c'):if(_0x553137[_0x778d('0x5d')]===_0x778d('0x5e')){if(_0x553137['value']['split']('\x20')['length']>0x1){_0x4fe171[_0x4fd2e3](_0x778d('0x5f'),qs[_0x778d('0x60')](_0x553137[_0x778d('0x59')]),null);}else{var _0x2f287d='%'+_0x553137[_0x778d('0x59')]+'%';_0x4fe171[_0x4fd2e3]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2f287d,_0x2f287d,_0x2f287d);}}else{_0x18d0e9=_[_0x778d('0x57')](_0x519744,[_0x778d('0x28'),_0x778d('0x61')]);_0x553137[_0x778d('0x40')]=_0x778d('0x61');_0x32410e=as[_0x778d('0x62')](_0x134f68,_0x18d0e9[_0x778d('0x63')],_0x553137);_0x4fe171[_0x4fd2e3](_0x32410e[_0x778d('0x64')],_0x32410e[_0x778d('0x59')][_0x778d('0x65')],_0x32410e[_0x778d('0x59')][_0x778d('0x25')]);}break;case'Tag':var _0xd44978=_0x553137[_0x778d('0x59')][_0x778d('0x2c')](',')[_0x778d('0x29')](function(_0x3a73e2){return Number(_0x3a73e2);});_0xd44978[_0x778d('0x2d')](function(_0x48cf06){_0x5303f2['or'](_0x778d('0x66'),'%,'+_0x48cf06+',%');});_0x185388=_[_0x778d('0x67')](_0x185388,_0xd44978);break;case _0x778d('0x68'):if(_0x553137[_0x778d('0x5d')]===_0x778d('0x5e')){_0x4fe171[_0x4fd2e3](_0x778d('0x69'),'%'+_0x553137['value']+'%',null);}else{_0x18d0e9=_[_0x778d('0x57')](_0x519744,[_0x778d('0x28'),_0x778d('0x6a')]);_0x553137[_0x778d('0x40')]='UserId';_0x32410e=as['buildExpression'](_0x134f68,_0x18d0e9[_0x778d('0x63')],_0x553137);_0x4fe171[_0x4fd2e3](_0x32410e[_0x778d('0x64')],_0x32410e[_0x778d('0x59')][_0x778d('0x65')],_0x32410e[_0x778d('0x59')][_0x778d('0x25')]);}break;case'body':_0x32410e=as[_0x778d('0x62')]('me',null,_0x553137);_0x4fe171[_0x4fd2e3](_0x32410e[_0x778d('0x64')],_0x32410e[_0x778d('0x59')][_0x778d('0x65')],_0x32410e[_0x778d('0x59')][_0x778d('0x25')]);break;}}else{var _0x32410e=as['buildExpression'](_0x134f68,_0x18d0e9['type'],_0x553137);_0x4fe171[_0x4fd2e3](_0x32410e['text'],_0x32410e[_0x778d('0x59')][_0x778d('0x65')],_0x32410e[_0x778d('0x59')][_0x778d('0x25')]);}}}else{var _0x1d702a=_(_0x306a38[_0x778d('0x33')])[_0x778d('0x34')]()[_0x778d('0x29')](function(_0x1a09bc){return _['some'](_0x519744,[_0x778d('0x28'),_0x1a09bc])?_0x1a09bc:undefined;})[_0x778d('0x6b')]()[_0x778d('0x59')]();if(!_['isEmpty'](_0x1d702a)){_0x1d702a[_0x778d('0x2d')](function(_0x51ed08){if(_0x51ed08==='FaxAccountId'){_0x4af5ca[_0x778d('0x3e')](_0x778d('0x6c'),[][_0x778d('0x6d')](_0x306a38['query'][_0x51ed08]));}else if(_0x51ed08===_0x778d('0x6e')){var _0x54d0d4=JSON[_0x778d('0x6f')](_0x306a38[_0x778d('0x33')][_0x51ed08])[_0x778d('0x70')];var _0x5ead98=JSON[_0x778d('0x6f')](_0x306a38[_0x778d('0x33')][_0x51ed08])['$lte'];_0x4af5ca[_0x778d('0x3e')](_0x778d('0x71'),_0x54d0d4,_0x5ead98);}else{if(_0x306a38[_0x778d('0x33')][_0x51ed08]===_0x778d('0x72')){_0x4af5ca['where']('i.'+_0x51ed08+_0x778d('0x73'));}else{_0x4af5ca['where']('i.'+_0x51ed08+_0x778d('0x74'),_0x306a38[_0x778d('0x33')][_0x51ed08]);}}});}if(_0x306a38[_0x778d('0x33')]['read']){if(_0x306a38[_0x778d('0x33')][_0x778d('0x75')]==0x1){_0x4af5ca[_0x778d('0x5a')](_0x778d('0x76'));}else{_0x4af5ca[_0x778d('0x5a')](_0x778d('0x77'));}}if(_0x306a38[_0x778d('0x33')]['tag']){_0x185388=_['isArray'](_0x306a38[_0x778d('0x33')][_0x778d('0x78')])?_0x306a38[_0x778d('0x33')][_0x778d('0x78')]:new Array(_0x306a38[_0x778d('0x33')][_0x778d('0x78')]);_0x185388[_0x778d('0x2d')](function(_0x42684e){_0x5303f2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x42684e+',%');});}if(_0x306a38[_0x778d('0x33')][_0x778d('0x79')]){var _0x53ce69=_0x306a38[_0x778d('0x33')]['filter'][_0x778d('0x7a')]('\x5c','\x5c\x5c')[_0x778d('0x7a')](/'/g,'\x27\x27');if(qs[_0x778d('0x7b')](_0x53ce69)){_0x4fe171['or']('i.id\x20LIKE\x20?',_0x53ce69+'%')['or'](_0x778d('0x7c'),_0x53ce69+'%');}_0x4fe171['or'](_0x778d('0x7d'),_0x53ce69+'%');}}_0x4af5ca[_0x778d('0x3e')](_0x4fe171);_0x4af5ca[_0x778d('0x7e')](_0x778d('0x7f'));var _0x557db6={'type':db[_0x778d('0x80')][_0x778d('0x81')][_0x778d('0x82')],'raw':!![]};var _0xac1dff=_0x4af5ca[_0x778d('0x83')]();_0xac1dff['field'](_0x778d('0x7f'));_0xac1dff[_0x778d('0x40')](_0x778d('0x84'),_0x778d('0x58'));if(_0x5906d2[_0x778d('0x3c')]){_0x5906d2['order'][_0x778d('0x2d')](function(_0x30c29a){var _0x21c840=_0x30c29a[0x0]==='contactName'?_0x30c29a[0x0]:'i.'+_0x30c29a[0x0];_0x4af5ca[_0x778d('0x3c')](_0x21c840,_0x30c29a[0x1]===_0x778d('0x85')?![]:!![]);});}if(!_[_0x778d('0x86')](_0x185388)){_0x4af5ca[_0x778d('0x5a')](_0x5303f2);_0xac1dff['where']('t.id\x20IN\x20?',_0x185388);}BPromise[_0x778d('0x87')]()[_0x778d('0x23')](function(){if(!_0x33a5d3){if(_0x306a38[_0x778d('0x33')][_0x778d('0x88')])return;_0xac1dff[_0x778d('0x3e')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x4af5ca[_0x778d('0x3e')](_0x778d('0x89'));return;}if(_0x306a38[_0x778d('0x8a')][_0x778d('0x8b')]!==_0x778d('0x8c'))return;return _0x306a38[_0x778d('0x8a')][_0x778d('0x8d')]({'attributes':['id'],'raw':!![]})[_0x778d('0x23')](function(_0x13ceb8){if(_[_0x778d('0x86')](_0x13ceb8)){_0xac1dff['where'](_0x778d('0x8e'));_0x4af5ca[_0x778d('0x3e')]('i.FaxAccountId\x20IS\x20NULL');}else{_0xac1dff['where'](_0x778d('0x6c'),_[_0x778d('0x29')](_0x13ceb8,'id'));_0x4af5ca['where'](_0x778d('0x6c'),_[_0x778d('0x29')](_0x13ceb8,'id'));}});})[_0x778d('0x23')](function(){if(_0x306a38['user'][_0x778d('0x8b')]===_0x778d('0x8c')&&!_0x33a5d3&&!_0x306a38[_0x778d('0x33')]['FaxAccountId'])return[];return db[_0x778d('0x8f')][_0x778d('0x33')](_0xac1dff[_0x778d('0x90')](),_0x557db6);})[_0x778d('0x23')](function(_0x1d1270){_0x321425[_0x778d('0x91')]=_0x1d1270[_0x778d('0x56')];if(_0x321425[_0x778d('0x91')]===0x0)return[];return db[_0x778d('0x8f')][_0x778d('0x33')](_0x57a684[_0x778d('0x90')](),_0x557db6)[_0x778d('0x23')](function(_0x75ef70){_0x25c1fb=_[_0x778d('0x92')](_0x75ef70,'id');_0x557db6=_[_0x778d('0x93')](_0x557db6,{'model':db[_0x778d('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x306a38[_0x778d('0x33')][_0x778d('0x39')]){_0x5906d2[_0x778d('0x38')]['forEach'](function(_0x4103bc){_0x4af5ca['field']('i.'+_0x4103bc);});}else{_0x4af5ca[_0x778d('0x40')](_0x778d('0x84'),'unreadMessages');_0x4af5ca['field']('a.key',_0x778d('0x94'));_0x4af5ca[_0x778d('0x40')]('a.mandatoryDisposition',_0x778d('0x95'));_0x4af5ca[_0x778d('0x40')](_0x778d('0x96'),_0x778d('0x97'));_0x4af5ca[_0x778d('0x40')](_0x778d('0x98'));_0x4af5ca['field'](_0x778d('0x99'),_0x778d('0x9a'));_0x4af5ca[_0x778d('0x40')](_0x778d('0x9b'),_0x778d('0x9c'));_0x4af5ca[_0x778d('0x40')](_0x778d('0x9d'),'Contact.email');_0x4af5ca[_0x778d('0x40')](_0x778d('0x9e'),'Contact.phone');_0x4af5ca['field'](_0x778d('0x9f'),'Contact.mobile');_0x4af5ca['field']('c.fax',_0x778d('0xa0'));_0x4af5ca[_0x778d('0x40')]('o.fullname',_0x778d('0xa1'));_0x4af5ca[_0x778d('0x40')](_0x778d('0xa2'),'Owner.internal');_0x4af5ca[_0x778d('0x40')](_0x778d('0xa3'),_0x778d('0x2a'));}if(_0x5906d2[_0x778d('0x1e')])_0x4af5ca['limit'](_0x5906d2['limit']);if(_0x5906d2[_0x778d('0x1d')])_0x4af5ca['offset'](_0x5906d2['offset']);return db[_0x778d('0x8f')][_0x778d('0x33')](_0x4af5ca[_0x778d('0x90')](),_0x557db6);})[_0x778d('0x23')](function(_0x48b97c){_0x5d96cb[_0x778d('0x3e')](_0x778d('0xa4'),_['map'](_0x48b97c,'id'));return db[_0x778d('0x8f')][_0x778d('0x33')](_0x5d96cb[_0x778d('0x90')](),_0x557db6)[_0x778d('0x23')](function(_0x2259b3){var _0x21c369=_['groupBy'](_0x2259b3,_0x778d('0xa5'));var _0x3bec9a=[];_0x48b97c['forEach'](function(_0x4d1ffd){_0x3bec9a[_0x778d('0xa6')](updateFaxInteraction(_0x4d1ffd,_0x25c1fb,_0x21c369));});return BPromise[_0x778d('0xa7')](_0x3bec9a);});});})[_0x778d('0x23')](function(_0x386df8){_0x321425[_0x778d('0xa8')]=_0x386df8;return _0x321425;})[_0x778d('0x23')](respondWithFilteredResult(_0x4b1c94,_0x5906d2))[_0x778d('0x2e')](handleError(_0x4b1c94,null));};exports[_0x778d('0xa9')]=function(_0x42b8e3,_0x43f013){var _0x4147f6={'raw':![],'where':{'id':_0x42b8e3[_0x778d('0xaa')]['id']}},_0x3d8f81={};_0x3d8f81[_0x778d('0x37')]=_[_0x778d('0x34')](db[_0x778d('0x30')][_0x778d('0x31')]);_0x3d8f81[_0x778d('0x33')]=_[_0x778d('0x34')](_0x42b8e3[_0x778d('0x33')]);_0x3d8f81[_0x778d('0x35')]=_[_0x778d('0x36')](_0x3d8f81[_0x778d('0x37')],_0x3d8f81['query']);_0x4147f6[_0x778d('0x38')]=_['intersection'](_0x3d8f81[_0x778d('0x37')],qs[_0x778d('0x39')](_0x42b8e3[_0x778d('0x33')][_0x778d('0x39')]));_0x4147f6['attributes']=_0x4147f6[_0x778d('0x38')][_0x778d('0x56')]?_0x4147f6['attributes']:_0x3d8f81[_0x778d('0x37')];if(_0x42b8e3[_0x778d('0x33')][_0x778d('0xab')]){_0x4147f6['include']=[{'all':!![]}];}_0x4147f6=_[_0x778d('0x93')]({},_0x4147f6,_0x42b8e3[_0x778d('0xac')]);return db[_0x778d('0x30')][_0x778d('0x57')](_0x4147f6)[_0x778d('0x23')](handleEntityNotFound(_0x43f013,null))[_0x778d('0x23')](respondWithResult(_0x43f013,null))[_0x778d('0x2e')](handleError(_0x43f013,null));};exports[_0x778d('0xad')]=function(_0x8cfae,_0x25cda5){return db[_0x778d('0x30')]['create'](_0x8cfae[_0x778d('0xae')],{})['then'](respondWithResult(_0x25cda5,0xc9))[_0x778d('0x2e')](handleError(_0x25cda5,null));};exports[_0x778d('0x22')]=function(_0xdb4315,_0x38c859){if(_0xdb4315['body']['id']){delete _0xdb4315[_0x778d('0xae')]['id'];}return db[_0x778d('0x30')][_0x778d('0x57')]({'where':{'id':_0xdb4315[_0x778d('0xaa')]['id']}})['then'](handleEntityNotFound(_0x38c859,null))['then'](saveUpdates(_0xdb4315[_0x778d('0xae')],null))['then'](respondWithResult(_0x38c859,null))[_0x778d('0x2e')](handleError(_0x38c859,null));};exports[_0x778d('0x24')]=function(_0x2bf4c6,_0x2dc726){return db[_0x778d('0x30')]['find']({'where':{'id':_0x2bf4c6['params']['id']}})['then'](handleEntityNotFound(_0x2dc726,null))[_0x778d('0x23')](removeEntity(_0x2dc726,null))[_0x778d('0x2e')](handleError(_0x2dc726,null));};exports[_0x778d('0xaf')]=function(_0x49964a,_0x577af0){return db[_0x778d('0x30')][_0x778d('0xaf')]()['then'](respondWithResult(_0x577af0,null))[_0x778d('0x2e')](handleError(_0x577af0,null));};exports[_0x778d('0xb0')]=function(_0x4d6ed7,_0x4d2a22,_0x524e0c){return db[_0x778d('0xb1')][_0x778d('0x57')]({'where':{'id':_0x4d6ed7[_0x778d('0xaa')]['id']}})['then'](handleEntityNotFound(_0x4d2a22,null))['then'](function(_0x3961d0){if(_0x3961d0){return _0x3961d0[_0x778d('0xb0')](_0x4d6ed7[_0x778d('0xae')][_0x778d('0xb2')],_['omit'](_0x4d6ed7[_0x778d('0xae')],['ids','id'])||{});}})[_0x778d('0x23')](respondWithResult(_0x4d2a22,null))[_0x778d('0x2e')](handleError(_0x4d2a22,null));};exports[_0x778d('0xb3')]=function(_0xf91fcc,_0x5dcdd0,_0x2eb359){var _0x398283={'raw':![],'where':{}};var _0x4abe0c={};var _0x35c37c={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x778d('0xb4')]({'where':{'id':_0xf91fcc[_0x778d('0xaa')]['id']}})[_0x778d('0x23')](handleEntityNotFound(_0x5dcdd0,null))[_0x778d('0x23')](function(_0x306acd){if(_0x306acd){_0x4abe0c[_0x778d('0x37')]=_[_0x778d('0x34')](db[_0x778d('0xb1')][_0x778d('0x31')]);_0x4abe0c[_0x778d('0x33')]=_[_0x778d('0x34')](_0xf91fcc[_0x778d('0x33')]);_0x4abe0c[_0x778d('0x35')]=_[_0x778d('0x36')](_0x4abe0c['model'],_0x4abe0c[_0x778d('0x33')]);_0x398283[_0x778d('0x38')]=_['intersection'](_0x4abe0c['model'],qs[_0x778d('0x39')](_0xf91fcc[_0x778d('0x33')]['fields']));_0x398283['attributes']=_0x398283[_0x778d('0x38')][_0x778d('0x56')]?_0x398283[_0x778d('0x38')]:_0x4abe0c[_0x778d('0x37')];if(!_0xf91fcc[_0x778d('0x33')]['hasOwnProperty'](_0x778d('0x3b'))){_0x398283[_0x778d('0x1e')]=qs['limit'](_0xf91fcc['query'][_0x778d('0x1e')]);_0x398283[_0x778d('0x1d')]=qs[_0x778d('0x1d')](_0xf91fcc[_0x778d('0x33')][_0x778d('0x1d')]);}_0x398283['order']=qs[_0x778d('0x3d')](_0xf91fcc['query'][_0x778d('0x3d')]);_0x398283[_0x778d('0x3e')]=qs[_0x778d('0x35')](_[_0x778d('0x3f')](_0xf91fcc['query'],_0x4abe0c[_0x778d('0x35')]));_0x398283[_0x778d('0x3e')][_0x778d('0xa5')]=_0x306acd['id'];if(_0xf91fcc[_0x778d('0x33')][_0x778d('0x79')]){_0x398283[_0x778d('0x3e')]=_[_0x778d('0x93')](_0x398283[_0x778d('0x3e')],{'$or':_[_0x778d('0x29')](_0x398283['attributes'],function(_0x2d70a9){var _0x102f56={};_0x102f56[_0x2d70a9]={'$like':'%'+_0xf91fcc['query'][_0x778d('0x79')]+'%'};return _0x102f56;})});}if(_0xf91fcc[_0x778d('0x33')]['$gte']){var _0x388966=_0xf91fcc[_0x778d('0x33')][_0x778d('0x70')][_0x778d('0x2c')](',');var _0x3d5515={};_0x3d5515[_0x388966[0x0]]={'$gte':moment(_0x388966[0x1])[_0x778d('0xb5')](_0x778d('0xb6'))};_0x398283['where']=_[_0x778d('0x93')](_0x398283['where'],_0x3d5515);}_0x398283=_['merge']({},_0x398283,_0xf91fcc[_0x778d('0xac')]);return db['FaxMessage'][_0x778d('0x91')]({'where':_0x398283[_0x778d('0x3e')]})[_0x778d('0x23')](function(_0x391146){_0x35c37c[_0x778d('0x91')]=_0x391146;if(_0xf91fcc[_0x778d('0x33')][_0x778d('0xab')]){_0x398283['include']=[{'all':!![]}];}return db[_0x778d('0xb1')][_0x778d('0xb7')](_0x398283);})['then'](function(_0x8ed7d8){_0x35c37c[_0x778d('0xa8')]=_0x8ed7d8;return _0x35c37c;});}})['then'](respondWithFilteredResult(_0x5dcdd0,_0x398283))[_0x778d('0x2e')](handleError(_0x5dcdd0,null));};exports['addTags']=function(_0x2d7698,_0x4f9741,_0x4eb2c5){return db[_0x778d('0x30')][_0x778d('0x57')]({'where':{'id':_0x2d7698[_0x778d('0xaa')]['id']}})[_0x778d('0x23')](handleEntityNotFound(_0x4f9741,null))[_0x778d('0x23')](function(_0x54cd0c){if(_0x54cd0c){return _0x54cd0c[_0x778d('0xb8')](_0x2d7698[_0x778d('0xae')]['ids'],_[_0x778d('0xb9')](_0x2d7698[_0x778d('0xae')],['ids','id'])||{})[_0x778d('0xba')](function(){return db[_0x778d('0xbb')][_0x778d('0xb7')]({'attributes':['id',_0x778d('0x28'),'color'],'where':{'id':_0x2d7698[_0x778d('0xae')][_0x778d('0xb2')]}});})[_0x778d('0x23')](function(_0x1c3e4a){socket['emit'](_0x778d('0xbc'),{'id':Number(_0x2d7698[_0x778d('0xaa')]['id']),'tags':_0x1c3e4a||[]});return{'id':Number(_0x2d7698[_0x778d('0xaa')]['id']),'tags':_0x1c3e4a||[]};});}})[_0x778d('0x23')](respondWithResult(_0x4f9741,null))[_0x778d('0x2e')](handleError(_0x4f9741,null));};exports[_0x778d('0xbd')]=function(_0x3c8080,_0x512719,_0x54b193){return db['FaxInteraction'][_0x778d('0x57')]({'where':{'id':_0x3c8080[_0x778d('0xaa')]['id']}})[_0x778d('0x23')](handleEntityNotFound(_0x512719,null))[_0x778d('0x23')](function(_0x15891b){if(_0x15891b){return _0x15891b['removeTags'](_0x3c8080[_0x778d('0x33')][_0x778d('0xb2')]);}})['then'](respondWithStatusCode(_0x512719,null))['catch'](handleError(_0x512719,null));};exports[_0x778d('0xbe')]=function(_0x37c860,_0x1835e0){var _0x590b5e=moment()['unix']()[_0x778d('0x90')]();var _0x14de72=path[_0x778d('0xbf')](config[_0x778d('0xc0')],_0x778d('0xc1'),_0x778d('0xc2'),_0x778d('0xc3'));var _0x1686fe=path[_0x778d('0xbf')](config[_0x778d('0xc0')],_0x778d('0xc1'),'files',_0x778d('0xc4'));var _0x2c94ed=path[_0x778d('0xbf')](_0x14de72,_0x590b5e);var _0x1321dc=util[_0x778d('0xb5')](_0x778d('0xc5'),_0x37c860[_0x778d('0xaa')]['id'],_0x590b5e);var _0x4e8997=path[_0x778d('0xbf')](_0x14de72,_0x1321dc);var _0x28e038=[];_0x28e038[_0x778d('0xa6')]({'model':db[_0x778d('0xc6')],'as':_0x778d('0xc6'),'raw':!![]});var _0x37f916=[{'model':db[_0x778d('0xb1')],'as':_0x778d('0xc7'),'attributes':['id',_0x778d('0xae'),_0x778d('0x6e')],'include':_0x28e038}];return db[_0x778d('0x30')][_0x778d('0x57')]({'where':{'id':_0x37c860[_0x778d('0xaa')]['id']},'include':_0x37f916})['then'](handleEntityNotFound(_0x1835e0,null))[_0x778d('0x23')](function(_0x222101){if(_0x222101&&_0x222101[_0x778d('0xc7')]){var _0x4bdfc2=_0x222101[_0x778d('0xc8')]({'plain':!![]});fs[_0x778d('0xc9')](_0x2c94ed);for(var _0x573b42=0x0;_0x573b42<_0x4bdfc2[_0x778d('0xc7')][_0x778d('0x56')];_0x573b42++){var _0x589d07=_0x4bdfc2[_0x778d('0xc7')][_0x573b42][_0x778d('0xc6')];if(_0x589d07){var _0x2db44b=path[_0x778d('0xbf')](_0x1686fe,_0x589d07['basename']);if(fs[_0x778d('0xca')](_0x2db44b)){fs['createReadStream'](_0x2db44b)[_0x778d('0xcb')](fs[_0x778d('0xcc')](path['join'](_0x2c94ed,_0x589d07[_0x778d('0xcd')])));}}}return BPromise[_0x778d('0x87')]()[_0x778d('0x23')](function(){return new BPromise(function(_0x4ea08d,_0x51cf50){zipdir(_0x2c94ed,{'saveTo':_0x4e8997},function(_0x730e30,_0x254dba){if(_0x730e30)return _0x51cf50(_0x730e30);return _0x4ea08d(_0x254dba);});})[_0x778d('0x23')](function(){return new BPromise(function(_0x1b7937,_0xfd2336){rimraf(_0x2c94ed,function(_0x4e3570){if(_0x4e3570)_0xfd2336(_0x4e3570);return _0x1b7937();});});})[_0x778d('0x23')](function(){return _0x1835e0['download'](_0x4e8997,_0x1321dc,function(_0x26cc8f){if(_0x26cc8f){console[_0x778d('0xce')](_0x778d('0xcf'),_0x26cc8f);}else{fs['unlinkSync'](_0x4e8997);}});});});}else{return _0x1835e0[_0x778d('0xd0')](0xc8);}})['catch'](handleError(_0x1835e0,null));}; \ No newline at end of file +var _0xaab4=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','send','TagIds','split','forEach','Tags','push','then','index','FaxInteraction','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','find','unreadMessages','value','`\x20=\x200','having','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','isEmpty','concat','createdAt','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\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)','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','catch','show','params','includeAll','include','options','create','addMessage','FaxMessage','omit','ids','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','Tag','faxInteractionTags:save','removeTags','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','download','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs'];(function(_0x13915f,_0x3d90c6){var _0x373181=function(_0x66a7b4){while(--_0x66a7b4){_0x13915f['push'](_0x13915f['shift']());}};_0x373181(++_0x3d90c6);}(_0xaab4,0xd4));var _0x4aab=function(_0xf0561d,_0x232524){_0xf0561d=_0xf0561d-0x0;var _0x5a6804=_0xaab4[_0xf0561d];return _0x5a6804;};'use strict';var pdf=require(_0x4aab('0x0'));var emlformat=require(_0x4aab('0x1'));var rimraf=require(_0x4aab('0x2'));var zipdir=require(_0x4aab('0x3'));var jsonpatch=require(_0x4aab('0x4'));var rp=require(_0x4aab('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4aab('0x6'));var util=require('util');var path=require(_0x4aab('0x7'));var sox=require(_0x4aab('0x8'));var csv=require(_0x4aab('0x9'));var ejs=require(_0x4aab('0xa'));var fs=require('fs');var _=require(_0x4aab('0xb'));var squel=require(_0x4aab('0xc'));var crypto=require(_0x4aab('0xd'));var jsforce=require(_0x4aab('0xe'));var deskjs=require(_0x4aab('0xf'));var toCsv=require(_0x4aab('0x9'));var querystring=require(_0x4aab('0x10'));var Papa=require(_0x4aab('0x11'));var Redis=require(_0x4aab('0x12'));var authService=require(_0x4aab('0x13'));var qs=require(_0x4aab('0x14'));var as=require(_0x4aab('0x15'));var hardwareService=require(_0x4aab('0x16'));var logger=require(_0x4aab('0x17'))(_0x4aab('0x18'));var utils=require('../../config/utils');var config=require(_0x4aab('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4aab('0x1a')]=_[_0x4aab('0x1b')](config[_0x4aab('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x4aab('0x1c'))(new Redis(config[_0x4aab('0x1a')]));require(_0x4aab('0x1d'))[_0x4aab('0x1e')](socket);function respondWithStatusCode(_0x27f259,_0x32f125){_0x32f125=_0x32f125||0xcc;return function(_0xb70339){if(_0xb70339){return _0x27f259[_0x4aab('0x1f')](_0x32f125);}return _0x27f259[_0x4aab('0x20')](_0x32f125)[_0x4aab('0x21')]();};}function respondWithResult(_0x435d8a,_0x5a0286){_0x5a0286=_0x5a0286||0xc8;return function(_0x9bc835){if(_0x9bc835){return _0x435d8a[_0x4aab('0x20')](_0x5a0286)[_0x4aab('0x22')](_0x9bc835);}};}function respondWithFilteredResult(_0x99921f,_0x4dc15a){return function(_0x4694d3){if(_0x4694d3){var _0x8e8962=_0x4694d3[_0x4aab('0x23')],_0x1df42c=_0x4dc15a[_0x4aab('0x24')],_0x1069b3=_0x4dc15a[_0x4aab('0x24')]+_0x4dc15a[_0x4aab('0x25')],_0x74ec80;if(_0x1069b3>=_0x8e8962){_0x1069b3=_0x8e8962;_0x74ec80=0xc8;}else{_0x74ec80=0xce;}_0x99921f[_0x4aab('0x20')](_0x74ec80);return _0x99921f[_0x4aab('0x26')](_0x4aab('0x27'),_0x1df42c+'-'+_0x1069b3+'/'+_0x8e8962)['json'](_0x4694d3);}return null;};}function patchUpdates(_0x4f4ae4){return function(_0x3d2310){try{jsonpatch[_0x4aab('0x28')](_0x3d2310,_0x4f4ae4,!![]);}catch(_0x36b748){return BPromise[_0x4aab('0x29')](_0x36b748);}return _0x3d2310[_0x4aab('0x2a')]();};}function saveUpdates(_0x48905c,_0x3e5019){return function(_0x3e33c5){if(_0x3e33c5){return _0x3e33c5[_0x4aab('0x2b')](_0x48905c)['then'](function(_0x7e35dc){return _0x7e35dc;});}return null;};}function removeEntity(_0x3ce624,_0x4ae8aa){return function(_0x233da4){if(_0x233da4){return _0x233da4['destroy']()['then'](function(){_0x3ce624[_0x4aab('0x20')](0xcc)[_0x4aab('0x21')]();});}};}function handleEntityNotFound(_0x2b327e,_0x24a343){return function(_0x1c85fc){if(!_0x1c85fc){_0x2b327e[_0x4aab('0x1f')](0x194);}return _0x1c85fc;};}function handleError(_0x2183c2,_0x1eadba){_0x1eadba=_0x1eadba||0x1f4;return function(_0x4184f7){logger['error'](_0x4184f7[_0x4aab('0x2c')]);if(_0x4184f7[_0x4aab('0x2d')]){delete _0x4184f7[_0x4aab('0x2d')];}_0x2183c2[_0x4aab('0x20')](_0x1eadba)[_0x4aab('0x2e')](_0x4184f7);};}function getInteractionUsers(_0x303cc3,_0x1d196a){return new BPromise(function(_0x106d29,_0x547188){try{if(_0x1d196a[_0x303cc3['id']]){_0x303cc3['Users']=_['map'](_0x1d196a[_0x303cc3['id']],function(_0x2e361f){return{'id':_0x2e361f['id'],'fullname':_0x2e361f['fullname']};});}}catch(_0x12d456){_0x547188(_0x12d456);}_0x106d29(_0x303cc3);});}function getInteractionTags(_0x3056ec,_0x10870b){return new BPromise(function(_0x28e732,_0x14ec45){try{if(_0x3056ec[_0x4aab('0x2f')]){_0x3056ec['Tags']=[];_0x3056ec[_0x4aab('0x2f')][_0x4aab('0x30')](',')[_0x4aab('0x31')](function(_0x3f33cb){_0x3056ec[_0x4aab('0x32')][_0x4aab('0x33')](_0x10870b[_0x3f33cb]);});}delete _0x3056ec[_0x4aab('0x2f')];}catch(_0x1cfaf7){_0x14ec45(_0x1cfaf7);}_0x28e732(_0x3056ec);});}function updateFaxInteraction(_0x3f8a93,_0x32b1b9,_0x522577){return new BPromise(function(_0x30b828,_0x16155f){return getInteractionUsers(_0x3f8a93,_0x522577)[_0x4aab('0x34')](function(_0x43fe93){return getInteractionTags(_0x43fe93,_0x32b1b9);})[_0x4aab('0x34')](function(_0x5b3fa6){_0x30b828(_0x5b3fa6);})['catch'](function(_0x5ca289){_0x16155f(_0x5ca289);});});}exports[_0x4aab('0x35')]=function(_0x2ebb84,_0x1ffe03){var _0xa12f10={},_0x252439={},_0x310e4e={'count':0x0,'rows':[]};var _0x4f2486=_['map'](db[_0x4aab('0x36')][_0x4aab('0x37')],function(_0x3f0531){return{'name':_0x3f0531['fieldName'],'type':_0x3f0531[_0x4aab('0x38')][_0x4aab('0x39')]};});_0x252439[_0x4aab('0x3a')]=_[_0x4aab('0x3b')](_0x4f2486,'name');_0x252439['query']=_[_0x4aab('0x3c')](_0x2ebb84[_0x4aab('0x3d')]);_0x252439[_0x4aab('0x3e')]=_[_0x4aab('0x3f')](_0x252439[_0x4aab('0x3a')],_0x252439[_0x4aab('0x3d')]);_0xa12f10['attributes']=_[_0x4aab('0x3f')](_0x252439[_0x4aab('0x3a')],qs[_0x4aab('0x40')](_0x2ebb84['query'][_0x4aab('0x40')]));_0xa12f10['attributes']=_0xa12f10[_0x4aab('0x41')][_0x4aab('0x42')]?_0xa12f10[_0x4aab('0x41')]:_0x252439['model'];if(!_0x2ebb84['query'][_0x4aab('0x43')](_0x4aab('0x44'))){_0xa12f10[_0x4aab('0x25')]=qs[_0x4aab('0x25')](_0x2ebb84[_0x4aab('0x3d')][_0x4aab('0x25')]);_0xa12f10[_0x4aab('0x24')]=qs['offset'](_0x2ebb84[_0x4aab('0x3d')][_0x4aab('0x24')]);}_0xa12f10[_0x4aab('0x45')]=qs[_0x4aab('0x46')](_0x2ebb84[_0x4aab('0x3d')][_0x4aab('0x46')]);_0xa12f10[_0x4aab('0x47')]=qs[_0x4aab('0x3e')](_[_0x4aab('0x48')](_0x2ebb84[_0x4aab('0x3d')],_0x252439[_0x4aab('0x3e')]),_0x4f2486);var _0x40de8e=[];var _0x563dc3=squel[_0x4aab('0x49')]()['field']('id')['field'](_0x4aab('0x2d'))[_0x4aab('0x4a')]('color')[_0x4aab('0x4b')](_0x4aab('0x4c'));var _0x494db2=squel[_0x4aab('0x49')]()[_0x4aab('0x4a')](_0x4aab('0x4d'))['field'](_0x4aab('0x4e'))[_0x4aab('0x4a')](_0x4aab('0x4f'))[_0x4aab('0x4b')]('user_has_fax_interactions','ui')[_0x4aab('0x50')](_0x4aab('0x51'),'u',_0x4aab('0x52'));var _0x1e5fdc=squel[_0x4aab('0x49')]()[_0x4aab('0x4b')](_0x4aab('0x53'),'i')['left_join'](_0x4aab('0x54'),'c',_0x4aab('0x55'))[_0x4aab('0x50')]('users','o',_0x4aab('0x56'))[_0x4aab('0x50')]('fax_accounts','a',_0x4aab('0x57'))[_0x4aab('0x50')](_0x4aab('0x58'),'me',_0x4aab('0x59'))[_0x4aab('0x50')](_0x4aab('0x5a'),'it',_0x4aab('0x5b'))[_0x4aab('0x50')](_0x4aab('0x4c'),'t',_0x4aab('0x5c'));var _0xc70363=squel[_0x4aab('0x5d')]();var _0xde632b=[];var _0x3af418=squel[_0x4aab('0x5d')]();var _0x3bd579;if(_0x2ebb84[_0x4aab('0x3d')][_0x4aab('0x5e')]){_0x3bd579=as[_0x4aab('0x5f')](_0x2ebb84[_0x4aab('0x3d')]['search']);var _0x5a5254=_0x3bd579[_0x4aab('0x60')];for(var _0x1ebffc=0x0;_0x1ebffc<_0x3bd579['conditions'][_0x4aab('0x42')];_0x1ebffc++){var _0x43a059=_0x3bd579['conditions'][_0x1ebffc];var _0x5403d2='i';var _0x595912=_[_0x4aab('0x61')](_0x4f2486,[_0x4aab('0x2d'),_0x43a059[_0x4aab('0x4a')]]);if(!_0x595912){switch(_0x43a059[_0x4aab('0x4a')]){case _0x4aab('0x62'):if(_0x43a059[_0x4aab('0x63')]==0x1){_0x1e5fdc['having']('`'+_0x43a059[_0x4aab('0x4a')]+_0x4aab('0x64'));}else{_0x1e5fdc[_0x4aab('0x65')]('`'+_0x43a059['field']+'`\x20>\x200');}break;case _0x4aab('0x66'):if(_0x43a059['operator']===_0x4aab('0x67')){if(_0x43a059[_0x4aab('0x63')]['split']('\x20')[_0x4aab('0x42')]>0x1){_0xc70363[_0x5a5254](_0x4aab('0x68'),qs[_0x4aab('0x69')](_0x43a059['value']),null);}else{var _0x4e9321='%'+_0x43a059['value']+'%';_0xc70363[_0x5a5254](_0x4aab('0x6a'),_0x4e9321,_0x4e9321,_0x4e9321);}}else{_0x595912=_[_0x4aab('0x61')](_0x4f2486,[_0x4aab('0x2d'),_0x4aab('0x6b')]);_0x43a059[_0x4aab('0x4a')]='ContactId';_0x185948=as[_0x4aab('0x6c')](_0x5403d2,_0x595912[_0x4aab('0x38')],_0x43a059);_0xc70363[_0x5a5254](_0x185948['text'],_0x185948[_0x4aab('0x63')][_0x4aab('0x6d')],_0x185948[_0x4aab('0x63')][_0x4aab('0x21')]);}break;case'Tag':var _0x18ecce=_0x43a059[_0x4aab('0x63')]['split'](',')[_0x4aab('0x3b')](function(_0x7f91ec){return Number(_0x7f91ec);});_0x18ecce[_0x4aab('0x31')](function(_0x484f99){_0x3af418['or'](_0x4aab('0x6e'),'%,'+_0x484f99+',%');});_0xde632b=_[_0x4aab('0x6f')](_0xde632b,_0x18ecce);break;case _0x4aab('0x70'):if(_0x43a059[_0x4aab('0x71')]===_0x4aab('0x67')){_0xc70363[_0x5a5254](_0x4aab('0x72'),'%'+_0x43a059[_0x4aab('0x63')]+'%',null);}else{_0x595912=_[_0x4aab('0x61')](_0x4f2486,[_0x4aab('0x2d'),_0x4aab('0x73')]);_0x43a059['field']='UserId';_0x185948=as['buildExpression'](_0x5403d2,_0x595912[_0x4aab('0x38')],_0x43a059);_0xc70363[_0x5a5254](_0x185948[_0x4aab('0x74')],_0x185948[_0x4aab('0x63')]['start'],_0x185948[_0x4aab('0x63')][_0x4aab('0x21')]);}break;case _0x4aab('0x75'):_0x185948=as[_0x4aab('0x6c')]('me',null,_0x43a059);_0xc70363[_0x5a5254](_0x185948[_0x4aab('0x74')],_0x185948['value'][_0x4aab('0x6d')],_0x185948[_0x4aab('0x63')]['end']);break;}}else{var _0x185948=as[_0x4aab('0x6c')](_0x5403d2,_0x595912[_0x4aab('0x38')],_0x43a059);_0xc70363[_0x5a5254](_0x185948['text'],_0x185948[_0x4aab('0x63')][_0x4aab('0x6d')],_0x185948['value'][_0x4aab('0x21')]);}}}else{var _0x38d12a=_(_0x2ebb84[_0x4aab('0x3d')])[_0x4aab('0x3c')]()[_0x4aab('0x3b')](function(_0x449d07){return _['some'](_0x4f2486,['name',_0x449d07])?_0x449d07:undefined;})['compact']()[_0x4aab('0x63')]();if(!_[_0x4aab('0x76')](_0x38d12a)){_0x38d12a[_0x4aab('0x31')](function(_0x12a741){if(_0x12a741==='FaxAccountId'){_0x1e5fdc[_0x4aab('0x47')]('i.FaxAccountId\x20IN\x20?',[][_0x4aab('0x77')](_0x2ebb84['query'][_0x12a741]));}else if(_0x12a741===_0x4aab('0x78')){var _0x7dc867=JSON['parse'](_0x2ebb84[_0x4aab('0x3d')][_0x12a741])['$gte'];var _0x15bb41=JSON['parse'](_0x2ebb84[_0x4aab('0x3d')][_0x12a741])[_0x4aab('0x79')];_0x1e5fdc['where'](_0x4aab('0x7a'),_0x7dc867,_0x15bb41);}else{if(_0x2ebb84[_0x4aab('0x3d')][_0x12a741]===_0x4aab('0x7b')){_0x1e5fdc[_0x4aab('0x47')]('i.'+_0x12a741+_0x4aab('0x7c'));}else{_0x1e5fdc[_0x4aab('0x47')]('i.'+_0x12a741+_0x4aab('0x7d'),_0x2ebb84['query'][_0x12a741]);}}});}if(_0x2ebb84['query'][_0x4aab('0x7e')]){if(_0x2ebb84[_0x4aab('0x3d')][_0x4aab('0x7e')]==0x1){_0x1e5fdc['having'](_0x4aab('0x7f'));}else{_0x1e5fdc[_0x4aab('0x65')](_0x4aab('0x80'));}}if(_0x2ebb84['query'][_0x4aab('0x81')]){_0xde632b=_[_0x4aab('0x82')](_0x2ebb84[_0x4aab('0x3d')]['tag'])?_0x2ebb84[_0x4aab('0x3d')][_0x4aab('0x81')]:new Array(_0x2ebb84[_0x4aab('0x3d')][_0x4aab('0x81')]);_0xde632b[_0x4aab('0x31')](function(_0x38baa5){_0x3af418['or'](_0x4aab('0x6e'),'%,'+_0x38baa5+',%');});}if(_0x2ebb84[_0x4aab('0x3d')][_0x4aab('0x83')]){var _0x5a194e=_0x2ebb84[_0x4aab('0x3d')]['filter'][_0x4aab('0x84')]('\x5c','\x5c\x5c')[_0x4aab('0x84')](/'/g,'\x27\x27');if(qs[_0x4aab('0x85')](_0x5a194e)){_0xc70363['or'](_0x4aab('0x86'),_0x5a194e+'%')['or'](_0x4aab('0x87'),_0x5a194e+'%');}_0xc70363['or'](_0x4aab('0x88'),_0x5a194e+'%');}}_0x1e5fdc[_0x4aab('0x47')](_0xc70363);_0x1e5fdc[_0x4aab('0x89')](_0x4aab('0x8a'));var _0x16428d={'type':db[_0x4aab('0x8b')][_0x4aab('0x8c')]['SELECT'],'raw':!![]};var _0x31d57b=_0x1e5fdc['clone']();_0x31d57b[_0x4aab('0x4a')]('i.id');_0x31d57b[_0x4aab('0x4a')](_0x4aab('0x8d'),_0x4aab('0x62'));if(_0xa12f10['order']){_0xa12f10[_0x4aab('0x45')][_0x4aab('0x31')](function(_0x47d94f){var _0x420275=_0x47d94f[0x0]==='contactName'?_0x47d94f[0x0]:'i.'+_0x47d94f[0x0];_0x1e5fdc['order'](_0x420275,_0x47d94f[0x1]===_0x4aab('0x8e')?![]:!![]);});}if(!_[_0x4aab('0x76')](_0xde632b)){_0x1e5fdc[_0x4aab('0x65')](_0x3af418);_0x31d57b[_0x4aab('0x47')](_0x4aab('0x8f'),_0xde632b);}BPromise[_0x4aab('0x90')]()[_0x4aab('0x34')](function(){if(!_0x3bd579){if(_0x2ebb84['query'][_0x4aab('0x91')])return;_0x31d57b['where'](_0x4aab('0x92'));_0x1e5fdc[_0x4aab('0x47')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x2ebb84['user'][_0x4aab('0x93')]!==_0x4aab('0x94'))return;return _0x2ebb84[_0x4aab('0x95')][_0x4aab('0x96')]({'attributes':['id'],'raw':!![]})[_0x4aab('0x34')](function(_0x54c86d){if(_['isEmpty'](_0x54c86d)){_0x31d57b[_0x4aab('0x47')](_0x4aab('0x97'));_0x1e5fdc[_0x4aab('0x47')](_0x4aab('0x97'));}else{_0x31d57b[_0x4aab('0x47')](_0x4aab('0x98'),_[_0x4aab('0x3b')](_0x54c86d,'id'));_0x1e5fdc[_0x4aab('0x47')](_0x4aab('0x98'),_[_0x4aab('0x3b')](_0x54c86d,'id'));}});})[_0x4aab('0x34')](function(){if(_0x2ebb84['user'][_0x4aab('0x93')]==='agent'&&!_0x3bd579&&!_0x2ebb84['query'][_0x4aab('0x91')])return[];return db[_0x4aab('0x99')][_0x4aab('0x3d')](_0x31d57b[_0x4aab('0x9a')](),_0x16428d);})[_0x4aab('0x34')](function(_0x1adf6f){_0x310e4e[_0x4aab('0x23')]=_0x1adf6f[_0x4aab('0x42')];if(_0x310e4e[_0x4aab('0x23')]===0x0)return[];return db[_0x4aab('0x99')][_0x4aab('0x3d')](_0x563dc3[_0x4aab('0x9a')](),_0x16428d)['then'](function(_0x4dff58){_0x40de8e=_[_0x4aab('0x9b')](_0x4dff58,'id');_0x16428d=_[_0x4aab('0x9c')](_0x16428d,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2ebb84[_0x4aab('0x3d')][_0x4aab('0x40')]){_0xa12f10[_0x4aab('0x41')][_0x4aab('0x31')](function(_0x4c7c9e){_0x1e5fdc[_0x4aab('0x4a')]('i.'+_0x4c7c9e);});}else{_0x1e5fdc[_0x4aab('0x4a')](_0x4aab('0x8d'),_0x4aab('0x62'));_0x1e5fdc['field'](_0x4aab('0x9d'),'Account.key');_0x1e5fdc[_0x4aab('0x4a')](_0x4aab('0x9e'),_0x4aab('0x9f'));_0x1e5fdc['field'](_0x4aab('0xa0'),_0x4aab('0xa1'));_0x1e5fdc[_0x4aab('0x4a')](_0x4aab('0xa2'));_0x1e5fdc['field']('c.firstName',_0x4aab('0xa3'));_0x1e5fdc[_0x4aab('0x4a')](_0x4aab('0xa4'),_0x4aab('0xa5'));_0x1e5fdc[_0x4aab('0x4a')](_0x4aab('0xa6'),_0x4aab('0xa7'));_0x1e5fdc[_0x4aab('0x4a')](_0x4aab('0xa8'),_0x4aab('0xa9'));_0x1e5fdc[_0x4aab('0x4a')](_0x4aab('0xaa'),'Contact.mobile');_0x1e5fdc[_0x4aab('0x4a')]('c.fax','Contact.fax');_0x1e5fdc['field'](_0x4aab('0xab'),_0x4aab('0xac'));_0x1e5fdc[_0x4aab('0x4a')](_0x4aab('0xad'),_0x4aab('0xae'));_0x1e5fdc[_0x4aab('0x4a')](_0x4aab('0xaf'),_0x4aab('0x2f'));}if(_0xa12f10[_0x4aab('0x25')])_0x1e5fdc['limit'](_0xa12f10[_0x4aab('0x25')]);if(_0xa12f10[_0x4aab('0x24')])_0x1e5fdc[_0x4aab('0x24')](_0xa12f10['offset']);return db[_0x4aab('0x99')][_0x4aab('0x3d')](_0x1e5fdc[_0x4aab('0x9a')](),_0x16428d);})['then'](function(_0x294702){_0x494db2[_0x4aab('0x47')](_0x4aab('0xb0'),_[_0x4aab('0x3b')](_0x294702,'id'));return db[_0x4aab('0x99')][_0x4aab('0x3d')](_0x494db2[_0x4aab('0x9a')](),_0x16428d)[_0x4aab('0x34')](function(_0x4d48ee){var _0x4b5cbc=_[_0x4aab('0xb1')](_0x4d48ee,_0x4aab('0xb2'));var _0x270de3=[];_0x294702[_0x4aab('0x31')](function(_0x3238dd){_0x270de3[_0x4aab('0x33')](updateFaxInteraction(_0x3238dd,_0x40de8e,_0x4b5cbc));});return BPromise[_0x4aab('0xb3')](_0x270de3);});});})[_0x4aab('0x34')](function(_0x1260b6){_0x310e4e[_0x4aab('0xb4')]=_0x1260b6;return _0x310e4e;})['then'](respondWithFilteredResult(_0x1ffe03,_0xa12f10))[_0x4aab('0xb5')](handleError(_0x1ffe03,null));};exports[_0x4aab('0xb6')]=function(_0x41a60f,_0x220139){var _0x2483c7={'raw':![],'where':{'id':_0x41a60f[_0x4aab('0xb7')]['id']}},_0x14e75c={};_0x14e75c[_0x4aab('0x3a')]=_[_0x4aab('0x3c')](db[_0x4aab('0x36')]['rawAttributes']);_0x14e75c['query']=_[_0x4aab('0x3c')](_0x41a60f[_0x4aab('0x3d')]);_0x14e75c[_0x4aab('0x3e')]=_['intersection'](_0x14e75c[_0x4aab('0x3a')],_0x14e75c[_0x4aab('0x3d')]);_0x2483c7['attributes']=_[_0x4aab('0x3f')](_0x14e75c[_0x4aab('0x3a')],qs[_0x4aab('0x40')](_0x41a60f['query'][_0x4aab('0x40')]));_0x2483c7[_0x4aab('0x41')]=_0x2483c7['attributes'][_0x4aab('0x42')]?_0x2483c7['attributes']:_0x14e75c[_0x4aab('0x3a')];if(_0x41a60f[_0x4aab('0x3d')][_0x4aab('0xb8')]){_0x2483c7[_0x4aab('0xb9')]=[{'all':!![]}];}_0x2483c7=_[_0x4aab('0x9c')]({},_0x2483c7,_0x41a60f[_0x4aab('0xba')]);return db[_0x4aab('0x36')]['find'](_0x2483c7)[_0x4aab('0x34')](handleEntityNotFound(_0x220139,null))[_0x4aab('0x34')](respondWithResult(_0x220139,null))['catch'](handleError(_0x220139,null));};exports[_0x4aab('0xbb')]=function(_0x1fbfb2,_0x4b8e69){return db['FaxInteraction'][_0x4aab('0xbb')](_0x1fbfb2[_0x4aab('0x75')],{})[_0x4aab('0x34')](respondWithResult(_0x4b8e69,0xc9))[_0x4aab('0xb5')](handleError(_0x4b8e69,null));};exports[_0x4aab('0x2b')]=function(_0x468885,_0x2a023c){if(_0x468885[_0x4aab('0x75')]['id']){delete _0x468885[_0x4aab('0x75')]['id'];}return db['FaxInteraction'][_0x4aab('0x61')]({'where':{'id':_0x468885['params']['id']}})[_0x4aab('0x34')](handleEntityNotFound(_0x2a023c,null))['then'](saveUpdates(_0x468885[_0x4aab('0x75')],null))[_0x4aab('0x34')](respondWithResult(_0x2a023c,null))['catch'](handleError(_0x2a023c,null));};exports['destroy']=function(_0x384fdc,_0x3c9964){return db[_0x4aab('0x36')][_0x4aab('0x61')]({'where':{'id':_0x384fdc[_0x4aab('0xb7')]['id']}})[_0x4aab('0x34')](handleEntityNotFound(_0x3c9964,null))[_0x4aab('0x34')](removeEntity(_0x3c9964,null))['catch'](handleError(_0x3c9964,null));};exports['describe']=function(_0x3dedcc,_0x58a7e5){return db[_0x4aab('0x36')]['describe']()[_0x4aab('0x34')](respondWithResult(_0x58a7e5,null))['catch'](handleError(_0x58a7e5,null));};exports[_0x4aab('0xbc')]=function(_0x30d8c1,_0x395e12,_0x44de52){return db[_0x4aab('0xbd')]['find']({'where':{'id':_0x30d8c1[_0x4aab('0xb7')]['id']}})[_0x4aab('0x34')](handleEntityNotFound(_0x395e12,null))[_0x4aab('0x34')](function(_0x17dc3d){if(_0x17dc3d){return _0x17dc3d['addMessage'](_0x30d8c1[_0x4aab('0x75')]['ids'],_[_0x4aab('0xbe')](_0x30d8c1[_0x4aab('0x75')],[_0x4aab('0xbf'),'id'])||{});}})[_0x4aab('0x34')](respondWithResult(_0x395e12,null))[_0x4aab('0xb5')](handleError(_0x395e12,null));};exports[_0x4aab('0xc0')]=function(_0x528815,_0xd3b686,_0x5bf3ff){var _0x5deed7={'raw':![],'where':{}};var _0x458125={};var _0x25a4f7={'count':0x0,'rows':[]};return db[_0x4aab('0x36')][_0x4aab('0xc1')]({'where':{'id':_0x528815[_0x4aab('0xb7')]['id']}})[_0x4aab('0x34')](handleEntityNotFound(_0xd3b686,null))[_0x4aab('0x34')](function(_0x8285bc){if(_0x8285bc){_0x458125[_0x4aab('0x3a')]=_[_0x4aab('0x3c')](db[_0x4aab('0xbd')][_0x4aab('0x37')]);_0x458125[_0x4aab('0x3d')]=_[_0x4aab('0x3c')](_0x528815[_0x4aab('0x3d')]);_0x458125[_0x4aab('0x3e')]=_[_0x4aab('0x3f')](_0x458125[_0x4aab('0x3a')],_0x458125[_0x4aab('0x3d')]);_0x5deed7['attributes']=_['intersection'](_0x458125[_0x4aab('0x3a')],qs['fields'](_0x528815[_0x4aab('0x3d')][_0x4aab('0x40')]));_0x5deed7[_0x4aab('0x41')]=_0x5deed7['attributes']['length']?_0x5deed7[_0x4aab('0x41')]:_0x458125[_0x4aab('0x3a')];if(!_0x528815[_0x4aab('0x3d')][_0x4aab('0x43')](_0x4aab('0x44'))){_0x5deed7[_0x4aab('0x25')]=qs[_0x4aab('0x25')](_0x528815[_0x4aab('0x3d')]['limit']);_0x5deed7[_0x4aab('0x24')]=qs[_0x4aab('0x24')](_0x528815['query']['offset']);}_0x5deed7[_0x4aab('0x45')]=qs['sort'](_0x528815['query'][_0x4aab('0x46')]);_0x5deed7[_0x4aab('0x47')]=qs[_0x4aab('0x3e')](_[_0x4aab('0x48')](_0x528815[_0x4aab('0x3d')],_0x458125[_0x4aab('0x3e')]));_0x5deed7['where'][_0x4aab('0xb2')]=_0x8285bc['id'];if(_0x528815[_0x4aab('0x3d')][_0x4aab('0x83')]){_0x5deed7[_0x4aab('0x47')]=_[_0x4aab('0x9c')](_0x5deed7['where'],{'$or':_[_0x4aab('0x3b')](_0x5deed7[_0x4aab('0x41')],function(_0x576f5e){var _0x2ed720={};_0x2ed720[_0x576f5e]={'$like':'%'+_0x528815[_0x4aab('0x3d')][_0x4aab('0x83')]+'%'};return _0x2ed720;})});}if(_0x528815[_0x4aab('0x3d')]['$gte']){var _0x84ab08=_0x528815[_0x4aab('0x3d')][_0x4aab('0xc2')][_0x4aab('0x30')](',');var _0x5851fe={};_0x5851fe[_0x84ab08[0x0]]={'$gte':moment(_0x84ab08[0x1])[_0x4aab('0xc3')](_0x4aab('0xc4'))};_0x5deed7[_0x4aab('0x47')]=_[_0x4aab('0x9c')](_0x5deed7[_0x4aab('0x47')],_0x5851fe);}_0x5deed7=_[_0x4aab('0x9c')]({},_0x5deed7,_0x528815[_0x4aab('0xba')]);return db[_0x4aab('0xbd')][_0x4aab('0x23')]({'where':_0x5deed7[_0x4aab('0x47')]})[_0x4aab('0x34')](function(_0x426430){_0x25a4f7['count']=_0x426430;if(_0x528815[_0x4aab('0x3d')]['includeAll']){_0x5deed7[_0x4aab('0xb9')]=[{'all':!![]}];}return db[_0x4aab('0xbd')][_0x4aab('0xc5')](_0x5deed7);})[_0x4aab('0x34')](function(_0x2dc385){_0x25a4f7[_0x4aab('0xb4')]=_0x2dc385;return _0x25a4f7;});}})[_0x4aab('0x34')](respondWithFilteredResult(_0xd3b686,_0x5deed7))[_0x4aab('0xb5')](handleError(_0xd3b686,null));};exports[_0x4aab('0xc6')]=function(_0x1d3cc3,_0x1073f5,_0x1a73df){return db['FaxInteraction'][_0x4aab('0x61')]({'where':{'id':_0x1d3cc3[_0x4aab('0xb7')]['id']}})[_0x4aab('0x34')](handleEntityNotFound(_0x1073f5,null))[_0x4aab('0x34')](function(_0x4447a8){if(_0x4447a8){return _0x4447a8[_0x4aab('0xc7')](_0x1d3cc3[_0x4aab('0x75')][_0x4aab('0xbf')],_[_0x4aab('0xbe')](_0x1d3cc3[_0x4aab('0x75')],[_0x4aab('0xbf'),'id'])||{})['spread'](function(){return db[_0x4aab('0xc8')][_0x4aab('0xc5')]({'attributes':['id',_0x4aab('0x2d'),'color'],'where':{'id':_0x1d3cc3[_0x4aab('0x75')][_0x4aab('0xbf')]}});})[_0x4aab('0x34')](function(_0x249e06){socket['emit'](_0x4aab('0xc9'),{'id':Number(_0x1d3cc3[_0x4aab('0xb7')]['id']),'tags':_0x249e06||[]});return{'id':Number(_0x1d3cc3[_0x4aab('0xb7')]['id']),'tags':_0x249e06||[]};});}})[_0x4aab('0x34')](respondWithResult(_0x1073f5,null))[_0x4aab('0xb5')](handleError(_0x1073f5,null));};exports[_0x4aab('0xca')]=function(_0x22b2b8,_0x24b348,_0x2b0970){return db[_0x4aab('0x36')][_0x4aab('0x61')]({'where':{'id':_0x22b2b8['params']['id']}})[_0x4aab('0x34')](handleEntityNotFound(_0x24b348,null))[_0x4aab('0x34')](function(_0x459d62){if(_0x459d62){return _0x459d62[_0x4aab('0xca')](_0x22b2b8['query'][_0x4aab('0xbf')]);}})[_0x4aab('0x34')](respondWithStatusCode(_0x24b348,null))['catch'](handleError(_0x24b348,null));};exports['download']=function(_0x34a667,_0x322046){var _0x19e6f1=moment()[_0x4aab('0xcb')]()[_0x4aab('0x9a')]();var _0x13ea49=path['join'](config[_0x4aab('0xcc')],_0x4aab('0xcd'),_0x4aab('0xce'),_0x4aab('0xcf'));var _0xc7879e=path[_0x4aab('0xd0')](config[_0x4aab('0xcc')],_0x4aab('0xcd'),_0x4aab('0xce'),_0x4aab('0xd1'));var _0x21e92e=path['join'](_0x13ea49,_0x19e6f1);var _0xf13590=util[_0x4aab('0xc3')](_0x4aab('0xd2'),_0x34a667[_0x4aab('0xb7')]['id'],_0x19e6f1);var _0x2a18a8=path[_0x4aab('0xd0')](_0x13ea49,_0xf13590);var _0x167322=[];_0x167322[_0x4aab('0x33')]({'model':db['Attachment'],'as':_0x4aab('0xd3'),'raw':!![]});var _0x3b0a95=[{'model':db[_0x4aab('0xbd')],'as':_0x4aab('0xd4'),'attributes':['id',_0x4aab('0x75'),_0x4aab('0x78')],'include':_0x167322}];return db[_0x4aab('0x36')]['find']({'where':{'id':_0x34a667[_0x4aab('0xb7')]['id']},'include':_0x3b0a95})[_0x4aab('0x34')](handleEntityNotFound(_0x322046,null))[_0x4aab('0x34')](function(_0x43844a){if(_0x43844a&&_0x43844a[_0x4aab('0xd4')]){var _0x324b78=_0x43844a[_0x4aab('0xd5')]({'plain':!![]});fs[_0x4aab('0xd6')](_0x21e92e);for(var _0x21d295=0x0;_0x21d295<_0x324b78[_0x4aab('0xd4')][_0x4aab('0x42')];_0x21d295++){var _0x73163b=_0x324b78[_0x4aab('0xd4')][_0x21d295][_0x4aab('0xd3')];if(_0x73163b){var _0xf0d6c0=path['join'](_0xc7879e,_0x73163b[_0x4aab('0xd7')]);if(fs[_0x4aab('0xd8')](_0xf0d6c0)){fs[_0x4aab('0xd9')](_0xf0d6c0)[_0x4aab('0xda')](fs[_0x4aab('0xdb')](path['join'](_0x21e92e,_0x73163b[_0x4aab('0xd7')])));}}}return BPromise[_0x4aab('0x90')]()[_0x4aab('0x34')](function(){return new BPromise(function(_0x24bf8f,_0x244e24){zipdir(_0x21e92e,{'saveTo':_0x2a18a8},function(_0x300171,_0x3cbb71){if(_0x300171)return _0x244e24(_0x300171);return _0x24bf8f(_0x3cbb71);});})['then'](function(){return new BPromise(function(_0xa130ff,_0x1acff9){rimraf(_0x21e92e,function(_0x2d75b3){if(_0x2d75b3)_0x1acff9(_0x2d75b3);return _0xa130ff();});});})[_0x4aab('0x34')](function(){return _0x322046[_0x4aab('0xdc')](_0x2a18a8,_0xf13590,function(_0x28318e){if(_0x28318e){console['log'](_0x4aab('0xdd'),_0x28318e);}else{fs[_0x4aab('0xde')](_0x2a18a8);}});});});}else{return _0x322046[_0x4aab('0x1f')](0xc8);}})[_0x4aab('0xb5')](handleError(_0x322046,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index fe57a8f..c69f9cc 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 _0x814b=['then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove'];(function(_0x5647ef,_0x1c84c5){var _0x5dccfa=function(_0x1e3004){while(--_0x1e3004){_0x5647ef['push'](_0x5647ef['shift']());}};_0x5dccfa(++_0x1c84c5);}(_0x814b,0x1a2));var _0xb814=function(_0x5db313,_0x3c8f0c){_0x5db313=_0x5db313-0x0;var _0x36d503=_0x814b[_0x5db313];return _0x36d503;};'use strict';var EventEmitter=require(_0xb814('0x0'));var FaxInteraction=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var FaxMessage=require(_0xb814('0x1'))['db'][_0xb814('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb814('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb814('0x5'),'afterDestroy':_0xb814('0x6')};function emitEvent(_0x258866){return function(_0x4237bc,_0x44931c,_0x322a70){_0x4237bc['getUsers']({'attributes':['id'],'raw':!![]})[_0xb814('0x7')](function(_0x2e6272){_0x4237bc['setDataValue'](_0xb814('0x8'),_0x2e6272[_0xb814('0x9')](function(_0x186d5a){return{'id':_0x186d5a['id']};}));return FaxMessage[_0xb814('0xa')]({'where':{'FaxInteractionId':_0x4237bc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb814('0x7')](function(_0x21d4a5){_0x4237bc[_0xb814('0xb')](_0xb814('0xc'),_0x21d4a5[_0xb814('0xd')]);FaxInteractionEvents[_0xb814('0xe')](_0x258866+':'+_0x4237bc['id'],_0x4237bc);FaxInteractionEvents[_0xb814('0xe')](_0x258866,_0x4237bc);_0x322a70(null);})['catch'](_0x322a70(null));};}for(var e in events){if(events[_0xb814('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xb814('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x4f6980,_0x4c6d58){var _0x5a9a67=function(_0x2eeaaf){while(--_0x2eeaaf){_0x4f6980['push'](_0x4f6980['shift']());}};_0x5a9a67(++_0x4c6d58);}(_0x1261,0x144));var _0x1126=function(_0x584291,_0x24b5b3){_0x584291=_0x584291-0x0;var _0x4e7d08=_0x1261[_0x584291];return _0x4e7d08;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var FaxMessage=require(_0x1126('0x0'))['db'][_0x1126('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1126('0x3')](0x0);var events={'afterCreate':_0x1126('0x4'),'afterUpdate':_0x1126('0x5'),'afterDestroy':_0x1126('0x6')};function emitEvent(_0x21a480){return function(_0x75a851,_0x5a2189,_0x5c68c8){_0x75a851[_0x1126('0x7')]({'attributes':['id'],'raw':!![]})[_0x1126('0x8')](function(_0x4f239c){_0x75a851[_0x1126('0x9')](_0x1126('0xa'),_0x4f239c[_0x1126('0xb')](function(_0x3abb0b){return{'id':_0x3abb0b['id']};}));return FaxMessage[_0x1126('0xc')]({'where':{'FaxInteractionId':_0x75a851['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f09ac){_0x75a851[_0x1126('0x9')](_0x1126('0xd'),_0x3f09ac['length']);FaxInteractionEvents[_0x1126('0xe')](_0x21a480+':'+_0x75a851['id'],_0x75a851);FaxInteractionEvents['emit'](_0x21a480,_0x75a851);_0x5c68c8(null);})['catch'](_0x5c68c8(null));};}for(var e in events){if(events[_0x1126('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1126('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 074a86f..910b382 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 _0xe654=['define','FaxInteraction','fax_interactions','changed','closedAt','format','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x93b417,_0x432e25){var _0x4e8ffa=function(_0x50c55e){while(--_0x50c55e){_0x93b417['push'](_0x93b417['shift']());}};_0x4e8ffa(++_0x432e25);}(_0xe654,0x1c8));var _0x4e65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe654[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e65('0x0'));var util=require(_0x4e65('0x1'));var logger=require(_0x4e65('0x2'))('api');var moment=require(_0x4e65('0x3'));var BPromise=require('bluebird');var rp=require(_0x4e65('0x4'));var fs=require('fs');var path=require(_0x4e65('0x5'));var rimraf=require(_0x4e65('0x6'));var config=require(_0x4e65('0x7'));var attributes=require('./faxInteraction.attributes');module[_0x4e65('0x8')]=function(_0x2244ba,_0x18a99f){return _0x2244ba[_0x4e65('0x9')](_0x4e65('0xa'),attributes,{'tableName':_0x4e65('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d92bf,_0x2e30a7,_0x185fbf){if(_0x1d92bf[_0x4e65('0xc')]('closed')){_0x1d92bf[_0x4e65('0xd')]=moment()[_0x4e65('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x185fbf(null,_0x1d92bf);}}});}; \ No newline at end of file +var _0x4c15=['bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment'];(function(_0x4f13b3,_0x3cd20c){var _0x3551d4=function(_0x26fbec){while(--_0x26fbec){_0x4f13b3['push'](_0x4f13b3['shift']());}};_0x3551d4(++_0x3cd20c);}(_0x4c15,0x1be));var _0x54c1=function(_0x18371d,_0xf7d926){_0x18371d=_0x18371d-0x0;var _0x48fedb=_0x4c15[_0x18371d];return _0x48fedb;};'use strict';var _=require('lodash');var util=require(_0x54c1('0x0'));var logger=require(_0x54c1('0x1'))(_0x54c1('0x2'));var moment=require(_0x54c1('0x3'));var BPromise=require(_0x54c1('0x4'));var rp=require(_0x54c1('0x5'));var fs=require('fs');var path=require(_0x54c1('0x6'));var rimraf=require(_0x54c1('0x7'));var config=require(_0x54c1('0x8'));var attributes=require(_0x54c1('0x9'));module['exports']=function(_0x20e3b7,_0x4ed79c){return _0x20e3b7[_0x54c1('0xa')](_0x54c1('0xb'),attributes,{'tableName':_0x54c1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x38f516,_0x8061f3,_0xaca37){if(_0x38f516[_0x54c1('0xd')](_0x54c1('0xe'))){_0x38f516[_0x54c1('0xf')]=moment()[_0x54c1('0x10')](_0x54c1('0x11'));}_0xaca37(null,_0x38f516);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 671c1b9..7845b79 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 _0x228b=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','FaxInteraction','update','body','options','raw','where','limit','UpdateFaxInteraction','addTags','omit','AddTags','util','moment'];(function(_0x3bd9e8,_0x35e8d9){var _0x1f542c=function(_0x4b5480){while(--_0x4b5480){_0x3bd9e8['push'](_0x3bd9e8['shift']());}};_0x1f542c(++_0x35e8d9);}(_0x228b,0x10f));var _0xb228=function(_0x477869,_0x29ed36){_0x477869=_0x477869-0x0;var _0xaeb15a=_0x228b[_0x477869];return _0xaeb15a;};'use strict';var _=require('lodash');var util=require(_0xb228('0x0'));var moment=require(_0xb228('0x1'));var BPromise=require(_0xb228('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb228('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb228('0x4'));var logger=require(_0xb228('0x5'))(_0xb228('0x6'));var config=require(_0xb228('0x7'));var jayson=require(_0xb228('0x8'));var client=jayson['client'][_0xb228('0x9')]({'port':0x232a});config[_0xb228('0xa')]=_[_0xb228('0xb')](config['redis'],{'host':_0xb228('0xc'),'port':0x18eb});var socket=require(_0xb228('0xd'))(new Redis(config[_0xb228('0xa')]));require(_0xb228('0xe'))[_0xb228('0xf')](socket);function respondWithRpcPromise(_0x5ecd9b,_0x272b66,_0x46a356){return new BPromise(function(_0x3dff31,_0x34b5e5){return client[_0xb228('0x10')](_0x5ecd9b,_0x46a356)[_0xb228('0x11')](function(_0x37c1f2){logger[_0xb228('0x12')](_0xb228('0x13'),_0x272b66,_0xb228('0x14'));logger[_0xb228('0x15')](_0xb228('0x16'),_0x272b66,_0xb228('0x14'),JSON['stringify'](_0x37c1f2));if(_0x37c1f2['error']){if(_0x37c1f2[_0xb228('0x17')][_0xb228('0x18')]===0x1f4){logger[_0xb228('0x17')](_0xb228('0x13'),_0x272b66,_0x37c1f2[_0xb228('0x17')]['message']);return _0x34b5e5(_0x37c1f2[_0xb228('0x17')][_0xb228('0x19')]);}logger[_0xb228('0x17')](_0xb228('0x13'),_0x272b66,_0x37c1f2[_0xb228('0x17')][_0xb228('0x19')]);return _0x3dff31(_0x37c1f2[_0xb228('0x17')][_0xb228('0x19')]);}else{logger[_0xb228('0x12')](_0xb228('0x13'),_0x272b66,'request\x20sent');_0x3dff31(_0x37c1f2[_0xb228('0x1a')][_0xb228('0x19')]);}})[_0xb228('0x1b')](function(_0x68240b){logger[_0xb228('0x17')](_0xb228('0x13'),_0x272b66,_0x68240b);_0x34b5e5(_0x68240b);});});}exports['UpdateFaxInteraction']=function(_0x2ceac1){var _0x3b06a4=this;return new Promise(function(_0x3fbfaa,_0x4e44ba){return db[_0xb228('0x1c')][_0xb228('0x1d')](_0x2ceac1[_0xb228('0x1e')],{'raw':_0x2ceac1[_0xb228('0x1f')]?_0x2ceac1[_0xb228('0x1f')][_0xb228('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ceac1[_0xb228('0x1f')]?_0x2ceac1['options'][_0xb228('0x21')]||null:null,'attributes':_0x2ceac1[_0xb228('0x1f')]?_0x2ceac1['options']['attributes']||null:null,'limit':_0x2ceac1[_0xb228('0x1f')]?_0x2ceac1[_0xb228('0x1f')][_0xb228('0x22')]||null:null})[_0xb228('0x11')](function(_0x4f6000){logger[_0xb228('0x12')](_0xb228('0x23'),_0x2ceac1);logger['debug'](_0xb228('0x23'),_0x2ceac1,JSON['stringify'](_0x4f6000));_0x3fbfaa(_0x4f6000);})[_0xb228('0x1b')](function(_0x843cd){logger[_0xb228('0x17')](_0xb228('0x23'),_0x843cd[_0xb228('0x19')],_0x2ceac1);_0x4e44ba(_0x3b06a4[_0xb228('0x17')](0x1f4,_0x843cd[_0xb228('0x19')]));});});};exports['AddTagsToFaxInteraction']=function(_0x5da545){return new Promise(function(_0x3bea50,_0x1516f5){return db['FaxInteraction']['find']({'where':_0x5da545[_0xb228('0x1f')]?_0x5da545[_0xb228('0x1f')][_0xb228('0x21')]||null:null})['then'](function(_0x207580){if(_0x207580){return _0x207580[_0xb228('0x24')](_0x5da545[_0xb228('0x1e')]['ids'],_[_0xb228('0x25')](_0x5da545[_0xb228('0x1e')],['ids','id'])||{});}})['spread'](function(_0x2145eb){logger[_0xb228('0x12')](_0xb228('0x26'),_0x5da545);logger[_0xb228('0x15')](_0xb228('0x26'),_0x5da545,JSON['stringify'](_0x2145eb));_0x3bea50(_0x2145eb);})['catch'](function(_0x49729b){logger['error']('AddTags',_0x49729b[_0xb228('0x19')],_0x5da545);_0x1516f5(_this[_0xb228('0x17')](0x1f4,_0x49729b[_0xb228('0x19')]));});});}; \ No newline at end of file +var _0xc6d2=['attributes','then','stringify','find','addTags','ids','omit','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','info','FaxInteraction,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','where'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc6d2,0x131));var _0x2c6d=function(_0x19881c,_0x1d3cf1){_0x19881c=_0x19881c-0x0;var _0x2446a4=_0xc6d2[_0x19881c];return _0x2446a4;};'use strict';var _=require('lodash');var util=require(_0x2c6d('0x0'));var moment=require('moment');var BPromise=require(_0x2c6d('0x1'));var rs=require(_0x2c6d('0x2'));var fs=require('fs');var Redis=require(_0x2c6d('0x3'));var db=require(_0x2c6d('0x4'))['db'];var utils=require(_0x2c6d('0x5'));var logger=require('../../config/logger')(_0x2c6d('0x6'));var config=require('../../config/environment');var jayson=require(_0x2c6d('0x7'));var client=jayson['client'][_0x2c6d('0x8')]({'port':0x232a});config[_0x2c6d('0x9')]=_[_0x2c6d('0xa')](config[_0x2c6d('0x9')],{'host':_0x2c6d('0xb'),'port':0x18eb});var socket=require(_0x2c6d('0xc'))(new Redis(config[_0x2c6d('0x9')]));require(_0x2c6d('0xd'))['register'](socket);function respondWithRpcPromise(_0x2de8f8,_0x3fe6cf,_0x5d5794){return new BPromise(function(_0x3589e4,_0x27f9d9){return client['request'](_0x2de8f8,_0x5d5794)['then'](function(_0x3cb522){logger[_0x2c6d('0xe')](_0x2c6d('0xf'),_0x3fe6cf,'request\x20sent');logger[_0x2c6d('0x10')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x3fe6cf,'request\x20sent',JSON['stringify'](_0x3cb522));if(_0x3cb522[_0x2c6d('0x11')]){if(_0x3cb522[_0x2c6d('0x11')][_0x2c6d('0x12')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x3fe6cf,_0x3cb522[_0x2c6d('0x11')][_0x2c6d('0x13')]);return _0x27f9d9(_0x3cb522['error']['message']);}logger[_0x2c6d('0x11')](_0x2c6d('0xf'),_0x3fe6cf,_0x3cb522[_0x2c6d('0x11')]['message']);return _0x3589e4(_0x3cb522[_0x2c6d('0x11')][_0x2c6d('0x13')]);}else{logger[_0x2c6d('0xe')]('FaxInteraction,\x20%s,\x20%s',_0x3fe6cf,_0x2c6d('0x14'));_0x3589e4(_0x3cb522[_0x2c6d('0x15')][_0x2c6d('0x13')]);}})[_0x2c6d('0x16')](function(_0x2f0f9e){logger[_0x2c6d('0x11')](_0x2c6d('0xf'),_0x3fe6cf,_0x2f0f9e);_0x27f9d9(_0x2f0f9e);});});}exports[_0x2c6d('0x17')]=function(_0x1021ad){var _0x4eac96=this;return new Promise(function(_0x103997,_0x170115){return db[_0x2c6d('0x18')]['update'](_0x1021ad[_0x2c6d('0x19')],{'raw':_0x1021ad[_0x2c6d('0x1a')]?_0x1021ad['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1021ad[_0x2c6d('0x1a')]?_0x1021ad[_0x2c6d('0x1a')][_0x2c6d('0x1b')]||null:null,'attributes':_0x1021ad[_0x2c6d('0x1a')]?_0x1021ad['options'][_0x2c6d('0x1c')]||null:null,'limit':_0x1021ad['options']?_0x1021ad[_0x2c6d('0x1a')]['limit']||null:null})[_0x2c6d('0x1d')](function(_0xc146dd){logger['info'](_0x2c6d('0x17'),_0x1021ad);logger[_0x2c6d('0x10')]('UpdateFaxInteraction',_0x1021ad,JSON[_0x2c6d('0x1e')](_0xc146dd));_0x103997(_0xc146dd);})[_0x2c6d('0x16')](function(_0x4a5154){logger[_0x2c6d('0x11')](_0x2c6d('0x17'),_0x4a5154['message'],_0x1021ad);_0x170115(_0x4eac96[_0x2c6d('0x11')](0x1f4,_0x4a5154['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x3f29e3){return new Promise(function(_0x24638e,_0x1feae7){return db[_0x2c6d('0x18')][_0x2c6d('0x1f')]({'where':_0x3f29e3[_0x2c6d('0x1a')]?_0x3f29e3[_0x2c6d('0x1a')][_0x2c6d('0x1b')]||null:null})['then'](function(_0x419e7e){if(_0x419e7e){return _0x419e7e[_0x2c6d('0x20')](_0x3f29e3[_0x2c6d('0x19')][_0x2c6d('0x21')],_[_0x2c6d('0x22')](_0x3f29e3['body'],[_0x2c6d('0x21'),'id'])||{});}})[_0x2c6d('0x23')](function(_0x22e018){logger['info']('AddTags',_0x3f29e3);logger[_0x2c6d('0x10')](_0x2c6d('0x24'),_0x3f29e3,JSON[_0x2c6d('0x1e')](_0x22e018));_0x24638e(_0x22e018);})[_0x2c6d('0x16')](function(_0x17ae74){logger[_0x2c6d('0x11')]('AddTags',_0x17ae74['message'],_0x3f29e3);_0x1feae7(_this[_0x2c6d('0x11')](0x1f4,_0x17ae74['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index e2956da..2b31f10 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 _0xe4d4=['emit','removeListener','length','./faxInteraction.events','save','remove','update'];(function(_0x526609,_0x53e5c8){var _0x2b7ded=function(_0x26063f){while(--_0x26063f){_0x526609['push'](_0x526609['shift']());}};_0x2b7ded(++_0x53e5c8);}(_0xe4d4,0x1b5));var _0x4e4d=function(_0x27e880,_0x2b98e9){_0x27e880=_0x27e880-0x0;var _0x15f563=_0xe4d4[_0x27e880];return _0x15f563;};'use strict';var FaxInteractionEvents=require(_0x4e4d('0x0'));var events=[_0x4e4d('0x1'),_0x4e4d('0x2'),_0x4e4d('0x3')];function createListener(_0x4f64ab,_0xeb1df7){return function(_0x1e6718){_0xeb1df7[_0x4e4d('0x4')](_0x4f64ab,_0x1e6718);};}function removeListener(_0x1d73cd,_0x526641){return function(){FaxInteractionEvents[_0x4e4d('0x5')](_0x1d73cd,_0x526641);};}exports['register']=function(_0x52d3b9){for(var _0x5abede=0x0,_0xa91c09=events[_0x4e4d('0x6')];_0x5abede<_0xa91c09;_0x5abede++){var _0x6d250e=events[_0x5abede];var _0x1a102b=createListener('faxInteraction:'+_0x6d250e,_0x52d3b9);FaxInteractionEvents['on'](_0x6d250e,_0x1a102b);}}; \ No newline at end of file +var _0x0957=['faxInteraction:','remove','emit','removeListener','register'];(function(_0x2797c6,_0x37421b){var _0x54809f=function(_0x2d100c){while(--_0x2d100c){_0x2797c6['push'](_0x2797c6['shift']());}};_0x54809f(++_0x37421b);}(_0x0957,0xba));var _0x7095=function(_0x5092fa,_0x5ede37){_0x5092fa=_0x5092fa-0x0;var _0x5f4ee7=_0x0957[_0x5092fa];return _0x5f4ee7;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0x7095('0x0'),'update'];function createListener(_0xf9d6f6,_0x1812d5){return function(_0x191601){_0x1812d5[_0x7095('0x1')](_0xf9d6f6,_0x191601);};}function removeListener(_0x2d32d8,_0x23161a){return function(){FaxInteractionEvents[_0x7095('0x2')](_0x2d32d8,_0x23161a);};}exports[_0x7095('0x3')]=function(_0x3a54cd){for(var _0x54fce8=0x0,_0x275176=events['length'];_0x54fce8<_0x275176;_0x54fce8++){var _0x26d3e9=events[_0x54fce8];var _0x3f4909=createListener(_0x7095('0x4')+_0x26d3e9,_0x3a54cd);FaxInteractionEvents['on'](_0x26d3e9,_0x3f4909);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 9dfecaa..18c8d5a 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 _0xcb91=['update','delete','fax','removeTags','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update'];(function(_0x95e7b9,_0x2b4eed){var _0x1dd6fa=function(_0x3db99e){while(--_0x3db99e){_0x95e7b9['push'](_0x95e7b9['shift']());}};_0x1dd6fa(++_0x2b4eed);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0xcb91[_0x22e9fe];return _0x47cd19;};'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('./faxInteraction.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/:id',auth[_0x1cb9('0x7')](),controller['show']);router['get'](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0x6')](_0x1cb9('0xc'),auth['isAuthenticated'](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')]('/',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0xe')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x1cb9('0xe')](_0x1cb9('0x10'),auth[_0x1cb9('0x7')](),interaction[_0x1cb9('0x11')]('fax',_0x1cb9('0x12')),controller[_0x1cb9('0x13')]);router[_0x1cb9('0x14')](_0x1cb9('0x15'),auth[_0x1cb9('0x7')](),interaction['tracked']('fax',_0x1cb9('0x16')),controller[_0x1cb9('0x17')]);router[_0x1cb9('0x18')](_0x1cb9('0x15'),auth[_0x1cb9('0x7')](),interaction[_0x1cb9('0x11')](_0x1cb9('0x19'),'faxinteraction:destroy'),controller['destroy']);router[_0x1cb9('0x18')](_0x1cb9('0x10'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0x1a')]);module[_0x1cb9('0x1b')]=router; \ No newline at end of file +var _0xa9e0=['exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','/:id','/:id/messages','getMessages','/:id/download','create','post','addMessage','tracked','fax','faxinteraction:addtags','addTags','put','update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags'];(function(_0x558b83,_0x10fb5e){var _0x23d2fe=function(_0x43551d){while(--_0x43551d){_0x558b83['push'](_0x558b83['shift']());}};_0x23d2fe(++_0x10fb5e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')]('/:id/tags',auth[_0x0a9e('0x8')](),interaction[_0x0a9e('0x11')](_0x0a9e('0x12'),_0x0a9e('0x13')),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),interaction['tracked'](_0x0a9e('0x12'),'faxinteraction:update'),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x17')]('/:id',auth[_0x0a9e('0x8')](),interaction['tracked'](_0x0a9e('0x12'),_0x0a9e('0x18')),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x17')](_0x0a9e('0x1a'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1b')]);module[_0x0a9e('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 150c33c..94fd352 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 _0xf24b=['medium','BOOLEAN','ENUM','out','sequelize','exports','TEXT'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf24b,0xd6));var _0xbf24=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf24b[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xbf24('0x0'));module[_0xbf24('0x1')]={'body':{'type':Sequelize[_0xbf24('0x2')](_0xbf24('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xbf24('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbf24('0x5')]('in',_0xbf24('0x6')),'defaultValue':_0xbf24('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xbf24('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x2fae=['exports','BOOLEAN','out','TEXT','DATE','sequelize'];(function(_0x346353,_0x4c89ad){var _0x140c77=function(_0x4aa42b){while(--_0x4aa42b){_0x346353['push'](_0x346353['shift']());}};_0x140c77(++_0x4c89ad);}(_0x2fae,0x1a9));var _0xe2fa=function(_0x3f5ce4,_0x38248d){_0x3f5ce4=_0x3f5ce4-0x0;var _0x255a75=_0x2fae[_0x3f5ce4];return _0x255a75;};'use strict';var Sequelize=require(_0xe2fa('0x0'));module[_0xe2fa('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe2fa('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe2fa('0x3')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xe2fa('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0xe2fa('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index d4b18f3..53ac4bc 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 _0xa571=['join','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','destroy','end','stack','name','index','map','FaxMessage','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','filter','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','body','describe','fax-interactions','accept','read','readAt','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','role','stringify','null','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','create','CmContact','findOne','ContactId','Attachment','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download'];(function(_0x5bbf6a,_0x29460a){var _0x5d051a=function(_0x2c76a7){while(--_0x2c76a7){_0x5bbf6a['push'](_0x5bbf6a['shift']());}};_0x5d051a(++_0x29460a);}(_0xa571,0x107));var _0x1a57=function(_0x3f088e,_0x422e52){_0x3f088e=_0x3f088e-0x0;var _0x443c86=_0xa571[_0x3f088e];return _0x443c86;};'use strict';var pdf=require(_0x1a57('0x0'));var emlformat=require(_0x1a57('0x1'));var rimraf=require(_0x1a57('0x2'));var zipdir=require(_0x1a57('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a57('0x4'));var moment=require(_0x1a57('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1a57('0x6'));var path=require('path');var sox=require(_0x1a57('0x7'));var csv=require(_0x1a57('0x8'));var ejs=require(_0x1a57('0x9'));var fs=require('fs');var _=require(_0x1a57('0xa'));var squel=require(_0x1a57('0xb'));var crypto=require(_0x1a57('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1a57('0xd'));var toCsv=require(_0x1a57('0x8'));var querystring=require(_0x1a57('0xe'));var Papa=require('papaparse');var Redis=require(_0x1a57('0xf'));var authService=require(_0x1a57('0x10'));var qs=require(_0x1a57('0x11'));var as=require(_0x1a57('0x12'));var hardwareService=require(_0x1a57('0x13'));var logger=require(_0x1a57('0x14'))(_0x1a57('0x15'));var utils=require(_0x1a57('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a57('0x17'))['db'];config[_0x1a57('0x18')]=_[_0x1a57('0x19')](config['redis'],{'host':_0x1a57('0x1a'),'port':0x18eb});var socket=require(_0x1a57('0x1b'))(new Redis(config['redis']));require(_0x1a57('0x1c'))['register'](socket);var jayson=require(_0x1a57('0x1d'));var client=jayson[_0x1a57('0x1e')][_0x1a57('0x1f')]({'port':0x232c});var client9002=jayson[_0x1a57('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20f7ad,_0x53c61f,_0x49ee05,_0x1b58d7){return new BPromise(function(_0x1c537f,_0x22f400){var _0x51b4c2=_0x1b58d7||client;return _0x51b4c2[_0x1a57('0x20')](_0x20f7ad,_0x49ee05)[_0x1a57('0x21')](function(_0x80f8c1){logger['info'](_0x1a57('0x22'),_0x53c61f,_0x1a57('0x23'));logger[_0x1a57('0x24')](_0x1a57('0x25'),_0x53c61f,_0x1a57('0x23'),JSON['stringify'](_0x80f8c1));if(_0x80f8c1['error']){if(_0x80f8c1[_0x1a57('0x26')][_0x1a57('0x27')]===0x1f4){logger[_0x1a57('0x26')]('FaxMessage,\x20%s,\x20%s',_0x53c61f,_0x80f8c1['error']['message']);return _0x22f400(_0x80f8c1[_0x1a57('0x26')][_0x1a57('0x28')]);}logger[_0x1a57('0x26')](_0x1a57('0x22'),_0x53c61f,_0x80f8c1[_0x1a57('0x26')][_0x1a57('0x28')]);return _0x1c537f(_0x80f8c1[_0x1a57('0x26')][_0x1a57('0x28')]);}else{logger[_0x1a57('0x29')](_0x1a57('0x22'),_0x53c61f,_0x1a57('0x23'));_0x1c537f(_0x80f8c1[_0x1a57('0x2a')][_0x1a57('0x28')]);}})[_0x1a57('0x2b')](function(_0x2f9454){logger[_0x1a57('0x26')](_0x1a57('0x22'),_0x53c61f,_0x2f9454);_0x22f400(_0x2f9454);});});}function respondWithStatusCode(_0x267302,_0x27cfe1){_0x27cfe1=_0x27cfe1||0xcc;return function(_0xf6ffef){if(_0xf6ffef){return _0x267302[_0x1a57('0x2c')](_0x27cfe1);}return _0x267302[_0x1a57('0x2d')](_0x27cfe1)['end']();};}function respondWithResult(_0x530401,_0x139d8c){_0x139d8c=_0x139d8c||0xc8;return function(_0x22549f){if(_0x22549f){return _0x530401['status'](_0x139d8c)[_0x1a57('0x2e')](_0x22549f);}};}function respondWithFilteredResult(_0x54f6a5,_0x2d8738){return function(_0x4a2901){if(_0x4a2901){var _0x53bf6e=_0x4a2901[_0x1a57('0x2f')],_0x8179a4=_0x2d8738['offset'],_0x274fe6=_0x2d8738[_0x1a57('0x30')]+_0x2d8738[_0x1a57('0x31')],_0x30527c;if(_0x274fe6>=_0x53bf6e){_0x274fe6=_0x53bf6e;_0x30527c=0xc8;}else{_0x30527c=0xce;}_0x54f6a5[_0x1a57('0x2d')](_0x30527c);return _0x54f6a5[_0x1a57('0x32')]('Content-Range',_0x8179a4+'-'+_0x274fe6+'/'+_0x53bf6e)[_0x1a57('0x2e')](_0x4a2901);}return null;};}function patchUpdates(_0x251a54){return function(_0x139fc9){try{jsonpatch[_0x1a57('0x33')](_0x139fc9,_0x251a54,!![]);}catch(_0x3ac6ff){return BPromise[_0x1a57('0x34')](_0x3ac6ff);}return _0x139fc9[_0x1a57('0x35')]();};}function saveUpdates(_0x1e7f0d,_0x154cba){return function(_0x4c1acc){if(_0x4c1acc){return _0x4c1acc[_0x1a57('0x36')](_0x1e7f0d)[_0x1a57('0x21')](function(_0x497488){return _0x497488;});}return null;};}function removeEntity(_0x4f9368,_0x17b12e){return function(_0x136842){if(_0x136842){return _0x136842[_0x1a57('0x37')]()[_0x1a57('0x21')](function(){_0x4f9368[_0x1a57('0x2d')](0xcc)[_0x1a57('0x38')]();});}};}function handleEntityNotFound(_0xe80d94,_0x41e466){return function(_0x3f14ca){if(!_0x3f14ca){_0xe80d94[_0x1a57('0x2c')](0x194);}return _0x3f14ca;};}function handleError(_0x4091b6,_0x24025c){_0x24025c=_0x24025c||0x1f4;return function(_0x12f3a7){logger[_0x1a57('0x26')](_0x12f3a7[_0x1a57('0x39')]);if(_0x12f3a7[_0x1a57('0x3a')]){delete _0x12f3a7[_0x1a57('0x3a')];}_0x4091b6[_0x1a57('0x2d')](_0x24025c)['send'](_0x12f3a7);};}exports[_0x1a57('0x3b')]=function(_0x173671,_0x137920){var _0x3dad7c={},_0x58b7dc={},_0xf64cb5={'count':0x0,'rows':[]};var _0x939976=_[_0x1a57('0x3c')](db[_0x1a57('0x3d')]['rawAttributes'],function(_0x4c37af){return{'name':_0x4c37af['fieldName'],'type':_0x4c37af['type'][_0x1a57('0x3e')]};});_0x58b7dc[_0x1a57('0x3f')]=_[_0x1a57('0x3c')](_0x939976,'name');_0x58b7dc[_0x1a57('0x40')]=_[_0x1a57('0x41')](_0x173671[_0x1a57('0x40')]);_0x58b7dc[_0x1a57('0x42')]=_['intersection'](_0x58b7dc[_0x1a57('0x3f')],_0x58b7dc['query']);_0x3dad7c[_0x1a57('0x43')]=_[_0x1a57('0x44')](_0x58b7dc[_0x1a57('0x3f')],qs['fields'](_0x173671[_0x1a57('0x40')][_0x1a57('0x45')]));_0x3dad7c[_0x1a57('0x43')]=_0x3dad7c[_0x1a57('0x43')][_0x1a57('0x46')]?_0x3dad7c['attributes']:_0x58b7dc[_0x1a57('0x3f')];if(!_0x173671['query']['hasOwnProperty'](_0x1a57('0x47'))){_0x3dad7c['limit']=qs[_0x1a57('0x31')](_0x173671[_0x1a57('0x40')][_0x1a57('0x31')]);_0x3dad7c['offset']=qs[_0x1a57('0x30')](_0x173671[_0x1a57('0x40')][_0x1a57('0x30')]);}_0x3dad7c[_0x1a57('0x48')]=qs['sort'](_0x173671[_0x1a57('0x40')][_0x1a57('0x49')]);_0x3dad7c['where']=qs[_0x1a57('0x42')](_['pick'](_0x173671['query'],_0x58b7dc[_0x1a57('0x42')]),_0x939976);if(_0x173671[_0x1a57('0x40')][_0x1a57('0x4a')]){_0x3dad7c[_0x1a57('0x4b')]=_['merge'](_0x3dad7c[_0x1a57('0x4b')],{'$or':_[_0x1a57('0x3c')](_0x939976,function(_0x20517c){if(_0x20517c[_0x1a57('0x4c')]!==_0x1a57('0x4d')){var _0x498b30={};_0x498b30[_0x20517c[_0x1a57('0x3a')]]={'$like':'%'+_0x173671[_0x1a57('0x40')][_0x1a57('0x4a')]+'%'};return _0x498b30;}})});}_0x3dad7c=_[_0x1a57('0x4e')]({},_0x3dad7c,_0x173671['options']);var _0x1f1abd={'where':_0x3dad7c['where']};return db[_0x1a57('0x3d')][_0x1a57('0x2f')](_0x1f1abd)[_0x1a57('0x21')](function(_0xbdb0e0){_0xf64cb5[_0x1a57('0x2f')]=_0xbdb0e0;if(_0x173671[_0x1a57('0x40')][_0x1a57('0x4f')]){_0x3dad7c[_0x1a57('0x50')]=[{'all':!![]}];}return db[_0x1a57('0x3d')][_0x1a57('0x51')](_0x3dad7c);})[_0x1a57('0x21')](function(_0x136335){_0xf64cb5[_0x1a57('0x52')]=_0x136335;return _0xf64cb5;})['then'](respondWithFilteredResult(_0x137920,_0x3dad7c))[_0x1a57('0x2b')](handleError(_0x137920,null));};exports[_0x1a57('0x53')]=function(_0x3bf103,_0x3b3f1f){var _0x38b334={'raw':!![],'where':{'id':_0x3bf103[_0x1a57('0x54')]['id']}},_0x28ebdd={};_0x28ebdd[_0x1a57('0x3f')]=_[_0x1a57('0x41')](db[_0x1a57('0x3d')][_0x1a57('0x55')]);_0x28ebdd['query']=_[_0x1a57('0x41')](_0x3bf103[_0x1a57('0x40')]);_0x28ebdd['filters']=_[_0x1a57('0x44')](_0x28ebdd[_0x1a57('0x3f')],_0x28ebdd['query']);_0x38b334[_0x1a57('0x43')]=_[_0x1a57('0x44')](_0x28ebdd['model'],qs['fields'](_0x3bf103['query'][_0x1a57('0x45')]));_0x38b334[_0x1a57('0x43')]=_0x38b334['attributes'][_0x1a57('0x46')]?_0x38b334[_0x1a57('0x43')]:_0x28ebdd['model'];if(_0x3bf103['query']['includeAll']){_0x38b334[_0x1a57('0x50')]=[{'all':!![]}];}_0x38b334=_[_0x1a57('0x4e')]({},_0x38b334,_0x3bf103[_0x1a57('0x56')]);return db[_0x1a57('0x3d')][_0x1a57('0x57')](_0x38b334)[_0x1a57('0x21')](handleEntityNotFound(_0x3b3f1f,null))[_0x1a57('0x21')](respondWithResult(_0x3b3f1f,null))[_0x1a57('0x2b')](handleError(_0x3b3f1f,null));};exports['update']=function(_0x5473cb,_0x48308b){if(_0x5473cb['body']['id']){delete _0x5473cb['body']['id'];}return db[_0x1a57('0x3d')][_0x1a57('0x57')]({'where':{'id':_0x5473cb[_0x1a57('0x54')]['id']}})[_0x1a57('0x21')](handleEntityNotFound(_0x48308b,null))[_0x1a57('0x21')](saveUpdates(_0x5473cb[_0x1a57('0x58')],null))[_0x1a57('0x21')](respondWithResult(_0x48308b,null))[_0x1a57('0x2b')](handleError(_0x48308b,null));};exports['destroy']=function(_0x48cc13,_0x515b81){return db[_0x1a57('0x3d')]['find']({'where':{'id':_0x48cc13[_0x1a57('0x54')]['id']}})[_0x1a57('0x21')](handleEntityNotFound(_0x515b81,null))[_0x1a57('0x21')](removeEntity(_0x515b81,null))[_0x1a57('0x2b')](handleError(_0x515b81,null));};exports[_0x1a57('0x59')]=function(_0x369c57,_0x5a80be){return db['FaxMessage']['describe']()['then'](respondWithResult(_0x5a80be,null))[_0x1a57('0x2b')](handleError(_0x5a80be,null));};var interaction_log=require(_0x1a57('0x14'))(_0x1a57('0x5a'));exports[_0x1a57('0x5b')]=function(_0x2db770,_0xdade74,_0x2ca029){var _0x4ab246={'agent':{},'channel':'fax'};if(_0x2db770[_0x1a57('0x58')]['id']){delete _0x2db770[_0x1a57('0x58')]['id'];}_0x2db770[_0x1a57('0x58')][_0x1a57('0x5c')]=!![];_0x2db770[_0x1a57('0x58')][_0x1a57('0x5d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2db770[_0x1a57('0x58')][_0x1a57('0x5e')]=_0x2db770['body']['UserId']||_0x2db770[_0x1a57('0x5f')]['id'];_0x4ab246[_0x1a57('0x60')]['id']=_0x2db770[_0x1a57('0x58')][_0x1a57('0x5e')];return db[_0x1a57('0x3d')][_0x1a57('0x57')]({'where':{'id':_0x2db770[_0x1a57('0x54')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x1a57('0x21')](handleEntityNotFound(_0xdade74,null))[_0x1a57('0x21')](saveUpdates(_0x2db770[_0x1a57('0x58')],null))[_0x1a57('0x21')](function(_0x5d92dc){if(_0x5d92dc){_0x4ab246[_0x1a57('0x28')]=_0x5d92dc[_0x1a57('0x61')]({'plain':!![]});return db[_0x1a57('0x62')][_0x1a57('0x57')]({'where':{'id':_0x5d92dc[_0x1a57('0x63')]}});}return null;})['then'](handleEntityNotFound(_0xdade74,null))['then'](function(_0x59d0b0){if(_0x59d0b0){return _0x59d0b0[_0x1a57('0x36')]({'UserId':_0x2db770[_0x1a57('0x58')][_0x1a57('0x5e')],'read1stAt':_[_0x1a57('0x64')](_0x59d0b0[_0x1a57('0x65')])?moment()[_0x1a57('0x66')](_0x1a57('0x67')):undefined});}return null;})[_0x1a57('0x21')](function(_0x482508){if(_0x482508){_0x4ab246[_0x1a57('0x68')]=_0x482508[_0x1a57('0x61')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2db770[_0x1a57('0x5f')]['id'],_0x2db770['user'][_0x1a57('0x3a')],_0x2db770[_0x1a57('0x5f')][_0x1a57('0x69')],_0x4ab246[_0x1a57('0x68')]['id'],_0x2db770[_0x1a57('0x58')]?JSON[_0x1a57('0x6a')](_0x2db770[_0x1a57('0x58')]):_0x1a57('0x6b'));return respondWithRpcPromise('AcceptMessage',_0x1a57('0x6c'),_0x4ab246);}return null;})[_0x1a57('0x21')](function(_0x5e5b2f){if(_0x5e5b2f){if(_0x2db770[_0x1a57('0x58')][_0x1a57('0x6d')]){_0x4ab246[_0x1a57('0x28')]['interface']=util['format'](_0x1a57('0x6e'),_0x2db770[_0x1a57('0x5f')][_0x1a57('0x3a')]);_0x4ab246[_0x1a57('0x28')]['channel']=_0x4ab246[_0x1a57('0x6f')];_0x4ab246[_0x1a57('0x28')][_0x1a57('0x70')]=_0x1a57('0x5b');return respondWithRpcPromise(_0x1a57('0x71'),'EventManager',{'event':_0x1a57('0x72'),'message':_0x4ab246[_0x1a57('0x28')]},client9002)[_0x1a57('0x21')](function(){return _0x4ab246;});}return _0x4ab246;}return null;})[_0x1a57('0x21')](respondWithResult(_0xdade74,null))[_0x1a57('0x2b')](handleError(_0xdade74,null));};var interaction_log=require(_0x1a57('0x14'))(_0x1a57('0x5a'));exports[_0x1a57('0x34')]=function(_0x3cb5ca,_0x11b17c,_0x43a402){var _0x48a10e={'agent':{},'channel':_0x1a57('0x73')};if(_0x3cb5ca[_0x1a57('0x58')]['id']){delete _0x3cb5ca['body']['id'];}_0x3cb5ca[_0x1a57('0x58')][_0x1a57('0x5e')]=_0x3cb5ca['body'][_0x1a57('0x5e')]||_0x3cb5ca[_0x1a57('0x5f')]['id'];_0x48a10e[_0x1a57('0x60')]['id']=_0x3cb5ca[_0x1a57('0x58')][_0x1a57('0x5e')];return db[_0x1a57('0x3d')][_0x1a57('0x57')]({'where':{'id':_0x3cb5ca[_0x1a57('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x11b17c,null))[_0x1a57('0x21')](function(_0x598a8d){if(_0x598a8d){_0x48a10e['message']=_0x598a8d[_0x1a57('0x61')]({'plain':!![]});return db[_0x1a57('0x62')][_0x1a57('0x57')]({'where':{'id':_0x598a8d[_0x1a57('0x63')]}});}return null;})[_0x1a57('0x21')](handleEntityNotFound(_0x11b17c,null))[_0x1a57('0x21')](function(_0x220725){if(_0x220725){_0x48a10e[_0x1a57('0x68')]=_0x220725[_0x1a57('0x61')]({'plain':!![]});interaction_log['info'](_0x1a57('0x74'),_0x3cb5ca[_0x1a57('0x5f')]['id'],_0x3cb5ca[_0x1a57('0x5f')][_0x1a57('0x3a')],_0x3cb5ca[_0x1a57('0x5f')]['role'],_0x48a10e[_0x1a57('0x68')]['id'],_0x3cb5ca[_0x1a57('0x58')]?JSON[_0x1a57('0x6a')](_0x3cb5ca[_0x1a57('0x58')]):_0x1a57('0x6b'));return respondWithRpcPromise(_0x1a57('0x75'),_0x1a57('0x76'),_0x48a10e);}return null;})[_0x1a57('0x21')](function(_0x51ccba){if(_0x51ccba){_0x51ccba[_0x1a57('0x28')][_0x1a57('0x77')]=util[_0x1a57('0x66')](_0x1a57('0x6e'),_0x3cb5ca['user']['name']);_0x51ccba['message']['channel']=_0x48a10e['channel'];_0x51ccba[_0x1a57('0x28')][_0x1a57('0x70')]='reject';respondWithRpcPromise(_0x1a57('0x71'),_0x1a57('0x71'),{'event':'rejectmessage','message':_0x51ccba[_0x1a57('0x28')]},client9002);return _0x48a10e;}return null;})[_0x1a57('0x21')](respondWithResult(_0x11b17c,null))[_0x1a57('0x2b')](handleError(_0x11b17c,null));};exports[_0x1a57('0x78')]=function(_0x56ddf7,_0x444d60){var _0x1064a9;return db['FaxMessage'][_0x1a57('0x78')](_0x56ddf7[_0x1a57('0x58')],{})[_0x1a57('0x21')](function(_0x2e3280){_0x1064a9=_0x2e3280;return db[_0x1a57('0x79')][_0x1a57('0x7a')]({'where':{'id':_0x1064a9[_0x1a57('0x7b')]}});})['then'](function(_0x243e53){if(_['isNil'](_0x243e53)){return;}else{_0x1064a9[_0x1a57('0x73')]=_0x243e53[_0x1a57('0x73')];return db[_0x1a57('0x7c')][_0x1a57('0x7a')]({'where':{'id':_0x1064a9['AttachmentId']}});}})[_0x1a57('0x21')](function(_0x2d918f){return respondWithRpcPromise(_0x1a57('0x7d'),'SendFax',{'FaxAccountId':_[_0x1a57('0x64')](_0x56ddf7[_0x1a57('0x58')])?undefined:_0x56ddf7[_0x1a57('0x58')]['FaxAccountId'],'path':_[_0x1a57('0x64')](_0x2d918f)?undefined:util[_0x1a57('0x66')](_0x1a57('0x7e'),_0x2d918f[_0x1a57('0x7f')]),'fax':_[_0x1a57('0x64')](_0x1064a9[_0x1a57('0x73')])?undefined:_0x1064a9[_0x1a57('0x73')],'AttachmentId':_0x1064a9[_0x1a57('0x80')]},client9002);})[_0x1a57('0x21')](respondWithResult(_0x444d60,0xc9))[_0x1a57('0x2b')](handleError(_0x444d60,null));};exports[_0x1a57('0x81')]=function(_0x5de7b1,_0x1b0580){var _0x563182=path[_0x1a57('0x82')](config['root'],'server','files','attachments');return db[_0x1a57('0x3d')][_0x1a57('0x57')]({'where':{'id':_0x5de7b1[_0x1a57('0x54')]['id']},'include':[{'model':db['Attachment'],'as':_0x1a57('0x7c')}]})['then'](handleEntityNotFound(_0x1b0580,null))[_0x1a57('0x21')](function(_0x158f8b){if(_0x158f8b){return _0x1b0580[_0x1a57('0x81')](path[_0x1a57('0x82')](_0x563182,_0x158f8b[_0x1a57('0x7c')][_0x1a57('0x7f')]));}})['catch'](handleError(_0x1b0580,null));}; \ No newline at end of file +var _0xb78e=['describe','fax-interactions','accept','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','CmContact','Contact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','create','findOne','ContactId','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','join','root','server','files','attachments','download','basename','html-pdf','eml-format','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/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','status','end','json','count','set','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','send','FaxMessage','rawAttributes','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','limit','offset','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','update','body','catch'];(function(_0x57fdec,_0x3eb286){var _0x3108a1=function(_0x4d58e5){while(--_0x4d58e5){_0x57fdec['push'](_0x57fdec['shift']());}};_0x3108a1(++_0x3eb286);}(_0xb78e,0x1c9));var _0xeb78=function(_0x1dcdc7,_0x2b8876){_0x1dcdc7=_0x1dcdc7-0x0;var _0x4b3239=_0xb78e[_0x1dcdc7];return _0x4b3239;};'use strict';var pdf=require(_0xeb78('0x0'));var emlformat=require(_0xeb78('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xeb78('0x2'));var jsonpatch=require(_0xeb78('0x3'));var rp=require(_0xeb78('0x4'));var moment=require(_0xeb78('0x5'));var BPromise=require(_0xeb78('0x6'));var Mustache=require(_0xeb78('0x7'));var util=require(_0xeb78('0x8'));var path=require(_0xeb78('0x9'));var sox=require('sox');var csv=require(_0xeb78('0xa'));var ejs=require(_0xeb78('0xb'));var fs=require('fs');var _=require(_0xeb78('0xc'));var squel=require(_0xeb78('0xd'));var crypto=require(_0xeb78('0xe'));var jsforce=require(_0xeb78('0xf'));var deskjs=require(_0xeb78('0x10'));var toCsv=require('to-csv');var querystring=require(_0xeb78('0x11'));var Papa=require(_0xeb78('0x12'));var Redis=require(_0xeb78('0x13'));var authService=require(_0xeb78('0x14'));var qs=require(_0xeb78('0x15'));var as=require(_0xeb78('0x16'));var hardwareService=require(_0xeb78('0x17'));var logger=require(_0xeb78('0x18'))(_0xeb78('0x19'));var utils=require('../../config/utils');var config=require(_0xeb78('0x1a'));var licenseUtil=require(_0xeb78('0x1b'));var db=require(_0xeb78('0x1c'))['db'];config[_0xeb78('0x1d')]=_[_0xeb78('0x1e')](config[_0xeb78('0x1d')],{'host':_0xeb78('0x1f'),'port':0x18eb});var socket=require(_0xeb78('0x20'))(new Redis(config[_0xeb78('0x1d')]));require(_0xeb78('0x21'))['register'](socket);var jayson=require(_0xeb78('0x22'));var client=jayson[_0xeb78('0x23')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x23a0d0,_0x50ebae,_0xa28d5e,_0x247cb1){return new BPromise(function(_0x49123d,_0x39d987){var _0x53c811=_0x247cb1||client;return _0x53c811[_0xeb78('0x24')](_0x23a0d0,_0xa28d5e)[_0xeb78('0x25')](function(_0x576802){logger[_0xeb78('0x26')](_0xeb78('0x27'),_0x50ebae,_0xeb78('0x28'));logger['debug'](_0xeb78('0x29'),_0x50ebae,_0xeb78('0x28'),JSON['stringify'](_0x576802));if(_0x576802['error']){if(_0x576802[_0xeb78('0x2a')][_0xeb78('0x2b')]===0x1f4){logger[_0xeb78('0x2a')](_0xeb78('0x27'),_0x50ebae,_0x576802[_0xeb78('0x2a')][_0xeb78('0x2c')]);return _0x39d987(_0x576802[_0xeb78('0x2a')][_0xeb78('0x2c')]);}logger[_0xeb78('0x2a')]('FaxMessage,\x20%s,\x20%s',_0x50ebae,_0x576802['error']['message']);return _0x49123d(_0x576802['error'][_0xeb78('0x2c')]);}else{logger['info'](_0xeb78('0x27'),_0x50ebae,_0xeb78('0x28'));_0x49123d(_0x576802['result'][_0xeb78('0x2c')]);}})['catch'](function(_0x9a00b){logger[_0xeb78('0x2a')](_0xeb78('0x27'),_0x50ebae,_0x9a00b);_0x39d987(_0x9a00b);});});}function respondWithStatusCode(_0x12b3b2,_0x4bcdcf){_0x4bcdcf=_0x4bcdcf||0xcc;return function(_0x108052){if(_0x108052){return _0x12b3b2['sendStatus'](_0x4bcdcf);}return _0x12b3b2[_0xeb78('0x2d')](_0x4bcdcf)[_0xeb78('0x2e')]();};}function respondWithResult(_0x4493bb,_0x5263fc){_0x5263fc=_0x5263fc||0xc8;return function(_0x1028ba){if(_0x1028ba){return _0x4493bb[_0xeb78('0x2d')](_0x5263fc)[_0xeb78('0x2f')](_0x1028ba);}};}function respondWithFilteredResult(_0x381b2f,_0x3d4a97){return function(_0x3516b8){if(_0x3516b8){var _0x1131a9=_0x3516b8[_0xeb78('0x30')],_0x22c25f=_0x3d4a97['offset'],_0x29d6cf=_0x3d4a97['offset']+_0x3d4a97['limit'],_0x19ad00;if(_0x29d6cf>=_0x1131a9){_0x29d6cf=_0x1131a9;_0x19ad00=0xc8;}else{_0x19ad00=0xce;}_0x381b2f[_0xeb78('0x2d')](_0x19ad00);return _0x381b2f[_0xeb78('0x31')](_0xeb78('0x32'),_0x22c25f+'-'+_0x29d6cf+'/'+_0x1131a9)['json'](_0x3516b8);}return null;};}function patchUpdates(_0x3cea77){return function(_0x1ecdfb){try{jsonpatch[_0xeb78('0x33')](_0x1ecdfb,_0x3cea77,!![]);}catch(_0x83b35d){return BPromise[_0xeb78('0x34')](_0x83b35d);}return _0x1ecdfb[_0xeb78('0x35')]();};}function saveUpdates(_0x1ec0bc,_0x39df93){return function(_0x38922f){if(_0x38922f){return _0x38922f['update'](_0x1ec0bc)[_0xeb78('0x25')](function(_0x5c32bb){return _0x5c32bb;});}return null;};}function removeEntity(_0xf01a87,_0x20ba1d){return function(_0xe7f7c7){if(_0xe7f7c7){return _0xe7f7c7[_0xeb78('0x36')]()[_0xeb78('0x25')](function(){_0xf01a87[_0xeb78('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5505b7,_0x31bdd1){return function(_0x26975a){if(!_0x26975a){_0x5505b7[_0xeb78('0x37')](0x194);}return _0x26975a;};}function handleError(_0x2c2073,_0x3d4732){_0x3d4732=_0x3d4732||0x1f4;return function(_0x5927e1){logger[_0xeb78('0x2a')](_0x5927e1[_0xeb78('0x38')]);if(_0x5927e1[_0xeb78('0x39')]){delete _0x5927e1[_0xeb78('0x39')];}_0x2c2073[_0xeb78('0x2d')](_0x3d4732)[_0xeb78('0x3a')](_0x5927e1);};}exports['index']=function(_0x59b721,_0x5b0d05){var _0x493571={},_0x45123e={},_0x4600a1={'count':0x0,'rows':[]};var _0x24a6e3=_['map'](db[_0xeb78('0x3b')][_0xeb78('0x3c')],function(_0x518653){return{'name':_0x518653['fieldName'],'type':_0x518653['type'][_0xeb78('0x3d')]};});_0x45123e[_0xeb78('0x3e')]=_[_0xeb78('0x3f')](_0x24a6e3,'name');_0x45123e[_0xeb78('0x40')]=_[_0xeb78('0x41')](_0x59b721[_0xeb78('0x40')]);_0x45123e['filters']=_[_0xeb78('0x42')](_0x45123e[_0xeb78('0x3e')],_0x45123e[_0xeb78('0x40')]);_0x493571[_0xeb78('0x43')]=_['intersection'](_0x45123e['model'],qs[_0xeb78('0x44')](_0x59b721[_0xeb78('0x40')][_0xeb78('0x44')]));_0x493571[_0xeb78('0x43')]=_0x493571[_0xeb78('0x43')][_0xeb78('0x45')]?_0x493571[_0xeb78('0x43')]:_0x45123e[_0xeb78('0x3e')];if(!_0x59b721[_0xeb78('0x40')]['hasOwnProperty'](_0xeb78('0x46'))){_0x493571[_0xeb78('0x47')]=qs[_0xeb78('0x47')](_0x59b721['query'][_0xeb78('0x47')]);_0x493571['offset']=qs[_0xeb78('0x48')](_0x59b721[_0xeb78('0x40')][_0xeb78('0x48')]);}_0x493571['order']=qs[_0xeb78('0x49')](_0x59b721[_0xeb78('0x40')][_0xeb78('0x49')]);_0x493571[_0xeb78('0x4a')]=qs[_0xeb78('0x4b')](_['pick'](_0x59b721[_0xeb78('0x40')],_0x45123e[_0xeb78('0x4b')]),_0x24a6e3);if(_0x59b721['query'][_0xeb78('0x4c')]){_0x493571[_0xeb78('0x4a')]=_[_0xeb78('0x4d')](_0x493571['where'],{'$or':_[_0xeb78('0x3f')](_0x24a6e3,function(_0x42ac24){if(_0x42ac24[_0xeb78('0x4e')]!==_0xeb78('0x4f')){var _0x32133a={};_0x32133a[_0x42ac24[_0xeb78('0x39')]]={'$like':'%'+_0x59b721['query']['filter']+'%'};return _0x32133a;}})});}_0x493571=_[_0xeb78('0x4d')]({},_0x493571,_0x59b721[_0xeb78('0x50')]);var _0x521362={'where':_0x493571[_0xeb78('0x4a')]};return db[_0xeb78('0x3b')][_0xeb78('0x30')](_0x521362)[_0xeb78('0x25')](function(_0x5ccd68){_0x4600a1[_0xeb78('0x30')]=_0x5ccd68;if(_0x59b721[_0xeb78('0x40')][_0xeb78('0x51')]){_0x493571[_0xeb78('0x52')]=[{'all':!![]}];}return db[_0xeb78('0x3b')][_0xeb78('0x53')](_0x493571);})[_0xeb78('0x25')](function(_0x25636f){_0x4600a1[_0xeb78('0x54')]=_0x25636f;return _0x4600a1;})[_0xeb78('0x25')](respondWithFilteredResult(_0x5b0d05,_0x493571))['catch'](handleError(_0x5b0d05,null));};exports[_0xeb78('0x55')]=function(_0x2c7426,_0x439c75){var _0x913b3a={'raw':!![],'where':{'id':_0x2c7426[_0xeb78('0x56')]['id']}},_0x51ab39={};_0x51ab39[_0xeb78('0x3e')]=_[_0xeb78('0x41')](db[_0xeb78('0x3b')][_0xeb78('0x3c')]);_0x51ab39['query']=_['keys'](_0x2c7426['query']);_0x51ab39[_0xeb78('0x4b')]=_[_0xeb78('0x42')](_0x51ab39['model'],_0x51ab39[_0xeb78('0x40')]);_0x913b3a[_0xeb78('0x43')]=_[_0xeb78('0x42')](_0x51ab39['model'],qs['fields'](_0x2c7426[_0xeb78('0x40')][_0xeb78('0x44')]));_0x913b3a[_0xeb78('0x43')]=_0x913b3a['attributes'][_0xeb78('0x45')]?_0x913b3a[_0xeb78('0x43')]:_0x51ab39[_0xeb78('0x3e')];if(_0x2c7426['query']['includeAll']){_0x913b3a['include']=[{'all':!![]}];}_0x913b3a=_[_0xeb78('0x4d')]({},_0x913b3a,_0x2c7426[_0xeb78('0x50')]);return db['FaxMessage'][_0xeb78('0x57')](_0x913b3a)[_0xeb78('0x25')](handleEntityNotFound(_0x439c75,null))[_0xeb78('0x25')](respondWithResult(_0x439c75,null))['catch'](handleError(_0x439c75,null));};exports[_0xeb78('0x58')]=function(_0x572aaf,_0xe58c2){if(_0x572aaf[_0xeb78('0x59')]['id']){delete _0x572aaf[_0xeb78('0x59')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x572aaf['params']['id']}})['then'](handleEntityNotFound(_0xe58c2,null))[_0xeb78('0x25')](saveUpdates(_0x572aaf['body'],null))[_0xeb78('0x25')](respondWithResult(_0xe58c2,null))[_0xeb78('0x5a')](handleError(_0xe58c2,null));};exports[_0xeb78('0x36')]=function(_0x1b7290,_0x2a1f7f){return db[_0xeb78('0x3b')]['find']({'where':{'id':_0x1b7290['params']['id']}})[_0xeb78('0x25')](handleEntityNotFound(_0x2a1f7f,null))[_0xeb78('0x25')](removeEntity(_0x2a1f7f,null))[_0xeb78('0x5a')](handleError(_0x2a1f7f,null));};exports[_0xeb78('0x5b')]=function(_0x480093,_0x17937a){return db['FaxMessage'][_0xeb78('0x5b')]()[_0xeb78('0x25')](respondWithResult(_0x17937a,null))[_0xeb78('0x5a')](handleError(_0x17937a,null));};var interaction_log=require('../../config/logger')(_0xeb78('0x5c'));exports[_0xeb78('0x5d')]=function(_0x4c54be,_0x5a5de3,_0x154f19){var _0x442937={'agent':{},'channel':'fax'};if(_0x4c54be[_0xeb78('0x59')]['id']){delete _0x4c54be[_0xeb78('0x59')]['id'];}_0x4c54be['body']['read']=!![];_0x4c54be[_0xeb78('0x59')]['readAt']=moment()['format'](_0xeb78('0x5e'));_0x4c54be['body'][_0xeb78('0x5f')]=_0x4c54be[_0xeb78('0x59')][_0xeb78('0x5f')]||_0x4c54be['user']['id'];_0x442937[_0xeb78('0x60')]['id']=_0x4c54be[_0xeb78('0x59')][_0xeb78('0x5f')];return db['FaxMessage'][_0xeb78('0x57')]({'where':{'id':_0x4c54be[_0xeb78('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xeb78('0x61')],'as':_0xeb78('0x62')}]})[_0xeb78('0x25')](handleEntityNotFound(_0x5a5de3,null))[_0xeb78('0x25')](saveUpdates(_0x4c54be['body'],null))[_0xeb78('0x25')](function(_0x48435b){if(_0x48435b){_0x442937[_0xeb78('0x2c')]=_0x48435b[_0xeb78('0x63')]({'plain':!![]});return db[_0xeb78('0x64')][_0xeb78('0x57')]({'where':{'id':_0x48435b[_0xeb78('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x5a5de3,null))[_0xeb78('0x25')](function(_0x2bf5a8){if(_0x2bf5a8){return _0x2bf5a8[_0xeb78('0x58')]({'UserId':_0x4c54be[_0xeb78('0x59')][_0xeb78('0x5f')],'read1stAt':_[_0xeb78('0x66')](_0x2bf5a8[_0xeb78('0x67')])?moment()[_0xeb78('0x68')](_0xeb78('0x5e')):undefined});}return null;})[_0xeb78('0x25')](function(_0x21e507){if(_0x21e507){_0x442937[_0xeb78('0x69')]=_0x21e507[_0xeb78('0x63')]({'plain':!![]});interaction_log[_0xeb78('0x26')](_0xeb78('0x6a'),_0x4c54be[_0xeb78('0x6b')]['id'],_0x4c54be['user'][_0xeb78('0x39')],_0x4c54be[_0xeb78('0x6b')][_0xeb78('0x6c')],_0x442937['interaction']['id'],_0x4c54be[_0xeb78('0x59')]?JSON[_0xeb78('0x6d')](_0x4c54be[_0xeb78('0x59')]):_0xeb78('0x6e'));return respondWithRpcPromise(_0xeb78('0x6f'),_0xeb78('0x70'),_0x442937);}return null;})[_0xeb78('0x25')](function(_0xb4b5bd){if(_0xb4b5bd){if(_0x4c54be[_0xeb78('0x59')]['manual']){_0x442937['message'][_0xeb78('0x71')]=util[_0xeb78('0x68')](_0xeb78('0x72'),_0x4c54be[_0xeb78('0x6b')][_0xeb78('0x39')]);_0x442937[_0xeb78('0x2c')][_0xeb78('0x73')]=_0x442937[_0xeb78('0x73')];_0x442937[_0xeb78('0x2c')][_0xeb78('0x74')]='accept';return respondWithRpcPromise(_0xeb78('0x75'),_0xeb78('0x75'),{'event':_0xeb78('0x76'),'message':_0x442937['message']},client9002)['then'](function(){return _0x442937;});}return _0x442937;}return null;})['then'](respondWithResult(_0x5a5de3,null))['catch'](handleError(_0x5a5de3,null));};var interaction_log=require(_0xeb78('0x18'))(_0xeb78('0x5c'));exports[_0xeb78('0x34')]=function(_0xf89f26,_0x134c8c,_0x1f81c7){var _0xa1bf55={'agent':{},'channel':_0xeb78('0x77')};if(_0xf89f26[_0xeb78('0x59')]['id']){delete _0xf89f26[_0xeb78('0x59')]['id'];}_0xf89f26[_0xeb78('0x59')]['UserId']=_0xf89f26[_0xeb78('0x59')]['UserId']||_0xf89f26[_0xeb78('0x6b')]['id'];_0xa1bf55['agent']['id']=_0xf89f26[_0xeb78('0x59')][_0xeb78('0x5f')];return db[_0xeb78('0x3b')][_0xeb78('0x57')]({'where':{'id':_0xf89f26[_0xeb78('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x134c8c,null))[_0xeb78('0x25')](function(_0x30a573){if(_0x30a573){_0xa1bf55[_0xeb78('0x2c')]=_0x30a573[_0xeb78('0x63')]({'plain':!![]});return db[_0xeb78('0x64')][_0xeb78('0x57')]({'where':{'id':_0x30a573[_0xeb78('0x65')]}});}return null;})[_0xeb78('0x25')](handleEntityNotFound(_0x134c8c,null))[_0xeb78('0x25')](function(_0x3975e9){if(_0x3975e9){_0xa1bf55['interaction']=_0x3975e9[_0xeb78('0x63')]({'plain':!![]});interaction_log[_0xeb78('0x26')](_0xeb78('0x78'),_0xf89f26[_0xeb78('0x6b')]['id'],_0xf89f26[_0xeb78('0x6b')][_0xeb78('0x39')],_0xf89f26[_0xeb78('0x6b')]['role'],_0xa1bf55[_0xeb78('0x69')]['id'],_0xf89f26['body']?JSON[_0xeb78('0x6d')](_0xf89f26[_0xeb78('0x59')]):_0xeb78('0x6e'));return respondWithRpcPromise('RejectMessage',_0xeb78('0x79'),_0xa1bf55);}return null;})[_0xeb78('0x25')](function(_0x509d85){if(_0x509d85){_0x509d85[_0xeb78('0x2c')][_0xeb78('0x71')]=util['format'](_0xeb78('0x72'),_0xf89f26[_0xeb78('0x6b')][_0xeb78('0x39')]);_0x509d85['message'][_0xeb78('0x73')]=_0xa1bf55[_0xeb78('0x73')];_0x509d85[_0xeb78('0x2c')]['event']=_0xeb78('0x34');respondWithRpcPromise(_0xeb78('0x75'),'EventManager',{'event':'rejectmessage','message':_0x509d85['message']},client9002);return _0xa1bf55;}return null;})['then'](respondWithResult(_0x134c8c,null))[_0xeb78('0x5a')](handleError(_0x134c8c,null));};exports[_0xeb78('0x7a')]=function(_0x1d2073,_0x2dbef1){var _0x44c44b;return db[_0xeb78('0x3b')][_0xeb78('0x7a')](_0x1d2073[_0xeb78('0x59')],{})[_0xeb78('0x25')](function(_0xd3ed51){_0x44c44b=_0xd3ed51;return db[_0xeb78('0x61')][_0xeb78('0x7b')]({'where':{'id':_0x44c44b[_0xeb78('0x7c')]}});})['then'](function(_0x4afefa){if(_[_0xeb78('0x66')](_0x4afefa)){return;}else{_0x44c44b[_0xeb78('0x77')]=_0x4afefa[_0xeb78('0x77')];return db[_0xeb78('0x7d')][_0xeb78('0x7b')]({'where':{'id':_0x44c44b[_0xeb78('0x7e')]}});}})['then'](function(_0x1262a9){return respondWithRpcPromise(_0xeb78('0x7f'),'SendFax',{'FaxAccountId':_[_0xeb78('0x66')](_0x1d2073[_0xeb78('0x59')])?undefined:_0x1d2073[_0xeb78('0x59')][_0xeb78('0x80')],'path':_[_0xeb78('0x66')](_0x1262a9)?undefined:util[_0xeb78('0x68')](_0xeb78('0x81'),_0x1262a9['basename']),'fax':_[_0xeb78('0x66')](_0x44c44b['fax'])?undefined:_0x44c44b[_0xeb78('0x77')],'AttachmentId':_0x44c44b[_0xeb78('0x7e')]},client9002);})[_0xeb78('0x25')](respondWithResult(_0x2dbef1,0xc9))[_0xeb78('0x5a')](handleError(_0x2dbef1,null));};exports['download']=function(_0x2193e6,_0x573736){var _0x59eac9=path[_0xeb78('0x82')](config[_0xeb78('0x83')],_0xeb78('0x84'),_0xeb78('0x85'),_0xeb78('0x86'));return db[_0xeb78('0x3b')][_0xeb78('0x57')]({'where':{'id':_0x2193e6[_0xeb78('0x56')]['id']},'include':[{'model':db[_0xeb78('0x7d')],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x573736,null))[_0xeb78('0x25')](function(_0x368b36){if(_0x368b36){return _0x573736[_0xeb78('0x87')](path['join'](_0x59eac9,_0x368b36[_0xeb78('0x7d')][_0xeb78('0x88')]));}})[_0xeb78('0x5a')](handleError(_0x573736,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 3cb541c..93b820c 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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x5fc3,0xa8));var _0x35fc=function(_0xd578cb,_0x2167a3){_0xd578cb=_0xd578cb-0x0;var _0x775533=_0x5fc3[_0xd578cb];return _0x775533;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var FaxMessage=require(_0x35fc('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){FaxMessageEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);FaxMessageEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','FaxMessage','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x4d41ee,_0x5e06ba){_0x4d41ee=_0x4d41ee-0x0;var _0x911222=_0x3e74[_0x4d41ee];return _0x911222;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x43e7('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){FaxMessageEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);FaxMessageEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index ef9286a..7e22e4a 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 _0x52bd=['FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','./faxMessage.attributes','exports','define'];(function(_0x1843e0,_0x4a8344){var _0x40b60d=function(_0x58ff08){while(--_0x58ff08){_0x1843e0['push'](_0x1843e0['shift']());}};_0x40b60d(++_0x4a8344);}(_0x52bd,0x122));var _0xd52b=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x52bd[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0xd52b('0x0'));var util=require('util');var logger=require(_0xd52b('0x1'))(_0xd52b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd52b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd52b('0x4'));module[_0xd52b('0x5')]=function(_0x31e551,_0xc7fdee){return _0x31e551[_0xd52b('0x6')](_0xd52b('0x7'),attributes,{'tableName':_0xd52b('0x8'),'paranoid':![],'indexes':[{'name':_0xd52b('0x9'),'fields':[_0xd52b('0xa')],'type':_0xd52b('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x12053a,_0x13bd31,_0x32a58c){var _0x5027bb=_0x31e551[_0xd52b('0xc')];var _0xde0e30=_0x12053a[_0xd52b('0xd')]({'plain':!![]});if(_0xde0e30[_0xd52b('0xe')][_0xd52b('0xf')]()==='in'||_0xde0e30[_0xd52b('0xe')][_0xd52b('0xf')]()===_0xd52b('0x10')&&!_0xde0e30[_0xd52b('0x11')]&&!_['isNil'](_0xde0e30[_0xd52b('0x12')])){_0x5027bb['FaxInteraction'][_0xd52b('0x13')]({'where':{'id':_0xde0e30[_0xd52b('0x14')]}})[_0xd52b('0x15')](function(_0x277d9b){if(_0x277d9b){_0x277d9b[_0xd52b('0x16')]({'lastMsgAt':_0xde0e30[_0xd52b('0x17')],'lastMsgDirection':_0xde0e30[_0xd52b('0xe')]['toLowerCase']()});}})[_0xd52b('0x18')](function(_0x23981d){console[_0xd52b('0x19')](_0x23981d);});}_0x32a58c();}},'charset':'utf8mb4','collate':_0xd52b('0x1a')});}; \ No newline at end of file +var _0x353c=['FaxInteraction','findOne','FaxInteractionId','then','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','path','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fti_fax_messages','body','models','get','direction','toLowerCase','secret','isNil','UserId'];(function(_0x12a94b,_0x2873ef){var _0x500c66=function(_0x36e5a8){while(--_0x36e5a8){_0x12a94b['push'](_0x12a94b['shift']());}};_0x500c66(++_0x2873ef);}(_0x353c,0x18e));var _0xc353=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x353c[_0x725b8e];return _0x43ac45;};'use strict';var _=require(_0xc353('0x0'));var util=require(_0xc353('0x1'));var logger=require(_0xc353('0x2'))(_0xc353('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc353('0x4'));var rimraf=require('rimraf');var config=require(_0xc353('0x5'));var attributes=require(_0xc353('0x6'));module[_0xc353('0x7')]=function(_0x3dbfcc,_0x12abd8){return _0x3dbfcc['define'](_0xc353('0x8'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xc353('0x9'),'fields':[_0xc353('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1b54e6,_0x5a45a7,_0x59f471){var _0x153126=_0x3dbfcc[_0xc353('0xb')];var _0x44b719=_0x1b54e6[_0xc353('0xc')]({'plain':!![]});if(_0x44b719[_0xc353('0xd')][_0xc353('0xe')]()==='in'||_0x44b719[_0xc353('0xd')][_0xc353('0xe')]()==='out'&&!_0x44b719[_0xc353('0xf')]&&!_[_0xc353('0x10')](_0x44b719[_0xc353('0x11')])){_0x153126[_0xc353('0x12')][_0xc353('0x13')]({'where':{'id':_0x44b719[_0xc353('0x14')]}})[_0xc353('0x15')](function(_0x256e70){if(_0x256e70){_0x256e70['update']({'lastMsgAt':_0x44b719[_0xc353('0x16')],'lastMsgDirection':_0x44b719['direction'][_0xc353('0xe')]()});}})[_0xc353('0x17')](function(_0x38d929){console[_0xc353('0x18')](_0x38d929);});}_0x59f471();}},'charset':'utf8mb4','collate':_0xc353('0x19')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 32b6d83..c28337a 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 _0x8732=['FaxMessage,\x20%s,\x20%s','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','debug','UpdateFaxMessage','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','then','info'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x8732,0x14b));var _0x2873=function(_0xd7d69e,_0x20dcf0){_0xd7d69e=_0xd7d69e-0x0;var _0x2cb332=_0x8732[_0xd7d69e];return _0x2cb332;};'use strict';var _=require(_0x2873('0x0'));var util=require(_0x2873('0x1'));var moment=require(_0x2873('0x2'));var BPromise=require(_0x2873('0x3'));var rs=require(_0x2873('0x4'));var fs=require('fs');var Redis=require(_0x2873('0x5'));var db=require(_0x2873('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2873('0x7'))(_0x2873('0x8'));var config=require(_0x2873('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2873('0xa')][_0x2873('0xb')]({'port':0x232a});config['redis']=_[_0x2873('0xc')](config[_0x2873('0xd')],{'host':_0x2873('0xe'),'port':0x18eb});var socket=require(_0x2873('0xf'))(new Redis(config[_0x2873('0xd')]));require(_0x2873('0x10'))[_0x2873('0x11')](socket);function respondWithRpcPromise(_0x43c654,_0x4321a6,_0xd79be2){return new BPromise(function(_0x3ad794,_0x49bcb2){return client['request'](_0x43c654,_0xd79be2)[_0x2873('0x12')](function(_0x4cfaad){logger[_0x2873('0x13')](_0x2873('0x14'),_0x4321a6,'request\x20sent');logger['debug'](_0x2873('0x15'),_0x4321a6,_0x2873('0x16'),JSON[_0x2873('0x17')](_0x4cfaad));if(_0x4cfaad[_0x2873('0x18')]){if(_0x4cfaad[_0x2873('0x18')][_0x2873('0x19')]===0x1f4){logger[_0x2873('0x18')](_0x2873('0x14'),_0x4321a6,_0x4cfaad[_0x2873('0x18')][_0x2873('0x1a')]);return _0x49bcb2(_0x4cfaad[_0x2873('0x18')][_0x2873('0x1a')]);}logger[_0x2873('0x18')](_0x2873('0x14'),_0x4321a6,_0x4cfaad[_0x2873('0x18')]['message']);return _0x3ad794(_0x4cfaad[_0x2873('0x18')][_0x2873('0x1a')]);}else{logger[_0x2873('0x13')](_0x2873('0x14'),_0x4321a6,'request\x20sent');_0x3ad794(_0x4cfaad['result'][_0x2873('0x1a')]);}})[_0x2873('0x1b')](function(_0x22a46f){logger[_0x2873('0x18')](_0x2873('0x14'),_0x4321a6,_0x22a46f);_0x49bcb2(_0x22a46f);});});}exports['CreateFaxMessage']=function(_0xbd4f94){var _0x321029=this;return new Promise(function(_0x1e7dd9,_0x5d0dd5){return db[_0x2873('0x1c')][_0x2873('0x1d')](_0xbd4f94[_0x2873('0x1e')],{'raw':_0xbd4f94[_0x2873('0x1f')]?_0xbd4f94[_0x2873('0x1f')][_0x2873('0x20')]===undefined?!![]:![]:!![]})[_0x2873('0x12')](function(_0x49e2a3){logger[_0x2873('0x13')](_0x2873('0x21'),_0xbd4f94);logger[_0x2873('0x22')](_0x2873('0x21'),_0xbd4f94,JSON['stringify'](_0x49e2a3));_0x1e7dd9(_0x49e2a3);})[_0x2873('0x1b')](function(_0xc86fe9){logger[_0x2873('0x18')](_0x2873('0x21'),_0xc86fe9[_0x2873('0x1a')],_0xbd4f94);_0x5d0dd5(_0x321029['error'](0x1f4,_0xc86fe9[_0x2873('0x1a')]));});});};exports[_0x2873('0x23')]=function(_0x267f7e){var _0x511397=this;return new Promise(function(_0x1466a1,_0x2c7bc9){return db['FaxMessage'][_0x2873('0x24')](_0x267f7e['body'],{'raw':_0x267f7e[_0x2873('0x1f')]?_0x267f7e['options'][_0x2873('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x267f7e[_0x2873('0x1f')]?_0x267f7e[_0x2873('0x1f')]['where']||null:null,'attributes':_0x267f7e[_0x2873('0x1f')]?_0x267f7e['options'][_0x2873('0x25')]||null:null,'limit':_0x267f7e[_0x2873('0x1f')]?_0x267f7e[_0x2873('0x1f')][_0x2873('0x26')]||null:null})['then'](function(_0x2a09d5){logger[_0x2873('0x13')](_0x2873('0x23'),_0x267f7e);logger['debug'](_0x2873('0x23'),_0x267f7e,JSON[_0x2873('0x17')](_0x2a09d5));_0x1466a1(_0x2a09d5);})[_0x2873('0x1b')](function(_0x3e2656){logger['error'](_0x2873('0x23'),_0x3e2656['message'],_0x267f7e);_0x2c7bc9(_0x511397[_0x2873('0x18')](0x1f4,_0x3e2656['message']));});});}; \ No newline at end of file +var _0x6720=['code','message','result','catch','FaxMessage','create','options','CreateFaxMessage','UpdateFaxMessage','update','raw','where','attributes','limit','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1972c3,_0x3c3ccf){var _0x4c5de1=function(_0x2445b5){while(--_0x2445b5){_0x1972c3['push'](_0x1972c3['shift']());}};_0x4c5de1(++_0x3c3ccf);}(_0x6720,0xab));var _0x0672=function(_0x9c494b,_0x2bd024){_0x9c494b=_0x9c494b-0x0;var _0x55b48f=_0x6720[_0x9c494b];return _0x55b48f;};'use strict';var _=require('lodash');var util=require(_0x0672('0x0'));var moment=require(_0x0672('0x1'));var BPromise=require(_0x0672('0x2'));var rs=require(_0x0672('0x3'));var fs=require('fs');var Redis=require(_0x0672('0x4'));var db=require(_0x0672('0x5'))['db'];var utils=require(_0x0672('0x6'));var logger=require(_0x0672('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0672('0x8'));var client=jayson[_0x0672('0x9')][_0x0672('0xa')]({'port':0x232a});config[_0x0672('0xb')]=_[_0x0672('0xc')](config[_0x0672('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0672('0xd'))(new Redis(config[_0x0672('0xb')]));require(_0x0672('0xe'))[_0x0672('0xf')](socket);function respondWithRpcPromise(_0x5a55c1,_0x1d63b2,_0x424570){return new BPromise(function(_0x2b6e4b,_0x21ed94){return client[_0x0672('0x10')](_0x5a55c1,_0x424570)['then'](function(_0x298151){logger[_0x0672('0x11')](_0x0672('0x12'),_0x1d63b2,_0x0672('0x13'));logger[_0x0672('0x14')](_0x0672('0x15'),_0x1d63b2,_0x0672('0x13'),JSON[_0x0672('0x16')](_0x298151));if(_0x298151[_0x0672('0x17')]){if(_0x298151[_0x0672('0x17')][_0x0672('0x18')]===0x1f4){logger[_0x0672('0x17')]('FaxMessage,\x20%s,\x20%s',_0x1d63b2,_0x298151[_0x0672('0x17')]['message']);return _0x21ed94(_0x298151[_0x0672('0x17')]['message']);}logger[_0x0672('0x17')](_0x0672('0x12'),_0x1d63b2,_0x298151['error'][_0x0672('0x19')]);return _0x2b6e4b(_0x298151[_0x0672('0x17')][_0x0672('0x19')]);}else{logger[_0x0672('0x11')](_0x0672('0x12'),_0x1d63b2,_0x0672('0x13'));_0x2b6e4b(_0x298151[_0x0672('0x1a')][_0x0672('0x19')]);}})[_0x0672('0x1b')](function(_0x407b8d){logger[_0x0672('0x17')](_0x0672('0x12'),_0x1d63b2,_0x407b8d);_0x21ed94(_0x407b8d);});});}exports['CreateFaxMessage']=function(_0x5eea23){var _0x2b756f=this;return new Promise(function(_0x422953,_0x5d1032){return db[_0x0672('0x1c')][_0x0672('0x1d')](_0x5eea23['body'],{'raw':_0x5eea23[_0x0672('0x1e')]?_0x5eea23[_0x0672('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xd4673d){logger[_0x0672('0x11')]('CreateFaxMessage',_0x5eea23);logger['debug'](_0x0672('0x1f'),_0x5eea23,JSON[_0x0672('0x16')](_0xd4673d));_0x422953(_0xd4673d);})[_0x0672('0x1b')](function(_0x53a7f5){logger[_0x0672('0x17')](_0x0672('0x1f'),_0x53a7f5[_0x0672('0x19')],_0x5eea23);_0x5d1032(_0x2b756f[_0x0672('0x17')](0x1f4,_0x53a7f5[_0x0672('0x19')]));});});};exports[_0x0672('0x20')]=function(_0x562051){var _0x4c15af=this;return new Promise(function(_0x36b087,_0x4146c5){return db['FaxMessage'][_0x0672('0x21')](_0x562051['body'],{'raw':_0x562051['options']?_0x562051[_0x0672('0x1e')][_0x0672('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x562051['options']?_0x562051[_0x0672('0x1e')][_0x0672('0x23')]||null:null,'attributes':_0x562051[_0x0672('0x1e')]?_0x562051[_0x0672('0x1e')][_0x0672('0x24')]||null:null,'limit':_0x562051['options']?_0x562051['options'][_0x0672('0x25')]||null:null})[_0x0672('0x26')](function(_0x557f4f){logger[_0x0672('0x11')](_0x0672('0x20'),_0x562051);logger[_0x0672('0x14')]('UpdateFaxMessage',_0x562051,JSON['stringify'](_0x557f4f));_0x36b087(_0x557f4f);})[_0x0672('0x1b')](function(_0x34a5a0){logger[_0x0672('0x17')](_0x0672('0x20'),_0x34a5a0[_0x0672('0x19')],_0x562051);_0x4146c5(_0x4c15af['error'](0x1f4,_0x34a5a0[_0x0672('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index da9d0b7..64a9d71 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x15af0f,_0x5454ce){var _0x2bd1cb=function(_0x593818){while(--_0x593818){_0x15af0f['push'](_0x15af0f['shift']());}};_0x2bd1cb(++_0x5454ce);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 d78d21c..0308b92 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 _0x6a7a=['/:id/download','post','tracked','faxmessage:create','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','/describe','/:id','show'];(function(_0x2625f4,_0x135ac8){var _0x1ad69f=function(_0x3583be){while(--_0x3583be){_0x2625f4['push'](_0x2625f4['shift']());}};_0x1ad69f(++_0x135ac8);}(_0x6a7a,0x1ad));var _0xa6a7=function(_0x11da31,_0x5d576f){_0x11da31=_0x11da31-0x0;var _0x6bb4c8=_0x6a7a[_0x11da31];return _0x6bb4c8;};'use strict';var multer=require(_0xa6a7('0x0'));var util=require(_0xa6a7('0x1'));var path=require(_0xa6a7('0x2'));var timeout=require(_0xa6a7('0x3'));var express=require('express');var router=express[_0xa6a7('0x4')]();var auth=require(_0xa6a7('0x5'));var interaction=require(_0xa6a7('0x6'));var config=require('../../config/environment');var controller=require(_0xa6a7('0x7'));router[_0xa6a7('0x8')]('/',auth[_0xa6a7('0x9')](),controller['index']);router['get'](_0xa6a7('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xa6a7('0x8')](_0xa6a7('0xb'),auth[_0xa6a7('0x9')](),controller[_0xa6a7('0xc')]);router[_0xa6a7('0x8')](_0xa6a7('0xd'),auth['isAuthenticated'](),controller['download']);router[_0xa6a7('0xe')]('/',auth[_0xa6a7('0x9')](),interaction[_0xa6a7('0xf')]('fax',_0xa6a7('0x10')),controller[_0xa6a7('0x11')]);router[_0xa6a7('0x12')](_0xa6a7('0xb'),auth[_0xa6a7('0x9')](),controller[_0xa6a7('0x13')]);router[_0xa6a7('0x12')]('/:id/accept',auth[_0xa6a7('0x9')](),controller[_0xa6a7('0x14')]);router[_0xa6a7('0x12')](_0xa6a7('0x15'),auth[_0xa6a7('0x9')](),controller[_0xa6a7('0x16')]);router[_0xa6a7('0x17')](_0xa6a7('0xb'),auth[_0xa6a7('0x9')](),controller[_0xa6a7('0x18')]);module[_0xa6a7('0x19')]=router; \ No newline at end of file +var _0x9efc=['/:id/download','fax','create','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','./faxMessage.controller','isAuthenticated','get','/describe','describe','/:id','show'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0x9efc,0x19c));var _0xc9ef=function(_0x136a67,_0x50cc82){_0x136a67=_0x136a67-0x0;var _0x4d3ed2=_0x9efc[_0x136a67];return _0x4d3ed2;};'use strict';var multer=require(_0xc9ef('0x0'));var util=require(_0xc9ef('0x1'));var path=require(_0xc9ef('0x2'));var timeout=require(_0xc9ef('0x3'));var express=require(_0xc9ef('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc9ef('0x5'));var config=require('../../config/environment');var controller=require(_0xc9ef('0x6'));router['get']('/',auth[_0xc9ef('0x7')](),controller['index']);router[_0xc9ef('0x8')](_0xc9ef('0x9'),auth[_0xc9ef('0x7')](),controller[_0xc9ef('0xa')]);router[_0xc9ef('0x8')](_0xc9ef('0xb'),auth[_0xc9ef('0x7')](),controller[_0xc9ef('0xc')]);router[_0xc9ef('0x8')](_0xc9ef('0xd'),auth[_0xc9ef('0x7')](),controller['download']);router['post']('/',auth[_0xc9ef('0x7')](),interaction['tracked'](_0xc9ef('0xe'),'faxmessage:create'),controller[_0xc9ef('0xf')]);router['put']('/:id',auth[_0xc9ef('0x7')](),controller[_0xc9ef('0x10')]);router[_0xc9ef('0x11')](_0xc9ef('0x12'),auth[_0xc9ef('0x7')](),controller[_0xc9ef('0x13')]);router[_0xc9ef('0x11')](_0xc9ef('0x14'),auth[_0xc9ef('0x7')](),controller[_0xc9ef('0x15')]);router[_0xc9ef('0x16')]('/:id',auth[_0xc9ef('0x7')](),controller[_0xc9ef('0x17')]);module[_0xc9ef('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 7829598..2aa5b1f 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 _0x896f=['roundrobin','INTEGER','sequelize','STRING','name','ENUM','rrmemory','beepall'];(function(_0x22e7c0,_0x488133){var _0x1e93f8=function(_0x10d035){while(--_0x10d035){_0x22e7c0['push'](_0x22e7c0['shift']());}};_0x1e93f8(++_0x488133);}(_0x896f,0x92));var _0xf896=function(_0x406696,_0x39f9b1){_0x406696=_0x406696-0x0;var _0x10e35c=_0x896f[_0x406696];return _0x10e35c;};'use strict';var Sequelize=require(_0xf896('0x0'));module['exports']={'name':{'type':Sequelize[_0xf896('0x1')],'unique':_0xf896('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf896('0x3')](_0xf896('0x4'),_0xf896('0x5'),_0xf896('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xf896('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x025c=['INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','STRING','name'];(function(_0x5e24cb,_0x4f3b97){var _0x43d311=function(_0x335cd1){while(--_0x335cd1){_0x5e24cb['push'](_0x5e24cb['shift']());}};_0x43d311(++_0x4f3b97);}(_0x025c,0x1ad));var _0xc025=function(_0x17bd5f,_0x4d00d7){_0x17bd5f=_0x17bd5f-0x0;var _0x5f1f18=_0x025c[_0x17bd5f];return _0x5f1f18;};'use strict';var Sequelize=require('sequelize');module[_0xc025('0x0')]={'name':{'type':Sequelize[_0xc025('0x1')],'unique':_0xc025('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc025('0x1')]},'timeout':{'type':Sequelize[_0xc025('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc025('0x4')](_0xc025('0x5'),_0xc025('0x6'),_0xc025('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 466a35e..2695701 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 _0xd78b=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','UserId','agent','faxPause','updatedAt','createdAt','count','format','%s/%s','SIP','getTeams','ids','Team','User','Agents','online','voicePause','interface','flatMap','transaction','forEach','removeTeams','select','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','compact','sequelize','userFaxQueue:remove','addAgents','spread','emit','userFaxQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','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','defaults','redis','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','FaxQueues','UserProfileResource','error','stack','name','send','map','FaxQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x5b49b5,_0xe5b574){var _0x2c87d1=function(_0x3253a6){while(--_0x3253a6){_0x5b49b5['push'](_0x5b49b5['shift']());}};_0x2c87d1(++_0xe5b574);}(_0xd78b,0x155));var _0xbd78=function(_0x15681c,_0x1de42e){_0x15681c=_0x15681c-0x0;var _0x1cddf6=_0xd78b[_0x15681c];return _0x1cddf6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbd78('0x0'));var rimraf=require(_0xbd78('0x1'));var zipdir=require(_0xbd78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd78('0x3'));var moment=require(_0xbd78('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xbd78('0x5'));var sox=require(_0xbd78('0x6'));var csv=require('to-csv');var ejs=require(_0xbd78('0x7'));var fs=require('fs');var _=require(_0xbd78('0x8'));var squel=require(_0xbd78('0x9'));var crypto=require(_0xbd78('0xa'));var jsforce=require(_0xbd78('0xb'));var deskjs=require(_0xbd78('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbd78('0xd'));var Redis=require('ioredis');var authService=require(_0xbd78('0xe'));var qs=require(_0xbd78('0xf'));var as=require(_0xbd78('0x10'));var hardwareService=require(_0xbd78('0x11'));var logger=require(_0xbd78('0x12'))(_0xbd78('0x13'));var utils=require(_0xbd78('0x14'));var config=require(_0xbd78('0x15'));var licenseUtil=require(_0xbd78('0x16'));var db=require(_0xbd78('0x17'))['db'];config['redis']=_[_0xbd78('0x18')](config[_0xbd78('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xbd78('0x1a'))(new Redis(config[_0xbd78('0x19')]));require(_0xbd78('0x1b'))['register'](socket);function respondWithStatusCode(_0x595cf7,_0x53864d){_0x53864d=_0x53864d||0xcc;return function(_0x2a997a){if(_0x2a997a){return _0x595cf7[_0xbd78('0x1c')](_0x53864d);}return _0x595cf7[_0xbd78('0x1d')](_0x53864d)[_0xbd78('0x1e')]();};}function respondWithResult(_0x342c86,_0x30762b){_0x30762b=_0x30762b||0xc8;return function(_0x289dca){if(_0x289dca){return _0x342c86[_0xbd78('0x1d')](_0x30762b)[_0xbd78('0x1f')](_0x289dca);}};}function respondWithFilteredResult(_0x5e1e15,_0x640d8c){return function(_0x395f3b){if(_0x395f3b){var _0x9c243b=_0x395f3b['count'],_0x550cfe=_0x640d8c['offset'],_0x1225fa=_0x640d8c[_0xbd78('0x20')]+_0x640d8c[_0xbd78('0x21')],_0x56d27b;if(_0x1225fa>=_0x9c243b){_0x1225fa=_0x9c243b;_0x56d27b=0xc8;}else{_0x56d27b=0xce;}_0x5e1e15['status'](_0x56d27b);return _0x5e1e15[_0xbd78('0x22')](_0xbd78('0x23'),_0x550cfe+'-'+_0x1225fa+'/'+_0x9c243b)[_0xbd78('0x1f')](_0x395f3b);}return null;};}function patchUpdates(_0x958e5f){return function(_0x1d5942){try{jsonpatch[_0xbd78('0x24')](_0x1d5942,_0x958e5f,!![]);}catch(_0x58a4d9){return BPromise['reject'](_0x58a4d9);}return _0x1d5942[_0xbd78('0x25')]();};}function saveUpdates(_0x136ffb,_0x6bccda){return function(_0x34e2cb){if(_0x34e2cb){return _0x34e2cb[_0xbd78('0x26')](_0x136ffb)[_0xbd78('0x27')](function(_0xeba1e6){return _0xeba1e6;});}return null;};}function removeEntity(_0xf1fe01,_0x59ab96){return function(_0x57d8b5){if(_0x57d8b5){return _0x57d8b5[_0xbd78('0x28')]()[_0xbd78('0x27')](function(){var _0x494fae=_0x57d8b5['get']({'plain':!![]});var _0x148f48=_0xbd78('0x29');return db[_0xbd78('0x2a')][_0xbd78('0x28')]({'where':{'type':_0x148f48,'resourceId':_0x494fae['id']}})[_0xbd78('0x27')](function(){return _0x57d8b5;});})[_0xbd78('0x27')](function(){_0xf1fe01[_0xbd78('0x1d')](0xcc)[_0xbd78('0x1e')]();});}};}function handleEntityNotFound(_0x2ff83a,_0xc95976){return function(_0xb7eed4){if(!_0xb7eed4){_0x2ff83a['sendStatus'](0x194);}return _0xb7eed4;};}function handleError(_0x1fc168,_0x440ce2){_0x440ce2=_0x440ce2||0x1f4;return function(_0x24857c){logger[_0xbd78('0x2b')](_0x24857c[_0xbd78('0x2c')]);if(_0x24857c['name']){delete _0x24857c[_0xbd78('0x2d')];}_0x1fc168[_0xbd78('0x1d')](_0x440ce2)[_0xbd78('0x2e')](_0x24857c);};}exports['index']=function(_0x4cf1b0,_0xe76ec6){var _0x1f04e6={},_0xa7942d={},_0x193f04={'count':0x0,'rows':[]};var _0x13beff=_[_0xbd78('0x2f')](db[_0xbd78('0x30')][_0xbd78('0x31')],function(_0x4a1ab7){return{'name':_0x4a1ab7['fieldName'],'type':_0x4a1ab7[_0xbd78('0x32')][_0xbd78('0x33')]};});_0xa7942d[_0xbd78('0x34')]=_[_0xbd78('0x2f')](_0x13beff,_0xbd78('0x2d'));_0xa7942d[_0xbd78('0x35')]=_[_0xbd78('0x36')](_0x4cf1b0[_0xbd78('0x35')]);_0xa7942d[_0xbd78('0x37')]=_[_0xbd78('0x38')](_0xa7942d[_0xbd78('0x34')],_0xa7942d[_0xbd78('0x35')]);_0x1f04e6[_0xbd78('0x39')]=_[_0xbd78('0x38')](_0xa7942d[_0xbd78('0x34')],qs[_0xbd78('0x3a')](_0x4cf1b0[_0xbd78('0x35')][_0xbd78('0x3a')]));_0x1f04e6[_0xbd78('0x39')]=_0x1f04e6[_0xbd78('0x39')][_0xbd78('0x3b')]?_0x1f04e6[_0xbd78('0x39')]:_0xa7942d['model'];if(!_0x4cf1b0['query'][_0xbd78('0x3c')](_0xbd78('0x3d'))){_0x1f04e6[_0xbd78('0x21')]=qs[_0xbd78('0x21')](_0x4cf1b0[_0xbd78('0x35')][_0xbd78('0x21')]);_0x1f04e6['offset']=qs[_0xbd78('0x20')](_0x4cf1b0[_0xbd78('0x35')][_0xbd78('0x20')]);}_0x1f04e6[_0xbd78('0x3e')]=qs[_0xbd78('0x3f')](_0x4cf1b0['query'][_0xbd78('0x3f')]);_0x1f04e6[_0xbd78('0x40')]=qs['filters'](_[_0xbd78('0x41')](_0x4cf1b0[_0xbd78('0x35')],_0xa7942d[_0xbd78('0x37')]),_0x13beff);if(_0x4cf1b0['query'][_0xbd78('0x42')]){_0x1f04e6[_0xbd78('0x40')]=_[_0xbd78('0x43')](_0x1f04e6['where'],{'$or':_[_0xbd78('0x2f')](_0x13beff,function(_0xd268d6){if(_0xd268d6[_0xbd78('0x32')]!==_0xbd78('0x44')){var _0x11039c={};_0x11039c[_0xd268d6[_0xbd78('0x2d')]]={'$like':'%'+_0x4cf1b0[_0xbd78('0x35')]['filter']+'%'};return _0x11039c;}})});}_0x1f04e6=_['merge']({},_0x1f04e6,_0x4cf1b0[_0xbd78('0x45')]);var _0x2b231e={'where':_0x1f04e6['where']};return db[_0xbd78('0x30')]['count'](_0x2b231e)[_0xbd78('0x27')](function(_0x17b84f){_0x193f04['count']=_0x17b84f;if(_0x4cf1b0[_0xbd78('0x35')][_0xbd78('0x46')]){_0x1f04e6[_0xbd78('0x47')]=[{'all':!![]}];}return db[_0xbd78('0x30')][_0xbd78('0x48')](_0x1f04e6);})[_0xbd78('0x27')](function(_0x51a225){_0x193f04[_0xbd78('0x49')]=_0x51a225;return _0x193f04;})[_0xbd78('0x27')](respondWithFilteredResult(_0xe76ec6,_0x1f04e6))[_0xbd78('0x4a')](handleError(_0xe76ec6,null));};exports[_0xbd78('0x4b')]=function(_0x1d8bae,_0x138857){var _0x1d261b={'raw':!![],'where':{'id':_0x1d8bae[_0xbd78('0x4c')]['id']}},_0x1c3d82={};_0x1c3d82[_0xbd78('0x34')]=_[_0xbd78('0x36')](db[_0xbd78('0x30')][_0xbd78('0x31')]);_0x1c3d82['query']=_[_0xbd78('0x36')](_0x1d8bae[_0xbd78('0x35')]);_0x1c3d82[_0xbd78('0x37')]=_['intersection'](_0x1c3d82['model'],_0x1c3d82[_0xbd78('0x35')]);_0x1d261b[_0xbd78('0x39')]=_[_0xbd78('0x38')](_0x1c3d82['model'],qs[_0xbd78('0x3a')](_0x1d8bae[_0xbd78('0x35')][_0xbd78('0x3a')]));_0x1d261b[_0xbd78('0x39')]=_0x1d261b[_0xbd78('0x39')][_0xbd78('0x3b')]?_0x1d261b[_0xbd78('0x39')]:_0x1c3d82[_0xbd78('0x34')];if(_0x1d8bae['query'][_0xbd78('0x46')]){_0x1d261b['include']=[{'all':!![]}];}_0x1d261b=_[_0xbd78('0x43')]({},_0x1d261b,_0x1d8bae[_0xbd78('0x45')]);return db[_0xbd78('0x30')]['find'](_0x1d261b)[_0xbd78('0x27')](handleEntityNotFound(_0x138857,null))[_0xbd78('0x27')](respondWithResult(_0x138857,null))[_0xbd78('0x4a')](handleError(_0x138857,null));};exports[_0xbd78('0x4d')]=function(_0x380293,_0x3cb06e){return db[_0xbd78('0x30')]['create'](_0x380293['body'],{})[_0xbd78('0x27')](function(_0x44d6cc){var _0x3615f9=_0x380293['user'][_0xbd78('0x4e')]({'plain':!![]});if(!_0x3615f9)throw new Error(_0xbd78('0x4f'));if(_0x3615f9['role']==='user'){var _0x19b872=_0x44d6cc[_0xbd78('0x4e')]({'plain':!![]});var _0xa83309='FaxQueues';return db[_0xbd78('0x50')]['find']({'where':{'name':_0xa83309,'userProfileId':_0x3615f9['userProfileId']},'raw':!![]})[_0xbd78('0x27')](function(_0x2e6d17){if(_0x2e6d17&&_0x2e6d17[_0xbd78('0x51')]===0x0){return db[_0xbd78('0x2a')][_0xbd78('0x4d')]({'name':_0x19b872['name'],'resourceId':_0x19b872['id'],'type':_0x2e6d17[_0xbd78('0x2d')],'sectionId':_0x2e6d17['id']},{})[_0xbd78('0x27')](function(){return _0x44d6cc;});}else{return _0x44d6cc;}})[_0xbd78('0x4a')](function(_0x47362c){logger[_0xbd78('0x2b')](_0xbd78('0x52'),_0x47362c);throw _0x47362c;});}return _0x44d6cc;})['then'](respondWithResult(_0x3cb06e,0xc9))[_0xbd78('0x4a')](handleError(_0x3cb06e,null));};exports['update']=function(_0xb50c0d,_0x51138b){if(_0xb50c0d['body']['id']){delete _0xb50c0d[_0xbd78('0x53')]['id'];}return db[_0xbd78('0x30')]['find']({'where':{'id':_0xb50c0d[_0xbd78('0x4c')]['id']}})[_0xbd78('0x27')](handleEntityNotFound(_0x51138b,null))[_0xbd78('0x27')](saveUpdates(_0xb50c0d[_0xbd78('0x53')],null))[_0xbd78('0x27')](respondWithResult(_0x51138b,null))[_0xbd78('0x4a')](handleError(_0x51138b,null));};exports[_0xbd78('0x28')]=function(_0x11e3ce,_0x45a271){return db[_0xbd78('0x30')][_0xbd78('0x54')]({'where':{'id':_0x11e3ce[_0xbd78('0x4c')]['id']}})[_0xbd78('0x27')](handleEntityNotFound(_0x45a271,null))[_0xbd78('0x27')](removeEntity(_0x45a271,null))[_0xbd78('0x4a')](handleError(_0x45a271,null));};exports[_0xbd78('0x55')]=function(_0xd515e5,_0x266180){return db[_0xbd78('0x30')][_0xbd78('0x55')]()[_0xbd78('0x27')](respondWithResult(_0x266180,null))['catch'](handleError(_0x266180,null));};exports[_0xbd78('0x56')]=function(_0xbfb7e2,_0x55d9c1,_0x538c57){var _0xb873d5={'raw':!![],'where':{}},_0x376a8c={},_0x5ae34a;return db['FaxQueue'][_0xbd78('0x57')]({'where':{'id':_0xbfb7e2['params']['id']}})[_0xbd78('0x27')](handleEntityNotFound(_0x55d9c1,null))['then'](function(_0x392620){if(_0x392620){_0x5ae34a=_0x392620[_0xbd78('0x4e')]({'plain':!![]});_0x376a8c[_0xbd78('0x34')]=_[_0xbd78('0x36')](db[_0xbd78('0x58')][_0xbd78('0x31')]);_0x376a8c['query']=_['keys'](_0xbfb7e2[_0xbd78('0x35')]);_0x376a8c[_0xbd78('0x37')]=_['intersection'](_0x376a8c['model'],_0x376a8c[_0xbd78('0x35')]);_0xb873d5['attributes']=_[_0xbd78('0x38')](_0x376a8c['model'],qs[_0xbd78('0x3a')](_0xbfb7e2[_0xbd78('0x35')]['fields']));_0xb873d5[_0xbd78('0x39')]=_0xb873d5[_0xbd78('0x39')][_0xbd78('0x3b')]?_0xb873d5[_0xbd78('0x39')]:_0x376a8c['model'];if(!_0xbfb7e2[_0xbd78('0x35')][_0xbd78('0x3c')](_0xbd78('0x3d'))){_0xb873d5[_0xbd78('0x21')]=qs[_0xbd78('0x21')](_0xbfb7e2[_0xbd78('0x35')][_0xbd78('0x21')]);_0xb873d5[_0xbd78('0x20')]=qs[_0xbd78('0x20')](_0xbfb7e2[_0xbd78('0x35')][_0xbd78('0x20')]);}_0xb873d5[_0xbd78('0x3e')]=qs[_0xbd78('0x3f')](_0xbfb7e2[_0xbd78('0x35')][_0xbd78('0x3f')]);_0xb873d5['where']=qs[_0xbd78('0x37')](_[_0xbd78('0x41')](_0xbfb7e2[_0xbd78('0x35')],_0x376a8c[_0xbd78('0x37')]));_0xb873d5[_0xbd78('0x40')][_0xbd78('0x59')]=_0x392620['id'];if(_0xbfb7e2[_0xbd78('0x35')][_0xbd78('0x42')]){_0xb873d5['where']=_[_0xbd78('0x43')](_0xb873d5[_0xbd78('0x40')],{'$or':_[_0xbd78('0x2f')](_0xb873d5[_0xbd78('0x39')],function(_0x580329){var _0x474780={};_0x474780[_0x580329]={'$like':'%'+_0xbfb7e2[_0xbd78('0x35')][_0xbd78('0x42')]+'%'};return _0x474780;})});}_0xb873d5=_[_0xbd78('0x43')]({},_0xb873d5,_0xbfb7e2[_0xbd78('0x45')]);return db[_0xbd78('0x58')][_0xbd78('0x48')](_0xb873d5);}})[_0xbd78('0x27')](function(_0x2f2c52){if(_0x2f2c52){return db['User']['findAndCountAll']({'where':{'id':_[_0xbd78('0x2f')](_0x2f2c52,_0xbd78('0x5a')),'role':_0xbd78('0x5b')},'attributes':['id',_0xbd78('0x2d'),_0xbd78('0x5c'),_0xbd78('0x5d'),_0xbd78('0x5e')]});}})[_0xbd78('0x27')](function(_0x2fa452){if(_0x2fa452){return{'count':_0x2fa452[_0xbd78('0x5f')],'rows':_['map'](_0x2fa452[_0xbd78('0x49')],function(_0x3be030){return{'membername':_0x3be030[_0xbd78('0x2d')],'UserId':_0x3be030['id'],'queue_name':_0x5ae34a[_0xbd78('0x2d')],'FaxQueueId':_0x5ae34a['id'],'interface':util[_0xbd78('0x60')](_0xbd78('0x61'),_0xbd78('0x62'),_0x3be030[_0xbd78('0x2d')]),'penalty':0x0,'paused':_0x3be030[_0xbd78('0x5c')],'createdAt':_0x3be030[_0xbd78('0x5e')],'updatedAt':_0x3be030[_0xbd78('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x55d9c1,_0xb873d5))['catch'](handleError(_0x55d9c1,null));};exports[_0xbd78('0x63')]=function(_0x2fa8c2,_0x15f71d,_0x471b11){var _0x5ee855={};var _0x346836={};var _0x1b816b;var _0x6b035;return db[_0xbd78('0x30')][_0xbd78('0x57')]({'where':{'id':_0x2fa8c2[_0xbd78('0x4c')]['id']}})[_0xbd78('0x27')](handleEntityNotFound(_0x15f71d,null))[_0xbd78('0x27')](function(_0x4822c4){if(_0x4822c4){_0x1b816b=_0x4822c4;_0x346836['model']=_[_0xbd78('0x36')](db['Team'][_0xbd78('0x31')]);_0x346836[_0xbd78('0x35')]=_[_0xbd78('0x36')](_0x2fa8c2[_0xbd78('0x35')]);_0x346836[_0xbd78('0x37')]=_['intersection'](_0x346836[_0xbd78('0x34')],_0x346836[_0xbd78('0x35')]);_0x5ee855[_0xbd78('0x39')]=_[_0xbd78('0x38')](_0x346836[_0xbd78('0x34')],qs['fields'](_0x2fa8c2['query'][_0xbd78('0x3a')]));_0x5ee855['attributes']=_0x5ee855['attributes']['length']?_0x5ee855[_0xbd78('0x39')]:_0x346836[_0xbd78('0x34')];_0x5ee855['order']=qs[_0xbd78('0x3f')](_0x2fa8c2['query'][_0xbd78('0x3f')]);_0x5ee855[_0xbd78('0x40')]=qs['filters'](_[_0xbd78('0x41')](_0x2fa8c2[_0xbd78('0x35')],_0x346836[_0xbd78('0x37')]));if(_0x2fa8c2['query'][_0xbd78('0x42')]){_0x5ee855['where']=_['merge'](_0x5ee855[_0xbd78('0x40')],{'$or':_[_0xbd78('0x2f')](_0x5ee855[_0xbd78('0x39')],function(_0x3097cf){var _0x514713={};_0x514713[_0x3097cf]={'$like':'%'+_0x2fa8c2[_0xbd78('0x35')]['filter']+'%'};return _0x514713;})});}_0x5ee855=_['merge']({},_0x5ee855,_0x2fa8c2[_0xbd78('0x45')]);return _0x1b816b[_0xbd78('0x63')](_0x5ee855);}})['then'](function(_0x5de810){if(_0x5de810){_0x6b035=_0x5de810[_0xbd78('0x3b')];if(!_0x2fa8c2[_0xbd78('0x35')][_0xbd78('0x3c')](_0xbd78('0x3d'))){_0x5ee855[_0xbd78('0x21')]=qs[_0xbd78('0x21')](_0x2fa8c2['query'][_0xbd78('0x21')]);_0x5ee855[_0xbd78('0x20')]=qs[_0xbd78('0x20')](_0x2fa8c2['query'][_0xbd78('0x20')]);}return _0x1b816b['getTeams'](_0x5ee855);}})['then'](function(_0x3f0634){if(_0x3f0634){return _0x3f0634?{'count':_0x6b035,'rows':_0x3f0634}:null;}})[_0xbd78('0x27')](respondWithResult(_0x15f71d,null))[_0xbd78('0x4a')](handleError(_0x15f71d,null));};exports['addTeams']=function(_0x34cd39,_0x566de9,_0x39c6f7){var _0x23305a=_0x34cd39[_0xbd78('0x53')][_0xbd78('0x64')];return db[_0xbd78('0x65')]['findAll']({'where':{'id':_0x23305a},'attributes':['id'],'include':[{'model':db[_0xbd78('0x66')],'as':_0xbd78('0x67'),'attributes':['id',_0xbd78('0x2d'),_0xbd78('0x68'),_0xbd78('0x69'),_0xbd78('0x6a')],'raw':!![]}]})[_0xbd78('0x27')](function(_0x5bf2eb){if(_0x5bf2eb){var _0x3d4094=_[_0xbd78('0x6b')](_0x5bf2eb,function(_0xf53418){var _0x53b4c8=_0xf53418[_0xbd78('0x4e')]({'plain':!![]});return _0x53b4c8['Agents'];});return db['FaxQueue'][_0xbd78('0x54')]({'where':{'id':_0x34cd39['params']['id']}})[_0xbd78('0x27')](function(_0x10613d){return db['sequelize'][_0xbd78('0x6c')](function(_0x542eb6){return _0x10613d['addTeams'](_0x23305a,{'transaction':_0x542eb6})[_0xbd78('0x27')](function(){return BPromise['each'](_0x3d4094,function(_0x3e9d0e){return db[_0xbd78('0x58')]['findOrCreate']({'where':{'UserId':_0x3e9d0e['id'],'FaxQueueId':_0x34cd39['params']['id']},'transaction':_0x542eb6});});})['then'](function(){_0x3d4094[_0xbd78('0x6d')](function(_0x14ad91){socket['emit']('userFaxQueue:save',{'UserId':_0x14ad91['id'],'FaxQueueId':_0x10613d['id']});});});});});}})['then'](respondWithStatusCode(_0x566de9,null))[_0xbd78('0x4a')](handleError(_0x566de9,null));};exports[_0xbd78('0x6e')]=function(_0x41f1e7,_0x102cae,_0x29f9b4){return db[_0xbd78('0x65')]['findAll']({'where':{'id':_0x41f1e7[_0xbd78('0x35')][_0xbd78('0x64')]},'attributes':['id'],'include':[{'model':db[_0xbd78('0x66')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbd78('0x27')](handleEntityNotFound(_0x102cae,null))[_0xbd78('0x27')](function(_0x2023dd){var _0x3a8ef8=_['map'](_0x2023dd,'id');var _0x56fcfd=[];var _0x58bafd=[];var _0x3013c8=squel[_0xbd78('0x6f')]();_0x3013c8['field']('tq.TeamId')[_0xbd78('0x70')](_0xbd78('0x71'),'tq')[_0xbd78('0x72')](_0xbd78('0x73'),'ut',_0xbd78('0x74'))[_0xbd78('0x40')](_0xbd78('0x75'),_0x41f1e7['params']['id']);for(var _0x30be42=0x0;_0x30be42<_0x2023dd[_0xbd78('0x3b')];_0x30be42+=0x1){let _0x4d58c6=_0x2023dd[_0x30be42];for(var _0x30a0f2=0x0;_0x30a0f2<_0x4d58c6[_0xbd78('0x67')][_0xbd78('0x3b')];_0x30a0f2+=0x1){let _0x346b1d=_0x4d58c6[_0xbd78('0x67')][_0x30a0f2];var _0xba070d=_0x3013c8[_0xbd78('0x76')]();_0xba070d[_0xbd78('0x40')](_0xbd78('0x77'),_0x346b1d['id']);_0x58bafd[_0xbd78('0x78')](db['sequelize'][_0xbd78('0x35')](_0xba070d[_0xbd78('0x79')](),{'type':db['sequelize'][_0xbd78('0x7a')][_0xbd78('0x7b')]})['then'](function(_0x35a16d){if(_0x35a16d[_0xbd78('0x3b')]===0x1){return _0x346b1d['id'];}else{var _0xaa5a6a=_['every'](_[_0xbd78('0x2f')](_0x35a16d,_0xbd78('0x7c')),function(_0x15d954){return _['includes'](_0x3a8ef8,_0x15d954);});if(_0xaa5a6a){return _0x346b1d['id'];}}}));}}return BPromise[_0xbd78('0x7d')](_0x58bafd)[_0xbd78('0x27')](function(_0x1a75f0){_0x56fcfd=_(_0x56fcfd)['union'](_0x1a75f0)[_0xbd78('0x7e')]()['value']();return db[_0xbd78('0x30')][_0xbd78('0x54')]({'where':{'id':_0x41f1e7[_0xbd78('0x4c')]['id']}})[_0xbd78('0x27')](function(_0x4c6e4a){return db[_0xbd78('0x7f')][_0xbd78('0x6c')](function(_0x4d6a51){return _0x4c6e4a[_0xbd78('0x6e')](_0x41f1e7['query'][_0xbd78('0x64')],{'transaction':_0x4d6a51})[_0xbd78('0x27')](function(){if(!_['isEmpty'](_0x56fcfd)){return _0x4c6e4a['removeAgents'](_0x56fcfd,{'transaction':_0x4d6a51});}})[_0xbd78('0x27')](function(){_0x56fcfd[_0xbd78('0x6d')](function(_0x17f1f5){socket['emit'](_0xbd78('0x80'),{'UserId':_0x17f1f5,'FaxQueueId':_0x4c6e4a['id']});});});});});});})[_0xbd78('0x27')](respondWithStatusCode(_0x102cae,null))[_0xbd78('0x4a')](handleError(_0x102cae,null));};exports['addAgents']=function(_0x4d8079,_0x1f2d3d,_0x8bc4a8){return db[_0xbd78('0x30')]['find']({'where':{'id':_0x4d8079[_0xbd78('0x4c')]['id']}})[_0xbd78('0x27')](handleEntityNotFound(_0x1f2d3d,null))[_0xbd78('0x27')](function(_0x4ea1c7){if(_0x4ea1c7){return _0x4ea1c7[_0xbd78('0x81')](_0x4d8079[_0xbd78('0x53')][_0xbd78('0x64')],_['omit'](_0x4d8079[_0xbd78('0x53')],[_0xbd78('0x64'),'id'])||{})[_0xbd78('0x82')](function(_0x206a2b){for(var _0x668ac9=0x0;_0x668ac9<_0x4d8079[_0xbd78('0x53')][_0xbd78('0x64')][_0xbd78('0x3b')];_0x668ac9+=0x1){socket[_0xbd78('0x83')](_0xbd78('0x84'),{'UserId':_0x4d8079[_0xbd78('0x53')][_0xbd78('0x64')][_0x668ac9],'FaxQueueId':_0x4d8079[_0xbd78('0x4c')]['id']});}return _0x206a2b;});}})[_0xbd78('0x27')](respondWithResult(_0x1f2d3d,null))[_0xbd78('0x4a')](handleError(_0x1f2d3d,null));};exports[_0xbd78('0x85')]=function(_0x3d0dda,_0x3effff,_0x5c79c7){return db['FaxQueue'][_0xbd78('0x54')]({'where':{'id':_0x3d0dda[_0xbd78('0x4c')]['id']}})[_0xbd78('0x27')](handleEntityNotFound(_0x3effff,null))[_0xbd78('0x27')](function(_0x2c75b2){if(_0x2c75b2){return _0x2c75b2[_0xbd78('0x85')](_0x3d0dda[_0xbd78('0x35')][_0xbd78('0x64')])[_0xbd78('0x27')](function(){if(_[_0xbd78('0x86')](_0x3d0dda[_0xbd78('0x35')]['ids'])){for(var _0x1eef3a=0x0;_0x1eef3a<_0x3d0dda['query'][_0xbd78('0x64')][_0xbd78('0x3b')];_0x1eef3a+=0x1){socket[_0xbd78('0x83')](_0xbd78('0x80'),{'UserId':Number(_0x3d0dda['query'][_0xbd78('0x64')][_0x1eef3a]),'FaxQueueId':Number(_0x3d0dda[_0xbd78('0x4c')]['id'])});}}else{socket['emit'](_0xbd78('0x80'),{'UserId':Number(_0x3d0dda[_0xbd78('0x35')]['ids']),'FaxQueueId':Number(_0x3d0dda[_0xbd78('0x4c')]['id'])});}});}})[_0xbd78('0x27')](respondWithStatusCode(_0x3effff,null))[_0xbd78('0x4a')](handleError(_0x3effff,null));};exports[_0xbd78('0x87')]=function(_0xae8d4a,_0x1a32bf,_0x3f41a4){var _0x510ef2={};var _0x64bd46={};var _0x107cb3;var _0x436ca6;return db[_0xbd78('0x30')][_0xbd78('0x57')]({'where':{'id':_0xae8d4a[_0xbd78('0x4c')]['id']}})[_0xbd78('0x27')](handleEntityNotFound(_0x1a32bf,null))[_0xbd78('0x27')](function(_0x2b4997){if(_0x2b4997){_0x107cb3=_0x2b4997;_0x64bd46['model']=_['keys'](db[_0xbd78('0x66')][_0xbd78('0x31')]);_0x64bd46['query']=_['keys'](_0xae8d4a[_0xbd78('0x35')]);_0x64bd46[_0xbd78('0x37')]=_[_0xbd78('0x38')](_0x64bd46['model'],_0x64bd46[_0xbd78('0x35')]);_0x510ef2['attributes']=_[_0xbd78('0x38')](_0x64bd46[_0xbd78('0x34')],qs[_0xbd78('0x3a')](_0xae8d4a['query']['fields']));_0x510ef2[_0xbd78('0x39')]=_0x510ef2['attributes']['length']?_0x510ef2[_0xbd78('0x39')]:_0x64bd46[_0xbd78('0x34')];_0x510ef2[_0xbd78('0x3e')]=qs[_0xbd78('0x3f')](_0xae8d4a['query'][_0xbd78('0x3f')]);_0x510ef2[_0xbd78('0x40')]=qs[_0xbd78('0x37')](_[_0xbd78('0x41')](_0xae8d4a['query'],_0x64bd46[_0xbd78('0x37')]));if(_0xae8d4a[_0xbd78('0x35')]['filter']){_0x510ef2[_0xbd78('0x40')]=_[_0xbd78('0x43')](_0x510ef2[_0xbd78('0x40')],{'$or':_[_0xbd78('0x2f')](_0x510ef2[_0xbd78('0x39')],function(_0x2e8df1){var _0x46f065={};_0x46f065[_0x2e8df1]={'$like':'%'+_0xae8d4a[_0xbd78('0x35')]['filter']+'%'};return _0x46f065;})});}_0x510ef2=_[_0xbd78('0x43')]({},_0x510ef2,_0xae8d4a[_0xbd78('0x45')]);return _0x107cb3[_0xbd78('0x87')](_0x510ef2);}})[_0xbd78('0x27')](function(_0x4a12b6){if(_0x4a12b6){_0x436ca6=_0x4a12b6[_0xbd78('0x3b')];if(!_0xae8d4a[_0xbd78('0x35')]['hasOwnProperty']('nolimit')){_0x510ef2[_0xbd78('0x21')]=qs['limit'](_0xae8d4a['query'][_0xbd78('0x21')]);_0x510ef2[_0xbd78('0x20')]=qs[_0xbd78('0x20')](_0xae8d4a[_0xbd78('0x35')][_0xbd78('0x20')]);}return _0x107cb3['getAgents'](_0x510ef2);}})['then'](function(_0x5cbd50){if(_0x5cbd50){return _0x5cbd50?{'count':_0x436ca6,'rows':_0x5cbd50}:null;}})[_0xbd78('0x27')](respondWithResult(_0x1a32bf,null))[_0xbd78('0x4a')](handleError(_0x1a32bf,null));}; \ No newline at end of file +var _0xc551=['FaxQueueId','findAndCountAll','faxPause','createdAt','format','SIP','updatedAt','getTeams','addTeams','ids','Team','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','User','select','field','tq.TeamId','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','FaxQueues','error','stack','name','send','FaxQueue','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserFaxQueue'];(function(_0xcbdbb1,_0x2cf3b9){var _0x356ec5=function(_0x540404){while(--_0x540404){_0xcbdbb1['push'](_0xcbdbb1['shift']());}};_0x356ec5(++_0x2cf3b9);}(_0xc551,0xbd));var _0x1c55=function(_0x1a1b45,_0x19b8c4){_0x1a1b45=_0x1a1b45-0x0;var _0x3c0168=_0xc551[_0x1a1b45];return _0x3c0168;};'use strict';var pdf=require(_0x1c55('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1c55('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1c55('0x2'));var rp=require('request-promise');var moment=require(_0x1c55('0x3'));var BPromise=require(_0x1c55('0x4'));var Mustache=require(_0x1c55('0x5'));var util=require(_0x1c55('0x6'));var path=require(_0x1c55('0x7'));var sox=require(_0x1c55('0x8'));var csv=require(_0x1c55('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1c55('0xa'));var squel=require('squel');var crypto=require(_0x1c55('0xb'));var jsforce=require(_0x1c55('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1c55('0xd'));var Papa=require(_0x1c55('0xe'));var Redis=require(_0x1c55('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1c55('0x10'));var as=require(_0x1c55('0x11'));var hardwareService=require(_0x1c55('0x12'));var logger=require('../../config/logger')(_0x1c55('0x13'));var utils=require('../../config/utils');var config=require(_0x1c55('0x14'));var licenseUtil=require(_0x1c55('0x15'));var db=require(_0x1c55('0x16'))['db'];config['redis']=_[_0x1c55('0x17')](config[_0x1c55('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x1c55('0x19'))(new Redis(config[_0x1c55('0x18')]));require(_0x1c55('0x1a'))[_0x1c55('0x1b')](socket);function respondWithStatusCode(_0x2b90cf,_0xb2d749){_0xb2d749=_0xb2d749||0xcc;return function(_0x564f81){if(_0x564f81){return _0x2b90cf[_0x1c55('0x1c')](_0xb2d749);}return _0x2b90cf[_0x1c55('0x1d')](_0xb2d749)[_0x1c55('0x1e')]();};}function respondWithResult(_0xca1824,_0x1f33ad){_0x1f33ad=_0x1f33ad||0xc8;return function(_0x271486){if(_0x271486){return _0xca1824[_0x1c55('0x1d')](_0x1f33ad)[_0x1c55('0x1f')](_0x271486);}};}function respondWithFilteredResult(_0x311a92,_0x5056a6){return function(_0x4b5b18){if(_0x4b5b18){var _0x5a977a=_0x4b5b18[_0x1c55('0x20')],_0x3d37e2=_0x5056a6[_0x1c55('0x21')],_0x4ce070=_0x5056a6[_0x1c55('0x21')]+_0x5056a6[_0x1c55('0x22')],_0x3691d1;if(_0x4ce070>=_0x5a977a){_0x4ce070=_0x5a977a;_0x3691d1=0xc8;}else{_0x3691d1=0xce;}_0x311a92[_0x1c55('0x1d')](_0x3691d1);return _0x311a92[_0x1c55('0x23')](_0x1c55('0x24'),_0x3d37e2+'-'+_0x4ce070+'/'+_0x5a977a)[_0x1c55('0x1f')](_0x4b5b18);}return null;};}function patchUpdates(_0x72d9be){return function(_0x53c16a){try{jsonpatch[_0x1c55('0x25')](_0x53c16a,_0x72d9be,!![]);}catch(_0x3a34b5){return BPromise['reject'](_0x3a34b5);}return _0x53c16a[_0x1c55('0x26')]();};}function saveUpdates(_0x7d5be4,_0x1f3eac){return function(_0x177a5d){if(_0x177a5d){return _0x177a5d[_0x1c55('0x27')](_0x7d5be4)['then'](function(_0x3a9b29){return _0x3a9b29;});}return null;};}function removeEntity(_0x42a2e0,_0x9abff1){return function(_0x5880ff){if(_0x5880ff){return _0x5880ff[_0x1c55('0x28')]()[_0x1c55('0x29')](function(){var _0x1cd302=_0x5880ff['get']({'plain':!![]});var _0x5d669b=_0x1c55('0x2a');return db['UserProfileResource'][_0x1c55('0x28')]({'where':{'type':_0x5d669b,'resourceId':_0x1cd302['id']}})[_0x1c55('0x29')](function(){return _0x5880ff;});})[_0x1c55('0x29')](function(){_0x42a2e0[_0x1c55('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f81f,_0x35a4d7){return function(_0x349f57){if(!_0x349f57){_0x4f81f['sendStatus'](0x194);}return _0x349f57;};}function handleError(_0x1db020,_0x43aa4f){_0x43aa4f=_0x43aa4f||0x1f4;return function(_0x402478){logger[_0x1c55('0x2b')](_0x402478[_0x1c55('0x2c')]);if(_0x402478[_0x1c55('0x2d')]){delete _0x402478[_0x1c55('0x2d')];}_0x1db020[_0x1c55('0x1d')](_0x43aa4f)[_0x1c55('0x2e')](_0x402478);};}exports['index']=function(_0x3b9db1,_0x4ff936){var _0x36bebf={},_0x3f3482={},_0x34638c={'count':0x0,'rows':[]};var _0x60958e=_['map'](db[_0x1c55('0x2f')][_0x1c55('0x30')],function(_0x2c11c2){return{'name':_0x2c11c2[_0x1c55('0x31')],'type':_0x2c11c2[_0x1c55('0x32')][_0x1c55('0x33')]};});_0x3f3482['model']=_[_0x1c55('0x34')](_0x60958e,'name');_0x3f3482[_0x1c55('0x35')]=_[_0x1c55('0x36')](_0x3b9db1['query']);_0x3f3482[_0x1c55('0x37')]=_[_0x1c55('0x38')](_0x3f3482[_0x1c55('0x39')],_0x3f3482[_0x1c55('0x35')]);_0x36bebf['attributes']=_['intersection'](_0x3f3482['model'],qs[_0x1c55('0x3a')](_0x3b9db1[_0x1c55('0x35')][_0x1c55('0x3a')]));_0x36bebf[_0x1c55('0x3b')]=_0x36bebf['attributes'][_0x1c55('0x3c')]?_0x36bebf['attributes']:_0x3f3482['model'];if(!_0x3b9db1[_0x1c55('0x35')][_0x1c55('0x3d')](_0x1c55('0x3e'))){_0x36bebf['limit']=qs[_0x1c55('0x22')](_0x3b9db1[_0x1c55('0x35')][_0x1c55('0x22')]);_0x36bebf[_0x1c55('0x21')]=qs[_0x1c55('0x21')](_0x3b9db1['query'][_0x1c55('0x21')]);}_0x36bebf[_0x1c55('0x3f')]=qs[_0x1c55('0x40')](_0x3b9db1[_0x1c55('0x35')]['sort']);_0x36bebf['where']=qs[_0x1c55('0x37')](_[_0x1c55('0x41')](_0x3b9db1[_0x1c55('0x35')],_0x3f3482[_0x1c55('0x37')]),_0x60958e);if(_0x3b9db1['query'][_0x1c55('0x42')]){_0x36bebf[_0x1c55('0x43')]=_[_0x1c55('0x44')](_0x36bebf['where'],{'$or':_['map'](_0x60958e,function(_0x3d52c1){if(_0x3d52c1[_0x1c55('0x32')]!==_0x1c55('0x45')){var _0x3596c5={};_0x3596c5[_0x3d52c1[_0x1c55('0x2d')]]={'$like':'%'+_0x3b9db1[_0x1c55('0x35')][_0x1c55('0x42')]+'%'};return _0x3596c5;}})});}_0x36bebf=_[_0x1c55('0x44')]({},_0x36bebf,_0x3b9db1[_0x1c55('0x46')]);var _0x466ca7={'where':_0x36bebf[_0x1c55('0x43')]};return db[_0x1c55('0x2f')][_0x1c55('0x20')](_0x466ca7)['then'](function(_0x45fe11){_0x34638c[_0x1c55('0x20')]=_0x45fe11;if(_0x3b9db1[_0x1c55('0x35')][_0x1c55('0x47')]){_0x36bebf[_0x1c55('0x48')]=[{'all':!![]}];}return db[_0x1c55('0x2f')][_0x1c55('0x49')](_0x36bebf);})[_0x1c55('0x29')](function(_0x4afbad){_0x34638c[_0x1c55('0x4a')]=_0x4afbad;return _0x34638c;})[_0x1c55('0x29')](respondWithFilteredResult(_0x4ff936,_0x36bebf))[_0x1c55('0x4b')](handleError(_0x4ff936,null));};exports['show']=function(_0x218004,_0x341fce){var _0x210e29={'raw':!![],'where':{'id':_0x218004[_0x1c55('0x4c')]['id']}},_0x1183b7={};_0x1183b7['model']=_['keys'](db[_0x1c55('0x2f')][_0x1c55('0x30')]);_0x1183b7[_0x1c55('0x35')]=_[_0x1c55('0x36')](_0x218004['query']);_0x1183b7[_0x1c55('0x37')]=_[_0x1c55('0x38')](_0x1183b7[_0x1c55('0x39')],_0x1183b7[_0x1c55('0x35')]);_0x210e29[_0x1c55('0x3b')]=_[_0x1c55('0x38')](_0x1183b7['model'],qs['fields'](_0x218004[_0x1c55('0x35')]['fields']));_0x210e29[_0x1c55('0x3b')]=_0x210e29['attributes']['length']?_0x210e29[_0x1c55('0x3b')]:_0x1183b7[_0x1c55('0x39')];if(_0x218004['query']['includeAll']){_0x210e29[_0x1c55('0x48')]=[{'all':!![]}];}_0x210e29=_[_0x1c55('0x44')]({},_0x210e29,_0x218004[_0x1c55('0x46')]);return db[_0x1c55('0x2f')][_0x1c55('0x4d')](_0x210e29)[_0x1c55('0x29')](handleEntityNotFound(_0x341fce,null))[_0x1c55('0x29')](respondWithResult(_0x341fce,null))[_0x1c55('0x4b')](handleError(_0x341fce,null));};exports[_0x1c55('0x4e')]=function(_0x3b0d59,_0x1fec47){return db['FaxQueue'][_0x1c55('0x4e')](_0x3b0d59[_0x1c55('0x4f')],{})[_0x1c55('0x29')](function(_0x20a4d1){var _0x1b636a=_0x3b0d59[_0x1c55('0x50')]['get']({'plain':!![]});if(!_0x1b636a)throw new Error(_0x1c55('0x51'));if(_0x1b636a[_0x1c55('0x52')]===_0x1c55('0x50')){var _0x49780c=_0x20a4d1[_0x1c55('0x53')]({'plain':!![]});var _0x16230f=_0x1c55('0x2a');return db[_0x1c55('0x54')]['find']({'where':{'name':_0x16230f,'userProfileId':_0x1b636a['userProfileId']},'raw':!![]})[_0x1c55('0x29')](function(_0x34484d){if(_0x34484d&&_0x34484d[_0x1c55('0x55')]===0x0){return db[_0x1c55('0x56')][_0x1c55('0x4e')]({'name':_0x49780c[_0x1c55('0x2d')],'resourceId':_0x49780c['id'],'type':_0x34484d[_0x1c55('0x2d')],'sectionId':_0x34484d['id']},{})[_0x1c55('0x29')](function(){return _0x20a4d1;});}else{return _0x20a4d1;}})[_0x1c55('0x4b')](function(_0x475bf7){logger['error'](_0x1c55('0x57'),_0x475bf7);throw _0x475bf7;});}return _0x20a4d1;})['then'](respondWithResult(_0x1fec47,0xc9))[_0x1c55('0x4b')](handleError(_0x1fec47,null));};exports['update']=function(_0x366da0,_0xf44500){if(_0x366da0['body']['id']){delete _0x366da0[_0x1c55('0x4f')]['id'];}return db['FaxQueue'][_0x1c55('0x4d')]({'where':{'id':_0x366da0[_0x1c55('0x4c')]['id']}})[_0x1c55('0x29')](handleEntityNotFound(_0xf44500,null))[_0x1c55('0x29')](saveUpdates(_0x366da0[_0x1c55('0x4f')],null))[_0x1c55('0x29')](respondWithResult(_0xf44500,null))[_0x1c55('0x4b')](handleError(_0xf44500,null));};exports['destroy']=function(_0x385573,_0x56463d){return db[_0x1c55('0x2f')]['find']({'where':{'id':_0x385573[_0x1c55('0x4c')]['id']}})[_0x1c55('0x29')](handleEntityNotFound(_0x56463d,null))[_0x1c55('0x29')](removeEntity(_0x56463d,null))[_0x1c55('0x4b')](handleError(_0x56463d,null));};exports['describe']=function(_0x569f23,_0x2261d6){return db[_0x1c55('0x2f')][_0x1c55('0x58')]()['then'](respondWithResult(_0x2261d6,null))[_0x1c55('0x4b')](handleError(_0x2261d6,null));};exports['getMembers']=function(_0x4f580c,_0x180655,_0x501ec4){var _0x52b8c7={'raw':!![],'where':{}},_0x11c055={},_0x2082e9;return db[_0x1c55('0x2f')][_0x1c55('0x59')]({'where':{'id':_0x4f580c[_0x1c55('0x4c')]['id']}})[_0x1c55('0x29')](handleEntityNotFound(_0x180655,null))[_0x1c55('0x29')](function(_0x2fb9c4){if(_0x2fb9c4){_0x2082e9=_0x2fb9c4[_0x1c55('0x53')]({'plain':!![]});_0x11c055[_0x1c55('0x39')]=_['keys'](db[_0x1c55('0x5a')][_0x1c55('0x30')]);_0x11c055[_0x1c55('0x35')]=_['keys'](_0x4f580c[_0x1c55('0x35')]);_0x11c055[_0x1c55('0x37')]=_[_0x1c55('0x38')](_0x11c055['model'],_0x11c055['query']);_0x52b8c7[_0x1c55('0x3b')]=_['intersection'](_0x11c055[_0x1c55('0x39')],qs[_0x1c55('0x3a')](_0x4f580c['query'][_0x1c55('0x3a')]));_0x52b8c7['attributes']=_0x52b8c7[_0x1c55('0x3b')]['length']?_0x52b8c7[_0x1c55('0x3b')]:_0x11c055[_0x1c55('0x39')];if(!_0x4f580c['query'][_0x1c55('0x3d')](_0x1c55('0x3e'))){_0x52b8c7[_0x1c55('0x22')]=qs[_0x1c55('0x22')](_0x4f580c['query']['limit']);_0x52b8c7[_0x1c55('0x21')]=qs[_0x1c55('0x21')](_0x4f580c['query'][_0x1c55('0x21')]);}_0x52b8c7[_0x1c55('0x3f')]=qs[_0x1c55('0x40')](_0x4f580c['query']['sort']);_0x52b8c7[_0x1c55('0x43')]=qs[_0x1c55('0x37')](_[_0x1c55('0x41')](_0x4f580c[_0x1c55('0x35')],_0x11c055[_0x1c55('0x37')]));_0x52b8c7[_0x1c55('0x43')][_0x1c55('0x5b')]=_0x2fb9c4['id'];if(_0x4f580c['query']['filter']){_0x52b8c7['where']=_[_0x1c55('0x44')](_0x52b8c7[_0x1c55('0x43')],{'$or':_[_0x1c55('0x34')](_0x52b8c7[_0x1c55('0x3b')],function(_0x48b171){var _0x59a0e2={};_0x59a0e2[_0x48b171]={'$like':'%'+_0x4f580c[_0x1c55('0x35')]['filter']+'%'};return _0x59a0e2;})});}_0x52b8c7=_[_0x1c55('0x44')]({},_0x52b8c7,_0x4f580c['options']);return db['UserFaxQueue']['findAll'](_0x52b8c7);}})[_0x1c55('0x29')](function(_0x157d19){if(_0x157d19){return db['User'][_0x1c55('0x5c')]({'where':{'id':_['map'](_0x157d19,'UserId'),'role':'agent'},'attributes':['id','name',_0x1c55('0x5d'),'updatedAt',_0x1c55('0x5e')]});}})[_0x1c55('0x29')](function(_0x29d644){if(_0x29d644){return{'count':_0x29d644['count'],'rows':_['map'](_0x29d644[_0x1c55('0x4a')],function(_0x13aca0){return{'membername':_0x13aca0[_0x1c55('0x2d')],'UserId':_0x13aca0['id'],'queue_name':_0x2082e9[_0x1c55('0x2d')],'FaxQueueId':_0x2082e9['id'],'interface':util[_0x1c55('0x5f')]('%s/%s',_0x1c55('0x60'),_0x13aca0[_0x1c55('0x2d')]),'penalty':0x0,'paused':_0x13aca0['faxPause'],'createdAt':_0x13aca0[_0x1c55('0x5e')],'updatedAt':_0x13aca0[_0x1c55('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x180655,_0x52b8c7))[_0x1c55('0x4b')](handleError(_0x180655,null));};exports[_0x1c55('0x62')]=function(_0x741484,_0x52dcea,_0x15cee3){var _0x493832={};var _0x1e7068={};var _0x292b88;var _0x362c62;return db[_0x1c55('0x2f')][_0x1c55('0x59')]({'where':{'id':_0x741484[_0x1c55('0x4c')]['id']}})[_0x1c55('0x29')](handleEntityNotFound(_0x52dcea,null))['then'](function(_0x51dee2){if(_0x51dee2){_0x292b88=_0x51dee2;_0x1e7068[_0x1c55('0x39')]=_[_0x1c55('0x36')](db['Team']['rawAttributes']);_0x1e7068[_0x1c55('0x35')]=_[_0x1c55('0x36')](_0x741484[_0x1c55('0x35')]);_0x1e7068['filters']=_[_0x1c55('0x38')](_0x1e7068[_0x1c55('0x39')],_0x1e7068[_0x1c55('0x35')]);_0x493832[_0x1c55('0x3b')]=_[_0x1c55('0x38')](_0x1e7068['model'],qs[_0x1c55('0x3a')](_0x741484['query']['fields']));_0x493832[_0x1c55('0x3b')]=_0x493832[_0x1c55('0x3b')][_0x1c55('0x3c')]?_0x493832['attributes']:_0x1e7068['model'];_0x493832[_0x1c55('0x3f')]=qs[_0x1c55('0x40')](_0x741484[_0x1c55('0x35')][_0x1c55('0x40')]);_0x493832[_0x1c55('0x43')]=qs[_0x1c55('0x37')](_[_0x1c55('0x41')](_0x741484[_0x1c55('0x35')],_0x1e7068[_0x1c55('0x37')]));if(_0x741484[_0x1c55('0x35')][_0x1c55('0x42')]){_0x493832[_0x1c55('0x43')]=_[_0x1c55('0x44')](_0x493832[_0x1c55('0x43')],{'$or':_[_0x1c55('0x34')](_0x493832[_0x1c55('0x3b')],function(_0x22644a){var _0x340257={};_0x340257[_0x22644a]={'$like':'%'+_0x741484[_0x1c55('0x35')][_0x1c55('0x42')]+'%'};return _0x340257;})});}_0x493832=_[_0x1c55('0x44')]({},_0x493832,_0x741484[_0x1c55('0x46')]);return _0x292b88[_0x1c55('0x62')](_0x493832);}})[_0x1c55('0x29')](function(_0xd97fc0){if(_0xd97fc0){_0x362c62=_0xd97fc0['length'];if(!_0x741484[_0x1c55('0x35')]['hasOwnProperty'](_0x1c55('0x3e'))){_0x493832[_0x1c55('0x22')]=qs['limit'](_0x741484[_0x1c55('0x35')]['limit']);_0x493832[_0x1c55('0x21')]=qs[_0x1c55('0x21')](_0x741484[_0x1c55('0x35')][_0x1c55('0x21')]);}return _0x292b88[_0x1c55('0x62')](_0x493832);}})[_0x1c55('0x29')](function(_0x11fd7d){if(_0x11fd7d){return _0x11fd7d?{'count':_0x362c62,'rows':_0x11fd7d}:null;}})[_0x1c55('0x29')](respondWithResult(_0x52dcea,null))[_0x1c55('0x4b')](handleError(_0x52dcea,null));};exports[_0x1c55('0x63')]=function(_0x515d35,_0x519f30,_0x536c28){var _0x40c2dc=_0x515d35['body'][_0x1c55('0x64')];return db[_0x1c55('0x65')][_0x1c55('0x49')]({'where':{'id':_0x40c2dc},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x1c55('0x2d'),_0x1c55('0x66'),_0x1c55('0x67'),_0x1c55('0x68')],'raw':!![]}]})[_0x1c55('0x29')](function(_0x37f68a){if(_0x37f68a){var _0x32b671=_[_0x1c55('0x69')](_0x37f68a,function(_0x328808){var _0x4ade79=_0x328808[_0x1c55('0x53')]({'plain':!![]});return _0x4ade79[_0x1c55('0x6a')];});return db[_0x1c55('0x2f')][_0x1c55('0x4d')]({'where':{'id':_0x515d35[_0x1c55('0x4c')]['id']}})[_0x1c55('0x29')](function(_0x2fa1aa){return db[_0x1c55('0x6b')][_0x1c55('0x6c')](function(_0x2d3fbc){return _0x2fa1aa[_0x1c55('0x63')](_0x40c2dc,{'transaction':_0x2d3fbc})[_0x1c55('0x29')](function(){return BPromise[_0x1c55('0x6d')](_0x32b671,function(_0x25e05c){return db['UserFaxQueue'][_0x1c55('0x6e')]({'where':{'UserId':_0x25e05c['id'],'FaxQueueId':_0x515d35[_0x1c55('0x4c')]['id']},'transaction':_0x2d3fbc});});})[_0x1c55('0x29')](function(){_0x32b671[_0x1c55('0x6f')](function(_0x591120){socket[_0x1c55('0x70')]('userFaxQueue:save',{'UserId':_0x591120['id'],'FaxQueueId':_0x2fa1aa['id']});});});});});}})[_0x1c55('0x29')](respondWithStatusCode(_0x519f30,null))[_0x1c55('0x4b')](handleError(_0x519f30,null));};exports[_0x1c55('0x71')]=function(_0x40ff02,_0x6ee01d,_0x444f93){return db['Team'][_0x1c55('0x49')]({'where':{'id':_0x40ff02[_0x1c55('0x35')][_0x1c55('0x64')]},'attributes':['id'],'include':[{'model':db[_0x1c55('0x72')],'as':_0x1c55('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x1c55('0x29')](handleEntityNotFound(_0x6ee01d,null))['then'](function(_0x120447){var _0x2d23dd=_[_0x1c55('0x34')](_0x120447,'id');var _0x278e1f=[];var _0x5edd7a=[];var _0x2d0b4c=squel[_0x1c55('0x73')]();_0x2d0b4c[_0x1c55('0x74')](_0x1c55('0x75'))['from'](_0x1c55('0x76'),'tq')[_0x1c55('0x77')]('user_has_teams','ut',_0x1c55('0x78'))[_0x1c55('0x43')](_0x1c55('0x79'),_0x40ff02[_0x1c55('0x4c')]['id']);for(var _0x5754d4=0x0;_0x5754d4<_0x120447[_0x1c55('0x3c')];_0x5754d4+=0x1){let _0x5cb4e5=_0x120447[_0x5754d4];for(var _0x5a7eb1=0x0;_0x5a7eb1<_0x5cb4e5[_0x1c55('0x6a')][_0x1c55('0x3c')];_0x5a7eb1+=0x1){let _0x2a050a=_0x5cb4e5[_0x1c55('0x6a')][_0x5a7eb1];var _0x147ce9=_0x2d0b4c[_0x1c55('0x7a')]();_0x147ce9[_0x1c55('0x43')](_0x1c55('0x7b'),_0x2a050a['id']);_0x5edd7a[_0x1c55('0x7c')](db[_0x1c55('0x6b')]['query'](_0x147ce9[_0x1c55('0x7d')](),{'type':db[_0x1c55('0x6b')][_0x1c55('0x7e')]['SELECT']})[_0x1c55('0x29')](function(_0x30b3c5){if(_0x30b3c5['length']===0x1){return _0x2a050a['id'];}else{var _0x59639f=_['every'](_[_0x1c55('0x34')](_0x30b3c5,_0x1c55('0x7f')),function(_0x7c12ef){return _[_0x1c55('0x80')](_0x2d23dd,_0x7c12ef);});if(_0x59639f){return _0x2a050a['id'];}}}));}}return BPromise[_0x1c55('0x81')](_0x5edd7a)['then'](function(_0x4ed9eb){_0x278e1f=_(_0x278e1f)['union'](_0x4ed9eb)[_0x1c55('0x82')]()[_0x1c55('0x83')]();return db[_0x1c55('0x2f')][_0x1c55('0x4d')]({'where':{'id':_0x40ff02[_0x1c55('0x4c')]['id']}})['then'](function(_0x368aaa){return db[_0x1c55('0x6b')][_0x1c55('0x6c')](function(_0xff8a1e){return _0x368aaa['removeTeams'](_0x40ff02['query'][_0x1c55('0x64')],{'transaction':_0xff8a1e})[_0x1c55('0x29')](function(){if(!_[_0x1c55('0x84')](_0x278e1f)){return _0x368aaa[_0x1c55('0x85')](_0x278e1f,{'transaction':_0xff8a1e});}})[_0x1c55('0x29')](function(){_0x278e1f[_0x1c55('0x6f')](function(_0x59dbdf){socket[_0x1c55('0x70')](_0x1c55('0x86'),{'UserId':_0x59dbdf,'FaxQueueId':_0x368aaa['id']});});});});});});})[_0x1c55('0x29')](respondWithStatusCode(_0x6ee01d,null))[_0x1c55('0x4b')](handleError(_0x6ee01d,null));};exports[_0x1c55('0x87')]=function(_0x15fcb6,_0x2e1c42,_0x44c341){return db['FaxQueue'][_0x1c55('0x4d')]({'where':{'id':_0x15fcb6[_0x1c55('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2e1c42,null))[_0x1c55('0x29')](function(_0x427bcc){if(_0x427bcc){return _0x427bcc[_0x1c55('0x87')](_0x15fcb6[_0x1c55('0x4f')][_0x1c55('0x64')],_[_0x1c55('0x88')](_0x15fcb6[_0x1c55('0x4f')],[_0x1c55('0x64'),'id'])||{})[_0x1c55('0x89')](function(_0x50ca55){for(var _0x4f22e9=0x0;_0x4f22e9<_0x15fcb6['body'][_0x1c55('0x64')]['length'];_0x4f22e9+=0x1){socket['emit']('userFaxQueue:save',{'UserId':_0x15fcb6[_0x1c55('0x4f')][_0x1c55('0x64')][_0x4f22e9],'FaxQueueId':_0x15fcb6['params']['id']});}return _0x50ca55;});}})[_0x1c55('0x29')](respondWithResult(_0x2e1c42,null))[_0x1c55('0x4b')](handleError(_0x2e1c42,null));};exports['removeAgents']=function(_0x11fae6,_0x322733,_0xf0f96c){return db[_0x1c55('0x2f')][_0x1c55('0x4d')]({'where':{'id':_0x11fae6['params']['id']}})['then'](handleEntityNotFound(_0x322733,null))[_0x1c55('0x29')](function(_0x44dd4b){if(_0x44dd4b){return _0x44dd4b[_0x1c55('0x85')](_0x11fae6['query'][_0x1c55('0x64')])[_0x1c55('0x29')](function(){if(_[_0x1c55('0x8a')](_0x11fae6[_0x1c55('0x35')]['ids'])){for(var _0x4df229=0x0;_0x4df229<_0x11fae6['query'][_0x1c55('0x64')][_0x1c55('0x3c')];_0x4df229+=0x1){socket[_0x1c55('0x70')](_0x1c55('0x86'),{'UserId':Number(_0x11fae6['query'][_0x1c55('0x64')][_0x4df229]),'FaxQueueId':Number(_0x11fae6[_0x1c55('0x4c')]['id'])});}}else{socket[_0x1c55('0x70')]('userFaxQueue:remove',{'UserId':Number(_0x11fae6[_0x1c55('0x35')][_0x1c55('0x64')]),'FaxQueueId':Number(_0x11fae6[_0x1c55('0x4c')]['id'])});}});}})[_0x1c55('0x29')](respondWithStatusCode(_0x322733,null))[_0x1c55('0x4b')](handleError(_0x322733,null));};exports[_0x1c55('0x8b')]=function(_0x5dbd2c,_0x1f7f33,_0x2b6b62){var _0x5d96a1={};var _0x4f1efe={};var _0x4ede8e;var _0x28f6fc;return db['FaxQueue'][_0x1c55('0x59')]({'where':{'id':_0x5dbd2c[_0x1c55('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1f7f33,null))['then'](function(_0x46778d){if(_0x46778d){_0x4ede8e=_0x46778d;_0x4f1efe['model']=_[_0x1c55('0x36')](db[_0x1c55('0x72')][_0x1c55('0x30')]);_0x4f1efe[_0x1c55('0x35')]=_['keys'](_0x5dbd2c[_0x1c55('0x35')]);_0x4f1efe[_0x1c55('0x37')]=_[_0x1c55('0x38')](_0x4f1efe[_0x1c55('0x39')],_0x4f1efe['query']);_0x5d96a1[_0x1c55('0x3b')]=_[_0x1c55('0x38')](_0x4f1efe[_0x1c55('0x39')],qs[_0x1c55('0x3a')](_0x5dbd2c[_0x1c55('0x35')][_0x1c55('0x3a')]));_0x5d96a1[_0x1c55('0x3b')]=_0x5d96a1['attributes'][_0x1c55('0x3c')]?_0x5d96a1['attributes']:_0x4f1efe[_0x1c55('0x39')];_0x5d96a1[_0x1c55('0x3f')]=qs['sort'](_0x5dbd2c[_0x1c55('0x35')][_0x1c55('0x40')]);_0x5d96a1[_0x1c55('0x43')]=qs[_0x1c55('0x37')](_['pick'](_0x5dbd2c[_0x1c55('0x35')],_0x4f1efe[_0x1c55('0x37')]));if(_0x5dbd2c['query'][_0x1c55('0x42')]){_0x5d96a1[_0x1c55('0x43')]=_[_0x1c55('0x44')](_0x5d96a1[_0x1c55('0x43')],{'$or':_[_0x1c55('0x34')](_0x5d96a1[_0x1c55('0x3b')],function(_0x57c05e){var _0x53767b={};_0x53767b[_0x57c05e]={'$like':'%'+_0x5dbd2c[_0x1c55('0x35')][_0x1c55('0x42')]+'%'};return _0x53767b;})});}_0x5d96a1=_[_0x1c55('0x44')]({},_0x5d96a1,_0x5dbd2c[_0x1c55('0x46')]);return _0x4ede8e[_0x1c55('0x8b')](_0x5d96a1);}})[_0x1c55('0x29')](function(_0x233f97){if(_0x233f97){_0x28f6fc=_0x233f97[_0x1c55('0x3c')];if(!_0x5dbd2c['query'][_0x1c55('0x3d')](_0x1c55('0x3e'))){_0x5d96a1['limit']=qs[_0x1c55('0x22')](_0x5dbd2c[_0x1c55('0x35')][_0x1c55('0x22')]);_0x5d96a1[_0x1c55('0x21')]=qs[_0x1c55('0x21')](_0x5dbd2c[_0x1c55('0x35')][_0x1c55('0x21')]);}return _0x4ede8e[_0x1c55('0x8b')](_0x5d96a1);}})['then'](function(_0x4ec8fb){if(_0x4ec8fb){return _0x4ec8fb?{'count':_0x28f6fc,'rows':_0x4ec8fb}:null;}})[_0x1c55('0x29')](respondWithResult(_0x1f7f33,null))[_0x1c55('0x4b')](handleError(_0x1f7f33,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 201d8d9..ce3f487 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 _0x223a=['setMaxListeners','save','remove','emit','hasOwnProperty','events'];(function(_0x31abee,_0x11ff0c){var _0x3c1761=function(_0x2b5062){while(--_0x2b5062){_0x31abee['push'](_0x31abee['shift']());}};_0x3c1761(++_0x11ff0c);}(_0x223a,0x131));var _0xa223=function(_0xb46468,_0x1b8dd8){_0xb46468=_0xb46468-0x0;var _0x5d827b=_0x223a[_0xb46468];return _0x5d827b;};'use strict';var EventEmitter=require(_0xa223('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xa223('0x1')](0x0);var events={'afterCreate':_0xa223('0x2'),'afterUpdate':'update','afterDestroy':_0xa223('0x3')};function emitEvent(_0x4f7c07){return function(_0x40d5e0,_0x1b84e6,_0x4f81fa){FaxQueueEvents[_0xa223('0x4')](_0x4f7c07+':'+_0x40d5e0['id'],_0x40d5e0);FaxQueueEvents['emit'](_0x4f7c07,_0x40d5e0);_0x4f81fa(null);};}for(var e in events){if(events[_0xa223('0x5')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x1101=['hook','exports','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x1101,0x1df));var _0x1110=function(_0x49a801,_0x3e0dc3){_0x49a801=_0x49a801-0x0;var _0x23e5ef=_0x1101[_0x49a801];return _0x23e5ef;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x1110('0x0'))['db'][_0x1110('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x1110('0x2')](0x0);var events={'afterCreate':_0x1110('0x3'),'afterUpdate':_0x1110('0x4'),'afterDestroy':'remove'};function emitEvent(_0x31df0c){return function(_0x52c911,_0x41b72c,_0x28f94b){FaxQueueEvents[_0x1110('0x5')](_0x31df0c+':'+_0x52c911['id'],_0x52c911);FaxQueueEvents[_0x1110('0x5')](_0x31df0c,_0x52c911);_0x28f94b(null);};}for(var e in events){if(events[_0x1110('0x6')](e)){var event=events[e];FaxQueue[_0x1110('0x7')](e,emitEvent(event));}}module[_0x1110('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 2254ffb..4008301 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 _0xdd01=['moment','request-promise','path','rimraf','../../config/environment','exports','define','FaxQueue','util','../../config/logger','api'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xdd01,0x97));var _0x1dd0=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xdd01[_0x2aea9e];return _0x430b92;};'use strict';var _=require('lodash');var util=require(_0x1dd0('0x0'));var logger=require(_0x1dd0('0x1'))(_0x1dd0('0x2'));var moment=require(_0x1dd0('0x3'));var BPromise=require('bluebird');var rp=require(_0x1dd0('0x4'));var fs=require('fs');var path=require(_0x1dd0('0x5'));var rimraf=require(_0x1dd0('0x6'));var config=require(_0x1dd0('0x7'));var attributes=require('./faxQueue.attributes');module[_0x1dd0('0x8')]=function(_0x1c38ad,_0x5d4921){return _0x1c38ad[_0x1dd0('0x9')](_0x1dd0('0xa'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9477=['bluebird','request-promise','../../config/environment','define','FaxQueue','fax_queues','util','moment'];(function(_0x4f1d9a,_0x44fa56){var _0x1c5e92=function(_0x20279e){while(--_0x20279e){_0x4f1d9a['push'](_0x4f1d9a['shift']());}};_0x1c5e92(++_0x44fa56);}(_0x9477,0x15e));var _0x7947=function(_0xac1f27,_0x3f03b1){_0xac1f27=_0xac1f27-0x0;var _0x556029=_0x9477[_0xac1f27];return _0x556029;};'use strict';var _=require('lodash');var util=require(_0x7947('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7947('0x1'));var BPromise=require(_0x7947('0x2'));var rp=require(_0x7947('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7947('0x4'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0x6f92b3,_0x551679){return _0x6f92b3[_0x7947('0x5')](_0x7947('0x6'),attributes,{'tableName':_0x7947('0x7'),'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 759ef32..9972d75 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 _0x0f01=['where','include','map','model','attributes','debug','ShowFaxQueue','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options'];(function(_0x15adaa,_0x1f3295){var _0x4eb318=function(_0x2fd91f){while(--_0x2fd91f){_0x15adaa['push'](_0x15adaa['shift']());}};_0x4eb318(++_0x1f3295);}(_0x0f01,0xec));var _0x10f0=function(_0x3b5219,_0x124a0c){_0x3b5219=_0x3b5219-0x0;var _0x3e752f=_0x0f01[_0x3b5219];return _0x3e752f;};'use strict';var _=require('lodash');var util=require(_0x10f0('0x0'));var moment=require(_0x10f0('0x1'));var BPromise=require(_0x10f0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x10f0('0x3'));var db=require(_0x10f0('0x4'))['db'];var utils=require(_0x10f0('0x5'));var logger=require(_0x10f0('0x6'))(_0x10f0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x10f0('0x8')]=_[_0x10f0('0x9')](config[_0x10f0('0x8')],{'host':_0x10f0('0xa'),'port':0x18eb});var socket=require(_0x10f0('0xb'))(new Redis(config[_0x10f0('0x8')]));require(_0x10f0('0xc'))[_0x10f0('0xd')](socket);function respondWithRpcPromise(_0x1b7db7,_0x4dbb94,_0x782dc0){return new BPromise(function(_0x4f606b,_0x1765b2){return client[_0x10f0('0xe')](_0x1b7db7,_0x782dc0)[_0x10f0('0xf')](function(_0x423832){logger[_0x10f0('0x10')](_0x10f0('0x11'),_0x4dbb94,_0x10f0('0x12'));logger['debug'](_0x10f0('0x13'),_0x4dbb94,_0x10f0('0x12'),JSON[_0x10f0('0x14')](_0x423832));if(_0x423832['error']){if(_0x423832[_0x10f0('0x15')][_0x10f0('0x16')]===0x1f4){logger[_0x10f0('0x15')](_0x10f0('0x11'),_0x4dbb94,_0x423832[_0x10f0('0x15')][_0x10f0('0x17')]);return _0x1765b2(_0x423832['error'][_0x10f0('0x17')]);}logger[_0x10f0('0x15')](_0x10f0('0x11'),_0x4dbb94,_0x423832[_0x10f0('0x15')][_0x10f0('0x17')]);return _0x4f606b(_0x423832[_0x10f0('0x15')]['message']);}else{logger[_0x10f0('0x10')](_0x10f0('0x11'),_0x4dbb94,_0x10f0('0x12'));_0x4f606b(_0x423832[_0x10f0('0x18')][_0x10f0('0x17')]);}})[_0x10f0('0x19')](function(_0x34eca7){logger[_0x10f0('0x15')](_0x10f0('0x11'),_0x4dbb94,_0x34eca7);_0x1765b2(_0x34eca7);});});}exports[_0x10f0('0x1a')]=function(_0x3ed757){var _0xc8dee0=this;return new Promise(function(_0x2aa801,_0x1ba307){return db[_0x10f0('0x1b')][_0x10f0('0x1c')]({'raw':_0x3ed757[_0x10f0('0x1d')]?_0x3ed757[_0x10f0('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3ed757[_0x10f0('0x1d')]?_0x3ed757[_0x10f0('0x1d')][_0x10f0('0x1e')]||null:null,'attributes':_0x3ed757['options']?_0x3ed757[_0x10f0('0x1d')]['attributes']||null:null,'limit':_0x3ed757[_0x10f0('0x1d')]?_0x3ed757['options']['limit']||null:null,'include':_0x3ed757['options']?_0x3ed757[_0x10f0('0x1d')][_0x10f0('0x1f')]?_[_0x10f0('0x20')](_0x3ed757['options'][_0x10f0('0x1f')],function(_0x56e5d0){return{'model':db[_0x56e5d0[_0x10f0('0x21')]],'as':_0x56e5d0['as'],'attributes':_0x56e5d0['attributes'],'include':_0x56e5d0[_0x10f0('0x1f')]?_['map'](_0x56e5d0['include'],function(_0x4a45de){return{'model':db[_0x4a45de[_0x10f0('0x21')]],'as':_0x4a45de['as'],'attributes':_0x4a45de[_0x10f0('0x22')],'include':_0x4a45de[_0x10f0('0x1f')]?_[_0x10f0('0x20')](_0x4a45de[_0x10f0('0x1f')],function(_0x14e50c){return{'model':db[_0x14e50c[_0x10f0('0x21')]],'as':_0x14e50c['as'],'attributes':_0x14e50c[_0x10f0('0x22')]};}):[]};}):[]};}):[]:[]})[_0x10f0('0xf')](function(_0x57a4eb){logger[_0x10f0('0x10')]('GetFaxQueue',_0x3ed757);logger[_0x10f0('0x23')](_0x10f0('0x1a'),_0x3ed757,JSON[_0x10f0('0x14')](_0x57a4eb));_0x2aa801(_0x57a4eb);})['catch'](function(_0x11925b){logger[_0x10f0('0x15')](_0x10f0('0x1a'),_0x11925b[_0x10f0('0x17')],_0x3ed757);_0x1ba307(_0xc8dee0[_0x10f0('0x15')](0x1f4,_0x11925b[_0x10f0('0x17')]));});});};exports[_0x10f0('0x24')]=function(_0x4d3747){var _0xeb7903=this;return new Promise(function(_0x11e746,_0x2044db){return db[_0x10f0('0x1b')]['find']({'raw':_0x4d3747[_0x10f0('0x1d')]?_0x4d3747['options'][_0x10f0('0x25')]===undefined?!![]:![]:!![],'where':_0x4d3747[_0x10f0('0x1d')]?_0x4d3747[_0x10f0('0x1d')]['where']||null:null,'attributes':_0x4d3747[_0x10f0('0x1d')]?_0x4d3747['options'][_0x10f0('0x22')]||null:null,'include':_0x4d3747[_0x10f0('0x1d')]?_0x4d3747['options'][_0x10f0('0x1f')]?_[_0x10f0('0x20')](_0x4d3747[_0x10f0('0x1d')][_0x10f0('0x1f')],function(_0x3571f0){return{'model':db[_0x3571f0['model']],'as':_0x3571f0['as'],'attributes':_0x3571f0[_0x10f0('0x22')],'include':_0x3571f0['include']?_[_0x10f0('0x20')](_0x3571f0[_0x10f0('0x1f')],function(_0x27e8fb){return{'model':db[_0x27e8fb[_0x10f0('0x21')]],'as':_0x27e8fb['as'],'attributes':_0x27e8fb[_0x10f0('0x22')],'include':_0x27e8fb[_0x10f0('0x1f')]?_[_0x10f0('0x20')](_0x27e8fb['include'],function(_0x10e349){return{'model':db[_0x10e349[_0x10f0('0x21')]],'as':_0x10e349['as'],'attributes':_0x10e349[_0x10f0('0x22')]};}):[]};}):[]};}):[]:[]})[_0x10f0('0xf')](function(_0x5b24ed){logger[_0x10f0('0x10')](_0x10f0('0x24'),_0x4d3747);logger[_0x10f0('0x23')](_0x10f0('0x24'),_0x4d3747,JSON['stringify'](_0x5b24ed));_0x11e746(_0x5b24ed);})[_0x10f0('0x19')](function(_0x3ff79e){logger[_0x10f0('0x15')](_0x10f0('0x24'),_0x3ff79e['message'],_0x4d3747);_0x2044db(_0xeb7903[_0x10f0('0x15')](0x1f4,_0x3ff79e[_0x10f0('0x17')]));});});}; \ No newline at end of file +var _0x8de2=['code','FaxQueue,\x20%s,\x20%s','message','GetFaxQueue','FaxQueue','findAll','options','limit','include','map','model','attributes','stringify','catch','ShowFaxQueue','find','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','debug','request\x20sent','error'];(function(_0xd25629,_0x5b4f1f){var _0x3cff28=function(_0x48ed41){while(--_0x48ed41){_0xd25629['push'](_0xd25629['shift']());}};_0x3cff28(++_0x5b4f1f);}(_0x8de2,0x80));var _0x28de=function(_0x4b7150,_0x5c23df){_0x4b7150=_0x4b7150-0x0;var _0x298641=_0x8de2[_0x4b7150];return _0x298641;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x28de('0x0'));var BPromise=require(_0x28de('0x1'));var rs=require(_0x28de('0x2'));var fs=require('fs');var Redis=require(_0x28de('0x3'));var db=require(_0x28de('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x28de('0x5'))(_0x28de('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x28de('0x7')]['http']({'port':0x232a});config[_0x28de('0x8')]=_[_0x28de('0x9')](config[_0x28de('0x8')],{'host':_0x28de('0xa'),'port':0x18eb});var socket=require(_0x28de('0xb'))(new Redis(config[_0x28de('0x8')]));require(_0x28de('0xc'))[_0x28de('0xd')](socket);function respondWithRpcPromise(_0x51bc81,_0x2fa189,_0x19e26f){return new BPromise(function(_0x17825f,_0x4b3cf5){return client[_0x28de('0xe')](_0x51bc81,_0x19e26f)[_0x28de('0xf')](function(_0x1b964e){logger[_0x28de('0x10')]('FaxQueue,\x20%s,\x20%s',_0x2fa189,'request\x20sent');logger[_0x28de('0x11')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x2fa189,_0x28de('0x12'),JSON['stringify'](_0x1b964e));if(_0x1b964e[_0x28de('0x13')]){if(_0x1b964e[_0x28de('0x13')][_0x28de('0x14')]===0x1f4){logger[_0x28de('0x13')](_0x28de('0x15'),_0x2fa189,_0x1b964e['error'][_0x28de('0x16')]);return _0x4b3cf5(_0x1b964e['error'][_0x28de('0x16')]);}logger['error'](_0x28de('0x15'),_0x2fa189,_0x1b964e[_0x28de('0x13')][_0x28de('0x16')]);return _0x17825f(_0x1b964e[_0x28de('0x13')][_0x28de('0x16')]);}else{logger[_0x28de('0x10')](_0x28de('0x15'),_0x2fa189,'request\x20sent');_0x17825f(_0x1b964e['result'][_0x28de('0x16')]);}})['catch'](function(_0x486b1b){logger['error'](_0x28de('0x15'),_0x2fa189,_0x486b1b);_0x4b3cf5(_0x486b1b);});});}exports[_0x28de('0x17')]=function(_0x266ea9){var _0x377026=this;return new Promise(function(_0x42d843,_0x58c55d){return db[_0x28de('0x18')][_0x28de('0x19')]({'raw':_0x266ea9[_0x28de('0x1a')]?_0x266ea9['options']['raw']===undefined?!![]:![]:!![],'where':_0x266ea9[_0x28de('0x1a')]?_0x266ea9[_0x28de('0x1a')]['where']||null:null,'attributes':_0x266ea9[_0x28de('0x1a')]?_0x266ea9['options']['attributes']||null:null,'limit':_0x266ea9[_0x28de('0x1a')]?_0x266ea9[_0x28de('0x1a')][_0x28de('0x1b')]||null:null,'include':_0x266ea9[_0x28de('0x1a')]?_0x266ea9[_0x28de('0x1a')][_0x28de('0x1c')]?_[_0x28de('0x1d')](_0x266ea9[_0x28de('0x1a')][_0x28de('0x1c')],function(_0x3da82d){return{'model':db[_0x3da82d[_0x28de('0x1e')]],'as':_0x3da82d['as'],'attributes':_0x3da82d[_0x28de('0x1f')],'include':_0x3da82d[_0x28de('0x1c')]?_[_0x28de('0x1d')](_0x3da82d[_0x28de('0x1c')],function(_0x28ae86){return{'model':db[_0x28ae86[_0x28de('0x1e')]],'as':_0x28ae86['as'],'attributes':_0x28ae86[_0x28de('0x1f')],'include':_0x28ae86[_0x28de('0x1c')]?_[_0x28de('0x1d')](_0x28ae86[_0x28de('0x1c')],function(_0x31214d){return{'model':db[_0x31214d[_0x28de('0x1e')]],'as':_0x31214d['as'],'attributes':_0x31214d[_0x28de('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x28de('0xf')](function(_0x8f359d){logger[_0x28de('0x10')](_0x28de('0x17'),_0x266ea9);logger[_0x28de('0x11')]('GetFaxQueue',_0x266ea9,JSON[_0x28de('0x20')](_0x8f359d));_0x42d843(_0x8f359d);})[_0x28de('0x21')](function(_0x5b0054){logger[_0x28de('0x13')](_0x28de('0x17'),_0x5b0054['message'],_0x266ea9);_0x58c55d(_0x377026[_0x28de('0x13')](0x1f4,_0x5b0054['message']));});});};exports[_0x28de('0x22')]=function(_0x11ee11){var _0x298f95=this;return new Promise(function(_0x42dca9,_0x1a6af4){return db[_0x28de('0x18')][_0x28de('0x23')]({'raw':_0x11ee11[_0x28de('0x1a')]?_0x11ee11[_0x28de('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x11ee11[_0x28de('0x1a')]?_0x11ee11[_0x28de('0x1a')][_0x28de('0x24')]||null:null,'attributes':_0x11ee11[_0x28de('0x1a')]?_0x11ee11[_0x28de('0x1a')][_0x28de('0x1f')]||null:null,'include':_0x11ee11[_0x28de('0x1a')]?_0x11ee11['options'][_0x28de('0x1c')]?_[_0x28de('0x1d')](_0x11ee11['options'][_0x28de('0x1c')],function(_0x2dc6e7){return{'model':db[_0x2dc6e7[_0x28de('0x1e')]],'as':_0x2dc6e7['as'],'attributes':_0x2dc6e7['attributes'],'include':_0x2dc6e7['include']?_[_0x28de('0x1d')](_0x2dc6e7[_0x28de('0x1c')],function(_0x3e4d2b){return{'model':db[_0x3e4d2b[_0x28de('0x1e')]],'as':_0x3e4d2b['as'],'attributes':_0x3e4d2b[_0x28de('0x1f')],'include':_0x3e4d2b['include']?_[_0x28de('0x1d')](_0x3e4d2b[_0x28de('0x1c')],function(_0x121291){return{'model':db[_0x121291['model']],'as':_0x121291['as'],'attributes':_0x121291['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4afb9d){logger[_0x28de('0x10')](_0x28de('0x22'),_0x11ee11);logger[_0x28de('0x11')]('ShowFaxQueue',_0x11ee11,JSON[_0x28de('0x20')](_0x4afb9d));_0x42dca9(_0x4afb9d);})['catch'](function(_0xf9ff66){logger['error'](_0x28de('0x22'),_0xf9ff66[_0x28de('0x16')],_0x11ee11);_0x1a6af4(_0x298f95[_0x28de('0x13')](0x1f4,_0xf9ff66[_0x28de('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 5ead4f8..c111cb1 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 _0x7172=['update','removeListener','register','faxQueue:','./faxQueue.events','save'];(function(_0x2b513b,_0x43aa05){var _0xf03790=function(_0x3e84da){while(--_0x3e84da){_0x2b513b['push'](_0x2b513b['shift']());}};_0xf03790(++_0x43aa05);}(_0x7172,0xee));var _0x2717=function(_0xfc3f65,_0x21f988){_0xfc3f65=_0xfc3f65-0x0;var _0xc3d341=_0x7172[_0xfc3f65];return _0xc3d341;};'use strict';var FaxQueueEvents=require(_0x2717('0x0'));var events=[_0x2717('0x1'),'remove',_0x2717('0x2')];function createListener(_0x27faa3,_0x1717dc){return function(_0xc88a1c){_0x1717dc['emit'](_0x27faa3,_0xc88a1c);};}function removeListener(_0x5e2b9d,_0x27283f){return function(){FaxQueueEvents[_0x2717('0x3')](_0x5e2b9d,_0x27283f);};}exports[_0x2717('0x4')]=function(_0x1c3eb8){for(var _0xf058bf=0x0,_0x16793b=events['length'];_0xf058bf<_0x16793b;_0xf058bf++){var _0x1ac66c=events[_0xf058bf];var _0x1c8173=createListener(_0x2717('0x5')+_0x1ac66c,_0x1c3eb8);FaxQueueEvents['on'](_0x1ac66c,_0x1c8173);}}; \ No newline at end of file +var _0xfebd=['removeListener','faxQueue:','./faxQueue.events','save','remove','update','emit'];(function(_0x25486a,_0x1cc83b){var _0x353315=function(_0x14a901){while(--_0x14a901){_0x25486a['push'](_0x25486a['shift']());}};_0x353315(++_0x1cc83b);}(_0xfebd,0x72));var _0xdfeb=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfebd[_0x2dafbe];return _0x58a45a;};'use strict';var FaxQueueEvents=require(_0xdfeb('0x0'));var events=[_0xdfeb('0x1'),_0xdfeb('0x2'),_0xdfeb('0x3')];function createListener(_0x449821,_0x2751ac){return function(_0x19680d){_0x2751ac[_0xdfeb('0x4')](_0x449821,_0x19680d);};}function removeListener(_0x10519f,_0x185820){return function(){FaxQueueEvents[_0xdfeb('0x5')](_0x10519f,_0x185820);};}exports['register']=function(_0x1254a0){for(var _0x5c6221=0x0,_0x313cb5=events['length'];_0x5c6221<_0x313cb5;_0x5c6221++){var _0x1dcd59=events[_0x5c6221];var _0x69f111=createListener(_0xdfeb('0x6')+_0x1dcd59,_0x1254a0);FaxQueueEvents['on'](_0x1dcd59,_0x69f111);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 5409402..ea79238 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 _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0x2af053,_0x4f6d28){var _0x4b4001=function(_0x9200c1){while(--_0x9200c1){_0x2af053['push'](_0x2af053['shift']());}};_0x4b4001(++_0x4f6d28);}(_0x0b0e,0x187));var _0xe0b0=function(_0x163f58,_0x1c8ae4){_0x163f58=_0x163f58-0x0;var _0x472ed9=_0x0b0e[_0x163f58];return _0x472ed9;};'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['getMembers']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')]('/:id/teams',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x13')](_0xe0b0('0x11'),auth[_0xe0b0('0x9')](),controller['addAgents']);router[_0xe0b0('0x16')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['delete'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0x1cd47d,_0x55bc75){var _0x29d52f=function(_0x37737a){while(--_0x37737a){_0x1cd47d['push'](_0x1cd47d['shift']());}};_0x29d52f(++_0x55bc75);}(_0x0b0e,0x187));var _0xe0b0=function(_0x422be2,_0x1c439e){_0x422be2=_0x422be2-0x0;var _0x1b820e=_0x0b0e[_0x422be2];return _0x1b820e;};'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['getMembers']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')]('/:id/teams',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x13')](_0xe0b0('0x11'),auth[_0xe0b0('0x9')](),controller['addAgents']);router[_0xe0b0('0x16')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['delete'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 9a824c6..57295b9 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 _0x432f=['DATE','moment','exports','STRING'];(function(_0x104626,_0x353da9){var _0x34c92d=function(_0x1570af){while(--_0x1570af){_0x104626['push'](_0x104626['shift']());}};_0x34c92d(++_0x353da9);}(_0x432f,0xc1));var _0xf432=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x432f[_0x15bc81];return _0x59440e;};'use strict';var moment=require(_0xf432('0x0'));var Sequelize=require('sequelize');module[_0xf432('0x1')]={'uniqueid':{'type':Sequelize[_0xf432('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf432('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xf432('0x3')]},'acceptAt':{'type':Sequelize[_0xf432('0x3')]},'exitAt':{'type':Sequelize[_0xf432('0x3')]},'reason':{'type':Sequelize[_0xf432('0x2')]}}; \ No newline at end of file +var _0x2834=['STRING','DATE','moment','sequelize','exports'];(function(_0x566b67,_0x54a6fd){var _0x3f0cf1=function(_0x196408){while(--_0x196408){_0x566b67['push'](_0x566b67['shift']());}};_0x3f0cf1(++_0x54a6fd);}(_0x2834,0x1c9));var _0x4283=function(_0x129b2c,_0x37d5fe){_0x129b2c=_0x129b2c-0x0;var _0xc6a2d8=_0x2834[_0x129b2c];return _0xc6a2d8;};'use strict';var moment=require(_0x4283('0x0'));var Sequelize=require(_0x4283('0x1'));module[_0x4283('0x2')]={'uniqueid':{'type':Sequelize[_0x4283('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x4283('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x4283('0x4')]},'acceptAt':{'type':Sequelize[_0x4283('0x4')]},'exitAt':{'type':Sequelize[_0x4283('0x4')]},'reason':{'type':Sequelize[_0x4283('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 943ee28..1eeadeb 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 _0x60ca=['filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','VIRTUAL','merge','FaxQueueReport','count','includeAll','include','findAll','rows','catch','rawAttributes','find','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','fieldName','type','key','model','keys','query'];(function(_0x417b27,_0x3d89e8){var _0x2abb16=function(_0x3a7653){while(--_0x3a7653){_0x417b27['push'](_0x417b27['shift']());}};_0x2abb16(++_0x3d89e8);}(_0x60ca,0xf8));var _0xa60c=function(_0x3dbc7d,_0xa77448){_0x3dbc7d=_0x3dbc7d-0x0;var _0x223024=_0x60ca[_0x3dbc7d];return _0x223024;};'use strict';var pdf=require(_0xa60c('0x0'));var emlformat=require(_0xa60c('0x1'));var rimraf=require(_0xa60c('0x2'));var zipdir=require(_0xa60c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa60c('0x4'));var BPromise=require(_0xa60c('0x5'));var Mustache=require(_0xa60c('0x6'));var util=require(_0xa60c('0x7'));var path=require(_0xa60c('0x8'));var sox=require(_0xa60c('0x9'));var csv=require('to-csv');var ejs=require(_0xa60c('0xa'));var fs=require('fs');var _=require(_0xa60c('0xb'));var squel=require(_0xa60c('0xc'));var crypto=require(_0xa60c('0xd'));var jsforce=require(_0xa60c('0xe'));var deskjs=require(_0xa60c('0xf'));var toCsv=require(_0xa60c('0x10'));var querystring=require(_0xa60c('0x11'));var Papa=require(_0xa60c('0x12'));var Redis=require('ioredis');var authService=require(_0xa60c('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa60c('0x14'));var logger=require(_0xa60c('0x15'))(_0xa60c('0x16'));var utils=require(_0xa60c('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa60c('0x18'))['db'];function respondWithStatusCode(_0x22d3b1,_0x372eb3){_0x372eb3=_0x372eb3||0xcc;return function(_0x6a9121){if(_0x6a9121){return _0x22d3b1[_0xa60c('0x19')](_0x372eb3);}return _0x22d3b1[_0xa60c('0x1a')](_0x372eb3)[_0xa60c('0x1b')]();};}function respondWithResult(_0x13dc62,_0x188a20){_0x188a20=_0x188a20||0xc8;return function(_0x1587f9){if(_0x1587f9){return _0x13dc62[_0xa60c('0x1a')](_0x188a20)[_0xa60c('0x1c')](_0x1587f9);}};}function respondWithFilteredResult(_0x51bf33,_0x1e0c39){return function(_0x3c3edd){if(_0x3c3edd){var _0x1da498=_0x3c3edd['count'],_0x2bf52a=_0x1e0c39['offset'],_0x5e4971=_0x1e0c39['offset']+_0x1e0c39[_0xa60c('0x1d')],_0x12ba94;if(_0x5e4971>=_0x1da498){_0x5e4971=_0x1da498;_0x12ba94=0xc8;}else{_0x12ba94=0xce;}_0x51bf33[_0xa60c('0x1a')](_0x12ba94);return _0x51bf33[_0xa60c('0x1e')](_0xa60c('0x1f'),_0x2bf52a+'-'+_0x5e4971+'/'+_0x1da498)[_0xa60c('0x1c')](_0x3c3edd);}return null;};}function patchUpdates(_0x1b9e89){return function(_0x3da1de){try{jsonpatch[_0xa60c('0x20')](_0x3da1de,_0x1b9e89,!![]);}catch(_0x2fc83c){return BPromise[_0xa60c('0x21')](_0x2fc83c);}return _0x3da1de['save']();};}function saveUpdates(_0xa6ec0f,_0x2de5c9){return function(_0x1a87cd){if(_0x1a87cd){return _0x1a87cd[_0xa60c('0x22')](_0xa6ec0f)[_0xa60c('0x23')](function(_0x3da05a){return _0x3da05a;});}return null;};}function removeEntity(_0x3acc0c,_0x27cbd3){return function(_0x285e7e){if(_0x285e7e){return _0x285e7e[_0xa60c('0x24')]()[_0xa60c('0x23')](function(){_0x3acc0c[_0xa60c('0x1a')](0xcc)[_0xa60c('0x1b')]();});}};}function handleEntityNotFound(_0x375636,_0x4f86c5){return function(_0x5b9995){if(!_0x5b9995){_0x375636[_0xa60c('0x19')](0x194);}return _0x5b9995;};}function handleError(_0x7d78ac,_0x48134e){_0x48134e=_0x48134e||0x1f4;return function(_0x42b4b3){logger[_0xa60c('0x25')](_0x42b4b3[_0xa60c('0x26')]);if(_0x42b4b3[_0xa60c('0x27')]){delete _0x42b4b3[_0xa60c('0x27')];}_0x7d78ac[_0xa60c('0x1a')](_0x48134e)[_0xa60c('0x28')](_0x42b4b3);};}exports['index']=function(_0x55d0e1,_0x301a9c){var _0x52605c={},_0x393c3a={},_0x35b712={'count':0x0,'rows':[]};var _0x3da718=_[_0xa60c('0x29')](db['FaxQueueReport']['rawAttributes'],function(_0x5c22e7){return{'name':_0x5c22e7[_0xa60c('0x2a')],'type':_0x5c22e7[_0xa60c('0x2b')][_0xa60c('0x2c')]};});_0x393c3a[_0xa60c('0x2d')]=_[_0xa60c('0x29')](_0x3da718,'name');_0x393c3a['query']=_[_0xa60c('0x2e')](_0x55d0e1[_0xa60c('0x2f')]);_0x393c3a[_0xa60c('0x30')]=_['intersection'](_0x393c3a['model'],_0x393c3a[_0xa60c('0x2f')]);_0x52605c[_0xa60c('0x31')]=_[_0xa60c('0x32')](_0x393c3a[_0xa60c('0x2d')],qs[_0xa60c('0x33')](_0x55d0e1['query'][_0xa60c('0x33')]));_0x52605c[_0xa60c('0x31')]=_0x52605c[_0xa60c('0x31')][_0xa60c('0x34')]?_0x52605c['attributes']:_0x393c3a[_0xa60c('0x2d')];if(!_0x55d0e1[_0xa60c('0x2f')][_0xa60c('0x35')](_0xa60c('0x36'))){_0x52605c['limit']=qs['limit'](_0x55d0e1[_0xa60c('0x2f')]['limit']);_0x52605c[_0xa60c('0x37')]=qs[_0xa60c('0x37')](_0x55d0e1[_0xa60c('0x2f')][_0xa60c('0x37')]);}_0x52605c[_0xa60c('0x38')]=qs[_0xa60c('0x39')](_0x55d0e1[_0xa60c('0x2f')][_0xa60c('0x39')]);_0x52605c[_0xa60c('0x3a')]=qs['filters'](_['pick'](_0x55d0e1['query'],_0x393c3a['filters']),_0x3da718);if(_0x55d0e1[_0xa60c('0x2f')][_0xa60c('0x3b')]){_0x52605c['where']=_['merge'](_0x52605c['where'],{'$or':_[_0xa60c('0x29')](_0x3da718,function(_0x4a6705){if(_0x4a6705[_0xa60c('0x2b')]!==_0xa60c('0x3c')){var _0x4c4675={};_0x4c4675[_0x4a6705[_0xa60c('0x27')]]={'$like':'%'+_0x55d0e1[_0xa60c('0x2f')][_0xa60c('0x3b')]+'%'};return _0x4c4675;}})});}_0x52605c=_[_0xa60c('0x3d')]({},_0x52605c,_0x55d0e1['options']);var _0x396d32={'where':_0x52605c[_0xa60c('0x3a')]};return db[_0xa60c('0x3e')][_0xa60c('0x3f')](_0x396d32)['then'](function(_0x40fc84){_0x35b712['count']=_0x40fc84;if(_0x55d0e1[_0xa60c('0x2f')][_0xa60c('0x40')]){_0x52605c[_0xa60c('0x41')]=[{'all':!![]}];}return db[_0xa60c('0x3e')][_0xa60c('0x42')](_0x52605c);})[_0xa60c('0x23')](function(_0x363d8b){_0x35b712[_0xa60c('0x43')]=_0x363d8b;return _0x35b712;})[_0xa60c('0x23')](respondWithFilteredResult(_0x301a9c,_0x52605c))[_0xa60c('0x44')](handleError(_0x301a9c,null));};exports['show']=function(_0x46e632,_0x49b39d){var _0x237497={'raw':!![],'where':{'id':_0x46e632['params']['id']}},_0xcf29c2={};_0xcf29c2[_0xa60c('0x2d')]=_[_0xa60c('0x2e')](db[_0xa60c('0x3e')][_0xa60c('0x45')]);_0xcf29c2['query']=_[_0xa60c('0x2e')](_0x46e632[_0xa60c('0x2f')]);_0xcf29c2['filters']=_[_0xa60c('0x32')](_0xcf29c2[_0xa60c('0x2d')],_0xcf29c2[_0xa60c('0x2f')]);_0x237497['attributes']=_[_0xa60c('0x32')](_0xcf29c2[_0xa60c('0x2d')],qs['fields'](_0x46e632[_0xa60c('0x2f')]['fields']));_0x237497['attributes']=_0x237497[_0xa60c('0x31')]['length']?_0x237497[_0xa60c('0x31')]:_0xcf29c2['model'];if(_0x46e632[_0xa60c('0x2f')][_0xa60c('0x40')]){_0x237497['include']=[{'all':!![]}];}_0x237497=_[_0xa60c('0x3d')]({},_0x237497,_0x46e632['options']);return db[_0xa60c('0x3e')][_0xa60c('0x46')](_0x237497)['then'](handleEntityNotFound(_0x49b39d,null))['then'](respondWithResult(_0x49b39d,null))[_0xa60c('0x44')](handleError(_0x49b39d,null));};exports['create']=function(_0x437fb5,_0x4eadaa){return db[_0xa60c('0x3e')]['create'](_0x437fb5[_0xa60c('0x47')],{})[_0xa60c('0x23')](respondWithResult(_0x4eadaa,0xc9))[_0xa60c('0x44')](handleError(_0x4eadaa,null));};exports[_0xa60c('0x22')]=function(_0x35c6d1,_0x3d0b0c){if(_0x35c6d1[_0xa60c('0x47')]['id']){delete _0x35c6d1[_0xa60c('0x47')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x35c6d1[_0xa60c('0x48')]['id']}})[_0xa60c('0x23')](handleEntityNotFound(_0x3d0b0c,null))['then'](saveUpdates(_0x35c6d1[_0xa60c('0x47')],null))[_0xa60c('0x23')](respondWithResult(_0x3d0b0c,null))['catch'](handleError(_0x3d0b0c,null));};exports['destroy']=function(_0x267db5,_0x496e6d){return db['FaxQueueReport']['find']({'where':{'id':_0x267db5[_0xa60c('0x48')]['id']}})[_0xa60c('0x23')](handleEntityNotFound(_0x496e6d,null))[_0xa60c('0x23')](removeEntity(_0x496e6d,null))[_0xa60c('0x44')](handleError(_0x496e6d,null));};exports[_0xa60c('0x49')]=function(_0x4291ff,_0x4d7aad){return db[_0xa60c('0x3e')]['describe']()['then'](respondWithResult(_0x4d7aad,null))[_0xa60c('0x44')](handleError(_0x4d7aad,null));}; \ No newline at end of file +var _0xdb36=['hasOwnProperty','order','sort','where','pick','merge','filter','include','findAll','catch','show','params','length','includeAll','options','find','body','destroy','describe','html-pdf','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','FaxQueueReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes'];(function(_0x585cd8,_0x4a213d){var _0x55cc9f=function(_0x560e16){while(--_0x560e16){_0x585cd8['push'](_0x585cd8['shift']());}};_0x55cc9f(++_0x4a213d);}(_0xdb36,0x167));var _0x6db3=function(_0x1c14ef,_0x41d5a0){_0x1c14ef=_0x1c14ef-0x0;var _0x5aad00=_0xdb36[_0x1c14ef];return _0x5aad00;};'use strict';var pdf=require(_0x6db3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6db3('0x1'));var zipdir=require(_0x6db3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6db3('0x3'));var moment=require(_0x6db3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6db3('0x5'));var path=require(_0x6db3('0x6'));var sox=require(_0x6db3('0x7'));var csv=require(_0x6db3('0x8'));var ejs=require(_0x6db3('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6db3('0xa'));var jsforce=require(_0x6db3('0xb'));var deskjs=require(_0x6db3('0xc'));var toCsv=require(_0x6db3('0x8'));var querystring=require('querystring');var Papa=require(_0x6db3('0xd'));var Redis=require('ioredis');var authService=require(_0x6db3('0xe'));var qs=require(_0x6db3('0xf'));var as=require(_0x6db3('0x10'));var hardwareService=require(_0x6db3('0x11'));var logger=require('../../config/logger')(_0x6db3('0x12'));var utils=require(_0x6db3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6db3('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x460f20,_0x2a45a7){_0x2a45a7=_0x2a45a7||0xcc;return function(_0x382e10){if(_0x382e10){return _0x460f20['sendStatus'](_0x2a45a7);}return _0x460f20['status'](_0x2a45a7)[_0x6db3('0x15')]();};}function respondWithResult(_0x4cce12,_0x1e3515){_0x1e3515=_0x1e3515||0xc8;return function(_0x58751b){if(_0x58751b){return _0x4cce12['status'](_0x1e3515)[_0x6db3('0x16')](_0x58751b);}};}function respondWithFilteredResult(_0x3bccd2,_0x18d70f){return function(_0x2eddff){if(_0x2eddff){var _0x2ad9b0=_0x2eddff[_0x6db3('0x17')],_0x1d1fe4=_0x18d70f['offset'],_0x36332d=_0x18d70f[_0x6db3('0x18')]+_0x18d70f[_0x6db3('0x19')],_0x293d8e;if(_0x36332d>=_0x2ad9b0){_0x36332d=_0x2ad9b0;_0x293d8e=0xc8;}else{_0x293d8e=0xce;}_0x3bccd2[_0x6db3('0x1a')](_0x293d8e);return _0x3bccd2[_0x6db3('0x1b')](_0x6db3('0x1c'),_0x1d1fe4+'-'+_0x36332d+'/'+_0x2ad9b0)[_0x6db3('0x16')](_0x2eddff);}return null;};}function patchUpdates(_0x32a125){return function(_0x1ce7c9){try{jsonpatch[_0x6db3('0x1d')](_0x1ce7c9,_0x32a125,!![]);}catch(_0x3243dc){return BPromise[_0x6db3('0x1e')](_0x3243dc);}return _0x1ce7c9[_0x6db3('0x1f')]();};}function saveUpdates(_0x4073d8,_0x2097e5){return function(_0x306844){if(_0x306844){return _0x306844['update'](_0x4073d8)[_0x6db3('0x20')](function(_0x25cd25){return _0x25cd25;});}return null;};}function removeEntity(_0x5efca8,_0x227a78){return function(_0x43e492){if(_0x43e492){return _0x43e492['destroy']()['then'](function(){_0x5efca8[_0x6db3('0x1a')](0xcc)[_0x6db3('0x15')]();});}};}function handleEntityNotFound(_0x5b5409,_0xba1a84){return function(_0x5daf7f){if(!_0x5daf7f){_0x5b5409[_0x6db3('0x21')](0x194);}return _0x5daf7f;};}function handleError(_0x126af9,_0x585798){_0x585798=_0x585798||0x1f4;return function(_0x190557){logger[_0x6db3('0x22')](_0x190557[_0x6db3('0x23')]);if(_0x190557[_0x6db3('0x24')]){delete _0x190557[_0x6db3('0x24')];}_0x126af9[_0x6db3('0x1a')](_0x585798)['send'](_0x190557);};}exports['index']=function(_0x5f2a5b,_0x5cd523){var _0x212002={},_0x413f91={},_0x574b6d={'count':0x0,'rows':[]};var _0x5cfc82=_['map'](db[_0x6db3('0x25')][_0x6db3('0x26')],function(_0x19830a){return{'name':_0x19830a[_0x6db3('0x27')],'type':_0x19830a[_0x6db3('0x28')]['key']};});_0x413f91[_0x6db3('0x29')]=_[_0x6db3('0x2a')](_0x5cfc82,_0x6db3('0x24'));_0x413f91[_0x6db3('0x2b')]=_[_0x6db3('0x2c')](_0x5f2a5b[_0x6db3('0x2b')]);_0x413f91[_0x6db3('0x2d')]=_[_0x6db3('0x2e')](_0x413f91[_0x6db3('0x29')],_0x413f91[_0x6db3('0x2b')]);_0x212002['attributes']=_[_0x6db3('0x2e')](_0x413f91[_0x6db3('0x29')],qs[_0x6db3('0x2f')](_0x5f2a5b[_0x6db3('0x2b')][_0x6db3('0x2f')]));_0x212002[_0x6db3('0x30')]=_0x212002[_0x6db3('0x30')]['length']?_0x212002[_0x6db3('0x30')]:_0x413f91[_0x6db3('0x29')];if(!_0x5f2a5b[_0x6db3('0x2b')][_0x6db3('0x31')]('nolimit')){_0x212002[_0x6db3('0x19')]=qs[_0x6db3('0x19')](_0x5f2a5b[_0x6db3('0x2b')][_0x6db3('0x19')]);_0x212002[_0x6db3('0x18')]=qs[_0x6db3('0x18')](_0x5f2a5b[_0x6db3('0x2b')][_0x6db3('0x18')]);}_0x212002[_0x6db3('0x32')]=qs[_0x6db3('0x33')](_0x5f2a5b['query'][_0x6db3('0x33')]);_0x212002[_0x6db3('0x34')]=qs[_0x6db3('0x2d')](_[_0x6db3('0x35')](_0x5f2a5b[_0x6db3('0x2b')],_0x413f91[_0x6db3('0x2d')]),_0x5cfc82);if(_0x5f2a5b[_0x6db3('0x2b')]['filter']){_0x212002[_0x6db3('0x34')]=_[_0x6db3('0x36')](_0x212002[_0x6db3('0x34')],{'$or':_[_0x6db3('0x2a')](_0x5cfc82,function(_0x4a1501){if(_0x4a1501[_0x6db3('0x28')]!=='VIRTUAL'){var _0x46a1f2={};_0x46a1f2[_0x4a1501[_0x6db3('0x24')]]={'$like':'%'+_0x5f2a5b['query'][_0x6db3('0x37')]+'%'};return _0x46a1f2;}})});}_0x212002=_['merge']({},_0x212002,_0x5f2a5b['options']);var _0x2195f7={'where':_0x212002[_0x6db3('0x34')]};return db[_0x6db3('0x25')][_0x6db3('0x17')](_0x2195f7)[_0x6db3('0x20')](function(_0x4ed4ab){_0x574b6d[_0x6db3('0x17')]=_0x4ed4ab;if(_0x5f2a5b[_0x6db3('0x2b')]['includeAll']){_0x212002[_0x6db3('0x38')]=[{'all':!![]}];}return db[_0x6db3('0x25')][_0x6db3('0x39')](_0x212002);})[_0x6db3('0x20')](function(_0x2912dc){_0x574b6d['rows']=_0x2912dc;return _0x574b6d;})[_0x6db3('0x20')](respondWithFilteredResult(_0x5cd523,_0x212002))[_0x6db3('0x3a')](handleError(_0x5cd523,null));};exports[_0x6db3('0x3b')]=function(_0x19aa05,_0x94d893){var _0xe5857={'raw':!![],'where':{'id':_0x19aa05[_0x6db3('0x3c')]['id']}},_0x177f59={};_0x177f59[_0x6db3('0x29')]=_[_0x6db3('0x2c')](db[_0x6db3('0x25')][_0x6db3('0x26')]);_0x177f59[_0x6db3('0x2b')]=_[_0x6db3('0x2c')](_0x19aa05[_0x6db3('0x2b')]);_0x177f59[_0x6db3('0x2d')]=_['intersection'](_0x177f59[_0x6db3('0x29')],_0x177f59[_0x6db3('0x2b')]);_0xe5857[_0x6db3('0x30')]=_[_0x6db3('0x2e')](_0x177f59[_0x6db3('0x29')],qs[_0x6db3('0x2f')](_0x19aa05[_0x6db3('0x2b')][_0x6db3('0x2f')]));_0xe5857[_0x6db3('0x30')]=_0xe5857[_0x6db3('0x30')][_0x6db3('0x3d')]?_0xe5857[_0x6db3('0x30')]:_0x177f59[_0x6db3('0x29')];if(_0x19aa05[_0x6db3('0x2b')][_0x6db3('0x3e')]){_0xe5857[_0x6db3('0x38')]=[{'all':!![]}];}_0xe5857=_[_0x6db3('0x36')]({},_0xe5857,_0x19aa05[_0x6db3('0x3f')]);return db[_0x6db3('0x25')][_0x6db3('0x40')](_0xe5857)['then'](handleEntityNotFound(_0x94d893,null))[_0x6db3('0x20')](respondWithResult(_0x94d893,null))[_0x6db3('0x3a')](handleError(_0x94d893,null));};exports['create']=function(_0x3c0e01,_0xffb275){return db['FaxQueueReport']['create'](_0x3c0e01[_0x6db3('0x41')],{})[_0x6db3('0x20')](respondWithResult(_0xffb275,0xc9))[_0x6db3('0x3a')](handleError(_0xffb275,null));};exports['update']=function(_0x5b9707,_0x3a0147){if(_0x5b9707[_0x6db3('0x41')]['id']){delete _0x5b9707['body']['id'];}return db[_0x6db3('0x25')][_0x6db3('0x40')]({'where':{'id':_0x5b9707[_0x6db3('0x3c')]['id']}})[_0x6db3('0x20')](handleEntityNotFound(_0x3a0147,null))[_0x6db3('0x20')](saveUpdates(_0x5b9707[_0x6db3('0x41')],null))[_0x6db3('0x20')](respondWithResult(_0x3a0147,null))[_0x6db3('0x3a')](handleError(_0x3a0147,null));};exports[_0x6db3('0x42')]=function(_0xeaceec,_0x42f5dd){return db['FaxQueueReport'][_0x6db3('0x40')]({'where':{'id':_0xeaceec['params']['id']}})[_0x6db3('0x20')](handleEntityNotFound(_0x42f5dd,null))[_0x6db3('0x20')](removeEntity(_0x42f5dd,null))['catch'](handleError(_0x42f5dd,null));};exports[_0x6db3('0x43')]=function(_0xdf1ea5,_0x3048f3){return db[_0x6db3('0x25')][_0x6db3('0x43')]()['then'](respondWithResult(_0x3048f3,null))[_0x6db3('0x3a')](handleError(_0x3048f3,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index b7ecb7f..f77af99 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 _0x2fd1=['path','../../config/environment','exports','define','lodash','api','moment','request-promise'];(function(_0x16b078,_0x52cb76){var _0x207b3a=function(_0x3c62d8){while(--_0x3c62d8){_0x16b078['push'](_0x16b078['shift']());}};_0x207b3a(++_0x52cb76);}(_0x2fd1,0x19c));var _0x12fd=function(_0x35c506,_0x18351c){_0x35c506=_0x35c506-0x0;var _0x4d025c=_0x2fd1[_0x35c506];return _0x4d025c;};'use strict';var _=require(_0x12fd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x12fd('0x1'));var moment=require(_0x12fd('0x2'));var BPromise=require('bluebird');var rp=require(_0x12fd('0x3'));var fs=require('fs');var path=require(_0x12fd('0x4'));var rimraf=require('rimraf');var config=require(_0x12fd('0x5'));var attributes=require('./faxQueueReport.attributes');module[_0x12fd('0x6')]=function(_0xccdaf2,_0x50efbe){return _0xccdaf2[_0x12fd('0x7')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2488=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x2488,0x1bf));var _0x8248=function(_0x5504fc,_0x2e161c){_0x5504fc=_0x5504fc-0x0;var _0xbad34c=_0x2488[_0x5504fc];return _0xbad34c;};'use strict';var _=require(_0x8248('0x0'));var util=require(_0x8248('0x1'));var logger=require(_0x8248('0x2'))(_0x8248('0x3'));var moment=require(_0x8248('0x4'));var BPromise=require(_0x8248('0x5'));var rp=require(_0x8248('0x6'));var fs=require('fs');var path=require(_0x8248('0x7'));var rimraf=require(_0x8248('0x8'));var config=require(_0x8248('0x9'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x484427,_0x3f9a33){return _0x484427[_0x8248('0xa')](_0x8248('0xb'),attributes,{'tableName':_0x8248('0xc'),'paranoid':![],'indexes':[{'name':_0x8248('0xd'),'fields':[_0x8248('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 4f240a2..7552997 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 _0x9591=['jayson/promise','client','request','then','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','info','catch','CreateFaxQueueReport','create','options','raw','UpdateFaxQueueReport','FaxQueueReport','update','body','attributes','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x38d187,_0x1d6ea6){var _0x116854=function(_0x34ffee){while(--_0x34ffee){_0x38d187['push'](_0x38d187['shift']());}};_0x116854(++_0x1d6ea6);}(_0x9591,0x9c));var _0x1959=function(_0x3aa94f,_0x2cc3e0){_0x3aa94f=_0x3aa94f-0x0;var _0x3285ae=_0x9591[_0x3aa94f];return _0x3285ae;};'use strict';var _=require('lodash');var util=require(_0x1959('0x0'));var moment=require('moment');var BPromise=require(_0x1959('0x1'));var rs=require(_0x1959('0x2'));var fs=require('fs');var Redis=require(_0x1959('0x3'));var db=require(_0x1959('0x4'))['db'];var utils=require(_0x1959('0x5'));var logger=require(_0x1959('0x6'))(_0x1959('0x7'));var config=require(_0x1959('0x8'));var jayson=require(_0x1959('0x9'));var client=jayson[_0x1959('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ec9f3,_0x5b07e9,_0x5b52ee){return new BPromise(function(_0x195581,_0x5e4de9){return client[_0x1959('0xb')](_0x5ec9f3,_0x5b52ee)[_0x1959('0xc')](function(_0xdb49ea){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x5b07e9,_0x1959('0xd'));logger[_0x1959('0xe')](_0x1959('0xf'),_0x5b07e9,'request\x20sent',JSON[_0x1959('0x10')](_0xdb49ea));if(_0xdb49ea[_0x1959('0x11')]){if(_0xdb49ea[_0x1959('0x11')][_0x1959('0x12')]===0x1f4){logger[_0x1959('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x5b07e9,_0xdb49ea[_0x1959('0x11')][_0x1959('0x13')]);return _0x5e4de9(_0xdb49ea[_0x1959('0x11')][_0x1959('0x13')]);}logger[_0x1959('0x11')](_0x1959('0x14'),_0x5b07e9,_0xdb49ea[_0x1959('0x11')]['message']);return _0x195581(_0xdb49ea[_0x1959('0x11')][_0x1959('0x13')]);}else{logger[_0x1959('0x15')]('FaxQueueReport,\x20%s,\x20%s',_0x5b07e9,'request\x20sent');_0x195581(_0xdb49ea['result'][_0x1959('0x13')]);}})[_0x1959('0x16')](function(_0x3517d5){logger[_0x1959('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x5b07e9,_0x3517d5);_0x5e4de9(_0x3517d5);});});}exports[_0x1959('0x17')]=function(_0x19faf0){var _0x1a240b=this;return new Promise(function(_0x41c528,_0x15db4c){return db['FaxQueueReport'][_0x1959('0x18')](_0x19faf0['body'],{'raw':_0x19faf0['options']?_0x19faf0[_0x1959('0x19')][_0x1959('0x1a')]===undefined?!![]:![]:!![]})[_0x1959('0xc')](function(_0x19d039){logger[_0x1959('0x15')](_0x1959('0x17'),_0x19faf0);logger['debug'](_0x1959('0x17'),_0x19faf0,JSON[_0x1959('0x10')](_0x19d039));_0x41c528(_0x19d039);})[_0x1959('0x16')](function(_0x31cc7b){logger[_0x1959('0x11')](_0x1959('0x17'),_0x31cc7b[_0x1959('0x13')],_0x19faf0);_0x15db4c(_0x1a240b[_0x1959('0x11')](0x1f4,_0x31cc7b[_0x1959('0x13')]));});});};exports[_0x1959('0x1b')]=function(_0x38aee2){var _0x55a8e6=this;return new Promise(function(_0x412674,_0x2b5543){return db[_0x1959('0x1c')][_0x1959('0x1d')](_0x38aee2[_0x1959('0x1e')],{'raw':_0x38aee2['options']?_0x38aee2['options'][_0x1959('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38aee2[_0x1959('0x19')]?_0x38aee2[_0x1959('0x19')]['where']||null:null,'attributes':_0x38aee2[_0x1959('0x19')]?_0x38aee2[_0x1959('0x19')][_0x1959('0x1f')]||null:null,'limit':_0x38aee2[_0x1959('0x19')]?_0x38aee2[_0x1959('0x19')][_0x1959('0x20')]||null:null})[_0x1959('0xc')](function(_0x52dd27){logger['info'](_0x1959('0x1b'),_0x38aee2);logger['debug']('UpdateFaxQueueReport',_0x38aee2,JSON['stringify'](_0x52dd27));_0x412674(_0x52dd27);})['catch'](function(_0x2fae17){logger[_0x1959('0x11')](_0x1959('0x1b'),_0x2fae17[_0x1959('0x13')],_0x38aee2);_0x2b5543(_0x55a8e6[_0x1959('0x11')](0x1f4,_0x2fae17[_0x1959('0x13')]));});});}; \ No newline at end of file +var _0xc9ab=['attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','then','UpdateFaxQueueReport','update','raw','where'];(function(_0x395039,_0x30b465){var _0x37e26e=function(_0x4d4fca){while(--_0x4d4fca){_0x395039['push'](_0x395039['shift']());}};_0x37e26e(++_0x30b465);}(_0xc9ab,0x98));var _0xbc9a=function(_0x10e5ae,_0x4a8c28){_0x10e5ae=_0x10e5ae-0x0;var _0x27d9b5=_0xc9ab[_0x10e5ae];return _0x27d9b5;};'use strict';var _=require(_0xbc9a('0x0'));var util=require(_0xbc9a('0x1'));var moment=require('moment');var BPromise=require(_0xbc9a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbc9a('0x3'));var db=require(_0xbc9a('0x4'))['db'];var utils=require(_0xbc9a('0x5'));var logger=require(_0xbc9a('0x6'))(_0xbc9a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x249ebf,_0x16a6b8,_0x37a98e){return new BPromise(function(_0x4f451b,_0x5842d4){return client[_0xbc9a('0x8')](_0x249ebf,_0x37a98e)['then'](function(_0x15e17a){logger[_0xbc9a('0x9')](_0xbc9a('0xa'),_0x16a6b8,_0xbc9a('0xb'));logger[_0xbc9a('0xc')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x16a6b8,_0xbc9a('0xb'),JSON[_0xbc9a('0xd')](_0x15e17a));if(_0x15e17a[_0xbc9a('0xe')]){if(_0x15e17a['error']['code']===0x1f4){logger[_0xbc9a('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x16a6b8,_0x15e17a['error'][_0xbc9a('0xf')]);return _0x5842d4(_0x15e17a[_0xbc9a('0xe')]['message']);}logger[_0xbc9a('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x16a6b8,_0x15e17a[_0xbc9a('0xe')][_0xbc9a('0xf')]);return _0x4f451b(_0x15e17a[_0xbc9a('0xe')][_0xbc9a('0xf')]);}else{logger['info'](_0xbc9a('0xa'),_0x16a6b8,'request\x20sent');_0x4f451b(_0x15e17a[_0xbc9a('0x10')]['message']);}})[_0xbc9a('0x11')](function(_0x4ee1e2){logger[_0xbc9a('0xe')](_0xbc9a('0xa'),_0x16a6b8,_0x4ee1e2);_0x5842d4(_0x4ee1e2);});});}exports[_0xbc9a('0x12')]=function(_0x5daccd){var _0x4e219e=this;return new Promise(function(_0x330436,_0x14b044){return db[_0xbc9a('0x13')][_0xbc9a('0x14')](_0x5daccd[_0xbc9a('0x15')],{'raw':_0x5daccd['options']?_0x5daccd[_0xbc9a('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xbc9a('0x17')](function(_0x115cef){logger['info'](_0xbc9a('0x12'),_0x5daccd);logger[_0xbc9a('0xc')](_0xbc9a('0x12'),_0x5daccd,JSON[_0xbc9a('0xd')](_0x115cef));_0x330436(_0x115cef);})[_0xbc9a('0x11')](function(_0x4c0e9d){logger[_0xbc9a('0xe')](_0xbc9a('0x12'),_0x4c0e9d[_0xbc9a('0xf')],_0x5daccd);_0x14b044(_0x4e219e[_0xbc9a('0xe')](0x1f4,_0x4c0e9d['message']));});});};exports[_0xbc9a('0x18')]=function(_0x41e88a){var _0x5e5f9c=this;return new Promise(function(_0x27f8fe,_0x5d0fe0){return db['FaxQueueReport'][_0xbc9a('0x19')](_0x41e88a[_0xbc9a('0x15')],{'raw':_0x41e88a[_0xbc9a('0x16')]?_0x41e88a[_0xbc9a('0x16')][_0xbc9a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41e88a[_0xbc9a('0x16')]?_0x41e88a['options'][_0xbc9a('0x1b')]||null:null,'attributes':_0x41e88a[_0xbc9a('0x16')]?_0x41e88a[_0xbc9a('0x16')][_0xbc9a('0x1c')]||null:null,'limit':_0x41e88a[_0xbc9a('0x16')]?_0x41e88a['options'][_0xbc9a('0x1d')]||null:null})[_0xbc9a('0x17')](function(_0x28842c){logger['info'](_0xbc9a('0x18'),_0x41e88a);logger[_0xbc9a('0xc')](_0xbc9a('0x18'),_0x41e88a,JSON['stringify'](_0x28842c));_0x27f8fe(_0x28842c);})[_0xbc9a('0x11')](function(_0x25da21){logger[_0xbc9a('0xe')](_0xbc9a('0x18'),_0x25da21[_0xbc9a('0xf')],_0x41e88a);_0x5d0fe0(_0x5e5f9c[_0xbc9a('0xe')](0x1f4,_0x25da21[_0xbc9a('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index c4632bd..87b1b77 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 _0xcda4=['./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','create','/:id','update','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1e1fe9,_0x216dd9){var _0x4eeb06=function(_0x3c69c2){while(--_0x3c69c2){_0x1e1fe9['push'](_0x1e1fe9['shift']());}};_0x4eeb06(++_0x216dd9);}(_0xcda4,0x64));var _0x4cda=function(_0xa4518,_0x41d2dd){_0xa4518=_0xa4518-0x0;var _0x4d99cc=_0xcda4[_0xa4518];return _0x4d99cc;};'use strict';var multer=require(_0x4cda('0x0'));var util=require(_0x4cda('0x1'));var path=require(_0x4cda('0x2'));var timeout=require('connect-timeout');var express=require(_0x4cda('0x3'));var router=express[_0x4cda('0x4')]();var auth=require(_0x4cda('0x5'));var interaction=require(_0x4cda('0x6'));var config=require(_0x4cda('0x7'));var controller=require(_0x4cda('0x8'));router[_0x4cda('0x9')]('/',auth[_0x4cda('0xa')](),controller[_0x4cda('0xb')]);router[_0x4cda('0x9')](_0x4cda('0xc'),auth[_0x4cda('0xa')](),controller[_0x4cda('0xd')]);router[_0x4cda('0x9')]('/:id',auth[_0x4cda('0xa')](),controller['show']);router['post']('/',auth[_0x4cda('0xa')](),controller[_0x4cda('0xe')]);router['put'](_0x4cda('0xf'),auth['isAuthenticated'](),controller[_0x4cda('0x10')]);router['delete'](_0x4cda('0xf'),auth[_0x4cda('0xa')](),controller[_0x4cda('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3e55=['index','describe','post','create','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated'];(function(_0x52b7b9,_0x43ed4b){var _0x5b5d30=function(_0x4a5b9c){while(--_0x4a5b9c){_0x52b7b9['push'](_0x52b7b9['shift']());}};_0x5b5d30(++_0x43ed4b);}(_0x3e55,0x135));var _0x53e5=function(_0x224dc9,_0x258a9e){_0x224dc9=_0x224dc9-0x0;var _0x17fede=_0x3e55[_0x224dc9];return _0x17fede;};'use strict';var multer=require(_0x53e5('0x0'));var util=require(_0x53e5('0x1'));var path=require('path');var timeout=require(_0x53e5('0x2'));var express=require(_0x53e5('0x3'));var router=express[_0x53e5('0x4')]();var auth=require(_0x53e5('0x5'));var interaction=require(_0x53e5('0x6'));var config=require(_0x53e5('0x7'));var controller=require(_0x53e5('0x8'));router[_0x53e5('0x9')]('/',auth[_0x53e5('0xa')](),controller[_0x53e5('0xb')]);router[_0x53e5('0x9')]('/describe',auth[_0x53e5('0xa')](),controller[_0x53e5('0xc')]);router[_0x53e5('0x9')]('/:id',auth[_0x53e5('0xa')](),controller['show']);router[_0x53e5('0xd')]('/',auth[_0x53e5('0xa')](),controller[_0x53e5('0xe')]);router[_0x53e5('0xf')](_0x53e5('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x53e5('0x11')](_0x53e5('0x10'),auth[_0x53e5('0xa')](),controller[_0x53e5('0x12')]);module[_0x53e5('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index fef21d9..7a15d1f 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 _0xe1a9=['STRING','account','agent','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x404957,_0x5192a4){var _0x4e0365=function(_0x4f6cd7){while(--_0x4f6cd7){_0x404957['push'](_0x404957['shift']());}};_0x4e0365(++_0x5192a4);}(_0xe1a9,0x1a4));var _0x9e1a=function(_0x3bd0e8,_0x531d56){_0x3bd0e8=_0x3bd0e8-0x0;var _0x54dc88=_0xe1a9[_0x3bd0e8];return _0x54dc88;};'use strict';var moment=require(_0x9e1a('0x0'));var Sequelize=require(_0x9e1a('0x1'));module[_0x9e1a('0x2')]={'uniqueid':{'type':Sequelize[_0x9e1a('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9e1a('0x4'),_0x9e1a('0x5'),_0x9e1a('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x9e1a('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x9e1a('0x8')]}}; \ No newline at end of file +var _0x4261=['agent','queue','NOW','ENUM','account'];(function(_0x98bc70,_0x113d42){var _0x3c9ae8=function(_0x4314d3){while(--_0x4314d3){_0x98bc70['push'](_0x98bc70['shift']());}};_0x3c9ae8(++_0x113d42);}(_0x4261,0xee));var _0x1426=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x4261[_0x2a6809];return _0x11c371;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1426('0x0')](_0x1426('0x1'),_0x1426('0x2'),_0x1426('0x3')),'allowNull':![],'defaultValue':_0x1426('0x3')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1426('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 39d5a6d..f2ae09b 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 _0x4279=['bluebird','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','FaxTransferReport','rawAttributes','type','key','map','query','keys','model','attributes','fields','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','intersection','length','merge','create','body','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x1a86db,_0x252ab9){var _0x3083a3=function(_0xeede25){while(--_0xeede25){_0x1a86db['push'](_0x1a86db['shift']());}};_0x3083a3(++_0x252ab9);}(_0x4279,0x8d));var _0x9427=function(_0x3a884f,_0x51ac9a){_0x3a884f=_0x3a884f-0x0;var _0x3271b1=_0x4279[_0x3a884f];return _0x3271b1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9427('0x0'));var rimraf=require(_0x9427('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9427('0x2'));var rp=require(_0x9427('0x3'));var moment=require(_0x9427('0x4'));var BPromise=require(_0x9427('0x5'));var Mustache=require('mustache');var util=require(_0x9427('0x6'));var path=require('path');var sox=require(_0x9427('0x7'));var csv=require(_0x9427('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9427('0x9'));var squel=require(_0x9427('0xa'));var crypto=require(_0x9427('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9427('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9427('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9427('0xe'));var qs=require(_0x9427('0xf'));var as=require(_0x9427('0x10'));var hardwareService=require(_0x9427('0x11'));var logger=require(_0x9427('0x12'))(_0x9427('0x13'));var utils=require(_0x9427('0x14'));var config=require(_0x9427('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9427('0x16'))['db'];function respondWithStatusCode(_0x1ceb46,_0x44bd4e){_0x44bd4e=_0x44bd4e||0xcc;return function(_0x17eb26){if(_0x17eb26){return _0x1ceb46[_0x9427('0x17')](_0x44bd4e);}return _0x1ceb46[_0x9427('0x18')](_0x44bd4e)[_0x9427('0x19')]();};}function respondWithResult(_0x1f6b92,_0x250144){_0x250144=_0x250144||0xc8;return function(_0x3a2956){if(_0x3a2956){return _0x1f6b92[_0x9427('0x18')](_0x250144)[_0x9427('0x1a')](_0x3a2956);}};}function respondWithFilteredResult(_0x418e37,_0x5cbf67){return function(_0x3a6f84){if(_0x3a6f84){var _0x1a41eb=_0x3a6f84[_0x9427('0x1b')],_0x154929=_0x5cbf67['offset'],_0x536030=_0x5cbf67[_0x9427('0x1c')]+_0x5cbf67[_0x9427('0x1d')],_0x542718;if(_0x536030>=_0x1a41eb){_0x536030=_0x1a41eb;_0x542718=0xc8;}else{_0x542718=0xce;}_0x418e37['status'](_0x542718);return _0x418e37['set'](_0x9427('0x1e'),_0x154929+'-'+_0x536030+'/'+_0x1a41eb)[_0x9427('0x1a')](_0x3a6f84);}return null;};}function patchUpdates(_0x2fa0ad){return function(_0x11fcd4){try{jsonpatch[_0x9427('0x1f')](_0x11fcd4,_0x2fa0ad,!![]);}catch(_0x1a60f6){return BPromise[_0x9427('0x20')](_0x1a60f6);}return _0x11fcd4[_0x9427('0x21')]();};}function saveUpdates(_0xa9da31,_0x97800f){return function(_0x236688){if(_0x236688){return _0x236688[_0x9427('0x22')](_0xa9da31)[_0x9427('0x23')](function(_0xdf042f){return _0xdf042f;});}return null;};}function removeEntity(_0xac18ea,_0x3e8743){return function(_0x4c6c09){if(_0x4c6c09){return _0x4c6c09['destroy']()[_0x9427('0x23')](function(){_0xac18ea[_0x9427('0x18')](0xcc)[_0x9427('0x19')]();});}};}function handleEntityNotFound(_0x40d8cb,_0x437dda){return function(_0x24f3c0){if(!_0x24f3c0){_0x40d8cb[_0x9427('0x17')](0x194);}return _0x24f3c0;};}function handleError(_0x355dcf,_0x1df6a8){_0x1df6a8=_0x1df6a8||0x1f4;return function(_0x1ecd67){logger[_0x9427('0x24')](_0x1ecd67[_0x9427('0x25')]);if(_0x1ecd67['name']){delete _0x1ecd67[_0x9427('0x26')];}_0x355dcf['status'](_0x1df6a8)[_0x9427('0x27')](_0x1ecd67);};}exports[_0x9427('0x28')]=function(_0x57c95a,_0x251cab){var _0x33b874={},_0x1aef2e={},_0x536c15={'count':0x0,'rows':[]};var _0x1c4c29=_['map'](db[_0x9427('0x29')][_0x9427('0x2a')],function(_0x5947d0){return{'name':_0x5947d0['fieldName'],'type':_0x5947d0[_0x9427('0x2b')][_0x9427('0x2c')]};});_0x1aef2e['model']=_[_0x9427('0x2d')](_0x1c4c29,_0x9427('0x26'));_0x1aef2e[_0x9427('0x2e')]=_[_0x9427('0x2f')](_0x57c95a[_0x9427('0x2e')]);_0x1aef2e['filters']=_['intersection'](_0x1aef2e[_0x9427('0x30')],_0x1aef2e[_0x9427('0x2e')]);_0x33b874[_0x9427('0x31')]=_['intersection'](_0x1aef2e[_0x9427('0x30')],qs[_0x9427('0x32')](_0x57c95a[_0x9427('0x2e')]['fields']));_0x33b874['attributes']=_0x33b874[_0x9427('0x31')]['length']?_0x33b874[_0x9427('0x31')]:_0x1aef2e[_0x9427('0x30')];if(!_0x57c95a[_0x9427('0x2e')]['hasOwnProperty'](_0x9427('0x33'))){_0x33b874[_0x9427('0x1d')]=qs[_0x9427('0x1d')](_0x57c95a[_0x9427('0x2e')][_0x9427('0x1d')]);_0x33b874[_0x9427('0x1c')]=qs['offset'](_0x57c95a['query'][_0x9427('0x1c')]);}_0x33b874[_0x9427('0x34')]=qs[_0x9427('0x35')](_0x57c95a[_0x9427('0x2e')][_0x9427('0x35')]);_0x33b874['where']=qs[_0x9427('0x36')](_[_0x9427('0x37')](_0x57c95a[_0x9427('0x2e')],_0x1aef2e[_0x9427('0x36')]),_0x1c4c29);if(_0x57c95a[_0x9427('0x2e')][_0x9427('0x38')]){_0x33b874[_0x9427('0x39')]=_['merge'](_0x33b874[_0x9427('0x39')],{'$or':_['map'](_0x1c4c29,function(_0x51e058){if(_0x51e058[_0x9427('0x2b')]!==_0x9427('0x3a')){var _0x1b3d95={};_0x1b3d95[_0x51e058[_0x9427('0x26')]]={'$like':'%'+_0x57c95a[_0x9427('0x2e')][_0x9427('0x38')]+'%'};return _0x1b3d95;}})});}_0x33b874=_['merge']({},_0x33b874,_0x57c95a['options']);var _0x689284={'where':_0x33b874['where']};return db[_0x9427('0x29')][_0x9427('0x1b')](_0x689284)['then'](function(_0x602324){_0x536c15[_0x9427('0x1b')]=_0x602324;if(_0x57c95a['query'][_0x9427('0x3b')]){_0x33b874[_0x9427('0x3c')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x9427('0x3d')](_0x33b874);})['then'](function(_0x3862ad){_0x536c15[_0x9427('0x3e')]=_0x3862ad;return _0x536c15;})[_0x9427('0x23')](respondWithFilteredResult(_0x251cab,_0x33b874))[_0x9427('0x3f')](handleError(_0x251cab,null));};exports[_0x9427('0x40')]=function(_0x3566a3,_0x14e137){var _0x2aacfe={'raw':!![],'where':{'id':_0x3566a3['params']['id']}},_0x3e04fd={};_0x3e04fd[_0x9427('0x30')]=_[_0x9427('0x2f')](db['FaxTransferReport']['rawAttributes']);_0x3e04fd[_0x9427('0x2e')]=_[_0x9427('0x2f')](_0x3566a3[_0x9427('0x2e')]);_0x3e04fd[_0x9427('0x36')]=_[_0x9427('0x41')](_0x3e04fd['model'],_0x3e04fd[_0x9427('0x2e')]);_0x2aacfe[_0x9427('0x31')]=_[_0x9427('0x41')](_0x3e04fd[_0x9427('0x30')],qs['fields'](_0x3566a3['query'][_0x9427('0x32')]));_0x2aacfe[_0x9427('0x31')]=_0x2aacfe[_0x9427('0x31')][_0x9427('0x42')]?_0x2aacfe[_0x9427('0x31')]:_0x3e04fd['model'];if(_0x3566a3[_0x9427('0x2e')][_0x9427('0x3b')]){_0x2aacfe['include']=[{'all':!![]}];}_0x2aacfe=_[_0x9427('0x43')]({},_0x2aacfe,_0x3566a3['options']);return db['FaxTransferReport']['find'](_0x2aacfe)['then'](handleEntityNotFound(_0x14e137,null))['then'](respondWithResult(_0x14e137,null))['catch'](handleError(_0x14e137,null));};exports[_0x9427('0x44')]=function(_0x56fb64,_0x4a1691){return db['FaxTransferReport'][_0x9427('0x44')](_0x56fb64[_0x9427('0x45')],{})['then'](respondWithResult(_0x4a1691,0xc9))['catch'](handleError(_0x4a1691,null));};exports[_0x9427('0x22')]=function(_0x118d6d,_0x57a9da){if(_0x118d6d['body']['id']){delete _0x118d6d[_0x9427('0x45')]['id'];}return db[_0x9427('0x29')]['find']({'where':{'id':_0x118d6d[_0x9427('0x46')]['id']}})[_0x9427('0x23')](handleEntityNotFound(_0x57a9da,null))[_0x9427('0x23')](saveUpdates(_0x118d6d['body'],null))[_0x9427('0x23')](respondWithResult(_0x57a9da,null))['catch'](handleError(_0x57a9da,null));};exports[_0x9427('0x47')]=function(_0xd33a1,_0x1a5a5c){return db[_0x9427('0x29')]['find']({'where':{'id':_0xd33a1[_0x9427('0x46')]['id']}})[_0x9427('0x23')](handleEntityNotFound(_0x1a5a5c,null))[_0x9427('0x23')](removeEntity(_0x1a5a5c,null))[_0x9427('0x3f')](handleError(_0x1a5a5c,null));};exports[_0x9427('0x48')]=function(_0x83a453,_0x5cd0cd){return db[_0x9427('0x29')][_0x9427('0x48')]()[_0x9427('0x23')](respondWithResult(_0x5cd0cd,null))[_0x9427('0x3f')](handleError(_0x5cd0cd,null));}; \ No newline at end of file +var _0x6208=['describe','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','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','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FaxTransferReport','rawAttributes','type','model','query','keys','filters','intersection','fields','length','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','count','include','findAll','rows','catch','show','params','attributes','includeAll','create','body','find'];(function(_0x3d5a86,_0x1843c4){var _0x4e0cff=function(_0x2222a5){while(--_0x2222a5){_0x3d5a86['push'](_0x3d5a86['shift']());}};_0x4e0cff(++_0x1843c4);}(_0x6208,0x17d));var _0x8620=function(_0x28b7ab,_0x16a764){_0x28b7ab=_0x28b7ab-0x0;var _0x56791b=_0x6208[_0x28b7ab];return _0x56791b;};'use strict';var pdf=require(_0x8620('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8620('0x1'));var zipdir=require(_0x8620('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8620('0x3'));var moment=require('moment');var BPromise=require(_0x8620('0x4'));var Mustache=require(_0x8620('0x5'));var util=require(_0x8620('0x6'));var path=require(_0x8620('0x7'));var sox=require(_0x8620('0x8'));var csv=require(_0x8620('0x9'));var ejs=require(_0x8620('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8620('0xb'));var crypto=require(_0x8620('0xc'));var jsforce=require(_0x8620('0xd'));var deskjs=require(_0x8620('0xe'));var toCsv=require(_0x8620('0x9'));var querystring=require(_0x8620('0xf'));var Papa=require(_0x8620('0x10'));var Redis=require(_0x8620('0x11'));var authService=require(_0x8620('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8620('0x13'));var hardwareService=require(_0x8620('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x8620('0x15'));var config=require(_0x8620('0x16'));var licenseUtil=require(_0x8620('0x17'));var db=require(_0x8620('0x18'))['db'];function respondWithStatusCode(_0x3d7a76,_0x36abcb){_0x36abcb=_0x36abcb||0xcc;return function(_0x578636){if(_0x578636){return _0x3d7a76[_0x8620('0x19')](_0x36abcb);}return _0x3d7a76['status'](_0x36abcb)[_0x8620('0x1a')]();};}function respondWithResult(_0x2747b3,_0x2490bb){_0x2490bb=_0x2490bb||0xc8;return function(_0x1e6721){if(_0x1e6721){return _0x2747b3['status'](_0x2490bb)[_0x8620('0x1b')](_0x1e6721);}};}function respondWithFilteredResult(_0x41ea96,_0x5908c0){return function(_0x4ae1d1){if(_0x4ae1d1){var _0x213668=_0x4ae1d1['count'],_0x12fe8d=_0x5908c0[_0x8620('0x1c')],_0x597e21=_0x5908c0[_0x8620('0x1c')]+_0x5908c0[_0x8620('0x1d')],_0x23c8e4;if(_0x597e21>=_0x213668){_0x597e21=_0x213668;_0x23c8e4=0xc8;}else{_0x23c8e4=0xce;}_0x41ea96[_0x8620('0x1e')](_0x23c8e4);return _0x41ea96[_0x8620('0x1f')](_0x8620('0x20'),_0x12fe8d+'-'+_0x597e21+'/'+_0x213668)[_0x8620('0x1b')](_0x4ae1d1);}return null;};}function patchUpdates(_0x8e35ae){return function(_0x2f6d60){try{jsonpatch[_0x8620('0x21')](_0x2f6d60,_0x8e35ae,!![]);}catch(_0xb73f31){return BPromise[_0x8620('0x22')](_0xb73f31);}return _0x2f6d60[_0x8620('0x23')]();};}function saveUpdates(_0x7deddb,_0x1ff783){return function(_0x186878){if(_0x186878){return _0x186878[_0x8620('0x24')](_0x7deddb)[_0x8620('0x25')](function(_0x2cc7d0){return _0x2cc7d0;});}return null;};}function removeEntity(_0x88ef0f,_0x49334a){return function(_0xa63ba9){if(_0xa63ba9){return _0xa63ba9[_0x8620('0x26')]()[_0x8620('0x25')](function(){_0x88ef0f[_0x8620('0x1e')](0xcc)[_0x8620('0x1a')]();});}};}function handleEntityNotFound(_0x291e6b,_0x28c3e1){return function(_0x41bf78){if(!_0x41bf78){_0x291e6b[_0x8620('0x19')](0x194);}return _0x41bf78;};}function handleError(_0x4ff541,_0x4d03cb){_0x4d03cb=_0x4d03cb||0x1f4;return function(_0x5b9e92){logger[_0x8620('0x27')](_0x5b9e92[_0x8620('0x28')]);if(_0x5b9e92[_0x8620('0x29')]){delete _0x5b9e92['name'];}_0x4ff541[_0x8620('0x1e')](_0x4d03cb)[_0x8620('0x2a')](_0x5b9e92);};}exports[_0x8620('0x2b')]=function(_0x18ef1d,_0xe0e33){var _0x33819f={},_0x520d9d={},_0x5e515c={'count':0x0,'rows':[]};var _0x460aef=_['map'](db[_0x8620('0x2c')][_0x8620('0x2d')],function(_0x25e3c1){return{'name':_0x25e3c1['fieldName'],'type':_0x25e3c1[_0x8620('0x2e')]['key']};});_0x520d9d[_0x8620('0x2f')]=_['map'](_0x460aef,_0x8620('0x29'));_0x520d9d[_0x8620('0x30')]=_[_0x8620('0x31')](_0x18ef1d[_0x8620('0x30')]);_0x520d9d[_0x8620('0x32')]=_[_0x8620('0x33')](_0x520d9d['model'],_0x520d9d['query']);_0x33819f['attributes']=_['intersection'](_0x520d9d[_0x8620('0x2f')],qs[_0x8620('0x34')](_0x18ef1d[_0x8620('0x30')]['fields']));_0x33819f['attributes']=_0x33819f['attributes'][_0x8620('0x35')]?_0x33819f['attributes']:_0x520d9d['model'];if(!_0x18ef1d['query']['hasOwnProperty'](_0x8620('0x36'))){_0x33819f[_0x8620('0x1d')]=qs[_0x8620('0x1d')](_0x18ef1d[_0x8620('0x30')][_0x8620('0x1d')]);_0x33819f[_0x8620('0x1c')]=qs[_0x8620('0x1c')](_0x18ef1d[_0x8620('0x30')][_0x8620('0x1c')]);}_0x33819f['order']=qs[_0x8620('0x37')](_0x18ef1d[_0x8620('0x30')][_0x8620('0x37')]);_0x33819f[_0x8620('0x38')]=qs['filters'](_[_0x8620('0x39')](_0x18ef1d[_0x8620('0x30')],_0x520d9d[_0x8620('0x32')]),_0x460aef);if(_0x18ef1d[_0x8620('0x30')][_0x8620('0x3a')]){_0x33819f[_0x8620('0x38')]=_[_0x8620('0x3b')](_0x33819f[_0x8620('0x38')],{'$or':_[_0x8620('0x3c')](_0x460aef,function(_0x27f7f3){if(_0x27f7f3[_0x8620('0x2e')]!==_0x8620('0x3d')){var _0x3068b7={};_0x3068b7[_0x27f7f3[_0x8620('0x29')]]={'$like':'%'+_0x18ef1d[_0x8620('0x30')][_0x8620('0x3a')]+'%'};return _0x3068b7;}})});}_0x33819f=_['merge']({},_0x33819f,_0x18ef1d[_0x8620('0x3e')]);var _0x2b38eb={'where':_0x33819f['where']};return db['FaxTransferReport'][_0x8620('0x3f')](_0x2b38eb)[_0x8620('0x25')](function(_0x1353be){_0x5e515c[_0x8620('0x3f')]=_0x1353be;if(_0x18ef1d[_0x8620('0x30')]['includeAll']){_0x33819f[_0x8620('0x40')]=[{'all':!![]}];}return db[_0x8620('0x2c')][_0x8620('0x41')](_0x33819f);})['then'](function(_0xce4cba){_0x5e515c[_0x8620('0x42')]=_0xce4cba;return _0x5e515c;})['then'](respondWithFilteredResult(_0xe0e33,_0x33819f))[_0x8620('0x43')](handleError(_0xe0e33,null));};exports[_0x8620('0x44')]=function(_0x536f3e,_0x15c187){var _0x36ddc3={'raw':!![],'where':{'id':_0x536f3e[_0x8620('0x45')]['id']}},_0x58fe38={};_0x58fe38[_0x8620('0x2f')]=_['keys'](db[_0x8620('0x2c')]['rawAttributes']);_0x58fe38[_0x8620('0x30')]=_[_0x8620('0x31')](_0x536f3e['query']);_0x58fe38[_0x8620('0x32')]=_['intersection'](_0x58fe38[_0x8620('0x2f')],_0x58fe38[_0x8620('0x30')]);_0x36ddc3[_0x8620('0x46')]=_['intersection'](_0x58fe38[_0x8620('0x2f')],qs['fields'](_0x536f3e[_0x8620('0x30')][_0x8620('0x34')]));_0x36ddc3[_0x8620('0x46')]=_0x36ddc3[_0x8620('0x46')][_0x8620('0x35')]?_0x36ddc3['attributes']:_0x58fe38[_0x8620('0x2f')];if(_0x536f3e[_0x8620('0x30')][_0x8620('0x47')]){_0x36ddc3['include']=[{'all':!![]}];}_0x36ddc3=_[_0x8620('0x3b')]({},_0x36ddc3,_0x536f3e[_0x8620('0x3e')]);return db[_0x8620('0x2c')]['find'](_0x36ddc3)[_0x8620('0x25')](handleEntityNotFound(_0x15c187,null))[_0x8620('0x25')](respondWithResult(_0x15c187,null))[_0x8620('0x43')](handleError(_0x15c187,null));};exports[_0x8620('0x48')]=function(_0x52b246,_0x210e26){return db['FaxTransferReport'][_0x8620('0x48')](_0x52b246[_0x8620('0x49')],{})['then'](respondWithResult(_0x210e26,0xc9))[_0x8620('0x43')](handleError(_0x210e26,null));};exports[_0x8620('0x24')]=function(_0x17aafc,_0x2eae82){if(_0x17aafc[_0x8620('0x49')]['id']){delete _0x17aafc[_0x8620('0x49')]['id'];}return db[_0x8620('0x2c')]['find']({'where':{'id':_0x17aafc[_0x8620('0x45')]['id']}})[_0x8620('0x25')](handleEntityNotFound(_0x2eae82,null))[_0x8620('0x25')](saveUpdates(_0x17aafc[_0x8620('0x49')],null))['then'](respondWithResult(_0x2eae82,null))['catch'](handleError(_0x2eae82,null));};exports[_0x8620('0x26')]=function(_0x45ad57,_0x304d9f){return db[_0x8620('0x2c')][_0x8620('0x4a')]({'where':{'id':_0x45ad57[_0x8620('0x45')]['id']}})[_0x8620('0x25')](handleEntityNotFound(_0x304d9f,null))['then'](removeEntity(_0x304d9f,null))[_0x8620('0x43')](handleError(_0x304d9f,null));};exports[_0x8620('0x4b')]=function(_0x3675fe,_0xc2f13a){return db['FaxTransferReport'][_0x8620('0x4b')]()[_0x8620('0x25')](respondWithResult(_0xc2f13a,null))[_0x8620('0x43')](handleError(_0xc2f13a,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index e929159..77ac7ce 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 _0xd627=['api','bluebird','request-promise','path','rimraf','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash'];(function(_0x3eb258,_0x26c27b){var _0x1b439f=function(_0x20535f){while(--_0x20535f){_0x3eb258['push'](_0x3eb258['shift']());}};_0x1b439f(++_0x26c27b);}(_0xd627,0x153));var _0x7d62=function(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0xd627[_0x3fb030];return _0xd6899b;};'use strict';var _=require(_0x7d62('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7d62('0x1'));var moment=require('moment');var BPromise=require(_0x7d62('0x2'));var rp=require(_0x7d62('0x3'));var fs=require('fs');var path=require(_0x7d62('0x4'));var rimraf=require(_0x7d62('0x5'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x114e23,_0x59c241){return _0x114e23[_0x7d62('0x6')](_0x7d62('0x7'),attributes,{'tableName':_0x7d62('0x8'),'paranoid':![],'indexes':[{'name':_0x7d62('0x9'),'fields':[_0x7d62('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc8e5=['define','FaxTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0xc8e5,0xb3));var _0x5c8e=function(_0xf4430a,_0x47303e){_0xf4430a=_0xf4430a-0x0;var _0x4490cd=_0xc8e5[_0xf4430a];return _0x4490cd;};'use strict';var _=require(_0x5c8e('0x0'));var util=require(_0x5c8e('0x1'));var logger=require(_0x5c8e('0x2'))(_0x5c8e('0x3'));var moment=require(_0x5c8e('0x4'));var BPromise=require(_0x5c8e('0x5'));var rp=require(_0x5c8e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5c8e('0x7'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x8a211b,_0x1027a5){return _0x8a211b[_0x5c8e('0x8')](_0x5c8e('0x9'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5c8e('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 d336312..041ccf5 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 _0x0c9c=['request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','then','info','FaxTransferReport,\x20%s,\x20%s'];(function(_0x1eb1ec,_0x47bfba){var _0x2e7e95=function(_0xbcfa68){while(--_0xbcfa68){_0x1eb1ec['push'](_0x1eb1ec['shift']());}};_0x2e7e95(++_0x47bfba);}(_0x0c9c,0x7d));var _0xc0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc0c9('0x0'));var moment=require('moment');var BPromise=require(_0xc0c9('0x1'));var rs=require(_0xc0c9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc0c9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc0c9('0x4'))(_0xc0c9('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc0c9('0x6')][_0xc0c9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xe3f71b,_0x435d3f,_0x681299){return new BPromise(function(_0xb4c2a8,_0x204cec){return client['request'](_0xe3f71b,_0x681299)[_0xc0c9('0x8')](function(_0x2ff22f){logger[_0xc0c9('0x9')](_0xc0c9('0xa'),_0x435d3f,_0xc0c9('0xb'));logger['debug'](_0xc0c9('0xc'),_0x435d3f,_0xc0c9('0xb'),JSON['stringify'](_0x2ff22f));if(_0x2ff22f[_0xc0c9('0xd')]){if(_0x2ff22f['error']['code']===0x1f4){logger[_0xc0c9('0xd')](_0xc0c9('0xa'),_0x435d3f,_0x2ff22f[_0xc0c9('0xd')]['message']);return _0x204cec(_0x2ff22f['error'][_0xc0c9('0xe')]);}logger[_0xc0c9('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x435d3f,_0x2ff22f['error'][_0xc0c9('0xe')]);return _0xb4c2a8(_0x2ff22f[_0xc0c9('0xd')][_0xc0c9('0xe')]);}else{logger[_0xc0c9('0x9')]('FaxTransferReport,\x20%s,\x20%s',_0x435d3f,_0xc0c9('0xb'));_0xb4c2a8(_0x2ff22f[_0xc0c9('0xf')][_0xc0c9('0xe')]);}})[_0xc0c9('0x10')](function(_0x3d463f){logger[_0xc0c9('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x435d3f,_0x3d463f);_0x204cec(_0x3d463f);});});} \ No newline at end of file +var _0xaa5a=['request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x128d68,_0x555a32){var _0x24ad4d=function(_0x101a3a){while(--_0x101a3a){_0x128d68['push'](_0x128d68['shift']());}};_0x24ad4d(++_0x555a32);}(_0xaa5a,0x1aa));var _0xaaa5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa5a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaaa5('0x0'));var util=require(_0xaaa5('0x1'));var moment=require('moment');var BPromise=require(_0xaaa5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaaa5('0x3'));var db=require(_0xaaa5('0x4'))['db'];var utils=require(_0xaaa5('0x5'));var logger=require(_0xaaa5('0x6'))(_0xaaa5('0x7'));var config=require(_0xaaa5('0x8'));var jayson=require(_0xaaa5('0x9'));var client=jayson[_0xaaa5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bcb04,_0x2893db,_0x2786da){return new BPromise(function(_0x590f32,_0x5b2f35){return client[_0xaaa5('0xb')](_0x5bcb04,_0x2786da)[_0xaaa5('0xc')](function(_0x23c4fa){logger[_0xaaa5('0xd')](_0xaaa5('0xe'),_0x2893db,_0xaaa5('0xf'));logger[_0xaaa5('0x10')](_0xaaa5('0x11'),_0x2893db,'request\x20sent',JSON[_0xaaa5('0x12')](_0x23c4fa));if(_0x23c4fa[_0xaaa5('0x13')]){if(_0x23c4fa['error'][_0xaaa5('0x14')]===0x1f4){logger[_0xaaa5('0x13')](_0xaaa5('0xe'),_0x2893db,_0x23c4fa[_0xaaa5('0x13')][_0xaaa5('0x15')]);return _0x5b2f35(_0x23c4fa[_0xaaa5('0x13')][_0xaaa5('0x15')]);}logger[_0xaaa5('0x13')](_0xaaa5('0xe'),_0x2893db,_0x23c4fa[_0xaaa5('0x13')][_0xaaa5('0x15')]);return _0x590f32(_0x23c4fa[_0xaaa5('0x13')][_0xaaa5('0x15')]);}else{logger[_0xaaa5('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x2893db,_0xaaa5('0xf'));_0x590f32(_0x23c4fa[_0xaaa5('0x16')][_0xaaa5('0x15')]);}})['catch'](function(_0x335e91){logger[_0xaaa5('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x2893db,_0x335e91);_0x5b2f35(_0x335e91);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index a8f7115..745eb28 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 _0xd593=['isAuthenticated','show','post','create','/:id','update','delete','destroy','multer','util','connect-timeout','Router','../../components/interaction/service','./faxTransferReport.controller','index','get','describe'];(function(_0x3f5c87,_0x1fd95f){var _0x5bd4bb=function(_0x438818){while(--_0x438818){_0x3f5c87['push'](_0x3f5c87['shift']());}};_0x5bd4bb(++_0x1fd95f);}(_0xd593,0x18f));var _0x3d59=function(_0x9fed82,_0x12f7f2){_0x9fed82=_0x9fed82-0x0;var _0x57d8ba=_0xd593[_0x9fed82];return _0x57d8ba;};'use strict';var multer=require(_0x3d59('0x0'));var util=require(_0x3d59('0x1'));var path=require('path');var timeout=require(_0x3d59('0x2'));var express=require('express');var router=express[_0x3d59('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3d59('0x4'));var config=require('../../config/environment');var controller=require(_0x3d59('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x3d59('0x6')]);router[_0x3d59('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x3d59('0x8')]);router[_0x3d59('0x7')]('/:id',auth[_0x3d59('0x9')](),controller[_0x3d59('0xa')]);router[_0x3d59('0xb')]('/',auth['isAuthenticated'](),controller[_0x3d59('0xc')]);router['put'](_0x3d59('0xd'),auth[_0x3d59('0x9')](),controller[_0x3d59('0xe')]);router[_0x3d59('0xf')](_0x3d59('0xd'),auth[_0x3d59('0x9')](),controller[_0x3d59('0x10')]);module['exports']=router; \ No newline at end of file +var _0xdfe9=['index','isAuthenticated','describe','show','post','create','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0xdfe9,0xf4));var _0x9dfe=function(_0x301305,_0x39b39c){_0x301305=_0x301305-0x0;var _0x5dab58=_0xdfe9[_0x301305];return _0x5dab58;};'use strict';var multer=require(_0x9dfe('0x0'));var util=require(_0x9dfe('0x1'));var path=require(_0x9dfe('0x2'));var timeout=require(_0x9dfe('0x3'));var express=require(_0x9dfe('0x4'));var router=express['Router']();var auth=require(_0x9dfe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9dfe('0x6'));var controller=require('./faxTransferReport.controller');router[_0x9dfe('0x7')]('/',auth['isAuthenticated'](),controller[_0x9dfe('0x8')]);router[_0x9dfe('0x7')]('/describe',auth[_0x9dfe('0x9')](),controller[_0x9dfe('0xa')]);router[_0x9dfe('0x7')]('/:id',auth[_0x9dfe('0x9')](),controller[_0x9dfe('0xb')]);router[_0x9dfe('0xc')]('/',auth[_0x9dfe('0x9')](),controller[_0x9dfe('0xd')]);router['put']('/:id',auth[_0x9dfe('0x9')](),controller[_0x9dfe('0xe')]);router[_0x9dfe('0xf')](_0x9dfe('0x10'),auth[_0x9dfe('0x9')](),controller[_0x9dfe('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 5de068b..a5c6b61 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 _0x2893=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','update','destroy'];(function(_0x192d1a,_0x3e7389){var _0xef435d=function(_0x5bcd61){while(--_0x5bcd61){_0x192d1a['push'](_0x192d1a['shift']());}};_0xef435d(++_0x3e7389);}(_0x2893,0x1a5));var _0x3289=function(_0x47fa10,_0x39b01c){_0x47fa10=_0x47fa10-0x0;var _0x204f30=_0x2893[_0x47fa10];return _0x204f30;};'use strict';var multer=require(_0x3289('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3289('0x1'));var express=require(_0x3289('0x2'));var router=express[_0x3289('0x3')]();var auth=require(_0x3289('0x4'));var interaction=require(_0x3289('0x5'));var config=require('../../config/environment');var controller=require(_0x3289('0x6'));router[_0x3289('0x7')]('/',auth[_0x3289('0x8')](),controller[_0x3289('0x9')]);router[_0x3289('0x7')](_0x3289('0xa'),auth[_0x3289('0x8')](),controller[_0x3289('0xb')]);router[_0x3289('0x7')](_0x3289('0xc'),auth['isAuthenticated'](),controller[_0x3289('0xd')]);router['get'](_0x3289('0xe'),auth[_0x3289('0x8')](),controller[_0x3289('0xf')]);router[_0x3289('0x10')]('/',auth[_0x3289('0x8')](),controller['create']);router[_0x3289('0x10')](_0x3289('0xc'),auth[_0x3289('0x8')](),controller['addConfiguration']);router[_0x3289('0x11')](_0x3289('0xa'),auth['isAuthenticated'](),controller[_0x3289('0x12')]);router['delete'](_0x3289('0xa'),auth[_0x3289('0x8')](),controller[_0x3289('0x13')]);module[_0x3289('0x14')]=router; \ No newline at end of file +var _0x34f4=['/:id','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x5b9467,_0x45207f){var _0x15ec52=function(_0x330da7){while(--_0x330da7){_0x5b9467['push'](_0x5b9467['shift']());}};_0x15ec52(++_0x45207f);}(_0x34f4,0x1de));var _0x434f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x34f4[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x434f('0x0'));var util=require(_0x434f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x434f('0x2'));var interaction=require(_0x434f('0x3'));var config=require(_0x434f('0x4'));var controller=require('./intDeskAccount.controller');router[_0x434f('0x5')]('/',auth[_0x434f('0x6')](),controller[_0x434f('0x7')]);router['get'](_0x434f('0x8'),auth[_0x434f('0x6')](),controller['show']);router[_0x434f('0x5')](_0x434f('0x9'),auth[_0x434f('0x6')](),controller['getConfigurations']);router[_0x434f('0x5')](_0x434f('0xa'),auth[_0x434f('0x6')](),controller[_0x434f('0xb')]);router[_0x434f('0xc')]('/',auth[_0x434f('0x6')](),controller[_0x434f('0xd')]);router[_0x434f('0xc')](_0x434f('0x9'),auth[_0x434f('0x6')](),controller[_0x434f('0xe')]);router[_0x434f('0xf')](_0x434f('0x8'),auth[_0x434f('0x6')](),controller[_0x434f('0x10')]);router[_0x434f('0x11')](_0x434f('0x8'),auth[_0x434f('0x6')](),controller['destroy']);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 efe5c94..59453d2 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 _0x20d6=['basic','newTab','sequelize','exports','STRING','ENUM'];(function(_0xb8b26c,_0x4c9acd){var _0x18aaa0=function(_0x5931ee){while(--_0x5931ee){_0xb8b26c['push'](_0xb8b26c['shift']());}};_0x18aaa0(++_0x4c9acd);}(_0x20d6,0x1b8));var _0x620d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x20d6[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x620d('0x0'));module[_0x620d('0x1')]={'name':{'type':Sequelize[_0x620d('0x2')]},'description':{'type':Sequelize[_0x620d('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x620d('0x2')]},'authType':{'type':Sequelize[_0x620d('0x3')](_0x620d('0x4')),'defaultValue':_0x620d('0x4')},'password':{'type':Sequelize[_0x620d('0x2')]},'consumerKey':{'type':Sequelize[_0x620d('0x2')]},'consumerSecret':{'type':Sequelize[_0x620d('0x2')]},'token':{'type':Sequelize[_0x620d('0x2')]},'tokenSecret':{'type':Sequelize[_0x620d('0x2')]},'serverUrl':{'type':Sequelize[_0x620d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x620d('0x3')]('integrationTab',_0x620d('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xfff0=['ENUM','basic','integrationTab','exports','STRING'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xfff0,0x139));var _0x0fff=function(_0x2e3ede,_0x3ae655){_0x2e3ede=_0x2e3ede-0x0;var _0x28c0f1=_0xfff0[_0x2e3ede];return _0x28c0f1;};'use strict';var Sequelize=require('sequelize');module[_0x0fff('0x0')]={'name':{'type':Sequelize[_0x0fff('0x1')]},'description':{'type':Sequelize[_0x0fff('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0fff('0x1')]},'authType':{'type':Sequelize[_0x0fff('0x2')](_0x0fff('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x0fff('0x1')]},'consumerKey':{'type':Sequelize[_0x0fff('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x0fff('0x1')]},'tokenSecret':{'type':Sequelize[_0x0fff('0x1')]},'serverUrl':{'type':Sequelize[_0x0fff('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0fff('0x4'),'newTab'),'defaultValue':_0x0fff('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 4f1274e..ac24603 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 _0xa2f8=['show','params','includeAll','find','create','body','destroy','getConfigurations','findOne','DeskConfiguration','sort','Subjects','channel','Descriptions','getDescriptions','DeskField','priority','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','headers','Authorization','Basic\x20%s','%s:%s','username','toString','_embedded','entries','label','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','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','../../components/integrations/configuration','jayson/promise','client','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','status','end','json','offset','set','Content-Range','save','update','then','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','filters','pick','merge','VIRTUAL','filter','options','count','include','findAll','rows'];(function(_0x43fb15,_0x4b3f5b){var _0x42d47a=function(_0x27859b){while(--_0x27859b){_0x43fb15['push'](_0x43fb15['shift']());}};_0x42d47a(++_0x4b3f5b);}(_0xa2f8,0x18a));var _0x8a2f=function(_0xaebcc8,_0x197dd2){_0xaebcc8=_0xaebcc8-0x0;var _0x3693fa=_0xa2f8[_0xaebcc8];return _0x3693fa;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8a2f('0x0'));var rimraf=require(_0x8a2f('0x1'));var zipdir=require(_0x8a2f('0x2'));var jsonpatch=require(_0x8a2f('0x3'));var rp=require(_0x8a2f('0x4'));var moment=require(_0x8a2f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8a2f('0x6'));var util=require(_0x8a2f('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x8a2f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8a2f('0x9'));var deskjs=require(_0x8a2f('0xa'));var toCsv=require(_0x8a2f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8a2f('0xb'));var authService=require(_0x8a2f('0xc'));var qs=require(_0x8a2f('0xd'));var as=require(_0x8a2f('0xe'));var hardwareService=require(_0x8a2f('0xf'));var logger=require(_0x8a2f('0x10'))(_0x8a2f('0x11'));var utils=require(_0x8a2f('0x12'));var config=require(_0x8a2f('0x13'));var licenseUtil=require(_0x8a2f('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8a2f('0x15'));var jayson=require(_0x8a2f('0x16'));var client=jayson[_0x8a2f('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b94fd,_0x593fd7,_0x325760,_0x4216db){return new BPromise(function(_0x594f13,_0x349588){var _0x2eb3c9=_0x4216db||client;return _0x2eb3c9[_0x8a2f('0x18')](_0x2b94fd,_0x325760)['then'](function(_0x934008){logger[_0x8a2f('0x19')](_0x8a2f('0x1a'),_0x593fd7,_0x8a2f('0x1b'));logger[_0x8a2f('0x1c')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x593fd7,_0x8a2f('0x1b'),JSON['stringify'](_0x934008));if(_0x934008[_0x8a2f('0x1d')]){if(_0x934008[_0x8a2f('0x1d')][_0x8a2f('0x1e')]===0x1f4){logger[_0x8a2f('0x1d')](_0x8a2f('0x1a'),_0x593fd7,_0x934008[_0x8a2f('0x1d')]['message']);return _0x349588(_0x934008[_0x8a2f('0x1d')][_0x8a2f('0x1f')]);}logger['error'](_0x8a2f('0x1a'),_0x593fd7,_0x934008[_0x8a2f('0x1d')]['message']);return _0x594f13(_0x934008['error'][_0x8a2f('0x1f')]);}else{logger[_0x8a2f('0x19')](_0x8a2f('0x1a'),_0x593fd7,_0x8a2f('0x1b'));_0x594f13(_0x934008['result']['message']);}})[_0x8a2f('0x20')](function(_0x3d41d2){logger[_0x8a2f('0x1d')](_0x8a2f('0x1a'),_0x593fd7,_0x3d41d2);_0x349588(_0x3d41d2);});});}function respondWithStatusCode(_0x2dd16f,_0x16dd44){_0x16dd44=_0x16dd44||0xcc;return function(_0x659efc){if(_0x659efc){return _0x2dd16f[_0x8a2f('0x21')](_0x16dd44);}return _0x2dd16f[_0x8a2f('0x22')](_0x16dd44)[_0x8a2f('0x23')]();};}function respondWithResult(_0x5ed51c,_0x143cb1){_0x143cb1=_0x143cb1||0xc8;return function(_0x588d44){if(_0x588d44){return _0x5ed51c[_0x8a2f('0x22')](_0x143cb1)[_0x8a2f('0x24')](_0x588d44);}};}function respondWithFilteredResult(_0x34f117,_0x28403c){return function(_0x43406d){if(_0x43406d){var _0x2d269a=_0x43406d['count'],_0x571629=_0x28403c[_0x8a2f('0x25')],_0x4a4274=_0x28403c[_0x8a2f('0x25')]+_0x28403c['limit'],_0xb6b5d6;if(_0x4a4274>=_0x2d269a){_0x4a4274=_0x2d269a;_0xb6b5d6=0xc8;}else{_0xb6b5d6=0xce;}_0x34f117[_0x8a2f('0x22')](_0xb6b5d6);return _0x34f117[_0x8a2f('0x26')](_0x8a2f('0x27'),_0x571629+'-'+_0x4a4274+'/'+_0x2d269a)[_0x8a2f('0x24')](_0x43406d);}return null;};}function patchUpdates(_0xc9fca7){return function(_0x4012ac){try{jsonpatch['apply'](_0x4012ac,_0xc9fca7,!![]);}catch(_0xe569fd){return BPromise['reject'](_0xe569fd);}return _0x4012ac[_0x8a2f('0x28')]();};}function saveUpdates(_0x5d0c1e,_0x2bcf87){return function(_0x2bfce8){if(_0x2bfce8){return _0x2bfce8[_0x8a2f('0x29')](_0x5d0c1e)[_0x8a2f('0x2a')](function(_0x56ffa7){return _0x56ffa7;});}return null;};}function removeEntity(_0x53d9fa,_0x18ce2c){return function(_0x980329){if(_0x980329){return _0x980329['destroy']()[_0x8a2f('0x2a')](function(){_0x53d9fa[_0x8a2f('0x22')](0xcc)[_0x8a2f('0x23')]();});}};}function handleEntityNotFound(_0x17bd96,_0x4495f5){return function(_0x12bf94){if(!_0x12bf94){_0x17bd96['sendStatus'](0x194);}return _0x12bf94;};}function handleError(_0x5bf9a3,_0x2bcc4a){_0x2bcc4a=_0x2bcc4a||0x1f4;return function(_0x3b7c15){logger[_0x8a2f('0x1d')](_0x3b7c15[_0x8a2f('0x2b')]);if(_0x3b7c15['name']){delete _0x3b7c15[_0x8a2f('0x2c')];}_0x5bf9a3[_0x8a2f('0x22')](_0x2bcc4a)[_0x8a2f('0x2d')](_0x3b7c15);};}exports[_0x8a2f('0x2e')]=function(_0x355d30,_0x28a148){var _0x57f245={},_0x567257={},_0x593da0={'count':0x0,'rows':[]};var _0x1d9815=_[_0x8a2f('0x2f')](db[_0x8a2f('0x30')][_0x8a2f('0x31')],function(_0xaeaf38){return{'name':_0xaeaf38[_0x8a2f('0x32')],'type':_0xaeaf38[_0x8a2f('0x33')]['key']};});_0x567257[_0x8a2f('0x34')]=_[_0x8a2f('0x2f')](_0x1d9815,_0x8a2f('0x2c'));_0x567257[_0x8a2f('0x35')]=_[_0x8a2f('0x36')](_0x355d30[_0x8a2f('0x35')]);_0x567257['filters']=_[_0x8a2f('0x37')](_0x567257[_0x8a2f('0x34')],_0x567257[_0x8a2f('0x35')]);_0x57f245[_0x8a2f('0x38')]=_[_0x8a2f('0x37')](_0x567257[_0x8a2f('0x34')],qs[_0x8a2f('0x39')](_0x355d30[_0x8a2f('0x35')]['fields']));_0x57f245[_0x8a2f('0x38')]=_0x57f245[_0x8a2f('0x38')][_0x8a2f('0x3a')]?_0x57f245[_0x8a2f('0x38')]:_0x567257[_0x8a2f('0x34')];if(!_0x355d30['query'][_0x8a2f('0x3b')](_0x8a2f('0x3c'))){_0x57f245[_0x8a2f('0x3d')]=qs[_0x8a2f('0x3d')](_0x355d30[_0x8a2f('0x35')][_0x8a2f('0x3d')]);_0x57f245[_0x8a2f('0x25')]=qs[_0x8a2f('0x25')](_0x355d30['query']['offset']);}_0x57f245[_0x8a2f('0x3e')]=qs['sort'](_0x355d30[_0x8a2f('0x35')]['sort']);_0x57f245[_0x8a2f('0x3f')]=qs[_0x8a2f('0x40')](_[_0x8a2f('0x41')](_0x355d30[_0x8a2f('0x35')],_0x567257['filters']),_0x1d9815);if(_0x355d30[_0x8a2f('0x35')]['filter']){_0x57f245['where']=_[_0x8a2f('0x42')](_0x57f245['where'],{'$or':_[_0x8a2f('0x2f')](_0x1d9815,function(_0x12c6f5){if(_0x12c6f5['type']!==_0x8a2f('0x43')){var _0x220d88={};_0x220d88[_0x12c6f5[_0x8a2f('0x2c')]]={'$like':'%'+_0x355d30['query'][_0x8a2f('0x44')]+'%'};return _0x220d88;}})});}_0x57f245=_[_0x8a2f('0x42')]({},_0x57f245,_0x355d30[_0x8a2f('0x45')]);var _0x1067f0={'where':_0x57f245[_0x8a2f('0x3f')]};return db[_0x8a2f('0x30')][_0x8a2f('0x46')](_0x1067f0)[_0x8a2f('0x2a')](function(_0xa440ae){_0x593da0[_0x8a2f('0x46')]=_0xa440ae;if(_0x355d30[_0x8a2f('0x35')]['includeAll']){_0x57f245[_0x8a2f('0x47')]=[{'all':!![]}];}return db[_0x8a2f('0x30')][_0x8a2f('0x48')](_0x57f245);})[_0x8a2f('0x2a')](function(_0x21cb39){_0x593da0[_0x8a2f('0x49')]=_0x21cb39;return _0x593da0;})[_0x8a2f('0x2a')](respondWithFilteredResult(_0x28a148,_0x57f245))[_0x8a2f('0x20')](handleError(_0x28a148,null));};exports[_0x8a2f('0x4a')]=function(_0x117f2a,_0x16c0a2){var _0x245e10={'raw':![],'where':{'id':_0x117f2a[_0x8a2f('0x4b')]['id']}},_0x4f4a01={};_0x4f4a01[_0x8a2f('0x34')]=_[_0x8a2f('0x36')](db['DeskAccount'][_0x8a2f('0x31')]);_0x4f4a01['query']=_['keys'](_0x117f2a['query']);_0x4f4a01['filters']=_['intersection'](_0x4f4a01[_0x8a2f('0x34')],_0x4f4a01[_0x8a2f('0x35')]);_0x245e10[_0x8a2f('0x38')]=_['intersection'](_0x4f4a01[_0x8a2f('0x34')],qs[_0x8a2f('0x39')](_0x117f2a[_0x8a2f('0x35')][_0x8a2f('0x39')]));_0x245e10[_0x8a2f('0x38')]=_0x245e10['attributes']['length']?_0x245e10[_0x8a2f('0x38')]:_0x4f4a01['model'];if(_0x117f2a['query'][_0x8a2f('0x4c')]){_0x245e10[_0x8a2f('0x47')]=[{'all':!![]}];}_0x245e10=_[_0x8a2f('0x42')]({},_0x245e10,_0x117f2a[_0x8a2f('0x45')]);return db['DeskAccount'][_0x8a2f('0x4d')](_0x245e10)['then'](handleEntityNotFound(_0x16c0a2,null))['then'](respondWithResult(_0x16c0a2,null))[_0x8a2f('0x20')](handleError(_0x16c0a2,null));};exports[_0x8a2f('0x4e')]=function(_0xb1aa5e,_0x4b4578){return db[_0x8a2f('0x30')][_0x8a2f('0x4e')](_0xb1aa5e[_0x8a2f('0x4f')],{})[_0x8a2f('0x2a')](respondWithResult(_0x4b4578,0xc9))[_0x8a2f('0x20')](handleError(_0x4b4578,null));};exports[_0x8a2f('0x29')]=function(_0x45d1f9,_0x451bf9){if(_0x45d1f9['body']['id']){delete _0x45d1f9[_0x8a2f('0x4f')]['id'];}return db[_0x8a2f('0x30')][_0x8a2f('0x4d')]({'where':{'id':_0x45d1f9[_0x8a2f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x451bf9,null))[_0x8a2f('0x2a')](saveUpdates(_0x45d1f9[_0x8a2f('0x4f')],null))[_0x8a2f('0x2a')](respondWithResult(_0x451bf9,null))[_0x8a2f('0x20')](handleError(_0x451bf9,null));};exports[_0x8a2f('0x50')]=function(_0x5dc351,_0x205b39){return db[_0x8a2f('0x30')][_0x8a2f('0x4d')]({'where':{'id':_0x5dc351[_0x8a2f('0x4b')]['id']}})[_0x8a2f('0x2a')](handleEntityNotFound(_0x205b39,null))[_0x8a2f('0x2a')](removeEntity(_0x205b39,null))[_0x8a2f('0x20')](handleError(_0x205b39,null));};exports[_0x8a2f('0x51')]=function(_0x34a81a,_0x1a03bf,_0x118806){var _0x34ecd1={};var _0x42de87={};var _0x24ae41;var _0x505e96;return db[_0x8a2f('0x30')][_0x8a2f('0x52')]({'where':{'id':_0x34a81a['params']['id']}})[_0x8a2f('0x2a')](handleEntityNotFound(_0x1a03bf,null))[_0x8a2f('0x2a')](function(_0x574bcd){if(_0x574bcd){_0x24ae41=_0x574bcd;_0x42de87[_0x8a2f('0x34')]=_['keys'](db[_0x8a2f('0x53')]['rawAttributes']);_0x42de87['query']=_[_0x8a2f('0x36')](_0x34a81a[_0x8a2f('0x35')]);_0x42de87[_0x8a2f('0x40')]=_[_0x8a2f('0x37')](_0x42de87[_0x8a2f('0x34')],_0x42de87['query']);_0x34ecd1[_0x8a2f('0x38')]=_['intersection'](_0x42de87[_0x8a2f('0x34')],qs[_0x8a2f('0x39')](_0x34a81a[_0x8a2f('0x35')]['fields']));_0x34ecd1[_0x8a2f('0x38')]=_0x34ecd1['attributes']['length']?_0x34ecd1[_0x8a2f('0x38')]:_0x42de87['model'];_0x34ecd1[_0x8a2f('0x3e')]=qs[_0x8a2f('0x54')](_0x34a81a[_0x8a2f('0x35')]['sort']);_0x34ecd1[_0x8a2f('0x3f')]=qs[_0x8a2f('0x40')](_[_0x8a2f('0x41')](_0x34a81a[_0x8a2f('0x35')],_0x42de87['filters']));if(_0x34a81a[_0x8a2f('0x35')][_0x8a2f('0x44')]){_0x34ecd1[_0x8a2f('0x3f')]=_[_0x8a2f('0x42')](_0x34ecd1[_0x8a2f('0x3f')],{'$or':_[_0x8a2f('0x2f')](_0x34ecd1['attributes'],function(_0x2c0bcb){var _0x2e7cdd={};_0x2e7cdd[_0x2c0bcb]={'$like':'%'+_0x34a81a[_0x8a2f('0x35')]['filter']+'%'};return _0x2e7cdd;})});}_0x34ecd1=_[_0x8a2f('0x42')]({},_0x34ecd1,_0x34a81a[_0x8a2f('0x45')]);return _0x24ae41['getConfigurations'](_0x34ecd1);}})['then'](function(_0x51815b){if(_0x51815b){_0x505e96=_0x51815b[_0x8a2f('0x3a')];if(!_0x34a81a[_0x8a2f('0x35')]['hasOwnProperty'](_0x8a2f('0x3c'))){_0x34ecd1[_0x8a2f('0x3d')]=qs[_0x8a2f('0x3d')](_0x34a81a[_0x8a2f('0x35')][_0x8a2f('0x3d')]);_0x34ecd1['offset']=qs[_0x8a2f('0x25')](_0x34a81a[_0x8a2f('0x35')]['offset']);}return _0x24ae41[_0x8a2f('0x51')](_0x34ecd1);}})[_0x8a2f('0x2a')](function(_0x46a1b6){if(_0x46a1b6){return _0x46a1b6?{'count':_0x505e96,'rows':_0x46a1b6}:null;}})[_0x8a2f('0x2a')](respondWithResult(_0x1a03bf,null))[_0x8a2f('0x20')](handleError(_0x1a03bf,null));};exports['addConfiguration']=function(_0x3ceece,_0x2d976d,_0x29da63){if(_0x3ceece[_0x8a2f('0x4f')]['id']){delete _0x3ceece['body']['id'];}return db[_0x8a2f('0x30')][_0x8a2f('0x52')]({'where':{'id':_0x3ceece['params']['id']}})[_0x8a2f('0x2a')](handleEntityNotFound(_0x2d976d,null))[_0x8a2f('0x2a')](function(_0x515894){if(_0x515894){_0x3ceece['body']['AccountId']=_0x515894['id'];_0x3ceece[_0x8a2f('0x4f')][_0x8a2f('0x55')]=integrations['getSubjects'](_0x3ceece[_0x8a2f('0x4f')][_0x8a2f('0x56')],_0x3ceece[_0x8a2f('0x4f')][_0x8a2f('0x33')]);_0x3ceece['body'][_0x8a2f('0x57')]=integrations[_0x8a2f('0x58')](_0x3ceece[_0x8a2f('0x4f')][_0x8a2f('0x56')],_0x3ceece['body'][_0x8a2f('0x33')]);return db[_0x8a2f('0x53')][_0x8a2f('0x4e')](_0x3ceece['body'],{'include':[{'model':db[_0x8a2f('0x59')],'as':'Subjects'},{'model':db[_0x8a2f('0x59')],'as':'Descriptions'}]});}return null;})[_0x8a2f('0x2a')](respondWithResult(_0x2d976d,null))[_0x8a2f('0x20')](handleError(_0x2d976d,null));};exports['getFields']=function(_0x26c45c,_0x1d4090,_0x441608){var _0x2134e6=[{'name':_0x8a2f('0x5a'),'label':_0x8a2f('0x5a'),'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 _0x3eb785='';return db['DeskAccount'][_0x8a2f('0x52')]({'where':{'id':_0x26c45c[_0x8a2f('0x4b')]['id']},'attributes':['id','remoteUri','authType','username',_0x8a2f('0x5b'),_0x8a2f('0x5c'),_0x8a2f('0x5d'),_0x8a2f('0x5e'),_0x8a2f('0x5f')]})[_0x8a2f('0x2a')](handleEntityNotFound(_0x1d4090,null))[_0x8a2f('0x2a')](function(_0x32c156){if(_0x32c156){_0x3eb785=_0x32c156['remoteUri'];var _0x106add=_0x3eb785[_0x8a2f('0x60')](-0x1);if(_0x106add==='/'){_0x3eb785=_0x3eb785[_0x8a2f('0x61')](0x0,_0x3eb785[_0x8a2f('0x62')](_0x106add));}var _0x752c20={'method':_0x8a2f('0x63'),'uri':util[_0x8a2f('0x64')](_0x8a2f('0x65'),_0x3eb785),'headers':{'Content-Type':_0x8a2f('0x66'),'Accept':_0x8a2f('0x66')},'json':!![]};if(_0x32c156[_0x8a2f('0x67')]==='basic'){_0x752c20[_0x8a2f('0x68')][_0x8a2f('0x69')]=util['format'](_0x8a2f('0x6a'),new Buffer(util[_0x8a2f('0x64')](_0x8a2f('0x6b'),_0x32c156[_0x8a2f('0x6c')],_0x32c156[_0x8a2f('0x5b')]))[_0x8a2f('0x6d')]('base64'));}return rp(_0x752c20)[_0x8a2f('0x2a')](function(_0x5ca53b){return _0x2134e6['concat'](_[_0x8a2f('0x2f')](_0x5ca53b[_0x8a2f('0x6e')][_0x8a2f('0x6f')],function(_0x36b163){return{'id':_0x36b163[_0x8a2f('0x2c')],'name':_0x36b163[_0x8a2f('0x2c')],'type':_0x36b163['type'],'active':_0x36b163['active'],'label':_0x36b163[_0x8a2f('0x70')],'custom':!![]};}));});}})['then'](function(_0x3fc8ac){return{'count':_0x3fc8ac[_0x8a2f('0x3a')],'rows':_0x3fc8ac};})['then'](respondWithResult(_0x1d4090,null))[_0x8a2f('0x20')](function(_0x10c4b9){var _0xc22e9=_0x26c45c[_0x8a2f('0x35')]['test']?0x1f4:_0x10c4b9['statusCode']||0x1f4;logger[_0x8a2f('0x1d')](_0x8a2f('0x71'),_0x8a2f('0x72'),_0xc22e9,JSON['stringify'](_0x10c4b9));delete _0x10c4b9['name'];if(_0xc22e9===0x191){_0xc22e9=0x190;}_0x1d4090[_0x8a2f('0x22')](_0xc22e9)[_0x8a2f('0x2d')](_0x26c45c[_0x8a2f('0x35')][_0x8a2f('0x73')]?{'message':_0x8a2f('0x74'),'statusCode':_0x10c4b9['statusCode']}:_0x10c4b9);});}; \ No newline at end of file +var _0xf2d8=['request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','destroy','stack','name','index','DeskAccount','rawAttributes','type','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','show','params','options','find','create','body','update','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','consumerKey','consumerSecret','token','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','username','password','toString','base64','_embedded','active','label','test','statusCode','send','Wrong\x20credentials','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s'];(function(_0x4725e8,_0x440ab1){var _0x5aedb2=function(_0x5e01a1){while(--_0x5e01a1){_0x4725e8['push'](_0x4725e8['shift']());}};_0x5aedb2(++_0x440ab1);}(_0xf2d8,0x1ce));var _0x8f2d=function(_0x3a7b72,_0x43751b){_0x3a7b72=_0x3a7b72-0x0;var _0x2752a3=_0xf2d8[_0x3a7b72];return _0x2752a3;};'use strict';var pdf=require(_0x8f2d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8f2d('0x1'));var jsonpatch=require(_0x8f2d('0x2'));var rp=require(_0x8f2d('0x3'));var moment=require(_0x8f2d('0x4'));var BPromise=require(_0x8f2d('0x5'));var Mustache=require(_0x8f2d('0x6'));var util=require(_0x8f2d('0x7'));var path=require(_0x8f2d('0x8'));var sox=require(_0x8f2d('0x9'));var csv=require(_0x8f2d('0xa'));var ejs=require(_0x8f2d('0xb'));var fs=require('fs');var _=require(_0x8f2d('0xc'));var squel=require(_0x8f2d('0xd'));var crypto=require(_0x8f2d('0xe'));var jsforce=require(_0x8f2d('0xf'));var deskjs=require(_0x8f2d('0x10'));var toCsv=require(_0x8f2d('0xa'));var querystring=require('querystring');var Papa=require(_0x8f2d('0x11'));var Redis=require(_0x8f2d('0x12'));var authService=require(_0x8f2d('0x13'));var qs=require(_0x8f2d('0x14'));var as=require(_0x8f2d('0x15'));var hardwareService=require(_0x8f2d('0x16'));var logger=require(_0x8f2d('0x17'))(_0x8f2d('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8f2d('0x19'))['db'];var integrations=require(_0x8f2d('0x1a'));var jayson=require(_0x8f2d('0x1b'));var client=jayson[_0x8f2d('0x1c')][_0x8f2d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1a8ffb,_0x428d92,_0x40a04a,_0x5a1c68){return new BPromise(function(_0x54a6ee,_0x3cc19f){var _0x3f38b4=_0x5a1c68||client;return _0x3f38b4[_0x8f2d('0x1e')](_0x1a8ffb,_0x40a04a)[_0x8f2d('0x1f')](function(_0x25d53a){logger[_0x8f2d('0x20')](_0x8f2d('0x21'),_0x428d92,_0x8f2d('0x22'));logger[_0x8f2d('0x23')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x428d92,'request\x20sent',JSON[_0x8f2d('0x24')](_0x25d53a));if(_0x25d53a['error']){if(_0x25d53a[_0x8f2d('0x25')][_0x8f2d('0x26')]===0x1f4){logger['error'](_0x8f2d('0x21'),_0x428d92,_0x25d53a[_0x8f2d('0x25')][_0x8f2d('0x27')]);return _0x3cc19f(_0x25d53a['error'][_0x8f2d('0x27')]);}logger['error'](_0x8f2d('0x21'),_0x428d92,_0x25d53a['error'][_0x8f2d('0x27')]);return _0x54a6ee(_0x25d53a['error']['message']);}else{logger[_0x8f2d('0x20')](_0x8f2d('0x21'),_0x428d92,'request\x20sent');_0x54a6ee(_0x25d53a['result'][_0x8f2d('0x27')]);}})[_0x8f2d('0x28')](function(_0x37c5e9){logger[_0x8f2d('0x25')](_0x8f2d('0x21'),_0x428d92,_0x37c5e9);_0x3cc19f(_0x37c5e9);});});}function respondWithStatusCode(_0x88c050,_0x3c29f9){_0x3c29f9=_0x3c29f9||0xcc;return function(_0x3557c1){if(_0x3557c1){return _0x88c050[_0x8f2d('0x29')](_0x3c29f9);}return _0x88c050[_0x8f2d('0x2a')](_0x3c29f9)[_0x8f2d('0x2b')]();};}function respondWithResult(_0x2841e7,_0x2d944c){_0x2d944c=_0x2d944c||0xc8;return function(_0x112f4e){if(_0x112f4e){return _0x2841e7[_0x8f2d('0x2a')](_0x2d944c)[_0x8f2d('0x2c')](_0x112f4e);}};}function respondWithFilteredResult(_0x14eb94,_0x11cb4f){return function(_0x36924c){if(_0x36924c){var _0x3f6604=_0x36924c[_0x8f2d('0x2d')],_0x4804cf=_0x11cb4f[_0x8f2d('0x2e')],_0x46626e=_0x11cb4f['offset']+_0x11cb4f[_0x8f2d('0x2f')],_0x53b44e;if(_0x46626e>=_0x3f6604){_0x46626e=_0x3f6604;_0x53b44e=0xc8;}else{_0x53b44e=0xce;}_0x14eb94[_0x8f2d('0x2a')](_0x53b44e);return _0x14eb94['set'](_0x8f2d('0x30'),_0x4804cf+'-'+_0x46626e+'/'+_0x3f6604)[_0x8f2d('0x2c')](_0x36924c);}return null;};}function patchUpdates(_0xad5620){return function(_0x4d26ae){try{jsonpatch[_0x8f2d('0x31')](_0x4d26ae,_0xad5620,!![]);}catch(_0x4cb643){return BPromise[_0x8f2d('0x32')](_0x4cb643);}return _0x4d26ae[_0x8f2d('0x33')]();};}function saveUpdates(_0x168f84,_0x834468){return function(_0x5df65d){if(_0x5df65d){return _0x5df65d['update'](_0x168f84)[_0x8f2d('0x1f')](function(_0x5b87bc){return _0x5b87bc;});}return null;};}function removeEntity(_0x335b1a,_0x191c59){return function(_0x5a01c4){if(_0x5a01c4){return _0x5a01c4[_0x8f2d('0x34')]()[_0x8f2d('0x1f')](function(){_0x335b1a[_0x8f2d('0x2a')](0xcc)[_0x8f2d('0x2b')]();});}};}function handleEntityNotFound(_0x4ae276,_0x27a8cf){return function(_0x2570aa){if(!_0x2570aa){_0x4ae276[_0x8f2d('0x29')](0x194);}return _0x2570aa;};}function handleError(_0x191a6f,_0x561ee7){_0x561ee7=_0x561ee7||0x1f4;return function(_0x9fd3b){logger['error'](_0x9fd3b[_0x8f2d('0x35')]);if(_0x9fd3b[_0x8f2d('0x36')]){delete _0x9fd3b[_0x8f2d('0x36')];}_0x191a6f[_0x8f2d('0x2a')](_0x561ee7)['send'](_0x9fd3b);};}exports[_0x8f2d('0x37')]=function(_0x79efc2,_0x32ef4e){var _0x5904c0={},_0x11d29f={},_0x5d3945={'count':0x0,'rows':[]};var _0x57d0ca=_['map'](db[_0x8f2d('0x38')][_0x8f2d('0x39')],function(_0x1a68a5){return{'name':_0x1a68a5['fieldName'],'type':_0x1a68a5[_0x8f2d('0x3a')]['key']};});_0x11d29f['model']=_[_0x8f2d('0x3b')](_0x57d0ca,_0x8f2d('0x36'));_0x11d29f['query']=_[_0x8f2d('0x3c')](_0x79efc2[_0x8f2d('0x3d')]);_0x11d29f[_0x8f2d('0x3e')]=_[_0x8f2d('0x3f')](_0x11d29f[_0x8f2d('0x40')],_0x11d29f[_0x8f2d('0x3d')]);_0x5904c0[_0x8f2d('0x41')]=_[_0x8f2d('0x3f')](_0x11d29f['model'],qs[_0x8f2d('0x42')](_0x79efc2[_0x8f2d('0x3d')][_0x8f2d('0x42')]));_0x5904c0[_0x8f2d('0x41')]=_0x5904c0['attributes'][_0x8f2d('0x43')]?_0x5904c0[_0x8f2d('0x41')]:_0x11d29f[_0x8f2d('0x40')];if(!_0x79efc2[_0x8f2d('0x3d')][_0x8f2d('0x44')]('nolimit')){_0x5904c0[_0x8f2d('0x2f')]=qs[_0x8f2d('0x2f')](_0x79efc2[_0x8f2d('0x3d')][_0x8f2d('0x2f')]);_0x5904c0[_0x8f2d('0x2e')]=qs[_0x8f2d('0x2e')](_0x79efc2['query'][_0x8f2d('0x2e')]);}_0x5904c0[_0x8f2d('0x45')]=qs[_0x8f2d('0x46')](_0x79efc2['query']['sort']);_0x5904c0[_0x8f2d('0x47')]=qs[_0x8f2d('0x3e')](_[_0x8f2d('0x48')](_0x79efc2[_0x8f2d('0x3d')],_0x11d29f[_0x8f2d('0x3e')]),_0x57d0ca);if(_0x79efc2[_0x8f2d('0x3d')][_0x8f2d('0x49')]){_0x5904c0[_0x8f2d('0x47')]=_['merge'](_0x5904c0[_0x8f2d('0x47')],{'$or':_[_0x8f2d('0x3b')](_0x57d0ca,function(_0x355872){if(_0x355872['type']!==_0x8f2d('0x4a')){var _0x32f1b8={};_0x32f1b8[_0x355872[_0x8f2d('0x36')]]={'$like':'%'+_0x79efc2[_0x8f2d('0x3d')][_0x8f2d('0x49')]+'%'};return _0x32f1b8;}})});}_0x5904c0=_[_0x8f2d('0x4b')]({},_0x5904c0,_0x79efc2['options']);var _0xf9f8e6={'where':_0x5904c0[_0x8f2d('0x47')]};return db[_0x8f2d('0x38')][_0x8f2d('0x2d')](_0xf9f8e6)[_0x8f2d('0x1f')](function(_0x1fdd01){_0x5d3945['count']=_0x1fdd01;if(_0x79efc2['query'][_0x8f2d('0x4c')]){_0x5904c0[_0x8f2d('0x4d')]=[{'all':!![]}];}return db[_0x8f2d('0x38')]['findAll'](_0x5904c0);})[_0x8f2d('0x1f')](function(_0x488d94){_0x5d3945[_0x8f2d('0x4e')]=_0x488d94;return _0x5d3945;})[_0x8f2d('0x1f')](respondWithFilteredResult(_0x32ef4e,_0x5904c0))['catch'](handleError(_0x32ef4e,null));};exports[_0x8f2d('0x4f')]=function(_0x4df9dc,_0x32da28){var _0x3d1fe3={'raw':![],'where':{'id':_0x4df9dc[_0x8f2d('0x50')]['id']}},_0x17ac7d={};_0x17ac7d[_0x8f2d('0x40')]=_[_0x8f2d('0x3c')](db[_0x8f2d('0x38')][_0x8f2d('0x39')]);_0x17ac7d['query']=_[_0x8f2d('0x3c')](_0x4df9dc[_0x8f2d('0x3d')]);_0x17ac7d[_0x8f2d('0x3e')]=_[_0x8f2d('0x3f')](_0x17ac7d[_0x8f2d('0x40')],_0x17ac7d[_0x8f2d('0x3d')]);_0x3d1fe3[_0x8f2d('0x41')]=_[_0x8f2d('0x3f')](_0x17ac7d[_0x8f2d('0x40')],qs['fields'](_0x4df9dc['query'][_0x8f2d('0x42')]));_0x3d1fe3[_0x8f2d('0x41')]=_0x3d1fe3['attributes'][_0x8f2d('0x43')]?_0x3d1fe3[_0x8f2d('0x41')]:_0x17ac7d['model'];if(_0x4df9dc['query'][_0x8f2d('0x4c')]){_0x3d1fe3[_0x8f2d('0x4d')]=[{'all':!![]}];}_0x3d1fe3=_[_0x8f2d('0x4b')]({},_0x3d1fe3,_0x4df9dc[_0x8f2d('0x51')]);return db[_0x8f2d('0x38')][_0x8f2d('0x52')](_0x3d1fe3)['then'](handleEntityNotFound(_0x32da28,null))['then'](respondWithResult(_0x32da28,null))[_0x8f2d('0x28')](handleError(_0x32da28,null));};exports[_0x8f2d('0x53')]=function(_0x2114dc,_0x5ece54){return db[_0x8f2d('0x38')][_0x8f2d('0x53')](_0x2114dc[_0x8f2d('0x54')],{})['then'](respondWithResult(_0x5ece54,0xc9))[_0x8f2d('0x28')](handleError(_0x5ece54,null));};exports[_0x8f2d('0x55')]=function(_0x11e239,_0x251f18){if(_0x11e239[_0x8f2d('0x54')]['id']){delete _0x11e239[_0x8f2d('0x54')]['id'];}return db['DeskAccount']['find']({'where':{'id':_0x11e239[_0x8f2d('0x50')]['id']}})['then'](handleEntityNotFound(_0x251f18,null))[_0x8f2d('0x1f')](saveUpdates(_0x11e239[_0x8f2d('0x54')],null))[_0x8f2d('0x1f')](respondWithResult(_0x251f18,null))['catch'](handleError(_0x251f18,null));};exports['destroy']=function(_0x5a4de1,_0x177f3d){return db['DeskAccount'][_0x8f2d('0x52')]({'where':{'id':_0x5a4de1[_0x8f2d('0x50')]['id']}})[_0x8f2d('0x1f')](handleEntityNotFound(_0x177f3d,null))['then'](removeEntity(_0x177f3d,null))[_0x8f2d('0x28')](handleError(_0x177f3d,null));};exports[_0x8f2d('0x56')]=function(_0x473264,_0x2cc686,_0x505774){var _0x60a3d2={};var _0x14caab={};var _0x234b68;var _0x527fe9;return db[_0x8f2d('0x38')][_0x8f2d('0x57')]({'where':{'id':_0x473264[_0x8f2d('0x50')]['id']}})[_0x8f2d('0x1f')](handleEntityNotFound(_0x2cc686,null))['then'](function(_0x200886){if(_0x200886){_0x234b68=_0x200886;_0x14caab['model']=_[_0x8f2d('0x3c')](db['DeskConfiguration']['rawAttributes']);_0x14caab[_0x8f2d('0x3d')]=_[_0x8f2d('0x3c')](_0x473264['query']);_0x14caab[_0x8f2d('0x3e')]=_[_0x8f2d('0x3f')](_0x14caab[_0x8f2d('0x40')],_0x14caab[_0x8f2d('0x3d')]);_0x60a3d2[_0x8f2d('0x41')]=_['intersection'](_0x14caab[_0x8f2d('0x40')],qs[_0x8f2d('0x42')](_0x473264[_0x8f2d('0x3d')][_0x8f2d('0x42')]));_0x60a3d2[_0x8f2d('0x41')]=_0x60a3d2[_0x8f2d('0x41')][_0x8f2d('0x43')]?_0x60a3d2['attributes']:_0x14caab['model'];_0x60a3d2[_0x8f2d('0x45')]=qs[_0x8f2d('0x46')](_0x473264[_0x8f2d('0x3d')]['sort']);_0x60a3d2[_0x8f2d('0x47')]=qs[_0x8f2d('0x3e')](_['pick'](_0x473264[_0x8f2d('0x3d')],_0x14caab['filters']));if(_0x473264[_0x8f2d('0x3d')][_0x8f2d('0x49')]){_0x60a3d2[_0x8f2d('0x47')]=_[_0x8f2d('0x4b')](_0x60a3d2[_0x8f2d('0x47')],{'$or':_['map'](_0x60a3d2[_0x8f2d('0x41')],function(_0x43762b){var _0x4be277={};_0x4be277[_0x43762b]={'$like':'%'+_0x473264[_0x8f2d('0x3d')][_0x8f2d('0x49')]+'%'};return _0x4be277;})});}_0x60a3d2=_['merge']({},_0x60a3d2,_0x473264['options']);return _0x234b68[_0x8f2d('0x56')](_0x60a3d2);}})['then'](function(_0x408fee){if(_0x408fee){_0x527fe9=_0x408fee[_0x8f2d('0x43')];if(!_0x473264[_0x8f2d('0x3d')][_0x8f2d('0x44')](_0x8f2d('0x58'))){_0x60a3d2[_0x8f2d('0x2f')]=qs[_0x8f2d('0x2f')](_0x473264[_0x8f2d('0x3d')][_0x8f2d('0x2f')]);_0x60a3d2[_0x8f2d('0x2e')]=qs[_0x8f2d('0x2e')](_0x473264['query']['offset']);}return _0x234b68[_0x8f2d('0x56')](_0x60a3d2);}})[_0x8f2d('0x1f')](function(_0x3cf468){if(_0x3cf468){return _0x3cf468?{'count':_0x527fe9,'rows':_0x3cf468}:null;}})[_0x8f2d('0x1f')](respondWithResult(_0x2cc686,null))[_0x8f2d('0x28')](handleError(_0x2cc686,null));};exports[_0x8f2d('0x59')]=function(_0x44909b,_0x3146f4,_0x89a00c){if(_0x44909b['body']['id']){delete _0x44909b['body']['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x44909b[_0x8f2d('0x50')]['id']}})[_0x8f2d('0x1f')](handleEntityNotFound(_0x3146f4,null))['then'](function(_0x566006){if(_0x566006){_0x44909b['body'][_0x8f2d('0x5a')]=_0x566006['id'];_0x44909b[_0x8f2d('0x54')][_0x8f2d('0x5b')]=integrations[_0x8f2d('0x5c')](_0x44909b[_0x8f2d('0x54')][_0x8f2d('0x5d')],_0x44909b['body']['type']);_0x44909b[_0x8f2d('0x54')]['Descriptions']=integrations[_0x8f2d('0x5e')](_0x44909b[_0x8f2d('0x54')][_0x8f2d('0x5d')],_0x44909b['body']['type']);return db[_0x8f2d('0x5f')]['create'](_0x44909b[_0x8f2d('0x54')],{'include':[{'model':db[_0x8f2d('0x60')],'as':_0x8f2d('0x5b')},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0x8f2d('0x1f')](respondWithResult(_0x3146f4,null))[_0x8f2d('0x28')](handleError(_0x3146f4,null));};exports[_0x8f2d('0x61')]=function(_0x2a16ec,_0x2ade9d,_0x45a162){var _0x4b4850=[{'name':_0x8f2d('0x62'),'label':_0x8f2d('0x62'),'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 _0x5b98d0='';return db['DeskAccount']['findOne']({'where':{'id':_0x2a16ec[_0x8f2d('0x50')]['id']},'attributes':['id',_0x8f2d('0x63'),_0x8f2d('0x64'),'username','password',_0x8f2d('0x65'),_0x8f2d('0x66'),_0x8f2d('0x67'),'tokenSecret']})[_0x8f2d('0x1f')](handleEntityNotFound(_0x2ade9d,null))['then'](function(_0x1821a7){if(_0x1821a7){_0x5b98d0=_0x1821a7['remoteUri'];var _0x4810f3=_0x5b98d0[_0x8f2d('0x68')](-0x1);if(_0x4810f3==='/'){_0x5b98d0=_0x5b98d0['substring'](0x0,_0x5b98d0[_0x8f2d('0x69')](_0x4810f3));}var _0x2d2935={'method':_0x8f2d('0x6a'),'uri':util[_0x8f2d('0x6b')](_0x8f2d('0x6c'),_0x5b98d0),'headers':{'Content-Type':'application/json','Accept':_0x8f2d('0x6d')},'json':!![]};if(_0x1821a7[_0x8f2d('0x64')]===_0x8f2d('0x6e')){_0x2d2935[_0x8f2d('0x6f')]['Authorization']=util[_0x8f2d('0x6b')](_0x8f2d('0x70'),new Buffer(util[_0x8f2d('0x6b')]('%s:%s',_0x1821a7[_0x8f2d('0x71')],_0x1821a7[_0x8f2d('0x72')]))[_0x8f2d('0x73')](_0x8f2d('0x74')));}return rp(_0x2d2935)[_0x8f2d('0x1f')](function(_0x264428){return _0x4b4850['concat'](_[_0x8f2d('0x3b')](_0x264428[_0x8f2d('0x75')]['entries'],function(_0x5bf95c){return{'id':_0x5bf95c[_0x8f2d('0x36')],'name':_0x5bf95c[_0x8f2d('0x36')],'type':_0x5bf95c['type'],'active':_0x5bf95c[_0x8f2d('0x76')],'label':_0x5bf95c[_0x8f2d('0x77')],'custom':!![]};}));});}})[_0x8f2d('0x1f')](function(_0x2b5706){return{'count':_0x2b5706[_0x8f2d('0x43')],'rows':_0x2b5706};})[_0x8f2d('0x1f')](respondWithResult(_0x2ade9d,null))[_0x8f2d('0x28')](function(_0x4b954d){var _0x509875=_0x2a16ec[_0x8f2d('0x3d')][_0x8f2d('0x78')]?0x1f4:_0x4b954d[_0x8f2d('0x79')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x8f2d('0x61'),_0x509875,JSON['stringify'](_0x4b954d));delete _0x4b954d[_0x8f2d('0x36')];if(_0x509875===0x191){_0x509875=0x190;}_0x2ade9d['status'](_0x509875)[_0x8f2d('0x7a')](_0x2a16ec['query']['test']?{'message':_0x8f2d('0x7b'),'statusCode':_0x4b954d[_0x8f2d('0x79')]}:_0x4b954d);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 42e99b1..af9f7a4 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 _0xbf97=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util'];(function(_0x1f7eb4,_0x4cc438){var _0x4b9956=function(_0x2acc3b){while(--_0x2acc3b){_0x1f7eb4['push'](_0x1f7eb4['shift']());}};_0x4b9956(++_0x4cc438);}(_0xbf97,0x94));var _0x7bf9=function(_0x4ad21f,_0x892913){_0x4ad21f=_0x4ad21f-0x0;var _0x3adbc6=_0xbf97[_0x4ad21f];return _0x3adbc6;};'use strict';var _=require(_0x7bf9('0x0'));var util=require(_0x7bf9('0x1'));var logger=require(_0x7bf9('0x2'))('api');var moment=require(_0x7bf9('0x3'));var BPromise=require(_0x7bf9('0x4'));var rp=require(_0x7bf9('0x5'));var fs=require('fs');var path=require(_0x7bf9('0x6'));var rimraf=require(_0x7bf9('0x7'));var config=require(_0x7bf9('0x8'));var attributes=require(_0x7bf9('0x9'));var integrations=require(_0x7bf9('0xa'));module[_0x7bf9('0xb')]=function(_0x51ed5d,_0x179a0a){return _0x51ed5d[_0x7bf9('0xc')](_0x7bf9('0xd'),attributes,{'tableName':_0x7bf9('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd51=['int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intDeskAccount.attributes','exports','define','DeskAccount'];(function(_0x179775,_0x403b57){var _0x17ee82=function(_0xea75ea){while(--_0xea75ea){_0x179775['push'](_0x179775['shift']());}};_0x17ee82(++_0x403b57);}(_0xcd51,0xd1));var _0x1cd5=function(_0x7a39d4,_0x1946b9){_0x7a39d4=_0x7a39d4-0x0;var _0xa45577=_0xcd51[_0x7a39d4];return _0xa45577;};'use strict';var _=require(_0x1cd5('0x0'));var util=require(_0x1cd5('0x1'));var logger=require(_0x1cd5('0x2'))(_0x1cd5('0x3'));var moment=require(_0x1cd5('0x4'));var BPromise=require(_0x1cd5('0x5'));var rp=require(_0x1cd5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1cd5('0x7'));var config=require('../../config/environment');var attributes=require(_0x1cd5('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x1cd5('0x9')]=function(_0xe23d85,_0x28dd7d){return _0xe23d85[_0x1cd5('0xa')](_0x1cd5('0xb'),attributes,{'tableName':_0x1cd5('0xc'),'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 df384eb..652a0e8 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 _0xbf0b=['catch','GetDeskAccount','findAll','options','raw','attributes','include','model','map','ShowDeskAccount','DeskAccount','find','where','info','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result'];(function(_0x5d2acc,_0x277057){var _0xa615b0=function(_0x4d51fc){while(--_0x4d51fc){_0x5d2acc['push'](_0x5d2acc['shift']());}};_0xa615b0(++_0x277057);}(_0xbf0b,0x1b3));var _0xbbf0=function(_0x5a28ed,_0x2bcf10){_0x5a28ed=_0x5a28ed-0x0;var _0x4d4f6a=_0xbf0b[_0x5a28ed];return _0x4d4f6a;};'use strict';var _=require(_0xbbf0('0x0'));var util=require(_0xbbf0('0x1'));var moment=require(_0xbbf0('0x2'));var BPromise=require(_0xbbf0('0x3'));var rs=require(_0xbbf0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbbf0('0x5'))['db'];var utils=require(_0xbbf0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xbbf0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbbf0('0x8')][_0xbbf0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52d9b3,_0x2cc30d,_0x3b2545){return new BPromise(function(_0x57388f,_0x2a0065){return client[_0xbbf0('0xa')](_0x52d9b3,_0x3b2545)[_0xbbf0('0xb')](function(_0x1a4c1d){logger['info'](_0xbbf0('0xc'),_0x2cc30d,_0xbbf0('0xd'));logger['debug'](_0xbbf0('0xe'),_0x2cc30d,_0xbbf0('0xd'),JSON[_0xbbf0('0xf')](_0x1a4c1d));if(_0x1a4c1d['error']){if(_0x1a4c1d['error'][_0xbbf0('0x10')]===0x1f4){logger['error'](_0xbbf0('0xc'),_0x2cc30d,_0x1a4c1d[_0xbbf0('0x11')][_0xbbf0('0x12')]);return _0x2a0065(_0x1a4c1d[_0xbbf0('0x11')]['message']);}logger['error'](_0xbbf0('0xc'),_0x2cc30d,_0x1a4c1d[_0xbbf0('0x11')][_0xbbf0('0x12')]);return _0x57388f(_0x1a4c1d['error']['message']);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x2cc30d,'request\x20sent');_0x57388f(_0x1a4c1d[_0xbbf0('0x13')]['message']);}})[_0xbbf0('0x14')](function(_0x272045){logger[_0xbbf0('0x11')](_0xbbf0('0xc'),_0x2cc30d,_0x272045);_0x2a0065(_0x272045);});});}exports[_0xbbf0('0x15')]=function(_0x5763fb){var _0x34d699=this;return new Promise(function(_0x2c16ae,_0x482ab7){return db['DeskAccount'][_0xbbf0('0x16')]({'raw':_0x5763fb[_0xbbf0('0x17')]?_0x5763fb[_0xbbf0('0x17')][_0xbbf0('0x18')]===undefined?!![]:![]:!![],'where':_0x5763fb[_0xbbf0('0x17')]?_0x5763fb['options']['where']||null:null,'attributes':_0x5763fb[_0xbbf0('0x17')]?_0x5763fb[_0xbbf0('0x17')][_0xbbf0('0x19')]||null:null,'limit':_0x5763fb['options']?_0x5763fb[_0xbbf0('0x17')]['limit']||null:null,'include':_0x5763fb[_0xbbf0('0x17')]?_0x5763fb[_0xbbf0('0x17')]['include']?_['map'](_0x5763fb['options'][_0xbbf0('0x1a')],function(_0x2f0bde){return{'model':db[_0x2f0bde[_0xbbf0('0x1b')]],'as':_0x2f0bde['as'],'attributes':_0x2f0bde['attributes'],'include':_0x2f0bde[_0xbbf0('0x1a')]?_[_0xbbf0('0x1c')](_0x2f0bde[_0xbbf0('0x1a')],function(_0x4f2ce8){return{'model':db[_0x4f2ce8[_0xbbf0('0x1b')]],'as':_0x4f2ce8['as'],'attributes':_0x4f2ce8['attributes'],'include':_0x4f2ce8[_0xbbf0('0x1a')]?_[_0xbbf0('0x1c')](_0x4f2ce8[_0xbbf0('0x1a')],function(_0x228841){return{'model':db[_0x228841[_0xbbf0('0x1b')]],'as':_0x228841['as'],'attributes':_0x228841[_0xbbf0('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbbf0('0xb')](function(_0x55bd4f){logger['info'](_0xbbf0('0x15'),_0x5763fb);logger['debug'](_0xbbf0('0x15'),_0x5763fb,JSON['stringify'](_0x55bd4f));_0x2c16ae(_0x55bd4f);})[_0xbbf0('0x14')](function(_0x3151b1){logger[_0xbbf0('0x11')](_0xbbf0('0x15'),_0x3151b1['message'],_0x5763fb);_0x482ab7(_0x34d699[_0xbbf0('0x11')](0x1f4,_0x3151b1[_0xbbf0('0x12')]));});});};exports[_0xbbf0('0x1d')]=function(_0x2c1219){var _0x134b4a=this;return new Promise(function(_0xffedaa,_0x22ed13){return db[_0xbbf0('0x1e')][_0xbbf0('0x1f')]({'raw':_0x2c1219[_0xbbf0('0x17')]?_0x2c1219[_0xbbf0('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2c1219[_0xbbf0('0x17')]?_0x2c1219[_0xbbf0('0x17')][_0xbbf0('0x20')]||null:null,'attributes':_0x2c1219['options']?_0x2c1219[_0xbbf0('0x17')][_0xbbf0('0x19')]||null:null,'include':_0x2c1219[_0xbbf0('0x17')]?_0x2c1219[_0xbbf0('0x17')]['include']?_[_0xbbf0('0x1c')](_0x2c1219[_0xbbf0('0x17')][_0xbbf0('0x1a')],function(_0x3a36d7){return{'model':db[_0x3a36d7[_0xbbf0('0x1b')]],'as':_0x3a36d7['as'],'attributes':_0x3a36d7['attributes'],'include':_0x3a36d7[_0xbbf0('0x1a')]?_[_0xbbf0('0x1c')](_0x3a36d7['include'],function(_0x5cc31e){return{'model':db[_0x5cc31e[_0xbbf0('0x1b')]],'as':_0x5cc31e['as'],'attributes':_0x5cc31e[_0xbbf0('0x19')],'include':_0x5cc31e[_0xbbf0('0x1a')]?_[_0xbbf0('0x1c')](_0x5cc31e[_0xbbf0('0x1a')],function(_0x5dfde6){return{'model':db[_0x5dfde6[_0xbbf0('0x1b')]],'as':_0x5dfde6['as'],'attributes':_0x5dfde6[_0xbbf0('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbbf0('0xb')](function(_0x3f799e){logger[_0xbbf0('0x21')]('ShowDeskAccount',_0x2c1219);logger[_0xbbf0('0x22')](_0xbbf0('0x1d'),_0x2c1219,JSON[_0xbbf0('0xf')](_0x3f799e));_0xffedaa(_0x3f799e);})[_0xbbf0('0x14')](function(_0x49b2b6){logger[_0xbbf0('0x11')]('ShowDeskAccount',_0x49b2b6['message'],_0x2c1219);_0x22ed13(_0x134b4a[_0xbbf0('0x11')](0x1f4,_0x49b2b6[_0xbbf0('0x12')]));});});}; \ No newline at end of file +var _0xf539=['catch','GetDeskAccount','DeskAccount','options','raw','where','attributes','limit','include','map','model','find','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result'];(function(_0x48d29f,_0x44b6c9){var _0x47f143=function(_0x50162c){while(--_0x50162c){_0x48d29f['push'](_0x48d29f['shift']());}};_0x47f143(++_0x44b6c9);}(_0xf539,0x135));var _0x9f53=function(_0x1f2933,_0xdeb1da){_0x1f2933=_0x1f2933-0x0;var _0x1050fd=_0xf539[_0x1f2933];return _0x1050fd;};'use strict';var _=require(_0x9f53('0x0'));var util=require(_0x9f53('0x1'));var moment=require(_0x9f53('0x2'));var BPromise=require(_0x9f53('0x3'));var rs=require(_0x9f53('0x4'));var fs=require('fs');var Redis=require(_0x9f53('0x5'));var db=require(_0x9f53('0x6'))['db'];var utils=require(_0x9f53('0x7'));var logger=require('../../config/logger')(_0x9f53('0x8'));var config=require(_0x9f53('0x9'));var jayson=require(_0x9f53('0xa'));var client=jayson[_0x9f53('0xb')][_0x9f53('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ef8f5,_0x3c64d4,_0x573a41){return new BPromise(function(_0x1f7fdd,_0xb84504){return client['request'](_0x2ef8f5,_0x573a41)[_0x9f53('0xd')](function(_0x5193bc){logger[_0x9f53('0xe')]('DeskAccount,\x20%s,\x20%s',_0x3c64d4,_0x9f53('0xf'));logger[_0x9f53('0x10')](_0x9f53('0x11'),_0x3c64d4,_0x9f53('0xf'),JSON[_0x9f53('0x12')](_0x5193bc));if(_0x5193bc[_0x9f53('0x13')]){if(_0x5193bc[_0x9f53('0x13')][_0x9f53('0x14')]===0x1f4){logger[_0x9f53('0x13')](_0x9f53('0x15'),_0x3c64d4,_0x5193bc[_0x9f53('0x13')][_0x9f53('0x16')]);return _0xb84504(_0x5193bc[_0x9f53('0x13')][_0x9f53('0x16')]);}logger[_0x9f53('0x13')]('DeskAccount,\x20%s,\x20%s',_0x3c64d4,_0x5193bc['error']['message']);return _0x1f7fdd(_0x5193bc[_0x9f53('0x13')][_0x9f53('0x16')]);}else{logger[_0x9f53('0xe')]('DeskAccount,\x20%s,\x20%s',_0x3c64d4,_0x9f53('0xf'));_0x1f7fdd(_0x5193bc[_0x9f53('0x17')][_0x9f53('0x16')]);}})[_0x9f53('0x18')](function(_0x408d31){logger['error'](_0x9f53('0x15'),_0x3c64d4,_0x408d31);_0xb84504(_0x408d31);});});}exports[_0x9f53('0x19')]=function(_0x53a8e9){var _0x377157=this;return new Promise(function(_0x52c109,_0x24283c){return db[_0x9f53('0x1a')]['findAll']({'raw':_0x53a8e9[_0x9f53('0x1b')]?_0x53a8e9[_0x9f53('0x1b')][_0x9f53('0x1c')]===undefined?!![]:![]:!![],'where':_0x53a8e9[_0x9f53('0x1b')]?_0x53a8e9[_0x9f53('0x1b')][_0x9f53('0x1d')]||null:null,'attributes':_0x53a8e9['options']?_0x53a8e9[_0x9f53('0x1b')][_0x9f53('0x1e')]||null:null,'limit':_0x53a8e9['options']?_0x53a8e9['options'][_0x9f53('0x1f')]||null:null,'include':_0x53a8e9[_0x9f53('0x1b')]?_0x53a8e9[_0x9f53('0x1b')][_0x9f53('0x20')]?_[_0x9f53('0x21')](_0x53a8e9[_0x9f53('0x1b')][_0x9f53('0x20')],function(_0x49814d){return{'model':db[_0x49814d['model']],'as':_0x49814d['as'],'attributes':_0x49814d[_0x9f53('0x1e')],'include':_0x49814d[_0x9f53('0x20')]?_[_0x9f53('0x21')](_0x49814d[_0x9f53('0x20')],function(_0x3f46ed){return{'model':db[_0x3f46ed[_0x9f53('0x22')]],'as':_0x3f46ed['as'],'attributes':_0x3f46ed[_0x9f53('0x1e')],'include':_0x3f46ed[_0x9f53('0x20')]?_[_0x9f53('0x21')](_0x3f46ed[_0x9f53('0x20')],function(_0x3318ec){return{'model':db[_0x3318ec['model']],'as':_0x3318ec['as'],'attributes':_0x3318ec[_0x9f53('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9f53('0xd')](function(_0x3a5a1d){logger[_0x9f53('0xe')](_0x9f53('0x19'),_0x53a8e9);logger[_0x9f53('0x10')]('GetDeskAccount',_0x53a8e9,JSON[_0x9f53('0x12')](_0x3a5a1d));_0x52c109(_0x3a5a1d);})['catch'](function(_0x113f4b){logger[_0x9f53('0x13')](_0x9f53('0x19'),_0x113f4b[_0x9f53('0x16')],_0x53a8e9);_0x24283c(_0x377157[_0x9f53('0x13')](0x1f4,_0x113f4b[_0x9f53('0x16')]));});});};exports['ShowDeskAccount']=function(_0x31553d){var _0x232b16=this;return new Promise(function(_0x3ca255,_0x57c201){return db[_0x9f53('0x1a')][_0x9f53('0x23')]({'raw':_0x31553d[_0x9f53('0x1b')]?_0x31553d[_0x9f53('0x1b')][_0x9f53('0x1c')]===undefined?!![]:![]:!![],'where':_0x31553d[_0x9f53('0x1b')]?_0x31553d[_0x9f53('0x1b')][_0x9f53('0x1d')]||null:null,'attributes':_0x31553d[_0x9f53('0x1b')]?_0x31553d[_0x9f53('0x1b')]['attributes']||null:null,'include':_0x31553d[_0x9f53('0x1b')]?_0x31553d[_0x9f53('0x1b')][_0x9f53('0x20')]?_[_0x9f53('0x21')](_0x31553d[_0x9f53('0x1b')][_0x9f53('0x20')],function(_0x4b1ef6){return{'model':db[_0x4b1ef6[_0x9f53('0x22')]],'as':_0x4b1ef6['as'],'attributes':_0x4b1ef6[_0x9f53('0x1e')],'include':_0x4b1ef6[_0x9f53('0x20')]?_['map'](_0x4b1ef6[_0x9f53('0x20')],function(_0x19c0f0){return{'model':db[_0x19c0f0[_0x9f53('0x22')]],'as':_0x19c0f0['as'],'attributes':_0x19c0f0[_0x9f53('0x1e')],'include':_0x19c0f0[_0x9f53('0x20')]?_[_0x9f53('0x21')](_0x19c0f0[_0x9f53('0x20')],function(_0x4fe54d){return{'model':db[_0x4fe54d['model']],'as':_0x4fe54d['as'],'attributes':_0x4fe54d[_0x9f53('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9f53('0xd')](function(_0x23fd34){logger[_0x9f53('0xe')]('ShowDeskAccount',_0x31553d);logger[_0x9f53('0x10')]('ShowDeskAccount',_0x31553d,JSON[_0x9f53('0x12')](_0x23fd34));_0x3ca255(_0x23fd34);})['catch'](function(_0x2e53b2){logger[_0x9f53('0x13')](_0x9f53('0x24'),_0x2e53b2[_0x9f53('0x16')],_0x31553d);_0x57c201(_0x232b16[_0x9f53('0x13')](0x1f4,_0x2e53b2[_0x9f53('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 2983b8f..7648cf0 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 _0xf963=['getDescriptions','/:id/tags','getTags','post','create','setTags','update','destroy','exports','multer','connect-timeout','express','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getSubjects','/:id/descriptions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf963,0x11d));var _0x3f96=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xf963[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require(_0x3f96('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3f96('0x1'));var express=require(_0x3f96('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3f96('0x3'));var config=require(_0x3f96('0x4'));var controller=require(_0x3f96('0x5'));router[_0x3f96('0x6')]('/',auth['isAuthenticated'](),controller[_0x3f96('0x7')]);router['get'](_0x3f96('0x8'),auth[_0x3f96('0x9')](),controller[_0x3f96('0xa')]);router['get'](_0x3f96('0xb'),auth[_0x3f96('0x9')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x3f96('0xc')]);router[_0x3f96('0x6')](_0x3f96('0xd'),auth[_0x3f96('0x9')](),controller[_0x3f96('0xe')]);router['get'](_0x3f96('0xf'),auth[_0x3f96('0x9')](),controller[_0x3f96('0x10')]);router[_0x3f96('0x11')]('/',auth['isAuthenticated'](),controller[_0x3f96('0x12')]);router['post'](_0x3f96('0xf'),auth[_0x3f96('0x9')](),controller[_0x3f96('0x13')]);router['put'](_0x3f96('0x8'),auth['isAuthenticated'](),controller[_0x3f96('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3f96('0x15')]);module[_0x3f96('0x16')]=router; \ No newline at end of file +var _0x66c7=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','destroy','exports','multer','util'];(function(_0x5d6806,_0x36efa6){var _0x4c4dd0=function(_0x5c38f6){while(--_0x5c38f6){_0x5d6806['push'](_0x5d6806['shift']());}};_0x4c4dd0(++_0x36efa6);}(_0x66c7,0x15c));var _0x766c=function(_0x4767fb,_0x3842f7){_0x4767fb=_0x4767fb-0x0;var _0x3f9248=_0x66c7[_0x4767fb];return _0x3f9248;};'use strict';var multer=require(_0x766c('0x0'));var util=require(_0x766c('0x1'));var path=require(_0x766c('0x2'));var timeout=require('connect-timeout');var express=require(_0x766c('0x3'));var router=express[_0x766c('0x4')]();var auth=require(_0x766c('0x5'));var interaction=require(_0x766c('0x6'));var config=require(_0x766c('0x7'));var controller=require(_0x766c('0x8'));router['get']('/',auth[_0x766c('0x9')](),controller[_0x766c('0xa')]);router[_0x766c('0xb')](_0x766c('0xc'),auth[_0x766c('0x9')](),controller[_0x766c('0xd')]);router[_0x766c('0xb')](_0x766c('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0x766c('0xb')](_0x766c('0xf'),auth[_0x766c('0x9')](),controller['getSubjects']);router[_0x766c('0xb')]('/:id/descriptions',auth[_0x766c('0x9')](),controller[_0x766c('0x10')]);router[_0x766c('0xb')](_0x766c('0x11'),auth[_0x766c('0x9')](),controller[_0x766c('0x12')]);router[_0x766c('0x13')]('/',auth[_0x766c('0x9')](),controller[_0x766c('0x14')]);router[_0x766c('0x13')](_0x766c('0x11'),auth[_0x766c('0x9')](),controller[_0x766c('0x15')]);router[_0x766c('0x16')](_0x766c('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x766c('0xc'),auth[_0x766c('0x9')](),controller[_0x766c('0x17')]);module[_0x766c('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 5dee1ed..3a20744 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 _0x659e=['exports','STRING','sequelize'];(function(_0x14f5fc,_0xa3b5f4){var _0x1cfb68=function(_0x3d13d5){while(--_0x3d13d5){_0x14f5fc['push'](_0x14f5fc['shift']());}};_0x1cfb68(++_0xa3b5f4);}(_0x659e,0x107));var _0xe659=function(_0x153a75,_0x2fb605){_0x153a75=_0x153a75-0x0;var _0x5d2f39=_0x659e[_0x153a75];return _0x5d2f39;};'use strict';var Sequelize=require(_0xe659('0x0'));module[_0xe659('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe659('0x2')]}}; \ No newline at end of file +var _0xf558=['exports','STRING'];(function(_0x256e15,_0x5b1d95){var _0x3ad2d2=function(_0x408c1e){while(--_0x408c1e){_0x256e15['push'](_0x256e15['shift']());}};_0x3ad2d2(++_0x5b1d95);}(_0xf558,0x170));var _0x8f55=function(_0x483f0,_0x329df8){_0x483f0=_0x483f0-0x0;var _0x59a8eb=_0xf558[_0x483f0];return _0x59a8eb;};'use strict';var Sequelize=require('sequelize');module[_0x8f55('0x0')]={'name':{'type':Sequelize[_0x8f55('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 8dce623..da5e805 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 _0xbf9b=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','send','index','map','rawAttributes','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','DeskConfiguration','include','findAll','rows','show','params','includeAll','find','create','update','body','findOne','DeskField','length','getFields','getSubjects','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch'];(function(_0x24db86,_0x4dbd8c){var _0x1f5377=function(_0xc019d7){while(--_0xc019d7){_0x24db86['push'](_0x24db86['shift']());}};_0x1f5377(++_0x4dbd8c);}(_0xbf9b,0x174));var _0xbbf9=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xbf9b[_0x1caf6a];return _0x1bf493;};'use strict';var pdf=require(_0xbbf9('0x0'));var emlformat=require(_0xbbf9('0x1'));var rimraf=require(_0xbbf9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbf9('0x3'));var rp=require(_0xbbf9('0x4'));var moment=require(_0xbbf9('0x5'));var BPromise=require(_0xbbf9('0x6'));var Mustache=require(_0xbbf9('0x7'));var util=require(_0xbbf9('0x8'));var path=require(_0xbbf9('0x9'));var sox=require(_0xbbf9('0xa'));var csv=require(_0xbbf9('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xbbf9('0xc'));var crypto=require(_0xbbf9('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbbf9('0xb'));var querystring=require(_0xbbf9('0xe'));var Papa=require('papaparse');var Redis=require(_0xbbf9('0xf'));var authService=require(_0xbbf9('0x10'));var qs=require(_0xbbf9('0x11'));var as=require(_0xbbf9('0x12'));var hardwareService=require(_0xbbf9('0x13'));var logger=require(_0xbbf9('0x14'))(_0xbbf9('0x15'));var utils=require(_0xbbf9('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbbf9('0x17'))['db'];var jayson=require(_0xbbf9('0x18'));var client=jayson[_0xbbf9('0x19')][_0xbbf9('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x28bd10,_0x4eceba,_0x1de0d0,_0x8df27e){return new BPromise(function(_0x31f286,_0x4ba719){var _0x95df99=_0x8df27e||client;return _0x95df99['request'](_0x28bd10,_0x1de0d0)[_0xbbf9('0x1b')](function(_0x2dc790){logger['info'](_0xbbf9('0x1c'),_0x4eceba,_0xbbf9('0x1d'));logger['debug'](_0xbbf9('0x1e'),_0x4eceba,_0xbbf9('0x1d'),JSON[_0xbbf9('0x1f')](_0x2dc790));if(_0x2dc790[_0xbbf9('0x20')]){if(_0x2dc790[_0xbbf9('0x20')][_0xbbf9('0x21')]===0x1f4){logger['error'](_0xbbf9('0x1c'),_0x4eceba,_0x2dc790[_0xbbf9('0x20')]['message']);return _0x4ba719(_0x2dc790[_0xbbf9('0x20')][_0xbbf9('0x22')]);}logger[_0xbbf9('0x20')](_0xbbf9('0x1c'),_0x4eceba,_0x2dc790[_0xbbf9('0x20')]['message']);return _0x31f286(_0x2dc790[_0xbbf9('0x20')][_0xbbf9('0x22')]);}else{logger['info'](_0xbbf9('0x1c'),_0x4eceba,'request\x20sent');_0x31f286(_0x2dc790[_0xbbf9('0x23')][_0xbbf9('0x22')]);}})[_0xbbf9('0x24')](function(_0x412ed5){logger[_0xbbf9('0x20')](_0xbbf9('0x1c'),_0x4eceba,_0x412ed5);_0x4ba719(_0x412ed5);});});}function respondWithStatusCode(_0x241090,_0x399084){_0x399084=_0x399084||0xcc;return function(_0x48ee97){if(_0x48ee97){return _0x241090['sendStatus'](_0x399084);}return _0x241090['status'](_0x399084)[_0xbbf9('0x25')]();};}function respondWithResult(_0x98bb0b,_0x1b3220){_0x1b3220=_0x1b3220||0xc8;return function(_0x506a2f){if(_0x506a2f){return _0x98bb0b['status'](_0x1b3220)[_0xbbf9('0x26')](_0x506a2f);}};}function respondWithFilteredResult(_0x250de2,_0x1c8cc8){return function(_0x3625f5){if(_0x3625f5){var _0x357e91=_0x3625f5[_0xbbf9('0x27')],_0x424065=_0x1c8cc8[_0xbbf9('0x28')],_0x71c07d=_0x1c8cc8[_0xbbf9('0x28')]+_0x1c8cc8[_0xbbf9('0x29')],_0x31e7d0;if(_0x71c07d>=_0x357e91){_0x71c07d=_0x357e91;_0x31e7d0=0xc8;}else{_0x31e7d0=0xce;}_0x250de2[_0xbbf9('0x2a')](_0x31e7d0);return _0x250de2[_0xbbf9('0x2b')](_0xbbf9('0x2c'),_0x424065+'-'+_0x71c07d+'/'+_0x357e91)[_0xbbf9('0x26')](_0x3625f5);}return null;};}function patchUpdates(_0x5349e3){return function(_0x51aa6a){try{jsonpatch[_0xbbf9('0x2d')](_0x51aa6a,_0x5349e3,!![]);}catch(_0x21c896){return BPromise[_0xbbf9('0x2e')](_0x21c896);}return _0x51aa6a[_0xbbf9('0x2f')]();};}function saveUpdates(_0x472232,_0x3006d0){return function(_0x588b7d){if(_0x588b7d){return _0x588b7d['update'](_0x472232)[_0xbbf9('0x1b')](function(_0x4bd699){return _0x4bd699;});}return null;};}function removeEntity(_0x5aac35,_0x1ce31a){return function(_0x3397d7){if(_0x3397d7){return _0x3397d7[_0xbbf9('0x30')]()[_0xbbf9('0x1b')](function(){_0x5aac35['status'](0xcc)[_0xbbf9('0x25')]();});}};}function handleEntityNotFound(_0x3f306e,_0x5b1705){return function(_0x1db3ec){if(!_0x1db3ec){_0x3f306e[_0xbbf9('0x31')](0x194);}return _0x1db3ec;};}function handleError(_0xe377a8,_0x5f4137){_0x5f4137=_0x5f4137||0x1f4;return function(_0x7b86ae){logger['error'](_0x7b86ae[_0xbbf9('0x32')]);if(_0x7b86ae[_0xbbf9('0x33')]){delete _0x7b86ae[_0xbbf9('0x33')];}_0xe377a8['status'](_0x5f4137)[_0xbbf9('0x34')](_0x7b86ae);};}exports[_0xbbf9('0x35')]=function(_0x4a982f,_0x5d3fa2){var _0x39dcfc={},_0x2d8e56={},_0x78b61b={'count':0x0,'rows':[]};var _0x129979=_[_0xbbf9('0x36')](db['DeskConfiguration'][_0xbbf9('0x37')],function(_0x3ba1c0){return{'name':_0x3ba1c0['fieldName'],'type':_0x3ba1c0['type']['key']};});_0x2d8e56['model']=_[_0xbbf9('0x36')](_0x129979,_0xbbf9('0x33'));_0x2d8e56[_0xbbf9('0x38')]=_[_0xbbf9('0x39')](_0x4a982f[_0xbbf9('0x38')]);_0x2d8e56['filters']=_[_0xbbf9('0x3a')](_0x2d8e56[_0xbbf9('0x3b')],_0x2d8e56[_0xbbf9('0x38')]);_0x39dcfc[_0xbbf9('0x3c')]=_['intersection'](_0x2d8e56[_0xbbf9('0x3b')],qs[_0xbbf9('0x3d')](_0x4a982f['query'][_0xbbf9('0x3d')]));_0x39dcfc[_0xbbf9('0x3c')]=_0x39dcfc[_0xbbf9('0x3c')]['length']?_0x39dcfc[_0xbbf9('0x3c')]:_0x2d8e56[_0xbbf9('0x3b')];if(!_0x4a982f['query'][_0xbbf9('0x3e')](_0xbbf9('0x3f'))){_0x39dcfc['limit']=qs['limit'](_0x4a982f[_0xbbf9('0x38')][_0xbbf9('0x29')]);_0x39dcfc[_0xbbf9('0x28')]=qs[_0xbbf9('0x28')](_0x4a982f[_0xbbf9('0x38')]['offset']);}_0x39dcfc[_0xbbf9('0x40')]=qs[_0xbbf9('0x41')](_0x4a982f['query'][_0xbbf9('0x41')]);_0x39dcfc[_0xbbf9('0x42')]=qs[_0xbbf9('0x43')](_[_0xbbf9('0x44')](_0x4a982f['query'],_0x2d8e56[_0xbbf9('0x43')]),_0x129979);if(_0x4a982f[_0xbbf9('0x38')][_0xbbf9('0x45')]){_0x39dcfc[_0xbbf9('0x42')]=_[_0xbbf9('0x46')](_0x39dcfc[_0xbbf9('0x42')],{'$or':_[_0xbbf9('0x36')](_0x129979,function(_0x5e60c0){if(_0x5e60c0[_0xbbf9('0x47')]!=='VIRTUAL'){var _0x156671={};_0x156671[_0x5e60c0[_0xbbf9('0x33')]]={'$like':'%'+_0x4a982f['query'][_0xbbf9('0x45')]+'%'};return _0x156671;}})});}_0x39dcfc=_[_0xbbf9('0x46')]({},_0x39dcfc,_0x4a982f[_0xbbf9('0x48')]);var _0xc99b87={'where':_0x39dcfc[_0xbbf9('0x42')]};return db[_0xbbf9('0x49')][_0xbbf9('0x27')](_0xc99b87)['then'](function(_0x2734af){_0x78b61b['count']=_0x2734af;if(_0x4a982f[_0xbbf9('0x38')]['includeAll']){_0x39dcfc[_0xbbf9('0x4a')]=[{'all':!![]}];}return db[_0xbbf9('0x49')][_0xbbf9('0x4b')](_0x39dcfc);})[_0xbbf9('0x1b')](function(_0x284123){_0x78b61b[_0xbbf9('0x4c')]=_0x284123;return _0x78b61b;})['then'](respondWithFilteredResult(_0x5d3fa2,_0x39dcfc))[_0xbbf9('0x24')](handleError(_0x5d3fa2,null));};exports[_0xbbf9('0x4d')]=function(_0x3bc812,_0x121fe1){var _0x14ba0e={'raw':![],'where':{'id':_0x3bc812[_0xbbf9('0x4e')]['id']}},_0x26ebb5={};_0x26ebb5[_0xbbf9('0x3b')]=_[_0xbbf9('0x39')](db[_0xbbf9('0x49')][_0xbbf9('0x37')]);_0x26ebb5[_0xbbf9('0x38')]=_['keys'](_0x3bc812[_0xbbf9('0x38')]);_0x26ebb5['filters']=_[_0xbbf9('0x3a')](_0x26ebb5[_0xbbf9('0x3b')],_0x26ebb5[_0xbbf9('0x38')]);_0x14ba0e[_0xbbf9('0x3c')]=_[_0xbbf9('0x3a')](_0x26ebb5[_0xbbf9('0x3b')],qs[_0xbbf9('0x3d')](_0x3bc812[_0xbbf9('0x38')]['fields']));_0x14ba0e[_0xbbf9('0x3c')]=_0x14ba0e[_0xbbf9('0x3c')]['length']?_0x14ba0e[_0xbbf9('0x3c')]:_0x26ebb5[_0xbbf9('0x3b')];if(_0x3bc812[_0xbbf9('0x38')][_0xbbf9('0x4f')]){_0x14ba0e[_0xbbf9('0x4a')]=[{'all':!![]}];}_0x14ba0e=_[_0xbbf9('0x46')]({},_0x14ba0e,_0x3bc812[_0xbbf9('0x48')]);return db[_0xbbf9('0x49')][_0xbbf9('0x50')](_0x14ba0e)[_0xbbf9('0x1b')](handleEntityNotFound(_0x121fe1,null))['then'](respondWithResult(_0x121fe1,null))[_0xbbf9('0x24')](handleError(_0x121fe1,null));};exports[_0xbbf9('0x51')]=function(_0x129dd8,_0x12ac4b){return db['DeskConfiguration']['create'](_0x129dd8['body'],{})[_0xbbf9('0x1b')](respondWithResult(_0x12ac4b,0xc9))['catch'](handleError(_0x12ac4b,null));};exports[_0xbbf9('0x52')]=function(_0x52d261,_0x136b71){if(_0x52d261['body']['id']){delete _0x52d261['body']['id'];}return db[_0xbbf9('0x49')][_0xbbf9('0x50')]({'where':{'id':_0x52d261['params']['id']}})[_0xbbf9('0x1b')](handleEntityNotFound(_0x136b71,null))[_0xbbf9('0x1b')](saveUpdates(_0x52d261[_0xbbf9('0x53')],null))[_0xbbf9('0x1b')](respondWithResult(_0x136b71,null))['catch'](handleError(_0x136b71,null));};exports[_0xbbf9('0x30')]=function(_0x1075c9,_0x2fd48b){return db[_0xbbf9('0x49')]['find']({'where':{'id':_0x1075c9[_0xbbf9('0x4e')]['id']}})[_0xbbf9('0x1b')](handleEntityNotFound(_0x2fd48b,null))[_0xbbf9('0x1b')](removeEntity(_0x2fd48b,null))[_0xbbf9('0x24')](handleError(_0x2fd48b,null));};exports['getFields']=function(_0x29d4e8,_0x2e0225,_0x1c618a){var _0x6654da={};var _0x2e72fa={};var _0x103636;var _0x4fe9ae;return db[_0xbbf9('0x49')][_0xbbf9('0x54')]({'where':{'id':_0x29d4e8['params']['id']}})[_0xbbf9('0x1b')](handleEntityNotFound(_0x2e0225,null))['then'](function(_0x2eb782){if(_0x2eb782){_0x103636=_0x2eb782;_0x2e72fa['model']=_['keys'](db[_0xbbf9('0x55')][_0xbbf9('0x37')]);_0x2e72fa[_0xbbf9('0x38')]=_[_0xbbf9('0x39')](_0x29d4e8['query']);_0x2e72fa[_0xbbf9('0x43')]=_[_0xbbf9('0x3a')](_0x2e72fa[_0xbbf9('0x3b')],_0x2e72fa['query']);_0x6654da[_0xbbf9('0x3c')]=_[_0xbbf9('0x3a')](_0x2e72fa[_0xbbf9('0x3b')],qs[_0xbbf9('0x3d')](_0x29d4e8['query'][_0xbbf9('0x3d')]));_0x6654da[_0xbbf9('0x3c')]=_0x6654da[_0xbbf9('0x3c')][_0xbbf9('0x56')]?_0x6654da[_0xbbf9('0x3c')]:_0x2e72fa[_0xbbf9('0x3b')];_0x6654da['order']=qs[_0xbbf9('0x41')](_0x29d4e8[_0xbbf9('0x38')][_0xbbf9('0x41')]);_0x6654da[_0xbbf9('0x42')]=qs[_0xbbf9('0x43')](_[_0xbbf9('0x44')](_0x29d4e8[_0xbbf9('0x38')],_0x2e72fa['filters']));if(_0x29d4e8[_0xbbf9('0x38')][_0xbbf9('0x45')]){_0x6654da[_0xbbf9('0x42')]=_[_0xbbf9('0x46')](_0x6654da['where'],{'$or':_[_0xbbf9('0x36')](_0x6654da[_0xbbf9('0x3c')],function(_0x2dfe02){var _0x56ca08={};_0x56ca08[_0x2dfe02]={'$like':'%'+_0x29d4e8[_0xbbf9('0x38')][_0xbbf9('0x45')]+'%'};return _0x56ca08;})});}_0x6654da=_['merge']({},_0x6654da,_0x29d4e8[_0xbbf9('0x48')]);return _0x103636[_0xbbf9('0x57')](_0x6654da);}})['then'](function(_0x2a04a5){if(_0x2a04a5){_0x4fe9ae=_0x2a04a5['length'];if(!_0x29d4e8[_0xbbf9('0x38')][_0xbbf9('0x3e')](_0xbbf9('0x3f'))){_0x6654da[_0xbbf9('0x29')]=qs[_0xbbf9('0x29')](_0x29d4e8[_0xbbf9('0x38')]['limit']);_0x6654da[_0xbbf9('0x28')]=qs['offset'](_0x29d4e8[_0xbbf9('0x38')]['offset']);}return _0x103636[_0xbbf9('0x57')](_0x6654da);}})[_0xbbf9('0x1b')](function(_0x5f2122){if(_0x5f2122){return _0x5f2122?{'count':_0x4fe9ae,'rows':_0x5f2122}:null;}})[_0xbbf9('0x1b')](respondWithResult(_0x2e0225,null))[_0xbbf9('0x24')](handleError(_0x2e0225,null));};exports[_0xbbf9('0x58')]=function(_0x1c008f,_0x1f1ca1,_0x1efe77){var _0x4ceae6={};var _0x3f99fa={};var _0x107321;var _0x436016;return db[_0xbbf9('0x49')]['findOne']({'where':{'id':_0x1c008f[_0xbbf9('0x4e')]['id']}})[_0xbbf9('0x1b')](handleEntityNotFound(_0x1f1ca1,null))[_0xbbf9('0x1b')](function(_0x4989b8){if(_0x4989b8){_0x107321=_0x4989b8;_0x3f99fa[_0xbbf9('0x3b')]=_[_0xbbf9('0x39')](db[_0xbbf9('0x55')][_0xbbf9('0x37')]);_0x3f99fa[_0xbbf9('0x38')]=_[_0xbbf9('0x39')](_0x1c008f['query']);_0x3f99fa[_0xbbf9('0x43')]=_[_0xbbf9('0x3a')](_0x3f99fa[_0xbbf9('0x3b')],_0x3f99fa[_0xbbf9('0x38')]);_0x4ceae6[_0xbbf9('0x3c')]=_['intersection'](_0x3f99fa[_0xbbf9('0x3b')],qs['fields'](_0x1c008f[_0xbbf9('0x38')][_0xbbf9('0x3d')]));_0x4ceae6[_0xbbf9('0x3c')]=_0x4ceae6['attributes'][_0xbbf9('0x56')]?_0x4ceae6[_0xbbf9('0x3c')]:_0x3f99fa[_0xbbf9('0x3b')];_0x4ceae6[_0xbbf9('0x40')]=qs[_0xbbf9('0x41')](_0x1c008f['query'][_0xbbf9('0x41')]);_0x4ceae6['where']=qs[_0xbbf9('0x43')](_[_0xbbf9('0x44')](_0x1c008f[_0xbbf9('0x38')],_0x3f99fa['filters']));if(_0x1c008f['query']['filter']){_0x4ceae6[_0xbbf9('0x42')]=_['merge'](_0x4ceae6[_0xbbf9('0x42')],{'$or':_[_0xbbf9('0x36')](_0x4ceae6[_0xbbf9('0x3c')],function(_0xb7421c){var _0xe64a31={};_0xe64a31[_0xb7421c]={'$like':'%'+_0x1c008f[_0xbbf9('0x38')]['filter']+'%'};return _0xe64a31;})});}_0x4ceae6=_[_0xbbf9('0x46')]({},_0x4ceae6,_0x1c008f[_0xbbf9('0x48')]);return _0x107321[_0xbbf9('0x58')](_0x4ceae6);}})[_0xbbf9('0x1b')](function(_0x191db4){if(_0x191db4){_0x436016=_0x191db4[_0xbbf9('0x56')];if(!_0x1c008f[_0xbbf9('0x38')][_0xbbf9('0x3e')](_0xbbf9('0x3f'))){_0x4ceae6[_0xbbf9('0x29')]=qs[_0xbbf9('0x29')](_0x1c008f[_0xbbf9('0x38')][_0xbbf9('0x29')]);_0x4ceae6[_0xbbf9('0x28')]=qs['offset'](_0x1c008f[_0xbbf9('0x38')][_0xbbf9('0x28')]);}return _0x107321['getSubjects'](_0x4ceae6);}})['then'](function(_0x277860){if(_0x277860){return _0x277860?{'count':_0x436016,'rows':_0x277860}:null;}})['then'](respondWithResult(_0x1f1ca1,null))[_0xbbf9('0x24')](handleError(_0x1f1ca1,null));};exports[_0xbbf9('0x59')]=function(_0x51209d,_0x5c6179,_0x27d8ba){var _0x787330={};var _0x222ce8={};var _0x338096;var _0x46fab2;return db['DeskConfiguration'][_0xbbf9('0x54')]({'where':{'id':_0x51209d[_0xbbf9('0x4e')]['id']}})[_0xbbf9('0x1b')](handleEntityNotFound(_0x5c6179,null))[_0xbbf9('0x1b')](function(_0x3d51fc){if(_0x3d51fc){_0x338096=_0x3d51fc;_0x222ce8[_0xbbf9('0x3b')]=_[_0xbbf9('0x39')](db[_0xbbf9('0x55')][_0xbbf9('0x37')]);_0x222ce8['query']=_['keys'](_0x51209d['query']);_0x222ce8[_0xbbf9('0x43')]=_['intersection'](_0x222ce8[_0xbbf9('0x3b')],_0x222ce8[_0xbbf9('0x38')]);_0x787330[_0xbbf9('0x3c')]=_['intersection'](_0x222ce8[_0xbbf9('0x3b')],qs[_0xbbf9('0x3d')](_0x51209d['query'][_0xbbf9('0x3d')]));_0x787330[_0xbbf9('0x3c')]=_0x787330['attributes'][_0xbbf9('0x56')]?_0x787330[_0xbbf9('0x3c')]:_0x222ce8[_0xbbf9('0x3b')];_0x787330['order']=qs[_0xbbf9('0x41')](_0x51209d['query']['sort']);_0x787330[_0xbbf9('0x42')]=qs[_0xbbf9('0x43')](_['pick'](_0x51209d[_0xbbf9('0x38')],_0x222ce8['filters']));if(_0x51209d['query']['filter']){_0x787330['where']=_[_0xbbf9('0x46')](_0x787330[_0xbbf9('0x42')],{'$or':_[_0xbbf9('0x36')](_0x787330[_0xbbf9('0x3c')],function(_0x285e55){var _0x164b50={};_0x164b50[_0x285e55]={'$like':'%'+_0x51209d[_0xbbf9('0x38')][_0xbbf9('0x45')]+'%'};return _0x164b50;})});}_0x787330=_[_0xbbf9('0x46')]({},_0x787330,_0x51209d[_0xbbf9('0x48')]);return _0x338096[_0xbbf9('0x59')](_0x787330);}})['then'](function(_0x25b4f3){if(_0x25b4f3){_0x46fab2=_0x25b4f3[_0xbbf9('0x56')];if(!_0x51209d[_0xbbf9('0x38')][_0xbbf9('0x3e')](_0xbbf9('0x3f'))){_0x787330['limit']=qs[_0xbbf9('0x29')](_0x51209d['query'][_0xbbf9('0x29')]);_0x787330[_0xbbf9('0x28')]=qs[_0xbbf9('0x28')](_0x51209d[_0xbbf9('0x38')][_0xbbf9('0x28')]);}return _0x338096[_0xbbf9('0x59')](_0x787330);}})[_0xbbf9('0x1b')](function(_0x5eefd0){if(_0x5eefd0){return _0x5eefd0?{'count':_0x46fab2,'rows':_0x5eefd0}:null;}})[_0xbbf9('0x1b')](respondWithResult(_0x5c6179,null))['catch'](handleError(_0x5c6179,null));};exports['getTags']=function(_0x4bddd2,_0x1478b6,_0x517ca5){var _0x1db5b3={};var _0x43ea91={};var _0x419fcb;var _0x1fdec5;return db[_0xbbf9('0x49')]['findOne']({'where':{'id':_0x4bddd2[_0xbbf9('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1478b6,null))[_0xbbf9('0x1b')](function(_0x433d28){if(_0x433d28){_0x419fcb=_0x433d28;_0x43ea91[_0xbbf9('0x3b')]=_['keys'](db[_0xbbf9('0x5a')]['rawAttributes']);_0x43ea91['query']=_[_0xbbf9('0x39')](_0x4bddd2[_0xbbf9('0x38')]);_0x43ea91['filters']=_[_0xbbf9('0x3a')](_0x43ea91[_0xbbf9('0x3b')],_0x43ea91['query']);_0x1db5b3[_0xbbf9('0x3c')]=_['intersection'](_0x43ea91[_0xbbf9('0x3b')],qs['fields'](_0x4bddd2['query'][_0xbbf9('0x3d')]));_0x1db5b3[_0xbbf9('0x3c')]=_0x1db5b3[_0xbbf9('0x3c')][_0xbbf9('0x56')]?_0x1db5b3[_0xbbf9('0x3c')]:_0x43ea91[_0xbbf9('0x3b')];_0x1db5b3[_0xbbf9('0x40')]=qs[_0xbbf9('0x41')](_0x4bddd2['query'][_0xbbf9('0x41')]);_0x1db5b3[_0xbbf9('0x42')]=qs[_0xbbf9('0x43')](_[_0xbbf9('0x44')](_0x4bddd2[_0xbbf9('0x38')],_0x43ea91[_0xbbf9('0x43')]));if(_0x4bddd2[_0xbbf9('0x38')][_0xbbf9('0x45')]){_0x1db5b3['where']=_[_0xbbf9('0x46')](_0x1db5b3[_0xbbf9('0x42')],{'$or':_[_0xbbf9('0x36')](_0x1db5b3['attributes'],function(_0xca116f){var _0x23dac1={};_0x23dac1[_0xca116f]={'$like':'%'+_0x4bddd2[_0xbbf9('0x38')][_0xbbf9('0x45')]+'%'};return _0x23dac1;})});}_0x1db5b3=_['merge']({},_0x1db5b3,_0x4bddd2['options']);return _0x419fcb['getTags'](_0x1db5b3);}})['then'](function(_0x2b4ad0){if(_0x2b4ad0){_0x1fdec5=_0x2b4ad0['length'];if(!_0x4bddd2[_0xbbf9('0x38')][_0xbbf9('0x3e')]('nolimit')){_0x1db5b3['limit']=qs[_0xbbf9('0x29')](_0x4bddd2[_0xbbf9('0x38')]['limit']);_0x1db5b3[_0xbbf9('0x28')]=qs['offset'](_0x4bddd2[_0xbbf9('0x38')][_0xbbf9('0x28')]);}return _0x419fcb[_0xbbf9('0x5b')](_0x1db5b3);}})[_0xbbf9('0x1b')](function(_0x348fa6){if(_0x348fa6){return _0x348fa6?{'count':_0x1fdec5,'rows':_0x348fa6}:null;}})[_0xbbf9('0x1b')](respondWithResult(_0x1478b6,null))[_0xbbf9('0x24')](handleError(_0x1478b6,null));};exports[_0xbbf9('0x5c')]=function(_0x398d86,_0x2e8508,_0x2d6a93){if(_0x398d86[_0xbbf9('0x53')]['id']){delete _0x398d86[_0xbbf9('0x53')]['id'];}return db[_0xbbf9('0x49')][_0xbbf9('0x54')]({'where':{'id':_0x398d86[_0xbbf9('0x4e')]['id']}})[_0xbbf9('0x1b')](handleEntityNotFound(_0x2e8508,null))[_0xbbf9('0x1b')](function(_0x45be02){if(_0x45be02){return _0x45be02['setTags'](_0x398d86['body'][_0xbbf9('0x5d')]||[]);}return null;})[_0xbbf9('0x1b')](respondWithResult(_0x2e8508,null))[_0xbbf9('0x24')](handleError(_0x2e8508,null));}; \ No newline at end of file +var _0x1a76=['model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','options','include','findAll','rows','show','includeAll','find','create','body','params','destroy','getFields','DeskField','pick','getSubjects','findOne','getDescriptions','Tag','getTags','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','debug','request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','DeskConfiguration','rawAttributes','type','key'];(function(_0x51ee74,_0x18e42e){var _0x1971dd=function(_0x2e1e69){while(--_0x2e1e69){_0x51ee74['push'](_0x51ee74['shift']());}};_0x1971dd(++_0x18e42e);}(_0x1a76,0x134));var _0x61a7=function(_0x295771,_0x11e035){_0x295771=_0x295771-0x0;var _0x5130ee=_0x1a76[_0x295771];return _0x5130ee;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x61a7('0x0'));var jsonpatch=require(_0x61a7('0x1'));var rp=require(_0x61a7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x61a7('0x3'));var util=require(_0x61a7('0x4'));var path=require(_0x61a7('0x5'));var sox=require(_0x61a7('0x6'));var csv=require(_0x61a7('0x7'));var ejs=require(_0x61a7('0x8'));var fs=require('fs');var _=require(_0x61a7('0x9'));var squel=require(_0x61a7('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x61a7('0x7'));var querystring=require(_0x61a7('0xb'));var Papa=require(_0x61a7('0xc'));var Redis=require('ioredis');var authService=require(_0x61a7('0xd'));var qs=require(_0x61a7('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x61a7('0xf'))(_0x61a7('0x10'));var utils=require(_0x61a7('0x11'));var config=require(_0x61a7('0x12'));var licenseUtil=require(_0x61a7('0x13'));var db=require(_0x61a7('0x14'))['db'];var jayson=require(_0x61a7('0x15'));var client=jayson['client'][_0x61a7('0x16')]({'port':0x232a});function respondWithRpcPromise(_0xb2c6f3,_0x4ea452,_0x1da1b3,_0x30fc5e){return new BPromise(function(_0x43d87c,_0x4190a1){var _0x2e758e=_0x30fc5e||client;return _0x2e758e[_0x61a7('0x17')](_0xb2c6f3,_0x1da1b3)['then'](function(_0x46d741){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x4ea452,'request\x20sent');logger[_0x61a7('0x18')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4ea452,_0x61a7('0x19'),JSON[_0x61a7('0x1a')](_0x46d741));if(_0x46d741[_0x61a7('0x1b')]){if(_0x46d741[_0x61a7('0x1b')][_0x61a7('0x1c')]===0x1f4){logger[_0x61a7('0x1b')](_0x61a7('0x1d'),_0x4ea452,_0x46d741[_0x61a7('0x1b')][_0x61a7('0x1e')]);return _0x4190a1(_0x46d741[_0x61a7('0x1b')][_0x61a7('0x1e')]);}logger[_0x61a7('0x1b')](_0x61a7('0x1d'),_0x4ea452,_0x46d741[_0x61a7('0x1b')][_0x61a7('0x1e')]);return _0x43d87c(_0x46d741[_0x61a7('0x1b')][_0x61a7('0x1e')]);}else{logger[_0x61a7('0x1f')](_0x61a7('0x1d'),_0x4ea452,'request\x20sent');_0x43d87c(_0x46d741[_0x61a7('0x20')]['message']);}})[_0x61a7('0x21')](function(_0xd8c791){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x4ea452,_0xd8c791);_0x4190a1(_0xd8c791);});});}function respondWithStatusCode(_0x43aecc,_0x316fd){_0x316fd=_0x316fd||0xcc;return function(_0x287d48){if(_0x287d48){return _0x43aecc[_0x61a7('0x22')](_0x316fd);}return _0x43aecc[_0x61a7('0x23')](_0x316fd)[_0x61a7('0x24')]();};}function respondWithResult(_0x6fe424,_0x3f682b){_0x3f682b=_0x3f682b||0xc8;return function(_0x3a214f){if(_0x3a214f){return _0x6fe424[_0x61a7('0x23')](_0x3f682b)[_0x61a7('0x25')](_0x3a214f);}};}function respondWithFilteredResult(_0x461743,_0x2074b6){return function(_0x8bede7){if(_0x8bede7){var _0x42a184=_0x8bede7[_0x61a7('0x26')],_0x375e47=_0x2074b6[_0x61a7('0x27')],_0x366290=_0x2074b6['offset']+_0x2074b6[_0x61a7('0x28')],_0x420dfe;if(_0x366290>=_0x42a184){_0x366290=_0x42a184;_0x420dfe=0xc8;}else{_0x420dfe=0xce;}_0x461743['status'](_0x420dfe);return _0x461743[_0x61a7('0x29')](_0x61a7('0x2a'),_0x375e47+'-'+_0x366290+'/'+_0x42a184)[_0x61a7('0x25')](_0x8bede7);}return null;};}function patchUpdates(_0xce7c98){return function(_0x382036){try{jsonpatch[_0x61a7('0x2b')](_0x382036,_0xce7c98,!![]);}catch(_0x2af852){return BPromise[_0x61a7('0x2c')](_0x2af852);}return _0x382036[_0x61a7('0x2d')]();};}function saveUpdates(_0x30de73,_0x19208f){return function(_0x12e6df){if(_0x12e6df){return _0x12e6df[_0x61a7('0x2e')](_0x30de73)[_0x61a7('0x2f')](function(_0x124888){return _0x124888;});}return null;};}function removeEntity(_0x158136,_0x386532){return function(_0x345a70){if(_0x345a70){return _0x345a70['destroy']()[_0x61a7('0x2f')](function(){_0x158136[_0x61a7('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fc2a5,_0x2e16ca){return function(_0x287072){if(!_0x287072){_0x3fc2a5[_0x61a7('0x22')](0x194);}return _0x287072;};}function handleError(_0x42c0f9,_0xec24b0){_0xec24b0=_0xec24b0||0x1f4;return function(_0x5a88e5){logger[_0x61a7('0x1b')](_0x5a88e5[_0x61a7('0x30')]);if(_0x5a88e5['name']){delete _0x5a88e5[_0x61a7('0x31')];}_0x42c0f9['status'](_0xec24b0)[_0x61a7('0x32')](_0x5a88e5);};}exports[_0x61a7('0x33')]=function(_0x38e668,_0x5eee47){var _0x3106b4={},_0xa891bf={},_0x395062={'count':0x0,'rows':[]};var _0x3ca219=_['map'](db[_0x61a7('0x34')][_0x61a7('0x35')],function(_0x271ec3){return{'name':_0x271ec3['fieldName'],'type':_0x271ec3[_0x61a7('0x36')][_0x61a7('0x37')]};});_0xa891bf[_0x61a7('0x38')]=_['map'](_0x3ca219,_0x61a7('0x31'));_0xa891bf[_0x61a7('0x39')]=_[_0x61a7('0x3a')](_0x38e668[_0x61a7('0x39')]);_0xa891bf[_0x61a7('0x3b')]=_['intersection'](_0xa891bf[_0x61a7('0x38')],_0xa891bf[_0x61a7('0x39')]);_0x3106b4[_0x61a7('0x3c')]=_[_0x61a7('0x3d')](_0xa891bf['model'],qs[_0x61a7('0x3e')](_0x38e668['query'][_0x61a7('0x3e')]));_0x3106b4[_0x61a7('0x3c')]=_0x3106b4[_0x61a7('0x3c')][_0x61a7('0x3f')]?_0x3106b4[_0x61a7('0x3c')]:_0xa891bf[_0x61a7('0x38')];if(!_0x38e668['query'][_0x61a7('0x40')](_0x61a7('0x41'))){_0x3106b4['limit']=qs[_0x61a7('0x28')](_0x38e668[_0x61a7('0x39')][_0x61a7('0x28')]);_0x3106b4[_0x61a7('0x27')]=qs[_0x61a7('0x27')](_0x38e668['query'][_0x61a7('0x27')]);}_0x3106b4[_0x61a7('0x42')]=qs[_0x61a7('0x43')](_0x38e668[_0x61a7('0x39')]['sort']);_0x3106b4['where']=qs['filters'](_['pick'](_0x38e668[_0x61a7('0x39')],_0xa891bf[_0x61a7('0x3b')]),_0x3ca219);if(_0x38e668[_0x61a7('0x39')][_0x61a7('0x44')]){_0x3106b4[_0x61a7('0x45')]=_[_0x61a7('0x46')](_0x3106b4[_0x61a7('0x45')],{'$or':_[_0x61a7('0x47')](_0x3ca219,function(_0x400e85){if(_0x400e85[_0x61a7('0x36')]!=='VIRTUAL'){var _0x27db84={};_0x27db84[_0x400e85[_0x61a7('0x31')]]={'$like':'%'+_0x38e668[_0x61a7('0x39')][_0x61a7('0x44')]+'%'};return _0x27db84;}})});}_0x3106b4=_[_0x61a7('0x46')]({},_0x3106b4,_0x38e668[_0x61a7('0x48')]);var _0x1245c6={'where':_0x3106b4['where']};return db[_0x61a7('0x34')][_0x61a7('0x26')](_0x1245c6)[_0x61a7('0x2f')](function(_0x23a4ae){_0x395062['count']=_0x23a4ae;if(_0x38e668['query']['includeAll']){_0x3106b4[_0x61a7('0x49')]=[{'all':!![]}];}return db[_0x61a7('0x34')][_0x61a7('0x4a')](_0x3106b4);})[_0x61a7('0x2f')](function(_0x129727){_0x395062[_0x61a7('0x4b')]=_0x129727;return _0x395062;})[_0x61a7('0x2f')](respondWithFilteredResult(_0x5eee47,_0x3106b4))[_0x61a7('0x21')](handleError(_0x5eee47,null));};exports[_0x61a7('0x4c')]=function(_0x582b3e,_0x4d568b){var _0x14ffcd={'raw':![],'where':{'id':_0x582b3e['params']['id']}},_0x2b95cf={};_0x2b95cf[_0x61a7('0x38')]=_['keys'](db['DeskConfiguration'][_0x61a7('0x35')]);_0x2b95cf['query']=_['keys'](_0x582b3e['query']);_0x2b95cf[_0x61a7('0x3b')]=_[_0x61a7('0x3d')](_0x2b95cf[_0x61a7('0x38')],_0x2b95cf[_0x61a7('0x39')]);_0x14ffcd[_0x61a7('0x3c')]=_[_0x61a7('0x3d')](_0x2b95cf[_0x61a7('0x38')],qs[_0x61a7('0x3e')](_0x582b3e['query'][_0x61a7('0x3e')]));_0x14ffcd[_0x61a7('0x3c')]=_0x14ffcd[_0x61a7('0x3c')]['length']?_0x14ffcd[_0x61a7('0x3c')]:_0x2b95cf[_0x61a7('0x38')];if(_0x582b3e[_0x61a7('0x39')][_0x61a7('0x4d')]){_0x14ffcd[_0x61a7('0x49')]=[{'all':!![]}];}_0x14ffcd=_[_0x61a7('0x46')]({},_0x14ffcd,_0x582b3e[_0x61a7('0x48')]);return db[_0x61a7('0x34')][_0x61a7('0x4e')](_0x14ffcd)['then'](handleEntityNotFound(_0x4d568b,null))[_0x61a7('0x2f')](respondWithResult(_0x4d568b,null))[_0x61a7('0x21')](handleError(_0x4d568b,null));};exports['create']=function(_0x3eecad,_0xce7083){return db['DeskConfiguration'][_0x61a7('0x4f')](_0x3eecad[_0x61a7('0x50')],{})[_0x61a7('0x2f')](respondWithResult(_0xce7083,0xc9))[_0x61a7('0x21')](handleError(_0xce7083,null));};exports[_0x61a7('0x2e')]=function(_0x1697f1,_0x6cf4fa){if(_0x1697f1[_0x61a7('0x50')]['id']){delete _0x1697f1[_0x61a7('0x50')]['id'];}return db[_0x61a7('0x34')][_0x61a7('0x4e')]({'where':{'id':_0x1697f1[_0x61a7('0x51')]['id']}})[_0x61a7('0x2f')](handleEntityNotFound(_0x6cf4fa,null))[_0x61a7('0x2f')](saveUpdates(_0x1697f1[_0x61a7('0x50')],null))[_0x61a7('0x2f')](respondWithResult(_0x6cf4fa,null))['catch'](handleError(_0x6cf4fa,null));};exports[_0x61a7('0x52')]=function(_0x8c0416,_0x367af7){return db[_0x61a7('0x34')]['find']({'where':{'id':_0x8c0416[_0x61a7('0x51')]['id']}})['then'](handleEntityNotFound(_0x367af7,null))[_0x61a7('0x2f')](removeEntity(_0x367af7,null))[_0x61a7('0x21')](handleError(_0x367af7,null));};exports[_0x61a7('0x53')]=function(_0x1ebfc5,_0x4bdf8f,_0x3bc88a){var _0x38eb1f={};var _0x46c6ff={};var _0xfd0229;var _0x39f6c3;return db['DeskConfiguration']['findOne']({'where':{'id':_0x1ebfc5[_0x61a7('0x51')]['id']}})[_0x61a7('0x2f')](handleEntityNotFound(_0x4bdf8f,null))['then'](function(_0x3ad016){if(_0x3ad016){_0xfd0229=_0x3ad016;_0x46c6ff[_0x61a7('0x38')]=_[_0x61a7('0x3a')](db[_0x61a7('0x54')][_0x61a7('0x35')]);_0x46c6ff[_0x61a7('0x39')]=_[_0x61a7('0x3a')](_0x1ebfc5['query']);_0x46c6ff['filters']=_[_0x61a7('0x3d')](_0x46c6ff[_0x61a7('0x38')],_0x46c6ff[_0x61a7('0x39')]);_0x38eb1f['attributes']=_[_0x61a7('0x3d')](_0x46c6ff[_0x61a7('0x38')],qs[_0x61a7('0x3e')](_0x1ebfc5[_0x61a7('0x39')][_0x61a7('0x3e')]));_0x38eb1f[_0x61a7('0x3c')]=_0x38eb1f[_0x61a7('0x3c')][_0x61a7('0x3f')]?_0x38eb1f['attributes']:_0x46c6ff['model'];_0x38eb1f[_0x61a7('0x42')]=qs['sort'](_0x1ebfc5['query']['sort']);_0x38eb1f[_0x61a7('0x45')]=qs['filters'](_[_0x61a7('0x55')](_0x1ebfc5[_0x61a7('0x39')],_0x46c6ff[_0x61a7('0x3b')]));if(_0x1ebfc5[_0x61a7('0x39')]['filter']){_0x38eb1f['where']=_[_0x61a7('0x46')](_0x38eb1f[_0x61a7('0x45')],{'$or':_[_0x61a7('0x47')](_0x38eb1f['attributes'],function(_0x53f687){var _0x5b5585={};_0x5b5585[_0x53f687]={'$like':'%'+_0x1ebfc5[_0x61a7('0x39')][_0x61a7('0x44')]+'%'};return _0x5b5585;})});}_0x38eb1f=_[_0x61a7('0x46')]({},_0x38eb1f,_0x1ebfc5[_0x61a7('0x48')]);return _0xfd0229[_0x61a7('0x53')](_0x38eb1f);}})['then'](function(_0x38343f){if(_0x38343f){_0x39f6c3=_0x38343f[_0x61a7('0x3f')];if(!_0x1ebfc5[_0x61a7('0x39')][_0x61a7('0x40')]('nolimit')){_0x38eb1f['limit']=qs[_0x61a7('0x28')](_0x1ebfc5[_0x61a7('0x39')][_0x61a7('0x28')]);_0x38eb1f[_0x61a7('0x27')]=qs[_0x61a7('0x27')](_0x1ebfc5[_0x61a7('0x39')]['offset']);}return _0xfd0229[_0x61a7('0x53')](_0x38eb1f);}})[_0x61a7('0x2f')](function(_0x5d48d9){if(_0x5d48d9){return _0x5d48d9?{'count':_0x39f6c3,'rows':_0x5d48d9}:null;}})[_0x61a7('0x2f')](respondWithResult(_0x4bdf8f,null))[_0x61a7('0x21')](handleError(_0x4bdf8f,null));};exports[_0x61a7('0x56')]=function(_0x792d51,_0x2577a5,_0x228138){var _0x4ef7bd={};var _0x3bfdfe={};var _0x4e4f4d;var _0x41a106;return db['DeskConfiguration'][_0x61a7('0x57')]({'where':{'id':_0x792d51['params']['id']}})['then'](handleEntityNotFound(_0x2577a5,null))[_0x61a7('0x2f')](function(_0x1b26d2){if(_0x1b26d2){_0x4e4f4d=_0x1b26d2;_0x3bfdfe[_0x61a7('0x38')]=_[_0x61a7('0x3a')](db[_0x61a7('0x54')][_0x61a7('0x35')]);_0x3bfdfe['query']=_[_0x61a7('0x3a')](_0x792d51[_0x61a7('0x39')]);_0x3bfdfe[_0x61a7('0x3b')]=_['intersection'](_0x3bfdfe[_0x61a7('0x38')],_0x3bfdfe['query']);_0x4ef7bd['attributes']=_[_0x61a7('0x3d')](_0x3bfdfe[_0x61a7('0x38')],qs['fields'](_0x792d51['query'][_0x61a7('0x3e')]));_0x4ef7bd[_0x61a7('0x3c')]=_0x4ef7bd['attributes'][_0x61a7('0x3f')]?_0x4ef7bd[_0x61a7('0x3c')]:_0x3bfdfe[_0x61a7('0x38')];_0x4ef7bd[_0x61a7('0x42')]=qs['sort'](_0x792d51['query'][_0x61a7('0x43')]);_0x4ef7bd[_0x61a7('0x45')]=qs[_0x61a7('0x3b')](_[_0x61a7('0x55')](_0x792d51['query'],_0x3bfdfe[_0x61a7('0x3b')]));if(_0x792d51[_0x61a7('0x39')][_0x61a7('0x44')]){_0x4ef7bd[_0x61a7('0x45')]=_[_0x61a7('0x46')](_0x4ef7bd['where'],{'$or':_[_0x61a7('0x47')](_0x4ef7bd[_0x61a7('0x3c')],function(_0x40fca6){var _0x388725={};_0x388725[_0x40fca6]={'$like':'%'+_0x792d51[_0x61a7('0x39')][_0x61a7('0x44')]+'%'};return _0x388725;})});}_0x4ef7bd=_[_0x61a7('0x46')]({},_0x4ef7bd,_0x792d51[_0x61a7('0x48')]);return _0x4e4f4d['getSubjects'](_0x4ef7bd);}})[_0x61a7('0x2f')](function(_0xf7c719){if(_0xf7c719){_0x41a106=_0xf7c719[_0x61a7('0x3f')];if(!_0x792d51[_0x61a7('0x39')][_0x61a7('0x40')](_0x61a7('0x41'))){_0x4ef7bd['limit']=qs[_0x61a7('0x28')](_0x792d51['query']['limit']);_0x4ef7bd[_0x61a7('0x27')]=qs[_0x61a7('0x27')](_0x792d51[_0x61a7('0x39')][_0x61a7('0x27')]);}return _0x4e4f4d[_0x61a7('0x56')](_0x4ef7bd);}})[_0x61a7('0x2f')](function(_0x5eac6c){if(_0x5eac6c){return _0x5eac6c?{'count':_0x41a106,'rows':_0x5eac6c}:null;}})[_0x61a7('0x2f')](respondWithResult(_0x2577a5,null))[_0x61a7('0x21')](handleError(_0x2577a5,null));};exports[_0x61a7('0x58')]=function(_0x7d2125,_0x13049a,_0x3f0f6a){var _0x71f228={};var _0x33ceaa={};var _0x843f2c;var _0x171975;return db[_0x61a7('0x34')][_0x61a7('0x57')]({'where':{'id':_0x7d2125['params']['id']}})[_0x61a7('0x2f')](handleEntityNotFound(_0x13049a,null))['then'](function(_0x58fd6c){if(_0x58fd6c){_0x843f2c=_0x58fd6c;_0x33ceaa[_0x61a7('0x38')]=_['keys'](db[_0x61a7('0x54')][_0x61a7('0x35')]);_0x33ceaa['query']=_[_0x61a7('0x3a')](_0x7d2125[_0x61a7('0x39')]);_0x33ceaa[_0x61a7('0x3b')]=_[_0x61a7('0x3d')](_0x33ceaa[_0x61a7('0x38')],_0x33ceaa[_0x61a7('0x39')]);_0x71f228['attributes']=_['intersection'](_0x33ceaa[_0x61a7('0x38')],qs['fields'](_0x7d2125[_0x61a7('0x39')]['fields']));_0x71f228[_0x61a7('0x3c')]=_0x71f228[_0x61a7('0x3c')][_0x61a7('0x3f')]?_0x71f228[_0x61a7('0x3c')]:_0x33ceaa[_0x61a7('0x38')];_0x71f228[_0x61a7('0x42')]=qs[_0x61a7('0x43')](_0x7d2125[_0x61a7('0x39')][_0x61a7('0x43')]);_0x71f228[_0x61a7('0x45')]=qs['filters'](_['pick'](_0x7d2125[_0x61a7('0x39')],_0x33ceaa[_0x61a7('0x3b')]));if(_0x7d2125[_0x61a7('0x39')][_0x61a7('0x44')]){_0x71f228[_0x61a7('0x45')]=_[_0x61a7('0x46')](_0x71f228['where'],{'$or':_[_0x61a7('0x47')](_0x71f228['attributes'],function(_0xa6c5b1){var _0x2eccf5={};_0x2eccf5[_0xa6c5b1]={'$like':'%'+_0x7d2125['query'][_0x61a7('0x44')]+'%'};return _0x2eccf5;})});}_0x71f228=_[_0x61a7('0x46')]({},_0x71f228,_0x7d2125['options']);return _0x843f2c[_0x61a7('0x58')](_0x71f228);}})[_0x61a7('0x2f')](function(_0x53fe12){if(_0x53fe12){_0x171975=_0x53fe12['length'];if(!_0x7d2125[_0x61a7('0x39')]['hasOwnProperty'](_0x61a7('0x41'))){_0x71f228[_0x61a7('0x28')]=qs[_0x61a7('0x28')](_0x7d2125[_0x61a7('0x39')][_0x61a7('0x28')]);_0x71f228[_0x61a7('0x27')]=qs['offset'](_0x7d2125[_0x61a7('0x39')][_0x61a7('0x27')]);}return _0x843f2c[_0x61a7('0x58')](_0x71f228);}})['then'](function(_0x3b78a1){if(_0x3b78a1){return _0x3b78a1?{'count':_0x171975,'rows':_0x3b78a1}:null;}})[_0x61a7('0x2f')](respondWithResult(_0x13049a,null))[_0x61a7('0x21')](handleError(_0x13049a,null));};exports['getTags']=function(_0x3e2bb1,_0x54b743,_0x146de3){var _0x5edaf4={};var _0x24c99e={};var _0x5af02d;var _0x5d5409;return db[_0x61a7('0x34')][_0x61a7('0x57')]({'where':{'id':_0x3e2bb1[_0x61a7('0x51')]['id']}})[_0x61a7('0x2f')](handleEntityNotFound(_0x54b743,null))[_0x61a7('0x2f')](function(_0x49dee9){if(_0x49dee9){_0x5af02d=_0x49dee9;_0x24c99e[_0x61a7('0x38')]=_['keys'](db[_0x61a7('0x59')]['rawAttributes']);_0x24c99e[_0x61a7('0x39')]=_[_0x61a7('0x3a')](_0x3e2bb1[_0x61a7('0x39')]);_0x24c99e[_0x61a7('0x3b')]=_[_0x61a7('0x3d')](_0x24c99e[_0x61a7('0x38')],_0x24c99e[_0x61a7('0x39')]);_0x5edaf4[_0x61a7('0x3c')]=_[_0x61a7('0x3d')](_0x24c99e[_0x61a7('0x38')],qs[_0x61a7('0x3e')](_0x3e2bb1[_0x61a7('0x39')][_0x61a7('0x3e')]));_0x5edaf4[_0x61a7('0x3c')]=_0x5edaf4[_0x61a7('0x3c')][_0x61a7('0x3f')]?_0x5edaf4[_0x61a7('0x3c')]:_0x24c99e[_0x61a7('0x38')];_0x5edaf4[_0x61a7('0x42')]=qs['sort'](_0x3e2bb1['query'][_0x61a7('0x43')]);_0x5edaf4['where']=qs[_0x61a7('0x3b')](_[_0x61a7('0x55')](_0x3e2bb1[_0x61a7('0x39')],_0x24c99e['filters']));if(_0x3e2bb1[_0x61a7('0x39')][_0x61a7('0x44')]){_0x5edaf4[_0x61a7('0x45')]=_[_0x61a7('0x46')](_0x5edaf4['where'],{'$or':_[_0x61a7('0x47')](_0x5edaf4[_0x61a7('0x3c')],function(_0x1de173){var _0xaf9147={};_0xaf9147[_0x1de173]={'$like':'%'+_0x3e2bb1['query']['filter']+'%'};return _0xaf9147;})});}_0x5edaf4=_['merge']({},_0x5edaf4,_0x3e2bb1[_0x61a7('0x48')]);return _0x5af02d[_0x61a7('0x5a')](_0x5edaf4);}})[_0x61a7('0x2f')](function(_0x9e7e39){if(_0x9e7e39){_0x5d5409=_0x9e7e39[_0x61a7('0x3f')];if(!_0x3e2bb1[_0x61a7('0x39')]['hasOwnProperty']('nolimit')){_0x5edaf4[_0x61a7('0x28')]=qs[_0x61a7('0x28')](_0x3e2bb1['query'][_0x61a7('0x28')]);_0x5edaf4[_0x61a7('0x27')]=qs[_0x61a7('0x27')](_0x3e2bb1[_0x61a7('0x39')]['offset']);}return _0x5af02d[_0x61a7('0x5a')](_0x5edaf4);}})[_0x61a7('0x2f')](function(_0x147408){if(_0x147408){return _0x147408?{'count':_0x5d5409,'rows':_0x147408}:null;}})[_0x61a7('0x2f')](respondWithResult(_0x54b743,null))['catch'](handleError(_0x54b743,null));};exports['setTags']=function(_0x28a652,_0x5cc89e,_0x1d8ded){if(_0x28a652['body']['id']){delete _0x28a652['body']['id'];}return db['DeskConfiguration'][_0x61a7('0x57')]({'where':{'id':_0x28a652[_0x61a7('0x51')]['id']}})[_0x61a7('0x2f')](handleEntityNotFound(_0x5cc89e,null))[_0x61a7('0x2f')](function(_0x231ca1){if(_0x231ca1){return _0x231ca1['setTags'](_0x28a652[_0x61a7('0x50')]['ids']||[]);}return null;})[_0x61a7('0x2f')](respondWithResult(_0x5cc89e,null))[_0x61a7('0x21')](handleError(_0x5cc89e,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 796a267..abe77d1 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 _0xa969=['path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3407be,_0x3ad78b){var _0x1743e2=function(_0x564703){while(--_0x564703){_0x3407be['push'](_0x3407be['shift']());}};_0x1743e2(++_0x3ad78b);}(_0xa969,0xbe));var _0x9a96=function(_0x39e164,_0x2cb93b){_0x39e164=_0x39e164-0x0;var _0x13fa6b=_0xa969[_0x39e164];return _0x13fa6b;};'use strict';var _=require(_0x9a96('0x0'));var util=require(_0x9a96('0x1'));var logger=require(_0x9a96('0x2'))(_0x9a96('0x3'));var moment=require(_0x9a96('0x4'));var BPromise=require(_0x9a96('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a96('0x6'));var rimraf=require(_0x9a96('0x7'));var config=require(_0x9a96('0x8'));var attributes=require(_0x9a96('0x9'));module[_0x9a96('0xa')]=function(_0x5116d4,_0x125ed5){return _0x5116d4[_0x9a96('0xb')](_0x9a96('0xc'),attributes,{'tableName':_0x9a96('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5eb=['define','DeskConfiguration','int_desk_configurations','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x4d121a,_0x591d4f){var _0x1a4c55=function(_0x177231){while(--_0x177231){_0x4d121a['push'](_0x4d121a['shift']());}};_0x1a4c55(++_0x591d4f);}(_0xa5eb,0x93));var _0xba5e=function(_0x5e5580,_0x32fb08){_0x5e5580=_0x5e5580-0x0;var _0x436d68=_0xa5eb[_0x5e5580];return _0x436d68;};'use strict';var _=require(_0xba5e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xba5e('0x1'));var moment=require(_0xba5e('0x2'));var BPromise=require(_0xba5e('0x3'));var rp=require(_0xba5e('0x4'));var fs=require('fs');var path=require(_0xba5e('0x5'));var rimraf=require(_0xba5e('0x6'));var config=require(_0xba5e('0x7'));var attributes=require(_0xba5e('0x8'));module['exports']=function(_0x4db041,_0x41442a){return _0x4db041[_0xba5e('0x9')](_0xba5e('0xa'),attributes,{'tableName':_0xba5e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 9a46836..3d2c2f1 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 _0x8d53=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch'];(function(_0x3ae136,_0xb7631e){var _0x594053=function(_0x539bf4){while(--_0x539bf4){_0x3ae136['push'](_0x3ae136['shift']());}};_0x594053(++_0xb7631e);}(_0x8d53,0x1c2));var _0x38d5=function(_0x1021d7,_0x26b624){_0x1021d7=_0x1021d7-0x0;var _0x3c73b3=_0x8d53[_0x1021d7];return _0x3c73b3;};'use strict';var _=require(_0x38d5('0x0'));var util=require(_0x38d5('0x1'));var moment=require('moment');var BPromise=require(_0x38d5('0x2'));var rs=require(_0x38d5('0x3'));var fs=require('fs');var Redis=require(_0x38d5('0x4'));var db=require(_0x38d5('0x5'))['db'];var utils=require(_0x38d5('0x6'));var logger=require(_0x38d5('0x7'))(_0x38d5('0x8'));var config=require(_0x38d5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x38d5('0xa')][_0x38d5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xeb7913,_0x5aa1ca,_0x5ebf9a){return new BPromise(function(_0x284f7b,_0x3883e0){return client[_0x38d5('0xc')](_0xeb7913,_0x5ebf9a)[_0x38d5('0xd')](function(_0x4e18c0){logger[_0x38d5('0xe')](_0x38d5('0xf'),_0x5aa1ca,'request\x20sent');logger[_0x38d5('0x10')](_0x38d5('0x11'),_0x5aa1ca,_0x38d5('0x12'),JSON[_0x38d5('0x13')](_0x4e18c0));if(_0x4e18c0['error']){if(_0x4e18c0['error'][_0x38d5('0x14')]===0x1f4){logger[_0x38d5('0x15')]('DeskConfiguration,\x20%s,\x20%s',_0x5aa1ca,_0x4e18c0[_0x38d5('0x15')]['message']);return _0x3883e0(_0x4e18c0[_0x38d5('0x15')][_0x38d5('0x16')]);}logger[_0x38d5('0x15')](_0x38d5('0xf'),_0x5aa1ca,_0x4e18c0[_0x38d5('0x15')][_0x38d5('0x16')]);return _0x284f7b(_0x4e18c0['error'][_0x38d5('0x16')]);}else{logger['info'](_0x38d5('0xf'),_0x5aa1ca,'request\x20sent');_0x284f7b(_0x4e18c0[_0x38d5('0x17')][_0x38d5('0x16')]);}})[_0x38d5('0x18')](function(_0x4e98df){logger[_0x38d5('0x15')](_0x38d5('0xf'),_0x5aa1ca,_0x4e98df);_0x3883e0(_0x4e98df);});});} \ No newline at end of file +var _0x0624=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x260db5,_0x420864){var _0x4f6afc=function(_0x2020e0){while(--_0x2020e0){_0x260db5['push'](_0x260db5['shift']());}};_0x4f6afc(++_0x420864);}(_0x0624,0x132));var _0x4062=function(_0x2c46f5,_0x186c11){_0x2c46f5=_0x2c46f5-0x0;var _0x4e2aa9=_0x0624[_0x2c46f5];return _0x4e2aa9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4062('0x0'));var fs=require('fs');var Redis=require(_0x4062('0x1'));var db=require(_0x4062('0x2'))['db'];var utils=require(_0x4062('0x3'));var logger=require(_0x4062('0x4'))(_0x4062('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4062('0x6')][_0x4062('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2f4928,_0xdff88c,_0x27794b){return new BPromise(function(_0x5d19e8,_0x75ce4e){return client['request'](_0x2f4928,_0x27794b)[_0x4062('0x8')](function(_0x35663b){logger[_0x4062('0x9')](_0x4062('0xa'),_0xdff88c,_0x4062('0xb'));logger[_0x4062('0xc')](_0x4062('0xd'),_0xdff88c,'request\x20sent',JSON[_0x4062('0xe')](_0x35663b));if(_0x35663b['error']){if(_0x35663b[_0x4062('0xf')][_0x4062('0x10')]===0x1f4){logger[_0x4062('0xf')](_0x4062('0xa'),_0xdff88c,_0x35663b[_0x4062('0xf')]['message']);return _0x75ce4e(_0x35663b[_0x4062('0xf')][_0x4062('0x11')]);}logger['error'](_0x4062('0xa'),_0xdff88c,_0x35663b[_0x4062('0xf')][_0x4062('0x11')]);return _0x5d19e8(_0x35663b['error']['message']);}else{logger[_0x4062('0x9')](_0x4062('0xa'),_0xdff88c,'request\x20sent');_0x5d19e8(_0x35663b['result']['message']);}})['catch'](function(_0x437432){logger['error'](_0x4062('0xa'),_0xdff88c,_0x437432);_0x75ce4e(_0x437432);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index ca336b4..80bf1dd 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 _0x0488=['create','put','update','delete','exports','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x1186ba,_0x421a86){var _0x13a347=function(_0x357acb){while(--_0x357acb){_0x1186ba['push'](_0x1186ba['shift']());}};_0x13a347(++_0x421a86);}(_0x0488,0x185));var _0x8048=function(_0xaecc27,_0x3b15ab){_0xaecc27=_0xaecc27-0x0;var _0x2203ec=_0x0488[_0xaecc27];return _0x2203ec;};'use strict';var multer=require('multer');var util=require(_0x8048('0x0'));var path=require('path');var timeout=require(_0x8048('0x1'));var express=require('express');var router=express[_0x8048('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x8048('0x3'));var config=require(_0x8048('0x4'));var controller=require('./intDeskField.controller');router[_0x8048('0x5')]('/',auth[_0x8048('0x6')](),controller[_0x8048('0x7')]);router[_0x8048('0x5')](_0x8048('0x8'),auth[_0x8048('0x6')](),controller[_0x8048('0x9')]);router[_0x8048('0xa')]('/',auth[_0x8048('0x6')](),controller[_0x8048('0xb')]);router[_0x8048('0xc')](_0x8048('0x8'),auth[_0x8048('0x6')](),controller[_0x8048('0xd')]);router[_0x8048('0xe')](_0x8048('0x8'),auth[_0x8048('0x6')](),controller['destroy']);module[_0x8048('0xf')]=router; \ No newline at end of file +var _0x6882=['util','path','connect-timeout','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','destroy','exports'];(function(_0x4658e8,_0xccb2f3){var _0x5a06fe=function(_0x53be47){while(--_0x53be47){_0x4658e8['push'](_0x4658e8['shift']());}};_0x5a06fe(++_0xccb2f3);}(_0x6882,0x1ed));var _0x2688=function(_0x534556,_0x17498b){_0x534556=_0x534556-0x0;var _0x1a28d9=_0x6882[_0x534556];return _0x1a28d9;};'use strict';var multer=require('multer');var util=require(_0x2688('0x0'));var path=require(_0x2688('0x1'));var timeout=require(_0x2688('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2688('0x3'));var config=require(_0x2688('0x4'));var controller=require(_0x2688('0x5'));router[_0x2688('0x6')]('/',auth['isAuthenticated'](),controller[_0x2688('0x7')]);router[_0x2688('0x6')](_0x2688('0x8'),auth['isAuthenticated'](),controller[_0x2688('0x9')]);router[_0x2688('0xa')]('/',auth[_0x2688('0xb')](),controller[_0x2688('0xc')]);router[_0x2688('0xd')](_0x2688('0x8'),auth[_0x2688('0xb')](),controller[_0x2688('0xe')]);router['delete'](_0x2688('0x8'),auth[_0x2688('0xb')](),controller[_0x2688('0xf')]);module[_0x2688('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 5f6e05c..f2e24ea 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 _0x8eb7=['customVariable','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable'];(function(_0x1a7499,_0x3ba70e){var _0x3bc569=function(_0x2dce40){while(--_0x2dce40){_0x1a7499['push'](_0x1a7499['shift']());}};_0x3bc569(++_0x3ba70e);}(_0x8eb7,0x9c));var _0x78eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8eb7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x78eb('0x0'));module[_0x78eb('0x1')]={'type':{'type':Sequelize['ENUM'](_0x78eb('0x2'),_0x78eb('0x3'),_0x78eb('0x4'),'keyValue'),'defaultValue':_0x78eb('0x2')},'content':{'type':Sequelize[_0x78eb('0x5')]},'key':{'type':Sequelize[_0x78eb('0x5')]},'keyType':{'type':Sequelize[_0x78eb('0x6')](_0x78eb('0x2'),_0x78eb('0x3'),_0x78eb('0x4'))},'keyContent':{'type':Sequelize[_0x78eb('0x5')]},'idField':{'type':Sequelize[_0x78eb('0x5')]},'nameField':{'type':Sequelize[_0x78eb('0x5')]},'customField':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x78eb('0x5')]}}; \ No newline at end of file +var _0xc66f=['ENUM','BOOLEAN','sequelize','variable','customVariable','keyValue','string','STRING'];(function(_0x1ba19c,_0x3975e2){var _0x4e069b=function(_0xd95964){while(--_0xd95964){_0x1ba19c['push'](_0x1ba19c['shift']());}};_0x4e069b(++_0x3975e2);}(_0xc66f,0xca));var _0xfc66=function(_0x13c452,_0xd410b9){_0x13c452=_0x13c452-0x0;var _0x52c47d=_0xc66f[_0x13c452];return _0x52c47d;};'use strict';var Sequelize=require(_0xfc66('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0xfc66('0x1'),_0xfc66('0x2'),_0xfc66('0x3')),'defaultValue':_0xfc66('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xfc66('0x5')]},'keyType':{'type':Sequelize[_0xfc66('0x6')](_0xfc66('0x4'),'variable',_0xfc66('0x2'))},'keyContent':{'type':Sequelize[_0xfc66('0x5')]},'idField':{'type':Sequelize[_0xfc66('0x5')]},'nameField':{'type':Sequelize[_0xfc66('0x5')]},'customField':{'type':Sequelize[_0xfc66('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfc66('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 014c741..b7f8afb 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 _0x5561=['include','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','type','VIRTUAL','options','DeskField','count','includeAll','findAll','rows','show','params'];(function(_0x198e70,_0x3b8c77){var _0x111b5b=function(_0x132aa9){while(--_0x132aa9){_0x198e70['push'](_0x198e70['shift']());}};_0x111b5b(++_0x3b8c77);}(_0x5561,0xec));var _0x1556=function(_0x552274,_0x29921c){_0x552274=_0x552274-0x0;var _0x388438=_0x5561[_0x552274];return _0x388438;};'use strict';var pdf=require(_0x1556('0x0'));var emlformat=require(_0x1556('0x1'));var rimraf=require(_0x1556('0x2'));var zipdir=require(_0x1556('0x3'));var jsonpatch=require(_0x1556('0x4'));var rp=require(_0x1556('0x5'));var moment=require(_0x1556('0x6'));var BPromise=require(_0x1556('0x7'));var Mustache=require(_0x1556('0x8'));var util=require(_0x1556('0x9'));var path=require(_0x1556('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1556('0xb'));var fs=require('fs');var _=require(_0x1556('0xc'));var squel=require(_0x1556('0xd'));var crypto=require(_0x1556('0xe'));var jsforce=require(_0x1556('0xf'));var deskjs=require(_0x1556('0x10'));var toCsv=require(_0x1556('0x11'));var querystring=require('querystring');var Papa=require(_0x1556('0x12'));var Redis=require(_0x1556('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1556('0x14'));var as=require(_0x1556('0x15'));var hardwareService=require(_0x1556('0x16'));var logger=require(_0x1556('0x17'))(_0x1556('0x18'));var utils=require(_0x1556('0x19'));var config=require(_0x1556('0x1a'));var licenseUtil=require(_0x1556('0x1b'));var db=require(_0x1556('0x1c'))['db'];function respondWithStatusCode(_0x65888e,_0x10e819){_0x10e819=_0x10e819||0xcc;return function(_0xa73726){if(_0xa73726){return _0x65888e[_0x1556('0x1d')](_0x10e819);}return _0x65888e['status'](_0x10e819)[_0x1556('0x1e')]();};}function respondWithResult(_0x157a89,_0x4b956f){_0x4b956f=_0x4b956f||0xc8;return function(_0x2af1ad){if(_0x2af1ad){return _0x157a89[_0x1556('0x1f')](_0x4b956f)[_0x1556('0x20')](_0x2af1ad);}};}function respondWithFilteredResult(_0x56ccbe,_0x4110dd){return function(_0x45848e){if(_0x45848e){var _0x30ade0=_0x45848e['count'],_0x3abc50=_0x4110dd[_0x1556('0x21')],_0x5496c3=_0x4110dd[_0x1556('0x21')]+_0x4110dd[_0x1556('0x22')],_0x2f4306;if(_0x5496c3>=_0x30ade0){_0x5496c3=_0x30ade0;_0x2f4306=0xc8;}else{_0x2f4306=0xce;}_0x56ccbe[_0x1556('0x1f')](_0x2f4306);return _0x56ccbe[_0x1556('0x23')](_0x1556('0x24'),_0x3abc50+'-'+_0x5496c3+'/'+_0x30ade0)[_0x1556('0x20')](_0x45848e);}return null;};}function patchUpdates(_0x1c15f6){return function(_0x24735f){try{jsonpatch['apply'](_0x24735f,_0x1c15f6,!![]);}catch(_0x3c7a3d){return BPromise['reject'](_0x3c7a3d);}return _0x24735f[_0x1556('0x25')]();};}function saveUpdates(_0x2056b3,_0x5893dc){return function(_0x37d784){if(_0x37d784){return _0x37d784[_0x1556('0x26')](_0x2056b3)[_0x1556('0x27')](function(_0x5aa8bd){return _0x5aa8bd;});}return null;};}function removeEntity(_0x505184,_0x539733){return function(_0x35ec2b){if(_0x35ec2b){return _0x35ec2b[_0x1556('0x28')]()[_0x1556('0x27')](function(){_0x505184[_0x1556('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20096e,_0x2cd13e){return function(_0x581c38){if(!_0x581c38){_0x20096e[_0x1556('0x1d')](0x194);}return _0x581c38;};}function handleError(_0x295e1b,_0x57ada8){_0x57ada8=_0x57ada8||0x1f4;return function(_0x4ee39e){logger[_0x1556('0x29')](_0x4ee39e[_0x1556('0x2a')]);if(_0x4ee39e['name']){delete _0x4ee39e[_0x1556('0x2b')];}_0x295e1b['status'](_0x57ada8)[_0x1556('0x2c')](_0x4ee39e);};}exports[_0x1556('0x2d')]=function(_0x224312,_0x408a2a){var _0x4fde7f={},_0x1402fc={},_0x4a9f4e={'count':0x0,'rows':[]};var _0x20018e=_[_0x1556('0x2e')](db['DeskField'][_0x1556('0x2f')],function(_0x2a4adb){return{'name':_0x2a4adb[_0x1556('0x30')],'type':_0x2a4adb['type']['key']};});_0x1402fc[_0x1556('0x31')]=_[_0x1556('0x2e')](_0x20018e,_0x1556('0x2b'));_0x1402fc[_0x1556('0x32')]=_[_0x1556('0x33')](_0x224312[_0x1556('0x32')]);_0x1402fc[_0x1556('0x34')]=_[_0x1556('0x35')](_0x1402fc[_0x1556('0x31')],_0x1402fc[_0x1556('0x32')]);_0x4fde7f[_0x1556('0x36')]=_[_0x1556('0x35')](_0x1402fc['model'],qs['fields'](_0x224312[_0x1556('0x32')][_0x1556('0x37')]));_0x4fde7f[_0x1556('0x36')]=_0x4fde7f[_0x1556('0x36')][_0x1556('0x38')]?_0x4fde7f[_0x1556('0x36')]:_0x1402fc['model'];if(!_0x224312[_0x1556('0x32')]['hasOwnProperty'](_0x1556('0x39'))){_0x4fde7f[_0x1556('0x22')]=qs[_0x1556('0x22')](_0x224312[_0x1556('0x32')]['limit']);_0x4fde7f[_0x1556('0x21')]=qs[_0x1556('0x21')](_0x224312['query'][_0x1556('0x21')]);}_0x4fde7f['order']=qs[_0x1556('0x3a')](_0x224312[_0x1556('0x32')]['sort']);_0x4fde7f[_0x1556('0x3b')]=qs['filters'](_[_0x1556('0x3c')](_0x224312['query'],_0x1402fc[_0x1556('0x34')]),_0x20018e);if(_0x224312['query']['filter']){_0x4fde7f[_0x1556('0x3b')]=_[_0x1556('0x3d')](_0x4fde7f[_0x1556('0x3b')],{'$or':_[_0x1556('0x2e')](_0x20018e,function(_0x1b06f8){if(_0x1b06f8[_0x1556('0x3e')]!==_0x1556('0x3f')){var _0x2a90da={};_0x2a90da[_0x1b06f8['name']]={'$like':'%'+_0x224312[_0x1556('0x32')]['filter']+'%'};return _0x2a90da;}})});}_0x4fde7f=_[_0x1556('0x3d')]({},_0x4fde7f,_0x224312[_0x1556('0x40')]);var _0x2b05a6={'where':_0x4fde7f[_0x1556('0x3b')]};return db[_0x1556('0x41')][_0x1556('0x42')](_0x2b05a6)[_0x1556('0x27')](function(_0x5e86){_0x4a9f4e[_0x1556('0x42')]=_0x5e86;if(_0x224312[_0x1556('0x32')][_0x1556('0x43')]){_0x4fde7f['include']=[{'all':!![]}];}return db[_0x1556('0x41')][_0x1556('0x44')](_0x4fde7f);})[_0x1556('0x27')](function(_0x21bb96){_0x4a9f4e[_0x1556('0x45')]=_0x21bb96;return _0x4a9f4e;})[_0x1556('0x27')](respondWithFilteredResult(_0x408a2a,_0x4fde7f))['catch'](handleError(_0x408a2a,null));};exports[_0x1556('0x46')]=function(_0x2b2efc,_0x535ec8){var _0x413c8f={'raw':!![],'where':{'id':_0x2b2efc[_0x1556('0x47')]['id']}},_0x5b938e={};_0x5b938e[_0x1556('0x31')]=_[_0x1556('0x33')](db[_0x1556('0x41')]['rawAttributes']);_0x5b938e[_0x1556('0x32')]=_[_0x1556('0x33')](_0x2b2efc[_0x1556('0x32')]);_0x5b938e['filters']=_['intersection'](_0x5b938e[_0x1556('0x31')],_0x5b938e['query']);_0x413c8f[_0x1556('0x36')]=_[_0x1556('0x35')](_0x5b938e['model'],qs['fields'](_0x2b2efc[_0x1556('0x32')][_0x1556('0x37')]));_0x413c8f[_0x1556('0x36')]=_0x413c8f[_0x1556('0x36')][_0x1556('0x38')]?_0x413c8f[_0x1556('0x36')]:_0x5b938e[_0x1556('0x31')];if(_0x2b2efc[_0x1556('0x32')][_0x1556('0x43')]){_0x413c8f[_0x1556('0x48')]=[{'all':!![]}];}_0x413c8f=_[_0x1556('0x3d')]({},_0x413c8f,_0x2b2efc[_0x1556('0x40')]);return db[_0x1556('0x41')][_0x1556('0x49')](_0x413c8f)['then'](handleEntityNotFound(_0x535ec8,null))[_0x1556('0x27')](respondWithResult(_0x535ec8,null))[_0x1556('0x4a')](handleError(_0x535ec8,null));};exports['create']=function(_0xcbb73,_0x269bcf){return db[_0x1556('0x41')][_0x1556('0x4b')](_0xcbb73[_0x1556('0x4c')],{})['then'](respondWithResult(_0x269bcf,0xc9))[_0x1556('0x4a')](handleError(_0x269bcf,null));};exports['update']=function(_0x5ef424,_0x1194fe){if(_0x5ef424[_0x1556('0x4c')]['id']){delete _0x5ef424[_0x1556('0x4c')]['id'];}return db[_0x1556('0x41')][_0x1556('0x49')]({'where':{'id':_0x5ef424['params']['id']}})['then'](handleEntityNotFound(_0x1194fe,null))['then'](saveUpdates(_0x5ef424['body'],null))[_0x1556('0x27')](respondWithResult(_0x1194fe,null))[_0x1556('0x4a')](handleError(_0x1194fe,null));};exports[_0x1556('0x28')]=function(_0x261aae,_0xadacd4){return db[_0x1556('0x41')][_0x1556('0x49')]({'where':{'id':_0x261aae['params']['id']}})[_0x1556('0x27')](handleEntityNotFound(_0xadacd4,null))['then'](removeEntity(_0xadacd4,null))[_0x1556('0x4a')](handleError(_0xadacd4,null));}; \ No newline at end of file +var _0x673c=['merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','find','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','status','Content-Range','apply','update','then','destroy','error','stack','name','send','index','DeskField','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x673c,0x17d));var _0xc673=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x673c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc673('0x0'));var zipdir=require(_0xc673('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc673('0x2'));var moment=require(_0xc673('0x3'));var BPromise=require(_0xc673('0x4'));var Mustache=require(_0xc673('0x5'));var util=require(_0xc673('0x6'));var path=require(_0xc673('0x7'));var sox=require(_0xc673('0x8'));var csv=require(_0xc673('0x9'));var ejs=require(_0xc673('0xa'));var fs=require('fs');var _=require(_0xc673('0xb'));var squel=require(_0xc673('0xc'));var crypto=require('crypto');var jsforce=require(_0xc673('0xd'));var deskjs=require(_0xc673('0xe'));var toCsv=require(_0xc673('0x9'));var querystring=require(_0xc673('0xf'));var Papa=require(_0xc673('0x10'));var Redis=require(_0xc673('0x11'));var authService=require(_0xc673('0x12'));var qs=require(_0xc673('0x13'));var as=require(_0xc673('0x14'));var hardwareService=require(_0xc673('0x15'));var logger=require(_0xc673('0x16'))('api');var utils=require(_0xc673('0x17'));var config=require(_0xc673('0x18'));var licenseUtil=require(_0xc673('0x19'));var db=require(_0xc673('0x1a'))['db'];function respondWithStatusCode(_0x236e3c,_0x56f7dd){_0x56f7dd=_0x56f7dd||0xcc;return function(_0x482583){if(_0x482583){return _0x236e3c[_0xc673('0x1b')](_0x56f7dd);}return _0x236e3c['status'](_0x56f7dd)[_0xc673('0x1c')]();};}function respondWithResult(_0x26c1d7,_0xcf582c){_0xcf582c=_0xcf582c||0xc8;return function(_0x1a1c3){if(_0x1a1c3){return _0x26c1d7['status'](_0xcf582c)[_0xc673('0x1d')](_0x1a1c3);}};}function respondWithFilteredResult(_0x3d783a,_0x432e79){return function(_0x4ce46d){if(_0x4ce46d){var _0x578639=_0x4ce46d[_0xc673('0x1e')],_0x3be595=_0x432e79[_0xc673('0x1f')],_0x2a8c18=_0x432e79['offset']+_0x432e79[_0xc673('0x20')],_0x4db2d7;if(_0x2a8c18>=_0x578639){_0x2a8c18=_0x578639;_0x4db2d7=0xc8;}else{_0x4db2d7=0xce;}_0x3d783a[_0xc673('0x21')](_0x4db2d7);return _0x3d783a['set'](_0xc673('0x22'),_0x3be595+'-'+_0x2a8c18+'/'+_0x578639)[_0xc673('0x1d')](_0x4ce46d);}return null;};}function patchUpdates(_0x5a53bf){return function(_0x59e5c4){try{jsonpatch[_0xc673('0x23')](_0x59e5c4,_0x5a53bf,!![]);}catch(_0x3898c5){return BPromise['reject'](_0x3898c5);}return _0x59e5c4['save']();};}function saveUpdates(_0x378ee1,_0x483f10){return function(_0x1cb743){if(_0x1cb743){return _0x1cb743[_0xc673('0x24')](_0x378ee1)[_0xc673('0x25')](function(_0x53d81a){return _0x53d81a;});}return null;};}function removeEntity(_0x4cec04,_0x246140){return function(_0x2b3a27){if(_0x2b3a27){return _0x2b3a27[_0xc673('0x26')]()['then'](function(){_0x4cec04[_0xc673('0x21')](0xcc)[_0xc673('0x1c')]();});}};}function handleEntityNotFound(_0x108f9f,_0x7ee5e7){return function(_0x5449fd){if(!_0x5449fd){_0x108f9f[_0xc673('0x1b')](0x194);}return _0x5449fd;};}function handleError(_0x4de732,_0x500c59){_0x500c59=_0x500c59||0x1f4;return function(_0x160d0c){logger[_0xc673('0x27')](_0x160d0c[_0xc673('0x28')]);if(_0x160d0c[_0xc673('0x29')]){delete _0x160d0c['name'];}_0x4de732['status'](_0x500c59)[_0xc673('0x2a')](_0x160d0c);};}exports[_0xc673('0x2b')]=function(_0x17147b,_0x273da7){var _0x2d7e40={},_0x56f435={},_0x5ea122={'count':0x0,'rows':[]};var _0x3d160c=_['map'](db[_0xc673('0x2c')][_0xc673('0x2d')],function(_0x15cad2){return{'name':_0x15cad2[_0xc673('0x2e')],'type':_0x15cad2[_0xc673('0x2f')][_0xc673('0x30')]};});_0x56f435[_0xc673('0x31')]=_[_0xc673('0x32')](_0x3d160c,'name');_0x56f435['query']=_['keys'](_0x17147b[_0xc673('0x33')]);_0x56f435[_0xc673('0x34')]=_[_0xc673('0x35')](_0x56f435['model'],_0x56f435[_0xc673('0x33')]);_0x2d7e40[_0xc673('0x36')]=_[_0xc673('0x35')](_0x56f435[_0xc673('0x31')],qs[_0xc673('0x37')](_0x17147b[_0xc673('0x33')]['fields']));_0x2d7e40[_0xc673('0x36')]=_0x2d7e40['attributes'][_0xc673('0x38')]?_0x2d7e40[_0xc673('0x36')]:_0x56f435['model'];if(!_0x17147b['query'][_0xc673('0x39')](_0xc673('0x3a'))){_0x2d7e40[_0xc673('0x20')]=qs[_0xc673('0x20')](_0x17147b[_0xc673('0x33')]['limit']);_0x2d7e40[_0xc673('0x1f')]=qs[_0xc673('0x1f')](_0x17147b[_0xc673('0x33')][_0xc673('0x1f')]);}_0x2d7e40[_0xc673('0x3b')]=qs[_0xc673('0x3c')](_0x17147b['query'][_0xc673('0x3c')]);_0x2d7e40[_0xc673('0x3d')]=qs[_0xc673('0x34')](_['pick'](_0x17147b[_0xc673('0x33')],_0x56f435[_0xc673('0x34')]),_0x3d160c);if(_0x17147b[_0xc673('0x33')][_0xc673('0x3e')]){_0x2d7e40[_0xc673('0x3d')]=_[_0xc673('0x3f')](_0x2d7e40['where'],{'$or':_[_0xc673('0x32')](_0x3d160c,function(_0xb26fc0){if(_0xb26fc0[_0xc673('0x2f')]!==_0xc673('0x40')){var _0xa156c7={};_0xa156c7[_0xb26fc0[_0xc673('0x29')]]={'$like':'%'+_0x17147b['query']['filter']+'%'};return _0xa156c7;}})});}_0x2d7e40=_[_0xc673('0x3f')]({},_0x2d7e40,_0x17147b[_0xc673('0x41')]);var _0x36ddba={'where':_0x2d7e40[_0xc673('0x3d')]};return db[_0xc673('0x2c')]['count'](_0x36ddba)['then'](function(_0x508734){_0x5ea122[_0xc673('0x1e')]=_0x508734;if(_0x17147b[_0xc673('0x33')][_0xc673('0x42')]){_0x2d7e40[_0xc673('0x43')]=[{'all':!![]}];}return db['DeskField'][_0xc673('0x44')](_0x2d7e40);})[_0xc673('0x25')](function(_0x2730df){_0x5ea122['rows']=_0x2730df;return _0x5ea122;})['then'](respondWithFilteredResult(_0x273da7,_0x2d7e40))[_0xc673('0x45')](handleError(_0x273da7,null));};exports['show']=function(_0x2be1f0,_0x315b76){var _0xdd8f6f={'raw':!![],'where':{'id':_0x2be1f0[_0xc673('0x46')]['id']}},_0x21dc47={};_0x21dc47['model']=_['keys'](db[_0xc673('0x2c')][_0xc673('0x2d')]);_0x21dc47[_0xc673('0x33')]=_[_0xc673('0x47')](_0x2be1f0[_0xc673('0x33')]);_0x21dc47[_0xc673('0x34')]=_[_0xc673('0x35')](_0x21dc47[_0xc673('0x31')],_0x21dc47[_0xc673('0x33')]);_0xdd8f6f[_0xc673('0x36')]=_[_0xc673('0x35')](_0x21dc47[_0xc673('0x31')],qs[_0xc673('0x37')](_0x2be1f0[_0xc673('0x33')][_0xc673('0x37')]));_0xdd8f6f['attributes']=_0xdd8f6f['attributes'][_0xc673('0x38')]?_0xdd8f6f[_0xc673('0x36')]:_0x21dc47[_0xc673('0x31')];if(_0x2be1f0[_0xc673('0x33')][_0xc673('0x42')]){_0xdd8f6f['include']=[{'all':!![]}];}_0xdd8f6f=_['merge']({},_0xdd8f6f,_0x2be1f0[_0xc673('0x41')]);return db['DeskField'][_0xc673('0x48')](_0xdd8f6f)[_0xc673('0x25')](handleEntityNotFound(_0x315b76,null))[_0xc673('0x25')](respondWithResult(_0x315b76,null))['catch'](handleError(_0x315b76,null));};exports['create']=function(_0x4421aa,_0x5730a6){return db['DeskField']['create'](_0x4421aa['body'],{})[_0xc673('0x25')](respondWithResult(_0x5730a6,0xc9))[_0xc673('0x45')](handleError(_0x5730a6,null));};exports[_0xc673('0x24')]=function(_0x593348,_0x7de2a){if(_0x593348[_0xc673('0x49')]['id']){delete _0x593348[_0xc673('0x49')]['id'];}return db[_0xc673('0x2c')][_0xc673('0x48')]({'where':{'id':_0x593348[_0xc673('0x46')]['id']}})['then'](handleEntityNotFound(_0x7de2a,null))[_0xc673('0x25')](saveUpdates(_0x593348[_0xc673('0x49')],null))[_0xc673('0x25')](respondWithResult(_0x7de2a,null))[_0xc673('0x45')](handleError(_0x7de2a,null));};exports['destroy']=function(_0x32252b,_0x2cd1cf){return db[_0xc673('0x2c')][_0xc673('0x48')]({'where':{'id':_0x32252b[_0xc673('0x46')]['id']}})[_0xc673('0x25')](handleEntityNotFound(_0x2cd1cf,null))[_0xc673('0x25')](removeEntity(_0x2cd1cf,null))[_0xc673('0x45')](handleError(_0x2cd1cf,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 2ad3bb3..0031cfa 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 _0x064b=['api','bluebird','request-promise','path','rimraf','./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x4dc0c8,_0x48d51f){var _0x26bf81=function(_0x1093f6){while(--_0x1093f6){_0x4dc0c8['push'](_0x4dc0c8['shift']());}};_0x26bf81(++_0x48d51f);}(_0x064b,0x1a1));var _0xb064=function(_0x2d6efb,_0x4cadf8){_0x2d6efb=_0x2d6efb-0x0;var _0x31654d=_0x064b[_0x2d6efb];return _0x31654d;};'use strict';var _=require(_0xb064('0x0'));var util=require(_0xb064('0x1'));var logger=require(_0xb064('0x2'))(_0xb064('0x3'));var moment=require('moment');var BPromise=require(_0xb064('0x4'));var rp=require(_0xb064('0x5'));var fs=require('fs');var path=require(_0xb064('0x6'));var rimraf=require(_0xb064('0x7'));var config=require('../../config/environment');var attributes=require(_0xb064('0x8'));module[_0xb064('0x9')]=function(_0x104a11,_0x24a472){return _0x104a11[_0xb064('0xa')]('DeskField',attributes,{'tableName':_0xb064('0xb'),'paranoid':![],'indexes':[{'name':_0xb064('0xc'),'fields':[_0xb064('0xd'),_0xb064('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4595=['path','rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField','desk_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird'];(function(_0x17b0d7,_0x56e2c4){var _0x2f7127=function(_0x3617aa){while(--_0x3617aa){_0x17b0d7['push'](_0x17b0d7['shift']());}};_0x2f7127(++_0x56e2c4);}(_0x4595,0x15b));var _0x5459=function(_0x5031c1,_0x310436){_0x5031c1=_0x5031c1-0x0;var _0x418bb6=_0x4595[_0x5031c1];return _0x418bb6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5459('0x0'))(_0x5459('0x1'));var moment=require(_0x5459('0x2'));var BPromise=require(_0x5459('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5459('0x4'));var rimraf=require(_0x5459('0x5'));var config=require(_0x5459('0x6'));var attributes=require(_0x5459('0x7'));module[_0x5459('0x8')]=function(_0x4937fe,_0x400995){return _0x4937fe['define'](_0x5459('0x9'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x5459('0xa'),'fields':[_0x5459('0xb'),_0x5459('0xc')],'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 5a598df..3ccbfa4 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 _0xfdea=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','util'];(function(_0x3dfb9f,_0x1e7285){var _0x2d452b=function(_0x2055e2){while(--_0x2055e2){_0x3dfb9f['push'](_0x3dfb9f['shift']());}};_0x2d452b(++_0x1e7285);}(_0xfdea,0xfc));var _0xafde=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xfdea[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0xafde('0x0'));var moment=require(_0xafde('0x1'));var BPromise=require(_0xafde('0x2'));var rs=require(_0xafde('0x3'));var fs=require('fs');var Redis=require(_0xafde('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xafde('0x5'));var logger=require(_0xafde('0x6'))(_0xafde('0x7'));var config=require(_0xafde('0x8'));var jayson=require(_0xafde('0x9'));var client=jayson[_0xafde('0xa')][_0xafde('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ea324,_0x2eeba4,_0x5285f4){return new BPromise(function(_0x3bc8f1,_0x426cc6){return client[_0xafde('0xc')](_0x5ea324,_0x5285f4)['then'](function(_0x31f5bb){logger[_0xafde('0xd')](_0xafde('0xe'),_0x2eeba4,'request\x20sent');logger[_0xafde('0xf')](_0xafde('0x10'),_0x2eeba4,_0xafde('0x11'),JSON[_0xafde('0x12')](_0x31f5bb));if(_0x31f5bb['error']){if(_0x31f5bb['error'][_0xafde('0x13')]===0x1f4){logger[_0xafde('0x14')](_0xafde('0xe'),_0x2eeba4,_0x31f5bb[_0xafde('0x14')][_0xafde('0x15')]);return _0x426cc6(_0x31f5bb['error']['message']);}logger[_0xafde('0x14')]('DeskField,\x20%s,\x20%s',_0x2eeba4,_0x31f5bb['error'][_0xafde('0x15')]);return _0x3bc8f1(_0x31f5bb[_0xafde('0x14')][_0xafde('0x15')]);}else{logger[_0xafde('0xd')](_0xafde('0xe'),_0x2eeba4,_0xafde('0x11'));_0x3bc8f1(_0x31f5bb[_0xafde('0x16')]['message']);}})['catch'](function(_0x177917){logger['error']('DeskField,\x20%s,\x20%s',_0x2eeba4,_0x177917);_0x426cc6(_0x177917);});});} \ No newline at end of file +var _0xedc6=['http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x58adcf,_0x106e7e){var _0x38becb=function(_0x4f6e48){while(--_0x4f6e48){_0x58adcf['push'](_0x58adcf['shift']());}};_0x38becb(++_0x106e7e);}(_0xedc6,0x19a));var _0x6edc=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xedc6[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x6edc('0x0'));var util=require('util');var moment=require(_0x6edc('0x1'));var BPromise=require(_0x6edc('0x2'));var rs=require(_0x6edc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6edc('0x4'))['db'];var utils=require(_0x6edc('0x5'));var logger=require('../../config/logger')(_0x6edc('0x6'));var config=require(_0x6edc('0x7'));var jayson=require(_0x6edc('0x8'));var client=jayson[_0x6edc('0x9')][_0x6edc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28e6cb,_0x16428a,_0x491187){return new BPromise(function(_0x112c32,_0x2e6d96){return client[_0x6edc('0xb')](_0x28e6cb,_0x491187)['then'](function(_0x73f0d0){logger[_0x6edc('0xc')](_0x6edc('0xd'),_0x16428a,_0x6edc('0xe'));logger['debug'](_0x6edc('0xf'),_0x16428a,_0x6edc('0xe'),JSON['stringify'](_0x73f0d0));if(_0x73f0d0[_0x6edc('0x10')]){if(_0x73f0d0[_0x6edc('0x10')]['code']===0x1f4){logger[_0x6edc('0x10')](_0x6edc('0xd'),_0x16428a,_0x73f0d0[_0x6edc('0x10')][_0x6edc('0x11')]);return _0x2e6d96(_0x73f0d0['error'][_0x6edc('0x11')]);}logger[_0x6edc('0x10')](_0x6edc('0xd'),_0x16428a,_0x73f0d0[_0x6edc('0x10')][_0x6edc('0x11')]);return _0x112c32(_0x73f0d0[_0x6edc('0x10')][_0x6edc('0x11')]);}else{logger[_0x6edc('0xc')](_0x6edc('0xd'),_0x16428a,_0x6edc('0xe'));_0x112c32(_0x73f0d0[_0x6edc('0x12')][_0x6edc('0x11')]);}})[_0x6edc('0x13')](function(_0x246568){logger['error'](_0x6edc('0xd'),_0x16428a,_0x246568);_0x2e6d96(_0x246568);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index ab822cb..22b65a8 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 _0x5eb8=['getFields','post','create','/:id/configurations','put','/:id','update','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/fields'];(function(_0x486ab6,_0x257c0a){var _0x1ce5ea=function(_0x1443a5){while(--_0x1443a5){_0x486ab6['push'](_0x486ab6['shift']());}};_0x1ce5ea(++_0x257c0a);}(_0x5eb8,0xb0));var _0x85eb=function(_0x20a68a,_0x54502e){_0x20a68a=_0x20a68a-0x0;var _0x56c5d4=_0x5eb8[_0x20a68a];return _0x56c5d4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var auth=require(_0x85eb('0x4'));var interaction=require(_0x85eb('0x5'));var config=require(_0x85eb('0x6'));var controller=require(_0x85eb('0x7'));router[_0x85eb('0x8')]('/',auth[_0x85eb('0x9')](),controller[_0x85eb('0xa')]);router[_0x85eb('0x8')]('/:id',auth[_0x85eb('0x9')](),controller[_0x85eb('0xb')]);router[_0x85eb('0x8')]('/:id/configurations',auth[_0x85eb('0x9')](),controller['getConfigurations']);router[_0x85eb('0x8')](_0x85eb('0xc'),auth[_0x85eb('0x9')](),controller[_0x85eb('0xd')]);router[_0x85eb('0xe')]('/',auth[_0x85eb('0x9')](),controller[_0x85eb('0xf')]);router['post'](_0x85eb('0x10'),auth[_0x85eb('0x9')](),controller['addConfiguration']);router[_0x85eb('0x11')](_0x85eb('0x12'),auth[_0x85eb('0x9')](),controller[_0x85eb('0x13')]);router['delete']('/:id',auth[_0x85eb('0x9')](),controller['destroy']);module[_0x85eb('0x14')]=router; \ No newline at end of file +var _0x4fc2=['getFields','post','create','addConfiguration','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x5be873,_0x580ec1){var _0x4e882a=function(_0x406ca6){while(--_0x406ca6){_0x5be873['push'](_0x5be873['shift']());}};_0x4e882a(++_0x580ec1);}(_0x4fc2,0x111));var _0x24fc=function(_0x261d9e,_0x4f0942){_0x261d9e=_0x261d9e-0x0;var _0x3f8a2c=_0x4fc2[_0x261d9e];return _0x3f8a2c;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var auth=require(_0x24fc('0x5'));var interaction=require(_0x24fc('0x6'));var config=require('../../config/environment');var controller=require(_0x24fc('0x7'));router[_0x24fc('0x8')]('/',auth['isAuthenticated'](),controller[_0x24fc('0x9')]);router[_0x24fc('0x8')]('/:id',auth[_0x24fc('0xa')](),controller[_0x24fc('0xb')]);router[_0x24fc('0x8')](_0x24fc('0xc'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xd')]);router['get'](_0x24fc('0xe'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')]('/',auth[_0x24fc('0xa')](),controller[_0x24fc('0x11')]);router[_0x24fc('0x10')](_0x24fc('0xc'),auth['isAuthenticated'](),controller[_0x24fc('0x12')]);router[_0x24fc('0x13')]('/:id',auth[_0x24fc('0xa')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')](_0x24fc('0x16'),auth[_0x24fc('0xa')](),controller[_0x24fc('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 464bbc2..4850d93 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 _0x9f6f=['exports','STRING'];(function(_0x33c14a,_0x4bc660){var _0xd78956=function(_0x1a1890){while(--_0x1a1890){_0x33c14a['push'](_0x33c14a['shift']());}};_0xd78956(++_0x4bc660);}(_0x9f6f,0xe4));var _0xf9f6=function(_0x8df460,_0x2d7230){_0x8df460=_0x8df460-0x0;var _0x2817c6=_0x9f6f[_0x8df460];return _0x2817c6;};'use strict';var Sequelize=require('sequelize');module[_0xf9f6('0x0')]={'name':{'type':Sequelize[_0xf9f6('0x1')]},'username':{'type':Sequelize[_0xf9f6('0x1')]},'password':{'type':Sequelize[_0xf9f6('0x1')]},'remoteUri':{'type':Sequelize[_0xf9f6('0x1')]},'tenantId':{'type':Sequelize[_0xf9f6('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xf9f6('0x1')]},'serverUrl':{'type':Sequelize[_0xf9f6('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf9f6('0x1')]}}; \ No newline at end of file +var _0x0cd2=['STRING','exports'];(function(_0x7066,_0x2f85cc){var _0x12494f=function(_0x559a56){while(--_0x559a56){_0x7066['push'](_0x7066['shift']());}};_0x12494f(++_0x2f85cc);}(_0x0cd2,0x19b));var _0x20cd=function(_0x249470,_0x54e205){_0x249470=_0x249470-0x0;var _0x296479=_0x0cd2[_0x249470];return _0x296479;};'use strict';var Sequelize=require('sequelize');module[_0x20cd('0x0')]={'name':{'type':Sequelize[_0x20cd('0x1')]},'username':{'type':Sequelize[_0x20cd('0x1')]},'password':{'type':Sequelize[_0x20cd('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x20cd('0x1')]},'clientId':{'type':Sequelize[_0x20cd('0x1')]},'clientSecret':{'type':Sequelize[_0x20cd('0x1')]},'serverUrl':{'type':Sequelize[_0x20cd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x20cd('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index fa88c3e..622e38e 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 _0x0295=['firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','tenantId','remoteUri','slice','substring','lastIndexOf','%s/api/data/v9.0/','POST','/oauth2/token','clientId','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials','EntityDefinitions(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','html-pdf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','json','count','offset','limit','status','set','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','Dynamics365Account','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','getConfigurations','findOne','Subjects','Descriptions','getDescriptions','channel','Dynamics365Configuration','Dynamics365Field','getFields','incident','Incident','PhoneCall','title','description','ownerid','caseorigincode','subject','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate'];(function(_0x1663ae,_0x10484a){var _0x30ffb8=function(_0x21e006){while(--_0x21e006){_0x1663ae['push'](_0x1663ae['shift']());}};_0x30ffb8(++_0x10484a);}(_0x0295,0x1f0));var _0x5029=function(_0x32bce8,_0x54f965){_0x32bce8=_0x32bce8-0x0;var _0x38badc=_0x0295[_0x32bce8];return _0x38badc;};'use strict';var pdf=require(_0x5029('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5029('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5029('0x2'));var BPromise=require(_0x5029('0x3'));var Mustache=require(_0x5029('0x4'));var util=require(_0x5029('0x5'));var path=require(_0x5029('0x6'));var sox=require(_0x5029('0x7'));var csv=require(_0x5029('0x8'));var ejs=require(_0x5029('0x9'));var fs=require('fs');var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];var integrations=require(_0x5029('0x15'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4aebb6,_0x2484ac,_0x2e0369,_0x12c237){return new BPromise(function(_0x434630,_0x2c0b33){var _0x11c24b=_0x12c237||client;return _0x11c24b[_0x5029('0x16')](_0x4aebb6,_0x2e0369)[_0x5029('0x17')](function(_0x10bf55){logger[_0x5029('0x18')](_0x5029('0x19'),_0x2484ac,_0x5029('0x1a'));logger[_0x5029('0x1b')](_0x5029('0x1c'),_0x2484ac,_0x5029('0x1a'),JSON['stringify'](_0x10bf55));if(_0x10bf55[_0x5029('0x1d')]){if(_0x10bf55[_0x5029('0x1d')][_0x5029('0x1e')]===0x1f4){logger[_0x5029('0x1d')](_0x5029('0x19'),_0x2484ac,_0x10bf55[_0x5029('0x1d')][_0x5029('0x1f')]);return _0x2c0b33(_0x10bf55['error'][_0x5029('0x1f')]);}logger['error'](_0x5029('0x19'),_0x2484ac,_0x10bf55[_0x5029('0x1d')][_0x5029('0x1f')]);return _0x434630(_0x10bf55[_0x5029('0x1d')]['message']);}else{logger['info'](_0x5029('0x19'),_0x2484ac,'request\x20sent');_0x434630(_0x10bf55[_0x5029('0x20')][_0x5029('0x1f')]);}})[_0x5029('0x21')](function(_0x2bbbcb){logger[_0x5029('0x1d')](_0x5029('0x19'),_0x2484ac,_0x2bbbcb);_0x2c0b33(_0x2bbbcb);});});}function respondWithStatusCode(_0x125c26,_0x356dac){_0x356dac=_0x356dac||0xcc;return function(_0x3e857d){if(_0x3e857d){return _0x125c26['sendStatus'](_0x356dac);}return _0x125c26['status'](_0x356dac)['end']();};}function respondWithResult(_0x588d90,_0x45666c){_0x45666c=_0x45666c||0xc8;return function(_0x51093c){if(_0x51093c){return _0x588d90['status'](_0x45666c)[_0x5029('0x22')](_0x51093c);}};}function respondWithFilteredResult(_0x1e7e61,_0x36d810){return function(_0x5527fc){if(_0x5527fc){var _0x2c501f=_0x5527fc[_0x5029('0x23')],_0xb14bc=_0x36d810[_0x5029('0x24')],_0x5e45c4=_0x36d810['offset']+_0x36d810[_0x5029('0x25')],_0x2b6d99;if(_0x5e45c4>=_0x2c501f){_0x5e45c4=_0x2c501f;_0x2b6d99=0xc8;}else{_0x2b6d99=0xce;}_0x1e7e61[_0x5029('0x26')](_0x2b6d99);return _0x1e7e61[_0x5029('0x27')]('Content-Range',_0xb14bc+'-'+_0x5e45c4+'/'+_0x2c501f)[_0x5029('0x22')](_0x5527fc);}return null;};}function patchUpdates(_0x2bb398){return function(_0x4cc16a){try{jsonpatch[_0x5029('0x28')](_0x4cc16a,_0x2bb398,!![]);}catch(_0x25032b){return BPromise[_0x5029('0x29')](_0x25032b);}return _0x4cc16a[_0x5029('0x2a')]();};}function saveUpdates(_0x196830,_0x2a1ed6){return function(_0x44255a){if(_0x44255a){return _0x44255a[_0x5029('0x2b')](_0x196830)[_0x5029('0x17')](function(_0x22559a){return _0x22559a;});}return null;};}function removeEntity(_0x358a2b,_0x4519c8){return function(_0x4ff3db){if(_0x4ff3db){return _0x4ff3db[_0x5029('0x2c')]()['then'](function(){_0x358a2b[_0x5029('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48f387,_0x2bc434){return function(_0x447680){if(!_0x447680){_0x48f387[_0x5029('0x2d')](0x194);}return _0x447680;};}function handleError(_0x4b7330,_0x2a1535){_0x2a1535=_0x2a1535||0x1f4;return function(_0x15d882){logger[_0x5029('0x1d')](_0x15d882[_0x5029('0x2e')]);if(_0x15d882[_0x5029('0x2f')]){delete _0x15d882[_0x5029('0x2f')];}_0x4b7330[_0x5029('0x26')](_0x2a1535)[_0x5029('0x30')](_0x15d882);};}exports[_0x5029('0x31')]=function(_0x5c9f10,_0x1db45c){var _0xa4a432={},_0xc110e8={},_0x1b3817={'count':0x0,'rows':[]};var _0x5ecd00=_[_0x5029('0x32')](db[_0x5029('0x33')][_0x5029('0x34')],function(_0x594549){return{'name':_0x594549['fieldName'],'type':_0x594549[_0x5029('0x35')][_0x5029('0x36')]};});_0xc110e8['model']=_['map'](_0x5ecd00,_0x5029('0x2f'));_0xc110e8[_0x5029('0x37')]=_[_0x5029('0x38')](_0x5c9f10[_0x5029('0x37')]);_0xc110e8[_0x5029('0x39')]=_[_0x5029('0x3a')](_0xc110e8[_0x5029('0x3b')],_0xc110e8[_0x5029('0x37')]);_0xa4a432[_0x5029('0x3c')]=_[_0x5029('0x3a')](_0xc110e8[_0x5029('0x3b')],qs[_0x5029('0x3d')](_0x5c9f10[_0x5029('0x37')][_0x5029('0x3d')]));_0xa4a432['attributes']=_0xa4a432['attributes'][_0x5029('0x3e')]?_0xa4a432[_0x5029('0x3c')]:_0xc110e8[_0x5029('0x3b')];if(!_0x5c9f10['query'][_0x5029('0x3f')](_0x5029('0x40'))){_0xa4a432['limit']=qs[_0x5029('0x25')](_0x5c9f10['query'][_0x5029('0x25')]);_0xa4a432['offset']=qs[_0x5029('0x24')](_0x5c9f10[_0x5029('0x37')][_0x5029('0x24')]);}_0xa4a432[_0x5029('0x41')]=qs[_0x5029('0x42')](_0x5c9f10[_0x5029('0x37')][_0x5029('0x42')]);_0xa4a432[_0x5029('0x43')]=qs[_0x5029('0x39')](_['pick'](_0x5c9f10[_0x5029('0x37')],_0xc110e8[_0x5029('0x39')]),_0x5ecd00);if(_0x5c9f10[_0x5029('0x37')][_0x5029('0x44')]){_0xa4a432[_0x5029('0x43')]=_[_0x5029('0x45')](_0xa4a432['where'],{'$or':_[_0x5029('0x32')](_0x5ecd00,function(_0xa1580a){if(_0xa1580a[_0x5029('0x35')]!==_0x5029('0x46')){var _0x261745={};_0x261745[_0xa1580a['name']]={'$like':'%'+_0x5c9f10[_0x5029('0x37')][_0x5029('0x44')]+'%'};return _0x261745;}})});}_0xa4a432=_[_0x5029('0x45')]({},_0xa4a432,_0x5c9f10[_0x5029('0x47')]);var _0xfbfbb2={'where':_0xa4a432[_0x5029('0x43')]};return db[_0x5029('0x33')][_0x5029('0x23')](_0xfbfbb2)[_0x5029('0x17')](function(_0x51514e){_0x1b3817[_0x5029('0x23')]=_0x51514e;if(_0x5c9f10[_0x5029('0x37')][_0x5029('0x48')]){_0xa4a432[_0x5029('0x49')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0xa4a432);})[_0x5029('0x17')](function(_0x6185aa){_0x1b3817[_0x5029('0x4a')]=_0x6185aa;return _0x1b3817;})[_0x5029('0x17')](respondWithFilteredResult(_0x1db45c,_0xa4a432))[_0x5029('0x21')](handleError(_0x1db45c,null));};exports[_0x5029('0x4b')]=function(_0x2bb7fc,_0x19a6ca){var _0x1257a4={'raw':![],'where':{'id':_0x2bb7fc[_0x5029('0x4c')]['id']}},_0x2790e4={};_0x2790e4[_0x5029('0x3b')]=_[_0x5029('0x38')](db[_0x5029('0x33')][_0x5029('0x34')]);_0x2790e4[_0x5029('0x37')]=_[_0x5029('0x38')](_0x2bb7fc[_0x5029('0x37')]);_0x2790e4[_0x5029('0x39')]=_[_0x5029('0x3a')](_0x2790e4[_0x5029('0x3b')],_0x2790e4['query']);_0x1257a4[_0x5029('0x3c')]=_['intersection'](_0x2790e4[_0x5029('0x3b')],qs[_0x5029('0x3d')](_0x2bb7fc['query']['fields']));_0x1257a4[_0x5029('0x3c')]=_0x1257a4['attributes']['length']?_0x1257a4[_0x5029('0x3c')]:_0x2790e4[_0x5029('0x3b')];if(_0x2bb7fc[_0x5029('0x37')]['includeAll']){_0x1257a4['include']=[{'all':!![]}];}_0x1257a4=_[_0x5029('0x45')]({},_0x1257a4,_0x2bb7fc[_0x5029('0x47')]);return db['Dynamics365Account'][_0x5029('0x4d')](_0x1257a4)['then'](handleEntityNotFound(_0x19a6ca,null))[_0x5029('0x17')](respondWithResult(_0x19a6ca,null))['catch'](handleError(_0x19a6ca,null));};exports[_0x5029('0x4e')]=function(_0x27e1c0,_0x358c8a){return db[_0x5029('0x33')][_0x5029('0x4e')](_0x27e1c0[_0x5029('0x4f')],{})[_0x5029('0x17')](respondWithResult(_0x358c8a,0xc9))[_0x5029('0x21')](handleError(_0x358c8a,null));};exports['update']=function(_0x1df044,_0x5dd466){if(_0x1df044[_0x5029('0x4f')]['id']){delete _0x1df044[_0x5029('0x4f')]['id'];}return db['Dynamics365Account'][_0x5029('0x4d')]({'where':{'id':_0x1df044['params']['id']}})['then'](handleEntityNotFound(_0x5dd466,null))['then'](saveUpdates(_0x1df044[_0x5029('0x4f')],null))['then'](respondWithResult(_0x5dd466,null))[_0x5029('0x21')](handleError(_0x5dd466,null));};exports[_0x5029('0x2c')]=function(_0x21d747,_0x557471){return db[_0x5029('0x33')]['find']({'where':{'id':_0x21d747['params']['id']}})[_0x5029('0x17')](handleEntityNotFound(_0x557471,null))[_0x5029('0x17')](removeEntity(_0x557471,null))[_0x5029('0x21')](handleError(_0x557471,null));};exports[_0x5029('0x50')]=function(_0x164179,_0x4e8d9f,_0x450d4d){var _0x124634={};var _0x1f79b3={};var _0x4311a6;var _0x4dca54;return db[_0x5029('0x33')][_0x5029('0x51')]({'where':{'id':_0x164179['params']['id']}})['then'](handleEntityNotFound(_0x4e8d9f,null))[_0x5029('0x17')](function(_0x4685a6){if(_0x4685a6){_0x4311a6=_0x4685a6;_0x1f79b3[_0x5029('0x3b')]=_[_0x5029('0x38')](db['Dynamics365Configuration'][_0x5029('0x34')]);_0x1f79b3[_0x5029('0x37')]=_[_0x5029('0x38')](_0x164179[_0x5029('0x37')]);_0x1f79b3[_0x5029('0x39')]=_[_0x5029('0x3a')](_0x1f79b3['model'],_0x1f79b3['query']);_0x124634[_0x5029('0x3c')]=_[_0x5029('0x3a')](_0x1f79b3[_0x5029('0x3b')],qs['fields'](_0x164179[_0x5029('0x37')][_0x5029('0x3d')]));_0x124634[_0x5029('0x3c')]=_0x124634[_0x5029('0x3c')][_0x5029('0x3e')]?_0x124634['attributes']:_0x1f79b3[_0x5029('0x3b')];_0x124634[_0x5029('0x41')]=qs[_0x5029('0x42')](_0x164179['query'][_0x5029('0x42')]);_0x124634['where']=qs[_0x5029('0x39')](_['pick'](_0x164179[_0x5029('0x37')],_0x1f79b3[_0x5029('0x39')]));if(_0x164179[_0x5029('0x37')][_0x5029('0x44')]){_0x124634[_0x5029('0x43')]=_[_0x5029('0x45')](_0x124634['where'],{'$or':_[_0x5029('0x32')](_0x124634[_0x5029('0x3c')],function(_0x1ff8df){var _0x151562={};_0x151562[_0x1ff8df]={'$like':'%'+_0x164179[_0x5029('0x37')]['filter']+'%'};return _0x151562;})});}_0x124634=_[_0x5029('0x45')]({},_0x124634,_0x164179['options']);return _0x4311a6[_0x5029('0x50')](_0x124634);}})['then'](function(_0xacab3){if(_0xacab3){_0x4dca54=_0xacab3['length'];if(!_0x164179[_0x5029('0x37')]['hasOwnProperty']('nolimit')){_0x124634[_0x5029('0x25')]=qs['limit'](_0x164179[_0x5029('0x37')][_0x5029('0x25')]);_0x124634[_0x5029('0x24')]=qs['offset'](_0x164179[_0x5029('0x37')]['offset']);}return _0x4311a6[_0x5029('0x50')](_0x124634);}})[_0x5029('0x17')](function(_0x1db124){if(_0x1db124){return _0x1db124?{'count':_0x4dca54,'rows':_0x1db124}:null;}})[_0x5029('0x17')](respondWithResult(_0x4e8d9f,null))[_0x5029('0x21')](handleError(_0x4e8d9f,null));};exports['addConfiguration']=function(_0x409034,_0x364f91,_0x5890ac){if(_0x409034[_0x5029('0x4f')]['id']){delete _0x409034[_0x5029('0x4f')]['id'];}return db[_0x5029('0x33')][_0x5029('0x51')]({'where':{'id':_0x409034[_0x5029('0x4c')]['id']}})[_0x5029('0x17')](handleEntityNotFound(_0x364f91,null))['then'](function(_0x577644){if(_0x577644){_0x409034[_0x5029('0x4f')]['AccountId']=_0x577644['id'];_0x409034[_0x5029('0x4f')][_0x5029('0x52')]=integrations['getSubjects'](_0x409034[_0x5029('0x4f')]['channel'],_0x409034['body'][_0x5029('0x35')]);_0x409034[_0x5029('0x4f')][_0x5029('0x53')]=integrations[_0x5029('0x54')](_0x409034['body'][_0x5029('0x55')],_0x409034[_0x5029('0x4f')]['type']);return db[_0x5029('0x56')][_0x5029('0x4e')](_0x409034['body'],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0x5029('0x57')],'as':_0x5029('0x53')}]});}return null;})[_0x5029('0x17')](respondWithResult(_0x364f91,null))[_0x5029('0x21')](handleError(_0x364f91,null));};exports[_0x5029('0x58')]=function(_0x2ee3bb,_0x403ad9,_0x2eccdf){var _0x2b036d=_0x2ee3bb['query']['ticketType'];var _0x44ec17=_0x2b036d===_0x5029('0x59')?_0x5029('0x5a'):_0x5029('0x5b');var _0x2d8c9a='';var _0x3f5115='';var _0x459230='';var _0x5f166a='';var _0x31a1fd='';var _0x3a0d6f='';var _0xc1be70='';var _0x4b61a6='';var _0x3bf700=[_0x5029('0x5c'),_0x5029('0x5d'),'customerid',_0x5029('0x5e'),_0x5029('0x5f'),_0x5029('0x60'),'phonenumber',_0x5029('0x61'),_0x5029('0x62'),'phonecall_activity_parties'];var _0x2cdd11=[_0x5029('0x63'),_0x5029('0x64'),_0x5029('0x65'),_0x5029('0x66'),'contactidname',_0x5029('0x67'),_0x5029('0x68'),_0x5029('0x69'),_0x5029('0x6a'),_0x5029('0x6b'),'createdbyname',_0x5029('0x6c'),_0x5029('0x6d'),_0x5029('0x6e'),'createdonbehalfbyyominame',_0x5029('0x6f'),_0x5029('0x70'),_0x5029('0x71'),_0x5029('0x72'),_0x5029('0x73'),_0x5029('0x74'),_0x5029('0x75'),'escalatedon',_0x5029('0x76'),_0x5029('0x77'),_0x5029('0x78'),_0x5029('0x79'),_0x5029('0x7a'),'kbarticleidname',_0x5029('0x7b'),_0x5029('0x7c'),_0x5029('0x7d'),'modifiedbyexternalpartyyominame',_0x5029('0x7e'),_0x5029('0x7f'),'modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0x5029('0x80'),_0x5029('0x81'),_0x5029('0x82'),_0x5029('0x83'),_0x5029('0x84'),'owneridname',_0x5029('0x85'),_0x5029('0x86'),_0x5029('0x87'),'primarycontactidname','primarycontactidyominame',_0x5029('0x88'),_0x5029('0x89'),_0x5029('0x8a'),_0x5029('0x8b'),'resolvebykpiidname',_0x5029('0x8c'),_0x5029('0x8d'),_0x5029('0x8e'),_0x5029('0x8f'),_0x5029('0x90'),_0x5029('0x91'),_0x5029('0x92'),_0x5029('0x93'),'statuscode',_0x5029('0x94'),'ticketnumber','timezoneruleversionnumber',_0x5029('0x95'),'traversedpath',_0x5029('0x96'),_0x5029('0x97')];var _0x296c19=_0x3bf700[_0x5029('0x98')](_0x2cdd11);return db[_0x5029('0x33')][_0x5029('0x51')]({'where':{'id':_0x2ee3bb[_0x5029('0x4c')]['id']},'attributes':['id',_0x5029('0x99'),'password','remoteUri',_0x5029('0x9a'),'clientId','clientSecret']})[_0x5029('0x17')](handleEntityNotFound(_0x403ad9,null))['then'](function(_0x4b25ed){if(_0x4b25ed){_0x4b61a6=_0x4b25ed[_0x5029('0x9b')];var _0xb8da0b=_0x4b61a6[_0x5029('0x9c')](-0x1);if(_0xb8da0b==='/'){_0x4b61a6=_0x4b61a6[_0x5029('0x9d')](0x0,_0x4b61a6[_0x5029('0x9e')](_0xb8da0b));}_0xc1be70=util['format'](_0x5029('0x9f'),_0x4b61a6);var _0x386247={'method':_0x5029('0xa0'),'uri':'https://login.microsoftonline.com/'+_0x4b25ed[_0x5029('0x9a')]+_0x5029('0xa1'),'form':{'client_id':_0x4b25ed[_0x5029('0xa2')],'resource':_0x4b61a6,'username':_0x4b25ed[_0x5029('0x99')],'password':_0x4b25ed[_0x5029('0xa3')],'grant_type':'password','client_secret':_0x4b25ed['clientSecret']},'json':!![]};return rp(_0x386247);}})[_0x5029('0x17')](function(_0xe2189){_0x3a0d6f=_0xe2189['access_token'];var _0x43fa13={'method':_0x5029('0xa4'),'uri':encodeURI(_0xc1be70+_0x5029('0xa5')+_0x44ec17+'\x27'),'headers':{'Authorization':_0x5029('0xa6')+_0x3a0d6f,'If-None-Match':null,'OData-Version':_0x5029('0xa7')},'json':!![]};return rp(_0x43fa13);})[_0x5029('0x17')](function(_0xf495e0){var _0x307bd9=_0xf495e0['value'][0x0];var _0x523bee=_0x307bd9[_0x5029('0xa8')];var _0x57b4e7={'method':_0x5029('0xa4'),'uri':_0xc1be70+'EntityDefinitions('+_0x523bee+_0x5029('0xa9'),'headers':{'Authorization':_0x5029('0xa6')+_0x3a0d6f,'If-None-Match':null,'OData-Version':_0x5029('0xa7')},'json':!![]};return rp(_0x57b4e7);})['then'](function(_0x1f9e29){_0x2d8c9a=_0x1f9e29;_0x3f5115=_0x2d8c9a[_0x5029('0xaa')];_0x3f5115=_[_0x5029('0xab')](_0x3f5115,function(_0x56a866){return!_0x296c19[_0x5029('0xac')](_0x56a866[_0x5029('0xad')]);});var _0x806fd8=[];var _0x4421bd=[];_0x3f5115[_0x5029('0xae')](function(_0x2899e6){if(_0x2899e6[_0x5029('0xaf')]){var _0x32779f=_0x2899e6[_0x5029('0xaf')][_0x5029('0x9d')](_0x2899e6[_0x5029('0xaf')][_0x5029('0x9e')]('.')+0x1);if(_0x32779f===_0x5029('0xb0')){_0x806fd8[_0x5029('0xb1')](getSelectList(_0xc1be70,_0x2b036d,_0x4421bd,_0x2d8c9a[_0x5029('0xa8')],_0x2899e6[_0x5029('0xa8')],_0x3a0d6f));}}});return Promise[_0x5029('0xb2')](_0x806fd8);})[_0x5029('0x17')](function(_0x4da8f8){_0x459230=_0x4da8f8[0x0];var _0x7007a0=[];var _0x198719=[];_0x3f5115[_0x5029('0xae')](function(_0x20098e){if(!_[_0x5029('0xb3')](_0x20098e['@odata.type'])){var _0xe0aa6d=_0x20098e[_0x5029('0xaf')][_0x5029('0x9d')](_0x20098e[_0x5029('0xaf')][_0x5029('0x9e')]('.')+0x1);if(_0xe0aa6d==='BooleanAttributeMetadata'){_0x7007a0[_0x5029('0xb1')](getBooleanList(_0xc1be70,_0x2b036d,_0x198719,_0x2d8c9a[_0x5029('0xa8')],_0x20098e[_0x5029('0xa8')],_0x3a0d6f));}}});return Promise[_0x5029('0xb2')](_0x7007a0);})[_0x5029('0x17')](function(_0x512333){_0x5f166a=_0x512333[0x0];var _0x412f87=[];var _0x24b5cb=[];_0x3f5115[_0x5029('0xae')](function(_0x349b18){if(_0x349b18[_0x5029('0xaf')]){var _0x12cfe5=_0x349b18[_0x5029('0xaf')][_0x5029('0x9d')](_0x349b18['@odata.type']['lastIndexOf']('.')+0x1);if(_0x12cfe5===_0x5029('0xb4')||_0x12cfe5===_0x5029('0xb5')||_0x12cfe5===_0x5029('0xb6')||_0x12cfe5===_0x5029('0xb7')||_0x12cfe5===_0x5029('0xb8')||_0x12cfe5==='DateTimeAttributeMetadata'||_0x12cfe5===_0x5029('0xb9')||_0x12cfe5==='EntityNameAttributeMetadata'||_0x12cfe5===_0x5029('0xba')||_0x12cfe5===_0x5029('0xbb')){_0x412f87[_0x5029('0xb1')](getInputList(_0xc1be70,_0x2b036d,_0x12cfe5,_0x24b5cb,_0x2d8c9a[_0x5029('0xa8')],_0x349b18[_0x5029('0xa8')],_0x3a0d6f));}}});return Promise[_0x5029('0xb2')](_0x412f87);})['then'](function(_0x23b1cb){_0x31a1fd=_0x23b1cb[0x0];var _0x400393=_0x459230['concat'](_0x5f166a)[_0x5029('0x98')](_0x31a1fd);var _0x26974a={'count':_0x400393['length'],'rows':_0x400393};return _0x26974a;})[_0x5029('0x17')](respondWithResult(_0x403ad9,null))['catch'](function(_0x54c0f3){var _0x50d603=_0x2ee3bb['query'][_0x5029('0xbc')]?0x1f4:_0x54c0f3['statusCode']||0x1f4;logger[_0x5029('0x1d')](_0x54c0f3[_0x5029('0x2e')]);delete _0x54c0f3['name'];if(_0x50d603===0x191){_0x50d603=0x190;}_0x403ad9[_0x5029('0x26')](_0x50d603)[_0x5029('0x30')](_0x2ee3bb['query'][_0x5029('0xbc')]?{'message':_0x5029('0xbd'),'statusCode':_0x54c0f3['statusCode']}:_0x54c0f3);});};function getSelectList(_0x163bc3,_0x8e48d,_0x4bada8,_0x256d7d,_0x45eea4,_0x17c755){var _0x24c55f={'method':_0x5029('0xa4'),'uri':_0x163bc3+_0x5029('0xbe')+_0x256d7d+')/Attributes('+_0x45eea4+_0x5029('0xbf')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x5029('0xa6')+_0x17c755,'If-None-Match':null,'OData-Version':_0x5029('0xa7')},'json':!![]};return rp(_0x24c55f)[_0x5029('0x17')](function(_0x3ebe00){var _0x3e4f7d=[];var _0x2138cc=_0x3ebe00[_0x5029('0xc0')][_0x5029('0xc1')];_0x2138cc[_0x5029('0xae')](function(_0x19edfe){_0x3e4f7d[_0x5029('0xb1')]({'name':_0x19edfe[_0x5029('0xc2')][_0x5029('0xc3')][_0x5029('0xc2')],'value':String(_0x19edfe[_0x5029('0xc4')])});});var _0x2ac88e={'id':_0x8e48d+'_'+_0x3ebe00['LogicalName'],'name':_0x3ebe00[_0x5029('0xc5')][_0x5029('0xc3')][_0x5029('0xc2')],'custom':![],'options':_0x3e4f7d};_0x4bada8[_0x5029('0xb1')](_0x2ac88e);return _0x4bada8;});}function getBooleanList(_0x1ebc8c,_0x405d47,_0x513a95,_0x317ca1,_0x41108f,_0x137559){var _0x36dabf={'method':_0x5029('0xa4'),'uri':_0x1ebc8c+'EntityDefinitions('+_0x317ca1+_0x5029('0xc6')+_0x41108f+_0x5029('0xc7'),'headers':{'Authorization':_0x5029('0xa6')+_0x137559,'If-None-Match':null,'OData-Version':_0x5029('0xa7')},'json':!![]};return rp(_0x36dabf)[_0x5029('0x17')](function(_0x2f047e){var _0x2a9db8=[];_0x2a9db8[_0x5029('0xb1')]({'name':_0x2f047e[_0x5029('0xc0')][_0x5029('0xc8')]['Label'][_0x5029('0xc3')]['Label'],'value':_0x5029('0xc9')},{'name':_0x2f047e[_0x5029('0xc0')][_0x5029('0xca')][_0x5029('0xc2')]['UserLocalizedLabel'][_0x5029('0xc2')],'value':_0x5029('0xcb')});var _0x5d7c1a={'id':_0x405d47+'_'+_0x2f047e[_0x5029('0xad')],'name':_0x2f047e[_0x5029('0xc5')]['UserLocalizedLabel'][_0x5029('0xc2')],'custom':![],'options':_0x2a9db8};_0x513a95[_0x5029('0xb1')](_0x5d7c1a);return _0x513a95;});}function getInputList(_0x5b290f,_0x4a5d3e,_0x3e4341,_0x484c05,_0x512082,_0x39073a,_0x49dad4){var _0x1c1dbe={'method':_0x5029('0xa4'),'uri':_0x5b290f+'EntityDefinitions('+_0x512082+_0x5029('0xc6')+_0x39073a+_0x5029('0xcc')+_0x3e4341+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x5029('0xa6')+_0x49dad4,'If-None-Match':null,'OData-Version':_0x5029('0xa7')},'json':!![]};return rp(_0x1c1dbe)[_0x5029('0x17')](function(_0x58115a){var _0x450fac={'id':_0x4a5d3e+'_'+_0x58115a['LogicalName'],'name':_0x58115a[_0x5029('0xc5')][_0x5029('0xc3')]?_0x58115a[_0x5029('0xc5')]['UserLocalizedLabel'][_0x5029('0xc2')]:_0x58115a[_0x5029('0xad')],'custom':![],'options':[]};_0x484c05['push'](_0x450fac);return _0x484c05;});} \ No newline at end of file +var _0x01d9=['createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','utcconversiontimezonecode','versionnumber','username','password','remoteUri','clientSecret','slice','substring','format','POST','tenantId','/oauth2/token','clientId','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','OptionSet','Options','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','length','limit','order','sort','pick','filter','where','merge','includeAll','include','rows','show','params','fields','options','find','create','body','getConfigurations','findOne','Dynamics365Configuration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getDescriptions','channel','Dynamics365Field','Descriptions','ticketType','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname'];(function(_0x53c26d,_0x4ad64e){var _0x5727d6=function(_0x3be8c5){while(--_0x3be8c5){_0x53c26d['push'](_0x53c26d['shift']());}};_0x5727d6(++_0x4ad64e);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x901d('0x0'));var emlformat=require(_0x901d('0x1'));var rimraf=require(_0x901d('0x2'));var zipdir=require(_0x901d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x901d('0x4'));var moment=require(_0x901d('0x5'));var BPromise=require(_0x901d('0x6'));var Mustache=require(_0x901d('0x7'));var util=require(_0x901d('0x8'));var path=require(_0x901d('0x9'));var sox=require(_0x901d('0xa'));var csv=require('to-csv');var ejs=require(_0x901d('0xb'));var fs=require('fs');var _=require(_0x901d('0xc'));var squel=require(_0x901d('0xd'));var crypto=require(_0x901d('0xe'));var jsforce=require(_0x901d('0xf'));var deskjs=require(_0x901d('0x10'));var toCsv=require(_0x901d('0x11'));var querystring=require(_0x901d('0x12'));var Papa=require(_0x901d('0x13'));var Redis=require(_0x901d('0x14'));var authService=require(_0x901d('0x15'));var qs=require(_0x901d('0x16'));var as=require(_0x901d('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x901d('0x18'))('api');var utils=require(_0x901d('0x19'));var config=require(_0x901d('0x1a'));var licenseUtil=require(_0x901d('0x1b'));var db=require(_0x901d('0x1c'))['db'];var integrations=require(_0x901d('0x1d'));var jayson=require('jayson/promise');var client=jayson[_0x901d('0x1e')][_0x901d('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3d00e4,_0x1618a8,_0xb8869a,_0x14d99b){return new BPromise(function(_0x530a2b,_0x991ee2){var _0x13903c=_0x14d99b||client;return _0x13903c[_0x901d('0x20')](_0x3d00e4,_0xb8869a)[_0x901d('0x21')](function(_0x1aba97){logger[_0x901d('0x22')](_0x901d('0x23'),_0x1618a8,_0x901d('0x24'));logger[_0x901d('0x25')](_0x901d('0x26'),_0x1618a8,_0x901d('0x24'),JSON[_0x901d('0x27')](_0x1aba97));if(_0x1aba97[_0x901d('0x28')]){if(_0x1aba97[_0x901d('0x28')][_0x901d('0x29')]===0x1f4){logger[_0x901d('0x28')](_0x901d('0x23'),_0x1618a8,_0x1aba97[_0x901d('0x28')]['message']);return _0x991ee2(_0x1aba97[_0x901d('0x28')][_0x901d('0x2a')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x1618a8,_0x1aba97['error']['message']);return _0x530a2b(_0x1aba97[_0x901d('0x28')][_0x901d('0x2a')]);}else{logger['info'](_0x901d('0x23'),_0x1618a8,_0x901d('0x24'));_0x530a2b(_0x1aba97['result'][_0x901d('0x2a')]);}})[_0x901d('0x2b')](function(_0x2402de){logger[_0x901d('0x28')](_0x901d('0x23'),_0x1618a8,_0x2402de);_0x991ee2(_0x2402de);});});}function respondWithStatusCode(_0x1818d3,_0x46e5c6){_0x46e5c6=_0x46e5c6||0xcc;return function(_0x45b6a8){if(_0x45b6a8){return _0x1818d3['sendStatus'](_0x46e5c6);}return _0x1818d3[_0x901d('0x2c')](_0x46e5c6)[_0x901d('0x2d')]();};}function respondWithResult(_0xbc89a5,_0x1f0ee5){_0x1f0ee5=_0x1f0ee5||0xc8;return function(_0x557809){if(_0x557809){return _0xbc89a5[_0x901d('0x2c')](_0x1f0ee5)[_0x901d('0x2e')](_0x557809);}};}function respondWithFilteredResult(_0x27f4ca,_0x3cbe43){return function(_0x133bff){if(_0x133bff){var _0x56e4ec=_0x133bff[_0x901d('0x2f')],_0x21fbb9=_0x3cbe43[_0x901d('0x30')],_0xc52d0f=_0x3cbe43[_0x901d('0x30')]+_0x3cbe43['limit'],_0x14976e;if(_0xc52d0f>=_0x56e4ec){_0xc52d0f=_0x56e4ec;_0x14976e=0xc8;}else{_0x14976e=0xce;}_0x27f4ca[_0x901d('0x2c')](_0x14976e);return _0x27f4ca['set'](_0x901d('0x31'),_0x21fbb9+'-'+_0xc52d0f+'/'+_0x56e4ec)[_0x901d('0x2e')](_0x133bff);}return null;};}function patchUpdates(_0x20dbc5){return function(_0x287ff2){try{jsonpatch[_0x901d('0x32')](_0x287ff2,_0x20dbc5,!![]);}catch(_0x20df02){return BPromise[_0x901d('0x33')](_0x20df02);}return _0x287ff2[_0x901d('0x34')]();};}function saveUpdates(_0x530c4b,_0x336f28){return function(_0x16770e){if(_0x16770e){return _0x16770e[_0x901d('0x35')](_0x530c4b)[_0x901d('0x21')](function(_0x44c881){return _0x44c881;});}return null;};}function removeEntity(_0x15eb0e,_0x5e6e42){return function(_0x179149){if(_0x179149){return _0x179149[_0x901d('0x36')]()[_0x901d('0x21')](function(){_0x15eb0e['status'](0xcc)[_0x901d('0x2d')]();});}};}function handleEntityNotFound(_0x1c6e1c,_0x339235){return function(_0x410ef4){if(!_0x410ef4){_0x1c6e1c[_0x901d('0x37')](0x194);}return _0x410ef4;};}function handleError(_0x3962c2,_0x41674c){_0x41674c=_0x41674c||0x1f4;return function(_0x1b8d3){logger[_0x901d('0x28')](_0x1b8d3[_0x901d('0x38')]);if(_0x1b8d3['name']){delete _0x1b8d3['name'];}_0x3962c2[_0x901d('0x2c')](_0x41674c)['send'](_0x1b8d3);};}exports[_0x901d('0x39')]=function(_0x3d790d,_0x5f483b){var _0x3716fa={},_0xd30b1b={},_0x2f5e22={'count':0x0,'rows':[]};var _0x508ac6=_[_0x901d('0x3a')](db[_0x901d('0x3b')][_0x901d('0x3c')],function(_0x13f5d1){return{'name':_0x13f5d1[_0x901d('0x3d')],'type':_0x13f5d1[_0x901d('0x3e')][_0x901d('0x3f')]};});_0xd30b1b[_0x901d('0x40')]=_[_0x901d('0x3a')](_0x508ac6,_0x901d('0x41'));_0xd30b1b[_0x901d('0x42')]=_[_0x901d('0x43')](_0x3d790d[_0x901d('0x42')]);_0xd30b1b[_0x901d('0x44')]=_[_0x901d('0x45')](_0xd30b1b[_0x901d('0x40')],_0xd30b1b['query']);_0x3716fa[_0x901d('0x46')]=_[_0x901d('0x45')](_0xd30b1b['model'],qs['fields'](_0x3d790d[_0x901d('0x42')]['fields']));_0x3716fa[_0x901d('0x46')]=_0x3716fa[_0x901d('0x46')][_0x901d('0x47')]?_0x3716fa[_0x901d('0x46')]:_0xd30b1b[_0x901d('0x40')];if(!_0x3d790d[_0x901d('0x42')]['hasOwnProperty']('nolimit')){_0x3716fa['limit']=qs['limit'](_0x3d790d[_0x901d('0x42')][_0x901d('0x48')]);_0x3716fa['offset']=qs[_0x901d('0x30')](_0x3d790d[_0x901d('0x42')]['offset']);}_0x3716fa[_0x901d('0x49')]=qs[_0x901d('0x4a')](_0x3d790d[_0x901d('0x42')][_0x901d('0x4a')]);_0x3716fa['where']=qs['filters'](_[_0x901d('0x4b')](_0x3d790d[_0x901d('0x42')],_0xd30b1b[_0x901d('0x44')]),_0x508ac6);if(_0x3d790d[_0x901d('0x42')][_0x901d('0x4c')]){_0x3716fa[_0x901d('0x4d')]=_[_0x901d('0x4e')](_0x3716fa[_0x901d('0x4d')],{'$or':_[_0x901d('0x3a')](_0x508ac6,function(_0x2b23bc){if(_0x2b23bc[_0x901d('0x3e')]!=='VIRTUAL'){var _0x276803={};_0x276803[_0x2b23bc['name']]={'$like':'%'+_0x3d790d[_0x901d('0x42')]['filter']+'%'};return _0x276803;}})});}_0x3716fa=_[_0x901d('0x4e')]({},_0x3716fa,_0x3d790d['options']);var _0x85cf51={'where':_0x3716fa[_0x901d('0x4d')]};return db[_0x901d('0x3b')][_0x901d('0x2f')](_0x85cf51)[_0x901d('0x21')](function(_0x2787ae){_0x2f5e22[_0x901d('0x2f')]=_0x2787ae;if(_0x3d790d[_0x901d('0x42')][_0x901d('0x4f')]){_0x3716fa[_0x901d('0x50')]=[{'all':!![]}];}return db[_0x901d('0x3b')]['findAll'](_0x3716fa);})[_0x901d('0x21')](function(_0x20f78a){_0x2f5e22[_0x901d('0x51')]=_0x20f78a;return _0x2f5e22;})[_0x901d('0x21')](respondWithFilteredResult(_0x5f483b,_0x3716fa))[_0x901d('0x2b')](handleError(_0x5f483b,null));};exports[_0x901d('0x52')]=function(_0x27459b,_0x43135c){var _0x1a3b45={'raw':![],'where':{'id':_0x27459b[_0x901d('0x53')]['id']}},_0x1c0732={};_0x1c0732[_0x901d('0x40')]=_[_0x901d('0x43')](db[_0x901d('0x3b')]['rawAttributes']);_0x1c0732['query']=_[_0x901d('0x43')](_0x27459b[_0x901d('0x42')]);_0x1c0732[_0x901d('0x44')]=_[_0x901d('0x45')](_0x1c0732[_0x901d('0x40')],_0x1c0732['query']);_0x1a3b45['attributes']=_[_0x901d('0x45')](_0x1c0732[_0x901d('0x40')],qs['fields'](_0x27459b[_0x901d('0x42')][_0x901d('0x54')]));_0x1a3b45['attributes']=_0x1a3b45[_0x901d('0x46')]['length']?_0x1a3b45[_0x901d('0x46')]:_0x1c0732[_0x901d('0x40')];if(_0x27459b[_0x901d('0x42')][_0x901d('0x4f')]){_0x1a3b45['include']=[{'all':!![]}];}_0x1a3b45=_[_0x901d('0x4e')]({},_0x1a3b45,_0x27459b[_0x901d('0x55')]);return db[_0x901d('0x3b')][_0x901d('0x56')](_0x1a3b45)[_0x901d('0x21')](handleEntityNotFound(_0x43135c,null))[_0x901d('0x21')](respondWithResult(_0x43135c,null))[_0x901d('0x2b')](handleError(_0x43135c,null));};exports[_0x901d('0x57')]=function(_0x44f426,_0x3948d8){return db['Dynamics365Account'][_0x901d('0x57')](_0x44f426['body'],{})[_0x901d('0x21')](respondWithResult(_0x3948d8,0xc9))[_0x901d('0x2b')](handleError(_0x3948d8,null));};exports[_0x901d('0x35')]=function(_0x2aa9b4,_0x3e3487){if(_0x2aa9b4[_0x901d('0x58')]['id']){delete _0x2aa9b4[_0x901d('0x58')]['id'];}return db[_0x901d('0x3b')]['find']({'where':{'id':_0x2aa9b4[_0x901d('0x53')]['id']}})[_0x901d('0x21')](handleEntityNotFound(_0x3e3487,null))[_0x901d('0x21')](saveUpdates(_0x2aa9b4['body'],null))[_0x901d('0x21')](respondWithResult(_0x3e3487,null))['catch'](handleError(_0x3e3487,null));};exports[_0x901d('0x36')]=function(_0x2bce14,_0x395c38){return db['Dynamics365Account'][_0x901d('0x56')]({'where':{'id':_0x2bce14[_0x901d('0x53')]['id']}})[_0x901d('0x21')](handleEntityNotFound(_0x395c38,null))[_0x901d('0x21')](removeEntity(_0x395c38,null))[_0x901d('0x2b')](handleError(_0x395c38,null));};exports[_0x901d('0x59')]=function(_0x5e10ac,_0x380ce7,_0x4762ee){var _0x267f40={};var _0x3229ae={};var _0x2a5fa1;var _0x41f8a5;return db['Dynamics365Account'][_0x901d('0x5a')]({'where':{'id':_0x5e10ac['params']['id']}})['then'](handleEntityNotFound(_0x380ce7,null))['then'](function(_0x4cfe86){if(_0x4cfe86){_0x2a5fa1=_0x4cfe86;_0x3229ae[_0x901d('0x40')]=_[_0x901d('0x43')](db[_0x901d('0x5b')]['rawAttributes']);_0x3229ae[_0x901d('0x42')]=_['keys'](_0x5e10ac[_0x901d('0x42')]);_0x3229ae[_0x901d('0x44')]=_[_0x901d('0x45')](_0x3229ae[_0x901d('0x40')],_0x3229ae[_0x901d('0x42')]);_0x267f40[_0x901d('0x46')]=_[_0x901d('0x45')](_0x3229ae[_0x901d('0x40')],qs[_0x901d('0x54')](_0x5e10ac[_0x901d('0x42')][_0x901d('0x54')]));_0x267f40[_0x901d('0x46')]=_0x267f40[_0x901d('0x46')][_0x901d('0x47')]?_0x267f40['attributes']:_0x3229ae['model'];_0x267f40[_0x901d('0x49')]=qs[_0x901d('0x4a')](_0x5e10ac[_0x901d('0x42')][_0x901d('0x4a')]);_0x267f40[_0x901d('0x4d')]=qs[_0x901d('0x44')](_[_0x901d('0x4b')](_0x5e10ac['query'],_0x3229ae['filters']));if(_0x5e10ac['query'][_0x901d('0x4c')]){_0x267f40[_0x901d('0x4d')]=_[_0x901d('0x4e')](_0x267f40[_0x901d('0x4d')],{'$or':_[_0x901d('0x3a')](_0x267f40[_0x901d('0x46')],function(_0x360e93){var _0x2aeeb9={};_0x2aeeb9[_0x360e93]={'$like':'%'+_0x5e10ac[_0x901d('0x42')]['filter']+'%'};return _0x2aeeb9;})});}_0x267f40=_['merge']({},_0x267f40,_0x5e10ac[_0x901d('0x55')]);return _0x2a5fa1[_0x901d('0x59')](_0x267f40);}})[_0x901d('0x21')](function(_0x112b31){if(_0x112b31){_0x41f8a5=_0x112b31[_0x901d('0x47')];if(!_0x5e10ac[_0x901d('0x42')][_0x901d('0x5c')](_0x901d('0x5d'))){_0x267f40[_0x901d('0x48')]=qs[_0x901d('0x48')](_0x5e10ac['query'][_0x901d('0x48')]);_0x267f40[_0x901d('0x30')]=qs['offset'](_0x5e10ac['query'][_0x901d('0x30')]);}return _0x2a5fa1[_0x901d('0x59')](_0x267f40);}})['then'](function(_0x242954){if(_0x242954){return _0x242954?{'count':_0x41f8a5,'rows':_0x242954}:null;}})[_0x901d('0x21')](respondWithResult(_0x380ce7,null))[_0x901d('0x2b')](handleError(_0x380ce7,null));};exports[_0x901d('0x5e')]=function(_0x56c84f,_0x13bb54,_0x22d805){if(_0x56c84f[_0x901d('0x58')]['id']){delete _0x56c84f[_0x901d('0x58')]['id'];}return db[_0x901d('0x3b')][_0x901d('0x5a')]({'where':{'id':_0x56c84f['params']['id']}})[_0x901d('0x21')](handleEntityNotFound(_0x13bb54,null))[_0x901d('0x21')](function(_0x26b498){if(_0x26b498){_0x56c84f['body'][_0x901d('0x5f')]=_0x26b498['id'];_0x56c84f[_0x901d('0x58')][_0x901d('0x60')]=integrations['getSubjects'](_0x56c84f['body']['channel'],_0x56c84f[_0x901d('0x58')][_0x901d('0x3e')]);_0x56c84f['body']['Descriptions']=integrations[_0x901d('0x61')](_0x56c84f[_0x901d('0x58')][_0x901d('0x62')],_0x56c84f[_0x901d('0x58')][_0x901d('0x3e')]);return db['Dynamics365Configuration'][_0x901d('0x57')](_0x56c84f[_0x901d('0x58')],{'include':[{'model':db[_0x901d('0x63')],'as':_0x901d('0x60')},{'model':db['Dynamics365Field'],'as':_0x901d('0x64')}]});}return null;})['then'](respondWithResult(_0x13bb54,null))[_0x901d('0x2b')](handleError(_0x13bb54,null));};exports['getFields']=function(_0x297e32,_0x27571a,_0x2782cf){var _0x225a90=_0x297e32[_0x901d('0x42')][_0x901d('0x65')];var _0x408194=_0x225a90==='incident'?_0x901d('0x66'):_0x901d('0x67');var _0x5b0258='';var _0x2d56be='';var _0x4e56ba='';var _0x48e772='';var _0x52196f='';var _0x501853='';var _0xee8b2d='';var _0x2cdbe9='';var _0x4b5163=[_0x901d('0x68'),_0x901d('0x69'),_0x901d('0x6a'),_0x901d('0x6b'),_0x901d('0x6c'),'subject',_0x901d('0x6d'),_0x901d('0x6e'),_0x901d('0x6f'),'phonecall_activity_parties'];var _0x1204a5=[_0x901d('0x70'),_0x901d('0x71'),_0x901d('0x72'),_0x901d('0x73'),_0x901d('0x74'),_0x901d('0x75'),_0x901d('0x76'),_0x901d('0x77'),_0x901d('0x78'),_0x901d('0x79'),_0x901d('0x7a'),_0x901d('0x7b'),'createdon',_0x901d('0x7c'),_0x901d('0x7d'),_0x901d('0x7e'),_0x901d('0x7f'),_0x901d('0x80'),_0x901d('0x81'),_0x901d('0x82'),_0x901d('0x83'),'entityimage_url',_0x901d('0x84'),_0x901d('0x85'),_0x901d('0x86'),'followupby',_0x901d('0x87'),_0x901d('0x88'),_0x901d('0x89'),_0x901d('0x8a'),_0x901d('0x8b'),_0x901d('0x8c'),_0x901d('0x8d'),_0x901d('0x8e'),_0x901d('0x8f'),_0x901d('0x90'),_0x901d('0x91'),_0x901d('0x92'),_0x901d('0x93'),_0x901d('0x94'),_0x901d('0x95'),_0x901d('0x96'),'overriddencreatedon',_0x901d('0x97'),_0x901d('0x98'),_0x901d('0x99'),_0x901d('0x9a'),_0x901d('0x9b'),_0x901d('0x9c'),'prioritycodename',_0x901d('0x9d'),_0x901d('0x9e'),_0x901d('0x9f'),_0x901d('0xa0'),_0x901d('0xa1'),_0x901d('0xa2'),_0x901d('0xa3'),'sentimentvalue',_0x901d('0xa4'),'slaname',_0x901d('0xa5'),_0x901d('0xa6'),_0x901d('0xa7'),_0x901d('0xa8'),'ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath',_0x901d('0xa9'),_0x901d('0xaa')];var _0x52b377=_0x4b5163['concat'](_0x1204a5);return db['Dynamics365Account'][_0x901d('0x5a')]({'where':{'id':_0x297e32['params']['id']},'attributes':['id',_0x901d('0xab'),_0x901d('0xac'),_0x901d('0xad'),'tenantId','clientId',_0x901d('0xae')]})[_0x901d('0x21')](handleEntityNotFound(_0x27571a,null))[_0x901d('0x21')](function(_0x4d4548){if(_0x4d4548){_0x2cdbe9=_0x4d4548['remoteUri'];var _0x496e6a=_0x2cdbe9[_0x901d('0xaf')](-0x1);if(_0x496e6a==='/'){_0x2cdbe9=_0x2cdbe9[_0x901d('0xb0')](0x0,_0x2cdbe9['lastIndexOf'](_0x496e6a));}_0xee8b2d=util[_0x901d('0xb1')]('%s/api/data/v9.0/',_0x2cdbe9);var _0x552b3e={'method':_0x901d('0xb2'),'uri':'https://login.microsoftonline.com/'+_0x4d4548[_0x901d('0xb3')]+_0x901d('0xb4'),'form':{'client_id':_0x4d4548[_0x901d('0xb5')],'resource':_0x2cdbe9,'username':_0x4d4548[_0x901d('0xab')],'password':_0x4d4548[_0x901d('0xac')],'grant_type':_0x901d('0xac'),'client_secret':_0x4d4548['clientSecret']},'json':!![]};return rp(_0x552b3e);}})[_0x901d('0x21')](function(_0x41d4c6){_0x501853=_0x41d4c6[_0x901d('0xb6')];var _0x1ee563={'method':_0x901d('0xb7'),'uri':encodeURI(_0xee8b2d+_0x901d('0xb8')+_0x408194+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x501853,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1ee563);})[_0x901d('0x21')](function(_0x20008d){var _0x2e9fac=_0x20008d[_0x901d('0xb9')][0x0];var _0x77f5f6=_0x2e9fac[_0x901d('0xba')];var _0x12e0c4={'method':_0x901d('0xb7'),'uri':_0xee8b2d+_0x901d('0xbb')+_0x77f5f6+_0x901d('0xbc'),'headers':{'Authorization':'Bearer\x20'+_0x501853,'If-None-Match':null,'OData-Version':_0x901d('0xbd')},'json':!![]};return rp(_0x12e0c4);})[_0x901d('0x21')](function(_0x185595){_0x5b0258=_0x185595;_0x2d56be=_0x5b0258[_0x901d('0xbe')];_0x2d56be=_[_0x901d('0xbf')](_0x2d56be,function(_0x1cf620){return!_0x52b377[_0x901d('0xc0')](_0x1cf620[_0x901d('0xc1')]);});var _0x3fadee=[];var _0x17b7ef=[];_0x2d56be[_0x901d('0xc2')](function(_0x1d4c67){if(_0x1d4c67[_0x901d('0xc3')]){var _0xd9051f=_0x1d4c67['@odata.type'][_0x901d('0xb0')](_0x1d4c67[_0x901d('0xc3')][_0x901d('0xc4')]('.')+0x1);if(_0xd9051f===_0x901d('0xc5')){_0x3fadee[_0x901d('0xc6')](getSelectList(_0xee8b2d,_0x225a90,_0x17b7ef,_0x5b0258[_0x901d('0xba')],_0x1d4c67[_0x901d('0xba')],_0x501853));}}});return Promise[_0x901d('0xc7')](_0x3fadee);})[_0x901d('0x21')](function(_0x4bff44){_0x4e56ba=_0x4bff44[0x0];var _0x1268fc=[];var _0x1035a8=[];_0x2d56be[_0x901d('0xc2')](function(_0x2a9ebc){if(!_[_0x901d('0xc8')](_0x2a9ebc[_0x901d('0xc3')])){var _0x5146ec=_0x2a9ebc[_0x901d('0xc3')][_0x901d('0xb0')](_0x2a9ebc[_0x901d('0xc3')][_0x901d('0xc4')]('.')+0x1);if(_0x5146ec===_0x901d('0xc9')){_0x1268fc['push'](getBooleanList(_0xee8b2d,_0x225a90,_0x1035a8,_0x5b0258['MetadataId'],_0x2a9ebc[_0x901d('0xba')],_0x501853));}}});return Promise['all'](_0x1268fc);})[_0x901d('0x21')](function(_0x238de2){_0x48e772=_0x238de2[0x0];var _0x59782e=[];var _0x153537=[];_0x2d56be['forEach'](function(_0x210c1e){if(_0x210c1e['@odata.type']){var _0x3118f5=_0x210c1e[_0x901d('0xc3')]['substring'](_0x210c1e[_0x901d('0xc3')]['lastIndexOf']('.')+0x1);if(_0x3118f5==='StringAttributeMetadata'||_0x3118f5===_0x901d('0xca')||_0x3118f5===_0x901d('0xcb')||_0x3118f5===_0x901d('0xcc')||_0x3118f5===_0x901d('0xcd')||_0x3118f5===_0x901d('0xce')||_0x3118f5===_0x901d('0xcf')||_0x3118f5==='EntityNameAttributeMetadata'||_0x3118f5===_0x901d('0xd0')||_0x3118f5===_0x901d('0xd1')){_0x59782e['push'](getInputList(_0xee8b2d,_0x225a90,_0x3118f5,_0x153537,_0x5b0258[_0x901d('0xba')],_0x210c1e[_0x901d('0xba')],_0x501853));}}});return Promise['all'](_0x59782e);})[_0x901d('0x21')](function(_0x12da54){_0x52196f=_0x12da54[0x0];var _0x4ec09b=_0x4e56ba['concat'](_0x48e772)[_0x901d('0xd2')](_0x52196f);var _0xd891bf={'count':_0x4ec09b[_0x901d('0x47')],'rows':_0x4ec09b};return _0xd891bf;})[_0x901d('0x21')](respondWithResult(_0x27571a,null))[_0x901d('0x2b')](function(_0x1e55fa){var _0x10918e=_0x297e32[_0x901d('0x42')][_0x901d('0xd3')]?0x1f4:_0x1e55fa[_0x901d('0xd4')]||0x1f4;logger[_0x901d('0x28')](_0x1e55fa[_0x901d('0x38')]);delete _0x1e55fa[_0x901d('0x41')];if(_0x10918e===0x191){_0x10918e=0x190;}_0x27571a[_0x901d('0x2c')](_0x10918e)[_0x901d('0xd5')](_0x297e32[_0x901d('0x42')][_0x901d('0xd3')]?{'message':_0x901d('0xd6'),'statusCode':_0x1e55fa[_0x901d('0xd4')]}:_0x1e55fa);});};function getSelectList(_0x2f7f37,_0x3e40b4,_0x3289b6,_0x13c649,_0x1eba2a,_0x236870){var _0x7a5c92={'method':_0x901d('0xb7'),'uri':_0x2f7f37+_0x901d('0xbb')+_0x13c649+_0x901d('0xd7')+_0x1eba2a+_0x901d('0xd8')+_0x901d('0xd9'),'headers':{'Authorization':_0x901d('0xda')+_0x236870,'If-None-Match':null,'OData-Version':_0x901d('0xbd')},'json':!![]};return rp(_0x7a5c92)[_0x901d('0x21')](function(_0x5bcdaa){var _0x5780ed=[];var _0x347085=_0x5bcdaa[_0x901d('0xdb')][_0x901d('0xdc')];_0x347085['forEach'](function(_0x57996a){_0x5780ed[_0x901d('0xc6')]({'name':_0x57996a[_0x901d('0xdd')]['UserLocalizedLabel'][_0x901d('0xdd')],'value':String(_0x57996a[_0x901d('0xde')])});});var _0x4fd503={'id':_0x3e40b4+'_'+_0x5bcdaa[_0x901d('0xc1')],'name':_0x5bcdaa[_0x901d('0xdf')][_0x901d('0xe0')][_0x901d('0xdd')],'custom':![],'options':_0x5780ed};_0x3289b6[_0x901d('0xc6')](_0x4fd503);return _0x3289b6;});}function getBooleanList(_0x21e0d5,_0x17330d,_0x2fb9a9,_0x345b67,_0x23420d,_0x23be96){var _0x5eea7f={'method':_0x901d('0xb7'),'uri':_0x21e0d5+'EntityDefinitions('+_0x345b67+_0x901d('0xd7')+_0x23420d+_0x901d('0xe1'),'headers':{'Authorization':'Bearer\x20'+_0x23be96,'If-None-Match':null,'OData-Version':_0x901d('0xbd')},'json':!![]};return rp(_0x5eea7f)[_0x901d('0x21')](function(_0x35a4de){var _0x234595=[];_0x234595['push']({'name':_0x35a4de[_0x901d('0xdb')][_0x901d('0xe2')][_0x901d('0xdd')]['UserLocalizedLabel'][_0x901d('0xdd')],'value':_0x901d('0xe3')},{'name':_0x35a4de['OptionSet'][_0x901d('0xe4')][_0x901d('0xdd')]['UserLocalizedLabel'][_0x901d('0xdd')],'value':'false'});var _0x4e6621={'id':_0x17330d+'_'+_0x35a4de[_0x901d('0xc1')],'name':_0x35a4de[_0x901d('0xdf')][_0x901d('0xe0')]['Label'],'custom':![],'options':_0x234595};_0x2fb9a9[_0x901d('0xc6')](_0x4e6621);return _0x2fb9a9;});}function getInputList(_0x2fb62a,_0x6f127d,_0x47a1ba,_0x40b9a9,_0x2bc3c8,_0x1e0283,_0x531e95){var _0x1ab62f={'method':'GET','uri':_0x2fb62a+'EntityDefinitions('+_0x2bc3c8+_0x901d('0xd7')+_0x1e0283+_0x901d('0xe5')+_0x47a1ba+_0x901d('0xe6'),'headers':{'Authorization':_0x901d('0xda')+_0x531e95,'If-None-Match':null,'OData-Version':_0x901d('0xbd')},'json':!![]};return rp(_0x1ab62f)[_0x901d('0x21')](function(_0x188ea8){var _0x25c4d4={'id':_0x6f127d+'_'+_0x188ea8[_0x901d('0xc1')],'name':_0x188ea8['DisplayName']['UserLocalizedLabel']?_0x188ea8[_0x901d('0xdf')][_0x901d('0xe0')][_0x901d('0xdd')]:_0x188ea8[_0x901d('0xc1')],'custom':![],'options':[]};_0x40b9a9[_0x901d('0xc6')](_0x25c4d4);return _0x40b9a9;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 5e1e46d..ee70d87 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 _0xf61a=['bluebird','request-promise','path','rimraf','./intDynamics365Account.attributes','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','../../config/logger','api','moment'];(function(_0x5efbcb,_0x5319b2){var _0x4d44af=function(_0x37fc97){while(--_0x37fc97){_0x5efbcb['push'](_0x5efbcb['shift']());}};_0x4d44af(++_0x5319b2);}(_0xf61a,0x1a9));var _0xaf61=function(_0x4dd35d,_0x1b2259){_0x4dd35d=_0x4dd35d-0x0;var _0x4501b2=_0xf61a[_0x4dd35d];return _0x4501b2;};'use strict';var _=require(_0xaf61('0x0'));var util=require('util');var logger=require(_0xaf61('0x1'))(_0xaf61('0x2'));var moment=require(_0xaf61('0x3'));var BPromise=require(_0xaf61('0x4'));var rp=require(_0xaf61('0x5'));var fs=require('fs');var path=require(_0xaf61('0x6'));var rimraf=require(_0xaf61('0x7'));var config=require('../../config/environment');var attributes=require(_0xaf61('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xaf61('0x9')]=function(_0x4b7edc,_0x1246a2){return _0x4b7edc[_0xaf61('0xa')](_0xaf61('0xb'),attributes,{'tableName':_0xaf61('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf263=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','lodash'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xf263,0xcf));var _0x3f26=function(_0x1f239e,_0x367b43){_0x1f239e=_0x1f239e-0x0;var _0x826971=_0xf263[_0x1f239e];return _0x826971;};'use strict';var _=require(_0x3f26('0x0'));var util=require(_0x3f26('0x1'));var logger=require(_0x3f26('0x2'))(_0x3f26('0x3'));var moment=require(_0x3f26('0x4'));var BPromise=require('bluebird');var rp=require(_0x3f26('0x5'));var fs=require('fs');var path=require(_0x3f26('0x6'));var rimraf=require('rimraf');var config=require(_0x3f26('0x7'));var attributes=require(_0x3f26('0x8'));var integrations=require(_0x3f26('0x9'));module[_0x3f26('0xa')]=function(_0x2078f2,_0x454b26){return _0x2078f2[_0x3f26('0xb')](_0x3f26('0xc'),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 357df6b..63fea15 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 _0x04f9=['attributes','catch','Dynamics365Account','ShowDynamics365Account','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDynamics365Account','raw','options','where','limit','include','map','model'];(function(_0xd82a86,_0x1ba4f0){var _0x1d392d=function(_0x4df267){while(--_0x4df267){_0xd82a86['push'](_0xd82a86['shift']());}};_0x1d392d(++_0x1ba4f0);}(_0x04f9,0xb3));var _0x904f=function(_0x172f09,_0xaebf5e){_0x172f09=_0x172f09-0x0;var _0x769755=_0x04f9[_0x172f09];return _0x769755;};'use strict';var _=require('lodash');var util=require(_0x904f('0x0'));var moment=require(_0x904f('0x1'));var BPromise=require(_0x904f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x904f('0x3'));var db=require(_0x904f('0x4'))['db'];var utils=require(_0x904f('0x5'));var logger=require(_0x904f('0x6'))(_0x904f('0x7'));var config=require(_0x904f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x904f('0x9')][_0x904f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x175c38,_0x21dce4,_0x34cbd7){return new BPromise(function(_0x506239,_0xa90c3f){return client[_0x904f('0xb')](_0x175c38,_0x34cbd7)[_0x904f('0xc')](function(_0x4f8d32){logger[_0x904f('0xd')](_0x904f('0xe'),_0x21dce4,_0x904f('0xf'));logger[_0x904f('0x10')](_0x904f('0x11'),_0x21dce4,_0x904f('0xf'),JSON[_0x904f('0x12')](_0x4f8d32));if(_0x4f8d32[_0x904f('0x13')]){if(_0x4f8d32[_0x904f('0x13')][_0x904f('0x14')]===0x1f4){logger[_0x904f('0x13')](_0x904f('0xe'),_0x21dce4,_0x4f8d32[_0x904f('0x13')][_0x904f('0x15')]);return _0xa90c3f(_0x4f8d32[_0x904f('0x13')][_0x904f('0x15')]);}logger[_0x904f('0x13')](_0x904f('0xe'),_0x21dce4,_0x4f8d32[_0x904f('0x13')][_0x904f('0x15')]);return _0x506239(_0x4f8d32[_0x904f('0x13')][_0x904f('0x15')]);}else{logger[_0x904f('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x21dce4,'request\x20sent');_0x506239(_0x4f8d32[_0x904f('0x16')][_0x904f('0x15')]);}})['catch'](function(_0x58c4d6){logger['error'](_0x904f('0xe'),_0x21dce4,_0x58c4d6);_0xa90c3f(_0x58c4d6);});});}exports[_0x904f('0x17')]=function(_0x4eb784){var _0x43cf3e=this;return new Promise(function(_0x502f80,_0x5327b5){return db['Dynamics365Account']['findAll']({'raw':_0x4eb784['options']?_0x4eb784['options'][_0x904f('0x18')]===undefined?!![]:![]:!![],'where':_0x4eb784[_0x904f('0x19')]?_0x4eb784['options'][_0x904f('0x1a')]||null:null,'attributes':_0x4eb784[_0x904f('0x19')]?_0x4eb784[_0x904f('0x19')]['attributes']||null:null,'limit':_0x4eb784[_0x904f('0x19')]?_0x4eb784[_0x904f('0x19')][_0x904f('0x1b')]||null:null,'include':_0x4eb784[_0x904f('0x19')]?_0x4eb784[_0x904f('0x19')][_0x904f('0x1c')]?_[_0x904f('0x1d')](_0x4eb784[_0x904f('0x19')][_0x904f('0x1c')],function(_0x1f3c74){return{'model':db[_0x1f3c74[_0x904f('0x1e')]],'as':_0x1f3c74['as'],'attributes':_0x1f3c74[_0x904f('0x1f')],'include':_0x1f3c74[_0x904f('0x1c')]?_[_0x904f('0x1d')](_0x1f3c74[_0x904f('0x1c')],function(_0x57dbcc){return{'model':db[_0x57dbcc['model']],'as':_0x57dbcc['as'],'attributes':_0x57dbcc[_0x904f('0x1f')],'include':_0x57dbcc[_0x904f('0x1c')]?_['map'](_0x57dbcc[_0x904f('0x1c')],function(_0x1b8f20){return{'model':db[_0x1b8f20['model']],'as':_0x1b8f20['as'],'attributes':_0x1b8f20[_0x904f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x904f('0xc')](function(_0x3fcb62){logger[_0x904f('0xd')](_0x904f('0x17'),_0x4eb784);logger[_0x904f('0x10')](_0x904f('0x17'),_0x4eb784,JSON[_0x904f('0x12')](_0x3fcb62));_0x502f80(_0x3fcb62);})[_0x904f('0x20')](function(_0x3aa868){logger['error'](_0x904f('0x17'),_0x3aa868['message'],_0x4eb784);_0x5327b5(_0x43cf3e[_0x904f('0x13')](0x1f4,_0x3aa868[_0x904f('0x15')]));});});};exports['ShowDynamics365Account']=function(_0x56ac39){var _0x39fd1d=this;return new Promise(function(_0x5353d5,_0x7d6015){return db[_0x904f('0x21')]['find']({'raw':_0x56ac39[_0x904f('0x19')]?_0x56ac39['options'][_0x904f('0x18')]===undefined?!![]:![]:!![],'where':_0x56ac39[_0x904f('0x19')]?_0x56ac39[_0x904f('0x19')][_0x904f('0x1a')]||null:null,'attributes':_0x56ac39[_0x904f('0x19')]?_0x56ac39[_0x904f('0x19')]['attributes']||null:null,'include':_0x56ac39['options']?_0x56ac39[_0x904f('0x19')][_0x904f('0x1c')]?_['map'](_0x56ac39[_0x904f('0x19')][_0x904f('0x1c')],function(_0x10a87a){return{'model':db[_0x10a87a[_0x904f('0x1e')]],'as':_0x10a87a['as'],'attributes':_0x10a87a[_0x904f('0x1f')],'include':_0x10a87a[_0x904f('0x1c')]?_['map'](_0x10a87a[_0x904f('0x1c')],function(_0x3d1edd){return{'model':db[_0x3d1edd[_0x904f('0x1e')]],'as':_0x3d1edd['as'],'attributes':_0x3d1edd[_0x904f('0x1f')],'include':_0x3d1edd['include']?_[_0x904f('0x1d')](_0x3d1edd[_0x904f('0x1c')],function(_0x435f99){return{'model':db[_0x435f99['model']],'as':_0x435f99['as'],'attributes':_0x435f99[_0x904f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x904f('0xc')](function(_0xeb03c9){logger[_0x904f('0xd')](_0x904f('0x22'),_0x56ac39);logger[_0x904f('0x10')](_0x904f('0x22'),_0x56ac39,JSON[_0x904f('0x12')](_0xeb03c9));_0x5353d5(_0xeb03c9);})[_0x904f('0x20')](function(_0x5c9a07){logger[_0x904f('0x13')](_0x904f('0x22'),_0x5c9a07[_0x904f('0x15')],_0x56ac39);_0x7d6015(_0x39fd1d[_0x904f('0x13')](0x1f4,_0x5c9a07['message']));});});}; \ No newline at end of file +var _0xcedf=['ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','include','map','model','attributes','ShowDynamics365Account','find','lodash','util','moment','bluebird'];(function(_0x5aee7a,_0x33ce74){var _0x49d48b=function(_0x77c7e3){while(--_0x77c7e3){_0x5aee7a['push'](_0x5aee7a['shift']());}};_0x49d48b(++_0x33ce74);}(_0xcedf,0x1b6));var _0xfced=function(_0x503e95,_0x16ba78){_0x503e95=_0x503e95-0x0;var _0x32f7b4=_0xcedf[_0x503e95];return _0x32f7b4;};'use strict';var _=require(_0xfced('0x0'));var util=require(_0xfced('0x1'));var moment=require(_0xfced('0x2'));var BPromise=require(_0xfced('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfced('0x4'));var db=require(_0xfced('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfced('0x6'));var config=require('../../config/environment');var jayson=require(_0xfced('0x7'));var client=jayson['client'][_0xfced('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x571725,_0x2cc4d1,_0x5bd518){return new BPromise(function(_0x5c6588,_0x27a65b){return client[_0xfced('0x9')](_0x571725,_0x5bd518)[_0xfced('0xa')](function(_0x1479e5){logger['info'](_0xfced('0xb'),_0x2cc4d1,_0xfced('0xc'));logger[_0xfced('0xd')](_0xfced('0xe'),_0x2cc4d1,_0xfced('0xc'),JSON[_0xfced('0xf')](_0x1479e5));if(_0x1479e5[_0xfced('0x10')]){if(_0x1479e5[_0xfced('0x10')][_0xfced('0x11')]===0x1f4){logger['error'](_0xfced('0xb'),_0x2cc4d1,_0x1479e5['error'][_0xfced('0x12')]);return _0x27a65b(_0x1479e5[_0xfced('0x10')][_0xfced('0x12')]);}logger[_0xfced('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x2cc4d1,_0x1479e5[_0xfced('0x10')][_0xfced('0x12')]);return _0x5c6588(_0x1479e5[_0xfced('0x10')][_0xfced('0x12')]);}else{logger[_0xfced('0x13')](_0xfced('0xb'),_0x2cc4d1,_0xfced('0xc'));_0x5c6588(_0x1479e5[_0xfced('0x14')]['message']);}})[_0xfced('0x15')](function(_0x5f1ac5){logger[_0xfced('0x10')](_0xfced('0xb'),_0x2cc4d1,_0x5f1ac5);_0x27a65b(_0x5f1ac5);});});}exports[_0xfced('0x16')]=function(_0x2d00dc){var _0x38528a=this;return new Promise(function(_0x27e988,_0x3dc86c){return db[_0xfced('0x17')][_0xfced('0x18')]({'raw':_0x2d00dc[_0xfced('0x19')]?_0x2d00dc['options'][_0xfced('0x1a')]===undefined?!![]:![]:!![],'where':_0x2d00dc[_0xfced('0x19')]?_0x2d00dc[_0xfced('0x19')][_0xfced('0x1b')]||null:null,'attributes':_0x2d00dc[_0xfced('0x19')]?_0x2d00dc['options']['attributes']||null:null,'limit':_0x2d00dc[_0xfced('0x19')]?_0x2d00dc[_0xfced('0x19')]['limit']||null:null,'include':_0x2d00dc[_0xfced('0x19')]?_0x2d00dc[_0xfced('0x19')][_0xfced('0x1c')]?_[_0xfced('0x1d')](_0x2d00dc[_0xfced('0x19')][_0xfced('0x1c')],function(_0x4b3547){return{'model':db[_0x4b3547[_0xfced('0x1e')]],'as':_0x4b3547['as'],'attributes':_0x4b3547[_0xfced('0x1f')],'include':_0x4b3547[_0xfced('0x1c')]?_[_0xfced('0x1d')](_0x4b3547[_0xfced('0x1c')],function(_0x56a26e){return{'model':db[_0x56a26e['model']],'as':_0x56a26e['as'],'attributes':_0x56a26e[_0xfced('0x1f')],'include':_0x56a26e[_0xfced('0x1c')]?_[_0xfced('0x1d')](_0x56a26e[_0xfced('0x1c')],function(_0x4d67bf){return{'model':db[_0x4d67bf[_0xfced('0x1e')]],'as':_0x4d67bf['as'],'attributes':_0x4d67bf['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x328cf1){logger[_0xfced('0x13')]('GetDynamics365Account',_0x2d00dc);logger[_0xfced('0xd')]('GetDynamics365Account',_0x2d00dc,JSON[_0xfced('0xf')](_0x328cf1));_0x27e988(_0x328cf1);})[_0xfced('0x15')](function(_0x419875){logger[_0xfced('0x10')]('GetDynamics365Account',_0x419875[_0xfced('0x12')],_0x2d00dc);_0x3dc86c(_0x38528a[_0xfced('0x10')](0x1f4,_0x419875[_0xfced('0x12')]));});});};exports[_0xfced('0x20')]=function(_0x54faca){var _0x1fab8d=this;return new Promise(function(_0x2691b4,_0x221dc9){return db['Dynamics365Account'][_0xfced('0x21')]({'raw':_0x54faca[_0xfced('0x19')]?_0x54faca[_0xfced('0x19')][_0xfced('0x1a')]===undefined?!![]:![]:!![],'where':_0x54faca[_0xfced('0x19')]?_0x54faca[_0xfced('0x19')][_0xfced('0x1b')]||null:null,'attributes':_0x54faca[_0xfced('0x19')]?_0x54faca[_0xfced('0x19')][_0xfced('0x1f')]||null:null,'include':_0x54faca[_0xfced('0x19')]?_0x54faca[_0xfced('0x19')][_0xfced('0x1c')]?_['map'](_0x54faca['options']['include'],function(_0x97f070){return{'model':db[_0x97f070[_0xfced('0x1e')]],'as':_0x97f070['as'],'attributes':_0x97f070[_0xfced('0x1f')],'include':_0x97f070[_0xfced('0x1c')]?_[_0xfced('0x1d')](_0x97f070['include'],function(_0x173c1f){return{'model':db[_0x173c1f[_0xfced('0x1e')]],'as':_0x173c1f['as'],'attributes':_0x173c1f[_0xfced('0x1f')],'include':_0x173c1f[_0xfced('0x1c')]?_[_0xfced('0x1d')](_0x173c1f['include'],function(_0x47e831){return{'model':db[_0x47e831[_0xfced('0x1e')]],'as':_0x47e831['as'],'attributes':_0x47e831['attributes']};}):[]};}):[]};}):[]:[]})[_0xfced('0xa')](function(_0xf976cf){logger['info'](_0xfced('0x20'),_0x54faca);logger['debug'](_0xfced('0x20'),_0x54faca,JSON[_0xfced('0xf')](_0xf976cf));_0x2691b4(_0xf976cf);})[_0xfced('0x15')](function(_0x996cdf){logger[_0xfced('0x10')](_0xfced('0x20'),_0x996cdf[_0xfced('0x12')],_0x54faca);_0x221dc9(_0x1fab8d[_0xfced('0x10')](0x1f4,_0x996cdf[_0xfced('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 5eda6f0..ca2167f 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 _0x8550=['show','getFields','/:id/subjects','getDescriptions','post','create','put','update','delete','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','/:id','isAuthenticated'];(function(_0x3b2ac8,_0x2d6552){var _0xa98039=function(_0x47f74e){while(--_0x47f74e){_0x3b2ac8['push'](_0x3b2ac8['shift']());}};_0xa98039(++_0x2d6552);}(_0x8550,0x180));var _0x0855=function(_0xcfa300,_0x46c18f){_0xcfa300=_0xcfa300-0x0;var _0x236906=_0x8550[_0xcfa300];return _0x236906;};'use strict';var multer=require(_0x0855('0x0'));var util=require('util');var path=require(_0x0855('0x1'));var timeout=require(_0x0855('0x2'));var express=require('express');var router=express[_0x0855('0x3')]();var auth=require(_0x0855('0x4'));var interaction=require(_0x0855('0x5'));var config=require(_0x0855('0x6'));var controller=require(_0x0855('0x7'));router[_0x0855('0x8')]('/',auth['isAuthenticated'](),controller[_0x0855('0x9')]);router['get'](_0x0855('0xa'),auth[_0x0855('0xb')](),controller[_0x0855('0xc')]);router[_0x0855('0x8')]('/:id/fields',auth[_0x0855('0xb')](),controller[_0x0855('0xd')]);router[_0x0855('0x8')](_0x0855('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x0855('0xb')](),controller[_0x0855('0xf')]);router[_0x0855('0x10')]('/',auth[_0x0855('0xb')](),controller[_0x0855('0x11')]);router[_0x0855('0x12')](_0x0855('0xa'),auth['isAuthenticated'](),controller[_0x0855('0x13')]);router[_0x0855('0x14')](_0x0855('0xa'),auth['isAuthenticated'](),controller[_0x0855('0x15')]);module['exports']=router; \ No newline at end of file +var _0xa83e=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/fields','getFields'];(function(_0x130b8f,_0x4fa933){var _0x4cf492=function(_0x2bd41b){while(--_0x2bd41b){_0x130b8f['push'](_0x130b8f['shift']());}};_0x4cf492(++_0x4fa933);}(_0xa83e,0xcf));var _0xea83=function(_0x1a268f,_0x2f4759){_0x1a268f=_0x1a268f-0x0;var _0x63fe77=_0xa83e[_0x1a268f];return _0x63fe77;};'use strict';var multer=require('multer');var util=require(_0xea83('0x0'));var path=require(_0xea83('0x1'));var timeout=require(_0xea83('0x2'));var express=require(_0xea83('0x3'));var router=express[_0xea83('0x4')]();var auth=require(_0xea83('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xea83('0x6'));var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0xea83('0x7')](),controller[_0xea83('0x8')]);router[_0xea83('0x9')](_0xea83('0xa'),auth[_0xea83('0x7')](),controller['show']);router[_0xea83('0x9')](_0xea83('0xb'),auth[_0xea83('0x7')](),controller[_0xea83('0xc')]);router[_0xea83('0x9')](_0xea83('0xd'),auth[_0xea83('0x7')](),controller[_0xea83('0xe')]);router['get'](_0xea83('0xf'),auth[_0xea83('0x7')](),controller[_0xea83('0x10')]);router[_0xea83('0x11')]('/',auth[_0xea83('0x7')](),controller[_0xea83('0x12')]);router[_0xea83('0x13')](_0xea83('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xea83('0x14')](_0xea83('0xa'),auth[_0xea83('0x7')](),controller['destroy']);module[_0xea83('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 244cef3..97b4f5f 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 _0x9a6b=['incident','sequelize','exports','STRING','ENUM'];(function(_0x4bc93e,_0x1ae64b){var _0x26663e=function(_0x20227f){while(--_0x20227f){_0x4bc93e['push'](_0x4bc93e['shift']());}};_0x26663e(++_0x1ae64b);}(_0x9a6b,0x119));var _0xb9a6=function(_0x2399bc,_0x475e0d){_0x2399bc=_0x2399bc-0x0;var _0x3f230a=_0x9a6b[_0x2399bc];return _0x3f230a;};'use strict';var Sequelize=require(_0xb9a6('0x0'));module[_0xb9a6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb9a6('0x2')]},'ticketType':{'type':Sequelize[_0xb9a6('0x3')](_0xb9a6('0x4'),'phonecall'),'defaultValue':_0xb9a6('0x4')}}; \ No newline at end of file +var _0x3d86=['phonecall','sequelize','STRING','ENUM','incident'];(function(_0x3ade6f,_0x33788f){var _0x2069d9=function(_0x338303){while(--_0x338303){_0x3ade6f['push'](_0x3ade6f['shift']());}};_0x2069d9(++_0x33788f);}(_0x3d86,0x1d7));var _0x63d8=function(_0x348cf1,_0x12b1ad){_0x348cf1=_0x348cf1-0x0;var _0x480b1d=_0x3d86[_0x348cf1];return _0x480b1d;};'use strict';var Sequelize=require(_0x63d8('0x0'));module['exports']={'name':{'type':Sequelize[_0x63d8('0x1')]},'description':{'type':Sequelize[_0x63d8('0x1')]},'ticketType':{'type':Sequelize[_0x63d8('0x2')](_0x63d8('0x3'),_0x63d8('0x4')),'defaultValue':_0x63d8('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 8529b2e..87e2a4d 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 _0x1fe0=['show','find','create','body','params','findOne','Dynamics365Field','pick','getFields','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','Dynamics365Configuration','includeAll','include','rows'];(function(_0x3fc0c7,_0x1a4ab3){var _0x5ccabf=function(_0x126bbc){while(--_0x126bbc){_0x3fc0c7['push'](_0x3fc0c7['shift']());}};_0x5ccabf(++_0x1a4ab3);}(_0x1fe0,0x66));var _0x01fe=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x1fe0[_0x1deb03];return _0x189fe7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x01fe('0x0'));var rimraf=require(_0x01fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x01fe('0x2'));var rp=require(_0x01fe('0x3'));var moment=require(_0x01fe('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x01fe('0x5'));var util=require(_0x01fe('0x6'));var path=require(_0x01fe('0x7'));var sox=require(_0x01fe('0x8'));var csv=require(_0x01fe('0x9'));var ejs=require(_0x01fe('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x01fe('0xb'));var crypto=require(_0x01fe('0xc'));var jsforce=require(_0x01fe('0xd'));var deskjs=require(_0x01fe('0xe'));var toCsv=require(_0x01fe('0x9'));var querystring=require(_0x01fe('0xf'));var Papa=require('papaparse');var Redis=require(_0x01fe('0x10'));var authService=require(_0x01fe('0x11'));var qs=require(_0x01fe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x01fe('0x13'));var logger=require(_0x01fe('0x14'))(_0x01fe('0x15'));var utils=require(_0x01fe('0x16'));var config=require(_0x01fe('0x17'));var licenseUtil=require(_0x01fe('0x18'));var db=require(_0x01fe('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x01fe('0x1a')][_0x01fe('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4a2ee4,_0x5ca981,_0x3f022e,_0x2cabbc){return new BPromise(function(_0x5585a0,_0x1f62ea){var _0x333d56=_0x2cabbc||client;return _0x333d56[_0x01fe('0x1c')](_0x4a2ee4,_0x3f022e)['then'](function(_0x5e3cf9){logger['info'](_0x01fe('0x1d'),_0x5ca981,'request\x20sent');logger['debug'](_0x01fe('0x1e'),_0x5ca981,_0x01fe('0x1f'),JSON[_0x01fe('0x20')](_0x5e3cf9));if(_0x5e3cf9[_0x01fe('0x21')]){if(_0x5e3cf9[_0x01fe('0x21')][_0x01fe('0x22')]===0x1f4){logger[_0x01fe('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5ca981,_0x5e3cf9[_0x01fe('0x21')][_0x01fe('0x23')]);return _0x1f62ea(_0x5e3cf9['error'][_0x01fe('0x23')]);}logger[_0x01fe('0x21')](_0x01fe('0x1d'),_0x5ca981,_0x5e3cf9['error'][_0x01fe('0x23')]);return _0x5585a0(_0x5e3cf9[_0x01fe('0x21')][_0x01fe('0x23')]);}else{logger[_0x01fe('0x24')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5ca981,_0x01fe('0x1f'));_0x5585a0(_0x5e3cf9[_0x01fe('0x25')][_0x01fe('0x23')]);}})[_0x01fe('0x26')](function(_0x18a16c){logger[_0x01fe('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5ca981,_0x18a16c);_0x1f62ea(_0x18a16c);});});}function respondWithStatusCode(_0x2ec7dd,_0x9281fa){_0x9281fa=_0x9281fa||0xcc;return function(_0x2fb558){if(_0x2fb558){return _0x2ec7dd[_0x01fe('0x27')](_0x9281fa);}return _0x2ec7dd[_0x01fe('0x28')](_0x9281fa)[_0x01fe('0x29')]();};}function respondWithResult(_0x367d63,_0xe51483){_0xe51483=_0xe51483||0xc8;return function(_0x48e65a){if(_0x48e65a){return _0x367d63[_0x01fe('0x28')](_0xe51483)[_0x01fe('0x2a')](_0x48e65a);}};}function respondWithFilteredResult(_0x3ef675,_0x4ac826){return function(_0x2cb84f){if(_0x2cb84f){var _0x1121a8=_0x2cb84f[_0x01fe('0x2b')],_0x37512c=_0x4ac826[_0x01fe('0x2c')],_0x58b68=_0x4ac826[_0x01fe('0x2c')]+_0x4ac826[_0x01fe('0x2d')],_0x4ecd8e;if(_0x58b68>=_0x1121a8){_0x58b68=_0x1121a8;_0x4ecd8e=0xc8;}else{_0x4ecd8e=0xce;}_0x3ef675['status'](_0x4ecd8e);return _0x3ef675['set']('Content-Range',_0x37512c+'-'+_0x58b68+'/'+_0x1121a8)['json'](_0x2cb84f);}return null;};}function patchUpdates(_0x366c75){return function(_0x13414c){try{jsonpatch[_0x01fe('0x2e')](_0x13414c,_0x366c75,!![]);}catch(_0x54b11a){return BPromise[_0x01fe('0x2f')](_0x54b11a);}return _0x13414c[_0x01fe('0x30')]();};}function saveUpdates(_0x26c8cd,_0x496da6){return function(_0x3b59a7){if(_0x3b59a7){return _0x3b59a7[_0x01fe('0x31')](_0x26c8cd)[_0x01fe('0x32')](function(_0x31fa20){return _0x31fa20;});}return null;};}function removeEntity(_0x1cdcf1,_0x2a9072){return function(_0x4bf38a){if(_0x4bf38a){return _0x4bf38a[_0x01fe('0x33')]()[_0x01fe('0x32')](function(){_0x1cdcf1[_0x01fe('0x28')](0xcc)[_0x01fe('0x29')]();});}};}function handleEntityNotFound(_0x3668a0,_0xac4d62){return function(_0x7a6e9f){if(!_0x7a6e9f){_0x3668a0[_0x01fe('0x27')](0x194);}return _0x7a6e9f;};}function handleError(_0x576c23,_0xa162f9){_0xa162f9=_0xa162f9||0x1f4;return function(_0x4c075e){logger[_0x01fe('0x21')](_0x4c075e[_0x01fe('0x34')]);if(_0x4c075e[_0x01fe('0x35')]){delete _0x4c075e['name'];}_0x576c23[_0x01fe('0x28')](_0xa162f9)[_0x01fe('0x36')](_0x4c075e);};}exports['index']=function(_0xf86834,_0x22aaeb){var _0x5a7fe6={},_0x4f0dbc={},_0xade2f7={'count':0x0,'rows':[]};var _0x4d2b34=_[_0x01fe('0x37')](db['Dynamics365Configuration'][_0x01fe('0x38')],function(_0x163f8c){return{'name':_0x163f8c[_0x01fe('0x39')],'type':_0x163f8c[_0x01fe('0x3a')]['key']};});_0x4f0dbc[_0x01fe('0x3b')]=_[_0x01fe('0x37')](_0x4d2b34,_0x01fe('0x35'));_0x4f0dbc['query']=_[_0x01fe('0x3c')](_0xf86834['query']);_0x4f0dbc[_0x01fe('0x3d')]=_[_0x01fe('0x3e')](_0x4f0dbc[_0x01fe('0x3b')],_0x4f0dbc[_0x01fe('0x3f')]);_0x5a7fe6['attributes']=_['intersection'](_0x4f0dbc['model'],qs['fields'](_0xf86834['query'][_0x01fe('0x40')]));_0x5a7fe6[_0x01fe('0x41')]=_0x5a7fe6[_0x01fe('0x41')][_0x01fe('0x42')]?_0x5a7fe6[_0x01fe('0x41')]:_0x4f0dbc['model'];if(!_0xf86834['query'][_0x01fe('0x43')](_0x01fe('0x44'))){_0x5a7fe6[_0x01fe('0x2d')]=qs[_0x01fe('0x2d')](_0xf86834['query'][_0x01fe('0x2d')]);_0x5a7fe6[_0x01fe('0x2c')]=qs[_0x01fe('0x2c')](_0xf86834['query'][_0x01fe('0x2c')]);}_0x5a7fe6[_0x01fe('0x45')]=qs['sort'](_0xf86834[_0x01fe('0x3f')][_0x01fe('0x46')]);_0x5a7fe6['where']=qs[_0x01fe('0x3d')](_['pick'](_0xf86834[_0x01fe('0x3f')],_0x4f0dbc[_0x01fe('0x3d')]),_0x4d2b34);if(_0xf86834[_0x01fe('0x3f')][_0x01fe('0x47')]){_0x5a7fe6['where']=_[_0x01fe('0x48')](_0x5a7fe6[_0x01fe('0x49')],{'$or':_[_0x01fe('0x37')](_0x4d2b34,function(_0x5e472a){if(_0x5e472a['type']!==_0x01fe('0x4a')){var _0x1c4314={};_0x1c4314[_0x5e472a[_0x01fe('0x35')]]={'$like':'%'+_0xf86834[_0x01fe('0x3f')][_0x01fe('0x47')]+'%'};return _0x1c4314;}})});}_0x5a7fe6=_[_0x01fe('0x48')]({},_0x5a7fe6,_0xf86834[_0x01fe('0x4b')]);var _0x28a917={'where':_0x5a7fe6[_0x01fe('0x49')]};return db[_0x01fe('0x4c')]['count'](_0x28a917)['then'](function(_0x2f1280){_0xade2f7[_0x01fe('0x2b')]=_0x2f1280;if(_0xf86834[_0x01fe('0x3f')][_0x01fe('0x4d')]){_0x5a7fe6[_0x01fe('0x4e')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x5a7fe6);})['then'](function(_0x2b5d54){_0xade2f7[_0x01fe('0x4f')]=_0x2b5d54;return _0xade2f7;})['then'](respondWithFilteredResult(_0x22aaeb,_0x5a7fe6))[_0x01fe('0x26')](handleError(_0x22aaeb,null));};exports[_0x01fe('0x50')]=function(_0x382d4a,_0x596e6c){var _0x20f0a8={'raw':![],'where':{'id':_0x382d4a['params']['id']}},_0x9d5328={};_0x9d5328[_0x01fe('0x3b')]=_[_0x01fe('0x3c')](db[_0x01fe('0x4c')]['rawAttributes']);_0x9d5328[_0x01fe('0x3f')]=_[_0x01fe('0x3c')](_0x382d4a[_0x01fe('0x3f')]);_0x9d5328[_0x01fe('0x3d')]=_[_0x01fe('0x3e')](_0x9d5328[_0x01fe('0x3b')],_0x9d5328[_0x01fe('0x3f')]);_0x20f0a8['attributes']=_[_0x01fe('0x3e')](_0x9d5328[_0x01fe('0x3b')],qs[_0x01fe('0x40')](_0x382d4a[_0x01fe('0x3f')][_0x01fe('0x40')]));_0x20f0a8[_0x01fe('0x41')]=_0x20f0a8['attributes'][_0x01fe('0x42')]?_0x20f0a8['attributes']:_0x9d5328[_0x01fe('0x3b')];if(_0x382d4a[_0x01fe('0x3f')][_0x01fe('0x4d')]){_0x20f0a8['include']=[{'all':!![]}];}_0x20f0a8=_[_0x01fe('0x48')]({},_0x20f0a8,_0x382d4a[_0x01fe('0x4b')]);return db[_0x01fe('0x4c')][_0x01fe('0x51')](_0x20f0a8)['then'](handleEntityNotFound(_0x596e6c,null))[_0x01fe('0x32')](respondWithResult(_0x596e6c,null))[_0x01fe('0x26')](handleError(_0x596e6c,null));};exports[_0x01fe('0x52')]=function(_0x5d38e6,_0x546769){return db[_0x01fe('0x4c')]['create'](_0x5d38e6['body'],{})[_0x01fe('0x32')](respondWithResult(_0x546769,0xc9))[_0x01fe('0x26')](handleError(_0x546769,null));};exports[_0x01fe('0x31')]=function(_0x2ddf6d,_0x1a972b){if(_0x2ddf6d[_0x01fe('0x53')]['id']){delete _0x2ddf6d[_0x01fe('0x53')]['id'];}return db[_0x01fe('0x4c')][_0x01fe('0x51')]({'where':{'id':_0x2ddf6d[_0x01fe('0x54')]['id']}})[_0x01fe('0x32')](handleEntityNotFound(_0x1a972b,null))[_0x01fe('0x32')](saveUpdates(_0x2ddf6d[_0x01fe('0x53')],null))[_0x01fe('0x32')](respondWithResult(_0x1a972b,null))[_0x01fe('0x26')](handleError(_0x1a972b,null));};exports[_0x01fe('0x33')]=function(_0x54e8d3,_0x4c46a7){return db[_0x01fe('0x4c')]['find']({'where':{'id':_0x54e8d3[_0x01fe('0x54')]['id']}})[_0x01fe('0x32')](handleEntityNotFound(_0x4c46a7,null))['then'](removeEntity(_0x4c46a7,null))[_0x01fe('0x26')](handleError(_0x4c46a7,null));};exports['getFields']=function(_0x4dc29c,_0x5be8a9,_0x26076a){var _0xc955bc={};var _0x1dde1f={};var _0x42d50e;var _0x232274;return db[_0x01fe('0x4c')][_0x01fe('0x55')]({'where':{'id':_0x4dc29c[_0x01fe('0x54')]['id']}})[_0x01fe('0x32')](handleEntityNotFound(_0x5be8a9,null))[_0x01fe('0x32')](function(_0xbfdf61){if(_0xbfdf61){_0x42d50e=_0xbfdf61;_0x1dde1f[_0x01fe('0x3b')]=_[_0x01fe('0x3c')](db[_0x01fe('0x56')][_0x01fe('0x38')]);_0x1dde1f['query']=_[_0x01fe('0x3c')](_0x4dc29c['query']);_0x1dde1f[_0x01fe('0x3d')]=_[_0x01fe('0x3e')](_0x1dde1f[_0x01fe('0x3b')],_0x1dde1f['query']);_0xc955bc[_0x01fe('0x41')]=_[_0x01fe('0x3e')](_0x1dde1f[_0x01fe('0x3b')],qs[_0x01fe('0x40')](_0x4dc29c[_0x01fe('0x3f')][_0x01fe('0x40')]));_0xc955bc[_0x01fe('0x41')]=_0xc955bc[_0x01fe('0x41')]['length']?_0xc955bc[_0x01fe('0x41')]:_0x1dde1f[_0x01fe('0x3b')];_0xc955bc[_0x01fe('0x45')]=qs[_0x01fe('0x46')](_0x4dc29c[_0x01fe('0x3f')][_0x01fe('0x46')]);_0xc955bc[_0x01fe('0x49')]=qs[_0x01fe('0x3d')](_[_0x01fe('0x57')](_0x4dc29c['query'],_0x1dde1f['filters']));if(_0x4dc29c[_0x01fe('0x3f')]['filter']){_0xc955bc[_0x01fe('0x49')]=_[_0x01fe('0x48')](_0xc955bc['where'],{'$or':_[_0x01fe('0x37')](_0xc955bc[_0x01fe('0x41')],function(_0x595b75){var _0x5c4708={};_0x5c4708[_0x595b75]={'$like':'%'+_0x4dc29c[_0x01fe('0x3f')]['filter']+'%'};return _0x5c4708;})});}_0xc955bc=_[_0x01fe('0x48')]({},_0xc955bc,_0x4dc29c[_0x01fe('0x4b')]);return _0x42d50e[_0x01fe('0x58')](_0xc955bc);}})['then'](function(_0xd2bef8){if(_0xd2bef8){_0x232274=_0xd2bef8['length'];if(!_0x4dc29c['query']['hasOwnProperty'](_0x01fe('0x44'))){_0xc955bc[_0x01fe('0x2d')]=qs['limit'](_0x4dc29c[_0x01fe('0x3f')]['limit']);_0xc955bc[_0x01fe('0x2c')]=qs[_0x01fe('0x2c')](_0x4dc29c[_0x01fe('0x3f')][_0x01fe('0x2c')]);}return _0x42d50e[_0x01fe('0x58')](_0xc955bc);}})[_0x01fe('0x32')](function(_0x318ed5){if(_0x318ed5){return _0x318ed5?{'count':_0x232274,'rows':_0x318ed5}:null;}})[_0x01fe('0x32')](respondWithResult(_0x5be8a9,null))[_0x01fe('0x26')](handleError(_0x5be8a9,null));};exports[_0x01fe('0x59')]=function(_0x44f667,_0x811d3e,_0x543e69){var _0x328cab={};var _0x4c989f={};var _0x12c428;var _0x5a71fe;return db[_0x01fe('0x4c')]['findOne']({'where':{'id':_0x44f667[_0x01fe('0x54')]['id']}})['then'](handleEntityNotFound(_0x811d3e,null))[_0x01fe('0x32')](function(_0x248c50){if(_0x248c50){_0x12c428=_0x248c50;_0x4c989f['model']=_[_0x01fe('0x3c')](db[_0x01fe('0x56')][_0x01fe('0x38')]);_0x4c989f['query']=_[_0x01fe('0x3c')](_0x44f667[_0x01fe('0x3f')]);_0x4c989f['filters']=_[_0x01fe('0x3e')](_0x4c989f[_0x01fe('0x3b')],_0x4c989f['query']);_0x328cab[_0x01fe('0x41')]=_['intersection'](_0x4c989f['model'],qs['fields'](_0x44f667[_0x01fe('0x3f')]['fields']));_0x328cab[_0x01fe('0x41')]=_0x328cab[_0x01fe('0x41')][_0x01fe('0x42')]?_0x328cab[_0x01fe('0x41')]:_0x4c989f[_0x01fe('0x3b')];_0x328cab[_0x01fe('0x45')]=qs['sort'](_0x44f667[_0x01fe('0x3f')][_0x01fe('0x46')]);_0x328cab[_0x01fe('0x49')]=qs['filters'](_[_0x01fe('0x57')](_0x44f667[_0x01fe('0x3f')],_0x4c989f[_0x01fe('0x3d')]));if(_0x44f667[_0x01fe('0x3f')][_0x01fe('0x47')]){_0x328cab[_0x01fe('0x49')]=_[_0x01fe('0x48')](_0x328cab[_0x01fe('0x49')],{'$or':_[_0x01fe('0x37')](_0x328cab[_0x01fe('0x41')],function(_0x570328){var _0x108013={};_0x108013[_0x570328]={'$like':'%'+_0x44f667[_0x01fe('0x3f')][_0x01fe('0x47')]+'%'};return _0x108013;})});}_0x328cab=_[_0x01fe('0x48')]({},_0x328cab,_0x44f667[_0x01fe('0x4b')]);return _0x12c428[_0x01fe('0x59')](_0x328cab);}})[_0x01fe('0x32')](function(_0x3843dd){if(_0x3843dd){_0x5a71fe=_0x3843dd['length'];if(!_0x44f667[_0x01fe('0x3f')][_0x01fe('0x43')]('nolimit')){_0x328cab[_0x01fe('0x2d')]=qs[_0x01fe('0x2d')](_0x44f667['query'][_0x01fe('0x2d')]);_0x328cab['offset']=qs[_0x01fe('0x2c')](_0x44f667['query'][_0x01fe('0x2c')]);}return _0x12c428['getSubjects'](_0x328cab);}})[_0x01fe('0x32')](function(_0x10e0ea){if(_0x10e0ea){return _0x10e0ea?{'count':_0x5a71fe,'rows':_0x10e0ea}:null;}})[_0x01fe('0x32')](respondWithResult(_0x811d3e,null))[_0x01fe('0x26')](handleError(_0x811d3e,null));};exports['getDescriptions']=function(_0xace64c,_0x3af09d,_0x3202c7){var _0x159404={};var _0x22504b={};var _0x50bcd6;var _0xc59dbe;return db[_0x01fe('0x4c')][_0x01fe('0x55')]({'where':{'id':_0xace64c[_0x01fe('0x54')]['id']}})[_0x01fe('0x32')](handleEntityNotFound(_0x3af09d,null))['then'](function(_0x34a188){if(_0x34a188){_0x50bcd6=_0x34a188;_0x22504b[_0x01fe('0x3b')]=_[_0x01fe('0x3c')](db[_0x01fe('0x56')][_0x01fe('0x38')]);_0x22504b[_0x01fe('0x3f')]=_['keys'](_0xace64c[_0x01fe('0x3f')]);_0x22504b['filters']=_['intersection'](_0x22504b['model'],_0x22504b[_0x01fe('0x3f')]);_0x159404['attributes']=_['intersection'](_0x22504b['model'],qs[_0x01fe('0x40')](_0xace64c[_0x01fe('0x3f')][_0x01fe('0x40')]));_0x159404['attributes']=_0x159404['attributes'][_0x01fe('0x42')]?_0x159404[_0x01fe('0x41')]:_0x22504b[_0x01fe('0x3b')];_0x159404['order']=qs['sort'](_0xace64c[_0x01fe('0x3f')][_0x01fe('0x46')]);_0x159404[_0x01fe('0x49')]=qs[_0x01fe('0x3d')](_[_0x01fe('0x57')](_0xace64c['query'],_0x22504b[_0x01fe('0x3d')]));if(_0xace64c[_0x01fe('0x3f')][_0x01fe('0x47')]){_0x159404[_0x01fe('0x49')]=_[_0x01fe('0x48')](_0x159404[_0x01fe('0x49')],{'$or':_[_0x01fe('0x37')](_0x159404[_0x01fe('0x41')],function(_0x1c53c1){var _0x587771={};_0x587771[_0x1c53c1]={'$like':'%'+_0xace64c[_0x01fe('0x3f')][_0x01fe('0x47')]+'%'};return _0x587771;})});}_0x159404=_[_0x01fe('0x48')]({},_0x159404,_0xace64c[_0x01fe('0x4b')]);return _0x50bcd6[_0x01fe('0x5a')](_0x159404);}})[_0x01fe('0x32')](function(_0x3182d2){if(_0x3182d2){_0xc59dbe=_0x3182d2[_0x01fe('0x42')];if(!_0xace64c[_0x01fe('0x3f')]['hasOwnProperty'](_0x01fe('0x44'))){_0x159404['limit']=qs['limit'](_0xace64c[_0x01fe('0x3f')][_0x01fe('0x2d')]);_0x159404[_0x01fe('0x2c')]=qs['offset'](_0xace64c['query'][_0x01fe('0x2c')]);}return _0x50bcd6['getDescriptions'](_0x159404);}})[_0x01fe('0x32')](function(_0x477b4d){if(_0x477b4d){return _0x477b4d?{'count':_0xc59dbe,'rows':_0x477b4d}:null;}})[_0x01fe('0x32')](respondWithResult(_0x3af09d,null))[_0x01fe('0x26')](handleError(_0x3af09d,null));}; \ No newline at end of file +var _0xf39c=['error','message','info','request\x20sent','result','catch','sendStatus','status','json','count','offset','set','apply','reject','update','destroy','end','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','limit','order','sort','where','pick','merge','VIRTUAL','options','Dynamics365Configuration','includeAll','findAll','show','params','find','create','body','findOne','Dynamics365Field','filter','getFields','hasOwnProperty','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x557f5f,_0x31d8e7){var _0x196eba=function(_0x433d89){while(--_0x433d89){_0x557f5f['push'](_0x557f5f['shift']());}};_0x196eba(++_0x31d8e7);}(_0xf39c,0x19d));var _0xcf39=function(_0xf828bc,_0x262e54){_0xf828bc=_0xf828bc-0x0;var _0x8c6b47=_0xf39c[_0xf828bc];return _0x8c6b47;};'use strict';var pdf=require(_0xcf39('0x0'));var emlformat=require(_0xcf39('0x1'));var rimraf=require(_0xcf39('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcf39('0x3'));var moment=require(_0xcf39('0x4'));var BPromise=require(_0xcf39('0x5'));var Mustache=require(_0xcf39('0x6'));var util=require(_0xcf39('0x7'));var path=require('path');var sox=require(_0xcf39('0x8'));var csv=require(_0xcf39('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcf39('0xa'));var squel=require(_0xcf39('0xb'));var crypto=require(_0xcf39('0xc'));var jsforce=require(_0xcf39('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcf39('0x9'));var querystring=require(_0xcf39('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcf39('0xf'));var qs=require(_0xcf39('0x10'));var as=require(_0xcf39('0x11'));var hardwareService=require(_0xcf39('0x12'));var logger=require(_0xcf39('0x13'))(_0xcf39('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcf39('0x15'));var db=require(_0xcf39('0x16'))['db'];var jayson=require(_0xcf39('0x17'));var client=jayson[_0xcf39('0x18')][_0xcf39('0x19')]({'port':0x232a});function respondWithRpcPromise(_0xf8e988,_0x29ff0b,_0x1659c3,_0x406fd1){return new BPromise(function(_0x46a084,_0x30c23a){var _0x12dd78=_0x406fd1||client;return _0x12dd78[_0xcf39('0x1a')](_0xf8e988,_0x1659c3)[_0xcf39('0x1b')](function(_0x387d3f){logger['info'](_0xcf39('0x1c'),_0x29ff0b,'request\x20sent');logger[_0xcf39('0x1d')](_0xcf39('0x1e'),_0x29ff0b,'request\x20sent',JSON[_0xcf39('0x1f')](_0x387d3f));if(_0x387d3f['error']){if(_0x387d3f[_0xcf39('0x20')]['code']===0x1f4){logger[_0xcf39('0x20')](_0xcf39('0x1c'),_0x29ff0b,_0x387d3f['error'][_0xcf39('0x21')]);return _0x30c23a(_0x387d3f[_0xcf39('0x20')][_0xcf39('0x21')]);}logger['error'](_0xcf39('0x1c'),_0x29ff0b,_0x387d3f[_0xcf39('0x20')]['message']);return _0x46a084(_0x387d3f[_0xcf39('0x20')][_0xcf39('0x21')]);}else{logger[_0xcf39('0x22')](_0xcf39('0x1c'),_0x29ff0b,_0xcf39('0x23'));_0x46a084(_0x387d3f[_0xcf39('0x24')][_0xcf39('0x21')]);}})[_0xcf39('0x25')](function(_0x5eb094){logger[_0xcf39('0x20')](_0xcf39('0x1c'),_0x29ff0b,_0x5eb094);_0x30c23a(_0x5eb094);});});}function respondWithStatusCode(_0x3a2733,_0x45d182){_0x45d182=_0x45d182||0xcc;return function(_0x30e32c){if(_0x30e32c){return _0x3a2733[_0xcf39('0x26')](_0x45d182);}return _0x3a2733[_0xcf39('0x27')](_0x45d182)['end']();};}function respondWithResult(_0x3924eb,_0x5ec029){_0x5ec029=_0x5ec029||0xc8;return function(_0x4582dd){if(_0x4582dd){return _0x3924eb[_0xcf39('0x27')](_0x5ec029)[_0xcf39('0x28')](_0x4582dd);}};}function respondWithFilteredResult(_0x945971,_0x507128){return function(_0x539fc5){if(_0x539fc5){var _0x5546b1=_0x539fc5[_0xcf39('0x29')],_0x549d77=_0x507128[_0xcf39('0x2a')],_0x546b18=_0x507128[_0xcf39('0x2a')]+_0x507128['limit'],_0x5aa7cf;if(_0x546b18>=_0x5546b1){_0x546b18=_0x5546b1;_0x5aa7cf=0xc8;}else{_0x5aa7cf=0xce;}_0x945971[_0xcf39('0x27')](_0x5aa7cf);return _0x945971[_0xcf39('0x2b')]('Content-Range',_0x549d77+'-'+_0x546b18+'/'+_0x5546b1)[_0xcf39('0x28')](_0x539fc5);}return null;};}function patchUpdates(_0x28f06d){return function(_0x393869){try{jsonpatch[_0xcf39('0x2c')](_0x393869,_0x28f06d,!![]);}catch(_0x33c73f){return BPromise[_0xcf39('0x2d')](_0x33c73f);}return _0x393869['save']();};}function saveUpdates(_0x467c12,_0x2b898e){return function(_0x113023){if(_0x113023){return _0x113023[_0xcf39('0x2e')](_0x467c12)['then'](function(_0x37e450){return _0x37e450;});}return null;};}function removeEntity(_0x24a1ce,_0x3e4db4){return function(_0x5bd637){if(_0x5bd637){return _0x5bd637[_0xcf39('0x2f')]()[_0xcf39('0x1b')](function(){_0x24a1ce['status'](0xcc)[_0xcf39('0x30')]();});}};}function handleEntityNotFound(_0x2cc5e0,_0x57ab82){return function(_0x2f2254){if(!_0x2f2254){_0x2cc5e0[_0xcf39('0x26')](0x194);}return _0x2f2254;};}function handleError(_0x1ce135,_0xabcb5){_0xabcb5=_0xabcb5||0x1f4;return function(_0x44f6bd){logger['error'](_0x44f6bd[_0xcf39('0x31')]);if(_0x44f6bd[_0xcf39('0x32')]){delete _0x44f6bd[_0xcf39('0x32')];}_0x1ce135[_0xcf39('0x27')](_0xabcb5)['send'](_0x44f6bd);};}exports[_0xcf39('0x33')]=function(_0x18ff4b,_0x3d1543){var _0x1c6abb={},_0x410cd9={},_0xf42487={'count':0x0,'rows':[]};var _0x4d2b68=_[_0xcf39('0x34')](db['Dynamics365Configuration'][_0xcf39('0x35')],function(_0x259851){return{'name':_0x259851[_0xcf39('0x36')],'type':_0x259851[_0xcf39('0x37')][_0xcf39('0x38')]};});_0x410cd9['model']=_[_0xcf39('0x34')](_0x4d2b68,'name');_0x410cd9[_0xcf39('0x39')]=_[_0xcf39('0x3a')](_0x18ff4b[_0xcf39('0x39')]);_0x410cd9[_0xcf39('0x3b')]=_['intersection'](_0x410cd9['model'],_0x410cd9[_0xcf39('0x39')]);_0x1c6abb[_0xcf39('0x3c')]=_[_0xcf39('0x3d')](_0x410cd9[_0xcf39('0x3e')],qs[_0xcf39('0x3f')](_0x18ff4b['query'][_0xcf39('0x3f')]));_0x1c6abb[_0xcf39('0x3c')]=_0x1c6abb[_0xcf39('0x3c')][_0xcf39('0x40')]?_0x1c6abb[_0xcf39('0x3c')]:_0x410cd9[_0xcf39('0x3e')];if(!_0x18ff4b[_0xcf39('0x39')]['hasOwnProperty']('nolimit')){_0x1c6abb['limit']=qs[_0xcf39('0x41')](_0x18ff4b['query'][_0xcf39('0x41')]);_0x1c6abb[_0xcf39('0x2a')]=qs['offset'](_0x18ff4b['query']['offset']);}_0x1c6abb[_0xcf39('0x42')]=qs[_0xcf39('0x43')](_0x18ff4b[_0xcf39('0x39')][_0xcf39('0x43')]);_0x1c6abb[_0xcf39('0x44')]=qs['filters'](_[_0xcf39('0x45')](_0x18ff4b[_0xcf39('0x39')],_0x410cd9[_0xcf39('0x3b')]),_0x4d2b68);if(_0x18ff4b[_0xcf39('0x39')]['filter']){_0x1c6abb[_0xcf39('0x44')]=_[_0xcf39('0x46')](_0x1c6abb[_0xcf39('0x44')],{'$or':_['map'](_0x4d2b68,function(_0x1a4f7d){if(_0x1a4f7d['type']!==_0xcf39('0x47')){var _0x5b1fe7={};_0x5b1fe7[_0x1a4f7d[_0xcf39('0x32')]]={'$like':'%'+_0x18ff4b[_0xcf39('0x39')]['filter']+'%'};return _0x5b1fe7;}})});}_0x1c6abb=_[_0xcf39('0x46')]({},_0x1c6abb,_0x18ff4b[_0xcf39('0x48')]);var _0x53eb6c={'where':_0x1c6abb[_0xcf39('0x44')]};return db[_0xcf39('0x49')]['count'](_0x53eb6c)[_0xcf39('0x1b')](function(_0x1bb80d){_0xf42487['count']=_0x1bb80d;if(_0x18ff4b[_0xcf39('0x39')][_0xcf39('0x4a')]){_0x1c6abb['include']=[{'all':!![]}];}return db[_0xcf39('0x49')][_0xcf39('0x4b')](_0x1c6abb);})[_0xcf39('0x1b')](function(_0x522ed9){_0xf42487['rows']=_0x522ed9;return _0xf42487;})[_0xcf39('0x1b')](respondWithFilteredResult(_0x3d1543,_0x1c6abb))['catch'](handleError(_0x3d1543,null));};exports[_0xcf39('0x4c')]=function(_0x1517ac,_0x5b7908){var _0x7f488c={'raw':![],'where':{'id':_0x1517ac[_0xcf39('0x4d')]['id']}},_0x286fd2={};_0x286fd2[_0xcf39('0x3e')]=_[_0xcf39('0x3a')](db[_0xcf39('0x49')]['rawAttributes']);_0x286fd2[_0xcf39('0x39')]=_['keys'](_0x1517ac[_0xcf39('0x39')]);_0x286fd2[_0xcf39('0x3b')]=_[_0xcf39('0x3d')](_0x286fd2[_0xcf39('0x3e')],_0x286fd2[_0xcf39('0x39')]);_0x7f488c[_0xcf39('0x3c')]=_[_0xcf39('0x3d')](_0x286fd2[_0xcf39('0x3e')],qs[_0xcf39('0x3f')](_0x1517ac[_0xcf39('0x39')][_0xcf39('0x3f')]));_0x7f488c[_0xcf39('0x3c')]=_0x7f488c[_0xcf39('0x3c')][_0xcf39('0x40')]?_0x7f488c[_0xcf39('0x3c')]:_0x286fd2[_0xcf39('0x3e')];if(_0x1517ac['query'][_0xcf39('0x4a')]){_0x7f488c['include']=[{'all':!![]}];}_0x7f488c=_[_0xcf39('0x46')]({},_0x7f488c,_0x1517ac[_0xcf39('0x48')]);return db[_0xcf39('0x49')][_0xcf39('0x4e')](_0x7f488c)[_0xcf39('0x1b')](handleEntityNotFound(_0x5b7908,null))[_0xcf39('0x1b')](respondWithResult(_0x5b7908,null))[_0xcf39('0x25')](handleError(_0x5b7908,null));};exports[_0xcf39('0x4f')]=function(_0x54e588,_0x37f993){return db['Dynamics365Configuration'][_0xcf39('0x4f')](_0x54e588[_0xcf39('0x50')],{})['then'](respondWithResult(_0x37f993,0xc9))[_0xcf39('0x25')](handleError(_0x37f993,null));};exports[_0xcf39('0x2e')]=function(_0x3f9072,_0x230d1c){if(_0x3f9072[_0xcf39('0x50')]['id']){delete _0x3f9072[_0xcf39('0x50')]['id'];}return db[_0xcf39('0x49')]['find']({'where':{'id':_0x3f9072[_0xcf39('0x4d')]['id']}})['then'](handleEntityNotFound(_0x230d1c,null))[_0xcf39('0x1b')](saveUpdates(_0x3f9072[_0xcf39('0x50')],null))['then'](respondWithResult(_0x230d1c,null))['catch'](handleError(_0x230d1c,null));};exports[_0xcf39('0x2f')]=function(_0x545253,_0x349497){return db[_0xcf39('0x49')][_0xcf39('0x4e')]({'where':{'id':_0x545253[_0xcf39('0x4d')]['id']}})[_0xcf39('0x1b')](handleEntityNotFound(_0x349497,null))[_0xcf39('0x1b')](removeEntity(_0x349497,null))[_0xcf39('0x25')](handleError(_0x349497,null));};exports['getFields']=function(_0x1c295b,_0x21bd4b,_0x422cd3){var _0x232b4b={};var _0x203ed7={};var _0x21d539;var _0x322c28;return db[_0xcf39('0x49')][_0xcf39('0x51')]({'where':{'id':_0x1c295b[_0xcf39('0x4d')]['id']}})[_0xcf39('0x1b')](handleEntityNotFound(_0x21bd4b,null))[_0xcf39('0x1b')](function(_0x30a2b0){if(_0x30a2b0){_0x21d539=_0x30a2b0;_0x203ed7[_0xcf39('0x3e')]=_[_0xcf39('0x3a')](db[_0xcf39('0x52')][_0xcf39('0x35')]);_0x203ed7[_0xcf39('0x39')]=_[_0xcf39('0x3a')](_0x1c295b['query']);_0x203ed7[_0xcf39('0x3b')]=_[_0xcf39('0x3d')](_0x203ed7[_0xcf39('0x3e')],_0x203ed7[_0xcf39('0x39')]);_0x232b4b[_0xcf39('0x3c')]=_[_0xcf39('0x3d')](_0x203ed7['model'],qs[_0xcf39('0x3f')](_0x1c295b[_0xcf39('0x39')][_0xcf39('0x3f')]));_0x232b4b[_0xcf39('0x3c')]=_0x232b4b[_0xcf39('0x3c')][_0xcf39('0x40')]?_0x232b4b['attributes']:_0x203ed7[_0xcf39('0x3e')];_0x232b4b['order']=qs['sort'](_0x1c295b[_0xcf39('0x39')][_0xcf39('0x43')]);_0x232b4b[_0xcf39('0x44')]=qs['filters'](_['pick'](_0x1c295b[_0xcf39('0x39')],_0x203ed7[_0xcf39('0x3b')]));if(_0x1c295b['query'][_0xcf39('0x53')]){_0x232b4b['where']=_[_0xcf39('0x46')](_0x232b4b[_0xcf39('0x44')],{'$or':_[_0xcf39('0x34')](_0x232b4b['attributes'],function(_0x5259f5){var _0x122825={};_0x122825[_0x5259f5]={'$like':'%'+_0x1c295b[_0xcf39('0x39')][_0xcf39('0x53')]+'%'};return _0x122825;})});}_0x232b4b=_[_0xcf39('0x46')]({},_0x232b4b,_0x1c295b[_0xcf39('0x48')]);return _0x21d539[_0xcf39('0x54')](_0x232b4b);}})[_0xcf39('0x1b')](function(_0x1ce137){if(_0x1ce137){_0x322c28=_0x1ce137['length'];if(!_0x1c295b['query'][_0xcf39('0x55')](_0xcf39('0x56'))){_0x232b4b['limit']=qs['limit'](_0x1c295b[_0xcf39('0x39')][_0xcf39('0x41')]);_0x232b4b[_0xcf39('0x2a')]=qs[_0xcf39('0x2a')](_0x1c295b['query'][_0xcf39('0x2a')]);}return _0x21d539['getFields'](_0x232b4b);}})['then'](function(_0x602a1){if(_0x602a1){return _0x602a1?{'count':_0x322c28,'rows':_0x602a1}:null;}})[_0xcf39('0x1b')](respondWithResult(_0x21bd4b,null))[_0xcf39('0x25')](handleError(_0x21bd4b,null));};exports[_0xcf39('0x57')]=function(_0x250e39,_0x57faeb,_0x17bcfc){var _0x467c2={};var _0x39fbab={};var _0x21a67b;var _0x2efd2a;return db[_0xcf39('0x49')]['findOne']({'where':{'id':_0x250e39[_0xcf39('0x4d')]['id']}})[_0xcf39('0x1b')](handleEntityNotFound(_0x57faeb,null))[_0xcf39('0x1b')](function(_0x596c91){if(_0x596c91){_0x21a67b=_0x596c91;_0x39fbab[_0xcf39('0x3e')]=_[_0xcf39('0x3a')](db[_0xcf39('0x52')]['rawAttributes']);_0x39fbab[_0xcf39('0x39')]=_['keys'](_0x250e39[_0xcf39('0x39')]);_0x39fbab[_0xcf39('0x3b')]=_[_0xcf39('0x3d')](_0x39fbab[_0xcf39('0x3e')],_0x39fbab['query']);_0x467c2['attributes']=_[_0xcf39('0x3d')](_0x39fbab[_0xcf39('0x3e')],qs['fields'](_0x250e39[_0xcf39('0x39')][_0xcf39('0x3f')]));_0x467c2[_0xcf39('0x3c')]=_0x467c2[_0xcf39('0x3c')][_0xcf39('0x40')]?_0x467c2[_0xcf39('0x3c')]:_0x39fbab[_0xcf39('0x3e')];_0x467c2['order']=qs[_0xcf39('0x43')](_0x250e39[_0xcf39('0x39')]['sort']);_0x467c2[_0xcf39('0x44')]=qs[_0xcf39('0x3b')](_['pick'](_0x250e39[_0xcf39('0x39')],_0x39fbab[_0xcf39('0x3b')]));if(_0x250e39[_0xcf39('0x39')][_0xcf39('0x53')]){_0x467c2[_0xcf39('0x44')]=_[_0xcf39('0x46')](_0x467c2[_0xcf39('0x44')],{'$or':_[_0xcf39('0x34')](_0x467c2[_0xcf39('0x3c')],function(_0x250989){var _0x32062d={};_0x32062d[_0x250989]={'$like':'%'+_0x250e39[_0xcf39('0x39')]['filter']+'%'};return _0x32062d;})});}_0x467c2=_[_0xcf39('0x46')]({},_0x467c2,_0x250e39[_0xcf39('0x48')]);return _0x21a67b[_0xcf39('0x57')](_0x467c2);}})[_0xcf39('0x1b')](function(_0x2e9312){if(_0x2e9312){_0x2efd2a=_0x2e9312[_0xcf39('0x40')];if(!_0x250e39[_0xcf39('0x39')][_0xcf39('0x55')]('nolimit')){_0x467c2['limit']=qs[_0xcf39('0x41')](_0x250e39['query']['limit']);_0x467c2[_0xcf39('0x2a')]=qs[_0xcf39('0x2a')](_0x250e39[_0xcf39('0x39')][_0xcf39('0x2a')]);}return _0x21a67b['getSubjects'](_0x467c2);}})[_0xcf39('0x1b')](function(_0xc692ad){if(_0xc692ad){return _0xc692ad?{'count':_0x2efd2a,'rows':_0xc692ad}:null;}})[_0xcf39('0x1b')](respondWithResult(_0x57faeb,null))[_0xcf39('0x25')](handleError(_0x57faeb,null));};exports[_0xcf39('0x58')]=function(_0x3d559b,_0x44b2bc,_0x508d6f){var _0x10fae3={};var _0x214fac={};var _0x5c4678;var _0x317dea;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x3d559b[_0xcf39('0x4d')]['id']}})['then'](handleEntityNotFound(_0x44b2bc,null))[_0xcf39('0x1b')](function(_0x283c94){if(_0x283c94){_0x5c4678=_0x283c94;_0x214fac[_0xcf39('0x3e')]=_[_0xcf39('0x3a')](db[_0xcf39('0x52')][_0xcf39('0x35')]);_0x214fac['query']=_[_0xcf39('0x3a')](_0x3d559b[_0xcf39('0x39')]);_0x214fac[_0xcf39('0x3b')]=_[_0xcf39('0x3d')](_0x214fac[_0xcf39('0x3e')],_0x214fac['query']);_0x10fae3[_0xcf39('0x3c')]=_['intersection'](_0x214fac[_0xcf39('0x3e')],qs[_0xcf39('0x3f')](_0x3d559b[_0xcf39('0x39')][_0xcf39('0x3f')]));_0x10fae3['attributes']=_0x10fae3[_0xcf39('0x3c')]['length']?_0x10fae3[_0xcf39('0x3c')]:_0x214fac['model'];_0x10fae3[_0xcf39('0x42')]=qs['sort'](_0x3d559b[_0xcf39('0x39')][_0xcf39('0x43')]);_0x10fae3[_0xcf39('0x44')]=qs[_0xcf39('0x3b')](_[_0xcf39('0x45')](_0x3d559b[_0xcf39('0x39')],_0x214fac['filters']));if(_0x3d559b[_0xcf39('0x39')][_0xcf39('0x53')]){_0x10fae3[_0xcf39('0x44')]=_[_0xcf39('0x46')](_0x10fae3['where'],{'$or':_[_0xcf39('0x34')](_0x10fae3[_0xcf39('0x3c')],function(_0xfa97f7){var _0x4b9592={};_0x4b9592[_0xfa97f7]={'$like':'%'+_0x3d559b[_0xcf39('0x39')][_0xcf39('0x53')]+'%'};return _0x4b9592;})});}_0x10fae3=_[_0xcf39('0x46')]({},_0x10fae3,_0x3d559b[_0xcf39('0x48')]);return _0x5c4678[_0xcf39('0x58')](_0x10fae3);}})[_0xcf39('0x1b')](function(_0x22fa39){if(_0x22fa39){_0x317dea=_0x22fa39[_0xcf39('0x40')];if(!_0x3d559b[_0xcf39('0x39')][_0xcf39('0x55')](_0xcf39('0x56'))){_0x10fae3[_0xcf39('0x41')]=qs['limit'](_0x3d559b[_0xcf39('0x39')]['limit']);_0x10fae3['offset']=qs[_0xcf39('0x2a')](_0x3d559b[_0xcf39('0x39')][_0xcf39('0x2a')]);}return _0x5c4678[_0xcf39('0x58')](_0x10fae3);}})[_0xcf39('0x1b')](function(_0x709166){if(_0x709166){return _0x709166?{'count':_0x317dea,'rows':_0x709166}:null;}})[_0xcf39('0x1b')](respondWithResult(_0x44b2bc,null))[_0xcf39('0x25')](handleError(_0x44b2bc,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 3f95ad4..070bf03 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 _0xe7f8=['Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x1269c6,_0x1c8942){var _0x4868c7=function(_0x1661bc){while(--_0x1661bc){_0x1269c6['push'](_0x1269c6['shift']());}};_0x4868c7(++_0x1c8942);}(_0xe7f8,0x18a));var _0x8e7f=function(_0x2639f5,_0x2a4cd5){_0x2639f5=_0x2639f5-0x0;var _0x4b2cf6=_0xe7f8[_0x2639f5];return _0x4b2cf6;};'use strict';var _=require(_0x8e7f('0x0'));var util=require(_0x8e7f('0x1'));var logger=require('../../config/logger')(_0x8e7f('0x2'));var moment=require(_0x8e7f('0x3'));var BPromise=require(_0x8e7f('0x4'));var rp=require(_0x8e7f('0x5'));var fs=require('fs');var path=require(_0x8e7f('0x6'));var rimraf=require(_0x8e7f('0x7'));var config=require(_0x8e7f('0x8'));var attributes=require(_0x8e7f('0x9'));module[_0x8e7f('0xa')]=function(_0x105b14,_0x42791e){return _0x105b14[_0x8e7f('0xb')](_0x8e7f('0xc'),attributes,{'tableName':_0x8e7f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c99=['int_dynamics365_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','Dynamics365Configuration'];(function(_0x4062de,_0x1a2afd){var _0x3780c2=function(_0x208491){while(--_0x208491){_0x4062de['push'](_0x4062de['shift']());}};_0x3780c2(++_0x1a2afd);}(_0x5c99,0x85));var _0x95c9=function(_0x1a4c39,_0x22b9be){_0x1a4c39=_0x1a4c39-0x0;var _0x174630=_0x5c99[_0x1a4c39];return _0x174630;};'use strict';var _=require(_0x95c9('0x0'));var util=require(_0x95c9('0x1'));var logger=require(_0x95c9('0x2'))('api');var moment=require(_0x95c9('0x3'));var BPromise=require(_0x95c9('0x4'));var rp=require(_0x95c9('0x5'));var fs=require('fs');var path=require(_0x95c9('0x6'));var rimraf=require(_0x95c9('0x7'));var config=require('../../config/environment');var attributes=require('./intDynamics365Configuration.attributes');module[_0x95c9('0x8')]=function(_0x490e5d,_0x294b99){return _0x490e5d[_0x95c9('0x9')](_0x95c9('0xa'),attributes,{'tableName':_0x95c9('0xb'),'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 197b458..e4dce4e 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 _0xba77=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','util','moment','bluebird'];(function(_0x3e00a7,_0x15e0e2){var _0xe16b22=function(_0x42830a){while(--_0x42830a){_0x3e00a7['push'](_0x3e00a7['shift']());}};_0xe16b22(++_0x15e0e2);}(_0xba77,0x1f1));var _0x7ba7=function(_0x5eca50,_0xc1e3f8){_0x5eca50=_0x5eca50-0x0;var _0x41fb84=_0xba77[_0x5eca50];return _0x41fb84;};'use strict';var _=require('lodash');var util=require(_0x7ba7('0x0'));var moment=require(_0x7ba7('0x1'));var BPromise=require(_0x7ba7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ba7('0x3'));var db=require(_0x7ba7('0x4'))['db'];var utils=require(_0x7ba7('0x5'));var logger=require(_0x7ba7('0x6'))(_0x7ba7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7ba7('0x8')][_0x7ba7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x281aa1,_0x831117,_0xe97a38){return new BPromise(function(_0x4254a2,_0x48e26){return client['request'](_0x281aa1,_0xe97a38)[_0x7ba7('0xa')](function(_0x35a991){logger[_0x7ba7('0xb')](_0x7ba7('0xc'),_0x831117,'request\x20sent');logger[_0x7ba7('0xd')](_0x7ba7('0xe'),_0x831117,_0x7ba7('0xf'),JSON['stringify'](_0x35a991));if(_0x35a991[_0x7ba7('0x10')]){if(_0x35a991[_0x7ba7('0x10')][_0x7ba7('0x11')]===0x1f4){logger[_0x7ba7('0x10')](_0x7ba7('0xc'),_0x831117,_0x35a991[_0x7ba7('0x10')][_0x7ba7('0x12')]);return _0x48e26(_0x35a991[_0x7ba7('0x10')][_0x7ba7('0x12')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x831117,_0x35a991['error'][_0x7ba7('0x12')]);return _0x4254a2(_0x35a991[_0x7ba7('0x10')][_0x7ba7('0x12')]);}else{logger[_0x7ba7('0xb')](_0x7ba7('0xc'),_0x831117,_0x7ba7('0xf'));_0x4254a2(_0x35a991['result']['message']);}})[_0x7ba7('0x13')](function(_0x49beef){logger[_0x7ba7('0x10')](_0x7ba7('0xc'),_0x831117,_0x49beef);_0x48e26(_0x49beef);});});} \ No newline at end of file +var _0x8e46=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e46,0xd3));var _0x68e4=function(_0x34ca5a,_0x2f14b1){_0x34ca5a=_0x34ca5a-0x0;var _0x38c2be=_0x8e46[_0x34ca5a];return _0x38c2be;};'use strict';var _=require(_0x68e4('0x0'));var util=require(_0x68e4('0x1'));var moment=require(_0x68e4('0x2'));var BPromise=require(_0x68e4('0x3'));var rs=require(_0x68e4('0x4'));var fs=require('fs');var Redis=require(_0x68e4('0x5'));var db=require(_0x68e4('0x6'))['db'];var utils=require(_0x68e4('0x7'));var logger=require('../../config/logger')(_0x68e4('0x8'));var config=require(_0x68e4('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x68e4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26cf5d,_0x3af6e6,_0x4b7ade){return new BPromise(function(_0x3256bf,_0x1adc5b){return client[_0x68e4('0xb')](_0x26cf5d,_0x4b7ade)[_0x68e4('0xc')](function(_0x4f4478){logger[_0x68e4('0xd')](_0x68e4('0xe'),_0x3af6e6,_0x68e4('0xf'));logger[_0x68e4('0x10')](_0x68e4('0x11'),_0x3af6e6,_0x68e4('0xf'),JSON[_0x68e4('0x12')](_0x4f4478));if(_0x4f4478[_0x68e4('0x13')]){if(_0x4f4478[_0x68e4('0x13')][_0x68e4('0x14')]===0x1f4){logger['error'](_0x68e4('0xe'),_0x3af6e6,_0x4f4478[_0x68e4('0x13')][_0x68e4('0x15')]);return _0x1adc5b(_0x4f4478[_0x68e4('0x13')][_0x68e4('0x15')]);}logger[_0x68e4('0x13')](_0x68e4('0xe'),_0x3af6e6,_0x4f4478[_0x68e4('0x13')][_0x68e4('0x15')]);return _0x3256bf(_0x4f4478[_0x68e4('0x13')][_0x68e4('0x15')]);}else{logger['info'](_0x68e4('0xe'),_0x3af6e6,'request\x20sent');_0x3256bf(_0x4f4478[_0x68e4('0x16')][_0x68e4('0x15')]);}})[_0x68e4('0x17')](function(_0x5268af){logger[_0x68e4('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3af6e6,_0x5268af);_0x1adc5b(_0x5268af);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 71fbdb1..8ef38bf 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 _0xa37e=['post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','/:id'];(function(_0xc1586c,_0x110ef2){var _0xc1f303=function(_0x1a29c4){while(--_0x1a29c4){_0xc1586c['push'](_0xc1586c['shift']());}};_0xc1f303(++_0x110ef2);}(_0xa37e,0x97));var _0xea37=function(_0x3a5d2b,_0x1e5602){_0x3a5d2b=_0x3a5d2b-0x0;var _0x5d086b=_0xa37e[_0x3a5d2b];return _0x5d086b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xea37('0x0'));var timeout=require(_0xea37('0x1'));var express=require(_0xea37('0x2'));var router=express[_0xea37('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xea37('0x4'));var config=require('../../config/environment');var controller=require(_0xea37('0x5'));router[_0xea37('0x6')]('/',auth[_0xea37('0x7')](),controller['index']);router['get'](_0xea37('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xea37('0x9')]('/',auth[_0xea37('0x7')](),controller[_0xea37('0xa')]);router[_0xea37('0xb')]('/:id',auth[_0xea37('0x7')](),controller[_0xea37('0xc')]);router[_0xea37('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xea37('0xe')]);module[_0xea37('0xf')]=router; \ No newline at end of file +var _0x153f=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x342874,_0xae5304){var _0x503c39=function(_0xd68ca4){while(--_0xd68ca4){_0x342874['push'](_0x342874['shift']());}};_0x503c39(++_0xae5304);}(_0x153f,0x15b));var _0xf153=function(_0x48668b,_0x44cb77){_0x48668b=_0x48668b-0x0;var _0x5a3b25=_0x153f[_0x48668b];return _0x5a3b25;};'use strict';var multer=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var timeout=require(_0xf153('0x3'));var express=require(_0xf153('0x4'));var router=express[_0xf153('0x5')]();var auth=require(_0xf153('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf153('0x7'));var controller=require('./intDynamics365Field.controller');router[_0xf153('0x8')]('/',auth[_0xf153('0x9')](),controller[_0xf153('0xa')]);router[_0xf153('0x8')](_0xf153('0xb'),auth['isAuthenticated'](),controller[_0xf153('0xc')]);router[_0xf153('0xd')]('/',auth[_0xf153('0x9')](),controller[_0xf153('0xe')]);router[_0xf153('0xf')](_0xf153('0xb'),auth[_0xf153('0x9')](),controller[_0xf153('0x10')]);router[_0xf153('0x11')](_0xf153('0xb'),auth['isAuthenticated'](),controller[_0xf153('0x12')]);module[_0xf153('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 4628648..486a72c 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 _0x772d=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','exports'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0x772d,0x197));var _0xd772=function(_0x437cc1,_0x2c4cc0){_0x437cc1=_0x437cc1-0x0;var _0x29665d=_0x772d[_0x437cc1];return _0x29665d;};'use strict';var Sequelize=require('sequelize');module[_0xd772('0x0')]={'type':{'type':Sequelize[_0xd772('0x1')](_0xd772('0x2'),_0xd772('0x3'),_0xd772('0x4'),_0xd772('0x5')),'defaultValue':_0xd772('0x2')},'content':{'type':Sequelize[_0xd772('0x6')]},'key':{'type':Sequelize[_0xd772('0x6')]},'keyType':{'type':Sequelize[_0xd772('0x1')](_0xd772('0x2'),_0xd772('0x3'),_0xd772('0x4'))},'keyContent':{'type':Sequelize[_0xd772('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd772('0x6')]},'customField':{'type':Sequelize[_0xd772('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xac65=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x2ad673,_0x5b579c){var _0x4dae3e=function(_0x2b6826){while(--_0x2b6826){_0x2ad673['push'](_0x2ad673['shift']());}};_0x4dae3e(++_0x5b579c);}(_0xac65,0x11d));var _0x5ac6=function(_0x4fa564,_0xb6d0e1){_0x4fa564=_0x4fa564-0x0;var _0x2cd694=_0xac65[_0x4fa564];return _0x2cd694;};'use strict';var Sequelize=require(_0x5ac6('0x0'));module[_0x5ac6('0x1')]={'type':{'type':Sequelize[_0x5ac6('0x2')]('string',_0x5ac6('0x3'),_0x5ac6('0x4'),_0x5ac6('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5ac6('0x6')]},'key':{'type':Sequelize[_0x5ac6('0x6')]},'keyType':{'type':Sequelize[_0x5ac6('0x2')]('string',_0x5ac6('0x3'),_0x5ac6('0x4'))},'keyContent':{'type':Sequelize[_0x5ac6('0x6')]},'idField':{'type':Sequelize[_0x5ac6('0x6')]},'nameField':{'type':Sequelize[_0x5ac6('0x6')]},'customField':{'type':Sequelize[_0x5ac6('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5ac6('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index da28bc6..e24b6bf 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 _0x9b11=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','error','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','keys','body','find','destroy','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x46ad1c,_0x33dcad){var _0x2f483e=function(_0x272f08){while(--_0x272f08){_0x46ad1c['push'](_0x46ad1c['shift']());}};_0x2f483e(++_0x33dcad);}(_0x9b11,0x1a4));var _0x19b1=function(_0x502953,_0x28de83){_0x502953=_0x502953-0x0;var _0x2fa32d=_0x9b11[_0x502953];return _0x2fa32d;};'use strict';var pdf=require(_0x19b1('0x0'));var emlformat=require(_0x19b1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x19b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x19b1('0x3'));var moment=require('moment');var BPromise=require(_0x19b1('0x4'));var Mustache=require(_0x19b1('0x5'));var util=require(_0x19b1('0x6'));var path=require(_0x19b1('0x7'));var sox=require(_0x19b1('0x8'));var csv=require(_0x19b1('0x9'));var ejs=require(_0x19b1('0xa'));var fs=require('fs');var _=require(_0x19b1('0xb'));var squel=require('squel');var crypto=require(_0x19b1('0xc'));var jsforce=require(_0x19b1('0xd'));var deskjs=require(_0x19b1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x19b1('0xf'));var Papa=require(_0x19b1('0x10'));var Redis=require(_0x19b1('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x19b1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x19b1('0x13'))(_0x19b1('0x14'));var utils=require('../../config/utils');var config=require(_0x19b1('0x15'));var licenseUtil=require(_0x19b1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x253335,_0x4246b0){_0x4246b0=_0x4246b0||0xcc;return function(_0x253a1b){if(_0x253a1b){return _0x253335[_0x19b1('0x17')](_0x4246b0);}return _0x253335[_0x19b1('0x18')](_0x4246b0)[_0x19b1('0x19')]();};}function respondWithResult(_0x5e0176,_0x59c5dc){_0x59c5dc=_0x59c5dc||0xc8;return function(_0x8e1037){if(_0x8e1037){return _0x5e0176[_0x19b1('0x18')](_0x59c5dc)[_0x19b1('0x1a')](_0x8e1037);}};}function respondWithFilteredResult(_0x11e8b7,_0x591dfd){return function(_0x4e5c8a){if(_0x4e5c8a){var _0x5b8c5e=_0x4e5c8a['count'],_0x52e1f4=_0x591dfd[_0x19b1('0x1b')],_0x273e0e=_0x591dfd[_0x19b1('0x1b')]+_0x591dfd[_0x19b1('0x1c')],_0xf62589;if(_0x273e0e>=_0x5b8c5e){_0x273e0e=_0x5b8c5e;_0xf62589=0xc8;}else{_0xf62589=0xce;}_0x11e8b7['status'](_0xf62589);return _0x11e8b7[_0x19b1('0x1d')](_0x19b1('0x1e'),_0x52e1f4+'-'+_0x273e0e+'/'+_0x5b8c5e)[_0x19b1('0x1a')](_0x4e5c8a);}return null;};}function patchUpdates(_0x2cbbe0){return function(_0x46c42d){try{jsonpatch[_0x19b1('0x1f')](_0x46c42d,_0x2cbbe0,!![]);}catch(_0x36627a){return BPromise['reject'](_0x36627a);}return _0x46c42d[_0x19b1('0x20')]();};}function saveUpdates(_0x5d246b,_0x5f0625){return function(_0x1eedd5){if(_0x1eedd5){return _0x1eedd5[_0x19b1('0x21')](_0x5d246b)[_0x19b1('0x22')](function(_0x2ba32b){return _0x2ba32b;});}return null;};}function removeEntity(_0x5c14a6,_0x5f3caa){return function(_0x2a4e1b){if(_0x2a4e1b){return _0x2a4e1b['destroy']()['then'](function(){_0x5c14a6[_0x19b1('0x18')](0xcc)[_0x19b1('0x19')]();});}};}function handleEntityNotFound(_0x4dbd3c,_0xf30877){return function(_0x2ab6ea){if(!_0x2ab6ea){_0x4dbd3c[_0x19b1('0x17')](0x194);}return _0x2ab6ea;};}function handleError(_0x1493cd,_0x45ce6d){_0x45ce6d=_0x45ce6d||0x1f4;return function(_0x43316a){logger[_0x19b1('0x23')](_0x43316a['stack']);if(_0x43316a['name']){delete _0x43316a[_0x19b1('0x24')];}_0x1493cd['status'](_0x45ce6d)[_0x19b1('0x25')](_0x43316a);};}exports['index']=function(_0x30b70a,_0x4e5363){var _0x1cb7cc={},_0x4ebb85={},_0x7121f={'count':0x0,'rows':[]};var _0x3a79f7=_[_0x19b1('0x26')](db[_0x19b1('0x27')][_0x19b1('0x28')],function(_0x578c76){return{'name':_0x578c76[_0x19b1('0x29')],'type':_0x578c76[_0x19b1('0x2a')][_0x19b1('0x2b')]};});_0x4ebb85['model']=_[_0x19b1('0x26')](_0x3a79f7,'name');_0x4ebb85['query']=_['keys'](_0x30b70a[_0x19b1('0x2c')]);_0x4ebb85['filters']=_[_0x19b1('0x2d')](_0x4ebb85[_0x19b1('0x2e')],_0x4ebb85[_0x19b1('0x2c')]);_0x1cb7cc[_0x19b1('0x2f')]=_['intersection'](_0x4ebb85['model'],qs[_0x19b1('0x30')](_0x30b70a['query'][_0x19b1('0x30')]));_0x1cb7cc[_0x19b1('0x2f')]=_0x1cb7cc[_0x19b1('0x2f')][_0x19b1('0x31')]?_0x1cb7cc[_0x19b1('0x2f')]:_0x4ebb85[_0x19b1('0x2e')];if(!_0x30b70a['query'][_0x19b1('0x32')](_0x19b1('0x33'))){_0x1cb7cc[_0x19b1('0x1c')]=qs[_0x19b1('0x1c')](_0x30b70a[_0x19b1('0x2c')]['limit']);_0x1cb7cc[_0x19b1('0x1b')]=qs[_0x19b1('0x1b')](_0x30b70a[_0x19b1('0x2c')][_0x19b1('0x1b')]);}_0x1cb7cc[_0x19b1('0x34')]=qs[_0x19b1('0x35')](_0x30b70a[_0x19b1('0x2c')][_0x19b1('0x35')]);_0x1cb7cc[_0x19b1('0x36')]=qs[_0x19b1('0x37')](_[_0x19b1('0x38')](_0x30b70a[_0x19b1('0x2c')],_0x4ebb85[_0x19b1('0x37')]),_0x3a79f7);if(_0x30b70a[_0x19b1('0x2c')][_0x19b1('0x39')]){_0x1cb7cc[_0x19b1('0x36')]=_[_0x19b1('0x3a')](_0x1cb7cc[_0x19b1('0x36')],{'$or':_['map'](_0x3a79f7,function(_0x42be36){if(_0x42be36['type']!==_0x19b1('0x3b')){var _0x219b5f={};_0x219b5f[_0x42be36[_0x19b1('0x24')]]={'$like':'%'+_0x30b70a[_0x19b1('0x2c')][_0x19b1('0x39')]+'%'};return _0x219b5f;}})});}_0x1cb7cc=_[_0x19b1('0x3a')]({},_0x1cb7cc,_0x30b70a[_0x19b1('0x3c')]);var _0x25f240={'where':_0x1cb7cc['where']};return db['Dynamics365Field'][_0x19b1('0x3d')](_0x25f240)[_0x19b1('0x22')](function(_0x59587d){_0x7121f[_0x19b1('0x3d')]=_0x59587d;if(_0x30b70a[_0x19b1('0x2c')][_0x19b1('0x3e')]){_0x1cb7cc[_0x19b1('0x3f')]=[{'all':!![]}];}return db[_0x19b1('0x27')][_0x19b1('0x40')](_0x1cb7cc);})[_0x19b1('0x22')](function(_0x458de5){_0x7121f['rows']=_0x458de5;return _0x7121f;})[_0x19b1('0x22')](respondWithFilteredResult(_0x4e5363,_0x1cb7cc))[_0x19b1('0x41')](handleError(_0x4e5363,null));};exports[_0x19b1('0x42')]=function(_0x55ec4e,_0x5aa3b4){var _0x4deea7={'raw':!![],'where':{'id':_0x55ec4e[_0x19b1('0x43')]['id']}},_0x30b24e={};_0x30b24e['model']=_[_0x19b1('0x44')](db[_0x19b1('0x27')][_0x19b1('0x28')]);_0x30b24e['query']=_[_0x19b1('0x44')](_0x55ec4e[_0x19b1('0x2c')]);_0x30b24e[_0x19b1('0x37')]=_[_0x19b1('0x2d')](_0x30b24e['model'],_0x30b24e[_0x19b1('0x2c')]);_0x4deea7[_0x19b1('0x2f')]=_[_0x19b1('0x2d')](_0x30b24e[_0x19b1('0x2e')],qs[_0x19b1('0x30')](_0x55ec4e[_0x19b1('0x2c')]['fields']));_0x4deea7[_0x19b1('0x2f')]=_0x4deea7[_0x19b1('0x2f')]['length']?_0x4deea7[_0x19b1('0x2f')]:_0x30b24e[_0x19b1('0x2e')];if(_0x55ec4e['query'][_0x19b1('0x3e')]){_0x4deea7[_0x19b1('0x3f')]=[{'all':!![]}];}_0x4deea7=_[_0x19b1('0x3a')]({},_0x4deea7,_0x55ec4e[_0x19b1('0x3c')]);return db['Dynamics365Field']['find'](_0x4deea7)[_0x19b1('0x22')](handleEntityNotFound(_0x5aa3b4,null))[_0x19b1('0x22')](respondWithResult(_0x5aa3b4,null))['catch'](handleError(_0x5aa3b4,null));};exports['create']=function(_0x287251,_0x4070ed){return db[_0x19b1('0x27')]['create'](_0x287251[_0x19b1('0x45')],{})['then'](respondWithResult(_0x4070ed,0xc9))[_0x19b1('0x41')](handleError(_0x4070ed,null));};exports[_0x19b1('0x21')]=function(_0xfc1854,_0x1e9452){if(_0xfc1854['body']['id']){delete _0xfc1854[_0x19b1('0x45')]['id'];}return db[_0x19b1('0x27')][_0x19b1('0x46')]({'where':{'id':_0xfc1854['params']['id']}})[_0x19b1('0x22')](handleEntityNotFound(_0x1e9452,null))[_0x19b1('0x22')](saveUpdates(_0xfc1854[_0x19b1('0x45')],null))[_0x19b1('0x22')](respondWithResult(_0x1e9452,null))[_0x19b1('0x41')](handleError(_0x1e9452,null));};exports[_0x19b1('0x47')]=function(_0x1e530d,_0x580f10){return db[_0x19b1('0x27')][_0x19b1('0x46')]({'where':{'id':_0x1e530d[_0x19b1('0x43')]['id']}})[_0x19b1('0x22')](handleEntityNotFound(_0x580f10,null))[_0x19b1('0x22')](removeEntity(_0x580f10,null))[_0x19b1('0x41')](handleError(_0x580f10,null));}; \ No newline at end of file +var _0x2b41=['limit','Content-Range','reject','save','update','then','destroy','end','error','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','model','query','keys','intersection','fields','length','attributes','order','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset'];(function(_0x2ed76a,_0x517738){var _0x1f4388=function(_0x2baaaa){while(--_0x2baaaa){_0x2ed76a['push'](_0x2ed76a['shift']());}};_0x1f4388(++_0x517738);}(_0x2b41,0x146));var _0x12b4=function(_0x5e45c3,_0x907997){_0x5e45c3=_0x5e45c3-0x0;var _0x5492ac=_0x2b41[_0x5e45c3];return _0x5492ac;};'use strict';var pdf=require(_0x12b4('0x0'));var emlformat=require(_0x12b4('0x1'));var rimraf=require(_0x12b4('0x2'));var zipdir=require(_0x12b4('0x3'));var jsonpatch=require(_0x12b4('0x4'));var rp=require(_0x12b4('0x5'));var moment=require(_0x12b4('0x6'));var BPromise=require(_0x12b4('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x12b4('0x8'));var sox=require(_0x12b4('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x12b4('0xa'));var crypto=require(_0x12b4('0xb'));var jsforce=require(_0x12b4('0xc'));var deskjs=require(_0x12b4('0xd'));var toCsv=require(_0x12b4('0xe'));var querystring=require(_0x12b4('0xf'));var Papa=require(_0x12b4('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x12b4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x12b4('0x12'))(_0x12b4('0x13'));var utils=require(_0x12b4('0x14'));var config=require(_0x12b4('0x15'));var licenseUtil=require(_0x12b4('0x16'));var db=require(_0x12b4('0x17'))['db'];function respondWithStatusCode(_0x1daf42,_0x4f0dda){_0x4f0dda=_0x4f0dda||0xcc;return function(_0x346218){if(_0x346218){return _0x1daf42[_0x12b4('0x18')](_0x4f0dda);}return _0x1daf42[_0x12b4('0x19')](_0x4f0dda)['end']();};}function respondWithResult(_0x14d170,_0x38f8e3){_0x38f8e3=_0x38f8e3||0xc8;return function(_0x45fbbe){if(_0x45fbbe){return _0x14d170['status'](_0x38f8e3)[_0x12b4('0x1a')](_0x45fbbe);}};}function respondWithFilteredResult(_0x4def42,_0x1a8c2b){return function(_0x4e725c){if(_0x4e725c){var _0x1b16a4=_0x4e725c[_0x12b4('0x1b')],_0x3d169d=_0x1a8c2b[_0x12b4('0x1c')],_0x57b5c5=_0x1a8c2b['offset']+_0x1a8c2b[_0x12b4('0x1d')],_0x3682ce;if(_0x57b5c5>=_0x1b16a4){_0x57b5c5=_0x1b16a4;_0x3682ce=0xc8;}else{_0x3682ce=0xce;}_0x4def42['status'](_0x3682ce);return _0x4def42['set'](_0x12b4('0x1e'),_0x3d169d+'-'+_0x57b5c5+'/'+_0x1b16a4)[_0x12b4('0x1a')](_0x4e725c);}return null;};}function patchUpdates(_0x4b0551){return function(_0x378571){try{jsonpatch['apply'](_0x378571,_0x4b0551,!![]);}catch(_0x42b534){return BPromise[_0x12b4('0x1f')](_0x42b534);}return _0x378571[_0x12b4('0x20')]();};}function saveUpdates(_0xa8b30f,_0x54103d){return function(_0x4d5eac){if(_0x4d5eac){return _0x4d5eac[_0x12b4('0x21')](_0xa8b30f)[_0x12b4('0x22')](function(_0x25f4f6){return _0x25f4f6;});}return null;};}function removeEntity(_0xc733d5,_0x3cc6be){return function(_0x5d4429){if(_0x5d4429){return _0x5d4429[_0x12b4('0x23')]()[_0x12b4('0x22')](function(){_0xc733d5['status'](0xcc)[_0x12b4('0x24')]();});}};}function handleEntityNotFound(_0x5d7983,_0x3cc12b){return function(_0x4b31d7){if(!_0x4b31d7){_0x5d7983[_0x12b4('0x18')](0x194);}return _0x4b31d7;};}function handleError(_0x369da2,_0x2f6959){_0x2f6959=_0x2f6959||0x1f4;return function(_0x20216b){logger[_0x12b4('0x25')](_0x20216b['stack']);if(_0x20216b[_0x12b4('0x26')]){delete _0x20216b[_0x12b4('0x26')];}_0x369da2[_0x12b4('0x19')](_0x2f6959)[_0x12b4('0x27')](_0x20216b);};}exports[_0x12b4('0x28')]=function(_0x349c4d,_0x4c7161){var _0x5351c5={},_0x19aa40={},_0x4ec745={'count':0x0,'rows':[]};var _0xaddfe=_[_0x12b4('0x29')](db[_0x12b4('0x2a')][_0x12b4('0x2b')],function(_0x10a109){return{'name':_0x10a109[_0x12b4('0x2c')],'type':_0x10a109[_0x12b4('0x2d')]['key']};});_0x19aa40[_0x12b4('0x2e')]=_['map'](_0xaddfe,_0x12b4('0x26'));_0x19aa40[_0x12b4('0x2f')]=_[_0x12b4('0x30')](_0x349c4d['query']);_0x19aa40['filters']=_[_0x12b4('0x31')](_0x19aa40[_0x12b4('0x2e')],_0x19aa40[_0x12b4('0x2f')]);_0x5351c5['attributes']=_['intersection'](_0x19aa40[_0x12b4('0x2e')],qs[_0x12b4('0x32')](_0x349c4d[_0x12b4('0x2f')]['fields']));_0x5351c5['attributes']=_0x5351c5['attributes'][_0x12b4('0x33')]?_0x5351c5[_0x12b4('0x34')]:_0x19aa40[_0x12b4('0x2e')];if(!_0x349c4d[_0x12b4('0x2f')]['hasOwnProperty']('nolimit')){_0x5351c5[_0x12b4('0x1d')]=qs[_0x12b4('0x1d')](_0x349c4d[_0x12b4('0x2f')][_0x12b4('0x1d')]);_0x5351c5['offset']=qs[_0x12b4('0x1c')](_0x349c4d[_0x12b4('0x2f')][_0x12b4('0x1c')]);}_0x5351c5[_0x12b4('0x35')]=qs[_0x12b4('0x36')](_0x349c4d[_0x12b4('0x2f')][_0x12b4('0x36')]);_0x5351c5['where']=qs[_0x12b4('0x37')](_['pick'](_0x349c4d['query'],_0x19aa40[_0x12b4('0x37')]),_0xaddfe);if(_0x349c4d[_0x12b4('0x2f')][_0x12b4('0x38')]){_0x5351c5[_0x12b4('0x39')]=_[_0x12b4('0x3a')](_0x5351c5[_0x12b4('0x39')],{'$or':_[_0x12b4('0x29')](_0xaddfe,function(_0x29b802){if(_0x29b802[_0x12b4('0x2d')]!==_0x12b4('0x3b')){var _0x4c5aac={};_0x4c5aac[_0x29b802[_0x12b4('0x26')]]={'$like':'%'+_0x349c4d['query'][_0x12b4('0x38')]+'%'};return _0x4c5aac;}})});}_0x5351c5=_['merge']({},_0x5351c5,_0x349c4d[_0x12b4('0x3c')]);var _0x3c28bb={'where':_0x5351c5[_0x12b4('0x39')]};return db[_0x12b4('0x2a')][_0x12b4('0x1b')](_0x3c28bb)[_0x12b4('0x22')](function(_0x38ef98){_0x4ec745[_0x12b4('0x1b')]=_0x38ef98;if(_0x349c4d['query']['includeAll']){_0x5351c5[_0x12b4('0x3d')]=[{'all':!![]}];}return db[_0x12b4('0x2a')][_0x12b4('0x3e')](_0x5351c5);})[_0x12b4('0x22')](function(_0x475f2c){_0x4ec745[_0x12b4('0x3f')]=_0x475f2c;return _0x4ec745;})[_0x12b4('0x22')](respondWithFilteredResult(_0x4c7161,_0x5351c5))['catch'](handleError(_0x4c7161,null));};exports[_0x12b4('0x40')]=function(_0x53113a,_0x57368b){var _0x825584={'raw':!![],'where':{'id':_0x53113a[_0x12b4('0x41')]['id']}},_0x23383c={};_0x23383c[_0x12b4('0x2e')]=_[_0x12b4('0x30')](db[_0x12b4('0x2a')][_0x12b4('0x2b')]);_0x23383c[_0x12b4('0x2f')]=_[_0x12b4('0x30')](_0x53113a[_0x12b4('0x2f')]);_0x23383c[_0x12b4('0x37')]=_[_0x12b4('0x31')](_0x23383c[_0x12b4('0x2e')],_0x23383c[_0x12b4('0x2f')]);_0x825584[_0x12b4('0x34')]=_[_0x12b4('0x31')](_0x23383c['model'],qs[_0x12b4('0x32')](_0x53113a[_0x12b4('0x2f')]['fields']));_0x825584[_0x12b4('0x34')]=_0x825584[_0x12b4('0x34')][_0x12b4('0x33')]?_0x825584['attributes']:_0x23383c[_0x12b4('0x2e')];if(_0x53113a[_0x12b4('0x2f')][_0x12b4('0x42')]){_0x825584[_0x12b4('0x3d')]=[{'all':!![]}];}_0x825584=_[_0x12b4('0x3a')]({},_0x825584,_0x53113a[_0x12b4('0x3c')]);return db[_0x12b4('0x2a')][_0x12b4('0x43')](_0x825584)[_0x12b4('0x22')](handleEntityNotFound(_0x57368b,null))['then'](respondWithResult(_0x57368b,null))[_0x12b4('0x44')](handleError(_0x57368b,null));};exports[_0x12b4('0x45')]=function(_0x7a7833,_0x4e5c89){return db[_0x12b4('0x2a')][_0x12b4('0x45')](_0x7a7833['body'],{})[_0x12b4('0x22')](respondWithResult(_0x4e5c89,0xc9))[_0x12b4('0x44')](handleError(_0x4e5c89,null));};exports['update']=function(_0x220ba2,_0x56cf42){if(_0x220ba2['body']['id']){delete _0x220ba2[_0x12b4('0x46')]['id'];}return db[_0x12b4('0x2a')]['find']({'where':{'id':_0x220ba2[_0x12b4('0x41')]['id']}})[_0x12b4('0x22')](handleEntityNotFound(_0x56cf42,null))[_0x12b4('0x22')](saveUpdates(_0x220ba2[_0x12b4('0x46')],null))['then'](respondWithResult(_0x56cf42,null))['catch'](handleError(_0x56cf42,null));};exports[_0x12b4('0x23')]=function(_0x1da72f,_0x1b2c87){return db[_0x12b4('0x2a')][_0x12b4('0x43')]({'where':{'id':_0x1da72f[_0x12b4('0x41')]['id']}})[_0x12b4('0x22')](handleEntityNotFound(_0x1b2c87,null))[_0x12b4('0x22')](removeEntity(_0x1b2c87,null))['catch'](handleError(_0x1b2c87,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 7a4bedd..23305f8 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 _0xcd06=['../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','idField','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x13c774,_0x4d3531){var _0x5ae4e7=function(_0x43a7b0){while(--_0x43a7b0){_0x13c774['push'](_0x13c774['shift']());}};_0x5ae4e7(++_0x4d3531);}(_0xcd06,0x68));var _0x6cd0=function(_0x2ffb94,_0x2ca599){_0x2ffb94=_0x2ffb94-0x0;var _0x5cb99c=_0xcd06[_0x2ffb94];return _0x5cb99c;};'use strict';var _=require(_0x6cd0('0x0'));var util=require(_0x6cd0('0x1'));var logger=require(_0x6cd0('0x2'))(_0x6cd0('0x3'));var moment=require(_0x6cd0('0x4'));var BPromise=require(_0x6cd0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6cd0('0x6'));var rimraf=require(_0x6cd0('0x7'));var config=require(_0x6cd0('0x8'));var attributes=require(_0x6cd0('0x9'));module['exports']=function(_0x145d9d,_0x1c2116){return _0x145d9d[_0x6cd0('0xa')](_0x6cd0('0xb'),attributes,{'tableName':_0x6cd0('0xc'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x6cd0('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2016=['dynamics365_unique_index','FieldId','lodash','moment','request-promise','path','rimraf','exports','define','Dynamics365Field'];(function(_0x3a5349,_0x39e90b){var _0x3e52e8=function(_0xa9a111){while(--_0xa9a111){_0x3a5349['push'](_0x3a5349['shift']());}};_0x3e52e8(++_0x39e90b);}(_0x2016,0x174));var _0x6201=function(_0x20d175,_0x47721a){_0x20d175=_0x20d175-0x0;var _0xc9078d=_0x2016[_0x20d175];return _0xc9078d;};'use strict';var _=require(_0x6201('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6201('0x1'));var BPromise=require('bluebird');var rp=require(_0x6201('0x2'));var fs=require('fs');var path=require(_0x6201('0x3'));var rimraf=require(_0x6201('0x4'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0x6201('0x5')]=function(_0x39d3ed,_0xbac9e8){return _0x39d3ed[_0x6201('0x6')](_0x6201('0x7'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x6201('0x8'),'fields':['idField',_0x6201('0x9')],'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 65c8451..6e3829a 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 _0x1a38=['lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x3de3be,_0x248c25){var _0x33a8f4=function(_0x38a0bd){while(--_0x38a0bd){_0x3de3be['push'](_0x3de3be['shift']());}};_0x33a8f4(++_0x248c25);}(_0x1a38,0xb0));var _0x81a3=function(_0x1acc2d,_0x597696){_0x1acc2d=_0x1acc2d-0x0;var _0xabfa6d=_0x1a38[_0x1acc2d];return _0xabfa6d;};'use strict';var _=require(_0x81a3('0x0'));var util=require(_0x81a3('0x1'));var moment=require(_0x81a3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81a3('0x3'))['db'];var utils=require(_0x81a3('0x4'));var logger=require(_0x81a3('0x5'))(_0x81a3('0x6'));var config=require(_0x81a3('0x7'));var jayson=require(_0x81a3('0x8'));var client=jayson[_0x81a3('0x9')][_0x81a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3153ee,_0x2d331e,_0x207345){return new BPromise(function(_0xe10e0a,_0x3be616){return client['request'](_0x3153ee,_0x207345)[_0x81a3('0xb')](function(_0x252685){logger[_0x81a3('0xc')](_0x81a3('0xd'),_0x2d331e,_0x81a3('0xe'));logger['debug'](_0x81a3('0xf'),_0x2d331e,_0x81a3('0xe'),JSON[_0x81a3('0x10')](_0x252685));if(_0x252685['error']){if(_0x252685['error'][_0x81a3('0x11')]===0x1f4){logger[_0x81a3('0x12')](_0x81a3('0xd'),_0x2d331e,_0x252685[_0x81a3('0x12')][_0x81a3('0x13')]);return _0x3be616(_0x252685[_0x81a3('0x12')][_0x81a3('0x13')]);}logger[_0x81a3('0x12')](_0x81a3('0xd'),_0x2d331e,_0x252685[_0x81a3('0x12')][_0x81a3('0x13')]);return _0xe10e0a(_0x252685[_0x81a3('0x12')]['message']);}else{logger[_0x81a3('0xc')](_0x81a3('0xd'),_0x2d331e,_0x81a3('0xe'));_0xe10e0a(_0x252685[_0x81a3('0x14')]['message']);}})[_0x81a3('0x15')](function(_0x18fc8d){logger['error'](_0x81a3('0xd'),_0x2d331e,_0x18fc8d);_0x3be616(_0x18fc8d);});});} \ No newline at end of file +var _0xa6bb=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch'];(function(_0x5825a4,_0x7c714a){var _0x5b13c1=function(_0x73c371){while(--_0x73c371){_0x5825a4['push'](_0x5825a4['shift']());}};_0x5b13c1(++_0x7c714a);}(_0xa6bb,0x12c));var _0xba6b=function(_0x3f28b1,_0x1fafcb){_0x3f28b1=_0x3f28b1-0x0;var _0x1bdcf8=_0xa6bb[_0x3f28b1];return _0x1bdcf8;};'use strict';var _=require('lodash');var util=require(_0xba6b('0x0'));var moment=require(_0xba6b('0x1'));var BPromise=require(_0xba6b('0x2'));var rs=require(_0xba6b('0x3'));var fs=require('fs');var Redis=require(_0xba6b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xba6b('0x5'))(_0xba6b('0x6'));var config=require(_0xba6b('0x7'));var jayson=require(_0xba6b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a00d6,_0x4f6c6c,_0x2f305e){return new BPromise(function(_0x5506d6,_0x55f5c3){return client[_0xba6b('0x9')](_0x2a00d6,_0x2f305e)[_0xba6b('0xa')](function(_0x2cab30){logger[_0xba6b('0xb')](_0xba6b('0xc'),_0x4f6c6c,'request\x20sent');logger[_0xba6b('0xd')](_0xba6b('0xe'),_0x4f6c6c,_0xba6b('0xf'),JSON['stringify'](_0x2cab30));if(_0x2cab30[_0xba6b('0x10')]){if(_0x2cab30[_0xba6b('0x10')][_0xba6b('0x11')]===0x1f4){logger[_0xba6b('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x4f6c6c,_0x2cab30[_0xba6b('0x10')]['message']);return _0x55f5c3(_0x2cab30[_0xba6b('0x10')][_0xba6b('0x12')]);}logger[_0xba6b('0x10')](_0xba6b('0xc'),_0x4f6c6c,_0x2cab30[_0xba6b('0x10')]['message']);return _0x5506d6(_0x2cab30[_0xba6b('0x10')][_0xba6b('0x12')]);}else{logger['info'](_0xba6b('0xc'),_0x4f6c6c,_0xba6b('0xf'));_0x5506d6(_0x2cab30['result']['message']);}})[_0xba6b('0x13')](function(_0x5b32cd){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x4f6c6c,_0x5b32cd);_0x55f5c3(_0x5b32cd);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index fef12bc..8daac4c 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 _0x8351=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put'];(function(_0x48c550,_0x428ac2){var _0x4bf9ee=function(_0x265900){while(--_0x265900){_0x48c550['push'](_0x48c550['shift']());}};_0x4bf9ee(++_0x428ac2);}(_0x8351,0x18b));var _0x1835=function(_0x4f0f27,_0x51deba){_0x4f0f27=_0x4f0f27-0x0;var _0x2ce661=_0x8351[_0x4f0f27];return _0x2ce661;};'use strict';var multer=require(_0x1835('0x0'));var util=require(_0x1835('0x1'));var path=require(_0x1835('0x2'));var timeout=require(_0x1835('0x3'));var express=require('express');var router=express[_0x1835('0x4')]();var auth=require(_0x1835('0x5'));var interaction=require(_0x1835('0x6'));var config=require(_0x1835('0x7'));var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth[_0x1835('0x8')](),controller[_0x1835('0x9')]);router[_0x1835('0xa')](_0x1835('0xb'),auth[_0x1835('0x8')](),controller['show']);router['get']('/:id/configurations',auth[_0x1835('0x8')](),controller[_0x1835('0xc')]);router['get'](_0x1835('0xd'),auth['isAuthenticated'](),controller[_0x1835('0xe')]);router[_0x1835('0xf')]('/',auth[_0x1835('0x8')](),controller['create']);router[_0x1835('0xf')](_0x1835('0x10'),auth[_0x1835('0x8')](),controller[_0x1835('0x11')]);router[_0x1835('0x12')](_0x1835('0xb'),auth['isAuthenticated'](),controller[_0x1835('0x13')]);router[_0x1835('0x14')](_0x1835('0xb'),auth[_0x1835('0x8')](),controller[_0x1835('0x15')]);module[_0x1835('0x16')]=router; \ No newline at end of file +var _0xe187=['create','addConfiguration','put','update','delete','/:id','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id/configurations','getConfigurations','getFields','post'];(function(_0x4c996c,_0x214f7c){var _0x4a84fc=function(_0x828e7b){while(--_0x828e7b){_0x4c996c['push'](_0x4c996c['shift']());}};_0x4a84fc(++_0x214f7c);}(_0xe187,0x125));var _0x7e18=function(_0x499ea6,_0x105051){_0x499ea6=_0x499ea6-0x0;var _0x43cdc8=_0xe187[_0x499ea6];return _0x43cdc8;};'use strict';var multer=require(_0x7e18('0x0'));var util=require('util');var path=require(_0x7e18('0x1'));var timeout=require(_0x7e18('0x2'));var express=require('express');var router=express[_0x7e18('0x3')]();var auth=require(_0x7e18('0x4'));var interaction=require(_0x7e18('0x5'));var config=require(_0x7e18('0x6'));var controller=require(_0x7e18('0x7'));router['get']('/',auth[_0x7e18('0x8')](),controller[_0x7e18('0x9')]);router[_0x7e18('0xa')]('/:id',auth[_0x7e18('0x8')](),controller['show']);router[_0x7e18('0xa')](_0x7e18('0xb'),auth[_0x7e18('0x8')](),controller[_0x7e18('0xc')]);router['get']('/:id/fields',auth[_0x7e18('0x8')](),controller[_0x7e18('0xd')]);router[_0x7e18('0xe')]('/',auth[_0x7e18('0x8')](),controller[_0x7e18('0xf')]);router[_0x7e18('0xe')](_0x7e18('0xb'),auth['isAuthenticated'](),controller[_0x7e18('0x10')]);router[_0x7e18('0x11')]('/:id',auth[_0x7e18('0x8')](),controller[_0x7e18('0x12')]);router[_0x7e18('0x13')](_0x7e18('0x14'),auth['isAuthenticated'](),controller[_0x7e18('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 7e12635..2302d6a 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 _0x2e77=['STRING','username','remoteUri','sequelize','exports'];(function(_0x4bfcbe,_0x4630f5){var _0x5b65e6=function(_0x5dcfc8){while(--_0x5dcfc8){_0x4bfcbe['push'](_0x4bfcbe['shift']());}};_0x5b65e6(++_0x4630f5);}(_0x2e77,0xc6));var _0x72e7=function(_0x17ba9b,_0x1ad9f2){_0x17ba9b=_0x17ba9b-0x0;var _0x849e8c=_0x2e77[_0x17ba9b];return _0x849e8c;};'use strict';var Sequelize=require(_0x72e7('0x0'));module[_0x72e7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x72e7('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x72e7('0x3')},'apiKey':{'type':Sequelize[_0x72e7('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x72e7('0x4')},'serverUrl':{'type':Sequelize[_0x72e7('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x9e3c=['username','remoteUri','sequelize','exports','STRING'];(function(_0x4997ce,_0x23efc3){var _0x50f9cc=function(_0x464d99){while(--_0x464d99){_0x4997ce['push'](_0x4997ce['shift']());}};_0x50f9cc(++_0x23efc3);}(_0x9e3c,0x1a6));var _0xc9e3=function(_0xb93e37,_0x3643bf){_0xb93e37=_0xb93e37-0x0;var _0x275cad=_0x9e3c[_0xb93e37];return _0x275cad;};'use strict';var Sequelize=require(_0xc9e3('0x0'));module[_0xc9e3('0x1')]={'name':{'type':Sequelize[_0xc9e3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc9e3('0x2')],'unique':_0xc9e3('0x3')},'apiKey':{'type':Sequelize[_0xc9e3('0x2')]},'remoteUri':{'type':Sequelize[_0xc9e3('0x2')],'unique':_0xc9e3('0x4')},'serverUrl':{'type':Sequelize[_0xc9e3('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 0dbf005..1a82e3f 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 _0x1656=['company','includes','default','custom_text','custom_dropdown','choices','capitalize','statusCode','send','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','count','includeAll','show','params','find','create','body','findOne','FreshdeskConfiguration','order','options','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','substring','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','agent','description','priority','group','source','ticket_type'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1656,0xfb));var _0x6165=function(_0x550eb7,_0x465856){_0x550eb7=_0x550eb7-0x0;var _0x33bffe=_0x1656[_0x550eb7];return _0x33bffe;};'use strict';var pdf=require(_0x6165('0x0'));var emlformat=require(_0x6165('0x1'));var rimraf=require(_0x6165('0x2'));var zipdir=require(_0x6165('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6165('0x4'));var moment=require('moment');var BPromise=require(_0x6165('0x5'));var Mustache=require(_0x6165('0x6'));var util=require('util');var path=require(_0x6165('0x7'));var sox=require('sox');var csv=require(_0x6165('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6165('0x9'));var crypto=require('crypto');var jsforce=require(_0x6165('0xa'));var deskjs=require(_0x6165('0xb'));var toCsv=require(_0x6165('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6165('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x6165('0xd'));var as=require(_0x6165('0xe'));var hardwareService=require(_0x6165('0xf'));var logger=require(_0x6165('0x10'))(_0x6165('0x11'));var utils=require('../../config/utils');var config=require(_0x6165('0x12'));var licenseUtil=require(_0x6165('0x13'));var db=require(_0x6165('0x14'))['db'];var integrations=require(_0x6165('0x15'));var jayson=require(_0x6165('0x16'));var client=jayson[_0x6165('0x17')][_0x6165('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1baf5c,_0x39e857,_0x4a873e,_0x430222){return new BPromise(function(_0x3fe380,_0x3a42dc){var _0x161f94=_0x430222||client;return _0x161f94[_0x6165('0x19')](_0x1baf5c,_0x4a873e)[_0x6165('0x1a')](function(_0x4da7cf){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x39e857,_0x6165('0x1b'));logger[_0x6165('0x1c')](_0x6165('0x1d'),_0x39e857,_0x6165('0x1b'),JSON[_0x6165('0x1e')](_0x4da7cf));if(_0x4da7cf[_0x6165('0x1f')]){if(_0x4da7cf[_0x6165('0x1f')]['code']===0x1f4){logger['error'](_0x6165('0x20'),_0x39e857,_0x4da7cf[_0x6165('0x1f')][_0x6165('0x21')]);return _0x3a42dc(_0x4da7cf['error']['message']);}logger[_0x6165('0x1f')](_0x6165('0x20'),_0x39e857,_0x4da7cf[_0x6165('0x1f')]['message']);return _0x3fe380(_0x4da7cf[_0x6165('0x1f')][_0x6165('0x21')]);}else{logger[_0x6165('0x22')](_0x6165('0x20'),_0x39e857,_0x6165('0x1b'));_0x3fe380(_0x4da7cf['result'][_0x6165('0x21')]);}})[_0x6165('0x23')](function(_0x59d2c5){logger[_0x6165('0x1f')](_0x6165('0x20'),_0x39e857,_0x59d2c5);_0x3a42dc(_0x59d2c5);});});}function respondWithStatusCode(_0x76ce6a,_0x1a24f1){_0x1a24f1=_0x1a24f1||0xcc;return function(_0xb3273c){if(_0xb3273c){return _0x76ce6a[_0x6165('0x24')](_0x1a24f1);}return _0x76ce6a[_0x6165('0x25')](_0x1a24f1)[_0x6165('0x26')]();};}function respondWithResult(_0x381507,_0x4a1b3f){_0x4a1b3f=_0x4a1b3f||0xc8;return function(_0x1be5eb){if(_0x1be5eb){return _0x381507['status'](_0x4a1b3f)[_0x6165('0x27')](_0x1be5eb);}};}function respondWithFilteredResult(_0x1e0a33,_0x39c56a){return function(_0x5e2b82){if(_0x5e2b82){var _0x2844fd=_0x5e2b82['count'],_0x1397b1=_0x39c56a[_0x6165('0x28')],_0x26b61e=_0x39c56a[_0x6165('0x28')]+_0x39c56a[_0x6165('0x29')],_0x2e7caa;if(_0x26b61e>=_0x2844fd){_0x26b61e=_0x2844fd;_0x2e7caa=0xc8;}else{_0x2e7caa=0xce;}_0x1e0a33[_0x6165('0x25')](_0x2e7caa);return _0x1e0a33[_0x6165('0x2a')](_0x6165('0x2b'),_0x1397b1+'-'+_0x26b61e+'/'+_0x2844fd)[_0x6165('0x27')](_0x5e2b82);}return null;};}function patchUpdates(_0xe77c03){return function(_0x6458a7){try{jsonpatch['apply'](_0x6458a7,_0xe77c03,!![]);}catch(_0x2d912b){return BPromise[_0x6165('0x2c')](_0x2d912b);}return _0x6458a7[_0x6165('0x2d')]();};}function saveUpdates(_0x2cc5a0,_0x32e1a9){return function(_0x2f6888){if(_0x2f6888){return _0x2f6888[_0x6165('0x2e')](_0x2cc5a0)[_0x6165('0x1a')](function(_0x193e45){return _0x193e45;});}return null;};}function removeEntity(_0x330042,_0x27720e){return function(_0x3e7ca1){if(_0x3e7ca1){return _0x3e7ca1[_0x6165('0x2f')]()[_0x6165('0x1a')](function(){_0x330042[_0x6165('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35a795,_0x15fef7){return function(_0x5f3a2f){if(!_0x5f3a2f){_0x35a795[_0x6165('0x24')](0x194);}return _0x5f3a2f;};}function handleError(_0x28e2fb,_0x23b09f){_0x23b09f=_0x23b09f||0x1f4;return function(_0x143961){logger['error'](_0x143961[_0x6165('0x30')]);if(_0x143961[_0x6165('0x31')]){delete _0x143961[_0x6165('0x31')];}_0x28e2fb['status'](_0x23b09f)['send'](_0x143961);};}exports['index']=function(_0x253d4d,_0x5975a7){var _0x499c70={},_0x5dd491={},_0x766737={'count':0x0,'rows':[]};var _0x2d8170=_[_0x6165('0x32')](db[_0x6165('0x33')][_0x6165('0x34')],function(_0x373bb2){return{'name':_0x373bb2[_0x6165('0x35')],'type':_0x373bb2[_0x6165('0x36')][_0x6165('0x37')]};});_0x5dd491[_0x6165('0x38')]=_['map'](_0x2d8170,'name');_0x5dd491['query']=_[_0x6165('0x39')](_0x253d4d['query']);_0x5dd491[_0x6165('0x3a')]=_[_0x6165('0x3b')](_0x5dd491[_0x6165('0x38')],_0x5dd491[_0x6165('0x3c')]);_0x499c70['attributes']=_[_0x6165('0x3b')](_0x5dd491[_0x6165('0x38')],qs[_0x6165('0x3d')](_0x253d4d[_0x6165('0x3c')]['fields']));_0x499c70[_0x6165('0x3e')]=_0x499c70[_0x6165('0x3e')][_0x6165('0x3f')]?_0x499c70[_0x6165('0x3e')]:_0x5dd491[_0x6165('0x38')];if(!_0x253d4d[_0x6165('0x3c')][_0x6165('0x40')](_0x6165('0x41'))){_0x499c70[_0x6165('0x29')]=qs[_0x6165('0x29')](_0x253d4d[_0x6165('0x3c')][_0x6165('0x29')]);_0x499c70[_0x6165('0x28')]=qs[_0x6165('0x28')](_0x253d4d[_0x6165('0x3c')][_0x6165('0x28')]);}_0x499c70['order']=qs[_0x6165('0x42')](_0x253d4d[_0x6165('0x3c')]['sort']);_0x499c70[_0x6165('0x43')]=qs[_0x6165('0x3a')](_[_0x6165('0x44')](_0x253d4d[_0x6165('0x3c')],_0x5dd491['filters']),_0x2d8170);if(_0x253d4d['query'][_0x6165('0x45')]){_0x499c70[_0x6165('0x43')]=_[_0x6165('0x46')](_0x499c70[_0x6165('0x43')],{'$or':_[_0x6165('0x32')](_0x2d8170,function(_0x4872ac){if(_0x4872ac[_0x6165('0x36')]!=='VIRTUAL'){var _0x35621b={};_0x35621b[_0x4872ac['name']]={'$like':'%'+_0x253d4d[_0x6165('0x3c')][_0x6165('0x45')]+'%'};return _0x35621b;}})});}_0x499c70=_['merge']({},_0x499c70,_0x253d4d['options']);var _0x11e823={'where':_0x499c70[_0x6165('0x43')]};return db[_0x6165('0x33')][_0x6165('0x47')](_0x11e823)['then'](function(_0x5890b1){_0x766737[_0x6165('0x47')]=_0x5890b1;if(_0x253d4d['query'][_0x6165('0x48')]){_0x499c70['include']=[{'all':!![]}];}return db[_0x6165('0x33')]['findAll'](_0x499c70);})[_0x6165('0x1a')](function(_0x3a982c){_0x766737['rows']=_0x3a982c;return _0x766737;})[_0x6165('0x1a')](respondWithFilteredResult(_0x5975a7,_0x499c70))[_0x6165('0x23')](handleError(_0x5975a7,null));};exports[_0x6165('0x49')]=function(_0x118331,_0x5a33de){var _0x282128={'raw':![],'where':{'id':_0x118331[_0x6165('0x4a')]['id']}},_0x12cf6={};_0x12cf6[_0x6165('0x38')]=_[_0x6165('0x39')](db['FreshdeskAccount']['rawAttributes']);_0x12cf6[_0x6165('0x3c')]=_[_0x6165('0x39')](_0x118331[_0x6165('0x3c')]);_0x12cf6['filters']=_[_0x6165('0x3b')](_0x12cf6[_0x6165('0x38')],_0x12cf6[_0x6165('0x3c')]);_0x282128[_0x6165('0x3e')]=_['intersection'](_0x12cf6[_0x6165('0x38')],qs[_0x6165('0x3d')](_0x118331[_0x6165('0x3c')][_0x6165('0x3d')]));_0x282128[_0x6165('0x3e')]=_0x282128[_0x6165('0x3e')][_0x6165('0x3f')]?_0x282128['attributes']:_0x12cf6[_0x6165('0x38')];if(_0x118331['query'][_0x6165('0x48')]){_0x282128['include']=[{'all':!![]}];}_0x282128=_[_0x6165('0x46')]({},_0x282128,_0x118331['options']);return db['FreshdeskAccount'][_0x6165('0x4b')](_0x282128)[_0x6165('0x1a')](handleEntityNotFound(_0x5a33de,null))[_0x6165('0x1a')](respondWithResult(_0x5a33de,null))[_0x6165('0x23')](handleError(_0x5a33de,null));};exports['create']=function(_0x33b082,_0x27567d){return db['FreshdeskAccount'][_0x6165('0x4c')](_0x33b082[_0x6165('0x4d')],{})[_0x6165('0x1a')](respondWithResult(_0x27567d,0xc9))['catch'](handleError(_0x27567d,null));};exports['update']=function(_0x42bffd,_0x1f2aeb){if(_0x42bffd['body']['id']){delete _0x42bffd[_0x6165('0x4d')]['id'];}return db[_0x6165('0x33')]['find']({'where':{'id':_0x42bffd['params']['id']}})[_0x6165('0x1a')](handleEntityNotFound(_0x1f2aeb,null))['then'](saveUpdates(_0x42bffd[_0x6165('0x4d')],null))['then'](respondWithResult(_0x1f2aeb,null))[_0x6165('0x23')](handleError(_0x1f2aeb,null));};exports[_0x6165('0x2f')]=function(_0x53ab9b,_0xad939e){return db[_0x6165('0x33')][_0x6165('0x4b')]({'where':{'id':_0x53ab9b[_0x6165('0x4a')]['id']}})[_0x6165('0x1a')](handleEntityNotFound(_0xad939e,null))[_0x6165('0x1a')](removeEntity(_0xad939e,null))[_0x6165('0x23')](handleError(_0xad939e,null));};exports['getConfigurations']=function(_0x30fe3a,_0x555122,_0x2d2073){var _0x1ed643={};var _0xa2aafb={};var _0x286734;var _0x392e04;return db[_0x6165('0x33')][_0x6165('0x4e')]({'where':{'id':_0x30fe3a[_0x6165('0x4a')]['id']}})['then'](handleEntityNotFound(_0x555122,null))[_0x6165('0x1a')](function(_0x4327e6){if(_0x4327e6){_0x286734=_0x4327e6;_0xa2aafb[_0x6165('0x38')]=_['keys'](db[_0x6165('0x4f')][_0x6165('0x34')]);_0xa2aafb[_0x6165('0x3c')]=_[_0x6165('0x39')](_0x30fe3a[_0x6165('0x3c')]);_0xa2aafb[_0x6165('0x3a')]=_['intersection'](_0xa2aafb[_0x6165('0x38')],_0xa2aafb['query']);_0x1ed643[_0x6165('0x3e')]=_[_0x6165('0x3b')](_0xa2aafb[_0x6165('0x38')],qs[_0x6165('0x3d')](_0x30fe3a[_0x6165('0x3c')][_0x6165('0x3d')]));_0x1ed643['attributes']=_0x1ed643['attributes'][_0x6165('0x3f')]?_0x1ed643[_0x6165('0x3e')]:_0xa2aafb[_0x6165('0x38')];_0x1ed643[_0x6165('0x50')]=qs[_0x6165('0x42')](_0x30fe3a[_0x6165('0x3c')][_0x6165('0x42')]);_0x1ed643[_0x6165('0x43')]=qs[_0x6165('0x3a')](_[_0x6165('0x44')](_0x30fe3a['query'],_0xa2aafb[_0x6165('0x3a')]));if(_0x30fe3a[_0x6165('0x3c')][_0x6165('0x45')]){_0x1ed643[_0x6165('0x43')]=_['merge'](_0x1ed643[_0x6165('0x43')],{'$or':_['map'](_0x1ed643[_0x6165('0x3e')],function(_0x3546e2){var _0x4cc393={};_0x4cc393[_0x3546e2]={'$like':'%'+_0x30fe3a[_0x6165('0x3c')][_0x6165('0x45')]+'%'};return _0x4cc393;})});}_0x1ed643=_[_0x6165('0x46')]({},_0x1ed643,_0x30fe3a[_0x6165('0x51')]);return _0x286734[_0x6165('0x52')](_0x1ed643);}})[_0x6165('0x1a')](function(_0x1c46e5){if(_0x1c46e5){_0x392e04=_0x1c46e5[_0x6165('0x3f')];if(!_0x30fe3a[_0x6165('0x3c')][_0x6165('0x40')](_0x6165('0x41'))){_0x1ed643[_0x6165('0x29')]=qs[_0x6165('0x29')](_0x30fe3a[_0x6165('0x3c')]['limit']);_0x1ed643['offset']=qs[_0x6165('0x28')](_0x30fe3a[_0x6165('0x3c')][_0x6165('0x28')]);}return _0x286734[_0x6165('0x52')](_0x1ed643);}})[_0x6165('0x1a')](function(_0x16f211){if(_0x16f211){return _0x16f211?{'count':_0x392e04,'rows':_0x16f211}:null;}})[_0x6165('0x1a')](respondWithResult(_0x555122,null))[_0x6165('0x23')](handleError(_0x555122,null));};exports[_0x6165('0x53')]=function(_0x46348d,_0x19a1a8,_0x28cd59){if(_0x46348d[_0x6165('0x4d')]['id']){delete _0x46348d['body']['id'];}return db[_0x6165('0x33')]['findOne']({'where':{'id':_0x46348d[_0x6165('0x4a')]['id']}})['then'](handleEntityNotFound(_0x19a1a8,null))['then'](function(_0x39f7dc){if(_0x39f7dc){_0x46348d[_0x6165('0x4d')][_0x6165('0x54')]=_0x39f7dc['id'];_0x46348d['body'][_0x6165('0x55')]=integrations['getSubjects'](_0x46348d[_0x6165('0x4d')][_0x6165('0x56')],_0x46348d[_0x6165('0x4d')][_0x6165('0x36')]);_0x46348d[_0x6165('0x4d')][_0x6165('0x57')]=integrations[_0x6165('0x58')](_0x46348d[_0x6165('0x4d')]['channel'],_0x46348d[_0x6165('0x4d')][_0x6165('0x36')]);return db[_0x6165('0x4f')][_0x6165('0x4c')](_0x46348d[_0x6165('0x4d')],{'include':[{'model':db['FreshdeskField'],'as':'Subjects'},{'model':db[_0x6165('0x59')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x19a1a8,null))[_0x6165('0x23')](handleError(_0x19a1a8,null));};exports[_0x6165('0x5a')]=function(_0xb53b2c,_0x30affc,_0x5811a2){var _0x486935='';return db[_0x6165('0x33')][_0x6165('0x4e')]({'where':{'id':_0xb53b2c[_0x6165('0x4a')]['id']},'attributes':['id',_0x6165('0x5b'),_0x6165('0x5c')]})[_0x6165('0x1a')](handleEntityNotFound(_0x30affc,null))['then'](function(_0x23c2c6){if(_0x23c2c6){_0x486935=_0x23c2c6['remoteUri'];var _0x50e8c3=_0x486935['slice'](-0x1);if(_0x50e8c3==='/'){_0x486935=_0x486935[_0x6165('0x5d')](0x0,_0x486935['lastIndexOf'](_0x50e8c3));}return rp({'method':_0x6165('0x5e'),'uri':util[_0x6165('0x5f')](_0x6165('0x60'),_0x486935,_0x6165('0x61')),'headers':{'Authorization':util['format'](_0x6165('0x62'),new Buffer(util[_0x6165('0x5f')](_0x6165('0x63'),_0x23c2c6[_0x6165('0x5c')]))[_0x6165('0x64')](_0x6165('0x65')))},'json':!![]});}})[_0x6165('0x1a')](function(_0x317b0c){if(_0x317b0c){var _0x1edfc2=[_0x6165('0x66'),'subject',_0x6165('0x67'),_0x6165('0x68'),_0x6165('0x25'),_0x6165('0x69'),_0x6165('0x6a'),_0x6165('0x6b'),_0x6165('0x6c'),_0x6165('0x6a'),_0x6165('0x6d')];_['remove'](_0x317b0c,function(_0x315eaf){return _0x1edfc2[_0x6165('0x6e')](_0x315eaf[_0x6165('0x31')])||!_0x315eaf[_0x6165('0x6f')]&&_0x315eaf['type']!==_0x6165('0x70')&&_0x315eaf[_0x6165('0x36')]!==_0x6165('0x71');});return{'count':_0x317b0c[_0x6165('0x3f')],'rows':_[_0x6165('0x32')](_0x317b0c,function(_0x2975be){return{'id':_0x2975be[_0x6165('0x31')],'name':_0x2975be['label'],'custom':!_0x2975be[_0x6165('0x6f')],'options':_0x2975be['choices']?_[_0x6165('0x32')](_0x2975be[_0x6165('0x72')],function(_0x53d559){return{'name':_[_0x6165('0x73')](_0x53d559),'value':_0x53d559};}):[]};})};}})[_0x6165('0x1a')](respondWithResult(_0x30affc,null))[_0x6165('0x23')](function(_0x4491b4){var _0xf1c16=_0xb53b2c[_0x6165('0x3c')]['test']?0x1f4:_0x4491b4[_0x6165('0x74')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x6165('0x5a'),_0xf1c16,JSON[_0x6165('0x1e')](_0x4491b4));delete _0x4491b4[_0x6165('0x31')];if(_0xf1c16===0x191){_0xf1c16=0x190;}_0x30affc[_0x6165('0x25')](_0xf1c16)[_0x6165('0x75')](_0xb53b2c[_0x6165('0x3c')][_0x6165('0x76')]?{'message':_0x6165('0x77'),'statusCode':_0x4491b4[_0x6165('0x74')]}:_0x4491b4);});}; \ No newline at end of file +var _0x6be9=['getFields','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','apply','save','update','destroy','then','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','model','query','intersection','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','findAll','show','keys','fields','options','find','create','body','params','getConfigurations','FreshdeskConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','agent','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s'];(function(_0x3bfb07,_0x2987ed){var _0x55095d=function(_0x274889){while(--_0x274889){_0x3bfb07['push'](_0x3bfb07['shift']());}};_0x55095d(++_0x2987ed);}(_0x6be9,0x103));var _0x96be=function(_0x36fbfd,_0x2b7d21){_0x36fbfd=_0x36fbfd-0x0;var _0x1ec6d9=_0x6be9[_0x36fbfd];return _0x1ec6d9;};'use strict';var pdf=require(_0x96be('0x0'));var emlformat=require(_0x96be('0x1'));var rimraf=require(_0x96be('0x2'));var zipdir=require(_0x96be('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x96be('0x4'));var moment=require(_0x96be('0x5'));var BPromise=require(_0x96be('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x96be('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x96be('0x8'));var fs=require('fs');var _=require(_0x96be('0x9'));var squel=require(_0x96be('0xa'));var crypto=require(_0x96be('0xb'));var jsforce=require(_0x96be('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x96be('0xd'));var querystring=require(_0x96be('0xe'));var Papa=require(_0x96be('0xf'));var Redis=require(_0x96be('0x10'));var authService=require(_0x96be('0x11'));var qs=require(_0x96be('0x12'));var as=require(_0x96be('0x13'));var hardwareService=require(_0x96be('0x14'));var logger=require(_0x96be('0x15'))('api');var utils=require(_0x96be('0x16'));var config=require(_0x96be('0x17'));var licenseUtil=require(_0x96be('0x18'));var db=require(_0x96be('0x19'))['db'];var integrations=require(_0x96be('0x1a'));var jayson=require('jayson/promise');var client=jayson[_0x96be('0x1b')][_0x96be('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x504b4c,_0x2da5a1,_0x3391aa,_0x1c2233){return new BPromise(function(_0x5de5a0,_0x1a2584){var _0x1c6fd5=_0x1c2233||client;return _0x1c6fd5[_0x96be('0x1d')](_0x504b4c,_0x3391aa)['then'](function(_0x1c55bc){logger[_0x96be('0x1e')](_0x96be('0x1f'),_0x2da5a1,_0x96be('0x20'));logger[_0x96be('0x21')](_0x96be('0x22'),_0x2da5a1,_0x96be('0x20'),JSON[_0x96be('0x23')](_0x1c55bc));if(_0x1c55bc[_0x96be('0x24')]){if(_0x1c55bc[_0x96be('0x24')][_0x96be('0x25')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x2da5a1,_0x1c55bc[_0x96be('0x24')][_0x96be('0x26')]);return _0x1a2584(_0x1c55bc[_0x96be('0x24')][_0x96be('0x26')]);}logger[_0x96be('0x24')]('FreshdeskAccount,\x20%s,\x20%s',_0x2da5a1,_0x1c55bc['error'][_0x96be('0x26')]);return _0x5de5a0(_0x1c55bc[_0x96be('0x24')][_0x96be('0x26')]);}else{logger[_0x96be('0x1e')](_0x96be('0x1f'),_0x2da5a1,'request\x20sent');_0x5de5a0(_0x1c55bc[_0x96be('0x27')][_0x96be('0x26')]);}})[_0x96be('0x28')](function(_0x3f049f){logger[_0x96be('0x24')](_0x96be('0x1f'),_0x2da5a1,_0x3f049f);_0x1a2584(_0x3f049f);});});}function respondWithStatusCode(_0x480dda,_0x2c345c){_0x2c345c=_0x2c345c||0xcc;return function(_0x5495b0){if(_0x5495b0){return _0x480dda[_0x96be('0x29')](_0x2c345c);}return _0x480dda[_0x96be('0x2a')](_0x2c345c)[_0x96be('0x2b')]();};}function respondWithResult(_0x1d7a65,_0x4649c7){_0x4649c7=_0x4649c7||0xc8;return function(_0x43ba36){if(_0x43ba36){return _0x1d7a65[_0x96be('0x2a')](_0x4649c7)['json'](_0x43ba36);}};}function respondWithFilteredResult(_0x27750e,_0x522035){return function(_0x4accb9){if(_0x4accb9){var _0x1d7835=_0x4accb9['count'],_0x301e3a=_0x522035[_0x96be('0x2c')],_0x1e64db=_0x522035[_0x96be('0x2c')]+_0x522035[_0x96be('0x2d')],_0x55b200;if(_0x1e64db>=_0x1d7835){_0x1e64db=_0x1d7835;_0x55b200=0xc8;}else{_0x55b200=0xce;}_0x27750e[_0x96be('0x2a')](_0x55b200);return _0x27750e[_0x96be('0x2e')](_0x96be('0x2f'),_0x301e3a+'-'+_0x1e64db+'/'+_0x1d7835)['json'](_0x4accb9);}return null;};}function patchUpdates(_0x56dad3){return function(_0x407b08){try{jsonpatch[_0x96be('0x30')](_0x407b08,_0x56dad3,!![]);}catch(_0x3ed1c9){return BPromise['reject'](_0x3ed1c9);}return _0x407b08[_0x96be('0x31')]();};}function saveUpdates(_0x49d208,_0x271426){return function(_0x2e9e1a){if(_0x2e9e1a){return _0x2e9e1a[_0x96be('0x32')](_0x49d208)['then'](function(_0x76bbb2){return _0x76bbb2;});}return null;};}function removeEntity(_0x1a7b64,_0x520540){return function(_0x2ed6b4){if(_0x2ed6b4){return _0x2ed6b4[_0x96be('0x33')]()[_0x96be('0x34')](function(){_0x1a7b64[_0x96be('0x2a')](0xcc)[_0x96be('0x2b')]();});}};}function handleEntityNotFound(_0x1bd939,_0x21edfb){return function(_0x6be416){if(!_0x6be416){_0x1bd939['sendStatus'](0x194);}return _0x6be416;};}function handleError(_0x44f73d,_0x1ce201){_0x1ce201=_0x1ce201||0x1f4;return function(_0x18b8a7){logger[_0x96be('0x24')](_0x18b8a7[_0x96be('0x35')]);if(_0x18b8a7[_0x96be('0x36')]){delete _0x18b8a7[_0x96be('0x36')];}_0x44f73d[_0x96be('0x2a')](_0x1ce201)[_0x96be('0x37')](_0x18b8a7);};}exports[_0x96be('0x38')]=function(_0x20251a,_0x3e1373){var _0x32df26={},_0x350f5b={},_0x254f2e={'count':0x0,'rows':[]};var _0x473385=_[_0x96be('0x39')](db[_0x96be('0x3a')][_0x96be('0x3b')],function(_0xcb0609){return{'name':_0xcb0609[_0x96be('0x3c')],'type':_0xcb0609['type']['key']};});_0x350f5b[_0x96be('0x3d')]=_['map'](_0x473385,_0x96be('0x36'));_0x350f5b[_0x96be('0x3e')]=_['keys'](_0x20251a[_0x96be('0x3e')]);_0x350f5b['filters']=_[_0x96be('0x3f')](_0x350f5b[_0x96be('0x3d')],_0x350f5b[_0x96be('0x3e')]);_0x32df26['attributes']=_[_0x96be('0x3f')](_0x350f5b[_0x96be('0x3d')],qs['fields'](_0x20251a['query']['fields']));_0x32df26[_0x96be('0x40')]=_0x32df26[_0x96be('0x40')][_0x96be('0x41')]?_0x32df26['attributes']:_0x350f5b[_0x96be('0x3d')];if(!_0x20251a[_0x96be('0x3e')]['hasOwnProperty'](_0x96be('0x42'))){_0x32df26[_0x96be('0x2d')]=qs[_0x96be('0x2d')](_0x20251a['query'][_0x96be('0x2d')]);_0x32df26[_0x96be('0x2c')]=qs[_0x96be('0x2c')](_0x20251a[_0x96be('0x3e')][_0x96be('0x2c')]);}_0x32df26[_0x96be('0x43')]=qs[_0x96be('0x44')](_0x20251a[_0x96be('0x3e')][_0x96be('0x44')]);_0x32df26[_0x96be('0x45')]=qs[_0x96be('0x46')](_[_0x96be('0x47')](_0x20251a[_0x96be('0x3e')],_0x350f5b[_0x96be('0x46')]),_0x473385);if(_0x20251a['query'][_0x96be('0x48')]){_0x32df26[_0x96be('0x45')]=_[_0x96be('0x49')](_0x32df26['where'],{'$or':_['map'](_0x473385,function(_0x541d3f){if(_0x541d3f['type']!==_0x96be('0x4a')){var _0x15bdbb={};_0x15bdbb[_0x541d3f[_0x96be('0x36')]]={'$like':'%'+_0x20251a['query']['filter']+'%'};return _0x15bdbb;}})});}_0x32df26=_[_0x96be('0x49')]({},_0x32df26,_0x20251a['options']);var _0x5b1e73={'where':_0x32df26[_0x96be('0x45')]};return db[_0x96be('0x3a')][_0x96be('0x4b')](_0x5b1e73)['then'](function(_0x4b85de){_0x254f2e[_0x96be('0x4b')]=_0x4b85de;if(_0x20251a[_0x96be('0x3e')]['includeAll']){_0x32df26['include']=[{'all':!![]}];}return db[_0x96be('0x3a')][_0x96be('0x4c')](_0x32df26);})['then'](function(_0x32985d){_0x254f2e['rows']=_0x32985d;return _0x254f2e;})['then'](respondWithFilteredResult(_0x3e1373,_0x32df26))['catch'](handleError(_0x3e1373,null));};exports[_0x96be('0x4d')]=function(_0x4a9388,_0x9328fc){var _0x570aac={'raw':![],'where':{'id':_0x4a9388['params']['id']}},_0x11b18c={};_0x11b18c[_0x96be('0x3d')]=_['keys'](db['FreshdeskAccount'][_0x96be('0x3b')]);_0x11b18c['query']=_[_0x96be('0x4e')](_0x4a9388['query']);_0x11b18c['filters']=_[_0x96be('0x3f')](_0x11b18c[_0x96be('0x3d')],_0x11b18c[_0x96be('0x3e')]);_0x570aac['attributes']=_[_0x96be('0x3f')](_0x11b18c[_0x96be('0x3d')],qs['fields'](_0x4a9388[_0x96be('0x3e')][_0x96be('0x4f')]));_0x570aac['attributes']=_0x570aac[_0x96be('0x40')][_0x96be('0x41')]?_0x570aac['attributes']:_0x11b18c[_0x96be('0x3d')];if(_0x4a9388[_0x96be('0x3e')]['includeAll']){_0x570aac['include']=[{'all':!![]}];}_0x570aac=_[_0x96be('0x49')]({},_0x570aac,_0x4a9388[_0x96be('0x50')]);return db[_0x96be('0x3a')][_0x96be('0x51')](_0x570aac)[_0x96be('0x34')](handleEntityNotFound(_0x9328fc,null))[_0x96be('0x34')](respondWithResult(_0x9328fc,null))[_0x96be('0x28')](handleError(_0x9328fc,null));};exports[_0x96be('0x52')]=function(_0x390808,_0x4cab61){return db[_0x96be('0x3a')][_0x96be('0x52')](_0x390808[_0x96be('0x53')],{})[_0x96be('0x34')](respondWithResult(_0x4cab61,0xc9))[_0x96be('0x28')](handleError(_0x4cab61,null));};exports['update']=function(_0x15b842,_0x186ded){if(_0x15b842[_0x96be('0x53')]['id']){delete _0x15b842[_0x96be('0x53')]['id'];}return db[_0x96be('0x3a')][_0x96be('0x51')]({'where':{'id':_0x15b842[_0x96be('0x54')]['id']}})[_0x96be('0x34')](handleEntityNotFound(_0x186ded,null))['then'](saveUpdates(_0x15b842['body'],null))['then'](respondWithResult(_0x186ded,null))['catch'](handleError(_0x186ded,null));};exports['destroy']=function(_0x2ac2a8,_0x2e2cff){return db[_0x96be('0x3a')][_0x96be('0x51')]({'where':{'id':_0x2ac2a8[_0x96be('0x54')]['id']}})['then'](handleEntityNotFound(_0x2e2cff,null))['then'](removeEntity(_0x2e2cff,null))[_0x96be('0x28')](handleError(_0x2e2cff,null));};exports[_0x96be('0x55')]=function(_0x50a73f,_0x407c20,_0x202b65){var _0x4ccd63={};var _0x157a0c={};var _0x468d89;var _0x3947d4;return db[_0x96be('0x3a')]['findOne']({'where':{'id':_0x50a73f[_0x96be('0x54')]['id']}})[_0x96be('0x34')](handleEntityNotFound(_0x407c20,null))[_0x96be('0x34')](function(_0x1c0f99){if(_0x1c0f99){_0x468d89=_0x1c0f99;_0x157a0c[_0x96be('0x3d')]=_[_0x96be('0x4e')](db[_0x96be('0x56')]['rawAttributes']);_0x157a0c[_0x96be('0x3e')]=_['keys'](_0x50a73f[_0x96be('0x3e')]);_0x157a0c[_0x96be('0x46')]=_['intersection'](_0x157a0c[_0x96be('0x3d')],_0x157a0c[_0x96be('0x3e')]);_0x4ccd63['attributes']=_[_0x96be('0x3f')](_0x157a0c[_0x96be('0x3d')],qs[_0x96be('0x4f')](_0x50a73f[_0x96be('0x3e')]['fields']));_0x4ccd63[_0x96be('0x40')]=_0x4ccd63[_0x96be('0x40')][_0x96be('0x41')]?_0x4ccd63[_0x96be('0x40')]:_0x157a0c[_0x96be('0x3d')];_0x4ccd63['order']=qs[_0x96be('0x44')](_0x50a73f[_0x96be('0x3e')][_0x96be('0x44')]);_0x4ccd63[_0x96be('0x45')]=qs[_0x96be('0x46')](_[_0x96be('0x47')](_0x50a73f[_0x96be('0x3e')],_0x157a0c[_0x96be('0x46')]));if(_0x50a73f[_0x96be('0x3e')]['filter']){_0x4ccd63[_0x96be('0x45')]=_['merge'](_0x4ccd63[_0x96be('0x45')],{'$or':_['map'](_0x4ccd63[_0x96be('0x40')],function(_0x4a50a0){var _0x541552={};_0x541552[_0x4a50a0]={'$like':'%'+_0x50a73f[_0x96be('0x3e')][_0x96be('0x48')]+'%'};return _0x541552;})});}_0x4ccd63=_[_0x96be('0x49')]({},_0x4ccd63,_0x50a73f[_0x96be('0x50')]);return _0x468d89[_0x96be('0x55')](_0x4ccd63);}})[_0x96be('0x34')](function(_0x513807){if(_0x513807){_0x3947d4=_0x513807['length'];if(!_0x50a73f[_0x96be('0x3e')][_0x96be('0x57')](_0x96be('0x42'))){_0x4ccd63[_0x96be('0x2d')]=qs[_0x96be('0x2d')](_0x50a73f[_0x96be('0x3e')]['limit']);_0x4ccd63[_0x96be('0x2c')]=qs[_0x96be('0x2c')](_0x50a73f['query'][_0x96be('0x2c')]);}return _0x468d89[_0x96be('0x55')](_0x4ccd63);}})['then'](function(_0x20a67e){if(_0x20a67e){return _0x20a67e?{'count':_0x3947d4,'rows':_0x20a67e}:null;}})['then'](respondWithResult(_0x407c20,null))[_0x96be('0x28')](handleError(_0x407c20,null));};exports[_0x96be('0x58')]=function(_0x88b6a4,_0x20ab51,_0x5b8536){if(_0x88b6a4[_0x96be('0x53')]['id']){delete _0x88b6a4[_0x96be('0x53')]['id'];}return db['FreshdeskAccount'][_0x96be('0x59')]({'where':{'id':_0x88b6a4[_0x96be('0x54')]['id']}})[_0x96be('0x34')](handleEntityNotFound(_0x20ab51,null))['then'](function(_0x3bf727){if(_0x3bf727){_0x88b6a4[_0x96be('0x53')][_0x96be('0x5a')]=_0x3bf727['id'];_0x88b6a4[_0x96be('0x53')][_0x96be('0x5b')]=integrations[_0x96be('0x5c')](_0x88b6a4[_0x96be('0x53')]['channel'],_0x88b6a4[_0x96be('0x53')][_0x96be('0x5d')]);_0x88b6a4[_0x96be('0x53')][_0x96be('0x5e')]=integrations[_0x96be('0x5f')](_0x88b6a4[_0x96be('0x53')][_0x96be('0x60')],_0x88b6a4[_0x96be('0x53')][_0x96be('0x5d')]);return db['FreshdeskConfiguration'][_0x96be('0x52')](_0x88b6a4[_0x96be('0x53')],{'include':[{'model':db['FreshdeskField'],'as':_0x96be('0x5b')},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x20ab51,null))[_0x96be('0x28')](handleError(_0x20ab51,null));};exports['getFields']=function(_0x7da9eb,_0x1b20ca,_0x318818){var _0x2516b1='';return db[_0x96be('0x3a')][_0x96be('0x59')]({'where':{'id':_0x7da9eb[_0x96be('0x54')]['id']},'attributes':['id',_0x96be('0x61'),_0x96be('0x62')]})[_0x96be('0x34')](handleEntityNotFound(_0x1b20ca,null))[_0x96be('0x34')](function(_0x34e656){if(_0x34e656){_0x2516b1=_0x34e656[_0x96be('0x61')];var _0x320848=_0x2516b1[_0x96be('0x63')](-0x1);if(_0x320848==='/'){_0x2516b1=_0x2516b1[_0x96be('0x64')](0x0,_0x2516b1[_0x96be('0x65')](_0x320848));}return rp({'method':_0x96be('0x66'),'uri':util[_0x96be('0x67')]('%s/%s',_0x2516b1,_0x96be('0x68')),'headers':{'Authorization':util['format'](_0x96be('0x69'),new Buffer(util[_0x96be('0x67')](_0x96be('0x6a'),_0x34e656['apiKey']))[_0x96be('0x6b')](_0x96be('0x6c')))},'json':!![]});}})[_0x96be('0x34')](function(_0x32c2df){if(_0x32c2df){var _0x5e0080=[_0x96be('0x6d'),'subject',_0x96be('0x6e'),_0x96be('0x6f'),_0x96be('0x2a'),_0x96be('0x70'),_0x96be('0x71'),_0x96be('0x72'),_0x96be('0x73'),_0x96be('0x71'),_0x96be('0x74')];_[_0x96be('0x75')](_0x32c2df,function(_0x624d9d){return _0x5e0080[_0x96be('0x76')](_0x624d9d['name'])||!_0x624d9d[_0x96be('0x77')]&&_0x624d9d[_0x96be('0x5d')]!==_0x96be('0x78')&&_0x624d9d['type']!==_0x96be('0x79');});return{'count':_0x32c2df[_0x96be('0x41')],'rows':_[_0x96be('0x39')](_0x32c2df,function(_0x182ca7){return{'id':_0x182ca7[_0x96be('0x36')],'name':_0x182ca7['label'],'custom':!_0x182ca7[_0x96be('0x77')],'options':_0x182ca7[_0x96be('0x7a')]?_['map'](_0x182ca7[_0x96be('0x7a')],function(_0x3f1207){return{'name':_['capitalize'](_0x3f1207),'value':_0x3f1207};}):[]};})};}})[_0x96be('0x34')](respondWithResult(_0x1b20ca,null))[_0x96be('0x28')](function(_0xbb9dd2){var _0x3e931c=_0x7da9eb[_0x96be('0x3e')]['test']?0x1f4:_0xbb9dd2[_0x96be('0x7b')]||0x1f4;logger[_0x96be('0x24')](_0x96be('0x7c'),_0x96be('0x7d'),_0x3e931c,JSON[_0x96be('0x23')](_0xbb9dd2));delete _0xbb9dd2[_0x96be('0x36')];if(_0x3e931c===0x191){_0x3e931c=0x190;}_0x1b20ca[_0x96be('0x2a')](_0x3e931c)['send'](_0x7da9eb[_0x96be('0x3e')][_0x96be('0x7e')]?{'message':_0x96be('0x7f'),'statusCode':_0xbb9dd2[_0x96be('0x7b')]}:_0xbb9dd2);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 117b94c..6215416 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 _0x2c54=['path','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x13016d,_0x113532){var _0x4f1a5c=function(_0x375b56){while(--_0x375b56){_0x13016d['push'](_0x13016d['shift']());}};_0x4f1a5c(++_0x113532);}(_0x2c54,0x1a7));var _0x42c5=function(_0x529100,_0x1bb499){_0x529100=_0x529100-0x0;var _0x13381b=_0x2c54[_0x529100];return _0x13381b;};'use strict';var _=require(_0x42c5('0x0'));var util=require('util');var logger=require(_0x42c5('0x1'))(_0x42c5('0x2'));var moment=require(_0x42c5('0x3'));var BPromise=require(_0x42c5('0x4'));var rp=require(_0x42c5('0x5'));var fs=require('fs');var path=require(_0x42c5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x42c5('0x7'));var integrations=require(_0x42c5('0x8'));module[_0x42c5('0x9')]=function(_0x27a423,_0x598b12){return _0x27a423[_0x42c5('0xa')](_0x42c5('0xb'),attributes,{'tableName':_0x42c5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8eb7=['path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x301dab,_0x38050a){var _0x2500a2=function(_0x4d3dff){while(--_0x4d3dff){_0x301dab['push'](_0x301dab['shift']());}};_0x2500a2(++_0x38050a);}(_0x8eb7,0x117));var _0x78eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8eb7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x78eb('0x0'));var logger=require(_0x78eb('0x1'))(_0x78eb('0x2'));var moment=require(_0x78eb('0x3'));var BPromise=require(_0x78eb('0x4'));var rp=require(_0x78eb('0x5'));var fs=require('fs');var path=require(_0x78eb('0x6'));var rimraf=require(_0x78eb('0x7'));var config=require(_0x78eb('0x8'));var attributes=require(_0x78eb('0x9'));var integrations=require(_0x78eb('0xa'));module[_0x78eb('0xb')]=function(_0x3e74f4,_0x4c9b48){return _0x3e74f4[_0x78eb('0xc')](_0x78eb('0xd'),attributes,{'tableName':_0x78eb('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 73a5180..cb54862 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 _0x9eab=['client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','catch','ShowFreshdeskAccount','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2ab5e1,_0x27f9ee){var _0x507db5=function(_0x2caf62){while(--_0x2caf62){_0x2ab5e1['push'](_0x2ab5e1['shift']());}};_0x507db5(++_0x27f9ee);}(_0x9eab,0x12d));var _0xb9ea=function(_0x2a5d5c,_0x138c43){_0x2a5d5c=_0x2a5d5c-0x0;var _0x12dda3=_0x9eab[_0x2a5d5c];return _0x12dda3;};'use strict';var _=require(_0xb9ea('0x0'));var util=require(_0xb9ea('0x1'));var moment=require(_0xb9ea('0x2'));var BPromise=require(_0xb9ea('0x3'));var rs=require(_0xb9ea('0x4'));var fs=require('fs');var Redis=require(_0xb9ea('0x5'));var db=require(_0xb9ea('0x6'))['db'];var utils=require(_0xb9ea('0x7'));var logger=require(_0xb9ea('0x8'))(_0xb9ea('0x9'));var config=require(_0xb9ea('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb9ea('0xb')][_0xb9ea('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a72b5,_0x2f5374,_0x6fedd1){return new BPromise(function(_0x1c0cf5,_0x167382){return client[_0xb9ea('0xd')](_0x5a72b5,_0x6fedd1)[_0xb9ea('0xe')](function(_0x5c92e1){logger[_0xb9ea('0xf')](_0xb9ea('0x10'),_0x2f5374,_0xb9ea('0x11'));logger[_0xb9ea('0x12')](_0xb9ea('0x13'),_0x2f5374,_0xb9ea('0x11'),JSON['stringify'](_0x5c92e1));if(_0x5c92e1['error']){if(_0x5c92e1[_0xb9ea('0x14')][_0xb9ea('0x15')]===0x1f4){logger[_0xb9ea('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x2f5374,_0x5c92e1['error'][_0xb9ea('0x16')]);return _0x167382(_0x5c92e1[_0xb9ea('0x14')]['message']);}logger['error'](_0xb9ea('0x10'),_0x2f5374,_0x5c92e1[_0xb9ea('0x14')][_0xb9ea('0x16')]);return _0x1c0cf5(_0x5c92e1[_0xb9ea('0x14')]['message']);}else{logger[_0xb9ea('0xf')](_0xb9ea('0x10'),_0x2f5374,'request\x20sent');_0x1c0cf5(_0x5c92e1[_0xb9ea('0x17')][_0xb9ea('0x16')]);}})['catch'](function(_0x43337f){logger['error'](_0xb9ea('0x10'),_0x2f5374,_0x43337f);_0x167382(_0x43337f);});});}exports[_0xb9ea('0x18')]=function(_0x2187fd){var _0x3350cf=this;return new Promise(function(_0x220b31,_0xfa60a){return db[_0xb9ea('0x19')][_0xb9ea('0x1a')]({'raw':_0x2187fd[_0xb9ea('0x1b')]?_0x2187fd['options'][_0xb9ea('0x1c')]===undefined?!![]:![]:!![],'where':_0x2187fd[_0xb9ea('0x1b')]?_0x2187fd['options'][_0xb9ea('0x1d')]||null:null,'attributes':_0x2187fd['options']?_0x2187fd['options'][_0xb9ea('0x1e')]||null:null,'limit':_0x2187fd['options']?_0x2187fd[_0xb9ea('0x1b')][_0xb9ea('0x1f')]||null:null,'include':_0x2187fd[_0xb9ea('0x1b')]?_0x2187fd[_0xb9ea('0x1b')]['include']?_[_0xb9ea('0x20')](_0x2187fd[_0xb9ea('0x1b')][_0xb9ea('0x21')],function(_0xa07d38){return{'model':db[_0xa07d38[_0xb9ea('0x22')]],'as':_0xa07d38['as'],'attributes':_0xa07d38['attributes'],'include':_0xa07d38[_0xb9ea('0x21')]?_[_0xb9ea('0x20')](_0xa07d38['include'],function(_0x5ee134){return{'model':db[_0x5ee134[_0xb9ea('0x22')]],'as':_0x5ee134['as'],'attributes':_0x5ee134['attributes'],'include':_0x5ee134[_0xb9ea('0x21')]?_[_0xb9ea('0x20')](_0x5ee134[_0xb9ea('0x21')],function(_0x109924){return{'model':db[_0x109924[_0xb9ea('0x22')]],'as':_0x109924['as'],'attributes':_0x109924[_0xb9ea('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb9ea('0xe')](function(_0x500b7a){logger['info'](_0xb9ea('0x18'),_0x2187fd);logger[_0xb9ea('0x12')](_0xb9ea('0x18'),_0x2187fd,JSON['stringify'](_0x500b7a));_0x220b31(_0x500b7a);})[_0xb9ea('0x23')](function(_0x349b10){logger[_0xb9ea('0x14')](_0xb9ea('0x18'),_0x349b10['message'],_0x2187fd);_0xfa60a(_0x3350cf[_0xb9ea('0x14')](0x1f4,_0x349b10['message']));});});};exports[_0xb9ea('0x24')]=function(_0x50869e){var _0x4c44b2=this;return new Promise(function(_0x2ebfd9,_0x11fa6f){return db[_0xb9ea('0x19')][_0xb9ea('0x25')]({'raw':_0x50869e[_0xb9ea('0x1b')]?_0x50869e[_0xb9ea('0x1b')][_0xb9ea('0x1c')]===undefined?!![]:![]:!![],'where':_0x50869e[_0xb9ea('0x1b')]?_0x50869e[_0xb9ea('0x1b')][_0xb9ea('0x1d')]||null:null,'attributes':_0x50869e['options']?_0x50869e[_0xb9ea('0x1b')]['attributes']||null:null,'include':_0x50869e[_0xb9ea('0x1b')]?_0x50869e['options']['include']?_[_0xb9ea('0x20')](_0x50869e[_0xb9ea('0x1b')]['include'],function(_0x4da96c){return{'model':db[_0x4da96c[_0xb9ea('0x22')]],'as':_0x4da96c['as'],'attributes':_0x4da96c[_0xb9ea('0x1e')],'include':_0x4da96c[_0xb9ea('0x21')]?_[_0xb9ea('0x20')](_0x4da96c['include'],function(_0x2107ee){return{'model':db[_0x2107ee[_0xb9ea('0x22')]],'as':_0x2107ee['as'],'attributes':_0x2107ee['attributes'],'include':_0x2107ee[_0xb9ea('0x21')]?_[_0xb9ea('0x20')](_0x2107ee[_0xb9ea('0x21')],function(_0x2938b5){return{'model':db[_0x2938b5[_0xb9ea('0x22')]],'as':_0x2938b5['as'],'attributes':_0x2938b5[_0xb9ea('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb9ea('0xe')](function(_0x2bda6a){logger[_0xb9ea('0xf')](_0xb9ea('0x24'),_0x50869e);logger[_0xb9ea('0x12')](_0xb9ea('0x24'),_0x50869e,JSON[_0xb9ea('0x26')](_0x2bda6a));_0x2ebfd9(_0x2bda6a);})[_0xb9ea('0x23')](function(_0x39d392){logger[_0xb9ea('0x14')](_0xb9ea('0x24'),_0x39d392[_0xb9ea('0x16')],_0x50869e);_0x11fa6f(_0x4c44b2[_0xb9ea('0x14')](0x1f4,_0x39d392[_0xb9ea('0x16')]));});});}; \ No newline at end of file +var _0xf6a8=['GetFreshdeskAccount','options','raw','attributes','limit','include','map','then','catch','ShowFreshdeskAccount','FreshdeskAccount','find','where','model','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','info','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','result'];(function(_0x22f5c9,_0x35a6b4){var _0x51b06a=function(_0x3edf23){while(--_0x3edf23){_0x22f5c9['push'](_0x22f5c9['shift']());}};_0x51b06a(++_0x35a6b4);}(_0xf6a8,0x86));var _0x8f6a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf6a8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8f6a('0x0'));var util=require('util');var moment=require(_0x8f6a('0x1'));var BPromise=require('bluebird');var rs=require(_0x8f6a('0x2'));var fs=require('fs');var Redis=require(_0x8f6a('0x3'));var db=require(_0x8f6a('0x4'))['db'];var utils=require(_0x8f6a('0x5'));var logger=require('../../config/logger')(_0x8f6a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8f6a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x50d057,_0x59678e,_0x52e860){return new BPromise(function(_0x1b2e31,_0x5f00ab){return client['request'](_0x50d057,_0x52e860)['then'](function(_0x3ce390){logger[_0x8f6a('0x8')]('FreshdeskAccount,\x20%s,\x20%s',_0x59678e,'request\x20sent');logger['debug'](_0x8f6a('0x9'),_0x59678e,_0x8f6a('0xa'),JSON[_0x8f6a('0xb')](_0x3ce390));if(_0x3ce390[_0x8f6a('0xc')]){if(_0x3ce390[_0x8f6a('0xc')]['code']===0x1f4){logger[_0x8f6a('0xc')](_0x8f6a('0xd'),_0x59678e,_0x3ce390[_0x8f6a('0xc')][_0x8f6a('0xe')]);return _0x5f00ab(_0x3ce390[_0x8f6a('0xc')][_0x8f6a('0xe')]);}logger[_0x8f6a('0xc')](_0x8f6a('0xd'),_0x59678e,_0x3ce390[_0x8f6a('0xc')][_0x8f6a('0xe')]);return _0x1b2e31(_0x3ce390[_0x8f6a('0xc')][_0x8f6a('0xe')]);}else{logger[_0x8f6a('0x8')](_0x8f6a('0xd'),_0x59678e,_0x8f6a('0xa'));_0x1b2e31(_0x3ce390[_0x8f6a('0xf')][_0x8f6a('0xe')]);}})['catch'](function(_0xee83f3){logger[_0x8f6a('0xc')](_0x8f6a('0xd'),_0x59678e,_0xee83f3);_0x5f00ab(_0xee83f3);});});}exports[_0x8f6a('0x10')]=function(_0x50d227){var _0x4b53bd=this;return new Promise(function(_0x783e18,_0x2c0cb8){return db['FreshdeskAccount']['findAll']({'raw':_0x50d227[_0x8f6a('0x11')]?_0x50d227['options'][_0x8f6a('0x12')]===undefined?!![]:![]:!![],'where':_0x50d227['options']?_0x50d227['options']['where']||null:null,'attributes':_0x50d227[_0x8f6a('0x11')]?_0x50d227[_0x8f6a('0x11')][_0x8f6a('0x13')]||null:null,'limit':_0x50d227['options']?_0x50d227[_0x8f6a('0x11')][_0x8f6a('0x14')]||null:null,'include':_0x50d227[_0x8f6a('0x11')]?_0x50d227['options'][_0x8f6a('0x15')]?_[_0x8f6a('0x16')](_0x50d227[_0x8f6a('0x11')][_0x8f6a('0x15')],function(_0x4a970d){return{'model':db[_0x4a970d['model']],'as':_0x4a970d['as'],'attributes':_0x4a970d[_0x8f6a('0x13')],'include':_0x4a970d[_0x8f6a('0x15')]?_[_0x8f6a('0x16')](_0x4a970d[_0x8f6a('0x15')],function(_0x5212cb){return{'model':db[_0x5212cb['model']],'as':_0x5212cb['as'],'attributes':_0x5212cb[_0x8f6a('0x13')],'include':_0x5212cb[_0x8f6a('0x15')]?_[_0x8f6a('0x16')](_0x5212cb[_0x8f6a('0x15')],function(_0x53674d){return{'model':db[_0x53674d['model']],'as':_0x53674d['as'],'attributes':_0x53674d['attributes']};}):[]};}):[]};}):[]:[]})[_0x8f6a('0x17')](function(_0x3e2d27){logger[_0x8f6a('0x8')](_0x8f6a('0x10'),_0x50d227);logger['debug'](_0x8f6a('0x10'),_0x50d227,JSON['stringify'](_0x3e2d27));_0x783e18(_0x3e2d27);})[_0x8f6a('0x18')](function(_0x3432cf){logger[_0x8f6a('0xc')](_0x8f6a('0x10'),_0x3432cf[_0x8f6a('0xe')],_0x50d227);_0x2c0cb8(_0x4b53bd[_0x8f6a('0xc')](0x1f4,_0x3432cf[_0x8f6a('0xe')]));});});};exports[_0x8f6a('0x19')]=function(_0xf9b309){var _0x363131=this;return new Promise(function(_0x14268f,_0x563207){return db[_0x8f6a('0x1a')][_0x8f6a('0x1b')]({'raw':_0xf9b309[_0x8f6a('0x11')]?_0xf9b309[_0x8f6a('0x11')][_0x8f6a('0x12')]===undefined?!![]:![]:!![],'where':_0xf9b309[_0x8f6a('0x11')]?_0xf9b309[_0x8f6a('0x11')][_0x8f6a('0x1c')]||null:null,'attributes':_0xf9b309[_0x8f6a('0x11')]?_0xf9b309[_0x8f6a('0x11')][_0x8f6a('0x13')]||null:null,'include':_0xf9b309['options']?_0xf9b309[_0x8f6a('0x11')]['include']?_[_0x8f6a('0x16')](_0xf9b309[_0x8f6a('0x11')][_0x8f6a('0x15')],function(_0x40290a){return{'model':db[_0x40290a[_0x8f6a('0x1d')]],'as':_0x40290a['as'],'attributes':_0x40290a[_0x8f6a('0x13')],'include':_0x40290a['include']?_[_0x8f6a('0x16')](_0x40290a[_0x8f6a('0x15')],function(_0x21086d){return{'model':db[_0x21086d['model']],'as':_0x21086d['as'],'attributes':_0x21086d['attributes'],'include':_0x21086d['include']?_[_0x8f6a('0x16')](_0x21086d[_0x8f6a('0x15')],function(_0x4fa053){return{'model':db[_0x4fa053['model']],'as':_0x4fa053['as'],'attributes':_0x4fa053[_0x8f6a('0x13')]};}):[]};}):[]};}):[]:[]})[_0x8f6a('0x17')](function(_0x2b0ef2){logger[_0x8f6a('0x8')]('ShowFreshdeskAccount',_0xf9b309);logger['debug'](_0x8f6a('0x19'),_0xf9b309,JSON[_0x8f6a('0xb')](_0x2b0ef2));_0x14268f(_0x2b0ef2);})[_0x8f6a('0x18')](function(_0x4cc305){logger[_0x8f6a('0xc')](_0x8f6a('0x19'),_0x4cc305['message'],_0xf9b309);_0x563207(_0x363131[_0x8f6a('0xc')](0x1f4,_0x4cc305[_0x8f6a('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 9e1617d..08323e4 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 _0x2031=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','/:id/tags','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','/:id/fields'];(function(_0x2c5e05,_0x36c359){var _0x41dd4b=function(_0x46ce29){while(--_0x46ce29){_0x2c5e05['push'](_0x2c5e05['shift']());}};_0x41dd4b(++_0x36c359);}(_0x2031,0x1ee));var _0x1203=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2031[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x1203('0x0'));var util=require(_0x1203('0x1'));var path=require(_0x1203('0x2'));var timeout=require(_0x1203('0x3'));var express=require(_0x1203('0x4'));var router=express[_0x1203('0x5')]();var auth=require(_0x1203('0x6'));var interaction=require(_0x1203('0x7'));var config=require(_0x1203('0x8'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1203('0x9')](_0x1203('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x1203('0x9')](_0x1203('0xb'),auth[_0x1203('0xc')](),controller[_0x1203('0xd')]);router[_0x1203('0x9')](_0x1203('0xe'),auth['isAuthenticated'](),controller[_0x1203('0xf')]);router[_0x1203('0x9')](_0x1203('0x10'),auth[_0x1203('0xc')](),controller['getDescriptions']);router[_0x1203('0x9')]('/:id/tags',auth[_0x1203('0xc')](),controller['getTags']);router[_0x1203('0x11')]('/',auth[_0x1203('0xc')](),controller[_0x1203('0x12')]);router[_0x1203('0x11')](_0x1203('0x13'),auth['isAuthenticated'](),controller['setTags']);router[_0x1203('0x14')](_0x1203('0xa'),auth[_0x1203('0xc')](),controller['update']);router[_0x1203('0x15')](_0x1203('0xa'),auth[_0x1203('0xc')](),controller['destroy']);module[_0x1203('0x16')]=router; \ No newline at end of file +var _0x063e=['exports','multer','util','path','connect-timeout','express','Router','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy'];(function(_0x36995d,_0x339e24){var _0x2e10cc=function(_0xa23a88){while(--_0xa23a88){_0x36995d['push'](_0x36995d['shift']());}};_0x2e10cc(++_0x339e24);}(_0x063e,0x10f));var _0xe063=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x063e[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0xe063('0x0'));var util=require(_0xe063('0x1'));var path=require(_0xe063('0x2'));var timeout=require(_0xe063('0x3'));var express=require(_0xe063('0x4'));var router=express[_0xe063('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe063('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0xe063('0x7')](),controller[_0xe063('0x8')]);router[_0xe063('0x9')](_0xe063('0xa'),auth['isAuthenticated'](),controller[_0xe063('0xb')]);router[_0xe063('0x9')](_0xe063('0xc'),auth[_0xe063('0x7')](),controller[_0xe063('0xd')]);router[_0xe063('0x9')](_0xe063('0xe'),auth[_0xe063('0x7')](),controller[_0xe063('0xf')]);router[_0xe063('0x9')]('/:id/descriptions',auth[_0xe063('0x7')](),controller[_0xe063('0x10')]);router[_0xe063('0x9')](_0xe063('0x11'),auth['isAuthenticated'](),controller[_0xe063('0x12')]);router[_0xe063('0x13')]('/',auth[_0xe063('0x7')](),controller[_0xe063('0x14')]);router[_0xe063('0x13')](_0xe063('0x11'),auth[_0xe063('0x7')](),controller[_0xe063('0x15')]);router[_0xe063('0x16')](_0xe063('0xa'),auth[_0xe063('0x7')](),controller[_0xe063('0x17')]);router[_0xe063('0x18')](_0xe063('0xa'),auth[_0xe063('0x7')](),controller[_0xe063('0x19')]);module[_0xe063('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 d09c9ce..542676e 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 _0xb564=['STRING','sequelize'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xb564,0x165));var _0x4b56=function(_0x5e997a,_0xc231f5){_0x5e997a=_0x5e997a-0x0;var _0x3a863d=_0xb564[_0x5e997a];return _0x3a863d;};'use strict';var Sequelize=require(_0x4b56('0x0'));module['exports']={'name':{'type':Sequelize[_0x4b56('0x1')]},'description':{'type':Sequelize[_0x4b56('0x1')]}}; \ No newline at end of file +var _0x816a=['exports'];(function(_0x38ed1d,_0x50d7e2){var _0x5a06e9=function(_0x5e4127){while(--_0x5e4127){_0x38ed1d['push'](_0x38ed1d['shift']());}};_0x5a06e9(++_0x50d7e2);}(_0x816a,0x166));var _0xa816=function(_0x33aa8d,_0x5d6fe2){_0x33aa8d=_0x33aa8d-0x0;var _0x314cf7=_0x816a[_0x33aa8d];return _0x314cf7;};'use strict';var Sequelize=require('sequelize');module[_0xa816('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 72be0ea..6a0c3b9 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 _0x52d3=['sort','where','VIRTUAL','filter','options','includeAll','findAll','rows','show','include','merge','find','create','body','params','destroy','getFields','findOne','FreshdeskField','rawAttributes','pick','hasOwnProperty','nolimit','getSubjects','getDescriptions','Tag','getTags','setTags','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','http','request','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','end','name','send','index','map','FreshdeskConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order'];(function(_0x34b357,_0x219e90){var _0x598474=function(_0x34474a){while(--_0x34474a){_0x34b357['push'](_0x34b357['shift']());}};_0x598474(++_0x219e90);}(_0x52d3,0x18c));var _0x352d=function(_0xcc1a4e,_0x44394a){_0xcc1a4e=_0xcc1a4e-0x0;var _0x3bd805=_0x52d3[_0xcc1a4e];return _0x3bd805;};'use strict';var pdf=require(_0x352d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x352d('0x1'));var zipdir=require(_0x352d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x352d('0x3'));var moment=require('moment');var BPromise=require(_0x352d('0x4'));var Mustache=require(_0x352d('0x5'));var util=require(_0x352d('0x6'));var path=require(_0x352d('0x7'));var sox=require(_0x352d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x352d('0x9'));var squel=require(_0x352d('0xa'));var crypto=require(_0x352d('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x352d('0xc'));var Papa=require(_0x352d('0xd'));var Redis=require(_0x352d('0xe'));var authService=require(_0x352d('0xf'));var qs=require(_0x352d('0x10'));var as=require(_0x352d('0x11'));var hardwareService=require(_0x352d('0x12'));var logger=require(_0x352d('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x352d('0x14'));var db=require(_0x352d('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x352d('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x366871,_0x4ddd2b,_0x1c0a62,_0x213513){return new BPromise(function(_0x2f842c,_0x599d08){var _0x46848a=_0x213513||client;return _0x46848a[_0x352d('0x17')](_0x366871,_0x1c0a62)['then'](function(_0x212dea){logger['info'](_0x352d('0x18'),_0x4ddd2b,_0x352d('0x19'));logger[_0x352d('0x1a')](_0x352d('0x1b'),_0x4ddd2b,_0x352d('0x19'),JSON[_0x352d('0x1c')](_0x212dea));if(_0x212dea[_0x352d('0x1d')]){if(_0x212dea[_0x352d('0x1d')][_0x352d('0x1e')]===0x1f4){logger['error'](_0x352d('0x18'),_0x4ddd2b,_0x212dea[_0x352d('0x1d')][_0x352d('0x1f')]);return _0x599d08(_0x212dea[_0x352d('0x1d')]['message']);}logger[_0x352d('0x1d')](_0x352d('0x18'),_0x4ddd2b,_0x212dea[_0x352d('0x1d')]['message']);return _0x2f842c(_0x212dea[_0x352d('0x1d')]['message']);}else{logger['info'](_0x352d('0x18'),_0x4ddd2b,_0x352d('0x19'));_0x2f842c(_0x212dea[_0x352d('0x20')]['message']);}})[_0x352d('0x21')](function(_0x2a46c9){logger[_0x352d('0x1d')](_0x352d('0x18'),_0x4ddd2b,_0x2a46c9);_0x599d08(_0x2a46c9);});});}function respondWithStatusCode(_0x1b7acb,_0x12d146){_0x12d146=_0x12d146||0xcc;return function(_0x43bf59){if(_0x43bf59){return _0x1b7acb[_0x352d('0x22')](_0x12d146);}return _0x1b7acb[_0x352d('0x23')](_0x12d146)['end']();};}function respondWithResult(_0x209143,_0x3b44ae){_0x3b44ae=_0x3b44ae||0xc8;return function(_0x4f8e48){if(_0x4f8e48){return _0x209143[_0x352d('0x23')](_0x3b44ae)[_0x352d('0x24')](_0x4f8e48);}};}function respondWithFilteredResult(_0x5099e5,_0x6e448e){return function(_0x2199d9){if(_0x2199d9){var _0x5adf5f=_0x2199d9[_0x352d('0x25')],_0x52e40a=_0x6e448e[_0x352d('0x26')],_0x143c7e=_0x6e448e['offset']+_0x6e448e[_0x352d('0x27')],_0xbcf7fd;if(_0x143c7e>=_0x5adf5f){_0x143c7e=_0x5adf5f;_0xbcf7fd=0xc8;}else{_0xbcf7fd=0xce;}_0x5099e5[_0x352d('0x23')](_0xbcf7fd);return _0x5099e5[_0x352d('0x28')]('Content-Range',_0x52e40a+'-'+_0x143c7e+'/'+_0x5adf5f)[_0x352d('0x24')](_0x2199d9);}return null;};}function patchUpdates(_0x6a0f7f){return function(_0x1e1519){try{jsonpatch[_0x352d('0x29')](_0x1e1519,_0x6a0f7f,!![]);}catch(_0x3b1661){return BPromise[_0x352d('0x2a')](_0x3b1661);}return _0x1e1519[_0x352d('0x2b')]();};}function saveUpdates(_0x48151b,_0x51fe18){return function(_0x5b5b03){if(_0x5b5b03){return _0x5b5b03[_0x352d('0x2c')](_0x48151b)[_0x352d('0x2d')](function(_0x47cde4){return _0x47cde4;});}return null;};}function removeEntity(_0x10f6cb,_0x289db0){return function(_0x2c1c1d){if(_0x2c1c1d){return _0x2c1c1d['destroy']()[_0x352d('0x2d')](function(){_0x10f6cb[_0x352d('0x23')](0xcc)[_0x352d('0x2e')]();});}};}function handleEntityNotFound(_0x17acec,_0x141573){return function(_0x46a804){if(!_0x46a804){_0x17acec['sendStatus'](0x194);}return _0x46a804;};}function handleError(_0x1eb1c4,_0x4b597e){_0x4b597e=_0x4b597e||0x1f4;return function(_0x4c9655){logger['error'](_0x4c9655['stack']);if(_0x4c9655[_0x352d('0x2f')]){delete _0x4c9655[_0x352d('0x2f')];}_0x1eb1c4['status'](_0x4b597e)[_0x352d('0x30')](_0x4c9655);};}exports[_0x352d('0x31')]=function(_0xb9ce1b,_0x218fa7){var _0x361e10={},_0xa2002e={},_0x3272bb={'count':0x0,'rows':[]};var _0x3b5a0f=_[_0x352d('0x32')](db[_0x352d('0x33')]['rawAttributes'],function(_0x51641b){return{'name':_0x51641b[_0x352d('0x34')],'type':_0x51641b[_0x352d('0x35')][_0x352d('0x36')]};});_0xa2002e[_0x352d('0x37')]=_[_0x352d('0x32')](_0x3b5a0f,'name');_0xa2002e[_0x352d('0x38')]=_[_0x352d('0x39')](_0xb9ce1b[_0x352d('0x38')]);_0xa2002e[_0x352d('0x3a')]=_[_0x352d('0x3b')](_0xa2002e[_0x352d('0x37')],_0xa2002e[_0x352d('0x38')]);_0x361e10[_0x352d('0x3c')]=_['intersection'](_0xa2002e[_0x352d('0x37')],qs[_0x352d('0x3d')](_0xb9ce1b[_0x352d('0x38')][_0x352d('0x3d')]));_0x361e10[_0x352d('0x3c')]=_0x361e10[_0x352d('0x3c')][_0x352d('0x3e')]?_0x361e10[_0x352d('0x3c')]:_0xa2002e[_0x352d('0x37')];if(!_0xb9ce1b[_0x352d('0x38')]['hasOwnProperty']('nolimit')){_0x361e10[_0x352d('0x27')]=qs[_0x352d('0x27')](_0xb9ce1b['query'][_0x352d('0x27')]);_0x361e10['offset']=qs[_0x352d('0x26')](_0xb9ce1b[_0x352d('0x38')][_0x352d('0x26')]);}_0x361e10[_0x352d('0x3f')]=qs[_0x352d('0x40')](_0xb9ce1b['query'][_0x352d('0x40')]);_0x361e10['where']=qs[_0x352d('0x3a')](_['pick'](_0xb9ce1b['query'],_0xa2002e[_0x352d('0x3a')]),_0x3b5a0f);if(_0xb9ce1b[_0x352d('0x38')]['filter']){_0x361e10['where']=_['merge'](_0x361e10[_0x352d('0x41')],{'$or':_[_0x352d('0x32')](_0x3b5a0f,function(_0x3dfa71){if(_0x3dfa71[_0x352d('0x35')]!==_0x352d('0x42')){var _0x44d9b4={};_0x44d9b4[_0x3dfa71['name']]={'$like':'%'+_0xb9ce1b[_0x352d('0x38')][_0x352d('0x43')]+'%'};return _0x44d9b4;}})});}_0x361e10=_['merge']({},_0x361e10,_0xb9ce1b[_0x352d('0x44')]);var _0x254bf0={'where':_0x361e10[_0x352d('0x41')]};return db[_0x352d('0x33')][_0x352d('0x25')](_0x254bf0)['then'](function(_0x589196){_0x3272bb['count']=_0x589196;if(_0xb9ce1b[_0x352d('0x38')][_0x352d('0x45')]){_0x361e10['include']=[{'all':!![]}];}return db[_0x352d('0x33')][_0x352d('0x46')](_0x361e10);})['then'](function(_0x3ba479){_0x3272bb[_0x352d('0x47')]=_0x3ba479;return _0x3272bb;})['then'](respondWithFilteredResult(_0x218fa7,_0x361e10))['catch'](handleError(_0x218fa7,null));};exports[_0x352d('0x48')]=function(_0x3efff4,_0x339b37){var _0xa1b64c={'raw':![],'where':{'id':_0x3efff4['params']['id']}},_0x127ce4={};_0x127ce4['model']=_['keys'](db[_0x352d('0x33')]['rawAttributes']);_0x127ce4[_0x352d('0x38')]=_[_0x352d('0x39')](_0x3efff4['query']);_0x127ce4[_0x352d('0x3a')]=_[_0x352d('0x3b')](_0x127ce4[_0x352d('0x37')],_0x127ce4[_0x352d('0x38')]);_0xa1b64c[_0x352d('0x3c')]=_[_0x352d('0x3b')](_0x127ce4['model'],qs[_0x352d('0x3d')](_0x3efff4[_0x352d('0x38')]['fields']));_0xa1b64c[_0x352d('0x3c')]=_0xa1b64c[_0x352d('0x3c')][_0x352d('0x3e')]?_0xa1b64c['attributes']:_0x127ce4[_0x352d('0x37')];if(_0x3efff4[_0x352d('0x38')][_0x352d('0x45')]){_0xa1b64c[_0x352d('0x49')]=[{'all':!![]}];}_0xa1b64c=_[_0x352d('0x4a')]({},_0xa1b64c,_0x3efff4['options']);return db[_0x352d('0x33')][_0x352d('0x4b')](_0xa1b64c)[_0x352d('0x2d')](handleEntityNotFound(_0x339b37,null))[_0x352d('0x2d')](respondWithResult(_0x339b37,null))[_0x352d('0x21')](handleError(_0x339b37,null));};exports[_0x352d('0x4c')]=function(_0x213168,_0x37fa0a){return db['FreshdeskConfiguration'][_0x352d('0x4c')](_0x213168[_0x352d('0x4d')],{})[_0x352d('0x2d')](respondWithResult(_0x37fa0a,0xc9))[_0x352d('0x21')](handleError(_0x37fa0a,null));};exports[_0x352d('0x2c')]=function(_0x56f677,_0x58aeba){if(_0x56f677['body']['id']){delete _0x56f677[_0x352d('0x4d')]['id'];}return db[_0x352d('0x33')][_0x352d('0x4b')]({'where':{'id':_0x56f677[_0x352d('0x4e')]['id']}})[_0x352d('0x2d')](handleEntityNotFound(_0x58aeba,null))[_0x352d('0x2d')](saveUpdates(_0x56f677[_0x352d('0x4d')],null))[_0x352d('0x2d')](respondWithResult(_0x58aeba,null))[_0x352d('0x21')](handleError(_0x58aeba,null));};exports[_0x352d('0x4f')]=function(_0x1fa8f8,_0x56e682){return db[_0x352d('0x33')][_0x352d('0x4b')]({'where':{'id':_0x1fa8f8['params']['id']}})[_0x352d('0x2d')](handleEntityNotFound(_0x56e682,null))[_0x352d('0x2d')](removeEntity(_0x56e682,null))['catch'](handleError(_0x56e682,null));};exports[_0x352d('0x50')]=function(_0x2c3e46,_0x5b1b67,_0x5f3077){var _0x62201f={};var _0x2720b4={};var _0x580ea0;var _0x2986a6;return db[_0x352d('0x33')][_0x352d('0x51')]({'where':{'id':_0x2c3e46[_0x352d('0x4e')]['id']}})[_0x352d('0x2d')](handleEntityNotFound(_0x5b1b67,null))[_0x352d('0x2d')](function(_0x4c81fc){if(_0x4c81fc){_0x580ea0=_0x4c81fc;_0x2720b4[_0x352d('0x37')]=_['keys'](db[_0x352d('0x52')][_0x352d('0x53')]);_0x2720b4['query']=_[_0x352d('0x39')](_0x2c3e46[_0x352d('0x38')]);_0x2720b4['filters']=_['intersection'](_0x2720b4['model'],_0x2720b4[_0x352d('0x38')]);_0x62201f[_0x352d('0x3c')]=_['intersection'](_0x2720b4[_0x352d('0x37')],qs['fields'](_0x2c3e46['query']['fields']));_0x62201f[_0x352d('0x3c')]=_0x62201f[_0x352d('0x3c')][_0x352d('0x3e')]?_0x62201f[_0x352d('0x3c')]:_0x2720b4['model'];_0x62201f[_0x352d('0x3f')]=qs[_0x352d('0x40')](_0x2c3e46[_0x352d('0x38')][_0x352d('0x40')]);_0x62201f['where']=qs['filters'](_[_0x352d('0x54')](_0x2c3e46[_0x352d('0x38')],_0x2720b4[_0x352d('0x3a')]));if(_0x2c3e46[_0x352d('0x38')]['filter']){_0x62201f['where']=_['merge'](_0x62201f['where'],{'$or':_['map'](_0x62201f[_0x352d('0x3c')],function(_0x17642d){var _0x770aec={};_0x770aec[_0x17642d]={'$like':'%'+_0x2c3e46['query'][_0x352d('0x43')]+'%'};return _0x770aec;})});}_0x62201f=_[_0x352d('0x4a')]({},_0x62201f,_0x2c3e46['options']);return _0x580ea0['getFields'](_0x62201f);}})[_0x352d('0x2d')](function(_0x54716a){if(_0x54716a){_0x2986a6=_0x54716a[_0x352d('0x3e')];if(!_0x2c3e46[_0x352d('0x38')][_0x352d('0x55')](_0x352d('0x56'))){_0x62201f['limit']=qs[_0x352d('0x27')](_0x2c3e46[_0x352d('0x38')][_0x352d('0x27')]);_0x62201f[_0x352d('0x26')]=qs[_0x352d('0x26')](_0x2c3e46['query'][_0x352d('0x26')]);}return _0x580ea0[_0x352d('0x50')](_0x62201f);}})[_0x352d('0x2d')](function(_0x4bedea){if(_0x4bedea){return _0x4bedea?{'count':_0x2986a6,'rows':_0x4bedea}:null;}})['then'](respondWithResult(_0x5b1b67,null))[_0x352d('0x21')](handleError(_0x5b1b67,null));};exports[_0x352d('0x57')]=function(_0x1d5cc9,_0x5f574c,_0x3f0f51){var _0xf8b848={};var _0x3dd8e4={};var _0x127fd9;var _0x149ef1;return db[_0x352d('0x33')][_0x352d('0x51')]({'where':{'id':_0x1d5cc9[_0x352d('0x4e')]['id']}})[_0x352d('0x2d')](handleEntityNotFound(_0x5f574c,null))['then'](function(_0x588915){if(_0x588915){_0x127fd9=_0x588915;_0x3dd8e4[_0x352d('0x37')]=_[_0x352d('0x39')](db[_0x352d('0x52')][_0x352d('0x53')]);_0x3dd8e4['query']=_[_0x352d('0x39')](_0x1d5cc9[_0x352d('0x38')]);_0x3dd8e4['filters']=_['intersection'](_0x3dd8e4[_0x352d('0x37')],_0x3dd8e4[_0x352d('0x38')]);_0xf8b848[_0x352d('0x3c')]=_[_0x352d('0x3b')](_0x3dd8e4['model'],qs['fields'](_0x1d5cc9[_0x352d('0x38')][_0x352d('0x3d')]));_0xf8b848[_0x352d('0x3c')]=_0xf8b848[_0x352d('0x3c')][_0x352d('0x3e')]?_0xf8b848[_0x352d('0x3c')]:_0x3dd8e4['model'];_0xf8b848[_0x352d('0x3f')]=qs['sort'](_0x1d5cc9[_0x352d('0x38')][_0x352d('0x40')]);_0xf8b848[_0x352d('0x41')]=qs[_0x352d('0x3a')](_[_0x352d('0x54')](_0x1d5cc9['query'],_0x3dd8e4[_0x352d('0x3a')]));if(_0x1d5cc9[_0x352d('0x38')]['filter']){_0xf8b848['where']=_[_0x352d('0x4a')](_0xf8b848[_0x352d('0x41')],{'$or':_[_0x352d('0x32')](_0xf8b848[_0x352d('0x3c')],function(_0x267163){var _0x3ac7c6={};_0x3ac7c6[_0x267163]={'$like':'%'+_0x1d5cc9[_0x352d('0x38')]['filter']+'%'};return _0x3ac7c6;})});}_0xf8b848=_[_0x352d('0x4a')]({},_0xf8b848,_0x1d5cc9[_0x352d('0x44')]);return _0x127fd9[_0x352d('0x57')](_0xf8b848);}})[_0x352d('0x2d')](function(_0x442a6b){if(_0x442a6b){_0x149ef1=_0x442a6b[_0x352d('0x3e')];if(!_0x1d5cc9['query']['hasOwnProperty'](_0x352d('0x56'))){_0xf8b848[_0x352d('0x27')]=qs[_0x352d('0x27')](_0x1d5cc9['query'][_0x352d('0x27')]);_0xf8b848['offset']=qs[_0x352d('0x26')](_0x1d5cc9['query'][_0x352d('0x26')]);}return _0x127fd9[_0x352d('0x57')](_0xf8b848);}})[_0x352d('0x2d')](function(_0x1eb5e1){if(_0x1eb5e1){return _0x1eb5e1?{'count':_0x149ef1,'rows':_0x1eb5e1}:null;}})[_0x352d('0x2d')](respondWithResult(_0x5f574c,null))['catch'](handleError(_0x5f574c,null));};exports[_0x352d('0x58')]=function(_0x3369a1,_0x5e5112,_0x428060){var _0x435fb4={};var _0x12255e={};var _0x4c6cb1;var _0xcabf0a;return db['FreshdeskConfiguration'][_0x352d('0x51')]({'where':{'id':_0x3369a1[_0x352d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5e5112,null))[_0x352d('0x2d')](function(_0x238344){if(_0x238344){_0x4c6cb1=_0x238344;_0x12255e['model']=_['keys'](db[_0x352d('0x52')][_0x352d('0x53')]);_0x12255e[_0x352d('0x38')]=_[_0x352d('0x39')](_0x3369a1['query']);_0x12255e['filters']=_[_0x352d('0x3b')](_0x12255e[_0x352d('0x37')],_0x12255e[_0x352d('0x38')]);_0x435fb4[_0x352d('0x3c')]=_[_0x352d('0x3b')](_0x12255e[_0x352d('0x37')],qs[_0x352d('0x3d')](_0x3369a1[_0x352d('0x38')][_0x352d('0x3d')]));_0x435fb4[_0x352d('0x3c')]=_0x435fb4[_0x352d('0x3c')][_0x352d('0x3e')]?_0x435fb4['attributes']:_0x12255e[_0x352d('0x37')];_0x435fb4['order']=qs[_0x352d('0x40')](_0x3369a1[_0x352d('0x38')][_0x352d('0x40')]);_0x435fb4[_0x352d('0x41')]=qs[_0x352d('0x3a')](_[_0x352d('0x54')](_0x3369a1[_0x352d('0x38')],_0x12255e[_0x352d('0x3a')]));if(_0x3369a1[_0x352d('0x38')][_0x352d('0x43')]){_0x435fb4[_0x352d('0x41')]=_['merge'](_0x435fb4[_0x352d('0x41')],{'$or':_[_0x352d('0x32')](_0x435fb4[_0x352d('0x3c')],function(_0x4c3a19){var _0x4d584d={};_0x4d584d[_0x4c3a19]={'$like':'%'+_0x3369a1['query'][_0x352d('0x43')]+'%'};return _0x4d584d;})});}_0x435fb4=_[_0x352d('0x4a')]({},_0x435fb4,_0x3369a1[_0x352d('0x44')]);return _0x4c6cb1['getDescriptions'](_0x435fb4);}})['then'](function(_0x2df9ad){if(_0x2df9ad){_0xcabf0a=_0x2df9ad['length'];if(!_0x3369a1[_0x352d('0x38')][_0x352d('0x55')](_0x352d('0x56'))){_0x435fb4[_0x352d('0x27')]=qs[_0x352d('0x27')](_0x3369a1[_0x352d('0x38')]['limit']);_0x435fb4[_0x352d('0x26')]=qs[_0x352d('0x26')](_0x3369a1['query']['offset']);}return _0x4c6cb1[_0x352d('0x58')](_0x435fb4);}})[_0x352d('0x2d')](function(_0x20c2e5){if(_0x20c2e5){return _0x20c2e5?{'count':_0xcabf0a,'rows':_0x20c2e5}:null;}})[_0x352d('0x2d')](respondWithResult(_0x5e5112,null))[_0x352d('0x21')](handleError(_0x5e5112,null));};exports['getTags']=function(_0x13d327,_0x2f1d71,_0x2b9140){var _0x5cd793={};var _0x206398={};var _0x5d193e;var _0x4e880e;return db[_0x352d('0x33')]['findOne']({'where':{'id':_0x13d327['params']['id']}})['then'](handleEntityNotFound(_0x2f1d71,null))[_0x352d('0x2d')](function(_0x25c13d){if(_0x25c13d){_0x5d193e=_0x25c13d;_0x206398[_0x352d('0x37')]=_[_0x352d('0x39')](db[_0x352d('0x59')][_0x352d('0x53')]);_0x206398[_0x352d('0x38')]=_[_0x352d('0x39')](_0x13d327[_0x352d('0x38')]);_0x206398[_0x352d('0x3a')]=_['intersection'](_0x206398['model'],_0x206398[_0x352d('0x38')]);_0x5cd793[_0x352d('0x3c')]=_[_0x352d('0x3b')](_0x206398['model'],qs['fields'](_0x13d327[_0x352d('0x38')][_0x352d('0x3d')]));_0x5cd793[_0x352d('0x3c')]=_0x5cd793[_0x352d('0x3c')][_0x352d('0x3e')]?_0x5cd793[_0x352d('0x3c')]:_0x206398['model'];_0x5cd793[_0x352d('0x3f')]=qs[_0x352d('0x40')](_0x13d327[_0x352d('0x38')]['sort']);_0x5cd793[_0x352d('0x41')]=qs[_0x352d('0x3a')](_[_0x352d('0x54')](_0x13d327['query'],_0x206398[_0x352d('0x3a')]));if(_0x13d327['query'][_0x352d('0x43')]){_0x5cd793['where']=_[_0x352d('0x4a')](_0x5cd793['where'],{'$or':_[_0x352d('0x32')](_0x5cd793['attributes'],function(_0x556f05){var _0x43721b={};_0x43721b[_0x556f05]={'$like':'%'+_0x13d327[_0x352d('0x38')]['filter']+'%'};return _0x43721b;})});}_0x5cd793=_[_0x352d('0x4a')]({},_0x5cd793,_0x13d327[_0x352d('0x44')]);return _0x5d193e[_0x352d('0x5a')](_0x5cd793);}})[_0x352d('0x2d')](function(_0x24b35c){if(_0x24b35c){_0x4e880e=_0x24b35c['length'];if(!_0x13d327[_0x352d('0x38')][_0x352d('0x55')]('nolimit')){_0x5cd793[_0x352d('0x27')]=qs[_0x352d('0x27')](_0x13d327[_0x352d('0x38')][_0x352d('0x27')]);_0x5cd793['offset']=qs['offset'](_0x13d327[_0x352d('0x38')][_0x352d('0x26')]);}return _0x5d193e['getTags'](_0x5cd793);}})[_0x352d('0x2d')](function(_0x547d7f){if(_0x547d7f){return _0x547d7f?{'count':_0x4e880e,'rows':_0x547d7f}:null;}})[_0x352d('0x2d')](respondWithResult(_0x2f1d71,null))[_0x352d('0x21')](handleError(_0x2f1d71,null));};exports[_0x352d('0x5b')]=function(_0x1d6239,_0x14a92d,_0x32d3bf){if(_0x1d6239[_0x352d('0x4d')]['id']){delete _0x1d6239['body']['id'];}return db[_0x352d('0x33')][_0x352d('0x51')]({'where':{'id':_0x1d6239[_0x352d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x14a92d,null))[_0x352d('0x2d')](function(_0x4ecce5){if(_0x4ecce5){return _0x4ecce5[_0x352d('0x5b')](_0x1d6239[_0x352d('0x4d')]['ids']||[]);}return null;})[_0x352d('0x2d')](respondWithResult(_0x14a92d,null))[_0x352d('0x21')](handleError(_0x14a92d,null));}; \ No newline at end of file +var _0x6971=['offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','sort','filters','pick','where','filter','merge','options','include','findAll','rows','show','includeAll','find','create','body','params','getFields','findOne','FreshdeskField','length','getSubjects','order','hasOwnProperty','getDescriptions','getTags','Tag','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','end','status','json','count'];(function(_0x15eb54,_0x2f69b0){var _0x22d8c3=function(_0x2dad2a){while(--_0x2dad2a){_0x15eb54['push'](_0x15eb54['shift']());}};_0x22d8c3(++_0x2f69b0);}(_0x6971,0x154));var _0x1697=function(_0x110a73,_0x1fe4b1){_0x110a73=_0x110a73-0x0;var _0x7ab3c7=_0x6971[_0x110a73];return _0x7ab3c7;};'use strict';var pdf=require(_0x1697('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1697('0x1'));var zipdir=require(_0x1697('0x2'));var jsonpatch=require(_0x1697('0x3'));var rp=require(_0x1697('0x4'));var moment=require(_0x1697('0x5'));var BPromise=require(_0x1697('0x6'));var Mustache=require(_0x1697('0x7'));var util=require(_0x1697('0x8'));var path=require(_0x1697('0x9'));var sox=require(_0x1697('0xa'));var csv=require(_0x1697('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1697('0xc'));var crypto=require(_0x1697('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1697('0xe'));var toCsv=require(_0x1697('0xb'));var querystring=require(_0x1697('0xf'));var Papa=require(_0x1697('0x10'));var Redis=require(_0x1697('0x11'));var authService=require(_0x1697('0x12'));var qs=require(_0x1697('0x13'));var as=require(_0x1697('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1697('0x15'))('api');var utils=require(_0x1697('0x16'));var config=require(_0x1697('0x17'));var licenseUtil=require(_0x1697('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x1697('0x19'));var client=jayson[_0x1697('0x1a')][_0x1697('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3e12a0,_0xcb25d2,_0x4841a9,_0x4601fb){return new BPromise(function(_0x57002b,_0x38898f){var _0x5ae19a=_0x4601fb||client;return _0x5ae19a[_0x1697('0x1c')](_0x3e12a0,_0x4841a9)[_0x1697('0x1d')](function(_0x94607e){logger[_0x1697('0x1e')](_0x1697('0x1f'),_0xcb25d2,'request\x20sent');logger[_0x1697('0x20')](_0x1697('0x21'),_0xcb25d2,_0x1697('0x22'),JSON['stringify'](_0x94607e));if(_0x94607e[_0x1697('0x23')]){if(_0x94607e[_0x1697('0x23')][_0x1697('0x24')]===0x1f4){logger[_0x1697('0x23')](_0x1697('0x1f'),_0xcb25d2,_0x94607e[_0x1697('0x23')][_0x1697('0x25')]);return _0x38898f(_0x94607e[_0x1697('0x23')]['message']);}logger[_0x1697('0x23')](_0x1697('0x1f'),_0xcb25d2,_0x94607e[_0x1697('0x23')][_0x1697('0x25')]);return _0x57002b(_0x94607e[_0x1697('0x23')][_0x1697('0x25')]);}else{logger['info'](_0x1697('0x1f'),_0xcb25d2,_0x1697('0x22'));_0x57002b(_0x94607e['result'][_0x1697('0x25')]);}})[_0x1697('0x26')](function(_0x1eaab0){logger[_0x1697('0x23')](_0x1697('0x1f'),_0xcb25d2,_0x1eaab0);_0x38898f(_0x1eaab0);});});}function respondWithStatusCode(_0x352cee,_0x7dd2ad){_0x7dd2ad=_0x7dd2ad||0xcc;return function(_0x24467b){if(_0x24467b){return _0x352cee[_0x1697('0x27')](_0x7dd2ad);}return _0x352cee['status'](_0x7dd2ad)[_0x1697('0x28')]();};}function respondWithResult(_0x1bb2ed,_0x4d9b87){_0x4d9b87=_0x4d9b87||0xc8;return function(_0x2a5bd6){if(_0x2a5bd6){return _0x1bb2ed[_0x1697('0x29')](_0x4d9b87)[_0x1697('0x2a')](_0x2a5bd6);}};}function respondWithFilteredResult(_0x10a107,_0x4721c6){return function(_0x29209e){if(_0x29209e){var _0x58bd09=_0x29209e[_0x1697('0x2b')],_0x50ac54=_0x4721c6[_0x1697('0x2c')],_0xe6a692=_0x4721c6[_0x1697('0x2c')]+_0x4721c6[_0x1697('0x2d')],_0x5dc3c2;if(_0xe6a692>=_0x58bd09){_0xe6a692=_0x58bd09;_0x5dc3c2=0xc8;}else{_0x5dc3c2=0xce;}_0x10a107[_0x1697('0x29')](_0x5dc3c2);return _0x10a107[_0x1697('0x2e')](_0x1697('0x2f'),_0x50ac54+'-'+_0xe6a692+'/'+_0x58bd09)[_0x1697('0x2a')](_0x29209e);}return null;};}function patchUpdates(_0x2a0a73){return function(_0x3d8013){try{jsonpatch[_0x1697('0x30')](_0x3d8013,_0x2a0a73,!![]);}catch(_0x80e754){return BPromise['reject'](_0x80e754);}return _0x3d8013[_0x1697('0x31')]();};}function saveUpdates(_0x43fb9d,_0x564057){return function(_0x3ebe41){if(_0x3ebe41){return _0x3ebe41[_0x1697('0x32')](_0x43fb9d)[_0x1697('0x1d')](function(_0x401260){return _0x401260;});}return null;};}function removeEntity(_0x495f90,_0x60d4c6){return function(_0x13ed24){if(_0x13ed24){return _0x13ed24[_0x1697('0x33')]()[_0x1697('0x1d')](function(){_0x495f90['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23fc37,_0x51c567){return function(_0x4f7fc1){if(!_0x4f7fc1){_0x23fc37[_0x1697('0x27')](0x194);}return _0x4f7fc1;};}function handleError(_0x5e0d7f,_0x243443){_0x243443=_0x243443||0x1f4;return function(_0xff90f5){logger[_0x1697('0x23')](_0xff90f5[_0x1697('0x34')]);if(_0xff90f5[_0x1697('0x35')]){delete _0xff90f5[_0x1697('0x35')];}_0x5e0d7f['status'](_0x243443)[_0x1697('0x36')](_0xff90f5);};}exports['index']=function(_0x2237f9,_0x223ae1){var _0x5b44e2={},_0x58841c={},_0x51c61d={'count':0x0,'rows':[]};var _0x4f1b91=_[_0x1697('0x37')](db[_0x1697('0x38')][_0x1697('0x39')],function(_0x123433){return{'name':_0x123433[_0x1697('0x3a')],'type':_0x123433[_0x1697('0x3b')][_0x1697('0x3c')]};});_0x58841c[_0x1697('0x3d')]=_[_0x1697('0x37')](_0x4f1b91,_0x1697('0x35'));_0x58841c[_0x1697('0x3e')]=_[_0x1697('0x3f')](_0x2237f9[_0x1697('0x3e')]);_0x58841c['filters']=_[_0x1697('0x40')](_0x58841c[_0x1697('0x3d')],_0x58841c[_0x1697('0x3e')]);_0x5b44e2[_0x1697('0x41')]=_[_0x1697('0x40')](_0x58841c[_0x1697('0x3d')],qs[_0x1697('0x42')](_0x2237f9['query']['fields']));_0x5b44e2[_0x1697('0x41')]=_0x5b44e2['attributes']['length']?_0x5b44e2['attributes']:_0x58841c[_0x1697('0x3d')];if(!_0x2237f9['query']['hasOwnProperty'](_0x1697('0x43'))){_0x5b44e2['limit']=qs['limit'](_0x2237f9[_0x1697('0x3e')][_0x1697('0x2d')]);_0x5b44e2[_0x1697('0x2c')]=qs['offset'](_0x2237f9[_0x1697('0x3e')][_0x1697('0x2c')]);}_0x5b44e2['order']=qs[_0x1697('0x44')](_0x2237f9['query']['sort']);_0x5b44e2['where']=qs[_0x1697('0x45')](_[_0x1697('0x46')](_0x2237f9[_0x1697('0x3e')],_0x58841c[_0x1697('0x45')]),_0x4f1b91);if(_0x2237f9[_0x1697('0x3e')]['filter']){_0x5b44e2[_0x1697('0x47')]=_['merge'](_0x5b44e2['where'],{'$or':_['map'](_0x4f1b91,function(_0x2fb897){if(_0x2fb897['type']!=='VIRTUAL'){var _0x28a023={};_0x28a023[_0x2fb897[_0x1697('0x35')]]={'$like':'%'+_0x2237f9[_0x1697('0x3e')][_0x1697('0x48')]+'%'};return _0x28a023;}})});}_0x5b44e2=_[_0x1697('0x49')]({},_0x5b44e2,_0x2237f9[_0x1697('0x4a')]);var _0x1c269d={'where':_0x5b44e2[_0x1697('0x47')]};return db['FreshdeskConfiguration'][_0x1697('0x2b')](_0x1c269d)[_0x1697('0x1d')](function(_0xc1d44f){_0x51c61d[_0x1697('0x2b')]=_0xc1d44f;if(_0x2237f9[_0x1697('0x3e')]['includeAll']){_0x5b44e2[_0x1697('0x4b')]=[{'all':!![]}];}return db[_0x1697('0x38')][_0x1697('0x4c')](_0x5b44e2);})[_0x1697('0x1d')](function(_0x14f818){_0x51c61d[_0x1697('0x4d')]=_0x14f818;return _0x51c61d;})[_0x1697('0x1d')](respondWithFilteredResult(_0x223ae1,_0x5b44e2))['catch'](handleError(_0x223ae1,null));};exports[_0x1697('0x4e')]=function(_0x24fd0d,_0x4656fb){var _0x519e9a={'raw':![],'where':{'id':_0x24fd0d['params']['id']}},_0x28f006={};_0x28f006['model']=_['keys'](db[_0x1697('0x38')][_0x1697('0x39')]);_0x28f006['query']=_[_0x1697('0x3f')](_0x24fd0d[_0x1697('0x3e')]);_0x28f006[_0x1697('0x45')]=_[_0x1697('0x40')](_0x28f006[_0x1697('0x3d')],_0x28f006[_0x1697('0x3e')]);_0x519e9a['attributes']=_[_0x1697('0x40')](_0x28f006[_0x1697('0x3d')],qs[_0x1697('0x42')](_0x24fd0d['query'][_0x1697('0x42')]));_0x519e9a[_0x1697('0x41')]=_0x519e9a[_0x1697('0x41')]['length']?_0x519e9a[_0x1697('0x41')]:_0x28f006[_0x1697('0x3d')];if(_0x24fd0d['query'][_0x1697('0x4f')]){_0x519e9a['include']=[{'all':!![]}];}_0x519e9a=_['merge']({},_0x519e9a,_0x24fd0d['options']);return db[_0x1697('0x38')][_0x1697('0x50')](_0x519e9a)[_0x1697('0x1d')](handleEntityNotFound(_0x4656fb,null))[_0x1697('0x1d')](respondWithResult(_0x4656fb,null))['catch'](handleError(_0x4656fb,null));};exports[_0x1697('0x51')]=function(_0x25f3f1,_0x44ba3c){return db[_0x1697('0x38')]['create'](_0x25f3f1[_0x1697('0x52')],{})[_0x1697('0x1d')](respondWithResult(_0x44ba3c,0xc9))['catch'](handleError(_0x44ba3c,null));};exports['update']=function(_0x43d412,_0x172829){if(_0x43d412[_0x1697('0x52')]['id']){delete _0x43d412[_0x1697('0x52')]['id'];}return db[_0x1697('0x38')][_0x1697('0x50')]({'where':{'id':_0x43d412[_0x1697('0x53')]['id']}})[_0x1697('0x1d')](handleEntityNotFound(_0x172829,null))[_0x1697('0x1d')](saveUpdates(_0x43d412[_0x1697('0x52')],null))[_0x1697('0x1d')](respondWithResult(_0x172829,null))[_0x1697('0x26')](handleError(_0x172829,null));};exports[_0x1697('0x33')]=function(_0x3b0e5f,_0x30d0df){return db['FreshdeskConfiguration'][_0x1697('0x50')]({'where':{'id':_0x3b0e5f['params']['id']}})['then'](handleEntityNotFound(_0x30d0df,null))[_0x1697('0x1d')](removeEntity(_0x30d0df,null))['catch'](handleError(_0x30d0df,null));};exports[_0x1697('0x54')]=function(_0x1fed0c,_0x55393a,_0x18324e){var _0x26d88d={};var _0x4bf438={};var _0x3b4a52;var _0x574e67;return db[_0x1697('0x38')][_0x1697('0x55')]({'where':{'id':_0x1fed0c[_0x1697('0x53')]['id']}})[_0x1697('0x1d')](handleEntityNotFound(_0x55393a,null))[_0x1697('0x1d')](function(_0x18a8a4){if(_0x18a8a4){_0x3b4a52=_0x18a8a4;_0x4bf438[_0x1697('0x3d')]=_[_0x1697('0x3f')](db[_0x1697('0x56')][_0x1697('0x39')]);_0x4bf438[_0x1697('0x3e')]=_[_0x1697('0x3f')](_0x1fed0c['query']);_0x4bf438['filters']=_[_0x1697('0x40')](_0x4bf438[_0x1697('0x3d')],_0x4bf438[_0x1697('0x3e')]);_0x26d88d['attributes']=_[_0x1697('0x40')](_0x4bf438[_0x1697('0x3d')],qs['fields'](_0x1fed0c[_0x1697('0x3e')][_0x1697('0x42')]));_0x26d88d['attributes']=_0x26d88d['attributes'][_0x1697('0x57')]?_0x26d88d[_0x1697('0x41')]:_0x4bf438[_0x1697('0x3d')];_0x26d88d['order']=qs[_0x1697('0x44')](_0x1fed0c['query'][_0x1697('0x44')]);_0x26d88d['where']=qs[_0x1697('0x45')](_['pick'](_0x1fed0c['query'],_0x4bf438['filters']));if(_0x1fed0c[_0x1697('0x3e')][_0x1697('0x48')]){_0x26d88d['where']=_[_0x1697('0x49')](_0x26d88d[_0x1697('0x47')],{'$or':_[_0x1697('0x37')](_0x26d88d['attributes'],function(_0x21ee1f){var _0x5b85d2={};_0x5b85d2[_0x21ee1f]={'$like':'%'+_0x1fed0c[_0x1697('0x3e')]['filter']+'%'};return _0x5b85d2;})});}_0x26d88d=_[_0x1697('0x49')]({},_0x26d88d,_0x1fed0c[_0x1697('0x4a')]);return _0x3b4a52[_0x1697('0x54')](_0x26d88d);}})[_0x1697('0x1d')](function(_0x41feb4){if(_0x41feb4){_0x574e67=_0x41feb4[_0x1697('0x57')];if(!_0x1fed0c[_0x1697('0x3e')]['hasOwnProperty'](_0x1697('0x43'))){_0x26d88d['limit']=qs[_0x1697('0x2d')](_0x1fed0c['query'][_0x1697('0x2d')]);_0x26d88d['offset']=qs['offset'](_0x1fed0c[_0x1697('0x3e')][_0x1697('0x2c')]);}return _0x3b4a52[_0x1697('0x54')](_0x26d88d);}})[_0x1697('0x1d')](function(_0x35b969){if(_0x35b969){return _0x35b969?{'count':_0x574e67,'rows':_0x35b969}:null;}})[_0x1697('0x1d')](respondWithResult(_0x55393a,null))[_0x1697('0x26')](handleError(_0x55393a,null));};exports[_0x1697('0x58')]=function(_0x357148,_0x5adebd,_0x3fd0ad){var _0x58b6b0={};var _0x5ee3e5={};var _0x133852;var _0x8ece7;return db[_0x1697('0x38')][_0x1697('0x55')]({'where':{'id':_0x357148['params']['id']}})[_0x1697('0x1d')](handleEntityNotFound(_0x5adebd,null))[_0x1697('0x1d')](function(_0x3e919c){if(_0x3e919c){_0x133852=_0x3e919c;_0x5ee3e5[_0x1697('0x3d')]=_['keys'](db[_0x1697('0x56')][_0x1697('0x39')]);_0x5ee3e5[_0x1697('0x3e')]=_[_0x1697('0x3f')](_0x357148['query']);_0x5ee3e5['filters']=_[_0x1697('0x40')](_0x5ee3e5[_0x1697('0x3d')],_0x5ee3e5[_0x1697('0x3e')]);_0x58b6b0['attributes']=_[_0x1697('0x40')](_0x5ee3e5[_0x1697('0x3d')],qs[_0x1697('0x42')](_0x357148[_0x1697('0x3e')]['fields']));_0x58b6b0[_0x1697('0x41')]=_0x58b6b0[_0x1697('0x41')][_0x1697('0x57')]?_0x58b6b0['attributes']:_0x5ee3e5[_0x1697('0x3d')];_0x58b6b0[_0x1697('0x59')]=qs[_0x1697('0x44')](_0x357148[_0x1697('0x3e')]['sort']);_0x58b6b0[_0x1697('0x47')]=qs[_0x1697('0x45')](_[_0x1697('0x46')](_0x357148['query'],_0x5ee3e5[_0x1697('0x45')]));if(_0x357148[_0x1697('0x3e')][_0x1697('0x48')]){_0x58b6b0[_0x1697('0x47')]=_['merge'](_0x58b6b0['where'],{'$or':_[_0x1697('0x37')](_0x58b6b0[_0x1697('0x41')],function(_0x30534e){var _0x458f29={};_0x458f29[_0x30534e]={'$like':'%'+_0x357148['query'][_0x1697('0x48')]+'%'};return _0x458f29;})});}_0x58b6b0=_[_0x1697('0x49')]({},_0x58b6b0,_0x357148[_0x1697('0x4a')]);return _0x133852[_0x1697('0x58')](_0x58b6b0);}})['then'](function(_0x17d7a3){if(_0x17d7a3){_0x8ece7=_0x17d7a3[_0x1697('0x57')];if(!_0x357148[_0x1697('0x3e')][_0x1697('0x5a')]('nolimit')){_0x58b6b0['limit']=qs[_0x1697('0x2d')](_0x357148[_0x1697('0x3e')][_0x1697('0x2d')]);_0x58b6b0['offset']=qs[_0x1697('0x2c')](_0x357148['query'][_0x1697('0x2c')]);}return _0x133852[_0x1697('0x58')](_0x58b6b0);}})['then'](function(_0x460c26){if(_0x460c26){return _0x460c26?{'count':_0x8ece7,'rows':_0x460c26}:null;}})[_0x1697('0x1d')](respondWithResult(_0x5adebd,null))['catch'](handleError(_0x5adebd,null));};exports[_0x1697('0x5b')]=function(_0x468237,_0x4a6ad3,_0x3dcc43){var _0x29a762={};var _0x243e69={};var _0x4ed132;var _0x1c0d38;return db[_0x1697('0x38')][_0x1697('0x55')]({'where':{'id':_0x468237[_0x1697('0x53')]['id']}})[_0x1697('0x1d')](handleEntityNotFound(_0x4a6ad3,null))[_0x1697('0x1d')](function(_0x46ccf5){if(_0x46ccf5){_0x4ed132=_0x46ccf5;_0x243e69[_0x1697('0x3d')]=_[_0x1697('0x3f')](db['FreshdeskField'][_0x1697('0x39')]);_0x243e69[_0x1697('0x3e')]=_['keys'](_0x468237[_0x1697('0x3e')]);_0x243e69[_0x1697('0x45')]=_[_0x1697('0x40')](_0x243e69['model'],_0x243e69[_0x1697('0x3e')]);_0x29a762[_0x1697('0x41')]=_[_0x1697('0x40')](_0x243e69[_0x1697('0x3d')],qs['fields'](_0x468237[_0x1697('0x3e')]['fields']));_0x29a762['attributes']=_0x29a762['attributes'][_0x1697('0x57')]?_0x29a762[_0x1697('0x41')]:_0x243e69['model'];_0x29a762[_0x1697('0x59')]=qs[_0x1697('0x44')](_0x468237[_0x1697('0x3e')][_0x1697('0x44')]);_0x29a762[_0x1697('0x47')]=qs['filters'](_[_0x1697('0x46')](_0x468237['query'],_0x243e69[_0x1697('0x45')]));if(_0x468237[_0x1697('0x3e')]['filter']){_0x29a762[_0x1697('0x47')]=_[_0x1697('0x49')](_0x29a762['where'],{'$or':_[_0x1697('0x37')](_0x29a762[_0x1697('0x41')],function(_0xb434f7){var _0x448401={};_0x448401[_0xb434f7]={'$like':'%'+_0x468237[_0x1697('0x3e')][_0x1697('0x48')]+'%'};return _0x448401;})});}_0x29a762=_[_0x1697('0x49')]({},_0x29a762,_0x468237[_0x1697('0x4a')]);return _0x4ed132[_0x1697('0x5b')](_0x29a762);}})[_0x1697('0x1d')](function(_0x3a4867){if(_0x3a4867){_0x1c0d38=_0x3a4867[_0x1697('0x57')];if(!_0x468237[_0x1697('0x3e')]['hasOwnProperty']('nolimit')){_0x29a762[_0x1697('0x2d')]=qs[_0x1697('0x2d')](_0x468237[_0x1697('0x3e')]['limit']);_0x29a762[_0x1697('0x2c')]=qs[_0x1697('0x2c')](_0x468237['query'][_0x1697('0x2c')]);}return _0x4ed132[_0x1697('0x5b')](_0x29a762);}})[_0x1697('0x1d')](function(_0x475784){if(_0x475784){return _0x475784?{'count':_0x1c0d38,'rows':_0x475784}:null;}})[_0x1697('0x1d')](respondWithResult(_0x4a6ad3,null))['catch'](handleError(_0x4a6ad3,null));};exports[_0x1697('0x5c')]=function(_0x551ad8,_0x1422d7,_0x379f8c){var _0x5422a4={};var _0xb075a6={};var _0x422179;var _0x5f16d6;return db['FreshdeskConfiguration'][_0x1697('0x55')]({'where':{'id':_0x551ad8['params']['id']}})['then'](handleEntityNotFound(_0x1422d7,null))[_0x1697('0x1d')](function(_0x166607){if(_0x166607){_0x422179=_0x166607;_0xb075a6[_0x1697('0x3d')]=_['keys'](db[_0x1697('0x5d')][_0x1697('0x39')]);_0xb075a6[_0x1697('0x3e')]=_[_0x1697('0x3f')](_0x551ad8[_0x1697('0x3e')]);_0xb075a6[_0x1697('0x45')]=_[_0x1697('0x40')](_0xb075a6['model'],_0xb075a6[_0x1697('0x3e')]);_0x5422a4[_0x1697('0x41')]=_['intersection'](_0xb075a6[_0x1697('0x3d')],qs[_0x1697('0x42')](_0x551ad8[_0x1697('0x3e')][_0x1697('0x42')]));_0x5422a4[_0x1697('0x41')]=_0x5422a4[_0x1697('0x41')][_0x1697('0x57')]?_0x5422a4[_0x1697('0x41')]:_0xb075a6[_0x1697('0x3d')];_0x5422a4[_0x1697('0x59')]=qs['sort'](_0x551ad8[_0x1697('0x3e')][_0x1697('0x44')]);_0x5422a4[_0x1697('0x47')]=qs['filters'](_[_0x1697('0x46')](_0x551ad8[_0x1697('0x3e')],_0xb075a6[_0x1697('0x45')]));if(_0x551ad8[_0x1697('0x3e')][_0x1697('0x48')]){_0x5422a4[_0x1697('0x47')]=_[_0x1697('0x49')](_0x5422a4['where'],{'$or':_['map'](_0x5422a4['attributes'],function(_0x442364){var _0x3879e4={};_0x3879e4[_0x442364]={'$like':'%'+_0x551ad8[_0x1697('0x3e')]['filter']+'%'};return _0x3879e4;})});}_0x5422a4=_['merge']({},_0x5422a4,_0x551ad8[_0x1697('0x4a')]);return _0x422179[_0x1697('0x5c')](_0x5422a4);}})[_0x1697('0x1d')](function(_0xef12d8){if(_0xef12d8){_0x5f16d6=_0xef12d8[_0x1697('0x57')];if(!_0x551ad8[_0x1697('0x3e')][_0x1697('0x5a')](_0x1697('0x43'))){_0x5422a4[_0x1697('0x2d')]=qs[_0x1697('0x2d')](_0x551ad8[_0x1697('0x3e')][_0x1697('0x2d')]);_0x5422a4[_0x1697('0x2c')]=qs[_0x1697('0x2c')](_0x551ad8[_0x1697('0x3e')][_0x1697('0x2c')]);}return _0x422179[_0x1697('0x5c')](_0x5422a4);}})['then'](function(_0xb23a28){if(_0xb23a28){return _0xb23a28?{'count':_0x5f16d6,'rows':_0xb23a28}:null;}})[_0x1697('0x1d')](respondWithResult(_0x1422d7,null))[_0x1697('0x26')](handleError(_0x1422d7,null));};exports['setTags']=function(_0x553a61,_0x292c60,_0x10a1bd){if(_0x553a61[_0x1697('0x52')]['id']){delete _0x553a61[_0x1697('0x52')]['id'];}return db[_0x1697('0x38')][_0x1697('0x55')]({'where':{'id':_0x553a61[_0x1697('0x53')]['id']}})[_0x1697('0x1d')](handleEntityNotFound(_0x292c60,null))[_0x1697('0x1d')](function(_0xe2d098){if(_0xe2d098){return _0xe2d098[_0x1697('0x5e')](_0x553a61[_0x1697('0x52')][_0x1697('0x5f')]||[]);}return null;})[_0x1697('0x1d')](respondWithResult(_0x292c60,null))[_0x1697('0x26')](handleError(_0x292c60,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 993ff32..14a2c3e 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 _0x5aee=['api','moment','bluebird','request-promise','path','exports','int_freshdesk_configurations','lodash','../../config/logger'];(function(_0x37ebc3,_0x3af10b){var _0x32fb72=function(_0x512898){while(--_0x512898){_0x37ebc3['push'](_0x37ebc3['shift']());}};_0x32fb72(++_0x3af10b);}(_0x5aee,0xbb));var _0xe5ae=function(_0x225a1e,_0x596a9d){_0x225a1e=_0x225a1e-0x0;var _0x422e4d=_0x5aee[_0x225a1e];return _0x422e4d;};'use strict';var _=require(_0xe5ae('0x0'));var util=require('util');var logger=require(_0xe5ae('0x1'))(_0xe5ae('0x2'));var moment=require(_0xe5ae('0x3'));var BPromise=require(_0xe5ae('0x4'));var rp=require(_0xe5ae('0x5'));var fs=require('fs');var path=require(_0xe5ae('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xe5ae('0x7')]=function(_0x46106e,_0x59da64){return _0x46106e['define']('FreshdeskConfiguration',attributes,{'tableName':_0xe5ae('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98a5=['path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x16d098,_0x27f362){var _0x1148d8=function(_0x391bde){while(--_0x391bde){_0x16d098['push'](_0x16d098['shift']());}};_0x1148d8(++_0x27f362);}(_0x98a5,0x16f));var _0x598a=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0x98a5[_0xd0a847];return _0x2536ec;};'use strict';var _=require('lodash');var util=require(_0x598a('0x0'));var logger=require(_0x598a('0x1'))('api');var moment=require(_0x598a('0x2'));var BPromise=require(_0x598a('0x3'));var rp=require(_0x598a('0x4'));var fs=require('fs');var path=require(_0x598a('0x5'));var rimraf=require(_0x598a('0x6'));var config=require(_0x598a('0x7'));var attributes=require(_0x598a('0x8'));module['exports']=function(_0xcfc37a,_0x16d522){return _0xcfc37a[_0x598a('0x9')](_0x598a('0xa'),attributes,{'tableName':_0x598a('0xb'),'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 e96090d..8d1dd39 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 _0x3ecd=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x3ecd,0xea));var _0xd3ec=function(_0x2dd413,_0x464b52){_0x2dd413=_0x2dd413-0x0;var _0xec3844=_0x3ecd[_0x2dd413];return _0xec3844;};'use strict';var _=require(_0xd3ec('0x0'));var util=require(_0xd3ec('0x1'));var moment=require(_0xd3ec('0x2'));var BPromise=require(_0xd3ec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3ec('0x4'));var db=require(_0xd3ec('0x5'))['db'];var utils=require(_0xd3ec('0x6'));var logger=require(_0xd3ec('0x7'))(_0xd3ec('0x8'));var config=require(_0xd3ec('0x9'));var jayson=require(_0xd3ec('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x412e98,_0x42751a,_0x2e32ac){return new BPromise(function(_0xb9b463,_0x128f46){return client[_0xd3ec('0xb')](_0x412e98,_0x2e32ac)[_0xd3ec('0xc')](function(_0x459d52){logger[_0xd3ec('0xd')](_0xd3ec('0xe'),_0x42751a,_0xd3ec('0xf'));logger[_0xd3ec('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x42751a,_0xd3ec('0xf'),JSON['stringify'](_0x459d52));if(_0x459d52[_0xd3ec('0x11')]){if(_0x459d52['error']['code']===0x1f4){logger['error'](_0xd3ec('0xe'),_0x42751a,_0x459d52[_0xd3ec('0x11')]['message']);return _0x128f46(_0x459d52[_0xd3ec('0x11')][_0xd3ec('0x12')]);}logger[_0xd3ec('0x11')](_0xd3ec('0xe'),_0x42751a,_0x459d52['error']['message']);return _0xb9b463(_0x459d52[_0xd3ec('0x11')][_0xd3ec('0x12')]);}else{logger[_0xd3ec('0xd')](_0xd3ec('0xe'),_0x42751a,_0xd3ec('0xf'));_0xb9b463(_0x459d52[_0xd3ec('0x13')]['message']);}})[_0xd3ec('0x14')](function(_0x4e27ba){logger[_0xd3ec('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x42751a,_0x4e27ba);_0x128f46(_0x4e27ba);});});} \ No newline at end of file +var _0x0423=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','info','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','FreshdeskConfiguration,\x20%s,\x20%s','result'];(function(_0x1ebafb,_0x5c9831){var _0x14ad17=function(_0x138889){while(--_0x138889){_0x1ebafb['push'](_0x1ebafb['shift']());}};_0x14ad17(++_0x5c9831);}(_0x0423,0xe8));var _0x3042=function(_0x52d8de,_0x32f714){_0x52d8de=_0x52d8de-0x0;var _0xa30123=_0x0423[_0x52d8de];return _0xa30123;};'use strict';var _=require(_0x3042('0x0'));var util=require(_0x3042('0x1'));var moment=require(_0x3042('0x2'));var BPromise=require(_0x3042('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3042('0x4'));var db=require(_0x3042('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3042('0x6'))(_0x3042('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x167ca9,_0x6c4a2a,_0x574b56){return new BPromise(function(_0x4d4c81,_0x3c162f){return client[_0x3042('0x9')](_0x167ca9,_0x574b56)[_0x3042('0xa')](function(_0x56c85a){logger[_0x3042('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x6c4a2a,'request\x20sent');logger[_0x3042('0xc')](_0x3042('0xd'),_0x6c4a2a,_0x3042('0xe'),JSON['stringify'](_0x56c85a));if(_0x56c85a['error']){if(_0x56c85a['error'][_0x3042('0xf')]===0x1f4){logger[_0x3042('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x6c4a2a,_0x56c85a['error'][_0x3042('0x11')]);return _0x3c162f(_0x56c85a[_0x3042('0x10')][_0x3042('0x11')]);}logger[_0x3042('0x10')](_0x3042('0x12'),_0x6c4a2a,_0x56c85a[_0x3042('0x10')][_0x3042('0x11')]);return _0x4d4c81(_0x56c85a[_0x3042('0x10')][_0x3042('0x11')]);}else{logger[_0x3042('0xb')](_0x3042('0x12'),_0x6c4a2a,'request\x20sent');_0x4d4c81(_0x56c85a[_0x3042('0x13')]['message']);}})[_0x3042('0x14')](function(_0x1f2535){logger['error'](_0x3042('0x12'),_0x6c4a2a,_0x1f2535);_0x3c162f(_0x1f2535);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index cc669fa..308a326 100644 --- a/server/api/intFreshdeskField/index.js +++ b/server/api/intFreshdeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x190e94,_0x117fc1){var _0x3012a0=function(_0x500c69){while(--_0x500c69){_0x190e94['push'](_0x190e94['shift']());}};_0x3012a0(++_0x117fc1);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['post']('/',auth[_0x49c4('0x9')](),controller[_0x49c4('0xb')]);router[_0x49c4('0xc')](_0x49c4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x49c4('0xd')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file +var _0xa9e0=['/:id','update','delete','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x5e9cbe,_0x5d1400){var _0x176cb0=function(_0x41350f){while(--_0x41350f){_0x5e9cbe['push'](_0x5e9cbe['shift']());}};_0x176cb0(++_0x5d1400);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index d967649..6f97b3f 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 _0xf006=['STRING','BOOLEAN','ENUM','string','customVariable','variable'];(function(_0x258d77,_0x53f74e){var _0x5a2f8a=function(_0x57089c){while(--_0x57089c){_0x258d77['push'](_0x258d77['shift']());}};_0x5a2f8a(++_0x53f74e);}(_0xf006,0x146));var _0x6f00=function(_0x309073,_0x59080f){_0x309073=_0x309073-0x0;var _0x339c73=_0xf006[_0x309073];return _0x339c73;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x6f00('0x0')](_0x6f00('0x1'),'variable',_0x6f00('0x2'),'keyValue'),'defaultValue':_0x6f00('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6f00('0x0')](_0x6f00('0x1'),_0x6f00('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x6f00('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6f00('0x4')]},'customField':{'type':Sequelize[_0x6f00('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6f00('0x4')]}}; \ No newline at end of file +var _0x1daf=['ENUM','BOOLEAN','sequelize','string','variable','customVariable','STRING'];(function(_0x41d562,_0x4b016a){var _0x2e2863=function(_0x103e9f){while(--_0x103e9f){_0x41d562['push'](_0x41d562['shift']());}};_0x2e2863(++_0x4b016a);}(_0x1daf,0x17c));var _0xf1da=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1daf[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf1da('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xf1da('0x1'),_0xf1da('0x2'),_0xf1da('0x3'),'keyValue'),'defaultValue':_0xf1da('0x1')},'content':{'type':Sequelize[_0xf1da('0x4')]},'key':{'type':Sequelize[_0xf1da('0x4')]},'keyType':{'type':Sequelize[_0xf1da('0x5')]('string',_0xf1da('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf1da('0x4')]},'nameField':{'type':Sequelize[_0xf1da('0x4')]},'customField':{'type':Sequelize[_0xf1da('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 4da14f1..ece646f 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 _0x3248=['rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','params','keys','length','find','catch','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','status','end','json','count','offset','Content-Range','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','FreshdeskField'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x3248,0x1bc));var _0x8324=function(_0x21a18b,_0xcf43fa){_0x21a18b=_0x21a18b-0x0;var _0x34104d=_0x3248[_0x21a18b];return _0x34104d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8324('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8324('0x1'));var rp=require(_0x8324('0x2'));var moment=require(_0x8324('0x3'));var BPromise=require(_0x8324('0x4'));var Mustache=require(_0x8324('0x5'));var util=require(_0x8324('0x6'));var path=require('path');var sox=require(_0x8324('0x7'));var csv=require(_0x8324('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8324('0x9'));var squel=require(_0x8324('0xa'));var crypto=require(_0x8324('0xb'));var jsforce=require(_0x8324('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8324('0x8'));var querystring=require(_0x8324('0xd'));var Papa=require(_0x8324('0xe'));var Redis=require(_0x8324('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8324('0x10'));var as=require(_0x8324('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8324('0x12'))(_0x8324('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8324('0x14'))['db'];function respondWithStatusCode(_0x24d731,_0x2aa8c1){_0x2aa8c1=_0x2aa8c1||0xcc;return function(_0x3619ec){if(_0x3619ec){return _0x24d731['sendStatus'](_0x2aa8c1);}return _0x24d731[_0x8324('0x15')](_0x2aa8c1)[_0x8324('0x16')]();};}function respondWithResult(_0x3882a4,_0x13a81f){_0x13a81f=_0x13a81f||0xc8;return function(_0x18a6fd){if(_0x18a6fd){return _0x3882a4['status'](_0x13a81f)[_0x8324('0x17')](_0x18a6fd);}};}function respondWithFilteredResult(_0x4651a0,_0x411e41){return function(_0x3b1a18){if(_0x3b1a18){var _0x3f8f66=_0x3b1a18[_0x8324('0x18')],_0x5ecb20=_0x411e41[_0x8324('0x19')],_0x8da92c=_0x411e41['offset']+_0x411e41['limit'],_0xaf20a5;if(_0x8da92c>=_0x3f8f66){_0x8da92c=_0x3f8f66;_0xaf20a5=0xc8;}else{_0xaf20a5=0xce;}_0x4651a0['status'](_0xaf20a5);return _0x4651a0['set'](_0x8324('0x1a'),_0x5ecb20+'-'+_0x8da92c+'/'+_0x3f8f66)[_0x8324('0x17')](_0x3b1a18);}return null;};}function patchUpdates(_0x271f09){return function(_0x111f33){try{jsonpatch['apply'](_0x111f33,_0x271f09,!![]);}catch(_0x8b8c64){return BPromise[_0x8324('0x1b')](_0x8b8c64);}return _0x111f33[_0x8324('0x1c')]();};}function saveUpdates(_0xbbf8e3,_0x3c2254){return function(_0x4885a9){if(_0x4885a9){return _0x4885a9[_0x8324('0x1d')](_0xbbf8e3)[_0x8324('0x1e')](function(_0x165f4c){return _0x165f4c;});}return null;};}function removeEntity(_0x4d648b,_0x378451){return function(_0x864bf8){if(_0x864bf8){return _0x864bf8[_0x8324('0x1f')]()[_0x8324('0x1e')](function(){_0x4d648b[_0x8324('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21c707,_0x351079){return function(_0x5274a1){if(!_0x5274a1){_0x21c707[_0x8324('0x20')](0x194);}return _0x5274a1;};}function handleError(_0xd50595,_0x28d239){_0x28d239=_0x28d239||0x1f4;return function(_0x43717d){logger[_0x8324('0x21')](_0x43717d['stack']);if(_0x43717d['name']){delete _0x43717d[_0x8324('0x22')];}_0xd50595[_0x8324('0x15')](_0x28d239)[_0x8324('0x23')](_0x43717d);};}exports[_0x8324('0x24')]=function(_0x2bd3bb,_0x41e2fd){var _0x5b2a1a={},_0x329ccc={},_0x542154={'count':0x0,'rows':[]};var _0x599563=_[_0x8324('0x25')](db[_0x8324('0x26')][_0x8324('0x27')],function(_0x2cf245){return{'name':_0x2cf245[_0x8324('0x28')],'type':_0x2cf245['type']['key']};});_0x329ccc[_0x8324('0x29')]=_['map'](_0x599563,'name');_0x329ccc[_0x8324('0x2a')]=_['keys'](_0x2bd3bb['query']);_0x329ccc[_0x8324('0x2b')]=_[_0x8324('0x2c')](_0x329ccc[_0x8324('0x29')],_0x329ccc[_0x8324('0x2a')]);_0x5b2a1a['attributes']=_[_0x8324('0x2c')](_0x329ccc[_0x8324('0x29')],qs[_0x8324('0x2d')](_0x2bd3bb['query'][_0x8324('0x2d')]));_0x5b2a1a[_0x8324('0x2e')]=_0x5b2a1a[_0x8324('0x2e')]['length']?_0x5b2a1a[_0x8324('0x2e')]:_0x329ccc[_0x8324('0x29')];if(!_0x2bd3bb['query'][_0x8324('0x2f')](_0x8324('0x30'))){_0x5b2a1a[_0x8324('0x31')]=qs[_0x8324('0x31')](_0x2bd3bb[_0x8324('0x2a')][_0x8324('0x31')]);_0x5b2a1a[_0x8324('0x19')]=qs[_0x8324('0x19')](_0x2bd3bb[_0x8324('0x2a')][_0x8324('0x19')]);}_0x5b2a1a[_0x8324('0x32')]=qs['sort'](_0x2bd3bb[_0x8324('0x2a')][_0x8324('0x33')]);_0x5b2a1a[_0x8324('0x34')]=qs[_0x8324('0x2b')](_[_0x8324('0x35')](_0x2bd3bb[_0x8324('0x2a')],_0x329ccc[_0x8324('0x2b')]),_0x599563);if(_0x2bd3bb['query'][_0x8324('0x36')]){_0x5b2a1a[_0x8324('0x34')]=_[_0x8324('0x37')](_0x5b2a1a[_0x8324('0x34')],{'$or':_[_0x8324('0x25')](_0x599563,function(_0x135bde){if(_0x135bde[_0x8324('0x38')]!==_0x8324('0x39')){var _0x47afe9={};_0x47afe9[_0x135bde[_0x8324('0x22')]]={'$like':'%'+_0x2bd3bb[_0x8324('0x2a')][_0x8324('0x36')]+'%'};return _0x47afe9;}})});}_0x5b2a1a=_[_0x8324('0x37')]({},_0x5b2a1a,_0x2bd3bb[_0x8324('0x3a')]);var _0x2df903={'where':_0x5b2a1a[_0x8324('0x34')]};return db[_0x8324('0x26')][_0x8324('0x18')](_0x2df903)[_0x8324('0x1e')](function(_0x48f4e5){_0x542154[_0x8324('0x18')]=_0x48f4e5;if(_0x2bd3bb[_0x8324('0x2a')][_0x8324('0x3b')]){_0x5b2a1a['include']=[{'all':!![]}];}return db[_0x8324('0x26')][_0x8324('0x3c')](_0x5b2a1a);})[_0x8324('0x1e')](function(_0x5dac5f){_0x542154[_0x8324('0x3d')]=_0x5dac5f;return _0x542154;})[_0x8324('0x1e')](respondWithFilteredResult(_0x41e2fd,_0x5b2a1a))['catch'](handleError(_0x41e2fd,null));};exports['show']=function(_0x5e221c,_0x4aaf19){var _0x47f5a0={'raw':!![],'where':{'id':_0x5e221c[_0x8324('0x3e')]['id']}},_0x296fc4={};_0x296fc4[_0x8324('0x29')]=_[_0x8324('0x3f')](db[_0x8324('0x26')][_0x8324('0x27')]);_0x296fc4[_0x8324('0x2a')]=_['keys'](_0x5e221c[_0x8324('0x2a')]);_0x296fc4[_0x8324('0x2b')]=_[_0x8324('0x2c')](_0x296fc4[_0x8324('0x29')],_0x296fc4[_0x8324('0x2a')]);_0x47f5a0['attributes']=_[_0x8324('0x2c')](_0x296fc4[_0x8324('0x29')],qs[_0x8324('0x2d')](_0x5e221c[_0x8324('0x2a')][_0x8324('0x2d')]));_0x47f5a0[_0x8324('0x2e')]=_0x47f5a0['attributes'][_0x8324('0x40')]?_0x47f5a0[_0x8324('0x2e')]:_0x296fc4['model'];if(_0x5e221c[_0x8324('0x2a')][_0x8324('0x3b')]){_0x47f5a0['include']=[{'all':!![]}];}_0x47f5a0=_[_0x8324('0x37')]({},_0x47f5a0,_0x5e221c[_0x8324('0x3a')]);return db[_0x8324('0x26')][_0x8324('0x41')](_0x47f5a0)[_0x8324('0x1e')](handleEntityNotFound(_0x4aaf19,null))[_0x8324('0x1e')](respondWithResult(_0x4aaf19,null))[_0x8324('0x42')](handleError(_0x4aaf19,null));};exports[_0x8324('0x43')]=function(_0x118d4a,_0x5e9f9f){return db[_0x8324('0x26')][_0x8324('0x43')](_0x118d4a[_0x8324('0x44')],{})['then'](respondWithResult(_0x5e9f9f,0xc9))[_0x8324('0x42')](handleError(_0x5e9f9f,null));};exports[_0x8324('0x1d')]=function(_0x489b2a,_0x160190){if(_0x489b2a[_0x8324('0x44')]['id']){delete _0x489b2a['body']['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x489b2a['params']['id']}})[_0x8324('0x1e')](handleEntityNotFound(_0x160190,null))['then'](saveUpdates(_0x489b2a[_0x8324('0x44')],null))[_0x8324('0x1e')](respondWithResult(_0x160190,null))[_0x8324('0x42')](handleError(_0x160190,null));};exports[_0x8324('0x1f')]=function(_0x35ef78,_0x9ab4fa){return db['FreshdeskField'][_0x8324('0x41')]({'where':{'id':_0x35ef78[_0x8324('0x3e')]['id']}})[_0x8324('0x1e')](handleEntityNotFound(_0x9ab4fa,null))[_0x8324('0x1e')](removeEntity(_0x9ab4fa,null))[_0x8324('0x42')](handleError(_0x9ab4fa,null));}; \ No newline at end of file +var _0x3efe=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','set','Content-Range','apply','save','destroy','then','end','sendStatus','error','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filter','where','merge','VIRTUAL','FreshdeskField','include','findAll','rows','show','params','includeAll','options','find','create','body','update','catch','eml-format'];(function(_0x119d25,_0x588c8){var _0x39cf30=function(_0x31c68c){while(--_0x31c68c){_0x119d25['push'](_0x119d25['shift']());}};_0x39cf30(++_0x588c8);}(_0x3efe,0x91));var _0xe3ef=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3efe[_0xfae23b];return _0x200640;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe3ef('0x0'));var rimraf=require(_0xe3ef('0x1'));var zipdir=require(_0xe3ef('0x2'));var jsonpatch=require(_0xe3ef('0x3'));var rp=require(_0xe3ef('0x4'));var moment=require(_0xe3ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe3ef('0x6'));var util=require(_0xe3ef('0x7'));var path=require(_0xe3ef('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe3ef('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe3ef('0xa'));var crypto=require(_0xe3ef('0xb'));var jsforce=require(_0xe3ef('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe3ef('0xd'));var querystring=require('querystring');var Papa=require(_0xe3ef('0xe'));var Redis=require(_0xe3ef('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe3ef('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3ef('0x11'));var logger=require(_0xe3ef('0x12'))(_0xe3ef('0x13'));var utils=require(_0xe3ef('0x14'));var config=require(_0xe3ef('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe3ef('0x16'))['db'];function respondWithStatusCode(_0x2bb316,_0x104af5){_0x104af5=_0x104af5||0xcc;return function(_0x2d0d66){if(_0x2d0d66){return _0x2bb316['sendStatus'](_0x104af5);}return _0x2bb316[_0xe3ef('0x17')](_0x104af5)['end']();};}function respondWithResult(_0x580718,_0x2d626b){_0x2d626b=_0x2d626b||0xc8;return function(_0x319da5){if(_0x319da5){return _0x580718[_0xe3ef('0x17')](_0x2d626b)[_0xe3ef('0x18')](_0x319da5);}};}function respondWithFilteredResult(_0x340b94,_0x2c8817){return function(_0x40a4f9){if(_0x40a4f9){var _0x3cf301=_0x40a4f9[_0xe3ef('0x19')],_0xa824a4=_0x2c8817['offset'],_0x30a36c=_0x2c8817['offset']+_0x2c8817['limit'],_0xdc089b;if(_0x30a36c>=_0x3cf301){_0x30a36c=_0x3cf301;_0xdc089b=0xc8;}else{_0xdc089b=0xce;}_0x340b94[_0xe3ef('0x17')](_0xdc089b);return _0x340b94[_0xe3ef('0x1a')](_0xe3ef('0x1b'),_0xa824a4+'-'+_0x30a36c+'/'+_0x3cf301)[_0xe3ef('0x18')](_0x40a4f9);}return null;};}function patchUpdates(_0x443705){return function(_0x2a8256){try{jsonpatch[_0xe3ef('0x1c')](_0x2a8256,_0x443705,!![]);}catch(_0x1ac7cf){return BPromise['reject'](_0x1ac7cf);}return _0x2a8256[_0xe3ef('0x1d')]();};}function saveUpdates(_0x1229f1,_0x5a7155){return function(_0x230f04){if(_0x230f04){return _0x230f04['update'](_0x1229f1)['then'](function(_0xd2144d){return _0xd2144d;});}return null;};}function removeEntity(_0x3fa4d8,_0x7ca06a){return function(_0x5b0d2f){if(_0x5b0d2f){return _0x5b0d2f[_0xe3ef('0x1e')]()[_0xe3ef('0x1f')](function(){_0x3fa4d8['status'](0xcc)[_0xe3ef('0x20')]();});}};}function handleEntityNotFound(_0x56f24e,_0x466e62){return function(_0x2771ce){if(!_0x2771ce){_0x56f24e[_0xe3ef('0x21')](0x194);}return _0x2771ce;};}function handleError(_0x495b8e,_0x72e1c5){_0x72e1c5=_0x72e1c5||0x1f4;return function(_0x1ecb8f){logger[_0xe3ef('0x22')](_0x1ecb8f['stack']);if(_0x1ecb8f[_0xe3ef('0x23')]){delete _0x1ecb8f['name'];}_0x495b8e[_0xe3ef('0x17')](_0x72e1c5)['send'](_0x1ecb8f);};}exports[_0xe3ef('0x24')]=function(_0x1c1509,_0x582a84){var _0x1169e2={},_0x1d4dee={},_0x11bd41={'count':0x0,'rows':[]};var _0x2309e7=_[_0xe3ef('0x25')](db['FreshdeskField'][_0xe3ef('0x26')],function(_0x5b43c8){return{'name':_0x5b43c8[_0xe3ef('0x27')],'type':_0x5b43c8[_0xe3ef('0x28')]['key']};});_0x1d4dee[_0xe3ef('0x29')]=_[_0xe3ef('0x25')](_0x2309e7,_0xe3ef('0x23'));_0x1d4dee[_0xe3ef('0x2a')]=_[_0xe3ef('0x2b')](_0x1c1509[_0xe3ef('0x2a')]);_0x1d4dee[_0xe3ef('0x2c')]=_[_0xe3ef('0x2d')](_0x1d4dee[_0xe3ef('0x29')],_0x1d4dee[_0xe3ef('0x2a')]);_0x1169e2[_0xe3ef('0x2e')]=_['intersection'](_0x1d4dee[_0xe3ef('0x29')],qs[_0xe3ef('0x2f')](_0x1c1509['query'][_0xe3ef('0x2f')]));_0x1169e2[_0xe3ef('0x2e')]=_0x1169e2['attributes'][_0xe3ef('0x30')]?_0x1169e2[_0xe3ef('0x2e')]:_0x1d4dee[_0xe3ef('0x29')];if(!_0x1c1509['query'][_0xe3ef('0x31')](_0xe3ef('0x32'))){_0x1169e2['limit']=qs[_0xe3ef('0x33')](_0x1c1509[_0xe3ef('0x2a')][_0xe3ef('0x33')]);_0x1169e2[_0xe3ef('0x34')]=qs['offset'](_0x1c1509[_0xe3ef('0x2a')][_0xe3ef('0x34')]);}_0x1169e2[_0xe3ef('0x35')]=qs['sort'](_0x1c1509[_0xe3ef('0x2a')][_0xe3ef('0x36')]);_0x1169e2['where']=qs[_0xe3ef('0x2c')](_[_0xe3ef('0x37')](_0x1c1509['query'],_0x1d4dee[_0xe3ef('0x2c')]),_0x2309e7);if(_0x1c1509['query'][_0xe3ef('0x38')]){_0x1169e2[_0xe3ef('0x39')]=_[_0xe3ef('0x3a')](_0x1169e2[_0xe3ef('0x39')],{'$or':_[_0xe3ef('0x25')](_0x2309e7,function(_0x1405ed){if(_0x1405ed['type']!==_0xe3ef('0x3b')){var _0x115911={};_0x115911[_0x1405ed['name']]={'$like':'%'+_0x1c1509[_0xe3ef('0x2a')]['filter']+'%'};return _0x115911;}})});}_0x1169e2=_[_0xe3ef('0x3a')]({},_0x1169e2,_0x1c1509['options']);var _0x349763={'where':_0x1169e2[_0xe3ef('0x39')]};return db[_0xe3ef('0x3c')]['count'](_0x349763)[_0xe3ef('0x1f')](function(_0x30cf40){_0x11bd41[_0xe3ef('0x19')]=_0x30cf40;if(_0x1c1509[_0xe3ef('0x2a')]['includeAll']){_0x1169e2[_0xe3ef('0x3d')]=[{'all':!![]}];}return db[_0xe3ef('0x3c')][_0xe3ef('0x3e')](_0x1169e2);})[_0xe3ef('0x1f')](function(_0x3675f6){_0x11bd41[_0xe3ef('0x3f')]=_0x3675f6;return _0x11bd41;})['then'](respondWithFilteredResult(_0x582a84,_0x1169e2))['catch'](handleError(_0x582a84,null));};exports[_0xe3ef('0x40')]=function(_0x3f51f7,_0x131fe3){var _0x5f48e0={'raw':!![],'where':{'id':_0x3f51f7[_0xe3ef('0x41')]['id']}},_0xcea1d2={};_0xcea1d2[_0xe3ef('0x29')]=_[_0xe3ef('0x2b')](db[_0xe3ef('0x3c')]['rawAttributes']);_0xcea1d2[_0xe3ef('0x2a')]=_[_0xe3ef('0x2b')](_0x3f51f7[_0xe3ef('0x2a')]);_0xcea1d2[_0xe3ef('0x2c')]=_[_0xe3ef('0x2d')](_0xcea1d2[_0xe3ef('0x29')],_0xcea1d2['query']);_0x5f48e0[_0xe3ef('0x2e')]=_[_0xe3ef('0x2d')](_0xcea1d2[_0xe3ef('0x29')],qs['fields'](_0x3f51f7[_0xe3ef('0x2a')]['fields']));_0x5f48e0[_0xe3ef('0x2e')]=_0x5f48e0[_0xe3ef('0x2e')]['length']?_0x5f48e0['attributes']:_0xcea1d2[_0xe3ef('0x29')];if(_0x3f51f7[_0xe3ef('0x2a')][_0xe3ef('0x42')]){_0x5f48e0[_0xe3ef('0x3d')]=[{'all':!![]}];}_0x5f48e0=_[_0xe3ef('0x3a')]({},_0x5f48e0,_0x3f51f7[_0xe3ef('0x43')]);return db['FreshdeskField'][_0xe3ef('0x44')](_0x5f48e0)[_0xe3ef('0x1f')](handleEntityNotFound(_0x131fe3,null))[_0xe3ef('0x1f')](respondWithResult(_0x131fe3,null))['catch'](handleError(_0x131fe3,null));};exports['create']=function(_0x18ecbf,_0xfe218f){return db[_0xe3ef('0x3c')][_0xe3ef('0x45')](_0x18ecbf[_0xe3ef('0x46')],{})['then'](respondWithResult(_0xfe218f,0xc9))['catch'](handleError(_0xfe218f,null));};exports[_0xe3ef('0x47')]=function(_0x430c35,_0x3383af){if(_0x430c35[_0xe3ef('0x46')]['id']){delete _0x430c35[_0xe3ef('0x46')]['id'];}return db[_0xe3ef('0x3c')][_0xe3ef('0x44')]({'where':{'id':_0x430c35[_0xe3ef('0x41')]['id']}})['then'](handleEntityNotFound(_0x3383af,null))[_0xe3ef('0x1f')](saveUpdates(_0x430c35[_0xe3ef('0x46')],null))[_0xe3ef('0x1f')](respondWithResult(_0x3383af,null))[_0xe3ef('0x48')](handleError(_0x3383af,null));};exports['destroy']=function(_0x10ec93,_0x4a8b0b){return db[_0xe3ef('0x3c')][_0xe3ef('0x44')]({'where':{'id':_0x10ec93[_0xe3ef('0x41')]['id']}})[_0xe3ef('0x1f')](handleEntityNotFound(_0x4a8b0b,null))[_0xe3ef('0x1f')](removeEntity(_0x4a8b0b,null))[_0xe3ef('0x48')](handleError(_0x4a8b0b,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 74a528d..3a175e9 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 _0x9464=['exports','define','FreshdeskField','int_freshdesk_fields','idField','FieldId','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4fccad,_0x3447af){var _0x9646ea=function(_0xde4e5f){while(--_0xde4e5f){_0x4fccad['push'](_0x4fccad['shift']());}};_0x9646ea(++_0x3447af);}(_0x9464,0x126));var _0x4946=function(_0x134827,_0x21f6ed){_0x134827=_0x134827-0x0;var _0x366671=_0x9464[_0x134827];return _0x366671;};'use strict';var _=require('lodash');var util=require(_0x4946('0x0'));var logger=require(_0x4946('0x1'))(_0x4946('0x2'));var moment=require(_0x4946('0x3'));var BPromise=require(_0x4946('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4946('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0x4946('0x6')]=function(_0x5d30ab,_0x2c0188){return _0x5d30ab[_0x4946('0x7')](_0x4946('0x8'),attributes,{'tableName':_0x4946('0x9'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x4946('0xa'),_0x4946('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe8bf=['FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define'];(function(_0x5e26af,_0x3be0b2){var _0x3609f1=function(_0x422ce2){while(--_0x422ce2){_0x5e26af['push'](_0x5e26af['shift']());}};_0x3609f1(++_0x3be0b2);}(_0xe8bf,0x19a));var _0xfe8b=function(_0x313814,_0x443ef2){_0x313814=_0x313814-0x0;var _0x27579e=_0xe8bf[_0x313814];return _0x27579e;};'use strict';var _=require(_0xfe8b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfe8b('0x1'));var moment=require(_0xfe8b('0x2'));var BPromise=require('bluebird');var rp=require(_0xfe8b('0x3'));var fs=require('fs');var path=require(_0xfe8b('0x4'));var rimraf=require(_0xfe8b('0x5'));var config=require(_0xfe8b('0x6'));var attributes=require(_0xfe8b('0x7'));module[_0xfe8b('0x8')]=function(_0x482083,_0x1b92d1){return _0x482083[_0xfe8b('0x9')](_0xfe8b('0xa'),attributes,{'tableName':_0xfe8b('0xb'),'paranoid':![],'indexes':[{'name':_0xfe8b('0xc'),'fields':['idField',_0xfe8b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 2e89e1b..f424756 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(_0x38f2b4,_0x1b7675){var _0x584e14=function(_0x44eb4b){while(--_0x44eb4b){_0x38f2b4['push'](_0x38f2b4['shift']());}};_0x584e14(++_0x1b7675);}(_0xb10b,0x12a));var _0xbb10=function(_0x602436,_0xbf433){_0x602436=_0x602436-0x0;var _0x504c33=_0xb10b[_0x602436];return _0x504c33;};'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 _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(_0x3bbb79,_0x4fe9bf){var _0x53eb07=function(_0x55b34d){while(--_0x55b34d){_0x3bbb79['push'](_0x3bbb79['shift']());}};_0x53eb07(++_0x4fe9bf);}(_0xb10b,0x12a));var _0xbb10=function(_0x91fbc7,_0x207e4c){_0x91fbc7=_0x91fbc7-0x0;var _0x32a811=_0xb10b[_0x91fbc7];return _0x32a811;};'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 diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 87cf553..8d3ae21 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 _0x3de8=['destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3de8,0x166));var _0x83de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3de8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x83de('0x0'));var timeout=require(_0x83de('0x1'));var express=require(_0x83de('0x2'));var router=express[_0x83de('0x3')]();var auth=require(_0x83de('0x4'));var interaction=require(_0x83de('0x5'));var config=require('../../config/environment');var controller=require(_0x83de('0x6'));router[_0x83de('0x7')]('/',auth[_0x83de('0x8')](),controller[_0x83de('0x9')]);router['get'](_0x83de('0xa'),auth[_0x83de('0x8')](),controller[_0x83de('0xb')]);router['get']('/:id/configurations',auth[_0x83de('0x8')](),controller['getConfigurations']);router[_0x83de('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x83de('0xc')]);router[_0x83de('0xd')]('/',auth[_0x83de('0x8')](),controller[_0x83de('0xe')]);router[_0x83de('0xd')](_0x83de('0xf'),auth['isAuthenticated'](),controller[_0x83de('0x10')]);router[_0x83de('0x11')](_0x83de('0xa'),auth[_0x83de('0x8')](),controller[_0x83de('0x12')]);router[_0x83de('0x13')](_0x83de('0xa'),auth[_0x83de('0x8')](),controller[_0x83de('0x14')]);module['exports']=router; \ No newline at end of file +var _0xaa07=['get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','post','/:id/configurations','addConfiguration','put','update','delete','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xaa07,0x13d));var _0x7aa0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xaa07[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x7aa0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7aa0('0x1'));var express=require('express');var router=express[_0x7aa0('0x2')]();var auth=require(_0x7aa0('0x3'));var interaction=require(_0x7aa0('0x4'));var config=require('../../config/environment');var controller=require(_0x7aa0('0x5'));router[_0x7aa0('0x6')]('/',auth[_0x7aa0('0x7')](),controller['index']);router[_0x7aa0('0x6')](_0x7aa0('0x8'),auth[_0x7aa0('0x7')](),controller[_0x7aa0('0x9')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x7aa0('0xa')]);router[_0x7aa0('0x6')](_0x7aa0('0xb'),auth[_0x7aa0('0x7')](),controller['getFields']);router[_0x7aa0('0xc')]('/',auth[_0x7aa0('0x7')](),controller['create']);router['post'](_0x7aa0('0xd'),auth[_0x7aa0('0x7')](),controller[_0x7aa0('0xe')]);router[_0x7aa0('0xf')](_0x7aa0('0x8'),auth[_0x7aa0('0x7')](),controller[_0x7aa0('0x10')]);router[_0x7aa0('0x11')](_0x7aa0('0x8'),auth[_0x7aa0('0x7')](),controller['destroy']);module[_0x7aa0('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 9ec8daf..e9329a8 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 _0x0dcd=['username','sequelize','STRING'];(function(_0x4039a2,_0x23242e){var _0x3d5892=function(_0x444129){while(--_0x444129){_0x4039a2['push'](_0x4039a2['shift']());}};_0x3d5892(++_0x23242e);}(_0x0dcd,0x18d));var _0xd0dc=function(_0x33806d,_0x3c0980){_0x33806d=_0x33806d-0x0;var _0x44d06a=_0x0dcd[_0x33806d];return _0x44d06a;};'use strict';var Sequelize=require(_0xd0dc('0x0'));module['exports']={'name':{'type':Sequelize[_0xd0dc('0x1')]},'description':{'type':Sequelize[_0xd0dc('0x1')]},'username':{'type':Sequelize[_0xd0dc('0x1')],'unique':_0xd0dc('0x2')},'apiKey':{'type':Sequelize[_0xd0dc('0x1')]},'remoteUri':{'type':Sequelize[_0xd0dc('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xd0dc('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xa29b=['remoteUri','sequelize','exports','STRING','username'];(function(_0x2a18cd,_0x3cd719){var _0x1d4faf=function(_0x24a9c0){while(--_0x24a9c0){_0x2a18cd['push'](_0x2a18cd['shift']());}};_0x1d4faf(++_0x3cd719);}(_0xa29b,0xd3));var _0xba29=function(_0x2e21e7,_0x5def61){_0x2e21e7=_0x2e21e7-0x0;var _0x3bb3d7=_0xa29b[_0x2e21e7];return _0x3bb3d7;};'use strict';var Sequelize=require(_0xba29('0x0'));module[_0xba29('0x1')]={'name':{'type':Sequelize[_0xba29('0x2')]},'description':{'type':Sequelize[_0xba29('0x2')]},'username':{'type':Sequelize[_0xba29('0x2')],'unique':_0xba29('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xba29('0x4')},'serverUrl':{'type':Sequelize[_0xba29('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 6cee68d..74d23e9 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 _0xde2c=['/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','code','FreshsalesAccount,\x20%s,\x20%s','error','message','result','catch','end','status','count','offset','limit','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','map','FreshsalesAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','where','filters','pick','filter','merge','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','destroy','getConfigurations','sort','addConfiguration','getSubjects','channel','Descriptions','FreshsalesConfiguration','FreshsalesField','Subjects','getFields','findOne','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s'];(function(_0x407ac2,_0xe80818){var _0xaf9b40=function(_0x482300){while(--_0x482300){_0x407ac2['push'](_0x407ac2['shift']());}};_0xaf9b40(++_0xe80818);}(_0xde2c,0x7f));var _0xcde2=function(_0x1ee0a1,_0x51058e){_0x1ee0a1=_0x1ee0a1-0x0;var _0x1d2d5b=_0xde2c[_0x1ee0a1];return _0x1d2d5b;};'use strict';var pdf=require(_0xcde2('0x0'));var emlformat=require(_0xcde2('0x1'));var rimraf=require(_0xcde2('0x2'));var zipdir=require(_0xcde2('0x3'));var jsonpatch=require(_0xcde2('0x4'));var rp=require(_0xcde2('0x5'));var moment=require(_0xcde2('0x6'));var BPromise=require(_0xcde2('0x7'));var Mustache=require('mustache');var util=require(_0xcde2('0x8'));var path=require(_0xcde2('0x9'));var sox=require(_0xcde2('0xa'));var csv=require(_0xcde2('0xb'));var ejs=require(_0xcde2('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcde2('0xd'));var crypto=require(_0xcde2('0xe'));var jsforce=require(_0xcde2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcde2('0x10'));var Papa=require(_0xcde2('0x11'));var Redis=require('ioredis');var authService=require(_0xcde2('0x12'));var qs=require(_0xcde2('0x13'));var as=require(_0xcde2('0x14'));var hardwareService=require(_0xcde2('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xcde2('0x16'));var config=require(_0xcde2('0x17'));var licenseUtil=require(_0xcde2('0x18'));var db=require(_0xcde2('0x19'))['db'];var integrations=require(_0xcde2('0x1a'));var jayson=require(_0xcde2('0x1b'));var client=jayson['client'][_0xcde2('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x577062,_0x31c3ba,_0x4f0ac9,_0x4b0e0e){return new BPromise(function(_0x34e079,_0x1c7103){var _0x417505=_0x4b0e0e||client;return _0x417505[_0xcde2('0x1d')](_0x577062,_0x4f0ac9)[_0xcde2('0x1e')](function(_0x5312c7){logger[_0xcde2('0x1f')]('FreshsalesAccount,\x20%s,\x20%s',_0x31c3ba,_0xcde2('0x20'));logger[_0xcde2('0x21')](_0xcde2('0x22'),_0x31c3ba,_0xcde2('0x20'),JSON['stringify'](_0x5312c7));if(_0x5312c7['error']){if(_0x5312c7['error'][_0xcde2('0x23')]===0x1f4){logger['error'](_0xcde2('0x24'),_0x31c3ba,_0x5312c7[_0xcde2('0x25')][_0xcde2('0x26')]);return _0x1c7103(_0x5312c7['error'][_0xcde2('0x26')]);}logger[_0xcde2('0x25')](_0xcde2('0x24'),_0x31c3ba,_0x5312c7[_0xcde2('0x25')][_0xcde2('0x26')]);return _0x34e079(_0x5312c7['error']['message']);}else{logger['info'](_0xcde2('0x24'),_0x31c3ba,_0xcde2('0x20'));_0x34e079(_0x5312c7[_0xcde2('0x27')][_0xcde2('0x26')]);}})[_0xcde2('0x28')](function(_0x5a7c5c){logger[_0xcde2('0x25')]('FreshsalesAccount,\x20%s,\x20%s',_0x31c3ba,_0x5a7c5c);_0x1c7103(_0x5a7c5c);});});}function respondWithStatusCode(_0x280d8c,_0xb2123c){_0xb2123c=_0xb2123c||0xcc;return function(_0x26d18e){if(_0x26d18e){return _0x280d8c['sendStatus'](_0xb2123c);}return _0x280d8c['status'](_0xb2123c)[_0xcde2('0x29')]();};}function respondWithResult(_0x207a12,_0x3e8aaf){_0x3e8aaf=_0x3e8aaf||0xc8;return function(_0x217ec9){if(_0x217ec9){return _0x207a12[_0xcde2('0x2a')](_0x3e8aaf)['json'](_0x217ec9);}};}function respondWithFilteredResult(_0x2d1d17,_0x45275a){return function(_0x1dce65){if(_0x1dce65){var _0x513965=_0x1dce65[_0xcde2('0x2b')],_0x2487eb=_0x45275a[_0xcde2('0x2c')],_0x348ca1=_0x45275a[_0xcde2('0x2c')]+_0x45275a[_0xcde2('0x2d')],_0x8e1655;if(_0x348ca1>=_0x513965){_0x348ca1=_0x513965;_0x8e1655=0xc8;}else{_0x8e1655=0xce;}_0x2d1d17[_0xcde2('0x2a')](_0x8e1655);return _0x2d1d17['set'](_0xcde2('0x2e'),_0x2487eb+'-'+_0x348ca1+'/'+_0x513965)['json'](_0x1dce65);}return null;};}function patchUpdates(_0x141072){return function(_0xb87851){try{jsonpatch[_0xcde2('0x2f')](_0xb87851,_0x141072,!![]);}catch(_0x49cb58){return BPromise[_0xcde2('0x30')](_0x49cb58);}return _0xb87851[_0xcde2('0x31')]();};}function saveUpdates(_0x58afb1,_0x26ec42){return function(_0x7c50ef){if(_0x7c50ef){return _0x7c50ef[_0xcde2('0x32')](_0x58afb1)[_0xcde2('0x1e')](function(_0x14f784){return _0x14f784;});}return null;};}function removeEntity(_0xb689cd,_0x11b817){return function(_0x41fdac){if(_0x41fdac){return _0x41fdac['destroy']()[_0xcde2('0x1e')](function(){_0xb689cd[_0xcde2('0x2a')](0xcc)[_0xcde2('0x29')]();});}};}function handleEntityNotFound(_0x15bd3e,_0x4e2c3a){return function(_0x2ae8e0){if(!_0x2ae8e0){_0x15bd3e[_0xcde2('0x33')](0x194);}return _0x2ae8e0;};}function handleError(_0x2e14f8,_0x2fec6e){_0x2fec6e=_0x2fec6e||0x1f4;return function(_0x498339){logger[_0xcde2('0x25')](_0x498339[_0xcde2('0x34')]);if(_0x498339[_0xcde2('0x35')]){delete _0x498339[_0xcde2('0x35')];}_0x2e14f8['status'](_0x2fec6e)[_0xcde2('0x36')](_0x498339);};}exports[_0xcde2('0x37')]=function(_0xbde4f4,_0x3090b6){var _0x1646a6={},_0x49d8d7={},_0x2cd313={'count':0x0,'rows':[]};var _0x31feeb=_[_0xcde2('0x38')](db[_0xcde2('0x39')]['rawAttributes'],function(_0x542246){return{'name':_0x542246[_0xcde2('0x3a')],'type':_0x542246[_0xcde2('0x3b')][_0xcde2('0x3c')]};});_0x49d8d7[_0xcde2('0x3d')]=_[_0xcde2('0x38')](_0x31feeb,_0xcde2('0x35'));_0x49d8d7[_0xcde2('0x3e')]=_[_0xcde2('0x3f')](_0xbde4f4[_0xcde2('0x3e')]);_0x49d8d7['filters']=_[_0xcde2('0x40')](_0x49d8d7[_0xcde2('0x3d')],_0x49d8d7[_0xcde2('0x3e')]);_0x1646a6[_0xcde2('0x41')]=_[_0xcde2('0x40')](_0x49d8d7['model'],qs['fields'](_0xbde4f4[_0xcde2('0x3e')][_0xcde2('0x42')]));_0x1646a6[_0xcde2('0x41')]=_0x1646a6[_0xcde2('0x41')][_0xcde2('0x43')]?_0x1646a6[_0xcde2('0x41')]:_0x49d8d7['model'];if(!_0xbde4f4['query']['hasOwnProperty'](_0xcde2('0x44'))){_0x1646a6[_0xcde2('0x2d')]=qs[_0xcde2('0x2d')](_0xbde4f4[_0xcde2('0x3e')][_0xcde2('0x2d')]);_0x1646a6[_0xcde2('0x2c')]=qs[_0xcde2('0x2c')](_0xbde4f4['query']['offset']);}_0x1646a6[_0xcde2('0x45')]=qs['sort'](_0xbde4f4[_0xcde2('0x3e')]['sort']);_0x1646a6[_0xcde2('0x46')]=qs[_0xcde2('0x47')](_[_0xcde2('0x48')](_0xbde4f4['query'],_0x49d8d7[_0xcde2('0x47')]),_0x31feeb);if(_0xbde4f4['query'][_0xcde2('0x49')]){_0x1646a6[_0xcde2('0x46')]=_[_0xcde2('0x4a')](_0x1646a6[_0xcde2('0x46')],{'$or':_[_0xcde2('0x38')](_0x31feeb,function(_0x27b64f){if(_0x27b64f['type']!=='VIRTUAL'){var _0x22084e={};_0x22084e[_0x27b64f['name']]={'$like':'%'+_0xbde4f4['query'][_0xcde2('0x49')]+'%'};return _0x22084e;}})});}_0x1646a6=_['merge']({},_0x1646a6,_0xbde4f4[_0xcde2('0x4b')]);var _0x2e99c8={'where':_0x1646a6['where']};return db[_0xcde2('0x39')]['count'](_0x2e99c8)['then'](function(_0x7e4a5e){_0x2cd313[_0xcde2('0x2b')]=_0x7e4a5e;if(_0xbde4f4['query'][_0xcde2('0x4c')]){_0x1646a6['include']=[{'all':!![]}];}return db[_0xcde2('0x39')][_0xcde2('0x4d')](_0x1646a6);})[_0xcde2('0x1e')](function(_0x411103){_0x2cd313[_0xcde2('0x4e')]=_0x411103;return _0x2cd313;})['then'](respondWithFilteredResult(_0x3090b6,_0x1646a6))[_0xcde2('0x28')](handleError(_0x3090b6,null));};exports[_0xcde2('0x4f')]=function(_0x40d14b,_0x2c78a5){var _0x47f8c3={'raw':![],'where':{'id':_0x40d14b[_0xcde2('0x50')]['id']}},_0x58ded4={};_0x58ded4['model']=_[_0xcde2('0x3f')](db[_0xcde2('0x39')][_0xcde2('0x51')]);_0x58ded4[_0xcde2('0x3e')]=_[_0xcde2('0x3f')](_0x40d14b[_0xcde2('0x3e')]);_0x58ded4['filters']=_[_0xcde2('0x40')](_0x58ded4['model'],_0x58ded4[_0xcde2('0x3e')]);_0x47f8c3['attributes']=_[_0xcde2('0x40')](_0x58ded4[_0xcde2('0x3d')],qs[_0xcde2('0x42')](_0x40d14b[_0xcde2('0x3e')][_0xcde2('0x42')]));_0x47f8c3[_0xcde2('0x41')]=_0x47f8c3['attributes'][_0xcde2('0x43')]?_0x47f8c3['attributes']:_0x58ded4[_0xcde2('0x3d')];if(_0x40d14b[_0xcde2('0x3e')][_0xcde2('0x4c')]){_0x47f8c3[_0xcde2('0x52')]=[{'all':!![]}];}_0x47f8c3=_[_0xcde2('0x4a')]({},_0x47f8c3,_0x40d14b[_0xcde2('0x4b')]);return db[_0xcde2('0x39')][_0xcde2('0x53')](_0x47f8c3)[_0xcde2('0x1e')](handleEntityNotFound(_0x2c78a5,null))[_0xcde2('0x1e')](respondWithResult(_0x2c78a5,null))[_0xcde2('0x28')](handleError(_0x2c78a5,null));};exports[_0xcde2('0x54')]=function(_0x5d777d,_0x53bd70){return db['FreshsalesAccount'][_0xcde2('0x54')](_0x5d777d['body'],{})[_0xcde2('0x1e')](respondWithResult(_0x53bd70,0xc9))[_0xcde2('0x28')](handleError(_0x53bd70,null));};exports[_0xcde2('0x32')]=function(_0x53349f,_0x33dc10){if(_0x53349f['body']['id']){delete _0x53349f[_0xcde2('0x55')]['id'];}return db['FreshsalesAccount'][_0xcde2('0x53')]({'where':{'id':_0x53349f[_0xcde2('0x50')]['id']}})['then'](handleEntityNotFound(_0x33dc10,null))[_0xcde2('0x1e')](saveUpdates(_0x53349f['body'],null))['then'](respondWithResult(_0x33dc10,null))[_0xcde2('0x28')](handleError(_0x33dc10,null));};exports[_0xcde2('0x56')]=function(_0x8eddd4,_0x255bab){return db[_0xcde2('0x39')][_0xcde2('0x53')]({'where':{'id':_0x8eddd4['params']['id']}})[_0xcde2('0x1e')](handleEntityNotFound(_0x255bab,null))[_0xcde2('0x1e')](removeEntity(_0x255bab,null))[_0xcde2('0x28')](handleError(_0x255bab,null));};exports[_0xcde2('0x57')]=function(_0x349818,_0x541a70,_0x50892c){var _0x5775bb={};var _0x30dee3={};var _0x35c6e5;var _0x6a9fa4;return db[_0xcde2('0x39')]['findOne']({'where':{'id':_0x349818[_0xcde2('0x50')]['id']}})[_0xcde2('0x1e')](handleEntityNotFound(_0x541a70,null))[_0xcde2('0x1e')](function(_0x2e18f4){if(_0x2e18f4){_0x35c6e5=_0x2e18f4;_0x30dee3[_0xcde2('0x3d')]=_[_0xcde2('0x3f')](db['FreshsalesConfiguration'][_0xcde2('0x51')]);_0x30dee3[_0xcde2('0x3e')]=_['keys'](_0x349818[_0xcde2('0x3e')]);_0x30dee3[_0xcde2('0x47')]=_[_0xcde2('0x40')](_0x30dee3[_0xcde2('0x3d')],_0x30dee3[_0xcde2('0x3e')]);_0x5775bb[_0xcde2('0x41')]=_[_0xcde2('0x40')](_0x30dee3[_0xcde2('0x3d')],qs[_0xcde2('0x42')](_0x349818[_0xcde2('0x3e')]['fields']));_0x5775bb[_0xcde2('0x41')]=_0x5775bb[_0xcde2('0x41')]['length']?_0x5775bb[_0xcde2('0x41')]:_0x30dee3[_0xcde2('0x3d')];_0x5775bb[_0xcde2('0x45')]=qs['sort'](_0x349818[_0xcde2('0x3e')][_0xcde2('0x58')]);_0x5775bb[_0xcde2('0x46')]=qs[_0xcde2('0x47')](_[_0xcde2('0x48')](_0x349818[_0xcde2('0x3e')],_0x30dee3[_0xcde2('0x47')]));if(_0x349818[_0xcde2('0x3e')][_0xcde2('0x49')]){_0x5775bb[_0xcde2('0x46')]=_[_0xcde2('0x4a')](_0x5775bb['where'],{'$or':_['map'](_0x5775bb[_0xcde2('0x41')],function(_0xd28773){var _0x1c9fbb={};_0x1c9fbb[_0xd28773]={'$like':'%'+_0x349818['query']['filter']+'%'};return _0x1c9fbb;})});}_0x5775bb=_['merge']({},_0x5775bb,_0x349818[_0xcde2('0x4b')]);return _0x35c6e5[_0xcde2('0x57')](_0x5775bb);}})[_0xcde2('0x1e')](function(_0x88614f){if(_0x88614f){_0x6a9fa4=_0x88614f[_0xcde2('0x43')];if(!_0x349818[_0xcde2('0x3e')]['hasOwnProperty']('nolimit')){_0x5775bb[_0xcde2('0x2d')]=qs[_0xcde2('0x2d')](_0x349818[_0xcde2('0x3e')][_0xcde2('0x2d')]);_0x5775bb[_0xcde2('0x2c')]=qs[_0xcde2('0x2c')](_0x349818[_0xcde2('0x3e')][_0xcde2('0x2c')]);}return _0x35c6e5[_0xcde2('0x57')](_0x5775bb);}})[_0xcde2('0x1e')](function(_0x2da2b2){if(_0x2da2b2){return _0x2da2b2?{'count':_0x6a9fa4,'rows':_0x2da2b2}:null;}})[_0xcde2('0x1e')](respondWithResult(_0x541a70,null))[_0xcde2('0x28')](handleError(_0x541a70,null));};exports[_0xcde2('0x59')]=function(_0x3f46ca,_0xb5e3,_0x3cf1aa){if(_0x3f46ca[_0xcde2('0x55')]['id']){delete _0x3f46ca[_0xcde2('0x55')]['id'];}return db[_0xcde2('0x39')]['findOne']({'where':{'id':_0x3f46ca[_0xcde2('0x50')]['id']}})[_0xcde2('0x1e')](handleEntityNotFound(_0xb5e3,null))[_0xcde2('0x1e')](function(_0x36ee59){if(_0x36ee59){_0x3f46ca[_0xcde2('0x55')]['AccountId']=_0x36ee59['id'];_0x3f46ca[_0xcde2('0x55')]['Subjects']=integrations[_0xcde2('0x5a')](_0x3f46ca[_0xcde2('0x55')][_0xcde2('0x5b')],_0x3f46ca[_0xcde2('0x55')][_0xcde2('0x3b')]);_0x3f46ca[_0xcde2('0x55')][_0xcde2('0x5c')]=integrations['getDescriptions'](_0x3f46ca['body'][_0xcde2('0x5b')],_0x3f46ca['body'][_0xcde2('0x3b')]);return db[_0xcde2('0x5d')][_0xcde2('0x54')](_0x3f46ca[_0xcde2('0x55')],{'include':[{'model':db[_0xcde2('0x5e')],'as':_0xcde2('0x5f')},{'model':db[_0xcde2('0x5e')],'as':'Descriptions'}]});}return null;})[_0xcde2('0x1e')](respondWithResult(_0xb5e3,null))[_0xcde2('0x28')](handleError(_0xb5e3,null));};exports[_0xcde2('0x60')]=function(_0x24b7b0,_0x5f2ec6,_0x15fff3){var _0x3a6898='';var _0x13478f='';return db[_0xcde2('0x39')][_0xcde2('0x61')]({'where':{'id':_0x24b7b0[_0xcde2('0x50')]['id']},'attributes':['id',_0xcde2('0x62'),_0xcde2('0x63'),_0xcde2('0x64')]})[_0xcde2('0x1e')](handleEntityNotFound(_0x5f2ec6,null))[_0xcde2('0x1e')](function(_0x225ddd){if(_0x225ddd){_0x13478f=_0x225ddd[_0xcde2('0x62')];_0x3a6898=_0x225ddd['remoteUri'];var _0x3a691d=_0x225ddd[_0xcde2('0x63')][_0xcde2('0x65')](-0x1);if(_0x3a691d==='/'){_0x3a6898=_0x3a6898[_0xcde2('0x66')](0x0,_0x3a6898[_0xcde2('0x67')](_0x3a691d));}return rp({'method':_0xcde2('0x68'),'uri':util[_0xcde2('0x69')](_0xcde2('0x6a'),_0x3a6898,_0xcde2('0x6b')),'headers':{'Authorization':_0xcde2('0x6c')+_0x225ddd[_0xcde2('0x64')]},'json':!![]});}})[_0xcde2('0x1e')](function(_0x2ac055){if(_0x2ac055){var _0x2ff2f2=_0x2ac055[_0xcde2('0x6d')];var _0x1d0b11=![];var _0x5c63d9=null;for(_0x5c63d9=0x0;_0x5c63d9<_0x2ff2f2['length'];_0x5c63d9++){if(_0x2ff2f2[_0x5c63d9][_0xcde2('0x6e')]===_0x13478f){_0x1d0b11=!![];}}if(_0x1d0b11){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xcde2('0x6f')});}}})[_0xcde2('0x1e')](respondWithResult(_0x5f2ec6,null))[_0xcde2('0x28')](function(_0x4ffd32){var _0x9afade=_0x24b7b0['query'][_0xcde2('0x70')]?0x1f4:_0x4ffd32['statusCode']||0x1f4;logger[_0xcde2('0x25')](_0xcde2('0x71'),'getFields',_0x9afade,JSON[_0xcde2('0x72')](_0x4ffd32));delete _0x4ffd32[_0xcde2('0x35')];if(_0x9afade===0x191){_0x9afade=0x190;}_0x5f2ec6[_0xcde2('0x2a')](_0x9afade)['send'](_0x24b7b0[_0xcde2('0x3e')][_0xcde2('0x70')]?{'message':_0xcde2('0x73'),'statusCode':_0x4ffd32[_0xcde2('0x74')]}:_0x4ffd32);});}; \ No newline at end of file +var _0xb49a=['AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','getFields','username','remoteUri','slice','substring','GET','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesAccount,\x20%s,\x20%s','result','catch','status','end','count','offset','Content-Range','apply','reject','save','update','stack','name','map','FreshsalesAccount','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','create','body','destroy','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration'];(function(_0x26728c,_0x22178f){var _0x1eb2e5=function(_0x265663){while(--_0x265663){_0x26728c['push'](_0x26728c['shift']());}};_0x1eb2e5(++_0x22178f);}(_0xb49a,0xfb));var _0xab49=function(_0x1e7944,_0x5a1ee7){_0x1e7944=_0x1e7944-0x0;var _0x4be825=_0xb49a[_0x1e7944];return _0x4be825;};'use strict';var pdf=require(_0xab49('0x0'));var emlformat=require(_0xab49('0x1'));var rimraf=require(_0xab49('0x2'));var zipdir=require(_0xab49('0x3'));var jsonpatch=require(_0xab49('0x4'));var rp=require('request-promise');var moment=require(_0xab49('0x5'));var BPromise=require(_0xab49('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xab49('0x7'));var sox=require(_0xab49('0x8'));var csv=require(_0xab49('0x9'));var ejs=require(_0xab49('0xa'));var fs=require('fs');var _=require(_0xab49('0xb'));var squel=require(_0xab49('0xc'));var crypto=require(_0xab49('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xab49('0xe'));var toCsv=require(_0xab49('0x9'));var querystring=require(_0xab49('0xf'));var Papa=require(_0xab49('0x10'));var Redis=require(_0xab49('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xab49('0x12'));var hardwareService=require(_0xab49('0x13'));var logger=require(_0xab49('0x14'))(_0xab49('0x15'));var utils=require(_0xab49('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xab49('0x17'));var db=require(_0xab49('0x18'))['db'];var integrations=require(_0xab49('0x19'));var jayson=require(_0xab49('0x1a'));var client=jayson[_0xab49('0x1b')][_0xab49('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x11d285,_0x136f5f,_0x24b4ad,_0x389ebb){return new BPromise(function(_0x40f465,_0x5ea744){var _0xcd137f=_0x389ebb||client;return _0xcd137f[_0xab49('0x1d')](_0x11d285,_0x24b4ad)[_0xab49('0x1e')](function(_0x9c59e1){logger[_0xab49('0x1f')]('FreshsalesAccount,\x20%s,\x20%s',_0x136f5f,_0xab49('0x20'));logger[_0xab49('0x21')](_0xab49('0x22'),_0x136f5f,_0xab49('0x20'),JSON[_0xab49('0x23')](_0x9c59e1));if(_0x9c59e1['error']){if(_0x9c59e1[_0xab49('0x24')][_0xab49('0x25')]===0x1f4){logger[_0xab49('0x24')]('FreshsalesAccount,\x20%s,\x20%s',_0x136f5f,_0x9c59e1['error'][_0xab49('0x26')]);return _0x5ea744(_0x9c59e1[_0xab49('0x24')]['message']);}logger[_0xab49('0x24')](_0xab49('0x27'),_0x136f5f,_0x9c59e1['error'][_0xab49('0x26')]);return _0x40f465(_0x9c59e1['error'][_0xab49('0x26')]);}else{logger[_0xab49('0x1f')]('FreshsalesAccount,\x20%s,\x20%s',_0x136f5f,'request\x20sent');_0x40f465(_0x9c59e1[_0xab49('0x28')]['message']);}})[_0xab49('0x29')](function(_0x532788){logger[_0xab49('0x24')](_0xab49('0x27'),_0x136f5f,_0x532788);_0x5ea744(_0x532788);});});}function respondWithStatusCode(_0x2ba18a,_0x579039){_0x579039=_0x579039||0xcc;return function(_0x2bf8e0){if(_0x2bf8e0){return _0x2ba18a['sendStatus'](_0x579039);}return _0x2ba18a[_0xab49('0x2a')](_0x579039)[_0xab49('0x2b')]();};}function respondWithResult(_0x5c3d71,_0x29096f){_0x29096f=_0x29096f||0xc8;return function(_0x18e65a){if(_0x18e65a){return _0x5c3d71['status'](_0x29096f)['json'](_0x18e65a);}};}function respondWithFilteredResult(_0x11446b,_0x2e0e37){return function(_0x1b70e1){if(_0x1b70e1){var _0x5b7c22=_0x1b70e1[_0xab49('0x2c')],_0x1b1fed=_0x2e0e37[_0xab49('0x2d')],_0x237273=_0x2e0e37[_0xab49('0x2d')]+_0x2e0e37['limit'],_0x4bf0cf;if(_0x237273>=_0x5b7c22){_0x237273=_0x5b7c22;_0x4bf0cf=0xc8;}else{_0x4bf0cf=0xce;}_0x11446b[_0xab49('0x2a')](_0x4bf0cf);return _0x11446b['set'](_0xab49('0x2e'),_0x1b1fed+'-'+_0x237273+'/'+_0x5b7c22)['json'](_0x1b70e1);}return null;};}function patchUpdates(_0x19f094){return function(_0x54942c){try{jsonpatch[_0xab49('0x2f')](_0x54942c,_0x19f094,!![]);}catch(_0x24bd0f){return BPromise[_0xab49('0x30')](_0x24bd0f);}return _0x54942c[_0xab49('0x31')]();};}function saveUpdates(_0x49f122,_0x6e83f6){return function(_0x1ea20e){if(_0x1ea20e){return _0x1ea20e[_0xab49('0x32')](_0x49f122)['then'](function(_0x2b18b9){return _0x2b18b9;});}return null;};}function removeEntity(_0x569569,_0x246dee){return function(_0x4f6352){if(_0x4f6352){return _0x4f6352['destroy']()['then'](function(){_0x569569[_0xab49('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17260e,_0x2e013f){return function(_0x15c7f1){if(!_0x15c7f1){_0x17260e['sendStatus'](0x194);}return _0x15c7f1;};}function handleError(_0x114cc0,_0x1292f6){_0x1292f6=_0x1292f6||0x1f4;return function(_0x3cc88b){logger[_0xab49('0x24')](_0x3cc88b[_0xab49('0x33')]);if(_0x3cc88b['name']){delete _0x3cc88b[_0xab49('0x34')];}_0x114cc0[_0xab49('0x2a')](_0x1292f6)['send'](_0x3cc88b);};}exports['index']=function(_0x2b97e5,_0x29c6cf){var _0x30ee5e={},_0x224b7f={},_0x325ad9={'count':0x0,'rows':[]};var _0x26daf3=_[_0xab49('0x35')](db[_0xab49('0x36')][_0xab49('0x37')],function(_0x43027f){return{'name':_0x43027f[_0xab49('0x38')],'type':_0x43027f[_0xab49('0x39')][_0xab49('0x3a')]};});_0x224b7f['model']=_[_0xab49('0x35')](_0x26daf3,_0xab49('0x34'));_0x224b7f[_0xab49('0x3b')]=_[_0xab49('0x3c')](_0x2b97e5[_0xab49('0x3b')]);_0x224b7f['filters']=_[_0xab49('0x3d')](_0x224b7f['model'],_0x224b7f['query']);_0x30ee5e[_0xab49('0x3e')]=_[_0xab49('0x3d')](_0x224b7f[_0xab49('0x3f')],qs[_0xab49('0x40')](_0x2b97e5[_0xab49('0x3b')]['fields']));_0x30ee5e[_0xab49('0x3e')]=_0x30ee5e[_0xab49('0x3e')][_0xab49('0x41')]?_0x30ee5e[_0xab49('0x3e')]:_0x224b7f[_0xab49('0x3f')];if(!_0x2b97e5['query']['hasOwnProperty'](_0xab49('0x42'))){_0x30ee5e[_0xab49('0x43')]=qs[_0xab49('0x43')](_0x2b97e5['query'][_0xab49('0x43')]);_0x30ee5e['offset']=qs['offset'](_0x2b97e5['query']['offset']);}_0x30ee5e[_0xab49('0x44')]=qs[_0xab49('0x45')](_0x2b97e5[_0xab49('0x3b')][_0xab49('0x45')]);_0x30ee5e[_0xab49('0x46')]=qs[_0xab49('0x47')](_[_0xab49('0x48')](_0x2b97e5[_0xab49('0x3b')],_0x224b7f[_0xab49('0x47')]),_0x26daf3);if(_0x2b97e5[_0xab49('0x3b')]['filter']){_0x30ee5e[_0xab49('0x46')]=_[_0xab49('0x49')](_0x30ee5e['where'],{'$or':_[_0xab49('0x35')](_0x26daf3,function(_0x204ff3){if(_0x204ff3[_0xab49('0x39')]!==_0xab49('0x4a')){var _0x393959={};_0x393959[_0x204ff3[_0xab49('0x34')]]={'$like':'%'+_0x2b97e5[_0xab49('0x3b')][_0xab49('0x4b')]+'%'};return _0x393959;}})});}_0x30ee5e=_['merge']({},_0x30ee5e,_0x2b97e5[_0xab49('0x4c')]);var _0x1a0b03={'where':_0x30ee5e[_0xab49('0x46')]};return db['FreshsalesAccount'][_0xab49('0x2c')](_0x1a0b03)[_0xab49('0x1e')](function(_0x1bfd4e){_0x325ad9[_0xab49('0x2c')]=_0x1bfd4e;if(_0x2b97e5[_0xab49('0x3b')][_0xab49('0x4d')]){_0x30ee5e['include']=[{'all':!![]}];}return db[_0xab49('0x36')][_0xab49('0x4e')](_0x30ee5e);})[_0xab49('0x1e')](function(_0x33b568){_0x325ad9[_0xab49('0x4f')]=_0x33b568;return _0x325ad9;})[_0xab49('0x1e')](respondWithFilteredResult(_0x29c6cf,_0x30ee5e))['catch'](handleError(_0x29c6cf,null));};exports[_0xab49('0x50')]=function(_0x186fcf,_0x20631b){var _0xca56ce={'raw':![],'where':{'id':_0x186fcf[_0xab49('0x51')]['id']}},_0xeea2c8={};_0xeea2c8[_0xab49('0x3f')]=_[_0xab49('0x3c')](db[_0xab49('0x36')][_0xab49('0x37')]);_0xeea2c8[_0xab49('0x3b')]=_[_0xab49('0x3c')](_0x186fcf['query']);_0xeea2c8[_0xab49('0x47')]=_[_0xab49('0x3d')](_0xeea2c8[_0xab49('0x3f')],_0xeea2c8[_0xab49('0x3b')]);_0xca56ce[_0xab49('0x3e')]=_[_0xab49('0x3d')](_0xeea2c8[_0xab49('0x3f')],qs['fields'](_0x186fcf[_0xab49('0x3b')]['fields']));_0xca56ce[_0xab49('0x3e')]=_0xca56ce['attributes'][_0xab49('0x41')]?_0xca56ce[_0xab49('0x3e')]:_0xeea2c8['model'];if(_0x186fcf[_0xab49('0x3b')][_0xab49('0x4d')]){_0xca56ce[_0xab49('0x52')]=[{'all':!![]}];}_0xca56ce=_[_0xab49('0x49')]({},_0xca56ce,_0x186fcf[_0xab49('0x4c')]);return db[_0xab49('0x36')][_0xab49('0x53')](_0xca56ce)[_0xab49('0x1e')](handleEntityNotFound(_0x20631b,null))[_0xab49('0x1e')](respondWithResult(_0x20631b,null))[_0xab49('0x29')](handleError(_0x20631b,null));};exports[_0xab49('0x54')]=function(_0x360b11,_0x31955b){return db[_0xab49('0x36')][_0xab49('0x54')](_0x360b11[_0xab49('0x55')],{})[_0xab49('0x1e')](respondWithResult(_0x31955b,0xc9))['catch'](handleError(_0x31955b,null));};exports[_0xab49('0x32')]=function(_0x2a609e,_0x1dfaaa){if(_0x2a609e[_0xab49('0x55')]['id']){delete _0x2a609e[_0xab49('0x55')]['id'];}return db['FreshsalesAccount'][_0xab49('0x53')]({'where':{'id':_0x2a609e[_0xab49('0x51')]['id']}})[_0xab49('0x1e')](handleEntityNotFound(_0x1dfaaa,null))[_0xab49('0x1e')](saveUpdates(_0x2a609e[_0xab49('0x55')],null))[_0xab49('0x1e')](respondWithResult(_0x1dfaaa,null))['catch'](handleError(_0x1dfaaa,null));};exports[_0xab49('0x56')]=function(_0x1d6bd3,_0x100c5a){return db[_0xab49('0x36')]['find']({'where':{'id':_0x1d6bd3['params']['id']}})[_0xab49('0x1e')](handleEntityNotFound(_0x100c5a,null))['then'](removeEntity(_0x100c5a,null))[_0xab49('0x29')](handleError(_0x100c5a,null));};exports[_0xab49('0x57')]=function(_0xa49709,_0x2cfce0,_0xbad48e){var _0x22294f={};var _0x1ba368={};var _0x10da44;var _0x4de03d;return db[_0xab49('0x36')][_0xab49('0x58')]({'where':{'id':_0xa49709[_0xab49('0x51')]['id']}})[_0xab49('0x1e')](handleEntityNotFound(_0x2cfce0,null))[_0xab49('0x1e')](function(_0x5205e0){if(_0x5205e0){_0x10da44=_0x5205e0;_0x1ba368[_0xab49('0x3f')]=_[_0xab49('0x3c')](db[_0xab49('0x59')][_0xab49('0x37')]);_0x1ba368[_0xab49('0x3b')]=_[_0xab49('0x3c')](_0xa49709[_0xab49('0x3b')]);_0x1ba368[_0xab49('0x47')]=_[_0xab49('0x3d')](_0x1ba368[_0xab49('0x3f')],_0x1ba368[_0xab49('0x3b')]);_0x22294f[_0xab49('0x3e')]=_[_0xab49('0x3d')](_0x1ba368['model'],qs[_0xab49('0x40')](_0xa49709[_0xab49('0x3b')][_0xab49('0x40')]));_0x22294f[_0xab49('0x3e')]=_0x22294f[_0xab49('0x3e')][_0xab49('0x41')]?_0x22294f[_0xab49('0x3e')]:_0x1ba368[_0xab49('0x3f')];_0x22294f[_0xab49('0x44')]=qs[_0xab49('0x45')](_0xa49709['query'][_0xab49('0x45')]);_0x22294f[_0xab49('0x46')]=qs['filters'](_[_0xab49('0x48')](_0xa49709[_0xab49('0x3b')],_0x1ba368[_0xab49('0x47')]));if(_0xa49709['query'][_0xab49('0x4b')]){_0x22294f[_0xab49('0x46')]=_['merge'](_0x22294f['where'],{'$or':_[_0xab49('0x35')](_0x22294f[_0xab49('0x3e')],function(_0x2acd68){var _0x48fb06={};_0x48fb06[_0x2acd68]={'$like':'%'+_0xa49709['query'][_0xab49('0x4b')]+'%'};return _0x48fb06;})});}_0x22294f=_[_0xab49('0x49')]({},_0x22294f,_0xa49709[_0xab49('0x4c')]);return _0x10da44[_0xab49('0x57')](_0x22294f);}})[_0xab49('0x1e')](function(_0x5f1325){if(_0x5f1325){_0x4de03d=_0x5f1325[_0xab49('0x41')];if(!_0xa49709[_0xab49('0x3b')]['hasOwnProperty']('nolimit')){_0x22294f[_0xab49('0x43')]=qs[_0xab49('0x43')](_0xa49709[_0xab49('0x3b')][_0xab49('0x43')]);_0x22294f[_0xab49('0x2d')]=qs[_0xab49('0x2d')](_0xa49709[_0xab49('0x3b')][_0xab49('0x2d')]);}return _0x10da44[_0xab49('0x57')](_0x22294f);}})[_0xab49('0x1e')](function(_0x47d36d){if(_0x47d36d){return _0x47d36d?{'count':_0x4de03d,'rows':_0x47d36d}:null;}})[_0xab49('0x1e')](respondWithResult(_0x2cfce0,null))[_0xab49('0x29')](handleError(_0x2cfce0,null));};exports[_0xab49('0x5a')]=function(_0x685962,_0xc80b1e,_0x219a2f){if(_0x685962[_0xab49('0x55')]['id']){delete _0x685962[_0xab49('0x55')]['id'];}return db['FreshsalesAccount'][_0xab49('0x58')]({'where':{'id':_0x685962['params']['id']}})[_0xab49('0x1e')](handleEntityNotFound(_0xc80b1e,null))[_0xab49('0x1e')](function(_0x14f179){if(_0x14f179){_0x685962['body'][_0xab49('0x5b')]=_0x14f179['id'];_0x685962[_0xab49('0x55')]['Subjects']=integrations[_0xab49('0x5c')](_0x685962[_0xab49('0x55')][_0xab49('0x5d')],_0x685962[_0xab49('0x55')][_0xab49('0x39')]);_0x685962[_0xab49('0x55')][_0xab49('0x5e')]=integrations[_0xab49('0x5f')](_0x685962[_0xab49('0x55')][_0xab49('0x5d')],_0x685962[_0xab49('0x55')][_0xab49('0x39')]);return db[_0xab49('0x59')]['create'](_0x685962[_0xab49('0x55')],{'include':[{'model':db[_0xab49('0x60')],'as':_0xab49('0x61')},{'model':db['FreshsalesField'],'as':_0xab49('0x5e')}]});}return null;})[_0xab49('0x1e')](respondWithResult(_0xc80b1e,null))['catch'](handleError(_0xc80b1e,null));};exports[_0xab49('0x62')]=function(_0x388409,_0x5c57f5,_0x18fd16){var _0x372947='';var _0x239236='';return db[_0xab49('0x36')][_0xab49('0x58')]({'where':{'id':_0x388409[_0xab49('0x51')]['id']},'attributes':['id',_0xab49('0x63'),_0xab49('0x64'),'apiKey']})['then'](handleEntityNotFound(_0x5c57f5,null))[_0xab49('0x1e')](function(_0x284158){if(_0x284158){_0x239236=_0x284158[_0xab49('0x63')];_0x372947=_0x284158[_0xab49('0x64')];var _0x20a245=_0x284158[_0xab49('0x64')][_0xab49('0x65')](-0x1);if(_0x20a245==='/'){_0x372947=_0x372947[_0xab49('0x66')](0x0,_0x372947['lastIndexOf'](_0x20a245));}return rp({'method':_0xab49('0x67'),'uri':util['format'](_0xab49('0x68'),_0x372947,_0xab49('0x69')),'headers':{'Authorization':_0xab49('0x6a')+_0x284158[_0xab49('0x6b')]},'json':!![]});}})[_0xab49('0x1e')](function(_0x2533ba){if(_0x2533ba){var _0x10ae41=_0x2533ba[_0xab49('0x6c')];var _0x1d9018=![];var _0x40e622=null;for(_0x40e622=0x0;_0x40e622<_0x10ae41[_0xab49('0x41')];_0x40e622++){if(_0x10ae41[_0x40e622][_0xab49('0x6d')]===_0x239236){_0x1d9018=!![];}}if(_0x1d9018){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xab49('0x6e')});}}})[_0xab49('0x1e')](respondWithResult(_0x5c57f5,null))[_0xab49('0x29')](function(_0x4732b5){var _0x5034f5=_0x388409['query'][_0xab49('0x6f')]?0x1f4:_0x4732b5[_0xab49('0x70')]||0x1f4;logger[_0xab49('0x24')](_0xab49('0x71'),_0xab49('0x62'),_0x5034f5,JSON[_0xab49('0x23')](_0x4732b5));delete _0x4732b5['name'];if(_0x5034f5===0x191){_0x5034f5=0x190;}_0x5c57f5[_0xab49('0x2a')](_0x5034f5)['send'](_0x388409['query'][_0xab49('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x4732b5[_0xab49('0x70')]}:_0x4732b5);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 7bf3490..aaf666c 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 _0xfb66=['bluebird','request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x49c4b7,_0xd24a09){var _0x3341dc=function(_0x58c96d){while(--_0x58c96d){_0x49c4b7['push'](_0x49c4b7['shift']());}};_0x3341dc(++_0xd24a09);}(_0xfb66,0xf7));var _0x6fb6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfb66[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x6fb6('0x0'));var util=require(_0x6fb6('0x1'));var logger=require(_0x6fb6('0x2'))(_0x6fb6('0x3'));var moment=require(_0x6fb6('0x4'));var BPromise=require(_0x6fb6('0x5'));var rp=require(_0x6fb6('0x6'));var fs=require('fs');var path=require(_0x6fb6('0x7'));var rimraf=require(_0x6fb6('0x8'));var config=require('../../config/environment');var attributes=require(_0x6fb6('0x9'));var integrations=require(_0x6fb6('0xa'));module[_0x6fb6('0xb')]=function(_0x374f2e,_0x3a88dc){return _0x374f2e[_0x6fb6('0xc')]('FreshsalesAccount',attributes,{'tableName':_0x6fb6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75d9=['request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x75d9,0x162));var _0x975d=function(_0xa98302,_0x844f27){_0xa98302=_0xa98302-0x0;var _0x1ad8e3=_0x75d9[_0xa98302];return _0x1ad8e3;};'use strict';var _=require(_0x975d('0x0'));var util=require(_0x975d('0x1'));var logger=require(_0x975d('0x2'))(_0x975d('0x3'));var moment=require(_0x975d('0x4'));var BPromise=require(_0x975d('0x5'));var rp=require(_0x975d('0x6'));var fs=require('fs');var path=require(_0x975d('0x7'));var rimraf=require(_0x975d('0x8'));var config=require(_0x975d('0x9'));var attributes=require(_0x975d('0xa'));var integrations=require(_0x975d('0xb'));module[_0x975d('0xc')]=function(_0x1ead2f,_0x5d4fbb){return _0x1ead2f[_0x975d('0xd')](_0x975d('0xe'),attributes,{'tableName':'int_freshsales_accounts','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 aed783d..70df940 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 _0xb016=['include','model','debug','ShowFreshsalesAccount','find','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','map'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xb016,0x159));var _0x6b01=function(_0x2fd665,_0x4fcaf6){_0x2fd665=_0x2fd665-0x0;var _0xeaa6d5=_0xb016[_0x2fd665];return _0xeaa6d5;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b01('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b01('0x3'))['db'];var utils=require(_0x6b01('0x4'));var logger=require(_0x6b01('0x5'))(_0x6b01('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b01('0x7'));var client=jayson[_0x6b01('0x8')][_0x6b01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5759a1,_0x5c5bfb,_0x374aab){return new BPromise(function(_0x39f9fa,_0x526a7d){return client['request'](_0x5759a1,_0x374aab)[_0x6b01('0xa')](function(_0x1cb3a6){logger[_0x6b01('0xb')](_0x6b01('0xc'),_0x5c5bfb,_0x6b01('0xd'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'),JSON[_0x6b01('0xe')](_0x1cb3a6));if(_0x1cb3a6[_0x6b01('0xf')]){if(_0x1cb3a6['error'][_0x6b01('0x10')]===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x5c5bfb,_0x1cb3a6[_0x6b01('0xf')]['message']);return _0x526a7d(_0x1cb3a6[_0x6b01('0xf')][_0x6b01('0x11')]);}logger['error'](_0x6b01('0xc'),_0x5c5bfb,_0x1cb3a6['error']['message']);return _0x39f9fa(_0x1cb3a6['error'][_0x6b01('0x11')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'));_0x39f9fa(_0x1cb3a6[_0x6b01('0x12')][_0x6b01('0x11')]);}})[_0x6b01('0x13')](function(_0x3d7045){logger[_0x6b01('0xf')](_0x6b01('0xc'),_0x5c5bfb,_0x3d7045);_0x526a7d(_0x3d7045);});});}exports[_0x6b01('0x14')]=function(_0x9c6571){var _0xc4e1b1=this;return new Promise(function(_0x18f336,_0x4f2d08){return db[_0x6b01('0x15')][_0x6b01('0x16')]({'raw':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x18')]===undefined?!![]:![]:!![],'where':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x19')]||null:null,'attributes':_0x9c6571['options']?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x1a')]||null:null,'limit':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x1b')]||null:null,'include':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')]['include']?_[_0x6b01('0x1c')](_0x9c6571[_0x6b01('0x17')][_0x6b01('0x1d')],function(_0x51243c){return{'model':db[_0x51243c[_0x6b01('0x1e')]],'as':_0x51243c['as'],'attributes':_0x51243c[_0x6b01('0x1a')],'include':_0x51243c[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x51243c[_0x6b01('0x1d')],function(_0x2456e9){return{'model':db[_0x2456e9[_0x6b01('0x1e')]],'as':_0x2456e9['as'],'attributes':_0x2456e9[_0x6b01('0x1a')],'include':_0x2456e9[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x2456e9[_0x6b01('0x1d')],function(_0xa846d8){return{'model':db[_0xa846d8[_0x6b01('0x1e')]],'as':_0xa846d8['as'],'attributes':_0xa846d8['attributes']};}):[]};}):[]};}):[]:[]})[_0x6b01('0xa')](function(_0x220efb){logger[_0x6b01('0xb')](_0x6b01('0x14'),_0x9c6571);logger[_0x6b01('0x1f')]('GetFreshsalesAccount',_0x9c6571,JSON['stringify'](_0x220efb));_0x18f336(_0x220efb);})[_0x6b01('0x13')](function(_0x3df3d4){logger[_0x6b01('0xf')](_0x6b01('0x14'),_0x3df3d4[_0x6b01('0x11')],_0x9c6571);_0x4f2d08(_0xc4e1b1[_0x6b01('0xf')](0x1f4,_0x3df3d4['message']));});});};exports[_0x6b01('0x20')]=function(_0x5482a8){var _0x3942d7=this;return new Promise(function(_0x4e7e32,_0x6920cf){return db[_0x6b01('0x15')][_0x6b01('0x21')]({'raw':_0x5482a8[_0x6b01('0x17')]?_0x5482a8[_0x6b01('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5482a8[_0x6b01('0x17')]?_0x5482a8[_0x6b01('0x17')][_0x6b01('0x19')]||null:null,'attributes':_0x5482a8['options']?_0x5482a8['options'][_0x6b01('0x1a')]||null:null,'include':_0x5482a8['options']?_0x5482a8[_0x6b01('0x17')][_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x5482a8['options'][_0x6b01('0x1d')],function(_0x42d5f7){return{'model':db[_0x42d5f7[_0x6b01('0x1e')]],'as':_0x42d5f7['as'],'attributes':_0x42d5f7['attributes'],'include':_0x42d5f7[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x42d5f7[_0x6b01('0x1d')],function(_0x2eb34f){return{'model':db[_0x2eb34f[_0x6b01('0x1e')]],'as':_0x2eb34f['as'],'attributes':_0x2eb34f['attributes'],'include':_0x2eb34f[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x2eb34f[_0x6b01('0x1d')],function(_0x5269c7){return{'model':db[_0x5269c7[_0x6b01('0x1e')]],'as':_0x5269c7['as'],'attributes':_0x5269c7[_0x6b01('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6b01('0xa')](function(_0x3154d7){logger['info'](_0x6b01('0x20'),_0x5482a8);logger['debug'](_0x6b01('0x20'),_0x5482a8,JSON[_0x6b01('0xe')](_0x3154d7));_0x4e7e32(_0x3154d7);})[_0x6b01('0x13')](function(_0x318b8b){logger[_0x6b01('0xf')](_0x6b01('0x20'),_0x318b8b[_0x6b01('0x11')],_0x5482a8);_0x6920cf(_0x3942d7['error'](0x1f4,_0x318b8b[_0x6b01('0x11')]));});});}; \ No newline at end of file +var _0x5c3c=['find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','limit','include','map','model','attributes','debug','catch','ShowFreshsalesAccount'];(function(_0x12f52d,_0x2b3b28){var _0x2c796e=function(_0x41947c){while(--_0x41947c){_0x12f52d['push'](_0x12f52d['shift']());}};_0x2c796e(++_0x2b3b28);}(_0x5c3c,0x132));var _0xc5c3=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x5c3c[_0x5834bc];return _0x3e183a;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a392b,_0x4b8404,_0x591f7d){return new BPromise(function(_0x723c31,_0x522be1){return client['request'](_0x5a392b,_0x591f7d)[_0xc5c3('0xd')](function(_0x46e2c1){logger['info'](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));logger['debug'](_0xc5c3('0x10'),_0x4b8404,_0xc5c3('0xf'),JSON[_0xc5c3('0x11')](_0x46e2c1));if(_0x46e2c1['error']){if(_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x13')]===0x1f4){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x522be1(_0x46e2c1['error'][_0xc5c3('0x14')]);}logger[_0xc5c3('0x12')](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x723c31(_0x46e2c1['error']['message']);}else{logger[_0xc5c3('0x15')](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));_0x723c31(_0x46e2c1[_0xc5c3('0x16')]['message']);}})['catch'](function(_0x467ba9){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x467ba9);_0x522be1(_0x467ba9);});});}exports[_0xc5c3('0x17')]=function(_0x2ff158){var _0x13c867=this;return new Promise(function(_0x28bae6,_0x5e11d5){return db[_0xc5c3('0x18')][_0xc5c3('0x19')]({'raw':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')][_0xc5c3('0x1b')]||null:null,'attributes':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')]['attributes']||null:null,'limit':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')][_0xc5c3('0x1c')]||null:null,'include':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')][_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x2ff158['options']['include'],function(_0x45affe){return{'model':db[_0x45affe[_0xc5c3('0x1f')]],'as':_0x45affe['as'],'attributes':_0x45affe['attributes'],'include':_0x45affe['include']?_[_0xc5c3('0x1e')](_0x45affe[_0xc5c3('0x1d')],function(_0x38a3df){return{'model':db[_0x38a3df['model']],'as':_0x38a3df['as'],'attributes':_0x38a3df['attributes'],'include':_0x38a3df[_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x38a3df[_0xc5c3('0x1d')],function(_0x29791c){return{'model':db[_0x29791c['model']],'as':_0x29791c['as'],'attributes':_0x29791c[_0xc5c3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2eacec){logger['info'](_0xc5c3('0x17'),_0x2ff158);logger[_0xc5c3('0x21')](_0xc5c3('0x17'),_0x2ff158,JSON[_0xc5c3('0x11')](_0x2eacec));_0x28bae6(_0x2eacec);})[_0xc5c3('0x22')](function(_0x2d07e1){logger[_0xc5c3('0x12')]('GetFreshsalesAccount',_0x2d07e1[_0xc5c3('0x14')],_0x2ff158);_0x5e11d5(_0x13c867['error'](0x1f4,_0x2d07e1[_0xc5c3('0x14')]));});});};exports[_0xc5c3('0x23')]=function(_0x5b26e9){var _0x4daa8b=this;return new Promise(function(_0x2e648f,_0x46f149){return db[_0xc5c3('0x18')][_0xc5c3('0x24')]({'raw':_0x5b26e9['options']?_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x25')]===undefined?!![]:![]:!![],'where':_0x5b26e9[_0xc5c3('0x1a')]?_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x1b')]||null:null,'attributes':_0x5b26e9[_0xc5c3('0x1a')]?_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x20')]||null:null,'include':_0x5b26e9[_0xc5c3('0x1a')]?_0x5b26e9['options'][_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x1d')],function(_0x330391){return{'model':db[_0x330391[_0xc5c3('0x1f')]],'as':_0x330391['as'],'attributes':_0x330391[_0xc5c3('0x20')],'include':_0x330391['include']?_['map'](_0x330391[_0xc5c3('0x1d')],function(_0x55fccf){return{'model':db[_0x55fccf[_0xc5c3('0x1f')]],'as':_0x55fccf['as'],'attributes':_0x55fccf[_0xc5c3('0x20')],'include':_0x55fccf[_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x55fccf[_0xc5c3('0x1d')],function(_0x498677){return{'model':db[_0x498677[_0xc5c3('0x1f')]],'as':_0x498677['as'],'attributes':_0x498677[_0xc5c3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29f57d){logger[_0xc5c3('0x15')](_0xc5c3('0x23'),_0x5b26e9);logger[_0xc5c3('0x21')](_0xc5c3('0x23'),_0x5b26e9,JSON[_0xc5c3('0x11')](_0x29f57d));_0x2e648f(_0x29f57d);})[_0xc5c3('0x22')](function(_0x2ad440){logger[_0xc5c3('0x12')](_0xc5c3('0x23'),_0x2ad440['message'],_0x5b26e9);_0x46f149(_0x4daa8b[_0xc5c3('0x12')](0x1f4,_0x2ad440['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index c1e928c..773f505 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 _0xd213=['update','delete','exports','multer','util','path','connect-timeout','express','Router','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id/subjects','/:id/descriptions','/:id/fields','getFields','create'];(function(_0xf31767,_0x381746){var _0x24bd0c=function(_0x3b3472){while(--_0x3b3472){_0xf31767['push'](_0xf31767['shift']());}};_0x24bd0c(++_0x381746);}(_0xd213,0xc9));var _0x3d21=function(_0x54c6f7,_0x5ea013){_0x54c6f7=_0x54c6f7-0x0;var _0x1999e0=_0xd213[_0x54c6f7];return _0x1999e0;};'use strict';var multer=require(_0x3d21('0x0'));var util=require(_0x3d21('0x1'));var path=require(_0x3d21('0x2'));var timeout=require(_0x3d21('0x3'));var express=require(_0x3d21('0x4'));var router=express[_0x3d21('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3d21('0x6'));router[_0x3d21('0x7')]('/',auth[_0x3d21('0x8')](),controller[_0x3d21('0x9')]);router[_0x3d21('0x7')]('/:id',auth[_0x3d21('0x8')](),controller['show']);router[_0x3d21('0x7')](_0x3d21('0xa'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x3d21('0xb'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x3d21('0x7')](_0x3d21('0xc'),auth[_0x3d21('0x8')](),controller[_0x3d21('0xd')]);router['post']('/',auth[_0x3d21('0x8')](),controller[_0x3d21('0xe')]);router['put']('/:id',auth[_0x3d21('0x8')](),controller[_0x3d21('0xf')]);router[_0x3d21('0x10')]('/:id',auth[_0x3d21('0x8')](),controller['destroy']);module[_0x3d21('0x11')]=router; \ No newline at end of file +var _0xcdce=['/:id/fields','getFields','post','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects','getDescriptions'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcdce,0x93));var _0xecdc=function(_0x3944af,_0x2d9cd7){_0x3944af=_0x3944af-0x0;var _0x38b6b8=_0xcdce[_0x3944af];return _0x38b6b8;};'use strict';var multer=require(_0xecdc('0x0'));var util=require(_0xecdc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xecdc('0x2')]();var auth=require(_0xecdc('0x3'));var interaction=require(_0xecdc('0x4'));var config=require(_0xecdc('0x5'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xecdc('0x6')]('/',auth[_0xecdc('0x7')](),controller['index']);router[_0xecdc('0x6')](_0xecdc('0x8'),auth[_0xecdc('0x7')](),controller[_0xecdc('0x9')]);router[_0xecdc('0x6')](_0xecdc('0xa'),auth[_0xecdc('0x7')](),controller[_0xecdc('0xb')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0xecdc('0xc')]);router[_0xecdc('0x6')](_0xecdc('0xd'),auth[_0xecdc('0x7')](),controller[_0xecdc('0xe')]);router[_0xecdc('0xf')]('/',auth[_0xecdc('0x7')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xecdc('0x10')]);router[_0xecdc('0x11')](_0xecdc('0x8'),auth['isAuthenticated'](),controller[_0xecdc('0x12')]);module[_0xecdc('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 1548923..983de1f 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 _0x0c8b=['sequelize','exports','STRING'];(function(_0x4e07c6,_0x5d8c10){var _0x37023e=function(_0x339588){while(--_0x339588){_0x4e07c6['push'](_0x4e07c6['shift']());}};_0x37023e(++_0x5d8c10);}(_0x0c8b,0x129));var _0xb0c8=function(_0x3441e2,_0x57b820){_0x3441e2=_0x3441e2-0x0;var _0x1a129b=_0x0c8b[_0x3441e2];return _0x1a129b;};'use strict';var Sequelize=require(_0xb0c8('0x0'));module[_0xb0c8('0x1')]={'name':{'type':Sequelize[_0xb0c8('0x2')]},'description':{'type':Sequelize[_0xb0c8('0x2')]}}; \ No newline at end of file +var _0x651c=['sequelize','exports'];(function(_0x1677c0,_0x56af50){var _0x1d3448=function(_0x4b52a2){while(--_0x4b52a2){_0x1677c0['push'](_0x1677c0['shift']());}};_0x1d3448(++_0x56af50);}(_0x651c,0xac));var _0xc651=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x651c[_0x2080a3];return _0x8d7d17;};'use strict';var Sequelize=require(_0xc651('0x0'));module[_0xc651('0x1')]={'name':{'type':Sequelize['STRING']},'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 e6dd799..b9f1d9a 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 _0x4975=['limit','Content-Range','reject','save','then','stack','name','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','rows','show','params','includeAll','find','create','update','body','destroy','FreshsalesConfiguration','getSubjects','findOne','FreshsalesField','order','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json'];(function(_0x31be7b,_0x1f7231){var _0x9d1b28=function(_0x51ac71){while(--_0x51ac71){_0x31be7b['push'](_0x31be7b['shift']());}};_0x9d1b28(++_0x1f7231);}(_0x4975,0x86));var _0x5497=function(_0x595738,_0x205da3){_0x595738=_0x595738-0x0;var _0x2802bd=_0x4975[_0x595738];return _0x2802bd;};'use strict';var pdf=require(_0x5497('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5497('0x1'));var zipdir=require(_0x5497('0x2'));var jsonpatch=require(_0x5497('0x3'));var rp=require(_0x5497('0x4'));var moment=require(_0x5497('0x5'));var BPromise=require(_0x5497('0x6'));var Mustache=require(_0x5497('0x7'));var util=require(_0x5497('0x8'));var path=require(_0x5497('0x9'));var sox=require(_0x5497('0xa'));var csv=require('to-csv');var ejs=require(_0x5497('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xf'));var querystring=require('querystring');var Papa=require(_0x5497('0x10'));var Redis=require(_0x5497('0x11'));var authService=require(_0x5497('0x12'));var qs=require(_0x5497('0x13'));var as=require(_0x5497('0x14'));var hardwareService=require(_0x5497('0x15'));var logger=require(_0x5497('0x16'))(_0x5497('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x18'))['db'];var jayson=require(_0x5497('0x19'));var client=jayson[_0x5497('0x1a')][_0x5497('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x747dc7,_0x365144,_0x1f7169,_0xaca97d){return new BPromise(function(_0x363a5b,_0x1a4c74){var _0x55f590=_0xaca97d||client;return _0x55f590[_0x5497('0x1c')](_0x747dc7,_0x1f7169)['then'](function(_0x4237a9){logger[_0x5497('0x1d')](_0x5497('0x1e'),_0x365144,_0x5497('0x1f'));logger[_0x5497('0x20')](_0x5497('0x21'),_0x365144,_0x5497('0x1f'),JSON['stringify'](_0x4237a9));if(_0x4237a9['error']){if(_0x4237a9[_0x5497('0x22')][_0x5497('0x23')]===0x1f4){logger[_0x5497('0x22')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x365144,_0x4237a9[_0x5497('0x22')][_0x5497('0x24')]);return _0x1a4c74(_0x4237a9[_0x5497('0x22')][_0x5497('0x24')]);}logger[_0x5497('0x22')](_0x5497('0x1e'),_0x365144,_0x4237a9[_0x5497('0x22')][_0x5497('0x24')]);return _0x363a5b(_0x4237a9[_0x5497('0x22')][_0x5497('0x24')]);}else{logger[_0x5497('0x1d')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x365144,_0x5497('0x1f'));_0x363a5b(_0x4237a9['result'][_0x5497('0x24')]);}})[_0x5497('0x25')](function(_0x44265c){logger[_0x5497('0x22')](_0x5497('0x1e'),_0x365144,_0x44265c);_0x1a4c74(_0x44265c);});});}function respondWithStatusCode(_0x3b2fbc,_0x5018fa){_0x5018fa=_0x5018fa||0xcc;return function(_0x54043a){if(_0x54043a){return _0x3b2fbc[_0x5497('0x26')](_0x5018fa);}return _0x3b2fbc[_0x5497('0x27')](_0x5018fa)[_0x5497('0x28')]();};}function respondWithResult(_0x281155,_0x5223b5){_0x5223b5=_0x5223b5||0xc8;return function(_0x13b7a4){if(_0x13b7a4){return _0x281155['status'](_0x5223b5)[_0x5497('0x29')](_0x13b7a4);}};}function respondWithFilteredResult(_0x16a2b4,_0x429d36){return function(_0x34a1a5){if(_0x34a1a5){var _0x163a30=_0x34a1a5['count'],_0x31cd01=_0x429d36['offset'],_0x48b835=_0x429d36['offset']+_0x429d36[_0x5497('0x2a')],_0x4af5f4;if(_0x48b835>=_0x163a30){_0x48b835=_0x163a30;_0x4af5f4=0xc8;}else{_0x4af5f4=0xce;}_0x16a2b4['status'](_0x4af5f4);return _0x16a2b4['set'](_0x5497('0x2b'),_0x31cd01+'-'+_0x48b835+'/'+_0x163a30)[_0x5497('0x29')](_0x34a1a5);}return null;};}function patchUpdates(_0x1cf908){return function(_0x4c442a){try{jsonpatch['apply'](_0x4c442a,_0x1cf908,!![]);}catch(_0x58230b){return BPromise[_0x5497('0x2c')](_0x58230b);}return _0x4c442a[_0x5497('0x2d')]();};}function saveUpdates(_0xf4c117,_0x5b8f79){return function(_0x489f71){if(_0x489f71){return _0x489f71['update'](_0xf4c117)[_0x5497('0x2e')](function(_0x572460){return _0x572460;});}return null;};}function removeEntity(_0x438ee4,_0x258c2d){return function(_0x77c575){if(_0x77c575){return _0x77c575['destroy']()[_0x5497('0x2e')](function(){_0x438ee4[_0x5497('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xce7cb2,_0xce2e81){return function(_0x331dfc){if(!_0x331dfc){_0xce7cb2['sendStatus'](0x194);}return _0x331dfc;};}function handleError(_0x3395f6,_0x2fe1f2){_0x2fe1f2=_0x2fe1f2||0x1f4;return function(_0x125d51){logger[_0x5497('0x22')](_0x125d51[_0x5497('0x2f')]);if(_0x125d51['name']){delete _0x125d51[_0x5497('0x30')];}_0x3395f6[_0x5497('0x27')](_0x2fe1f2)['send'](_0x125d51);};}exports[_0x5497('0x31')]=function(_0x44299b,_0xc7730){var _0x1b9cd8={},_0x1656c7={},_0x37011c={'count':0x0,'rows':[]};var _0x580e86=_[_0x5497('0x32')](db['FreshsalesConfiguration'][_0x5497('0x33')],function(_0x212199){return{'name':_0x212199[_0x5497('0x34')],'type':_0x212199['type']['key']};});_0x1656c7[_0x5497('0x35')]=_[_0x5497('0x32')](_0x580e86,_0x5497('0x30'));_0x1656c7[_0x5497('0x36')]=_[_0x5497('0x37')](_0x44299b[_0x5497('0x36')]);_0x1656c7['filters']=_[_0x5497('0x38')](_0x1656c7[_0x5497('0x35')],_0x1656c7[_0x5497('0x36')]);_0x1b9cd8[_0x5497('0x39')]=_[_0x5497('0x38')](_0x1656c7[_0x5497('0x35')],qs[_0x5497('0x3a')](_0x44299b[_0x5497('0x36')][_0x5497('0x3a')]));_0x1b9cd8['attributes']=_0x1b9cd8[_0x5497('0x39')][_0x5497('0x3b')]?_0x1b9cd8[_0x5497('0x39')]:_0x1656c7[_0x5497('0x35')];if(!_0x44299b[_0x5497('0x36')][_0x5497('0x3c')](_0x5497('0x3d'))){_0x1b9cd8['limit']=qs[_0x5497('0x2a')](_0x44299b[_0x5497('0x36')][_0x5497('0x2a')]);_0x1b9cd8[_0x5497('0x3e')]=qs[_0x5497('0x3e')](_0x44299b[_0x5497('0x36')][_0x5497('0x3e')]);}_0x1b9cd8['order']=qs[_0x5497('0x3f')](_0x44299b[_0x5497('0x36')][_0x5497('0x3f')]);_0x1b9cd8[_0x5497('0x40')]=qs[_0x5497('0x41')](_[_0x5497('0x42')](_0x44299b[_0x5497('0x36')],_0x1656c7[_0x5497('0x41')]),_0x580e86);if(_0x44299b[_0x5497('0x36')][_0x5497('0x43')]){_0x1b9cd8['where']=_[_0x5497('0x44')](_0x1b9cd8['where'],{'$or':_[_0x5497('0x32')](_0x580e86,function(_0x9fc24){if(_0x9fc24[_0x5497('0x45')]!==_0x5497('0x46')){var _0x133746={};_0x133746[_0x9fc24['name']]={'$like':'%'+_0x44299b[_0x5497('0x36')][_0x5497('0x43')]+'%'};return _0x133746;}})});}_0x1b9cd8=_['merge']({},_0x1b9cd8,_0x44299b[_0x5497('0x47')]);var _0x553279={'where':_0x1b9cd8[_0x5497('0x40')]};return db['FreshsalesConfiguration'][_0x5497('0x48')](_0x553279)[_0x5497('0x2e')](function(_0x2e8c6a){_0x37011c[_0x5497('0x48')]=_0x2e8c6a;if(_0x44299b[_0x5497('0x36')]['includeAll']){_0x1b9cd8['include']=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x1b9cd8);})[_0x5497('0x2e')](function(_0x43c430){_0x37011c[_0x5497('0x49')]=_0x43c430;return _0x37011c;})[_0x5497('0x2e')](respondWithFilteredResult(_0xc7730,_0x1b9cd8))[_0x5497('0x25')](handleError(_0xc7730,null));};exports[_0x5497('0x4a')]=function(_0xc78abe,_0x466287){var _0x2626bf={'raw':![],'where':{'id':_0xc78abe[_0x5497('0x4b')]['id']}},_0x57350a={};_0x57350a[_0x5497('0x35')]=_[_0x5497('0x37')](db['FreshsalesConfiguration'][_0x5497('0x33')]);_0x57350a['query']=_[_0x5497('0x37')](_0xc78abe[_0x5497('0x36')]);_0x57350a[_0x5497('0x41')]=_['intersection'](_0x57350a[_0x5497('0x35')],_0x57350a[_0x5497('0x36')]);_0x2626bf['attributes']=_[_0x5497('0x38')](_0x57350a['model'],qs[_0x5497('0x3a')](_0xc78abe['query'][_0x5497('0x3a')]));_0x2626bf[_0x5497('0x39')]=_0x2626bf[_0x5497('0x39')][_0x5497('0x3b')]?_0x2626bf[_0x5497('0x39')]:_0x57350a[_0x5497('0x35')];if(_0xc78abe[_0x5497('0x36')][_0x5497('0x4c')]){_0x2626bf['include']=[{'all':!![]}];}_0x2626bf=_[_0x5497('0x44')]({},_0x2626bf,_0xc78abe['options']);return db['FreshsalesConfiguration'][_0x5497('0x4d')](_0x2626bf)[_0x5497('0x2e')](handleEntityNotFound(_0x466287,null))['then'](respondWithResult(_0x466287,null))[_0x5497('0x25')](handleError(_0x466287,null));};exports[_0x5497('0x4e')]=function(_0x436a83,_0x3094c7){return db['FreshsalesConfiguration'][_0x5497('0x4e')](_0x436a83['body'],{})['then'](respondWithResult(_0x3094c7,0xc9))[_0x5497('0x25')](handleError(_0x3094c7,null));};exports[_0x5497('0x4f')]=function(_0x2f7ec8,_0x49c85a){if(_0x2f7ec8['body']['id']){delete _0x2f7ec8[_0x5497('0x50')]['id'];}return db['FreshsalesConfiguration'][_0x5497('0x4d')]({'where':{'id':_0x2f7ec8['params']['id']}})[_0x5497('0x2e')](handleEntityNotFound(_0x49c85a,null))['then'](saveUpdates(_0x2f7ec8[_0x5497('0x50')],null))[_0x5497('0x2e')](respondWithResult(_0x49c85a,null))['catch'](handleError(_0x49c85a,null));};exports[_0x5497('0x51')]=function(_0x5dccfb,_0x506d69){return db[_0x5497('0x52')][_0x5497('0x4d')]({'where':{'id':_0x5dccfb['params']['id']}})[_0x5497('0x2e')](handleEntityNotFound(_0x506d69,null))[_0x5497('0x2e')](removeEntity(_0x506d69,null))[_0x5497('0x25')](handleError(_0x506d69,null));};exports[_0x5497('0x53')]=function(_0x3fca40,_0x25c75e,_0x590be7){var _0x215ea8={};var _0x4916cd={};var _0x4e0d4c;var _0x480582;return db[_0x5497('0x52')][_0x5497('0x54')]({'where':{'id':_0x3fca40[_0x5497('0x4b')]['id']}})['then'](handleEntityNotFound(_0x25c75e,null))[_0x5497('0x2e')](function(_0x528fb4){if(_0x528fb4){_0x4e0d4c=_0x528fb4;_0x4916cd['model']=_[_0x5497('0x37')](db[_0x5497('0x55')][_0x5497('0x33')]);_0x4916cd[_0x5497('0x36')]=_[_0x5497('0x37')](_0x3fca40[_0x5497('0x36')]);_0x4916cd['filters']=_[_0x5497('0x38')](_0x4916cd[_0x5497('0x35')],_0x4916cd[_0x5497('0x36')]);_0x215ea8[_0x5497('0x39')]=_['intersection'](_0x4916cd[_0x5497('0x35')],qs[_0x5497('0x3a')](_0x3fca40[_0x5497('0x36')][_0x5497('0x3a')]));_0x215ea8['attributes']=_0x215ea8[_0x5497('0x39')][_0x5497('0x3b')]?_0x215ea8[_0x5497('0x39')]:_0x4916cd['model'];_0x215ea8[_0x5497('0x56')]=qs['sort'](_0x3fca40['query']['sort']);_0x215ea8[_0x5497('0x40')]=qs[_0x5497('0x41')](_[_0x5497('0x42')](_0x3fca40['query'],_0x4916cd[_0x5497('0x41')]));if(_0x3fca40[_0x5497('0x36')][_0x5497('0x43')]){_0x215ea8[_0x5497('0x40')]=_['merge'](_0x215ea8[_0x5497('0x40')],{'$or':_[_0x5497('0x32')](_0x215ea8[_0x5497('0x39')],function(_0x49617c){var _0x164de1={};_0x164de1[_0x49617c]={'$like':'%'+_0x3fca40[_0x5497('0x36')][_0x5497('0x43')]+'%'};return _0x164de1;})});}_0x215ea8=_[_0x5497('0x44')]({},_0x215ea8,_0x3fca40[_0x5497('0x47')]);return _0x4e0d4c[_0x5497('0x53')](_0x215ea8);}})[_0x5497('0x2e')](function(_0x4b4cfe){if(_0x4b4cfe){_0x480582=_0x4b4cfe[_0x5497('0x3b')];if(!_0x3fca40[_0x5497('0x36')][_0x5497('0x3c')](_0x5497('0x3d'))){_0x215ea8['limit']=qs['limit'](_0x3fca40['query'][_0x5497('0x2a')]);_0x215ea8[_0x5497('0x3e')]=qs[_0x5497('0x3e')](_0x3fca40['query'][_0x5497('0x3e')]);}return _0x4e0d4c[_0x5497('0x53')](_0x215ea8);}})[_0x5497('0x2e')](function(_0x464df3){if(_0x464df3){return _0x464df3?{'count':_0x480582,'rows':_0x464df3}:null;}})[_0x5497('0x2e')](respondWithResult(_0x25c75e,null))[_0x5497('0x25')](handleError(_0x25c75e,null));};exports[_0x5497('0x57')]=function(_0x23bd32,_0x21da3d,_0x940188){var _0x1fc6ad={};var _0x5a8b3a={};var _0x15d5a4;var _0x2940ec;return db[_0x5497('0x52')]['findOne']({'where':{'id':_0x23bd32[_0x5497('0x4b')]['id']}})['then'](handleEntityNotFound(_0x21da3d,null))[_0x5497('0x2e')](function(_0x469e97){if(_0x469e97){_0x15d5a4=_0x469e97;_0x5a8b3a['model']=_[_0x5497('0x37')](db[_0x5497('0x55')][_0x5497('0x33')]);_0x5a8b3a[_0x5497('0x36')]=_['keys'](_0x23bd32[_0x5497('0x36')]);_0x5a8b3a[_0x5497('0x41')]=_[_0x5497('0x38')](_0x5a8b3a['model'],_0x5a8b3a[_0x5497('0x36')]);_0x1fc6ad[_0x5497('0x39')]=_['intersection'](_0x5a8b3a[_0x5497('0x35')],qs[_0x5497('0x3a')](_0x23bd32[_0x5497('0x36')]['fields']));_0x1fc6ad['attributes']=_0x1fc6ad[_0x5497('0x39')][_0x5497('0x3b')]?_0x1fc6ad[_0x5497('0x39')]:_0x5a8b3a[_0x5497('0x35')];_0x1fc6ad[_0x5497('0x56')]=qs[_0x5497('0x3f')](_0x23bd32[_0x5497('0x36')]['sort']);_0x1fc6ad['where']=qs[_0x5497('0x41')](_[_0x5497('0x42')](_0x23bd32['query'],_0x5a8b3a[_0x5497('0x41')]));if(_0x23bd32[_0x5497('0x36')][_0x5497('0x43')]){_0x1fc6ad['where']=_[_0x5497('0x44')](_0x1fc6ad[_0x5497('0x40')],{'$or':_['map'](_0x1fc6ad[_0x5497('0x39')],function(_0x16e2cf){var _0x9458d7={};_0x9458d7[_0x16e2cf]={'$like':'%'+_0x23bd32[_0x5497('0x36')][_0x5497('0x43')]+'%'};return _0x9458d7;})});}_0x1fc6ad=_['merge']({},_0x1fc6ad,_0x23bd32[_0x5497('0x47')]);return _0x15d5a4[_0x5497('0x57')](_0x1fc6ad);}})[_0x5497('0x2e')](function(_0x23e259){if(_0x23e259){_0x2940ec=_0x23e259[_0x5497('0x3b')];if(!_0x23bd32['query'][_0x5497('0x3c')](_0x5497('0x3d'))){_0x1fc6ad[_0x5497('0x2a')]=qs[_0x5497('0x2a')](_0x23bd32['query'][_0x5497('0x2a')]);_0x1fc6ad[_0x5497('0x3e')]=qs['offset'](_0x23bd32[_0x5497('0x36')][_0x5497('0x3e')]);}return _0x15d5a4[_0x5497('0x57')](_0x1fc6ad);}})[_0x5497('0x2e')](function(_0x53b1b7){if(_0x53b1b7){return _0x53b1b7?{'count':_0x2940ec,'rows':_0x53b1b7}:null;}})['then'](respondWithResult(_0x21da3d,null))['catch'](handleError(_0x21da3d,null));};exports['getFields']=function(_0x594761,_0x2d5543,_0x2375cc){var _0x15d0da={};var _0x1f02d3={};var _0x41f347;var _0x4b7c43;return db['FreshsalesConfiguration'][_0x5497('0x54')]({'where':{'id':_0x594761[_0x5497('0x4b')]['id']}})[_0x5497('0x2e')](handleEntityNotFound(_0x2d5543,null))[_0x5497('0x2e')](function(_0x307dc5){if(_0x307dc5){_0x41f347=_0x307dc5;_0x1f02d3[_0x5497('0x35')]=_[_0x5497('0x37')](db[_0x5497('0x55')][_0x5497('0x33')]);_0x1f02d3[_0x5497('0x36')]=_['keys'](_0x594761[_0x5497('0x36')]);_0x1f02d3[_0x5497('0x41')]=_[_0x5497('0x38')](_0x1f02d3[_0x5497('0x35')],_0x1f02d3[_0x5497('0x36')]);_0x15d0da[_0x5497('0x39')]=_['intersection'](_0x1f02d3[_0x5497('0x35')],qs['fields'](_0x594761[_0x5497('0x36')][_0x5497('0x3a')]));_0x15d0da[_0x5497('0x39')]=_0x15d0da['attributes']['length']?_0x15d0da[_0x5497('0x39')]:_0x1f02d3[_0x5497('0x35')];_0x15d0da[_0x5497('0x56')]=qs[_0x5497('0x3f')](_0x594761[_0x5497('0x36')][_0x5497('0x3f')]);_0x15d0da[_0x5497('0x40')]=qs[_0x5497('0x41')](_['pick'](_0x594761['query'],_0x1f02d3['filters']));if(_0x594761[_0x5497('0x36')][_0x5497('0x43')]){_0x15d0da[_0x5497('0x40')]=_[_0x5497('0x44')](_0x15d0da['where'],{'$or':_['map'](_0x15d0da[_0x5497('0x39')],function(_0xf38193){var _0x5dd9bc={};_0x5dd9bc[_0xf38193]={'$like':'%'+_0x594761[_0x5497('0x36')][_0x5497('0x43')]+'%'};return _0x5dd9bc;})});}_0x15d0da=_[_0x5497('0x44')]({},_0x15d0da,_0x594761[_0x5497('0x47')]);return _0x41f347['getFields'](_0x15d0da);}})['then'](function(_0x55e597){if(_0x55e597){_0x4b7c43=_0x55e597['length'];if(!_0x594761['query'][_0x5497('0x3c')]('nolimit')){_0x15d0da[_0x5497('0x2a')]=qs['limit'](_0x594761[_0x5497('0x36')][_0x5497('0x2a')]);_0x15d0da[_0x5497('0x3e')]=qs[_0x5497('0x3e')](_0x594761[_0x5497('0x36')][_0x5497('0x3e')]);}return _0x41f347['getFields'](_0x15d0da);}})[_0x5497('0x2e')](function(_0x513479){if(_0x513479){return _0x513479?{'count':_0x4b7c43,'rows':_0x513479}:null;}})[_0x5497('0x2e')](respondWithResult(_0x2d5543,null))[_0x5497('0x25')](handleError(_0x2d5543,null));}; \ No newline at end of file +var _0x8ef6=['error','code','message','result','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','update','destroy','name','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','rows','catch','show','params','keys','find','create','body','getSubjects','findOne','hasOwnProperty','getDescriptions','FreshsalesField','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xa568a5,_0x1670dc){var _0x2f55bb=function(_0x20ec75){while(--_0x20ec75){_0xa568a5['push'](_0xa568a5['shift']());}};_0x2f55bb(++_0x1670dc);}(_0x8ef6,0xf2));var _0x68ef=function(_0x39878a,_0x6ae573){_0x39878a=_0x39878a-0x0;var _0xc5304a=_0x8ef6[_0x39878a];return _0xc5304a;};'use strict';var pdf=require(_0x68ef('0x0'));var emlformat=require(_0x68ef('0x1'));var rimraf=require(_0x68ef('0x2'));var zipdir=require(_0x68ef('0x3'));var jsonpatch=require(_0x68ef('0x4'));var rp=require(_0x68ef('0x5'));var moment=require(_0x68ef('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x68ef('0x7'));var util=require(_0x68ef('0x8'));var path=require(_0x68ef('0x9'));var sox=require(_0x68ef('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xf'));var querystring=require(_0x68ef('0x10'));var Papa=require(_0x68ef('0x11'));var Redis=require(_0x68ef('0x12'));var authService=require(_0x68ef('0x13'));var qs=require(_0x68ef('0x14'));var as=require(_0x68ef('0x15'));var hardwareService=require(_0x68ef('0x16'));var logger=require(_0x68ef('0x17'))(_0x68ef('0x18'));var utils=require(_0x68ef('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x1a'));var db=require(_0x68ef('0x1b'))['db'];var jayson=require(_0x68ef('0x1c'));var client=jayson[_0x68ef('0x1d')][_0x68ef('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x288cc9,_0x508671,_0x3b48dd,_0xc50cce){return new BPromise(function(_0x2657c5,_0x47fbb5){var _0x22fe96=_0xc50cce||client;return _0x22fe96[_0x68ef('0x1f')](_0x288cc9,_0x3b48dd)[_0x68ef('0x20')](function(_0x5005ba){logger[_0x68ef('0x21')](_0x68ef('0x22'),_0x508671,_0x68ef('0x23'));logger[_0x68ef('0x24')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x508671,_0x68ef('0x23'),JSON['stringify'](_0x5005ba));if(_0x5005ba['error']){if(_0x5005ba[_0x68ef('0x25')][_0x68ef('0x26')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x508671,_0x5005ba[_0x68ef('0x25')][_0x68ef('0x27')]);return _0x47fbb5(_0x5005ba[_0x68ef('0x25')]['message']);}logger[_0x68ef('0x25')](_0x68ef('0x22'),_0x508671,_0x5005ba[_0x68ef('0x25')]['message']);return _0x2657c5(_0x5005ba[_0x68ef('0x25')][_0x68ef('0x27')]);}else{logger['info'](_0x68ef('0x22'),_0x508671,_0x68ef('0x23'));_0x2657c5(_0x5005ba[_0x68ef('0x28')]['message']);}})['catch'](function(_0x59bebc){logger[_0x68ef('0x25')](_0x68ef('0x22'),_0x508671,_0x59bebc);_0x47fbb5(_0x59bebc);});});}function respondWithStatusCode(_0x312cc9,_0x2e6e39){_0x2e6e39=_0x2e6e39||0xcc;return function(_0x438b4c){if(_0x438b4c){return _0x312cc9[_0x68ef('0x29')](_0x2e6e39);}return _0x312cc9[_0x68ef('0x2a')](_0x2e6e39)[_0x68ef('0x2b')]();};}function respondWithResult(_0x65fd09,_0x13280b){_0x13280b=_0x13280b||0xc8;return function(_0x5e4dbe){if(_0x5e4dbe){return _0x65fd09[_0x68ef('0x2a')](_0x13280b)['json'](_0x5e4dbe);}};}function respondWithFilteredResult(_0x599243,_0x55d8b0){return function(_0x1a7ce1){if(_0x1a7ce1){var _0x268f32=_0x1a7ce1['count'],_0x123041=_0x55d8b0[_0x68ef('0x2c')],_0x29518e=_0x55d8b0[_0x68ef('0x2c')]+_0x55d8b0[_0x68ef('0x2d')],_0x52e67e;if(_0x29518e>=_0x268f32){_0x29518e=_0x268f32;_0x52e67e=0xc8;}else{_0x52e67e=0xce;}_0x599243[_0x68ef('0x2a')](_0x52e67e);return _0x599243[_0x68ef('0x2e')](_0x68ef('0x2f'),_0x123041+'-'+_0x29518e+'/'+_0x268f32)[_0x68ef('0x30')](_0x1a7ce1);}return null;};}function patchUpdates(_0x4579cb){return function(_0x5a6dfd){try{jsonpatch[_0x68ef('0x31')](_0x5a6dfd,_0x4579cb,!![]);}catch(_0x4314bd){return BPromise[_0x68ef('0x32')](_0x4314bd);}return _0x5a6dfd['save']();};}function saveUpdates(_0x370a8f,_0x523120){return function(_0x133788){if(_0x133788){return _0x133788[_0x68ef('0x33')](_0x370a8f)['then'](function(_0x5e1e1b){return _0x5e1e1b;});}return null;};}function removeEntity(_0x159395,_0x5fa72a){return function(_0x4b8fc8){if(_0x4b8fc8){return _0x4b8fc8[_0x68ef('0x34')]()[_0x68ef('0x20')](function(){_0x159395[_0x68ef('0x2a')](0xcc)[_0x68ef('0x2b')]();});}};}function handleEntityNotFound(_0x59e9fb,_0x2c8bd0){return function(_0x1d69ac){if(!_0x1d69ac){_0x59e9fb['sendStatus'](0x194);}return _0x1d69ac;};}function handleError(_0x2f8de2,_0x5237e1){_0x5237e1=_0x5237e1||0x1f4;return function(_0x14581d){logger[_0x68ef('0x25')](_0x14581d['stack']);if(_0x14581d[_0x68ef('0x35')]){delete _0x14581d['name'];}_0x2f8de2[_0x68ef('0x2a')](_0x5237e1)['send'](_0x14581d);};}exports[_0x68ef('0x36')]=function(_0x1444e0,_0x798276){var _0x569949={},_0x1f91c7={},_0x485dc3={'count':0x0,'rows':[]};var _0x476938=_['map'](db[_0x68ef('0x37')][_0x68ef('0x38')],function(_0x102df9){return{'name':_0x102df9[_0x68ef('0x39')],'type':_0x102df9[_0x68ef('0x3a')][_0x68ef('0x3b')]};});_0x1f91c7['model']=_[_0x68ef('0x3c')](_0x476938,_0x68ef('0x35'));_0x1f91c7[_0x68ef('0x3d')]=_['keys'](_0x1444e0[_0x68ef('0x3d')]);_0x1f91c7[_0x68ef('0x3e')]=_[_0x68ef('0x3f')](_0x1f91c7['model'],_0x1f91c7['query']);_0x569949[_0x68ef('0x40')]=_[_0x68ef('0x3f')](_0x1f91c7[_0x68ef('0x41')],qs[_0x68ef('0x42')](_0x1444e0[_0x68ef('0x3d')][_0x68ef('0x42')]));_0x569949[_0x68ef('0x40')]=_0x569949['attributes'][_0x68ef('0x43')]?_0x569949[_0x68ef('0x40')]:_0x1f91c7[_0x68ef('0x41')];if(!_0x1444e0[_0x68ef('0x3d')]['hasOwnProperty'](_0x68ef('0x44'))){_0x569949[_0x68ef('0x2d')]=qs[_0x68ef('0x2d')](_0x1444e0[_0x68ef('0x3d')][_0x68ef('0x2d')]);_0x569949[_0x68ef('0x2c')]=qs['offset'](_0x1444e0[_0x68ef('0x3d')][_0x68ef('0x2c')]);}_0x569949[_0x68ef('0x45')]=qs[_0x68ef('0x46')](_0x1444e0[_0x68ef('0x3d')][_0x68ef('0x46')]);_0x569949[_0x68ef('0x47')]=qs[_0x68ef('0x3e')](_[_0x68ef('0x48')](_0x1444e0['query'],_0x1f91c7[_0x68ef('0x3e')]),_0x476938);if(_0x1444e0[_0x68ef('0x3d')][_0x68ef('0x49')]){_0x569949[_0x68ef('0x47')]=_[_0x68ef('0x4a')](_0x569949[_0x68ef('0x47')],{'$or':_[_0x68ef('0x3c')](_0x476938,function(_0x576767){if(_0x576767[_0x68ef('0x3a')]!=='VIRTUAL'){var _0x13c088={};_0x13c088[_0x576767[_0x68ef('0x35')]]={'$like':'%'+_0x1444e0[_0x68ef('0x3d')][_0x68ef('0x49')]+'%'};return _0x13c088;}})});}_0x569949=_['merge']({},_0x569949,_0x1444e0[_0x68ef('0x4b')]);var _0x5a8231={'where':_0x569949[_0x68ef('0x47')]};return db['FreshsalesConfiguration'][_0x68ef('0x4c')](_0x5a8231)[_0x68ef('0x20')](function(_0x105e8c){_0x485dc3['count']=_0x105e8c;if(_0x1444e0['query'][_0x68ef('0x4d')]){_0x569949[_0x68ef('0x4e')]=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x569949);})['then'](function(_0xe547c){_0x485dc3[_0x68ef('0x4f')]=_0xe547c;return _0x485dc3;})[_0x68ef('0x20')](respondWithFilteredResult(_0x798276,_0x569949))[_0x68ef('0x50')](handleError(_0x798276,null));};exports[_0x68ef('0x51')]=function(_0x583566,_0x55f385){var _0xc39f5b={'raw':![],'where':{'id':_0x583566[_0x68ef('0x52')]['id']}},_0x21f064={};_0x21f064[_0x68ef('0x41')]=_['keys'](db[_0x68ef('0x37')][_0x68ef('0x38')]);_0x21f064[_0x68ef('0x3d')]=_[_0x68ef('0x53')](_0x583566['query']);_0x21f064['filters']=_[_0x68ef('0x3f')](_0x21f064[_0x68ef('0x41')],_0x21f064['query']);_0xc39f5b[_0x68ef('0x40')]=_[_0x68ef('0x3f')](_0x21f064[_0x68ef('0x41')],qs[_0x68ef('0x42')](_0x583566[_0x68ef('0x3d')]['fields']));_0xc39f5b[_0x68ef('0x40')]=_0xc39f5b[_0x68ef('0x40')][_0x68ef('0x43')]?_0xc39f5b['attributes']:_0x21f064[_0x68ef('0x41')];if(_0x583566[_0x68ef('0x3d')][_0x68ef('0x4d')]){_0xc39f5b['include']=[{'all':!![]}];}_0xc39f5b=_[_0x68ef('0x4a')]({},_0xc39f5b,_0x583566['options']);return db['FreshsalesConfiguration'][_0x68ef('0x54')](_0xc39f5b)['then'](handleEntityNotFound(_0x55f385,null))[_0x68ef('0x20')](respondWithResult(_0x55f385,null))[_0x68ef('0x50')](handleError(_0x55f385,null));};exports[_0x68ef('0x55')]=function(_0x1e651f,_0x2a0be0){return db[_0x68ef('0x37')][_0x68ef('0x55')](_0x1e651f[_0x68ef('0x56')],{})[_0x68ef('0x20')](respondWithResult(_0x2a0be0,0xc9))[_0x68ef('0x50')](handleError(_0x2a0be0,null));};exports['update']=function(_0x534960,_0x390451){if(_0x534960[_0x68ef('0x56')]['id']){delete _0x534960[_0x68ef('0x56')]['id'];}return db[_0x68ef('0x37')][_0x68ef('0x54')]({'where':{'id':_0x534960[_0x68ef('0x52')]['id']}})[_0x68ef('0x20')](handleEntityNotFound(_0x390451,null))[_0x68ef('0x20')](saveUpdates(_0x534960[_0x68ef('0x56')],null))['then'](respondWithResult(_0x390451,null))['catch'](handleError(_0x390451,null));};exports[_0x68ef('0x34')]=function(_0x5781c8,_0x459b21){return db['FreshsalesConfiguration'][_0x68ef('0x54')]({'where':{'id':_0x5781c8[_0x68ef('0x52')]['id']}})['then'](handleEntityNotFound(_0x459b21,null))[_0x68ef('0x20')](removeEntity(_0x459b21,null))['catch'](handleError(_0x459b21,null));};exports[_0x68ef('0x57')]=function(_0x15c1ee,_0x3319ea,_0x304434){var _0x1bc83b={};var _0x3d81c8={};var _0x5c347c;var _0x1cdaef;return db[_0x68ef('0x37')][_0x68ef('0x58')]({'where':{'id':_0x15c1ee[_0x68ef('0x52')]['id']}})[_0x68ef('0x20')](handleEntityNotFound(_0x3319ea,null))[_0x68ef('0x20')](function(_0x48e15a){if(_0x48e15a){_0x5c347c=_0x48e15a;_0x3d81c8[_0x68ef('0x41')]=_[_0x68ef('0x53')](db['FreshsalesField'][_0x68ef('0x38')]);_0x3d81c8[_0x68ef('0x3d')]=_[_0x68ef('0x53')](_0x15c1ee['query']);_0x3d81c8[_0x68ef('0x3e')]=_['intersection'](_0x3d81c8['model'],_0x3d81c8[_0x68ef('0x3d')]);_0x1bc83b['attributes']=_[_0x68ef('0x3f')](_0x3d81c8['model'],qs[_0x68ef('0x42')](_0x15c1ee[_0x68ef('0x3d')][_0x68ef('0x42')]));_0x1bc83b[_0x68ef('0x40')]=_0x1bc83b[_0x68ef('0x40')][_0x68ef('0x43')]?_0x1bc83b['attributes']:_0x3d81c8[_0x68ef('0x41')];_0x1bc83b['order']=qs[_0x68ef('0x46')](_0x15c1ee['query'][_0x68ef('0x46')]);_0x1bc83b[_0x68ef('0x47')]=qs[_0x68ef('0x3e')](_[_0x68ef('0x48')](_0x15c1ee[_0x68ef('0x3d')],_0x3d81c8[_0x68ef('0x3e')]));if(_0x15c1ee[_0x68ef('0x3d')]['filter']){_0x1bc83b[_0x68ef('0x47')]=_[_0x68ef('0x4a')](_0x1bc83b[_0x68ef('0x47')],{'$or':_[_0x68ef('0x3c')](_0x1bc83b[_0x68ef('0x40')],function(_0x4ff8a6){var _0x1a62ef={};_0x1a62ef[_0x4ff8a6]={'$like':'%'+_0x15c1ee['query'][_0x68ef('0x49')]+'%'};return _0x1a62ef;})});}_0x1bc83b=_['merge']({},_0x1bc83b,_0x15c1ee['options']);return _0x5c347c[_0x68ef('0x57')](_0x1bc83b);}})[_0x68ef('0x20')](function(_0x6d566f){if(_0x6d566f){_0x1cdaef=_0x6d566f[_0x68ef('0x43')];if(!_0x15c1ee['query'][_0x68ef('0x59')]('nolimit')){_0x1bc83b[_0x68ef('0x2d')]=qs[_0x68ef('0x2d')](_0x15c1ee[_0x68ef('0x3d')]['limit']);_0x1bc83b['offset']=qs[_0x68ef('0x2c')](_0x15c1ee[_0x68ef('0x3d')][_0x68ef('0x2c')]);}return _0x5c347c[_0x68ef('0x57')](_0x1bc83b);}})['then'](function(_0x335ba8){if(_0x335ba8){return _0x335ba8?{'count':_0x1cdaef,'rows':_0x335ba8}:null;}})[_0x68ef('0x20')](respondWithResult(_0x3319ea,null))[_0x68ef('0x50')](handleError(_0x3319ea,null));};exports[_0x68ef('0x5a')]=function(_0x5089b3,_0x3f56a7,_0x53a601){var _0x10c546={};var _0x3998d4={};var _0x90e1a6;var _0x3193c8;return db[_0x68ef('0x37')]['findOne']({'where':{'id':_0x5089b3[_0x68ef('0x52')]['id']}})[_0x68ef('0x20')](handleEntityNotFound(_0x3f56a7,null))[_0x68ef('0x20')](function(_0x595e79){if(_0x595e79){_0x90e1a6=_0x595e79;_0x3998d4[_0x68ef('0x41')]=_['keys'](db[_0x68ef('0x5b')]['rawAttributes']);_0x3998d4['query']=_[_0x68ef('0x53')](_0x5089b3[_0x68ef('0x3d')]);_0x3998d4[_0x68ef('0x3e')]=_[_0x68ef('0x3f')](_0x3998d4['model'],_0x3998d4[_0x68ef('0x3d')]);_0x10c546[_0x68ef('0x40')]=_[_0x68ef('0x3f')](_0x3998d4['model'],qs[_0x68ef('0x42')](_0x5089b3[_0x68ef('0x3d')][_0x68ef('0x42')]));_0x10c546[_0x68ef('0x40')]=_0x10c546[_0x68ef('0x40')][_0x68ef('0x43')]?_0x10c546[_0x68ef('0x40')]:_0x3998d4[_0x68ef('0x41')];_0x10c546[_0x68ef('0x45')]=qs[_0x68ef('0x46')](_0x5089b3[_0x68ef('0x3d')][_0x68ef('0x46')]);_0x10c546['where']=qs[_0x68ef('0x3e')](_[_0x68ef('0x48')](_0x5089b3['query'],_0x3998d4['filters']));if(_0x5089b3[_0x68ef('0x3d')]['filter']){_0x10c546[_0x68ef('0x47')]=_[_0x68ef('0x4a')](_0x10c546['where'],{'$or':_['map'](_0x10c546[_0x68ef('0x40')],function(_0x5c500c){var _0x279059={};_0x279059[_0x5c500c]={'$like':'%'+_0x5089b3['query'][_0x68ef('0x49')]+'%'};return _0x279059;})});}_0x10c546=_['merge']({},_0x10c546,_0x5089b3[_0x68ef('0x4b')]);return _0x90e1a6[_0x68ef('0x5a')](_0x10c546);}})['then'](function(_0x3c5e35){if(_0x3c5e35){_0x3193c8=_0x3c5e35[_0x68ef('0x43')];if(!_0x5089b3[_0x68ef('0x3d')][_0x68ef('0x59')]('nolimit')){_0x10c546[_0x68ef('0x2d')]=qs[_0x68ef('0x2d')](_0x5089b3['query'][_0x68ef('0x2d')]);_0x10c546[_0x68ef('0x2c')]=qs[_0x68ef('0x2c')](_0x5089b3['query'][_0x68ef('0x2c')]);}return _0x90e1a6['getDescriptions'](_0x10c546);}})[_0x68ef('0x20')](function(_0x36c109){if(_0x36c109){return _0x36c109?{'count':_0x3193c8,'rows':_0x36c109}:null;}})['then'](respondWithResult(_0x3f56a7,null))['catch'](handleError(_0x3f56a7,null));};exports['getFields']=function(_0x564ef7,_0x4370b1,_0x28ad22){var _0x1217f9={};var _0x41a657={};var _0x45cd01;var _0x409516;return db[_0x68ef('0x37')][_0x68ef('0x58')]({'where':{'id':_0x564ef7[_0x68ef('0x52')]['id']}})[_0x68ef('0x20')](handleEntityNotFound(_0x4370b1,null))[_0x68ef('0x20')](function(_0x108223){if(_0x108223){_0x45cd01=_0x108223;_0x41a657[_0x68ef('0x41')]=_['keys'](db[_0x68ef('0x5b')]['rawAttributes']);_0x41a657[_0x68ef('0x3d')]=_['keys'](_0x564ef7['query']);_0x41a657[_0x68ef('0x3e')]=_[_0x68ef('0x3f')](_0x41a657[_0x68ef('0x41')],_0x41a657[_0x68ef('0x3d')]);_0x1217f9['attributes']=_['intersection'](_0x41a657[_0x68ef('0x41')],qs[_0x68ef('0x42')](_0x564ef7[_0x68ef('0x3d')]['fields']));_0x1217f9[_0x68ef('0x40')]=_0x1217f9[_0x68ef('0x40')][_0x68ef('0x43')]?_0x1217f9[_0x68ef('0x40')]:_0x41a657['model'];_0x1217f9[_0x68ef('0x45')]=qs[_0x68ef('0x46')](_0x564ef7[_0x68ef('0x3d')][_0x68ef('0x46')]);_0x1217f9[_0x68ef('0x47')]=qs[_0x68ef('0x3e')](_['pick'](_0x564ef7[_0x68ef('0x3d')],_0x41a657['filters']));if(_0x564ef7[_0x68ef('0x3d')][_0x68ef('0x49')]){_0x1217f9[_0x68ef('0x47')]=_[_0x68ef('0x4a')](_0x1217f9['where'],{'$or':_[_0x68ef('0x3c')](_0x1217f9['attributes'],function(_0x3d8d69){var _0x328abd={};_0x328abd[_0x3d8d69]={'$like':'%'+_0x564ef7['query']['filter']+'%'};return _0x328abd;})});}_0x1217f9=_[_0x68ef('0x4a')]({},_0x1217f9,_0x564ef7['options']);return _0x45cd01[_0x68ef('0x5c')](_0x1217f9);}})['then'](function(_0x34d825){if(_0x34d825){_0x409516=_0x34d825[_0x68ef('0x43')];if(!_0x564ef7[_0x68ef('0x3d')][_0x68ef('0x59')](_0x68ef('0x44'))){_0x1217f9[_0x68ef('0x2d')]=qs['limit'](_0x564ef7[_0x68ef('0x3d')][_0x68ef('0x2d')]);_0x1217f9[_0x68ef('0x2c')]=qs[_0x68ef('0x2c')](_0x564ef7[_0x68ef('0x3d')][_0x68ef('0x2c')]);}return _0x45cd01[_0x68ef('0x5c')](_0x1217f9);}})['then'](function(_0x295c0f){if(_0x295c0f){return _0x295c0f?{'count':_0x409516,'rows':_0x295c0f}:null;}})[_0x68ef('0x20')](respondWithResult(_0x4370b1,null))[_0x68ef('0x50')](handleError(_0x4370b1,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index d44f80e..638ebb2 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 _0xe908=['define','int_freshsales_configurations','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports'];(function(_0xa78ef4,_0x376a6c){var _0x27593b=function(_0x4b2ab8){while(--_0x4b2ab8){_0xa78ef4['push'](_0xa78ef4['shift']());}};_0x27593b(++_0x376a6c);}(_0xe908,0x1be));var _0x8e90=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe908[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x8e90('0x0'));var logger=require('../../config/logger')(_0x8e90('0x1'));var moment=require(_0x8e90('0x2'));var BPromise=require(_0x8e90('0x3'));var rp=require(_0x8e90('0x4'));var fs=require('fs');var path=require(_0x8e90('0x5'));var rimraf=require(_0x8e90('0x6'));var config=require(_0x8e90('0x7'));var attributes=require(_0x8e90('0x8'));module[_0x8e90('0x9')]=function(_0x5168ff,_0x518713){return _0x5168ff[_0x8e90('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0x8e90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaac0=['./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','api','moment','bluebird','path','../../config/environment'];(function(_0x137bf4,_0x23449a){var _0x5b74c9=function(_0x394d11){while(--_0x394d11){_0x137bf4['push'](_0x137bf4['shift']());}};_0x5b74c9(++_0x23449a);}(_0xaac0,0x10c));var _0x0aac=function(_0x4c56b6,_0x239082){_0x4c56b6=_0x4c56b6-0x0;var _0x1ee73a=_0xaac0[_0x4c56b6];return _0x1ee73a;};'use strict';var _=require(_0x0aac('0x0'));var util=require(_0x0aac('0x1'));var logger=require('../../config/logger')(_0x0aac('0x2'));var moment=require(_0x0aac('0x3'));var BPromise=require(_0x0aac('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0aac('0x5'));var rimraf=require('rimraf');var config=require(_0x0aac('0x6'));var attributes=require(_0x0aac('0x7'));module['exports']=function(_0x31c5f4,_0x45c2e0){return _0x31c5f4[_0x0aac('0x8')](_0x0aac('0x9'),attributes,{'tableName':_0x0aac('0xa'),'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 2c26ba7..aa1c2de 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 _0xf46a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','info','lodash','moment','bluebird','ioredis'];(function(_0x5c925d,_0x2e042a){var _0x45792e=function(_0x32888e){while(--_0x32888e){_0x5c925d['push'](_0x5c925d['shift']());}};_0x45792e(++_0x2e042a);}(_0xf46a,0xa4));var _0xaf46=function(_0x38c585,_0xb72c9e){_0x38c585=_0x38c585-0x0;var _0x26cbd=_0xf46a[_0x38c585];return _0x26cbd;};'use strict';var _=require(_0xaf46('0x0'));var util=require('util');var moment=require(_0xaf46('0x1'));var BPromise=require(_0xaf46('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf46('0x3'));var db=require(_0xaf46('0x4'))['db'];var utils=require(_0xaf46('0x5'));var logger=require(_0xaf46('0x6'))(_0xaf46('0x7'));var config=require(_0xaf46('0x8'));var jayson=require(_0xaf46('0x9'));var client=jayson[_0xaf46('0xa')][_0xaf46('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9e9887,_0x4f76cc,_0xa4a618){return new BPromise(function(_0x105943,_0x328d92){return client['request'](_0x9e9887,_0xa4a618)[_0xaf46('0xc')](function(_0x4e67c0){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x4f76cc,_0xaf46('0xd'));logger[_0xaf46('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x4f76cc,_0xaf46('0xd'),JSON[_0xaf46('0xf')](_0x4e67c0));if(_0x4e67c0[_0xaf46('0x10')]){if(_0x4e67c0['error'][_0xaf46('0x11')]===0x1f4){logger['error'](_0xaf46('0x12'),_0x4f76cc,_0x4e67c0['error'][_0xaf46('0x13')]);return _0x328d92(_0x4e67c0['error'][_0xaf46('0x13')]);}logger[_0xaf46('0x10')](_0xaf46('0x12'),_0x4f76cc,_0x4e67c0[_0xaf46('0x10')][_0xaf46('0x13')]);return _0x105943(_0x4e67c0[_0xaf46('0x10')][_0xaf46('0x13')]);}else{logger[_0xaf46('0x14')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4f76cc,'request\x20sent');_0x105943(_0x4e67c0['result'][_0xaf46('0x13')]);}})['catch'](function(_0x498720){logger[_0xaf46('0x10')](_0xaf46('0x12'),_0x4f76cc,_0x498720);_0x328d92(_0x498720);});});} \ No newline at end of file +var _0x74fd=['code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2bce13,_0x529a85){var _0xaefeb6=function(_0xd5edbf){while(--_0xd5edbf){_0x2bce13['push'](_0x2bce13['shift']());}};_0xaefeb6(++_0x529a85);}(_0x74fd,0x8f));var _0xd74f=function(_0x3a78a0,_0x44985f){_0x3a78a0=_0x3a78a0-0x0;var _0x48e917=_0x74fd[_0x3a78a0];return _0x48e917;};'use strict';var _=require(_0xd74f('0x0'));var util=require('util');var moment=require(_0xd74f('0x1'));var BPromise=require(_0xd74f('0x2'));var rs=require(_0xd74f('0x3'));var fs=require('fs');var Redis=require(_0xd74f('0x4'));var db=require(_0xd74f('0x5'))['db'];var utils=require(_0xd74f('0x6'));var logger=require(_0xd74f('0x7'))(_0xd74f('0x8'));var config=require(_0xd74f('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd74f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf8e312,_0x4f2e9c,_0x43f684){return new BPromise(function(_0x161599,_0x605d18){return client[_0xd74f('0xb')](_0xf8e312,_0x43f684)[_0xd74f('0xc')](function(_0x514d18){logger['info'](_0xd74f('0xd'),_0x4f2e9c,'request\x20sent');logger['debug'](_0xd74f('0xe'),_0x4f2e9c,_0xd74f('0xf'),JSON[_0xd74f('0x10')](_0x514d18));if(_0x514d18[_0xd74f('0x11')]){if(_0x514d18[_0xd74f('0x11')][_0xd74f('0x12')]===0x1f4){logger[_0xd74f('0x11')](_0xd74f('0xd'),_0x4f2e9c,_0x514d18[_0xd74f('0x11')]['message']);return _0x605d18(_0x514d18[_0xd74f('0x11')][_0xd74f('0x13')]);}logger[_0xd74f('0x11')](_0xd74f('0xd'),_0x4f2e9c,_0x514d18[_0xd74f('0x11')]['message']);return _0x161599(_0x514d18[_0xd74f('0x11')][_0xd74f('0x13')]);}else{logger[_0xd74f('0x14')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4f2e9c,_0xd74f('0xf'));_0x161599(_0x514d18[_0xd74f('0x15')]['message']);}})[_0xd74f('0x16')](function(_0x229f49){logger[_0xd74f('0x11')](_0xd74f('0xd'),_0x4f2e9c,_0x229f49);_0x605d18(_0x229f49);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 73e4284..059f96c 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 _0xabc3=['show','put','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index'];(function(_0x580538,_0xaf3f6c){var _0x5480be=function(_0x3c202b){while(--_0x3c202b){_0x580538['push'](_0x580538['shift']());}};_0x5480be(++_0xaf3f6c);}(_0xabc3,0x85));var _0x3abc=function(_0x138578,_0x358a16){_0x138578=_0x138578-0x0;var _0x3e92ab=_0xabc3[_0x138578];return _0x3e92ab;};'use strict';var multer=require(_0x3abc('0x0'));var util=require(_0x3abc('0x1'));var path=require(_0x3abc('0x2'));var timeout=require(_0x3abc('0x3'));var express=require('express');var router=express[_0x3abc('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3abc('0x5'));var config=require(_0x3abc('0x6'));var controller=require(_0x3abc('0x7'));router[_0x3abc('0x8')]('/',auth[_0x3abc('0x9')](),controller[_0x3abc('0xa')]);router[_0x3abc('0x8')]('/:id',auth[_0x3abc('0x9')](),controller[_0x3abc('0xb')]);router['post']('/',auth[_0x3abc('0x9')](),controller['create']);router[_0x3abc('0xc')](_0x3abc('0xd'),auth[_0x3abc('0x9')](),controller['update']);router['delete']('/:id',auth[_0x3abc('0x9')](),controller[_0x3abc('0xe')]);module[_0x3abc('0xf')]=router; \ No newline at end of file +var _0x767b=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x767b,0x113));var _0xb767=function(_0x1443d5,_0x21f839){_0x1443d5=_0x1443d5-0x0;var _0x3f8e34=_0x767b[_0x1443d5];return _0x3f8e34;};'use strict';var multer=require(_0xb767('0x0'));var util=require('util');var path=require(_0xb767('0x1'));var timeout=require(_0xb767('0x2'));var express=require(_0xb767('0x3'));var router=express[_0xb767('0x4')]();var auth=require(_0xb767('0x5'));var interaction=require(_0xb767('0x6'));var config=require(_0xb767('0x7'));var controller=require(_0xb767('0x8'));router[_0xb767('0x9')]('/',auth[_0xb767('0xa')](),controller[_0xb767('0xb')]);router['get'](_0xb767('0xc'),auth['isAuthenticated'](),controller[_0xb767('0xd')]);router[_0xb767('0xe')]('/',auth['isAuthenticated'](),controller[_0xb767('0xf')]);router[_0xb767('0x10')](_0xb767('0xc'),auth[_0xb767('0xa')](),controller[_0xb767('0x11')]);router[_0xb767('0x12')](_0xb767('0xc'),auth[_0xb767('0xa')](),controller[_0xb767('0x13')]);module[_0xb767('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 364179e..cdab89b 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 _0x8cd9=['exports','ENUM','string','customVariable','keyValue','STRING','variable','sequelize'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x8cd9,0x1c7));var _0x98cd=function(_0x368fd0,_0x2335c1){_0x368fd0=_0x368fd0-0x0;var _0x4f0b31=_0x8cd9[_0x368fd0];return _0x4f0b31;};'use strict';var Sequelize=require(_0x98cd('0x0'));module[_0x98cd('0x1')]={'type':{'type':Sequelize[_0x98cd('0x2')](_0x98cd('0x3'),'variable',_0x98cd('0x4'),_0x98cd('0x5')),'defaultValue':_0x98cd('0x3')},'content':{'type':Sequelize[_0x98cd('0x6')]},'key':{'type':Sequelize[_0x98cd('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x98cd('0x3'),_0x98cd('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x98cd('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x98cd('0x6')]}}; \ No newline at end of file +var _0x7da1=['STRING','BOOLEAN','ENUM','string','variable','customVariable','keyValue'];(function(_0x56b125,_0x397317){var _0xe264b1=function(_0xd8d76d){while(--_0xd8d76d){_0x56b125['push'](_0x56b125['shift']());}};_0xe264b1(++_0x397317);}(_0x7da1,0x1bb));var _0x17da=function(_0x163607,_0x1375a4){_0x163607=_0x163607-0x0;var _0x58c256=_0x7da1[_0x163607];return _0x58c256;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x17da('0x0')](_0x17da('0x1'),_0x17da('0x2'),_0x17da('0x3'),_0x17da('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x17da('0x5')]},'key':{'type':Sequelize[_0x17da('0x5')]},'keyType':{'type':Sequelize[_0x17da('0x0')]('string',_0x17da('0x2'),_0x17da('0x3'))},'keyContent':{'type':Sequelize[_0x17da('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x17da('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x17da('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index fdba6ec..d8beacb 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 _0xb41a=['filters','length','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','filter','VIRTUAL','merge','FreshsalesField','includeAll','include','catch','show','params'];(function(_0x9b163,_0x5d8c8f){var _0x824910=function(_0xe93c8){while(--_0xe93c8){_0x9b163['push'](_0x9b163['shift']());}};_0x824910(++_0x5d8c8f);}(_0xb41a,0xda));var _0xab41=function(_0x4e11e7,_0x42d0b6){_0x4e11e7=_0x4e11e7-0x0;var _0x1d7d39=_0xb41a[_0x4e11e7];return _0x1d7d39;};'use strict';var pdf=require(_0xab41('0x0'));var emlformat=require(_0xab41('0x1'));var rimraf=require(_0xab41('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab41('0x3'));var rp=require(_0xab41('0x4'));var moment=require(_0xab41('0x5'));var BPromise=require(_0xab41('0x6'));var Mustache=require(_0xab41('0x7'));var util=require(_0xab41('0x8'));var path=require(_0xab41('0x9'));var sox=require(_0xab41('0xa'));var csv=require('to-csv');var ejs=require(_0xab41('0xb'));var fs=require('fs');var _=require(_0xab41('0xc'));var squel=require(_0xab41('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xab41('0xe'));var toCsv=require(_0xab41('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xab41('0x10'));var authService=require(_0xab41('0x11'));var qs=require(_0xab41('0x12'));var as=require(_0xab41('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xab41('0x14'))('api');var utils=require(_0xab41('0x15'));var config=require(_0xab41('0x16'));var licenseUtil=require(_0xab41('0x17'));var db=require(_0xab41('0x18'))['db'];function respondWithStatusCode(_0x1ab339,_0x356b17){_0x356b17=_0x356b17||0xcc;return function(_0x1fb03c){if(_0x1fb03c){return _0x1ab339[_0xab41('0x19')](_0x356b17);}return _0x1ab339[_0xab41('0x1a')](_0x356b17)[_0xab41('0x1b')]();};}function respondWithResult(_0x277023,_0x397f01){_0x397f01=_0x397f01||0xc8;return function(_0x4c7fba){if(_0x4c7fba){return _0x277023[_0xab41('0x1a')](_0x397f01)[_0xab41('0x1c')](_0x4c7fba);}};}function respondWithFilteredResult(_0x1ee13f,_0x4209cc){return function(_0x1d5274){if(_0x1d5274){var _0xb0a1c3=_0x1d5274[_0xab41('0x1d')],_0x171a29=_0x4209cc[_0xab41('0x1e')],_0x3b1076=_0x4209cc[_0xab41('0x1e')]+_0x4209cc[_0xab41('0x1f')],_0x157639;if(_0x3b1076>=_0xb0a1c3){_0x3b1076=_0xb0a1c3;_0x157639=0xc8;}else{_0x157639=0xce;}_0x1ee13f[_0xab41('0x1a')](_0x157639);return _0x1ee13f[_0xab41('0x20')]('Content-Range',_0x171a29+'-'+_0x3b1076+'/'+_0xb0a1c3)[_0xab41('0x1c')](_0x1d5274);}return null;};}function patchUpdates(_0x44148e){return function(_0x52ad8c){try{jsonpatch[_0xab41('0x21')](_0x52ad8c,_0x44148e,!![]);}catch(_0x50172a){return BPromise[_0xab41('0x22')](_0x50172a);}return _0x52ad8c[_0xab41('0x23')]();};}function saveUpdates(_0x5ee9d9,_0x22e4dc){return function(_0x547513){if(_0x547513){return _0x547513[_0xab41('0x24')](_0x5ee9d9)[_0xab41('0x25')](function(_0x1a99c4){return _0x1a99c4;});}return null;};}function removeEntity(_0x34146a,_0x1c35a5){return function(_0x33523d){if(_0x33523d){return _0x33523d[_0xab41('0x26')]()[_0xab41('0x25')](function(){_0x34146a[_0xab41('0x1a')](0xcc)[_0xab41('0x1b')]();});}};}function handleEntityNotFound(_0x2bdd9c,_0x5252d9){return function(_0x4c4796){if(!_0x4c4796){_0x2bdd9c[_0xab41('0x19')](0x194);}return _0x4c4796;};}function handleError(_0x17bb52,_0x1c6077){_0x1c6077=_0x1c6077||0x1f4;return function(_0x5c9213){logger['error'](_0x5c9213[_0xab41('0x27')]);if(_0x5c9213[_0xab41('0x28')]){delete _0x5c9213['name'];}_0x17bb52[_0xab41('0x1a')](_0x1c6077)[_0xab41('0x29')](_0x5c9213);};}exports[_0xab41('0x2a')]=function(_0x5c5bfc,_0x5d8775){var _0x268682={},_0xca3565={},_0x9e4e2b={'count':0x0,'rows':[]};var _0x1ad74b=_['map'](db['FreshsalesField'][_0xab41('0x2b')],function(_0x12b3e1){return{'name':_0x12b3e1[_0xab41('0x2c')],'type':_0x12b3e1[_0xab41('0x2d')][_0xab41('0x2e')]};});_0xca3565[_0xab41('0x2f')]=_['map'](_0x1ad74b,_0xab41('0x28'));_0xca3565[_0xab41('0x30')]=_[_0xab41('0x31')](_0x5c5bfc[_0xab41('0x30')]);_0xca3565['filters']=_['intersection'](_0xca3565[_0xab41('0x2f')],_0xca3565[_0xab41('0x30')]);_0x268682['attributes']=_[_0xab41('0x32')](_0xca3565[_0xab41('0x2f')],qs['fields'](_0x5c5bfc[_0xab41('0x30')][_0xab41('0x33')]));_0x268682[_0xab41('0x34')]=_0x268682[_0xab41('0x34')]['length']?_0x268682[_0xab41('0x34')]:_0xca3565[_0xab41('0x2f')];if(!_0x5c5bfc['query']['hasOwnProperty'](_0xab41('0x35'))){_0x268682[_0xab41('0x1f')]=qs['limit'](_0x5c5bfc[_0xab41('0x30')]['limit']);_0x268682[_0xab41('0x1e')]=qs[_0xab41('0x1e')](_0x5c5bfc[_0xab41('0x30')][_0xab41('0x1e')]);}_0x268682[_0xab41('0x36')]=qs['sort'](_0x5c5bfc[_0xab41('0x30')][_0xab41('0x37')]);_0x268682[_0xab41('0x38')]=qs['filters'](_['pick'](_0x5c5bfc[_0xab41('0x30')],_0xca3565['filters']),_0x1ad74b);if(_0x5c5bfc['query'][_0xab41('0x39')]){_0x268682[_0xab41('0x38')]=_['merge'](_0x268682[_0xab41('0x38')],{'$or':_['map'](_0x1ad74b,function(_0x38c10c){if(_0x38c10c[_0xab41('0x2d')]!==_0xab41('0x3a')){var _0x38c7b9={};_0x38c7b9[_0x38c10c['name']]={'$like':'%'+_0x5c5bfc[_0xab41('0x30')][_0xab41('0x39')]+'%'};return _0x38c7b9;}})});}_0x268682=_[_0xab41('0x3b')]({},_0x268682,_0x5c5bfc['options']);var _0x332960={'where':_0x268682['where']};return db[_0xab41('0x3c')]['count'](_0x332960)[_0xab41('0x25')](function(_0x118aa3){_0x9e4e2b['count']=_0x118aa3;if(_0x5c5bfc[_0xab41('0x30')][_0xab41('0x3d')]){_0x268682[_0xab41('0x3e')]=[{'all':!![]}];}return db[_0xab41('0x3c')]['findAll'](_0x268682);})[_0xab41('0x25')](function(_0x45e00d){_0x9e4e2b['rows']=_0x45e00d;return _0x9e4e2b;})['then'](respondWithFilteredResult(_0x5d8775,_0x268682))[_0xab41('0x3f')](handleError(_0x5d8775,null));};exports[_0xab41('0x40')]=function(_0x49233d,_0x1d18db){var _0x533be7={'raw':!![],'where':{'id':_0x49233d[_0xab41('0x41')]['id']}},_0x49d46f={};_0x49d46f[_0xab41('0x2f')]=_[_0xab41('0x31')](db['FreshsalesField'][_0xab41('0x2b')]);_0x49d46f[_0xab41('0x30')]=_[_0xab41('0x31')](_0x49233d[_0xab41('0x30')]);_0x49d46f[_0xab41('0x42')]=_[_0xab41('0x32')](_0x49d46f[_0xab41('0x2f')],_0x49d46f[_0xab41('0x30')]);_0x533be7[_0xab41('0x34')]=_[_0xab41('0x32')](_0x49d46f[_0xab41('0x2f')],qs[_0xab41('0x33')](_0x49233d[_0xab41('0x30')][_0xab41('0x33')]));_0x533be7['attributes']=_0x533be7[_0xab41('0x34')][_0xab41('0x43')]?_0x533be7[_0xab41('0x34')]:_0x49d46f['model'];if(_0x49233d['query'][_0xab41('0x3d')]){_0x533be7[_0xab41('0x3e')]=[{'all':!![]}];}_0x533be7=_[_0xab41('0x3b')]({},_0x533be7,_0x49233d['options']);return db[_0xab41('0x3c')]['find'](_0x533be7)['then'](handleEntityNotFound(_0x1d18db,null))[_0xab41('0x25')](respondWithResult(_0x1d18db,null))['catch'](handleError(_0x1d18db,null));};exports['create']=function(_0x4d6412,_0x4ff885){return db[_0xab41('0x3c')][_0xab41('0x44')](_0x4d6412[_0xab41('0x45')],{})[_0xab41('0x25')](respondWithResult(_0x4ff885,0xc9))['catch'](handleError(_0x4ff885,null));};exports['update']=function(_0x4c7349,_0x3843e8){if(_0x4c7349[_0xab41('0x45')]['id']){delete _0x4c7349[_0xab41('0x45')]['id'];}return db[_0xab41('0x3c')][_0xab41('0x46')]({'where':{'id':_0x4c7349['params']['id']}})[_0xab41('0x25')](handleEntityNotFound(_0x3843e8,null))[_0xab41('0x25')](saveUpdates(_0x4c7349[_0xab41('0x45')],null))[_0xab41('0x25')](respondWithResult(_0x3843e8,null))[_0xab41('0x3f')](handleError(_0x3843e8,null));};exports[_0xab41('0x26')]=function(_0x3a4ecf,_0x2cd12e){return db[_0xab41('0x3c')][_0xab41('0x46')]({'where':{'id':_0x3a4ecf['params']['id']}})[_0xab41('0x25')](handleEntityNotFound(_0x2cd12e,null))['then'](removeEntity(_0x2cd12e,null))['catch'](handleError(_0x2cd12e,null));}; \ No newline at end of file +var _0x5c05=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','apply','reject','save','update','then','error','stack','name','send','index','FreshsalesField','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x5c05,0x89));var _0x55c0=function(_0x262d0e,_0x2179db){_0x262d0e=_0x262d0e-0x0;var _0x585559=_0x5c05[_0x262d0e];return _0x585559;};'use strict';var pdf=require(_0x55c0('0x0'));var emlformat=require(_0x55c0('0x1'));var rimraf=require(_0x55c0('0x2'));var zipdir=require(_0x55c0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x55c0('0x4'));var moment=require('moment');var BPromise=require(_0x55c0('0x5'));var Mustache=require(_0x55c0('0x6'));var util=require(_0x55c0('0x7'));var path=require(_0x55c0('0x8'));var sox=require('sox');var csv=require(_0x55c0('0x9'));var ejs=require(_0x55c0('0xa'));var fs=require('fs');var _=require(_0x55c0('0xb'));var squel=require(_0x55c0('0xc'));var crypto=require(_0x55c0('0xd'));var jsforce=require(_0x55c0('0xe'));var deskjs=require(_0x55c0('0xf'));var toCsv=require(_0x55c0('0x9'));var querystring=require(_0x55c0('0x10'));var Papa=require(_0x55c0('0x11'));var Redis=require('ioredis');var authService=require(_0x55c0('0x12'));var qs=require(_0x55c0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x55c0('0x14'));var logger=require(_0x55c0('0x15'))(_0x55c0('0x16'));var utils=require(_0x55c0('0x17'));var config=require(_0x55c0('0x18'));var licenseUtil=require(_0x55c0('0x19'));var db=require(_0x55c0('0x1a'))['db'];function respondWithStatusCode(_0x3022b6,_0x31cf1e){_0x31cf1e=_0x31cf1e||0xcc;return function(_0x2139a4){if(_0x2139a4){return _0x3022b6[_0x55c0('0x1b')](_0x31cf1e);}return _0x3022b6[_0x55c0('0x1c')](_0x31cf1e)[_0x55c0('0x1d')]();};}function respondWithResult(_0x20f918,_0x4344dc){_0x4344dc=_0x4344dc||0xc8;return function(_0x78f72e){if(_0x78f72e){return _0x20f918[_0x55c0('0x1c')](_0x4344dc)[_0x55c0('0x1e')](_0x78f72e);}};}function respondWithFilteredResult(_0x50a103,_0x53aa10){return function(_0x55c66f){if(_0x55c66f){var _0x5035e7=_0x55c66f[_0x55c0('0x1f')],_0xd665ea=_0x53aa10['offset'],_0x293c7b=_0x53aa10[_0x55c0('0x20')]+_0x53aa10['limit'],_0x3effce;if(_0x293c7b>=_0x5035e7){_0x293c7b=_0x5035e7;_0x3effce=0xc8;}else{_0x3effce=0xce;}_0x50a103[_0x55c0('0x1c')](_0x3effce);return _0x50a103['set']('Content-Range',_0xd665ea+'-'+_0x293c7b+'/'+_0x5035e7)[_0x55c0('0x1e')](_0x55c66f);}return null;};}function patchUpdates(_0x71c695){return function(_0x16deae){try{jsonpatch[_0x55c0('0x21')](_0x16deae,_0x71c695,!![]);}catch(_0x1683ec){return BPromise[_0x55c0('0x22')](_0x1683ec);}return _0x16deae[_0x55c0('0x23')]();};}function saveUpdates(_0x2cffd0,_0x2f9068){return function(_0x5a94de){if(_0x5a94de){return _0x5a94de[_0x55c0('0x24')](_0x2cffd0)['then'](function(_0x211c84){return _0x211c84;});}return null;};}function removeEntity(_0x394e34,_0x1eee05){return function(_0x59ec9d){if(_0x59ec9d){return _0x59ec9d['destroy']()[_0x55c0('0x25')](function(){_0x394e34[_0x55c0('0x1c')](0xcc)[_0x55c0('0x1d')]();});}};}function handleEntityNotFound(_0xefe2,_0x5dde53){return function(_0x52f998){if(!_0x52f998){_0xefe2[_0x55c0('0x1b')](0x194);}return _0x52f998;};}function handleError(_0x95aa34,_0x119125){_0x119125=_0x119125||0x1f4;return function(_0x503188){logger[_0x55c0('0x26')](_0x503188[_0x55c0('0x27')]);if(_0x503188[_0x55c0('0x28')]){delete _0x503188['name'];}_0x95aa34[_0x55c0('0x1c')](_0x119125)[_0x55c0('0x29')](_0x503188);};}exports[_0x55c0('0x2a')]=function(_0x2a6524,_0x404499){var _0x3009ca={},_0x5a154d={},_0x472c6e={'count':0x0,'rows':[]};var _0x219211=_['map'](db[_0x55c0('0x2b')][_0x55c0('0x2c')],function(_0x4f21cb){return{'name':_0x4f21cb['fieldName'],'type':_0x4f21cb[_0x55c0('0x2d')][_0x55c0('0x2e')]};});_0x5a154d[_0x55c0('0x2f')]=_[_0x55c0('0x30')](_0x219211,'name');_0x5a154d[_0x55c0('0x31')]=_['keys'](_0x2a6524[_0x55c0('0x31')]);_0x5a154d[_0x55c0('0x32')]=_[_0x55c0('0x33')](_0x5a154d[_0x55c0('0x2f')],_0x5a154d['query']);_0x3009ca[_0x55c0('0x34')]=_['intersection'](_0x5a154d['model'],qs[_0x55c0('0x35')](_0x2a6524[_0x55c0('0x31')][_0x55c0('0x35')]));_0x3009ca[_0x55c0('0x34')]=_0x3009ca[_0x55c0('0x34')][_0x55c0('0x36')]?_0x3009ca[_0x55c0('0x34')]:_0x5a154d[_0x55c0('0x2f')];if(!_0x2a6524[_0x55c0('0x31')][_0x55c0('0x37')](_0x55c0('0x38'))){_0x3009ca[_0x55c0('0x39')]=qs[_0x55c0('0x39')](_0x2a6524['query'][_0x55c0('0x39')]);_0x3009ca[_0x55c0('0x20')]=qs['offset'](_0x2a6524[_0x55c0('0x31')]['offset']);}_0x3009ca[_0x55c0('0x3a')]=qs[_0x55c0('0x3b')](_0x2a6524[_0x55c0('0x31')][_0x55c0('0x3b')]);_0x3009ca[_0x55c0('0x3c')]=qs[_0x55c0('0x32')](_['pick'](_0x2a6524['query'],_0x5a154d[_0x55c0('0x32')]),_0x219211);if(_0x2a6524[_0x55c0('0x31')][_0x55c0('0x3d')]){_0x3009ca[_0x55c0('0x3c')]=_[_0x55c0('0x3e')](_0x3009ca[_0x55c0('0x3c')],{'$or':_['map'](_0x219211,function(_0xaabce0){if(_0xaabce0[_0x55c0('0x2d')]!==_0x55c0('0x3f')){var _0x8521e8={};_0x8521e8[_0xaabce0['name']]={'$like':'%'+_0x2a6524[_0x55c0('0x31')][_0x55c0('0x3d')]+'%'};return _0x8521e8;}})});}_0x3009ca=_[_0x55c0('0x3e')]({},_0x3009ca,_0x2a6524[_0x55c0('0x40')]);var _0x27e93a={'where':_0x3009ca['where']};return db[_0x55c0('0x2b')]['count'](_0x27e93a)['then'](function(_0x29720d){_0x472c6e[_0x55c0('0x1f')]=_0x29720d;if(_0x2a6524[_0x55c0('0x31')]['includeAll']){_0x3009ca[_0x55c0('0x41')]=[{'all':!![]}];}return db[_0x55c0('0x2b')][_0x55c0('0x42')](_0x3009ca);})[_0x55c0('0x25')](function(_0x5956e3){_0x472c6e[_0x55c0('0x43')]=_0x5956e3;return _0x472c6e;})['then'](respondWithFilteredResult(_0x404499,_0x3009ca))[_0x55c0('0x44')](handleError(_0x404499,null));};exports[_0x55c0('0x45')]=function(_0x2a7be1,_0x5dcd5b){var _0x47100b={'raw':!![],'where':{'id':_0x2a7be1[_0x55c0('0x46')]['id']}},_0x13a555={};_0x13a555[_0x55c0('0x2f')]=_[_0x55c0('0x47')](db[_0x55c0('0x2b')]['rawAttributes']);_0x13a555[_0x55c0('0x31')]=_[_0x55c0('0x47')](_0x2a7be1[_0x55c0('0x31')]);_0x13a555['filters']=_[_0x55c0('0x33')](_0x13a555[_0x55c0('0x2f')],_0x13a555[_0x55c0('0x31')]);_0x47100b[_0x55c0('0x34')]=_['intersection'](_0x13a555[_0x55c0('0x2f')],qs[_0x55c0('0x35')](_0x2a7be1['query'][_0x55c0('0x35')]));_0x47100b[_0x55c0('0x34')]=_0x47100b[_0x55c0('0x34')][_0x55c0('0x36')]?_0x47100b[_0x55c0('0x34')]:_0x13a555['model'];if(_0x2a7be1[_0x55c0('0x31')][_0x55c0('0x48')]){_0x47100b['include']=[{'all':!![]}];}_0x47100b=_[_0x55c0('0x3e')]({},_0x47100b,_0x2a7be1['options']);return db['FreshsalesField'][_0x55c0('0x49')](_0x47100b)[_0x55c0('0x25')](handleEntityNotFound(_0x5dcd5b,null))[_0x55c0('0x25')](respondWithResult(_0x5dcd5b,null))[_0x55c0('0x44')](handleError(_0x5dcd5b,null));};exports['create']=function(_0x1f30c2,_0x55730f){return db[_0x55c0('0x2b')][_0x55c0('0x4a')](_0x1f30c2[_0x55c0('0x4b')],{})[_0x55c0('0x25')](respondWithResult(_0x55730f,0xc9))['catch'](handleError(_0x55730f,null));};exports['update']=function(_0x47624e,_0x4a5094){if(_0x47624e[_0x55c0('0x4b')]['id']){delete _0x47624e[_0x55c0('0x4b')]['id'];}return db['FreshsalesField'][_0x55c0('0x49')]({'where':{'id':_0x47624e[_0x55c0('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a5094,null))[_0x55c0('0x25')](saveUpdates(_0x47624e[_0x55c0('0x4b')],null))[_0x55c0('0x25')](respondWithResult(_0x4a5094,null))[_0x55c0('0x44')](handleError(_0x4a5094,null));};exports['destroy']=function(_0x395fe4,_0x479e5f){return db[_0x55c0('0x2b')][_0x55c0('0x49')]({'where':{'id':_0x395fe4[_0x55c0('0x46')]['id']}})['then'](handleEntityNotFound(_0x479e5f,null))[_0x55c0('0x25')](removeEntity(_0x479e5f,null))[_0x55c0('0x44')](handleError(_0x479e5f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 5c63524..7e7114a 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 _0x703c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','../../config/logger'];(function(_0x3f1e31,_0x49768a){var _0x1bb81b=function(_0x37acbb){while(--_0x37acbb){_0x3f1e31['push'](_0x3f1e31['shift']());}};_0x1bb81b(++_0x49768a);}(_0x703c,0x19e));var _0xc703=function(_0xefd1c9,_0x5d726a){_0xefd1c9=_0xefd1c9-0x0;var _0x37026f=_0x703c[_0xefd1c9];return _0x37026f;};'use strict';var _=require(_0xc703('0x0'));var util=require('util');var logger=require(_0xc703('0x1'))(_0xc703('0x2'));var moment=require(_0xc703('0x3'));var BPromise=require(_0xc703('0x4'));var rp=require(_0xc703('0x5'));var fs=require('fs');var path=require(_0xc703('0x6'));var rimraf=require(_0xc703('0x7'));var config=require(_0xc703('0x8'));var attributes=require(_0xc703('0x9'));module[_0xc703('0xa')]=function(_0x11ddfb,_0x2f31b1){return _0x11ddfb[_0xc703('0xb')](_0xc703('0xc'),attributes,{'tableName':_0xc703('0xd'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xc703('0xe'),_0xc703('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x54cf=['FieldId','util','api','moment','request-promise','path','exports','freshsales_unique_index','idField'];(function(_0x3c73b3,_0x4618bb){var _0x5ac5e8=function(_0x24a0bb){while(--_0x24a0bb){_0x3c73b3['push'](_0x3c73b3['shift']());}};_0x5ac5e8(++_0x4618bb);}(_0x54cf,0x10f));var _0xf54c=function(_0x282f90,_0x415511){_0x282f90=_0x282f90-0x0;var _0x4aaa1e=_0x54cf[_0x282f90];return _0x4aaa1e;};'use strict';var _=require('lodash');var util=require(_0xf54c('0x0'));var logger=require('../../config/logger')(_0xf54c('0x1'));var moment=require(_0xf54c('0x2'));var BPromise=require('bluebird');var rp=require(_0xf54c('0x3'));var fs=require('fs');var path=require(_0xf54c('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module[_0xf54c('0x5')]=function(_0x165bac,_0x5e6bd8){return _0x165bac['define']('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xf54c('0x6'),'fields':[_0xf54c('0x7'),_0xf54c('0x8')],'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 d1f1da3..ddadd96 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 _0x7980=['client','http','request','then','info','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x501d1c,_0x22144a){var _0x1ddb0f=function(_0x146b78){while(--_0x146b78){_0x501d1c['push'](_0x501d1c['shift']());}};_0x1ddb0f(++_0x22144a);}(_0x7980,0x1a6));var _0x0798=function(_0x5cc7f2,_0x4a6a17){_0x5cc7f2=_0x5cc7f2-0x0;var _0x3be986=_0x7980[_0x5cc7f2];return _0x3be986;};'use strict';var _=require(_0x0798('0x0'));var util=require(_0x0798('0x1'));var moment=require(_0x0798('0x2'));var BPromise=require('bluebird');var rs=require(_0x0798('0x3'));var fs=require('fs');var Redis=require(_0x0798('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0798('0x5'));var logger=require(_0x0798('0x6'))(_0x0798('0x7'));var config=require(_0x0798('0x8'));var jayson=require(_0x0798('0x9'));var client=jayson[_0x0798('0xa')][_0x0798('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe4c448,_0x255682,_0x5e25f7){return new BPromise(function(_0x2fe4c9,_0x28d3e9){return client[_0x0798('0xc')](_0xe4c448,_0x5e25f7)[_0x0798('0xd')](function(_0x4c26f8){logger[_0x0798('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x255682,_0x0798('0xf'));logger[_0x0798('0x10')](_0x0798('0x11'),_0x255682,_0x0798('0xf'),JSON[_0x0798('0x12')](_0x4c26f8));if(_0x4c26f8[_0x0798('0x13')]){if(_0x4c26f8[_0x0798('0x13')][_0x0798('0x14')]===0x1f4){logger[_0x0798('0x13')](_0x0798('0x15'),_0x255682,_0x4c26f8[_0x0798('0x13')]['message']);return _0x28d3e9(_0x4c26f8['error'][_0x0798('0x16')]);}logger[_0x0798('0x13')](_0x0798('0x15'),_0x255682,_0x4c26f8[_0x0798('0x13')][_0x0798('0x16')]);return _0x2fe4c9(_0x4c26f8[_0x0798('0x13')]['message']);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x255682,_0x0798('0xf'));_0x2fe4c9(_0x4c26f8[_0x0798('0x17')][_0x0798('0x16')]);}})['catch'](function(_0x574fb3){logger['error'](_0x0798('0x15'),_0x255682,_0x574fb3);_0x28d3e9(_0x574fb3);});});} \ No newline at end of file +var _0x8727=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x1ceafa,_0x252713){var _0x2cb283=function(_0x3b68c9){while(--_0x3b68c9){_0x1ceafa['push'](_0x1ceafa['shift']());}};_0x2cb283(++_0x252713);}(_0x8727,0x8c));var _0x7872=function(_0x897ec9,_0xa15d6c){_0x897ec9=_0x897ec9-0x0;var _0x261ee7=_0x8727[_0x897ec9];return _0x261ee7;};'use strict';var _=require('lodash');var util=require(_0x7872('0x0'));var moment=require(_0x7872('0x1'));var BPromise=require(_0x7872('0x2'));var rs=require(_0x7872('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7872('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7872('0x5'))(_0x7872('0x6'));var config=require(_0x7872('0x7'));var jayson=require(_0x7872('0x8'));var client=jayson['client'][_0x7872('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x130bbf,_0xba7c24,_0x47b40e){return new BPromise(function(_0x12f9bb,_0x2e42e4){return client['request'](_0x130bbf,_0x47b40e)[_0x7872('0xa')](function(_0x1c6983){logger[_0x7872('0xb')](_0x7872('0xc'),_0xba7c24,_0x7872('0xd'));logger[_0x7872('0xe')](_0x7872('0xf'),_0xba7c24,_0x7872('0xd'),JSON['stringify'](_0x1c6983));if(_0x1c6983[_0x7872('0x10')]){if(_0x1c6983[_0x7872('0x10')][_0x7872('0x11')]===0x1f4){logger['error'](_0x7872('0xc'),_0xba7c24,_0x1c6983[_0x7872('0x10')][_0x7872('0x12')]);return _0x2e42e4(_0x1c6983[_0x7872('0x10')][_0x7872('0x12')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0xba7c24,_0x1c6983[_0x7872('0x10')][_0x7872('0x12')]);return _0x12f9bb(_0x1c6983['error'][_0x7872('0x12')]);}else{logger[_0x7872('0xb')]('FreshsalesField,\x20%s,\x20%s',_0xba7c24,_0x7872('0xd'));_0x12f9bb(_0x1c6983[_0x7872('0x13')][_0x7872('0x12')]);}})['catch'](function(_0xa26208){logger['error'](_0x7872('0xc'),_0xba7c24,_0xa26208);_0x2e42e4(_0xa26208);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 4251718..12ffd6b 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 _0x51c0=['isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','delete','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x51c0,0xef));var _0x051c=function(_0x2c51b9,_0x1f7737){_0x2c51b9=_0x2c51b9-0x0;var _0x41fe9c=_0x51c0[_0x2c51b9];return _0x41fe9c;};'use strict';var multer=require(_0x051c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x051c('0x1'));var express=require(_0x051c('0x2'));var router=express[_0x051c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x051c('0x4'));var config=require(_0x051c('0x5'));var controller=require(_0x051c('0x6'));router[_0x051c('0x7')]('/',auth[_0x051c('0x8')](),controller['index']);router[_0x051c('0x7')](_0x051c('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0x051c('0xa'),auth[_0x051c('0x8')](),controller[_0x051c('0xb')]);router[_0x051c('0x7')](_0x051c('0xc'),auth[_0x051c('0x8')](),controller[_0x051c('0xd')]);router['post']('/',auth[_0x051c('0x8')](),controller[_0x051c('0xe')]);router['post']('/:id/configurations',auth[_0x051c('0x8')](),controller[_0x051c('0xf')]);router[_0x051c('0x10')](_0x051c('0x9'),auth[_0x051c('0x8')](),controller['update']);router[_0x051c('0x11')]('/:id',auth[_0x051c('0x8')](),controller['destroy']);module[_0x051c('0x12')]=router; \ No newline at end of file +var _0xb3cf=['update','delete','destroy','multer','util','path','express','../../components/auth/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','put'];(function(_0x29fa3d,_0x45d24f){var _0x5d4bbf=function(_0x5b89ef){while(--_0x5b89ef){_0x29fa3d['push'](_0x29fa3d['shift']());}};_0x5d4bbf(++_0x45d24f);}(_0xb3cf,0x1a7));var _0xfb3c=function(_0x4d4298,_0xa728df){_0x4d4298=_0x4d4298-0x0;var _0x2f8aa2=_0xb3cf[_0x4d4298];return _0x2f8aa2;};'use strict';var multer=require(_0xfb3c('0x0'));var util=require(_0xfb3c('0x1'));var path=require(_0xfb3c('0x2'));var timeout=require('connect-timeout');var express=require(_0xfb3c('0x3'));var router=express['Router']();var auth=require(_0xfb3c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfb3c('0x5'));var controller=require(_0xfb3c('0x6'));router[_0xfb3c('0x7')]('/',auth[_0xfb3c('0x8')](),controller['index']);router['get'](_0xfb3c('0x9'),auth['isAuthenticated'](),controller[_0xfb3c('0xa')]);router['get'](_0xfb3c('0xb'),auth[_0xfb3c('0x8')](),controller[_0xfb3c('0xc')]);router[_0xfb3c('0x7')](_0xfb3c('0xd'),auth[_0xfb3c('0x8')](),controller['getFields']);router['post']('/',auth[_0xfb3c('0x8')](),controller[_0xfb3c('0xe')]);router[_0xfb3c('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xfb3c('0x10')]);router[_0xfb3c('0x11')](_0xfb3c('0x9'),auth[_0xfb3c('0x8')](),controller[_0xfb3c('0x12')]);router[_0xfb3c('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xfb3c('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index ed0bc8b..05575c8 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 _0x6347=['username','integrationTab','exports','STRING'];(function(_0x1c80a1,_0x339aa2){var _0xeff92b=function(_0x2484da){while(--_0x2484da){_0x1c80a1['push'](_0x1c80a1['shift']());}};_0xeff92b(++_0x339aa2);}(_0x6347,0xd2));var _0x7634=function(_0x305ad2,_0x198aab){_0x305ad2=_0x305ad2-0x0;var _0x2d1e45=_0x6347[_0x305ad2];return _0x2d1e45;};'use strict';var Sequelize=require('sequelize');module[_0x7634('0x0')]={'name':{'type':Sequelize[_0x7634('0x1')]},'description':{'type':Sequelize[_0x7634('0x1')]},'username':{'type':Sequelize[_0x7634('0x1')],'unique':_0x7634('0x2')},'remoteUri':{'type':Sequelize[_0x7634('0x1')]},'password':{'type':Sequelize[_0x7634('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x7634('0x1')]},'securityToken':{'type':Sequelize[_0x7634('0x1')]},'serverUrl':{'type':Sequelize[_0x7634('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7634('0x3'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x74ad=['integrationTab','sequelize','exports','STRING','username','ENUM'];(function(_0x495cbe,_0xad2d6f){var _0x435ee1=function(_0x2c5f9a){while(--_0x2c5f9a){_0x495cbe['push'](_0x495cbe['shift']());}};_0x435ee1(++_0xad2d6f);}(_0x74ad,0x181));var _0xd74a=function(_0x2f2e0e,_0xbeb776){_0x2f2e0e=_0x2f2e0e-0x0;var _0x465367=_0x74ad[_0x2f2e0e];return _0x465367;};'use strict';var Sequelize=require(_0xd74a('0x0'));module[_0xd74a('0x1')]={'name':{'type':Sequelize[_0xd74a('0x2')]},'description':{'type':Sequelize[_0xd74a('0x2')]},'username':{'type':Sequelize[_0xd74a('0x2')],'unique':_0xd74a('0x3')},'remoteUri':{'type':Sequelize[_0xd74a('0x2')]},'password':{'type':Sequelize[_0xd74a('0x2')]},'clientId':{'type':Sequelize[_0xd74a('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xd74a('0x2')]},'serverUrl':{'type':Sequelize[_0xd74a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd74a('0x4')](_0xd74a('0x5'),'newTab'),'defaultValue':_0xd74a('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 5ad4ac0..6b560de 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 _0x8a4e=['options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','create','body','findOne','SalesforceConfiguration','getConfigurations','hasOwnProperty','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','lastIndexOf','concat','isNil','ticketType','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','picklist','boolean','email','textarea','phone','includes','label','picklistValues','value','True','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','Content-Range','apply','save','update','destroy','stack','name','send','map','SalesforceAccount','type','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x3473ae,_0x1b6c35){var _0x643ebe=function(_0x403641){while(--_0x403641){_0x3473ae['push'](_0x3473ae['shift']());}};_0x643ebe(++_0x1b6c35);}(_0x8a4e,0xbc));var _0xe8a4=function(_0x4344a2,_0x4798ee){_0x4344a2=_0x4344a2-0x0;var _0x3dc2cb=_0x8a4e[_0x4344a2];return _0x3dc2cb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe8a4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe8a4('0x1'));var jsonpatch=require(_0xe8a4('0x2'));var rp=require(_0xe8a4('0x3'));var moment=require(_0xe8a4('0x4'));var BPromise=require(_0xe8a4('0x5'));var Mustache=require(_0xe8a4('0x6'));var util=require(_0xe8a4('0x7'));var path=require(_0xe8a4('0x8'));var sox=require('sox');var csv=require(_0xe8a4('0x9'));var ejs=require(_0xe8a4('0xa'));var fs=require('fs');var _=require(_0xe8a4('0xb'));var squel=require(_0xe8a4('0xc'));var crypto=require(_0xe8a4('0xd'));var jsforce=require(_0xe8a4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe8a4('0x9'));var querystring=require(_0xe8a4('0xf'));var Papa=require('papaparse');var Redis=require(_0xe8a4('0x10'));var authService=require(_0xe8a4('0x11'));var qs=require(_0xe8a4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe8a4('0x13'));var logger=require(_0xe8a4('0x14'))('api');var utils=require(_0xe8a4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe8a4('0x16'));var db=require(_0xe8a4('0x17'))['db'];var integrations=require(_0xe8a4('0x18'));var jayson=require('jayson/promise');var client=jayson[_0xe8a4('0x19')][_0xe8a4('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x381a00,_0xe38c50,_0x361e4a,_0x3e7653){return new BPromise(function(_0x313384,_0x4c5ad3){var _0x112add=_0x3e7653||client;return _0x112add[_0xe8a4('0x1b')](_0x381a00,_0x361e4a)[_0xe8a4('0x1c')](function(_0x510ac5){logger[_0xe8a4('0x1d')](_0xe8a4('0x1e'),_0xe38c50,_0xe8a4('0x1f'));logger[_0xe8a4('0x20')](_0xe8a4('0x21'),_0xe38c50,'request\x20sent',JSON[_0xe8a4('0x22')](_0x510ac5));if(_0x510ac5[_0xe8a4('0x23')]){if(_0x510ac5[_0xe8a4('0x23')][_0xe8a4('0x24')]===0x1f4){logger[_0xe8a4('0x23')](_0xe8a4('0x1e'),_0xe38c50,_0x510ac5[_0xe8a4('0x23')]['message']);return _0x4c5ad3(_0x510ac5[_0xe8a4('0x23')]['message']);}logger[_0xe8a4('0x23')](_0xe8a4('0x1e'),_0xe38c50,_0x510ac5['error'][_0xe8a4('0x25')]);return _0x313384(_0x510ac5[_0xe8a4('0x23')]['message']);}else{logger['info'](_0xe8a4('0x1e'),_0xe38c50,_0xe8a4('0x1f'));_0x313384(_0x510ac5[_0xe8a4('0x26')][_0xe8a4('0x25')]);}})[_0xe8a4('0x27')](function(_0x370c4f){logger[_0xe8a4('0x23')](_0xe8a4('0x1e'),_0xe38c50,_0x370c4f);_0x4c5ad3(_0x370c4f);});});}function respondWithStatusCode(_0x12e593,_0x5c033c){_0x5c033c=_0x5c033c||0xcc;return function(_0x5df32a){if(_0x5df32a){return _0x12e593[_0xe8a4('0x28')](_0x5c033c);}return _0x12e593[_0xe8a4('0x29')](_0x5c033c)['end']();};}function respondWithResult(_0x1f3e75,_0x367912){_0x367912=_0x367912||0xc8;return function(_0xc018f){if(_0xc018f){return _0x1f3e75[_0xe8a4('0x29')](_0x367912)[_0xe8a4('0x2a')](_0xc018f);}};}function respondWithFilteredResult(_0x44f2dd,_0x2be00a){return function(_0x2ed3ab){if(_0x2ed3ab){var _0x6ef4ce=_0x2ed3ab[_0xe8a4('0x2b')],_0x27e132=_0x2be00a[_0xe8a4('0x2c')],_0x1f4410=_0x2be00a[_0xe8a4('0x2c')]+_0x2be00a['limit'],_0x4d69e0;if(_0x1f4410>=_0x6ef4ce){_0x1f4410=_0x6ef4ce;_0x4d69e0=0xc8;}else{_0x4d69e0=0xce;}_0x44f2dd['status'](_0x4d69e0);return _0x44f2dd['set'](_0xe8a4('0x2d'),_0x27e132+'-'+_0x1f4410+'/'+_0x6ef4ce)[_0xe8a4('0x2a')](_0x2ed3ab);}return null;};}function patchUpdates(_0x37886f){return function(_0x7e0b22){try{jsonpatch[_0xe8a4('0x2e')](_0x7e0b22,_0x37886f,!![]);}catch(_0x2e409c){return BPromise['reject'](_0x2e409c);}return _0x7e0b22[_0xe8a4('0x2f')]();};}function saveUpdates(_0x2897e3,_0x46675b){return function(_0x57bfe8){if(_0x57bfe8){return _0x57bfe8[_0xe8a4('0x30')](_0x2897e3)[_0xe8a4('0x1c')](function(_0x89cb24){return _0x89cb24;});}return null;};}function removeEntity(_0x10fab0,_0x66efd2){return function(_0x52f92a){if(_0x52f92a){return _0x52f92a[_0xe8a4('0x31')]()[_0xe8a4('0x1c')](function(){_0x10fab0[_0xe8a4('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cd209,_0x2901b3){return function(_0x561cbf){if(!_0x561cbf){_0x3cd209[_0xe8a4('0x28')](0x194);}return _0x561cbf;};}function handleError(_0x10a5f5,_0x397f51){_0x397f51=_0x397f51||0x1f4;return function(_0x101261){logger[_0xe8a4('0x23')](_0x101261[_0xe8a4('0x32')]);if(_0x101261[_0xe8a4('0x33')]){delete _0x101261[_0xe8a4('0x33')];}_0x10a5f5[_0xe8a4('0x29')](_0x397f51)[_0xe8a4('0x34')](_0x101261);};}exports['index']=function(_0x1262e3,_0x129f10){var _0x58a5cc={},_0x4d91ba={},_0x5773fd={'count':0x0,'rows':[]};var _0x46af34=_[_0xe8a4('0x35')](db[_0xe8a4('0x36')]['rawAttributes'],function(_0x3749bf){return{'name':_0x3749bf['fieldName'],'type':_0x3749bf[_0xe8a4('0x37')]['key']};});_0x4d91ba[_0xe8a4('0x38')]=_[_0xe8a4('0x35')](_0x46af34,_0xe8a4('0x33'));_0x4d91ba[_0xe8a4('0x39')]=_['keys'](_0x1262e3[_0xe8a4('0x39')]);_0x4d91ba[_0xe8a4('0x3a')]=_[_0xe8a4('0x3b')](_0x4d91ba[_0xe8a4('0x38')],_0x4d91ba[_0xe8a4('0x39')]);_0x58a5cc[_0xe8a4('0x3c')]=_[_0xe8a4('0x3b')](_0x4d91ba['model'],qs[_0xe8a4('0x3d')](_0x1262e3[_0xe8a4('0x39')][_0xe8a4('0x3d')]));_0x58a5cc[_0xe8a4('0x3c')]=_0x58a5cc[_0xe8a4('0x3c')][_0xe8a4('0x3e')]?_0x58a5cc['attributes']:_0x4d91ba[_0xe8a4('0x38')];if(!_0x1262e3[_0xe8a4('0x39')]['hasOwnProperty'](_0xe8a4('0x3f'))){_0x58a5cc[_0xe8a4('0x40')]=qs[_0xe8a4('0x40')](_0x1262e3[_0xe8a4('0x39')][_0xe8a4('0x40')]);_0x58a5cc['offset']=qs['offset'](_0x1262e3[_0xe8a4('0x39')][_0xe8a4('0x2c')]);}_0x58a5cc[_0xe8a4('0x41')]=qs[_0xe8a4('0x42')](_0x1262e3['query'][_0xe8a4('0x42')]);_0x58a5cc[_0xe8a4('0x43')]=qs[_0xe8a4('0x3a')](_[_0xe8a4('0x44')](_0x1262e3['query'],_0x4d91ba[_0xe8a4('0x3a')]),_0x46af34);if(_0x1262e3['query'][_0xe8a4('0x45')]){_0x58a5cc[_0xe8a4('0x43')]=_[_0xe8a4('0x46')](_0x58a5cc[_0xe8a4('0x43')],{'$or':_[_0xe8a4('0x35')](_0x46af34,function(_0x325a40){if(_0x325a40[_0xe8a4('0x37')]!==_0xe8a4('0x47')){var _0x3ad761={};_0x3ad761[_0x325a40[_0xe8a4('0x33')]]={'$like':'%'+_0x1262e3[_0xe8a4('0x39')]['filter']+'%'};return _0x3ad761;}})});}_0x58a5cc=_['merge']({},_0x58a5cc,_0x1262e3[_0xe8a4('0x48')]);var _0x327af5={'where':_0x58a5cc[_0xe8a4('0x43')]};return db[_0xe8a4('0x36')][_0xe8a4('0x2b')](_0x327af5)[_0xe8a4('0x1c')](function(_0xb72b22){_0x5773fd[_0xe8a4('0x2b')]=_0xb72b22;if(_0x1262e3[_0xe8a4('0x39')][_0xe8a4('0x49')]){_0x58a5cc[_0xe8a4('0x4a')]=[{'all':!![]}];}return db[_0xe8a4('0x36')][_0xe8a4('0x4b')](_0x58a5cc);})[_0xe8a4('0x1c')](function(_0x2c7cb2){_0x5773fd[_0xe8a4('0x4c')]=_0x2c7cb2;return _0x5773fd;})[_0xe8a4('0x1c')](respondWithFilteredResult(_0x129f10,_0x58a5cc))[_0xe8a4('0x27')](handleError(_0x129f10,null));};exports[_0xe8a4('0x4d')]=function(_0x466fb3,_0x1fc61c){var _0x140129={'raw':![],'where':{'id':_0x466fb3[_0xe8a4('0x4e')]['id']}},_0x51613d={};_0x51613d['model']=_[_0xe8a4('0x4f')](db['SalesforceAccount'][_0xe8a4('0x50')]);_0x51613d[_0xe8a4('0x39')]=_[_0xe8a4('0x4f')](_0x466fb3[_0xe8a4('0x39')]);_0x51613d['filters']=_[_0xe8a4('0x3b')](_0x51613d['model'],_0x51613d[_0xe8a4('0x39')]);_0x140129['attributes']=_[_0xe8a4('0x3b')](_0x51613d[_0xe8a4('0x38')],qs['fields'](_0x466fb3[_0xe8a4('0x39')][_0xe8a4('0x3d')]));_0x140129[_0xe8a4('0x3c')]=_0x140129[_0xe8a4('0x3c')][_0xe8a4('0x3e')]?_0x140129[_0xe8a4('0x3c')]:_0x51613d[_0xe8a4('0x38')];if(_0x466fb3[_0xe8a4('0x39')][_0xe8a4('0x49')]){_0x140129[_0xe8a4('0x4a')]=[{'all':!![]}];}_0x140129=_[_0xe8a4('0x46')]({},_0x140129,_0x466fb3[_0xe8a4('0x48')]);return db[_0xe8a4('0x36')][_0xe8a4('0x51')](_0x140129)[_0xe8a4('0x1c')](handleEntityNotFound(_0x1fc61c,null))[_0xe8a4('0x1c')](respondWithResult(_0x1fc61c,null))[_0xe8a4('0x27')](handleError(_0x1fc61c,null));};exports[_0xe8a4('0x52')]=function(_0x27c1be,_0x2f5c24){return db['SalesforceAccount'][_0xe8a4('0x52')](_0x27c1be[_0xe8a4('0x53')],{})[_0xe8a4('0x1c')](respondWithResult(_0x2f5c24,0xc9))['catch'](handleError(_0x2f5c24,null));};exports[_0xe8a4('0x30')]=function(_0xda5d4,_0x34d7fc){if(_0xda5d4[_0xe8a4('0x53')]['id']){delete _0xda5d4[_0xe8a4('0x53')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0xda5d4[_0xe8a4('0x4e')]['id']}})[_0xe8a4('0x1c')](handleEntityNotFound(_0x34d7fc,null))['then'](saveUpdates(_0xda5d4[_0xe8a4('0x53')],null))['then'](respondWithResult(_0x34d7fc,null))[_0xe8a4('0x27')](handleError(_0x34d7fc,null));};exports['destroy']=function(_0x52bd41,_0x52665a){return db[_0xe8a4('0x36')][_0xe8a4('0x51')]({'where':{'id':_0x52bd41['params']['id']}})[_0xe8a4('0x1c')](handleEntityNotFound(_0x52665a,null))[_0xe8a4('0x1c')](removeEntity(_0x52665a,null))[_0xe8a4('0x27')](handleError(_0x52665a,null));};exports['getConfigurations']=function(_0x3eecc1,_0x13fcd7,_0x254511){var _0x12522d={};var _0x4a0a3e={};var _0x12c597;var _0x508647;return db[_0xe8a4('0x36')][_0xe8a4('0x54')]({'where':{'id':_0x3eecc1['params']['id']}})[_0xe8a4('0x1c')](handleEntityNotFound(_0x13fcd7,null))[_0xe8a4('0x1c')](function(_0x5c26af){if(_0x5c26af){_0x12c597=_0x5c26af;_0x4a0a3e[_0xe8a4('0x38')]=_[_0xe8a4('0x4f')](db[_0xe8a4('0x55')]['rawAttributes']);_0x4a0a3e['query']=_['keys'](_0x3eecc1[_0xe8a4('0x39')]);_0x4a0a3e[_0xe8a4('0x3a')]=_[_0xe8a4('0x3b')](_0x4a0a3e[_0xe8a4('0x38')],_0x4a0a3e[_0xe8a4('0x39')]);_0x12522d['attributes']=_[_0xe8a4('0x3b')](_0x4a0a3e['model'],qs[_0xe8a4('0x3d')](_0x3eecc1['query'][_0xe8a4('0x3d')]));_0x12522d[_0xe8a4('0x3c')]=_0x12522d[_0xe8a4('0x3c')][_0xe8a4('0x3e')]?_0x12522d['attributes']:_0x4a0a3e[_0xe8a4('0x38')];_0x12522d[_0xe8a4('0x41')]=qs['sort'](_0x3eecc1['query']['sort']);_0x12522d[_0xe8a4('0x43')]=qs[_0xe8a4('0x3a')](_[_0xe8a4('0x44')](_0x3eecc1['query'],_0x4a0a3e[_0xe8a4('0x3a')]));if(_0x3eecc1['query'][_0xe8a4('0x45')]){_0x12522d['where']=_['merge'](_0x12522d[_0xe8a4('0x43')],{'$or':_[_0xe8a4('0x35')](_0x12522d[_0xe8a4('0x3c')],function(_0x59c7fe){var _0x5948f5={};_0x5948f5[_0x59c7fe]={'$like':'%'+_0x3eecc1['query'][_0xe8a4('0x45')]+'%'};return _0x5948f5;})});}_0x12522d=_[_0xe8a4('0x46')]({},_0x12522d,_0x3eecc1['options']);return _0x12c597[_0xe8a4('0x56')](_0x12522d);}})[_0xe8a4('0x1c')](function(_0x5a06bd){if(_0x5a06bd){_0x508647=_0x5a06bd['length'];if(!_0x3eecc1['query'][_0xe8a4('0x57')](_0xe8a4('0x3f'))){_0x12522d['limit']=qs[_0xe8a4('0x40')](_0x3eecc1[_0xe8a4('0x39')][_0xe8a4('0x40')]);_0x12522d[_0xe8a4('0x2c')]=qs['offset'](_0x3eecc1[_0xe8a4('0x39')][_0xe8a4('0x2c')]);}return _0x12c597[_0xe8a4('0x56')](_0x12522d);}})[_0xe8a4('0x1c')](function(_0x2d457c){if(_0x2d457c){return _0x2d457c?{'count':_0x508647,'rows':_0x2d457c}:null;}})[_0xe8a4('0x1c')](respondWithResult(_0x13fcd7,null))['catch'](handleError(_0x13fcd7,null));};exports['addConfiguration']=function(_0xd6d7d9,_0x3129c3,_0x1eb05e){if(_0xd6d7d9['body']['id']){delete _0xd6d7d9[_0xe8a4('0x53')]['id'];}return db[_0xe8a4('0x36')][_0xe8a4('0x54')]({'where':{'id':_0xd6d7d9['params']['id']}})[_0xe8a4('0x1c')](handleEntityNotFound(_0x3129c3,null))[_0xe8a4('0x1c')](function(_0x2f49ab){if(_0x2f49ab){_0xd6d7d9['body']['AccountId']=_0x2f49ab['id'];_0xd6d7d9[_0xe8a4('0x53')][_0xe8a4('0x58')]=integrations[_0xe8a4('0x59')](_0xd6d7d9['body'][_0xe8a4('0x5a')],_0xd6d7d9[_0xe8a4('0x53')][_0xe8a4('0x37')]);_0xd6d7d9[_0xe8a4('0x53')][_0xe8a4('0x5b')]=integrations[_0xe8a4('0x5c')](_0xd6d7d9[_0xe8a4('0x53')][_0xe8a4('0x5a')],_0xd6d7d9[_0xe8a4('0x53')][_0xe8a4('0x37')]);return db['SalesforceConfiguration']['create'](_0xd6d7d9[_0xe8a4('0x53')],{'include':[{'model':db[_0xe8a4('0x5d')],'as':_0xe8a4('0x58')},{'model':db[_0xe8a4('0x5d')],'as':_0xe8a4('0x5b')}]});}return null;})[_0xe8a4('0x1c')](respondWithResult(_0x3129c3,null))['catch'](handleError(_0x3129c3,null));};exports[_0xe8a4('0x5e')]=function(_0x19c802,_0x3d8fac,_0x1193fa){var _0x3c71e3;var _0x135c29='';var _0x51c899=_0xe8a4('0x5f');return db[_0xe8a4('0x36')][_0xe8a4('0x54')]({'where':{'id':_0x19c802[_0xe8a4('0x4e')]['id']},'attributes':['id',_0xe8a4('0x60'),_0xe8a4('0x61'),_0xe8a4('0x62'),_0xe8a4('0x63'),_0xe8a4('0x64'),_0xe8a4('0x65')]})['then'](handleEntityNotFound(_0x3d8fac,null))[_0xe8a4('0x1c')](function(_0x5bb224){if(_0x5bb224){_0x135c29=_0x5bb224[_0xe8a4('0x60')];var _0x4ac6ab=_0x135c29[_0xe8a4('0x66')](-0x1);if(_0x4ac6ab==='/'){_0x135c29=_0x135c29['substring'](0x0,_0x135c29[_0xe8a4('0x67')](_0x4ac6ab));}_0x3c71e3=new jsforce['Connection']({'oauth2':{'loginUrl':_0x135c29,'clientId':_0x5bb224[_0xe8a4('0x61')],'clientSecret':_0x5bb224[_0xe8a4('0x62')]}});return _0x3c71e3['login'](_0x5bb224[_0xe8a4('0x63')],_0x5bb224['password'][_0xe8a4('0x68')](_0x5bb224['securityToken']));}})[_0xe8a4('0x1c')](function(_0x1c855c){if(_0x1c855c){if(!_[_0xe8a4('0x69')](_0x19c802['query'][_0xe8a4('0x6a')])){_0x51c899=_0x19c802[_0xe8a4('0x39')]['ticketType'];}return _0x3c71e3['sobject'](_0x51c899)[_0xe8a4('0x6b')]();}})[_0xe8a4('0x1c')](function(_0x383fd5){var _0x16d7f2=['OwnerId',_0xe8a4('0x6c'),_0xe8a4('0x6d'),_0xe8a4('0x6e'),_0xe8a4('0x6f'),'Description'];var _0x2ae3e1=[_0xe8a4('0x70'),_0xe8a4('0x71'),_0xe8a4('0x72'),_0xe8a4('0x73'),_0xe8a4('0x74'),_0xe8a4('0x75'),_0xe8a4('0x76')];if(_0x383fd5){_['remove'](_0x383fd5['fields'],function(_0x3d8b6a){return _0x16d7f2[_0xe8a4('0x77')](_0x3d8b6a[_0xe8a4('0x33')])||!_0x2ae3e1[_0xe8a4('0x77')](_0x3d8b6a[_0xe8a4('0x37')]);});return{'count':_0x383fd5[_0xe8a4('0x3d')][_0xe8a4('0x3e')],'rows':_[_0xe8a4('0x35')](_0x383fd5[_0xe8a4('0x3d')],function(_0x38dc1a){return{'id':_0x38dc1a[_0xe8a4('0x33')],'name':_0x38dc1a[_0xe8a4('0x78')],'custom':_0x38dc1a['custom'],'options':_0x38dc1a[_0xe8a4('0x79')][_0xe8a4('0x3e')]>0x0?_[_0xe8a4('0x35')](_0x38dc1a[_0xe8a4('0x79')],function(_0x344e17){return{'name':_0x344e17[_0xe8a4('0x78')],'value':_0x344e17[_0xe8a4('0x7a')]};}):_0x38dc1a[_0xe8a4('0x37')]==_0xe8a4('0x73')?[{'name':_0xe8a4('0x7b'),'value':'true'},{'name':_0xe8a4('0x7c'),'value':_0xe8a4('0x7d')}]:[]};})};}})[_0xe8a4('0x1c')](respondWithResult(_0x3d8fac,null))[_0xe8a4('0x27')](function(_0x39e630){var _0x3a9fb4=_0x19c802['query'][_0xe8a4('0x7e')]?0x1f4:_0x39e630[_0xe8a4('0x7f')]||0x1f4;logger[_0xe8a4('0x23')](_0xe8a4('0x80'),_0xe8a4('0x5e'),_0x3a9fb4,JSON[_0xe8a4('0x22')](_0x39e630));delete _0x39e630['name'];if(_0x3a9fb4===0x191){_0x3a9fb4=0x190;}_0x3d8fac[_0xe8a4('0x29')](_0x3a9fb4)['send'](_0x19c802[_0xe8a4('0x39')]['test']?{'message':_0xe8a4('0x81'),'statusCode':_0x39e630[_0xe8a4('0x7f')]}:_0x39e630);});}; \ No newline at end of file +var _0x71ad=['reject','save','update','destroy','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','then','rows','show','params','include','find','create','body','SalesforceConfiguration','nolimit','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','Task','clientId','clientSecret','username','password','securityToken','lastIndexOf','login','concat','isNil','ticketType','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','email','remove','includes','label','custom','value','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x71ad,0x1db));var _0xd71a=function(_0x4501a4,_0x44770a){_0x4501a4=_0x4501a4-0x0;var _0x25986e=_0x71ad[_0x4501a4];return _0x25986e;};'use strict';var pdf=require(_0xd71a('0x0'));var emlformat=require(_0xd71a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd71a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd71a('0x3'));var moment=require(_0xd71a('0x4'));var BPromise=require(_0xd71a('0x5'));var Mustache=require(_0xd71a('0x6'));var util=require(_0xd71a('0x7'));var path=require(_0xd71a('0x8'));var sox=require(_0xd71a('0x9'));var csv=require(_0xd71a('0xa'));var ejs=require(_0xd71a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd71a('0xc'));var deskjs=require(_0xd71a('0xd'));var toCsv=require(_0xd71a('0xa'));var querystring=require(_0xd71a('0xe'));var Papa=require(_0xd71a('0xf'));var Redis=require(_0xd71a('0x10'));var authService=require(_0xd71a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd71a('0x12'))('api');var utils=require(_0xd71a('0x13'));var config=require(_0xd71a('0x14'));var licenseUtil=require(_0xd71a('0x15'));var db=require(_0xd71a('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xd71a('0x17'));var client=jayson[_0xd71a('0x18')][_0xd71a('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x33a3f1,_0xd57742,_0x2a36f7,_0x1d5e91){return new BPromise(function(_0x10af8b,_0x43f6db){var _0x42e14d=_0x1d5e91||client;return _0x42e14d[_0xd71a('0x1a')](_0x33a3f1,_0x2a36f7)['then'](function(_0x3103f2){logger[_0xd71a('0x1b')](_0xd71a('0x1c'),_0xd57742,'request\x20sent');logger[_0xd71a('0x1d')](_0xd71a('0x1e'),_0xd57742,_0xd71a('0x1f'),JSON['stringify'](_0x3103f2));if(_0x3103f2['error']){if(_0x3103f2['error'][_0xd71a('0x20')]===0x1f4){logger[_0xd71a('0x21')]('SalesforceAccount,\x20%s,\x20%s',_0xd57742,_0x3103f2[_0xd71a('0x21')][_0xd71a('0x22')]);return _0x43f6db(_0x3103f2[_0xd71a('0x21')][_0xd71a('0x22')]);}logger[_0xd71a('0x21')]('SalesforceAccount,\x20%s,\x20%s',_0xd57742,_0x3103f2[_0xd71a('0x21')][_0xd71a('0x22')]);return _0x10af8b(_0x3103f2[_0xd71a('0x21')]['message']);}else{logger[_0xd71a('0x1b')](_0xd71a('0x1c'),_0xd57742,_0xd71a('0x1f'));_0x10af8b(_0x3103f2[_0xd71a('0x23')]['message']);}})[_0xd71a('0x24')](function(_0x28a148){logger[_0xd71a('0x21')](_0xd71a('0x1c'),_0xd57742,_0x28a148);_0x43f6db(_0x28a148);});});}function respondWithStatusCode(_0xe6f31f,_0x29ccf3){_0x29ccf3=_0x29ccf3||0xcc;return function(_0x3368a9){if(_0x3368a9){return _0xe6f31f[_0xd71a('0x25')](_0x29ccf3);}return _0xe6f31f[_0xd71a('0x26')](_0x29ccf3)[_0xd71a('0x27')]();};}function respondWithResult(_0x5ec374,_0x9e65d2){_0x9e65d2=_0x9e65d2||0xc8;return function(_0x1b2ada){if(_0x1b2ada){return _0x5ec374[_0xd71a('0x26')](_0x9e65d2)[_0xd71a('0x28')](_0x1b2ada);}};}function respondWithFilteredResult(_0x1c56fe,_0x4096a9){return function(_0x1099af){if(_0x1099af){var _0x2e5aac=_0x1099af[_0xd71a('0x29')],_0x1e9609=_0x4096a9[_0xd71a('0x2a')],_0x693ea2=_0x4096a9['offset']+_0x4096a9[_0xd71a('0x2b')],_0x20a39c;if(_0x693ea2>=_0x2e5aac){_0x693ea2=_0x2e5aac;_0x20a39c=0xc8;}else{_0x20a39c=0xce;}_0x1c56fe[_0xd71a('0x26')](_0x20a39c);return _0x1c56fe[_0xd71a('0x2c')]('Content-Range',_0x1e9609+'-'+_0x693ea2+'/'+_0x2e5aac)[_0xd71a('0x28')](_0x1099af);}return null;};}function patchUpdates(_0x487272){return function(_0x29175e){try{jsonpatch['apply'](_0x29175e,_0x487272,!![]);}catch(_0x45f306){return BPromise[_0xd71a('0x2d')](_0x45f306);}return _0x29175e[_0xd71a('0x2e')]();};}function saveUpdates(_0x4dead7,_0x30b09c){return function(_0x597aa1){if(_0x597aa1){return _0x597aa1[_0xd71a('0x2f')](_0x4dead7)['then'](function(_0x59d03c){return _0x59d03c;});}return null;};}function removeEntity(_0x2072e2,_0x48b8f1){return function(_0x463c69){if(_0x463c69){return _0x463c69[_0xd71a('0x30')]()['then'](function(){_0x2072e2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x140ba3,_0x112af1){return function(_0x36bddd){if(!_0x36bddd){_0x140ba3['sendStatus'](0x194);}return _0x36bddd;};}function handleError(_0x38c5f7,_0xbc8be1){_0xbc8be1=_0xbc8be1||0x1f4;return function(_0x48292f){logger[_0xd71a('0x21')](_0x48292f[_0xd71a('0x31')]);if(_0x48292f['name']){delete _0x48292f[_0xd71a('0x32')];}_0x38c5f7[_0xd71a('0x26')](_0xbc8be1)['send'](_0x48292f);};}exports[_0xd71a('0x33')]=function(_0x11e65d,_0xc10031){var _0x4abd0d={},_0x3ca09e={},_0x47fa83={'count':0x0,'rows':[]};var _0x59d84d=_[_0xd71a('0x34')](db[_0xd71a('0x35')][_0xd71a('0x36')],function(_0x1a88b8){return{'name':_0x1a88b8[_0xd71a('0x37')],'type':_0x1a88b8[_0xd71a('0x38')][_0xd71a('0x39')]};});_0x3ca09e['model']=_[_0xd71a('0x34')](_0x59d84d,_0xd71a('0x32'));_0x3ca09e[_0xd71a('0x3a')]=_[_0xd71a('0x3b')](_0x11e65d['query']);_0x3ca09e['filters']=_[_0xd71a('0x3c')](_0x3ca09e['model'],_0x3ca09e['query']);_0x4abd0d[_0xd71a('0x3d')]=_[_0xd71a('0x3c')](_0x3ca09e[_0xd71a('0x3e')],qs[_0xd71a('0x3f')](_0x11e65d[_0xd71a('0x3a')][_0xd71a('0x3f')]));_0x4abd0d[_0xd71a('0x3d')]=_0x4abd0d[_0xd71a('0x3d')][_0xd71a('0x40')]?_0x4abd0d[_0xd71a('0x3d')]:_0x3ca09e['model'];if(!_0x11e65d[_0xd71a('0x3a')]['hasOwnProperty']('nolimit')){_0x4abd0d['limit']=qs[_0xd71a('0x2b')](_0x11e65d[_0xd71a('0x3a')][_0xd71a('0x2b')]);_0x4abd0d[_0xd71a('0x2a')]=qs[_0xd71a('0x2a')](_0x11e65d[_0xd71a('0x3a')]['offset']);}_0x4abd0d[_0xd71a('0x41')]=qs['sort'](_0x11e65d[_0xd71a('0x3a')][_0xd71a('0x42')]);_0x4abd0d[_0xd71a('0x43')]=qs['filters'](_[_0xd71a('0x44')](_0x11e65d['query'],_0x3ca09e[_0xd71a('0x45')]),_0x59d84d);if(_0x11e65d['query'][_0xd71a('0x46')]){_0x4abd0d['where']=_[_0xd71a('0x47')](_0x4abd0d[_0xd71a('0x43')],{'$or':_[_0xd71a('0x34')](_0x59d84d,function(_0x198761){if(_0x198761[_0xd71a('0x38')]!==_0xd71a('0x48')){var _0x5a52d1={};_0x5a52d1[_0x198761[_0xd71a('0x32')]]={'$like':'%'+_0x11e65d[_0xd71a('0x3a')][_0xd71a('0x46')]+'%'};return _0x5a52d1;}})});}_0x4abd0d=_[_0xd71a('0x47')]({},_0x4abd0d,_0x11e65d[_0xd71a('0x49')]);var _0x58ee13={'where':_0x4abd0d[_0xd71a('0x43')]};return db[_0xd71a('0x35')]['count'](_0x58ee13)['then'](function(_0x4dec14){_0x47fa83[_0xd71a('0x29')]=_0x4dec14;if(_0x11e65d[_0xd71a('0x3a')][_0xd71a('0x4a')]){_0x4abd0d['include']=[{'all':!![]}];}return db[_0xd71a('0x35')][_0xd71a('0x4b')](_0x4abd0d);})[_0xd71a('0x4c')](function(_0x3724ed){_0x47fa83[_0xd71a('0x4d')]=_0x3724ed;return _0x47fa83;})[_0xd71a('0x4c')](respondWithFilteredResult(_0xc10031,_0x4abd0d))[_0xd71a('0x24')](handleError(_0xc10031,null));};exports[_0xd71a('0x4e')]=function(_0x3bb76c,_0x1d4bd9){var _0x3fb947={'raw':![],'where':{'id':_0x3bb76c[_0xd71a('0x4f')]['id']}},_0x102633={};_0x102633[_0xd71a('0x3e')]=_[_0xd71a('0x3b')](db['SalesforceAccount'][_0xd71a('0x36')]);_0x102633[_0xd71a('0x3a')]=_[_0xd71a('0x3b')](_0x3bb76c['query']);_0x102633[_0xd71a('0x45')]=_[_0xd71a('0x3c')](_0x102633[_0xd71a('0x3e')],_0x102633[_0xd71a('0x3a')]);_0x3fb947[_0xd71a('0x3d')]=_[_0xd71a('0x3c')](_0x102633[_0xd71a('0x3e')],qs[_0xd71a('0x3f')](_0x3bb76c[_0xd71a('0x3a')][_0xd71a('0x3f')]));_0x3fb947[_0xd71a('0x3d')]=_0x3fb947['attributes']['length']?_0x3fb947[_0xd71a('0x3d')]:_0x102633[_0xd71a('0x3e')];if(_0x3bb76c['query'][_0xd71a('0x4a')]){_0x3fb947[_0xd71a('0x50')]=[{'all':!![]}];}_0x3fb947=_['merge']({},_0x3fb947,_0x3bb76c[_0xd71a('0x49')]);return db[_0xd71a('0x35')][_0xd71a('0x51')](_0x3fb947)[_0xd71a('0x4c')](handleEntityNotFound(_0x1d4bd9,null))[_0xd71a('0x4c')](respondWithResult(_0x1d4bd9,null))[_0xd71a('0x24')](handleError(_0x1d4bd9,null));};exports['create']=function(_0x32fc24,_0x3f6e6a){return db[_0xd71a('0x35')][_0xd71a('0x52')](_0x32fc24[_0xd71a('0x53')],{})[_0xd71a('0x4c')](respondWithResult(_0x3f6e6a,0xc9))[_0xd71a('0x24')](handleError(_0x3f6e6a,null));};exports[_0xd71a('0x2f')]=function(_0x4cd427,_0x1111db){if(_0x4cd427['body']['id']){delete _0x4cd427[_0xd71a('0x53')]['id'];}return db['SalesforceAccount'][_0xd71a('0x51')]({'where':{'id':_0x4cd427[_0xd71a('0x4f')]['id']}})[_0xd71a('0x4c')](handleEntityNotFound(_0x1111db,null))[_0xd71a('0x4c')](saveUpdates(_0x4cd427['body'],null))[_0xd71a('0x4c')](respondWithResult(_0x1111db,null))['catch'](handleError(_0x1111db,null));};exports[_0xd71a('0x30')]=function(_0x3e8751,_0x5da8e3){return db[_0xd71a('0x35')]['find']({'where':{'id':_0x3e8751[_0xd71a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5da8e3,null))[_0xd71a('0x4c')](removeEntity(_0x5da8e3,null))['catch'](handleError(_0x5da8e3,null));};exports['getConfigurations']=function(_0x1f05a0,_0x522290,_0x711eb9){var _0x473b13={};var _0x465e26={};var _0x382023;var _0x7b59b1;return db[_0xd71a('0x35')]['findOne']({'where':{'id':_0x1f05a0['params']['id']}})['then'](handleEntityNotFound(_0x522290,null))['then'](function(_0x11e3f0){if(_0x11e3f0){_0x382023=_0x11e3f0;_0x465e26[_0xd71a('0x3e')]=_[_0xd71a('0x3b')](db[_0xd71a('0x54')][_0xd71a('0x36')]);_0x465e26[_0xd71a('0x3a')]=_[_0xd71a('0x3b')](_0x1f05a0['query']);_0x465e26[_0xd71a('0x45')]=_[_0xd71a('0x3c')](_0x465e26[_0xd71a('0x3e')],_0x465e26[_0xd71a('0x3a')]);_0x473b13[_0xd71a('0x3d')]=_[_0xd71a('0x3c')](_0x465e26[_0xd71a('0x3e')],qs[_0xd71a('0x3f')](_0x1f05a0[_0xd71a('0x3a')][_0xd71a('0x3f')]));_0x473b13[_0xd71a('0x3d')]=_0x473b13['attributes'][_0xd71a('0x40')]?_0x473b13[_0xd71a('0x3d')]:_0x465e26[_0xd71a('0x3e')];_0x473b13[_0xd71a('0x41')]=qs[_0xd71a('0x42')](_0x1f05a0[_0xd71a('0x3a')][_0xd71a('0x42')]);_0x473b13[_0xd71a('0x43')]=qs['filters'](_[_0xd71a('0x44')](_0x1f05a0[_0xd71a('0x3a')],_0x465e26[_0xd71a('0x45')]));if(_0x1f05a0[_0xd71a('0x3a')][_0xd71a('0x46')]){_0x473b13[_0xd71a('0x43')]=_['merge'](_0x473b13[_0xd71a('0x43')],{'$or':_['map'](_0x473b13[_0xd71a('0x3d')],function(_0x1cb81f){var _0x312f99={};_0x312f99[_0x1cb81f]={'$like':'%'+_0x1f05a0[_0xd71a('0x3a')][_0xd71a('0x46')]+'%'};return _0x312f99;})});}_0x473b13=_[_0xd71a('0x47')]({},_0x473b13,_0x1f05a0[_0xd71a('0x49')]);return _0x382023['getConfigurations'](_0x473b13);}})[_0xd71a('0x4c')](function(_0x3f3615){if(_0x3f3615){_0x7b59b1=_0x3f3615[_0xd71a('0x40')];if(!_0x1f05a0['query']['hasOwnProperty'](_0xd71a('0x55'))){_0x473b13[_0xd71a('0x2b')]=qs[_0xd71a('0x2b')](_0x1f05a0[_0xd71a('0x3a')][_0xd71a('0x2b')]);_0x473b13['offset']=qs['offset'](_0x1f05a0['query']['offset']);}return _0x382023[_0xd71a('0x56')](_0x473b13);}})['then'](function(_0x5e17b2){if(_0x5e17b2){return _0x5e17b2?{'count':_0x7b59b1,'rows':_0x5e17b2}:null;}})[_0xd71a('0x4c')](respondWithResult(_0x522290,null))[_0xd71a('0x24')](handleError(_0x522290,null));};exports['addConfiguration']=function(_0x9d7f44,_0x26efa4,_0x2771b2){if(_0x9d7f44[_0xd71a('0x53')]['id']){delete _0x9d7f44[_0xd71a('0x53')]['id'];}return db[_0xd71a('0x35')][_0xd71a('0x57')]({'where':{'id':_0x9d7f44['params']['id']}})[_0xd71a('0x4c')](handleEntityNotFound(_0x26efa4,null))[_0xd71a('0x4c')](function(_0x5e7388){if(_0x5e7388){_0x9d7f44[_0xd71a('0x53')][_0xd71a('0x58')]=_0x5e7388['id'];_0x9d7f44[_0xd71a('0x53')][_0xd71a('0x59')]=integrations[_0xd71a('0x5a')](_0x9d7f44[_0xd71a('0x53')][_0xd71a('0x5b')],_0x9d7f44[_0xd71a('0x53')][_0xd71a('0x38')]);_0x9d7f44['body']['Descriptions']=integrations[_0xd71a('0x5c')](_0x9d7f44['body'][_0xd71a('0x5b')],_0x9d7f44[_0xd71a('0x53')][_0xd71a('0x38')]);return db[_0xd71a('0x54')]['create'](_0x9d7f44[_0xd71a('0x53')],{'include':[{'model':db[_0xd71a('0x5d')],'as':_0xd71a('0x59')},{'model':db[_0xd71a('0x5d')],'as':_0xd71a('0x5e')}]});}return null;})['then'](respondWithResult(_0x26efa4,null))['catch'](handleError(_0x26efa4,null));};exports[_0xd71a('0x5f')]=function(_0x4c4f9d,_0x515814,_0x2e7fad){var _0x1b502c;var _0x16e9d5='';var _0x36a251=_0xd71a('0x60');return db['SalesforceAccount'][_0xd71a('0x57')]({'where':{'id':_0x4c4f9d[_0xd71a('0x4f')]['id']},'attributes':['id','remoteUri',_0xd71a('0x61'),_0xd71a('0x62'),_0xd71a('0x63'),_0xd71a('0x64'),_0xd71a('0x65')]})['then'](handleEntityNotFound(_0x515814,null))[_0xd71a('0x4c')](function(_0x39748d){if(_0x39748d){_0x16e9d5=_0x39748d['remoteUri'];var _0x147c59=_0x16e9d5['slice'](-0x1);if(_0x147c59==='/'){_0x16e9d5=_0x16e9d5['substring'](0x0,_0x16e9d5[_0xd71a('0x66')](_0x147c59));}_0x1b502c=new jsforce['Connection']({'oauth2':{'loginUrl':_0x16e9d5,'clientId':_0x39748d[_0xd71a('0x61')],'clientSecret':_0x39748d[_0xd71a('0x62')]}});return _0x1b502c[_0xd71a('0x67')](_0x39748d[_0xd71a('0x63')],_0x39748d['password'][_0xd71a('0x68')](_0x39748d['securityToken']));}})[_0xd71a('0x4c')](function(_0x9d906e){if(_0x9d906e){if(!_[_0xd71a('0x69')](_0x4c4f9d['query'][_0xd71a('0x6a')])){_0x36a251=_0x4c4f9d[_0xd71a('0x3a')][_0xd71a('0x6a')];}return _0x1b502c['sobject'](_0x36a251)[_0xd71a('0x6b')]();}})['then'](function(_0x1114e3){var _0x4f8c96=[_0xd71a('0x6c'),'ActivityDate',_0xd71a('0x6d'),_0xd71a('0x6e'),_0xd71a('0x6f'),_0xd71a('0x70')];var _0x3e92a7=[_0xd71a('0x71'),_0xd71a('0x72'),_0xd71a('0x73'),'boolean',_0xd71a('0x74'),'textarea','phone'];if(_0x1114e3){_[_0xd71a('0x75')](_0x1114e3[_0xd71a('0x3f')],function(_0x3f1b58){return _0x4f8c96['includes'](_0x3f1b58[_0xd71a('0x32')])||!_0x3e92a7[_0xd71a('0x76')](_0x3f1b58['type']);});return{'count':_0x1114e3[_0xd71a('0x3f')][_0xd71a('0x40')],'rows':_[_0xd71a('0x34')](_0x1114e3[_0xd71a('0x3f')],function(_0x3659e3){return{'id':_0x3659e3[_0xd71a('0x32')],'name':_0x3659e3[_0xd71a('0x77')],'custom':_0x3659e3[_0xd71a('0x78')],'options':_0x3659e3['picklistValues'][_0xd71a('0x40')]>0x0?_['map'](_0x3659e3['picklistValues'],function(_0x3f0f09){return{'name':_0x3f0f09[_0xd71a('0x77')],'value':_0x3f0f09[_0xd71a('0x79')]};}):_0x3659e3[_0xd71a('0x38')]=='boolean'?[{'name':'True','value':'true'},{'name':_0xd71a('0x7a'),'value':_0xd71a('0x7b')}]:[]};})};}})[_0xd71a('0x4c')](respondWithResult(_0x515814,null))[_0xd71a('0x24')](function(_0x24d1fe){var _0x496efc=_0x4c4f9d['query'][_0xd71a('0x7c')]?0x1f4:_0x24d1fe[_0xd71a('0x7d')]||0x1f4;logger[_0xd71a('0x21')](_0xd71a('0x7e'),'getFields',_0x496efc,JSON[_0xd71a('0x7f')](_0x24d1fe));delete _0x24d1fe['name'];if(_0x496efc===0x191){_0x496efc=0x190;}_0x515814['status'](_0x496efc)[_0xd71a('0x80')](_0x4c4f9d[_0xd71a('0x3a')][_0xd71a('0x7c')]?{'message':_0xd71a('0x81'),'statusCode':_0x24d1fe[_0xd71a('0x7d')]}:_0x24d1fe);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 51820b8..86147a7 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 _0x4722=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','SalesforceAccount','int_salesforce_accounts'];(function(_0x355e43,_0x3d46b0){var _0x43a9a2=function(_0x5217e8){while(--_0x5217e8){_0x355e43['push'](_0x355e43['shift']());}};_0x43a9a2(++_0x3d46b0);}(_0x4722,0xaa));var _0x2472=function(_0x50a1dc,_0x44325b){_0x50a1dc=_0x50a1dc-0x0;var _0x3d31e4=_0x4722[_0x50a1dc];return _0x3d31e4;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2472('0x0'));var moment=require(_0x2472('0x1'));var BPromise=require(_0x2472('0x2'));var rp=require(_0x2472('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2472('0x4'));var config=require(_0x2472('0x5'));var attributes=require(_0x2472('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x2472('0x7')]=function(_0x46e44a,_0x4a20f9){return _0x46e44a['define'](_0x2472('0x8'),attributes,{'tableName':_0x2472('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x810d=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','define','SalesforceAccount'];(function(_0x2c9681,_0x289c64){var _0x30f46e=function(_0xf02d6){while(--_0xf02d6){_0x2c9681['push'](_0x2c9681['shift']());}};_0x30f46e(++_0x289c64);}(_0x810d,0x75));var _0xd810=function(_0x228a15,_0x5c411b){_0x228a15=_0x228a15-0x0;var _0x50c9f5=_0x810d[_0x228a15];return _0x50c9f5;};'use strict';var _=require(_0xd810('0x0'));var util=require(_0xd810('0x1'));var logger=require('../../config/logger')(_0xd810('0x2'));var moment=require(_0xd810('0x3'));var BPromise=require(_0xd810('0x4'));var rp=require(_0xd810('0x5'));var fs=require('fs');var path=require(_0xd810('0x6'));var rimraf=require(_0xd810('0x7'));var config=require(_0xd810('0x8'));var attributes=require(_0xd810('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xd810('0xa')]=function(_0x54ef30,_0x36d567){return _0x54ef30[_0xd810('0xb')](_0xd810('0xc'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index e0a55bf..83c5ed8 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 _0xf290=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetSalesforceAccount','findAll','options','raw','where','map','include','model','attributes','stringify','SalesforceAccount','ShowSalesforceAccount','util','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf290,0xde));var _0x0f29=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xf290[_0xd09668];return _0x68726;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var moment=require('moment');var BPromise=require(_0x0f29('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f29('0x2'));var db=require(_0x0f29('0x3'))['db'];var utils=require(_0x0f29('0x4'));var logger=require(_0x0f29('0x5'))(_0x0f29('0x6'));var config=require('../../config/environment');var jayson=require(_0x0f29('0x7'));var client=jayson['client'][_0x0f29('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c45ec,_0x355e21,_0xaa2675){return new BPromise(function(_0xc78ca2,_0x45350b){return client[_0x0f29('0x9')](_0x1c45ec,_0xaa2675)[_0x0f29('0xa')](function(_0x376de4){logger[_0x0f29('0xb')](_0x0f29('0xc'),_0x355e21,_0x0f29('0xd'));logger[_0x0f29('0xe')](_0x0f29('0xf'),_0x355e21,_0x0f29('0xd'),JSON['stringify'](_0x376de4));if(_0x376de4[_0x0f29('0x10')]){if(_0x376de4['error'][_0x0f29('0x11')]===0x1f4){logger[_0x0f29('0x10')](_0x0f29('0xc'),_0x355e21,_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);return _0x45350b(_0x376de4[_0x0f29('0x10')]['message']);}logger[_0x0f29('0x10')](_0x0f29('0xc'),_0x355e21,_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);return _0xc78ca2(_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);}else{logger[_0x0f29('0xb')](_0x0f29('0xc'),_0x355e21,'request\x20sent');_0xc78ca2(_0x376de4['result'][_0x0f29('0x12')]);}})[_0x0f29('0x13')](function(_0x38031e){logger[_0x0f29('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x355e21,_0x38031e);_0x45350b(_0x38031e);});});}exports[_0x0f29('0x14')]=function(_0x5d72a5){var _0x17b994=this;return new Promise(function(_0x4ca5e8,_0x5ddc74){return db['SalesforceAccount'][_0x0f29('0x15')]({'raw':_0x5d72a5[_0x0f29('0x16')]?_0x5d72a5[_0x0f29('0x16')][_0x0f29('0x17')]===undefined?!![]:![]:!![],'where':_0x5d72a5[_0x0f29('0x16')]?_0x5d72a5[_0x0f29('0x16')][_0x0f29('0x18')]||null:null,'attributes':_0x5d72a5['options']?_0x5d72a5[_0x0f29('0x16')]['attributes']||null:null,'limit':_0x5d72a5['options']?_0x5d72a5['options']['limit']||null:null,'include':_0x5d72a5[_0x0f29('0x16')]?_0x5d72a5[_0x0f29('0x16')]['include']?_[_0x0f29('0x19')](_0x5d72a5[_0x0f29('0x16')][_0x0f29('0x1a')],function(_0x3402dc){return{'model':db[_0x3402dc[_0x0f29('0x1b')]],'as':_0x3402dc['as'],'attributes':_0x3402dc['attributes'],'include':_0x3402dc[_0x0f29('0x1a')]?_['map'](_0x3402dc[_0x0f29('0x1a')],function(_0x26f46f){return{'model':db[_0x26f46f[_0x0f29('0x1b')]],'as':_0x26f46f['as'],'attributes':_0x26f46f[_0x0f29('0x1c')],'include':_0x26f46f['include']?_[_0x0f29('0x19')](_0x26f46f['include'],function(_0x58b201){return{'model':db[_0x58b201[_0x0f29('0x1b')]],'as':_0x58b201['as'],'attributes':_0x58b201['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x57dcc7){logger['info'](_0x0f29('0x14'),_0x5d72a5);logger[_0x0f29('0xe')]('GetSalesforceAccount',_0x5d72a5,JSON[_0x0f29('0x1d')](_0x57dcc7));_0x4ca5e8(_0x57dcc7);})[_0x0f29('0x13')](function(_0x274c9d){logger['error']('GetSalesforceAccount',_0x274c9d[_0x0f29('0x12')],_0x5d72a5);_0x5ddc74(_0x17b994['error'](0x1f4,_0x274c9d[_0x0f29('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0x526364){var _0x7b10f=this;return new Promise(function(_0x409b19,_0xf59431){return db[_0x0f29('0x1e')]['find']({'raw':_0x526364['options']?_0x526364[_0x0f29('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x526364['options']?_0x526364[_0x0f29('0x16')]['where']||null:null,'attributes':_0x526364[_0x0f29('0x16')]?_0x526364['options']['attributes']||null:null,'include':_0x526364[_0x0f29('0x16')]?_0x526364[_0x0f29('0x16')][_0x0f29('0x1a')]?_[_0x0f29('0x19')](_0x526364[_0x0f29('0x16')]['include'],function(_0x426a3e){return{'model':db[_0x426a3e['model']],'as':_0x426a3e['as'],'attributes':_0x426a3e[_0x0f29('0x1c')],'include':_0x426a3e[_0x0f29('0x1a')]?_[_0x0f29('0x19')](_0x426a3e[_0x0f29('0x1a')],function(_0x4852a5){return{'model':db[_0x4852a5[_0x0f29('0x1b')]],'as':_0x4852a5['as'],'attributes':_0x4852a5[_0x0f29('0x1c')],'include':_0x4852a5['include']?_[_0x0f29('0x19')](_0x4852a5[_0x0f29('0x1a')],function(_0x5e40ac){return{'model':db[_0x5e40ac['model']],'as':_0x5e40ac['as'],'attributes':_0x5e40ac[_0x0f29('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0f29('0xa')](function(_0x3691d4){logger[_0x0f29('0xb')](_0x0f29('0x1f'),_0x526364);logger[_0x0f29('0xe')]('ShowSalesforceAccount',_0x526364,JSON[_0x0f29('0x1d')](_0x3691d4));_0x409b19(_0x3691d4);})['catch'](function(_0x331dc7){logger['error'](_0x0f29('0x1f'),_0x331dc7[_0x0f29('0x12')],_0x526364);_0xf59431(_0x7b10f[_0x0f29('0x10')](0x1f4,_0x331dc7['message']));});});}; \ No newline at end of file +var _0xe14d=['catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','limit','include','map','model','ShowSalesforceAccount','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','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','code','message','result'];(function(_0x43b616,_0xb842c){var _0xc188db=function(_0x2faaf5){while(--_0x2faaf5){_0x43b616['push'](_0x43b616['shift']());}};_0xc188db(++_0xb842c);}(_0xe14d,0x1ee));var _0xde14=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xe14d[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});}exports[_0xde14('0x19')]=function(_0x3cc317){var _0x10c4ab=this;return new Promise(function(_0x590a8b,_0x3f5fcf){return db[_0xde14('0x1a')][_0xde14('0x1b')]({'raw':_0x3cc317[_0xde14('0x1c')]?_0x3cc317['options'][_0xde14('0x1d')]===undefined?!![]:![]:!![],'where':_0x3cc317['options']?_0x3cc317[_0xde14('0x1c')]['where']||null:null,'attributes':_0x3cc317[_0xde14('0x1c')]?_0x3cc317[_0xde14('0x1c')][_0xde14('0x1e')]||null:null,'limit':_0x3cc317[_0xde14('0x1c')]?_0x3cc317[_0xde14('0x1c')][_0xde14('0x1f')]||null:null,'include':_0x3cc317[_0xde14('0x1c')]?_0x3cc317[_0xde14('0x1c')][_0xde14('0x20')]?_[_0xde14('0x21')](_0x3cc317[_0xde14('0x1c')][_0xde14('0x20')],function(_0x8f8033){return{'model':db[_0x8f8033['model']],'as':_0x8f8033['as'],'attributes':_0x8f8033[_0xde14('0x1e')],'include':_0x8f8033[_0xde14('0x20')]?_[_0xde14('0x21')](_0x8f8033[_0xde14('0x20')],function(_0x1bb7be){return{'model':db[_0x1bb7be[_0xde14('0x22')]],'as':_0x1bb7be['as'],'attributes':_0x1bb7be[_0xde14('0x1e')],'include':_0x1bb7be[_0xde14('0x20')]?_[_0xde14('0x21')](_0x1bb7be[_0xde14('0x20')],function(_0x4eff65){return{'model':db[_0x4eff65[_0xde14('0x22')]],'as':_0x4eff65['as'],'attributes':_0x4eff65[_0xde14('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xde14('0xd')](function(_0xf8279a){logger['info'](_0xde14('0x19'),_0x3cc317);logger[_0xde14('0x10')](_0xde14('0x19'),_0x3cc317,JSON['stringify'](_0xf8279a));_0x590a8b(_0xf8279a);})[_0xde14('0x18')](function(_0x582537){logger[_0xde14('0x14')](_0xde14('0x19'),_0x582537[_0xde14('0x16')],_0x3cc317);_0x3f5fcf(_0x10c4ab[_0xde14('0x14')](0x1f4,_0x582537[_0xde14('0x16')]));});});};exports[_0xde14('0x23')]=function(_0xae9dca){var _0x464666=this;return new Promise(function(_0x4e7c5b,_0xbfc01b){return db[_0xde14('0x1a')]['find']({'raw':_0xae9dca[_0xde14('0x1c')]?_0xae9dca['options'][_0xde14('0x1d')]===undefined?!![]:![]:!![],'where':_0xae9dca[_0xde14('0x1c')]?_0xae9dca[_0xde14('0x1c')][_0xde14('0x24')]||null:null,'attributes':_0xae9dca[_0xde14('0x1c')]?_0xae9dca['options'][_0xde14('0x1e')]||null:null,'include':_0xae9dca[_0xde14('0x1c')]?_0xae9dca['options'][_0xde14('0x20')]?_[_0xde14('0x21')](_0xae9dca[_0xde14('0x1c')][_0xde14('0x20')],function(_0x2713fb){return{'model':db[_0x2713fb[_0xde14('0x22')]],'as':_0x2713fb['as'],'attributes':_0x2713fb[_0xde14('0x1e')],'include':_0x2713fb[_0xde14('0x20')]?_[_0xde14('0x21')](_0x2713fb['include'],function(_0x50084f){return{'model':db[_0x50084f[_0xde14('0x22')]],'as':_0x50084f['as'],'attributes':_0x50084f[_0xde14('0x1e')],'include':_0x50084f[_0xde14('0x20')]?_[_0xde14('0x21')](_0x50084f[_0xde14('0x20')],function(_0x23813f){return{'model':db[_0x23813f[_0xde14('0x22')]],'as':_0x23813f['as'],'attributes':_0x23813f[_0xde14('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xde14('0xd')](function(_0x4e33e0){logger[_0xde14('0xe')]('ShowSalesforceAccount',_0xae9dca);logger['debug']('ShowSalesforceAccount',_0xae9dca,JSON[_0xde14('0x13')](_0x4e33e0));_0x4e7c5b(_0x4e33e0);})[_0xde14('0x18')](function(_0x398f63){logger[_0xde14('0x14')](_0xde14('0x23'),_0x398f63[_0xde14('0x16')],_0xae9dca);_0xbfc01b(_0x464666[_0xde14('0x14')](0x1f4,_0x398f63[_0xde14('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index c2803ec..f2407ef 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 _0xe7bb=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getDescriptions','post','create','put','delete','destroy','multer','util','express','Router','../../components/auth/service'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xe7bb,0x18b));var _0xbe7b=function(_0x33b297,_0xbbfafd){_0x33b297=_0x33b297-0x0;var _0x27b686=_0xe7bb[_0x33b297];return _0x27b686;};'use strict';var multer=require(_0xbe7b('0x0'));var util=require(_0xbe7b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe7b('0x2'));var router=express[_0xbe7b('0x3')]();var auth=require(_0xbe7b('0x4'));var interaction=require(_0xbe7b('0x5'));var config=require(_0xbe7b('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0xbe7b('0x7')]('/',auth[_0xbe7b('0x8')](),controller[_0xbe7b('0x9')]);router[_0xbe7b('0x7')](_0xbe7b('0xa'),auth[_0xbe7b('0x8')](),controller[_0xbe7b('0xb')]);router[_0xbe7b('0x7')](_0xbe7b('0xc'),auth[_0xbe7b('0x8')](),controller[_0xbe7b('0xd')]);router[_0xbe7b('0x7')]('/:id/subjects',auth[_0xbe7b('0x8')](),controller['getSubjects']);router[_0xbe7b('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xbe7b('0xe')]);router[_0xbe7b('0xf')]('/',auth[_0xbe7b('0x8')](),controller[_0xbe7b('0x10')]);router[_0xbe7b('0x11')](_0xbe7b('0xa'),auth[_0xbe7b('0x8')](),controller['update']);router[_0xbe7b('0x12')](_0xbe7b('0xa'),auth[_0xbe7b('0x8')](),controller[_0xbe7b('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7a4e=['/:id/subjects','getSubjects','getDescriptions','post','update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','getFields'];(function(_0x41fcf9,_0x13f0c7){var _0x335a9f=function(_0xbf572){while(--_0xbf572){_0x41fcf9['push'](_0x41fcf9['shift']());}};_0x335a9f(++_0x13f0c7);}(_0x7a4e,0xc4));var _0xe7a4=function(_0x5224ba,_0x3fb4e1){_0x5224ba=_0x5224ba-0x0;var _0x459bd2=_0x7a4e[_0x5224ba];return _0x459bd2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7a4('0x0'));var timeout=require(_0xe7a4('0x1'));var express=require(_0xe7a4('0x2'));var router=express[_0xe7a4('0x3')]();var auth=require(_0xe7a4('0x4'));var interaction=require(_0xe7a4('0x5'));var config=require(_0xe7a4('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0xe7a4('0x7')]('/',auth['isAuthenticated'](),controller[_0xe7a4('0x8')]);router[_0xe7a4('0x7')](_0xe7a4('0x9'),auth[_0xe7a4('0xa')](),controller[_0xe7a4('0xb')]);router[_0xe7a4('0x7')](_0xe7a4('0xc'),auth[_0xe7a4('0xa')](),controller[_0xe7a4('0xd')]);router[_0xe7a4('0x7')](_0xe7a4('0xe'),auth['isAuthenticated'](),controller[_0xe7a4('0xf')]);router['get']('/:id/descriptions',auth[_0xe7a4('0xa')](),controller[_0xe7a4('0x10')]);router[_0xe7a4('0x11')]('/',auth[_0xe7a4('0xa')](),controller['create']);router['put'](_0xe7a4('0x9'),auth['isAuthenticated'](),controller[_0xe7a4('0x12')]);router[_0xe7a4('0x13')](_0xe7a4('0x9'),auth[_0xe7a4('0xa')](),controller['destroy']);module[_0xe7a4('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 8cc5fb7..bdd58eb 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 _0xfc82=['Task','Case','contact_lead','contact','lead','nothing','sequelize','STRING','ENUM'];(function(_0x51674a,_0x77ccff){var _0x13fca6=function(_0x3d6c27){while(--_0x3d6c27){_0x51674a['push'](_0x51674a['shift']());}};_0x13fca6(++_0x77ccff);}(_0xfc82,0x11d));var _0x2fc8=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xfc82[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x2fc8('0x0'));module['exports']={'name':{'type':Sequelize[_0x2fc8('0x1')]},'description':{'type':Sequelize[_0x2fc8('0x1')]},'ticketType':{'type':Sequelize[_0x2fc8('0x2')](_0x2fc8('0x3'),_0x2fc8('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM'](_0x2fc8('0x5'),_0x2fc8('0x6'),_0x2fc8('0x7')),'defaultValue':_0x2fc8('0x5')},'moduleCreate':{'type':Sequelize[_0x2fc8('0x2')](_0x2fc8('0x8'),_0x2fc8('0x6'),_0x2fc8('0x7')),'defaultValue':_0x2fc8('0x7')}}; \ No newline at end of file +var _0x29c9=['STRING','Case','Task','ENUM','contact_lead','lead','nothing','contact','sequelize','exports'];(function(_0x3afb47,_0x54bee0){var _0xe566d2=function(_0x214891){while(--_0x214891){_0x3afb47['push'](_0x3afb47['shift']());}};_0xe566d2(++_0x54bee0);}(_0x29c9,0x18e));var _0x929c=function(_0x400f4e,_0x13db76){_0x400f4e=_0x400f4e-0x0;var _0x47ec14=_0x29c9[_0x400f4e];return _0x47ec14;};'use strict';var Sequelize=require(_0x929c('0x0'));module[_0x929c('0x1')]={'name':{'type':Sequelize[_0x929c('0x2')]},'description':{'type':Sequelize[_0x929c('0x2')]},'ticketType':{'type':Sequelize['ENUM']('Task',_0x929c('0x3')),'defaultValue':_0x929c('0x4')},'moduleSearch':{'type':Sequelize[_0x929c('0x5')](_0x929c('0x6'),'contact',_0x929c('0x7')),'defaultValue':_0x929c('0x6')},'moduleCreate':{'type':Sequelize[_0x929c('0x5')](_0x929c('0x8'),_0x929c('0x9'),'lead'),'defaultValue':_0x929c('0x7')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 6758993..8d7b2b9 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 _0xcb5c=['includeAll','include','findAll','rows','show','params','rawAttributes','create','body','find','getFields','SalesforceField','where','options','hasOwnProperty','getSubjects','getDescriptions','findOne','html-pdf','eml-format','rimraf','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','name','send','index','map','SalesforceConfiguration','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','limit','order','sort','pick','filter','merge','VIRTUAL'];(function(_0x172ffb,_0x2f03eb){var _0x2c47dd=function(_0x40792f){while(--_0x40792f){_0x172ffb['push'](_0x172ffb['shift']());}};_0x2c47dd(++_0x2f03eb);}(_0xcb5c,0xc4));var _0xccb5=function(_0x4ebf07,_0x72b3b8){_0x4ebf07=_0x4ebf07-0x0;var _0x91220d=_0xcb5c[_0x4ebf07];return _0x91220d;};'use strict';var pdf=require(_0xccb5('0x0'));var emlformat=require(_0xccb5('0x1'));var rimraf=require(_0xccb5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xccb5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xccb5('0x4'));var util=require(_0xccb5('0x5'));var path=require(_0xccb5('0x6'));var sox=require(_0xccb5('0x7'));var csv=require(_0xccb5('0x8'));var ejs=require(_0xccb5('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xccb5('0xa'));var crypto=require(_0xccb5('0xb'));var jsforce=require(_0xccb5('0xc'));var deskjs=require(_0xccb5('0xd'));var toCsv=require(_0xccb5('0x8'));var querystring=require(_0xccb5('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xccb5('0xf'));var qs=require(_0xccb5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xccb5('0x11'));var logger=require(_0xccb5('0x12'))(_0xccb5('0x13'));var utils=require(_0xccb5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xccb5('0x15'));var db=require(_0xccb5('0x16'))['db'];var jayson=require(_0xccb5('0x17'));var client=jayson['client'][_0xccb5('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4d6884,_0x27fb4f,_0x2e8be3,_0x55c8cb){return new BPromise(function(_0x517e41,_0x70179e){var _0x19cadb=_0x55c8cb||client;return _0x19cadb[_0xccb5('0x19')](_0x4d6884,_0x2e8be3)['then'](function(_0x578500){logger[_0xccb5('0x1a')](_0xccb5('0x1b'),_0x27fb4f,'request\x20sent');logger[_0xccb5('0x1c')](_0xccb5('0x1d'),_0x27fb4f,_0xccb5('0x1e'),JSON['stringify'](_0x578500));if(_0x578500[_0xccb5('0x1f')]){if(_0x578500[_0xccb5('0x1f')][_0xccb5('0x20')]===0x1f4){logger['error'](_0xccb5('0x1b'),_0x27fb4f,_0x578500['error'][_0xccb5('0x21')]);return _0x70179e(_0x578500[_0xccb5('0x1f')][_0xccb5('0x21')]);}logger[_0xccb5('0x1f')](_0xccb5('0x1b'),_0x27fb4f,_0x578500[_0xccb5('0x1f')][_0xccb5('0x21')]);return _0x517e41(_0x578500['error'][_0xccb5('0x21')]);}else{logger[_0xccb5('0x1a')](_0xccb5('0x1b'),_0x27fb4f,_0xccb5('0x1e'));_0x517e41(_0x578500['result'][_0xccb5('0x21')]);}})[_0xccb5('0x22')](function(_0x2f845a){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x27fb4f,_0x2f845a);_0x70179e(_0x2f845a);});});}function respondWithStatusCode(_0x2d019c,_0x553971){_0x553971=_0x553971||0xcc;return function(_0x583aed){if(_0x583aed){return _0x2d019c['sendStatus'](_0x553971);}return _0x2d019c[_0xccb5('0x23')](_0x553971)[_0xccb5('0x24')]();};}function respondWithResult(_0x303bd3,_0xb32473){_0xb32473=_0xb32473||0xc8;return function(_0x9da7b0){if(_0x9da7b0){return _0x303bd3[_0xccb5('0x23')](_0xb32473)[_0xccb5('0x25')](_0x9da7b0);}};}function respondWithFilteredResult(_0x3a026f,_0x248a69){return function(_0x338cbb){if(_0x338cbb){var _0x4826d1=_0x338cbb[_0xccb5('0x26')],_0x2b5984=_0x248a69['offset'],_0x41011d=_0x248a69[_0xccb5('0x27')]+_0x248a69['limit'],_0x3c8e08;if(_0x41011d>=_0x4826d1){_0x41011d=_0x4826d1;_0x3c8e08=0xc8;}else{_0x3c8e08=0xce;}_0x3a026f[_0xccb5('0x23')](_0x3c8e08);return _0x3a026f[_0xccb5('0x28')](_0xccb5('0x29'),_0x2b5984+'-'+_0x41011d+'/'+_0x4826d1)[_0xccb5('0x25')](_0x338cbb);}return null;};}function patchUpdates(_0xbd8726){return function(_0x424e3b){try{jsonpatch[_0xccb5('0x2a')](_0x424e3b,_0xbd8726,!![]);}catch(_0x47bd0d){return BPromise[_0xccb5('0x2b')](_0x47bd0d);}return _0x424e3b[_0xccb5('0x2c')]();};}function saveUpdates(_0x540ec8,_0x3113ae){return function(_0x37f576){if(_0x37f576){return _0x37f576[_0xccb5('0x2d')](_0x540ec8)[_0xccb5('0x2e')](function(_0x3505ec){return _0x3505ec;});}return null;};}function removeEntity(_0x28641a,_0x15c32f){return function(_0xc336d8){if(_0xc336d8){return _0xc336d8['destroy']()[_0xccb5('0x2e')](function(){_0x28641a[_0xccb5('0x23')](0xcc)[_0xccb5('0x24')]();});}};}function handleEntityNotFound(_0x129e95,_0x1ec6ca){return function(_0x1145be){if(!_0x1145be){_0x129e95['sendStatus'](0x194);}return _0x1145be;};}function handleError(_0x5468fd,_0x40fbce){_0x40fbce=_0x40fbce||0x1f4;return function(_0x161f7f){logger[_0xccb5('0x1f')](_0x161f7f['stack']);if(_0x161f7f[_0xccb5('0x2f')]){delete _0x161f7f[_0xccb5('0x2f')];}_0x5468fd[_0xccb5('0x23')](_0x40fbce)[_0xccb5('0x30')](_0x161f7f);};}exports[_0xccb5('0x31')]=function(_0x24368b,_0x1c4beb){var _0x47f467={},_0x5c3463={},_0x58788e={'count':0x0,'rows':[]};var _0x31f044=_[_0xccb5('0x32')](db[_0xccb5('0x33')]['rawAttributes'],function(_0x102c73){return{'name':_0x102c73[_0xccb5('0x34')],'type':_0x102c73[_0xccb5('0x35')][_0xccb5('0x36')]};});_0x5c3463['model']=_[_0xccb5('0x32')](_0x31f044,_0xccb5('0x2f'));_0x5c3463[_0xccb5('0x37')]=_[_0xccb5('0x38')](_0x24368b[_0xccb5('0x37')]);_0x5c3463[_0xccb5('0x39')]=_['intersection'](_0x5c3463[_0xccb5('0x3a')],_0x5c3463[_0xccb5('0x37')]);_0x47f467[_0xccb5('0x3b')]=_[_0xccb5('0x3c')](_0x5c3463['model'],qs['fields'](_0x24368b[_0xccb5('0x37')][_0xccb5('0x3d')]));_0x47f467[_0xccb5('0x3b')]=_0x47f467[_0xccb5('0x3b')][_0xccb5('0x3e')]?_0x47f467[_0xccb5('0x3b')]:_0x5c3463[_0xccb5('0x3a')];if(!_0x24368b[_0xccb5('0x37')]['hasOwnProperty'](_0xccb5('0x3f'))){_0x47f467[_0xccb5('0x40')]=qs[_0xccb5('0x40')](_0x24368b[_0xccb5('0x37')][_0xccb5('0x40')]);_0x47f467['offset']=qs[_0xccb5('0x27')](_0x24368b[_0xccb5('0x37')][_0xccb5('0x27')]);}_0x47f467[_0xccb5('0x41')]=qs[_0xccb5('0x42')](_0x24368b[_0xccb5('0x37')][_0xccb5('0x42')]);_0x47f467['where']=qs[_0xccb5('0x39')](_[_0xccb5('0x43')](_0x24368b['query'],_0x5c3463[_0xccb5('0x39')]),_0x31f044);if(_0x24368b[_0xccb5('0x37')][_0xccb5('0x44')]){_0x47f467['where']=_[_0xccb5('0x45')](_0x47f467['where'],{'$or':_[_0xccb5('0x32')](_0x31f044,function(_0x270392){if(_0x270392['type']!==_0xccb5('0x46')){var _0x5bc137={};_0x5bc137[_0x270392[_0xccb5('0x2f')]]={'$like':'%'+_0x24368b[_0xccb5('0x37')]['filter']+'%'};return _0x5bc137;}})});}_0x47f467=_[_0xccb5('0x45')]({},_0x47f467,_0x24368b['options']);var _0x38dab9={'where':_0x47f467['where']};return db[_0xccb5('0x33')]['count'](_0x38dab9)[_0xccb5('0x2e')](function(_0x24b879){_0x58788e[_0xccb5('0x26')]=_0x24b879;if(_0x24368b[_0xccb5('0x37')][_0xccb5('0x47')]){_0x47f467[_0xccb5('0x48')]=[{'all':!![]}];}return db[_0xccb5('0x33')][_0xccb5('0x49')](_0x47f467);})[_0xccb5('0x2e')](function(_0x548c20){_0x58788e[_0xccb5('0x4a')]=_0x548c20;return _0x58788e;})[_0xccb5('0x2e')](respondWithFilteredResult(_0x1c4beb,_0x47f467))[_0xccb5('0x22')](handleError(_0x1c4beb,null));};exports[_0xccb5('0x4b')]=function(_0x13c6e7,_0x40bb3d){var _0x5b64f5={'raw':![],'where':{'id':_0x13c6e7[_0xccb5('0x4c')]['id']}},_0x5e7ff1={};_0x5e7ff1['model']=_[_0xccb5('0x38')](db[_0xccb5('0x33')][_0xccb5('0x4d')]);_0x5e7ff1[_0xccb5('0x37')]=_['keys'](_0x13c6e7[_0xccb5('0x37')]);_0x5e7ff1['filters']=_[_0xccb5('0x3c')](_0x5e7ff1[_0xccb5('0x3a')],_0x5e7ff1[_0xccb5('0x37')]);_0x5b64f5[_0xccb5('0x3b')]=_[_0xccb5('0x3c')](_0x5e7ff1[_0xccb5('0x3a')],qs[_0xccb5('0x3d')](_0x13c6e7[_0xccb5('0x37')][_0xccb5('0x3d')]));_0x5b64f5[_0xccb5('0x3b')]=_0x5b64f5[_0xccb5('0x3b')][_0xccb5('0x3e')]?_0x5b64f5['attributes']:_0x5e7ff1['model'];if(_0x13c6e7[_0xccb5('0x37')]['includeAll']){_0x5b64f5[_0xccb5('0x48')]=[{'all':!![]}];}_0x5b64f5=_[_0xccb5('0x45')]({},_0x5b64f5,_0x13c6e7['options']);return db[_0xccb5('0x33')]['find'](_0x5b64f5)['then'](handleEntityNotFound(_0x40bb3d,null))[_0xccb5('0x2e')](respondWithResult(_0x40bb3d,null))[_0xccb5('0x22')](handleError(_0x40bb3d,null));};exports['create']=function(_0x30e278,_0x5bf170){return db[_0xccb5('0x33')][_0xccb5('0x4e')](_0x30e278[_0xccb5('0x4f')],{})['then'](respondWithResult(_0x5bf170,0xc9))['catch'](handleError(_0x5bf170,null));};exports['update']=function(_0x3781f0,_0x4044a8){if(_0x3781f0['body']['id']){delete _0x3781f0[_0xccb5('0x4f')]['id'];}return db[_0xccb5('0x33')][_0xccb5('0x50')]({'where':{'id':_0x3781f0['params']['id']}})[_0xccb5('0x2e')](handleEntityNotFound(_0x4044a8,null))[_0xccb5('0x2e')](saveUpdates(_0x3781f0[_0xccb5('0x4f')],null))[_0xccb5('0x2e')](respondWithResult(_0x4044a8,null))[_0xccb5('0x22')](handleError(_0x4044a8,null));};exports['destroy']=function(_0x36a258,_0x1f3ed0){return db[_0xccb5('0x33')][_0xccb5('0x50')]({'where':{'id':_0x36a258[_0xccb5('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1f3ed0,null))['then'](removeEntity(_0x1f3ed0,null))[_0xccb5('0x22')](handleError(_0x1f3ed0,null));};exports[_0xccb5('0x51')]=function(_0x2683f7,_0x520eeb,_0x82d2f7){var _0x3c6791={};var _0x18971e={};var _0x4c7bf6;var _0x2eca7e;return db[_0xccb5('0x33')]['findOne']({'where':{'id':_0x2683f7[_0xccb5('0x4c')]['id']}})[_0xccb5('0x2e')](handleEntityNotFound(_0x520eeb,null))[_0xccb5('0x2e')](function(_0x3c8b66){if(_0x3c8b66){_0x4c7bf6=_0x3c8b66;_0x18971e[_0xccb5('0x3a')]=_[_0xccb5('0x38')](db[_0xccb5('0x52')][_0xccb5('0x4d')]);_0x18971e[_0xccb5('0x37')]=_['keys'](_0x2683f7['query']);_0x18971e[_0xccb5('0x39')]=_[_0xccb5('0x3c')](_0x18971e[_0xccb5('0x3a')],_0x18971e['query']);_0x3c6791[_0xccb5('0x3b')]=_[_0xccb5('0x3c')](_0x18971e[_0xccb5('0x3a')],qs[_0xccb5('0x3d')](_0x2683f7['query']['fields']));_0x3c6791[_0xccb5('0x3b')]=_0x3c6791[_0xccb5('0x3b')][_0xccb5('0x3e')]?_0x3c6791['attributes']:_0x18971e[_0xccb5('0x3a')];_0x3c6791[_0xccb5('0x41')]=qs[_0xccb5('0x42')](_0x2683f7[_0xccb5('0x37')]['sort']);_0x3c6791[_0xccb5('0x53')]=qs[_0xccb5('0x39')](_[_0xccb5('0x43')](_0x2683f7[_0xccb5('0x37')],_0x18971e[_0xccb5('0x39')]));if(_0x2683f7['query']['filter']){_0x3c6791[_0xccb5('0x53')]=_[_0xccb5('0x45')](_0x3c6791[_0xccb5('0x53')],{'$or':_[_0xccb5('0x32')](_0x3c6791[_0xccb5('0x3b')],function(_0xa9221d){var _0x4d2ede={};_0x4d2ede[_0xa9221d]={'$like':'%'+_0x2683f7[_0xccb5('0x37')]['filter']+'%'};return _0x4d2ede;})});}_0x3c6791=_['merge']({},_0x3c6791,_0x2683f7[_0xccb5('0x54')]);return _0x4c7bf6[_0xccb5('0x51')](_0x3c6791);}})[_0xccb5('0x2e')](function(_0x5419da){if(_0x5419da){_0x2eca7e=_0x5419da[_0xccb5('0x3e')];if(!_0x2683f7[_0xccb5('0x37')][_0xccb5('0x55')](_0xccb5('0x3f'))){_0x3c6791[_0xccb5('0x40')]=qs['limit'](_0x2683f7['query'][_0xccb5('0x40')]);_0x3c6791[_0xccb5('0x27')]=qs['offset'](_0x2683f7[_0xccb5('0x37')][_0xccb5('0x27')]);}return _0x4c7bf6[_0xccb5('0x51')](_0x3c6791);}})[_0xccb5('0x2e')](function(_0x9839dc){if(_0x9839dc){return _0x9839dc?{'count':_0x2eca7e,'rows':_0x9839dc}:null;}})[_0xccb5('0x2e')](respondWithResult(_0x520eeb,null))[_0xccb5('0x22')](handleError(_0x520eeb,null));};exports[_0xccb5('0x56')]=function(_0x1438af,_0x357296,_0x59c197){var _0x55291c={};var _0x57fc99={};var _0x452a4a;var _0x4771b6;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x1438af[_0xccb5('0x4c')]['id']}})[_0xccb5('0x2e')](handleEntityNotFound(_0x357296,null))['then'](function(_0x2c8c9d){if(_0x2c8c9d){_0x452a4a=_0x2c8c9d;_0x57fc99[_0xccb5('0x3a')]=_[_0xccb5('0x38')](db[_0xccb5('0x52')][_0xccb5('0x4d')]);_0x57fc99[_0xccb5('0x37')]=_['keys'](_0x1438af[_0xccb5('0x37')]);_0x57fc99['filters']=_['intersection'](_0x57fc99['model'],_0x57fc99['query']);_0x55291c[_0xccb5('0x3b')]=_[_0xccb5('0x3c')](_0x57fc99[_0xccb5('0x3a')],qs[_0xccb5('0x3d')](_0x1438af[_0xccb5('0x37')][_0xccb5('0x3d')]));_0x55291c['attributes']=_0x55291c[_0xccb5('0x3b')][_0xccb5('0x3e')]?_0x55291c[_0xccb5('0x3b')]:_0x57fc99['model'];_0x55291c[_0xccb5('0x41')]=qs['sort'](_0x1438af[_0xccb5('0x37')][_0xccb5('0x42')]);_0x55291c['where']=qs[_0xccb5('0x39')](_['pick'](_0x1438af['query'],_0x57fc99['filters']));if(_0x1438af[_0xccb5('0x37')][_0xccb5('0x44')]){_0x55291c['where']=_[_0xccb5('0x45')](_0x55291c[_0xccb5('0x53')],{'$or':_[_0xccb5('0x32')](_0x55291c[_0xccb5('0x3b')],function(_0x4b65b6){var _0x740049={};_0x740049[_0x4b65b6]={'$like':'%'+_0x1438af['query'][_0xccb5('0x44')]+'%'};return _0x740049;})});}_0x55291c=_[_0xccb5('0x45')]({},_0x55291c,_0x1438af[_0xccb5('0x54')]);return _0x452a4a['getSubjects'](_0x55291c);}})[_0xccb5('0x2e')](function(_0x2fc482){if(_0x2fc482){_0x4771b6=_0x2fc482[_0xccb5('0x3e')];if(!_0x1438af['query']['hasOwnProperty']('nolimit')){_0x55291c[_0xccb5('0x40')]=qs[_0xccb5('0x40')](_0x1438af[_0xccb5('0x37')][_0xccb5('0x40')]);_0x55291c[_0xccb5('0x27')]=qs[_0xccb5('0x27')](_0x1438af[_0xccb5('0x37')]['offset']);}return _0x452a4a[_0xccb5('0x56')](_0x55291c);}})['then'](function(_0xb2ed4d){if(_0xb2ed4d){return _0xb2ed4d?{'count':_0x4771b6,'rows':_0xb2ed4d}:null;}})['then'](respondWithResult(_0x357296,null))['catch'](handleError(_0x357296,null));};exports[_0xccb5('0x57')]=function(_0x5bf4fe,_0x27a15f,_0x21acc8){var _0x2655c6={};var _0x3ba19e={};var _0x507593;var _0x5dceca;return db['SalesforceConfiguration'][_0xccb5('0x58')]({'where':{'id':_0x5bf4fe[_0xccb5('0x4c')]['id']}})['then'](handleEntityNotFound(_0x27a15f,null))[_0xccb5('0x2e')](function(_0x2aaa96){if(_0x2aaa96){_0x507593=_0x2aaa96;_0x3ba19e['model']=_[_0xccb5('0x38')](db[_0xccb5('0x52')][_0xccb5('0x4d')]);_0x3ba19e['query']=_[_0xccb5('0x38')](_0x5bf4fe[_0xccb5('0x37')]);_0x3ba19e['filters']=_[_0xccb5('0x3c')](_0x3ba19e['model'],_0x3ba19e['query']);_0x2655c6['attributes']=_[_0xccb5('0x3c')](_0x3ba19e[_0xccb5('0x3a')],qs[_0xccb5('0x3d')](_0x5bf4fe[_0xccb5('0x37')][_0xccb5('0x3d')]));_0x2655c6[_0xccb5('0x3b')]=_0x2655c6[_0xccb5('0x3b')][_0xccb5('0x3e')]?_0x2655c6['attributes']:_0x3ba19e[_0xccb5('0x3a')];_0x2655c6[_0xccb5('0x41')]=qs[_0xccb5('0x42')](_0x5bf4fe[_0xccb5('0x37')][_0xccb5('0x42')]);_0x2655c6[_0xccb5('0x53')]=qs[_0xccb5('0x39')](_[_0xccb5('0x43')](_0x5bf4fe[_0xccb5('0x37')],_0x3ba19e[_0xccb5('0x39')]));if(_0x5bf4fe[_0xccb5('0x37')][_0xccb5('0x44')]){_0x2655c6[_0xccb5('0x53')]=_[_0xccb5('0x45')](_0x2655c6[_0xccb5('0x53')],{'$or':_[_0xccb5('0x32')](_0x2655c6[_0xccb5('0x3b')],function(_0xab1fc4){var _0x4de94e={};_0x4de94e[_0xab1fc4]={'$like':'%'+_0x5bf4fe[_0xccb5('0x37')][_0xccb5('0x44')]+'%'};return _0x4de94e;})});}_0x2655c6=_[_0xccb5('0x45')]({},_0x2655c6,_0x5bf4fe[_0xccb5('0x54')]);return _0x507593[_0xccb5('0x57')](_0x2655c6);}})[_0xccb5('0x2e')](function(_0x5eb55c){if(_0x5eb55c){_0x5dceca=_0x5eb55c['length'];if(!_0x5bf4fe[_0xccb5('0x37')]['hasOwnProperty'](_0xccb5('0x3f'))){_0x2655c6[_0xccb5('0x40')]=qs[_0xccb5('0x40')](_0x5bf4fe[_0xccb5('0x37')][_0xccb5('0x40')]);_0x2655c6['offset']=qs[_0xccb5('0x27')](_0x5bf4fe[_0xccb5('0x37')][_0xccb5('0x27')]);}return _0x507593[_0xccb5('0x57')](_0x2655c6);}})[_0xccb5('0x2e')](function(_0x569882){if(_0x569882){return _0x569882?{'count':_0x5dceca,'rows':_0x569882}:null;}})['then'](respondWithResult(_0x27a15f,null))[_0xccb5('0x22')](handleError(_0x27a15f,null));}; \ No newline at end of file +var _0xb61c=['zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','name','map','rawAttributes','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','SalesforceConfiguration','includeAll','include','findAll','rows','params','keys','create','body','find','getFields','SalesforceField','pick','findOne','getSubjects','getDescriptions','html-pdf','eml-format'];(function(_0x15fbc8,_0x1fcfd2){var _0x2b2b96=function(_0x1c401a){while(--_0x1c401a){_0x15fbc8['push'](_0x15fbc8['shift']());}};_0x2b2b96(++_0x1fcfd2);}(_0xb61c,0xa6));var _0xcb61=function(_0x21ea0e,_0x57088f){_0x21ea0e=_0x21ea0e-0x0;var _0x30ba5a=_0xb61c[_0x21ea0e];return _0x30ba5a;};'use strict';var pdf=require(_0xcb61('0x0'));var emlformat=require(_0xcb61('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcb61('0x2'));var jsonpatch=require(_0xcb61('0x3'));var rp=require('request-promise');var moment=require(_0xcb61('0x4'));var BPromise=require(_0xcb61('0x5'));var Mustache=require('mustache');var util=require(_0xcb61('0x6'));var path=require(_0xcb61('0x7'));var sox=require(_0xcb61('0x8'));var csv=require(_0xcb61('0x9'));var ejs=require(_0xcb61('0xa'));var fs=require('fs');var _=require(_0xcb61('0xb'));var squel=require('squel');var crypto=require(_0xcb61('0xc'));var jsforce=require(_0xcb61('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcb61('0xe'));var Papa=require(_0xcb61('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcb61('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcb61('0x11'));var utils=require(_0xcb61('0x12'));var config=require(_0xcb61('0x13'));var licenseUtil=require(_0xcb61('0x14'));var db=require(_0xcb61('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xcb61('0x16')][_0xcb61('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x324606,_0x339d12,_0x1ee8e5,_0x2ba56a){return new BPromise(function(_0x16d4d4,_0x40662e){var _0x522860=_0x2ba56a||client;return _0x522860[_0xcb61('0x18')](_0x324606,_0x1ee8e5)[_0xcb61('0x19')](function(_0x39ac43){logger[_0xcb61('0x1a')](_0xcb61('0x1b'),_0x339d12,'request\x20sent');logger[_0xcb61('0x1c')](_0xcb61('0x1d'),_0x339d12,_0xcb61('0x1e'),JSON['stringify'](_0x39ac43));if(_0x39ac43[_0xcb61('0x1f')]){if(_0x39ac43['error'][_0xcb61('0x20')]===0x1f4){logger['error'](_0xcb61('0x1b'),_0x339d12,_0x39ac43[_0xcb61('0x1f')][_0xcb61('0x21')]);return _0x40662e(_0x39ac43['error'][_0xcb61('0x21')]);}logger[_0xcb61('0x1f')](_0xcb61('0x1b'),_0x339d12,_0x39ac43[_0xcb61('0x1f')][_0xcb61('0x21')]);return _0x16d4d4(_0x39ac43[_0xcb61('0x1f')][_0xcb61('0x21')]);}else{logger[_0xcb61('0x1a')](_0xcb61('0x1b'),_0x339d12,_0xcb61('0x1e'));_0x16d4d4(_0x39ac43['result'][_0xcb61('0x21')]);}})[_0xcb61('0x22')](function(_0x5eed0e){logger['error'](_0xcb61('0x1b'),_0x339d12,_0x5eed0e);_0x40662e(_0x5eed0e);});});}function respondWithStatusCode(_0x89c27c,_0x151093){_0x151093=_0x151093||0xcc;return function(_0x288e22){if(_0x288e22){return _0x89c27c[_0xcb61('0x23')](_0x151093);}return _0x89c27c[_0xcb61('0x24')](_0x151093)[_0xcb61('0x25')]();};}function respondWithResult(_0x194bba,_0xee16a2){_0xee16a2=_0xee16a2||0xc8;return function(_0x1920df){if(_0x1920df){return _0x194bba['status'](_0xee16a2)[_0xcb61('0x26')](_0x1920df);}};}function respondWithFilteredResult(_0x49ace4,_0x345bd9){return function(_0x55e38e){if(_0x55e38e){var _0x1497ed=_0x55e38e[_0xcb61('0x27')],_0x197488=_0x345bd9[_0xcb61('0x28')],_0x588f38=_0x345bd9[_0xcb61('0x28')]+_0x345bd9[_0xcb61('0x29')],_0x76b395;if(_0x588f38>=_0x1497ed){_0x588f38=_0x1497ed;_0x76b395=0xc8;}else{_0x76b395=0xce;}_0x49ace4[_0xcb61('0x24')](_0x76b395);return _0x49ace4[_0xcb61('0x2a')](_0xcb61('0x2b'),_0x197488+'-'+_0x588f38+'/'+_0x1497ed)[_0xcb61('0x26')](_0x55e38e);}return null;};}function patchUpdates(_0xbcccc6){return function(_0x1b3bb9){try{jsonpatch['apply'](_0x1b3bb9,_0xbcccc6,!![]);}catch(_0x19b15e){return BPromise[_0xcb61('0x2c')](_0x19b15e);}return _0x1b3bb9[_0xcb61('0x2d')]();};}function saveUpdates(_0x52d817,_0x533f00){return function(_0x36186c){if(_0x36186c){return _0x36186c[_0xcb61('0x2e')](_0x52d817)[_0xcb61('0x19')](function(_0x3f179c){return _0x3f179c;});}return null;};}function removeEntity(_0x55eb96,_0x1031af){return function(_0x2d9aa2){if(_0x2d9aa2){return _0x2d9aa2[_0xcb61('0x2f')]()[_0xcb61('0x19')](function(){_0x55eb96[_0xcb61('0x24')](0xcc)[_0xcb61('0x25')]();});}};}function handleEntityNotFound(_0x3f8960,_0x7a363f){return function(_0x4a3bd6){if(!_0x4a3bd6){_0x3f8960['sendStatus'](0x194);}return _0x4a3bd6;};}function handleError(_0xda27cc,_0x4f2994){_0x4f2994=_0x4f2994||0x1f4;return function(_0x3eca55){logger['error'](_0x3eca55['stack']);if(_0x3eca55['name']){delete _0x3eca55[_0xcb61('0x30')];}_0xda27cc[_0xcb61('0x24')](_0x4f2994)['send'](_0x3eca55);};}exports['index']=function(_0x5e4ca0,_0x3c82c3){var _0x43e360={},_0x562e0f={},_0x12c1ff={'count':0x0,'rows':[]};var _0x18c6dc=_[_0xcb61('0x31')](db['SalesforceConfiguration'][_0xcb61('0x32')],function(_0x260523){return{'name':_0x260523['fieldName'],'type':_0x260523['type']['key']};});_0x562e0f[_0xcb61('0x33')]=_['map'](_0x18c6dc,'name');_0x562e0f[_0xcb61('0x34')]=_['keys'](_0x5e4ca0['query']);_0x562e0f[_0xcb61('0x35')]=_[_0xcb61('0x36')](_0x562e0f['model'],_0x562e0f['query']);_0x43e360['attributes']=_[_0xcb61('0x36')](_0x562e0f[_0xcb61('0x33')],qs[_0xcb61('0x37')](_0x5e4ca0[_0xcb61('0x34')][_0xcb61('0x37')]));_0x43e360[_0xcb61('0x38')]=_0x43e360[_0xcb61('0x38')][_0xcb61('0x39')]?_0x43e360[_0xcb61('0x38')]:_0x562e0f[_0xcb61('0x33')];if(!_0x5e4ca0[_0xcb61('0x34')][_0xcb61('0x3a')](_0xcb61('0x3b'))){_0x43e360['limit']=qs[_0xcb61('0x29')](_0x5e4ca0[_0xcb61('0x34')]['limit']);_0x43e360[_0xcb61('0x28')]=qs[_0xcb61('0x28')](_0x5e4ca0[_0xcb61('0x34')][_0xcb61('0x28')]);}_0x43e360[_0xcb61('0x3c')]=qs['sort'](_0x5e4ca0['query'][_0xcb61('0x3d')]);_0x43e360['where']=qs[_0xcb61('0x35')](_['pick'](_0x5e4ca0[_0xcb61('0x34')],_0x562e0f[_0xcb61('0x35')]),_0x18c6dc);if(_0x5e4ca0[_0xcb61('0x34')]['filter']){_0x43e360[_0xcb61('0x3e')]=_[_0xcb61('0x3f')](_0x43e360['where'],{'$or':_[_0xcb61('0x31')](_0x18c6dc,function(_0x447d25){if(_0x447d25[_0xcb61('0x40')]!==_0xcb61('0x41')){var _0x1f3d5f={};_0x1f3d5f[_0x447d25[_0xcb61('0x30')]]={'$like':'%'+_0x5e4ca0[_0xcb61('0x34')][_0xcb61('0x42')]+'%'};return _0x1f3d5f;}})});}_0x43e360=_['merge']({},_0x43e360,_0x5e4ca0[_0xcb61('0x43')]);var _0x4726fe={'where':_0x43e360[_0xcb61('0x3e')]};return db[_0xcb61('0x44')]['count'](_0x4726fe)[_0xcb61('0x19')](function(_0xf98ee){_0x12c1ff[_0xcb61('0x27')]=_0xf98ee;if(_0x5e4ca0['query'][_0xcb61('0x45')]){_0x43e360[_0xcb61('0x46')]=[{'all':!![]}];}return db[_0xcb61('0x44')][_0xcb61('0x47')](_0x43e360);})[_0xcb61('0x19')](function(_0xef4192){_0x12c1ff[_0xcb61('0x48')]=_0xef4192;return _0x12c1ff;})['then'](respondWithFilteredResult(_0x3c82c3,_0x43e360))['catch'](handleError(_0x3c82c3,null));};exports['show']=function(_0x441ecc,_0x90857b){var _0x2690e0={'raw':![],'where':{'id':_0x441ecc[_0xcb61('0x49')]['id']}},_0xde5d81={};_0xde5d81[_0xcb61('0x33')]=_[_0xcb61('0x4a')](db[_0xcb61('0x44')][_0xcb61('0x32')]);_0xde5d81[_0xcb61('0x34')]=_[_0xcb61('0x4a')](_0x441ecc[_0xcb61('0x34')]);_0xde5d81[_0xcb61('0x35')]=_[_0xcb61('0x36')](_0xde5d81[_0xcb61('0x33')],_0xde5d81['query']);_0x2690e0[_0xcb61('0x38')]=_[_0xcb61('0x36')](_0xde5d81[_0xcb61('0x33')],qs['fields'](_0x441ecc[_0xcb61('0x34')]['fields']));_0x2690e0[_0xcb61('0x38')]=_0x2690e0[_0xcb61('0x38')]['length']?_0x2690e0['attributes']:_0xde5d81['model'];if(_0x441ecc[_0xcb61('0x34')][_0xcb61('0x45')]){_0x2690e0[_0xcb61('0x46')]=[{'all':!![]}];}_0x2690e0=_[_0xcb61('0x3f')]({},_0x2690e0,_0x441ecc[_0xcb61('0x43')]);return db[_0xcb61('0x44')]['find'](_0x2690e0)['then'](handleEntityNotFound(_0x90857b,null))['then'](respondWithResult(_0x90857b,null))[_0xcb61('0x22')](handleError(_0x90857b,null));};exports[_0xcb61('0x4b')]=function(_0x2c85eb,_0x4de3a9){return db[_0xcb61('0x44')][_0xcb61('0x4b')](_0x2c85eb['body'],{})[_0xcb61('0x19')](respondWithResult(_0x4de3a9,0xc9))['catch'](handleError(_0x4de3a9,null));};exports['update']=function(_0x3133fc,_0x36f1b7){if(_0x3133fc['body']['id']){delete _0x3133fc['body']['id'];}return db[_0xcb61('0x44')]['find']({'where':{'id':_0x3133fc[_0xcb61('0x49')]['id']}})[_0xcb61('0x19')](handleEntityNotFound(_0x36f1b7,null))['then'](saveUpdates(_0x3133fc[_0xcb61('0x4c')],null))[_0xcb61('0x19')](respondWithResult(_0x36f1b7,null))[_0xcb61('0x22')](handleError(_0x36f1b7,null));};exports['destroy']=function(_0x422954,_0x4861a0){return db[_0xcb61('0x44')][_0xcb61('0x4d')]({'where':{'id':_0x422954[_0xcb61('0x49')]['id']}})[_0xcb61('0x19')](handleEntityNotFound(_0x4861a0,null))[_0xcb61('0x19')](removeEntity(_0x4861a0,null))[_0xcb61('0x22')](handleError(_0x4861a0,null));};exports[_0xcb61('0x4e')]=function(_0x2d84ff,_0x5a882b,_0x2bb715){var _0x4793cf={};var _0x37a3dd={};var _0x241493;var _0x461728;return db[_0xcb61('0x44')]['findOne']({'where':{'id':_0x2d84ff['params']['id']}})[_0xcb61('0x19')](handleEntityNotFound(_0x5a882b,null))[_0xcb61('0x19')](function(_0x44b06f){if(_0x44b06f){_0x241493=_0x44b06f;_0x37a3dd[_0xcb61('0x33')]=_[_0xcb61('0x4a')](db[_0xcb61('0x4f')][_0xcb61('0x32')]);_0x37a3dd[_0xcb61('0x34')]=_['keys'](_0x2d84ff[_0xcb61('0x34')]);_0x37a3dd[_0xcb61('0x35')]=_['intersection'](_0x37a3dd[_0xcb61('0x33')],_0x37a3dd[_0xcb61('0x34')]);_0x4793cf[_0xcb61('0x38')]=_[_0xcb61('0x36')](_0x37a3dd[_0xcb61('0x33')],qs[_0xcb61('0x37')](_0x2d84ff[_0xcb61('0x34')][_0xcb61('0x37')]));_0x4793cf[_0xcb61('0x38')]=_0x4793cf[_0xcb61('0x38')][_0xcb61('0x39')]?_0x4793cf[_0xcb61('0x38')]:_0x37a3dd[_0xcb61('0x33')];_0x4793cf[_0xcb61('0x3c')]=qs[_0xcb61('0x3d')](_0x2d84ff['query'][_0xcb61('0x3d')]);_0x4793cf[_0xcb61('0x3e')]=qs[_0xcb61('0x35')](_[_0xcb61('0x50')](_0x2d84ff[_0xcb61('0x34')],_0x37a3dd['filters']));if(_0x2d84ff[_0xcb61('0x34')][_0xcb61('0x42')]){_0x4793cf[_0xcb61('0x3e')]=_[_0xcb61('0x3f')](_0x4793cf[_0xcb61('0x3e')],{'$or':_[_0xcb61('0x31')](_0x4793cf[_0xcb61('0x38')],function(_0x2966b4){var _0x2814ce={};_0x2814ce[_0x2966b4]={'$like':'%'+_0x2d84ff[_0xcb61('0x34')][_0xcb61('0x42')]+'%'};return _0x2814ce;})});}_0x4793cf=_[_0xcb61('0x3f')]({},_0x4793cf,_0x2d84ff[_0xcb61('0x43')]);return _0x241493[_0xcb61('0x4e')](_0x4793cf);}})['then'](function(_0x5e5f21){if(_0x5e5f21){_0x461728=_0x5e5f21['length'];if(!_0x2d84ff[_0xcb61('0x34')][_0xcb61('0x3a')](_0xcb61('0x3b'))){_0x4793cf[_0xcb61('0x29')]=qs[_0xcb61('0x29')](_0x2d84ff[_0xcb61('0x34')][_0xcb61('0x29')]);_0x4793cf[_0xcb61('0x28')]=qs[_0xcb61('0x28')](_0x2d84ff[_0xcb61('0x34')][_0xcb61('0x28')]);}return _0x241493['getFields'](_0x4793cf);}})[_0xcb61('0x19')](function(_0x395077){if(_0x395077){return _0x395077?{'count':_0x461728,'rows':_0x395077}:null;}})['then'](respondWithResult(_0x5a882b,null))['catch'](handleError(_0x5a882b,null));};exports['getSubjects']=function(_0x5c9142,_0x222dfc,_0x97e3bd){var _0x9f8680={};var _0x55e2bf={};var _0x3a4190;var _0x2dc196;return db['SalesforceConfiguration'][_0xcb61('0x51')]({'where':{'id':_0x5c9142[_0xcb61('0x49')]['id']}})[_0xcb61('0x19')](handleEntityNotFound(_0x222dfc,null))[_0xcb61('0x19')](function(_0x299aae){if(_0x299aae){_0x3a4190=_0x299aae;_0x55e2bf[_0xcb61('0x33')]=_[_0xcb61('0x4a')](db[_0xcb61('0x4f')][_0xcb61('0x32')]);_0x55e2bf[_0xcb61('0x34')]=_[_0xcb61('0x4a')](_0x5c9142[_0xcb61('0x34')]);_0x55e2bf[_0xcb61('0x35')]=_[_0xcb61('0x36')](_0x55e2bf[_0xcb61('0x33')],_0x55e2bf[_0xcb61('0x34')]);_0x9f8680[_0xcb61('0x38')]=_[_0xcb61('0x36')](_0x55e2bf['model'],qs[_0xcb61('0x37')](_0x5c9142[_0xcb61('0x34')][_0xcb61('0x37')]));_0x9f8680[_0xcb61('0x38')]=_0x9f8680[_0xcb61('0x38')]['length']?_0x9f8680[_0xcb61('0x38')]:_0x55e2bf[_0xcb61('0x33')];_0x9f8680['order']=qs[_0xcb61('0x3d')](_0x5c9142[_0xcb61('0x34')]['sort']);_0x9f8680['where']=qs[_0xcb61('0x35')](_[_0xcb61('0x50')](_0x5c9142[_0xcb61('0x34')],_0x55e2bf['filters']));if(_0x5c9142[_0xcb61('0x34')]['filter']){_0x9f8680[_0xcb61('0x3e')]=_[_0xcb61('0x3f')](_0x9f8680[_0xcb61('0x3e')],{'$or':_['map'](_0x9f8680[_0xcb61('0x38')],function(_0xba2f1a){var _0x343112={};_0x343112[_0xba2f1a]={'$like':'%'+_0x5c9142['query']['filter']+'%'};return _0x343112;})});}_0x9f8680=_[_0xcb61('0x3f')]({},_0x9f8680,_0x5c9142[_0xcb61('0x43')]);return _0x3a4190[_0xcb61('0x52')](_0x9f8680);}})[_0xcb61('0x19')](function(_0x440615){if(_0x440615){_0x2dc196=_0x440615[_0xcb61('0x39')];if(!_0x5c9142['query'][_0xcb61('0x3a')](_0xcb61('0x3b'))){_0x9f8680['limit']=qs[_0xcb61('0x29')](_0x5c9142[_0xcb61('0x34')][_0xcb61('0x29')]);_0x9f8680[_0xcb61('0x28')]=qs['offset'](_0x5c9142[_0xcb61('0x34')]['offset']);}return _0x3a4190[_0xcb61('0x52')](_0x9f8680);}})[_0xcb61('0x19')](function(_0x2d0322){if(_0x2d0322){return _0x2d0322?{'count':_0x2dc196,'rows':_0x2d0322}:null;}})['then'](respondWithResult(_0x222dfc,null))['catch'](handleError(_0x222dfc,null));};exports['getDescriptions']=function(_0x25ff8d,_0x44939e,_0x1eddeb){var _0x59b96d={};var _0x3bfdf7={};var _0x175936;var _0x4a945a;return db[_0xcb61('0x44')][_0xcb61('0x51')]({'where':{'id':_0x25ff8d[_0xcb61('0x49')]['id']}})['then'](handleEntityNotFound(_0x44939e,null))[_0xcb61('0x19')](function(_0x696b9a){if(_0x696b9a){_0x175936=_0x696b9a;_0x3bfdf7['model']=_['keys'](db['SalesforceField'][_0xcb61('0x32')]);_0x3bfdf7['query']=_['keys'](_0x25ff8d[_0xcb61('0x34')]);_0x3bfdf7[_0xcb61('0x35')]=_['intersection'](_0x3bfdf7[_0xcb61('0x33')],_0x3bfdf7[_0xcb61('0x34')]);_0x59b96d[_0xcb61('0x38')]=_[_0xcb61('0x36')](_0x3bfdf7['model'],qs[_0xcb61('0x37')](_0x25ff8d['query'][_0xcb61('0x37')]));_0x59b96d[_0xcb61('0x38')]=_0x59b96d['attributes']['length']?_0x59b96d[_0xcb61('0x38')]:_0x3bfdf7[_0xcb61('0x33')];_0x59b96d[_0xcb61('0x3c')]=qs[_0xcb61('0x3d')](_0x25ff8d[_0xcb61('0x34')][_0xcb61('0x3d')]);_0x59b96d[_0xcb61('0x3e')]=qs['filters'](_[_0xcb61('0x50')](_0x25ff8d[_0xcb61('0x34')],_0x3bfdf7[_0xcb61('0x35')]));if(_0x25ff8d['query']['filter']){_0x59b96d[_0xcb61('0x3e')]=_[_0xcb61('0x3f')](_0x59b96d['where'],{'$or':_['map'](_0x59b96d[_0xcb61('0x38')],function(_0x13b02d){var _0x421c0c={};_0x421c0c[_0x13b02d]={'$like':'%'+_0x25ff8d[_0xcb61('0x34')][_0xcb61('0x42')]+'%'};return _0x421c0c;})});}_0x59b96d=_[_0xcb61('0x3f')]({},_0x59b96d,_0x25ff8d[_0xcb61('0x43')]);return _0x175936['getDescriptions'](_0x59b96d);}})[_0xcb61('0x19')](function(_0x1f2746){if(_0x1f2746){_0x4a945a=_0x1f2746['length'];if(!_0x25ff8d[_0xcb61('0x34')][_0xcb61('0x3a')]('nolimit')){_0x59b96d[_0xcb61('0x29')]=qs['limit'](_0x25ff8d[_0xcb61('0x34')][_0xcb61('0x29')]);_0x59b96d['offset']=qs[_0xcb61('0x28')](_0x25ff8d[_0xcb61('0x34')][_0xcb61('0x28')]);}return _0x175936[_0xcb61('0x53')](_0x59b96d);}})[_0xcb61('0x19')](function(_0x2f6ca0){if(_0x2f6ca0){return _0x2f6ca0?{'count':_0x4a945a,'rows':_0x2f6ca0}:null;}})['then'](respondWithResult(_0x44939e,null))[_0xcb61('0x22')](handleError(_0x44939e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 81173b8..23f6c9b 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 _0xbacc=['define','SalesforceConfiguration','int_salesforce_configurations','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports'];(function(_0x2d7ded,_0x30cffd){var _0x447f64=function(_0x137d81){while(--_0x137d81){_0x2d7ded['push'](_0x2d7ded['shift']());}};_0x447f64(++_0x30cffd);}(_0xbacc,0x155));var _0xcbac=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xbacc[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0xcbac('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcbac('0x1'));var moment=require(_0xcbac('0x2'));var BPromise=require(_0xcbac('0x3'));var rp=require(_0xcbac('0x4'));var fs=require('fs');var path=require(_0xcbac('0x5'));var rimraf=require(_0xcbac('0x6'));var config=require(_0xcbac('0x7'));var attributes=require(_0xcbac('0x8'));module[_0xcbac('0x9')]=function(_0x1bcc0a,_0x4ee6da){return _0x1bcc0a[_0xcbac('0xa')](_0xcbac('0xb'),attributes,{'tableName':_0xcbac('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d17=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration'];(function(_0x6af1b1,_0x4ccf9e){var _0x139dae=function(_0x409ebf){while(--_0x409ebf){_0x6af1b1['push'](_0x6af1b1['shift']());}};_0x139dae(++_0x4ccf9e);}(_0x5d17,0x111));var _0x75d1=function(_0x42a44a,_0x15ca12){_0x42a44a=_0x42a44a-0x0;var _0x1e6ab6=_0x5d17[_0x42a44a];return _0x1e6ab6;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var logger=require(_0x75d1('0x2'))(_0x75d1('0x3'));var moment=require(_0x75d1('0x4'));var BPromise=require(_0x75d1('0x5'));var rp=require(_0x75d1('0x6'));var fs=require('fs');var path=require(_0x75d1('0x7'));var rimraf=require(_0x75d1('0x8'));var config=require(_0x75d1('0x9'));var attributes=require(_0x75d1('0xa'));module['exports']=function(_0x160f5d,_0x5bdc81){return _0x160f5d[_0x75d1('0xb')](_0x75d1('0xc'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 2e709ec..f4e2125 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 _0xed7d=['http','request','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','SalesforceConfiguration,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x10ed89,_0x370125){var _0x5fa716=function(_0x44d93d){while(--_0x44d93d){_0x10ed89['push'](_0x10ed89['shift']());}};_0x5fa716(++_0x370125);}(_0xed7d,0x107));var _0xded7=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0xed7d[_0x31bab3];return _0x4fd382;};'use strict';var _=require(_0xded7('0x0'));var util=require(_0xded7('0x1'));var moment=require(_0xded7('0x2'));var BPromise=require('bluebird');var rs=require(_0xded7('0x3'));var fs=require('fs');var Redis=require(_0xded7('0x4'));var db=require(_0xded7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xded7('0x6'))('rpc');var config=require(_0xded7('0x7'));var jayson=require(_0xded7('0x8'));var client=jayson[_0xded7('0x9')][_0xded7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36f0c7,_0x3ebce9,_0x2cf937){return new BPromise(function(_0x3eda68,_0x2bf76c){return client[_0xded7('0xb')](_0x36f0c7,_0x2cf937)['then'](function(_0x6ec588){logger[_0xded7('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3ebce9,_0xded7('0xd'));logger[_0xded7('0xe')](_0xded7('0xf'),_0x3ebce9,'request\x20sent',JSON[_0xded7('0x10')](_0x6ec588));if(_0x6ec588[_0xded7('0x11')]){if(_0x6ec588[_0xded7('0x11')]['code']===0x1f4){logger[_0xded7('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3ebce9,_0x6ec588[_0xded7('0x11')][_0xded7('0x12')]);return _0x2bf76c(_0x6ec588['error'][_0xded7('0x12')]);}logger['error'](_0xded7('0x13'),_0x3ebce9,_0x6ec588[_0xded7('0x11')][_0xded7('0x12')]);return _0x3eda68(_0x6ec588['error'][_0xded7('0x12')]);}else{logger[_0xded7('0xc')](_0xded7('0x13'),_0x3ebce9,_0xded7('0xd'));_0x3eda68(_0x6ec588['result']['message']);}})[_0xded7('0x14')](function(_0x1f9216){logger['error'](_0xded7('0x13'),_0x3ebce9,_0x1f9216);_0x2bf76c(_0x1f9216);});});} \ No newline at end of file +var _0x83dd=['message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1b62e1,_0x2e9a5b){var _0x2da6ba=function(_0x172961){while(--_0x172961){_0x1b62e1['push'](_0x1b62e1['shift']());}};_0x2da6ba(++_0x2e9a5b);}(_0x83dd,0xe7));var _0xd83d=function(_0x2497db,_0x584ae9){_0x2497db=_0x2497db-0x0;var _0x31323d=_0x83dd[_0x2497db];return _0x31323d;};'use strict';var _=require(_0xd83d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd83d('0x1'));var rs=require(_0xd83d('0x2'));var fs=require('fs');var Redis=require(_0xd83d('0x3'));var db=require(_0xd83d('0x4'))['db'];var utils=require(_0xd83d('0x5'));var logger=require(_0xd83d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd83d('0x7'));var client=jayson['client'][_0xd83d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c5cb6,_0x132397,_0x2bc4d5){return new BPromise(function(_0x236298,_0xc6b2c6){return client[_0xd83d('0x9')](_0x2c5cb6,_0x2bc4d5)['then'](function(_0x5c2ecf){logger['info'](_0xd83d('0xa'),_0x132397,_0xd83d('0xb'));logger[_0xd83d('0xc')](_0xd83d('0xd'),_0x132397,_0xd83d('0xb'),JSON[_0xd83d('0xe')](_0x5c2ecf));if(_0x5c2ecf[_0xd83d('0xf')]){if(_0x5c2ecf[_0xd83d('0xf')]['code']===0x1f4){logger[_0xd83d('0xf')](_0xd83d('0xa'),_0x132397,_0x5c2ecf[_0xd83d('0xf')]['message']);return _0xc6b2c6(_0x5c2ecf['error']['message']);}logger[_0xd83d('0xf')](_0xd83d('0xa'),_0x132397,_0x5c2ecf[_0xd83d('0xf')][_0xd83d('0x10')]);return _0x236298(_0x5c2ecf[_0xd83d('0xf')][_0xd83d('0x10')]);}else{logger['info'](_0xd83d('0xa'),_0x132397,'request\x20sent');_0x236298(_0x5c2ecf[_0xd83d('0x11')][_0xd83d('0x10')]);}})[_0xd83d('0x12')](function(_0x309ea5){logger[_0xd83d('0xf')](_0xd83d('0xa'),_0x132397,_0x309ea5);_0xc6b2c6(_0x309ea5);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 2bd49c6..6a14d3a 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 _0xfb65=['./intSalesforceField.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x242160,_0x2783c4){var _0x302b4c=function(_0x1088f1){while(--_0x1088f1){_0x242160['push'](_0x242160['shift']());}};_0x302b4c(++_0x2783c4);}(_0xfb65,0x82));var _0x5fb6=function(_0x513430,_0x1a7cdf){_0x513430=_0x513430-0x0;var _0x4b3dea=_0xfb65[_0x513430];return _0x4b3dea;};'use strict';var multer=require('multer');var util=require(_0x5fb6('0x0'));var path=require(_0x5fb6('0x1'));var timeout=require('connect-timeout');var express=require(_0x5fb6('0x2'));var router=express['Router']();var auth=require(_0x5fb6('0x3'));var interaction=require(_0x5fb6('0x4'));var config=require(_0x5fb6('0x5'));var controller=require(_0x5fb6('0x6'));router[_0x5fb6('0x7')]('/',auth[_0x5fb6('0x8')](),controller['index']);router['get'](_0x5fb6('0x9'),auth[_0x5fb6('0x8')](),controller[_0x5fb6('0xa')]);router[_0x5fb6('0xb')]('/',auth['isAuthenticated'](),controller[_0x5fb6('0xc')]);router[_0x5fb6('0xd')](_0x5fb6('0x9'),auth[_0x5fb6('0x8')](),controller['update']);router[_0x5fb6('0xe')](_0x5fb6('0x9'),auth['isAuthenticated'](),controller[_0x5fb6('0xf')]);module[_0x5fb6('0x10')]=router; \ No newline at end of file +var _0xb4c7=['create','put','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','show','post'];(function(_0x206f68,_0xe18947){var _0x24f59b=function(_0x5639e9){while(--_0x5639e9){_0x206f68['push'](_0x206f68['shift']());}};_0x24f59b(++_0xe18947);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x368a70,_0x49ee43){_0x368a70=_0x368a70-0x0;var _0x245db0=_0xb4c7[_0x368a70];return _0x245db0;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var auth=require(_0x7b4c('0x5'));var interaction=require(_0x7b4c('0x6'));var config=require(_0x7b4c('0x7'));var controller=require(_0x7b4c('0x8'));router[_0x7b4c('0x9')]('/',auth['isAuthenticated'](),controller[_0x7b4c('0xa')]);router[_0x7b4c('0x9')](_0x7b4c('0xb'),auth['isAuthenticated'](),controller[_0x7b4c('0xc')]);router[_0x7b4c('0xd')]('/',auth['isAuthenticated'](),controller[_0x7b4c('0xe')]);router[_0x7b4c('0xf')](_0x7b4c('0xb'),auth[_0x7b4c('0x10')](),controller[_0x7b4c('0x11')]);router[_0x7b4c('0x12')](_0x7b4c('0xb'),auth[_0x7b4c('0x10')](),controller[_0x7b4c('0x13')]);module[_0x7b4c('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 6ea9a9c..08a5f3c 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 _0x4fd2=['STRING','sequelize','ENUM','string','variable','customVariable','keyValue'];(function(_0x4ce9be,_0x265133){var _0x5074dd=function(_0x471351){while(--_0x471351){_0x4ce9be['push'](_0x4ce9be['shift']());}};_0x5074dd(++_0x265133);}(_0x4fd2,0x182));var _0x24fd=function(_0x440d15,_0x3daafb){_0x440d15=_0x440d15-0x0;var _0x4fc87b=_0x4fd2[_0x440d15];return _0x4fc87b;};'use strict';var Sequelize=require(_0x24fd('0x0'));module['exports']={'type':{'type':Sequelize[_0x24fd('0x1')](_0x24fd('0x2'),_0x24fd('0x3'),_0x24fd('0x4'),_0x24fd('0x5')),'defaultValue':_0x24fd('0x2')},'content':{'type':Sequelize[_0x24fd('0x6')]},'key':{'type':Sequelize[_0x24fd('0x6')]},'keyType':{'type':Sequelize[_0x24fd('0x1')]('string',_0x24fd('0x3'),_0x24fd('0x4'))},'keyContent':{'type':Sequelize[_0x24fd('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x24fd('0x6')]}}; \ No newline at end of file +var _0xa418=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x13137e,_0x29c0f3){var _0x346261=function(_0x8c7d4f){while(--_0x8c7d4f){_0x13137e['push'](_0x13137e['shift']());}};_0x346261(++_0x29c0f3);}(_0xa418,0x1d0));var _0x8a41=function(_0x4b0717,_0x3cbe25){_0x4b0717=_0x4b0717-0x0;var _0x351677=_0xa418[_0x4b0717];return _0x351677;};'use strict';var Sequelize=require(_0x8a41('0x0'));module[_0x8a41('0x1')]={'type':{'type':Sequelize[_0x8a41('0x2')](_0x8a41('0x3'),_0x8a41('0x4'),_0x8a41('0x5'),_0x8a41('0x6')),'defaultValue':_0x8a41('0x3')},'content':{'type':Sequelize[_0x8a41('0x7')]},'key':{'type':Sequelize[_0x8a41('0x7')]},'keyType':{'type':Sequelize[_0x8a41('0x2')](_0x8a41('0x3'),_0x8a41('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x8a41('0x7')]},'idField':{'type':Sequelize[_0x8a41('0x7')]},'variableName':{'type':Sequelize[_0x8a41('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index aa81537..4199606 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 _0x160a=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','set','json','apply','reject','save','update','then','end','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','catch','create','body','find','destroy','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','lodash'];(function(_0x31ae97,_0x4745be){var _0x3c2eae=function(_0x12e9ed){while(--_0x12e9ed){_0x31ae97['push'](_0x31ae97['shift']());}};_0x3c2eae(++_0x4745be);}(_0x160a,0x19b));var _0xa160=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x160a[_0x468b0f];return _0x3e74d9;};'use strict';var pdf=require(_0xa160('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa160('0x1'));var jsonpatch=require(_0xa160('0x2'));var rp=require(_0xa160('0x3'));var moment=require(_0xa160('0x4'));var BPromise=require(_0xa160('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa160('0x6'));var csv=require(_0xa160('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa160('0x8'));var squel=require(_0xa160('0x9'));var crypto=require(_0xa160('0xa'));var jsforce=require(_0xa160('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa160('0x7'));var querystring=require(_0xa160('0xc'));var Papa=require(_0xa160('0xd'));var Redis=require(_0xa160('0xe'));var authService=require(_0xa160('0xf'));var qs=require(_0xa160('0x10'));var as=require(_0xa160('0x11'));var hardwareService=require(_0xa160('0x12'));var logger=require(_0xa160('0x13'))('api');var utils=require(_0xa160('0x14'));var config=require(_0xa160('0x15'));var licenseUtil=require(_0xa160('0x16'));var db=require(_0xa160('0x17'))['db'];function respondWithStatusCode(_0x127889,_0x3c8d08){_0x3c8d08=_0x3c8d08||0xcc;return function(_0x28d24){if(_0x28d24){return _0x127889[_0xa160('0x18')](_0x3c8d08);}return _0x127889[_0xa160('0x19')](_0x3c8d08)['end']();};}function respondWithResult(_0x43980a,_0x6a3bd){_0x6a3bd=_0x6a3bd||0xc8;return function(_0x1c7adf){if(_0x1c7adf){return _0x43980a[_0xa160('0x19')](_0x6a3bd)['json'](_0x1c7adf);}};}function respondWithFilteredResult(_0x246b88,_0x5640ba){return function(_0x55fdad){if(_0x55fdad){var _0x5e9476=_0x55fdad['count'],_0x34422c=_0x5640ba[_0xa160('0x1a')],_0x294122=_0x5640ba[_0xa160('0x1a')]+_0x5640ba[_0xa160('0x1b')],_0x258625;if(_0x294122>=_0x5e9476){_0x294122=_0x5e9476;_0x258625=0xc8;}else{_0x258625=0xce;}_0x246b88[_0xa160('0x19')](_0x258625);return _0x246b88[_0xa160('0x1c')]('Content-Range',_0x34422c+'-'+_0x294122+'/'+_0x5e9476)[_0xa160('0x1d')](_0x55fdad);}return null;};}function patchUpdates(_0x48061c){return function(_0x105185){try{jsonpatch[_0xa160('0x1e')](_0x105185,_0x48061c,!![]);}catch(_0x28f679){return BPromise[_0xa160('0x1f')](_0x28f679);}return _0x105185[_0xa160('0x20')]();};}function saveUpdates(_0x58b1cc,_0x468f69){return function(_0x18a162){if(_0x18a162){return _0x18a162[_0xa160('0x21')](_0x58b1cc)[_0xa160('0x22')](function(_0x1b047c){return _0x1b047c;});}return null;};}function removeEntity(_0x3fdf3d,_0x313e2e){return function(_0x451ac2){if(_0x451ac2){return _0x451ac2['destroy']()[_0xa160('0x22')](function(){_0x3fdf3d[_0xa160('0x19')](0xcc)[_0xa160('0x23')]();});}};}function handleEntityNotFound(_0x285f40,_0x5c4cdc){return function(_0x4788b8){if(!_0x4788b8){_0x285f40[_0xa160('0x18')](0x194);}return _0x4788b8;};}function handleError(_0x43b3c5,_0xc0ac20){_0xc0ac20=_0xc0ac20||0x1f4;return function(_0x1292d5){logger['error'](_0x1292d5[_0xa160('0x24')]);if(_0x1292d5[_0xa160('0x25')]){delete _0x1292d5['name'];}_0x43b3c5[_0xa160('0x19')](_0xc0ac20)[_0xa160('0x26')](_0x1292d5);};}exports[_0xa160('0x27')]=function(_0xf51594,_0x13104){var _0x1aca54={},_0x1dc04b={},_0x4a7a26={'count':0x0,'rows':[]};var _0x187339=_[_0xa160('0x28')](db[_0xa160('0x29')][_0xa160('0x2a')],function(_0x11f2a4){return{'name':_0x11f2a4[_0xa160('0x2b')],'type':_0x11f2a4[_0xa160('0x2c')][_0xa160('0x2d')]};});_0x1dc04b[_0xa160('0x2e')]=_[_0xa160('0x28')](_0x187339,_0xa160('0x25'));_0x1dc04b[_0xa160('0x2f')]=_[_0xa160('0x30')](_0xf51594['query']);_0x1dc04b[_0xa160('0x31')]=_[_0xa160('0x32')](_0x1dc04b[_0xa160('0x2e')],_0x1dc04b['query']);_0x1aca54[_0xa160('0x33')]=_['intersection'](_0x1dc04b[_0xa160('0x2e')],qs[_0xa160('0x34')](_0xf51594[_0xa160('0x2f')][_0xa160('0x34')]));_0x1aca54[_0xa160('0x33')]=_0x1aca54[_0xa160('0x33')][_0xa160('0x35')]?_0x1aca54[_0xa160('0x33')]:_0x1dc04b[_0xa160('0x2e')];if(!_0xf51594[_0xa160('0x2f')]['hasOwnProperty'](_0xa160('0x36'))){_0x1aca54['limit']=qs[_0xa160('0x1b')](_0xf51594['query'][_0xa160('0x1b')]);_0x1aca54[_0xa160('0x1a')]=qs['offset'](_0xf51594[_0xa160('0x2f')][_0xa160('0x1a')]);}_0x1aca54['order']=qs[_0xa160('0x37')](_0xf51594['query'][_0xa160('0x37')]);_0x1aca54[_0xa160('0x38')]=qs[_0xa160('0x31')](_[_0xa160('0x39')](_0xf51594[_0xa160('0x2f')],_0x1dc04b[_0xa160('0x31')]),_0x187339);if(_0xf51594['query'][_0xa160('0x3a')]){_0x1aca54[_0xa160('0x38')]=_[_0xa160('0x3b')](_0x1aca54['where'],{'$or':_[_0xa160('0x28')](_0x187339,function(_0x3c6fed){if(_0x3c6fed['type']!=='VIRTUAL'){var _0x45a7f5={};_0x45a7f5[_0x3c6fed[_0xa160('0x25')]]={'$like':'%'+_0xf51594[_0xa160('0x2f')][_0xa160('0x3a')]+'%'};return _0x45a7f5;}})});}_0x1aca54=_[_0xa160('0x3b')]({},_0x1aca54,_0xf51594[_0xa160('0x3c')]);var _0x1fd2da={'where':_0x1aca54['where']};return db[_0xa160('0x29')]['count'](_0x1fd2da)['then'](function(_0x377af9){_0x4a7a26[_0xa160('0x3d')]=_0x377af9;if(_0xf51594[_0xa160('0x2f')][_0xa160('0x3e')]){_0x1aca54[_0xa160('0x3f')]=[{'all':!![]}];}return db['SalesforceField'][_0xa160('0x40')](_0x1aca54);})['then'](function(_0x389401){_0x4a7a26['rows']=_0x389401;return _0x4a7a26;})[_0xa160('0x22')](respondWithFilteredResult(_0x13104,_0x1aca54))[_0xa160('0x41')](handleError(_0x13104,null));};exports['show']=function(_0x43e71b,_0x9e08f6){var _0x524b35={'raw':!![],'where':{'id':_0x43e71b['params']['id']}},_0x3313dd={};_0x3313dd[_0xa160('0x2e')]=_[_0xa160('0x30')](db[_0xa160('0x29')]['rawAttributes']);_0x3313dd['query']=_[_0xa160('0x30')](_0x43e71b[_0xa160('0x2f')]);_0x3313dd[_0xa160('0x31')]=_[_0xa160('0x32')](_0x3313dd[_0xa160('0x2e')],_0x3313dd['query']);_0x524b35['attributes']=_[_0xa160('0x32')](_0x3313dd[_0xa160('0x2e')],qs[_0xa160('0x34')](_0x43e71b[_0xa160('0x2f')][_0xa160('0x34')]));_0x524b35['attributes']=_0x524b35[_0xa160('0x33')][_0xa160('0x35')]?_0x524b35[_0xa160('0x33')]:_0x3313dd[_0xa160('0x2e')];if(_0x43e71b['query'][_0xa160('0x3e')]){_0x524b35[_0xa160('0x3f')]=[{'all':!![]}];}_0x524b35=_[_0xa160('0x3b')]({},_0x524b35,_0x43e71b[_0xa160('0x3c')]);return db[_0xa160('0x29')]['find'](_0x524b35)[_0xa160('0x22')](handleEntityNotFound(_0x9e08f6,null))[_0xa160('0x22')](respondWithResult(_0x9e08f6,null))[_0xa160('0x41')](handleError(_0x9e08f6,null));};exports[_0xa160('0x42')]=function(_0x425bd6,_0x16cec2){return db[_0xa160('0x29')][_0xa160('0x42')](_0x425bd6['body'],{})[_0xa160('0x22')](respondWithResult(_0x16cec2,0xc9))[_0xa160('0x41')](handleError(_0x16cec2,null));};exports[_0xa160('0x21')]=function(_0x54726d,_0x119583){if(_0x54726d[_0xa160('0x43')]['id']){delete _0x54726d['body']['id'];}return db[_0xa160('0x29')][_0xa160('0x44')]({'where':{'id':_0x54726d['params']['id']}})[_0xa160('0x22')](handleEntityNotFound(_0x119583,null))['then'](saveUpdates(_0x54726d['body'],null))[_0xa160('0x22')](respondWithResult(_0x119583,null))['catch'](handleError(_0x119583,null));};exports[_0xa160('0x45')]=function(_0x10f0dd,_0x35ff35){return db[_0xa160('0x29')]['find']({'where':{'id':_0x10f0dd['params']['id']}})[_0xa160('0x22')](handleEntityNotFound(_0x35ff35,null))['then'](removeEntity(_0x35ff35,null))[_0xa160('0x41')](handleError(_0x35ff35,null));}; \ No newline at end of file +var _0xb45d=['filter','merge','VIRTUAL','options','SalesforceField','include','rows','catch','params','keys','includeAll','create','body','destroy','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','error','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick'];(function(_0x4bface,_0x1cdf5b){var _0xc2b3a7=function(_0x1fce06){while(--_0x1fce06){_0x4bface['push'](_0x4bface['shift']());}};_0xc2b3a7(++_0x1cdf5b);}(_0xb45d,0x186));var _0xdb45=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xb45d[_0x297fd3];return _0x2af381;};'use strict';var pdf=require(_0xdb45('0x0'));var emlformat=require(_0xdb45('0x1'));var rimraf=require(_0xdb45('0x2'));var zipdir=require(_0xdb45('0x3'));var jsonpatch=require(_0xdb45('0x4'));var rp=require('request-promise');var moment=require(_0xdb45('0x5'));var BPromise=require(_0xdb45('0x6'));var Mustache=require(_0xdb45('0x7'));var util=require('util');var path=require(_0xdb45('0x8'));var sox=require(_0xdb45('0x9'));var csv=require(_0xdb45('0xa'));var ejs=require(_0xdb45('0xb'));var fs=require('fs');var _=require(_0xdb45('0xc'));var squel=require(_0xdb45('0xd'));var crypto=require(_0xdb45('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdb45('0xa'));var querystring=require(_0xdb45('0xf'));var Papa=require(_0xdb45('0x10'));var Redis=require(_0xdb45('0x11'));var authService=require(_0xdb45('0x12'));var qs=require(_0xdb45('0x13'));var as=require(_0xdb45('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb45('0x15'))(_0xdb45('0x16'));var utils=require(_0xdb45('0x17'));var config=require(_0xdb45('0x18'));var licenseUtil=require(_0xdb45('0x19'));var db=require(_0xdb45('0x1a'))['db'];function respondWithStatusCode(_0x57755d,_0x21b67b){_0x21b67b=_0x21b67b||0xcc;return function(_0x7e15e8){if(_0x7e15e8){return _0x57755d[_0xdb45('0x1b')](_0x21b67b);}return _0x57755d[_0xdb45('0x1c')](_0x21b67b)[_0xdb45('0x1d')]();};}function respondWithResult(_0x461757,_0x1951dd){_0x1951dd=_0x1951dd||0xc8;return function(_0x89302b){if(_0x89302b){return _0x461757[_0xdb45('0x1c')](_0x1951dd)['json'](_0x89302b);}};}function respondWithFilteredResult(_0x3b3308,_0x552aaa){return function(_0x21031c){if(_0x21031c){var _0x223705=_0x21031c[_0xdb45('0x1e')],_0x4c8293=_0x552aaa['offset'],_0x3ce1ba=_0x552aaa[_0xdb45('0x1f')]+_0x552aaa[_0xdb45('0x20')],_0x2e547c;if(_0x3ce1ba>=_0x223705){_0x3ce1ba=_0x223705;_0x2e547c=0xc8;}else{_0x2e547c=0xce;}_0x3b3308[_0xdb45('0x1c')](_0x2e547c);return _0x3b3308[_0xdb45('0x21')]('Content-Range',_0x4c8293+'-'+_0x3ce1ba+'/'+_0x223705)[_0xdb45('0x22')](_0x21031c);}return null;};}function patchUpdates(_0x5262a2){return function(_0x1ceacc){try{jsonpatch[_0xdb45('0x23')](_0x1ceacc,_0x5262a2,!![]);}catch(_0x4cff36){return BPromise[_0xdb45('0x24')](_0x4cff36);}return _0x1ceacc[_0xdb45('0x25')]();};}function saveUpdates(_0x344359,_0x2a3cbc){return function(_0x271a2c){if(_0x271a2c){return _0x271a2c[_0xdb45('0x26')](_0x344359)['then'](function(_0x1a5db7){return _0x1a5db7;});}return null;};}function removeEntity(_0x525c5e,_0x279b39){return function(_0xe1936e){if(_0xe1936e){return _0xe1936e['destroy']()[_0xdb45('0x27')](function(){_0x525c5e[_0xdb45('0x1c')](0xcc)[_0xdb45('0x1d')]();});}};}function handleEntityNotFound(_0x3baf50,_0x13eb41){return function(_0x46a90f){if(!_0x46a90f){_0x3baf50['sendStatus'](0x194);}return _0x46a90f;};}function handleError(_0x426dd8,_0x3d7983){_0x3d7983=_0x3d7983||0x1f4;return function(_0x17f585){logger[_0xdb45('0x28')](_0x17f585['stack']);if(_0x17f585[_0xdb45('0x29')]){delete _0x17f585[_0xdb45('0x29')];}_0x426dd8['status'](_0x3d7983)['send'](_0x17f585);};}exports[_0xdb45('0x2a')]=function(_0x38f335,_0x342783){var _0x17d1b0={},_0x8f6fb2={},_0x10eeed={'count':0x0,'rows':[]};var _0x1ae6f5=_[_0xdb45('0x2b')](db['SalesforceField'][_0xdb45('0x2c')],function(_0x1dc86f){return{'name':_0x1dc86f[_0xdb45('0x2d')],'type':_0x1dc86f[_0xdb45('0x2e')][_0xdb45('0x2f')]};});_0x8f6fb2[_0xdb45('0x30')]=_[_0xdb45('0x2b')](_0x1ae6f5,'name');_0x8f6fb2[_0xdb45('0x31')]=_['keys'](_0x38f335['query']);_0x8f6fb2[_0xdb45('0x32')]=_[_0xdb45('0x33')](_0x8f6fb2['model'],_0x8f6fb2[_0xdb45('0x31')]);_0x17d1b0[_0xdb45('0x34')]=_['intersection'](_0x8f6fb2[_0xdb45('0x30')],qs[_0xdb45('0x35')](_0x38f335['query'][_0xdb45('0x35')]));_0x17d1b0[_0xdb45('0x34')]=_0x17d1b0[_0xdb45('0x34')][_0xdb45('0x36')]?_0x17d1b0[_0xdb45('0x34')]:_0x8f6fb2[_0xdb45('0x30')];if(!_0x38f335[_0xdb45('0x31')]['hasOwnProperty'](_0xdb45('0x37'))){_0x17d1b0[_0xdb45('0x20')]=qs['limit'](_0x38f335[_0xdb45('0x31')][_0xdb45('0x20')]);_0x17d1b0[_0xdb45('0x1f')]=qs['offset'](_0x38f335[_0xdb45('0x31')]['offset']);}_0x17d1b0[_0xdb45('0x38')]=qs[_0xdb45('0x39')](_0x38f335['query'][_0xdb45('0x39')]);_0x17d1b0[_0xdb45('0x3a')]=qs[_0xdb45('0x32')](_[_0xdb45('0x3b')](_0x38f335[_0xdb45('0x31')],_0x8f6fb2['filters']),_0x1ae6f5);if(_0x38f335[_0xdb45('0x31')][_0xdb45('0x3c')]){_0x17d1b0['where']=_[_0xdb45('0x3d')](_0x17d1b0['where'],{'$or':_[_0xdb45('0x2b')](_0x1ae6f5,function(_0x178629){if(_0x178629[_0xdb45('0x2e')]!==_0xdb45('0x3e')){var _0x50a39c={};_0x50a39c[_0x178629[_0xdb45('0x29')]]={'$like':'%'+_0x38f335[_0xdb45('0x31')][_0xdb45('0x3c')]+'%'};return _0x50a39c;}})});}_0x17d1b0=_[_0xdb45('0x3d')]({},_0x17d1b0,_0x38f335[_0xdb45('0x3f')]);var _0x3329e8={'where':_0x17d1b0[_0xdb45('0x3a')]};return db[_0xdb45('0x40')][_0xdb45('0x1e')](_0x3329e8)['then'](function(_0x3c3f2f){_0x10eeed[_0xdb45('0x1e')]=_0x3c3f2f;if(_0x38f335['query']['includeAll']){_0x17d1b0[_0xdb45('0x41')]=[{'all':!![]}];}return db[_0xdb45('0x40')]['findAll'](_0x17d1b0);})[_0xdb45('0x27')](function(_0x35be82){_0x10eeed[_0xdb45('0x42')]=_0x35be82;return _0x10eeed;})[_0xdb45('0x27')](respondWithFilteredResult(_0x342783,_0x17d1b0))[_0xdb45('0x43')](handleError(_0x342783,null));};exports['show']=function(_0x3c3c7f,_0x49aeda){var _0x4a62c1={'raw':!![],'where':{'id':_0x3c3c7f[_0xdb45('0x44')]['id']}},_0x9b3415={};_0x9b3415[_0xdb45('0x30')]=_[_0xdb45('0x45')](db[_0xdb45('0x40')]['rawAttributes']);_0x9b3415[_0xdb45('0x31')]=_[_0xdb45('0x45')](_0x3c3c7f[_0xdb45('0x31')]);_0x9b3415[_0xdb45('0x32')]=_[_0xdb45('0x33')](_0x9b3415[_0xdb45('0x30')],_0x9b3415['query']);_0x4a62c1[_0xdb45('0x34')]=_[_0xdb45('0x33')](_0x9b3415[_0xdb45('0x30')],qs[_0xdb45('0x35')](_0x3c3c7f[_0xdb45('0x31')][_0xdb45('0x35')]));_0x4a62c1[_0xdb45('0x34')]=_0x4a62c1[_0xdb45('0x34')][_0xdb45('0x36')]?_0x4a62c1[_0xdb45('0x34')]:_0x9b3415['model'];if(_0x3c3c7f[_0xdb45('0x31')][_0xdb45('0x46')]){_0x4a62c1['include']=[{'all':!![]}];}_0x4a62c1=_[_0xdb45('0x3d')]({},_0x4a62c1,_0x3c3c7f['options']);return db['SalesforceField']['find'](_0x4a62c1)[_0xdb45('0x27')](handleEntityNotFound(_0x49aeda,null))[_0xdb45('0x27')](respondWithResult(_0x49aeda,null))[_0xdb45('0x43')](handleError(_0x49aeda,null));};exports['create']=function(_0x590ff2,_0x27b437){return db[_0xdb45('0x40')][_0xdb45('0x47')](_0x590ff2[_0xdb45('0x48')],{})[_0xdb45('0x27')](respondWithResult(_0x27b437,0xc9))[_0xdb45('0x43')](handleError(_0x27b437,null));};exports[_0xdb45('0x26')]=function(_0x4e4557,_0x54bd99){if(_0x4e4557[_0xdb45('0x48')]['id']){delete _0x4e4557['body']['id'];}return db['SalesforceField']['find']({'where':{'id':_0x4e4557[_0xdb45('0x44')]['id']}})[_0xdb45('0x27')](handleEntityNotFound(_0x54bd99,null))[_0xdb45('0x27')](saveUpdates(_0x4e4557[_0xdb45('0x48')],null))[_0xdb45('0x27')](respondWithResult(_0x54bd99,null))['catch'](handleError(_0x54bd99,null));};exports[_0xdb45('0x49')]=function(_0x1b384b,_0x393d9f){return db[_0xdb45('0x40')][_0xdb45('0x4a')]({'where':{'id':_0x1b384b[_0xdb45('0x44')]['id']}})[_0xdb45('0x27')](handleEntityNotFound(_0x393d9f,null))[_0xdb45('0x27')](removeEntity(_0x393d9f,null))[_0xdb45('0x43')](handleError(_0x393d9f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 145a424..c3fd975 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 _0xd74c=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','idField','FieldId'];(function(_0x1ff977,_0x3d1a3d){var _0x2d3381=function(_0x2b84bb){while(--_0x2b84bb){_0x1ff977['push'](_0x1ff977['shift']());}};_0x2d3381(++_0x3d1a3d);}(_0xd74c,0xb4));var _0xcd74=function(_0x211560,_0x31f292){_0x211560=_0x211560-0x0;var _0x512d56=_0xd74c[_0x211560];return _0x512d56;};'use strict';var _=require('lodash');var util=require(_0xcd74('0x0'));var logger=require(_0xcd74('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcd74('0x2'));var rp=require(_0xcd74('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd74('0x4'));var config=require(_0xcd74('0x5'));var attributes=require(_0xcd74('0x6'));module['exports']=function(_0x215ee5,_0x122714){return _0x215ee5[_0xcd74('0x7')](_0xcd74('0x8'),attributes,{'tableName':_0xcd74('0x9'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xcd74('0xa'),_0xcd74('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d4c=['../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','idField','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1daa97,_0xbaa3fc){var _0x551a31=function(_0x5a9191){while(--_0x5a9191){_0x1daa97['push'](_0x1daa97['shift']());}};_0x551a31(++_0xbaa3fc);}(_0x8d4c,0x173));var _0xc8d4=function(_0xac6fdf,_0x315296){_0xac6fdf=_0xac6fdf-0x0;var _0x56d02f=_0x8d4c[_0xac6fdf];return _0x56d02f;};'use strict';var _=require(_0xc8d4('0x0'));var util=require('util');var logger=require(_0xc8d4('0x1'))(_0xc8d4('0x2'));var moment=require(_0xc8d4('0x3'));var BPromise=require('bluebird');var rp=require(_0xc8d4('0x4'));var fs=require('fs');var path=require(_0xc8d4('0x5'));var rimraf=require(_0xc8d4('0x6'));var config=require(_0xc8d4('0x7'));var attributes=require(_0xc8d4('0x8'));module[_0xc8d4('0x9')]=function(_0x1838f5,_0x4258ec){return _0x1838f5[_0xc8d4('0xa')](_0xc8d4('0xb'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xc8d4('0xc'),'fields':[_0xc8d4('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index a26ec08..f275bce 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 _0xa571=['request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http'];(function(_0x337a10,_0x5191c7){var _0x575f98=function(_0x3851cd){while(--_0x3851cd){_0x337a10['push'](_0x337a10['shift']());}};_0x575f98(++_0x5191c7);}(_0xa571,0x107));var _0x1a57=function(_0x79a609,_0x4565f1){_0x79a609=_0x79a609-0x0;var _0x3b6943=_0xa571[_0x79a609];return _0x3b6943;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var moment=require(_0x1a57('0x2'));var BPromise=require(_0x1a57('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a57('0x4'));var db=require(_0x1a57('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a57('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a57('0x7'));var client=jayson[_0x1a57('0x8')][_0x1a57('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5352,_0x2492f5,_0x924873){return new BPromise(function(_0x5d9f45,_0x3edb40){return client[_0x1a57('0xa')](_0x3c5352,_0x924873)[_0x1a57('0xb')](function(_0x58e266){logger[_0x1a57('0xc')](_0x1a57('0xd'),_0x2492f5,_0x1a57('0xe'));logger[_0x1a57('0xf')](_0x1a57('0x10'),_0x2492f5,_0x1a57('0xe'),JSON[_0x1a57('0x11')](_0x58e266));if(_0x58e266[_0x1a57('0x12')]){if(_0x58e266['error']['code']===0x1f4){logger[_0x1a57('0x12')](_0x1a57('0xd'),_0x2492f5,_0x58e266[_0x1a57('0x12')]['message']);return _0x3edb40(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}logger['error'](_0x1a57('0xd'),_0x2492f5,_0x58e266['error'][_0x1a57('0x13')]);return _0x5d9f45(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}else{logger[_0x1a57('0xc')]('SalesforceField,\x20%s,\x20%s',_0x2492f5,_0x1a57('0xe'));_0x5d9f45(_0x58e266['result']['message']);}})[_0x1a57('0x14')](function(_0x1c537f){logger[_0x1a57('0x12')]('SalesforceField,\x20%s,\x20%s',_0x2492f5,_0x1c537f);_0x3edb40(_0x1c537f);});});} \ 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(_0x3c5c6a,_0x5e63b9){var _0xa96586=function(_0x43e9b1){while(--_0x43e9b1){_0x3c5c6a['push'](_0x3c5c6a['shift']());}};_0xa96586(++_0x5e63b9);}(_0x4483,0x1a3));var _0x3448=function(_0x414ec3,_0x3ae4f2){_0x414ec3=_0x414ec3-0x0;var _0x9ed331=_0x4483[_0x414ec3];return _0x9ed331;};'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 e06a4c3..3b1f214 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 _0xc684=['/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc684,0x199));var _0x4c68=function(_0x519e45,_0x50e90d){_0x519e45=_0x519e45-0x0;var _0x321246=_0xc684[_0x519e45];return _0x321246;};'use strict';var multer=require(_0x4c68('0x0'));var util=require('util');var path=require(_0x4c68('0x1'));var timeout=require(_0x4c68('0x2'));var express=require(_0x4c68('0x3'));var router=express[_0x4c68('0x4')]();var auth=require(_0x4c68('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4c68('0x6'));var controller=require(_0x4c68('0x7'));router[_0x4c68('0x8')]('/',auth[_0x4c68('0x9')](),controller[_0x4c68('0xa')]);router[_0x4c68('0x8')]('/:id',auth[_0x4c68('0x9')](),controller['show']);router['get'](_0x4c68('0xb'),auth[_0x4c68('0x9')](),controller[_0x4c68('0xc')]);router[_0x4c68('0x8')](_0x4c68('0xd'),auth[_0x4c68('0x9')](),controller[_0x4c68('0xe')]);router['post']('/',auth[_0x4c68('0x9')](),controller['create']);router['post'](_0x4c68('0xb'),auth[_0x4c68('0x9')](),controller[_0x4c68('0xf')]);router[_0x4c68('0x10')](_0x4c68('0x11'),auth[_0x4c68('0x9')](),controller[_0x4c68('0x12')]);router[_0x4c68('0x13')]('/:id',auth[_0x4c68('0x9')](),controller[_0x4c68('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf891=['getFields','post','create','addConfiguration','update','destroy','exports','multer','util','express','Router','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0xf87ea8,_0x457423){var _0x399f04=function(_0x271d9c){while(--_0x271d9c){_0xf87ea8['push'](_0xf87ea8['shift']());}};_0x399f04(++_0x457423);}(_0xf891,0x93));var _0x1f89=function(_0x516f7e,_0x4029e3){_0x516f7e=_0x516f7e-0x0;var _0x3b7472=_0xf891[_0x516f7e];return _0x3b7472;};'use strict';var multer=require(_0x1f89('0x0'));var util=require(_0x1f89('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1f89('0x2'));var router=express[_0x1f89('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1f89('0x4'));var config=require('../../config/environment');var controller=require(_0x1f89('0x5'));router[_0x1f89('0x6')]('/',auth[_0x1f89('0x7')](),controller['index']);router[_0x1f89('0x6')](_0x1f89('0x8'),auth['isAuthenticated'](),controller[_0x1f89('0x9')]);router[_0x1f89('0x6')](_0x1f89('0xa'),auth[_0x1f89('0x7')](),controller[_0x1f89('0xb')]);router[_0x1f89('0x6')](_0x1f89('0xc'),auth['isAuthenticated'](),controller[_0x1f89('0xd')]);router[_0x1f89('0xe')]('/',auth[_0x1f89('0x7')](),controller[_0x1f89('0xf')]);router[_0x1f89('0xe')](_0x1f89('0xa'),auth[_0x1f89('0x7')](),controller[_0x1f89('0x10')]);router['put'](_0x1f89('0x8'),auth[_0x1f89('0x7')](),controller[_0x1f89('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1f89('0x12')]);module[_0x1f89('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 33c6f0c..44f8209 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 _0xa253=['STRING','username','remoteUri','sequelize','exports'];(function(_0x2beaf4,_0x4626b3){var _0x5d639d=function(_0x5a8032){while(--_0x5a8032){_0x2beaf4['push'](_0x2beaf4['shift']());}};_0x5d639d(++_0x4626b3);}(_0xa253,0x1de));var _0x3a25=function(_0x2f6799,_0x4e7f00){_0x2f6799=_0x2f6799-0x0;var _0x3cb26f=_0xa253[_0x2f6799];return _0x3cb26f;};'use strict';var Sequelize=require(_0x3a25('0x0'));module[_0x3a25('0x1')]={'name':{'type':Sequelize[_0x3a25('0x2')]},'description':{'type':Sequelize[_0x3a25('0x2')]},'username':{'type':Sequelize[_0x3a25('0x2')],'unique':_0x3a25('0x3')},'password':{'type':Sequelize[_0x3a25('0x2')]},'email':{'type':Sequelize[_0x3a25('0x2')]},'remoteUri':{'type':Sequelize[_0x3a25('0x2')],'unique':_0x3a25('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x574a=['sequelize','exports','STRING','username','remoteUri'];(function(_0x3abd6f,_0x44521d){var _0x4e05a2=function(_0xc4ba72){while(--_0xc4ba72){_0x3abd6f['push'](_0x3abd6f['shift']());}};_0x4e05a2(++_0x44521d);}(_0x574a,0x7d));var _0xa574=function(_0x2769b5,_0x27cd7a){_0x2769b5=_0x2769b5-0x0;var _0x513fab=_0x574a[_0x2769b5];return _0x513fab;};'use strict';var Sequelize=require(_0xa574('0x0'));module[_0xa574('0x1')]={'name':{'type':Sequelize[_0xa574('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa574('0x2')],'unique':_0xa574('0x3')},'password':{'type':Sequelize[_0xa574('0x2')]},'email':{'type':Sequelize[_0xa574('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xa574('0x4')},'serverUrl':{'type':Sequelize[_0xa574('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 4504909..ce38fdd 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 _0xf754=['Wrong\x20credentials','boolean','True','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','zip-dir','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','stack','name','send','index','ServicenowAccount','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','show','fields','create','body','find','params','destroy','getConfigurations','findOne','ServicenowConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','subcategory','close_code','severity','category','caused_by','watch_list','upon_reject','child_incidents','hold_reason','approval_history','resolved_by','sys_updated_by','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','delivery_plan','impact','active','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','work_notes','correlation_display','delivery_task','assignment_group','calendar_duration','notify','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','password','remoteUri','substring','lastIndexOf','format','%s/api/now/table/','username','result','log','assign','remove','includes','forEach','internalType','push','TCL:\x20_object','label','all','concat','test','statusCode'];(function(_0x2fd933,_0x54bfd4){var _0x1ba837=function(_0x1db146){while(--_0x1db146){_0x2fd933['push'](_0x2fd933['shift']());}};_0x1ba837(++_0x54bfd4);}(_0xf754,0xc4));var _0x4f75=function(_0x2f4e7c,_0x54e4dc){_0x2f4e7c=_0x2f4e7c-0x0;var _0x370015=_0xf754[_0x2f4e7c];return _0x370015;};'use strict';var pdf=require(_0x4f75('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4f75('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4f75('0x2'));var util=require(_0x4f75('0x3'));var path=require(_0x4f75('0x4'));var sox=require('sox');var csv=require(_0x4f75('0x5'));var ejs=require(_0x4f75('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4f75('0x7'));var jsforce=require(_0x4f75('0x8'));var deskjs=require(_0x4f75('0x9'));var toCsv=require(_0x4f75('0x5'));var querystring=require('querystring');var Papa=require(_0x4f75('0xa'));var Redis=require(_0x4f75('0xb'));var authService=require(_0x4f75('0xc'));var qs=require(_0x4f75('0xd'));var as=require(_0x4f75('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f75('0xf'))('api');var utils=require(_0x4f75('0x10'));var config=require(_0x4f75('0x11'));var licenseUtil=require(_0x4f75('0x12'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x4f75('0x13'));var client=jayson['client'][_0x4f75('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x19eb8d,_0x5586fa,_0x428d0e,_0x12ff06){return new BPromise(function(_0x3d3431,_0x194c91){var _0x538422=_0x12ff06||client;return _0x538422[_0x4f75('0x15')](_0x19eb8d,_0x428d0e)[_0x4f75('0x16')](function(_0x433501){logger['info'](_0x4f75('0x17'),_0x5586fa,_0x4f75('0x18'));logger['debug'](_0x4f75('0x19'),_0x5586fa,_0x4f75('0x18'),JSON[_0x4f75('0x1a')](_0x433501));if(_0x433501[_0x4f75('0x1b')]){if(_0x433501[_0x4f75('0x1b')][_0x4f75('0x1c')]===0x1f4){logger[_0x4f75('0x1b')](_0x4f75('0x17'),_0x5586fa,_0x433501[_0x4f75('0x1b')][_0x4f75('0x1d')]);return _0x194c91(_0x433501['error'][_0x4f75('0x1d')]);}logger[_0x4f75('0x1b')](_0x4f75('0x17'),_0x5586fa,_0x433501[_0x4f75('0x1b')][_0x4f75('0x1d')]);return _0x3d3431(_0x433501['error'][_0x4f75('0x1d')]);}else{logger[_0x4f75('0x1e')](_0x4f75('0x17'),_0x5586fa,_0x4f75('0x18'));_0x3d3431(_0x433501['result'][_0x4f75('0x1d')]);}})['catch'](function(_0x5ba150){logger[_0x4f75('0x1b')]('ServicenowAccount,\x20%s,\x20%s',_0x5586fa,_0x5ba150);_0x194c91(_0x5ba150);});});}function respondWithStatusCode(_0x263559,_0x260e40){_0x260e40=_0x260e40||0xcc;return function(_0x4049d1){if(_0x4049d1){return _0x263559[_0x4f75('0x1f')](_0x260e40);}return _0x263559[_0x4f75('0x20')](_0x260e40)[_0x4f75('0x21')]();};}function respondWithResult(_0x584735,_0x493da4){_0x493da4=_0x493da4||0xc8;return function(_0x4dec78){if(_0x4dec78){return _0x584735[_0x4f75('0x20')](_0x493da4)[_0x4f75('0x22')](_0x4dec78);}};}function respondWithFilteredResult(_0x26473f,_0x46f92c){return function(_0x430891){if(_0x430891){var _0x41ddef=_0x430891['count'],_0x3ffd1d=_0x46f92c['offset'],_0x5841ee=_0x46f92c[_0x4f75('0x23')]+_0x46f92c[_0x4f75('0x24')],_0xfa9afb;if(_0x5841ee>=_0x41ddef){_0x5841ee=_0x41ddef;_0xfa9afb=0xc8;}else{_0xfa9afb=0xce;}_0x26473f[_0x4f75('0x20')](_0xfa9afb);return _0x26473f[_0x4f75('0x25')](_0x4f75('0x26'),_0x3ffd1d+'-'+_0x5841ee+'/'+_0x41ddef)[_0x4f75('0x22')](_0x430891);}return null;};}function patchUpdates(_0x20dde2){return function(_0x481652){try{jsonpatch['apply'](_0x481652,_0x20dde2,!![]);}catch(_0x13aec5){return BPromise[_0x4f75('0x27')](_0x13aec5);}return _0x481652[_0x4f75('0x28')]();};}function saveUpdates(_0x603a95,_0x3a65af){return function(_0xfaf509){if(_0xfaf509){return _0xfaf509[_0x4f75('0x29')](_0x603a95)[_0x4f75('0x16')](function(_0x3249e3){return _0x3249e3;});}return null;};}function removeEntity(_0x3a676f,_0x15beca){return function(_0x488447){if(_0x488447){return _0x488447['destroy']()[_0x4f75('0x16')](function(){_0x3a676f['status'](0xcc)[_0x4f75('0x21')]();});}};}function handleEntityNotFound(_0x5a6c8d,_0x11b42c){return function(_0x597f9d){if(!_0x597f9d){_0x5a6c8d[_0x4f75('0x1f')](0x194);}return _0x597f9d;};}function handleError(_0x1f9c86,_0x2732f8){_0x2732f8=_0x2732f8||0x1f4;return function(_0x1ac574){logger['error'](_0x1ac574[_0x4f75('0x2a')]);if(_0x1ac574[_0x4f75('0x2b')]){delete _0x1ac574[_0x4f75('0x2b')];}_0x1f9c86[_0x4f75('0x20')](_0x2732f8)[_0x4f75('0x2c')](_0x1ac574);};}exports[_0x4f75('0x2d')]=function(_0x2df870,_0x382abc){var _0x35f446={},_0xfb1712={},_0x2d7e79={'count':0x0,'rows':[]};var _0x5adc69=_['map'](db[_0x4f75('0x2e')][_0x4f75('0x2f')],function(_0x3d1c00){return{'name':_0x3d1c00['fieldName'],'type':_0x3d1c00['type'][_0x4f75('0x30')]};});_0xfb1712[_0x4f75('0x31')]=_[_0x4f75('0x32')](_0x5adc69,_0x4f75('0x2b'));_0xfb1712[_0x4f75('0x33')]=_[_0x4f75('0x34')](_0x2df870[_0x4f75('0x33')]);_0xfb1712[_0x4f75('0x35')]=_[_0x4f75('0x36')](_0xfb1712[_0x4f75('0x31')],_0xfb1712[_0x4f75('0x33')]);_0x35f446[_0x4f75('0x37')]=_['intersection'](_0xfb1712['model'],qs['fields'](_0x2df870[_0x4f75('0x33')]['fields']));_0x35f446['attributes']=_0x35f446[_0x4f75('0x37')][_0x4f75('0x38')]?_0x35f446[_0x4f75('0x37')]:_0xfb1712['model'];if(!_0x2df870[_0x4f75('0x33')]['hasOwnProperty'](_0x4f75('0x39'))){_0x35f446['limit']=qs[_0x4f75('0x24')](_0x2df870[_0x4f75('0x33')][_0x4f75('0x24')]);_0x35f446['offset']=qs['offset'](_0x2df870[_0x4f75('0x33')][_0x4f75('0x23')]);}_0x35f446[_0x4f75('0x3a')]=qs['sort'](_0x2df870[_0x4f75('0x33')][_0x4f75('0x3b')]);_0x35f446[_0x4f75('0x3c')]=qs['filters'](_[_0x4f75('0x3d')](_0x2df870[_0x4f75('0x33')],_0xfb1712[_0x4f75('0x35')]),_0x5adc69);if(_0x2df870[_0x4f75('0x33')][_0x4f75('0x3e')]){_0x35f446[_0x4f75('0x3c')]=_[_0x4f75('0x3f')](_0x35f446[_0x4f75('0x3c')],{'$or':_[_0x4f75('0x32')](_0x5adc69,function(_0x2c436b){if(_0x2c436b[_0x4f75('0x40')]!==_0x4f75('0x41')){var _0xd98731={};_0xd98731[_0x2c436b[_0x4f75('0x2b')]]={'$like':'%'+_0x2df870[_0x4f75('0x33')][_0x4f75('0x3e')]+'%'};return _0xd98731;}})});}_0x35f446=_['merge']({},_0x35f446,_0x2df870[_0x4f75('0x42')]);var _0x11979d={'where':_0x35f446[_0x4f75('0x3c')]};return db[_0x4f75('0x2e')][_0x4f75('0x43')](_0x11979d)[_0x4f75('0x16')](function(_0x537446){_0x2d7e79[_0x4f75('0x43')]=_0x537446;if(_0x2df870[_0x4f75('0x33')][_0x4f75('0x44')]){_0x35f446[_0x4f75('0x45')]=[{'all':!![]}];}return db[_0x4f75('0x2e')][_0x4f75('0x46')](_0x35f446);})['then'](function(_0x249f78){_0x2d7e79['rows']=_0x249f78;return _0x2d7e79;})[_0x4f75('0x16')](respondWithFilteredResult(_0x382abc,_0x35f446))[_0x4f75('0x47')](handleError(_0x382abc,null));};exports[_0x4f75('0x48')]=function(_0xc60ca,_0x49a1a6){var _0xd88e4d={'raw':![],'where':{'id':_0xc60ca['params']['id']}},_0x2e1a6f={};_0x2e1a6f[_0x4f75('0x31')]=_[_0x4f75('0x34')](db[_0x4f75('0x2e')][_0x4f75('0x2f')]);_0x2e1a6f[_0x4f75('0x33')]=_[_0x4f75('0x34')](_0xc60ca['query']);_0x2e1a6f['filters']=_[_0x4f75('0x36')](_0x2e1a6f[_0x4f75('0x31')],_0x2e1a6f['query']);_0xd88e4d[_0x4f75('0x37')]=_[_0x4f75('0x36')](_0x2e1a6f[_0x4f75('0x31')],qs[_0x4f75('0x49')](_0xc60ca[_0x4f75('0x33')][_0x4f75('0x49')]));_0xd88e4d[_0x4f75('0x37')]=_0xd88e4d['attributes'][_0x4f75('0x38')]?_0xd88e4d[_0x4f75('0x37')]:_0x2e1a6f[_0x4f75('0x31')];if(_0xc60ca[_0x4f75('0x33')][_0x4f75('0x44')]){_0xd88e4d[_0x4f75('0x45')]=[{'all':!![]}];}_0xd88e4d=_[_0x4f75('0x3f')]({},_0xd88e4d,_0xc60ca[_0x4f75('0x42')]);return db[_0x4f75('0x2e')]['find'](_0xd88e4d)[_0x4f75('0x16')](handleEntityNotFound(_0x49a1a6,null))['then'](respondWithResult(_0x49a1a6,null))[_0x4f75('0x47')](handleError(_0x49a1a6,null));};exports[_0x4f75('0x4a')]=function(_0x9613c7,_0xac0ee1){return db[_0x4f75('0x2e')][_0x4f75('0x4a')](_0x9613c7['body'],{})[_0x4f75('0x16')](respondWithResult(_0xac0ee1,0xc9))[_0x4f75('0x47')](handleError(_0xac0ee1,null));};exports[_0x4f75('0x29')]=function(_0x2a0975,_0x93aa2b){if(_0x2a0975[_0x4f75('0x4b')]['id']){delete _0x2a0975['body']['id'];}return db[_0x4f75('0x2e')][_0x4f75('0x4c')]({'where':{'id':_0x2a0975[_0x4f75('0x4d')]['id']}})[_0x4f75('0x16')](handleEntityNotFound(_0x93aa2b,null))[_0x4f75('0x16')](saveUpdates(_0x2a0975['body'],null))[_0x4f75('0x16')](respondWithResult(_0x93aa2b,null))[_0x4f75('0x47')](handleError(_0x93aa2b,null));};exports[_0x4f75('0x4e')]=function(_0x293787,_0x4dc128){return db[_0x4f75('0x2e')][_0x4f75('0x4c')]({'where':{'id':_0x293787[_0x4f75('0x4d')]['id']}})[_0x4f75('0x16')](handleEntityNotFound(_0x4dc128,null))['then'](removeEntity(_0x4dc128,null))[_0x4f75('0x47')](handleError(_0x4dc128,null));};exports[_0x4f75('0x4f')]=function(_0x42ec0a,_0x16533c,_0x2483ed){var _0x11529a={};var _0x4fec4a={};var _0x5bd066;var _0x55a66c;return db[_0x4f75('0x2e')][_0x4f75('0x50')]({'where':{'id':_0x42ec0a[_0x4f75('0x4d')]['id']}})[_0x4f75('0x16')](handleEntityNotFound(_0x16533c,null))[_0x4f75('0x16')](function(_0x311945){if(_0x311945){_0x5bd066=_0x311945;_0x4fec4a['model']=_[_0x4f75('0x34')](db[_0x4f75('0x51')][_0x4f75('0x2f')]);_0x4fec4a['query']=_[_0x4f75('0x34')](_0x42ec0a[_0x4f75('0x33')]);_0x4fec4a[_0x4f75('0x35')]=_[_0x4f75('0x36')](_0x4fec4a[_0x4f75('0x31')],_0x4fec4a[_0x4f75('0x33')]);_0x11529a['attributes']=_[_0x4f75('0x36')](_0x4fec4a[_0x4f75('0x31')],qs[_0x4f75('0x49')](_0x42ec0a['query'][_0x4f75('0x49')]));_0x11529a[_0x4f75('0x37')]=_0x11529a[_0x4f75('0x37')][_0x4f75('0x38')]?_0x11529a[_0x4f75('0x37')]:_0x4fec4a[_0x4f75('0x31')];_0x11529a[_0x4f75('0x3a')]=qs['sort'](_0x42ec0a[_0x4f75('0x33')][_0x4f75('0x3b')]);_0x11529a[_0x4f75('0x3c')]=qs['filters'](_[_0x4f75('0x3d')](_0x42ec0a[_0x4f75('0x33')],_0x4fec4a[_0x4f75('0x35')]));if(_0x42ec0a[_0x4f75('0x33')][_0x4f75('0x3e')]){_0x11529a['where']=_['merge'](_0x11529a[_0x4f75('0x3c')],{'$or':_['map'](_0x11529a[_0x4f75('0x37')],function(_0x3b4fae){var _0x5ec999={};_0x5ec999[_0x3b4fae]={'$like':'%'+_0x42ec0a['query'][_0x4f75('0x3e')]+'%'};return _0x5ec999;})});}_0x11529a=_[_0x4f75('0x3f')]({},_0x11529a,_0x42ec0a[_0x4f75('0x42')]);return _0x5bd066['getConfigurations'](_0x11529a);}})['then'](function(_0x46031c){if(_0x46031c){_0x55a66c=_0x46031c[_0x4f75('0x38')];if(!_0x42ec0a['query']['hasOwnProperty']('nolimit')){_0x11529a[_0x4f75('0x24')]=qs[_0x4f75('0x24')](_0x42ec0a[_0x4f75('0x33')][_0x4f75('0x24')]);_0x11529a[_0x4f75('0x23')]=qs['offset'](_0x42ec0a[_0x4f75('0x33')][_0x4f75('0x23')]);}return _0x5bd066[_0x4f75('0x4f')](_0x11529a);}})['then'](function(_0x4a82b7){if(_0x4a82b7){return _0x4a82b7?{'count':_0x55a66c,'rows':_0x4a82b7}:null;}})[_0x4f75('0x16')](respondWithResult(_0x16533c,null))['catch'](handleError(_0x16533c,null));};exports['addConfiguration']=function(_0x21730a,_0xb98b42,_0x174e8f){if(_0x21730a[_0x4f75('0x4b')]['id']){delete _0x21730a[_0x4f75('0x4b')]['id'];}return db[_0x4f75('0x2e')][_0x4f75('0x50')]({'where':{'id':_0x21730a[_0x4f75('0x4d')]['id']}})['then'](handleEntityNotFound(_0xb98b42,null))[_0x4f75('0x16')](function(_0x547bbe){if(_0x547bbe){_0x21730a[_0x4f75('0x4b')][_0x4f75('0x52')]=_0x547bbe['id'];_0x21730a[_0x4f75('0x4b')][_0x4f75('0x53')]=integrations[_0x4f75('0x54')](_0x21730a[_0x4f75('0x4b')][_0x4f75('0x55')],_0x21730a['body'][_0x4f75('0x40')]);_0x21730a[_0x4f75('0x4b')][_0x4f75('0x56')]=integrations[_0x4f75('0x57')](_0x21730a['body']['channel'],_0x21730a[_0x4f75('0x4b')][_0x4f75('0x40')]);return db['ServicenowConfiguration'][_0x4f75('0x4a')](_0x21730a[_0x4f75('0x4b')],{'include':[{'model':db[_0x4f75('0x58')],'as':_0x4f75('0x53')},{'model':db[_0x4f75('0x58')],'as':'Descriptions'}]});}return null;})[_0x4f75('0x16')](respondWithResult(_0xb98b42,null))[_0x4f75('0x47')](handleError(_0xb98b42,null));};exports[_0x4f75('0x59')]=function(_0x2e4dd5,_0x2f03cd,_0x50572f){var _0x27e73e=[_0x4f75('0x5a'),'hold_reason','knowledge',_0x4f75('0x5b'),_0x4f75('0x5c'),'notify','incident_state',_0x4f75('0x5d'),_0x4f75('0x5e')];var _0x12c72c=['parent',_0x4f75('0x5a'),_0x4f75('0x5f'),_0x4f75('0x60'),_0x4f75('0x61'),'sys_updated_on',_0x4f75('0x62'),_0x4f75('0x63'),_0x4f75('0x64'),'number',_0x4f75('0x65'),_0x4f75('0x66'),'opened_by','user_input',_0x4f75('0x67'),_0x4f75('0x68'),_0x4f75('0x69'),_0x4f75('0x6a'),_0x4f75('0x6b'),_0x4f75('0x3a'),_0x4f75('0x6c'),_0x4f75('0x6d'),'cmdb_ci',_0x4f75('0x6e'),_0x4f75('0x6f'),_0x4f75('0x70'),'work_notes_list',_0x4f75('0x71'),_0x4f75('0x72'),_0x4f75('0x73'),_0x4f75('0x74'),_0x4f75('0x75'),_0x4f75('0x76'),_0x4f75('0x77'),'business_duration',_0x4f75('0x78'),_0x4f75('0x79'),_0x4f75('0x7a'),_0x4f75('0x7b'),_0x4f75('0x7c'),'approval_set',_0x4f75('0x5b'),_0x4f75('0x7d'),'short_description',_0x4f75('0x5c'),_0x4f75('0x7e'),_0x4f75('0x7f'),'work_start',_0x4f75('0x80'),'business_stc','additional_assignee_list','description',_0x4f75('0x81'),_0x4f75('0x82'),'sys_class_name',_0x4f75('0x83'),_0x4f75('0x84'),_0x4f75('0x85'),_0x4f75('0x86'),_0x4f75('0x87'),_0x4f75('0x88'),_0x4f75('0x89'),'incident_state',_0x4f75('0x8a'),_0x4f75('0x8b'),_0x4f75('0x8c'),'reassignment_count',_0x4f75('0x8d'),_0x4f75('0x8e'),'severity',_0x4f75('0x8f'),_0x4f75('0x90'),_0x4f75('0x91'),_0x4f75('0x92'),_0x4f75('0x93'),_0x4f75('0x94'),_0x4f75('0x95'),_0x4f75('0x96'),_0x4f75('0x97'),_0x4f75('0x98'),_0x4f75('0x99'),_0x4f75('0x9a'),_0x4f75('0x5e')];var _0x4cf479='';var _0x37fd9d='';var _0x409eb8=[];var _0x1c86b2='';var _0x3d269f='';var _0x6ffd82=[];var _0x27db3e='';var _0xcc6593='';var _0x2c5c71={};var _0x2a3fca='';return db[_0x4f75('0x2e')]['findOne']({'where':{'id':_0x2e4dd5[_0x4f75('0x4d')]['id']},'attributes':['id','username',_0x4f75('0x9b'),'email',_0x4f75('0x9c'),'serverUrl']})[_0x4f75('0x16')](handleEntityNotFound(_0x2f03cd,null))[_0x4f75('0x16')](function(_0x417f5c){if(_0x417f5c){_0x2a3fca=_0x417f5c[_0x4f75('0x9c')];var _0x1c5fc7=_0x2a3fca['slice'](-0x1);if(_0x1c5fc7==='/'){_0x2a3fca=_0x2a3fca[_0x4f75('0x9d')](0x0,_0x2a3fca[_0x4f75('0x9e')](_0x1c5fc7));}_0xcc6593=util[_0x4f75('0x9f')]('%s/api/now/doc/table/schema/',_0x2a3fca);_0x27db3e=util[_0x4f75('0x9f')](_0x4f75('0xa0'),_0x2a3fca);_0x2c5c71={'user':_0x417f5c[_0x4f75('0xa1')],'pass':_0x417f5c[_0x4f75('0x9b')]};var _0x587bc0={'method':'GET','uri':_0xcc6593+'incident?sysparm_display_value=all','auth':_0x2c5c71,'json':!![]};return rp(_0x587bc0);}})['then'](function(_0x3552b9){if(_0x3552b9[_0x4f75('0xa2')][_0x4f75('0x38')]>0x0){_0x4cf479=_0x3552b9['result'];}console[_0x4f75('0xa3')]('incident\x20table\x20objects',_0x4cf479);_0x6ffd82=[];_0x37fd9d=Object[_0x4f75('0xa4')]([],_0x4cf479);_[_0x4f75('0xa5')](_0x37fd9d,function(_0x5d34e7){return!_0x27e73e[_0x4f75('0xa6')](_0x5d34e7[_0x4f75('0x2b')]);});_0x37fd9d[_0x4f75('0xa7')](function(_0x307aea){var _0x4ddf39=createFieldObject(_0x27db3e,_0x2c5c71,_0x307aea[_0x4f75('0xa8')],_0x307aea[_0x4f75('0x2b')],_0x307aea['label'],![]);_0x6ffd82[_0x4f75('0xa9')](_0x4ddf39);});return Promise['all'](_0x6ffd82);})[_0x4f75('0x16')](function(_0x12110f){_0x409eb8=_0x12110f;_0x1c86b2=Object[_0x4f75('0xa4')]([],_0x4cf479);console[_0x4f75('0xa3')](_0x4f75('0xaa'),_0x4cf479);_[_0x4f75('0xa5')](_0x1c86b2,function(_0x1ba397){return _0x12c72c[_0x4f75('0xa6')](_0x1ba397[_0x4f75('0x2b')]);});console[_0x4f75('0xa3')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x1c86b2);_0x6ffd82=[];_0x1c86b2['forEach'](function(_0x318574){var _0x489429=createFieldObject(_0x27db3e,_0x2c5c71,_0x318574[_0x4f75('0xa8')],_0x318574[_0x4f75('0x2b')],_0x318574[_0x4f75('0xab')],!![]);_0x6ffd82[_0x4f75('0xa9')](_0x489429);});return Promise[_0x4f75('0xac')](_0x6ffd82);})[_0x4f75('0x16')](function(_0x565715){_0x3d269f=_0x565715;var _0x1f5a79=_0x409eb8[_0x4f75('0xad')](_0x3d269f);return{'count':_0x1f5a79[_0x4f75('0x38')],'rows':_0x1f5a79};})['then'](respondWithResult(_0x2f03cd,null))[_0x4f75('0x47')](function(_0x5511a8){console[_0x4f75('0xa3')]('ServiceNow\x20error:\x20'+_0x5511a8);var _0x5997f7=_0x2e4dd5['query'][_0x4f75('0xae')]?0x1f4:_0x5511a8[_0x4f75('0xaf')]||0x1f4;logger[_0x4f75('0x1b')](_0x5511a8[_0x4f75('0x2a')]);delete _0x5511a8[_0x4f75('0x2b')];if(_0x5997f7===0x191){_0x5997f7=0x190;}_0x2f03cd['status'](_0x5997f7)[_0x4f75('0x2c')](_0x2e4dd5[_0x4f75('0x33')][_0x4f75('0xae')]?{'message':_0x4f75('0xb0'),'statusCode':_0x5511a8[_0x4f75('0xaf')]}:_0x5511a8);});};function createFieldObject(_0x4eb097,_0x505cb3,_0x56267a,_0x58e99d,_0x4a2db9,_0x5a807a){return new Promise(function(_0x2fc206,_0x4f472a){var _0xfa6e7b={'id':_0x58e99d,'name':_0x4a2db9,'custom':_0x5a807a};if(_0x56267a===_0x4f75('0xb1')){_0xfa6e7b[_0x4f75('0x42')]=[{'name':_0x4f75('0xb2'),'value':_0x4f75('0xb3')},{'name':_0x4f75('0xb4'),'value':_0x4f75('0xb5')}];_0x2fc206(_0xfa6e7b);}else{var _0x1b7b73={'method':_0x4f75('0xb6'),'uri':_0x4eb097+_0x4f75('0xb7')+_0x58e99d,'auth':_0x505cb3,'json':!![]};return rp(_0x1b7b73)[_0x4f75('0x16')](function(_0x270205){var _0x4a6a3a=[];if(_0x270205[_0x4f75('0xa2')][_0x4f75('0x38')]>0x0){_0x270205[_0x4f75('0xa2')]['forEach'](function(_0x5d6e2f){if(_0x5d6e2f[_0x4f75('0xb8')]==='false'){var _0x17da22={'name':_0x5d6e2f[_0x4f75('0xab')],'value':_0x5d6e2f[_0x4f75('0xb9')]};_0x4a6a3a[_0x4f75('0xa9')](_0x17da22);}});}_0xfa6e7b[_0x4f75('0x42')]=_0x4a6a3a;if(_0xfa6e7b[_0x4f75('0x42')][_0x4f75('0x38')]>0x0){_0x2fc206(_0xfa6e7b);}else{if(_0x5a807a==![]){_0x2fc206();}else{_0x2fc206(_0xfa6e7b);}}});}});} \ No newline at end of file +var _0xcce9=['urgency','problem_id','company','reassignment_count','activity_due','assigned_to','severity','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','username','email','remoteUri','serverUrl','slice','format','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','forEach','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','concat','ServiceNow\x20error:\x20','test','stack','Wrong\x20credentials','statusCode','True','False','GET','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','html-pdf','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','ServicenowAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','limit','apply','reject','save','update','destroy','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','options','rows','params','create','body','getConfigurations','findOne','ServicenowConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','made_sla','hold_reason','knowledge','subcategory','close_code','category','upon_reject','sys_updated_on','approval_history','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','sys_created_by','closed_at','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','close_notes','closed_by','sys_id','reopened_by','incident_state'];(function(_0x3fa5b1,_0x2496c1){var _0x3c57b8=function(_0x96c7d9){while(--_0x96c7d9){_0x3fa5b1['push'](_0x3fa5b1['shift']());}};_0x3c57b8(++_0x2496c1);}(_0xcce9,0x1a8));var _0x9cce=function(_0x33457f,_0xe393ae){_0x33457f=_0x33457f-0x0;var _0xc0fdd7=_0xcce9[_0x33457f];return _0xc0fdd7;};'use strict';var pdf=require(_0x9cce('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9cce('0x1'));var zipdir=require(_0x9cce('0x2'));var jsonpatch=require(_0x9cce('0x3'));var rp=require(_0x9cce('0x4'));var moment=require(_0x9cce('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9cce('0x6'));var util=require(_0x9cce('0x7'));var path=require(_0x9cce('0x8'));var sox=require(_0x9cce('0x9'));var csv=require(_0x9cce('0xa'));var ejs=require(_0x9cce('0xb'));var fs=require('fs');var _=require(_0x9cce('0xc'));var squel=require(_0x9cce('0xd'));var crypto=require(_0x9cce('0xe'));var jsforce=require(_0x9cce('0xf'));var deskjs=require(_0x9cce('0x10'));var toCsv=require(_0x9cce('0xa'));var querystring=require(_0x9cce('0x11'));var Papa=require(_0x9cce('0x12'));var Redis=require(_0x9cce('0x13'));var authService=require(_0x9cce('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9cce('0x15'));var hardwareService=require(_0x9cce('0x16'));var logger=require(_0x9cce('0x17'))(_0x9cce('0x18'));var utils=require('../../config/utils');var config=require(_0x9cce('0x19'));var licenseUtil=require(_0x9cce('0x1a'));var db=require(_0x9cce('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x9cce('0x1c')][_0x9cce('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5db5de,_0xe3dc84,_0x495df2,_0x672a74){return new BPromise(function(_0x494a88,_0x105ec6){var _0x538c5d=_0x672a74||client;return _0x538c5d[_0x9cce('0x1e')](_0x5db5de,_0x495df2)[_0x9cce('0x1f')](function(_0x1724e6){logger[_0x9cce('0x20')]('ServicenowAccount,\x20%s,\x20%s',_0xe3dc84,_0x9cce('0x21'));logger[_0x9cce('0x22')](_0x9cce('0x23'),_0xe3dc84,_0x9cce('0x21'),JSON['stringify'](_0x1724e6));if(_0x1724e6[_0x9cce('0x24')]){if(_0x1724e6[_0x9cce('0x24')][_0x9cce('0x25')]===0x1f4){logger[_0x9cce('0x24')]('ServicenowAccount,\x20%s,\x20%s',_0xe3dc84,_0x1724e6[_0x9cce('0x24')][_0x9cce('0x26')]);return _0x105ec6(_0x1724e6['error'][_0x9cce('0x26')]);}logger['error'](_0x9cce('0x27'),_0xe3dc84,_0x1724e6[_0x9cce('0x24')]['message']);return _0x494a88(_0x1724e6[_0x9cce('0x24')][_0x9cce('0x26')]);}else{logger[_0x9cce('0x20')](_0x9cce('0x27'),_0xe3dc84,_0x9cce('0x21'));_0x494a88(_0x1724e6[_0x9cce('0x28')][_0x9cce('0x26')]);}})[_0x9cce('0x29')](function(_0x16a4cb){logger['error'](_0x9cce('0x27'),_0xe3dc84,_0x16a4cb);_0x105ec6(_0x16a4cb);});});}function respondWithStatusCode(_0x57f720,_0x4ff381){_0x4ff381=_0x4ff381||0xcc;return function(_0x2d0e9c){if(_0x2d0e9c){return _0x57f720[_0x9cce('0x2a')](_0x4ff381);}return _0x57f720[_0x9cce('0x2b')](_0x4ff381)[_0x9cce('0x2c')]();};}function respondWithResult(_0x8f69e3,_0xc4c547){_0xc4c547=_0xc4c547||0xc8;return function(_0x4543a2){if(_0x4543a2){return _0x8f69e3[_0x9cce('0x2b')](_0xc4c547)[_0x9cce('0x2d')](_0x4543a2);}};}function respondWithFilteredResult(_0x45b20e,_0x3c9c2b){return function(_0x4b662a){if(_0x4b662a){var _0x5dd434=_0x4b662a['count'],_0x5b4c48=_0x3c9c2b[_0x9cce('0x2e')],_0x333686=_0x3c9c2b[_0x9cce('0x2e')]+_0x3c9c2b[_0x9cce('0x2f')],_0x45d661;if(_0x333686>=_0x5dd434){_0x333686=_0x5dd434;_0x45d661=0xc8;}else{_0x45d661=0xce;}_0x45b20e[_0x9cce('0x2b')](_0x45d661);return _0x45b20e['set']('Content-Range',_0x5b4c48+'-'+_0x333686+'/'+_0x5dd434)['json'](_0x4b662a);}return null;};}function patchUpdates(_0x48325f){return function(_0x39c8f3){try{jsonpatch[_0x9cce('0x30')](_0x39c8f3,_0x48325f,!![]);}catch(_0x5c588d){return BPromise[_0x9cce('0x31')](_0x5c588d);}return _0x39c8f3[_0x9cce('0x32')]();};}function saveUpdates(_0x29d0d2,_0x36b166){return function(_0x3cfa65){if(_0x3cfa65){return _0x3cfa65[_0x9cce('0x33')](_0x29d0d2)[_0x9cce('0x1f')](function(_0x5d6c5){return _0x5d6c5;});}return null;};}function removeEntity(_0x536f0e,_0x4b40fa){return function(_0x520eda){if(_0x520eda){return _0x520eda[_0x9cce('0x34')]()['then'](function(){_0x536f0e[_0x9cce('0x2b')](0xcc)[_0x9cce('0x2c')]();});}};}function handleEntityNotFound(_0x4ad6b9,_0x2b6618){return function(_0x1d6268){if(!_0x1d6268){_0x4ad6b9[_0x9cce('0x2a')](0x194);}return _0x1d6268;};}function handleError(_0x5e3937,_0x5476c9){_0x5476c9=_0x5476c9||0x1f4;return function(_0x14877f){logger['error'](_0x14877f['stack']);if(_0x14877f['name']){delete _0x14877f[_0x9cce('0x35')];}_0x5e3937['status'](_0x5476c9)[_0x9cce('0x36')](_0x14877f);};}exports[_0x9cce('0x37')]=function(_0x2802d5,_0x2c8673){var _0x583a86={},_0x44ef29={},_0x3611e7={'count':0x0,'rows':[]};var _0x51b875=_[_0x9cce('0x38')](db[_0x9cce('0x39')][_0x9cce('0x3a')],function(_0xf8612){return{'name':_0xf8612[_0x9cce('0x3b')],'type':_0xf8612['type'][_0x9cce('0x3c')]};});_0x44ef29[_0x9cce('0x3d')]=_[_0x9cce('0x38')](_0x51b875,_0x9cce('0x35'));_0x44ef29[_0x9cce('0x3e')]=_[_0x9cce('0x3f')](_0x2802d5[_0x9cce('0x3e')]);_0x44ef29[_0x9cce('0x40')]=_['intersection'](_0x44ef29[_0x9cce('0x3d')],_0x44ef29['query']);_0x583a86[_0x9cce('0x41')]=_[_0x9cce('0x42')](_0x44ef29[_0x9cce('0x3d')],qs[_0x9cce('0x43')](_0x2802d5[_0x9cce('0x3e')][_0x9cce('0x43')]));_0x583a86[_0x9cce('0x41')]=_0x583a86['attributes'][_0x9cce('0x44')]?_0x583a86['attributes']:_0x44ef29[_0x9cce('0x3d')];if(!_0x2802d5[_0x9cce('0x3e')][_0x9cce('0x45')](_0x9cce('0x46'))){_0x583a86[_0x9cce('0x2f')]=qs[_0x9cce('0x2f')](_0x2802d5[_0x9cce('0x3e')][_0x9cce('0x2f')]);_0x583a86[_0x9cce('0x2e')]=qs[_0x9cce('0x2e')](_0x2802d5[_0x9cce('0x3e')][_0x9cce('0x2e')]);}_0x583a86['order']=qs[_0x9cce('0x47')](_0x2802d5[_0x9cce('0x3e')][_0x9cce('0x47')]);_0x583a86['where']=qs[_0x9cce('0x40')](_[_0x9cce('0x48')](_0x2802d5[_0x9cce('0x3e')],_0x44ef29['filters']),_0x51b875);if(_0x2802d5[_0x9cce('0x3e')][_0x9cce('0x49')]){_0x583a86['where']=_[_0x9cce('0x4a')](_0x583a86[_0x9cce('0x4b')],{'$or':_[_0x9cce('0x38')](_0x51b875,function(_0x4f51c5){if(_0x4f51c5['type']!=='VIRTUAL'){var _0x2c1f2c={};_0x2c1f2c[_0x4f51c5['name']]={'$like':'%'+_0x2802d5['query'][_0x9cce('0x49')]+'%'};return _0x2c1f2c;}})});}_0x583a86=_[_0x9cce('0x4a')]({},_0x583a86,_0x2802d5[_0x9cce('0x4c')]);var _0x618436={'where':_0x583a86[_0x9cce('0x4b')]};return db[_0x9cce('0x39')]['count'](_0x618436)['then'](function(_0x986880){_0x3611e7['count']=_0x986880;if(_0x2802d5['query']['includeAll']){_0x583a86['include']=[{'all':!![]}];}return db[_0x9cce('0x39')]['findAll'](_0x583a86);})[_0x9cce('0x1f')](function(_0x256eb1){_0x3611e7[_0x9cce('0x4d')]=_0x256eb1;return _0x3611e7;})[_0x9cce('0x1f')](respondWithFilteredResult(_0x2c8673,_0x583a86))['catch'](handleError(_0x2c8673,null));};exports['show']=function(_0x3cb99f,_0x21f7c0){var _0x34ae46={'raw':![],'where':{'id':_0x3cb99f[_0x9cce('0x4e')]['id']}},_0x1ae506={};_0x1ae506[_0x9cce('0x3d')]=_[_0x9cce('0x3f')](db[_0x9cce('0x39')][_0x9cce('0x3a')]);_0x1ae506[_0x9cce('0x3e')]=_[_0x9cce('0x3f')](_0x3cb99f[_0x9cce('0x3e')]);_0x1ae506['filters']=_[_0x9cce('0x42')](_0x1ae506[_0x9cce('0x3d')],_0x1ae506[_0x9cce('0x3e')]);_0x34ae46[_0x9cce('0x41')]=_['intersection'](_0x1ae506[_0x9cce('0x3d')],qs['fields'](_0x3cb99f[_0x9cce('0x3e')]['fields']));_0x34ae46[_0x9cce('0x41')]=_0x34ae46['attributes']['length']?_0x34ae46[_0x9cce('0x41')]:_0x1ae506[_0x9cce('0x3d')];if(_0x3cb99f[_0x9cce('0x3e')]['includeAll']){_0x34ae46['include']=[{'all':!![]}];}_0x34ae46=_[_0x9cce('0x4a')]({},_0x34ae46,_0x3cb99f[_0x9cce('0x4c')]);return db[_0x9cce('0x39')]['find'](_0x34ae46)[_0x9cce('0x1f')](handleEntityNotFound(_0x21f7c0,null))[_0x9cce('0x1f')](respondWithResult(_0x21f7c0,null))[_0x9cce('0x29')](handleError(_0x21f7c0,null));};exports[_0x9cce('0x4f')]=function(_0x4455a9,_0x538c24){return db['ServicenowAccount'][_0x9cce('0x4f')](_0x4455a9[_0x9cce('0x50')],{})['then'](respondWithResult(_0x538c24,0xc9))[_0x9cce('0x29')](handleError(_0x538c24,null));};exports['update']=function(_0xe3ced4,_0x2c7ad1){if(_0xe3ced4[_0x9cce('0x50')]['id']){delete _0xe3ced4[_0x9cce('0x50')]['id'];}return db[_0x9cce('0x39')]['find']({'where':{'id':_0xe3ced4['params']['id']}})[_0x9cce('0x1f')](handleEntityNotFound(_0x2c7ad1,null))[_0x9cce('0x1f')](saveUpdates(_0xe3ced4[_0x9cce('0x50')],null))[_0x9cce('0x1f')](respondWithResult(_0x2c7ad1,null))[_0x9cce('0x29')](handleError(_0x2c7ad1,null));};exports[_0x9cce('0x34')]=function(_0x5400ff,_0x16ed20){return db[_0x9cce('0x39')]['find']({'where':{'id':_0x5400ff['params']['id']}})['then'](handleEntityNotFound(_0x16ed20,null))[_0x9cce('0x1f')](removeEntity(_0x16ed20,null))[_0x9cce('0x29')](handleError(_0x16ed20,null));};exports[_0x9cce('0x51')]=function(_0x42f42a,_0x5f39f7,_0x4fd978){var _0x162b74={};var _0x505053={};var _0x35c2e7;var _0x290ef3;return db[_0x9cce('0x39')][_0x9cce('0x52')]({'where':{'id':_0x42f42a['params']['id']}})[_0x9cce('0x1f')](handleEntityNotFound(_0x5f39f7,null))[_0x9cce('0x1f')](function(_0x3a2f4f){if(_0x3a2f4f){_0x35c2e7=_0x3a2f4f;_0x505053['model']=_[_0x9cce('0x3f')](db[_0x9cce('0x53')]['rawAttributes']);_0x505053[_0x9cce('0x3e')]=_[_0x9cce('0x3f')](_0x42f42a['query']);_0x505053['filters']=_[_0x9cce('0x42')](_0x505053['model'],_0x505053['query']);_0x162b74[_0x9cce('0x41')]=_[_0x9cce('0x42')](_0x505053[_0x9cce('0x3d')],qs[_0x9cce('0x43')](_0x42f42a['query'][_0x9cce('0x43')]));_0x162b74[_0x9cce('0x41')]=_0x162b74[_0x9cce('0x41')][_0x9cce('0x44')]?_0x162b74[_0x9cce('0x41')]:_0x505053['model'];_0x162b74[_0x9cce('0x54')]=qs['sort'](_0x42f42a['query'][_0x9cce('0x47')]);_0x162b74['where']=qs['filters'](_['pick'](_0x42f42a['query'],_0x505053[_0x9cce('0x40')]));if(_0x42f42a[_0x9cce('0x3e')]['filter']){_0x162b74[_0x9cce('0x4b')]=_['merge'](_0x162b74[_0x9cce('0x4b')],{'$or':_[_0x9cce('0x38')](_0x162b74[_0x9cce('0x41')],function(_0x59a281){var _0x4ec11a={};_0x4ec11a[_0x59a281]={'$like':'%'+_0x42f42a[_0x9cce('0x3e')][_0x9cce('0x49')]+'%'};return _0x4ec11a;})});}_0x162b74=_[_0x9cce('0x4a')]({},_0x162b74,_0x42f42a['options']);return _0x35c2e7[_0x9cce('0x51')](_0x162b74);}})[_0x9cce('0x1f')](function(_0x30c7aa){if(_0x30c7aa){_0x290ef3=_0x30c7aa['length'];if(!_0x42f42a[_0x9cce('0x3e')][_0x9cce('0x45')]('nolimit')){_0x162b74['limit']=qs[_0x9cce('0x2f')](_0x42f42a[_0x9cce('0x3e')][_0x9cce('0x2f')]);_0x162b74['offset']=qs[_0x9cce('0x2e')](_0x42f42a[_0x9cce('0x3e')][_0x9cce('0x2e')]);}return _0x35c2e7[_0x9cce('0x51')](_0x162b74);}})[_0x9cce('0x1f')](function(_0x17fea7){if(_0x17fea7){return _0x17fea7?{'count':_0x290ef3,'rows':_0x17fea7}:null;}})[_0x9cce('0x1f')](respondWithResult(_0x5f39f7,null))[_0x9cce('0x29')](handleError(_0x5f39f7,null));};exports[_0x9cce('0x55')]=function(_0x6c6962,_0x341102,_0x132c7c){if(_0x6c6962[_0x9cce('0x50')]['id']){delete _0x6c6962[_0x9cce('0x50')]['id'];}return db[_0x9cce('0x39')][_0x9cce('0x52')]({'where':{'id':_0x6c6962[_0x9cce('0x4e')]['id']}})[_0x9cce('0x1f')](handleEntityNotFound(_0x341102,null))[_0x9cce('0x1f')](function(_0x57bc02){if(_0x57bc02){_0x6c6962[_0x9cce('0x50')][_0x9cce('0x56')]=_0x57bc02['id'];_0x6c6962[_0x9cce('0x50')][_0x9cce('0x57')]=integrations[_0x9cce('0x58')](_0x6c6962[_0x9cce('0x50')][_0x9cce('0x59')],_0x6c6962[_0x9cce('0x50')][_0x9cce('0x5a')]);_0x6c6962[_0x9cce('0x50')][_0x9cce('0x5b')]=integrations[_0x9cce('0x5c')](_0x6c6962[_0x9cce('0x50')][_0x9cce('0x59')],_0x6c6962[_0x9cce('0x50')]['type']);return db['ServicenowConfiguration'][_0x9cce('0x4f')](_0x6c6962[_0x9cce('0x50')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db['ServicenowField'],'as':_0x9cce('0x5b')}]});}return null;})[_0x9cce('0x1f')](respondWithResult(_0x341102,null))['catch'](handleError(_0x341102,null));};exports['getFields']=function(_0x178fbb,_0x225a87,_0x4d539a){var _0x158e63=[_0x9cce('0x5d'),_0x9cce('0x5e'),_0x9cce('0x5f'),_0x9cce('0x60'),_0x9cce('0x61'),'notify','incident_state','severity',_0x9cce('0x62')];var _0x59701f=['parent',_0x9cce('0x5d'),'caused_by','watch_list',_0x9cce('0x63'),_0x9cce('0x64'),'child_incidents',_0x9cce('0x5e'),_0x9cce('0x65'),'number',_0x9cce('0x66'),_0x9cce('0x67'),'opened_by',_0x9cce('0x68'),_0x9cce('0x69'),_0x9cce('0x6a'),'state',_0x9cce('0x6b'),_0x9cce('0x5f'),_0x9cce('0x54'),'calendar_stc',_0x9cce('0x6c'),'cmdb_ci',_0x9cce('0x6d'),'impact',_0x9cce('0x6e'),_0x9cce('0x6f'),_0x9cce('0x70'),_0x9cce('0x71'),_0x9cce('0x72'),'rfc',_0x9cce('0x73'),_0x9cce('0x74'),_0x9cce('0x75'),'business_duration',_0x9cce('0x76'),_0x9cce('0x77'),_0x9cce('0x78'),_0x9cce('0x79'),_0x9cce('0x7a'),'approval_set','subcategory','work_notes','short_description','close_code',_0x9cce('0x7b'),_0x9cce('0x7c'),_0x9cce('0x7d'),_0x9cce('0x7e'),_0x9cce('0x7f'),_0x9cce('0x80'),_0x9cce('0x81'),_0x9cce('0x82'),_0x9cce('0x83'),'sys_class_name',_0x9cce('0x84'),_0x9cce('0x85'),'follow_up','parent_incident',_0x9cce('0x86'),'contact_type',_0x9cce('0x87'),_0x9cce('0x88'),_0x9cce('0x89'),_0x9cce('0x8a'),_0x9cce('0x8b'),_0x9cce('0x8c'),_0x9cce('0x8d'),_0x9cce('0x8e'),_0x9cce('0x8f'),'comments','sla_due',_0x9cce('0x90'),_0x9cce('0x91'),_0x9cce('0x92'),_0x9cce('0x93'),_0x9cce('0x94'),'sys_tags',_0x9cce('0x95'),_0x9cce('0x96'),_0x9cce('0x97'),_0x9cce('0x98'),'category'];var _0x6bcd50='';var _0x2a6d97='';var _0x3f0a58=[];var _0x313271='';var _0x5b4b07='';var _0x3e5a56=[];var _0x594947='';var _0x4dd3fc='';var _0xbb35ba={};var _0x392da2='';return db[_0x9cce('0x39')][_0x9cce('0x52')]({'where':{'id':_0x178fbb[_0x9cce('0x4e')]['id']},'attributes':['id',_0x9cce('0x99'),'password',_0x9cce('0x9a'),_0x9cce('0x9b'),_0x9cce('0x9c')]})[_0x9cce('0x1f')](handleEntityNotFound(_0x225a87,null))[_0x9cce('0x1f')](function(_0x28c43f){if(_0x28c43f){_0x392da2=_0x28c43f[_0x9cce('0x9b')];var _0x53b895=_0x392da2[_0x9cce('0x9d')](-0x1);if(_0x53b895==='/'){_0x392da2=_0x392da2['substring'](0x0,_0x392da2['lastIndexOf'](_0x53b895));}_0x4dd3fc=util[_0x9cce('0x9e')](_0x9cce('0x9f'),_0x392da2);_0x594947=util['format'](_0x9cce('0xa0'),_0x392da2);_0xbb35ba={'user':_0x28c43f['username'],'pass':_0x28c43f['password']};var _0x2ba913={'method':'GET','uri':_0x4dd3fc+_0x9cce('0xa1'),'auth':_0xbb35ba,'json':!![]};return rp(_0x2ba913);}})[_0x9cce('0x1f')](function(_0x2dcaac){if(_0x2dcaac['result'][_0x9cce('0x44')]>0x0){_0x6bcd50=_0x2dcaac[_0x9cce('0x28')];}console[_0x9cce('0xa2')](_0x9cce('0xa3'),_0x6bcd50);_0x3e5a56=[];_0x2a6d97=Object[_0x9cce('0xa4')]([],_0x6bcd50);_[_0x9cce('0xa5')](_0x2a6d97,function(_0x1f2a3c){return!_0x158e63[_0x9cce('0xa6')](_0x1f2a3c[_0x9cce('0x35')]);});_0x2a6d97[_0x9cce('0xa7')](function(_0x4511a9){var _0xcad927=createFieldObject(_0x594947,_0xbb35ba,_0x4511a9['internalType'],_0x4511a9[_0x9cce('0x35')],_0x4511a9[_0x9cce('0xa8')],![]);_0x3e5a56[_0x9cce('0xa9')](_0xcad927);});return Promise[_0x9cce('0xaa')](_0x3e5a56);})[_0x9cce('0x1f')](function(_0x3e370d){_0x3f0a58=_0x3e370d;_0x313271=Object['assign']([],_0x6bcd50);console[_0x9cce('0xa2')](_0x9cce('0xab'),_0x6bcd50);_[_0x9cce('0xa5')](_0x313271,function(_0x29b21f){return _0x59701f[_0x9cce('0xa6')](_0x29b21f['name']);});console['log'](_0x9cce('0xac'),_0x313271);_0x3e5a56=[];_0x313271[_0x9cce('0xa7')](function(_0x5691ec){var _0x262c20=createFieldObject(_0x594947,_0xbb35ba,_0x5691ec[_0x9cce('0xad')],_0x5691ec[_0x9cce('0x35')],_0x5691ec[_0x9cce('0xa8')],!![]);_0x3e5a56['push'](_0x262c20);});return Promise[_0x9cce('0xaa')](_0x3e5a56);})[_0x9cce('0x1f')](function(_0x245461){_0x5b4b07=_0x245461;var _0x33f29b=_0x3f0a58[_0x9cce('0xae')](_0x5b4b07);return{'count':_0x33f29b[_0x9cce('0x44')],'rows':_0x33f29b};})[_0x9cce('0x1f')](respondWithResult(_0x225a87,null))[_0x9cce('0x29')](function(_0x4771aa){console[_0x9cce('0xa2')](_0x9cce('0xaf')+_0x4771aa);var _0x12cc22=_0x178fbb[_0x9cce('0x3e')][_0x9cce('0xb0')]?0x1f4:_0x4771aa['statusCode']||0x1f4;logger['error'](_0x4771aa[_0x9cce('0xb1')]);delete _0x4771aa['name'];if(_0x12cc22===0x191){_0x12cc22=0x190;}_0x225a87[_0x9cce('0x2b')](_0x12cc22)['send'](_0x178fbb['query'][_0x9cce('0xb0')]?{'message':_0x9cce('0xb2'),'statusCode':_0x4771aa[_0x9cce('0xb3')]}:_0x4771aa);});};function createFieldObject(_0x13b9f0,_0x2a0eaa,_0x1c277e,_0x5b366b,_0x2fe565,_0x1fb5af){return new Promise(function(_0x17d563,_0x5dae10){var _0x2d50fb={'id':_0x5b366b,'name':_0x2fe565,'custom':_0x1fb5af};if(_0x1c277e==='boolean'){_0x2d50fb['options']=[{'name':_0x9cce('0xb4'),'value':'true'},{'name':_0x9cce('0xb5'),'value':'false'}];_0x17d563(_0x2d50fb);}else{var _0x3c45fb={'method':_0x9cce('0xb6'),'uri':_0x13b9f0+_0x9cce('0xb7')+_0x5b366b,'auth':_0x2a0eaa,'json':!![]};return rp(_0x3c45fb)['then'](function(_0x770395){var _0x2e596c=[];if(_0x770395[_0x9cce('0x28')]['length']>0x0){_0x770395[_0x9cce('0x28')][_0x9cce('0xa7')](function(_0x22dcff){if(_0x22dcff[_0x9cce('0xb8')]===_0x9cce('0xb9')){var _0x499144={'name':_0x22dcff['label'],'value':_0x22dcff[_0x9cce('0xba')]};_0x2e596c[_0x9cce('0xa9')](_0x499144);}});}_0x2d50fb[_0x9cce('0x4c')]=_0x2e596c;if(_0x2d50fb[_0x9cce('0x4c')][_0x9cce('0x44')]>0x0){_0x17d563(_0x2d50fb);}else{if(_0x1fb5af==![]){_0x17d563();}else{_0x17d563(_0x2d50fb);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 80b5659..4225c18 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 _0x7bae=['define','ServicenowAccount','int_servicenow_accounts','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x7bae,0x13b));var _0xe7ba=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x7bae[_0x24237f];return _0x48298e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7ba('0x0'))(_0xe7ba('0x1'));var moment=require('moment');var BPromise=require(_0xe7ba('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe7ba('0x3'));var rimraf=require(_0xe7ba('0x4'));var config=require(_0xe7ba('0x5'));var attributes=require(_0xe7ba('0x6'));var integrations=require(_0xe7ba('0x7'));module[_0xe7ba('0x8')]=function(_0x2d31df,_0x3c5e59){return _0x2d31df[_0xe7ba('0x9')](_0xe7ba('0xa'),attributes,{'tableName':_0xe7ba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5162=['../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts','lodash','bluebird','request-promise','path','rimraf'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x5162,0x103));var _0x2516=function(_0x3c6c1b,_0x82a1e4){_0x3c6c1b=_0x3c6c1b-0x0;var _0x15170e=_0x5162[_0x3c6c1b];return _0x15170e;};'use strict';var _=require(_0x2516('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2516('0x1'));var rp=require(_0x2516('0x2'));var fs=require('fs');var path=require(_0x2516('0x3'));var rimraf=require(_0x2516('0x4'));var config=require(_0x2516('0x5'));var attributes=require(_0x2516('0x6'));var integrations=require(_0x2516('0x7'));module['exports']=function(_0x48f411,_0x5beeb3){return _0x48f411[_0x2516('0x8')](_0x2516('0x9'),attributes,{'tableName':_0x2516('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 963df8c..3b22955 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 _0x4c28=['code','message','result','GetServicenowAccount','findAll','options','limit','map','model','attributes','include','stringify','catch','ShowServicenowAccount','ServicenowAccount','raw','where','util','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4c28,0x191));var _0x84c2=function(_0x544999,_0x50742a){_0x544999=_0x544999-0x0;var _0x18a4c6=_0x4c28[_0x544999];return _0x18a4c6;};'use strict';var _=require('lodash');var util=require(_0x84c2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x84c2('0x1'));var db=require(_0x84c2('0x2'))['db'];var utils=require(_0x84c2('0x3'));var logger=require('../../config/logger')(_0x84c2('0x4'));var config=require('../../config/environment');var jayson=require(_0x84c2('0x5'));var client=jayson[_0x84c2('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d31cd,_0x370cd6,_0x1a3208){return new BPromise(function(_0x25e37e,_0x158bb5){return client[_0x84c2('0x7')](_0x3d31cd,_0x1a3208)[_0x84c2('0x8')](function(_0x278401){logger[_0x84c2('0x9')](_0x84c2('0xa'),_0x370cd6,_0x84c2('0xb'));logger[_0x84c2('0xc')](_0x84c2('0xd'),_0x370cd6,_0x84c2('0xb'),JSON['stringify'](_0x278401));if(_0x278401[_0x84c2('0xe')]){if(_0x278401[_0x84c2('0xe')][_0x84c2('0xf')]===0x1f4){logger[_0x84c2('0xe')](_0x84c2('0xa'),_0x370cd6,_0x278401[_0x84c2('0xe')][_0x84c2('0x10')]);return _0x158bb5(_0x278401[_0x84c2('0xe')][_0x84c2('0x10')]);}logger[_0x84c2('0xe')](_0x84c2('0xa'),_0x370cd6,_0x278401[_0x84c2('0xe')][_0x84c2('0x10')]);return _0x25e37e(_0x278401[_0x84c2('0xe')][_0x84c2('0x10')]);}else{logger[_0x84c2('0x9')](_0x84c2('0xa'),_0x370cd6,_0x84c2('0xb'));_0x25e37e(_0x278401[_0x84c2('0x11')][_0x84c2('0x10')]);}})['catch'](function(_0x5b6350){logger[_0x84c2('0xe')](_0x84c2('0xa'),_0x370cd6,_0x5b6350);_0x158bb5(_0x5b6350);});});}exports[_0x84c2('0x12')]=function(_0x6858bb){var _0x14795a=this;return new Promise(function(_0x328d8e,_0x386579){return db['ServicenowAccount'][_0x84c2('0x13')]({'raw':_0x6858bb[_0x84c2('0x14')]?_0x6858bb[_0x84c2('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x6858bb[_0x84c2('0x14')]?_0x6858bb[_0x84c2('0x14')]['where']||null:null,'attributes':_0x6858bb[_0x84c2('0x14')]?_0x6858bb['options']['attributes']||null:null,'limit':_0x6858bb[_0x84c2('0x14')]?_0x6858bb[_0x84c2('0x14')][_0x84c2('0x15')]||null:null,'include':_0x6858bb[_0x84c2('0x14')]?_0x6858bb[_0x84c2('0x14')]['include']?_[_0x84c2('0x16')](_0x6858bb[_0x84c2('0x14')]['include'],function(_0x496a19){return{'model':db[_0x496a19[_0x84c2('0x17')]],'as':_0x496a19['as'],'attributes':_0x496a19[_0x84c2('0x18')],'include':_0x496a19[_0x84c2('0x19')]?_['map'](_0x496a19['include'],function(_0x322b96){return{'model':db[_0x322b96[_0x84c2('0x17')]],'as':_0x322b96['as'],'attributes':_0x322b96[_0x84c2('0x18')],'include':_0x322b96['include']?_['map'](_0x322b96[_0x84c2('0x19')],function(_0x2b65e0){return{'model':db[_0x2b65e0[_0x84c2('0x17')]],'as':_0x2b65e0['as'],'attributes':_0x2b65e0[_0x84c2('0x18')]};}):[]};}):[]};}):[]:[]})[_0x84c2('0x8')](function(_0x253472){logger[_0x84c2('0x9')](_0x84c2('0x12'),_0x6858bb);logger['debug'](_0x84c2('0x12'),_0x6858bb,JSON[_0x84c2('0x1a')](_0x253472));_0x328d8e(_0x253472);})[_0x84c2('0x1b')](function(_0x3e3f5a){logger[_0x84c2('0xe')]('GetServicenowAccount',_0x3e3f5a[_0x84c2('0x10')],_0x6858bb);_0x386579(_0x14795a[_0x84c2('0xe')](0x1f4,_0x3e3f5a[_0x84c2('0x10')]));});});};exports[_0x84c2('0x1c')]=function(_0x25f640){var _0x1ff898=this;return new Promise(function(_0x4bb366,_0xc4e00f){return db[_0x84c2('0x1d')]['find']({'raw':_0x25f640[_0x84c2('0x14')]?_0x25f640['options'][_0x84c2('0x1e')]===undefined?!![]:![]:!![],'where':_0x25f640[_0x84c2('0x14')]?_0x25f640['options'][_0x84c2('0x1f')]||null:null,'attributes':_0x25f640[_0x84c2('0x14')]?_0x25f640['options'][_0x84c2('0x18')]||null:null,'include':_0x25f640[_0x84c2('0x14')]?_0x25f640[_0x84c2('0x14')][_0x84c2('0x19')]?_[_0x84c2('0x16')](_0x25f640['options'][_0x84c2('0x19')],function(_0x65ab9d){return{'model':db[_0x65ab9d[_0x84c2('0x17')]],'as':_0x65ab9d['as'],'attributes':_0x65ab9d[_0x84c2('0x18')],'include':_0x65ab9d[_0x84c2('0x19')]?_[_0x84c2('0x16')](_0x65ab9d['include'],function(_0x1b5064){return{'model':db[_0x1b5064['model']],'as':_0x1b5064['as'],'attributes':_0x1b5064[_0x84c2('0x18')],'include':_0x1b5064[_0x84c2('0x19')]?_['map'](_0x1b5064[_0x84c2('0x19')],function(_0xed1998){return{'model':db[_0xed1998[_0x84c2('0x17')]],'as':_0xed1998['as'],'attributes':_0xed1998[_0x84c2('0x18')]};}):[]};}):[]};}):[]:[]})[_0x84c2('0x8')](function(_0x1abad7){logger[_0x84c2('0x9')](_0x84c2('0x1c'),_0x25f640);logger[_0x84c2('0xc')](_0x84c2('0x1c'),_0x25f640,JSON[_0x84c2('0x1a')](_0x1abad7));_0x4bb366(_0x1abad7);})[_0x84c2('0x1b')](function(_0x430c17){logger[_0x84c2('0xe')](_0x84c2('0x1c'),_0x430c17[_0x84c2('0x10')],_0x25f640);_0xc4e00f(_0x1ff898['error'](0x1f4,_0x430c17[_0x84c2('0x10')]));});});}; \ No newline at end of file +var _0x8c95=['ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetServicenowAccount','options','where','attributes','include','map','model','ShowServicenowAccount','ServicenowAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info'];(function(_0x2f58ea,_0x2c8f38){var _0x514770=function(_0xd39816){while(--_0xd39816){_0x2f58ea['push'](_0x2f58ea['shift']());}};_0x514770(++_0x2c8f38);}(_0x8c95,0x112));var _0x58c9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8c95[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x58c9('0x0'));var util=require(_0x58c9('0x1'));var moment=require(_0x58c9('0x2'));var BPromise=require(_0x58c9('0x3'));var rs=require(_0x58c9('0x4'));var fs=require('fs');var Redis=require(_0x58c9('0x5'));var db=require(_0x58c9('0x6'))['db'];var utils=require(_0x58c9('0x7'));var logger=require(_0x58c9('0x8'))('rpc');var config=require(_0x58c9('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x58c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x96eff3,_0x21ed5d,_0x3c68f1){return new BPromise(function(_0xc4fe25,_0x38ddc6){return client[_0x58c9('0xb')](_0x96eff3,_0x3c68f1)[_0x58c9('0xc')](function(_0x2b8b36){logger[_0x58c9('0xd')](_0x58c9('0xe'),_0x21ed5d,_0x58c9('0xf'));logger[_0x58c9('0x10')](_0x58c9('0x11'),_0x21ed5d,'request\x20sent',JSON[_0x58c9('0x12')](_0x2b8b36));if(_0x2b8b36[_0x58c9('0x13')]){if(_0x2b8b36[_0x58c9('0x13')]['code']===0x1f4){logger[_0x58c9('0x13')](_0x58c9('0xe'),_0x21ed5d,_0x2b8b36[_0x58c9('0x13')][_0x58c9('0x14')]);return _0x38ddc6(_0x2b8b36['error'][_0x58c9('0x14')]);}logger[_0x58c9('0x13')](_0x58c9('0xe'),_0x21ed5d,_0x2b8b36[_0x58c9('0x13')][_0x58c9('0x14')]);return _0xc4fe25(_0x2b8b36[_0x58c9('0x13')][_0x58c9('0x14')]);}else{logger[_0x58c9('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x21ed5d,_0x58c9('0xf'));_0xc4fe25(_0x2b8b36['result'][_0x58c9('0x14')]);}})[_0x58c9('0x15')](function(_0x3a8283){logger[_0x58c9('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x21ed5d,_0x3a8283);_0x38ddc6(_0x3a8283);});});}exports[_0x58c9('0x16')]=function(_0x2fc9a4){var _0x5bb863=this;return new Promise(function(_0x4bab71,_0x29414d){return db['ServicenowAccount']['findAll']({'raw':_0x2fc9a4['options']?_0x2fc9a4['options']['raw']===undefined?!![]:![]:!![],'where':_0x2fc9a4[_0x58c9('0x17')]?_0x2fc9a4['options'][_0x58c9('0x18')]||null:null,'attributes':_0x2fc9a4['options']?_0x2fc9a4[_0x58c9('0x17')][_0x58c9('0x19')]||null:null,'limit':_0x2fc9a4[_0x58c9('0x17')]?_0x2fc9a4[_0x58c9('0x17')]['limit']||null:null,'include':_0x2fc9a4[_0x58c9('0x17')]?_0x2fc9a4[_0x58c9('0x17')][_0x58c9('0x1a')]?_[_0x58c9('0x1b')](_0x2fc9a4[_0x58c9('0x17')]['include'],function(_0x461ac4){return{'model':db[_0x461ac4['model']],'as':_0x461ac4['as'],'attributes':_0x461ac4[_0x58c9('0x19')],'include':_0x461ac4[_0x58c9('0x1a')]?_[_0x58c9('0x1b')](_0x461ac4[_0x58c9('0x1a')],function(_0xae9f18){return{'model':db[_0xae9f18[_0x58c9('0x1c')]],'as':_0xae9f18['as'],'attributes':_0xae9f18[_0x58c9('0x19')],'include':_0xae9f18[_0x58c9('0x1a')]?_[_0x58c9('0x1b')](_0xae9f18[_0x58c9('0x1a')],function(_0x2f04f4){return{'model':db[_0x2f04f4[_0x58c9('0x1c')]],'as':_0x2f04f4['as'],'attributes':_0x2f04f4[_0x58c9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x58c9('0xc')](function(_0x3de1e9){logger[_0x58c9('0xd')](_0x58c9('0x16'),_0x2fc9a4);logger['debug']('GetServicenowAccount',_0x2fc9a4,JSON[_0x58c9('0x12')](_0x3de1e9));_0x4bab71(_0x3de1e9);})[_0x58c9('0x15')](function(_0x4f5f2d){logger[_0x58c9('0x13')](_0x58c9('0x16'),_0x4f5f2d[_0x58c9('0x14')],_0x2fc9a4);_0x29414d(_0x5bb863[_0x58c9('0x13')](0x1f4,_0x4f5f2d[_0x58c9('0x14')]));});});};exports[_0x58c9('0x1d')]=function(_0x4ed95b){var _0x17b6b8=this;return new Promise(function(_0x344646,_0x5d7c02){return db[_0x58c9('0x1e')][_0x58c9('0x1f')]({'raw':_0x4ed95b[_0x58c9('0x17')]?_0x4ed95b[_0x58c9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4ed95b[_0x58c9('0x17')]?_0x4ed95b[_0x58c9('0x17')][_0x58c9('0x18')]||null:null,'attributes':_0x4ed95b[_0x58c9('0x17')]?_0x4ed95b['options'][_0x58c9('0x19')]||null:null,'include':_0x4ed95b['options']?_0x4ed95b[_0x58c9('0x17')][_0x58c9('0x1a')]?_[_0x58c9('0x1b')](_0x4ed95b[_0x58c9('0x17')][_0x58c9('0x1a')],function(_0x36b599){return{'model':db[_0x36b599[_0x58c9('0x1c')]],'as':_0x36b599['as'],'attributes':_0x36b599[_0x58c9('0x19')],'include':_0x36b599[_0x58c9('0x1a')]?_[_0x58c9('0x1b')](_0x36b599[_0x58c9('0x1a')],function(_0x2420a2){return{'model':db[_0x2420a2[_0x58c9('0x1c')]],'as':_0x2420a2['as'],'attributes':_0x2420a2[_0x58c9('0x19')],'include':_0x2420a2[_0x58c9('0x1a')]?_[_0x58c9('0x1b')](_0x2420a2[_0x58c9('0x1a')],function(_0x3e452e){return{'model':db[_0x3e452e[_0x58c9('0x1c')]],'as':_0x3e452e['as'],'attributes':_0x3e452e[_0x58c9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x58c9('0xc')](function(_0x4feb1e){logger[_0x58c9('0xd')](_0x58c9('0x1d'),_0x4ed95b);logger[_0x58c9('0x10')](_0x58c9('0x1d'),_0x4ed95b,JSON[_0x58c9('0x12')](_0x4feb1e));_0x344646(_0x4feb1e);})['catch'](function(_0x10f290){logger['error'](_0x58c9('0x1d'),_0x10f290['message'],_0x4ed95b);_0x5d7c02(_0x17b6b8[_0x58c9('0x13')](0x1f4,_0x10f290[_0x58c9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 87975e0..6e9bd99 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 _0x16d7=['delete','destroy','exports','util','express','Router','../../components/interaction/service','get','index','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','update'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x16d7,0x17f));var _0x716d=function(_0x277f9a,_0x3956f1){_0x277f9a=_0x277f9a-0x0;var _0x162dca=_0x16d7[_0x277f9a];return _0x162dca;};'use strict';var multer=require('multer');var util=require(_0x716d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x716d('0x1'));var router=express[_0x716d('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x716d('0x3'));var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router[_0x716d('0x4')]('/',auth['isAuthenticated'](),controller[_0x716d('0x5')]);router[_0x716d('0x4')]('/:id',auth[_0x716d('0x6')](),controller['show']);router['get'](_0x716d('0x7'),auth[_0x716d('0x6')](),controller[_0x716d('0x8')]);router[_0x716d('0x4')](_0x716d('0x9'),auth[_0x716d('0x6')](),controller[_0x716d('0xa')]);router[_0x716d('0x4')](_0x716d('0xb'),auth[_0x716d('0x6')](),controller[_0x716d('0xc')]);router[_0x716d('0xd')]('/',auth[_0x716d('0x6')](),controller['create']);router[_0x716d('0xe')](_0x716d('0xf'),auth[_0x716d('0x6')](),controller[_0x716d('0x10')]);router[_0x716d('0x11')](_0x716d('0xf'),auth[_0x716d('0x6')](),controller[_0x716d('0x12')]);module[_0x716d('0x13')]=router; \ No newline at end of file +var _0x1417=['get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x1417,0x1de));var _0x7141=function(_0x584e66,_0x40aa39){_0x584e66=_0x584e66-0x0;var _0x358c68=_0x1417[_0x584e66];return _0x358c68;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7141('0x0'));var timeout=require(_0x7141('0x1'));var express=require('express');var router=express[_0x7141('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x7141('0x3'));var config=require(_0x7141('0x4'));var controller=require(_0x7141('0x5'));router[_0x7141('0x6')]('/',auth[_0x7141('0x7')](),controller[_0x7141('0x8')]);router['get'](_0x7141('0x9'),auth[_0x7141('0x7')](),controller[_0x7141('0xa')]);router[_0x7141('0x6')](_0x7141('0xb'),auth[_0x7141('0x7')](),controller[_0x7141('0xc')]);router[_0x7141('0x6')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x7141('0xd')]);router['get'](_0x7141('0xe'),auth[_0x7141('0x7')](),controller[_0x7141('0xf')]);router[_0x7141('0x10')]('/',auth[_0x7141('0x7')](),controller['create']);router[_0x7141('0x11')](_0x7141('0x9'),auth[_0x7141('0x7')](),controller[_0x7141('0x12')]);router[_0x7141('0x13')](_0x7141('0x9'),auth[_0x7141('0x7')](),controller[_0x7141('0x14')]);module[_0x7141('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index c335ebd..d4e32f2 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 _0xce50=['exports','STRING','sequelize'];(function(_0x536851,_0x2302b2){var _0x30e3bf=function(_0x25498b){while(--_0x25498b){_0x536851['push'](_0x536851['shift']());}};_0x30e3bf(++_0x2302b2);}(_0xce50,0x8c));var _0x0ce5=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xce50[_0x263a74];return _0x2aa86c;};'use strict';var Sequelize=require(_0x0ce5('0x0'));module[_0x0ce5('0x1')]={'name':{'type':Sequelize[_0x0ce5('0x2')]},'description':{'type':Sequelize[_0x0ce5('0x2')]}}; \ No newline at end of file +var _0x9ec2=['STRING','sequelize','exports'];(function(_0xf8de92,_0x2baab6){var _0x4b2288=function(_0x23d969){while(--_0x23d969){_0xf8de92['push'](_0xf8de92['shift']());}};_0x4b2288(++_0x2baab6);}(_0x9ec2,0x7c));var _0x29ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ec2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x29ec('0x0'));module[_0x29ec('0x1')]={'name':{'type':Sequelize[_0x29ec('0x2')]},'description':{'type':Sequelize[_0x29ec('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index e8646f8..d0d025e 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 _0xb862=['request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','length','includeAll','options','create','body','find','params','findOne','ServicenowField','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x4f6ea8,_0x191395){var _0x39f538=function(_0x8aa4c9){while(--_0x8aa4c9){_0x4f6ea8['push'](_0x4f6ea8['shift']());}};_0x39f538(++_0x191395);}(_0xb862,0x148));var _0x2b86=function(_0x4a6425,_0x1894f0){_0x4a6425=_0x4a6425-0x0;var _0x287efb=_0xb862[_0x4a6425];return _0x287efb;};'use strict';var pdf=require(_0x2b86('0x0'));var emlformat=require(_0x2b86('0x1'));var rimraf=require(_0x2b86('0x2'));var zipdir=require(_0x2b86('0x3'));var jsonpatch=require(_0x2b86('0x4'));var rp=require(_0x2b86('0x5'));var moment=require(_0x2b86('0x6'));var BPromise=require(_0x2b86('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x2b86('0x8'));var ejs=require(_0x2b86('0x9'));var fs=require('fs');var _=require(_0x2b86('0xa'));var squel=require(_0x2b86('0xb'));var crypto=require('crypto');var jsforce=require(_0x2b86('0xc'));var deskjs=require(_0x2b86('0xd'));var toCsv=require(_0x2b86('0x8'));var querystring=require(_0x2b86('0xe'));var Papa=require(_0x2b86('0xf'));var Redis=require('ioredis');var authService=require(_0x2b86('0x10'));var qs=require(_0x2b86('0x11'));var as=require(_0x2b86('0x12'));var hardwareService=require(_0x2b86('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2b86('0x14'));var db=require(_0x2b86('0x15'))['db'];var jayson=require(_0x2b86('0x16'));var client=jayson[_0x2b86('0x17')][_0x2b86('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x28b6b1,_0x532686,_0x58ee5e,_0x512a42){return new BPromise(function(_0x25a899,_0x538438){var _0x35c611=_0x512a42||client;return _0x35c611['request'](_0x28b6b1,_0x58ee5e)[_0x2b86('0x19')](function(_0xa25a64){logger[_0x2b86('0x1a')](_0x2b86('0x1b'),_0x532686,_0x2b86('0x1c'));logger[_0x2b86('0x1d')](_0x2b86('0x1e'),_0x532686,'request\x20sent',JSON['stringify'](_0xa25a64));if(_0xa25a64[_0x2b86('0x1f')]){if(_0xa25a64[_0x2b86('0x1f')]['code']===0x1f4){logger[_0x2b86('0x1f')](_0x2b86('0x1b'),_0x532686,_0xa25a64[_0x2b86('0x1f')][_0x2b86('0x20')]);return _0x538438(_0xa25a64[_0x2b86('0x1f')][_0x2b86('0x20')]);}logger['error'](_0x2b86('0x1b'),_0x532686,_0xa25a64[_0x2b86('0x1f')][_0x2b86('0x20')]);return _0x25a899(_0xa25a64[_0x2b86('0x1f')][_0x2b86('0x20')]);}else{logger[_0x2b86('0x1a')](_0x2b86('0x1b'),_0x532686,_0x2b86('0x1c'));_0x25a899(_0xa25a64[_0x2b86('0x21')]['message']);}})['catch'](function(_0x56bd2c){logger[_0x2b86('0x1f')](_0x2b86('0x1b'),_0x532686,_0x56bd2c);_0x538438(_0x56bd2c);});});}function respondWithStatusCode(_0xcee3b9,_0x55a21d){_0x55a21d=_0x55a21d||0xcc;return function(_0x4d4b35){if(_0x4d4b35){return _0xcee3b9[_0x2b86('0x22')](_0x55a21d);}return _0xcee3b9[_0x2b86('0x23')](_0x55a21d)['end']();};}function respondWithResult(_0x3089aa,_0x5d4570){_0x5d4570=_0x5d4570||0xc8;return function(_0x1b9904){if(_0x1b9904){return _0x3089aa[_0x2b86('0x23')](_0x5d4570)[_0x2b86('0x24')](_0x1b9904);}};}function respondWithFilteredResult(_0x42dae1,_0x25d78a){return function(_0x301e83){if(_0x301e83){var _0x4af5c6=_0x301e83[_0x2b86('0x25')],_0xfe2821=_0x25d78a[_0x2b86('0x26')],_0x504cde=_0x25d78a[_0x2b86('0x26')]+_0x25d78a[_0x2b86('0x27')],_0x33c4c5;if(_0x504cde>=_0x4af5c6){_0x504cde=_0x4af5c6;_0x33c4c5=0xc8;}else{_0x33c4c5=0xce;}_0x42dae1[_0x2b86('0x23')](_0x33c4c5);return _0x42dae1[_0x2b86('0x28')](_0x2b86('0x29'),_0xfe2821+'-'+_0x504cde+'/'+_0x4af5c6)['json'](_0x301e83);}return null;};}function patchUpdates(_0x1a46e6){return function(_0x29c2ae){try{jsonpatch[_0x2b86('0x2a')](_0x29c2ae,_0x1a46e6,!![]);}catch(_0x50ce73){return BPromise[_0x2b86('0x2b')](_0x50ce73);}return _0x29c2ae[_0x2b86('0x2c')]();};}function saveUpdates(_0x22e21a,_0x4c321b){return function(_0x529b97){if(_0x529b97){return _0x529b97[_0x2b86('0x2d')](_0x22e21a)[_0x2b86('0x19')](function(_0x3d6dae){return _0x3d6dae;});}return null;};}function removeEntity(_0xcfaa12,_0x3078cd){return function(_0x5f1b04){if(_0x5f1b04){return _0x5f1b04[_0x2b86('0x2e')]()['then'](function(){_0xcfaa12[_0x2b86('0x23')](0xcc)[_0x2b86('0x2f')]();});}};}function handleEntityNotFound(_0x2995e0,_0x61744e){return function(_0x5bab8e){if(!_0x5bab8e){_0x2995e0[_0x2b86('0x22')](0x194);}return _0x5bab8e;};}function handleError(_0x3d4ed0,_0x47d37c){_0x47d37c=_0x47d37c||0x1f4;return function(_0x243bf7){logger[_0x2b86('0x1f')](_0x243bf7[_0x2b86('0x30')]);if(_0x243bf7['name']){delete _0x243bf7[_0x2b86('0x31')];}_0x3d4ed0[_0x2b86('0x23')](_0x47d37c)[_0x2b86('0x32')](_0x243bf7);};}exports[_0x2b86('0x33')]=function(_0x4e6b08,_0x17cc3f){var _0x172caf={},_0x240fa4={},_0x10cb79={'count':0x0,'rows':[]};var _0x5b6486=_[_0x2b86('0x34')](db[_0x2b86('0x35')][_0x2b86('0x36')],function(_0x3dfec7){return{'name':_0x3dfec7[_0x2b86('0x37')],'type':_0x3dfec7[_0x2b86('0x38')][_0x2b86('0x39')]};});_0x240fa4[_0x2b86('0x3a')]=_['map'](_0x5b6486,_0x2b86('0x31'));_0x240fa4[_0x2b86('0x3b')]=_[_0x2b86('0x3c')](_0x4e6b08[_0x2b86('0x3b')]);_0x240fa4[_0x2b86('0x3d')]=_[_0x2b86('0x3e')](_0x240fa4[_0x2b86('0x3a')],_0x240fa4[_0x2b86('0x3b')]);_0x172caf[_0x2b86('0x3f')]=_[_0x2b86('0x3e')](_0x240fa4[_0x2b86('0x3a')],qs['fields'](_0x4e6b08[_0x2b86('0x3b')][_0x2b86('0x40')]));_0x172caf[_0x2b86('0x3f')]=_0x172caf['attributes']['length']?_0x172caf[_0x2b86('0x3f')]:_0x240fa4[_0x2b86('0x3a')];if(!_0x4e6b08['query'][_0x2b86('0x41')](_0x2b86('0x42'))){_0x172caf['limit']=qs[_0x2b86('0x27')](_0x4e6b08['query']['limit']);_0x172caf[_0x2b86('0x26')]=qs[_0x2b86('0x26')](_0x4e6b08['query'][_0x2b86('0x26')]);}_0x172caf[_0x2b86('0x43')]=qs[_0x2b86('0x44')](_0x4e6b08[_0x2b86('0x3b')]['sort']);_0x172caf[_0x2b86('0x45')]=qs[_0x2b86('0x3d')](_[_0x2b86('0x46')](_0x4e6b08[_0x2b86('0x3b')],_0x240fa4[_0x2b86('0x3d')]),_0x5b6486);if(_0x4e6b08[_0x2b86('0x3b')][_0x2b86('0x47')]){_0x172caf['where']=_[_0x2b86('0x48')](_0x172caf[_0x2b86('0x45')],{'$or':_[_0x2b86('0x34')](_0x5b6486,function(_0x1ce511){if(_0x1ce511['type']!==_0x2b86('0x49')){var _0x2e84a4={};_0x2e84a4[_0x1ce511[_0x2b86('0x31')]]={'$like':'%'+_0x4e6b08['query'][_0x2b86('0x47')]+'%'};return _0x2e84a4;}})});}_0x172caf=_[_0x2b86('0x48')]({},_0x172caf,_0x4e6b08['options']);var _0x4355a7={'where':_0x172caf[_0x2b86('0x45')]};return db['ServicenowConfiguration']['count'](_0x4355a7)['then'](function(_0x475560){_0x10cb79['count']=_0x475560;if(_0x4e6b08['query']['includeAll']){_0x172caf[_0x2b86('0x4a')]=[{'all':!![]}];}return db[_0x2b86('0x35')][_0x2b86('0x4b')](_0x172caf);})['then'](function(_0x2536a0){_0x10cb79['rows']=_0x2536a0;return _0x10cb79;})[_0x2b86('0x19')](respondWithFilteredResult(_0x17cc3f,_0x172caf))[_0x2b86('0x4c')](handleError(_0x17cc3f,null));};exports['show']=function(_0x1e2437,_0x12cf98){var _0x44049b={'raw':![],'where':{'id':_0x1e2437['params']['id']}},_0x315ae1={};_0x315ae1['model']=_[_0x2b86('0x3c')](db[_0x2b86('0x35')][_0x2b86('0x36')]);_0x315ae1[_0x2b86('0x3b')]=_[_0x2b86('0x3c')](_0x1e2437[_0x2b86('0x3b')]);_0x315ae1[_0x2b86('0x3d')]=_[_0x2b86('0x3e')](_0x315ae1[_0x2b86('0x3a')],_0x315ae1[_0x2b86('0x3b')]);_0x44049b[_0x2b86('0x3f')]=_[_0x2b86('0x3e')](_0x315ae1[_0x2b86('0x3a')],qs['fields'](_0x1e2437[_0x2b86('0x3b')][_0x2b86('0x40')]));_0x44049b[_0x2b86('0x3f')]=_0x44049b[_0x2b86('0x3f')][_0x2b86('0x4d')]?_0x44049b[_0x2b86('0x3f')]:_0x315ae1['model'];if(_0x1e2437['query'][_0x2b86('0x4e')]){_0x44049b[_0x2b86('0x4a')]=[{'all':!![]}];}_0x44049b=_['merge']({},_0x44049b,_0x1e2437[_0x2b86('0x4f')]);return db['ServicenowConfiguration']['find'](_0x44049b)[_0x2b86('0x19')](handleEntityNotFound(_0x12cf98,null))[_0x2b86('0x19')](respondWithResult(_0x12cf98,null))['catch'](handleError(_0x12cf98,null));};exports['create']=function(_0x43dcc5,_0xc2c645){return db[_0x2b86('0x35')][_0x2b86('0x50')](_0x43dcc5['body'],{})[_0x2b86('0x19')](respondWithResult(_0xc2c645,0xc9))[_0x2b86('0x4c')](handleError(_0xc2c645,null));};exports['update']=function(_0x57c266,_0x144e29){if(_0x57c266[_0x2b86('0x51')]['id']){delete _0x57c266[_0x2b86('0x51')]['id'];}return db[_0x2b86('0x35')][_0x2b86('0x52')]({'where':{'id':_0x57c266[_0x2b86('0x53')]['id']}})[_0x2b86('0x19')](handleEntityNotFound(_0x144e29,null))[_0x2b86('0x19')](saveUpdates(_0x57c266[_0x2b86('0x51')],null))[_0x2b86('0x19')](respondWithResult(_0x144e29,null))['catch'](handleError(_0x144e29,null));};exports[_0x2b86('0x2e')]=function(_0x273513,_0x135a9e){return db[_0x2b86('0x35')][_0x2b86('0x52')]({'where':{'id':_0x273513['params']['id']}})[_0x2b86('0x19')](handleEntityNotFound(_0x135a9e,null))[_0x2b86('0x19')](removeEntity(_0x135a9e,null))[_0x2b86('0x4c')](handleError(_0x135a9e,null));};exports['getFields']=function(_0x27066e,_0x4774d1,_0x531f14){var _0x3a7648={};var _0x140ea5={};var _0x246fd8;var _0x4a3459;return db['ServicenowConfiguration'][_0x2b86('0x54')]({'where':{'id':_0x27066e[_0x2b86('0x53')]['id']}})['then'](handleEntityNotFound(_0x4774d1,null))[_0x2b86('0x19')](function(_0x4b2a5b){if(_0x4b2a5b){_0x246fd8=_0x4b2a5b;_0x140ea5[_0x2b86('0x3a')]=_['keys'](db[_0x2b86('0x55')][_0x2b86('0x36')]);_0x140ea5[_0x2b86('0x3b')]=_[_0x2b86('0x3c')](_0x27066e[_0x2b86('0x3b')]);_0x140ea5['filters']=_[_0x2b86('0x3e')](_0x140ea5[_0x2b86('0x3a')],_0x140ea5[_0x2b86('0x3b')]);_0x3a7648['attributes']=_[_0x2b86('0x3e')](_0x140ea5['model'],qs[_0x2b86('0x40')](_0x27066e[_0x2b86('0x3b')][_0x2b86('0x40')]));_0x3a7648[_0x2b86('0x3f')]=_0x3a7648['attributes'][_0x2b86('0x4d')]?_0x3a7648[_0x2b86('0x3f')]:_0x140ea5[_0x2b86('0x3a')];_0x3a7648[_0x2b86('0x43')]=qs[_0x2b86('0x44')](_0x27066e[_0x2b86('0x3b')][_0x2b86('0x44')]);_0x3a7648['where']=qs[_0x2b86('0x3d')](_[_0x2b86('0x46')](_0x27066e[_0x2b86('0x3b')],_0x140ea5['filters']));if(_0x27066e[_0x2b86('0x3b')]['filter']){_0x3a7648['where']=_[_0x2b86('0x48')](_0x3a7648['where'],{'$or':_['map'](_0x3a7648[_0x2b86('0x3f')],function(_0x23fb41){var _0x3f0025={};_0x3f0025[_0x23fb41]={'$like':'%'+_0x27066e[_0x2b86('0x3b')]['filter']+'%'};return _0x3f0025;})});}_0x3a7648=_[_0x2b86('0x48')]({},_0x3a7648,_0x27066e[_0x2b86('0x4f')]);return _0x246fd8[_0x2b86('0x56')](_0x3a7648);}})['then'](function(_0x23711d){if(_0x23711d){_0x4a3459=_0x23711d[_0x2b86('0x4d')];if(!_0x27066e[_0x2b86('0x3b')][_0x2b86('0x41')](_0x2b86('0x42'))){_0x3a7648['limit']=qs[_0x2b86('0x27')](_0x27066e[_0x2b86('0x3b')][_0x2b86('0x27')]);_0x3a7648[_0x2b86('0x26')]=qs[_0x2b86('0x26')](_0x27066e[_0x2b86('0x3b')]['offset']);}return _0x246fd8['getFields'](_0x3a7648);}})[_0x2b86('0x19')](function(_0x1c066d){if(_0x1c066d){return _0x1c066d?{'count':_0x4a3459,'rows':_0x1c066d}:null;}})['then'](respondWithResult(_0x4774d1,null))[_0x2b86('0x4c')](handleError(_0x4774d1,null));};exports[_0x2b86('0x57')]=function(_0x359698,_0x2667d5,_0x306605){var _0x45faa6={};var _0x308c4d={};var _0x2d9c0a;var _0x3d1c23;return db[_0x2b86('0x35')][_0x2b86('0x54')]({'where':{'id':_0x359698[_0x2b86('0x53')]['id']}})['then'](handleEntityNotFound(_0x2667d5,null))[_0x2b86('0x19')](function(_0x1979a0){if(_0x1979a0){_0x2d9c0a=_0x1979a0;_0x308c4d[_0x2b86('0x3a')]=_[_0x2b86('0x3c')](db[_0x2b86('0x55')]['rawAttributes']);_0x308c4d[_0x2b86('0x3b')]=_['keys'](_0x359698[_0x2b86('0x3b')]);_0x308c4d[_0x2b86('0x3d')]=_[_0x2b86('0x3e')](_0x308c4d[_0x2b86('0x3a')],_0x308c4d[_0x2b86('0x3b')]);_0x45faa6[_0x2b86('0x3f')]=_['intersection'](_0x308c4d[_0x2b86('0x3a')],qs[_0x2b86('0x40')](_0x359698['query'][_0x2b86('0x40')]));_0x45faa6[_0x2b86('0x3f')]=_0x45faa6['attributes']['length']?_0x45faa6['attributes']:_0x308c4d[_0x2b86('0x3a')];_0x45faa6['order']=qs['sort'](_0x359698[_0x2b86('0x3b')][_0x2b86('0x44')]);_0x45faa6[_0x2b86('0x45')]=qs[_0x2b86('0x3d')](_[_0x2b86('0x46')](_0x359698['query'],_0x308c4d[_0x2b86('0x3d')]));if(_0x359698['query']['filter']){_0x45faa6[_0x2b86('0x45')]=_[_0x2b86('0x48')](_0x45faa6['where'],{'$or':_[_0x2b86('0x34')](_0x45faa6[_0x2b86('0x3f')],function(_0x241902){var _0x3d3318={};_0x3d3318[_0x241902]={'$like':'%'+_0x359698[_0x2b86('0x3b')]['filter']+'%'};return _0x3d3318;})});}_0x45faa6=_[_0x2b86('0x48')]({},_0x45faa6,_0x359698[_0x2b86('0x4f')]);return _0x2d9c0a[_0x2b86('0x57')](_0x45faa6);}})[_0x2b86('0x19')](function(_0x3eb91e){if(_0x3eb91e){_0x3d1c23=_0x3eb91e['length'];if(!_0x359698[_0x2b86('0x3b')][_0x2b86('0x41')](_0x2b86('0x42'))){_0x45faa6[_0x2b86('0x27')]=qs[_0x2b86('0x27')](_0x359698[_0x2b86('0x3b')][_0x2b86('0x27')]);_0x45faa6['offset']=qs[_0x2b86('0x26')](_0x359698['query'][_0x2b86('0x26')]);}return _0x2d9c0a[_0x2b86('0x57')](_0x45faa6);}})[_0x2b86('0x19')](function(_0xae8a68){if(_0xae8a68){return _0xae8a68?{'count':_0x3d1c23,'rows':_0xae8a68}:null;}})[_0x2b86('0x19')](respondWithResult(_0x2667d5,null))[_0x2b86('0x4c')](handleError(_0x2667d5,null));};exports[_0x2b86('0x58')]=function(_0x5a3b7a,_0x8e0de5,_0x592646){var _0x127156={};var _0x3b0453={};var _0x186aa2;var _0x127720;return db[_0x2b86('0x35')]['findOne']({'where':{'id':_0x5a3b7a[_0x2b86('0x53')]['id']}})[_0x2b86('0x19')](handleEntityNotFound(_0x8e0de5,null))[_0x2b86('0x19')](function(_0x151011){if(_0x151011){_0x186aa2=_0x151011;_0x3b0453[_0x2b86('0x3a')]=_['keys'](db[_0x2b86('0x55')][_0x2b86('0x36')]);_0x3b0453[_0x2b86('0x3b')]=_[_0x2b86('0x3c')](_0x5a3b7a[_0x2b86('0x3b')]);_0x3b0453['filters']=_['intersection'](_0x3b0453['model'],_0x3b0453[_0x2b86('0x3b')]);_0x127156[_0x2b86('0x3f')]=_[_0x2b86('0x3e')](_0x3b0453[_0x2b86('0x3a')],qs['fields'](_0x5a3b7a['query'][_0x2b86('0x40')]));_0x127156[_0x2b86('0x3f')]=_0x127156[_0x2b86('0x3f')][_0x2b86('0x4d')]?_0x127156[_0x2b86('0x3f')]:_0x3b0453[_0x2b86('0x3a')];_0x127156[_0x2b86('0x43')]=qs[_0x2b86('0x44')](_0x5a3b7a[_0x2b86('0x3b')][_0x2b86('0x44')]);_0x127156[_0x2b86('0x45')]=qs[_0x2b86('0x3d')](_['pick'](_0x5a3b7a[_0x2b86('0x3b')],_0x3b0453[_0x2b86('0x3d')]));if(_0x5a3b7a['query'][_0x2b86('0x47')]){_0x127156['where']=_[_0x2b86('0x48')](_0x127156[_0x2b86('0x45')],{'$or':_[_0x2b86('0x34')](_0x127156[_0x2b86('0x3f')],function(_0x1428f0){var _0x3aacd5={};_0x3aacd5[_0x1428f0]={'$like':'%'+_0x5a3b7a['query'][_0x2b86('0x47')]+'%'};return _0x3aacd5;})});}_0x127156=_[_0x2b86('0x48')]({},_0x127156,_0x5a3b7a[_0x2b86('0x4f')]);return _0x186aa2[_0x2b86('0x58')](_0x127156);}})['then'](function(_0xe22e86){if(_0xe22e86){_0x127720=_0xe22e86['length'];if(!_0x5a3b7a['query'][_0x2b86('0x41')](_0x2b86('0x42'))){_0x127156['limit']=qs[_0x2b86('0x27')](_0x5a3b7a['query'][_0x2b86('0x27')]);_0x127156[_0x2b86('0x26')]=qs[_0x2b86('0x26')](_0x5a3b7a[_0x2b86('0x3b')][_0x2b86('0x26')]);}return _0x186aa2['getDescriptions'](_0x127156);}})['then'](function(_0x67942d){if(_0x67942d){return _0x67942d?{'count':_0x127720,'rows':_0x67942d}:null;}})[_0x2b86('0x19')](respondWithResult(_0x8e0de5,null))[_0x2b86('0x4c')](handleError(_0x8e0de5,null));}; \ No newline at end of file +var _0xffa7=['fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','rows','show','params','include','find','create','body','getFields','findOne','pick','options','getSubjects','ServicenowField','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','request\x20sent','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','ServicenowConfiguration','rawAttributes'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xffa7,0x130));var _0x7ffa=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xffa7[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x7ffa('0x0'));var emlformat=require(_0x7ffa('0x1'));var rimraf=require(_0x7ffa('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ffa('0x3'));var rp=require('request-promise');var moment=require(_0x7ffa('0x4'));var BPromise=require(_0x7ffa('0x5'));var Mustache=require(_0x7ffa('0x6'));var util=require('util');var path=require(_0x7ffa('0x7'));var sox=require(_0x7ffa('0x8'));var csv=require(_0x7ffa('0x9'));var ejs=require(_0x7ffa('0xa'));var fs=require('fs');var _=require(_0x7ffa('0xb'));var squel=require(_0x7ffa('0xc'));var crypto=require(_0x7ffa('0xd'));var jsforce=require(_0x7ffa('0xe'));var deskjs=require(_0x7ffa('0xf'));var toCsv=require(_0x7ffa('0x9'));var querystring=require('querystring');var Papa=require(_0x7ffa('0x10'));var Redis=require(_0x7ffa('0x11'));var authService=require(_0x7ffa('0x12'));var qs=require(_0x7ffa('0x13'));var as=require(_0x7ffa('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7ffa('0x15'))(_0x7ffa('0x16'));var utils=require(_0x7ffa('0x17'));var config=require(_0x7ffa('0x18'));var licenseUtil=require(_0x7ffa('0x19'));var db=require(_0x7ffa('0x1a'))['db'];var jayson=require(_0x7ffa('0x1b'));var client=jayson['client'][_0x7ffa('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x160458,_0x1fb40d,_0x4db911,_0x1286ef){return new BPromise(function(_0x2ca369,_0x5c0c81){var _0x32db22=_0x1286ef||client;return _0x32db22[_0x7ffa('0x1d')](_0x160458,_0x4db911)[_0x7ffa('0x1e')](function(_0x1abb84){logger[_0x7ffa('0x1f')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1fb40d,_0x7ffa('0x20'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x1fb40d,_0x7ffa('0x20'),JSON['stringify'](_0x1abb84));if(_0x1abb84[_0x7ffa('0x21')]){if(_0x1abb84['error'][_0x7ffa('0x22')]===0x1f4){logger['error'](_0x7ffa('0x23'),_0x1fb40d,_0x1abb84[_0x7ffa('0x21')][_0x7ffa('0x24')]);return _0x5c0c81(_0x1abb84[_0x7ffa('0x21')]['message']);}logger['error'](_0x7ffa('0x23'),_0x1fb40d,_0x1abb84[_0x7ffa('0x21')][_0x7ffa('0x24')]);return _0x2ca369(_0x1abb84[_0x7ffa('0x21')]['message']);}else{logger[_0x7ffa('0x1f')](_0x7ffa('0x23'),_0x1fb40d,_0x7ffa('0x20'));_0x2ca369(_0x1abb84['result'][_0x7ffa('0x24')]);}})[_0x7ffa('0x25')](function(_0x4b3dcc){logger[_0x7ffa('0x21')](_0x7ffa('0x23'),_0x1fb40d,_0x4b3dcc);_0x5c0c81(_0x4b3dcc);});});}function respondWithStatusCode(_0x5ae129,_0x48ca7b){_0x48ca7b=_0x48ca7b||0xcc;return function(_0x3ab1b){if(_0x3ab1b){return _0x5ae129[_0x7ffa('0x26')](_0x48ca7b);}return _0x5ae129['status'](_0x48ca7b)['end']();};}function respondWithResult(_0x54fbdf,_0x5c4501){_0x5c4501=_0x5c4501||0xc8;return function(_0x50803b){if(_0x50803b){return _0x54fbdf[_0x7ffa('0x27')](_0x5c4501)[_0x7ffa('0x28')](_0x50803b);}};}function respondWithFilteredResult(_0x2efe86,_0x1d0fdf){return function(_0x3dc630){if(_0x3dc630){var _0x3bc087=_0x3dc630[_0x7ffa('0x29')],_0x299d4f=_0x1d0fdf[_0x7ffa('0x2a')],_0x2f0171=_0x1d0fdf['offset']+_0x1d0fdf[_0x7ffa('0x2b')],_0x34e38b;if(_0x2f0171>=_0x3bc087){_0x2f0171=_0x3bc087;_0x34e38b=0xc8;}else{_0x34e38b=0xce;}_0x2efe86['status'](_0x34e38b);return _0x2efe86[_0x7ffa('0x2c')](_0x7ffa('0x2d'),_0x299d4f+'-'+_0x2f0171+'/'+_0x3bc087)[_0x7ffa('0x28')](_0x3dc630);}return null;};}function patchUpdates(_0x3ac79e){return function(_0x52da01){try{jsonpatch[_0x7ffa('0x2e')](_0x52da01,_0x3ac79e,!![]);}catch(_0x3ec6ee){return BPromise[_0x7ffa('0x2f')](_0x3ec6ee);}return _0x52da01[_0x7ffa('0x30')]();};}function saveUpdates(_0x1eaeba,_0x108467){return function(_0x1f2732){if(_0x1f2732){return _0x1f2732[_0x7ffa('0x31')](_0x1eaeba)[_0x7ffa('0x1e')](function(_0x2f66de){return _0x2f66de;});}return null;};}function removeEntity(_0x18a20c,_0xe71275){return function(_0x2df477){if(_0x2df477){return _0x2df477[_0x7ffa('0x32')]()[_0x7ffa('0x1e')](function(){_0x18a20c[_0x7ffa('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7a2313,_0x559ad2){return function(_0x32dffe){if(!_0x32dffe){_0x7a2313[_0x7ffa('0x26')](0x194);}return _0x32dffe;};}function handleError(_0x223fdf,_0x3348e6){_0x3348e6=_0x3348e6||0x1f4;return function(_0x2c6cfd){logger[_0x7ffa('0x21')](_0x2c6cfd[_0x7ffa('0x33')]);if(_0x2c6cfd[_0x7ffa('0x34')]){delete _0x2c6cfd[_0x7ffa('0x34')];}_0x223fdf[_0x7ffa('0x27')](_0x3348e6)['send'](_0x2c6cfd);};}exports[_0x7ffa('0x35')]=function(_0x326057,_0x57d055){var _0x422743={},_0x50f2b9={},_0x41df3c={'count':0x0,'rows':[]};var _0x1f2b33=_['map'](db[_0x7ffa('0x36')][_0x7ffa('0x37')],function(_0xffc8e1){return{'name':_0xffc8e1[_0x7ffa('0x38')],'type':_0xffc8e1[_0x7ffa('0x39')][_0x7ffa('0x3a')]};});_0x50f2b9[_0x7ffa('0x3b')]=_[_0x7ffa('0x3c')](_0x1f2b33,'name');_0x50f2b9[_0x7ffa('0x3d')]=_[_0x7ffa('0x3e')](_0x326057[_0x7ffa('0x3d')]);_0x50f2b9[_0x7ffa('0x3f')]=_[_0x7ffa('0x40')](_0x50f2b9[_0x7ffa('0x3b')],_0x50f2b9[_0x7ffa('0x3d')]);_0x422743['attributes']=_['intersection'](_0x50f2b9['model'],qs[_0x7ffa('0x41')](_0x326057[_0x7ffa('0x3d')][_0x7ffa('0x41')]));_0x422743[_0x7ffa('0x42')]=_0x422743[_0x7ffa('0x42')][_0x7ffa('0x43')]?_0x422743[_0x7ffa('0x42')]:_0x50f2b9[_0x7ffa('0x3b')];if(!_0x326057[_0x7ffa('0x3d')][_0x7ffa('0x44')](_0x7ffa('0x45'))){_0x422743[_0x7ffa('0x2b')]=qs['limit'](_0x326057[_0x7ffa('0x3d')][_0x7ffa('0x2b')]);_0x422743['offset']=qs[_0x7ffa('0x2a')](_0x326057[_0x7ffa('0x3d')]['offset']);}_0x422743[_0x7ffa('0x46')]=qs['sort'](_0x326057[_0x7ffa('0x3d')][_0x7ffa('0x47')]);_0x422743[_0x7ffa('0x48')]=qs[_0x7ffa('0x3f')](_['pick'](_0x326057[_0x7ffa('0x3d')],_0x50f2b9[_0x7ffa('0x3f')]),_0x1f2b33);if(_0x326057[_0x7ffa('0x3d')][_0x7ffa('0x49')]){_0x422743[_0x7ffa('0x48')]=_[_0x7ffa('0x4a')](_0x422743[_0x7ffa('0x48')],{'$or':_[_0x7ffa('0x3c')](_0x1f2b33,function(_0x3ccbcd){if(_0x3ccbcd[_0x7ffa('0x39')]!==_0x7ffa('0x4b')){var _0x40afad={};_0x40afad[_0x3ccbcd[_0x7ffa('0x34')]]={'$like':'%'+_0x326057['query']['filter']+'%'};return _0x40afad;}})});}_0x422743=_['merge']({},_0x422743,_0x326057['options']);var _0x411fc5={'where':_0x422743[_0x7ffa('0x48')]};return db[_0x7ffa('0x36')][_0x7ffa('0x29')](_0x411fc5)[_0x7ffa('0x1e')](function(_0xe89043){_0x41df3c[_0x7ffa('0x29')]=_0xe89043;if(_0x326057['query']['includeAll']){_0x422743['include']=[{'all':!![]}];}return db[_0x7ffa('0x36')]['findAll'](_0x422743);})[_0x7ffa('0x1e')](function(_0xa1b310){_0x41df3c[_0x7ffa('0x4c')]=_0xa1b310;return _0x41df3c;})['then'](respondWithFilteredResult(_0x57d055,_0x422743))[_0x7ffa('0x25')](handleError(_0x57d055,null));};exports[_0x7ffa('0x4d')]=function(_0x13eec0,_0x577176){var _0x55d556={'raw':![],'where':{'id':_0x13eec0[_0x7ffa('0x4e')]['id']}},_0x77953b={};_0x77953b['model']=_[_0x7ffa('0x3e')](db['ServicenowConfiguration']['rawAttributes']);_0x77953b['query']=_[_0x7ffa('0x3e')](_0x13eec0[_0x7ffa('0x3d')]);_0x77953b[_0x7ffa('0x3f')]=_[_0x7ffa('0x40')](_0x77953b['model'],_0x77953b[_0x7ffa('0x3d')]);_0x55d556[_0x7ffa('0x42')]=_[_0x7ffa('0x40')](_0x77953b['model'],qs['fields'](_0x13eec0[_0x7ffa('0x3d')]['fields']));_0x55d556[_0x7ffa('0x42')]=_0x55d556[_0x7ffa('0x42')][_0x7ffa('0x43')]?_0x55d556['attributes']:_0x77953b[_0x7ffa('0x3b')];if(_0x13eec0['query']['includeAll']){_0x55d556[_0x7ffa('0x4f')]=[{'all':!![]}];}_0x55d556=_['merge']({},_0x55d556,_0x13eec0['options']);return db[_0x7ffa('0x36')][_0x7ffa('0x50')](_0x55d556)['then'](handleEntityNotFound(_0x577176,null))[_0x7ffa('0x1e')](respondWithResult(_0x577176,null))['catch'](handleError(_0x577176,null));};exports[_0x7ffa('0x51')]=function(_0x10fa7a,_0x5b590e){return db['ServicenowConfiguration'][_0x7ffa('0x51')](_0x10fa7a[_0x7ffa('0x52')],{})[_0x7ffa('0x1e')](respondWithResult(_0x5b590e,0xc9))[_0x7ffa('0x25')](handleError(_0x5b590e,null));};exports[_0x7ffa('0x31')]=function(_0x522573,_0x3a0631){if(_0x522573[_0x7ffa('0x52')]['id']){delete _0x522573[_0x7ffa('0x52')]['id'];}return db['ServicenowConfiguration'][_0x7ffa('0x50')]({'where':{'id':_0x522573[_0x7ffa('0x4e')]['id']}})[_0x7ffa('0x1e')](handleEntityNotFound(_0x3a0631,null))[_0x7ffa('0x1e')](saveUpdates(_0x522573[_0x7ffa('0x52')],null))[_0x7ffa('0x1e')](respondWithResult(_0x3a0631,null))['catch'](handleError(_0x3a0631,null));};exports[_0x7ffa('0x32')]=function(_0x20c03b,_0x183979){return db['ServicenowConfiguration'][_0x7ffa('0x50')]({'where':{'id':_0x20c03b['params']['id']}})[_0x7ffa('0x1e')](handleEntityNotFound(_0x183979,null))[_0x7ffa('0x1e')](removeEntity(_0x183979,null))[_0x7ffa('0x25')](handleError(_0x183979,null));};exports[_0x7ffa('0x53')]=function(_0x11153f,_0x2f6a91,_0x17f77a){var _0x3b1ec5={};var _0x2e170b={};var _0x5c1fc3;var _0x2521e0;return db[_0x7ffa('0x36')][_0x7ffa('0x54')]({'where':{'id':_0x11153f[_0x7ffa('0x4e')]['id']}})[_0x7ffa('0x1e')](handleEntityNotFound(_0x2f6a91,null))[_0x7ffa('0x1e')](function(_0x4f24b5){if(_0x4f24b5){_0x5c1fc3=_0x4f24b5;_0x2e170b['model']=_[_0x7ffa('0x3e')](db['ServicenowField'][_0x7ffa('0x37')]);_0x2e170b[_0x7ffa('0x3d')]=_[_0x7ffa('0x3e')](_0x11153f[_0x7ffa('0x3d')]);_0x2e170b[_0x7ffa('0x3f')]=_['intersection'](_0x2e170b[_0x7ffa('0x3b')],_0x2e170b[_0x7ffa('0x3d')]);_0x3b1ec5[_0x7ffa('0x42')]=_['intersection'](_0x2e170b[_0x7ffa('0x3b')],qs[_0x7ffa('0x41')](_0x11153f[_0x7ffa('0x3d')][_0x7ffa('0x41')]));_0x3b1ec5['attributes']=_0x3b1ec5['attributes'][_0x7ffa('0x43')]?_0x3b1ec5[_0x7ffa('0x42')]:_0x2e170b[_0x7ffa('0x3b')];_0x3b1ec5[_0x7ffa('0x46')]=qs['sort'](_0x11153f[_0x7ffa('0x3d')][_0x7ffa('0x47')]);_0x3b1ec5[_0x7ffa('0x48')]=qs[_0x7ffa('0x3f')](_[_0x7ffa('0x55')](_0x11153f[_0x7ffa('0x3d')],_0x2e170b[_0x7ffa('0x3f')]));if(_0x11153f[_0x7ffa('0x3d')][_0x7ffa('0x49')]){_0x3b1ec5[_0x7ffa('0x48')]=_['merge'](_0x3b1ec5[_0x7ffa('0x48')],{'$or':_[_0x7ffa('0x3c')](_0x3b1ec5[_0x7ffa('0x42')],function(_0x48e459){var _0xce8eb4={};_0xce8eb4[_0x48e459]={'$like':'%'+_0x11153f[_0x7ffa('0x3d')][_0x7ffa('0x49')]+'%'};return _0xce8eb4;})});}_0x3b1ec5=_[_0x7ffa('0x4a')]({},_0x3b1ec5,_0x11153f[_0x7ffa('0x56')]);return _0x5c1fc3[_0x7ffa('0x53')](_0x3b1ec5);}})[_0x7ffa('0x1e')](function(_0x5ef95b){if(_0x5ef95b){_0x2521e0=_0x5ef95b[_0x7ffa('0x43')];if(!_0x11153f[_0x7ffa('0x3d')][_0x7ffa('0x44')](_0x7ffa('0x45'))){_0x3b1ec5[_0x7ffa('0x2b')]=qs[_0x7ffa('0x2b')](_0x11153f[_0x7ffa('0x3d')][_0x7ffa('0x2b')]);_0x3b1ec5[_0x7ffa('0x2a')]=qs[_0x7ffa('0x2a')](_0x11153f[_0x7ffa('0x3d')][_0x7ffa('0x2a')]);}return _0x5c1fc3[_0x7ffa('0x53')](_0x3b1ec5);}})[_0x7ffa('0x1e')](function(_0x57e806){if(_0x57e806){return _0x57e806?{'count':_0x2521e0,'rows':_0x57e806}:null;}})[_0x7ffa('0x1e')](respondWithResult(_0x2f6a91,null))[_0x7ffa('0x25')](handleError(_0x2f6a91,null));};exports[_0x7ffa('0x57')]=function(_0x4ce6ad,_0x57cffa,_0x494553){var _0x5cb929={};var _0xeb89d6={};var _0x58af95;var _0x376492;return db[_0x7ffa('0x36')][_0x7ffa('0x54')]({'where':{'id':_0x4ce6ad[_0x7ffa('0x4e')]['id']}})[_0x7ffa('0x1e')](handleEntityNotFound(_0x57cffa,null))['then'](function(_0x3b6795){if(_0x3b6795){_0x58af95=_0x3b6795;_0xeb89d6[_0x7ffa('0x3b')]=_[_0x7ffa('0x3e')](db[_0x7ffa('0x58')][_0x7ffa('0x37')]);_0xeb89d6['query']=_[_0x7ffa('0x3e')](_0x4ce6ad[_0x7ffa('0x3d')]);_0xeb89d6[_0x7ffa('0x3f')]=_['intersection'](_0xeb89d6[_0x7ffa('0x3b')],_0xeb89d6[_0x7ffa('0x3d')]);_0x5cb929[_0x7ffa('0x42')]=_[_0x7ffa('0x40')](_0xeb89d6[_0x7ffa('0x3b')],qs[_0x7ffa('0x41')](_0x4ce6ad[_0x7ffa('0x3d')][_0x7ffa('0x41')]));_0x5cb929[_0x7ffa('0x42')]=_0x5cb929[_0x7ffa('0x42')][_0x7ffa('0x43')]?_0x5cb929[_0x7ffa('0x42')]:_0xeb89d6['model'];_0x5cb929['order']=qs['sort'](_0x4ce6ad[_0x7ffa('0x3d')][_0x7ffa('0x47')]);_0x5cb929[_0x7ffa('0x48')]=qs[_0x7ffa('0x3f')](_[_0x7ffa('0x55')](_0x4ce6ad[_0x7ffa('0x3d')],_0xeb89d6[_0x7ffa('0x3f')]));if(_0x4ce6ad[_0x7ffa('0x3d')][_0x7ffa('0x49')]){_0x5cb929[_0x7ffa('0x48')]=_[_0x7ffa('0x4a')](_0x5cb929['where'],{'$or':_[_0x7ffa('0x3c')](_0x5cb929[_0x7ffa('0x42')],function(_0xdc3e6f){var _0x1d8b14={};_0x1d8b14[_0xdc3e6f]={'$like':'%'+_0x4ce6ad['query'][_0x7ffa('0x49')]+'%'};return _0x1d8b14;})});}_0x5cb929=_[_0x7ffa('0x4a')]({},_0x5cb929,_0x4ce6ad[_0x7ffa('0x56')]);return _0x58af95['getSubjects'](_0x5cb929);}})['then'](function(_0x1f8abf){if(_0x1f8abf){_0x376492=_0x1f8abf[_0x7ffa('0x43')];if(!_0x4ce6ad[_0x7ffa('0x3d')][_0x7ffa('0x44')](_0x7ffa('0x45'))){_0x5cb929[_0x7ffa('0x2b')]=qs['limit'](_0x4ce6ad[_0x7ffa('0x3d')][_0x7ffa('0x2b')]);_0x5cb929['offset']=qs['offset'](_0x4ce6ad['query'][_0x7ffa('0x2a')]);}return _0x58af95[_0x7ffa('0x57')](_0x5cb929);}})[_0x7ffa('0x1e')](function(_0x344211){if(_0x344211){return _0x344211?{'count':_0x376492,'rows':_0x344211}:null;}})['then'](respondWithResult(_0x57cffa,null))[_0x7ffa('0x25')](handleError(_0x57cffa,null));};exports['getDescriptions']=function(_0x3b7d43,_0x3d7196,_0x6b0d03){var _0x86996c={};var _0x93696c={};var _0x136017;var _0x43675d;return db[_0x7ffa('0x36')][_0x7ffa('0x54')]({'where':{'id':_0x3b7d43[_0x7ffa('0x4e')]['id']}})[_0x7ffa('0x1e')](handleEntityNotFound(_0x3d7196,null))[_0x7ffa('0x1e')](function(_0x1a31a9){if(_0x1a31a9){_0x136017=_0x1a31a9;_0x93696c[_0x7ffa('0x3b')]=_[_0x7ffa('0x3e')](db[_0x7ffa('0x58')][_0x7ffa('0x37')]);_0x93696c['query']=_[_0x7ffa('0x3e')](_0x3b7d43[_0x7ffa('0x3d')]);_0x93696c[_0x7ffa('0x3f')]=_[_0x7ffa('0x40')](_0x93696c[_0x7ffa('0x3b')],_0x93696c['query']);_0x86996c[_0x7ffa('0x42')]=_[_0x7ffa('0x40')](_0x93696c[_0x7ffa('0x3b')],qs[_0x7ffa('0x41')](_0x3b7d43[_0x7ffa('0x3d')][_0x7ffa('0x41')]));_0x86996c['attributes']=_0x86996c[_0x7ffa('0x42')][_0x7ffa('0x43')]?_0x86996c['attributes']:_0x93696c[_0x7ffa('0x3b')];_0x86996c[_0x7ffa('0x46')]=qs['sort'](_0x3b7d43['query'][_0x7ffa('0x47')]);_0x86996c['where']=qs['filters'](_[_0x7ffa('0x55')](_0x3b7d43[_0x7ffa('0x3d')],_0x93696c[_0x7ffa('0x3f')]));if(_0x3b7d43[_0x7ffa('0x3d')][_0x7ffa('0x49')]){_0x86996c[_0x7ffa('0x48')]=_[_0x7ffa('0x4a')](_0x86996c[_0x7ffa('0x48')],{'$or':_['map'](_0x86996c['attributes'],function(_0x38a0bb){var _0x46d223={};_0x46d223[_0x38a0bb]={'$like':'%'+_0x3b7d43[_0x7ffa('0x3d')][_0x7ffa('0x49')]+'%'};return _0x46d223;})});}_0x86996c=_['merge']({},_0x86996c,_0x3b7d43['options']);return _0x136017[_0x7ffa('0x59')](_0x86996c);}})['then'](function(_0x493e36){if(_0x493e36){_0x43675d=_0x493e36['length'];if(!_0x3b7d43[_0x7ffa('0x3d')]['hasOwnProperty'](_0x7ffa('0x45'))){_0x86996c[_0x7ffa('0x2b')]=qs['limit'](_0x3b7d43[_0x7ffa('0x3d')][_0x7ffa('0x2b')]);_0x86996c[_0x7ffa('0x2a')]=qs[_0x7ffa('0x2a')](_0x3b7d43[_0x7ffa('0x3d')]['offset']);}return _0x136017[_0x7ffa('0x59')](_0x86996c);}})[_0x7ffa('0x1e')](function(_0x19ddc8){if(_0x19ddc8){return _0x19ddc8?{'count':_0x43675d,'rows':_0x19ddc8}:null;}})[_0x7ffa('0x1e')](respondWithResult(_0x3d7196,null))[_0x7ffa('0x25')](handleError(_0x3d7196,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index bc3e110..65eaa3c 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 _0x73cd=['api','bluebird','request-promise','rimraf','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations'];(function(_0x4d8ef0,_0x3df7a9){var _0x3bcd7e=function(_0x12d303){while(--_0x12d303){_0x4d8ef0['push'](_0x4d8ef0['shift']());}};_0x3bcd7e(++_0x3df7a9);}(_0x73cd,0x10e));var _0xd73c=function(_0x461c2c,_0x13f720){_0x461c2c=_0x461c2c-0x0;var _0x34ce82=_0x73cd[_0x461c2c];return _0x34ce82;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd73c('0x0'));var moment=require('moment');var BPromise=require(_0xd73c('0x1'));var rp=require(_0xd73c('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd73c('0x3'));var config=require('../../config/environment');var attributes=require(_0xd73c('0x4'));module[_0xd73c('0x5')]=function(_0x28fce1,_0x2436a1){return _0x28fce1[_0xd73c('0x6')](_0xd73c('0x7'),attributes,{'tableName':_0xd73c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c10=['bluebird','path','rimraf','../../config/environment','ServicenowConfiguration','util','../../config/logger','api','moment'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0x4c10,0x15b));var _0x04c1=function(_0x24ac45,_0x1f1adc){_0x24ac45=_0x24ac45-0x0;var _0x2f5bfa=_0x4c10[_0x24ac45];return _0x2f5bfa;};'use strict';var _=require('lodash');var util=require(_0x04c1('0x0'));var logger=require(_0x04c1('0x1'))(_0x04c1('0x2'));var moment=require(_0x04c1('0x3'));var BPromise=require(_0x04c1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x04c1('0x5'));var rimraf=require(_0x04c1('0x6'));var config=require(_0x04c1('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x494304,_0x7432c6){return _0x494304['define'](_0x04c1('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 561e1dc..6a57414 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 _0x9266=['client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x47bc26,_0x15d32f){var _0x424a5b=function(_0x7edc09){while(--_0x7edc09){_0x47bc26['push'](_0x47bc26['shift']());}};_0x424a5b(++_0x15d32f);}(_0x9266,0x17c));var _0x6926=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x9266[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x6926('0x0'));var util=require(_0x6926('0x1'));var moment=require(_0x6926('0x2'));var BPromise=require(_0x6926('0x3'));var rs=require(_0x6926('0x4'));var fs=require('fs');var Redis=require(_0x6926('0x5'));var db=require(_0x6926('0x6'))['db'];var utils=require(_0x6926('0x7'));var logger=require('../../config/logger')(_0x6926('0x8'));var config=require(_0x6926('0x9'));var jayson=require(_0x6926('0xa'));var client=jayson[_0x6926('0xb')][_0x6926('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7cb091,_0x3bedd1,_0x14304a){return new BPromise(function(_0x39158d,_0x5b24bc){return client[_0x6926('0xd')](_0x7cb091,_0x14304a)['then'](function(_0x248657){logger[_0x6926('0xe')](_0x6926('0xf'),_0x3bedd1,_0x6926('0x10'));logger[_0x6926('0x11')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x3bedd1,'request\x20sent',JSON['stringify'](_0x248657));if(_0x248657[_0x6926('0x12')]){if(_0x248657[_0x6926('0x12')][_0x6926('0x13')]===0x1f4){logger[_0x6926('0x12')](_0x6926('0xf'),_0x3bedd1,_0x248657[_0x6926('0x12')][_0x6926('0x14')]);return _0x5b24bc(_0x248657[_0x6926('0x12')][_0x6926('0x14')]);}logger[_0x6926('0x12')](_0x6926('0xf'),_0x3bedd1,_0x248657[_0x6926('0x12')][_0x6926('0x14')]);return _0x39158d(_0x248657[_0x6926('0x12')][_0x6926('0x14')]);}else{logger[_0x6926('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3bedd1,'request\x20sent');_0x39158d(_0x248657[_0x6926('0x15')]['message']);}})[_0x6926('0x16')](function(_0x4b71c5){logger['error'](_0x6926('0xf'),_0x3bedd1,_0x4b71c5);_0x5b24bc(_0x4b71c5);});});} \ No newline at end of file +var _0x70d5=['debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70d5,0x1eb));var _0x570d=function(_0x380ac8,_0x2d6c81){_0x380ac8=_0x380ac8-0x0;var _0x513c8e=_0x70d5[_0x380ac8];return _0x513c8e;};'use strict';var _=require('lodash');var util=require(_0x570d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x570d('0x1'));var fs=require('fs');var Redis=require(_0x570d('0x2'));var db=require(_0x570d('0x3'))['db'];var utils=require(_0x570d('0x4'));var logger=require(_0x570d('0x5'))(_0x570d('0x6'));var config=require('../../config/environment');var jayson=require(_0x570d('0x7'));var client=jayson[_0x570d('0x8')][_0x570d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x290cb1,_0x5f1875,_0x57117f){return new BPromise(function(_0x29c838,_0x2f3298){return client['request'](_0x290cb1,_0x57117f)[_0x570d('0xa')](function(_0x76311c){logger[_0x570d('0xb')](_0x570d('0xc'),_0x5f1875,'request\x20sent');logger[_0x570d('0xd')](_0x570d('0xe'),_0x5f1875,_0x570d('0xf'),JSON[_0x570d('0x10')](_0x76311c));if(_0x76311c[_0x570d('0x11')]){if(_0x76311c[_0x570d('0x11')][_0x570d('0x12')]===0x1f4){logger[_0x570d('0x11')](_0x570d('0xc'),_0x5f1875,_0x76311c['error'][_0x570d('0x13')]);return _0x2f3298(_0x76311c['error'][_0x570d('0x13')]);}logger[_0x570d('0x11')](_0x570d('0xc'),_0x5f1875,_0x76311c['error'][_0x570d('0x13')]);return _0x29c838(_0x76311c[_0x570d('0x11')][_0x570d('0x13')]);}else{logger[_0x570d('0xb')](_0x570d('0xc'),_0x5f1875,_0x570d('0xf'));_0x29c838(_0x76311c[_0x570d('0x14')][_0x570d('0x13')]);}})['catch'](function(_0x7e8217){logger[_0x570d('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5f1875,_0x7e8217);_0x2f3298(_0x7e8217);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 1b75370..3342695 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 _0x20c8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated','post','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3c3b01,_0x411554){var _0x1138cc=function(_0x2a0805){while(--_0x2a0805){_0x3c3b01['push'](_0x3c3b01['shift']());}};_0x1138cc(++_0x411554);}(_0x20c8,0xc6));var _0x820c=function(_0x1417f5,_0x1c16c8){_0x1417f5=_0x1417f5-0x0;var _0x2c290e=_0x20c8[_0x1417f5];return _0x2c290e;};'use strict';var multer=require(_0x820c('0x0'));var util=require(_0x820c('0x1'));var path=require(_0x820c('0x2'));var timeout=require(_0x820c('0x3'));var express=require(_0x820c('0x4'));var router=express[_0x820c('0x5')]();var auth=require(_0x820c('0x6'));var interaction=require(_0x820c('0x7'));var config=require(_0x820c('0x8'));var controller=require(_0x820c('0x9'));router[_0x820c('0xa')]('/',auth['isAuthenticated'](),controller[_0x820c('0xb')]);router[_0x820c('0xa')](_0x820c('0xc'),auth[_0x820c('0xd')](),controller['show']);router[_0x820c('0xe')]('/',auth[_0x820c('0xd')](),controller['create']);router['put']('/:id',auth[_0x820c('0xd')](),controller[_0x820c('0xf')]);router['delete'](_0x820c('0xc'),auth[_0x820c('0xd')](),controller['destroy']);module[_0x820c('0x10')]=router; \ No newline at end of file +var _0xad09=['../../components/auth/service','../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated','post','put','multer','util','path','express'];(function(_0x404694,_0x3cc6aa){var _0x25e049=function(_0x20838d){while(--_0x20838d){_0x404694['push'](_0x404694['shift']());}};_0x25e049(++_0x3cc6aa);}(_0xad09,0x1d0));var _0x9ad0=function(_0x132a19,_0x26fae6){_0x132a19=_0x132a19-0x0;var _0x33bf22=_0xad09[_0x132a19];return _0x33bf22;};'use strict';var multer=require(_0x9ad0('0x0'));var util=require(_0x9ad0('0x1'));var path=require(_0x9ad0('0x2'));var timeout=require('connect-timeout');var express=require(_0x9ad0('0x3'));var router=express['Router']();var auth=require(_0x9ad0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9ad0('0x5'));var controller=require(_0x9ad0('0x6'));router[_0x9ad0('0x7')]('/',auth['isAuthenticated'](),controller[_0x9ad0('0x8')]);router[_0x9ad0('0x7')](_0x9ad0('0x9'),auth[_0x9ad0('0xa')](),controller['show']);router[_0x9ad0('0xb')]('/',auth[_0x9ad0('0xa')](),controller['create']);router[_0x9ad0('0xc')](_0x9ad0('0x9'),auth[_0x9ad0('0xa')](),controller['update']);router['delete'](_0x9ad0('0x9'),auth[_0x9ad0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index d1589d3..e5cbcb6 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 _0x8d4c=['STRING','customVariable','BOOLEAN','sequelize','ENUM','string','variable','keyValue'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0x8d4c,0x173));var _0xc8d4=function(_0x60878f,_0x1166d3){_0x60878f=_0x60878f-0x0;var _0x1fbefb=_0x8d4c[_0x60878f];return _0x1fbefb;};'use strict';var Sequelize=require(_0xc8d4('0x0'));module['exports']={'type':{'type':Sequelize[_0xc8d4('0x1')](_0xc8d4('0x2'),_0xc8d4('0x3'),'customVariable',_0xc8d4('0x4')),'defaultValue':_0xc8d4('0x2')},'content':{'type':Sequelize[_0xc8d4('0x5')]},'key':{'type':Sequelize[_0xc8d4('0x5')]},'keyType':{'type':Sequelize[_0xc8d4('0x1')](_0xc8d4('0x2'),_0xc8d4('0x3'),_0xc8d4('0x6'))},'keyContent':{'type':Sequelize[_0xc8d4('0x5')]},'idField':{'type':Sequelize[_0xc8d4('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc8d4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc8d4('0x5')]}}; \ No newline at end of file +var _0x96c7=['sequelize','variable','customVariable','keyValue','string','STRING','ENUM','BOOLEAN'];(function(_0x2273c1,_0x41484b){var _0x26c7cc=function(_0x1860d6){while(--_0x1860d6){_0x2273c1['push'](_0x2273c1['shift']());}};_0x26c7cc(++_0x41484b);}(_0x96c7,0xe0));var _0x796c=function(_0x459bea,_0x188d0a){_0x459bea=_0x459bea-0x0;var _0x43fe4d=_0x96c7[_0x459bea];return _0x43fe4d;};'use strict';var Sequelize=require(_0x796c('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x796c('0x1'),_0x796c('0x2'),_0x796c('0x3')),'defaultValue':_0x796c('0x4')},'content':{'type':Sequelize[_0x796c('0x5')]},'key':{'type':Sequelize[_0x796c('0x5')]},'keyType':{'type':Sequelize[_0x796c('0x6')](_0x796c('0x4'),_0x796c('0x1'),_0x796c('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x796c('0x5')]},'nameField':{'type':Sequelize[_0x796c('0x5')]},'customField':{'type':Sequelize[_0x796c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x796c('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 221b256..35b14cf 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 _0x87a2=['reject','save','update','then','destroy','sendStatus','error','stack','name','send','ServicenowField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','params','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply'];(function(_0x12058d,_0x4e44e1){var _0x1d22d6=function(_0x11b523){while(--_0x11b523){_0x12058d['push'](_0x12058d['shift']());}};_0x1d22d6(++_0x4e44e1);}(_0x87a2,0x14a));var _0x287a=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x87a2[_0xea8947];return _0x2455e9;};'use strict';var pdf=require(_0x287a('0x0'));var emlformat=require(_0x287a('0x1'));var rimraf=require(_0x287a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x287a('0x3'));var rp=require(_0x287a('0x4'));var moment=require(_0x287a('0x5'));var BPromise=require(_0x287a('0x6'));var Mustache=require(_0x287a('0x7'));var util=require(_0x287a('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x287a('0x9'));var fs=require('fs');var _=require(_0x287a('0xa'));var squel=require(_0x287a('0xb'));var crypto=require(_0x287a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x287a('0xd'));var Papa=require(_0x287a('0xe'));var Redis=require(_0x287a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x287a('0x10'));var as=require(_0x287a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x287a('0x12'))(_0x287a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x287a('0x14'));var db=require(_0x287a('0x15'))['db'];function respondWithStatusCode(_0x25a993,_0x49ffd5){_0x49ffd5=_0x49ffd5||0xcc;return function(_0x4e3106){if(_0x4e3106){return _0x25a993['sendStatus'](_0x49ffd5);}return _0x25a993[_0x287a('0x16')](_0x49ffd5)[_0x287a('0x17')]();};}function respondWithResult(_0x14b8ad,_0x2bcdbc){_0x2bcdbc=_0x2bcdbc||0xc8;return function(_0x5dd341){if(_0x5dd341){return _0x14b8ad[_0x287a('0x16')](_0x2bcdbc)[_0x287a('0x18')](_0x5dd341);}};}function respondWithFilteredResult(_0x17cc58,_0x357bf8){return function(_0x190ae8){if(_0x190ae8){var _0x2938ba=_0x190ae8[_0x287a('0x19')],_0x5e17b2=_0x357bf8[_0x287a('0x1a')],_0x28b568=_0x357bf8[_0x287a('0x1a')]+_0x357bf8['limit'],_0x3aa35f;if(_0x28b568>=_0x2938ba){_0x28b568=_0x2938ba;_0x3aa35f=0xc8;}else{_0x3aa35f=0xce;}_0x17cc58[_0x287a('0x16')](_0x3aa35f);return _0x17cc58[_0x287a('0x1b')](_0x287a('0x1c'),_0x5e17b2+'-'+_0x28b568+'/'+_0x2938ba)['json'](_0x190ae8);}return null;};}function patchUpdates(_0x529805){return function(_0x56c8f){try{jsonpatch[_0x287a('0x1d')](_0x56c8f,_0x529805,!![]);}catch(_0x54771a){return BPromise[_0x287a('0x1e')](_0x54771a);}return _0x56c8f[_0x287a('0x1f')]();};}function saveUpdates(_0x25c7ec,_0x524b65){return function(_0x1701d2){if(_0x1701d2){return _0x1701d2[_0x287a('0x20')](_0x25c7ec)[_0x287a('0x21')](function(_0x5f3459){return _0x5f3459;});}return null;};}function removeEntity(_0x38f3c2,_0x119a7a){return function(_0x1d1012){if(_0x1d1012){return _0x1d1012[_0x287a('0x22')]()['then'](function(){_0x38f3c2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fb336,_0x422774){return function(_0x41017c){if(!_0x41017c){_0x4fb336[_0x287a('0x23')](0x194);}return _0x41017c;};}function handleError(_0x257039,_0x1797a6){_0x1797a6=_0x1797a6||0x1f4;return function(_0x31a0aa){logger[_0x287a('0x24')](_0x31a0aa[_0x287a('0x25')]);if(_0x31a0aa[_0x287a('0x26')]){delete _0x31a0aa[_0x287a('0x26')];}_0x257039[_0x287a('0x16')](_0x1797a6)[_0x287a('0x27')](_0x31a0aa);};}exports['index']=function(_0xa55472,_0x41f35b){var _0x1658e6={},_0x254806={},_0x28f767={'count':0x0,'rows':[]};var _0x2c1bc5=_['map'](db[_0x287a('0x28')][_0x287a('0x29')],function(_0xa5c4da){return{'name':_0xa5c4da[_0x287a('0x2a')],'type':_0xa5c4da[_0x287a('0x2b')][_0x287a('0x2c')]};});_0x254806[_0x287a('0x2d')]=_[_0x287a('0x2e')](_0x2c1bc5,'name');_0x254806[_0x287a('0x2f')]=_[_0x287a('0x30')](_0xa55472[_0x287a('0x2f')]);_0x254806[_0x287a('0x31')]=_['intersection'](_0x254806[_0x287a('0x2d')],_0x254806[_0x287a('0x2f')]);_0x1658e6['attributes']=_[_0x287a('0x32')](_0x254806[_0x287a('0x2d')],qs['fields'](_0xa55472[_0x287a('0x2f')][_0x287a('0x33')]));_0x1658e6[_0x287a('0x34')]=_0x1658e6['attributes'][_0x287a('0x35')]?_0x1658e6['attributes']:_0x254806['model'];if(!_0xa55472[_0x287a('0x2f')][_0x287a('0x36')](_0x287a('0x37'))){_0x1658e6[_0x287a('0x38')]=qs['limit'](_0xa55472[_0x287a('0x2f')][_0x287a('0x38')]);_0x1658e6[_0x287a('0x1a')]=qs[_0x287a('0x1a')](_0xa55472[_0x287a('0x2f')][_0x287a('0x1a')]);}_0x1658e6[_0x287a('0x39')]=qs[_0x287a('0x3a')](_0xa55472[_0x287a('0x2f')]['sort']);_0x1658e6[_0x287a('0x3b')]=qs[_0x287a('0x31')](_[_0x287a('0x3c')](_0xa55472[_0x287a('0x2f')],_0x254806['filters']),_0x2c1bc5);if(_0xa55472[_0x287a('0x2f')][_0x287a('0x3d')]){_0x1658e6['where']=_['merge'](_0x1658e6[_0x287a('0x3b')],{'$or':_[_0x287a('0x2e')](_0x2c1bc5,function(_0x54e06d){if(_0x54e06d[_0x287a('0x2b')]!==_0x287a('0x3e')){var _0x530be1={};_0x530be1[_0x54e06d['name']]={'$like':'%'+_0xa55472['query']['filter']+'%'};return _0x530be1;}})});}_0x1658e6=_[_0x287a('0x3f')]({},_0x1658e6,_0xa55472['options']);var _0x5bc19f={'where':_0x1658e6[_0x287a('0x3b')]};return db[_0x287a('0x28')][_0x287a('0x19')](_0x5bc19f)['then'](function(_0x4e41b2){_0x28f767[_0x287a('0x19')]=_0x4e41b2;if(_0xa55472[_0x287a('0x2f')][_0x287a('0x40')]){_0x1658e6['include']=[{'all':!![]}];}return db['ServicenowField'][_0x287a('0x41')](_0x1658e6);})[_0x287a('0x21')](function(_0x5e800d){_0x28f767[_0x287a('0x42')]=_0x5e800d;return _0x28f767;})[_0x287a('0x21')](respondWithFilteredResult(_0x41f35b,_0x1658e6))[_0x287a('0x43')](handleError(_0x41f35b,null));};exports['show']=function(_0x577a5e,_0x140535){var _0xadce28={'raw':!![],'where':{'id':_0x577a5e[_0x287a('0x44')]['id']}},_0x2c9c9d={};_0x2c9c9d[_0x287a('0x2d')]=_[_0x287a('0x30')](db[_0x287a('0x28')][_0x287a('0x29')]);_0x2c9c9d[_0x287a('0x2f')]=_[_0x287a('0x30')](_0x577a5e[_0x287a('0x2f')]);_0x2c9c9d[_0x287a('0x31')]=_[_0x287a('0x32')](_0x2c9c9d['model'],_0x2c9c9d['query']);_0xadce28[_0x287a('0x34')]=_[_0x287a('0x32')](_0x2c9c9d[_0x287a('0x2d')],qs[_0x287a('0x33')](_0x577a5e[_0x287a('0x2f')]['fields']));_0xadce28[_0x287a('0x34')]=_0xadce28[_0x287a('0x34')][_0x287a('0x35')]?_0xadce28[_0x287a('0x34')]:_0x2c9c9d[_0x287a('0x2d')];if(_0x577a5e[_0x287a('0x2f')][_0x287a('0x40')]){_0xadce28['include']=[{'all':!![]}];}_0xadce28=_['merge']({},_0xadce28,_0x577a5e['options']);return db[_0x287a('0x28')][_0x287a('0x45')](_0xadce28)[_0x287a('0x21')](handleEntityNotFound(_0x140535,null))[_0x287a('0x21')](respondWithResult(_0x140535,null))[_0x287a('0x43')](handleError(_0x140535,null));};exports['create']=function(_0x51d694,_0x4de440){return db[_0x287a('0x28')][_0x287a('0x46')](_0x51d694[_0x287a('0x47')],{})['then'](respondWithResult(_0x4de440,0xc9))[_0x287a('0x43')](handleError(_0x4de440,null));};exports[_0x287a('0x20')]=function(_0x2c008b,_0x5989fa){if(_0x2c008b[_0x287a('0x47')]['id']){delete _0x2c008b[_0x287a('0x47')]['id'];}return db[_0x287a('0x28')]['find']({'where':{'id':_0x2c008b[_0x287a('0x44')]['id']}})[_0x287a('0x21')](handleEntityNotFound(_0x5989fa,null))[_0x287a('0x21')](saveUpdates(_0x2c008b['body'],null))[_0x287a('0x21')](respondWithResult(_0x5989fa,null))[_0x287a('0x43')](handleError(_0x5989fa,null));};exports['destroy']=function(_0x4c9b06,_0x5072b5){return db['ServicenowField'][_0x287a('0x45')]({'where':{'id':_0x4c9b06['params']['id']}})['then'](handleEntityNotFound(_0x5072b5,null))['then'](removeEntity(_0x5072b5,null))[_0x287a('0x43')](handleError(_0x5072b5,null));}; \ No newline at end of file +var _0x8d62=['ServicenowField','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','count','catch','show','params','includeAll','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','reject','update','then','error','stack','name','send','index','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d62,0xf8));var _0x28d6=function(_0x461a1f,_0x35751d){_0x461a1f=_0x461a1f-0x0;var _0x11fd6c=_0x8d62[_0x461a1f];return _0x11fd6c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x28d6('0x0'));var rimraf=require(_0x28d6('0x1'));var zipdir=require(_0x28d6('0x2'));var jsonpatch=require(_0x28d6('0x3'));var rp=require(_0x28d6('0x4'));var moment=require(_0x28d6('0x5'));var BPromise=require(_0x28d6('0x6'));var Mustache=require(_0x28d6('0x7'));var util=require(_0x28d6('0x8'));var path=require(_0x28d6('0x9'));var sox=require(_0x28d6('0xa'));var csv=require(_0x28d6('0xb'));var ejs=require(_0x28d6('0xc'));var fs=require('fs');var _=require(_0x28d6('0xd'));var squel=require('squel');var crypto=require(_0x28d6('0xe'));var jsforce=require(_0x28d6('0xf'));var deskjs=require(_0x28d6('0x10'));var toCsv=require('to-csv');var querystring=require(_0x28d6('0x11'));var Papa=require('papaparse');var Redis=require(_0x28d6('0x12'));var authService=require(_0x28d6('0x13'));var qs=require(_0x28d6('0x14'));var as=require(_0x28d6('0x15'));var hardwareService=require(_0x28d6('0x16'));var logger=require('../../config/logger')(_0x28d6('0x17'));var utils=require(_0x28d6('0x18'));var config=require(_0x28d6('0x19'));var licenseUtil=require(_0x28d6('0x1a'));var db=require(_0x28d6('0x1b'))['db'];function respondWithStatusCode(_0x240839,_0x2c29bd){_0x2c29bd=_0x2c29bd||0xcc;return function(_0x43d460){if(_0x43d460){return _0x240839['sendStatus'](_0x2c29bd);}return _0x240839[_0x28d6('0x1c')](_0x2c29bd)[_0x28d6('0x1d')]();};}function respondWithResult(_0x33ba38,_0x549b39){_0x549b39=_0x549b39||0xc8;return function(_0x1621ee){if(_0x1621ee){return _0x33ba38['status'](_0x549b39)[_0x28d6('0x1e')](_0x1621ee);}};}function respondWithFilteredResult(_0x425ffb,_0x4b82e2){return function(_0x1881a8){if(_0x1881a8){var _0x159d2a=_0x1881a8['count'],_0x2d5eee=_0x4b82e2[_0x28d6('0x1f')],_0x17a822=_0x4b82e2['offset']+_0x4b82e2[_0x28d6('0x20')],_0x154c4d;if(_0x17a822>=_0x159d2a){_0x17a822=_0x159d2a;_0x154c4d=0xc8;}else{_0x154c4d=0xce;}_0x425ffb[_0x28d6('0x1c')](_0x154c4d);return _0x425ffb[_0x28d6('0x21')](_0x28d6('0x22'),_0x2d5eee+'-'+_0x17a822+'/'+_0x159d2a)[_0x28d6('0x1e')](_0x1881a8);}return null;};}function patchUpdates(_0x2f1b6b){return function(_0x2d521d){try{jsonpatch['apply'](_0x2d521d,_0x2f1b6b,!![]);}catch(_0x29cfbf){return BPromise[_0x28d6('0x23')](_0x29cfbf);}return _0x2d521d['save']();};}function saveUpdates(_0x26362e,_0x24f764){return function(_0x3770ba){if(_0x3770ba){return _0x3770ba[_0x28d6('0x24')](_0x26362e)[_0x28d6('0x25')](function(_0x3b121a){return _0x3b121a;});}return null;};}function removeEntity(_0x376a64,_0x506be6){return function(_0xcf8fa0){if(_0xcf8fa0){return _0xcf8fa0['destroy']()[_0x28d6('0x25')](function(){_0x376a64[_0x28d6('0x1c')](0xcc)[_0x28d6('0x1d')]();});}};}function handleEntityNotFound(_0x3d128b,_0x26809d){return function(_0x3f7eb9){if(!_0x3f7eb9){_0x3d128b['sendStatus'](0x194);}return _0x3f7eb9;};}function handleError(_0x5c4909,_0xe45d33){_0xe45d33=_0xe45d33||0x1f4;return function(_0x2fb6f7){logger[_0x28d6('0x26')](_0x2fb6f7[_0x28d6('0x27')]);if(_0x2fb6f7['name']){delete _0x2fb6f7[_0x28d6('0x28')];}_0x5c4909[_0x28d6('0x1c')](_0xe45d33)[_0x28d6('0x29')](_0x2fb6f7);};}exports[_0x28d6('0x2a')]=function(_0x4757b1,_0x6a76a){var _0x60ded0={},_0x20b220={},_0x23ef1c={'count':0x0,'rows':[]};var _0x12f77e=_[_0x28d6('0x2b')](db[_0x28d6('0x2c')][_0x28d6('0x2d')],function(_0x3ba89f){return{'name':_0x3ba89f['fieldName'],'type':_0x3ba89f['type'][_0x28d6('0x2e')]};});_0x20b220[_0x28d6('0x2f')]=_[_0x28d6('0x2b')](_0x12f77e,_0x28d6('0x28'));_0x20b220[_0x28d6('0x30')]=_[_0x28d6('0x31')](_0x4757b1['query']);_0x20b220[_0x28d6('0x32')]=_['intersection'](_0x20b220[_0x28d6('0x2f')],_0x20b220['query']);_0x60ded0[_0x28d6('0x33')]=_[_0x28d6('0x34')](_0x20b220[_0x28d6('0x2f')],qs[_0x28d6('0x35')](_0x4757b1[_0x28d6('0x30')]['fields']));_0x60ded0['attributes']=_0x60ded0[_0x28d6('0x33')][_0x28d6('0x36')]?_0x60ded0['attributes']:_0x20b220[_0x28d6('0x2f')];if(!_0x4757b1['query'][_0x28d6('0x37')]('nolimit')){_0x60ded0[_0x28d6('0x20')]=qs['limit'](_0x4757b1[_0x28d6('0x30')][_0x28d6('0x20')]);_0x60ded0[_0x28d6('0x1f')]=qs[_0x28d6('0x1f')](_0x4757b1[_0x28d6('0x30')][_0x28d6('0x1f')]);}_0x60ded0[_0x28d6('0x38')]=qs['sort'](_0x4757b1[_0x28d6('0x30')][_0x28d6('0x39')]);_0x60ded0[_0x28d6('0x3a')]=qs[_0x28d6('0x32')](_['pick'](_0x4757b1[_0x28d6('0x30')],_0x20b220[_0x28d6('0x32')]),_0x12f77e);if(_0x4757b1[_0x28d6('0x30')][_0x28d6('0x3b')]){_0x60ded0['where']=_[_0x28d6('0x3c')](_0x60ded0[_0x28d6('0x3a')],{'$or':_[_0x28d6('0x2b')](_0x12f77e,function(_0x1120c9){if(_0x1120c9[_0x28d6('0x3d')]!==_0x28d6('0x3e')){var _0x1f0fc8={};_0x1f0fc8[_0x1120c9[_0x28d6('0x28')]]={'$like':'%'+_0x4757b1[_0x28d6('0x30')][_0x28d6('0x3b')]+'%'};return _0x1f0fc8;}})});}_0x60ded0=_[_0x28d6('0x3c')]({},_0x60ded0,_0x4757b1[_0x28d6('0x3f')]);var _0x286b3d={'where':_0x60ded0[_0x28d6('0x3a')]};return db[_0x28d6('0x2c')][_0x28d6('0x40')](_0x286b3d)['then'](function(_0x5eff10){_0x23ef1c['count']=_0x5eff10;if(_0x4757b1[_0x28d6('0x30')]['includeAll']){_0x60ded0['include']=[{'all':!![]}];}return db[_0x28d6('0x2c')]['findAll'](_0x60ded0);})[_0x28d6('0x25')](function(_0x3f551a){_0x23ef1c['rows']=_0x3f551a;return _0x23ef1c;})[_0x28d6('0x25')](respondWithFilteredResult(_0x6a76a,_0x60ded0))[_0x28d6('0x41')](handleError(_0x6a76a,null));};exports[_0x28d6('0x42')]=function(_0x131628,_0x3388dc){var _0x334727={'raw':!![],'where':{'id':_0x131628[_0x28d6('0x43')]['id']}},_0x18a0bc={};_0x18a0bc['model']=_[_0x28d6('0x31')](db[_0x28d6('0x2c')]['rawAttributes']);_0x18a0bc[_0x28d6('0x30')]=_[_0x28d6('0x31')](_0x131628[_0x28d6('0x30')]);_0x18a0bc['filters']=_[_0x28d6('0x34')](_0x18a0bc[_0x28d6('0x2f')],_0x18a0bc[_0x28d6('0x30')]);_0x334727[_0x28d6('0x33')]=_['intersection'](_0x18a0bc[_0x28d6('0x2f')],qs[_0x28d6('0x35')](_0x131628[_0x28d6('0x30')]['fields']));_0x334727[_0x28d6('0x33')]=_0x334727[_0x28d6('0x33')][_0x28d6('0x36')]?_0x334727[_0x28d6('0x33')]:_0x18a0bc['model'];if(_0x131628[_0x28d6('0x30')][_0x28d6('0x44')]){_0x334727[_0x28d6('0x45')]=[{'all':!![]}];}_0x334727=_[_0x28d6('0x3c')]({},_0x334727,_0x131628[_0x28d6('0x3f')]);return db['ServicenowField'][_0x28d6('0x46')](_0x334727)[_0x28d6('0x25')](handleEntityNotFound(_0x3388dc,null))[_0x28d6('0x25')](respondWithResult(_0x3388dc,null))[_0x28d6('0x41')](handleError(_0x3388dc,null));};exports[_0x28d6('0x47')]=function(_0x182d70,_0x10a52){return db[_0x28d6('0x2c')][_0x28d6('0x47')](_0x182d70[_0x28d6('0x48')],{})['then'](respondWithResult(_0x10a52,0xc9))['catch'](handleError(_0x10a52,null));};exports[_0x28d6('0x24')]=function(_0x5635dc,_0x5ce7c1){if(_0x5635dc['body']['id']){delete _0x5635dc[_0x28d6('0x48')]['id'];}return db['ServicenowField'][_0x28d6('0x46')]({'where':{'id':_0x5635dc['params']['id']}})[_0x28d6('0x25')](handleEntityNotFound(_0x5ce7c1,null))[_0x28d6('0x25')](saveUpdates(_0x5635dc[_0x28d6('0x48')],null))['then'](respondWithResult(_0x5ce7c1,null))['catch'](handleError(_0x5ce7c1,null));};exports['destroy']=function(_0x2720b1,_0x12e3c0){return db['ServicenowField'][_0x28d6('0x46')]({'where':{'id':_0x2720b1[_0x28d6('0x43')]['id']}})[_0x28d6('0x25')](handleEntityNotFound(_0x12e3c0,null))[_0x28d6('0x25')](removeEntity(_0x12e3c0,null))[_0x28d6('0x41')](handleError(_0x12e3c0,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index e958bf8..eda3e0a 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 _0xb6d2=['./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x7b917e,_0x8683e8){var _0x54db1e=function(_0x23e2dc){while(--_0x23e2dc){_0x7b917e['push'](_0x7b917e['shift']());}};_0x54db1e(++_0x8683e8);}(_0xb6d2,0x188));var _0x2b6d=function(_0x152252,_0x265010){_0x152252=_0x152252-0x0;var _0x1914a5=_0xb6d2[_0x152252];return _0x1914a5;};'use strict';var _=require(_0x2b6d('0x0'));var util=require(_0x2b6d('0x1'));var logger=require(_0x2b6d('0x2'))(_0x2b6d('0x3'));var moment=require(_0x2b6d('0x4'));var BPromise=require('bluebird');var rp=require(_0x2b6d('0x5'));var fs=require('fs');var path=require(_0x2b6d('0x6'));var rimraf=require(_0x2b6d('0x7'));var config=require('../../config/environment');var attributes=require(_0x2b6d('0x8'));module[_0x2b6d('0x9')]=function(_0x5e070c,_0x4ccde9){return _0x5e070c[_0x2b6d('0xa')](_0x2b6d('0xb'),attributes,{'tableName':_0x2b6d('0xc'),'paranoid':![],'indexes':[{'name':_0x2b6d('0xd'),'fields':[_0x2b6d('0xe'),_0x2b6d('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xda03=['exports','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','path','./intServicenowField.attributes'];(function(_0x59de84,_0x7b3398){var _0x7b2a09=function(_0x29137e){while(--_0x29137e){_0x59de84['push'](_0x59de84['shift']());}};_0x7b2a09(++_0x7b3398);}(_0xda03,0x102));var _0x3da0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda03[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3da0('0x0'));var logger=require(_0x3da0('0x1'))('api');var moment=require(_0x3da0('0x2'));var BPromise=require(_0x3da0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3da0('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3da0('0x5'));module[_0x3da0('0x6')]=function(_0x1de587,_0xc36b23){return _0x1de587['define']('ServicenowField',attributes,{'tableName':_0x3da0('0x7'),'paranoid':![],'indexes':[{'name':_0x3da0('0x8'),'fields':[_0x3da0('0x9'),_0x3da0('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 128cfbc..80ec1d0 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 _0x8bd6=['message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ServicenowField,\x20%s,\x20%s','request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4d66b1,_0x45c5e1){var _0x385b74=function(_0x17db41){while(--_0x17db41){_0x4d66b1['push'](_0x4d66b1['shift']());}};_0x385b74(++_0x45c5e1);}(_0x8bd6,0x1a2));var _0x68bd=function(_0x317548,_0x29845b){_0x317548=_0x317548-0x0;var _0x5ebdac=_0x8bd6[_0x317548];return _0x5ebdac;};'use strict';var _=require(_0x68bd('0x0'));var util=require(_0x68bd('0x1'));var moment=require(_0x68bd('0x2'));var BPromise=require('bluebird');var rs=require(_0x68bd('0x3'));var fs=require('fs');var Redis=require(_0x68bd('0x4'));var db=require(_0x68bd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x68bd('0x6'))(_0x68bd('0x7'));var config=require(_0x68bd('0x8'));var jayson=require(_0x68bd('0x9'));var client=jayson['client'][_0x68bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d499e,_0x593dd0,_0x5621f4){return new BPromise(function(_0x19994e,_0x1cb4a0){return client[_0x68bd('0xb')](_0x5d499e,_0x5621f4)[_0x68bd('0xc')](function(_0x48db88){logger['info'](_0x68bd('0xd'),_0x593dd0,_0x68bd('0xe'));logger['debug'](_0x68bd('0xf'),_0x593dd0,_0x68bd('0xe'),JSON[_0x68bd('0x10')](_0x48db88));if(_0x48db88[_0x68bd('0x11')]){if(_0x48db88[_0x68bd('0x11')][_0x68bd('0x12')]===0x1f4){logger['error'](_0x68bd('0xd'),_0x593dd0,_0x48db88[_0x68bd('0x11')][_0x68bd('0x13')]);return _0x1cb4a0(_0x48db88['error'][_0x68bd('0x13')]);}logger[_0x68bd('0x11')]('ServicenowField,\x20%s,\x20%s',_0x593dd0,_0x48db88[_0x68bd('0x11')][_0x68bd('0x13')]);return _0x19994e(_0x48db88[_0x68bd('0x11')][_0x68bd('0x13')]);}else{logger[_0x68bd('0x14')](_0x68bd('0xd'),_0x593dd0,_0x68bd('0xe'));_0x19994e(_0x48db88[_0x68bd('0x15')][_0x68bd('0x13')]);}})[_0x68bd('0x16')](function(_0x1f3673){logger[_0x68bd('0x11')](_0x68bd('0xd'),_0x593dd0,_0x1f3673);_0x1cb4a0(_0x1f3673);});});} \ No newline at end of file +var _0x4010=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ServicenowField,\x20%s,\x20%s','message','lodash'];(function(_0x14110b,_0x3ce4f6){var _0x33d8db=function(_0x55c02f){while(--_0x55c02f){_0x14110b['push'](_0x14110b['shift']());}};_0x33d8db(++_0x3ce4f6);}(_0x4010,0xf1));var _0x0401=function(_0x42acab,_0x2aa6ec){_0x42acab=_0x42acab-0x0;var _0x303dd8=_0x4010[_0x42acab];return _0x303dd8;};'use strict';var _=require(_0x0401('0x0'));var util=require('util');var moment=require(_0x0401('0x1'));var BPromise=require('bluebird');var rs=require(_0x0401('0x2'));var fs=require('fs');var Redis=require(_0x0401('0x3'));var db=require(_0x0401('0x4'))['db'];var utils=require(_0x0401('0x5'));var logger=require(_0x0401('0x6'))(_0x0401('0x7'));var config=require(_0x0401('0x8'));var jayson=require(_0x0401('0x9'));var client=jayson[_0x0401('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x235787,_0x54e1a7,_0x15b21c){return new BPromise(function(_0x53081c,_0x24b936){return client[_0x0401('0xb')](_0x235787,_0x15b21c)[_0x0401('0xc')](function(_0x39e528){logger[_0x0401('0xd')]('ServicenowField,\x20%s,\x20%s',_0x54e1a7,'request\x20sent');logger[_0x0401('0xe')](_0x0401('0xf'),_0x54e1a7,_0x0401('0x10'),JSON[_0x0401('0x11')](_0x39e528));if(_0x39e528['error']){if(_0x39e528[_0x0401('0x12')][_0x0401('0x13')]===0x1f4){logger[_0x0401('0x12')](_0x0401('0x14'),_0x54e1a7,_0x39e528[_0x0401('0x12')]['message']);return _0x24b936(_0x39e528['error'][_0x0401('0x15')]);}logger[_0x0401('0x12')](_0x0401('0x14'),_0x54e1a7,_0x39e528['error'][_0x0401('0x15')]);return _0x53081c(_0x39e528['error']['message']);}else{logger[_0x0401('0xd')](_0x0401('0x14'),_0x54e1a7,_0x0401('0x10'));_0x53081c(_0x39e528['result'][_0x0401('0x15')]);}})['catch'](function(_0x2a2b82){logger[_0x0401('0x12')](_0x0401('0x14'),_0x54e1a7,_0x2a2b82);_0x24b936(_0x2a2b82);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 0663d5e..5cbf2a3 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 _0xf250=['/:id','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index'];(function(_0x236622,_0x5d6400){var _0x343b56=function(_0x4475f8){while(--_0x4475f8){_0x236622['push'](_0x236622['shift']());}};_0x343b56(++_0x5d6400);}(_0xf250,0x73));var _0x0f25=function(_0x5b328a,_0x5c48bc){_0x5b328a=_0x5b328a-0x0;var _0xfcf474=_0xf250[_0x5b328a];return _0xfcf474;};'use strict';var multer=require(_0x0f25('0x0'));var util=require(_0x0f25('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0f25('0x2'));var router=express[_0x0f25('0x3')]();var auth=require(_0x0f25('0x4'));var interaction=require(_0x0f25('0x5'));var config=require(_0x0f25('0x6'));var controller=require(_0x0f25('0x7'));router[_0x0f25('0x8')]('/',auth[_0x0f25('0x9')](),controller[_0x0f25('0xa')]);router[_0x0f25('0x8')](_0x0f25('0xb'),auth[_0x0f25('0x9')](),controller['show']);router['get'](_0x0f25('0xc'),auth[_0x0f25('0x9')](),controller[_0x0f25('0xd')]);router[_0x0f25('0x8')]('/:id/fields',auth[_0x0f25('0x9')](),controller[_0x0f25('0xe')]);router[_0x0f25('0xf')]('/',auth[_0x0f25('0x9')](),controller['create']);router[_0x0f25('0xf')]('/:id/configurations',auth[_0x0f25('0x9')](),controller[_0x0f25('0x10')]);router[_0x0f25('0x11')](_0x0f25('0xb'),auth['isAuthenticated'](),controller[_0x0f25('0x12')]);router['delete'](_0x0f25('0xb'),auth[_0x0f25('0x9')](),controller[_0x0f25('0x13')]);module[_0x0f25('0x14')]=router; \ No newline at end of file +var _0x1a5b=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','multer'];(function(_0xc5d3c8,_0x43352b){var _0x3537e4=function(_0x4bfe24){while(--_0x4bfe24){_0xc5d3c8['push'](_0xc5d3c8['shift']());}};_0x3537e4(++_0x43352b);}(_0x1a5b,0x153));var _0xb1a5=function(_0x41b1f8,_0x3da270){_0x41b1f8=_0x41b1f8-0x0;var _0x45b943=_0x1a5b[_0x41b1f8];return _0x45b943;};'use strict';var multer=require(_0xb1a5('0x0'));var util=require(_0xb1a5('0x1'));var path=require(_0xb1a5('0x2'));var timeout=require(_0xb1a5('0x3'));var express=require(_0xb1a5('0x4'));var router=express['Router']();var auth=require(_0xb1a5('0x5'));var interaction=require(_0xb1a5('0x6'));var config=require(_0xb1a5('0x7'));var controller=require(_0xb1a5('0x8'));router[_0xb1a5('0x9')]('/',auth[_0xb1a5('0xa')](),controller[_0xb1a5('0xb')]);router[_0xb1a5('0x9')](_0xb1a5('0xc'),auth[_0xb1a5('0xa')](),controller['show']);router[_0xb1a5('0x9')](_0xb1a5('0xd'),auth[_0xb1a5('0xa')](),controller[_0xb1a5('0xe')]);router[_0xb1a5('0x9')](_0xb1a5('0xf'),auth[_0xb1a5('0xa')](),controller[_0xb1a5('0x10')]);router[_0xb1a5('0x11')]('/',auth[_0xb1a5('0xa')](),controller['create']);router[_0xb1a5('0x11')](_0xb1a5('0xd'),auth[_0xb1a5('0xa')](),controller[_0xb1a5('0x12')]);router[_0xb1a5('0x13')](_0xb1a5('0xc'),auth[_0xb1a5('0xa')](),controller['update']);router['delete'](_0xb1a5('0xc'),auth[_0xb1a5('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index b9dce9c..7be12e9 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 _0xa6b8=['STRING','username','remoteUri','sequelize'];(function(_0x4bc65f,_0x39ec43){var _0x44f85f=function(_0x175343){while(--_0x175343){_0x4bc65f['push'](_0x4bc65f['shift']());}};_0x44f85f(++_0x39ec43);}(_0xa6b8,0x107));var _0x8a6b=function(_0x41e723,_0x5e6494){_0x41e723=_0x41e723-0x0;var _0x5cf973=_0xa6b8[_0x41e723];return _0x5cf973;};'use strict';var Sequelize=require(_0x8a6b('0x0'));module['exports']={'name':{'type':Sequelize[_0x8a6b('0x1')]},'description':{'type':Sequelize[_0x8a6b('0x1')]},'username':{'type':Sequelize[_0x8a6b('0x1')],'unique':_0x8a6b('0x2')},'password':{'type':Sequelize[_0x8a6b('0x1')]},'remoteUri':{'type':Sequelize[_0x8a6b('0x1')],'unique':_0x8a6b('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x9c72=['username','sequelize','exports','STRING'];(function(_0x48f2e7,_0x3c2167){var _0x4df7ca=function(_0x248071){while(--_0x248071){_0x48f2e7['push'](_0x48f2e7['shift']());}};_0x4df7ca(++_0x3c2167);}(_0x9c72,0x71));var _0x29c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c72[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x29c7('0x0'));module[_0x29c7('0x1')]={'name':{'type':Sequelize[_0x29c7('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x29c7('0x2')],'unique':_0x29c7('0x3')},'password':{'type':Sequelize[_0x29c7('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x29c7('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 4d492ba..f613fa0 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 _0x44b4=['findOne','SugarcrmConfiguration','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','Descriptions','channel','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','parent_id','parent_name','remoteUri','substring','POST','format','%s%s','login','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','Calls','label','endsWith','values','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','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','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','count','offset','set','reject','save','update','then','destroy','sendStatus','stack','name','send','index','SugarcrmAccount','key','model','map','query','intersection','attributes','fields','length','nolimit','limit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','rawAttributes','include','find','create','body'];(function(_0x46ee89,_0x186aa6){var _0x4fd761=function(_0x42baf8){while(--_0x42baf8){_0x46ee89['push'](_0x46ee89['shift']());}};_0x4fd761(++_0x186aa6);}(_0x44b4,0x11a));var _0x444b=function(_0x2994ad,_0x4b699a){_0x2994ad=_0x2994ad-0x0;var _0x568906=_0x44b4[_0x2994ad];return _0x568906;};'use strict';var pdf=require(_0x444b('0x0'));var emlformat=require(_0x444b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x444b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x444b('0x3'));var moment=require(_0x444b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x444b('0x5'));var util=require(_0x444b('0x6'));var path=require(_0x444b('0x7'));var sox=require(_0x444b('0x8'));var csv=require('to-csv');var ejs=require(_0x444b('0x9'));var fs=require('fs');var _=require(_0x444b('0xa'));var squel=require(_0x444b('0xb'));var crypto=require(_0x444b('0xc'));var jsforce=require(_0x444b('0xd'));var deskjs=require(_0x444b('0xe'));var toCsv=require(_0x444b('0xf'));var querystring=require(_0x444b('0x10'));var Papa=require(_0x444b('0x11'));var Redis=require('ioredis');var authService=require(_0x444b('0x12'));var qs=require(_0x444b('0x13'));var as=require(_0x444b('0x14'));var hardwareService=require(_0x444b('0x15'));var logger=require('../../config/logger')(_0x444b('0x16'));var utils=require(_0x444b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x444b('0x18'));var db=require(_0x444b('0x19'))['db'];var integrations=require(_0x444b('0x1a'));var jayson=require('jayson/promise');var client=jayson[_0x444b('0x1b')][_0x444b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x11ac91,_0x3acf40,_0x556492,_0x3ebd75){return new BPromise(function(_0x2342b3,_0x44a2b2){var _0xe5c663=_0x3ebd75||client;return _0xe5c663[_0x444b('0x1d')](_0x11ac91,_0x556492)['then'](function(_0x5d2205){logger[_0x444b('0x1e')](_0x444b('0x1f'),_0x3acf40,_0x444b('0x20'));logger['debug'](_0x444b('0x21'),_0x3acf40,_0x444b('0x20'),JSON[_0x444b('0x22')](_0x5d2205));if(_0x5d2205[_0x444b('0x23')]){if(_0x5d2205['error'][_0x444b('0x24')]===0x1f4){logger[_0x444b('0x23')](_0x444b('0x1f'),_0x3acf40,_0x5d2205['error']['message']);return _0x44a2b2(_0x5d2205[_0x444b('0x23')][_0x444b('0x25')]);}logger['error'](_0x444b('0x1f'),_0x3acf40,_0x5d2205['error']['message']);return _0x2342b3(_0x5d2205[_0x444b('0x23')]['message']);}else{logger[_0x444b('0x1e')](_0x444b('0x1f'),_0x3acf40,'request\x20sent');_0x2342b3(_0x5d2205['result'][_0x444b('0x25')]);}})[_0x444b('0x26')](function(_0xd4674e){logger[_0x444b('0x23')](_0x444b('0x1f'),_0x3acf40,_0xd4674e);_0x44a2b2(_0xd4674e);});});}function respondWithStatusCode(_0x2f3877,_0x4271e7){_0x4271e7=_0x4271e7||0xcc;return function(_0x9b088a){if(_0x9b088a){return _0x2f3877['sendStatus'](_0x4271e7);}return _0x2f3877[_0x444b('0x27')](_0x4271e7)[_0x444b('0x28')]();};}function respondWithResult(_0x49c9fb,_0x2df59c){_0x2df59c=_0x2df59c||0xc8;return function(_0x986752){if(_0x986752){return _0x49c9fb[_0x444b('0x27')](_0x2df59c)[_0x444b('0x29')](_0x986752);}};}function respondWithFilteredResult(_0x4373c4,_0x3254c9){return function(_0x1ecd2d){if(_0x1ecd2d){var _0x52ac47=_0x1ecd2d[_0x444b('0x2a')],_0x54d3c0=_0x3254c9[_0x444b('0x2b')],_0x337a64=_0x3254c9[_0x444b('0x2b')]+_0x3254c9['limit'],_0x4207a4;if(_0x337a64>=_0x52ac47){_0x337a64=_0x52ac47;_0x4207a4=0xc8;}else{_0x4207a4=0xce;}_0x4373c4[_0x444b('0x27')](_0x4207a4);return _0x4373c4[_0x444b('0x2c')]('Content-Range',_0x54d3c0+'-'+_0x337a64+'/'+_0x52ac47)[_0x444b('0x29')](_0x1ecd2d);}return null;};}function patchUpdates(_0x5eb713){return function(_0x54e67a){try{jsonpatch['apply'](_0x54e67a,_0x5eb713,!![]);}catch(_0xe01812){return BPromise[_0x444b('0x2d')](_0xe01812);}return _0x54e67a[_0x444b('0x2e')]();};}function saveUpdates(_0x196976,_0x174028){return function(_0x3be1d0){if(_0x3be1d0){return _0x3be1d0[_0x444b('0x2f')](_0x196976)[_0x444b('0x30')](function(_0x488b52){return _0x488b52;});}return null;};}function removeEntity(_0xd1b28,_0x2cf565){return function(_0x2204b){if(_0x2204b){return _0x2204b[_0x444b('0x31')]()[_0x444b('0x30')](function(){_0xd1b28[_0x444b('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6983,_0x19f883){return function(_0x2ecc6c){if(!_0x2ecc6c){_0x4d6983[_0x444b('0x32')](0x194);}return _0x2ecc6c;};}function handleError(_0x46750a,_0x83b936){_0x83b936=_0x83b936||0x1f4;return function(_0x1ae2b3){logger[_0x444b('0x23')](_0x1ae2b3[_0x444b('0x33')]);if(_0x1ae2b3[_0x444b('0x34')]){delete _0x1ae2b3[_0x444b('0x34')];}_0x46750a[_0x444b('0x27')](_0x83b936)[_0x444b('0x35')](_0x1ae2b3);};}exports[_0x444b('0x36')]=function(_0x15ce1e,_0x345b8e){var _0x43ccfb={},_0x576992={},_0x57eb9a={'count':0x0,'rows':[]};var _0xccbcbe=_['map'](db[_0x444b('0x37')]['rawAttributes'],function(_0x11677e){return{'name':_0x11677e['fieldName'],'type':_0x11677e['type'][_0x444b('0x38')]};});_0x576992[_0x444b('0x39')]=_[_0x444b('0x3a')](_0xccbcbe,_0x444b('0x34'));_0x576992[_0x444b('0x3b')]=_['keys'](_0x15ce1e[_0x444b('0x3b')]);_0x576992['filters']=_[_0x444b('0x3c')](_0x576992[_0x444b('0x39')],_0x576992[_0x444b('0x3b')]);_0x43ccfb[_0x444b('0x3d')]=_[_0x444b('0x3c')](_0x576992['model'],qs[_0x444b('0x3e')](_0x15ce1e[_0x444b('0x3b')][_0x444b('0x3e')]));_0x43ccfb['attributes']=_0x43ccfb['attributes'][_0x444b('0x3f')]?_0x43ccfb[_0x444b('0x3d')]:_0x576992[_0x444b('0x39')];if(!_0x15ce1e[_0x444b('0x3b')]['hasOwnProperty'](_0x444b('0x40'))){_0x43ccfb[_0x444b('0x41')]=qs[_0x444b('0x41')](_0x15ce1e[_0x444b('0x3b')][_0x444b('0x41')]);_0x43ccfb[_0x444b('0x2b')]=qs[_0x444b('0x2b')](_0x15ce1e['query'][_0x444b('0x2b')]);}_0x43ccfb[_0x444b('0x42')]=qs[_0x444b('0x43')](_0x15ce1e[_0x444b('0x3b')][_0x444b('0x43')]);_0x43ccfb['where']=qs[_0x444b('0x44')](_[_0x444b('0x45')](_0x15ce1e['query'],_0x576992[_0x444b('0x44')]),_0xccbcbe);if(_0x15ce1e[_0x444b('0x3b')][_0x444b('0x46')]){_0x43ccfb[_0x444b('0x47')]=_[_0x444b('0x48')](_0x43ccfb[_0x444b('0x47')],{'$or':_[_0x444b('0x3a')](_0xccbcbe,function(_0x50f610){if(_0x50f610[_0x444b('0x49')]!==_0x444b('0x4a')){var _0x143d00={};_0x143d00[_0x50f610[_0x444b('0x34')]]={'$like':'%'+_0x15ce1e['query'][_0x444b('0x46')]+'%'};return _0x143d00;}})});}_0x43ccfb=_[_0x444b('0x48')]({},_0x43ccfb,_0x15ce1e[_0x444b('0x4b')]);var _0x384280={'where':_0x43ccfb[_0x444b('0x47')]};return db[_0x444b('0x37')]['count'](_0x384280)[_0x444b('0x30')](function(_0x3157ef){_0x57eb9a[_0x444b('0x2a')]=_0x3157ef;if(_0x15ce1e['query'][_0x444b('0x4c')]){_0x43ccfb['include']=[{'all':!![]}];}return db[_0x444b('0x37')][_0x444b('0x4d')](_0x43ccfb);})[_0x444b('0x30')](function(_0x2a94be){_0x57eb9a[_0x444b('0x4e')]=_0x2a94be;return _0x57eb9a;})[_0x444b('0x30')](respondWithFilteredResult(_0x345b8e,_0x43ccfb))[_0x444b('0x26')](handleError(_0x345b8e,null));};exports[_0x444b('0x4f')]=function(_0x8b8830,_0x48686a){var _0x181998={'raw':![],'where':{'id':_0x8b8830[_0x444b('0x50')]['id']}},_0x30cc54={};_0x30cc54[_0x444b('0x39')]=_[_0x444b('0x51')](db['SugarcrmAccount'][_0x444b('0x52')]);_0x30cc54[_0x444b('0x3b')]=_['keys'](_0x8b8830[_0x444b('0x3b')]);_0x30cc54[_0x444b('0x44')]=_[_0x444b('0x3c')](_0x30cc54['model'],_0x30cc54[_0x444b('0x3b')]);_0x181998[_0x444b('0x3d')]=_[_0x444b('0x3c')](_0x30cc54[_0x444b('0x39')],qs[_0x444b('0x3e')](_0x8b8830[_0x444b('0x3b')][_0x444b('0x3e')]));_0x181998[_0x444b('0x3d')]=_0x181998['attributes'][_0x444b('0x3f')]?_0x181998['attributes']:_0x30cc54[_0x444b('0x39')];if(_0x8b8830[_0x444b('0x3b')][_0x444b('0x4c')]){_0x181998[_0x444b('0x53')]=[{'all':!![]}];}_0x181998=_[_0x444b('0x48')]({},_0x181998,_0x8b8830[_0x444b('0x4b')]);return db['SugarcrmAccount'][_0x444b('0x54')](_0x181998)['then'](handleEntityNotFound(_0x48686a,null))[_0x444b('0x30')](respondWithResult(_0x48686a,null))[_0x444b('0x26')](handleError(_0x48686a,null));};exports['create']=function(_0x16da71,_0x3a3399){return db[_0x444b('0x37')][_0x444b('0x55')](_0x16da71['body'],{})[_0x444b('0x30')](respondWithResult(_0x3a3399,0xc9))[_0x444b('0x26')](handleError(_0x3a3399,null));};exports['update']=function(_0x16250f,_0x4b2994){if(_0x16250f[_0x444b('0x56')]['id']){delete _0x16250f[_0x444b('0x56')]['id'];}return db[_0x444b('0x37')][_0x444b('0x54')]({'where':{'id':_0x16250f[_0x444b('0x50')]['id']}})[_0x444b('0x30')](handleEntityNotFound(_0x4b2994,null))[_0x444b('0x30')](saveUpdates(_0x16250f[_0x444b('0x56')],null))[_0x444b('0x30')](respondWithResult(_0x4b2994,null))[_0x444b('0x26')](handleError(_0x4b2994,null));};exports[_0x444b('0x31')]=function(_0x5cf300,_0x2b0243){return db[_0x444b('0x37')][_0x444b('0x54')]({'where':{'id':_0x5cf300[_0x444b('0x50')]['id']}})[_0x444b('0x30')](handleEntityNotFound(_0x2b0243,null))[_0x444b('0x30')](removeEntity(_0x2b0243,null))[_0x444b('0x26')](handleError(_0x2b0243,null));};exports['getConfigurations']=function(_0x30e20e,_0x5d551c,_0x5b29d0){var _0x596d82={};var _0x1c12d6={};var _0x59c5ae;var _0x28556d;return db[_0x444b('0x37')][_0x444b('0x57')]({'where':{'id':_0x30e20e['params']['id']}})[_0x444b('0x30')](handleEntityNotFound(_0x5d551c,null))[_0x444b('0x30')](function(_0x2e81e5){if(_0x2e81e5){_0x59c5ae=_0x2e81e5;_0x1c12d6[_0x444b('0x39')]=_['keys'](db[_0x444b('0x58')]['rawAttributes']);_0x1c12d6['query']=_[_0x444b('0x51')](_0x30e20e[_0x444b('0x3b')]);_0x1c12d6[_0x444b('0x44')]=_['intersection'](_0x1c12d6[_0x444b('0x39')],_0x1c12d6['query']);_0x596d82[_0x444b('0x3d')]=_[_0x444b('0x3c')](_0x1c12d6[_0x444b('0x39')],qs[_0x444b('0x3e')](_0x30e20e[_0x444b('0x3b')][_0x444b('0x3e')]));_0x596d82['attributes']=_0x596d82[_0x444b('0x3d')][_0x444b('0x3f')]?_0x596d82[_0x444b('0x3d')]:_0x1c12d6[_0x444b('0x39')];_0x596d82['order']=qs[_0x444b('0x43')](_0x30e20e[_0x444b('0x3b')][_0x444b('0x43')]);_0x596d82[_0x444b('0x47')]=qs[_0x444b('0x44')](_[_0x444b('0x45')](_0x30e20e[_0x444b('0x3b')],_0x1c12d6[_0x444b('0x44')]));if(_0x30e20e['query']['filter']){_0x596d82[_0x444b('0x47')]=_[_0x444b('0x48')](_0x596d82[_0x444b('0x47')],{'$or':_[_0x444b('0x3a')](_0x596d82['attributes'],function(_0x5381ae){var _0x52e08d={};_0x52e08d[_0x5381ae]={'$like':'%'+_0x30e20e[_0x444b('0x3b')]['filter']+'%'};return _0x52e08d;})});}_0x596d82=_[_0x444b('0x48')]({},_0x596d82,_0x30e20e[_0x444b('0x4b')]);return _0x59c5ae[_0x444b('0x59')](_0x596d82);}})[_0x444b('0x30')](function(_0xa1ddba){if(_0xa1ddba){_0x28556d=_0xa1ddba['length'];if(!_0x30e20e[_0x444b('0x3b')][_0x444b('0x5a')]('nolimit')){_0x596d82[_0x444b('0x41')]=qs['limit'](_0x30e20e[_0x444b('0x3b')][_0x444b('0x41')]);_0x596d82['offset']=qs[_0x444b('0x2b')](_0x30e20e[_0x444b('0x3b')]['offset']);}return _0x59c5ae[_0x444b('0x59')](_0x596d82);}})[_0x444b('0x30')](function(_0x4ec6a3){if(_0x4ec6a3){return _0x4ec6a3?{'count':_0x28556d,'rows':_0x4ec6a3}:null;}})['then'](respondWithResult(_0x5d551c,null))[_0x444b('0x26')](handleError(_0x5d551c,null));};exports[_0x444b('0x5b')]=function(_0x5e4133,_0x392235,_0xa6172f){if(_0x5e4133[_0x444b('0x56')]['id']){delete _0x5e4133[_0x444b('0x56')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x5e4133['params']['id']}})[_0x444b('0x30')](handleEntityNotFound(_0x392235,null))[_0x444b('0x30')](function(_0x5edfd3){if(_0x5edfd3){_0x5e4133[_0x444b('0x56')][_0x444b('0x5c')]=_0x5edfd3['id'];_0x5e4133[_0x444b('0x56')][_0x444b('0x5d')]=integrations['getSubjects'](_0x5e4133[_0x444b('0x56')]['channel'],_0x5e4133['body'][_0x444b('0x49')]);_0x5e4133[_0x444b('0x56')][_0x444b('0x5e')]=integrations['getDescriptions'](_0x5e4133[_0x444b('0x56')][_0x444b('0x5f')],_0x5e4133['body']['type']);return db[_0x444b('0x58')]['create'](_0x5e4133[_0x444b('0x56')],{'include':[{'model':db[_0x444b('0x60')],'as':_0x444b('0x5d')},{'model':db['SugarcrmField'],'as':_0x444b('0x5e')}]});}return null;})['then'](respondWithResult(_0x392235,null))[_0x444b('0x26')](handleError(_0x392235,null));};exports[_0x444b('0x61')]=function(_0x425c7b,_0x310d01,_0x2beca8){var _0x42676c='';var _0x255f39=['id',_0x444b('0x34'),_0x444b('0x62'),'created_by',_0x444b('0x63'),_0x444b('0x64'),_0x444b('0x65'),'duration_minutes',_0x444b('0x66'),'parent_type',_0x444b('0x67'),'direction'];return db[_0x444b('0x37')][_0x444b('0x57')]({'where':{'id':_0x425c7b[_0x444b('0x50')]['id']},'attributes':['id','username','password',_0x444b('0x68')]})[_0x444b('0x30')](handleEntityNotFound(_0x310d01,null))[_0x444b('0x30')](function(_0x15fe3f){if(_0x15fe3f){_0x42676c=_0x15fe3f[_0x444b('0x68')];var _0x5c27b0=_0x42676c['slice'](-0x1);if(_0x5c27b0==='/'){_0x42676c=_0x42676c[_0x444b('0x69')](0x0,_0x42676c['lastIndexOf'](_0x5c27b0));}return rp({'method':_0x444b('0x6a'),'uri':util[_0x444b('0x6b')](_0x444b('0x6c'),_0x42676c,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x444b('0x6d'),'input_type':_0x444b('0x6e'),'response_type':'JSON','rest_data':JSON[_0x444b('0x22')]({'user_auth':{'user_name':_0x15fe3f['username'],'password':_0x15fe3f[_0x444b('0x6f')],'encryption':_0x444b('0x70')},'application':_0x444b('0x71')})}});}})[_0x444b('0x30')](function(_0x5d2a87){if(_0x5d2a87&&_0x5d2a87[_0x444b('0x34')]!==_0x444b('0x72')&&_0x5d2a87['name']!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0x444b('0x6b')](_0x444b('0x6c'),_0x42676c,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x444b('0x73'),'input_type':_0x444b('0x6e'),'response_type':_0x444b('0x6e'),'rest_data':JSON[_0x444b('0x22')]({'session':_0x5d2a87['id'],'module_name':_0x444b('0x74')})}})['then'](function(_0x783111){if(_0x783111){var _0x151998=_['values'](_0x783111['module_fields']);_['remove'](_0x151998,function(_0x169066){return _0x255f39['includes'](_0x169066[_0x444b('0x34')]);});return{'count':_0x151998[_0x444b('0x3f')],'rows':_[_0x444b('0x3a')](_0x151998,function(_0x3c1c1e){return{'id':_0x3c1c1e['name'],'name':_0x3c1c1e[_0x444b('0x75')],'custom':_[_0x444b('0x76')](_0x3c1c1e[_0x444b('0x34')],'_c')?!![]:![],'options':_0x3c1c1e['options']?_[_0x444b('0x3a')](_[_0x444b('0x77')](_0x3c1c1e[_0x444b('0x4b')]),function(_0x7a05b2){return{'name':_0x7a05b2['value'],'value':_0x7a05b2[_0x444b('0x34')]};}):[]};})};}})[_0x444b('0x30')](respondWithResult(_0x310d01,null))[_0x444b('0x26')](function(_0x3c2337){var _0x141313=_0x425c7b[_0x444b('0x3b')][_0x444b('0x78')]?0x1f4:_0x3c2337[_0x444b('0x79')]||0x1f4;logger[_0x444b('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0x444b('0x61'),_0x141313,JSON[_0x444b('0x22')](_0x3c2337));delete _0x3c2337[_0x444b('0x34')];if(_0x141313===0x191){_0x141313=0x190;}_0x310d01[_0x444b('0x27')](_0x141313)[_0x444b('0x35')](_0x425c7b[_0x444b('0x3b')]['test']?{'message':_0x444b('0x7a'),'statusCode':_0x3c2337[_0x444b('0x79')]}:_0x3c2337);});}else{var _0x1a51aa=0x1f4;_0x310d01[_0x444b('0x27')](_0x1a51aa)[_0x444b('0x35')]({'message':_0x444b('0x7a'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xec08=['parent_type','parent_name','direction','password','remoteUri','substring','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','values','remove','label','endsWith','statusCode','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','set','apply','save','update','destroy','stack','name','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','sort','where','pick','merge','VIRTUAL','filter','options','SugarcrmAccount','count','includeAll','include','findAll','rows','show','keys','length','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','order','hasOwnProperty','nolimit','addConfiguration','channel','Descriptions','getDescriptions','Subjects','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id'];(function(_0x46a907,_0x5ada45){var _0x34b186=function(_0x2991bb){while(--_0x2991bb){_0x46a907['push'](_0x46a907['shift']());}};_0x34b186(++_0x5ada45);}(_0xec08,0x190));var _0x8ec0=function(_0x259784,_0x3c5337){_0x259784=_0x259784-0x0;var _0x18dd01=_0xec08[_0x259784];return _0x18dd01;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8ec0('0x0'));var rimraf=require(_0x8ec0('0x1'));var zipdir=require(_0x8ec0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8ec0('0x3'));var util=require(_0x8ec0('0x4'));var path=require(_0x8ec0('0x5'));var sox=require(_0x8ec0('0x6'));var csv=require('to-csv');var ejs=require(_0x8ec0('0x7'));var fs=require('fs');var _=require(_0x8ec0('0x8'));var squel=require(_0x8ec0('0x9'));var crypto=require(_0x8ec0('0xa'));var jsforce=require(_0x8ec0('0xb'));var deskjs=require(_0x8ec0('0xc'));var toCsv=require(_0x8ec0('0xd'));var querystring=require(_0x8ec0('0xe'));var Papa=require(_0x8ec0('0xf'));var Redis=require(_0x8ec0('0x10'));var authService=require(_0x8ec0('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8ec0('0x12'));var logger=require('../../config/logger')(_0x8ec0('0x13'));var utils=require(_0x8ec0('0x14'));var config=require(_0x8ec0('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ec0('0x16'))['db'];var integrations=require(_0x8ec0('0x17'));var jayson=require('jayson/promise');var client=jayson[_0x8ec0('0x18')][_0x8ec0('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2cb628,_0x3752e3,_0x5d15b0,_0x32a773){return new BPromise(function(_0x2ef954,_0x2eec9e){var _0x2175a7=_0x32a773||client;return _0x2175a7['request'](_0x2cb628,_0x5d15b0)[_0x8ec0('0x1a')](function(_0x2ffc41){logger[_0x8ec0('0x1b')]('SugarcrmAccount,\x20%s,\x20%s',_0x3752e3,_0x8ec0('0x1c'));logger[_0x8ec0('0x1d')](_0x8ec0('0x1e'),_0x3752e3,_0x8ec0('0x1c'),JSON['stringify'](_0x2ffc41));if(_0x2ffc41[_0x8ec0('0x1f')]){if(_0x2ffc41['error'][_0x8ec0('0x20')]===0x1f4){logger[_0x8ec0('0x1f')](_0x8ec0('0x21'),_0x3752e3,_0x2ffc41[_0x8ec0('0x1f')][_0x8ec0('0x22')]);return _0x2eec9e(_0x2ffc41[_0x8ec0('0x1f')][_0x8ec0('0x22')]);}logger[_0x8ec0('0x1f')](_0x8ec0('0x21'),_0x3752e3,_0x2ffc41['error'][_0x8ec0('0x22')]);return _0x2ef954(_0x2ffc41[_0x8ec0('0x1f')]['message']);}else{logger[_0x8ec0('0x1b')](_0x8ec0('0x21'),_0x3752e3,'request\x20sent');_0x2ef954(_0x2ffc41[_0x8ec0('0x23')][_0x8ec0('0x22')]);}})[_0x8ec0('0x24')](function(_0x35dce3){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x3752e3,_0x35dce3);_0x2eec9e(_0x35dce3);});});}function respondWithStatusCode(_0xd88b41,_0x4d979c){_0x4d979c=_0x4d979c||0xcc;return function(_0xf523d6){if(_0xf523d6){return _0xd88b41[_0x8ec0('0x25')](_0x4d979c);}return _0xd88b41[_0x8ec0('0x26')](_0x4d979c)[_0x8ec0('0x27')]();};}function respondWithResult(_0x377880,_0x3a2ae4){_0x3a2ae4=_0x3a2ae4||0xc8;return function(_0x5b2a1c){if(_0x5b2a1c){return _0x377880['status'](_0x3a2ae4)[_0x8ec0('0x28')](_0x5b2a1c);}};}function respondWithFilteredResult(_0x580846,_0x170544){return function(_0x587f0b){if(_0x587f0b){var _0x5aa04a=_0x587f0b['count'],_0x5e1075=_0x170544[_0x8ec0('0x29')],_0x280814=_0x170544[_0x8ec0('0x29')]+_0x170544[_0x8ec0('0x2a')],_0x371ded;if(_0x280814>=_0x5aa04a){_0x280814=_0x5aa04a;_0x371ded=0xc8;}else{_0x371ded=0xce;}_0x580846[_0x8ec0('0x26')](_0x371ded);return _0x580846[_0x8ec0('0x2b')]('Content-Range',_0x5e1075+'-'+_0x280814+'/'+_0x5aa04a)['json'](_0x587f0b);}return null;};}function patchUpdates(_0x46e924){return function(_0x42d1de){try{jsonpatch[_0x8ec0('0x2c')](_0x42d1de,_0x46e924,!![]);}catch(_0x1755ba){return BPromise['reject'](_0x1755ba);}return _0x42d1de[_0x8ec0('0x2d')]();};}function saveUpdates(_0x2f8d6f,_0x3d9ea5){return function(_0x3199b5){if(_0x3199b5){return _0x3199b5[_0x8ec0('0x2e')](_0x2f8d6f)['then'](function(_0xca0466){return _0xca0466;});}return null;};}function removeEntity(_0x3f8142,_0x2d2a70){return function(_0x1242b1){if(_0x1242b1){return _0x1242b1[_0x8ec0('0x2f')]()[_0x8ec0('0x1a')](function(){_0x3f8142[_0x8ec0('0x26')](0xcc)[_0x8ec0('0x27')]();});}};}function handleEntityNotFound(_0x5b2754,_0x19dfc2){return function(_0xc15d04){if(!_0xc15d04){_0x5b2754[_0x8ec0('0x25')](0x194);}return _0xc15d04;};}function handleError(_0x5e4879,_0x4648ce){_0x4648ce=_0x4648ce||0x1f4;return function(_0x3fcb3b){logger[_0x8ec0('0x1f')](_0x3fcb3b[_0x8ec0('0x30')]);if(_0x3fcb3b['name']){delete _0x3fcb3b[_0x8ec0('0x31')];}_0x5e4879['status'](_0x4648ce)['send'](_0x3fcb3b);};}exports[_0x8ec0('0x32')]=function(_0x3d9e75,_0x2a6c98){var _0x4092a7={},_0x23b900={},_0x3b8b25={'count':0x0,'rows':[]};var _0x5a4ebd=_[_0x8ec0('0x33')](db['SugarcrmAccount']['rawAttributes'],function(_0xc92f4d){return{'name':_0xc92f4d[_0x8ec0('0x34')],'type':_0xc92f4d[_0x8ec0('0x35')][_0x8ec0('0x36')]};});_0x23b900[_0x8ec0('0x37')]=_[_0x8ec0('0x33')](_0x5a4ebd,_0x8ec0('0x31'));_0x23b900[_0x8ec0('0x38')]=_['keys'](_0x3d9e75[_0x8ec0('0x38')]);_0x23b900[_0x8ec0('0x39')]=_[_0x8ec0('0x3a')](_0x23b900[_0x8ec0('0x37')],_0x23b900[_0x8ec0('0x38')]);_0x4092a7['attributes']=_['intersection'](_0x23b900['model'],qs[_0x8ec0('0x3b')](_0x3d9e75[_0x8ec0('0x38')][_0x8ec0('0x3b')]));_0x4092a7['attributes']=_0x4092a7[_0x8ec0('0x3c')]['length']?_0x4092a7[_0x8ec0('0x3c')]:_0x23b900['model'];if(!_0x3d9e75[_0x8ec0('0x38')]['hasOwnProperty']('nolimit')){_0x4092a7['limit']=qs[_0x8ec0('0x2a')](_0x3d9e75[_0x8ec0('0x38')]['limit']);_0x4092a7['offset']=qs[_0x8ec0('0x29')](_0x3d9e75[_0x8ec0('0x38')][_0x8ec0('0x29')]);}_0x4092a7['order']=qs[_0x8ec0('0x3d')](_0x3d9e75[_0x8ec0('0x38')][_0x8ec0('0x3d')]);_0x4092a7[_0x8ec0('0x3e')]=qs[_0x8ec0('0x39')](_[_0x8ec0('0x3f')](_0x3d9e75['query'],_0x23b900[_0x8ec0('0x39')]),_0x5a4ebd);if(_0x3d9e75[_0x8ec0('0x38')]['filter']){_0x4092a7[_0x8ec0('0x3e')]=_[_0x8ec0('0x40')](_0x4092a7[_0x8ec0('0x3e')],{'$or':_[_0x8ec0('0x33')](_0x5a4ebd,function(_0x1884f0){if(_0x1884f0[_0x8ec0('0x35')]!==_0x8ec0('0x41')){var _0x55cb1a={};_0x55cb1a[_0x1884f0['name']]={'$like':'%'+_0x3d9e75[_0x8ec0('0x38')][_0x8ec0('0x42')]+'%'};return _0x55cb1a;}})});}_0x4092a7=_['merge']({},_0x4092a7,_0x3d9e75[_0x8ec0('0x43')]);var _0x1ca52f={'where':_0x4092a7[_0x8ec0('0x3e')]};return db[_0x8ec0('0x44')][_0x8ec0('0x45')](_0x1ca52f)['then'](function(_0x285f3b){_0x3b8b25['count']=_0x285f3b;if(_0x3d9e75['query'][_0x8ec0('0x46')]){_0x4092a7[_0x8ec0('0x47')]=[{'all':!![]}];}return db[_0x8ec0('0x44')][_0x8ec0('0x48')](_0x4092a7);})['then'](function(_0x4af856){_0x3b8b25[_0x8ec0('0x49')]=_0x4af856;return _0x3b8b25;})[_0x8ec0('0x1a')](respondWithFilteredResult(_0x2a6c98,_0x4092a7))[_0x8ec0('0x24')](handleError(_0x2a6c98,null));};exports[_0x8ec0('0x4a')]=function(_0x41ad16,_0x388276){var _0x460415={'raw':![],'where':{'id':_0x41ad16['params']['id']}},_0x247305={};_0x247305['model']=_[_0x8ec0('0x4b')](db[_0x8ec0('0x44')]['rawAttributes']);_0x247305[_0x8ec0('0x38')]=_[_0x8ec0('0x4b')](_0x41ad16[_0x8ec0('0x38')]);_0x247305[_0x8ec0('0x39')]=_[_0x8ec0('0x3a')](_0x247305[_0x8ec0('0x37')],_0x247305['query']);_0x460415['attributes']=_['intersection'](_0x247305[_0x8ec0('0x37')],qs[_0x8ec0('0x3b')](_0x41ad16[_0x8ec0('0x38')][_0x8ec0('0x3b')]));_0x460415['attributes']=_0x460415['attributes'][_0x8ec0('0x4c')]?_0x460415['attributes']:_0x247305[_0x8ec0('0x37')];if(_0x41ad16[_0x8ec0('0x38')]['includeAll']){_0x460415[_0x8ec0('0x47')]=[{'all':!![]}];}_0x460415=_[_0x8ec0('0x40')]({},_0x460415,_0x41ad16[_0x8ec0('0x43')]);return db[_0x8ec0('0x44')][_0x8ec0('0x4d')](_0x460415)[_0x8ec0('0x1a')](handleEntityNotFound(_0x388276,null))[_0x8ec0('0x1a')](respondWithResult(_0x388276,null))['catch'](handleError(_0x388276,null));};exports[_0x8ec0('0x4e')]=function(_0x1ed071,_0x3765a1){return db['SugarcrmAccount'][_0x8ec0('0x4e')](_0x1ed071[_0x8ec0('0x4f')],{})[_0x8ec0('0x1a')](respondWithResult(_0x3765a1,0xc9))['catch'](handleError(_0x3765a1,null));};exports['update']=function(_0x101f05,_0x5e3ec5){if(_0x101f05[_0x8ec0('0x4f')]['id']){delete _0x101f05['body']['id'];}return db[_0x8ec0('0x44')][_0x8ec0('0x4d')]({'where':{'id':_0x101f05[_0x8ec0('0x50')]['id']}})['then'](handleEntityNotFound(_0x5e3ec5,null))[_0x8ec0('0x1a')](saveUpdates(_0x101f05[_0x8ec0('0x4f')],null))['then'](respondWithResult(_0x5e3ec5,null))[_0x8ec0('0x24')](handleError(_0x5e3ec5,null));};exports[_0x8ec0('0x2f')]=function(_0x49bbdf,_0x272013){return db['SugarcrmAccount'][_0x8ec0('0x4d')]({'where':{'id':_0x49bbdf[_0x8ec0('0x50')]['id']}})[_0x8ec0('0x1a')](handleEntityNotFound(_0x272013,null))['then'](removeEntity(_0x272013,null))['catch'](handleError(_0x272013,null));};exports[_0x8ec0('0x51')]=function(_0x3b5643,_0x4de34e,_0x432a20){var _0x17309b={};var _0x9ec011={};var _0x5ee873;var _0xd7e6;return db['SugarcrmAccount'][_0x8ec0('0x52')]({'where':{'id':_0x3b5643[_0x8ec0('0x50')]['id']}})[_0x8ec0('0x1a')](handleEntityNotFound(_0x4de34e,null))['then'](function(_0x270144){if(_0x270144){_0x5ee873=_0x270144;_0x9ec011[_0x8ec0('0x37')]=_[_0x8ec0('0x4b')](db[_0x8ec0('0x53')]['rawAttributes']);_0x9ec011[_0x8ec0('0x38')]=_['keys'](_0x3b5643[_0x8ec0('0x38')]);_0x9ec011[_0x8ec0('0x39')]=_['intersection'](_0x9ec011[_0x8ec0('0x37')],_0x9ec011[_0x8ec0('0x38')]);_0x17309b[_0x8ec0('0x3c')]=_[_0x8ec0('0x3a')](_0x9ec011['model'],qs[_0x8ec0('0x3b')](_0x3b5643['query'][_0x8ec0('0x3b')]));_0x17309b[_0x8ec0('0x3c')]=_0x17309b[_0x8ec0('0x3c')][_0x8ec0('0x4c')]?_0x17309b[_0x8ec0('0x3c')]:_0x9ec011['model'];_0x17309b[_0x8ec0('0x54')]=qs['sort'](_0x3b5643[_0x8ec0('0x38')][_0x8ec0('0x3d')]);_0x17309b['where']=qs['filters'](_[_0x8ec0('0x3f')](_0x3b5643['query'],_0x9ec011[_0x8ec0('0x39')]));if(_0x3b5643[_0x8ec0('0x38')]['filter']){_0x17309b[_0x8ec0('0x3e')]=_[_0x8ec0('0x40')](_0x17309b[_0x8ec0('0x3e')],{'$or':_['map'](_0x17309b[_0x8ec0('0x3c')],function(_0x43d3c3){var _0x261e57={};_0x261e57[_0x43d3c3]={'$like':'%'+_0x3b5643[_0x8ec0('0x38')][_0x8ec0('0x42')]+'%'};return _0x261e57;})});}_0x17309b=_[_0x8ec0('0x40')]({},_0x17309b,_0x3b5643[_0x8ec0('0x43')]);return _0x5ee873['getConfigurations'](_0x17309b);}})[_0x8ec0('0x1a')](function(_0x1c025f){if(_0x1c025f){_0xd7e6=_0x1c025f['length'];if(!_0x3b5643[_0x8ec0('0x38')][_0x8ec0('0x55')](_0x8ec0('0x56'))){_0x17309b[_0x8ec0('0x2a')]=qs[_0x8ec0('0x2a')](_0x3b5643[_0x8ec0('0x38')][_0x8ec0('0x2a')]);_0x17309b[_0x8ec0('0x29')]=qs['offset'](_0x3b5643[_0x8ec0('0x38')][_0x8ec0('0x29')]);}return _0x5ee873[_0x8ec0('0x51')](_0x17309b);}})['then'](function(_0x1b0688){if(_0x1b0688){return _0x1b0688?{'count':_0xd7e6,'rows':_0x1b0688}:null;}})[_0x8ec0('0x1a')](respondWithResult(_0x4de34e,null))['catch'](handleError(_0x4de34e,null));};exports[_0x8ec0('0x57')]=function(_0x1455b1,_0x9534e2,_0x2ac743){if(_0x1455b1[_0x8ec0('0x4f')]['id']){delete _0x1455b1[_0x8ec0('0x4f')]['id'];}return db[_0x8ec0('0x44')][_0x8ec0('0x52')]({'where':{'id':_0x1455b1[_0x8ec0('0x50')]['id']}})[_0x8ec0('0x1a')](handleEntityNotFound(_0x9534e2,null))[_0x8ec0('0x1a')](function(_0xb66b4a){if(_0xb66b4a){_0x1455b1[_0x8ec0('0x4f')]['AccountId']=_0xb66b4a['id'];_0x1455b1[_0x8ec0('0x4f')]['Subjects']=integrations['getSubjects'](_0x1455b1[_0x8ec0('0x4f')][_0x8ec0('0x58')],_0x1455b1[_0x8ec0('0x4f')][_0x8ec0('0x35')]);_0x1455b1[_0x8ec0('0x4f')][_0x8ec0('0x59')]=integrations[_0x8ec0('0x5a')](_0x1455b1[_0x8ec0('0x4f')][_0x8ec0('0x58')],_0x1455b1['body'][_0x8ec0('0x35')]);return db[_0x8ec0('0x53')][_0x8ec0('0x4e')](_0x1455b1[_0x8ec0('0x4f')],{'include':[{'model':db['SugarcrmField'],'as':_0x8ec0('0x5b')},{'model':db[_0x8ec0('0x5c')],'as':'Descriptions'}]});}return null;})[_0x8ec0('0x1a')](respondWithResult(_0x9534e2,null))[_0x8ec0('0x24')](handleError(_0x9534e2,null));};exports[_0x8ec0('0x5d')]=function(_0x1c0748,_0x2f07db,_0x15443e){var _0xb38290='';var _0x29ebb3=['id',_0x8ec0('0x31'),_0x8ec0('0x5e'),_0x8ec0('0x5f'),_0x8ec0('0x60'),_0x8ec0('0x61'),'duration_hours',_0x8ec0('0x62'),_0x8ec0('0x63'),_0x8ec0('0x64'),_0x8ec0('0x65'),_0x8ec0('0x66')];return db[_0x8ec0('0x44')][_0x8ec0('0x52')]({'where':{'id':_0x1c0748[_0x8ec0('0x50')]['id']},'attributes':['id','username',_0x8ec0('0x67'),_0x8ec0('0x68')]})[_0x8ec0('0x1a')](handleEntityNotFound(_0x2f07db,null))[_0x8ec0('0x1a')](function(_0x209027){if(_0x209027){_0xb38290=_0x209027[_0x8ec0('0x68')];var _0x315c4c=_0xb38290['slice'](-0x1);if(_0x315c4c==='/'){_0xb38290=_0xb38290[_0x8ec0('0x69')](0x0,_0xb38290['lastIndexOf'](_0x315c4c));}return rp({'method':_0x8ec0('0x6a'),'uri':util['format'](_0x8ec0('0x6b'),_0xb38290,_0x8ec0('0x6c')),'json':!![],'form':{'method':_0x8ec0('0x6d'),'input_type':_0x8ec0('0x6e'),'response_type':_0x8ec0('0x6e'),'rest_data':JSON[_0x8ec0('0x6f')]({'user_auth':{'user_name':_0x209027[_0x8ec0('0x70')],'password':_0x209027[_0x8ec0('0x67')],'encryption':_0x8ec0('0x71')},'application':_0x8ec0('0x72')})}});}})['then'](function(_0x33bc9c){if(_0x33bc9c&&_0x33bc9c[_0x8ec0('0x31')]!==_0x8ec0('0x73')&&_0x33bc9c[_0x8ec0('0x31')]!==_0x8ec0('0x74')){return rp({'method':_0x8ec0('0x6a'),'uri':util['format']('%s%s',_0xb38290,_0x8ec0('0x6c')),'json':!![],'form':{'method':_0x8ec0('0x75'),'input_type':_0x8ec0('0x6e'),'response_type':'JSON','rest_data':JSON[_0x8ec0('0x6f')]({'session':_0x33bc9c['id'],'module_name':'Calls'})}})[_0x8ec0('0x1a')](function(_0x23ad56){if(_0x23ad56){var _0x5e419a=_[_0x8ec0('0x76')](_0x23ad56['module_fields']);_[_0x8ec0('0x77')](_0x5e419a,function(_0x38572d){return _0x29ebb3['includes'](_0x38572d[_0x8ec0('0x31')]);});return{'count':_0x5e419a[_0x8ec0('0x4c')],'rows':_[_0x8ec0('0x33')](_0x5e419a,function(_0x4c6418){return{'id':_0x4c6418['name'],'name':_0x4c6418[_0x8ec0('0x78')],'custom':_[_0x8ec0('0x79')](_0x4c6418[_0x8ec0('0x31')],'_c')?!![]:![],'options':_0x4c6418[_0x8ec0('0x43')]?_[_0x8ec0('0x33')](_[_0x8ec0('0x76')](_0x4c6418['options']),function(_0x54fe61){return{'name':_0x54fe61['value'],'value':_0x54fe61[_0x8ec0('0x31')]};}):[]};})};}})[_0x8ec0('0x1a')](respondWithResult(_0x2f07db,null))[_0x8ec0('0x24')](function(_0x411c12){var _0x5d11b6=_0x1c0748['query']['test']?0x1f4:_0x411c12[_0x8ec0('0x7a')]||0x1f4;logger[_0x8ec0('0x1f')]('getFields,\x20%s,\x20%s,\x20%s',_0x8ec0('0x5d'),_0x5d11b6,JSON[_0x8ec0('0x6f')](_0x411c12));delete _0x411c12[_0x8ec0('0x31')];if(_0x5d11b6===0x191){_0x5d11b6=0x190;}_0x2f07db[_0x8ec0('0x26')](_0x5d11b6)['send'](_0x1c0748[_0x8ec0('0x38')][_0x8ec0('0x7b')]?{'message':_0x8ec0('0x7c'),'statusCode':_0x411c12[_0x8ec0('0x7a')]}:_0x411c12);});}else{var _0x499275=0x1f4;_0x2f07db[_0x8ec0('0x26')](_0x499275)['send']({'message':'Wrong\x20credentials','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 d1236df..2bde2c8 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 _0x52b8=['request-promise','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','moment'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x52b8,0xb8));var _0x852b=function(_0x3c11fc,_0x4df1ae){_0x3c11fc=_0x3c11fc-0x0;var _0x44af95=_0x52b8[_0x3c11fc];return _0x44af95;};'use strict';var _=require(_0x852b('0x0'));var util=require(_0x852b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x852b('0x2'));var BPromise=require('bluebird');var rp=require(_0x852b('0x3'));var fs=require('fs');var path=require(_0x852b('0x4'));var rimraf=require(_0x852b('0x5'));var config=require('../../config/environment');var attributes=require(_0x852b('0x6'));var integrations=require(_0x852b('0x7'));module[_0x852b('0x8')]=function(_0x5a43a3,_0x434686){return _0x5a43a3['define'](_0x852b('0x9'),attributes,{'tableName':_0x852b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37ab=['moment','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','../../config/logger','api'];(function(_0x88b43d,_0xe1badf){var _0x48ac98=function(_0x4ca50f){while(--_0x4ca50f){_0x88b43d['push'](_0x88b43d['shift']());}};_0x48ac98(++_0xe1badf);}(_0x37ab,0xc3));var _0xb37a=function(_0x3566d0,_0x34a49f){_0x3566d0=_0x3566d0-0x0;var _0x3fd4da=_0x37ab[_0x3566d0];return _0x3fd4da;};'use strict';var _=require(_0xb37a('0x0'));var util=require('util');var logger=require(_0xb37a('0x1'))(_0xb37a('0x2'));var moment=require(_0xb37a('0x3'));var BPromise=require('bluebird');var rp=require(_0xb37a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb37a('0x5'));var config=require(_0xb37a('0x6'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xb37a('0x7'));module[_0xb37a('0x8')]=function(_0x234f5e,_0xc6b53a){return _0x234f5e[_0xb37a('0x9')]('SugarcrmAccount',attributes,{'tableName':_0xb37a('0xa'),'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 18e6b28..e6319a7 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 _0xdbb4=['findAll','options','include','attributes','map','model','ShowSugarcrmAccount','find','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSugarcrmAccount'];(function(_0x37e5b4,_0x2788ef){var _0x541f96=function(_0x1ac5be){while(--_0x1ac5be){_0x37e5b4['push'](_0x37e5b4['shift']());}};_0x541f96(++_0x2788ef);}(_0xdbb4,0x1c3));var _0x4dbb=function(_0x14ee69,_0x436a8a){_0x14ee69=_0x14ee69-0x0;var _0x4d5664=_0xdbb4[_0x14ee69];return _0x4d5664;};'use strict';var _=require(_0x4dbb('0x0'));var util=require(_0x4dbb('0x1'));var moment=require('moment');var BPromise=require(_0x4dbb('0x2'));var rs=require(_0x4dbb('0x3'));var fs=require('fs');var Redis=require(_0x4dbb('0x4'));var db=require(_0x4dbb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4dbb('0x6'))(_0x4dbb('0x7'));var config=require(_0x4dbb('0x8'));var jayson=require(_0x4dbb('0x9'));var client=jayson['client'][_0x4dbb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14a70b,_0x494b34,_0x263511){return new BPromise(function(_0xa2d923,_0x1340bc){return client[_0x4dbb('0xb')](_0x14a70b,_0x263511)[_0x4dbb('0xc')](function(_0x146280){logger[_0x4dbb('0xd')](_0x4dbb('0xe'),_0x494b34,'request\x20sent');logger[_0x4dbb('0xf')](_0x4dbb('0x10'),_0x494b34,_0x4dbb('0x11'),JSON[_0x4dbb('0x12')](_0x146280));if(_0x146280[_0x4dbb('0x13')]){if(_0x146280[_0x4dbb('0x13')][_0x4dbb('0x14')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x494b34,_0x146280[_0x4dbb('0x13')]['message']);return _0x1340bc(_0x146280[_0x4dbb('0x13')][_0x4dbb('0x15')]);}logger[_0x4dbb('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x494b34,_0x146280[_0x4dbb('0x13')]['message']);return _0xa2d923(_0x146280['error']['message']);}else{logger['info'](_0x4dbb('0xe'),_0x494b34,_0x4dbb('0x11'));_0xa2d923(_0x146280[_0x4dbb('0x16')][_0x4dbb('0x15')]);}})[_0x4dbb('0x17')](function(_0x143179){logger[_0x4dbb('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x494b34,_0x143179);_0x1340bc(_0x143179);});});}exports[_0x4dbb('0x18')]=function(_0x1deef5){var _0x194f87=this;return new Promise(function(_0x198b81,_0x43c600){return db['SugarcrmAccount'][_0x4dbb('0x19')]({'raw':_0x1deef5[_0x4dbb('0x1a')]?_0x1deef5[_0x4dbb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1deef5['options']?_0x1deef5[_0x4dbb('0x1a')]['where']||null:null,'attributes':_0x1deef5['options']?_0x1deef5[_0x4dbb('0x1a')]['attributes']||null:null,'limit':_0x1deef5[_0x4dbb('0x1a')]?_0x1deef5[_0x4dbb('0x1a')]['limit']||null:null,'include':_0x1deef5[_0x4dbb('0x1a')]?_0x1deef5[_0x4dbb('0x1a')][_0x4dbb('0x1b')]?_['map'](_0x1deef5[_0x4dbb('0x1a')][_0x4dbb('0x1b')],function(_0x293aaf){return{'model':db[_0x293aaf['model']],'as':_0x293aaf['as'],'attributes':_0x293aaf[_0x4dbb('0x1c')],'include':_0x293aaf[_0x4dbb('0x1b')]?_[_0x4dbb('0x1d')](_0x293aaf[_0x4dbb('0x1b')],function(_0x6caa9a){return{'model':db[_0x6caa9a[_0x4dbb('0x1e')]],'as':_0x6caa9a['as'],'attributes':_0x6caa9a[_0x4dbb('0x1c')],'include':_0x6caa9a[_0x4dbb('0x1b')]?_[_0x4dbb('0x1d')](_0x6caa9a[_0x4dbb('0x1b')],function(_0x20ff19){return{'model':db[_0x20ff19[_0x4dbb('0x1e')]],'as':_0x20ff19['as'],'attributes':_0x20ff19[_0x4dbb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4dbb('0xc')](function(_0x34f416){logger['info'](_0x4dbb('0x18'),_0x1deef5);logger[_0x4dbb('0xf')]('GetSugarcrmAccount',_0x1deef5,JSON[_0x4dbb('0x12')](_0x34f416));_0x198b81(_0x34f416);})[_0x4dbb('0x17')](function(_0x185a51){logger[_0x4dbb('0x13')](_0x4dbb('0x18'),_0x185a51['message'],_0x1deef5);_0x43c600(_0x194f87['error'](0x1f4,_0x185a51[_0x4dbb('0x15')]));});});};exports[_0x4dbb('0x1f')]=function(_0x33c44d){var _0x4f5f1a=this;return new Promise(function(_0x52dd6a,_0x2fdd96){return db['SugarcrmAccount'][_0x4dbb('0x20')]({'raw':_0x33c44d[_0x4dbb('0x1a')]?_0x33c44d[_0x4dbb('0x1a')][_0x4dbb('0x21')]===undefined?!![]:![]:!![],'where':_0x33c44d[_0x4dbb('0x1a')]?_0x33c44d[_0x4dbb('0x1a')]['where']||null:null,'attributes':_0x33c44d[_0x4dbb('0x1a')]?_0x33c44d['options'][_0x4dbb('0x1c')]||null:null,'include':_0x33c44d[_0x4dbb('0x1a')]?_0x33c44d[_0x4dbb('0x1a')]['include']?_[_0x4dbb('0x1d')](_0x33c44d[_0x4dbb('0x1a')][_0x4dbb('0x1b')],function(_0x38a15c){return{'model':db[_0x38a15c['model']],'as':_0x38a15c['as'],'attributes':_0x38a15c[_0x4dbb('0x1c')],'include':_0x38a15c[_0x4dbb('0x1b')]?_[_0x4dbb('0x1d')](_0x38a15c['include'],function(_0x56a4f2){return{'model':db[_0x56a4f2[_0x4dbb('0x1e')]],'as':_0x56a4f2['as'],'attributes':_0x56a4f2['attributes'],'include':_0x56a4f2[_0x4dbb('0x1b')]?_[_0x4dbb('0x1d')](_0x56a4f2['include'],function(_0x18a159){return{'model':db[_0x18a159['model']],'as':_0x18a159['as'],'attributes':_0x18a159[_0x4dbb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4dbb('0xc')](function(_0x1ea08b){logger[_0x4dbb('0xd')](_0x4dbb('0x1f'),_0x33c44d);logger[_0x4dbb('0xf')]('ShowSugarcrmAccount',_0x33c44d,JSON['stringify'](_0x1ea08b));_0x52dd6a(_0x1ea08b);})[_0x4dbb('0x17')](function(_0x5cea22){logger[_0x4dbb('0x13')]('ShowSugarcrmAccount',_0x5cea22[_0x4dbb('0x15')],_0x33c44d);_0x2fdd96(_0x4f5f1a['error'](0x1f4,_0x5cea22[_0x4dbb('0x15')]));});});}; \ No newline at end of file +var _0x1a97=['request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSugarcrmAccount','findAll','options','include','map','model','attributes','catch','ShowSugarcrmAccount','SugarcrmAccount','find','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xfb7545,_0x56f4e3){var _0x3c3e76=function(_0x19c6ac){while(--_0x19c6ac){_0xfb7545['push'](_0xfb7545['shift']());}};_0x3c3e76(++_0x56f4e3);}(_0x1a97,0xf0));var _0x71a9=function(_0x4347ec,_0x41c4b8){_0x4347ec=_0x4347ec-0x0;var _0x4c8314=_0x1a97[_0x4347ec];return _0x4c8314;};'use strict';var _=require(_0x71a9('0x0'));var util=require(_0x71a9('0x1'));var moment=require('moment');var BPromise=require(_0x71a9('0x2'));var rs=require(_0x71a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x71a9('0x4'))['db'];var utils=require(_0x71a9('0x5'));var logger=require(_0x71a9('0x6'))(_0x71a9('0x7'));var config=require(_0x71a9('0x8'));var jayson=require(_0x71a9('0x9'));var client=jayson[_0x71a9('0xa')][_0x71a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8effb1,_0x19c151,_0x3c794a){return new BPromise(function(_0x34abb9,_0x350e19){return client[_0x71a9('0xc')](_0x8effb1,_0x3c794a)[_0x71a9('0xd')](function(_0x474e2f){logger[_0x71a9('0xe')](_0x71a9('0xf'),_0x19c151,_0x71a9('0x10'));logger[_0x71a9('0x11')](_0x71a9('0x12'),_0x19c151,_0x71a9('0x10'),JSON[_0x71a9('0x13')](_0x474e2f));if(_0x474e2f[_0x71a9('0x14')]){if(_0x474e2f['error'][_0x71a9('0x15')]===0x1f4){logger[_0x71a9('0x14')](_0x71a9('0xf'),_0x19c151,_0x474e2f[_0x71a9('0x14')][_0x71a9('0x16')]);return _0x350e19(_0x474e2f[_0x71a9('0x14')][_0x71a9('0x16')]);}logger[_0x71a9('0x14')](_0x71a9('0xf'),_0x19c151,_0x474e2f[_0x71a9('0x14')][_0x71a9('0x16')]);return _0x34abb9(_0x474e2f[_0x71a9('0x14')][_0x71a9('0x16')]);}else{logger[_0x71a9('0xe')](_0x71a9('0xf'),_0x19c151,_0x71a9('0x10'));_0x34abb9(_0x474e2f[_0x71a9('0x17')]['message']);}})['catch'](function(_0x37eade){logger[_0x71a9('0x14')](_0x71a9('0xf'),_0x19c151,_0x37eade);_0x350e19(_0x37eade);});});}exports[_0x71a9('0x18')]=function(_0x2617e5){var _0xfb408c=this;return new Promise(function(_0x221dff,_0x19db30){return db['SugarcrmAccount'][_0x71a9('0x19')]({'raw':_0x2617e5[_0x71a9('0x1a')]?_0x2617e5[_0x71a9('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2617e5[_0x71a9('0x1a')]?_0x2617e5[_0x71a9('0x1a')]['where']||null:null,'attributes':_0x2617e5[_0x71a9('0x1a')]?_0x2617e5[_0x71a9('0x1a')]['attributes']||null:null,'limit':_0x2617e5[_0x71a9('0x1a')]?_0x2617e5[_0x71a9('0x1a')]['limit']||null:null,'include':_0x2617e5[_0x71a9('0x1a')]?_0x2617e5[_0x71a9('0x1a')][_0x71a9('0x1b')]?_[_0x71a9('0x1c')](_0x2617e5['options'][_0x71a9('0x1b')],function(_0xf1a47e){return{'model':db[_0xf1a47e[_0x71a9('0x1d')]],'as':_0xf1a47e['as'],'attributes':_0xf1a47e[_0x71a9('0x1e')],'include':_0xf1a47e[_0x71a9('0x1b')]?_[_0x71a9('0x1c')](_0xf1a47e['include'],function(_0x3518fc){return{'model':db[_0x3518fc['model']],'as':_0x3518fc['as'],'attributes':_0x3518fc['attributes'],'include':_0x3518fc['include']?_[_0x71a9('0x1c')](_0x3518fc[_0x71a9('0x1b')],function(_0x3a65d2){return{'model':db[_0x3a65d2[_0x71a9('0x1d')]],'as':_0x3a65d2['as'],'attributes':_0x3a65d2[_0x71a9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x71a9('0xd')](function(_0x4c014b){logger['info']('GetSugarcrmAccount',_0x2617e5);logger[_0x71a9('0x11')](_0x71a9('0x18'),_0x2617e5,JSON['stringify'](_0x4c014b));_0x221dff(_0x4c014b);})[_0x71a9('0x1f')](function(_0x3be311){logger['error'](_0x71a9('0x18'),_0x3be311[_0x71a9('0x16')],_0x2617e5);_0x19db30(_0xfb408c['error'](0x1f4,_0x3be311[_0x71a9('0x16')]));});});};exports[_0x71a9('0x20')]=function(_0x4d1724){var _0x19ed70=this;return new Promise(function(_0xfe4a05,_0x3f3aeb){return db[_0x71a9('0x21')][_0x71a9('0x22')]({'raw':_0x4d1724['options']?_0x4d1724[_0x71a9('0x1a')][_0x71a9('0x23')]===undefined?!![]:![]:!![],'where':_0x4d1724[_0x71a9('0x1a')]?_0x4d1724[_0x71a9('0x1a')]['where']||null:null,'attributes':_0x4d1724[_0x71a9('0x1a')]?_0x4d1724[_0x71a9('0x1a')][_0x71a9('0x1e')]||null:null,'include':_0x4d1724[_0x71a9('0x1a')]?_0x4d1724['options'][_0x71a9('0x1b')]?_[_0x71a9('0x1c')](_0x4d1724[_0x71a9('0x1a')]['include'],function(_0x15679d){return{'model':db[_0x15679d['model']],'as':_0x15679d['as'],'attributes':_0x15679d[_0x71a9('0x1e')],'include':_0x15679d['include']?_[_0x71a9('0x1c')](_0x15679d[_0x71a9('0x1b')],function(_0x22bbb2){return{'model':db[_0x22bbb2['model']],'as':_0x22bbb2['as'],'attributes':_0x22bbb2[_0x71a9('0x1e')],'include':_0x22bbb2[_0x71a9('0x1b')]?_['map'](_0x22bbb2[_0x71a9('0x1b')],function(_0xfd762c){return{'model':db[_0xfd762c[_0x71a9('0x1d')]],'as':_0xfd762c['as'],'attributes':_0xfd762c[_0x71a9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x71a9('0xd')](function(_0x17bc4f){logger[_0x71a9('0xe')](_0x71a9('0x20'),_0x4d1724);logger[_0x71a9('0x11')]('ShowSugarcrmAccount',_0x4d1724,JSON['stringify'](_0x17bc4f));_0xfe4a05(_0x17bc4f);})[_0x71a9('0x1f')](function(_0x4554af){logger[_0x71a9('0x14')](_0x71a9('0x20'),_0x4554af[_0x71a9('0x16')],_0x4d1724);_0x3f3aeb(_0x19ed70[_0x71a9('0x14')](0x1f4,_0x4554af[_0x71a9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 9acddba..dd8ea4a 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 _0x7e3a=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','getSubjects','post','put','destroy','exports','multer','util'];(function(_0x3baf6e,_0x2263b9){var _0x251e16=function(_0x245a97){while(--_0x245a97){_0x3baf6e['push'](_0x3baf6e['shift']());}};_0x251e16(++_0x2263b9);}(_0x7e3a,0x152));var _0xa7e3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7e3a[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xa7e3('0x0'));var util=require(_0xa7e3('0x1'));var path=require(_0xa7e3('0x2'));var timeout=require(_0xa7e3('0x3'));var express=require('express');var router=express[_0xa7e3('0x4')]();var auth=require(_0xa7e3('0x5'));var interaction=require(_0xa7e3('0x6'));var config=require(_0xa7e3('0x7'));var controller=require(_0xa7e3('0x8'));router[_0xa7e3('0x9')]('/',auth[_0xa7e3('0xa')](),controller['index']);router['get'](_0xa7e3('0xb'),auth[_0xa7e3('0xa')](),controller[_0xa7e3('0xc')]);router[_0xa7e3('0x9')]('/:id/fields',auth[_0xa7e3('0xa')](),controller[_0xa7e3('0xd')]);router['get'](_0xa7e3('0xe'),auth['isAuthenticated'](),controller[_0xa7e3('0xf')]);router['get']('/:id/descriptions',auth[_0xa7e3('0xa')](),controller['getDescriptions']);router[_0xa7e3('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa7e3('0x11')](_0xa7e3('0xb'),auth[_0xa7e3('0xa')](),controller['update']);router['delete'](_0xa7e3('0xb'),auth[_0xa7e3('0xa')](),controller[_0xa7e3('0x12')]);module[_0xa7e3('0x13')]=router; \ No newline at end of file +var _0xc84d=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','delete','destroy','exports','util','connect-timeout','express'];(function(_0xfcb50b,_0x4c5d52){var _0x57276d=function(_0x351305){while(--_0x351305){_0xfcb50b['push'](_0xfcb50b['shift']());}};_0x57276d(++_0x4c5d52);}(_0xc84d,0x1b6));var _0xdc84=function(_0x88dae8,_0x4d5b49){_0x88dae8=_0x88dae8-0x0;var _0x313ad6=_0xc84d[_0x88dae8];return _0x313ad6;};'use strict';var multer=require('multer');var util=require(_0xdc84('0x0'));var path=require('path');var timeout=require(_0xdc84('0x1'));var express=require(_0xdc84('0x2'));var router=express[_0xdc84('0x3')]();var auth=require(_0xdc84('0x4'));var interaction=require(_0xdc84('0x5'));var config=require(_0xdc84('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xdc84('0x7')]('/',auth[_0xdc84('0x8')](),controller[_0xdc84('0x9')]);router['get'](_0xdc84('0xa'),auth[_0xdc84('0x8')](),controller[_0xdc84('0xb')]);router[_0xdc84('0x7')](_0xdc84('0xc'),auth[_0xdc84('0x8')](),controller['getFields']);router['get'](_0xdc84('0xd'),auth[_0xdc84('0x8')](),controller[_0xdc84('0xe')]);router[_0xdc84('0x7')](_0xdc84('0xf'),auth[_0xdc84('0x8')](),controller[_0xdc84('0x10')]);router[_0xdc84('0x11')]('/',auth[_0xdc84('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xdc84('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xdc84('0x13')]);module[_0xdc84('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 8058326..a1cbe61 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 _0x7f05=['exports','STRING','sequelize'];(function(_0x20eacd,_0x2394e2){var _0x57942a=function(_0xd86eda){while(--_0xd86eda){_0x20eacd['push'](_0x20eacd['shift']());}};_0x57942a(++_0x2394e2);}(_0x7f05,0x8c));var _0x57f0=function(_0x242747,_0x1e4c64){_0x242747=_0x242747-0x0;var _0x1127f9=_0x7f05[_0x242747];return _0x1127f9;};'use strict';var Sequelize=require(_0x57f0('0x0'));module[_0x57f0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x57f0('0x2')]}}; \ No newline at end of file +var _0x4922=['sequelize','exports','STRING'];(function(_0x5e3e92,_0x35723f){var _0x1ea582=function(_0x5eb2b0){while(--_0x5eb2b0){_0x5e3e92['push'](_0x5e3e92['shift']());}};_0x1ea582(++_0x35723f);}(_0x4922,0xa2));var _0x2492=function(_0xd8ed58,_0x553238){_0xd8ed58=_0xd8ed58-0x0;var _0x36352b=_0x4922[_0xd8ed58];return _0x36352b;};'use strict';var Sequelize=require(_0x2492('0x0'));module[_0x2492('0x1')]={'name':{'type':Sequelize[_0x2492('0x2')]},'description':{'type':Sequelize[_0x2492('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index f0b604a..2b9cefb 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 _0x1d97=['VIRTUAL','merge','options','include','findAll','rows','show','params','includeAll','find','create','body','destroy','findOne','SugarcrmField','order','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','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','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d97,0xd1));var _0x71d9=function(_0x4d9831,_0x1d97ec){_0x4d9831=_0x4d9831-0x0;var _0x534596=_0x1d97[_0x4d9831];return _0x534596;};'use strict';var pdf=require(_0x71d9('0x0'));var emlformat=require(_0x71d9('0x1'));var rimraf=require(_0x71d9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x71d9('0x3'));var Mustache=require(_0x71d9('0x4'));var util=require(_0x71d9('0x5'));var path=require(_0x71d9('0x6'));var sox=require(_0x71d9('0x7'));var csv=require(_0x71d9('0x8'));var ejs=require(_0x71d9('0x9'));var fs=require('fs');var _=require(_0x71d9('0xa'));var squel=require(_0x71d9('0xb'));var crypto=require(_0x71d9('0xc'));var jsforce=require(_0x71d9('0xd'));var deskjs=require(_0x71d9('0xe'));var toCsv=require(_0x71d9('0x8'));var querystring=require(_0x71d9('0xf'));var Papa=require('papaparse');var Redis=require(_0x71d9('0x10'));var authService=require(_0x71d9('0x11'));var qs=require(_0x71d9('0x12'));var as=require(_0x71d9('0x13'));var hardwareService=require(_0x71d9('0x14'));var logger=require('../../config/logger')(_0x71d9('0x15'));var utils=require(_0x71d9('0x16'));var config=require(_0x71d9('0x17'));var licenseUtil=require(_0x71d9('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x71d9('0x19'));var client=jayson['client'][_0x71d9('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x25ee59,_0x5d6119,_0x42b3b1,_0x60cb50){return new BPromise(function(_0x464306,_0x38ff60){var _0x43b1dd=_0x60cb50||client;return _0x43b1dd[_0x71d9('0x1b')](_0x25ee59,_0x42b3b1)[_0x71d9('0x1c')](function(_0x14dc25){logger['info'](_0x71d9('0x1d'),_0x5d6119,_0x71d9('0x1e'));logger[_0x71d9('0x1f')](_0x71d9('0x20'),_0x5d6119,'request\x20sent',JSON[_0x71d9('0x21')](_0x14dc25));if(_0x14dc25['error']){if(_0x14dc25[_0x71d9('0x22')][_0x71d9('0x23')]===0x1f4){logger[_0x71d9('0x22')](_0x71d9('0x1d'),_0x5d6119,_0x14dc25[_0x71d9('0x22')][_0x71d9('0x24')]);return _0x38ff60(_0x14dc25[_0x71d9('0x22')]['message']);}logger[_0x71d9('0x22')](_0x71d9('0x1d'),_0x5d6119,_0x14dc25[_0x71d9('0x22')][_0x71d9('0x24')]);return _0x464306(_0x14dc25['error'][_0x71d9('0x24')]);}else{logger[_0x71d9('0x25')](_0x71d9('0x1d'),_0x5d6119,_0x71d9('0x1e'));_0x464306(_0x14dc25[_0x71d9('0x26')]['message']);}})[_0x71d9('0x27')](function(_0x1bd0bb){logger[_0x71d9('0x22')](_0x71d9('0x1d'),_0x5d6119,_0x1bd0bb);_0x38ff60(_0x1bd0bb);});});}function respondWithStatusCode(_0x52c0e2,_0x4d3656){_0x4d3656=_0x4d3656||0xcc;return function(_0x3dd771){if(_0x3dd771){return _0x52c0e2[_0x71d9('0x28')](_0x4d3656);}return _0x52c0e2[_0x71d9('0x29')](_0x4d3656)[_0x71d9('0x2a')]();};}function respondWithResult(_0xe87b92,_0x372ed1){_0x372ed1=_0x372ed1||0xc8;return function(_0x1e44d7){if(_0x1e44d7){return _0xe87b92['status'](_0x372ed1)[_0x71d9('0x2b')](_0x1e44d7);}};}function respondWithFilteredResult(_0x20ac35,_0x43ca5b){return function(_0x4f4d48){if(_0x4f4d48){var _0x311340=_0x4f4d48[_0x71d9('0x2c')],_0x5cf0ea=_0x43ca5b[_0x71d9('0x2d')],_0x121342=_0x43ca5b[_0x71d9('0x2d')]+_0x43ca5b['limit'],_0x4cc7df;if(_0x121342>=_0x311340){_0x121342=_0x311340;_0x4cc7df=0xc8;}else{_0x4cc7df=0xce;}_0x20ac35[_0x71d9('0x29')](_0x4cc7df);return _0x20ac35['set'](_0x71d9('0x2e'),_0x5cf0ea+'-'+_0x121342+'/'+_0x311340)[_0x71d9('0x2b')](_0x4f4d48);}return null;};}function patchUpdates(_0x1b4c52){return function(_0x455397){try{jsonpatch[_0x71d9('0x2f')](_0x455397,_0x1b4c52,!![]);}catch(_0x4d60cc){return BPromise[_0x71d9('0x30')](_0x4d60cc);}return _0x455397[_0x71d9('0x31')]();};}function saveUpdates(_0x1a9fab,_0x15ea5a){return function(_0x323136){if(_0x323136){return _0x323136[_0x71d9('0x32')](_0x1a9fab)[_0x71d9('0x1c')](function(_0x5559de){return _0x5559de;});}return null;};}function removeEntity(_0x2b172e,_0x39eb53){return function(_0x42f612){if(_0x42f612){return _0x42f612['destroy']()['then'](function(){_0x2b172e[_0x71d9('0x29')](0xcc)[_0x71d9('0x2a')]();});}};}function handleEntityNotFound(_0x2f7395,_0x1a057d){return function(_0x26e7d2){if(!_0x26e7d2){_0x2f7395['sendStatus'](0x194);}return _0x26e7d2;};}function handleError(_0xc400ae,_0x12d98a){_0x12d98a=_0x12d98a||0x1f4;return function(_0x32d0d8){logger[_0x71d9('0x22')](_0x32d0d8[_0x71d9('0x33')]);if(_0x32d0d8[_0x71d9('0x34')]){delete _0x32d0d8['name'];}_0xc400ae[_0x71d9('0x29')](_0x12d98a)[_0x71d9('0x35')](_0x32d0d8);};}exports[_0x71d9('0x36')]=function(_0x23b89b,_0x1693bd){var _0x1867ea={},_0x4751d4={},_0x186569={'count':0x0,'rows':[]};var _0x57fca0=_[_0x71d9('0x37')](db[_0x71d9('0x38')][_0x71d9('0x39')],function(_0x42004a){return{'name':_0x42004a[_0x71d9('0x3a')],'type':_0x42004a['type'][_0x71d9('0x3b')]};});_0x4751d4[_0x71d9('0x3c')]=_[_0x71d9('0x37')](_0x57fca0,'name');_0x4751d4['query']=_[_0x71d9('0x3d')](_0x23b89b['query']);_0x4751d4[_0x71d9('0x3e')]=_[_0x71d9('0x3f')](_0x4751d4['model'],_0x4751d4[_0x71d9('0x40')]);_0x1867ea[_0x71d9('0x41')]=_[_0x71d9('0x3f')](_0x4751d4[_0x71d9('0x3c')],qs['fields'](_0x23b89b[_0x71d9('0x40')][_0x71d9('0x42')]));_0x1867ea[_0x71d9('0x41')]=_0x1867ea[_0x71d9('0x41')][_0x71d9('0x43')]?_0x1867ea[_0x71d9('0x41')]:_0x4751d4[_0x71d9('0x3c')];if(!_0x23b89b['query'][_0x71d9('0x44')](_0x71d9('0x45'))){_0x1867ea['limit']=qs['limit'](_0x23b89b[_0x71d9('0x40')][_0x71d9('0x46')]);_0x1867ea[_0x71d9('0x2d')]=qs['offset'](_0x23b89b[_0x71d9('0x40')]['offset']);}_0x1867ea['order']=qs['sort'](_0x23b89b[_0x71d9('0x40')][_0x71d9('0x47')]);_0x1867ea[_0x71d9('0x48')]=qs[_0x71d9('0x3e')](_[_0x71d9('0x49')](_0x23b89b[_0x71d9('0x40')],_0x4751d4[_0x71d9('0x3e')]),_0x57fca0);if(_0x23b89b['query'][_0x71d9('0x4a')]){_0x1867ea[_0x71d9('0x48')]=_['merge'](_0x1867ea[_0x71d9('0x48')],{'$or':_[_0x71d9('0x37')](_0x57fca0,function(_0x3f5866){if(_0x3f5866[_0x71d9('0x4b')]!==_0x71d9('0x4c')){var _0x31d262={};_0x31d262[_0x3f5866['name']]={'$like':'%'+_0x23b89b[_0x71d9('0x40')][_0x71d9('0x4a')]+'%'};return _0x31d262;}})});}_0x1867ea=_[_0x71d9('0x4d')]({},_0x1867ea,_0x23b89b[_0x71d9('0x4e')]);var _0x53b0c0={'where':_0x1867ea[_0x71d9('0x48')]};return db['SugarcrmConfiguration'][_0x71d9('0x2c')](_0x53b0c0)['then'](function(_0x59a2b2){_0x186569[_0x71d9('0x2c')]=_0x59a2b2;if(_0x23b89b[_0x71d9('0x40')]['includeAll']){_0x1867ea[_0x71d9('0x4f')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x71d9('0x50')](_0x1867ea);})[_0x71d9('0x1c')](function(_0x1d7eac){_0x186569[_0x71d9('0x51')]=_0x1d7eac;return _0x186569;})[_0x71d9('0x1c')](respondWithFilteredResult(_0x1693bd,_0x1867ea))['catch'](handleError(_0x1693bd,null));};exports[_0x71d9('0x52')]=function(_0x4434d8,_0x56d55f){var _0x98d33c={'raw':![],'where':{'id':_0x4434d8[_0x71d9('0x53')]['id']}},_0x147c5e={};_0x147c5e[_0x71d9('0x3c')]=_[_0x71d9('0x3d')](db['SugarcrmConfiguration'][_0x71d9('0x39')]);_0x147c5e[_0x71d9('0x40')]=_[_0x71d9('0x3d')](_0x4434d8['query']);_0x147c5e['filters']=_[_0x71d9('0x3f')](_0x147c5e[_0x71d9('0x3c')],_0x147c5e['query']);_0x98d33c['attributes']=_[_0x71d9('0x3f')](_0x147c5e[_0x71d9('0x3c')],qs[_0x71d9('0x42')](_0x4434d8['query'][_0x71d9('0x42')]));_0x98d33c[_0x71d9('0x41')]=_0x98d33c[_0x71d9('0x41')][_0x71d9('0x43')]?_0x98d33c[_0x71d9('0x41')]:_0x147c5e[_0x71d9('0x3c')];if(_0x4434d8[_0x71d9('0x40')][_0x71d9('0x54')]){_0x98d33c[_0x71d9('0x4f')]=[{'all':!![]}];}_0x98d33c=_[_0x71d9('0x4d')]({},_0x98d33c,_0x4434d8[_0x71d9('0x4e')]);return db[_0x71d9('0x38')][_0x71d9('0x55')](_0x98d33c)[_0x71d9('0x1c')](handleEntityNotFound(_0x56d55f,null))[_0x71d9('0x1c')](respondWithResult(_0x56d55f,null))['catch'](handleError(_0x56d55f,null));};exports[_0x71d9('0x56')]=function(_0x40b5b8,_0x24c013){return db[_0x71d9('0x38')][_0x71d9('0x56')](_0x40b5b8[_0x71d9('0x57')],{})[_0x71d9('0x1c')](respondWithResult(_0x24c013,0xc9))[_0x71d9('0x27')](handleError(_0x24c013,null));};exports[_0x71d9('0x32')]=function(_0x5ad512,_0x3360de){if(_0x5ad512[_0x71d9('0x57')]['id']){delete _0x5ad512[_0x71d9('0x57')]['id'];}return db[_0x71d9('0x38')][_0x71d9('0x55')]({'where':{'id':_0x5ad512[_0x71d9('0x53')]['id']}})['then'](handleEntityNotFound(_0x3360de,null))['then'](saveUpdates(_0x5ad512[_0x71d9('0x57')],null))[_0x71d9('0x1c')](respondWithResult(_0x3360de,null))[_0x71d9('0x27')](handleError(_0x3360de,null));};exports[_0x71d9('0x58')]=function(_0x3d06eb,_0x2b9b8b){return db['SugarcrmConfiguration'][_0x71d9('0x55')]({'where':{'id':_0x3d06eb[_0x71d9('0x53')]['id']}})[_0x71d9('0x1c')](handleEntityNotFound(_0x2b9b8b,null))[_0x71d9('0x1c')](removeEntity(_0x2b9b8b,null))[_0x71d9('0x27')](handleError(_0x2b9b8b,null));};exports['getFields']=function(_0x514fd4,_0x39eccc,_0x35cdf6){var _0x397228={};var _0xf9055d={};var _0x3189cc;var _0x1a7c86;return db[_0x71d9('0x38')][_0x71d9('0x59')]({'where':{'id':_0x514fd4['params']['id']}})[_0x71d9('0x1c')](handleEntityNotFound(_0x39eccc,null))[_0x71d9('0x1c')](function(_0x57ce75){if(_0x57ce75){_0x3189cc=_0x57ce75;_0xf9055d[_0x71d9('0x3c')]=_[_0x71d9('0x3d')](db[_0x71d9('0x5a')][_0x71d9('0x39')]);_0xf9055d[_0x71d9('0x40')]=_[_0x71d9('0x3d')](_0x514fd4[_0x71d9('0x40')]);_0xf9055d[_0x71d9('0x3e')]=_[_0x71d9('0x3f')](_0xf9055d['model'],_0xf9055d[_0x71d9('0x40')]);_0x397228[_0x71d9('0x41')]=_[_0x71d9('0x3f')](_0xf9055d['model'],qs[_0x71d9('0x42')](_0x514fd4['query'][_0x71d9('0x42')]));_0x397228[_0x71d9('0x41')]=_0x397228[_0x71d9('0x41')][_0x71d9('0x43')]?_0x397228[_0x71d9('0x41')]:_0xf9055d[_0x71d9('0x3c')];_0x397228[_0x71d9('0x5b')]=qs[_0x71d9('0x47')](_0x514fd4['query'][_0x71d9('0x47')]);_0x397228['where']=qs['filters'](_[_0x71d9('0x49')](_0x514fd4['query'],_0xf9055d[_0x71d9('0x3e')]));if(_0x514fd4[_0x71d9('0x40')][_0x71d9('0x4a')]){_0x397228[_0x71d9('0x48')]=_['merge'](_0x397228[_0x71d9('0x48')],{'$or':_[_0x71d9('0x37')](_0x397228[_0x71d9('0x41')],function(_0x46d379){var _0x5b4584={};_0x5b4584[_0x46d379]={'$like':'%'+_0x514fd4[_0x71d9('0x40')]['filter']+'%'};return _0x5b4584;})});}_0x397228=_['merge']({},_0x397228,_0x514fd4[_0x71d9('0x4e')]);return _0x3189cc['getFields'](_0x397228);}})[_0x71d9('0x1c')](function(_0x514a7d){if(_0x514a7d){_0x1a7c86=_0x514a7d[_0x71d9('0x43')];if(!_0x514fd4[_0x71d9('0x40')][_0x71d9('0x44')]('nolimit')){_0x397228[_0x71d9('0x46')]=qs['limit'](_0x514fd4[_0x71d9('0x40')][_0x71d9('0x46')]);_0x397228[_0x71d9('0x2d')]=qs[_0x71d9('0x2d')](_0x514fd4[_0x71d9('0x40')][_0x71d9('0x2d')]);}return _0x3189cc[_0x71d9('0x5c')](_0x397228);}})[_0x71d9('0x1c')](function(_0x1ffe2b){if(_0x1ffe2b){return _0x1ffe2b?{'count':_0x1a7c86,'rows':_0x1ffe2b}:null;}})[_0x71d9('0x1c')](respondWithResult(_0x39eccc,null))[_0x71d9('0x27')](handleError(_0x39eccc,null));};exports[_0x71d9('0x5d')]=function(_0x337973,_0x7db813,_0x5bc6e4){var _0x3b45e8={};var _0x4a6853={};var _0x2b8412;var _0x1aedac;return db[_0x71d9('0x38')][_0x71d9('0x59')]({'where':{'id':_0x337973['params']['id']}})['then'](handleEntityNotFound(_0x7db813,null))['then'](function(_0x61f5c9){if(_0x61f5c9){_0x2b8412=_0x61f5c9;_0x4a6853[_0x71d9('0x3c')]=_[_0x71d9('0x3d')](db[_0x71d9('0x5a')]['rawAttributes']);_0x4a6853[_0x71d9('0x40')]=_[_0x71d9('0x3d')](_0x337973[_0x71d9('0x40')]);_0x4a6853[_0x71d9('0x3e')]=_[_0x71d9('0x3f')](_0x4a6853[_0x71d9('0x3c')],_0x4a6853['query']);_0x3b45e8['attributes']=_['intersection'](_0x4a6853['model'],qs[_0x71d9('0x42')](_0x337973[_0x71d9('0x40')][_0x71d9('0x42')]));_0x3b45e8[_0x71d9('0x41')]=_0x3b45e8[_0x71d9('0x41')][_0x71d9('0x43')]?_0x3b45e8[_0x71d9('0x41')]:_0x4a6853[_0x71d9('0x3c')];_0x3b45e8[_0x71d9('0x5b')]=qs[_0x71d9('0x47')](_0x337973[_0x71d9('0x40')][_0x71d9('0x47')]);_0x3b45e8['where']=qs['filters'](_[_0x71d9('0x49')](_0x337973[_0x71d9('0x40')],_0x4a6853['filters']));if(_0x337973['query'][_0x71d9('0x4a')]){_0x3b45e8[_0x71d9('0x48')]=_[_0x71d9('0x4d')](_0x3b45e8[_0x71d9('0x48')],{'$or':_[_0x71d9('0x37')](_0x3b45e8['attributes'],function(_0x525deb){var _0x3faae3={};_0x3faae3[_0x525deb]={'$like':'%'+_0x337973[_0x71d9('0x40')][_0x71d9('0x4a')]+'%'};return _0x3faae3;})});}_0x3b45e8=_[_0x71d9('0x4d')]({},_0x3b45e8,_0x337973['options']);return _0x2b8412[_0x71d9('0x5d')](_0x3b45e8);}})['then'](function(_0x40d7a9){if(_0x40d7a9){_0x1aedac=_0x40d7a9['length'];if(!_0x337973[_0x71d9('0x40')][_0x71d9('0x44')](_0x71d9('0x45'))){_0x3b45e8[_0x71d9('0x46')]=qs['limit'](_0x337973['query'][_0x71d9('0x46')]);_0x3b45e8[_0x71d9('0x2d')]=qs[_0x71d9('0x2d')](_0x337973[_0x71d9('0x40')][_0x71d9('0x2d')]);}return _0x2b8412['getSubjects'](_0x3b45e8);}})[_0x71d9('0x1c')](function(_0x4122bb){if(_0x4122bb){return _0x4122bb?{'count':_0x1aedac,'rows':_0x4122bb}:null;}})[_0x71d9('0x1c')](respondWithResult(_0x7db813,null))[_0x71d9('0x27')](handleError(_0x7db813,null));};exports[_0x71d9('0x5e')]=function(_0x1b4de3,_0x373e3b,_0xe9b314){var _0x19cd3d={};var _0xe8b1a7={};var _0x57de18;var _0x12491a;return db[_0x71d9('0x38')]['findOne']({'where':{'id':_0x1b4de3['params']['id']}})[_0x71d9('0x1c')](handleEntityNotFound(_0x373e3b,null))[_0x71d9('0x1c')](function(_0x1ab4f0){if(_0x1ab4f0){_0x57de18=_0x1ab4f0;_0xe8b1a7[_0x71d9('0x3c')]=_[_0x71d9('0x3d')](db['SugarcrmField'][_0x71d9('0x39')]);_0xe8b1a7[_0x71d9('0x40')]=_[_0x71d9('0x3d')](_0x1b4de3['query']);_0xe8b1a7['filters']=_[_0x71d9('0x3f')](_0xe8b1a7[_0x71d9('0x3c')],_0xe8b1a7[_0x71d9('0x40')]);_0x19cd3d[_0x71d9('0x41')]=_['intersection'](_0xe8b1a7[_0x71d9('0x3c')],qs[_0x71d9('0x42')](_0x1b4de3['query'][_0x71d9('0x42')]));_0x19cd3d[_0x71d9('0x41')]=_0x19cd3d[_0x71d9('0x41')][_0x71d9('0x43')]?_0x19cd3d[_0x71d9('0x41')]:_0xe8b1a7['model'];_0x19cd3d[_0x71d9('0x5b')]=qs['sort'](_0x1b4de3[_0x71d9('0x40')][_0x71d9('0x47')]);_0x19cd3d['where']=qs[_0x71d9('0x3e')](_['pick'](_0x1b4de3['query'],_0xe8b1a7[_0x71d9('0x3e')]));if(_0x1b4de3[_0x71d9('0x40')]['filter']){_0x19cd3d[_0x71d9('0x48')]=_[_0x71d9('0x4d')](_0x19cd3d['where'],{'$or':_[_0x71d9('0x37')](_0x19cd3d[_0x71d9('0x41')],function(_0x389df2){var _0x111b63={};_0x111b63[_0x389df2]={'$like':'%'+_0x1b4de3['query'][_0x71d9('0x4a')]+'%'};return _0x111b63;})});}_0x19cd3d=_['merge']({},_0x19cd3d,_0x1b4de3['options']);return _0x57de18['getDescriptions'](_0x19cd3d);}})[_0x71d9('0x1c')](function(_0x38a4bf){if(_0x38a4bf){_0x12491a=_0x38a4bf['length'];if(!_0x1b4de3[_0x71d9('0x40')][_0x71d9('0x44')](_0x71d9('0x45'))){_0x19cd3d[_0x71d9('0x46')]=qs[_0x71d9('0x46')](_0x1b4de3[_0x71d9('0x40')]['limit']);_0x19cd3d['offset']=qs['offset'](_0x1b4de3[_0x71d9('0x40')][_0x71d9('0x2d')]);}return _0x57de18[_0x71d9('0x5e')](_0x19cd3d);}})[_0x71d9('0x1c')](function(_0x1510d1){if(_0x1510d1){return _0x1510d1?{'count':_0x12491a,'rows':_0x1510d1}:null;}})[_0x71d9('0x1c')](respondWithResult(_0x373e3b,null))[_0x71d9('0x27')](handleError(_0x373e3b,null));}; \ No newline at end of file +var _0xe145=['SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','SugarcrmConfiguration','rawAttributes','fieldName','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','getFields','SugarcrmField','getSubjects','findOne','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info'];(function(_0x1ba380,_0x33b8a3){var _0x16b4e2=function(_0x5df8a7){while(--_0x5df8a7){_0x1ba380['push'](_0x1ba380['shift']());}};_0x16b4e2(++_0x33b8a3);}(_0xe145,0x1aa));var _0x5e14=function(_0x3fafcd,_0x591560){_0x3fafcd=_0x3fafcd-0x0;var _0x3e7adc=_0xe145[_0x3fafcd];return _0x3e7adc;};'use strict';var pdf=require(_0x5e14('0x0'));var emlformat=require(_0x5e14('0x1'));var rimraf=require(_0x5e14('0x2'));var zipdir=require(_0x5e14('0x3'));var jsonpatch=require(_0x5e14('0x4'));var rp=require('request-promise');var moment=require(_0x5e14('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5e14('0x6'));var util=require(_0x5e14('0x7'));var path=require(_0x5e14('0x8'));var sox=require(_0x5e14('0x9'));var csv=require(_0x5e14('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5e14('0xb'));var squel=require(_0x5e14('0xc'));var crypto=require(_0x5e14('0xd'));var jsforce=require(_0x5e14('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5e14('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5e14('0xf'));var authService=require(_0x5e14('0x10'));var qs=require(_0x5e14('0x11'));var as=require(_0x5e14('0x12'));var hardwareService=require(_0x5e14('0x13'));var logger=require(_0x5e14('0x14'))(_0x5e14('0x15'));var utils=require('../../config/utils');var config=require(_0x5e14('0x16'));var licenseUtil=require(_0x5e14('0x17'));var db=require(_0x5e14('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x5e14('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5c4f0a,_0x5d5ae9,_0xca3f5c,_0x2282ce){return new BPromise(function(_0x4e08ee,_0x46035b){var _0x3251a7=_0x2282ce||client;return _0x3251a7[_0x5e14('0x1a')](_0x5c4f0a,_0xca3f5c)[_0x5e14('0x1b')](function(_0x2013c5){logger[_0x5e14('0x1c')](_0x5e14('0x1d'),_0x5d5ae9,_0x5e14('0x1e'));logger['debug'](_0x5e14('0x1f'),_0x5d5ae9,_0x5e14('0x1e'),JSON['stringify'](_0x2013c5));if(_0x2013c5['error']){if(_0x2013c5[_0x5e14('0x20')][_0x5e14('0x21')]===0x1f4){logger[_0x5e14('0x20')](_0x5e14('0x1d'),_0x5d5ae9,_0x2013c5[_0x5e14('0x20')][_0x5e14('0x22')]);return _0x46035b(_0x2013c5[_0x5e14('0x20')][_0x5e14('0x22')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x5d5ae9,_0x2013c5[_0x5e14('0x20')][_0x5e14('0x22')]);return _0x4e08ee(_0x2013c5[_0x5e14('0x20')][_0x5e14('0x22')]);}else{logger[_0x5e14('0x1c')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5d5ae9,_0x5e14('0x1e'));_0x4e08ee(_0x2013c5[_0x5e14('0x23')][_0x5e14('0x22')]);}})[_0x5e14('0x24')](function(_0x53262b){logger[_0x5e14('0x20')](_0x5e14('0x1d'),_0x5d5ae9,_0x53262b);_0x46035b(_0x53262b);});});}function respondWithStatusCode(_0x27c8dc,_0xce49de){_0xce49de=_0xce49de||0xcc;return function(_0x1c4231){if(_0x1c4231){return _0x27c8dc[_0x5e14('0x25')](_0xce49de);}return _0x27c8dc[_0x5e14('0x26')](_0xce49de)['end']();};}function respondWithResult(_0x52e157,_0x26bd9a){_0x26bd9a=_0x26bd9a||0xc8;return function(_0x8b5aba){if(_0x8b5aba){return _0x52e157[_0x5e14('0x26')](_0x26bd9a)[_0x5e14('0x27')](_0x8b5aba);}};}function respondWithFilteredResult(_0x4b96e4,_0x5e1f7f){return function(_0x403847){if(_0x403847){var _0x1c5d89=_0x403847[_0x5e14('0x28')],_0x52d6b7=_0x5e1f7f['offset'],_0x90f472=_0x5e1f7f[_0x5e14('0x29')]+_0x5e1f7f[_0x5e14('0x2a')],_0x22fd99;if(_0x90f472>=_0x1c5d89){_0x90f472=_0x1c5d89;_0x22fd99=0xc8;}else{_0x22fd99=0xce;}_0x4b96e4['status'](_0x22fd99);return _0x4b96e4['set'](_0x5e14('0x2b'),_0x52d6b7+'-'+_0x90f472+'/'+_0x1c5d89)['json'](_0x403847);}return null;};}function patchUpdates(_0x2805e1){return function(_0x268d39){try{jsonpatch[_0x5e14('0x2c')](_0x268d39,_0x2805e1,!![]);}catch(_0x1ff2ec){return BPromise[_0x5e14('0x2d')](_0x1ff2ec);}return _0x268d39[_0x5e14('0x2e')]();};}function saveUpdates(_0x4617e5,_0x2afdea){return function(_0x207677){if(_0x207677){return _0x207677[_0x5e14('0x2f')](_0x4617e5)[_0x5e14('0x1b')](function(_0x1d65f4){return _0x1d65f4;});}return null;};}function removeEntity(_0x1e7f6a,_0x3835ab){return function(_0x2cc318){if(_0x2cc318){return _0x2cc318[_0x5e14('0x30')]()[_0x5e14('0x1b')](function(){_0x1e7f6a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46b895,_0x2d8399){return function(_0x20448e){if(!_0x20448e){_0x46b895[_0x5e14('0x25')](0x194);}return _0x20448e;};}function handleError(_0x7f8ac9,_0x163a66){_0x163a66=_0x163a66||0x1f4;return function(_0x5a25a3){logger[_0x5e14('0x20')](_0x5a25a3[_0x5e14('0x31')]);if(_0x5a25a3[_0x5e14('0x32')]){delete _0x5a25a3[_0x5e14('0x32')];}_0x7f8ac9[_0x5e14('0x26')](_0x163a66)[_0x5e14('0x33')](_0x5a25a3);};}exports[_0x5e14('0x34')]=function(_0x32d356,_0x45b4ca){var _0xcfefc3={},_0xbf6bf0={},_0x50d8a7={'count':0x0,'rows':[]};var _0x50efa3=_['map'](db[_0x5e14('0x35')][_0x5e14('0x36')],function(_0x473878){return{'name':_0x473878[_0x5e14('0x37')],'type':_0x473878['type'][_0x5e14('0x38')]};});_0xbf6bf0[_0x5e14('0x39')]=_[_0x5e14('0x3a')](_0x50efa3,'name');_0xbf6bf0[_0x5e14('0x3b')]=_['keys'](_0x32d356[_0x5e14('0x3b')]);_0xbf6bf0['filters']=_['intersection'](_0xbf6bf0[_0x5e14('0x39')],_0xbf6bf0['query']);_0xcfefc3['attributes']=_[_0x5e14('0x3c')](_0xbf6bf0[_0x5e14('0x39')],qs[_0x5e14('0x3d')](_0x32d356[_0x5e14('0x3b')][_0x5e14('0x3d')]));_0xcfefc3[_0x5e14('0x3e')]=_0xcfefc3[_0x5e14('0x3e')][_0x5e14('0x3f')]?_0xcfefc3['attributes']:_0xbf6bf0['model'];if(!_0x32d356['query'][_0x5e14('0x40')](_0x5e14('0x41'))){_0xcfefc3[_0x5e14('0x2a')]=qs['limit'](_0x32d356['query'][_0x5e14('0x2a')]);_0xcfefc3[_0x5e14('0x29')]=qs[_0x5e14('0x29')](_0x32d356[_0x5e14('0x3b')][_0x5e14('0x29')]);}_0xcfefc3[_0x5e14('0x42')]=qs[_0x5e14('0x43')](_0x32d356[_0x5e14('0x3b')][_0x5e14('0x43')]);_0xcfefc3['where']=qs[_0x5e14('0x44')](_[_0x5e14('0x45')](_0x32d356[_0x5e14('0x3b')],_0xbf6bf0[_0x5e14('0x44')]),_0x50efa3);if(_0x32d356[_0x5e14('0x3b')][_0x5e14('0x46')]){_0xcfefc3[_0x5e14('0x47')]=_[_0x5e14('0x48')](_0xcfefc3[_0x5e14('0x47')],{'$or':_[_0x5e14('0x3a')](_0x50efa3,function(_0x1257ae){if(_0x1257ae[_0x5e14('0x49')]!==_0x5e14('0x4a')){var _0x2a9f78={};_0x2a9f78[_0x1257ae[_0x5e14('0x32')]]={'$like':'%'+_0x32d356[_0x5e14('0x3b')]['filter']+'%'};return _0x2a9f78;}})});}_0xcfefc3=_[_0x5e14('0x48')]({},_0xcfefc3,_0x32d356[_0x5e14('0x4b')]);var _0x40da1c={'where':_0xcfefc3[_0x5e14('0x47')]};return db['SugarcrmConfiguration'][_0x5e14('0x28')](_0x40da1c)['then'](function(_0x7ff9d8){_0x50d8a7[_0x5e14('0x28')]=_0x7ff9d8;if(_0x32d356[_0x5e14('0x3b')][_0x5e14('0x4c')]){_0xcfefc3[_0x5e14('0x4d')]=[{'all':!![]}];}return db[_0x5e14('0x35')][_0x5e14('0x4e')](_0xcfefc3);})[_0x5e14('0x1b')](function(_0x131401){_0x50d8a7[_0x5e14('0x4f')]=_0x131401;return _0x50d8a7;})[_0x5e14('0x1b')](respondWithFilteredResult(_0x45b4ca,_0xcfefc3))['catch'](handleError(_0x45b4ca,null));};exports[_0x5e14('0x50')]=function(_0x4b476a,_0x36e679){var _0x2a7050={'raw':![],'where':{'id':_0x4b476a[_0x5e14('0x51')]['id']}},_0x1b4b8c={};_0x1b4b8c['model']=_['keys'](db[_0x5e14('0x35')][_0x5e14('0x36')]);_0x1b4b8c[_0x5e14('0x3b')]=_[_0x5e14('0x52')](_0x4b476a['query']);_0x1b4b8c[_0x5e14('0x44')]=_['intersection'](_0x1b4b8c['model'],_0x1b4b8c[_0x5e14('0x3b')]);_0x2a7050[_0x5e14('0x3e')]=_[_0x5e14('0x3c')](_0x1b4b8c[_0x5e14('0x39')],qs['fields'](_0x4b476a[_0x5e14('0x3b')]['fields']));_0x2a7050[_0x5e14('0x3e')]=_0x2a7050[_0x5e14('0x3e')]['length']?_0x2a7050['attributes']:_0x1b4b8c[_0x5e14('0x39')];if(_0x4b476a['query']['includeAll']){_0x2a7050[_0x5e14('0x4d')]=[{'all':!![]}];}_0x2a7050=_[_0x5e14('0x48')]({},_0x2a7050,_0x4b476a[_0x5e14('0x4b')]);return db[_0x5e14('0x35')][_0x5e14('0x53')](_0x2a7050)[_0x5e14('0x1b')](handleEntityNotFound(_0x36e679,null))[_0x5e14('0x1b')](respondWithResult(_0x36e679,null))[_0x5e14('0x24')](handleError(_0x36e679,null));};exports[_0x5e14('0x54')]=function(_0x4491a6,_0x5db452){return db[_0x5e14('0x35')][_0x5e14('0x54')](_0x4491a6[_0x5e14('0x55')],{})[_0x5e14('0x1b')](respondWithResult(_0x5db452,0xc9))[_0x5e14('0x24')](handleError(_0x5db452,null));};exports[_0x5e14('0x2f')]=function(_0xad3882,_0x54c580){if(_0xad3882[_0x5e14('0x55')]['id']){delete _0xad3882[_0x5e14('0x55')]['id'];}return db[_0x5e14('0x35')][_0x5e14('0x53')]({'where':{'id':_0xad3882[_0x5e14('0x51')]['id']}})[_0x5e14('0x1b')](handleEntityNotFound(_0x54c580,null))['then'](saveUpdates(_0xad3882[_0x5e14('0x55')],null))[_0x5e14('0x1b')](respondWithResult(_0x54c580,null))[_0x5e14('0x24')](handleError(_0x54c580,null));};exports[_0x5e14('0x30')]=function(_0x5c3cca,_0x1f3259){return db['SugarcrmConfiguration'][_0x5e14('0x53')]({'where':{'id':_0x5c3cca[_0x5e14('0x51')]['id']}})[_0x5e14('0x1b')](handleEntityNotFound(_0x1f3259,null))[_0x5e14('0x1b')](removeEntity(_0x1f3259,null))['catch'](handleError(_0x1f3259,null));};exports[_0x5e14('0x56')]=function(_0x4fd9df,_0x212280,_0x3fb5ab){var _0xc782e={};var _0x2d3da4={};var _0x2f3be2;var _0x4d1349;return db[_0x5e14('0x35')]['findOne']({'where':{'id':_0x4fd9df[_0x5e14('0x51')]['id']}})['then'](handleEntityNotFound(_0x212280,null))[_0x5e14('0x1b')](function(_0x5baff2){if(_0x5baff2){_0x2f3be2=_0x5baff2;_0x2d3da4['model']=_[_0x5e14('0x52')](db[_0x5e14('0x57')][_0x5e14('0x36')]);_0x2d3da4[_0x5e14('0x3b')]=_[_0x5e14('0x52')](_0x4fd9df[_0x5e14('0x3b')]);_0x2d3da4['filters']=_['intersection'](_0x2d3da4[_0x5e14('0x39')],_0x2d3da4[_0x5e14('0x3b')]);_0xc782e[_0x5e14('0x3e')]=_[_0x5e14('0x3c')](_0x2d3da4[_0x5e14('0x39')],qs[_0x5e14('0x3d')](_0x4fd9df[_0x5e14('0x3b')]['fields']));_0xc782e[_0x5e14('0x3e')]=_0xc782e[_0x5e14('0x3e')]['length']?_0xc782e[_0x5e14('0x3e')]:_0x2d3da4[_0x5e14('0x39')];_0xc782e[_0x5e14('0x42')]=qs['sort'](_0x4fd9df['query']['sort']);_0xc782e[_0x5e14('0x47')]=qs['filters'](_[_0x5e14('0x45')](_0x4fd9df[_0x5e14('0x3b')],_0x2d3da4['filters']));if(_0x4fd9df[_0x5e14('0x3b')]['filter']){_0xc782e['where']=_[_0x5e14('0x48')](_0xc782e[_0x5e14('0x47')],{'$or':_['map'](_0xc782e[_0x5e14('0x3e')],function(_0x10d6a6){var _0x2dccb7={};_0x2dccb7[_0x10d6a6]={'$like':'%'+_0x4fd9df[_0x5e14('0x3b')]['filter']+'%'};return _0x2dccb7;})});}_0xc782e=_[_0x5e14('0x48')]({},_0xc782e,_0x4fd9df['options']);return _0x2f3be2['getFields'](_0xc782e);}})[_0x5e14('0x1b')](function(_0xc5e862){if(_0xc5e862){_0x4d1349=_0xc5e862[_0x5e14('0x3f')];if(!_0x4fd9df[_0x5e14('0x3b')][_0x5e14('0x40')](_0x5e14('0x41'))){_0xc782e[_0x5e14('0x2a')]=qs['limit'](_0x4fd9df[_0x5e14('0x3b')][_0x5e14('0x2a')]);_0xc782e[_0x5e14('0x29')]=qs[_0x5e14('0x29')](_0x4fd9df[_0x5e14('0x3b')][_0x5e14('0x29')]);}return _0x2f3be2['getFields'](_0xc782e);}})['then'](function(_0x482df0){if(_0x482df0){return _0x482df0?{'count':_0x4d1349,'rows':_0x482df0}:null;}})[_0x5e14('0x1b')](respondWithResult(_0x212280,null))['catch'](handleError(_0x212280,null));};exports[_0x5e14('0x58')]=function(_0x1c66bf,_0x163263,_0x30d452){var _0x17189f={};var _0x499762={};var _0x217ba0;var _0x332dca;return db[_0x5e14('0x35')]['findOne']({'where':{'id':_0x1c66bf['params']['id']}})[_0x5e14('0x1b')](handleEntityNotFound(_0x163263,null))['then'](function(_0x126394){if(_0x126394){_0x217ba0=_0x126394;_0x499762[_0x5e14('0x39')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x499762[_0x5e14('0x3b')]=_[_0x5e14('0x52')](_0x1c66bf[_0x5e14('0x3b')]);_0x499762[_0x5e14('0x44')]=_[_0x5e14('0x3c')](_0x499762[_0x5e14('0x39')],_0x499762[_0x5e14('0x3b')]);_0x17189f['attributes']=_[_0x5e14('0x3c')](_0x499762[_0x5e14('0x39')],qs[_0x5e14('0x3d')](_0x1c66bf[_0x5e14('0x3b')]['fields']));_0x17189f[_0x5e14('0x3e')]=_0x17189f[_0x5e14('0x3e')][_0x5e14('0x3f')]?_0x17189f['attributes']:_0x499762[_0x5e14('0x39')];_0x17189f[_0x5e14('0x42')]=qs[_0x5e14('0x43')](_0x1c66bf[_0x5e14('0x3b')][_0x5e14('0x43')]);_0x17189f[_0x5e14('0x47')]=qs[_0x5e14('0x44')](_[_0x5e14('0x45')](_0x1c66bf[_0x5e14('0x3b')],_0x499762[_0x5e14('0x44')]));if(_0x1c66bf[_0x5e14('0x3b')][_0x5e14('0x46')]){_0x17189f['where']=_['merge'](_0x17189f[_0x5e14('0x47')],{'$or':_[_0x5e14('0x3a')](_0x17189f['attributes'],function(_0x106265){var _0x3399d={};_0x3399d[_0x106265]={'$like':'%'+_0x1c66bf['query']['filter']+'%'};return _0x3399d;})});}_0x17189f=_[_0x5e14('0x48')]({},_0x17189f,_0x1c66bf[_0x5e14('0x4b')]);return _0x217ba0[_0x5e14('0x58')](_0x17189f);}})[_0x5e14('0x1b')](function(_0x7f11f1){if(_0x7f11f1){_0x332dca=_0x7f11f1[_0x5e14('0x3f')];if(!_0x1c66bf['query'][_0x5e14('0x40')](_0x5e14('0x41'))){_0x17189f['limit']=qs[_0x5e14('0x2a')](_0x1c66bf[_0x5e14('0x3b')]['limit']);_0x17189f[_0x5e14('0x29')]=qs[_0x5e14('0x29')](_0x1c66bf[_0x5e14('0x3b')]['offset']);}return _0x217ba0[_0x5e14('0x58')](_0x17189f);}})[_0x5e14('0x1b')](function(_0x4f0cb9){if(_0x4f0cb9){return _0x4f0cb9?{'count':_0x332dca,'rows':_0x4f0cb9}:null;}})[_0x5e14('0x1b')](respondWithResult(_0x163263,null))[_0x5e14('0x24')](handleError(_0x163263,null));};exports['getDescriptions']=function(_0x4e96e7,_0x2196b3,_0x23dd50){var _0x15d029={};var _0xc05228={};var _0x5ceafd;var _0x4dc4ee;return db['SugarcrmConfiguration'][_0x5e14('0x59')]({'where':{'id':_0x4e96e7['params']['id']}})[_0x5e14('0x1b')](handleEntityNotFound(_0x2196b3,null))[_0x5e14('0x1b')](function(_0x4b62bd){if(_0x4b62bd){_0x5ceafd=_0x4b62bd;_0xc05228[_0x5e14('0x39')]=_[_0x5e14('0x52')](db['SugarcrmField'][_0x5e14('0x36')]);_0xc05228[_0x5e14('0x3b')]=_['keys'](_0x4e96e7['query']);_0xc05228[_0x5e14('0x44')]=_[_0x5e14('0x3c')](_0xc05228[_0x5e14('0x39')],_0xc05228[_0x5e14('0x3b')]);_0x15d029[_0x5e14('0x3e')]=_[_0x5e14('0x3c')](_0xc05228[_0x5e14('0x39')],qs[_0x5e14('0x3d')](_0x4e96e7['query'][_0x5e14('0x3d')]));_0x15d029[_0x5e14('0x3e')]=_0x15d029[_0x5e14('0x3e')]['length']?_0x15d029[_0x5e14('0x3e')]:_0xc05228[_0x5e14('0x39')];_0x15d029[_0x5e14('0x42')]=qs[_0x5e14('0x43')](_0x4e96e7[_0x5e14('0x3b')][_0x5e14('0x43')]);_0x15d029[_0x5e14('0x47')]=qs[_0x5e14('0x44')](_[_0x5e14('0x45')](_0x4e96e7['query'],_0xc05228[_0x5e14('0x44')]));if(_0x4e96e7[_0x5e14('0x3b')]['filter']){_0x15d029['where']=_['merge'](_0x15d029[_0x5e14('0x47')],{'$or':_[_0x5e14('0x3a')](_0x15d029[_0x5e14('0x3e')],function(_0x2ed8c6){var _0x3a7104={};_0x3a7104[_0x2ed8c6]={'$like':'%'+_0x4e96e7[_0x5e14('0x3b')][_0x5e14('0x46')]+'%'};return _0x3a7104;})});}_0x15d029=_[_0x5e14('0x48')]({},_0x15d029,_0x4e96e7['options']);return _0x5ceafd[_0x5e14('0x5a')](_0x15d029);}})[_0x5e14('0x1b')](function(_0x55a774){if(_0x55a774){_0x4dc4ee=_0x55a774[_0x5e14('0x3f')];if(!_0x4e96e7[_0x5e14('0x3b')][_0x5e14('0x40')](_0x5e14('0x41'))){_0x15d029[_0x5e14('0x2a')]=qs[_0x5e14('0x2a')](_0x4e96e7[_0x5e14('0x3b')][_0x5e14('0x2a')]);_0x15d029[_0x5e14('0x29')]=qs[_0x5e14('0x29')](_0x4e96e7[_0x5e14('0x3b')][_0x5e14('0x29')]);}return _0x5ceafd[_0x5e14('0x5a')](_0x15d029);}})[_0x5e14('0x1b')](function(_0x396a87){if(_0x396a87){return _0x396a87?{'count':_0x4dc4ee,'rows':_0x396a87}:null;}})[_0x5e14('0x1b')](respondWithResult(_0x2196b3,null))[_0x5e14('0x24')](handleError(_0x2196b3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 4531a78..4ad4196 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 _0x3cce=['define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','bluebird','../../config/environment','./intSugarcrmConfiguration.attributes','exports'];(function(_0x5bce33,_0x4a4b06){var _0x15bc20=function(_0x56c711){while(--_0x56c711){_0x5bce33['push'](_0x5bce33['shift']());}};_0x15bc20(++_0x4a4b06);}(_0x3cce,0x158));var _0xe3cc=function(_0x321dbc,_0xf5630b){_0x321dbc=_0x321dbc-0x0;var _0x8450a3=_0x3cce[_0x321dbc];return _0x8450a3;};'use strict';var _=require(_0xe3cc('0x0'));var util=require(_0xe3cc('0x1'));var logger=require(_0xe3cc('0x2'))(_0xe3cc('0x3'));var moment=require('moment');var BPromise=require(_0xe3cc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe3cc('0x5'));var attributes=require(_0xe3cc('0x6'));module[_0xe3cc('0x7')]=function(_0x46a420,_0x409a88){return _0x46a420[_0xe3cc('0x8')](_0xe3cc('0x9'),attributes,{'tableName':_0xe3cc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b46=['exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x1b46,0x148));var _0x61b4=function(_0x3e4edb,_0x26f5ce){_0x3e4edb=_0x3e4edb-0x0;var _0x320866=_0x1b46[_0x3e4edb];return _0x320866;};'use strict';var _=require(_0x61b4('0x0'));var util=require(_0x61b4('0x1'));var logger=require(_0x61b4('0x2'))(_0x61b4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x61b4('0x4'));var fs=require('fs');var path=require(_0x61b4('0x5'));var rimraf=require(_0x61b4('0x6'));var config=require('../../config/environment');var attributes=require(_0x61b4('0x7'));module[_0x61b4('0x8')]=function(_0x5010a2,_0x5e0dc5){return _0x5010a2[_0x61b4('0x9')](_0x61b4('0xa'),attributes,{'tableName':_0x61b4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index f447e29..5422e84 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 _0x9f03=['code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x5575e9,_0x461703){var _0x103166=function(_0x226e6d){while(--_0x226e6d){_0x5575e9['push'](_0x5575e9['shift']());}};_0x103166(++_0x461703);}(_0x9f03,0x1a5));var _0x39f0=function(_0x4923c6,_0xd3ba89){_0x4923c6=_0x4923c6-0x0;var _0x39c7e2=_0x9f03[_0x4923c6];return _0x39c7e2;};'use strict';var _=require(_0x39f0('0x0'));var util=require(_0x39f0('0x1'));var moment=require(_0x39f0('0x2'));var BPromise=require('bluebird');var rs=require(_0x39f0('0x3'));var fs=require('fs');var Redis=require(_0x39f0('0x4'));var db=require(_0x39f0('0x5'))['db'];var utils=require(_0x39f0('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x39f0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x246307,_0x442977,_0x353823){return new BPromise(function(_0x2c3dfe,_0x26f871){return client[_0x39f0('0x8')](_0x246307,_0x353823)[_0x39f0('0x9')](function(_0x1e034c){logger[_0x39f0('0xa')](_0x39f0('0xb'),_0x442977,_0x39f0('0xc'));logger[_0x39f0('0xd')](_0x39f0('0xe'),_0x442977,_0x39f0('0xc'),JSON['stringify'](_0x1e034c));if(_0x1e034c[_0x39f0('0xf')]){if(_0x1e034c['error'][_0x39f0('0x10')]===0x1f4){logger[_0x39f0('0xf')](_0x39f0('0xb'),_0x442977,_0x1e034c[_0x39f0('0xf')][_0x39f0('0x11')]);return _0x26f871(_0x1e034c[_0x39f0('0xf')][_0x39f0('0x11')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x442977,_0x1e034c[_0x39f0('0xf')]['message']);return _0x2c3dfe(_0x1e034c[_0x39f0('0xf')]['message']);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x442977,_0x39f0('0xc'));_0x2c3dfe(_0x1e034c['result'][_0x39f0('0x11')]);}})[_0x39f0('0x12')](function(_0x2115a6){logger[_0x39f0('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x442977,_0x2115a6);_0x26f871(_0x2115a6);});});} \ No newline at end of file +var _0x940f=['rpc','../../config/environment','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0x940f,0x12d));var _0xf940=function(_0x6dbcf3,_0x328b11){_0x6dbcf3=_0x6dbcf3-0x0;var _0x40d166=_0x940f[_0x6dbcf3];return _0x40d166;};'use strict';var _=require(_0xf940('0x0'));var util=require(_0xf940('0x1'));var moment=require('moment');var BPromise=require(_0xf940('0x2'));var rs=require(_0xf940('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf940('0x4'))['db'];var utils=require(_0xf940('0x5'));var logger=require(_0xf940('0x6'))(_0xf940('0x7'));var config=require(_0xf940('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf940('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1623a0,_0x503e55,_0x3a7cee){return new BPromise(function(_0x1a5a45,_0x119897){return client[_0xf940('0xa')](_0x1623a0,_0x3a7cee)[_0xf940('0xb')](function(_0xb8a300){logger[_0xf940('0xc')](_0xf940('0xd'),_0x503e55,_0xf940('0xe'));logger['debug'](_0xf940('0xf'),_0x503e55,_0xf940('0xe'),JSON[_0xf940('0x10')](_0xb8a300));if(_0xb8a300[_0xf940('0x11')]){if(_0xb8a300[_0xf940('0x11')][_0xf940('0x12')]===0x1f4){logger[_0xf940('0x11')](_0xf940('0xd'),_0x503e55,_0xb8a300['error'][_0xf940('0x13')]);return _0x119897(_0xb8a300[_0xf940('0x11')][_0xf940('0x13')]);}logger[_0xf940('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x503e55,_0xb8a300['error'][_0xf940('0x13')]);return _0x1a5a45(_0xb8a300[_0xf940('0x11')][_0xf940('0x13')]);}else{logger[_0xf940('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x503e55,_0xf940('0xe'));_0x1a5a45(_0xb8a300[_0xf940('0x14')][_0xf940('0x13')]);}})[_0xf940('0x15')](function(_0x5d56cc){logger[_0xf940('0x11')](_0xf940('0xd'),_0x503e55,_0x5d56cc);_0x119897(_0x5d56cc);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index f762876..4fcacfd 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 _0xc5cf=['isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x25cec5,_0x115d0c){var _0x19fba4=function(_0x17c923){while(--_0x17c923){_0x25cec5['push'](_0x25cec5['shift']());}};_0x19fba4(++_0x115d0c);}(_0xc5cf,0xb5));var _0xfc5c=function(_0x18255e,_0x1a2c2e){_0x18255e=_0x18255e-0x0;var _0xce4b47=_0xc5cf[_0x18255e];return _0xce4b47;};'use strict';var multer=require(_0xfc5c('0x0'));var util=require(_0xfc5c('0x1'));var path=require(_0xfc5c('0x2'));var timeout=require(_0xfc5c('0x3'));var express=require('express');var router=express[_0xfc5c('0x4')]();var auth=require(_0xfc5c('0x5'));var interaction=require(_0xfc5c('0x6'));var config=require(_0xfc5c('0x7'));var controller=require('./intSugarcrmField.controller');router[_0xfc5c('0x8')]('/',auth[_0xfc5c('0x9')](),controller[_0xfc5c('0xa')]);router[_0xfc5c('0x8')](_0xfc5c('0xb'),auth[_0xfc5c('0x9')](),controller['show']);router[_0xfc5c('0xc')]('/',auth['isAuthenticated'](),controller[_0xfc5c('0xd')]);router[_0xfc5c('0xe')](_0xfc5c('0xb'),auth[_0xfc5c('0x9')](),controller[_0xfc5c('0xf')]);router[_0xfc5c('0x10')]('/:id',auth[_0xfc5c('0x9')](),controller[_0xfc5c('0x11')]);module[_0xfc5c('0x12')]=router; \ No newline at end of file +var _0xea60=['../../config/environment','./intSugarcrmField.controller','get','index','isAuthenticated','show','post','put','/:id','update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x556504,_0x3d5bb1){var _0x27c977=function(_0x2f6143){while(--_0x2f6143){_0x556504['push'](_0x556504['shift']());}};_0x27c977(++_0x3d5bb1);}(_0xea60,0x8a));var _0x0ea6=function(_0x2ee9bd,_0x5be295){_0x2ee9bd=_0x2ee9bd-0x0;var _0x546fee=_0xea60[_0x2ee9bd];return _0x546fee;};'use strict';var multer=require(_0x0ea6('0x0'));var util=require(_0x0ea6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0ea6('0x2'));var router=express[_0x0ea6('0x3')]();var auth=require(_0x0ea6('0x4'));var interaction=require(_0x0ea6('0x5'));var config=require(_0x0ea6('0x6'));var controller=require(_0x0ea6('0x7'));router[_0x0ea6('0x8')]('/',auth['isAuthenticated'](),controller[_0x0ea6('0x9')]);router[_0x0ea6('0x8')]('/:id',auth[_0x0ea6('0xa')](),controller[_0x0ea6('0xb')]);router[_0x0ea6('0xc')]('/',auth[_0x0ea6('0xa')](),controller['create']);router[_0x0ea6('0xd')](_0x0ea6('0xe'),auth['isAuthenticated'](),controller[_0x0ea6('0xf')]);router['delete'](_0x0ea6('0xe'),auth['isAuthenticated'](),controller[_0x0ea6('0x10')]);module[_0x0ea6('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index c417d57..4ce43b9 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 _0x4c4e=['customVariable','BOOLEAN','sequelize','ENUM','string','variable','keyValue','STRING'];(function(_0x25714c,_0x48bfac){var _0x3680e3=function(_0x219d9d){while(--_0x219d9d){_0x25714c['push'](_0x25714c['shift']());}};_0x3680e3(++_0x48bfac);}(_0x4c4e,0x152));var _0xe4c4=function(_0x5421b,_0x506dca){_0x5421b=_0x5421b-0x0;var _0x18ddcf=_0x4c4e[_0x5421b];return _0x18ddcf;};'use strict';var Sequelize=require(_0xe4c4('0x0'));module['exports']={'type':{'type':Sequelize[_0xe4c4('0x1')](_0xe4c4('0x2'),_0xe4c4('0x3'),'customVariable',_0xe4c4('0x4')),'defaultValue':_0xe4c4('0x2')},'content':{'type':Sequelize[_0xe4c4('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe4c4('0x1')]('string',_0xe4c4('0x3'),_0xe4c4('0x6'))},'keyContent':{'type':Sequelize[_0xe4c4('0x5')]},'idField':{'type':Sequelize[_0xe4c4('0x5')]},'nameField':{'type':Sequelize[_0xe4c4('0x5')]},'customField':{'type':Sequelize[_0xe4c4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe4c4('0x5')]}}; \ No newline at end of file +var _0x3ffb=['exports','ENUM','string','variable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x23d070,_0x35b1b0){var _0x7079fc=function(_0x52a5e1){while(--_0x52a5e1){_0x23d070['push'](_0x23d070['shift']());}};_0x7079fc(++_0x35b1b0);}(_0x3ffb,0x13f));var _0xb3ff=function(_0x28011b,_0x4c2d30){_0x28011b=_0x28011b-0x0;var _0x40a329=_0x3ffb[_0x28011b];return _0x40a329;};'use strict';var Sequelize=require(_0xb3ff('0x0'));module[_0xb3ff('0x1')]={'type':{'type':Sequelize[_0xb3ff('0x2')](_0xb3ff('0x3'),_0xb3ff('0x4'),'customVariable',_0xb3ff('0x5')),'defaultValue':_0xb3ff('0x3')},'content':{'type':Sequelize[_0xb3ff('0x6')]},'key':{'type':Sequelize[_0xb3ff('0x6')]},'keyType':{'type':Sequelize[_0xb3ff('0x2')](_0xb3ff('0x3'),_0xb3ff('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xb3ff('0x6')]},'idField':{'type':Sequelize[_0xb3ff('0x6')]},'nameField':{'type':Sequelize[_0xb3ff('0x6')]},'customField':{'type':Sequelize[_0xb3ff('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 6ed8ff8..2837e07 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 _0x31f0=['stack','name','send','map','SugarcrmField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error'];(function(_0x362c91,_0xdbfcf2){var _0x4eb29a=function(_0x4cae58){while(--_0x4cae58){_0x362c91['push'](_0x362c91['shift']());}};_0x4eb29a(++_0xdbfcf2);}(_0x31f0,0xb7));var _0x031f=function(_0x473203,_0x1ea637){_0x473203=_0x473203-0x0;var _0x45c971=_0x31f0[_0x473203];return _0x45c971;};'use strict';var pdf=require(_0x031f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x031f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x031f('0x2'));var rp=require(_0x031f('0x3'));var moment=require(_0x031f('0x4'));var BPromise=require(_0x031f('0x5'));var Mustache=require('mustache');var util=require(_0x031f('0x6'));var path=require(_0x031f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x031f('0x8'));var squel=require('squel');var crypto=require(_0x031f('0x9'));var jsforce=require(_0x031f('0xa'));var deskjs=require(_0x031f('0xb'));var toCsv=require(_0x031f('0xc'));var querystring=require('querystring');var Papa=require(_0x031f('0xd'));var Redis=require(_0x031f('0xe'));var authService=require(_0x031f('0xf'));var qs=require(_0x031f('0x10'));var as=require(_0x031f('0x11'));var hardwareService=require(_0x031f('0x12'));var logger=require(_0x031f('0x13'))(_0x031f('0x14'));var utils=require('../../config/utils');var config=require(_0x031f('0x15'));var licenseUtil=require(_0x031f('0x16'));var db=require(_0x031f('0x17'))['db'];function respondWithStatusCode(_0x351052,_0x3819bb){_0x3819bb=_0x3819bb||0xcc;return function(_0x405896){if(_0x405896){return _0x351052[_0x031f('0x18')](_0x3819bb);}return _0x351052['status'](_0x3819bb)[_0x031f('0x19')]();};}function respondWithResult(_0x23b40c,_0x17a699){_0x17a699=_0x17a699||0xc8;return function(_0x2e3dfe){if(_0x2e3dfe){return _0x23b40c[_0x031f('0x1a')](_0x17a699)['json'](_0x2e3dfe);}};}function respondWithFilteredResult(_0x4b7011,_0x1f08db){return function(_0x3a10aa){if(_0x3a10aa){var _0xe4fc1d=_0x3a10aa[_0x031f('0x1b')],_0x286177=_0x1f08db['offset'],_0x5196b1=_0x1f08db[_0x031f('0x1c')]+_0x1f08db['limit'],_0x1dc4a7;if(_0x5196b1>=_0xe4fc1d){_0x5196b1=_0xe4fc1d;_0x1dc4a7=0xc8;}else{_0x1dc4a7=0xce;}_0x4b7011[_0x031f('0x1a')](_0x1dc4a7);return _0x4b7011[_0x031f('0x1d')](_0x031f('0x1e'),_0x286177+'-'+_0x5196b1+'/'+_0xe4fc1d)[_0x031f('0x1f')](_0x3a10aa);}return null;};}function patchUpdates(_0x1ceddc){return function(_0x26cb5e){try{jsonpatch[_0x031f('0x20')](_0x26cb5e,_0x1ceddc,!![]);}catch(_0x2825ef){return BPromise[_0x031f('0x21')](_0x2825ef);}return _0x26cb5e[_0x031f('0x22')]();};}function saveUpdates(_0x29dd6e,_0x48a76e){return function(_0xf72793){if(_0xf72793){return _0xf72793[_0x031f('0x23')](_0x29dd6e)[_0x031f('0x24')](function(_0x4d6706){return _0x4d6706;});}return null;};}function removeEntity(_0x5c4184,_0xa11a2b){return function(_0x4d0f92){if(_0x4d0f92){return _0x4d0f92[_0x031f('0x25')]()['then'](function(){_0x5c4184['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x971691,_0x12c406){return function(_0x2920cd){if(!_0x2920cd){_0x971691[_0x031f('0x18')](0x194);}return _0x2920cd;};}function handleError(_0x494568,_0x374b65){_0x374b65=_0x374b65||0x1f4;return function(_0x5a64c0){logger[_0x031f('0x26')](_0x5a64c0[_0x031f('0x27')]);if(_0x5a64c0[_0x031f('0x28')]){delete _0x5a64c0['name'];}_0x494568[_0x031f('0x1a')](_0x374b65)[_0x031f('0x29')](_0x5a64c0);};}exports['index']=function(_0x3847b2,_0x28a617){var _0x2403e9={},_0x5395ea={},_0xa308b={'count':0x0,'rows':[]};var _0x114e34=_[_0x031f('0x2a')](db[_0x031f('0x2b')][_0x031f('0x2c')],function(_0x301bd2){return{'name':_0x301bd2['fieldName'],'type':_0x301bd2[_0x031f('0x2d')][_0x031f('0x2e')]};});_0x5395ea[_0x031f('0x2f')]=_[_0x031f('0x2a')](_0x114e34,_0x031f('0x28'));_0x5395ea[_0x031f('0x30')]=_[_0x031f('0x31')](_0x3847b2[_0x031f('0x30')]);_0x5395ea[_0x031f('0x32')]=_[_0x031f('0x33')](_0x5395ea[_0x031f('0x2f')],_0x5395ea['query']);_0x2403e9[_0x031f('0x34')]=_[_0x031f('0x33')](_0x5395ea[_0x031f('0x2f')],qs[_0x031f('0x35')](_0x3847b2[_0x031f('0x30')][_0x031f('0x35')]));_0x2403e9[_0x031f('0x34')]=_0x2403e9[_0x031f('0x34')][_0x031f('0x36')]?_0x2403e9[_0x031f('0x34')]:_0x5395ea[_0x031f('0x2f')];if(!_0x3847b2[_0x031f('0x30')][_0x031f('0x37')]('nolimit')){_0x2403e9[_0x031f('0x38')]=qs[_0x031f('0x38')](_0x3847b2['query'][_0x031f('0x38')]);_0x2403e9[_0x031f('0x1c')]=qs['offset'](_0x3847b2[_0x031f('0x30')][_0x031f('0x1c')]);}_0x2403e9[_0x031f('0x39')]=qs[_0x031f('0x3a')](_0x3847b2['query']['sort']);_0x2403e9[_0x031f('0x3b')]=qs['filters'](_[_0x031f('0x3c')](_0x3847b2[_0x031f('0x30')],_0x5395ea[_0x031f('0x32')]),_0x114e34);if(_0x3847b2['query']['filter']){_0x2403e9[_0x031f('0x3b')]=_['merge'](_0x2403e9['where'],{'$or':_[_0x031f('0x2a')](_0x114e34,function(_0x45e3a4){if(_0x45e3a4[_0x031f('0x2d')]!==_0x031f('0x3d')){var _0x11c03c={};_0x11c03c[_0x45e3a4[_0x031f('0x28')]]={'$like':'%'+_0x3847b2[_0x031f('0x30')]['filter']+'%'};return _0x11c03c;}})});}_0x2403e9=_[_0x031f('0x3e')]({},_0x2403e9,_0x3847b2[_0x031f('0x3f')]);var _0xb3b188={'where':_0x2403e9[_0x031f('0x3b')]};return db['SugarcrmField'][_0x031f('0x1b')](_0xb3b188)[_0x031f('0x24')](function(_0x2dba8b){_0xa308b['count']=_0x2dba8b;if(_0x3847b2[_0x031f('0x30')][_0x031f('0x40')]){_0x2403e9['include']=[{'all':!![]}];}return db[_0x031f('0x2b')][_0x031f('0x41')](_0x2403e9);})['then'](function(_0x4c50b2){_0xa308b[_0x031f('0x42')]=_0x4c50b2;return _0xa308b;})[_0x031f('0x24')](respondWithFilteredResult(_0x28a617,_0x2403e9))[_0x031f('0x43')](handleError(_0x28a617,null));};exports[_0x031f('0x44')]=function(_0x2691b7,_0xf0fb95){var _0xe07087={'raw':!![],'where':{'id':_0x2691b7[_0x031f('0x45')]['id']}},_0x5a212c={};_0x5a212c[_0x031f('0x2f')]=_['keys'](db[_0x031f('0x2b')]['rawAttributes']);_0x5a212c[_0x031f('0x30')]=_[_0x031f('0x31')](_0x2691b7['query']);_0x5a212c[_0x031f('0x32')]=_[_0x031f('0x33')](_0x5a212c[_0x031f('0x2f')],_0x5a212c['query']);_0xe07087[_0x031f('0x34')]=_[_0x031f('0x33')](_0x5a212c[_0x031f('0x2f')],qs[_0x031f('0x35')](_0x2691b7[_0x031f('0x30')][_0x031f('0x35')]));_0xe07087[_0x031f('0x34')]=_0xe07087[_0x031f('0x34')][_0x031f('0x36')]?_0xe07087['attributes']:_0x5a212c[_0x031f('0x2f')];if(_0x2691b7[_0x031f('0x30')][_0x031f('0x40')]){_0xe07087[_0x031f('0x46')]=[{'all':!![]}];}_0xe07087=_[_0x031f('0x3e')]({},_0xe07087,_0x2691b7[_0x031f('0x3f')]);return db[_0x031f('0x2b')][_0x031f('0x47')](_0xe07087)[_0x031f('0x24')](handleEntityNotFound(_0xf0fb95,null))['then'](respondWithResult(_0xf0fb95,null))[_0x031f('0x43')](handleError(_0xf0fb95,null));};exports['create']=function(_0x512937,_0x434849){return db[_0x031f('0x2b')][_0x031f('0x48')](_0x512937[_0x031f('0x49')],{})[_0x031f('0x24')](respondWithResult(_0x434849,0xc9))['catch'](handleError(_0x434849,null));};exports[_0x031f('0x23')]=function(_0x365f8c,_0x4216ce){if(_0x365f8c['body']['id']){delete _0x365f8c[_0x031f('0x49')]['id'];}return db[_0x031f('0x2b')][_0x031f('0x47')]({'where':{'id':_0x365f8c[_0x031f('0x45')]['id']}})[_0x031f('0x24')](handleEntityNotFound(_0x4216ce,null))[_0x031f('0x24')](saveUpdates(_0x365f8c['body'],null))['then'](respondWithResult(_0x4216ce,null))[_0x031f('0x43')](handleError(_0x4216ce,null));};exports['destroy']=function(_0x3b8c04,_0x3bba44){return db['SugarcrmField'][_0x031f('0x47')]({'where':{'id':_0x3b8c04['params']['id']}})['then'](handleEntityNotFound(_0x3bba44,null))[_0x031f('0x24')](removeEntity(_0x3bba44,null))['catch'](handleError(_0x3bba44,null));}; \ No newline at end of file +var _0x24ca=['bluebird','util','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','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','stack','name','send','index','map','SugarcrmField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','options','find','create','body','params','destroy','html-pdf','zip-dir','request-promise','moment'];(function(_0x1a90cb,_0x1154ff){var _0x4cb8d8=function(_0x2973ce){while(--_0x2973ce){_0x1a90cb['push'](_0x1a90cb['shift']());}};_0x4cb8d8(++_0x1154ff);}(_0x24ca,0x8c));var _0xa24c=function(_0xca1f0e,_0x2713d5){_0xca1f0e=_0xca1f0e-0x0;var _0x35e4ef=_0x24ca[_0xca1f0e];return _0x35e4ef;};'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'];function respondWithStatusCode(_0x566313,_0x5bb631){_0x5bb631=_0x5bb631||0xcc;return function(_0x4907f6){if(_0x4907f6){return _0x566313[_0xa24c('0x17')](_0x5bb631);}return _0x566313[_0xa24c('0x18')](_0x5bb631)[_0xa24c('0x19')]();};}function respondWithResult(_0x9fe9e3,_0x4351a8){_0x4351a8=_0x4351a8||0xc8;return function(_0x4971af){if(_0x4971af){return _0x9fe9e3[_0xa24c('0x18')](_0x4351a8)['json'](_0x4971af);}};}function respondWithFilteredResult(_0x493bcb,_0x588acf){return function(_0x2e8dc9){if(_0x2e8dc9){var _0x2a4270=_0x2e8dc9[_0xa24c('0x1a')],_0x3f762e=_0x588acf[_0xa24c('0x1b')],_0x267762=_0x588acf[_0xa24c('0x1b')]+_0x588acf[_0xa24c('0x1c')],_0x204e7a;if(_0x267762>=_0x2a4270){_0x267762=_0x2a4270;_0x204e7a=0xc8;}else{_0x204e7a=0xce;}_0x493bcb[_0xa24c('0x18')](_0x204e7a);return _0x493bcb[_0xa24c('0x1d')](_0xa24c('0x1e'),_0x3f762e+'-'+_0x267762+'/'+_0x2a4270)[_0xa24c('0x1f')](_0x2e8dc9);}return null;};}function patchUpdates(_0x3e4e81){return function(_0x5276b6){try{jsonpatch[_0xa24c('0x20')](_0x5276b6,_0x3e4e81,!![]);}catch(_0x48fb65){return BPromise[_0xa24c('0x21')](_0x48fb65);}return _0x5276b6[_0xa24c('0x22')]();};}function saveUpdates(_0x8c3949,_0x37e20e){return function(_0x240f6c){if(_0x240f6c){return _0x240f6c[_0xa24c('0x23')](_0x8c3949)[_0xa24c('0x24')](function(_0x432c15){return _0x432c15;});}return null;};}function removeEntity(_0xba710,_0x2ec5ad){return function(_0x2b471a){if(_0x2b471a){return _0x2b471a['destroy']()['then'](function(){_0xba710[_0xa24c('0x18')](0xcc)[_0xa24c('0x19')]();});}};}function handleEntityNotFound(_0x316a68,_0x1a04ff){return function(_0x375c83){if(!_0x375c83){_0x316a68[_0xa24c('0x17')](0x194);}return _0x375c83;};}function handleError(_0x16bd20,_0x3106ff){_0x3106ff=_0x3106ff||0x1f4;return function(_0x304d6c){logger['error'](_0x304d6c[_0xa24c('0x25')]);if(_0x304d6c['name']){delete _0x304d6c[_0xa24c('0x26')];}_0x16bd20[_0xa24c('0x18')](_0x3106ff)[_0xa24c('0x27')](_0x304d6c);};}exports[_0xa24c('0x28')]=function(_0x54b8a6,_0x58ff62){var _0x4c86c6={},_0x4e5d2c={},_0x23fb79={'count':0x0,'rows':[]};var _0x39e0be=_[_0xa24c('0x29')](db[_0xa24c('0x2a')][_0xa24c('0x2b')],function(_0x5361d4){return{'name':_0x5361d4['fieldName'],'type':_0x5361d4[_0xa24c('0x2c')][_0xa24c('0x2d')]};});_0x4e5d2c[_0xa24c('0x2e')]=_[_0xa24c('0x29')](_0x39e0be,_0xa24c('0x26'));_0x4e5d2c[_0xa24c('0x2f')]=_[_0xa24c('0x30')](_0x54b8a6[_0xa24c('0x2f')]);_0x4e5d2c[_0xa24c('0x31')]=_[_0xa24c('0x32')](_0x4e5d2c['model'],_0x4e5d2c[_0xa24c('0x2f')]);_0x4c86c6[_0xa24c('0x33')]=_['intersection'](_0x4e5d2c[_0xa24c('0x2e')],qs[_0xa24c('0x34')](_0x54b8a6[_0xa24c('0x2f')][_0xa24c('0x34')]));_0x4c86c6[_0xa24c('0x33')]=_0x4c86c6[_0xa24c('0x33')][_0xa24c('0x35')]?_0x4c86c6[_0xa24c('0x33')]:_0x4e5d2c[_0xa24c('0x2e')];if(!_0x54b8a6[_0xa24c('0x2f')]['hasOwnProperty']('nolimit')){_0x4c86c6['limit']=qs[_0xa24c('0x1c')](_0x54b8a6['query'][_0xa24c('0x1c')]);_0x4c86c6[_0xa24c('0x1b')]=qs[_0xa24c('0x1b')](_0x54b8a6['query'][_0xa24c('0x1b')]);}_0x4c86c6[_0xa24c('0x36')]=qs[_0xa24c('0x37')](_0x54b8a6['query'][_0xa24c('0x37')]);_0x4c86c6[_0xa24c('0x38')]=qs['filters'](_[_0xa24c('0x39')](_0x54b8a6[_0xa24c('0x2f')],_0x4e5d2c[_0xa24c('0x31')]),_0x39e0be);if(_0x54b8a6['query'][_0xa24c('0x3a')]){_0x4c86c6[_0xa24c('0x38')]=_[_0xa24c('0x3b')](_0x4c86c6[_0xa24c('0x38')],{'$or':_[_0xa24c('0x29')](_0x39e0be,function(_0x4a9d2d){if(_0x4a9d2d[_0xa24c('0x2c')]!==_0xa24c('0x3c')){var _0x5d4837={};_0x5d4837[_0x4a9d2d[_0xa24c('0x26')]]={'$like':'%'+_0x54b8a6[_0xa24c('0x2f')][_0xa24c('0x3a')]+'%'};return _0x5d4837;}})});}_0x4c86c6=_['merge']({},_0x4c86c6,_0x54b8a6['options']);var _0x1f7535={'where':_0x4c86c6[_0xa24c('0x38')]};return db[_0xa24c('0x2a')][_0xa24c('0x1a')](_0x1f7535)[_0xa24c('0x24')](function(_0x3879c8){_0x23fb79['count']=_0x3879c8;if(_0x54b8a6[_0xa24c('0x2f')][_0xa24c('0x3d')]){_0x4c86c6[_0xa24c('0x3e')]=[{'all':!![]}];}return db[_0xa24c('0x2a')]['findAll'](_0x4c86c6);})[_0xa24c('0x24')](function(_0x190dfc){_0x23fb79[_0xa24c('0x3f')]=_0x190dfc;return _0x23fb79;})[_0xa24c('0x24')](respondWithFilteredResult(_0x58ff62,_0x4c86c6))[_0xa24c('0x40')](handleError(_0x58ff62,null));};exports[_0xa24c('0x41')]=function(_0x16cd65,_0x54939b){var _0x4e23d9={'raw':!![],'where':{'id':_0x16cd65['params']['id']}},_0x22c57e={};_0x22c57e[_0xa24c('0x2e')]=_['keys'](db[_0xa24c('0x2a')][_0xa24c('0x2b')]);_0x22c57e[_0xa24c('0x2f')]=_[_0xa24c('0x30')](_0x16cd65[_0xa24c('0x2f')]);_0x22c57e[_0xa24c('0x31')]=_[_0xa24c('0x32')](_0x22c57e[_0xa24c('0x2e')],_0x22c57e[_0xa24c('0x2f')]);_0x4e23d9[_0xa24c('0x33')]=_[_0xa24c('0x32')](_0x22c57e[_0xa24c('0x2e')],qs[_0xa24c('0x34')](_0x16cd65[_0xa24c('0x2f')][_0xa24c('0x34')]));_0x4e23d9[_0xa24c('0x33')]=_0x4e23d9['attributes'][_0xa24c('0x35')]?_0x4e23d9[_0xa24c('0x33')]:_0x22c57e[_0xa24c('0x2e')];if(_0x16cd65['query'][_0xa24c('0x3d')]){_0x4e23d9[_0xa24c('0x3e')]=[{'all':!![]}];}_0x4e23d9=_[_0xa24c('0x3b')]({},_0x4e23d9,_0x16cd65[_0xa24c('0x42')]);return db['SugarcrmField'][_0xa24c('0x43')](_0x4e23d9)[_0xa24c('0x24')](handleEntityNotFound(_0x54939b,null))[_0xa24c('0x24')](respondWithResult(_0x54939b,null))[_0xa24c('0x40')](handleError(_0x54939b,null));};exports[_0xa24c('0x44')]=function(_0x25ab02,_0x3a72ea){return db[_0xa24c('0x2a')][_0xa24c('0x44')](_0x25ab02[_0xa24c('0x45')],{})[_0xa24c('0x24')](respondWithResult(_0x3a72ea,0xc9))[_0xa24c('0x40')](handleError(_0x3a72ea,null));};exports[_0xa24c('0x23')]=function(_0x5da5f2,_0x19b05a){if(_0x5da5f2['body']['id']){delete _0x5da5f2[_0xa24c('0x45')]['id'];}return db[_0xa24c('0x2a')][_0xa24c('0x43')]({'where':{'id':_0x5da5f2[_0xa24c('0x46')]['id']}})[_0xa24c('0x24')](handleEntityNotFound(_0x19b05a,null))[_0xa24c('0x24')](saveUpdates(_0x5da5f2[_0xa24c('0x45')],null))[_0xa24c('0x24')](respondWithResult(_0x19b05a,null))[_0xa24c('0x40')](handleError(_0x19b05a,null));};exports[_0xa24c('0x47')]=function(_0x235b2d,_0x390688){return db[_0xa24c('0x2a')]['find']({'where':{'id':_0x235b2d[_0xa24c('0x46')]['id']}})[_0xa24c('0x24')](handleEntityNotFound(_0x390688,null))[_0xa24c('0x24')](removeEntity(_0x390688,null))[_0xa24c('0x40')](handleError(_0x390688,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index de04ca7..45efd0e 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 _0x16af=['api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','util','../../config/logger'];(function(_0x333ffb,_0x28e747){var _0x433cbd=function(_0x5af030){while(--_0x5af030){_0x333ffb['push'](_0x333ffb['shift']());}};_0x433cbd(++_0x28e747);}(_0x16af,0xb4));var _0xf16a=function(_0x199401,_0x3e0898){_0x199401=_0x199401-0x0;var _0x3f272a=_0x16af[_0x199401];return _0x3f272a;};'use strict';var _=require('lodash');var util=require(_0xf16a('0x0'));var logger=require(_0xf16a('0x1'))(_0xf16a('0x2'));var moment=require(_0xf16a('0x3'));var BPromise=require('bluebird');var rp=require(_0xf16a('0x4'));var fs=require('fs');var path=require(_0xf16a('0x5'));var rimraf=require(_0xf16a('0x6'));var config=require(_0xf16a('0x7'));var attributes=require(_0xf16a('0x8'));module[_0xf16a('0x9')]=function(_0x3da0d1,_0x19512e){return _0x3da0d1['define'](_0xf16a('0xa'),attributes,{'tableName':_0xf16a('0xb'),'paranoid':![],'indexes':[{'name':_0xf16a('0xc'),'fields':['idField',_0xf16a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5426=['./intSugarcrmField.attributes','exports','define','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x13a4bf,_0x56cb27){var _0x2933d6=function(_0x4a966f){while(--_0x4a966f){_0x13a4bf['push'](_0x13a4bf['shift']());}};_0x2933d6(++_0x56cb27);}(_0x5426,0x17d));var _0x6542=function(_0x11224f,_0x1f613b){_0x11224f=_0x11224f-0x0;var _0x41c4f8=_0x5426[_0x11224f];return _0x41c4f8;};'use strict';var _=require(_0x6542('0x0'));var util=require(_0x6542('0x1'));var logger=require(_0x6542('0x2'))('api');var moment=require(_0x6542('0x3'));var BPromise=require(_0x6542('0x4'));var rp=require(_0x6542('0x5'));var fs=require('fs');var path=require(_0x6542('0x6'));var rimraf=require(_0x6542('0x7'));var config=require(_0x6542('0x8'));var attributes=require(_0x6542('0x9'));module[_0x6542('0xa')]=function(_0x3b9dfc,_0x22139e){return _0x3b9dfc[_0x6542('0xb')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x6542('0xc'),'fields':[_0x6542('0xd'),_0x6542('0xe')],'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 5e4c65b..b334610 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 _0x757a=['request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2d3a4d,_0x47561e){var _0x3a94a3=function(_0x2f48da){while(--_0x2f48da){_0x2d3a4d['push'](_0x2d3a4d['shift']());}};_0x3a94a3(++_0x47561e);}(_0x757a,0xde));var _0xa757=function(_0x34d808,_0x3cd62e){_0x34d808=_0x34d808-0x0;var _0x49acb5=_0x757a[_0x34d808];return _0x49acb5;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});} \ No newline at end of file +var _0x0b0e=['SugarcrmField,\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','SugarcrmField,\x20%s,\x20%s','debug'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3311ae,_0x362cee){_0x3311ae=_0x3311ae-0x0;var _0x107949=_0x0b0e[_0x3311ae];return _0x107949;};'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')]('SugarcrmField,\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/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 8077bdc..bc03221 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 _0x902e=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x26393b,_0x449a84){var _0x57230a=function(_0x583888){while(--_0x583888){_0x26393b['push'](_0x26393b['shift']());}};_0x57230a(++_0x449a84);}(_0x902e,0x126));var _0xe902=function(_0x16ef58,_0x162636){_0x16ef58=_0x16ef58-0x0;var _0x175155=_0x902e[_0x16ef58];return _0x175155;};'use strict';var multer=require(_0xe902('0x0'));var util=require(_0xe902('0x1'));var path=require(_0xe902('0x2'));var timeout=require(_0xe902('0x3'));var express=require(_0xe902('0x4'));var router=express[_0xe902('0x5')]();var auth=require(_0xe902('0x6'));var interaction=require(_0xe902('0x7'));var config=require(_0xe902('0x8'));var controller=require('./intVtigerAccount.controller');router[_0xe902('0x9')]('/',auth[_0xe902('0xa')](),controller[_0xe902('0xb')]);router[_0xe902('0x9')](_0xe902('0xc'),auth[_0xe902('0xa')](),controller[_0xe902('0xd')]);router[_0xe902('0x9')](_0xe902('0xe'),auth['isAuthenticated'](),controller[_0xe902('0xf')]);router[_0xe902('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xe902('0x10')]);router[_0xe902('0x11')]('/',auth['isAuthenticated'](),controller[_0xe902('0x12')]);router['post']('/:id/configurations',auth[_0xe902('0xa')](),controller[_0xe902('0x13')]);router[_0xe902('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe902('0x15')](_0xe902('0xc'),auth[_0xe902('0xa')](),controller[_0xe902('0x16')]);module['exports']=router; \ No newline at end of file +var _0xfa69=['isAuthenticated','index','/:id','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get'];(function(_0x4e76b0,_0x3168de){var _0x5d5358=function(_0x57db2a){while(--_0x57db2a){_0x4e76b0['push'](_0x4e76b0['shift']());}};_0x5d5358(++_0x3168de);}(_0xfa69,0xfb));var _0x9fa6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xfa69[_0x40a045];return _0x1a687c;};'use strict';var multer=require('multer');var util=require(_0x9fa6('0x0'));var path=require(_0x9fa6('0x1'));var timeout=require(_0x9fa6('0x2'));var express=require(_0x9fa6('0x3'));var router=express[_0x9fa6('0x4')]();var auth=require(_0x9fa6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9fa6('0x6'));var controller=require(_0x9fa6('0x7'));router[_0x9fa6('0x8')]('/',auth[_0x9fa6('0x9')](),controller[_0x9fa6('0xa')]);router[_0x9fa6('0x8')](_0x9fa6('0xb'),auth[_0x9fa6('0x9')](),controller['show']);router[_0x9fa6('0x8')]('/:id/configurations',auth[_0x9fa6('0x9')](),controller['getConfigurations']);router['get'](_0x9fa6('0xc'),auth[_0x9fa6('0x9')](),controller[_0x9fa6('0xd')]);router[_0x9fa6('0xe')]('/',auth[_0x9fa6('0x9')](),controller[_0x9fa6('0xf')]);router[_0x9fa6('0xe')]('/:id/configurations',auth[_0x9fa6('0x9')](),controller[_0x9fa6('0x10')]);router[_0x9fa6('0x11')](_0x9fa6('0xb'),auth[_0x9fa6('0x9')](),controller['update']);router[_0x9fa6('0x12')](_0x9fa6('0xb'),auth[_0x9fa6('0x9')](),controller[_0x9fa6('0x13')]);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 501a1b0..a9e4ae6 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 _0x5fcb=['HelpDesk','sequelize','exports','STRING'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x5fcb,0x141));var _0xb5fc=function(_0x58a9fe,_0xc31b4c){_0x58a9fe=_0x58a9fe-0x0;var _0x7895c7=_0x5fcb[_0x58a9fe];return _0x7895c7;};'use strict';var Sequelize=require(_0xb5fc('0x0'));module[_0xb5fc('0x1')]={'name':{'type':Sequelize[_0xb5fc('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb5fc('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xb5fc('0x2')],'allowNull':![],'defaultValue':_0xb5fc('0x3')},'remoteUri':{'type':Sequelize[_0xb5fc('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xb5fc('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xb5fc('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xdf36=['sequelize','exports','STRING'];(function(_0x1589de,_0x55ec9e){var _0x45de9a=function(_0x525acf){while(--_0x525acf){_0x1589de['push'](_0x1589de['shift']());}};_0x45de9a(++_0x55ec9e);}(_0xdf36,0x1d1));var _0x6df3=function(_0x34e5d0,_0x465f53){_0x34e5d0=_0x34e5d0-0x0;var _0x316f32=_0xdf36[_0x34e5d0];return _0x316f32;};'use strict';var Sequelize=require(_0x6df3('0x0'));module[_0x6df3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6df3('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6df3('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x6df3('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x6df3('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 fc00454..af3ad0b 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 _0x534b=['label','startsWith','cf_','picklist','picklistValues','value','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','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','../../components/integrations/configuration','client','VtigerAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','name','index','map','VtigerAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','findOne','VtigerConfiguration','order','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','getchallenge','success','POST','login','GET','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x534b,0x19a));var _0xb534=function(_0x384141,_0x7f7f3a){_0x384141=_0x384141-0x0;var _0x3930c6=_0x534b[_0x384141];return _0x3930c6;};'use strict';var pdf=require(_0xb534('0x0'));var emlformat=require(_0xb534('0x1'));var rimraf=require(_0xb534('0x2'));var zipdir=require(_0xb534('0x3'));var jsonpatch=require(_0xb534('0x4'));var rp=require(_0xb534('0x5'));var moment=require(_0xb534('0x6'));var BPromise=require(_0xb534('0x7'));var Mustache=require(_0xb534('0x8'));var util=require(_0xb534('0x9'));var path=require('path');var sox=require(_0xb534('0xa'));var csv=require(_0xb534('0xb'));var ejs=require(_0xb534('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb534('0xd'));var crypto=require('crypto');var jsforce=require(_0xb534('0xe'));var deskjs=require(_0xb534('0xf'));var toCsv=require(_0xb534('0xb'));var querystring=require(_0xb534('0x10'));var Papa=require(_0xb534('0x11'));var Redis=require(_0xb534('0x12'));var authService=require(_0xb534('0x13'));var qs=require(_0xb534('0x14'));var as=require(_0xb534('0x15'));var hardwareService=require(_0xb534('0x16'));var logger=require(_0xb534('0x17'))(_0xb534('0x18'));var utils=require('../../config/utils');var config=require(_0xb534('0x19'));var licenseUtil=require(_0xb534('0x1a'));var db=require(_0xb534('0x1b'))['db'];var integrations=require(_0xb534('0x1c'));var jayson=require('jayson/promise');var client=jayson[_0xb534('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4760fb,_0x42e182,_0x40a763,_0x5622f3){return new BPromise(function(_0x2ced9a,_0x3db32f){var _0x5dfb57=_0x5622f3||client;return _0x5dfb57['request'](_0x4760fb,_0x40a763)['then'](function(_0xe07df1){logger['info'](_0xb534('0x1e'),_0x42e182,'request\x20sent');logger[_0xb534('0x1f')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x42e182,_0xb534('0x20'),JSON[_0xb534('0x21')](_0xe07df1));if(_0xe07df1[_0xb534('0x22')]){if(_0xe07df1[_0xb534('0x22')][_0xb534('0x23')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x42e182,_0xe07df1[_0xb534('0x22')][_0xb534('0x24')]);return _0x3db32f(_0xe07df1['error'][_0xb534('0x24')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x42e182,_0xe07df1[_0xb534('0x22')][_0xb534('0x24')]);return _0x2ced9a(_0xe07df1[_0xb534('0x22')]['message']);}else{logger[_0xb534('0x25')]('VtigerAccount,\x20%s,\x20%s',_0x42e182,_0xb534('0x20'));_0x2ced9a(_0xe07df1[_0xb534('0x26')][_0xb534('0x24')]);}})[_0xb534('0x27')](function(_0x29ad9f){logger[_0xb534('0x22')]('VtigerAccount,\x20%s,\x20%s',_0x42e182,_0x29ad9f);_0x3db32f(_0x29ad9f);});});}function respondWithStatusCode(_0x45d00b,_0x470bcf){_0x470bcf=_0x470bcf||0xcc;return function(_0x15fc5d){if(_0x15fc5d){return _0x45d00b[_0xb534('0x28')](_0x470bcf);}return _0x45d00b[_0xb534('0x29')](_0x470bcf)[_0xb534('0x2a')]();};}function respondWithResult(_0x21bcd1,_0x909ac){_0x909ac=_0x909ac||0xc8;return function(_0x3d6614){if(_0x3d6614){return _0x21bcd1[_0xb534('0x29')](_0x909ac)[_0xb534('0x2b')](_0x3d6614);}};}function respondWithFilteredResult(_0x42ba19,_0x31eff9){return function(_0x542d85){if(_0x542d85){var _0xb07741=_0x542d85[_0xb534('0x2c')],_0x4de4f9=_0x31eff9[_0xb534('0x2d')],_0x548c4d=_0x31eff9[_0xb534('0x2d')]+_0x31eff9['limit'],_0x386c9c;if(_0x548c4d>=_0xb07741){_0x548c4d=_0xb07741;_0x386c9c=0xc8;}else{_0x386c9c=0xce;}_0x42ba19[_0xb534('0x29')](_0x386c9c);return _0x42ba19[_0xb534('0x2e')](_0xb534('0x2f'),_0x4de4f9+'-'+_0x548c4d+'/'+_0xb07741)[_0xb534('0x2b')](_0x542d85);}return null;};}function patchUpdates(_0x488dc4){return function(_0xb011a7){try{jsonpatch[_0xb534('0x30')](_0xb011a7,_0x488dc4,!![]);}catch(_0x5f5d34){return BPromise[_0xb534('0x31')](_0x5f5d34);}return _0xb011a7[_0xb534('0x32')]();};}function saveUpdates(_0x5e482e,_0x49e3ad){return function(_0xc4b0d9){if(_0xc4b0d9){return _0xc4b0d9[_0xb534('0x33')](_0x5e482e)[_0xb534('0x34')](function(_0x132afa){return _0x132afa;});}return null;};}function removeEntity(_0x2be91f,_0x53b5d3){return function(_0x394140){if(_0x394140){return _0x394140[_0xb534('0x35')]()[_0xb534('0x34')](function(){_0x2be91f[_0xb534('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe2d49c,_0x4aba36){return function(_0x480d78){if(!_0x480d78){_0xe2d49c['sendStatus'](0x194);}return _0x480d78;};}function handleError(_0x1e6522,_0x476853){_0x476853=_0x476853||0x1f4;return function(_0x1d072c){logger['error'](_0x1d072c['stack']);if(_0x1d072c[_0xb534('0x36')]){delete _0x1d072c['name'];}_0x1e6522[_0xb534('0x29')](_0x476853)['send'](_0x1d072c);};}exports[_0xb534('0x37')]=function(_0x2e85d2,_0x7582d7){var _0x5bc8b0={},_0x2c478d={},_0x56466c={'count':0x0,'rows':[]};var _0x428fcb=_[_0xb534('0x38')](db[_0xb534('0x39')][_0xb534('0x3a')],function(_0x583e53){return{'name':_0x583e53[_0xb534('0x3b')],'type':_0x583e53[_0xb534('0x3c')]['key']};});_0x2c478d[_0xb534('0x3d')]=_['map'](_0x428fcb,'name');_0x2c478d[_0xb534('0x3e')]=_[_0xb534('0x3f')](_0x2e85d2['query']);_0x2c478d['filters']=_[_0xb534('0x40')](_0x2c478d[_0xb534('0x3d')],_0x2c478d['query']);_0x5bc8b0[_0xb534('0x41')]=_[_0xb534('0x40')](_0x2c478d[_0xb534('0x3d')],qs[_0xb534('0x42')](_0x2e85d2[_0xb534('0x3e')][_0xb534('0x42')]));_0x5bc8b0[_0xb534('0x41')]=_0x5bc8b0['attributes'][_0xb534('0x43')]?_0x5bc8b0[_0xb534('0x41')]:_0x2c478d[_0xb534('0x3d')];if(!_0x2e85d2['query']['hasOwnProperty'](_0xb534('0x44'))){_0x5bc8b0[_0xb534('0x45')]=qs['limit'](_0x2e85d2[_0xb534('0x3e')][_0xb534('0x45')]);_0x5bc8b0['offset']=qs[_0xb534('0x2d')](_0x2e85d2[_0xb534('0x3e')][_0xb534('0x2d')]);}_0x5bc8b0['order']=qs[_0xb534('0x46')](_0x2e85d2[_0xb534('0x3e')][_0xb534('0x46')]);_0x5bc8b0[_0xb534('0x47')]=qs[_0xb534('0x48')](_[_0xb534('0x49')](_0x2e85d2[_0xb534('0x3e')],_0x2c478d['filters']),_0x428fcb);if(_0x2e85d2[_0xb534('0x3e')][_0xb534('0x4a')]){_0x5bc8b0['where']=_[_0xb534('0x4b')](_0x5bc8b0[_0xb534('0x47')],{'$or':_[_0xb534('0x38')](_0x428fcb,function(_0x114624){if(_0x114624[_0xb534('0x3c')]!==_0xb534('0x4c')){var _0x5e95ab={};_0x5e95ab[_0x114624[_0xb534('0x36')]]={'$like':'%'+_0x2e85d2[_0xb534('0x3e')][_0xb534('0x4a')]+'%'};return _0x5e95ab;}})});}_0x5bc8b0=_[_0xb534('0x4b')]({},_0x5bc8b0,_0x2e85d2[_0xb534('0x4d')]);var _0x10f840={'where':_0x5bc8b0[_0xb534('0x47')]};return db[_0xb534('0x39')][_0xb534('0x2c')](_0x10f840)[_0xb534('0x34')](function(_0x4d8ea5){_0x56466c[_0xb534('0x2c')]=_0x4d8ea5;if(_0x2e85d2['query'][_0xb534('0x4e')]){_0x5bc8b0[_0xb534('0x4f')]=[{'all':!![]}];}return db[_0xb534('0x39')][_0xb534('0x50')](_0x5bc8b0);})[_0xb534('0x34')](function(_0x47a3d8){_0x56466c[_0xb534('0x51')]=_0x47a3d8;return _0x56466c;})['then'](respondWithFilteredResult(_0x7582d7,_0x5bc8b0))[_0xb534('0x27')](handleError(_0x7582d7,null));};exports[_0xb534('0x52')]=function(_0x7ae1f1,_0x2970da){var _0x23c279={'raw':![],'where':{'id':_0x7ae1f1[_0xb534('0x53')]['id']}},_0x2af3cc={};_0x2af3cc[_0xb534('0x3d')]=_['keys'](db[_0xb534('0x39')]['rawAttributes']);_0x2af3cc[_0xb534('0x3e')]=_[_0xb534('0x3f')](_0x7ae1f1[_0xb534('0x3e')]);_0x2af3cc['filters']=_[_0xb534('0x40')](_0x2af3cc[_0xb534('0x3d')],_0x2af3cc[_0xb534('0x3e')]);_0x23c279[_0xb534('0x41')]=_['intersection'](_0x2af3cc['model'],qs['fields'](_0x7ae1f1[_0xb534('0x3e')][_0xb534('0x42')]));_0x23c279[_0xb534('0x41')]=_0x23c279[_0xb534('0x41')]['length']?_0x23c279['attributes']:_0x2af3cc[_0xb534('0x3d')];if(_0x7ae1f1[_0xb534('0x3e')][_0xb534('0x4e')]){_0x23c279[_0xb534('0x4f')]=[{'all':!![]}];}_0x23c279=_[_0xb534('0x4b')]({},_0x23c279,_0x7ae1f1['options']);return db[_0xb534('0x39')][_0xb534('0x54')](_0x23c279)['then'](handleEntityNotFound(_0x2970da,null))['then'](respondWithResult(_0x2970da,null))['catch'](handleError(_0x2970da,null));};exports[_0xb534('0x55')]=function(_0x4c299a,_0x62fe6e){return db[_0xb534('0x39')][_0xb534('0x55')](_0x4c299a['body'],{})[_0xb534('0x34')](respondWithResult(_0x62fe6e,0xc9))[_0xb534('0x27')](handleError(_0x62fe6e,null));};exports[_0xb534('0x33')]=function(_0x36a55e,_0x5ac7c9){if(_0x36a55e['body']['id']){delete _0x36a55e[_0xb534('0x56')]['id'];}return db[_0xb534('0x39')][_0xb534('0x54')]({'where':{'id':_0x36a55e['params']['id']}})[_0xb534('0x34')](handleEntityNotFound(_0x5ac7c9,null))[_0xb534('0x34')](saveUpdates(_0x36a55e['body'],null))[_0xb534('0x34')](respondWithResult(_0x5ac7c9,null))[_0xb534('0x27')](handleError(_0x5ac7c9,null));};exports[_0xb534('0x35')]=function(_0x42cfb8,_0x529b0b){return db[_0xb534('0x39')][_0xb534('0x54')]({'where':{'id':_0x42cfb8['params']['id']}})[_0xb534('0x34')](handleEntityNotFound(_0x529b0b,null))[_0xb534('0x34')](removeEntity(_0x529b0b,null))['catch'](handleError(_0x529b0b,null));};exports['getConfigurations']=function(_0x397829,_0x30c7a6,_0x42ac1e){var _0x27c960={};var _0x37569b={};var _0x4f81e3;var _0x2970eb;return db[_0xb534('0x39')][_0xb534('0x57')]({'where':{'id':_0x397829[_0xb534('0x53')]['id']}})['then'](handleEntityNotFound(_0x30c7a6,null))[_0xb534('0x34')](function(_0x5c2c70){if(_0x5c2c70){_0x4f81e3=_0x5c2c70;_0x37569b[_0xb534('0x3d')]=_[_0xb534('0x3f')](db[_0xb534('0x58')]['rawAttributes']);_0x37569b[_0xb534('0x3e')]=_[_0xb534('0x3f')](_0x397829[_0xb534('0x3e')]);_0x37569b[_0xb534('0x48')]=_[_0xb534('0x40')](_0x37569b[_0xb534('0x3d')],_0x37569b[_0xb534('0x3e')]);_0x27c960[_0xb534('0x41')]=_[_0xb534('0x40')](_0x37569b[_0xb534('0x3d')],qs[_0xb534('0x42')](_0x397829[_0xb534('0x3e')]['fields']));_0x27c960[_0xb534('0x41')]=_0x27c960['attributes'][_0xb534('0x43')]?_0x27c960[_0xb534('0x41')]:_0x37569b[_0xb534('0x3d')];_0x27c960[_0xb534('0x59')]=qs[_0xb534('0x46')](_0x397829[_0xb534('0x3e')]['sort']);_0x27c960[_0xb534('0x47')]=qs[_0xb534('0x48')](_[_0xb534('0x49')](_0x397829[_0xb534('0x3e')],_0x37569b[_0xb534('0x48')]));if(_0x397829[_0xb534('0x3e')]['filter']){_0x27c960[_0xb534('0x47')]=_[_0xb534('0x4b')](_0x27c960['where'],{'$or':_[_0xb534('0x38')](_0x27c960[_0xb534('0x41')],function(_0x1d7802){var _0x521b4b={};_0x521b4b[_0x1d7802]={'$like':'%'+_0x397829[_0xb534('0x3e')][_0xb534('0x4a')]+'%'};return _0x521b4b;})});}_0x27c960=_[_0xb534('0x4b')]({},_0x27c960,_0x397829[_0xb534('0x4d')]);return _0x4f81e3[_0xb534('0x5a')](_0x27c960);}})[_0xb534('0x34')](function(_0x327520){if(_0x327520){_0x2970eb=_0x327520[_0xb534('0x43')];if(!_0x397829[_0xb534('0x3e')]['hasOwnProperty']('nolimit')){_0x27c960['limit']=qs[_0xb534('0x45')](_0x397829[_0xb534('0x3e')][_0xb534('0x45')]);_0x27c960[_0xb534('0x2d')]=qs[_0xb534('0x2d')](_0x397829[_0xb534('0x3e')][_0xb534('0x2d')]);}return _0x4f81e3[_0xb534('0x5a')](_0x27c960);}})[_0xb534('0x34')](function(_0x565469){if(_0x565469){return _0x565469?{'count':_0x2970eb,'rows':_0x565469}:null;}})['then'](respondWithResult(_0x30c7a6,null))[_0xb534('0x27')](handleError(_0x30c7a6,null));};exports[_0xb534('0x5b')]=function(_0x2f5436,_0x337ebc,_0x1b8a11){if(_0x2f5436[_0xb534('0x56')]['id']){delete _0x2f5436[_0xb534('0x56')]['id'];}return db[_0xb534('0x39')][_0xb534('0x57')]({'where':{'id':_0x2f5436[_0xb534('0x53')]['id']}})[_0xb534('0x34')](handleEntityNotFound(_0x337ebc,null))['then'](function(_0xae4a02){if(_0xae4a02){_0x2f5436[_0xb534('0x56')]['AccountId']=_0xae4a02['id'];_0x2f5436[_0xb534('0x56')][_0xb534('0x5c')]=integrations[_0xb534('0x5d')](_0x2f5436[_0xb534('0x56')][_0xb534('0x5e')],_0x2f5436['body'][_0xb534('0x3c')]);_0x2f5436[_0xb534('0x56')][_0xb534('0x5f')]=integrations[_0xb534('0x60')](_0x2f5436[_0xb534('0x56')]['channel'],_0x2f5436['body']['type']);return db['VtigerConfiguration'][_0xb534('0x55')](_0x2f5436[_0xb534('0x56')],{'include':[{'model':db[_0xb534('0x61')],'as':_0xb534('0x5c')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0xb534('0x34')](respondWithResult(_0x337ebc,null))['catch'](handleError(_0x337ebc,null));};var md5=require(_0xb534('0x62'));exports[_0xb534('0x63')]=function(_0xb881a5,_0x478879,_0x54fb88){var _0x1dd18b=null;var _0x1eba88=null;var _0xa7de33=null;var _0x1e37c1=null;var _0x11cca3='';return db[_0xb534('0x39')][_0xb534('0x57')]({'where':{'id':_0xb881a5[_0xb534('0x53')]['id']},'attributes':['id','name',_0xb534('0x64'),_0xb534('0x65'),'moduleName',_0xb534('0x66'),_0xb534('0x67'),_0xb534('0x68')]})['then'](handleEntityNotFound(_0x478879,null))[_0xb534('0x34')](function(_0x37358e){if(_0x37358e){_0x1dd18b=_0x37358e[_0xb534('0x64')];_0x1eba88=_0x37358e[_0xb534('0x68')];_0xa7de33=_0x37358e['moduleName'];_0x11cca3=_0x37358e[_0xb534('0x66')];var _0x257277=_0x11cca3['slice'](-0x1);if(_0x257277==='/'){_0x11cca3=_0x11cca3[_0xb534('0x69')](0x0,_0x11cca3[_0xb534('0x6a')](_0x257277));}_0x1e37c1=util[_0xb534('0x6b')]('%s/webservice.php',_0x11cca3);var _0x273455={'method':'GET','uri':_0x1e37c1,'qs':{'operation':_0xb534('0x6c'),'username':_0x37358e[_0xb534('0x64')]},'json':!![]};return rp(_0x273455);}})[_0xb534('0x34')](function(_0x5b374f){if(_0x5b374f[_0xb534('0x6d')]){var _0x204f8d={'method':_0xb534('0x6e'),'uri':_0x1e37c1,'form':{'operation':_0xb534('0x6f'),'username':_0x1dd18b,'accessKey':md5(_0x5b374f[_0xb534('0x26')]['token']+_0x1eba88)},'json':!![]};return rp(_0x204f8d);}})[_0xb534('0x34')](function(_0x26a18d){if(_0x26a18d[_0xb534('0x6d')]){var _0x2cb3ef={'method':_0xb534('0x70'),'uri':_0x1e37c1,'qs':{'operation':_0xb534('0x71'),'username':_0x1dd18b,'sessionName':_0x26a18d[_0xb534('0x26')][_0xb534('0x72')],'elementType':_0xa7de33},'json':!![]};return rp(_0x2cb3ef);}})[_0xb534('0x34')](function(_0xda7e8c){if(_0xda7e8c[_0xb534('0x6d')]){var _0x39ff78=[_0xb534('0x73'),_0xb534('0x74'),_0xb534('0x75')];_[_0xb534('0x76')](_0xda7e8c[_0xb534('0x26')][_0xb534('0x42')],function(_0x2f1030){return _0x39ff78[_0xb534('0x77')](_0x2f1030[_0xb534('0x3c')][_0xb534('0x36')]);});_['remove'](_0xda7e8c[_0xb534('0x26')]['fields'],function(_0x2cd0cb){return _0x2cd0cb[_0xb534('0x78')]===_0xb534('0x79');});return{'count':_0xda7e8c[_0xb534('0x26')]['fields'][_0xb534('0x43')],'rows':_['map'](_0xda7e8c[_0xb534('0x26')]['fields'],function(_0x1a1486){return{'id':_0x1a1486['name'],'name':_0x1a1486[_0xb534('0x7a')],'custom':_[_0xb534('0x7b')](_0x1a1486['name'],_0xb534('0x7c'))?!![]:![],'options':_0x1a1486[_0xb534('0x3c')][_0xb534('0x36')]===_0xb534('0x7d')&&_0x1a1486[_0xb534('0x3c')][_0xb534('0x7e')][_0xb534('0x43')]>0x0?_[_0xb534('0x38')](_0x1a1486[_0xb534('0x3c')]['picklistValues'],function(_0x1a8b19){return{'name':_0x1a8b19['label'],'value':_0x1a8b19[_0xb534('0x7f')]};}):[]};})};}})['then'](respondWithResult(_0x478879,null))[_0xb534('0x27')](function(_0x15dc23){console[_0xb534('0x80')]('vTiger\x20error:\x20'+_0x15dc23);var _0x1bfd47=_0xb881a5[_0xb534('0x3e')][_0xb534('0x81')]?0x1f4:_0x15dc23[_0xb534('0x82')]||0x1f4;logger['error'](_0xb534('0x83'),'getFields',_0x1bfd47,JSON['stringify'](_0x15dc23));delete _0x15dc23[_0xb534('0x36')];if(_0x1bfd47===0x191){_0x1bfd47=0x190;}_0x478879[_0xb534('0x29')](_0x1bfd47)['send'](_0xb881a5[_0xb534('0x3e')][_0xb534('0x81')]?{'message':_0xb534('0x84'),'statusCode':_0x15dc23['statusCode']}:_0x15dc23);});}; \ No newline at end of file +var _0x6d03=['end','name','send','index','VtigerAccount','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','options','include','rows','show','keys','includeAll','find','create','body','update','params','getConfigurations','findOne','VtigerConfiguration','pick','nolimit','addConfiguration','AccountId','getSubjects','channel','getDescriptions','VtigerField','Subjects','Descriptions','username','description','serverUrl','accessKey','remoteUri','slice','substring','lastIndexOf','%s/webservice.php','GET','success','POST','login','token','describe','sessionName','autogenerated','reference','owner','includes','remove','editable','false','label','startsWith','cf_','picklist','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','destroy'];(function(_0x65cd03,_0x2913ee){var _0x21c579=function(_0xee6ad4){while(--_0xee6ad4){_0x65cd03['push'](_0x65cd03['shift']());}};_0x21c579(++_0x2913ee);}(_0x6d03,0x1df));var _0x36d0=function(_0x1bc07f,_0x8c879){_0x1bc07f=_0x1bc07f-0x0;var _0x52508e=_0x6d03[_0x1bc07f];return _0x52508e;};'use strict';var pdf=require(_0x36d0('0x0'));var emlformat=require(_0x36d0('0x1'));var rimraf=require(_0x36d0('0x2'));var zipdir=require(_0x36d0('0x3'));var jsonpatch=require(_0x36d0('0x4'));var rp=require(_0x36d0('0x5'));var moment=require('moment');var BPromise=require(_0x36d0('0x6'));var Mustache=require(_0x36d0('0x7'));var util=require(_0x36d0('0x8'));var path=require(_0x36d0('0x9'));var sox=require(_0x36d0('0xa'));var csv=require(_0x36d0('0xb'));var ejs=require(_0x36d0('0xc'));var fs=require('fs');var _=require(_0x36d0('0xd'));var squel=require(_0x36d0('0xe'));var crypto=require('crypto');var jsforce=require(_0x36d0('0xf'));var deskjs=require(_0x36d0('0x10'));var toCsv=require(_0x36d0('0xb'));var querystring=require(_0x36d0('0x11'));var Papa=require(_0x36d0('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x36d0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x36d0('0x14'));var licenseUtil=require(_0x36d0('0x15'));var db=require(_0x36d0('0x16'))['db'];var integrations=require(_0x36d0('0x17'));var jayson=require(_0x36d0('0x18'));var client=jayson[_0x36d0('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x588cb2,_0x596580,_0x18abca,_0x249776){return new BPromise(function(_0x4953c3,_0xa3159f){var _0x29c098=_0x249776||client;return _0x29c098['request'](_0x588cb2,_0x18abca)[_0x36d0('0x1a')](function(_0x229369){logger[_0x36d0('0x1b')](_0x36d0('0x1c'),_0x596580,_0x36d0('0x1d'));logger[_0x36d0('0x1e')](_0x36d0('0x1f'),_0x596580,_0x36d0('0x1d'),JSON[_0x36d0('0x20')](_0x229369));if(_0x229369[_0x36d0('0x21')]){if(_0x229369[_0x36d0('0x21')][_0x36d0('0x22')]===0x1f4){logger[_0x36d0('0x21')](_0x36d0('0x1c'),_0x596580,_0x229369[_0x36d0('0x21')][_0x36d0('0x23')]);return _0xa3159f(_0x229369[_0x36d0('0x21')][_0x36d0('0x23')]);}logger[_0x36d0('0x21')](_0x36d0('0x1c'),_0x596580,_0x229369[_0x36d0('0x21')][_0x36d0('0x23')]);return _0x4953c3(_0x229369[_0x36d0('0x21')][_0x36d0('0x23')]);}else{logger[_0x36d0('0x1b')]('VtigerAccount,\x20%s,\x20%s',_0x596580,_0x36d0('0x1d'));_0x4953c3(_0x229369[_0x36d0('0x24')][_0x36d0('0x23')]);}})[_0x36d0('0x25')](function(_0x401ed8){logger[_0x36d0('0x21')](_0x36d0('0x1c'),_0x596580,_0x401ed8);_0xa3159f(_0x401ed8);});});}function respondWithStatusCode(_0x5881d8,_0x24d9a9){_0x24d9a9=_0x24d9a9||0xcc;return function(_0x147273){if(_0x147273){return _0x5881d8[_0x36d0('0x26')](_0x24d9a9);}return _0x5881d8['status'](_0x24d9a9)['end']();};}function respondWithResult(_0x5ee822,_0x3f344c){_0x3f344c=_0x3f344c||0xc8;return function(_0x582ff6){if(_0x582ff6){return _0x5ee822[_0x36d0('0x27')](_0x3f344c)[_0x36d0('0x28')](_0x582ff6);}};}function respondWithFilteredResult(_0x3bd1a5,_0x5cbc0f){return function(_0x320420){if(_0x320420){var _0x2c6c58=_0x320420[_0x36d0('0x29')],_0x34702f=_0x5cbc0f[_0x36d0('0x2a')],_0x624ca2=_0x5cbc0f[_0x36d0('0x2a')]+_0x5cbc0f[_0x36d0('0x2b')],_0x35dee7;if(_0x624ca2>=_0x2c6c58){_0x624ca2=_0x2c6c58;_0x35dee7=0xc8;}else{_0x35dee7=0xce;}_0x3bd1a5[_0x36d0('0x27')](_0x35dee7);return _0x3bd1a5[_0x36d0('0x2c')](_0x36d0('0x2d'),_0x34702f+'-'+_0x624ca2+'/'+_0x2c6c58)[_0x36d0('0x28')](_0x320420);}return null;};}function patchUpdates(_0xbd9950){return function(_0x4ad942){try{jsonpatch['apply'](_0x4ad942,_0xbd9950,!![]);}catch(_0x51ad32){return BPromise[_0x36d0('0x2e')](_0x51ad32);}return _0x4ad942[_0x36d0('0x2f')]();};}function saveUpdates(_0x6fe2b,_0x1882f0){return function(_0x4c1b22){if(_0x4c1b22){return _0x4c1b22['update'](_0x6fe2b)[_0x36d0('0x1a')](function(_0x10c766){return _0x10c766;});}return null;};}function removeEntity(_0x2889f1,_0x10cf0c){return function(_0x27cbe6){if(_0x27cbe6){return _0x27cbe6[_0x36d0('0x30')]()['then'](function(){_0x2889f1['status'](0xcc)[_0x36d0('0x31')]();});}};}function handleEntityNotFound(_0x1fb1dd,_0x5e0f8e){return function(_0x3abe94){if(!_0x3abe94){_0x1fb1dd[_0x36d0('0x26')](0x194);}return _0x3abe94;};}function handleError(_0x295725,_0x45c9d6){_0x45c9d6=_0x45c9d6||0x1f4;return function(_0x555229){logger[_0x36d0('0x21')](_0x555229['stack']);if(_0x555229[_0x36d0('0x32')]){delete _0x555229['name'];}_0x295725[_0x36d0('0x27')](_0x45c9d6)[_0x36d0('0x33')](_0x555229);};}exports[_0x36d0('0x34')]=function(_0x1c70da,_0x73d66e){var _0x5eb333={},_0x2d2043={},_0x5c9b9f={'count':0x0,'rows':[]};var _0xa284cc=_['map'](db[_0x36d0('0x35')][_0x36d0('0x36')],function(_0x28a3ee){return{'name':_0x28a3ee[_0x36d0('0x37')],'type':_0x28a3ee['type'][_0x36d0('0x38')]};});_0x2d2043[_0x36d0('0x39')]=_[_0x36d0('0x3a')](_0xa284cc,_0x36d0('0x32'));_0x2d2043['query']=_['keys'](_0x1c70da[_0x36d0('0x3b')]);_0x2d2043[_0x36d0('0x3c')]=_[_0x36d0('0x3d')](_0x2d2043[_0x36d0('0x39')],_0x2d2043[_0x36d0('0x3b')]);_0x5eb333[_0x36d0('0x3e')]=_[_0x36d0('0x3d')](_0x2d2043['model'],qs['fields'](_0x1c70da[_0x36d0('0x3b')][_0x36d0('0x3f')]));_0x5eb333[_0x36d0('0x3e')]=_0x5eb333[_0x36d0('0x3e')][_0x36d0('0x40')]?_0x5eb333['attributes']:_0x2d2043[_0x36d0('0x39')];if(!_0x1c70da[_0x36d0('0x3b')][_0x36d0('0x41')]('nolimit')){_0x5eb333['limit']=qs[_0x36d0('0x2b')](_0x1c70da[_0x36d0('0x3b')][_0x36d0('0x2b')]);_0x5eb333[_0x36d0('0x2a')]=qs['offset'](_0x1c70da[_0x36d0('0x3b')][_0x36d0('0x2a')]);}_0x5eb333[_0x36d0('0x42')]=qs[_0x36d0('0x43')](_0x1c70da[_0x36d0('0x3b')]['sort']);_0x5eb333[_0x36d0('0x44')]=qs[_0x36d0('0x3c')](_['pick'](_0x1c70da[_0x36d0('0x3b')],_0x2d2043[_0x36d0('0x3c')]),_0xa284cc);if(_0x1c70da[_0x36d0('0x3b')][_0x36d0('0x45')]){_0x5eb333['where']=_['merge'](_0x5eb333[_0x36d0('0x44')],{'$or':_['map'](_0xa284cc,function(_0x3c04ba){if(_0x3c04ba[_0x36d0('0x46')]!==_0x36d0('0x47')){var _0x3808a6={};_0x3808a6[_0x3c04ba['name']]={'$like':'%'+_0x1c70da['query'][_0x36d0('0x45')]+'%'};return _0x3808a6;}})});}_0x5eb333=_[_0x36d0('0x48')]({},_0x5eb333,_0x1c70da[_0x36d0('0x49')]);var _0x4cb70e={'where':_0x5eb333['where']};return db[_0x36d0('0x35')][_0x36d0('0x29')](_0x4cb70e)[_0x36d0('0x1a')](function(_0x35a5e7){_0x5c9b9f[_0x36d0('0x29')]=_0x35a5e7;if(_0x1c70da[_0x36d0('0x3b')]['includeAll']){_0x5eb333[_0x36d0('0x4a')]=[{'all':!![]}];}return db[_0x36d0('0x35')]['findAll'](_0x5eb333);})['then'](function(_0x1a7538){_0x5c9b9f[_0x36d0('0x4b')]=_0x1a7538;return _0x5c9b9f;})[_0x36d0('0x1a')](respondWithFilteredResult(_0x73d66e,_0x5eb333))['catch'](handleError(_0x73d66e,null));};exports[_0x36d0('0x4c')]=function(_0x14acb0,_0x41e3e7){var _0x519097={'raw':![],'where':{'id':_0x14acb0['params']['id']}},_0x55c8a3={};_0x55c8a3[_0x36d0('0x39')]=_[_0x36d0('0x4d')](db[_0x36d0('0x35')][_0x36d0('0x36')]);_0x55c8a3['query']=_['keys'](_0x14acb0[_0x36d0('0x3b')]);_0x55c8a3['filters']=_[_0x36d0('0x3d')](_0x55c8a3[_0x36d0('0x39')],_0x55c8a3[_0x36d0('0x3b')]);_0x519097[_0x36d0('0x3e')]=_[_0x36d0('0x3d')](_0x55c8a3['model'],qs[_0x36d0('0x3f')](_0x14acb0[_0x36d0('0x3b')][_0x36d0('0x3f')]));_0x519097[_0x36d0('0x3e')]=_0x519097[_0x36d0('0x3e')][_0x36d0('0x40')]?_0x519097['attributes']:_0x55c8a3[_0x36d0('0x39')];if(_0x14acb0[_0x36d0('0x3b')][_0x36d0('0x4e')]){_0x519097[_0x36d0('0x4a')]=[{'all':!![]}];}_0x519097=_[_0x36d0('0x48')]({},_0x519097,_0x14acb0['options']);return db['VtigerAccount'][_0x36d0('0x4f')](_0x519097)[_0x36d0('0x1a')](handleEntityNotFound(_0x41e3e7,null))[_0x36d0('0x1a')](respondWithResult(_0x41e3e7,null))['catch'](handleError(_0x41e3e7,null));};exports[_0x36d0('0x50')]=function(_0x51bd7a,_0x110024){return db[_0x36d0('0x35')]['create'](_0x51bd7a[_0x36d0('0x51')],{})[_0x36d0('0x1a')](respondWithResult(_0x110024,0xc9))['catch'](handleError(_0x110024,null));};exports[_0x36d0('0x52')]=function(_0xa50f9a,_0x25f04f){if(_0xa50f9a[_0x36d0('0x51')]['id']){delete _0xa50f9a['body']['id'];}return db['VtigerAccount']['find']({'where':{'id':_0xa50f9a[_0x36d0('0x53')]['id']}})[_0x36d0('0x1a')](handleEntityNotFound(_0x25f04f,null))[_0x36d0('0x1a')](saveUpdates(_0xa50f9a['body'],null))[_0x36d0('0x1a')](respondWithResult(_0x25f04f,null))[_0x36d0('0x25')](handleError(_0x25f04f,null));};exports[_0x36d0('0x30')]=function(_0xace7c3,_0x7301da){return db['VtigerAccount'][_0x36d0('0x4f')]({'where':{'id':_0xace7c3[_0x36d0('0x53')]['id']}})[_0x36d0('0x1a')](handleEntityNotFound(_0x7301da,null))[_0x36d0('0x1a')](removeEntity(_0x7301da,null))[_0x36d0('0x25')](handleError(_0x7301da,null));};exports[_0x36d0('0x54')]=function(_0x5bbafb,_0x3f6c04,_0xe5b9a0){var _0x27439d={};var _0x49242c={};var _0x41f05c;var _0x10d60d;return db[_0x36d0('0x35')][_0x36d0('0x55')]({'where':{'id':_0x5bbafb[_0x36d0('0x53')]['id']}})[_0x36d0('0x1a')](handleEntityNotFound(_0x3f6c04,null))[_0x36d0('0x1a')](function(_0x34625d){if(_0x34625d){_0x41f05c=_0x34625d;_0x49242c[_0x36d0('0x39')]=_[_0x36d0('0x4d')](db[_0x36d0('0x56')][_0x36d0('0x36')]);_0x49242c[_0x36d0('0x3b')]=_[_0x36d0('0x4d')](_0x5bbafb[_0x36d0('0x3b')]);_0x49242c['filters']=_[_0x36d0('0x3d')](_0x49242c[_0x36d0('0x39')],_0x49242c[_0x36d0('0x3b')]);_0x27439d[_0x36d0('0x3e')]=_[_0x36d0('0x3d')](_0x49242c[_0x36d0('0x39')],qs[_0x36d0('0x3f')](_0x5bbafb[_0x36d0('0x3b')][_0x36d0('0x3f')]));_0x27439d['attributes']=_0x27439d[_0x36d0('0x3e')][_0x36d0('0x40')]?_0x27439d['attributes']:_0x49242c[_0x36d0('0x39')];_0x27439d[_0x36d0('0x42')]=qs[_0x36d0('0x43')](_0x5bbafb['query'][_0x36d0('0x43')]);_0x27439d[_0x36d0('0x44')]=qs[_0x36d0('0x3c')](_[_0x36d0('0x57')](_0x5bbafb[_0x36d0('0x3b')],_0x49242c['filters']));if(_0x5bbafb[_0x36d0('0x3b')][_0x36d0('0x45')]){_0x27439d[_0x36d0('0x44')]=_[_0x36d0('0x48')](_0x27439d[_0x36d0('0x44')],{'$or':_[_0x36d0('0x3a')](_0x27439d['attributes'],function(_0x2ed143){var _0x21c92e={};_0x21c92e[_0x2ed143]={'$like':'%'+_0x5bbafb[_0x36d0('0x3b')][_0x36d0('0x45')]+'%'};return _0x21c92e;})});}_0x27439d=_[_0x36d0('0x48')]({},_0x27439d,_0x5bbafb[_0x36d0('0x49')]);return _0x41f05c[_0x36d0('0x54')](_0x27439d);}})[_0x36d0('0x1a')](function(_0x142809){if(_0x142809){_0x10d60d=_0x142809[_0x36d0('0x40')];if(!_0x5bbafb[_0x36d0('0x3b')][_0x36d0('0x41')](_0x36d0('0x58'))){_0x27439d[_0x36d0('0x2b')]=qs[_0x36d0('0x2b')](_0x5bbafb[_0x36d0('0x3b')][_0x36d0('0x2b')]);_0x27439d[_0x36d0('0x2a')]=qs[_0x36d0('0x2a')](_0x5bbafb[_0x36d0('0x3b')][_0x36d0('0x2a')]);}return _0x41f05c['getConfigurations'](_0x27439d);}})[_0x36d0('0x1a')](function(_0x9272c6){if(_0x9272c6){return _0x9272c6?{'count':_0x10d60d,'rows':_0x9272c6}:null;}})[_0x36d0('0x1a')](respondWithResult(_0x3f6c04,null))[_0x36d0('0x25')](handleError(_0x3f6c04,null));};exports[_0x36d0('0x59')]=function(_0x21272e,_0x12ba11,_0x27a75d){if(_0x21272e[_0x36d0('0x51')]['id']){delete _0x21272e['body']['id'];}return db[_0x36d0('0x35')][_0x36d0('0x55')]({'where':{'id':_0x21272e['params']['id']}})[_0x36d0('0x1a')](handleEntityNotFound(_0x12ba11,null))[_0x36d0('0x1a')](function(_0x48db4f){if(_0x48db4f){_0x21272e[_0x36d0('0x51')][_0x36d0('0x5a')]=_0x48db4f['id'];_0x21272e[_0x36d0('0x51')]['Subjects']=integrations[_0x36d0('0x5b')](_0x21272e[_0x36d0('0x51')][_0x36d0('0x5c')],_0x21272e['body'][_0x36d0('0x46')]);_0x21272e[_0x36d0('0x51')]['Descriptions']=integrations[_0x36d0('0x5d')](_0x21272e[_0x36d0('0x51')]['channel'],_0x21272e[_0x36d0('0x51')][_0x36d0('0x46')]);return db[_0x36d0('0x56')][_0x36d0('0x50')](_0x21272e[_0x36d0('0x51')],{'include':[{'model':db[_0x36d0('0x5e')],'as':_0x36d0('0x5f')},{'model':db[_0x36d0('0x5e')],'as':_0x36d0('0x60')}]});}return null;})['then'](respondWithResult(_0x12ba11,null))[_0x36d0('0x25')](handleError(_0x12ba11,null));};var md5=require('md5');exports['getFields']=function(_0x1f1b74,_0x442f4b,_0x42eb96){var _0x314749=null;var _0x5f0409=null;var _0x49479b=null;var _0x4c40d0=null;var _0x1353af='';return db[_0x36d0('0x35')][_0x36d0('0x55')]({'where':{'id':_0x1f1b74[_0x36d0('0x53')]['id']},'attributes':['id','name',_0x36d0('0x61'),_0x36d0('0x62'),'moduleName','remoteUri',_0x36d0('0x63'),_0x36d0('0x64')]})['then'](handleEntityNotFound(_0x442f4b,null))[_0x36d0('0x1a')](function(_0x312721){if(_0x312721){_0x314749=_0x312721[_0x36d0('0x61')];_0x5f0409=_0x312721['accessKey'];_0x49479b=_0x312721['moduleName'];_0x1353af=_0x312721[_0x36d0('0x65')];var _0x103ab3=_0x1353af[_0x36d0('0x66')](-0x1);if(_0x103ab3==='/'){_0x1353af=_0x1353af[_0x36d0('0x67')](0x0,_0x1353af[_0x36d0('0x68')](_0x103ab3));}_0x4c40d0=util['format'](_0x36d0('0x69'),_0x1353af);var _0x31244a={'method':_0x36d0('0x6a'),'uri':_0x4c40d0,'qs':{'operation':'getchallenge','username':_0x312721[_0x36d0('0x61')]},'json':!![]};return rp(_0x31244a);}})[_0x36d0('0x1a')](function(_0x8fff36){if(_0x8fff36[_0x36d0('0x6b')]){var _0x57430e={'method':_0x36d0('0x6c'),'uri':_0x4c40d0,'form':{'operation':_0x36d0('0x6d'),'username':_0x314749,'accessKey':md5(_0x8fff36[_0x36d0('0x24')][_0x36d0('0x6e')]+_0x5f0409)},'json':!![]};return rp(_0x57430e);}})[_0x36d0('0x1a')](function(_0x3d921c){if(_0x3d921c[_0x36d0('0x6b')]){var _0x3b0b98={'method':'GET','uri':_0x4c40d0,'qs':{'operation':_0x36d0('0x6f'),'username':_0x314749,'sessionName':_0x3d921c[_0x36d0('0x24')][_0x36d0('0x70')],'elementType':_0x49479b},'json':!![]};return rp(_0x3b0b98);}})[_0x36d0('0x1a')](function(_0x39e48b){if(_0x39e48b[_0x36d0('0x6b')]){var _0x27a7e5=[_0x36d0('0x71'),_0x36d0('0x72'),_0x36d0('0x73')];_['remove'](_0x39e48b[_0x36d0('0x24')][_0x36d0('0x3f')],function(_0xb6cb6){return _0x27a7e5[_0x36d0('0x74')](_0xb6cb6['type'][_0x36d0('0x32')]);});_[_0x36d0('0x75')](_0x39e48b[_0x36d0('0x24')][_0x36d0('0x3f')],function(_0x55150f){return _0x55150f[_0x36d0('0x76')]===_0x36d0('0x77');});return{'count':_0x39e48b['result'][_0x36d0('0x3f')][_0x36d0('0x40')],'rows':_['map'](_0x39e48b['result'][_0x36d0('0x3f')],function(_0x4006e4){return{'id':_0x4006e4['name'],'name':_0x4006e4[_0x36d0('0x78')],'custom':_[_0x36d0('0x79')](_0x4006e4['name'],_0x36d0('0x7a'))?!![]:![],'options':_0x4006e4[_0x36d0('0x46')][_0x36d0('0x32')]===_0x36d0('0x7b')&&_0x4006e4[_0x36d0('0x46')]['picklistValues'][_0x36d0('0x40')]>0x0?_['map'](_0x4006e4[_0x36d0('0x46')]['picklistValues'],function(_0x539992){return{'name':_0x539992[_0x36d0('0x78')],'value':_0x539992[_0x36d0('0x7c')]};}):[]};})};}})['then'](respondWithResult(_0x442f4b,null))['catch'](function(_0x297768){console[_0x36d0('0x7d')](_0x36d0('0x7e')+_0x297768);var _0x220f9d=_0x1f1b74[_0x36d0('0x3b')][_0x36d0('0x7f')]?0x1f4:_0x297768[_0x36d0('0x80')]||0x1f4;logger[_0x36d0('0x21')](_0x36d0('0x81'),_0x36d0('0x82'),_0x220f9d,JSON[_0x36d0('0x20')](_0x297768));delete _0x297768[_0x36d0('0x32')];if(_0x220f9d===0x191){_0x220f9d=0x190;}_0x442f4b[_0x36d0('0x27')](_0x220f9d)[_0x36d0('0x33')](_0x1f1b74[_0x36d0('0x3b')][_0x36d0('0x7f')]?{'message':_0x36d0('0x83'),'statusCode':_0x297768[_0x36d0('0x80')]}:_0x297768);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 9d62203..ded52f2 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 _0xacb2=['api','moment','bluebird','request-promise','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','int_vtiger_accounts','lodash','util','../../config/logger'];(function(_0x5bc5f6,_0x72ef81){var _0x3c22c1=function(_0x551c2f){while(--_0x551c2f){_0x5bc5f6['push'](_0x5bc5f6['shift']());}};_0x3c22c1(++_0x72ef81);}(_0xacb2,0xc0));var _0x2acb=function(_0x4dcd1e,_0x7475df){_0x4dcd1e=_0x4dcd1e-0x0;var _0x48623f=_0xacb2[_0x4dcd1e];return _0x48623f;};'use strict';var _=require(_0x2acb('0x0'));var util=require(_0x2acb('0x1'));var logger=require(_0x2acb('0x2'))(_0x2acb('0x3'));var moment=require(_0x2acb('0x4'));var BPromise=require(_0x2acb('0x5'));var rp=require(_0x2acb('0x6'));var fs=require('fs');var path=require(_0x2acb('0x7'));var rimraf=require(_0x2acb('0x8'));var config=require('../../config/environment');var attributes=require(_0x2acb('0x9'));var integrations=require(_0x2acb('0xa'));module[_0x2acb('0xb')]=function(_0x30adcc,_0x29533b){return _0x30adcc['define']('VtigerAccount',attributes,{'tableName':_0x2acb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab94=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','VtigerAccount','int_vtiger_accounts','util','../../config/logger'];(function(_0x1179a6,_0x24c686){var _0x3b4810=function(_0x3207ba){while(--_0x3207ba){_0x1179a6['push'](_0x1179a6['shift']());}};_0x3b4810(++_0x24c686);}(_0xab94,0x1a2));var _0x4ab9=function(_0x48be08,_0x164a3f){_0x48be08=_0x48be08-0x0;var _0x515166=_0xab94[_0x48be08];return _0x515166;};'use strict';var _=require('lodash');var util=require(_0x4ab9('0x0'));var logger=require(_0x4ab9('0x1'))(_0x4ab9('0x2'));var moment=require(_0x4ab9('0x3'));var BPromise=require('bluebird');var rp=require(_0x4ab9('0x4'));var fs=require('fs');var path=require(_0x4ab9('0x5'));var rimraf=require(_0x4ab9('0x6'));var config=require(_0x4ab9('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x4ab9('0x8')]=function(_0x3d8454,_0x58ac8a){return _0x3d8454[_0x4ab9('0x9')](_0x4ab9('0xa'),attributes,{'tableName':_0x4ab9('0xb'),'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 7a7d249..e64bbda 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 _0xf24b=['where','attributes','include','map','model','debug','ShowVtigerAccount','VtigerAccount','find','lodash','util','bluebird','../../config/utils','rpc','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetVtigerAccount','findAll','options','raw'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xf24b,0xa9));var _0xbf24=function(_0x53b594,_0x559767){_0x53b594=_0x53b594-0x0;var _0x1e616f=_0xf24b[_0x53b594];return _0x1e616f;};'use strict';var _=require(_0xbf24('0x0'));var util=require(_0xbf24('0x1'));var moment=require('moment');var BPromise=require(_0xbf24('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbf24('0x3'));var logger=require('../../config/logger')(_0xbf24('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbf24('0x5')][_0xbf24('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x30bd81,_0x51d192,_0x343579){return new BPromise(function(_0x294adf,_0x243a23){return client[_0xbf24('0x7')](_0x30bd81,_0x343579)[_0xbf24('0x8')](function(_0x1756bd){logger[_0xbf24('0x9')](_0xbf24('0xa'),_0x51d192,'request\x20sent');logger['debug'](_0xbf24('0xb'),_0x51d192,'request\x20sent',JSON[_0xbf24('0xc')](_0x1756bd));if(_0x1756bd[_0xbf24('0xd')]){if(_0x1756bd['error'][_0xbf24('0xe')]===0x1f4){logger[_0xbf24('0xd')](_0xbf24('0xa'),_0x51d192,_0x1756bd[_0xbf24('0xd')][_0xbf24('0xf')]);return _0x243a23(_0x1756bd[_0xbf24('0xd')][_0xbf24('0xf')]);}logger['error'](_0xbf24('0xa'),_0x51d192,_0x1756bd[_0xbf24('0xd')][_0xbf24('0xf')]);return _0x294adf(_0x1756bd[_0xbf24('0xd')][_0xbf24('0xf')]);}else{logger[_0xbf24('0x9')](_0xbf24('0xa'),_0x51d192,_0xbf24('0x10'));_0x294adf(_0x1756bd[_0xbf24('0x11')]['message']);}})[_0xbf24('0x12')](function(_0x2abaa6){logger[_0xbf24('0xd')](_0xbf24('0xa'),_0x51d192,_0x2abaa6);_0x243a23(_0x2abaa6);});});}exports[_0xbf24('0x13')]=function(_0x3e6b9e){var _0x2bad36=this;return new Promise(function(_0x48e181,_0x16de5d){return db['VtigerAccount'][_0xbf24('0x14')]({'raw':_0x3e6b9e[_0xbf24('0x15')]?_0x3e6b9e[_0xbf24('0x15')][_0xbf24('0x16')]===undefined?!![]:![]:!![],'where':_0x3e6b9e[_0xbf24('0x15')]?_0x3e6b9e['options'][_0xbf24('0x17')]||null:null,'attributes':_0x3e6b9e[_0xbf24('0x15')]?_0x3e6b9e['options'][_0xbf24('0x18')]||null:null,'limit':_0x3e6b9e[_0xbf24('0x15')]?_0x3e6b9e['options']['limit']||null:null,'include':_0x3e6b9e[_0xbf24('0x15')]?_0x3e6b9e[_0xbf24('0x15')][_0xbf24('0x19')]?_[_0xbf24('0x1a')](_0x3e6b9e[_0xbf24('0x15')][_0xbf24('0x19')],function(_0xa3f564){return{'model':db[_0xa3f564['model']],'as':_0xa3f564['as'],'attributes':_0xa3f564['attributes'],'include':_0xa3f564['include']?_[_0xbf24('0x1a')](_0xa3f564[_0xbf24('0x19')],function(_0x10ac63){return{'model':db[_0x10ac63[_0xbf24('0x1b')]],'as':_0x10ac63['as'],'attributes':_0x10ac63[_0xbf24('0x18')],'include':_0x10ac63['include']?_[_0xbf24('0x1a')](_0x10ac63['include'],function(_0x5c2c56){return{'model':db[_0x5c2c56['model']],'as':_0x5c2c56['as'],'attributes':_0x5c2c56['attributes']};}):[]};}):[]};}):[]:[]})[_0xbf24('0x8')](function(_0x18c1f3){logger[_0xbf24('0x9')](_0xbf24('0x13'),_0x3e6b9e);logger[_0xbf24('0x1c')](_0xbf24('0x13'),_0x3e6b9e,JSON[_0xbf24('0xc')](_0x18c1f3));_0x48e181(_0x18c1f3);})['catch'](function(_0x49b8e5){logger[_0xbf24('0xd')](_0xbf24('0x13'),_0x49b8e5['message'],_0x3e6b9e);_0x16de5d(_0x2bad36[_0xbf24('0xd')](0x1f4,_0x49b8e5[_0xbf24('0xf')]));});});};exports[_0xbf24('0x1d')]=function(_0x4dea1e){var _0x1f8e30=this;return new Promise(function(_0x29a6b7,_0x445bca){return db[_0xbf24('0x1e')][_0xbf24('0x1f')]({'raw':_0x4dea1e[_0xbf24('0x15')]?_0x4dea1e[_0xbf24('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4dea1e[_0xbf24('0x15')]?_0x4dea1e[_0xbf24('0x15')][_0xbf24('0x17')]||null:null,'attributes':_0x4dea1e[_0xbf24('0x15')]?_0x4dea1e['options'][_0xbf24('0x18')]||null:null,'include':_0x4dea1e['options']?_0x4dea1e['options'][_0xbf24('0x19')]?_[_0xbf24('0x1a')](_0x4dea1e[_0xbf24('0x15')][_0xbf24('0x19')],function(_0x37c960){return{'model':db[_0x37c960[_0xbf24('0x1b')]],'as':_0x37c960['as'],'attributes':_0x37c960[_0xbf24('0x18')],'include':_0x37c960[_0xbf24('0x19')]?_[_0xbf24('0x1a')](_0x37c960[_0xbf24('0x19')],function(_0xde348d){return{'model':db[_0xde348d['model']],'as':_0xde348d['as'],'attributes':_0xde348d[_0xbf24('0x18')],'include':_0xde348d[_0xbf24('0x19')]?_[_0xbf24('0x1a')](_0xde348d[_0xbf24('0x19')],function(_0xc9a054){return{'model':db[_0xc9a054[_0xbf24('0x1b')]],'as':_0xc9a054['as'],'attributes':_0xc9a054[_0xbf24('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e5eb3){logger[_0xbf24('0x9')](_0xbf24('0x1d'),_0x4dea1e);logger[_0xbf24('0x1c')](_0xbf24('0x1d'),_0x4dea1e,JSON[_0xbf24('0xc')](_0x4e5eb3));_0x29a6b7(_0x4e5eb3);})[_0xbf24('0x12')](function(_0xedc669){logger[_0xbf24('0xd')](_0xbf24('0x1d'),_0xedc669[_0xbf24('0xf')],_0x4dea1e);_0x445bca(_0x1f8e30[_0xbf24('0xd')](0x1f4,_0xedc669[_0xbf24('0xf')]));});});}; \ No newline at end of file +var _0x1342=['stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','then','debug','find','raw','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1342,0xce));var _0x2134=function(_0x26bcec,_0xe13f50){_0x26bcec=_0x26bcec-0x0;var _0x1049dc=_0x1342[_0x26bcec];return _0x1049dc;};'use strict';var _=require(_0x2134('0x0'));var util=require(_0x2134('0x1'));var moment=require(_0x2134('0x2'));var BPromise=require(_0x2134('0x3'));var rs=require(_0x2134('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2134('0x5'))['db'];var utils=require(_0x2134('0x6'));var logger=require(_0x2134('0x7'))(_0x2134('0x8'));var config=require(_0x2134('0x9'));var jayson=require(_0x2134('0xa'));var client=jayson['client'][_0x2134('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c31bd,_0x18914e,_0x14adf5){return new BPromise(function(_0x25319c,_0x350f19){return client[_0x2134('0xc')](_0x3c31bd,_0x14adf5)['then'](function(_0xbc08ce){logger[_0x2134('0xd')](_0x2134('0xe'),_0x18914e,_0x2134('0xf'));logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x18914e,_0x2134('0xf'),JSON[_0x2134('0x10')](_0xbc08ce));if(_0xbc08ce[_0x2134('0x11')]){if(_0xbc08ce['error'][_0x2134('0x12')]===0x1f4){logger['error'](_0x2134('0xe'),_0x18914e,_0xbc08ce['error'][_0x2134('0x13')]);return _0x350f19(_0xbc08ce[_0x2134('0x11')][_0x2134('0x13')]);}logger[_0x2134('0x11')](_0x2134('0xe'),_0x18914e,_0xbc08ce[_0x2134('0x11')]['message']);return _0x25319c(_0xbc08ce[_0x2134('0x11')]['message']);}else{logger[_0x2134('0xd')](_0x2134('0xe'),_0x18914e,_0x2134('0xf'));_0x25319c(_0xbc08ce[_0x2134('0x14')][_0x2134('0x13')]);}})[_0x2134('0x15')](function(_0x4e5559){logger[_0x2134('0x11')](_0x2134('0xe'),_0x18914e,_0x4e5559);_0x350f19(_0x4e5559);});});}exports[_0x2134('0x16')]=function(_0x2d7a5c){var _0x3a53c5=this;return new Promise(function(_0x37a551,_0x39e6b2){return db[_0x2134('0x17')][_0x2134('0x18')]({'raw':_0x2d7a5c[_0x2134('0x19')]?_0x2d7a5c[_0x2134('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2d7a5c[_0x2134('0x19')]?_0x2d7a5c[_0x2134('0x19')][_0x2134('0x1a')]||null:null,'attributes':_0x2d7a5c[_0x2134('0x19')]?_0x2d7a5c['options'][_0x2134('0x1b')]||null:null,'limit':_0x2d7a5c[_0x2134('0x19')]?_0x2d7a5c[_0x2134('0x19')][_0x2134('0x1c')]||null:null,'include':_0x2d7a5c[_0x2134('0x19')]?_0x2d7a5c[_0x2134('0x19')][_0x2134('0x1d')]?_[_0x2134('0x1e')](_0x2d7a5c[_0x2134('0x19')]['include'],function(_0x137768){return{'model':db[_0x137768[_0x2134('0x1f')]],'as':_0x137768['as'],'attributes':_0x137768[_0x2134('0x1b')],'include':_0x137768[_0x2134('0x1d')]?_[_0x2134('0x1e')](_0x137768['include'],function(_0x2dffba){return{'model':db[_0x2dffba['model']],'as':_0x2dffba['as'],'attributes':_0x2dffba['attributes'],'include':_0x2dffba[_0x2134('0x1d')]?_[_0x2134('0x1e')](_0x2dffba['include'],function(_0xf7bb4e){return{'model':db[_0xf7bb4e[_0x2134('0x1f')]],'as':_0xf7bb4e['as'],'attributes':_0xf7bb4e[_0x2134('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2134('0x20')](function(_0x4fa156){logger[_0x2134('0xd')]('GetVtigerAccount',_0x2d7a5c);logger[_0x2134('0x21')](_0x2134('0x16'),_0x2d7a5c,JSON[_0x2134('0x10')](_0x4fa156));_0x37a551(_0x4fa156);})[_0x2134('0x15')](function(_0x513b32){logger[_0x2134('0x11')]('GetVtigerAccount',_0x513b32[_0x2134('0x13')],_0x2d7a5c);_0x39e6b2(_0x3a53c5[_0x2134('0x11')](0x1f4,_0x513b32['message']));});});};exports['ShowVtigerAccount']=function(_0x4fdd8e){var _0xbdad37=this;return new Promise(function(_0x5d57ce,_0x3afa9d){return db[_0x2134('0x17')][_0x2134('0x22')]({'raw':_0x4fdd8e[_0x2134('0x19')]?_0x4fdd8e['options'][_0x2134('0x23')]===undefined?!![]:![]:!![],'where':_0x4fdd8e['options']?_0x4fdd8e[_0x2134('0x19')]['where']||null:null,'attributes':_0x4fdd8e[_0x2134('0x19')]?_0x4fdd8e['options'][_0x2134('0x1b')]||null:null,'include':_0x4fdd8e[_0x2134('0x19')]?_0x4fdd8e[_0x2134('0x19')][_0x2134('0x1d')]?_['map'](_0x4fdd8e[_0x2134('0x19')][_0x2134('0x1d')],function(_0x5f0ccc){return{'model':db[_0x5f0ccc[_0x2134('0x1f')]],'as':_0x5f0ccc['as'],'attributes':_0x5f0ccc['attributes'],'include':_0x5f0ccc[_0x2134('0x1d')]?_[_0x2134('0x1e')](_0x5f0ccc['include'],function(_0x2273dc){return{'model':db[_0x2273dc[_0x2134('0x1f')]],'as':_0x2273dc['as'],'attributes':_0x2273dc['attributes'],'include':_0x2273dc[_0x2134('0x1d')]?_['map'](_0x2273dc[_0x2134('0x1d')],function(_0x311b6c){return{'model':db[_0x311b6c['model']],'as':_0x311b6c['as'],'attributes':_0x311b6c[_0x2134('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2134('0x20')](function(_0x2f4d77){logger['info']('ShowVtigerAccount',_0x4fdd8e);logger[_0x2134('0x21')](_0x2134('0x24'),_0x4fdd8e,JSON[_0x2134('0x10')](_0x2f4d77));_0x5d57ce(_0x2f4d77);})[_0x2134('0x15')](function(_0x356eca){logger['error'](_0x2134('0x24'),_0x356eca[_0x2134('0x13')],_0x4fdd8e);_0x3afa9d(_0xbdad37[_0x2134('0x11')](0x1f4,_0x356eca[_0x2134('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 57968f7..e87ec01 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(_0x1350fd,_0x666bf){var _0x37ca68=function(_0x55dd0e){while(--_0x55dd0e){_0x1350fd['push'](_0x1350fd['shift']());}};_0x37ca68(++_0x666bf);}(_0xb10b,0x12a));var _0xbb10=function(_0x3456fe,_0x4e21b6){_0x3456fe=_0x3456fe-0x0;var _0x46fdcb=_0xb10b[_0x3456fe];return _0x46fdcb;};'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 _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(_0x2423a7,_0x19ea7d){var _0x37aa5b=function(_0x44585d){while(--_0x44585d){_0x2423a7['push'](_0x2423a7['shift']());}};_0x37aa5b(++_0x19ea7d);}(_0xb10b,0x12a));var _0xbb10=function(_0x338c8c,_0x19df14){_0x338c8c=_0x338c8c-0x0;var _0x371a9a=_0xb10b[_0x338c8c];return _0x371a9a;};'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 diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 3957bc0..ab61591 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 _0xfb7b=['STRING'];(function(_0x153a48,_0x1bf1fb){var _0x47f05b=function(_0x89f6d5){while(--_0x89f6d5){_0x153a48['push'](_0x153a48['shift']());}};_0x47f05b(++_0x1bf1fb);}(_0xfb7b,0x1b5));var _0xbfb7=function(_0x117a0a,_0x44dfe0){_0x117a0a=_0x117a0a-0x0;var _0x51a706=_0xfb7b[_0x117a0a];return _0x51a706;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbfb7('0x0')]},'description':{'type':Sequelize[_0xbfb7('0x0')]}}; \ No newline at end of file +var _0x6a18=['sequelize','exports','STRING'];(function(_0x21b660,_0x2348cc){var _0x56d1ac=function(_0x564804){while(--_0x564804){_0x21b660['push'](_0x21b660['shift']());}};_0x56d1ac(++_0x2348cc);}(_0x6a18,0x1e3));var _0x86a1=function(_0x24bd4a,_0x2b8d75){_0x24bd4a=_0x24bd4a-0x0;var _0x34db86=_0x6a18[_0x24bd4a];return _0x34db86;};'use strict';var Sequelize=require(_0x86a1('0x0'));module[_0x86a1('0x1')]={'name':{'type':Sequelize[_0x86a1('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 7e6b1f7..a1989aa 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 _0x94ed=['status','count','offset','set','json','apply','save','update','destroy','stack','name','send','index','VtigerConfiguration','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','find','params','getFields','findOne','VtigerField','getSubjects','sort','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','client','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','VtigerConfiguration,\x20%s,\x20%s','message','sendStatus','end'];(function(_0x4cef81,_0x2cfe9c){var _0x5aab80=function(_0x57c349){while(--_0x57c349){_0x4cef81['push'](_0x4cef81['shift']());}};_0x5aab80(++_0x2cfe9c);}(_0x94ed,0x1a3));var _0xd94e=function(_0x3128f7,_0x5ec08a){_0x3128f7=_0x3128f7-0x0;var _0x5ce976=_0x94ed[_0x3128f7];return _0x5ce976;};'use strict';var pdf=require(_0xd94e('0x0'));var emlformat=require(_0xd94e('0x1'));var rimraf=require(_0xd94e('0x2'));var zipdir=require(_0xd94e('0x3'));var jsonpatch=require(_0xd94e('0x4'));var rp=require(_0xd94e('0x5'));var moment=require(_0xd94e('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xd94e('0x7'));var util=require(_0xd94e('0x8'));var path=require(_0xd94e('0x9'));var sox=require(_0xd94e('0xa'));var csv=require(_0xd94e('0xb'));var ejs=require(_0xd94e('0xc'));var fs=require('fs');var _=require(_0xd94e('0xd'));var squel=require('squel');var crypto=require(_0xd94e('0xe'));var jsforce=require(_0xd94e('0xf'));var deskjs=require(_0xd94e('0x10'));var toCsv=require(_0xd94e('0xb'));var querystring=require(_0xd94e('0x11'));var Papa=require(_0xd94e('0x12'));var Redis=require(_0xd94e('0x13'));var authService=require(_0xd94e('0x14'));var qs=require(_0xd94e('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd94e('0x16'));var logger=require(_0xd94e('0x17'))(_0xd94e('0x18'));var utils=require('../../config/utils');var config=require(_0xd94e('0x19'));var licenseUtil=require(_0xd94e('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd94e('0x1b'));var client=jayson[_0xd94e('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18e04e,_0x3c04d1,_0x3d114b,_0x3a7448){return new BPromise(function(_0x4315b3,_0x184381){var _0xa1fef6=_0x3a7448||client;return _0xa1fef6[_0xd94e('0x1d')](_0x18e04e,_0x3d114b)[_0xd94e('0x1e')](function(_0x739763){logger[_0xd94e('0x1f')]('VtigerConfiguration,\x20%s,\x20%s',_0x3c04d1,_0xd94e('0x20'));logger[_0xd94e('0x21')](_0xd94e('0x22'),_0x3c04d1,_0xd94e('0x20'),JSON['stringify'](_0x739763));if(_0x739763[_0xd94e('0x23')]){if(_0x739763['error'][_0xd94e('0x24')]===0x1f4){logger['error'](_0xd94e('0x25'),_0x3c04d1,_0x739763[_0xd94e('0x23')][_0xd94e('0x26')]);return _0x184381(_0x739763[_0xd94e('0x23')][_0xd94e('0x26')]);}logger[_0xd94e('0x23')](_0xd94e('0x25'),_0x3c04d1,_0x739763['error'][_0xd94e('0x26')]);return _0x4315b3(_0x739763['error'][_0xd94e('0x26')]);}else{logger['info'](_0xd94e('0x25'),_0x3c04d1,'request\x20sent');_0x4315b3(_0x739763['result'][_0xd94e('0x26')]);}})['catch'](function(_0x5c3510){logger['error'](_0xd94e('0x25'),_0x3c04d1,_0x5c3510);_0x184381(_0x5c3510);});});}function respondWithStatusCode(_0x59c555,_0x308a65){_0x308a65=_0x308a65||0xcc;return function(_0x31b304){if(_0x31b304){return _0x59c555[_0xd94e('0x27')](_0x308a65);}return _0x59c555['status'](_0x308a65)[_0xd94e('0x28')]();};}function respondWithResult(_0x2d86a4,_0x2bf230){_0x2bf230=_0x2bf230||0xc8;return function(_0xaf9b6d){if(_0xaf9b6d){return _0x2d86a4[_0xd94e('0x29')](_0x2bf230)['json'](_0xaf9b6d);}};}function respondWithFilteredResult(_0x4bf439,_0x3e5916){return function(_0x5b16da){if(_0x5b16da){var _0x3f7332=_0x5b16da[_0xd94e('0x2a')],_0x5d856d=_0x3e5916['offset'],_0x53bc7b=_0x3e5916[_0xd94e('0x2b')]+_0x3e5916['limit'],_0x3b7a97;if(_0x53bc7b>=_0x3f7332){_0x53bc7b=_0x3f7332;_0x3b7a97=0xc8;}else{_0x3b7a97=0xce;}_0x4bf439['status'](_0x3b7a97);return _0x4bf439[_0xd94e('0x2c')]('Content-Range',_0x5d856d+'-'+_0x53bc7b+'/'+_0x3f7332)[_0xd94e('0x2d')](_0x5b16da);}return null;};}function patchUpdates(_0x121958){return function(_0x1d30de){try{jsonpatch[_0xd94e('0x2e')](_0x1d30de,_0x121958,!![]);}catch(_0x13d388){return BPromise['reject'](_0x13d388);}return _0x1d30de[_0xd94e('0x2f')]();};}function saveUpdates(_0x195c62,_0x548d5d){return function(_0x4a773c){if(_0x4a773c){return _0x4a773c[_0xd94e('0x30')](_0x195c62)['then'](function(_0x2dd353){return _0x2dd353;});}return null;};}function removeEntity(_0x498f91,_0x2875d4){return function(_0x116f93){if(_0x116f93){return _0x116f93[_0xd94e('0x31')]()['then'](function(){_0x498f91['status'](0xcc)[_0xd94e('0x28')]();});}};}function handleEntityNotFound(_0x2df779,_0x1c7f7f){return function(_0x4434e6){if(!_0x4434e6){_0x2df779['sendStatus'](0x194);}return _0x4434e6;};}function handleError(_0x456878,_0x2e6b57){_0x2e6b57=_0x2e6b57||0x1f4;return function(_0x580d0f){logger[_0xd94e('0x23')](_0x580d0f[_0xd94e('0x32')]);if(_0x580d0f['name']){delete _0x580d0f[_0xd94e('0x33')];}_0x456878[_0xd94e('0x29')](_0x2e6b57)[_0xd94e('0x34')](_0x580d0f);};}exports[_0xd94e('0x35')]=function(_0x4e7b91,_0x456145){var _0x5db6a8={},_0x487385={},_0x23d816={'count':0x0,'rows':[]};var _0x1ebe5f=_['map'](db[_0xd94e('0x36')][_0xd94e('0x37')],function(_0x37cb17){return{'name':_0x37cb17['fieldName'],'type':_0x37cb17[_0xd94e('0x38')][_0xd94e('0x39')]};});_0x487385[_0xd94e('0x3a')]=_[_0xd94e('0x3b')](_0x1ebe5f,_0xd94e('0x33'));_0x487385[_0xd94e('0x3c')]=_[_0xd94e('0x3d')](_0x4e7b91[_0xd94e('0x3c')]);_0x487385[_0xd94e('0x3e')]=_[_0xd94e('0x3f')](_0x487385['model'],_0x487385['query']);_0x5db6a8[_0xd94e('0x40')]=_[_0xd94e('0x3f')](_0x487385[_0xd94e('0x3a')],qs[_0xd94e('0x41')](_0x4e7b91['query'][_0xd94e('0x41')]));_0x5db6a8[_0xd94e('0x40')]=_0x5db6a8[_0xd94e('0x40')][_0xd94e('0x42')]?_0x5db6a8[_0xd94e('0x40')]:_0x487385[_0xd94e('0x3a')];if(!_0x4e7b91[_0xd94e('0x3c')][_0xd94e('0x43')](_0xd94e('0x44'))){_0x5db6a8[_0xd94e('0x45')]=qs['limit'](_0x4e7b91[_0xd94e('0x3c')][_0xd94e('0x45')]);_0x5db6a8[_0xd94e('0x2b')]=qs[_0xd94e('0x2b')](_0x4e7b91[_0xd94e('0x3c')][_0xd94e('0x2b')]);}_0x5db6a8[_0xd94e('0x46')]=qs['sort'](_0x4e7b91['query']['sort']);_0x5db6a8[_0xd94e('0x47')]=qs[_0xd94e('0x3e')](_[_0xd94e('0x48')](_0x4e7b91[_0xd94e('0x3c')],_0x487385[_0xd94e('0x3e')]),_0x1ebe5f);if(_0x4e7b91[_0xd94e('0x3c')][_0xd94e('0x49')]){_0x5db6a8[_0xd94e('0x47')]=_[_0xd94e('0x4a')](_0x5db6a8[_0xd94e('0x47')],{'$or':_[_0xd94e('0x3b')](_0x1ebe5f,function(_0x354bdc){if(_0x354bdc[_0xd94e('0x38')]!==_0xd94e('0x4b')){var _0x2330d2={};_0x2330d2[_0x354bdc[_0xd94e('0x33')]]={'$like':'%'+_0x4e7b91['query'][_0xd94e('0x49')]+'%'};return _0x2330d2;}})});}_0x5db6a8=_[_0xd94e('0x4a')]({},_0x5db6a8,_0x4e7b91[_0xd94e('0x4c')]);var _0x55c1ae={'where':_0x5db6a8['where']};return db['VtigerConfiguration'][_0xd94e('0x2a')](_0x55c1ae)[_0xd94e('0x1e')](function(_0x52fd14){_0x23d816[_0xd94e('0x2a')]=_0x52fd14;if(_0x4e7b91['query'][_0xd94e('0x4d')]){_0x5db6a8[_0xd94e('0x4e')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0xd94e('0x4f')](_0x5db6a8);})[_0xd94e('0x1e')](function(_0x9db7c8){_0x23d816[_0xd94e('0x50')]=_0x9db7c8;return _0x23d816;})[_0xd94e('0x1e')](respondWithFilteredResult(_0x456145,_0x5db6a8))['catch'](handleError(_0x456145,null));};exports['show']=function(_0x365768,_0x132ac6){var _0x5988db={'raw':![],'where':{'id':_0x365768['params']['id']}},_0x4f291c={};_0x4f291c[_0xd94e('0x3a')]=_[_0xd94e('0x3d')](db[_0xd94e('0x36')][_0xd94e('0x37')]);_0x4f291c[_0xd94e('0x3c')]=_[_0xd94e('0x3d')](_0x365768['query']);_0x4f291c[_0xd94e('0x3e')]=_[_0xd94e('0x3f')](_0x4f291c[_0xd94e('0x3a')],_0x4f291c['query']);_0x5988db['attributes']=_[_0xd94e('0x3f')](_0x4f291c[_0xd94e('0x3a')],qs[_0xd94e('0x41')](_0x365768['query'][_0xd94e('0x41')]));_0x5988db[_0xd94e('0x40')]=_0x5988db[_0xd94e('0x40')]['length']?_0x5988db[_0xd94e('0x40')]:_0x4f291c[_0xd94e('0x3a')];if(_0x365768[_0xd94e('0x3c')]['includeAll']){_0x5988db[_0xd94e('0x4e')]=[{'all':!![]}];}_0x5988db=_[_0xd94e('0x4a')]({},_0x5988db,_0x365768[_0xd94e('0x4c')]);return db[_0xd94e('0x36')]['find'](_0x5988db)[_0xd94e('0x1e')](handleEntityNotFound(_0x132ac6,null))[_0xd94e('0x1e')](respondWithResult(_0x132ac6,null))[_0xd94e('0x51')](handleError(_0x132ac6,null));};exports[_0xd94e('0x52')]=function(_0x4dec86,_0x4c2871){return db[_0xd94e('0x36')][_0xd94e('0x52')](_0x4dec86[_0xd94e('0x53')],{})['then'](respondWithResult(_0x4c2871,0xc9))[_0xd94e('0x51')](handleError(_0x4c2871,null));};exports['update']=function(_0x322b56,_0x4591fa){if(_0x322b56['body']['id']){delete _0x322b56[_0xd94e('0x53')]['id'];}return db[_0xd94e('0x36')][_0xd94e('0x54')]({'where':{'id':_0x322b56[_0xd94e('0x55')]['id']}})['then'](handleEntityNotFound(_0x4591fa,null))[_0xd94e('0x1e')](saveUpdates(_0x322b56[_0xd94e('0x53')],null))[_0xd94e('0x1e')](respondWithResult(_0x4591fa,null))[_0xd94e('0x51')](handleError(_0x4591fa,null));};exports[_0xd94e('0x31')]=function(_0x3d09d1,_0x2afb65){return db[_0xd94e('0x36')][_0xd94e('0x54')]({'where':{'id':_0x3d09d1[_0xd94e('0x55')]['id']}})['then'](handleEntityNotFound(_0x2afb65,null))[_0xd94e('0x1e')](removeEntity(_0x2afb65,null))[_0xd94e('0x51')](handleError(_0x2afb65,null));};exports[_0xd94e('0x56')]=function(_0x40477d,_0x2044dc,_0x4f59c9){var _0x4ab797={};var _0x1212a4={};var _0x1eebf4;var _0x8e55e4;return db[_0xd94e('0x36')][_0xd94e('0x57')]({'where':{'id':_0x40477d[_0xd94e('0x55')]['id']}})['then'](handleEntityNotFound(_0x2044dc,null))[_0xd94e('0x1e')](function(_0x2832db){if(_0x2832db){_0x1eebf4=_0x2832db;_0x1212a4[_0xd94e('0x3a')]=_[_0xd94e('0x3d')](db[_0xd94e('0x58')][_0xd94e('0x37')]);_0x1212a4[_0xd94e('0x3c')]=_[_0xd94e('0x3d')](_0x40477d[_0xd94e('0x3c')]);_0x1212a4['filters']=_[_0xd94e('0x3f')](_0x1212a4[_0xd94e('0x3a')],_0x1212a4['query']);_0x4ab797['attributes']=_[_0xd94e('0x3f')](_0x1212a4[_0xd94e('0x3a')],qs['fields'](_0x40477d[_0xd94e('0x3c')][_0xd94e('0x41')]));_0x4ab797[_0xd94e('0x40')]=_0x4ab797[_0xd94e('0x40')][_0xd94e('0x42')]?_0x4ab797[_0xd94e('0x40')]:_0x1212a4[_0xd94e('0x3a')];_0x4ab797[_0xd94e('0x46')]=qs['sort'](_0x40477d[_0xd94e('0x3c')]['sort']);_0x4ab797[_0xd94e('0x47')]=qs[_0xd94e('0x3e')](_[_0xd94e('0x48')](_0x40477d[_0xd94e('0x3c')],_0x1212a4[_0xd94e('0x3e')]));if(_0x40477d['query'][_0xd94e('0x49')]){_0x4ab797[_0xd94e('0x47')]=_[_0xd94e('0x4a')](_0x4ab797['where'],{'$or':_[_0xd94e('0x3b')](_0x4ab797[_0xd94e('0x40')],function(_0xa12e2e){var _0x5cffce={};_0x5cffce[_0xa12e2e]={'$like':'%'+_0x40477d[_0xd94e('0x3c')][_0xd94e('0x49')]+'%'};return _0x5cffce;})});}_0x4ab797=_[_0xd94e('0x4a')]({},_0x4ab797,_0x40477d[_0xd94e('0x4c')]);return _0x1eebf4[_0xd94e('0x56')](_0x4ab797);}})['then'](function(_0x7357e3){if(_0x7357e3){_0x8e55e4=_0x7357e3[_0xd94e('0x42')];if(!_0x40477d['query'][_0xd94e('0x43')](_0xd94e('0x44'))){_0x4ab797[_0xd94e('0x45')]=qs[_0xd94e('0x45')](_0x40477d['query']['limit']);_0x4ab797['offset']=qs['offset'](_0x40477d[_0xd94e('0x3c')][_0xd94e('0x2b')]);}return _0x1eebf4['getFields'](_0x4ab797);}})[_0xd94e('0x1e')](function(_0x4d2dd4){if(_0x4d2dd4){return _0x4d2dd4?{'count':_0x8e55e4,'rows':_0x4d2dd4}:null;}})['then'](respondWithResult(_0x2044dc,null))[_0xd94e('0x51')](handleError(_0x2044dc,null));};exports[_0xd94e('0x59')]=function(_0x12325a,_0x517ad,_0x53925a){var _0x340a0e={};var _0x59e7de={};var _0x327c81;var _0x51b53b;return db[_0xd94e('0x36')]['findOne']({'where':{'id':_0x12325a['params']['id']}})[_0xd94e('0x1e')](handleEntityNotFound(_0x517ad,null))[_0xd94e('0x1e')](function(_0x407f2b){if(_0x407f2b){_0x327c81=_0x407f2b;_0x59e7de[_0xd94e('0x3a')]=_[_0xd94e('0x3d')](db['VtigerField']['rawAttributes']);_0x59e7de['query']=_[_0xd94e('0x3d')](_0x12325a[_0xd94e('0x3c')]);_0x59e7de[_0xd94e('0x3e')]=_[_0xd94e('0x3f')](_0x59e7de[_0xd94e('0x3a')],_0x59e7de[_0xd94e('0x3c')]);_0x340a0e[_0xd94e('0x40')]=_[_0xd94e('0x3f')](_0x59e7de[_0xd94e('0x3a')],qs[_0xd94e('0x41')](_0x12325a[_0xd94e('0x3c')][_0xd94e('0x41')]));_0x340a0e[_0xd94e('0x40')]=_0x340a0e[_0xd94e('0x40')][_0xd94e('0x42')]?_0x340a0e[_0xd94e('0x40')]:_0x59e7de[_0xd94e('0x3a')];_0x340a0e[_0xd94e('0x46')]=qs['sort'](_0x12325a[_0xd94e('0x3c')][_0xd94e('0x5a')]);_0x340a0e['where']=qs[_0xd94e('0x3e')](_['pick'](_0x12325a[_0xd94e('0x3c')],_0x59e7de['filters']));if(_0x12325a[_0xd94e('0x3c')][_0xd94e('0x49')]){_0x340a0e[_0xd94e('0x47')]=_['merge'](_0x340a0e['where'],{'$or':_[_0xd94e('0x3b')](_0x340a0e[_0xd94e('0x40')],function(_0x53b2ec){var _0x3cb9f1={};_0x3cb9f1[_0x53b2ec]={'$like':'%'+_0x12325a[_0xd94e('0x3c')][_0xd94e('0x49')]+'%'};return _0x3cb9f1;})});}_0x340a0e=_[_0xd94e('0x4a')]({},_0x340a0e,_0x12325a[_0xd94e('0x4c')]);return _0x327c81[_0xd94e('0x59')](_0x340a0e);}})[_0xd94e('0x1e')](function(_0x11a67c){if(_0x11a67c){_0x51b53b=_0x11a67c[_0xd94e('0x42')];if(!_0x12325a[_0xd94e('0x3c')][_0xd94e('0x43')]('nolimit')){_0x340a0e[_0xd94e('0x45')]=qs[_0xd94e('0x45')](_0x12325a['query'][_0xd94e('0x45')]);_0x340a0e[_0xd94e('0x2b')]=qs[_0xd94e('0x2b')](_0x12325a[_0xd94e('0x3c')][_0xd94e('0x2b')]);}return _0x327c81[_0xd94e('0x59')](_0x340a0e);}})[_0xd94e('0x1e')](function(_0x4ec725){if(_0x4ec725){return _0x4ec725?{'count':_0x51b53b,'rows':_0x4ec725}:null;}})[_0xd94e('0x1e')](respondWithResult(_0x517ad,null))[_0xd94e('0x51')](handleError(_0x517ad,null));};exports[_0xd94e('0x5b')]=function(_0x4918ef,_0x5eba3b,_0x28435){var _0x10a0fa={};var _0x25e06c={};var _0x5cd519;var _0x398af5;return db[_0xd94e('0x36')][_0xd94e('0x57')]({'where':{'id':_0x4918ef[_0xd94e('0x55')]['id']}})[_0xd94e('0x1e')](handleEntityNotFound(_0x5eba3b,null))[_0xd94e('0x1e')](function(_0x561ec2){if(_0x561ec2){_0x5cd519=_0x561ec2;_0x25e06c[_0xd94e('0x3a')]=_[_0xd94e('0x3d')](db['VtigerField'][_0xd94e('0x37')]);_0x25e06c[_0xd94e('0x3c')]=_[_0xd94e('0x3d')](_0x4918ef[_0xd94e('0x3c')]);_0x25e06c[_0xd94e('0x3e')]=_[_0xd94e('0x3f')](_0x25e06c['model'],_0x25e06c[_0xd94e('0x3c')]);_0x10a0fa[_0xd94e('0x40')]=_[_0xd94e('0x3f')](_0x25e06c[_0xd94e('0x3a')],qs['fields'](_0x4918ef[_0xd94e('0x3c')][_0xd94e('0x41')]));_0x10a0fa[_0xd94e('0x40')]=_0x10a0fa[_0xd94e('0x40')]['length']?_0x10a0fa[_0xd94e('0x40')]:_0x25e06c[_0xd94e('0x3a')];_0x10a0fa['order']=qs[_0xd94e('0x5a')](_0x4918ef[_0xd94e('0x3c')][_0xd94e('0x5a')]);_0x10a0fa['where']=qs[_0xd94e('0x3e')](_['pick'](_0x4918ef[_0xd94e('0x3c')],_0x25e06c[_0xd94e('0x3e')]));if(_0x4918ef[_0xd94e('0x3c')]['filter']){_0x10a0fa[_0xd94e('0x47')]=_[_0xd94e('0x4a')](_0x10a0fa[_0xd94e('0x47')],{'$or':_[_0xd94e('0x3b')](_0x10a0fa[_0xd94e('0x40')],function(_0x39c20f){var _0x43d88f={};_0x43d88f[_0x39c20f]={'$like':'%'+_0x4918ef[_0xd94e('0x3c')][_0xd94e('0x49')]+'%'};return _0x43d88f;})});}_0x10a0fa=_[_0xd94e('0x4a')]({},_0x10a0fa,_0x4918ef[_0xd94e('0x4c')]);return _0x5cd519[_0xd94e('0x5b')](_0x10a0fa);}})['then'](function(_0x168fe7){if(_0x168fe7){_0x398af5=_0x168fe7[_0xd94e('0x42')];if(!_0x4918ef[_0xd94e('0x3c')][_0xd94e('0x43')](_0xd94e('0x44'))){_0x10a0fa['limit']=qs[_0xd94e('0x45')](_0x4918ef['query']['limit']);_0x10a0fa[_0xd94e('0x2b')]=qs[_0xd94e('0x2b')](_0x4918ef[_0xd94e('0x3c')][_0xd94e('0x2b')]);}return _0x5cd519[_0xd94e('0x5b')](_0x10a0fa);}})[_0xd94e('0x1e')](function(_0x3ae9ab){if(_0x3ae9ab){return _0x3ae9ab?{'count':_0x398af5,'rows':_0x3ae9ab}:null;}})[_0xd94e('0x1e')](respondWithResult(_0x5eba3b,null))[_0xd94e('0x51')](handleError(_0x5eba3b,null));}; \ No newline at end of file +var _0x8828=['catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','length','find','create','body','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','info','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message'];(function(_0x30853f,_0x4aa320){var _0x3c416d=function(_0x15d3d2){while(--_0x15d3d2){_0x30853f['push'](_0x30853f['shift']());}};_0x3c416d(++_0x4aa320);}(_0x8828,0x197));var _0x8882=function(_0x4b60f1,_0x5e14a2){_0x4b60f1=_0x4b60f1-0x0;var _0xb4e241=_0x8828[_0x4b60f1];return _0xb4e241;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8882('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8882('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8882('0x2'));var moment=require(_0x8882('0x3'));var BPromise=require(_0x8882('0x4'));var Mustache=require(_0x8882('0x5'));var util=require(_0x8882('0x6'));var path=require(_0x8882('0x7'));var sox=require('sox');var csv=require(_0x8882('0x8'));var ejs=require(_0x8882('0x9'));var fs=require('fs');var _=require(_0x8882('0xa'));var squel=require(_0x8882('0xb'));var crypto=require(_0x8882('0xc'));var jsforce=require(_0x8882('0xd'));var deskjs=require(_0x8882('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8882('0xf'));var Papa=require('papaparse');var Redis=require(_0x8882('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8882('0x11'));var as=require(_0x8882('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8882('0x13'))(_0x8882('0x14'));var utils=require(_0x8882('0x15'));var config=require(_0x8882('0x16'));var licenseUtil=require(_0x8882('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x8882('0x18'));var client=jayson['client'][_0x8882('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x220c98,_0x50c8cf,_0x33f345,_0x509b4c){return new BPromise(function(_0x729ebb,_0x247d32){var _0x3d6505=_0x509b4c||client;return _0x3d6505['request'](_0x220c98,_0x33f345)['then'](function(_0x404469){logger[_0x8882('0x1a')]('VtigerConfiguration,\x20%s,\x20%s',_0x50c8cf,_0x8882('0x1b'));logger['debug'](_0x8882('0x1c'),_0x50c8cf,_0x8882('0x1b'),JSON[_0x8882('0x1d')](_0x404469));if(_0x404469[_0x8882('0x1e')]){if(_0x404469[_0x8882('0x1e')]['code']===0x1f4){logger[_0x8882('0x1e')](_0x8882('0x1f'),_0x50c8cf,_0x404469['error'][_0x8882('0x20')]);return _0x247d32(_0x404469[_0x8882('0x1e')][_0x8882('0x20')]);}logger[_0x8882('0x1e')]('VtigerConfiguration,\x20%s,\x20%s',_0x50c8cf,_0x404469[_0x8882('0x1e')]['message']);return _0x729ebb(_0x404469[_0x8882('0x1e')][_0x8882('0x20')]);}else{logger[_0x8882('0x1a')]('VtigerConfiguration,\x20%s,\x20%s',_0x50c8cf,_0x8882('0x1b'));_0x729ebb(_0x404469['result']['message']);}})[_0x8882('0x21')](function(_0x269f02){logger[_0x8882('0x1e')](_0x8882('0x1f'),_0x50c8cf,_0x269f02);_0x247d32(_0x269f02);});});}function respondWithStatusCode(_0xe98223,_0x56cbef){_0x56cbef=_0x56cbef||0xcc;return function(_0x4cf380){if(_0x4cf380){return _0xe98223[_0x8882('0x22')](_0x56cbef);}return _0xe98223[_0x8882('0x23')](_0x56cbef)['end']();};}function respondWithResult(_0x52b1a3,_0x44b9a9){_0x44b9a9=_0x44b9a9||0xc8;return function(_0x422780){if(_0x422780){return _0x52b1a3['status'](_0x44b9a9)[_0x8882('0x24')](_0x422780);}};}function respondWithFilteredResult(_0x3f853e,_0x129c75){return function(_0x41fd6f){if(_0x41fd6f){var _0x19462a=_0x41fd6f[_0x8882('0x25')],_0x173038=_0x129c75[_0x8882('0x26')],_0x552ea6=_0x129c75[_0x8882('0x26')]+_0x129c75[_0x8882('0x27')],_0x13d82e;if(_0x552ea6>=_0x19462a){_0x552ea6=_0x19462a;_0x13d82e=0xc8;}else{_0x13d82e=0xce;}_0x3f853e['status'](_0x13d82e);return _0x3f853e[_0x8882('0x28')](_0x8882('0x29'),_0x173038+'-'+_0x552ea6+'/'+_0x19462a)[_0x8882('0x24')](_0x41fd6f);}return null;};}function patchUpdates(_0x393297){return function(_0x48a86d){try{jsonpatch[_0x8882('0x2a')](_0x48a86d,_0x393297,!![]);}catch(_0x43c527){return BPromise[_0x8882('0x2b')](_0x43c527);}return _0x48a86d['save']();};}function saveUpdates(_0x541dec,_0x645665){return function(_0x13460b){if(_0x13460b){return _0x13460b[_0x8882('0x2c')](_0x541dec)[_0x8882('0x2d')](function(_0x4e04fa){return _0x4e04fa;});}return null;};}function removeEntity(_0x317aa5,_0x1e6b88){return function(_0x4f211f){if(_0x4f211f){return _0x4f211f[_0x8882('0x2e')]()['then'](function(){_0x317aa5[_0x8882('0x23')](0xcc)[_0x8882('0x2f')]();});}};}function handleEntityNotFound(_0x36a74f,_0x1d7a32){return function(_0x213888){if(!_0x213888){_0x36a74f[_0x8882('0x22')](0x194);}return _0x213888;};}function handleError(_0xd0e03,_0x29b39d){_0x29b39d=_0x29b39d||0x1f4;return function(_0x6d055d){logger[_0x8882('0x1e')](_0x6d055d[_0x8882('0x30')]);if(_0x6d055d[_0x8882('0x31')]){delete _0x6d055d[_0x8882('0x31')];}_0xd0e03[_0x8882('0x23')](_0x29b39d)[_0x8882('0x32')](_0x6d055d);};}exports[_0x8882('0x33')]=function(_0x279778,_0x2c5eea){var _0x55b2ee={},_0x4dcd71={},_0x1e93ef={'count':0x0,'rows':[]};var _0x4170ce=_[_0x8882('0x34')](db[_0x8882('0x35')][_0x8882('0x36')],function(_0x4d2185){return{'name':_0x4d2185[_0x8882('0x37')],'type':_0x4d2185[_0x8882('0x38')][_0x8882('0x39')]};});_0x4dcd71['model']=_[_0x8882('0x34')](_0x4170ce,'name');_0x4dcd71['query']=_[_0x8882('0x3a')](_0x279778[_0x8882('0x3b')]);_0x4dcd71[_0x8882('0x3c')]=_[_0x8882('0x3d')](_0x4dcd71[_0x8882('0x3e')],_0x4dcd71[_0x8882('0x3b')]);_0x55b2ee['attributes']=_[_0x8882('0x3d')](_0x4dcd71['model'],qs[_0x8882('0x3f')](_0x279778[_0x8882('0x3b')]['fields']));_0x55b2ee[_0x8882('0x40')]=_0x55b2ee[_0x8882('0x40')]['length']?_0x55b2ee['attributes']:_0x4dcd71[_0x8882('0x3e')];if(!_0x279778[_0x8882('0x3b')][_0x8882('0x41')](_0x8882('0x42'))){_0x55b2ee[_0x8882('0x27')]=qs['limit'](_0x279778[_0x8882('0x3b')][_0x8882('0x27')]);_0x55b2ee[_0x8882('0x26')]=qs[_0x8882('0x26')](_0x279778[_0x8882('0x3b')][_0x8882('0x26')]);}_0x55b2ee[_0x8882('0x43')]=qs[_0x8882('0x44')](_0x279778[_0x8882('0x3b')][_0x8882('0x44')]);_0x55b2ee[_0x8882('0x45')]=qs[_0x8882('0x3c')](_[_0x8882('0x46')](_0x279778['query'],_0x4dcd71[_0x8882('0x3c')]),_0x4170ce);if(_0x279778[_0x8882('0x3b')][_0x8882('0x47')]){_0x55b2ee[_0x8882('0x45')]=_[_0x8882('0x48')](_0x55b2ee[_0x8882('0x45')],{'$or':_['map'](_0x4170ce,function(_0x32e514){if(_0x32e514[_0x8882('0x38')]!=='VIRTUAL'){var _0x1abda3={};_0x1abda3[_0x32e514[_0x8882('0x31')]]={'$like':'%'+_0x279778[_0x8882('0x3b')][_0x8882('0x47')]+'%'};return _0x1abda3;}})});}_0x55b2ee=_[_0x8882('0x48')]({},_0x55b2ee,_0x279778[_0x8882('0x49')]);var _0x2038bb={'where':_0x55b2ee[_0x8882('0x45')]};return db['VtigerConfiguration'][_0x8882('0x25')](_0x2038bb)[_0x8882('0x2d')](function(_0x31f9f2){_0x1e93ef[_0x8882('0x25')]=_0x31f9f2;if(_0x279778['query'][_0x8882('0x4a')]){_0x55b2ee[_0x8882('0x4b')]=[{'all':!![]}];}return db[_0x8882('0x35')]['findAll'](_0x55b2ee);})[_0x8882('0x2d')](function(_0x54521f){_0x1e93ef[_0x8882('0x4c')]=_0x54521f;return _0x1e93ef;})[_0x8882('0x2d')](respondWithFilteredResult(_0x2c5eea,_0x55b2ee))[_0x8882('0x21')](handleError(_0x2c5eea,null));};exports[_0x8882('0x4d')]=function(_0x2f603f,_0x1bb061){var _0x6af8a={'raw':![],'where':{'id':_0x2f603f[_0x8882('0x4e')]['id']}},_0x4e4399={};_0x4e4399[_0x8882('0x3e')]=_[_0x8882('0x3a')](db[_0x8882('0x35')][_0x8882('0x36')]);_0x4e4399[_0x8882('0x3b')]=_[_0x8882('0x3a')](_0x2f603f[_0x8882('0x3b')]);_0x4e4399[_0x8882('0x3c')]=_['intersection'](_0x4e4399['model'],_0x4e4399['query']);_0x6af8a[_0x8882('0x40')]=_[_0x8882('0x3d')](_0x4e4399[_0x8882('0x3e')],qs[_0x8882('0x3f')](_0x2f603f[_0x8882('0x3b')]['fields']));_0x6af8a[_0x8882('0x40')]=_0x6af8a['attributes'][_0x8882('0x4f')]?_0x6af8a[_0x8882('0x40')]:_0x4e4399['model'];if(_0x2f603f['query'][_0x8882('0x4a')]){_0x6af8a[_0x8882('0x4b')]=[{'all':!![]}];}_0x6af8a=_[_0x8882('0x48')]({},_0x6af8a,_0x2f603f['options']);return db['VtigerConfiguration'][_0x8882('0x50')](_0x6af8a)[_0x8882('0x2d')](handleEntityNotFound(_0x1bb061,null))[_0x8882('0x2d')](respondWithResult(_0x1bb061,null))[_0x8882('0x21')](handleError(_0x1bb061,null));};exports['create']=function(_0x2f092c,_0x132c44){return db[_0x8882('0x35')][_0x8882('0x51')](_0x2f092c[_0x8882('0x52')],{})['then'](respondWithResult(_0x132c44,0xc9))[_0x8882('0x21')](handleError(_0x132c44,null));};exports[_0x8882('0x2c')]=function(_0x1be8a0,_0xe7f7f7){if(_0x1be8a0[_0x8882('0x52')]['id']){delete _0x1be8a0['body']['id'];}return db[_0x8882('0x35')][_0x8882('0x50')]({'where':{'id':_0x1be8a0[_0x8882('0x4e')]['id']}})['then'](handleEntityNotFound(_0xe7f7f7,null))[_0x8882('0x2d')](saveUpdates(_0x1be8a0[_0x8882('0x52')],null))[_0x8882('0x2d')](respondWithResult(_0xe7f7f7,null))[_0x8882('0x21')](handleError(_0xe7f7f7,null));};exports[_0x8882('0x2e')]=function(_0x50cd76,_0xef7cbe){return db[_0x8882('0x35')][_0x8882('0x50')]({'where':{'id':_0x50cd76[_0x8882('0x4e')]['id']}})['then'](handleEntityNotFound(_0xef7cbe,null))['then'](removeEntity(_0xef7cbe,null))[_0x8882('0x21')](handleError(_0xef7cbe,null));};exports[_0x8882('0x53')]=function(_0x3ee863,_0x22bf46,_0x4ed2ff){var _0x447820={};var _0x219467={};var _0xe0a3b1;var _0x5a9ab0;return db['VtigerConfiguration'][_0x8882('0x54')]({'where':{'id':_0x3ee863['params']['id']}})[_0x8882('0x2d')](handleEntityNotFound(_0x22bf46,null))[_0x8882('0x2d')](function(_0x5514f7){if(_0x5514f7){_0xe0a3b1=_0x5514f7;_0x219467[_0x8882('0x3e')]=_[_0x8882('0x3a')](db['VtigerField'][_0x8882('0x36')]);_0x219467[_0x8882('0x3b')]=_['keys'](_0x3ee863[_0x8882('0x3b')]);_0x219467['filters']=_[_0x8882('0x3d')](_0x219467[_0x8882('0x3e')],_0x219467[_0x8882('0x3b')]);_0x447820[_0x8882('0x40')]=_[_0x8882('0x3d')](_0x219467[_0x8882('0x3e')],qs['fields'](_0x3ee863[_0x8882('0x3b')]['fields']));_0x447820['attributes']=_0x447820['attributes']['length']?_0x447820['attributes']:_0x219467[_0x8882('0x3e')];_0x447820['order']=qs[_0x8882('0x44')](_0x3ee863['query'][_0x8882('0x44')]);_0x447820[_0x8882('0x45')]=qs[_0x8882('0x3c')](_[_0x8882('0x46')](_0x3ee863[_0x8882('0x3b')],_0x219467['filters']));if(_0x3ee863[_0x8882('0x3b')][_0x8882('0x47')]){_0x447820[_0x8882('0x45')]=_[_0x8882('0x48')](_0x447820[_0x8882('0x45')],{'$or':_[_0x8882('0x34')](_0x447820['attributes'],function(_0x5120db){var _0x3487a3={};_0x3487a3[_0x5120db]={'$like':'%'+_0x3ee863[_0x8882('0x3b')]['filter']+'%'};return _0x3487a3;})});}_0x447820=_[_0x8882('0x48')]({},_0x447820,_0x3ee863[_0x8882('0x49')]);return _0xe0a3b1['getFields'](_0x447820);}})[_0x8882('0x2d')](function(_0x2aa6c9){if(_0x2aa6c9){_0x5a9ab0=_0x2aa6c9['length'];if(!_0x3ee863[_0x8882('0x3b')]['hasOwnProperty'](_0x8882('0x42'))){_0x447820[_0x8882('0x27')]=qs[_0x8882('0x27')](_0x3ee863[_0x8882('0x3b')][_0x8882('0x27')]);_0x447820[_0x8882('0x26')]=qs['offset'](_0x3ee863[_0x8882('0x3b')][_0x8882('0x26')]);}return _0xe0a3b1[_0x8882('0x53')](_0x447820);}})[_0x8882('0x2d')](function(_0x55d124){if(_0x55d124){return _0x55d124?{'count':_0x5a9ab0,'rows':_0x55d124}:null;}})['then'](respondWithResult(_0x22bf46,null))[_0x8882('0x21')](handleError(_0x22bf46,null));};exports['getSubjects']=function(_0x7d8ee8,_0x45c2d5,_0x28a96c){var _0x46a776={};var _0x15047a={};var _0x2c83e3;var _0x54e471;return db[_0x8882('0x35')][_0x8882('0x54')]({'where':{'id':_0x7d8ee8[_0x8882('0x4e')]['id']}})[_0x8882('0x2d')](handleEntityNotFound(_0x45c2d5,null))[_0x8882('0x2d')](function(_0x3a0a25){if(_0x3a0a25){_0x2c83e3=_0x3a0a25;_0x15047a[_0x8882('0x3e')]=_[_0x8882('0x3a')](db[_0x8882('0x55')][_0x8882('0x36')]);_0x15047a[_0x8882('0x3b')]=_[_0x8882('0x3a')](_0x7d8ee8[_0x8882('0x3b')]);_0x15047a[_0x8882('0x3c')]=_[_0x8882('0x3d')](_0x15047a[_0x8882('0x3e')],_0x15047a[_0x8882('0x3b')]);_0x46a776['attributes']=_[_0x8882('0x3d')](_0x15047a['model'],qs[_0x8882('0x3f')](_0x7d8ee8[_0x8882('0x3b')][_0x8882('0x3f')]));_0x46a776['attributes']=_0x46a776[_0x8882('0x40')][_0x8882('0x4f')]?_0x46a776[_0x8882('0x40')]:_0x15047a[_0x8882('0x3e')];_0x46a776[_0x8882('0x43')]=qs[_0x8882('0x44')](_0x7d8ee8[_0x8882('0x3b')][_0x8882('0x44')]);_0x46a776[_0x8882('0x45')]=qs['filters'](_[_0x8882('0x46')](_0x7d8ee8[_0x8882('0x3b')],_0x15047a[_0x8882('0x3c')]));if(_0x7d8ee8[_0x8882('0x3b')][_0x8882('0x47')]){_0x46a776['where']=_[_0x8882('0x48')](_0x46a776['where'],{'$or':_[_0x8882('0x34')](_0x46a776[_0x8882('0x40')],function(_0x1e39d6){var _0x2b6cda={};_0x2b6cda[_0x1e39d6]={'$like':'%'+_0x7d8ee8[_0x8882('0x3b')][_0x8882('0x47')]+'%'};return _0x2b6cda;})});}_0x46a776=_['merge']({},_0x46a776,_0x7d8ee8['options']);return _0x2c83e3[_0x8882('0x56')](_0x46a776);}})[_0x8882('0x2d')](function(_0x29d45a){if(_0x29d45a){_0x54e471=_0x29d45a[_0x8882('0x4f')];if(!_0x7d8ee8[_0x8882('0x3b')][_0x8882('0x41')](_0x8882('0x42'))){_0x46a776[_0x8882('0x27')]=qs[_0x8882('0x27')](_0x7d8ee8['query'][_0x8882('0x27')]);_0x46a776[_0x8882('0x26')]=qs[_0x8882('0x26')](_0x7d8ee8[_0x8882('0x3b')][_0x8882('0x26')]);}return _0x2c83e3[_0x8882('0x56')](_0x46a776);}})['then'](function(_0x198a54){if(_0x198a54){return _0x198a54?{'count':_0x54e471,'rows':_0x198a54}:null;}})[_0x8882('0x2d')](respondWithResult(_0x45c2d5,null))[_0x8882('0x21')](handleError(_0x45c2d5,null));};exports[_0x8882('0x57')]=function(_0x277022,_0x5b8621,_0x28d5b7){var _0x1ece4a={};var _0x3cdafe={};var _0x1c65ec;var _0x627cd7;return db[_0x8882('0x35')][_0x8882('0x54')]({'where':{'id':_0x277022[_0x8882('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5b8621,null))['then'](function(_0x3240b2){if(_0x3240b2){_0x1c65ec=_0x3240b2;_0x3cdafe['model']=_[_0x8882('0x3a')](db[_0x8882('0x55')][_0x8882('0x36')]);_0x3cdafe[_0x8882('0x3b')]=_['keys'](_0x277022[_0x8882('0x3b')]);_0x3cdafe[_0x8882('0x3c')]=_[_0x8882('0x3d')](_0x3cdafe[_0x8882('0x3e')],_0x3cdafe[_0x8882('0x3b')]);_0x1ece4a[_0x8882('0x40')]=_[_0x8882('0x3d')](_0x3cdafe[_0x8882('0x3e')],qs[_0x8882('0x3f')](_0x277022[_0x8882('0x3b')][_0x8882('0x3f')]));_0x1ece4a[_0x8882('0x40')]=_0x1ece4a[_0x8882('0x40')][_0x8882('0x4f')]?_0x1ece4a[_0x8882('0x40')]:_0x3cdafe[_0x8882('0x3e')];_0x1ece4a[_0x8882('0x43')]=qs[_0x8882('0x44')](_0x277022['query'][_0x8882('0x44')]);_0x1ece4a['where']=qs[_0x8882('0x3c')](_['pick'](_0x277022[_0x8882('0x3b')],_0x3cdafe[_0x8882('0x3c')]));if(_0x277022[_0x8882('0x3b')][_0x8882('0x47')]){_0x1ece4a[_0x8882('0x45')]=_[_0x8882('0x48')](_0x1ece4a[_0x8882('0x45')],{'$or':_[_0x8882('0x34')](_0x1ece4a['attributes'],function(_0x6740d8){var _0x54dc8a={};_0x54dc8a[_0x6740d8]={'$like':'%'+_0x277022['query'][_0x8882('0x47')]+'%'};return _0x54dc8a;})});}_0x1ece4a=_['merge']({},_0x1ece4a,_0x277022[_0x8882('0x49')]);return _0x1c65ec[_0x8882('0x57')](_0x1ece4a);}})['then'](function(_0x581a30){if(_0x581a30){_0x627cd7=_0x581a30[_0x8882('0x4f')];if(!_0x277022[_0x8882('0x3b')][_0x8882('0x41')](_0x8882('0x42'))){_0x1ece4a['limit']=qs[_0x8882('0x27')](_0x277022['query']['limit']);_0x1ece4a[_0x8882('0x26')]=qs[_0x8882('0x26')](_0x277022[_0x8882('0x3b')][_0x8882('0x26')]);}return _0x1c65ec[_0x8882('0x57')](_0x1ece4a);}})[_0x8882('0x2d')](function(_0x3bb05d){if(_0x3bb05d){return _0x3bb05d?{'count':_0x627cd7,'rows':_0x3bb05d}:null;}})[_0x8882('0x2d')](respondWithResult(_0x5b8621,null))[_0x8882('0x21')](handleError(_0x5b8621,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 151288e..17807c0 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 _0x9793=['../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','api','moment','path'];(function(_0x44af89,_0x3e8e29){var _0x57b65b=function(_0x33e966){while(--_0x33e966){_0x44af89['push'](_0x44af89['shift']());}};_0x57b65b(++_0x3e8e29);}(_0x9793,0x1df));var _0x3979=function(_0x5c3a26,_0x5a00e4){_0x5c3a26=_0x5c3a26-0x0;var _0x108991=_0x9793[_0x5c3a26];return _0x108991;};'use strict';var _=require(_0x3979('0x0'));var util=require(_0x3979('0x1'));var logger=require('../../config/logger')(_0x3979('0x2'));var moment=require(_0x3979('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3979('0x4'));var rimraf=require('rimraf');var config=require(_0x3979('0x5'));var attributes=require(_0x3979('0x6'));module[_0x3979('0x7')]=function(_0x2e5663,_0x55a396){return _0x2e5663[_0x3979('0x8')](_0x3979('0x9'),attributes,{'tableName':_0x3979('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bfa=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations'];(function(_0x167952,_0x119667){var _0x5ebf09=function(_0x2c1bae){while(--_0x2c1bae){_0x167952['push'](_0x167952['shift']());}};_0x5ebf09(++_0x119667);}(_0x6bfa,0x188));var _0xa6bf=function(_0x5cc6c9,_0x521e56){_0x5cc6c9=_0x5cc6c9-0x0;var _0x440868=_0x6bfa[_0x5cc6c9];return _0x440868;};'use strict';var _=require(_0xa6bf('0x0'));var util=require(_0xa6bf('0x1'));var logger=require(_0xa6bf('0x2'))(_0xa6bf('0x3'));var moment=require(_0xa6bf('0x4'));var BPromise=require(_0xa6bf('0x5'));var rp=require(_0xa6bf('0x6'));var fs=require('fs');var path=require(_0xa6bf('0x7'));var rimraf=require(_0xa6bf('0x8'));var config=require(_0xa6bf('0x9'));var attributes=require(_0xa6bf('0xa'));module[_0xa6bf('0xb')]=function(_0x4abdd0,_0x4b5918){return _0x4abdd0[_0xa6bf('0xc')]('VtigerConfiguration',attributes,{'tableName':_0xa6bf('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 7f36c9c..55b1ff9 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 _0xc03c=['bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x2e5f9c,_0x134a52){var _0x538b44=function(_0x38ef13){while(--_0x38ef13){_0x2e5f9c['push'](_0x2e5f9c['shift']());}};_0x538b44(++_0x134a52);}(_0xc03c,0xbb));var _0xcc03=function(_0x33e93d,_0x1a8423){_0x33e93d=_0x33e93d-0x0;var _0x19e99d=_0xc03c[_0x33e93d];return _0x19e99d;};'use strict';var _=require(_0xcc03('0x0'));var util=require('util');var moment=require(_0xcc03('0x1'));var BPromise=require(_0xcc03('0x2'));var rs=require(_0xcc03('0x3'));var fs=require('fs');var Redis=require(_0xcc03('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcc03('0x5'))(_0xcc03('0x6'));var config=require('../../config/environment');var jayson=require(_0xcc03('0x7'));var client=jayson[_0xcc03('0x8')][_0xcc03('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35a00c,_0x565d96,_0x3ec11c){return new BPromise(function(_0x3defd6,_0x34832e){return client[_0xcc03('0xa')](_0x35a00c,_0x3ec11c)['then'](function(_0x45da64){logger[_0xcc03('0xb')](_0xcc03('0xc'),_0x565d96,_0xcc03('0xd'));logger[_0xcc03('0xe')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x565d96,'request\x20sent',JSON[_0xcc03('0xf')](_0x45da64));if(_0x45da64[_0xcc03('0x10')]){if(_0x45da64['error'][_0xcc03('0x11')]===0x1f4){logger[_0xcc03('0x10')](_0xcc03('0xc'),_0x565d96,_0x45da64['error']['message']);return _0x34832e(_0x45da64['error'][_0xcc03('0x12')]);}logger['error'](_0xcc03('0xc'),_0x565d96,_0x45da64[_0xcc03('0x10')][_0xcc03('0x12')]);return _0x3defd6(_0x45da64[_0xcc03('0x10')][_0xcc03('0x12')]);}else{logger[_0xcc03('0xb')](_0xcc03('0xc'),_0x565d96,'request\x20sent');_0x3defd6(_0x45da64[_0xcc03('0x13')]['message']);}})[_0xcc03('0x14')](function(_0x242b27){logger['error'](_0xcc03('0xc'),_0x565d96,_0x242b27);_0x34832e(_0x242b27);});});} \ No newline at end of file +var _0xed9f=['moment','ioredis','../../mysqldb','rpc','jayson/promise','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash','util'];(function(_0x15876a,_0x15383d){var _0xbd900f=function(_0x103e59){while(--_0x103e59){_0x15876a['push'](_0x15876a['shift']());}};_0xbd900f(++_0x15383d);}(_0xed9f,0x86));var _0xfed9=function(_0x286595,_0x29f350){_0x286595=_0x286595-0x0;var _0x3ea6b8=_0xed9f[_0x286595];return _0x3ea6b8;};'use strict';var _=require(_0xfed9('0x0'));var util=require(_0xfed9('0x1'));var moment=require(_0xfed9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfed9('0x3'));var db=require(_0xfed9('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfed9('0x5'));var config=require('../../config/environment');var jayson=require(_0xfed9('0x6'));var client=jayson[_0xfed9('0x7')][_0xfed9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45cfb4,_0x4ad1f0,_0x134b2c){return new BPromise(function(_0x52692d,_0x57a938){return client['request'](_0x45cfb4,_0x134b2c)[_0xfed9('0x9')](function(_0x3618aa){logger[_0xfed9('0xa')](_0xfed9('0xb'),_0x4ad1f0,_0xfed9('0xc'));logger[_0xfed9('0xd')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x4ad1f0,_0xfed9('0xc'),JSON['stringify'](_0x3618aa));if(_0x3618aa[_0xfed9('0xe')]){if(_0x3618aa[_0xfed9('0xe')][_0xfed9('0xf')]===0x1f4){logger[_0xfed9('0xe')](_0xfed9('0xb'),_0x4ad1f0,_0x3618aa['error']['message']);return _0x57a938(_0x3618aa['error']['message']);}logger[_0xfed9('0xe')](_0xfed9('0xb'),_0x4ad1f0,_0x3618aa[_0xfed9('0xe')][_0xfed9('0x10')]);return _0x52692d(_0x3618aa['error'][_0xfed9('0x10')]);}else{logger['info'](_0xfed9('0xb'),_0x4ad1f0,_0xfed9('0xc'));_0x52692d(_0x3618aa['result']['message']);}})['catch'](function(_0x5b0136){logger[_0xfed9('0xe')](_0xfed9('0xb'),_0x4ad1f0,_0x5b0136);_0x57a938(_0x5b0136);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 15287c1..c408b01 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 _0xf903=['../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','/:id','create','put','update','delete','exports','multer','path','express','Router'];(function(_0x16c63a,_0x4ae486){var _0x6d330f=function(_0x3ba91b){while(--_0x3ba91b){_0x16c63a['push'](_0x16c63a['shift']());}};_0x6d330f(++_0x4ae486);}(_0xf903,0xce));var _0x3f90=function(_0x569b43,_0x2088ac){_0x569b43=_0x569b43-0x0;var _0x550788=_0xf903[_0x569b43];return _0x550788;};'use strict';var multer=require(_0x3f90('0x0'));var util=require('util');var path=require(_0x3f90('0x1'));var timeout=require('connect-timeout');var express=require(_0x3f90('0x2'));var router=express[_0x3f90('0x3')]();var auth=require(_0x3f90('0x4'));var interaction=require(_0x3f90('0x5'));var config=require('../../config/environment');var controller=require(_0x3f90('0x6'));router[_0x3f90('0x7')]('/',auth[_0x3f90('0x8')](),controller['index']);router[_0x3f90('0x7')](_0x3f90('0x9'),auth[_0x3f90('0x8')](),controller['show']);router['post']('/',auth[_0x3f90('0x8')](),controller[_0x3f90('0xa')]);router[_0x3f90('0xb')](_0x3f90('0x9'),auth['isAuthenticated'](),controller[_0x3f90('0xc')]);router[_0x3f90('0xd')](_0x3f90('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x3f90('0xe')]=router; \ No newline at end of file +var _0xec13=['path','connect-timeout','express','Router','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','/:id','post','create','put','update','destroy','util'];(function(_0x35e28d,_0x28f31a){var _0x1641b1=function(_0x29ef5c){while(--_0x29ef5c){_0x35e28d['push'](_0x35e28d['shift']());}};_0x1641b1(++_0x28f31a);}(_0xec13,0x15f));var _0x3ec1=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xec13[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0x3ec1('0x0'));var path=require(_0x3ec1('0x1'));var timeout=require(_0x3ec1('0x2'));var express=require(_0x3ec1('0x3'));var router=express[_0x3ec1('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3ec1('0x5'));var controller=require(_0x3ec1('0x6'));router['get']('/',auth[_0x3ec1('0x7')](),controller[_0x3ec1('0x8')]);router[_0x3ec1('0x9')](_0x3ec1('0xa'),auth[_0x3ec1('0x7')](),controller['show']);router[_0x3ec1('0xb')]('/',auth['isAuthenticated'](),controller[_0x3ec1('0xc')]);router[_0x3ec1('0xd')](_0x3ec1('0xa'),auth[_0x3ec1('0x7')](),controller[_0x3ec1('0xe')]);router['delete'](_0x3ec1('0xa'),auth[_0x3ec1('0x7')](),controller[_0x3ec1('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 a04ccbe..749c1d7 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 _0x3f47=['string','customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','exports'];(function(_0x134909,_0x1ecd52){var _0x491d3f=function(_0x2ad3c9){while(--_0x2ad3c9){_0x134909['push'](_0x134909['shift']());}};_0x491d3f(++_0x1ecd52);}(_0x3f47,0x10e));var _0x73f4=function(_0x301874,_0x154f50){_0x301874=_0x301874-0x0;var _0x4a4939=_0x3f47[_0x301874];return _0x4a4939;};'use strict';var Sequelize=require(_0x73f4('0x0'));module[_0x73f4('0x1')]={'type':{'type':Sequelize['ENUM'](_0x73f4('0x2'),'variable',_0x73f4('0x3'),_0x73f4('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x73f4('0x5')]},'key':{'type':Sequelize[_0x73f4('0x5')]},'keyType':{'type':Sequelize[_0x73f4('0x6')](_0x73f4('0x2'),'variable',_0x73f4('0x3'))},'keyContent':{'type':Sequelize[_0x73f4('0x5')]},'idField':{'type':Sequelize[_0x73f4('0x5')]},'nameField':{'type':Sequelize[_0x73f4('0x5')]},'customField':{'type':Sequelize[_0x73f4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x73f4('0x5')]}}; \ No newline at end of file +var _0xeac6=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0x2767ec,_0x8548d7){var _0x10a88d=function(_0xf88ece){while(--_0xf88ece){_0x2767ec['push'](_0x2767ec['shift']());}};_0x10a88d(++_0x8548d7);}(_0xeac6,0xc0));var _0x6eac=function(_0xb3ebb1,_0x4bf8a8){_0xb3ebb1=_0xb3ebb1-0x0;var _0x39594b=_0xeac6[_0xb3ebb1];return _0x39594b;};'use strict';var Sequelize=require(_0x6eac('0x0'));module[_0x6eac('0x1')]={'type':{'type':Sequelize[_0x6eac('0x2')]('string',_0x6eac('0x3'),_0x6eac('0x4'),_0x6eac('0x5')),'defaultValue':_0x6eac('0x6')},'content':{'type':Sequelize[_0x6eac('0x7')]},'key':{'type':Sequelize[_0x6eac('0x7')]},'keyType':{'type':Sequelize[_0x6eac('0x2')](_0x6eac('0x6'),_0x6eac('0x3'),_0x6eac('0x4'))},'keyContent':{'type':Sequelize[_0x6eac('0x7')]},'idField':{'type':Sequelize[_0x6eac('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6eac('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 2595564..7bc1f9a 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 _0x126e=['apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','VtigerField','count','includeAll','include','findAll','catch','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range'];(function(_0x3aaae4,_0x306e97){var _0x47bf30=function(_0x45a355){while(--_0x45a355){_0x3aaae4['push'](_0x3aaae4['shift']());}};_0x47bf30(++_0x306e97);}(_0x126e,0x108));var _0xe126=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x126e[_0x3b380d];return _0x54502b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe126('0x0'));var rimraf=require(_0xe126('0x1'));var zipdir=require(_0xe126('0x2'));var jsonpatch=require(_0xe126('0x3'));var rp=require(_0xe126('0x4'));var moment=require(_0xe126('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe126('0x6'));var util=require(_0xe126('0x7'));var path=require(_0xe126('0x8'));var sox=require(_0xe126('0x9'));var csv=require(_0xe126('0xa'));var ejs=require(_0xe126('0xb'));var fs=require('fs');var _=require(_0xe126('0xc'));var squel=require('squel');var crypto=require(_0xe126('0xd'));var jsforce=require(_0xe126('0xe'));var deskjs=require(_0xe126('0xf'));var toCsv=require(_0xe126('0xa'));var querystring=require(_0xe126('0x10'));var Papa=require('papaparse');var Redis=require(_0xe126('0x11'));var authService=require(_0xe126('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe126('0x13'));var hardwareService=require(_0xe126('0x14'));var logger=require('../../config/logger')(_0xe126('0x15'));var utils=require('../../config/utils');var config=require(_0xe126('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe126('0x17'))['db'];function respondWithStatusCode(_0x34ae06,_0x23ff02){_0x23ff02=_0x23ff02||0xcc;return function(_0x38b8c3){if(_0x38b8c3){return _0x34ae06[_0xe126('0x18')](_0x23ff02);}return _0x34ae06[_0xe126('0x19')](_0x23ff02)[_0xe126('0x1a')]();};}function respondWithResult(_0x55f10a,_0xd55baf){_0xd55baf=_0xd55baf||0xc8;return function(_0x1c02c9){if(_0x1c02c9){return _0x55f10a['status'](_0xd55baf)[_0xe126('0x1b')](_0x1c02c9);}};}function respondWithFilteredResult(_0x28d7dd,_0x10bc24){return function(_0x38b0c0){if(_0x38b0c0){var _0x5e52d1=_0x38b0c0['count'],_0x14bfb7=_0x10bc24[_0xe126('0x1c')],_0x3a4996=_0x10bc24['offset']+_0x10bc24[_0xe126('0x1d')],_0x1c32fe;if(_0x3a4996>=_0x5e52d1){_0x3a4996=_0x5e52d1;_0x1c32fe=0xc8;}else{_0x1c32fe=0xce;}_0x28d7dd[_0xe126('0x19')](_0x1c32fe);return _0x28d7dd[_0xe126('0x1e')](_0xe126('0x1f'),_0x14bfb7+'-'+_0x3a4996+'/'+_0x5e52d1)[_0xe126('0x1b')](_0x38b0c0);}return null;};}function patchUpdates(_0x2efb73){return function(_0x20874b){try{jsonpatch[_0xe126('0x20')](_0x20874b,_0x2efb73,!![]);}catch(_0x5cc73b){return BPromise[_0xe126('0x21')](_0x5cc73b);}return _0x20874b[_0xe126('0x22')]();};}function saveUpdates(_0x35ab64,_0x2e5617){return function(_0x1777e2){if(_0x1777e2){return _0x1777e2[_0xe126('0x23')](_0x35ab64)[_0xe126('0x24')](function(_0x9dd8d1){return _0x9dd8d1;});}return null;};}function removeEntity(_0x5257bc,_0x4a1a97){return function(_0xdb6544){if(_0xdb6544){return _0xdb6544[_0xe126('0x25')]()[_0xe126('0x24')](function(){_0x5257bc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47f179,_0x4807d3){return function(_0x20378c){if(!_0x20378c){_0x47f179['sendStatus'](0x194);}return _0x20378c;};}function handleError(_0x264082,_0x2f05ec){_0x2f05ec=_0x2f05ec||0x1f4;return function(_0x4157ed){logger[_0xe126('0x26')](_0x4157ed['stack']);if(_0x4157ed['name']){delete _0x4157ed[_0xe126('0x27')];}_0x264082['status'](_0x2f05ec)[_0xe126('0x28')](_0x4157ed);};}exports[_0xe126('0x29')]=function(_0x630bcc,_0x5b31a4){var _0x45f55c={},_0x449309={},_0x4f5d09={'count':0x0,'rows':[]};var _0x5efeab=_[_0xe126('0x2a')](db['VtigerField'][_0xe126('0x2b')],function(_0x1fb354){return{'name':_0x1fb354[_0xe126('0x2c')],'type':_0x1fb354[_0xe126('0x2d')]['key']};});_0x449309[_0xe126('0x2e')]=_[_0xe126('0x2a')](_0x5efeab,'name');_0x449309['query']=_[_0xe126('0x2f')](_0x630bcc['query']);_0x449309[_0xe126('0x30')]=_[_0xe126('0x31')](_0x449309[_0xe126('0x2e')],_0x449309['query']);_0x45f55c[_0xe126('0x32')]=_[_0xe126('0x31')](_0x449309[_0xe126('0x2e')],qs['fields'](_0x630bcc[_0xe126('0x33')][_0xe126('0x34')]));_0x45f55c['attributes']=_0x45f55c['attributes'][_0xe126('0x35')]?_0x45f55c[_0xe126('0x32')]:_0x449309[_0xe126('0x2e')];if(!_0x630bcc[_0xe126('0x33')][_0xe126('0x36')](_0xe126('0x37'))){_0x45f55c[_0xe126('0x1d')]=qs[_0xe126('0x1d')](_0x630bcc['query'][_0xe126('0x1d')]);_0x45f55c[_0xe126('0x1c')]=qs[_0xe126('0x1c')](_0x630bcc[_0xe126('0x33')][_0xe126('0x1c')]);}_0x45f55c[_0xe126('0x38')]=qs['sort'](_0x630bcc[_0xe126('0x33')][_0xe126('0x39')]);_0x45f55c[_0xe126('0x3a')]=qs[_0xe126('0x30')](_[_0xe126('0x3b')](_0x630bcc['query'],_0x449309[_0xe126('0x30')]),_0x5efeab);if(_0x630bcc[_0xe126('0x33')][_0xe126('0x3c')]){_0x45f55c[_0xe126('0x3a')]=_['merge'](_0x45f55c[_0xe126('0x3a')],{'$or':_[_0xe126('0x2a')](_0x5efeab,function(_0x471715){if(_0x471715[_0xe126('0x2d')]!==_0xe126('0x3d')){var _0x2fe73a={};_0x2fe73a[_0x471715['name']]={'$like':'%'+_0x630bcc[_0xe126('0x33')][_0xe126('0x3c')]+'%'};return _0x2fe73a;}})});}_0x45f55c=_[_0xe126('0x3e')]({},_0x45f55c,_0x630bcc['options']);var _0x5073bc={'where':_0x45f55c[_0xe126('0x3a')]};return db[_0xe126('0x3f')][_0xe126('0x40')](_0x5073bc)[_0xe126('0x24')](function(_0x2caea4){_0x4f5d09[_0xe126('0x40')]=_0x2caea4;if(_0x630bcc['query'][_0xe126('0x41')]){_0x45f55c[_0xe126('0x42')]=[{'all':!![]}];}return db['VtigerField'][_0xe126('0x43')](_0x45f55c);})[_0xe126('0x24')](function(_0x9c5767){_0x4f5d09['rows']=_0x9c5767;return _0x4f5d09;})[_0xe126('0x24')](respondWithFilteredResult(_0x5b31a4,_0x45f55c))[_0xe126('0x44')](handleError(_0x5b31a4,null));};exports['show']=function(_0x130a1f,_0x366754){var _0x5629a8={'raw':!![],'where':{'id':_0x130a1f['params']['id']}},_0x3e168d={};_0x3e168d[_0xe126('0x2e')]=_[_0xe126('0x2f')](db['VtigerField'][_0xe126('0x2b')]);_0x3e168d[_0xe126('0x33')]=_[_0xe126('0x2f')](_0x130a1f['query']);_0x3e168d[_0xe126('0x30')]=_['intersection'](_0x3e168d[_0xe126('0x2e')],_0x3e168d[_0xe126('0x33')]);_0x5629a8[_0xe126('0x32')]=_[_0xe126('0x31')](_0x3e168d[_0xe126('0x2e')],qs[_0xe126('0x34')](_0x130a1f[_0xe126('0x33')][_0xe126('0x34')]));_0x5629a8[_0xe126('0x32')]=_0x5629a8[_0xe126('0x32')][_0xe126('0x35')]?_0x5629a8['attributes']:_0x3e168d['model'];if(_0x130a1f[_0xe126('0x33')][_0xe126('0x41')]){_0x5629a8['include']=[{'all':!![]}];}_0x5629a8=_[_0xe126('0x3e')]({},_0x5629a8,_0x130a1f[_0xe126('0x45')]);return db[_0xe126('0x3f')][_0xe126('0x46')](_0x5629a8)['then'](handleEntityNotFound(_0x366754,null))[_0xe126('0x24')](respondWithResult(_0x366754,null))[_0xe126('0x44')](handleError(_0x366754,null));};exports[_0xe126('0x47')]=function(_0x45ac4a,_0x376f9e){return db[_0xe126('0x3f')][_0xe126('0x47')](_0x45ac4a[_0xe126('0x48')],{})[_0xe126('0x24')](respondWithResult(_0x376f9e,0xc9))[_0xe126('0x44')](handleError(_0x376f9e,null));};exports[_0xe126('0x23')]=function(_0x237181,_0x24c312){if(_0x237181['body']['id']){delete _0x237181['body']['id'];}return db['VtigerField']['find']({'where':{'id':_0x237181[_0xe126('0x49')]['id']}})[_0xe126('0x24')](handleEntityNotFound(_0x24c312,null))[_0xe126('0x24')](saveUpdates(_0x237181[_0xe126('0x48')],null))[_0xe126('0x24')](respondWithResult(_0x24c312,null))[_0xe126('0x44')](handleError(_0x24c312,null));};exports[_0xe126('0x25')]=function(_0x5ece85,_0x58b1ef){return db[_0xe126('0x3f')][_0xe126('0x46')]({'where':{'id':_0x5ece85['params']['id']}})[_0xe126('0x24')](handleEntityNotFound(_0x58b1ef,null))[_0xe126('0x24')](removeEntity(_0x58b1ef,null))['catch'](handleError(_0x58b1ef,null));}; \ No newline at end of file +var _0xf072=['nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','create','body','update','find','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','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','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty'];(function(_0x26ff31,_0x46bc7b){var _0x47c461=function(_0x2f027a){while(--_0x2f027a){_0x26ff31['push'](_0x26ff31['shift']());}};_0x47c461(++_0x46bc7b);}(_0xf072,0x1cf));var _0x2f07=function(_0x2d25ef,_0x2fc879){_0x2d25ef=_0x2d25ef-0x0;var _0x5488f2=_0xf072[_0x2d25ef];return _0x5488f2;};'use strict';var pdf=require(_0x2f07('0x0'));var emlformat=require(_0x2f07('0x1'));var rimraf=require(_0x2f07('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2f07('0x3'));var rp=require('request-promise');var moment=require(_0x2f07('0x4'));var BPromise=require(_0x2f07('0x5'));var Mustache=require(_0x2f07('0x6'));var util=require('util');var path=require(_0x2f07('0x7'));var sox=require(_0x2f07('0x8'));var csv=require(_0x2f07('0x9'));var ejs=require(_0x2f07('0xa'));var fs=require('fs');var _=require(_0x2f07('0xb'));var squel=require(_0x2f07('0xc'));var crypto=require(_0x2f07('0xd'));var jsforce=require(_0x2f07('0xe'));var deskjs=require(_0x2f07('0xf'));var toCsv=require(_0x2f07('0x9'));var querystring=require(_0x2f07('0x10'));var Papa=require(_0x2f07('0x11'));var Redis=require(_0x2f07('0x12'));var authService=require(_0x2f07('0x13'));var qs=require(_0x2f07('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f07('0x15'));var logger=require(_0x2f07('0x16'))(_0x2f07('0x17'));var utils=require(_0x2f07('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2f07('0x19'))['db'];function respondWithStatusCode(_0x1e291d,_0x58549c){_0x58549c=_0x58549c||0xcc;return function(_0x6eb88a){if(_0x6eb88a){return _0x1e291d[_0x2f07('0x1a')](_0x58549c);}return _0x1e291d[_0x2f07('0x1b')](_0x58549c)['end']();};}function respondWithResult(_0x211514,_0x443fdc){_0x443fdc=_0x443fdc||0xc8;return function(_0x3596ea){if(_0x3596ea){return _0x211514[_0x2f07('0x1b')](_0x443fdc)[_0x2f07('0x1c')](_0x3596ea);}};}function respondWithFilteredResult(_0x309908,_0x5d32d6){return function(_0x8475cf){if(_0x8475cf){var _0x5a7b5c=_0x8475cf[_0x2f07('0x1d')],_0x2232a4=_0x5d32d6[_0x2f07('0x1e')],_0xe8cf4d=_0x5d32d6[_0x2f07('0x1e')]+_0x5d32d6[_0x2f07('0x1f')],_0x1dace4;if(_0xe8cf4d>=_0x5a7b5c){_0xe8cf4d=_0x5a7b5c;_0x1dace4=0xc8;}else{_0x1dace4=0xce;}_0x309908[_0x2f07('0x1b')](_0x1dace4);return _0x309908['set'](_0x2f07('0x20'),_0x2232a4+'-'+_0xe8cf4d+'/'+_0x5a7b5c)['json'](_0x8475cf);}return null;};}function patchUpdates(_0x3cd3c0){return function(_0x2df6ed){try{jsonpatch[_0x2f07('0x21')](_0x2df6ed,_0x3cd3c0,!![]);}catch(_0xd944d6){return BPromise[_0x2f07('0x22')](_0xd944d6);}return _0x2df6ed['save']();};}function saveUpdates(_0x45df73,_0x5a0146){return function(_0x5db56b){if(_0x5db56b){return _0x5db56b['update'](_0x45df73)[_0x2f07('0x23')](function(_0x51c285){return _0x51c285;});}return null;};}function removeEntity(_0xb0c978,_0x5e6ac6){return function(_0x354ee2){if(_0x354ee2){return _0x354ee2[_0x2f07('0x24')]()[_0x2f07('0x23')](function(){_0xb0c978[_0x2f07('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31be77,_0x428d8c){return function(_0x37c42a){if(!_0x37c42a){_0x31be77['sendStatus'](0x194);}return _0x37c42a;};}function handleError(_0x111376,_0x113916){_0x113916=_0x113916||0x1f4;return function(_0x522006){logger[_0x2f07('0x25')](_0x522006[_0x2f07('0x26')]);if(_0x522006['name']){delete _0x522006[_0x2f07('0x27')];}_0x111376['status'](_0x113916)[_0x2f07('0x28')](_0x522006);};}exports[_0x2f07('0x29')]=function(_0x27bd72,_0x18f599){var _0x20e4f8={},_0x139ea8={},_0x787aad={'count':0x0,'rows':[]};var _0xfc52cf=_[_0x2f07('0x2a')](db[_0x2f07('0x2b')][_0x2f07('0x2c')],function(_0x279eb3){return{'name':_0x279eb3['fieldName'],'type':_0x279eb3[_0x2f07('0x2d')][_0x2f07('0x2e')]};});_0x139ea8[_0x2f07('0x2f')]=_['map'](_0xfc52cf,_0x2f07('0x27'));_0x139ea8[_0x2f07('0x30')]=_[_0x2f07('0x31')](_0x27bd72['query']);_0x139ea8[_0x2f07('0x32')]=_[_0x2f07('0x33')](_0x139ea8[_0x2f07('0x2f')],_0x139ea8[_0x2f07('0x30')]);_0x20e4f8[_0x2f07('0x34')]=_[_0x2f07('0x33')](_0x139ea8[_0x2f07('0x2f')],qs['fields'](_0x27bd72[_0x2f07('0x30')]['fields']));_0x20e4f8[_0x2f07('0x34')]=_0x20e4f8[_0x2f07('0x34')][_0x2f07('0x35')]?_0x20e4f8[_0x2f07('0x34')]:_0x139ea8[_0x2f07('0x2f')];if(!_0x27bd72[_0x2f07('0x30')][_0x2f07('0x36')](_0x2f07('0x37'))){_0x20e4f8[_0x2f07('0x1f')]=qs[_0x2f07('0x1f')](_0x27bd72[_0x2f07('0x30')][_0x2f07('0x1f')]);_0x20e4f8[_0x2f07('0x1e')]=qs[_0x2f07('0x1e')](_0x27bd72[_0x2f07('0x30')][_0x2f07('0x1e')]);}_0x20e4f8['order']=qs['sort'](_0x27bd72[_0x2f07('0x30')][_0x2f07('0x38')]);_0x20e4f8[_0x2f07('0x39')]=qs['filters'](_['pick'](_0x27bd72[_0x2f07('0x30')],_0x139ea8['filters']),_0xfc52cf);if(_0x27bd72[_0x2f07('0x30')][_0x2f07('0x3a')]){_0x20e4f8[_0x2f07('0x39')]=_[_0x2f07('0x3b')](_0x20e4f8[_0x2f07('0x39')],{'$or':_['map'](_0xfc52cf,function(_0x45fe2f){if(_0x45fe2f['type']!==_0x2f07('0x3c')){var _0x4b38ba={};_0x4b38ba[_0x45fe2f[_0x2f07('0x27')]]={'$like':'%'+_0x27bd72['query']['filter']+'%'};return _0x4b38ba;}})});}_0x20e4f8=_[_0x2f07('0x3b')]({},_0x20e4f8,_0x27bd72[_0x2f07('0x3d')]);var _0x5e96b5={'where':_0x20e4f8[_0x2f07('0x39')]};return db[_0x2f07('0x2b')][_0x2f07('0x1d')](_0x5e96b5)['then'](function(_0x17b88f){_0x787aad[_0x2f07('0x1d')]=_0x17b88f;if(_0x27bd72[_0x2f07('0x30')][_0x2f07('0x3e')]){_0x20e4f8[_0x2f07('0x3f')]=[{'all':!![]}];}return db[_0x2f07('0x2b')][_0x2f07('0x40')](_0x20e4f8);})[_0x2f07('0x23')](function(_0x5083d5){_0x787aad[_0x2f07('0x41')]=_0x5083d5;return _0x787aad;})[_0x2f07('0x23')](respondWithFilteredResult(_0x18f599,_0x20e4f8))[_0x2f07('0x42')](handleError(_0x18f599,null));};exports[_0x2f07('0x43')]=function(_0x46c665,_0x2ded2e){var _0x5129c={'raw':!![],'where':{'id':_0x46c665[_0x2f07('0x44')]['id']}},_0x5879ce={};_0x5879ce[_0x2f07('0x2f')]=_[_0x2f07('0x31')](db[_0x2f07('0x2b')][_0x2f07('0x2c')]);_0x5879ce[_0x2f07('0x30')]=_['keys'](_0x46c665[_0x2f07('0x30')]);_0x5879ce[_0x2f07('0x32')]=_[_0x2f07('0x33')](_0x5879ce[_0x2f07('0x2f')],_0x5879ce['query']);_0x5129c['attributes']=_[_0x2f07('0x33')](_0x5879ce[_0x2f07('0x2f')],qs[_0x2f07('0x45')](_0x46c665[_0x2f07('0x30')]['fields']));_0x5129c[_0x2f07('0x34')]=_0x5129c[_0x2f07('0x34')][_0x2f07('0x35')]?_0x5129c[_0x2f07('0x34')]:_0x5879ce[_0x2f07('0x2f')];if(_0x46c665[_0x2f07('0x30')][_0x2f07('0x3e')]){_0x5129c[_0x2f07('0x3f')]=[{'all':!![]}];}_0x5129c=_[_0x2f07('0x3b')]({},_0x5129c,_0x46c665[_0x2f07('0x3d')]);return db['VtigerField']['find'](_0x5129c)['then'](handleEntityNotFound(_0x2ded2e,null))[_0x2f07('0x23')](respondWithResult(_0x2ded2e,null))[_0x2f07('0x42')](handleError(_0x2ded2e,null));};exports['create']=function(_0x97c166,_0x562b0f){return db[_0x2f07('0x2b')][_0x2f07('0x46')](_0x97c166[_0x2f07('0x47')],{})['then'](respondWithResult(_0x562b0f,0xc9))[_0x2f07('0x42')](handleError(_0x562b0f,null));};exports[_0x2f07('0x48')]=function(_0x47b17f,_0x521aed){if(_0x47b17f[_0x2f07('0x47')]['id']){delete _0x47b17f[_0x2f07('0x47')]['id'];}return db[_0x2f07('0x2b')][_0x2f07('0x49')]({'where':{'id':_0x47b17f[_0x2f07('0x44')]['id']}})[_0x2f07('0x23')](handleEntityNotFound(_0x521aed,null))[_0x2f07('0x23')](saveUpdates(_0x47b17f[_0x2f07('0x47')],null))[_0x2f07('0x23')](respondWithResult(_0x521aed,null))[_0x2f07('0x42')](handleError(_0x521aed,null));};exports[_0x2f07('0x24')]=function(_0x9a94c8,_0x405078){return db[_0x2f07('0x2b')][_0x2f07('0x49')]({'where':{'id':_0x9a94c8[_0x2f07('0x44')]['id']}})['then'](handleEntityNotFound(_0x405078,null))[_0x2f07('0x23')](removeEntity(_0x405078,null))[_0x2f07('0x42')](handleError(_0x405078,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index e797a4d..46e18ea 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(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_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 diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 686b7fb..dd762a7 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 _0xbc9d=['randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x1d0c1d,_0xff4dfb){_0x1d0c1d=_0x1d0c1d-0x0;var _0x5ed1f0=_0xbc9d[_0x1d0c1d];return _0x5ed1f0;};'use strict';var _=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var moment=require(_0xdbc9('0x2'));var BPromise=require(_0xdbc9('0x3'));var rs=require(_0xdbc9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdbc9('0x5'))(_0xdbc9('0x6'));var config=require(_0xdbc9('0x7'));var jayson=require(_0xdbc9('0x8'));var client=jayson[_0xdbc9('0x9')][_0xdbc9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x381a0e,_0x4a9246,_0x2dbd23){return new BPromise(function(_0x181f8a,_0x3d4918){return client['request'](_0x381a0e,_0x2dbd23)[_0xdbc9('0xb')](function(_0x53cff1){logger['info'](_0xdbc9('0xc'),_0x4a9246,_0xdbc9('0xd'));logger[_0xdbc9('0xe')](_0xdbc9('0xf'),_0x4a9246,'request\x20sent',JSON[_0xdbc9('0x10')](_0x53cff1));if(_0x53cff1[_0xdbc9('0x11')]){if(_0x53cff1[_0xdbc9('0x11')][_0xdbc9('0x12')]===0x1f4){logger[_0xdbc9('0x11')](_0xdbc9('0xc'),_0x4a9246,_0x53cff1['error']['message']);return _0x3d4918(_0x53cff1[_0xdbc9('0x11')][_0xdbc9('0x13')]);}logger[_0xdbc9('0x11')](_0xdbc9('0xc'),_0x4a9246,_0x53cff1[_0xdbc9('0x11')]['message']);return _0x181f8a(_0x53cff1[_0xdbc9('0x11')][_0xdbc9('0x13')]);}else{logger[_0xdbc9('0x14')]('VtigerField,\x20%s,\x20%s',_0x4a9246,_0xdbc9('0xd'));_0x181f8a(_0x53cff1[_0xdbc9('0x15')]['message']);}})[_0xdbc9('0x16')](function(_0x37856d){logger[_0xdbc9('0x11')](_0xdbc9('0xc'),_0x4a9246,_0x37856d);_0x3d4918(_0x37856d);});});} \ No newline at end of file +var _0xd509=['request','then','info','debug','request\x20sent','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0xe2b3d5,_0x129b43){var _0x160088=function(_0x4161f6){while(--_0x4161f6){_0xe2b3d5['push'](_0xe2b3d5['shift']());}};_0x160088(++_0x129b43);}(_0xd509,0xc9));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9d50('0x0'));var BPromise=require(_0x9d50('0x1'));var rs=require(_0x9d50('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9d50('0x3'));var logger=require(_0x9d50('0x4'))('rpc');var config=require(_0x9d50('0x5'));var jayson=require(_0x9d50('0x6'));var client=jayson[_0x9d50('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x907927,_0x57ca79,_0x427cee){return new BPromise(function(_0x9b5ecd,_0x2f7c2f){return client[_0x9d50('0x8')](_0x907927,_0x427cee)[_0x9d50('0x9')](function(_0x5380be){logger[_0x9d50('0xa')]('VtigerField,\x20%s,\x20%s',_0x57ca79,'request\x20sent');logger[_0x9d50('0xb')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x57ca79,_0x9d50('0xc'),JSON[_0x9d50('0xd')](_0x5380be));if(_0x5380be[_0x9d50('0xe')]){if(_0x5380be[_0x9d50('0xe')][_0x9d50('0xf')]===0x1f4){logger[_0x9d50('0xe')](_0x9d50('0x10'),_0x57ca79,_0x5380be['error'][_0x9d50('0x11')]);return _0x2f7c2f(_0x5380be['error'][_0x9d50('0x11')]);}logger[_0x9d50('0xe')](_0x9d50('0x10'),_0x57ca79,_0x5380be[_0x9d50('0xe')][_0x9d50('0x11')]);return _0x9b5ecd(_0x5380be[_0x9d50('0xe')][_0x9d50('0x11')]);}else{logger[_0x9d50('0xa')](_0x9d50('0x10'),_0x57ca79,_0x9d50('0xc'));_0x9b5ecd(_0x5380be[_0x9d50('0x12')][_0x9d50('0x11')]);}})['catch'](function(_0x12d178){logger[_0x9d50('0xe')](_0x9d50('0x10'),_0x57ca79,_0x12d178);_0x2f7c2f(_0x12d178);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 7dd06d3..914e719 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 _0x18a5=['update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put'];(function(_0x2d0dc0,_0x4ccd75){var _0x142527=function(_0xa66335){while(--_0xa66335){_0x2d0dc0['push'](_0x2d0dc0['shift']());}};_0x142527(++_0x4ccd75);}(_0x18a5,0x164));var _0x518a=function(_0x5ba7de,_0x5a74b2){_0x5ba7de=_0x5ba7de-0x0;var _0x526ed0=_0x18a5[_0x5ba7de];return _0x526ed0;};'use strict';var multer=require(_0x518a('0x0'));var util=require(_0x518a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x518a('0x2'));var router=express['Router']();var auth=require(_0x518a('0x3'));var interaction=require(_0x518a('0x4'));var config=require(_0x518a('0x5'));var controller=require(_0x518a('0x6'));router[_0x518a('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x518a('0x8'),auth[_0x518a('0x9')](),controller[_0x518a('0xa')]);router[_0x518a('0x7')](_0x518a('0xb'),auth[_0x518a('0x9')](),controller[_0x518a('0xc')]);router[_0x518a('0x7')](_0x518a('0xd'),auth[_0x518a('0x9')](),controller[_0x518a('0xe')]);router[_0x518a('0xf')]('/',auth[_0x518a('0x9')](),controller[_0x518a('0x10')]);router[_0x518a('0xf')]('/:id/configurations',auth[_0x518a('0x9')](),controller['addConfiguration']);router[_0x518a('0x11')]('/:id',auth[_0x518a('0x9')](),controller[_0x518a('0x12')]);router[_0x518a('0x13')](_0x518a('0x8'),auth[_0x518a('0x9')](),controller[_0x518a('0x14')]);module[_0x518a('0x15')]=router; \ No newline at end of file +var _0x605e=['util','connect-timeout','express','../../config/environment','./intZendeskAccount.controller','get','index','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','delete','destroy','exports','multer'];(function(_0x33e90b,_0x4c3364){var _0x1719ab=function(_0x1008c5){while(--_0x1008c5){_0x33e90b['push'](_0x33e90b['shift']());}};_0x1719ab(++_0x4c3364);}(_0x605e,0x1b8));var _0xe605=function(_0xff5770,_0x49b989){_0xff5770=_0xff5770-0x0;var _0xf0c980=_0x605e[_0xff5770];return _0xf0c980;};'use strict';var multer=require(_0xe605('0x0'));var util=require(_0xe605('0x1'));var path=require('path');var timeout=require(_0xe605('0x2'));var express=require(_0xe605('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe605('0x4'));var controller=require(_0xe605('0x5'));router[_0xe605('0x6')]('/',auth['isAuthenticated'](),controller[_0xe605('0x7')]);router[_0xe605('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xe605('0x8')]);router[_0xe605('0x6')](_0xe605('0x9'),auth[_0xe605('0xa')](),controller[_0xe605('0xb')]);router['get'](_0xe605('0xc'),auth[_0xe605('0xa')](),controller[_0xe605('0xd')]);router[_0xe605('0xe')]('/',auth[_0xe605('0xa')](),controller['create']);router[_0xe605('0xe')](_0xe605('0x9'),auth[_0xe605('0xa')](),controller[_0xe605('0xf')]);router[_0xe605('0x10')](_0xe605('0x11'),auth[_0xe605('0xa')](),controller['update']);router[_0xe605('0x12')](_0xe605('0x11'),auth[_0xe605('0xa')](),controller[_0xe605('0x13')]);module[_0xe605('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 59fe8a5..5d3046d 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 _0x84b0=['ENUM','password','token','newTab','sequelize','exports','STRING','username'];(function(_0x541ea6,_0x51cab6){var _0x3c3e84=function(_0xc06bed){while(--_0xc06bed){_0x541ea6['push'](_0x541ea6['shift']());}};_0x3c3e84(++_0x51cab6);}(_0x84b0,0x1ec));var _0x084b=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x84b0[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0x084b('0x0'));module[_0x084b('0x1')]={'name':{'type':Sequelize[_0x084b('0x2')]},'description':{'type':Sequelize[_0x084b('0x2')]},'username':{'type':Sequelize[_0x084b('0x2')],'unique':_0x084b('0x3')},'password':{'type':Sequelize[_0x084b('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x084b('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x084b('0x4')](_0x084b('0x5'),_0x084b('0x6')),'defaultValue':_0x084b('0x5')},'serverUrl':{'type':Sequelize[_0x084b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x084b('0x4')]('integrationTab',_0x084b('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xdddc=['newTab','sequelize','exports','STRING','ENUM','password','token','integrationTab'];(function(_0x21165c,_0xb6e791){var _0x2f78ed=function(_0xcfdd18){while(--_0xcfdd18){_0x21165c['push'](_0x21165c['shift']());}};_0x2f78ed(++_0xb6e791);}(_0xdddc,0xc1));var _0xcddd=function(_0x1c21f5,_0x4d45bd){_0x1c21f5=_0x1c21f5-0x0;var _0x1a4347=_0xdddc[_0x1c21f5];return _0x1a4347;};'use strict';var Sequelize=require(_0xcddd('0x0'));module[_0xcddd('0x1')]={'name':{'type':Sequelize[_0xcddd('0x2')]},'description':{'type':Sequelize[_0xcddd('0x2')]},'username':{'type':Sequelize[_0xcddd('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xcddd('0x2')]},'remoteUri':{'type':Sequelize[_0xcddd('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xcddd('0x3')](_0xcddd('0x4'),_0xcddd('0x5')),'defaultValue':_0xcddd('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xcddd('0x6'),_0xcddd('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 03d2c16..6a68da2 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 _0xc577=['%s/token:%s','Sequelize','Unknown\x20authentication\x20type','description','group','assignee','includes','ticket_fields','position','system_field_options','custom_field_options','Wrong\x20credentials','statusCode','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','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','client','request','then','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','sendStatus','end','status','json','count','offset','Content-Range','apply','save','update','destroy','stack','name','send','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','includeAll','include','ZendeskAccount','rows','catch','show','params','find','create','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','Subjects','ZendeskField','getFields','username','token','authType','remoteUri','substring','lastIndexOf','password','headers','format','Basic\x20%s','%s:%s','toString'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xc577,0x172));var _0x7c57=function(_0x2ff8ae,_0x459670){_0x2ff8ae=_0x2ff8ae-0x0;var _0x52d112=_0xc577[_0x2ff8ae];return _0x52d112;};'use strict';var pdf=require(_0x7c57('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7c57('0x1'));var jsonpatch=require(_0x7c57('0x2'));var rp=require(_0x7c57('0x3'));var moment=require(_0x7c57('0x4'));var BPromise=require(_0x7c57('0x5'));var Mustache=require(_0x7c57('0x6'));var util=require(_0x7c57('0x7'));var path=require('path');var sox=require(_0x7c57('0x8'));var csv=require(_0x7c57('0x9'));var ejs=require(_0x7c57('0xa'));var fs=require('fs');var _=require(_0x7c57('0xb'));var squel=require(_0x7c57('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7c57('0x9'));var querystring=require('querystring');var Papa=require(_0x7c57('0xd'));var Redis=require(_0x7c57('0xe'));var authService=require(_0x7c57('0xf'));var qs=require(_0x7c57('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c57('0x11'));var logger=require(_0x7c57('0x12'))('api');var utils=require(_0x7c57('0x13'));var config=require(_0x7c57('0x14'));var licenseUtil=require(_0x7c57('0x15'));var db=require(_0x7c57('0x16'))['db'];var integrations=require(_0x7c57('0x17'));var jayson=require(_0x7c57('0x18'));var client=jayson[_0x7c57('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x554e25,_0x547918,_0x46cae6,_0x373a4b){return new BPromise(function(_0x4c5af2,_0x43d1fd){var _0x2ce3ca=_0x373a4b||client;return _0x2ce3ca[_0x7c57('0x1a')](_0x554e25,_0x46cae6)[_0x7c57('0x1b')](function(_0x14ce67){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x547918,_0x7c57('0x1c'));logger[_0x7c57('0x1d')](_0x7c57('0x1e'),_0x547918,_0x7c57('0x1c'),JSON[_0x7c57('0x1f')](_0x14ce67));if(_0x14ce67['error']){if(_0x14ce67[_0x7c57('0x20')][_0x7c57('0x21')]===0x1f4){logger[_0x7c57('0x20')](_0x7c57('0x22'),_0x547918,_0x14ce67[_0x7c57('0x20')][_0x7c57('0x23')]);return _0x43d1fd(_0x14ce67[_0x7c57('0x20')][_0x7c57('0x23')]);}logger[_0x7c57('0x20')]('ZendeskAccount,\x20%s,\x20%s',_0x547918,_0x14ce67[_0x7c57('0x20')][_0x7c57('0x23')]);return _0x4c5af2(_0x14ce67[_0x7c57('0x20')][_0x7c57('0x23')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x547918,'request\x20sent');_0x4c5af2(_0x14ce67[_0x7c57('0x24')][_0x7c57('0x23')]);}})['catch'](function(_0x434a3e){logger[_0x7c57('0x20')](_0x7c57('0x22'),_0x547918,_0x434a3e);_0x43d1fd(_0x434a3e);});});}function respondWithStatusCode(_0xfb0f2e,_0x4734de){_0x4734de=_0x4734de||0xcc;return function(_0x1f8776){if(_0x1f8776){return _0xfb0f2e[_0x7c57('0x25')](_0x4734de);}return _0xfb0f2e['status'](_0x4734de)[_0x7c57('0x26')]();};}function respondWithResult(_0x3232f8,_0x16a517){_0x16a517=_0x16a517||0xc8;return function(_0x1641f1){if(_0x1641f1){return _0x3232f8[_0x7c57('0x27')](_0x16a517)[_0x7c57('0x28')](_0x1641f1);}};}function respondWithFilteredResult(_0x41125b,_0x1219f2){return function(_0x1edf4d){if(_0x1edf4d){var _0x4b8747=_0x1edf4d[_0x7c57('0x29')],_0x484027=_0x1219f2['offset'],_0x3cc29f=_0x1219f2[_0x7c57('0x2a')]+_0x1219f2['limit'],_0x3b62c7;if(_0x3cc29f>=_0x4b8747){_0x3cc29f=_0x4b8747;_0x3b62c7=0xc8;}else{_0x3b62c7=0xce;}_0x41125b['status'](_0x3b62c7);return _0x41125b['set'](_0x7c57('0x2b'),_0x484027+'-'+_0x3cc29f+'/'+_0x4b8747)[_0x7c57('0x28')](_0x1edf4d);}return null;};}function patchUpdates(_0x4b183a){return function(_0x423434){try{jsonpatch[_0x7c57('0x2c')](_0x423434,_0x4b183a,!![]);}catch(_0x1ce1fd){return BPromise['reject'](_0x1ce1fd);}return _0x423434[_0x7c57('0x2d')]();};}function saveUpdates(_0x2d4eb8,_0x2f97c6){return function(_0x54b657){if(_0x54b657){return _0x54b657[_0x7c57('0x2e')](_0x2d4eb8)[_0x7c57('0x1b')](function(_0x429576){return _0x429576;});}return null;};}function removeEntity(_0x13e913,_0xdef5db){return function(_0x18be83){if(_0x18be83){return _0x18be83[_0x7c57('0x2f')]()[_0x7c57('0x1b')](function(){_0x13e913[_0x7c57('0x27')](0xcc)[_0x7c57('0x26')]();});}};}function handleEntityNotFound(_0x535369,_0x374dc4){return function(_0x3fc882){if(!_0x3fc882){_0x535369['sendStatus'](0x194);}return _0x3fc882;};}function handleError(_0x446c1d,_0x34b29d){_0x34b29d=_0x34b29d||0x1f4;return function(_0x366c02){logger['error'](_0x366c02[_0x7c57('0x30')]);if(_0x366c02[_0x7c57('0x31')]){delete _0x366c02['name'];}_0x446c1d[_0x7c57('0x27')](_0x34b29d)[_0x7c57('0x32')](_0x366c02);};}exports['index']=function(_0x170d19,_0x291960){var _0x33fb84={},_0xc7ef31={},_0x5ce5a2={'count':0x0,'rows':[]};var _0x1db929=_['map'](db['ZendeskAccount'][_0x7c57('0x33')],function(_0x1ee29b){return{'name':_0x1ee29b[_0x7c57('0x34')],'type':_0x1ee29b[_0x7c57('0x35')]['key']};});_0xc7ef31[_0x7c57('0x36')]=_[_0x7c57('0x37')](_0x1db929,_0x7c57('0x31'));_0xc7ef31[_0x7c57('0x38')]=_[_0x7c57('0x39')](_0x170d19[_0x7c57('0x38')]);_0xc7ef31[_0x7c57('0x3a')]=_['intersection'](_0xc7ef31[_0x7c57('0x36')],_0xc7ef31[_0x7c57('0x38')]);_0x33fb84[_0x7c57('0x3b')]=_[_0x7c57('0x3c')](_0xc7ef31['model'],qs[_0x7c57('0x3d')](_0x170d19[_0x7c57('0x38')][_0x7c57('0x3d')]));_0x33fb84[_0x7c57('0x3b')]=_0x33fb84['attributes'][_0x7c57('0x3e')]?_0x33fb84[_0x7c57('0x3b')]:_0xc7ef31[_0x7c57('0x36')];if(!_0x170d19[_0x7c57('0x38')][_0x7c57('0x3f')](_0x7c57('0x40'))){_0x33fb84[_0x7c57('0x41')]=qs[_0x7c57('0x41')](_0x170d19[_0x7c57('0x38')]['limit']);_0x33fb84[_0x7c57('0x2a')]=qs['offset'](_0x170d19[_0x7c57('0x38')][_0x7c57('0x2a')]);}_0x33fb84[_0x7c57('0x42')]=qs[_0x7c57('0x43')](_0x170d19['query'][_0x7c57('0x43')]);_0x33fb84['where']=qs[_0x7c57('0x3a')](_[_0x7c57('0x44')](_0x170d19[_0x7c57('0x38')],_0xc7ef31[_0x7c57('0x3a')]),_0x1db929);if(_0x170d19[_0x7c57('0x38')][_0x7c57('0x45')]){_0x33fb84[_0x7c57('0x46')]=_['merge'](_0x33fb84[_0x7c57('0x46')],{'$or':_[_0x7c57('0x37')](_0x1db929,function(_0x4d174d){if(_0x4d174d[_0x7c57('0x35')]!=='VIRTUAL'){var _0x1a0838={};_0x1a0838[_0x4d174d[_0x7c57('0x31')]]={'$like':'%'+_0x170d19[_0x7c57('0x38')]['filter']+'%'};return _0x1a0838;}})});}_0x33fb84=_[_0x7c57('0x47')]({},_0x33fb84,_0x170d19[_0x7c57('0x48')]);var _0x496383={'where':_0x33fb84[_0x7c57('0x46')]};return db['ZendeskAccount']['count'](_0x496383)[_0x7c57('0x1b')](function(_0xfacb35){_0x5ce5a2[_0x7c57('0x29')]=_0xfacb35;if(_0x170d19['query'][_0x7c57('0x49')]){_0x33fb84[_0x7c57('0x4a')]=[{'all':!![]}];}return db[_0x7c57('0x4b')]['findAll'](_0x33fb84);})[_0x7c57('0x1b')](function(_0x1ccddb){_0x5ce5a2[_0x7c57('0x4c')]=_0x1ccddb;return _0x5ce5a2;})['then'](respondWithFilteredResult(_0x291960,_0x33fb84))[_0x7c57('0x4d')](handleError(_0x291960,null));};exports[_0x7c57('0x4e')]=function(_0x1d2ed4,_0x37e311){var _0x521b27={'raw':![],'where':{'id':_0x1d2ed4[_0x7c57('0x4f')]['id']}},_0x1e18d9={};_0x1e18d9[_0x7c57('0x36')]=_['keys'](db[_0x7c57('0x4b')][_0x7c57('0x33')]);_0x1e18d9[_0x7c57('0x38')]=_[_0x7c57('0x39')](_0x1d2ed4['query']);_0x1e18d9[_0x7c57('0x3a')]=_['intersection'](_0x1e18d9[_0x7c57('0x36')],_0x1e18d9[_0x7c57('0x38')]);_0x521b27[_0x7c57('0x3b')]=_[_0x7c57('0x3c')](_0x1e18d9[_0x7c57('0x36')],qs['fields'](_0x1d2ed4[_0x7c57('0x38')]['fields']));_0x521b27['attributes']=_0x521b27[_0x7c57('0x3b')][_0x7c57('0x3e')]?_0x521b27['attributes']:_0x1e18d9[_0x7c57('0x36')];if(_0x1d2ed4['query'][_0x7c57('0x49')]){_0x521b27[_0x7c57('0x4a')]=[{'all':!![]}];}_0x521b27=_[_0x7c57('0x47')]({},_0x521b27,_0x1d2ed4['options']);return db[_0x7c57('0x4b')][_0x7c57('0x50')](_0x521b27)[_0x7c57('0x1b')](handleEntityNotFound(_0x37e311,null))[_0x7c57('0x1b')](respondWithResult(_0x37e311,null))[_0x7c57('0x4d')](handleError(_0x37e311,null));};exports['create']=function(_0x260021,_0x928f69){return db[_0x7c57('0x4b')][_0x7c57('0x51')](_0x260021[_0x7c57('0x52')],{})[_0x7c57('0x1b')](respondWithResult(_0x928f69,0xc9))[_0x7c57('0x4d')](handleError(_0x928f69,null));};exports[_0x7c57('0x2e')]=function(_0x511022,_0x5ae07e){if(_0x511022[_0x7c57('0x52')]['id']){delete _0x511022['body']['id'];}return db['ZendeskAccount'][_0x7c57('0x50')]({'where':{'id':_0x511022[_0x7c57('0x4f')]['id']}})[_0x7c57('0x1b')](handleEntityNotFound(_0x5ae07e,null))[_0x7c57('0x1b')](saveUpdates(_0x511022['body'],null))[_0x7c57('0x1b')](respondWithResult(_0x5ae07e,null))['catch'](handleError(_0x5ae07e,null));};exports[_0x7c57('0x2f')]=function(_0x479f56,_0x1161d){return db[_0x7c57('0x4b')][_0x7c57('0x50')]({'where':{'id':_0x479f56[_0x7c57('0x4f')]['id']}})[_0x7c57('0x1b')](handleEntityNotFound(_0x1161d,null))[_0x7c57('0x1b')](removeEntity(_0x1161d,null))[_0x7c57('0x4d')](handleError(_0x1161d,null));};exports[_0x7c57('0x53')]=function(_0x5423a3,_0x2fbea2,_0x4969af){var _0xf8de27={};var _0x4ef04d={};var _0xc6b42e;var _0x2ae529;return db[_0x7c57('0x4b')][_0x7c57('0x54')]({'where':{'id':_0x5423a3[_0x7c57('0x4f')]['id']}})[_0x7c57('0x1b')](handleEntityNotFound(_0x2fbea2,null))[_0x7c57('0x1b')](function(_0x505040){if(_0x505040){_0xc6b42e=_0x505040;_0x4ef04d[_0x7c57('0x36')]=_[_0x7c57('0x39')](db[_0x7c57('0x55')]['rawAttributes']);_0x4ef04d['query']=_[_0x7c57('0x39')](_0x5423a3[_0x7c57('0x38')]);_0x4ef04d[_0x7c57('0x3a')]=_[_0x7c57('0x3c')](_0x4ef04d[_0x7c57('0x36')],_0x4ef04d['query']);_0xf8de27['attributes']=_[_0x7c57('0x3c')](_0x4ef04d['model'],qs[_0x7c57('0x3d')](_0x5423a3[_0x7c57('0x38')][_0x7c57('0x3d')]));_0xf8de27[_0x7c57('0x3b')]=_0xf8de27[_0x7c57('0x3b')][_0x7c57('0x3e')]?_0xf8de27[_0x7c57('0x3b')]:_0x4ef04d['model'];_0xf8de27[_0x7c57('0x42')]=qs[_0x7c57('0x43')](_0x5423a3[_0x7c57('0x38')][_0x7c57('0x43')]);_0xf8de27['where']=qs[_0x7c57('0x3a')](_['pick'](_0x5423a3[_0x7c57('0x38')],_0x4ef04d['filters']));if(_0x5423a3[_0x7c57('0x38')][_0x7c57('0x45')]){_0xf8de27[_0x7c57('0x46')]=_[_0x7c57('0x47')](_0xf8de27[_0x7c57('0x46')],{'$or':_[_0x7c57('0x37')](_0xf8de27[_0x7c57('0x3b')],function(_0x1c517b){var _0xa625a={};_0xa625a[_0x1c517b]={'$like':'%'+_0x5423a3[_0x7c57('0x38')][_0x7c57('0x45')]+'%'};return _0xa625a;})});}_0xf8de27=_[_0x7c57('0x47')]({},_0xf8de27,_0x5423a3[_0x7c57('0x48')]);return _0xc6b42e[_0x7c57('0x53')](_0xf8de27);}})[_0x7c57('0x1b')](function(_0x4f65a3){if(_0x4f65a3){_0x2ae529=_0x4f65a3['length'];if(!_0x5423a3[_0x7c57('0x38')]['hasOwnProperty']('nolimit')){_0xf8de27[_0x7c57('0x41')]=qs[_0x7c57('0x41')](_0x5423a3[_0x7c57('0x38')][_0x7c57('0x41')]);_0xf8de27[_0x7c57('0x2a')]=qs[_0x7c57('0x2a')](_0x5423a3[_0x7c57('0x38')]['offset']);}return _0xc6b42e['getConfigurations'](_0xf8de27);}})[_0x7c57('0x1b')](function(_0x51a8fd){if(_0x51a8fd){return _0x51a8fd?{'count':_0x2ae529,'rows':_0x51a8fd}:null;}})[_0x7c57('0x1b')](respondWithResult(_0x2fbea2,null))['catch'](handleError(_0x2fbea2,null));};exports[_0x7c57('0x56')]=function(_0x516be3,_0x48d408,_0x315854){if(_0x516be3['body']['id']){delete _0x516be3[_0x7c57('0x52')]['id'];}return db[_0x7c57('0x4b')][_0x7c57('0x54')]({'where':{'id':_0x516be3[_0x7c57('0x4f')]['id']}})[_0x7c57('0x1b')](handleEntityNotFound(_0x48d408,null))['then'](function(_0x193756){if(_0x193756){_0x516be3[_0x7c57('0x52')]['AccountId']=_0x193756['id'];_0x516be3['body']['Subjects']=integrations[_0x7c57('0x57')](_0x516be3[_0x7c57('0x52')][_0x7c57('0x58')],_0x516be3[_0x7c57('0x52')][_0x7c57('0x35')]);_0x516be3[_0x7c57('0x52')][_0x7c57('0x59')]=integrations[_0x7c57('0x5a')](_0x516be3[_0x7c57('0x52')]['channel'],_0x516be3['body']['type']);return db[_0x7c57('0x55')][_0x7c57('0x51')](_0x516be3['body'],{'include':[{'model':db['ZendeskField'],'as':_0x7c57('0x5b')},{'model':db[_0x7c57('0x5c')],'as':'Descriptions'}]});}return null;})[_0x7c57('0x1b')](respondWithResult(_0x48d408,null))['catch'](handleError(_0x48d408,null));};exports[_0x7c57('0x5d')]=function(_0x2313dc,_0x4b7649,_0x1fa422){var _0x5cfda3='';return db[_0x7c57('0x4b')][_0x7c57('0x54')]({'where':{'id':_0x2313dc['params']['id']},'attributes':['id',_0x7c57('0x5e'),'password',_0x7c57('0x5f'),_0x7c57('0x60'),'remoteUri']})[_0x7c57('0x1b')](handleEntityNotFound(_0x4b7649,null))['then'](function(_0x5852ac){if(_0x5852ac){_0x5cfda3=_0x5852ac[_0x7c57('0x61')];var _0x8e2637=_0x5cfda3['slice'](-0x1);if(_0x8e2637==='/'){_0x5cfda3=_0x5cfda3[_0x7c57('0x62')](0x0,_0x5cfda3[_0x7c57('0x63')](_0x8e2637));}var _0x44b01e={'method':'GET','uri':util['format']('%s/%s',_0x5cfda3,'ticket_fields'),'json':!![]};switch(_0x5852ac[_0x7c57('0x60')]){case _0x7c57('0x64'):_0x44b01e[_0x7c57('0x65')]={'Authorization':util[_0x7c57('0x66')](_0x7c57('0x67'),new Buffer(util['format'](_0x7c57('0x68'),_0x5852ac[_0x7c57('0x5e')],_0x5852ac[_0x7c57('0x64')]))[_0x7c57('0x69')]('base64'))};break;case _0x7c57('0x5f'):_0x44b01e[_0x7c57('0x65')]={'Authorization':util[_0x7c57('0x66')](_0x7c57('0x67'),new Buffer(util['format'](_0x7c57('0x6a'),_0x5852ac[_0x7c57('0x5e')],_0x5852ac['token']))[_0x7c57('0x69')]('base64'))};break;default:throw new db[(_0x7c57('0x6b'))]['ValidationError'](_0x7c57('0x6c'));}return rp(_0x44b01e);}})[_0x7c57('0x1b')](function(_0x2e3850){if(_0x2e3850){var _0x3c47da=['subject',_0x7c57('0x6d'),_0x7c57('0x6e'),_0x7c57('0x6f')];_['remove'](_0x2e3850['ticket_fields'],function(_0x1f8e20){return _0x3c47da[_0x7c57('0x70')](_0x1f8e20[_0x7c57('0x35')]);});return{'count':_0x2e3850[_0x7c57('0x71')][_0x7c57('0x3e')],'rows':_[_0x7c57('0x37')](_0x2e3850[_0x7c57('0x71')],function(_0x374eb0){return{'id':_0x374eb0['id'],'name':_0x374eb0[_0x7c57('0x72')]>0x7?_0x374eb0['title']:_0x374eb0[_0x7c57('0x35')],'custom':_0x374eb0['position']>0x7?!![]:![],'options':_0x374eb0[_0x7c57('0x73')]?_0x374eb0[_0x7c57('0x73')]:_0x374eb0[_0x7c57('0x74')]?_0x374eb0[_0x7c57('0x74')]:[]};})};}})[_0x7c57('0x1b')](respondWithResult(_0x4b7649,null))[_0x7c57('0x4d')](function(_0x8fcc55){var _0x23c49a=_0x2313dc[_0x7c57('0x38')]['test']?0x1f4:_0x8fcc55['statusCode']||0x1f4;logger[_0x7c57('0x20')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x23c49a,JSON[_0x7c57('0x1f')](_0x8fcc55));delete _0x8fcc55[_0x7c57('0x31')];if(_0x23c49a===0x191){_0x23c49a=0x190;}_0x4b7649['status'](_0x23c49a)[_0x7c57('0x32')](_0x2313dc[_0x7c57('0x38')]['test']?{'message':_0x7c57('0x75'),'statusCode':_0x8fcc55[_0x7c57('0x76')]}:_0x8fcc55);});}; \ No newline at end of file +var _0xffaa=['fields','find','create','body','findOne','ZendeskConfiguration','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','username','password','token','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','authType','headers','Basic\x20%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','count','offset','limit','json','reject','save','update','destroy','name','index','ZendeskAccount','rawAttributes','type','key','model','map','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys'];(function(_0x41df92,_0x145dfa){var _0x28a6db=function(_0x4afe84){while(--_0x4afe84){_0x41df92['push'](_0x41df92['shift']());}};_0x28a6db(++_0x145dfa);}(_0xffaa,0x130));var _0xaffa=function(_0x192838,_0x258a68){_0x192838=_0x192838-0x0;var _0x613192=_0xffaa[_0x192838];return _0x613192;};'use strict';var pdf=require(_0xaffa('0x0'));var emlformat=require(_0xaffa('0x1'));var rimraf=require(_0xaffa('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xaffa('0x3'));var moment=require(_0xaffa('0x4'));var BPromise=require(_0xaffa('0x5'));var Mustache=require(_0xaffa('0x6'));var util=require(_0xaffa('0x7'));var path=require(_0xaffa('0x8'));var sox=require(_0xaffa('0x9'));var csv=require(_0xaffa('0xa'));var ejs=require(_0xaffa('0xb'));var fs=require('fs');var _=require(_0xaffa('0xc'));var squel=require('squel');var crypto=require(_0xaffa('0xd'));var jsforce=require(_0xaffa('0xe'));var deskjs=require(_0xaffa('0xf'));var toCsv=require(_0xaffa('0xa'));var querystring=require('querystring');var Papa=require(_0xaffa('0x10'));var Redis=require('ioredis');var authService=require(_0xaffa('0x11'));var qs=require(_0xaffa('0x12'));var as=require(_0xaffa('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaffa('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaffa('0x15'));var db=require(_0xaffa('0x16'))['db'];var integrations=require(_0xaffa('0x17'));var jayson=require('jayson/promise');var client=jayson[_0xaffa('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25284e,_0x5b238c,_0xd8e9c6,_0x8ecc6b){return new BPromise(function(_0x255025,_0x103126){var _0x14f495=_0x8ecc6b||client;return _0x14f495[_0xaffa('0x19')](_0x25284e,_0xd8e9c6)[_0xaffa('0x1a')](function(_0x323a2f){logger['info'](_0xaffa('0x1b'),_0x5b238c,_0xaffa('0x1c'));logger['debug'](_0xaffa('0x1d'),_0x5b238c,'request\x20sent',JSON[_0xaffa('0x1e')](_0x323a2f));if(_0x323a2f[_0xaffa('0x1f')]){if(_0x323a2f[_0xaffa('0x1f')][_0xaffa('0x20')]===0x1f4){logger[_0xaffa('0x1f')](_0xaffa('0x1b'),_0x5b238c,_0x323a2f['error'][_0xaffa('0x21')]);return _0x103126(_0x323a2f[_0xaffa('0x1f')][_0xaffa('0x21')]);}logger[_0xaffa('0x1f')](_0xaffa('0x1b'),_0x5b238c,_0x323a2f[_0xaffa('0x1f')][_0xaffa('0x21')]);return _0x255025(_0x323a2f['error']['message']);}else{logger[_0xaffa('0x22')](_0xaffa('0x1b'),_0x5b238c,_0xaffa('0x1c'));_0x255025(_0x323a2f[_0xaffa('0x23')]['message']);}})['catch'](function(_0x1bf682){logger[_0xaffa('0x1f')]('ZendeskAccount,\x20%s,\x20%s',_0x5b238c,_0x1bf682);_0x103126(_0x1bf682);});});}function respondWithStatusCode(_0x2a5bb8,_0x298e2b){_0x298e2b=_0x298e2b||0xcc;return function(_0x41f668){if(_0x41f668){return _0x2a5bb8[_0xaffa('0x24')](_0x298e2b);}return _0x2a5bb8[_0xaffa('0x25')](_0x298e2b)[_0xaffa('0x26')]();};}function respondWithResult(_0x492b82,_0x1b18da){_0x1b18da=_0x1b18da||0xc8;return function(_0x12ee1f){if(_0x12ee1f){return _0x492b82['status'](_0x1b18da)['json'](_0x12ee1f);}};}function respondWithFilteredResult(_0x3f0d5a,_0x46ac99){return function(_0x348571){if(_0x348571){var _0x28b4e2=_0x348571[_0xaffa('0x27')],_0x247915=_0x46ac99[_0xaffa('0x28')],_0x411448=_0x46ac99[_0xaffa('0x28')]+_0x46ac99[_0xaffa('0x29')],_0x2faf48;if(_0x411448>=_0x28b4e2){_0x411448=_0x28b4e2;_0x2faf48=0xc8;}else{_0x2faf48=0xce;}_0x3f0d5a[_0xaffa('0x25')](_0x2faf48);return _0x3f0d5a['set']('Content-Range',_0x247915+'-'+_0x411448+'/'+_0x28b4e2)[_0xaffa('0x2a')](_0x348571);}return null;};}function patchUpdates(_0x46e268){return function(_0x495c7e){try{jsonpatch['apply'](_0x495c7e,_0x46e268,!![]);}catch(_0x5c6412){return BPromise[_0xaffa('0x2b')](_0x5c6412);}return _0x495c7e[_0xaffa('0x2c')]();};}function saveUpdates(_0x2c77e6,_0x50ca99){return function(_0x347069){if(_0x347069){return _0x347069[_0xaffa('0x2d')](_0x2c77e6)[_0xaffa('0x1a')](function(_0x178d76){return _0x178d76;});}return null;};}function removeEntity(_0x27506b,_0x3dd1e5){return function(_0x17ada5){if(_0x17ada5){return _0x17ada5[_0xaffa('0x2e')]()[_0xaffa('0x1a')](function(){_0x27506b[_0xaffa('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39b45c,_0x8a6d5c){return function(_0x1eff8a){if(!_0x1eff8a){_0x39b45c[_0xaffa('0x24')](0x194);}return _0x1eff8a;};}function handleError(_0x442967,_0x464188){_0x464188=_0x464188||0x1f4;return function(_0x433c7d){logger[_0xaffa('0x1f')](_0x433c7d['stack']);if(_0x433c7d['name']){delete _0x433c7d[_0xaffa('0x2f')];}_0x442967['status'](_0x464188)['send'](_0x433c7d);};}exports[_0xaffa('0x30')]=function(_0x407140,_0x1acb87){var _0x2bacf7={},_0x57b775={},_0x5795d3={'count':0x0,'rows':[]};var _0xdc48f=_['map'](db[_0xaffa('0x31')][_0xaffa('0x32')],function(_0x5129df){return{'name':_0x5129df['fieldName'],'type':_0x5129df[_0xaffa('0x33')][_0xaffa('0x34')]};});_0x57b775[_0xaffa('0x35')]=_[_0xaffa('0x36')](_0xdc48f,_0xaffa('0x2f'));_0x57b775['query']=_['keys'](_0x407140[_0xaffa('0x37')]);_0x57b775[_0xaffa('0x38')]=_['intersection'](_0x57b775[_0xaffa('0x35')],_0x57b775[_0xaffa('0x37')]);_0x2bacf7[_0xaffa('0x39')]=_[_0xaffa('0x3a')](_0x57b775[_0xaffa('0x35')],qs['fields'](_0x407140[_0xaffa('0x37')]['fields']));_0x2bacf7[_0xaffa('0x39')]=_0x2bacf7[_0xaffa('0x39')][_0xaffa('0x3b')]?_0x2bacf7['attributes']:_0x57b775['model'];if(!_0x407140['query'][_0xaffa('0x3c')](_0xaffa('0x3d'))){_0x2bacf7[_0xaffa('0x29')]=qs['limit'](_0x407140[_0xaffa('0x37')]['limit']);_0x2bacf7[_0xaffa('0x28')]=qs['offset'](_0x407140['query'][_0xaffa('0x28')]);}_0x2bacf7[_0xaffa('0x3e')]=qs[_0xaffa('0x3f')](_0x407140[_0xaffa('0x37')][_0xaffa('0x3f')]);_0x2bacf7[_0xaffa('0x40')]=qs[_0xaffa('0x38')](_[_0xaffa('0x41')](_0x407140[_0xaffa('0x37')],_0x57b775[_0xaffa('0x38')]),_0xdc48f);if(_0x407140['query'][_0xaffa('0x42')]){_0x2bacf7[_0xaffa('0x40')]=_[_0xaffa('0x43')](_0x2bacf7[_0xaffa('0x40')],{'$or':_[_0xaffa('0x36')](_0xdc48f,function(_0xd6c1b7){if(_0xd6c1b7[_0xaffa('0x33')]!==_0xaffa('0x44')){var _0x562585={};_0x562585[_0xd6c1b7[_0xaffa('0x2f')]]={'$like':'%'+_0x407140['query'][_0xaffa('0x42')]+'%'};return _0x562585;}})});}_0x2bacf7=_[_0xaffa('0x43')]({},_0x2bacf7,_0x407140[_0xaffa('0x45')]);var _0x50245b={'where':_0x2bacf7['where']};return db['ZendeskAccount'][_0xaffa('0x27')](_0x50245b)['then'](function(_0x2d87b8){_0x5795d3[_0xaffa('0x27')]=_0x2d87b8;if(_0x407140['query'][_0xaffa('0x46')]){_0x2bacf7[_0xaffa('0x47')]=[{'all':!![]}];}return db[_0xaffa('0x31')]['findAll'](_0x2bacf7);})['then'](function(_0x4c1263){_0x5795d3[_0xaffa('0x48')]=_0x4c1263;return _0x5795d3;})['then'](respondWithFilteredResult(_0x1acb87,_0x2bacf7))[_0xaffa('0x49')](handleError(_0x1acb87,null));};exports[_0xaffa('0x4a')]=function(_0x6c85b7,_0x547d4a){var _0x994219={'raw':![],'where':{'id':_0x6c85b7[_0xaffa('0x4b')]['id']}},_0x1c2440={};_0x1c2440[_0xaffa('0x35')]=_[_0xaffa('0x4c')](db['ZendeskAccount'][_0xaffa('0x32')]);_0x1c2440[_0xaffa('0x37')]=_['keys'](_0x6c85b7['query']);_0x1c2440['filters']=_[_0xaffa('0x3a')](_0x1c2440[_0xaffa('0x35')],_0x1c2440[_0xaffa('0x37')]);_0x994219[_0xaffa('0x39')]=_[_0xaffa('0x3a')](_0x1c2440['model'],qs[_0xaffa('0x4d')](_0x6c85b7[_0xaffa('0x37')][_0xaffa('0x4d')]));_0x994219[_0xaffa('0x39')]=_0x994219[_0xaffa('0x39')][_0xaffa('0x3b')]?_0x994219['attributes']:_0x1c2440[_0xaffa('0x35')];if(_0x6c85b7['query'][_0xaffa('0x46')]){_0x994219[_0xaffa('0x47')]=[{'all':!![]}];}_0x994219=_['merge']({},_0x994219,_0x6c85b7[_0xaffa('0x45')]);return db['ZendeskAccount'][_0xaffa('0x4e')](_0x994219)[_0xaffa('0x1a')](handleEntityNotFound(_0x547d4a,null))[_0xaffa('0x1a')](respondWithResult(_0x547d4a,null))[_0xaffa('0x49')](handleError(_0x547d4a,null));};exports[_0xaffa('0x4f')]=function(_0x378701,_0x5103bc){return db[_0xaffa('0x31')]['create'](_0x378701['body'],{})[_0xaffa('0x1a')](respondWithResult(_0x5103bc,0xc9))[_0xaffa('0x49')](handleError(_0x5103bc,null));};exports[_0xaffa('0x2d')]=function(_0x4af4a8,_0x806817){if(_0x4af4a8[_0xaffa('0x50')]['id']){delete _0x4af4a8[_0xaffa('0x50')]['id'];}return db[_0xaffa('0x31')][_0xaffa('0x4e')]({'where':{'id':_0x4af4a8['params']['id']}})[_0xaffa('0x1a')](handleEntityNotFound(_0x806817,null))[_0xaffa('0x1a')](saveUpdates(_0x4af4a8[_0xaffa('0x50')],null))[_0xaffa('0x1a')](respondWithResult(_0x806817,null))[_0xaffa('0x49')](handleError(_0x806817,null));};exports[_0xaffa('0x2e')]=function(_0xedea18,_0x29a709){return db[_0xaffa('0x31')][_0xaffa('0x4e')]({'where':{'id':_0xedea18[_0xaffa('0x4b')]['id']}})[_0xaffa('0x1a')](handleEntityNotFound(_0x29a709,null))[_0xaffa('0x1a')](removeEntity(_0x29a709,null))[_0xaffa('0x49')](handleError(_0x29a709,null));};exports['getConfigurations']=function(_0x4af885,_0x12cc0e,_0x136af1){var _0x2f6b28={};var _0x3b5588={};var _0x5c72a2;var _0xda2ec4;return db[_0xaffa('0x31')][_0xaffa('0x51')]({'where':{'id':_0x4af885[_0xaffa('0x4b')]['id']}})[_0xaffa('0x1a')](handleEntityNotFound(_0x12cc0e,null))[_0xaffa('0x1a')](function(_0x294751){if(_0x294751){_0x5c72a2=_0x294751;_0x3b5588['model']=_[_0xaffa('0x4c')](db[_0xaffa('0x52')]['rawAttributes']);_0x3b5588['query']=_[_0xaffa('0x4c')](_0x4af885[_0xaffa('0x37')]);_0x3b5588[_0xaffa('0x38')]=_[_0xaffa('0x3a')](_0x3b5588['model'],_0x3b5588['query']);_0x2f6b28[_0xaffa('0x39')]=_['intersection'](_0x3b5588[_0xaffa('0x35')],qs[_0xaffa('0x4d')](_0x4af885[_0xaffa('0x37')][_0xaffa('0x4d')]));_0x2f6b28[_0xaffa('0x39')]=_0x2f6b28[_0xaffa('0x39')][_0xaffa('0x3b')]?_0x2f6b28[_0xaffa('0x39')]:_0x3b5588[_0xaffa('0x35')];_0x2f6b28[_0xaffa('0x3e')]=qs[_0xaffa('0x3f')](_0x4af885[_0xaffa('0x37')][_0xaffa('0x3f')]);_0x2f6b28[_0xaffa('0x40')]=qs['filters'](_['pick'](_0x4af885[_0xaffa('0x37')],_0x3b5588[_0xaffa('0x38')]));if(_0x4af885[_0xaffa('0x37')][_0xaffa('0x42')]){_0x2f6b28['where']=_['merge'](_0x2f6b28[_0xaffa('0x40')],{'$or':_[_0xaffa('0x36')](_0x2f6b28[_0xaffa('0x39')],function(_0x54a6c5){var _0x30abde={};_0x30abde[_0x54a6c5]={'$like':'%'+_0x4af885[_0xaffa('0x37')][_0xaffa('0x42')]+'%'};return _0x30abde;})});}_0x2f6b28=_[_0xaffa('0x43')]({},_0x2f6b28,_0x4af885['options']);return _0x5c72a2[_0xaffa('0x53')](_0x2f6b28);}})[_0xaffa('0x1a')](function(_0x521794){if(_0x521794){_0xda2ec4=_0x521794['length'];if(!_0x4af885[_0xaffa('0x37')][_0xaffa('0x3c')](_0xaffa('0x3d'))){_0x2f6b28[_0xaffa('0x29')]=qs[_0xaffa('0x29')](_0x4af885[_0xaffa('0x37')][_0xaffa('0x29')]);_0x2f6b28[_0xaffa('0x28')]=qs[_0xaffa('0x28')](_0x4af885['query'][_0xaffa('0x28')]);}return _0x5c72a2[_0xaffa('0x53')](_0x2f6b28);}})[_0xaffa('0x1a')](function(_0x5a028a){if(_0x5a028a){return _0x5a028a?{'count':_0xda2ec4,'rows':_0x5a028a}:null;}})['then'](respondWithResult(_0x12cc0e,null))[_0xaffa('0x49')](handleError(_0x12cc0e,null));};exports[_0xaffa('0x54')]=function(_0x584a51,_0x45bf76,_0x17edd2){if(_0x584a51[_0xaffa('0x50')]['id']){delete _0x584a51[_0xaffa('0x50')]['id'];}return db[_0xaffa('0x31')]['findOne']({'where':{'id':_0x584a51[_0xaffa('0x4b')]['id']}})[_0xaffa('0x1a')](handleEntityNotFound(_0x45bf76,null))[_0xaffa('0x1a')](function(_0x5687fc){if(_0x5687fc){_0x584a51['body'][_0xaffa('0x55')]=_0x5687fc['id'];_0x584a51['body']['Subjects']=integrations[_0xaffa('0x56')](_0x584a51[_0xaffa('0x50')][_0xaffa('0x57')],_0x584a51[_0xaffa('0x50')][_0xaffa('0x33')]);_0x584a51[_0xaffa('0x50')][_0xaffa('0x58')]=integrations[_0xaffa('0x59')](_0x584a51['body'][_0xaffa('0x57')],_0x584a51[_0xaffa('0x50')][_0xaffa('0x33')]);return db['ZendeskConfiguration'][_0xaffa('0x4f')](_0x584a51['body'],{'include':[{'model':db[_0xaffa('0x5a')],'as':_0xaffa('0x5b')},{'model':db[_0xaffa('0x5a')],'as':_0xaffa('0x58')}]});}return null;})[_0xaffa('0x1a')](respondWithResult(_0x45bf76,null))[_0xaffa('0x49')](handleError(_0x45bf76,null));};exports[_0xaffa('0x5c')]=function(_0x1505bf,_0x37af26,_0x4cbb07){var _0x4b4137='';return db[_0xaffa('0x31')][_0xaffa('0x51')]({'where':{'id':_0x1505bf[_0xaffa('0x4b')]['id']},'attributes':['id',_0xaffa('0x5d'),_0xaffa('0x5e'),_0xaffa('0x5f'),'authType',_0xaffa('0x60')]})[_0xaffa('0x1a')](handleEntityNotFound(_0x37af26,null))[_0xaffa('0x1a')](function(_0x4c573){if(_0x4c573){_0x4b4137=_0x4c573[_0xaffa('0x60')];var _0x25965e=_0x4b4137[_0xaffa('0x61')](-0x1);if(_0x25965e==='/'){_0x4b4137=_0x4b4137[_0xaffa('0x62')](0x0,_0x4b4137[_0xaffa('0x63')](_0x25965e));}var _0x4fe68d={'method':_0xaffa('0x64'),'uri':util[_0xaffa('0x65')](_0xaffa('0x66'),_0x4b4137,'ticket_fields'),'json':!![]};switch(_0x4c573[_0xaffa('0x67')]){case'password':_0x4fe68d[_0xaffa('0x68')]={'Authorization':util[_0xaffa('0x65')](_0xaffa('0x69'),new Buffer(util['format']('%s:%s',_0x4c573[_0xaffa('0x5d')],_0x4c573[_0xaffa('0x5e')]))[_0xaffa('0x6a')](_0xaffa('0x6b')))};break;case _0xaffa('0x5f'):_0x4fe68d[_0xaffa('0x68')]={'Authorization':util[_0xaffa('0x65')]('Basic\x20%s',new Buffer(util['format'](_0xaffa('0x6c'),_0x4c573[_0xaffa('0x5d')],_0x4c573[_0xaffa('0x5f')]))[_0xaffa('0x6a')](_0xaffa('0x6b')))};break;default:throw new db[(_0xaffa('0x6d'))][(_0xaffa('0x6e'))](_0xaffa('0x6f'));}return rp(_0x4fe68d);}})[_0xaffa('0x1a')](function(_0xbe93bf){if(_0xbe93bf){var _0xabcd1d=[_0xaffa('0x70'),_0xaffa('0x71'),_0xaffa('0x72'),_0xaffa('0x73')];_['remove'](_0xbe93bf[_0xaffa('0x74')],function(_0x4b6423){return _0xabcd1d[_0xaffa('0x75')](_0x4b6423[_0xaffa('0x33')]);});return{'count':_0xbe93bf[_0xaffa('0x74')]['length'],'rows':_[_0xaffa('0x36')](_0xbe93bf[_0xaffa('0x74')],function(_0x26ed78){return{'id':_0x26ed78['id'],'name':_0x26ed78[_0xaffa('0x76')]>0x7?_0x26ed78[_0xaffa('0x77')]:_0x26ed78[_0xaffa('0x33')],'custom':_0x26ed78['position']>0x7?!![]:![],'options':_0x26ed78[_0xaffa('0x78')]?_0x26ed78[_0xaffa('0x78')]:_0x26ed78[_0xaffa('0x79')]?_0x26ed78['custom_field_options']:[]};})};}})[_0xaffa('0x1a')](respondWithResult(_0x37af26,null))['catch'](function(_0x112144){var _0x1dfb78=_0x1505bf[_0xaffa('0x37')][_0xaffa('0x7a')]?0x1f4:_0x112144[_0xaffa('0x7b')]||0x1f4;logger[_0xaffa('0x1f')](_0xaffa('0x7c'),_0xaffa('0x5c'),_0x1dfb78,JSON[_0xaffa('0x1e')](_0x112144));delete _0x112144[_0xaffa('0x2f')];if(_0x1dfb78===0x191){_0x1dfb78=0x190;}_0x37af26[_0xaffa('0x25')](_0x1dfb78)[_0xaffa('0x7d')](_0x1505bf[_0xaffa('0x37')][_0xaffa('0x7a')]?{'message':_0xaffa('0x7e'),'statusCode':_0x112144[_0xaffa('0x7b')]}:_0x112144);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 603692a..0b78281 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 _0x981c=['moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api'];(function(_0x5ca5b0,_0x8a4bee){var _0x3abdc0=function(_0x62e4ca){while(--_0x62e4ca){_0x5ca5b0['push'](_0x5ca5b0['shift']());}};_0x3abdc0(++_0x8a4bee);}(_0x981c,0x14c));var _0xc981=function(_0xf8f2db,_0x4f5a5){_0xf8f2db=_0xf8f2db-0x0;var _0x3397b5=_0x981c[_0xf8f2db];return _0x3397b5;};'use strict';var _=require(_0xc981('0x0'));var util=require(_0xc981('0x1'));var logger=require(_0xc981('0x2'))(_0xc981('0x3'));var moment=require(_0xc981('0x4'));var BPromise=require(_0xc981('0x5'));var rp=require(_0xc981('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc981('0x7'));var config=require(_0xc981('0x8'));var attributes=require(_0xc981('0x9'));var integrations=require(_0xc981('0xa'));module['exports']=function(_0x116188,_0xe174bc){return _0x116188[_0xc981('0xb')](_0xc981('0xc'),attributes,{'tableName':_0xc981('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e07=['moment','bluebird','request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','int_zendesk_accounts','lodash','util','../../config/logger','api'];(function(_0x553e1e,_0x5bedef){var _0x3bb17b=function(_0x53ad59){while(--_0x53ad59){_0x553e1e['push'](_0x553e1e['shift']());}};_0x3bb17b(++_0x5bedef);}(_0x8e07,0x71));var _0x78e0=function(_0x192191,_0x20abdb){_0x192191=_0x192191-0x0;var _0x4c7e5d=_0x8e07[_0x192191];return _0x4c7e5d;};'use strict';var _=require(_0x78e0('0x0'));var util=require(_0x78e0('0x1'));var logger=require(_0x78e0('0x2'))(_0x78e0('0x3'));var moment=require(_0x78e0('0x4'));var BPromise=require(_0x78e0('0x5'));var rp=require(_0x78e0('0x6'));var fs=require('fs');var path=require(_0x78e0('0x7'));var rimraf=require('rimraf');var config=require(_0x78e0('0x8'));var attributes=require(_0x78e0('0x9'));var integrations=require(_0x78e0('0xa'));module['exports']=function(_0x36e22e,_0x23e29c){return _0x36e22e[_0x78e0('0xb')]('ZendeskAccount',attributes,{'tableName':_0x78e0('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 0c9dfa9..e5a0e1c 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(_0x3e9f4c,_0x354ca6){var _0x2bd696=function(_0x3f6177){while(--_0x3f6177){_0x3e9f4c['push'](_0x3e9f4c['shift']());}};_0x2bd696(++_0x354ca6);}(_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 _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowZendeskAccount','ZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../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','error','code','message','result','catch','GetZendeskAccount','findAll'];(function(_0x59e8f8,_0x1dba50){var _0x237705=function(_0x11a030){while(--_0x11a030){_0x59e8f8['push'](_0x59e8f8['shift']());}};_0x237705(++_0x1dba50);}(_0xe706,0xa3));var _0x6e70=function(_0x1118da,_0x2fde4c){_0x1118da=_0x1118da-0x0;var _0x7374da=_0xe706[_0x1118da];return _0x7374da;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['ZendeskAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetZendeskAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 77237ef..f526ec4 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 _0x8a11=['path','connect-timeout','express','Router','../../components/auth/service','./intZendeskConfiguration.controller','get','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','setTags','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x11441f,_0x1dbdaa){var _0x54fe22=function(_0x2938cd){while(--_0x2938cd){_0x11441f['push'](_0x11441f['shift']());}};_0x54fe22(++_0x1dbdaa);}(_0x8a11,0x106));var _0x18a1=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0x8a11[_0x5d4f12];return _0x4eb577;};'use strict';var multer=require(_0x18a1('0x0'));var util=require(_0x18a1('0x1'));var path=require(_0x18a1('0x2'));var timeout=require(_0x18a1('0x3'));var express=require(_0x18a1('0x4'));var router=express[_0x18a1('0x5')]();var auth=require(_0x18a1('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x18a1('0x7'));router[_0x18a1('0x8')]('/',auth[_0x18a1('0x9')](),controller['index']);router[_0x18a1('0x8')]('/:id',auth[_0x18a1('0x9')](),controller['show']);router[_0x18a1('0x8')](_0x18a1('0xa'),auth[_0x18a1('0x9')](),controller[_0x18a1('0xb')]);router[_0x18a1('0x8')](_0x18a1('0xc'),auth[_0x18a1('0x9')](),controller[_0x18a1('0xd')]);router[_0x18a1('0x8')]('/:id/descriptions',auth[_0x18a1('0x9')](),controller[_0x18a1('0xe')]);router['get'](_0x18a1('0xf'),auth[_0x18a1('0x9')](),controller['getTags']);router['post']('/',auth[_0x18a1('0x9')](),controller['create']);router[_0x18a1('0x10')](_0x18a1('0xf'),auth[_0x18a1('0x9')](),controller[_0x18a1('0x11')]);router[_0x18a1('0x12')](_0x18a1('0x13'),auth['isAuthenticated'](),controller[_0x18a1('0x14')]);router[_0x18a1('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x18a1('0x16')]);module[_0x18a1('0x17')]=router; \ No newline at end of file +var _0x1343=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','delete','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','isAuthenticated','show','getFields'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x1343,0xfc));var _0x3134=function(_0x430a54,_0x1912b){_0x430a54=_0x430a54-0x0;var _0x50e04f=_0x1343[_0x430a54];return _0x50e04f;};'use strict';var multer=require(_0x3134('0x0'));var util=require('util');var path=require(_0x3134('0x1'));var timeout=require(_0x3134('0x2'));var express=require('express');var router=express[_0x3134('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3134('0x4'));var config=require(_0x3134('0x5'));var controller=require(_0x3134('0x6'));router[_0x3134('0x7')]('/',auth['isAuthenticated'](),controller[_0x3134('0x8')]);router['get']('/:id',auth[_0x3134('0x9')](),controller[_0x3134('0xa')]);router[_0x3134('0x7')]('/:id/fields',auth[_0x3134('0x9')](),controller[_0x3134('0xb')]);router[_0x3134('0x7')](_0x3134('0xc'),auth[_0x3134('0x9')](),controller[_0x3134('0xd')]);router[_0x3134('0x7')](_0x3134('0xe'),auth[_0x3134('0x9')](),controller[_0x3134('0xf')]);router['get'](_0x3134('0x10'),auth[_0x3134('0x9')](),controller[_0x3134('0x11')]);router['post']('/',auth[_0x3134('0x9')](),controller['create']);router[_0x3134('0x12')](_0x3134('0x10'),auth['isAuthenticated'](),controller[_0x3134('0x13')]);router[_0x3134('0x14')](_0x3134('0x15'),auth[_0x3134('0x9')](),controller['update']);router[_0x3134('0x16')](_0x3134('0x15'),auth[_0x3134('0x9')](),controller['destroy']);module[_0x3134('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 4145b97..2311522 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 _0x7d0a=['STRING','sequelize'];(function(_0x3101f0,_0x5956af){var _0x472ee8=function(_0x269a42){while(--_0x269a42){_0x3101f0['push'](_0x3101f0['shift']());}};_0x472ee8(++_0x5956af);}(_0x7d0a,0x1c5));var _0xa7d0=function(_0xcd5a3d,_0x3c5b33){_0xcd5a3d=_0xcd5a3d-0x0;var _0xd43207=_0x7d0a[_0xcd5a3d];return _0xd43207;};'use strict';var Sequelize=require(_0xa7d0('0x0'));module['exports']={'name':{'type':Sequelize[_0xa7d0('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xac1e=['exports','STRING','sequelize'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0xac1e,0x176));var _0xeac1=function(_0x18c5f2,_0x24af47){_0x18c5f2=_0x18c5f2-0x0;var _0x10b9b4=_0xac1e[_0x18c5f2];return _0x10b9b4;};'use strict';var Sequelize=require(_0xeac1('0x0'));module[_0xeac1('0x1')]={'name':{'type':Sequelize[_0xeac1('0x2')]},'description':{'type':Sequelize[_0xeac1('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 1ebfd68..ee41db5 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 _0xd604=['fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','findAll','rows','show','rawAttributes','include','options','find','create','body','update','params','findOne','ZendeskField','getFields','getSubjects','pick','getDescriptions','getTags','setTags','ids','html-pdf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','reject','save','destroy','stack','name','send','index','map','ZendeskConfiguration','type','key','query','keys','filters','intersection','model','attributes'];(function(_0x47ddfa,_0xea7d22){var _0xc96b54=function(_0x6704cb){while(--_0x6704cb){_0x47ddfa['push'](_0x47ddfa['shift']());}};_0xc96b54(++_0xea7d22);}(_0xd604,0x136));var _0x4d60=function(_0x509136,_0x33d27e){_0x509136=_0x509136-0x0;var _0x26517b=_0xd604[_0x509136];return _0x26517b;};'use strict';var pdf=require(_0x4d60('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4d60('0x1'));var moment=require(_0x4d60('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4d60('0x3'));var util=require(_0x4d60('0x4'));var path=require(_0x4d60('0x5'));var sox=require(_0x4d60('0x6'));var csv=require(_0x4d60('0x7'));var ejs=require(_0x4d60('0x8'));var fs=require('fs');var _=require(_0x4d60('0x9'));var squel=require(_0x4d60('0xa'));var crypto=require(_0x4d60('0xb'));var jsforce=require(_0x4d60('0xc'));var deskjs=require(_0x4d60('0xd'));var toCsv=require(_0x4d60('0x7'));var querystring=require(_0x4d60('0xe'));var Papa=require(_0x4d60('0xf'));var Redis=require(_0x4d60('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4d60('0x11'));var hardwareService=require(_0x4d60('0x12'));var logger=require('../../config/logger')(_0x4d60('0x13'));var utils=require(_0x4d60('0x14'));var config=require(_0x4d60('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x4d60('0x16'));var client=jayson[_0x4d60('0x17')][_0x4d60('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x390eca,_0x3aaaf0,_0x32e77a,_0x55cfbb){return new BPromise(function(_0x4f8da6,_0x10ffd9){var _0x3e6fbf=_0x55cfbb||client;return _0x3e6fbf['request'](_0x390eca,_0x32e77a)[_0x4d60('0x19')](function(_0x1d05a6){logger[_0x4d60('0x1a')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3aaaf0,_0x4d60('0x1b'));logger[_0x4d60('0x1c')](_0x4d60('0x1d'),_0x3aaaf0,_0x4d60('0x1b'),JSON[_0x4d60('0x1e')](_0x1d05a6));if(_0x1d05a6['error']){if(_0x1d05a6[_0x4d60('0x1f')][_0x4d60('0x20')]===0x1f4){logger[_0x4d60('0x1f')](_0x4d60('0x21'),_0x3aaaf0,_0x1d05a6[_0x4d60('0x1f')]['message']);return _0x10ffd9(_0x1d05a6[_0x4d60('0x1f')][_0x4d60('0x22')]);}logger[_0x4d60('0x1f')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3aaaf0,_0x1d05a6[_0x4d60('0x1f')][_0x4d60('0x22')]);return _0x4f8da6(_0x1d05a6[_0x4d60('0x1f')][_0x4d60('0x22')]);}else{logger['info'](_0x4d60('0x21'),_0x3aaaf0,_0x4d60('0x1b'));_0x4f8da6(_0x1d05a6[_0x4d60('0x23')][_0x4d60('0x22')]);}})[_0x4d60('0x24')](function(_0x23b048){logger[_0x4d60('0x1f')](_0x4d60('0x21'),_0x3aaaf0,_0x23b048);_0x10ffd9(_0x23b048);});});}function respondWithStatusCode(_0x1542e1,_0x2b4e2f){_0x2b4e2f=_0x2b4e2f||0xcc;return function(_0x264871){if(_0x264871){return _0x1542e1[_0x4d60('0x25')](_0x2b4e2f);}return _0x1542e1[_0x4d60('0x26')](_0x2b4e2f)[_0x4d60('0x27')]();};}function respondWithResult(_0x9519e5,_0x466886){_0x466886=_0x466886||0xc8;return function(_0x918509){if(_0x918509){return _0x9519e5[_0x4d60('0x26')](_0x466886)[_0x4d60('0x28')](_0x918509);}};}function respondWithFilteredResult(_0x4b6b33,_0x3dd863){return function(_0x43f363){if(_0x43f363){var _0x39bc3f=_0x43f363[_0x4d60('0x29')],_0x5bf822=_0x3dd863['offset'],_0x49e01a=_0x3dd863[_0x4d60('0x2a')]+_0x3dd863[_0x4d60('0x2b')],_0x42b89b;if(_0x49e01a>=_0x39bc3f){_0x49e01a=_0x39bc3f;_0x42b89b=0xc8;}else{_0x42b89b=0xce;}_0x4b6b33[_0x4d60('0x26')](_0x42b89b);return _0x4b6b33[_0x4d60('0x2c')]('Content-Range',_0x5bf822+'-'+_0x49e01a+'/'+_0x39bc3f)[_0x4d60('0x28')](_0x43f363);}return null;};}function patchUpdates(_0x2cbd7e){return function(_0xa4be1c){try{jsonpatch['apply'](_0xa4be1c,_0x2cbd7e,!![]);}catch(_0x2a7f2d){return BPromise[_0x4d60('0x2d')](_0x2a7f2d);}return _0xa4be1c[_0x4d60('0x2e')]();};}function saveUpdates(_0x264eee,_0x53ba8b){return function(_0x4e7053){if(_0x4e7053){return _0x4e7053['update'](_0x264eee)[_0x4d60('0x19')](function(_0x457b55){return _0x457b55;});}return null;};}function removeEntity(_0x356898,_0x53e2fa){return function(_0x638e42){if(_0x638e42){return _0x638e42[_0x4d60('0x2f')]()[_0x4d60('0x19')](function(){_0x356898['status'](0xcc)[_0x4d60('0x27')]();});}};}function handleEntityNotFound(_0x4d2c18,_0x1e1faa){return function(_0x44565f){if(!_0x44565f){_0x4d2c18[_0x4d60('0x25')](0x194);}return _0x44565f;};}function handleError(_0x5e0013,_0x4c4113){_0x4c4113=_0x4c4113||0x1f4;return function(_0x20b894){logger[_0x4d60('0x1f')](_0x20b894[_0x4d60('0x30')]);if(_0x20b894[_0x4d60('0x31')]){delete _0x20b894[_0x4d60('0x31')];}_0x5e0013[_0x4d60('0x26')](_0x4c4113)[_0x4d60('0x32')](_0x20b894);};}exports[_0x4d60('0x33')]=function(_0x2e7955,_0x2ae704){var _0x31441e={},_0x2c0eca={},_0x5d8f79={'count':0x0,'rows':[]};var _0x207f73=_[_0x4d60('0x34')](db[_0x4d60('0x35')]['rawAttributes'],function(_0x15f7ba){return{'name':_0x15f7ba['fieldName'],'type':_0x15f7ba[_0x4d60('0x36')][_0x4d60('0x37')]};});_0x2c0eca['model']=_[_0x4d60('0x34')](_0x207f73,_0x4d60('0x31'));_0x2c0eca[_0x4d60('0x38')]=_[_0x4d60('0x39')](_0x2e7955['query']);_0x2c0eca[_0x4d60('0x3a')]=_[_0x4d60('0x3b')](_0x2c0eca[_0x4d60('0x3c')],_0x2c0eca[_0x4d60('0x38')]);_0x31441e[_0x4d60('0x3d')]=_[_0x4d60('0x3b')](_0x2c0eca[_0x4d60('0x3c')],qs[_0x4d60('0x3e')](_0x2e7955['query'][_0x4d60('0x3e')]));_0x31441e[_0x4d60('0x3d')]=_0x31441e['attributes'][_0x4d60('0x3f')]?_0x31441e[_0x4d60('0x3d')]:_0x2c0eca[_0x4d60('0x3c')];if(!_0x2e7955['query'][_0x4d60('0x40')](_0x4d60('0x41'))){_0x31441e[_0x4d60('0x2b')]=qs[_0x4d60('0x2b')](_0x2e7955[_0x4d60('0x38')][_0x4d60('0x2b')]);_0x31441e[_0x4d60('0x2a')]=qs[_0x4d60('0x2a')](_0x2e7955[_0x4d60('0x38')][_0x4d60('0x2a')]);}_0x31441e[_0x4d60('0x42')]=qs[_0x4d60('0x43')](_0x2e7955[_0x4d60('0x38')][_0x4d60('0x43')]);_0x31441e[_0x4d60('0x44')]=qs[_0x4d60('0x3a')](_['pick'](_0x2e7955[_0x4d60('0x38')],_0x2c0eca[_0x4d60('0x3a')]),_0x207f73);if(_0x2e7955['query']['filter']){_0x31441e[_0x4d60('0x44')]=_[_0x4d60('0x45')](_0x31441e[_0x4d60('0x44')],{'$or':_[_0x4d60('0x34')](_0x207f73,function(_0x2c954a){if(_0x2c954a[_0x4d60('0x36')]!==_0x4d60('0x46')){var _0x7ca31a={};_0x7ca31a[_0x2c954a[_0x4d60('0x31')]]={'$like':'%'+_0x2e7955[_0x4d60('0x38')][_0x4d60('0x47')]+'%'};return _0x7ca31a;}})});}_0x31441e=_[_0x4d60('0x45')]({},_0x31441e,_0x2e7955['options']);var _0x4fbe21={'where':_0x31441e[_0x4d60('0x44')]};return db[_0x4d60('0x35')][_0x4d60('0x29')](_0x4fbe21)[_0x4d60('0x19')](function(_0x53c83b){_0x5d8f79[_0x4d60('0x29')]=_0x53c83b;if(_0x2e7955[_0x4d60('0x38')][_0x4d60('0x48')]){_0x31441e['include']=[{'all':!![]}];}return db[_0x4d60('0x35')][_0x4d60('0x49')](_0x31441e);})[_0x4d60('0x19')](function(_0x309141){_0x5d8f79[_0x4d60('0x4a')]=_0x309141;return _0x5d8f79;})[_0x4d60('0x19')](respondWithFilteredResult(_0x2ae704,_0x31441e))['catch'](handleError(_0x2ae704,null));};exports[_0x4d60('0x4b')]=function(_0x383807,_0x199c5b){var _0x586899={'raw':![],'where':{'id':_0x383807['params']['id']}},_0x37fd19={};_0x37fd19[_0x4d60('0x3c')]=_[_0x4d60('0x39')](db[_0x4d60('0x35')][_0x4d60('0x4c')]);_0x37fd19[_0x4d60('0x38')]=_['keys'](_0x383807[_0x4d60('0x38')]);_0x37fd19['filters']=_[_0x4d60('0x3b')](_0x37fd19[_0x4d60('0x3c')],_0x37fd19[_0x4d60('0x38')]);_0x586899[_0x4d60('0x3d')]=_[_0x4d60('0x3b')](_0x37fd19[_0x4d60('0x3c')],qs[_0x4d60('0x3e')](_0x383807['query'][_0x4d60('0x3e')]));_0x586899[_0x4d60('0x3d')]=_0x586899[_0x4d60('0x3d')][_0x4d60('0x3f')]?_0x586899[_0x4d60('0x3d')]:_0x37fd19[_0x4d60('0x3c')];if(_0x383807[_0x4d60('0x38')][_0x4d60('0x48')]){_0x586899[_0x4d60('0x4d')]=[{'all':!![]}];}_0x586899=_[_0x4d60('0x45')]({},_0x586899,_0x383807[_0x4d60('0x4e')]);return db[_0x4d60('0x35')][_0x4d60('0x4f')](_0x586899)[_0x4d60('0x19')](handleEntityNotFound(_0x199c5b,null))[_0x4d60('0x19')](respondWithResult(_0x199c5b,null))[_0x4d60('0x24')](handleError(_0x199c5b,null));};exports[_0x4d60('0x50')]=function(_0x460870,_0x3f7b66){return db['ZendeskConfiguration'][_0x4d60('0x50')](_0x460870[_0x4d60('0x51')],{})[_0x4d60('0x19')](respondWithResult(_0x3f7b66,0xc9))[_0x4d60('0x24')](handleError(_0x3f7b66,null));};exports[_0x4d60('0x52')]=function(_0x33cbdd,_0xa4333a){if(_0x33cbdd[_0x4d60('0x51')]['id']){delete _0x33cbdd[_0x4d60('0x51')]['id'];}return db['ZendeskConfiguration'][_0x4d60('0x4f')]({'where':{'id':_0x33cbdd[_0x4d60('0x53')]['id']}})[_0x4d60('0x19')](handleEntityNotFound(_0xa4333a,null))[_0x4d60('0x19')](saveUpdates(_0x33cbdd['body'],null))[_0x4d60('0x19')](respondWithResult(_0xa4333a,null))['catch'](handleError(_0xa4333a,null));};exports[_0x4d60('0x2f')]=function(_0x39868f,_0x382d5d){return db['ZendeskConfiguration'][_0x4d60('0x4f')]({'where':{'id':_0x39868f[_0x4d60('0x53')]['id']}})[_0x4d60('0x19')](handleEntityNotFound(_0x382d5d,null))[_0x4d60('0x19')](removeEntity(_0x382d5d,null))['catch'](handleError(_0x382d5d,null));};exports['getFields']=function(_0xcc7519,_0xd8c025,_0x47e07c){var _0x2e0c2f={};var _0x4876f5={};var _0x1613fd;var _0x39cb95;return db['ZendeskConfiguration'][_0x4d60('0x54')]({'where':{'id':_0xcc7519['params']['id']}})[_0x4d60('0x19')](handleEntityNotFound(_0xd8c025,null))[_0x4d60('0x19')](function(_0x29508b){if(_0x29508b){_0x1613fd=_0x29508b;_0x4876f5['model']=_[_0x4d60('0x39')](db[_0x4d60('0x55')][_0x4d60('0x4c')]);_0x4876f5['query']=_['keys'](_0xcc7519[_0x4d60('0x38')]);_0x4876f5['filters']=_[_0x4d60('0x3b')](_0x4876f5[_0x4d60('0x3c')],_0x4876f5[_0x4d60('0x38')]);_0x2e0c2f[_0x4d60('0x3d')]=_['intersection'](_0x4876f5[_0x4d60('0x3c')],qs[_0x4d60('0x3e')](_0xcc7519[_0x4d60('0x38')][_0x4d60('0x3e')]));_0x2e0c2f[_0x4d60('0x3d')]=_0x2e0c2f[_0x4d60('0x3d')][_0x4d60('0x3f')]?_0x2e0c2f['attributes']:_0x4876f5[_0x4d60('0x3c')];_0x2e0c2f['order']=qs[_0x4d60('0x43')](_0xcc7519['query']['sort']);_0x2e0c2f['where']=qs[_0x4d60('0x3a')](_['pick'](_0xcc7519['query'],_0x4876f5[_0x4d60('0x3a')]));if(_0xcc7519['query'][_0x4d60('0x47')]){_0x2e0c2f[_0x4d60('0x44')]=_[_0x4d60('0x45')](_0x2e0c2f['where'],{'$or':_['map'](_0x2e0c2f['attributes'],function(_0x4fd7d3){var _0xca3256={};_0xca3256[_0x4fd7d3]={'$like':'%'+_0xcc7519[_0x4d60('0x38')][_0x4d60('0x47')]+'%'};return _0xca3256;})});}_0x2e0c2f=_[_0x4d60('0x45')]({},_0x2e0c2f,_0xcc7519[_0x4d60('0x4e')]);return _0x1613fd[_0x4d60('0x56')](_0x2e0c2f);}})[_0x4d60('0x19')](function(_0x31944f){if(_0x31944f){_0x39cb95=_0x31944f[_0x4d60('0x3f')];if(!_0xcc7519[_0x4d60('0x38')][_0x4d60('0x40')](_0x4d60('0x41'))){_0x2e0c2f[_0x4d60('0x2b')]=qs[_0x4d60('0x2b')](_0xcc7519[_0x4d60('0x38')][_0x4d60('0x2b')]);_0x2e0c2f['offset']=qs['offset'](_0xcc7519['query'][_0x4d60('0x2a')]);}return _0x1613fd[_0x4d60('0x56')](_0x2e0c2f);}})[_0x4d60('0x19')](function(_0x4bd168){if(_0x4bd168){return _0x4bd168?{'count':_0x39cb95,'rows':_0x4bd168}:null;}})['then'](respondWithResult(_0xd8c025,null))['catch'](handleError(_0xd8c025,null));};exports[_0x4d60('0x57')]=function(_0x31ef56,_0x306c1e,_0x32b1a5){var _0x438cc3={};var _0x24dd59={};var _0x2eac8e;var _0x4e7a06;return db[_0x4d60('0x35')][_0x4d60('0x54')]({'where':{'id':_0x31ef56[_0x4d60('0x53')]['id']}})['then'](handleEntityNotFound(_0x306c1e,null))['then'](function(_0x40cbc0){if(_0x40cbc0){_0x2eac8e=_0x40cbc0;_0x24dd59['model']=_['keys'](db[_0x4d60('0x55')][_0x4d60('0x4c')]);_0x24dd59['query']=_[_0x4d60('0x39')](_0x31ef56[_0x4d60('0x38')]);_0x24dd59['filters']=_[_0x4d60('0x3b')](_0x24dd59[_0x4d60('0x3c')],_0x24dd59[_0x4d60('0x38')]);_0x438cc3[_0x4d60('0x3d')]=_[_0x4d60('0x3b')](_0x24dd59['model'],qs['fields'](_0x31ef56[_0x4d60('0x38')][_0x4d60('0x3e')]));_0x438cc3[_0x4d60('0x3d')]=_0x438cc3[_0x4d60('0x3d')][_0x4d60('0x3f')]?_0x438cc3[_0x4d60('0x3d')]:_0x24dd59[_0x4d60('0x3c')];_0x438cc3['order']=qs[_0x4d60('0x43')](_0x31ef56[_0x4d60('0x38')]['sort']);_0x438cc3[_0x4d60('0x44')]=qs[_0x4d60('0x3a')](_[_0x4d60('0x58')](_0x31ef56[_0x4d60('0x38')],_0x24dd59['filters']));if(_0x31ef56[_0x4d60('0x38')][_0x4d60('0x47')]){_0x438cc3[_0x4d60('0x44')]=_[_0x4d60('0x45')](_0x438cc3['where'],{'$or':_[_0x4d60('0x34')](_0x438cc3['attributes'],function(_0x1f8143){var _0x3288f8={};_0x3288f8[_0x1f8143]={'$like':'%'+_0x31ef56['query'][_0x4d60('0x47')]+'%'};return _0x3288f8;})});}_0x438cc3=_[_0x4d60('0x45')]({},_0x438cc3,_0x31ef56[_0x4d60('0x4e')]);return _0x2eac8e[_0x4d60('0x57')](_0x438cc3);}})['then'](function(_0x33bed1){if(_0x33bed1){_0x4e7a06=_0x33bed1[_0x4d60('0x3f')];if(!_0x31ef56[_0x4d60('0x38')][_0x4d60('0x40')](_0x4d60('0x41'))){_0x438cc3[_0x4d60('0x2b')]=qs['limit'](_0x31ef56[_0x4d60('0x38')][_0x4d60('0x2b')]);_0x438cc3['offset']=qs[_0x4d60('0x2a')](_0x31ef56['query']['offset']);}return _0x2eac8e[_0x4d60('0x57')](_0x438cc3);}})[_0x4d60('0x19')](function(_0x4e8b9b){if(_0x4e8b9b){return _0x4e8b9b?{'count':_0x4e7a06,'rows':_0x4e8b9b}:null;}})[_0x4d60('0x19')](respondWithResult(_0x306c1e,null))[_0x4d60('0x24')](handleError(_0x306c1e,null));};exports[_0x4d60('0x59')]=function(_0x21c3f6,_0x3da64d,_0x879bb5){var _0x3fb444={};var _0x3bdbaf={};var _0x4f55f9;var _0xab9a52;return db['ZendeskConfiguration'][_0x4d60('0x54')]({'where':{'id':_0x21c3f6[_0x4d60('0x53')]['id']}})[_0x4d60('0x19')](handleEntityNotFound(_0x3da64d,null))[_0x4d60('0x19')](function(_0x52beb4){if(_0x52beb4){_0x4f55f9=_0x52beb4;_0x3bdbaf[_0x4d60('0x3c')]=_['keys'](db[_0x4d60('0x55')][_0x4d60('0x4c')]);_0x3bdbaf[_0x4d60('0x38')]=_[_0x4d60('0x39')](_0x21c3f6['query']);_0x3bdbaf[_0x4d60('0x3a')]=_[_0x4d60('0x3b')](_0x3bdbaf[_0x4d60('0x3c')],_0x3bdbaf[_0x4d60('0x38')]);_0x3fb444[_0x4d60('0x3d')]=_[_0x4d60('0x3b')](_0x3bdbaf['model'],qs[_0x4d60('0x3e')](_0x21c3f6[_0x4d60('0x38')][_0x4d60('0x3e')]));_0x3fb444[_0x4d60('0x3d')]=_0x3fb444[_0x4d60('0x3d')]['length']?_0x3fb444['attributes']:_0x3bdbaf['model'];_0x3fb444[_0x4d60('0x42')]=qs[_0x4d60('0x43')](_0x21c3f6[_0x4d60('0x38')]['sort']);_0x3fb444[_0x4d60('0x44')]=qs[_0x4d60('0x3a')](_[_0x4d60('0x58')](_0x21c3f6[_0x4d60('0x38')],_0x3bdbaf['filters']));if(_0x21c3f6[_0x4d60('0x38')][_0x4d60('0x47')]){_0x3fb444['where']=_['merge'](_0x3fb444[_0x4d60('0x44')],{'$or':_[_0x4d60('0x34')](_0x3fb444[_0x4d60('0x3d')],function(_0x3a15c1){var _0x215d7a={};_0x215d7a[_0x3a15c1]={'$like':'%'+_0x21c3f6[_0x4d60('0x38')]['filter']+'%'};return _0x215d7a;})});}_0x3fb444=_[_0x4d60('0x45')]({},_0x3fb444,_0x21c3f6[_0x4d60('0x4e')]);return _0x4f55f9[_0x4d60('0x59')](_0x3fb444);}})['then'](function(_0x5cf8d3){if(_0x5cf8d3){_0xab9a52=_0x5cf8d3[_0x4d60('0x3f')];if(!_0x21c3f6[_0x4d60('0x38')][_0x4d60('0x40')](_0x4d60('0x41'))){_0x3fb444[_0x4d60('0x2b')]=qs[_0x4d60('0x2b')](_0x21c3f6[_0x4d60('0x38')][_0x4d60('0x2b')]);_0x3fb444[_0x4d60('0x2a')]=qs[_0x4d60('0x2a')](_0x21c3f6[_0x4d60('0x38')][_0x4d60('0x2a')]);}return _0x4f55f9['getDescriptions'](_0x3fb444);}})[_0x4d60('0x19')](function(_0x5d3463){if(_0x5d3463){return _0x5d3463?{'count':_0xab9a52,'rows':_0x5d3463}:null;}})[_0x4d60('0x19')](respondWithResult(_0x3da64d,null))[_0x4d60('0x24')](handleError(_0x3da64d,null));};exports[_0x4d60('0x5a')]=function(_0x29b808,_0x3cf072,_0x7c36bc){var _0x52015a={};var _0x4db0cb={};var _0x1baff7;var _0x2e51eb;return db[_0x4d60('0x35')][_0x4d60('0x54')]({'where':{'id':_0x29b808[_0x4d60('0x53')]['id']}})[_0x4d60('0x19')](handleEntityNotFound(_0x3cf072,null))[_0x4d60('0x19')](function(_0xd0fe9b){if(_0xd0fe9b){_0x1baff7=_0xd0fe9b;_0x4db0cb[_0x4d60('0x3c')]=_[_0x4d60('0x39')](db['Tag']['rawAttributes']);_0x4db0cb[_0x4d60('0x38')]=_[_0x4d60('0x39')](_0x29b808[_0x4d60('0x38')]);_0x4db0cb[_0x4d60('0x3a')]=_['intersection'](_0x4db0cb[_0x4d60('0x3c')],_0x4db0cb[_0x4d60('0x38')]);_0x52015a[_0x4d60('0x3d')]=_['intersection'](_0x4db0cb[_0x4d60('0x3c')],qs[_0x4d60('0x3e')](_0x29b808[_0x4d60('0x38')]['fields']));_0x52015a['attributes']=_0x52015a[_0x4d60('0x3d')][_0x4d60('0x3f')]?_0x52015a[_0x4d60('0x3d')]:_0x4db0cb[_0x4d60('0x3c')];_0x52015a['order']=qs[_0x4d60('0x43')](_0x29b808[_0x4d60('0x38')][_0x4d60('0x43')]);_0x52015a[_0x4d60('0x44')]=qs[_0x4d60('0x3a')](_[_0x4d60('0x58')](_0x29b808[_0x4d60('0x38')],_0x4db0cb[_0x4d60('0x3a')]));if(_0x29b808[_0x4d60('0x38')][_0x4d60('0x47')]){_0x52015a[_0x4d60('0x44')]=_['merge'](_0x52015a[_0x4d60('0x44')],{'$or':_[_0x4d60('0x34')](_0x52015a[_0x4d60('0x3d')],function(_0x7b97b0){var _0x4d7f46={};_0x4d7f46[_0x7b97b0]={'$like':'%'+_0x29b808['query']['filter']+'%'};return _0x4d7f46;})});}_0x52015a=_[_0x4d60('0x45')]({},_0x52015a,_0x29b808[_0x4d60('0x4e')]);return _0x1baff7[_0x4d60('0x5a')](_0x52015a);}})[_0x4d60('0x19')](function(_0x3421f6){if(_0x3421f6){_0x2e51eb=_0x3421f6['length'];if(!_0x29b808[_0x4d60('0x38')][_0x4d60('0x40')]('nolimit')){_0x52015a[_0x4d60('0x2b')]=qs[_0x4d60('0x2b')](_0x29b808['query']['limit']);_0x52015a[_0x4d60('0x2a')]=qs[_0x4d60('0x2a')](_0x29b808[_0x4d60('0x38')]['offset']);}return _0x1baff7[_0x4d60('0x5a')](_0x52015a);}})['then'](function(_0xc91290){if(_0xc91290){return _0xc91290?{'count':_0x2e51eb,'rows':_0xc91290}:null;}})[_0x4d60('0x19')](respondWithResult(_0x3cf072,null))[_0x4d60('0x24')](handleError(_0x3cf072,null));};exports[_0x4d60('0x5b')]=function(_0x47e8d3,_0x7e4ee0,_0x42b70d){if(_0x47e8d3[_0x4d60('0x51')]['id']){delete _0x47e8d3[_0x4d60('0x51')]['id'];}return db[_0x4d60('0x35')][_0x4d60('0x54')]({'where':{'id':_0x47e8d3[_0x4d60('0x53')]['id']}})[_0x4d60('0x19')](handleEntityNotFound(_0x7e4ee0,null))[_0x4d60('0x19')](function(_0x1f00bd){if(_0x1f00bd){return _0x1f00bd[_0x4d60('0x5b')](_0x47e8d3[_0x4d60('0x51')][_0x4d60('0x5c')]||[]);}return null;})[_0x4d60('0x19')](respondWithResult(_0x7e4ee0,null))['catch'](handleError(_0x7e4ee0,null));}; \ No newline at end of file +var _0x9cb8=['html-pdf','eml-format','rimraf','zip-dir','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/utils','../../config/environment','../../mysqldb','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','index','map','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','ZendeskConfiguration','rawAttributes','keys','length','includeAll','create','body','find','ZendeskField','getFields','getSubjects','getDescriptions','findOne','getTags','Tag','setTags','ids'];(function(_0x194331,_0x57fc29){var _0x49986a=function(_0x18a5ff){while(--_0x18a5ff){_0x194331['push'](_0x194331['shift']());}};_0x49986a(++_0x57fc29);}(_0x9cb8,0x11d));var _0x89cb=function(_0x4152fb,_0x382ecb){_0x4152fb=_0x4152fb-0x0;var _0x53b04d=_0x9cb8[_0x4152fb];return _0x53b04d;};'use strict';var pdf=require(_0x89cb('0x0'));var emlformat=require(_0x89cb('0x1'));var rimraf=require(_0x89cb('0x2'));var zipdir=require(_0x89cb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x89cb('0x4'));var moment=require(_0x89cb('0x5'));var BPromise=require(_0x89cb('0x6'));var Mustache=require('mustache');var util=require(_0x89cb('0x7'));var path=require(_0x89cb('0x8'));var sox=require('sox');var csv=require(_0x89cb('0x9'));var ejs=require(_0x89cb('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x89cb('0xb'));var crypto=require(_0x89cb('0xc'));var jsforce=require(_0x89cb('0xd'));var deskjs=require(_0x89cb('0xe'));var toCsv=require(_0x89cb('0x9'));var querystring=require(_0x89cb('0xf'));var Papa=require(_0x89cb('0x10'));var Redis=require(_0x89cb('0x11'));var authService=require(_0x89cb('0x12'));var qs=require(_0x89cb('0x13'));var as=require(_0x89cb('0x14'));var hardwareService=require(_0x89cb('0x15'));var logger=require(_0x89cb('0x16'))(_0x89cb('0x17'));var utils=require(_0x89cb('0x18'));var config=require(_0x89cb('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x89cb('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x89cb('0x1b')][_0x89cb('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x34a9de,_0x576e3b,_0x272ec1,_0x4b5f33){return new BPromise(function(_0x3e2a34,_0x1ccbc4){var _0x44d9da=_0x4b5f33||client;return _0x44d9da[_0x89cb('0x1d')](_0x34a9de,_0x272ec1)[_0x89cb('0x1e')](function(_0x564a6c){logger[_0x89cb('0x1f')](_0x89cb('0x20'),_0x576e3b,_0x89cb('0x21'));logger['debug'](_0x89cb('0x22'),_0x576e3b,'request\x20sent',JSON['stringify'](_0x564a6c));if(_0x564a6c['error']){if(_0x564a6c['error'][_0x89cb('0x23')]===0x1f4){logger[_0x89cb('0x24')](_0x89cb('0x20'),_0x576e3b,_0x564a6c[_0x89cb('0x24')]['message']);return _0x1ccbc4(_0x564a6c[_0x89cb('0x24')]['message']);}logger['error'](_0x89cb('0x20'),_0x576e3b,_0x564a6c[_0x89cb('0x24')][_0x89cb('0x25')]);return _0x3e2a34(_0x564a6c[_0x89cb('0x24')][_0x89cb('0x25')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x576e3b,'request\x20sent');_0x3e2a34(_0x564a6c['result'][_0x89cb('0x25')]);}})[_0x89cb('0x26')](function(_0x1b5180){logger['error'](_0x89cb('0x20'),_0x576e3b,_0x1b5180);_0x1ccbc4(_0x1b5180);});});}function respondWithStatusCode(_0x1008bf,_0x1e81f6){_0x1e81f6=_0x1e81f6||0xcc;return function(_0x16d4c7){if(_0x16d4c7){return _0x1008bf['sendStatus'](_0x1e81f6);}return _0x1008bf[_0x89cb('0x27')](_0x1e81f6)[_0x89cb('0x28')]();};}function respondWithResult(_0x505d66,_0x18c866){_0x18c866=_0x18c866||0xc8;return function(_0x232def){if(_0x232def){return _0x505d66[_0x89cb('0x27')](_0x18c866)[_0x89cb('0x29')](_0x232def);}};}function respondWithFilteredResult(_0x5d2250,_0x11d513){return function(_0x3a1456){if(_0x3a1456){var _0x398668=_0x3a1456[_0x89cb('0x2a')],_0x591f27=_0x11d513[_0x89cb('0x2b')],_0x8b534a=_0x11d513['offset']+_0x11d513[_0x89cb('0x2c')],_0x2fbf0c;if(_0x8b534a>=_0x398668){_0x8b534a=_0x398668;_0x2fbf0c=0xc8;}else{_0x2fbf0c=0xce;}_0x5d2250[_0x89cb('0x27')](_0x2fbf0c);return _0x5d2250[_0x89cb('0x2d')](_0x89cb('0x2e'),_0x591f27+'-'+_0x8b534a+'/'+_0x398668)[_0x89cb('0x29')](_0x3a1456);}return null;};}function patchUpdates(_0x556554){return function(_0x342593){try{jsonpatch['apply'](_0x342593,_0x556554,!![]);}catch(_0x363943){return BPromise[_0x89cb('0x2f')](_0x363943);}return _0x342593[_0x89cb('0x30')]();};}function saveUpdates(_0x3dfdca,_0x3ca428){return function(_0x22ae0f){if(_0x22ae0f){return _0x22ae0f[_0x89cb('0x31')](_0x3dfdca)['then'](function(_0x4b1bb3){return _0x4b1bb3;});}return null;};}function removeEntity(_0x13d4d3,_0x1b338e){return function(_0xe66319){if(_0xe66319){return _0xe66319[_0x89cb('0x32')]()[_0x89cb('0x1e')](function(){_0x13d4d3[_0x89cb('0x27')](0xcc)[_0x89cb('0x28')]();});}};}function handleEntityNotFound(_0x272a1c,_0x35c9f3){return function(_0x48c7f1){if(!_0x48c7f1){_0x272a1c['sendStatus'](0x194);}return _0x48c7f1;};}function handleError(_0x4fd12e,_0x17471d){_0x17471d=_0x17471d||0x1f4;return function(_0x598264){logger[_0x89cb('0x24')](_0x598264[_0x89cb('0x33')]);if(_0x598264['name']){delete _0x598264[_0x89cb('0x34')];}_0x4fd12e['status'](_0x17471d)['send'](_0x598264);};}exports[_0x89cb('0x35')]=function(_0x4b7e2f,_0x242bd7){var _0x4e5634={},_0xb5cb69={},_0x46d5fe={'count':0x0,'rows':[]};var _0x3c36ff=_[_0x89cb('0x36')](db['ZendeskConfiguration']['rawAttributes'],function(_0x5af486){return{'name':_0x5af486['fieldName'],'type':_0x5af486[_0x89cb('0x37')][_0x89cb('0x38')]};});_0xb5cb69['model']=_[_0x89cb('0x36')](_0x3c36ff,_0x89cb('0x34'));_0xb5cb69[_0x89cb('0x39')]=_['keys'](_0x4b7e2f[_0x89cb('0x39')]);_0xb5cb69[_0x89cb('0x3a')]=_['intersection'](_0xb5cb69[_0x89cb('0x3b')],_0xb5cb69['query']);_0x4e5634[_0x89cb('0x3c')]=_[_0x89cb('0x3d')](_0xb5cb69['model'],qs[_0x89cb('0x3e')](_0x4b7e2f[_0x89cb('0x39')]['fields']));_0x4e5634[_0x89cb('0x3c')]=_0x4e5634[_0x89cb('0x3c')]['length']?_0x4e5634[_0x89cb('0x3c')]:_0xb5cb69[_0x89cb('0x3b')];if(!_0x4b7e2f[_0x89cb('0x39')][_0x89cb('0x3f')](_0x89cb('0x40'))){_0x4e5634[_0x89cb('0x2c')]=qs[_0x89cb('0x2c')](_0x4b7e2f[_0x89cb('0x39')]['limit']);_0x4e5634[_0x89cb('0x2b')]=qs[_0x89cb('0x2b')](_0x4b7e2f[_0x89cb('0x39')][_0x89cb('0x2b')]);}_0x4e5634[_0x89cb('0x41')]=qs['sort'](_0x4b7e2f['query'][_0x89cb('0x42')]);_0x4e5634[_0x89cb('0x43')]=qs[_0x89cb('0x3a')](_[_0x89cb('0x44')](_0x4b7e2f['query'],_0xb5cb69['filters']),_0x3c36ff);if(_0x4b7e2f[_0x89cb('0x39')][_0x89cb('0x45')]){_0x4e5634[_0x89cb('0x43')]=_[_0x89cb('0x46')](_0x4e5634['where'],{'$or':_[_0x89cb('0x36')](_0x3c36ff,function(_0x471eeb){if(_0x471eeb[_0x89cb('0x37')]!==_0x89cb('0x47')){var _0x18247b={};_0x18247b[_0x471eeb[_0x89cb('0x34')]]={'$like':'%'+_0x4b7e2f[_0x89cb('0x39')]['filter']+'%'};return _0x18247b;}})});}_0x4e5634=_['merge']({},_0x4e5634,_0x4b7e2f[_0x89cb('0x48')]);var _0x2d3304={'where':_0x4e5634['where']};return db['ZendeskConfiguration'][_0x89cb('0x2a')](_0x2d3304)[_0x89cb('0x1e')](function(_0xe21a70){_0x46d5fe[_0x89cb('0x2a')]=_0xe21a70;if(_0x4b7e2f['query']['includeAll']){_0x4e5634[_0x89cb('0x49')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x89cb('0x4a')](_0x4e5634);})[_0x89cb('0x1e')](function(_0x5dfdba){_0x46d5fe[_0x89cb('0x4b')]=_0x5dfdba;return _0x46d5fe;})[_0x89cb('0x1e')](respondWithFilteredResult(_0x242bd7,_0x4e5634))[_0x89cb('0x26')](handleError(_0x242bd7,null));};exports[_0x89cb('0x4c')]=function(_0x31d491,_0x1875b0){var _0xd91d9d={'raw':![],'where':{'id':_0x31d491[_0x89cb('0x4d')]['id']}},_0x4b4514={};_0x4b4514['model']=_['keys'](db[_0x89cb('0x4e')][_0x89cb('0x4f')]);_0x4b4514['query']=_[_0x89cb('0x50')](_0x31d491[_0x89cb('0x39')]);_0x4b4514['filters']=_[_0x89cb('0x3d')](_0x4b4514[_0x89cb('0x3b')],_0x4b4514[_0x89cb('0x39')]);_0xd91d9d[_0x89cb('0x3c')]=_[_0x89cb('0x3d')](_0x4b4514[_0x89cb('0x3b')],qs[_0x89cb('0x3e')](_0x31d491['query'][_0x89cb('0x3e')]));_0xd91d9d[_0x89cb('0x3c')]=_0xd91d9d[_0x89cb('0x3c')][_0x89cb('0x51')]?_0xd91d9d['attributes']:_0x4b4514[_0x89cb('0x3b')];if(_0x31d491[_0x89cb('0x39')][_0x89cb('0x52')]){_0xd91d9d[_0x89cb('0x49')]=[{'all':!![]}];}_0xd91d9d=_['merge']({},_0xd91d9d,_0x31d491[_0x89cb('0x48')]);return db[_0x89cb('0x4e')]['find'](_0xd91d9d)[_0x89cb('0x1e')](handleEntityNotFound(_0x1875b0,null))[_0x89cb('0x1e')](respondWithResult(_0x1875b0,null))[_0x89cb('0x26')](handleError(_0x1875b0,null));};exports[_0x89cb('0x53')]=function(_0x46316e,_0x41a8d7){return db[_0x89cb('0x4e')]['create'](_0x46316e['body'],{})['then'](respondWithResult(_0x41a8d7,0xc9))['catch'](handleError(_0x41a8d7,null));};exports['update']=function(_0x48a488,_0x1155fa){if(_0x48a488[_0x89cb('0x54')]['id']){delete _0x48a488[_0x89cb('0x54')]['id'];}return db[_0x89cb('0x4e')][_0x89cb('0x55')]({'where':{'id':_0x48a488[_0x89cb('0x4d')]['id']}})[_0x89cb('0x1e')](handleEntityNotFound(_0x1155fa,null))[_0x89cb('0x1e')](saveUpdates(_0x48a488['body'],null))[_0x89cb('0x1e')](respondWithResult(_0x1155fa,null))['catch'](handleError(_0x1155fa,null));};exports[_0x89cb('0x32')]=function(_0x3ef471,_0x7366e){return db[_0x89cb('0x4e')][_0x89cb('0x55')]({'where':{'id':_0x3ef471[_0x89cb('0x4d')]['id']}})[_0x89cb('0x1e')](handleEntityNotFound(_0x7366e,null))[_0x89cb('0x1e')](removeEntity(_0x7366e,null))[_0x89cb('0x26')](handleError(_0x7366e,null));};exports['getFields']=function(_0x5a3343,_0x260088,_0x4dc816){var _0x529c4f={};var _0x67daf1={};var _0x2a935f;var _0x3cbe10;return db[_0x89cb('0x4e')]['findOne']({'where':{'id':_0x5a3343[_0x89cb('0x4d')]['id']}})['then'](handleEntityNotFound(_0x260088,null))[_0x89cb('0x1e')](function(_0x58c809){if(_0x58c809){_0x2a935f=_0x58c809;_0x67daf1['model']=_['keys'](db[_0x89cb('0x56')]['rawAttributes']);_0x67daf1[_0x89cb('0x39')]=_[_0x89cb('0x50')](_0x5a3343['query']);_0x67daf1[_0x89cb('0x3a')]=_['intersection'](_0x67daf1['model'],_0x67daf1['query']);_0x529c4f[_0x89cb('0x3c')]=_[_0x89cb('0x3d')](_0x67daf1[_0x89cb('0x3b')],qs[_0x89cb('0x3e')](_0x5a3343[_0x89cb('0x39')][_0x89cb('0x3e')]));_0x529c4f[_0x89cb('0x3c')]=_0x529c4f[_0x89cb('0x3c')][_0x89cb('0x51')]?_0x529c4f[_0x89cb('0x3c')]:_0x67daf1[_0x89cb('0x3b')];_0x529c4f[_0x89cb('0x41')]=qs[_0x89cb('0x42')](_0x5a3343[_0x89cb('0x39')][_0x89cb('0x42')]);_0x529c4f[_0x89cb('0x43')]=qs['filters'](_['pick'](_0x5a3343['query'],_0x67daf1[_0x89cb('0x3a')]));if(_0x5a3343['query'][_0x89cb('0x45')]){_0x529c4f['where']=_[_0x89cb('0x46')](_0x529c4f[_0x89cb('0x43')],{'$or':_[_0x89cb('0x36')](_0x529c4f[_0x89cb('0x3c')],function(_0x428dad){var _0x14f334={};_0x14f334[_0x428dad]={'$like':'%'+_0x5a3343[_0x89cb('0x39')][_0x89cb('0x45')]+'%'};return _0x14f334;})});}_0x529c4f=_[_0x89cb('0x46')]({},_0x529c4f,_0x5a3343['options']);return _0x2a935f[_0x89cb('0x57')](_0x529c4f);}})[_0x89cb('0x1e')](function(_0x7fea44){if(_0x7fea44){_0x3cbe10=_0x7fea44[_0x89cb('0x51')];if(!_0x5a3343['query'][_0x89cb('0x3f')](_0x89cb('0x40'))){_0x529c4f[_0x89cb('0x2c')]=qs[_0x89cb('0x2c')](_0x5a3343[_0x89cb('0x39')][_0x89cb('0x2c')]);_0x529c4f[_0x89cb('0x2b')]=qs['offset'](_0x5a3343['query'][_0x89cb('0x2b')]);}return _0x2a935f[_0x89cb('0x57')](_0x529c4f);}})[_0x89cb('0x1e')](function(_0x1a348b){if(_0x1a348b){return _0x1a348b?{'count':_0x3cbe10,'rows':_0x1a348b}:null;}})[_0x89cb('0x1e')](respondWithResult(_0x260088,null))[_0x89cb('0x26')](handleError(_0x260088,null));};exports['getSubjects']=function(_0x2deb9d,_0xd0a311,_0x3473b4){var _0x1a6cf0={};var _0x165821={};var _0x39ac80;var _0x4e912f;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x2deb9d[_0x89cb('0x4d')]['id']}})['then'](handleEntityNotFound(_0xd0a311,null))[_0x89cb('0x1e')](function(_0x138ecc){if(_0x138ecc){_0x39ac80=_0x138ecc;_0x165821[_0x89cb('0x3b')]=_[_0x89cb('0x50')](db[_0x89cb('0x56')][_0x89cb('0x4f')]);_0x165821[_0x89cb('0x39')]=_[_0x89cb('0x50')](_0x2deb9d[_0x89cb('0x39')]);_0x165821[_0x89cb('0x3a')]=_[_0x89cb('0x3d')](_0x165821[_0x89cb('0x3b')],_0x165821['query']);_0x1a6cf0['attributes']=_[_0x89cb('0x3d')](_0x165821['model'],qs[_0x89cb('0x3e')](_0x2deb9d[_0x89cb('0x39')][_0x89cb('0x3e')]));_0x1a6cf0[_0x89cb('0x3c')]=_0x1a6cf0['attributes'][_0x89cb('0x51')]?_0x1a6cf0[_0x89cb('0x3c')]:_0x165821[_0x89cb('0x3b')];_0x1a6cf0['order']=qs[_0x89cb('0x42')](_0x2deb9d[_0x89cb('0x39')][_0x89cb('0x42')]);_0x1a6cf0[_0x89cb('0x43')]=qs[_0x89cb('0x3a')](_[_0x89cb('0x44')](_0x2deb9d['query'],_0x165821[_0x89cb('0x3a')]));if(_0x2deb9d[_0x89cb('0x39')]['filter']){_0x1a6cf0[_0x89cb('0x43')]=_['merge'](_0x1a6cf0[_0x89cb('0x43')],{'$or':_[_0x89cb('0x36')](_0x1a6cf0[_0x89cb('0x3c')],function(_0x5527c4){var _0x3f1845={};_0x3f1845[_0x5527c4]={'$like':'%'+_0x2deb9d['query'][_0x89cb('0x45')]+'%'};return _0x3f1845;})});}_0x1a6cf0=_[_0x89cb('0x46')]({},_0x1a6cf0,_0x2deb9d[_0x89cb('0x48')]);return _0x39ac80['getSubjects'](_0x1a6cf0);}})[_0x89cb('0x1e')](function(_0x40f94b){if(_0x40f94b){_0x4e912f=_0x40f94b['length'];if(!_0x2deb9d[_0x89cb('0x39')][_0x89cb('0x3f')](_0x89cb('0x40'))){_0x1a6cf0['limit']=qs[_0x89cb('0x2c')](_0x2deb9d[_0x89cb('0x39')][_0x89cb('0x2c')]);_0x1a6cf0[_0x89cb('0x2b')]=qs['offset'](_0x2deb9d['query'][_0x89cb('0x2b')]);}return _0x39ac80[_0x89cb('0x58')](_0x1a6cf0);}})[_0x89cb('0x1e')](function(_0x35c993){if(_0x35c993){return _0x35c993?{'count':_0x4e912f,'rows':_0x35c993}:null;}})[_0x89cb('0x1e')](respondWithResult(_0xd0a311,null))[_0x89cb('0x26')](handleError(_0xd0a311,null));};exports[_0x89cb('0x59')]=function(_0xe41bc0,_0x5d7545,_0x10e8bf){var _0x441c57={};var _0x41403b={};var _0xb5438a;var _0x28d748;return db['ZendeskConfiguration'][_0x89cb('0x5a')]({'where':{'id':_0xe41bc0[_0x89cb('0x4d')]['id']}})[_0x89cb('0x1e')](handleEntityNotFound(_0x5d7545,null))[_0x89cb('0x1e')](function(_0x376909){if(_0x376909){_0xb5438a=_0x376909;_0x41403b[_0x89cb('0x3b')]=_[_0x89cb('0x50')](db['ZendeskField'][_0x89cb('0x4f')]);_0x41403b[_0x89cb('0x39')]=_[_0x89cb('0x50')](_0xe41bc0['query']);_0x41403b[_0x89cb('0x3a')]=_['intersection'](_0x41403b[_0x89cb('0x3b')],_0x41403b[_0x89cb('0x39')]);_0x441c57[_0x89cb('0x3c')]=_[_0x89cb('0x3d')](_0x41403b['model'],qs[_0x89cb('0x3e')](_0xe41bc0[_0x89cb('0x39')][_0x89cb('0x3e')]));_0x441c57[_0x89cb('0x3c')]=_0x441c57[_0x89cb('0x3c')]['length']?_0x441c57[_0x89cb('0x3c')]:_0x41403b[_0x89cb('0x3b')];_0x441c57['order']=qs[_0x89cb('0x42')](_0xe41bc0[_0x89cb('0x39')][_0x89cb('0x42')]);_0x441c57['where']=qs[_0x89cb('0x3a')](_['pick'](_0xe41bc0[_0x89cb('0x39')],_0x41403b[_0x89cb('0x3a')]));if(_0xe41bc0[_0x89cb('0x39')][_0x89cb('0x45')]){_0x441c57[_0x89cb('0x43')]=_['merge'](_0x441c57[_0x89cb('0x43')],{'$or':_[_0x89cb('0x36')](_0x441c57['attributes'],function(_0x55f123){var _0x4e4b9a={};_0x4e4b9a[_0x55f123]={'$like':'%'+_0xe41bc0['query'][_0x89cb('0x45')]+'%'};return _0x4e4b9a;})});}_0x441c57=_[_0x89cb('0x46')]({},_0x441c57,_0xe41bc0[_0x89cb('0x48')]);return _0xb5438a[_0x89cb('0x59')](_0x441c57);}})[_0x89cb('0x1e')](function(_0x102a0a){if(_0x102a0a){_0x28d748=_0x102a0a[_0x89cb('0x51')];if(!_0xe41bc0[_0x89cb('0x39')][_0x89cb('0x3f')](_0x89cb('0x40'))){_0x441c57[_0x89cb('0x2c')]=qs[_0x89cb('0x2c')](_0xe41bc0['query'][_0x89cb('0x2c')]);_0x441c57['offset']=qs[_0x89cb('0x2b')](_0xe41bc0[_0x89cb('0x39')][_0x89cb('0x2b')]);}return _0xb5438a[_0x89cb('0x59')](_0x441c57);}})['then'](function(_0x1110b3){if(_0x1110b3){return _0x1110b3?{'count':_0x28d748,'rows':_0x1110b3}:null;}})[_0x89cb('0x1e')](respondWithResult(_0x5d7545,null))[_0x89cb('0x26')](handleError(_0x5d7545,null));};exports[_0x89cb('0x5b')]=function(_0x19d707,_0x15c994,_0x164456){var _0x445445={};var _0x5cf405={};var _0x39ff25;var _0x6ec693;return db[_0x89cb('0x4e')][_0x89cb('0x5a')]({'where':{'id':_0x19d707[_0x89cb('0x4d')]['id']}})[_0x89cb('0x1e')](handleEntityNotFound(_0x15c994,null))[_0x89cb('0x1e')](function(_0x1d8e6e){if(_0x1d8e6e){_0x39ff25=_0x1d8e6e;_0x5cf405[_0x89cb('0x3b')]=_[_0x89cb('0x50')](db[_0x89cb('0x5c')][_0x89cb('0x4f')]);_0x5cf405[_0x89cb('0x39')]=_['keys'](_0x19d707[_0x89cb('0x39')]);_0x5cf405[_0x89cb('0x3a')]=_[_0x89cb('0x3d')](_0x5cf405[_0x89cb('0x3b')],_0x5cf405['query']);_0x445445[_0x89cb('0x3c')]=_[_0x89cb('0x3d')](_0x5cf405[_0x89cb('0x3b')],qs['fields'](_0x19d707[_0x89cb('0x39')]['fields']));_0x445445[_0x89cb('0x3c')]=_0x445445[_0x89cb('0x3c')][_0x89cb('0x51')]?_0x445445[_0x89cb('0x3c')]:_0x5cf405[_0x89cb('0x3b')];_0x445445[_0x89cb('0x41')]=qs[_0x89cb('0x42')](_0x19d707[_0x89cb('0x39')][_0x89cb('0x42')]);_0x445445[_0x89cb('0x43')]=qs[_0x89cb('0x3a')](_[_0x89cb('0x44')](_0x19d707[_0x89cb('0x39')],_0x5cf405[_0x89cb('0x3a')]));if(_0x19d707[_0x89cb('0x39')]['filter']){_0x445445[_0x89cb('0x43')]=_[_0x89cb('0x46')](_0x445445[_0x89cb('0x43')],{'$or':_['map'](_0x445445[_0x89cb('0x3c')],function(_0x3d2fc3){var _0x5b82e0={};_0x5b82e0[_0x3d2fc3]={'$like':'%'+_0x19d707[_0x89cb('0x39')][_0x89cb('0x45')]+'%'};return _0x5b82e0;})});}_0x445445=_['merge']({},_0x445445,_0x19d707[_0x89cb('0x48')]);return _0x39ff25[_0x89cb('0x5b')](_0x445445);}})[_0x89cb('0x1e')](function(_0x3ad102){if(_0x3ad102){_0x6ec693=_0x3ad102['length'];if(!_0x19d707[_0x89cb('0x39')][_0x89cb('0x3f')](_0x89cb('0x40'))){_0x445445['limit']=qs[_0x89cb('0x2c')](_0x19d707[_0x89cb('0x39')][_0x89cb('0x2c')]);_0x445445[_0x89cb('0x2b')]=qs[_0x89cb('0x2b')](_0x19d707[_0x89cb('0x39')][_0x89cb('0x2b')]);}return _0x39ff25[_0x89cb('0x5b')](_0x445445);}})[_0x89cb('0x1e')](function(_0x44274){if(_0x44274){return _0x44274?{'count':_0x6ec693,'rows':_0x44274}:null;}})[_0x89cb('0x1e')](respondWithResult(_0x15c994,null))['catch'](handleError(_0x15c994,null));};exports[_0x89cb('0x5d')]=function(_0x2e2c90,_0xd5efe1,_0x3d9b9f){if(_0x2e2c90[_0x89cb('0x54')]['id']){delete _0x2e2c90['body']['id'];}return db['ZendeskConfiguration'][_0x89cb('0x5a')]({'where':{'id':_0x2e2c90[_0x89cb('0x4d')]['id']}})[_0x89cb('0x1e')](handleEntityNotFound(_0xd5efe1,null))['then'](function(_0x1de126){if(_0x1de126){return _0x1de126[_0x89cb('0x5d')](_0x2e2c90[_0x89cb('0x54')][_0x89cb('0x5e')]||[]);}return null;})[_0x89cb('0x1e')](respondWithResult(_0xd5efe1,null))[_0x89cb('0x26')](handleError(_0xd5efe1,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index e30a62a..df2a061 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 _0x8390=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','ZendeskConfiguration','int_zendesk_configurations'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8390,0x18c));var _0x0839=function(_0x86b219,_0x43038f){_0x86b219=_0x86b219-0x0;var _0x1f320c=_0x8390[_0x86b219];return _0x1f320c;};'use strict';var _=require(_0x0839('0x0'));var util=require(_0x0839('0x1'));var logger=require(_0x0839('0x2'))('api');var moment=require(_0x0839('0x3'));var BPromise=require(_0x0839('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0839('0x5'));var rimraf=require(_0x0839('0x6'));var config=require(_0x0839('0x7'));var attributes=require(_0x0839('0x8'));module['exports']=function(_0x4d263a,_0x3c6c94){return _0x4d263a['define'](_0x0839('0x9'),attributes,{'tableName':_0x0839('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69f3=['../../config/logger','api','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','lodash'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x69f3,0x8b));var _0x369f=function(_0x1ce872,_0x2e54b2){_0x1ce872=_0x1ce872-0x0;var _0xfdc328=_0x69f3[_0x1ce872];return _0xfdc328;};'use strict';var _=require(_0x369f('0x0'));var util=require('util');var logger=require(_0x369f('0x1'))(_0x369f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x369f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x369f('0x4'));var config=require(_0x369f('0x5'));var attributes=require(_0x369f('0x6'));module[_0x369f('0x7')]=function(_0x32b698,_0x9090cc){return _0x32b698['define'](_0x369f('0x8'),attributes,{'tableName':_0x369f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 68dfa7a..c4feaab 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 _0xd5b5=['request\x20sent','debug','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x221c5a,_0x2c0ee9){var _0x56e96f=function(_0xc2403e){while(--_0xc2403e){_0x221c5a['push'](_0x221c5a['shift']());}};_0x56e96f(++_0x2c0ee9);}(_0xd5b5,0xd8));var _0x5d5b=function(_0x4362e6,_0x568800){_0x4362e6=_0x4362e6-0x0;var _0x544a93=_0xd5b5[_0x4362e6];return _0x544a93;};'use strict';var _=require(_0x5d5b('0x0'));var util=require(_0x5d5b('0x1'));var moment=require(_0x5d5b('0x2'));var BPromise=require(_0x5d5b('0x3'));var rs=require(_0x5d5b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d5b('0x5'))['db'];var utils=require(_0x5d5b('0x6'));var logger=require('../../config/logger')(_0x5d5b('0x7'));var config=require(_0x5d5b('0x8'));var jayson=require(_0x5d5b('0x9'));var client=jayson[_0x5d5b('0xa')][_0x5d5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x357bed,_0x4d5560,_0x4aae46){return new BPromise(function(_0x509d92,_0x581e0a){return client[_0x5d5b('0xc')](_0x357bed,_0x4aae46)['then'](function(_0x1f5132){logger[_0x5d5b('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4d5560,_0x5d5b('0xe'));logger[_0x5d5b('0xf')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4d5560,'request\x20sent',JSON[_0x5d5b('0x10')](_0x1f5132));if(_0x1f5132['error']){if(_0x1f5132[_0x5d5b('0x11')][_0x5d5b('0x12')]===0x1f4){logger[_0x5d5b('0x11')](_0x5d5b('0x13'),_0x4d5560,_0x1f5132['error'][_0x5d5b('0x14')]);return _0x581e0a(_0x1f5132[_0x5d5b('0x11')][_0x5d5b('0x14')]);}logger[_0x5d5b('0x11')](_0x5d5b('0x13'),_0x4d5560,_0x1f5132[_0x5d5b('0x11')][_0x5d5b('0x14')]);return _0x509d92(_0x1f5132[_0x5d5b('0x11')][_0x5d5b('0x14')]);}else{logger[_0x5d5b('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4d5560,_0x5d5b('0xe'));_0x509d92(_0x1f5132[_0x5d5b('0x15')][_0x5d5b('0x14')]);}})[_0x5d5b('0x16')](function(_0x4b64fc){logger[_0x5d5b('0x11')](_0x5d5b('0x13'),_0x4d5560,_0x4b64fc);_0x581e0a(_0x4b64fc);});});} \ No newline at end of file +var _0xb8a2=['client','http','request','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5bcefe,_0x43a32d){var _0x27bfaf=function(_0x1ab343){while(--_0x1ab343){_0x5bcefe['push'](_0x5bcefe['shift']());}};_0x27bfaf(++_0x43a32d);}(_0xb8a2,0xcb));var _0x2b8a=function(_0x40b45d,_0x3e5cda){_0x40b45d=_0x40b45d-0x0;var _0x46eb91=_0xb8a2[_0x40b45d];return _0x46eb91;};'use strict';var _=require('lodash');var util=require(_0x2b8a('0x0'));var moment=require('moment');var BPromise=require(_0x2b8a('0x1'));var rs=require(_0x2b8a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2b8a('0x3'))(_0x2b8a('0x4'));var config=require(_0x2b8a('0x5'));var jayson=require(_0x2b8a('0x6'));var client=jayson[_0x2b8a('0x7')][_0x2b8a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c3a37,_0x31b79c,_0x529e40){return new BPromise(function(_0x1da8c9,_0x37d3b9){return client[_0x2b8a('0x9')](_0x4c3a37,_0x529e40)['then'](function(_0x3bb059){logger[_0x2b8a('0xa')]('ZendeskConfiguration,\x20%s,\x20%s',_0x31b79c,_0x2b8a('0xb'));logger[_0x2b8a('0xc')](_0x2b8a('0xd'),_0x31b79c,'request\x20sent',JSON[_0x2b8a('0xe')](_0x3bb059));if(_0x3bb059['error']){if(_0x3bb059[_0x2b8a('0xf')][_0x2b8a('0x10')]===0x1f4){logger[_0x2b8a('0xf')](_0x2b8a('0x11'),_0x31b79c,_0x3bb059[_0x2b8a('0xf')]['message']);return _0x37d3b9(_0x3bb059[_0x2b8a('0xf')][_0x2b8a('0x12')]);}logger[_0x2b8a('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x31b79c,_0x3bb059[_0x2b8a('0xf')][_0x2b8a('0x12')]);return _0x1da8c9(_0x3bb059[_0x2b8a('0xf')][_0x2b8a('0x12')]);}else{logger['info'](_0x2b8a('0x11'),_0x31b79c,'request\x20sent');_0x1da8c9(_0x3bb059[_0x2b8a('0x13')][_0x2b8a('0x12')]);}})[_0x2b8a('0x14')](function(_0x15b896){logger[_0x2b8a('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x31b79c,_0x15b896);_0x37d3b9(_0x15b896);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index c80a4b0..e0e92ab 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 _0x49c2=['Router','../../components/auth/service','../../config/environment','./intZendeskField.controller','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x49c2,0x176));var _0x249c=function(_0x822939,_0x34bc67){_0x822939=_0x822939-0x0;var _0x476773=_0x49c2[_0x822939];return _0x476773;};'use strict';var multer=require(_0x249c('0x0'));var util=require(_0x249c('0x1'));var path=require(_0x249c('0x2'));var timeout=require(_0x249c('0x3'));var express=require('express');var router=express[_0x249c('0x4')]();var auth=require(_0x249c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x249c('0x6'));var controller=require(_0x249c('0x7'));router['get']('/',auth[_0x249c('0x8')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x249c('0x9')]);router[_0x249c('0xa')]('/',auth[_0x249c('0x8')](),controller[_0x249c('0xb')]);router[_0x249c('0xc')](_0x249c('0xd'),auth[_0x249c('0x8')](),controller[_0x249c('0xe')]);router[_0x249c('0xf')](_0x249c('0xd'),auth['isAuthenticated'](),controller[_0x249c('0x10')]);module[_0x249c('0x11')]=router; \ No newline at end of file +var _0xc61f=['create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','show'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc61f,0x65));var _0xfc61=function(_0x22159e,_0x317e4b){_0x22159e=_0x22159e-0x0;var _0x3521a3=_0xc61f[_0x22159e];return _0x3521a3;};'use strict';var multer=require('multer');var util=require(_0xfc61('0x0'));var path=require(_0xfc61('0x1'));var timeout=require(_0xfc61('0x2'));var express=require(_0xfc61('0x3'));var router=express[_0xfc61('0x4')]();var auth=require(_0xfc61('0x5'));var interaction=require(_0xfc61('0x6'));var config=require(_0xfc61('0x7'));var controller=require(_0xfc61('0x8'));router[_0xfc61('0x9')]('/',auth[_0xfc61('0xa')](),controller['index']);router[_0xfc61('0x9')](_0xfc61('0xb'),auth[_0xfc61('0xa')](),controller[_0xfc61('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfc61('0xd')]);router[_0xfc61('0xe')](_0xfc61('0xb'),auth[_0xfc61('0xa')](),controller[_0xfc61('0xf')]);router[_0xfc61('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfc61('0x11')]);module[_0xfc61('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 2febe8c..59ba429 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 _0xd847=['variable','BOOLEAN','sequelize','exports','ENUM','string','keyValue','STRING'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xd847,0x18a));var _0x7d84=function(_0x1823f1,_0xb4ed91){_0x1823f1=_0x1823f1-0x0;var _0xf6635=_0xd847[_0x1823f1];return _0xf6635;};'use strict';var Sequelize=require(_0x7d84('0x0'));module[_0x7d84('0x1')]={'type':{'type':Sequelize[_0x7d84('0x2')](_0x7d84('0x3'),'variable','customVariable',_0x7d84('0x4')),'defaultValue':_0x7d84('0x3')},'content':{'type':Sequelize[_0x7d84('0x5')]},'key':{'type':Sequelize[_0x7d84('0x5')]},'keyType':{'type':Sequelize[_0x7d84('0x2')]('string',_0x7d84('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x7d84('0x5')]},'idField':{'type':Sequelize[_0x7d84('0x5')]},'nameField':{'type':Sequelize[_0x7d84('0x5')]},'customField':{'type':Sequelize[_0x7d84('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7d84('0x5')]}}; \ No newline at end of file +var _0x8fe4=['keyValue','STRING','ENUM','BOOLEAN','sequelize','exports','string'];(function(_0x360c92,_0x5ed443){var _0x429495=function(_0x11feaf){while(--_0x11feaf){_0x360c92['push'](_0x360c92['shift']());}};_0x429495(++_0x5ed443);}(_0x8fe4,0x170));var _0x48fe=function(_0x4a6c50,_0xf2b78a){_0x4a6c50=_0x4a6c50-0x0;var _0x371080=_0x8fe4[_0x4a6c50];return _0x371080;};'use strict';var Sequelize=require(_0x48fe('0x0'));module[_0x48fe('0x1')]={'type':{'type':Sequelize['ENUM'](_0x48fe('0x2'),'variable','customVariable',_0x48fe('0x3')),'defaultValue':_0x48fe('0x2')},'content':{'type':Sequelize[_0x48fe('0x4')]},'key':{'type':Sequelize[_0x48fe('0x4')]},'keyType':{'type':Sequelize[_0x48fe('0x5')](_0x48fe('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x48fe('0x4')]},'customField':{'type':Sequelize[_0x48fe('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x48fe('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 56de84c..26aa7e5 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 _0x958a=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','json','apply','reject','update','destroy','error','name','send','index','map','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','then','includeAll','findAll','show','params','rawAttributes','include','ZendeskField','find','catch','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x958a,0x128));var _0xa958=function(_0x46ec0b,_0x399dea){_0x46ec0b=_0x46ec0b-0x0;var _0x5337a5=_0x958a[_0x46ec0b];return _0x5337a5;};'use strict';var pdf=require(_0xa958('0x0'));var emlformat=require(_0xa958('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa958('0x2'));var jsonpatch=require(_0xa958('0x3'));var rp=require(_0xa958('0x4'));var moment=require(_0xa958('0x5'));var BPromise=require(_0xa958('0x6'));var Mustache=require('mustache');var util=require(_0xa958('0x7'));var path=require('path');var sox=require(_0xa958('0x8'));var csv=require(_0xa958('0x9'));var ejs=require(_0xa958('0xa'));var fs=require('fs');var _=require(_0xa958('0xb'));var squel=require(_0xa958('0xc'));var crypto=require(_0xa958('0xd'));var jsforce=require(_0xa958('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa958('0xf'));var Papa=require(_0xa958('0x10'));var Redis=require(_0xa958('0x11'));var authService=require(_0xa958('0x12'));var qs=require(_0xa958('0x13'));var as=require(_0xa958('0x14'));var hardwareService=require(_0xa958('0x15'));var logger=require(_0xa958('0x16'))(_0xa958('0x17'));var utils=require(_0xa958('0x18'));var config=require(_0xa958('0x19'));var licenseUtil=require(_0xa958('0x1a'));var db=require(_0xa958('0x1b'))['db'];function respondWithStatusCode(_0x53bf27,_0x5063ae){_0x5063ae=_0x5063ae||0xcc;return function(_0x5bcc66){if(_0x5bcc66){return _0x53bf27[_0xa958('0x1c')](_0x5063ae);}return _0x53bf27[_0xa958('0x1d')](_0x5063ae)[_0xa958('0x1e')]();};}function respondWithResult(_0x591d4d,_0x3ebc66){_0x3ebc66=_0x3ebc66||0xc8;return function(_0x54c439){if(_0x54c439){return _0x591d4d['status'](_0x3ebc66)['json'](_0x54c439);}};}function respondWithFilteredResult(_0x1fe41e,_0x15fca8){return function(_0xb90ac6){if(_0xb90ac6){var _0x6a81c7=_0xb90ac6[_0xa958('0x1f')],_0x2c270c=_0x15fca8['offset'],_0x398931=_0x15fca8[_0xa958('0x20')]+_0x15fca8['limit'],_0x23736f;if(_0x398931>=_0x6a81c7){_0x398931=_0x6a81c7;_0x23736f=0xc8;}else{_0x23736f=0xce;}_0x1fe41e[_0xa958('0x1d')](_0x23736f);return _0x1fe41e[_0xa958('0x21')]('Content-Range',_0x2c270c+'-'+_0x398931+'/'+_0x6a81c7)[_0xa958('0x22')](_0xb90ac6);}return null;};}function patchUpdates(_0x1b5eec){return function(_0x47636f){try{jsonpatch[_0xa958('0x23')](_0x47636f,_0x1b5eec,!![]);}catch(_0x2759ad){return BPromise[_0xa958('0x24')](_0x2759ad);}return _0x47636f['save']();};}function saveUpdates(_0x4a90c2,_0x373661){return function(_0x1f48b7){if(_0x1f48b7){return _0x1f48b7[_0xa958('0x25')](_0x4a90c2)['then'](function(_0x1eec1d){return _0x1eec1d;});}return null;};}function removeEntity(_0x383aa3,_0x5c091a){return function(_0x28cf12){if(_0x28cf12){return _0x28cf12[_0xa958('0x26')]()['then'](function(){_0x383aa3['status'](0xcc)[_0xa958('0x1e')]();});}};}function handleEntityNotFound(_0x40b51e,_0x50b3c3){return function(_0x25f461){if(!_0x25f461){_0x40b51e[_0xa958('0x1c')](0x194);}return _0x25f461;};}function handleError(_0x2f03df,_0x347b72){_0x347b72=_0x347b72||0x1f4;return function(_0x16b04a){logger[_0xa958('0x27')](_0x16b04a['stack']);if(_0x16b04a[_0xa958('0x28')]){delete _0x16b04a['name'];}_0x2f03df[_0xa958('0x1d')](_0x347b72)[_0xa958('0x29')](_0x16b04a);};}exports[_0xa958('0x2a')]=function(_0x18f600,_0x21541f){var _0xddc7f6={},_0x2c970b={},_0xc75ae9={'count':0x0,'rows':[]};var _0x12cfde=_[_0xa958('0x2b')](db['ZendeskField']['rawAttributes'],function(_0xd2fcc9){return{'name':_0xd2fcc9['fieldName'],'type':_0xd2fcc9[_0xa958('0x2c')][_0xa958('0x2d')]};});_0x2c970b['model']=_[_0xa958('0x2b')](_0x12cfde,_0xa958('0x28'));_0x2c970b[_0xa958('0x2e')]=_[_0xa958('0x2f')](_0x18f600[_0xa958('0x2e')]);_0x2c970b['filters']=_['intersection'](_0x2c970b[_0xa958('0x30')],_0x2c970b['query']);_0xddc7f6['attributes']=_[_0xa958('0x31')](_0x2c970b[_0xa958('0x30')],qs[_0xa958('0x32')](_0x18f600[_0xa958('0x2e')][_0xa958('0x32')]));_0xddc7f6[_0xa958('0x33')]=_0xddc7f6['attributes'][_0xa958('0x34')]?_0xddc7f6['attributes']:_0x2c970b['model'];if(!_0x18f600[_0xa958('0x2e')][_0xa958('0x35')](_0xa958('0x36'))){_0xddc7f6[_0xa958('0x37')]=qs[_0xa958('0x37')](_0x18f600[_0xa958('0x2e')][_0xa958('0x37')]);_0xddc7f6[_0xa958('0x20')]=qs['offset'](_0x18f600['query'][_0xa958('0x20')]);}_0xddc7f6[_0xa958('0x38')]=qs[_0xa958('0x39')](_0x18f600[_0xa958('0x2e')][_0xa958('0x39')]);_0xddc7f6['where']=qs[_0xa958('0x3a')](_[_0xa958('0x3b')](_0x18f600[_0xa958('0x2e')],_0x2c970b[_0xa958('0x3a')]),_0x12cfde);if(_0x18f600['query'][_0xa958('0x3c')]){_0xddc7f6[_0xa958('0x3d')]=_[_0xa958('0x3e')](_0xddc7f6[_0xa958('0x3d')],{'$or':_[_0xa958('0x2b')](_0x12cfde,function(_0x48189e){if(_0x48189e[_0xa958('0x2c')]!==_0xa958('0x3f')){var _0x39af1e={};_0x39af1e[_0x48189e[_0xa958('0x28')]]={'$like':'%'+_0x18f600[_0xa958('0x2e')][_0xa958('0x3c')]+'%'};return _0x39af1e;}})});}_0xddc7f6=_[_0xa958('0x3e')]({},_0xddc7f6,_0x18f600[_0xa958('0x40')]);var _0x2378df={'where':_0xddc7f6[_0xa958('0x3d')]};return db['ZendeskField'][_0xa958('0x1f')](_0x2378df)[_0xa958('0x41')](function(_0x454a00){_0xc75ae9['count']=_0x454a00;if(_0x18f600[_0xa958('0x2e')][_0xa958('0x42')]){_0xddc7f6['include']=[{'all':!![]}];}return db['ZendeskField'][_0xa958('0x43')](_0xddc7f6);})['then'](function(_0x3b5e74){_0xc75ae9['rows']=_0x3b5e74;return _0xc75ae9;})[_0xa958('0x41')](respondWithFilteredResult(_0x21541f,_0xddc7f6))['catch'](handleError(_0x21541f,null));};exports[_0xa958('0x44')]=function(_0x1a5793,_0x44fa44){var _0x1af779={'raw':!![],'where':{'id':_0x1a5793[_0xa958('0x45')]['id']}},_0x1cdb9a={};_0x1cdb9a[_0xa958('0x30')]=_[_0xa958('0x2f')](db['ZendeskField'][_0xa958('0x46')]);_0x1cdb9a[_0xa958('0x2e')]=_[_0xa958('0x2f')](_0x1a5793['query']);_0x1cdb9a['filters']=_['intersection'](_0x1cdb9a[_0xa958('0x30')],_0x1cdb9a[_0xa958('0x2e')]);_0x1af779[_0xa958('0x33')]=_[_0xa958('0x31')](_0x1cdb9a[_0xa958('0x30')],qs['fields'](_0x1a5793[_0xa958('0x2e')][_0xa958('0x32')]));_0x1af779[_0xa958('0x33')]=_0x1af779[_0xa958('0x33')][_0xa958('0x34')]?_0x1af779[_0xa958('0x33')]:_0x1cdb9a[_0xa958('0x30')];if(_0x1a5793[_0xa958('0x2e')][_0xa958('0x42')]){_0x1af779[_0xa958('0x47')]=[{'all':!![]}];}_0x1af779=_[_0xa958('0x3e')]({},_0x1af779,_0x1a5793[_0xa958('0x40')]);return db[_0xa958('0x48')][_0xa958('0x49')](_0x1af779)[_0xa958('0x41')](handleEntityNotFound(_0x44fa44,null))[_0xa958('0x41')](respondWithResult(_0x44fa44,null))[_0xa958('0x4a')](handleError(_0x44fa44,null));};exports['create']=function(_0x5b8111,_0x5bfe18){return db[_0xa958('0x48')][_0xa958('0x4b')](_0x5b8111[_0xa958('0x4c')],{})[_0xa958('0x41')](respondWithResult(_0x5bfe18,0xc9))['catch'](handleError(_0x5bfe18,null));};exports[_0xa958('0x25')]=function(_0x3d6e80,_0xa07b67){if(_0x3d6e80[_0xa958('0x4c')]['id']){delete _0x3d6e80[_0xa958('0x4c')]['id'];}return db['ZendeskField'][_0xa958('0x49')]({'where':{'id':_0x3d6e80[_0xa958('0x45')]['id']}})[_0xa958('0x41')](handleEntityNotFound(_0xa07b67,null))['then'](saveUpdates(_0x3d6e80[_0xa958('0x4c')],null))['then'](respondWithResult(_0xa07b67,null))[_0xa958('0x4a')](handleError(_0xa07b67,null));};exports[_0xa958('0x26')]=function(_0x414fb1,_0x4e0740){return db[_0xa958('0x48')]['find']({'where':{'id':_0x414fb1[_0xa958('0x45')]['id']}})[_0xa958('0x41')](handleEntityNotFound(_0x4e0740,null))[_0xa958('0x41')](removeEntity(_0x4e0740,null))[_0xa958('0x4a')](handleError(_0x4e0740,null));}; \ No newline at end of file +var _0xe2fe=['nolimit','limit','order','where','filters','pick','filter','merge','options','rows','params','rawAttributes','find','create','catch','body','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','set','json','reject','save','then','destroy','end','error','stack','name','send','map','ZendeskField','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x5bd92e,_0x16c455){var _0xf06ea4=function(_0x9df4c1){while(--_0x9df4c1){_0x5bd92e['push'](_0x5bd92e['shift']());}};_0xf06ea4(++_0x16c455);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xee2f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xee2f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee2f('0x2'));var moment=require(_0xee2f('0x3'));var BPromise=require(_0xee2f('0x4'));var Mustache=require(_0xee2f('0x5'));var util=require(_0xee2f('0x6'));var path=require('path');var sox=require(_0xee2f('0x7'));var csv=require(_0xee2f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x8'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=_0x28b614['count'],_0x390c2c=_0x145241[_0xee2f('0x13')],_0x58f42a=_0x145241[_0xee2f('0x13')]+_0x145241['limit'],_0x3f6372;if(_0x58f42a>=_0x1bbf7d){_0x58f42a=_0x1bbf7d;_0x3f6372=0xc8;}else{_0x3f6372=0xce;}_0x445ba8['status'](_0x3f6372);return _0x445ba8[_0xee2f('0x14')]('Content-Range',_0x390c2c+'-'+_0x58f42a+'/'+_0x1bbf7d)[_0xee2f('0x15')](_0x28b614);}return null;};}function patchUpdates(_0x3e0b31){return function(_0x28549d){try{jsonpatch['apply'](_0x28549d,_0x3e0b31,!![]);}catch(_0x35e1a4){return BPromise[_0xee2f('0x16')](_0x35e1a4);}return _0x28549d[_0xee2f('0x17')]();};}function saveUpdates(_0x21fdf4,_0x3d892d){return function(_0x5d36d4){if(_0x5d36d4){return _0x5d36d4['update'](_0x21fdf4)[_0xee2f('0x18')](function(_0x3a1852){return _0x3a1852;});}return null;};}function removeEntity(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x19')]()[_0xee2f('0x18')](function(){_0x1ea808['status'](0xcc)[_0xee2f('0x1a')]();});}};}function handleEntityNotFound(_0x2c47c5,_0x15ceda){return function(_0x70e308){if(!_0x70e308){_0x2c47c5[_0xee2f('0x11')](0x194);}return _0x70e308;};}function handleError(_0xf77cf5,_0x15a1b1){_0x15a1b1=_0x15a1b1||0x1f4;return function(_0x13013f){logger[_0xee2f('0x1b')](_0x13013f[_0xee2f('0x1c')]);if(_0x13013f[_0xee2f('0x1d')]){delete _0x13013f[_0xee2f('0x1d')];}_0xf77cf5[_0xee2f('0x12')](_0x15a1b1)[_0xee2f('0x1e')](_0x13013f);};}exports['index']=function(_0x4ef690,_0x58ba65){var _0x18bdbb={},_0x18ff19={},_0x2cb0cb={'count':0x0,'rows':[]};var _0xc7f004=_[_0xee2f('0x1f')](db[_0xee2f('0x20')]['rawAttributes'],function(_0x3d3806){return{'name':_0x3d3806['fieldName'],'type':_0x3d3806[_0xee2f('0x21')][_0xee2f('0x22')]};});_0x18ff19[_0xee2f('0x23')]=_[_0xee2f('0x1f')](_0xc7f004,_0xee2f('0x1d'));_0x18ff19['query']=_[_0xee2f('0x24')](_0x4ef690[_0xee2f('0x25')]);_0x18ff19['filters']=_['intersection'](_0x18ff19[_0xee2f('0x23')],_0x18ff19['query']);_0x18bdbb[_0xee2f('0x26')]=_[_0xee2f('0x27')](_0x18ff19['model'],qs[_0xee2f('0x28')](_0x4ef690['query']['fields']));_0x18bdbb['attributes']=_0x18bdbb[_0xee2f('0x26')][_0xee2f('0x29')]?_0x18bdbb['attributes']:_0x18ff19[_0xee2f('0x23')];if(!_0x4ef690[_0xee2f('0x25')][_0xee2f('0x2a')](_0xee2f('0x2b'))){_0x18bdbb[_0xee2f('0x2c')]=qs['limit'](_0x4ef690[_0xee2f('0x25')]['limit']);_0x18bdbb[_0xee2f('0x13')]=qs[_0xee2f('0x13')](_0x4ef690[_0xee2f('0x25')]['offset']);}_0x18bdbb[_0xee2f('0x2d')]=qs['sort'](_0x4ef690[_0xee2f('0x25')]['sort']);_0x18bdbb[_0xee2f('0x2e')]=qs[_0xee2f('0x2f')](_[_0xee2f('0x30')](_0x4ef690[_0xee2f('0x25')],_0x18ff19[_0xee2f('0x2f')]),_0xc7f004);if(_0x4ef690[_0xee2f('0x25')][_0xee2f('0x31')]){_0x18bdbb[_0xee2f('0x2e')]=_[_0xee2f('0x32')](_0x18bdbb[_0xee2f('0x2e')],{'$or':_[_0xee2f('0x1f')](_0xc7f004,function(_0x5ad0a7){if(_0x5ad0a7[_0xee2f('0x21')]!=='VIRTUAL'){var _0x46166f={};_0x46166f[_0x5ad0a7[_0xee2f('0x1d')]]={'$like':'%'+_0x4ef690[_0xee2f('0x25')][_0xee2f('0x31')]+'%'};return _0x46166f;}})});}_0x18bdbb=_[_0xee2f('0x32')]({},_0x18bdbb,_0x4ef690[_0xee2f('0x33')]);var _0x694950={'where':_0x18bdbb[_0xee2f('0x2e')]};return db['ZendeskField']['count'](_0x694950)['then'](function(_0x46d9a2){_0x2cb0cb['count']=_0x46d9a2;if(_0x4ef690[_0xee2f('0x25')]['includeAll']){_0x18bdbb['include']=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x18bdbb);})[_0xee2f('0x18')](function(_0x692686){_0x2cb0cb[_0xee2f('0x34')]=_0x692686;return _0x2cb0cb;})[_0xee2f('0x18')](respondWithFilteredResult(_0x58ba65,_0x18bdbb))['catch'](handleError(_0x58ba65,null));};exports['show']=function(_0x3f2194,_0x5e12b7){var _0x5a7825={'raw':!![],'where':{'id':_0x3f2194[_0xee2f('0x35')]['id']}},_0x8204dc={};_0x8204dc[_0xee2f('0x23')]=_['keys'](db[_0xee2f('0x20')][_0xee2f('0x36')]);_0x8204dc[_0xee2f('0x25')]=_['keys'](_0x3f2194['query']);_0x8204dc[_0xee2f('0x2f')]=_[_0xee2f('0x27')](_0x8204dc[_0xee2f('0x23')],_0x8204dc[_0xee2f('0x25')]);_0x5a7825['attributes']=_[_0xee2f('0x27')](_0x8204dc[_0xee2f('0x23')],qs[_0xee2f('0x28')](_0x3f2194[_0xee2f('0x25')][_0xee2f('0x28')]));_0x5a7825[_0xee2f('0x26')]=_0x5a7825[_0xee2f('0x26')][_0xee2f('0x29')]?_0x5a7825[_0xee2f('0x26')]:_0x8204dc[_0xee2f('0x23')];if(_0x3f2194['query']['includeAll']){_0x5a7825['include']=[{'all':!![]}];}_0x5a7825=_['merge']({},_0x5a7825,_0x3f2194[_0xee2f('0x33')]);return db[_0xee2f('0x20')][_0xee2f('0x37')](_0x5a7825)[_0xee2f('0x18')](handleEntityNotFound(_0x5e12b7,null))[_0xee2f('0x18')](respondWithResult(_0x5e12b7,null))['catch'](handleError(_0x5e12b7,null));};exports[_0xee2f('0x38')]=function(_0x36c5cc,_0x9aef4b){return db[_0xee2f('0x20')]['create'](_0x36c5cc['body'],{})['then'](respondWithResult(_0x9aef4b,0xc9))[_0xee2f('0x39')](handleError(_0x9aef4b,null));};exports['update']=function(_0x4bb7c8,_0x57ce3c){if(_0x4bb7c8['body']['id']){delete _0x4bb7c8[_0xee2f('0x3a')]['id'];}return db[_0xee2f('0x20')][_0xee2f('0x37')]({'where':{'id':_0x4bb7c8['params']['id']}})[_0xee2f('0x18')](handleEntityNotFound(_0x57ce3c,null))['then'](saveUpdates(_0x4bb7c8[_0xee2f('0x3a')],null))[_0xee2f('0x18')](respondWithResult(_0x57ce3c,null))[_0xee2f('0x39')](handleError(_0x57ce3c,null));};exports[_0xee2f('0x19')]=function(_0x3d86b4,_0x4978eb){return db['ZendeskField'][_0xee2f('0x37')]({'where':{'id':_0x3d86b4['params']['id']}})[_0xee2f('0x18')](handleEntityNotFound(_0x4978eb,null))[_0xee2f('0x18')](removeEntity(_0x4978eb,null))[_0xee2f('0x39')](handleError(_0x4978eb,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index d738d1b..8610ea5 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 _0x8868=['path','rimraf','../../config/environment','./intZendeskField.attributes','define','int_zendesk_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x8868,0x1ca));var _0x8886=function(_0x3d3bc2,_0x1ad394){_0x3d3bc2=_0x3d3bc2-0x0;var _0xae29=_0x8868[_0x3d3bc2];return _0xae29;};'use strict';var _=require(_0x8886('0x0'));var util=require(_0x8886('0x1'));var logger=require(_0x8886('0x2'))(_0x8886('0x3'));var moment=require(_0x8886('0x4'));var BPromise=require(_0x8886('0x5'));var rp=require(_0x8886('0x6'));var fs=require('fs');var path=require(_0x8886('0x7'));var rimraf=require(_0x8886('0x8'));var config=require(_0x8886('0x9'));var attributes=require(_0x8886('0xa'));module['exports']=function(_0x544272,_0x2b2f5d){return _0x544272[_0x8886('0xb')]('ZendeskField',attributes,{'tableName':_0x8886('0xc'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x8886('0xd'),_0x8886('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0901=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','idField','FieldId'];(function(_0x4695e2,_0x3d5f15){var _0x160563=function(_0x5df0a2){while(--_0x5df0a2){_0x4695e2['push'](_0x4695e2['shift']());}};_0x160563(++_0x3d5f15);}(_0x0901,0x134));var _0x1090=function(_0x1390c1,_0x58c682){_0x1390c1=_0x1390c1-0x0;var _0x2644a7=_0x0901[_0x1390c1];return _0x2644a7;};'use strict';var _=require(_0x1090('0x0'));var util=require(_0x1090('0x1'));var logger=require(_0x1090('0x2'))(_0x1090('0x3'));var moment=require(_0x1090('0x4'));var BPromise=require(_0x1090('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1090('0x6'));var config=require(_0x1090('0x7'));var attributes=require(_0x1090('0x8'));module[_0x1090('0x9')]=function(_0x9a1121,_0x395921){return _0x9a1121['define'](_0x1090('0xa'),attributes,{'tableName':_0x1090('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x1090('0xc'),_0x1090('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 89867da..88b0d50 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 _0xd351=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x3a4931,_0x1b4341){var _0x31873b=function(_0x1ff778){while(--_0x1ff778){_0x3a4931['push'](_0x3a4931['shift']());}};_0x31873b(++_0x1b4341);}(_0xd351,0xb1));var _0x1d35=function(_0x2fc2e7,_0x4b3ffc){_0x2fc2e7=_0x2fc2e7-0x0;var _0x8f3dba=_0xd351[_0x2fc2e7];return _0x8f3dba;};'use strict';var _=require(_0x1d35('0x0'));var util=require(_0x1d35('0x1'));var moment=require(_0x1d35('0x2'));var BPromise=require(_0x1d35('0x3'));var rs=require(_0x1d35('0x4'));var fs=require('fs');var Redis=require(_0x1d35('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d35('0x6'));var logger=require(_0x1d35('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1d35('0x8'));var client=jayson['client'][_0x1d35('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x590fb3,_0x3b2171,_0x1f9ce0){return new BPromise(function(_0x2bf6f7,_0x5a0112){return client[_0x1d35('0xa')](_0x590fb3,_0x1f9ce0)[_0x1d35('0xb')](function(_0x5e5761){logger[_0x1d35('0xc')](_0x1d35('0xd'),_0x3b2171,_0x1d35('0xe'));logger[_0x1d35('0xf')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x3b2171,_0x1d35('0xe'),JSON[_0x1d35('0x10')](_0x5e5761));if(_0x5e5761[_0x1d35('0x11')]){if(_0x5e5761[_0x1d35('0x11')][_0x1d35('0x12')]===0x1f4){logger[_0x1d35('0x11')]('ZendeskField,\x20%s,\x20%s',_0x3b2171,_0x5e5761[_0x1d35('0x11')][_0x1d35('0x13')]);return _0x5a0112(_0x5e5761[_0x1d35('0x11')][_0x1d35('0x13')]);}logger[_0x1d35('0x11')](_0x1d35('0xd'),_0x3b2171,_0x5e5761[_0x1d35('0x11')][_0x1d35('0x13')]);return _0x2bf6f7(_0x5e5761[_0x1d35('0x11')]['message']);}else{logger[_0x1d35('0xc')](_0x1d35('0xd'),_0x3b2171,_0x1d35('0xe'));_0x2bf6f7(_0x5e5761[_0x1d35('0x14')][_0x1d35('0x13')]);}})[_0x1d35('0x15')](function(_0x25241e){logger[_0x1d35('0x11')](_0x1d35('0xd'),_0x3b2171,_0x25241e);_0x5a0112(_0x25241e);});});} \ No newline at end of file +var _0xafdf=['info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xafdf,0xf9));var _0xfafd=function(_0x20d594,_0x1f3c30){_0x20d594=_0x20d594-0x0;var _0x2089f9=_0xafdf[_0x20d594];return _0x2089f9;};'use strict';var _=require(_0xfafd('0x0'));var util=require(_0xfafd('0x1'));var moment=require(_0xfafd('0x2'));var BPromise=require(_0xfafd('0x3'));var rs=require(_0xfafd('0x4'));var fs=require('fs');var Redis=require(_0xfafd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfafd('0x6'));var logger=require(_0xfafd('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfafd('0x8'));var client=jayson['client'][_0xfafd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c8319,_0x4df487,_0x3f5ce3){return new BPromise(function(_0x3a8633,_0x449f27){return client[_0xfafd('0xa')](_0x4c8319,_0x3f5ce3)['then'](function(_0x4d8c62){logger[_0xfafd('0xb')]('ZendeskField,\x20%s,\x20%s',_0x4df487,_0xfafd('0xc'));logger[_0xfafd('0xd')](_0xfafd('0xe'),_0x4df487,_0xfafd('0xc'),JSON[_0xfafd('0xf')](_0x4d8c62));if(_0x4d8c62['error']){if(_0x4d8c62['error']['code']===0x1f4){logger[_0xfafd('0x10')]('ZendeskField,\x20%s,\x20%s',_0x4df487,_0x4d8c62[_0xfafd('0x10')]['message']);return _0x449f27(_0x4d8c62[_0xfafd('0x10')]['message']);}logger[_0xfafd('0x10')](_0xfafd('0x11'),_0x4df487,_0x4d8c62[_0xfafd('0x10')][_0xfafd('0x12')]);return _0x3a8633(_0x4d8c62[_0xfafd('0x10')][_0xfafd('0x12')]);}else{logger[_0xfafd('0xb')](_0xfafd('0x11'),_0x4df487,_0xfafd('0xc'));_0x3a8633(_0x4d8c62['result'][_0xfafd('0x12')]);}})[_0xfafd('0x13')](function(_0x3783a9){logger[_0xfafd('0x10')]('ZendeskField,\x20%s,\x20%s',_0x4df487,_0x3783a9);_0x449f27(_0x3783a9);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 9a042dc..d5d7672 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(_0x5e2fc5,_0x59c885){var _0x364f36=function(_0x29068f){while(--_0x29068f){_0x5e2fc5['push'](_0x5e2fc5['shift']());}};_0x364f36(++_0x59c885);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x379bc6,_0x339086){var _0x114c93=function(_0xb0b13a){while(--_0xb0b13a){_0x379bc6['push'](_0x379bc6['shift']());}};_0x114c93(++_0x339086);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 1efc2c4..210795e 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 _0x9c85=['sequelize','exports','STRING'];(function(_0x4c953c,_0x2edbb8){var _0xfa0543=function(_0x2d2cb1){while(--_0x2d2cb1){_0x4c953c['push'](_0x4c953c['shift']());}};_0xfa0543(++_0x2edbb8);}(_0x9c85,0xfc));var _0x59c8=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x9c85[_0x599f41];return _0x2e4d58;};'use strict';var Sequelize=require(_0x59c8('0x0'));module[_0x59c8('0x1')]={'name':{'type':Sequelize[_0x59c8('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x59c8('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x59c8('0x2')]},'serverUrl':{'type':Sequelize[_0x59c8('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x59c8('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x66c8=['exports','STRING','sequelize'];(function(_0x4e04f7,_0x493b4a){var _0x16eb92=function(_0x34e7fe){while(--_0x34e7fe){_0x4e04f7['push'](_0x4e04f7['shift']());}};_0x16eb92(++_0x493b4a);}(_0x66c8,0xec));var _0x866c=function(_0x2f5490,_0x39c549){_0x2f5490=_0x2f5490-0x0;var _0x3dee08=_0x66c8[_0x2f5490];return _0x3dee08;};'use strict';var Sequelize=require(_0x866c('0x0'));module[_0x866c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x866c('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x866c('0x2')]},'clientSecret':{'type':Sequelize[_0x866c('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x866c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index ec35aff..95b5c52 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 _0x056b=['ZohoConfiguration','sort','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','zone','serverUrl','host','zoho.eu','slice','lastIndexOf','GET','Calls','Zoho-oauthtoken\x20','response','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','display_label','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','includeAll','find','create','body','params','getConfigurations','findOne'];(function(_0x596ca3,_0x4ef597){var _0x25a222=function(_0x25e811){while(--_0x25e811){_0x596ca3['push'](_0x596ca3['shift']());}};_0x25a222(++_0x4ef597);}(_0x056b,0xb6));var _0xb056=function(_0x5ea911,_0x2a8a79){_0x5ea911=_0x5ea911-0x0;var _0x34ea74=_0x056b[_0x5ea911];return _0x34ea74;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb056('0x0'));var rimraf=require(_0xb056('0x1'));var zipdir=require(_0xb056('0x2'));var jsonpatch=require(_0xb056('0x3'));var rp=require(_0xb056('0x4'));var moment=require(_0xb056('0x5'));var BPromise=require(_0xb056('0x6'));var Mustache=require(_0xb056('0x7'));var util=require(_0xb056('0x8'));var path=require(_0xb056('0x9'));var sox=require(_0xb056('0xa'));var csv=require('to-csv');var ejs=require(_0xb056('0xb'));var fs=require('fs');var _=require(_0xb056('0xc'));var squel=require(_0xb056('0xd'));var crypto=require(_0xb056('0xe'));var jsforce=require(_0xb056('0xf'));var deskjs=require(_0xb056('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb056('0x11'));var Redis=require(_0xb056('0x12'));var authService=require(_0xb056('0x13'));var qs=require(_0xb056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb056('0x15'));var logger=require('../../config/logger')(_0xb056('0x16'));var utils=require(_0xb056('0x17'));var config=require(_0xb056('0x18'));var licenseUtil=require(_0xb056('0x19'));var db=require(_0xb056('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xb056('0x1b')][_0xb056('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x51999c,_0x81c9fc,_0x34611b,_0xf1c2e9){return new BPromise(function(_0x1197e5,_0x10dd19){var _0x3776a1=_0xf1c2e9||client;return _0x3776a1[_0xb056('0x1d')](_0x51999c,_0x34611b)['then'](function(_0x162146){logger[_0xb056('0x1e')](_0xb056('0x1f'),_0x81c9fc,_0xb056('0x20'));logger['debug'](_0xb056('0x21'),_0x81c9fc,'request\x20sent',JSON[_0xb056('0x22')](_0x162146));if(_0x162146[_0xb056('0x23')]){if(_0x162146['error'][_0xb056('0x24')]===0x1f4){logger['error'](_0xb056('0x1f'),_0x81c9fc,_0x162146[_0xb056('0x23')]['message']);return _0x10dd19(_0x162146[_0xb056('0x23')]['message']);}logger[_0xb056('0x23')](_0xb056('0x1f'),_0x81c9fc,_0x162146[_0xb056('0x23')][_0xb056('0x25')]);return _0x1197e5(_0x162146['error'][_0xb056('0x25')]);}else{logger['info'](_0xb056('0x1f'),_0x81c9fc,'request\x20sent');_0x1197e5(_0x162146[_0xb056('0x26')][_0xb056('0x25')]);}})[_0xb056('0x27')](function(_0x3e0298){logger[_0xb056('0x23')](_0xb056('0x1f'),_0x81c9fc,_0x3e0298);_0x10dd19(_0x3e0298);});});}function respondWithStatusCode(_0x4e66c3,_0x1016da){_0x1016da=_0x1016da||0xcc;return function(_0x18a3f2){if(_0x18a3f2){return _0x4e66c3[_0xb056('0x28')](_0x1016da);}return _0x4e66c3[_0xb056('0x29')](_0x1016da)['end']();};}function respondWithResult(_0x44a14f,_0x10b9b3){_0x10b9b3=_0x10b9b3||0xc8;return function(_0x5c39db){if(_0x5c39db){return _0x44a14f[_0xb056('0x29')](_0x10b9b3)[_0xb056('0x2a')](_0x5c39db);}};}function respondWithFilteredResult(_0x2ae873,_0x1d2c66){return function(_0x20a6c6){if(_0x20a6c6){var _0x4024d7=_0x20a6c6[_0xb056('0x2b')],_0x211898=_0x1d2c66['offset'],_0x2042f1=_0x1d2c66[_0xb056('0x2c')]+_0x1d2c66[_0xb056('0x2d')],_0x571e54;if(_0x2042f1>=_0x4024d7){_0x2042f1=_0x4024d7;_0x571e54=0xc8;}else{_0x571e54=0xce;}_0x2ae873[_0xb056('0x29')](_0x571e54);return _0x2ae873['set'](_0xb056('0x2e'),_0x211898+'-'+_0x2042f1+'/'+_0x4024d7)[_0xb056('0x2a')](_0x20a6c6);}return null;};}function patchUpdates(_0x4ba5f8){return function(_0x3a9e7d){try{jsonpatch[_0xb056('0x2f')](_0x3a9e7d,_0x4ba5f8,!![]);}catch(_0x329eaa){return BPromise[_0xb056('0x30')](_0x329eaa);}return _0x3a9e7d[_0xb056('0x31')]();};}function saveUpdates(_0x4ebca5,_0x87f31e){return function(_0x2de7ef){if(_0x2de7ef){return _0x2de7ef[_0xb056('0x32')](_0x4ebca5)[_0xb056('0x33')](function(_0x103482){return _0x103482;});}return null;};}function removeEntity(_0x559c34,_0x16bbd2){return function(_0x290807){if(_0x290807){return _0x290807[_0xb056('0x34')]()[_0xb056('0x33')](function(){_0x559c34[_0xb056('0x29')](0xcc)[_0xb056('0x35')]();});}};}function handleEntityNotFound(_0x19f277,_0x4522ef){return function(_0x54eda7){if(!_0x54eda7){_0x19f277[_0xb056('0x28')](0x194);}return _0x54eda7;};}function handleError(_0x59de9d,_0x45975d){_0x45975d=_0x45975d||0x1f4;return function(_0x4dffe5){logger['error'](_0x4dffe5[_0xb056('0x36')]);if(_0x4dffe5[_0xb056('0x37')]){delete _0x4dffe5[_0xb056('0x37')];}_0x59de9d[_0xb056('0x29')](_0x45975d)[_0xb056('0x38')](_0x4dffe5);};}exports[_0xb056('0x39')]=function(_0x32b332,_0x4adf18){var _0x112575={},_0x22e151={},_0x502fe7={'count':0x0,'rows':[]};var _0x50d9c6=_[_0xb056('0x3a')](db[_0xb056('0x3b')][_0xb056('0x3c')],function(_0x5c911b){return{'name':_0x5c911b[_0xb056('0x3d')],'type':_0x5c911b[_0xb056('0x3e')][_0xb056('0x3f')]};});_0x22e151[_0xb056('0x40')]=_[_0xb056('0x3a')](_0x50d9c6,_0xb056('0x37'));_0x22e151[_0xb056('0x41')]=_[_0xb056('0x42')](_0x32b332[_0xb056('0x41')]);_0x22e151[_0xb056('0x43')]=_[_0xb056('0x44')](_0x22e151[_0xb056('0x40')],_0x22e151['query']);_0x112575[_0xb056('0x45')]=_['intersection'](_0x22e151[_0xb056('0x40')],qs[_0xb056('0x46')](_0x32b332[_0xb056('0x41')][_0xb056('0x46')]));_0x112575[_0xb056('0x45')]=_0x112575[_0xb056('0x45')][_0xb056('0x47')]?_0x112575[_0xb056('0x45')]:_0x22e151['model'];if(!_0x32b332[_0xb056('0x41')][_0xb056('0x48')](_0xb056('0x49'))){_0x112575[_0xb056('0x2d')]=qs[_0xb056('0x2d')](_0x32b332['query'][_0xb056('0x2d')]);_0x112575[_0xb056('0x2c')]=qs[_0xb056('0x2c')](_0x32b332[_0xb056('0x41')][_0xb056('0x2c')]);}_0x112575[_0xb056('0x4a')]=qs['sort'](_0x32b332[_0xb056('0x41')]['sort']);_0x112575[_0xb056('0x4b')]=qs[_0xb056('0x43')](_[_0xb056('0x4c')](_0x32b332[_0xb056('0x41')],_0x22e151[_0xb056('0x43')]),_0x50d9c6);if(_0x32b332[_0xb056('0x41')][_0xb056('0x4d')]){_0x112575[_0xb056('0x4b')]=_[_0xb056('0x4e')](_0x112575[_0xb056('0x4b')],{'$or':_['map'](_0x50d9c6,function(_0xd73c5){if(_0xd73c5[_0xb056('0x3e')]!==_0xb056('0x4f')){var _0x4b0059={};_0x4b0059[_0xd73c5[_0xb056('0x37')]]={'$like':'%'+_0x32b332[_0xb056('0x41')]['filter']+'%'};return _0x4b0059;}})});}_0x112575=_['merge']({},_0x112575,_0x32b332[_0xb056('0x50')]);var _0x1ef279={'where':_0x112575[_0xb056('0x4b')]};return db[_0xb056('0x3b')]['count'](_0x1ef279)['then'](function(_0x4889b6){_0x502fe7['count']=_0x4889b6;if(_0x32b332['query']['includeAll']){_0x112575[_0xb056('0x51')]=[{'all':!![]}];}return db['ZohoAccount'][_0xb056('0x52')](_0x112575);})[_0xb056('0x33')](function(_0x1676f5){_0x502fe7[_0xb056('0x53')]=_0x1676f5;return _0x502fe7;})[_0xb056('0x33')](respondWithFilteredResult(_0x4adf18,_0x112575))[_0xb056('0x27')](handleError(_0x4adf18,null));};exports[_0xb056('0x54')]=function(_0x1d3f86,_0x5332b7){var _0x3185dc={'raw':![],'where':{'id':_0x1d3f86['params']['id']}},_0x76d3a0={};_0x76d3a0[_0xb056('0x40')]=_[_0xb056('0x42')](db[_0xb056('0x3b')][_0xb056('0x3c')]);_0x76d3a0[_0xb056('0x41')]=_[_0xb056('0x42')](_0x1d3f86['query']);_0x76d3a0[_0xb056('0x43')]=_['intersection'](_0x76d3a0[_0xb056('0x40')],_0x76d3a0[_0xb056('0x41')]);_0x3185dc[_0xb056('0x45')]=_[_0xb056('0x44')](_0x76d3a0[_0xb056('0x40')],qs[_0xb056('0x46')](_0x1d3f86[_0xb056('0x41')][_0xb056('0x46')]));_0x3185dc['attributes']=_0x3185dc[_0xb056('0x45')][_0xb056('0x47')]?_0x3185dc[_0xb056('0x45')]:_0x76d3a0[_0xb056('0x40')];if(_0x1d3f86[_0xb056('0x41')][_0xb056('0x55')]){_0x3185dc[_0xb056('0x51')]=[{'all':!![]}];}_0x3185dc=_[_0xb056('0x4e')]({},_0x3185dc,_0x1d3f86['options']);return db[_0xb056('0x3b')][_0xb056('0x56')](_0x3185dc)[_0xb056('0x33')](handleEntityNotFound(_0x5332b7,null))[_0xb056('0x33')](respondWithResult(_0x5332b7,null))[_0xb056('0x27')](handleError(_0x5332b7,null));};exports[_0xb056('0x57')]=function(_0x56b80d,_0xa2ecf){return db[_0xb056('0x3b')][_0xb056('0x57')](_0x56b80d['body'],{})[_0xb056('0x33')](respondWithResult(_0xa2ecf,0xc9))['catch'](handleError(_0xa2ecf,null));};exports[_0xb056('0x32')]=function(_0x8682d4,_0x2a064f){if(_0x8682d4[_0xb056('0x58')]['id']){delete _0x8682d4['body']['id'];}return db[_0xb056('0x3b')][_0xb056('0x56')]({'where':{'id':_0x8682d4['params']['id']}})[_0xb056('0x33')](handleEntityNotFound(_0x2a064f,null))[_0xb056('0x33')](saveUpdates(_0x8682d4[_0xb056('0x58')],null))[_0xb056('0x33')](respondWithResult(_0x2a064f,null))[_0xb056('0x27')](handleError(_0x2a064f,null));};exports['destroy']=function(_0x3a0854,_0x22bfb7){return db[_0xb056('0x3b')][_0xb056('0x56')]({'where':{'id':_0x3a0854[_0xb056('0x59')]['id']}})[_0xb056('0x33')](handleEntityNotFound(_0x22bfb7,null))[_0xb056('0x33')](removeEntity(_0x22bfb7,null))[_0xb056('0x27')](handleError(_0x22bfb7,null));};exports[_0xb056('0x5a')]=function(_0x29503a,_0x1b4a0d,_0x1aac7c){var _0x2ab5a8={};var _0x3f9964={};var _0xf7924b;var _0x282c31;return db[_0xb056('0x3b')][_0xb056('0x5b')]({'where':{'id':_0x29503a[_0xb056('0x59')]['id']}})[_0xb056('0x33')](handleEntityNotFound(_0x1b4a0d,null))[_0xb056('0x33')](function(_0x5e96c5){if(_0x5e96c5){_0xf7924b=_0x5e96c5;_0x3f9964[_0xb056('0x40')]=_[_0xb056('0x42')](db[_0xb056('0x5c')][_0xb056('0x3c')]);_0x3f9964[_0xb056('0x41')]=_[_0xb056('0x42')](_0x29503a[_0xb056('0x41')]);_0x3f9964['filters']=_['intersection'](_0x3f9964[_0xb056('0x40')],_0x3f9964[_0xb056('0x41')]);_0x2ab5a8[_0xb056('0x45')]=_[_0xb056('0x44')](_0x3f9964[_0xb056('0x40')],qs['fields'](_0x29503a[_0xb056('0x41')][_0xb056('0x46')]));_0x2ab5a8[_0xb056('0x45')]=_0x2ab5a8[_0xb056('0x45')]['length']?_0x2ab5a8[_0xb056('0x45')]:_0x3f9964[_0xb056('0x40')];_0x2ab5a8[_0xb056('0x4a')]=qs['sort'](_0x29503a[_0xb056('0x41')][_0xb056('0x5d')]);_0x2ab5a8[_0xb056('0x4b')]=qs['filters'](_[_0xb056('0x4c')](_0x29503a[_0xb056('0x41')],_0x3f9964[_0xb056('0x43')]));if(_0x29503a['query'][_0xb056('0x4d')]){_0x2ab5a8['where']=_[_0xb056('0x4e')](_0x2ab5a8[_0xb056('0x4b')],{'$or':_[_0xb056('0x3a')](_0x2ab5a8['attributes'],function(_0x45d347){var _0xc5b55d={};_0xc5b55d[_0x45d347]={'$like':'%'+_0x29503a['query'][_0xb056('0x4d')]+'%'};return _0xc5b55d;})});}_0x2ab5a8=_[_0xb056('0x4e')]({},_0x2ab5a8,_0x29503a[_0xb056('0x50')]);return _0xf7924b[_0xb056('0x5a')](_0x2ab5a8);}})[_0xb056('0x33')](function(_0x4e3a9e){if(_0x4e3a9e){_0x282c31=_0x4e3a9e['length'];if(!_0x29503a[_0xb056('0x41')]['hasOwnProperty'](_0xb056('0x49'))){_0x2ab5a8['limit']=qs[_0xb056('0x2d')](_0x29503a[_0xb056('0x41')][_0xb056('0x2d')]);_0x2ab5a8[_0xb056('0x2c')]=qs['offset'](_0x29503a['query'][_0xb056('0x2c')]);}return _0xf7924b[_0xb056('0x5a')](_0x2ab5a8);}})[_0xb056('0x33')](function(_0x21e16a){if(_0x21e16a){return _0x21e16a?{'count':_0x282c31,'rows':_0x21e16a}:null;}})['then'](respondWithResult(_0x1b4a0d,null))[_0xb056('0x27')](handleError(_0x1b4a0d,null));};exports['addConfiguration']=function(_0x349d7e,_0x5f0278,_0x2129c5){if(_0x349d7e['body']['id']){delete _0x349d7e[_0xb056('0x58')]['id'];}return db[_0xb056('0x3b')][_0xb056('0x5b')]({'where':{'id':_0x349d7e[_0xb056('0x59')]['id']}})['then'](handleEntityNotFound(_0x5f0278,null))[_0xb056('0x33')](function(_0x479332){if(_0x479332){_0x349d7e[_0xb056('0x58')][_0xb056('0x5e')]=_0x479332['id'];_0x349d7e[_0xb056('0x58')][_0xb056('0x5f')]=integrations[_0xb056('0x60')](_0x349d7e[_0xb056('0x58')][_0xb056('0x61')],_0x349d7e[_0xb056('0x58')][_0xb056('0x3e')]);_0x349d7e[_0xb056('0x58')][_0xb056('0x62')]=integrations[_0xb056('0x63')](_0x349d7e['body']['channel'],_0x349d7e[_0xb056('0x58')]['type']);return db[_0xb056('0x5c')]['create'](_0x349d7e[_0xb056('0x58')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db['ZohoField'],'as':_0xb056('0x62')}]});}return null;})['then'](respondWithResult(_0x5f0278,null))['catch'](handleError(_0x5f0278,null));};function getAccessToken(_0x3c9d5a){return new Promise(function(_0xb6fd9b,_0x343326){var _0x4ca52b;switch(_0x3c9d5a['zone']){case'US':_0x4ca52b='https://accounts.zoho.com';break;case'AU':_0x4ca52b=_0xb056('0x64');break;case'EU':_0x4ca52b=_0xb056('0x65');break;case'IN':_0x4ca52b=_0xb056('0x66');break;case'CN':_0x4ca52b=_0xb056('0x67');break;default:_0x4ca52b=_0xb056('0x65');break;}var _0x6a0bfc={'method':_0xb056('0x68'),'uri':_0x4ca52b+_0xb056('0x69'),'qs':{'refresh_token':_0x3c9d5a[_0xb056('0x6a')],'client_id':_0x3c9d5a[_0xb056('0x6b')],'client_secret':_0x3c9d5a[_0xb056('0x6c')],'grant_type':_0xb056('0x6d')},'json':!![]};return rp(_0x6a0bfc)[_0xb056('0x33')](function(_0x19243d){if(_0x19243d['access_token']){_0xb6fd9b(_0x19243d['access_token']);}else{_0x343326(_0xb056('0x6e'));}})['catch'](function(_0x11ef5f){_0x343326(_0x11ef5f);});});}exports[_0xb056('0x6f')]=function(_0x2a737f,_0xc2833b,_0x568898){var _0x5d84ff,_0x2e027a,_0x13a0f1,_0x131cef,_0x5aa3f5;return db['ZohoAccount'][_0xb056('0x5b')]({'where':{'id':_0x2a737f[_0xb056('0x59')]['id']},'attributes':['id','host',_0xb056('0x70'),_0xb056('0x6b'),_0xb056('0x6c'),_0xb056('0x71'),_0xb056('0x24'),_0xb056('0x6a')]})[_0xb056('0x33')](handleEntityNotFound(_0xc2833b,null))[_0xb056('0x33')](function(_0x141634){_0x5aa3f5=_0x141634;_0x5d84ff=_0x5aa3f5[_0xb056('0x72')];_0x2e027a=_0x5d84ff===_0xb056('0x73')?'eu':'com';_0x13a0f1=_0x5aa3f5[_0xb056('0x71')];var _0x2d0d1e=_0x13a0f1[_0xb056('0x74')](-0x1);if(_0x2d0d1e==='/'||_0x2d0d1e==='\x5c'||_0x2d0d1e===':'){_0x13a0f1=_0x13a0f1['substring'](0x0,_0x13a0f1[_0xb056('0x75')](_0x2d0d1e));}if(!_0x5aa3f5['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x5aa3f5);})[_0xb056('0x33')](function(_0x3a2f2f){if(_0x3a2f2f){return rp({'method':_0xb056('0x76'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x2e027a),'qs':{'module':_0xb056('0x77')},'headers':{'Authorization':_0xb056('0x78')+_0x3a2f2f},'json':!![]});}})['then'](function(_0xc9623e){if(_0xc9623e){if(_0xc9623e['response']&&_0xc9623e[_0xb056('0x79')][_0xb056('0x23')]){throw new Error(_0xc9623e['response']['error'][_0xb056('0x25')]);}var _0x1cf122=[];var _0x523ca5=[];var _0x1cc5b1=['Owner','Subject',_0xb056('0x7a'),_0xb056('0x7b'),_0xb056('0x7c'),_0xb056('0x7d'),_0xb056('0x7e'),_0xb056('0x7f')];_0x523ca5=_['remove'](_0xc9623e[_0xb056('0x46')],function(_0x5b7b5a){return _0x1cc5b1[_0xb056('0x80')](_0x5b7b5a[_0xb056('0x81')]);});for(var _0x4b3a43=0x0;_0x4b3a43<_0x523ca5[_0xb056('0x47')];_0x4b3a43++){if(_0x523ca5[_0x4b3a43][_0xb056('0x82')]===![]){_0x1cf122['push']({'id':_0x523ca5[_0x4b3a43]['id'],'name':_0x523ca5[_0x4b3a43][_0xb056('0x83')],'custom':_0x523ca5[_0x4b3a43]['custom_field'],'options':_0x523ca5[_0x4b3a43][_0xb056('0x84')]==='picklist'&&_0x523ca5[_0x4b3a43][_0xb056('0x85')][_0xb056('0x47')]>-0x1?_['map'](_0x523ca5[_0x4b3a43][_0xb056('0x85')],function(_0x52d9fb){return{'name':_0x52d9fb,'value':_0x52d9fb};}):[]});}}return{'count':_0x1cf122[_0xb056('0x47')],'rows':_0x1cf122};}else{return{'count':0x0,'rows':[]};}})[_0xb056('0x33')](respondWithResult(_0xc2833b,null))[_0xb056('0x27')](function(_0xf53df4){var _0x2835ca=_0x2a737f[_0xb056('0x41')][_0xb056('0x86')]?0x1f4:_0xf53df4[_0xb056('0x87')]||0x1f4;logger['error'](_0xb056('0x88'),'getFields',_0x2835ca,JSON['stringify'](_0xf53df4));delete _0xf53df4['name'];if(_0x2835ca===0x191){_0x2835ca=0x190;}_0xc2833b[_0xb056('0x29')](_0x2835ca)[_0xb056('0x38')](_0x2a737f[_0xb056('0x41')][_0xb056('0x86')]?{'message':'Wrong\x20credentials','statusCode':_0xf53df4[_0xb056('0x87')]}:_0xf53df4);});}; \ No newline at end of file +var _0x2542=['filter','merge','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','find','findOne','ZohoConfiguration','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','ZohoField','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','com','slice','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','index','map','ZohoAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','where','VIRTUAL'];(function(_0x5392fc,_0x51a706){var _0xf4f7cf=function(_0x12f68c){while(--_0x12f68c){_0x5392fc['push'](_0x5392fc['shift']());}};_0xf4f7cf(++_0x51a706);}(_0x2542,0x169));var _0x2254=function(_0x468c49,_0x23ceda){_0x468c49=_0x468c49-0x0;var _0x97e909=_0x2542[_0x468c49];return _0x97e909;};'use strict';var pdf=require(_0x2254('0x0'));var emlformat=require(_0x2254('0x1'));var rimraf=require(_0x2254('0x2'));var zipdir=require(_0x2254('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2254('0x4'));var moment=require('moment');var BPromise=require(_0x2254('0x5'));var Mustache=require(_0x2254('0x6'));var util=require(_0x2254('0x7'));var path=require(_0x2254('0x8'));var sox=require(_0x2254('0x9'));var csv=require('to-csv');var ejs=require(_0x2254('0xa'));var fs=require('fs');var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x10'));var querystring=require(_0x2254('0x11'));var Papa=require(_0x2254('0x12'));var Redis=require(_0x2254('0x13'));var authService=require(_0x2254('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x15'));var hardwareService=require(_0x2254('0x16'));var logger=require(_0x2254('0x17'))(_0x2254('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x19'));var db=require(_0x2254('0x1a'))['db'];var integrations=require(_0x2254('0x1b'));var jayson=require(_0x2254('0x1c'));var client=jayson[_0x2254('0x1d')][_0x2254('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x592a4f,_0x439238,_0x7c7ab0,_0x504749){return new BPromise(function(_0x2f4de,_0x1e582d){var _0xfb23cb=_0x504749||client;return _0xfb23cb[_0x2254('0x1f')](_0x592a4f,_0x7c7ab0)[_0x2254('0x20')](function(_0xbc5548){logger['info'](_0x2254('0x21'),_0x439238,'request\x20sent');logger[_0x2254('0x22')](_0x2254('0x23'),_0x439238,_0x2254('0x24'),JSON[_0x2254('0x25')](_0xbc5548));if(_0xbc5548[_0x2254('0x26')]){if(_0xbc5548[_0x2254('0x26')]['code']===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x439238,_0xbc5548[_0x2254('0x26')][_0x2254('0x27')]);return _0x1e582d(_0xbc5548[_0x2254('0x26')][_0x2254('0x27')]);}logger[_0x2254('0x26')](_0x2254('0x21'),_0x439238,_0xbc5548['error'][_0x2254('0x27')]);return _0x2f4de(_0xbc5548[_0x2254('0x26')][_0x2254('0x27')]);}else{logger['info']('ZohoAccount,\x20%s,\x20%s',_0x439238,'request\x20sent');_0x2f4de(_0xbc5548[_0x2254('0x28')][_0x2254('0x27')]);}})[_0x2254('0x29')](function(_0x56b91e){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x439238,_0x56b91e);_0x1e582d(_0x56b91e);});});}function respondWithStatusCode(_0x540020,_0x5e5edb){_0x5e5edb=_0x5e5edb||0xcc;return function(_0x4f797d){if(_0x4f797d){return _0x540020[_0x2254('0x2a')](_0x5e5edb);}return _0x540020[_0x2254('0x2b')](_0x5e5edb)[_0x2254('0x2c')]();};}function respondWithResult(_0x265467,_0x13522d){_0x13522d=_0x13522d||0xc8;return function(_0x1349c9){if(_0x1349c9){return _0x265467['status'](_0x13522d)['json'](_0x1349c9);}};}function respondWithFilteredResult(_0x1ada42,_0x4f6877){return function(_0x35608a){if(_0x35608a){var _0x141dc5=_0x35608a['count'],_0x31a543=_0x4f6877[_0x2254('0x2d')],_0x3aa0bd=_0x4f6877[_0x2254('0x2d')]+_0x4f6877[_0x2254('0x2e')],_0x19043b;if(_0x3aa0bd>=_0x141dc5){_0x3aa0bd=_0x141dc5;_0x19043b=0xc8;}else{_0x19043b=0xce;}_0x1ada42[_0x2254('0x2b')](_0x19043b);return _0x1ada42[_0x2254('0x2f')](_0x2254('0x30'),_0x31a543+'-'+_0x3aa0bd+'/'+_0x141dc5)[_0x2254('0x31')](_0x35608a);}return null;};}function patchUpdates(_0x22e791){return function(_0x29975f){try{jsonpatch[_0x2254('0x32')](_0x29975f,_0x22e791,!![]);}catch(_0x21c641){return BPromise[_0x2254('0x33')](_0x21c641);}return _0x29975f[_0x2254('0x34')]();};}function saveUpdates(_0x27d30a,_0x4577f4){return function(_0x1b16c8){if(_0x1b16c8){return _0x1b16c8[_0x2254('0x35')](_0x27d30a)[_0x2254('0x20')](function(_0x2f32f8){return _0x2f32f8;});}return null;};}function removeEntity(_0x4e3658,_0xe29526){return function(_0xa39b89){if(_0xa39b89){return _0xa39b89[_0x2254('0x36')]()[_0x2254('0x20')](function(){_0x4e3658[_0x2254('0x2b')](0xcc)[_0x2254('0x2c')]();});}};}function handleEntityNotFound(_0x2cfc9c,_0x3ed00e){return function(_0x5b84ce){if(!_0x5b84ce){_0x2cfc9c['sendStatus'](0x194);}return _0x5b84ce;};}function handleError(_0x835a0e,_0x3aa0bb){_0x3aa0bb=_0x3aa0bb||0x1f4;return function(_0x503540){logger[_0x2254('0x26')](_0x503540[_0x2254('0x37')]);if(_0x503540[_0x2254('0x38')]){delete _0x503540[_0x2254('0x38')];}_0x835a0e['status'](_0x3aa0bb)['send'](_0x503540);};}exports[_0x2254('0x39')]=function(_0x4e2035,_0x3d620a){var _0x10d749={},_0x2ba6a1={},_0x141ddc={'count':0x0,'rows':[]};var _0x12428a=_[_0x2254('0x3a')](db[_0x2254('0x3b')]['rawAttributes'],function(_0x3234d4){return{'name':_0x3234d4[_0x2254('0x3c')],'type':_0x3234d4[_0x2254('0x3d')][_0x2254('0x3e')]};});_0x2ba6a1[_0x2254('0x3f')]=_[_0x2254('0x3a')](_0x12428a,_0x2254('0x38'));_0x2ba6a1[_0x2254('0x40')]=_[_0x2254('0x41')](_0x4e2035[_0x2254('0x40')]);_0x2ba6a1['filters']=_[_0x2254('0x42')](_0x2ba6a1[_0x2254('0x3f')],_0x2ba6a1[_0x2254('0x40')]);_0x10d749[_0x2254('0x43')]=_['intersection'](_0x2ba6a1[_0x2254('0x3f')],qs[_0x2254('0x44')](_0x4e2035[_0x2254('0x40')][_0x2254('0x44')]));_0x10d749[_0x2254('0x43')]=_0x10d749[_0x2254('0x43')][_0x2254('0x45')]?_0x10d749[_0x2254('0x43')]:_0x2ba6a1['model'];if(!_0x4e2035[_0x2254('0x40')]['hasOwnProperty'](_0x2254('0x46'))){_0x10d749[_0x2254('0x2e')]=qs[_0x2254('0x2e')](_0x4e2035[_0x2254('0x40')][_0x2254('0x2e')]);_0x10d749[_0x2254('0x2d')]=qs[_0x2254('0x2d')](_0x4e2035['query'][_0x2254('0x2d')]);}_0x10d749[_0x2254('0x47')]=qs[_0x2254('0x48')](_0x4e2035[_0x2254('0x40')][_0x2254('0x48')]);_0x10d749['where']=qs[_0x2254('0x49')](_[_0x2254('0x4a')](_0x4e2035[_0x2254('0x40')],_0x2ba6a1[_0x2254('0x49')]),_0x12428a);if(_0x4e2035[_0x2254('0x40')]['filter']){_0x10d749[_0x2254('0x4b')]=_['merge'](_0x10d749[_0x2254('0x4b')],{'$or':_[_0x2254('0x3a')](_0x12428a,function(_0xb4d042){if(_0xb4d042[_0x2254('0x3d')]!==_0x2254('0x4c')){var _0x32ad54={};_0x32ad54[_0xb4d042[_0x2254('0x38')]]={'$like':'%'+_0x4e2035[_0x2254('0x40')][_0x2254('0x4d')]+'%'};return _0x32ad54;}})});}_0x10d749=_[_0x2254('0x4e')]({},_0x10d749,_0x4e2035[_0x2254('0x4f')]);var _0x2349cf={'where':_0x10d749[_0x2254('0x4b')]};return db['ZohoAccount'][_0x2254('0x50')](_0x2349cf)[_0x2254('0x20')](function(_0x2c5609){_0x141ddc['count']=_0x2c5609;if(_0x4e2035[_0x2254('0x40')][_0x2254('0x51')]){_0x10d749[_0x2254('0x52')]=[{'all':!![]}];}return db[_0x2254('0x3b')][_0x2254('0x53')](_0x10d749);})[_0x2254('0x20')](function(_0x1f69bb){_0x141ddc[_0x2254('0x54')]=_0x1f69bb;return _0x141ddc;})[_0x2254('0x20')](respondWithFilteredResult(_0x3d620a,_0x10d749))['catch'](handleError(_0x3d620a,null));};exports[_0x2254('0x55')]=function(_0x405eb2,_0x2c3055){var _0x32515f={'raw':![],'where':{'id':_0x405eb2[_0x2254('0x56')]['id']}},_0xbbc059={};_0xbbc059[_0x2254('0x3f')]=_[_0x2254('0x41')](db[_0x2254('0x3b')][_0x2254('0x57')]);_0xbbc059['query']=_[_0x2254('0x41')](_0x405eb2[_0x2254('0x40')]);_0xbbc059['filters']=_[_0x2254('0x42')](_0xbbc059[_0x2254('0x3f')],_0xbbc059[_0x2254('0x40')]);_0x32515f[_0x2254('0x43')]=_['intersection'](_0xbbc059[_0x2254('0x3f')],qs[_0x2254('0x44')](_0x405eb2['query'][_0x2254('0x44')]));_0x32515f[_0x2254('0x43')]=_0x32515f[_0x2254('0x43')][_0x2254('0x45')]?_0x32515f['attributes']:_0xbbc059[_0x2254('0x3f')];if(_0x405eb2[_0x2254('0x40')][_0x2254('0x51')]){_0x32515f['include']=[{'all':!![]}];}_0x32515f=_['merge']({},_0x32515f,_0x405eb2[_0x2254('0x4f')]);return db[_0x2254('0x3b')]['find'](_0x32515f)[_0x2254('0x20')](handleEntityNotFound(_0x2c3055,null))['then'](respondWithResult(_0x2c3055,null))['catch'](handleError(_0x2c3055,null));};exports[_0x2254('0x58')]=function(_0x135962,_0x3be0f3){return db[_0x2254('0x3b')][_0x2254('0x58')](_0x135962['body'],{})['then'](respondWithResult(_0x3be0f3,0xc9))[_0x2254('0x29')](handleError(_0x3be0f3,null));};exports['update']=function(_0x10a8db,_0x28a7c6){if(_0x10a8db[_0x2254('0x59')]['id']){delete _0x10a8db[_0x2254('0x59')]['id'];}return db['ZohoAccount'][_0x2254('0x5a')]({'where':{'id':_0x10a8db[_0x2254('0x56')]['id']}})['then'](handleEntityNotFound(_0x28a7c6,null))['then'](saveUpdates(_0x10a8db[_0x2254('0x59')],null))['then'](respondWithResult(_0x28a7c6,null))[_0x2254('0x29')](handleError(_0x28a7c6,null));};exports[_0x2254('0x36')]=function(_0x2ef4a0,_0x2cdcf1){return db[_0x2254('0x3b')]['find']({'where':{'id':_0x2ef4a0['params']['id']}})[_0x2254('0x20')](handleEntityNotFound(_0x2cdcf1,null))['then'](removeEntity(_0x2cdcf1,null))[_0x2254('0x29')](handleError(_0x2cdcf1,null));};exports['getConfigurations']=function(_0x4da493,_0x5999c8,_0x2c0063){var _0x448773={};var _0x1d4b90={};var _0x3ea2d9;var _0x13606e;return db[_0x2254('0x3b')][_0x2254('0x5b')]({'where':{'id':_0x4da493[_0x2254('0x56')]['id']}})[_0x2254('0x20')](handleEntityNotFound(_0x5999c8,null))[_0x2254('0x20')](function(_0x2e68b5){if(_0x2e68b5){_0x3ea2d9=_0x2e68b5;_0x1d4b90[_0x2254('0x3f')]=_[_0x2254('0x41')](db[_0x2254('0x5c')][_0x2254('0x57')]);_0x1d4b90[_0x2254('0x40')]=_[_0x2254('0x41')](_0x4da493[_0x2254('0x40')]);_0x1d4b90[_0x2254('0x49')]=_['intersection'](_0x1d4b90[_0x2254('0x3f')],_0x1d4b90[_0x2254('0x40')]);_0x448773[_0x2254('0x43')]=_[_0x2254('0x42')](_0x1d4b90['model'],qs['fields'](_0x4da493[_0x2254('0x40')][_0x2254('0x44')]));_0x448773[_0x2254('0x43')]=_0x448773[_0x2254('0x43')][_0x2254('0x45')]?_0x448773['attributes']:_0x1d4b90[_0x2254('0x3f')];_0x448773[_0x2254('0x47')]=qs[_0x2254('0x48')](_0x4da493['query']['sort']);_0x448773[_0x2254('0x4b')]=qs['filters'](_[_0x2254('0x4a')](_0x4da493[_0x2254('0x40')],_0x1d4b90['filters']));if(_0x4da493[_0x2254('0x40')][_0x2254('0x4d')]){_0x448773['where']=_[_0x2254('0x4e')](_0x448773[_0x2254('0x4b')],{'$or':_['map'](_0x448773['attributes'],function(_0xde4e7){var _0xa159a4={};_0xa159a4[_0xde4e7]={'$like':'%'+_0x4da493['query']['filter']+'%'};return _0xa159a4;})});}_0x448773=_[_0x2254('0x4e')]({},_0x448773,_0x4da493['options']);return _0x3ea2d9[_0x2254('0x5d')](_0x448773);}})['then'](function(_0x1cabab){if(_0x1cabab){_0x13606e=_0x1cabab[_0x2254('0x45')];if(!_0x4da493[_0x2254('0x40')][_0x2254('0x5e')]('nolimit')){_0x448773[_0x2254('0x2e')]=qs['limit'](_0x4da493[_0x2254('0x40')][_0x2254('0x2e')]);_0x448773['offset']=qs[_0x2254('0x2d')](_0x4da493[_0x2254('0x40')]['offset']);}return _0x3ea2d9[_0x2254('0x5d')](_0x448773);}})[_0x2254('0x20')](function(_0x28ef48){if(_0x28ef48){return _0x28ef48?{'count':_0x13606e,'rows':_0x28ef48}:null;}})[_0x2254('0x20')](respondWithResult(_0x5999c8,null))['catch'](handleError(_0x5999c8,null));};exports[_0x2254('0x5f')]=function(_0x301db7,_0x544102,_0x1ac8ff){if(_0x301db7[_0x2254('0x59')]['id']){delete _0x301db7['body']['id'];}return db[_0x2254('0x3b')]['findOne']({'where':{'id':_0x301db7[_0x2254('0x56')]['id']}})['then'](handleEntityNotFound(_0x544102,null))[_0x2254('0x20')](function(_0x1f95b2){if(_0x1f95b2){_0x301db7['body'][_0x2254('0x60')]=_0x1f95b2['id'];_0x301db7['body'][_0x2254('0x61')]=integrations[_0x2254('0x62')](_0x301db7[_0x2254('0x59')]['channel'],_0x301db7[_0x2254('0x59')]['type']);_0x301db7[_0x2254('0x59')][_0x2254('0x63')]=integrations['getDescriptions'](_0x301db7['body'][_0x2254('0x64')],_0x301db7[_0x2254('0x59')][_0x2254('0x3d')]);return db[_0x2254('0x5c')]['create'](_0x301db7[_0x2254('0x59')],{'include':[{'model':db[_0x2254('0x65')],'as':_0x2254('0x61')},{'model':db[_0x2254('0x65')],'as':'Descriptions'}]});}return null;})[_0x2254('0x20')](respondWithResult(_0x544102,null))[_0x2254('0x29')](handleError(_0x544102,null));};function getAccessToken(_0x5cddb0){return new Promise(function(_0x38e393,_0x5cbdb0){var _0x19283d;switch(_0x5cddb0['zone']){case'US':_0x19283d='https://accounts.zoho.com';break;case'AU':_0x19283d='https://accounts.zoho.com.au';break;case'EU':_0x19283d=_0x2254('0x66');break;case'IN':_0x19283d='https://accounts.zoho.in';break;case'CN':_0x19283d=_0x2254('0x67');break;default:_0x19283d=_0x2254('0x66');break;}var _0x5b7f68={'method':_0x2254('0x68'),'uri':_0x19283d+_0x2254('0x69'),'qs':{'refresh_token':_0x5cddb0[_0x2254('0x6a')],'client_id':_0x5cddb0[_0x2254('0x6b')],'client_secret':_0x5cddb0[_0x2254('0x6c')],'grant_type':_0x2254('0x6d')},'json':!![]};return rp(_0x5b7f68)['then'](function(_0x553ac5){if(_0x553ac5[_0x2254('0x6e')]){_0x38e393(_0x553ac5[_0x2254('0x6e')]);}else{_0x5cbdb0(_0x2254('0x6f'));}})[_0x2254('0x29')](function(_0x3c8c99){_0x5cbdb0(_0x3c8c99);});});}exports[_0x2254('0x70')]=function(_0x30e8cb,_0xf1a252,_0xdeafce){var _0x39b95b,_0x4ddf37,_0x25eb17,_0x40cd61,_0x53cf03;return db[_0x2254('0x3b')]['findOne']({'where':{'id':_0x30e8cb[_0x2254('0x56')]['id']},'attributes':['id',_0x2254('0x71'),'zone',_0x2254('0x6b'),'clientSecret',_0x2254('0x72'),_0x2254('0x73'),_0x2254('0x6a')]})[_0x2254('0x20')](handleEntityNotFound(_0xf1a252,null))['then'](function(_0x15a29a){_0x53cf03=_0x15a29a;_0x39b95b=_0x53cf03[_0x2254('0x71')];_0x4ddf37=_0x39b95b===_0x2254('0x74')?'eu':_0x2254('0x75');_0x25eb17=_0x53cf03['serverUrl'];var _0x177f00=_0x25eb17[_0x2254('0x76')](-0x1);if(_0x177f00==='/'||_0x177f00==='\x5c'||_0x177f00===':'){_0x25eb17=_0x25eb17['substring'](0x0,_0x25eb17[_0x2254('0x77')](_0x177f00));}if(!_0x53cf03[_0x2254('0x6a')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x53cf03);})['then'](function(_0x1f29ec){if(_0x1f29ec){return rp({'method':_0x2254('0x78'),'uri':util[_0x2254('0x79')](_0x2254('0x7a'),_0x4ddf37),'qs':{'module':_0x2254('0x7b')},'headers':{'Authorization':_0x2254('0x7c')+_0x1f29ec},'json':!![]});}})[_0x2254('0x20')](function(_0x251d70){if(_0x251d70){if(_0x251d70[_0x2254('0x7d')]&&_0x251d70['response'][_0x2254('0x26')]){throw new Error(_0x251d70['response'][_0x2254('0x26')]['message']);}var _0x36d121=[];var _0x207a09=[];var _0x2b0a45=['Owner',_0x2254('0x7e'),_0x2254('0x7f'),_0x2254('0x80'),_0x2254('0x81'),_0x2254('0x82'),_0x2254('0x83'),_0x2254('0x84')];_0x207a09=_[_0x2254('0x85')](_0x251d70[_0x2254('0x44')],function(_0x146b52){return _0x2b0a45[_0x2254('0x86')](_0x146b52[_0x2254('0x87')]);});for(var _0x70c30=0x0;_0x70c30<_0x207a09['length'];_0x70c30++){if(_0x207a09[_0x70c30][_0x2254('0x88')]===![]){_0x36d121['push']({'id':_0x207a09[_0x70c30]['id'],'name':_0x207a09[_0x70c30][_0x2254('0x89')],'custom':_0x207a09[_0x70c30][_0x2254('0x8a')],'options':_0x207a09[_0x70c30][_0x2254('0x8b')]===_0x2254('0x8c')&&_0x207a09[_0x70c30][_0x2254('0x8d')][_0x2254('0x45')]>-0x1?_[_0x2254('0x3a')](_0x207a09[_0x70c30]['pick_list_values'],function(_0x46b528){return{'name':_0x46b528,'value':_0x46b528};}):[]});}}return{'count':_0x36d121['length'],'rows':_0x36d121};}else{return{'count':0x0,'rows':[]};}})[_0x2254('0x20')](respondWithResult(_0xf1a252,null))['catch'](function(_0xa761ee){var _0x449ede=_0x30e8cb[_0x2254('0x40')]['test']?0x1f4:_0xa761ee[_0x2254('0x8e')]||0x1f4;logger[_0x2254('0x26')](_0x2254('0x8f'),_0x2254('0x70'),_0x449ede,JSON[_0x2254('0x25')](_0xa761ee));delete _0xa761ee[_0x2254('0x38')];if(_0x449ede===0x191){_0x449ede=0x190;}_0xf1a252[_0x2254('0x2b')](_0x449ede)[_0x2254('0x90')](_0x30e8cb['query']['test']?{'message':_0x2254('0x91'),'statusCode':_0xa761ee['statusCode']}:_0xa761ee);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 26c7faf..8c6ee9d 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 _0x86f0=['error','host','then','catch','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','code','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','serverUrl','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect'];(function(_0x4576b7,_0x50057b){var _0x3a81e0=function(_0x5e2814){while(--_0x5e2814){_0x4576b7['push'](_0x4576b7['shift']());}};_0x3a81e0(++_0x50057b);}(_0x86f0,0x1b2));var _0x086f=function(_0x583167,_0x40fcb0){_0x583167=_0x583167-0x0;var _0x5202c7=_0x86f0[_0x583167];return _0x5202c7;};'use strict';var _=require(_0x086f('0x0'));var util=require('util');var logger=require(_0x086f('0x1'))(_0x086f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x086f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x086f('0x4'));var config=require(_0x086f('0x5'));var attributes=require(_0x086f('0x6'));var integrations=require(_0x086f('0x7'));module[_0x086f('0x8')]=function(_0x593bd3,_0x161688){return _0x593bd3[_0x086f('0x9')](_0x086f('0xa'),attributes,{'tableName':_0x086f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4cfec6,_0xa5e6f1,_0x1dd8bb){if(_0x4cfec6[_0x086f('0xc')](_0x086f('0xd'))||_0x4cfec6[_0x086f('0xc')]('serverUrl')||_0x4cfec6[_0x086f('0xc')](_0x086f('0xe'))||_0x4cfec6[_0x086f('0xc')]('clientSecret')||_0x4cfec6[_0x086f('0xc')](_0x086f('0xf'))||_0x4cfec6['changed']('host')){var _0x32971b,_0x4116cf;_0x32971b=_0x4cfec6['serverUrl'];var _0x223e2f=_0x32971b[_0x086f('0x10')](-0x1);if(_0x223e2f==='/'||_0x223e2f==='\x5c'||_0x223e2f===':'){_0x32971b=_0x32971b[_0x086f('0x11')](0x0,_0x32971b[_0x086f('0x12')](_0x223e2f));}switch(_0x4cfec6[_0x086f('0xd')]){case'US':_0x4116cf=_0x086f('0x13');break;case'AU':_0x4116cf=_0x086f('0x14');break;case'IN':_0x4116cf=_0x086f('0x15');break;case'CN':_0x4116cf=_0x086f('0x16');break;default:_0x4116cf=_0x086f('0x17');break;}var _0x206483={'method':_0x086f('0x18'),'uri':_0x4116cf+_0x086f('0x19'),'form':{'grant_type':_0x086f('0x1a'),'client_id':_0x4cfec6[_0x086f('0xe')],'client_secret':_0x4cfec6[_0x086f('0x1b')],'redirect_uri':_0x4cfec6[_0x086f('0x1c')],'code':_0x4cfec6[_0x086f('0xf')]},'headers':{'Content-Type':_0x086f('0x1d')}};return rp(_0x206483)['then'](function(_0x3cf8a1){var _0x68dc87=JSON[_0x086f('0x1e')](_0x3cf8a1);if(_0x68dc87[_0x086f('0x1f')]){_0x4cfec6[_0x086f('0x20')]=_0x68dc87['refresh_token'];logger[_0x086f('0x21')](util[_0x086f('0x22')](_0x086f('0x23'),_0x4cfec6[_0x086f('0x24')],_0x4cfec6['id']));}else{logger['error'](util[_0x086f('0x22')](_0x086f('0x25'),_0x4cfec6[_0x086f('0x24')],_0x4cfec6['id']),util[_0x086f('0x26')](_0x68dc87,{'showHidden':![],'depth':null}));}return _0x1dd8bb(null,_0xa5e6f1);})['catch'](function(_0x36b695){logger[_0x086f('0x27')](util[_0x086f('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4cfec6['name'],_0x4cfec6['id']),util[_0x086f('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x1dd8bb(_0x36b695);});}else{return _0x1dd8bb(null,_0xa5e6f1);}},'beforeUpdate':function(_0x53c054,_0xcc30de,_0x1c93a4){if(_0x53c054['changed'](_0x086f('0xd'))||_0x53c054[_0x086f('0xc')]('serverUrl')||_0x53c054[_0x086f('0xc')](_0x086f('0xe'))||_0x53c054['changed'](_0x086f('0x1b'))||_0x53c054[_0x086f('0xc')](_0x086f('0xf'))||_0x53c054[_0x086f('0xc')](_0x086f('0x28'))){var _0x16197e,_0x13f2a6;_0x16197e=_0x53c054[_0x086f('0x1c')];var _0x55f0d6=_0x16197e[_0x086f('0x10')](-0x1);if(_0x55f0d6==='/'||_0x55f0d6==='\x5c'||_0x55f0d6===':'){_0x16197e=_0x16197e[_0x086f('0x11')](0x0,_0x16197e[_0x086f('0x12')](_0x55f0d6));}switch(_0x53c054[_0x086f('0xd')]){case'US':_0x13f2a6='https://accounts.zoho.com';break;case'AU':_0x13f2a6=_0x086f('0x14');break;case'IN':_0x13f2a6=_0x086f('0x15');break;case'CN':_0x13f2a6=_0x086f('0x16');break;default:_0x13f2a6=_0x086f('0x17');break;}var _0x424750={'method':_0x086f('0x18'),'uri':_0x13f2a6+_0x086f('0x19'),'form':{'grant_type':_0x086f('0x1a'),'client_id':_0x53c054[_0x086f('0xe')],'client_secret':_0x53c054[_0x086f('0x1b')],'redirect_uri':_0x53c054[_0x086f('0x1c')],'code':_0x53c054[_0x086f('0xf')]},'headers':{'Content-Type':_0x086f('0x1d')}};return rp(_0x424750)[_0x086f('0x29')](function(_0x361935){var _0x11a1f0=JSON[_0x086f('0x1e')](_0x361935);if(_0x11a1f0[_0x086f('0x1f')]){_0x53c054['refreshToken']=_0x11a1f0[_0x086f('0x1f')];logger[_0x086f('0x21')](util['format'](_0x086f('0x23'),_0x53c054[_0x086f('0x24')],_0x53c054['id']));}else{logger[_0x086f('0x27')](util[_0x086f('0x22')](_0x086f('0x25'),_0x53c054[_0x086f('0x24')],_0x53c054['id']),util[_0x086f('0x26')](_0x11a1f0,{'showHidden':![],'depth':null}));}return _0x1c93a4(null,_0xcc30de);})[_0x086f('0x2a')](function(_0xd83fc8){logger[_0x086f('0x27')](util[_0x086f('0x22')](_0x086f('0x25'),_0x53c054[_0x086f('0x24')],_0x53c054['id']),util[_0x086f('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x1c93a4(_0xd83fc8);});}else{return _0x1c93a4(null,_0xcc30de);}}}});}; \ No newline at end of file +var _0xde90=['ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','error','inspect','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','parse','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','zone','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','refreshToken','refresh_token','info','format'];(function(_0x14a0a0,_0x45d0cf){var _0x56b651=function(_0x1fae09){while(--_0x1fae09){_0x14a0a0['push'](_0x14a0a0['shift']());}};_0x56b651(++_0x45d0cf);}(_0xde90,0x137));var _0x0de9=function(_0x4ea571,_0x524bc2){_0x4ea571=_0x4ea571-0x0;var _0x122eba=_0xde90[_0x4ea571];return _0x122eba;};'use strict';var _=require('lodash');var util=require(_0x0de9('0x0'));var logger=require(_0x0de9('0x1'))('api');var moment=require(_0x0de9('0x2'));var BPromise=require(_0x0de9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0de9('0x4'));var rimraf=require(_0x0de9('0x5'));var config=require(_0x0de9('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x0de9('0x7'));module[_0x0de9('0x8')]=function(_0x3a2501,_0x32adbb){return _0x3a2501[_0x0de9('0x9')](_0x0de9('0xa'),attributes,{'tableName':_0x0de9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x19ae4b,_0xc9f477,_0xf1c0ed){if(_0x19ae4b['changed']('zone')||_0x19ae4b[_0x0de9('0xc')](_0x0de9('0xd'))||_0x19ae4b['changed'](_0x0de9('0xe'))||_0x19ae4b[_0x0de9('0xc')](_0x0de9('0xf'))||_0x19ae4b[_0x0de9('0xc')](_0x0de9('0x10'))||_0x19ae4b[_0x0de9('0xc')](_0x0de9('0x11'))){var _0x53701e,_0x3e49f2;_0x53701e=_0x19ae4b[_0x0de9('0xd')];var _0x4da08f=_0x53701e[_0x0de9('0x12')](-0x1);if(_0x4da08f==='/'||_0x4da08f==='\x5c'||_0x4da08f===':'){_0x53701e=_0x53701e[_0x0de9('0x13')](0x0,_0x53701e[_0x0de9('0x14')](_0x4da08f));}switch(_0x19ae4b[_0x0de9('0x15')]){case'US':_0x3e49f2='https://accounts.zoho.com';break;case'AU':_0x3e49f2='https://accounts.zoho.com.au';break;case'IN':_0x3e49f2='https://accounts.zoho.in';break;case'CN':_0x3e49f2=_0x0de9('0x16');break;default:_0x3e49f2=_0x0de9('0x17');break;}var _0x4886fe={'method':_0x0de9('0x18'),'uri':_0x3e49f2+_0x0de9('0x19'),'form':{'grant_type':_0x0de9('0x1a'),'client_id':_0x19ae4b['clientId'],'client_secret':_0x19ae4b[_0x0de9('0xf')],'redirect_uri':_0x19ae4b[_0x0de9('0xd')],'code':_0x19ae4b['code']},'headers':{'Content-Type':_0x0de9('0x1b')}};return rp(_0x4886fe)[_0x0de9('0x1c')](function(_0x527d65){var _0x2d0680=JSON['parse'](_0x527d65);if(_0x2d0680['refresh_token']){_0x19ae4b[_0x0de9('0x1d')]=_0x2d0680[_0x0de9('0x1e')];logger[_0x0de9('0x1f')](util[_0x0de9('0x20')](_0x0de9('0x21'),_0x19ae4b[_0x0de9('0x22')],_0x19ae4b['id']));}else{logger['error'](util['format'](_0x0de9('0x23'),_0x19ae4b[_0x0de9('0x22')],_0x19ae4b['id']),util['inspect'](_0x2d0680,{'showHidden':![],'depth':null}));}return _0xf1c0ed(null,_0xc9f477);})[_0x0de9('0x24')](function(_0x430e85){logger[_0x0de9('0x25')](util[_0x0de9('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x19ae4b['name'],_0x19ae4b['id']),util[_0x0de9('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0xf1c0ed(_0x430e85);});}else{return _0xf1c0ed(null,_0xc9f477);}},'beforeUpdate':function(_0x526f9e,_0x51ad77,_0x1f3778){if(_0x526f9e[_0x0de9('0xc')](_0x0de9('0x15'))||_0x526f9e[_0x0de9('0xc')](_0x0de9('0xd'))||_0x526f9e[_0x0de9('0xc')](_0x0de9('0xe'))||_0x526f9e[_0x0de9('0xc')](_0x0de9('0xf'))||_0x526f9e[_0x0de9('0xc')]('code')||_0x526f9e[_0x0de9('0xc')](_0x0de9('0x11'))){var _0x5bc8ab,_0x25d2dd;_0x5bc8ab=_0x526f9e[_0x0de9('0xd')];var _0x206c73=_0x5bc8ab[_0x0de9('0x12')](-0x1);if(_0x206c73==='/'||_0x206c73==='\x5c'||_0x206c73===':'){_0x5bc8ab=_0x5bc8ab[_0x0de9('0x13')](0x0,_0x5bc8ab[_0x0de9('0x14')](_0x206c73));}switch(_0x526f9e[_0x0de9('0x15')]){case'US':_0x25d2dd=_0x0de9('0x27');break;case'AU':_0x25d2dd=_0x0de9('0x28');break;case'IN':_0x25d2dd=_0x0de9('0x29');break;case'CN':_0x25d2dd=_0x0de9('0x16');break;default:_0x25d2dd=_0x0de9('0x17');break;}var _0xf91cf={'method':'POST','uri':_0x25d2dd+_0x0de9('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x526f9e[_0x0de9('0xe')],'client_secret':_0x526f9e[_0x0de9('0xf')],'redirect_uri':_0x526f9e[_0x0de9('0xd')],'code':_0x526f9e[_0x0de9('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0xf91cf)[_0x0de9('0x1c')](function(_0x1dff24){var _0x479f5b=JSON[_0x0de9('0x2a')](_0x1dff24);if(_0x479f5b['refresh_token']){_0x526f9e[_0x0de9('0x1d')]=_0x479f5b[_0x0de9('0x1e')];logger['info'](util[_0x0de9('0x20')](_0x0de9('0x21'),_0x526f9e[_0x0de9('0x22')],_0x526f9e['id']));}else{logger['error'](util['format'](_0x0de9('0x23'),_0x526f9e[_0x0de9('0x22')],_0x526f9e['id']),util[_0x0de9('0x26')](_0x479f5b,{'showHidden':![],'depth':null}));}return _0x1f3778(null,_0x51ad77);})[_0x0de9('0x24')](function(_0x53ee0c){logger[_0x0de9('0x25')](util[_0x0de9('0x20')](_0x0de9('0x23'),_0x526f9e[_0x0de9('0x22')],_0x526f9e['id']),util[_0x0de9('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x1f3778(_0x53ee0c);});}else{return _0x1f3778(null,_0x51ad77);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 02bc31c..72da490 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 _0xeff9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','then','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','attributes','limit','include','map','model','stringify','ShowZohoAccount','find','raw','where','lodash'];(function(_0x59cda7,_0x3a69fd){var _0x5eba04=function(_0xeb3d88){while(--_0xeb3d88){_0x59cda7['push'](_0x59cda7['shift']());}};_0x5eba04(++_0x3a69fd);}(_0xeff9,0x15d));var _0x9eff=function(_0x21f564,_0x26fcee){_0x21f564=_0x21f564-0x0;var _0x18cccf=_0xeff9[_0x21f564];return _0x18cccf;};'use strict';var _=require(_0x9eff('0x0'));var util=require(_0x9eff('0x1'));var moment=require(_0x9eff('0x2'));var BPromise=require(_0x9eff('0x3'));var rs=require(_0x9eff('0x4'));var fs=require('fs');var Redis=require(_0x9eff('0x5'));var db=require(_0x9eff('0x6'))['db'];var utils=require(_0x9eff('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9eff('0x8'));var client=jayson['client'][_0x9eff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47e99f,_0xab38,_0x1c515b){return new BPromise(function(_0x130d33,_0xa4c9){return client['request'](_0x47e99f,_0x1c515b)[_0x9eff('0xa')](function(_0x2804d5){logger['info'](_0x9eff('0xb'),_0xab38,'request\x20sent');logger[_0x9eff('0xc')](_0x9eff('0xd'),_0xab38,_0x9eff('0xe'),JSON['stringify'](_0x2804d5));if(_0x2804d5[_0x9eff('0xf')]){if(_0x2804d5[_0x9eff('0xf')][_0x9eff('0x10')]===0x1f4){logger[_0x9eff('0xf')](_0x9eff('0xb'),_0xab38,_0x2804d5[_0x9eff('0xf')][_0x9eff('0x11')]);return _0xa4c9(_0x2804d5[_0x9eff('0xf')][_0x9eff('0x11')]);}logger[_0x9eff('0xf')](_0x9eff('0xb'),_0xab38,_0x2804d5[_0x9eff('0xf')][_0x9eff('0x11')]);return _0x130d33(_0x2804d5[_0x9eff('0xf')][_0x9eff('0x11')]);}else{logger[_0x9eff('0x12')](_0x9eff('0xb'),_0xab38,_0x9eff('0xe'));_0x130d33(_0x2804d5[_0x9eff('0x13')]['message']);}})[_0x9eff('0x14')](function(_0x5e3306){logger[_0x9eff('0xf')](_0x9eff('0xb'),_0xab38,_0x5e3306);_0xa4c9(_0x5e3306);});});}exports[_0x9eff('0x15')]=function(_0x24f460){var _0x3aafbf=this;return new Promise(function(_0x1964a3,_0x9f5a0){return db[_0x9eff('0x16')][_0x9eff('0x17')]({'raw':_0x24f460['options']?_0x24f460[_0x9eff('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x24f460[_0x9eff('0x18')]?_0x24f460['options']['where']||null:null,'attributes':_0x24f460[_0x9eff('0x18')]?_0x24f460['options'][_0x9eff('0x19')]||null:null,'limit':_0x24f460[_0x9eff('0x18')]?_0x24f460[_0x9eff('0x18')][_0x9eff('0x1a')]||null:null,'include':_0x24f460[_0x9eff('0x18')]?_0x24f460[_0x9eff('0x18')][_0x9eff('0x1b')]?_[_0x9eff('0x1c')](_0x24f460[_0x9eff('0x18')][_0x9eff('0x1b')],function(_0x5d4ce9){return{'model':db[_0x5d4ce9['model']],'as':_0x5d4ce9['as'],'attributes':_0x5d4ce9['attributes'],'include':_0x5d4ce9['include']?_[_0x9eff('0x1c')](_0x5d4ce9['include'],function(_0x461b80){return{'model':db[_0x461b80[_0x9eff('0x1d')]],'as':_0x461b80['as'],'attributes':_0x461b80[_0x9eff('0x19')],'include':_0x461b80[_0x9eff('0x1b')]?_[_0x9eff('0x1c')](_0x461b80[_0x9eff('0x1b')],function(_0x4f9694){return{'model':db[_0x4f9694[_0x9eff('0x1d')]],'as':_0x4f9694['as'],'attributes':_0x4f9694[_0x9eff('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9eff('0xa')](function(_0x8ed0e1){logger[_0x9eff('0x12')](_0x9eff('0x15'),_0x24f460);logger['debug']('GetZohoAccount',_0x24f460,JSON[_0x9eff('0x1e')](_0x8ed0e1));_0x1964a3(_0x8ed0e1);})[_0x9eff('0x14')](function(_0x2a7de2){logger[_0x9eff('0xf')]('GetZohoAccount',_0x2a7de2[_0x9eff('0x11')],_0x24f460);_0x9f5a0(_0x3aafbf[_0x9eff('0xf')](0x1f4,_0x2a7de2[_0x9eff('0x11')]));});});};exports[_0x9eff('0x1f')]=function(_0x195503){var _0x30bb96=this;return new Promise(function(_0x1476a0,_0x9b73e6){return db[_0x9eff('0x16')][_0x9eff('0x20')]({'raw':_0x195503[_0x9eff('0x18')]?_0x195503[_0x9eff('0x18')][_0x9eff('0x21')]===undefined?!![]:![]:!![],'where':_0x195503[_0x9eff('0x18')]?_0x195503[_0x9eff('0x18')][_0x9eff('0x22')]||null:null,'attributes':_0x195503['options']?_0x195503[_0x9eff('0x18')][_0x9eff('0x19')]||null:null,'include':_0x195503['options']?_0x195503['options'][_0x9eff('0x1b')]?_['map'](_0x195503['options'][_0x9eff('0x1b')],function(_0x1a3d7e){return{'model':db[_0x1a3d7e[_0x9eff('0x1d')]],'as':_0x1a3d7e['as'],'attributes':_0x1a3d7e['attributes'],'include':_0x1a3d7e[_0x9eff('0x1b')]?_['map'](_0x1a3d7e['include'],function(_0x1ea392){return{'model':db[_0x1ea392[_0x9eff('0x1d')]],'as':_0x1ea392['as'],'attributes':_0x1ea392[_0x9eff('0x19')],'include':_0x1ea392[_0x9eff('0x1b')]?_[_0x9eff('0x1c')](_0x1ea392[_0x9eff('0x1b')],function(_0x35b5cd){return{'model':db[_0x35b5cd['model']],'as':_0x35b5cd['as'],'attributes':_0x35b5cd['attributes']};}):[]};}):[]};}):[]:[]})[_0x9eff('0xa')](function(_0x5aedd5){logger[_0x9eff('0x12')](_0x9eff('0x1f'),_0x195503);logger[_0x9eff('0xc')](_0x9eff('0x1f'),_0x195503,JSON[_0x9eff('0x1e')](_0x5aedd5));_0x1476a0(_0x5aedd5);})[_0x9eff('0x14')](function(_0x1a7d5b){logger[_0x9eff('0xf')](_0x9eff('0x1f'),_0x1a7d5b[_0x9eff('0x11')],_0x195503);_0x9b73e6(_0x30bb96[_0x9eff('0xf')](0x1f4,_0x1a7d5b[_0x9eff('0x11')]));});});}; \ No newline at end of file +var _0x7cdc=['client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetZohoAccount','ZohoAccount','options','raw','where','attributes','limit','include','map','model','debug','catch','find','ShowZohoAccount','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x2741ce,_0x4cd1c8){var _0x17560c=function(_0x3cda28){while(--_0x3cda28){_0x2741ce['push'](_0x2741ce['shift']());}};_0x17560c(++_0x4cd1c8);}(_0x7cdc,0x190));var _0xc7cd=function(_0x1a0054,_0x1b2e50){_0x1a0054=_0x1a0054-0x0;var _0x29c49a=_0x7cdc[_0x1a0054];return _0x29c49a;};'use strict';var _=require('lodash');var util=require(_0xc7cd('0x0'));var moment=require(_0xc7cd('0x1'));var BPromise=require('bluebird');var rs=require(_0xc7cd('0x2'));var fs=require('fs');var Redis=require(_0xc7cd('0x3'));var db=require(_0xc7cd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc7cd('0x5'))(_0xc7cd('0x6'));var config=require('../../config/environment');var jayson=require(_0xc7cd('0x7'));var client=jayson[_0xc7cd('0x8')][_0xc7cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c168c,_0x13ffeb,_0x30089e){return new BPromise(function(_0x42a4b8,_0x5b5d3d){return client[_0xc7cd('0xa')](_0x2c168c,_0x30089e)['then'](function(_0x36d8b9){logger[_0xc7cd('0xb')](_0xc7cd('0xc'),_0x13ffeb,_0xc7cd('0xd'));logger['debug'](_0xc7cd('0xe'),_0x13ffeb,_0xc7cd('0xd'),JSON[_0xc7cd('0xf')](_0x36d8b9));if(_0x36d8b9[_0xc7cd('0x10')]){if(_0x36d8b9['error'][_0xc7cd('0x11')]===0x1f4){logger['error'](_0xc7cd('0xc'),_0x13ffeb,_0x36d8b9[_0xc7cd('0x10')][_0xc7cd('0x12')]);return _0x5b5d3d(_0x36d8b9[_0xc7cd('0x10')]['message']);}logger[_0xc7cd('0x10')](_0xc7cd('0xc'),_0x13ffeb,_0x36d8b9['error'][_0xc7cd('0x12')]);return _0x42a4b8(_0x36d8b9['error'][_0xc7cd('0x12')]);}else{logger['info'](_0xc7cd('0xc'),_0x13ffeb,_0xc7cd('0xd'));_0x42a4b8(_0x36d8b9[_0xc7cd('0x13')][_0xc7cd('0x12')]);}})['catch'](function(_0x211e6d){logger[_0xc7cd('0x10')](_0xc7cd('0xc'),_0x13ffeb,_0x211e6d);_0x5b5d3d(_0x211e6d);});});}exports[_0xc7cd('0x14')]=function(_0xe93ad5){var _0x2eca03=this;return new Promise(function(_0x2d5825,_0x2d11e4){return db[_0xc7cd('0x15')]['findAll']({'raw':_0xe93ad5[_0xc7cd('0x16')]?_0xe93ad5['options'][_0xc7cd('0x17')]===undefined?!![]:![]:!![],'where':_0xe93ad5[_0xc7cd('0x16')]?_0xe93ad5[_0xc7cd('0x16')][_0xc7cd('0x18')]||null:null,'attributes':_0xe93ad5[_0xc7cd('0x16')]?_0xe93ad5['options'][_0xc7cd('0x19')]||null:null,'limit':_0xe93ad5[_0xc7cd('0x16')]?_0xe93ad5[_0xc7cd('0x16')][_0xc7cd('0x1a')]||null:null,'include':_0xe93ad5['options']?_0xe93ad5[_0xc7cd('0x16')][_0xc7cd('0x1b')]?_[_0xc7cd('0x1c')](_0xe93ad5[_0xc7cd('0x16')]['include'],function(_0x4e47b0){return{'model':db[_0x4e47b0['model']],'as':_0x4e47b0['as'],'attributes':_0x4e47b0[_0xc7cd('0x19')],'include':_0x4e47b0['include']?_[_0xc7cd('0x1c')](_0x4e47b0[_0xc7cd('0x1b')],function(_0x2932fe){return{'model':db[_0x2932fe[_0xc7cd('0x1d')]],'as':_0x2932fe['as'],'attributes':_0x2932fe[_0xc7cd('0x19')],'include':_0x2932fe[_0xc7cd('0x1b')]?_['map'](_0x2932fe[_0xc7cd('0x1b')],function(_0x33c1ca){return{'model':db[_0x33c1ca[_0xc7cd('0x1d')]],'as':_0x33c1ca['as'],'attributes':_0x33c1ca[_0xc7cd('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x325792){logger[_0xc7cd('0xb')](_0xc7cd('0x14'),_0xe93ad5);logger[_0xc7cd('0x1e')]('GetZohoAccount',_0xe93ad5,JSON[_0xc7cd('0xf')](_0x325792));_0x2d5825(_0x325792);})[_0xc7cd('0x1f')](function(_0x5ab9a2){logger['error'](_0xc7cd('0x14'),_0x5ab9a2[_0xc7cd('0x12')],_0xe93ad5);_0x2d11e4(_0x2eca03[_0xc7cd('0x10')](0x1f4,_0x5ab9a2[_0xc7cd('0x12')]));});});};exports['ShowZohoAccount']=function(_0x1d5d4c){var _0x82be3=this;return new Promise(function(_0x5ed4d5,_0x1b7f72){return db['ZohoAccount'][_0xc7cd('0x20')]({'raw':_0x1d5d4c[_0xc7cd('0x16')]?_0x1d5d4c[_0xc7cd('0x16')][_0xc7cd('0x17')]===undefined?!![]:![]:!![],'where':_0x1d5d4c[_0xc7cd('0x16')]?_0x1d5d4c[_0xc7cd('0x16')][_0xc7cd('0x18')]||null:null,'attributes':_0x1d5d4c[_0xc7cd('0x16')]?_0x1d5d4c['options']['attributes']||null:null,'include':_0x1d5d4c[_0xc7cd('0x16')]?_0x1d5d4c['options']['include']?_[_0xc7cd('0x1c')](_0x1d5d4c[_0xc7cd('0x16')][_0xc7cd('0x1b')],function(_0x1b8e7b){return{'model':db[_0x1b8e7b['model']],'as':_0x1b8e7b['as'],'attributes':_0x1b8e7b[_0xc7cd('0x19')],'include':_0x1b8e7b[_0xc7cd('0x1b')]?_[_0xc7cd('0x1c')](_0x1b8e7b[_0xc7cd('0x1b')],function(_0x1bf7e3){return{'model':db[_0x1bf7e3['model']],'as':_0x1bf7e3['as'],'attributes':_0x1bf7e3[_0xc7cd('0x19')],'include':_0x1bf7e3[_0xc7cd('0x1b')]?_['map'](_0x1bf7e3[_0xc7cd('0x1b')],function(_0x3fcec9){return{'model':db[_0x3fcec9[_0xc7cd('0x1d')]],'as':_0x3fcec9['as'],'attributes':_0x3fcec9[_0xc7cd('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15092c){logger[_0xc7cd('0xb')](_0xc7cd('0x21'),_0x1d5d4c);logger[_0xc7cd('0x1e')](_0xc7cd('0x21'),_0x1d5d4c,JSON[_0xc7cd('0xf')](_0x15092c));_0x5ed4d5(_0x15092c);})[_0xc7cd('0x1f')](function(_0x1a2f34){logger[_0xc7cd('0x10')](_0xc7cd('0x21'),_0x1a2f34['message'],_0x1d5d4c);_0x1b7f72(_0x82be3[_0xc7cd('0x10')](0x1f4,_0x1a2f34['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 4aeaea4..09c99ba 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 _0x0833=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../config/environment','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0833,0x1bd));var _0x3083=function(_0xa495c4,_0x5837e2){_0xa495c4=_0xa495c4-0x0;var _0x492bd9=_0x0833[_0xa495c4];return _0x492bd9;};'use strict';var multer=require(_0x3083('0x0'));var util=require(_0x3083('0x1'));var path=require(_0x3083('0x2'));var timeout=require(_0x3083('0x3'));var express=require(_0x3083('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3083('0x5'));var controller=require('./intZohoConfiguration.controller');router[_0x3083('0x6')]('/',auth[_0x3083('0x7')](),controller[_0x3083('0x8')]);router['get'](_0x3083('0x9'),auth[_0x3083('0x7')](),controller['show']);router['get']('/:id/fields',auth[_0x3083('0x7')](),controller['getFields']);router['get'](_0x3083('0xa'),auth[_0x3083('0x7')](),controller[_0x3083('0xb')]);router[_0x3083('0x6')](_0x3083('0xc'),auth[_0x3083('0x7')](),controller[_0x3083('0xd')]);router[_0x3083('0xe')]('/',auth[_0x3083('0x7')](),controller[_0x3083('0xf')]);router[_0x3083('0x10')](_0x3083('0x9'),auth[_0x3083('0x7')](),controller[_0x3083('0x11')]);router[_0x3083('0x12')]('/:id',auth[_0x3083('0x7')](),controller[_0x3083('0x13')]);module['exports']=router; \ No newline at end of file +var _0xd10f=['../../components/interaction/service','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0xe2ebaa,_0x138483){var _0x563838=function(_0x542a4c){while(--_0x542a4c){_0xe2ebaa['push'](_0xe2ebaa['shift']());}};_0x563838(++_0x138483);}(_0xd10f,0x198));var _0xfd10=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd10f[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xfd10('0x0'));var util=require(_0xfd10('0x1'));var path=require(_0xfd10('0x2'));var timeout=require(_0xfd10('0x3'));var express=require(_0xfd10('0x4'));var router=express['Router']();var auth=require(_0xfd10('0x5'));var interaction=require(_0xfd10('0x6'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0xfd10('0x7')]('/',auth[_0xfd10('0x8')](),controller[_0xfd10('0x9')]);router[_0xfd10('0x7')](_0xfd10('0xa'),auth[_0xfd10('0x8')](),controller[_0xfd10('0xb')]);router[_0xfd10('0x7')]('/:id/fields',auth[_0xfd10('0x8')](),controller[_0xfd10('0xc')]);router['get'](_0xfd10('0xd'),auth[_0xfd10('0x8')](),controller[_0xfd10('0xe')]);router[_0xfd10('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xfd10('0xf')]);router[_0xfd10('0x10')]('/',auth['isAuthenticated'](),controller[_0xfd10('0x11')]);router[_0xfd10('0x12')](_0xfd10('0xa'),auth[_0xfd10('0x8')](),controller[_0xfd10('0x13')]);router[_0xfd10('0x14')](_0xfd10('0xa'),auth[_0xfd10('0x8')](),controller[_0xfd10('0x15')]);module[_0xfd10('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 6f5ffce..10c111f 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 _0x2bb8=['contact_lead','contact','sequelize','STRING','ENUM','lead','nothing'];(function(_0x2aa23f,_0x2d7180){var _0x212263=function(_0x6add70){while(--_0x6add70){_0x2aa23f['push'](_0x2aa23f['shift']());}};_0x212263(++_0x2d7180);}(_0x2bb8,0x80));var _0x82bb=function(_0x4a477c,_0x5e7cdd){_0x4a477c=_0x4a477c-0x0;var _0x21e003=_0x2bb8[_0x4a477c];return _0x21e003;};'use strict';var Sequelize=require(_0x82bb('0x0'));module['exports']={'name':{'type':Sequelize[_0x82bb('0x1')]},'moduleCreate':{'type':Sequelize[_0x82bb('0x2')](_0x82bb('0x3'),'contact',_0x82bb('0x4')),'defaultValue':_0x82bb('0x3')},'moduleSearch':{'type':Sequelize[_0x82bb('0x2')](_0x82bb('0x5'),_0x82bb('0x6'),'lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x82bb('0x1')]}}; \ No newline at end of file +var _0xc38b=['ENUM','lead','nothing','contact_lead','exports','STRING'];(function(_0x30413a,_0x2120da){var _0x33f109=function(_0x4b00af){while(--_0x4b00af){_0x30413a['push'](_0x30413a['shift']());}};_0x33f109(++_0x2120da);}(_0xc38b,0x1f0));var _0xbc38=function(_0x14cd41,_0x34c058){_0x14cd41=_0x14cd41-0x0;var _0x344af3=_0xc38b[_0x14cd41];return _0x344af3;};'use strict';var Sequelize=require('sequelize');module[_0xbc38('0x0')]={'name':{'type':Sequelize[_0xbc38('0x1')]},'moduleCreate':{'type':Sequelize[_0xbc38('0x2')](_0xbc38('0x3'),'contact',_0xbc38('0x4')),'defaultValue':_0xbc38('0x3')},'moduleSearch':{'type':Sequelize[_0xbc38('0x2')](_0xbc38('0x5'),'contact','lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xbc38('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index d544fe2..8e2584a 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(_0x30f07a,_0x98341){var _0xb38461=function(_0x7b287a){while(--_0x7b287a){_0x30f07a['push'](_0x30f07a['shift']());}};_0xb38461(++_0x98341);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 e739200..2ce88d5 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 _0x11e3=['lodash','util','api','moment','bluebird','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x11e3,0x14a));var _0x311e=function(_0x2e1177,_0x24e0cd){_0x2e1177=_0x2e1177-0x0;var _0x1d407c=_0x11e3[_0x2e1177];return _0x1d407c;};'use strict';var _=require(_0x311e('0x0'));var util=require(_0x311e('0x1'));var logger=require('../../config/logger')(_0x311e('0x2'));var moment=require(_0x311e('0x3'));var BPromise=require(_0x311e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x311e('0x5'));var config=require(_0x311e('0x6'));var attributes=require(_0x311e('0x7'));module[_0x311e('0x8')]=function(_0x288e63,_0x45098a){return _0x288e63['define'](_0x311e('0x9'),attributes,{'tableName':_0x311e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4a3=['moment','bluebird','request-promise','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','api'];(function(_0x369bd0,_0x18c34a){var _0x3a2f24=function(_0x4b1878){while(--_0x4b1878){_0x369bd0['push'](_0x369bd0['shift']());}};_0x3a2f24(++_0x18c34a);}(_0xa4a3,0x6b));var _0x3a4a=function(_0x5bc440,_0x2b6060){_0x5bc440=_0x5bc440-0x0;var _0x422868=_0xa4a3[_0x5bc440];return _0x422868;};'use strict';var _=require(_0x3a4a('0x0'));var util=require('util');var logger=require(_0x3a4a('0x1'))(_0x3a4a('0x2'));var moment=require(_0x3a4a('0x3'));var BPromise=require(_0x3a4a('0x4'));var rp=require(_0x3a4a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3a4a('0x6'));var attributes=require(_0x3a4a('0x7'));module['exports']=function(_0x2ea7fe,_0x50c1fe){return _0x2ea7fe[_0x3a4a('0x8')](_0x3a4a('0x9'),attributes,{'tableName':_0x3a4a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index a1b9ef8..ca72a15 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 _0x9e8c=['debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x4f3b10,_0x35cc88){var _0x454404=function(_0x28fecf){while(--_0x28fecf){_0x4f3b10['push'](_0x4f3b10['shift']());}};_0x454404(++_0x35cc88);}(_0x9e8c,0x142));var _0xc9e8=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9e8c[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xc9e8('0x0'));var util=require(_0xc9e8('0x1'));var moment=require(_0xc9e8('0x2'));var BPromise=require('bluebird');var rs=require(_0xc9e8('0x3'));var fs=require('fs');var Redis=require(_0xc9e8('0x4'));var db=require(_0xc9e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc9e8('0x6'))('rpc');var config=require(_0xc9e8('0x7'));var jayson=require(_0xc9e8('0x8'));var client=jayson['client'][_0xc9e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x158f5e,_0x510473,_0x50b6de){return new BPromise(function(_0x4e3dc7,_0x358004){return client['request'](_0x158f5e,_0x50b6de)[_0xc9e8('0xa')](function(_0x3f8895){logger[_0xc9e8('0xb')](_0xc9e8('0xc'),_0x510473,_0xc9e8('0xd'));logger[_0xc9e8('0xe')](_0xc9e8('0xf'),_0x510473,_0xc9e8('0xd'),JSON[_0xc9e8('0x10')](_0x3f8895));if(_0x3f8895['error']){if(_0x3f8895[_0xc9e8('0x11')][_0xc9e8('0x12')]===0x1f4){logger[_0xc9e8('0x11')](_0xc9e8('0xc'),_0x510473,_0x3f8895[_0xc9e8('0x11')][_0xc9e8('0x13')]);return _0x358004(_0x3f8895[_0xc9e8('0x11')][_0xc9e8('0x13')]);}logger[_0xc9e8('0x11')](_0xc9e8('0xc'),_0x510473,_0x3f8895[_0xc9e8('0x11')][_0xc9e8('0x13')]);return _0x4e3dc7(_0x3f8895[_0xc9e8('0x11')][_0xc9e8('0x13')]);}else{logger['info'](_0xc9e8('0xc'),_0x510473,_0xc9e8('0xd'));_0x4e3dc7(_0x3f8895['result'][_0xc9e8('0x13')]);}})[_0xc9e8('0x14')](function(_0x576e26){logger[_0xc9e8('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x510473,_0x576e26);_0x358004(_0x576e26);});});} \ No newline at end of file +var _0xd4e3=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','moment','bluebird','randomstring'];(function(_0x55a618,_0x52c67c){var _0xdc2923=function(_0x3343a9){while(--_0x3343a9){_0x55a618['push'](_0x55a618['shift']());}};_0xdc2923(++_0x52c67c);}(_0xd4e3,0x101));var _0x3d4e=function(_0x2d05cf,_0x58750d){_0x2d05cf=_0x2d05cf-0x0;var _0x36421a=_0xd4e3[_0x2d05cf];return _0x36421a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3d4e('0x0'));var BPromise=require(_0x3d4e('0x1'));var rs=require(_0x3d4e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d4e('0x3'))['db'];var utils=require(_0x3d4e('0x4'));var logger=require(_0x3d4e('0x5'))(_0x3d4e('0x6'));var config=require(_0x3d4e('0x7'));var jayson=require(_0x3d4e('0x8'));var client=jayson[_0x3d4e('0x9')][_0x3d4e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fd496,_0x3a6ec5,_0x536a52){return new BPromise(function(_0x4d6767,_0xfb1068){return client[_0x3d4e('0xb')](_0x3fd496,_0x536a52)[_0x3d4e('0xc')](function(_0x394942){logger['info'](_0x3d4e('0xd'),_0x3a6ec5,_0x3d4e('0xe'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3a6ec5,_0x3d4e('0xe'),JSON[_0x3d4e('0xf')](_0x394942));if(_0x394942['error']){if(_0x394942['error']['code']===0x1f4){logger[_0x3d4e('0x10')](_0x3d4e('0xd'),_0x3a6ec5,_0x394942['error'][_0x3d4e('0x11')]);return _0xfb1068(_0x394942[_0x3d4e('0x10')][_0x3d4e('0x11')]);}logger[_0x3d4e('0x10')](_0x3d4e('0xd'),_0x3a6ec5,_0x394942[_0x3d4e('0x10')][_0x3d4e('0x11')]);return _0x4d6767(_0x394942['error'][_0x3d4e('0x11')]);}else{logger['info'](_0x3d4e('0xd'),_0x3a6ec5,_0x3d4e('0xe'));_0x4d6767(_0x394942[_0x3d4e('0x12')][_0x3d4e('0x11')]);}})[_0x3d4e('0x13')](function(_0x437a55){logger['error'](_0x3d4e('0xd'),_0x3a6ec5,_0x437a55);_0xfb1068(_0x437a55);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index e4d5005..7b4aba3 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 _0x5430=['express','Router','../../config/environment','isAuthenticated','index','get','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x48f2fb,_0x4b7474){var _0x58ff62=function(_0x449cd0){while(--_0x449cd0){_0x48f2fb['push'](_0x48f2fb['shift']());}};_0x58ff62(++_0x4b7474);}(_0x5430,0x10c));var _0x0543=function(_0x336af9,_0x2f20f0){_0x336af9=_0x336af9-0x0;var _0x39ae53=_0x5430[_0x336af9];return _0x39ae53;};'use strict';var multer=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var path=require(_0x0543('0x2'));var timeout=require(_0x0543('0x3'));var express=require(_0x0543('0x4'));var router=express[_0x0543('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0543('0x6'));var controller=require('./intZohoField.controller');router['get']('/',auth[_0x0543('0x7')](),controller[_0x0543('0x8')]);router[_0x0543('0x9')](_0x0543('0xa'),auth[_0x0543('0x7')](),controller['show']);router[_0x0543('0xb')]('/',auth[_0x0543('0x7')](),controller[_0x0543('0xc')]);router[_0x0543('0xd')](_0x0543('0xa'),auth[_0x0543('0x7')](),controller['update']);router[_0x0543('0xe')](_0x0543('0xa'),auth['isAuthenticated'](),controller[_0x0543('0xf')]);module[_0x0543('0x10')]=router; \ No newline at end of file +var _0x9582=['show','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id'];(function(_0x153817,_0xaff548){var _0x2c5c33=function(_0x366a3a){while(--_0x366a3a){_0x153817['push'](_0x153817['shift']());}};_0x2c5c33(++_0xaff548);}(_0x9582,0x95));var _0x2958=function(_0x4e76cc,_0x5b8848){_0x4e76cc=_0x4e76cc-0x0;var _0x57cfc4=_0x9582[_0x4e76cc];return _0x57cfc4;};'use strict';var multer=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var path=require(_0x2958('0x2'));var timeout=require(_0x2958('0x3'));var express=require(_0x2958('0x4'));var router=express[_0x2958('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2958('0x6'));var config=require(_0x2958('0x7'));var controller=require(_0x2958('0x8'));router[_0x2958('0x9')]('/',auth[_0x2958('0xa')](),controller[_0x2958('0xb')]);router[_0x2958('0x9')](_0x2958('0xc'),auth[_0x2958('0xa')](),controller[_0x2958('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2958('0xe')]);router['put'](_0x2958('0xc'),auth['isAuthenticated'](),controller[_0x2958('0xf')]);router['delete'](_0x2958('0xc'),auth[_0x2958('0xa')](),controller[_0x2958('0x10')]);module[_0x2958('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 0022628..284b15a 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 _0x58f4=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x3a0a39,_0x464113){var _0x26cca9=function(_0x1f9d06){while(--_0x1f9d06){_0x3a0a39['push'](_0x3a0a39['shift']());}};_0x26cca9(++_0x464113);}(_0x58f4,0x1b2));var _0x458f=function(_0x440f31,_0x3db2c6){_0x440f31=_0x440f31-0x0;var _0x22e95c=_0x58f4[_0x440f31];return _0x22e95c;};'use strict';var Sequelize=require('sequelize');module[_0x458f('0x0')]={'type':{'type':Sequelize[_0x458f('0x1')](_0x458f('0x2'),_0x458f('0x3'),_0x458f('0x4'),_0x458f('0x5')),'defaultValue':_0x458f('0x2')},'content':{'type':Sequelize[_0x458f('0x6')]},'key':{'type':Sequelize[_0x458f('0x6')]},'keyType':{'type':Sequelize[_0x458f('0x1')](_0x458f('0x2'),_0x458f('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x458f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x458f('0x6')]}}; \ No newline at end of file +var _0xfcda=['sequelize','exports','string','STRING','ENUM','variable','customVariable','BOOLEAN'];(function(_0x50e2e6,_0x3cba1a){var _0x125ab9=function(_0x102c48){while(--_0x102c48){_0x50e2e6['push'](_0x50e2e6['shift']());}};_0x125ab9(++_0x3cba1a);}(_0xfcda,0x198));var _0xafcd=function(_0x5ac5c7,_0x3e5ecd){_0x5ac5c7=_0x5ac5c7-0x0;var _0x1eede1=_0xfcda[_0x5ac5c7];return _0x1eede1;};'use strict';var Sequelize=require(_0xafcd('0x0'));module[_0xafcd('0x1')]={'type':{'type':Sequelize['ENUM'](_0xafcd('0x2'),'variable','customVariable','keyValue'),'defaultValue':_0xafcd('0x2')},'content':{'type':Sequelize[_0xafcd('0x3')]},'key':{'type':Sequelize[_0xafcd('0x3')]},'keyType':{'type':Sequelize[_0xafcd('0x4')](_0xafcd('0x2'),_0xafcd('0x5'),_0xafcd('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xafcd('0x3')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xafcd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xafcd('0x3')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 52cc8de..f601152 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 _0x1953=['order','sort','where','filters','filter','merge','VIRTUAL','options','ZohoField','includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','update','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','then','sendStatus','stack','name','send','map','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1953,0x1ad));var _0x3195=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x1953[_0x465028];return _0xb783d4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3195('0x0'));var zipdir=require(_0x3195('0x1'));var jsonpatch=require(_0x3195('0x2'));var rp=require(_0x3195('0x3'));var moment=require('moment');var BPromise=require(_0x3195('0x4'));var Mustache=require(_0x3195('0x5'));var util=require(_0x3195('0x6'));var path=require('path');var sox=require(_0x3195('0x7'));var csv=require(_0x3195('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3195('0x9'));var squel=require(_0x3195('0xa'));var crypto=require(_0x3195('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3195('0xc'));var toCsv=require(_0x3195('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3195('0xd'));var authService=require(_0x3195('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3195('0xf'))(_0x3195('0x10'));var utils=require(_0x3195('0x11'));var config=require(_0x3195('0x12'));var licenseUtil=require(_0x3195('0x13'));var db=require(_0x3195('0x14'))['db'];function respondWithStatusCode(_0x2e4abf,_0x134ce6){_0x134ce6=_0x134ce6||0xcc;return function(_0x313d4a){if(_0x313d4a){return _0x2e4abf['sendStatus'](_0x134ce6);}return _0x2e4abf[_0x3195('0x15')](_0x134ce6)[_0x3195('0x16')]();};}function respondWithResult(_0x8a8052,_0x49ff82){_0x49ff82=_0x49ff82||0xc8;return function(_0x239ed5){if(_0x239ed5){return _0x8a8052['status'](_0x49ff82)[_0x3195('0x17')](_0x239ed5);}};}function respondWithFilteredResult(_0x530c3f,_0xcb7480){return function(_0x59c53c){if(_0x59c53c){var _0x1ce702=_0x59c53c[_0x3195('0x18')],_0x38d865=_0xcb7480[_0x3195('0x19')],_0x29715c=_0xcb7480[_0x3195('0x19')]+_0xcb7480[_0x3195('0x1a')],_0x29102c;if(_0x29715c>=_0x1ce702){_0x29715c=_0x1ce702;_0x29102c=0xc8;}else{_0x29102c=0xce;}_0x530c3f[_0x3195('0x15')](_0x29102c);return _0x530c3f[_0x3195('0x1b')](_0x3195('0x1c'),_0x38d865+'-'+_0x29715c+'/'+_0x1ce702)[_0x3195('0x17')](_0x59c53c);}return null;};}function patchUpdates(_0x4da53f){return function(_0x1b1cb8){try{jsonpatch[_0x3195('0x1d')](_0x1b1cb8,_0x4da53f,!![]);}catch(_0x37daf0){return BPromise['reject'](_0x37daf0);}return _0x1b1cb8['save']();};}function saveUpdates(_0x3d7ee2,_0xcc4eeb){return function(_0x4cb927){if(_0x4cb927){return _0x4cb927['update'](_0x3d7ee2)[_0x3195('0x1e')](function(_0x76bd7b){return _0x76bd7b;});}return null;};}function removeEntity(_0x4f3f1c,_0x3493ac){return function(_0x1c0a58){if(_0x1c0a58){return _0x1c0a58['destroy']()[_0x3195('0x1e')](function(){_0x4f3f1c[_0x3195('0x15')](0xcc)[_0x3195('0x16')]();});}};}function handleEntityNotFound(_0x45993f,_0x49c42a){return function(_0xaf42df){if(!_0xaf42df){_0x45993f[_0x3195('0x1f')](0x194);}return _0xaf42df;};}function handleError(_0x6b0152,_0x381cf9){_0x381cf9=_0x381cf9||0x1f4;return function(_0x2e0675){logger['error'](_0x2e0675[_0x3195('0x20')]);if(_0x2e0675[_0x3195('0x21')]){delete _0x2e0675[_0x3195('0x21')];}_0x6b0152[_0x3195('0x15')](_0x381cf9)[_0x3195('0x22')](_0x2e0675);};}exports['index']=function(_0x5e6e1a,_0x474732){var _0x25e47e={},_0x482441={},_0xf686b={'count':0x0,'rows':[]};var _0x2c97d5=_[_0x3195('0x23')](db['ZohoField']['rawAttributes'],function(_0x13f70d){return{'name':_0x13f70d['fieldName'],'type':_0x13f70d[_0x3195('0x24')][_0x3195('0x25')]};});_0x482441[_0x3195('0x26')]=_['map'](_0x2c97d5,_0x3195('0x21'));_0x482441[_0x3195('0x27')]=_[_0x3195('0x28')](_0x5e6e1a[_0x3195('0x27')]);_0x482441['filters']=_['intersection'](_0x482441['model'],_0x482441['query']);_0x25e47e[_0x3195('0x29')]=_[_0x3195('0x2a')](_0x482441[_0x3195('0x26')],qs['fields'](_0x5e6e1a[_0x3195('0x27')][_0x3195('0x2b')]));_0x25e47e[_0x3195('0x29')]=_0x25e47e[_0x3195('0x29')][_0x3195('0x2c')]?_0x25e47e[_0x3195('0x29')]:_0x482441[_0x3195('0x26')];if(!_0x5e6e1a['query'][_0x3195('0x2d')](_0x3195('0x2e'))){_0x25e47e[_0x3195('0x1a')]=qs[_0x3195('0x1a')](_0x5e6e1a[_0x3195('0x27')]['limit']);_0x25e47e[_0x3195('0x19')]=qs[_0x3195('0x19')](_0x5e6e1a[_0x3195('0x27')]['offset']);}_0x25e47e[_0x3195('0x2f')]=qs[_0x3195('0x30')](_0x5e6e1a[_0x3195('0x27')][_0x3195('0x30')]);_0x25e47e[_0x3195('0x31')]=qs[_0x3195('0x32')](_['pick'](_0x5e6e1a[_0x3195('0x27')],_0x482441[_0x3195('0x32')]),_0x2c97d5);if(_0x5e6e1a['query'][_0x3195('0x33')]){_0x25e47e[_0x3195('0x31')]=_[_0x3195('0x34')](_0x25e47e[_0x3195('0x31')],{'$or':_[_0x3195('0x23')](_0x2c97d5,function(_0x206f5b){if(_0x206f5b[_0x3195('0x24')]!==_0x3195('0x35')){var _0xdc36d2={};_0xdc36d2[_0x206f5b['name']]={'$like':'%'+_0x5e6e1a[_0x3195('0x27')][_0x3195('0x33')]+'%'};return _0xdc36d2;}})});}_0x25e47e=_[_0x3195('0x34')]({},_0x25e47e,_0x5e6e1a[_0x3195('0x36')]);var _0x305ea0={'where':_0x25e47e[_0x3195('0x31')]};return db[_0x3195('0x37')][_0x3195('0x18')](_0x305ea0)[_0x3195('0x1e')](function(_0x3f424d){_0xf686b[_0x3195('0x18')]=_0x3f424d;if(_0x5e6e1a['query'][_0x3195('0x38')]){_0x25e47e[_0x3195('0x39')]=[{'all':!![]}];}return db['ZohoField'][_0x3195('0x3a')](_0x25e47e);})[_0x3195('0x1e')](function(_0x11208e){_0xf686b[_0x3195('0x3b')]=_0x11208e;return _0xf686b;})[_0x3195('0x1e')](respondWithFilteredResult(_0x474732,_0x25e47e))[_0x3195('0x3c')](handleError(_0x474732,null));};exports['show']=function(_0x3d9cf2,_0x106ffd){var _0xd0aba6={'raw':!![],'where':{'id':_0x3d9cf2[_0x3195('0x3d')]['id']}},_0x3b0bf0={};_0x3b0bf0['model']=_[_0x3195('0x28')](db['ZohoField'][_0x3195('0x3e')]);_0x3b0bf0['query']=_[_0x3195('0x28')](_0x3d9cf2[_0x3195('0x27')]);_0x3b0bf0['filters']=_[_0x3195('0x2a')](_0x3b0bf0[_0x3195('0x26')],_0x3b0bf0[_0x3195('0x27')]);_0xd0aba6['attributes']=_[_0x3195('0x2a')](_0x3b0bf0['model'],qs[_0x3195('0x2b')](_0x3d9cf2[_0x3195('0x27')]['fields']));_0xd0aba6[_0x3195('0x29')]=_0xd0aba6[_0x3195('0x29')][_0x3195('0x2c')]?_0xd0aba6[_0x3195('0x29')]:_0x3b0bf0[_0x3195('0x26')];if(_0x3d9cf2[_0x3195('0x27')][_0x3195('0x38')]){_0xd0aba6['include']=[{'all':!![]}];}_0xd0aba6=_[_0x3195('0x34')]({},_0xd0aba6,_0x3d9cf2[_0x3195('0x36')]);return db[_0x3195('0x37')]['find'](_0xd0aba6)[_0x3195('0x1e')](handleEntityNotFound(_0x106ffd,null))[_0x3195('0x1e')](respondWithResult(_0x106ffd,null))[_0x3195('0x3c')](handleError(_0x106ffd,null));};exports[_0x3195('0x3f')]=function(_0x320a8a,_0x1db218){return db[_0x3195('0x37')][_0x3195('0x3f')](_0x320a8a[_0x3195('0x40')],{})[_0x3195('0x1e')](respondWithResult(_0x1db218,0xc9))[_0x3195('0x3c')](handleError(_0x1db218,null));};exports[_0x3195('0x41')]=function(_0x11ea7b,_0x1a8767){if(_0x11ea7b['body']['id']){delete _0x11ea7b[_0x3195('0x40')]['id'];}return db[_0x3195('0x37')][_0x3195('0x42')]({'where':{'id':_0x11ea7b[_0x3195('0x3d')]['id']}})[_0x3195('0x1e')](handleEntityNotFound(_0x1a8767,null))[_0x3195('0x1e')](saveUpdates(_0x11ea7b[_0x3195('0x40')],null))[_0x3195('0x1e')](respondWithResult(_0x1a8767,null))[_0x3195('0x3c')](handleError(_0x1a8767,null));};exports[_0x3195('0x43')]=function(_0x29f8d5,_0x40f3b7){return db['ZohoField'][_0x3195('0x42')]({'where':{'id':_0x29f8d5[_0x3195('0x3d')]['id']}})['then'](handleEntityNotFound(_0x40f3b7,null))[_0x3195('0x1e')](removeEntity(_0x40f3b7,null))['catch'](handleError(_0x40f3b7,null));}; \ No newline at end of file +var _0x088c=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','fields','includeAll','find','create','body','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','length','attributes'];(function(_0x5bf420,_0x2d068d){var _0x1c5255=function(_0x4964a2){while(--_0x4964a2){_0x5bf420['push'](_0x5bf420['shift']());}};_0x1c5255(++_0x2d068d);}(_0x088c,0x1ca));var _0xc088=function(_0x3736f2,_0x5d819a){_0x3736f2=_0x3736f2-0x0;var _0x7150df=_0x088c[_0x3736f2];return _0x7150df;};'use strict';var pdf=require(_0xc088('0x0'));var emlformat=require(_0xc088('0x1'));var rimraf=require(_0xc088('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc088('0x3'));var rp=require(_0xc088('0x4'));var moment=require(_0xc088('0x5'));var BPromise=require(_0xc088('0x6'));var Mustache=require(_0xc088('0x7'));var util=require('util');var path=require(_0xc088('0x8'));var sox=require('sox');var csv=require(_0xc088('0x9'));var ejs=require(_0xc088('0xa'));var fs=require('fs');var _=require(_0xc088('0xb'));var squel=require(_0xc088('0xc'));var crypto=require('crypto');var jsforce=require(_0xc088('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc088('0x9'));var querystring=require(_0xc088('0xe'));var Papa=require(_0xc088('0xf'));var Redis=require('ioredis');var authService=require(_0xc088('0x10'));var qs=require(_0xc088('0x11'));var as=require(_0xc088('0x12'));var hardwareService=require(_0xc088('0x13'));var logger=require(_0xc088('0x14'))(_0xc088('0x15'));var utils=require(_0xc088('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc088('0x17'))['db'];function respondWithStatusCode(_0x1ab6e6,_0xc7cc25){_0xc7cc25=_0xc7cc25||0xcc;return function(_0x4d0897){if(_0x4d0897){return _0x1ab6e6[_0xc088('0x18')](_0xc7cc25);}return _0x1ab6e6['status'](_0xc7cc25)[_0xc088('0x19')]();};}function respondWithResult(_0xf3baaa,_0xc4d005){_0xc4d005=_0xc4d005||0xc8;return function(_0x29b8ef){if(_0x29b8ef){return _0xf3baaa['status'](_0xc4d005)[_0xc088('0x1a')](_0x29b8ef);}};}function respondWithFilteredResult(_0xb5e1b4,_0x337968){return function(_0x3ca370){if(_0x3ca370){var _0x31d2e2=_0x3ca370['count'],_0x3c2e60=_0x337968[_0xc088('0x1b')],_0x1aa3bc=_0x337968[_0xc088('0x1b')]+_0x337968[_0xc088('0x1c')],_0xae894a;if(_0x1aa3bc>=_0x31d2e2){_0x1aa3bc=_0x31d2e2;_0xae894a=0xc8;}else{_0xae894a=0xce;}_0xb5e1b4[_0xc088('0x1d')](_0xae894a);return _0xb5e1b4[_0xc088('0x1e')](_0xc088('0x1f'),_0x3c2e60+'-'+_0x1aa3bc+'/'+_0x31d2e2)['json'](_0x3ca370);}return null;};}function patchUpdates(_0x30a542){return function(_0x4b7a69){try{jsonpatch[_0xc088('0x20')](_0x4b7a69,_0x30a542,!![]);}catch(_0x2a44cd){return BPromise[_0xc088('0x21')](_0x2a44cd);}return _0x4b7a69['save']();};}function saveUpdates(_0x2a9469,_0x36921d){return function(_0x112782){if(_0x112782){return _0x112782[_0xc088('0x22')](_0x2a9469)[_0xc088('0x23')](function(_0x142c18){return _0x142c18;});}return null;};}function removeEntity(_0x58381e,_0x35141a){return function(_0x5e3c92){if(_0x5e3c92){return _0x5e3c92[_0xc088('0x24')]()[_0xc088('0x23')](function(){_0x58381e[_0xc088('0x1d')](0xcc)[_0xc088('0x19')]();});}};}function handleEntityNotFound(_0x3e72ee,_0xfed31){return function(_0x4ea878){if(!_0x4ea878){_0x3e72ee[_0xc088('0x18')](0x194);}return _0x4ea878;};}function handleError(_0x4afc3f,_0x5a17de){_0x5a17de=_0x5a17de||0x1f4;return function(_0xc1560f){logger['error'](_0xc1560f[_0xc088('0x25')]);if(_0xc1560f[_0xc088('0x26')]){delete _0xc1560f['name'];}_0x4afc3f[_0xc088('0x1d')](_0x5a17de)[_0xc088('0x27')](_0xc1560f);};}exports[_0xc088('0x28')]=function(_0x458e0c,_0x1142fc){var _0x585d9a={},_0x5a9f27={},_0x597d89={'count':0x0,'rows':[]};var _0x5279ba=_[_0xc088('0x29')](db[_0xc088('0x2a')][_0xc088('0x2b')],function(_0x9b2154){return{'name':_0x9b2154[_0xc088('0x2c')],'type':_0x9b2154[_0xc088('0x2d')]['key']};});_0x5a9f27[_0xc088('0x2e')]=_[_0xc088('0x29')](_0x5279ba,_0xc088('0x26'));_0x5a9f27[_0xc088('0x2f')]=_[_0xc088('0x30')](_0x458e0c[_0xc088('0x2f')]);_0x5a9f27[_0xc088('0x31')]=_[_0xc088('0x32')](_0x5a9f27[_0xc088('0x2e')],_0x5a9f27[_0xc088('0x2f')]);_0x585d9a['attributes']=_[_0xc088('0x32')](_0x5a9f27[_0xc088('0x2e')],qs['fields'](_0x458e0c[_0xc088('0x2f')]['fields']));_0x585d9a['attributes']=_0x585d9a['attributes'][_0xc088('0x33')]?_0x585d9a[_0xc088('0x34')]:_0x5a9f27[_0xc088('0x2e')];if(!_0x458e0c['query'][_0xc088('0x35')](_0xc088('0x36'))){_0x585d9a[_0xc088('0x1c')]=qs[_0xc088('0x1c')](_0x458e0c[_0xc088('0x2f')][_0xc088('0x1c')]);_0x585d9a['offset']=qs[_0xc088('0x1b')](_0x458e0c[_0xc088('0x2f')][_0xc088('0x1b')]);}_0x585d9a['order']=qs[_0xc088('0x37')](_0x458e0c[_0xc088('0x2f')][_0xc088('0x37')]);_0x585d9a[_0xc088('0x38')]=qs[_0xc088('0x31')](_[_0xc088('0x39')](_0x458e0c[_0xc088('0x2f')],_0x5a9f27[_0xc088('0x31')]),_0x5279ba);if(_0x458e0c[_0xc088('0x2f')][_0xc088('0x3a')]){_0x585d9a[_0xc088('0x38')]=_[_0xc088('0x3b')](_0x585d9a['where'],{'$or':_['map'](_0x5279ba,function(_0x59cdb7){if(_0x59cdb7[_0xc088('0x2d')]!==_0xc088('0x3c')){var _0x2f5e47={};_0x2f5e47[_0x59cdb7[_0xc088('0x26')]]={'$like':'%'+_0x458e0c[_0xc088('0x2f')][_0xc088('0x3a')]+'%'};return _0x2f5e47;}})});}_0x585d9a=_[_0xc088('0x3b')]({},_0x585d9a,_0x458e0c[_0xc088('0x3d')]);var _0x46bf30={'where':_0x585d9a[_0xc088('0x38')]};return db[_0xc088('0x2a')][_0xc088('0x3e')](_0x46bf30)[_0xc088('0x23')](function(_0x37aff6){_0x597d89[_0xc088('0x3e')]=_0x37aff6;if(_0x458e0c[_0xc088('0x2f')]['includeAll']){_0x585d9a[_0xc088('0x3f')]=[{'all':!![]}];}return db[_0xc088('0x2a')][_0xc088('0x40')](_0x585d9a);})['then'](function(_0xe3f32d){_0x597d89[_0xc088('0x41')]=_0xe3f32d;return _0x597d89;})['then'](respondWithFilteredResult(_0x1142fc,_0x585d9a))[_0xc088('0x42')](handleError(_0x1142fc,null));};exports['show']=function(_0x1aa65c,_0x2b324b){var _0x496a3a={'raw':!![],'where':{'id':_0x1aa65c['params']['id']}},_0x18feda={};_0x18feda[_0xc088('0x2e')]=_[_0xc088('0x30')](db[_0xc088('0x2a')][_0xc088('0x2b')]);_0x18feda['query']=_[_0xc088('0x30')](_0x1aa65c[_0xc088('0x2f')]);_0x18feda[_0xc088('0x31')]=_[_0xc088('0x32')](_0x18feda[_0xc088('0x2e')],_0x18feda[_0xc088('0x2f')]);_0x496a3a['attributes']=_[_0xc088('0x32')](_0x18feda['model'],qs[_0xc088('0x43')](_0x1aa65c[_0xc088('0x2f')][_0xc088('0x43')]));_0x496a3a[_0xc088('0x34')]=_0x496a3a[_0xc088('0x34')][_0xc088('0x33')]?_0x496a3a[_0xc088('0x34')]:_0x18feda['model'];if(_0x1aa65c[_0xc088('0x2f')][_0xc088('0x44')]){_0x496a3a[_0xc088('0x3f')]=[{'all':!![]}];}_0x496a3a=_[_0xc088('0x3b')]({},_0x496a3a,_0x1aa65c['options']);return db[_0xc088('0x2a')][_0xc088('0x45')](_0x496a3a)['then'](handleEntityNotFound(_0x2b324b,null))[_0xc088('0x23')](respondWithResult(_0x2b324b,null))[_0xc088('0x42')](handleError(_0x2b324b,null));};exports[_0xc088('0x46')]=function(_0x2fbcb4,_0x578a01){return db[_0xc088('0x2a')][_0xc088('0x46')](_0x2fbcb4[_0xc088('0x47')],{})['then'](respondWithResult(_0x578a01,0xc9))[_0xc088('0x42')](handleError(_0x578a01,null));};exports[_0xc088('0x22')]=function(_0x4a5880,_0x2998ed){if(_0x4a5880[_0xc088('0x47')]['id']){delete _0x4a5880[_0xc088('0x47')]['id'];}return db[_0xc088('0x2a')]['find']({'where':{'id':_0x4a5880[_0xc088('0x48')]['id']}})[_0xc088('0x23')](handleEntityNotFound(_0x2998ed,null))[_0xc088('0x23')](saveUpdates(_0x4a5880['body'],null))[_0xc088('0x23')](respondWithResult(_0x2998ed,null))[_0xc088('0x42')](handleError(_0x2998ed,null));};exports[_0xc088('0x24')]=function(_0x505563,_0x4ea673){return db[_0xc088('0x2a')][_0xc088('0x45')]({'where':{'id':_0x505563[_0xc088('0x48')]['id']}})[_0xc088('0x23')](handleEntityNotFound(_0x4ea673,null))[_0xc088('0x23')](removeEntity(_0x4ea673,null))['catch'](handleError(_0x4ea673,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index deb3936..099c188 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 _0x4add=['ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','define'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4add,0x1e4));var _0xd4ad=function(_0x29e342,_0x160ebc){_0x29e342=_0x29e342-0x0;var _0x1a0fd7=_0x4add[_0x29e342];return _0x1a0fd7;};'use strict';var _=require(_0xd4ad('0x0'));var util=require(_0xd4ad('0x1'));var logger=require(_0xd4ad('0x2'))(_0xd4ad('0x3'));var moment=require(_0xd4ad('0x4'));var BPromise=require(_0xd4ad('0x5'));var rp=require(_0xd4ad('0x6'));var fs=require('fs');var path=require(_0xd4ad('0x7'));var rimraf=require('rimraf');var config=require(_0xd4ad('0x8'));var attributes=require(_0xd4ad('0x9'));module[_0xd4ad('0xa')]=function(_0x3fd8cd,_0xe9d874){return _0x3fd8cd[_0xd4ad('0xb')](_0xd4ad('0xc'),attributes,{'tableName':_0xd4ad('0xd'),'paranoid':![],'indexes':[{'name':_0xd4ad('0xe'),'fields':['idField',_0xd4ad('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc1e6=['../../config/environment','define','zoho_unique_index','lodash','util','moment','bluebird','path','rimraf'];(function(_0x40b513,_0x26a5f4){var _0x52fdd9=function(_0x499941){while(--_0x499941){_0x40b513['push'](_0x40b513['shift']());}};_0x52fdd9(++_0x26a5f4);}(_0xc1e6,0x93));var _0x6c1e=function(_0x35c5a9,_0x2e3346){_0x35c5a9=_0x35c5a9-0x0;var _0x10a31b=_0xc1e6[_0x35c5a9];return _0x10a31b;};'use strict';var _=require(_0x6c1e('0x0'));var util=require(_0x6c1e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6c1e('0x2'));var BPromise=require(_0x6c1e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c1e('0x4'));var rimraf=require(_0x6c1e('0x5'));var config=require(_0x6c1e('0x6'));var attributes=require('./intZohoField.attributes');module['exports']=function(_0x5610e0,_0x3880e7){return _0x5610e0[_0x6c1e('0x7')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x6c1e('0x8'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 5cc6959..6480eb1 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 _0x33c5=['then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x33c5,0xe6));var _0x533c=function(_0x4c9d00,_0x5092d5){_0x4c9d00=_0x4c9d00-0x0;var _0x4a73f5=_0x33c5[_0x4c9d00];return _0x4a73f5;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var moment=require(_0x533c('0x1'));var BPromise=require('bluebird');var rs=require(_0x533c('0x2'));var fs=require('fs');var Redis=require(_0x533c('0x3'));var db=require(_0x533c('0x4'))['db'];var utils=require(_0x533c('0x5'));var logger=require(_0x533c('0x6'))('rpc');var config=require(_0x533c('0x7'));var jayson=require(_0x533c('0x8'));var client=jayson[_0x533c('0x9')][_0x533c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34ca89,_0x1699d5,_0x3a009b){return new BPromise(function(_0x36d74e,_0x2c297c){return client[_0x533c('0xb')](_0x34ca89,_0x3a009b)[_0x533c('0xc')](function(_0x46536d){logger[_0x533c('0xd')](_0x533c('0xe'),_0x1699d5,_0x533c('0xf'));logger[_0x533c('0x10')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x1699d5,_0x533c('0xf'),JSON[_0x533c('0x11')](_0x46536d));if(_0x46536d[_0x533c('0x12')]){if(_0x46536d[_0x533c('0x12')][_0x533c('0x13')]===0x1f4){logger[_0x533c('0x12')]('ZohoField,\x20%s,\x20%s',_0x1699d5,_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);return _0x2c297c(_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);}logger[_0x533c('0x12')](_0x533c('0xe'),_0x1699d5,_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);return _0x36d74e(_0x46536d['error'][_0x533c('0x14')]);}else{logger[_0x533c('0xd')](_0x533c('0xe'),_0x1699d5,_0x533c('0xf'));_0x36d74e(_0x46536d['result'][_0x533c('0x14')]);}})[_0x533c('0x15')](function(_0x41e22c){logger[_0x533c('0x12')](_0x533c('0xe'),_0x1699d5,_0x41e22c);_0x2c297c(_0x41e22c);});});} \ No newline at end of file +var _0x9a19=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x888385,_0x9cdc66){var _0x22d5c2=function(_0x3b1599){while(--_0x3b1599){_0x888385['push'](_0x888385['shift']());}};_0x22d5c2(++_0x9cdc66);}(_0x9a19,0x114));var _0x99a1=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x9a19[_0x4ae829];return _0x256b31;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var moment=require(_0x99a1('0x2'));var BPromise=require('bluebird');var rs=require(_0x99a1('0x3'));var fs=require('fs');var Redis=require(_0x99a1('0x4'));var db=require(_0x99a1('0x5'))['db'];var utils=require(_0x99a1('0x6'));var logger=require(_0x99a1('0x7'))(_0x99a1('0x8'));var config=require(_0x99a1('0x9'));var jayson=require(_0x99a1('0xa'));var client=jayson[_0x99a1('0xb')][_0x99a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x65045d,_0x523b9e,_0x4d2a5c){return new BPromise(function(_0x5aa6c2,_0x56f50){return client[_0x99a1('0xd')](_0x65045d,_0x4d2a5c)['then'](function(_0x5874fc){logger[_0x99a1('0xe')](_0x99a1('0xf'),_0x523b9e,_0x99a1('0x10'));logger[_0x99a1('0x11')](_0x99a1('0x12'),_0x523b9e,'request\x20sent',JSON[_0x99a1('0x13')](_0x5874fc));if(_0x5874fc[_0x99a1('0x14')]){if(_0x5874fc[_0x99a1('0x14')][_0x99a1('0x15')]===0x1f4){logger[_0x99a1('0x14')](_0x99a1('0xf'),_0x523b9e,_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);return _0x56f50(_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);}logger[_0x99a1('0x14')](_0x99a1('0xf'),_0x523b9e,_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);return _0x5aa6c2(_0x5874fc[_0x99a1('0x14')]['message']);}else{logger[_0x99a1('0xe')](_0x99a1('0xf'),_0x523b9e,_0x99a1('0x10'));_0x5aa6c2(_0x5874fc[_0x99a1('0x17')][_0x99a1('0x16')]);}})[_0x99a1('0x18')](function(_0x1ca878){logger['error']('ZohoField,\x20%s,\x20%s',_0x523b9e,_0x1ca878);_0x56f50(_0x1ca878);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 722942f..fcf674f 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 _0x7a4b=['connect-timeout','express','Router','../../config/environment','exports','multer','path'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x7a4b,0x18d));var _0xb7a4=function(_0x568cc7,_0x29d799){_0x568cc7=_0x568cc7-0x0;var _0x5b19f3=_0x7a4b[_0x568cc7];return _0x5b19f3;};'use strict';var multer=require(_0xb7a4('0x0'));var util=require('util');var path=require(_0xb7a4('0x1'));var timeout=require(_0xb7a4('0x2'));var express=require(_0xb7a4('0x3'));var router=express[_0xb7a4('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb7a4('0x5'));module[_0xb7a4('0x6')]=router; \ No newline at end of file +var _0x7f98=['express','Router','exports','multer','util','path','connect-timeout'];(function(_0x41bf72,_0x3ae764){var _0x308308=function(_0x404b79){while(--_0x404b79){_0x41bf72['push'](_0x41bf72['shift']());}};_0x308308(++_0x3ae764);}(_0x7f98,0x153));var _0x87f9=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x7f98[_0x9cd4c3];return _0x4c9025;};'use strict';var multer=require(_0x87f9('0x0'));var util=require(_0x87f9('0x1'));var path=require(_0x87f9('0x2'));var timeout=require(_0x87f9('0x3'));var express=require(_0x87f9('0x4'));var router=express[_0x87f9('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x87f9('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 56d5645..00fc329 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 _0xcf72=['exports','STRING','unique_name_and_version','INTEGER','state','sequelize'];(function(_0x35f3cb,_0x3b3183){var _0xf54851=function(_0x2058c4){while(--_0x2058c4){_0x35f3cb['push'](_0x35f3cb['shift']());}};_0xf54851(++_0x3b3183);}(_0xcf72,0x1bb));var _0x2cf7=function(_0x17785d,_0x3915d6){_0x17785d=_0x17785d-0x0;var _0x31b276=_0xcf72[_0x17785d];return _0x31b276;};'use strict';var Sequelize=require(_0x2cf7('0x0'));module[_0x2cf7('0x1')]={'name':{'type':Sequelize[_0x2cf7('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x2cf7('0x2')],'allowNull':![],'unique':_0x2cf7('0x3')},'main':{'type':Sequelize[_0x2cf7('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x2cf7('0x2')]},'path':{'type':Sequelize[_0x2cf7('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x2cf7('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x2cf7('0x2')]},'logo':{'type':Sequelize[_0x2cf7('0x2')]},'state':{'type':Sequelize[_0x2cf7('0x2')],'unique':_0x2cf7('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x2cf7('0x2')]},'remoteUri':{'type':Sequelize[_0x2cf7('0x2')]},'link':{'type':Sequelize[_0x2cf7('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xea7e=['state','sequelize','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xea7e,0x1ed));var _0xeea7=function(_0xed3886,_0x153a90){_0xed3886=_0xed3886-0x0;var _0x2dd61d=_0xea7e[_0xed3886];return _0x2dd61d;};'use strict';var Sequelize=require(_0xeea7('0x0'));module['exports']={'name':{'type':Sequelize[_0xeea7('0x1')],'allowNull':![],'unique':_0xeea7('0x2')},'version':{'type':Sequelize[_0xeea7('0x1')],'allowNull':![],'unique':_0xeea7('0x2')},'main':{'type':Sequelize[_0xeea7('0x1')],'defaultValue':_0xeea7('0x3')},'filename':{'type':Sequelize[_0xeea7('0x1')]},'path':{'type':Sequelize[_0xeea7('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xeea7('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xeea7('0x1')]},'logo':{'type':Sequelize[_0xeea7('0x1')]},'state':{'type':Sequelize[_0xeea7('0x1')],'unique':_0xeea7('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xeea7('0x1')]},'remoteUri':{'type':Sequelize[_0xeea7('0x1')]},'link':{'type':Sequelize[_0xeea7('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 7a4cbe8..644a57c 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 _0xf63a=['count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','index','map','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','options','Integration','include','catch','show','params','rawAttributes','length','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','end','json'];(function(_0x43a808,_0xb2e81e){var _0x3388cb=function(_0x1ae284){while(--_0x1ae284){_0x43a808['push'](_0x43a808['shift']());}};_0x3388cb(++_0xb2e81e);}(_0xf63a,0x6e));var _0xaf63=function(_0x5d8444,_0x3547b0){_0x5d8444=_0x5d8444-0x0;var _0x3801bf=_0xf63a[_0x5d8444];return _0x3801bf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaf63('0x0'));var rimraf=require(_0xaf63('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf63('0x2'));var rp=require(_0xaf63('0x3'));var moment=require(_0xaf63('0x4'));var BPromise=require(_0xaf63('0x5'));var Mustache=require(_0xaf63('0x6'));var util=require(_0xaf63('0x7'));var path=require(_0xaf63('0x8'));var sox=require(_0xaf63('0x9'));var csv=require(_0xaf63('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xaf63('0xb'));var jsforce=require(_0xaf63('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xaf63('0xa'));var querystring=require(_0xaf63('0xd'));var Papa=require(_0xaf63('0xe'));var Redis=require(_0xaf63('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xaf63('0x10'));var as=require(_0xaf63('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaf63('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaf63('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x270bff,_0x4a2ae3){_0x4a2ae3=_0x4a2ae3||0xcc;return function(_0x8613){if(_0x8613){return _0x270bff[_0xaf63('0x14')](_0x4a2ae3);}return _0x270bff[_0xaf63('0x15')](_0x4a2ae3)[_0xaf63('0x16')]();};}function respondWithResult(_0x20f1fb,_0x1245b7){_0x1245b7=_0x1245b7||0xc8;return function(_0x838417){if(_0x838417){return _0x20f1fb[_0xaf63('0x15')](_0x1245b7)[_0xaf63('0x17')](_0x838417);}};}function respondWithFilteredResult(_0x694a4e,_0x2a47ca){return function(_0x11ab7a){if(_0x11ab7a){var _0x517637=_0x11ab7a[_0xaf63('0x18')],_0x4836f9=_0x2a47ca[_0xaf63('0x19')],_0xfe76a5=_0x2a47ca[_0xaf63('0x19')]+_0x2a47ca[_0xaf63('0x1a')],_0x59ed38;if(_0xfe76a5>=_0x517637){_0xfe76a5=_0x517637;_0x59ed38=0xc8;}else{_0x59ed38=0xce;}_0x694a4e[_0xaf63('0x15')](_0x59ed38);return _0x694a4e[_0xaf63('0x1b')](_0xaf63('0x1c'),_0x4836f9+'-'+_0xfe76a5+'/'+_0x517637)[_0xaf63('0x17')](_0x11ab7a);}return null;};}function patchUpdates(_0x549bc6){return function(_0x5e6275){try{jsonpatch[_0xaf63('0x1d')](_0x5e6275,_0x549bc6,!![]);}catch(_0x4c01ba){return BPromise[_0xaf63('0x1e')](_0x4c01ba);}return _0x5e6275['save']();};}function saveUpdates(_0x497212,_0x1a1228){return function(_0x32838d){if(_0x32838d){return _0x32838d[_0xaf63('0x1f')](_0x497212)[_0xaf63('0x20')](function(_0x5bb956){return _0x5bb956;});}return null;};}function removeEntity(_0x4c8589,_0x5a7a0e){return function(_0x16e4bf){if(_0x16e4bf){return _0x16e4bf[_0xaf63('0x21')]()[_0xaf63('0x20')](function(){_0x4c8589[_0xaf63('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2eb7ef,_0x1b5c36){return function(_0x56a75d){if(!_0x56a75d){_0x2eb7ef[_0xaf63('0x14')](0x194);}return _0x56a75d;};}function handleError(_0x1ba627,_0x442023){_0x442023=_0x442023||0x1f4;return function(_0x2eecc9){logger[_0xaf63('0x22')](_0x2eecc9[_0xaf63('0x23')]);if(_0x2eecc9['name']){delete _0x2eecc9['name'];}_0x1ba627[_0xaf63('0x15')](_0x442023)[_0xaf63('0x24')](_0x2eecc9);};}exports[_0xaf63('0x25')]=function(_0x370c73,_0xffd1b5){var _0x216bed={},_0x201efd={},_0x2c165f={'count':0x0,'rows':[]};var _0x497314=_[_0xaf63('0x26')](db['Integration']['rawAttributes'],function(_0x11fa20){return{'name':_0x11fa20[_0xaf63('0x27')],'type':_0x11fa20[_0xaf63('0x28')][_0xaf63('0x29')]};});_0x201efd[_0xaf63('0x2a')]=_[_0xaf63('0x26')](_0x497314,_0xaf63('0x2b'));_0x201efd['query']=_[_0xaf63('0x2c')](_0x370c73[_0xaf63('0x2d')]);_0x201efd[_0xaf63('0x2e')]=_[_0xaf63('0x2f')](_0x201efd[_0xaf63('0x2a')],_0x201efd['query']);_0x216bed[_0xaf63('0x30')]=_[_0xaf63('0x2f')](_0x201efd[_0xaf63('0x2a')],qs[_0xaf63('0x31')](_0x370c73['query'][_0xaf63('0x31')]));_0x216bed[_0xaf63('0x30')]=_0x216bed[_0xaf63('0x30')]['length']?_0x216bed['attributes']:_0x201efd[_0xaf63('0x2a')];if(!_0x370c73[_0xaf63('0x2d')]['hasOwnProperty'](_0xaf63('0x32'))){_0x216bed[_0xaf63('0x1a')]=qs[_0xaf63('0x1a')](_0x370c73[_0xaf63('0x2d')]['limit']);_0x216bed[_0xaf63('0x19')]=qs[_0xaf63('0x19')](_0x370c73['query'][_0xaf63('0x19')]);}_0x216bed['order']=qs[_0xaf63('0x33')](_0x370c73[_0xaf63('0x2d')][_0xaf63('0x33')]);_0x216bed[_0xaf63('0x34')]=qs[_0xaf63('0x2e')](_[_0xaf63('0x35')](_0x370c73['query'],_0x201efd['filters']),_0x497314);if(_0x370c73[_0xaf63('0x2d')][_0xaf63('0x36')]){_0x216bed['where']=_[_0xaf63('0x37')](_0x216bed[_0xaf63('0x34')],{'$or':_['map'](_0x497314,function(_0x172f4c){if(_0x172f4c[_0xaf63('0x28')]!=='VIRTUAL'){var _0x56c3e2={};_0x56c3e2[_0x172f4c['name']]={'$like':'%'+_0x370c73['query']['filter']+'%'};return _0x56c3e2;}})});}_0x216bed=_[_0xaf63('0x37')]({},_0x216bed,_0x370c73[_0xaf63('0x38')]);var _0x19ead4={'where':_0x216bed[_0xaf63('0x34')]};return db[_0xaf63('0x39')][_0xaf63('0x18')](_0x19ead4)[_0xaf63('0x20')](function(_0x375996){_0x2c165f[_0xaf63('0x18')]=_0x375996;if(_0x370c73['query']['includeAll']){_0x216bed[_0xaf63('0x3a')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x216bed);})[_0xaf63('0x20')](function(_0x4e9195){_0x2c165f['rows']=_0x4e9195;return _0x2c165f;})[_0xaf63('0x20')](respondWithFilteredResult(_0xffd1b5,_0x216bed))[_0xaf63('0x3b')](handleError(_0xffd1b5,null));};exports[_0xaf63('0x3c')]=function(_0x414e90,_0x45bc67){var _0x39931d={'raw':![],'where':{'id':_0x414e90[_0xaf63('0x3d')]['id']}},_0x21fa5e={};_0x21fa5e['model']=_['keys'](db['Integration'][_0xaf63('0x3e')]);_0x21fa5e['query']=_[_0xaf63('0x2c')](_0x414e90[_0xaf63('0x2d')]);_0x21fa5e['filters']=_[_0xaf63('0x2f')](_0x21fa5e[_0xaf63('0x2a')],_0x21fa5e['query']);_0x39931d['attributes']=_[_0xaf63('0x2f')](_0x21fa5e['model'],qs['fields'](_0x414e90['query']['fields']));_0x39931d['attributes']=_0x39931d[_0xaf63('0x30')][_0xaf63('0x3f')]?_0x39931d[_0xaf63('0x30')]:_0x21fa5e[_0xaf63('0x2a')];if(_0x414e90[_0xaf63('0x2d')]['includeAll']){_0x39931d[_0xaf63('0x3a')]=[{'all':!![]}];}_0x39931d=_[_0xaf63('0x37')]({},_0x39931d,_0x414e90[_0xaf63('0x38')]);return db['Integration'][_0xaf63('0x40')](_0x39931d)['then'](handleEntityNotFound(_0x45bc67,null))[_0xaf63('0x20')](respondWithResult(_0x45bc67,null))[_0xaf63('0x3b')](handleError(_0x45bc67,null));};exports[_0xaf63('0x41')]=function(_0x1923b7,_0x1a5284){return db[_0xaf63('0x39')][_0xaf63('0x41')](_0x1923b7[_0xaf63('0x42')],{})[_0xaf63('0x20')](respondWithResult(_0x1a5284,0xc9))['catch'](handleError(_0x1a5284,null));};exports[_0xaf63('0x1f')]=function(_0x221028,_0x3fef6a){if(_0x221028[_0xaf63('0x42')]['id']){delete _0x221028[_0xaf63('0x42')]['id'];}return db[_0xaf63('0x39')][_0xaf63('0x40')]({'where':{'id':_0x221028['params']['id']}})[_0xaf63('0x20')](handleEntityNotFound(_0x3fef6a,null))[_0xaf63('0x20')](saveUpdates(_0x221028[_0xaf63('0x42')],null))[_0xaf63('0x20')](respondWithResult(_0x3fef6a,null))[_0xaf63('0x3b')](handleError(_0x3fef6a,null));};exports[_0xaf63('0x21')]=function(_0x1ef7ae,_0x1a2812){return db['Integration'][_0xaf63('0x40')]({'where':{'id':_0x1ef7ae['params']['id']}})[_0xaf63('0x20')](handleEntityNotFound(_0x1a2812,null))[_0xaf63('0x20')](removeEntity(_0x1a2812,null))[_0xaf63('0x3b')](handleError(_0x1a2812,null));}; \ No newline at end of file +var _0x8e7b=['hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','Integration','rawAttributes','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','error','name','send','index','map','type','key','model','keys','query','intersection','attributes','fields','length'];(function(_0x2d2e85,_0x22faa9){var _0x3e9f5e=function(_0x101c22){while(--_0x101c22){_0x2d2e85['push'](_0x2d2e85['shift']());}};_0x3e9f5e(++_0x22faa9);}(_0x8e7b,0xb2));var _0xb8e7=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x8e7b[_0x5d6456];return _0x4d66c1;};'use strict';var pdf=require(_0xb8e7('0x0'));var emlformat=require(_0xb8e7('0x1'));var rimraf=require(_0xb8e7('0x2'));var zipdir=require(_0xb8e7('0x3'));var jsonpatch=require(_0xb8e7('0x4'));var rp=require('request-promise');var moment=require(_0xb8e7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb8e7('0x6'));var util=require(_0xb8e7('0x7'));var path=require(_0xb8e7('0x8'));var sox=require('sox');var csv=require(_0xb8e7('0x9'));var ejs=require(_0xb8e7('0xa'));var fs=require('fs');var _=require(_0xb8e7('0xb'));var squel=require(_0xb8e7('0xc'));var crypto=require('crypto');var jsforce=require(_0xb8e7('0xd'));var deskjs=require(_0xb8e7('0xe'));var toCsv=require(_0xb8e7('0x9'));var querystring=require(_0xb8e7('0xf'));var Papa=require(_0xb8e7('0x10'));var Redis=require('ioredis');var authService=require(_0xb8e7('0x11'));var qs=require(_0xb8e7('0x12'));var as=require(_0xb8e7('0x13'));var hardwareService=require(_0xb8e7('0x14'));var logger=require(_0xb8e7('0x15'))(_0xb8e7('0x16'));var utils=require(_0xb8e7('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb8e7('0x18'));var db=require(_0xb8e7('0x19'))['db'];function respondWithStatusCode(_0x56dad8,_0x588657){_0x588657=_0x588657||0xcc;return function(_0x5900ea){if(_0x5900ea){return _0x56dad8[_0xb8e7('0x1a')](_0x588657);}return _0x56dad8['status'](_0x588657)['end']();};}function respondWithResult(_0x4c07b1,_0x42547c){_0x42547c=_0x42547c||0xc8;return function(_0x42be6f){if(_0x42be6f){return _0x4c07b1[_0xb8e7('0x1b')](_0x42547c)[_0xb8e7('0x1c')](_0x42be6f);}};}function respondWithFilteredResult(_0x5f1264,_0xc53048){return function(_0x41f633){if(_0x41f633){var _0x230c9e=_0x41f633[_0xb8e7('0x1d')],_0x15fc3e=_0xc53048[_0xb8e7('0x1e')],_0x1f3129=_0xc53048[_0xb8e7('0x1e')]+_0xc53048['limit'],_0x28fafb;if(_0x1f3129>=_0x230c9e){_0x1f3129=_0x230c9e;_0x28fafb=0xc8;}else{_0x28fafb=0xce;}_0x5f1264[_0xb8e7('0x1b')](_0x28fafb);return _0x5f1264[_0xb8e7('0x1f')](_0xb8e7('0x20'),_0x15fc3e+'-'+_0x1f3129+'/'+_0x230c9e)[_0xb8e7('0x1c')](_0x41f633);}return null;};}function patchUpdates(_0x2bdcfb){return function(_0x53ccc9){try{jsonpatch[_0xb8e7('0x21')](_0x53ccc9,_0x2bdcfb,!![]);}catch(_0x53ee5f){return BPromise[_0xb8e7('0x22')](_0x53ee5f);}return _0x53ccc9[_0xb8e7('0x23')]();};}function saveUpdates(_0x5978de,_0x5e1b64){return function(_0x5ac589){if(_0x5ac589){return _0x5ac589[_0xb8e7('0x24')](_0x5978de)['then'](function(_0x30fdd5){return _0x30fdd5;});}return null;};}function removeEntity(_0x4f02f0,_0xba2dd4){return function(_0x384a99){if(_0x384a99){return _0x384a99[_0xb8e7('0x25')]()['then'](function(){_0x4f02f0['status'](0xcc)[_0xb8e7('0x26')]();});}};}function handleEntityNotFound(_0x2289f8,_0x5032ec){return function(_0x210b9c){if(!_0x210b9c){_0x2289f8[_0xb8e7('0x1a')](0x194);}return _0x210b9c;};}function handleError(_0x44830e,_0x1e8538){_0x1e8538=_0x1e8538||0x1f4;return function(_0x517ebc){logger[_0xb8e7('0x27')](_0x517ebc['stack']);if(_0x517ebc[_0xb8e7('0x28')]){delete _0x517ebc[_0xb8e7('0x28')];}_0x44830e[_0xb8e7('0x1b')](_0x1e8538)[_0xb8e7('0x29')](_0x517ebc);};}exports[_0xb8e7('0x2a')]=function(_0x514961,_0x15b316){var _0x203099={},_0x2e192d={},_0x45bf2c={'count':0x0,'rows':[]};var _0x1a5b8a=_[_0xb8e7('0x2b')](db['Integration']['rawAttributes'],function(_0xd0a4d8){return{'name':_0xd0a4d8['fieldName'],'type':_0xd0a4d8[_0xb8e7('0x2c')][_0xb8e7('0x2d')]};});_0x2e192d[_0xb8e7('0x2e')]=_[_0xb8e7('0x2b')](_0x1a5b8a,_0xb8e7('0x28'));_0x2e192d['query']=_[_0xb8e7('0x2f')](_0x514961[_0xb8e7('0x30')]);_0x2e192d['filters']=_[_0xb8e7('0x31')](_0x2e192d['model'],_0x2e192d[_0xb8e7('0x30')]);_0x203099[_0xb8e7('0x32')]=_[_0xb8e7('0x31')](_0x2e192d[_0xb8e7('0x2e')],qs[_0xb8e7('0x33')](_0x514961['query'][_0xb8e7('0x33')]));_0x203099[_0xb8e7('0x32')]=_0x203099[_0xb8e7('0x32')][_0xb8e7('0x34')]?_0x203099[_0xb8e7('0x32')]:_0x2e192d[_0xb8e7('0x2e')];if(!_0x514961[_0xb8e7('0x30')][_0xb8e7('0x35')](_0xb8e7('0x36'))){_0x203099['limit']=qs[_0xb8e7('0x37')](_0x514961[_0xb8e7('0x30')][_0xb8e7('0x37')]);_0x203099[_0xb8e7('0x1e')]=qs[_0xb8e7('0x1e')](_0x514961[_0xb8e7('0x30')][_0xb8e7('0x1e')]);}_0x203099[_0xb8e7('0x38')]=qs[_0xb8e7('0x39')](_0x514961[_0xb8e7('0x30')]['sort']);_0x203099[_0xb8e7('0x3a')]=qs['filters'](_[_0xb8e7('0x3b')](_0x514961['query'],_0x2e192d[_0xb8e7('0x3c')]),_0x1a5b8a);if(_0x514961['query'][_0xb8e7('0x3d')]){_0x203099[_0xb8e7('0x3a')]=_[_0xb8e7('0x3e')](_0x203099[_0xb8e7('0x3a')],{'$or':_['map'](_0x1a5b8a,function(_0x4cf33a){if(_0x4cf33a[_0xb8e7('0x2c')]!==_0xb8e7('0x3f')){var _0x2d21c1={};_0x2d21c1[_0x4cf33a[_0xb8e7('0x28')]]={'$like':'%'+_0x514961[_0xb8e7('0x30')][_0xb8e7('0x3d')]+'%'};return _0x2d21c1;}})});}_0x203099=_[_0xb8e7('0x3e')]({},_0x203099,_0x514961[_0xb8e7('0x40')]);var _0x10c4bb={'where':_0x203099['where']};return db['Integration'][_0xb8e7('0x1d')](_0x10c4bb)[_0xb8e7('0x41')](function(_0x43c709){_0x45bf2c[_0xb8e7('0x1d')]=_0x43c709;if(_0x514961[_0xb8e7('0x30')][_0xb8e7('0x42')]){_0x203099[_0xb8e7('0x43')]=[{'all':!![]}];}return db['Integration'][_0xb8e7('0x44')](_0x203099);})[_0xb8e7('0x41')](function(_0x57c74b){_0x45bf2c[_0xb8e7('0x45')]=_0x57c74b;return _0x45bf2c;})[_0xb8e7('0x41')](respondWithFilteredResult(_0x15b316,_0x203099))[_0xb8e7('0x46')](handleError(_0x15b316,null));};exports[_0xb8e7('0x47')]=function(_0x2abe75,_0x2d8c42){var _0x9e9d5f={'raw':![],'where':{'id':_0x2abe75['params']['id']}},_0x5cbf90={};_0x5cbf90[_0xb8e7('0x2e')]=_['keys'](db[_0xb8e7('0x48')][_0xb8e7('0x49')]);_0x5cbf90[_0xb8e7('0x30')]=_[_0xb8e7('0x2f')](_0x2abe75[_0xb8e7('0x30')]);_0x5cbf90[_0xb8e7('0x3c')]=_[_0xb8e7('0x31')](_0x5cbf90[_0xb8e7('0x2e')],_0x5cbf90[_0xb8e7('0x30')]);_0x9e9d5f[_0xb8e7('0x32')]=_[_0xb8e7('0x31')](_0x5cbf90[_0xb8e7('0x2e')],qs[_0xb8e7('0x33')](_0x2abe75['query'][_0xb8e7('0x33')]));_0x9e9d5f[_0xb8e7('0x32')]=_0x9e9d5f[_0xb8e7('0x32')][_0xb8e7('0x34')]?_0x9e9d5f[_0xb8e7('0x32')]:_0x5cbf90['model'];if(_0x2abe75[_0xb8e7('0x30')]['includeAll']){_0x9e9d5f[_0xb8e7('0x43')]=[{'all':!![]}];}_0x9e9d5f=_[_0xb8e7('0x3e')]({},_0x9e9d5f,_0x2abe75[_0xb8e7('0x40')]);return db[_0xb8e7('0x48')][_0xb8e7('0x4a')](_0x9e9d5f)[_0xb8e7('0x41')](handleEntityNotFound(_0x2d8c42,null))[_0xb8e7('0x41')](respondWithResult(_0x2d8c42,null))[_0xb8e7('0x46')](handleError(_0x2d8c42,null));};exports[_0xb8e7('0x4b')]=function(_0x38765e,_0x51e4c3){return db[_0xb8e7('0x48')][_0xb8e7('0x4b')](_0x38765e[_0xb8e7('0x4c')],{})[_0xb8e7('0x41')](respondWithResult(_0x51e4c3,0xc9))['catch'](handleError(_0x51e4c3,null));};exports[_0xb8e7('0x24')]=function(_0x25365f,_0x199f12){if(_0x25365f['body']['id']){delete _0x25365f['body']['id'];}return db[_0xb8e7('0x48')][_0xb8e7('0x4a')]({'where':{'id':_0x25365f['params']['id']}})['then'](handleEntityNotFound(_0x199f12,null))[_0xb8e7('0x41')](saveUpdates(_0x25365f['body'],null))[_0xb8e7('0x41')](respondWithResult(_0x199f12,null))[_0xb8e7('0x46')](handleError(_0x199f12,null));};exports[_0xb8e7('0x25')]=function(_0x2fac1f,_0x1a5788){return db['Integration'][_0xb8e7('0x4a')]({'where':{'id':_0x2fac1f['params']['id']}})[_0xb8e7('0x41')](handleEntityNotFound(_0x1a5788,null))[_0xb8e7('0x41')](removeEntity(_0x1a5788,null))[_0xb8e7('0x46')](handleError(_0x1a5788,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index c6108c4..2cff758 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 _0x851c=['request-promise','rimraf','../../config/environment','define','Integration','integrations','util','api'];(function(_0x9c49d8,_0x2ecf6c){var _0x5936e1=function(_0x2319bf){while(--_0x2319bf){_0x9c49d8['push'](_0x9c49d8['shift']());}};_0x5936e1(++_0x2ecf6c);}(_0x851c,0x96));var _0xc851=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x851c[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0xc851('0x0'));var logger=require('../../config/logger')(_0xc851('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc851('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc851('0x3'));var config=require(_0xc851('0x4'));var attributes=require('./integration.attributes');module['exports']=function(_0x1b083d,_0x3e832e){return _0x1b083d[_0xc851('0x5')](_0xc851('0x6'),attributes,{'tableName':_0xc851('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x524e=['define','Integration','integrations','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./integration.attributes','exports'];(function(_0x329668,_0x3ca7d4){var _0x4e06d3=function(_0x308b96){while(--_0x308b96){_0x329668['push'](_0x329668['shift']());}};_0x4e06d3(++_0x3ca7d4);}(_0x524e,0x16b));var _0xe524=function(_0x519917,_0x3091bd){_0x519917=_0x519917-0x0;var _0x419ff3=_0x524e[_0x519917];return _0x419ff3;};'use strict';var _=require(_0xe524('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe524('0x1'));var moment=require(_0xe524('0x2'));var BPromise=require(_0xe524('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe524('0x4'));var rimraf=require(_0xe524('0x5'));var config=require(_0xe524('0x6'));var attributes=require(_0xe524('0x7'));module[_0xe524('0x8')]=function(_0x18cfe0,_0x5515eb){return _0x18cfe0[_0xe524('0x9')](_0xe524('0xa'),attributes,{'tableName':_0xe524('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index bf208d5..7d89a31 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 _0x44f6=['rpc','client','http','info','Integration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x495f0b,_0x499f83){var _0xef44be=function(_0xea90c){while(--_0xea90c){_0x495f0b['push'](_0x495f0b['shift']());}};_0xef44be(++_0x499f83);}(_0x44f6,0xa4));var _0x644f=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0x44f6[_0xe39824];return _0x4bc31e;};'use strict';var _=require(_0x644f('0x0'));var util=require(_0x644f('0x1'));var moment=require(_0x644f('0x2'));var BPromise=require(_0x644f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x644f('0x4'))['db'];var utils=require(_0x644f('0x5'));var logger=require(_0x644f('0x6'))(_0x644f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x644f('0x8')][_0x644f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x353dae,_0x190bf9,_0x1c79ce){return new BPromise(function(_0x204c12,_0xbecaee){return client['request'](_0x353dae,_0x1c79ce)['then'](function(_0x4e466d){logger[_0x644f('0xa')](_0x644f('0xb'),_0x190bf9,_0x644f('0xc'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x190bf9,_0x644f('0xc'),JSON[_0x644f('0xd')](_0x4e466d));if(_0x4e466d[_0x644f('0xe')]){if(_0x4e466d[_0x644f('0xe')][_0x644f('0xf')]===0x1f4){logger[_0x644f('0xe')]('Integration,\x20%s,\x20%s',_0x190bf9,_0x4e466d[_0x644f('0xe')][_0x644f('0x10')]);return _0xbecaee(_0x4e466d[_0x644f('0xe')][_0x644f('0x10')]);}logger[_0x644f('0xe')]('Integration,\x20%s,\x20%s',_0x190bf9,_0x4e466d['error'][_0x644f('0x10')]);return _0x204c12(_0x4e466d[_0x644f('0xe')][_0x644f('0x10')]);}else{logger[_0x644f('0xa')](_0x644f('0xb'),_0x190bf9,_0x644f('0xc'));_0x204c12(_0x4e466d[_0x644f('0x11')][_0x644f('0x10')]);}})[_0x644f('0x12')](function(_0xf092a6){logger[_0x644f('0xe')]('Integration,\x20%s,\x20%s',_0x190bf9,_0xf092a6);_0xbecaee(_0xf092a6);});});} \ No newline at end of file +var _0x207d=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0xa797fe,_0x136079){var _0x3cbd82=function(_0x544921){while(--_0x544921){_0xa797fe['push'](_0xa797fe['shift']());}};_0x3cbd82(++_0x136079);}(_0x207d,0x10d));var _0xd207=function(_0x4dd44c,_0x249887){_0x4dd44c=_0x4dd44c-0x0;var _0x229a94=_0x207d[_0x4dd44c];return _0x229a94;};'use strict';var _=require(_0xd207('0x0'));var util=require(_0xd207('0x1'));var moment=require(_0xd207('0x2'));var BPromise=require(_0xd207('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd207('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd207('0x5'));var logger=require(_0xd207('0x6'))('rpc');var config=require(_0xd207('0x7'));var jayson=require(_0xd207('0x8'));var client=jayson[_0xd207('0x9')][_0xd207('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0cfe,_0x1bfc5a,_0x3e09c7){return new BPromise(function(_0x7def24,_0x304b70){return client[_0xd207('0xb')](_0x2e0cfe,_0x3e09c7)[_0xd207('0xc')](function(_0x545ab1){logger[_0xd207('0xd')](_0xd207('0xe'),_0x1bfc5a,_0xd207('0xf'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x1bfc5a,_0xd207('0xf'),JSON[_0xd207('0x10')](_0x545ab1));if(_0x545ab1[_0xd207('0x11')]){if(_0x545ab1['error'][_0xd207('0x12')]===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x1bfc5a,_0x545ab1['error'][_0xd207('0x13')]);return _0x304b70(_0x545ab1[_0xd207('0x11')][_0xd207('0x13')]);}logger[_0xd207('0x11')](_0xd207('0xe'),_0x1bfc5a,_0x545ab1[_0xd207('0x11')][_0xd207('0x13')]);return _0x7def24(_0x545ab1[_0xd207('0x11')][_0xd207('0x13')]);}else{logger[_0xd207('0xd')](_0xd207('0xe'),_0x1bfc5a,'request\x20sent');_0x7def24(_0x545ab1['result'][_0xd207('0x13')]);}})[_0xd207('0x14')](function(_0x38e8e8){logger['error']('Integration,\x20%s,\x20%s',_0x1bfc5a,_0x38e8e8);_0x304b70(_0x38e8e8);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 1dee539..632e662 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 _0xa4b5=['index','/describe','describe','/:id','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xa4b5,0x100));var _0x5a4b=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa4b5[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x5a4b('0x0'));var util=require(_0x5a4b('0x1'));var path=require(_0x5a4b('0x2'));var timeout=require(_0x5a4b('0x3'));var express=require(_0x5a4b('0x4'));var router=express['Router']();var auth=require(_0x5a4b('0x5'));var interaction=require(_0x5a4b('0x6'));var config=require('../../config/environment');var controller=require(_0x5a4b('0x7'));router[_0x5a4b('0x8')]('/',auth[_0x5a4b('0x9')](),controller[_0x5a4b('0xa')]);router['get'](_0x5a4b('0xb'),auth['isAuthenticated'](),controller[_0x5a4b('0xc')]);router['get'](_0x5a4b('0xd'),auth[_0x5a4b('0x9')](),controller['show']);router[_0x5a4b('0xe')]('/',auth[_0x5a4b('0x9')](),controller[_0x5a4b('0xf')]);router['put'](_0x5a4b('0xd'),auth[_0x5a4b('0x9')](),controller[_0x5a4b('0x10')]);router['delete'](_0x5a4b('0xd'),auth[_0x5a4b('0x9')](),controller[_0x5a4b('0x11')]);module[_0x5a4b('0x12')]=router; \ No newline at end of file +var _0xabe7=['isAuthenticated','index','/describe','describe','get','show','post','create','put','/:id','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./integrationReport.controller'];(function(_0x1d7e9e,_0x3d0a07){var _0x561218=function(_0xf45bbd){while(--_0xf45bbd){_0x1d7e9e['push'](_0x1d7e9e['shift']());}};_0x561218(++_0x3d0a07);}(_0xabe7,0x1b0));var _0x7abe=function(_0x11efd7,_0x1cc20b){_0x11efd7=_0x11efd7-0x0;var _0x427fca=_0xabe7[_0x11efd7];return _0x427fca;};'use strict';var multer=require(_0x7abe('0x0'));var util=require(_0x7abe('0x1'));var path=require(_0x7abe('0x2'));var timeout=require('connect-timeout');var express=require(_0x7abe('0x3'));var router=express[_0x7abe('0x4')]();var auth=require(_0x7abe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7abe('0x6'));var controller=require(_0x7abe('0x7'));router['get']('/',auth[_0x7abe('0x8')](),controller[_0x7abe('0x9')]);router['get'](_0x7abe('0xa'),auth[_0x7abe('0x8')](),controller[_0x7abe('0xb')]);router[_0x7abe('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x7abe('0xd')]);router[_0x7abe('0xe')]('/',auth[_0x7abe('0x8')](),controller[_0x7abe('0xf')]);router[_0x7abe('0x10')](_0x7abe('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x7abe('0x12')]('/:id',auth[_0x7abe('0x8')](),controller[_0x7abe('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 62ae1da..8d99e9d 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 _0xa624=['TEXT','ENUM','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x28139b,_0x155e7f){var _0x38e5be=function(_0x339d8f){while(--_0x339d8f){_0x28139b['push'](_0x28139b['shift']());}};_0x38e5be(++_0x155e7f);}(_0xa624,0x1d0));var _0x4a62=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0xa624[_0x355ce8];return _0x1db8b8;};'use strict';var Sequelize=require('sequelize');module[_0x4a62('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x4a62('0x1')]},'integrationId':{'type':Sequelize[_0x4a62('0x2')]},'contacts':{'type':Sequelize[_0x4a62('0x1')]},'uniqueid':{'type':Sequelize[_0x4a62('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4a62('0x1')]},'queue':{'type':Sequelize[_0x4a62('0x1')]},'interface':{'type':Sequelize[_0x4a62('0x1')]},'membername':{'type':Sequelize[_0x4a62('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x4a62('0x3')]},'holdtime':{'type':Sequelize[_0x4a62('0x2')]},'agentcomplete':{'type':Sequelize[_0x4a62('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4a62('0x3')]},'talktime':{'type':Sequelize[_0x4a62('0x2')]},'agentacw':{'type':Sequelize[_0x4a62('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x4a62('0x3')]},'agentdump':{'type':Sequelize[_0x4a62('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4a62('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4a62('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4a62('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4a62('0x1')]},'accountcode':{'type':Sequelize[_0x4a62('0x1')]},'context':{'type':Sequelize[_0x4a62('0x1')]},'exten':{'type':Sequelize[_0x4a62('0x1')]},'priority':{'type':Sequelize[_0x4a62('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x4a62('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x4a62('0x1')]},'destcalleridnum':{'type':Sequelize[_0x4a62('0x1')]},'destcalleridname':{'type':Sequelize[_0x4a62('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x4a62('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x4a62('0x1')]},'destlanguage':{'type':Sequelize[_0x4a62('0x1')]},'destaccountcode':{'type':Sequelize[_0x4a62('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x4a62('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x4a62('0x1')]},'messageId':{'type':Sequelize[_0x4a62('0x1')]},'inReplyTo':{'type':Sequelize[_0x4a62('0x1')]},'subject':{'type':Sequelize[_0x4a62('0x1')]},'from':{'type':Sequelize[_0x4a62('0x1')]},'to':{'type':Sequelize[_0x4a62('0x1')]},'cc':{'type':Sequelize[_0x4a62('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x4a62('0x5')]},'status':{'type':Sequelize[_0x4a62('0x6')]('SENT','SENDING','RECEIVED','FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x4a62('0x1')]},'appdata':{'type':Sequelize[_0x4a62('0x1')]},'projectId':{'type':Sequelize[_0x4a62('0x2')]}}; \ No newline at end of file +var _0x0099=['SENDING','FAILED','sequelize','STRING','DATE','BOOLEAN','INTEGER','TEXT','ENUM','SENT'];(function(_0xffd8b0,_0x12c51f){var _0x301ba0=function(_0x103c05){while(--_0x103c05){_0xffd8b0['push'](_0xffd8b0['shift']());}};_0x301ba0(++_0x12c51f);}(_0x0099,0x66));var _0x9009=function(_0x143368,_0x5d0b64){_0x143368=_0x143368-0x0;var _0x44c10a=_0x0099[_0x143368];return _0x44c10a;};'use strict';var Sequelize=require(_0x9009('0x0'));module['exports']={'integration':{'type':Sequelize[_0x9009('0x1')]},'eventChannel':{'type':Sequelize[_0x9009('0x1')]},'exitStatus':{'type':Sequelize[_0x9009('0x1')]},'ticketId':{'type':Sequelize[_0x9009('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9009('0x1')]},'calleridnum':{'type':Sequelize[_0x9009('0x1')]},'calleridname':{'type':Sequelize[_0x9009('0x1')]},'queue':{'type':Sequelize[_0x9009('0x1')]},'interface':{'type':Sequelize[_0x9009('0x1')]},'membername':{'type':Sequelize[_0x9009('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x9009('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x9009('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x9009('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9009('0x4')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x9009('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x9009('0x2')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x9009('0x2')]},'lastevent':{'type':Sequelize[_0x9009('0x1')]},'channel':{'type':Sequelize[_0x9009('0x1')]},'channelstate':{'type':Sequelize[_0x9009('0x4')]},'channelstatedesc':{'type':Sequelize[_0x9009('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9009('0x1')]},'connectedlinename':{'type':Sequelize[_0x9009('0x1')]},'language':{'type':Sequelize[_0x9009('0x1')]},'accountcode':{'type':Sequelize[_0x9009('0x1')]},'context':{'type':Sequelize[_0x9009('0x1')]},'exten':{'type':Sequelize[_0x9009('0x1')]},'priority':{'type':Sequelize[_0x9009('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x9009('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x9009('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x9009('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x9009('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x9009('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x9009('0x1')]},'destcontext':{'type':Sequelize[_0x9009('0x1')]},'destexten':{'type':Sequelize[_0x9009('0x1')]},'destpriority':{'type':Sequelize[_0x9009('0x1')]},'destuniqueid':{'type':Sequelize[_0x9009('0x1')]},'messageId':{'type':Sequelize[_0x9009('0x1')]},'inReplyTo':{'type':Sequelize[_0x9009('0x1')]},'subject':{'type':Sequelize[_0x9009('0x1')]},'from':{'type':Sequelize[_0x9009('0x1')]},'to':{'type':Sequelize[_0x9009('0x1')]},'cc':{'type':Sequelize[_0x9009('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x9009('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x9009('0x6')](_0x9009('0x7'),_0x9009('0x8'),'RECEIVED',_0x9009('0x9'))},'url':{'type':Sequelize[_0x9009('0x1')]},'app':{'type':Sequelize[_0x9009('0x1')]},'appdata':{'type':Sequelize[_0x9009('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 20411af..cb445f9 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 _0xd009=['include','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','describe','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','limit','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','IntegrationReport','fieldName','type','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','offset','order','sort','where','pick','filters','filter','VIRTUAL','merge','options'];(function(_0x31a542,_0x14e19f){var _0xabbef4=function(_0x159a69){while(--_0x159a69){_0x31a542['push'](_0x31a542['shift']());}};_0xabbef4(++_0x14e19f);}(_0xd009,0x1df));var _0x9d00=function(_0x2803d1,_0x4c3125){_0x2803d1=_0x2803d1-0x0;var _0x2586a1=_0xd009[_0x2803d1];return _0x2586a1;};'use strict';var pdf=require(_0x9d00('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9d00('0x1'));var jsonpatch=require(_0x9d00('0x2'));var rp=require(_0x9d00('0x3'));var moment=require('moment');var BPromise=require(_0x9d00('0x4'));var Mustache=require('mustache');var util=require(_0x9d00('0x5'));var path=require(_0x9d00('0x6'));var sox=require(_0x9d00('0x7'));var csv=require(_0x9d00('0x8'));var ejs=require(_0x9d00('0x9'));var fs=require('fs');var _=require(_0x9d00('0xa'));var squel=require(_0x9d00('0xb'));var crypto=require(_0x9d00('0xc'));var jsforce=require(_0x9d00('0xd'));var deskjs=require(_0x9d00('0xe'));var toCsv=require(_0x9d00('0x8'));var querystring=require(_0x9d00('0xf'));var Papa=require(_0x9d00('0x10'));var Redis=require(_0x9d00('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9d00('0x12'));var as=require(_0x9d00('0x13'));var hardwareService=require(_0x9d00('0x14'));var logger=require(_0x9d00('0x15'))(_0x9d00('0x16'));var utils=require(_0x9d00('0x17'));var config=require(_0x9d00('0x18'));var licenseUtil=require(_0x9d00('0x19'));var db=require(_0x9d00('0x1a'))['db'];function respondWithStatusCode(_0x1844b4,_0x4cdb3d){_0x4cdb3d=_0x4cdb3d||0xcc;return function(_0x5b790e){if(_0x5b790e){return _0x1844b4[_0x9d00('0x1b')](_0x4cdb3d);}return _0x1844b4[_0x9d00('0x1c')](_0x4cdb3d)[_0x9d00('0x1d')]();};}function respondWithResult(_0x4fbc75,_0x3b82d3){_0x3b82d3=_0x3b82d3||0xc8;return function(_0xa8b396){if(_0xa8b396){return _0x4fbc75[_0x9d00('0x1c')](_0x3b82d3)['json'](_0xa8b396);}};}function respondWithFilteredResult(_0x461eb0,_0x25a94b){return function(_0x4ebe40){if(_0x4ebe40){var _0x25bed8=_0x4ebe40[_0x9d00('0x1e')],_0x399327=_0x25a94b['offset'],_0xbf4d94=_0x25a94b['offset']+_0x25a94b[_0x9d00('0x1f')],_0x198df6;if(_0xbf4d94>=_0x25bed8){_0xbf4d94=_0x25bed8;_0x198df6=0xc8;}else{_0x198df6=0xce;}_0x461eb0['status'](_0x198df6);return _0x461eb0['set'](_0x9d00('0x20'),_0x399327+'-'+_0xbf4d94+'/'+_0x25bed8)[_0x9d00('0x21')](_0x4ebe40);}return null;};}function patchUpdates(_0x2e80d7){return function(_0x6299a5){try{jsonpatch[_0x9d00('0x22')](_0x6299a5,_0x2e80d7,!![]);}catch(_0x718075){return BPromise[_0x9d00('0x23')](_0x718075);}return _0x6299a5[_0x9d00('0x24')]();};}function saveUpdates(_0x22914e,_0x51c759){return function(_0x49b318){if(_0x49b318){return _0x49b318[_0x9d00('0x25')](_0x22914e)['then'](function(_0x16bc94){return _0x16bc94;});}return null;};}function removeEntity(_0x4f4e4d,_0x35e5b7){return function(_0x553e28){if(_0x553e28){return _0x553e28[_0x9d00('0x26')]()[_0x9d00('0x27')](function(){_0x4f4e4d[_0x9d00('0x1c')](0xcc)[_0x9d00('0x1d')]();});}};}function handleEntityNotFound(_0x5cea3a,_0x3c96f8){return function(_0x2d0d4b){if(!_0x2d0d4b){_0x5cea3a[_0x9d00('0x1b')](0x194);}return _0x2d0d4b;};}function handleError(_0x267ebc,_0x28b5d4){_0x28b5d4=_0x28b5d4||0x1f4;return function(_0x264b58){logger[_0x9d00('0x28')](_0x264b58[_0x9d00('0x29')]);if(_0x264b58[_0x9d00('0x2a')]){delete _0x264b58['name'];}_0x267ebc[_0x9d00('0x1c')](_0x28b5d4)[_0x9d00('0x2b')](_0x264b58);};}exports[_0x9d00('0x2c')]=function(_0x49f591,_0x56a375){var _0x458ffe={},_0xf9f89e={},_0x30cfd3={'count':0x0,'rows':[]};var _0x221b59=_[_0x9d00('0x2d')](db[_0x9d00('0x2e')]['rawAttributes'],function(_0x412463){return{'name':_0x412463[_0x9d00('0x2f')],'type':_0x412463[_0x9d00('0x30')][_0x9d00('0x31')]};});_0xf9f89e[_0x9d00('0x32')]=_['map'](_0x221b59,_0x9d00('0x2a'));_0xf9f89e['query']=_[_0x9d00('0x33')](_0x49f591['query']);_0xf9f89e['filters']=_[_0x9d00('0x34')](_0xf9f89e['model'],_0xf9f89e[_0x9d00('0x35')]);_0x458ffe[_0x9d00('0x36')]=_['intersection'](_0xf9f89e[_0x9d00('0x32')],qs[_0x9d00('0x37')](_0x49f591[_0x9d00('0x35')][_0x9d00('0x37')]));_0x458ffe['attributes']=_0x458ffe[_0x9d00('0x36')]['length']?_0x458ffe['attributes']:_0xf9f89e['model'];if(!_0x49f591[_0x9d00('0x35')][_0x9d00('0x38')]('nolimit')){_0x458ffe[_0x9d00('0x1f')]=qs[_0x9d00('0x1f')](_0x49f591[_0x9d00('0x35')][_0x9d00('0x1f')]);_0x458ffe[_0x9d00('0x39')]=qs[_0x9d00('0x39')](_0x49f591[_0x9d00('0x35')][_0x9d00('0x39')]);}_0x458ffe[_0x9d00('0x3a')]=qs[_0x9d00('0x3b')](_0x49f591[_0x9d00('0x35')][_0x9d00('0x3b')]);_0x458ffe[_0x9d00('0x3c')]=qs['filters'](_[_0x9d00('0x3d')](_0x49f591[_0x9d00('0x35')],_0xf9f89e[_0x9d00('0x3e')]),_0x221b59);if(_0x49f591[_0x9d00('0x35')][_0x9d00('0x3f')]){_0x458ffe[_0x9d00('0x3c')]=_['merge'](_0x458ffe[_0x9d00('0x3c')],{'$or':_[_0x9d00('0x2d')](_0x221b59,function(_0x3733a8){if(_0x3733a8[_0x9d00('0x30')]!==_0x9d00('0x40')){var _0x5583f0={};_0x5583f0[_0x3733a8[_0x9d00('0x2a')]]={'$like':'%'+_0x49f591[_0x9d00('0x35')][_0x9d00('0x3f')]+'%'};return _0x5583f0;}})});}_0x458ffe=_[_0x9d00('0x41')]({},_0x458ffe,_0x49f591[_0x9d00('0x42')]);var _0x52ab38={'where':_0x458ffe['where']};return db['IntegrationReport'][_0x9d00('0x1e')](_0x52ab38)[_0x9d00('0x27')](function(_0x2866bf){_0x30cfd3[_0x9d00('0x1e')]=_0x2866bf;if(_0x49f591[_0x9d00('0x35')]['includeAll']){_0x458ffe[_0x9d00('0x43')]=[{'all':!![]}];}return db[_0x9d00('0x2e')][_0x9d00('0x44')](_0x458ffe);})[_0x9d00('0x27')](function(_0x2bbb58){_0x30cfd3['rows']=_0x2bbb58;return _0x30cfd3;})[_0x9d00('0x27')](respondWithFilteredResult(_0x56a375,_0x458ffe))[_0x9d00('0x45')](handleError(_0x56a375,null));};exports[_0x9d00('0x46')]=function(_0x3a0653,_0xb8e3e){var _0x213788={'raw':![],'where':{'id':_0x3a0653[_0x9d00('0x47')]['id']}},_0xfe9cf={};_0xfe9cf[_0x9d00('0x32')]=_[_0x9d00('0x33')](db['IntegrationReport'][_0x9d00('0x48')]);_0xfe9cf[_0x9d00('0x35')]=_[_0x9d00('0x33')](_0x3a0653[_0x9d00('0x35')]);_0xfe9cf[_0x9d00('0x3e')]=_[_0x9d00('0x34')](_0xfe9cf['model'],_0xfe9cf[_0x9d00('0x35')]);_0x213788[_0x9d00('0x36')]=_[_0x9d00('0x34')](_0xfe9cf['model'],qs[_0x9d00('0x37')](_0x3a0653[_0x9d00('0x35')][_0x9d00('0x37')]));_0x213788[_0x9d00('0x36')]=_0x213788['attributes']['length']?_0x213788[_0x9d00('0x36')]:_0xfe9cf[_0x9d00('0x32')];if(_0x3a0653[_0x9d00('0x35')][_0x9d00('0x49')]){_0x213788[_0x9d00('0x43')]=[{'all':!![]}];}_0x213788=_['merge']({},_0x213788,_0x3a0653[_0x9d00('0x42')]);return db[_0x9d00('0x2e')][_0x9d00('0x4a')](_0x213788)[_0x9d00('0x27')](handleEntityNotFound(_0xb8e3e,null))[_0x9d00('0x27')](respondWithResult(_0xb8e3e,null))[_0x9d00('0x45')](handleError(_0xb8e3e,null));};exports['create']=function(_0xd17880,_0x2bc8f6){return db[_0x9d00('0x2e')][_0x9d00('0x4b')](_0xd17880[_0x9d00('0x4c')],{})[_0x9d00('0x27')](respondWithResult(_0x2bc8f6,0xc9))[_0x9d00('0x45')](handleError(_0x2bc8f6,null));};exports['update']=function(_0xe39af1,_0x5097dc){if(_0xe39af1[_0x9d00('0x4c')]['id']){delete _0xe39af1['body']['id'];}return db[_0x9d00('0x2e')]['find']({'where':{'id':_0xe39af1['params']['id']}})[_0x9d00('0x27')](handleEntityNotFound(_0x5097dc,null))[_0x9d00('0x27')](saveUpdates(_0xe39af1[_0x9d00('0x4c')],null))[_0x9d00('0x27')](respondWithResult(_0x5097dc,null))['catch'](handleError(_0x5097dc,null));};exports[_0x9d00('0x26')]=function(_0xa1d20d,_0x41da98){return db['IntegrationReport'][_0x9d00('0x4a')]({'where':{'id':_0xa1d20d[_0x9d00('0x47')]['id']}})[_0x9d00('0x27')](handleEntityNotFound(_0x41da98,null))[_0x9d00('0x27')](removeEntity(_0x41da98,null))['catch'](handleError(_0x41da98,null));};exports[_0x9d00('0x4d')]=function(_0x903e62,_0x1c2688){return db[_0x9d00('0x2e')]['describe']()['then'](respondWithResult(_0x1c2688,null))[_0x9d00('0x45')](handleError(_0x1c2688,null));}; \ No newline at end of file +var _0x127d=['findAll','rows','catch','show','params','includeAll','find','create','body','describe','html-pdf','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','map','IntegrationReport','rawAttributes','key','model','keys','query','intersection','fields','attributes','length','order','sort','where','filters','pick','filter','type','merge','options','include'];(function(_0x3360f3,_0x344f01){var _0x45e856=function(_0x588d0c){while(--_0x588d0c){_0x3360f3['push'](_0x3360f3['shift']());}};_0x45e856(++_0x344f01);}(_0x127d,0x1b4));var _0xd127=function(_0xbd13f0,_0x3de5e2){_0xbd13f0=_0xbd13f0-0x0;var _0x5f561b=_0x127d[_0xbd13f0];return _0x5f561b;};'use strict';var pdf=require(_0xd127('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd127('0x1'));var moment=require(_0xd127('0x2'));var BPromise=require(_0xd127('0x3'));var Mustache=require('mustache');var util=require(_0xd127('0x4'));var path=require(_0xd127('0x5'));var sox=require('sox');var csv=require(_0xd127('0x6'));var ejs=require(_0xd127('0x7'));var fs=require('fs');var _=require(_0xd127('0x8'));var squel=require(_0xd127('0x9'));var crypto=require(_0xd127('0xa'));var jsforce=require(_0xd127('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd127('0x6'));var querystring=require(_0xd127('0xc'));var Papa=require(_0xd127('0xd'));var Redis=require(_0xd127('0xe'));var authService=require(_0xd127('0xf'));var qs=require(_0xd127('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd127('0x11'));var logger=require(_0xd127('0x12'))(_0xd127('0x13'));var utils=require(_0xd127('0x14'));var config=require(_0xd127('0x15'));var licenseUtil=require(_0xd127('0x16'));var db=require(_0xd127('0x17'))['db'];function respondWithStatusCode(_0x49a276,_0x15ed7d){_0x15ed7d=_0x15ed7d||0xcc;return function(_0x51a9f4){if(_0x51a9f4){return _0x49a276['sendStatus'](_0x15ed7d);}return _0x49a276[_0xd127('0x18')](_0x15ed7d)['end']();};}function respondWithResult(_0x31a140,_0x243c0f){_0x243c0f=_0x243c0f||0xc8;return function(_0x56f7cc){if(_0x56f7cc){return _0x31a140[_0xd127('0x18')](_0x243c0f)['json'](_0x56f7cc);}};}function respondWithFilteredResult(_0xf92407,_0x356eb5){return function(_0x3bf869){if(_0x3bf869){var _0x21c930=_0x3bf869[_0xd127('0x19')],_0x40a392=_0x356eb5[_0xd127('0x1a')],_0x5dc559=_0x356eb5['offset']+_0x356eb5[_0xd127('0x1b')],_0x4bc3e0;if(_0x5dc559>=_0x21c930){_0x5dc559=_0x21c930;_0x4bc3e0=0xc8;}else{_0x4bc3e0=0xce;}_0xf92407['status'](_0x4bc3e0);return _0xf92407['set'](_0xd127('0x1c'),_0x40a392+'-'+_0x5dc559+'/'+_0x21c930)[_0xd127('0x1d')](_0x3bf869);}return null;};}function patchUpdates(_0x1936af){return function(_0x1055c0){try{jsonpatch[_0xd127('0x1e')](_0x1055c0,_0x1936af,!![]);}catch(_0x2d1fe2){return BPromise[_0xd127('0x1f')](_0x2d1fe2);}return _0x1055c0[_0xd127('0x20')]();};}function saveUpdates(_0x2b9e31,_0x41f72f){return function(_0x1c2fc1){if(_0x1c2fc1){return _0x1c2fc1['update'](_0x2b9e31)[_0xd127('0x21')](function(_0x2b0511){return _0x2b0511;});}return null;};}function removeEntity(_0x1a65b0,_0x1f252a){return function(_0x3c380f){if(_0x3c380f){return _0x3c380f[_0xd127('0x22')]()[_0xd127('0x21')](function(){_0x1a65b0[_0xd127('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59faf7,_0x1459bc){return function(_0x35bef2){if(!_0x35bef2){_0x59faf7[_0xd127('0x23')](0x194);}return _0x35bef2;};}function handleError(_0x38a6b4,_0x2072d3){_0x2072d3=_0x2072d3||0x1f4;return function(_0x2e4af4){logger['error'](_0x2e4af4[_0xd127('0x24')]);if(_0x2e4af4[_0xd127('0x25')]){delete _0x2e4af4[_0xd127('0x25')];}_0x38a6b4[_0xd127('0x18')](_0x2072d3)[_0xd127('0x26')](_0x2e4af4);};}exports[_0xd127('0x27')]=function(_0x266a71,_0x247241){var _0x37c8f1={},_0x29d2f0={},_0x1fc103={'count':0x0,'rows':[]};var _0x2b6518=_[_0xd127('0x28')](db[_0xd127('0x29')][_0xd127('0x2a')],function(_0x1ec783){return{'name':_0x1ec783['fieldName'],'type':_0x1ec783['type'][_0xd127('0x2b')]};});_0x29d2f0[_0xd127('0x2c')]=_[_0xd127('0x28')](_0x2b6518,_0xd127('0x25'));_0x29d2f0['query']=_[_0xd127('0x2d')](_0x266a71[_0xd127('0x2e')]);_0x29d2f0['filters']=_[_0xd127('0x2f')](_0x29d2f0[_0xd127('0x2c')],_0x29d2f0[_0xd127('0x2e')]);_0x37c8f1['attributes']=_[_0xd127('0x2f')](_0x29d2f0['model'],qs[_0xd127('0x30')](_0x266a71[_0xd127('0x2e')][_0xd127('0x30')]));_0x37c8f1[_0xd127('0x31')]=_0x37c8f1[_0xd127('0x31')][_0xd127('0x32')]?_0x37c8f1[_0xd127('0x31')]:_0x29d2f0[_0xd127('0x2c')];if(!_0x266a71[_0xd127('0x2e')]['hasOwnProperty']('nolimit')){_0x37c8f1['limit']=qs[_0xd127('0x1b')](_0x266a71[_0xd127('0x2e')][_0xd127('0x1b')]);_0x37c8f1[_0xd127('0x1a')]=qs[_0xd127('0x1a')](_0x266a71[_0xd127('0x2e')][_0xd127('0x1a')]);}_0x37c8f1[_0xd127('0x33')]=qs[_0xd127('0x34')](_0x266a71['query'][_0xd127('0x34')]);_0x37c8f1[_0xd127('0x35')]=qs[_0xd127('0x36')](_[_0xd127('0x37')](_0x266a71[_0xd127('0x2e')],_0x29d2f0['filters']),_0x2b6518);if(_0x266a71[_0xd127('0x2e')][_0xd127('0x38')]){_0x37c8f1[_0xd127('0x35')]=_['merge'](_0x37c8f1[_0xd127('0x35')],{'$or':_[_0xd127('0x28')](_0x2b6518,function(_0x6fdbec){if(_0x6fdbec[_0xd127('0x39')]!=='VIRTUAL'){var _0x1a29c0={};_0x1a29c0[_0x6fdbec[_0xd127('0x25')]]={'$like':'%'+_0x266a71[_0xd127('0x2e')][_0xd127('0x38')]+'%'};return _0x1a29c0;}})});}_0x37c8f1=_[_0xd127('0x3a')]({},_0x37c8f1,_0x266a71[_0xd127('0x3b')]);var _0x4dfae5={'where':_0x37c8f1['where']};return db['IntegrationReport'][_0xd127('0x19')](_0x4dfae5)['then'](function(_0xfd1634){_0x1fc103['count']=_0xfd1634;if(_0x266a71[_0xd127('0x2e')]['includeAll']){_0x37c8f1[_0xd127('0x3c')]=[{'all':!![]}];}return db['IntegrationReport'][_0xd127('0x3d')](_0x37c8f1);})['then'](function(_0x40c862){_0x1fc103[_0xd127('0x3e')]=_0x40c862;return _0x1fc103;})['then'](respondWithFilteredResult(_0x247241,_0x37c8f1))[_0xd127('0x3f')](handleError(_0x247241,null));};exports[_0xd127('0x40')]=function(_0x2bd08a,_0x12d9ab){var _0x43aca7={'raw':![],'where':{'id':_0x2bd08a[_0xd127('0x41')]['id']}},_0x516749={};_0x516749[_0xd127('0x2c')]=_[_0xd127('0x2d')](db[_0xd127('0x29')][_0xd127('0x2a')]);_0x516749[_0xd127('0x2e')]=_[_0xd127('0x2d')](_0x2bd08a[_0xd127('0x2e')]);_0x516749[_0xd127('0x36')]=_[_0xd127('0x2f')](_0x516749[_0xd127('0x2c')],_0x516749[_0xd127('0x2e')]);_0x43aca7[_0xd127('0x31')]=_['intersection'](_0x516749[_0xd127('0x2c')],qs['fields'](_0x2bd08a['query'][_0xd127('0x30')]));_0x43aca7[_0xd127('0x31')]=_0x43aca7['attributes'][_0xd127('0x32')]?_0x43aca7['attributes']:_0x516749[_0xd127('0x2c')];if(_0x2bd08a[_0xd127('0x2e')][_0xd127('0x42')]){_0x43aca7[_0xd127('0x3c')]=[{'all':!![]}];}_0x43aca7=_[_0xd127('0x3a')]({},_0x43aca7,_0x2bd08a[_0xd127('0x3b')]);return db[_0xd127('0x29')][_0xd127('0x43')](_0x43aca7)['then'](handleEntityNotFound(_0x12d9ab,null))[_0xd127('0x21')](respondWithResult(_0x12d9ab,null))[_0xd127('0x3f')](handleError(_0x12d9ab,null));};exports[_0xd127('0x44')]=function(_0x2188a7,_0x57e6bc){return db['IntegrationReport'][_0xd127('0x44')](_0x2188a7[_0xd127('0x45')],{})['then'](respondWithResult(_0x57e6bc,0xc9))['catch'](handleError(_0x57e6bc,null));};exports['update']=function(_0x1d1212,_0xd7bfc3){if(_0x1d1212['body']['id']){delete _0x1d1212[_0xd127('0x45')]['id'];}return db['IntegrationReport'][_0xd127('0x43')]({'where':{'id':_0x1d1212[_0xd127('0x41')]['id']}})['then'](handleEntityNotFound(_0xd7bfc3,null))[_0xd127('0x21')](saveUpdates(_0x1d1212[_0xd127('0x45')],null))[_0xd127('0x21')](respondWithResult(_0xd7bfc3,null))[_0xd127('0x3f')](handleError(_0xd7bfc3,null));};exports[_0xd127('0x22')]=function(_0x57021b,_0x2bab70){return db[_0xd127('0x29')][_0xd127('0x43')]({'where':{'id':_0x57021b[_0xd127('0x41')]['id']}})[_0xd127('0x21')](handleEntityNotFound(_0x2bab70,null))[_0xd127('0x21')](removeEntity(_0x2bab70,null))[_0xd127('0x3f')](handleError(_0x2bab70,null));};exports[_0xd127('0x46')]=function(_0x33654e,_0x66d416){return db['IntegrationReport']['describe']()[_0xd127('0x21')](respondWithResult(_0x66d416,null))[_0xd127('0x3f')](handleError(_0x66d416,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 0441e57..101efef 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 _0x93e1=['api','moment','path','rimraf','../../config/environment','define','IntegrationReport','report_integration','util'];(function(_0xe73bdd,_0x6fa765){var _0xa9f84a=function(_0x44cdea){while(--_0x44cdea){_0xe73bdd['push'](_0xe73bdd['shift']());}};_0xa9f84a(++_0x6fa765);}(_0x93e1,0x104));var _0x193e=function(_0x479db7,_0x2e5a83){_0x479db7=_0x479db7-0x0;var _0x4a8fad=_0x93e1[_0x479db7];return _0x4a8fad;};'use strict';var _=require('lodash');var util=require(_0x193e('0x0'));var logger=require('../../config/logger')(_0x193e('0x1'));var moment=require(_0x193e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x193e('0x3'));var rimraf=require(_0x193e('0x4'));var config=require(_0x193e('0x5'));var attributes=require('./integrationReport.attributes');module['exports']=function(_0x56798b,_0x26affd){return _0x56798b[_0x193e('0x6')](_0x193e('0x7'),attributes,{'tableName':_0x193e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27ac=['util','../../config/logger','api','moment','bluebird','../../config/environment','./integrationReport.attributes','report_integration','lodash'];(function(_0x2e8b4f,_0x1b893b){var _0x214328=function(_0x417bb3){while(--_0x417bb3){_0x2e8b4f['push'](_0x2e8b4f['shift']());}};_0x214328(++_0x1b893b);}(_0x27ac,0x194));var _0xc27a=function(_0x4c5b19,_0x4d16ac){_0x4c5b19=_0x4c5b19-0x0;var _0x245588=_0x27ac[_0x4c5b19];return _0x245588;};'use strict';var _=require(_0xc27a('0x0'));var util=require(_0xc27a('0x1'));var logger=require(_0xc27a('0x2'))(_0xc27a('0x3'));var moment=require(_0xc27a('0x4'));var BPromise=require(_0xc27a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc27a('0x6'));var attributes=require(_0xc27a('0x7'));module['exports']=function(_0x50106a,_0x4cac40){return _0x50106a['define']('IntegrationReport',attributes,{'tableName':_0xc27a('0x8'),'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 d15b964..bb1129f 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x32b122,_0x1ad490){var _0x4ad25a=function(_0x590ee6){while(--_0x590ee6){_0x32b122['push'](_0x32b122['shift']());}};_0x4ad25a(++_0x1ad490);}(_0xda3f,0xec));var _0xfda3=function(_0x493aed,_0x5a9212){_0x493aed=_0x493aed-0x0;var _0x104d1c=_0xda3f[_0x493aed];return _0x104d1c;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('IntegrationReport,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('IntegrationReport,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0xf13ca6,_0x5735ea){var _0x4a4387=function(_0x103f67){while(--_0x103f67){_0xf13ca6['push'](_0xf13ca6['shift']());}};_0x4a4387(++_0x5735ea);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 35813c4..ef05539 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 _0x9c44=['../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','addInterval','addIntervals','put','update','destroy','exports','path','connect-timeout','express','Router'];(function(_0x43f8e4,_0x3218e9){var _0x143d10=function(_0x4ca4af){while(--_0x4ca4af){_0x43f8e4['push'](_0x43f8e4['shift']());}};_0x143d10(++_0x3218e9);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x49c4('0xd')](_0x49c4('0xb'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);router[_0x49c4('0xd')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0x11')]);router['delete'](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x12')]);module[_0x49c4('0x13')]=router; \ No newline at end of file +var _0x9c44=['../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','addInterval','addIntervals','put','update','destroy','exports','path','connect-timeout','express','Router'];(function(_0x1ad7fc,_0x111149){var _0x8d1fdb=function(_0x2cca4e){while(--_0x2cca4e){_0x1ad7fc['push'](_0x1ad7fc['shift']());}};_0x8d1fdb(++_0x111149);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x49c4('0xd')](_0x49c4('0xb'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);router[_0x49c4('0xd')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0x11')]);router['delete'](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x12')]);module[_0x49c4('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 68cfebc..28fd8d5 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 _0x0e39=['STRING'];(function(_0x540dcb,_0x4eacb6){var _0x49353c=function(_0x449bb1){while(--_0x449bb1){_0x540dcb['push'](_0x540dcb['shift']());}};_0x49353c(++_0x4eacb6);}(_0x0e39,0x198));var _0x90e3=function(_0x42701f,_0x3d2f90){_0x42701f=_0x42701f-0x0;var _0x36aafb=_0x0e39[_0x42701f];return _0x36aafb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x90e3('0x0')]},'interval':{'type':Sequelize[_0x90e3('0x0')],'allowNull':!![]}}; \ No newline at end of file +var _0x3b97=['STRING','sequelize'];(function(_0x4a017d,_0xf03e02){var _0x56e7bc=function(_0x3d7228){while(--_0x3d7228){_0x4a017d['push'](_0x4a017d['shift']());}};_0x56e7bc(++_0xf03e02);}(_0x3b97,0x1a5));var _0x73b9=function(_0x57e195,_0x103770){_0x57e195=_0x57e195-0x0;var _0x4f1230=_0x3b97[_0x57e195];return _0x4f1230;};'use strict';var Sequelize=require(_0x73b9('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x73b9('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 1539bd9..23bfe3f 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 _0x7adc=['get','UserProfileResource','destroy','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','catch','show','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Intervals','UserProfileSection','autoAssociation','update','params','IntervalId','getIntervals','findOne','sequelize','transaction','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','to-csv','ejs','lodash','squel','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','json','offset','limit','apply','reject','save','then'];(function(_0x58502e,_0x5c65cd){var _0x584762=function(_0xf9eb){while(--_0xf9eb){_0x58502e['push'](_0x58502e['shift']());}};_0x584762(++_0x5c65cd);}(_0x7adc,0x13b));var _0xc7ad=function(_0x33c1b1,_0x2355fb){_0x33c1b1=_0x33c1b1-0x0;var _0x2c2037=_0x7adc[_0x33c1b1];return _0x2c2037;};'use strict';var pdf=require(_0xc7ad('0x0'));var emlformat=require(_0xc7ad('0x1'));var rimraf=require(_0xc7ad('0x2'));var zipdir=require(_0xc7ad('0x3'));var jsonpatch=require(_0xc7ad('0x4'));var rp=require('request-promise');var moment=require(_0xc7ad('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc7ad('0x6'));var ejs=require(_0xc7ad('0x7'));var fs=require('fs');var _=require(_0xc7ad('0x8'));var squel=require(_0xc7ad('0x9'));var crypto=require('crypto');var jsforce=require(_0xc7ad('0xa'));var deskjs=require(_0xc7ad('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc7ad('0xc'));var Papa=require(_0xc7ad('0xd'));var Redis=require('ioredis');var authService=require(_0xc7ad('0xe'));var qs=require(_0xc7ad('0xf'));var as=require(_0xc7ad('0x10'));var hardwareService=require(_0xc7ad('0x11'));var logger=require(_0xc7ad('0x12'))(_0xc7ad('0x13'));var utils=require(_0xc7ad('0x14'));var config=require(_0xc7ad('0x15'));var licenseUtil=require(_0xc7ad('0x16'));var db=require(_0xc7ad('0x17'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x4d781f,_0x2419f9){_0x2419f9=_0x2419f9||0xcc;return function(_0x2f5f30){if(_0x2f5f30){return _0x4d781f[_0xc7ad('0x18')](_0x2419f9);}return _0x4d781f[_0xc7ad('0x19')](_0x2419f9)['end']();};}function respondWithResult(_0x27ce19,_0x3aec75){_0x3aec75=_0x3aec75||0xc8;return function(_0x4b2729){if(_0x4b2729){return _0x27ce19['status'](_0x3aec75)[_0xc7ad('0x1a')](_0x4b2729);}};}function respondWithFilteredResult(_0x4f551d,_0xfdc2b8){return function(_0x1c996d){if(_0x1c996d){var _0x4f1b57=_0x1c996d['count'],_0x175aa4=_0xfdc2b8[_0xc7ad('0x1b')],_0x3e1ab2=_0xfdc2b8[_0xc7ad('0x1b')]+_0xfdc2b8[_0xc7ad('0x1c')],_0x4fde59;if(_0x3e1ab2>=_0x4f1b57){_0x3e1ab2=_0x4f1b57;_0x4fde59=0xc8;}else{_0x4fde59=0xce;}_0x4f551d[_0xc7ad('0x19')](_0x4fde59);return _0x4f551d['set']('Content-Range',_0x175aa4+'-'+_0x3e1ab2+'/'+_0x4f1b57)[_0xc7ad('0x1a')](_0x1c996d);}return null;};}function patchUpdates(_0x564985){return function(_0x113af4){try{jsonpatch[_0xc7ad('0x1d')](_0x113af4,_0x564985,!![]);}catch(_0x5d816e){return BPromise[_0xc7ad('0x1e')](_0x5d816e);}return _0x113af4[_0xc7ad('0x1f')]();};}function saveUpdates(_0x4bb131,_0xee74a5){return function(_0x497198){if(_0x497198){return _0x497198['update'](_0x4bb131)[_0xc7ad('0x20')](function(_0x213f61){return _0x213f61;});}return null;};}function removeEntity(_0x7df084,_0x14065a){return function(_0x17aac3){if(_0x17aac3){return _0x17aac3['destroy']()['then'](function(){var _0x328e92=_0x17aac3[_0xc7ad('0x21')]({'plain':!![]});var _0x2580a7='Intervals';return db[_0xc7ad('0x22')][_0xc7ad('0x23')]({'where':{'type':_0x2580a7,'resourceId':_0x328e92['id']}})[_0xc7ad('0x20')](function(){return _0x17aac3;});})[_0xc7ad('0x20')](function(){_0x7df084[_0xc7ad('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21cfae,_0x3b110e){return function(_0x3a7049){if(!_0x3a7049){_0x21cfae[_0xc7ad('0x18')](0x194);}return _0x3a7049;};}function handleError(_0x286a63,_0x18882f){_0x18882f=_0x18882f||0x1f4;return function(_0x3ddda4){logger[_0xc7ad('0x24')](_0x3ddda4[_0xc7ad('0x25')]);if(_0x3ddda4[_0xc7ad('0x26')]){delete _0x3ddda4[_0xc7ad('0x26')];}_0x286a63[_0xc7ad('0x19')](_0x18882f)[_0xc7ad('0x27')](_0x3ddda4);};}exports[_0xc7ad('0x28')]=function(_0x115fac,_0x53ec23){var _0x3c026e={},_0x19e732={},_0x435336={'count':0x0,'rows':[]};var _0x43a734=_[_0xc7ad('0x29')](db[_0xc7ad('0x2a')][_0xc7ad('0x2b')],function(_0x2616ed){return{'name':_0x2616ed[_0xc7ad('0x2c')],'type':_0x2616ed[_0xc7ad('0x2d')][_0xc7ad('0x2e')]};});_0x19e732[_0xc7ad('0x2f')]=_[_0xc7ad('0x29')](_0x43a734,_0xc7ad('0x26'));_0x19e732[_0xc7ad('0x30')]=_[_0xc7ad('0x31')](_0x115fac['query']);_0x19e732[_0xc7ad('0x32')]=_[_0xc7ad('0x33')](_0x19e732['model'],_0x19e732[_0xc7ad('0x30')]);_0x3c026e[_0xc7ad('0x34')]=_[_0xc7ad('0x33')](_0x19e732['model'],qs['fields'](_0x115fac[_0xc7ad('0x30')][_0xc7ad('0x35')]));_0x3c026e[_0xc7ad('0x34')]=_0x3c026e[_0xc7ad('0x34')][_0xc7ad('0x36')]?_0x3c026e[_0xc7ad('0x34')]:_0x19e732[_0xc7ad('0x2f')];if(!_0x115fac[_0xc7ad('0x30')][_0xc7ad('0x37')](_0xc7ad('0x38'))){_0x3c026e[_0xc7ad('0x1c')]=qs[_0xc7ad('0x1c')](_0x115fac[_0xc7ad('0x30')][_0xc7ad('0x1c')]);_0x3c026e[_0xc7ad('0x1b')]=qs[_0xc7ad('0x1b')](_0x115fac[_0xc7ad('0x30')]['offset']);}_0x3c026e[_0xc7ad('0x39')]=qs[_0xc7ad('0x3a')](_0x115fac['query'][_0xc7ad('0x3a')]);_0x3c026e[_0xc7ad('0x3b')]=qs[_0xc7ad('0x32')](_[_0xc7ad('0x3c')](_0x115fac[_0xc7ad('0x30')],_0x19e732[_0xc7ad('0x32')]),_0x43a734);if(_0x115fac[_0xc7ad('0x30')][_0xc7ad('0x3d')]){_0x3c026e[_0xc7ad('0x3b')]=_[_0xc7ad('0x3e')](_0x3c026e[_0xc7ad('0x3b')],{'$or':_[_0xc7ad('0x29')](_0x43a734,function(_0x4f5c6e){if(_0x4f5c6e[_0xc7ad('0x2d')]!=='VIRTUAL'){var _0x3053e2={};_0x3053e2[_0x4f5c6e[_0xc7ad('0x26')]]={'$like':'%'+_0x115fac['query'][_0xc7ad('0x3d')]+'%'};return _0x3053e2;}})});}_0x3c026e=_['merge']({},_0x3c026e,_0x115fac[_0xc7ad('0x3f')]);var _0x2dd3fe={'where':_0x3c026e[_0xc7ad('0x3b')]};return db[_0xc7ad('0x2a')][_0xc7ad('0x40')](_0x2dd3fe)[_0xc7ad('0x20')](function(_0x41b9c9){_0x435336['count']=_0x41b9c9;if(_0x115fac[_0xc7ad('0x30')][_0xc7ad('0x41')]){_0x3c026e['include']=[{'all':!![]}];}return db['Interval'][_0xc7ad('0x42')](_0x3c026e);})[_0xc7ad('0x20')](function(_0x17d76d){_0x435336['rows']=_0x17d76d;return _0x435336;})[_0xc7ad('0x20')](respondWithFilteredResult(_0x53ec23,_0x3c026e))[_0xc7ad('0x43')](handleError(_0x53ec23,null));};exports[_0xc7ad('0x44')]=function(_0x417532,_0x4ff8d3){var _0x56afec={'raw':!![],'where':{'id':_0x417532['params']['id']}},_0x22db44={};_0x22db44[_0xc7ad('0x2f')]=_[_0xc7ad('0x31')](db['Interval']['rawAttributes']);_0x22db44['query']=_[_0xc7ad('0x31')](_0x417532['query']);_0x22db44['filters']=_[_0xc7ad('0x33')](_0x22db44[_0xc7ad('0x2f')],_0x22db44['query']);_0x56afec[_0xc7ad('0x34')]=_[_0xc7ad('0x33')](_0x22db44[_0xc7ad('0x2f')],qs['fields'](_0x417532[_0xc7ad('0x30')][_0xc7ad('0x35')]));_0x56afec[_0xc7ad('0x34')]=_0x56afec['attributes'][_0xc7ad('0x36')]?_0x56afec['attributes']:_0x22db44[_0xc7ad('0x2f')];if(_0x417532['query'][_0xc7ad('0x41')]){_0x56afec[_0xc7ad('0x45')]=[{'all':!![]}];}_0x56afec=_[_0xc7ad('0x3e')]({},_0x56afec,_0x417532[_0xc7ad('0x3f')]);return db[_0xc7ad('0x2a')][_0xc7ad('0x46')](_0x56afec)[_0xc7ad('0x20')](handleEntityNotFound(_0x4ff8d3,null))[_0xc7ad('0x20')](respondWithResult(_0x4ff8d3,null))[_0xc7ad('0x43')](handleError(_0x4ff8d3,null));};exports[_0xc7ad('0x47')]=function(_0x1dfbd4,_0x40a547){return db[_0xc7ad('0x2a')][_0xc7ad('0x47')](_0x1dfbd4[_0xc7ad('0x48')],{})[_0xc7ad('0x20')](function(_0x245e31){var _0x1e0ec1=_0x1dfbd4['user'][_0xc7ad('0x21')]({'plain':!![]});if(!_0x1e0ec1)throw new Error(_0xc7ad('0x49'));if(_0x1e0ec1[_0xc7ad('0x4a')]===_0xc7ad('0x4b')){var _0x2a4178=_0x245e31['get']({'plain':!![]});var _0x50ef53=_0xc7ad('0x4c');return db[_0xc7ad('0x4d')][_0xc7ad('0x46')]({'where':{'name':_0x50ef53,'userProfileId':_0x1e0ec1['userProfileId']},'raw':!![]})[_0xc7ad('0x20')](function(_0x18b30b){if(_0x18b30b&&_0x18b30b[_0xc7ad('0x4e')]===0x0){return db[_0xc7ad('0x22')]['create']({'name':_0x2a4178[_0xc7ad('0x26')],'resourceId':_0x2a4178['id'],'type':_0x18b30b[_0xc7ad('0x26')],'sectionId':_0x18b30b['id']},{})[_0xc7ad('0x20')](function(){return _0x245e31;});}else{return _0x245e31;}})[_0xc7ad('0x43')](function(_0x472d91){logger[_0xc7ad('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x472d91);throw _0x472d91;});}return _0x245e31;})[_0xc7ad('0x20')](respondWithResult(_0x40a547,0xc9))[_0xc7ad('0x43')](handleError(_0x40a547,null));};exports[_0xc7ad('0x4f')]=function(_0x42582f,_0xb0ddb1){if(_0x42582f[_0xc7ad('0x48')]['id']){delete _0x42582f[_0xc7ad('0x48')]['id'];}return db[_0xc7ad('0x2a')]['find']({'where':{'id':_0x42582f['params']['id']}})[_0xc7ad('0x20')](handleEntityNotFound(_0xb0ddb1,null))[_0xc7ad('0x20')](saveUpdates(_0x42582f[_0xc7ad('0x48')],null))[_0xc7ad('0x20')](respondWithResult(_0xb0ddb1,null))[_0xc7ad('0x43')](handleError(_0xb0ddb1,null));};exports[_0xc7ad('0x23')]=function(_0x217c2f,_0x52431e){return db[_0xc7ad('0x2a')][_0xc7ad('0x46')]({'where':{'id':_0x217c2f[_0xc7ad('0x50')]['id']}})[_0xc7ad('0x20')](handleEntityNotFound(_0x52431e,null))[_0xc7ad('0x20')](removeEntity(_0x52431e,null))[_0xc7ad('0x43')](handleError(_0x52431e,null));};exports['addInterval']=function(_0x2c656e,_0x245ce8,_0x4d4b9d){if(_0x2c656e[_0xc7ad('0x48')]['id']){delete _0x2c656e[_0xc7ad('0x48')]['id'];}return db['Interval'][_0xc7ad('0x46')]({'where':{'id':_0x2c656e[_0xc7ad('0x50')]['id']}})[_0xc7ad('0x20')](handleEntityNotFound(_0x245ce8,null))['then'](function(_0x4d3213){if(_0x4d3213){_0x2c656e[_0xc7ad('0x48')][_0xc7ad('0x51')]=_0x4d3213['id'];return db[_0xc7ad('0x2a')][_0xc7ad('0x47')](_0x2c656e[_0xc7ad('0x48')]);}})['then'](respondWithResult(_0x245ce8,null))[_0xc7ad('0x43')](handleError(_0x245ce8,null));};exports[_0xc7ad('0x52')]=function(_0x124c68,_0x276f1b,_0x1037ab){var _0x4f7a6f={};var _0x773d76={};var _0x2e2da0;var _0x3b7d80;return db[_0xc7ad('0x2a')][_0xc7ad('0x53')]({'where':{'id':_0x124c68[_0xc7ad('0x50')]['id']}})[_0xc7ad('0x20')](handleEntityNotFound(_0x276f1b,null))[_0xc7ad('0x20')](function(_0x2e334c){if(_0x2e334c){_0x2e2da0=_0x2e334c;_0x773d76[_0xc7ad('0x2f')]=_['keys'](db['Interval'][_0xc7ad('0x2b')]);_0x773d76[_0xc7ad('0x30')]=_[_0xc7ad('0x31')](_0x124c68[_0xc7ad('0x30')]);_0x773d76[_0xc7ad('0x32')]=_[_0xc7ad('0x33')](_0x773d76['model'],_0x773d76[_0xc7ad('0x30')]);_0x4f7a6f[_0xc7ad('0x34')]=_['intersection'](_0x773d76['model'],qs['fields'](_0x124c68['query']['fields']));_0x4f7a6f[_0xc7ad('0x34')]=_0x4f7a6f[_0xc7ad('0x34')][_0xc7ad('0x36')]?_0x4f7a6f[_0xc7ad('0x34')]:_0x773d76['model'];_0x4f7a6f[_0xc7ad('0x39')]=qs[_0xc7ad('0x3a')](_0x124c68[_0xc7ad('0x30')][_0xc7ad('0x3a')]);_0x4f7a6f[_0xc7ad('0x3b')]=qs[_0xc7ad('0x32')](_[_0xc7ad('0x3c')](_0x124c68[_0xc7ad('0x30')],_0x773d76[_0xc7ad('0x32')]));if(_0x124c68[_0xc7ad('0x30')][_0xc7ad('0x3d')]){_0x4f7a6f['where']=_['merge'](_0x4f7a6f[_0xc7ad('0x3b')],{'$or':_[_0xc7ad('0x29')](_0x4f7a6f[_0xc7ad('0x34')],function(_0x236a8d){var _0x3e8361={};_0x3e8361[_0x236a8d]={'$like':'%'+_0x124c68['query'][_0xc7ad('0x3d')]+'%'};return _0x3e8361;})});}_0x4f7a6f=_['merge']({},_0x4f7a6f,_0x124c68['options']);return _0x2e2da0[_0xc7ad('0x52')](_0x4f7a6f);}})['then'](function(_0x2cee18){if(_0x2cee18){_0x3b7d80=_0x2cee18['length'];if(!_0x124c68[_0xc7ad('0x30')][_0xc7ad('0x37')](_0xc7ad('0x38'))){_0x4f7a6f[_0xc7ad('0x1c')]=qs[_0xc7ad('0x1c')](_0x124c68[_0xc7ad('0x30')][_0xc7ad('0x1c')]);_0x4f7a6f[_0xc7ad('0x1b')]=qs[_0xc7ad('0x1b')](_0x124c68[_0xc7ad('0x30')][_0xc7ad('0x1b')]);}return _0x2e2da0[_0xc7ad('0x52')](_0x4f7a6f);}})[_0xc7ad('0x20')](function(_0x45ff43){if(_0x45ff43){return _0x45ff43?{'count':_0x3b7d80,'rows':_0x45ff43}:null;}})[_0xc7ad('0x20')](respondWithResult(_0x276f1b,null))[_0xc7ad('0x43')](handleError(_0x276f1b,null));};exports['addIntervals']=function(_0x4c9a65,_0xe4806f,_0x128089){return db[_0xc7ad('0x2a')][_0xc7ad('0x53')]({'where':{'id':_0x4c9a65['params']['id']}})[_0xc7ad('0x20')](handleEntityNotFound(_0xe4806f,null))['then'](function(_0x223441){if(_0x223441){return db[_0xc7ad('0x54')][_0xc7ad('0x55')](function(_0x2579e2){return db['Interval'][_0xc7ad('0x23')]({'where':{'IntervalId':_0x4c9a65[_0xc7ad('0x50')]['id']},'transaction':_0x2579e2})[_0xc7ad('0x20')](function(_0x179534){var _0x3b7dac=_[_0xc7ad('0x29')](_0x4c9a65['body'],function(_0x2ff4d1){delete _0x2ff4d1['id'];_0x2ff4d1[_0xc7ad('0x51')]=_0x4c9a65[_0xc7ad('0x50')]['id'];return _0x2ff4d1;});return db[_0xc7ad('0x2a')][_0xc7ad('0x56')](_0x3b7dac,{'transaction':_0x2579e2});});})[_0xc7ad('0x20')](function(){return db['Interval'][_0xc7ad('0x42')]({'where':{'IntervalId':_0x4c9a65[_0xc7ad('0x50')]['id']}});});}})[_0xc7ad('0x20')](respondWithResult(_0xe4806f,null))['catch'](handleError(_0xe4806f,null));}; \ No newline at end of file +var _0x54c8=['includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','IntervalId','getIntervals','findOne','length','order','pick','filter','addIntervals','transaction','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Intervals','UserProfileResource','end','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','query','keys','model','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','filters','merge','VIRTUAL','options','include','findAll','rows','show','params'];(function(_0x2ba6ad,_0x30056a){var _0x1cf636=function(_0x48dcf9){while(--_0x48dcf9){_0x2ba6ad['push'](_0x2ba6ad['shift']());}};_0x1cf636(++_0x30056a);}(_0x54c8,0x12d));var _0x854c=function(_0x43d875,_0x3b2275){_0x43d875=_0x43d875-0x0;var _0x4aa700=_0x54c8[_0x43d875];return _0x4aa700;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x854c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x854c('0x1'));var jsonpatch=require(_0x854c('0x2'));var rp=require(_0x854c('0x3'));var moment=require(_0x854c('0x4'));var BPromise=require(_0x854c('0x5'));var Mustache=require(_0x854c('0x6'));var util=require(_0x854c('0x7'));var path=require(_0x854c('0x8'));var sox=require(_0x854c('0x9'));var csv=require('to-csv');var ejs=require(_0x854c('0xa'));var fs=require('fs');var _=require(_0x854c('0xb'));var squel=require('squel');var crypto=require(_0x854c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x854c('0xd'));var toCsv=require(_0x854c('0xe'));var querystring=require(_0x854c('0xf'));var Papa=require(_0x854c('0x10'));var Redis=require(_0x854c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x854c('0x12'));var as=require(_0x854c('0x13'));var hardwareService=require(_0x854c('0x14'));var logger=require(_0x854c('0x15'))(_0x854c('0x16'));var utils=require(_0x854c('0x17'));var config=require(_0x854c('0x18'));var licenseUtil=require(_0x854c('0x19'));var db=require(_0x854c('0x1a'))['db'];var extensions=require(_0x854c('0x1b'));function respondWithStatusCode(_0x24a40e,_0x503519){_0x503519=_0x503519||0xcc;return function(_0x7f0208){if(_0x7f0208){return _0x24a40e[_0x854c('0x1c')](_0x503519);}return _0x24a40e[_0x854c('0x1d')](_0x503519)['end']();};}function respondWithResult(_0x29c9ac,_0x5da970){_0x5da970=_0x5da970||0xc8;return function(_0x41b1d7){if(_0x41b1d7){return _0x29c9ac['status'](_0x5da970)[_0x854c('0x1e')](_0x41b1d7);}};}function respondWithFilteredResult(_0x23100a,_0x2d45f4){return function(_0x21587c){if(_0x21587c){var _0x576c1e=_0x21587c[_0x854c('0x1f')],_0x3471ae=_0x2d45f4[_0x854c('0x20')],_0x133dce=_0x2d45f4[_0x854c('0x20')]+_0x2d45f4['limit'],_0x47dd22;if(_0x133dce>=_0x576c1e){_0x133dce=_0x576c1e;_0x47dd22=0xc8;}else{_0x47dd22=0xce;}_0x23100a[_0x854c('0x1d')](_0x47dd22);return _0x23100a[_0x854c('0x21')](_0x854c('0x22'),_0x3471ae+'-'+_0x133dce+'/'+_0x576c1e)['json'](_0x21587c);}return null;};}function patchUpdates(_0x235952){return function(_0x127826){try{jsonpatch['apply'](_0x127826,_0x235952,!![]);}catch(_0x32fe9a){return BPromise[_0x854c('0x23')](_0x32fe9a);}return _0x127826[_0x854c('0x24')]();};}function saveUpdates(_0xe7b038,_0x499897){return function(_0x58ae56){if(_0x58ae56){return _0x58ae56[_0x854c('0x25')](_0xe7b038)[_0x854c('0x26')](function(_0x45578d){return _0x45578d;});}return null;};}function removeEntity(_0x15ec19,_0x3688bd){return function(_0xadeb35){if(_0xadeb35){return _0xadeb35[_0x854c('0x27')]()[_0x854c('0x26')](function(){var _0x444699=_0xadeb35[_0x854c('0x28')]({'plain':!![]});var _0x50962a=_0x854c('0x29');return db[_0x854c('0x2a')][_0x854c('0x27')]({'where':{'type':_0x50962a,'resourceId':_0x444699['id']}})[_0x854c('0x26')](function(){return _0xadeb35;});})['then'](function(){_0x15ec19[_0x854c('0x1d')](0xcc)[_0x854c('0x2b')]();});}};}function handleEntityNotFound(_0x597107,_0x12dc39){return function(_0x3a2edb){if(!_0x3a2edb){_0x597107[_0x854c('0x1c')](0x194);}return _0x3a2edb;};}function handleError(_0x2ab884,_0xb10bc7){_0xb10bc7=_0xb10bc7||0x1f4;return function(_0x5a712d){logger[_0x854c('0x2c')](_0x5a712d[_0x854c('0x2d')]);if(_0x5a712d['name']){delete _0x5a712d[_0x854c('0x2e')];}_0x2ab884[_0x854c('0x1d')](_0xb10bc7)[_0x854c('0x2f')](_0x5a712d);};}exports[_0x854c('0x30')]=function(_0x591a23,_0x45d425){var _0x88db5a={},_0xb2c43a={},_0x3903b1={'count':0x0,'rows':[]};var _0x5f41ca=_[_0x854c('0x31')](db[_0x854c('0x32')][_0x854c('0x33')],function(_0x2b3d6b){return{'name':_0x2b3d6b[_0x854c('0x34')],'type':_0x2b3d6b[_0x854c('0x35')][_0x854c('0x36')]};});_0xb2c43a['model']=_[_0x854c('0x31')](_0x5f41ca,_0x854c('0x2e'));_0xb2c43a[_0x854c('0x37')]=_[_0x854c('0x38')](_0x591a23['query']);_0xb2c43a['filters']=_['intersection'](_0xb2c43a[_0x854c('0x39')],_0xb2c43a[_0x854c('0x37')]);_0x88db5a['attributes']=_[_0x854c('0x3a')](_0xb2c43a['model'],qs[_0x854c('0x3b')](_0x591a23[_0x854c('0x37')]['fields']));_0x88db5a[_0x854c('0x3c')]=_0x88db5a[_0x854c('0x3c')]['length']?_0x88db5a[_0x854c('0x3c')]:_0xb2c43a[_0x854c('0x39')];if(!_0x591a23[_0x854c('0x37')][_0x854c('0x3d')](_0x854c('0x3e'))){_0x88db5a['limit']=qs[_0x854c('0x3f')](_0x591a23[_0x854c('0x37')][_0x854c('0x3f')]);_0x88db5a[_0x854c('0x20')]=qs[_0x854c('0x20')](_0x591a23['query'][_0x854c('0x20')]);}_0x88db5a['order']=qs['sort'](_0x591a23['query'][_0x854c('0x40')]);_0x88db5a[_0x854c('0x41')]=qs[_0x854c('0x42')](_['pick'](_0x591a23['query'],_0xb2c43a['filters']),_0x5f41ca);if(_0x591a23[_0x854c('0x37')]['filter']){_0x88db5a[_0x854c('0x41')]=_[_0x854c('0x43')](_0x88db5a['where'],{'$or':_[_0x854c('0x31')](_0x5f41ca,function(_0xb2d03c){if(_0xb2d03c[_0x854c('0x35')]!==_0x854c('0x44')){var _0x42395b={};_0x42395b[_0xb2d03c[_0x854c('0x2e')]]={'$like':'%'+_0x591a23['query']['filter']+'%'};return _0x42395b;}})});}_0x88db5a=_['merge']({},_0x88db5a,_0x591a23[_0x854c('0x45')]);var _0x108120={'where':_0x88db5a[_0x854c('0x41')]};return db['Interval']['count'](_0x108120)[_0x854c('0x26')](function(_0x1df7c5){_0x3903b1[_0x854c('0x1f')]=_0x1df7c5;if(_0x591a23['query']['includeAll']){_0x88db5a[_0x854c('0x46')]=[{'all':!![]}];}return db['Interval'][_0x854c('0x47')](_0x88db5a);})[_0x854c('0x26')](function(_0x4f3b12){_0x3903b1[_0x854c('0x48')]=_0x4f3b12;return _0x3903b1;})[_0x854c('0x26')](respondWithFilteredResult(_0x45d425,_0x88db5a))['catch'](handleError(_0x45d425,null));};exports[_0x854c('0x49')]=function(_0x1e21a8,_0x48b947){var _0x8008a5={'raw':!![],'where':{'id':_0x1e21a8[_0x854c('0x4a')]['id']}},_0x3cd9eb={};_0x3cd9eb[_0x854c('0x39')]=_['keys'](db[_0x854c('0x32')][_0x854c('0x33')]);_0x3cd9eb[_0x854c('0x37')]=_[_0x854c('0x38')](_0x1e21a8[_0x854c('0x37')]);_0x3cd9eb['filters']=_[_0x854c('0x3a')](_0x3cd9eb[_0x854c('0x39')],_0x3cd9eb[_0x854c('0x37')]);_0x8008a5[_0x854c('0x3c')]=_['intersection'](_0x3cd9eb[_0x854c('0x39')],qs['fields'](_0x1e21a8[_0x854c('0x37')]['fields']));_0x8008a5[_0x854c('0x3c')]=_0x8008a5[_0x854c('0x3c')]['length']?_0x8008a5[_0x854c('0x3c')]:_0x3cd9eb[_0x854c('0x39')];if(_0x1e21a8[_0x854c('0x37')][_0x854c('0x4b')]){_0x8008a5[_0x854c('0x46')]=[{'all':!![]}];}_0x8008a5=_[_0x854c('0x43')]({},_0x8008a5,_0x1e21a8[_0x854c('0x45')]);return db[_0x854c('0x32')][_0x854c('0x4c')](_0x8008a5)[_0x854c('0x26')](handleEntityNotFound(_0x48b947,null))[_0x854c('0x26')](respondWithResult(_0x48b947,null))['catch'](handleError(_0x48b947,null));};exports[_0x854c('0x4d')]=function(_0x1956fd,_0x1b3e26){return db[_0x854c('0x32')]['create'](_0x1956fd[_0x854c('0x4e')],{})['then'](function(_0x50aa7b){var _0x17baa0=_0x1956fd[_0x854c('0x4f')][_0x854c('0x28')]({'plain':!![]});if(!_0x17baa0)throw new Error(_0x854c('0x50'));if(_0x17baa0[_0x854c('0x51')]===_0x854c('0x4f')){var _0x5a4857=_0x50aa7b[_0x854c('0x28')]({'plain':!![]});var _0x5bad97=_0x854c('0x29');return db['UserProfileSection'][_0x854c('0x4c')]({'where':{'name':_0x5bad97,'userProfileId':_0x17baa0[_0x854c('0x52')]},'raw':!![]})[_0x854c('0x26')](function(_0x3f143a){if(_0x3f143a&&_0x3f143a['autoAssociation']===0x0){return db[_0x854c('0x2a')][_0x854c('0x4d')]({'name':_0x5a4857[_0x854c('0x2e')],'resourceId':_0x5a4857['id'],'type':_0x3f143a[_0x854c('0x2e')],'sectionId':_0x3f143a['id']},{})['then'](function(){return _0x50aa7b;});}else{return _0x50aa7b;}})[_0x854c('0x53')](function(_0x625d77){logger['error'](_0x854c('0x54'),_0x625d77);throw _0x625d77;});}return _0x50aa7b;})['then'](respondWithResult(_0x1b3e26,0xc9))[_0x854c('0x53')](handleError(_0x1b3e26,null));};exports['update']=function(_0x313baa,_0x38c812){if(_0x313baa[_0x854c('0x4e')]['id']){delete _0x313baa[_0x854c('0x4e')]['id'];}return db[_0x854c('0x32')]['find']({'where':{'id':_0x313baa[_0x854c('0x4a')]['id']}})[_0x854c('0x26')](handleEntityNotFound(_0x38c812,null))[_0x854c('0x26')](saveUpdates(_0x313baa['body'],null))['then'](respondWithResult(_0x38c812,null))['catch'](handleError(_0x38c812,null));};exports[_0x854c('0x27')]=function(_0x2676bb,_0x4d69d6){return db[_0x854c('0x32')]['find']({'where':{'id':_0x2676bb['params']['id']}})[_0x854c('0x26')](handleEntityNotFound(_0x4d69d6,null))[_0x854c('0x26')](removeEntity(_0x4d69d6,null))['catch'](handleError(_0x4d69d6,null));};exports['addInterval']=function(_0x57cb34,_0x3bcb93,_0x5090b5){if(_0x57cb34[_0x854c('0x4e')]['id']){delete _0x57cb34[_0x854c('0x4e')]['id'];}return db['Interval'][_0x854c('0x4c')]({'where':{'id':_0x57cb34['params']['id']}})[_0x854c('0x26')](handleEntityNotFound(_0x3bcb93,null))[_0x854c('0x26')](function(_0x41c6cc){if(_0x41c6cc){_0x57cb34[_0x854c('0x4e')][_0x854c('0x55')]=_0x41c6cc['id'];return db[_0x854c('0x32')][_0x854c('0x4d')](_0x57cb34[_0x854c('0x4e')]);}})[_0x854c('0x26')](respondWithResult(_0x3bcb93,null))['catch'](handleError(_0x3bcb93,null));};exports[_0x854c('0x56')]=function(_0x9fc626,_0x10859a,_0x5ec80a){var _0x232028={};var _0x210eae={};var _0x543161;var _0x28b6f3;return db['Interval'][_0x854c('0x57')]({'where':{'id':_0x9fc626[_0x854c('0x4a')]['id']}})[_0x854c('0x26')](handleEntityNotFound(_0x10859a,null))[_0x854c('0x26')](function(_0x2cfea5){if(_0x2cfea5){_0x543161=_0x2cfea5;_0x210eae[_0x854c('0x39')]=_['keys'](db[_0x854c('0x32')][_0x854c('0x33')]);_0x210eae['query']=_['keys'](_0x9fc626[_0x854c('0x37')]);_0x210eae['filters']=_['intersection'](_0x210eae[_0x854c('0x39')],_0x210eae['query']);_0x232028[_0x854c('0x3c')]=_['intersection'](_0x210eae[_0x854c('0x39')],qs[_0x854c('0x3b')](_0x9fc626[_0x854c('0x37')][_0x854c('0x3b')]));_0x232028[_0x854c('0x3c')]=_0x232028[_0x854c('0x3c')][_0x854c('0x58')]?_0x232028[_0x854c('0x3c')]:_0x210eae['model'];_0x232028[_0x854c('0x59')]=qs[_0x854c('0x40')](_0x9fc626[_0x854c('0x37')][_0x854c('0x40')]);_0x232028[_0x854c('0x41')]=qs[_0x854c('0x42')](_[_0x854c('0x5a')](_0x9fc626[_0x854c('0x37')],_0x210eae['filters']));if(_0x9fc626[_0x854c('0x37')][_0x854c('0x5b')]){_0x232028[_0x854c('0x41')]=_[_0x854c('0x43')](_0x232028['where'],{'$or':_[_0x854c('0x31')](_0x232028[_0x854c('0x3c')],function(_0x1e9fe3){var _0x29b2ed={};_0x29b2ed[_0x1e9fe3]={'$like':'%'+_0x9fc626[_0x854c('0x37')][_0x854c('0x5b')]+'%'};return _0x29b2ed;})});}_0x232028=_[_0x854c('0x43')]({},_0x232028,_0x9fc626['options']);return _0x543161['getIntervals'](_0x232028);}})[_0x854c('0x26')](function(_0x37cf0c){if(_0x37cf0c){_0x28b6f3=_0x37cf0c[_0x854c('0x58')];if(!_0x9fc626['query']['hasOwnProperty'](_0x854c('0x3e'))){_0x232028['limit']=qs[_0x854c('0x3f')](_0x9fc626[_0x854c('0x37')][_0x854c('0x3f')]);_0x232028[_0x854c('0x20')]=qs['offset'](_0x9fc626[_0x854c('0x37')][_0x854c('0x20')]);}return _0x543161[_0x854c('0x56')](_0x232028);}})[_0x854c('0x26')](function(_0x2e04a8){if(_0x2e04a8){return _0x2e04a8?{'count':_0x28b6f3,'rows':_0x2e04a8}:null;}})[_0x854c('0x26')](respondWithResult(_0x10859a,null))[_0x854c('0x53')](handleError(_0x10859a,null));};exports[_0x854c('0x5c')]=function(_0x48dba5,_0xe3eb37,_0x36711a){return db[_0x854c('0x32')][_0x854c('0x57')]({'where':{'id':_0x48dba5[_0x854c('0x4a')]['id']}})[_0x854c('0x26')](handleEntityNotFound(_0xe3eb37,null))[_0x854c('0x26')](function(_0x52e8c1){if(_0x52e8c1){return db['sequelize'][_0x854c('0x5d')](function(_0x3ecf1b){return db[_0x854c('0x32')]['destroy']({'where':{'IntervalId':_0x48dba5[_0x854c('0x4a')]['id']},'transaction':_0x3ecf1b})[_0x854c('0x26')](function(_0x5e55fc){var _0xc431e=_[_0x854c('0x31')](_0x48dba5['body'],function(_0x4e3810){delete _0x4e3810['id'];_0x4e3810[_0x854c('0x55')]=_0x48dba5['params']['id'];return _0x4e3810;});return db['Interval']['bulkCreate'](_0xc431e,{'transaction':_0x3ecf1b});});})[_0x854c('0x26')](function(){return db[_0x854c('0x32')][_0x854c('0x47')]({'where':{'IntervalId':_0x48dba5['params']['id']}});});}})[_0x854c('0x26')](respondWithResult(_0xe3eb37,null))['catch'](handleError(_0xe3eb37,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 6e9d091..f2cc599 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 _0xe0b2=['Interval','rewrite','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports'];(function(_0x3bd52b,_0xbbc735){var _0x1e5b89=function(_0x29ccc3){while(--_0x29ccc3){_0x3bd52b['push'](_0x3bd52b['shift']());}};_0x1e5b89(++_0xbbc735);}(_0xe0b2,0xec));var _0x2e0b=function(_0x44ec56,_0x5387be){_0x44ec56=_0x44ec56-0x0;var _0x57e902=_0xe0b2[_0x44ec56];return _0x57e902;};'use strict';var _=require('lodash');var util=require(_0x2e0b('0x0'));var logger=require(_0x2e0b('0x1'))(_0x2e0b('0x2'));var moment=require(_0x2e0b('0x3'));var BPromise=require(_0x2e0b('0x4'));var rp=require(_0x2e0b('0x5'));var fs=require('fs');var path=require(_0x2e0b('0x6'));var rimraf=require('rimraf');var config=require(_0x2e0b('0x7'));var attributes=require(_0x2e0b('0x8'));var extensions=require(_0x2e0b('0x9'));module[_0x2e0b('0xa')]=function(_0x1b8455,_0x264319){return _0x1b8455['define'](_0x2e0b('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1afd43,_0xba54b9){extensions[_0x2e0b('0xc')](_0x1b8455,_0x1afd43);},'afterBulkCreate':function(_0x3078eb,_0x674f01,_0x173f25){_0x173f25();extensions[_0x2e0b('0xc')](_0x1b8455,_0x3078eb[0x0]);},'afterUpdate':function(_0x462729,_0x208f48){extensions['rewrite'](_0x1b8455,_0x462729);},'afterDestroy':function(_0x3ca7ea,_0x10a658){extensions['rewrite'](_0x1b8455,_0x3ca7ea);}}});}; \ No newline at end of file +var _0x7229=['./interval.attributes','../../components/extensions/rewrite','exports','define','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x52cf9a,_0x3d8e7f){var _0xaf48eb=function(_0x587462){while(--_0x587462){_0x52cf9a['push'](_0x52cf9a['shift']());}};_0xaf48eb(++_0x3d8e7f);}(_0x7229,0x76));var _0x9722=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x7229[_0x481bf7];return _0x461787;};'use strict';var _=require(_0x9722('0x0'));var util=require(_0x9722('0x1'));var logger=require(_0x9722('0x2'))(_0x9722('0x3'));var moment=require(_0x9722('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9722('0x5'));var rimraf=require(_0x9722('0x6'));var config=require(_0x9722('0x7'));var attributes=require(_0x9722('0x8'));var extensions=require(_0x9722('0x9'));module[_0x9722('0xa')]=function(_0x2689b3,_0x541b0c){return _0x2689b3[_0x9722('0xb')]('Interval',attributes,{'tableName':_0x9722('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c65f5,_0x185f94){extensions[_0x9722('0xd')](_0x2689b3,_0x2c65f5);},'afterBulkCreate':function(_0x13b156,_0x408509,_0x409979){_0x409979();extensions[_0x9722('0xd')](_0x2689b3,_0x13b156[0x0]);},'afterUpdate':function(_0x5a526d,_0x5de408){extensions[_0x9722('0xd')](_0x2689b3,_0x5a526d);},'afterDestroy':function(_0x3cb317,_0x282250){extensions[_0x9722('0xd')](_0x2689b3,_0x3cb317);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 96eaa29..aaa9b2a 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 _0xedee=['http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetInterval','Interval','findAll','options','where','attributes','limit','model','include','map','find','raw','ShowInterval','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x18fdd5,_0x164ffa){var _0x527988=function(_0x4a697a){while(--_0x4a697a){_0x18fdd5['push'](_0x18fdd5['shift']());}};_0x527988(++_0x164ffa);}(_0xedee,0xf8));var _0xeede=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xedee[_0x4e676e];return _0x336a3c;};'use strict';var _=require('lodash');var util=require(_0xeede('0x0'));var moment=require('moment');var BPromise=require(_0xeede('0x1'));var rs=require(_0xeede('0x2'));var fs=require('fs');var Redis=require(_0xeede('0x3'));var db=require(_0xeede('0x4'))['db'];var utils=require(_0xeede('0x5'));var logger=require(_0xeede('0x6'))(_0xeede('0x7'));var config=require(_0xeede('0x8'));var jayson=require(_0xeede('0x9'));var client=jayson[_0xeede('0xa')][_0xeede('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3634da,_0x1c9676,_0x52595a){return new BPromise(function(_0xb5f2eb,_0x5a2700){return client[_0xeede('0xc')](_0x3634da,_0x52595a)[_0xeede('0xd')](function(_0xcf11f5){logger[_0xeede('0xe')](_0xeede('0xf'),_0x1c9676,_0xeede('0x10'));logger[_0xeede('0x11')]('Interval,\x20%s,\x20%s,\x20%s',_0x1c9676,_0xeede('0x10'),JSON[_0xeede('0x12')](_0xcf11f5));if(_0xcf11f5[_0xeede('0x13')]){if(_0xcf11f5[_0xeede('0x13')][_0xeede('0x14')]===0x1f4){logger[_0xeede('0x13')](_0xeede('0xf'),_0x1c9676,_0xcf11f5[_0xeede('0x13')][_0xeede('0x15')]);return _0x5a2700(_0xcf11f5['error'][_0xeede('0x15')]);}logger[_0xeede('0x13')](_0xeede('0xf'),_0x1c9676,_0xcf11f5['error'][_0xeede('0x15')]);return _0xb5f2eb(_0xcf11f5[_0xeede('0x13')][_0xeede('0x15')]);}else{logger['info'](_0xeede('0xf'),_0x1c9676,_0xeede('0x10'));_0xb5f2eb(_0xcf11f5[_0xeede('0x16')][_0xeede('0x15')]);}})[_0xeede('0x17')](function(_0xc87613){logger[_0xeede('0x13')]('Interval,\x20%s,\x20%s',_0x1c9676,_0xc87613);_0x5a2700(_0xc87613);});});}exports[_0xeede('0x18')]=function(_0x4132c0){var _0x44aa6d=this;return new Promise(function(_0x3231ef,_0x4f1b0a){return db[_0xeede('0x19')][_0xeede('0x1a')]({'raw':_0x4132c0[_0xeede('0x1b')]?_0x4132c0[_0xeede('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4132c0['options']?_0x4132c0[_0xeede('0x1b')][_0xeede('0x1c')]||null:null,'attributes':_0x4132c0[_0xeede('0x1b')]?_0x4132c0['options'][_0xeede('0x1d')]||null:null,'limit':_0x4132c0[_0xeede('0x1b')]?_0x4132c0[_0xeede('0x1b')][_0xeede('0x1e')]||null:null,'include':_0x4132c0['options']?_0x4132c0[_0xeede('0x1b')]['include']?_['map'](_0x4132c0[_0xeede('0x1b')]['include'],function(_0x2ad07c){return{'model':db[_0x2ad07c[_0xeede('0x1f')]],'as':_0x2ad07c['as'],'attributes':_0x2ad07c[_0xeede('0x1d')],'include':_0x2ad07c[_0xeede('0x20')]?_[_0xeede('0x21')](_0x2ad07c['include'],function(_0x3080f3){return{'model':db[_0x3080f3[_0xeede('0x1f')]],'as':_0x3080f3['as'],'attributes':_0x3080f3[_0xeede('0x1d')],'include':_0x3080f3[_0xeede('0x20')]?_['map'](_0x3080f3['include'],function(_0x1507eb){return{'model':db[_0x1507eb['model']],'as':_0x1507eb['as'],'attributes':_0x1507eb[_0xeede('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xeede('0xd')](function(_0x59c8f2){logger[_0xeede('0xe')](_0xeede('0x18'),_0x4132c0);logger[_0xeede('0x11')](_0xeede('0x18'),_0x4132c0,JSON[_0xeede('0x12')](_0x59c8f2));_0x3231ef(_0x59c8f2);})[_0xeede('0x17')](function(_0x421b5a){logger[_0xeede('0x13')]('GetInterval',_0x421b5a['message'],_0x4132c0);_0x4f1b0a(_0x44aa6d[_0xeede('0x13')](0x1f4,_0x421b5a[_0xeede('0x15')]));});});};exports['ShowInterval']=function(_0x39af3a){var _0x314936=this;return new Promise(function(_0x7dfd08,_0x13a6f9){return db[_0xeede('0x19')][_0xeede('0x22')]({'raw':_0x39af3a[_0xeede('0x1b')]?_0x39af3a[_0xeede('0x1b')][_0xeede('0x23')]===undefined?!![]:![]:!![],'where':_0x39af3a[_0xeede('0x1b')]?_0x39af3a[_0xeede('0x1b')][_0xeede('0x1c')]||null:null,'attributes':_0x39af3a['options']?_0x39af3a[_0xeede('0x1b')][_0xeede('0x1d')]||null:null,'include':_0x39af3a[_0xeede('0x1b')]?_0x39af3a[_0xeede('0x1b')]['include']?_[_0xeede('0x21')](_0x39af3a[_0xeede('0x1b')]['include'],function(_0x15462c){return{'model':db[_0x15462c[_0xeede('0x1f')]],'as':_0x15462c['as'],'attributes':_0x15462c[_0xeede('0x1d')],'include':_0x15462c[_0xeede('0x20')]?_['map'](_0x15462c[_0xeede('0x20')],function(_0xf4fd97){return{'model':db[_0xf4fd97['model']],'as':_0xf4fd97['as'],'attributes':_0xf4fd97[_0xeede('0x1d')],'include':_0xf4fd97['include']?_[_0xeede('0x21')](_0xf4fd97[_0xeede('0x20')],function(_0x4208be){return{'model':db[_0x4208be[_0xeede('0x1f')]],'as':_0x4208be['as'],'attributes':_0x4208be['attributes']};}):[]};}):[]};}):[]:[]})[_0xeede('0xd')](function(_0x3f3e51){logger[_0xeede('0xe')](_0xeede('0x24'),_0x39af3a);logger[_0xeede('0x11')](_0xeede('0x24'),_0x39af3a,JSON[_0xeede('0x12')](_0x3f3e51));_0x7dfd08(_0x3f3e51);})[_0xeede('0x17')](function(_0x335e35){logger[_0xeede('0x13')](_0xeede('0x24'),_0x335e35['message'],_0x39af3a);_0x13a6f9(_0x314936[_0xeede('0x13')](0x1f4,_0x335e35[_0xeede('0x15')]));});});}; \ No newline at end of file +var _0x7c76=['limit','include','map','model','catch','ShowInterval','Interval','find','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','code','error','Interval,\x20%s,\x20%s','message','request\x20sent','result','GetInterval','findAll','options','raw','where','attributes'];(function(_0x4f6079,_0x45843d){var _0x14bcfa=function(_0x529d9a){while(--_0x529d9a){_0x4f6079['push'](_0x4f6079['shift']());}};_0x14bcfa(++_0x45843d);}(_0x7c76,0xb2));var _0x67c7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7c76[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x67c7('0x0'));var moment=require('moment');var BPromise=require(_0x67c7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x67c7('0x2'));var db=require(_0x67c7('0x3'))['db'];var utils=require(_0x67c7('0x4'));var logger=require(_0x67c7('0x5'))(_0x67c7('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x67c7('0x7')][_0x67c7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf990ef,_0x63edc4,_0x291f25){return new BPromise(function(_0x479e19,_0x38eaab){return client['request'](_0xf990ef,_0x291f25)[_0x67c7('0x9')](function(_0x2d7ef5){logger[_0x67c7('0xa')]('Interval,\x20%s,\x20%s',_0x63edc4,'request\x20sent');logger[_0x67c7('0xb')](_0x67c7('0xc'),_0x63edc4,'request\x20sent',JSON[_0x67c7('0xd')](_0x2d7ef5));if(_0x2d7ef5['error']){if(_0x2d7ef5['error'][_0x67c7('0xe')]===0x1f4){logger[_0x67c7('0xf')](_0x67c7('0x10'),_0x63edc4,_0x2d7ef5[_0x67c7('0xf')][_0x67c7('0x11')]);return _0x38eaab(_0x2d7ef5[_0x67c7('0xf')][_0x67c7('0x11')]);}logger['error']('Interval,\x20%s,\x20%s',_0x63edc4,_0x2d7ef5[_0x67c7('0xf')][_0x67c7('0x11')]);return _0x479e19(_0x2d7ef5[_0x67c7('0xf')][_0x67c7('0x11')]);}else{logger[_0x67c7('0xa')]('Interval,\x20%s,\x20%s',_0x63edc4,_0x67c7('0x12'));_0x479e19(_0x2d7ef5[_0x67c7('0x13')][_0x67c7('0x11')]);}})['catch'](function(_0x2f6e95){logger[_0x67c7('0xf')](_0x67c7('0x10'),_0x63edc4,_0x2f6e95);_0x38eaab(_0x2f6e95);});});}exports[_0x67c7('0x14')]=function(_0xb7a780){var _0x485832=this;return new Promise(function(_0x5ecf66,_0x21fea9){return db['Interval'][_0x67c7('0x15')]({'raw':_0xb7a780['options']?_0xb7a780[_0x67c7('0x16')][_0x67c7('0x17')]===undefined?!![]:![]:!![],'where':_0xb7a780[_0x67c7('0x16')]?_0xb7a780[_0x67c7('0x16')][_0x67c7('0x18')]||null:null,'attributes':_0xb7a780[_0x67c7('0x16')]?_0xb7a780[_0x67c7('0x16')][_0x67c7('0x19')]||null:null,'limit':_0xb7a780['options']?_0xb7a780['options'][_0x67c7('0x1a')]||null:null,'include':_0xb7a780[_0x67c7('0x16')]?_0xb7a780[_0x67c7('0x16')][_0x67c7('0x1b')]?_[_0x67c7('0x1c')](_0xb7a780[_0x67c7('0x16')][_0x67c7('0x1b')],function(_0x3e22f4){return{'model':db[_0x3e22f4[_0x67c7('0x1d')]],'as':_0x3e22f4['as'],'attributes':_0x3e22f4[_0x67c7('0x19')],'include':_0x3e22f4[_0x67c7('0x1b')]?_[_0x67c7('0x1c')](_0x3e22f4['include'],function(_0x3eeed0){return{'model':db[_0x3eeed0['model']],'as':_0x3eeed0['as'],'attributes':_0x3eeed0[_0x67c7('0x19')],'include':_0x3eeed0[_0x67c7('0x1b')]?_[_0x67c7('0x1c')](_0x3eeed0[_0x67c7('0x1b')],function(_0x2c4b50){return{'model':db[_0x2c4b50['model']],'as':_0x2c4b50['as'],'attributes':_0x2c4b50[_0x67c7('0x19')]};}):[]};}):[]};}):[]:[]})[_0x67c7('0x9')](function(_0x2dd66d){logger[_0x67c7('0xa')](_0x67c7('0x14'),_0xb7a780);logger[_0x67c7('0xb')]('GetInterval',_0xb7a780,JSON[_0x67c7('0xd')](_0x2dd66d));_0x5ecf66(_0x2dd66d);})[_0x67c7('0x1e')](function(_0x84f441){logger[_0x67c7('0xf')](_0x67c7('0x14'),_0x84f441[_0x67c7('0x11')],_0xb7a780);_0x21fea9(_0x485832[_0x67c7('0xf')](0x1f4,_0x84f441['message']));});});};exports[_0x67c7('0x1f')]=function(_0x8bb7a5){var _0x4504ad=this;return new Promise(function(_0x7ed8b0,_0x1836b1){return db[_0x67c7('0x20')][_0x67c7('0x21')]({'raw':_0x8bb7a5[_0x67c7('0x16')]?_0x8bb7a5['options'][_0x67c7('0x17')]===undefined?!![]:![]:!![],'where':_0x8bb7a5[_0x67c7('0x16')]?_0x8bb7a5[_0x67c7('0x16')]['where']||null:null,'attributes':_0x8bb7a5[_0x67c7('0x16')]?_0x8bb7a5[_0x67c7('0x16')]['attributes']||null:null,'include':_0x8bb7a5[_0x67c7('0x16')]?_0x8bb7a5[_0x67c7('0x16')][_0x67c7('0x1b')]?_[_0x67c7('0x1c')](_0x8bb7a5[_0x67c7('0x16')][_0x67c7('0x1b')],function(_0x1ee2c6){return{'model':db[_0x1ee2c6[_0x67c7('0x1d')]],'as':_0x1ee2c6['as'],'attributes':_0x1ee2c6['attributes'],'include':_0x1ee2c6['include']?_[_0x67c7('0x1c')](_0x1ee2c6[_0x67c7('0x1b')],function(_0x461dc9){return{'model':db[_0x461dc9[_0x67c7('0x1d')]],'as':_0x461dc9['as'],'attributes':_0x461dc9[_0x67c7('0x19')],'include':_0x461dc9[_0x67c7('0x1b')]?_[_0x67c7('0x1c')](_0x461dc9['include'],function(_0xbbf093){return{'model':db[_0xbbf093['model']],'as':_0xbbf093['as'],'attributes':_0xbbf093[_0x67c7('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51475a){logger['info'](_0x67c7('0x1f'),_0x8bb7a5);logger[_0x67c7('0xb')](_0x67c7('0x1f'),_0x8bb7a5,JSON['stringify'](_0x51475a));_0x7ed8b0(_0x51475a);})[_0x67c7('0x1e')](function(_0x33a95b){logger[_0x67c7('0xf')](_0x67c7('0x1f'),_0x33a95b['message'],_0x8bb7a5);_0x1836b1(_0x4504ad[_0x67c7('0xf')](0x1f4,_0x33a95b[_0x67c7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 88d65a2..ca1b678 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 _0xe2fe=['express','Router','../../components/auth/service','post','exports'];(function(_0x1fdb40,_0x51351c){var _0x281f93=function(_0x35eebe){while(--_0x35eebe){_0x1fdb40['push'](_0x1fdb40['shift']());}};_0x281f93(++_0x51351c);}(_0xe2fe,0x1a9));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xee2f('0x0'));var router=express[_0xee2f('0x1')]();var auth=require(_0xee2f('0x2'));var controller=require('./jira.controller');router[_0xee2f('0x3')]('/',auth['isAuthenticated'](),controller['send']);module[_0xee2f('0x4')]=router; \ No newline at end of file +var _0xa82a=['exports','Router','../../components/auth/service','./jira.controller','isAuthenticated','send'];(function(_0x3d20d1,_0x5bdb8a){var _0x4d28a0=function(_0x12a5d0){while(--_0x12a5d0){_0x3d20d1['push'](_0x3d20d1['shift']());}};_0x4d28a0(++_0x5bdb8a);}(_0xa82a,0x19f));var _0xaa82=function(_0x2f8309,_0x55adb0){_0x2f8309=_0x2f8309-0x0;var _0x296c41=_0xa82a[_0x2f8309];return _0x296c41;};'use strict';var express=require('express');var router=express[_0xaa82('0x0')]();var auth=require(_0xaa82('0x1'));var controller=require(_0xaa82('0x2'));router['post']('/',auth[_0xaa82('0x3')](),controller[_0xaa82('0x4')]);module[_0xaa82('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 6d20a23..c649353 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 _0x54f3=['setEncoding','data','end','status','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','description','issuetype','Bug','customfield_11500','email','customfield_11501','oldToken','fields','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','request'];(function(_0x3a99f4,_0x2a81c1){var _0xea0b42=function(_0x41f533){while(--_0x41f533){_0x3a99f4['push'](_0x3a99f4['shift']());}};_0xea0b42(++_0x2a81c1);}(_0x54f3,0x1d2));var _0x354f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x54f3[_0x40a045];return _0x1a687c;};'use strict';var BPromise=require(_0x354f('0x0'));var https=require(_0x354f('0x1'));var logger=require(_0x354f('0x2'))('api');var USERNAME=_0x354f('0x3');var PASSWORD=_0x354f('0x4');function openIssue(_0x548bdd,_0xa996cd){var _0x22d60e={'fields':{'project':{'key':_0x548bdd[_0x354f('0x5')]||_0x354f('0x6')},'summary':(_0x548bdd[_0x354f('0x7')]||'Report')+_0x354f('0x8')+_0x548bdd['ip'],'description':_0x548bdd[_0x354f('0x9')]||JSON['stringify'](_0x548bdd),'issuetype':{'name':_0x548bdd[_0x354f('0xa')]||_0x354f('0xb')}}};_0x22d60e['fields'][_0x354f('0xc')]=_0x548bdd[_0x354f('0xd')];_0x22d60e['fields'][_0x354f('0xe')]=_0x548bdd[_0x354f('0xf')];_0x22d60e[_0x354f('0x10')][_0x354f('0x11')]=_0x548bdd[_0x354f('0x12')];_0x22d60e[_0x354f('0x10')][_0x354f('0x13')]=_0x548bdd['name'];_0x22d60e[_0x354f('0x10')][_0x354f('0x14')]=_0x548bdd[_0x354f('0x15')];_0x22d60e[_0x354f('0x10')][_0x354f('0x16')]=_0x548bdd['ip'];var _0x1b341c={'host':_0x354f('0x17'),'port':0x1bb,'path':_0x354f('0x18'),'method':_0x354f('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0x354f('0x1a'),'Authorization':_0x354f('0x1b')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x17e644=JSON['stringify'](_0x22d60e);var _0x4cc215=https[_0x354f('0x1c')](_0x1b341c,function(_0x59aec7){_0x59aec7[_0x354f('0x1d')]('utf8');var _0x17ac87='';_0x59aec7['on'](_0x354f('0x1e'),function(_0x24b2b6){_0x17ac87+=_0x24b2b6;});_0x59aec7['on'](_0x354f('0x1f'),function(){if(_0xa996cd){return _0xa996cd[_0x354f('0x20')](_0x59aec7['statusCode'])['json'](JSON[_0x354f('0x21')](_0x17ac87));}});});_0x4cc215['on'](_0x354f('0x22'),function(_0x46782e){if(_0xa996cd){return _0xa996cd['status'](0x1f4)['json']({'errors':[{'message':_0x354f('0x23'),'type':_0x354f('0x24')}]});}});_0x4cc215[_0x354f('0x25')](_0x17e644);_0x4cc215[_0x354f('0x1f')]();}exports[_0x354f('0x26')]=openIssue;exports[_0x354f('0x27')]=function(_0x4a496a,_0x12e26a){_0x4a496a[_0x354f('0x28')]['ip']=_0x4a496a[_0x354f('0x29')][_0x354f('0x2a')]||_0x4a496a[_0x354f('0x2b')][_0x354f('0x2c')]||_0x4a496a['socket'][_0x354f('0x2c')]||_0x4a496a['connection']['socket'][_0x354f('0x2c')];return openIssue(_0x4a496a['body'],_0x12e26a);}; \ No newline at end of file +var _0x13b0=['MOTGUI','summary','\x20from\x20','description','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','stringify','utf8','data','end','statusCode','json','parse','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','connection','socket','remoteAddress','body','bluebird','api','key'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x13b0,0xf9));var _0x013b=function(_0x480408,_0x403a40){_0x480408=_0x480408-0x0;var _0x52d4e6=_0x13b0[_0x480408];return _0x52d4e6;};'use strict';var BPromise=require(_0x013b('0x0'));var https=require('https');var logger=require('../../config/logger')(_0x013b('0x1'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x3032a9,_0x14f0f4){var _0xe37918={'fields':{'project':{'key':_0x3032a9[_0x013b('0x2')]||_0x013b('0x3')},'summary':(_0x3032a9[_0x013b('0x4')]||'Report')+_0x013b('0x5')+_0x3032a9['ip'],'description':_0x3032a9[_0x013b('0x6')]||JSON['stringify'](_0x3032a9),'issuetype':{'name':_0x3032a9[_0x013b('0x7')]||_0x013b('0x8')}}};_0xe37918[_0x013b('0x9')][_0x013b('0xa')]=_0x3032a9[_0x013b('0xb')];_0xe37918[_0x013b('0x9')][_0x013b('0xc')]=_0x3032a9['oldToken'];_0xe37918[_0x013b('0x9')][_0x013b('0xd')]=_0x3032a9[_0x013b('0xe')];_0xe37918[_0x013b('0x9')][_0x013b('0xf')]=_0x3032a9[_0x013b('0x10')];_0xe37918[_0x013b('0x9')]['customfield_11504']=_0x3032a9[_0x013b('0x11')];_0xe37918['fields']['customfield_10102']=_0x3032a9['ip'];var _0x50cefc={'host':_0x013b('0x12'),'port':0x1bb,'path':_0x013b('0x13'),'method':_0x013b('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0x013b('0x15'),'Authorization':_0x013b('0x16')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x013b('0x17'))}};var _0x4d9706=JSON[_0x013b('0x18')](_0xe37918);var _0x89cee4=https['request'](_0x50cefc,function(_0x22cce8){_0x22cce8['setEncoding'](_0x013b('0x19'));var _0x2fb7eb='';_0x22cce8['on'](_0x013b('0x1a'),function(_0x49728c){_0x2fb7eb+=_0x49728c;});_0x22cce8['on'](_0x013b('0x1b'),function(){if(_0x14f0f4){return _0x14f0f4['status'](_0x22cce8[_0x013b('0x1c')])[_0x013b('0x1d')](JSON[_0x013b('0x1e')](_0x2fb7eb));}});});_0x89cee4['on']('error',function(_0xc25e79){if(_0x14f0f4){return _0x14f0f4[_0x013b('0x1f')](0x1f4)[_0x013b('0x1d')]({'errors':[{'message':_0x013b('0x20'),'type':_0x013b('0x21')}]});}});_0x89cee4[_0x013b('0x22')](_0x4d9706);_0x89cee4[_0x013b('0x1b')]();}exports[_0x013b('0x23')]=openIssue;exports[_0x013b('0x24')]=function(_0x10cd8a,_0x4b6f30){_0x10cd8a['body']['ip']=_0x10cd8a[_0x013b('0x25')]['x-forwarded-for']||_0x10cd8a[_0x013b('0x26')]['remoteAddress']||_0x10cd8a[_0x013b('0x27')]['remoteAddress']||_0x10cd8a[_0x013b('0x26')][_0x013b('0x27')][_0x013b('0x28')];return openIssue(_0x10cd8a[_0x013b('0x29')],_0x4b6f30);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 34a890d..b392175 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 _0xb7e9=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x1aff95,_0x50de20){var _0x3b208f=function(_0x26a7a2){while(--_0x26a7a2){_0x1aff95['push'](_0x1aff95['shift']());}};_0x3b208f(++_0x50de20);}(_0xb7e9,0x89));var _0x9b7e=function(_0x1aa8e4,_0x422beb){_0x1aa8e4=_0x1aa8e4-0x0;var _0x335a4d=_0xb7e9[_0x1aa8e4];return _0x335a4d;};'use strict';var multer=require(_0x9b7e('0x0'));var util=require(_0x9b7e('0x1'));var path=require(_0x9b7e('0x2'));var timeout=require(_0x9b7e('0x3'));var express=require(_0x9b7e('0x4'));var router=express[_0x9b7e('0x5')]();var auth=require(_0x9b7e('0x6'));var interaction=require(_0x9b7e('0x7'));var config=require(_0x9b7e('0x8'));var controller=require(_0x9b7e('0x9'));router[_0x9b7e('0xa')]('/',auth[_0x9b7e('0xb')](),controller[_0x9b7e('0xc')]);router['get'](_0x9b7e('0xd'),auth[_0x9b7e('0xb')](),controller[_0x9b7e('0xe')]);router[_0x9b7e('0xa')](_0x9b7e('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x9b7e('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9b7e('0x11')]('/:id',auth[_0x9b7e('0xb')](),controller[_0x9b7e('0x12')]);router[_0x9b7e('0x13')](_0x9b7e('0xf'),auth[_0x9b7e('0xb')](),controller[_0x9b7e('0x14')]);module[_0x9b7e('0x15')]=router; \ No newline at end of file +var _0x5cec=['describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe'];(function(_0x2ee2e,_0x5c9e69){var _0x69c02=function(_0x2e651c){while(--_0x2e651c){_0x2ee2e['push'](_0x2ee2e['shift']());}};_0x69c02(++_0x5c9e69);}(_0x5cec,0x159));var _0xc5ce=function(_0xec269c,_0x30e0ce){_0xec269c=_0xec269c-0x0;var _0x37fc4b=_0x5cec[_0xec269c];return _0x37fc4b;};'use strict';var multer=require(_0xc5ce('0x0'));var util=require(_0xc5ce('0x1'));var path=require(_0xc5ce('0x2'));var timeout=require(_0xc5ce('0x3'));var express=require('express');var router=express[_0xc5ce('0x4')]();var auth=require(_0xc5ce('0x5'));var interaction=require(_0xc5ce('0x6'));var config=require('../../config/environment');var controller=require(_0xc5ce('0x7'));router[_0xc5ce('0x8')]('/',auth[_0xc5ce('0x9')](),controller[_0xc5ce('0xa')]);router['get'](_0xc5ce('0xb'),auth['isAuthenticated'](),controller[_0xc5ce('0xc')]);router[_0xc5ce('0x8')](_0xc5ce('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xc5ce('0xe')]('/',auth[_0xc5ce('0x9')](),controller[_0xc5ce('0xf')]);router[_0xc5ce('0x10')]('/:id',auth[_0xc5ce('0x9')](),controller[_0xc5ce('0x11')]);router[_0xc5ce('0x12')](_0xc5ce('0xd'),auth[_0xc5ce('0x9')](),controller[_0xc5ce('0x13')]);module[_0xc5ce('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index efeeae2..30e3877 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 _0x1d2d=['sequelize','exports','TEXT','long','STRING'];(function(_0x46ffb5,_0x4ee7a8){var _0x38e940=function(_0x5d57b3){while(--_0x5d57b3){_0x46ffb5['push'](_0x46ffb5['shift']());}};_0x38e940(++_0x4ee7a8);}(_0x1d2d,0xf0));var _0xd1d2=function(_0xc69c2c,_0x42086b){_0xc69c2c=_0xc69c2c-0x0;var _0x2049ce=_0x1d2d[_0xc69c2c];return _0x2049ce;};'use strict';var Sequelize=require(_0xd1d2('0x0'));module[_0xd1d2('0x1')]={'question':{'type':Sequelize[_0xd1d2('0x2')]},'answer':{'type':Sequelize[_0xd1d2('0x2')](_0xd1d2('0x3'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xd1d2('0x4')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd1d2('0x4')]},'calleridnum':{'type':Sequelize[_0xd1d2('0x4')]},'questionId':{'type':Sequelize[_0xd1d2('0x4')]}}; \ No newline at end of file +var _0x6582=['exports','TEXT','long','STRING','sequelize'];(function(_0x1aeda2,_0x1217eb){var _0x32dc6d=function(_0x34a460){while(--_0x34a460){_0x1aeda2['push'](_0x1aeda2['shift']());}};_0x32dc6d(++_0x1217eb);}(_0x6582,0x108));var _0x2658=function(_0xc2e46e,_0x3b979c){_0xc2e46e=_0xc2e46e-0x0;var _0x1a355d=_0x6582[_0xc2e46e];return _0x1a355d;};'use strict';var Sequelize=require(_0x2658('0x0'));module[_0x2658('0x1')]={'question':{'type':Sequelize[_0x2658('0x2')]},'answer':{'type':Sequelize[_0x2658('0x2')](_0x2658('0x3'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x2658('0x4')]},'queue':{'type':Sequelize[_0x2658('0x4')]},'uniqueid':{'type':Sequelize[_0x2658('0x4')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 1e00578..e7b1e2a 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 _0x9903=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','destroy','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','type','model','query','keys','filters','attributes','intersection','order','sort','where','pick','merge','filter','options','count','includeAll','include','findAll','rows','catch','show','params','fields','length','find','create','body','update','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','util','path','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9903,0x1e0));var _0x3990=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9903[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x3990('0x0'));var emlformat=require(_0x3990('0x1'));var rimraf=require(_0x3990('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3990('0x3'));var rp=require('request-promise');var moment=require(_0x3990('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3990('0x5'));var path=require(_0x3990('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3990('0x7'));var fs=require('fs');var _=require(_0x3990('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3990('0x9'));var deskjs=require(_0x3990('0xa'));var toCsv=require(_0x3990('0xb'));var querystring=require(_0x3990('0xc'));var Papa=require(_0x3990('0xd'));var Redis=require(_0x3990('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3990('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3990('0x10'))(_0x3990('0x11'));var utils=require(_0x3990('0x12'));var config=require(_0x3990('0x13'));var licenseUtil=require(_0x3990('0x14'));var db=require(_0x3990('0x15'))['db'];function respondWithStatusCode(_0x54bc05,_0x370ebb){_0x370ebb=_0x370ebb||0xcc;return function(_0xac2b31){if(_0xac2b31){return _0x54bc05[_0x3990('0x16')](_0x370ebb);}return _0x54bc05[_0x3990('0x17')](_0x370ebb)[_0x3990('0x18')]();};}function respondWithResult(_0x35e0df,_0xf74bf2){_0xf74bf2=_0xf74bf2||0xc8;return function(_0x28f8f7){if(_0x28f8f7){return _0x35e0df[_0x3990('0x17')](_0xf74bf2)[_0x3990('0x19')](_0x28f8f7);}};}function respondWithFilteredResult(_0x55ec50,_0x4eeaec){return function(_0x1fadf0){if(_0x1fadf0){var _0x47440a=_0x1fadf0['count'],_0x231b52=_0x4eeaec[_0x3990('0x1a')],_0x22a863=_0x4eeaec['offset']+_0x4eeaec[_0x3990('0x1b')],_0x1f1cd5;if(_0x22a863>=_0x47440a){_0x22a863=_0x47440a;_0x1f1cd5=0xc8;}else{_0x1f1cd5=0xce;}_0x55ec50[_0x3990('0x17')](_0x1f1cd5);return _0x55ec50[_0x3990('0x1c')]('Content-Range',_0x231b52+'-'+_0x22a863+'/'+_0x47440a)[_0x3990('0x19')](_0x1fadf0);}return null;};}function patchUpdates(_0x5f15cb){return function(_0x252168){try{jsonpatch[_0x3990('0x1d')](_0x252168,_0x5f15cb,!![]);}catch(_0x4e2cab){return BPromise[_0x3990('0x1e')](_0x4e2cab);}return _0x252168[_0x3990('0x1f')]();};}function saveUpdates(_0x100f7f,_0x3235c5){return function(_0x19ffb7){if(_0x19ffb7){return _0x19ffb7['update'](_0x100f7f)['then'](function(_0x1f652c){return _0x1f652c;});}return null;};}function removeEntity(_0x344ec9,_0x4a78e1){return function(_0x47e25d){if(_0x47e25d){return _0x47e25d[_0x3990('0x20')]()[_0x3990('0x21')](function(){_0x344ec9[_0x3990('0x17')](0xcc)[_0x3990('0x18')]();});}};}function handleEntityNotFound(_0xa0a417,_0x1c77f7){return function(_0x474c1f){if(!_0x474c1f){_0xa0a417[_0x3990('0x16')](0x194);}return _0x474c1f;};}function handleError(_0x1aa761,_0x422d8b){_0x422d8b=_0x422d8b||0x1f4;return function(_0xbf234f){logger[_0x3990('0x22')](_0xbf234f[_0x3990('0x23')]);if(_0xbf234f[_0x3990('0x24')]){delete _0xbf234f[_0x3990('0x24')];}_0x1aa761[_0x3990('0x17')](_0x422d8b)[_0x3990('0x25')](_0xbf234f);};}exports[_0x3990('0x26')]=function(_0x429120,_0x5f3905){var _0x1fb7d9={},_0x4a9372={},_0x4b5780={'count':0x0,'rows':[]};var _0x102ba3=_[_0x3990('0x27')](db[_0x3990('0x28')][_0x3990('0x29')],function(_0x53bf94){return{'name':_0x53bf94['fieldName'],'type':_0x53bf94[_0x3990('0x2a')]['key']};});_0x4a9372[_0x3990('0x2b')]=_[_0x3990('0x27')](_0x102ba3,'name');_0x4a9372[_0x3990('0x2c')]=_[_0x3990('0x2d')](_0x429120[_0x3990('0x2c')]);_0x4a9372[_0x3990('0x2e')]=_['intersection'](_0x4a9372[_0x3990('0x2b')],_0x4a9372[_0x3990('0x2c')]);_0x1fb7d9[_0x3990('0x2f')]=_[_0x3990('0x30')](_0x4a9372[_0x3990('0x2b')],qs['fields'](_0x429120['query']['fields']));_0x1fb7d9['attributes']=_0x1fb7d9[_0x3990('0x2f')]['length']?_0x1fb7d9[_0x3990('0x2f')]:_0x4a9372['model'];if(!_0x429120[_0x3990('0x2c')]['hasOwnProperty']('nolimit')){_0x1fb7d9[_0x3990('0x1b')]=qs[_0x3990('0x1b')](_0x429120[_0x3990('0x2c')][_0x3990('0x1b')]);_0x1fb7d9[_0x3990('0x1a')]=qs['offset'](_0x429120[_0x3990('0x2c')][_0x3990('0x1a')]);}_0x1fb7d9[_0x3990('0x31')]=qs[_0x3990('0x32')](_0x429120['query']['sort']);_0x1fb7d9[_0x3990('0x33')]=qs[_0x3990('0x2e')](_[_0x3990('0x34')](_0x429120[_0x3990('0x2c')],_0x4a9372[_0x3990('0x2e')]),_0x102ba3);if(_0x429120[_0x3990('0x2c')]['filter']){_0x1fb7d9[_0x3990('0x33')]=_[_0x3990('0x35')](_0x1fb7d9[_0x3990('0x33')],{'$or':_[_0x3990('0x27')](_0x102ba3,function(_0x541d02){if(_0x541d02[_0x3990('0x2a')]!=='VIRTUAL'){var _0x4c4637={};_0x4c4637[_0x541d02[_0x3990('0x24')]]={'$like':'%'+_0x429120[_0x3990('0x2c')][_0x3990('0x36')]+'%'};return _0x4c4637;}})});}_0x1fb7d9=_[_0x3990('0x35')]({},_0x1fb7d9,_0x429120[_0x3990('0x37')]);var _0x25d720={'where':_0x1fb7d9[_0x3990('0x33')]};return db[_0x3990('0x28')][_0x3990('0x38')](_0x25d720)['then'](function(_0x24dcf8){_0x4b5780[_0x3990('0x38')]=_0x24dcf8;if(_0x429120[_0x3990('0x2c')][_0x3990('0x39')]){_0x1fb7d9[_0x3990('0x3a')]=[{'all':!![]}];}return db[_0x3990('0x28')][_0x3990('0x3b')](_0x1fb7d9);})['then'](function(_0x76c8de){_0x4b5780[_0x3990('0x3c')]=_0x76c8de;return _0x4b5780;})[_0x3990('0x21')](respondWithFilteredResult(_0x5f3905,_0x1fb7d9))[_0x3990('0x3d')](handleError(_0x5f3905,null));};exports[_0x3990('0x3e')]=function(_0x4f0254,_0x87150d){var _0x47aa50={'raw':!![],'where':{'id':_0x4f0254[_0x3990('0x3f')]['id']}},_0x463b13={};_0x463b13[_0x3990('0x2b')]=_['keys'](db['JscriptyAnswerReport'][_0x3990('0x29')]);_0x463b13[_0x3990('0x2c')]=_[_0x3990('0x2d')](_0x4f0254[_0x3990('0x2c')]);_0x463b13[_0x3990('0x2e')]=_[_0x3990('0x30')](_0x463b13[_0x3990('0x2b')],_0x463b13[_0x3990('0x2c')]);_0x47aa50[_0x3990('0x2f')]=_[_0x3990('0x30')](_0x463b13[_0x3990('0x2b')],qs[_0x3990('0x40')](_0x4f0254[_0x3990('0x2c')][_0x3990('0x40')]));_0x47aa50[_0x3990('0x2f')]=_0x47aa50[_0x3990('0x2f')][_0x3990('0x41')]?_0x47aa50[_0x3990('0x2f')]:_0x463b13[_0x3990('0x2b')];if(_0x4f0254['query']['includeAll']){_0x47aa50['include']=[{'all':!![]}];}_0x47aa50=_[_0x3990('0x35')]({},_0x47aa50,_0x4f0254['options']);return db[_0x3990('0x28')][_0x3990('0x42')](_0x47aa50)[_0x3990('0x21')](handleEntityNotFound(_0x87150d,null))[_0x3990('0x21')](respondWithResult(_0x87150d,null))[_0x3990('0x3d')](handleError(_0x87150d,null));};exports['create']=function(_0x4b64b0,_0x5407d8){return db[_0x3990('0x28')][_0x3990('0x43')](_0x4b64b0[_0x3990('0x44')],{})['then'](respondWithResult(_0x5407d8,0xc9))['catch'](handleError(_0x5407d8,null));};exports[_0x3990('0x45')]=function(_0x474b93,_0x9d8260){if(_0x474b93['body']['id']){delete _0x474b93[_0x3990('0x44')]['id'];}return db[_0x3990('0x28')]['find']({'where':{'id':_0x474b93[_0x3990('0x3f')]['id']}})['then'](handleEntityNotFound(_0x9d8260,null))[_0x3990('0x21')](saveUpdates(_0x474b93[_0x3990('0x44')],null))[_0x3990('0x21')](respondWithResult(_0x9d8260,null))[_0x3990('0x3d')](handleError(_0x9d8260,null));};exports[_0x3990('0x20')]=function(_0x43db51,_0x58175f){return db[_0x3990('0x28')]['find']({'where':{'id':_0x43db51[_0x3990('0x3f')]['id']}})[_0x3990('0x21')](handleEntityNotFound(_0x58175f,null))[_0x3990('0x21')](removeEntity(_0x58175f,null))['catch'](handleError(_0x58175f,null));};exports[_0x3990('0x46')]=function(_0x5dc2e7,_0x28a924){return db[_0x3990('0x28')]['describe']()[_0x3990('0x21')](respondWithResult(_0x28a924,null))[_0x3990('0x3d')](handleError(_0x28a924,null));}; \ No newline at end of file +var _0x94ce=['query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','Content-Range','apply','save','update','then','end','error','stack','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x94ce,0xf7));var _0xe94c=function(_0x3463bf,_0x2644e2){_0x3463bf=_0x3463bf-0x0;var _0x2c304b=_0x94ce[_0x3463bf];return _0x2c304b;};'use strict';var pdf=require(_0xe94c('0x0'));var emlformat=require(_0xe94c('0x1'));var rimraf=require(_0xe94c('0x2'));var zipdir=require(_0xe94c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe94c('0x4'));var moment=require(_0xe94c('0x5'));var BPromise=require(_0xe94c('0x6'));var Mustache=require(_0xe94c('0x7'));var util=require(_0xe94c('0x8'));var path=require(_0xe94c('0x9'));var sox=require(_0xe94c('0xa'));var csv=require('to-csv');var ejs=require(_0xe94c('0xb'));var fs=require('fs');var _=require(_0xe94c('0xc'));var squel=require('squel');var crypto=require(_0xe94c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe94c('0xe'));var toCsv=require(_0xe94c('0xf'));var querystring=require(_0xe94c('0x10'));var Papa=require(_0xe94c('0x11'));var Redis=require(_0xe94c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe94c('0x13'));var as=require(_0xe94c('0x14'));var hardwareService=require(_0xe94c('0x15'));var logger=require(_0xe94c('0x16'))(_0xe94c('0x17'));var utils=require('../../config/utils');var config=require(_0xe94c('0x18'));var licenseUtil=require(_0xe94c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d7573,_0xf263ec){_0xf263ec=_0xf263ec||0xcc;return function(_0x4d803c){if(_0x4d803c){return _0x3d7573[_0xe94c('0x1a')](_0xf263ec);}return _0x3d7573[_0xe94c('0x1b')](_0xf263ec)['end']();};}function respondWithResult(_0x333c1a,_0x57e1db){_0x57e1db=_0x57e1db||0xc8;return function(_0x53ee4b){if(_0x53ee4b){return _0x333c1a[_0xe94c('0x1b')](_0x57e1db)[_0xe94c('0x1c')](_0x53ee4b);}};}function respondWithFilteredResult(_0x18bf87,_0x59fb99){return function(_0x24e362){if(_0x24e362){var _0x374848=_0x24e362[_0xe94c('0x1d')],_0x354bbb=_0x59fb99[_0xe94c('0x1e')],_0x38449a=_0x59fb99[_0xe94c('0x1e')]+_0x59fb99['limit'],_0x404ed0;if(_0x38449a>=_0x374848){_0x38449a=_0x374848;_0x404ed0=0xc8;}else{_0x404ed0=0xce;}_0x18bf87[_0xe94c('0x1b')](_0x404ed0);return _0x18bf87['set'](_0xe94c('0x1f'),_0x354bbb+'-'+_0x38449a+'/'+_0x374848)[_0xe94c('0x1c')](_0x24e362);}return null;};}function patchUpdates(_0x136d2d){return function(_0x285c10){try{jsonpatch[_0xe94c('0x20')](_0x285c10,_0x136d2d,!![]);}catch(_0x1e9426){return BPromise['reject'](_0x1e9426);}return _0x285c10[_0xe94c('0x21')]();};}function saveUpdates(_0x3e57ff,_0x264bd7){return function(_0x136b9c){if(_0x136b9c){return _0x136b9c[_0xe94c('0x22')](_0x3e57ff)[_0xe94c('0x23')](function(_0x27652b){return _0x27652b;});}return null;};}function removeEntity(_0x500f6,_0x245363){return function(_0x1e2b6f){if(_0x1e2b6f){return _0x1e2b6f['destroy']()[_0xe94c('0x23')](function(){_0x500f6['status'](0xcc)[_0xe94c('0x24')]();});}};}function handleEntityNotFound(_0xe12269,_0x4e10d2){return function(_0x2034ff){if(!_0x2034ff){_0xe12269[_0xe94c('0x1a')](0x194);}return _0x2034ff;};}function handleError(_0x4dc85a,_0x409a82){_0x409a82=_0x409a82||0x1f4;return function(_0x5a44fb){logger[_0xe94c('0x25')](_0x5a44fb[_0xe94c('0x26')]);if(_0x5a44fb[_0xe94c('0x27')]){delete _0x5a44fb[_0xe94c('0x27')];}_0x4dc85a[_0xe94c('0x1b')](_0x409a82)[_0xe94c('0x28')](_0x5a44fb);};}exports['index']=function(_0x13bfb1,_0x14601a){var _0x27c41f={},_0x108c68={},_0x139848={'count':0x0,'rows':[]};var _0x2a881a=_[_0xe94c('0x29')](db[_0xe94c('0x2a')][_0xe94c('0x2b')],function(_0x2149f6){return{'name':_0x2149f6[_0xe94c('0x2c')],'type':_0x2149f6['type']['key']};});_0x108c68['model']=_[_0xe94c('0x29')](_0x2a881a,_0xe94c('0x27'));_0x108c68[_0xe94c('0x2d')]=_['keys'](_0x13bfb1['query']);_0x108c68[_0xe94c('0x2e')]=_[_0xe94c('0x2f')](_0x108c68[_0xe94c('0x30')],_0x108c68[_0xe94c('0x2d')]);_0x27c41f['attributes']=_[_0xe94c('0x2f')](_0x108c68[_0xe94c('0x30')],qs['fields'](_0x13bfb1[_0xe94c('0x2d')][_0xe94c('0x31')]));_0x27c41f[_0xe94c('0x32')]=_0x27c41f[_0xe94c('0x32')][_0xe94c('0x33')]?_0x27c41f['attributes']:_0x108c68[_0xe94c('0x30')];if(!_0x13bfb1[_0xe94c('0x2d')][_0xe94c('0x34')](_0xe94c('0x35'))){_0x27c41f[_0xe94c('0x36')]=qs['limit'](_0x13bfb1[_0xe94c('0x2d')][_0xe94c('0x36')]);_0x27c41f[_0xe94c('0x1e')]=qs[_0xe94c('0x1e')](_0x13bfb1[_0xe94c('0x2d')][_0xe94c('0x1e')]);}_0x27c41f[_0xe94c('0x37')]=qs[_0xe94c('0x38')](_0x13bfb1[_0xe94c('0x2d')]['sort']);_0x27c41f[_0xe94c('0x39')]=qs['filters'](_['pick'](_0x13bfb1[_0xe94c('0x2d')],_0x108c68[_0xe94c('0x2e')]),_0x2a881a);if(_0x13bfb1[_0xe94c('0x2d')][_0xe94c('0x3a')]){_0x27c41f[_0xe94c('0x39')]=_[_0xe94c('0x3b')](_0x27c41f[_0xe94c('0x39')],{'$or':_['map'](_0x2a881a,function(_0x49134c){if(_0x49134c['type']!==_0xe94c('0x3c')){var _0x2c43b9={};_0x2c43b9[_0x49134c[_0xe94c('0x27')]]={'$like':'%'+_0x13bfb1['query']['filter']+'%'};return _0x2c43b9;}})});}_0x27c41f=_[_0xe94c('0x3b')]({},_0x27c41f,_0x13bfb1[_0xe94c('0x3d')]);var _0x4be88d={'where':_0x27c41f[_0xe94c('0x39')]};return db[_0xe94c('0x2a')]['count'](_0x4be88d)['then'](function(_0x55e953){_0x139848[_0xe94c('0x1d')]=_0x55e953;if(_0x13bfb1[_0xe94c('0x2d')][_0xe94c('0x3e')]){_0x27c41f[_0xe94c('0x3f')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xe94c('0x40')](_0x27c41f);})[_0xe94c('0x23')](function(_0x3ea081){_0x139848[_0xe94c('0x41')]=_0x3ea081;return _0x139848;})['then'](respondWithFilteredResult(_0x14601a,_0x27c41f))[_0xe94c('0x42')](handleError(_0x14601a,null));};exports['show']=function(_0x187842,_0x9f293){var _0x180a04={'raw':!![],'where':{'id':_0x187842[_0xe94c('0x43')]['id']}},_0x217294={};_0x217294[_0xe94c('0x30')]=_['keys'](db[_0xe94c('0x2a')]['rawAttributes']);_0x217294['query']=_['keys'](_0x187842[_0xe94c('0x2d')]);_0x217294[_0xe94c('0x2e')]=_['intersection'](_0x217294[_0xe94c('0x30')],_0x217294[_0xe94c('0x2d')]);_0x180a04[_0xe94c('0x32')]=_[_0xe94c('0x2f')](_0x217294[_0xe94c('0x30')],qs[_0xe94c('0x31')](_0x187842['query'][_0xe94c('0x31')]));_0x180a04[_0xe94c('0x32')]=_0x180a04[_0xe94c('0x32')]['length']?_0x180a04['attributes']:_0x217294['model'];if(_0x187842['query'][_0xe94c('0x3e')]){_0x180a04['include']=[{'all':!![]}];}_0x180a04=_[_0xe94c('0x3b')]({},_0x180a04,_0x187842[_0xe94c('0x3d')]);return db[_0xe94c('0x2a')][_0xe94c('0x44')](_0x180a04)['then'](handleEntityNotFound(_0x9f293,null))[_0xe94c('0x23')](respondWithResult(_0x9f293,null))['catch'](handleError(_0x9f293,null));};exports[_0xe94c('0x45')]=function(_0x487c99,_0x1f2a8b){return db[_0xe94c('0x2a')]['create'](_0x487c99['body'],{})[_0xe94c('0x23')](respondWithResult(_0x1f2a8b,0xc9))[_0xe94c('0x42')](handleError(_0x1f2a8b,null));};exports['update']=function(_0xa7b1bd,_0x52cd69){if(_0xa7b1bd['body']['id']){delete _0xa7b1bd[_0xe94c('0x46')]['id'];}return db[_0xe94c('0x2a')][_0xe94c('0x44')]({'where':{'id':_0xa7b1bd[_0xe94c('0x43')]['id']}})[_0xe94c('0x23')](handleEntityNotFound(_0x52cd69,null))[_0xe94c('0x23')](saveUpdates(_0xa7b1bd[_0xe94c('0x46')],null))[_0xe94c('0x23')](respondWithResult(_0x52cd69,null))[_0xe94c('0x42')](handleError(_0x52cd69,null));};exports[_0xe94c('0x47')]=function(_0x5961e3,_0x42bea7){return db[_0xe94c('0x2a')]['find']({'where':{'id':_0x5961e3[_0xe94c('0x43')]['id']}})['then'](handleEntityNotFound(_0x42bea7,null))[_0xe94c('0x23')](removeEntity(_0x42bea7,null))[_0xe94c('0x42')](handleError(_0x42bea7,null));};exports[_0xe94c('0x48')]=function(_0xfe9b5a,_0x4e4fa0){return db[_0xe94c('0x2a')][_0xe94c('0x48')]()[_0xe94c('0x23')](respondWithResult(_0x4e4fa0,null))['catch'](handleError(_0x4e4fa0,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 1328e41..c46bc52 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 _0x53ef=['JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','exports','define'];(function(_0x17f632,_0x23bc1f){var _0xed6eba=function(_0x427eb2){while(--_0x427eb2){_0x17f632['push'](_0x17f632['shift']());}};_0xed6eba(++_0x23bc1f);}(_0x53ef,0x178));var _0xf53e=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0x53ef[_0x1e500e];return _0x10dc5e;};'use strict';var _=require(_0xf53e('0x0'));var util=require(_0xf53e('0x1'));var logger=require(_0xf53e('0x2'))('api');var moment=require(_0xf53e('0x3'));var BPromise=require(_0xf53e('0x4'));var rp=require(_0xf53e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf53e('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module[_0xf53e('0x7')]=function(_0x483d1f,_0x2a29a5){return _0x483d1f[_0xf53e('0x8')](_0xf53e('0x9'),attributes,{'tableName':_0xf53e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x328a=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','util','../../config/logger','api'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x328a,0xed));var _0xa328=function(_0x508bf9,_0x3cf21e){_0x508bf9=_0x508bf9-0x0;var _0x43994d=_0x328a[_0x508bf9];return _0x43994d;};'use strict';var _=require('lodash');var util=require(_0xa328('0x0'));var logger=require(_0xa328('0x1'))(_0xa328('0x2'));var moment=require('moment');var BPromise=require(_0xa328('0x3'));var rp=require(_0xa328('0x4'));var fs=require('fs');var path=require(_0xa328('0x5'));var rimraf=require(_0xa328('0x6'));var config=require(_0xa328('0x7'));var attributes=require(_0xa328('0x8'));module[_0xa328('0x9')]=function(_0x15b6bd,_0x20bd2b){return _0x15b6bd[_0xa328('0xa')]('JscriptyAnswerReport',attributes,{'tableName':_0xa328('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 6ac9163..c3ebc1a 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 _0x85b9=['error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x582f72,_0x886d8){var _0x4cd5fe=function(_0x4ac1c7){while(--_0x4ac1c7){_0x582f72['push'](_0x582f72['shift']());}};_0x4cd5fe(++_0x886d8);}(_0x85b9,0x109));var _0x985b=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x85b9[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x985b('0x0'));var util=require(_0x985b('0x1'));var moment=require(_0x985b('0x2'));var BPromise=require(_0x985b('0x3'));var rs=require(_0x985b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x985b('0x5'));var logger=require(_0x985b('0x6'))('rpc');var config=require(_0x985b('0x7'));var jayson=require(_0x985b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x554a09,_0x141ef6,_0x5cceb9){return new BPromise(function(_0x46470e,_0xde8280){return client[_0x985b('0x9')](_0x554a09,_0x5cceb9)[_0x985b('0xa')](function(_0x277ed6){logger['info'](_0x985b('0xb'),_0x141ef6,_0x985b('0xc'));logger['debug'](_0x985b('0xd'),_0x141ef6,_0x985b('0xc'),JSON[_0x985b('0xe')](_0x277ed6));if(_0x277ed6[_0x985b('0xf')]){if(_0x277ed6[_0x985b('0xf')]['code']===0x1f4){logger['error'](_0x985b('0xb'),_0x141ef6,_0x277ed6[_0x985b('0xf')][_0x985b('0x10')]);return _0xde8280(_0x277ed6[_0x985b('0xf')][_0x985b('0x10')]);}logger[_0x985b('0xf')](_0x985b('0xb'),_0x141ef6,_0x277ed6['error'][_0x985b('0x10')]);return _0x46470e(_0x277ed6[_0x985b('0xf')][_0x985b('0x10')]);}else{logger[_0x985b('0x11')](_0x985b('0xb'),_0x141ef6,_0x985b('0xc'));_0x46470e(_0x277ed6[_0x985b('0x12')][_0x985b('0x10')]);}})[_0x985b('0x13')](function(_0x4deae0){logger[_0x985b('0xf')](_0x985b('0xb'),_0x141ef6,_0x4deae0);_0xde8280(_0x4deae0);});});} \ No newline at end of file +var _0xbee2=['request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x25b9fc,_0x5770fd){var _0x38e7db=function(_0x2b44e5){while(--_0x2b44e5){_0x25b9fc['push'](_0x25b9fc['shift']());}};_0x38e7db(++_0x5770fd);}(_0xbee2,0x11f));var _0x2bee=function(_0x43b487,_0x21893a){_0x43b487=_0x43b487-0x0;var _0x2f707a=_0xbee2[_0x43b487];return _0x2f707a;};'use strict';var _=require(_0x2bee('0x0'));var util=require(_0x2bee('0x1'));var moment=require(_0x2bee('0x2'));var BPromise=require(_0x2bee('0x3'));var rs=require(_0x2bee('0x4'));var fs=require('fs');var Redis=require(_0x2bee('0x5'));var db=require(_0x2bee('0x6'))['db'];var utils=require(_0x2bee('0x7'));var logger=require('../../config/logger')(_0x2bee('0x8'));var config=require(_0x2bee('0x9'));var jayson=require(_0x2bee('0xa'));var client=jayson[_0x2bee('0xb')][_0x2bee('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2195c5,_0x5b1d58,_0x10f4d1){return new BPromise(function(_0x17d060,_0x52c113){return client[_0x2bee('0xd')](_0x2195c5,_0x10f4d1)[_0x2bee('0xe')](function(_0x371efc){logger['info'](_0x2bee('0xf'),_0x5b1d58,_0x2bee('0x10'));logger[_0x2bee('0x11')](_0x2bee('0x12'),_0x5b1d58,'request\x20sent',JSON[_0x2bee('0x13')](_0x371efc));if(_0x371efc[_0x2bee('0x14')]){if(_0x371efc[_0x2bee('0x14')][_0x2bee('0x15')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x5b1d58,_0x371efc[_0x2bee('0x14')][_0x2bee('0x16')]);return _0x52c113(_0x371efc[_0x2bee('0x14')][_0x2bee('0x16')]);}logger[_0x2bee('0x14')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5b1d58,_0x371efc[_0x2bee('0x14')][_0x2bee('0x16')]);return _0x17d060(_0x371efc['error'][_0x2bee('0x16')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x5b1d58,_0x2bee('0x10'));_0x17d060(_0x371efc[_0x2bee('0x17')]['message']);}})[_0x2bee('0x18')](function(_0x255a2f){logger[_0x2bee('0x14')](_0x2bee('0xf'),_0x5b1d58,_0x255a2f);_0x52c113(_0x255a2f);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 41a9ddf..a738a34 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 _0xef5a=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','getSessions','/:id/answers','getAnswers','30s','getSummary','post','clone','update','destroy','exports','multer','util','path'];(function(_0x17790b,_0x353b9b){var _0x26e8b3=function(_0x2a60db){while(--_0x2a60db){_0x17790b['push'](_0x17790b['shift']());}};_0x26e8b3(++_0x353b9b);}(_0xef5a,0x1e0));var _0xaef5=function(_0x159187,_0x572db4){_0x159187=_0x159187-0x0;var _0x3eaa07=_0xef5a[_0x159187];return _0x3eaa07;};'use strict';var multer=require(_0xaef5('0x0'));var util=require(_0xaef5('0x1'));var path=require(_0xaef5('0x2'));var timeout=require(_0xaef5('0x3'));var express=require(_0xaef5('0x4'));var router=express[_0xaef5('0x5')]();var auth=require(_0xaef5('0x6'));var interaction=require(_0xaef5('0x7'));var config=require(_0xaef5('0x8'));var controller=require('./jscriptyProject.controller');router[_0xaef5('0x9')]('/',auth[_0xaef5('0xa')](),controller[_0xaef5('0xb')]);router[_0xaef5('0x9')](_0xaef5('0xc'),auth[_0xaef5('0xa')](),controller['show']);router[_0xaef5('0x9')]('/:id/sessions',auth[_0xaef5('0xa')](),controller[_0xaef5('0xd')]);router[_0xaef5('0x9')](_0xaef5('0xe'),auth[_0xaef5('0xa')](),controller[_0xaef5('0xf')]);router[_0xaef5('0x9')]('/:id/summary',auth[_0xaef5('0xa')](),timeout(_0xaef5('0x10')),controller[_0xaef5('0x11')]);router[_0xaef5('0x12')]('/',auth[_0xaef5('0xa')](),controller['create']);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0xaef5('0x13')]);router['put'](_0xaef5('0xc'),auth['isAuthenticated'](),controller[_0xaef5('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xaef5('0x15')]);module[_0xaef5('0x16')]=router; \ No newline at end of file +var _0x4149=['../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','show','/:id/sessions','/:id/answers','/:id/summary','30s','post','create','/:id/clone','clone','put','/:id','update','exports','multer','util','path','connect-timeout','Router'];(function(_0x187bbf,_0x384bcc){var _0x29ccce=function(_0x225f35){while(--_0x225f35){_0x187bbf['push'](_0x187bbf['shift']());}};_0x29ccce(++_0x384bcc);}(_0x4149,0x10f));var _0x9414=function(_0x35b908,_0x12301e){_0x35b908=_0x35b908-0x0;var _0x417a43=_0x4149[_0x35b908];return _0x417a43;};'use strict';var multer=require(_0x9414('0x0'));var util=require(_0x9414('0x1'));var path=require(_0x9414('0x2'));var timeout=require(_0x9414('0x3'));var express=require('express');var router=express[_0x9414('0x4')]();var auth=require(_0x9414('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9414('0x6'));var controller=require(_0x9414('0x7'));router[_0x9414('0x8')]('/',auth[_0x9414('0x9')](),controller['index']);router[_0x9414('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x9414('0xa')]);router[_0x9414('0x8')](_0x9414('0xb'),auth[_0x9414('0x9')](),controller['getSessions']);router[_0x9414('0x8')](_0x9414('0xc'),auth[_0x9414('0x9')](),controller['getAnswers']);router[_0x9414('0x8')](_0x9414('0xd'),auth[_0x9414('0x9')](),timeout(_0x9414('0xe')),controller['getSummary']);router[_0x9414('0xf')]('/',auth['isAuthenticated'](),controller[_0x9414('0x10')]);router[_0x9414('0xf')](_0x9414('0x11'),auth[_0x9414('0x9')](),controller[_0x9414('0x12')]);router[_0x9414('0x13')](_0x9414('0x14'),auth['isAuthenticated'](),controller[_0x9414('0x15')]);router['delete'](_0x9414('0x14'),auth[_0x9414('0x9')](),controller['destroy']);module[_0x9414('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 356038a..75cc7e5 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 _0x04c6=['stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','long','setDataValue','formData'];(function(_0x3c0b53,_0x34cdd3){var _0x48246a=function(_0x314dbc){while(--_0x314dbc){_0x3c0b53['push'](_0x3c0b53['shift']());}};_0x48246a(++_0x34cdd3);}(_0x04c6,0x141));var _0x604c=function(_0x499316,_0x55a4d5){_0x499316=_0x499316-0x0;var _0x1ac2fd=_0x04c6[_0x499316];return _0x1ac2fd;};'use strict';var Sequelize=require(_0x604c('0x0'));var _=require(_0x604c('0x1'));var util=require(_0x604c('0x2'));module[_0x604c('0x3')]={'name':{'type':Sequelize[_0x604c('0x4')],'unique':_0x604c('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x604c('0x6')),'set':function(_0x35fbe7){if(_['isObjectLike'](_0x35fbe7)){this[_0x604c('0x7')](_0x604c('0x8'),JSON[_0x604c('0x9')](_0x35fbe7));}else if(_['isString'](_0x35fbe7)){this['setDataValue'](_0x604c('0x8'),_0x35fbe7);}else{this[_0x604c('0x7')](_0x604c('0x8'),util[_0x604c('0xa')](_0x604c('0xb'),this[_0x604c('0xc')](_0x604c('0x5'))||'',this['getDataValue'](_0x604c('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x604c('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x604c('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x89d1=['TEXT','setDataValue','formData','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','util','STRING','name'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x89d1,0x1e8));var _0x189d=function(_0x24d302,_0x56187c){_0x24d302=_0x24d302-0x0;var _0x4e8021=_0x89d1[_0x24d302];return _0x4e8021;};'use strict';var Sequelize=require(_0x189d('0x0'));var _=require('lodash');var util=require(_0x189d('0x1'));module['exports']={'name':{'type':Sequelize[_0x189d('0x2')],'unique':_0x189d('0x3')},'description':{'type':Sequelize[_0x189d('0x2')]},'formData':{'type':Sequelize[_0x189d('0x4')]('long'),'set':function(_0x568948){if(_['isObjectLike'](_0x568948)){this[_0x189d('0x5')](_0x189d('0x6'),JSON['stringify'](_0x568948));}else if(_[_0x189d('0x7')](_0x568948)){this[_0x189d('0x5')](_0x189d('0x6'),_0x568948);}else{this[_0x189d('0x5')](_0x189d('0x6'),util[_0x189d('0x8')](_0x189d('0x9'),this[_0x189d('0xa')](_0x189d('0x3'))||'',this[_0x189d('0xa')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x189d('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 72deba6..c44032f 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 _0x306d=['set','apply','reject','save','destroy','then','get','Projects','error','stack','name','send','index','map','JscriptyProject','type','keys','query','model','attributes','intersection','fields','offset','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','show','rawAttributes','length','options','find','catch','create','body','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','updatedAt','omit','role','UserProfileSection','UserProfileResource','update','getSessions','findOne','JscriptySessionReport','hasOwnProperty','order','ProjectId','JscriptyAnswerReport','fromCharCode','indexOf','toString','replace','getSummary','startTime','parse','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x306d,0x14b));var _0xd306=function(_0x54f127,_0x5b92f1){_0x54f127=_0x54f127-0x0;var _0xd56a90=_0x306d[_0x54f127];return _0xd56a90;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd306('0x0'));var rimraf=require(_0xd306('0x1'));var zipdir=require(_0xd306('0x2'));var jsonpatch=require(_0xd306('0x3'));var rp=require(_0xd306('0x4'));var moment=require(_0xd306('0x5'));var BPromise=require(_0xd306('0x6'));var Mustache=require(_0xd306('0x7'));var util=require('util');var path=require(_0xd306('0x8'));var sox=require('sox');var csv=require(_0xd306('0x9'));var ejs=require(_0xd306('0xa'));var fs=require('fs');var _=require(_0xd306('0xb'));var squel=require(_0xd306('0xc'));var crypto=require(_0xd306('0xd'));var jsforce=require(_0xd306('0xe'));var deskjs=require(_0xd306('0xf'));var toCsv=require(_0xd306('0x9'));var querystring=require(_0xd306('0x10'));var Papa=require(_0xd306('0x11'));var Redis=require(_0xd306('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd306('0x13'));var as=require(_0xd306('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd306('0x15'))(_0xd306('0x16'));var utils=require(_0xd306('0x17'));var config=require(_0xd306('0x18'));var licenseUtil=require(_0xd306('0x19'));var db=require(_0xd306('0x1a'))['db'];function respondWithStatusCode(_0x275d18,_0x2d89a6){_0x2d89a6=_0x2d89a6||0xcc;return function(_0x178326){if(_0x178326){return _0x275d18[_0xd306('0x1b')](_0x2d89a6);}return _0x275d18['status'](_0x2d89a6)[_0xd306('0x1c')]();};}function respondWithResult(_0x17936d,_0xf478a0){_0xf478a0=_0xf478a0||0xc8;return function(_0xc27e08){if(_0xc27e08){return _0x17936d[_0xd306('0x1d')](_0xf478a0)[_0xd306('0x1e')](_0xc27e08);}};}function respondWithFilteredResult(_0x33e21f,_0x364f13){return function(_0x1fd655){if(_0x1fd655){var _0x153d35=_0x1fd655['count'],_0x5b255b=_0x364f13['offset'],_0x383f87=_0x364f13['offset']+_0x364f13[_0xd306('0x1f')],_0x74b85c;if(_0x383f87>=_0x153d35){_0x383f87=_0x153d35;_0x74b85c=0xc8;}else{_0x74b85c=0xce;}_0x33e21f[_0xd306('0x1d')](_0x74b85c);return _0x33e21f[_0xd306('0x20')]('Content-Range',_0x5b255b+'-'+_0x383f87+'/'+_0x153d35)[_0xd306('0x1e')](_0x1fd655);}return null;};}function patchUpdates(_0x5b3d66){return function(_0x32bd43){try{jsonpatch[_0xd306('0x21')](_0x32bd43,_0x5b3d66,!![]);}catch(_0x49bb48){return BPromise[_0xd306('0x22')](_0x49bb48);}return _0x32bd43[_0xd306('0x23')]();};}function saveUpdates(_0xf1349a,_0x3abd40){return function(_0xc0caf9){if(_0xc0caf9){return _0xc0caf9['update'](_0xf1349a)['then'](function(_0x1cb80a){return _0x1cb80a;});}return null;};}function removeEntity(_0x527e63,_0x38707b){return function(_0x3247f7){if(_0x3247f7){return _0x3247f7[_0xd306('0x24')]()[_0xd306('0x25')](function(){var _0x7b4011=_0x3247f7[_0xd306('0x26')]({'plain':!![]});var _0x26eea9=_0xd306('0x27');return db['UserProfileResource'][_0xd306('0x24')]({'where':{'type':_0x26eea9,'resourceId':_0x7b4011['id']}})[_0xd306('0x25')](function(){return _0x3247f7;});})[_0xd306('0x25')](function(){_0x527e63[_0xd306('0x1d')](0xcc)[_0xd306('0x1c')]();});}};}function handleEntityNotFound(_0x5ccffc,_0xd57e52){return function(_0xd27018){if(!_0xd27018){_0x5ccffc[_0xd306('0x1b')](0x194);}return _0xd27018;};}function handleError(_0x12551d,_0x2a250b){_0x2a250b=_0x2a250b||0x1f4;return function(_0x211617){logger[_0xd306('0x28')](_0x211617[_0xd306('0x29')]);if(_0x211617[_0xd306('0x2a')]){delete _0x211617[_0xd306('0x2a')];}_0x12551d[_0xd306('0x1d')](_0x2a250b)[_0xd306('0x2b')](_0x211617);};}exports[_0xd306('0x2c')]=function(_0x305946,_0x53ab5f){var _0x29813e={},_0x27478c={},_0x322b48={'count':0x0,'rows':[]};var _0x31f222=_[_0xd306('0x2d')](db[_0xd306('0x2e')]['rawAttributes'],function(_0x12c144){return{'name':_0x12c144['fieldName'],'type':_0x12c144[_0xd306('0x2f')]['key']};});_0x27478c['model']=_[_0xd306('0x2d')](_0x31f222,_0xd306('0x2a'));_0x27478c['query']=_[_0xd306('0x30')](_0x305946[_0xd306('0x31')]);_0x27478c['filters']=_['intersection'](_0x27478c[_0xd306('0x32')],_0x27478c['query']);_0x29813e[_0xd306('0x33')]=_[_0xd306('0x34')](_0x27478c['model'],qs[_0xd306('0x35')](_0x305946[_0xd306('0x31')]['fields']));_0x29813e[_0xd306('0x33')]=_0x29813e[_0xd306('0x33')]['length']?_0x29813e[_0xd306('0x33')]:_0x27478c[_0xd306('0x32')];if(!_0x305946['query']['hasOwnProperty']('nolimit')){_0x29813e[_0xd306('0x1f')]=qs[_0xd306('0x1f')](_0x305946[_0xd306('0x31')][_0xd306('0x1f')]);_0x29813e[_0xd306('0x36')]=qs[_0xd306('0x36')](_0x305946[_0xd306('0x31')]['offset']);}_0x29813e['order']=qs[_0xd306('0x37')](_0x305946[_0xd306('0x31')]['sort']);_0x29813e[_0xd306('0x38')]=qs[_0xd306('0x39')](_[_0xd306('0x3a')](_0x305946[_0xd306('0x31')],_0x27478c[_0xd306('0x39')]),_0x31f222);if(_0x305946[_0xd306('0x31')][_0xd306('0x3b')]){_0x29813e[_0xd306('0x38')]=_[_0xd306('0x3c')](_0x29813e[_0xd306('0x38')],{'$or':_[_0xd306('0x2d')](_0x31f222,function(_0xd8cfe3){if(_0xd8cfe3['type']!==_0xd306('0x3d')){var _0x14e74a={};_0x14e74a[_0xd8cfe3['name']]={'$like':'%'+_0x305946[_0xd306('0x31')][_0xd306('0x3b')]+'%'};return _0x14e74a;}})});}_0x29813e=_[_0xd306('0x3c')]({},_0x29813e,_0x305946['options']);var _0x588596={'where':_0x29813e[_0xd306('0x38')]};return db[_0xd306('0x2e')][_0xd306('0x3e')](_0x588596)['then'](function(_0xd630bb){_0x322b48[_0xd306('0x3e')]=_0xd630bb;if(_0x305946[_0xd306('0x31')][_0xd306('0x3f')]){_0x29813e[_0xd306('0x40')]=[{'all':!![]}];}return db[_0xd306('0x2e')][_0xd306('0x41')](_0x29813e);})['then'](function(_0x18411a){_0x322b48[_0xd306('0x42')]=_0x18411a;return _0x322b48;})[_0xd306('0x25')](respondWithFilteredResult(_0x53ab5f,_0x29813e))['catch'](handleError(_0x53ab5f,null));};exports[_0xd306('0x43')]=function(_0x50fb36,_0x1a5abb){var _0x40f969={'raw':![],'where':{'id':_0x50fb36['params']['id']}},_0x18bee6={};_0x18bee6[_0xd306('0x32')]=_[_0xd306('0x30')](db['JscriptyProject'][_0xd306('0x44')]);_0x18bee6[_0xd306('0x31')]=_[_0xd306('0x30')](_0x50fb36[_0xd306('0x31')]);_0x18bee6[_0xd306('0x39')]=_['intersection'](_0x18bee6[_0xd306('0x32')],_0x18bee6[_0xd306('0x31')]);_0x40f969[_0xd306('0x33')]=_[_0xd306('0x34')](_0x18bee6[_0xd306('0x32')],qs[_0xd306('0x35')](_0x50fb36[_0xd306('0x31')][_0xd306('0x35')]));_0x40f969[_0xd306('0x33')]=_0x40f969[_0xd306('0x33')][_0xd306('0x45')]?_0x40f969[_0xd306('0x33')]:_0x18bee6[_0xd306('0x32')];if(_0x50fb36[_0xd306('0x31')][_0xd306('0x3f')]){_0x40f969[_0xd306('0x40')]=[{'all':!![]}];}_0x40f969=_[_0xd306('0x3c')]({},_0x40f969,_0x50fb36[_0xd306('0x46')]);return db[_0xd306('0x2e')][_0xd306('0x47')](_0x40f969)[_0xd306('0x25')](handleEntityNotFound(_0x1a5abb,null))['then'](respondWithResult(_0x1a5abb,null))[_0xd306('0x48')](handleError(_0x1a5abb,null));};exports[_0xd306('0x49')]=function(_0x109bed,_0x28731e){return db['JscriptyProject'][_0xd306('0x49')](_0x109bed[_0xd306('0x4a')],{})[_0xd306('0x25')](function(_0x21ee77){var _0x219558=_0x109bed[_0xd306('0x4b')][_0xd306('0x26')]({'plain':!![]});if(!_0x219558)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x219558['role']===_0xd306('0x4b')){var _0x2f5d98=_0x21ee77[_0xd306('0x26')]({'plain':!![]});var _0x49cf8f=_0xd306('0x27');return db['UserProfileSection'][_0xd306('0x47')]({'where':{'name':_0x49cf8f,'userProfileId':_0x219558[_0xd306('0x4c')]},'raw':!![]})[_0xd306('0x25')](function(_0x29b7c8){if(_0x29b7c8&&_0x29b7c8[_0xd306('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x2f5d98[_0xd306('0x2a')],'resourceId':_0x2f5d98['id'],'type':_0x29b7c8[_0xd306('0x2a')],'sectionId':_0x29b7c8['id']},{})['then'](function(){return _0x21ee77;});}else{return _0x21ee77;}})[_0xd306('0x48')](function(_0x679839){logger[_0xd306('0x28')](_0xd306('0x4e'),_0x679839);throw _0x679839;});}return _0x21ee77;})[_0xd306('0x25')](respondWithResult(_0x28731e,0xc9))['catch'](handleError(_0x28731e,null));};exports[_0xd306('0x4f')]=function(_0x37c4c2,_0x5ec23b){var _0x5e8cb0={'where':{'id':_0x37c4c2[_0xd306('0x50')]['id']}},_0x3c765d={};_0x3c765d[_0xd306('0x32')]=_[_0xd306('0x30')](db[_0xd306('0x2e')][_0xd306('0x44')]);_0x5e8cb0[_0xd306('0x33')]=_[_0xd306('0x34')](_0x3c765d[_0xd306('0x32')],qs[_0xd306('0x35')](_0x37c4c2[_0xd306('0x31')][_0xd306('0x35')]));_0x5e8cb0[_0xd306('0x33')]=_0x5e8cb0[_0xd306('0x33')][_0xd306('0x45')]?_0x5e8cb0['attributes']:_0x3c765d[_0xd306('0x32')];if(_0x37c4c2['query'][_0xd306('0x3f')]){_0x5e8cb0[_0xd306('0x40')]=[{'all':!![]}];}_0x5e8cb0=_[_0xd306('0x3c')]({},_0x5e8cb0,_0x37c4c2[_0xd306('0x46')]);return db['JscriptyProject'][_0xd306('0x47')](_0x5e8cb0)[_0xd306('0x25')](handleEntityNotFound(_0x5ec23b,null))['then'](function(_0x17ab70){if(_0x17ab70){var _0x3300d3=_0x17ab70[_0xd306('0x26')]({'plain':!![]});_0x3300d3=qs['omit'](_0x3300d3,['id',_0xd306('0x51'),_0xd306('0x52')]);_0x37c4c2['body']=_[_0xd306('0x53')](_0x37c4c2[_0xd306('0x4a')],['id',_0xd306('0x51'),_0xd306('0x52')]);return db['JscriptyProject']['create'](_[_0xd306('0x3c')](_0x3300d3,_0x37c4c2['body']),{'include':_0x37c4c2[_0xd306('0x31')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x28c0b5){var _0x340c75=_0x37c4c2['user'][_0xd306('0x26')]({'plain':!![]});if(!_0x340c75)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x340c75[_0xd306('0x54')]==='user'){var _0x587d2f=_0x28c0b5[_0xd306('0x26')]({'plain':!![]});var _0x386d05='Projects';return db[_0xd306('0x55')]['find']({'where':{'name':_0x386d05,'userProfileId':_0x340c75[_0xd306('0x4c')]},'raw':!![]})['then'](function(_0x11630f){if(_0x11630f&&_0x11630f['autoAssociation']===0x0){return db[_0xd306('0x56')]['create']({'name':_0x587d2f[_0xd306('0x2a')],'resourceId':_0x587d2f['id'],'type':_0x11630f[_0xd306('0x2a')],'sectionId':_0x11630f['id']},{})[_0xd306('0x25')](function(){return _0x28c0b5;});}else{return _0x28c0b5;}})['catch'](function(_0x3269de){logger[_0xd306('0x28')](_0xd306('0x4e'),_0x3269de);throw _0x3269de;});}return _0x28c0b5;});}})['then'](respondWithResult(_0x5ec23b,0xc9))[_0xd306('0x48')](handleError(_0x5ec23b,null));};exports[_0xd306('0x57')]=function(_0x3b2d7c,_0x2e0f53){if(_0x3b2d7c[_0xd306('0x4a')]['id']){delete _0x3b2d7c[_0xd306('0x4a')]['id'];}return db[_0xd306('0x2e')][_0xd306('0x47')]({'where':{'id':_0x3b2d7c['params']['id']}})[_0xd306('0x25')](handleEntityNotFound(_0x2e0f53,null))[_0xd306('0x25')](saveUpdates(_0x3b2d7c['body'],null))['then'](respondWithResult(_0x2e0f53,null))['catch'](handleError(_0x2e0f53,null));};exports[_0xd306('0x24')]=function(_0x29bf7f,_0xac4a22){return db[_0xd306('0x2e')][_0xd306('0x47')]({'where':{'id':_0x29bf7f[_0xd306('0x50')]['id']}})[_0xd306('0x25')](handleEntityNotFound(_0xac4a22,null))[_0xd306('0x25')](removeEntity(_0xac4a22,null))[_0xd306('0x48')](handleError(_0xac4a22,null));};exports[_0xd306('0x58')]=function(_0x5a7689,_0x300b18,_0x4a1226){var _0x1332c5={'raw':!![],'where':{}};var _0x1b23c6={};var _0x4b942e={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xd306('0x59')]({'where':{'id':_0x5a7689[_0xd306('0x50')]['id']}})[_0xd306('0x25')](handleEntityNotFound(_0x300b18,null))[_0xd306('0x25')](function(_0x2e5c79){if(_0x2e5c79){_0x1b23c6[_0xd306('0x32')]=_[_0xd306('0x30')](db[_0xd306('0x5a')]['rawAttributes']);_0x1b23c6[_0xd306('0x31')]=_['keys'](_0x5a7689[_0xd306('0x31')]);_0x1b23c6[_0xd306('0x39')]=_['intersection'](_0x1b23c6[_0xd306('0x32')],_0x1b23c6[_0xd306('0x31')]);_0x1332c5[_0xd306('0x33')]=_[_0xd306('0x34')](_0x1b23c6[_0xd306('0x32')],qs[_0xd306('0x35')](_0x5a7689['query'][_0xd306('0x35')]));_0x1332c5[_0xd306('0x33')]=_0x1332c5[_0xd306('0x33')][_0xd306('0x45')]?_0x1332c5[_0xd306('0x33')]:_0x1b23c6[_0xd306('0x32')];if(!_0x5a7689[_0xd306('0x31')][_0xd306('0x5b')]('nolimit')){_0x1332c5[_0xd306('0x1f')]=qs[_0xd306('0x1f')](_0x5a7689[_0xd306('0x31')][_0xd306('0x1f')]);_0x1332c5[_0xd306('0x36')]=qs[_0xd306('0x36')](_0x5a7689[_0xd306('0x31')][_0xd306('0x36')]);}_0x1332c5[_0xd306('0x5c')]=qs[_0xd306('0x37')](_0x5a7689['query'][_0xd306('0x37')]);_0x1332c5[_0xd306('0x38')]=qs[_0xd306('0x39')](_[_0xd306('0x3a')](_0x5a7689[_0xd306('0x31')],_0x1b23c6[_0xd306('0x39')]));_0x1332c5[_0xd306('0x38')][_0xd306('0x5d')]=_0x2e5c79['id'];if(_0x5a7689[_0xd306('0x31')][_0xd306('0x3b')]){_0x1332c5['where']=_['merge'](_0x1332c5[_0xd306('0x38')],{'$or':_[_0xd306('0x2d')](_0x1332c5['attributes'],function(_0x51cd1b){var _0xfebd81={};_0xfebd81[_0x51cd1b]={'$like':'%'+_0x5a7689[_0xd306('0x31')][_0xd306('0x3b')]+'%'};return _0xfebd81;})});}_0x1332c5=_[_0xd306('0x3c')]({},_0x1332c5,_0x5a7689[_0xd306('0x46')]);return db[_0xd306('0x5a')][_0xd306('0x3e')]({'where':_0x1332c5[_0xd306('0x38')]})[_0xd306('0x25')](function(_0x144cbc){_0x4b942e[_0xd306('0x3e')]=_0x144cbc;if(_0x5a7689[_0xd306('0x31')][_0xd306('0x3f')]){_0x1332c5[_0xd306('0x40')]=[{'all':!![]}];}return db[_0xd306('0x5a')][_0xd306('0x41')](_0x1332c5);})[_0xd306('0x25')](function(_0x486246){_0x4b942e[_0xd306('0x42')]=_0x486246;return _0x4b942e;});}})['then'](respondWithFilteredResult(_0x300b18,_0x1332c5))[_0xd306('0x48')](handleError(_0x300b18,null));};exports['getAnswers']=function(_0x431680,_0x568d80,_0x4604ad){var _0x5dba17={'raw':!![],'where':{}};var _0x2b096b={};var _0x857322={'count':0x0,'rows':[]};return db[_0xd306('0x2e')][_0xd306('0x59')]({'where':{'id':_0x431680[_0xd306('0x50')]['id']}})[_0xd306('0x25')](handleEntityNotFound(_0x568d80,null))[_0xd306('0x25')](function(_0x3cbe68){if(_0x3cbe68){_0x2b096b[_0xd306('0x32')]=_[_0xd306('0x30')](db[_0xd306('0x5e')][_0xd306('0x44')]);_0x2b096b[_0xd306('0x31')]=_[_0xd306('0x30')](_0x431680[_0xd306('0x31')]);_0x2b096b[_0xd306('0x39')]=_[_0xd306('0x34')](_0x2b096b[_0xd306('0x32')],_0x2b096b['query']);_0x5dba17[_0xd306('0x33')]=_[_0xd306('0x34')](_0x2b096b[_0xd306('0x32')],qs[_0xd306('0x35')](_0x431680['query'][_0xd306('0x35')]));_0x5dba17[_0xd306('0x33')]=_0x5dba17[_0xd306('0x33')][_0xd306('0x45')]?_0x5dba17[_0xd306('0x33')]:_0x2b096b[_0xd306('0x32')];if(!_0x431680['query'][_0xd306('0x5b')]('nolimit')){_0x5dba17[_0xd306('0x1f')]=qs[_0xd306('0x1f')](_0x431680[_0xd306('0x31')]['limit']);_0x5dba17[_0xd306('0x36')]=qs['offset'](_0x431680[_0xd306('0x31')]['offset']);}_0x5dba17[_0xd306('0x5c')]=qs['sort'](_0x431680[_0xd306('0x31')][_0xd306('0x37')]);_0x5dba17[_0xd306('0x38')]=qs[_0xd306('0x39')](_[_0xd306('0x3a')](_0x431680[_0xd306('0x31')],_0x2b096b[_0xd306('0x39')]));_0x5dba17[_0xd306('0x38')]['ProjectId']=_0x3cbe68['id'];if(_0x431680[_0xd306('0x31')][_0xd306('0x3b')]){_0x5dba17['where']=_['merge'](_0x5dba17[_0xd306('0x38')],{'$or':_[_0xd306('0x2d')](_0x5dba17[_0xd306('0x33')],function(_0x422660){var _0x452aec={};_0x452aec[_0x422660]={'$like':'%'+_0x431680[_0xd306('0x31')][_0xd306('0x3b')]+'%'};return _0x452aec;})});}_0x5dba17=_[_0xd306('0x3c')]({},_0x5dba17,_0x431680[_0xd306('0x46')]);return db[_0xd306('0x5e')]['count']({'where':_0x5dba17[_0xd306('0x38')]})[_0xd306('0x25')](function(_0x91d63f){_0x857322[_0xd306('0x3e')]=_0x91d63f;if(_0x431680[_0xd306('0x31')]['includeAll']){_0x5dba17[_0xd306('0x40')]=[{'all':!![]}];}return db[_0xd306('0x5e')][_0xd306('0x41')](_0x5dba17);})['then'](function(_0x42a5b7){_0x857322['rows']=_0x42a5b7;return _0x857322;});}})[_0xd306('0x25')](respondWithFilteredResult(_0x568d80,_0x5dba17))['catch'](handleError(_0x568d80,null));};function char(_0x2d7514){return'number'===typeof _0x2d7514?String[_0xd306('0x5f')][_0xd306('0x21')](null,arguments):_0x2d7514;}function needsEncapsulation(_0x11bbe3){return!!_0x11bbe3&&(_0x11bbe3['toString']()[_0xd306('0x60')](char(0xd))>=0x0||_0x11bbe3[_0xd306('0x61')]()[_0xd306('0x60')](char(0xa))>=0x0||_0x11bbe3[_0xd306('0x61')]()[_0xd306('0x60')](char(0x2c))>=0x0||_0x11bbe3['toString']()[_0xd306('0x60')](char(0x22))>=0x0);}function encapsulate(_0x465c56){var _0x101e96=char(0x22),_0x3da0c3='\x5c'+char(0x22),_0x164359=_0x465c56[_0xd306('0x61')]()[_0xd306('0x62')](new RegExp(_0x101e96,'g'),_0x3da0c3);return _0x101e96+_0x164359+_0x101e96;}exports[_0xd306('0x63')]=function(_0x497d3a,_0x51f8a4,_0x3814ec){var _0x477308,_0x54f84b;var _0x29a08c={'where':{'ProjectId':_0x497d3a[_0xd306('0x50')]['id']}};if(_0x497d3a['query'][_0xd306('0x64')]){_0x29a08c['where']['starttime']=JSON[_0xd306('0x65')](_0x497d3a[_0xd306('0x31')][_0xd306('0x64')]);}return db[_0xd306('0x5a')][_0xd306('0x41')](_0x29a08c)[_0xd306('0x25')](handleEntityNotFound(_0x51f8a4,null))[_0xd306('0x25')](function(_0x4c1397){if(_0x4c1397){_0x477308=_0x4c1397;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_['map'](_0x477308,'id')},'ProjectId':_0x497d3a[_0xd306('0x50')]['id']},'order':_0xd306('0x66')});}})['then'](handleEntityNotFound(_0x51f8a4,null))[_0xd306('0x25')](function(_0x8efb61){if(_0x8efb61){_0x54f84b=_0x8efb61;var _0x4fbe82={};for(var _0x490746=0x0,_0x1d66c3=_0x54f84b[_0xd306('0x45')];_0x490746<_0x1d66c3;_0x490746++){if(!_0x4fbe82['hasOwnProperty'](_0x54f84b[_0x490746][_0xd306('0x67')])){_0x4fbe82[_0x54f84b[_0x490746][_0xd306('0x67')]]=needsEncapsulation(_0x54f84b[_0x490746][_0xd306('0x68')])?encapsulate(_0x54f84b[_0x490746][_0xd306('0x68')]):_0x54f84b[_0x490746][_0xd306('0x68')];}}var _0x531718=[],_0x304390={};for(var _0x292910=0x0,_0x55ee1b=_0x477308[_0xd306('0x45')];_0x292910<_0x55ee1b;_0x292910++){_0x304390={'ProjectId':_0x497d3a[_0xd306('0x50')]['id'],'SessionId':_0x477308[_0x292910]['id'],'StartTime':moment(_0x477308[_0x292910][_0xd306('0x69')])[_0xd306('0x6a')](_0xd306('0x6b'))};for(var _0x3367aa=0x0,_0x151615=_0x54f84b['length'];_0x3367aa<_0x151615;_0x3367aa++){if(_0x54f84b[_0x3367aa][_0xd306('0x6c')]==_0x477308[_0x292910]['id']&&_0x4fbe82[_0xd306('0x5b')](_0x54f84b[_0x3367aa]['questionId'])){_0x304390[_0x4fbe82[_0x54f84b[_0x3367aa]['questionId']]]=_0x54f84b[_0x3367aa][_0xd306('0x6d')];}}for(var _0x3ba9c8 in _0x4fbe82){if(!_0x304390[_0xd306('0x5b')](_0x4fbe82[_0x3ba9c8])){_0x304390[_0x4fbe82[_0x3ba9c8]]=null;}}_0x531718[_0xd306('0x6e')](_0x304390);}return _0x531718;}})[_0xd306('0x25')](function(_0x605ef8){if(!_[_0xd306('0x6f')](_0x605ef8)){var _0x1a3801=toCsv(_0x605ef8);var _0xb87077=Date[_0xd306('0x70')]();fs[_0xd306('0x71')](util[_0xd306('0x6a')](_0xd306('0x72'),_0x497d3a['params']['id'],_0xb87077),_0x1a3801);_0x51f8a4[_0xd306('0x73')](_0xd306('0x74'),_0xd306('0x75')+util[_0xd306('0x6a')](_0xd306('0x76'),_0x497d3a['params']['id'],_0xb87077));_0x51f8a4['setHeader']('Content-type',_0xd306('0x77'));return _0x51f8a4[_0xd306('0x78')](util[_0xd306('0x6a')](_0xd306('0x72'),_0x497d3a[_0xd306('0x50')]['id'],_0xb87077));}else{return _0x51f8a4[_0xd306('0x1b')](0xcc);}})[_0xd306('0x48')](handleError(_0x51f8a4,null));}; \ No newline at end of file +var _0x1aa5=['apply','reject','update','then','get','Projects','destroy','error','stack','name','index','map','JscriptyProject','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','count','includeAll','catch','show','merge','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','clone','params','include','omit','createdAt','body','updatedAt','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','order','pick','ProjectId','findAll','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','questionId','question','starttime','format','SessionId','push','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range'];(function(_0x47ad45,_0x29a76d){var _0x4042fc=function(_0x26c863){while(--_0x26c863){_0x47ad45['push'](_0x47ad45['shift']());}};_0x4042fc(++_0x29a76d);}(_0x1aa5,0x1a8));var _0x51aa=function(_0x3a281b,_0x3524dd){_0x3a281b=_0x3a281b-0x0;var _0x41ac1c=_0x1aa5[_0x3a281b];return _0x41ac1c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x51aa('0x0'));var rimraf=require(_0x51aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x51aa('0x2'));var rp=require('request-promise');var moment=require(_0x51aa('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x51aa('0x4'));var util=require(_0x51aa('0x5'));var path=require(_0x51aa('0x6'));var sox=require('sox');var csv=require(_0x51aa('0x7'));var ejs=require(_0x51aa('0x8'));var fs=require('fs');var _=require(_0x51aa('0x9'));var squel=require(_0x51aa('0xa'));var crypto=require(_0x51aa('0xb'));var jsforce=require(_0x51aa('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x51aa('0xd'));var Papa=require(_0x51aa('0xe'));var Redis=require(_0x51aa('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x51aa('0x10'))('api');var utils=require(_0x51aa('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x51aa('0x12'));var db=require(_0x51aa('0x13'))['db'];function respondWithStatusCode(_0x39b2d7,_0x5484b5){_0x5484b5=_0x5484b5||0xcc;return function(_0x15ef19){if(_0x15ef19){return _0x39b2d7[_0x51aa('0x14')](_0x5484b5);}return _0x39b2d7[_0x51aa('0x15')](_0x5484b5)[_0x51aa('0x16')]();};}function respondWithResult(_0x256f37,_0x34a8f9){_0x34a8f9=_0x34a8f9||0xc8;return function(_0x30a3d6){if(_0x30a3d6){return _0x256f37['status'](_0x34a8f9)[_0x51aa('0x17')](_0x30a3d6);}};}function respondWithFilteredResult(_0x5e7568,_0x19a4bf){return function(_0xb27503){if(_0xb27503){var _0x3c7b5f=_0xb27503['count'],_0x502280=_0x19a4bf[_0x51aa('0x18')],_0x28f8a8=_0x19a4bf[_0x51aa('0x18')]+_0x19a4bf[_0x51aa('0x19')],_0x22dd33;if(_0x28f8a8>=_0x3c7b5f){_0x28f8a8=_0x3c7b5f;_0x22dd33=0xc8;}else{_0x22dd33=0xce;}_0x5e7568[_0x51aa('0x15')](_0x22dd33);return _0x5e7568[_0x51aa('0x1a')](_0x51aa('0x1b'),_0x502280+'-'+_0x28f8a8+'/'+_0x3c7b5f)['json'](_0xb27503);}return null;};}function patchUpdates(_0x559292){return function(_0x3a66c0){try{jsonpatch[_0x51aa('0x1c')](_0x3a66c0,_0x559292,!![]);}catch(_0x5ac51d){return BPromise[_0x51aa('0x1d')](_0x5ac51d);}return _0x3a66c0['save']();};}function saveUpdates(_0x5746e2,_0x1f454a){return function(_0x43d20d){if(_0x43d20d){return _0x43d20d[_0x51aa('0x1e')](_0x5746e2)['then'](function(_0x442ffe){return _0x442ffe;});}return null;};}function removeEntity(_0x3e7d7c,_0x2117af){return function(_0x2649f1){if(_0x2649f1){return _0x2649f1['destroy']()[_0x51aa('0x1f')](function(){var _0x47b439=_0x2649f1[_0x51aa('0x20')]({'plain':!![]});var _0x163058=_0x51aa('0x21');return db['UserProfileResource'][_0x51aa('0x22')]({'where':{'type':_0x163058,'resourceId':_0x47b439['id']}})[_0x51aa('0x1f')](function(){return _0x2649f1;});})[_0x51aa('0x1f')](function(){_0x3e7d7c['status'](0xcc)[_0x51aa('0x16')]();});}};}function handleEntityNotFound(_0x21de3a,_0x3afc6f){return function(_0x21ca3b){if(!_0x21ca3b){_0x21de3a[_0x51aa('0x14')](0x194);}return _0x21ca3b;};}function handleError(_0x1b2dcc,_0x2ee021){_0x2ee021=_0x2ee021||0x1f4;return function(_0x4cb2ea){logger[_0x51aa('0x23')](_0x4cb2ea[_0x51aa('0x24')]);if(_0x4cb2ea[_0x51aa('0x25')]){delete _0x4cb2ea['name'];}_0x1b2dcc['status'](_0x2ee021)['send'](_0x4cb2ea);};}exports[_0x51aa('0x26')]=function(_0xe3ed76,_0x1371ff){var _0x381dc6={},_0x137c80={},_0x13f9d1={'count':0x0,'rows':[]};var _0x43f8b9=_[_0x51aa('0x27')](db[_0x51aa('0x28')][_0x51aa('0x29')],function(_0xb54dd4){return{'name':_0xb54dd4['fieldName'],'type':_0xb54dd4[_0x51aa('0x2a')][_0x51aa('0x2b')]};});_0x137c80[_0x51aa('0x2c')]=_[_0x51aa('0x27')](_0x43f8b9,_0x51aa('0x25'));_0x137c80[_0x51aa('0x2d')]=_[_0x51aa('0x2e')](_0xe3ed76[_0x51aa('0x2d')]);_0x137c80[_0x51aa('0x2f')]=_[_0x51aa('0x30')](_0x137c80[_0x51aa('0x2c')],_0x137c80[_0x51aa('0x2d')]);_0x381dc6[_0x51aa('0x31')]=_[_0x51aa('0x30')](_0x137c80[_0x51aa('0x2c')],qs[_0x51aa('0x32')](_0xe3ed76[_0x51aa('0x2d')][_0x51aa('0x32')]));_0x381dc6['attributes']=_0x381dc6['attributes'][_0x51aa('0x33')]?_0x381dc6['attributes']:_0x137c80[_0x51aa('0x2c')];if(!_0xe3ed76['query'][_0x51aa('0x34')](_0x51aa('0x35'))){_0x381dc6[_0x51aa('0x19')]=qs[_0x51aa('0x19')](_0xe3ed76['query'][_0x51aa('0x19')]);_0x381dc6[_0x51aa('0x18')]=qs[_0x51aa('0x18')](_0xe3ed76[_0x51aa('0x2d')]['offset']);}_0x381dc6['order']=qs['sort'](_0xe3ed76[_0x51aa('0x2d')][_0x51aa('0x36')]);_0x381dc6[_0x51aa('0x37')]=qs[_0x51aa('0x2f')](_['pick'](_0xe3ed76[_0x51aa('0x2d')],_0x137c80['filters']),_0x43f8b9);if(_0xe3ed76[_0x51aa('0x2d')][_0x51aa('0x38')]){_0x381dc6['where']=_['merge'](_0x381dc6[_0x51aa('0x37')],{'$or':_['map'](_0x43f8b9,function(_0x3c64ee){if(_0x3c64ee[_0x51aa('0x2a')]!==_0x51aa('0x39')){var _0x5233ef={};_0x5233ef[_0x3c64ee[_0x51aa('0x25')]]={'$like':'%'+_0xe3ed76[_0x51aa('0x2d')]['filter']+'%'};return _0x5233ef;}})});}_0x381dc6=_['merge']({},_0x381dc6,_0xe3ed76[_0x51aa('0x3a')]);var _0x1e17c5={'where':_0x381dc6['where']};return db[_0x51aa('0x28')]['count'](_0x1e17c5)[_0x51aa('0x1f')](function(_0x516e16){_0x13f9d1[_0x51aa('0x3b')]=_0x516e16;if(_0xe3ed76['query'][_0x51aa('0x3c')]){_0x381dc6['include']=[{'all':!![]}];}return db[_0x51aa('0x28')]['findAll'](_0x381dc6);})[_0x51aa('0x1f')](function(_0x102c10){_0x13f9d1['rows']=_0x102c10;return _0x13f9d1;})['then'](respondWithFilteredResult(_0x1371ff,_0x381dc6))[_0x51aa('0x3d')](handleError(_0x1371ff,null));};exports[_0x51aa('0x3e')]=function(_0x236112,_0x858c7b){var _0x3d190f={'raw':![],'where':{'id':_0x236112['params']['id']}},_0x27a71e={};_0x27a71e['model']=_[_0x51aa('0x2e')](db[_0x51aa('0x28')][_0x51aa('0x29')]);_0x27a71e['query']=_[_0x51aa('0x2e')](_0x236112[_0x51aa('0x2d')]);_0x27a71e['filters']=_['intersection'](_0x27a71e[_0x51aa('0x2c')],_0x27a71e[_0x51aa('0x2d')]);_0x3d190f[_0x51aa('0x31')]=_[_0x51aa('0x30')](_0x27a71e[_0x51aa('0x2c')],qs[_0x51aa('0x32')](_0x236112[_0x51aa('0x2d')]['fields']));_0x3d190f[_0x51aa('0x31')]=_0x3d190f['attributes'][_0x51aa('0x33')]?_0x3d190f[_0x51aa('0x31')]:_0x27a71e[_0x51aa('0x2c')];if(_0x236112[_0x51aa('0x2d')][_0x51aa('0x3c')]){_0x3d190f['include']=[{'all':!![]}];}_0x3d190f=_[_0x51aa('0x3f')]({},_0x3d190f,_0x236112['options']);return db['JscriptyProject']['find'](_0x3d190f)[_0x51aa('0x1f')](handleEntityNotFound(_0x858c7b,null))['then'](respondWithResult(_0x858c7b,null))[_0x51aa('0x3d')](handleError(_0x858c7b,null));};exports[_0x51aa('0x40')]=function(_0x40d441,_0x4f3e1c){return db[_0x51aa('0x28')][_0x51aa('0x40')](_0x40d441['body'],{})[_0x51aa('0x1f')](function(_0x3f114c){var _0x11d8f=_0x40d441['user'][_0x51aa('0x20')]({'plain':!![]});if(!_0x11d8f)throw new Error(_0x51aa('0x41'));if(_0x11d8f['role']===_0x51aa('0x42')){var _0x114c6a=_0x3f114c[_0x51aa('0x20')]({'plain':!![]});var _0x3422e8=_0x51aa('0x21');return db[_0x51aa('0x43')][_0x51aa('0x44')]({'where':{'name':_0x3422e8,'userProfileId':_0x11d8f[_0x51aa('0x45')]},'raw':!![]})[_0x51aa('0x1f')](function(_0x1f9042){if(_0x1f9042&&_0x1f9042[_0x51aa('0x46')]===0x0){return db[_0x51aa('0x47')]['create']({'name':_0x114c6a[_0x51aa('0x25')],'resourceId':_0x114c6a['id'],'type':_0x1f9042[_0x51aa('0x25')],'sectionId':_0x1f9042['id']},{})[_0x51aa('0x1f')](function(){return _0x3f114c;});}else{return _0x3f114c;}})['catch'](function(_0x22f64d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22f64d);throw _0x22f64d;});}return _0x3f114c;})[_0x51aa('0x1f')](respondWithResult(_0x4f3e1c,0xc9))[_0x51aa('0x3d')](handleError(_0x4f3e1c,null));};exports[_0x51aa('0x48')]=function(_0x4de720,_0xbb2856){var _0x33bf16={'where':{'id':_0x4de720[_0x51aa('0x49')]['id']}},_0x1c4919={};_0x1c4919[_0x51aa('0x2c')]=_['keys'](db['JscriptyProject'][_0x51aa('0x29')]);_0x33bf16[_0x51aa('0x31')]=_[_0x51aa('0x30')](_0x1c4919[_0x51aa('0x2c')],qs['fields'](_0x4de720['query']['fields']));_0x33bf16['attributes']=_0x33bf16[_0x51aa('0x31')][_0x51aa('0x33')]?_0x33bf16[_0x51aa('0x31')]:_0x1c4919[_0x51aa('0x2c')];if(_0x4de720[_0x51aa('0x2d')][_0x51aa('0x3c')]){_0x33bf16[_0x51aa('0x4a')]=[{'all':!![]}];}_0x33bf16=_[_0x51aa('0x3f')]({},_0x33bf16,_0x4de720[_0x51aa('0x3a')]);return db[_0x51aa('0x28')][_0x51aa('0x44')](_0x33bf16)['then'](handleEntityNotFound(_0xbb2856,null))[_0x51aa('0x1f')](function(_0x5a2782){if(_0x5a2782){var _0x15baf1=_0x5a2782[_0x51aa('0x20')]({'plain':!![]});_0x15baf1=qs[_0x51aa('0x4b')](_0x15baf1,['id',_0x51aa('0x4c'),'updatedAt']);_0x4de720[_0x51aa('0x4d')]=_[_0x51aa('0x4b')](_0x4de720[_0x51aa('0x4d')],['id',_0x51aa('0x4c'),_0x51aa('0x4e')]);return db[_0x51aa('0x28')][_0x51aa('0x40')](_['merge'](_0x15baf1,_0x4de720[_0x51aa('0x4d')]),{'include':_0x4de720[_0x51aa('0x2d')][_0x51aa('0x3c')]?[{'all':!![]}]:undefined})[_0x51aa('0x1f')](function(_0x133b33){var _0x363d68=_0x4de720[_0x51aa('0x42')][_0x51aa('0x20')]({'plain':!![]});if(!_0x363d68)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x363d68[_0x51aa('0x4f')]===_0x51aa('0x42')){var _0x549091=_0x133b33[_0x51aa('0x20')]({'plain':!![]});var _0x2df9ab=_0x51aa('0x21');return db[_0x51aa('0x43')][_0x51aa('0x44')]({'where':{'name':_0x2df9ab,'userProfileId':_0x363d68[_0x51aa('0x45')]},'raw':!![]})['then'](function(_0x329180){if(_0x329180&&_0x329180[_0x51aa('0x46')]===0x0){return db[_0x51aa('0x47')][_0x51aa('0x40')]({'name':_0x549091[_0x51aa('0x25')],'resourceId':_0x549091['id'],'type':_0x329180[_0x51aa('0x25')],'sectionId':_0x329180['id']},{})[_0x51aa('0x1f')](function(){return _0x133b33;});}else{return _0x133b33;}})[_0x51aa('0x3d')](function(_0x1b719b){logger[_0x51aa('0x23')](_0x51aa('0x50'),_0x1b719b);throw _0x1b719b;});}return _0x133b33;});}})[_0x51aa('0x1f')](respondWithResult(_0xbb2856,0xc9))[_0x51aa('0x3d')](handleError(_0xbb2856,null));};exports[_0x51aa('0x1e')]=function(_0x274e0c,_0x1611fd){if(_0x274e0c[_0x51aa('0x4d')]['id']){delete _0x274e0c[_0x51aa('0x4d')]['id'];}return db[_0x51aa('0x28')]['find']({'where':{'id':_0x274e0c[_0x51aa('0x49')]['id']}})['then'](handleEntityNotFound(_0x1611fd,null))['then'](saveUpdates(_0x274e0c[_0x51aa('0x4d')],null))[_0x51aa('0x1f')](respondWithResult(_0x1611fd,null))[_0x51aa('0x3d')](handleError(_0x1611fd,null));};exports[_0x51aa('0x22')]=function(_0x243f1e,_0x7c0038){return db[_0x51aa('0x28')][_0x51aa('0x44')]({'where':{'id':_0x243f1e['params']['id']}})[_0x51aa('0x1f')](handleEntityNotFound(_0x7c0038,null))[_0x51aa('0x1f')](removeEntity(_0x7c0038,null))[_0x51aa('0x3d')](handleError(_0x7c0038,null));};exports[_0x51aa('0x51')]=function(_0x15018b,_0x564dc1,_0xe2e9dc){var _0x4ae4fb={'raw':!![],'where':{}};var _0x4a2b97={};var _0x26be40={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x51aa('0x52')]({'where':{'id':_0x15018b[_0x51aa('0x49')]['id']}})[_0x51aa('0x1f')](handleEntityNotFound(_0x564dc1,null))['then'](function(_0x11ed29){if(_0x11ed29){_0x4a2b97[_0x51aa('0x2c')]=_[_0x51aa('0x2e')](db[_0x51aa('0x53')][_0x51aa('0x29')]);_0x4a2b97['query']=_[_0x51aa('0x2e')](_0x15018b[_0x51aa('0x2d')]);_0x4a2b97[_0x51aa('0x2f')]=_[_0x51aa('0x30')](_0x4a2b97[_0x51aa('0x2c')],_0x4a2b97[_0x51aa('0x2d')]);_0x4ae4fb[_0x51aa('0x31')]=_[_0x51aa('0x30')](_0x4a2b97[_0x51aa('0x2c')],qs['fields'](_0x15018b[_0x51aa('0x2d')]['fields']));_0x4ae4fb[_0x51aa('0x31')]=_0x4ae4fb[_0x51aa('0x31')][_0x51aa('0x33')]?_0x4ae4fb[_0x51aa('0x31')]:_0x4a2b97['model'];if(!_0x15018b[_0x51aa('0x2d')][_0x51aa('0x34')](_0x51aa('0x35'))){_0x4ae4fb[_0x51aa('0x19')]=qs[_0x51aa('0x19')](_0x15018b[_0x51aa('0x2d')]['limit']);_0x4ae4fb[_0x51aa('0x18')]=qs[_0x51aa('0x18')](_0x15018b[_0x51aa('0x2d')][_0x51aa('0x18')]);}_0x4ae4fb[_0x51aa('0x54')]=qs[_0x51aa('0x36')](_0x15018b[_0x51aa('0x2d')][_0x51aa('0x36')]);_0x4ae4fb[_0x51aa('0x37')]=qs[_0x51aa('0x2f')](_[_0x51aa('0x55')](_0x15018b[_0x51aa('0x2d')],_0x4a2b97[_0x51aa('0x2f')]));_0x4ae4fb[_0x51aa('0x37')][_0x51aa('0x56')]=_0x11ed29['id'];if(_0x15018b[_0x51aa('0x2d')][_0x51aa('0x38')]){_0x4ae4fb[_0x51aa('0x37')]=_[_0x51aa('0x3f')](_0x4ae4fb['where'],{'$or':_[_0x51aa('0x27')](_0x4ae4fb[_0x51aa('0x31')],function(_0xa49fd3){var _0x401820={};_0x401820[_0xa49fd3]={'$like':'%'+_0x15018b[_0x51aa('0x2d')][_0x51aa('0x38')]+'%'};return _0x401820;})});}_0x4ae4fb=_[_0x51aa('0x3f')]({},_0x4ae4fb,_0x15018b['options']);return db[_0x51aa('0x53')][_0x51aa('0x3b')]({'where':_0x4ae4fb[_0x51aa('0x37')]})['then'](function(_0x5d7ecd){_0x26be40[_0x51aa('0x3b')]=_0x5d7ecd;if(_0x15018b['query']['includeAll']){_0x4ae4fb['include']=[{'all':!![]}];}return db[_0x51aa('0x53')][_0x51aa('0x57')](_0x4ae4fb);})[_0x51aa('0x1f')](function(_0x19dc5c){_0x26be40[_0x51aa('0x58')]=_0x19dc5c;return _0x26be40;});}})[_0x51aa('0x1f')](respondWithFilteredResult(_0x564dc1,_0x4ae4fb))[_0x51aa('0x3d')](handleError(_0x564dc1,null));};exports[_0x51aa('0x59')]=function(_0x587bfb,_0x36a95b,_0x5c028e){var _0xcc8fab={'raw':!![],'where':{}};var _0x43aa28={};var _0x4db58={'count':0x0,'rows':[]};return db[_0x51aa('0x28')][_0x51aa('0x52')]({'where':{'id':_0x587bfb[_0x51aa('0x49')]['id']}})[_0x51aa('0x1f')](handleEntityNotFound(_0x36a95b,null))[_0x51aa('0x1f')](function(_0xdf1a45){if(_0xdf1a45){_0x43aa28[_0x51aa('0x2c')]=_[_0x51aa('0x2e')](db['JscriptyAnswerReport'][_0x51aa('0x29')]);_0x43aa28[_0x51aa('0x2d')]=_[_0x51aa('0x2e')](_0x587bfb['query']);_0x43aa28['filters']=_['intersection'](_0x43aa28[_0x51aa('0x2c')],_0x43aa28[_0x51aa('0x2d')]);_0xcc8fab['attributes']=_[_0x51aa('0x30')](_0x43aa28[_0x51aa('0x2c')],qs[_0x51aa('0x32')](_0x587bfb[_0x51aa('0x2d')]['fields']));_0xcc8fab['attributes']=_0xcc8fab['attributes'][_0x51aa('0x33')]?_0xcc8fab[_0x51aa('0x31')]:_0x43aa28['model'];if(!_0x587bfb[_0x51aa('0x2d')][_0x51aa('0x34')](_0x51aa('0x35'))){_0xcc8fab['limit']=qs[_0x51aa('0x19')](_0x587bfb[_0x51aa('0x2d')]['limit']);_0xcc8fab[_0x51aa('0x18')]=qs[_0x51aa('0x18')](_0x587bfb[_0x51aa('0x2d')][_0x51aa('0x18')]);}_0xcc8fab[_0x51aa('0x54')]=qs[_0x51aa('0x36')](_0x587bfb['query'][_0x51aa('0x36')]);_0xcc8fab[_0x51aa('0x37')]=qs[_0x51aa('0x2f')](_[_0x51aa('0x55')](_0x587bfb[_0x51aa('0x2d')],_0x43aa28[_0x51aa('0x2f')]));_0xcc8fab[_0x51aa('0x37')][_0x51aa('0x56')]=_0xdf1a45['id'];if(_0x587bfb[_0x51aa('0x2d')][_0x51aa('0x38')]){_0xcc8fab[_0x51aa('0x37')]=_[_0x51aa('0x3f')](_0xcc8fab[_0x51aa('0x37')],{'$or':_['map'](_0xcc8fab[_0x51aa('0x31')],function(_0x2b76b9){var _0x381ba8={};_0x381ba8[_0x2b76b9]={'$like':'%'+_0x587bfb['query'][_0x51aa('0x38')]+'%'};return _0x381ba8;})});}_0xcc8fab=_['merge']({},_0xcc8fab,_0x587bfb['options']);return db['JscriptyAnswerReport'][_0x51aa('0x3b')]({'where':_0xcc8fab[_0x51aa('0x37')]})[_0x51aa('0x1f')](function(_0x48b72a){_0x4db58[_0x51aa('0x3b')]=_0x48b72a;if(_0x587bfb[_0x51aa('0x2d')][_0x51aa('0x3c')]){_0xcc8fab[_0x51aa('0x4a')]=[{'all':!![]}];}return db[_0x51aa('0x5a')][_0x51aa('0x57')](_0xcc8fab);})[_0x51aa('0x1f')](function(_0x126de1){_0x4db58[_0x51aa('0x58')]=_0x126de1;return _0x4db58;});}})[_0x51aa('0x1f')](respondWithFilteredResult(_0x36a95b,_0xcc8fab))[_0x51aa('0x3d')](handleError(_0x36a95b,null));};function char(_0x10dffe){return _0x51aa('0x5b')===typeof _0x10dffe?String[_0x51aa('0x5c')]['apply'](null,arguments):_0x10dffe;}function needsEncapsulation(_0x35ae7d){return!!_0x35ae7d&&(_0x35ae7d[_0x51aa('0x5d')]()['indexOf'](char(0xd))>=0x0||_0x35ae7d[_0x51aa('0x5d')]()[_0x51aa('0x5e')](char(0xa))>=0x0||_0x35ae7d['toString']()[_0x51aa('0x5e')](char(0x2c))>=0x0||_0x35ae7d[_0x51aa('0x5d')]()[_0x51aa('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x223d77){var _0x349414=char(0x22),_0x32ba44='\x5c'+char(0x22),_0x4ecfe2=_0x223d77[_0x51aa('0x5d')]()[_0x51aa('0x5f')](new RegExp(_0x349414,'g'),_0x32ba44);return _0x349414+_0x4ecfe2+_0x349414;}exports[_0x51aa('0x60')]=function(_0x1c09dc,_0x58aa42,_0x496eef){var _0x7b7d7d,_0x2e4432;var _0x192847={'where':{'ProjectId':_0x1c09dc[_0x51aa('0x49')]['id']}};if(_0x1c09dc[_0x51aa('0x2d')][_0x51aa('0x61')]){_0x192847[_0x51aa('0x37')]['starttime']=JSON[_0x51aa('0x62')](_0x1c09dc[_0x51aa('0x2d')][_0x51aa('0x61')]);}return db[_0x51aa('0x53')]['findAll'](_0x192847)[_0x51aa('0x1f')](handleEntityNotFound(_0x58aa42,null))[_0x51aa('0x1f')](function(_0x226443){if(_0x226443){_0x7b7d7d=_0x226443;return db['JscriptyQuestionReport'][_0x51aa('0x57')]({'where':{'SessionId':{'$in':_[_0x51aa('0x27')](_0x7b7d7d,'id')},'ProjectId':_0x1c09dc[_0x51aa('0x49')]['id']},'order':'-createdAt'});}})[_0x51aa('0x1f')](handleEntityNotFound(_0x58aa42,null))['then'](function(_0x5b5145){if(_0x5b5145){_0x2e4432=_0x5b5145;var _0x568e20={};for(var _0x2e0a14=0x0,_0x3ebd8b=_0x2e4432[_0x51aa('0x33')];_0x2e0a14<_0x3ebd8b;_0x2e0a14++){if(!_0x568e20['hasOwnProperty'](_0x2e4432[_0x2e0a14][_0x51aa('0x63')])){_0x568e20[_0x2e4432[_0x2e0a14]['questionId']]=needsEncapsulation(_0x2e4432[_0x2e0a14][_0x51aa('0x64')])?encapsulate(_0x2e4432[_0x2e0a14][_0x51aa('0x64')]):_0x2e4432[_0x2e0a14][_0x51aa('0x64')];}}var _0x2e4924=[],_0xd6c0ae={};for(var _0x56be4a=0x0,_0x1be4ef=_0x7b7d7d['length'];_0x56be4a<_0x1be4ef;_0x56be4a++){_0xd6c0ae={'ProjectId':_0x1c09dc[_0x51aa('0x49')]['id'],'SessionId':_0x7b7d7d[_0x56be4a]['id'],'StartTime':moment(_0x7b7d7d[_0x56be4a][_0x51aa('0x65')])[_0x51aa('0x66')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x23abbb=0x0,_0x142532=_0x2e4432['length'];_0x23abbb<_0x142532;_0x23abbb++){if(_0x2e4432[_0x23abbb][_0x51aa('0x67')]==_0x7b7d7d[_0x56be4a]['id']&&_0x568e20[_0x51aa('0x34')](_0x2e4432[_0x23abbb][_0x51aa('0x63')])){_0xd6c0ae[_0x568e20[_0x2e4432[_0x23abbb][_0x51aa('0x63')]]]=_0x2e4432[_0x23abbb]['answer'];}}for(var _0x489de0 in _0x568e20){if(!_0xd6c0ae[_0x51aa('0x34')](_0x568e20[_0x489de0])){_0xd6c0ae[_0x568e20[_0x489de0]]=null;}}_0x2e4924[_0x51aa('0x68')](_0xd6c0ae);}return _0x2e4924;}})[_0x51aa('0x1f')](function(_0x35d336){if(!_['isEmpty'](_0x35d336)){var _0x3ec550=toCsv(_0x35d336);var _0x201913=Date['now']();fs[_0x51aa('0x69')](util['format'](_0x51aa('0x6a'),_0x1c09dc[_0x51aa('0x49')]['id'],_0x201913),_0x3ec550);_0x58aa42[_0x51aa('0x6b')]('Content-disposition',_0x51aa('0x6c')+util[_0x51aa('0x66')](_0x51aa('0x6d'),_0x1c09dc[_0x51aa('0x49')]['id'],_0x201913));_0x58aa42[_0x51aa('0x6b')](_0x51aa('0x6e'),_0x51aa('0x6f'));return _0x58aa42[_0x51aa('0x70')](util[_0x51aa('0x66')](_0x51aa('0x6a'),_0x1c09dc[_0x51aa('0x49')]['id'],_0x201913));}else{return _0x58aa42['sendStatus'](0xcc);}})[_0x51aa('0x3d')](handleError(_0x58aa42,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 1fa6add..7ec1657 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 _0xe76b=['rimraf','../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe76b,0x72));var _0xbe76=function(_0x54a2e4,_0x1ff92c){_0x54a2e4=_0x54a2e4-0x0;var _0x4742d0=_0xe76b[_0x54a2e4];return _0x4742d0;};'use strict';var _=require('lodash');var util=require(_0xbe76('0x0'));var logger=require(_0xbe76('0x1'))(_0xbe76('0x2'));var moment=require(_0xbe76('0x3'));var BPromise=require(_0xbe76('0x4'));var rp=require(_0xbe76('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe76('0x6'));var config=require(_0xbe76('0x7'));var attributes=require(_0xbe76('0x8'));module[_0xbe76('0x9')]=function(_0x417654,_0x53e41d){return _0x417654['define'](_0xbe76('0xa'),attributes,{'tableName':_0xbe76('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba64=['bluebird','request-promise','path','rimraf','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','moment'];(function(_0x155eb8,_0x20029b){var _0x2d666b=function(_0x210f36){while(--_0x210f36){_0x155eb8['push'](_0x155eb8['shift']());}};_0x2d666b(++_0x20029b);}(_0xba64,0x188));var _0x4ba6=function(_0x343892,_0x36870e){_0x343892=_0x343892-0x0;var _0x92516a=_0xba64[_0x343892];return _0x92516a;};'use strict';var _=require(_0x4ba6('0x0'));var util=require(_0x4ba6('0x1'));var logger=require(_0x4ba6('0x2'))('api');var moment=require(_0x4ba6('0x3'));var BPromise=require(_0x4ba6('0x4'));var rp=require(_0x4ba6('0x5'));var fs=require('fs');var path=require(_0x4ba6('0x6'));var rimraf=require(_0x4ba6('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0x4ba6('0x8')]=function(_0xd55c2a,_0x17b0bf){return _0xd55c2a[_0x4ba6('0x9')](_0x4ba6('0xa'),attributes,{'tableName':_0x4ba6('0xb'),'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 2c4fba4..0f7faf4 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 _0x6f9e=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','info','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4a53fd,_0x4b7616){var _0x37747a=function(_0x3a6a50){while(--_0x3a6a50){_0x4a53fd['push'](_0x4a53fd['shift']());}};_0x37747a(++_0x4b7616);}(_0x6f9e,0xa2));var _0xe6f9=function(_0x21d128,_0x5ebb12){_0x21d128=_0x21d128-0x0;var _0x53da16=_0x6f9e[_0x21d128];return _0x53da16;};'use strict';var _=require(_0xe6f9('0x0'));var util=require(_0xe6f9('0x1'));var moment=require(_0xe6f9('0x2'));var BPromise=require(_0xe6f9('0x3'));var rs=require(_0xe6f9('0x4'));var fs=require('fs');var Redis=require(_0xe6f9('0x5'));var db=require(_0xe6f9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe6f9('0x7'))('rpc');var config=require(_0xe6f9('0x8'));var jayson=require(_0xe6f9('0x9'));var client=jayson[_0xe6f9('0xa')][_0xe6f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18c5ab,_0x4c6436,_0x29b467){return new BPromise(function(_0x2ad681,_0x3e21a7){return client[_0xe6f9('0xc')](_0x18c5ab,_0x29b467)[_0xe6f9('0xd')](function(_0x2375cb){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x4c6436,_0xe6f9('0xe'));logger['debug']('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x4c6436,_0xe6f9('0xe'),JSON[_0xe6f9('0xf')](_0x2375cb));if(_0x2375cb['error']){if(_0x2375cb[_0xe6f9('0x10')][_0xe6f9('0x11')]===0x1f4){logger[_0xe6f9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4c6436,_0x2375cb[_0xe6f9('0x10')][_0xe6f9('0x12')]);return _0x3e21a7(_0x2375cb[_0xe6f9('0x10')][_0xe6f9('0x12')]);}logger[_0xe6f9('0x10')](_0xe6f9('0x13'),_0x4c6436,_0x2375cb[_0xe6f9('0x10')][_0xe6f9('0x12')]);return _0x2ad681(_0x2375cb[_0xe6f9('0x10')][_0xe6f9('0x12')]);}else{logger[_0xe6f9('0x14')]('JscriptyProject,\x20%s,\x20%s',_0x4c6436,_0xe6f9('0xe'));_0x2ad681(_0x2375cb['result']['message']);}})['catch'](function(_0x310168){logger[_0xe6f9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4c6436,_0x310168);_0x3e21a7(_0x310168);});});} \ No newline at end of file +var _0xad7e=['rpc','../../config/environment','client','http','request','then','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5024ff,_0x2066c9){var _0x483662=function(_0x7954a3){while(--_0x7954a3){_0x5024ff['push'](_0x5024ff['shift']());}};_0x483662(++_0x2066c9);}(_0xad7e,0xde));var _0xead7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad7e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xead7('0x0'));var util=require(_0xead7('0x1'));var moment=require(_0xead7('0x2'));var BPromise=require('bluebird');var rs=require(_0xead7('0x3'));var fs=require('fs');var Redis=require(_0xead7('0x4'));var db=require(_0xead7('0x5'))['db'];var utils=require(_0xead7('0x6'));var logger=require(_0xead7('0x7'))(_0xead7('0x8'));var config=require(_0xead7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xead7('0xa')][_0xead7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10607c,_0x1c197a,_0xdd9753){return new BPromise(function(_0x5ca13a,_0x160790){return client[_0xead7('0xc')](_0x10607c,_0xdd9753)[_0xead7('0xd')](function(_0x2aeef4){logger['info'](_0xead7('0xe'),_0x1c197a,_0xead7('0xf'));logger[_0xead7('0x10')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x1c197a,_0xead7('0xf'),JSON[_0xead7('0x11')](_0x2aeef4));if(_0x2aeef4['error']){if(_0x2aeef4['error'][_0xead7('0x12')]===0x1f4){logger[_0xead7('0x13')](_0xead7('0xe'),_0x1c197a,_0x2aeef4[_0xead7('0x13')][_0xead7('0x14')]);return _0x160790(_0x2aeef4[_0xead7('0x13')][_0xead7('0x14')]);}logger[_0xead7('0x13')](_0xead7('0xe'),_0x1c197a,_0x2aeef4[_0xead7('0x13')][_0xead7('0x14')]);return _0x5ca13a(_0x2aeef4['error'][_0xead7('0x14')]);}else{logger['info'](_0xead7('0xe'),_0x1c197a,_0xead7('0xf'));_0x5ca13a(_0x2aeef4[_0xead7('0x15')][_0xead7('0x14')]);}})[_0xead7('0x16')](function(_0x59372e){logger[_0xead7('0x13')](_0xead7('0xe'),_0x1c197a,_0x59372e);_0x160790(_0x59372e);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 7285ac7..707f927 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 _0x1dc3=['update','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','get','/describe','/:id','show','post','create','put'];(function(_0x316363,_0x2986ec){var _0x41c9ea=function(_0x3f1704){while(--_0x3f1704){_0x316363['push'](_0x316363['shift']());}};_0x41c9ea(++_0x2986ec);}(_0x1dc3,0x145));var _0x31dc=function(_0xc180d1,_0x456432){_0xc180d1=_0xc180d1-0x0;var _0x43f2f9=_0x1dc3[_0xc180d1];return _0x43f2f9;};'use strict';var multer=require(_0x31dc('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x31dc('0x1'));var router=express[_0x31dc('0x2')]();var auth=require(_0x31dc('0x3'));var interaction=require(_0x31dc('0x4'));var config=require(_0x31dc('0x5'));var controller=require(_0x31dc('0x6'));router['get']('/',auth[_0x31dc('0x7')](),controller['index']);router[_0x31dc('0x8')](_0x31dc('0x9'),auth[_0x31dc('0x7')](),controller['describe']);router['get'](_0x31dc('0xa'),auth[_0x31dc('0x7')](),controller[_0x31dc('0xb')]);router[_0x31dc('0xc')]('/',auth[_0x31dc('0x7')](),controller[_0x31dc('0xd')]);router[_0x31dc('0xe')](_0x31dc('0xa'),auth[_0x31dc('0x7')](),controller[_0x31dc('0xf')]);router['delete'](_0x31dc('0xa'),auth[_0x31dc('0x7')](),controller['destroy']);module[_0x31dc('0x10')]=router; \ No newline at end of file +var _0x22ea=['util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','multer'];(function(_0x20f597,_0x20278b){var _0x31b38c=function(_0x2c600d){while(--_0x2c600d){_0x20f597['push'](_0x20f597['shift']());}};_0x31b38c(++_0x20278b);}(_0x22ea,0xb3));var _0xa22e=function(_0x4e48c3,_0x1d272b){_0x4e48c3=_0x4e48c3-0x0;var _0x35a053=_0x22ea[_0x4e48c3];return _0x35a053;};'use strict';var multer=require(_0xa22e('0x0'));var util=require(_0xa22e('0x1'));var path=require(_0xa22e('0x2'));var timeout=require(_0xa22e('0x3'));var express=require('express');var router=express[_0xa22e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa22e('0x5'));var config=require(_0xa22e('0x6'));var controller=require(_0xa22e('0x7'));router[_0xa22e('0x8')]('/',auth[_0xa22e('0x9')](),controller['index']);router['get'](_0xa22e('0xa'),auth[_0xa22e('0x9')](),controller[_0xa22e('0xb')]);router[_0xa22e('0x8')](_0xa22e('0xc'),auth[_0xa22e('0x9')](),controller[_0xa22e('0xd')]);router[_0xa22e('0xe')]('/',auth[_0xa22e('0x9')](),controller['create']);router[_0xa22e('0xf')](_0xa22e('0xc'),auth['isAuthenticated'](),controller[_0xa22e('0x10')]);router[_0xa22e('0x11')](_0xa22e('0xc'),auth[_0xa22e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 99dbc1e..3af2ea0 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 _0x7af2=['STRING','exports','TEXT','long'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7af2,0x119));var _0x27af=function(_0x19a562,_0x4b669f){_0x19a562=_0x19a562-0x0;var _0x3bd3f3=_0x7af2[_0x19a562];return _0x3bd3f3;};'use strict';var Sequelize=require('sequelize');module[_0x27af('0x0')]={'question':{'type':Sequelize[_0x27af('0x1')]},'answer':{'type':Sequelize[_0x27af('0x1')](_0x27af('0x2'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x27af('0x3')]},'queue':{'type':Sequelize[_0x27af('0x3')]},'uniqueid':{'type':Sequelize[_0x27af('0x3')]},'calleridname':{'type':Sequelize[_0x27af('0x3')]},'calleridnum':{'type':Sequelize[_0x27af('0x3')]},'questionId':{'type':Sequelize[_0x27af('0x3')]}}; \ No newline at end of file +var _0x8130=['STRING','sequelize','exports','TEXT','long'];(function(_0xe7469b,_0x4a14f5){var _0x4d0ba8=function(_0x2f1524){while(--_0x2f1524){_0xe7469b['push'](_0xe7469b['shift']());}};_0x4d0ba8(++_0x4a14f5);}(_0x8130,0x146));var _0x0813=function(_0x329aa5,_0x5a9f99){_0x329aa5=_0x329aa5-0x0;var _0x2f05c8=_0x8130[_0x329aa5];return _0x2f05c8;};'use strict';var Sequelize=require(_0x0813('0x0'));module[_0x0813('0x1')]={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize[_0x0813('0x2')](_0x0813('0x3'))},'membername':{'type':Sequelize[_0x0813('0x4')]},'projectname':{'type':Sequelize[_0x0813('0x4')]},'queue':{'type':Sequelize[_0x0813('0x4')]},'uniqueid':{'type':Sequelize[_0x0813('0x4')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0813('0x4')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 99c7d45..14a6053 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 _0xc3de=['../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','reject','then','destroy','end','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','JscriptyQuestionReport','include','findAll','rows','show','model','fields','includeAll','create','catch','update','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x4ed431,_0x37b579){var _0x9c64e5=function(_0xd6c75e){while(--_0xd6c75e){_0x4ed431['push'](_0x4ed431['shift']());}};_0x9c64e5(++_0x37b579);}(_0xc3de,0xd0));var _0xec3d=function(_0x542d43,_0x581432){_0x542d43=_0x542d43-0x0;var _0x3fb854=_0xc3de[_0x542d43];return _0x3fb854;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xec3d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec3d('0x1'));var jsonpatch=require(_0xec3d('0x2'));var rp=require(_0xec3d('0x3'));var moment=require(_0xec3d('0x4'));var BPromise=require(_0xec3d('0x5'));var Mustache=require(_0xec3d('0x6'));var util=require(_0xec3d('0x7'));var path=require(_0xec3d('0x8'));var sox=require(_0xec3d('0x9'));var csv=require(_0xec3d('0xa'));var ejs=require(_0xec3d('0xb'));var fs=require('fs');var _=require(_0xec3d('0xc'));var squel=require(_0xec3d('0xd'));var crypto=require('crypto');var jsforce=require(_0xec3d('0xe'));var deskjs=require(_0xec3d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xec3d('0x10'));var Papa=require(_0xec3d('0x11'));var Redis=require(_0xec3d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xec3d('0x13'));var as=require(_0xec3d('0x14'));var hardwareService=require(_0xec3d('0x15'));var logger=require(_0xec3d('0x16'))(_0xec3d('0x17'));var utils=require(_0xec3d('0x18'));var config=require(_0xec3d('0x19'));var licenseUtil=require(_0xec3d('0x1a'));var db=require(_0xec3d('0x1b'))['db'];function respondWithStatusCode(_0x22c230,_0x360319){_0x360319=_0x360319||0xcc;return function(_0x52983d){if(_0x52983d){return _0x22c230[_0xec3d('0x1c')](_0x360319);}return _0x22c230[_0xec3d('0x1d')](_0x360319)['end']();};}function respondWithResult(_0x57d050,_0xd57275){_0xd57275=_0xd57275||0xc8;return function(_0x3ff85f){if(_0x3ff85f){return _0x57d050['status'](_0xd57275)[_0xec3d('0x1e')](_0x3ff85f);}};}function respondWithFilteredResult(_0x182706,_0x3ef27f){return function(_0xbe541d){if(_0xbe541d){var _0x55a712=_0xbe541d[_0xec3d('0x1f')],_0x17f285=_0x3ef27f[_0xec3d('0x20')],_0x2f9ee6=_0x3ef27f['offset']+_0x3ef27f['limit'],_0x7af67c;if(_0x2f9ee6>=_0x55a712){_0x2f9ee6=_0x55a712;_0x7af67c=0xc8;}else{_0x7af67c=0xce;}_0x182706[_0xec3d('0x1d')](_0x7af67c);return _0x182706[_0xec3d('0x21')](_0xec3d('0x22'),_0x17f285+'-'+_0x2f9ee6+'/'+_0x55a712)['json'](_0xbe541d);}return null;};}function patchUpdates(_0x23d7cb){return function(_0x2517d5){try{jsonpatch['apply'](_0x2517d5,_0x23d7cb,!![]);}catch(_0x2f9872){return BPromise[_0xec3d('0x23')](_0x2f9872);}return _0x2517d5['save']();};}function saveUpdates(_0x355392,_0xbd65e8){return function(_0x1eeca2){if(_0x1eeca2){return _0x1eeca2['update'](_0x355392)[_0xec3d('0x24')](function(_0x4e9d64){return _0x4e9d64;});}return null;};}function removeEntity(_0x47a56c,_0x4e47d2){return function(_0x564068){if(_0x564068){return _0x564068[_0xec3d('0x25')]()[_0xec3d('0x24')](function(){_0x47a56c[_0xec3d('0x1d')](0xcc)[_0xec3d('0x26')]();});}};}function handleEntityNotFound(_0x180597,_0x732374){return function(_0x582261){if(!_0x582261){_0x180597['sendStatus'](0x194);}return _0x582261;};}function handleError(_0x3d53fd,_0x395375){_0x395375=_0x395375||0x1f4;return function(_0x315db1){logger['error'](_0x315db1[_0xec3d('0x27')]);if(_0x315db1[_0xec3d('0x28')]){delete _0x315db1[_0xec3d('0x28')];}_0x3d53fd[_0xec3d('0x1d')](_0x395375)['send'](_0x315db1);};}exports[_0xec3d('0x29')]=function(_0x4cb7fe,_0x5e4f86){var _0x5b8cb2={},_0x1cf8d6={},_0x262186={'count':0x0,'rows':[]};var _0x31fafa=_[_0xec3d('0x2a')](db['JscriptyQuestionReport'][_0xec3d('0x2b')],function(_0x308935){return{'name':_0x308935[_0xec3d('0x2c')],'type':_0x308935[_0xec3d('0x2d')][_0xec3d('0x2e')]};});_0x1cf8d6['model']=_[_0xec3d('0x2a')](_0x31fafa,_0xec3d('0x28'));_0x1cf8d6[_0xec3d('0x2f')]=_[_0xec3d('0x30')](_0x4cb7fe[_0xec3d('0x2f')]);_0x1cf8d6[_0xec3d('0x31')]=_[_0xec3d('0x32')](_0x1cf8d6['model'],_0x1cf8d6['query']);_0x5b8cb2[_0xec3d('0x33')]=_[_0xec3d('0x32')](_0x1cf8d6['model'],qs['fields'](_0x4cb7fe[_0xec3d('0x2f')]['fields']));_0x5b8cb2[_0xec3d('0x33')]=_0x5b8cb2['attributes'][_0xec3d('0x34')]?_0x5b8cb2[_0xec3d('0x33')]:_0x1cf8d6['model'];if(!_0x4cb7fe[_0xec3d('0x2f')][_0xec3d('0x35')](_0xec3d('0x36'))){_0x5b8cb2[_0xec3d('0x37')]=qs[_0xec3d('0x37')](_0x4cb7fe[_0xec3d('0x2f')][_0xec3d('0x37')]);_0x5b8cb2[_0xec3d('0x20')]=qs['offset'](_0x4cb7fe[_0xec3d('0x2f')][_0xec3d('0x20')]);}_0x5b8cb2[_0xec3d('0x38')]=qs[_0xec3d('0x39')](_0x4cb7fe[_0xec3d('0x2f')][_0xec3d('0x39')]);_0x5b8cb2['where']=qs[_0xec3d('0x31')](_[_0xec3d('0x3a')](_0x4cb7fe[_0xec3d('0x2f')],_0x1cf8d6[_0xec3d('0x31')]),_0x31fafa);if(_0x4cb7fe[_0xec3d('0x2f')][_0xec3d('0x3b')]){_0x5b8cb2['where']=_[_0xec3d('0x3c')](_0x5b8cb2[_0xec3d('0x3d')],{'$or':_[_0xec3d('0x2a')](_0x31fafa,function(_0x3f7382){if(_0x3f7382[_0xec3d('0x2d')]!==_0xec3d('0x3e')){var _0x3887ba={};_0x3887ba[_0x3f7382[_0xec3d('0x28')]]={'$like':'%'+_0x4cb7fe[_0xec3d('0x2f')]['filter']+'%'};return _0x3887ba;}})});}_0x5b8cb2=_[_0xec3d('0x3c')]({},_0x5b8cb2,_0x4cb7fe['options']);var _0x2d920f={'where':_0x5b8cb2[_0xec3d('0x3d')]};return db[_0xec3d('0x3f')]['count'](_0x2d920f)['then'](function(_0x485a7b){_0x262186[_0xec3d('0x1f')]=_0x485a7b;if(_0x4cb7fe[_0xec3d('0x2f')]['includeAll']){_0x5b8cb2[_0xec3d('0x40')]=[{'all':!![]}];}return db[_0xec3d('0x3f')][_0xec3d('0x41')](_0x5b8cb2);})[_0xec3d('0x24')](function(_0x3884c0){_0x262186[_0xec3d('0x42')]=_0x3884c0;return _0x262186;})[_0xec3d('0x24')](respondWithFilteredResult(_0x5e4f86,_0x5b8cb2))['catch'](handleError(_0x5e4f86,null));};exports[_0xec3d('0x43')]=function(_0x363ec8,_0x5435c5){var _0x33ac45={'raw':!![],'where':{'id':_0x363ec8['params']['id']}},_0x268a49={};_0x268a49['model']=_[_0xec3d('0x30')](db[_0xec3d('0x3f')]['rawAttributes']);_0x268a49[_0xec3d('0x2f')]=_[_0xec3d('0x30')](_0x363ec8[_0xec3d('0x2f')]);_0x268a49['filters']=_[_0xec3d('0x32')](_0x268a49[_0xec3d('0x44')],_0x268a49[_0xec3d('0x2f')]);_0x33ac45[_0xec3d('0x33')]=_['intersection'](_0x268a49['model'],qs[_0xec3d('0x45')](_0x363ec8[_0xec3d('0x2f')]['fields']));_0x33ac45[_0xec3d('0x33')]=_0x33ac45['attributes'][_0xec3d('0x34')]?_0x33ac45[_0xec3d('0x33')]:_0x268a49[_0xec3d('0x44')];if(_0x363ec8[_0xec3d('0x2f')][_0xec3d('0x46')]){_0x33ac45[_0xec3d('0x40')]=[{'all':!![]}];}_0x33ac45=_[_0xec3d('0x3c')]({},_0x33ac45,_0x363ec8['options']);return db[_0xec3d('0x3f')]['find'](_0x33ac45)[_0xec3d('0x24')](handleEntityNotFound(_0x5435c5,null))[_0xec3d('0x24')](respondWithResult(_0x5435c5,null))['catch'](handleError(_0x5435c5,null));};exports[_0xec3d('0x47')]=function(_0x18ce65,_0x4197e3){return db[_0xec3d('0x3f')][_0xec3d('0x47')](_0x18ce65['body'],{})['then'](respondWithResult(_0x4197e3,0xc9))[_0xec3d('0x48')](handleError(_0x4197e3,null));};exports[_0xec3d('0x49')]=function(_0x70cf1c,_0x90deec){if(_0x70cf1c[_0xec3d('0x4a')]['id']){delete _0x70cf1c[_0xec3d('0x4a')]['id'];}return db[_0xec3d('0x3f')][_0xec3d('0x4b')]({'where':{'id':_0x70cf1c[_0xec3d('0x4c')]['id']}})[_0xec3d('0x24')](handleEntityNotFound(_0x90deec,null))['then'](saveUpdates(_0x70cf1c[_0xec3d('0x4a')],null))['then'](respondWithResult(_0x90deec,null))['catch'](handleError(_0x90deec,null));};exports['destroy']=function(_0x2be80d,_0x60f2e){return db[_0xec3d('0x3f')]['find']({'where':{'id':_0x2be80d[_0xec3d('0x4c')]['id']}})[_0xec3d('0x24')](handleEntityNotFound(_0x60f2e,null))[_0xec3d('0x24')](removeEntity(_0x60f2e,null))[_0xec3d('0x48')](handleError(_0x60f2e,null));};exports[_0xec3d('0x4d')]=function(_0x4ca9bf,_0x1deb7d){return db['JscriptyQuestionReport'][_0xec3d('0x4d')]()[_0xec3d('0x24')](respondWithResult(_0x1deb7d,null))[_0xec3d('0x48')](handleError(_0x1deb7d,null));}; \ No newline at end of file +var _0xe2c9=['catch','create','body','update','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','JscriptyQuestionReport','include','rows','show','params','includeAll'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xe2c9,0x17d));var _0x9e2c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe2c9[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0x9e2c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9e2c('0x1'));var zipdir=require(_0x9e2c('0x2'));var jsonpatch=require(_0x9e2c('0x3'));var rp=require(_0x9e2c('0x4'));var moment=require('moment');var BPromise=require(_0x9e2c('0x5'));var Mustache=require(_0x9e2c('0x6'));var util=require(_0x9e2c('0x7'));var path=require(_0x9e2c('0x8'));var sox=require(_0x9e2c('0x9'));var csv=require('to-csv');var ejs=require(_0x9e2c('0xa'));var fs=require('fs');var _=require(_0x9e2c('0xb'));var squel=require(_0x9e2c('0xc'));var crypto=require('crypto');var jsforce=require(_0x9e2c('0xd'));var deskjs=require(_0x9e2c('0xe'));var toCsv=require(_0x9e2c('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9e2c('0x10'));var authService=require(_0x9e2c('0x11'));var qs=require(_0x9e2c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e2c('0x13'));var logger=require(_0x9e2c('0x14'))(_0x9e2c('0x15'));var utils=require(_0x9e2c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9e2c('0x17'));var db=require(_0x9e2c('0x18'))['db'];function respondWithStatusCode(_0x47aa5d,_0x11d4e4){_0x11d4e4=_0x11d4e4||0xcc;return function(_0x5c22e8){if(_0x5c22e8){return _0x47aa5d[_0x9e2c('0x19')](_0x11d4e4);}return _0x47aa5d[_0x9e2c('0x1a')](_0x11d4e4)[_0x9e2c('0x1b')]();};}function respondWithResult(_0x31e769,_0x49b96b){_0x49b96b=_0x49b96b||0xc8;return function(_0xf8721e){if(_0xf8721e){return _0x31e769[_0x9e2c('0x1a')](_0x49b96b)[_0x9e2c('0x1c')](_0xf8721e);}};}function respondWithFilteredResult(_0x5b3293,_0x57b191){return function(_0x21e95e){if(_0x21e95e){var _0x23f0a0=_0x21e95e[_0x9e2c('0x1d')],_0x5bd492=_0x57b191[_0x9e2c('0x1e')],_0x1f84fb=_0x57b191[_0x9e2c('0x1e')]+_0x57b191[_0x9e2c('0x1f')],_0x3253c2;if(_0x1f84fb>=_0x23f0a0){_0x1f84fb=_0x23f0a0;_0x3253c2=0xc8;}else{_0x3253c2=0xce;}_0x5b3293[_0x9e2c('0x1a')](_0x3253c2);return _0x5b3293['set'](_0x9e2c('0x20'),_0x5bd492+'-'+_0x1f84fb+'/'+_0x23f0a0)[_0x9e2c('0x1c')](_0x21e95e);}return null;};}function patchUpdates(_0x5c08b5){return function(_0x4b0148){try{jsonpatch[_0x9e2c('0x21')](_0x4b0148,_0x5c08b5,!![]);}catch(_0x53600c){return BPromise[_0x9e2c('0x22')](_0x53600c);}return _0x4b0148[_0x9e2c('0x23')]();};}function saveUpdates(_0x1b625c,_0x5a6142){return function(_0x47e1b3){if(_0x47e1b3){return _0x47e1b3['update'](_0x1b625c)[_0x9e2c('0x24')](function(_0x5efaa3){return _0x5efaa3;});}return null;};}function removeEntity(_0x46d909,_0x240233){return function(_0x465db6){if(_0x465db6){return _0x465db6['destroy']()[_0x9e2c('0x24')](function(){_0x46d909[_0x9e2c('0x1a')](0xcc)[_0x9e2c('0x1b')]();});}};}function handleEntityNotFound(_0x1177a2,_0x2068d9){return function(_0x50c420){if(!_0x50c420){_0x1177a2[_0x9e2c('0x19')](0x194);}return _0x50c420;};}function handleError(_0xfaf2c0,_0x353029){_0x353029=_0x353029||0x1f4;return function(_0xb05468){logger[_0x9e2c('0x25')](_0xb05468[_0x9e2c('0x26')]);if(_0xb05468[_0x9e2c('0x27')]){delete _0xb05468['name'];}_0xfaf2c0['status'](_0x353029)[_0x9e2c('0x28')](_0xb05468);};}exports[_0x9e2c('0x29')]=function(_0x168b60,_0xbcd03){var _0x4a9951={},_0xf88425={},_0x4393db={'count':0x0,'rows':[]};var _0x58e07d=_[_0x9e2c('0x2a')](db['JscriptyQuestionReport'][_0x9e2c('0x2b')],function(_0x23cb32){return{'name':_0x23cb32[_0x9e2c('0x2c')],'type':_0x23cb32[_0x9e2c('0x2d')]['key']};});_0xf88425['model']=_[_0x9e2c('0x2a')](_0x58e07d,_0x9e2c('0x27'));_0xf88425[_0x9e2c('0x2e')]=_[_0x9e2c('0x2f')](_0x168b60[_0x9e2c('0x2e')]);_0xf88425[_0x9e2c('0x30')]=_[_0x9e2c('0x31')](_0xf88425[_0x9e2c('0x32')],_0xf88425[_0x9e2c('0x2e')]);_0x4a9951[_0x9e2c('0x33')]=_[_0x9e2c('0x31')](_0xf88425['model'],qs['fields'](_0x168b60[_0x9e2c('0x2e')][_0x9e2c('0x34')]));_0x4a9951['attributes']=_0x4a9951['attributes'][_0x9e2c('0x35')]?_0x4a9951[_0x9e2c('0x33')]:_0xf88425[_0x9e2c('0x32')];if(!_0x168b60[_0x9e2c('0x2e')][_0x9e2c('0x36')](_0x9e2c('0x37'))){_0x4a9951[_0x9e2c('0x1f')]=qs[_0x9e2c('0x1f')](_0x168b60[_0x9e2c('0x2e')][_0x9e2c('0x1f')]);_0x4a9951[_0x9e2c('0x1e')]=qs['offset'](_0x168b60[_0x9e2c('0x2e')]['offset']);}_0x4a9951[_0x9e2c('0x38')]=qs['sort'](_0x168b60[_0x9e2c('0x2e')][_0x9e2c('0x39')]);_0x4a9951['where']=qs[_0x9e2c('0x30')](_['pick'](_0x168b60[_0x9e2c('0x2e')],_0xf88425[_0x9e2c('0x30')]),_0x58e07d);if(_0x168b60[_0x9e2c('0x2e')][_0x9e2c('0x3a')]){_0x4a9951['where']=_[_0x9e2c('0x3b')](_0x4a9951[_0x9e2c('0x3c')],{'$or':_[_0x9e2c('0x2a')](_0x58e07d,function(_0x1d8f80){if(_0x1d8f80[_0x9e2c('0x2d')]!==_0x9e2c('0x3d')){var _0x3ae261={};_0x3ae261[_0x1d8f80[_0x9e2c('0x27')]]={'$like':'%'+_0x168b60[_0x9e2c('0x2e')][_0x9e2c('0x3a')]+'%'};return _0x3ae261;}})});}_0x4a9951=_[_0x9e2c('0x3b')]({},_0x4a9951,_0x168b60[_0x9e2c('0x3e')]);var _0x50a1b1={'where':_0x4a9951[_0x9e2c('0x3c')]};return db[_0x9e2c('0x3f')]['count'](_0x50a1b1)[_0x9e2c('0x24')](function(_0x4670a5){_0x4393db['count']=_0x4670a5;if(_0x168b60[_0x9e2c('0x2e')]['includeAll']){_0x4a9951[_0x9e2c('0x40')]=[{'all':!![]}];}return db[_0x9e2c('0x3f')]['findAll'](_0x4a9951);})['then'](function(_0x4ce25e){_0x4393db[_0x9e2c('0x41')]=_0x4ce25e;return _0x4393db;})[_0x9e2c('0x24')](respondWithFilteredResult(_0xbcd03,_0x4a9951))['catch'](handleError(_0xbcd03,null));};exports[_0x9e2c('0x42')]=function(_0x1e75e0,_0x189630){var _0x544ada={'raw':!![],'where':{'id':_0x1e75e0[_0x9e2c('0x43')]['id']}},_0x38fd98={};_0x38fd98['model']=_[_0x9e2c('0x2f')](db[_0x9e2c('0x3f')][_0x9e2c('0x2b')]);_0x38fd98[_0x9e2c('0x2e')]=_[_0x9e2c('0x2f')](_0x1e75e0['query']);_0x38fd98[_0x9e2c('0x30')]=_[_0x9e2c('0x31')](_0x38fd98[_0x9e2c('0x32')],_0x38fd98[_0x9e2c('0x2e')]);_0x544ada['attributes']=_[_0x9e2c('0x31')](_0x38fd98[_0x9e2c('0x32')],qs[_0x9e2c('0x34')](_0x1e75e0[_0x9e2c('0x2e')][_0x9e2c('0x34')]));_0x544ada['attributes']=_0x544ada[_0x9e2c('0x33')][_0x9e2c('0x35')]?_0x544ada[_0x9e2c('0x33')]:_0x38fd98['model'];if(_0x1e75e0[_0x9e2c('0x2e')][_0x9e2c('0x44')]){_0x544ada[_0x9e2c('0x40')]=[{'all':!![]}];}_0x544ada=_[_0x9e2c('0x3b')]({},_0x544ada,_0x1e75e0[_0x9e2c('0x3e')]);return db[_0x9e2c('0x3f')]['find'](_0x544ada)[_0x9e2c('0x24')](handleEntityNotFound(_0x189630,null))[_0x9e2c('0x24')](respondWithResult(_0x189630,null))[_0x9e2c('0x45')](handleError(_0x189630,null));};exports[_0x9e2c('0x46')]=function(_0x1766d2,_0x143fa8){return db[_0x9e2c('0x3f')][_0x9e2c('0x46')](_0x1766d2[_0x9e2c('0x47')],{})[_0x9e2c('0x24')](respondWithResult(_0x143fa8,0xc9))['catch'](handleError(_0x143fa8,null));};exports[_0x9e2c('0x48')]=function(_0x2e0190,_0x4e5394){if(_0x2e0190[_0x9e2c('0x47')]['id']){delete _0x2e0190[_0x9e2c('0x47')]['id'];}return db[_0x9e2c('0x3f')][_0x9e2c('0x49')]({'where':{'id':_0x2e0190['params']['id']}})['then'](handleEntityNotFound(_0x4e5394,null))[_0x9e2c('0x24')](saveUpdates(_0x2e0190[_0x9e2c('0x47')],null))[_0x9e2c('0x24')](respondWithResult(_0x4e5394,null))[_0x9e2c('0x45')](handleError(_0x4e5394,null));};exports['destroy']=function(_0xbb5733,_0x15e291){return db[_0x9e2c('0x3f')][_0x9e2c('0x49')]({'where':{'id':_0xbb5733['params']['id']}})[_0x9e2c('0x24')](handleEntityNotFound(_0x15e291,null))[_0x9e2c('0x24')](removeEntity(_0x15e291,null))[_0x9e2c('0x45')](handleError(_0x15e291,null));};exports[_0x9e2c('0x4a')]=function(_0x194a16,_0x4e2d33){return db['JscriptyQuestionReport']['describe']()['then'](respondWithResult(_0x4e2d33,null))[_0x9e2c('0x45')](handleError(_0x4e2d33,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index c58b202..ece061d 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 _0x2e90=['request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x11bdeb,_0x45a142){var _0x206c25=function(_0x4b67b8){while(--_0x4b67b8){_0x11bdeb['push'](_0x11bdeb['shift']());}};_0x206c25(++_0x45a142);}(_0x2e90,0x166));var _0x02e9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2e90[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x02e9('0x0'));var util=require(_0x02e9('0x1'));var logger=require(_0x02e9('0x2'))(_0x02e9('0x3'));var moment=require(_0x02e9('0x4'));var BPromise=require('bluebird');var rp=require(_0x02e9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x02e9('0x6'));var config=require(_0x02e9('0x7'));var attributes=require(_0x02e9('0x8'));module[_0x02e9('0x9')]=function(_0x34c910,_0x26f7a6){return _0x34c910[_0x02e9('0xa')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd004=['../../config/logger','bluebird','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util'];(function(_0x5a1748,_0xe6026f){var _0x771410=function(_0x55ace5){while(--_0x55ace5){_0x5a1748['push'](_0x5a1748['shift']());}};_0x771410(++_0xe6026f);}(_0xd004,0x1f2));var _0x4d00=function(_0x5d242a,_0x34ced5){_0x5d242a=_0x5d242a-0x0;var _0x17649d=_0xd004[_0x5d242a];return _0x17649d;};'use strict';var _=require(_0x4d00('0x0'));var util=require(_0x4d00('0x1'));var logger=require(_0x4d00('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4d00('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4d00('0x4'));var config=require(_0x4d00('0x5'));var attributes=require(_0x4d00('0x6'));module[_0x4d00('0x7')]=function(_0x3b0959,_0x22825f){return _0x3b0959['define'](_0x4d00('0x8'),attributes,{'tableName':_0x4d00('0x9'),'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 59b6173..2a15c36 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 _0xb89e=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyQuestionReport,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug'];(function(_0x202ea3,_0x38ab41){var _0x58787b=function(_0x1dce0b){while(--_0x1dce0b){_0x202ea3['push'](_0x202ea3['shift']());}};_0x58787b(++_0x38ab41);}(_0xb89e,0x114));var _0xeb89=function(_0x8ba19a,_0x1d2b2b){_0x8ba19a=_0x8ba19a-0x0;var _0x2bd8b4=_0xb89e[_0x8ba19a];return _0x2bd8b4;};'use strict';var _=require(_0xeb89('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xeb89('0x1'));var rs=require(_0xeb89('0x2'));var fs=require('fs');var Redis=require(_0xeb89('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeb89('0x4'))('rpc');var config=require(_0xeb89('0x5'));var jayson=require(_0xeb89('0x6'));var client=jayson[_0xeb89('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe17f71,_0x2144ac,_0x1ae566){return new BPromise(function(_0x30e573,_0x510750){return client[_0xeb89('0x8')](_0xe17f71,_0x1ae566)['then'](function(_0x5c6d0a){logger[_0xeb89('0x9')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2144ac,_0xeb89('0xa'));logger[_0xeb89('0xb')](_0xeb89('0xc'),_0x2144ac,_0xeb89('0xa'),JSON[_0xeb89('0xd')](_0x5c6d0a));if(_0x5c6d0a[_0xeb89('0xe')]){if(_0x5c6d0a['error']['code']===0x1f4){logger[_0xeb89('0xe')](_0xeb89('0xf'),_0x2144ac,_0x5c6d0a['error']['message']);return _0x510750(_0x5c6d0a[_0xeb89('0xe')][_0xeb89('0x10')]);}logger[_0xeb89('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2144ac,_0x5c6d0a['error'][_0xeb89('0x10')]);return _0x30e573(_0x5c6d0a[_0xeb89('0xe')]['message']);}else{logger[_0xeb89('0x9')](_0xeb89('0xf'),_0x2144ac,_0xeb89('0xa'));_0x30e573(_0x5c6d0a['result'][_0xeb89('0x10')]);}})[_0xeb89('0x11')](function(_0x1a6969){logger[_0xeb89('0xe')](_0xeb89('0xf'),_0x2144ac,_0x1a6969);_0x510750(_0x1a6969);});});} \ No newline at end of file +var _0xbcc8=['info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xbcc8,0xfc));var _0x8bcc=function(_0x2e78e9,_0x42957c){_0x2e78e9=_0x2e78e9-0x0;var _0x35aad4=_0xbcc8[_0x2e78e9];return _0x35aad4;};'use strict';var _=require(_0x8bcc('0x0'));var util=require('util');var moment=require(_0x8bcc('0x1'));var BPromise=require('bluebird');var rs=require(_0x8bcc('0x2'));var fs=require('fs');var Redis=require(_0x8bcc('0x3'));var db=require(_0x8bcc('0x4'))['db'];var utils=require(_0x8bcc('0x5'));var logger=require('../../config/logger')(_0x8bcc('0x6'));var config=require(_0x8bcc('0x7'));var jayson=require(_0x8bcc('0x8'));var client=jayson['client'][_0x8bcc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x475146,_0x276238,_0x5ec4db){return new BPromise(function(_0xedb8e0,_0x5832f3){return client[_0x8bcc('0xa')](_0x475146,_0x5ec4db)[_0x8bcc('0xb')](function(_0x11b0bb){logger[_0x8bcc('0xc')](_0x8bcc('0xd'),_0x276238,_0x8bcc('0xe'));logger[_0x8bcc('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x276238,'request\x20sent',JSON[_0x8bcc('0x10')](_0x11b0bb));if(_0x11b0bb['error']){if(_0x11b0bb[_0x8bcc('0x11')][_0x8bcc('0x12')]===0x1f4){logger['error'](_0x8bcc('0xd'),_0x276238,_0x11b0bb[_0x8bcc('0x11')][_0x8bcc('0x13')]);return _0x5832f3(_0x11b0bb[_0x8bcc('0x11')][_0x8bcc('0x13')]);}logger[_0x8bcc('0x11')](_0x8bcc('0xd'),_0x276238,_0x11b0bb['error'][_0x8bcc('0x13')]);return _0xedb8e0(_0x11b0bb[_0x8bcc('0x11')][_0x8bcc('0x13')]);}else{logger[_0x8bcc('0xc')](_0x8bcc('0xd'),_0x276238,_0x8bcc('0xe'));_0xedb8e0(_0x11b0bb[_0x8bcc('0x14')][_0x8bcc('0x13')]);}})[_0x8bcc('0x15')](function(_0x56ffcd){logger[_0x8bcc('0x11')](_0x8bcc('0xd'),_0x276238,_0x56ffcd);_0x5832f3(_0x56ffcd);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 997d127..dfaed55 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 _0xc576=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','./jscriptySessionReport.controller','get','index','/describe','isAuthenticated','show','/:id/questions','getQuestions','post','create'];(function(_0x30b95a,_0x103ff4){var _0x356c58=function(_0x55a40f){while(--_0x55a40f){_0x30b95a['push'](_0x30b95a['shift']());}};_0x356c58(++_0x103ff4);}(_0xc576,0x1ea));var _0x6c57=function(_0x3fe1ba,_0x1a33c5){_0x3fe1ba=_0x3fe1ba-0x0;var _0x5df1b4=_0xc576[_0x3fe1ba];return _0x5df1b4;};'use strict';var multer=require(_0x6c57('0x0'));var util=require(_0x6c57('0x1'));var path=require(_0x6c57('0x2'));var timeout=require(_0x6c57('0x3'));var express=require(_0x6c57('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6c57('0x5'));var config=require('../../config/environment');var controller=require(_0x6c57('0x6'));router[_0x6c57('0x7')]('/',auth['isAuthenticated'](),controller[_0x6c57('0x8')]);router['get'](_0x6c57('0x9'),auth[_0x6c57('0xa')](),controller['describe']);router[_0x6c57('0x7')]('/:id',auth[_0x6c57('0xa')](),controller[_0x6c57('0xb')]);router['get'](_0x6c57('0xc'),auth[_0x6c57('0xa')](),controller[_0x6c57('0xd')]);router[_0x6c57('0xe')]('/',auth['isAuthenticated'](),controller[_0x6c57('0xf')]);router[_0x6c57('0x10')](_0x6c57('0x11'),auth[_0x6c57('0xa')](),controller[_0x6c57('0x12')]);router[_0x6c57('0x13')]('/:id',auth[_0x6c57('0xa')](),controller[_0x6c57('0x14')]);module[_0x6c57('0x15')]=router; \ No newline at end of file +var _0xdcc4=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','post','create'];(function(_0x50cbd5,_0x204074){var _0x51ef04=function(_0x51e99b){while(--_0x51e99b){_0x50cbd5['push'](_0x50cbd5['shift']());}};_0x51ef04(++_0x204074);}(_0xdcc4,0xea));var _0x4dcc=function(_0x3aef06,_0x5b3f27){_0x3aef06=_0x3aef06-0x0;var _0x13cedb=_0xdcc4[_0x3aef06];return _0x13cedb;};'use strict';var multer=require(_0x4dcc('0x0'));var util=require(_0x4dcc('0x1'));var path=require(_0x4dcc('0x2'));var timeout=require(_0x4dcc('0x3'));var express=require(_0x4dcc('0x4'));var router=express['Router']();var auth=require(_0x4dcc('0x5'));var interaction=require(_0x4dcc('0x6'));var config=require(_0x4dcc('0x7'));var controller=require(_0x4dcc('0x8'));router[_0x4dcc('0x9')]('/',auth[_0x4dcc('0xa')](),controller['index']);router[_0x4dcc('0x9')]('/describe',auth[_0x4dcc('0xa')](),controller[_0x4dcc('0xb')]);router[_0x4dcc('0x9')](_0x4dcc('0xc'),auth['isAuthenticated'](),controller[_0x4dcc('0xd')]);router[_0x4dcc('0x9')](_0x4dcc('0xe'),auth[_0x4dcc('0xa')](),controller[_0x4dcc('0xf')]);router[_0x4dcc('0x10')]('/',auth[_0x4dcc('0xa')](),controller[_0x4dcc('0x11')]);router['put'](_0x4dcc('0xc'),auth[_0x4dcc('0xa')](),controller['update']);router[_0x4dcc('0x12')](_0x4dcc('0xc'),auth['isAuthenticated'](),controller[_0x4dcc('0x13')]);module[_0x4dcc('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 2098dc2..4b73441 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 _0x8372=['setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','exports','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8372,0xba));var _0x2837=function(_0x33683f,_0x59a2f1){_0x33683f=_0x33683f-0x0;var _0x185598=_0x8372[_0x33683f];return _0x185598;};'use strict';var moment=require(_0x2837('0x0'));var Sequelize=require('sequelize');module[_0x2837('0x1')]={'starttime':{'type':Sequelize[_0x2837('0x2')],'set':function(_0x401afe){this[_0x2837('0x3')]('starttime',_0x401afe);this[_0x2837('0x3')](_0x2837('0x4'),moment()[_0x2837('0x5')](_0x2837('0x6')));}},'endtime':{'type':Sequelize[_0x2837('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x2837('0x7')]},'queue':{'type':Sequelize[_0x2837('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2837('0x7')]},'calleridnum':{'type':Sequelize[_0x2837('0x7')]},'completed':{'type':Sequelize[_0x2837('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xf9e2=['BOOLEAN','moment','sequelize','exports','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xf9e2,0x85));var _0x2f9e=function(_0x1d2a53,_0x40c0ea){_0x1d2a53=_0x1d2a53-0x0;var _0x3a061c=_0xf9e2[_0x1d2a53];return _0x3a061c;};'use strict';var moment=require(_0x2f9e('0x0'));var Sequelize=require(_0x2f9e('0x1'));module[_0x2f9e('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0xad2a53){this[_0x2f9e('0x3')](_0x2f9e('0x4'),_0xad2a53);this['setDataValue'](_0x2f9e('0x5'),moment()[_0x2f9e('0x6')](_0x2f9e('0x7')));}},'endtime':{'type':Sequelize[_0x2f9e('0x8')]},'membername':{'type':Sequelize[_0x2f9e('0x9')]},'projectname':{'type':Sequelize[_0x2f9e('0x9')]},'queue':{'type':Sequelize[_0x2f9e('0x9')]},'uniqueid':{'type':Sequelize[_0x2f9e('0x9')]},'calleridname':{'type':Sequelize[_0x2f9e('0x9')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x2f9e('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index bf4c184..98267a2 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 _0x7cbe=['../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','Content-Range','update','status','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','filters','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','filter','merge','options','JscriptySessionReport','then','includeAll','include','catch','params','keys','length','create','body','destroy','find','describe','getQuestions','JscriptyQuestionReport','sort','pick','SessionId','count','findAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','ejs','lodash','squel','jsforce','to-csv','ioredis','../../components/parsers/advancedSearch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7cbe,0xc1));var _0xe7cb=function(_0x1829c6,_0x4d98fd){_0x1829c6=_0x1829c6-0x0;var _0x19a7a0=_0x7cbe[_0x1829c6];return _0x19a7a0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe7cb('0x0'));var rimraf=require(_0xe7cb('0x1'));var zipdir=require(_0xe7cb('0x2'));var jsonpatch=require(_0xe7cb('0x3'));var rp=require('request-promise');var moment=require(_0xe7cb('0x4'));var BPromise=require(_0xe7cb('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe7cb('0x6'));var csv=require('to-csv');var ejs=require(_0xe7cb('0x7'));var fs=require('fs');var _=require(_0xe7cb('0x8'));var squel=require(_0xe7cb('0x9'));var crypto=require('crypto');var jsforce=require(_0xe7cb('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xe7cb('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe7cb('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe7cb('0xd'));var hardwareService=require(_0xe7cb('0xe'));var logger=require('../../config/logger')(_0xe7cb('0xf'));var utils=require('../../config/utils');var config=require(_0xe7cb('0x10'));var licenseUtil=require(_0xe7cb('0x11'));var db=require(_0xe7cb('0x12'))['db'];function respondWithStatusCode(_0x52b3d0,_0xf0772){_0xf0772=_0xf0772||0xcc;return function(_0xcc7c56){if(_0xcc7c56){return _0x52b3d0[_0xe7cb('0x13')](_0xf0772);}return _0x52b3d0['status'](_0xf0772)[_0xe7cb('0x14')]();};}function respondWithResult(_0x40f07b,_0x49fd9c){_0x49fd9c=_0x49fd9c||0xc8;return function(_0x57151b){if(_0x57151b){return _0x40f07b['status'](_0x49fd9c)[_0xe7cb('0x15')](_0x57151b);}};}function respondWithFilteredResult(_0x450bfd,_0x23cdb9){return function(_0x5cffdf){if(_0x5cffdf){var _0x76c6a3=_0x5cffdf['count'],_0xd2e162=_0x23cdb9[_0xe7cb('0x16')],_0x34d6ff=_0x23cdb9[_0xe7cb('0x16')]+_0x23cdb9[_0xe7cb('0x17')],_0xf68817;if(_0x34d6ff>=_0x76c6a3){_0x34d6ff=_0x76c6a3;_0xf68817=0xc8;}else{_0xf68817=0xce;}_0x450bfd['status'](_0xf68817);return _0x450bfd['set'](_0xe7cb('0x18'),_0xd2e162+'-'+_0x34d6ff+'/'+_0x76c6a3)[_0xe7cb('0x15')](_0x5cffdf);}return null;};}function patchUpdates(_0x1d2429){return function(_0xe50fdd){try{jsonpatch['apply'](_0xe50fdd,_0x1d2429,!![]);}catch(_0x44cd08){return BPromise['reject'](_0x44cd08);}return _0xe50fdd['save']();};}function saveUpdates(_0x3479b6,_0x48548f){return function(_0x156506){if(_0x156506){return _0x156506[_0xe7cb('0x19')](_0x3479b6)['then'](function(_0x3eff56){return _0x3eff56;});}return null;};}function removeEntity(_0x45b686,_0x5240eb){return function(_0x2c3ce7){if(_0x2c3ce7){return _0x2c3ce7['destroy']()['then'](function(){_0x45b686[_0xe7cb('0x1a')](0xcc)[_0xe7cb('0x14')]();});}};}function handleEntityNotFound(_0x96a96d,_0x4a8abc){return function(_0x5679ad){if(!_0x5679ad){_0x96a96d[_0xe7cb('0x13')](0x194);}return _0x5679ad;};}function handleError(_0x2a8f11,_0x21b0a6){_0x21b0a6=_0x21b0a6||0x1f4;return function(_0x3aa8c2){logger[_0xe7cb('0x1b')](_0x3aa8c2[_0xe7cb('0x1c')]);if(_0x3aa8c2['name']){delete _0x3aa8c2[_0xe7cb('0x1d')];}_0x2a8f11[_0xe7cb('0x1a')](_0x21b0a6)['send'](_0x3aa8c2);};}exports[_0xe7cb('0x1e')]=function(_0x436231,_0xd83802){var _0x40c4a3={},_0x144e0f={},_0x34b24b={'count':0x0,'rows':[]};var _0x1f83f9=_[_0xe7cb('0x1f')](db['JscriptySessionReport'][_0xe7cb('0x20')],function(_0x4c328e){return{'name':_0x4c328e[_0xe7cb('0x21')],'type':_0x4c328e[_0xe7cb('0x22')][_0xe7cb('0x23')]};});_0x144e0f[_0xe7cb('0x24')]=_[_0xe7cb('0x1f')](_0x1f83f9,_0xe7cb('0x1d'));_0x144e0f['query']=_['keys'](_0x436231['query']);_0x144e0f[_0xe7cb('0x25')]=_['intersection'](_0x144e0f[_0xe7cb('0x24')],_0x144e0f[_0xe7cb('0x26')]);_0x40c4a3[_0xe7cb('0x27')]=_[_0xe7cb('0x28')](_0x144e0f['model'],qs[_0xe7cb('0x29')](_0x436231[_0xe7cb('0x26')][_0xe7cb('0x29')]));_0x40c4a3[_0xe7cb('0x27')]=_0x40c4a3['attributes']['length']?_0x40c4a3[_0xe7cb('0x27')]:_0x144e0f[_0xe7cb('0x24')];if(!_0x436231['query'][_0xe7cb('0x2a')](_0xe7cb('0x2b'))){_0x40c4a3[_0xe7cb('0x17')]=qs[_0xe7cb('0x17')](_0x436231[_0xe7cb('0x26')]['limit']);_0x40c4a3['offset']=qs[_0xe7cb('0x16')](_0x436231['query'][_0xe7cb('0x16')]);}_0x40c4a3[_0xe7cb('0x2c')]=qs['sort'](_0x436231[_0xe7cb('0x26')]['sort']);_0x40c4a3[_0xe7cb('0x2d')]=qs[_0xe7cb('0x25')](_['pick'](_0x436231['query'],_0x144e0f[_0xe7cb('0x25')]),_0x1f83f9);if(_0x436231[_0xe7cb('0x26')][_0xe7cb('0x2e')]){_0x40c4a3[_0xe7cb('0x2d')]=_[_0xe7cb('0x2f')](_0x40c4a3[_0xe7cb('0x2d')],{'$or':_[_0xe7cb('0x1f')](_0x1f83f9,function(_0x3b2e16){if(_0x3b2e16[_0xe7cb('0x22')]!=='VIRTUAL'){var _0x5b5bfa={};_0x5b5bfa[_0x3b2e16[_0xe7cb('0x1d')]]={'$like':'%'+_0x436231['query'][_0xe7cb('0x2e')]+'%'};return _0x5b5bfa;}})});}_0x40c4a3=_['merge']({},_0x40c4a3,_0x436231[_0xe7cb('0x30')]);var _0x209c43={'where':_0x40c4a3[_0xe7cb('0x2d')]};return db[_0xe7cb('0x31')]['count'](_0x209c43)[_0xe7cb('0x32')](function(_0xc97300){_0x34b24b['count']=_0xc97300;if(_0x436231[_0xe7cb('0x26')][_0xe7cb('0x33')]){_0x40c4a3[_0xe7cb('0x34')]=[{'all':!![]}];}return db[_0xe7cb('0x31')]['findAll'](_0x40c4a3);})[_0xe7cb('0x32')](function(_0xd788f1){_0x34b24b['rows']=_0xd788f1;return _0x34b24b;})[_0xe7cb('0x32')](respondWithFilteredResult(_0xd83802,_0x40c4a3))[_0xe7cb('0x35')](handleError(_0xd83802,null));};exports['show']=function(_0x1490d6,_0x131da9){var _0x1c9331={'raw':!![],'where':{'id':_0x1490d6[_0xe7cb('0x36')]['id']}},_0x1b44dc={};_0x1b44dc[_0xe7cb('0x24')]=_[_0xe7cb('0x37')](db['JscriptySessionReport'][_0xe7cb('0x20')]);_0x1b44dc[_0xe7cb('0x26')]=_[_0xe7cb('0x37')](_0x1490d6[_0xe7cb('0x26')]);_0x1b44dc[_0xe7cb('0x25')]=_[_0xe7cb('0x28')](_0x1b44dc[_0xe7cb('0x24')],_0x1b44dc[_0xe7cb('0x26')]);_0x1c9331[_0xe7cb('0x27')]=_['intersection'](_0x1b44dc[_0xe7cb('0x24')],qs[_0xe7cb('0x29')](_0x1490d6[_0xe7cb('0x26')]['fields']));_0x1c9331[_0xe7cb('0x27')]=_0x1c9331[_0xe7cb('0x27')][_0xe7cb('0x38')]?_0x1c9331[_0xe7cb('0x27')]:_0x1b44dc['model'];if(_0x1490d6['query']['includeAll']){_0x1c9331['include']=[{'all':!![]}];}_0x1c9331=_['merge']({},_0x1c9331,_0x1490d6[_0xe7cb('0x30')]);return db[_0xe7cb('0x31')]['find'](_0x1c9331)[_0xe7cb('0x32')](handleEntityNotFound(_0x131da9,null))[_0xe7cb('0x32')](respondWithResult(_0x131da9,null))[_0xe7cb('0x35')](handleError(_0x131da9,null));};exports[_0xe7cb('0x39')]=function(_0x24f3f6,_0x416fcf){return db[_0xe7cb('0x31')][_0xe7cb('0x39')](_0x24f3f6[_0xe7cb('0x3a')],{})['then'](respondWithResult(_0x416fcf,0xc9))[_0xe7cb('0x35')](handleError(_0x416fcf,null));};exports['update']=function(_0x1c29db,_0x377374){if(_0x1c29db['body']['id']){delete _0x1c29db[_0xe7cb('0x3a')]['id'];}return db[_0xe7cb('0x31')]['find']({'where':{'id':_0x1c29db[_0xe7cb('0x36')]['id']}})['then'](handleEntityNotFound(_0x377374,null))[_0xe7cb('0x32')](saveUpdates(_0x1c29db[_0xe7cb('0x3a')],null))['then'](respondWithResult(_0x377374,null))[_0xe7cb('0x35')](handleError(_0x377374,null));};exports[_0xe7cb('0x3b')]=function(_0x8e06a5,_0x459af1){return db[_0xe7cb('0x31')][_0xe7cb('0x3c')]({'where':{'id':_0x8e06a5[_0xe7cb('0x36')]['id']}})[_0xe7cb('0x32')](handleEntityNotFound(_0x459af1,null))[_0xe7cb('0x32')](removeEntity(_0x459af1,null))['catch'](handleError(_0x459af1,null));};exports[_0xe7cb('0x3d')]=function(_0x3d500c,_0x2cc9ed){return db[_0xe7cb('0x31')][_0xe7cb('0x3d')]()[_0xe7cb('0x32')](respondWithResult(_0x2cc9ed,null))['catch'](handleError(_0x2cc9ed,null));};exports[_0xe7cb('0x3e')]=function(_0x448016,_0x453d10,_0x2e4363){var _0x4b716b={'raw':!![],'where':{}};var _0xce654={};var _0x528704={'count':0x0,'rows':[]};return db[_0xe7cb('0x31')]['findOne']({'where':{'id':_0x448016[_0xe7cb('0x36')]['id']}})[_0xe7cb('0x32')](handleEntityNotFound(_0x453d10,null))['then'](function(_0x17c71d){if(_0x17c71d){_0xce654[_0xe7cb('0x24')]=_['keys'](db[_0xe7cb('0x3f')][_0xe7cb('0x20')]);_0xce654[_0xe7cb('0x26')]=_[_0xe7cb('0x37')](_0x448016[_0xe7cb('0x26')]);_0xce654[_0xe7cb('0x25')]=_[_0xe7cb('0x28')](_0xce654[_0xe7cb('0x24')],_0xce654['query']);_0x4b716b[_0xe7cb('0x27')]=_[_0xe7cb('0x28')](_0xce654[_0xe7cb('0x24')],qs[_0xe7cb('0x29')](_0x448016[_0xe7cb('0x26')]['fields']));_0x4b716b['attributes']=_0x4b716b[_0xe7cb('0x27')]['length']?_0x4b716b[_0xe7cb('0x27')]:_0xce654[_0xe7cb('0x24')];if(!_0x448016[_0xe7cb('0x26')][_0xe7cb('0x2a')]('nolimit')){_0x4b716b[_0xe7cb('0x17')]=qs['limit'](_0x448016['query']['limit']);_0x4b716b[_0xe7cb('0x16')]=qs[_0xe7cb('0x16')](_0x448016[_0xe7cb('0x26')][_0xe7cb('0x16')]);}_0x4b716b['order']=qs[_0xe7cb('0x40')](_0x448016[_0xe7cb('0x26')][_0xe7cb('0x40')]);_0x4b716b['where']=qs['filters'](_[_0xe7cb('0x41')](_0x448016[_0xe7cb('0x26')],_0xce654[_0xe7cb('0x25')]));_0x4b716b['where'][_0xe7cb('0x42')]=_0x17c71d['id'];if(_0x448016[_0xe7cb('0x26')][_0xe7cb('0x2e')]){_0x4b716b[_0xe7cb('0x2d')]=_[_0xe7cb('0x2f')](_0x4b716b[_0xe7cb('0x2d')],{'$or':_['map'](_0x4b716b[_0xe7cb('0x27')],function(_0x3aed23){var _0x3a4a22={};_0x3a4a22[_0x3aed23]={'$like':'%'+_0x448016[_0xe7cb('0x26')][_0xe7cb('0x2e')]+'%'};return _0x3a4a22;})});}_0x4b716b=_[_0xe7cb('0x2f')]({},_0x4b716b,_0x448016[_0xe7cb('0x30')]);return db[_0xe7cb('0x3f')][_0xe7cb('0x43')]({'where':_0x4b716b[_0xe7cb('0x2d')]})['then'](function(_0xbf63da){_0x528704['count']=_0xbf63da;if(_0x448016[_0xe7cb('0x26')]['includeAll']){_0x4b716b['include']=[{'all':!![]}];}return db[_0xe7cb('0x3f')][_0xe7cb('0x44')](_0x4b716b);})[_0xe7cb('0x32')](function(_0x2548bb){_0x528704['rows']=_0x2548bb;return _0x528704;});}})[_0xe7cb('0x32')](respondWithFilteredResult(_0x453d10,_0x4b716b))[_0xe7cb('0x35')](handleError(_0x453d10,null));}; \ No newline at end of file +var _0x43f0=['update','then','destroy','send','index','JscriptySessionReport','fieldName','key','model','map','name','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','type','VIRTUAL','filter','merge','findAll','rows','catch','show','keys','rawAttributes','includeAll','options','find','create','body','params','describe','findOne','JscriptyQuestionReport','order','SessionId','include','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','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','count','offset','Content-Range','apply','reject','save'];(function(_0x16cb03,_0x43ea58){var _0x10944e=function(_0x27ebaa){while(--_0x27ebaa){_0x16cb03['push'](_0x16cb03['shift']());}};_0x10944e(++_0x43ea58);}(_0x43f0,0x7c));var _0x043f=function(_0x1fec0d,_0x134e2d){_0x1fec0d=_0x1fec0d-0x0;var _0x4dd9ae=_0x43f0[_0x1fec0d];return _0x4dd9ae;};'use strict';var pdf=require(_0x043f('0x0'));var emlformat=require(_0x043f('0x1'));var rimraf=require(_0x043f('0x2'));var zipdir=require(_0x043f('0x3'));var jsonpatch=require(_0x043f('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x043f('0x5'));var Mustache=require('mustache');var util=require(_0x043f('0x6'));var path=require(_0x043f('0x7'));var sox=require(_0x043f('0x8'));var csv=require(_0x043f('0x9'));var ejs=require(_0x043f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x043f('0xb'));var crypto=require(_0x043f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x043f('0x9'));var querystring=require('querystring');var Papa=require(_0x043f('0xd'));var Redis=require(_0x043f('0xe'));var authService=require(_0x043f('0xf'));var qs=require(_0x043f('0x10'));var as=require(_0x043f('0x11'));var hardwareService=require(_0x043f('0x12'));var logger=require(_0x043f('0x13'))(_0x043f('0x14'));var utils=require(_0x043f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x043f('0x16'));var db=require(_0x043f('0x17'))['db'];function respondWithStatusCode(_0xf1f53c,_0x4caf07){_0x4caf07=_0x4caf07||0xcc;return function(_0x14a9e7){if(_0x14a9e7){return _0xf1f53c[_0x043f('0x18')](_0x4caf07);}return _0xf1f53c[_0x043f('0x19')](_0x4caf07)[_0x043f('0x1a')]();};}function respondWithResult(_0x10143a,_0x34d4d7){_0x34d4d7=_0x34d4d7||0xc8;return function(_0x35a052){if(_0x35a052){return _0x10143a['status'](_0x34d4d7)[_0x043f('0x1b')](_0x35a052);}};}function respondWithFilteredResult(_0x4042af,_0x208b35){return function(_0x4ef295){if(_0x4ef295){var _0x1ed13f=_0x4ef295[_0x043f('0x1c')],_0x5cb6da=_0x208b35[_0x043f('0x1d')],_0x2e1e16=_0x208b35[_0x043f('0x1d')]+_0x208b35['limit'],_0x155cfa;if(_0x2e1e16>=_0x1ed13f){_0x2e1e16=_0x1ed13f;_0x155cfa=0xc8;}else{_0x155cfa=0xce;}_0x4042af['status'](_0x155cfa);return _0x4042af['set'](_0x043f('0x1e'),_0x5cb6da+'-'+_0x2e1e16+'/'+_0x1ed13f)[_0x043f('0x1b')](_0x4ef295);}return null;};}function patchUpdates(_0xd08d50){return function(_0x2e7082){try{jsonpatch[_0x043f('0x1f')](_0x2e7082,_0xd08d50,!![]);}catch(_0x5db8f1){return BPromise[_0x043f('0x20')](_0x5db8f1);}return _0x2e7082[_0x043f('0x21')]();};}function saveUpdates(_0x118da4,_0x51eb0f){return function(_0x225db0){if(_0x225db0){return _0x225db0[_0x043f('0x22')](_0x118da4)[_0x043f('0x23')](function(_0x5b4197){return _0x5b4197;});}return null;};}function removeEntity(_0x4560c3,_0x48cd02){return function(_0xb1955){if(_0xb1955){return _0xb1955[_0x043f('0x24')]()['then'](function(){_0x4560c3['status'](0xcc)[_0x043f('0x1a')]();});}};}function handleEntityNotFound(_0x5764c2,_0x313dfe){return function(_0x3787a6){if(!_0x3787a6){_0x5764c2['sendStatus'](0x194);}return _0x3787a6;};}function handleError(_0x300016,_0x237226){_0x237226=_0x237226||0x1f4;return function(_0x516aac){logger['error'](_0x516aac['stack']);if(_0x516aac['name']){delete _0x516aac['name'];}_0x300016[_0x043f('0x19')](_0x237226)[_0x043f('0x25')](_0x516aac);};}exports[_0x043f('0x26')]=function(_0x655f48,_0x5b659d){var _0x2aeee3={},_0x18df95={},_0x21a12e={'count':0x0,'rows':[]};var _0x47b152=_['map'](db[_0x043f('0x27')]['rawAttributes'],function(_0x17c63d){return{'name':_0x17c63d[_0x043f('0x28')],'type':_0x17c63d['type'][_0x043f('0x29')]};});_0x18df95[_0x043f('0x2a')]=_[_0x043f('0x2b')](_0x47b152,_0x043f('0x2c'));_0x18df95['query']=_['keys'](_0x655f48['query']);_0x18df95[_0x043f('0x2d')]=_[_0x043f('0x2e')](_0x18df95[_0x043f('0x2a')],_0x18df95[_0x043f('0x2f')]);_0x2aeee3[_0x043f('0x30')]=_['intersection'](_0x18df95[_0x043f('0x2a')],qs[_0x043f('0x31')](_0x655f48[_0x043f('0x2f')][_0x043f('0x31')]));_0x2aeee3['attributes']=_0x2aeee3['attributes'][_0x043f('0x32')]?_0x2aeee3[_0x043f('0x30')]:_0x18df95[_0x043f('0x2a')];if(!_0x655f48[_0x043f('0x2f')][_0x043f('0x33')](_0x043f('0x34'))){_0x2aeee3['limit']=qs[_0x043f('0x35')](_0x655f48[_0x043f('0x2f')][_0x043f('0x35')]);_0x2aeee3[_0x043f('0x1d')]=qs[_0x043f('0x1d')](_0x655f48['query'][_0x043f('0x1d')]);}_0x2aeee3['order']=qs[_0x043f('0x36')](_0x655f48[_0x043f('0x2f')][_0x043f('0x36')]);_0x2aeee3[_0x043f('0x37')]=qs[_0x043f('0x2d')](_[_0x043f('0x38')](_0x655f48[_0x043f('0x2f')],_0x18df95[_0x043f('0x2d')]),_0x47b152);if(_0x655f48['query']['filter']){_0x2aeee3[_0x043f('0x37')]=_['merge'](_0x2aeee3[_0x043f('0x37')],{'$or':_[_0x043f('0x2b')](_0x47b152,function(_0x4ff459){if(_0x4ff459[_0x043f('0x39')]!==_0x043f('0x3a')){var _0x1278cd={};_0x1278cd[_0x4ff459['name']]={'$like':'%'+_0x655f48[_0x043f('0x2f')][_0x043f('0x3b')]+'%'};return _0x1278cd;}})});}_0x2aeee3=_[_0x043f('0x3c')]({},_0x2aeee3,_0x655f48['options']);var _0x273bb3={'where':_0x2aeee3[_0x043f('0x37')]};return db['JscriptySessionReport']['count'](_0x273bb3)[_0x043f('0x23')](function(_0x22e566){_0x21a12e[_0x043f('0x1c')]=_0x22e566;if(_0x655f48[_0x043f('0x2f')]['includeAll']){_0x2aeee3['include']=[{'all':!![]}];}return db[_0x043f('0x27')][_0x043f('0x3d')](_0x2aeee3);})[_0x043f('0x23')](function(_0x3c35a5){_0x21a12e[_0x043f('0x3e')]=_0x3c35a5;return _0x21a12e;})[_0x043f('0x23')](respondWithFilteredResult(_0x5b659d,_0x2aeee3))[_0x043f('0x3f')](handleError(_0x5b659d,null));};exports[_0x043f('0x40')]=function(_0x4a1d3e,_0x1127d2){var _0x349483={'raw':!![],'where':{'id':_0x4a1d3e['params']['id']}},_0x5e6e5e={};_0x5e6e5e[_0x043f('0x2a')]=_[_0x043f('0x41')](db['JscriptySessionReport'][_0x043f('0x42')]);_0x5e6e5e['query']=_['keys'](_0x4a1d3e[_0x043f('0x2f')]);_0x5e6e5e['filters']=_[_0x043f('0x2e')](_0x5e6e5e[_0x043f('0x2a')],_0x5e6e5e[_0x043f('0x2f')]);_0x349483[_0x043f('0x30')]=_[_0x043f('0x2e')](_0x5e6e5e[_0x043f('0x2a')],qs[_0x043f('0x31')](_0x4a1d3e['query']['fields']));_0x349483[_0x043f('0x30')]=_0x349483[_0x043f('0x30')][_0x043f('0x32')]?_0x349483[_0x043f('0x30')]:_0x5e6e5e['model'];if(_0x4a1d3e['query'][_0x043f('0x43')]){_0x349483['include']=[{'all':!![]}];}_0x349483=_[_0x043f('0x3c')]({},_0x349483,_0x4a1d3e[_0x043f('0x44')]);return db[_0x043f('0x27')][_0x043f('0x45')](_0x349483)[_0x043f('0x23')](handleEntityNotFound(_0x1127d2,null))['then'](respondWithResult(_0x1127d2,null))[_0x043f('0x3f')](handleError(_0x1127d2,null));};exports['create']=function(_0x1002cb,_0x51e6d3){return db['JscriptySessionReport'][_0x043f('0x46')](_0x1002cb['body'],{})[_0x043f('0x23')](respondWithResult(_0x51e6d3,0xc9))['catch'](handleError(_0x51e6d3,null));};exports[_0x043f('0x22')]=function(_0x293f00,_0x29f877){if(_0x293f00['body']['id']){delete _0x293f00[_0x043f('0x47')]['id'];}return db[_0x043f('0x27')][_0x043f('0x45')]({'where':{'id':_0x293f00['params']['id']}})[_0x043f('0x23')](handleEntityNotFound(_0x29f877,null))[_0x043f('0x23')](saveUpdates(_0x293f00['body'],null))[_0x043f('0x23')](respondWithResult(_0x29f877,null))[_0x043f('0x3f')](handleError(_0x29f877,null));};exports[_0x043f('0x24')]=function(_0xc782d1,_0x4e4020){return db[_0x043f('0x27')]['find']({'where':{'id':_0xc782d1[_0x043f('0x48')]['id']}})[_0x043f('0x23')](handleEntityNotFound(_0x4e4020,null))[_0x043f('0x23')](removeEntity(_0x4e4020,null))[_0x043f('0x3f')](handleError(_0x4e4020,null));};exports[_0x043f('0x49')]=function(_0x41df48,_0x31a582){return db[_0x043f('0x27')]['describe']()[_0x043f('0x23')](respondWithResult(_0x31a582,null))[_0x043f('0x3f')](handleError(_0x31a582,null));};exports['getQuestions']=function(_0x47a5da,_0x93f0c4,_0x345bbf){var _0x113517={'raw':!![],'where':{}};var _0x4f8943={};var _0x15b284={'count':0x0,'rows':[]};return db[_0x043f('0x27')][_0x043f('0x4a')]({'where':{'id':_0x47a5da[_0x043f('0x48')]['id']}})['then'](handleEntityNotFound(_0x93f0c4,null))[_0x043f('0x23')](function(_0x3b7f52){if(_0x3b7f52){_0x4f8943[_0x043f('0x2a')]=_[_0x043f('0x41')](db[_0x043f('0x4b')][_0x043f('0x42')]);_0x4f8943[_0x043f('0x2f')]=_[_0x043f('0x41')](_0x47a5da[_0x043f('0x2f')]);_0x4f8943[_0x043f('0x2d')]=_[_0x043f('0x2e')](_0x4f8943['model'],_0x4f8943['query']);_0x113517[_0x043f('0x30')]=_['intersection'](_0x4f8943['model'],qs[_0x043f('0x31')](_0x47a5da[_0x043f('0x2f')][_0x043f('0x31')]));_0x113517[_0x043f('0x30')]=_0x113517[_0x043f('0x30')]['length']?_0x113517[_0x043f('0x30')]:_0x4f8943[_0x043f('0x2a')];if(!_0x47a5da[_0x043f('0x2f')][_0x043f('0x33')](_0x043f('0x34'))){_0x113517['limit']=qs[_0x043f('0x35')](_0x47a5da[_0x043f('0x2f')][_0x043f('0x35')]);_0x113517['offset']=qs[_0x043f('0x1d')](_0x47a5da['query']['offset']);}_0x113517[_0x043f('0x4c')]=qs[_0x043f('0x36')](_0x47a5da[_0x043f('0x2f')][_0x043f('0x36')]);_0x113517[_0x043f('0x37')]=qs['filters'](_[_0x043f('0x38')](_0x47a5da[_0x043f('0x2f')],_0x4f8943[_0x043f('0x2d')]));_0x113517[_0x043f('0x37')][_0x043f('0x4d')]=_0x3b7f52['id'];if(_0x47a5da[_0x043f('0x2f')]['filter']){_0x113517[_0x043f('0x37')]=_[_0x043f('0x3c')](_0x113517[_0x043f('0x37')],{'$or':_[_0x043f('0x2b')](_0x113517[_0x043f('0x30')],function(_0x5d180c){var _0x52014a={};_0x52014a[_0x5d180c]={'$like':'%'+_0x47a5da[_0x043f('0x2f')][_0x043f('0x3b')]+'%'};return _0x52014a;})});}_0x113517=_[_0x043f('0x3c')]({},_0x113517,_0x47a5da[_0x043f('0x44')]);return db[_0x043f('0x4b')][_0x043f('0x1c')]({'where':_0x113517[_0x043f('0x37')]})['then'](function(_0x3fcc15){_0x15b284[_0x043f('0x1c')]=_0x3fcc15;if(_0x47a5da[_0x043f('0x2f')][_0x043f('0x43')]){_0x113517[_0x043f('0x4e')]=[{'all':!![]}];}return db[_0x043f('0x4b')][_0x043f('0x3d')](_0x113517);})['then'](function(_0x52ed67){_0x15b284[_0x043f('0x3e')]=_0x52ed67;return _0x15b284;});}})[_0x043f('0x23')](respondWithFilteredResult(_0x93f0c4,_0x113517))[_0x043f('0x3f')](handleError(_0x93f0c4,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 285bb28..aed0ddf 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 _0xd4c2=['api','moment','bluebird','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash','util'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xd4c2,0x1d4));var _0x2d4c=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xd4c2[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x2d4c('0x0'));var util=require(_0x2d4c('0x1'));var logger=require('../../config/logger')(_0x2d4c('0x2'));var moment=require(_0x2d4c('0x3'));var BPromise=require(_0x2d4c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2d4c('0x5'));var attributes=require(_0x2d4c('0x6'));module[_0x2d4c('0x7')]=function(_0x449df7,_0x12dff7){return _0x449df7[_0x2d4c('0x8')](_0x2d4c('0x9'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5447=['report_jscripty_sessions','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x1286f6,_0x2a6ced){var _0x2f354d=function(_0x196f11){while(--_0x196f11){_0x1286f6['push'](_0x1286f6['shift']());}};_0x2f354d(++_0x2a6ced);}(_0x5447,0xf1));var _0x7544=function(_0x5f0729,_0x34256f){_0x5f0729=_0x5f0729-0x0;var _0x2105a2=_0x5447[_0x5f0729];return _0x2105a2;};'use strict';var _=require(_0x7544('0x0'));var util=require('util');var logger=require(_0x7544('0x1'))(_0x7544('0x2'));var moment=require('moment');var BPromise=require(_0x7544('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7544('0x4'));var rimraf=require(_0x7544('0x5'));var config=require(_0x7544('0x6'));var attributes=require(_0x7544('0x7'));module[_0x7544('0x8')]=function(_0x7e80,_0x3feef7){return _0x7e80[_0x7544('0x9')](_0x7544('0xa'),attributes,{'tableName':_0x7544('0xb'),'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 5fc5e43..69b6dc0 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 _0x125a=['JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x125a,0x1e7));var _0xa125=function(_0x287a47,_0x2f731c){_0x287a47=_0x287a47-0x0;var _0x3fb726=_0x125a[_0x287a47];return _0x3fb726;};'use strict';var _=require(_0xa125('0x0'));var util=require(_0xa125('0x1'));var moment=require(_0xa125('0x2'));var BPromise=require(_0xa125('0x3'));var rs=require(_0xa125('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa125('0x5'))['db'];var utils=require(_0xa125('0x6'));var logger=require(_0xa125('0x7'))(_0xa125('0x8'));var config=require(_0xa125('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa125('0xa')][_0xa125('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48b190,_0x1f65a1,_0x232ee9){return new BPromise(function(_0x5ac24c,_0x1eace2){return client[_0xa125('0xc')](_0x48b190,_0x232ee9)[_0xa125('0xd')](function(_0x5720b9){logger[_0xa125('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x1f65a1,_0xa125('0xf'));logger[_0xa125('0x10')](_0xa125('0x11'),_0x1f65a1,_0xa125('0xf'),JSON[_0xa125('0x12')](_0x5720b9));if(_0x5720b9[_0xa125('0x13')]){if(_0x5720b9['error'][_0xa125('0x14')]===0x1f4){logger[_0xa125('0x13')](_0xa125('0x15'),_0x1f65a1,_0x5720b9['error'][_0xa125('0x16')]);return _0x1eace2(_0x5720b9['error'][_0xa125('0x16')]);}logger['error'](_0xa125('0x15'),_0x1f65a1,_0x5720b9[_0xa125('0x13')]['message']);return _0x5ac24c(_0x5720b9[_0xa125('0x13')][_0xa125('0x16')]);}else{logger[_0xa125('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x1f65a1,_0xa125('0xf'));_0x5ac24c(_0x5720b9[_0xa125('0x17')][_0xa125('0x16')]);}})['catch'](function(_0x5b78e3){logger[_0xa125('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x1f65a1,_0x5b78e3);_0x1eace2(_0x5b78e3);});});} \ No newline at end of file +var _0xe7b2=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','util','moment','bluebird','ioredis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe7b2,0x1ca));var _0x2e7b=function(_0x20e46a,_0x2ccd30){_0x20e46a=_0x20e46a-0x0;var _0x540597=_0xe7b2[_0x20e46a];return _0x540597;};'use strict';var _=require('lodash');var util=require(_0x2e7b('0x0'));var moment=require(_0x2e7b('0x1'));var BPromise=require(_0x2e7b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e7b('0x3'));var db=require(_0x2e7b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e7b('0x5'))(_0x2e7b('0x6'));var config=require(_0x2e7b('0x7'));var jayson=require(_0x2e7b('0x8'));var client=jayson[_0x2e7b('0x9')][_0x2e7b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2eacab,_0x40083e,_0x2ebcf6){return new BPromise(function(_0x802692,_0x153fdb){return client[_0x2e7b('0xb')](_0x2eacab,_0x2ebcf6)[_0x2e7b('0xc')](function(_0x1daa2b){logger[_0x2e7b('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x40083e,_0x2e7b('0xe'));logger[_0x2e7b('0xf')](_0x2e7b('0x10'),_0x40083e,_0x2e7b('0xe'),JSON[_0x2e7b('0x11')](_0x1daa2b));if(_0x1daa2b[_0x2e7b('0x12')]){if(_0x1daa2b['error'][_0x2e7b('0x13')]===0x1f4){logger[_0x2e7b('0x12')](_0x2e7b('0x14'),_0x40083e,_0x1daa2b['error']['message']);return _0x153fdb(_0x1daa2b[_0x2e7b('0x12')]['message']);}logger[_0x2e7b('0x12')](_0x2e7b('0x14'),_0x40083e,_0x1daa2b[_0x2e7b('0x12')][_0x2e7b('0x15')]);return _0x802692(_0x1daa2b['error']['message']);}else{logger[_0x2e7b('0xd')](_0x2e7b('0x14'),_0x40083e,'request\x20sent');_0x802692(_0x1daa2b['result']['message']);}})['catch'](function(_0x1fadbc){logger[_0x2e7b('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x40083e,_0x1fadbc);_0x153fdb(_0x1fadbc);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 51e8ad5..8d23f6e 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 _0x3174=['isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./license.controller','index','put','/:id'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0x3174,0x13e));var _0x4317=function(_0x1ac49d,_0x5a2e76){_0x1ac49d=_0x1ac49d-0x0;var _0x2ede41=_0x3174[_0x1ac49d];return _0x2ede41;};'use strict';var multer=require(_0x4317('0x0'));var util=require(_0x4317('0x1'));var path=require(_0x4317('0x2'));var timeout=require(_0x4317('0x3'));var express=require(_0x4317('0x4'));var router=express[_0x4317('0x5')]();var auth=require(_0x4317('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4317('0x7'));var controller=require(_0x4317('0x8'));router['get']('/',controller[_0x4317('0x9')]);router[_0x4317('0xa')](_0x4317('0xb'),auth[_0x4317('0xc')](),controller[_0x4317('0xd')]);module[_0x4317('0xe')]=router; \ No newline at end of file +var _0x8f77=['index','put','/:id','isAuthenticated','update','exports','multer','path','Router','../../components/interaction/service','../../config/environment','./license.controller','get'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x8f77,0x1b3));var _0x78f7=function(_0x409d15,_0x5503da){_0x409d15=_0x409d15-0x0;var _0x4e57a1=_0x8f77[_0x409d15];return _0x4e57a1;};'use strict';var multer=require(_0x78f7('0x0'));var util=require('util');var path=require(_0x78f7('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x78f7('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x78f7('0x3'));var config=require(_0x78f7('0x4'));var controller=require(_0x78f7('0x5'));router[_0x78f7('0x6')]('/',controller[_0x78f7('0x7')]);router[_0x78f7('0x8')](_0x78f7('0x9'),auth[_0x78f7('0xa')](),controller[_0x78f7('0xb')]);module[_0x78f7('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 1c6e6c6..0b716e2 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 _0x53ec=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x2d63d4,_0x1c13cc){var _0xa0b250=function(_0x29b36c){while(--_0x29b36c){_0x2d63d4['push'](_0x2d63d4['shift']());}};_0xa0b250(++_0x1c13cc);}(_0x53ec,0x192));var _0xc53e=function(_0x4695e2,_0x3d5f15){_0x4695e2=_0x4695e2-0x0;var _0x160563=_0x53ec[_0x4695e2];return _0x160563;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'license':{'type':Sequelize[_0xc53e('0x2')]},'data1':{'type':Sequelize[_0xc53e('0x3')]},'data2':{'type':Sequelize[_0xc53e('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xc53e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdc97=['exports','TEXT','STRING','sequelize'];(function(_0xfe4136,_0x39f69e){var _0x540bd6=function(_0x14738a){while(--_0x14738a){_0xfe4136['push'](_0xfe4136['shift']());}};_0x540bd6(++_0x39f69e);}(_0xdc97,0x13b));var _0x7dc9=function(_0x23ff9e,_0x3fab93){_0x23ff9e=_0x23ff9e-0x0;var _0x1b140a=_0xdc97[_0x23ff9e];return _0x1b140a;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'license':{'type':Sequelize[_0x7dc9('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x7dc9('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 248a3b0..664b385 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 _0xdbd0=['model','License','keys','query','filters','intersection','attributes','fields','length','merge','getLicense','catch','body','params','get','checkLicense','key','demo','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','index'];(function(_0x3ceb73,_0x4829e5){var _0xf8ff4f=function(_0x1c6659){while(--_0x1c6659){_0x3ceb73['push'](_0x3ceb73['shift']());}};_0xf8ff4f(++_0x4829e5);}(_0xdbd0,0x88));var _0x0dbd=function(_0x1fb745,_0x12fa58){_0x1fb745=_0x1fb745-0x0;var _0x184d25=_0xdbd0[_0x1fb745];return _0x184d25;};'use strict';var pdf=require(_0x0dbd('0x0'));var emlformat=require(_0x0dbd('0x1'));var rimraf=require(_0x0dbd('0x2'));var zipdir=require(_0x0dbd('0x3'));var jsonpatch=require(_0x0dbd('0x4'));var rp=require('request-promise');var moment=require(_0x0dbd('0x5'));var BPromise=require(_0x0dbd('0x6'));var Mustache=require(_0x0dbd('0x7'));var util=require('util');var path=require(_0x0dbd('0x8'));var sox=require(_0x0dbd('0x9'));var csv=require(_0x0dbd('0xa'));var ejs=require(_0x0dbd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0dbd('0xc'));var jsforce=require(_0x0dbd('0xd'));var deskjs=require(_0x0dbd('0xe'));var toCsv=require(_0x0dbd('0xa'));var querystring=require(_0x0dbd('0xf'));var Papa=require(_0x0dbd('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0dbd('0x11'));var as=require(_0x0dbd('0x12'));var hardwareService=require(_0x0dbd('0x13'));var logger=require(_0x0dbd('0x14'))(_0x0dbd('0x15'));var utils=require(_0x0dbd('0x16'));var config=require(_0x0dbd('0x17'));var licenseUtil=require(_0x0dbd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c12f3,_0x6b2b5){_0x6b2b5=_0x6b2b5||0xcc;return function(_0xbeeb88){if(_0xbeeb88){return _0x1c12f3['sendStatus'](_0x6b2b5);}return _0x1c12f3[_0x0dbd('0x19')](_0x6b2b5)[_0x0dbd('0x1a')]();};}function respondWithResult(_0x1a45d0,_0x903a5){_0x903a5=_0x903a5||0xc8;return function(_0x19192d){if(_0x19192d){return _0x1a45d0[_0x0dbd('0x19')](_0x903a5)[_0x0dbd('0x1b')](_0x19192d);}};}function respondWithFilteredResult(_0xce4a93,_0x1b9134){return function(_0x513a76){if(_0x513a76){var _0x5714f8=_0x513a76[_0x0dbd('0x1c')],_0x844503=_0x1b9134[_0x0dbd('0x1d')],_0xe8ca22=_0x1b9134['offset']+_0x1b9134['limit'],_0x5b2a34;if(_0xe8ca22>=_0x5714f8){_0xe8ca22=_0x5714f8;_0x5b2a34=0xc8;}else{_0x5b2a34=0xce;}_0xce4a93[_0x0dbd('0x19')](_0x5b2a34);return _0xce4a93[_0x0dbd('0x1e')](_0x0dbd('0x1f'),_0x844503+'-'+_0xe8ca22+'/'+_0x5714f8)['json'](_0x513a76);}return null;};}function patchUpdates(_0x134055){return function(_0x2a26dd){try{jsonpatch['apply'](_0x2a26dd,_0x134055,!![]);}catch(_0x48ef90){return BPromise[_0x0dbd('0x20')](_0x48ef90);}return _0x2a26dd[_0x0dbd('0x21')]();};}function saveUpdates(_0x3b9fc6,_0x50866a){return function(_0x4a0193){if(_0x4a0193){return _0x4a0193[_0x0dbd('0x22')](_0x3b9fc6)[_0x0dbd('0x23')](function(_0x4e5f3e){return _0x4e5f3e;});}return null;};}function removeEntity(_0x5bea28,_0x3d821a){return function(_0x425ceb){if(_0x425ceb){return _0x425ceb['destroy']()[_0x0dbd('0x23')](function(){_0x5bea28[_0x0dbd('0x19')](0xcc)[_0x0dbd('0x1a')]();});}};}function handleEntityNotFound(_0x524a84,_0x16a21c){return function(_0x1bbefb){if(!_0x1bbefb){_0x524a84['sendStatus'](0x194);}return _0x1bbefb;};}function handleError(_0x328eba,_0x380ff0){_0x380ff0=_0x380ff0||0x1f4;return function(_0x563185){logger[_0x0dbd('0x24')](_0x563185[_0x0dbd('0x25')]);if(_0x563185['name']){delete _0x563185[_0x0dbd('0x26')];}_0x328eba[_0x0dbd('0x19')](_0x380ff0)[_0x0dbd('0x27')](_0x563185);};}var utilLicense=require(_0x0dbd('0x18'));exports[_0x0dbd('0x28')]=function(_0x464d99,_0x4938d9){var _0x5dd8cd={'raw':!![],'where':{'id':0x1}},_0x47dce1={};_0x47dce1[_0x0dbd('0x29')]=_['keys'](db[_0x0dbd('0x2a')]['rawAttributes']);_0x47dce1['query']=_[_0x0dbd('0x2b')](_0x464d99[_0x0dbd('0x2c')]);_0x47dce1[_0x0dbd('0x2d')]=_[_0x0dbd('0x2e')](_0x47dce1['model'],_0x47dce1[_0x0dbd('0x2c')]);_0x5dd8cd[_0x0dbd('0x2f')]=_[_0x0dbd('0x2e')](_0x47dce1['model'],qs[_0x0dbd('0x30')](_0x464d99[_0x0dbd('0x2c')][_0x0dbd('0x30')]));_0x5dd8cd[_0x0dbd('0x2f')]=_0x5dd8cd['attributes'][_0x0dbd('0x31')]?_0x5dd8cd[_0x0dbd('0x2f')]:_0x47dce1[_0x0dbd('0x29')];_0x5dd8cd=_[_0x0dbd('0x32')]({},_0x5dd8cd,_0x464d99['options']);return utilLicense[_0x0dbd('0x33')](_0x5dd8cd)[_0x0dbd('0x23')](respondWithResult(_0x4938d9,null))[_0x0dbd('0x34')](handleError(_0x4938d9,null));};exports['update']=function(_0x4302e1,_0x2bdd87){if(_0x4302e1[_0x0dbd('0x35')]['id']){delete _0x4302e1['body']['id'];}return db[_0x0dbd('0x2a')]['find']({'where':{'id':_0x4302e1[_0x0dbd('0x36')]['id']}})['then'](handleEntityNotFound(_0x2bdd87,null))['then'](function(_0x4da660){var _0x5a5f09=_0x4da660[_0x0dbd('0x37')]({'plain':!![]});return utilLicense[_0x0dbd('0x38')](_0x5a5f09,_0x4302e1['body'][_0x0dbd('0x39')]);})[_0x0dbd('0x23')](function(_0x5452f0){if(!_0x5452f0[_0x0dbd('0x3a')]){return saveUpdates(_0x4302e1[_0x0dbd('0x35')],null);}return _0x5452f0;})[_0x0dbd('0x23')](respondWithResult(_0x2bdd87,null))['catch'](handleError(_0x2bdd87,null));}; \ No newline at end of file +var _0xf987=['send','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','merge','options','getLicense','catch','body','find','params','checkLicense','key','demo','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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x2dd390,_0x1bc894){var _0x3afe47=function(_0x42d8d3){while(--_0x42d8d3){_0x2dd390['push'](_0x2dd390['shift']());}};_0x3afe47(++_0x1bc894);}(_0xf987,0x18a));var _0x7f98=function(_0x31cca3,_0x241f96){_0x31cca3=_0x31cca3-0x0;var _0x76b5df=_0xf987[_0x31cca3];return _0x76b5df;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7f98('0x0'));var zipdir=require(_0x7f98('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7f98('0x2'));var moment=require(_0x7f98('0x3'));var BPromise=require(_0x7f98('0x4'));var Mustache=require(_0x7f98('0x5'));var util=require(_0x7f98('0x6'));var path=require(_0x7f98('0x7'));var sox=require(_0x7f98('0x8'));var csv=require(_0x7f98('0x9'));var ejs=require(_0x7f98('0xa'));var fs=require('fs');var _=require(_0x7f98('0xb'));var squel=require(_0x7f98('0xc'));var crypto=require(_0x7f98('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7f98('0xe'));var toCsv=require(_0x7f98('0x9'));var querystring=require(_0x7f98('0xf'));var Papa=require(_0x7f98('0x10'));var Redis=require(_0x7f98('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7f98('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f98('0x13'))(_0x7f98('0x14'));var utils=require(_0x7f98('0x15'));var config=require(_0x7f98('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7f98('0x17'))['db'];function respondWithStatusCode(_0x4c4ae9,_0x9c2633){_0x9c2633=_0x9c2633||0xcc;return function(_0x2c26d8){if(_0x2c26d8){return _0x4c4ae9[_0x7f98('0x18')](_0x9c2633);}return _0x4c4ae9[_0x7f98('0x19')](_0x9c2633)[_0x7f98('0x1a')]();};}function respondWithResult(_0x11b1f8,_0x33108e){_0x33108e=_0x33108e||0xc8;return function(_0x3044d4){if(_0x3044d4){return _0x11b1f8[_0x7f98('0x19')](_0x33108e)[_0x7f98('0x1b')](_0x3044d4);}};}function respondWithFilteredResult(_0x2d366a,_0x1fa829){return function(_0x5e3bb5){if(_0x5e3bb5){var _0xcab406=_0x5e3bb5[_0x7f98('0x1c')],_0x4de314=_0x1fa829['offset'],_0x487dc0=_0x1fa829['offset']+_0x1fa829['limit'],_0x3ac563;if(_0x487dc0>=_0xcab406){_0x487dc0=_0xcab406;_0x3ac563=0xc8;}else{_0x3ac563=0xce;}_0x2d366a['status'](_0x3ac563);return _0x2d366a[_0x7f98('0x1d')](_0x7f98('0x1e'),_0x4de314+'-'+_0x487dc0+'/'+_0xcab406)['json'](_0x5e3bb5);}return null;};}function patchUpdates(_0x533983){return function(_0x4f3ac0){try{jsonpatch[_0x7f98('0x1f')](_0x4f3ac0,_0x533983,!![]);}catch(_0x5e45a2){return BPromise[_0x7f98('0x20')](_0x5e45a2);}return _0x4f3ac0[_0x7f98('0x21')]();};}function saveUpdates(_0x3e78e2,_0x446dd5){return function(_0x2dc650){if(_0x2dc650){return _0x2dc650[_0x7f98('0x22')](_0x3e78e2)[_0x7f98('0x23')](function(_0xc3b46f){return _0xc3b46f;});}return null;};}function removeEntity(_0x20ad36,_0x53c1ef){return function(_0x55189b){if(_0x55189b){return _0x55189b[_0x7f98('0x24')]()['then'](function(){_0x20ad36[_0x7f98('0x19')](0xcc)[_0x7f98('0x1a')]();});}};}function handleEntityNotFound(_0x51eca3,_0x417ad4){return function(_0xe03ec4){if(!_0xe03ec4){_0x51eca3['sendStatus'](0x194);}return _0xe03ec4;};}function handleError(_0x37c56d,_0x32bc48){_0x32bc48=_0x32bc48||0x1f4;return function(_0x1d6bdb){logger[_0x7f98('0x25')](_0x1d6bdb[_0x7f98('0x26')]);if(_0x1d6bdb[_0x7f98('0x27')]){delete _0x1d6bdb[_0x7f98('0x27')];}_0x37c56d[_0x7f98('0x19')](_0x32bc48)[_0x7f98('0x28')](_0x1d6bdb);};}var utilLicense=require(_0x7f98('0x29'));exports[_0x7f98('0x2a')]=function(_0x4c37a4,_0x312c64){var _0x51cf96={'raw':!![],'where':{'id':0x1}},_0x4c9809={};_0x4c9809[_0x7f98('0x2b')]=_[_0x7f98('0x2c')](db[_0x7f98('0x2d')][_0x7f98('0x2e')]);_0x4c9809[_0x7f98('0x2f')]=_[_0x7f98('0x2c')](_0x4c37a4[_0x7f98('0x2f')]);_0x4c9809[_0x7f98('0x30')]=_[_0x7f98('0x31')](_0x4c9809[_0x7f98('0x2b')],_0x4c9809['query']);_0x51cf96[_0x7f98('0x32')]=_[_0x7f98('0x31')](_0x4c9809['model'],qs[_0x7f98('0x33')](_0x4c37a4[_0x7f98('0x2f')][_0x7f98('0x33')]));_0x51cf96['attributes']=_0x51cf96[_0x7f98('0x32')]['length']?_0x51cf96[_0x7f98('0x32')]:_0x4c9809['model'];_0x51cf96=_[_0x7f98('0x34')]({},_0x51cf96,_0x4c37a4[_0x7f98('0x35')]);return utilLicense[_0x7f98('0x36')](_0x51cf96)[_0x7f98('0x23')](respondWithResult(_0x312c64,null))[_0x7f98('0x37')](handleError(_0x312c64,null));};exports[_0x7f98('0x22')]=function(_0x282d11,_0x481e59){if(_0x282d11['body']['id']){delete _0x282d11[_0x7f98('0x38')]['id'];}return db[_0x7f98('0x2d')][_0x7f98('0x39')]({'where':{'id':_0x282d11[_0x7f98('0x3a')]['id']}})[_0x7f98('0x23')](handleEntityNotFound(_0x481e59,null))[_0x7f98('0x23')](function(_0x37bf4b){var _0x51a15d=_0x37bf4b['get']({'plain':!![]});return utilLicense[_0x7f98('0x3b')](_0x51a15d,_0x282d11['body'][_0x7f98('0x3c')]);})['then'](function(_0x376dd3){if(!_0x376dd3[_0x7f98('0x3d')]){return saveUpdates(_0x282d11[_0x7f98('0x38')],null);}return _0x376dd3;})[_0x7f98('0x23')](respondWithResult(_0x481e59,null))[_0x7f98('0x37')](handleError(_0x481e59,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 2ec811c..443d70b 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 _0x28e0=['request-promise','path','rimraf','../../config/environment','./license.attributes','define','License','license','lodash','util','../../config/logger','api','moment'];(function(_0x468714,_0x4b342e){var _0x1db862=function(_0x3accb0){while(--_0x3accb0){_0x468714['push'](_0x468714['shift']());}};_0x1db862(++_0x4b342e);}(_0x28e0,0x126));var _0x028e=function(_0x3dcb1e,_0x37d276){_0x3dcb1e=_0x3dcb1e-0x0;var _0x4f7432=_0x28e0[_0x3dcb1e];return _0x4f7432;};'use strict';var _=require(_0x028e('0x0'));var util=require(_0x028e('0x1'));var logger=require(_0x028e('0x2'))(_0x028e('0x3'));var moment=require(_0x028e('0x4'));var BPromise=require('bluebird');var rp=require(_0x028e('0x5'));var fs=require('fs');var path=require(_0x028e('0x6'));var rimraf=require(_0x028e('0x7'));var config=require(_0x028e('0x8'));var attributes=require(_0x028e('0x9'));module['exports']=function(_0x244880,_0x1c8003){return _0x244880[_0x028e('0xa')](_0x028e('0xb'),attributes,{'tableName':_0x028e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f83=['define','License','license','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2101a8,_0x4fdf0d){var _0x1f112d=function(_0x5320fd){while(--_0x5320fd){_0x2101a8['push'](_0x2101a8['shift']());}};_0x1f112d(++_0x4fdf0d);}(_0x0f83,0x66));var _0x30f8=function(_0x13404a,_0x5b7171){_0x13404a=_0x13404a-0x0;var _0x2a57f3=_0x0f83[_0x13404a];return _0x2a57f3;};'use strict';var _=require('lodash');var util=require(_0x30f8('0x0'));var logger=require(_0x30f8('0x1'))('api');var moment=require('moment');var BPromise=require(_0x30f8('0x2'));var rp=require(_0x30f8('0x3'));var fs=require('fs');var path=require(_0x30f8('0x4'));var rimraf=require(_0x30f8('0x5'));var config=require(_0x30f8('0x6'));var attributes=require('./license.attributes');module[_0x30f8('0x7')]=function(_0x19f1c5,_0x160e2b){return _0x19f1c5[_0x30f8('0x8')](_0x30f8('0x9'),attributes,{'tableName':_0x30f8('0xa'),'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 0ce3838..9215a58 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 _0xcbe1=['then','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request'];(function(_0x11a9d5,_0x5f36b7){var _0x54a95b=function(_0x486d9f){while(--_0x486d9f){_0x11a9d5['push'](_0x11a9d5['shift']());}};_0x54a95b(++_0x5f36b7);}(_0xcbe1,0x1a2));var _0x1cbe=function(_0x3bb854,_0x2fa23e){_0x3bb854=_0x3bb854-0x0;var _0x2ea95e=_0xcbe1[_0x3bb854];return _0x2ea95e;};'use strict';var _=require('lodash');var util=require(_0x1cbe('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1cbe('0x1'))['db'];var utils=require(_0x1cbe('0x2'));var logger=require('../../config/logger')(_0x1cbe('0x3'));var config=require('../../config/environment');var jayson=require(_0x1cbe('0x4'));var client=jayson[_0x1cbe('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a02c7,_0x21342a,_0x3882e1){return new BPromise(function(_0x18e76b,_0x21b2a5){return client[_0x1cbe('0x6')](_0x1a02c7,_0x3882e1)[_0x1cbe('0x7')](function(_0x42232d){logger['info'](_0x1cbe('0x8'),_0x21342a,'request\x20sent');logger[_0x1cbe('0x9')](_0x1cbe('0xa'),_0x21342a,_0x1cbe('0xb'),JSON[_0x1cbe('0xc')](_0x42232d));if(_0x42232d['error']){if(_0x42232d[_0x1cbe('0xd')]['code']===0x1f4){logger[_0x1cbe('0xd')](_0x1cbe('0x8'),_0x21342a,_0x42232d['error'][_0x1cbe('0xe')]);return _0x21b2a5(_0x42232d[_0x1cbe('0xd')][_0x1cbe('0xe')]);}logger['error'](_0x1cbe('0x8'),_0x21342a,_0x42232d[_0x1cbe('0xd')][_0x1cbe('0xe')]);return _0x18e76b(_0x42232d[_0x1cbe('0xd')][_0x1cbe('0xe')]);}else{logger[_0x1cbe('0xf')](_0x1cbe('0x8'),_0x21342a,_0x1cbe('0xb'));_0x18e76b(_0x42232d[_0x1cbe('0x10')][_0x1cbe('0xe')]);}})['catch'](function(_0x228488){logger[_0x1cbe('0xd')](_0x1cbe('0x8'),_0x21342a,_0x228488);_0x21b2a5(_0x228488);});});} \ No newline at end of file +var _0xcd31=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcd31,0x15d));var _0x1cd3=function(_0x33c935,_0x5aaf49){_0x33c935=_0x33c935-0x0;var _0x49c201=_0xcd31[_0x33c935];return _0x49c201;};'use strict';var _=require('lodash');var util=require(_0x1cd3('0x0'));var moment=require(_0x1cd3('0x1'));var BPromise=require(_0x1cd3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1cd3('0x3'));var db=require(_0x1cd3('0x4'))['db'];var utils=require(_0x1cd3('0x5'));var logger=require(_0x1cd3('0x6'))(_0x1cd3('0x7'));var config=require(_0x1cd3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1cd3('0x9')][_0x1cd3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xedb6d1,_0x49d849,_0x45cc24){return new BPromise(function(_0x11b139,_0x124659){return client['request'](_0xedb6d1,_0x45cc24)[_0x1cd3('0xb')](function(_0x3953d3){logger[_0x1cd3('0xc')](_0x1cd3('0xd'),_0x49d849,_0x1cd3('0xe'));logger[_0x1cd3('0xf')](_0x1cd3('0x10'),_0x49d849,'request\x20sent',JSON[_0x1cd3('0x11')](_0x3953d3));if(_0x3953d3[_0x1cd3('0x12')]){if(_0x3953d3[_0x1cd3('0x12')][_0x1cd3('0x13')]===0x1f4){logger['error'](_0x1cd3('0xd'),_0x49d849,_0x3953d3['error'][_0x1cd3('0x14')]);return _0x124659(_0x3953d3[_0x1cd3('0x12')][_0x1cd3('0x14')]);}logger['error']('License,\x20%s,\x20%s',_0x49d849,_0x3953d3[_0x1cd3('0x12')][_0x1cd3('0x14')]);return _0x11b139(_0x3953d3[_0x1cd3('0x12')]['message']);}else{logger[_0x1cd3('0xc')](_0x1cd3('0xd'),_0x49d849,_0x1cd3('0xe'));_0x11b139(_0x3953d3[_0x1cd3('0x15')]['message']);}})['catch'](function(_0x5531c5){logger['error']('License,\x20%s,\x20%s',_0x49d849,_0x5531c5);_0x124659(_0x5531c5);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 84790e6..f4f43f5 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 _0x8be8=['delete','/:id/in_servers','removeImap','removeSmtp','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','getDispositions','getAnswers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/dispositions','create','addImap','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','removeDispositions','/:id/canned_answers','removeAnswers'];(function(_0x1a049b,_0x364223){var _0x570b5a=function(_0x5d757b){while(--_0x5d757b){_0x1a049b['push'](_0x1a049b['shift']());}};_0x570b5a(++_0x364223);}(_0x8be8,0xf6));var _0x88be=function(_0x31379c,_0x312a90){_0x31379c=_0x31379c-0x0;var _0x1667ae=_0x8be8[_0x31379c];return _0x1667ae;};'use strict';var multer=require(_0x88be('0x0'));var util=require(_0x88be('0x1'));var path=require(_0x88be('0x2'));var timeout=require(_0x88be('0x3'));var express=require(_0x88be('0x4'));var router=express[_0x88be('0x5')]();var auth=require(_0x88be('0x6'));var interaction=require(_0x88be('0x7'));var config=require(_0x88be('0x8'));var controller=require('./mailAccount.controller');router[_0x88be('0x9')]('/',auth['isAuthenticated'](),controller[_0x88be('0xa')]);router['get'](_0x88be('0xb'),auth[_0x88be('0xc')](),controller[_0x88be('0xd')]);router[_0x88be('0x9')](_0x88be('0xe'),auth[_0x88be('0xc')](),controller['show']);router[_0x88be('0x9')]('/:id/dispositions',auth[_0x88be('0xc')](),controller[_0x88be('0xf')]);router[_0x88be('0x9')]('/:id/canned_answers',auth[_0x88be('0xc')](),controller[_0x88be('0x10')]);router[_0x88be('0x9')]('/:id/in_servers',auth[_0x88be('0xc')](),controller['getImap']);router[_0x88be('0x9')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x88be('0x11')]);router[_0x88be('0x9')](_0x88be('0x12'),auth[_0x88be('0xc')](),controller[_0x88be('0x13')]);router[_0x88be('0x9')](_0x88be('0x14'),auth[_0x88be('0xc')](),controller['getApplications']);router[_0x88be('0x9')](_0x88be('0x15'),auth[_0x88be('0xc')](),controller['getMessages']);router[_0x88be('0x9')](_0x88be('0x16'),auth['isAuthenticated'](),controller[_0x88be('0x17')]);router[_0x88be('0x9')](_0x88be('0x18'),auth[_0x88be('0xc')](),controller[_0x88be('0x19')]);router[_0x88be('0x1a')](_0x88be('0x1b'),auth[_0x88be('0xc')](),controller['addDisposition']);router[_0x88be('0x1a')]('/:id/canned_answers',auth[_0x88be('0xc')](),controller['addAnswer']);router['post']('/',auth[_0x88be('0xc')](),controller[_0x88be('0x1c')]);router[_0x88be('0x1a')]('/:id/in_servers',auth[_0x88be('0xc')](),controller[_0x88be('0x1d')]);router[_0x88be('0x1a')](_0x88be('0x1e'),auth[_0x88be('0xc')](),controller[_0x88be('0x1f')]);router[_0x88be('0x1a')](_0x88be('0x12'),auth[_0x88be('0xc')](),controller[_0x88be('0x20')]);router[_0x88be('0x1a')](_0x88be('0x14'),auth[_0x88be('0xc')](),controller[_0x88be('0x21')]);router[_0x88be('0x1a')](_0x88be('0x22'),auth['isAuthenticated'](),controller[_0x88be('0x23')]);router[_0x88be('0x1a')](_0x88be('0x18'),auth['isAuthenticated'](),controller[_0x88be('0x24')]);router[_0x88be('0x25')](_0x88be('0xe'),auth[_0x88be('0xc')](),controller[_0x88be('0x26')]);router['delete'](_0x88be('0x1b'),auth[_0x88be('0xc')](),controller[_0x88be('0x27')]);router['delete'](_0x88be('0x28'),auth[_0x88be('0xc')](),controller[_0x88be('0x29')]);router[_0x88be('0x2a')](_0x88be('0x2b'),auth[_0x88be('0xc')](),controller[_0x88be('0x2c')]);router[_0x88be('0x2a')](_0x88be('0x1e'),auth['isAuthenticated'](),controller[_0x88be('0x2d')]);router[_0x88be('0x2a')](_0x88be('0xe'),auth[_0x88be('0xc')](),controller[_0x88be('0x2e')]);router[_0x88be('0x2a')](_0x88be('0x18'),auth[_0x88be('0xc')](),controller[_0x88be('0x2f')]);module['exports']=router; \ No newline at end of file +var _0x9c48=['/:id/users','post','addDisposition','addAnswer','create','addImap','/:id/out_servers','addInteraction','/:id/applications','addApplications','send','addAgents','put','update','delete','removeDispositions','removeImap','removeSmtp','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','./mailAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9c48,0xa1));var _0x89c4=function(_0x269bfb,_0x50ad38){_0x269bfb=_0x269bfb-0x0;var _0x562535=_0x9c48[_0x269bfb];return _0x562535;};'use strict';var multer=require(_0x89c4('0x0'));var util=require(_0x89c4('0x1'));var path=require(_0x89c4('0x2'));var timeout=require('connect-timeout');var express=require(_0x89c4('0x3'));var router=express[_0x89c4('0x4')]();var auth=require(_0x89c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x89c4('0x6'));router[_0x89c4('0x7')]('/',auth['isAuthenticated'](),controller[_0x89c4('0x8')]);router[_0x89c4('0x7')](_0x89c4('0x9'),auth[_0x89c4('0xa')](),controller[_0x89c4('0xb')]);router[_0x89c4('0x7')](_0x89c4('0xc'),auth[_0x89c4('0xa')](),controller[_0x89c4('0xd')]);router[_0x89c4('0x7')](_0x89c4('0xe'),auth[_0x89c4('0xa')](),controller[_0x89c4('0xf')]);router[_0x89c4('0x7')](_0x89c4('0x10'),auth[_0x89c4('0xa')](),controller[_0x89c4('0x11')]);router[_0x89c4('0x7')](_0x89c4('0x12'),auth[_0x89c4('0xa')](),controller['getImap']);router['get']('/:id/out_servers',auth[_0x89c4('0xa')](),controller[_0x89c4('0x13')]);router[_0x89c4('0x7')](_0x89c4('0x14'),auth[_0x89c4('0xa')](),controller[_0x89c4('0x15')]);router[_0x89c4('0x7')]('/:id/applications',auth[_0x89c4('0xa')](),controller[_0x89c4('0x16')]);router[_0x89c4('0x7')](_0x89c4('0x17'),auth['isAuthenticated'](),controller[_0x89c4('0x18')]);router[_0x89c4('0x7')](_0x89c4('0x19'),auth['isAuthenticated'](),controller[_0x89c4('0x1a')]);router['get'](_0x89c4('0x1b'),auth[_0x89c4('0xa')](),controller['getAgents']);router[_0x89c4('0x1c')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x89c4('0x1d')]);router[_0x89c4('0x1c')](_0x89c4('0x10'),auth['isAuthenticated'](),controller[_0x89c4('0x1e')]);router['post']('/',auth[_0x89c4('0xa')](),controller[_0x89c4('0x1f')]);router['post'](_0x89c4('0x12'),auth[_0x89c4('0xa')](),controller[_0x89c4('0x20')]);router[_0x89c4('0x1c')](_0x89c4('0x21'),auth[_0x89c4('0xa')](),controller['addSmtp']);router[_0x89c4('0x1c')](_0x89c4('0x14'),auth['isAuthenticated'](),controller[_0x89c4('0x22')]);router[_0x89c4('0x1c')](_0x89c4('0x23'),auth[_0x89c4('0xa')](),controller[_0x89c4('0x24')]);router[_0x89c4('0x1c')]('/:id/send',auth[_0x89c4('0xa')](),controller[_0x89c4('0x25')]);router[_0x89c4('0x1c')](_0x89c4('0x1b'),auth[_0x89c4('0xa')](),controller[_0x89c4('0x26')]);router[_0x89c4('0x27')](_0x89c4('0xc'),auth[_0x89c4('0xa')](),controller[_0x89c4('0x28')]);router[_0x89c4('0x29')](_0x89c4('0xe'),auth[_0x89c4('0xa')](),controller[_0x89c4('0x2a')]);router['delete']('/:id/canned_answers',auth[_0x89c4('0xa')](),controller['removeAnswers']);router[_0x89c4('0x29')](_0x89c4('0x12'),auth[_0x89c4('0xa')](),controller[_0x89c4('0x2b')]);router[_0x89c4('0x29')](_0x89c4('0x21'),auth[_0x89c4('0xa')](),controller[_0x89c4('0x2c')]);router[_0x89c4('0x29')](_0x89c4('0xc'),auth[_0x89c4('0xa')](),controller['destroy']);router['delete']('/:id/users',auth[_0x89c4('0xa')](),controller[_0x89c4('0x2d')]);module[_0x89c4('0x2e')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index fb166c2..9a09995 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 _0xff87=['sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x5c47fb,_0x3d00ff){var _0x4a5532=function(_0x28f984){while(--_0x28f984){_0x5c47fb['push'](_0x5c47fb['shift']());}};_0x4a5532(++_0x3d00ff);}(_0xff87,0xa8));var _0x7ff8=function(_0x28ee74,_0x289441){_0x28ee74=_0x28ee74-0x0;var _0x6cc80c=_0xff87[_0x28ee74];return _0x6cc80c;};'use strict';var Sequelize=require(_0x7ff8('0x0'));module[_0x7ff8('0x1')]={'description':{'type':Sequelize[_0x7ff8('0x2')]},'name':{'type':Sequelize[_0x7ff8('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x7ff8('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x7ff8('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x7ff8('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x7ff8('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7ff8('0x2')],'allowNull':![],'defaultValue':_0x7ff8('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x7ff8('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x7ff8('0x4')],'defaultValue':function(){return _0x7ff8('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7ff8('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7ff8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7ff8('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7ff8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7ff8('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7ff8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7ff8('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x7ff8('0x3')],'defaultValue':![],'comment':_0x7ff8('0x9'),'set':function(_0x4ded66){if(!_0x4ded66)this[_0x7ff8('0xa')](_0x7ff8('0xb'),null);this[_0x7ff8('0xa')]('mandatoryDisposition',_0x4ded66);}}}; \ No newline at end of file +var _0xf928=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x2e2441,_0x50ad4f){var _0x50032e=function(_0x50f53a){while(--_0x50f53a){_0x2e2441['push'](_0x2e2441['shift']());}};_0x50032e(++_0x50ad4f);}(_0xf928,0x11b));var _0x8f92=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf928[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x8f92('0x0'));module[_0x8f92('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x8f92('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x8f92('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x8f92('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x8f92('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x8f92('0x4')]},'markAsUnread':{'type':Sequelize[_0x8f92('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8f92('0x5')},'fontSize':{'type':Sequelize[_0x8f92('0x6')](0x2)[_0x8f92('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x8f92('0x4')],'defaultValue':function(){return _0x8f92('0x8');}},'notificationSound':{'type':Sequelize[_0x8f92('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8f92('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8f92('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8f92('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8f92('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8f92('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x8f92('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x8f92('0x3')],'defaultValue':![],'comment':_0x8f92('0xa'),'set':function(_0x117531){if(!_0x117531)this[_0x8f92('0xb')](_0x8f92('0xc'),null);this['setDataValue'](_0x8f92('0xd'),_0x117531);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 580c40c..d4153f5 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 _0x8e32=['getApplications','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','MailMessage','send','split','CmList','Contacts','updatedAt','from','format','%s\x20<%s>','attachments','join','root','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','List','messageId','subject','attach','out','Messages','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','juice','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','client','http','request','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailAccount,\x20%s,\x20%s','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','MailAccounts','UserProfileResource','stack','name','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','catch','params','rawAttributes','find','update','body','describe','addDisposition','MailAccountId','create','findOne','Disposition','length','findAll','rows','removeDispositions','ids','getAnswers','CannedAnswer','nolimit','removeAnswers','key','email','ListId','isNil','active','description','cservice','user','pass','cpassword','authentication','host','port','service','cuser','password','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','MailInteraction','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','color','tag','MailApplication','bulkCreate','priority'];(function(_0x2e5289,_0x4ab9ed){var _0x1bba30=function(_0x18df8d){while(--_0x18df8d){_0x2e5289['push'](_0x2e5289['shift']());}};_0x1bba30(++_0x4ab9ed);}(_0x8e32,0x1aa));var _0x28e3=function(_0x2d039b,_0x4f79fd){_0x2d039b=_0x2d039b-0x0;var _0x357688=_0x8e32[_0x2d039b];return _0x357688;};'use strict';var pdf=require(_0x28e3('0x0'));var emlformat=require(_0x28e3('0x1'));var rimraf=require(_0x28e3('0x2'));var zipdir=require(_0x28e3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x28e3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x28e3('0x5'));var util=require(_0x28e3('0x6'));var path=require(_0x28e3('0x7'));var sox=require(_0x28e3('0x8'));var csv=require(_0x28e3('0x9'));var ejs=require(_0x28e3('0xa'));var fs=require('fs');var _=require(_0x28e3('0xb'));var squel=require(_0x28e3('0xc'));var crypto=require('crypto');var jsforce=require(_0x28e3('0xd'));var deskjs=require(_0x28e3('0xe'));var toCsv=require(_0x28e3('0x9'));var querystring=require('querystring');var Papa=require(_0x28e3('0xf'));var htmlToText=require('html-to-text');var juice=require(_0x28e3('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x28e3('0x11'));var as=require(_0x28e3('0x12'));var hardwareService=require(_0x28e3('0x13'));var logger=require(_0x28e3('0x14'))(_0x28e3('0x15'));var utils=require('../../config/utils');var config=require(_0x28e3('0x16'));var licenseUtil=require(_0x28e3('0x17'));var db=require(_0x28e3('0x18'))['db'];config['redis']=_[_0x28e3('0x19')](config[_0x28e3('0x1a')],{'host':_0x28e3('0x1b'),'port':0x18eb});var socket=require(_0x28e3('0x1c'))(new Redis(config['redis']));require(_0x28e3('0x1d'))[_0x28e3('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x28e3('0x1f')][_0x28e3('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x116dab,_0x4f0042,_0x49f927,_0x12fb73){return new BPromise(function(_0x1ca172,_0x16f3a5){var _0x54f51b=_0x12fb73||client;return _0x54f51b[_0x28e3('0x21')](_0x116dab,_0x49f927)[_0x28e3('0x22')](function(_0x4e1925){logger['info']('MailAccount,\x20%s,\x20%s',_0x4f0042,_0x28e3('0x23'));logger[_0x28e3('0x24')](_0x28e3('0x25'),_0x4f0042,_0x28e3('0x23'),JSON[_0x28e3('0x26')](_0x4e1925));if(_0x4e1925[_0x28e3('0x27')]){if(_0x4e1925[_0x28e3('0x27')][_0x28e3('0x28')]===0x1f4){logger[_0x28e3('0x27')]('MailAccount,\x20%s,\x20%s',_0x4f0042,_0x4e1925[_0x28e3('0x27')][_0x28e3('0x29')]);return _0x16f3a5(_0x4e1925[_0x28e3('0x27')]['message']);}logger[_0x28e3('0x27')](_0x28e3('0x2a'),_0x4f0042,_0x4e1925[_0x28e3('0x27')][_0x28e3('0x29')]);return _0x1ca172(_0x4e1925['error'][_0x28e3('0x29')]);}else{logger['info'](_0x28e3('0x2a'),_0x4f0042,'request\x20sent');_0x1ca172(_0x4e1925[_0x28e3('0x2b')][_0x28e3('0x29')]);}})['catch'](function(_0x2c85bb){logger['error']('MailAccount,\x20%s,\x20%s',_0x4f0042,_0x2c85bb);_0x16f3a5(_0x2c85bb);});});}function respondWithStatusCode(_0x15dad5,_0x5bfdab){_0x5bfdab=_0x5bfdab||0xcc;return function(_0x385609){if(_0x385609){return _0x15dad5[_0x28e3('0x2c')](_0x5bfdab);}return _0x15dad5['status'](_0x5bfdab)[_0x28e3('0x2d')]();};}function respondWithResult(_0x2f1cb7,_0x4158e9){_0x4158e9=_0x4158e9||0xc8;return function(_0x5afacb){if(_0x5afacb){return _0x2f1cb7[_0x28e3('0x2e')](_0x4158e9)[_0x28e3('0x2f')](_0x5afacb);}};}function respondWithFilteredResult(_0xeb398f,_0x375524){return function(_0x1da5b2){if(_0x1da5b2){var _0x10c4da=_0x1da5b2[_0x28e3('0x30')],_0x1ac40e=_0x375524['offset'],_0x3a5ff6=_0x375524[_0x28e3('0x31')]+_0x375524[_0x28e3('0x32')],_0x28d828;if(_0x3a5ff6>=_0x10c4da){_0x3a5ff6=_0x10c4da;_0x28d828=0xc8;}else{_0x28d828=0xce;}_0xeb398f[_0x28e3('0x2e')](_0x28d828);return _0xeb398f[_0x28e3('0x33')](_0x28e3('0x34'),_0x1ac40e+'-'+_0x3a5ff6+'/'+_0x10c4da)[_0x28e3('0x2f')](_0x1da5b2);}return null;};}function patchUpdates(_0x3be8b1){return function(_0x13808a){try{jsonpatch[_0x28e3('0x35')](_0x13808a,_0x3be8b1,!![]);}catch(_0x363ed9){return BPromise[_0x28e3('0x36')](_0x363ed9);}return _0x13808a[_0x28e3('0x37')]();};}function saveUpdates(_0x22cc2e,_0x5deaba){return function(_0x5ce5bf){if(_0x5ce5bf){return _0x5ce5bf['update'](_0x22cc2e)[_0x28e3('0x22')](function(_0x78bb86){return _0x78bb86;});}return null;};}function removeEntity(_0x2ca70f,_0x468d10){return function(_0x5d759e){if(_0x5d759e){return _0x5d759e[_0x28e3('0x38')]()[_0x28e3('0x22')](function(){var _0x1d01a8=_0x5d759e['get']({'plain':!![]});var _0x3b5769=_0x28e3('0x39');return db[_0x28e3('0x3a')]['destroy']({'where':{'type':_0x3b5769,'resourceId':_0x1d01a8['id']}})[_0x28e3('0x22')](function(){return _0x5d759e;});})[_0x28e3('0x22')](function(){_0x2ca70f[_0x28e3('0x2e')](0xcc)[_0x28e3('0x2d')]();});}};}function handleEntityNotFound(_0x18d890,_0x3ede03){return function(_0x3693ca){if(!_0x3693ca){_0x18d890['sendStatus'](0x194);}return _0x3693ca;};}function handleError(_0x5d4e2b,_0x4cb04f){_0x4cb04f=_0x4cb04f||0x1f4;return function(_0x205137){logger[_0x28e3('0x27')](_0x205137[_0x28e3('0x3b')]);if(_0x205137[_0x28e3('0x3c')]){delete _0x205137[_0x28e3('0x3c')];}_0x5d4e2b[_0x28e3('0x2e')](_0x4cb04f)['send'](_0x205137);};}exports[_0x28e3('0x3d')]=function(_0x5959ba,_0x15e0dc){var _0x5d9377={'include':[{'model':db[_0x28e3('0x3e')],'as':_0x28e3('0x3f')},{'model':db[_0x28e3('0x40')],'as':_0x28e3('0x41')},{'model':db[_0x28e3('0x42')],'as':_0x28e3('0x43')}]},_0x2a6c70={},_0xc9b958={'count':0x0,'rows':[]};var _0x47195c=_[_0x28e3('0x44')](db[_0x28e3('0x45')]['rawAttributes'],function(_0x405675){return{'name':_0x405675[_0x28e3('0x46')],'type':_0x405675[_0x28e3('0x47')]['key']};});_0x2a6c70[_0x28e3('0x48')]=_[_0x28e3('0x44')](_0x47195c,_0x28e3('0x3c'));_0x2a6c70['query']=_[_0x28e3('0x49')](_0x5959ba[_0x28e3('0x4a')]);_0x2a6c70[_0x28e3('0x4b')]=_[_0x28e3('0x4c')](_0x2a6c70[_0x28e3('0x48')],_0x2a6c70[_0x28e3('0x4a')]);_0x5d9377[_0x28e3('0x4d')]=_['intersection'](_0x2a6c70[_0x28e3('0x48')],qs['fields'](_0x5959ba[_0x28e3('0x4a')][_0x28e3('0x4e')]));_0x5d9377[_0x28e3('0x4d')]=_0x5d9377[_0x28e3('0x4d')]['length']?_0x5d9377['attributes']:_0x2a6c70[_0x28e3('0x48')];if(!_0x5959ba[_0x28e3('0x4a')][_0x28e3('0x4f')]('nolimit')){_0x5d9377[_0x28e3('0x32')]=qs[_0x28e3('0x32')](_0x5959ba[_0x28e3('0x4a')][_0x28e3('0x32')]);_0x5d9377[_0x28e3('0x31')]=qs[_0x28e3('0x31')](_0x5959ba['query']['offset']);}_0x5d9377[_0x28e3('0x50')]=qs[_0x28e3('0x51')](_0x5959ba['query'][_0x28e3('0x51')]);_0x5d9377['where']=qs[_0x28e3('0x4b')](_[_0x28e3('0x52')](_0x5959ba[_0x28e3('0x4a')],_0x2a6c70[_0x28e3('0x4b')]),_0x47195c);if(_0x5959ba[_0x28e3('0x4a')][_0x28e3('0x53')]){_0x5d9377[_0x28e3('0x54')]=_[_0x28e3('0x55')](_0x5d9377['where'],{'$or':_['map'](_0x47195c,function(_0x498776){if(_0x498776[_0x28e3('0x47')]!==_0x28e3('0x56')){var _0x907aad={};_0x907aad[_0x498776[_0x28e3('0x3c')]]={'$like':'%'+_0x5959ba[_0x28e3('0x4a')][_0x28e3('0x53')]+'%'};return _0x907aad;}})});}_0x5d9377=_[_0x28e3('0x55')]({},_0x5d9377,_0x5959ba[_0x28e3('0x57')]);var _0x4a356d={'where':_0x5d9377[_0x28e3('0x54')]};return db[_0x28e3('0x45')]['count'](_0x4a356d)[_0x28e3('0x22')](function(_0x4fc418){_0xc9b958[_0x28e3('0x30')]=_0x4fc418;if(_0x5959ba[_0x28e3('0x4a')][_0x28e3('0x58')]){_0x5d9377[_0x28e3('0x59')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x5d9377);})[_0x28e3('0x22')](function(_0x2ddc8d){_0xc9b958['rows']=_0x2ddc8d;return _0xc9b958;})['then'](respondWithFilteredResult(_0x15e0dc,_0x5d9377))[_0x28e3('0x5a')](handleError(_0x15e0dc,null));};exports['show']=function(_0x3d9420,_0x829849){var _0x49a359={'raw':![],'where':{'id':_0x3d9420[_0x28e3('0x5b')]['id']},'include':[{'model':db[_0x28e3('0x3e')],'as':'Imap'},{'model':db[_0x28e3('0x40')],'as':_0x28e3('0x41')},{'model':db['Pause'],'as':_0x28e3('0x43')}]},_0x19ba8f={};_0x19ba8f['model']=_['keys'](db['MailAccount'][_0x28e3('0x5c')]);_0x19ba8f[_0x28e3('0x4a')]=_[_0x28e3('0x49')](_0x3d9420[_0x28e3('0x4a')]);_0x19ba8f[_0x28e3('0x4b')]=_[_0x28e3('0x4c')](_0x19ba8f[_0x28e3('0x48')],_0x19ba8f[_0x28e3('0x4a')]);_0x49a359[_0x28e3('0x4d')]=_[_0x28e3('0x4c')](_0x19ba8f['model'],qs['fields'](_0x3d9420[_0x28e3('0x4a')][_0x28e3('0x4e')]));_0x49a359['attributes']=_0x49a359[_0x28e3('0x4d')]['length']?_0x49a359[_0x28e3('0x4d')]:_0x19ba8f[_0x28e3('0x48')];if(_0x3d9420[_0x28e3('0x4a')][_0x28e3('0x58')]){_0x49a359[_0x28e3('0x59')]=[{'all':!![]}];}_0x49a359=_['merge']({},_0x49a359,_0x3d9420[_0x28e3('0x57')]);return db['MailAccount'][_0x28e3('0x5d')](_0x49a359)[_0x28e3('0x22')](handleEntityNotFound(_0x829849,null))['then'](respondWithResult(_0x829849,null))['catch'](handleError(_0x829849,null));};exports[_0x28e3('0x5e')]=function(_0x57b774,_0x1c8a1a){if(_0x57b774[_0x28e3('0x5f')]['id']){delete _0x57b774[_0x28e3('0x5f')]['id'];}return db[_0x28e3('0x45')][_0x28e3('0x5d')]({'where':{'id':_0x57b774[_0x28e3('0x5b')]['id']},'include':[{'model':db[_0x28e3('0x3e')],'as':'Imap'},{'model':db[_0x28e3('0x40')],'as':_0x28e3('0x41')},{'model':db[_0x28e3('0x42')],'as':_0x28e3('0x43')}]})[_0x28e3('0x22')](handleEntityNotFound(_0x1c8a1a,null))[_0x28e3('0x22')](saveUpdates(_0x57b774['body'],null))['then'](function(_0x4a58db){if(_0x4a58db&&_0x57b774[_0x28e3('0x5f')][_0x28e3('0x3f')]){return db[_0x28e3('0x3e')][_0x28e3('0x5e')](_0x57b774['body']['Imap'],{'where':{'MailAccountId':_0x4a58db['id']}})[_0x28e3('0x22')](function(){return _0x4a58db;});}return _0x4a58db;})[_0x28e3('0x22')](function(_0x19c342){if(_0x19c342&&_0x57b774[_0x28e3('0x5f')][_0x28e3('0x41')]){return db[_0x28e3('0x40')]['update'](_0x57b774[_0x28e3('0x5f')][_0x28e3('0x41')],{'where':{'MailAccountId':_0x19c342['id']}})['then'](function(){return _0x19c342;});}return _0x19c342;})[_0x28e3('0x22')](respondWithResult(_0x1c8a1a,null))['catch'](handleError(_0x1c8a1a,null));};exports['describe']=function(_0x55d37d,_0x39baab){return db[_0x28e3('0x45')][_0x28e3('0x60')]()[_0x28e3('0x22')](respondWithResult(_0x39baab,null))['catch'](handleError(_0x39baab,null));};exports[_0x28e3('0x61')]=function(_0x3c52c2,_0x5b2cd7,_0x2545c8){if(_0x3c52c2['body']['id']){delete _0x3c52c2[_0x28e3('0x5f')]['id'];}return db[_0x28e3('0x45')][_0x28e3('0x5d')]({'where':{'id':_0x3c52c2['params']['id']}})[_0x28e3('0x22')](handleEntityNotFound(_0x5b2cd7,null))[_0x28e3('0x22')](function(_0x1f9ce9){if(_0x1f9ce9){_0x3c52c2[_0x28e3('0x5f')][_0x28e3('0x62')]=_0x1f9ce9['id'];return db['Disposition'][_0x28e3('0x63')](_0x3c52c2[_0x28e3('0x5f')]);}})[_0x28e3('0x22')](respondWithResult(_0x5b2cd7,null))['catch'](handleError(_0x5b2cd7,null));};exports['getDispositions']=function(_0x640fd5,_0x185f8a,_0x1b8671){var _0x3c2852={'raw':![],'where':{}};var _0x53f851={};var _0x2abe35={'count':0x0,'rows':[]};return db['MailAccount'][_0x28e3('0x64')]({'where':{'id':_0x640fd5[_0x28e3('0x5b')]['id']}})[_0x28e3('0x22')](handleEntityNotFound(_0x185f8a,null))[_0x28e3('0x22')](function(_0x560bf5){if(_0x560bf5){_0x53f851[_0x28e3('0x48')]=_['keys'](db[_0x28e3('0x65')][_0x28e3('0x5c')]);_0x53f851['query']=_[_0x28e3('0x49')](_0x640fd5[_0x28e3('0x4a')]);_0x53f851[_0x28e3('0x4b')]=_[_0x28e3('0x4c')](_0x53f851['model'],_0x53f851['query']);_0x3c2852[_0x28e3('0x4d')]=_[_0x28e3('0x4c')](_0x53f851[_0x28e3('0x48')],qs[_0x28e3('0x4e')](_0x640fd5[_0x28e3('0x4a')][_0x28e3('0x4e')]));_0x3c2852[_0x28e3('0x4d')]=_0x3c2852[_0x28e3('0x4d')][_0x28e3('0x66')]?_0x3c2852[_0x28e3('0x4d')]:_0x53f851[_0x28e3('0x48')];if(!_0x640fd5[_0x28e3('0x4a')][_0x28e3('0x4f')]('nolimit')){_0x3c2852[_0x28e3('0x32')]=qs[_0x28e3('0x32')](_0x640fd5[_0x28e3('0x4a')][_0x28e3('0x32')]);_0x3c2852[_0x28e3('0x31')]=qs[_0x28e3('0x31')](_0x640fd5[_0x28e3('0x4a')]['offset']);}_0x3c2852['order']=qs['sort'](_0x640fd5['query'][_0x28e3('0x51')]);_0x3c2852['where']=qs['filters'](_[_0x28e3('0x52')](_0x640fd5[_0x28e3('0x4a')],_0x53f851['filters']));_0x3c2852[_0x28e3('0x54')]['MailAccountId']=_0x560bf5['id'];if(_0x640fd5[_0x28e3('0x4a')][_0x28e3('0x53')]){_0x3c2852['where']=_[_0x28e3('0x55')](_0x3c2852[_0x28e3('0x54')],{'$or':_[_0x28e3('0x44')](_0x3c2852[_0x28e3('0x4d')],function(_0x2b4b58){var _0x2d4906={};_0x2d4906[_0x2b4b58]={'$like':'%'+_0x640fd5['query'][_0x28e3('0x53')]+'%'};return _0x2d4906;})});}_0x3c2852=_[_0x28e3('0x55')]({},_0x3c2852,_0x640fd5['options']);return db[_0x28e3('0x65')][_0x28e3('0x30')]({'where':_0x3c2852[_0x28e3('0x54')]})[_0x28e3('0x22')](function(_0x340d7b){_0x2abe35[_0x28e3('0x30')]=_0x340d7b;if(_0x640fd5[_0x28e3('0x4a')]['includeAll']){_0x3c2852['include']=[{'all':!![]}];}return db[_0x28e3('0x65')][_0x28e3('0x67')](_0x3c2852);})[_0x28e3('0x22')](function(_0x10ac53){_0x2abe35[_0x28e3('0x68')]=_0x10ac53;return _0x2abe35;});}})[_0x28e3('0x22')](respondWithFilteredResult(_0x185f8a,_0x3c2852))[_0x28e3('0x5a')](handleError(_0x185f8a,null));};exports[_0x28e3('0x69')]=function(_0x4ab9cc,_0x35fff8,_0x567202){return db[_0x28e3('0x45')][_0x28e3('0x5d')]({'where':{'id':_0x4ab9cc['params']['id']}})[_0x28e3('0x22')](handleEntityNotFound(_0x35fff8,null))[_0x28e3('0x22')](function(_0x3b4ee4){if(_0x3b4ee4){return _0x3b4ee4[_0x28e3('0x69')](_0x4ab9cc['query'][_0x28e3('0x6a')]);}})['then'](respondWithStatusCode(_0x35fff8,null))[_0x28e3('0x5a')](handleError(_0x35fff8,null));};exports['addAnswer']=function(_0x56e34a,_0x24254b,_0x17a38){if(_0x56e34a[_0x28e3('0x5f')]['id']){delete _0x56e34a[_0x28e3('0x5f')]['id'];}return db[_0x28e3('0x45')][_0x28e3('0x5d')]({'where':{'id':_0x56e34a[_0x28e3('0x5b')]['id']}})[_0x28e3('0x22')](handleEntityNotFound(_0x24254b,null))['then'](function(_0x27bbaf){if(_0x27bbaf){_0x56e34a['body'][_0x28e3('0x62')]=_0x27bbaf['id'];return db['CannedAnswer'][_0x28e3('0x63')](_0x56e34a[_0x28e3('0x5f')]);}})[_0x28e3('0x22')](respondWithResult(_0x24254b,null))[_0x28e3('0x5a')](handleError(_0x24254b,null));};exports[_0x28e3('0x6b')]=function(_0x38d66,_0x21081a,_0x7e7b32){var _0x3e8b43={'raw':![],'where':{}};var _0xac10fe={};var _0x44ae82={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x38d66['params']['id']}})[_0x28e3('0x22')](handleEntityNotFound(_0x21081a,null))[_0x28e3('0x22')](function(_0x3ccb35){if(_0x3ccb35){_0xac10fe['model']=_['keys'](db[_0x28e3('0x6c')][_0x28e3('0x5c')]);_0xac10fe['query']=_[_0x28e3('0x49')](_0x38d66[_0x28e3('0x4a')]);_0xac10fe[_0x28e3('0x4b')]=_[_0x28e3('0x4c')](_0xac10fe[_0x28e3('0x48')],_0xac10fe[_0x28e3('0x4a')]);_0x3e8b43[_0x28e3('0x4d')]=_[_0x28e3('0x4c')](_0xac10fe[_0x28e3('0x48')],qs[_0x28e3('0x4e')](_0x38d66[_0x28e3('0x4a')][_0x28e3('0x4e')]));_0x3e8b43[_0x28e3('0x4d')]=_0x3e8b43['attributes'][_0x28e3('0x66')]?_0x3e8b43['attributes']:_0xac10fe[_0x28e3('0x48')];if(!_0x38d66[_0x28e3('0x4a')][_0x28e3('0x4f')](_0x28e3('0x6d'))){_0x3e8b43[_0x28e3('0x32')]=qs[_0x28e3('0x32')](_0x38d66[_0x28e3('0x4a')][_0x28e3('0x32')]);_0x3e8b43[_0x28e3('0x31')]=qs[_0x28e3('0x31')](_0x38d66[_0x28e3('0x4a')][_0x28e3('0x31')]);}_0x3e8b43[_0x28e3('0x50')]=qs[_0x28e3('0x51')](_0x38d66[_0x28e3('0x4a')]['sort']);_0x3e8b43[_0x28e3('0x54')]=qs['filters'](_[_0x28e3('0x52')](_0x38d66[_0x28e3('0x4a')],_0xac10fe[_0x28e3('0x4b')]));_0x3e8b43[_0x28e3('0x54')][_0x28e3('0x62')]=_0x3ccb35['id'];if(_0x38d66[_0x28e3('0x4a')][_0x28e3('0x53')]){_0x3e8b43[_0x28e3('0x54')]=_[_0x28e3('0x55')](_0x3e8b43[_0x28e3('0x54')],{'$or':_[_0x28e3('0x44')](_0x3e8b43[_0x28e3('0x4d')],function(_0x297096){var _0x10eabe={};_0x10eabe[_0x297096]={'$like':'%'+_0x38d66[_0x28e3('0x4a')][_0x28e3('0x53')]+'%'};return _0x10eabe;})});}_0x3e8b43=_[_0x28e3('0x55')]({},_0x3e8b43,_0x38d66[_0x28e3('0x57')]);return db['CannedAnswer'][_0x28e3('0x30')]({'where':_0x3e8b43['where']})[_0x28e3('0x22')](function(_0x5ccd75){_0x44ae82[_0x28e3('0x30')]=_0x5ccd75;if(_0x38d66[_0x28e3('0x4a')][_0x28e3('0x58')]){_0x3e8b43[_0x28e3('0x59')]=[{'all':!![]}];}return db[_0x28e3('0x6c')]['findAll'](_0x3e8b43);})['then'](function(_0x172ea2){_0x44ae82['rows']=_0x172ea2;return _0x44ae82;});}})[_0x28e3('0x22')](respondWithFilteredResult(_0x21081a,_0x3e8b43))[_0x28e3('0x5a')](handleError(_0x21081a,null));};exports[_0x28e3('0x6e')]=function(_0x321a78,_0x1e0d0d,_0x628d81){return db[_0x28e3('0x45')][_0x28e3('0x5d')]({'where':{'id':_0x321a78['params']['id']}})[_0x28e3('0x22')](handleEntityNotFound(_0x1e0d0d,null))[_0x28e3('0x22')](function(_0x1c8fe6){if(_0x1c8fe6){return _0x1c8fe6[_0x28e3('0x6e')](_0x321a78[_0x28e3('0x4a')][_0x28e3('0x6a')]);}})[_0x28e3('0x22')](respondWithStatusCode(_0x1e0d0d,null))[_0x28e3('0x5a')](handleError(_0x1e0d0d,null));};exports[_0x28e3('0x63')]=function(_0x50f10b,_0x1e4c76){var _0x59e59e={'name':_0x50f10b['body'][_0x28e3('0x3c')],'key':_0x50f10b[_0x28e3('0x5f')][_0x28e3('0x6f')],'email':_0x50f10b[_0x28e3('0x5f')][_0x28e3('0x70')],'ListId':_0x50f10b['body'][_0x28e3('0x71')],'active':!_[_0x28e3('0x72')](_0x50f10b[_0x28e3('0x5f')]['active'])?_0x50f10b[_0x28e3('0x5f')][_0x28e3('0x73')]:!![],'description':_0x50f10b['body'][_0x28e3('0x74')]||null,'Imap':{},'Smtp':{}};if(_[_0x28e3('0x72')](_0x50f10b['body'][_0x28e3('0x75')])){if(_0x50f10b[_0x28e3('0x5f')]['cauthentication']){_0x59e59e[_0x28e3('0x3f')][_0x28e3('0x76')]=_0x59e59e[_0x28e3('0x41')][_0x28e3('0x76')]=_0x50f10b[_0x28e3('0x5f')]['cuser'];_0x59e59e[_0x28e3('0x3f')]['password']=_0x59e59e[_0x28e3('0x41')][_0x28e3('0x77')]=_0x50f10b[_0x28e3('0x5f')][_0x28e3('0x78')];}else{_0x59e59e[_0x28e3('0x3f')]['authentication']=_0x59e59e[_0x28e3('0x41')][_0x28e3('0x79')]=![];}_0x59e59e['Imap'][_0x28e3('0x7a')]=_0x50f10b['body'][_0x28e3('0x3f')][_0x28e3('0x7a')];_0x59e59e[_0x28e3('0x3f')][_0x28e3('0x7b')]=_0x50f10b['body'][_0x28e3('0x3f')]['port'];_0x59e59e['Smtp'][_0x28e3('0x7a')]=_0x50f10b[_0x28e3('0x5f')]['Smtp'][_0x28e3('0x7a')];_0x59e59e[_0x28e3('0x41')][_0x28e3('0x7b')]=_0x50f10b[_0x28e3('0x5f')][_0x28e3('0x41')][_0x28e3('0x7b')];}else{_0x59e59e[_0x28e3('0x3f')][_0x28e3('0x7c')]=_0x59e59e['Smtp'][_0x28e3('0x7c')]=_0x50f10b[_0x28e3('0x5f')][_0x28e3('0x75')];_0x59e59e[_0x28e3('0x3f')][_0x28e3('0x76')]=_0x59e59e[_0x28e3('0x41')]['user']=_0x50f10b[_0x28e3('0x5f')][_0x28e3('0x7d')];_0x59e59e['Imap'][_0x28e3('0x7e')]=_0x59e59e[_0x28e3('0x41')]['pass']=_0x50f10b[_0x28e3('0x5f')]['cpassword'];}return db[_0x28e3('0x45')][_0x28e3('0x63')](_0x59e59e,{'include':[{'model':db[_0x28e3('0x40')],'as':_0x28e3('0x41')},{'model':db['MailServerIn'],'as':_0x28e3('0x3f')}]})[_0x28e3('0x22')](function(_0x23307a){var _0x2023ad=_0x50f10b[_0x28e3('0x76')][_0x28e3('0x7f')]({'plain':!![]});if(!_0x2023ad)throw new Error(_0x28e3('0x80'));if(_0x2023ad[_0x28e3('0x81')]===_0x28e3('0x76')){var _0x5ab011=_0x23307a[_0x28e3('0x7f')]({'plain':!![]});return db[_0x28e3('0x82')]['find']({'where':{'name':_0x28e3('0x39'),'userProfileId':_0x2023ad[_0x28e3('0x83')]},'raw':!![]})['then'](function(_0x5303a8){if(_0x5303a8&&_0x5303a8[_0x28e3('0x84')]===0x0){return db[_0x28e3('0x3a')][_0x28e3('0x63')]({'name':_0x5ab011[_0x28e3('0x3c')],'resourceId':_0x5ab011['id'],'type':_0x5303a8[_0x28e3('0x3c')],'sectionId':_0x5303a8['id']},{})[_0x28e3('0x22')](function(){return _0x23307a;});}else{return _0x23307a;}})['catch'](function(_0x3beaba){logger[_0x28e3('0x27')](_0x28e3('0x85'),_0x3beaba);throw _0x3beaba;});}return _0x23307a;})['then'](respondWithResult(_0x1e4c76,0xc9))['catch'](handleError(_0x1e4c76,null));};exports[_0x28e3('0x86')]=function(_0x3c8d53,_0x253565,_0x298f38){return db[_0x28e3('0x45')][_0x28e3('0x64')]({'where':{'id':_0x3c8d53[_0x28e3('0x5b')]['id']}})[_0x28e3('0x22')](handleEntityNotFound(_0x253565,null))[_0x28e3('0x22')](function(_0x5f106c){if(_0x5f106c){return _0x5f106c['getImap']();}return null;})[_0x28e3('0x22')](respondWithResult(_0x253565,null))[_0x28e3('0x5a')](handleError(_0x253565,null));};exports['addImap']=function(_0x18a727,_0xd2f9d2,_0x589dc8){if(_0x18a727[_0x28e3('0x5f')]['id']){delete _0x18a727[_0x28e3('0x5f')]['id'];}return db[_0x28e3('0x45')]['find']({'where':{'id':_0x18a727['params']['id']}})[_0x28e3('0x22')](handleEntityNotFound(_0xd2f9d2,null))[_0x28e3('0x22')](function(_0x5f0992){if(_0x5f0992){_0x18a727[_0x28e3('0x5f')][_0x28e3('0x62')]=_0x5f0992['id'];return db[_0x28e3('0x3e')]['create'](_0x18a727['body']);}})[_0x28e3('0x22')](respondWithResult(_0xd2f9d2,null))['catch'](handleError(_0xd2f9d2,null));};exports[_0x28e3('0x87')]=function(_0x147df0,_0x339c6c,_0x28d54a){return db[_0x28e3('0x45')]['findOne']({'where':{'id':_0x147df0[_0x28e3('0x5b')]['id']}})['then'](handleEntityNotFound(_0x339c6c,null))[_0x28e3('0x22')](function(_0x64fc34){if(_0x64fc34){return _0x64fc34[_0x28e3('0x88')](null);}return null;})[_0x28e3('0x22')](respondWithStatusCode(_0x339c6c,null))[_0x28e3('0x5a')](handleError(_0x339c6c,null));};exports['getSmtp']=function(_0xa77607,_0xea479,_0x479427){return db['MailAccount']['findOne']({'where':{'id':_0xa77607[_0x28e3('0x5b')]['id']}})[_0x28e3('0x22')](handleEntityNotFound(_0xea479,null))[_0x28e3('0x22')](function(_0x549d7f){if(_0x549d7f){return _0x549d7f[_0x28e3('0x89')]();}return null;})['then'](respondWithResult(_0xea479,null))[_0x28e3('0x5a')](handleError(_0xea479,null));};exports['addSmtp']=function(_0x2bee9e,_0x544d49,_0x59cfc7){if(_0x2bee9e[_0x28e3('0x5f')]['id']){delete _0x2bee9e['body']['id'];}return db[_0x28e3('0x45')][_0x28e3('0x5d')]({'where':{'id':_0x2bee9e[_0x28e3('0x5b')]['id']}})[_0x28e3('0x22')](handleEntityNotFound(_0x544d49,null))[_0x28e3('0x22')](function(_0x3e639d){if(_0x3e639d){_0x2bee9e[_0x28e3('0x5f')][_0x28e3('0x62')]=_0x3e639d['id'];return db[_0x28e3('0x40')]['create'](_0x2bee9e[_0x28e3('0x5f')]);}})[_0x28e3('0x22')](respondWithResult(_0x544d49,null))['catch'](handleError(_0x544d49,null));};exports[_0x28e3('0x8a')]=function(_0x44f554,_0x16147e,_0x2c6cff){return db[_0x28e3('0x45')][_0x28e3('0x64')]({'where':{'id':_0x44f554[_0x28e3('0x5b')]['id']}})[_0x28e3('0x22')](handleEntityNotFound(_0x16147e,null))['then'](function(_0x239178){if(_0x239178){return _0x239178[_0x28e3('0x8b')](null);}return null;})['then'](respondWithStatusCode(_0x16147e,null))[_0x28e3('0x5a')](handleError(_0x16147e,null));};exports['addInteraction']=function(_0x5f449a,_0x5b5978,_0x230779){return db[_0x28e3('0x8c')]['find']({'where':{'id':_0x5f449a[_0x28e3('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5b5978,null))[_0x28e3('0x22')](function(_0x19f71a){if(_0x19f71a){return _0x19f71a['addInteraction'](_0x5f449a[_0x28e3('0x5f')]['ids'],_['omit'](_0x5f449a['body'],['ids','id'])||{});}})[_0x28e3('0x22')](respondWithResult(_0x5b5978,null))[_0x28e3('0x5a')](handleError(_0x5b5978,null));};exports[_0x28e3('0x8d')]=function(_0x39e7ac,_0x31dbe9,_0x3f28f9){var _0x272ca7={'raw':![],'where':{}};var _0x36a882={};var _0x2c03b3={'count':0x0,'rows':[]};return db[_0x28e3('0x45')]['findOne']({'where':{'id':_0x39e7ac[_0x28e3('0x5b')]['id']}})[_0x28e3('0x22')](handleEntityNotFound(_0x31dbe9,null))[_0x28e3('0x22')](function(_0x3e3317){if(_0x3e3317){_0x36a882[_0x28e3('0x48')]=_['keys'](db[_0x28e3('0x8c')]['rawAttributes']);_0x36a882[_0x28e3('0x4a')]=_[_0x28e3('0x49')](_0x39e7ac[_0x28e3('0x4a')]);_0x36a882[_0x28e3('0x4b')]=_['intersection'](_0x36a882[_0x28e3('0x48')],_0x36a882[_0x28e3('0x4a')]);_0x272ca7[_0x28e3('0x4d')]=_[_0x28e3('0x4c')](_0x36a882[_0x28e3('0x48')],qs[_0x28e3('0x4e')](_0x39e7ac['query']['fields']));_0x272ca7[_0x28e3('0x4d')]=_0x272ca7[_0x28e3('0x4d')][_0x28e3('0x66')]?_0x272ca7[_0x28e3('0x4d')]:_0x36a882['model'];if(!_0x39e7ac[_0x28e3('0x4a')][_0x28e3('0x4f')](_0x28e3('0x6d'))){_0x272ca7['limit']=qs[_0x28e3('0x32')](_0x39e7ac[_0x28e3('0x4a')][_0x28e3('0x32')]);_0x272ca7['offset']=qs[_0x28e3('0x31')](_0x39e7ac[_0x28e3('0x4a')][_0x28e3('0x31')]);}_0x272ca7[_0x28e3('0x50')]=qs[_0x28e3('0x51')](_0x39e7ac[_0x28e3('0x4a')][_0x28e3('0x51')]);_0x272ca7[_0x28e3('0x54')]=qs[_0x28e3('0x4b')](_[_0x28e3('0x52')](_0x39e7ac[_0x28e3('0x4a')],_0x36a882['filters']));_0x272ca7['where']['MailAccountId']=_0x3e3317['id'];if(_0x39e7ac[_0x28e3('0x4a')][_0x28e3('0x53')]){_0x272ca7[_0x28e3('0x54')]=_[_0x28e3('0x55')](_0x272ca7['where'],{'$or':_['map'](_0x272ca7[_0x28e3('0x4d')],function(_0x2fd7ef){var _0x4f590c={};_0x4f590c[_0x2fd7ef]={'$like':'%'+_0x39e7ac['query'][_0x28e3('0x53')]+'%'};return _0x4f590c;})});}_0x272ca7=_[_0x28e3('0x55')]({},_0x272ca7,_0x39e7ac[_0x28e3('0x57')]);return db[_0x28e3('0x8c')][_0x28e3('0x30')]({'where':_0x272ca7[_0x28e3('0x54')]})[_0x28e3('0x22')](function(_0xd2696b){_0x2c03b3[_0x28e3('0x30')]=_0xd2696b;if(_0x39e7ac[_0x28e3('0x4a')][_0x28e3('0x58')]){_0x272ca7['include']=[{'model':db[_0x28e3('0x8e')],'as':_0x28e3('0x8f'),'required':![]},{'model':db['User'],'as':_0x28e3('0x90'),'attributes':[_0x28e3('0x3c'),_0x28e3('0x91'),_0x28e3('0x92')],'required':![]},{'model':db[_0x28e3('0x93')],'as':'Tags','attributes':['id',_0x28e3('0x3c'),_0x28e3('0x94')],'where':_0x39e7ac[_0x28e3('0x4a')][_0x28e3('0x95')]?{'id':_0x39e7ac[_0x28e3('0x4a')][_0x28e3('0x95')]}:undefined,'required':_0x39e7ac[_0x28e3('0x4a')][_0x28e3('0x95')]?!![]:![]}];}return db[_0x28e3('0x8c')]['findAll'](_0x272ca7);})[_0x28e3('0x22')](function(_0x397dee){_0x2c03b3[_0x28e3('0x68')]=_0x397dee;return _0x2c03b3;});}})[_0x28e3('0x22')](respondWithFilteredResult(_0x31dbe9,_0x272ca7))['catch'](handleError(_0x31dbe9,null));};exports['addApplications']=function(_0x2a6a5b,_0x309d50,_0x13f995){return db[_0x28e3('0x45')]['findOne']({'where':{'id':_0x2a6a5b['params']['id']}})[_0x28e3('0x22')](handleEntityNotFound(_0x309d50,null))[_0x28e3('0x22')](function(_0x11eaa5){if(_0x11eaa5){return db['sequelize']['transaction'](function(_0x2e77e2){return db[_0x28e3('0x96')][_0x28e3('0x38')]({'where':{'MailAccountId':_0x2a6a5b[_0x28e3('0x5b')]['id']},'transaction':_0x2e77e2})[_0x28e3('0x22')](function(_0x316699){var _0x4e8082=_[_0x28e3('0x44')](_0x2a6a5b[_0x28e3('0x5f')],function(_0x1f5678){_0x1f5678[_0x28e3('0x62')]=_0x2a6a5b[_0x28e3('0x5b')]['id'];return _0x1f5678;});return db[_0x28e3('0x96')][_0x28e3('0x97')](_0x4e8082,{'transaction':_0x2e77e2});});})['then'](function(){return db[_0x28e3('0x96')]['findAndCountAll']({'where':{'MailAccountId':_0x2a6a5b['params']['id']},'order':_0x28e3('0x98')});});}})[_0x28e3('0x22')](respondWithResult(_0x309d50,null))[_0x28e3('0x5a')](handleError(_0x309d50,null));};exports[_0x28e3('0x99')]=function(_0x4fe902,_0xcd40e6,_0x40bb41){var _0x1d367e={};var _0x29fb85={};var _0x3dab25;var _0x47e568;return db[_0x28e3('0x45')][_0x28e3('0x64')]({'where':{'id':_0x4fe902[_0x28e3('0x5b')]['id']}})[_0x28e3('0x22')](handleEntityNotFound(_0xcd40e6,null))[_0x28e3('0x22')](function(_0x5a7f79){if(_0x5a7f79){_0x3dab25=_0x5a7f79;_0x29fb85['model']=_[_0x28e3('0x49')](db[_0x28e3('0x96')][_0x28e3('0x5c')]);_0x29fb85[_0x28e3('0x4a')]=_[_0x28e3('0x49')](_0x4fe902[_0x28e3('0x4a')]);_0x29fb85[_0x28e3('0x4b')]=_[_0x28e3('0x4c')](_0x29fb85['model'],_0x29fb85['query']);_0x1d367e['attributes']=_[_0x28e3('0x4c')](_0x29fb85['model'],qs[_0x28e3('0x4e')](_0x4fe902['query'][_0x28e3('0x4e')]));_0x1d367e['attributes']=_0x1d367e[_0x28e3('0x4d')][_0x28e3('0x66')]?_0x1d367e[_0x28e3('0x4d')]:_0x29fb85[_0x28e3('0x48')];_0x1d367e[_0x28e3('0x50')]=qs['sort'](_0x4fe902[_0x28e3('0x4a')][_0x28e3('0x51')]);_0x1d367e[_0x28e3('0x54')]=qs[_0x28e3('0x4b')](_[_0x28e3('0x52')](_0x4fe902[_0x28e3('0x4a')],_0x29fb85[_0x28e3('0x4b')]));if(_0x4fe902[_0x28e3('0x4a')][_0x28e3('0x53')]){_0x1d367e[_0x28e3('0x54')]=_[_0x28e3('0x55')](_0x1d367e[_0x28e3('0x54')],{'$or':_[_0x28e3('0x44')](_0x1d367e['attributes'],function(_0x3564a1){var _0x46cc6b={};_0x46cc6b[_0x3564a1]={'$like':'%'+_0x4fe902[_0x28e3('0x4a')][_0x28e3('0x53')]+'%'};return _0x46cc6b;})});}_0x1d367e=_[_0x28e3('0x55')]({},_0x1d367e,_0x4fe902[_0x28e3('0x57')]);return _0x3dab25[_0x28e3('0x99')](_0x1d367e);}})[_0x28e3('0x22')](function(_0x45aa63){if(_0x45aa63){_0x47e568=_0x45aa63['length'];if(!_0x4fe902[_0x28e3('0x4a')][_0x28e3('0x4f')](_0x28e3('0x6d'))){_0x1d367e[_0x28e3('0x32')]=qs[_0x28e3('0x32')](_0x4fe902[_0x28e3('0x4a')][_0x28e3('0x32')]);_0x1d367e[_0x28e3('0x31')]=qs[_0x28e3('0x31')](_0x4fe902[_0x28e3('0x4a')][_0x28e3('0x31')]);}return _0x3dab25[_0x28e3('0x99')](_0x1d367e);}})[_0x28e3('0x22')](function(_0x55f02){if(_0x55f02){return _0x55f02?{'count':_0x47e568,'rows':_0x55f02}:null;}})[_0x28e3('0x22')](respondWithResult(_0xcd40e6,null))[_0x28e3('0x5a')](handleError(_0xcd40e6,null));};exports[_0x28e3('0x9a')]=function(_0x2d9aaf,_0x4f727d,_0x1eea4f){var _0x1168c7={'raw':!![],'where':{}};var _0x7b365e={};var _0x5647bf={'count':0x0,'rows':[]};return db[_0x28e3('0x45')][_0x28e3('0x64')]({'where':{'id':_0x2d9aaf['params']['id']}})['then'](handleEntityNotFound(_0x4f727d,null))[_0x28e3('0x22')](function(_0x164a53){if(_0x164a53){_0x7b365e[_0x28e3('0x48')]=_[_0x28e3('0x49')](db['MailMessage'][_0x28e3('0x5c')]);_0x7b365e[_0x28e3('0x4a')]=_[_0x28e3('0x49')](_0x2d9aaf[_0x28e3('0x4a')]);_0x7b365e[_0x28e3('0x4b')]=_[_0x28e3('0x4c')](_0x7b365e[_0x28e3('0x48')],_0x7b365e['query']);_0x1168c7[_0x28e3('0x4d')]=_[_0x28e3('0x4c')](_0x7b365e[_0x28e3('0x48')],qs[_0x28e3('0x4e')](_0x2d9aaf['query'][_0x28e3('0x4e')]));_0x1168c7['attributes']=_0x1168c7[_0x28e3('0x4d')][_0x28e3('0x66')]?_0x1168c7['attributes']:_0x7b365e[_0x28e3('0x48')];if(!_0x2d9aaf['query']['hasOwnProperty'](_0x28e3('0x6d'))){_0x1168c7[_0x28e3('0x32')]=qs[_0x28e3('0x32')](_0x2d9aaf[_0x28e3('0x4a')][_0x28e3('0x32')]);_0x1168c7[_0x28e3('0x31')]=qs[_0x28e3('0x31')](_0x2d9aaf[_0x28e3('0x4a')][_0x28e3('0x31')]);}_0x1168c7['order']=qs[_0x28e3('0x51')](_0x2d9aaf[_0x28e3('0x4a')]['sort']);_0x1168c7[_0x28e3('0x54')]=qs[_0x28e3('0x4b')](_[_0x28e3('0x52')](_0x2d9aaf[_0x28e3('0x4a')],_0x7b365e['filters']));_0x1168c7[_0x28e3('0x54')][_0x28e3('0x62')]=_0x164a53['id'];if(_0x2d9aaf[_0x28e3('0x4a')][_0x28e3('0x53')]){_0x1168c7[_0x28e3('0x54')]=_[_0x28e3('0x55')](_0x1168c7[_0x28e3('0x54')],{'$or':_[_0x28e3('0x44')](_0x1168c7[_0x28e3('0x4d')],function(_0x333253){var _0xa16303={};_0xa16303[_0x333253]={'$like':'%'+_0x2d9aaf[_0x28e3('0x4a')][_0x28e3('0x53')]+'%'};return _0xa16303;})});}if(_0x2d9aaf[_0x28e3('0x4a')]['$gte']){var _0x4f121f=_0x2d9aaf[_0x28e3('0x4a')][_0x28e3('0x9b')]['split'](',');var _0x405bcc={};_0x405bcc[_0x4f121f[0x0]]={'$gte':moment(_0x4f121f[0x1])['format'](_0x28e3('0x9c'))};_0x1168c7[_0x28e3('0x54')]=_[_0x28e3('0x55')](_0x1168c7['where'],_0x405bcc);}_0x1168c7=_['merge']({},_0x1168c7,_0x2d9aaf[_0x28e3('0x57')]);return db[_0x28e3('0x9d')][_0x28e3('0x30')]({'where':_0x1168c7['where']})['then'](function(_0x493b04){_0x5647bf[_0x28e3('0x30')]=_0x493b04;if(_0x2d9aaf[_0x28e3('0x4a')][_0x28e3('0x58')]){_0x1168c7[_0x28e3('0x59')]=[{'all':!![]}];}return db[_0x28e3('0x9d')][_0x28e3('0x67')](_0x1168c7);})['then'](function(_0x401422){if(_0x2d9aaf[_0x28e3('0x4a')]['inlineCss']==='true'){for(var _0x4a0ba3=0x0;_0x4a0ba3<_0x401422[_0x28e3('0x66')];_0x4a0ba3++){_0x401422[_0x4a0ba3][_0x28e3('0x5f')]=juice(_0x401422[_0x4a0ba3]['body']);}}_0x5647bf[_0x28e3('0x68')]=_0x401422;return _0x5647bf;});}})[_0x28e3('0x22')](respondWithFilteredResult(_0x4f727d,_0x1168c7))[_0x28e3('0x5a')](handleError(_0x4f727d,null));};exports[_0x28e3('0x9e')]=function(_0x48492e,_0x37febc,_0x596a26){var _0x5178b7,_0x12942e={},_0x2eaf83;if(_0x48492e[_0x28e3('0x5f')]['to']){_0x2eaf83=_0x48492e['body']['to'][_0x28e3('0x9f')](',')[0x0];}return db[_0x28e3('0x45')]['find']({'where':{'id':_0x48492e[_0x28e3('0x5b')]['id']},'include':[{'model':db[_0x28e3('0xa0')],'as':'List','include':[{'model':db[_0x28e3('0x8e')],'as':_0x28e3('0xa1'),'where':{'email':_0x2eaf83},'limit':0x1,'order':[[_0x28e3('0xa2'),'DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x28e3('0x22')](handleEntityNotFound(_0x37febc,null))[_0x28e3('0x22')](function(_0x2aa1e5){if(_0x2aa1e5){_0x5178b7=_0x2aa1e5;if(_0x2aa1e5[_0x28e3('0x41')]){if(_[_0x28e3('0x72')](_0x48492e[_0x28e3('0x5f')][_0x28e3('0xa3')])){_0x48492e['body']['from']=util[_0x28e3('0xa4')](_0x28e3('0xa5'),_0x2aa1e5[_0x28e3('0x3c')],_0x2aa1e5[_0x28e3('0x70')]||_0x2aa1e5[_0x28e3('0x41')][_0x28e3('0x76')]);}if(_0x48492e[_0x28e3('0x5f')][_0x28e3('0xa6')]&&_0x48492e[_0x28e3('0x5f')][_0x28e3('0xa6')][_0x28e3('0x66')]){for(var _0x39aff9=0x0;_0x39aff9<_0x48492e[_0x28e3('0x5f')][_0x28e3('0xa6')][_0x28e3('0x66')];_0x39aff9+=0x1){_0x48492e[_0x28e3('0x5f')][_0x28e3('0xa6')][_0x39aff9]={'filename':_0x48492e[_0x28e3('0x5f')][_0x28e3('0xa6')][_0x39aff9]['name'],'path':path[_0x28e3('0xa7')](config[_0x28e3('0xa8')],'server/files/attachments',_0x48492e[_0x28e3('0x5f')][_0x28e3('0xa6')][_0x39aff9][_0x28e3('0xa9')])};}}var _0x507345={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x2aa1e5[_0x28e3('0x41')][_0x28e3('0x7c')])){if(_0x2aa1e5['Smtp'][_0x28e3('0x79')]){_0x507345[_0x28e3('0xaa')]={'user':_0x2aa1e5[_0x28e3('0x41')][_0x28e3('0x76')],'pass':_0x2aa1e5[_0x28e3('0x41')]['pass']};}_0x507345[_0x28e3('0x7a')]=_0x2aa1e5[_0x28e3('0x41')]['host'];_0x507345[_0x28e3('0x7b')]=_0x2aa1e5[_0x28e3('0x41')]['port'];_0x507345[_0x28e3('0xab')]=_0x2aa1e5[_0x28e3('0x41')]['secure'];}else{_0x507345[_0x28e3('0x7c')]=_0x2aa1e5[_0x28e3('0x41')]['service'];_0x507345[_0x28e3('0xaa')]={'user':_0x2aa1e5[_0x28e3('0x41')][_0x28e3('0x76')],'pass':_0x2aa1e5[_0x28e3('0x41')]['pass']};}return respondWithRpcPromise(_0x28e3('0xac'),_0x28e3('0xad'),{'account':_0x507345,'message':_0x48492e[_0x28e3('0x5f')]});}else{throw new Error(_0x28e3('0xae'));}}})[_0x28e3('0x22')](function(_0x26ca79){if(_0x26ca79){_0x12942e=_0x26ca79;if(_0x5178b7[_0x28e3('0xaf')]){if(_0x5178b7[_0x28e3('0xaf')]['Contacts'][_0x28e3('0x66')]){return _0x5178b7['List'][_0x28e3('0xa1')][0x0];}else{return db[_0x28e3('0x8e')][_0x28e3('0x63')](_[_0x28e3('0x19')](_0x48492e[_0x28e3('0x5f')],{'firstName':_0x48492e[_0x28e3('0x5f')]['to'],'email':_0x48492e[_0x28e3('0x5f')]['to'],'phone':_0x48492e[_0x28e3('0x5f')]['to'],'ListId':_0x5178b7[_0x28e3('0x71')]}));}}else{throw new Error(_0x28e3('0xae'));}}})[_0x28e3('0x22')](function(_0x24cf03){if(_0x24cf03){var _0x38beaa={'UserId':_0x48492e[_0x28e3('0x76')]['id'],'ContactId':_0x24cf03['id'],'MailAccountId':_0x5178b7['id'],'inReplyTo':_0x12942e[_0x28e3('0xb0')],'to':_0x48492e[_0x28e3('0x5f')]['from'],'cc':_0x48492e[_0x28e3('0x5f')]['cc'],'subject':_0x48492e[_0x28e3('0x5f')][_0x28e3('0xb1')],'attach':_0x48492e[_0x28e3('0x5f')][_0x28e3('0xb2')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x28e3('0xa4')](_0x28e3('0x9c')),'lastMsgDirection':_0x28e3('0xb3'),'lastMsgBody':_0x48492e[_0x28e3('0x5f')][_0x28e3('0x5f')],'Messages':[_['merge'](_0x48492e['body'],{'messageId':_0x12942e[_0x28e3('0xb0')],'sentAt':moment()[_0x28e3('0xa4')](_0x28e3('0x9c')),'read':!![],'MailAccountId':_0x5178b7['id'],'UserId':_0x48492e[_0x28e3('0x76')]['id'],'ContactId':_0x24cf03['id']})]};if(_0x48492e[_0x28e3('0x5f')]['Interaction']){_0x38beaa=_[_0x28e3('0x55')](_0x38beaa,_0x48492e[_0x28e3('0x5f')]['Interaction']);}return db['MailInteraction'][_0x28e3('0x63')](_0x38beaa,{'include':[{'model':db[_0x28e3('0x9d')],'as':_0x28e3('0xb4')}]});}})[_0x28e3('0x22')](respondWithResult(_0x37febc,null))[_0x28e3('0x5a')](handleError(_0x37febc,null));};exports['verifySmtp']=function(_0xbacd7c,_0x3fb688,_0x4109ce){return db[_0x28e3('0x45')]['find']({'where':{'id':_0xbacd7c['params']['id']},'include':[{'model':db[_0x28e3('0x40')],'as':_0x28e3('0x41'),'raw':!![]}]})[_0x28e3('0x22')](handleEntityNotFound(_0x3fb688,null))[_0x28e3('0x22')](function(_0x5dab11){if(_0x5dab11&&_0x5dab11[_0x28e3('0x41')]){var _0x3cd06c={'id':_0x5dab11['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5dab11['Smtp'][_0x28e3('0x7c')]){_0x3cd06c[_0x28e3('0x7c')]=_0x5dab11[_0x28e3('0x41')][_0x28e3('0x7c')];}else{_0x3cd06c[_0x28e3('0x7a')]=_0x5dab11[_0x28e3('0x41')][_0x28e3('0x7a')];_0x3cd06c[_0x28e3('0x7b')]=_0x5dab11[_0x28e3('0x41')][_0x28e3('0x7b')];_0x3cd06c[_0x28e3('0xab')]=_0x5dab11[_0x28e3('0x41')][_0x28e3('0xab')];}if(_0x5dab11[_0x28e3('0x41')]['authentication']){_0x3cd06c[_0x28e3('0xaa')]={'user':_0x5dab11[_0x28e3('0x41')][_0x28e3('0x76')],'pass':_0x5dab11[_0x28e3('0x41')][_0x28e3('0x77')]};}return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x3cd06c});}})[_0x28e3('0x22')](respondWithResult(_0x3fb688,null))['catch'](handleError(_0x3fb688,null));};exports[_0x28e3('0x38')]=function(_0x4aeb10,_0x16a72f){return db['MailAccount'][_0x28e3('0x5d')]({'where':{'id':_0x4aeb10[_0x28e3('0x5b')]['id']}})['then'](handleEntityNotFound(_0x16a72f,null))['then'](function(_0x1c8938){if(_0x1c8938&&_0x1c8938[_0x28e3('0x7c')]){throw new db['Sequelize'][(_0x28e3('0xb5'))](_0x28e3('0xb6'));}return _0x1c8938;})[_0x28e3('0x22')](removeEntity(_0x16a72f,null))[_0x28e3('0x5a')](handleError(_0x16a72f,null));};exports[_0x28e3('0xb7')]=function(_0x494ab2,_0x2212a9,_0x39cc4c){return db['MailAccount'][_0x28e3('0x5d')]({'where':{'id':_0x494ab2['params']['id']}})[_0x28e3('0x22')](handleEntityNotFound(_0x2212a9,null))[_0x28e3('0x22')](function(_0x594679){if(_0x594679){return _0x594679['addAgents'](_0x494ab2['body'][_0x28e3('0x6a')],_[_0x28e3('0xb8')](_0x494ab2[_0x28e3('0x5f')],[_0x28e3('0x6a'),'id'])||{})[_0x28e3('0xb9')](function(_0x4e5d99){for(var _0x45bfed=0x0;_0x45bfed<_0x494ab2[_0x28e3('0x5f')][_0x28e3('0x6a')][_0x28e3('0x66')];_0x45bfed+=0x1){socket[_0x28e3('0xba')](_0x28e3('0xbb'),{'UserId':_0x494ab2[_0x28e3('0x5f')][_0x28e3('0x6a')][_0x45bfed],'MailAccountId':_0x494ab2['params']['id']});}return _0x4e5d99;});}})[_0x28e3('0x22')](respondWithResult(_0x2212a9,null))[_0x28e3('0x5a')](handleError(_0x2212a9,null));};exports[_0x28e3('0xbc')]=function(_0x4f1081,_0x3cf477,_0x2de7a6){return db[_0x28e3('0x45')][_0x28e3('0x5d')]({'where':{'id':_0x4f1081[_0x28e3('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3cf477,null))[_0x28e3('0x22')](function(_0x512c70){if(_0x512c70){return _0x512c70[_0x28e3('0xbc')](_0x4f1081[_0x28e3('0x4a')][_0x28e3('0x6a')])[_0x28e3('0x22')](function(){if(_[_0x28e3('0xbd')](_0x4f1081['query']['ids'])){for(var _0x2894e1=0x0;_0x2894e1<_0x4f1081['query'][_0x28e3('0x6a')][_0x28e3('0x66')];_0x2894e1+=0x1){socket[_0x28e3('0xba')](_0x28e3('0xbe'),{'UserId':Number(_0x4f1081[_0x28e3('0x4a')][_0x28e3('0x6a')][_0x2894e1]),'MailAccountId':Number(_0x4f1081[_0x28e3('0x5b')]['id'])});}}else{socket['emit'](_0x28e3('0xbe'),{'UserId':Number(_0x4f1081[_0x28e3('0x4a')][_0x28e3('0x6a')]),'MailAccountId':Number(_0x4f1081[_0x28e3('0x5b')]['id'])});}});}})[_0x28e3('0x22')](respondWithStatusCode(_0x3cf477,null))['catch'](handleError(_0x3cf477,null));};exports[_0x28e3('0xbf')]=function(_0x30c73b,_0x578a12,_0x2bef60){var _0x3f6252={};var _0x216bb3={};var _0x5abfd0;var _0x379ed0;return db[_0x28e3('0x45')]['findOne']({'where':{'id':_0x30c73b['params']['id']}})[_0x28e3('0x22')](handleEntityNotFound(_0x578a12,null))[_0x28e3('0x22')](function(_0x1051b5){if(_0x1051b5){_0x5abfd0=_0x1051b5;_0x216bb3[_0x28e3('0x48')]=_[_0x28e3('0x49')](db[_0x28e3('0xc0')][_0x28e3('0x5c')]);_0x216bb3['query']=_[_0x28e3('0x49')](_0x30c73b[_0x28e3('0x4a')]);_0x216bb3[_0x28e3('0x4b')]=_['intersection'](_0x216bb3[_0x28e3('0x48')],_0x216bb3['query']);_0x3f6252[_0x28e3('0x4d')]=_['intersection'](_0x216bb3[_0x28e3('0x48')],qs['fields'](_0x30c73b[_0x28e3('0x4a')][_0x28e3('0x4e')]));_0x3f6252['attributes']=_0x3f6252['attributes'][_0x28e3('0x66')]?_0x3f6252[_0x28e3('0x4d')]:_0x216bb3[_0x28e3('0x48')];_0x3f6252['order']=qs['sort'](_0x30c73b[_0x28e3('0x4a')][_0x28e3('0x51')]);_0x3f6252['where']=qs[_0x28e3('0x4b')](_[_0x28e3('0x52')](_0x30c73b[_0x28e3('0x4a')],_0x216bb3[_0x28e3('0x4b')]));if(_0x30c73b[_0x28e3('0x4a')][_0x28e3('0x53')]){_0x3f6252[_0x28e3('0x54')]=_['merge'](_0x3f6252[_0x28e3('0x54')],{'$or':_['map'](_0x3f6252['attributes'],function(_0x33c2e6){var _0x30e7b0={};_0x30e7b0[_0x33c2e6]={'$like':'%'+_0x30c73b['query'][_0x28e3('0x53')]+'%'};return _0x30e7b0;})});}_0x3f6252=_['merge']({},_0x3f6252,_0x30c73b[_0x28e3('0x57')]);return _0x5abfd0[_0x28e3('0xbf')](_0x3f6252);}})[_0x28e3('0x22')](function(_0x36cee0){if(_0x36cee0){_0x379ed0=_0x36cee0[_0x28e3('0x66')];if(!_0x30c73b[_0x28e3('0x4a')][_0x28e3('0x4f')](_0x28e3('0x6d'))){_0x3f6252['limit']=qs[_0x28e3('0x32')](_0x30c73b[_0x28e3('0x4a')][_0x28e3('0x32')]);_0x3f6252[_0x28e3('0x31')]=qs[_0x28e3('0x31')](_0x30c73b[_0x28e3('0x4a')][_0x28e3('0x31')]);}return _0x5abfd0['getAgents'](_0x3f6252);}})[_0x28e3('0x22')](function(_0x11cdd6){if(_0x11cdd6){return _0x11cdd6?{'count':_0x379ed0,'rows':_0x11cdd6}:null;}})['then'](respondWithResult(_0x578a12,null))[_0x28e3('0x5a')](handleError(_0x578a12,null));}; \ No newline at end of file +var _0x5a0b=['includeAll','include','findAll','rows','params','Smtp','options','find','body','Imap','describe','Disposition','create','getDispositions','filter','removeDispositions','addAnswer','MailAccountId','CannedAnswer','removeAnswers','ids','email','ListId','isNil','active','cservice','cauthentication','user','cuser','password','cpassword','authentication','host','port','service','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','getImap','findOne','addImap','removeImap','removeSmtp','setSmtp','MailInteraction','addInteraction','Contact','User','fullname','color','tag','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','CmList','List','CmContact','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','Contacts','defaults','messageId','subject','attach','out','Interaction','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','html-to-text','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','merge','VIRTUAL'];(function(_0x17706d,_0x5a3500){var _0x40251f=function(_0x10f66e){while(--_0x10f66e){_0x17706d['push'](_0x17706d['shift']());}};_0x40251f(++_0x5a3500);}(_0x5a0b,0x68));var _0xb5a0=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x5a0b[_0x29b609];return _0x54c952;};'use strict';var pdf=require(_0xb5a0('0x0'));var emlformat=require(_0xb5a0('0x1'));var rimraf=require(_0xb5a0('0x2'));var zipdir=require(_0xb5a0('0x3'));var jsonpatch=require(_0xb5a0('0x4'));var rp=require('request-promise');var moment=require(_0xb5a0('0x5'));var BPromise=require(_0xb5a0('0x6'));var Mustache=require(_0xb5a0('0x7'));var util=require('util');var path=require(_0xb5a0('0x8'));var sox=require(_0xb5a0('0x9'));var csv=require(_0xb5a0('0xa'));var ejs=require(_0xb5a0('0xb'));var fs=require('fs');var _=require(_0xb5a0('0xc'));var squel=require(_0xb5a0('0xd'));var crypto=require('crypto');var jsforce=require(_0xb5a0('0xe'));var deskjs=require(_0xb5a0('0xf'));var toCsv=require(_0xb5a0('0xa'));var querystring=require(_0xb5a0('0x10'));var Papa=require(_0xb5a0('0x11'));var htmlToText=require(_0xb5a0('0x12'));var juice=require('juice');var Redis=require(_0xb5a0('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb5a0('0x14'));var as=require(_0xb5a0('0x15'));var hardwareService=require(_0xb5a0('0x16'));var logger=require(_0xb5a0('0x17'))(_0xb5a0('0x18'));var utils=require('../../config/utils');var config=require(_0xb5a0('0x19'));var licenseUtil=require(_0xb5a0('0x1a'));var db=require(_0xb5a0('0x1b'))['db'];config[_0xb5a0('0x1c')]=_['defaults'](config[_0xb5a0('0x1c')],{'host':_0xb5a0('0x1d'),'port':0x18eb});var socket=require(_0xb5a0('0x1e'))(new Redis(config[_0xb5a0('0x1c')]));require(_0xb5a0('0x1f'))[_0xb5a0('0x20')](socket);var jayson=require(_0xb5a0('0x21'));var client=jayson['client'][_0xb5a0('0x22')]({'port':0x232b});function respondWithRpcPromise(_0x4b9b69,_0xc4ae10,_0x50e008,_0x1e7cbb){return new BPromise(function(_0x1d9e8f,_0x4d7c72){var _0x28be8f=_0x1e7cbb||client;return _0x28be8f[_0xb5a0('0x23')](_0x4b9b69,_0x50e008)[_0xb5a0('0x24')](function(_0xcde165){logger[_0xb5a0('0x25')]('MailAccount,\x20%s,\x20%s',_0xc4ae10,_0xb5a0('0x26'));logger[_0xb5a0('0x27')](_0xb5a0('0x28'),_0xc4ae10,'request\x20sent',JSON[_0xb5a0('0x29')](_0xcde165));if(_0xcde165[_0xb5a0('0x2a')]){if(_0xcde165['error'][_0xb5a0('0x2b')]===0x1f4){logger[_0xb5a0('0x2a')](_0xb5a0('0x2c'),_0xc4ae10,_0xcde165[_0xb5a0('0x2a')][_0xb5a0('0x2d')]);return _0x4d7c72(_0xcde165['error'][_0xb5a0('0x2d')]);}logger[_0xb5a0('0x2a')](_0xb5a0('0x2c'),_0xc4ae10,_0xcde165[_0xb5a0('0x2a')]['message']);return _0x1d9e8f(_0xcde165[_0xb5a0('0x2a')][_0xb5a0('0x2d')]);}else{logger[_0xb5a0('0x25')](_0xb5a0('0x2c'),_0xc4ae10,_0xb5a0('0x26'));_0x1d9e8f(_0xcde165['result']['message']);}})[_0xb5a0('0x2e')](function(_0x198d5e){logger[_0xb5a0('0x2a')](_0xb5a0('0x2c'),_0xc4ae10,_0x198d5e);_0x4d7c72(_0x198d5e);});});}function respondWithStatusCode(_0x1fe85e,_0x5733d9){_0x5733d9=_0x5733d9||0xcc;return function(_0x2870bf){if(_0x2870bf){return _0x1fe85e[_0xb5a0('0x2f')](_0x5733d9);}return _0x1fe85e[_0xb5a0('0x30')](_0x5733d9)[_0xb5a0('0x31')]();};}function respondWithResult(_0x3b8ccb,_0x5213ad){_0x5213ad=_0x5213ad||0xc8;return function(_0x13dd52){if(_0x13dd52){return _0x3b8ccb[_0xb5a0('0x30')](_0x5213ad)[_0xb5a0('0x32')](_0x13dd52);}};}function respondWithFilteredResult(_0x155c92,_0x164981){return function(_0x483e33){if(_0x483e33){var _0x54b0a4=_0x483e33[_0xb5a0('0x33')],_0x319f7e=_0x164981['offset'],_0x3f9c5e=_0x164981[_0xb5a0('0x34')]+_0x164981['limit'],_0x2d424d;if(_0x3f9c5e>=_0x54b0a4){_0x3f9c5e=_0x54b0a4;_0x2d424d=0xc8;}else{_0x2d424d=0xce;}_0x155c92[_0xb5a0('0x30')](_0x2d424d);return _0x155c92[_0xb5a0('0x35')](_0xb5a0('0x36'),_0x319f7e+'-'+_0x3f9c5e+'/'+_0x54b0a4)['json'](_0x483e33);}return null;};}function patchUpdates(_0x33a2da){return function(_0x5091b4){try{jsonpatch[_0xb5a0('0x37')](_0x5091b4,_0x33a2da,!![]);}catch(_0x240589){return BPromise[_0xb5a0('0x38')](_0x240589);}return _0x5091b4['save']();};}function saveUpdates(_0x2e1f34,_0x58e613){return function(_0x452f67){if(_0x452f67){return _0x452f67[_0xb5a0('0x39')](_0x2e1f34)[_0xb5a0('0x24')](function(_0x299e4e){return _0x299e4e;});}return null;};}function removeEntity(_0x166c85,_0x2a167d){return function(_0xe8a128){if(_0xe8a128){return _0xe8a128[_0xb5a0('0x3a')]()[_0xb5a0('0x24')](function(){var _0x2f6963=_0xe8a128[_0xb5a0('0x3b')]({'plain':!![]});var _0x1aa41e=_0xb5a0('0x3c');return db[_0xb5a0('0x3d')][_0xb5a0('0x3a')]({'where':{'type':_0x1aa41e,'resourceId':_0x2f6963['id']}})[_0xb5a0('0x24')](function(){return _0xe8a128;});})[_0xb5a0('0x24')](function(){_0x166c85[_0xb5a0('0x30')](0xcc)[_0xb5a0('0x31')]();});}};}function handleEntityNotFound(_0x10f874,_0x159446){return function(_0x59432d){if(!_0x59432d){_0x10f874[_0xb5a0('0x2f')](0x194);}return _0x59432d;};}function handleError(_0x2a6096,_0x56a9df){_0x56a9df=_0x56a9df||0x1f4;return function(_0x49ad7b){logger[_0xb5a0('0x2a')](_0x49ad7b[_0xb5a0('0x3e')]);if(_0x49ad7b[_0xb5a0('0x3f')]){delete _0x49ad7b['name'];}_0x2a6096[_0xb5a0('0x30')](_0x56a9df)[_0xb5a0('0x40')](_0x49ad7b);};}exports[_0xb5a0('0x41')]=function(_0xc8ebb0,_0x609ac1){var _0x53df91={'include':[{'model':db[_0xb5a0('0x42')],'as':'Imap'},{'model':db[_0xb5a0('0x43')],'as':'Smtp'},{'model':db[_0xb5a0('0x44')],'as':_0xb5a0('0x45')}]},_0xdcbae2={},_0x18b69d={'count':0x0,'rows':[]};var _0x17a28f=_['map'](db[_0xb5a0('0x46')][_0xb5a0('0x47')],function(_0x427da3){return{'name':_0x427da3[_0xb5a0('0x48')],'type':_0x427da3[_0xb5a0('0x49')]['key']};});_0xdcbae2[_0xb5a0('0x4a')]=_[_0xb5a0('0x4b')](_0x17a28f,_0xb5a0('0x3f'));_0xdcbae2[_0xb5a0('0x4c')]=_[_0xb5a0('0x4d')](_0xc8ebb0[_0xb5a0('0x4c')]);_0xdcbae2['filters']=_[_0xb5a0('0x4e')](_0xdcbae2[_0xb5a0('0x4a')],_0xdcbae2[_0xb5a0('0x4c')]);_0x53df91['attributes']=_[_0xb5a0('0x4e')](_0xdcbae2['model'],qs[_0xb5a0('0x4f')](_0xc8ebb0[_0xb5a0('0x4c')]['fields']));_0x53df91[_0xb5a0('0x50')]=_0x53df91[_0xb5a0('0x50')][_0xb5a0('0x51')]?_0x53df91[_0xb5a0('0x50')]:_0xdcbae2[_0xb5a0('0x4a')];if(!_0xc8ebb0[_0xb5a0('0x4c')][_0xb5a0('0x52')](_0xb5a0('0x53'))){_0x53df91[_0xb5a0('0x54')]=qs[_0xb5a0('0x54')](_0xc8ebb0[_0xb5a0('0x4c')][_0xb5a0('0x54')]);_0x53df91['offset']=qs[_0xb5a0('0x34')](_0xc8ebb0[_0xb5a0('0x4c')][_0xb5a0('0x34')]);}_0x53df91[_0xb5a0('0x55')]=qs[_0xb5a0('0x56')](_0xc8ebb0[_0xb5a0('0x4c')][_0xb5a0('0x56')]);_0x53df91[_0xb5a0('0x57')]=qs['filters'](_[_0xb5a0('0x58')](_0xc8ebb0[_0xb5a0('0x4c')],_0xdcbae2[_0xb5a0('0x59')]),_0x17a28f);if(_0xc8ebb0['query']['filter']){_0x53df91[_0xb5a0('0x57')]=_[_0xb5a0('0x5a')](_0x53df91['where'],{'$or':_[_0xb5a0('0x4b')](_0x17a28f,function(_0x513098){if(_0x513098[_0xb5a0('0x49')]!==_0xb5a0('0x5b')){var _0x42408b={};_0x42408b[_0x513098['name']]={'$like':'%'+_0xc8ebb0[_0xb5a0('0x4c')]['filter']+'%'};return _0x42408b;}})});}_0x53df91=_[_0xb5a0('0x5a')]({},_0x53df91,_0xc8ebb0['options']);var _0x1c23f5={'where':_0x53df91[_0xb5a0('0x57')]};return db[_0xb5a0('0x46')][_0xb5a0('0x33')](_0x1c23f5)[_0xb5a0('0x24')](function(_0x5f1f18){_0x18b69d[_0xb5a0('0x33')]=_0x5f1f18;if(_0xc8ebb0[_0xb5a0('0x4c')][_0xb5a0('0x5c')]){_0x53df91[_0xb5a0('0x5d')]=[{'all':!![]}];}return db[_0xb5a0('0x46')][_0xb5a0('0x5e')](_0x53df91);})[_0xb5a0('0x24')](function(_0x5b13ab){_0x18b69d[_0xb5a0('0x5f')]=_0x5b13ab;return _0x18b69d;})[_0xb5a0('0x24')](respondWithFilteredResult(_0x609ac1,_0x53df91))['catch'](handleError(_0x609ac1,null));};exports['show']=function(_0x242e73,_0xcffe7){var _0x35020c={'raw':![],'where':{'id':_0x242e73[_0xb5a0('0x60')]['id']},'include':[{'model':db[_0xb5a0('0x42')],'as':'Imap'},{'model':db[_0xb5a0('0x43')],'as':_0xb5a0('0x61')},{'model':db['Pause'],'as':_0xb5a0('0x45')}]},_0x5385c5={};_0x5385c5['model']=_[_0xb5a0('0x4d')](db[_0xb5a0('0x46')][_0xb5a0('0x47')]);_0x5385c5[_0xb5a0('0x4c')]=_['keys'](_0x242e73[_0xb5a0('0x4c')]);_0x5385c5[_0xb5a0('0x59')]=_[_0xb5a0('0x4e')](_0x5385c5[_0xb5a0('0x4a')],_0x5385c5[_0xb5a0('0x4c')]);_0x35020c[_0xb5a0('0x50')]=_[_0xb5a0('0x4e')](_0x5385c5['model'],qs[_0xb5a0('0x4f')](_0x242e73[_0xb5a0('0x4c')][_0xb5a0('0x4f')]));_0x35020c[_0xb5a0('0x50')]=_0x35020c[_0xb5a0('0x50')][_0xb5a0('0x51')]?_0x35020c['attributes']:_0x5385c5[_0xb5a0('0x4a')];if(_0x242e73[_0xb5a0('0x4c')][_0xb5a0('0x5c')]){_0x35020c[_0xb5a0('0x5d')]=[{'all':!![]}];}_0x35020c=_[_0xb5a0('0x5a')]({},_0x35020c,_0x242e73[_0xb5a0('0x62')]);return db[_0xb5a0('0x46')][_0xb5a0('0x63')](_0x35020c)['then'](handleEntityNotFound(_0xcffe7,null))[_0xb5a0('0x24')](respondWithResult(_0xcffe7,null))[_0xb5a0('0x2e')](handleError(_0xcffe7,null));};exports[_0xb5a0('0x39')]=function(_0x16f105,_0x1e6c58){if(_0x16f105['body']['id']){delete _0x16f105[_0xb5a0('0x64')]['id'];}return db[_0xb5a0('0x46')]['find']({'where':{'id':_0x16f105['params']['id']},'include':[{'model':db[_0xb5a0('0x42')],'as':_0xb5a0('0x65')},{'model':db[_0xb5a0('0x43')],'as':_0xb5a0('0x61')},{'model':db[_0xb5a0('0x44')],'as':'mandatoryDispositionPause'}]})[_0xb5a0('0x24')](handleEntityNotFound(_0x1e6c58,null))['then'](saveUpdates(_0x16f105['body'],null))[_0xb5a0('0x24')](function(_0x58da8a){if(_0x58da8a&&_0x16f105[_0xb5a0('0x64')][_0xb5a0('0x65')]){return db[_0xb5a0('0x42')][_0xb5a0('0x39')](_0x16f105[_0xb5a0('0x64')][_0xb5a0('0x65')],{'where':{'MailAccountId':_0x58da8a['id']}})[_0xb5a0('0x24')](function(){return _0x58da8a;});}return _0x58da8a;})['then'](function(_0x2a6b1e){if(_0x2a6b1e&&_0x16f105[_0xb5a0('0x64')]['Smtp']){return db[_0xb5a0('0x43')]['update'](_0x16f105[_0xb5a0('0x64')][_0xb5a0('0x61')],{'where':{'MailAccountId':_0x2a6b1e['id']}})[_0xb5a0('0x24')](function(){return _0x2a6b1e;});}return _0x2a6b1e;})['then'](respondWithResult(_0x1e6c58,null))[_0xb5a0('0x2e')](handleError(_0x1e6c58,null));};exports[_0xb5a0('0x66')]=function(_0x145b11,_0x5a794d){return db[_0xb5a0('0x46')][_0xb5a0('0x66')]()[_0xb5a0('0x24')](respondWithResult(_0x5a794d,null))[_0xb5a0('0x2e')](handleError(_0x5a794d,null));};exports['addDisposition']=function(_0x38c3b4,_0x4a6801,_0xa61ee1){if(_0x38c3b4[_0xb5a0('0x64')]['id']){delete _0x38c3b4['body']['id'];}return db[_0xb5a0('0x46')][_0xb5a0('0x63')]({'where':{'id':_0x38c3b4[_0xb5a0('0x60')]['id']}})['then'](handleEntityNotFound(_0x4a6801,null))[_0xb5a0('0x24')](function(_0xe5119f){if(_0xe5119f){_0x38c3b4[_0xb5a0('0x64')]['MailAccountId']=_0xe5119f['id'];return db[_0xb5a0('0x67')][_0xb5a0('0x68')](_0x38c3b4[_0xb5a0('0x64')]);}})[_0xb5a0('0x24')](respondWithResult(_0x4a6801,null))[_0xb5a0('0x2e')](handleError(_0x4a6801,null));};exports[_0xb5a0('0x69')]=function(_0x5e35b8,_0x5f3db0,_0x5c2140){var _0x17aa34={'raw':![],'where':{}};var _0x5819c2={};var _0x260726={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x5e35b8[_0xb5a0('0x60')]['id']}})[_0xb5a0('0x24')](handleEntityNotFound(_0x5f3db0,null))['then'](function(_0x5837e2){if(_0x5837e2){_0x5819c2[_0xb5a0('0x4a')]=_[_0xb5a0('0x4d')](db[_0xb5a0('0x67')]['rawAttributes']);_0x5819c2['query']=_[_0xb5a0('0x4d')](_0x5e35b8[_0xb5a0('0x4c')]);_0x5819c2['filters']=_[_0xb5a0('0x4e')](_0x5819c2[_0xb5a0('0x4a')],_0x5819c2['query']);_0x17aa34[_0xb5a0('0x50')]=_[_0xb5a0('0x4e')](_0x5819c2[_0xb5a0('0x4a')],qs[_0xb5a0('0x4f')](_0x5e35b8[_0xb5a0('0x4c')][_0xb5a0('0x4f')]));_0x17aa34[_0xb5a0('0x50')]=_0x17aa34[_0xb5a0('0x50')]['length']?_0x17aa34[_0xb5a0('0x50')]:_0x5819c2[_0xb5a0('0x4a')];if(!_0x5e35b8[_0xb5a0('0x4c')][_0xb5a0('0x52')](_0xb5a0('0x53'))){_0x17aa34[_0xb5a0('0x54')]=qs[_0xb5a0('0x54')](_0x5e35b8[_0xb5a0('0x4c')][_0xb5a0('0x54')]);_0x17aa34[_0xb5a0('0x34')]=qs[_0xb5a0('0x34')](_0x5e35b8[_0xb5a0('0x4c')][_0xb5a0('0x34')]);}_0x17aa34[_0xb5a0('0x55')]=qs[_0xb5a0('0x56')](_0x5e35b8['query'][_0xb5a0('0x56')]);_0x17aa34[_0xb5a0('0x57')]=qs['filters'](_[_0xb5a0('0x58')](_0x5e35b8[_0xb5a0('0x4c')],_0x5819c2[_0xb5a0('0x59')]));_0x17aa34['where']['MailAccountId']=_0x5837e2['id'];if(_0x5e35b8[_0xb5a0('0x4c')][_0xb5a0('0x6a')]){_0x17aa34[_0xb5a0('0x57')]=_['merge'](_0x17aa34[_0xb5a0('0x57')],{'$or':_['map'](_0x17aa34[_0xb5a0('0x50')],function(_0x32478b){var _0x578507={};_0x578507[_0x32478b]={'$like':'%'+_0x5e35b8['query']['filter']+'%'};return _0x578507;})});}_0x17aa34=_[_0xb5a0('0x5a')]({},_0x17aa34,_0x5e35b8[_0xb5a0('0x62')]);return db[_0xb5a0('0x67')][_0xb5a0('0x33')]({'where':_0x17aa34[_0xb5a0('0x57')]})[_0xb5a0('0x24')](function(_0x1f0b2c){_0x260726[_0xb5a0('0x33')]=_0x1f0b2c;if(_0x5e35b8[_0xb5a0('0x4c')][_0xb5a0('0x5c')]){_0x17aa34[_0xb5a0('0x5d')]=[{'all':!![]}];}return db['Disposition'][_0xb5a0('0x5e')](_0x17aa34);})[_0xb5a0('0x24')](function(_0x44f8a7){_0x260726[_0xb5a0('0x5f')]=_0x44f8a7;return _0x260726;});}})[_0xb5a0('0x24')](respondWithFilteredResult(_0x5f3db0,_0x17aa34))['catch'](handleError(_0x5f3db0,null));};exports['removeDispositions']=function(_0x3fadc9,_0x3588a8,_0x563144){return db[_0xb5a0('0x46')][_0xb5a0('0x63')]({'where':{'id':_0x3fadc9['params']['id']}})[_0xb5a0('0x24')](handleEntityNotFound(_0x3588a8,null))[_0xb5a0('0x24')](function(_0x1204cf){if(_0x1204cf){return _0x1204cf[_0xb5a0('0x6b')](_0x3fadc9[_0xb5a0('0x4c')]['ids']);}})[_0xb5a0('0x24')](respondWithStatusCode(_0x3588a8,null))[_0xb5a0('0x2e')](handleError(_0x3588a8,null));};exports[_0xb5a0('0x6c')]=function(_0x407f47,_0x358875,_0x5acdcb){if(_0x407f47['body']['id']){delete _0x407f47[_0xb5a0('0x64')]['id'];}return db[_0xb5a0('0x46')][_0xb5a0('0x63')]({'where':{'id':_0x407f47['params']['id']}})['then'](handleEntityNotFound(_0x358875,null))[_0xb5a0('0x24')](function(_0x588229){if(_0x588229){_0x407f47[_0xb5a0('0x64')][_0xb5a0('0x6d')]=_0x588229['id'];return db[_0xb5a0('0x6e')][_0xb5a0('0x68')](_0x407f47['body']);}})[_0xb5a0('0x24')](respondWithResult(_0x358875,null))[_0xb5a0('0x2e')](handleError(_0x358875,null));};exports['getAnswers']=function(_0x25d405,_0x2908cf,_0x2a1703){var _0x18586a={'raw':![],'where':{}};var _0x4019fc={};var _0x3478ce={'count':0x0,'rows':[]};return db[_0xb5a0('0x46')]['findOne']({'where':{'id':_0x25d405[_0xb5a0('0x60')]['id']}})[_0xb5a0('0x24')](handleEntityNotFound(_0x2908cf,null))[_0xb5a0('0x24')](function(_0x59b09f){if(_0x59b09f){_0x4019fc[_0xb5a0('0x4a')]=_['keys'](db[_0xb5a0('0x6e')][_0xb5a0('0x47')]);_0x4019fc[_0xb5a0('0x4c')]=_['keys'](_0x25d405['query']);_0x4019fc[_0xb5a0('0x59')]=_[_0xb5a0('0x4e')](_0x4019fc[_0xb5a0('0x4a')],_0x4019fc[_0xb5a0('0x4c')]);_0x18586a[_0xb5a0('0x50')]=_[_0xb5a0('0x4e')](_0x4019fc[_0xb5a0('0x4a')],qs[_0xb5a0('0x4f')](_0x25d405[_0xb5a0('0x4c')][_0xb5a0('0x4f')]));_0x18586a['attributes']=_0x18586a[_0xb5a0('0x50')][_0xb5a0('0x51')]?_0x18586a['attributes']:_0x4019fc[_0xb5a0('0x4a')];if(!_0x25d405[_0xb5a0('0x4c')]['hasOwnProperty'](_0xb5a0('0x53'))){_0x18586a[_0xb5a0('0x54')]=qs[_0xb5a0('0x54')](_0x25d405['query'][_0xb5a0('0x54')]);_0x18586a[_0xb5a0('0x34')]=qs[_0xb5a0('0x34')](_0x25d405['query'][_0xb5a0('0x34')]);}_0x18586a[_0xb5a0('0x55')]=qs[_0xb5a0('0x56')](_0x25d405['query'][_0xb5a0('0x56')]);_0x18586a['where']=qs[_0xb5a0('0x59')](_[_0xb5a0('0x58')](_0x25d405[_0xb5a0('0x4c')],_0x4019fc[_0xb5a0('0x59')]));_0x18586a[_0xb5a0('0x57')][_0xb5a0('0x6d')]=_0x59b09f['id'];if(_0x25d405[_0xb5a0('0x4c')]['filter']){_0x18586a[_0xb5a0('0x57')]=_[_0xb5a0('0x5a')](_0x18586a[_0xb5a0('0x57')],{'$or':_['map'](_0x18586a['attributes'],function(_0x3d2760){var _0x301abe={};_0x301abe[_0x3d2760]={'$like':'%'+_0x25d405[_0xb5a0('0x4c')][_0xb5a0('0x6a')]+'%'};return _0x301abe;})});}_0x18586a=_['merge']({},_0x18586a,_0x25d405[_0xb5a0('0x62')]);return db[_0xb5a0('0x6e')][_0xb5a0('0x33')]({'where':_0x18586a['where']})[_0xb5a0('0x24')](function(_0x415a0f){_0x3478ce[_0xb5a0('0x33')]=_0x415a0f;if(_0x25d405[_0xb5a0('0x4c')][_0xb5a0('0x5c')]){_0x18586a['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xb5a0('0x5e')](_0x18586a);})[_0xb5a0('0x24')](function(_0x479ad7){_0x3478ce['rows']=_0x479ad7;return _0x3478ce;});}})['then'](respondWithFilteredResult(_0x2908cf,_0x18586a))[_0xb5a0('0x2e')](handleError(_0x2908cf,null));};exports[_0xb5a0('0x6f')]=function(_0x41e646,_0x3a8eaf,_0x3a87fa){return db['MailAccount'][_0xb5a0('0x63')]({'where':{'id':_0x41e646[_0xb5a0('0x60')]['id']}})[_0xb5a0('0x24')](handleEntityNotFound(_0x3a8eaf,null))[_0xb5a0('0x24')](function(_0x2adb4b){if(_0x2adb4b){return _0x2adb4b[_0xb5a0('0x6f')](_0x41e646['query'][_0xb5a0('0x70')]);}})[_0xb5a0('0x24')](respondWithStatusCode(_0x3a8eaf,null))[_0xb5a0('0x2e')](handleError(_0x3a8eaf,null));};exports['create']=function(_0x6a045e,_0x2c4d85){var _0x338ae9={'name':_0x6a045e['body'][_0xb5a0('0x3f')],'key':_0x6a045e[_0xb5a0('0x64')]['key'],'email':_0x6a045e[_0xb5a0('0x64')][_0xb5a0('0x71')],'ListId':_0x6a045e[_0xb5a0('0x64')][_0xb5a0('0x72')],'active':!_[_0xb5a0('0x73')](_0x6a045e[_0xb5a0('0x64')][_0xb5a0('0x74')])?_0x6a045e[_0xb5a0('0x64')]['active']:!![],'description':_0x6a045e[_0xb5a0('0x64')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0xb5a0('0x73')](_0x6a045e[_0xb5a0('0x64')][_0xb5a0('0x75')])){if(_0x6a045e[_0xb5a0('0x64')][_0xb5a0('0x76')]){_0x338ae9[_0xb5a0('0x65')][_0xb5a0('0x77')]=_0x338ae9['Smtp']['user']=_0x6a045e[_0xb5a0('0x64')][_0xb5a0('0x78')];_0x338ae9[_0xb5a0('0x65')][_0xb5a0('0x79')]=_0x338ae9[_0xb5a0('0x61')]['pass']=_0x6a045e['body'][_0xb5a0('0x7a')];}else{_0x338ae9['Imap']['authentication']=_0x338ae9[_0xb5a0('0x61')][_0xb5a0('0x7b')]=![];}_0x338ae9[_0xb5a0('0x65')][_0xb5a0('0x7c')]=_0x6a045e[_0xb5a0('0x64')][_0xb5a0('0x65')]['host'];_0x338ae9[_0xb5a0('0x65')][_0xb5a0('0x7d')]=_0x6a045e[_0xb5a0('0x64')][_0xb5a0('0x65')][_0xb5a0('0x7d')];_0x338ae9[_0xb5a0('0x61')][_0xb5a0('0x7c')]=_0x6a045e[_0xb5a0('0x64')][_0xb5a0('0x61')]['host'];_0x338ae9[_0xb5a0('0x61')]['port']=_0x6a045e['body'][_0xb5a0('0x61')][_0xb5a0('0x7d')];}else{_0x338ae9[_0xb5a0('0x65')][_0xb5a0('0x7e')]=_0x338ae9[_0xb5a0('0x61')][_0xb5a0('0x7e')]=_0x6a045e[_0xb5a0('0x64')][_0xb5a0('0x75')];_0x338ae9[_0xb5a0('0x65')][_0xb5a0('0x77')]=_0x338ae9[_0xb5a0('0x61')]['user']=_0x6a045e[_0xb5a0('0x64')]['cuser'];_0x338ae9['Imap'][_0xb5a0('0x79')]=_0x338ae9['Smtp'][_0xb5a0('0x7f')]=_0x6a045e[_0xb5a0('0x64')][_0xb5a0('0x7a')];}return db['MailAccount']['create'](_0x338ae9,{'include':[{'model':db[_0xb5a0('0x43')],'as':_0xb5a0('0x61')},{'model':db[_0xb5a0('0x42')],'as':_0xb5a0('0x65')}]})[_0xb5a0('0x24')](function(_0x102306){var _0x5ee8b1=_0x6a045e[_0xb5a0('0x77')]['get']({'plain':!![]});if(!_0x5ee8b1)throw new Error(_0xb5a0('0x80'));if(_0x5ee8b1['role']===_0xb5a0('0x77')){var _0x82149d=_0x102306[_0xb5a0('0x3b')]({'plain':!![]});return db[_0xb5a0('0x81')][_0xb5a0('0x63')]({'where':{'name':_0xb5a0('0x3c'),'userProfileId':_0x5ee8b1[_0xb5a0('0x82')]},'raw':!![]})['then'](function(_0x4e02b2){if(_0x4e02b2&&_0x4e02b2[_0xb5a0('0x83')]===0x0){return db[_0xb5a0('0x3d')][_0xb5a0('0x68')]({'name':_0x82149d[_0xb5a0('0x3f')],'resourceId':_0x82149d['id'],'type':_0x4e02b2[_0xb5a0('0x3f')],'sectionId':_0x4e02b2['id']},{})[_0xb5a0('0x24')](function(){return _0x102306;});}else{return _0x102306;}})['catch'](function(_0x1d642a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d642a);throw _0x1d642a;});}return _0x102306;})['then'](respondWithResult(_0x2c4d85,0xc9))['catch'](handleError(_0x2c4d85,null));};exports[_0xb5a0('0x84')]=function(_0x4be0d1,_0x2d9821,_0x23b52a){return db[_0xb5a0('0x46')][_0xb5a0('0x85')]({'where':{'id':_0x4be0d1['params']['id']}})[_0xb5a0('0x24')](handleEntityNotFound(_0x2d9821,null))[_0xb5a0('0x24')](function(_0x2c3655){if(_0x2c3655){return _0x2c3655[_0xb5a0('0x84')]();}return null;})[_0xb5a0('0x24')](respondWithResult(_0x2d9821,null))[_0xb5a0('0x2e')](handleError(_0x2d9821,null));};exports[_0xb5a0('0x86')]=function(_0x30a949,_0x40a0ca,_0x2c9e46){if(_0x30a949[_0xb5a0('0x64')]['id']){delete _0x30a949['body']['id'];}return db[_0xb5a0('0x46')]['find']({'where':{'id':_0x30a949['params']['id']}})[_0xb5a0('0x24')](handleEntityNotFound(_0x40a0ca,null))[_0xb5a0('0x24')](function(_0x36ffa8){if(_0x36ffa8){_0x30a949[_0xb5a0('0x64')][_0xb5a0('0x6d')]=_0x36ffa8['id'];return db['MailServerIn'][_0xb5a0('0x68')](_0x30a949['body']);}})[_0xb5a0('0x24')](respondWithResult(_0x40a0ca,null))[_0xb5a0('0x2e')](handleError(_0x40a0ca,null));};exports[_0xb5a0('0x87')]=function(_0x2368ec,_0x38ccdc,_0x3d6718){return db[_0xb5a0('0x46')][_0xb5a0('0x85')]({'where':{'id':_0x2368ec[_0xb5a0('0x60')]['id']}})['then'](handleEntityNotFound(_0x38ccdc,null))[_0xb5a0('0x24')](function(_0xf6f184){if(_0xf6f184){return _0xf6f184['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x38ccdc,null))[_0xb5a0('0x2e')](handleError(_0x38ccdc,null));};exports['getSmtp']=function(_0x8f84b0,_0x230820,_0x5ad3b2){return db[_0xb5a0('0x46')][_0xb5a0('0x85')]({'where':{'id':_0x8f84b0[_0xb5a0('0x60')]['id']}})['then'](handleEntityNotFound(_0x230820,null))[_0xb5a0('0x24')](function(_0x22af51){if(_0x22af51){return _0x22af51['getSmtp']();}return null;})[_0xb5a0('0x24')](respondWithResult(_0x230820,null))[_0xb5a0('0x2e')](handleError(_0x230820,null));};exports['addSmtp']=function(_0x1dc829,_0x37d25a,_0x2c9c45){if(_0x1dc829['body']['id']){delete _0x1dc829[_0xb5a0('0x64')]['id'];}return db[_0xb5a0('0x46')][_0xb5a0('0x63')]({'where':{'id':_0x1dc829[_0xb5a0('0x60')]['id']}})[_0xb5a0('0x24')](handleEntityNotFound(_0x37d25a,null))['then'](function(_0x8418a5){if(_0x8418a5){_0x1dc829[_0xb5a0('0x64')][_0xb5a0('0x6d')]=_0x8418a5['id'];return db['MailServerOut'][_0xb5a0('0x68')](_0x1dc829[_0xb5a0('0x64')]);}})[_0xb5a0('0x24')](respondWithResult(_0x37d25a,null))['catch'](handleError(_0x37d25a,null));};exports[_0xb5a0('0x88')]=function(_0x27a552,_0x293fe5,_0x1d9c55){return db[_0xb5a0('0x46')][_0xb5a0('0x85')]({'where':{'id':_0x27a552['params']['id']}})[_0xb5a0('0x24')](handleEntityNotFound(_0x293fe5,null))[_0xb5a0('0x24')](function(_0x47938c){if(_0x47938c){return _0x47938c[_0xb5a0('0x89')](null);}return null;})[_0xb5a0('0x24')](respondWithStatusCode(_0x293fe5,null))['catch'](handleError(_0x293fe5,null));};exports['addInteraction']=function(_0x59f322,_0x1730bd,_0x204122){return db[_0xb5a0('0x8a')]['find']({'where':{'id':_0x59f322[_0xb5a0('0x60')]['id']}})[_0xb5a0('0x24')](handleEntityNotFound(_0x1730bd,null))['then'](function(_0x1d30a2){if(_0x1d30a2){return _0x1d30a2[_0xb5a0('0x8b')](_0x59f322[_0xb5a0('0x64')]['ids'],_['omit'](_0x59f322[_0xb5a0('0x64')],['ids','id'])||{});}})[_0xb5a0('0x24')](respondWithResult(_0x1730bd,null))[_0xb5a0('0x2e')](handleError(_0x1730bd,null));};exports['getInteractions']=function(_0xae5658,_0x12df4b,_0x2b61ac){var _0xb5aa90={'raw':![],'where':{}};var _0x20e275={};var _0x1e2477={'count':0x0,'rows':[]};return db[_0xb5a0('0x46')][_0xb5a0('0x85')]({'where':{'id':_0xae5658[_0xb5a0('0x60')]['id']}})[_0xb5a0('0x24')](handleEntityNotFound(_0x12df4b,null))['then'](function(_0x36ecfb){if(_0x36ecfb){_0x20e275[_0xb5a0('0x4a')]=_[_0xb5a0('0x4d')](db[_0xb5a0('0x8a')][_0xb5a0('0x47')]);_0x20e275['query']=_[_0xb5a0('0x4d')](_0xae5658[_0xb5a0('0x4c')]);_0x20e275[_0xb5a0('0x59')]=_[_0xb5a0('0x4e')](_0x20e275[_0xb5a0('0x4a')],_0x20e275['query']);_0xb5aa90[_0xb5a0('0x50')]=_[_0xb5a0('0x4e')](_0x20e275[_0xb5a0('0x4a')],qs[_0xb5a0('0x4f')](_0xae5658[_0xb5a0('0x4c')][_0xb5a0('0x4f')]));_0xb5aa90[_0xb5a0('0x50')]=_0xb5aa90['attributes'][_0xb5a0('0x51')]?_0xb5aa90[_0xb5a0('0x50')]:_0x20e275[_0xb5a0('0x4a')];if(!_0xae5658[_0xb5a0('0x4c')][_0xb5a0('0x52')](_0xb5a0('0x53'))){_0xb5aa90[_0xb5a0('0x54')]=qs[_0xb5a0('0x54')](_0xae5658[_0xb5a0('0x4c')][_0xb5a0('0x54')]);_0xb5aa90['offset']=qs[_0xb5a0('0x34')](_0xae5658[_0xb5a0('0x4c')]['offset']);}_0xb5aa90[_0xb5a0('0x55')]=qs[_0xb5a0('0x56')](_0xae5658[_0xb5a0('0x4c')][_0xb5a0('0x56')]);_0xb5aa90['where']=qs[_0xb5a0('0x59')](_[_0xb5a0('0x58')](_0xae5658[_0xb5a0('0x4c')],_0x20e275[_0xb5a0('0x59')]));_0xb5aa90['where'][_0xb5a0('0x6d')]=_0x36ecfb['id'];if(_0xae5658['query'][_0xb5a0('0x6a')]){_0xb5aa90[_0xb5a0('0x57')]=_[_0xb5a0('0x5a')](_0xb5aa90['where'],{'$or':_[_0xb5a0('0x4b')](_0xb5aa90[_0xb5a0('0x50')],function(_0x2f05b8){var _0x2369a6={};_0x2369a6[_0x2f05b8]={'$like':'%'+_0xae5658['query'][_0xb5a0('0x6a')]+'%'};return _0x2369a6;})});}_0xb5aa90=_[_0xb5a0('0x5a')]({},_0xb5aa90,_0xae5658[_0xb5a0('0x62')]);return db[_0xb5a0('0x8a')][_0xb5a0('0x33')]({'where':_0xb5aa90['where']})[_0xb5a0('0x24')](function(_0x3b8b38){_0x1e2477[_0xb5a0('0x33')]=_0x3b8b38;if(_0xae5658[_0xb5a0('0x4c')][_0xb5a0('0x5c')]){_0xb5aa90[_0xb5a0('0x5d')]=[{'model':db['CmContact'],'as':_0xb5a0('0x8c'),'required':![]},{'model':db[_0xb5a0('0x8d')],'as':'Owner','attributes':['name',_0xb5a0('0x8e'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xb5a0('0x3f'),_0xb5a0('0x8f')],'where':_0xae5658['query'][_0xb5a0('0x90')]?{'id':_0xae5658[_0xb5a0('0x4c')][_0xb5a0('0x90')]}:undefined,'required':_0xae5658[_0xb5a0('0x4c')][_0xb5a0('0x90')]?!![]:![]}];}return db[_0xb5a0('0x8a')][_0xb5a0('0x5e')](_0xb5aa90);})[_0xb5a0('0x24')](function(_0x50aeba){_0x1e2477[_0xb5a0('0x5f')]=_0x50aeba;return _0x1e2477;});}})[_0xb5a0('0x24')](respondWithFilteredResult(_0x12df4b,_0xb5aa90))[_0xb5a0('0x2e')](handleError(_0x12df4b,null));};exports['addApplications']=function(_0x9cdcbf,_0x499225,_0x1dfdc5){return db['MailAccount']['findOne']({'where':{'id':_0x9cdcbf[_0xb5a0('0x60')]['id']}})[_0xb5a0('0x24')](handleEntityNotFound(_0x499225,null))['then'](function(_0x532b1b){if(_0x532b1b){return db[_0xb5a0('0x91')][_0xb5a0('0x92')](function(_0x2e5b5e){return db[_0xb5a0('0x93')][_0xb5a0('0x3a')]({'where':{'MailAccountId':_0x9cdcbf[_0xb5a0('0x60')]['id']},'transaction':_0x2e5b5e})['then'](function(_0x57fe8a){var _0x318bfd=_[_0xb5a0('0x4b')](_0x9cdcbf[_0xb5a0('0x64')],function(_0x35f22e){_0x35f22e['MailAccountId']=_0x9cdcbf[_0xb5a0('0x60')]['id'];return _0x35f22e;});return db[_0xb5a0('0x93')][_0xb5a0('0x94')](_0x318bfd,{'transaction':_0x2e5b5e});});})[_0xb5a0('0x24')](function(){return db['MailApplication'][_0xb5a0('0x95')]({'where':{'MailAccountId':_0x9cdcbf['params']['id']},'order':_0xb5a0('0x96')});});}})[_0xb5a0('0x24')](respondWithResult(_0x499225,null))[_0xb5a0('0x2e')](handleError(_0x499225,null));};exports[_0xb5a0('0x97')]=function(_0x1064dd,_0x9260e9,_0x1b987b){var _0xff2c3e={};var _0xabf5da={};var _0x15ee28;var _0x31dbd3;return db[_0xb5a0('0x46')][_0xb5a0('0x85')]({'where':{'id':_0x1064dd[_0xb5a0('0x60')]['id']}})['then'](handleEntityNotFound(_0x9260e9,null))['then'](function(_0x5ab077){if(_0x5ab077){_0x15ee28=_0x5ab077;_0xabf5da[_0xb5a0('0x4a')]=_[_0xb5a0('0x4d')](db[_0xb5a0('0x93')][_0xb5a0('0x47')]);_0xabf5da[_0xb5a0('0x4c')]=_[_0xb5a0('0x4d')](_0x1064dd[_0xb5a0('0x4c')]);_0xabf5da[_0xb5a0('0x59')]=_[_0xb5a0('0x4e')](_0xabf5da[_0xb5a0('0x4a')],_0xabf5da['query']);_0xff2c3e[_0xb5a0('0x50')]=_[_0xb5a0('0x4e')](_0xabf5da['model'],qs['fields'](_0x1064dd[_0xb5a0('0x4c')][_0xb5a0('0x4f')]));_0xff2c3e['attributes']=_0xff2c3e['attributes'][_0xb5a0('0x51')]?_0xff2c3e[_0xb5a0('0x50')]:_0xabf5da[_0xb5a0('0x4a')];_0xff2c3e[_0xb5a0('0x55')]=qs[_0xb5a0('0x56')](_0x1064dd[_0xb5a0('0x4c')][_0xb5a0('0x56')]);_0xff2c3e[_0xb5a0('0x57')]=qs[_0xb5a0('0x59')](_[_0xb5a0('0x58')](_0x1064dd[_0xb5a0('0x4c')],_0xabf5da[_0xb5a0('0x59')]));if(_0x1064dd[_0xb5a0('0x4c')][_0xb5a0('0x6a')]){_0xff2c3e['where']=_['merge'](_0xff2c3e['where'],{'$or':_['map'](_0xff2c3e[_0xb5a0('0x50')],function(_0x181d8f){var _0x7eef24={};_0x7eef24[_0x181d8f]={'$like':'%'+_0x1064dd[_0xb5a0('0x4c')]['filter']+'%'};return _0x7eef24;})});}_0xff2c3e=_['merge']({},_0xff2c3e,_0x1064dd['options']);return _0x15ee28[_0xb5a0('0x97')](_0xff2c3e);}})[_0xb5a0('0x24')](function(_0x58bed6){if(_0x58bed6){_0x31dbd3=_0x58bed6[_0xb5a0('0x51')];if(!_0x1064dd['query'][_0xb5a0('0x52')](_0xb5a0('0x53'))){_0xff2c3e[_0xb5a0('0x54')]=qs[_0xb5a0('0x54')](_0x1064dd['query'][_0xb5a0('0x54')]);_0xff2c3e[_0xb5a0('0x34')]=qs['offset'](_0x1064dd[_0xb5a0('0x4c')][_0xb5a0('0x34')]);}return _0x15ee28[_0xb5a0('0x97')](_0xff2c3e);}})[_0xb5a0('0x24')](function(_0x2168a0){if(_0x2168a0){return _0x2168a0?{'count':_0x31dbd3,'rows':_0x2168a0}:null;}})[_0xb5a0('0x24')](respondWithResult(_0x9260e9,null))[_0xb5a0('0x2e')](handleError(_0x9260e9,null));};exports[_0xb5a0('0x98')]=function(_0x1367b2,_0x5bd4aa,_0x57c017){var _0x247886={'raw':!![],'where':{}};var _0x4f53a5={};var _0x35bd86={'count':0x0,'rows':[]};return db[_0xb5a0('0x46')][_0xb5a0('0x85')]({'where':{'id':_0x1367b2['params']['id']}})['then'](handleEntityNotFound(_0x5bd4aa,null))[_0xb5a0('0x24')](function(_0x152289){if(_0x152289){_0x4f53a5['model']=_[_0xb5a0('0x4d')](db['MailMessage']['rawAttributes']);_0x4f53a5[_0xb5a0('0x4c')]=_[_0xb5a0('0x4d')](_0x1367b2[_0xb5a0('0x4c')]);_0x4f53a5[_0xb5a0('0x59')]=_[_0xb5a0('0x4e')](_0x4f53a5[_0xb5a0('0x4a')],_0x4f53a5[_0xb5a0('0x4c')]);_0x247886['attributes']=_[_0xb5a0('0x4e')](_0x4f53a5[_0xb5a0('0x4a')],qs[_0xb5a0('0x4f')](_0x1367b2[_0xb5a0('0x4c')][_0xb5a0('0x4f')]));_0x247886[_0xb5a0('0x50')]=_0x247886[_0xb5a0('0x50')][_0xb5a0('0x51')]?_0x247886[_0xb5a0('0x50')]:_0x4f53a5[_0xb5a0('0x4a')];if(!_0x1367b2[_0xb5a0('0x4c')]['hasOwnProperty'](_0xb5a0('0x53'))){_0x247886[_0xb5a0('0x54')]=qs[_0xb5a0('0x54')](_0x1367b2[_0xb5a0('0x4c')][_0xb5a0('0x54')]);_0x247886[_0xb5a0('0x34')]=qs[_0xb5a0('0x34')](_0x1367b2['query'][_0xb5a0('0x34')]);}_0x247886['order']=qs[_0xb5a0('0x56')](_0x1367b2[_0xb5a0('0x4c')][_0xb5a0('0x56')]);_0x247886[_0xb5a0('0x57')]=qs['filters'](_[_0xb5a0('0x58')](_0x1367b2[_0xb5a0('0x4c')],_0x4f53a5[_0xb5a0('0x59')]));_0x247886[_0xb5a0('0x57')][_0xb5a0('0x6d')]=_0x152289['id'];if(_0x1367b2[_0xb5a0('0x4c')][_0xb5a0('0x6a')]){_0x247886[_0xb5a0('0x57')]=_[_0xb5a0('0x5a')](_0x247886['where'],{'$or':_[_0xb5a0('0x4b')](_0x247886[_0xb5a0('0x50')],function(_0x136f52){var _0x42cd5e={};_0x42cd5e[_0x136f52]={'$like':'%'+_0x1367b2[_0xb5a0('0x4c')][_0xb5a0('0x6a')]+'%'};return _0x42cd5e;})});}if(_0x1367b2[_0xb5a0('0x4c')]['$gte']){var _0x16aa26=_0x1367b2['query'][_0xb5a0('0x99')][_0xb5a0('0x9a')](',');var _0x2a84d8={};_0x2a84d8[_0x16aa26[0x0]]={'$gte':moment(_0x16aa26[0x1])[_0xb5a0('0x9b')](_0xb5a0('0x9c'))};_0x247886[_0xb5a0('0x57')]=_[_0xb5a0('0x5a')](_0x247886[_0xb5a0('0x57')],_0x2a84d8);}_0x247886=_[_0xb5a0('0x5a')]({},_0x247886,_0x1367b2[_0xb5a0('0x62')]);return db[_0xb5a0('0x9d')][_0xb5a0('0x33')]({'where':_0x247886['where']})[_0xb5a0('0x24')](function(_0x432c7c){_0x35bd86[_0xb5a0('0x33')]=_0x432c7c;if(_0x1367b2[_0xb5a0('0x4c')]['includeAll']){_0x247886[_0xb5a0('0x5d')]=[{'all':!![]}];}return db[_0xb5a0('0x9d')]['findAll'](_0x247886);})[_0xb5a0('0x24')](function(_0x2ba350){if(_0x1367b2['query'][_0xb5a0('0x9e')]==='true'){for(var _0x32b872=0x0;_0x32b872<_0x2ba350[_0xb5a0('0x51')];_0x32b872++){_0x2ba350[_0x32b872][_0xb5a0('0x64')]=juice(_0x2ba350[_0x32b872][_0xb5a0('0x64')]);}}_0x35bd86[_0xb5a0('0x5f')]=_0x2ba350;return _0x35bd86;});}})['then'](respondWithFilteredResult(_0x5bd4aa,_0x247886))['catch'](handleError(_0x5bd4aa,null));};exports[_0xb5a0('0x40')]=function(_0x362889,_0x4b4983,_0x287cdb){var _0x35d282,_0x4f02b4={},_0x279ff7;if(_0x362889['body']['to']){_0x279ff7=_0x362889[_0xb5a0('0x64')]['to'][_0xb5a0('0x9a')](',')[0x0];}return db[_0xb5a0('0x46')][_0xb5a0('0x63')]({'where':{'id':_0x362889[_0xb5a0('0x60')]['id']},'include':[{'model':db[_0xb5a0('0x9f')],'as':_0xb5a0('0xa0'),'include':[{'model':db[_0xb5a0('0xa1')],'as':'Contacts','where':{'email':_0x279ff7},'limit':0x1,'order':[[_0xb5a0('0xa2'),_0xb5a0('0xa3')]]}]},{'model':db['MailServerOut'],'as':_0xb5a0('0x61'),'raw':!![]}]})[_0xb5a0('0x24')](handleEntityNotFound(_0x4b4983,null))[_0xb5a0('0x24')](function(_0x399358){if(_0x399358){_0x35d282=_0x399358;if(_0x399358[_0xb5a0('0x61')]){if(_[_0xb5a0('0x73')](_0x362889[_0xb5a0('0x64')]['from'])){_0x362889[_0xb5a0('0x64')][_0xb5a0('0xa4')]=util['format'](_0xb5a0('0xa5'),_0x399358[_0xb5a0('0x3f')],_0x399358['email']||_0x399358['Smtp'][_0xb5a0('0x77')]);}if(_0x362889['body'][_0xb5a0('0xa6')]&&_0x362889['body'][_0xb5a0('0xa6')][_0xb5a0('0x51')]){for(var _0x5d7936=0x0;_0x5d7936<_0x362889['body'][_0xb5a0('0xa6')][_0xb5a0('0x51')];_0x5d7936+=0x1){_0x362889[_0xb5a0('0x64')]['attachments'][_0x5d7936]={'filename':_0x362889[_0xb5a0('0x64')][_0xb5a0('0xa6')][_0x5d7936][_0xb5a0('0x3f')],'path':path[_0xb5a0('0xa7')](config[_0xb5a0('0xa8')],'server/files/attachments',_0x362889['body']['attachments'][_0x5d7936][_0xb5a0('0xa9')])};}}var _0x29917a={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x399358['Smtp'][_0xb5a0('0x7e')])){if(_0x399358[_0xb5a0('0x61')][_0xb5a0('0x7b')]){_0x29917a[_0xb5a0('0xaa')]={'user':_0x399358[_0xb5a0('0x61')][_0xb5a0('0x77')],'pass':_0x399358[_0xb5a0('0x61')][_0xb5a0('0x7f')]};}_0x29917a[_0xb5a0('0x7c')]=_0x399358['Smtp'][_0xb5a0('0x7c')];_0x29917a[_0xb5a0('0x7d')]=_0x399358[_0xb5a0('0x61')][_0xb5a0('0x7d')];_0x29917a[_0xb5a0('0xab')]=_0x399358['Smtp'][_0xb5a0('0xab')];}else{_0x29917a['service']=_0x399358[_0xb5a0('0x61')][_0xb5a0('0x7e')];_0x29917a['auth']={'user':_0x399358['Smtp']['user'],'pass':_0x399358[_0xb5a0('0x61')][_0xb5a0('0x7f')]};}return respondWithRpcPromise(_0xb5a0('0xac'),_0xb5a0('0xad'),{'account':_0x29917a,'message':_0x362889[_0xb5a0('0x64')]});}else{throw new Error(_0xb5a0('0xae'));}}})['then'](function(_0x2e34da){if(_0x2e34da){_0x4f02b4=_0x2e34da;if(_0x35d282[_0xb5a0('0xa0')]){if(_0x35d282[_0xb5a0('0xa0')][_0xb5a0('0xaf')][_0xb5a0('0x51')]){return _0x35d282['List'][_0xb5a0('0xaf')][0x0];}else{return db['CmContact'][_0xb5a0('0x68')](_[_0xb5a0('0xb0')](_0x362889[_0xb5a0('0x64')],{'firstName':_0x362889[_0xb5a0('0x64')]['to'],'email':_0x362889[_0xb5a0('0x64')]['to'],'phone':_0x362889[_0xb5a0('0x64')]['to'],'ListId':_0x35d282[_0xb5a0('0x72')]}));}}else{throw new Error(_0xb5a0('0xae'));}}})[_0xb5a0('0x24')](function(_0x7122a4){if(_0x7122a4){var _0x579295={'UserId':_0x362889[_0xb5a0('0x77')]['id'],'ContactId':_0x7122a4['id'],'MailAccountId':_0x35d282['id'],'inReplyTo':_0x4f02b4[_0xb5a0('0xb1')],'to':_0x362889['body'][_0xb5a0('0xa4')],'cc':_0x362889[_0xb5a0('0x64')]['cc'],'subject':_0x362889['body'][_0xb5a0('0xb2')],'attach':_0x362889[_0xb5a0('0x64')][_0xb5a0('0xb3')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xb5a0('0x9b')](_0xb5a0('0x9c')),'lastMsgDirection':_0xb5a0('0xb4'),'lastMsgBody':_0x362889[_0xb5a0('0x64')][_0xb5a0('0x64')],'Messages':[_[_0xb5a0('0x5a')](_0x362889['body'],{'messageId':_0x4f02b4['messageId'],'sentAt':moment()[_0xb5a0('0x9b')](_0xb5a0('0x9c')),'read':!![],'MailAccountId':_0x35d282['id'],'UserId':_0x362889[_0xb5a0('0x77')]['id'],'ContactId':_0x7122a4['id']})]};if(_0x362889[_0xb5a0('0x64')]['Interaction']){_0x579295=_[_0xb5a0('0x5a')](_0x579295,_0x362889['body'][_0xb5a0('0xb5')]);}return db[_0xb5a0('0x8a')][_0xb5a0('0x68')](_0x579295,{'include':[{'model':db[_0xb5a0('0x9d')],'as':'Messages'}]});}})[_0xb5a0('0x24')](respondWithResult(_0x4b4983,null))[_0xb5a0('0x2e')](handleError(_0x4b4983,null));};exports['verifySmtp']=function(_0x4eeb1b,_0xae70a4,_0x1b5b8c){return db[_0xb5a0('0x46')]['find']({'where':{'id':_0x4eeb1b[_0xb5a0('0x60')]['id']},'include':[{'model':db[_0xb5a0('0x43')],'as':'Smtp','raw':!![]}]})[_0xb5a0('0x24')](handleEntityNotFound(_0xae70a4,null))[_0xb5a0('0x24')](function(_0x6e9222){if(_0x6e9222&&_0x6e9222[_0xb5a0('0x61')]){var _0x3bdb7d={'id':_0x6e9222['id'],'tls':{'rejectUnauthorized':![]}};if(_0x6e9222[_0xb5a0('0x61')][_0xb5a0('0x7e')]){_0x3bdb7d['service']=_0x6e9222[_0xb5a0('0x61')][_0xb5a0('0x7e')];}else{_0x3bdb7d['host']=_0x6e9222[_0xb5a0('0x61')][_0xb5a0('0x7c')];_0x3bdb7d[_0xb5a0('0x7d')]=_0x6e9222[_0xb5a0('0x61')][_0xb5a0('0x7d')];_0x3bdb7d[_0xb5a0('0xab')]=_0x6e9222[_0xb5a0('0x61')]['secure'];}if(_0x6e9222[_0xb5a0('0x61')][_0xb5a0('0x7b')]){_0x3bdb7d['auth']={'user':_0x6e9222['Smtp']['user'],'pass':_0x6e9222['Smtp'][_0xb5a0('0x7f')]};}return respondWithRpcPromise(_0xb5a0('0xb6'),_0xb5a0('0xb7'),{'account':_0x3bdb7d});}})[_0xb5a0('0x24')](respondWithResult(_0xae70a4,null))[_0xb5a0('0x2e')](handleError(_0xae70a4,null));};exports[_0xb5a0('0x3a')]=function(_0x2baab3,_0x1fcd31){return db[_0xb5a0('0x46')][_0xb5a0('0x63')]({'where':{'id':_0x2baab3['params']['id']}})[_0xb5a0('0x24')](handleEntityNotFound(_0x1fcd31,null))[_0xb5a0('0x24')](function(_0x2881ba){if(_0x2881ba&&_0x2881ba[_0xb5a0('0x7e')]){throw new db[(_0xb5a0('0xb8'))][(_0xb5a0('0xb9'))](_0xb5a0('0xba'));}return _0x2881ba;})[_0xb5a0('0x24')](removeEntity(_0x1fcd31,null))[_0xb5a0('0x2e')](handleError(_0x1fcd31,null));};exports[_0xb5a0('0xbb')]=function(_0x417394,_0x19765f,_0x3bc349){return db[_0xb5a0('0x46')][_0xb5a0('0x63')]({'where':{'id':_0x417394[_0xb5a0('0x60')]['id']}})[_0xb5a0('0x24')](handleEntityNotFound(_0x19765f,null))['then'](function(_0x1c2bb4){if(_0x1c2bb4){return _0x1c2bb4['addAgents'](_0x417394[_0xb5a0('0x64')][_0xb5a0('0x70')],_[_0xb5a0('0xbc')](_0x417394[_0xb5a0('0x64')],[_0xb5a0('0x70'),'id'])||{})[_0xb5a0('0xbd')](function(_0x225052){for(var _0x3baf3b=0x0;_0x3baf3b<_0x417394[_0xb5a0('0x64')][_0xb5a0('0x70')]['length'];_0x3baf3b+=0x1){socket[_0xb5a0('0xbe')](_0xb5a0('0xbf'),{'UserId':_0x417394[_0xb5a0('0x64')][_0xb5a0('0x70')][_0x3baf3b],'MailAccountId':_0x417394[_0xb5a0('0x60')]['id']});}return _0x225052;});}})['then'](respondWithResult(_0x19765f,null))[_0xb5a0('0x2e')](handleError(_0x19765f,null));};exports[_0xb5a0('0xc0')]=function(_0x237f0e,_0x121444,_0x49eaa4){return db[_0xb5a0('0x46')]['find']({'where':{'id':_0x237f0e['params']['id']}})[_0xb5a0('0x24')](handleEntityNotFound(_0x121444,null))['then'](function(_0x520f59){if(_0x520f59){return _0x520f59[_0xb5a0('0xc0')](_0x237f0e['query'][_0xb5a0('0x70')])[_0xb5a0('0x24')](function(){if(_[_0xb5a0('0xc1')](_0x237f0e[_0xb5a0('0x4c')][_0xb5a0('0x70')])){for(var _0x4db12c=0x0;_0x4db12c<_0x237f0e[_0xb5a0('0x4c')][_0xb5a0('0x70')]['length'];_0x4db12c+=0x1){socket[_0xb5a0('0xbe')](_0xb5a0('0xc2'),{'UserId':Number(_0x237f0e[_0xb5a0('0x4c')][_0xb5a0('0x70')][_0x4db12c]),'MailAccountId':Number(_0x237f0e[_0xb5a0('0x60')]['id'])});}}else{socket[_0xb5a0('0xbe')](_0xb5a0('0xc2'),{'UserId':Number(_0x237f0e[_0xb5a0('0x4c')][_0xb5a0('0x70')]),'MailAccountId':Number(_0x237f0e[_0xb5a0('0x60')]['id'])});}});}})[_0xb5a0('0x24')](respondWithStatusCode(_0x121444,null))[_0xb5a0('0x2e')](handleError(_0x121444,null));};exports[_0xb5a0('0xc3')]=function(_0x39a5ef,_0x1e8e30,_0x5a8d91){var _0x19f08a={};var _0x172e80={};var _0x41ba0e;var _0x1264f4;return db['MailAccount'][_0xb5a0('0x85')]({'where':{'id':_0x39a5ef[_0xb5a0('0x60')]['id']}})[_0xb5a0('0x24')](handleEntityNotFound(_0x1e8e30,null))[_0xb5a0('0x24')](function(_0x52b1b6){if(_0x52b1b6){_0x41ba0e=_0x52b1b6;_0x172e80[_0xb5a0('0x4a')]=_['keys'](db[_0xb5a0('0x8d')]['rawAttributes']);_0x172e80[_0xb5a0('0x4c')]=_[_0xb5a0('0x4d')](_0x39a5ef[_0xb5a0('0x4c')]);_0x172e80[_0xb5a0('0x59')]=_[_0xb5a0('0x4e')](_0x172e80[_0xb5a0('0x4a')],_0x172e80[_0xb5a0('0x4c')]);_0x19f08a[_0xb5a0('0x50')]=_[_0xb5a0('0x4e')](_0x172e80[_0xb5a0('0x4a')],qs[_0xb5a0('0x4f')](_0x39a5ef[_0xb5a0('0x4c')][_0xb5a0('0x4f')]));_0x19f08a[_0xb5a0('0x50')]=_0x19f08a[_0xb5a0('0x50')][_0xb5a0('0x51')]?_0x19f08a[_0xb5a0('0x50')]:_0x172e80[_0xb5a0('0x4a')];_0x19f08a[_0xb5a0('0x55')]=qs[_0xb5a0('0x56')](_0x39a5ef[_0xb5a0('0x4c')][_0xb5a0('0x56')]);_0x19f08a['where']=qs['filters'](_[_0xb5a0('0x58')](_0x39a5ef[_0xb5a0('0x4c')],_0x172e80[_0xb5a0('0x59')]));if(_0x39a5ef[_0xb5a0('0x4c')][_0xb5a0('0x6a')]){_0x19f08a[_0xb5a0('0x57')]=_['merge'](_0x19f08a[_0xb5a0('0x57')],{'$or':_[_0xb5a0('0x4b')](_0x19f08a[_0xb5a0('0x50')],function(_0x4d9cb1){var _0x17fcac={};_0x17fcac[_0x4d9cb1]={'$like':'%'+_0x39a5ef[_0xb5a0('0x4c')][_0xb5a0('0x6a')]+'%'};return _0x17fcac;})});}_0x19f08a=_[_0xb5a0('0x5a')]({},_0x19f08a,_0x39a5ef['options']);return _0x41ba0e[_0xb5a0('0xc3')](_0x19f08a);}})[_0xb5a0('0x24')](function(_0x5cef52){if(_0x5cef52){_0x1264f4=_0x5cef52[_0xb5a0('0x51')];if(!_0x39a5ef['query'][_0xb5a0('0x52')](_0xb5a0('0x53'))){_0x19f08a[_0xb5a0('0x54')]=qs[_0xb5a0('0x54')](_0x39a5ef[_0xb5a0('0x4c')][_0xb5a0('0x54')]);_0x19f08a['offset']=qs['offset'](_0x39a5ef[_0xb5a0('0x4c')]['offset']);}return _0x41ba0e[_0xb5a0('0xc3')](_0x19f08a);}})['then'](function(_0x56dcae){if(_0x56dcae){return _0x56dcae?{'count':_0x1264f4,'rows':_0x56dcae}:null;}})[_0xb5a0('0x24')](respondWithResult(_0x1e8e30,null))[_0xb5a0('0x2e')](handleError(_0x1e8e30,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index fe533c2..b083419 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 _0x2f63=['setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x554292,_0x82948a){var _0x3dd555=function(_0xab7590){while(--_0xab7590){_0x554292['push'](_0x554292['shift']());}};_0x3dd555(++_0x82948a);}(_0x2f63,0xf5));var _0x32f6=function(_0x4f217f,_0x313163){_0x4f217f=_0x4f217f-0x0;var _0x3b583a=_0x2f63[_0x4f217f];return _0x3b583a;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x32f6('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x32f6('0x1'),'afterDestroy':_0x32f6('0x2')};function emitEvent(_0x24712b){return function(_0x3d85b6,_0x4b37e2,_0x50b651){MailAccountEvents[_0x32f6('0x3')](_0x24712b+':'+_0x3d85b6['id'],_0x3d85b6);MailAccountEvents['emit'](_0x24712b,_0x3d85b6);_0x50b651(null);};}for(var e in events){if(events[_0x32f6('0x4')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xa00d=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailAccount'];(function(_0x33c195,_0x25b4f2){var _0x331e21=function(_0x5c460e){while(--_0x5c460e){_0x33c195['push'](_0x33c195['shift']());}};_0x331e21(++_0x25b4f2);}(_0xa00d,0x8a));var _0xda00=function(_0x464f85,_0xbc0381){_0x464f85=_0x464f85-0x0;var _0x41467f=_0xa00d[_0x464f85];return _0x41467f;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xda00('0x0'))['db'][_0xda00('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xda00('0x2')};function emitEvent(_0x12b4a0){return function(_0x559b64,_0x15d558,_0x5796a4){MailAccountEvents['emit'](_0x12b4a0+':'+_0x559b64['id'],_0x559b64);MailAccountEvents[_0xda00('0x3')](_0x12b4a0,_0x559b64);_0x5796a4(null);};}for(var e in events){if(events[_0xda00('0x4')](e)){var event=events[e];MailAccount[_0xda00('0x5')](e,emitEvent(event));}}module[_0xda00('0x6')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 77e27c5..7503630 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 _0x8fa1=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','mail_accounts','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8fa1,0x15e));var _0x18fa=function(_0x1ebc56,_0xe73d52){_0x1ebc56=_0x1ebc56-0x0;var _0x3683a9=_0x8fa1[_0x1ebc56];return _0x3683a9;};'use strict';var _=require(_0x18fa('0x0'));var util=require('util');var logger=require(_0x18fa('0x1'))(_0x18fa('0x2'));var moment=require(_0x18fa('0x3'));var BPromise=require(_0x18fa('0x4'));var rp=require(_0x18fa('0x5'));var fs=require('fs');var path=require(_0x18fa('0x6'));var rimraf=require(_0x18fa('0x7'));var config=require(_0x18fa('0x8'));var attributes=require('./mailAccount.attributes');module['exports']=function(_0xc23704,_0x403ed1){return _0xc23704[_0x18fa('0x9')]('MailAccount',attributes,{'tableName':_0x18fa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9670=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','MailAccount','mail_accounts'];(function(_0x5c027f,_0xa40135){var _0x5392f3=function(_0x581c3b){while(--_0x581c3b){_0x5c027f['push'](_0x5c027f['shift']());}};_0x5392f3(++_0xa40135);}(_0x9670,0xea));var _0x0967=function(_0x495f42,_0x46ae77){_0x495f42=_0x495f42-0x0;var _0x40ebc3=_0x9670[_0x495f42];return _0x40ebc3;};'use strict';var _=require(_0x0967('0x0'));var util=require('util');var logger=require(_0x0967('0x1'))(_0x0967('0x2'));var moment=require(_0x0967('0x3'));var BPromise=require(_0x0967('0x4'));var rp=require(_0x0967('0x5'));var fs=require('fs');var path=require(_0x0967('0x6'));var rimraf=require(_0x0967('0x7'));var config=require(_0x0967('0x8'));var attributes=require(_0x0967('0x9'));module[_0x0967('0xa')]=function(_0x2c60b9,_0x491d4c){return _0x2c60b9['define'](_0x0967('0xb'),attributes,{'tableName':_0x0967('0xc'),'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 decb1b9..e3ab8a4 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 _0x0e35=['jayson/promise','client','defaults','redis','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','model','map','catch','find','ShowMailAccount','NotifyMailAccount','body','mail','keys','CmContact','rawAttributes','createdAt','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','get','omit','applications','list','orderBy','priority','asc','autoclose','length','*,*,*,*','contact','messageId','generate','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','subject','attach','interaction','attachments','originTo','originCc','bcc','Attachments','UserId','unshift','agent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x44c09c,_0x225ba3){var _0x4da5c8=function(_0x322e31){while(--_0x322e31){_0x44c09c['push'](_0x44c09c['shift']());}};_0x4da5c8(++_0x225ba3);}(_0x0e35,0xc2));var _0x50e3=function(_0x32caaa,_0xe9cd17){_0x32caaa=_0x32caaa-0x0;var _0x4bccd0=_0x0e35[_0x32caaa];return _0x4bccd0;};'use strict';var _=require(_0x50e3('0x0'));var util=require(_0x50e3('0x1'));var moment=require(_0x50e3('0x2'));var BPromise=require(_0x50e3('0x3'));var rs=require(_0x50e3('0x4'));var fs=require('fs');var Redis=require(_0x50e3('0x5'));var db=require(_0x50e3('0x6'))['db'];var utils=require(_0x50e3('0x7'));var logger=require(_0x50e3('0x8'))(_0x50e3('0x9'));var config=require('../../config/environment');var jayson=require(_0x50e3('0xa'));var client=jayson[_0x50e3('0xb')]['http']({'port':0x232c});config['redis']=_[_0x50e3('0xc')](config[_0x50e3('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x50e3('0xd')]));require(_0x50e3('0xe'))[_0x50e3('0xf')](socket);function respondWithRpcPromise(_0x2658d9,_0x3dbc46,_0x1deed0){return new BPromise(function(_0x2bf7a7,_0x34100e){return client[_0x50e3('0x10')](_0x2658d9,_0x1deed0)[_0x50e3('0x11')](function(_0x3b2e32){logger[_0x50e3('0x12')](_0x50e3('0x13'),_0x3dbc46,'request\x20sent');logger[_0x50e3('0x14')](_0x50e3('0x15'),_0x3dbc46,_0x50e3('0x16'),JSON[_0x50e3('0x17')](_0x3b2e32));if(_0x3b2e32['error']){if(_0x3b2e32[_0x50e3('0x18')][_0x50e3('0x19')]===0x1f4){logger['error'](_0x50e3('0x13'),_0x3dbc46,_0x3b2e32[_0x50e3('0x18')][_0x50e3('0x1a')]);return _0x34100e(_0x3b2e32[_0x50e3('0x18')][_0x50e3('0x1a')]);}logger['error'](_0x50e3('0x13'),_0x3dbc46,_0x3b2e32['error'][_0x50e3('0x1a')]);return _0x2bf7a7(_0x3b2e32[_0x50e3('0x18')][_0x50e3('0x1a')]);}else{logger['info'](_0x50e3('0x13'),_0x3dbc46,_0x50e3('0x16'));_0x2bf7a7(_0x3b2e32[_0x50e3('0x1b')][_0x50e3('0x1a')]);}})['catch'](function(_0x4e14ab){logger[_0x50e3('0x18')]('MailAccount,\x20%s,\x20%s',_0x3dbc46,_0x4e14ab);_0x34100e(_0x4e14ab);});});}exports[_0x50e3('0x1c')]=function(_0xcab60a){var _0x57e154=this;return new Promise(function(_0x4d20b1,_0x635288){return db[_0x50e3('0x1d')]['findAll']({'raw':_0xcab60a[_0x50e3('0x1e')]?_0xcab60a[_0x50e3('0x1e')][_0x50e3('0x1f')]===undefined?!![]:![]:!![],'where':_0xcab60a[_0x50e3('0x1e')]?_0xcab60a[_0x50e3('0x1e')][_0x50e3('0x20')]||null:null,'attributes':_0xcab60a['options']?_0xcab60a[_0x50e3('0x1e')][_0x50e3('0x21')]||null:null,'limit':_0xcab60a[_0x50e3('0x1e')]?_0xcab60a[_0x50e3('0x1e')][_0x50e3('0x22')]||null:null,'include':_0xcab60a[_0x50e3('0x1e')]?_0xcab60a[_0x50e3('0x1e')][_0x50e3('0x23')]?_['map'](_0xcab60a[_0x50e3('0x1e')]['include'],function(_0x14c06c){return{'model':db[_0x14c06c[_0x50e3('0x24')]],'as':_0x14c06c['as'],'attributes':_0x14c06c[_0x50e3('0x21')],'include':_0x14c06c[_0x50e3('0x23')]?_[_0x50e3('0x25')](_0x14c06c['include'],function(_0x5af9a4){return{'model':db[_0x5af9a4[_0x50e3('0x24')]],'as':_0x5af9a4['as'],'attributes':_0x5af9a4['attributes'],'include':_0x5af9a4[_0x50e3('0x23')]?_['map'](_0x5af9a4['include'],function(_0x5e5b36){return{'model':db[_0x5e5b36[_0x50e3('0x24')]],'as':_0x5e5b36['as'],'attributes':_0x5e5b36[_0x50e3('0x21')]};}):[]};}):[]};}):[]:[]})[_0x50e3('0x11')](function(_0x131fa2){logger[_0x50e3('0x12')](_0x50e3('0x1c'),_0xcab60a);logger[_0x50e3('0x14')](_0x50e3('0x1c'),_0xcab60a,JSON['stringify'](_0x131fa2));_0x4d20b1(_0x131fa2);})[_0x50e3('0x26')](function(_0x13edd9){logger[_0x50e3('0x18')]('GetMailAccount',_0x13edd9[_0x50e3('0x1a')],_0xcab60a);_0x635288(_0x57e154[_0x50e3('0x18')](0x1f4,_0x13edd9[_0x50e3('0x1a')]));});});};exports['ShowMailAccount']=function(_0x21c561){var _0x1b34ca=this;return new Promise(function(_0x5c602d,_0x3ac5d0){return db[_0x50e3('0x1d')][_0x50e3('0x27')]({'raw':_0x21c561['options']?_0x21c561[_0x50e3('0x1e')][_0x50e3('0x1f')]===undefined?!![]:![]:!![],'where':_0x21c561[_0x50e3('0x1e')]?_0x21c561[_0x50e3('0x1e')][_0x50e3('0x20')]||null:null,'attributes':_0x21c561[_0x50e3('0x1e')]?_0x21c561['options'][_0x50e3('0x21')]||null:null,'include':_0x21c561[_0x50e3('0x1e')]?_0x21c561[_0x50e3('0x1e')]['include']?_[_0x50e3('0x25')](_0x21c561[_0x50e3('0x1e')]['include'],function(_0x39aab3){return{'model':db[_0x39aab3['model']],'as':_0x39aab3['as'],'attributes':_0x39aab3[_0x50e3('0x21')],'include':_0x39aab3['include']?_[_0x50e3('0x25')](_0x39aab3['include'],function(_0x1344a9){return{'model':db[_0x1344a9['model']],'as':_0x1344a9['as'],'attributes':_0x1344a9['attributes'],'include':_0x1344a9[_0x50e3('0x23')]?_['map'](_0x1344a9[_0x50e3('0x23')],function(_0x41730c){return{'model':db[_0x41730c[_0x50e3('0x24')]],'as':_0x41730c['as'],'attributes':_0x41730c[_0x50e3('0x21')]};}):[]};}):[]};}):[]:[]})[_0x50e3('0x11')](function(_0x1fa152){logger[_0x50e3('0x12')](_0x50e3('0x28'),_0x21c561);logger['debug'](_0x50e3('0x28'),_0x21c561,JSON[_0x50e3('0x17')](_0x1fa152));_0x5c602d(_0x1fa152);})['catch'](function(_0x36ecfc){logger[_0x50e3('0x18')]('ShowMailAccount',_0x36ecfc[_0x50e3('0x1a')],_0x21c561);_0x3ac5d0(_0x1b34ca[_0x50e3('0x18')](0x1f4,_0x36ecfc[_0x50e3('0x1a')]));});});};exports[_0x50e3('0x29')]=function(_0x5511be){var _0x50079d=this;return new Promise(function(_0x17c823,_0x47e64e){var _0x50d628={'body':_0x5511be[_0x50e3('0x2a')],'channel':_0x50e3('0x2b')};var _0xae1d1d=_['difference'](_[_0x50e3('0x2c')](db[_0x50e3('0x2d')][_0x50e3('0x2e')]),[_0x50e3('0x2f'),'updatedAt','CompanyId',_0x50e3('0x30')]);var _0x1716de=![];if(_0x5511be[_0x50e3('0x2a')]['id']){delete _0x5511be[_0x50e3('0x2a')]['id'];}if(_['isNil'](_0x5511be['body'][_0x50e3('0x31')])){return _0x47e64e(_0x50079d[_0x50e3('0x18')](0x1f4,_0x50e3('0x32')));}if(_[_0x50e3('0x33')](_0x5511be[_0x50e3('0x2a')][_0x50e3('0x2a')])||_0x5511be[_0x50e3('0x2a')][_0x50e3('0x2a')]===''){return _0x47e64e(_0x50079d[_0x50e3('0x18')](0x1f4,_0x50e3('0x34')));}if(_[_0x50e3('0x33')](_0x5511be[_0x50e3('0x2a')][_0x50e3('0x35')])){return _0x47e64e(_0x50079d['error'](0x1f4,_0x50e3('0x36')+_0xae1d1d));}if(!_[_0x50e3('0x37')](_0xae1d1d,_0x5511be[_0x50e3('0x2a')][_0x50e3('0x35')])){return _0x47e64e(_0x50079d['error'](0x1f4,_0x50e3('0x38')+_0xae1d1d));}var _0xba5653={};_0xba5653[_0x5511be[_0x50e3('0x2a')]['mapKey']]=_0x5511be[_0x50e3('0x2a')][_0x50e3('0x31')];return db['MailAccount'][_0x50e3('0x27')]({'where':{'id':_0x5511be[_0x50e3('0x39')]['id']},'include':[{'model':db[_0x50e3('0x3a')],'as':_0x50e3('0x3b'),'include':[{'model':db[_0x50e3('0x2d')],'as':_0x50e3('0x3c'),'where':_0xba5653,'limit':0x1,'order':[[_0x50e3('0x3d'),_0x50e3('0x3e')]]}]},{'model':db[_0x50e3('0x3f')],'as':_0x50e3('0x40')},{'model':db[_0x50e3('0x41')],'as':'Smtp'}]})[_0x50e3('0x11')](function(_0x1449df){if(_0x1449df&&_0x1449df[_0x50e3('0x3b')]){var _0x4721a0=_0x1449df[_0x50e3('0x42')]({'plain':!![]});_0x50d628[_0x50e3('0x39')]=_[_0x50e3('0x43')](_0x4721a0,[_0x50e3('0x40'),_0x50e3('0x3b')]);_0x50d628[_0x50e3('0x44')]=_0x4721a0['Applications'];_0x50d628[_0x50e3('0x45')]=_0x4721a0[_0x50e3('0x3b')];_0x50d628['applications']=_[_0x50e3('0x46')](_0x50d628['applications'],[_0x50e3('0x47')],[_0x50e3('0x48')]);if(_0x50d628[_0x50e3('0x39')]&&_0x50d628[_0x50e3('0x39')][_0x50e3('0x49')]){_0x50d628['applications']['push']({'id':0x0,'priority':_0x50d628[_0x50e3('0x44')][_0x50e3('0x4a')]+0x1,'app':'close','appdata':_0x50e3('0x49'),'interval':_0x50e3('0x4b')});}if(_0x50d628[_0x50e3('0x39')][_0x50e3('0x40')]){delete _0x50d628['account'][_0x50e3('0x40')];}if(_0x50d628['account'][_0x50e3('0x3b')]){delete _0x50d628['account'][_0x50e3('0x3b')];}if(_0x4721a0[_0x50e3('0x3b')][_0x50e3('0x3c')][_0x50e3('0x4a')]){return _0x4721a0[_0x50e3('0x3b')][_0x50e3('0x3c')][0x0];}var _0xc787e=_[_0x50e3('0xc')](_0x5511be['body'],{'firstName':_0x5511be['body'][_0x50e3('0x31')],'ListId':_0x4721a0['ListId']});_0xc787e[_0x5511be[_0x50e3('0x2a')][_0x50e3('0x35')]]=_0x5511be[_0x50e3('0x2a')]['from'];return db[_0x50e3('0x2d')]['create'](_0xc787e);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x21721d){_0x50d628[_0x50e3('0x4c')]=_0x21721d;if(_0x21721d){if(!_0x5511be[_0x50e3('0x2a')]['message'][_0x50e3('0x4d')]){_0x5511be['body']['message'][_0x50e3('0x4d')]=rs[_0x50e3('0x4e')]()+'\x20'+_0x5511be['body'][_0x50e3('0x1a')][_0x50e3('0x31')];}var _0x9368c9={'ContactId':_0x21721d['id'],'MailAccountId':_0x5511be[_0x50e3('0x39')]['id'],'inReplyTo':_0x5511be[_0x50e3('0x2a')][_0x50e3('0x1a')][_0x50e3('0x4d')],'to':_0x5511be[_0x50e3('0x2a')][_0x50e3('0x1a')][_0x50e3('0x31')],'cc':_0x5511be[_0x50e3('0x2a')][_0x50e3('0x1a')]['cc'],'subject':_0x5511be['body'][_0x50e3('0x1a')]['subject'],'attach':_0x5511be[_0x50e3('0x2a')][_0x50e3('0x1a')]['attach'],'lastMsgAt':moment()[_0x50e3('0x4f')](_0x50e3('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x5511be[_0x50e3('0x2a')][_0x50e3('0x2a')]};return db[_0x50e3('0x51')][_0x50e3('0x27')]({'where':{'closed':![],'MailAccountId':_0x5511be[_0x50e3('0x39')]['id']},'include':[{'model':db[_0x50e3('0x52')],'as':_0x50e3('0x53'),'attributes':[_0x50e3('0x4d')],'where':{'messageId':_0x5511be['body']['message'][_0x50e3('0x54')]}}]})[_0x50e3('0x11')](function(_0x3727f7){if(_0x3727f7){return[_0x3727f7,![]];}return db[_0x50e3('0x51')][_0x50e3('0x55')](_0x9368c9)['then'](function(_0x216476){return[_0x216476,!![]];});});}else{throw new Error(_0x50e3('0x56'));}})[_0x50e3('0x57')](function(_0x309592,_0x332e2c){if(_0x309592){_0x1716de=_0x332e2c;if(!_0x332e2c){return _0x309592[_0x50e3('0x58')]({'inReplyTo':_0x5511be[_0x50e3('0x2a')][_0x50e3('0x1a')][_0x50e3('0x4d')],'to':_0x5511be['body'][_0x50e3('0x1a')]['from'],'cc':_0x5511be['body'][_0x50e3('0x1a')]['cc'],'subject':_0x5511be[_0x50e3('0x2a')][_0x50e3('0x1a')][_0x50e3('0x59')],'attach':_0x309592[_0x50e3('0x5a')]?_0x309592[_0x50e3('0x5a')]:_0x5511be[_0x50e3('0x2a')]['message'][_0x50e3('0x5a')],'substatus':null,'substatusAt':moment()[_0x50e3('0x4f')](_0x50e3('0x50')),'lastMsgAt':moment()[_0x50e3('0x4f')](_0x50e3('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x5511be[_0x50e3('0x2a')]['body']});}else{return _0x309592;}}})['then'](function(_0xb29ddf){_0x50d628['interaction']=_0xb29ddf[_0x50e3('0x42')]({'plain':!![]});_0x50d628[_0x50e3('0x5b')]['created']=_0x1716de;return db[_0x50e3('0x52')][_0x50e3('0x55')]({'body':_0x5511be['body'][_0x50e3('0x2a')],'MailAccountId':_0x5511be[_0x50e3('0x39')]['id'],'MailInteractionId':_0xb29ddf['id'],'direction':'in','ContactId':_0x50d628['contact']['id'],'messageId':_0x5511be[_0x50e3('0x2a')]['message'][_0x50e3('0x4d')],'from':_0x5511be[_0x50e3('0x2a')][_0x50e3('0x1a')][_0x50e3('0x31')],'to':_0x5511be['body']['message']['to'],'cc':_0x5511be['body'][_0x50e3('0x1a')]['cc'],'subject':_0x5511be[_0x50e3('0x2a')][_0x50e3('0x1a')]['subject'],'attach':_0x5511be[_0x50e3('0x2a')]['message']['attach'],'Attachments':_0x5511be[_0x50e3('0x2a')][_0x50e3('0x1a')][_0x50e3('0x5c')],'originTo':_0x5511be[_0x50e3('0x2a')]['message'][_0x50e3('0x5d')],'originCc':_0x5511be[_0x50e3('0x2a')][_0x50e3('0x1a')][_0x50e3('0x5e')],'bcc':_0x5511be[_0x50e3('0x2a')][_0x50e3('0x1a')][_0x50e3('0x5f')]},{'include':[{'model':db['Attachment'],'as':_0x50e3('0x60')}]});})[_0x50e3('0x11')](function(_0x4da043){_0x50d628[_0x50e3('0x1a')]=_0x4da043;if(_0x50d628[_0x50e3('0x5b')][_0x50e3('0x61')]){return db['User'][_0x50e3('0x27')]({'attributes':['id','name'],'where':{'id':_0x50d628['interaction']['UserId']}})[_0x50e3('0x11')](function(_0x31689f){if(_0x31689f){_0x50d628['applications'][_0x50e3('0x62')]({'id':0x0,'priority':0x0,'app':_0x50e3('0x63'),'appdata':_0x31689f['name']+','+(_0x50d628['account']['waitForTheAssignedAgent']||0xa),'interval':_0x50e3('0x4b')});}return respondWithRpcPromise(_0x50e3('0x64'),'startRouting',_0x50d628);});}return respondWithRpcPromise(_0x50e3('0x64'),_0x50e3('0x65'),_0x50d628);})[_0x50e3('0x11')](function(_0x3b1ad9){_0x17c823(_0x3b1ad9);})['catch'](function(_0x58a3c3){_0x47e64e(_0x50079d[_0x50e3('0x18')](0x1f4,_0x58a3c3['message']));});});}; \ No newline at end of file +var _0xf2a6=['generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','update','interaction','created','Attachment','Attachments','UserId','name','unshift','agent','Start','startRouting','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','findAll','options','raw','where','limit','include','model','attributes','map','debug','ShowMailAccount','MailAccount','find','NotifyMailAccount','body','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','Contacts','MailApplication','Applications','MailServerOut','Smtp','List','get','omit','applications','list','priority','asc','autoclose','push','length','close','*,*,*,*','CmContact','create','List\x20not\x20found','messageId'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xf2a6,0x13d));var _0x6f2a=function(_0x21fa8f,_0x1ec930){_0x21fa8f=_0x21fa8f-0x0;var _0x3ccad1=_0xf2a6[_0x21fa8f];return _0x3ccad1;};'use strict';var _=require(_0x6f2a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6f2a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f2a('0x2'))['db'];var utils=require(_0x6f2a('0x3'));var logger=require(_0x6f2a('0x4'))(_0x6f2a('0x5'));var config=require(_0x6f2a('0x6'));var jayson=require(_0x6f2a('0x7'));var client=jayson[_0x6f2a('0x8')][_0x6f2a('0x9')]({'port':0x232c});config[_0x6f2a('0xa')]=_[_0x6f2a('0xb')](config['redis'],{'host':_0x6f2a('0xc'),'port':0x18eb});var socket=require(_0x6f2a('0xd'))(new Redis(config[_0x6f2a('0xa')]));require(_0x6f2a('0xe'))['register'](socket);function respondWithRpcPromise(_0x2fabc5,_0x5663e2,_0x310635){return new BPromise(function(_0x601b21,_0x396cb9){return client['request'](_0x2fabc5,_0x310635)[_0x6f2a('0xf')](function(_0x4b25c3){logger[_0x6f2a('0x10')](_0x6f2a('0x11'),_0x5663e2,_0x6f2a('0x12'));logger['debug'](_0x6f2a('0x13'),_0x5663e2,'request\x20sent',JSON[_0x6f2a('0x14')](_0x4b25c3));if(_0x4b25c3[_0x6f2a('0x15')]){if(_0x4b25c3[_0x6f2a('0x15')][_0x6f2a('0x16')]===0x1f4){logger[_0x6f2a('0x15')]('MailAccount,\x20%s,\x20%s',_0x5663e2,_0x4b25c3[_0x6f2a('0x15')][_0x6f2a('0x17')]);return _0x396cb9(_0x4b25c3[_0x6f2a('0x15')][_0x6f2a('0x17')]);}logger[_0x6f2a('0x15')](_0x6f2a('0x11'),_0x5663e2,_0x4b25c3[_0x6f2a('0x15')][_0x6f2a('0x17')]);return _0x601b21(_0x4b25c3[_0x6f2a('0x15')][_0x6f2a('0x17')]);}else{logger[_0x6f2a('0x10')](_0x6f2a('0x11'),_0x5663e2,'request\x20sent');_0x601b21(_0x4b25c3[_0x6f2a('0x18')][_0x6f2a('0x17')]);}})[_0x6f2a('0x19')](function(_0x1ff155){logger[_0x6f2a('0x15')](_0x6f2a('0x11'),_0x5663e2,_0x1ff155);_0x396cb9(_0x1ff155);});});}exports[_0x6f2a('0x1a')]=function(_0x224915){var _0x152052=this;return new Promise(function(_0x3e996b,_0x33554f){return db['MailAccount'][_0x6f2a('0x1b')]({'raw':_0x224915[_0x6f2a('0x1c')]?_0x224915[_0x6f2a('0x1c')][_0x6f2a('0x1d')]===undefined?!![]:![]:!![],'where':_0x224915[_0x6f2a('0x1c')]?_0x224915[_0x6f2a('0x1c')][_0x6f2a('0x1e')]||null:null,'attributes':_0x224915['options']?_0x224915[_0x6f2a('0x1c')]['attributes']||null:null,'limit':_0x224915[_0x6f2a('0x1c')]?_0x224915[_0x6f2a('0x1c')][_0x6f2a('0x1f')]||null:null,'include':_0x224915['options']?_0x224915[_0x6f2a('0x1c')][_0x6f2a('0x20')]?_['map'](_0x224915['options'][_0x6f2a('0x20')],function(_0x36c0b7){return{'model':db[_0x36c0b7[_0x6f2a('0x21')]],'as':_0x36c0b7['as'],'attributes':_0x36c0b7[_0x6f2a('0x22')],'include':_0x36c0b7[_0x6f2a('0x20')]?_['map'](_0x36c0b7[_0x6f2a('0x20')],function(_0x549dd7){return{'model':db[_0x549dd7[_0x6f2a('0x21')]],'as':_0x549dd7['as'],'attributes':_0x549dd7[_0x6f2a('0x22')],'include':_0x549dd7['include']?_[_0x6f2a('0x23')](_0x549dd7[_0x6f2a('0x20')],function(_0x498d7e){return{'model':db[_0x498d7e[_0x6f2a('0x21')]],'as':_0x498d7e['as'],'attributes':_0x498d7e[_0x6f2a('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6f2a('0xf')](function(_0x39a911){logger[_0x6f2a('0x10')](_0x6f2a('0x1a'),_0x224915);logger[_0x6f2a('0x24')]('GetMailAccount',_0x224915,JSON[_0x6f2a('0x14')](_0x39a911));_0x3e996b(_0x39a911);})['catch'](function(_0x34acb0){logger['error'](_0x6f2a('0x1a'),_0x34acb0[_0x6f2a('0x17')],_0x224915);_0x33554f(_0x152052[_0x6f2a('0x15')](0x1f4,_0x34acb0['message']));});});};exports[_0x6f2a('0x25')]=function(_0x5430fa){var _0x182edf=this;return new Promise(function(_0x42d9b8,_0x5a80e3){return db[_0x6f2a('0x26')][_0x6f2a('0x27')]({'raw':_0x5430fa[_0x6f2a('0x1c')]?_0x5430fa['options']['raw']===undefined?!![]:![]:!![],'where':_0x5430fa['options']?_0x5430fa[_0x6f2a('0x1c')]['where']||null:null,'attributes':_0x5430fa[_0x6f2a('0x1c')]?_0x5430fa[_0x6f2a('0x1c')]['attributes']||null:null,'include':_0x5430fa[_0x6f2a('0x1c')]?_0x5430fa[_0x6f2a('0x1c')][_0x6f2a('0x20')]?_[_0x6f2a('0x23')](_0x5430fa['options'][_0x6f2a('0x20')],function(_0x4f28eb){return{'model':db[_0x4f28eb[_0x6f2a('0x21')]],'as':_0x4f28eb['as'],'attributes':_0x4f28eb[_0x6f2a('0x22')],'include':_0x4f28eb[_0x6f2a('0x20')]?_[_0x6f2a('0x23')](_0x4f28eb[_0x6f2a('0x20')],function(_0x119175){return{'model':db[_0x119175[_0x6f2a('0x21')]],'as':_0x119175['as'],'attributes':_0x119175['attributes'],'include':_0x119175[_0x6f2a('0x20')]?_[_0x6f2a('0x23')](_0x119175[_0x6f2a('0x20')],function(_0x1945ad){return{'model':db[_0x1945ad[_0x6f2a('0x21')]],'as':_0x1945ad['as'],'attributes':_0x1945ad[_0x6f2a('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6f2a('0xf')](function(_0x4dbd15){logger[_0x6f2a('0x10')](_0x6f2a('0x25'),_0x5430fa);logger[_0x6f2a('0x24')]('ShowMailAccount',_0x5430fa,JSON[_0x6f2a('0x14')](_0x4dbd15));_0x42d9b8(_0x4dbd15);})[_0x6f2a('0x19')](function(_0x2b3c03){logger['error'](_0x6f2a('0x25'),_0x2b3c03[_0x6f2a('0x17')],_0x5430fa);_0x5a80e3(_0x182edf[_0x6f2a('0x15')](0x1f4,_0x2b3c03[_0x6f2a('0x17')]));});});};exports[_0x6f2a('0x28')]=function(_0x35ce69){var _0x335a0b=this;return new Promise(function(_0x44c61d,_0xb39009){var _0x35d4a8={'body':_0x35ce69[_0x6f2a('0x29')],'channel':'mail'};var _0x2b7a64=_[_0x6f2a('0x2a')](_[_0x6f2a('0x2b')](db['CmContact'][_0x6f2a('0x2c')]),[_0x6f2a('0x2d'),_0x6f2a('0x2e'),_0x6f2a('0x2f'),_0x6f2a('0x30')]);var _0x2c5fbb=![];if(_0x35ce69[_0x6f2a('0x29')]['id']){delete _0x35ce69[_0x6f2a('0x29')]['id'];}if(_['isNil'](_0x35ce69[_0x6f2a('0x29')]['from'])){return _0xb39009(_0x335a0b['error'](0x1f4,_0x6f2a('0x31')));}if(_[_0x6f2a('0x32')](_0x35ce69[_0x6f2a('0x29')][_0x6f2a('0x29')])||_0x35ce69['body'][_0x6f2a('0x29')]===''){return _0xb39009(_0x335a0b[_0x6f2a('0x15')](0x1f4,_0x6f2a('0x33')));}if(_[_0x6f2a('0x32')](_0x35ce69[_0x6f2a('0x29')][_0x6f2a('0x34')])){return _0xb39009(_0x335a0b['error'](0x1f4,_0x6f2a('0x35')+_0x2b7a64));}if(!_[_0x6f2a('0x36')](_0x2b7a64,_0x35ce69[_0x6f2a('0x29')][_0x6f2a('0x34')])){return _0xb39009(_0x335a0b[_0x6f2a('0x15')](0x1f4,_0x6f2a('0x37')+_0x2b7a64));}var _0x5367f6={};_0x5367f6[_0x35ce69['body'][_0x6f2a('0x34')]]=_0x35ce69['body'][_0x6f2a('0x38')];return db['MailAccount'][_0x6f2a('0x27')]({'where':{'id':_0x35ce69[_0x6f2a('0x39')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x6f2a('0x3a'),'where':_0x5367f6,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x6f2a('0x3b')],'as':_0x6f2a('0x3c')},{'model':db[_0x6f2a('0x3d')],'as':_0x6f2a('0x3e')}]})['then'](function(_0x1e86ad){if(_0x1e86ad&&_0x1e86ad[_0x6f2a('0x3f')]){var _0x254233=_0x1e86ad[_0x6f2a('0x40')]({'plain':!![]});_0x35d4a8[_0x6f2a('0x39')]=_[_0x6f2a('0x41')](_0x254233,['Applications',_0x6f2a('0x3f')]);_0x35d4a8[_0x6f2a('0x42')]=_0x254233[_0x6f2a('0x3c')];_0x35d4a8[_0x6f2a('0x43')]=_0x254233[_0x6f2a('0x3f')];_0x35d4a8[_0x6f2a('0x42')]=_['orderBy'](_0x35d4a8[_0x6f2a('0x42')],[_0x6f2a('0x44')],[_0x6f2a('0x45')]);if(_0x35d4a8['account']&&_0x35d4a8['account'][_0x6f2a('0x46')]){_0x35d4a8[_0x6f2a('0x42')][_0x6f2a('0x47')]({'id':0x0,'priority':_0x35d4a8[_0x6f2a('0x42')][_0x6f2a('0x48')]+0x1,'app':_0x6f2a('0x49'),'appdata':_0x6f2a('0x46'),'interval':_0x6f2a('0x4a')});}if(_0x35d4a8[_0x6f2a('0x39')][_0x6f2a('0x3c')]){delete _0x35d4a8[_0x6f2a('0x39')][_0x6f2a('0x3c')];}if(_0x35d4a8[_0x6f2a('0x39')]['List']){delete _0x35d4a8[_0x6f2a('0x39')]['List'];}if(_0x254233[_0x6f2a('0x3f')]['Contacts'][_0x6f2a('0x48')]){return _0x254233['List'][_0x6f2a('0x3a')][0x0];}var _0x1c1ad9=_[_0x6f2a('0xb')](_0x35ce69['body'],{'firstName':_0x35ce69[_0x6f2a('0x29')]['from'],'ListId':_0x254233[_0x6f2a('0x30')]});_0x1c1ad9[_0x35ce69['body']['mapKey']]=_0x35ce69[_0x6f2a('0x29')][_0x6f2a('0x38')];return db[_0x6f2a('0x4b')][_0x6f2a('0x4c')](_0x1c1ad9);}else{throw new Error(_0x6f2a('0x4d'));}})[_0x6f2a('0xf')](function(_0x3b7ea4){_0x35d4a8['contact']=_0x3b7ea4;if(_0x3b7ea4){if(!_0x35ce69[_0x6f2a('0x29')][_0x6f2a('0x17')][_0x6f2a('0x4e')]){_0x35ce69[_0x6f2a('0x29')][_0x6f2a('0x17')][_0x6f2a('0x4e')]=rs[_0x6f2a('0x4f')]()+'\x20'+_0x35ce69[_0x6f2a('0x29')][_0x6f2a('0x17')][_0x6f2a('0x38')];}var _0x2c9133={'ContactId':_0x3b7ea4['id'],'MailAccountId':_0x35ce69[_0x6f2a('0x39')]['id'],'inReplyTo':_0x35ce69[_0x6f2a('0x29')]['message'][_0x6f2a('0x4e')],'to':_0x35ce69[_0x6f2a('0x29')][_0x6f2a('0x17')][_0x6f2a('0x38')],'cc':_0x35ce69[_0x6f2a('0x29')][_0x6f2a('0x17')]['cc'],'subject':_0x35ce69[_0x6f2a('0x29')][_0x6f2a('0x17')][_0x6f2a('0x50')],'attach':_0x35ce69['body'][_0x6f2a('0x17')][_0x6f2a('0x51')],'lastMsgAt':moment()[_0x6f2a('0x52')](_0x6f2a('0x53')),'lastMsgDirection':'in','lastMsgBody':_0x35ce69[_0x6f2a('0x29')][_0x6f2a('0x29')]};return db[_0x6f2a('0x54')][_0x6f2a('0x27')]({'where':{'closed':![],'MailAccountId':_0x35ce69[_0x6f2a('0x39')]['id']},'include':[{'model':db[_0x6f2a('0x55')],'as':'Messages','attributes':[_0x6f2a('0x4e')],'where':{'messageId':_0x35ce69[_0x6f2a('0x29')]['message'][_0x6f2a('0x56')]}}]})[_0x6f2a('0xf')](function(_0x2609cd){if(_0x2609cd){return[_0x2609cd,![]];}return db[_0x6f2a('0x54')]['create'](_0x2c9133)['then'](function(_0x3097e8){return[_0x3097e8,!![]];});});}else{throw new Error(_0x6f2a('0x57'));}})['spread'](function(_0x3518de,_0x190f60){if(_0x3518de){_0x2c5fbb=_0x190f60;if(!_0x190f60){return _0x3518de[_0x6f2a('0x58')]({'inReplyTo':_0x35ce69[_0x6f2a('0x29')]['message'][_0x6f2a('0x4e')],'to':_0x35ce69[_0x6f2a('0x29')][_0x6f2a('0x17')][_0x6f2a('0x38')],'cc':_0x35ce69[_0x6f2a('0x29')][_0x6f2a('0x17')]['cc'],'subject':_0x35ce69[_0x6f2a('0x29')][_0x6f2a('0x17')][_0x6f2a('0x50')],'attach':_0x3518de['attach']?_0x3518de[_0x6f2a('0x51')]:_0x35ce69[_0x6f2a('0x29')][_0x6f2a('0x17')][_0x6f2a('0x51')],'substatus':null,'substatusAt':moment()[_0x6f2a('0x52')](_0x6f2a('0x53')),'lastMsgAt':moment()[_0x6f2a('0x52')](_0x6f2a('0x53')),'lastMsgDirection':'in','lastMsgBody':_0x35ce69[_0x6f2a('0x29')][_0x6f2a('0x29')]});}else{return _0x3518de;}}})[_0x6f2a('0xf')](function(_0x34eb85){_0x35d4a8[_0x6f2a('0x59')]=_0x34eb85[_0x6f2a('0x40')]({'plain':!![]});_0x35d4a8[_0x6f2a('0x59')][_0x6f2a('0x5a')]=_0x2c5fbb;return db[_0x6f2a('0x55')][_0x6f2a('0x4c')]({'body':_0x35ce69[_0x6f2a('0x29')][_0x6f2a('0x29')],'MailAccountId':_0x35ce69[_0x6f2a('0x39')]['id'],'MailInteractionId':_0x34eb85['id'],'direction':'in','ContactId':_0x35d4a8['contact']['id'],'messageId':_0x35ce69[_0x6f2a('0x29')]['message'][_0x6f2a('0x4e')],'from':_0x35ce69[_0x6f2a('0x29')]['message'][_0x6f2a('0x38')],'to':_0x35ce69[_0x6f2a('0x29')][_0x6f2a('0x17')]['to'],'cc':_0x35ce69[_0x6f2a('0x29')][_0x6f2a('0x17')]['cc'],'subject':_0x35ce69['body'][_0x6f2a('0x17')][_0x6f2a('0x50')],'attach':_0x35ce69['body'][_0x6f2a('0x17')]['attach'],'Attachments':_0x35ce69[_0x6f2a('0x29')][_0x6f2a('0x17')]['attachments'],'originTo':_0x35ce69[_0x6f2a('0x29')][_0x6f2a('0x17')]['originTo'],'originCc':_0x35ce69['body']['message']['originCc'],'bcc':_0x35ce69['body'][_0x6f2a('0x17')]['bcc']},{'include':[{'model':db[_0x6f2a('0x5b')],'as':_0x6f2a('0x5c')}]});})['then'](function(_0x3e123a){_0x35d4a8[_0x6f2a('0x17')]=_0x3e123a;if(_0x35d4a8[_0x6f2a('0x59')][_0x6f2a('0x5d')]){return db['User'][_0x6f2a('0x27')]({'attributes':['id',_0x6f2a('0x5e')],'where':{'id':_0x35d4a8[_0x6f2a('0x59')][_0x6f2a('0x5d')]}})[_0x6f2a('0xf')](function(_0x28ff85){if(_0x28ff85){_0x35d4a8['applications'][_0x6f2a('0x5f')]({'id':0x0,'priority':0x0,'app':_0x6f2a('0x60'),'appdata':_0x28ff85[_0x6f2a('0x5e')]+','+(_0x35d4a8['account']['waitForTheAssignedAgent']||0xa),'interval':_0x6f2a('0x4a')});}return respondWithRpcPromise(_0x6f2a('0x61'),_0x6f2a('0x62'),_0x35d4a8);});}return respondWithRpcPromise(_0x6f2a('0x61'),_0x6f2a('0x62'),_0x35d4a8);})['then'](function(_0x8f8eb7){_0x44c61d(_0x8f8eb7);})['catch'](function(_0x3365cd){_0xb39009(_0x335a0b[_0x6f2a('0x15')](0x1f4,_0x3365cd[_0x6f2a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 4b83aa5..85a35d0 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 _0x6334=['length','mailAccount:','./mailAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x2f2402,_0x20d316){var _0x2d1348=function(_0x1e676a){while(--_0x1e676a){_0x2f2402['push'](_0x2f2402['shift']());}};_0x2d1348(++_0x20d316);}(_0x6334,0x119));var _0x4633=function(_0x680b65,_0x5b2e9c){_0x680b65=_0x680b65-0x0;var _0x1c2053=_0x6334[_0x680b65];return _0x1c2053;};'use strict';var MailAccountEvents=require(_0x4633('0x0'));var events=[_0x4633('0x1'),_0x4633('0x2'),_0x4633('0x3')];function createListener(_0x1e53a0,_0x47254b){return function(_0x5109db){_0x47254b[_0x4633('0x4')](_0x1e53a0,_0x5109db);};}function removeListener(_0x205442,_0x2a2b3c){return function(){MailAccountEvents[_0x4633('0x5')](_0x205442,_0x2a2b3c);};}exports[_0x4633('0x6')]=function(_0x6493dc){for(var _0x175e14=0x0,_0x4a8997=events[_0x4633('0x7')];_0x175e14<_0x4a8997;_0x175e14++){var _0x56891d=events[_0x175e14];var _0x21af74=createListener(_0x4633('0x8')+_0x56891d,_0x6493dc);MailAccountEvents['on'](_0x56891d,_0x21af74);}}; \ No newline at end of file +var _0x2087=['register','length','mailAccount:','./mailAccount.events','save','remove','update','emit'];(function(_0x332e16,_0x3d69cc){var _0x4338a8=function(_0x4303e8){while(--_0x4303e8){_0x332e16['push'](_0x332e16['shift']());}};_0x4338a8(++_0x3d69cc);}(_0x2087,0xf3));var _0x7208=function(_0x3d6a00,_0x41f7f6){_0x3d6a00=_0x3d6a00-0x0;var _0xaeb4d5=_0x2087[_0x3d6a00];return _0xaeb4d5;};'use strict';var MailAccountEvents=require(_0x7208('0x0'));var events=[_0x7208('0x1'),_0x7208('0x2'),_0x7208('0x3')];function createListener(_0x5eea11,_0xace481){return function(_0x3df29d){_0xace481[_0x7208('0x4')](_0x5eea11,_0x3df29d);};}function removeListener(_0x1d5d58,_0x4d7cd4){return function(){MailAccountEvents['removeListener'](_0x1d5d58,_0x4d7cd4);};}exports[_0x7208('0x5')]=function(_0x5cc93f){for(var _0x3c7d9d=0x0,_0x502ccb=events[_0x7208('0x6')];_0x3c7d9d<_0x502ccb;_0x3c7d9d++){var _0x328f94=events[_0x3c7d9d];var _0x2bf5f4=createListener(_0x7208('0x7')+_0x328f94,_0x5cc93f);MailAccountEvents['on'](_0x328f94,_0x2bf5f4);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 67bc60a..34f6f3a 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 _0xeffd=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer'];(function(_0x4e9523,_0x320824){var _0x3ccc87=function(_0x55d549){while(--_0x55d549){_0x4e9523['push'](_0x4e9523['shift']());}};_0x3ccc87(++_0x320824);}(_0xeffd,0x6b));var _0xdeff=function(_0x3844ff,_0xf4264a){_0x3844ff=_0x3844ff-0x0;var _0x3f6796=_0xeffd[_0x3844ff];return _0x3f6796;};'use strict';var multer=require(_0xdeff('0x0'));var util=require('util');var path=require(_0xdeff('0x1'));var timeout=require(_0xdeff('0x2'));var express=require(_0xdeff('0x3'));var router=express[_0xdeff('0x4')]();var auth=require(_0xdeff('0x5'));var interaction=require(_0xdeff('0x6'));var config=require(_0xdeff('0x7'));var controller=require(_0xdeff('0x8'));router[_0xdeff('0x9')](_0xdeff('0xa'),auth[_0xdeff('0xb')](),controller[_0xdeff('0xc')]);router[_0xdeff('0xd')](_0xdeff('0xa'),auth[_0xdeff('0xb')](),controller[_0xdeff('0xe')]);router[_0xdeff('0xf')]('/:id',auth[_0xdeff('0xb')](),controller[_0xdeff('0x10')]);module[_0xdeff('0x11')]=router; \ No newline at end of file +var _0x4ded=['/:id','show','put','isAuthenticated','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get'];(function(_0x495c52,_0x53c0cc){var _0x2b4bb2=function(_0x536d43){while(--_0x536d43){_0x495c52['push'](_0x495c52['shift']());}};_0x2b4bb2(++_0x53c0cc);}(_0x4ded,0x116));var _0xd4de=function(_0x490bfa,_0x5d2c01){_0x490bfa=_0x490bfa-0x0;var _0x19ab36=_0x4ded[_0x490bfa];return _0x19ab36;};'use strict';var multer=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var path=require(_0xd4de('0x2'));var timeout=require(_0xd4de('0x3'));var express=require(_0xd4de('0x4'));var router=express[_0xd4de('0x5')]();var auth=require(_0xd4de('0x6'));var interaction=require(_0xd4de('0x7'));var config=require(_0xd4de('0x8'));var controller=require(_0xd4de('0x9'));router[_0xd4de('0xa')](_0xd4de('0xb'),auth['isAuthenticated'](),controller[_0xd4de('0xc')]);router[_0xd4de('0xd')](_0xd4de('0xb'),auth[_0xd4de('0xe')](),controller[_0xd4de('0xf')]);router[_0xd4de('0x10')]('/:id',auth[_0xd4de('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index d902e2f..c446c42 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 _0xe65b=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x3be17d,_0x387563){var _0xf39c28=function(_0x13d38d){while(--_0x13d38d){_0x3be17d['push'](_0x3be17d['shift']());}};_0xf39c28(++_0x387563);}(_0xe65b,0x1a5));var _0xbe65=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xe65b[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0xbe65('0x0'));module['exports']={'priority':{'type':Sequelize[_0xbe65('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xbe65('0x2')],'allowNull':![],'defaultValue':_0xbe65('0x3')},'appdata':{'type':Sequelize[_0xbe65('0x4')]()},'description':{'type':Sequelize[_0xbe65('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xbe65('0x5')}}; \ No newline at end of file +var _0xb7a9=['STRING','TEXT','INTEGER'];(function(_0x454d6c,_0x4ae444){var _0x410af9=function(_0x56b7af){while(--_0x56b7af){_0x454d6c['push'](_0x454d6c['shift']());}};_0x410af9(++_0x4ae444);}(_0xb7a9,0x140));var _0x9b7a=function(_0x41d666,_0x1665d9){_0x41d666=_0x41d666-0x0;var _0x4a597a=_0xb7a9[_0x41d666];return _0x4a597a;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x9b7a('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x9b7a('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9b7a('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9b7a('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index bc40fb3..8484dba 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 _0x13fa=['params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','../../mysqldb','json','count','offset','limit','status','set','reject','update','then','destroy','sendStatus','stack','name','send','query','keys','model','attributes','fields','length','includeAll','include','merge','options','MailApplication','find','body'];(function(_0x2009b1,_0x982375){var _0x3855cd=function(_0x30566a){while(--_0x30566a){_0x2009b1['push'](_0x2009b1['shift']());}};_0x3855cd(++_0x982375);}(_0x13fa,0x1a2));var _0xa13f=function(_0x1a89ca,_0x27394b){_0x1a89ca=_0x1a89ca-0x0;var _0x29cbb2=_0x13fa[_0x1a89ca];return _0x29cbb2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa13f('0x0'));var rimraf=require(_0xa13f('0x1'));var zipdir=require(_0xa13f('0x2'));var jsonpatch=require(_0xa13f('0x3'));var rp=require(_0xa13f('0x4'));var moment=require(_0xa13f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa13f('0x6'));var sox=require(_0xa13f('0x7'));var csv=require(_0xa13f('0x8'));var ejs=require(_0xa13f('0x9'));var fs=require('fs');var _=require(_0xa13f('0xa'));var squel=require(_0xa13f('0xb'));var crypto=require(_0xa13f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa13f('0xd'));var toCsv=require(_0xa13f('0x8'));var querystring=require(_0xa13f('0xe'));var Papa=require(_0xa13f('0xf'));var Redis=require(_0xa13f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa13f('0x11'));var as=require(_0xa13f('0x12'));var hardwareService=require(_0xa13f('0x13'));var logger=require('../../config/logger')(_0xa13f('0x14'));var utils=require('../../config/utils');var config=require(_0xa13f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa13f('0x16'))['db'];function respondWithStatusCode(_0xdd6ca,_0x2468f2){_0x2468f2=_0x2468f2||0xcc;return function(_0x186c60){if(_0x186c60){return _0xdd6ca['sendStatus'](_0x2468f2);}return _0xdd6ca['status'](_0x2468f2)['end']();};}function respondWithResult(_0x3ee3aa,_0xa1fc47){_0xa1fc47=_0xa1fc47||0xc8;return function(_0x2c67a7){if(_0x2c67a7){return _0x3ee3aa['status'](_0xa1fc47)[_0xa13f('0x17')](_0x2c67a7);}};}function respondWithFilteredResult(_0x15cfbb,_0x1f24f6){return function(_0xd4751b){if(_0xd4751b){var _0x1088fc=_0xd4751b[_0xa13f('0x18')],_0x383834=_0x1f24f6[_0xa13f('0x19')],_0x4c7a5a=_0x1f24f6[_0xa13f('0x19')]+_0x1f24f6[_0xa13f('0x1a')],_0x13af60;if(_0x4c7a5a>=_0x1088fc){_0x4c7a5a=_0x1088fc;_0x13af60=0xc8;}else{_0x13af60=0xce;}_0x15cfbb[_0xa13f('0x1b')](_0x13af60);return _0x15cfbb[_0xa13f('0x1c')]('Content-Range',_0x383834+'-'+_0x4c7a5a+'/'+_0x1088fc)['json'](_0xd4751b);}return null;};}function patchUpdates(_0x420024){return function(_0x5ea429){try{jsonpatch['apply'](_0x5ea429,_0x420024,!![]);}catch(_0x59ee85){return BPromise[_0xa13f('0x1d')](_0x59ee85);}return _0x5ea429['save']();};}function saveUpdates(_0x598cc1,_0x1abe59){return function(_0x5c3f4c){if(_0x5c3f4c){return _0x5c3f4c[_0xa13f('0x1e')](_0x598cc1)[_0xa13f('0x1f')](function(_0x18f674){return _0x18f674;});}return null;};}function removeEntity(_0x180888,_0x202037){return function(_0x42eafb){if(_0x42eafb){return _0x42eafb[_0xa13f('0x20')]()['then'](function(){_0x180888['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x161fb7,_0x5d6c25){return function(_0x36c89b){if(!_0x36c89b){_0x161fb7[_0xa13f('0x21')](0x194);}return _0x36c89b;};}function handleError(_0x5c396a,_0x49da3a){_0x49da3a=_0x49da3a||0x1f4;return function(_0x576f76){logger['error'](_0x576f76[_0xa13f('0x22')]);if(_0x576f76[_0xa13f('0x23')]){delete _0x576f76[_0xa13f('0x23')];}_0x5c396a[_0xa13f('0x1b')](_0x49da3a)[_0xa13f('0x24')](_0x576f76);};}exports['show']=function(_0x42ac5e,_0x4582cb){var _0x2c6ddf={'raw':!![],'where':{'id':_0x42ac5e['params']['id']}},_0x42f0ef={};_0x42f0ef['model']=_['keys'](db['MailApplication']['rawAttributes']);_0x42f0ef[_0xa13f('0x25')]=_[_0xa13f('0x26')](_0x42ac5e[_0xa13f('0x25')]);_0x42f0ef['filters']=_['intersection'](_0x42f0ef[_0xa13f('0x27')],_0x42f0ef['query']);_0x2c6ddf[_0xa13f('0x28')]=_['intersection'](_0x42f0ef[_0xa13f('0x27')],qs[_0xa13f('0x29')](_0x42ac5e[_0xa13f('0x25')]['fields']));_0x2c6ddf[_0xa13f('0x28')]=_0x2c6ddf[_0xa13f('0x28')][_0xa13f('0x2a')]?_0x2c6ddf[_0xa13f('0x28')]:_0x42f0ef[_0xa13f('0x27')];if(_0x42ac5e[_0xa13f('0x25')][_0xa13f('0x2b')]){_0x2c6ddf[_0xa13f('0x2c')]=[{'all':!![]}];}_0x2c6ddf=_[_0xa13f('0x2d')]({},_0x2c6ddf,_0x42ac5e[_0xa13f('0x2e')]);return db[_0xa13f('0x2f')][_0xa13f('0x30')](_0x2c6ddf)['then'](handleEntityNotFound(_0x4582cb,null))[_0xa13f('0x1f')](respondWithResult(_0x4582cb,null))['catch'](handleError(_0x4582cb,null));};exports[_0xa13f('0x1e')]=function(_0x260d06,_0x5c5945){if(_0x260d06[_0xa13f('0x31')]['id']){delete _0x260d06[_0xa13f('0x31')]['id'];}return db[_0xa13f('0x2f')][_0xa13f('0x30')]({'where':{'id':_0x260d06['params']['id']}})[_0xa13f('0x1f')](handleEntityNotFound(_0x5c5945,null))[_0xa13f('0x1f')](saveUpdates(_0x260d06[_0xa13f('0x31')],null))[_0xa13f('0x1f')](respondWithResult(_0x5c5945,null))['catch'](handleError(_0x5c5945,null));};exports[_0xa13f('0x20')]=function(_0x1703f7,_0x41cbf0){return db[_0xa13f('0x2f')][_0xa13f('0x30')]({'where':{'id':_0x1703f7[_0xa13f('0x32')]['id']}})[_0xa13f('0x1f')](handleEntityNotFound(_0x41cbf0,null))[_0xa13f('0x1f')](removeEntity(_0x41cbf0,null))[_0xa13f('0x33')](handleError(_0x41cbf0,null));}; \ No newline at end of file +var _0x82b2=['body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','name','send','show','params','model','keys','MailApplication','rawAttributes','query','intersection','attributes','fields','include','find','catch'];(function(_0x44937e,_0x1757db){var _0x1dcdba=function(_0x4b21b1){while(--_0x4b21b1){_0x44937e['push'](_0x44937e['shift']());}};_0x1dcdba(++_0x1757db);}(_0x82b2,0x174));var _0x282b=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0x82b2[_0x4687df];return _0x32eaef;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x282b('0x0'));var rimraf=require(_0x282b('0x1'));var zipdir=require(_0x282b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x282b('0x3'));var moment=require(_0x282b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x282b('0x5'));var util=require(_0x282b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x282b('0x7'));var ejs=require(_0x282b('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x282b('0x9'));var crypto=require('crypto');var jsforce=require(_0x282b('0xa'));var deskjs=require(_0x282b('0xb'));var toCsv=require(_0x282b('0x7'));var querystring=require(_0x282b('0xc'));var Papa=require(_0x282b('0xd'));var Redis=require(_0x282b('0xe'));var authService=require(_0x282b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x282b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x282b('0x11'))(_0x282b('0x12'));var utils=require('../../config/utils');var config=require(_0x282b('0x13'));var licenseUtil=require(_0x282b('0x14'));var db=require(_0x282b('0x15'))['db'];function respondWithStatusCode(_0x3e3196,_0x5e398b){_0x5e398b=_0x5e398b||0xcc;return function(_0x51dd0c){if(_0x51dd0c){return _0x3e3196['sendStatus'](_0x5e398b);}return _0x3e3196[_0x282b('0x16')](_0x5e398b)['end']();};}function respondWithResult(_0x256a6c,_0xec76a0){_0xec76a0=_0xec76a0||0xc8;return function(_0x30f799){if(_0x30f799){return _0x256a6c[_0x282b('0x16')](_0xec76a0)[_0x282b('0x17')](_0x30f799);}};}function respondWithFilteredResult(_0x2c698e,_0x220b45){return function(_0x15f4be){if(_0x15f4be){var _0x35336e=_0x15f4be[_0x282b('0x18')],_0x3d991f=_0x220b45['offset'],_0x34cbe5=_0x220b45[_0x282b('0x19')]+_0x220b45[_0x282b('0x1a')],_0x55280;if(_0x34cbe5>=_0x35336e){_0x34cbe5=_0x35336e;_0x55280=0xc8;}else{_0x55280=0xce;}_0x2c698e[_0x282b('0x16')](_0x55280);return _0x2c698e[_0x282b('0x1b')](_0x282b('0x1c'),_0x3d991f+'-'+_0x34cbe5+'/'+_0x35336e)[_0x282b('0x17')](_0x15f4be);}return null;};}function patchUpdates(_0x263946){return function(_0x21cd25){try{jsonpatch[_0x282b('0x1d')](_0x21cd25,_0x263946,!![]);}catch(_0x3b04b1){return BPromise[_0x282b('0x1e')](_0x3b04b1);}return _0x21cd25[_0x282b('0x1f')]();};}function saveUpdates(_0x41379c,_0x2292c9){return function(_0x510ade){if(_0x510ade){return _0x510ade[_0x282b('0x20')](_0x41379c)['then'](function(_0x54fbf7){return _0x54fbf7;});}return null;};}function removeEntity(_0x4ac0db,_0x17927b){return function(_0x3900b5){if(_0x3900b5){return _0x3900b5[_0x282b('0x21')]()[_0x282b('0x22')](function(){_0x4ac0db[_0x282b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c6fd3,_0x742ec1){return function(_0xd2b9ab){if(!_0xd2b9ab){_0x3c6fd3[_0x282b('0x23')](0x194);}return _0xd2b9ab;};}function handleError(_0x1f9af7,_0x369acc){_0x369acc=_0x369acc||0x1f4;return function(_0x571a3f){logger[_0x282b('0x24')](_0x571a3f['stack']);if(_0x571a3f[_0x282b('0x25')]){delete _0x571a3f[_0x282b('0x25')];}_0x1f9af7[_0x282b('0x16')](_0x369acc)[_0x282b('0x26')](_0x571a3f);};}exports[_0x282b('0x27')]=function(_0x35f48e,_0x148921){var _0x3ca8c5={'raw':!![],'where':{'id':_0x35f48e[_0x282b('0x28')]['id']}},_0x490c3d={};_0x490c3d[_0x282b('0x29')]=_[_0x282b('0x2a')](db[_0x282b('0x2b')][_0x282b('0x2c')]);_0x490c3d[_0x282b('0x2d')]=_['keys'](_0x35f48e['query']);_0x490c3d['filters']=_[_0x282b('0x2e')](_0x490c3d[_0x282b('0x29')],_0x490c3d[_0x282b('0x2d')]);_0x3ca8c5[_0x282b('0x2f')]=_[_0x282b('0x2e')](_0x490c3d['model'],qs['fields'](_0x35f48e[_0x282b('0x2d')][_0x282b('0x30')]));_0x3ca8c5[_0x282b('0x2f')]=_0x3ca8c5[_0x282b('0x2f')]['length']?_0x3ca8c5[_0x282b('0x2f')]:_0x490c3d['model'];if(_0x35f48e[_0x282b('0x2d')]['includeAll']){_0x3ca8c5[_0x282b('0x31')]=[{'all':!![]}];}_0x3ca8c5=_['merge']({},_0x3ca8c5,_0x35f48e['options']);return db[_0x282b('0x2b')][_0x282b('0x32')](_0x3ca8c5)[_0x282b('0x22')](handleEntityNotFound(_0x148921,null))[_0x282b('0x22')](respondWithResult(_0x148921,null))[_0x282b('0x33')](handleError(_0x148921,null));};exports[_0x282b('0x20')]=function(_0x457e7c,_0x44c5f8){if(_0x457e7c[_0x282b('0x34')]['id']){delete _0x457e7c[_0x282b('0x34')]['id'];}return db[_0x282b('0x2b')][_0x282b('0x32')]({'where':{'id':_0x457e7c[_0x282b('0x28')]['id']}})[_0x282b('0x22')](handleEntityNotFound(_0x44c5f8,null))[_0x282b('0x22')](saveUpdates(_0x457e7c[_0x282b('0x34')],null))[_0x282b('0x22')](respondWithResult(_0x44c5f8,null))[_0x282b('0x33')](handleError(_0x44c5f8,null));};exports[_0x282b('0x21')]=function(_0x24d7cd,_0x33df50){return db[_0x282b('0x2b')]['find']({'where':{'id':_0x24d7cd[_0x282b('0x28')]['id']}})[_0x282b('0x22')](handleEntityNotFound(_0x33df50,null))[_0x282b('0x22')](removeEntity(_0x33df50,null))[_0x282b('0x33')](handleError(_0x33df50,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index f8f1eb3..36e45f7 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 _0x50a8=['MailApplication','mail_applications','utf8mb4','util','api','moment','bluebird','request-promise','./mailApplication.attributes','exports'];(function(_0x49aa7d,_0x5d46d8){var _0xdd0d26=function(_0x159df7){while(--_0x159df7){_0x49aa7d['push'](_0x49aa7d['shift']());}};_0xdd0d26(++_0x5d46d8);}(_0x50a8,0x193));var _0x850a=function(_0x3eff8f,_0x58a445){_0x3eff8f=_0x3eff8f-0x0;var _0x23eabd=_0x50a8[_0x3eff8f];return _0x23eabd;};'use strict';var _=require('lodash');var util=require(_0x850a('0x0'));var logger=require('../../config/logger')(_0x850a('0x1'));var moment=require(_0x850a('0x2'));var BPromise=require(_0x850a('0x3'));var rp=require(_0x850a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x850a('0x5'));module[_0x850a('0x6')]=function(_0x530b92,_0x31c037){return _0x530b92['define'](_0x850a('0x7'),attributes,{'tableName':_0x850a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x850a('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd237=['api','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0xa2c139,_0xa6a01c){var _0xd343f=function(_0x50babc){while(--_0x50babc){_0xa2c139['push'](_0xa2c139['shift']());}};_0xd343f(++_0xa6a01c);}(_0xd237,0x14f));var _0x7d23=function(_0x1c2051,_0x4cb6b9){_0x1c2051=_0x1c2051-0x0;var _0x2b58a0=_0xd237[_0x1c2051];return _0x2b58a0;};'use strict';var _=require(_0x7d23('0x0'));var util=require(_0x7d23('0x1'));var logger=require(_0x7d23('0x2'))(_0x7d23('0x3'));var moment=require('moment');var BPromise=require(_0x7d23('0x4'));var rp=require(_0x7d23('0x5'));var fs=require('fs');var path=require(_0x7d23('0x6'));var rimraf=require(_0x7d23('0x7'));var config=require(_0x7d23('0x8'));var attributes=require(_0x7d23('0x9'));module['exports']=function(_0x24f10b,_0x5e9d09){return _0x24f10b['define']('MailApplication',attributes,{'tableName':_0x7d23('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7d23('0xb'),'collate':_0x7d23('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 41333b7..7fc177a 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 _0x21d6=['info','catch','UpdateMailApplication','MailApplication','body','options','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x109bc5,_0x2a3f2a){var _0x40238b=function(_0x32233a){while(--_0x32233a){_0x109bc5['push'](_0x109bc5['shift']());}};_0x40238b(++_0x2a3f2a);}(_0x21d6,0xfc));var _0x621d=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x21d6[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x621d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x621d('0x1'));var rs=require(_0x621d('0x2'));var fs=require('fs');var Redis=require(_0x621d('0x3'));var db=require(_0x621d('0x4'))['db'];var utils=require(_0x621d('0x5'));var logger=require(_0x621d('0x6'))(_0x621d('0x7'));var config=require('../../config/environment');var jayson=require(_0x621d('0x8'));var client=jayson[_0x621d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a06d4,_0x21c231,_0x59443b){return new BPromise(function(_0x379df5,_0xe3e56d){return client[_0x621d('0xa')](_0x5a06d4,_0x59443b)[_0x621d('0xb')](function(_0x5426be){logger['info'](_0x621d('0xc'),_0x21c231,_0x621d('0xd'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x21c231,_0x621d('0xd'),JSON[_0x621d('0xe')](_0x5426be));if(_0x5426be[_0x621d('0xf')]){if(_0x5426be[_0x621d('0xf')][_0x621d('0x10')]===0x1f4){logger[_0x621d('0xf')](_0x621d('0xc'),_0x21c231,_0x5426be[_0x621d('0xf')][_0x621d('0x11')]);return _0xe3e56d(_0x5426be[_0x621d('0xf')]['message']);}logger[_0x621d('0xf')]('MailApplication,\x20%s,\x20%s',_0x21c231,_0x5426be[_0x621d('0xf')][_0x621d('0x11')]);return _0x379df5(_0x5426be[_0x621d('0xf')][_0x621d('0x11')]);}else{logger[_0x621d('0x12')]('MailApplication,\x20%s,\x20%s',_0x21c231,_0x621d('0xd'));_0x379df5(_0x5426be['result'][_0x621d('0x11')]);}})[_0x621d('0x13')](function(_0x1fed1d){logger[_0x621d('0xf')](_0x621d('0xc'),_0x21c231,_0x1fed1d);_0xe3e56d(_0x1fed1d);});});}exports[_0x621d('0x14')]=function(_0x4d562b){var _0x383653=this;return new Promise(function(_0x4db0f3,_0x3e0149){return db[_0x621d('0x15')]['update'](_0x4d562b[_0x621d('0x16')],{'raw':_0x4d562b[_0x621d('0x17')]?_0x4d562b['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d562b[_0x621d('0x17')]?_0x4d562b[_0x621d('0x17')][_0x621d('0x18')]||null:null,'attributes':_0x4d562b[_0x621d('0x17')]?_0x4d562b[_0x621d('0x17')][_0x621d('0x19')]||null:null,'limit':_0x4d562b['options']?_0x4d562b[_0x621d('0x17')][_0x621d('0x1a')]||null:null})[_0x621d('0xb')](function(_0x35c7d8){logger[_0x621d('0x12')](_0x621d('0x14'),_0x4d562b);logger['debug'](_0x621d('0x14'),_0x4d562b,JSON[_0x621d('0xe')](_0x35c7d8));_0x4db0f3(_0x35c7d8);})['catch'](function(_0x38ddb9){logger[_0x621d('0xf')](_0x621d('0x14'),_0x38ddb9[_0x621d('0x11')],_0x4d562b);_0x3e0149(_0x383653['error'](0x1f4,_0x38ddb9[_0x621d('0x11')]));});});}; \ No newline at end of file +var _0x142c=['info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','where','attributes','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1d7fab,_0x3dfa49){var _0x1d27f0=function(_0x1047ff){while(--_0x1047ff){_0x1d7fab['push'](_0x1d7fab['shift']());}};_0x1d27f0(++_0x3dfa49);}(_0x142c,0x92));var _0xc142=function(_0x157f09,_0x4014d1){_0x157f09=_0x157f09-0x0;var _0x5e9ce4=_0x142c[_0x157f09];return _0x5e9ce4;};'use strict';var _=require(_0xc142('0x0'));var util=require(_0xc142('0x1'));var moment=require(_0xc142('0x2'));var BPromise=require(_0xc142('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc142('0x4'))['db'];var utils=require(_0xc142('0x5'));var logger=require(_0xc142('0x6'))(_0xc142('0x7'));var config=require(_0xc142('0x8'));var jayson=require(_0xc142('0x9'));var client=jayson[_0xc142('0xa')][_0xc142('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dc0d8,_0x3ffe12,_0x304d14){return new BPromise(function(_0x5b357c,_0x7002be){return client[_0xc142('0xc')](_0x5dc0d8,_0x304d14)[_0xc142('0xd')](function(_0x5ac62c){logger[_0xc142('0xe')](_0xc142('0xf'),_0x3ffe12,_0xc142('0x10'));logger['debug'](_0xc142('0x11'),_0x3ffe12,_0xc142('0x10'),JSON[_0xc142('0x12')](_0x5ac62c));if(_0x5ac62c['error']){if(_0x5ac62c['error'][_0xc142('0x13')]===0x1f4){logger[_0xc142('0x14')](_0xc142('0xf'),_0x3ffe12,_0x5ac62c[_0xc142('0x14')][_0xc142('0x15')]);return _0x7002be(_0x5ac62c['error'][_0xc142('0x15')]);}logger['error'](_0xc142('0xf'),_0x3ffe12,_0x5ac62c[_0xc142('0x14')]['message']);return _0x5b357c(_0x5ac62c['error']['message']);}else{logger[_0xc142('0xe')](_0xc142('0xf'),_0x3ffe12,_0xc142('0x10'));_0x5b357c(_0x5ac62c[_0xc142('0x16')][_0xc142('0x15')]);}})[_0xc142('0x17')](function(_0x2a4cc9){logger['error'](_0xc142('0xf'),_0x3ffe12,_0x2a4cc9);_0x7002be(_0x2a4cc9);});});}exports[_0xc142('0x18')]=function(_0x3dad9e){var _0xd22740=this;return new Promise(function(_0x177f24,_0x4a2669){return db[_0xc142('0x19')][_0xc142('0x1a')](_0x3dad9e[_0xc142('0x1b')],{'raw':_0x3dad9e[_0xc142('0x1c')]?_0x3dad9e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dad9e[_0xc142('0x1c')]?_0x3dad9e[_0xc142('0x1c')][_0xc142('0x1d')]||null:null,'attributes':_0x3dad9e[_0xc142('0x1c')]?_0x3dad9e[_0xc142('0x1c')][_0xc142('0x1e')]||null:null,'limit':_0x3dad9e[_0xc142('0x1c')]?_0x3dad9e[_0xc142('0x1c')]['limit']||null:null})['then'](function(_0x2dc4b9){logger[_0xc142('0xe')](_0xc142('0x18'),_0x3dad9e);logger[_0xc142('0x1f')](_0xc142('0x18'),_0x3dad9e,JSON[_0xc142('0x12')](_0x2dc4b9));_0x177f24(_0x2dc4b9);})[_0xc142('0x17')](function(_0x326c2a){logger[_0xc142('0x14')](_0xc142('0x18'),_0x326c2a[_0xc142('0x15')],_0x3dad9e);_0x4a2669(_0xd22740[_0xc142('0x14')](0x1f4,_0x326c2a[_0xc142('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index b3cd205..68310f4 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 _0xadb8=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/messages','/:id/download','download','post','create','addMessage','tracked','mailinteraction:addtags','addTags','put','mail','mailinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','path'];(function(_0x16479b,_0x54a5d2){var _0xef03d5=function(_0x3f5522){while(--_0x3f5522){_0x16479b['push'](_0x16479b['shift']());}};_0xef03d5(++_0x54a5d2);}(_0xadb8,0x1d0));var _0x8adb=function(_0x4eaa4c,_0x2f7422){_0x4eaa4c=_0x4eaa4c-0x0;var _0x15aec6=_0xadb8[_0x4eaa4c];return _0x15aec6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8adb('0x0'));var timeout=require('connect-timeout');var express=require(_0x8adb('0x1'));var router=express[_0x8adb('0x2')]();var auth=require(_0x8adb('0x3'));var interaction=require(_0x8adb('0x4'));var config=require(_0x8adb('0x5'));var controller=require(_0x8adb('0x6'));router[_0x8adb('0x7')]('/',auth['isAuthenticated'](),controller[_0x8adb('0x8')]);router[_0x8adb('0x7')](_0x8adb('0x9'),auth[_0x8adb('0xa')](),controller[_0x8adb('0xb')]);router[_0x8adb('0x7')](_0x8adb('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x8adb('0xd'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x8adb('0xe'),auth[_0x8adb('0xa')](),controller[_0x8adb('0xf')]);router[_0x8adb('0x10')]('/',auth[_0x8adb('0xa')](),controller[_0x8adb('0x11')]);router[_0x8adb('0x10')](_0x8adb('0xd'),auth[_0x8adb('0xa')](),controller[_0x8adb('0x12')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0x8adb('0x13')]('mail',_0x8adb('0x14')),controller[_0x8adb('0x15')]);router[_0x8adb('0x16')]('/:id',auth[_0x8adb('0xa')](),interaction[_0x8adb('0x13')](_0x8adb('0x17'),_0x8adb('0x18')),controller[_0x8adb('0x19')]);router[_0x8adb('0x1a')]('/:id',auth[_0x8adb('0xa')](),interaction[_0x8adb('0x13')]('mail','mailinteraction:destroy'),controller[_0x8adb('0x1b')]);router[_0x8adb('0x1a')](_0x8adb('0x1c'),auth[_0x8adb('0xa')](),controller[_0x8adb('0x1d')]);module[_0x8adb('0x1e')]=router; \ No newline at end of file +var _0x18a5=['mail','addTags','put','delete','mailinteraction:destroy','destroy','removeTags','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked'];(function(_0x9320fe,_0x429a46){var _0x1c501b=function(_0x2dc8e1){while(--_0x2dc8e1){_0x9320fe['push'](_0x9320fe['shift']());}};_0x1c501b(++_0x429a46);}(_0x18a5,0x164));var _0x518a=function(_0x9ddeae,_0x5c80a1){_0x9ddeae=_0x9ddeae-0x0;var _0xc4b60d=_0x18a5[_0x9ddeae];return _0xc4b60d;};'use strict';var multer=require(_0x518a('0x0'));var util=require(_0x518a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x518a('0x2'));var router=express['Router']();var auth=require(_0x518a('0x3'));var interaction=require(_0x518a('0x4'));var config=require(_0x518a('0x5'));var controller=require(_0x518a('0x6'));router[_0x518a('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x518a('0x8'),auth[_0x518a('0x9')](),controller[_0x518a('0xa')]);router[_0x518a('0x7')](_0x518a('0xb'),auth[_0x518a('0x9')](),controller[_0x518a('0xc')]);router[_0x518a('0x7')](_0x518a('0xd'),auth[_0x518a('0x9')](),controller[_0x518a('0xe')]);router[_0x518a('0x7')](_0x518a('0xf'),auth[_0x518a('0x9')](),controller[_0x518a('0x10')]);router['post']('/',auth[_0x518a('0x9')](),controller['create']);router[_0x518a('0x11')]('/:id/messages',auth[_0x518a('0x9')](),controller[_0x518a('0x12')]);router[_0x518a('0x11')](_0x518a('0x13'),auth[_0x518a('0x9')](),interaction[_0x518a('0x14')](_0x518a('0x15'),'mailinteraction:addtags'),controller[_0x518a('0x16')]);router[_0x518a('0x17')](_0x518a('0xb'),auth['isAuthenticated'](),interaction[_0x518a('0x14')](_0x518a('0x15'),'mailinteraction:update'),controller['update']);router[_0x518a('0x18')]('/:id',auth[_0x518a('0x9')](),interaction[_0x518a('0x14')](_0x518a('0x15'),_0x518a('0x19')),controller[_0x518a('0x1a')]);router[_0x518a('0x18')](_0x518a('0x13'),auth[_0x518a('0x9')](),controller[_0x518a('0x1b')]);module[_0x518a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 07783b8..11fe118 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 _0x8a02=['STRING','TEXT','long','ENUM','out','sequelize','iconv','exports','BOOLEAN','DATE'];(function(_0x3f9a81,_0x53550b){var _0x22112c=function(_0xfb425f){while(--_0xfb425f){_0x3f9a81['push'](_0x3f9a81['shift']());}};_0x22112c(++_0x53550b);}(_0x8a02,0x16d));var _0x28a0=function(_0x14d89d,_0x1a7db2){_0x14d89d=_0x14d89d-0x0;var _0x214efc=_0x8a02[_0x14d89d];return _0x214efc;};'use strict';var Sequelize=require(_0x28a0('0x0'));var iconv=require(_0x28a0('0x1'));module[_0x28a0('0x2')]={'closed':{'type':Sequelize[_0x28a0('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x28a0('0x4')]},'disposition':{'type':Sequelize[_0x28a0('0x5')]},'secondDisposition':{'type':Sequelize[_0x28a0('0x5')]},'thirdDisposition':{'type':Sequelize[_0x28a0('0x5')]},'note':{'type':Sequelize[_0x28a0('0x5')]},'inReplyTo':{'type':Sequelize[_0x28a0('0x5')](0x1fe)},'to':{'type':Sequelize[_0x28a0('0x5')]},'cc':{'type':Sequelize[_0x28a0('0x6')](_0x28a0('0x7'))},'subject':{'type':Sequelize[_0x28a0('0x6')]()},'attach':{'type':Sequelize[_0x28a0('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x28a0('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x28a0('0x8')]('in',_0x28a0('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x28a0('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x28a0('0x8')]('in',_0x28a0('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x28a0('0x6')](_0x28a0('0x7'))},'lastMsgText':{'type':Sequelize[_0x28a0('0x6')]('long')}}; \ No newline at end of file +var _0x601e=['TEXT','ENUM','out','long','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x3b6d58,_0xb29c70){var _0x64d7dc=function(_0x2ac5e4){while(--_0x2ac5e4){_0x3b6d58['push'](_0x3b6d58['shift']());}};_0x64d7dc(++_0xb29c70);}(_0x601e,0x16c));var _0xe601=function(_0x5517c0,_0x358609){_0x5517c0=_0x5517c0-0x0;var _0x33803b=_0x601e[_0x5517c0];return _0x33803b;};'use strict';var Sequelize=require(_0xe601('0x0'));var iconv=require('iconv');module[_0xe601('0x1')]={'closed':{'type':Sequelize[_0xe601('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe601('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xe601('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe601('0x4')]},'note':{'type':Sequelize[_0xe601('0x4')]},'inReplyTo':{'type':Sequelize[_0xe601('0x4')](0x1fe)},'to':{'type':Sequelize[_0xe601('0x4')]},'cc':{'type':Sequelize[_0xe601('0x5')]('long')},'subject':{'type':Sequelize[_0xe601('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xe601('0x3')]},'substatus':{'type':Sequelize[_0xe601('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xe601('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe601('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe601('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xe601('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xe601('0x5')](_0xe601('0x8'))},'lastMsgText':{'type':Sequelize[_0xe601('0x5')](_0xe601('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index f3eb8aa..41f5c99 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 _0x955f=['root','server','files','tmp','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','headers','Bcc','basename','readFileSync','message%d.eml','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','html-to-text','juice','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','status','count','offset','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','select','field','color','from','u.id','ui.MailInteractionId','user_has_mail_interactions','users','u.id\x20=\x20ui.UserId','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','tools_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','text','start','some','compact','MailAccountId','where','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`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)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','resolve','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','toString','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgAt','i.disposition','i.secondDisposition','i.substatus','i.to','i.MailAccountId','i.UserId','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','destroy','addMessage','MailMessage','ids','omit','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','addTags','setTags','findAll','emit','removeTags','download','unix','join'];(function(_0x27fedb,_0x31c693){var _0x58ab78=function(_0x532732){while(--_0x532732){_0x27fedb['push'](_0x27fedb['shift']());}};_0x58ab78(++_0x31c693);}(_0x955f,0x1eb));var _0xf955=function(_0x2a0daa,_0x28340e){_0x2a0daa=_0x2a0daa-0x0;var _0x58f83=_0x955f[_0x2a0daa];return _0x58f83;};'use strict';var pdf=require(_0xf955('0x0'));var emlformat=require(_0xf955('0x1'));var rimraf=require(_0xf955('0x2'));var zipdir=require(_0xf955('0x3'));var jsonpatch=require(_0xf955('0x4'));var rp=require('request-promise');var moment=require(_0xf955('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf955('0x6'));var path=require('path');var sox=require(_0xf955('0x7'));var csv=require(_0xf955('0x8'));var ejs=require(_0xf955('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf955('0xa'));var crypto=require(_0xf955('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf955('0xc'));var toCsv=require(_0xf955('0x8'));var querystring=require(_0xf955('0xd'));var Papa=require(_0xf955('0xe'));var htmlToText=require(_0xf955('0xf'));var juice=require(_0xf955('0x10'));var Redis=require(_0xf955('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf955('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf955('0x13'));var logger=require(_0xf955('0x14'))(_0xf955('0x15'));var utils=require('../../config/utils');var config=require(_0xf955('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf955('0x17'))['db'];config['redis']=_[_0xf955('0x18')](config[_0xf955('0x19')],{'host':_0xf955('0x1a'),'port':0x18eb});var socket=require(_0xf955('0x1b'))(new Redis(config[_0xf955('0x19')]));require(_0xf955('0x1c'))[_0xf955('0x1d')](socket);function respondWithStatusCode(_0x2783f2,_0x3c6af7){_0x3c6af7=_0x3c6af7||0xcc;return function(_0x24e75c){if(_0x24e75c){return _0x2783f2['sendStatus'](_0x3c6af7);}return _0x2783f2[_0xf955('0x1e')](_0x3c6af7)['end']();};}function respondWithResult(_0x3139d5,_0x3a814f){_0x3a814f=_0x3a814f||0xc8;return function(_0x2f881b){if(_0x2f881b){return _0x3139d5[_0xf955('0x1e')](_0x3a814f)['json'](_0x2f881b);}};}function respondWithFilteredResult(_0x5ac6cb,_0x1e20d1){return function(_0xe6de5c){if(_0xe6de5c){var _0x3c49c0=_0xe6de5c[_0xf955('0x1f')],_0x4d7b5b=_0x1e20d1[_0xf955('0x20')],_0xb71daf=_0x1e20d1[_0xf955('0x20')]+_0x1e20d1['limit'],_0x3576fa;if(_0xb71daf>=_0x3c49c0){_0xb71daf=_0x3c49c0;_0x3576fa=0xc8;}else{_0x3576fa=0xce;}_0x5ac6cb[_0xf955('0x1e')](_0x3576fa);return _0x5ac6cb[_0xf955('0x21')](_0xf955('0x22'),_0x4d7b5b+'-'+_0xb71daf+'/'+_0x3c49c0)['json'](_0xe6de5c);}return null;};}function patchUpdates(_0x43a5f2){return function(_0x5daa73){try{jsonpatch[_0xf955('0x23')](_0x5daa73,_0x43a5f2,!![]);}catch(_0x43b078){return BPromise[_0xf955('0x24')](_0x43b078);}return _0x5daa73[_0xf955('0x25')]();};}function saveUpdates(_0x160071,_0x565641){return function(_0x25f4f2){if(_0x25f4f2){return _0x25f4f2[_0xf955('0x26')](_0x160071)[_0xf955('0x27')](function(_0x13a1a7){return _0x13a1a7;});}return null;};}function removeEntity(_0x17dec2,_0x102e36){return function(_0x1f87f6){if(_0x1f87f6){return _0x1f87f6['destroy']()[_0xf955('0x27')](function(){_0x17dec2[_0xf955('0x1e')](0xcc)[_0xf955('0x28')]();});}};}function handleEntityNotFound(_0x406632,_0x2dcd55){return function(_0x13a86d){if(!_0x13a86d){_0x406632[_0xf955('0x29')](0x194);}return _0x13a86d;};}function handleError(_0x51f3ab,_0x3caea6){_0x3caea6=_0x3caea6||0x1f4;return function(_0x145098){logger[_0xf955('0x2a')](_0x145098[_0xf955('0x2b')]);if(_0x145098[_0xf955('0x2c')]){delete _0x145098[_0xf955('0x2c')];}_0x51f3ab['status'](_0x3caea6)[_0xf955('0x2d')](_0x145098);};}function getInteractionUsers(_0x1e5d37,_0x4ec3e8){return new BPromise(function(_0x256df5,_0x2c8df1){try{if(_0x4ec3e8[_0x1e5d37['id']]){_0x1e5d37[_0xf955('0x2e')]=_[_0xf955('0x2f')](_0x4ec3e8[_0x1e5d37['id']],function(_0x59bfb5){return{'id':_0x59bfb5['id'],'fullname':_0x59bfb5[_0xf955('0x30')]};});}}catch(_0x518fb3){_0x2c8df1(_0x518fb3);}_0x256df5(_0x1e5d37);});}function getInteractionTags(_0x227104,_0x2c222a){return new BPromise(function(_0x44eacf,_0x4069fe){try{if(_0x227104[_0xf955('0x31')]){_0x227104[_0xf955('0x32')]=[];_0x227104[_0xf955('0x31')][_0xf955('0x33')](',')['forEach'](function(_0x45e913){_0x227104[_0xf955('0x32')][_0xf955('0x34')](_0x2c222a[_0x45e913]);});}delete _0x227104[_0xf955('0x31')];}catch(_0x4fea0c){_0x4069fe(_0x4fea0c);}_0x44eacf(_0x227104);});}function getLastMessageText(_0x23c848){return new BPromise(function(_0x31dad5,_0x3c81bc){return db[_0xf955('0x35')][_0xf955('0x36')]({'where':{'id':_0x23c848['id']},'attributes':['lastMsgBody','lastMsgText'],'raw':!![]})['then'](function(_0x2626cb){if(!_0x2626cb[_0xf955('0x37')]){_0x23c848[_0xf955('0x37')]=_[_0xf955('0x38')](htmlToText[_0xf955('0x39')](_0x2626cb[_0xf955('0x3a')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x23c848['lastMsgText']=_0x2626cb[_0xf955('0x37')];}_0x31dad5(_0x23c848);})['catch'](function(_0x8f842f){_0x3c81bc(_0x8f842f);});});}function updateMailInteraction(_0x2371e4,_0xe33ef2,_0x51762d,_0x60a421){return new BPromise(function(_0x4bef80,_0x2bc1a0){return getInteractionUsers(_0x2371e4,_0x51762d)[_0xf955('0x27')](function(_0x2ebd6c){return getInteractionTags(_0x2ebd6c,_0xe33ef2);})[_0xf955('0x27')](function(_0x52ab07){if(_0x60a421){_0x4bef80(getLastMessageText(_0x52ab07));}else{_0x4bef80(_0x52ab07);}})[_0xf955('0x3b')](function(_0x118c92){_0x2bc1a0(_0x118c92);});});}exports['index']=function(_0x430e12,_0x460aa7){var _0x79016b={},_0x547ed9={},_0x292e53={'count':0x0,'rows':[]};var _0xffe510=_[_0xf955('0x2f')](db['MailInteraction'][_0xf955('0x3c')],function(_0x195faa){return{'name':_0x195faa[_0xf955('0x3d')],'type':_0x195faa[_0xf955('0x3e')][_0xf955('0x3f')]};});_0x547ed9[_0xf955('0x40')]=_[_0xf955('0x2f')](_0xffe510,_0xf955('0x2c'));_0x547ed9['query']=_[_0xf955('0x41')](_0x430e12[_0xf955('0x42')]);_0x547ed9[_0xf955('0x43')]=_[_0xf955('0x44')](_0x547ed9[_0xf955('0x40')],_0x547ed9[_0xf955('0x42')]);_0x79016b[_0xf955('0x45')]=_[_0xf955('0x44')](_0x547ed9[_0xf955('0x40')],qs[_0xf955('0x46')](_0x430e12[_0xf955('0x42')][_0xf955('0x46')]));_0x79016b[_0xf955('0x45')]=_0x79016b[_0xf955('0x45')][_0xf955('0x47')]?_0x79016b[_0xf955('0x45')]:_0x547ed9[_0xf955('0x40')];if(!_0x430e12[_0xf955('0x42')][_0xf955('0x48')]('nolimit')){_0x79016b[_0xf955('0x49')]=qs[_0xf955('0x49')](_0x430e12[_0xf955('0x42')]['limit']);_0x79016b[_0xf955('0x20')]=qs['offset'](_0x430e12[_0xf955('0x42')]['offset']);}_0x79016b[_0xf955('0x4a')]=qs[_0xf955('0x4b')](_0x430e12[_0xf955('0x42')][_0xf955('0x4b')]);_0x79016b['where']=qs[_0xf955('0x43')](_[_0xf955('0x4c')](_0x430e12[_0xf955('0x42')],_0x547ed9['filters']),_0xffe510);var _0x5e98ae=[];var _0x1bd760=squel[_0xf955('0x4d')]()[_0xf955('0x4e')]('id')[_0xf955('0x4e')]('name')[_0xf955('0x4e')](_0xf955('0x4f'))[_0xf955('0x50')]('tools_tags');var _0x388e59=squel['select']()[_0xf955('0x4e')](_0xf955('0x51'))[_0xf955('0x4e')]('u.fullname')[_0xf955('0x4e')](_0xf955('0x52'))[_0xf955('0x50')](_0xf955('0x53'),'ui')['left_join'](_0xf955('0x54'),'u',_0xf955('0x55'));var _0x1c6d76=squel[_0xf955('0x4d')]()[_0xf955('0x50')]('mail_interactions','i')[_0xf955('0x56')]('cm_contacts','c',_0xf955('0x57'))['left_join'](_0xf955('0x54'),'o','o.id\x20=\x20i.UserId')['left_join'](_0xf955('0x58'),'a',_0xf955('0x59'))['left_join'](_0xf955('0x5a'),'me','me.MailInteractionId\x20=\x20i.id')['left_join']('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')[_0xf955('0x56')](_0xf955('0x5b'),'t','t.id\x20=\x20it.TagId');var _0x4c4b6d=squel[_0xf955('0x5c')]();var _0x17fc93=[];var _0x460052=squel[_0xf955('0x5c')]();var _0x1b7b21;if(_0x430e12[_0xf955('0x42')][_0xf955('0x5d')]){_0x1b7b21=as[_0xf955('0x5e')](_0x430e12[_0xf955('0x42')][_0xf955('0x5d')]);var _0x1b7b73=_0x1b7b21[_0xf955('0x5f')];for(var _0x47a3a6=0x0;_0x47a3a6<_0x1b7b21[_0xf955('0x60')][_0xf955('0x47')];_0x47a3a6++){var _0x1d0e0c=_0x1b7b21[_0xf955('0x60')][_0x47a3a6];var _0x3242fe='i';var _0x4dc34b=_[_0xf955('0x61')](_0xffe510,[_0xf955('0x2c'),_0x1d0e0c[_0xf955('0x4e')]]);if(!_0x4dc34b){switch(_0x1d0e0c[_0xf955('0x4e')]){case _0xf955('0x62'):if(_0x1d0e0c[_0xf955('0x63')]==0x1){_0x1c6d76[_0xf955('0x64')]('`'+_0x1d0e0c[_0xf955('0x4e')]+_0xf955('0x65'));}else{_0x1c6d76[_0xf955('0x64')]('`'+_0x1d0e0c['field']+_0xf955('0x66'));}break;case _0xf955('0x67'):if(_0x1d0e0c[_0xf955('0x68')]===_0xf955('0x69')){if(_0x1d0e0c[_0xf955('0x63')][_0xf955('0x33')]('\x20')[_0xf955('0x47')]>0x1){_0x4c4b6d[_0x1b7b73](_0xf955('0x6a'),qs[_0xf955('0x6b')](_0x1d0e0c[_0xf955('0x63')]),null);}else{var _0x40efb1='%'+_0x1d0e0c[_0xf955('0x63')]+'%';_0x4c4b6d[_0x1b7b73]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x40efb1,_0x40efb1,_0x40efb1);}}else{_0x4dc34b=_[_0xf955('0x61')](_0xffe510,[_0xf955('0x2c'),_0xf955('0x6c')]);_0x1d0e0c[_0xf955('0x4e')]=_0xf955('0x6c');_0x34f52a=as[_0xf955('0x6d')](_0x3242fe,_0x4dc34b[_0xf955('0x3e')],_0x1d0e0c);_0x4c4b6d[_0x1b7b73](_0x34f52a['text'],_0x34f52a['value']['start'],_0x34f52a[_0xf955('0x63')]['end']);}break;case'Tag':var _0x3cfc25=_0x1d0e0c['value'][_0xf955('0x33')](',')[_0xf955('0x2f')](function(_0x158469){return Number(_0x158469);});_0x3cfc25[_0xf955('0x6e')](function(_0x4c88ae){_0x460052['or'](_0xf955('0x6f'),'%,'+_0x4c88ae+',%');});_0x17fc93=_[_0xf955('0x70')](_0x17fc93,_0x3cfc25);break;case _0xf955('0x71'):if(_0x1d0e0c[_0xf955('0x68')]===_0xf955('0x69')){_0x4c4b6d[_0x1b7b73]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1d0e0c[_0xf955('0x63')]+'%',null);}else{_0x4dc34b=_['find'](_0xffe510,[_0xf955('0x2c'),_0xf955('0x72')]);_0x1d0e0c[_0xf955('0x4e')]='UserId';_0x34f52a=as[_0xf955('0x6d')](_0x3242fe,_0x4dc34b[_0xf955('0x3e')],_0x1d0e0c);_0x4c4b6d[_0x1b7b73](_0x34f52a[_0xf955('0x73')],_0x34f52a[_0xf955('0x63')][_0xf955('0x74')],_0x34f52a[_0xf955('0x63')][_0xf955('0x28')]);}break;case'plainBody':_0x34f52a=as['buildExpression']('me',null,_0x1d0e0c);_0x4c4b6d[_0x1b7b73](_0x34f52a[_0xf955('0x73')],_0x34f52a[_0xf955('0x63')][_0xf955('0x74')],_0x34f52a[_0xf955('0x63')][_0xf955('0x28')]);break;}}else{var _0x34f52a=as[_0xf955('0x6d')](_0x3242fe,_0x4dc34b[_0xf955('0x3e')],_0x1d0e0c);_0x4c4b6d[_0x1b7b73](_0x34f52a[_0xf955('0x73')],_0x34f52a[_0xf955('0x63')][_0xf955('0x74')],_0x34f52a['value'][_0xf955('0x28')]);}}}else{var _0x4916c3=_(_0x430e12[_0xf955('0x42')])['keys']()['map'](function(_0x4210af){return _[_0xf955('0x75')](_0xffe510,['name',_0x4210af])?_0x4210af:undefined;})[_0xf955('0x76')]()[_0xf955('0x63')]();if(!_['isEmpty'](_0x4916c3)){_0x4916c3['forEach'](function(_0x1e418){if(_0x1e418===_0xf955('0x77')){_0x1c6d76[_0xf955('0x78')]('i.MailAccountId\x20IN\x20?',[][_0xf955('0x79')](_0x430e12[_0xf955('0x42')][_0x1e418]));}else if(_0x1e418===_0xf955('0x7a')){var _0x356be7=JSON[_0xf955('0x7b')](_0x430e12[_0xf955('0x42')][_0x1e418])[_0xf955('0x7c')];var _0xf1e40b=JSON['parse'](_0x430e12[_0xf955('0x42')][_0x1e418])[_0xf955('0x7d')];_0x1c6d76['where'](_0xf955('0x7e'),_0x356be7,_0xf1e40b);}else{if(_0x430e12[_0xf955('0x42')][_0x1e418]===_0xf955('0x7f')){_0x1c6d76[_0xf955('0x78')]('i.'+_0x1e418+'\x20IS\x20NULL');}else{_0x1c6d76[_0xf955('0x78')]('i.'+_0x1e418+_0xf955('0x80'),_0x430e12['query'][_0x1e418]);}}});}if(_0x430e12['query'][_0xf955('0x81')]){if(_0x430e12[_0xf955('0x42')][_0xf955('0x81')]==0x1){_0x1c6d76[_0xf955('0x64')]('`unreadMessages`\x20=\x200');}else{_0x1c6d76[_0xf955('0x64')](_0xf955('0x82'));}}if(_0x430e12[_0xf955('0x42')][_0xf955('0x83')]){_0x17fc93=_[_0xf955('0x84')](_0x430e12[_0xf955('0x42')][_0xf955('0x83')])?_0x430e12[_0xf955('0x42')][_0xf955('0x83')]:new Array(_0x430e12[_0xf955('0x42')][_0xf955('0x83')]);_0x17fc93[_0xf955('0x6e')](function(_0x4254a2){_0x460052['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4254a2+',%');});}if(_0x430e12[_0xf955('0x42')][_0xf955('0x85')]){var _0x1d9469=_0x430e12[_0xf955('0x42')]['filter'][_0xf955('0x86')]('\x5c','\x5c\x5c')[_0xf955('0x86')](/'/g,'\x27\x27');if(qs[_0xf955('0x87')](_0x1d9469)){_0x4c4b6d['or'](_0xf955('0x88'),_0x1d9469+'%');}else if(qs[_0xf955('0x89')](_0x1d9469)){_0x4c4b6d['or'](_0xf955('0x8a'),_0x1d9469+'%');}else{_0x4c4b6d['or'](_0xf955('0x8b'),qs[_0xf955('0x6b')](_0x1d9469))['or'](_0xf955('0x8c'),qs[_0xf955('0x6b')](_0x1d9469));}}}_0x1c6d76[_0xf955('0x78')](_0x4c4b6d);_0x1c6d76['group'](_0xf955('0x8d'));var _0x1c8c8a={'type':db[_0xf955('0x8e')][_0xf955('0x8f')][_0xf955('0x90')],'raw':!![]};var _0xaeaffb=_0x1c6d76[_0xf955('0x91')]();_0xaeaffb['field'](_0xf955('0x8d'));_0xaeaffb['field'](_0xf955('0x92'),'unreadMessages');if(_0x79016b[_0xf955('0x4a')]){_0x79016b[_0xf955('0x4a')][_0xf955('0x6e')](function(_0x147b5c){var _0x6da71d=_0x147b5c[0x0]===_0xf955('0x93')?_0x147b5c[0x0]:'i.'+_0x147b5c[0x0];_0x1c6d76['order'](_0x6da71d,_0x147b5c[0x1]===_0xf955('0x94')?![]:!![]);});}if(!_[_0xf955('0x95')](_0x17fc93)){_0x1c6d76[_0xf955('0x64')](_0x460052);_0xaeaffb['where']('t.id\x20IN\x20?',_0x17fc93);}BPromise[_0xf955('0x96')]()[_0xf955('0x27')](function(){if(!_0x1b7b21){if(_0x430e12[_0xf955('0x42')]['MailAccountId'])return;_0xaeaffb[_0xf955('0x78')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x1c6d76[_0xf955('0x78')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x430e12[_0xf955('0x97')][_0xf955('0x98')]!==_0xf955('0x99'))return;return _0x430e12['user'][_0xf955('0x9a')]({'attributes':['id'],'raw':!![]})[_0xf955('0x27')](function(_0x2cd1bd){if(_['isEmpty'](_0x2cd1bd)){_0xaeaffb[_0xf955('0x78')](_0xf955('0x9b'));_0x1c6d76[_0xf955('0x78')](_0xf955('0x9b'));}else{_0xaeaffb[_0xf955('0x78')](_0xf955('0x9c'),_[_0xf955('0x2f')](_0x2cd1bd,'id'));_0x1c6d76['where'](_0xf955('0x9c'),_[_0xf955('0x2f')](_0x2cd1bd,'id'));}});})[_0xf955('0x27')](function(){if(_0x430e12[_0xf955('0x97')][_0xf955('0x98')]==='agent'&&!_0x1b7b21&&!_0x430e12[_0xf955('0x42')][_0xf955('0x77')])return[];return db['sequelize']['query'](_0xaeaffb[_0xf955('0x9d')](),_0x1c8c8a);})[_0xf955('0x27')](function(_0x3bd458){_0x292e53[_0xf955('0x1f')]=_0x3bd458['length'];if(_0x292e53[_0xf955('0x1f')]===0x0)return[];return db['sequelize']['query'](_0x1bd760[_0xf955('0x9d')](),_0x1c8c8a)[_0xf955('0x27')](function(_0x526e1b){_0x5e98ae=_['keyBy'](_0x526e1b,'id');_0x1c8c8a=_[_0xf955('0x9e')](_0x1c8c8a,{'model':db[_0xf955('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x430e12[_0xf955('0x42')]['fields']){_0x79016b['attributes'][_0xf955('0x6e')](function(_0xe8b4a){_0x1c6d76[_0xf955('0x4e')]('i.'+_0xe8b4a);});}else{_0x1c6d76['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x1c6d76['field'](_0xf955('0x9f'),'Account.key');_0x1c6d76[_0xf955('0x4e')](_0xf955('0xa0'),_0xf955('0xa1'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xa2'),'contactName');_0x1c6d76[_0xf955('0x4e')](_0xf955('0x8d'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xa3'));_0x1c6d76['field'](_0xf955('0xa4'));_0x1c6d76[_0xf955('0x4e')]('i.closed');_0x1c6d76[_0xf955('0x4e')](_0xf955('0xa5'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xa6'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xa7'));_0x1c6d76['field']('i.lastMsgDirection');_0x1c6d76[_0xf955('0x4e')]('i.subject');_0x1c6d76[_0xf955('0x4e')](_0xf955('0xa8'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xa9'));_0x1c6d76['field']('i.thirdDisposition');_0x1c6d76[_0xf955('0x4e')](_0xf955('0xaa'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xab'));_0x1c6d76[_0xf955('0x4e')]('i.ContactId');_0x1c6d76[_0xf955('0x4e')](_0xf955('0xac'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xad'));_0x1c6d76['field']('c.firstName',_0xf955('0xae'));_0x1c6d76[_0xf955('0x4e')]('c.lastName',_0xf955('0xaf'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xb0'),_0xf955('0xb1'));_0x1c6d76['field'](_0xf955('0xb2'),_0xf955('0xb3'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xb4'),_0xf955('0xb5'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xb6'),'Contact.fax');_0x1c6d76['field']('o.fullname',_0xf955('0xb7'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xb8'),_0xf955('0xb9'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xba'),_0xf955('0x31'));}if(_0x79016b['limit'])_0x1c6d76[_0xf955('0x49')](_0x79016b[_0xf955('0x49')]);if(_0x79016b['offset'])_0x1c6d76[_0xf955('0x20')](_0x79016b[_0xf955('0x20')]);return db[_0xf955('0xbb')][_0xf955('0x42')](_0x1c6d76[_0xf955('0x9d')](),_0x1c8c8a);})[_0xf955('0x27')](function(_0x30e770){_0x388e59[_0xf955('0x78')]('ui.MailInteractionId\x20IN\x20?',_['map'](_0x30e770,'id'));return db['sequelize'][_0xf955('0x42')](_0x388e59[_0xf955('0x9d')](),_0x1c8c8a)[_0xf955('0x27')](function(_0x3ed082){var _0x68e55=_['groupBy'](_0x3ed082,_0xf955('0xbc'));var _0x22f34c=[];return db[_0xf955('0xbd')][_0xf955('0x36')]({'attributes':[_0xf955('0xbe')],'raw':!![]})[_0xf955('0x27')](function(_0x11f6f8){var _0x436d73=_0x11f6f8[_0xf955('0xbe')];_0x30e770['forEach'](function(_0x3c7c36){_0x22f34c['push'](updateMailInteraction(_0x3c7c36,_0x5e98ae,_0x68e55,_0x436d73));});return BPromise[_0xf955('0xbf')](_0x22f34c);});});});})[_0xf955('0x27')](function(_0x864af8){_0x292e53[_0xf955('0xc0')]=_0x864af8;return _0x292e53;})[_0xf955('0x27')](respondWithFilteredResult(_0x460aa7,_0x79016b))[_0xf955('0x3b')](handleError(_0x460aa7,null));};exports[_0xf955('0xc1')]=function(_0x4b8cde,_0x1ef189){var _0x4bb590={'raw':![],'where':{'id':_0x4b8cde[_0xf955('0xc2')]['id']}},_0x222df2={};_0x222df2['model']=_[_0xf955('0x41')](db[_0xf955('0x35')][_0xf955('0x3c')]);_0x222df2[_0xf955('0x42')]=_[_0xf955('0x41')](_0x4b8cde[_0xf955('0x42')]);_0x222df2[_0xf955('0x43')]=_['intersection'](_0x222df2[_0xf955('0x40')],_0x222df2[_0xf955('0x42')]);_0x4bb590['attributes']=_[_0xf955('0x44')](_0x222df2[_0xf955('0x40')],qs['fields'](_0x4b8cde['query'][_0xf955('0x46')]));_0x4bb590[_0xf955('0x45')]=_0x4bb590[_0xf955('0x45')]['length']?_0x4bb590[_0xf955('0x45')]:_0x222df2[_0xf955('0x40')];if(_0x4b8cde[_0xf955('0x42')][_0xf955('0xc3')]){_0x4bb590[_0xf955('0xc4')]=[{'all':!![]}];}_0x4bb590=_[_0xf955('0x9e')]({},_0x4bb590,_0x4b8cde[_0xf955('0xc5')]);return db[_0xf955('0x35')][_0xf955('0x61')](_0x4bb590)[_0xf955('0x27')](handleEntityNotFound(_0x1ef189,null))[_0xf955('0x27')](respondWithResult(_0x1ef189,null))[_0xf955('0x3b')](handleError(_0x1ef189,null));};exports[_0xf955('0xc6')]=function(_0x1e608e,_0x490981){return db['MailInteraction'][_0xf955('0xc6')](_0x1e608e[_0xf955('0xc7')],{})[_0xf955('0x27')](respondWithResult(_0x490981,0xc9))[_0xf955('0x3b')](handleError(_0x490981,null));};exports[_0xf955('0x26')]=function(_0x4954ba,_0x161d06){if(_0x4954ba[_0xf955('0xc7')]['id']){delete _0x4954ba['body']['id'];}return db[_0xf955('0x35')][_0xf955('0x61')]({'where':{'id':_0x4954ba[_0xf955('0xc2')]['id']}})[_0xf955('0x27')](handleEntityNotFound(_0x161d06,null))['then'](saveUpdates(_0x4954ba[_0xf955('0xc7')],null))['then'](respondWithResult(_0x161d06,null))[_0xf955('0x3b')](handleError(_0x161d06,null));};exports[_0xf955('0xc8')]=function(_0x29e08b,_0xe9f9a8){return db['MailInteraction'][_0xf955('0x61')]({'where':{'id':_0x29e08b[_0xf955('0xc2')]['id']}})[_0xf955('0x27')](handleEntityNotFound(_0xe9f9a8,null))[_0xf955('0x27')](removeEntity(_0xe9f9a8,null))[_0xf955('0x3b')](handleError(_0xe9f9a8,null));};exports['describe']=function(_0x12e6aa,_0x1f38db){return db[_0xf955('0x35')]['describe']()[_0xf955('0x27')](respondWithResult(_0x1f38db,null))[_0xf955('0x3b')](handleError(_0x1f38db,null));};exports[_0xf955('0xc9')]=function(_0x218493,_0x19665c,_0x437020){return db[_0xf955('0xca')]['find']({'where':{'id':_0x218493['params']['id']}})['then'](handleEntityNotFound(_0x19665c,null))[_0xf955('0x27')](function(_0x441833){if(_0x441833){return _0x441833['addMessage'](_0x218493[_0xf955('0xc7')][_0xf955('0xcb')],_[_0xf955('0xcc')](_0x218493['body'],[_0xf955('0xcb'),'id'])||{});}})[_0xf955('0x27')](respondWithResult(_0x19665c,null))['catch'](handleError(_0x19665c,null));};exports['getMessages']=function(_0x3033c7,_0x8eae44,_0x184581){var _0x30baa1={'raw':![],'where':{}};var _0x189377={};var _0x5b6f67={'count':0x0,'rows':[]};return db[_0xf955('0x35')][_0xf955('0x36')]({'where':{'id':_0x3033c7[_0xf955('0xc2')]['id']}})[_0xf955('0x27')](handleEntityNotFound(_0x8eae44,null))[_0xf955('0x27')](function(_0x480d95){if(_0x480d95){_0x189377[_0xf955('0x40')]=_[_0xf955('0x41')](db[_0xf955('0xca')][_0xf955('0x3c')]);_0x189377['query']=_[_0xf955('0x41')](_0x3033c7[_0xf955('0x42')]);_0x189377[_0xf955('0x43')]=_[_0xf955('0x44')](_0x189377[_0xf955('0x40')],_0x189377['query']);_0x30baa1[_0xf955('0x45')]=_[_0xf955('0x44')](_0x189377['model'],qs[_0xf955('0x46')](_0x3033c7[_0xf955('0x42')][_0xf955('0x46')]));_0x30baa1[_0xf955('0x45')]=_0x30baa1[_0xf955('0x45')][_0xf955('0x47')]?_0x30baa1[_0xf955('0x45')]:_0x189377[_0xf955('0x40')];if(!_0x3033c7[_0xf955('0x42')][_0xf955('0x48')]('nolimit')){_0x30baa1['limit']=qs[_0xf955('0x49')](_0x3033c7[_0xf955('0x42')][_0xf955('0x49')]);_0x30baa1[_0xf955('0x20')]=qs['offset'](_0x3033c7[_0xf955('0x42')][_0xf955('0x20')]);}_0x30baa1['order']=qs['sort'](_0x3033c7[_0xf955('0x42')][_0xf955('0x4b')]);_0x30baa1[_0xf955('0x78')]=qs[_0xf955('0x43')](_['pick'](_0x3033c7[_0xf955('0x42')],_0x189377[_0xf955('0x43')]));_0x30baa1[_0xf955('0x78')][_0xf955('0xbc')]=_0x480d95['id'];if(_0x3033c7[_0xf955('0x42')][_0xf955('0x85')]){_0x30baa1[_0xf955('0x78')]=_[_0xf955('0x9e')](_0x30baa1['where'],{'$or':_[_0xf955('0x2f')](_0x30baa1[_0xf955('0x45')],function(_0x3edceb){var _0x26478e={};_0x26478e[_0x3edceb]={'$like':'%'+_0x3033c7[_0xf955('0x42')][_0xf955('0x85')]+'%'};return _0x26478e;})});}if(_0x3033c7[_0xf955('0x42')][_0xf955('0x7c')]){var _0x1f17fb=_0x3033c7[_0xf955('0x42')]['$gte'][_0xf955('0x33')](',');var _0x1cccb2={};_0x1cccb2[_0x1f17fb[0x0]]={'$gte':moment(_0x1f17fb[0x1])[_0xf955('0xcd')](_0xf955('0xce'))};_0x30baa1[_0xf955('0x78')]=_[_0xf955('0x9e')](_0x30baa1[_0xf955('0x78')],_0x1cccb2);}_0x30baa1=_['merge']({},_0x30baa1,_0x3033c7[_0xf955('0xc5')]);return db['MailMessage'][_0xf955('0x1f')]({'where':_0x30baa1[_0xf955('0x78')]})[_0xf955('0x27')](function(_0x209200){_0x5b6f67[_0xf955('0x1f')]=_0x209200;if(_0x3033c7[_0xf955('0x42')][_0xf955('0xc3')]){_0x30baa1[_0xf955('0xc4')]=[{'all':!![]}];}return db[_0xf955('0xca')]['findAll'](_0x30baa1);})[_0xf955('0x27')](function(_0x2d79a0){if(_0x3033c7[_0xf955('0x42')][_0xf955('0xcf')]===_0xf955('0xd0')){for(var _0x2099ea=0x0;_0x2099ea<_0x2d79a0['length'];_0x2099ea++){_0x2d79a0[_0x2099ea][_0xf955('0xc7')]=juice(_0x2d79a0[_0x2099ea][_0xf955('0xc7')]);}}_0x5b6f67[_0xf955('0xc0')]=_0x2d79a0;return _0x5b6f67;});}})['then'](respondWithFilteredResult(_0x8eae44,_0x30baa1))[_0xf955('0x3b')](handleError(_0x8eae44,null));};exports[_0xf955('0xd1')]=function(_0x2e5554,_0x40dcdd,_0x3b3c0e){return db[_0xf955('0x35')]['find']({'where':{'id':_0x2e5554[_0xf955('0xc2')]['id']}})[_0xf955('0x27')](handleEntityNotFound(_0x40dcdd,null))[_0xf955('0x27')](function(_0x42e3eb){if(_0x42e3eb){return _0x42e3eb[_0xf955('0xd2')](_0x2e5554[_0xf955('0xc7')]['ids'],_[_0xf955('0xcc')](_0x2e5554['body'],['ids','id'])||{})['spread'](function(){return db['Tag'][_0xf955('0xd3')]({'attributes':['id','name',_0xf955('0x4f')],'where':{'id':_0x2e5554[_0xf955('0xc7')]['ids']}});})[_0xf955('0x27')](function(_0x5bbb80){socket[_0xf955('0xd4')]('mailInteractionTags:save',{'id':Number(_0x2e5554[_0xf955('0xc2')]['id']),'tags':_0x5bbb80||[]});return{'id':Number(_0x2e5554[_0xf955('0xc2')]['id']),'tags':_0x5bbb80||[]};});}})[_0xf955('0x27')](respondWithResult(_0x40dcdd,null))[_0xf955('0x3b')](handleError(_0x40dcdd,null));};exports['removeTags']=function(_0x15b32a,_0x5d1c27,_0x3c7e80){return db[_0xf955('0x35')][_0xf955('0x61')]({'where':{'id':_0x15b32a[_0xf955('0xc2')]['id']}})[_0xf955('0x27')](handleEntityNotFound(_0x5d1c27,null))[_0xf955('0x27')](function(_0x1cc042){if(_0x1cc042){return _0x1cc042[_0xf955('0xd5')](_0x15b32a[_0xf955('0x42')][_0xf955('0xcb')]);}})['then'](respondWithStatusCode(_0x5d1c27,null))[_0xf955('0x3b')](handleError(_0x5d1c27,null));};exports[_0xf955('0xd6')]=function(_0x444e24,_0x2fb11a){var _0x438cbc=moment()[_0xf955('0xd7')]()[_0xf955('0x9d')]();var _0x57c0c3=path[_0xf955('0xd8')](config[_0xf955('0xd9')],_0xf955('0xda'),_0xf955('0xdb'),_0xf955('0xdc'));var _0x2b68b3=path[_0xf955('0xd8')](config[_0xf955('0xd9')],_0xf955('0xda'),_0xf955('0xdb'),'attachments');var _0x1620ec=path[_0xf955('0xd8')](_0x57c0c3,_0x438cbc);var _0x2b3deb=util[_0xf955('0xcd')](_0xf955('0xdd'),_0x444e24[_0xf955('0xc2')]['id'],_0x438cbc);var _0x20a400=path[_0xf955('0xd8')](_0x57c0c3,_0x2b3deb);var _0x5d1f3d=[];if(_0x444e24[_0xf955('0x42')][_0xf955('0xde')]){_0x5d1f3d[_0xf955('0x34')]({'model':db[_0xf955('0xdf')],'as':_0xf955('0xe0'),'raw':!![]});}var _0x29d54d=[{'model':db[_0xf955('0xca')],'as':_0xf955('0xe1'),'attributes':['id','body','from','to','cc',_0xf955('0xe2'),_0xf955('0xe3'),_0xf955('0x7a')],'where':{'secret':![]},'order':qs[_0xf955('0x4b')]('id'),'include':_0x5d1f3d}];return db['MailInteraction']['find']({'where':{'id':_0x444e24[_0xf955('0xc2')]['id']},'include':_0x29d54d})[_0xf955('0x27')](handleEntityNotFound(_0x2fb11a,null))['then'](function(_0x35c679){if(_0x35c679&&_0x35c679[_0xf955('0xe1')]){var _0x46e341=_0x35c679[_0xf955('0xe4')]({'plain':!![]});fs[_0xf955('0xe5')](_0x1620ec);return BPromise['each'](_0x46e341[_0xf955('0xe1')],function(_0x306858,_0x3a3826){var _0x106640={'from':_0x306858[_0xf955('0x50')],'to':_0x306858['to'],'subject':_0x306858['subject'],'html':_0x306858[_0xf955('0xc7')],'headers':{'Date':moment(_0x306858['createdAt'])[_0xf955('0xcd')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x306858['cc']){_0x106640[_0xf955('0xe6')]['Cc']=_0x306858['cc'];}if(_0x306858[_0xf955('0xe2')]){_0x106640[_0xf955('0xe6')][_0xf955('0xe7')]=_0x306858[_0xf955('0xe2')];}return new BPromise(function(_0x23fa36,_0x85661f){if(_0x306858[_0xf955('0xe0')]){for(var _0x421b76=0x0;_0x421b76<_0x306858[_0xf955('0xe0')]['length'];_0x421b76++){var _0x598132=_0x306858[_0xf955('0xe0')][_0x421b76];var _0x29d79f=path[_0xf955('0xd8')](_0x2b68b3,_0x598132[_0xf955('0xe8')]);if(fs['existsSync'](_0x29d79f)){_0x106640['attachments'][_0xf955('0x34')]({'name':_0x598132['name'],'contentType':_0x598132['type'],'data':fs[_0xf955('0xe9')](_0x29d79f)});}}}emlformat['build'](_0x106640,function(_0x2f8e43,_0x1ed1e1){if(_0x2f8e43)return _0x85661f(_0x2f8e43);fs['writeFileSync'](path['join'](_0x1620ec,util[_0xf955('0xcd')](_0xf955('0xea'),_0x3a3826)),_0x1ed1e1);return _0x23fa36(_0x1ed1e1);});});})[_0xf955('0x27')](function(){return new BPromise(function(_0x58495b,_0x30e0a1){zipdir(_0x1620ec,{'saveTo':_0x20a400},function(_0x5cbf1e,_0x143bfd){if(_0x5cbf1e)return _0x30e0a1(_0x5cbf1e);return _0x58495b(_0x143bfd);});})['then'](function(){return new BPromise(function(_0x5a5d7e,_0x591585){rimraf(_0x1620ec,function(_0x1505ba){if(_0x1505ba)_0x591585(_0x1505ba);return _0x5a5d7e();});});})[_0xf955('0x27')](function(){return _0x2fb11a[_0xf955('0xd6')](_0x20a400,_0x2b3deb,function(_0x4a84e0){if(_0x4a84e0){console['log'](_0xf955('0xeb'),_0x4a84e0);}else{fs['unlinkSync'](_0x20a400);}});});});}else{return _0x2fb11a[_0xf955('0x29')](0xc8);}})['catch'](handleError(_0x2fb11a,null));}; \ No newline at end of file +var _0xd4a2=['plainBody','some','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','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.closedAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','include','options','create','body','destroy','describe','addMessage','MailMessage','getMessages','$gte','format','includeAll','inlineCss','true','setTags','ids','findAll','emit','mailInteractionTags:save','removeTags','download','server','tmp','join','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','log','err','unlinkSync','html-pdf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','Users','map','Tags','TagIds','split','forEach','push','findOne','lastMsgBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','field','color','tools_tags','select','u.id','u.fullname','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId'];(function(_0x5d0cce,_0x20af6b){var _0x509f80=function(_0x211ad9){while(--_0x211ad9){_0x5d0cce['push'](_0x5d0cce['shift']());}};_0x509f80(++_0x20af6b);}(_0xd4a2,0x173));var _0x2d4a=function(_0x5a933f,_0x215670){_0x5a933f=_0x5a933f-0x0;var _0x4e216c=_0xd4a2[_0x5a933f];return _0x4e216c;};'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 htmlToText=require(_0x2d4a('0xf'));var juice=require(_0x2d4a('0x10'));var Redis=require(_0x2d4a('0x11'));var authService=require(_0x2d4a('0x12'));var qs=require(_0x2d4a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d4a('0x14'))('api');var utils=require(_0x2d4a('0x15'));var config=require(_0x2d4a('0x16'));var licenseUtil=require(_0x2d4a('0x17'));var db=require(_0x2d4a('0x18'))['db'];config[_0x2d4a('0x19')]=_[_0x2d4a('0x1a')](config[_0x2d4a('0x19')],{'host':_0x2d4a('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2d4a('0x1c'))['register'](socket);function respondWithStatusCode(_0x11c64a,_0x175bda){_0x175bda=_0x175bda||0xcc;return function(_0x11896d){if(_0x11896d){return _0x11c64a[_0x2d4a('0x1d')](_0x175bda);}return _0x11c64a['status'](_0x175bda)[_0x2d4a('0x1e')]();};}function respondWithResult(_0x5a6378,_0x2838fa){_0x2838fa=_0x2838fa||0xc8;return function(_0x4802f0){if(_0x4802f0){return _0x5a6378[_0x2d4a('0x1f')](_0x2838fa)[_0x2d4a('0x20')](_0x4802f0);}};}function respondWithFilteredResult(_0x2188b2,_0x388371){return function(_0x498956){if(_0x498956){var _0x4fd169=_0x498956[_0x2d4a('0x21')],_0x5ac74b=_0x388371[_0x2d4a('0x22')],_0x12afd7=_0x388371[_0x2d4a('0x22')]+_0x388371[_0x2d4a('0x23')],_0x1966d1;if(_0x12afd7>=_0x4fd169){_0x12afd7=_0x4fd169;_0x1966d1=0xc8;}else{_0x1966d1=0xce;}_0x2188b2['status'](_0x1966d1);return _0x2188b2['set'](_0x2d4a('0x24'),_0x5ac74b+'-'+_0x12afd7+'/'+_0x4fd169)[_0x2d4a('0x20')](_0x498956);}return null;};}function patchUpdates(_0x1b0efb){return function(_0x17d72e){try{jsonpatch[_0x2d4a('0x25')](_0x17d72e,_0x1b0efb,!![]);}catch(_0x2e7736){return BPromise[_0x2d4a('0x26')](_0x2e7736);}return _0x17d72e[_0x2d4a('0x27')]();};}function saveUpdates(_0x5d5daa,_0x26e7b8){return function(_0x3240a2){if(_0x3240a2){return _0x3240a2[_0x2d4a('0x28')](_0x5d5daa)[_0x2d4a('0x29')](function(_0x2c845c){return _0x2c845c;});}return null;};}function removeEntity(_0xed2822,_0x456d38){return function(_0x1facb9){if(_0x1facb9){return _0x1facb9['destroy']()['then'](function(){_0xed2822['status'](0xcc)[_0x2d4a('0x1e')]();});}};}function handleEntityNotFound(_0x5029f3,_0x410f7d){return function(_0x3a2fd3){if(!_0x3a2fd3){_0x5029f3[_0x2d4a('0x1d')](0x194);}return _0x3a2fd3;};}function handleError(_0x1d2fa6,_0x13e769){_0x13e769=_0x13e769||0x1f4;return function(_0x326c38){logger[_0x2d4a('0x2a')](_0x326c38[_0x2d4a('0x2b')]);if(_0x326c38['name']){delete _0x326c38[_0x2d4a('0x2c')];}_0x1d2fa6['status'](_0x13e769)[_0x2d4a('0x2d')](_0x326c38);};}function getInteractionUsers(_0x9bac28,_0xc497ce){return new BPromise(function(_0x20b87d,_0x101382){try{if(_0xc497ce[_0x9bac28['id']]){_0x9bac28[_0x2d4a('0x2e')]=_[_0x2d4a('0x2f')](_0xc497ce[_0x9bac28['id']],function(_0x2e8063){return{'id':_0x2e8063['id'],'fullname':_0x2e8063['fullname']};});}}catch(_0x45a4fa){_0x101382(_0x45a4fa);}_0x20b87d(_0x9bac28);});}function getInteractionTags(_0x3d94b7,_0xda1ef2){return new BPromise(function(_0x286150,_0x2b66af){try{if(_0x3d94b7['TagIds']){_0x3d94b7[_0x2d4a('0x30')]=[];_0x3d94b7[_0x2d4a('0x31')][_0x2d4a('0x32')](',')[_0x2d4a('0x33')](function(_0x2bb93d){_0x3d94b7['Tags'][_0x2d4a('0x34')](_0xda1ef2[_0x2bb93d]);});}delete _0x3d94b7[_0x2d4a('0x31')];}catch(_0x46b623){_0x2b66af(_0x46b623);}_0x286150(_0x3d94b7);});}function getLastMessageText(_0x76e966){return new BPromise(function(_0x4399a,_0x2d51d1){return db['MailInteraction'][_0x2d4a('0x35')]({'where':{'id':_0x76e966['id']},'attributes':[_0x2d4a('0x36'),_0x2d4a('0x37')],'raw':!![]})[_0x2d4a('0x29')](function(_0x3486c9){if(!_0x3486c9['lastMsgText']){_0x76e966[_0x2d4a('0x37')]=_[_0x2d4a('0x38')](htmlToText['fromString'](_0x3486c9[_0x2d4a('0x36')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x76e966[_0x2d4a('0x37')]=_0x3486c9[_0x2d4a('0x37')];}_0x4399a(_0x76e966);})[_0x2d4a('0x39')](function(_0x2b9093){_0x2d51d1(_0x2b9093);});});}function updateMailInteraction(_0x318ff0,_0x487d2e,_0x52106e,_0x32a926){return new BPromise(function(_0x3e3256,_0x13f120){return getInteractionUsers(_0x318ff0,_0x52106e)[_0x2d4a('0x29')](function(_0x145f21){return getInteractionTags(_0x145f21,_0x487d2e);})['then'](function(_0x5883f5){if(_0x32a926){_0x3e3256(getLastMessageText(_0x5883f5));}else{_0x3e3256(_0x5883f5);}})[_0x2d4a('0x39')](function(_0x4b833b){_0x13f120(_0x4b833b);});});}exports[_0x2d4a('0x3a')]=function(_0x309e33,_0x5aeae4){var _0x109c84={},_0x275598={},_0x8e1bea={'count':0x0,'rows':[]};var _0x1035b9=_[_0x2d4a('0x2f')](db[_0x2d4a('0x3b')][_0x2d4a('0x3c')],function(_0x2bd60a){return{'name':_0x2bd60a[_0x2d4a('0x3d')],'type':_0x2bd60a[_0x2d4a('0x3e')][_0x2d4a('0x3f')]};});_0x275598['model']=_[_0x2d4a('0x2f')](_0x1035b9,_0x2d4a('0x2c'));_0x275598[_0x2d4a('0x40')]=_[_0x2d4a('0x41')](_0x309e33[_0x2d4a('0x40')]);_0x275598['filters']=_['intersection'](_0x275598['model'],_0x275598['query']);_0x109c84[_0x2d4a('0x42')]=_[_0x2d4a('0x43')](_0x275598[_0x2d4a('0x44')],qs[_0x2d4a('0x45')](_0x309e33['query'][_0x2d4a('0x45')]));_0x109c84[_0x2d4a('0x42')]=_0x109c84['attributes'][_0x2d4a('0x46')]?_0x109c84[_0x2d4a('0x42')]:_0x275598[_0x2d4a('0x44')];if(!_0x309e33[_0x2d4a('0x40')][_0x2d4a('0x47')](_0x2d4a('0x48'))){_0x109c84['limit']=qs[_0x2d4a('0x23')](_0x309e33[_0x2d4a('0x40')][_0x2d4a('0x23')]);_0x109c84[_0x2d4a('0x22')]=qs[_0x2d4a('0x22')](_0x309e33[_0x2d4a('0x40')]['offset']);}_0x109c84[_0x2d4a('0x49')]=qs[_0x2d4a('0x4a')](_0x309e33[_0x2d4a('0x40')]['sort']);_0x109c84[_0x2d4a('0x4b')]=qs['filters'](_[_0x2d4a('0x4c')](_0x309e33[_0x2d4a('0x40')],_0x275598[_0x2d4a('0x4d')]),_0x1035b9);var _0x1bd674=[];var _0x2bd86=squel['select']()['field']('id')[_0x2d4a('0x4e')](_0x2d4a('0x2c'))['field'](_0x2d4a('0x4f'))['from'](_0x2d4a('0x50'));var _0x13f768=squel[_0x2d4a('0x51')]()['field'](_0x2d4a('0x52'))['field'](_0x2d4a('0x53'))[_0x2d4a('0x4e')](_0x2d4a('0x54'))[_0x2d4a('0x55')](_0x2d4a('0x56'),'ui')[_0x2d4a('0x57')](_0x2d4a('0x58'),'u',_0x2d4a('0x59'));var _0x1ffb96=squel[_0x2d4a('0x51')]()[_0x2d4a('0x55')]('mail_interactions','i')[_0x2d4a('0x57')](_0x2d4a('0x5a'),'c',_0x2d4a('0x5b'))[_0x2d4a('0x57')](_0x2d4a('0x58'),'o','o.id\x20=\x20i.UserId')[_0x2d4a('0x57')](_0x2d4a('0x5c'),'a',_0x2d4a('0x5d'))[_0x2d4a('0x57')](_0x2d4a('0x5e'),'me','me.MailInteractionId\x20=\x20i.id')['left_join'](_0x2d4a('0x5f'),'it',_0x2d4a('0x60'))['left_join'](_0x2d4a('0x50'),'t',_0x2d4a('0x61'));var _0x7f0807=squel[_0x2d4a('0x62')]();var _0x52a468=[];var _0x31576d=squel['expr']();var _0x3e3fb7;if(_0x309e33[_0x2d4a('0x40')][_0x2d4a('0x63')]){_0x3e3fb7=as[_0x2d4a('0x64')](_0x309e33[_0x2d4a('0x40')][_0x2d4a('0x63')]);var _0x25fb59=_0x3e3fb7[_0x2d4a('0x65')];for(var _0x5d086a=0x0;_0x5d086a<_0x3e3fb7[_0x2d4a('0x66')][_0x2d4a('0x46')];_0x5d086a++){var _0x98046f=_0x3e3fb7[_0x2d4a('0x66')][_0x5d086a];var _0x3e3925='i';var _0x334d6a=_[_0x2d4a('0x67')](_0x1035b9,[_0x2d4a('0x2c'),_0x98046f[_0x2d4a('0x4e')]]);if(!_0x334d6a){switch(_0x98046f[_0x2d4a('0x4e')]){case _0x2d4a('0x68'):if(_0x98046f[_0x2d4a('0x69')]==0x1){_0x1ffb96[_0x2d4a('0x6a')]('`'+_0x98046f[_0x2d4a('0x4e')]+_0x2d4a('0x6b'));}else{_0x1ffb96[_0x2d4a('0x6a')]('`'+_0x98046f[_0x2d4a('0x4e')]+'`\x20>\x200');}break;case _0x2d4a('0x6c'):if(_0x98046f[_0x2d4a('0x6d')]==='$substring'){if(_0x98046f[_0x2d4a('0x69')][_0x2d4a('0x32')]('\x20')[_0x2d4a('0x46')]>0x1){_0x7f0807[_0x25fb59](_0x2d4a('0x6e'),qs[_0x2d4a('0x6f')](_0x98046f[_0x2d4a('0x69')]),null);}else{var _0x5ac4d1='%'+_0x98046f[_0x2d4a('0x69')]+'%';_0x7f0807[_0x25fb59](_0x2d4a('0x70'),_0x5ac4d1,_0x5ac4d1,_0x5ac4d1);}}else{_0x334d6a=_[_0x2d4a('0x67')](_0x1035b9,[_0x2d4a('0x2c'),_0x2d4a('0x71')]);_0x98046f['field']=_0x2d4a('0x71');_0x2b0e4c=as[_0x2d4a('0x72')](_0x3e3925,_0x334d6a['type'],_0x98046f);_0x7f0807[_0x25fb59](_0x2b0e4c[_0x2d4a('0x73')],_0x2b0e4c[_0x2d4a('0x69')][_0x2d4a('0x74')],_0x2b0e4c[_0x2d4a('0x69')][_0x2d4a('0x1e')]);}break;case _0x2d4a('0x75'):var _0x35fb34=_0x98046f[_0x2d4a('0x69')][_0x2d4a('0x32')](',')[_0x2d4a('0x2f')](function(_0x5bbc96){return Number(_0x5bbc96);});_0x35fb34[_0x2d4a('0x33')](function(_0x8ae6bd){_0x31576d['or'](_0x2d4a('0x76'),'%,'+_0x8ae6bd+',%');});_0x52a468=_['union'](_0x52a468,_0x35fb34);break;case _0x2d4a('0x77'):if(_0x98046f[_0x2d4a('0x6d')]===_0x2d4a('0x78')){_0x7f0807[_0x25fb59](_0x2d4a('0x79'),'%'+_0x98046f[_0x2d4a('0x69')]+'%',null);}else{_0x334d6a=_[_0x2d4a('0x67')](_0x1035b9,[_0x2d4a('0x2c'),_0x2d4a('0x7a')]);_0x98046f[_0x2d4a('0x4e')]='UserId';_0x2b0e4c=as[_0x2d4a('0x72')](_0x3e3925,_0x334d6a[_0x2d4a('0x3e')],_0x98046f);_0x7f0807[_0x25fb59](_0x2b0e4c[_0x2d4a('0x73')],_0x2b0e4c[_0x2d4a('0x69')][_0x2d4a('0x74')],_0x2b0e4c[_0x2d4a('0x69')]['end']);}break;case _0x2d4a('0x7b'):_0x2b0e4c=as[_0x2d4a('0x72')]('me',null,_0x98046f);_0x7f0807[_0x25fb59](_0x2b0e4c[_0x2d4a('0x73')],_0x2b0e4c['value'][_0x2d4a('0x74')],_0x2b0e4c[_0x2d4a('0x69')]['end']);break;}}else{var _0x2b0e4c=as[_0x2d4a('0x72')](_0x3e3925,_0x334d6a['type'],_0x98046f);_0x7f0807[_0x25fb59](_0x2b0e4c[_0x2d4a('0x73')],_0x2b0e4c['value']['start'],_0x2b0e4c[_0x2d4a('0x69')][_0x2d4a('0x1e')]);}}}else{var _0x3b5bb9=_(_0x309e33[_0x2d4a('0x40')])['keys']()[_0x2d4a('0x2f')](function(_0x52e392){return _[_0x2d4a('0x7c')](_0x1035b9,[_0x2d4a('0x2c'),_0x52e392])?_0x52e392:undefined;})['compact']()['value']();if(!_[_0x2d4a('0x7d')](_0x3b5bb9)){_0x3b5bb9[_0x2d4a('0x33')](function(_0x2a2441){if(_0x2a2441===_0x2d4a('0x7e')){_0x1ffb96[_0x2d4a('0x4b')](_0x2d4a('0x7f'),[][_0x2d4a('0x80')](_0x309e33['query'][_0x2a2441]));}else if(_0x2a2441===_0x2d4a('0x81')){var _0x23fdb2=JSON[_0x2d4a('0x82')](_0x309e33[_0x2d4a('0x40')][_0x2a2441])['$gte'];var _0x299bdf=JSON[_0x2d4a('0x82')](_0x309e33[_0x2d4a('0x40')][_0x2a2441])[_0x2d4a('0x83')];_0x1ffb96['where'](_0x2d4a('0x84'),_0x23fdb2,_0x299bdf);}else{if(_0x309e33[_0x2d4a('0x40')][_0x2a2441]==='null'){_0x1ffb96[_0x2d4a('0x4b')]('i.'+_0x2a2441+_0x2d4a('0x85'));}else{_0x1ffb96[_0x2d4a('0x4b')]('i.'+_0x2a2441+'\x20=\x20?',_0x309e33[_0x2d4a('0x40')][_0x2a2441]);}}});}if(_0x309e33[_0x2d4a('0x40')][_0x2d4a('0x86')]){if(_0x309e33[_0x2d4a('0x40')][_0x2d4a('0x86')]==0x1){_0x1ffb96[_0x2d4a('0x6a')](_0x2d4a('0x87'));}else{_0x1ffb96['having'](_0x2d4a('0x88'));}}if(_0x309e33[_0x2d4a('0x40')][_0x2d4a('0x89')]){_0x52a468=_[_0x2d4a('0x8a')](_0x309e33[_0x2d4a('0x40')]['tag'])?_0x309e33[_0x2d4a('0x40')]['tag']:new Array(_0x309e33[_0x2d4a('0x40')][_0x2d4a('0x89')]);_0x52a468[_0x2d4a('0x33')](function(_0x21fa97){_0x31576d['or'](_0x2d4a('0x76'),'%,'+_0x21fa97+',%');});}if(_0x309e33[_0x2d4a('0x40')][_0x2d4a('0x8b')]){var _0x1879ef=_0x309e33[_0x2d4a('0x40')][_0x2d4a('0x8b')]['replace']('\x5c','\x5c\x5c')[_0x2d4a('0x8c')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1879ef)){_0x7f0807['or'](_0x2d4a('0x8d'),_0x1879ef+'%');}else if(qs[_0x2d4a('0x8e')](_0x1879ef)){_0x7f0807['or'](_0x2d4a('0x8f'),_0x1879ef+'%');}else{_0x7f0807['or'](_0x2d4a('0x90'),qs[_0x2d4a('0x6f')](_0x1879ef))['or'](_0x2d4a('0x91'),qs[_0x2d4a('0x6f')](_0x1879ef));}}}_0x1ffb96[_0x2d4a('0x4b')](_0x7f0807);_0x1ffb96[_0x2d4a('0x92')]('i.id');var _0x1a83a4={'type':db[_0x2d4a('0x93')][_0x2d4a('0x94')][_0x2d4a('0x95')],'raw':!![]};var _0x574285=_0x1ffb96[_0x2d4a('0x96')]();_0x574285[_0x2d4a('0x4e')](_0x2d4a('0x97'));_0x574285[_0x2d4a('0x4e')](_0x2d4a('0x98'),_0x2d4a('0x68'));if(_0x109c84['order']){_0x109c84[_0x2d4a('0x49')][_0x2d4a('0x33')](function(_0x54350d){var _0x42e4e5=_0x54350d[0x0]===_0x2d4a('0x99')?_0x54350d[0x0]:'i.'+_0x54350d[0x0];_0x1ffb96[_0x2d4a('0x49')](_0x42e4e5,_0x54350d[0x1]===_0x2d4a('0x9a')?![]:!![]);});}if(!_[_0x2d4a('0x7d')](_0x52a468)){_0x1ffb96[_0x2d4a('0x6a')](_0x31576d);_0x574285[_0x2d4a('0x4b')](_0x2d4a('0x9b'),_0x52a468);}BPromise[_0x2d4a('0x9c')]()[_0x2d4a('0x29')](function(){if(!_0x3e3fb7){if(_0x309e33['query'][_0x2d4a('0x7e')])return;_0x574285['where'](_0x2d4a('0x9d'));_0x1ffb96[_0x2d4a('0x4b')](_0x2d4a('0x9d'));return;}if(_0x309e33[_0x2d4a('0x9e')][_0x2d4a('0x9f')]!==_0x2d4a('0xa0'))return;return _0x309e33[_0x2d4a('0x9e')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0x2d4a('0x29')](function(_0x2ebb9e){if(_[_0x2d4a('0x7d')](_0x2ebb9e)){_0x574285[_0x2d4a('0x4b')](_0x2d4a('0xa1'));_0x1ffb96['where']('i.MailAccountId\x20IS\x20NULL');}else{_0x574285['where'](_0x2d4a('0x7f'),_[_0x2d4a('0x2f')](_0x2ebb9e,'id'));_0x1ffb96[_0x2d4a('0x4b')]('i.MailAccountId\x20IN\x20?',_[_0x2d4a('0x2f')](_0x2ebb9e,'id'));}});})[_0x2d4a('0x29')](function(){if(_0x309e33[_0x2d4a('0x9e')][_0x2d4a('0x9f')]===_0x2d4a('0xa0')&&!_0x3e3fb7&&!_0x309e33[_0x2d4a('0x40')]['MailAccountId'])return[];return db[_0x2d4a('0xa2')]['query'](_0x574285[_0x2d4a('0xa3')](),_0x1a83a4);})[_0x2d4a('0x29')](function(_0x59fd99){_0x8e1bea[_0x2d4a('0x21')]=_0x59fd99['length'];if(_0x8e1bea['count']===0x0)return[];return db['sequelize'][_0x2d4a('0x40')](_0x2bd86[_0x2d4a('0xa3')](),_0x1a83a4)[_0x2d4a('0x29')](function(_0x56f0df){_0x1bd674=_[_0x2d4a('0xa4')](_0x56f0df,'id');_0x1a83a4=_[_0x2d4a('0xa5')](_0x1a83a4,{'model':db[_0x2d4a('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x309e33[_0x2d4a('0x40')]['fields']){_0x109c84[_0x2d4a('0x42')][_0x2d4a('0x33')](function(_0x4cd04c){_0x1ffb96[_0x2d4a('0x4e')]('i.'+_0x4cd04c);});}else{_0x1ffb96[_0x2d4a('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2d4a('0x68'));_0x1ffb96['field']('a.key',_0x2d4a('0xa6'));_0x1ffb96['field'](_0x2d4a('0xa7'),_0x2d4a('0xa8'));_0x1ffb96[_0x2d4a('0x4e')](_0x2d4a('0xa9'),'contactName');_0x1ffb96[_0x2d4a('0x4e')]('i.id');_0x1ffb96[_0x2d4a('0x4e')](_0x2d4a('0xaa'));_0x1ffb96[_0x2d4a('0x4e')](_0x2d4a('0xab'));_0x1ffb96[_0x2d4a('0x4e')]('i.closed');_0x1ffb96[_0x2d4a('0x4e')](_0x2d4a('0xac'));_0x1ffb96[_0x2d4a('0x4e')]('i.attach');_0x1ffb96[_0x2d4a('0x4e')]('i.lastMsgAt');_0x1ffb96['field'](_0x2d4a('0xad'));_0x1ffb96[_0x2d4a('0x4e')](_0x2d4a('0xae'));_0x1ffb96[_0x2d4a('0x4e')](_0x2d4a('0xaf'));_0x1ffb96[_0x2d4a('0x4e')](_0x2d4a('0xb0'));_0x1ffb96[_0x2d4a('0x4e')](_0x2d4a('0xb1'));_0x1ffb96[_0x2d4a('0x4e')]('i.substatus');_0x1ffb96[_0x2d4a('0x4e')](_0x2d4a('0xb2'));_0x1ffb96[_0x2d4a('0x4e')](_0x2d4a('0xb3'));_0x1ffb96[_0x2d4a('0x4e')](_0x2d4a('0xb4'));_0x1ffb96[_0x2d4a('0x4e')](_0x2d4a('0xb5'));_0x1ffb96['field'](_0x2d4a('0xb6'),_0x2d4a('0xb7'));_0x1ffb96[_0x2d4a('0x4e')]('c.lastName',_0x2d4a('0xb8'));_0x1ffb96['field'](_0x2d4a('0xb9'),_0x2d4a('0xba'));_0x1ffb96[_0x2d4a('0x4e')](_0x2d4a('0xbb'),'Contact.phone');_0x1ffb96[_0x2d4a('0x4e')]('c.mobile',_0x2d4a('0xbc'));_0x1ffb96[_0x2d4a('0x4e')](_0x2d4a('0xbd'),'Contact.fax');_0x1ffb96[_0x2d4a('0x4e')]('o.fullname',_0x2d4a('0xbe'));_0x1ffb96[_0x2d4a('0x4e')](_0x2d4a('0xbf'),_0x2d4a('0xc0'));_0x1ffb96[_0x2d4a('0x4e')](_0x2d4a('0xc1'),_0x2d4a('0x31'));}if(_0x109c84[_0x2d4a('0x23')])_0x1ffb96[_0x2d4a('0x23')](_0x109c84['limit']);if(_0x109c84['offset'])_0x1ffb96['offset'](_0x109c84[_0x2d4a('0x22')]);return db['sequelize'][_0x2d4a('0x40')](_0x1ffb96['toString'](),_0x1a83a4);})[_0x2d4a('0x29')](function(_0x29f417){_0x13f768['where']('ui.MailInteractionId\x20IN\x20?',_[_0x2d4a('0x2f')](_0x29f417,'id'));return db['sequelize'][_0x2d4a('0x40')](_0x13f768[_0x2d4a('0xa3')](),_0x1a83a4)[_0x2d4a('0x29')](function(_0x5e1042){var _0x405012=_[_0x2d4a('0xc2')](_0x5e1042,_0x2d4a('0xc3'));var _0x2c8acd=[];return db[_0x2d4a('0xc4')][_0x2d4a('0x35')]({'attributes':[_0x2d4a('0xc5')],'raw':!![]})[_0x2d4a('0x29')](function(_0x33452e){var _0x121430=_0x33452e[_0x2d4a('0xc5')];_0x29f417[_0x2d4a('0x33')](function(_0x56eacf){_0x2c8acd[_0x2d4a('0x34')](updateMailInteraction(_0x56eacf,_0x1bd674,_0x405012,_0x121430));});return BPromise[_0x2d4a('0xc6')](_0x2c8acd);});});});})[_0x2d4a('0x29')](function(_0x59f67a){_0x8e1bea[_0x2d4a('0xc7')]=_0x59f67a;return _0x8e1bea;})[_0x2d4a('0x29')](respondWithFilteredResult(_0x5aeae4,_0x109c84))[_0x2d4a('0x39')](handleError(_0x5aeae4,null));};exports[_0x2d4a('0xc8')]=function(_0x31b0c8,_0x4feefa){var _0x438769={'raw':![],'where':{'id':_0x31b0c8[_0x2d4a('0xc9')]['id']}},_0x1483af={};_0x1483af[_0x2d4a('0x44')]=_['keys'](db[_0x2d4a('0x3b')][_0x2d4a('0x3c')]);_0x1483af[_0x2d4a('0x40')]=_[_0x2d4a('0x41')](_0x31b0c8[_0x2d4a('0x40')]);_0x1483af[_0x2d4a('0x4d')]=_[_0x2d4a('0x43')](_0x1483af['model'],_0x1483af[_0x2d4a('0x40')]);_0x438769[_0x2d4a('0x42')]=_[_0x2d4a('0x43')](_0x1483af[_0x2d4a('0x44')],qs[_0x2d4a('0x45')](_0x31b0c8[_0x2d4a('0x40')]['fields']));_0x438769[_0x2d4a('0x42')]=_0x438769[_0x2d4a('0x42')][_0x2d4a('0x46')]?_0x438769[_0x2d4a('0x42')]:_0x1483af[_0x2d4a('0x44')];if(_0x31b0c8['query']['includeAll']){_0x438769[_0x2d4a('0xca')]=[{'all':!![]}];}_0x438769=_[_0x2d4a('0xa5')]({},_0x438769,_0x31b0c8[_0x2d4a('0xcb')]);return db[_0x2d4a('0x3b')][_0x2d4a('0x67')](_0x438769)[_0x2d4a('0x29')](handleEntityNotFound(_0x4feefa,null))[_0x2d4a('0x29')](respondWithResult(_0x4feefa,null))[_0x2d4a('0x39')](handleError(_0x4feefa,null));};exports[_0x2d4a('0xcc')]=function(_0x5dca40,_0x502a8c){return db[_0x2d4a('0x3b')][_0x2d4a('0xcc')](_0x5dca40[_0x2d4a('0xcd')],{})[_0x2d4a('0x29')](respondWithResult(_0x502a8c,0xc9))[_0x2d4a('0x39')](handleError(_0x502a8c,null));};exports[_0x2d4a('0x28')]=function(_0x131d47,_0x9cf6ac){if(_0x131d47[_0x2d4a('0xcd')]['id']){delete _0x131d47[_0x2d4a('0xcd')]['id'];}return db[_0x2d4a('0x3b')][_0x2d4a('0x67')]({'where':{'id':_0x131d47['params']['id']}})['then'](handleEntityNotFound(_0x9cf6ac,null))['then'](saveUpdates(_0x131d47[_0x2d4a('0xcd')],null))['then'](respondWithResult(_0x9cf6ac,null))['catch'](handleError(_0x9cf6ac,null));};exports[_0x2d4a('0xce')]=function(_0x447bc6,_0x4e306e){return db['MailInteraction']['find']({'where':{'id':_0x447bc6[_0x2d4a('0xc9')]['id']}})[_0x2d4a('0x29')](handleEntityNotFound(_0x4e306e,null))[_0x2d4a('0x29')](removeEntity(_0x4e306e,null))[_0x2d4a('0x39')](handleError(_0x4e306e,null));};exports[_0x2d4a('0xcf')]=function(_0x357dfc,_0xd80165){return db[_0x2d4a('0x3b')][_0x2d4a('0xcf')]()[_0x2d4a('0x29')](respondWithResult(_0xd80165,null))['catch'](handleError(_0xd80165,null));};exports[_0x2d4a('0xd0')]=function(_0x4146ce,_0x1fb91d,_0x285942){return db[_0x2d4a('0xd1')][_0x2d4a('0x67')]({'where':{'id':_0x4146ce['params']['id']}})[_0x2d4a('0x29')](handleEntityNotFound(_0x1fb91d,null))[_0x2d4a('0x29')](function(_0x488fa0){if(_0x488fa0){return _0x488fa0[_0x2d4a('0xd0')](_0x4146ce[_0x2d4a('0xcd')]['ids'],_['omit'](_0x4146ce['body'],['ids','id'])||{});}})[_0x2d4a('0x29')](respondWithResult(_0x1fb91d,null))['catch'](handleError(_0x1fb91d,null));};exports[_0x2d4a('0xd2')]=function(_0x364017,_0x1e3333,_0xdf1070){var _0x445de6={'raw':![],'where':{}};var _0x33f664={};var _0x13fb0a={'count':0x0,'rows':[]};return db['MailInteraction'][_0x2d4a('0x35')]({'where':{'id':_0x364017['params']['id']}})[_0x2d4a('0x29')](handleEntityNotFound(_0x1e3333,null))[_0x2d4a('0x29')](function(_0x137c57){if(_0x137c57){_0x33f664[_0x2d4a('0x44')]=_[_0x2d4a('0x41')](db[_0x2d4a('0xd1')][_0x2d4a('0x3c')]);_0x33f664['query']=_[_0x2d4a('0x41')](_0x364017['query']);_0x33f664[_0x2d4a('0x4d')]=_[_0x2d4a('0x43')](_0x33f664[_0x2d4a('0x44')],_0x33f664['query']);_0x445de6[_0x2d4a('0x42')]=_[_0x2d4a('0x43')](_0x33f664[_0x2d4a('0x44')],qs[_0x2d4a('0x45')](_0x364017[_0x2d4a('0x40')][_0x2d4a('0x45')]));_0x445de6['attributes']=_0x445de6[_0x2d4a('0x42')]['length']?_0x445de6[_0x2d4a('0x42')]:_0x33f664['model'];if(!_0x364017['query'][_0x2d4a('0x47')]('nolimit')){_0x445de6['limit']=qs[_0x2d4a('0x23')](_0x364017[_0x2d4a('0x40')][_0x2d4a('0x23')]);_0x445de6[_0x2d4a('0x22')]=qs[_0x2d4a('0x22')](_0x364017[_0x2d4a('0x40')][_0x2d4a('0x22')]);}_0x445de6['order']=qs['sort'](_0x364017[_0x2d4a('0x40')][_0x2d4a('0x4a')]);_0x445de6[_0x2d4a('0x4b')]=qs[_0x2d4a('0x4d')](_[_0x2d4a('0x4c')](_0x364017[_0x2d4a('0x40')],_0x33f664[_0x2d4a('0x4d')]));_0x445de6['where'][_0x2d4a('0xc3')]=_0x137c57['id'];if(_0x364017[_0x2d4a('0x40')]['filter']){_0x445de6[_0x2d4a('0x4b')]=_['merge'](_0x445de6[_0x2d4a('0x4b')],{'$or':_[_0x2d4a('0x2f')](_0x445de6[_0x2d4a('0x42')],function(_0x47ea54){var _0x1cd63f={};_0x1cd63f[_0x47ea54]={'$like':'%'+_0x364017['query']['filter']+'%'};return _0x1cd63f;})});}if(_0x364017[_0x2d4a('0x40')][_0x2d4a('0xd3')]){var _0x1dae77=_0x364017['query'][_0x2d4a('0xd3')]['split'](',');var _0xe06e2a={};_0xe06e2a[_0x1dae77[0x0]]={'$gte':moment(_0x1dae77[0x1])[_0x2d4a('0xd4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x445de6[_0x2d4a('0x4b')]=_[_0x2d4a('0xa5')](_0x445de6[_0x2d4a('0x4b')],_0xe06e2a);}_0x445de6=_[_0x2d4a('0xa5')]({},_0x445de6,_0x364017[_0x2d4a('0xcb')]);return db[_0x2d4a('0xd1')][_0x2d4a('0x21')]({'where':_0x445de6['where']})[_0x2d4a('0x29')](function(_0x5e358a){_0x13fb0a[_0x2d4a('0x21')]=_0x5e358a;if(_0x364017[_0x2d4a('0x40')][_0x2d4a('0xd5')]){_0x445de6[_0x2d4a('0xca')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x445de6);})[_0x2d4a('0x29')](function(_0x2e5c33){if(_0x364017[_0x2d4a('0x40')][_0x2d4a('0xd6')]===_0x2d4a('0xd7')){for(var _0x36a944=0x0;_0x36a944<_0x2e5c33[_0x2d4a('0x46')];_0x36a944++){_0x2e5c33[_0x36a944][_0x2d4a('0xcd')]=juice(_0x2e5c33[_0x36a944]['body']);}}_0x13fb0a[_0x2d4a('0xc7')]=_0x2e5c33;return _0x13fb0a;});}})[_0x2d4a('0x29')](respondWithFilteredResult(_0x1e3333,_0x445de6))['catch'](handleError(_0x1e3333,null));};exports['addTags']=function(_0x1fa027,_0x6929c5,_0x3e016a){return db['MailInteraction'][_0x2d4a('0x67')]({'where':{'id':_0x1fa027[_0x2d4a('0xc9')]['id']}})['then'](handleEntityNotFound(_0x6929c5,null))[_0x2d4a('0x29')](function(_0x3ee55d){if(_0x3ee55d){return _0x3ee55d[_0x2d4a('0xd8')](_0x1fa027[_0x2d4a('0xcd')][_0x2d4a('0xd9')],_['omit'](_0x1fa027['body'],[_0x2d4a('0xd9'),'id'])||{})['spread'](function(){return db[_0x2d4a('0x75')][_0x2d4a('0xda')]({'attributes':['id',_0x2d4a('0x2c'),'color'],'where':{'id':_0x1fa027[_0x2d4a('0xcd')][_0x2d4a('0xd9')]}});})[_0x2d4a('0x29')](function(_0x2d683b){socket[_0x2d4a('0xdb')](_0x2d4a('0xdc'),{'id':Number(_0x1fa027[_0x2d4a('0xc9')]['id']),'tags':_0x2d683b||[]});return{'id':Number(_0x1fa027[_0x2d4a('0xc9')]['id']),'tags':_0x2d683b||[]};});}})['then'](respondWithResult(_0x6929c5,null))['catch'](handleError(_0x6929c5,null));};exports['removeTags']=function(_0x358fd7,_0x12723f,_0x10725a){return db['MailInteraction'][_0x2d4a('0x67')]({'where':{'id':_0x358fd7['params']['id']}})[_0x2d4a('0x29')](handleEntityNotFound(_0x12723f,null))[_0x2d4a('0x29')](function(_0x272df1){if(_0x272df1){return _0x272df1[_0x2d4a('0xdd')](_0x358fd7[_0x2d4a('0x40')][_0x2d4a('0xd9')]);}})[_0x2d4a('0x29')](respondWithStatusCode(_0x12723f,null))['catch'](handleError(_0x12723f,null));};exports[_0x2d4a('0xde')]=function(_0x1dcb18,_0x1a2242){var _0x4a8dee=moment()['unix']()[_0x2d4a('0xa3')]();var _0x567f14=path['join'](config['root'],_0x2d4a('0xdf'),'files',_0x2d4a('0xe0'));var _0x4b4c44=path[_0x2d4a('0xe1')](config['root'],_0x2d4a('0xdf'),'files',_0x2d4a('0xe2'));var _0x6159e6=path['join'](_0x567f14,_0x4a8dee);var _0x39c9db=util[_0x2d4a('0xd4')](_0x2d4a('0xe3'),_0x1dcb18['params']['id'],_0x4a8dee);var _0x4be976=path[_0x2d4a('0xe1')](_0x567f14,_0x39c9db);var _0x1d1154=[];if(_0x1dcb18[_0x2d4a('0x40')][_0x2d4a('0xe2')]){_0x1d1154[_0x2d4a('0x34')]({'model':db[_0x2d4a('0xe4')],'as':_0x2d4a('0xe5'),'raw':!![]});}var _0x1aedfb=[{'model':db[_0x2d4a('0xd1')],'as':_0x2d4a('0xe6'),'attributes':['id',_0x2d4a('0xcd'),_0x2d4a('0x55'),'to','cc',_0x2d4a('0xe7'),_0x2d4a('0xe8'),'createdAt'],'where':{'secret':![]},'order':qs[_0x2d4a('0x4a')]('id'),'include':_0x1d1154}];return db[_0x2d4a('0x3b')][_0x2d4a('0x67')]({'where':{'id':_0x1dcb18[_0x2d4a('0xc9')]['id']},'include':_0x1aedfb})[_0x2d4a('0x29')](handleEntityNotFound(_0x1a2242,null))['then'](function(_0x7b824c){if(_0x7b824c&&_0x7b824c[_0x2d4a('0xe6')]){var _0x5eb45a=_0x7b824c['get']({'plain':!![]});fs[_0x2d4a('0xe9')](_0x6159e6);return BPromise[_0x2d4a('0xea')](_0x5eb45a[_0x2d4a('0xe6')],function(_0x1533d1,_0x2bb5a4){var _0x4bb9b8={'from':_0x1533d1[_0x2d4a('0x55')],'to':_0x1533d1['to'],'subject':_0x1533d1[_0x2d4a('0xe8')],'html':_0x1533d1[_0x2d4a('0xcd')],'headers':{'Date':moment(_0x1533d1['createdAt'])[_0x2d4a('0xd4')](_0x2d4a('0xeb'))},'attachments':[]};if(_0x1533d1['cc']){_0x4bb9b8[_0x2d4a('0xec')]['Cc']=_0x1533d1['cc'];}if(_0x1533d1[_0x2d4a('0xe7')]){_0x4bb9b8[_0x2d4a('0xec')][_0x2d4a('0xed')]=_0x1533d1[_0x2d4a('0xe7')];}return new BPromise(function(_0x5dfded,_0x497b3e){if(_0x1533d1['Attachments']){for(var _0x4cb5fb=0x0;_0x4cb5fb<_0x1533d1['Attachments'][_0x2d4a('0x46')];_0x4cb5fb++){var _0x43b3d8=_0x1533d1[_0x2d4a('0xe5')][_0x4cb5fb];var _0x37c2ff=path['join'](_0x4b4c44,_0x43b3d8[_0x2d4a('0xee')]);if(fs[_0x2d4a('0xef')](_0x37c2ff)){_0x4bb9b8[_0x2d4a('0xe2')]['push']({'name':_0x43b3d8['name'],'contentType':_0x43b3d8[_0x2d4a('0x3e')],'data':fs[_0x2d4a('0xf0')](_0x37c2ff)});}}}emlformat[_0x2d4a('0xf1')](_0x4bb9b8,function(_0x3c69b4,_0x5a37d5){if(_0x3c69b4)return _0x497b3e(_0x3c69b4);fs[_0x2d4a('0xf2')](path[_0x2d4a('0xe1')](_0x6159e6,util[_0x2d4a('0xd4')](_0x2d4a('0xf3'),_0x2bb5a4)),_0x5a37d5);return _0x5dfded(_0x5a37d5);});});})['then'](function(){return new BPromise(function(_0x520cf6,_0x22b7a0){zipdir(_0x6159e6,{'saveTo':_0x4be976},function(_0x45267b,_0x3b0be4){if(_0x45267b)return _0x22b7a0(_0x45267b);return _0x520cf6(_0x3b0be4);});})[_0x2d4a('0x29')](function(){return new BPromise(function(_0x3d3016,_0x32139d){rimraf(_0x6159e6,function(_0x1f4f58){if(_0x1f4f58)_0x32139d(_0x1f4f58);return _0x3d3016();});});})[_0x2d4a('0x29')](function(){return _0x1a2242[_0x2d4a('0xde')](_0x4be976,_0x39c9db,function(_0x389e60){if(_0x389e60){console[_0x2d4a('0xf4')](_0x2d4a('0xf5'),_0x389e60);}else{fs[_0x2d4a('0xf6')](_0x4be976);}});});});}else{return _0x1a2242[_0x2d4a('0x1d')](0xc8);}})[_0x2d4a('0x39')](handleError(_0x1a2242,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 098140a..e0df872 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 _0x03b8=['emit','catch','hook','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','then','map','findAll','setDataValue','unreadMessages','length'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x03b8,0x113));var _0x803b=function(_0x5d3218,_0x404221){_0x5d3218=_0x5d3218-0x0;var _0x1ae462=_0x03b8[_0x5d3218];return _0x1ae462;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x803b('0x0')];var MailMessage=require(_0x803b('0x1'))['db'][_0x803b('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x803b('0x3')](0x0);var events={'afterCreate':_0x803b('0x4'),'afterUpdate':_0x803b('0x5'),'afterDestroy':_0x803b('0x6')};function emitEvent(_0x45ecb2){return function(_0x1e724c,_0x140010,_0x24d231){_0x1e724c[_0x803b('0x7')]({'attributes':['id'],'raw':!![]})[_0x803b('0x8')](function(_0x29eb32){_0x1e724c['setDataValue']('Users',_0x29eb32[_0x803b('0x9')](function(_0x3987b2){return{'id':_0x3987b2['id']};}));return MailMessage[_0x803b('0xa')]({'where':{'MailInteractionId':_0x1e724c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x803b('0x8')](function(_0x11ef83){_0x1e724c[_0x803b('0xb')](_0x803b('0xc'),_0x11ef83[_0x803b('0xd')]);MailInteractionEvents[_0x803b('0xe')](_0x45ecb2+':'+_0x1e724c['id'],_0x1e724c);MailInteractionEvents[_0x803b('0xe')](_0x45ecb2,_0x1e724c);_0x24d231(null);})[_0x803b('0xf')](_0x24d231(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x803b('0x10')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x629a=['events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports'];(function(_0xffc8,_0x26debc){var _0x3e86d8=function(_0x3b7816){while(--_0x3b7816){_0xffc8['push'](_0xffc8['shift']());}};_0x3e86d8(++_0x26debc);}(_0x629a,0x1e6));var _0xa629=function(_0x430dbd,_0x14ef7e){_0x430dbd=_0x430dbd-0x0;var _0x490452=_0x629a[_0x430dbd];return _0x490452;};'use strict';var EventEmitter=require(_0xa629('0x0'));var MailInteraction=require(_0xa629('0x1'))['db'][_0xa629('0x2')];var MailMessage=require(_0xa629('0x1'))['db'][_0xa629('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xa629('0x4')](0x0);var events={'afterCreate':_0xa629('0x5'),'afterUpdate':'update','afterDestroy':_0xa629('0x6')};function emitEvent(_0x4bdd37){return function(_0x395b13,_0x1ea94c,_0x257149){_0x395b13[_0xa629('0x7')]({'attributes':['id'],'raw':!![]})[_0xa629('0x8')](function(_0x3a2170){_0x395b13[_0xa629('0x9')](_0xa629('0xa'),_0x3a2170['map'](function(_0x36e00b){return{'id':_0x36e00b['id']};}));return MailMessage[_0xa629('0xb')]({'where':{'MailInteractionId':_0x395b13['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa629('0x8')](function(_0xdfdca1){_0x395b13['setDataValue'](_0xa629('0xc'),_0xdfdca1[_0xa629('0xd')]);MailInteractionEvents[_0xa629('0xe')](_0x4bdd37+':'+_0x395b13['id'],_0x395b13);MailInteractionEvents[_0xa629('0xe')](_0x4bdd37,_0x395b13);_0x257149(null);})['catch'](_0x257149(null));};}for(var e in events){if(events[_0xa629('0xf')](e)){var event=events[e];MailInteraction[_0xa629('0x10')](e,emitEvent(event));}}module[_0xa629('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 4672327..9a7c4a8 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 _0x6a00=['substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','models','get','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','subject','FULLTEXT','substatus'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6a00,0xc9));var _0x06a0=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6a00[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x06a0('0x0'));var util=require(_0x06a0('0x1'));var logger=require('../../config/logger')(_0x06a0('0x2'));var moment=require(_0x06a0('0x3'));var BPromise=require(_0x06a0('0x4'));var rp=require(_0x06a0('0x5'));var fs=require('fs');var path=require(_0x06a0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x06a0('0x7'));module[_0x06a0('0x8')]=function(_0x1de0c2,_0xa49954){return _0x1de0c2[_0x06a0('0x9')](_0x06a0('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x06a0('0xb'),'fields':[_0x06a0('0xc'),'to'],'type':_0x06a0('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x35af04,_0x38a7d3,_0x26c616){if(_0x35af04[_0x06a0('0xe')]){_0x35af04[_0x06a0('0xf')]=moment()[_0x06a0('0x10')](_0x06a0('0x11'));}if(_0x35af04[_0x06a0('0x12')]){_0x35af04['closedAt']=moment()['format'](_0x06a0('0x11'));}_0x26c616(null,_0x38a7d3);},'beforeUpdate':function(_0x4103c8,_0x43279d,_0x1d2b7f){if(_0x4103c8[_0x06a0('0x13')](_0x06a0('0xe'))){_0x4103c8[_0x06a0('0xf')]=_0x4103c8[_0x06a0('0xe')]?moment()['format'](_0x06a0('0x11')):null;}if(_0x4103c8[_0x06a0('0x13')](_0x06a0('0x12'))){_0x4103c8['closedAt']=moment()[_0x06a0('0x10')](_0x06a0('0x11'));_0x4103c8[_0x06a0('0xe')]=null;_0x4103c8['substatusAt']=null;}_0x1d2b7f(null,_0x4103c8);},'afterUpdate':function(_0x4083e7,_0x38fec6,_0x58edad){var _0x578f39=_0x1de0c2[_0x06a0('0x14')];var _0xacb02c=_0x4083e7[_0x06a0('0x15')]({'plain':!![]});if(_0xacb02c[_0x06a0('0x12')]){return _0x578f39['MailMessage'][_0x06a0('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0xacb02c['id']}})[_0x06a0('0x17')](function(){_0x58edad();})[_0x06a0('0x18')](function(_0x2d34e7){_0x58edad(_0x2d34e7);});}else{_0x58edad();}}},'charset':_0x06a0('0x19'),'collate':_0x06a0('0x1a')});}; \ No newline at end of file +var _0x1798=['MailInteraction','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','update','catch','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x1798,0x1d6));var _0x8179=function(_0x449926,_0x2bbd42){_0x449926=_0x449926-0x0;var _0x431b35=_0x1798[_0x449926];return _0x431b35;};'use strict';var _=require(_0x8179('0x0'));var util=require('util');var logger=require(_0x8179('0x1'))(_0x8179('0x2'));var moment=require('moment');var BPromise=require(_0x8179('0x3'));var rp=require(_0x8179('0x4'));var fs=require('fs');var path=require(_0x8179('0x5'));var rimraf=require(_0x8179('0x6'));var config=require('../../config/environment');var attributes=require(_0x8179('0x7'));module[_0x8179('0x8')]=function(_0x56188e,_0x565be1){return _0x56188e[_0x8179('0x9')](_0x8179('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x8179('0xb'),'fields':[_0x8179('0xc'),'to'],'type':_0x8179('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x15607d,_0x15f3dc,_0x5f4fa2){if(_0x15607d[_0x8179('0xe')]){_0x15607d[_0x8179('0xf')]=moment()[_0x8179('0x10')](_0x8179('0x11'));}if(_0x15607d[_0x8179('0x12')]){_0x15607d['closedAt']=moment()[_0x8179('0x10')](_0x8179('0x11'));}_0x5f4fa2(null,_0x15f3dc);},'beforeUpdate':function(_0x252f3f,_0x1d39c3,_0x2141b1){if(_0x252f3f['changed']('substatus')){_0x252f3f['substatusAt']=_0x252f3f[_0x8179('0xe')]?moment()[_0x8179('0x10')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x252f3f[_0x8179('0x13')](_0x8179('0x12'))){_0x252f3f[_0x8179('0x14')]=moment()[_0x8179('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x252f3f['substatus']=null;_0x252f3f['substatusAt']=null;}_0x2141b1(null,_0x252f3f);},'afterUpdate':function(_0x2ecd53,_0x46da7c,_0xc1c396){var _0x4b9775=_0x56188e['models'];var _0x59a92e=_0x2ecd53['get']({'plain':!![]});if(_0x59a92e[_0x8179('0x12')]){return _0x4b9775['MailMessage'][_0x8179('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x59a92e['id']}})['then'](function(){_0xc1c396();})[_0x8179('0x16')](function(_0x53906f){_0xc1c396(_0x53906f);});}else{_0xc1c396();}}},'charset':'utf8mb4','collate':_0x8179('0x17')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index b87b26e..b0cd76c 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 _0x6d4a=['catch','UpdateMailInteraction','MailInteraction','update','body','raw','options','where','limit','then','find','addTags','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x30d9b7,_0x551d50){var _0x3065f6=function(_0x2d1444){while(--_0x2d1444){_0x30d9b7['push'](_0x30d9b7['shift']());}};_0x3065f6(++_0x551d50);}(_0x6d4a,0x117));var _0xa6d4=function(_0x4d55f5,_0x290026){_0x4d55f5=_0x4d55f5-0x0;var _0x56e886=_0x6d4a[_0x4d55f5];return _0x56e886;};'use strict';var _=require(_0xa6d4('0x0'));var util=require('util');var moment=require(_0xa6d4('0x1'));var BPromise=require(_0xa6d4('0x2'));var rs=require(_0xa6d4('0x3'));var fs=require('fs');var Redis=require(_0xa6d4('0x4'));var db=require(_0xa6d4('0x5'))['db'];var utils=require(_0xa6d4('0x6'));var logger=require(_0xa6d4('0x7'))(_0xa6d4('0x8'));var config=require(_0xa6d4('0x9'));var jayson=require(_0xa6d4('0xa'));var client=jayson[_0xa6d4('0xb')][_0xa6d4('0xc')]({'port':0x232a});config[_0xa6d4('0xd')]=_[_0xa6d4('0xe')](config['redis'],{'host':_0xa6d4('0xf'),'port':0x18eb});var socket=require(_0xa6d4('0x10'))(new Redis(config['redis']));require(_0xa6d4('0x11'))[_0xa6d4('0x12')](socket);function respondWithRpcPromise(_0x2bea15,_0xb76050,_0x2320cc){return new BPromise(function(_0x54edec,_0x340d84){return client[_0xa6d4('0x13')](_0x2bea15,_0x2320cc)['then'](function(_0x2c7f14){logger[_0xa6d4('0x14')](_0xa6d4('0x15'),_0xb76050,'request\x20sent');logger[_0xa6d4('0x16')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0xb76050,_0xa6d4('0x17'),JSON[_0xa6d4('0x18')](_0x2c7f14));if(_0x2c7f14['error']){if(_0x2c7f14[_0xa6d4('0x19')][_0xa6d4('0x1a')]===0x1f4){logger[_0xa6d4('0x19')](_0xa6d4('0x15'),_0xb76050,_0x2c7f14[_0xa6d4('0x19')][_0xa6d4('0x1b')]);return _0x340d84(_0x2c7f14[_0xa6d4('0x19')][_0xa6d4('0x1b')]);}logger[_0xa6d4('0x19')](_0xa6d4('0x15'),_0xb76050,_0x2c7f14[_0xa6d4('0x19')][_0xa6d4('0x1b')]);return _0x54edec(_0x2c7f14['error'][_0xa6d4('0x1b')]);}else{logger['info'](_0xa6d4('0x15'),_0xb76050,_0xa6d4('0x17'));_0x54edec(_0x2c7f14[_0xa6d4('0x1c')]['message']);}})[_0xa6d4('0x1d')](function(_0x442466){logger['error'](_0xa6d4('0x15'),_0xb76050,_0x442466);_0x340d84(_0x442466);});});}exports[_0xa6d4('0x1e')]=function(_0x12c040){var _0x39315a=this;return new Promise(function(_0x702c88,_0x5c40f5){return db[_0xa6d4('0x1f')][_0xa6d4('0x20')](_0x12c040[_0xa6d4('0x21')],{'raw':_0x12c040['options']?_0x12c040['options'][_0xa6d4('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12c040[_0xa6d4('0x23')]?_0x12c040[_0xa6d4('0x23')][_0xa6d4('0x24')]||null:null,'attributes':_0x12c040[_0xa6d4('0x23')]?_0x12c040[_0xa6d4('0x23')]['attributes']||null:null,'limit':_0x12c040[_0xa6d4('0x23')]?_0x12c040[_0xa6d4('0x23')][_0xa6d4('0x25')]||null:null})[_0xa6d4('0x26')](function(_0x27ecc6){logger[_0xa6d4('0x14')]('UpdateMailInteraction',_0x12c040);logger[_0xa6d4('0x16')]('UpdateMailInteraction',_0x12c040,JSON[_0xa6d4('0x18')](_0x27ecc6));_0x702c88(_0x27ecc6);})['catch'](function(_0x272759){logger[_0xa6d4('0x19')](_0xa6d4('0x1e'),_0x272759['message'],_0x12c040);_0x5c40f5(_0x39315a[_0xa6d4('0x19')](0x1f4,_0x272759[_0xa6d4('0x1b')]));});});};exports['AddTagsToMailInteraction']=function(_0x2c4dd2){return new Promise(function(_0x220860,_0x501bd1){return db['MailInteraction'][_0xa6d4('0x27')]({'where':_0x2c4dd2[_0xa6d4('0x23')]?_0x2c4dd2[_0xa6d4('0x23')]['where']||null:null})[_0xa6d4('0x26')](function(_0x2fce2d){if(_0x2fce2d){return _0x2fce2d[_0xa6d4('0x28')](_0x2c4dd2[_0xa6d4('0x21')]['ids'],_['omit'](_0x2c4dd2['body'],[_0xa6d4('0x29'),'id'])||{});}})[_0xa6d4('0x2a')](function(_0x409e84){logger[_0xa6d4('0x14')](_0xa6d4('0x2b'),_0x2c4dd2);logger[_0xa6d4('0x16')](_0xa6d4('0x2b'),_0x2c4dd2,JSON['stringify'](_0x409e84));_0x220860(_0x409e84);})['catch'](function(_0x17da28){logger[_0xa6d4('0x19')](_0xa6d4('0x2b'),_0x17da28[_0xa6d4('0x1b')],_0x2c4dd2);_0x501bd1(_this[_0xa6d4('0x19')](0x1f4,_0x17da28[_0xa6d4('0x1b')]));});});}; \ No newline at end of file +var _0x7633=['request\x20sent','debug','stringify','error','code','message','info','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','AddTagsToMailInteraction','find','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','defaults','./mailInteraction.socket','request','then','MailInteraction,\x20%s,\x20%s'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x7633,0x1c4));var _0x3763=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7633[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3763('0x0'));var util=require(_0x3763('0x1'));var moment=require(_0x3763('0x2'));var BPromise=require(_0x3763('0x3'));var rs=require(_0x3763('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3763('0x5'))['db'];var utils=require(_0x3763('0x6'));var logger=require('../../config/logger')(_0x3763('0x7'));var config=require(_0x3763('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3763('0x9')]({'port':0x232a});config[_0x3763('0xa')]=_[_0x3763('0xb')](config[_0x3763('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3763('0xa')]));require(_0x3763('0xc'))['register'](socket);function respondWithRpcPromise(_0x5c872d,_0x44dc63,_0x1a83bb){return new BPromise(function(_0x401909,_0x29ec1c){return client[_0x3763('0xd')](_0x5c872d,_0x1a83bb)[_0x3763('0xe')](function(_0x8fc2be){logger['info'](_0x3763('0xf'),_0x44dc63,_0x3763('0x10'));logger[_0x3763('0x11')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x44dc63,'request\x20sent',JSON[_0x3763('0x12')](_0x8fc2be));if(_0x8fc2be['error']){if(_0x8fc2be[_0x3763('0x13')][_0x3763('0x14')]===0x1f4){logger[_0x3763('0x13')](_0x3763('0xf'),_0x44dc63,_0x8fc2be[_0x3763('0x13')][_0x3763('0x15')]);return _0x29ec1c(_0x8fc2be[_0x3763('0x13')]['message']);}logger[_0x3763('0x13')](_0x3763('0xf'),_0x44dc63,_0x8fc2be[_0x3763('0x13')]['message']);return _0x401909(_0x8fc2be['error']['message']);}else{logger[_0x3763('0x16')](_0x3763('0xf'),_0x44dc63,_0x3763('0x10'));_0x401909(_0x8fc2be[_0x3763('0x17')][_0x3763('0x15')]);}})[_0x3763('0x18')](function(_0x461924){logger['error'](_0x3763('0xf'),_0x44dc63,_0x461924);_0x29ec1c(_0x461924);});});}exports[_0x3763('0x19')]=function(_0x9a8152){var _0x443422=this;return new Promise(function(_0x4aa7b0,_0x485836){return db[_0x3763('0x1a')][_0x3763('0x1b')](_0x9a8152[_0x3763('0x1c')],{'raw':_0x9a8152[_0x3763('0x1d')]?_0x9a8152['options'][_0x3763('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9a8152['options']?_0x9a8152[_0x3763('0x1d')][_0x3763('0x1f')]||null:null,'attributes':_0x9a8152['options']?_0x9a8152[_0x3763('0x1d')][_0x3763('0x20')]||null:null,'limit':_0x9a8152[_0x3763('0x1d')]?_0x9a8152[_0x3763('0x1d')][_0x3763('0x21')]||null:null})[_0x3763('0xe')](function(_0x6ebb90){logger['info']('UpdateMailInteraction',_0x9a8152);logger['debug'](_0x3763('0x19'),_0x9a8152,JSON[_0x3763('0x12')](_0x6ebb90));_0x4aa7b0(_0x6ebb90);})[_0x3763('0x18')](function(_0xe5beb5){logger[_0x3763('0x13')](_0x3763('0x19'),_0xe5beb5[_0x3763('0x15')],_0x9a8152);_0x485836(_0x443422[_0x3763('0x13')](0x1f4,_0xe5beb5[_0x3763('0x15')]));});});};exports[_0x3763('0x22')]=function(_0x339870){return new Promise(function(_0x136c67,_0x4f9a96){return db[_0x3763('0x1a')][_0x3763('0x23')]({'where':_0x339870[_0x3763('0x1d')]?_0x339870['options'][_0x3763('0x1f')]||null:null})[_0x3763('0xe')](function(_0x18ffb0){if(_0x18ffb0){return _0x18ffb0['addTags'](_0x339870[_0x3763('0x1c')][_0x3763('0x24')],_[_0x3763('0x25')](_0x339870[_0x3763('0x1c')],[_0x3763('0x24'),'id'])||{});}})['spread'](function(_0x482c63){logger[_0x3763('0x16')](_0x3763('0x26'),_0x339870);logger[_0x3763('0x11')](_0x3763('0x26'),_0x339870,JSON[_0x3763('0x12')](_0x482c63));_0x136c67(_0x482c63);})[_0x3763('0x18')](function(_0xf9d6af){logger[_0x3763('0x13')]('AddTags',_0xf9d6af[_0x3763('0x15')],_0x339870);_0x4f9a96(_this[_0x3763('0x13')](0x1f4,_0xf9d6af[_0x3763('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 969a50c..b995f12 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 _0x4399=['length','mailInteraction:','./mailInteraction.events','remove','emit','register'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4399,0x116));var _0x9439=function(_0x18e21f,_0x412867){_0x18e21f=_0x18e21f-0x0;var _0x54a6af=_0x4399[_0x18e21f];return _0x54a6af;};'use strict';var MailInteractionEvents=require(_0x9439('0x0'));var events=['save',_0x9439('0x1'),'update'];function createListener(_0x4984f5,_0x1f1597){return function(_0x5300f2){_0x1f1597[_0x9439('0x2')](_0x4984f5,_0x5300f2);};}function removeListener(_0x2ab7f9,_0xaa7ca2){return function(){MailInteractionEvents['removeListener'](_0x2ab7f9,_0xaa7ca2);};}exports[_0x9439('0x3')]=function(_0x35f7c3){for(var _0x414384=0x0,_0x545184=events[_0x9439('0x4')];_0x414384<_0x545184;_0x414384++){var _0xeb2c5d=events[_0x414384];var _0x2bc98b=createListener(_0x9439('0x5')+_0xeb2c5d,_0x35f7c3);MailInteractionEvents['on'](_0xeb2c5d,_0x2bc98b);}}; \ No newline at end of file +var _0x2cfa=['emit','removeListener','register','mailInteraction:','save','remove'];(function(_0x3d7cb0,_0x15551e){var _0x4c4a0a=function(_0x520055){while(--_0x520055){_0x3d7cb0['push'](_0x3d7cb0['shift']());}};_0x4c4a0a(++_0x15551e);}(_0x2cfa,0x1ae));var _0xa2cf=function(_0x421526,_0x368eca){_0x421526=_0x421526-0x0;var _0xc44c07=_0x2cfa[_0x421526];return _0xc44c07;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xa2cf('0x0'),_0xa2cf('0x1'),'update'];function createListener(_0x520edd,_0x3cb103){return function(_0xc23dd2){_0x3cb103[_0xa2cf('0x2')](_0x520edd,_0xc23dd2);};}function removeListener(_0x134dbd,_0x467f44){return function(){MailInteractionEvents[_0xa2cf('0x3')](_0x134dbd,_0x467f44);};}exports[_0xa2cf('0x4')]=function(_0x4a5bae){for(var _0x66e085=0x0,_0x4e5bb3=events['length'];_0x66e085<_0x4e5bb3;_0x66e085++){var _0x138310=events[_0x66e085];var _0x1072be=createListener(_0xa2cf('0x5')+_0x138310,_0x4a5bae);MailInteractionEvents['on'](_0x138310,_0x1072be);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 03deb62..cf0aab0 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 _0xd6d6=['mailmessage:create','update','put','/:id/accept','accept','reject','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','post','mail'];(function(_0x8198e8,_0xf96b77){var _0x49a75b=function(_0x5e571a){while(--_0x5e571a){_0x8198e8['push'](_0x8198e8['shift']());}};_0x49a75b(++_0xf96b77);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x4ee260,_0x20ce5f){_0x4ee260=_0x4ee260-0x0;var _0xed5b17=_0xd6d6[_0x4ee260];return _0xed5b17;};'use strict';var multer=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var path=require(_0x6d6d('0x2'));var timeout=require(_0x6d6d('0x3'));var express=require('express');var router=express[_0x6d6d('0x4')]();var auth=require(_0x6d6d('0x5'));var interaction=require(_0x6d6d('0x6'));var config=require(_0x6d6d('0x7'));var controller=require(_0x6d6d('0x8'));router[_0x6d6d('0x9')]('/',auth[_0x6d6d('0xa')](),controller['index']);router[_0x6d6d('0x9')](_0x6d6d('0xb'),auth[_0x6d6d('0xa')](),controller[_0x6d6d('0xc')]);router[_0x6d6d('0x9')](_0x6d6d('0xd'),auth[_0x6d6d('0xa')](),controller['show']);router['get'](_0x6d6d('0xe'),auth[_0x6d6d('0xa')](),controller[_0x6d6d('0xf')]);router[_0x6d6d('0x10')]('/',auth[_0x6d6d('0xa')](),interaction['tracked'](_0x6d6d('0x11'),_0x6d6d('0x12')),controller['create']);router['put'](_0x6d6d('0xd'),auth[_0x6d6d('0xa')](),controller[_0x6d6d('0x13')]);router[_0x6d6d('0x14')](_0x6d6d('0x15'),auth[_0x6d6d('0xa')](),controller[_0x6d6d('0x16')]);router[_0x6d6d('0x14')]('/:id/reject',auth[_0x6d6d('0xa')](),controller[_0x6d6d('0x17')]);router[_0x6d6d('0x18')](_0x6d6d('0xd'),auth[_0x6d6d('0xa')](),controller['destroy']);module[_0x6d6d('0x19')]=router; \ No newline at end of file +var _0xe14b=['create','put','/:id','update','/:id/accept','accept','/:id/reject','destroy','exports','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/download','tracked','mailmessage:create'];(function(_0x3c5044,_0x6cdb0c){var _0x34987b=function(_0x310641){while(--_0x310641){_0x3c5044['push'](_0x3c5044['shift']());}};_0x34987b(++_0x6cdb0c);}(_0xe14b,0x93));var _0xbe14=function(_0x10438b,_0x3fba11){_0x10438b=_0x10438b-0x0;var _0x1de09d=_0xe14b[_0x10438b];return _0x1de09d;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe14('0x4'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0xbe14('0x5')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0x7')]);router[_0xbe14('0x5')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0x5')](_0xbe14('0xb'),auth[_0xbe14('0x6')](),controller['download']);router['post']('/',auth[_0xbe14('0x6')](),interaction[_0xbe14('0xc')]('mail',_0xbe14('0xd')),controller[_0xbe14('0xe')]);router[_0xbe14('0xf')](_0xbe14('0x10'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x11')]);router[_0xbe14('0xf')](_0xbe14('0x12'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x13')]);router[_0xbe14('0xf')](_0xbe14('0x14'),auth[_0xbe14('0x6')](),controller['reject']);router['delete'](_0xbe14('0x10'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x15')]);module[_0xbe14('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 254f8cf..c487642 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 _0x3cd0=['medium','BOOLEAN','ENUM','out','STRING','long','DATE','INTEGER','sequelize','TEXT'];(function(_0x3d6ff9,_0x1dde4b){var _0x4cefa9=function(_0x1a75c2){while(--_0x1a75c2){_0x3d6ff9['push'](_0x3d6ff9['shift']());}};_0x4cefa9(++_0x1dde4b);}(_0x3cd0,0x8a));var _0x03cd=function(_0x4536a4,_0x55af7b){_0x4536a4=_0x4536a4-0x0;var _0x4fd1c1=_0x3cd0[_0x4536a4];return _0x4fd1c1;};'use strict';var Sequelize=require(_0x03cd('0x0'));var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0x03cd('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x03cd('0x1')](_0x03cd('0x2'))},'read':{'type':Sequelize[_0x03cd('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x03cd('0x4')]('in',_0x03cd('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x03cd('0x6')](0x1fe)},'from':{'type':Sequelize[_0x03cd('0x6')]},'to':{'type':Sequelize[_0x03cd('0x1')](_0x03cd('0x7'))},'cc':{'type':Sequelize[_0x03cd('0x1')]('long')},'bcc':{'type':Sequelize[_0x03cd('0x1')]('long')},'subject':{'type':Sequelize[_0x03cd('0x1')]},'sentAt':{'type':Sequelize[_0x03cd('0x8')]},'attach':{'type':Sequelize[_0x03cd('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x03cd('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x03cd('0x1')](_0x03cd('0x7'))},'originCc':{'type':Sequelize[_0x03cd('0x1')](_0x03cd('0x7'))}}; \ No newline at end of file +var _0xcdd2=['lodash','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','long','DATE','sequelize'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2cdd('0x0'));var _=require(_0x2cdd('0x1'));module[_0x2cdd('0x2')]={'body':{'type':Sequelize[_0x2cdd('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x2cdd('0x3')](_0x2cdd('0x4'))},'read':{'type':Sequelize[_0x2cdd('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2cdd('0x6')]('in','out'),'defaultValue':_0x2cdd('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2cdd('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x2cdd('0x3')](_0x2cdd('0x9'))},'cc':{'type':Sequelize[_0x2cdd('0x3')](_0x2cdd('0x9'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x2cdd('0xa')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x2cdd('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x2cdd('0xa')]},'originTo':{'type':Sequelize[_0x2cdd('0x3')](_0x2cdd('0x9'))},'originCc':{'type':Sequelize[_0x2cdd('0x3')](_0x2cdd('0x9'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index e434126..c591421 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(_0x12498b,_0x348475){var _0x2ecaf2=function(_0x5b279e){while(--_0x5b279e){_0x12498b['push'](_0x12498b['shift']());}};_0x2ecaf2(++_0x348475);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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(_0x352a14,_0x312d33){var _0x4b2b1c=function(_0x1d9c3b){while(--_0x1d9c3b){_0x352a14['push'](_0x352a14['shift']());}};_0x4b2b1c(++_0x312d33);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 a016ec3..a435a74 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 _0x9357=['update','emit','hook','exports','events','MailMessage','setMaxListeners'];(function(_0x55a4d0,_0x4307d8){var _0x1c93c6=function(_0x1e7b68){while(--_0x1e7b68){_0x55a4d0['push'](_0x55a4d0['shift']());}};_0x1c93c6(++_0x4307d8);}(_0x9357,0x1a8));var _0x7935=function(_0x332fe5,_0x81dc62){_0x332fe5=_0x332fe5-0x0;var _0x5a1219=_0x9357[_0x332fe5];return _0x5a1219;};'use strict';var EventEmitter=require(_0x7935('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x7935('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x7935('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7935('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4d7acb){return function(_0x159153,_0x4b95d0,_0x54ee7f){MailMessageEvents[_0x7935('0x4')](_0x4d7acb+':'+_0x159153['id'],_0x159153);MailMessageEvents['emit'](_0x4d7acb,_0x159153);_0x54ee7f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x7935('0x5')](e,emitEvent(event));}}module[_0x7935('0x6')]=MailMessageEvents; \ No newline at end of file +var _0x3b7d=['MailMessage','setMaxListeners','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x3b7d,0xa6));var _0xd3b7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3b7d[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0xd3b7('0x0'));var MailMessage=require(_0xd3b7('0x1'))['db'][_0xd3b7('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xd3b7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd3b7('0x4')};function emitEvent(_0x5cc42d){return function(_0x508524,_0x4c2337,_0x47d738){MailMessageEvents[_0xd3b7('0x5')](_0x5cc42d+':'+_0x508524['id'],_0x508524);MailMessageEvents[_0xd3b7('0x5')](_0x5cc42d,_0x508524);_0x47d738(null);};}for(var e in events){if(events[_0xd3b7('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 5a2ba3a..4375f66 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 _0x667f=['get','direction','toLowerCase','out','secret','isNil','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','html-to-text','path','rimraf','./mailMessage.attributes','exports','define','mail_messages','messageId','subject','body','plainBody','fromString','models'];(function(_0x574159,_0x952110){var _0x5dd226=function(_0x5a32f2){while(--_0x5a32f2){_0x574159['push'](_0x574159['shift']());}};_0x5dd226(++_0x952110);}(_0x667f,0xfe));var _0xf667=function(_0x3893db,_0x4fc2c4){_0x3893db=_0x3893db-0x0;var _0xafc026=_0x667f[_0x3893db];return _0xafc026;};'use strict';var _=require(_0xf667('0x0'));var util=require('util');var logger=require(_0xf667('0x1'))(_0xf667('0x2'));var moment=require(_0xf667('0x3'));var BPromise=require(_0xf667('0x4'));var rp=require('request-promise');var htmlToText=require(_0xf667('0x5'));var fs=require('fs');var path=require(_0xf667('0x6'));var rimraf=require(_0xf667('0x7'));var config=require('../../config/environment');var attributes=require(_0xf667('0x8'));module[_0xf667('0x9')]=function(_0x4aa1a1,_0x119f72){return _0x4aa1a1[_0xf667('0xa')]('MailMessage',attributes,{'tableName':_0xf667('0xb'),'paranoid':![],'indexes':[{'name':_0xf667('0xc'),'fields':[_0xf667('0xc')]},{'name':'fti_mail_messages','fields':['plainBody',_0xf667('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x28bf03,_0x49e9d2,_0x582617){if(_0x28bf03[_0xf667('0xe')]){_0x28bf03[_0xf667('0xf')]=htmlToText[_0xf667('0x10')](_0x28bf03[_0xf667('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x582617(null,_0x49e9d2);},'afterCreate':function(_0x556b93,_0x47341a,_0x1e3434){var _0x5e484b=_0x4aa1a1[_0xf667('0x11')];var _0x227ddd=_0x556b93[_0xf667('0x12')]({'plain':!![]});if(_0x227ddd[_0xf667('0x13')][_0xf667('0x14')]()==='in'||_0x227ddd[_0xf667('0x13')][_0xf667('0x14')]()===_0xf667('0x15')&&!_0x227ddd[_0xf667('0x16')]&&!_[_0xf667('0x17')](_0x227ddd['UserId'])){_0x5e484b[_0xf667('0x18')][_0xf667('0x19')]({'where':{'id':_0x227ddd[_0xf667('0x1a')]}})[_0xf667('0x1b')](function(_0x5ac166){if(_0x5ac166){_0x5ac166[_0xf667('0x1c')]({'lastMsgAt':_0x227ddd[_0xf667('0x1d')],'lastMsgDirection':_0x227ddd[_0xf667('0x13')][_0xf667('0x14')](),'lastMsgBody':_0x227ddd[_0xf667('0xe')]});}})[_0xf667('0x1e')](function(_0x18a21a){console[_0xf667('0x1f')](_0x18a21a);});}_0x1e3434();}},'charset':_0xf667('0x20'),'collate':_0xf667('0x21')});}; \ No newline at end of file +var _0x48f7=['body','fromString','get','toLowerCase','out','secret','isNil','UserId','MailInteraction','MailInteractionId','then','update','createdAt','direction','catch','error','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./mailMessage.attributes','exports','define','fti_mail_messages','plainBody','subject'];(function(_0x2e28c6,_0x109c13){var _0x5aa2fc=function(_0x56ac7c){while(--_0x56ac7c){_0x2e28c6['push'](_0x2e28c6['shift']());}};_0x5aa2fc(++_0x109c13);}(_0x48f7,0xb8));var _0x748f=function(_0x16f29a,_0x1c710b){_0x16f29a=_0x16f29a-0x0;var _0xc9420=_0x48f7[_0x16f29a];return _0xc9420;};'use strict';var _=require('lodash');var util=require(_0x748f('0x0'));var logger=require(_0x748f('0x1'))('api');var moment=require(_0x748f('0x2'));var BPromise=require('bluebird');var rp=require(_0x748f('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require(_0x748f('0x4'));var config=require(_0x748f('0x5'));var attributes=require(_0x748f('0x6'));module[_0x748f('0x7')]=function(_0x37e200,_0x10d35f){return _0x37e200[_0x748f('0x8')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x748f('0x9'),'fields':[_0x748f('0xa'),_0x748f('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xcb2fe6,_0x1be9ce,_0x241e52){if(_0xcb2fe6[_0x748f('0xc')]){_0xcb2fe6[_0x748f('0xa')]=htmlToText[_0x748f('0xd')](_0xcb2fe6['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x241e52(null,_0x1be9ce);},'afterCreate':function(_0x40a720,_0x3ff946,_0x5a485f){var _0x5472c4=_0x37e200['models'];var _0x399f41=_0x40a720[_0x748f('0xe')]({'plain':!![]});if(_0x399f41['direction'][_0x748f('0xf')]()==='in'||_0x399f41['direction'][_0x748f('0xf')]()===_0x748f('0x10')&&!_0x399f41[_0x748f('0x11')]&&!_[_0x748f('0x12')](_0x399f41[_0x748f('0x13')])){_0x5472c4[_0x748f('0x14')]['findOne']({'where':{'id':_0x399f41[_0x748f('0x15')]}})[_0x748f('0x16')](function(_0x5e2ae6){if(_0x5e2ae6){_0x5e2ae6[_0x748f('0x17')]({'lastMsgAt':_0x399f41[_0x748f('0x18')],'lastMsgDirection':_0x399f41[_0x748f('0x19')]['toLowerCase'](),'lastMsgBody':_0x399f41[_0x748f('0xc')]});}})[_0x748f('0x1a')](function(_0x1b7bf5){console[_0x748f('0x1b')](_0x1b7bf5);});}_0x5a485f();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index b868d46..7534257 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 _0xb82a=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','raw','then','CreateMailMessage','lodash','util'];(function(_0x90a3b,_0x433c4b){var _0x40673f=function(_0x43f0fb){while(--_0x43f0fb){_0x90a3b['push'](_0x90a3b['shift']());}};_0x40673f(++_0x433c4b);}(_0xb82a,0x82));var _0xab82=function(_0x384a21,_0x59c9bd){_0x384a21=_0x384a21-0x0;var _0x2aabba=_0xb82a[_0x384a21];return _0x2aabba;};'use strict';var _=require(_0xab82('0x0'));var util=require(_0xab82('0x1'));var moment=require(_0xab82('0x2'));var BPromise=require(_0xab82('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab82('0x4'))['db'];var utils=require(_0xab82('0x5'));var logger=require(_0xab82('0x6'))(_0xab82('0x7'));var config=require('../../config/environment');var jayson=require(_0xab82('0x8'));var client=jayson[_0xab82('0x9')][_0xab82('0xa')]({'port':0x232a});config[_0xab82('0xb')]=_[_0xab82('0xc')](config[_0xab82('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xab82('0xd'))(new Redis(config['redis']));require('./mailMessage.socket')[_0xab82('0xe')](socket);function respondWithRpcPromise(_0x13c9c7,_0x5b396a,_0x5d444a){return new BPromise(function(_0x24389d,_0x4d70fc){return client[_0xab82('0xf')](_0x13c9c7,_0x5d444a)['then'](function(_0x1ace8c){logger[_0xab82('0x10')](_0xab82('0x11'),_0x5b396a,_0xab82('0x12'));logger[_0xab82('0x13')](_0xab82('0x14'),_0x5b396a,_0xab82('0x12'),JSON[_0xab82('0x15')](_0x1ace8c));if(_0x1ace8c[_0xab82('0x16')]){if(_0x1ace8c[_0xab82('0x16')][_0xab82('0x17')]===0x1f4){logger[_0xab82('0x16')]('MailMessage,\x20%s,\x20%s',_0x5b396a,_0x1ace8c[_0xab82('0x16')][_0xab82('0x18')]);return _0x4d70fc(_0x1ace8c['error'][_0xab82('0x18')]);}logger[_0xab82('0x16')](_0xab82('0x11'),_0x5b396a,_0x1ace8c['error'][_0xab82('0x18')]);return _0x24389d(_0x1ace8c[_0xab82('0x16')][_0xab82('0x18')]);}else{logger[_0xab82('0x10')](_0xab82('0x11'),_0x5b396a,_0xab82('0x12'));_0x24389d(_0x1ace8c[_0xab82('0x19')]['message']);}})[_0xab82('0x1a')](function(_0x5b8910){logger[_0xab82('0x16')]('MailMessage,\x20%s,\x20%s',_0x5b396a,_0x5b8910);_0x4d70fc(_0x5b8910);});});}exports['CreateMailMessage']=function(_0x1ff7ac){var _0x1c031d=this;return new Promise(function(_0x16a1b1,_0xb8d172){return db['MailMessage'][_0xab82('0x1b')](_0x1ff7ac[_0xab82('0x1c')],{'raw':_0x1ff7ac['options']?_0x1ff7ac[_0xab82('0x1d')][_0xab82('0x1e')]===undefined?!![]:![]:!![]})[_0xab82('0x1f')](function(_0x4ad47b){logger['info'](_0xab82('0x20'),_0x1ff7ac);logger[_0xab82('0x13')](_0xab82('0x20'),_0x1ff7ac,JSON[_0xab82('0x15')](_0x4ad47b));_0x16a1b1(_0x4ad47b);})[_0xab82('0x1a')](function(_0xf3f895){logger['error'](_0xab82('0x20'),_0xf3f895[_0xab82('0x18')],_0x1ff7ac);_0xb8d172(_0x1c031d[_0xab82('0x16')](0x1f4,_0xf3f895[_0xab82('0x18')]));});});}; \ No newline at end of file +var _0xac5c=['jayson/promise','client','http','defaults','redis','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','CreateMailMessage','MailMessage','create','body','options','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x531811,_0x1565b4){var _0x48640a=function(_0x500218){while(--_0x500218){_0x531811['push'](_0x531811['shift']());}};_0x48640a(++_0x1565b4);}(_0xac5c,0x10f));var _0xcac5=function(_0x594873,_0x2a09c2){_0x594873=_0x594873-0x0;var _0x98f937=_0xac5c[_0x594873];return _0x98f937;};'use strict';var _=require(_0xcac5('0x0'));var util=require(_0xcac5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcac5('0x2'));var fs=require('fs');var Redis=require(_0xcac5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcac5('0x4'));var logger=require(_0xcac5('0x5'))(_0xcac5('0x6'));var config=require(_0xcac5('0x7'));var jayson=require(_0xcac5('0x8'));var client=jayson[_0xcac5('0x9')][_0xcac5('0xa')]({'port':0x232a});config['redis']=_[_0xcac5('0xb')](config[_0xcac5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xcac5('0xd'))(new Redis(config[_0xcac5('0xc')]));require(_0xcac5('0xe'))[_0xcac5('0xf')](socket);function respondWithRpcPromise(_0x2366e0,_0x4a3746,_0x33ceb1){return new BPromise(function(_0x18f165,_0x43c506){return client[_0xcac5('0x10')](_0x2366e0,_0x33ceb1)[_0xcac5('0x11')](function(_0x58a4c5){logger[_0xcac5('0x12')](_0xcac5('0x13'),_0x4a3746,'request\x20sent');logger[_0xcac5('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x4a3746,'request\x20sent',JSON[_0xcac5('0x15')](_0x58a4c5));if(_0x58a4c5[_0xcac5('0x16')]){if(_0x58a4c5[_0xcac5('0x16')][_0xcac5('0x17')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x4a3746,_0x58a4c5[_0xcac5('0x16')]['message']);return _0x43c506(_0x58a4c5[_0xcac5('0x16')][_0xcac5('0x18')]);}logger[_0xcac5('0x16')]('MailMessage,\x20%s,\x20%s',_0x4a3746,_0x58a4c5[_0xcac5('0x16')]['message']);return _0x18f165(_0x58a4c5[_0xcac5('0x16')][_0xcac5('0x18')]);}else{logger[_0xcac5('0x12')]('MailMessage,\x20%s,\x20%s',_0x4a3746,_0xcac5('0x19'));_0x18f165(_0x58a4c5['result']['message']);}})['catch'](function(_0x37136e){logger[_0xcac5('0x16')](_0xcac5('0x13'),_0x4a3746,_0x37136e);_0x43c506(_0x37136e);});});}exports[_0xcac5('0x1a')]=function(_0x3172a8){var _0x189537=this;return new Promise(function(_0xa54b04,_0x14313e){return db[_0xcac5('0x1b')][_0xcac5('0x1c')](_0x3172a8[_0xcac5('0x1d')],{'raw':_0x3172a8[_0xcac5('0x1e')]?_0x3172a8[_0xcac5('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3bed89){logger[_0xcac5('0x12')]('CreateMailMessage',_0x3172a8);logger[_0xcac5('0x14')](_0xcac5('0x1a'),_0x3172a8,JSON['stringify'](_0x3bed89));_0xa54b04(_0x3bed89);})['catch'](function(_0x4e9793){logger[_0xcac5('0x16')]('CreateMailMessage',_0x4e9793['message'],_0x3172a8);_0x14313e(_0x189537[_0xcac5('0x16')](0x1f4,_0x4e9793[_0xcac5('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index a244cab..a4bfdd7 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 _0xaf9b=['removeListener','register','mailMessage:','./mailMessage.events','remove','emit'];(function(_0xe93913,_0x2e8af9){var _0x14a312=function(_0x5ea9eb){while(--_0x5ea9eb){_0xe93913['push'](_0xe93913['shift']());}};_0x14a312(++_0x2e8af9);}(_0xaf9b,0x1d7));var _0xbaf9=function(_0x21274a,_0x2509c9){_0x21274a=_0x21274a-0x0;var _0x4d81df=_0xaf9b[_0x21274a];return _0x4d81df;};'use strict';var MailMessageEvents=require(_0xbaf9('0x0'));var events=['save',_0xbaf9('0x1'),'update'];function createListener(_0x1f2f6e,_0x353aad){return function(_0x46312a){_0x353aad[_0xbaf9('0x2')](_0x1f2f6e,_0x46312a);};}function removeListener(_0x512b7c,_0x64585f){return function(){MailMessageEvents[_0xbaf9('0x3')](_0x512b7c,_0x64585f);};}exports[_0xbaf9('0x4')]=function(_0x4b443e){for(var _0x40b949=0x0,_0x3578fd=events['length'];_0x40b949<_0x3578fd;_0x40b949++){var _0x4a8f38=events[_0x40b949];var _0x1168ed=createListener(_0xbaf9('0x5')+_0x4a8f38,_0x4b443e);MailMessageEvents['on'](_0x4a8f38,_0x1168ed);}}; \ No newline at end of file +var _0x6c6f=['length','mailMessage:','./mailMessage.events','save','remove','update','emit','removeListener'];(function(_0x555a94,_0x166ba1){var _0x44c599=function(_0x417950){while(--_0x417950){_0x555a94['push'](_0x555a94['shift']());}};_0x44c599(++_0x166ba1);}(_0x6c6f,0x17a));var _0xf6c6=function(_0x43cc30,_0x1d3af3){_0x43cc30=_0x43cc30-0x0;var _0x16055d=_0x6c6f[_0x43cc30];return _0x16055d;};'use strict';var MailMessageEvents=require(_0xf6c6('0x0'));var events=[_0xf6c6('0x1'),_0xf6c6('0x2'),_0xf6c6('0x3')];function createListener(_0x2f571d,_0x3c8fc3){return function(_0x332916){_0x3c8fc3[_0xf6c6('0x4')](_0x2f571d,_0x332916);};}function removeListener(_0x36fcd2,_0xa1183){return function(){MailMessageEvents[_0xf6c6('0x5')](_0x36fcd2,_0xa1183);};}exports['register']=function(_0x3b4e7b){for(var _0x4f8e34=0x0,_0x4c27f8=events[_0xf6c6('0x6')];_0x4f8e34<_0x4c27f8;_0x4f8e34++){var _0x5b34df=events[_0x4f8e34];var _0x308c42=createListener(_0xf6c6('0x7')+_0x5b34df,_0x3b4e7b);MailMessageEvents['on'](_0x5b34df,_0x308c42);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 357875d..b570a0a 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 _0xbca1=['create','post','/:id/teams','addTeams','/:id/users','addAgents','put','/:id','delete','destroy','removeTeams','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','show','getMembers','getTeams','getAgents'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xbca1,0x15b));var _0x1bca=function(_0x46daca,_0xacb2b3){_0x46daca=_0x46daca-0x0;var _0x4b1726=_0xbca1[_0x46daca];return _0x4b1726;};'use strict';var multer=require('multer');var util=require(_0x1bca('0x0'));var path=require(_0x1bca('0x1'));var timeout=require(_0x1bca('0x2'));var express=require(_0x1bca('0x3'));var router=express[_0x1bca('0x4')]();var auth=require(_0x1bca('0x5'));var interaction=require(_0x1bca('0x6'));var config=require(_0x1bca('0x7'));var controller=require(_0x1bca('0x8'));router[_0x1bca('0x9')]('/',auth[_0x1bca('0xa')](),controller[_0x1bca('0xb')]);router[_0x1bca('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x1bca('0xc')]);router[_0x1bca('0x9')]('/:id',auth[_0x1bca('0xa')](),controller[_0x1bca('0xd')]);router[_0x1bca('0x9')]('/:id/members',auth[_0x1bca('0xa')](),controller[_0x1bca('0xe')]);router[_0x1bca('0x9')]('/:id/teams',auth[_0x1bca('0xa')](),controller[_0x1bca('0xf')]);router[_0x1bca('0x9')]('/:id/users',auth[_0x1bca('0xa')](),controller[_0x1bca('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1bca('0x11')]);router[_0x1bca('0x12')](_0x1bca('0x13'),auth[_0x1bca('0xa')](),controller[_0x1bca('0x14')]);router[_0x1bca('0x12')](_0x1bca('0x15'),auth[_0x1bca('0xa')](),controller[_0x1bca('0x16')]);router[_0x1bca('0x17')](_0x1bca('0x18'),auth['isAuthenticated'](),controller['update']);router[_0x1bca('0x19')](_0x1bca('0x18'),auth['isAuthenticated'](),controller[_0x1bca('0x1a')]);router[_0x1bca('0x19')](_0x1bca('0x13'),auth[_0x1bca('0xa')](),controller[_0x1bca('0x1b')]);router[_0x1bca('0x19')](_0x1bca('0x15'),auth[_0x1bca('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xbbc9=['/:id','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','/describe','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','/:id/users','put'];(function(_0x19c0e4,_0xd857a3){var _0x241b40=function(_0x5c2c2a){while(--_0x5c2c2a){_0x19c0e4['push'](_0x19c0e4['shift']());}};_0x241b40(++_0xd857a3);}(_0xbbc9,0x114));var _0x9bbc=function(_0x4280b5,_0x25e40d){_0x4280b5=_0x4280b5-0x0;var _0x5aa505=_0xbbc9[_0x4280b5];return _0x5aa505;};'use strict';var multer=require(_0x9bbc('0x0'));var util=require(_0x9bbc('0x1'));var path=require(_0x9bbc('0x2'));var timeout=require(_0x9bbc('0x3'));var express=require(_0x9bbc('0x4'));var router=express[_0x9bbc('0x5')]();var auth=require(_0x9bbc('0x6'));var interaction=require(_0x9bbc('0x7'));var config=require(_0x9bbc('0x8'));var controller=require(_0x9bbc('0x9'));router[_0x9bbc('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9bbc('0xa')](_0x9bbc('0xb'),auth[_0x9bbc('0xc')](),controller[_0x9bbc('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9bbc('0xe')]);router[_0x9bbc('0xa')](_0x9bbc('0xf'),auth[_0x9bbc('0xc')](),controller[_0x9bbc('0x10')]);router['get'](_0x9bbc('0x11'),auth[_0x9bbc('0xc')](),controller[_0x9bbc('0x12')]);router[_0x9bbc('0xa')]('/:id/users',auth[_0x9bbc('0xc')](),controller[_0x9bbc('0x13')]);router[_0x9bbc('0x14')]('/',auth[_0x9bbc('0xc')](),controller[_0x9bbc('0x15')]);router[_0x9bbc('0x14')](_0x9bbc('0x11'),auth[_0x9bbc('0xc')](),controller['addTeams']);router[_0x9bbc('0x14')](_0x9bbc('0x16'),auth[_0x9bbc('0xc')](),controller['addAgents']);router[_0x9bbc('0x17')](_0x9bbc('0x18'),auth[_0x9bbc('0xc')](),controller[_0x9bbc('0x19')]);router[_0x9bbc('0x1a')](_0x9bbc('0x18'),auth[_0x9bbc('0xc')](),controller[_0x9bbc('0x1b')]);router['delete'](_0x9bbc('0x11'),auth[_0x9bbc('0xc')](),controller[_0x9bbc('0x1c')]);router[_0x9bbc('0x1a')]('/:id/users',auth[_0x9bbc('0xc')](),controller['removeAgents']);module[_0x9bbc('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 b7e972a..d183286 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 _0xaebd=['STRING','name','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x66b9f9,_0x32d667){var _0x241ce9=function(_0x2b3426){while(--_0x2b3426){_0x66b9f9['push'](_0x66b9f9['shift']());}};_0x241ce9(++_0x32d667);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x4ef0dd,_0x19e80b){_0x4ef0dd=_0x4ef0dd-0x0;var _0x260a7c=_0xaebd[_0x4ef0dd];return _0x260a7c;};'use strict';var Sequelize=require(_0xdaeb('0x0'));module['exports']={'name':{'type':Sequelize[_0xdaeb('0x1')],'unique':_0xdaeb('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdaeb('0x1')]},'timeout':{'type':Sequelize[_0xdaeb('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdaeb('0x4')]('rrmemory',_0xdaeb('0x5'),_0xdaeb('0x6'))}}; \ No newline at end of file +var _0xae41=['roundrobin','sequelize','exports','STRING','name','rrmemory'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xae41,0xaf));var _0x1ae4=function(_0x521ea9,_0x25a2d0){_0x521ea9=_0x521ea9-0x0;var _0x52bae4=_0xae41[_0x521ea9];return _0x52bae4;};'use strict';var Sequelize=require(_0x1ae4('0x0'));module[_0x1ae4('0x1')]={'name':{'type':Sequelize[_0x1ae4('0x2')],'unique':_0x1ae4('0x3'),'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'](_0x1ae4('0x4'),'beepall',_0x1ae4('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 3f8637e..e3e7683 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 _0x7fce=['hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','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','describe','getMembers','UserMailQueue','map','User','UserId','mailPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','removeAgents','forEach','addAgents','omit','spread','isArray','userMailQueue:remove','getAgents','findOne','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','./mailQueue.socket','register','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','MailQueues','UserProfileResource','end','error','stack','name','send','index','MailQueue','fieldName','query','keys','filters','intersection','model','attributes','fields'];(function(_0x329559,_0x619f51){var _0xdfe142=function(_0x491064){while(--_0x491064){_0x329559['push'](_0x329559['shift']());}};_0xdfe142(++_0x619f51);}(_0x7fce,0xdc));var _0xe7fc=function(_0x54b57d,_0x45e9f8){_0x54b57d=_0x54b57d-0x0;var _0x57a92f=_0x7fce[_0x54b57d];return _0x57a92f;};'use strict';var pdf=require(_0xe7fc('0x0'));var emlformat=require(_0xe7fc('0x1'));var rimraf=require(_0xe7fc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe7fc('0x3'));var rp=require('request-promise');var moment=require(_0xe7fc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe7fc('0x5'));var util=require(_0xe7fc('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe7fc('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe7fc('0x8'));var squel=require(_0xe7fc('0x9'));var crypto=require(_0xe7fc('0xa'));var jsforce=require(_0xe7fc('0xb'));var deskjs=require(_0xe7fc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe7fc('0xd'));var Papa=require('papaparse');var Redis=require(_0xe7fc('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe7fc('0xf'));var as=require(_0xe7fc('0x10'));var hardwareService=require(_0xe7fc('0x11'));var logger=require(_0xe7fc('0x12'))('api');var utils=require(_0xe7fc('0x13'));var config=require(_0xe7fc('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe7fc('0x15')]=_['defaults'](config[_0xe7fc('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe7fc('0x15')]));require(_0xe7fc('0x16'))[_0xe7fc('0x17')](socket);function respondWithStatusCode(_0x307f58,_0x293cf4){_0x293cf4=_0x293cf4||0xcc;return function(_0x53e1cd){if(_0x53e1cd){return _0x307f58[_0xe7fc('0x18')](_0x293cf4);}return _0x307f58['status'](_0x293cf4)['end']();};}function respondWithResult(_0x1302e5,_0x249725){_0x249725=_0x249725||0xc8;return function(_0x1683c6){if(_0x1683c6){return _0x1302e5[_0xe7fc('0x19')](_0x249725)['json'](_0x1683c6);}};}function respondWithFilteredResult(_0x552429,_0x4e549a){return function(_0x4aa4f0){if(_0x4aa4f0){var _0x52902f=_0x4aa4f0[_0xe7fc('0x1a')],_0x490a99=_0x4e549a[_0xe7fc('0x1b')],_0x14515d=_0x4e549a[_0xe7fc('0x1b')]+_0x4e549a[_0xe7fc('0x1c')],_0x4a59d5;if(_0x14515d>=_0x52902f){_0x14515d=_0x52902f;_0x4a59d5=0xc8;}else{_0x4a59d5=0xce;}_0x552429[_0xe7fc('0x19')](_0x4a59d5);return _0x552429[_0xe7fc('0x1d')](_0xe7fc('0x1e'),_0x490a99+'-'+_0x14515d+'/'+_0x52902f)[_0xe7fc('0x1f')](_0x4aa4f0);}return null;};}function patchUpdates(_0x597fde){return function(_0x39c75a){try{jsonpatch[_0xe7fc('0x20')](_0x39c75a,_0x597fde,!![]);}catch(_0x5acd43){return BPromise['reject'](_0x5acd43);}return _0x39c75a[_0xe7fc('0x21')]();};}function saveUpdates(_0x3c31e7,_0x338613){return function(_0xfa2986){if(_0xfa2986){return _0xfa2986[_0xe7fc('0x22')](_0x3c31e7)[_0xe7fc('0x23')](function(_0x3f850f){return _0x3f850f;});}return null;};}function removeEntity(_0x1731b6,_0xb00cb9){return function(_0x3e7e7e){if(_0x3e7e7e){return _0x3e7e7e[_0xe7fc('0x24')]()[_0xe7fc('0x23')](function(){var _0x12ebdd=_0x3e7e7e['get']({'plain':!![]});var _0x2d9e77=_0xe7fc('0x25');return db[_0xe7fc('0x26')][_0xe7fc('0x24')]({'where':{'type':_0x2d9e77,'resourceId':_0x12ebdd['id']}})[_0xe7fc('0x23')](function(){return _0x3e7e7e;});})[_0xe7fc('0x23')](function(){_0x1731b6['status'](0xcc)[_0xe7fc('0x27')]();});}};}function handleEntityNotFound(_0x1ceedc,_0x3966ac){return function(_0x3e3798){if(!_0x3e3798){_0x1ceedc[_0xe7fc('0x18')](0x194);}return _0x3e3798;};}function handleError(_0x4416b5,_0x383ca6){_0x383ca6=_0x383ca6||0x1f4;return function(_0x4da084){logger[_0xe7fc('0x28')](_0x4da084[_0xe7fc('0x29')]);if(_0x4da084['name']){delete _0x4da084[_0xe7fc('0x2a')];}_0x4416b5['status'](_0x383ca6)[_0xe7fc('0x2b')](_0x4da084);};}exports[_0xe7fc('0x2c')]=function(_0x547219,_0x2b3830){var _0x4fe326={},_0x245965={},_0x32c422={'count':0x0,'rows':[]};var _0x40c297=_['map'](db[_0xe7fc('0x2d')]['rawAttributes'],function(_0x214f9c){return{'name':_0x214f9c[_0xe7fc('0x2e')],'type':_0x214f9c['type']['key']};});_0x245965['model']=_['map'](_0x40c297,_0xe7fc('0x2a'));_0x245965[_0xe7fc('0x2f')]=_[_0xe7fc('0x30')](_0x547219[_0xe7fc('0x2f')]);_0x245965[_0xe7fc('0x31')]=_[_0xe7fc('0x32')](_0x245965[_0xe7fc('0x33')],_0x245965[_0xe7fc('0x2f')]);_0x4fe326[_0xe7fc('0x34')]=_[_0xe7fc('0x32')](_0x245965['model'],qs[_0xe7fc('0x35')](_0x547219[_0xe7fc('0x2f')][_0xe7fc('0x35')]));_0x4fe326[_0xe7fc('0x34')]=_0x4fe326[_0xe7fc('0x34')]['length']?_0x4fe326[_0xe7fc('0x34')]:_0x245965[_0xe7fc('0x33')];if(!_0x547219[_0xe7fc('0x2f')][_0xe7fc('0x36')](_0xe7fc('0x37'))){_0x4fe326[_0xe7fc('0x1c')]=qs[_0xe7fc('0x1c')](_0x547219[_0xe7fc('0x2f')][_0xe7fc('0x1c')]);_0x4fe326[_0xe7fc('0x1b')]=qs[_0xe7fc('0x1b')](_0x547219[_0xe7fc('0x2f')]['offset']);}_0x4fe326[_0xe7fc('0x38')]=qs[_0xe7fc('0x39')](_0x547219[_0xe7fc('0x2f')][_0xe7fc('0x39')]);_0x4fe326[_0xe7fc('0x3a')]=qs['filters'](_[_0xe7fc('0x3b')](_0x547219[_0xe7fc('0x2f')],_0x245965[_0xe7fc('0x31')]),_0x40c297);if(_0x547219[_0xe7fc('0x2f')][_0xe7fc('0x3c')]){_0x4fe326[_0xe7fc('0x3a')]=_['merge'](_0x4fe326['where'],{'$or':_['map'](_0x40c297,function(_0x530e08){if(_0x530e08['type']!==_0xe7fc('0x3d')){var _0x2736a5={};_0x2736a5[_0x530e08['name']]={'$like':'%'+_0x547219[_0xe7fc('0x2f')]['filter']+'%'};return _0x2736a5;}})});}_0x4fe326=_[_0xe7fc('0x3e')]({},_0x4fe326,_0x547219[_0xe7fc('0x3f')]);var _0x34f15e={'where':_0x4fe326[_0xe7fc('0x3a')]};return db[_0xe7fc('0x2d')][_0xe7fc('0x1a')](_0x34f15e)['then'](function(_0x249b4c){_0x32c422['count']=_0x249b4c;if(_0x547219[_0xe7fc('0x2f')][_0xe7fc('0x40')]){_0x4fe326['include']=[{'all':!![]}];}return db[_0xe7fc('0x2d')][_0xe7fc('0x41')](_0x4fe326);})[_0xe7fc('0x23')](function(_0x87093a){_0x32c422[_0xe7fc('0x42')]=_0x87093a;return _0x32c422;})[_0xe7fc('0x23')](respondWithFilteredResult(_0x2b3830,_0x4fe326))[_0xe7fc('0x43')](handleError(_0x2b3830,null));};exports[_0xe7fc('0x44')]=function(_0x31473a,_0x118e94){var _0x1438b8={'raw':!![],'where':{'id':_0x31473a[_0xe7fc('0x45')]['id']}},_0x20332e={};_0x20332e[_0xe7fc('0x33')]=_[_0xe7fc('0x30')](db[_0xe7fc('0x2d')][_0xe7fc('0x46')]);_0x20332e['query']=_[_0xe7fc('0x30')](_0x31473a[_0xe7fc('0x2f')]);_0x20332e[_0xe7fc('0x31')]=_['intersection'](_0x20332e[_0xe7fc('0x33')],_0x20332e[_0xe7fc('0x2f')]);_0x1438b8[_0xe7fc('0x34')]=_[_0xe7fc('0x32')](_0x20332e[_0xe7fc('0x33')],qs['fields'](_0x31473a['query'][_0xe7fc('0x35')]));_0x1438b8[_0xe7fc('0x34')]=_0x1438b8[_0xe7fc('0x34')][_0xe7fc('0x47')]?_0x1438b8[_0xe7fc('0x34')]:_0x20332e['model'];if(_0x31473a[_0xe7fc('0x2f')][_0xe7fc('0x40')]){_0x1438b8[_0xe7fc('0x48')]=[{'all':!![]}];}_0x1438b8=_[_0xe7fc('0x3e')]({},_0x1438b8,_0x31473a[_0xe7fc('0x3f')]);return db[_0xe7fc('0x2d')][_0xe7fc('0x49')](_0x1438b8)[_0xe7fc('0x23')](handleEntityNotFound(_0x118e94,null))[_0xe7fc('0x23')](respondWithResult(_0x118e94,null))[_0xe7fc('0x43')](handleError(_0x118e94,null));};exports['create']=function(_0x3e61c3,_0x582133){return db[_0xe7fc('0x2d')][_0xe7fc('0x4a')](_0x3e61c3[_0xe7fc('0x4b')],{})[_0xe7fc('0x23')](function(_0x33fa72){var _0x213781=_0x3e61c3[_0xe7fc('0x4c')][_0xe7fc('0x4d')]({'plain':!![]});if(!_0x213781)throw new Error(_0xe7fc('0x4e'));if(_0x213781['role']===_0xe7fc('0x4c')){var _0xf553c1=_0x33fa72[_0xe7fc('0x4d')]({'plain':!![]});var _0x2e7748=_0xe7fc('0x25');return db[_0xe7fc('0x4f')]['find']({'where':{'name':_0x2e7748,'userProfileId':_0x213781[_0xe7fc('0x50')]},'raw':!![]})[_0xe7fc('0x23')](function(_0x29af8c){if(_0x29af8c&&_0x29af8c[_0xe7fc('0x51')]===0x0){return db[_0xe7fc('0x26')][_0xe7fc('0x4a')]({'name':_0xf553c1['name'],'resourceId':_0xf553c1['id'],'type':_0x29af8c['name'],'sectionId':_0x29af8c['id']},{})[_0xe7fc('0x23')](function(){return _0x33fa72;});}else{return _0x33fa72;}})['catch'](function(_0x557355){logger[_0xe7fc('0x28')](_0xe7fc('0x52'),_0x557355);throw _0x557355;});}return _0x33fa72;})[_0xe7fc('0x23')](respondWithResult(_0x582133,0xc9))[_0xe7fc('0x43')](handleError(_0x582133,null));};exports[_0xe7fc('0x22')]=function(_0x1fbd9d,_0x3fab1f){if(_0x1fbd9d[_0xe7fc('0x4b')]['id']){delete _0x1fbd9d[_0xe7fc('0x4b')]['id'];}return db[_0xe7fc('0x2d')][_0xe7fc('0x49')]({'where':{'id':_0x1fbd9d['params']['id']}})[_0xe7fc('0x23')](handleEntityNotFound(_0x3fab1f,null))['then'](saveUpdates(_0x1fbd9d[_0xe7fc('0x4b')],null))[_0xe7fc('0x23')](respondWithResult(_0x3fab1f,null))[_0xe7fc('0x43')](handleError(_0x3fab1f,null));};exports[_0xe7fc('0x24')]=function(_0x11d6a1,_0x3d14de){return db[_0xe7fc('0x2d')][_0xe7fc('0x49')]({'where':{'id':_0x11d6a1['params']['id']}})[_0xe7fc('0x23')](handleEntityNotFound(_0x3d14de,null))[_0xe7fc('0x23')](removeEntity(_0x3d14de,null))['catch'](handleError(_0x3d14de,null));};exports[_0xe7fc('0x53')]=function(_0xf281c,_0xc24f66){return db[_0xe7fc('0x2d')][_0xe7fc('0x53')]()['then'](respondWithResult(_0xc24f66,null))[_0xe7fc('0x43')](handleError(_0xc24f66,null));};exports[_0xe7fc('0x54')]=function(_0x3f1fb1,_0x2fa3d5,_0x50f2f7){var _0xd3ff41={'raw':!![],'where':{}},_0x39223b={},_0x144a6e;return db['MailQueue']['findOne']({'where':{'id':_0x3f1fb1[_0xe7fc('0x45')]['id']}})[_0xe7fc('0x23')](handleEntityNotFound(_0x2fa3d5,null))[_0xe7fc('0x23')](function(_0x147fb0){if(_0x147fb0){_0x144a6e=_0x147fb0[_0xe7fc('0x4d')]({'plain':!![]});_0x39223b[_0xe7fc('0x33')]=_['keys'](db[_0xe7fc('0x55')][_0xe7fc('0x46')]);_0x39223b[_0xe7fc('0x2f')]=_[_0xe7fc('0x30')](_0x3f1fb1['query']);_0x39223b[_0xe7fc('0x31')]=_['intersection'](_0x39223b['model'],_0x39223b['query']);_0xd3ff41[_0xe7fc('0x34')]=_[_0xe7fc('0x32')](_0x39223b[_0xe7fc('0x33')],qs['fields'](_0x3f1fb1['query']['fields']));_0xd3ff41['attributes']=_0xd3ff41[_0xe7fc('0x34')][_0xe7fc('0x47')]?_0xd3ff41[_0xe7fc('0x34')]:_0x39223b[_0xe7fc('0x33')];if(!_0x3f1fb1[_0xe7fc('0x2f')][_0xe7fc('0x36')](_0xe7fc('0x37'))){_0xd3ff41[_0xe7fc('0x1c')]=qs[_0xe7fc('0x1c')](_0x3f1fb1['query'][_0xe7fc('0x1c')]);_0xd3ff41['offset']=qs[_0xe7fc('0x1b')](_0x3f1fb1[_0xe7fc('0x2f')][_0xe7fc('0x1b')]);}_0xd3ff41['order']=qs[_0xe7fc('0x39')](_0x3f1fb1[_0xe7fc('0x2f')]['sort']);_0xd3ff41[_0xe7fc('0x3a')]=qs[_0xe7fc('0x31')](_['pick'](_0x3f1fb1[_0xe7fc('0x2f')],_0x39223b[_0xe7fc('0x31')]));_0xd3ff41[_0xe7fc('0x3a')]['MailQueueId']=_0x147fb0['id'];if(_0x3f1fb1[_0xe7fc('0x2f')]['filter']){_0xd3ff41['where']=_[_0xe7fc('0x3e')](_0xd3ff41[_0xe7fc('0x3a')],{'$or':_[_0xe7fc('0x56')](_0xd3ff41[_0xe7fc('0x34')],function(_0xeec376){var _0x477664={};_0x477664[_0xeec376]={'$like':'%'+_0x3f1fb1['query'][_0xe7fc('0x3c')]+'%'};return _0x477664;})});}_0xd3ff41=_[_0xe7fc('0x3e')]({},_0xd3ff41,_0x3f1fb1[_0xe7fc('0x3f')]);return db[_0xe7fc('0x55')]['findAll'](_0xd3ff41);}})[_0xe7fc('0x23')](function(_0x21d85d){if(_0x21d85d){return db[_0xe7fc('0x57')]['findAndCountAll']({'where':{'id':_[_0xe7fc('0x56')](_0x21d85d,_0xe7fc('0x58')),'role':'agent'},'attributes':['id',_0xe7fc('0x2a'),_0xe7fc('0x59'),_0xe7fc('0x5a'),_0xe7fc('0x5b')]});}})[_0xe7fc('0x23')](function(_0x42d013){if(_0x42d013){return{'count':_0x42d013[_0xe7fc('0x1a')],'rows':_[_0xe7fc('0x56')](_0x42d013[_0xe7fc('0x42')],function(_0x54ac8f){return{'membername':_0x54ac8f['name'],'UserId':_0x54ac8f['id'],'queue_name':_0x144a6e['name'],'MailQueueId':_0x144a6e['id'],'interface':util[_0xe7fc('0x5c')](_0xe7fc('0x5d'),'SIP',_0x54ac8f[_0xe7fc('0x2a')]),'penalty':0x0,'paused':_0x54ac8f['mailPause'],'createdAt':_0x54ac8f[_0xe7fc('0x5b')],'updatedAt':_0x54ac8f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe7fc('0x23')](respondWithFilteredResult(_0x2fa3d5,_0xd3ff41))[_0xe7fc('0x43')](handleError(_0x2fa3d5,null));};exports[_0xe7fc('0x5e')]=function(_0x13cf1d,_0x15b4dc,_0xb240bd){var _0x42e033={};var _0x2d074a={};var _0x2e6a5b;var _0xa5e54d;return db[_0xe7fc('0x2d')]['findOne']({'where':{'id':_0x13cf1d[_0xe7fc('0x45')]['id']}})[_0xe7fc('0x23')](handleEntityNotFound(_0x15b4dc,null))[_0xe7fc('0x23')](function(_0x3b8aa0){if(_0x3b8aa0){_0x2e6a5b=_0x3b8aa0;_0x2d074a['model']=_[_0xe7fc('0x30')](db[_0xe7fc('0x5f')][_0xe7fc('0x46')]);_0x2d074a['query']=_[_0xe7fc('0x30')](_0x13cf1d[_0xe7fc('0x2f')]);_0x2d074a[_0xe7fc('0x31')]=_[_0xe7fc('0x32')](_0x2d074a[_0xe7fc('0x33')],_0x2d074a[_0xe7fc('0x2f')]);_0x42e033[_0xe7fc('0x34')]=_[_0xe7fc('0x32')](_0x2d074a['model'],qs[_0xe7fc('0x35')](_0x13cf1d['query'][_0xe7fc('0x35')]));_0x42e033[_0xe7fc('0x34')]=_0x42e033[_0xe7fc('0x34')]['length']?_0x42e033[_0xe7fc('0x34')]:_0x2d074a[_0xe7fc('0x33')];_0x42e033[_0xe7fc('0x38')]=qs['sort'](_0x13cf1d[_0xe7fc('0x2f')]['sort']);_0x42e033[_0xe7fc('0x3a')]=qs[_0xe7fc('0x31')](_[_0xe7fc('0x3b')](_0x13cf1d[_0xe7fc('0x2f')],_0x2d074a[_0xe7fc('0x31')]));if(_0x13cf1d['query'][_0xe7fc('0x3c')]){_0x42e033[_0xe7fc('0x3a')]=_[_0xe7fc('0x3e')](_0x42e033['where'],{'$or':_[_0xe7fc('0x56')](_0x42e033['attributes'],function(_0xe32dec){var _0x5256ad={};_0x5256ad[_0xe32dec]={'$like':'%'+_0x13cf1d['query'][_0xe7fc('0x3c')]+'%'};return _0x5256ad;})});}_0x42e033=_[_0xe7fc('0x3e')]({},_0x42e033,_0x13cf1d[_0xe7fc('0x3f')]);return _0x2e6a5b[_0xe7fc('0x5e')](_0x42e033);}})[_0xe7fc('0x23')](function(_0x472bfc){if(_0x472bfc){_0xa5e54d=_0x472bfc[_0xe7fc('0x47')];if(!_0x13cf1d[_0xe7fc('0x2f')][_0xe7fc('0x36')](_0xe7fc('0x37'))){_0x42e033[_0xe7fc('0x1c')]=qs[_0xe7fc('0x1c')](_0x13cf1d[_0xe7fc('0x2f')]['limit']);_0x42e033[_0xe7fc('0x1b')]=qs['offset'](_0x13cf1d[_0xe7fc('0x2f')][_0xe7fc('0x1b')]);}return _0x2e6a5b['getTeams'](_0x42e033);}})['then'](function(_0x472197){if(_0x472197){return _0x472197?{'count':_0xa5e54d,'rows':_0x472197}:null;}})['then'](respondWithResult(_0x15b4dc,null))[_0xe7fc('0x43')](handleError(_0x15b4dc,null));};exports[_0xe7fc('0x60')]=function(_0x2fd0f6,_0x75edb2,_0x1de4c4){var _0x355bca=_0x2fd0f6[_0xe7fc('0x4b')][_0xe7fc('0x61')];return db[_0xe7fc('0x5f')][_0xe7fc('0x41')]({'where':{'id':_0x355bca},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe7fc('0x62'),'attributes':['id',_0xe7fc('0x2a'),'online',_0xe7fc('0x63'),_0xe7fc('0x64')],'raw':!![]}]})[_0xe7fc('0x23')](function(_0x42b4f1){if(_0x42b4f1){var _0x4113a3=_[_0xe7fc('0x65')](_0x42b4f1,function(_0x30701a){var _0x2ee43a=_0x30701a[_0xe7fc('0x4d')]({'plain':!![]});return _0x2ee43a[_0xe7fc('0x62')];});return db[_0xe7fc('0x2d')][_0xe7fc('0x49')]({'where':{'id':_0x2fd0f6['params']['id']}})[_0xe7fc('0x23')](function(_0x870345){return db[_0xe7fc('0x66')]['transaction'](function(_0x5b3aeb){return _0x870345[_0xe7fc('0x60')](_0x355bca,{'transaction':_0x5b3aeb})[_0xe7fc('0x23')](function(){return BPromise[_0xe7fc('0x67')](_0x4113a3,function(_0x575d99){return db[_0xe7fc('0x55')][_0xe7fc('0x68')]({'where':{'UserId':_0x575d99['id'],'MailQueueId':_0x2fd0f6['params']['id']},'transaction':_0x5b3aeb});});})[_0xe7fc('0x23')](function(){_0x4113a3['forEach'](function(_0x4284f5){socket[_0xe7fc('0x69')](_0xe7fc('0x6a'),{'UserId':_0x4284f5['id'],'MailQueueId':_0x870345['id']});});});});});}})[_0xe7fc('0x23')](respondWithStatusCode(_0x75edb2,null))[_0xe7fc('0x43')](handleError(_0x75edb2,null));};exports[_0xe7fc('0x6b')]=function(_0xa333a7,_0x24f920,_0x466296){return db[_0xe7fc('0x5f')][_0xe7fc('0x41')]({'where':{'id':_0xa333a7['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xe7fc('0x57')],'as':_0xe7fc('0x62'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x24f920,null))[_0xe7fc('0x23')](function(_0x17af0a){var _0x41e57d=_[_0xe7fc('0x56')](_0x17af0a,'id');var _0x110463=[];var _0x1034fe=[];var _0x3416d6=squel[_0xe7fc('0x6c')]();_0x3416d6[_0xe7fc('0x6d')](_0xe7fc('0x6e'))[_0xe7fc('0x6f')]('team_has_mail_queues','tq')[_0xe7fc('0x70')](_0xe7fc('0x71'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe7fc('0x3a')]('MailQueueId\x20=\x20?',_0xa333a7[_0xe7fc('0x45')]['id']);for(var _0x482951=0x0;_0x482951<_0x17af0a['length'];_0x482951+=0x1){let _0x36237b=_0x17af0a[_0x482951];for(var _0x53f65a=0x0;_0x53f65a<_0x36237b[_0xe7fc('0x62')]['length'];_0x53f65a+=0x1){let _0x5b96c9=_0x36237b[_0xe7fc('0x62')][_0x53f65a];var _0x4fd512=_0x3416d6[_0xe7fc('0x72')]();_0x4fd512[_0xe7fc('0x3a')](_0xe7fc('0x73'),_0x5b96c9['id']);_0x1034fe[_0xe7fc('0x74')](db[_0xe7fc('0x66')]['query'](_0x4fd512[_0xe7fc('0x75')](),{'type':db[_0xe7fc('0x66')][_0xe7fc('0x76')][_0xe7fc('0x77')]})[_0xe7fc('0x23')](function(_0x5d2162){if(_0x5d2162[_0xe7fc('0x47')]===0x1){return _0x5b96c9['id'];}else{var _0x942837=_[_0xe7fc('0x78')](_[_0xe7fc('0x56')](_0x5d2162,_0xe7fc('0x79')),function(_0xcec455){return _[_0xe7fc('0x7a')](_0x41e57d,_0xcec455);});if(_0x942837){return _0x5b96c9['id'];}}}));}}return BPromise[_0xe7fc('0x7b')](_0x1034fe)['then'](function(_0x3f08b7){_0x110463=_(_0x110463)[_0xe7fc('0x7c')](_0x3f08b7)[_0xe7fc('0x7d')]()[_0xe7fc('0x7e')]();return db[_0xe7fc('0x2d')][_0xe7fc('0x49')]({'where':{'id':_0xa333a7[_0xe7fc('0x45')]['id']}})[_0xe7fc('0x23')](function(_0x572016){return db[_0xe7fc('0x66')][_0xe7fc('0x7f')](function(_0x372bf6){return _0x572016['removeTeams'](_0xa333a7[_0xe7fc('0x2f')]['ids'],{'transaction':_0x372bf6})[_0xe7fc('0x23')](function(){if(!_['isEmpty'](_0x110463)){return _0x572016[_0xe7fc('0x80')](_0x110463,{'transaction':_0x372bf6});}})[_0xe7fc('0x23')](function(){_0x110463[_0xe7fc('0x81')](function(_0x3df140){socket[_0xe7fc('0x69')]('userMailQueue:remove',{'UserId':_0x3df140,'MailQueueId':_0x572016['id']});});});});});});})['then'](respondWithStatusCode(_0x24f920,null))[_0xe7fc('0x43')](handleError(_0x24f920,null));};exports[_0xe7fc('0x82')]=function(_0x10819d,_0x22fa02,_0x4bf413){return db[_0xe7fc('0x2d')][_0xe7fc('0x49')]({'where':{'id':_0x10819d[_0xe7fc('0x45')]['id']}})[_0xe7fc('0x23')](handleEntityNotFound(_0x22fa02,null))['then'](function(_0x925a01){if(_0x925a01){return _0x925a01[_0xe7fc('0x82')](_0x10819d[_0xe7fc('0x4b')][_0xe7fc('0x61')],_[_0xe7fc('0x83')](_0x10819d[_0xe7fc('0x4b')],[_0xe7fc('0x61'),'id'])||{})[_0xe7fc('0x84')](function(_0x5a2f07){for(var _0x5e4652=0x0;_0x5e4652<_0x10819d[_0xe7fc('0x4b')][_0xe7fc('0x61')][_0xe7fc('0x47')];_0x5e4652+=0x1){socket['emit'](_0xe7fc('0x6a'),{'UserId':_0x10819d['body'][_0xe7fc('0x61')][_0x5e4652],'MailQueueId':_0x10819d['params']['id']});}return _0x5a2f07;});}})['then'](respondWithResult(_0x22fa02,null))[_0xe7fc('0x43')](handleError(_0x22fa02,null));};exports[_0xe7fc('0x80')]=function(_0x5c9372,_0x175a62,_0x5c96a5){return db[_0xe7fc('0x2d')][_0xe7fc('0x49')]({'where':{'id':_0x5c9372[_0xe7fc('0x45')]['id']}})[_0xe7fc('0x23')](handleEntityNotFound(_0x175a62,null))['then'](function(_0x388380){if(_0x388380){return _0x388380['removeAgents'](_0x5c9372['query'][_0xe7fc('0x61')])[_0xe7fc('0x23')](function(){if(_[_0xe7fc('0x85')](_0x5c9372[_0xe7fc('0x2f')][_0xe7fc('0x61')])){for(var _0xa03707=0x0;_0xa03707<_0x5c9372[_0xe7fc('0x2f')][_0xe7fc('0x61')][_0xe7fc('0x47')];_0xa03707+=0x1){socket[_0xe7fc('0x69')](_0xe7fc('0x86'),{'UserId':Number(_0x5c9372[_0xe7fc('0x2f')][_0xe7fc('0x61')][_0xa03707]),'MailQueueId':Number(_0x5c9372['params']['id'])});}}else{socket[_0xe7fc('0x69')](_0xe7fc('0x86'),{'UserId':Number(_0x5c9372['query']['ids']),'MailQueueId':Number(_0x5c9372[_0xe7fc('0x45')]['id'])});}});}})[_0xe7fc('0x23')](respondWithStatusCode(_0x175a62,null))[_0xe7fc('0x43')](handleError(_0x175a62,null));};exports[_0xe7fc('0x87')]=function(_0x46f7dc,_0xb98691,_0x4d7db2){var _0x14a765={};var _0x3f6297={};var _0x2f8aa3;var _0x408a2;return db[_0xe7fc('0x2d')][_0xe7fc('0x88')]({'where':{'id':_0x46f7dc[_0xe7fc('0x45')]['id']}})['then'](handleEntityNotFound(_0xb98691,null))['then'](function(_0x23381a){if(_0x23381a){_0x2f8aa3=_0x23381a;_0x3f6297[_0xe7fc('0x33')]=_[_0xe7fc('0x30')](db[_0xe7fc('0x57')][_0xe7fc('0x46')]);_0x3f6297[_0xe7fc('0x2f')]=_[_0xe7fc('0x30')](_0x46f7dc[_0xe7fc('0x2f')]);_0x3f6297[_0xe7fc('0x31')]=_[_0xe7fc('0x32')](_0x3f6297['model'],_0x3f6297['query']);_0x14a765['attributes']=_[_0xe7fc('0x32')](_0x3f6297[_0xe7fc('0x33')],qs[_0xe7fc('0x35')](_0x46f7dc[_0xe7fc('0x2f')][_0xe7fc('0x35')]));_0x14a765[_0xe7fc('0x34')]=_0x14a765[_0xe7fc('0x34')][_0xe7fc('0x47')]?_0x14a765[_0xe7fc('0x34')]:_0x3f6297[_0xe7fc('0x33')];_0x14a765[_0xe7fc('0x38')]=qs[_0xe7fc('0x39')](_0x46f7dc[_0xe7fc('0x2f')][_0xe7fc('0x39')]);_0x14a765[_0xe7fc('0x3a')]=qs[_0xe7fc('0x31')](_[_0xe7fc('0x3b')](_0x46f7dc[_0xe7fc('0x2f')],_0x3f6297['filters']));if(_0x46f7dc[_0xe7fc('0x2f')][_0xe7fc('0x3c')]){_0x14a765[_0xe7fc('0x3a')]=_[_0xe7fc('0x3e')](_0x14a765['where'],{'$or':_[_0xe7fc('0x56')](_0x14a765[_0xe7fc('0x34')],function(_0x250509){var _0x43e448={};_0x43e448[_0x250509]={'$like':'%'+_0x46f7dc[_0xe7fc('0x2f')][_0xe7fc('0x3c')]+'%'};return _0x43e448;})});}_0x14a765=_['merge']({},_0x14a765,_0x46f7dc['options']);return _0x2f8aa3[_0xe7fc('0x87')](_0x14a765);}})['then'](function(_0x51d5f9){if(_0x51d5f9){_0x408a2=_0x51d5f9['length'];if(!_0x46f7dc[_0xe7fc('0x2f')][_0xe7fc('0x36')](_0xe7fc('0x37'))){_0x14a765[_0xe7fc('0x1c')]=qs['limit'](_0x46f7dc['query'][_0xe7fc('0x1c')]);_0x14a765[_0xe7fc('0x1b')]=qs[_0xe7fc('0x1b')](_0x46f7dc[_0xe7fc('0x2f')][_0xe7fc('0x1b')]);}return _0x2f8aa3[_0xe7fc('0x87')](_0x14a765);}})[_0xe7fc('0x23')](function(_0x189bb5){if(_0x189bb5){return _0x189bb5?{'count':_0x408a2,'rows':_0x189bb5}:null;}})[_0xe7fc('0x23')](respondWithResult(_0xb98691,null))[_0xe7fc('0x43')](handleError(_0xb98691,null));}; \ No newline at end of file +var _0x57c3=['autoAssociation','body','destroy','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','MailQueueId','findAll','User','UserId','mailPause','updatedAt','rows','getTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','removeTeams','Team','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','TeamId','includes','all','union','compact','value','removeAgents','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','isArray','getAgents','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./mailQueue.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','MailQueues','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','catch','show','params','includeAll','create','user','role','UserProfileSection','find','userProfileId'];(function(_0x58a7c1,_0x3be4eb){var _0x5bb95c=function(_0x4652ee){while(--_0x4652ee){_0x58a7c1['push'](_0x58a7c1['shift']());}};_0x5bb95c(++_0x3be4eb);}(_0x57c3,0xc2));var _0x357c=function(_0x3ce5df,_0x436cd0){_0x3ce5df=_0x3ce5df-0x0;var _0x2a9ed8=_0x57c3[_0x3ce5df];return _0x2a9ed8;};'use strict';var pdf=require(_0x357c('0x0'));var emlformat=require(_0x357c('0x1'));var rimraf=require(_0x357c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x357c('0x3'));var BPromise=require(_0x357c('0x4'));var Mustache=require(_0x357c('0x5'));var util=require(_0x357c('0x6'));var path=require('path');var sox=require(_0x357c('0x7'));var csv=require('to-csv');var ejs=require(_0x357c('0x8'));var fs=require('fs');var _=require(_0x357c('0x9'));var squel=require(_0x357c('0xa'));var crypto=require(_0x357c('0xb'));var jsforce=require(_0x357c('0xc'));var deskjs=require(_0x357c('0xd'));var toCsv=require(_0x357c('0xe'));var querystring=require('querystring');var Papa=require(_0x357c('0xf'));var Redis=require(_0x357c('0x10'));var authService=require(_0x357c('0x11'));var qs=require(_0x357c('0x12'));var as=require(_0x357c('0x13'));var hardwareService=require(_0x357c('0x14'));var logger=require(_0x357c('0x15'))(_0x357c('0x16'));var utils=require(_0x357c('0x17'));var config=require(_0x357c('0x18'));var licenseUtil=require(_0x357c('0x19'));var db=require(_0x357c('0x1a'))['db'];config['redis']=_[_0x357c('0x1b')](config[_0x357c('0x1c')],{'host':_0x357c('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x357c('0x1e'))[_0x357c('0x1f')](socket);function respondWithStatusCode(_0x1465ee,_0x41f924){_0x41f924=_0x41f924||0xcc;return function(_0xe9ad54){if(_0xe9ad54){return _0x1465ee[_0x357c('0x20')](_0x41f924);}return _0x1465ee['status'](_0x41f924)[_0x357c('0x21')]();};}function respondWithResult(_0x288ed7,_0x5e01dc){_0x5e01dc=_0x5e01dc||0xc8;return function(_0x590f6d){if(_0x590f6d){return _0x288ed7[_0x357c('0x22')](_0x5e01dc)[_0x357c('0x23')](_0x590f6d);}};}function respondWithFilteredResult(_0xfeb048,_0x5bf715){return function(_0x21d0f9){if(_0x21d0f9){var _0x3f3bf2=_0x21d0f9[_0x357c('0x24')],_0x1ddb95=_0x5bf715[_0x357c('0x25')],_0x34b058=_0x5bf715[_0x357c('0x25')]+_0x5bf715[_0x357c('0x26')],_0x3b4259;if(_0x34b058>=_0x3f3bf2){_0x34b058=_0x3f3bf2;_0x3b4259=0xc8;}else{_0x3b4259=0xce;}_0xfeb048['status'](_0x3b4259);return _0xfeb048[_0x357c('0x27')](_0x357c('0x28'),_0x1ddb95+'-'+_0x34b058+'/'+_0x3f3bf2)['json'](_0x21d0f9);}return null;};}function patchUpdates(_0x51f71f){return function(_0x12879b){try{jsonpatch[_0x357c('0x29')](_0x12879b,_0x51f71f,!![]);}catch(_0x53ca28){return BPromise[_0x357c('0x2a')](_0x53ca28);}return _0x12879b[_0x357c('0x2b')]();};}function saveUpdates(_0x5e7f32,_0x1dee93){return function(_0x336b14){if(_0x336b14){return _0x336b14[_0x357c('0x2c')](_0x5e7f32)[_0x357c('0x2d')](function(_0x324bff){return _0x324bff;});}return null;};}function removeEntity(_0x1cbd6c,_0x328dfc){return function(_0x23cde6){if(_0x23cde6){return _0x23cde6['destroy']()['then'](function(){var _0x37c9e1=_0x23cde6[_0x357c('0x2e')]({'plain':!![]});var _0x134274=_0x357c('0x2f');return db[_0x357c('0x30')]['destroy']({'where':{'type':_0x134274,'resourceId':_0x37c9e1['id']}})[_0x357c('0x2d')](function(){return _0x23cde6;});})['then'](function(){_0x1cbd6c[_0x357c('0x22')](0xcc)[_0x357c('0x21')]();});}};}function handleEntityNotFound(_0x95e7b5,_0x5f4a8a){return function(_0x11dc9c){if(!_0x11dc9c){_0x95e7b5[_0x357c('0x20')](0x194);}return _0x11dc9c;};}function handleError(_0x34984f,_0x42a97a){_0x42a97a=_0x42a97a||0x1f4;return function(_0x28cdc3){logger[_0x357c('0x31')](_0x28cdc3[_0x357c('0x32')]);if(_0x28cdc3[_0x357c('0x33')]){delete _0x28cdc3['name'];}_0x34984f[_0x357c('0x22')](_0x42a97a)[_0x357c('0x34')](_0x28cdc3);};}exports[_0x357c('0x35')]=function(_0x4e9ea0,_0x288957){var _0x51b7f4={},_0x396740={},_0x859a04={'count':0x0,'rows':[]};var _0x2f52c3=_[_0x357c('0x36')](db[_0x357c('0x37')][_0x357c('0x38')],function(_0x3122b1){return{'name':_0x3122b1[_0x357c('0x39')],'type':_0x3122b1[_0x357c('0x3a')][_0x357c('0x3b')]};});_0x396740[_0x357c('0x3c')]=_[_0x357c('0x36')](_0x2f52c3,_0x357c('0x33'));_0x396740['query']=_[_0x357c('0x3d')](_0x4e9ea0[_0x357c('0x3e')]);_0x396740['filters']=_[_0x357c('0x3f')](_0x396740[_0x357c('0x3c')],_0x396740[_0x357c('0x3e')]);_0x51b7f4[_0x357c('0x40')]=_[_0x357c('0x3f')](_0x396740[_0x357c('0x3c')],qs['fields'](_0x4e9ea0[_0x357c('0x3e')][_0x357c('0x41')]));_0x51b7f4[_0x357c('0x40')]=_0x51b7f4['attributes'][_0x357c('0x42')]?_0x51b7f4[_0x357c('0x40')]:_0x396740[_0x357c('0x3c')];if(!_0x4e9ea0['query']['hasOwnProperty'](_0x357c('0x43'))){_0x51b7f4[_0x357c('0x26')]=qs[_0x357c('0x26')](_0x4e9ea0['query'][_0x357c('0x26')]);_0x51b7f4['offset']=qs[_0x357c('0x25')](_0x4e9ea0[_0x357c('0x3e')][_0x357c('0x25')]);}_0x51b7f4[_0x357c('0x44')]=qs[_0x357c('0x45')](_0x4e9ea0['query'][_0x357c('0x45')]);_0x51b7f4[_0x357c('0x46')]=qs[_0x357c('0x47')](_[_0x357c('0x48')](_0x4e9ea0[_0x357c('0x3e')],_0x396740[_0x357c('0x47')]),_0x2f52c3);if(_0x4e9ea0[_0x357c('0x3e')][_0x357c('0x49')]){_0x51b7f4[_0x357c('0x46')]=_['merge'](_0x51b7f4[_0x357c('0x46')],{'$or':_[_0x357c('0x36')](_0x2f52c3,function(_0x4b2544){if(_0x4b2544[_0x357c('0x3a')]!==_0x357c('0x4a')){var _0x462d9f={};_0x462d9f[_0x4b2544[_0x357c('0x33')]]={'$like':'%'+_0x4e9ea0['query']['filter']+'%'};return _0x462d9f;}})});}_0x51b7f4=_[_0x357c('0x4b')]({},_0x51b7f4,_0x4e9ea0[_0x357c('0x4c')]);var _0xee2bd4={'where':_0x51b7f4[_0x357c('0x46')]};return db[_0x357c('0x37')][_0x357c('0x24')](_0xee2bd4)[_0x357c('0x2d')](function(_0x56f410){_0x859a04[_0x357c('0x24')]=_0x56f410;if(_0x4e9ea0[_0x357c('0x3e')]['includeAll']){_0x51b7f4[_0x357c('0x4d')]=[{'all':!![]}];}return db[_0x357c('0x37')]['findAll'](_0x51b7f4);})[_0x357c('0x2d')](function(_0xaab73f){_0x859a04['rows']=_0xaab73f;return _0x859a04;})[_0x357c('0x2d')](respondWithFilteredResult(_0x288957,_0x51b7f4))[_0x357c('0x4e')](handleError(_0x288957,null));};exports[_0x357c('0x4f')]=function(_0x32311a,_0x51b128){var _0x1e8424={'raw':!![],'where':{'id':_0x32311a[_0x357c('0x50')]['id']}},_0x29114d={};_0x29114d[_0x357c('0x3c')]=_[_0x357c('0x3d')](db[_0x357c('0x37')][_0x357c('0x38')]);_0x29114d['query']=_[_0x357c('0x3d')](_0x32311a['query']);_0x29114d[_0x357c('0x47')]=_['intersection'](_0x29114d[_0x357c('0x3c')],_0x29114d[_0x357c('0x3e')]);_0x1e8424[_0x357c('0x40')]=_[_0x357c('0x3f')](_0x29114d['model'],qs['fields'](_0x32311a[_0x357c('0x3e')]['fields']));_0x1e8424[_0x357c('0x40')]=_0x1e8424['attributes']['length']?_0x1e8424[_0x357c('0x40')]:_0x29114d[_0x357c('0x3c')];if(_0x32311a[_0x357c('0x3e')][_0x357c('0x51')]){_0x1e8424[_0x357c('0x4d')]=[{'all':!![]}];}_0x1e8424=_[_0x357c('0x4b')]({},_0x1e8424,_0x32311a['options']);return db[_0x357c('0x37')]['find'](_0x1e8424)[_0x357c('0x2d')](handleEntityNotFound(_0x51b128,null))[_0x357c('0x2d')](respondWithResult(_0x51b128,null))[_0x357c('0x4e')](handleError(_0x51b128,null));};exports[_0x357c('0x52')]=function(_0x44d8e6,_0x30387a){return db[_0x357c('0x37')][_0x357c('0x52')](_0x44d8e6['body'],{})[_0x357c('0x2d')](function(_0x10fa56){var _0x14c33b=_0x44d8e6[_0x357c('0x53')][_0x357c('0x2e')]({'plain':!![]});if(!_0x14c33b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14c33b[_0x357c('0x54')]===_0x357c('0x53')){var _0x5cea88=_0x10fa56[_0x357c('0x2e')]({'plain':!![]});var _0x18d8cf=_0x357c('0x2f');return db[_0x357c('0x55')][_0x357c('0x56')]({'where':{'name':_0x18d8cf,'userProfileId':_0x14c33b[_0x357c('0x57')]},'raw':!![]})[_0x357c('0x2d')](function(_0x4b097b){if(_0x4b097b&&_0x4b097b[_0x357c('0x58')]===0x0){return db[_0x357c('0x30')]['create']({'name':_0x5cea88['name'],'resourceId':_0x5cea88['id'],'type':_0x4b097b[_0x357c('0x33')],'sectionId':_0x4b097b['id']},{})[_0x357c('0x2d')](function(){return _0x10fa56;});}else{return _0x10fa56;}})[_0x357c('0x4e')](function(_0x45b755){logger[_0x357c('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45b755);throw _0x45b755;});}return _0x10fa56;})[_0x357c('0x2d')](respondWithResult(_0x30387a,0xc9))[_0x357c('0x4e')](handleError(_0x30387a,null));};exports['update']=function(_0x46cf72,_0x1acb68){if(_0x46cf72[_0x357c('0x59')]['id']){delete _0x46cf72[_0x357c('0x59')]['id'];}return db[_0x357c('0x37')]['find']({'where':{'id':_0x46cf72[_0x357c('0x50')]['id']}})[_0x357c('0x2d')](handleEntityNotFound(_0x1acb68,null))['then'](saveUpdates(_0x46cf72[_0x357c('0x59')],null))[_0x357c('0x2d')](respondWithResult(_0x1acb68,null))['catch'](handleError(_0x1acb68,null));};exports[_0x357c('0x5a')]=function(_0x2c02f4,_0x2e3797){return db[_0x357c('0x37')][_0x357c('0x56')]({'where':{'id':_0x2c02f4[_0x357c('0x50')]['id']}})['then'](handleEntityNotFound(_0x2e3797,null))['then'](removeEntity(_0x2e3797,null))[_0x357c('0x4e')](handleError(_0x2e3797,null));};exports[_0x357c('0x5b')]=function(_0xcd5e33,_0x2d2da3){return db[_0x357c('0x37')][_0x357c('0x5b')]()['then'](respondWithResult(_0x2d2da3,null))[_0x357c('0x4e')](handleError(_0x2d2da3,null));};exports[_0x357c('0x5c')]=function(_0x2fa62b,_0xc82cf2,_0x8538a4){var _0x32363={'raw':!![],'where':{}},_0xa58502={},_0x1955db;return db[_0x357c('0x37')][_0x357c('0x5d')]({'where':{'id':_0x2fa62b[_0x357c('0x50')]['id']}})[_0x357c('0x2d')](handleEntityNotFound(_0xc82cf2,null))[_0x357c('0x2d')](function(_0x202dd0){if(_0x202dd0){_0x1955db=_0x202dd0[_0x357c('0x2e')]({'plain':!![]});_0xa58502[_0x357c('0x3c')]=_['keys'](db[_0x357c('0x5e')][_0x357c('0x38')]);_0xa58502['query']=_[_0x357c('0x3d')](_0x2fa62b[_0x357c('0x3e')]);_0xa58502[_0x357c('0x47')]=_[_0x357c('0x3f')](_0xa58502[_0x357c('0x3c')],_0xa58502[_0x357c('0x3e')]);_0x32363[_0x357c('0x40')]=_[_0x357c('0x3f')](_0xa58502[_0x357c('0x3c')],qs[_0x357c('0x41')](_0x2fa62b['query'][_0x357c('0x41')]));_0x32363[_0x357c('0x40')]=_0x32363[_0x357c('0x40')][_0x357c('0x42')]?_0x32363[_0x357c('0x40')]:_0xa58502['model'];if(!_0x2fa62b[_0x357c('0x3e')][_0x357c('0x5f')](_0x357c('0x43'))){_0x32363[_0x357c('0x26')]=qs['limit'](_0x2fa62b[_0x357c('0x3e')]['limit']);_0x32363[_0x357c('0x25')]=qs['offset'](_0x2fa62b[_0x357c('0x3e')][_0x357c('0x25')]);}_0x32363[_0x357c('0x44')]=qs['sort'](_0x2fa62b['query'][_0x357c('0x45')]);_0x32363[_0x357c('0x46')]=qs['filters'](_[_0x357c('0x48')](_0x2fa62b[_0x357c('0x3e')],_0xa58502[_0x357c('0x47')]));_0x32363[_0x357c('0x46')][_0x357c('0x60')]=_0x202dd0['id'];if(_0x2fa62b[_0x357c('0x3e')][_0x357c('0x49')]){_0x32363[_0x357c('0x46')]=_[_0x357c('0x4b')](_0x32363['where'],{'$or':_[_0x357c('0x36')](_0x32363['attributes'],function(_0x5be608){var _0x517c40={};_0x517c40[_0x5be608]={'$like':'%'+_0x2fa62b[_0x357c('0x3e')]['filter']+'%'};return _0x517c40;})});}_0x32363=_[_0x357c('0x4b')]({},_0x32363,_0x2fa62b[_0x357c('0x4c')]);return db[_0x357c('0x5e')][_0x357c('0x61')](_0x32363);}})[_0x357c('0x2d')](function(_0x64004a){if(_0x64004a){return db[_0x357c('0x62')]['findAndCountAll']({'where':{'id':_[_0x357c('0x36')](_0x64004a,_0x357c('0x63')),'role':'agent'},'attributes':['id',_0x357c('0x33'),_0x357c('0x64'),_0x357c('0x65'),'createdAt']});}})[_0x357c('0x2d')](function(_0x177cc0){if(_0x177cc0){return{'count':_0x177cc0[_0x357c('0x24')],'rows':_[_0x357c('0x36')](_0x177cc0[_0x357c('0x66')],function(_0x4f3260){return{'membername':_0x4f3260[_0x357c('0x33')],'UserId':_0x4f3260['id'],'queue_name':_0x1955db[_0x357c('0x33')],'MailQueueId':_0x1955db['id'],'interface':util['format']('%s/%s','SIP',_0x4f3260[_0x357c('0x33')]),'penalty':0x0,'paused':_0x4f3260[_0x357c('0x64')],'createdAt':_0x4f3260['createdAt'],'updatedAt':_0x4f3260[_0x357c('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xc82cf2,_0x32363))[_0x357c('0x4e')](handleError(_0xc82cf2,null));};exports[_0x357c('0x67')]=function(_0x2d0baf,_0x2dc4ab,_0x2e924a){var _0xea131={};var _0x54c74b={};var _0x36b80c;var _0x60c790;return db['MailQueue'][_0x357c('0x5d')]({'where':{'id':_0x2d0baf[_0x357c('0x50')]['id']}})[_0x357c('0x2d')](handleEntityNotFound(_0x2dc4ab,null))['then'](function(_0x17a923){if(_0x17a923){_0x36b80c=_0x17a923;_0x54c74b[_0x357c('0x3c')]=_['keys'](db['Team']['rawAttributes']);_0x54c74b[_0x357c('0x3e')]=_[_0x357c('0x3d')](_0x2d0baf[_0x357c('0x3e')]);_0x54c74b[_0x357c('0x47')]=_[_0x357c('0x3f')](_0x54c74b[_0x357c('0x3c')],_0x54c74b[_0x357c('0x3e')]);_0xea131[_0x357c('0x40')]=_[_0x357c('0x3f')](_0x54c74b['model'],qs[_0x357c('0x41')](_0x2d0baf[_0x357c('0x3e')]['fields']));_0xea131['attributes']=_0xea131[_0x357c('0x40')][_0x357c('0x42')]?_0xea131['attributes']:_0x54c74b[_0x357c('0x3c')];_0xea131[_0x357c('0x44')]=qs[_0x357c('0x45')](_0x2d0baf[_0x357c('0x3e')][_0x357c('0x45')]);_0xea131[_0x357c('0x46')]=qs[_0x357c('0x47')](_[_0x357c('0x48')](_0x2d0baf[_0x357c('0x3e')],_0x54c74b['filters']));if(_0x2d0baf[_0x357c('0x3e')]['filter']){_0xea131[_0x357c('0x46')]=_[_0x357c('0x4b')](_0xea131[_0x357c('0x46')],{'$or':_['map'](_0xea131['attributes'],function(_0x18648c){var _0x30e90c={};_0x30e90c[_0x18648c]={'$like':'%'+_0x2d0baf[_0x357c('0x3e')][_0x357c('0x49')]+'%'};return _0x30e90c;})});}_0xea131=_[_0x357c('0x4b')]({},_0xea131,_0x2d0baf[_0x357c('0x4c')]);return _0x36b80c['getTeams'](_0xea131);}})[_0x357c('0x2d')](function(_0xce100b){if(_0xce100b){_0x60c790=_0xce100b[_0x357c('0x42')];if(!_0x2d0baf['query'][_0x357c('0x5f')](_0x357c('0x43'))){_0xea131['limit']=qs[_0x357c('0x26')](_0x2d0baf[_0x357c('0x3e')][_0x357c('0x26')]);_0xea131[_0x357c('0x25')]=qs[_0x357c('0x25')](_0x2d0baf[_0x357c('0x3e')][_0x357c('0x25')]);}return _0x36b80c[_0x357c('0x67')](_0xea131);}})['then'](function(_0x36706d){if(_0x36706d){return _0x36706d?{'count':_0x60c790,'rows':_0x36706d}:null;}})[_0x357c('0x2d')](respondWithResult(_0x2dc4ab,null))[_0x357c('0x4e')](handleError(_0x2dc4ab,null));};exports['addTeams']=function(_0xee9203,_0x104a36,_0x5cd960){var _0x1587c=_0xee9203['body'][_0x357c('0x68')];return db['Team'][_0x357c('0x61')]({'where':{'id':_0x1587c},'attributes':['id'],'include':[{'model':db[_0x357c('0x62')],'as':_0x357c('0x69'),'attributes':['id',_0x357c('0x33'),'online',_0x357c('0x6a'),_0x357c('0x6b')],'raw':!![]}]})[_0x357c('0x2d')](function(_0x162ce6){if(_0x162ce6){var _0x329dc1=_[_0x357c('0x6c')](_0x162ce6,function(_0x26ce7d){var _0x3fcabd=_0x26ce7d[_0x357c('0x2e')]({'plain':!![]});return _0x3fcabd[_0x357c('0x69')];});return db[_0x357c('0x37')][_0x357c('0x56')]({'where':{'id':_0xee9203[_0x357c('0x50')]['id']}})[_0x357c('0x2d')](function(_0xdc6477){return db[_0x357c('0x6d')][_0x357c('0x6e')](function(_0x5956a4){return _0xdc6477[_0x357c('0x6f')](_0x1587c,{'transaction':_0x5956a4})['then'](function(){return BPromise['each'](_0x329dc1,function(_0x3a80cf){return db[_0x357c('0x5e')]['findOrCreate']({'where':{'UserId':_0x3a80cf['id'],'MailQueueId':_0xee9203[_0x357c('0x50')]['id']},'transaction':_0x5956a4});});})['then'](function(){_0x329dc1[_0x357c('0x70')](function(_0x96f549){socket[_0x357c('0x71')]('userMailQueue:save',{'UserId':_0x96f549['id'],'MailQueueId':_0xdc6477['id']});});});});});}})[_0x357c('0x2d')](respondWithStatusCode(_0x104a36,null))[_0x357c('0x4e')](handleError(_0x104a36,null));};exports[_0x357c('0x72')]=function(_0x3fada4,_0x2f15ea,_0x4a7934){return db[_0x357c('0x73')][_0x357c('0x61')]({'where':{'id':_0x3fada4[_0x357c('0x3e')][_0x357c('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x357c('0x2d')](handleEntityNotFound(_0x2f15ea,null))[_0x357c('0x2d')](function(_0x2ff55e){var _0x105921=_[_0x357c('0x36')](_0x2ff55e,'id');var _0x2bd6b9=[];var _0x2b0857=[];var _0x27cdb3=squel['select']();_0x27cdb3[_0x357c('0x74')](_0x357c('0x75'))[_0x357c('0x76')](_0x357c('0x77'),'tq')[_0x357c('0x78')](_0x357c('0x79'),'ut',_0x357c('0x7a'))['where']('MailQueueId\x20=\x20?',_0x3fada4[_0x357c('0x50')]['id']);for(var _0x311ff9=0x0;_0x311ff9<_0x2ff55e['length'];_0x311ff9+=0x1){let _0x55a572=_0x2ff55e[_0x311ff9];for(var _0xa056ee=0x0;_0xa056ee<_0x55a572[_0x357c('0x69')][_0x357c('0x42')];_0xa056ee+=0x1){let _0x11e12d=_0x55a572['Agents'][_0xa056ee];var _0x1d67b2=_0x27cdb3[_0x357c('0x7b')]();_0x1d67b2[_0x357c('0x46')](_0x357c('0x7c'),_0x11e12d['id']);_0x2b0857[_0x357c('0x7d')](db[_0x357c('0x6d')][_0x357c('0x3e')](_0x1d67b2[_0x357c('0x7e')](),{'type':db[_0x357c('0x6d')]['QueryTypes']['SELECT']})[_0x357c('0x2d')](function(_0xe5baab){if(_0xe5baab[_0x357c('0x42')]===0x1){return _0x11e12d['id'];}else{var _0xca20a0=_['every'](_[_0x357c('0x36')](_0xe5baab,_0x357c('0x7f')),function(_0x133a9d){return _[_0x357c('0x80')](_0x105921,_0x133a9d);});if(_0xca20a0){return _0x11e12d['id'];}}}));}}return BPromise[_0x357c('0x81')](_0x2b0857)[_0x357c('0x2d')](function(_0x25c524){_0x2bd6b9=_(_0x2bd6b9)[_0x357c('0x82')](_0x25c524)[_0x357c('0x83')]()[_0x357c('0x84')]();return db['MailQueue'][_0x357c('0x56')]({'where':{'id':_0x3fada4['params']['id']}})[_0x357c('0x2d')](function(_0x3adc67){return db[_0x357c('0x6d')][_0x357c('0x6e')](function(_0x2a4fae){return _0x3adc67['removeTeams'](_0x3fada4['query'][_0x357c('0x68')],{'transaction':_0x2a4fae})[_0x357c('0x2d')](function(){if(!_['isEmpty'](_0x2bd6b9)){return _0x3adc67[_0x357c('0x85')](_0x2bd6b9,{'transaction':_0x2a4fae});}})[_0x357c('0x2d')](function(){_0x2bd6b9[_0x357c('0x70')](function(_0x197fe2){socket[_0x357c('0x71')](_0x357c('0x86'),{'UserId':_0x197fe2,'MailQueueId':_0x3adc67['id']});});});});});});})['then'](respondWithStatusCode(_0x2f15ea,null))[_0x357c('0x4e')](handleError(_0x2f15ea,null));};exports['addAgents']=function(_0x54dcdb,_0x422d55,_0x90c32c){return db[_0x357c('0x37')][_0x357c('0x56')]({'where':{'id':_0x54dcdb[_0x357c('0x50')]['id']}})[_0x357c('0x2d')](handleEntityNotFound(_0x422d55,null))[_0x357c('0x2d')](function(_0x1d11a5){if(_0x1d11a5){return _0x1d11a5[_0x357c('0x87')](_0x54dcdb[_0x357c('0x59')][_0x357c('0x68')],_[_0x357c('0x88')](_0x54dcdb[_0x357c('0x59')],[_0x357c('0x68'),'id'])||{})[_0x357c('0x89')](function(_0x2c5302){for(var _0x4996fe=0x0;_0x4996fe<_0x54dcdb['body'][_0x357c('0x68')][_0x357c('0x42')];_0x4996fe+=0x1){socket[_0x357c('0x71')](_0x357c('0x8a'),{'UserId':_0x54dcdb['body']['ids'][_0x4996fe],'MailQueueId':_0x54dcdb[_0x357c('0x50')]['id']});}return _0x2c5302;});}})[_0x357c('0x2d')](respondWithResult(_0x422d55,null))['catch'](handleError(_0x422d55,null));};exports[_0x357c('0x85')]=function(_0x346db9,_0x50a26c,_0x4c529f){return db[_0x357c('0x37')][_0x357c('0x56')]({'where':{'id':_0x346db9['params']['id']}})[_0x357c('0x2d')](handleEntityNotFound(_0x50a26c,null))[_0x357c('0x2d')](function(_0x29bde6){if(_0x29bde6){return _0x29bde6[_0x357c('0x85')](_0x346db9[_0x357c('0x3e')]['ids'])[_0x357c('0x2d')](function(){if(_[_0x357c('0x8b')](_0x346db9[_0x357c('0x3e')]['ids'])){for(var _0x219fdf=0x0;_0x219fdf<_0x346db9['query'][_0x357c('0x68')][_0x357c('0x42')];_0x219fdf+=0x1){socket[_0x357c('0x71')](_0x357c('0x86'),{'UserId':Number(_0x346db9[_0x357c('0x3e')][_0x357c('0x68')][_0x219fdf]),'MailQueueId':Number(_0x346db9[_0x357c('0x50')]['id'])});}}else{socket['emit'](_0x357c('0x86'),{'UserId':Number(_0x346db9[_0x357c('0x3e')][_0x357c('0x68')]),'MailQueueId':Number(_0x346db9[_0x357c('0x50')]['id'])});}});}})[_0x357c('0x2d')](respondWithStatusCode(_0x50a26c,null))['catch'](handleError(_0x50a26c,null));};exports[_0x357c('0x8c')]=function(_0x2cb7bd,_0x3dc51c,_0x4828ee){var _0x26c72a={};var _0x170baa={};var _0x372825;var _0x258469;return db[_0x357c('0x37')][_0x357c('0x5d')]({'where':{'id':_0x2cb7bd[_0x357c('0x50')]['id']}})[_0x357c('0x2d')](handleEntityNotFound(_0x3dc51c,null))['then'](function(_0x24631f){if(_0x24631f){_0x372825=_0x24631f;_0x170baa[_0x357c('0x3c')]=_[_0x357c('0x3d')](db[_0x357c('0x62')][_0x357c('0x38')]);_0x170baa[_0x357c('0x3e')]=_[_0x357c('0x3d')](_0x2cb7bd['query']);_0x170baa[_0x357c('0x47')]=_[_0x357c('0x3f')](_0x170baa[_0x357c('0x3c')],_0x170baa[_0x357c('0x3e')]);_0x26c72a[_0x357c('0x40')]=_['intersection'](_0x170baa[_0x357c('0x3c')],qs[_0x357c('0x41')](_0x2cb7bd['query'][_0x357c('0x41')]));_0x26c72a[_0x357c('0x40')]=_0x26c72a['attributes'][_0x357c('0x42')]?_0x26c72a[_0x357c('0x40')]:_0x170baa['model'];_0x26c72a[_0x357c('0x44')]=qs[_0x357c('0x45')](_0x2cb7bd[_0x357c('0x3e')]['sort']);_0x26c72a[_0x357c('0x46')]=qs[_0x357c('0x47')](_[_0x357c('0x48')](_0x2cb7bd[_0x357c('0x3e')],_0x170baa[_0x357c('0x47')]));if(_0x2cb7bd[_0x357c('0x3e')][_0x357c('0x49')]){_0x26c72a[_0x357c('0x46')]=_[_0x357c('0x4b')](_0x26c72a[_0x357c('0x46')],{'$or':_[_0x357c('0x36')](_0x26c72a['attributes'],function(_0x14a4b9){var _0x73566e={};_0x73566e[_0x14a4b9]={'$like':'%'+_0x2cb7bd[_0x357c('0x3e')]['filter']+'%'};return _0x73566e;})});}_0x26c72a=_[_0x357c('0x4b')]({},_0x26c72a,_0x2cb7bd[_0x357c('0x4c')]);return _0x372825[_0x357c('0x8c')](_0x26c72a);}})[_0x357c('0x2d')](function(_0x138502){if(_0x138502){_0x258469=_0x138502[_0x357c('0x42')];if(!_0x2cb7bd[_0x357c('0x3e')]['hasOwnProperty'](_0x357c('0x43'))){_0x26c72a[_0x357c('0x26')]=qs[_0x357c('0x26')](_0x2cb7bd[_0x357c('0x3e')][_0x357c('0x26')]);_0x26c72a[_0x357c('0x25')]=qs['offset'](_0x2cb7bd[_0x357c('0x3e')][_0x357c('0x25')]);}return _0x372825[_0x357c('0x8c')](_0x26c72a);}})[_0x357c('0x2d')](function(_0x3558f7){if(_0x3558f7){return _0x3558f7?{'count':_0x258469,'rows':_0x3558f7}:null;}})[_0x357c('0x2d')](respondWithResult(_0x3dc51c,null))[_0x357c('0x4e')](handleError(_0x3dc51c,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 65098c4..8829ccb 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 _0xe4d7=['hasOwnProperty','hook','events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit'];(function(_0x2dfb77,_0x47964e){var _0xaf4c1d=function(_0x567959){while(--_0x567959){_0x2dfb77['push'](_0x2dfb77['shift']());}};_0xaf4c1d(++_0x47964e);}(_0xe4d7,0xe8));var _0x7e4d=function(_0x2e9e5e,_0x39b7b6){_0x2e9e5e=_0x2e9e5e-0x0;var _0x534e41=_0xe4d7[_0x2e9e5e];return _0x534e41;};'use strict';var EventEmitter=require(_0x7e4d('0x0'));var MailQueue=require(_0x7e4d('0x1'))['db'][_0x7e4d('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x7e4d('0x3')](0x0);var events={'afterCreate':_0x7e4d('0x4'),'afterUpdate':_0x7e4d('0x5'),'afterDestroy':_0x7e4d('0x6')};function emitEvent(_0x561370){return function(_0x4f9440,_0x4de3f6,_0x12ec8b){MailQueueEvents[_0x7e4d('0x7')](_0x561370+':'+_0x4f9440['id'],_0x4f9440);MailQueueEvents[_0x7e4d('0x7')](_0x561370,_0x4f9440);_0x12ec8b(null);};}for(var e in events){if(events[_0x7e4d('0x8')](e)){var event=events[e];MailQueue[_0x7e4d('0x9')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x964b=['hasOwnProperty','hook','exports','events','save','remove','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x964b,0x1d8));var _0xb964=function(_0x200d75,_0x204c62){_0x200d75=_0x200d75-0x0;var _0x229751=_0x964b[_0x200d75];return _0x229751;};'use strict';var EventEmitter=require(_0xb964('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb964('0x1'),'afterUpdate':'update','afterDestroy':_0xb964('0x2')};function emitEvent(_0x184c79){return function(_0x1744f4,_0x34790f,_0x352cd0){MailQueueEvents[_0xb964('0x3')](_0x184c79+':'+_0x1744f4['id'],_0x1744f4);MailQueueEvents[_0xb964('0x3')](_0x184c79,_0x1744f4);_0x352cd0(null);};}for(var e in events){if(events[_0xb964('0x4')](e)){var event=events[e];MailQueue[_0xb964('0x5')](e,emitEvent(event));}}module[_0xb964('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index d4eabc9..be69775 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 _0x4988=['../../config/environment','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2b68a1,_0x317089){var _0x340dd4=function(_0x59ac59){while(--_0x59ac59){_0x2b68a1['push'](_0x2b68a1['shift']());}};_0x340dd4(++_0x317089);}(_0x4988,0x1bf));var _0x8498=function(_0x1c13ee,_0x123ccb){_0x1c13ee=_0x1c13ee-0x0;var _0x3b0535=_0x4988[_0x1c13ee];return _0x3b0535;};'use strict';var _=require(_0x8498('0x0'));var util=require(_0x8498('0x1'));var logger=require(_0x8498('0x2'))('api');var moment=require(_0x8498('0x3'));var BPromise=require(_0x8498('0x4'));var rp=require(_0x8498('0x5'));var fs=require('fs');var path=require(_0x8498('0x6'));var rimraf=require(_0x8498('0x7'));var config=require(_0x8498('0x8'));var attributes=require('./mailQueue.attributes');module[_0x8498('0x9')]=function(_0x394512,_0x596ee8){return _0x394512[_0x8498('0xa')](_0x8498('0xb'),attributes,{'tableName':_0x8498('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe43=['../../config/logger','api','moment','bluebird','path','rimraf','exports','MailQueue','mail_queues','lodash','util'];(function(_0x16c95e,_0x4a470d){var _0x4c082b=function(_0x463fd9){while(--_0x463fd9){_0x16c95e['push'](_0x16c95e['shift']());}};_0x4c082b(++_0x4a470d);}(_0xbe43,0x1d7));var _0x3be4=function(_0x27a6dc,_0x2f77af){_0x27a6dc=_0x27a6dc-0x0;var _0x1d56c4=_0xbe43[_0x27a6dc];return _0x1d56c4;};'use strict';var _=require(_0x3be4('0x0'));var util=require(_0x3be4('0x1'));var logger=require(_0x3be4('0x2'))(_0x3be4('0x3'));var moment=require(_0x3be4('0x4'));var BPromise=require(_0x3be4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3be4('0x6'));var rimraf=require(_0x3be4('0x7'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x3be4('0x8')]=function(_0xdd90d5,_0x59c6e5){return _0xdd90d5['define'](_0x3be4('0x9'),attributes,{'tableName':_0x3be4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index d9c93a5..fbb5a5a 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 _0x7bc0=['include','map','model','GetMailQueue','stringify','ShowMailQueue','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s','message','error','catch','MailQueue','findAll','options','raw','attributes','limit'];(function(_0x3f6da3,_0x3d2c49){var _0x290926=function(_0xe25786){while(--_0xe25786){_0x3f6da3['push'](_0x3f6da3['shift']());}};_0x290926(++_0x3d2c49);}(_0x7bc0,0x178));var _0x07bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7bc0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x07bc('0x0'));var util=require(_0x07bc('0x1'));var moment=require(_0x07bc('0x2'));var BPromise=require(_0x07bc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x07bc('0x4'));var db=require(_0x07bc('0x5'))['db'];var utils=require(_0x07bc('0x6'));var logger=require(_0x07bc('0x7'))('rpc');var config=require(_0x07bc('0x8'));var jayson=require(_0x07bc('0x9'));var client=jayson[_0x07bc('0xa')][_0x07bc('0xb')]({'port':0x232a});config[_0x07bc('0xc')]=_[_0x07bc('0xd')](config[_0x07bc('0xc')],{'host':_0x07bc('0xe'),'port':0x18eb});var socket=require(_0x07bc('0xf'))(new Redis(config[_0x07bc('0xc')]));require(_0x07bc('0x10'))[_0x07bc('0x11')](socket);function respondWithRpcPromise(_0x3de2fa,_0xbaf6ec,_0x2213c7){return new BPromise(function(_0x531f20,_0x1107c6){return client[_0x07bc('0x12')](_0x3de2fa,_0x2213c7)[_0x07bc('0x13')](function(_0x4d8375){logger[_0x07bc('0x14')]('MailQueue,\x20%s,\x20%s',_0xbaf6ec,_0x07bc('0x15'));logger[_0x07bc('0x16')](_0x07bc('0x17'),_0xbaf6ec,_0x07bc('0x15'),JSON['stringify'](_0x4d8375));if(_0x4d8375['error']){if(_0x4d8375['error']['code']===0x1f4){logger['error'](_0x07bc('0x18'),_0xbaf6ec,_0x4d8375['error'][_0x07bc('0x19')]);return _0x1107c6(_0x4d8375['error'][_0x07bc('0x19')]);}logger[_0x07bc('0x1a')]('MailQueue,\x20%s,\x20%s',_0xbaf6ec,_0x4d8375['error'][_0x07bc('0x19')]);return _0x531f20(_0x4d8375[_0x07bc('0x1a')]['message']);}else{logger[_0x07bc('0x14')](_0x07bc('0x18'),_0xbaf6ec,'request\x20sent');_0x531f20(_0x4d8375['result'][_0x07bc('0x19')]);}})[_0x07bc('0x1b')](function(_0x26ea11){logger['error'](_0x07bc('0x18'),_0xbaf6ec,_0x26ea11);_0x1107c6(_0x26ea11);});});}exports['GetMailQueue']=function(_0x1fe903){var _0x4e7c49=this;return new Promise(function(_0x3e2db8,_0x3a2e78){return db[_0x07bc('0x1c')][_0x07bc('0x1d')]({'raw':_0x1fe903[_0x07bc('0x1e')]?_0x1fe903['options'][_0x07bc('0x1f')]===undefined?!![]:![]:!![],'where':_0x1fe903[_0x07bc('0x1e')]?_0x1fe903[_0x07bc('0x1e')]['where']||null:null,'attributes':_0x1fe903[_0x07bc('0x1e')]?_0x1fe903['options'][_0x07bc('0x20')]||null:null,'limit':_0x1fe903['options']?_0x1fe903[_0x07bc('0x1e')][_0x07bc('0x21')]||null:null,'include':_0x1fe903[_0x07bc('0x1e')]?_0x1fe903[_0x07bc('0x1e')][_0x07bc('0x22')]?_[_0x07bc('0x23')](_0x1fe903[_0x07bc('0x1e')][_0x07bc('0x22')],function(_0x1f80a4){return{'model':db[_0x1f80a4[_0x07bc('0x24')]],'as':_0x1f80a4['as'],'attributes':_0x1f80a4['attributes'],'include':_0x1f80a4[_0x07bc('0x22')]?_['map'](_0x1f80a4['include'],function(_0x79bc13){return{'model':db[_0x79bc13['model']],'as':_0x79bc13['as'],'attributes':_0x79bc13[_0x07bc('0x20')],'include':_0x79bc13[_0x07bc('0x22')]?_[_0x07bc('0x23')](_0x79bc13['include'],function(_0x4971e6){return{'model':db[_0x4971e6[_0x07bc('0x24')]],'as':_0x4971e6['as'],'attributes':_0x4971e6[_0x07bc('0x20')]};}):[]};}):[]};}):[]:[]})[_0x07bc('0x13')](function(_0x4cdaed){logger['info'](_0x07bc('0x25'),_0x1fe903);logger[_0x07bc('0x16')]('GetMailQueue',_0x1fe903,JSON[_0x07bc('0x26')](_0x4cdaed));_0x3e2db8(_0x4cdaed);})[_0x07bc('0x1b')](function(_0x269e20){logger[_0x07bc('0x1a')](_0x07bc('0x25'),_0x269e20['message'],_0x1fe903);_0x3a2e78(_0x4e7c49[_0x07bc('0x1a')](0x1f4,_0x269e20['message']));});});};exports[_0x07bc('0x27')]=function(_0x1fe931){var _0x37e67b=this;return new Promise(function(_0x4bfa56,_0xfc42f1){return db[_0x07bc('0x1c')]['find']({'raw':_0x1fe931[_0x07bc('0x1e')]?_0x1fe931['options'][_0x07bc('0x1f')]===undefined?!![]:![]:!![],'where':_0x1fe931[_0x07bc('0x1e')]?_0x1fe931[_0x07bc('0x1e')][_0x07bc('0x28')]||null:null,'attributes':_0x1fe931['options']?_0x1fe931[_0x07bc('0x1e')][_0x07bc('0x20')]||null:null,'include':_0x1fe931[_0x07bc('0x1e')]?_0x1fe931['options'][_0x07bc('0x22')]?_['map'](_0x1fe931[_0x07bc('0x1e')][_0x07bc('0x22')],function(_0x4e4a94){return{'model':db[_0x4e4a94[_0x07bc('0x24')]],'as':_0x4e4a94['as'],'attributes':_0x4e4a94[_0x07bc('0x20')],'include':_0x4e4a94['include']?_[_0x07bc('0x23')](_0x4e4a94['include'],function(_0x4187bb){return{'model':db[_0x4187bb['model']],'as':_0x4187bb['as'],'attributes':_0x4187bb[_0x07bc('0x20')],'include':_0x4187bb[_0x07bc('0x22')]?_[_0x07bc('0x23')](_0x4187bb[_0x07bc('0x22')],function(_0x1fc724){return{'model':db[_0x1fc724[_0x07bc('0x24')]],'as':_0x1fc724['as'],'attributes':_0x1fc724[_0x07bc('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2402a0){logger['info'](_0x07bc('0x27'),_0x1fe931);logger[_0x07bc('0x16')](_0x07bc('0x27'),_0x1fe931,JSON['stringify'](_0x2402a0));_0x4bfa56(_0x2402a0);})[_0x07bc('0x1b')](function(_0x5d4585){logger[_0x07bc('0x1a')](_0x07bc('0x27'),_0x5d4585[_0x07bc('0x19')],_0x1fe931);_0xfc42f1(_0x37e67b['error'](0x1f4,_0x5d4585[_0x07bc('0x19')]));});});}; \ No newline at end of file +var _0x9f83=['bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetMailQueue','findAll','options','raw','attributes','limit','include','map','model','then','debug','catch','ShowMailQueue','MailQueue','find','where','lodash','util','moment'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x9f83,0xc5));var _0x39f8=function(_0x2d5b4c,_0x53c01b){_0x2d5b4c=_0x2d5b4c-0x0;var _0x2fe065=_0x9f83[_0x2d5b4c];return _0x2fe065;};'use strict';var _=require(_0x39f8('0x0'));var util=require(_0x39f8('0x1'));var moment=require(_0x39f8('0x2'));var BPromise=require(_0x39f8('0x3'));var rs=require(_0x39f8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x39f8('0x5'))(_0x39f8('0x6'));var config=require(_0x39f8('0x7'));var jayson=require(_0x39f8('0x8'));var client=jayson['client'][_0x39f8('0x9')]({'port':0x232a});config[_0x39f8('0xa')]=_[_0x39f8('0xb')](config[_0x39f8('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x39f8('0xc'))(new Redis(config[_0x39f8('0xa')]));require(_0x39f8('0xd'))[_0x39f8('0xe')](socket);function respondWithRpcPromise(_0x484f77,_0x177a45,_0x56ebe0){return new BPromise(function(_0x32f0ab,_0x490c34){return client[_0x39f8('0xf')](_0x484f77,_0x56ebe0)['then'](function(_0x1efb0c){logger[_0x39f8('0x10')](_0x39f8('0x11'),_0x177a45,_0x39f8('0x12'));logger['debug'](_0x39f8('0x13'),_0x177a45,_0x39f8('0x12'),JSON[_0x39f8('0x14')](_0x1efb0c));if(_0x1efb0c[_0x39f8('0x15')]){if(_0x1efb0c[_0x39f8('0x15')]['code']===0x1f4){logger[_0x39f8('0x15')](_0x39f8('0x11'),_0x177a45,_0x1efb0c[_0x39f8('0x15')]['message']);return _0x490c34(_0x1efb0c[_0x39f8('0x15')]['message']);}logger[_0x39f8('0x15')](_0x39f8('0x11'),_0x177a45,_0x1efb0c[_0x39f8('0x15')][_0x39f8('0x16')]);return _0x32f0ab(_0x1efb0c[_0x39f8('0x15')][_0x39f8('0x16')]);}else{logger[_0x39f8('0x10')]('MailQueue,\x20%s,\x20%s',_0x177a45,_0x39f8('0x12'));_0x32f0ab(_0x1efb0c[_0x39f8('0x17')]['message']);}})['catch'](function(_0x34126b){logger[_0x39f8('0x15')](_0x39f8('0x11'),_0x177a45,_0x34126b);_0x490c34(_0x34126b);});});}exports[_0x39f8('0x18')]=function(_0x2cb768){var _0x31cf02=this;return new Promise(function(_0x17a227,_0x141c90){return db['MailQueue'][_0x39f8('0x19')]({'raw':_0x2cb768[_0x39f8('0x1a')]?_0x2cb768[_0x39f8('0x1a')][_0x39f8('0x1b')]===undefined?!![]:![]:!![],'where':_0x2cb768[_0x39f8('0x1a')]?_0x2cb768[_0x39f8('0x1a')]['where']||null:null,'attributes':_0x2cb768['options']?_0x2cb768['options'][_0x39f8('0x1c')]||null:null,'limit':_0x2cb768['options']?_0x2cb768['options'][_0x39f8('0x1d')]||null:null,'include':_0x2cb768[_0x39f8('0x1a')]?_0x2cb768[_0x39f8('0x1a')][_0x39f8('0x1e')]?_[_0x39f8('0x1f')](_0x2cb768[_0x39f8('0x1a')][_0x39f8('0x1e')],function(_0x203b2c){return{'model':db[_0x203b2c[_0x39f8('0x20')]],'as':_0x203b2c['as'],'attributes':_0x203b2c[_0x39f8('0x1c')],'include':_0x203b2c[_0x39f8('0x1e')]?_[_0x39f8('0x1f')](_0x203b2c[_0x39f8('0x1e')],function(_0x341d19){return{'model':db[_0x341d19[_0x39f8('0x20')]],'as':_0x341d19['as'],'attributes':_0x341d19['attributes'],'include':_0x341d19['include']?_['map'](_0x341d19[_0x39f8('0x1e')],function(_0xf741b5){return{'model':db[_0xf741b5[_0x39f8('0x20')]],'as':_0xf741b5['as'],'attributes':_0xf741b5[_0x39f8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x39f8('0x21')](function(_0x23cf91){logger[_0x39f8('0x10')]('GetMailQueue',_0x2cb768);logger[_0x39f8('0x22')](_0x39f8('0x18'),_0x2cb768,JSON['stringify'](_0x23cf91));_0x17a227(_0x23cf91);})[_0x39f8('0x23')](function(_0x21ef78){logger[_0x39f8('0x15')](_0x39f8('0x18'),_0x21ef78[_0x39f8('0x16')],_0x2cb768);_0x141c90(_0x31cf02[_0x39f8('0x15')](0x1f4,_0x21ef78[_0x39f8('0x16')]));});});};exports[_0x39f8('0x24')]=function(_0x4a3369){var _0xb8aa6f=this;return new Promise(function(_0x1af752,_0x32fec9){return db[_0x39f8('0x25')][_0x39f8('0x26')]({'raw':_0x4a3369[_0x39f8('0x1a')]?_0x4a3369[_0x39f8('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4a3369[_0x39f8('0x1a')]?_0x4a3369['options'][_0x39f8('0x27')]||null:null,'attributes':_0x4a3369[_0x39f8('0x1a')]?_0x4a3369['options'][_0x39f8('0x1c')]||null:null,'include':_0x4a3369[_0x39f8('0x1a')]?_0x4a3369[_0x39f8('0x1a')]['include']?_[_0x39f8('0x1f')](_0x4a3369[_0x39f8('0x1a')][_0x39f8('0x1e')],function(_0x14e088){return{'model':db[_0x14e088[_0x39f8('0x20')]],'as':_0x14e088['as'],'attributes':_0x14e088[_0x39f8('0x1c')],'include':_0x14e088[_0x39f8('0x1e')]?_[_0x39f8('0x1f')](_0x14e088[_0x39f8('0x1e')],function(_0x3ecf1e){return{'model':db[_0x3ecf1e['model']],'as':_0x3ecf1e['as'],'attributes':_0x3ecf1e['attributes'],'include':_0x3ecf1e['include']?_['map'](_0x3ecf1e['include'],function(_0x7c94e0){return{'model':db[_0x7c94e0[_0x39f8('0x20')]],'as':_0x7c94e0['as'],'attributes':_0x7c94e0[_0x39f8('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1fce9e){logger[_0x39f8('0x10')](_0x39f8('0x24'),_0x4a3369);logger[_0x39f8('0x22')](_0x39f8('0x24'),_0x4a3369,JSON[_0x39f8('0x14')](_0x1fce9e));_0x1af752(_0x1fce9e);})[_0x39f8('0x23')](function(_0x326d45){logger[_0x39f8('0x15')]('ShowMailQueue',_0x326d45[_0x39f8('0x16')],_0x4a3369);_0x32fec9(_0xb8aa6f[_0x39f8('0x15')](0x1f4,_0x326d45[_0x39f8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 2de1e2b..9f0eb92 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 _0x6985=['register','mailQueue:','./mailQueue.events','save','emit','removeListener'];(function(_0x31144a,_0x13b28f){var _0x49597c=function(_0x3c156a){while(--_0x3c156a){_0x31144a['push'](_0x31144a['shift']());}};_0x49597c(++_0x13b28f);}(_0x6985,0x158));var _0x5698=function(_0xb8a2f0,_0x45261c){_0xb8a2f0=_0xb8a2f0-0x0;var _0x48735a=_0x6985[_0xb8a2f0];return _0x48735a;};'use strict';var MailQueueEvents=require(_0x5698('0x0'));var events=[_0x5698('0x1'),'remove','update'];function createListener(_0x322cb8,_0x24567d){return function(_0x3bf738){_0x24567d[_0x5698('0x2')](_0x322cb8,_0x3bf738);};}function removeListener(_0x192098,_0x11349d){return function(){MailQueueEvents[_0x5698('0x3')](_0x192098,_0x11349d);};}exports[_0x5698('0x4')]=function(_0x291700){for(var _0x4267ea=0x0,_0x51cf24=events['length'];_0x4267ea<_0x51cf24;_0x4267ea++){var _0x2c6d9f=events[_0x4267ea];var _0x559591=createListener(_0x5698('0x5')+_0x2c6d9f,_0x291700);MailQueueEvents['on'](_0x2c6d9f,_0x559591);}}; \ No newline at end of file +var _0x5fce=['length','./mailQueue.events','save','update','emit','register'];(function(_0xc7e9c8,_0x36dccd){var _0x3bc051=function(_0x176a55){while(--_0x176a55){_0xc7e9c8['push'](_0xc7e9c8['shift']());}};_0x3bc051(++_0x36dccd);}(_0x5fce,0xc1));var _0xe5fc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5fce[_0x2dafbe];return _0x58a45a;};'use strict';var MailQueueEvents=require(_0xe5fc('0x0'));var events=[_0xe5fc('0x1'),'remove',_0xe5fc('0x2')];function createListener(_0x45a6c1,_0x6c512b){return function(_0x12c36b){_0x6c512b[_0xe5fc('0x3')](_0x45a6c1,_0x12c36b);};}function removeListener(_0x2ff9eb,_0x5dfd33){return function(){MailQueueEvents['removeListener'](_0x2ff9eb,_0x5dfd33);};}exports[_0xe5fc('0x4')]=function(_0x500d21){for(var _0x2fcf83=0x0,_0x106589=events[_0xe5fc('0x5')];_0x2fcf83<_0x106589;_0x2fcf83++){var _0x4d5e4f=events[_0x2fcf83];var _0x250411=createListener('mailQueue:'+_0x4d5e4f,_0x500d21);MailQueueEvents['on'](_0x4d5e4f,_0x250411);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 534be35..93306a2 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 _0x8560=['isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','index'];(function(_0x2706b8,_0x11e4a2){var _0x200cd0=function(_0x193ffe){while(--_0x193ffe){_0x2706b8['push'](_0x2706b8['shift']());}};_0x200cd0(++_0x11e4a2);}(_0x8560,0x1d9));var _0x0856=function(_0x8dc04d,_0xaa7559){_0x8dc04d=_0x8dc04d-0x0;var _0x2f5f28=_0x8560[_0x8dc04d];return _0x2f5f28;};'use strict';var multer=require(_0x0856('0x0'));var util=require(_0x0856('0x1'));var path=require(_0x0856('0x2'));var timeout=require('connect-timeout');var express=require(_0x0856('0x3'));var router=express[_0x0856('0x4')]();var auth=require(_0x0856('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0856('0x6'));var controller=require(_0x0856('0x7'));router[_0x0856('0x8')]('/',auth['isAuthenticated'](),controller[_0x0856('0x9')]);router[_0x0856('0x8')]('/describe',auth[_0x0856('0xa')](),controller[_0x0856('0xb')]);router[_0x0856('0x8')]('/:id',auth[_0x0856('0xa')](),controller[_0x0856('0xc')]);router[_0x0856('0xd')]('/',auth['isAuthenticated'](),controller[_0x0856('0xe')]);router[_0x0856('0xf')](_0x0856('0x10'),auth['isAuthenticated'](),controller[_0x0856('0x11')]);router[_0x0856('0x12')](_0x0856('0x10'),auth[_0x0856('0xa')](),controller[_0x0856('0x13')]);module[_0x0856('0x14')]=router; \ No newline at end of file +var _0x133e=['isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','/describe','/:id'];(function(_0x11b070,_0x3ec9f3){var _0xebba40=function(_0x2aacfe){while(--_0x2aacfe){_0x11b070['push'](_0x11b070['shift']());}};_0xebba40(++_0x3ec9f3);}(_0x133e,0xc6));var _0xe133=function(_0x1b4002,_0x5b4094){_0x1b4002=_0x1b4002-0x0;var _0x1716f3=_0x133e[_0x1b4002];return _0x1716f3;};'use strict';var multer=require(_0xe133('0x0'));var util=require(_0xe133('0x1'));var path=require(_0xe133('0x2'));var timeout=require(_0xe133('0x3'));var express=require(_0xe133('0x4'));var router=express[_0xe133('0x5')]();var auth=require(_0xe133('0x6'));var interaction=require(_0xe133('0x7'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0xe133('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe133('0x8')](_0xe133('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xe133('0x8')](_0xe133('0xa'),auth[_0xe133('0xb')](),controller[_0xe133('0xc')]);router[_0xe133('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe133('0xe')](_0xe133('0xa'),auth['isAuthenticated'](),controller[_0xe133('0xf')]);router[_0xe133('0x10')](_0xe133('0xa'),auth[_0xe133('0xb')](),controller[_0xe133('0x11')]);module[_0xe133('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index d6987a5..d1ec7cc 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 _0x386e=['exports','STRING','DATE','moment'];(function(_0x590b61,_0x4c4335){var _0x1a14dc=function(_0x2ff4f6){while(--_0x2ff4f6){_0x590b61['push'](_0x590b61['shift']());}};_0x1a14dc(++_0x4c4335);}(_0x386e,0x1e3));var _0xe386=function(_0x2a863f,_0x3e7a74){_0x2a863f=_0x2a863f-0x0;var _0x525dac=_0x386e[_0x2a863f];return _0x525dac;};'use strict';var moment=require(_0xe386('0x0'));var Sequelize=require('sequelize');module[_0xe386('0x1')]={'uniqueid':{'type':Sequelize[_0xe386('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe386('0x2')]},'joinAt':{'type':Sequelize[_0xe386('0x3')]},'leaveAt':{'type':Sequelize[_0xe386('0x3')]},'acceptAt':{'type':Sequelize[_0xe386('0x3')]},'exitAt':{'type':Sequelize[_0xe386('0x3')]},'reason':{'type':Sequelize[_0xe386('0x2')]}}; \ No newline at end of file +var _0xa3cf=['DATE','sequelize','exports','STRING'];(function(_0x45f6b4,_0x18e4b0){var _0x27113b=function(_0xd7003){while(--_0xd7003){_0x45f6b4['push'](_0x45f6b4['shift']());}};_0x27113b(++_0x18e4b0);}(_0xa3cf,0xa5));var _0xfa3c=function(_0x395249,_0xc4b2e0){_0x395249=_0x395249-0x0;var _0x56a8e5=_0xa3cf[_0x395249];return _0x56a8e5;};'use strict';var moment=require('moment');var Sequelize=require(_0xfa3c('0x0'));module[_0xfa3c('0x1')]={'uniqueid':{'type':Sequelize[_0xfa3c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xfa3c('0x2')]},'joinAt':{'type':Sequelize[_0xfa3c('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xfa3c('0x3')]},'exitAt':{'type':Sequelize[_0xfa3c('0x3')]},'reason':{'type':Sequelize[_0xfa3c('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 3b2e4b9..9e80846 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 _0x60b4=['find','describe','html-pdf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','apply','reject','save','destroy','then','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','update'];(function(_0x1416f7,_0x50b1d5){var _0x1e8f96=function(_0x2fc808){while(--_0x2fc808){_0x1416f7['push'](_0x1416f7['shift']());}};_0x1e8f96(++_0x50b1d5);}(_0x60b4,0x126));var _0x460b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x60b4[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x460b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x460b('0x1'));var jsonpatch=require(_0x460b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x460b('0x3'));var util=require(_0x460b('0x4'));var path=require(_0x460b('0x5'));var sox=require(_0x460b('0x6'));var csv=require(_0x460b('0x7'));var ejs=require(_0x460b('0x8'));var fs=require('fs');var _=require(_0x460b('0x9'));var squel=require(_0x460b('0xa'));var crypto=require(_0x460b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x460b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x460b('0xd'));var Papa=require('papaparse');var Redis=require(_0x460b('0xe'));var authService=require(_0x460b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x460b('0x10'));var hardwareService=require(_0x460b('0x11'));var logger=require(_0x460b('0x12'))(_0x460b('0x13'));var utils=require(_0x460b('0x14'));var config=require(_0x460b('0x15'));var licenseUtil=require(_0x460b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30d7cf,_0x37ae54){_0x37ae54=_0x37ae54||0xcc;return function(_0x1819f1){if(_0x1819f1){return _0x30d7cf[_0x460b('0x17')](_0x37ae54);}return _0x30d7cf[_0x460b('0x18')](_0x37ae54)[_0x460b('0x19')]();};}function respondWithResult(_0x185b92,_0x20f93e){_0x20f93e=_0x20f93e||0xc8;return function(_0x451fbf){if(_0x451fbf){return _0x185b92[_0x460b('0x18')](_0x20f93e)[_0x460b('0x1a')](_0x451fbf);}};}function respondWithFilteredResult(_0x2a7a64,_0x3275b1){return function(_0x3ab735){if(_0x3ab735){var _0x63056d=_0x3ab735[_0x460b('0x1b')],_0x3a8bfd=_0x3275b1[_0x460b('0x1c')],_0x5afd24=_0x3275b1[_0x460b('0x1c')]+_0x3275b1[_0x460b('0x1d')],_0x579392;if(_0x5afd24>=_0x63056d){_0x5afd24=_0x63056d;_0x579392=0xc8;}else{_0x579392=0xce;}_0x2a7a64[_0x460b('0x18')](_0x579392);return _0x2a7a64['set']('Content-Range',_0x3a8bfd+'-'+_0x5afd24+'/'+_0x63056d)[_0x460b('0x1a')](_0x3ab735);}return null;};}function patchUpdates(_0x20921f){return function(_0x1eff4e){try{jsonpatch[_0x460b('0x1e')](_0x1eff4e,_0x20921f,!![]);}catch(_0x4be762){return BPromise[_0x460b('0x1f')](_0x4be762);}return _0x1eff4e[_0x460b('0x20')]();};}function saveUpdates(_0x2e11be,_0x55b01f){return function(_0x3e1b12){if(_0x3e1b12){return _0x3e1b12['update'](_0x2e11be)['then'](function(_0x3500f6){return _0x3500f6;});}return null;};}function removeEntity(_0x2e82e0,_0x236706){return function(_0x25fc67){if(_0x25fc67){return _0x25fc67[_0x460b('0x21')]()[_0x460b('0x22')](function(){_0x2e82e0[_0x460b('0x18')](0xcc)[_0x460b('0x19')]();});}};}function handleEntityNotFound(_0x49609b,_0x472f08){return function(_0x49d665){if(!_0x49d665){_0x49609b[_0x460b('0x17')](0x194);}return _0x49d665;};}function handleError(_0x7d74ff,_0x535ea0){_0x535ea0=_0x535ea0||0x1f4;return function(_0x1dc3df){logger['error'](_0x1dc3df['stack']);if(_0x1dc3df[_0x460b('0x23')]){delete _0x1dc3df[_0x460b('0x23')];}_0x7d74ff[_0x460b('0x18')](_0x535ea0)[_0x460b('0x24')](_0x1dc3df);};}exports[_0x460b('0x25')]=function(_0x3bc4dc,_0x5d0108){var _0x5ed53c={},_0x58039d={},_0x1ece4c={'count':0x0,'rows':[]};var _0x1b5041=_[_0x460b('0x26')](db[_0x460b('0x27')][_0x460b('0x28')],function(_0x62d0aa){return{'name':_0x62d0aa[_0x460b('0x29')],'type':_0x62d0aa[_0x460b('0x2a')][_0x460b('0x2b')]};});_0x58039d[_0x460b('0x2c')]=_[_0x460b('0x26')](_0x1b5041,_0x460b('0x23'));_0x58039d[_0x460b('0x2d')]=_[_0x460b('0x2e')](_0x3bc4dc[_0x460b('0x2d')]);_0x58039d[_0x460b('0x2f')]=_['intersection'](_0x58039d[_0x460b('0x2c')],_0x58039d[_0x460b('0x2d')]);_0x5ed53c[_0x460b('0x30')]=_[_0x460b('0x31')](_0x58039d['model'],qs[_0x460b('0x32')](_0x3bc4dc[_0x460b('0x2d')][_0x460b('0x32')]));_0x5ed53c[_0x460b('0x30')]=_0x5ed53c[_0x460b('0x30')][_0x460b('0x33')]?_0x5ed53c[_0x460b('0x30')]:_0x58039d[_0x460b('0x2c')];if(!_0x3bc4dc[_0x460b('0x2d')][_0x460b('0x34')]('nolimit')){_0x5ed53c[_0x460b('0x1d')]=qs['limit'](_0x3bc4dc[_0x460b('0x2d')]['limit']);_0x5ed53c['offset']=qs[_0x460b('0x1c')](_0x3bc4dc['query']['offset']);}_0x5ed53c[_0x460b('0x35')]=qs[_0x460b('0x36')](_0x3bc4dc[_0x460b('0x2d')][_0x460b('0x36')]);_0x5ed53c['where']=qs[_0x460b('0x2f')](_[_0x460b('0x37')](_0x3bc4dc[_0x460b('0x2d')],_0x58039d[_0x460b('0x2f')]),_0x1b5041);if(_0x3bc4dc[_0x460b('0x2d')][_0x460b('0x38')]){_0x5ed53c[_0x460b('0x39')]=_[_0x460b('0x3a')](_0x5ed53c[_0x460b('0x39')],{'$or':_[_0x460b('0x26')](_0x1b5041,function(_0x61370b){if(_0x61370b[_0x460b('0x2a')]!==_0x460b('0x3b')){var _0x2dfe0c={};_0x2dfe0c[_0x61370b['name']]={'$like':'%'+_0x3bc4dc['query'][_0x460b('0x38')]+'%'};return _0x2dfe0c;}})});}_0x5ed53c=_[_0x460b('0x3a')]({},_0x5ed53c,_0x3bc4dc[_0x460b('0x3c')]);var _0x470b91={'where':_0x5ed53c[_0x460b('0x39')]};return db[_0x460b('0x27')][_0x460b('0x1b')](_0x470b91)[_0x460b('0x22')](function(_0x5f4b6e){_0x1ece4c[_0x460b('0x1b')]=_0x5f4b6e;if(_0x3bc4dc[_0x460b('0x2d')][_0x460b('0x3d')]){_0x5ed53c[_0x460b('0x3e')]=[{'all':!![]}];}return db[_0x460b('0x27')][_0x460b('0x3f')](_0x5ed53c);})[_0x460b('0x22')](function(_0x3a8308){_0x1ece4c[_0x460b('0x40')]=_0x3a8308;return _0x1ece4c;})[_0x460b('0x22')](respondWithFilteredResult(_0x5d0108,_0x5ed53c))[_0x460b('0x41')](handleError(_0x5d0108,null));};exports[_0x460b('0x42')]=function(_0x38f999,_0x43304e){var _0x4b6c9b={'raw':!![],'where':{'id':_0x38f999[_0x460b('0x43')]['id']}},_0x160892={};_0x160892[_0x460b('0x2c')]=_[_0x460b('0x2e')](db[_0x460b('0x27')][_0x460b('0x28')]);_0x160892[_0x460b('0x2d')]=_[_0x460b('0x2e')](_0x38f999[_0x460b('0x2d')]);_0x160892[_0x460b('0x2f')]=_[_0x460b('0x31')](_0x160892['model'],_0x160892[_0x460b('0x2d')]);_0x4b6c9b[_0x460b('0x30')]=_[_0x460b('0x31')](_0x160892[_0x460b('0x2c')],qs[_0x460b('0x32')](_0x38f999['query'][_0x460b('0x32')]));_0x4b6c9b[_0x460b('0x30')]=_0x4b6c9b['attributes'][_0x460b('0x33')]?_0x4b6c9b[_0x460b('0x30')]:_0x160892['model'];if(_0x38f999[_0x460b('0x2d')]['includeAll']){_0x4b6c9b[_0x460b('0x3e')]=[{'all':!![]}];}_0x4b6c9b=_[_0x460b('0x3a')]({},_0x4b6c9b,_0x38f999[_0x460b('0x3c')]);return db[_0x460b('0x27')]['find'](_0x4b6c9b)['then'](handleEntityNotFound(_0x43304e,null))[_0x460b('0x22')](respondWithResult(_0x43304e,null))['catch'](handleError(_0x43304e,null));};exports[_0x460b('0x44')]=function(_0x2cb794,_0x36006c){return db[_0x460b('0x27')][_0x460b('0x44')](_0x2cb794[_0x460b('0x45')],{})[_0x460b('0x22')](respondWithResult(_0x36006c,0xc9))[_0x460b('0x41')](handleError(_0x36006c,null));};exports[_0x460b('0x46')]=function(_0x38d950,_0x249ffc){if(_0x38d950[_0x460b('0x45')]['id']){delete _0x38d950[_0x460b('0x45')]['id'];}return db[_0x460b('0x27')][_0x460b('0x47')]({'where':{'id':_0x38d950[_0x460b('0x43')]['id']}})[_0x460b('0x22')](handleEntityNotFound(_0x249ffc,null))[_0x460b('0x22')](saveUpdates(_0x38d950[_0x460b('0x45')],null))['then'](respondWithResult(_0x249ffc,null))[_0x460b('0x41')](handleError(_0x249ffc,null));};exports[_0x460b('0x21')]=function(_0x414075,_0x468e28){return db[_0x460b('0x27')]['find']({'where':{'id':_0x414075[_0x460b('0x43')]['id']}})[_0x460b('0x22')](handleEntityNotFound(_0x468e28,null))[_0x460b('0x22')](removeEntity(_0x468e28,null))[_0x460b('0x41')](handleError(_0x468e28,null));};exports['describe']=function(_0x1c4323,_0x23c43e){return db[_0x460b('0x27')][_0x460b('0x48')]()[_0x460b('0x22')](respondWithResult(_0x23c43e,null))[_0x460b('0x41')](handleError(_0x23c43e,null));}; \ No newline at end of file +var _0x038d=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','type','model','query','intersection','fields','attributes','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','MailQueueReport','keys','length','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','querystring'];(function(_0x233536,_0x254285){var _0x12204c=function(_0x3f0a45){while(--_0x3f0a45){_0x233536['push'](_0x233536['shift']());}};_0x12204c(++_0x254285);}(_0x038d,0x84));var _0xd038=function(_0x4383a1,_0x265f12){_0x4383a1=_0x4383a1-0x0;var _0x8e9d28=_0x038d[_0x4383a1];return _0x8e9d28;};'use strict';var pdf=require(_0xd038('0x0'));var emlformat=require(_0xd038('0x1'));var rimraf=require(_0xd038('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd038('0x3'));var rp=require(_0xd038('0x4'));var moment=require('moment');var BPromise=require(_0xd038('0x5'));var Mustache=require('mustache');var util=require(_0xd038('0x6'));var path=require(_0xd038('0x7'));var sox=require('sox');var csv=require(_0xd038('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd038('0x9'));var squel=require(_0xd038('0xa'));var crypto=require(_0xd038('0xb'));var jsforce=require(_0xd038('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd038('0xd'));var Papa=require(_0xd038('0xe'));var Redis=require(_0xd038('0xf'));var authService=require(_0xd038('0x10'));var qs=require(_0xd038('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd038('0x12'));var logger=require(_0xd038('0x13'))(_0xd038('0x14'));var utils=require(_0xd038('0x15'));var config=require(_0xd038('0x16'));var licenseUtil=require(_0xd038('0x17'));var db=require(_0xd038('0x18'))['db'];function respondWithStatusCode(_0x56b227,_0x3c4741){_0x3c4741=_0x3c4741||0xcc;return function(_0x195f52){if(_0x195f52){return _0x56b227[_0xd038('0x19')](_0x3c4741);}return _0x56b227[_0xd038('0x1a')](_0x3c4741)['end']();};}function respondWithResult(_0x5ec282,_0x4ca814){_0x4ca814=_0x4ca814||0xc8;return function(_0x470c01){if(_0x470c01){return _0x5ec282[_0xd038('0x1a')](_0x4ca814)['json'](_0x470c01);}};}function respondWithFilteredResult(_0x2da292,_0x19f6f4){return function(_0x446f20){if(_0x446f20){var _0x168af1=_0x446f20['count'],_0x2678e7=_0x19f6f4[_0xd038('0x1b')],_0x193d25=_0x19f6f4['offset']+_0x19f6f4[_0xd038('0x1c')],_0x1d17d0;if(_0x193d25>=_0x168af1){_0x193d25=_0x168af1;_0x1d17d0=0xc8;}else{_0x1d17d0=0xce;}_0x2da292['status'](_0x1d17d0);return _0x2da292[_0xd038('0x1d')](_0xd038('0x1e'),_0x2678e7+'-'+_0x193d25+'/'+_0x168af1)[_0xd038('0x1f')](_0x446f20);}return null;};}function patchUpdates(_0x33ea0a){return function(_0xa2ef3){try{jsonpatch[_0xd038('0x20')](_0xa2ef3,_0x33ea0a,!![]);}catch(_0xc6eae2){return BPromise[_0xd038('0x21')](_0xc6eae2);}return _0xa2ef3[_0xd038('0x22')]();};}function saveUpdates(_0x14f717,_0x4b0fce){return function(_0x5c62d8){if(_0x5c62d8){return _0x5c62d8[_0xd038('0x23')](_0x14f717)[_0xd038('0x24')](function(_0x8ee391){return _0x8ee391;});}return null;};}function removeEntity(_0x51b537,_0x8506c7){return function(_0x29c1fb){if(_0x29c1fb){return _0x29c1fb[_0xd038('0x25')]()[_0xd038('0x24')](function(){_0x51b537['status'](0xcc)[_0xd038('0x26')]();});}};}function handleEntityNotFound(_0x13302c,_0x238a63){return function(_0xbb74e){if(!_0xbb74e){_0x13302c['sendStatus'](0x194);}return _0xbb74e;};}function handleError(_0x266aac,_0x3bea7c){_0x3bea7c=_0x3bea7c||0x1f4;return function(_0x3d963d){logger[_0xd038('0x27')](_0x3d963d[_0xd038('0x28')]);if(_0x3d963d[_0xd038('0x29')]){delete _0x3d963d[_0xd038('0x29')];}_0x266aac['status'](_0x3bea7c)['send'](_0x3d963d);};}exports[_0xd038('0x2a')]=function(_0x19acdc,_0x3aa54c){var _0xeb569b={},_0x2d5c2c={},_0x41d317={'count':0x0,'rows':[]};var _0x16eb3d=_[_0xd038('0x2b')](db['MailQueueReport']['rawAttributes'],function(_0x30c8d5){return{'name':_0x30c8d5['fieldName'],'type':_0x30c8d5[_0xd038('0x2c')]['key']};});_0x2d5c2c[_0xd038('0x2d')]=_[_0xd038('0x2b')](_0x16eb3d,_0xd038('0x29'));_0x2d5c2c['query']=_['keys'](_0x19acdc[_0xd038('0x2e')]);_0x2d5c2c['filters']=_[_0xd038('0x2f')](_0x2d5c2c[_0xd038('0x2d')],_0x2d5c2c[_0xd038('0x2e')]);_0xeb569b['attributes']=_['intersection'](_0x2d5c2c[_0xd038('0x2d')],qs[_0xd038('0x30')](_0x19acdc[_0xd038('0x2e')][_0xd038('0x30')]));_0xeb569b[_0xd038('0x31')]=_0xeb569b[_0xd038('0x31')]['length']?_0xeb569b[_0xd038('0x31')]:_0x2d5c2c[_0xd038('0x2d')];if(!_0x19acdc['query']['hasOwnProperty'](_0xd038('0x32'))){_0xeb569b[_0xd038('0x1c')]=qs[_0xd038('0x1c')](_0x19acdc[_0xd038('0x2e')][_0xd038('0x1c')]);_0xeb569b[_0xd038('0x1b')]=qs[_0xd038('0x1b')](_0x19acdc[_0xd038('0x2e')][_0xd038('0x1b')]);}_0xeb569b[_0xd038('0x33')]=qs[_0xd038('0x34')](_0x19acdc[_0xd038('0x2e')][_0xd038('0x34')]);_0xeb569b[_0xd038('0x35')]=qs[_0xd038('0x36')](_['pick'](_0x19acdc['query'],_0x2d5c2c[_0xd038('0x36')]),_0x16eb3d);if(_0x19acdc[_0xd038('0x2e')][_0xd038('0x37')]){_0xeb569b['where']=_[_0xd038('0x38')](_0xeb569b['where'],{'$or':_[_0xd038('0x2b')](_0x16eb3d,function(_0x5d1ab0){if(_0x5d1ab0[_0xd038('0x2c')]!==_0xd038('0x39')){var _0x4552bf={};_0x4552bf[_0x5d1ab0[_0xd038('0x29')]]={'$like':'%'+_0x19acdc['query'][_0xd038('0x37')]+'%'};return _0x4552bf;}})});}_0xeb569b=_[_0xd038('0x38')]({},_0xeb569b,_0x19acdc[_0xd038('0x3a')]);var _0x268aeb={'where':_0xeb569b[_0xd038('0x35')]};return db['MailQueueReport'][_0xd038('0x3b')](_0x268aeb)[_0xd038('0x24')](function(_0x44a1fc){_0x41d317['count']=_0x44a1fc;if(_0x19acdc['query'][_0xd038('0x3c')]){_0xeb569b[_0xd038('0x3d')]=[{'all':!![]}];}return db['MailQueueReport'][_0xd038('0x3e')](_0xeb569b);})[_0xd038('0x24')](function(_0x3a5667){_0x41d317[_0xd038('0x3f')]=_0x3a5667;return _0x41d317;})[_0xd038('0x24')](respondWithFilteredResult(_0x3aa54c,_0xeb569b))[_0xd038('0x40')](handleError(_0x3aa54c,null));};exports['show']=function(_0x1684a7,_0x1f837f){var _0x507c32={'raw':!![],'where':{'id':_0x1684a7[_0xd038('0x41')]['id']}},_0x3eb581={};_0x3eb581[_0xd038('0x2d')]=_['keys'](db[_0xd038('0x42')]['rawAttributes']);_0x3eb581[_0xd038('0x2e')]=_[_0xd038('0x43')](_0x1684a7[_0xd038('0x2e')]);_0x3eb581['filters']=_[_0xd038('0x2f')](_0x3eb581[_0xd038('0x2d')],_0x3eb581[_0xd038('0x2e')]);_0x507c32[_0xd038('0x31')]=_[_0xd038('0x2f')](_0x3eb581[_0xd038('0x2d')],qs[_0xd038('0x30')](_0x1684a7[_0xd038('0x2e')][_0xd038('0x30')]));_0x507c32['attributes']=_0x507c32[_0xd038('0x31')][_0xd038('0x44')]?_0x507c32[_0xd038('0x31')]:_0x3eb581[_0xd038('0x2d')];if(_0x1684a7[_0xd038('0x2e')][_0xd038('0x3c')]){_0x507c32['include']=[{'all':!![]}];}_0x507c32=_['merge']({},_0x507c32,_0x1684a7[_0xd038('0x3a')]);return db[_0xd038('0x42')][_0xd038('0x45')](_0x507c32)[_0xd038('0x24')](handleEntityNotFound(_0x1f837f,null))[_0xd038('0x24')](respondWithResult(_0x1f837f,null))[_0xd038('0x40')](handleError(_0x1f837f,null));};exports[_0xd038('0x46')]=function(_0x167f5d,_0x42a6bf){return db[_0xd038('0x42')][_0xd038('0x46')](_0x167f5d[_0xd038('0x47')],{})[_0xd038('0x24')](respondWithResult(_0x42a6bf,0xc9))[_0xd038('0x40')](handleError(_0x42a6bf,null));};exports['update']=function(_0x197be7,_0x1a0164){if(_0x197be7['body']['id']){delete _0x197be7['body']['id'];}return db[_0xd038('0x42')][_0xd038('0x45')]({'where':{'id':_0x197be7[_0xd038('0x41')]['id']}})[_0xd038('0x24')](handleEntityNotFound(_0x1a0164,null))['then'](saveUpdates(_0x197be7[_0xd038('0x47')],null))[_0xd038('0x24')](respondWithResult(_0x1a0164,null))[_0xd038('0x40')](handleError(_0x1a0164,null));};exports[_0xd038('0x25')]=function(_0x1b97d7,_0xd6cd9f){return db['MailQueueReport'][_0xd038('0x45')]({'where':{'id':_0x1b97d7[_0xd038('0x41')]['id']}})[_0xd038('0x24')](handleEntityNotFound(_0xd6cd9f,null))[_0xd038('0x24')](removeEntity(_0xd6cd9f,null))[_0xd038('0x40')](handleError(_0xd6cd9f,null));};exports[_0xd038('0x48')]=function(_0xf35d4c,_0x5921a0){return db['MailQueueReport'][_0xd038('0x48')]()[_0xd038('0x24')](respondWithResult(_0x5921a0,null))['catch'](handleError(_0x5921a0,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 57ef255..c96fed9 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 _0x54b2=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger'];(function(_0x4fd030,_0x564597){var _0x580818=function(_0x168978){while(--_0x168978){_0x4fd030['push'](_0x4fd030['shift']());}};_0x580818(++_0x564597);}(_0x54b2,0x6e));var _0x254b=function(_0x219711,_0x2a9fb6){_0x219711=_0x219711-0x0;var _0x5a02ee=_0x54b2[_0x219711];return _0x5a02ee;};'use strict';var _=require(_0x254b('0x0'));var util=require('util');var logger=require(_0x254b('0x1'))(_0x254b('0x2'));var moment=require(_0x254b('0x3'));var BPromise=require(_0x254b('0x4'));var rp=require(_0x254b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x254b('0x6'));var config=require(_0x254b('0x7'));var attributes=require(_0x254b('0x8'));module[_0x254b('0x9')]=function(_0x106c90,_0x48e16a){return _0x106c90[_0x254b('0xa')](_0x254b('0xb'),attributes,{'tableName':_0x254b('0xc'),'paranoid':![],'indexes':[{'name':_0x254b('0xd'),'fields':[_0x254b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6b45=['request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x6b45,0xb0));var _0x56b4=function(_0x3be32c,_0x4e30f3){_0x3be32c=_0x3be32c-0x0;var _0x5270d9=_0x6b45[_0x3be32c];return _0x5270d9;};'use strict';var _=require(_0x56b4('0x0'));var util=require(_0x56b4('0x1'));var logger=require(_0x56b4('0x2'))(_0x56b4('0x3'));var moment=require(_0x56b4('0x4'));var BPromise=require(_0x56b4('0x5'));var rp=require(_0x56b4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x56b4('0x7'));var config=require(_0x56b4('0x8'));var attributes=require(_0x56b4('0x9'));module[_0x56b4('0xa')]=function(_0x1c027b,_0x203c5e){return _0x1c027b[_0x56b4('0xb')]('MailQueueReport',attributes,{'tableName':_0x56b4('0xc'),'paranoid':![],'indexes':[{'name':_0x56b4('0xd'),'fields':[_0x56b4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 7b6e978..07e0ca5 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 _0x955d=['request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','create','options','raw','stringify','UpdateMailQueueReport','update','body','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailQueueReport,\x20%s,\x20%s'];(function(_0x2ab1f,_0x2ed032){var _0x406920=function(_0x433625){while(--_0x433625){_0x2ab1f['push'](_0x2ab1f['shift']());}};_0x406920(++_0x2ed032);}(_0x955d,0xa3));var _0xd955=function(_0x19836c,_0x137539){_0x19836c=_0x19836c-0x0;var _0x4d0420=_0x955d[_0x19836c];return _0x4d0420;};'use strict';var _=require(_0xd955('0x0'));var util=require(_0xd955('0x1'));var moment=require(_0xd955('0x2'));var BPromise=require(_0xd955('0x3'));var rs=require(_0xd955('0x4'));var fs=require('fs');var Redis=require(_0xd955('0x5'));var db=require(_0xd955('0x6'))['db'];var utils=require(_0xd955('0x7'));var logger=require(_0xd955('0x8'))(_0xd955('0x9'));var config=require(_0xd955('0xa'));var jayson=require(_0xd955('0xb'));var client=jayson[_0xd955('0xc')][_0xd955('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x39dd6a,_0x3efc83,_0x10a815){return new BPromise(function(_0x53bfa6,_0x2725ee){return client['request'](_0x39dd6a,_0x10a815)[_0xd955('0xe')](function(_0x5dc1cf){logger[_0xd955('0xf')](_0xd955('0x10'),_0x3efc83,_0xd955('0x11'));logger[_0xd955('0x12')](_0xd955('0x13'),_0x3efc83,_0xd955('0x11'),JSON['stringify'](_0x5dc1cf));if(_0x5dc1cf[_0xd955('0x14')]){if(_0x5dc1cf['error'][_0xd955('0x15')]===0x1f4){logger[_0xd955('0x14')](_0xd955('0x10'),_0x3efc83,_0x5dc1cf[_0xd955('0x14')][_0xd955('0x16')]);return _0x2725ee(_0x5dc1cf['error'][_0xd955('0x16')]);}logger['error']('MailQueueReport,\x20%s,\x20%s',_0x3efc83,_0x5dc1cf['error'][_0xd955('0x16')]);return _0x53bfa6(_0x5dc1cf['error']['message']);}else{logger['info']('MailQueueReport,\x20%s,\x20%s',_0x3efc83,'request\x20sent');_0x53bfa6(_0x5dc1cf[_0xd955('0x17')]['message']);}})[_0xd955('0x18')](function(_0x41fd30){logger[_0xd955('0x14')]('MailQueueReport,\x20%s,\x20%s',_0x3efc83,_0x41fd30);_0x2725ee(_0x41fd30);});});}exports[_0xd955('0x19')]=function(_0xc72942){var _0x3a0092=this;return new Promise(function(_0x4508d3,_0x426eb1){return db[_0xd955('0x1a')][_0xd955('0x1b')](_0xc72942['body'],{'raw':_0xc72942[_0xd955('0x1c')]?_0xc72942['options'][_0xd955('0x1d')]===undefined?!![]:![]:!![]})[_0xd955('0xe')](function(_0x192e5f){logger[_0xd955('0xf')](_0xd955('0x19'),_0xc72942);logger[_0xd955('0x12')](_0xd955('0x19'),_0xc72942,JSON[_0xd955('0x1e')](_0x192e5f));_0x4508d3(_0x192e5f);})[_0xd955('0x18')](function(_0xcff4f0){logger[_0xd955('0x14')](_0xd955('0x19'),_0xcff4f0[_0xd955('0x16')],_0xc72942);_0x426eb1(_0x3a0092['error'](0x1f4,_0xcff4f0[_0xd955('0x16')]));});});};exports[_0xd955('0x1f')]=function(_0x87195f){var _0x976006=this;return new Promise(function(_0x1aa76a,_0x494e63){return db['MailQueueReport'][_0xd955('0x20')](_0x87195f[_0xd955('0x21')],{'raw':_0x87195f[_0xd955('0x1c')]?_0x87195f[_0xd955('0x1c')][_0xd955('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x87195f[_0xd955('0x1c')]?_0x87195f['options']['where']||null:null,'attributes':_0x87195f[_0xd955('0x1c')]?_0x87195f[_0xd955('0x1c')][_0xd955('0x22')]||null:null,'limit':_0x87195f['options']?_0x87195f[_0xd955('0x1c')][_0xd955('0x23')]||null:null})[_0xd955('0xe')](function(_0x31b0b9){logger[_0xd955('0xf')](_0xd955('0x1f'),_0x87195f);logger[_0xd955('0x12')](_0xd955('0x1f'),_0x87195f,JSON[_0xd955('0x1e')](_0x31b0b9));_0x1aa76a(_0x31b0b9);})[_0xd955('0x18')](function(_0x2e7ba0){logger[_0xd955('0x14')](_0xd955('0x1f'),_0x2e7ba0[_0xd955('0x16')],_0x87195f);_0x494e63(_0x976006[_0xd955('0x14')](0x1f4,_0x2e7ba0[_0xd955('0x16')]));});});}; \ No newline at end of file +var _0x15b5=['MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MailQueueReport','create','options','debug','CreateMailQueueReport','where','attributes','UpdateMailQueueReport','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x15b5,0x138));var _0x515b=function(_0x4bb2b9,_0x459c78){_0x4bb2b9=_0x4bb2b9-0x0;var _0x40e2a2=_0x15b5[_0x4bb2b9];return _0x40e2a2;};'use strict';var _=require('lodash');var util=require(_0x515b('0x0'));var moment=require(_0x515b('0x1'));var BPromise=require(_0x515b('0x2'));var rs=require(_0x515b('0x3'));var fs=require('fs');var Redis=require(_0x515b('0x4'));var db=require(_0x515b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x515b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x30241d,_0x5a1625,_0x598a56){return new BPromise(function(_0x54e286,_0x4bb639){return client[_0x515b('0x7')](_0x30241d,_0x598a56)[_0x515b('0x8')](function(_0x47696d){logger[_0x515b('0x9')](_0x515b('0xa'),_0x5a1625,_0x515b('0xb'));logger['debug'](_0x515b('0xc'),_0x5a1625,'request\x20sent',JSON['stringify'](_0x47696d));if(_0x47696d[_0x515b('0xd')]){if(_0x47696d['error'][_0x515b('0xe')]===0x1f4){logger[_0x515b('0xd')](_0x515b('0xa'),_0x5a1625,_0x47696d[_0x515b('0xd')][_0x515b('0xf')]);return _0x4bb639(_0x47696d[_0x515b('0xd')][_0x515b('0xf')]);}logger[_0x515b('0xd')](_0x515b('0xa'),_0x5a1625,_0x47696d[_0x515b('0xd')][_0x515b('0xf')]);return _0x54e286(_0x47696d[_0x515b('0xd')]['message']);}else{logger['info'](_0x515b('0xa'),_0x5a1625,'request\x20sent');_0x54e286(_0x47696d[_0x515b('0x10')][_0x515b('0xf')]);}})[_0x515b('0x11')](function(_0x43d556){logger['error'](_0x515b('0xa'),_0x5a1625,_0x43d556);_0x4bb639(_0x43d556);});});}exports['CreateMailQueueReport']=function(_0x58643e){var _0x338a36=this;return new Promise(function(_0x2c557f,_0x5dcb57){return db[_0x515b('0x12')][_0x515b('0x13')](_0x58643e['body'],{'raw':_0x58643e[_0x515b('0x14')]?_0x58643e[_0x515b('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x515b('0x8')](function(_0x58d97e){logger[_0x515b('0x9')]('CreateMailQueueReport',_0x58643e);logger[_0x515b('0x15')](_0x515b('0x16'),_0x58643e,JSON['stringify'](_0x58d97e));_0x2c557f(_0x58d97e);})[_0x515b('0x11')](function(_0x34c4bd){logger[_0x515b('0xd')](_0x515b('0x16'),_0x34c4bd[_0x515b('0xf')],_0x58643e);_0x5dcb57(_0x338a36[_0x515b('0xd')](0x1f4,_0x34c4bd[_0x515b('0xf')]));});});};exports['UpdateMailQueueReport']=function(_0x381ab2){var _0x3173bd=this;return new Promise(function(_0xfda943,_0x350100){return db['MailQueueReport']['update'](_0x381ab2['body'],{'raw':_0x381ab2[_0x515b('0x14')]?_0x381ab2[_0x515b('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x381ab2[_0x515b('0x14')]?_0x381ab2[_0x515b('0x14')][_0x515b('0x17')]||null:null,'attributes':_0x381ab2['options']?_0x381ab2[_0x515b('0x14')][_0x515b('0x18')]||null:null,'limit':_0x381ab2[_0x515b('0x14')]?_0x381ab2['options']['limit']||null:null})['then'](function(_0x16f4b4){logger[_0x515b('0x9')]('UpdateMailQueueReport',_0x381ab2);logger['debug'](_0x515b('0x19'),_0x381ab2,JSON[_0x515b('0x1a')](_0x16f4b4));_0xfda943(_0x16f4b4);})['catch'](function(_0x4cee25){logger[_0x515b('0xd')](_0x515b('0x19'),_0x4cee25['message'],_0x381ab2);_0x350100(_0x3173bd[_0x515b('0xd')](0x1f4,_0x4cee25[_0x515b('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 5d4f9e0..7693e5f 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 _0x9fba=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','connect-timeout','express'];(function(_0x8a5a4a,_0x160a03){var _0x3907c4=function(_0x5332bf){while(--_0x5332bf){_0x8a5a4a['push'](_0x8a5a4a['shift']());}};_0x3907c4(++_0x160a03);}(_0x9fba,0x11b));var _0xa9fb=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x9fba[_0x33032e];return _0x13316b;};'use strict';var multer=require(_0xa9fb('0x0'));var util=require(_0xa9fb('0x1'));var path=require(_0xa9fb('0x2'));var timeout=require(_0xa9fb('0x3'));var express=require(_0xa9fb('0x4'));var router=express['Router']();var auth=require(_0xa9fb('0x5'));var interaction=require(_0xa9fb('0x6'));var config=require('../../config/environment');module[_0xa9fb('0x7')]=router; \ No newline at end of file +var _0xc17b=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x449853,_0x2f6bc6){var _0x4ec99e=function(_0x2d0206){while(--_0x2d0206){_0x449853['push'](_0x449853['shift']());}};_0x4ec99e(++_0x2f6bc6);}(_0xc17b,0x1e3));var _0xbc17=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xc17b[_0x5608a3];return _0x1ed50a;};'use strict';var multer=require(_0xbc17('0x0'));var util=require(_0xbc17('0x1'));var path=require(_0xbc17('0x2'));var timeout=require(_0xbc17('0x3'));var express=require('express');var router=express[_0xbc17('0x4')]();var auth=require(_0xbc17('0x5'));var interaction=require(_0xbc17('0x6'));var config=require(_0xbc17('0x7'));module[_0xbc17('0x8')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index def037a..14fd005 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 _0x9f24=['BOOLEAN','INTEGER','INBOX','STRING'];(function(_0x33be73,_0x59d750){var _0x2d1f91=function(_0x24f2e5){while(--_0x24f2e5){_0x33be73['push'](_0x33be73['shift']());}};_0x2d1f91(++_0x59d750);}(_0x9f24,0x183));var _0x49f2=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0x9f24[_0x47e549];return _0x251374;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x49f2('0x0')]},'host':{'type':Sequelize[_0x49f2('0x0')]},'authentication':{'type':Sequelize[_0x49f2('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0x49f2('0x0')],'unique':'username'},'password':{'type':Sequelize[_0x49f2('0x0')]},'port':{'type':Sequelize[_0x49f2('0x2')]},'tls':{'type':Sequelize[_0x49f2('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x49f2('0x0')],'defaultValue':_0x49f2('0x3')},'connTimeout':{'type':Sequelize[_0x49f2('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x49f2('0x0')]}}; \ No newline at end of file +var _0x29f8=['exports','STRING','username','BOOLEAN','INBOX','INTEGER','sequelize'];(function(_0x5c446e,_0x4418ba){var _0x3f8643=function(_0x24bf46){while(--_0x24bf46){_0x5c446e['push'](_0x5c446e['shift']());}};_0x3f8643(++_0x4418ba);}(_0x29f8,0x11e));var _0x829f=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x29f8[_0xbe200f];return _0x192597;};'use strict';var Sequelize=require(_0x829f('0x0'));module[_0x829f('0x1')]={'description':{'type':Sequelize[_0x829f('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x829f('0x2')],'unique':_0x829f('0x3')},'password':{'type':Sequelize[_0x829f('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x829f('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x829f('0x5')},'connTimeout':{'type':Sequelize[_0x829f('0x6')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x829f('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 5b38993..28122c4 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 _0x4cf8=['../../config/environment','./mailServerIn.attributes','exports','define','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x851b8e,_0x36e967){var _0x5690f5=function(_0x3b1feb){while(--_0x3b1feb){_0x851b8e['push'](_0x851b8e['shift']());}};_0x5690f5(++_0x36e967);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x8b0f43,_0x1c57b8){_0x8b0f43=_0x8b0f43-0x0;var _0x3f4425=_0x4cf8[_0x8b0f43];return _0x3f4425;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var logger=require(_0x84cf('0x2'))(_0x84cf('0x3'));var moment=require(_0x84cf('0x4'));var BPromise=require(_0x84cf('0x5'));var rp=require(_0x84cf('0x6'));var fs=require('fs');var path=require(_0x84cf('0x7'));var rimraf=require(_0x84cf('0x8'));var config=require(_0x84cf('0x9'));var attributes=require(_0x84cf('0xa'));module[_0x84cf('0xb')]=function(_0x50ade2,_0x4af3f1){return _0x50ade2[_0x84cf('0xc')]('MailServerIn',attributes,{'tableName':_0x84cf('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5fa=['exports','define','MailServerIn','mail_servers_in','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./mailServerIn.attributes'];(function(_0x4470b4,_0x2d1245){var _0x317e5a=function(_0x398e3d){while(--_0x398e3d){_0x4470b4['push'](_0x4470b4['shift']());}};_0x317e5a(++_0x2d1245);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x437545,_0x4ab48b){_0x437545=_0x437545-0x0;var _0x408060=_0xa5fa[_0x437545];return _0x408060;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var logger=require(_0xaa5f('0x1'))(_0xaa5f('0x2'));var moment=require(_0xaa5f('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa5f('0x4'));var fs=require('fs');var path=require(_0xaa5f('0x5'));var rimraf=require('rimraf');var config=require(_0xaa5f('0x6'));var attributes=require(_0xaa5f('0x7'));module[_0xaa5f('0x8')]=function(_0x20744d,_0x3d1489){return _0x20744d[_0xaa5f('0x9')](_0xaa5f('0xa'),attributes,{'tableName':_0xaa5f('0xb'),'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 e441604..8918d65 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 _0x1e8e=['include','map','model','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','attributes','limit'];(function(_0x47166c,_0x2167ec){var _0x6e3e93=function(_0x94e41e){while(--_0x94e41e){_0x47166c['push'](_0x47166c['shift']());}};_0x6e3e93(++_0x2167ec);}(_0x1e8e,0x1c3));var _0xe1e8=function(_0xb158f5,_0x58dde7){_0xb158f5=_0xb158f5-0x0;var _0x1d4409=_0x1e8e[_0xb158f5];return _0x1d4409;};'use strict';var _=require('lodash');var util=require(_0xe1e8('0x0'));var moment=require(_0xe1e8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe1e8('0x2'));var db=require(_0xe1e8('0x3'))['db'];var utils=require(_0xe1e8('0x4'));var logger=require(_0xe1e8('0x5'))(_0xe1e8('0x6'));var config=require('../../config/environment');var jayson=require(_0xe1e8('0x7'));var client=jayson[_0xe1e8('0x8')][_0xe1e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54354b,_0x5b516e,_0x18e38a){return new BPromise(function(_0x444261,_0x305efe){return client['request'](_0x54354b,_0x18e38a)[_0xe1e8('0xa')](function(_0x2dd7d4){logger[_0xe1e8('0xb')](_0xe1e8('0xc'),_0x5b516e,_0xe1e8('0xd'));logger[_0xe1e8('0xe')](_0xe1e8('0xf'),_0x5b516e,_0xe1e8('0xd'),JSON[_0xe1e8('0x10')](_0x2dd7d4));if(_0x2dd7d4[_0xe1e8('0x11')]){if(_0x2dd7d4[_0xe1e8('0x11')][_0xe1e8('0x12')]===0x1f4){logger[_0xe1e8('0x11')](_0xe1e8('0xc'),_0x5b516e,_0x2dd7d4['error'][_0xe1e8('0x13')]);return _0x305efe(_0x2dd7d4[_0xe1e8('0x11')][_0xe1e8('0x13')]);}logger['error'](_0xe1e8('0xc'),_0x5b516e,_0x2dd7d4[_0xe1e8('0x11')][_0xe1e8('0x13')]);return _0x444261(_0x2dd7d4[_0xe1e8('0x11')][_0xe1e8('0x13')]);}else{logger['info'](_0xe1e8('0xc'),_0x5b516e,'request\x20sent');_0x444261(_0x2dd7d4[_0xe1e8('0x14')][_0xe1e8('0x13')]);}})[_0xe1e8('0x15')](function(_0x1eb1b2){logger[_0xe1e8('0x11')](_0xe1e8('0xc'),_0x5b516e,_0x1eb1b2);_0x305efe(_0x1eb1b2);});});}exports[_0xe1e8('0x16')]=function(_0x232997){var _0x3bafb0=this;return new Promise(function(_0x3193da,_0x4a2f1a){return db[_0xe1e8('0x17')][_0xe1e8('0x18')]({'raw':_0x232997[_0xe1e8('0x19')]?_0x232997[_0xe1e8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x232997['options']?_0x232997[_0xe1e8('0x19')][_0xe1e8('0x1a')]||null:null,'attributes':_0x232997[_0xe1e8('0x19')]?_0x232997[_0xe1e8('0x19')][_0xe1e8('0x1b')]||null:null,'limit':_0x232997[_0xe1e8('0x19')]?_0x232997[_0xe1e8('0x19')][_0xe1e8('0x1c')]||null:null,'include':_0x232997[_0xe1e8('0x19')]?_0x232997[_0xe1e8('0x19')][_0xe1e8('0x1d')]?_[_0xe1e8('0x1e')](_0x232997['options']['include'],function(_0x1fce91){return{'model':db[_0x1fce91[_0xe1e8('0x1f')]],'as':_0x1fce91['as'],'attributes':_0x1fce91[_0xe1e8('0x1b')],'include':_0x1fce91[_0xe1e8('0x1d')]?_[_0xe1e8('0x1e')](_0x1fce91[_0xe1e8('0x1d')],function(_0x174d00){return{'model':db[_0x174d00['model']],'as':_0x174d00['as'],'attributes':_0x174d00['attributes'],'include':_0x174d00[_0xe1e8('0x1d')]?_['map'](_0x174d00[_0xe1e8('0x1d')],function(_0x536bdc){return{'model':db[_0x536bdc[_0xe1e8('0x1f')]],'as':_0x536bdc['as'],'attributes':_0x536bdc[_0xe1e8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe1e8('0xa')](function(_0x11bcf6){logger['info']('GetMailServerIn',_0x232997);logger[_0xe1e8('0xe')](_0xe1e8('0x16'),_0x232997,JSON['stringify'](_0x11bcf6));_0x3193da(_0x11bcf6);})['catch'](function(_0x75c9e4){logger[_0xe1e8('0x11')](_0xe1e8('0x16'),_0x75c9e4[_0xe1e8('0x13')],_0x232997);_0x4a2f1a(_0x3bafb0[_0xe1e8('0x11')](0x1f4,_0x75c9e4[_0xe1e8('0x13')]));});});}; \ No newline at end of file +var _0x6d98=['model','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','options','where','attributes','include','map'];(function(_0x564e9f,_0x225a15){var _0x3a9f3e=function(_0x1bbe48){while(--_0x1bbe48){_0x564e9f['push'](_0x564e9f['shift']());}};_0x3a9f3e(++_0x225a15);}(_0x6d98,0x76));var _0x86d9=function(_0x1a4b1a,_0x47b334){_0x1a4b1a=_0x1a4b1a-0x0;var _0x191f69=_0x6d98[_0x1a4b1a];return _0x191f69;};'use strict';var _=require(_0x86d9('0x0'));var util=require(_0x86d9('0x1'));var moment=require('moment');var BPromise=require(_0x86d9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x86d9('0x3'));var db=require(_0x86d9('0x4'))['db'];var utils=require(_0x86d9('0x5'));var logger=require('../../config/logger')(_0x86d9('0x6'));var config=require(_0x86d9('0x7'));var jayson=require(_0x86d9('0x8'));var client=jayson[_0x86d9('0x9')][_0x86d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf94ac6,_0x4266b6,_0x3f8736){return new BPromise(function(_0x50eb66,_0x8139cd){return client['request'](_0xf94ac6,_0x3f8736)['then'](function(_0x11d26e){logger[_0x86d9('0xb')]('MailServerIn,\x20%s,\x20%s',_0x4266b6,_0x86d9('0xc'));logger['debug'](_0x86d9('0xd'),_0x4266b6,_0x86d9('0xc'),JSON['stringify'](_0x11d26e));if(_0x11d26e[_0x86d9('0xe')]){if(_0x11d26e[_0x86d9('0xe')][_0x86d9('0xf')]===0x1f4){logger['error'](_0x86d9('0x10'),_0x4266b6,_0x11d26e['error'][_0x86d9('0x11')]);return _0x8139cd(_0x11d26e[_0x86d9('0xe')][_0x86d9('0x11')]);}logger[_0x86d9('0xe')](_0x86d9('0x10'),_0x4266b6,_0x11d26e[_0x86d9('0xe')][_0x86d9('0x11')]);return _0x50eb66(_0x11d26e[_0x86d9('0xe')][_0x86d9('0x11')]);}else{logger['info'](_0x86d9('0x10'),_0x4266b6,_0x86d9('0xc'));_0x50eb66(_0x11d26e[_0x86d9('0x12')][_0x86d9('0x11')]);}})[_0x86d9('0x13')](function(_0x418f14){logger[_0x86d9('0xe')](_0x86d9('0x10'),_0x4266b6,_0x418f14);_0x8139cd(_0x418f14);});});}exports[_0x86d9('0x14')]=function(_0x545449){var _0x551495=this;return new Promise(function(_0x3e5259,_0x486525){return db[_0x86d9('0x15')]['findAll']({'raw':_0x545449['options']?_0x545449[_0x86d9('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x545449[_0x86d9('0x16')]?_0x545449[_0x86d9('0x16')][_0x86d9('0x17')]||null:null,'attributes':_0x545449[_0x86d9('0x16')]?_0x545449['options'][_0x86d9('0x18')]||null:null,'limit':_0x545449['options']?_0x545449[_0x86d9('0x16')]['limit']||null:null,'include':_0x545449[_0x86d9('0x16')]?_0x545449[_0x86d9('0x16')][_0x86d9('0x19')]?_[_0x86d9('0x1a')](_0x545449[_0x86d9('0x16')][_0x86d9('0x19')],function(_0x1b412b){return{'model':db[_0x1b412b[_0x86d9('0x1b')]],'as':_0x1b412b['as'],'attributes':_0x1b412b['attributes'],'include':_0x1b412b[_0x86d9('0x19')]?_['map'](_0x1b412b[_0x86d9('0x19')],function(_0x3e388f){return{'model':db[_0x3e388f['model']],'as':_0x3e388f['as'],'attributes':_0x3e388f[_0x86d9('0x18')],'include':_0x3e388f['include']?_['map'](_0x3e388f['include'],function(_0x5ab457){return{'model':db[_0x5ab457['model']],'as':_0x5ab457['as'],'attributes':_0x5ab457['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x277b7e){logger[_0x86d9('0xb')](_0x86d9('0x14'),_0x545449);logger[_0x86d9('0x1c')](_0x86d9('0x14'),_0x545449,JSON['stringify'](_0x277b7e));_0x3e5259(_0x277b7e);})['catch'](function(_0x5d8708){logger[_0x86d9('0xe')](_0x86d9('0x14'),_0x5d8708[_0x86d9('0x11')],_0x545449);_0x486525(_0x551495[_0x86d9('0xe')](0x1f4,_0x5d8708[_0x86d9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 4812e9d..67dcecb 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 _0x18d1=['index','/:id','isAuthenticated','show','post','create','put','update','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./mailServerOut.controller','get'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0x18d1,0x12a));var _0x118d=function(_0x464e76,_0x234e05){_0x464e76=_0x464e76-0x0;var _0x158530=_0x18d1[_0x464e76];return _0x158530;};'use strict';var multer=require('multer');var util=require(_0x118d('0x0'));var path=require(_0x118d('0x1'));var timeout=require(_0x118d('0x2'));var express=require(_0x118d('0x3'));var router=express[_0x118d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x118d('0x5'));var config=require('../../config/environment');var controller=require(_0x118d('0x6'));router[_0x118d('0x7')]('/',auth['isAuthenticated'](),controller[_0x118d('0x8')]);router['get'](_0x118d('0x9'),auth[_0x118d('0xa')](),controller[_0x118d('0xb')]);router[_0x118d('0xc')]('/',auth[_0x118d('0xa')](),controller[_0x118d('0xd')]);router[_0x118d('0xe')](_0x118d('0x9'),auth[_0x118d('0xa')](),controller[_0x118d('0xf')]);router['delete'](_0x118d('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x118d('0x10')]=router; \ No newline at end of file +var _0xa526=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','/:id','post','put'];(function(_0x169775,_0x19eeaa){var _0x58f22e=function(_0x277976){while(--_0x277976){_0x169775['push'](_0x169775['shift']());}};_0x58f22e(++_0x19eeaa);}(_0xa526,0x180));var _0x6a52=function(_0x19babd,_0x1d4ef7){_0x19babd=_0x19babd-0x0;var _0x314eaf=_0xa526[_0x19babd];return _0x314eaf;};'use strict';var multer=require(_0x6a52('0x0'));var util=require(_0x6a52('0x1'));var path=require(_0x6a52('0x2'));var timeout=require(_0x6a52('0x3'));var express=require(_0x6a52('0x4'));var router=express[_0x6a52('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x6a52('0x6'));var config=require(_0x6a52('0x7'));var controller=require(_0x6a52('0x8'));router[_0x6a52('0x9')]('/',auth[_0x6a52('0xa')](),controller[_0x6a52('0xb')]);router['get'](_0x6a52('0xc'),auth[_0x6a52('0xa')](),controller['show']);router[_0x6a52('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6a52('0xe')]('/:id',auth[_0x6a52('0xa')](),controller[_0x6a52('0xf')]);router[_0x6a52('0x10')](_0x6a52('0xc'),auth[_0x6a52('0xa')](),controller[_0x6a52('0x11')]);module[_0x6a52('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 6c59429..33529d4 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 _0xfcf0=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfcf0,0x138));var _0x0fcf=function(_0x3817a9,_0x29e215){_0x3817a9=_0x3817a9-0x0;var _0x443f30=_0xfcf0[_0x3817a9];return _0x443f30;};'use strict';var Sequelize=require(_0x0fcf('0x0'));module[_0x0fcf('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x0fcf('0x2')]},'user':{'type':Sequelize[_0x0fcf('0x2')]},'pass':{'type':Sequelize[_0x0fcf('0x2')]},'port':{'type':Sequelize[_0x0fcf('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x0fcf('0x2')]},'authentication':{'type':Sequelize[_0x0fcf('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x94ba=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x2c9a36,_0x1b1fb8){var _0x556a9e=function(_0x2cc111){while(--_0x2cc111){_0x2c9a36['push'](_0x2c9a36['shift']());}};_0x556a9e(++_0x1b1fb8);}(_0x94ba,0xbe));var _0xa94b=function(_0x14eb9e,_0x29fe9e){_0x14eb9e=_0x14eb9e-0x0;var _0x4c59c4=_0x94ba[_0x14eb9e];return _0x4c59c4;};'use strict';var Sequelize=require(_0xa94b('0x0'));module[_0xa94b('0x1')]={'description':{'type':Sequelize[_0xa94b('0x2')]},'host':{'type':Sequelize[_0xa94b('0x2')]},'user':{'type':Sequelize[_0xa94b('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xa94b('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xa94b('0x2')]},'authentication':{'type':Sequelize[_0xa94b('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 faeb3cc..efd1e2d 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 _0xf046=['then','catch','show','params','length','options','find','create','body','destroy','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','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','end','json','count','offset','limit','set','Content-Range','save','update','error','stack','name','send','map','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','order','sort','where','merge','VIRTUAL','filter','MailServerOut','include','findAll'];(function(_0x15aa6b,_0x2de48c){var _0x61e8=function(_0x21df49){while(--_0x21df49){_0x15aa6b['push'](_0x15aa6b['shift']());}};_0x61e8(++_0x2de48c);}(_0xf046,0x172));var _0x6f04=function(_0x212b03,_0x1f1b50){_0x212b03=_0x212b03-0x0;var _0x423115=_0xf046[_0x212b03];return _0x423115;};'use strict';var pdf=require(_0x6f04('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6f04('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6f04('0x2'));var moment=require(_0x6f04('0x3'));var BPromise=require(_0x6f04('0x4'));var Mustache=require(_0x6f04('0x5'));var util=require(_0x6f04('0x6'));var path=require('path');var sox=require(_0x6f04('0x7'));var csv=require(_0x6f04('0x8'));var ejs=require(_0x6f04('0x9'));var fs=require('fs');var _=require(_0x6f04('0xa'));var squel=require(_0x6f04('0xb'));var crypto=require(_0x6f04('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6f04('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6f04('0xe'));var Papa=require(_0x6f04('0xf'));var Redis=require(_0x6f04('0x10'));var authService=require(_0x6f04('0x11'));var qs=require(_0x6f04('0x12'));var as=require(_0x6f04('0x13'));var hardwareService=require(_0x6f04('0x14'));var logger=require(_0x6f04('0x15'))(_0x6f04('0x16'));var utils=require(_0x6f04('0x17'));var config=require(_0x6f04('0x18'));var licenseUtil=require(_0x6f04('0x19'));var db=require(_0x6f04('0x1a'))['db'];function respondWithStatusCode(_0x1194fc,_0x49615a){_0x49615a=_0x49615a||0xcc;return function(_0x8c04f3){if(_0x8c04f3){return _0x1194fc[_0x6f04('0x1b')](_0x49615a);}return _0x1194fc[_0x6f04('0x1c')](_0x49615a)[_0x6f04('0x1d')]();};}function respondWithResult(_0x1a06f9,_0x3631e6){_0x3631e6=_0x3631e6||0xc8;return function(_0x39432d){if(_0x39432d){return _0x1a06f9['status'](_0x3631e6)[_0x6f04('0x1e')](_0x39432d);}};}function respondWithFilteredResult(_0x449625,_0x557146){return function(_0x6e2687){if(_0x6e2687){var _0x5cd14e=_0x6e2687[_0x6f04('0x1f')],_0x200501=_0x557146[_0x6f04('0x20')],_0x527a7f=_0x557146[_0x6f04('0x20')]+_0x557146[_0x6f04('0x21')],_0x5a23aa;if(_0x527a7f>=_0x5cd14e){_0x527a7f=_0x5cd14e;_0x5a23aa=0xc8;}else{_0x5a23aa=0xce;}_0x449625[_0x6f04('0x1c')](_0x5a23aa);return _0x449625[_0x6f04('0x22')](_0x6f04('0x23'),_0x200501+'-'+_0x527a7f+'/'+_0x5cd14e)['json'](_0x6e2687);}return null;};}function patchUpdates(_0x5179f8){return function(_0x1a74f1){try{jsonpatch['apply'](_0x1a74f1,_0x5179f8,!![]);}catch(_0x16b8e0){return BPromise['reject'](_0x16b8e0);}return _0x1a74f1[_0x6f04('0x24')]();};}function saveUpdates(_0x178eea,_0x4a2ac8){return function(_0x5cd248){if(_0x5cd248){return _0x5cd248[_0x6f04('0x25')](_0x178eea)['then'](function(_0x1f2360){return _0x1f2360;});}return null;};}function removeEntity(_0x10797b,_0x24b86f){return function(_0x2f4d78){if(_0x2f4d78){return _0x2f4d78['destroy']()['then'](function(){_0x10797b[_0x6f04('0x1c')](0xcc)[_0x6f04('0x1d')]();});}};}function handleEntityNotFound(_0x2cfead,_0x213302){return function(_0x3b17db){if(!_0x3b17db){_0x2cfead[_0x6f04('0x1b')](0x194);}return _0x3b17db;};}function handleError(_0x4764a4,_0x58cde9){_0x58cde9=_0x58cde9||0x1f4;return function(_0x141559){logger[_0x6f04('0x26')](_0x141559[_0x6f04('0x27')]);if(_0x141559[_0x6f04('0x28')]){delete _0x141559['name'];}_0x4764a4[_0x6f04('0x1c')](_0x58cde9)[_0x6f04('0x29')](_0x141559);};}exports['index']=function(_0x3a3e49,_0x3bae2b){var _0x4c981d={},_0x21c9f2={},_0x2cb403={'count':0x0,'rows':[]};var _0x5a6286=_[_0x6f04('0x2a')](db['MailServerOut'][_0x6f04('0x2b')],function(_0x59bc1d){return{'name':_0x59bc1d['fieldName'],'type':_0x59bc1d[_0x6f04('0x2c')][_0x6f04('0x2d')]};});_0x21c9f2['model']=_[_0x6f04('0x2a')](_0x5a6286,'name');_0x21c9f2[_0x6f04('0x2e')]=_[_0x6f04('0x2f')](_0x3a3e49[_0x6f04('0x2e')]);_0x21c9f2[_0x6f04('0x30')]=_[_0x6f04('0x31')](_0x21c9f2['model'],_0x21c9f2[_0x6f04('0x2e')]);_0x4c981d['attributes']=_[_0x6f04('0x31')](_0x21c9f2[_0x6f04('0x32')],qs[_0x6f04('0x33')](_0x3a3e49[_0x6f04('0x2e')][_0x6f04('0x33')]));_0x4c981d[_0x6f04('0x34')]=_0x4c981d['attributes']['length']?_0x4c981d[_0x6f04('0x34')]:_0x21c9f2[_0x6f04('0x32')];if(!_0x3a3e49['query']['hasOwnProperty']('nolimit')){_0x4c981d[_0x6f04('0x21')]=qs[_0x6f04('0x21')](_0x3a3e49['query']['limit']);_0x4c981d[_0x6f04('0x20')]=qs[_0x6f04('0x20')](_0x3a3e49['query']['offset']);}_0x4c981d[_0x6f04('0x35')]=qs[_0x6f04('0x36')](_0x3a3e49['query']['sort']);_0x4c981d[_0x6f04('0x37')]=qs['filters'](_['pick'](_0x3a3e49['query'],_0x21c9f2[_0x6f04('0x30')]),_0x5a6286);if(_0x3a3e49['query']['filter']){_0x4c981d['where']=_[_0x6f04('0x38')](_0x4c981d[_0x6f04('0x37')],{'$or':_[_0x6f04('0x2a')](_0x5a6286,function(_0x4aa999){if(_0x4aa999[_0x6f04('0x2c')]!==_0x6f04('0x39')){var _0x3f326a={};_0x3f326a[_0x4aa999['name']]={'$like':'%'+_0x3a3e49[_0x6f04('0x2e')][_0x6f04('0x3a')]+'%'};return _0x3f326a;}})});}_0x4c981d=_[_0x6f04('0x38')]({},_0x4c981d,_0x3a3e49['options']);var _0x3570c2={'where':_0x4c981d[_0x6f04('0x37')]};return db[_0x6f04('0x3b')][_0x6f04('0x1f')](_0x3570c2)['then'](function(_0xfa336f){_0x2cb403[_0x6f04('0x1f')]=_0xfa336f;if(_0x3a3e49['query']['includeAll']){_0x4c981d[_0x6f04('0x3c')]=[{'all':!![]}];}return db[_0x6f04('0x3b')][_0x6f04('0x3d')](_0x4c981d);})[_0x6f04('0x3e')](function(_0xdaee2d){_0x2cb403['rows']=_0xdaee2d;return _0x2cb403;})[_0x6f04('0x3e')](respondWithFilteredResult(_0x3bae2b,_0x4c981d))[_0x6f04('0x3f')](handleError(_0x3bae2b,null));};exports[_0x6f04('0x40')]=function(_0x5a143c,_0x5bfbe3){var _0x1850c3={'raw':!![],'where':{'id':_0x5a143c[_0x6f04('0x41')]['id']}},_0x2ed956={};_0x2ed956[_0x6f04('0x32')]=_[_0x6f04('0x2f')](db[_0x6f04('0x3b')][_0x6f04('0x2b')]);_0x2ed956[_0x6f04('0x2e')]=_[_0x6f04('0x2f')](_0x5a143c[_0x6f04('0x2e')]);_0x2ed956[_0x6f04('0x30')]=_['intersection'](_0x2ed956[_0x6f04('0x32')],_0x2ed956[_0x6f04('0x2e')]);_0x1850c3[_0x6f04('0x34')]=_[_0x6f04('0x31')](_0x2ed956[_0x6f04('0x32')],qs[_0x6f04('0x33')](_0x5a143c[_0x6f04('0x2e')][_0x6f04('0x33')]));_0x1850c3[_0x6f04('0x34')]=_0x1850c3[_0x6f04('0x34')][_0x6f04('0x42')]?_0x1850c3['attributes']:_0x2ed956[_0x6f04('0x32')];if(_0x5a143c[_0x6f04('0x2e')]['includeAll']){_0x1850c3[_0x6f04('0x3c')]=[{'all':!![]}];}_0x1850c3=_[_0x6f04('0x38')]({},_0x1850c3,_0x5a143c[_0x6f04('0x43')]);return db['MailServerOut'][_0x6f04('0x44')](_0x1850c3)[_0x6f04('0x3e')](handleEntityNotFound(_0x5bfbe3,null))['then'](respondWithResult(_0x5bfbe3,null))[_0x6f04('0x3f')](handleError(_0x5bfbe3,null));};exports[_0x6f04('0x45')]=function(_0x25c701,_0xc3112d){return db[_0x6f04('0x3b')][_0x6f04('0x45')](_0x25c701[_0x6f04('0x46')],{})['then'](respondWithResult(_0xc3112d,0xc9))[_0x6f04('0x3f')](handleError(_0xc3112d,null));};exports[_0x6f04('0x25')]=function(_0x161147,_0x5a50a3){if(_0x161147[_0x6f04('0x46')]['id']){delete _0x161147[_0x6f04('0x46')]['id'];}return db[_0x6f04('0x3b')][_0x6f04('0x44')]({'where':{'id':_0x161147[_0x6f04('0x41')]['id']}})[_0x6f04('0x3e')](handleEntityNotFound(_0x5a50a3,null))[_0x6f04('0x3e')](saveUpdates(_0x161147[_0x6f04('0x46')],null))[_0x6f04('0x3e')](respondWithResult(_0x5a50a3,null))[_0x6f04('0x3f')](handleError(_0x5a50a3,null));};exports[_0x6f04('0x47')]=function(_0x4ae239,_0x4a4311){return db[_0x6f04('0x3b')][_0x6f04('0x44')]({'where':{'id':_0x4ae239[_0x6f04('0x41')]['id']}})['then'](handleEntityNotFound(_0x4a4311,null))[_0x6f04('0x3e')](removeEntity(_0x4a4311,null))[_0x6f04('0x3f')](handleError(_0x4a4311,null));}; \ No newline at end of file +var _0x779e=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','filter','options','MailServerOut','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','json','offset','set','apply','reject','save','destroy','then','end','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x779e,0x187));var _0xe779=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0x779e[_0x48d6a3];return _0x38bfa0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe779('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe779('0x1'));var jsonpatch=require(_0xe779('0x2'));var rp=require(_0xe779('0x3'));var moment=require(_0xe779('0x4'));var BPromise=require(_0xe779('0x5'));var Mustache=require(_0xe779('0x6'));var util=require(_0xe779('0x7'));var path=require(_0xe779('0x8'));var sox=require('sox');var csv=require(_0xe779('0x9'));var ejs=require(_0xe779('0xa'));var fs=require('fs');var _=require(_0xe779('0xb'));var squel=require(_0xe779('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe779('0x9'));var querystring=require(_0xe779('0xd'));var Papa=require('papaparse');var Redis=require(_0xe779('0xe'));var authService=require(_0xe779('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe779('0x10'));var hardwareService=require(_0xe779('0x11'));var logger=require('../../config/logger')(_0xe779('0x12'));var utils=require(_0xe779('0x13'));var config=require(_0xe779('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ff762,_0x59f7cf){_0x59f7cf=_0x59f7cf||0xcc;return function(_0x872b3b){if(_0x872b3b){return _0x3ff762['sendStatus'](_0x59f7cf);}return _0x3ff762[_0xe779('0x15')](_0x59f7cf)['end']();};}function respondWithResult(_0x3e48cb,_0x3d73e1){_0x3d73e1=_0x3d73e1||0xc8;return function(_0x1401a8){if(_0x1401a8){return _0x3e48cb['status'](_0x3d73e1)[_0xe779('0x16')](_0x1401a8);}};}function respondWithFilteredResult(_0x427ad1,_0x1339e3){return function(_0xc6e5b0){if(_0xc6e5b0){var _0x9e41b1=_0xc6e5b0['count'],_0xcebb1b=_0x1339e3['offset'],_0x538dc5=_0x1339e3[_0xe779('0x17')]+_0x1339e3['limit'],_0x4da8ac;if(_0x538dc5>=_0x9e41b1){_0x538dc5=_0x9e41b1;_0x4da8ac=0xc8;}else{_0x4da8ac=0xce;}_0x427ad1[_0xe779('0x15')](_0x4da8ac);return _0x427ad1[_0xe779('0x18')]('Content-Range',_0xcebb1b+'-'+_0x538dc5+'/'+_0x9e41b1)[_0xe779('0x16')](_0xc6e5b0);}return null;};}function patchUpdates(_0x4486ed){return function(_0x52d00a){try{jsonpatch[_0xe779('0x19')](_0x52d00a,_0x4486ed,!![]);}catch(_0x5ee8f2){return BPromise[_0xe779('0x1a')](_0x5ee8f2);}return _0x52d00a[_0xe779('0x1b')]();};}function saveUpdates(_0x3ec625,_0x17f809){return function(_0x233082){if(_0x233082){return _0x233082['update'](_0x3ec625)['then'](function(_0x57db6f){return _0x57db6f;});}return null;};}function removeEntity(_0x577ca2,_0xb0118e){return function(_0x51461b){if(_0x51461b){return _0x51461b[_0xe779('0x1c')]()[_0xe779('0x1d')](function(){_0x577ca2[_0xe779('0x15')](0xcc)[_0xe779('0x1e')]();});}};}function handleEntityNotFound(_0x1ac105,_0x3139b7){return function(_0x1001d2){if(!_0x1001d2){_0x1ac105[_0xe779('0x1f')](0x194);}return _0x1001d2;};}function handleError(_0x146863,_0x173655){_0x173655=_0x173655||0x1f4;return function(_0x163098){logger[_0xe779('0x20')](_0x163098['stack']);if(_0x163098[_0xe779('0x21')]){delete _0x163098[_0xe779('0x21')];}_0x146863[_0xe779('0x15')](_0x173655)[_0xe779('0x22')](_0x163098);};}exports[_0xe779('0x23')]=function(_0x5982c5,_0x5bf63e){var _0x5aa976={},_0x2f0d3f={},_0x446808={'count':0x0,'rows':[]};var _0x373eb1=_[_0xe779('0x24')](db['MailServerOut'][_0xe779('0x25')],function(_0x13474d){return{'name':_0x13474d[_0xe779('0x26')],'type':_0x13474d[_0xe779('0x27')][_0xe779('0x28')]};});_0x2f0d3f[_0xe779('0x29')]=_[_0xe779('0x24')](_0x373eb1,'name');_0x2f0d3f[_0xe779('0x2a')]=_[_0xe779('0x2b')](_0x5982c5[_0xe779('0x2a')]);_0x2f0d3f[_0xe779('0x2c')]=_[_0xe779('0x2d')](_0x2f0d3f['model'],_0x2f0d3f['query']);_0x5aa976['attributes']=_[_0xe779('0x2d')](_0x2f0d3f[_0xe779('0x29')],qs[_0xe779('0x2e')](_0x5982c5[_0xe779('0x2a')][_0xe779('0x2e')]));_0x5aa976['attributes']=_0x5aa976[_0xe779('0x2f')][_0xe779('0x30')]?_0x5aa976['attributes']:_0x2f0d3f['model'];if(!_0x5982c5[_0xe779('0x2a')][_0xe779('0x31')](_0xe779('0x32'))){_0x5aa976['limit']=qs[_0xe779('0x33')](_0x5982c5['query']['limit']);_0x5aa976[_0xe779('0x17')]=qs['offset'](_0x5982c5['query'][_0xe779('0x17')]);}_0x5aa976[_0xe779('0x34')]=qs[_0xe779('0x35')](_0x5982c5[_0xe779('0x2a')][_0xe779('0x35')]);_0x5aa976['where']=qs['filters'](_[_0xe779('0x36')](_0x5982c5[_0xe779('0x2a')],_0x2f0d3f[_0xe779('0x2c')]),_0x373eb1);if(_0x5982c5[_0xe779('0x2a')]['filter']){_0x5aa976[_0xe779('0x37')]=_[_0xe779('0x38')](_0x5aa976[_0xe779('0x37')],{'$or':_['map'](_0x373eb1,function(_0x57a580){if(_0x57a580[_0xe779('0x27')]!==_0xe779('0x39')){var _0x3446dc={};_0x3446dc[_0x57a580['name']]={'$like':'%'+_0x5982c5[_0xe779('0x2a')][_0xe779('0x3a')]+'%'};return _0x3446dc;}})});}_0x5aa976=_[_0xe779('0x38')]({},_0x5aa976,_0x5982c5[_0xe779('0x3b')]);var _0x4c74b1={'where':_0x5aa976[_0xe779('0x37')]};return db[_0xe779('0x3c')]['count'](_0x4c74b1)[_0xe779('0x1d')](function(_0xc787d4){_0x446808['count']=_0xc787d4;if(_0x5982c5[_0xe779('0x2a')][_0xe779('0x3d')]){_0x5aa976[_0xe779('0x3e')]=[{'all':!![]}];}return db['MailServerOut'][_0xe779('0x3f')](_0x5aa976);})[_0xe779('0x1d')](function(_0x4e53fe){_0x446808[_0xe779('0x40')]=_0x4e53fe;return _0x446808;})[_0xe779('0x1d')](respondWithFilteredResult(_0x5bf63e,_0x5aa976))[_0xe779('0x41')](handleError(_0x5bf63e,null));};exports[_0xe779('0x42')]=function(_0x2ceddc,_0xa779d1){var _0x39699d={'raw':!![],'where':{'id':_0x2ceddc[_0xe779('0x43')]['id']}},_0x492a93={};_0x492a93[_0xe779('0x29')]=_[_0xe779('0x2b')](db[_0xe779('0x3c')][_0xe779('0x25')]);_0x492a93[_0xe779('0x2a')]=_[_0xe779('0x2b')](_0x2ceddc[_0xe779('0x2a')]);_0x492a93[_0xe779('0x2c')]=_['intersection'](_0x492a93[_0xe779('0x29')],_0x492a93[_0xe779('0x2a')]);_0x39699d[_0xe779('0x2f')]=_[_0xe779('0x2d')](_0x492a93['model'],qs['fields'](_0x2ceddc['query'][_0xe779('0x2e')]));_0x39699d[_0xe779('0x2f')]=_0x39699d[_0xe779('0x2f')][_0xe779('0x30')]?_0x39699d['attributes']:_0x492a93[_0xe779('0x29')];if(_0x2ceddc[_0xe779('0x2a')][_0xe779('0x3d')]){_0x39699d[_0xe779('0x3e')]=[{'all':!![]}];}_0x39699d=_[_0xe779('0x38')]({},_0x39699d,_0x2ceddc[_0xe779('0x3b')]);return db[_0xe779('0x3c')][_0xe779('0x44')](_0x39699d)[_0xe779('0x1d')](handleEntityNotFound(_0xa779d1,null))[_0xe779('0x1d')](respondWithResult(_0xa779d1,null))['catch'](handleError(_0xa779d1,null));};exports[_0xe779('0x45')]=function(_0x4b581e,_0x6b8ede){return db[_0xe779('0x3c')][_0xe779('0x45')](_0x4b581e[_0xe779('0x46')],{})[_0xe779('0x1d')](respondWithResult(_0x6b8ede,0xc9))['catch'](handleError(_0x6b8ede,null));};exports[_0xe779('0x47')]=function(_0x41091c,_0x2b5982){if(_0x41091c['body']['id']){delete _0x41091c[_0xe779('0x46')]['id'];}return db['MailServerOut'][_0xe779('0x44')]({'where':{'id':_0x41091c['params']['id']}})[_0xe779('0x1d')](handleEntityNotFound(_0x2b5982,null))[_0xe779('0x1d')](saveUpdates(_0x41091c[_0xe779('0x46')],null))[_0xe779('0x1d')](respondWithResult(_0x2b5982,null))[_0xe779('0x41')](handleError(_0x2b5982,null));};exports['destroy']=function(_0x1d2bca,_0x5aee36){return db[_0xe779('0x3c')][_0xe779('0x44')]({'where':{'id':_0x1d2bca[_0xe779('0x43')]['id']}})[_0xe779('0x1d')](handleEntityNotFound(_0x5aee36,null))[_0xe779('0x1d')](removeEntity(_0x5aee36,null))[_0xe779('0x41')](handleError(_0x5aee36,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index db35f36..9c4afeb 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 _0x24ca=['MailServerOut','mail_servers_out','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define'];(function(_0x34074d,_0x4daf45){var _0x56c1d1=function(_0x562eda){while(--_0x562eda){_0x34074d['push'](_0x34074d['shift']());}};_0x56c1d1(++_0x4daf45);}(_0x24ca,0x1bc));var _0xa24c=function(_0x59616b,_0x38e534){_0x59616b=_0x59616b-0x0;var _0x5c4523=_0x24ca[_0x59616b];return _0x5c4523;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var logger=require(_0xa24c('0x1'))(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa24c('0x4'));var fs=require('fs');var path=require(_0xa24c('0x5'));var rimraf=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var attributes=require(_0xa24c('0x8'));module[_0xa24c('0x9')]=function(_0xf0511,_0x3c0aaa){return _0xf0511[_0xa24c('0xa')](_0xa24c('0xb'),attributes,{'tableName':_0xa24c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','lodash','util'];(function(_0xb3fb40,_0x50ff23){var _0x130c41=function(_0x5b94ee){while(--_0x5b94ee){_0xb3fb40['push'](_0xb3fb40['shift']());}};_0x130c41(++_0x50ff23);}(_0xf494,0x1c6));var _0x4f49=function(_0x317226,_0x44415d){_0x317226=_0x317226-0x0;var _0x4dd967=_0xf494[_0x317226];return _0x4dd967;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 8c7ba12..6681bab 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 _0xba42=['MailServerOut,\x20%s,\x20%s','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','message'];(function(_0x356c05,_0x4afbbc){var _0x1bb399=function(_0x497024){while(--_0x497024){_0x356c05['push'](_0x356c05['shift']());}};_0x1bb399(++_0x4afbbc);}(_0xba42,0x1d5));var _0x2ba4=function(_0x2d3ab3,_0x47d90b){_0x2d3ab3=_0x2d3ab3-0x0;var _0x321f9e=_0xba42[_0x2d3ab3];return _0x321f9e;};'use strict';var _=require(_0x2ba4('0x0'));var util=require(_0x2ba4('0x1'));var moment=require(_0x2ba4('0x2'));var BPromise=require(_0x2ba4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ba4('0x4'));var db=require(_0x2ba4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2ba4('0x6'));var jayson=require(_0x2ba4('0x7'));var client=jayson['client'][_0x2ba4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20738a,_0x283843,_0x1b201c){return new BPromise(function(_0x6cef78,_0x5521a6){return client[_0x2ba4('0x9')](_0x20738a,_0x1b201c)[_0x2ba4('0xa')](function(_0x3857be){logger[_0x2ba4('0xb')]('MailServerOut,\x20%s,\x20%s',_0x283843,_0x2ba4('0xc'));logger[_0x2ba4('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x283843,'request\x20sent',JSON['stringify'](_0x3857be));if(_0x3857be[_0x2ba4('0xe')]){if(_0x3857be[_0x2ba4('0xe')][_0x2ba4('0xf')]===0x1f4){logger[_0x2ba4('0xe')]('MailServerOut,\x20%s,\x20%s',_0x283843,_0x3857be[_0x2ba4('0xe')][_0x2ba4('0x10')]);return _0x5521a6(_0x3857be[_0x2ba4('0xe')][_0x2ba4('0x10')]);}logger[_0x2ba4('0xe')](_0x2ba4('0x11'),_0x283843,_0x3857be[_0x2ba4('0xe')][_0x2ba4('0x10')]);return _0x6cef78(_0x3857be[_0x2ba4('0xe')][_0x2ba4('0x10')]);}else{logger['info'](_0x2ba4('0x11'),_0x283843,_0x2ba4('0xc'));_0x6cef78(_0x3857be['result'][_0x2ba4('0x10')]);}})['catch'](function(_0x139780){logger[_0x2ba4('0xe')]('MailServerOut,\x20%s,\x20%s',_0x283843,_0x139780);_0x5521a6(_0x139780);});});} \ No newline at end of file +var _0x2487=['message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error','code','MailServerOut,\x20%s,\x20%s'];(function(_0x2e516c,_0x1e4cae){var _0xbb339a=function(_0x197e34){while(--_0x197e34){_0x2e516c['push'](_0x2e516c['shift']());}};_0xbb339a(++_0x1e4cae);}(_0x2487,0x16b));var _0x7248=function(_0x594812,_0x2eb78d){_0x594812=_0x594812-0x0;var _0xc25be2=_0x2487[_0x594812];return _0xc25be2;};'use strict';var _=require(_0x7248('0x0'));var util=require(_0x7248('0x1'));var moment=require('moment');var BPromise=require(_0x7248('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7248('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7248('0x4'))(_0x7248('0x5'));var config=require(_0x7248('0x6'));var jayson=require(_0x7248('0x7'));var client=jayson[_0x7248('0x8')][_0x7248('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58a0ac,_0x566eb3,_0x2a2431){return new BPromise(function(_0x4f8fe0,_0xe249ba){return client[_0x7248('0xa')](_0x58a0ac,_0x2a2431)[_0x7248('0xb')](function(_0x43c77e){logger[_0x7248('0xc')]('MailServerOut,\x20%s,\x20%s',_0x566eb3,_0x7248('0xd'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0x566eb3,_0x7248('0xd'),JSON['stringify'](_0x43c77e));if(_0x43c77e[_0x7248('0xe')]){if(_0x43c77e['error'][_0x7248('0xf')]===0x1f4){logger[_0x7248('0xe')](_0x7248('0x10'),_0x566eb3,_0x43c77e[_0x7248('0xe')][_0x7248('0x11')]);return _0xe249ba(_0x43c77e[_0x7248('0xe')][_0x7248('0x11')]);}logger['error']('MailServerOut,\x20%s,\x20%s',_0x566eb3,_0x43c77e[_0x7248('0xe')][_0x7248('0x11')]);return _0x4f8fe0(_0x43c77e['error'][_0x7248('0x11')]);}else{logger[_0x7248('0xc')](_0x7248('0x10'),_0x566eb3,'request\x20sent');_0x4f8fe0(_0x43c77e[_0x7248('0x12')][_0x7248('0x11')]);}})[_0x7248('0x13')](function(_0x3bc3a1){logger[_0x7248('0xe')]('MailServerOut,\x20%s,\x20%s',_0x566eb3,_0x3bc3a1);_0xe249ba(_0x3bc3a1);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 9e1bc36..cf76b5c 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 _0xed29=['../../config/environment','./mailSubstatus.controller','get','isAuthenticated','describe','show','create','/:id','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xed29,0x1a3));var _0x9ed2=function(_0x5e5c64,_0x19b9fb){_0x5e5c64=_0x5e5c64-0x0;var _0x1bf287=_0xed29[_0x5e5c64];return _0x1bf287;};'use strict';var multer=require(_0x9ed2('0x0'));var util=require('util');var path=require(_0x9ed2('0x1'));var timeout=require('connect-timeout');var express=require(_0x9ed2('0x2'));var router=express[_0x9ed2('0x3')]();var auth=require(_0x9ed2('0x4'));var interaction=require(_0x9ed2('0x5'));var config=require(_0x9ed2('0x6'));var controller=require(_0x9ed2('0x7'));router[_0x9ed2('0x8')]('/',auth[_0x9ed2('0x9')](),controller['index']);router[_0x9ed2('0x8')]('/describe',auth[_0x9ed2('0x9')](),controller[_0x9ed2('0xa')]);router[_0x9ed2('0x8')]('/:id',auth[_0x9ed2('0x9')](),controller[_0x9ed2('0xb')]);router['post']('/',auth[_0x9ed2('0x9')](),controller[_0x9ed2('0xc')]);router['put'](_0x9ed2('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x9ed2('0xe')](_0x9ed2('0xd'),auth[_0x9ed2('0x9')](),controller[_0x9ed2('0xf')]);module[_0x9ed2('0x10')]=router; \ No newline at end of file +var _0xf6bd=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5a72ba,_0x40d344){var _0x5ec295=function(_0x2eea13){while(--_0x2eea13){_0x5a72ba['push'](_0x5a72ba['shift']());}};_0x5ec295(++_0x40d344);}(_0xf6bd,0xac));var _0xdf6b=function(_0x5275b8,_0x51e5dd){_0x5275b8=_0x5275b8-0x0;var _0x568a9b=_0xf6bd[_0x5275b8];return _0x568a9b;};'use strict';var multer=require(_0xdf6b('0x0'));var util=require(_0xdf6b('0x1'));var path=require(_0xdf6b('0x2'));var timeout=require(_0xdf6b('0x3'));var express=require(_0xdf6b('0x4'));var router=express[_0xdf6b('0x5')]();var auth=require(_0xdf6b('0x6'));var interaction=require(_0xdf6b('0x7'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0xdf6b('0x8')]('/',auth[_0xdf6b('0x9')](),controller[_0xdf6b('0xa')]);router[_0xdf6b('0x8')](_0xdf6b('0xb'),auth['isAuthenticated'](),controller[_0xdf6b('0xc')]);router[_0xdf6b('0x8')](_0xdf6b('0xd'),auth[_0xdf6b('0x9')](),controller[_0xdf6b('0xe')]);router[_0xdf6b('0xf')]('/',auth[_0xdf6b('0x9')](),controller[_0xdf6b('0x10')]);router[_0xdf6b('0x11')](_0xdf6b('0xd'),auth[_0xdf6b('0x9')](),controller['update']);router[_0xdf6b('0x12')](_0xdf6b('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xdf6b('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 2a3d6f9..6edb197 100644 --- a/server/api/mailSubstatus/mailSubstatus.attributes.js +++ b/server/api/mailSubstatus/mailSubstatus.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7031=['name','STRING','sequelize','exports'];(function(_0x3fd99c,_0x30d062){var _0x20d09b=function(_0x41b9d7){while(--_0x41b9d7){_0x3fd99c['push'](_0x3fd99c['shift']());}};_0x20d09b(++_0x30d062);}(_0x7031,0x19a));var _0x1703=function(_0x5ca644,_0x3d2165){_0x5ca644=_0x5ca644-0x0;var _0x5c87a2=_0x7031[_0x5ca644];return _0x5c87a2;};'use strict';var Sequelize=require(_0x1703('0x0'));module[_0x1703('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1703('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1703('0x3')]}}; \ No newline at end of file +var _0x27f3=['STRING','sequelize','exports','name'];(function(_0x493b3a,_0x3807bc){var _0x5837a0=function(_0xcaaad3){while(--_0xcaaad3){_0x493b3a['push'](_0x493b3a['shift']());}};_0x5837a0(++_0x3807bc);}(_0x27f3,0x1e9));var _0x327f=function(_0x3e7804,_0x121853){_0x3e7804=_0x3e7804-0x0;var _0x56efda=_0x27f3[_0x3e7804];return _0x56efda;};'use strict';var Sequelize=require(_0x327f('0x0'));module[_0x327f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x327f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x327f('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 39c4e02..4a38417 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 _0xfdde=['key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','limit','offset','sort','pick','filter','merge','where','VIRTUAL','options','then','includeAll','include','MailSubstatus','findAll','rows','catch','show','create','body','update','find','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','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','status','end','json','count','set','Content-Range','apply','save','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x1cece4,_0x5e7016){var _0x2835f3=function(_0x38ca6a){while(--_0x38ca6a){_0x1cece4['push'](_0x1cece4['shift']());}};_0x2835f3(++_0x5e7016);}(_0xfdde,0xbd));var _0xefdd=function(_0x7ecc0,_0x3c5cc5){_0x7ecc0=_0x7ecc0-0x0;var _0x5d016b=_0xfdde[_0x7ecc0];return _0x5d016b;};'use strict';var pdf=require(_0xefdd('0x0'));var emlformat=require(_0xefdd('0x1'));var rimraf=require(_0xefdd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xefdd('0x3'));var rp=require('request-promise');var moment=require(_0xefdd('0x4'));var BPromise=require(_0xefdd('0x5'));var Mustache=require(_0xefdd('0x6'));var util=require('util');var path=require(_0xefdd('0x7'));var sox=require('sox');var csv=require(_0xefdd('0x8'));var ejs=require(_0xefdd('0x9'));var fs=require('fs');var _=require(_0xefdd('0xa'));var squel=require(_0xefdd('0xb'));var crypto=require(_0xefdd('0xc'));var jsforce=require(_0xefdd('0xd'));var deskjs=require(_0xefdd('0xe'));var toCsv=require(_0xefdd('0x8'));var querystring=require(_0xefdd('0xf'));var Papa=require(_0xefdd('0x10'));var Redis=require(_0xefdd('0x11'));var authService=require(_0xefdd('0x12'));var qs=require(_0xefdd('0x13'));var as=require(_0xefdd('0x14'));var hardwareService=require(_0xefdd('0x15'));var logger=require(_0xefdd('0x16'))(_0xefdd('0x17'));var utils=require(_0xefdd('0x18'));var config=require(_0xefdd('0x19'));var licenseUtil=require(_0xefdd('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47fa01,_0x393c08){_0x393c08=_0x393c08||0xcc;return function(_0x24f862){if(_0x24f862){return _0x47fa01['sendStatus'](_0x393c08);}return _0x47fa01[_0xefdd('0x1b')](_0x393c08)[_0xefdd('0x1c')]();};}function respondWithResult(_0xd74749,_0x54c698){_0x54c698=_0x54c698||0xc8;return function(_0x4b67ff){if(_0x4b67ff){return _0xd74749[_0xefdd('0x1b')](_0x54c698)[_0xefdd('0x1d')](_0x4b67ff);}};}function respondWithFilteredResult(_0x39d032,_0x835374){return function(_0x1fe3ea){if(_0x1fe3ea){var _0x5f2aed=_0x1fe3ea[_0xefdd('0x1e')],_0x177d91=_0x835374['offset'],_0x59c595=_0x835374['offset']+_0x835374['limit'],_0xd0868e;if(_0x59c595>=_0x5f2aed){_0x59c595=_0x5f2aed;_0xd0868e=0xc8;}else{_0xd0868e=0xce;}_0x39d032[_0xefdd('0x1b')](_0xd0868e);return _0x39d032[_0xefdd('0x1f')](_0xefdd('0x20'),_0x177d91+'-'+_0x59c595+'/'+_0x5f2aed)['json'](_0x1fe3ea);}return null;};}function patchUpdates(_0x3674c8){return function(_0x2b54cf){try{jsonpatch[_0xefdd('0x21')](_0x2b54cf,_0x3674c8,!![]);}catch(_0x266305){return BPromise['reject'](_0x266305);}return _0x2b54cf[_0xefdd('0x22')]();};}function saveUpdates(_0x404088,_0x2730de){return function(_0x18b604){if(_0x18b604){return _0x18b604['update'](_0x404088)['then'](function(_0x23d42f){return _0x23d42f;});}return null;};}function removeEntity(_0x37d6a,_0x14562e){return function(_0x22f5c2){if(_0x22f5c2){return _0x22f5c2[_0xefdd('0x23')]()['then'](function(){_0x37d6a[_0xefdd('0x1b')](0xcc)[_0xefdd('0x1c')]();});}};}function handleEntityNotFound(_0x27bdc0,_0x5b5c8e){return function(_0x3b2e37){if(!_0x3b2e37){_0x27bdc0['sendStatus'](0x194);}return _0x3b2e37;};}function handleError(_0x100ffb,_0x2f771a){_0x2f771a=_0x2f771a||0x1f4;return function(_0x2811fd){logger[_0xefdd('0x24')](_0x2811fd[_0xefdd('0x25')]);if(_0x2811fd[_0xefdd('0x26')]){delete _0x2811fd['name'];}_0x100ffb[_0xefdd('0x1b')](_0x2f771a)[_0xefdd('0x27')](_0x2811fd);};}exports[_0xefdd('0x28')]=function(_0x2ccef9,_0x3c413d){var _0xf98643={},_0x38fb39={},_0x3b6a2f={'count':0x0,'rows':[]};var _0x1b101d=_[_0xefdd('0x29')](db['MailSubstatus'][_0xefdd('0x2a')],function(_0x20bf86){return{'name':_0x20bf86[_0xefdd('0x2b')],'type':_0x20bf86[_0xefdd('0x2c')][_0xefdd('0x2d')]};});_0x38fb39[_0xefdd('0x2e')]=_[_0xefdd('0x29')](_0x1b101d,_0xefdd('0x26'));_0x38fb39['query']=_[_0xefdd('0x2f')](_0x2ccef9[_0xefdd('0x30')]);_0x38fb39[_0xefdd('0x31')]=_['intersection'](_0x38fb39[_0xefdd('0x2e')],_0x38fb39['query']);_0xf98643[_0xefdd('0x32')]=_[_0xefdd('0x33')](_0x38fb39[_0xefdd('0x2e')],qs[_0xefdd('0x34')](_0x2ccef9[_0xefdd('0x30')][_0xefdd('0x34')]));_0xf98643[_0xefdd('0x32')]=_0xf98643[_0xefdd('0x32')][_0xefdd('0x35')]?_0xf98643[_0xefdd('0x32')]:_0x38fb39[_0xefdd('0x2e')];if(!_0x2ccef9[_0xefdd('0x30')]['hasOwnProperty'](_0xefdd('0x36'))){_0xf98643[_0xefdd('0x37')]=qs['limit'](_0x2ccef9[_0xefdd('0x30')][_0xefdd('0x37')]);_0xf98643['offset']=qs[_0xefdd('0x38')](_0x2ccef9[_0xefdd('0x30')][_0xefdd('0x38')]);}_0xf98643['order']=qs[_0xefdd('0x39')](_0x2ccef9['query'][_0xefdd('0x39')]);_0xf98643['where']=qs[_0xefdd('0x31')](_[_0xefdd('0x3a')](_0x2ccef9[_0xefdd('0x30')],_0x38fb39[_0xefdd('0x31')]),_0x1b101d);if(_0x2ccef9[_0xefdd('0x30')][_0xefdd('0x3b')]){_0xf98643['where']=_[_0xefdd('0x3c')](_0xf98643[_0xefdd('0x3d')],{'$or':_['map'](_0x1b101d,function(_0x151237){if(_0x151237[_0xefdd('0x2c')]!==_0xefdd('0x3e')){var _0x3e05a4={};_0x3e05a4[_0x151237[_0xefdd('0x26')]]={'$like':'%'+_0x2ccef9[_0xefdd('0x30')][_0xefdd('0x3b')]+'%'};return _0x3e05a4;}})});}_0xf98643=_[_0xefdd('0x3c')]({},_0xf98643,_0x2ccef9[_0xefdd('0x3f')]);var _0xd4308a={'where':_0xf98643[_0xefdd('0x3d')]};return db['MailSubstatus'][_0xefdd('0x1e')](_0xd4308a)[_0xefdd('0x40')](function(_0x4d16e3){_0x3b6a2f['count']=_0x4d16e3;if(_0x2ccef9[_0xefdd('0x30')][_0xefdd('0x41')]){_0xf98643[_0xefdd('0x42')]=[{'all':!![]}];}return db[_0xefdd('0x43')][_0xefdd('0x44')](_0xf98643);})[_0xefdd('0x40')](function(_0x2db2cb){_0x3b6a2f[_0xefdd('0x45')]=_0x2db2cb;return _0x3b6a2f;})[_0xefdd('0x40')](respondWithFilteredResult(_0x3c413d,_0xf98643))[_0xefdd('0x46')](handleError(_0x3c413d,null));};exports[_0xefdd('0x47')]=function(_0x520655,_0x511fb9){var _0x2cc73f={'raw':!![],'where':{'id':_0x520655['params']['id']}},_0xc4b520={};_0xc4b520['model']=_['keys'](db[_0xefdd('0x43')][_0xefdd('0x2a')]);_0xc4b520[_0xefdd('0x30')]=_[_0xefdd('0x2f')](_0x520655[_0xefdd('0x30')]);_0xc4b520[_0xefdd('0x31')]=_[_0xefdd('0x33')](_0xc4b520[_0xefdd('0x2e')],_0xc4b520[_0xefdd('0x30')]);_0x2cc73f[_0xefdd('0x32')]=_['intersection'](_0xc4b520[_0xefdd('0x2e')],qs[_0xefdd('0x34')](_0x520655[_0xefdd('0x30')]['fields']));_0x2cc73f[_0xefdd('0x32')]=_0x2cc73f[_0xefdd('0x32')]['length']?_0x2cc73f[_0xefdd('0x32')]:_0xc4b520[_0xefdd('0x2e')];if(_0x520655[_0xefdd('0x30')][_0xefdd('0x41')]){_0x2cc73f['include']=[{'all':!![]}];}_0x2cc73f=_['merge']({},_0x2cc73f,_0x520655[_0xefdd('0x3f')]);return db[_0xefdd('0x43')]['find'](_0x2cc73f)[_0xefdd('0x40')](handleEntityNotFound(_0x511fb9,null))[_0xefdd('0x40')](respondWithResult(_0x511fb9,null))[_0xefdd('0x46')](handleError(_0x511fb9,null));};exports['create']=function(_0x3af21b,_0x3fc0f2){return db['MailSubstatus'][_0xefdd('0x48')](_0x3af21b[_0xefdd('0x49')],{})[_0xefdd('0x40')](respondWithResult(_0x3fc0f2,0xc9))[_0xefdd('0x46')](handleError(_0x3fc0f2,null));};exports[_0xefdd('0x4a')]=function(_0x5511b2,_0x340a5d){if(_0x5511b2[_0xefdd('0x49')]['id']){delete _0x5511b2[_0xefdd('0x49')]['id'];}return db[_0xefdd('0x43')][_0xefdd('0x4b')]({'where':{'id':_0x5511b2[_0xefdd('0x4c')]['id']}})[_0xefdd('0x40')](handleEntityNotFound(_0x340a5d,null))['then'](saveUpdates(_0x5511b2[_0xefdd('0x49')],null))[_0xefdd('0x40')](respondWithResult(_0x340a5d,null))[_0xefdd('0x46')](handleError(_0x340a5d,null));};exports[_0xefdd('0x23')]=function(_0x10d9f9,_0x3389bf){return db[_0xefdd('0x43')][_0xefdd('0x4b')]({'where':{'id':_0x10d9f9[_0xefdd('0x4c')]['id']}})[_0xefdd('0x40')](handleEntityNotFound(_0x3389bf,null))[_0xefdd('0x40')](removeEntity(_0x3389bf,null))[_0xefdd('0x46')](handleError(_0x3389bf,null));};exports['describe']=function(_0x4fd958,_0x66e4d0){return db[_0xefdd('0x43')][_0xefdd('0x4d')]()[_0xefdd('0x40')](respondWithResult(_0x66e4d0,null))['catch'](handleError(_0x66e4d0,null));}; \ No newline at end of file +var _0x1acd=['findAll','catch','show','keys','includeAll','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','MailSubstatus','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include'];(function(_0x421be9,_0x3ce028){var _0x25a0f6=function(_0x23ca4c){while(--_0x23ca4c){_0x421be9['push'](_0x421be9['shift']());}};_0x25a0f6(++_0x3ce028);}(_0x1acd,0x1d2));var _0xd1ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1acd[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xd1ac('0x0'));var emlformat=require(_0xd1ac('0x1'));var rimraf=require(_0xd1ac('0x2'));var zipdir=require(_0xd1ac('0x3'));var jsonpatch=require(_0xd1ac('0x4'));var rp=require('request-promise');var moment=require(_0xd1ac('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd1ac('0x6'));var util=require(_0xd1ac('0x7'));var path=require(_0xd1ac('0x8'));var sox=require(_0xd1ac('0x9'));var csv=require(_0xd1ac('0xa'));var ejs=require(_0xd1ac('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd1ac('0xc'));var deskjs=require(_0xd1ac('0xd'));var toCsv=require(_0xd1ac('0xa'));var querystring=require(_0xd1ac('0xe'));var Papa=require(_0xd1ac('0xf'));var Redis=require(_0xd1ac('0x10'));var authService=require(_0xd1ac('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd1ac('0x12'));var hardwareService=require(_0xd1ac('0x13'));var logger=require(_0xd1ac('0x14'))(_0xd1ac('0x15'));var utils=require('../../config/utils');var config=require(_0xd1ac('0x16'));var licenseUtil=require(_0xd1ac('0x17'));var db=require(_0xd1ac('0x18'))['db'];function respondWithStatusCode(_0x2a3e72,_0x13212e){_0x13212e=_0x13212e||0xcc;return function(_0x24f303){if(_0x24f303){return _0x2a3e72[_0xd1ac('0x19')](_0x13212e);}return _0x2a3e72[_0xd1ac('0x1a')](_0x13212e)['end']();};}function respondWithResult(_0x5229fa,_0x2597ab){_0x2597ab=_0x2597ab||0xc8;return function(_0x567628){if(_0x567628){return _0x5229fa[_0xd1ac('0x1a')](_0x2597ab)[_0xd1ac('0x1b')](_0x567628);}};}function respondWithFilteredResult(_0x32a4dc,_0x479e32){return function(_0x1aee7d){if(_0x1aee7d){var _0x114a4d=_0x1aee7d[_0xd1ac('0x1c')],_0x23168d=_0x479e32[_0xd1ac('0x1d')],_0x349a40=_0x479e32[_0xd1ac('0x1d')]+_0x479e32['limit'],_0x497594;if(_0x349a40>=_0x114a4d){_0x349a40=_0x114a4d;_0x497594=0xc8;}else{_0x497594=0xce;}_0x32a4dc[_0xd1ac('0x1a')](_0x497594);return _0x32a4dc[_0xd1ac('0x1e')]('Content-Range',_0x23168d+'-'+_0x349a40+'/'+_0x114a4d)['json'](_0x1aee7d);}return null;};}function patchUpdates(_0x20ac43){return function(_0x1b491f){try{jsonpatch[_0xd1ac('0x1f')](_0x1b491f,_0x20ac43,!![]);}catch(_0x491597){return BPromise[_0xd1ac('0x20')](_0x491597);}return _0x1b491f['save']();};}function saveUpdates(_0x50c4cf,_0x1d930d){return function(_0x21ca93){if(_0x21ca93){return _0x21ca93[_0xd1ac('0x21')](_0x50c4cf)[_0xd1ac('0x22')](function(_0xb104ef){return _0xb104ef;});}return null;};}function removeEntity(_0x4e734b,_0x686f70){return function(_0x4b9dab){if(_0x4b9dab){return _0x4b9dab[_0xd1ac('0x23')]()[_0xd1ac('0x22')](function(){_0x4e734b[_0xd1ac('0x1a')](0xcc)[_0xd1ac('0x24')]();});}};}function handleEntityNotFound(_0x1f5f0e,_0x370e56){return function(_0x223073){if(!_0x223073){_0x1f5f0e[_0xd1ac('0x19')](0x194);}return _0x223073;};}function handleError(_0xdcdd55,_0x5ab8da){_0x5ab8da=_0x5ab8da||0x1f4;return function(_0x38baa){logger[_0xd1ac('0x25')](_0x38baa[_0xd1ac('0x26')]);if(_0x38baa[_0xd1ac('0x27')]){delete _0x38baa['name'];}_0xdcdd55[_0xd1ac('0x1a')](_0x5ab8da)[_0xd1ac('0x28')](_0x38baa);};}exports[_0xd1ac('0x29')]=function(_0x380703,_0x17a4fa){var _0x2a87a8={},_0x293958={},_0x3be0e5={'count':0x0,'rows':[]};var _0xc79dc6=_[_0xd1ac('0x2a')](db[_0xd1ac('0x2b')]['rawAttributes'],function(_0x4278ae){return{'name':_0x4278ae[_0xd1ac('0x2c')],'type':_0x4278ae[_0xd1ac('0x2d')][_0xd1ac('0x2e')]};});_0x293958[_0xd1ac('0x2f')]=_[_0xd1ac('0x2a')](_0xc79dc6,_0xd1ac('0x27'));_0x293958[_0xd1ac('0x30')]=_['keys'](_0x380703[_0xd1ac('0x30')]);_0x293958['filters']=_['intersection'](_0x293958['model'],_0x293958[_0xd1ac('0x30')]);_0x2a87a8[_0xd1ac('0x31')]=_[_0xd1ac('0x32')](_0x293958['model'],qs[_0xd1ac('0x33')](_0x380703[_0xd1ac('0x30')][_0xd1ac('0x33')]));_0x2a87a8[_0xd1ac('0x31')]=_0x2a87a8['attributes'][_0xd1ac('0x34')]?_0x2a87a8[_0xd1ac('0x31')]:_0x293958[_0xd1ac('0x2f')];if(!_0x380703[_0xd1ac('0x30')][_0xd1ac('0x35')](_0xd1ac('0x36'))){_0x2a87a8['limit']=qs[_0xd1ac('0x37')](_0x380703[_0xd1ac('0x30')]['limit']);_0x2a87a8[_0xd1ac('0x1d')]=qs[_0xd1ac('0x1d')](_0x380703['query'][_0xd1ac('0x1d')]);}_0x2a87a8[_0xd1ac('0x38')]=qs[_0xd1ac('0x39')](_0x380703[_0xd1ac('0x30')]['sort']);_0x2a87a8[_0xd1ac('0x3a')]=qs[_0xd1ac('0x3b')](_[_0xd1ac('0x3c')](_0x380703['query'],_0x293958['filters']),_0xc79dc6);if(_0x380703[_0xd1ac('0x30')]['filter']){_0x2a87a8[_0xd1ac('0x3a')]=_[_0xd1ac('0x3d')](_0x2a87a8['where'],{'$or':_[_0xd1ac('0x2a')](_0xc79dc6,function(_0x139cc0){if(_0x139cc0[_0xd1ac('0x2d')]!==_0xd1ac('0x3e')){var _0x101d11={};_0x101d11[_0x139cc0['name']]={'$like':'%'+_0x380703[_0xd1ac('0x30')][_0xd1ac('0x3f')]+'%'};return _0x101d11;}})});}_0x2a87a8=_['merge']({},_0x2a87a8,_0x380703[_0xd1ac('0x40')]);var _0xea9d53={'where':_0x2a87a8['where']};return db[_0xd1ac('0x2b')][_0xd1ac('0x1c')](_0xea9d53)['then'](function(_0x44f430){_0x3be0e5[_0xd1ac('0x1c')]=_0x44f430;if(_0x380703[_0xd1ac('0x30')]['includeAll']){_0x2a87a8[_0xd1ac('0x41')]=[{'all':!![]}];}return db[_0xd1ac('0x2b')][_0xd1ac('0x42')](_0x2a87a8);})[_0xd1ac('0x22')](function(_0x561d94){_0x3be0e5['rows']=_0x561d94;return _0x3be0e5;})['then'](respondWithFilteredResult(_0x17a4fa,_0x2a87a8))[_0xd1ac('0x43')](handleError(_0x17a4fa,null));};exports[_0xd1ac('0x44')]=function(_0x4f9cf8,_0x5ca21f){var _0x325054={'raw':!![],'where':{'id':_0x4f9cf8['params']['id']}},_0xab9321={};_0xab9321[_0xd1ac('0x2f')]=_[_0xd1ac('0x45')](db[_0xd1ac('0x2b')]['rawAttributes']);_0xab9321[_0xd1ac('0x30')]=_[_0xd1ac('0x45')](_0x4f9cf8[_0xd1ac('0x30')]);_0xab9321['filters']=_[_0xd1ac('0x32')](_0xab9321[_0xd1ac('0x2f')],_0xab9321[_0xd1ac('0x30')]);_0x325054['attributes']=_[_0xd1ac('0x32')](_0xab9321[_0xd1ac('0x2f')],qs['fields'](_0x4f9cf8[_0xd1ac('0x30')][_0xd1ac('0x33')]));_0x325054[_0xd1ac('0x31')]=_0x325054[_0xd1ac('0x31')][_0xd1ac('0x34')]?_0x325054[_0xd1ac('0x31')]:_0xab9321['model'];if(_0x4f9cf8[_0xd1ac('0x30')][_0xd1ac('0x46')]){_0x325054['include']=[{'all':!![]}];}_0x325054=_['merge']({},_0x325054,_0x4f9cf8['options']);return db[_0xd1ac('0x2b')][_0xd1ac('0x47')](_0x325054)[_0xd1ac('0x22')](handleEntityNotFound(_0x5ca21f,null))[_0xd1ac('0x22')](respondWithResult(_0x5ca21f,null))['catch'](handleError(_0x5ca21f,null));};exports['create']=function(_0x1998f1,_0x5bb5e0){return db['MailSubstatus'][_0xd1ac('0x48')](_0x1998f1[_0xd1ac('0x49')],{})[_0xd1ac('0x22')](respondWithResult(_0x5bb5e0,0xc9))[_0xd1ac('0x43')](handleError(_0x5bb5e0,null));};exports[_0xd1ac('0x21')]=function(_0x4c01e3,_0x5dec69){if(_0x4c01e3[_0xd1ac('0x49')]['id']){delete _0x4c01e3[_0xd1ac('0x49')]['id'];}return db['MailSubstatus'][_0xd1ac('0x47')]({'where':{'id':_0x4c01e3[_0xd1ac('0x4a')]['id']}})[_0xd1ac('0x22')](handleEntityNotFound(_0x5dec69,null))[_0xd1ac('0x22')](saveUpdates(_0x4c01e3[_0xd1ac('0x49')],null))['then'](respondWithResult(_0x5dec69,null))[_0xd1ac('0x43')](handleError(_0x5dec69,null));};exports[_0xd1ac('0x23')]=function(_0x3e52e9,_0x3da140){return db['MailSubstatus'][_0xd1ac('0x47')]({'where':{'id':_0x3e52e9[_0xd1ac('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3da140,null))[_0xd1ac('0x22')](removeEntity(_0x3da140,null))[_0xd1ac('0x43')](handleError(_0x3da140,null));};exports['describe']=function(_0x333f44,_0x851f95){return db[_0xd1ac('0x2b')][_0xd1ac('0x4b')]()['then'](respondWithResult(_0x851f95,null))[_0xd1ac('0x43')](handleError(_0x851f95,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 03e3074..6884521 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 _0x2c91=['path','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x18b746,_0x4ed88f){var _0x24fb9e=function(_0xe6f27){while(--_0xe6f27){_0x18b746['push'](_0x18b746['shift']());}};_0x24fb9e(++_0x4ed88f);}(_0x2c91,0x158));var _0x12c9=function(_0x2e6b82,_0x55335c){_0x2e6b82=_0x2e6b82-0x0;var _0x18574b=_0x2c91[_0x2e6b82];return _0x18574b;};'use strict';var _=require(_0x12c9('0x0'));var util=require(_0x12c9('0x1'));var logger=require(_0x12c9('0x2'))(_0x12c9('0x3'));var moment=require(_0x12c9('0x4'));var BPromise=require(_0x12c9('0x5'));var rp=require(_0x12c9('0x6'));var fs=require('fs');var path=require(_0x12c9('0x7'));var rimraf=require('rimraf');var config=require(_0x12c9('0x8'));var attributes=require(_0x12c9('0x9'));module[_0x12c9('0xa')]=function(_0x38bd43,_0x14c359){return _0x38bd43[_0x12c9('0xb')](_0x12c9('0xc'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefda=['../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','lodash','api','moment','request-promise','path','rimraf'];(function(_0x1c9b35,_0x490c49){var _0x33ca65=function(_0x5d0cf7){while(--_0x5d0cf7){_0x1c9b35['push'](_0x1c9b35['shift']());}};_0x33ca65(++_0x490c49);}(_0xefda,0x96));var _0xaefd=function(_0x505f6c,_0x20875a){_0x505f6c=_0x505f6c-0x0;var _0x39e74e=_0xefda[_0x505f6c];return _0x39e74e;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaefd('0x1'));var moment=require(_0xaefd('0x2'));var BPromise=require('bluebird');var rp=require(_0xaefd('0x3'));var fs=require('fs');var path=require(_0xaefd('0x4'));var rimraf=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var attributes=require(_0xaefd('0x7'));module[_0xaefd('0x8')]=function(_0x497258,_0x3677ea){return _0x497258[_0xaefd('0x9')](_0xaefd('0xa'),attributes,{'tableName':_0xaefd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 8ca991b..c830003 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 _0xfd28=['error','code','message','info','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','MailSubstatus,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x473970,_0xe20c1){var _0x18366e=function(_0x3af8dd){while(--_0x3af8dd){_0x473970['push'](_0x473970['shift']());}};_0x18366e(++_0xe20c1);}(_0xfd28,0x148));var _0x8fd2=function(_0x17a32f,_0x5a51a){_0x17a32f=_0x17a32f-0x0;var _0x15a293=_0xfd28[_0x17a32f];return _0x15a293;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var moment=require(_0x8fd2('0x1'));var BPromise=require('bluebird');var rs=require(_0x8fd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd2('0x3'))['db'];var utils=require(_0x8fd2('0x4'));var logger=require(_0x8fd2('0x5'))('rpc');var config=require(_0x8fd2('0x6'));var jayson=require(_0x8fd2('0x7'));var client=jayson[_0x8fd2('0x8')][_0x8fd2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f0afc,_0x4bdc1a,_0x53d938){return new BPromise(function(_0x10fccf,_0x466c3d){return client[_0x8fd2('0xa')](_0x2f0afc,_0x53d938)['then'](function(_0x13cc69){logger['info'](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');logger[_0x8fd2('0xc')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x4bdc1a,_0x8fd2('0xd'),JSON['stringify'](_0x13cc69));if(_0x13cc69[_0x8fd2('0xe')]){if(_0x13cc69['error'][_0x8fd2('0xf')]===0x1f4){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x466c3d(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x10fccf(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}else{logger[_0x8fd2('0x11')](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');_0x10fccf(_0x13cc69[_0x8fd2('0x12')]['message']);}})['catch'](function(_0x56f75d){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x56f75d);_0x466c3d(_0x56f75d);});});} \ No newline at end of file +var _0x2dae=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird'];(function(_0x270e2d,_0x449846){var _0x5ca702=function(_0x205f2a){while(--_0x205f2a){_0x270e2d['push'](_0x270e2d['shift']());}};_0x5ca702(++_0x449846);}(_0x2dae,0xc3));var _0xe2da=function(_0x22868f,_0x450f48){_0x22868f=_0x22868f-0x0;var _0x97bc75=_0x2dae[_0x22868f];return _0x97bc75;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var moment=require(_0xe2da('0x1'));var BPromise=require(_0xe2da('0x2'));var rs=require(_0xe2da('0x3'));var fs=require('fs');var Redis=require(_0xe2da('0x4'));var db=require(_0xe2da('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe2da('0x6'))(_0xe2da('0x7'));var config=require(_0xe2da('0x8'));var jayson=require(_0xe2da('0x9'));var client=jayson['client'][_0xe2da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x89c70b,_0x34cc98,_0x2efbd8){return new BPromise(function(_0x238da3,_0x1c71ea){return client[_0xe2da('0xb')](_0x89c70b,_0x2efbd8)[_0xe2da('0xc')](function(_0x68aa40){logger['info'](_0xe2da('0xd'),_0x34cc98,_0xe2da('0xe'));logger[_0xe2da('0xf')](_0xe2da('0x10'),_0x34cc98,_0xe2da('0xe'),JSON[_0xe2da('0x11')](_0x68aa40));if(_0x68aa40[_0xe2da('0x12')]){if(_0x68aa40[_0xe2da('0x12')]['code']===0x1f4){logger[_0xe2da('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x34cc98,_0x68aa40[_0xe2da('0x12')][_0xe2da('0x13')]);return _0x1c71ea(_0x68aa40[_0xe2da('0x12')][_0xe2da('0x13')]);}logger[_0xe2da('0x12')](_0xe2da('0xd'),_0x34cc98,_0x68aa40[_0xe2da('0x12')]['message']);return _0x238da3(_0x68aa40[_0xe2da('0x12')]['message']);}else{logger['info'](_0xe2da('0xd'),_0x34cc98,_0xe2da('0xe'));_0x238da3(_0x68aa40[_0xe2da('0x14')]['message']);}})[_0xe2da('0x15')](function(_0x2c0353){logger[_0xe2da('0x12')](_0xe2da('0xd'),_0x34cc98,_0x2c0353);_0x1c71ea(_0x2c0353);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 1608dd3..d55d695 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 _0xa5da=['get','isAuthenticated','index','post','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','../../config/environment','./mailTransferReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa5da,0x6a));var _0xaa5d=function(_0x5dc913,_0x39e1ec){_0x5dc913=_0x5dc913-0x0;var _0x4ec94a=_0xa5da[_0x5dc913];return _0x4ec94a;};'use strict';var multer=require('multer');var util=require(_0xaa5d('0x0'));var path=require(_0xaa5d('0x1'));var timeout=require(_0xaa5d('0x2'));var express=require(_0xaa5d('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaa5d('0x4'));var controller=require(_0xaa5d('0x5'));router[_0xaa5d('0x6')]('/',auth[_0xaa5d('0x7')](),controller[_0xaa5d('0x8')]);router['get']('/describe',auth[_0xaa5d('0x7')](),controller['describe']);router['get']('/:id',auth[_0xaa5d('0x7')](),controller['show']);router[_0xaa5d('0x9')]('/',auth[_0xaa5d('0x7')](),controller['create']);router[_0xaa5d('0xa')](_0xaa5d('0xb'),auth[_0xaa5d('0x7')](),controller[_0xaa5d('0xc')]);router[_0xaa5d('0xd')]('/:id',auth[_0xaa5d('0x7')](),controller[_0xaa5d('0xe')]);module[_0xaa5d('0xf')]=router; \ No newline at end of file +var _0x4364=['put','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x4b6d4b,_0x5975f5){var _0x13618c=function(_0x2d402e){while(--_0x2d402e){_0x4b6d4b['push'](_0x4b6d4b['shift']());}};_0x13618c(++_0x5975f5);}(_0x4364,0xb8));var _0x4436=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x4364[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0x4436('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4436('0x1'));var express=require(_0x4436('0x2'));var router=express[_0x4436('0x3')]();var auth=require(_0x4436('0x4'));var interaction=require(_0x4436('0x5'));var config=require(_0x4436('0x6'));var controller=require('./mailTransferReport.controller');router[_0x4436('0x7')]('/',auth[_0x4436('0x8')](),controller[_0x4436('0x9')]);router[_0x4436('0x7')](_0x4436('0xa'),auth['isAuthenticated'](),controller[_0x4436('0xb')]);router[_0x4436('0x7')](_0x4436('0xc'),auth[_0x4436('0x8')](),controller[_0x4436('0xd')]);router[_0x4436('0xe')]('/',auth[_0x4436('0x8')](),controller[_0x4436('0xf')]);router[_0x4436('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4436('0x11')](_0x4436('0xc'),auth[_0x4436('0x8')](),controller[_0x4436('0x12')]);module[_0x4436('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 b37fb07..c02a017 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 _0xfdd9=['DATE','NOW','moment','sequelize','account','agent','queue'];(function(_0x618644,_0x24242b){var _0x401623=function(_0x58dcce){while(--_0x58dcce){_0x618644['push'](_0x618644['shift']());}};_0x401623(++_0x24242b);}(_0xfdd9,0x1bb));var _0x9fdd=function(_0x4e1987,_0x57f1ef){_0x4e1987=_0x4e1987-0x0;var _0xa63975=_0xfdd9[_0x4e1987];return _0xa63975;};'use strict';var moment=require(_0x9fdd('0x0'));var Sequelize=require(_0x9fdd('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9fdd('0x2'),_0x9fdd('0x3'),_0x9fdd('0x4')),'allowNull':![],'defaultValue':_0x9fdd('0x4')},'transferredAt':{'type':Sequelize[_0x9fdd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x9fdd('0x6')]}}; \ No newline at end of file +var _0x54e8=['DATE','moment','sequelize','exports','STRING','account','queue'];(function(_0x105c51,_0x412d34){var _0x1f727d=function(_0x536704){while(--_0x536704){_0x105c51['push'](_0x105c51['shift']());}};_0x1f727d(++_0x412d34);}(_0x54e8,0xcc));var _0x854e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x54e8[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x854e('0x0'));var Sequelize=require(_0x854e('0x1'));module[_0x854e('0x2')]={'uniqueid':{'type':Sequelize[_0x854e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x854e('0x4'),'agent','queue'),'allowNull':![],'defaultValue':_0x854e('0x5')},'transferredAt':{'type':Sequelize[_0x854e('0x6')],'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 c345aeb..dbff2c2 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 _0xe53c=['crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','apply','save','then','sendStatus','name','send','index','map','MailTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','destroy','eml-format','rimraf','fast-json-patch','moment','mustache','util','to-csv','ejs'];(function(_0x145a43,_0x5dfa8c){var _0x14abc6=function(_0x3643fc){while(--_0x3643fc){_0x145a43['push'](_0x145a43['shift']());}};_0x14abc6(++_0x5dfa8c);}(_0xe53c,0x17e));var _0xce53=function(_0x130705,_0x2d266b){_0x130705=_0x130705-0x0;var _0x1fa991=_0xe53c[_0x130705];return _0x1fa991;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xce53('0x0'));var rimraf=require(_0xce53('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce53('0x2'));var rp=require('request-promise');var moment=require(_0xce53('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xce53('0x4'));var util=require(_0xce53('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xce53('0x6'));var ejs=require(_0xce53('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xce53('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xce53('0x9'));var Papa=require(_0xce53('0xa'));var Redis=require(_0xce53('0xb'));var authService=require(_0xce53('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xce53('0xd'))(_0xce53('0xe'));var utils=require(_0xce53('0xf'));var config=require(_0xce53('0x10'));var licenseUtil=require(_0xce53('0x11'));var db=require(_0xce53('0x12'))['db'];function respondWithStatusCode(_0x1cb32d,_0x399ae0){_0x399ae0=_0x399ae0||0xcc;return function(_0x3ea888){if(_0x3ea888){return _0x1cb32d['sendStatus'](_0x399ae0);}return _0x1cb32d[_0xce53('0x13')](_0x399ae0)[_0xce53('0x14')]();};}function respondWithResult(_0x2f9c0d,_0x289c51){_0x289c51=_0x289c51||0xc8;return function(_0x5ef108){if(_0x5ef108){return _0x2f9c0d[_0xce53('0x13')](_0x289c51)[_0xce53('0x15')](_0x5ef108);}};}function respondWithFilteredResult(_0x14abb2,_0x11d1c3){return function(_0xe2c356){if(_0xe2c356){var _0x386ce0=_0xe2c356['count'],_0x8c79b2=_0x11d1c3[_0xce53('0x16')],_0x5dbf13=_0x11d1c3[_0xce53('0x16')]+_0x11d1c3[_0xce53('0x17')],_0x56ef5c;if(_0x5dbf13>=_0x386ce0){_0x5dbf13=_0x386ce0;_0x56ef5c=0xc8;}else{_0x56ef5c=0xce;}_0x14abb2['status'](_0x56ef5c);return _0x14abb2['set']('Content-Range',_0x8c79b2+'-'+_0x5dbf13+'/'+_0x386ce0)[_0xce53('0x15')](_0xe2c356);}return null;};}function patchUpdates(_0x32d399){return function(_0x21424d){try{jsonpatch[_0xce53('0x18')](_0x21424d,_0x32d399,!![]);}catch(_0x1651cf){return BPromise['reject'](_0x1651cf);}return _0x21424d[_0xce53('0x19')]();};}function saveUpdates(_0x3163b8,_0x51e319){return function(_0xa07591){if(_0xa07591){return _0xa07591['update'](_0x3163b8)[_0xce53('0x1a')](function(_0x44b45d){return _0x44b45d;});}return null;};}function removeEntity(_0x5715f1,_0x4f72fb){return function(_0x494ec5){if(_0x494ec5){return _0x494ec5['destroy']()[_0xce53('0x1a')](function(){_0x5715f1[_0xce53('0x13')](0xcc)[_0xce53('0x14')]();});}};}function handleEntityNotFound(_0x385e26,_0x3cc517){return function(_0x30a503){if(!_0x30a503){_0x385e26[_0xce53('0x1b')](0x194);}return _0x30a503;};}function handleError(_0xf0ec95,_0x347833){_0x347833=_0x347833||0x1f4;return function(_0x5dcba2){logger['error'](_0x5dcba2['stack']);if(_0x5dcba2['name']){delete _0x5dcba2[_0xce53('0x1c')];}_0xf0ec95['status'](_0x347833)[_0xce53('0x1d')](_0x5dcba2);};}exports[_0xce53('0x1e')]=function(_0x590f4e,_0x1d1336){var _0x398e60={},_0x45ee1a={},_0x50edef={'count':0x0,'rows':[]};var _0x33be93=_[_0xce53('0x1f')](db[_0xce53('0x20')]['rawAttributes'],function(_0x5ea76f){return{'name':_0x5ea76f[_0xce53('0x21')],'type':_0x5ea76f[_0xce53('0x22')][_0xce53('0x23')]};});_0x45ee1a[_0xce53('0x24')]=_[_0xce53('0x1f')](_0x33be93,_0xce53('0x1c'));_0x45ee1a[_0xce53('0x25')]=_[_0xce53('0x26')](_0x590f4e['query']);_0x45ee1a[_0xce53('0x27')]=_[_0xce53('0x28')](_0x45ee1a[_0xce53('0x24')],_0x45ee1a['query']);_0x398e60[_0xce53('0x29')]=_[_0xce53('0x28')](_0x45ee1a['model'],qs[_0xce53('0x2a')](_0x590f4e['query'][_0xce53('0x2a')]));_0x398e60[_0xce53('0x29')]=_0x398e60[_0xce53('0x29')]['length']?_0x398e60['attributes']:_0x45ee1a[_0xce53('0x24')];if(!_0x590f4e['query'][_0xce53('0x2b')]('nolimit')){_0x398e60[_0xce53('0x17')]=qs[_0xce53('0x17')](_0x590f4e['query']['limit']);_0x398e60[_0xce53('0x16')]=qs[_0xce53('0x16')](_0x590f4e[_0xce53('0x25')][_0xce53('0x16')]);}_0x398e60[_0xce53('0x2c')]=qs[_0xce53('0x2d')](_0x590f4e[_0xce53('0x25')][_0xce53('0x2d')]);_0x398e60[_0xce53('0x2e')]=qs[_0xce53('0x27')](_['pick'](_0x590f4e[_0xce53('0x25')],_0x45ee1a[_0xce53('0x27')]),_0x33be93);if(_0x590f4e[_0xce53('0x25')][_0xce53('0x2f')]){_0x398e60['where']=_[_0xce53('0x30')](_0x398e60[_0xce53('0x2e')],{'$or':_[_0xce53('0x1f')](_0x33be93,function(_0x5ddd64){if(_0x5ddd64[_0xce53('0x22')]!==_0xce53('0x31')){var _0x2f9446={};_0x2f9446[_0x5ddd64[_0xce53('0x1c')]]={'$like':'%'+_0x590f4e[_0xce53('0x25')][_0xce53('0x2f')]+'%'};return _0x2f9446;}})});}_0x398e60=_[_0xce53('0x30')]({},_0x398e60,_0x590f4e[_0xce53('0x32')]);var _0x58ea02={'where':_0x398e60['where']};return db['MailTransferReport'][_0xce53('0x33')](_0x58ea02)[_0xce53('0x1a')](function(_0x1132c4){_0x50edef['count']=_0x1132c4;if(_0x590f4e[_0xce53('0x25')]['includeAll']){_0x398e60[_0xce53('0x34')]=[{'all':!![]}];}return db['MailTransferReport'][_0xce53('0x35')](_0x398e60);})[_0xce53('0x1a')](function(_0x202a18){_0x50edef[_0xce53('0x36')]=_0x202a18;return _0x50edef;})[_0xce53('0x1a')](respondWithFilteredResult(_0x1d1336,_0x398e60))[_0xce53('0x37')](handleError(_0x1d1336,null));};exports[_0xce53('0x38')]=function(_0x355e25,_0x34494d){var _0x49646f={'raw':!![],'where':{'id':_0x355e25[_0xce53('0x39')]['id']}},_0x5de938={};_0x5de938[_0xce53('0x24')]=_[_0xce53('0x26')](db[_0xce53('0x20')][_0xce53('0x3a')]);_0x5de938[_0xce53('0x25')]=_[_0xce53('0x26')](_0x355e25[_0xce53('0x25')]);_0x5de938['filters']=_['intersection'](_0x5de938['model'],_0x5de938[_0xce53('0x25')]);_0x49646f[_0xce53('0x29')]=_[_0xce53('0x28')](_0x5de938[_0xce53('0x24')],qs[_0xce53('0x2a')](_0x355e25[_0xce53('0x25')][_0xce53('0x2a')]));_0x49646f[_0xce53('0x29')]=_0x49646f[_0xce53('0x29')][_0xce53('0x3b')]?_0x49646f[_0xce53('0x29')]:_0x5de938[_0xce53('0x24')];if(_0x355e25[_0xce53('0x25')][_0xce53('0x3c')]){_0x49646f[_0xce53('0x34')]=[{'all':!![]}];}_0x49646f=_[_0xce53('0x30')]({},_0x49646f,_0x355e25['options']);return db[_0xce53('0x20')][_0xce53('0x3d')](_0x49646f)[_0xce53('0x1a')](handleEntityNotFound(_0x34494d,null))['then'](respondWithResult(_0x34494d,null))['catch'](handleError(_0x34494d,null));};exports[_0xce53('0x3e')]=function(_0x2d501c,_0x7cd064){return db['MailTransferReport'][_0xce53('0x3e')](_0x2d501c[_0xce53('0x3f')],{})[_0xce53('0x1a')](respondWithResult(_0x7cd064,0xc9))[_0xce53('0x37')](handleError(_0x7cd064,null));};exports['update']=function(_0x301c91,_0xc9c5b3){if(_0x301c91[_0xce53('0x3f')]['id']){delete _0x301c91[_0xce53('0x3f')]['id'];}return db[_0xce53('0x20')][_0xce53('0x3d')]({'where':{'id':_0x301c91[_0xce53('0x39')]['id']}})[_0xce53('0x1a')](handleEntityNotFound(_0xc9c5b3,null))[_0xce53('0x1a')](saveUpdates(_0x301c91[_0xce53('0x3f')],null))[_0xce53('0x1a')](respondWithResult(_0xc9c5b3,null))[_0xce53('0x37')](handleError(_0xc9c5b3,null));};exports[_0xce53('0x40')]=function(_0x4f7544,_0xe65425){return db[_0xce53('0x20')][_0xce53('0x3d')]({'where':{'id':_0x4f7544[_0xce53('0x39')]['id']}})[_0xce53('0x1a')](handleEntityNotFound(_0xe65425,null))[_0xce53('0x1a')](removeEntity(_0xe65425,null))[_0xce53('0x37')](handleError(_0xe65425,null));};exports['describe']=function(_0x1e2906,_0x5b913a){return db[_0xce53('0x20')]['describe']()['then'](respondWithResult(_0x5b913a,null))['catch'](handleError(_0x5b913a,null));}; \ No newline at end of file +var _0x63da=['index','map','rawAttributes','fieldName','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','MailTransferReport','findAll','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','error','stack'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x63da,0x147));var _0xa63d=function(_0x158dd7,_0x1f5f90){_0x158dd7=_0x158dd7-0x0;var _0x1772ba=_0x63da[_0x158dd7];return _0x1772ba;};'use strict';var pdf=require(_0xa63d('0x0'));var emlformat=require(_0xa63d('0x1'));var rimraf=require(_0xa63d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa63d('0x3'));var rp=require(_0xa63d('0x4'));var moment=require(_0xa63d('0x5'));var BPromise=require(_0xa63d('0x6'));var Mustache=require('mustache');var util=require(_0xa63d('0x7'));var path=require(_0xa63d('0x8'));var sox=require('sox');var csv=require(_0xa63d('0x9'));var ejs=require(_0xa63d('0xa'));var fs=require('fs');var _=require(_0xa63d('0xb'));var squel=require(_0xa63d('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa63d('0x9'));var querystring=require('querystring');var Papa=require(_0xa63d('0xd'));var Redis=require(_0xa63d('0xe'));var authService=require(_0xa63d('0xf'));var qs=require(_0xa63d('0x10'));var as=require(_0xa63d('0x11'));var hardwareService=require(_0xa63d('0x12'));var logger=require(_0xa63d('0x13'))(_0xa63d('0x14'));var utils=require('../../config/utils');var config=require(_0xa63d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa63d('0x16'))['db'];function respondWithStatusCode(_0x3ddff4,_0xf7de5e){_0xf7de5e=_0xf7de5e||0xcc;return function(_0x1debb6){if(_0x1debb6){return _0x3ddff4[_0xa63d('0x17')](_0xf7de5e);}return _0x3ddff4[_0xa63d('0x18')](_0xf7de5e)[_0xa63d('0x19')]();};}function respondWithResult(_0x39d0a9,_0x415754){_0x415754=_0x415754||0xc8;return function(_0x1e0b7b){if(_0x1e0b7b){return _0x39d0a9['status'](_0x415754)[_0xa63d('0x1a')](_0x1e0b7b);}};}function respondWithFilteredResult(_0x368343,_0x4179b9){return function(_0x504bab){if(_0x504bab){var _0x47cb5=_0x504bab[_0xa63d('0x1b')],_0x3b794a=_0x4179b9[_0xa63d('0x1c')],_0x424640=_0x4179b9[_0xa63d('0x1c')]+_0x4179b9[_0xa63d('0x1d')],_0x30f3c9;if(_0x424640>=_0x47cb5){_0x424640=_0x47cb5;_0x30f3c9=0xc8;}else{_0x30f3c9=0xce;}_0x368343['status'](_0x30f3c9);return _0x368343[_0xa63d('0x1e')]('Content-Range',_0x3b794a+'-'+_0x424640+'/'+_0x47cb5)[_0xa63d('0x1a')](_0x504bab);}return null;};}function patchUpdates(_0x1576c4){return function(_0x110ace){try{jsonpatch['apply'](_0x110ace,_0x1576c4,!![]);}catch(_0x421dd0){return BPromise[_0xa63d('0x1f')](_0x421dd0);}return _0x110ace[_0xa63d('0x20')]();};}function saveUpdates(_0x79873c,_0x58435e){return function(_0xcfa240){if(_0xcfa240){return _0xcfa240[_0xa63d('0x21')](_0x79873c)[_0xa63d('0x22')](function(_0x3ec782){return _0x3ec782;});}return null;};}function removeEntity(_0x3453ca,_0x1c90e5){return function(_0x49d1e3){if(_0x49d1e3){return _0x49d1e3[_0xa63d('0x23')]()[_0xa63d('0x22')](function(){_0x3453ca[_0xa63d('0x18')](0xcc)[_0xa63d('0x19')]();});}};}function handleEntityNotFound(_0x5f12ce,_0xea25e1){return function(_0x318f70){if(!_0x318f70){_0x5f12ce[_0xa63d('0x17')](0x194);}return _0x318f70;};}function handleError(_0x23bae0,_0x4709df){_0x4709df=_0x4709df||0x1f4;return function(_0x258bbe){logger[_0xa63d('0x24')](_0x258bbe[_0xa63d('0x25')]);if(_0x258bbe['name']){delete _0x258bbe['name'];}_0x23bae0[_0xa63d('0x18')](_0x4709df)['send'](_0x258bbe);};}exports[_0xa63d('0x26')]=function(_0x3863c4,_0x50666e){var _0x429d28={},_0x1f29e6={},_0xcd27fa={'count':0x0,'rows':[]};var _0xa8fb1b=_[_0xa63d('0x27')](db['MailTransferReport'][_0xa63d('0x28')],function(_0x2752e0){return{'name':_0x2752e0[_0xa63d('0x29')],'type':_0x2752e0['type'][_0xa63d('0x2a')]};});_0x1f29e6[_0xa63d('0x2b')]=_[_0xa63d('0x27')](_0xa8fb1b,_0xa63d('0x2c'));_0x1f29e6[_0xa63d('0x2d')]=_[_0xa63d('0x2e')](_0x3863c4[_0xa63d('0x2d')]);_0x1f29e6[_0xa63d('0x2f')]=_['intersection'](_0x1f29e6[_0xa63d('0x2b')],_0x1f29e6[_0xa63d('0x2d')]);_0x429d28[_0xa63d('0x30')]=_[_0xa63d('0x31')](_0x1f29e6[_0xa63d('0x2b')],qs['fields'](_0x3863c4[_0xa63d('0x2d')][_0xa63d('0x32')]));_0x429d28[_0xa63d('0x30')]=_0x429d28[_0xa63d('0x30')][_0xa63d('0x33')]?_0x429d28[_0xa63d('0x30')]:_0x1f29e6[_0xa63d('0x2b')];if(!_0x3863c4[_0xa63d('0x2d')][_0xa63d('0x34')](_0xa63d('0x35'))){_0x429d28[_0xa63d('0x1d')]=qs['limit'](_0x3863c4[_0xa63d('0x2d')][_0xa63d('0x1d')]);_0x429d28[_0xa63d('0x1c')]=qs['offset'](_0x3863c4[_0xa63d('0x2d')]['offset']);}_0x429d28[_0xa63d('0x36')]=qs[_0xa63d('0x37')](_0x3863c4[_0xa63d('0x2d')][_0xa63d('0x37')]);_0x429d28[_0xa63d('0x38')]=qs['filters'](_['pick'](_0x3863c4[_0xa63d('0x2d')],_0x1f29e6['filters']),_0xa8fb1b);if(_0x3863c4['query'][_0xa63d('0x39')]){_0x429d28[_0xa63d('0x38')]=_[_0xa63d('0x3a')](_0x429d28[_0xa63d('0x38')],{'$or':_[_0xa63d('0x27')](_0xa8fb1b,function(_0x4add09){if(_0x4add09[_0xa63d('0x3b')]!==_0xa63d('0x3c')){var _0x3f2b2f={};_0x3f2b2f[_0x4add09[_0xa63d('0x2c')]]={'$like':'%'+_0x3863c4[_0xa63d('0x2d')][_0xa63d('0x39')]+'%'};return _0x3f2b2f;}})});}_0x429d28=_['merge']({},_0x429d28,_0x3863c4[_0xa63d('0x3d')]);var _0x56d3e5={'where':_0x429d28[_0xa63d('0x38')]};return db['MailTransferReport'][_0xa63d('0x1b')](_0x56d3e5)[_0xa63d('0x22')](function(_0x1048dc){_0xcd27fa[_0xa63d('0x1b')]=_0x1048dc;if(_0x3863c4[_0xa63d('0x2d')][_0xa63d('0x3e')]){_0x429d28[_0xa63d('0x3f')]=[{'all':!![]}];}return db[_0xa63d('0x40')][_0xa63d('0x41')](_0x429d28);})[_0xa63d('0x22')](function(_0x17d675){_0xcd27fa['rows']=_0x17d675;return _0xcd27fa;})[_0xa63d('0x22')](respondWithFilteredResult(_0x50666e,_0x429d28))[_0xa63d('0x42')](handleError(_0x50666e,null));};exports[_0xa63d('0x43')]=function(_0x4d146e,_0x4ce813){var _0x316a80={'raw':!![],'where':{'id':_0x4d146e[_0xa63d('0x44')]['id']}},_0x492af4={};_0x492af4[_0xa63d('0x2b')]=_['keys'](db[_0xa63d('0x40')]['rawAttributes']);_0x492af4['query']=_[_0xa63d('0x2e')](_0x4d146e['query']);_0x492af4[_0xa63d('0x2f')]=_['intersection'](_0x492af4[_0xa63d('0x2b')],_0x492af4[_0xa63d('0x2d')]);_0x316a80[_0xa63d('0x30')]=_[_0xa63d('0x31')](_0x492af4[_0xa63d('0x2b')],qs[_0xa63d('0x32')](_0x4d146e[_0xa63d('0x2d')][_0xa63d('0x32')]));_0x316a80[_0xa63d('0x30')]=_0x316a80['attributes']['length']?_0x316a80[_0xa63d('0x30')]:_0x492af4[_0xa63d('0x2b')];if(_0x4d146e[_0xa63d('0x2d')][_0xa63d('0x3e')]){_0x316a80[_0xa63d('0x3f')]=[{'all':!![]}];}_0x316a80=_[_0xa63d('0x3a')]({},_0x316a80,_0x4d146e[_0xa63d('0x3d')]);return db[_0xa63d('0x40')][_0xa63d('0x45')](_0x316a80)[_0xa63d('0x22')](handleEntityNotFound(_0x4ce813,null))['then'](respondWithResult(_0x4ce813,null))[_0xa63d('0x42')](handleError(_0x4ce813,null));};exports['create']=function(_0x520779,_0x2128bd){return db[_0xa63d('0x40')][_0xa63d('0x46')](_0x520779[_0xa63d('0x47')],{})[_0xa63d('0x22')](respondWithResult(_0x2128bd,0xc9))[_0xa63d('0x42')](handleError(_0x2128bd,null));};exports[_0xa63d('0x21')]=function(_0xa2519b,_0x4e7be9){if(_0xa2519b['body']['id']){delete _0xa2519b[_0xa63d('0x47')]['id'];}return db['MailTransferReport'][_0xa63d('0x45')]({'where':{'id':_0xa2519b[_0xa63d('0x44')]['id']}})['then'](handleEntityNotFound(_0x4e7be9,null))['then'](saveUpdates(_0xa2519b[_0xa63d('0x47')],null))[_0xa63d('0x22')](respondWithResult(_0x4e7be9,null))['catch'](handleError(_0x4e7be9,null));};exports[_0xa63d('0x23')]=function(_0x5674ec,_0xec2d80){return db[_0xa63d('0x40')][_0xa63d('0x45')]({'where':{'id':_0x5674ec[_0xa63d('0x44')]['id']}})['then'](handleEntityNotFound(_0xec2d80,null))[_0xa63d('0x22')](removeEntity(_0xec2d80,null))['catch'](handleError(_0xec2d80,null));};exports['describe']=function(_0x472887,_0x3acd1e){return db['MailTransferReport'][_0xa63d('0x48')]()[_0xa63d('0x22')](respondWithResult(_0x3acd1e,null))[_0xa63d('0x42')](handleError(_0x3acd1e,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index c40149b..6f6d16a 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 _0xaa17=['exports','define','MailTransferReport','report_mail_transfer','uniqueid','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xaa17,0xc3));var _0x7aa1=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xaa17[_0x110c3d];return _0x226d67;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7aa1('0x0'));var moment=require('moment');var BPromise=require(_0x7aa1('0x1'));var rp=require(_0x7aa1('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7aa1('0x3'));var config=require(_0x7aa1('0x4'));var attributes=require('./mailTransferReport.attributes');module[_0x7aa1('0x5')]=function(_0x3ca90c,_0x327ed9){return _0x3ca90c[_0x7aa1('0x6')](_0x7aa1('0x7'),attributes,{'tableName':_0x7aa1('0x8'),'paranoid':![],'indexes':[{'name':_0x7aa1('0x9'),'fields':[_0x7aa1('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xad0c=['rimraf','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','../../config/logger','moment','bluebird','path'];(function(_0x1eb837,_0x24429f){var _0x4ed333=function(_0x5041ab){while(--_0x5041ab){_0x1eb837['push'](_0x1eb837['shift']());}};_0x4ed333(++_0x24429f);}(_0xad0c,0x100));var _0xcad0=function(_0xf92537,_0x415884){_0xf92537=_0xf92537-0x0;var _0x10b59f=_0xad0c[_0xf92537];return _0x10b59f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcad0('0x0'))('api');var moment=require(_0xcad0('0x1'));var BPromise=require(_0xcad0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcad0('0x3'));var rimraf=require(_0xcad0('0x4'));var config=require('../../config/environment');var attributes=require(_0xcad0('0x5'));module[_0xcad0('0x6')]=function(_0x38d399,_0x3d8dea){return _0x38d399['define'](_0xcad0('0x7'),attributes,{'tableName':_0xcad0('0x8'),'paranoid':![],'indexes':[{'name':_0xcad0('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index a4e301a..df07f42 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 _0xa8f9=['info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5deea5,_0x230d81){var _0x3d1998=function(_0x39341d){while(--_0x39341d){_0x5deea5['push'](_0x5deea5['shift']());}};_0x3d1998(++_0x230d81);}(_0xa8f9,0x179));var _0x9a8f=function(_0x4e73c4,_0x15ae12){_0x4e73c4=_0x4e73c4-0x0;var _0x2759a9=_0xa8f9[_0x4e73c4];return _0x2759a9;};'use strict';var _=require(_0x9a8f('0x0'));var util=require(_0x9a8f('0x1'));var moment=require('moment');var BPromise=require(_0x9a8f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a8f('0x3'));var db=require(_0x9a8f('0x4'))['db'];var utils=require(_0x9a8f('0x5'));var logger=require('../../config/logger')(_0x9a8f('0x6'));var config=require(_0x9a8f('0x7'));var jayson=require(_0x9a8f('0x8'));var client=jayson['client'][_0x9a8f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5169f1,_0x5c9145,_0x1c16b6){return new BPromise(function(_0x657649,_0x548ca2){return client['request'](_0x5169f1,_0x1c16b6)[_0x9a8f('0xa')](function(_0x2f7c6a){logger['info'](_0x9a8f('0xb'),_0x5c9145,_0x9a8f('0xc'));logger[_0x9a8f('0xd')](_0x9a8f('0xe'),_0x5c9145,_0x9a8f('0xc'),JSON[_0x9a8f('0xf')](_0x2f7c6a));if(_0x2f7c6a[_0x9a8f('0x10')]){if(_0x2f7c6a[_0x9a8f('0x10')][_0x9a8f('0x11')]===0x1f4){logger['error'](_0x9a8f('0xb'),_0x5c9145,_0x2f7c6a[_0x9a8f('0x10')][_0x9a8f('0x12')]);return _0x548ca2(_0x2f7c6a[_0x9a8f('0x10')]['message']);}logger[_0x9a8f('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x5c9145,_0x2f7c6a[_0x9a8f('0x10')][_0x9a8f('0x12')]);return _0x657649(_0x2f7c6a[_0x9a8f('0x10')][_0x9a8f('0x12')]);}else{logger[_0x9a8f('0x13')](_0x9a8f('0xb'),_0x5c9145,'request\x20sent');_0x657649(_0x2f7c6a[_0x9a8f('0x14')][_0x9a8f('0x12')]);}})[_0x9a8f('0x15')](function(_0x5501dc){logger[_0x9a8f('0x10')](_0x9a8f('0xb'),_0x5c9145,_0x5501dc);_0x548ca2(_0x5501dc);});});} \ No newline at end of file +var _0xb49b=['then','info','debug','request\x20sent','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','ioredis','../../config/logger','rpc','jayson/promise','request'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xb49b,0x185));var _0xbb49=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb49b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbb49('0x0'));var util=require('util');var moment=require(_0xbb49('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb49('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbb49('0x3'))(_0xbb49('0x4'));var config=require('../../config/environment');var jayson=require(_0xbb49('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36b1b2,_0x4ba555,_0x52c135){return new BPromise(function(_0x18b01b,_0x4447b8){return client[_0xbb49('0x6')](_0x36b1b2,_0x52c135)[_0xbb49('0x7')](function(_0x2c23d8){logger[_0xbb49('0x8')]('MailTransferReport,\x20%s,\x20%s',_0x4ba555,'request\x20sent');logger[_0xbb49('0x9')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x4ba555,_0xbb49('0xa'),JSON[_0xbb49('0xb')](_0x2c23d8));if(_0x2c23d8[_0xbb49('0xc')]){if(_0x2c23d8['error'][_0xbb49('0xd')]===0x1f4){logger[_0xbb49('0xc')](_0xbb49('0xe'),_0x4ba555,_0x2c23d8[_0xbb49('0xc')][_0xbb49('0xf')]);return _0x4447b8(_0x2c23d8['error'][_0xbb49('0xf')]);}logger['error'](_0xbb49('0xe'),_0x4ba555,_0x2c23d8[_0xbb49('0xc')]['message']);return _0x18b01b(_0x2c23d8[_0xbb49('0xc')][_0xbb49('0xf')]);}else{logger[_0xbb49('0x8')]('MailTransferReport,\x20%s,\x20%s',_0x4ba555,_0xbb49('0xa'));_0x18b01b(_0x2c23d8[_0xbb49('0x10')][_0xbb49('0xf')]);}})[_0xbb49('0x11')](function(_0x53e3bf){logger[_0xbb49('0xc')](_0xbb49('0xe'),_0x4ba555,_0x53e3bf);_0x4447b8(_0x53e3bf);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 48f44bc..5ad0b05 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 _0x6625=['isAuthenticated','index','/describe','describe','/:id','create','put','update','delete','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6625,0x117));var _0x5662=function(_0x5b210f,_0x463a7f){_0x5b210f=_0x5b210f-0x0;var _0x41662b=_0x6625[_0x5b210f];return _0x41662b;};'use strict';var multer=require(_0x5662('0x0'));var util=require('util');var path=require(_0x5662('0x1'));var timeout=require(_0x5662('0x2'));var express=require(_0x5662('0x3'));var router=express['Router']();var auth=require(_0x5662('0x4'));var interaction=require(_0x5662('0x5'));var config=require(_0x5662('0x6'));var controller=require(_0x5662('0x7'));router[_0x5662('0x8')]('/',auth[_0x5662('0x9')](),controller[_0x5662('0xa')]);router[_0x5662('0x8')](_0x5662('0xb'),auth[_0x5662('0x9')](),controller[_0x5662('0xc')]);router[_0x5662('0x8')](_0x5662('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x5662('0x9')](),controller[_0x5662('0xe')]);router[_0x5662('0xf')](_0x5662('0xd'),auth[_0x5662('0x9')](),controller[_0x5662('0x10')]);router[_0x5662('0x11')]('/:id',auth[_0x5662('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x60ac=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy'];(function(_0x36568a,_0x1e55c2){var _0x10ca3f=function(_0x5423cb){while(--_0x5423cb){_0x36568a['push'](_0x36568a['shift']());}};_0x10ca3f(++_0x1e55c2);}(_0x60ac,0x139));var _0xc60a=function(_0x5806fe,_0x4bab4a){_0x5806fe=_0x5806fe-0x0;var _0x4cde4a=_0x60ac[_0x5806fe];return _0x4cde4a;};'use strict';var multer=require(_0xc60a('0x0'));var util=require(_0xc60a('0x1'));var path=require(_0xc60a('0x2'));var timeout=require(_0xc60a('0x3'));var express=require(_0xc60a('0x4'));var router=express[_0xc60a('0x5')]();var auth=require(_0xc60a('0x6'));var interaction=require(_0xc60a('0x7'));var config=require(_0xc60a('0x8'));var controller=require(_0xc60a('0x9'));router[_0xc60a('0xa')]('/',auth[_0xc60a('0xb')](),controller[_0xc60a('0xc')]);router[_0xc60a('0xa')](_0xc60a('0xd'),auth[_0xc60a('0xb')](),controller[_0xc60a('0xe')]);router['get']('/:id',auth[_0xc60a('0xb')](),controller[_0xc60a('0xf')]);router[_0xc60a('0x10')]('/',auth[_0xc60a('0xb')](),controller[_0xc60a('0x11')]);router[_0xc60a('0x12')](_0xc60a('0x13'),auth['isAuthenticated'](),controller[_0xc60a('0x14')]);router[_0xc60a('0x15')](_0xc60a('0x13'),auth['isAuthenticated'](),controller[_0xc60a('0x16')]);module[_0xc60a('0x17')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index a890a83..af29e58 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 _0x3794=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt'];(function(_0x5338fe,_0x5e71d1){var _0xf0a1be=function(_0x306a01){while(--_0x306a01){_0x5338fe['push'](_0x5338fe['shift']());}};_0xf0a1be(++_0x5e71d1);}(_0x3794,0x19a));var _0x4379=function(_0x43f489,_0x2b4fea){_0x43f489=_0x43f489-0x0;var _0x4134b4=_0x3794[_0x43f489];return _0x4134b4;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4379('0x0'));module[_0x4379('0x1')]={'channel':{'type':Sequelize[_0x4379('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x4379('0x2')]},'type':{'type':Sequelize[_0x4379('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x4379('0x3')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x4379('0x4')],'set':function(_0x30f8c6){var _0x41d1e8=moment(_0x30f8c6);var _0x3b918e=moment(this[_0x4379('0x5')](_0x4379('0x6')));var _0x2b0169=_0x41d1e8['diff'](_0x3b918e,_0x4379('0x7'));this[_0x4379('0x8')](_0x4379('0x9'),_0x30f8c6);this[_0x4379('0x8')]('duration',_0x2b0169||null);}},'data1':{'type':Sequelize[_0x4379('0x2')],'comment':_0x4379('0xa')},'data2':{'type':Sequelize[_0x4379('0x2')],'comment':_0x4379('0xb')},'data3':{'type':Sequelize['STRING'],'comment':_0x4379('0xc')},'data4':{'type':Sequelize['STRING'],'comment':_0x4379('0xd')},'data5':{'type':Sequelize[_0x4379('0x2')],'comment':_0x4379('0xe')},'role':{'type':Sequelize[_0x4379('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x4379('0x2')]}}; \ No newline at end of file +var _0x2045=['LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING'];(function(_0x5a29d0,_0x4ce81f){var _0x5064f6=function(_0x1d460f){while(--_0x1d460f){_0x5a29d0['push'](_0x5a29d0['shift']());}};_0x5064f6(++_0x4ce81f);}(_0x2045,0x152));var _0x5204=function(_0x13e758,_0x317d23){_0x13e758=_0x13e758-0x0;var _0x5b53c3=_0x2045[_0x13e758];return _0x5b53c3;};'use strict';var Sequelize=require(_0x5204('0x0'));var moment=require(_0x5204('0x1'));module[_0x5204('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x5204('0x3')]},'type':{'type':Sequelize[_0x5204('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x5204('0x4')},'duration':{'type':Sequelize[_0x5204('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5204('0x6')],'set':function(_0xf873ff){var _0x4a28ef=moment(_0xf873ff);var _0xba32e6=moment(this[_0x5204('0x7')](_0x5204('0x8')));var _0x451f2f=_0x4a28ef['diff'](_0xba32e6,_0x5204('0x9'));this['setDataValue'](_0x5204('0xa'),_0xf873ff);this[_0x5204('0xb')](_0x5204('0xc'),_0x451f2f||null);}},'data1':{'type':Sequelize[_0x5204('0x3')],'comment':_0x5204('0xd')},'data2':{'type':Sequelize[_0x5204('0x3')],'comment':_0x5204('0xe')},'data3':{'type':Sequelize['STRING'],'comment':_0x5204('0xf')},'data4':{'type':Sequelize[_0x5204('0x3')],'comment':_0x5204('0x10')},'data5':{'type':Sequelize['STRING'],'comment':_0x5204('0x11')},'role':{'type':Sequelize[_0x5204('0x3')]},'internal':{'type':Sequelize[_0x5204('0x5')]},'uniqueid':{'type':Sequelize[_0x5204('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index d72f40b..bc865d8 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 _0x35d6=['filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','MemberReport','includeAll','include','findAll','rows','show','params','rawAttributes','options','catch','create','body','update','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','then','stack','name','send','index','map','fieldName','model','query','keys'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x35d6,0x145));var _0x635d=function(_0x2abe4f,_0x5932ab){_0x2abe4f=_0x2abe4f-0x0;var _0x62dde3=_0x35d6[_0x2abe4f];return _0x62dde3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x635d('0x0'));var rimraf=require(_0x635d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x635d('0x2'));var rp=require(_0x635d('0x3'));var moment=require(_0x635d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x635d('0x5'));var util=require('util');var path=require(_0x635d('0x6'));var sox=require(_0x635d('0x7'));var csv=require(_0x635d('0x8'));var ejs=require(_0x635d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x635d('0xa'));var crypto=require(_0x635d('0xb'));var jsforce=require(_0x635d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x635d('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x635d('0xd'));var authService=require(_0x635d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x635d('0xf'));var hardwareService=require(_0x635d('0x10'));var logger=require(_0x635d('0x11'))(_0x635d('0x12'));var utils=require(_0x635d('0x13'));var config=require(_0x635d('0x14'));var licenseUtil=require(_0x635d('0x15'));var db=require(_0x635d('0x16'))['db'];function respondWithStatusCode(_0x778b1d,_0x462400){_0x462400=_0x462400||0xcc;return function(_0x4082d3){if(_0x4082d3){return _0x778b1d[_0x635d('0x17')](_0x462400);}return _0x778b1d['status'](_0x462400)[_0x635d('0x18')]();};}function respondWithResult(_0x54dff5,_0x344df7){_0x344df7=_0x344df7||0xc8;return function(_0x34921d){if(_0x34921d){return _0x54dff5[_0x635d('0x19')](_0x344df7)[_0x635d('0x1a')](_0x34921d);}};}function respondWithFilteredResult(_0x5a15b9,_0x3ff2b8){return function(_0x1f982f){if(_0x1f982f){var _0x42174a=_0x1f982f[_0x635d('0x1b')],_0x2350eb=_0x3ff2b8[_0x635d('0x1c')],_0x515f0b=_0x3ff2b8['offset']+_0x3ff2b8[_0x635d('0x1d')],_0x23a191;if(_0x515f0b>=_0x42174a){_0x515f0b=_0x42174a;_0x23a191=0xc8;}else{_0x23a191=0xce;}_0x5a15b9[_0x635d('0x19')](_0x23a191);return _0x5a15b9[_0x635d('0x1e')](_0x635d('0x1f'),_0x2350eb+'-'+_0x515f0b+'/'+_0x42174a)[_0x635d('0x1a')](_0x1f982f);}return null;};}function patchUpdates(_0x224989){return function(_0x27c046){try{jsonpatch['apply'](_0x27c046,_0x224989,!![]);}catch(_0x23ff86){return BPromise[_0x635d('0x20')](_0x23ff86);}return _0x27c046[_0x635d('0x21')]();};}function saveUpdates(_0x1432d3,_0x47a251){return function(_0x49d4c9){if(_0x49d4c9){return _0x49d4c9['update'](_0x1432d3)['then'](function(_0xb8e34f){return _0xb8e34f;});}return null;};}function removeEntity(_0x23c827,_0xa94dbc){return function(_0x17125a){if(_0x17125a){return _0x17125a[_0x635d('0x22')]()[_0x635d('0x23')](function(){_0x23c827[_0x635d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x304efc,_0x274c4e){return function(_0x258430){if(!_0x258430){_0x304efc[_0x635d('0x17')](0x194);}return _0x258430;};}function handleError(_0x26a77c,_0x56c226){_0x56c226=_0x56c226||0x1f4;return function(_0x12c03d){logger['error'](_0x12c03d[_0x635d('0x24')]);if(_0x12c03d[_0x635d('0x25')]){delete _0x12c03d[_0x635d('0x25')];}_0x26a77c['status'](_0x56c226)[_0x635d('0x26')](_0x12c03d);};}exports[_0x635d('0x27')]=function(_0x276fdf,_0x50d9bb){var _0x4f4886={},_0x4f4757={},_0x5407dc={'count':0x0,'rows':[]};var _0x5d40c3=_[_0x635d('0x28')](db['MemberReport']['rawAttributes'],function(_0xeb2b1b){return{'name':_0xeb2b1b[_0x635d('0x29')],'type':_0xeb2b1b['type']['key']};});_0x4f4757[_0x635d('0x2a')]=_[_0x635d('0x28')](_0x5d40c3,'name');_0x4f4757[_0x635d('0x2b')]=_[_0x635d('0x2c')](_0x276fdf[_0x635d('0x2b')]);_0x4f4757[_0x635d('0x2d')]=_[_0x635d('0x2e')](_0x4f4757[_0x635d('0x2a')],_0x4f4757[_0x635d('0x2b')]);_0x4f4886[_0x635d('0x2f')]=_['intersection'](_0x4f4757[_0x635d('0x2a')],qs[_0x635d('0x30')](_0x276fdf[_0x635d('0x2b')][_0x635d('0x30')]));_0x4f4886[_0x635d('0x2f')]=_0x4f4886[_0x635d('0x2f')][_0x635d('0x31')]?_0x4f4886[_0x635d('0x2f')]:_0x4f4757[_0x635d('0x2a')];if(!_0x276fdf[_0x635d('0x2b')]['hasOwnProperty'](_0x635d('0x32'))){_0x4f4886[_0x635d('0x1d')]=qs[_0x635d('0x1d')](_0x276fdf[_0x635d('0x2b')][_0x635d('0x1d')]);_0x4f4886[_0x635d('0x1c')]=qs[_0x635d('0x1c')](_0x276fdf['query']['offset']);}_0x4f4886[_0x635d('0x33')]=qs['sort'](_0x276fdf[_0x635d('0x2b')][_0x635d('0x34')]);_0x4f4886[_0x635d('0x35')]=qs[_0x635d('0x2d')](_[_0x635d('0x36')](_0x276fdf[_0x635d('0x2b')],_0x4f4757[_0x635d('0x2d')]),_0x5d40c3);if(_0x276fdf['query'][_0x635d('0x37')]){_0x4f4886[_0x635d('0x35')]=_[_0x635d('0x38')](_0x4f4886[_0x635d('0x35')],{'$or':_['map'](_0x5d40c3,function(_0x1a7a32){if(_0x1a7a32[_0x635d('0x39')]!==_0x635d('0x3a')){var _0xf7a026={};_0xf7a026[_0x1a7a32['name']]={'$like':'%'+_0x276fdf[_0x635d('0x2b')][_0x635d('0x37')]+'%'};return _0xf7a026;}})});}_0x4f4886=_[_0x635d('0x38')]({},_0x4f4886,_0x276fdf['options']);var _0x40695e={'where':_0x4f4886[_0x635d('0x35')]};return db[_0x635d('0x3b')][_0x635d('0x1b')](_0x40695e)['then'](function(_0xfc021d){_0x5407dc['count']=_0xfc021d;if(_0x276fdf[_0x635d('0x2b')][_0x635d('0x3c')]){_0x4f4886[_0x635d('0x3d')]=[{'all':!![]}];}return db[_0x635d('0x3b')][_0x635d('0x3e')](_0x4f4886);})['then'](function(_0x2a4528){_0x5407dc[_0x635d('0x3f')]=_0x2a4528;return _0x5407dc;})[_0x635d('0x23')](respondWithFilteredResult(_0x50d9bb,_0x4f4886))['catch'](handleError(_0x50d9bb,null));};exports[_0x635d('0x40')]=function(_0x8e527a,_0x1c8cb0){var _0x69bb08={'raw':!![],'where':{'id':_0x8e527a[_0x635d('0x41')]['id']}},_0x1e7a7c={};_0x1e7a7c[_0x635d('0x2a')]=_['keys'](db[_0x635d('0x3b')][_0x635d('0x42')]);_0x1e7a7c[_0x635d('0x2b')]=_[_0x635d('0x2c')](_0x8e527a[_0x635d('0x2b')]);_0x1e7a7c['filters']=_[_0x635d('0x2e')](_0x1e7a7c[_0x635d('0x2a')],_0x1e7a7c['query']);_0x69bb08[_0x635d('0x2f')]=_[_0x635d('0x2e')](_0x1e7a7c[_0x635d('0x2a')],qs[_0x635d('0x30')](_0x8e527a['query'][_0x635d('0x30')]));_0x69bb08['attributes']=_0x69bb08[_0x635d('0x2f')]['length']?_0x69bb08['attributes']:_0x1e7a7c[_0x635d('0x2a')];if(_0x8e527a[_0x635d('0x2b')][_0x635d('0x3c')]){_0x69bb08['include']=[{'all':!![]}];}_0x69bb08=_[_0x635d('0x38')]({},_0x69bb08,_0x8e527a[_0x635d('0x43')]);return db[_0x635d('0x3b')]['find'](_0x69bb08)[_0x635d('0x23')](handleEntityNotFound(_0x1c8cb0,null))[_0x635d('0x23')](respondWithResult(_0x1c8cb0,null))[_0x635d('0x44')](handleError(_0x1c8cb0,null));};exports['create']=function(_0xd96ef6,_0x1be8d5){return db[_0x635d('0x3b')][_0x635d('0x45')](_0xd96ef6[_0x635d('0x46')],{})[_0x635d('0x23')](respondWithResult(_0x1be8d5,0xc9))['catch'](handleError(_0x1be8d5,null));};exports[_0x635d('0x47')]=function(_0x3d7672,_0x596f19){if(_0x3d7672['body']['id']){delete _0x3d7672[_0x635d('0x46')]['id'];}return db[_0x635d('0x3b')]['find']({'where':{'id':_0x3d7672[_0x635d('0x41')]['id']}})[_0x635d('0x23')](handleEntityNotFound(_0x596f19,null))[_0x635d('0x23')](saveUpdates(_0x3d7672[_0x635d('0x46')],null))[_0x635d('0x23')](respondWithResult(_0x596f19,null))[_0x635d('0x44')](handleError(_0x596f19,null));};exports[_0x635d('0x22')]=function(_0x2407d6,_0x1868db){return db['MemberReport'][_0x635d('0x48')]({'where':{'id':_0x2407d6[_0x635d('0x41')]['id']}})['then'](handleEntityNotFound(_0x1868db,null))[_0x635d('0x23')](removeEntity(_0x1868db,null))[_0x635d('0x44')](handleError(_0x1868db,null));};exports[_0x635d('0x49')]=function(_0x2c0164,_0x344780){return db[_0x635d('0x3b')][_0x635d('0x49')]()['then'](respondWithResult(_0x344780,null))[_0x635d('0x44')](handleError(_0x344780,null));}; \ No newline at end of file +var _0x3f7e=['where','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','save','update','then','destroy','end','sendStatus','stack','name','send','map','MemberReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','pick','filters','filter','merge'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x3f7e,0x1c3));var _0xe3f7=function(_0x5eb781,_0x4f5293){_0x5eb781=_0x5eb781-0x0;var _0x11252b=_0x3f7e[_0x5eb781];return _0x11252b;};'use strict';var pdf=require(_0xe3f7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe3f7('0x1'));var zipdir=require(_0xe3f7('0x2'));var jsonpatch=require(_0xe3f7('0x3'));var rp=require(_0xe3f7('0x4'));var moment=require(_0xe3f7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe3f7('0x6'));var util=require('util');var path=require(_0xe3f7('0x7'));var sox=require(_0xe3f7('0x8'));var csv=require(_0xe3f7('0x9'));var ejs=require(_0xe3f7('0xa'));var fs=require('fs');var _=require(_0xe3f7('0xb'));var squel=require(_0xe3f7('0xc'));var crypto=require(_0xe3f7('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe3f7('0xe'));var Papa=require(_0xe3f7('0xf'));var Redis=require(_0xe3f7('0x10'));var authService=require(_0xe3f7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe3f7('0x12'));var hardwareService=require(_0xe3f7('0x13'));var logger=require(_0xe3f7('0x14'))(_0xe3f7('0x15'));var utils=require(_0xe3f7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe3f7('0x17'));var db=require(_0xe3f7('0x18'))['db'];function respondWithStatusCode(_0x22f3fb,_0x25f940){_0x25f940=_0x25f940||0xcc;return function(_0x1c08a9){if(_0x1c08a9){return _0x22f3fb['sendStatus'](_0x25f940);}return _0x22f3fb[_0xe3f7('0x19')](_0x25f940)['end']();};}function respondWithResult(_0x2548a1,_0x3da0d9){_0x3da0d9=_0x3da0d9||0xc8;return function(_0xcbc22){if(_0xcbc22){return _0x2548a1[_0xe3f7('0x19')](_0x3da0d9)[_0xe3f7('0x1a')](_0xcbc22);}};}function respondWithFilteredResult(_0x207ab4,_0x12fbb2){return function(_0x462ff6){if(_0x462ff6){var _0x53e1c5=_0x462ff6[_0xe3f7('0x1b')],_0xef1a84=_0x12fbb2[_0xe3f7('0x1c')],_0xbb7069=_0x12fbb2['offset']+_0x12fbb2[_0xe3f7('0x1d')],_0x3dd2c2;if(_0xbb7069>=_0x53e1c5){_0xbb7069=_0x53e1c5;_0x3dd2c2=0xc8;}else{_0x3dd2c2=0xce;}_0x207ab4[_0xe3f7('0x19')](_0x3dd2c2);return _0x207ab4[_0xe3f7('0x1e')](_0xe3f7('0x1f'),_0xef1a84+'-'+_0xbb7069+'/'+_0x53e1c5)[_0xe3f7('0x1a')](_0x462ff6);}return null;};}function patchUpdates(_0x122218){return function(_0x4a4935){try{jsonpatch['apply'](_0x4a4935,_0x122218,!![]);}catch(_0x481ed8){return BPromise['reject'](_0x481ed8);}return _0x4a4935[_0xe3f7('0x20')]();};}function saveUpdates(_0x288264,_0x576c04){return function(_0xd31a7d){if(_0xd31a7d){return _0xd31a7d[_0xe3f7('0x21')](_0x288264)[_0xe3f7('0x22')](function(_0x147620){return _0x147620;});}return null;};}function removeEntity(_0x1c4507,_0x4d7abe){return function(_0x3d1b33){if(_0x3d1b33){return _0x3d1b33[_0xe3f7('0x23')]()['then'](function(){_0x1c4507[_0xe3f7('0x19')](0xcc)[_0xe3f7('0x24')]();});}};}function handleEntityNotFound(_0x48e2e3,_0x53e596){return function(_0x526fab){if(!_0x526fab){_0x48e2e3[_0xe3f7('0x25')](0x194);}return _0x526fab;};}function handleError(_0x3fe40a,_0xe0c3b5){_0xe0c3b5=_0xe0c3b5||0x1f4;return function(_0x313e77){logger['error'](_0x313e77[_0xe3f7('0x26')]);if(_0x313e77[_0xe3f7('0x27')]){delete _0x313e77[_0xe3f7('0x27')];}_0x3fe40a[_0xe3f7('0x19')](_0xe0c3b5)[_0xe3f7('0x28')](_0x313e77);};}exports['index']=function(_0x303b61,_0x773b85){var _0x5c98d3={},_0x5a1f81={},_0x7f29bc={'count':0x0,'rows':[]};var _0x339ac2=_[_0xe3f7('0x29')](db[_0xe3f7('0x2a')][_0xe3f7('0x2b')],function(_0x47b3e5){return{'name':_0x47b3e5[_0xe3f7('0x2c')],'type':_0x47b3e5['type'][_0xe3f7('0x2d')]};});_0x5a1f81[_0xe3f7('0x2e')]=_[_0xe3f7('0x29')](_0x339ac2,_0xe3f7('0x27'));_0x5a1f81[_0xe3f7('0x2f')]=_[_0xe3f7('0x30')](_0x303b61[_0xe3f7('0x2f')]);_0x5a1f81['filters']=_[_0xe3f7('0x31')](_0x5a1f81[_0xe3f7('0x2e')],_0x5a1f81[_0xe3f7('0x2f')]);_0x5c98d3[_0xe3f7('0x32')]=_[_0xe3f7('0x31')](_0x5a1f81[_0xe3f7('0x2e')],qs[_0xe3f7('0x33')](_0x303b61['query'][_0xe3f7('0x33')]));_0x5c98d3[_0xe3f7('0x32')]=_0x5c98d3[_0xe3f7('0x32')][_0xe3f7('0x34')]?_0x5c98d3[_0xe3f7('0x32')]:_0x5a1f81[_0xe3f7('0x2e')];if(!_0x303b61[_0xe3f7('0x2f')]['hasOwnProperty'](_0xe3f7('0x35'))){_0x5c98d3[_0xe3f7('0x1d')]=qs[_0xe3f7('0x1d')](_0x303b61[_0xe3f7('0x2f')][_0xe3f7('0x1d')]);_0x5c98d3[_0xe3f7('0x1c')]=qs[_0xe3f7('0x1c')](_0x303b61[_0xe3f7('0x2f')]['offset']);}_0x5c98d3[_0xe3f7('0x36')]=qs[_0xe3f7('0x37')](_0x303b61[_0xe3f7('0x2f')][_0xe3f7('0x37')]);_0x5c98d3['where']=qs['filters'](_[_0xe3f7('0x38')](_0x303b61[_0xe3f7('0x2f')],_0x5a1f81[_0xe3f7('0x39')]),_0x339ac2);if(_0x303b61[_0xe3f7('0x2f')][_0xe3f7('0x3a')]){_0x5c98d3['where']=_[_0xe3f7('0x3b')](_0x5c98d3[_0xe3f7('0x3c')],{'$or':_[_0xe3f7('0x29')](_0x339ac2,function(_0x2d318a){if(_0x2d318a['type']!==_0xe3f7('0x3d')){var _0x55010b={};_0x55010b[_0x2d318a[_0xe3f7('0x27')]]={'$like':'%'+_0x303b61[_0xe3f7('0x2f')][_0xe3f7('0x3a')]+'%'};return _0x55010b;}})});}_0x5c98d3=_['merge']({},_0x5c98d3,_0x303b61[_0xe3f7('0x3e')]);var _0x3806e6={'where':_0x5c98d3[_0xe3f7('0x3c')]};return db[_0xe3f7('0x2a')]['count'](_0x3806e6)[_0xe3f7('0x22')](function(_0x641c8b){_0x7f29bc[_0xe3f7('0x1b')]=_0x641c8b;if(_0x303b61['query'][_0xe3f7('0x3f')]){_0x5c98d3[_0xe3f7('0x40')]=[{'all':!![]}];}return db['MemberReport'][_0xe3f7('0x41')](_0x5c98d3);})[_0xe3f7('0x22')](function(_0x230850){_0x7f29bc['rows']=_0x230850;return _0x7f29bc;})[_0xe3f7('0x22')](respondWithFilteredResult(_0x773b85,_0x5c98d3))[_0xe3f7('0x42')](handleError(_0x773b85,null));};exports[_0xe3f7('0x43')]=function(_0x4d69ce,_0x33dd45){var _0x26cc9f={'raw':!![],'where':{'id':_0x4d69ce['params']['id']}},_0x27eef1={};_0x27eef1[_0xe3f7('0x2e')]=_['keys'](db[_0xe3f7('0x2a')][_0xe3f7('0x2b')]);_0x27eef1[_0xe3f7('0x2f')]=_['keys'](_0x4d69ce[_0xe3f7('0x2f')]);_0x27eef1[_0xe3f7('0x39')]=_['intersection'](_0x27eef1[_0xe3f7('0x2e')],_0x27eef1[_0xe3f7('0x2f')]);_0x26cc9f[_0xe3f7('0x32')]=_[_0xe3f7('0x31')](_0x27eef1['model'],qs[_0xe3f7('0x33')](_0x4d69ce[_0xe3f7('0x2f')][_0xe3f7('0x33')]));_0x26cc9f[_0xe3f7('0x32')]=_0x26cc9f[_0xe3f7('0x32')][_0xe3f7('0x34')]?_0x26cc9f['attributes']:_0x27eef1[_0xe3f7('0x2e')];if(_0x4d69ce[_0xe3f7('0x2f')][_0xe3f7('0x3f')]){_0x26cc9f['include']=[{'all':!![]}];}_0x26cc9f=_[_0xe3f7('0x3b')]({},_0x26cc9f,_0x4d69ce[_0xe3f7('0x3e')]);return db[_0xe3f7('0x2a')][_0xe3f7('0x44')](_0x26cc9f)['then'](handleEntityNotFound(_0x33dd45,null))[_0xe3f7('0x22')](respondWithResult(_0x33dd45,null))['catch'](handleError(_0x33dd45,null));};exports[_0xe3f7('0x45')]=function(_0xf00904,_0x2eb248){return db[_0xe3f7('0x2a')][_0xe3f7('0x45')](_0xf00904['body'],{})[_0xe3f7('0x22')](respondWithResult(_0x2eb248,0xc9))[_0xe3f7('0x42')](handleError(_0x2eb248,null));};exports['update']=function(_0x1427e4,_0x20c30f){if(_0x1427e4[_0xe3f7('0x46')]['id']){delete _0x1427e4[_0xe3f7('0x46')]['id'];}return db[_0xe3f7('0x2a')][_0xe3f7('0x44')]({'where':{'id':_0x1427e4[_0xe3f7('0x47')]['id']}})[_0xe3f7('0x22')](handleEntityNotFound(_0x20c30f,null))[_0xe3f7('0x22')](saveUpdates(_0x1427e4[_0xe3f7('0x46')],null))[_0xe3f7('0x22')](respondWithResult(_0x20c30f,null))[_0xe3f7('0x42')](handleError(_0x20c30f,null));};exports[_0xe3f7('0x23')]=function(_0x3d52e1,_0x881f79){return db[_0xe3f7('0x2a')][_0xe3f7('0x44')]({'where':{'id':_0x3d52e1['params']['id']}})[_0xe3f7('0x22')](handleEntityNotFound(_0x881f79,null))[_0xe3f7('0x22')](removeEntity(_0x881f79,null))[_0xe3f7('0x42')](handleError(_0x881f79,null));};exports['describe']=function(_0x140efa,_0x20bade){return db[_0xe3f7('0x2a')][_0xe3f7('0x48')]()[_0xe3f7('0x22')](respondWithResult(_0x20bade,null))[_0xe3f7('0x42')](handleError(_0x20bade,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 6802c30..5b142ac 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 _0x5448=['../../config/environment','./memberReport.attributes','exports','report_member','membername_interface','interface','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x5ab552,_0x49220d){var _0x2bf1bb=function(_0x73ae9c){while(--_0x73ae9c){_0x5ab552['push'](_0x5ab552['shift']());}};_0x2bf1bb(++_0x49220d);}(_0x5448,0x17f));var _0x8544=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5448[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x8544('0x0'));var util=require(_0x8544('0x1'));var logger=require(_0x8544('0x2'))('api');var moment=require(_0x8544('0x3'));var BPromise=require(_0x8544('0x4'));var rp=require(_0x8544('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8544('0x6'));var config=require(_0x8544('0x7'));var attributes=require(_0x8544('0x8'));module[_0x8544('0x9')]=function(_0x2a4c6a,_0x709018){return _0x2a4c6a['define']('MemberReport',attributes,{'tableName':_0x8544('0xa'),'paranoid':![],'indexes':[{'name':_0x8544('0xb'),'fields':['membername',_0x8544('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8777=['MemberReport','report_member','membername_interface','membername','interface','lodash','util','api','request-promise','path','rimraf','./memberReport.attributes','exports','define'];(function(_0xeb0b02,_0x5ed383){var _0x6ecfeb=function(_0x454f01){while(--_0x454f01){_0xeb0b02['push'](_0xeb0b02['shift']());}};_0x6ecfeb(++_0x5ed383);}(_0x8777,0x11d));var _0x7877=function(_0x538c64,_0x170f72){_0x538c64=_0x538c64-0x0;var _0x52631a=_0x8777[_0x538c64];return _0x52631a;};'use strict';var _=require(_0x7877('0x0'));var util=require(_0x7877('0x1'));var logger=require('../../config/logger')(_0x7877('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7877('0x3'));var fs=require('fs');var path=require(_0x7877('0x4'));var rimraf=require(_0x7877('0x5'));var config=require('../../config/environment');var attributes=require(_0x7877('0x6'));module[_0x7877('0x7')]=function(_0x4781a5,_0x95efb7){return _0x4781a5[_0x7877('0x8')](_0x7877('0x9'),attributes,{'tableName':_0x7877('0xa'),'paranoid':![],'indexes':[{'name':_0x7877('0xb'),'fields':[_0x7877('0xc'),_0x7877('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index dc01c72..8041032 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 _0xee1b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMemberReport','MemberReport','options','raw','limit','map','include','model','attributes','then','CreateMemberReport','create','body','UpdateMemberReport','update','where','util','moment','bluebird','randomstring'];(function(_0x485123,_0x3e8593){var _0x15b93f=function(_0x10a013){while(--_0x10a013){_0x485123['push'](_0x485123['shift']());}};_0x15b93f(++_0x3e8593);}(_0xee1b,0x74));var _0xbee1=function(_0x2e9354,_0x102b82){_0x2e9354=_0x2e9354-0x0;var _0x4428b9=_0xee1b[_0x2e9354];return _0x4428b9;};'use strict';var _=require('lodash');var util=require(_0xbee1('0x0'));var moment=require(_0xbee1('0x1'));var BPromise=require(_0xbee1('0x2'));var rs=require(_0xbee1('0x3'));var fs=require('fs');var Redis=require(_0xbee1('0x4'));var db=require(_0xbee1('0x5'))['db'];var utils=require(_0xbee1('0x6'));var logger=require(_0xbee1('0x7'))(_0xbee1('0x8'));var config=require(_0xbee1('0x9'));var jayson=require(_0xbee1('0xa'));var client=jayson[_0xbee1('0xb')][_0xbee1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23fb86,_0x253e45,_0x11b78f){return new BPromise(function(_0xa4a998,_0x28bb58){return client[_0xbee1('0xd')](_0x23fb86,_0x11b78f)['then'](function(_0x5eaa1d){logger[_0xbee1('0xe')](_0xbee1('0xf'),_0x253e45,_0xbee1('0x10'));logger[_0xbee1('0x11')](_0xbee1('0x12'),_0x253e45,_0xbee1('0x10'),JSON[_0xbee1('0x13')](_0x5eaa1d));if(_0x5eaa1d[_0xbee1('0x14')]){if(_0x5eaa1d['error']['code']===0x1f4){logger['error'](_0xbee1('0xf'),_0x253e45,_0x5eaa1d[_0xbee1('0x14')][_0xbee1('0x15')]);return _0x28bb58(_0x5eaa1d['error'][_0xbee1('0x15')]);}logger[_0xbee1('0x14')](_0xbee1('0xf'),_0x253e45,_0x5eaa1d[_0xbee1('0x14')][_0xbee1('0x15')]);return _0xa4a998(_0x5eaa1d['error'][_0xbee1('0x15')]);}else{logger[_0xbee1('0xe')]('MemberReport,\x20%s,\x20%s',_0x253e45,_0xbee1('0x10'));_0xa4a998(_0x5eaa1d[_0xbee1('0x16')][_0xbee1('0x15')]);}})[_0xbee1('0x17')](function(_0x19a859){logger[_0xbee1('0x14')](_0xbee1('0xf'),_0x253e45,_0x19a859);_0x28bb58(_0x19a859);});});}exports[_0xbee1('0x18')]=function(_0x5673b2){var _0x3294a4=this;return new Promise(function(_0x499ede,_0x3ba687){return db[_0xbee1('0x19')]['findAll']({'raw':_0x5673b2[_0xbee1('0x1a')]?_0x5673b2['options'][_0xbee1('0x1b')]===undefined?!![]:![]:!![],'where':_0x5673b2['options']?_0x5673b2[_0xbee1('0x1a')]['where']||null:null,'attributes':_0x5673b2[_0xbee1('0x1a')]?_0x5673b2[_0xbee1('0x1a')]['attributes']||null:null,'limit':_0x5673b2[_0xbee1('0x1a')]?_0x5673b2['options'][_0xbee1('0x1c')]||null:null,'include':_0x5673b2['options']?_0x5673b2[_0xbee1('0x1a')]['include']?_[_0xbee1('0x1d')](_0x5673b2[_0xbee1('0x1a')][_0xbee1('0x1e')],function(_0x1dcf98){return{'model':db[_0x1dcf98[_0xbee1('0x1f')]],'as':_0x1dcf98['as'],'attributes':_0x1dcf98['attributes'],'include':_0x1dcf98[_0xbee1('0x1e')]?_['map'](_0x1dcf98[_0xbee1('0x1e')],function(_0x2d4042){return{'model':db[_0x2d4042['model']],'as':_0x2d4042['as'],'attributes':_0x2d4042[_0xbee1('0x20')],'include':_0x2d4042[_0xbee1('0x1e')]?_[_0xbee1('0x1d')](_0x2d4042[_0xbee1('0x1e')],function(_0x486bbf){return{'model':db[_0x486bbf[_0xbee1('0x1f')]],'as':_0x486bbf['as'],'attributes':_0x486bbf[_0xbee1('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbee1('0x21')](function(_0x55faf4){logger[_0xbee1('0xe')](_0xbee1('0x18'),_0x5673b2);logger['debug'](_0xbee1('0x18'),_0x5673b2,JSON['stringify'](_0x55faf4));_0x499ede(_0x55faf4);})[_0xbee1('0x17')](function(_0x33c09e){logger['error'](_0xbee1('0x18'),_0x33c09e[_0xbee1('0x15')],_0x5673b2);_0x3ba687(_0x3294a4[_0xbee1('0x14')](0x1f4,_0x33c09e[_0xbee1('0x15')]));});});};exports[_0xbee1('0x22')]=function(_0x3c28ef){var _0x1c5da4=this;return new Promise(function(_0x2c171b,_0x15f3cf){return db['MemberReport'][_0xbee1('0x23')](_0x3c28ef[_0xbee1('0x24')],{'raw':_0x3c28ef[_0xbee1('0x1a')]?_0x3c28ef[_0xbee1('0x1a')][_0xbee1('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2f45a9){logger[_0xbee1('0xe')](_0xbee1('0x22'),_0x3c28ef);logger['debug']('CreateMemberReport',_0x3c28ef,JSON[_0xbee1('0x13')](_0x2f45a9));_0x2c171b(_0x2f45a9);})['catch'](function(_0xc2b34b){logger[_0xbee1('0x14')](_0xbee1('0x22'),_0xc2b34b[_0xbee1('0x15')],_0x3c28ef);_0x15f3cf(_0x1c5da4['error'](0x1f4,_0xc2b34b[_0xbee1('0x15')]));});});};exports[_0xbee1('0x25')]=function(_0x3f4609){var _0x196063=this;return new Promise(function(_0x57a6bd,_0x13a9ed){return db[_0xbee1('0x19')][_0xbee1('0x26')](_0x3f4609['body'],{'raw':_0x3f4609[_0xbee1('0x1a')]?_0x3f4609[_0xbee1('0x1a')][_0xbee1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f4609[_0xbee1('0x1a')]?_0x3f4609[_0xbee1('0x1a')][_0xbee1('0x27')]||null:null,'attributes':_0x3f4609[_0xbee1('0x1a')]?_0x3f4609['options'][_0xbee1('0x20')]||null:null,'limit':_0x3f4609[_0xbee1('0x1a')]?_0x3f4609[_0xbee1('0x1a')][_0xbee1('0x1c')]||null:null})[_0xbee1('0x21')](function(_0x33ff21){logger[_0xbee1('0xe')]('UpdateMemberReport',_0x3f4609);logger[_0xbee1('0x11')](_0xbee1('0x25'),_0x3f4609,JSON[_0xbee1('0x13')](_0x33ff21));_0x57a6bd(_0x33ff21);})['catch'](function(_0x3cdce0){logger['error'](_0xbee1('0x25'),_0x3cdce0[_0xbee1('0x15')],_0x3f4609);_0x13a9ed(_0x196063[_0xbee1('0x14')](0x1f4,_0x3cdce0[_0xbee1('0x15')]));});});}; \ No newline at end of file +var _0x0b82=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetMemberReport','findAll','options','attributes','limit','include','map','model','then','CreateMemberReport','MemberReport','create','body','raw','UpdateMemberReport','update','where','lodash','util'];(function(_0x4931ac,_0xd4a55a){var _0x291e6c=function(_0xd61d2c){while(--_0xd61d2c){_0x4931ac['push'](_0x4931ac['shift']());}};_0x291e6c(++_0xd4a55a);}(_0x0b82,0xe8));var _0x20b8=function(_0x5ba275,_0x453b32){_0x5ba275=_0x5ba275-0x0;var _0x1695a8=_0x0b82[_0x5ba275];return _0x1695a8;};'use strict';var _=require(_0x20b8('0x0'));var util=require(_0x20b8('0x1'));var moment=require(_0x20b8('0x2'));var BPromise=require(_0x20b8('0x3'));var rs=require(_0x20b8('0x4'));var fs=require('fs');var Redis=require(_0x20b8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x20b8('0x6'));var logger=require(_0x20b8('0x7'))(_0x20b8('0x8'));var config=require(_0x20b8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x20b8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30df5e,_0x1aa11f,_0x1dd85e){return new BPromise(function(_0x471f25,_0x45c420){return client[_0x20b8('0xb')](_0x30df5e,_0x1dd85e)['then'](function(_0x532275){logger[_0x20b8('0xc')](_0x20b8('0xd'),_0x1aa11f,'request\x20sent');logger[_0x20b8('0xe')](_0x20b8('0xf'),_0x1aa11f,_0x20b8('0x10'),JSON[_0x20b8('0x11')](_0x532275));if(_0x532275['error']){if(_0x532275[_0x20b8('0x12')][_0x20b8('0x13')]===0x1f4){logger[_0x20b8('0x12')](_0x20b8('0xd'),_0x1aa11f,_0x532275[_0x20b8('0x12')][_0x20b8('0x14')]);return _0x45c420(_0x532275[_0x20b8('0x12')][_0x20b8('0x14')]);}logger[_0x20b8('0x12')](_0x20b8('0xd'),_0x1aa11f,_0x532275['error'][_0x20b8('0x14')]);return _0x471f25(_0x532275['error'][_0x20b8('0x14')]);}else{logger[_0x20b8('0xc')](_0x20b8('0xd'),_0x1aa11f,_0x20b8('0x10'));_0x471f25(_0x532275['result'][_0x20b8('0x14')]);}})[_0x20b8('0x15')](function(_0x38bb28){logger[_0x20b8('0x12')](_0x20b8('0xd'),_0x1aa11f,_0x38bb28);_0x45c420(_0x38bb28);});});}exports[_0x20b8('0x16')]=function(_0x1915f9){var _0x3fc8e3=this;return new Promise(function(_0xc244d1,_0x2d7f84){return db['MemberReport'][_0x20b8('0x17')]({'raw':_0x1915f9[_0x20b8('0x18')]?_0x1915f9[_0x20b8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1915f9[_0x20b8('0x18')]?_0x1915f9['options']['where']||null:null,'attributes':_0x1915f9[_0x20b8('0x18')]?_0x1915f9[_0x20b8('0x18')][_0x20b8('0x19')]||null:null,'limit':_0x1915f9[_0x20b8('0x18')]?_0x1915f9[_0x20b8('0x18')][_0x20b8('0x1a')]||null:null,'include':_0x1915f9[_0x20b8('0x18')]?_0x1915f9['options'][_0x20b8('0x1b')]?_[_0x20b8('0x1c')](_0x1915f9[_0x20b8('0x18')][_0x20b8('0x1b')],function(_0x5c9c06){return{'model':db[_0x5c9c06[_0x20b8('0x1d')]],'as':_0x5c9c06['as'],'attributes':_0x5c9c06[_0x20b8('0x19')],'include':_0x5c9c06[_0x20b8('0x1b')]?_[_0x20b8('0x1c')](_0x5c9c06[_0x20b8('0x1b')],function(_0x3e3ee1){return{'model':db[_0x3e3ee1[_0x20b8('0x1d')]],'as':_0x3e3ee1['as'],'attributes':_0x3e3ee1['attributes'],'include':_0x3e3ee1[_0x20b8('0x1b')]?_[_0x20b8('0x1c')](_0x3e3ee1[_0x20b8('0x1b')],function(_0x3ecdb7){return{'model':db[_0x3ecdb7[_0x20b8('0x1d')]],'as':_0x3ecdb7['as'],'attributes':_0x3ecdb7[_0x20b8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x20b8('0x1e')](function(_0x2e95a7){logger[_0x20b8('0xc')]('GetMemberReport',_0x1915f9);logger[_0x20b8('0xe')](_0x20b8('0x16'),_0x1915f9,JSON[_0x20b8('0x11')](_0x2e95a7));_0xc244d1(_0x2e95a7);})[_0x20b8('0x15')](function(_0x4aafb9){logger[_0x20b8('0x12')](_0x20b8('0x16'),_0x4aafb9[_0x20b8('0x14')],_0x1915f9);_0x2d7f84(_0x3fc8e3[_0x20b8('0x12')](0x1f4,_0x4aafb9[_0x20b8('0x14')]));});});};exports[_0x20b8('0x1f')]=function(_0x1d4158){var _0x1de3de=this;return new Promise(function(_0x4236b6,_0xd0ec1){return db[_0x20b8('0x20')][_0x20b8('0x21')](_0x1d4158[_0x20b8('0x22')],{'raw':_0x1d4158[_0x20b8('0x18')]?_0x1d4158[_0x20b8('0x18')][_0x20b8('0x23')]===undefined?!![]:![]:!![]})[_0x20b8('0x1e')](function(_0x5dcdb7){logger[_0x20b8('0xc')]('CreateMemberReport',_0x1d4158);logger[_0x20b8('0xe')]('CreateMemberReport',_0x1d4158,JSON['stringify'](_0x5dcdb7));_0x4236b6(_0x5dcdb7);})[_0x20b8('0x15')](function(_0x182b19){logger['error'](_0x20b8('0x1f'),_0x182b19[_0x20b8('0x14')],_0x1d4158);_0xd0ec1(_0x1de3de[_0x20b8('0x12')](0x1f4,_0x182b19['message']));});});};exports[_0x20b8('0x24')]=function(_0x17b0a3){var _0x28ce3c=this;return new Promise(function(_0x241fb2,_0xac1792){return db[_0x20b8('0x20')][_0x20b8('0x25')](_0x17b0a3[_0x20b8('0x22')],{'raw':_0x17b0a3[_0x20b8('0x18')]?_0x17b0a3[_0x20b8('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17b0a3[_0x20b8('0x18')]?_0x17b0a3[_0x20b8('0x18')][_0x20b8('0x26')]||null:null,'attributes':_0x17b0a3[_0x20b8('0x18')]?_0x17b0a3[_0x20b8('0x18')][_0x20b8('0x19')]||null:null,'limit':_0x17b0a3[_0x20b8('0x18')]?_0x17b0a3[_0x20b8('0x18')]['limit']||null:null})['then'](function(_0x115b26){logger['info'](_0x20b8('0x24'),_0x17b0a3);logger[_0x20b8('0xe')](_0x20b8('0x24'),_0x17b0a3,JSON['stringify'](_0x115b26));_0x241fb2(_0x115b26);})[_0x20b8('0x15')](function(_0x2eecb6){logger[_0x20b8('0x12')](_0x20b8('0x24'),_0x2eecb6[_0x20b8('0x14')],_0x17b0a3);_0xac1792(_0x28ce3c['error'](0x1f4,_0x2eecb6[_0x20b8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 604be2b..0fccea0 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 _0x1be1=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','exports','path','connect-timeout','Router'];(function(_0x3501f4,_0xfbae4c){var _0xcc0f26=function(_0x103acd){while(--_0x103acd){_0x3501f4['push'](_0x3501f4['shift']());}};_0xcc0f26(++_0xfbae4c);}(_0x1be1,0x192));var _0x11be=function(_0x23189e,_0x4fabb2){_0x23189e=_0x23189e-0x0;var _0x143c54=_0x1be1[_0x23189e];return _0x143c54;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var auth=require(_0x11be('0x3'));var interaction=require(_0x11be('0x4'));var config=require(_0x11be('0x5'));var controller=require('./migration.controller');router[_0x11be('0x6')]('/',controller[_0x11be('0x7')]);module[_0x11be('0x8')]=router; \ No newline at end of file +var _0x69d3=['index','exports','multer','util','path','express','Router','../../config/environment'];(function(_0x507c81,_0x3e1b56){var _0x368a25=function(_0x1e7519){while(--_0x1e7519){_0x507c81['push'](_0x507c81['shift']());}};_0x368a25(++_0x3e1b56);}(_0x69d3,0xda));var _0x369d=function(_0x4533f7,_0x1082b9){_0x4533f7=_0x4533f7-0x0;var _0xf6196b=_0x69d3[_0x4533f7];return _0xf6196b;};'use strict';var multer=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var path=require(_0x369d('0x2'));var timeout=require('connect-timeout');var express=require(_0x369d('0x3'));var router=express[_0x369d('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x369d('0x5'));var controller=require('./migration.controller');router['get']('/',controller[_0x369d('0x6')]);module[_0x369d('0x7')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 204f176..f1b8c3b 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 _0x906c=['exports','STRING'];(function(_0x18d329,_0x418166){var _0x1d215a=function(_0x2a5ce2){while(--_0x2a5ce2){_0x18d329['push'](_0x18d329['shift']());}};_0x1d215a(++_0x418166);}(_0x906c,0x136));var _0xc906=function(_0x460d58,_0x21fb34){_0x460d58=_0x460d58-0x0;var _0x5073a6=_0x906c[_0x460d58];return _0x5073a6;};'use strict';var Sequelize=require('sequelize');module[_0xc906('0x0')]={'version':{'type':Sequelize[_0xc906('0x1')],'unique':'version'}}; \ No newline at end of file +var _0x976c=['STRING','version','sequelize','exports'];(function(_0x998284,_0x2fb129){var _0x210fa3=function(_0x3d3526){while(--_0x3d3526){_0x998284['push'](_0x998284['shift']());}};_0x210fa3(++_0x2fb129);}(_0x976c,0xee));var _0xc976=function(_0x4f3567,_0x3aa2fd){_0x4f3567=_0x4f3567-0x0;var _0x19f8ff=_0x976c[_0x4f3567];return _0x19f8ff;};'use strict';var Sequelize=require(_0xc976('0x0'));module[_0xc976('0x1')]={'version':{'type':Sequelize[_0xc976('0x2')],'unique':_0xc976('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index fe0d1ac..0ef34e1 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 _0xc788=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','Migration','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis'];(function(_0x4fa438,_0x1f15a7){var _0x4e3958=function(_0x28f510){while(--_0x28f510){_0x4fa438['push'](_0x4fa438['shift']());}};_0x4e3958(++_0x1f15a7);}(_0xc788,0x13a));var _0x8c78=function(_0x3f4568,_0x9eb0ee){_0x3f4568=_0x3f4568-0x0;var _0xee2340=_0xc788[_0x3f4568];return _0xee2340;};'use strict';var pdf=require(_0x8c78('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8c78('0x1'));var zipdir=require(_0x8c78('0x2'));var jsonpatch=require(_0x8c78('0x3'));var rp=require(_0x8c78('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8c78('0x5'));var path=require(_0x8c78('0x6'));var sox=require(_0x8c78('0x7'));var csv=require(_0x8c78('0x8'));var ejs=require(_0x8c78('0x9'));var fs=require('fs');var _=require(_0x8c78('0xa'));var squel=require(_0x8c78('0xb'));var crypto=require(_0x8c78('0xc'));var jsforce=require(_0x8c78('0xd'));var deskjs=require(_0x8c78('0xe'));var toCsv=require(_0x8c78('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8c78('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c78('0x10'));var logger=require(_0x8c78('0x11'))('api');var utils=require(_0x8c78('0x12'));var config=require(_0x8c78('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c78('0x14'))['db'];function respondWithStatusCode(_0x457b41,_0x56ab68){_0x56ab68=_0x56ab68||0xcc;return function(_0x29638e){if(_0x29638e){return _0x457b41[_0x8c78('0x15')](_0x56ab68);}return _0x457b41[_0x8c78('0x16')](_0x56ab68)[_0x8c78('0x17')]();};}function respondWithResult(_0x16ae60,_0x7dc4ae){_0x7dc4ae=_0x7dc4ae||0xc8;return function(_0x33f01c){if(_0x33f01c){return _0x16ae60[_0x8c78('0x16')](_0x7dc4ae)['json'](_0x33f01c);}};}function respondWithFilteredResult(_0x4888d4,_0x4d8b6c){return function(_0x24ef5c){if(_0x24ef5c){var _0x399fe7=_0x24ef5c[_0x8c78('0x18')],_0x5b7a25=_0x4d8b6c['offset'],_0x267f90=_0x4d8b6c[_0x8c78('0x19')]+_0x4d8b6c[_0x8c78('0x1a')],_0x46d054;if(_0x267f90>=_0x399fe7){_0x267f90=_0x399fe7;_0x46d054=0xc8;}else{_0x46d054=0xce;}_0x4888d4[_0x8c78('0x16')](_0x46d054);return _0x4888d4[_0x8c78('0x1b')]('Content-Range',_0x5b7a25+'-'+_0x267f90+'/'+_0x399fe7)[_0x8c78('0x1c')](_0x24ef5c);}return null;};}function patchUpdates(_0xe3753){return function(_0x3125db){try{jsonpatch[_0x8c78('0x1d')](_0x3125db,_0xe3753,!![]);}catch(_0x5667d0){return BPromise[_0x8c78('0x1e')](_0x5667d0);}return _0x3125db[_0x8c78('0x1f')]();};}function saveUpdates(_0x1c2303,_0x22ac61){return function(_0x197f8e){if(_0x197f8e){return _0x197f8e[_0x8c78('0x20')](_0x1c2303)[_0x8c78('0x21')](function(_0x57c5ef){return _0x57c5ef;});}return null;};}function removeEntity(_0x2f3e17,_0x3cdd6d){return function(_0x2ad859){if(_0x2ad859){return _0x2ad859[_0x8c78('0x22')]()[_0x8c78('0x21')](function(){_0x2f3e17[_0x8c78('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47fea0,_0x48ba93){return function(_0x5ef9bc){if(!_0x5ef9bc){_0x47fea0[_0x8c78('0x15')](0x194);}return _0x5ef9bc;};}function handleError(_0x28910a,_0x26689d){_0x26689d=_0x26689d||0x1f4;return function(_0x2ca681){logger['error'](_0x2ca681[_0x8c78('0x23')]);if(_0x2ca681[_0x8c78('0x24')]){delete _0x2ca681[_0x8c78('0x24')];}_0x28910a[_0x8c78('0x16')](_0x26689d)[_0x8c78('0x25')](_0x2ca681);};}exports[_0x8c78('0x26')]=function(_0x4e4aa3,_0x1e662d){var _0x42cc47={},_0x132e7b={},_0x4e0ff5={'count':0x0,'rows':[]};var _0x228d65=_[_0x8c78('0x27')](db[_0x8c78('0x28')][_0x8c78('0x29')],function(_0x569f5a){return{'name':_0x569f5a[_0x8c78('0x2a')],'type':_0x569f5a['type']['key']};});_0x132e7b[_0x8c78('0x2b')]=_[_0x8c78('0x27')](_0x228d65,_0x8c78('0x24'));_0x132e7b[_0x8c78('0x2c')]=_[_0x8c78('0x2d')](_0x4e4aa3['query']);_0x132e7b['filters']=_[_0x8c78('0x2e')](_0x132e7b['model'],_0x132e7b[_0x8c78('0x2c')]);_0x42cc47[_0x8c78('0x2f')]=_[_0x8c78('0x2e')](_0x132e7b[_0x8c78('0x2b')],qs[_0x8c78('0x30')](_0x4e4aa3[_0x8c78('0x2c')]['fields']));_0x42cc47[_0x8c78('0x2f')]=_0x42cc47[_0x8c78('0x2f')][_0x8c78('0x31')]?_0x42cc47[_0x8c78('0x2f')]:_0x132e7b['model'];if(!_0x4e4aa3[_0x8c78('0x2c')][_0x8c78('0x32')](_0x8c78('0x33'))){_0x42cc47['limit']=qs[_0x8c78('0x1a')](_0x4e4aa3[_0x8c78('0x2c')][_0x8c78('0x1a')]);_0x42cc47[_0x8c78('0x19')]=qs[_0x8c78('0x19')](_0x4e4aa3[_0x8c78('0x2c')][_0x8c78('0x19')]);}_0x42cc47[_0x8c78('0x34')]=qs[_0x8c78('0x35')](_0x4e4aa3[_0x8c78('0x2c')][_0x8c78('0x35')]);_0x42cc47[_0x8c78('0x36')]=qs[_0x8c78('0x37')](_['pick'](_0x4e4aa3['query'],_0x132e7b['filters']),_0x228d65);if(_0x4e4aa3[_0x8c78('0x2c')][_0x8c78('0x38')]){_0x42cc47[_0x8c78('0x36')]=_[_0x8c78('0x39')](_0x42cc47[_0x8c78('0x36')],{'$or':_[_0x8c78('0x27')](_0x228d65,function(_0x113447){if(_0x113447[_0x8c78('0x3a')]!==_0x8c78('0x3b')){var _0x5a9c31={};_0x5a9c31[_0x113447[_0x8c78('0x24')]]={'$like':'%'+_0x4e4aa3[_0x8c78('0x2c')][_0x8c78('0x38')]+'%'};return _0x5a9c31;}})});}_0x42cc47=_[_0x8c78('0x39')]({},_0x42cc47,_0x4e4aa3[_0x8c78('0x3c')]);var _0x2f6924={'where':_0x42cc47[_0x8c78('0x36')]};return db['Migration']['count'](_0x2f6924)[_0x8c78('0x21')](function(_0x4543f1){_0x4e0ff5[_0x8c78('0x18')]=_0x4543f1;if(_0x4e4aa3[_0x8c78('0x2c')][_0x8c78('0x3d')]){_0x42cc47[_0x8c78('0x3e')]=[{'all':!![]}];}return db['Migration'][_0x8c78('0x3f')](_0x42cc47);})['then'](function(_0xd5030c){_0x4e0ff5[_0x8c78('0x40')]=_0xd5030c;return _0x4e0ff5;})['then'](respondWithFilteredResult(_0x1e662d,_0x42cc47))[_0x8c78('0x41')](handleError(_0x1e662d,null));}; \ No newline at end of file +var _0x6100=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','Migration','rawAttributes','type','key'];(function(_0x21c23e,_0x1d33e3){var _0xa7b7e2=function(_0x6ac2a8){while(--_0x6ac2a8){_0x21c23e['push'](_0x21c23e['shift']());}};_0xa7b7e2(++_0x1d33e3);}(_0x6100,0x16e));var _0x0610=function(_0x11160d,_0x413adc){_0x11160d=_0x11160d-0x0;var _0x21520a=_0x6100[_0x11160d];return _0x21520a;};'use strict';var pdf=require(_0x0610('0x0'));var emlformat=require(_0x0610('0x1'));var rimraf=require(_0x0610('0x2'));var zipdir=require(_0x0610('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0610('0x4'));var moment=require(_0x0610('0x5'));var BPromise=require(_0x0610('0x6'));var Mustache=require('mustache');var util=require(_0x0610('0x7'));var path=require('path');var sox=require(_0x0610('0x8'));var csv=require(_0x0610('0x9'));var ejs=require(_0x0610('0xa'));var fs=require('fs');var _=require(_0x0610('0xb'));var squel=require(_0x0610('0xc'));var crypto=require(_0x0610('0xd'));var jsforce=require(_0x0610('0xe'));var deskjs=require(_0x0610('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0610('0x10'));var Papa=require(_0x0610('0x11'));var Redis=require('ioredis');var authService=require(_0x0610('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0610('0x13'));var logger=require(_0x0610('0x14'))(_0x0610('0x15'));var utils=require(_0x0610('0x16'));var config=require(_0x0610('0x17'));var licenseUtil=require(_0x0610('0x18'));var db=require(_0x0610('0x19'))['db'];function respondWithStatusCode(_0x1617c9,_0x32560f){_0x32560f=_0x32560f||0xcc;return function(_0x543139){if(_0x543139){return _0x1617c9['sendStatus'](_0x32560f);}return _0x1617c9[_0x0610('0x1a')](_0x32560f)['end']();};}function respondWithResult(_0x1df821,_0x5f540e){_0x5f540e=_0x5f540e||0xc8;return function(_0x2dee4a){if(_0x2dee4a){return _0x1df821[_0x0610('0x1a')](_0x5f540e)[_0x0610('0x1b')](_0x2dee4a);}};}function respondWithFilteredResult(_0x591787,_0x2b1303){return function(_0x36a5f4){if(_0x36a5f4){var _0x4d826e=_0x36a5f4[_0x0610('0x1c')],_0x263cc9=_0x2b1303[_0x0610('0x1d')],_0x514d0b=_0x2b1303[_0x0610('0x1d')]+_0x2b1303[_0x0610('0x1e')],_0x572165;if(_0x514d0b>=_0x4d826e){_0x514d0b=_0x4d826e;_0x572165=0xc8;}else{_0x572165=0xce;}_0x591787[_0x0610('0x1a')](_0x572165);return _0x591787['set'](_0x0610('0x1f'),_0x263cc9+'-'+_0x514d0b+'/'+_0x4d826e)[_0x0610('0x1b')](_0x36a5f4);}return null;};}function patchUpdates(_0x56fa6b){return function(_0x1344ba){try{jsonpatch[_0x0610('0x20')](_0x1344ba,_0x56fa6b,!![]);}catch(_0x2cca0b){return BPromise[_0x0610('0x21')](_0x2cca0b);}return _0x1344ba[_0x0610('0x22')]();};}function saveUpdates(_0x321c7d,_0x456173){return function(_0x28b48b){if(_0x28b48b){return _0x28b48b[_0x0610('0x23')](_0x321c7d)[_0x0610('0x24')](function(_0x48c597){return _0x48c597;});}return null;};}function removeEntity(_0x29c777,_0x5a87ef){return function(_0x3b0d99){if(_0x3b0d99){return _0x3b0d99[_0x0610('0x25')]()[_0x0610('0x24')](function(){_0x29c777['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb38d86,_0x116553){return function(_0x519c5d){if(!_0x519c5d){_0xb38d86[_0x0610('0x26')](0x194);}return _0x519c5d;};}function handleError(_0x957fcf,_0x2f1dce){_0x2f1dce=_0x2f1dce||0x1f4;return function(_0x3059ef){logger['error'](_0x3059ef[_0x0610('0x27')]);if(_0x3059ef[_0x0610('0x28')]){delete _0x3059ef[_0x0610('0x28')];}_0x957fcf[_0x0610('0x1a')](_0x2f1dce)[_0x0610('0x29')](_0x3059ef);};}exports[_0x0610('0x2a')]=function(_0x5102b6,_0x2255aa){var _0x12e516={},_0x3857b3={},_0x254bae={'count':0x0,'rows':[]};var _0x4422b5=_[_0x0610('0x2b')](db[_0x0610('0x2c')][_0x0610('0x2d')],function(_0x1c8f15){return{'name':_0x1c8f15['fieldName'],'type':_0x1c8f15[_0x0610('0x2e')][_0x0610('0x2f')]};});_0x3857b3[_0x0610('0x30')]=_['map'](_0x4422b5,_0x0610('0x28'));_0x3857b3[_0x0610('0x31')]=_[_0x0610('0x32')](_0x5102b6['query']);_0x3857b3[_0x0610('0x33')]=_[_0x0610('0x34')](_0x3857b3[_0x0610('0x30')],_0x3857b3['query']);_0x12e516['attributes']=_['intersection'](_0x3857b3[_0x0610('0x30')],qs[_0x0610('0x35')](_0x5102b6['query'][_0x0610('0x35')]));_0x12e516[_0x0610('0x36')]=_0x12e516[_0x0610('0x36')][_0x0610('0x37')]?_0x12e516['attributes']:_0x3857b3['model'];if(!_0x5102b6[_0x0610('0x31')][_0x0610('0x38')](_0x0610('0x39'))){_0x12e516[_0x0610('0x1e')]=qs[_0x0610('0x1e')](_0x5102b6['query'][_0x0610('0x1e')]);_0x12e516[_0x0610('0x1d')]=qs[_0x0610('0x1d')](_0x5102b6['query'][_0x0610('0x1d')]);}_0x12e516[_0x0610('0x3a')]=qs[_0x0610('0x3b')](_0x5102b6[_0x0610('0x31')][_0x0610('0x3b')]);_0x12e516[_0x0610('0x3c')]=qs[_0x0610('0x33')](_[_0x0610('0x3d')](_0x5102b6['query'],_0x3857b3[_0x0610('0x33')]),_0x4422b5);if(_0x5102b6['query']['filter']){_0x12e516[_0x0610('0x3c')]=_[_0x0610('0x3e')](_0x12e516[_0x0610('0x3c')],{'$or':_['map'](_0x4422b5,function(_0x5e4e59){if(_0x5e4e59[_0x0610('0x2e')]!=='VIRTUAL'){var _0x479af2={};_0x479af2[_0x5e4e59[_0x0610('0x28')]]={'$like':'%'+_0x5102b6[_0x0610('0x31')][_0x0610('0x3f')]+'%'};return _0x479af2;}})});}_0x12e516=_['merge']({},_0x12e516,_0x5102b6[_0x0610('0x40')]);var _0x53667c={'where':_0x12e516['where']};return db['Migration'][_0x0610('0x1c')](_0x53667c)[_0x0610('0x24')](function(_0xcd1f2c){_0x254bae[_0x0610('0x1c')]=_0xcd1f2c;if(_0x5102b6['query'][_0x0610('0x41')]){_0x12e516[_0x0610('0x42')]=[{'all':!![]}];}return db['Migration'][_0x0610('0x43')](_0x12e516);})[_0x0610('0x24')](function(_0x41f69e){_0x254bae[_0x0610('0x44')]=_0x41f69e;return _0x254bae;})[_0x0610('0x24')](respondWithFilteredResult(_0x2255aa,_0x12e516))['catch'](handleError(_0x2255aa,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 2954b6e..a90e760 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 _0x37cf=['define','Migration','util','moment','request-promise','rimraf','../../config/environment','./migration.attributes'];(function(_0x4f7b5e,_0x555f6f){var _0x4bac7b=function(_0x45fc9b){while(--_0x45fc9b){_0x4f7b5e['push'](_0x4f7b5e['shift']());}};_0x4bac7b(++_0x555f6f);}(_0x37cf,0x82));var _0xf37c=function(_0x3f02a3,_0x3fa603){_0x3f02a3=_0x3f02a3-0x0;var _0x2aa265=_0x37cf[_0x3f02a3];return _0x2aa265;};'use strict';var _=require('lodash');var util=require(_0xf37c('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf37c('0x1'));var BPromise=require('bluebird');var rp=require(_0xf37c('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf37c('0x3'));var config=require(_0xf37c('0x4'));var attributes=require(_0xf37c('0x5'));module['exports']=function(_0x19aa86,_0x447f54){return _0x19aa86[_0xf37c('0x6')](_0xf37c('0x7'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb51=['util','api','moment','bluebird','request-promise','path','../../config/environment','./migration.attributes','define','Migration','lodash'];(function(_0x28a385,_0x1e3956){var _0x2e10fb=function(_0x256530){while(--_0x256530){_0x28a385['push'](_0x28a385['shift']());}};_0x2e10fb(++_0x1e3956);}(_0xdb51,0xc5));var _0x1db5=function(_0x112949,_0x5f5849){_0x112949=_0x112949-0x0;var _0xf8d2f5=_0xdb51[_0x112949];return _0xf8d2f5;};'use strict';var _=require(_0x1db5('0x0'));var util=require(_0x1db5('0x1'));var logger=require('../../config/logger')(_0x1db5('0x2'));var moment=require(_0x1db5('0x3'));var BPromise=require(_0x1db5('0x4'));var rp=require(_0x1db5('0x5'));var fs=require('fs');var path=require(_0x1db5('0x6'));var rimraf=require('rimraf');var config=require(_0x1db5('0x7'));var attributes=require(_0x1db5('0x8'));module['exports']=function(_0x149677,_0x2985f7){return _0x149677[_0x1db5('0x9')](_0x1db5('0xa'),attributes,{'tableName':'migrations','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 5ec2173..4d039d6 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 _0x2613=['rpc','../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','error','message','request\x20sent','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x2613,0xc0));var _0x3261=function(_0x30047d,_0x3b1a65){_0x30047d=_0x30047d-0x0;var _0x8b0a2e=_0x2613[_0x30047d];return _0x8b0a2e;};'use strict';var _=require('lodash');var util=require(_0x3261('0x0'));var moment=require(_0x3261('0x1'));var BPromise=require(_0x3261('0x2'));var rs=require(_0x3261('0x3'));var fs=require('fs');var Redis=require(_0x3261('0x4'));var db=require(_0x3261('0x5'))['db'];var utils=require(_0x3261('0x6'));var logger=require(_0x3261('0x7'))(_0x3261('0x8'));var config=require(_0x3261('0x9'));var jayson=require(_0x3261('0xa'));var client=jayson[_0x3261('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1782b2,_0xe6f483,_0x344e31){return new BPromise(function(_0x1cc403,_0x88d80c){return client[_0x3261('0xc')](_0x1782b2,_0x344e31)[_0x3261('0xd')](function(_0x51f6d8){logger[_0x3261('0xe')](_0x3261('0xf'),_0xe6f483,'request\x20sent');logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0xe6f483,'request\x20sent',JSON['stringify'](_0x51f6d8));if(_0x51f6d8[_0x3261('0x10')]){if(_0x51f6d8[_0x3261('0x10')]['code']===0x1f4){logger[_0x3261('0x10')](_0x3261('0xf'),_0xe6f483,_0x51f6d8['error'][_0x3261('0x11')]);return _0x88d80c(_0x51f6d8['error']['message']);}logger['error'](_0x3261('0xf'),_0xe6f483,_0x51f6d8[_0x3261('0x10')][_0x3261('0x11')]);return _0x1cc403(_0x51f6d8['error'][_0x3261('0x11')]);}else{logger[_0x3261('0xe')](_0x3261('0xf'),_0xe6f483,_0x3261('0x12'));_0x1cc403(_0x51f6d8['result'][_0x3261('0x11')]);}})[_0x3261('0x13')](function(_0x402d59){logger['error']('Migration,\x20%s,\x20%s',_0xe6f483,_0x402d59);_0x88d80c(_0x402d59);});});} \ No newline at end of file +var _0x1ac8=['Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ac8,0xd1));var _0x81ac=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1ac8[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x81ac('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x81ac('0x1'));var rs=require(_0x81ac('0x2'));var fs=require('fs');var Redis=require(_0x81ac('0x3'));var db=require(_0x81ac('0x4'))['db'];var utils=require(_0x81ac('0x5'));var logger=require(_0x81ac('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x81ac('0x7'));var client=jayson['client'][_0x81ac('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b0926,_0x14dcea,_0x2fa70e){return new BPromise(function(_0x2eddc2,_0x3e1c95){return client[_0x81ac('0x9')](_0x4b0926,_0x2fa70e)[_0x81ac('0xa')](function(_0x462233){logger['info'](_0x81ac('0xb'),_0x14dcea,_0x81ac('0xc'));logger[_0x81ac('0xd')](_0x81ac('0xe'),_0x14dcea,_0x81ac('0xc'),JSON[_0x81ac('0xf')](_0x462233));if(_0x462233[_0x81ac('0x10')]){if(_0x462233[_0x81ac('0x10')]['code']===0x1f4){logger['error'](_0x81ac('0xb'),_0x14dcea,_0x462233[_0x81ac('0x10')][_0x81ac('0x11')]);return _0x3e1c95(_0x462233[_0x81ac('0x10')][_0x81ac('0x11')]);}logger[_0x81ac('0x10')](_0x81ac('0xb'),_0x14dcea,_0x462233[_0x81ac('0x10')][_0x81ac('0x11')]);return _0x2eddc2(_0x462233[_0x81ac('0x10')][_0x81ac('0x11')]);}else{logger['info'](_0x81ac('0xb'),_0x14dcea,'request\x20sent');_0x2eddc2(_0x462233[_0x81ac('0x12')][_0x81ac('0x11')]);}})[_0x81ac('0x13')](function(_0x290318){logger['error']('Migration,\x20%s,\x20%s',_0x14dcea,_0x290318);_0x3e1c95(_0x290318);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index befcb60..04cb0eb 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 _0x99e0=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x29f495,_0x19dcda){var _0x449c0b=function(_0x40802d){while(--_0x40802d){_0x29f495['push'](_0x29f495['shift']());}};_0x449c0b(++_0x19dcda);}(_0x99e0,0xd0));var _0x099e=function(_0xf38617,_0x157798){_0xf38617=_0xf38617-0x0;var _0x33a4d5=_0x99e0[_0xf38617];return _0x33a4d5;};'use strict';var multer=require(_0x099e('0x0'));var util=require(_0x099e('0x1'));var path=require(_0x099e('0x2'));var timeout=require(_0x099e('0x3'));var express=require(_0x099e('0x4'));var router=express['Router']();var auth=require(_0x099e('0x5'));var interaction=require(_0x099e('0x6'));var config=require(_0x099e('0x7'));var controller=require(_0x099e('0x8'));router[_0x099e('0x9')]('/',auth[_0x099e('0xa')](),controller['index']);router[_0x099e('0x9')](_0x099e('0xb'),auth[_0x099e('0xa')](),controller['show']);router[_0x099e('0xc')]('/',auth[_0x099e('0xa')](),controller[_0x099e('0xd')]);router[_0x099e('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x099e('0xf')]);router[_0x099e('0x10')](_0x099e('0xb'),auth[_0x099e('0xa')](),controller[_0x099e('0x11')]);module[_0x099e('0x12')]=router; \ No newline at end of file +var _0xe4c0=['isAuthenticated','update','destroy','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id','show'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xe4c0,0x1ca));var _0x0e4c=function(_0x4ed37d,_0x1a84c9){_0x4ed37d=_0x4ed37d-0x0;var _0x4fb2c5=_0xe4c0[_0x4ed37d];return _0x4fb2c5;};'use strict';var multer=require('multer');var util=require(_0x0e4c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0e4c('0x1')]();var auth=require(_0x0e4c('0x2'));var interaction=require(_0x0e4c('0x3'));var config=require(_0x0e4c('0x4'));var controller=require(_0x0e4c('0x5'));router[_0x0e4c('0x6')]('/',auth['isAuthenticated'](),controller[_0x0e4c('0x7')]);router[_0x0e4c('0x6')](_0x0e4c('0x8'),auth['isAuthenticated'](),controller[_0x0e4c('0x9')]);router['post']('/',auth[_0x0e4c('0xa')](),controller['create']);router['put'](_0x0e4c('0x8'),auth['isAuthenticated'](),controller[_0x0e4c('0xb')]);router['delete'](_0x0e4c('0x8'),auth['isAuthenticated'](),controller[_0x0e4c('0xc')]);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 21e41bd..528e1aa 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(_0x321c59,_0x81998f){var _0x492b31=function(_0x18753b){while(--_0x18753b){_0x321c59['push'](_0x321c59['shift']());}};_0x492b31(++_0x81998f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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(_0x2571f3,_0x41a701){var _0x2e3c64=function(_0x3cc18d){while(--_0x3cc18d){_0x2571f3['push'](_0x2571f3['shift']());}};_0x2e3c64(++_0x41a701);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 67c8f85..7499e16 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 _0xa2db=['STUN','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','readFileSync','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','join','writeFileSync','format','toLowerCase','chan_sip.so','toUpperCase','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','Network','includeAll','include','findAll','show','params','find','create','body'];(function(_0x323d66,_0x58a223){var _0x2a5324=function(_0x15285){while(--_0x15285){_0x323d66['push'](_0x323d66['shift']());}};_0x2a5324(++_0x58a223);}(_0xa2db,0x7b));var _0xba2d=function(_0x2181b1,_0x569637){_0x2181b1=_0x2181b1-0x0;var _0x530548=_0xa2db[_0x2181b1];return _0x530548;};'use strict';var pdf=require(_0xba2d('0x0'));var emlformat=require(_0xba2d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xba2d('0x2'));var rp=require(_0xba2d('0x3'));var moment=require(_0xba2d('0x4'));var BPromise=require(_0xba2d('0x5'));var Mustache=require(_0xba2d('0x6'));var util=require('util');var path=require(_0xba2d('0x7'));var sox=require(_0xba2d('0x8'));var csv=require(_0xba2d('0x9'));var ejs=require(_0xba2d('0xa'));var fs=require('fs');var _=require(_0xba2d('0xb'));var squel=require(_0xba2d('0xc'));var crypto=require('crypto');var jsforce=require(_0xba2d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xba2d('0x9'));var querystring=require(_0xba2d('0xe'));var Papa=require(_0xba2d('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xba2d('0x10'));var as=require(_0xba2d('0x11'));var hardwareService=require(_0xba2d('0x12'));var logger=require('../../config/logger')(_0xba2d('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xba2d('0x14'));var db=require(_0xba2d('0x15'))['db'];var jayson=require(_0xba2d('0x16'));var client=jayson[_0xba2d('0x17')][_0xba2d('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4f2f94,_0x2b06a9,_0x3c0ba5,_0x500135){return new BPromise(function(_0x41f37d,_0x449b5e){var _0x108365=_0x500135||client;return _0x108365[_0xba2d('0x19')](_0x4f2f94,_0x3c0ba5)[_0xba2d('0x1a')](function(_0x18263d){logger[_0xba2d('0x1b')](_0xba2d('0x1c'),_0x2b06a9,_0xba2d('0x1d'));logger['debug'](_0xba2d('0x1e'),_0x2b06a9,_0xba2d('0x1d'),JSON['stringify'](_0x18263d));if(_0x18263d[_0xba2d('0x1f')]){if(_0x18263d[_0xba2d('0x1f')][_0xba2d('0x20')]===0x1f4){logger[_0xba2d('0x1f')](_0xba2d('0x1c'),_0x2b06a9,_0x18263d[_0xba2d('0x1f')][_0xba2d('0x21')]);return _0x449b5e(_0x18263d[_0xba2d('0x1f')]['message']);}logger[_0xba2d('0x1f')](_0xba2d('0x1c'),_0x2b06a9,_0x18263d['error'][_0xba2d('0x21')]);return _0x41f37d(_0x18263d[_0xba2d('0x1f')]['message']);}else{logger[_0xba2d('0x1b')](_0xba2d('0x1c'),_0x2b06a9,'request\x20sent');_0x41f37d(_0x18263d[_0xba2d('0x22')]['message']);}})[_0xba2d('0x23')](function(_0x4015dd){logger[_0xba2d('0x1f')](_0xba2d('0x1c'),_0x2b06a9,_0x4015dd);_0x449b5e(_0x4015dd);});});}function respondWithStatusCode(_0x49036f,_0x1f6dc5){_0x1f6dc5=_0x1f6dc5||0xcc;return function(_0x11fb14){if(_0x11fb14){return _0x49036f[_0xba2d('0x24')](_0x1f6dc5);}return _0x49036f[_0xba2d('0x25')](_0x1f6dc5)[_0xba2d('0x26')]();};}function respondWithResult(_0x12618d,_0x44c79a){_0x44c79a=_0x44c79a||0xc8;return function(_0x289116){if(_0x289116){return _0x12618d[_0xba2d('0x25')](_0x44c79a)[_0xba2d('0x27')](_0x289116);}};}function respondWithFilteredResult(_0x495bd4,_0x592a8e){return function(_0x141278){if(_0x141278){var _0x25af51=_0x141278[_0xba2d('0x28')],_0xfd31a5=_0x592a8e['offset'],_0x1b1e60=_0x592a8e[_0xba2d('0x29')]+_0x592a8e['limit'],_0x193001;if(_0x1b1e60>=_0x25af51){_0x1b1e60=_0x25af51;_0x193001=0xc8;}else{_0x193001=0xce;}_0x495bd4[_0xba2d('0x25')](_0x193001);return _0x495bd4['set'](_0xba2d('0x2a'),_0xfd31a5+'-'+_0x1b1e60+'/'+_0x25af51)[_0xba2d('0x27')](_0x141278);}return null;};}function patchUpdates(_0x2b302c){return function(_0x453d75){try{jsonpatch[_0xba2d('0x2b')](_0x453d75,_0x2b302c,!![]);}catch(_0x40e68f){return BPromise[_0xba2d('0x2c')](_0x40e68f);}return _0x453d75[_0xba2d('0x2d')]();};}function saveUpdates(_0x12dac2,_0x538355){return function(_0x11d1b2){if(_0x11d1b2){return _0x11d1b2[_0xba2d('0x2e')](_0x12dac2)['then'](function(_0x1d7444){return _0x1d7444;});}return null;};}function removeEntity(_0x4e707f,_0x4c9f51){return function(_0x2511c1){if(_0x2511c1){return _0x2511c1[_0xba2d('0x2f')]()['then'](function(){_0x4e707f['status'](0xcc)[_0xba2d('0x26')]();});}};}function handleEntityNotFound(_0x3702fe,_0x18054c){return function(_0x3e3651){if(!_0x3e3651){_0x3702fe['sendStatus'](0x194);}return _0x3e3651;};}function handleError(_0x33ac04,_0x569ab9){_0x569ab9=_0x569ab9||0x1f4;return function(_0x46b675){logger['error'](_0x46b675[_0xba2d('0x30')]);if(_0x46b675[_0xba2d('0x31')]){delete _0x46b675[_0xba2d('0x31')];}_0x33ac04[_0xba2d('0x25')](_0x569ab9)[_0xba2d('0x32')](_0x46b675);};}exports['index']=function(_0x28374a,_0x443cb4){var _0x32b831={},_0x5d6870={},_0xd538be={'count':0x0,'rows':[]};var _0x1c36c3=_[_0xba2d('0x33')](db['Network'][_0xba2d('0x34')],function(_0x10eec4){return{'name':_0x10eec4[_0xba2d('0x35')],'type':_0x10eec4['type']['key']};});_0x5d6870[_0xba2d('0x36')]=_['map'](_0x1c36c3,_0xba2d('0x31'));_0x5d6870[_0xba2d('0x37')]=_[_0xba2d('0x38')](_0x28374a[_0xba2d('0x37')]);_0x5d6870[_0xba2d('0x39')]=_[_0xba2d('0x3a')](_0x5d6870[_0xba2d('0x36')],_0x5d6870[_0xba2d('0x37')]);_0x32b831['attributes']=_[_0xba2d('0x3a')](_0x5d6870[_0xba2d('0x36')],qs[_0xba2d('0x3b')](_0x28374a[_0xba2d('0x37')][_0xba2d('0x3b')]));_0x32b831[_0xba2d('0x3c')]=_0x32b831['attributes'][_0xba2d('0x3d')]?_0x32b831['attributes']:_0x5d6870[_0xba2d('0x36')];if(!_0x28374a[_0xba2d('0x37')][_0xba2d('0x3e')](_0xba2d('0x3f'))){_0x32b831[_0xba2d('0x40')]=qs[_0xba2d('0x40')](_0x28374a['query'][_0xba2d('0x40')]);_0x32b831[_0xba2d('0x29')]=qs[_0xba2d('0x29')](_0x28374a[_0xba2d('0x37')][_0xba2d('0x29')]);}_0x32b831[_0xba2d('0x41')]=qs[_0xba2d('0x42')](_0x28374a[_0xba2d('0x37')]['sort']);_0x32b831[_0xba2d('0x43')]=qs['filters'](_[_0xba2d('0x44')](_0x28374a[_0xba2d('0x37')],_0x5d6870[_0xba2d('0x39')]),_0x1c36c3);if(_0x28374a['query']['filter']){_0x32b831['where']=_[_0xba2d('0x45')](_0x32b831['where'],{'$or':_[_0xba2d('0x33')](_0x1c36c3,function(_0x44ad3d){if(_0x44ad3d[_0xba2d('0x46')]!==_0xba2d('0x47')){var _0x3e83e8={};_0x3e83e8[_0x44ad3d[_0xba2d('0x31')]]={'$like':'%'+_0x28374a[_0xba2d('0x37')][_0xba2d('0x48')]+'%'};return _0x3e83e8;}})});}_0x32b831=_[_0xba2d('0x45')]({},_0x32b831,_0x28374a[_0xba2d('0x49')]);var _0x45dba9={'where':_0x32b831[_0xba2d('0x43')]};return db[_0xba2d('0x4a')][_0xba2d('0x28')](_0x45dba9)[_0xba2d('0x1a')](function(_0x21c050){_0xd538be[_0xba2d('0x28')]=_0x21c050;if(_0x28374a[_0xba2d('0x37')][_0xba2d('0x4b')]){_0x32b831[_0xba2d('0x4c')]=[{'all':!![]}];}return db[_0xba2d('0x4a')][_0xba2d('0x4d')](_0x32b831);})[_0xba2d('0x1a')](function(_0x225397){_0xd538be['rows']=_0x225397;return _0xd538be;})[_0xba2d('0x1a')](respondWithFilteredResult(_0x443cb4,_0x32b831))['catch'](handleError(_0x443cb4,null));};exports[_0xba2d('0x4e')]=function(_0x311843,_0x41ac88){var _0x388194={'raw':!![],'where':{'id':_0x311843[_0xba2d('0x4f')]['id']}},_0x1b097e={};_0x1b097e[_0xba2d('0x36')]=_[_0xba2d('0x38')](db[_0xba2d('0x4a')][_0xba2d('0x34')]);_0x1b097e[_0xba2d('0x37')]=_['keys'](_0x311843[_0xba2d('0x37')]);_0x1b097e['filters']=_[_0xba2d('0x3a')](_0x1b097e[_0xba2d('0x36')],_0x1b097e['query']);_0x388194[_0xba2d('0x3c')]=_[_0xba2d('0x3a')](_0x1b097e['model'],qs['fields'](_0x311843['query'][_0xba2d('0x3b')]));_0x388194['attributes']=_0x388194[_0xba2d('0x3c')]['length']?_0x388194['attributes']:_0x1b097e[_0xba2d('0x36')];if(_0x311843[_0xba2d('0x37')]['includeAll']){_0x388194[_0xba2d('0x4c')]=[{'all':!![]}];}_0x388194=_[_0xba2d('0x45')]({},_0x388194,_0x311843['options']);return db[_0xba2d('0x4a')][_0xba2d('0x50')](_0x388194)[_0xba2d('0x1a')](handleEntityNotFound(_0x41ac88,null))[_0xba2d('0x1a')](respondWithResult(_0x41ac88,null))['catch'](handleError(_0x41ac88,null));};exports['create']=function(_0x1dc9f4,_0x539750,_0x24ac51){var _0xed247e;return db['sequelize']['transaction'](function(_0x323f1d){return db[_0xba2d('0x4a')][_0xba2d('0x51')](_0x1dc9f4[_0xba2d('0x52')],{'raw':!![]})[_0xba2d('0x1a')](function(_0x56457c){_0xed247e=_0x56457c;return db[_0xba2d('0x4a')]['findAll']({'where':{'type':_0x1dc9f4[_0xba2d('0x52')]['type']},'raw':!![]});})[_0xba2d('0x1a')](function(_0x4d8478){if(_0xed247e[_0xba2d('0x46')]['toUpperCase']()==_0xba2d('0x53')){var _0x2e0525=fs['readFileSync'](path['join'](config[_0xba2d('0x54')],_0xba2d('0x55')),_0xba2d('0x56'));var _0x5c2a4e=ejs[_0xba2d('0x57')](_0x2e0525,{'networks':_0x4d8478||[]});fs['writeFileSync'](_0xba2d('0x58'),_0x5c2a4e);return respondWithRpcPromise('Reload',_0xba2d('0x51'),{'module':_0xba2d('0x59')});}else if(_0xed247e[_0xba2d('0x46')]['toUpperCase']()==_0xba2d('0x5a')){var _0x55b398=fs[_0xba2d('0x5b')](path['join'](config[_0xba2d('0x54')],_0xba2d('0x5c')),'utf8');var _0x186544=ejs[_0xba2d('0x57')](_0x55b398,{'networks':_0x4d8478||[]});fs['writeFileSync'](_0xba2d('0x5d'),_0x186544);return respondWithRpcPromise(_0xba2d('0x5e'),_0xba2d('0x51'),{'module':_0xba2d('0x59')});}else{var _0x231c63=fs[_0xba2d('0x5b')](path[_0xba2d('0x5f')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x51085c=ejs[_0xba2d('0x57')](_0x231c63,{'networks':_0x4d8478||[]});fs[_0xba2d('0x60')](util[_0xba2d('0x61')]('/etc/asterisk/sip_xcally_%s.conf',_0x1dc9f4[_0xba2d('0x52')][_0xba2d('0x46')][_0xba2d('0x62')]()),_0x51085c);return respondWithRpcPromise(_0xba2d('0x5e'),'create',{'module':_0xba2d('0x63')});}return null;})['then'](function(){return _0xed247e;});})[_0xba2d('0x1a')](respondWithResult(_0x539750,0xc9))[_0xba2d('0x23')](handleError(_0x539750,null));};exports[_0xba2d('0x2e')]=function(_0x3a99df,_0x226f0a,_0x4a86ba){var _0x3adff4;return db['sequelize']['transaction'](function(_0x5304b7){return db['Network']['find']({'where':{'id':_0x3a99df[_0xba2d('0x4f')]['id']}})[_0xba2d('0x1a')](handleEntityNotFound(_0x226f0a,null))[_0xba2d('0x1a')](saveUpdates(_0x3a99df[_0xba2d('0x52')],null))[_0xba2d('0x1a')](function(_0x573c68){if(_0x573c68){_0x3adff4=_0x573c68;return db['Network']['findAll']({'where':{'type':_0x3adff4[_0xba2d('0x46')]},'raw':!![]});}return null;})[_0xba2d('0x1a')](function(_0x35bf75){if(_0x3adff4[_0xba2d('0x46')][_0xba2d('0x64')]()==_0xba2d('0x53')){var _0x5c60a5=fs[_0xba2d('0x5b')](path[_0xba2d('0x5f')](config[_0xba2d('0x54')],_0xba2d('0x55')),_0xba2d('0x56'));var _0x1c03dd=ejs[_0xba2d('0x57')](_0x5c60a5,{'networks':_0x35bf75||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x1c03dd);return respondWithRpcPromise('Reload','update',{'module':'res_stun_monitor.so'});}else if(_0x3adff4[_0xba2d('0x46')]['toUpperCase']()=='TURN'){var _0x14d89f=fs[_0xba2d('0x5b')](path[_0xba2d('0x5f')](config['root'],_0xba2d('0x5c')),_0xba2d('0x56'));var _0x1f05a3=ejs[_0xba2d('0x57')](_0x14d89f,{'networks':_0x35bf75||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x1f05a3);return respondWithRpcPromise(_0xba2d('0x5e'),_0xba2d('0x2e'),{'module':_0xba2d('0x59')});}else{var _0x748fcb=fs[_0xba2d('0x5b')](path['join'](config[_0xba2d('0x54')],_0xba2d('0x65')),_0xba2d('0x56'));var _0x1807a8=ejs[_0xba2d('0x57')](_0x748fcb,{'networks':_0x35bf75||[]});fs[_0xba2d('0x60')](util['format'](_0xba2d('0x66'),_0x3a99df[_0xba2d('0x52')]['type'][_0xba2d('0x62')]()),_0x1807a8);return respondWithRpcPromise('Reload',_0xba2d('0x2e'),{'module':_0xba2d('0x63')});}return null;})['then'](function(_0x24abef){if(_0x24abef){return _0x3adff4;}return null;});})[_0xba2d('0x1a')](respondWithResult(_0x226f0a,null))[_0xba2d('0x23')](handleError(_0x226f0a,null));};exports[_0xba2d('0x2f')]=function(_0x3480a8,_0x4c6f8b,_0x520c21){var _0x2b8ce1;return db[_0xba2d('0x4a')][_0xba2d('0x50')]({'where':{'id':_0x3480a8['params']['id']}})['then'](function(_0x1aa9ff){_0x2b8ce1=_0x1aa9ff;return _0x1aa9ff;})['then'](handleEntityNotFound(_0x4c6f8b,null))['then'](removeEntity(_0x4c6f8b,null))[_0xba2d('0x1a')](function(){if(_0x2b8ce1){return db[_0xba2d('0x4a')][_0xba2d('0x4d')]({'where':{'type':_0x2b8ce1['type']},'raw':!![]});}})[_0xba2d('0x1a')](function(_0x90ad8c){if(_0x2b8ce1['type'][_0xba2d('0x64')]()==_0xba2d('0x53')){var _0x1f19c2=fs[_0xba2d('0x5b')](path['join'](config[_0xba2d('0x54')],_0xba2d('0x55')),_0xba2d('0x56'));var _0x554ca4=ejs[_0xba2d('0x57')](_0x1f19c2,{'networks':_0x90ad8c||[]});fs[_0xba2d('0x60')](_0xba2d('0x58'),_0x554ca4);return respondWithRpcPromise(_0xba2d('0x5e'),_0xba2d('0x2f'),{'module':_0xba2d('0x59')});}else if(_0x2b8ce1['type'][_0xba2d('0x64')]()==_0xba2d('0x5a')){var _0x520081=fs[_0xba2d('0x5b')](path[_0xba2d('0x5f')](config['root'],_0xba2d('0x5c')),_0xba2d('0x56'));var _0x28345b=ejs['render'](_0x520081,{'networks':_0x90ad8c||[]});fs['writeFileSync'](_0xba2d('0x5d'),_0x28345b);return respondWithRpcPromise(_0xba2d('0x5e'),_0xba2d('0x2f'),{'module':'res_stun_monitor.so'});}else{var _0x12135a=fs['readFileSync'](path[_0xba2d('0x5f')](config[_0xba2d('0x54')],_0xba2d('0x65')),'utf8');var _0x4aa7f1=ejs[_0xba2d('0x57')](_0x12135a,{'networks':_0x90ad8c||[]});fs['writeFileSync'](util['format'](_0xba2d('0x66'),_0x3480a8[_0xba2d('0x52')][_0xba2d('0x46')][_0xba2d('0x62')]()),_0x4aa7f1);return respondWithRpcPromise(_0xba2d('0x5e'),_0xba2d('0x2f'),{'module':_0xba2d('0x63')});}return null;})[_0xba2d('0x23')](handleError(_0x4c6f8b,null));}; \ No newline at end of file +var _0xd2cb=['Reload','res_stun_monitor.so','TURN','root','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','server/files/templates/stun_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','chan_sip.so','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','key','keys','query','filters','intersection','attributes','model','fields','nolimit','order','filter','where','merge','type','VIRTUAL','options','Network','include','findAll','catch','show','params','length','includeAll','find','sequelize','transaction','create','body','toUpperCase','STUN','readFileSync','join','utf8','render','/etc/asterisk/stun_xcally.conf'];(function(_0x29a1e9,_0x3049a6){var _0x3302c2=function(_0x536b8d){while(--_0x536b8d){_0x29a1e9['push'](_0x29a1e9['shift']());}};_0x3302c2(++_0x3049a6);}(_0xd2cb,0x14b));var _0xbd2c=function(_0x51f4cd,_0xab2cdc){_0x51f4cd=_0x51f4cd-0x0;var _0x24936a=_0xd2cb[_0x51f4cd];return _0x24936a;};'use strict';var pdf=require(_0xbd2c('0x0'));var emlformat=require(_0xbd2c('0x1'));var rimraf=require(_0xbd2c('0x2'));var zipdir=require(_0xbd2c('0x3'));var jsonpatch=require(_0xbd2c('0x4'));var rp=require(_0xbd2c('0x5'));var moment=require(_0xbd2c('0x6'));var BPromise=require(_0xbd2c('0x7'));var Mustache=require(_0xbd2c('0x8'));var util=require(_0xbd2c('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xbd2c('0xa'));var ejs=require(_0xbd2c('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbd2c('0xc'));var crypto=require(_0xbd2c('0xd'));var jsforce=require(_0xbd2c('0xe'));var deskjs=require(_0xbd2c('0xf'));var toCsv=require(_0xbd2c('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbd2c('0x10'));var authService=require(_0xbd2c('0x11'));var qs=require(_0xbd2c('0x12'));var as=require(_0xbd2c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd2c('0x14'))(_0xbd2c('0x15'));var utils=require(_0xbd2c('0x16'));var config=require(_0xbd2c('0x17'));var licenseUtil=require(_0xbd2c('0x18'));var db=require(_0xbd2c('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xbd2c('0x1a')][_0xbd2c('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x361dfd,_0x5ce088,_0x54e723,_0x6c7de9){return new BPromise(function(_0x557085,_0x369593){var _0xdeb674=_0x6c7de9||client;return _0xdeb674[_0xbd2c('0x1c')](_0x361dfd,_0x54e723)['then'](function(_0x15be2d){logger[_0xbd2c('0x1d')](_0xbd2c('0x1e'),_0x5ce088,_0xbd2c('0x1f'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x5ce088,'request\x20sent',JSON[_0xbd2c('0x20')](_0x15be2d));if(_0x15be2d[_0xbd2c('0x21')]){if(_0x15be2d['error']['code']===0x1f4){logger[_0xbd2c('0x21')](_0xbd2c('0x1e'),_0x5ce088,_0x15be2d[_0xbd2c('0x21')][_0xbd2c('0x22')]);return _0x369593(_0x15be2d[_0xbd2c('0x21')][_0xbd2c('0x22')]);}logger['error'](_0xbd2c('0x1e'),_0x5ce088,_0x15be2d['error']['message']);return _0x557085(_0x15be2d[_0xbd2c('0x21')][_0xbd2c('0x22')]);}else{logger[_0xbd2c('0x1d')](_0xbd2c('0x1e'),_0x5ce088,_0xbd2c('0x1f'));_0x557085(_0x15be2d[_0xbd2c('0x23')][_0xbd2c('0x22')]);}})['catch'](function(_0xd00185){logger[_0xbd2c('0x21')]('Network,\x20%s,\x20%s',_0x5ce088,_0xd00185);_0x369593(_0xd00185);});});}function respondWithStatusCode(_0x4ae1c9,_0x44f899){_0x44f899=_0x44f899||0xcc;return function(_0x5537b4){if(_0x5537b4){return _0x4ae1c9[_0xbd2c('0x24')](_0x44f899);}return _0x4ae1c9[_0xbd2c('0x25')](_0x44f899)[_0xbd2c('0x26')]();};}function respondWithResult(_0x90668e,_0x65528b){_0x65528b=_0x65528b||0xc8;return function(_0x18479c){if(_0x18479c){return _0x90668e['status'](_0x65528b)[_0xbd2c('0x27')](_0x18479c);}};}function respondWithFilteredResult(_0x3e8e16,_0x59e9ba){return function(_0x5e1455){if(_0x5e1455){var _0x211121=_0x5e1455[_0xbd2c('0x28')],_0x15b5a7=_0x59e9ba[_0xbd2c('0x29')],_0x4af12d=_0x59e9ba['offset']+_0x59e9ba[_0xbd2c('0x2a')],_0x4f2a17;if(_0x4af12d>=_0x211121){_0x4af12d=_0x211121;_0x4f2a17=0xc8;}else{_0x4f2a17=0xce;}_0x3e8e16[_0xbd2c('0x25')](_0x4f2a17);return _0x3e8e16[_0xbd2c('0x2b')](_0xbd2c('0x2c'),_0x15b5a7+'-'+_0x4af12d+'/'+_0x211121)[_0xbd2c('0x27')](_0x5e1455);}return null;};}function patchUpdates(_0x387470){return function(_0x1e192f){try{jsonpatch[_0xbd2c('0x2d')](_0x1e192f,_0x387470,!![]);}catch(_0x4cd6a1){return BPromise[_0xbd2c('0x2e')](_0x4cd6a1);}return _0x1e192f[_0xbd2c('0x2f')]();};}function saveUpdates(_0x4b6243,_0x4674ce){return function(_0x41f86d){if(_0x41f86d){return _0x41f86d[_0xbd2c('0x30')](_0x4b6243)[_0xbd2c('0x31')](function(_0x27426f){return _0x27426f;});}return null;};}function removeEntity(_0xe58b93,_0x4f734d){return function(_0x4b38c1){if(_0x4b38c1){return _0x4b38c1[_0xbd2c('0x32')]()[_0xbd2c('0x31')](function(){_0xe58b93[_0xbd2c('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48e34f,_0x4f5485){return function(_0x38fcb3){if(!_0x38fcb3){_0x48e34f['sendStatus'](0x194);}return _0x38fcb3;};}function handleError(_0x60afe4,_0x23d556){_0x23d556=_0x23d556||0x1f4;return function(_0x24c9e3){logger[_0xbd2c('0x21')](_0x24c9e3[_0xbd2c('0x33')]);if(_0x24c9e3[_0xbd2c('0x34')]){delete _0x24c9e3['name'];}_0x60afe4['status'](_0x23d556)[_0xbd2c('0x35')](_0x24c9e3);};}exports[_0xbd2c('0x36')]=function(_0x4dd28d,_0x498b97){var _0x32a6ff={},_0x5d59ec={},_0x31ba7a={'count':0x0,'rows':[]};var _0x67bec7=_[_0xbd2c('0x37')](db['Network'][_0xbd2c('0x38')],function(_0x234e4c){return{'name':_0x234e4c['fieldName'],'type':_0x234e4c['type'][_0xbd2c('0x39')]};});_0x5d59ec['model']=_[_0xbd2c('0x37')](_0x67bec7,_0xbd2c('0x34'));_0x5d59ec['query']=_[_0xbd2c('0x3a')](_0x4dd28d[_0xbd2c('0x3b')]);_0x5d59ec[_0xbd2c('0x3c')]=_[_0xbd2c('0x3d')](_0x5d59ec['model'],_0x5d59ec['query']);_0x32a6ff[_0xbd2c('0x3e')]=_[_0xbd2c('0x3d')](_0x5d59ec[_0xbd2c('0x3f')],qs[_0xbd2c('0x40')](_0x4dd28d[_0xbd2c('0x3b')][_0xbd2c('0x40')]));_0x32a6ff[_0xbd2c('0x3e')]=_0x32a6ff[_0xbd2c('0x3e')]['length']?_0x32a6ff[_0xbd2c('0x3e')]:_0x5d59ec[_0xbd2c('0x3f')];if(!_0x4dd28d[_0xbd2c('0x3b')]['hasOwnProperty'](_0xbd2c('0x41'))){_0x32a6ff[_0xbd2c('0x2a')]=qs[_0xbd2c('0x2a')](_0x4dd28d[_0xbd2c('0x3b')][_0xbd2c('0x2a')]);_0x32a6ff['offset']=qs[_0xbd2c('0x29')](_0x4dd28d[_0xbd2c('0x3b')][_0xbd2c('0x29')]);}_0x32a6ff[_0xbd2c('0x42')]=qs['sort'](_0x4dd28d[_0xbd2c('0x3b')]['sort']);_0x32a6ff['where']=qs[_0xbd2c('0x3c')](_['pick'](_0x4dd28d[_0xbd2c('0x3b')],_0x5d59ec[_0xbd2c('0x3c')]),_0x67bec7);if(_0x4dd28d['query'][_0xbd2c('0x43')]){_0x32a6ff[_0xbd2c('0x44')]=_[_0xbd2c('0x45')](_0x32a6ff[_0xbd2c('0x44')],{'$or':_[_0xbd2c('0x37')](_0x67bec7,function(_0x241976){if(_0x241976[_0xbd2c('0x46')]!==_0xbd2c('0x47')){var _0x531e48={};_0x531e48[_0x241976[_0xbd2c('0x34')]]={'$like':'%'+_0x4dd28d[_0xbd2c('0x3b')]['filter']+'%'};return _0x531e48;}})});}_0x32a6ff=_[_0xbd2c('0x45')]({},_0x32a6ff,_0x4dd28d[_0xbd2c('0x48')]);var _0x16229c={'where':_0x32a6ff[_0xbd2c('0x44')]};return db[_0xbd2c('0x49')]['count'](_0x16229c)[_0xbd2c('0x31')](function(_0x43a310){_0x31ba7a['count']=_0x43a310;if(_0x4dd28d[_0xbd2c('0x3b')]['includeAll']){_0x32a6ff[_0xbd2c('0x4a')]=[{'all':!![]}];}return db[_0xbd2c('0x49')][_0xbd2c('0x4b')](_0x32a6ff);})[_0xbd2c('0x31')](function(_0x467b2e){_0x31ba7a['rows']=_0x467b2e;return _0x31ba7a;})[_0xbd2c('0x31')](respondWithFilteredResult(_0x498b97,_0x32a6ff))[_0xbd2c('0x4c')](handleError(_0x498b97,null));};exports[_0xbd2c('0x4d')]=function(_0x3e63ab,_0x39c2b4){var _0x433f50={'raw':!![],'where':{'id':_0x3e63ab[_0xbd2c('0x4e')]['id']}},_0x398a29={};_0x398a29['model']=_['keys'](db[_0xbd2c('0x49')]['rawAttributes']);_0x398a29[_0xbd2c('0x3b')]=_[_0xbd2c('0x3a')](_0x3e63ab[_0xbd2c('0x3b')]);_0x398a29[_0xbd2c('0x3c')]=_[_0xbd2c('0x3d')](_0x398a29[_0xbd2c('0x3f')],_0x398a29[_0xbd2c('0x3b')]);_0x433f50['attributes']=_[_0xbd2c('0x3d')](_0x398a29[_0xbd2c('0x3f')],qs[_0xbd2c('0x40')](_0x3e63ab[_0xbd2c('0x3b')]['fields']));_0x433f50[_0xbd2c('0x3e')]=_0x433f50['attributes'][_0xbd2c('0x4f')]?_0x433f50[_0xbd2c('0x3e')]:_0x398a29[_0xbd2c('0x3f')];if(_0x3e63ab[_0xbd2c('0x3b')][_0xbd2c('0x50')]){_0x433f50['include']=[{'all':!![]}];}_0x433f50=_['merge']({},_0x433f50,_0x3e63ab['options']);return db[_0xbd2c('0x49')][_0xbd2c('0x51')](_0x433f50)['then'](handleEntityNotFound(_0x39c2b4,null))['then'](respondWithResult(_0x39c2b4,null))[_0xbd2c('0x4c')](handleError(_0x39c2b4,null));};exports['create']=function(_0x2098bf,_0x43a5cf,_0x1d4f90){var _0x1a7616;return db[_0xbd2c('0x52')][_0xbd2c('0x53')](function(_0x253c23){return db['Network'][_0xbd2c('0x54')](_0x2098bf[_0xbd2c('0x55')],{'raw':!![]})[_0xbd2c('0x31')](function(_0x2245c1){_0x1a7616=_0x2245c1;return db[_0xbd2c('0x49')][_0xbd2c('0x4b')]({'where':{'type':_0x2098bf[_0xbd2c('0x55')][_0xbd2c('0x46')]},'raw':!![]});})[_0xbd2c('0x31')](function(_0x3f2e28){if(_0x1a7616[_0xbd2c('0x46')][_0xbd2c('0x56')]()==_0xbd2c('0x57')){var _0x1226c5=fs[_0xbd2c('0x58')](path[_0xbd2c('0x59')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xbd2c('0x5a'));var _0x119e49=ejs[_0xbd2c('0x5b')](_0x1226c5,{'networks':_0x3f2e28||[]});fs['writeFileSync'](_0xbd2c('0x5c'),_0x119e49);return respondWithRpcPromise(_0xbd2c('0x5d'),_0xbd2c('0x54'),{'module':_0xbd2c('0x5e')});}else if(_0x1a7616[_0xbd2c('0x46')][_0xbd2c('0x56')]()==_0xbd2c('0x5f')){var _0x16a956=fs[_0xbd2c('0x58')](path[_0xbd2c('0x59')](config[_0xbd2c('0x60')],_0xbd2c('0x61')),_0xbd2c('0x5a'));var _0x421dc2=ejs[_0xbd2c('0x5b')](_0x16a956,{'networks':_0x3f2e28||[]});fs[_0xbd2c('0x62')]('/etc/asterisk/turn_xcally.conf',_0x421dc2);return respondWithRpcPromise(_0xbd2c('0x5d'),'create',{'module':_0xbd2c('0x5e')});}else{var _0x72f17f=fs[_0xbd2c('0x58')](path['join'](config[_0xbd2c('0x60')],'server/files/templates/network.ejs'),_0xbd2c('0x5a'));var _0xda157a=ejs[_0xbd2c('0x5b')](_0x72f17f,{'networks':_0x3f2e28||[]});fs['writeFileSync'](util['format'](_0xbd2c('0x63'),_0x2098bf[_0xbd2c('0x55')][_0xbd2c('0x46')][_0xbd2c('0x64')]()),_0xda157a);return respondWithRpcPromise(_0xbd2c('0x5d'),_0xbd2c('0x54'),{'module':'chan_sip.so'});}return null;})[_0xbd2c('0x31')](function(){return _0x1a7616;});})[_0xbd2c('0x31')](respondWithResult(_0x43a5cf,0xc9))[_0xbd2c('0x4c')](handleError(_0x43a5cf,null));};exports[_0xbd2c('0x30')]=function(_0x4c59dc,_0x5b3f9e,_0x5f5354){var _0x398720;return db['sequelize'][_0xbd2c('0x53')](function(_0x445fcc){return db[_0xbd2c('0x49')][_0xbd2c('0x51')]({'where':{'id':_0x4c59dc['params']['id']}})[_0xbd2c('0x31')](handleEntityNotFound(_0x5b3f9e,null))[_0xbd2c('0x31')](saveUpdates(_0x4c59dc['body'],null))[_0xbd2c('0x31')](function(_0x5db474){if(_0x5db474){_0x398720=_0x5db474;return db[_0xbd2c('0x49')][_0xbd2c('0x4b')]({'where':{'type':_0x398720['type']},'raw':!![]});}return null;})[_0xbd2c('0x31')](function(_0x1863ac){if(_0x398720[_0xbd2c('0x46')][_0xbd2c('0x56')]()==_0xbd2c('0x57')){var _0x4028d4=fs[_0xbd2c('0x58')](path['join'](config[_0xbd2c('0x60')],_0xbd2c('0x65')),_0xbd2c('0x5a'));var _0x55e3d7=ejs[_0xbd2c('0x5b')](_0x4028d4,{'networks':_0x1863ac||[]});fs[_0xbd2c('0x62')](_0xbd2c('0x5c'),_0x55e3d7);return respondWithRpcPromise('Reload','update',{'module':_0xbd2c('0x5e')});}else if(_0x398720[_0xbd2c('0x46')][_0xbd2c('0x56')]()==_0xbd2c('0x5f')){var _0x10960a=fs[_0xbd2c('0x58')](path[_0xbd2c('0x59')](config[_0xbd2c('0x60')],_0xbd2c('0x61')),_0xbd2c('0x5a'));var _0x19fa1b=ejs[_0xbd2c('0x5b')](_0x10960a,{'networks':_0x1863ac||[]});fs[_0xbd2c('0x62')](_0xbd2c('0x66'),_0x19fa1b);return respondWithRpcPromise('Reload',_0xbd2c('0x30'),{'module':_0xbd2c('0x5e')});}else{var _0x56bd1b=fs['readFileSync'](path[_0xbd2c('0x59')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x35ade9=ejs['render'](_0x56bd1b,{'networks':_0x1863ac||[]});fs[_0xbd2c('0x62')](util['format'](_0xbd2c('0x63'),_0x4c59dc[_0xbd2c('0x55')]['type'][_0xbd2c('0x64')]()),_0x35ade9);return respondWithRpcPromise('Reload',_0xbd2c('0x30'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x2bc69e){if(_0x2bc69e){return _0x398720;}return null;});})[_0xbd2c('0x31')](respondWithResult(_0x5b3f9e,null))[_0xbd2c('0x4c')](handleError(_0x5b3f9e,null));};exports[_0xbd2c('0x32')]=function(_0x17547c,_0xaeedb8,_0x2529af){var _0x4534b9;return db[_0xbd2c('0x49')][_0xbd2c('0x51')]({'where':{'id':_0x17547c[_0xbd2c('0x4e')]['id']}})[_0xbd2c('0x31')](function(_0x4e008f){_0x4534b9=_0x4e008f;return _0x4e008f;})['then'](handleEntityNotFound(_0xaeedb8,null))['then'](removeEntity(_0xaeedb8,null))[_0xbd2c('0x31')](function(){if(_0x4534b9){return db[_0xbd2c('0x49')][_0xbd2c('0x4b')]({'where':{'type':_0x4534b9[_0xbd2c('0x46')]},'raw':!![]});}})['then'](function(_0x16f285){if(_0x4534b9[_0xbd2c('0x46')]['toUpperCase']()==_0xbd2c('0x57')){var _0x1bc99d=fs[_0xbd2c('0x58')](path[_0xbd2c('0x59')](config[_0xbd2c('0x60')],'server/files/templates/stun_multiple.ejs'),_0xbd2c('0x5a'));var _0x3df36e=ejs[_0xbd2c('0x5b')](_0x1bc99d,{'networks':_0x16f285||[]});fs['writeFileSync'](_0xbd2c('0x5c'),_0x3df36e);return respondWithRpcPromise(_0xbd2c('0x5d'),_0xbd2c('0x32'),{'module':'res_stun_monitor.so'});}else if(_0x4534b9[_0xbd2c('0x46')]['toUpperCase']()==_0xbd2c('0x5f')){var _0x502b38=fs[_0xbd2c('0x58')](path[_0xbd2c('0x59')](config[_0xbd2c('0x60')],_0xbd2c('0x61')),_0xbd2c('0x5a'));var _0xf1ff4c=ejs[_0xbd2c('0x5b')](_0x502b38,{'networks':_0x16f285||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0xf1ff4c);return respondWithRpcPromise('Reload',_0xbd2c('0x32'),{'module':'res_stun_monitor.so'});}else{var _0x3b0658=fs[_0xbd2c('0x58')](path[_0xbd2c('0x59')](config[_0xbd2c('0x60')],_0xbd2c('0x67')),_0xbd2c('0x5a'));var _0x5affbd=ejs['render'](_0x3b0658,{'networks':_0x16f285||[]});fs['writeFileSync'](util[_0xbd2c('0x68')](_0xbd2c('0x63'),_0x17547c[_0xbd2c('0x55')][_0xbd2c('0x46')][_0xbd2c('0x64')]()),_0x5affbd);return respondWithRpcPromise('Reload','destroy',{'module':_0xbd2c('0x69')});}return null;})['catch'](handleError(_0xaeedb8,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index ec2f4c5..4006f4c 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 _0x99ae=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Network','lodash','util','../../config/logger'];(function(_0x7afe7a,_0x34ed67){var _0x151340=function(_0x41a69c){while(--_0x41a69c){_0x7afe7a['push'](_0x7afe7a['shift']());}};_0x151340(++_0x34ed67);}(_0x99ae,0x135));var _0xe99a=function(_0x282494,_0x4b59d0){_0x282494=_0x282494-0x0;var _0x5c79e5=_0x99ae[_0x282494];return _0x5c79e5;};'use strict';var _=require(_0xe99a('0x0'));var util=require(_0xe99a('0x1'));var logger=require(_0xe99a('0x2'))(_0xe99a('0x3'));var moment=require(_0xe99a('0x4'));var BPromise=require(_0xe99a('0x5'));var rp=require(_0xe99a('0x6'));var fs=require('fs');var path=require(_0xe99a('0x7'));var rimraf=require(_0xe99a('0x8'));var config=require(_0xe99a('0x9'));var attributes=require('./network.attributes');module[_0xe99a('0xa')]=function(_0x345f6c,_0x1328a9){return _0x345f6c[_0xe99a('0xb')](_0xe99a('0xc'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0031=['define','Network','network','util','moment','bluebird','request-promise','path','rimraf','./network.attributes'];(function(_0x8db60d,_0x49fc1c){var _0x423034=function(_0xfb0b6f){while(--_0xfb0b6f){_0x8db60d['push'](_0x8db60d['shift']());}};_0x423034(++_0x49fc1c);}(_0x0031,0x1c5));var _0x1003=function(_0x218372,_0x1dbbb8){_0x218372=_0x218372-0x0;var _0x5effab=_0x0031[_0x218372];return _0x5effab;};'use strict';var _=require('lodash');var util=require(_0x1003('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x1003('0x1'));var BPromise=require(_0x1003('0x2'));var rp=require(_0x1003('0x3'));var fs=require('fs');var path=require(_0x1003('0x4'));var rimraf=require(_0x1003('0x5'));var config=require('../../config/environment');var attributes=require(_0x1003('0x6'));module['exports']=function(_0xbc7e0,_0x292740){return _0xbc7e0[_0x1003('0x7')](_0x1003('0x8'),attributes,{'tableName':_0x1003('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 511edec..fa014a7 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 _0x9bc5=['info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x5dff29,_0x1bbb43){var _0x4185b6=function(_0x37a1f9){while(--_0x37a1f9){_0x5dff29['push'](_0x5dff29['shift']());}};_0x4185b6(++_0x1bbb43);}(_0x9bc5,0x13d));var _0x59bc=function(_0x2c3f54,_0x16e225){_0x2c3f54=_0x2c3f54-0x0;var _0x57fb2f=_0x9bc5[_0x2c3f54];return _0x57fb2f;};'use strict';var _=require(_0x59bc('0x0'));var util=require(_0x59bc('0x1'));var moment=require('moment');var BPromise=require(_0x59bc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x59bc('0x3'));var db=require(_0x59bc('0x4'))['db'];var utils=require(_0x59bc('0x5'));var logger=require(_0x59bc('0x6'))(_0x59bc('0x7'));var config=require(_0x59bc('0x8'));var jayson=require(_0x59bc('0x9'));var client=jayson['client'][_0x59bc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54caac,_0x43d03e,_0x1d122b){return new BPromise(function(_0x41a7b0,_0xc30dcb){return client[_0x59bc('0xb')](_0x54caac,_0x1d122b)[_0x59bc('0xc')](function(_0x1cbaa4){logger[_0x59bc('0xd')](_0x59bc('0xe'),_0x43d03e,_0x59bc('0xf'));logger[_0x59bc('0x10')](_0x59bc('0x11'),_0x43d03e,_0x59bc('0xf'),JSON[_0x59bc('0x12')](_0x1cbaa4));if(_0x1cbaa4['error']){if(_0x1cbaa4[_0x59bc('0x13')]['code']===0x1f4){logger[_0x59bc('0x13')](_0x59bc('0xe'),_0x43d03e,_0x1cbaa4[_0x59bc('0x13')][_0x59bc('0x14')]);return _0xc30dcb(_0x1cbaa4[_0x59bc('0x13')][_0x59bc('0x14')]);}logger['error'](_0x59bc('0xe'),_0x43d03e,_0x1cbaa4[_0x59bc('0x13')][_0x59bc('0x14')]);return _0x41a7b0(_0x1cbaa4[_0x59bc('0x13')][_0x59bc('0x14')]);}else{logger[_0x59bc('0xd')](_0x59bc('0xe'),_0x43d03e,_0x59bc('0xf'));_0x41a7b0(_0x1cbaa4['result'][_0x59bc('0x14')]);}})[_0x59bc('0x15')](function(_0x43e00d){logger[_0x59bc('0x13')](_0x59bc('0xe'),_0x43d03e,_0x43e00d);_0xc30dcb(_0x43e00d);});});} \ No newline at end of file +var _0x28e8=['Network,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x421263,_0x18187d){var _0x34e4b5=function(_0x4e7978){while(--_0x4e7978){_0x421263['push'](_0x421263['shift']());}};_0x34e4b5(++_0x18187d);}(_0x28e8,0x6a));var _0x828e=function(_0x4833dc,_0x4a9ef7){_0x4833dc=_0x4833dc-0x0;var _0x3f3766=_0x28e8[_0x4833dc];return _0x3f3766;};'use strict';var _=require(_0x828e('0x0'));var util=require(_0x828e('0x1'));var moment=require('moment');var BPromise=require(_0x828e('0x2'));var rs=require(_0x828e('0x3'));var fs=require('fs');var Redis=require(_0x828e('0x4'));var db=require(_0x828e('0x5'))['db'];var utils=require(_0x828e('0x6'));var logger=require('../../config/logger')(_0x828e('0x7'));var config=require(_0x828e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x828e('0x9')][_0x828e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18f429,_0x2d987d,_0x4a85d8){return new BPromise(function(_0x108bbc,_0x13be3f){return client[_0x828e('0xb')](_0x18f429,_0x4a85d8)[_0x828e('0xc')](function(_0x4a6851){logger[_0x828e('0xd')](_0x828e('0xe'),_0x2d987d,_0x828e('0xf'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x2d987d,_0x828e('0xf'),JSON[_0x828e('0x10')](_0x4a6851));if(_0x4a6851['error']){if(_0x4a6851[_0x828e('0x11')]['code']===0x1f4){logger[_0x828e('0x11')](_0x828e('0xe'),_0x2d987d,_0x4a6851[_0x828e('0x11')][_0x828e('0x12')]);return _0x13be3f(_0x4a6851[_0x828e('0x11')]['message']);}logger[_0x828e('0x11')](_0x828e('0xe'),_0x2d987d,_0x4a6851['error'][_0x828e('0x12')]);return _0x108bbc(_0x4a6851['error'][_0x828e('0x12')]);}else{logger[_0x828e('0xd')]('Network,\x20%s,\x20%s',_0x2d987d,'request\x20sent');_0x108bbc(_0x4a6851[_0x828e('0x13')]['message']);}})['catch'](function(_0x3c6027){logger[_0x828e('0x11')](_0x828e('0xe'),_0x2d987d,_0x3c6027);_0x13be3f(_0x3c6027);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 98ad314..6387521 100644 --- a/server/api/notification/index.js +++ b/server/api/notification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x73ac=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./notification.controller','post','sendNotification','exports','multer','util','path'];(function(_0xe028d4,_0x436573){var _0x1d18cd=function(_0x34b06c){while(--_0x34b06c){_0xe028d4['push'](_0xe028d4['shift']());}};_0x1d18cd(++_0x436573);}(_0x73ac,0xa5));var _0xc73a=function(_0x34b90c,_0x157601){_0x34b90c=_0x34b90c-0x0;var _0x633d02=_0x73ac[_0x34b90c];return _0x633d02;};'use strict';var multer=require(_0xc73a('0x0'));var util=require(_0xc73a('0x1'));var path=require(_0xc73a('0x2'));var timeout=require(_0xc73a('0x3'));var express=require(_0xc73a('0x4'));var router=express[_0xc73a('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc73a('0x6'));var config=require(_0xc73a('0x7'));var controller=require(_0xc73a('0x8'));router[_0xc73a('0x9')]('/',auth['isAuthenticated'](),controller[_0xc73a('0xa')]);module[_0xc73a('0xb')]=router; \ No newline at end of file +var _0x865c=['path','express','Router','../../components/auth/service','../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','multer','util'];(function(_0x373096,_0x4d37aa){var _0x14a6d0=function(_0xb3b614){while(--_0xb3b614){_0x373096['push'](_0x373096['shift']());}};_0x14a6d0(++_0x4d37aa);}(_0x865c,0x132));var _0xc865=function(_0x31d605,_0x2708d7){_0x31d605=_0x31d605-0x0;var _0x1a1d77=_0x865c[_0x31d605];return _0x1a1d77;};'use strict';var multer=require(_0xc865('0x0'));var util=require(_0xc865('0x1'));var path=require(_0xc865('0x2'));var timeout=require('connect-timeout');var express=require(_0xc865('0x3'));var router=express[_0xc865('0x4')]();var auth=require(_0xc865('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc865('0x6'));var controller=require(_0xc865('0x7'));router[_0xc865('0x8')]('/',auth[_0xc865('0x9')](),controller[_0xc865('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 1e4ecc1..f5d5482 100644 --- a/server/api/notification/notification.attributes.js +++ b/server/api/notification/notification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c93=['BOOLEAN','TEXT','STRING'];(function(_0x548503,_0x1aa00c){var _0xf8f05f=function(_0x2014c2){while(--_0x2014c2){_0x548503['push'](_0x548503['shift']());}};_0xf8f05f(++_0x1aa00c);}(_0x4c93,0xfa));var _0x34c9=function(_0x46b8ec,_0x3c75ac){_0x46b8ec=_0x46b8ec-0x0;var _0x58d55b=_0x4c93[_0x46b8ec];return _0x58d55b;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x34c9('0x0')]},'senderName':{'type':Sequelize[_0x34c9('0x1')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x34c9('0x2')]}}; \ No newline at end of file +var _0x070c=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x070c,0x16c));var _0xc070=function(_0x276004,_0x6dc6c9){_0x276004=_0x276004-0x0;var _0x1a4033=_0x070c[_0x276004];return _0x1a4033;};'use strict';var Sequelize=require(_0xc070('0x0'));module[_0xc070('0x1')]={'body':{'type':Sequelize[_0xc070('0x2')]},'senderName':{'type':Sequelize[_0xc070('0x3')]},'recipientsId':{'type':Sequelize[_0xc070('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xc070('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index bf3b334..65a92eb 100644 --- a/server/api/notification/notification.controller.js +++ b/server/api/notification/notification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32a7=['moment','bluebird','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./notification.socket','register','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','smsqueue','voicequeue','team','user','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','sequelize','transaction','forEach','emit','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','queue','replace','Queue','ids','all','union','flatten','getAgents','eml-format','zip-dir','fast-json-patch'];(function(_0x57c308,_0x13f859){var _0x19691e=function(_0x128a08){while(--_0x128a08){_0x57c308['push'](_0x57c308['shift']());}};_0x19691e(++_0x13f859);}(_0x32a7,0xb5));var _0x732a=function(_0x53166a,_0x43b2d3){_0x53166a=_0x53166a-0x0;var _0x2676c5=_0x32a7[_0x53166a];return _0x2676c5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x732a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x732a('0x1'));var jsonpatch=require(_0x732a('0x2'));var rp=require('request-promise');var moment=require(_0x732a('0x3'));var BPromise=require(_0x732a('0x4'));var Mustache=require('mustache');var util=require(_0x732a('0x5'));var path=require('path');var sox=require(_0x732a('0x6'));var csv=require(_0x732a('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x732a('0x8'));var squel=require('squel');var crypto=require(_0x732a('0x9'));var jsforce=require(_0x732a('0xa'));var deskjs=require(_0x732a('0xb'));var toCsv=require(_0x732a('0x7'));var querystring=require(_0x732a('0xc'));var Papa=require(_0x732a('0xd'));var Redis=require(_0x732a('0xe'));var authService=require(_0x732a('0xf'));var qs=require(_0x732a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x732a('0x11'));var logger=require(_0x732a('0x12'))(_0x732a('0x13'));var utils=require(_0x732a('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x732a('0x15'))['db'];config['redis']=_[_0x732a('0x16')](config[_0x732a('0x17')],{'host':_0x732a('0x18'),'port':0x18eb});var socket=require(_0x732a('0x19'))(new Redis(config[_0x732a('0x17')]));require(_0x732a('0x1a'))[_0x732a('0x1b')](socket);function respondWithStatusCode(_0x2bee7e,_0x1bedb9){_0x1bedb9=_0x1bedb9||0xcc;return function(_0x48db71){if(_0x48db71){return _0x2bee7e[_0x732a('0x1c')](_0x1bedb9);}return _0x2bee7e[_0x732a('0x1d')](_0x1bedb9)[_0x732a('0x1e')]();};}function respondWithResult(_0x55cdbc,_0x5e4fb6){_0x5e4fb6=_0x5e4fb6||0xc8;return function(_0x2686d3){if(_0x2686d3){return _0x55cdbc[_0x732a('0x1d')](_0x5e4fb6)[_0x732a('0x1f')](_0x2686d3);}};}function respondWithFilteredResult(_0x1167ed,_0x47b5f4){return function(_0xc95bb9){if(_0xc95bb9){var _0x2fea51=_0xc95bb9[_0x732a('0x20')],_0x1ec510=_0x47b5f4['offset'],_0x5b2618=_0x47b5f4['offset']+_0x47b5f4[_0x732a('0x21')],_0x11185b;if(_0x5b2618>=_0x2fea51){_0x5b2618=_0x2fea51;_0x11185b=0xc8;}else{_0x11185b=0xce;}_0x1167ed['status'](_0x11185b);return _0x1167ed[_0x732a('0x22')](_0x732a('0x23'),_0x1ec510+'-'+_0x5b2618+'/'+_0x2fea51)[_0x732a('0x1f')](_0xc95bb9);}return null;};}function patchUpdates(_0x39a932){return function(_0x3e3115){try{jsonpatch[_0x732a('0x24')](_0x3e3115,_0x39a932,!![]);}catch(_0x5e6b9c){return BPromise[_0x732a('0x25')](_0x5e6b9c);}return _0x3e3115[_0x732a('0x26')]();};}function saveUpdates(_0x336602,_0x5e1e2d){return function(_0x127659){if(_0x127659){return _0x127659[_0x732a('0x27')](_0x336602)[_0x732a('0x28')](function(_0x52ec96){return _0x52ec96;});}return null;};}function removeEntity(_0xee92e5,_0x1a3939){return function(_0x42b163){if(_0x42b163){return _0x42b163['destroy']()[_0x732a('0x28')](function(){_0xee92e5['status'](0xcc)[_0x732a('0x1e')]();});}};}function handleEntityNotFound(_0x32c090,_0x3fafeb){return function(_0x17a2e9){if(!_0x17a2e9){_0x32c090['sendStatus'](0x194);}return _0x17a2e9;};}function handleError(_0x3a2848,_0x41c409){_0x41c409=_0x41c409||0x1f4;return function(_0x32c7eb){logger[_0x732a('0x29')](_0x32c7eb[_0x732a('0x2a')]);if(_0x32c7eb[_0x732a('0x2b')]){delete _0x32c7eb[_0x732a('0x2b')];}_0x3a2848[_0x732a('0x1d')](_0x41c409)[_0x732a('0x2c')](_0x32c7eb);};}exports['sendNotification']=function(_0x33b500,_0x3ace25,_0x5095f3){if(!_0x33b500['body']['hasOwnProperty']('text')&&!_0x33b500[_0x732a('0x2d')][_0x732a('0x2e')](_0x732a('0x2f'))){throw new db[(_0x732a('0x30'))][(_0x732a('0x31'))](_0x732a('0x32'));}else{if(_0x33b500[_0x732a('0x2d')]['hasOwnProperty'](_0x732a('0x2f'))&&!_0x33b500[_0x732a('0x2d')][_0x732a('0x2e')](_0x732a('0x33'))){throw new db[(_0x732a('0x30'))]['ValidationError'](_0x732a('0x34'));}if(!_0x33b500[_0x732a('0x2d')][_0x732a('0x2e')]('recipients')){throw new db[(_0x732a('0x30'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x407c41=JSON[_0x732a('0x35')](_0x33b500[_0x732a('0x2d')][_0x732a('0x36')]);}catch(_0x56ceda){logger[_0x732a('0x29')](_0x56ceda);throw new db['Sequelize'][(_0x732a('0x31'))](_0x732a('0x37'));}var _0x4622c9=[_0x732a('0x38'),'faxqueue','mailqueue','openchannelqueue',_0x732a('0x39'),_0x732a('0x3a'),'whatsappqueue',_0x732a('0x3b'),_0x732a('0x3c')];if(_['some'](_0x407c41,function(_0x1a1e9b){return!_[_0x732a('0x3d')](_0x4622c9,_0x1a1e9b[_0x732a('0x3e')]['toLowerCase']());})){throw new db[(_0x732a('0x30'))][(_0x732a('0x31'))](_0x732a('0x3f'));}}}var _0x2ebafb={};_0x2ebafb[_0x732a('0x40')]=_0x33b500['body'][_0x732a('0x2e')](_0x732a('0x40'))?_0x33b500[_0x732a('0x2d')]['senderName']:_0x33b500[_0x732a('0x3c')]['fullname'];_0x2ebafb[_0x732a('0x41')]=_[_0x732a('0x42')](_0x33b500[_0x732a('0x2d')][_0x732a('0x41')])?null:_0x33b500[_0x732a('0x2d')][_0x732a('0x41')];_0x2ebafb[_0x732a('0x43')]=_0x33b500[_0x732a('0x2d')][_0x732a('0x43')]||![];_0x2ebafb[_0x732a('0x44')]=_0x33b500[_0x732a('0x3c')]['id'];return getContent(_0x33b500[_0x732a('0x2d')])[_0x732a('0x28')](function(_0x14e438){_0x2ebafb[_0x732a('0x2d')]=_0x14e438;return getRecipients(_0x407c41);})[_0x732a('0x28')](function(_0x3deb28){_0x2ebafb['recipientsId']=_[_0x732a('0x45')](_0x3deb28)[_0x732a('0x46')](',');return db[_0x732a('0x47')][_0x732a('0x48')](function(_0x5d6b0e){return db['Notification']['create'](_0x2ebafb,{'raw':!![],'transaction':_0x5d6b0e})[_0x732a('0x28')](function(_0x2353c7){var _0x4d5e0b={'sender':_0x2ebafb[_0x732a('0x40')],'description':_0x2ebafb[_0x732a('0x41')],'content':_0x2ebafb[_0x732a('0x2d')],'beep':_0x2ebafb['beep']};_0x3deb28[_0x732a('0x49')](function(_0x170792){_0x4d5e0b['recipient']=_0x170792;socket[_0x732a('0x4a')]('notification:send',_0x4d5e0b);});return _0x2353c7;});});})['then'](respondWithResult(_0x3ace25,0xc9))[_0x732a('0x4b')](handleError(_0x3ace25,null));};function getContent(_0x22dea7){return new BPromise(function(_0x29948c,_0x3d4446){if(_0x22dea7['text']){_0x29948c(_0x22dea7[_0x732a('0x4c')]);return;}return db[_0x732a('0x4d')][_0x732a('0x4e')]({'attributes':[_0x732a('0x4f')],'where':{'id':_0x22dea7[_0x732a('0x2f')]},'raw':!![]})[_0x732a('0x28')](function(_0x4b571b){if(!_0x4b571b)throw new db['Sequelize'][(_0x732a('0x31'))](_0x732a('0x50'));var _0x583b51=Mustache[_0x732a('0x51')](_0x4b571b[_0x732a('0x4f')],_0x22dea7[_0x732a('0x33')]);_0x29948c(_0x583b51);})['catch'](function(_0x4251bb){_0x3d4446(_0x4251bb);});});}function getRecipients(_0x39c5d1){return new BPromise(function(_0x5150a2,_0x31f9dd){var _0x2bcce7=[];var _0x54390d=[];_0x39c5d1[_0x732a('0x49')](function(_0x4e32db){var _0x4ce7fa=_[_0x732a('0x52')](_0x4e32db[_0x732a('0x3e')][_0x732a('0x53')]());if(_0x4ce7fa==='User'){_0x2bcce7=_['union'](_0x2bcce7,_0x4e32db['ids']);}else{if(_[_0x732a('0x3d')](_0x4ce7fa,_0x732a('0x54')))_0x4ce7fa=_0x4ce7fa[_0x732a('0x55')](_0x732a('0x54'),_0x732a('0x56'));_0x4e32db[_0x732a('0x57')][_0x732a('0x49')](function(_0xf2c62){_0x54390d['push'](getAgents(_0x4ce7fa,_0xf2c62));});}});return BPromise[_0x732a('0x58')](_0x54390d)[_0x732a('0x28')](function(_0x384e71){_0x2bcce7=_[_0x732a('0x59')](_0x2bcce7,_[_0x732a('0x5a')](_0x384e71));_0x5150a2(_0x2bcce7);})[_0x732a('0x4b')](function(_0x5787ae){_0x31f9dd(_0x5787ae);});});}function getAgents(_0x39f850,_0x45f4dd){return new BPromise(function(_0x1620c1,_0x2ac2bc){return db[_0x39f850]['findOne']({'where':{'id':_0x45f4dd}})[_0x732a('0x28')](function(_0x3038b7){return _0x3038b7[_0x732a('0x5b')]({'attributes':['id'],'raw':!![]})[_0x732a('0x28')](function(_0x38807f){var _0x53cfde=_['map'](_0x38807f,'id');_0x1620c1(_0x53cfde);});})['catch'](function(_0x3fead3){_0x2ac2bc(_0x3fead3);});});} \ No newline at end of file +var _0x84e3=['transaction','Notification','create','forEach','recipient','emit','notification:send','catch','Template','findOne','html','render','User','union','ids','queue','replace','Queue','push','all','flatten','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','end','status','json','offset','limit','Content-Range','apply','reject','update','then','destroy','name','send','body','text','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','ValidationError','hasOwnProperty','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','includes','model','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join'];(function(_0xb6ec92,_0x2d49e0){var _0x4fa7ac=function(_0x523405){while(--_0x523405){_0xb6ec92['push'](_0xb6ec92['shift']());}};_0x4fa7ac(++_0x2d49e0);}(_0x84e3,0xd5));var _0x384e=function(_0x2006e8,_0x16e3f6){_0x2006e8=_0x2006e8-0x0;var _0x5135da=_0x84e3[_0x2006e8];return _0x5135da;};'use strict';var pdf=require(_0x384e('0x0'));var emlformat=require(_0x384e('0x1'));var rimraf=require(_0x384e('0x2'));var zipdir=require(_0x384e('0x3'));var jsonpatch=require(_0x384e('0x4'));var rp=require('request-promise');var moment=require(_0x384e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x384e('0x6'));var util=require(_0x384e('0x7'));var path=require(_0x384e('0x8'));var sox=require(_0x384e('0x9'));var csv=require(_0x384e('0xa'));var ejs=require(_0x384e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x384e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x384e('0xd'));var toCsv=require(_0x384e('0xa'));var querystring=require('querystring');var Papa=require(_0x384e('0xe'));var Redis=require(_0x384e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x384e('0x10'));var as=require(_0x384e('0x11'));var hardwareService=require(_0x384e('0x12'));var logger=require(_0x384e('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x384e('0x14'));var licenseUtil=require(_0x384e('0x15'));var db=require(_0x384e('0x16'))['db'];config[_0x384e('0x17')]=_['defaults'](config[_0x384e('0x17')],{'host':_0x384e('0x18'),'port':0x18eb});var socket=require(_0x384e('0x19'))(new Redis(config['redis']));require('./notification.socket')['register'](socket);function respondWithStatusCode(_0x1654e2,_0x54399e){_0x54399e=_0x54399e||0xcc;return function(_0x46e71e){if(_0x46e71e){return _0x1654e2[_0x384e('0x1a')](_0x54399e);}return _0x1654e2['status'](_0x54399e)[_0x384e('0x1b')]();};}function respondWithResult(_0x33ec92,_0x5396d8){_0x5396d8=_0x5396d8||0xc8;return function(_0x3507f9){if(_0x3507f9){return _0x33ec92[_0x384e('0x1c')](_0x5396d8)[_0x384e('0x1d')](_0x3507f9);}};}function respondWithFilteredResult(_0x468857,_0x2478bf){return function(_0x4b15b1){if(_0x4b15b1){var _0x5c291a=_0x4b15b1['count'],_0x56ca33=_0x2478bf['offset'],_0xd38e90=_0x2478bf[_0x384e('0x1e')]+_0x2478bf[_0x384e('0x1f')],_0x3602d8;if(_0xd38e90>=_0x5c291a){_0xd38e90=_0x5c291a;_0x3602d8=0xc8;}else{_0x3602d8=0xce;}_0x468857[_0x384e('0x1c')](_0x3602d8);return _0x468857['set'](_0x384e('0x20'),_0x56ca33+'-'+_0xd38e90+'/'+_0x5c291a)[_0x384e('0x1d')](_0x4b15b1);}return null;};}function patchUpdates(_0x5714c2){return function(_0x3ac3ce){try{jsonpatch[_0x384e('0x21')](_0x3ac3ce,_0x5714c2,!![]);}catch(_0x1db1d8){return BPromise[_0x384e('0x22')](_0x1db1d8);}return _0x3ac3ce['save']();};}function saveUpdates(_0x5c0782,_0x46224e){return function(_0x457354){if(_0x457354){return _0x457354[_0x384e('0x23')](_0x5c0782)[_0x384e('0x24')](function(_0x25aed7){return _0x25aed7;});}return null;};}function removeEntity(_0x813d85,_0x5e7412){return function(_0x58cd0d){if(_0x58cd0d){return _0x58cd0d[_0x384e('0x25')]()['then'](function(){_0x813d85[_0x384e('0x1c')](0xcc)[_0x384e('0x1b')]();});}};}function handleEntityNotFound(_0x466989,_0x443a90){return function(_0x55a775){if(!_0x55a775){_0x466989[_0x384e('0x1a')](0x194);}return _0x55a775;};}function handleError(_0x468b41,_0x1b4926){_0x1b4926=_0x1b4926||0x1f4;return function(_0x3c2e6e){logger['error'](_0x3c2e6e['stack']);if(_0x3c2e6e['name']){delete _0x3c2e6e[_0x384e('0x26')];}_0x468b41[_0x384e('0x1c')](_0x1b4926)[_0x384e('0x27')](_0x3c2e6e);};}exports['sendNotification']=function(_0x40253d,_0x3f7424,_0x550d00){if(!_0x40253d[_0x384e('0x28')]['hasOwnProperty'](_0x384e('0x29'))&&!_0x40253d[_0x384e('0x28')]['hasOwnProperty'](_0x384e('0x2a'))){throw new db[(_0x384e('0x2b'))]['ValidationError'](_0x384e('0x2c'));}else{if(_0x40253d[_0x384e('0x28')]['hasOwnProperty'](_0x384e('0x2a'))&&!_0x40253d[_0x384e('0x28')]['hasOwnProperty']('view')){throw new db[(_0x384e('0x2b'))][(_0x384e('0x2d'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x40253d[_0x384e('0x28')][_0x384e('0x2e')]('recipients')){throw new db[(_0x384e('0x2b'))][(_0x384e('0x2d'))](_0x384e('0x2f'));}else{try{var _0x3e61c6=JSON[_0x384e('0x30')](_0x40253d[_0x384e('0x28')][_0x384e('0x31')]);}catch(_0x36c156){logger[_0x384e('0x32')](_0x36c156);throw new db['Sequelize']['ValidationError'](_0x384e('0x33'));}var _0x3c2d19=[_0x384e('0x34'),'faxqueue',_0x384e('0x35'),_0x384e('0x36'),_0x384e('0x37'),_0x384e('0x38'),_0x384e('0x39'),_0x384e('0x3a'),_0x384e('0x3b')];if(_['some'](_0x3e61c6,function(_0x195189){return!_[_0x384e('0x3c')](_0x3c2d19,_0x195189[_0x384e('0x3d')][_0x384e('0x3e')]());})){throw new db['Sequelize'][(_0x384e('0x2d'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x4aa1a6={};_0x4aa1a6[_0x384e('0x3f')]=_0x40253d['body']['hasOwnProperty'](_0x384e('0x3f'))?_0x40253d['body']['senderName']:_0x40253d[_0x384e('0x3b')][_0x384e('0x40')];_0x4aa1a6[_0x384e('0x41')]=_[_0x384e('0x42')](_0x40253d[_0x384e('0x28')][_0x384e('0x41')])?null:_0x40253d[_0x384e('0x28')][_0x384e('0x41')];_0x4aa1a6[_0x384e('0x43')]=_0x40253d[_0x384e('0x28')][_0x384e('0x43')]||![];_0x4aa1a6[_0x384e('0x44')]=_0x40253d[_0x384e('0x3b')]['id'];return getContent(_0x40253d[_0x384e('0x28')])['then'](function(_0x51cd41){_0x4aa1a6['body']=_0x51cd41;return getRecipients(_0x3e61c6);})['then'](function(_0x64bb68){_0x4aa1a6[_0x384e('0x45')]=_[_0x384e('0x46')](_0x64bb68)[_0x384e('0x47')](',');return db['sequelize'][_0x384e('0x48')](function(_0x55ee8f){return db[_0x384e('0x49')][_0x384e('0x4a')](_0x4aa1a6,{'raw':!![],'transaction':_0x55ee8f})[_0x384e('0x24')](function(_0x58a2a1){var _0x4a3e23={'sender':_0x4aa1a6[_0x384e('0x3f')],'description':_0x4aa1a6['recipientsDescription'],'content':_0x4aa1a6['body'],'beep':_0x4aa1a6[_0x384e('0x43')]};_0x64bb68[_0x384e('0x4b')](function(_0x1bff4d){_0x4a3e23[_0x384e('0x4c')]=_0x1bff4d;socket[_0x384e('0x4d')](_0x384e('0x4e'),_0x4a3e23);});return _0x58a2a1;});});})['then'](respondWithResult(_0x3f7424,0xc9))[_0x384e('0x4f')](handleError(_0x3f7424,null));};function getContent(_0x32f811){return new BPromise(function(_0x5e9a39,_0x2fe5c5){if(_0x32f811[_0x384e('0x29')]){_0x5e9a39(_0x32f811[_0x384e('0x29')]);return;}return db[_0x384e('0x50')][_0x384e('0x51')]({'attributes':[_0x384e('0x52')],'where':{'id':_0x32f811['TemplateId']},'raw':!![]})[_0x384e('0x24')](function(_0x59743e){if(!_0x59743e)throw new db[(_0x384e('0x2b'))][(_0x384e('0x2d'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x248884=Mustache[_0x384e('0x53')](_0x59743e['html'],_0x32f811['view']);_0x5e9a39(_0x248884);})[_0x384e('0x4f')](function(_0x11141e){_0x2fe5c5(_0x11141e);});});}function getRecipients(_0x1f345e){return new BPromise(function(_0x2ec4c6,_0x3687ba){var _0x4d81f4=[];var _0x2275bf=[];_0x1f345e[_0x384e('0x4b')](function(_0x123847){var _0x5df0a5=_['startCase'](_0x123847[_0x384e('0x3d')][_0x384e('0x3e')]());if(_0x5df0a5===_0x384e('0x54')){_0x4d81f4=_[_0x384e('0x55')](_0x4d81f4,_0x123847[_0x384e('0x56')]);}else{if(_[_0x384e('0x3c')](_0x5df0a5,_0x384e('0x57')))_0x5df0a5=_0x5df0a5[_0x384e('0x58')](_0x384e('0x57'),_0x384e('0x59'));_0x123847['ids'][_0x384e('0x4b')](function(_0x3e144e){_0x2275bf[_0x384e('0x5a')](getAgents(_0x5df0a5,_0x3e144e));});}});return BPromise[_0x384e('0x5b')](_0x2275bf)['then'](function(_0x221d59){_0x4d81f4=_[_0x384e('0x55')](_0x4d81f4,_[_0x384e('0x5c')](_0x221d59));_0x2ec4c6(_0x4d81f4);})['catch'](function(_0x12a153){_0x3687ba(_0x12a153);});});}function getAgents(_0x11886d,_0xb8c06f){return new BPromise(function(_0x3a661a,_0x25941b){return db[_0x11886d]['findOne']({'where':{'id':_0xb8c06f}})['then'](function(_0x45658d){return _0x45658d[_0x384e('0x5d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2b5cb4){var _0x4b4700=_[_0x384e('0x5e')](_0x2b5cb4,'id');_0x3a661a(_0x4b4700);});})['catch'](function(_0x52812b){_0x25941b(_0x52812b);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 5a589a8..55b8a83 100644 --- a/server/api/notification/notification.events.js +++ b/server/api/notification/notification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['../../mysqldb','Notification','remove','emit','hasOwnProperty','hook'];(function(_0x41fa38,_0x2aba32){var _0x6bd0da=function(_0x156738){while(--_0x156738){_0x41fa38['push'](_0x41fa38['shift']());}};_0x6bd0da(++_0x2aba32);}(_0x757a,0xde));var _0xa757=function(_0x5d4fd2,_0x54f314){_0x5d4fd2=_0x5d4fd2-0x0;var _0x2afc1d=_0x757a[_0x5d4fd2];return _0x2afc1d;};'use strict';var EventEmitter=require('events');var Notification=require(_0xa757('0x0'))['db'][_0xa757('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa757('0x2')};function emitEvent(_0x1721c6){return function(_0x1c2932,_0x453d07,_0x32630d){NotificationEvents[_0xa757('0x3')](_0x1721c6+':'+_0x1c2932['id'],_0x1c2932);NotificationEvents['emit'](_0x1721c6,_0x1c2932);_0x32630d(null);};}for(var e in events){if(events[_0xa757('0x4')](e)){var event=events[e];Notification[_0xa757('0x5')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file +var _0x757a=['../../mysqldb','Notification','remove','emit','hasOwnProperty','hook'];(function(_0x3ef564,_0x235279){var _0x427667=function(_0x177a4b){while(--_0x177a4b){_0x3ef564['push'](_0x3ef564['shift']());}};_0x427667(++_0x235279);}(_0x757a,0xde));var _0xa757=function(_0x3b3780,_0x5206c2){_0x3b3780=_0x3b3780-0x0;var _0x46f4e0=_0x757a[_0x3b3780];return _0x46f4e0;};'use strict';var EventEmitter=require('events');var Notification=require(_0xa757('0x0'))['db'][_0xa757('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa757('0x2')};function emitEvent(_0x1721c6){return function(_0x1c2932,_0x453d07,_0x32630d){NotificationEvents[_0xa757('0x3')](_0x1721c6+':'+_0x1c2932['id'],_0x1c2932);NotificationEvents['emit'](_0x1721c6,_0x1c2932);_0x32630d(null);};}for(var e in events){if(events[_0xa757('0x4')](e)){var event=events[e];Notification[_0xa757('0x5')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 70cd475..873664e 100644 --- a/server/api/notification/notification.model.js +++ b/server/api/notification/notification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2209=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','Notification','notifications'];(function(_0x17dc33,_0x5bb571){var _0x1dbb33=function(_0x72a772){while(--_0x72a772){_0x17dc33['push'](_0x17dc33['shift']());}};_0x1dbb33(++_0x5bb571);}(_0x2209,0x1ae));var _0x9220=function(_0x1ec350,_0x922adb){_0x1ec350=_0x1ec350-0x0;var _0x480348=_0x2209[_0x1ec350];return _0x480348;};'use strict';var _=require(_0x9220('0x0'));var util=require('util');var logger=require(_0x9220('0x1'))(_0x9220('0x2'));var moment=require(_0x9220('0x3'));var BPromise=require('bluebird');var rp=require(_0x9220('0x4'));var fs=require('fs');var path=require(_0x9220('0x5'));var rimraf=require(_0x9220('0x6'));var config=require(_0x9220('0x7'));var attributes=require('./notification.attributes');module[_0x9220('0x8')]=function(_0x38ee8d,_0x25bac8){return _0x38ee8d[_0x9220('0x9')](_0x9220('0xa'),attributes,{'tableName':_0x9220('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9220('0xc')});}; \ No newline at end of file +var _0x5c52=['../../config/environment','./notification.attributes','define','Notification','utf8mb4','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x2030f1,_0x104ae3){var _0x1cf35e=function(_0x5a5c23){while(--_0x5a5c23){_0x2030f1['push'](_0x2030f1['shift']());}};_0x1cf35e(++_0x104ae3);}(_0x5c52,0x10d));var _0x25c5=function(_0x5c3677,_0x170ec0){_0x5c3677=_0x5c3677-0x0;var _0x5b9562=_0x5c52[_0x5c3677];return _0x5b9562;};'use strict';var _=require('lodash');var util=require(_0x25c5('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x25c5('0x1'));var BPromise=require(_0x25c5('0x2'));var rp=require(_0x25c5('0x3'));var fs=require('fs');var path=require(_0x25c5('0x4'));var rimraf=require(_0x25c5('0x5'));var config=require(_0x25c5('0x6'));var attributes=require(_0x25c5('0x7'));module['exports']=function(_0x408a6f,_0x394ad6){return _0x408a6f[_0x25c5('0x8')](_0x25c5('0x9'),attributes,{'tableName':'notifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x25c5('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 7a08f18..896cd71 100644 --- a/server/api/notification/notification.rpc.js +++ b/server/api/notification/notification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f15=['localhost','socket.io-emitter','./notification.socket','register','request','info','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\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','redis'];(function(_0x46753c,_0x1d8501){var _0x5edd01=function(_0x377bf9){while(--_0x377bf9){_0x46753c['push'](_0x46753c['shift']());}};_0x5edd01(++_0x1d8501);}(_0x8f15,0x9c));var _0x58f1=function(_0x30ddb0,_0x406993){_0x30ddb0=_0x30ddb0-0x0;var _0x599261=_0x8f15[_0x30ddb0];return _0x599261;};'use strict';var _=require(_0x58f1('0x0'));var util=require(_0x58f1('0x1'));var moment=require(_0x58f1('0x2'));var BPromise=require(_0x58f1('0x3'));var rs=require(_0x58f1('0x4'));var fs=require('fs');var Redis=require(_0x58f1('0x5'));var db=require(_0x58f1('0x6'))['db'];var utils=require(_0x58f1('0x7'));var logger=require(_0x58f1('0x8'))(_0x58f1('0x9'));var config=require(_0x58f1('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x58f1('0xb')]=_['defaults'](config[_0x58f1('0xb')],{'host':_0x58f1('0xc'),'port':0x18eb});var socket=require(_0x58f1('0xd'))(new Redis(config['redis']));require(_0x58f1('0xe'))[_0x58f1('0xf')](socket);function respondWithRpcPromise(_0x561a80,_0x8f57e,_0x50cea9){return new BPromise(function(_0x40183c,_0x212c1f){return client[_0x58f1('0x10')](_0x561a80,_0x50cea9)['then'](function(_0x2c5720){logger[_0x58f1('0x11')](_0x58f1('0x12'),_0x8f57e,_0x58f1('0x13'));logger[_0x58f1('0x14')](_0x58f1('0x15'),_0x8f57e,_0x58f1('0x13'),JSON[_0x58f1('0x16')](_0x2c5720));if(_0x2c5720[_0x58f1('0x17')]){if(_0x2c5720['error'][_0x58f1('0x18')]===0x1f4){logger[_0x58f1('0x17')]('Notification,\x20%s,\x20%s',_0x8f57e,_0x2c5720[_0x58f1('0x17')][_0x58f1('0x19')]);return _0x212c1f(_0x2c5720[_0x58f1('0x17')][_0x58f1('0x19')]);}logger[_0x58f1('0x17')](_0x58f1('0x12'),_0x8f57e,_0x2c5720[_0x58f1('0x17')][_0x58f1('0x19')]);return _0x40183c(_0x2c5720[_0x58f1('0x17')][_0x58f1('0x19')]);}else{logger['info'](_0x58f1('0x12'),_0x8f57e,_0x58f1('0x13'));_0x40183c(_0x2c5720[_0x58f1('0x1a')][_0x58f1('0x19')]);}})[_0x58f1('0x1b')](function(_0x1d4f51){logger['error']('Notification,\x20%s,\x20%s',_0x8f57e,_0x1d4f51);_0x212c1f(_0x1d4f51);});});} \ No newline at end of file +var _0x48d5=['./notification.socket','register','request','then','info','Notification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x48d5,0x1be));var _0x548d=function(_0x45a7a6,_0x380289){_0x45a7a6=_0x45a7a6-0x0;var _0x514f51=_0x48d5[_0x45a7a6];return _0x514f51;};'use strict';var _=require(_0x548d('0x0'));var util=require(_0x548d('0x1'));var moment=require(_0x548d('0x2'));var BPromise=require('bluebird');var rs=require(_0x548d('0x3'));var fs=require('fs');var Redis=require(_0x548d('0x4'));var db=require(_0x548d('0x5'))['db'];var utils=require(_0x548d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x548d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x548d('0x8')]['http']({'port':0x232a});config[_0x548d('0x9')]=_[_0x548d('0xa')](config[_0x548d('0x9')],{'host':_0x548d('0xb'),'port':0x18eb});var socket=require(_0x548d('0xc'))(new Redis(config[_0x548d('0x9')]));require(_0x548d('0xd'))[_0x548d('0xe')](socket);function respondWithRpcPromise(_0xaa9d86,_0x4eebfd,_0x5ad656){return new BPromise(function(_0x3908b4,_0xc0f8be){return client[_0x548d('0xf')](_0xaa9d86,_0x5ad656)[_0x548d('0x10')](function(_0xbffc0){logger[_0x548d('0x11')](_0x548d('0x12'),_0x4eebfd,_0x548d('0x13'));logger[_0x548d('0x14')]('Notification,\x20%s,\x20%s,\x20%s',_0x4eebfd,_0x548d('0x13'),JSON[_0x548d('0x15')](_0xbffc0));if(_0xbffc0[_0x548d('0x16')]){if(_0xbffc0['error'][_0x548d('0x17')]===0x1f4){logger[_0x548d('0x16')]('Notification,\x20%s,\x20%s',_0x4eebfd,_0xbffc0[_0x548d('0x16')][_0x548d('0x18')]);return _0xc0f8be(_0xbffc0[_0x548d('0x16')]['message']);}logger[_0x548d('0x16')](_0x548d('0x12'),_0x4eebfd,_0xbffc0['error'][_0x548d('0x18')]);return _0x3908b4(_0xbffc0[_0x548d('0x16')]['message']);}else{logger[_0x548d('0x11')](_0x548d('0x12'),_0x4eebfd,'request\x20sent');_0x3908b4(_0xbffc0[_0x548d('0x19')][_0x548d('0x18')]);}})[_0x548d('0x1a')](function(_0x395bcd){logger[_0x548d('0x16')](_0x548d('0x12'),_0x4eebfd,_0x395bcd);_0xc0f8be(_0x395bcd);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index ee64c8d..434af58 100644 --- a/server/api/notification/notification.socket.js +++ b/server/api/notification/notification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x687d=['notification:','./notification.events','save','remove','emit','removeListener','length'];(function(_0xc1aa73,_0x31a5fa){var _0x4f7e91=function(_0x3674a9){while(--_0x3674a9){_0xc1aa73['push'](_0xc1aa73['shift']());}};_0x4f7e91(++_0x31a5fa);}(_0x687d,0x1e4));var _0xd687=function(_0x1fa48e,_0x9d8448){_0x1fa48e=_0x1fa48e-0x0;var _0x5cc93f=_0x687d[_0x1fa48e];return _0x5cc93f;};'use strict';var NotificationEvents=require(_0xd687('0x0'));var events=[_0xd687('0x1'),_0xd687('0x2'),'update'];function createListener(_0x3bf04c,_0x503906){return function(_0x9dec1c){_0x503906[_0xd687('0x3')](_0x3bf04c,_0x9dec1c);};}function removeListener(_0x26cbbf,_0x46c450){return function(){NotificationEvents[_0xd687('0x4')](_0x26cbbf,_0x46c450);};}exports['register']=function(_0x5b21c8){for(var _0x5d75ee=0x0,_0x34de54=events[_0xd687('0x5')];_0x5d75ee<_0x34de54;_0x5d75ee++){var _0x17c6a9=events[_0x5d75ee];var _0x5d9a91=createListener(_0xd687('0x6')+_0x17c6a9,_0x5b21c8);NotificationEvents['on'](_0x17c6a9,_0x5d9a91);}}; \ No newline at end of file +var _0x3949=['save','remove','update','emit','removeListener','register','length','notification:','./notification.events'];(function(_0x5d16fb,_0x4fcc7a){var _0x8b5e9d=function(_0x224374){while(--_0x224374){_0x5d16fb['push'](_0x5d16fb['shift']());}};_0x8b5e9d(++_0x4fcc7a);}(_0x3949,0x167));var _0x9394=function(_0x76e09b,_0x5d18a3){_0x76e09b=_0x76e09b-0x0;var _0xd18014=_0x3949[_0x76e09b];return _0xd18014;};'use strict';var NotificationEvents=require(_0x9394('0x0'));var events=[_0x9394('0x1'),_0x9394('0x2'),_0x9394('0x3')];function createListener(_0x4e2d5d,_0xdec47c){return function(_0x324291){_0xdec47c[_0x9394('0x4')](_0x4e2d5d,_0x324291);};}function removeListener(_0xedd65c,_0x493e28){return function(){NotificationEvents[_0x9394('0x5')](_0xedd65c,_0x493e28);};}exports[_0x9394('0x6')]=function(_0x1137ca){for(var _0x34b5c1=0x0,_0x53f821=events[_0x9394('0x7')];_0x34b5c1<_0x53f821;_0x34b5c1++){var _0x240935=events[_0x34b5c1];var _0x546d74=createListener(_0x9394('0x8')+_0x240935,_0x1137ca);NotificationEvents['on'](_0x240935,_0x546d74);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 67615a5..bd8d606 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 _0x70d0=['/:id/send','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addAnswer','/:id/notify','notify','addApplications','addAgents'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x70d0,0x1d1));var _0x070d=function(_0x3c5f8d,_0x39891f){_0x3c5f8d=_0x3c5f8d-0x0;var _0x3b7beb=_0x70d0[_0x3c5f8d];return _0x3b7beb;};'use strict';var multer=require(_0x070d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x070d('0x1'));var express=require(_0x070d('0x2'));var router=express[_0x070d('0x3')]();var auth=require(_0x070d('0x4'));var interaction=require(_0x070d('0x5'));var config=require(_0x070d('0x6'));var controller=require(_0x070d('0x7'));router[_0x070d('0x8')]('/',auth[_0x070d('0x9')](),controller['index']);router[_0x070d('0x8')]('/describe',auth[_0x070d('0x9')](),controller[_0x070d('0xa')]);router[_0x070d('0x8')](_0x070d('0xb'),auth[_0x070d('0x9')](),controller[_0x070d('0xc')]);router[_0x070d('0x8')](_0x070d('0xd'),auth[_0x070d('0x9')](),controller['getDispositions']);router[_0x070d('0x8')](_0x070d('0xe'),auth['isAuthenticated'](),controller[_0x070d('0xf')]);router[_0x070d('0x8')](_0x070d('0x10'),auth[_0x070d('0x9')](),controller[_0x070d('0x11')]);router[_0x070d('0x8')](_0x070d('0x12'),auth[_0x070d('0x9')](),controller[_0x070d('0x13')]);router['get'](_0x070d('0x14'),auth[_0x070d('0x9')](),controller[_0x070d('0x15')]);router[_0x070d('0x16')]('/',auth[_0x070d('0x9')](),controller[_0x070d('0x17')]);router[_0x070d('0x16')](_0x070d('0xd'),auth[_0x070d('0x9')](),controller['addDisposition']);router[_0x070d('0x16')]('/:id/canned_answers',auth[_0x070d('0x9')](),controller[_0x070d('0x18')]);router[_0x070d('0x16')](_0x070d('0x19'),controller[_0x070d('0x1a')]);router[_0x070d('0x16')]('/:id/applications',auth[_0x070d('0x9')](),controller[_0x070d('0x1b')]);router['post'](_0x070d('0x14'),auth[_0x070d('0x9')](),controller[_0x070d('0x1c')]);router[_0x070d('0x16')](_0x070d('0x1d'),auth[_0x070d('0x9')](),controller[_0x070d('0x1e')]);router[_0x070d('0x1f')](_0x070d('0xb'),auth[_0x070d('0x9')](),controller['update']);router[_0x070d('0x20')](_0x070d('0xb'),auth[_0x070d('0x9')](),controller[_0x070d('0x21')]);router[_0x070d('0x20')](_0x070d('0xd'),auth[_0x070d('0x9')](),controller[_0x070d('0x22')]);router[_0x070d('0x20')](_0x070d('0xe'),auth[_0x070d('0x9')](),controller[_0x070d('0x23')]);router[_0x070d('0x20')](_0x070d('0x14'),auth[_0x070d('0x9')](),controller[_0x070d('0x24')]);module[_0x070d('0x25')]=router; \ No newline at end of file +var _0xc7f0=['/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','getInteractions','/:id/users','post','addAnswer','notify','addApplications','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe'];(function(_0xa3852f,_0x46a5d6){var _0x347bcc=function(_0x59d2ce){while(--_0x59d2ce){_0xa3852f['push'](_0xa3852f['shift']());}};_0x347bcc(++_0x46a5d6);}(_0xc7f0,0x168));var _0x0c7f=function(_0x278111,_0x44e763){_0x278111=_0x278111-0x0;var _0x34edb0=_0xc7f0[_0x278111];return _0x34edb0;};'use strict';var multer=require(_0x0c7f('0x0'));var util=require(_0x0c7f('0x1'));var path=require(_0x0c7f('0x2'));var timeout=require(_0x0c7f('0x3'));var express=require(_0x0c7f('0x4'));var router=express[_0x0c7f('0x5')]();var auth=require(_0x0c7f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0c7f('0x7'));var controller=require(_0x0c7f('0x8'));router[_0x0c7f('0x9')]('/',auth['isAuthenticated'](),controller[_0x0c7f('0xa')]);router[_0x0c7f('0x9')](_0x0c7f('0xb'),auth[_0x0c7f('0xc')](),controller[_0x0c7f('0xd')]);router['get'](_0x0c7f('0xe'),auth[_0x0c7f('0xc')](),controller['show']);router['get'](_0x0c7f('0xf'),auth['isAuthenticated'](),controller[_0x0c7f('0x10')]);router[_0x0c7f('0x9')](_0x0c7f('0x11'),auth[_0x0c7f('0xc')](),controller['getAnswers']);router[_0x0c7f('0x9')](_0x0c7f('0x12'),auth[_0x0c7f('0xc')](),controller[_0x0c7f('0x13')]);router[_0x0c7f('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x0c7f('0x14')]);router[_0x0c7f('0x9')](_0x0c7f('0x15'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0c7f('0x16')]('/',auth[_0x0c7f('0xc')](),controller['create']);router[_0x0c7f('0x16')](_0x0c7f('0xf'),auth[_0x0c7f('0xc')](),controller['addDisposition']);router[_0x0c7f('0x16')](_0x0c7f('0x11'),auth['isAuthenticated'](),controller[_0x0c7f('0x17')]);router[_0x0c7f('0x16')]('/:id/notify',controller[_0x0c7f('0x18')]);router[_0x0c7f('0x16')](_0x0c7f('0x12'),auth['isAuthenticated'](),controller[_0x0c7f('0x19')]);router[_0x0c7f('0x16')](_0x0c7f('0x15'),auth[_0x0c7f('0xc')](),controller['addAgents']);router[_0x0c7f('0x16')]('/:id/send',auth[_0x0c7f('0xc')](),controller['send']);router[_0x0c7f('0x1a')](_0x0c7f('0xe'),auth[_0x0c7f('0xc')](),controller[_0x0c7f('0x1b')]);router['delete'](_0x0c7f('0xe'),auth[_0x0c7f('0xc')](),controller[_0x0c7f('0x1c')]);router[_0x0c7f('0x1d')]('/:id/dispositions',auth[_0x0c7f('0xc')](),controller[_0x0c7f('0x1e')]);router[_0x0c7f('0x1d')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x0c7f('0x1f')]);router[_0x0c7f('0x1d')](_0x0c7f('0x15'),auth[_0x0c7f('0xc')](),controller[_0x0c7f('0x20')]);module[_0x0c7f('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index c93d49f..bf9b2da 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 _0xefff=['setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x19c422,_0x1e9ea4){var _0x1391a2=function(_0x1c7cdc){while(--_0x1c7cdc){_0x19c422['push'](_0x19c422['shift']());}};_0x1391a2(++_0x1e9ea4);}(_0xefff,0x12e));var _0xfeff=function(_0x43c340,_0xe421c0){_0x43c340=_0x43c340-0x0;var _0xf8039a=_0xefff[_0x43c340];return _0xf8039a;};'use strict';var Sequelize=require(_0xfeff('0x0'));var rs=require(_0xfeff('0x1'));module[_0xfeff('0x2')]={'name':{'type':Sequelize[_0xfeff('0x3')],'unique':_0xfeff('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xfeff('0x3')]},'token':{'type':Sequelize[_0xfeff('0x3')],'defaultValue':function(){return rs[_0xfeff('0x5')]();}},'replyUri':{'type':Sequelize[_0xfeff('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xfeff('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xfeff('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xfeff('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfeff('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfeff('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xfeff('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfeff('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfeff('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfeff('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xfeff('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x12f2b1){if(!_0x12f2b1)this[_0xfeff('0xa')](_0xfeff('0xb'),null);this['setDataValue']('mandatoryDisposition',_0x12f2b1);}}}; \ No newline at end of file +var _0xa0bf=['STRING','generate','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','mandatoryDispositionPauseId','randomstring'];(function(_0x4f86f8,_0x5ed60c){var _0x113a3e=function(_0x25f694){while(--_0x25f694){_0x4f86f8['push'](_0x4f86f8['shift']());}};_0x113a3e(++_0x5ed60c);}(_0xa0bf,0x98));var _0xfa0b=function(_0x182415,_0x493a46){_0x182415=_0x182415-0x0;var _0x2a1b3b=_0xa0bf[_0x182415];return _0x2a1b3b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xfa0b('0x0'));module['exports']={'name':{'type':Sequelize[_0xfa0b('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xfa0b('0x1')]},'token':{'type':Sequelize[_0xfa0b('0x1')],'defaultValue':function(){return rs[_0xfa0b('0x2')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xfa0b('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xfa0b('0x3');}},'notificationSound':{'type':Sequelize[_0xfa0b('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfa0b('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfa0b('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfa0b('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfa0b('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xfa0b('0x6')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1be1a1){if(!_0x1be1a1)this[_0xfa0b('0x7')](_0xfa0b('0x8'),null);this['setDataValue']('mandatoryDisposition',_0x1be1a1);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 32fc5be..0b0c7e0 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 _0x2e09=['Owner','fullname','internal','Tag','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','isArray','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','reject','then','OpenchannelAccounts','UserProfileResource','destroy','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','OpenchannelAccountId','Disposition','getDispositions','removeDispositions','findOne','CannedAnswer','removeAnswers','ids','openchannel','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','DESC','Applications','account','applications','orderBy','priority','asc','Contacts','contact','firstName','threadId','OpenchannelInteraction','externalUrl','spread','lastName','update','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','sequelize','transaction','OpenchannelApplication','getApplications','getInteractions','Contact'];(function(_0x111f63,_0x2ecfd2){var _0x126ec4=function(_0x3121c1){while(--_0x3121c1){_0x111f63['push'](_0x111f63['shift']());}};_0x126ec4(++_0x2ecfd2);}(_0x2e09,0xc8));var _0x92e0=function(_0xee154a,_0x185879){_0xee154a=_0xee154a-0x0;var _0x31ecb4=_0x2e09[_0xee154a];return _0x31ecb4;};'use strict';var pdf=require(_0x92e0('0x0'));var emlformat=require(_0x92e0('0x1'));var rimraf=require(_0x92e0('0x2'));var zipdir=require(_0x92e0('0x3'));var jsonpatch=require(_0x92e0('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x92e0('0x5'));var Mustache=require(_0x92e0('0x6'));var util=require(_0x92e0('0x7'));var path=require(_0x92e0('0x8'));var sox=require(_0x92e0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x92e0('0xa'));var squel=require(_0x92e0('0xb'));var crypto=require(_0x92e0('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x92e0('0xd'));var querystring=require(_0x92e0('0xe'));var Papa=require(_0x92e0('0xf'));var Redis=require('ioredis');var authService=require(_0x92e0('0x10'));var qs=require(_0x92e0('0x11'));var as=require(_0x92e0('0x12'));var hardwareService=require(_0x92e0('0x13'));var logger=require(_0x92e0('0x14'))(_0x92e0('0x15'));var utils=require('../../config/utils');var config=require(_0x92e0('0x16'));var licenseUtil=require(_0x92e0('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x92e0('0x18')](config[_0x92e0('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x92e0('0x1a'))(new Redis(config[_0x92e0('0x19')]));require(_0x92e0('0x1b'))['register'](socket);var jayson=require(_0x92e0('0x1c'));var client=jayson[_0x92e0('0x1d')][_0x92e0('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x92e0('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3d6d87,_0x5a7c6e,_0x4421d8,_0x15a4d3){return new BPromise(function(_0x1552ad,_0x11fa47){var _0x161938=_0x15a4d3||client;return _0x161938[_0x92e0('0x1f')](_0x3d6d87,_0x4421d8)['then'](function(_0x247f7c){logger[_0x92e0('0x20')](_0x92e0('0x21'),_0x5a7c6e,_0x92e0('0x22'));logger[_0x92e0('0x23')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5a7c6e,'request\x20sent',JSON[_0x92e0('0x24')](_0x247f7c));if(_0x247f7c[_0x92e0('0x25')]){if(_0x247f7c['error'][_0x92e0('0x26')]===0x1f4){logger[_0x92e0('0x25')](_0x92e0('0x21'),_0x5a7c6e,_0x247f7c[_0x92e0('0x25')][_0x92e0('0x27')]);return _0x11fa47(_0x247f7c[_0x92e0('0x25')][_0x92e0('0x27')]);}logger[_0x92e0('0x25')](_0x92e0('0x21'),_0x5a7c6e,_0x247f7c[_0x92e0('0x25')][_0x92e0('0x27')]);return _0x1552ad(_0x247f7c[_0x92e0('0x25')][_0x92e0('0x27')]);}else{logger[_0x92e0('0x20')]('OpenchannelAccount,\x20%s,\x20%s',_0x5a7c6e,_0x92e0('0x22'));_0x1552ad(_0x247f7c[_0x92e0('0x28')][_0x92e0('0x27')]);}})[_0x92e0('0x29')](function(_0x5bf9e3){logger[_0x92e0('0x25')](_0x92e0('0x21'),_0x5a7c6e,_0x5bf9e3);_0x11fa47(_0x5bf9e3);});});}function respondWithStatusCode(_0x47b11b,_0x3c09fb){_0x3c09fb=_0x3c09fb||0xcc;return function(_0x34bec1){if(_0x34bec1){return _0x47b11b[_0x92e0('0x2a')](_0x3c09fb);}return _0x47b11b[_0x92e0('0x2b')](_0x3c09fb)['end']();};}function respondWithResult(_0x3dfc9a,_0x1c65ef){_0x1c65ef=_0x1c65ef||0xc8;return function(_0x3ff16a){if(_0x3ff16a){return _0x3dfc9a[_0x92e0('0x2b')](_0x1c65ef)[_0x92e0('0x2c')](_0x3ff16a);}};}function respondWithFilteredResult(_0x22bc6f,_0x35eeb0){return function(_0x31df53){if(_0x31df53){var _0x46ad00=_0x31df53[_0x92e0('0x2d')],_0x3571bc=_0x35eeb0['offset'],_0x3d1ccf=_0x35eeb0[_0x92e0('0x2e')]+_0x35eeb0['limit'],_0x45e9e1;if(_0x3d1ccf>=_0x46ad00){_0x3d1ccf=_0x46ad00;_0x45e9e1=0xc8;}else{_0x45e9e1=0xce;}_0x22bc6f[_0x92e0('0x2b')](_0x45e9e1);return _0x22bc6f[_0x92e0('0x2f')](_0x92e0('0x30'),_0x3571bc+'-'+_0x3d1ccf+'/'+_0x46ad00)['json'](_0x31df53);}return null;};}function patchUpdates(_0x1b96f1){return function(_0x1e990f){try{jsonpatch['apply'](_0x1e990f,_0x1b96f1,!![]);}catch(_0x2db453){return BPromise[_0x92e0('0x31')](_0x2db453);}return _0x1e990f['save']();};}function saveUpdates(_0x1d8e7c,_0x1fb901){return function(_0x26cad8){if(_0x26cad8){return _0x26cad8['update'](_0x1d8e7c)[_0x92e0('0x32')](function(_0x2ee67c){return _0x2ee67c;});}return null;};}function removeEntity(_0x58d25a,_0x1841e0){return function(_0x2a681d){if(_0x2a681d){return _0x2a681d['destroy']()[_0x92e0('0x32')](function(){var _0x4ba6fc=_0x2a681d['get']({'plain':!![]});var _0x240ccf=_0x92e0('0x33');return db[_0x92e0('0x34')][_0x92e0('0x35')]({'where':{'type':_0x240ccf,'resourceId':_0x4ba6fc['id']}})[_0x92e0('0x32')](function(){return _0x2a681d;});})[_0x92e0('0x32')](function(){_0x58d25a[_0x92e0('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2480b7,_0x40b880){return function(_0x11e7fa){if(!_0x11e7fa){_0x2480b7[_0x92e0('0x2a')](0x194);}return _0x11e7fa;};}function handleError(_0x667764,_0x459108){_0x459108=_0x459108||0x1f4;return function(_0x31bff7){logger['error'](_0x31bff7['stack']);if(_0x31bff7[_0x92e0('0x36')]){delete _0x31bff7[_0x92e0('0x36')];}_0x667764[_0x92e0('0x2b')](_0x459108)[_0x92e0('0x37')](_0x31bff7);};}exports[_0x92e0('0x38')]=function(_0x160e9e,_0x2b3c74){var _0x53e208={'include':[{'model':db[_0x92e0('0x39')],'as':_0x92e0('0x3a')}]},_0x59a32b={},_0x5783b5={'count':0x0,'rows':[]};var _0x483e54=_['map'](db[_0x92e0('0x3b')][_0x92e0('0x3c')],function(_0x29dbd5){return{'name':_0x29dbd5[_0x92e0('0x3d')],'type':_0x29dbd5[_0x92e0('0x3e')][_0x92e0('0x3f')]};});_0x59a32b[_0x92e0('0x40')]=_[_0x92e0('0x41')](_0x483e54,_0x92e0('0x36'));_0x59a32b['query']=_[_0x92e0('0x42')](_0x160e9e['query']);_0x59a32b[_0x92e0('0x43')]=_[_0x92e0('0x44')](_0x59a32b[_0x92e0('0x40')],_0x59a32b[_0x92e0('0x45')]);_0x53e208[_0x92e0('0x46')]=_[_0x92e0('0x44')](_0x59a32b['model'],qs[_0x92e0('0x47')](_0x160e9e['query'][_0x92e0('0x47')]));_0x53e208['attributes']=_0x53e208[_0x92e0('0x46')][_0x92e0('0x48')]?_0x53e208[_0x92e0('0x46')]:_0x59a32b['model'];if(!_0x160e9e[_0x92e0('0x45')][_0x92e0('0x49')](_0x92e0('0x4a'))){_0x53e208[_0x92e0('0x4b')]=qs[_0x92e0('0x4b')](_0x160e9e['query'][_0x92e0('0x4b')]);_0x53e208[_0x92e0('0x2e')]=qs[_0x92e0('0x2e')](_0x160e9e[_0x92e0('0x45')][_0x92e0('0x2e')]);}_0x53e208[_0x92e0('0x4c')]=qs[_0x92e0('0x4d')](_0x160e9e[_0x92e0('0x45')][_0x92e0('0x4d')]);_0x53e208[_0x92e0('0x4e')]=qs[_0x92e0('0x43')](_[_0x92e0('0x4f')](_0x160e9e[_0x92e0('0x45')],_0x59a32b[_0x92e0('0x43')]),_0x483e54);if(_0x160e9e[_0x92e0('0x45')][_0x92e0('0x50')]){_0x53e208[_0x92e0('0x4e')]=_[_0x92e0('0x51')](_0x53e208['where'],{'$or':_['map'](_0x483e54,function(_0x10fb1c){if(_0x10fb1c['type']!==_0x92e0('0x52')){var _0xe0d04={};_0xe0d04[_0x10fb1c[_0x92e0('0x36')]]={'$like':'%'+_0x160e9e[_0x92e0('0x45')][_0x92e0('0x50')]+'%'};return _0xe0d04;}})});}_0x53e208=_['merge']({},_0x53e208,_0x160e9e[_0x92e0('0x53')]);var _0x474a98={'where':_0x53e208[_0x92e0('0x4e')]};return db[_0x92e0('0x3b')][_0x92e0('0x2d')](_0x474a98)[_0x92e0('0x32')](function(_0x36bb8a){_0x5783b5[_0x92e0('0x2d')]=_0x36bb8a;if(_0x160e9e[_0x92e0('0x45')][_0x92e0('0x54')]){_0x53e208[_0x92e0('0x55')]=[{'all':!![]}];}return db[_0x92e0('0x3b')][_0x92e0('0x56')](_0x53e208);})[_0x92e0('0x32')](function(_0x4d8ec4){_0x5783b5[_0x92e0('0x57')]=_0x4d8ec4;return _0x5783b5;})['then'](respondWithFilteredResult(_0x2b3c74,_0x53e208))[_0x92e0('0x29')](handleError(_0x2b3c74,null));};exports[_0x92e0('0x58')]=function(_0x1b1ff1,_0x26005a){var _0x267abc={'raw':![],'where':{'id':_0x1b1ff1[_0x92e0('0x59')]['id']},'include':[{'model':db[_0x92e0('0x39')],'as':_0x92e0('0x3a')}]},_0x4b8989={};_0x4b8989[_0x92e0('0x40')]=_[_0x92e0('0x42')](db[_0x92e0('0x3b')]['rawAttributes']);_0x4b8989[_0x92e0('0x45')]=_['keys'](_0x1b1ff1['query']);_0x4b8989[_0x92e0('0x43')]=_['intersection'](_0x4b8989['model'],_0x4b8989[_0x92e0('0x45')]);_0x267abc['attributes']=_[_0x92e0('0x44')](_0x4b8989[_0x92e0('0x40')],qs[_0x92e0('0x47')](_0x1b1ff1['query'][_0x92e0('0x47')]));_0x267abc['attributes']=_0x267abc[_0x92e0('0x46')][_0x92e0('0x48')]?_0x267abc['attributes']:_0x4b8989[_0x92e0('0x40')];if(_0x1b1ff1[_0x92e0('0x45')][_0x92e0('0x54')]){_0x267abc[_0x92e0('0x55')]=[{'all':!![]}];}_0x267abc=_[_0x92e0('0x51')]({},_0x267abc,_0x1b1ff1['options']);return db[_0x92e0('0x3b')]['find'](_0x267abc)['then'](handleEntityNotFound(_0x26005a,null))[_0x92e0('0x32')](respondWithResult(_0x26005a,null))[_0x92e0('0x29')](handleError(_0x26005a,null));};exports[_0x92e0('0x5a')]=function(_0xef8fe1,_0x10ed03){return db[_0x92e0('0x3b')]['create'](_0xef8fe1[_0x92e0('0x5b')],{})[_0x92e0('0x32')](function(_0x12be5d){var _0x184c1d=_0xef8fe1['user'][_0x92e0('0x5c')]({'plain':!![]});if(!_0x184c1d)throw new Error(_0x92e0('0x5d'));if(_0x184c1d[_0x92e0('0x5e')]===_0x92e0('0x5f')){var _0x295f87=_0x12be5d[_0x92e0('0x5c')]({'plain':!![]});var _0xc5437a=_0x92e0('0x33');return db[_0x92e0('0x60')][_0x92e0('0x61')]({'where':{'name':_0xc5437a,'userProfileId':_0x184c1d[_0x92e0('0x62')]},'raw':!![]})[_0x92e0('0x32')](function(_0x240c45){if(_0x240c45&&_0x240c45['autoAssociation']===0x0){return db[_0x92e0('0x34')][_0x92e0('0x5a')]({'name':_0x295f87[_0x92e0('0x36')],'resourceId':_0x295f87['id'],'type':_0x240c45[_0x92e0('0x36')],'sectionId':_0x240c45['id']},{})['then'](function(){return _0x12be5d;});}else{return _0x12be5d;}})['catch'](function(_0x527548){logger['error'](_0x92e0('0x63'),_0x527548);throw _0x527548;});}return _0x12be5d;})[_0x92e0('0x32')](respondWithResult(_0x10ed03,0xc9))[_0x92e0('0x29')](handleError(_0x10ed03,null));};exports['update']=function(_0x530bf5,_0x1ef6a5){if(_0x530bf5['body']['id']){delete _0x530bf5['body']['id'];}return db[_0x92e0('0x3b')][_0x92e0('0x61')]({'where':{'id':_0x530bf5[_0x92e0('0x59')]['id']},'include':[{'model':db[_0x92e0('0x39')],'as':_0x92e0('0x3a')}]})['then'](handleEntityNotFound(_0x1ef6a5,null))['then'](saveUpdates(_0x530bf5[_0x92e0('0x5b')],null))[_0x92e0('0x32')](respondWithResult(_0x1ef6a5,null))[_0x92e0('0x29')](handleError(_0x1ef6a5,null));};exports[_0x92e0('0x35')]=function(_0x139f82,_0x32972f){return db['OpenchannelAccount'][_0x92e0('0x61')]({'where':{'id':_0x139f82['params']['id']}})[_0x92e0('0x32')](handleEntityNotFound(_0x32972f,null))[_0x92e0('0x32')](removeEntity(_0x32972f,null))['catch'](handleError(_0x32972f,null));};exports['describe']=function(_0x298574,_0x7db98f){return db[_0x92e0('0x3b')]['describe']()[_0x92e0('0x32')](respondWithResult(_0x7db98f,null))[_0x92e0('0x29')](handleError(_0x7db98f,null));};exports[_0x92e0('0x64')]=function(_0x453401,_0x180c90,_0x68403d){if(_0x453401[_0x92e0('0x5b')]['id']){delete _0x453401[_0x92e0('0x5b')]['id'];}return db[_0x92e0('0x3b')][_0x92e0('0x61')]({'where':{'id':_0x453401['params']['id']}})['then'](handleEntityNotFound(_0x180c90,null))[_0x92e0('0x32')](function(_0x374aa5){if(_0x374aa5){_0x453401['body'][_0x92e0('0x65')]=_0x374aa5['id'];return db[_0x92e0('0x66')]['create'](_0x453401[_0x92e0('0x5b')]);}})['then'](respondWithResult(_0x180c90,null))[_0x92e0('0x29')](handleError(_0x180c90,null));};exports[_0x92e0('0x67')]=function(_0x581bca,_0x3ba4c2,_0x2d96ba){var _0x42a6ca={'raw':![],'where':{}};var _0x3f7c36={};var _0x3b7436={'count':0x0,'rows':[]};return db[_0x92e0('0x3b')]['findOne']({'where':{'id':_0x581bca[_0x92e0('0x59')]['id']}})[_0x92e0('0x32')](handleEntityNotFound(_0x3ba4c2,null))[_0x92e0('0x32')](function(_0x4ab832){if(_0x4ab832){_0x3f7c36[_0x92e0('0x40')]=_[_0x92e0('0x42')](db[_0x92e0('0x66')][_0x92e0('0x3c')]);_0x3f7c36[_0x92e0('0x45')]=_[_0x92e0('0x42')](_0x581bca[_0x92e0('0x45')]);_0x3f7c36[_0x92e0('0x43')]=_[_0x92e0('0x44')](_0x3f7c36[_0x92e0('0x40')],_0x3f7c36['query']);_0x42a6ca[_0x92e0('0x46')]=_[_0x92e0('0x44')](_0x3f7c36[_0x92e0('0x40')],qs['fields'](_0x581bca[_0x92e0('0x45')][_0x92e0('0x47')]));_0x42a6ca[_0x92e0('0x46')]=_0x42a6ca[_0x92e0('0x46')]['length']?_0x42a6ca[_0x92e0('0x46')]:_0x3f7c36[_0x92e0('0x40')];if(!_0x581bca[_0x92e0('0x45')][_0x92e0('0x49')](_0x92e0('0x4a'))){_0x42a6ca['limit']=qs[_0x92e0('0x4b')](_0x581bca[_0x92e0('0x45')][_0x92e0('0x4b')]);_0x42a6ca[_0x92e0('0x2e')]=qs['offset'](_0x581bca[_0x92e0('0x45')][_0x92e0('0x2e')]);}_0x42a6ca['order']=qs[_0x92e0('0x4d')](_0x581bca[_0x92e0('0x45')][_0x92e0('0x4d')]);_0x42a6ca['where']=qs['filters'](_[_0x92e0('0x4f')](_0x581bca[_0x92e0('0x45')],_0x3f7c36[_0x92e0('0x43')]));_0x42a6ca['where'][_0x92e0('0x65')]=_0x4ab832['id'];if(_0x581bca[_0x92e0('0x45')][_0x92e0('0x50')]){_0x42a6ca[_0x92e0('0x4e')]=_['merge'](_0x42a6ca[_0x92e0('0x4e')],{'$or':_['map'](_0x42a6ca[_0x92e0('0x46')],function(_0x54c433){var _0x146c92={};_0x146c92[_0x54c433]={'$like':'%'+_0x581bca['query'][_0x92e0('0x50')]+'%'};return _0x146c92;})});}_0x42a6ca=_[_0x92e0('0x51')]({},_0x42a6ca,_0x581bca[_0x92e0('0x53')]);return db['Disposition'][_0x92e0('0x2d')]({'where':_0x42a6ca['where']})['then'](function(_0x4f0fc0){_0x3b7436[_0x92e0('0x2d')]=_0x4f0fc0;if(_0x581bca['query'][_0x92e0('0x54')]){_0x42a6ca[_0x92e0('0x55')]=[{'all':!![]}];}return db[_0x92e0('0x66')][_0x92e0('0x56')](_0x42a6ca);})[_0x92e0('0x32')](function(_0x147afd){_0x3b7436[_0x92e0('0x57')]=_0x147afd;return _0x3b7436;});}})[_0x92e0('0x32')](respondWithFilteredResult(_0x3ba4c2,_0x42a6ca))['catch'](handleError(_0x3ba4c2,null));};exports['removeDispositions']=function(_0x5797b1,_0x744a24,_0x213a9b){return db[_0x92e0('0x3b')]['find']({'where':{'id':_0x5797b1[_0x92e0('0x59')]['id']}})[_0x92e0('0x32')](handleEntityNotFound(_0x744a24,null))['then'](function(_0x10b7ce){if(_0x10b7ce){return _0x10b7ce[_0x92e0('0x68')](_0x5797b1[_0x92e0('0x45')]['ids']);}})[_0x92e0('0x32')](respondWithStatusCode(_0x744a24,null))[_0x92e0('0x29')](handleError(_0x744a24,null));};exports['addAnswer']=function(_0x144ff8,_0x89bfa8,_0x189443){if(_0x144ff8[_0x92e0('0x5b')]['id']){delete _0x144ff8['body']['id'];}return db[_0x92e0('0x3b')][_0x92e0('0x61')]({'where':{'id':_0x144ff8[_0x92e0('0x59')]['id']}})['then'](handleEntityNotFound(_0x89bfa8,null))[_0x92e0('0x32')](function(_0x32af16){if(_0x32af16){_0x144ff8['body']['OpenchannelAccountId']=_0x32af16['id'];return db['CannedAnswer'][_0x92e0('0x5a')](_0x144ff8[_0x92e0('0x5b')]);}})['then'](respondWithResult(_0x89bfa8,null))['catch'](handleError(_0x89bfa8,null));};exports['getAnswers']=function(_0x5dfffa,_0x435da7,_0x87c11d){var _0x28d1ec={'raw':![],'where':{}};var _0x2cddb7={};var _0x4fd171={'count':0x0,'rows':[]};return db[_0x92e0('0x3b')][_0x92e0('0x69')]({'where':{'id':_0x5dfffa[_0x92e0('0x59')]['id']}})['then'](handleEntityNotFound(_0x435da7,null))['then'](function(_0x4bab62){if(_0x4bab62){_0x2cddb7[_0x92e0('0x40')]=_[_0x92e0('0x42')](db['CannedAnswer'][_0x92e0('0x3c')]);_0x2cddb7[_0x92e0('0x45')]=_[_0x92e0('0x42')](_0x5dfffa[_0x92e0('0x45')]);_0x2cddb7['filters']=_[_0x92e0('0x44')](_0x2cddb7[_0x92e0('0x40')],_0x2cddb7[_0x92e0('0x45')]);_0x28d1ec['attributes']=_[_0x92e0('0x44')](_0x2cddb7[_0x92e0('0x40')],qs[_0x92e0('0x47')](_0x5dfffa[_0x92e0('0x45')][_0x92e0('0x47')]));_0x28d1ec[_0x92e0('0x46')]=_0x28d1ec[_0x92e0('0x46')][_0x92e0('0x48')]?_0x28d1ec['attributes']:_0x2cddb7[_0x92e0('0x40')];if(!_0x5dfffa[_0x92e0('0x45')]['hasOwnProperty'](_0x92e0('0x4a'))){_0x28d1ec[_0x92e0('0x4b')]=qs[_0x92e0('0x4b')](_0x5dfffa[_0x92e0('0x45')][_0x92e0('0x4b')]);_0x28d1ec[_0x92e0('0x2e')]=qs[_0x92e0('0x2e')](_0x5dfffa[_0x92e0('0x45')][_0x92e0('0x2e')]);}_0x28d1ec[_0x92e0('0x4c')]=qs['sort'](_0x5dfffa[_0x92e0('0x45')]['sort']);_0x28d1ec['where']=qs[_0x92e0('0x43')](_[_0x92e0('0x4f')](_0x5dfffa[_0x92e0('0x45')],_0x2cddb7[_0x92e0('0x43')]));_0x28d1ec[_0x92e0('0x4e')][_0x92e0('0x65')]=_0x4bab62['id'];if(_0x5dfffa['query'][_0x92e0('0x50')]){_0x28d1ec[_0x92e0('0x4e')]=_[_0x92e0('0x51')](_0x28d1ec['where'],{'$or':_[_0x92e0('0x41')](_0x28d1ec[_0x92e0('0x46')],function(_0x26e2ee){var _0x4b6d0f={};_0x4b6d0f[_0x26e2ee]={'$like':'%'+_0x5dfffa['query'][_0x92e0('0x50')]+'%'};return _0x4b6d0f;})});}_0x28d1ec=_[_0x92e0('0x51')]({},_0x28d1ec,_0x5dfffa[_0x92e0('0x53')]);return db[_0x92e0('0x6a')][_0x92e0('0x2d')]({'where':_0x28d1ec[_0x92e0('0x4e')]})[_0x92e0('0x32')](function(_0x41296b){_0x4fd171[_0x92e0('0x2d')]=_0x41296b;if(_0x5dfffa['query'][_0x92e0('0x54')]){_0x28d1ec[_0x92e0('0x55')]=[{'all':!![]}];}return db[_0x92e0('0x6a')][_0x92e0('0x56')](_0x28d1ec);})['then'](function(_0x5821a1){_0x4fd171[_0x92e0('0x57')]=_0x5821a1;return _0x4fd171;});}})[_0x92e0('0x32')](respondWithFilteredResult(_0x435da7,_0x28d1ec))[_0x92e0('0x29')](handleError(_0x435da7,null));};exports[_0x92e0('0x6b')]=function(_0x76f40a,_0x5089e1,_0x1d1559){return db[_0x92e0('0x3b')][_0x92e0('0x61')]({'where':{'id':_0x76f40a[_0x92e0('0x59')]['id']}})[_0x92e0('0x32')](handleEntityNotFound(_0x5089e1,null))[_0x92e0('0x32')](function(_0x208018){if(_0x208018){return _0x208018[_0x92e0('0x6b')](_0x76f40a[_0x92e0('0x45')][_0x92e0('0x6c')]);}})[_0x92e0('0x32')](respondWithStatusCode(_0x5089e1,null))['catch'](handleError(_0x5089e1,null));};exports['notify']=function(_0x5162a0,_0x333777,_0x35278a){var _0x59bfd2={'body':_0x5162a0['body'],'channel':_0x92e0('0x6d')};var _0x3e7d83=[];var _0x7f81b3=[];var _0xebb76={};var _0x1a790d=![];return db[_0x92e0('0x6e')][_0x92e0('0x6f')]()[_0x92e0('0x32')](function(_0x3c676c){if(!_0x3c676c){throw new db[(_0x92e0('0x70'))][(_0x92e0('0x71'))](_0x92e0('0x72'));}_0x3e7d83=_[_0x92e0('0x73')](_['keys'](_0x3c676c),[_0x92e0('0x74'),_0x92e0('0x75')]);_0x7f81b3=_[_0x92e0('0x73')](_[_0x92e0('0x42')](_0x3c676c),[_0x92e0('0x74'),'updatedAt','CompanyId',_0x92e0('0x76')]);if(_0x5162a0[_0x92e0('0x5b')]['id']){delete _0x5162a0[_0x92e0('0x5b')]['id'];}if(_[_0x92e0('0x77')](_0x5162a0['body'][_0x92e0('0x78')])){throw new db['Sequelize']['ValidationError'](_0x92e0('0x79'));}if(_[_0x92e0('0x77')](_0x5162a0[_0x92e0('0x5b')][_0x92e0('0x5b')])||_0x5162a0[_0x92e0('0x5b')]['body']===''){throw new db[(_0x92e0('0x70'))][(_0x92e0('0x71'))](_0x92e0('0x7a'));}if(_[_0x92e0('0x77')](_0x5162a0[_0x92e0('0x5b')]['mapKey'])){throw new db[(_0x92e0('0x70'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x7f81b3);}if(!_[_0x92e0('0x7b')](_0x7f81b3,_0x5162a0['body'][_0x92e0('0x7c')])){throw new db[(_0x92e0('0x70'))][(_0x92e0('0x71'))](_0x92e0('0x7d')+_0x7f81b3);}_0xebb76[_0x5162a0['body'][_0x92e0('0x7c')]]=_0x5162a0['body'][_0x92e0('0x78')];})[_0x92e0('0x32')](function(){return db['OpenchannelAccount'][_0x92e0('0x61')]({'where':{'id':_0x5162a0[_0x92e0('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0x92e0('0x7e'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0xebb76,'limit':0x1,'order':[[_0x92e0('0x75'),_0x92e0('0x7f')]]}]},{'model':db['OpenchannelApplication'],'as':_0x92e0('0x80')}]});})[_0x92e0('0x32')](handleEntityNotFound(_0x333777,null))['then'](function(_0x242502){if(_0x242502&&_0x242502[_0x92e0('0x7e')]){_0x59bfd2[_0x92e0('0x81')]=_0x242502;_0x59bfd2[_0x92e0('0x82')]=_0x242502['Applications'];_0x59bfd2['list']=_0x242502[_0x92e0('0x7e')];_0x59bfd2['applications']=_[_0x92e0('0x83')](_0x59bfd2['applications'],[_0x92e0('0x84')],[_0x92e0('0x85')]);if(_0x59bfd2[_0x92e0('0x81')]['Applications']){delete _0x59bfd2[_0x92e0('0x81')][_0x92e0('0x80')];}if(_0x59bfd2[_0x92e0('0x81')]['List']&&_0x59bfd2[_0x92e0('0x81')][_0x92e0('0x7e')]['Contacts'][_0x92e0('0x48')]){return _0x59bfd2[_0x92e0('0x81')][_0x92e0('0x7e')][_0x92e0('0x86')][0x0];}var _0x304e03=_[_0x92e0('0x18')](_0x5162a0[_0x92e0('0x5b')],{'firstName':_0x5162a0[_0x92e0('0x5b')][_0x92e0('0x78')],'ListId':_0x242502[_0x92e0('0x76')]});_0x304e03[_0x5162a0[_0x92e0('0x5b')][_0x92e0('0x7c')]]=_0x5162a0['body'][_0x92e0('0x78')];return db[_0x92e0('0x6e')][_0x92e0('0x5a')](_0x304e03,{'fields':_0x3e7d83,'raw':!![]});}})['then'](handleEntityNotFound(_0x333777,null))['then'](function(_0x299204){_0x59bfd2[_0x92e0('0x87')]=_0x299204;if(_0x299204){var _0x27937b={'ContactId':_0x299204['id'],'OpenchannelAccountId':_0x5162a0[_0x92e0('0x59')]['id'],'from':(_0x299204[_0x92e0('0x88')]||'')+'\x20'+(_0x299204['lastName']||'')};var _0x53bdf1={'OpenchannelAccountId':_0x5162a0[_0x92e0('0x59')]['id'],'closed':![]};if(_0x5162a0[_0x92e0('0x5b')][_0x92e0('0x89')]){_0x53bdf1['threadId']=_0x5162a0[_0x92e0('0x5b')][_0x92e0('0x89')];return db[_0x92e0('0x8a')][_0x92e0('0x61')]({'where':_0x53bdf1})[_0x92e0('0x32')](function(_0xd4ea4e){if(_0xd4ea4e){return[_0xd4ea4e,![]];}_0x27937b[_0x92e0('0x89')]=_0x5162a0['body'][_0x92e0('0x89')];_0x27937b[_0x92e0('0x8b')]=_0x5162a0['body'][_0x92e0('0x8b')];return db[_0x92e0('0x8a')]['create'](_0x27937b)[_0x92e0('0x32')](function(_0x28cc49){return[_0x28cc49,!![]];});});}else{_0x53bdf1['threadId']=null;}_0x53bdf1['ContactId']=_0x299204['id'];return db[_0x92e0('0x8a')][_0x92e0('0x61')]({'where':_0x53bdf1})[_0x92e0('0x32')](function(_0x1e7609){if(_0x1e7609){return[_0x1e7609,![]];}return db[_0x92e0('0x8a')]['create'](_0x27937b)['then'](function(_0x2dd4aa){return[_0x2dd4aa,!![]];});});}})[_0x92e0('0x8c')](function(_0x51352c,_0x339e12){if(_0x51352c){_0x1a790d=_0x339e12;if(!_0x339e12){var _0x36ffbf={'from':(_0x59bfd2[_0x92e0('0x87')]['firstName']||'')+'\x20'+(_0x59bfd2[_0x92e0('0x87')][_0x92e0('0x8d')]||'')};if(_0x5162a0[_0x92e0('0x5b')][_0x92e0('0x89')]&&_0x5162a0[_0x92e0('0x5b')]['messageId']&&_0x5162a0[_0x92e0('0x5b')]['threadId']!=_0x5162a0[_0x92e0('0x5b')]['messageId']){_0x36ffbf[_0x92e0('0x89')]=_0x5162a0[_0x92e0('0x5b')]['messageId'];}return _0x51352c[_0x92e0('0x8e')](_0x36ffbf);}else{return _0x51352c;}}})['then'](function(_0x2e5561){_0x59bfd2[_0x92e0('0x8f')]=_0x2e5561[_0x92e0('0x5c')]({'plain':!![]});_0x59bfd2[_0x92e0('0x8f')][_0x92e0('0x90')]=_0x1a790d;if(_0x59bfd2['interaction']['created']){if(_0x59bfd2[_0x92e0('0x81')]['autoclose']){_0x59bfd2['applications'][_0x92e0('0x91')]({'id':0x0,'priority':_0x59bfd2[_0x92e0('0x82')][_0x92e0('0x48')]+0x1,'app':_0x92e0('0x92'),'appdata':_0x92e0('0x93'),'interval':_0x92e0('0x94')});}}return db[_0x92e0('0x95')][_0x92e0('0x5a')]({'body':_0x5162a0['body']['body'],'OpenchannelAccountId':_0x5162a0[_0x92e0('0x59')]['id'],'OpenchannelInteractionId':_0x2e5561['id'],'direction':'in','ContactId':_0x59bfd2['contact']['id'],'AttachmentId':_0x5162a0['body'][_0x92e0('0x96')]});})[_0x92e0('0x32')](function(_0xf0ecd9){_0x59bfd2[_0x92e0('0x27')]=_0xf0ecd9;if(_0x59bfd2[_0x92e0('0x8f')][_0x92e0('0x97')]){return db[_0x92e0('0x98')][_0x92e0('0x61')]({'attributes':['id',_0x92e0('0x36')],'where':{'id':_0x59bfd2[_0x92e0('0x8f')][_0x92e0('0x97')]}})[_0x92e0('0x32')](function(_0x4e6a20){if(_0x4e6a20){_0x59bfd2[_0x92e0('0x82')]['unshift']({'id':0x0,'priority':0x0,'app':_0x92e0('0x99'),'appdata':_0x4e6a20[_0x92e0('0x36')]+','+(_0x59bfd2['account'][_0x92e0('0x9a')]||0xa),'interval':_0x92e0('0x94')});_0x59bfd2[_0x92e0('0x9b')]=![];}return respondWithRpcPromise(_0x92e0('0x9c'),_0x92e0('0x9d'),_0x59bfd2);});}return respondWithRpcPromise('Start',_0x92e0('0x9d'),_0x59bfd2);})['then'](function(_0xaddce3){respondWithRpcPromise('EventManager',_0x92e0('0x9e'),{'event':_0x92e0('0x9f'),'message':_0xaddce3},client9002);return _0xaddce3;})[_0x92e0('0x32')](respondWithResult(_0x333777,null))[_0x92e0('0x29')](handleError(_0x333777,null));};exports['addApplications']=function(_0x20de36,_0x1a6d5c,_0x296af2){return db[_0x92e0('0x3b')][_0x92e0('0x69')]({'where':{'id':_0x20de36[_0x92e0('0x59')]['id']}})[_0x92e0('0x32')](handleEntityNotFound(_0x1a6d5c,null))[_0x92e0('0x32')](function(_0x467a46){if(_0x467a46){return db[_0x92e0('0xa0')][_0x92e0('0xa1')](function(_0x14dc43){return db[_0x92e0('0xa2')][_0x92e0('0x35')]({'where':{'OpenchannelAccountId':_0x20de36[_0x92e0('0x59')]['id']},'transaction':_0x14dc43})[_0x92e0('0x32')](function(_0x5f559d){var _0x16700f=_[_0x92e0('0x41')](_0x20de36[_0x92e0('0x5b')],function(_0x3f6e5a){_0x3f6e5a[_0x92e0('0x65')]=_0x20de36[_0x92e0('0x59')]['id'];return _0x3f6e5a;});return db[_0x92e0('0xa2')]['bulkCreate'](_0x16700f,{'transaction':_0x14dc43});});})[_0x92e0('0x32')](function(){return db[_0x92e0('0xa2')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x20de36[_0x92e0('0x59')]['id']},'order':'priority'});});}})[_0x92e0('0x32')](respondWithResult(_0x1a6d5c,null))['catch'](handleError(_0x1a6d5c,null));};exports['getApplications']=function(_0x360350,_0xf17e1b,_0x107142){var _0x58b12c={};var _0x4be0a1={};var _0x4c679c;var _0x974a0a;return db[_0x92e0('0x3b')]['findOne']({'where':{'id':_0x360350[_0x92e0('0x59')]['id']}})[_0x92e0('0x32')](handleEntityNotFound(_0xf17e1b,null))[_0x92e0('0x32')](function(_0x247271){if(_0x247271){_0x4c679c=_0x247271;_0x4be0a1[_0x92e0('0x40')]=_['keys'](db[_0x92e0('0xa2')]['rawAttributes']);_0x4be0a1['query']=_[_0x92e0('0x42')](_0x360350[_0x92e0('0x45')]);_0x4be0a1[_0x92e0('0x43')]=_[_0x92e0('0x44')](_0x4be0a1[_0x92e0('0x40')],_0x4be0a1[_0x92e0('0x45')]);_0x58b12c[_0x92e0('0x46')]=_[_0x92e0('0x44')](_0x4be0a1[_0x92e0('0x40')],qs[_0x92e0('0x47')](_0x360350[_0x92e0('0x45')]['fields']));_0x58b12c[_0x92e0('0x46')]=_0x58b12c['attributes'][_0x92e0('0x48')]?_0x58b12c[_0x92e0('0x46')]:_0x4be0a1[_0x92e0('0x40')];_0x58b12c[_0x92e0('0x4c')]=qs[_0x92e0('0x4d')](_0x360350[_0x92e0('0x45')][_0x92e0('0x4d')]);_0x58b12c[_0x92e0('0x4e')]=qs[_0x92e0('0x43')](_[_0x92e0('0x4f')](_0x360350['query'],_0x4be0a1[_0x92e0('0x43')]));if(_0x360350['query']['filter']){_0x58b12c[_0x92e0('0x4e')]=_[_0x92e0('0x51')](_0x58b12c['where'],{'$or':_['map'](_0x58b12c[_0x92e0('0x46')],function(_0x51963c){var _0x515836={};_0x515836[_0x51963c]={'$like':'%'+_0x360350[_0x92e0('0x45')][_0x92e0('0x50')]+'%'};return _0x515836;})});}_0x58b12c=_[_0x92e0('0x51')]({},_0x58b12c,_0x360350[_0x92e0('0x53')]);return _0x4c679c[_0x92e0('0xa3')](_0x58b12c);}})[_0x92e0('0x32')](function(_0x4cf377){if(_0x4cf377){_0x974a0a=_0x4cf377[_0x92e0('0x48')];if(!_0x360350['query'][_0x92e0('0x49')](_0x92e0('0x4a'))){_0x58b12c['limit']=qs[_0x92e0('0x4b')](_0x360350['query'][_0x92e0('0x4b')]);_0x58b12c[_0x92e0('0x2e')]=qs[_0x92e0('0x2e')](_0x360350[_0x92e0('0x45')][_0x92e0('0x2e')]);}return _0x4c679c[_0x92e0('0xa3')](_0x58b12c);}})[_0x92e0('0x32')](function(_0x101368){if(_0x101368){return _0x101368?{'count':_0x974a0a,'rows':_0x101368}:null;}})[_0x92e0('0x32')](respondWithResult(_0xf17e1b,null))[_0x92e0('0x29')](handleError(_0xf17e1b,null));};exports[_0x92e0('0xa4')]=function(_0xfa016b,_0x2ad852,_0x1e2bb7){var _0x2dbde6={'raw':![],'where':{}};var _0x2aaf74={};var _0xb48ef8={'count':0x0,'rows':[]};return db[_0x92e0('0x3b')][_0x92e0('0x69')]({'where':{'id':_0xfa016b[_0x92e0('0x59')]['id']}})[_0x92e0('0x32')](handleEntityNotFound(_0x2ad852,null))[_0x92e0('0x32')](function(_0x853753){if(_0x853753){_0x2aaf74[_0x92e0('0x40')]=_[_0x92e0('0x42')](db[_0x92e0('0x8a')]['rawAttributes']);_0x2aaf74['query']=_[_0x92e0('0x42')](_0xfa016b[_0x92e0('0x45')]);_0x2aaf74[_0x92e0('0x43')]=_[_0x92e0('0x44')](_0x2aaf74[_0x92e0('0x40')],_0x2aaf74['query']);_0x2dbde6[_0x92e0('0x46')]=_[_0x92e0('0x44')](_0x2aaf74[_0x92e0('0x40')],qs[_0x92e0('0x47')](_0xfa016b[_0x92e0('0x45')][_0x92e0('0x47')]));_0x2dbde6[_0x92e0('0x46')]=_0x2dbde6[_0x92e0('0x46')][_0x92e0('0x48')]?_0x2dbde6['attributes']:_0x2aaf74[_0x92e0('0x40')];if(!_0xfa016b['query'][_0x92e0('0x49')](_0x92e0('0x4a'))){_0x2dbde6[_0x92e0('0x4b')]=qs[_0x92e0('0x4b')](_0xfa016b[_0x92e0('0x45')][_0x92e0('0x4b')]);_0x2dbde6[_0x92e0('0x2e')]=qs['offset'](_0xfa016b[_0x92e0('0x45')][_0x92e0('0x2e')]);}_0x2dbde6[_0x92e0('0x4c')]=qs[_0x92e0('0x4d')](_0xfa016b[_0x92e0('0x45')][_0x92e0('0x4d')]);_0x2dbde6[_0x92e0('0x4e')]=qs[_0x92e0('0x43')](_[_0x92e0('0x4f')](_0xfa016b['query'],_0x2aaf74['filters']));_0x2dbde6[_0x92e0('0x4e')][_0x92e0('0x65')]=_0x853753['id'];if(_0xfa016b[_0x92e0('0x45')][_0x92e0('0x50')]){_0x2dbde6[_0x92e0('0x4e')]=_[_0x92e0('0x51')](_0x2dbde6[_0x92e0('0x4e')],{'$or':_[_0x92e0('0x41')](_0x2dbde6[_0x92e0('0x46')],function(_0x5e57f8){var _0x479c1f={};_0x479c1f[_0x5e57f8]={'$like':'%'+_0xfa016b[_0x92e0('0x45')][_0x92e0('0x50')]+'%'};return _0x479c1f;})});}_0x2dbde6=_[_0x92e0('0x51')]({},_0x2dbde6,_0xfa016b['options']);return db['OpenchannelInteraction'][_0x92e0('0x2d')]({'where':_0x2dbde6[_0x92e0('0x4e')]})[_0x92e0('0x32')](function(_0x54359c){_0xb48ef8[_0x92e0('0x2d')]=_0x54359c;if(_0xfa016b[_0x92e0('0x45')][_0x92e0('0x54')]){_0x2dbde6[_0x92e0('0x55')]=[{'model':db[_0x92e0('0x6e')],'as':_0x92e0('0xa5'),'required':![]},{'model':db[_0x92e0('0x98')],'as':_0x92e0('0xa6'),'attributes':[_0x92e0('0x36'),_0x92e0('0xa7'),_0x92e0('0xa8')],'required':![]},{'model':db[_0x92e0('0xa9')],'as':_0x92e0('0xaa'),'attributes':['id',_0x92e0('0x36'),_0x92e0('0xab')],'where':_0xfa016b[_0x92e0('0x45')][_0x92e0('0xac')]?{'id':_0xfa016b[_0x92e0('0x45')][_0x92e0('0xac')]}:undefined,'required':_0xfa016b[_0x92e0('0x45')][_0x92e0('0xac')]?!![]:![]}];}return db[_0x92e0('0x8a')][_0x92e0('0x56')](_0x2dbde6);})[_0x92e0('0x32')](function(_0x522466){_0xb48ef8['rows']=_0x522466;return _0xb48ef8;});}})[_0x92e0('0x32')](respondWithFilteredResult(_0x2ad852,_0x2dbde6))['catch'](handleError(_0x2ad852,null));};exports[_0x92e0('0xad')]=function(_0x162066,_0x3f6c7c,_0x47c812){return db[_0x92e0('0x3b')][_0x92e0('0x61')]({'where':{'id':_0x162066['params']['id']}})['then'](handleEntityNotFound(_0x3f6c7c,null))[_0x92e0('0x32')](function(_0x457214){if(_0x457214){return _0x457214[_0x92e0('0xad')](_0x162066[_0x92e0('0x5b')][_0x92e0('0x6c')],_['omit'](_0x162066[_0x92e0('0x5b')],['ids','id'])||{})[_0x92e0('0x8c')](function(_0x24916c){for(var _0x22c541=0x0;_0x22c541<_0x162066[_0x92e0('0x5b')][_0x92e0('0x6c')][_0x92e0('0x48')];_0x22c541+=0x1){socket[_0x92e0('0xae')](_0x92e0('0xaf'),{'UserId':_0x162066[_0x92e0('0x5b')][_0x92e0('0x6c')][_0x22c541],'OpenchannelAccountId':_0x162066[_0x92e0('0x59')]['id']});}return _0x24916c;});}})[_0x92e0('0x32')](respondWithResult(_0x3f6c7c,null))['catch'](handleError(_0x3f6c7c,null));};exports['removeAgents']=function(_0x16dae6,_0x9b1ba5,_0x1caddc){return db[_0x92e0('0x3b')][_0x92e0('0x61')]({'where':{'id':_0x16dae6[_0x92e0('0x59')]['id']}})[_0x92e0('0x32')](handleEntityNotFound(_0x9b1ba5,null))[_0x92e0('0x32')](function(_0x1b7d42){if(_0x1b7d42){return _0x1b7d42['removeAgents'](_0x16dae6[_0x92e0('0x45')][_0x92e0('0x6c')])['then'](function(){if(_[_0x92e0('0xb0')](_0x16dae6['query'][_0x92e0('0x6c')])){for(var _0x1cb1c7=0x0;_0x1cb1c7<_0x16dae6[_0x92e0('0x45')]['ids']['length'];_0x1cb1c7+=0x1){socket[_0x92e0('0xae')](_0x92e0('0xb1'),{'UserId':Number(_0x16dae6[_0x92e0('0x45')][_0x92e0('0x6c')][_0x1cb1c7]),'OpenchannelAccountId':Number(_0x16dae6[_0x92e0('0x59')]['id'])});}}else{socket[_0x92e0('0xae')](_0x92e0('0xb1'),{'UserId':Number(_0x16dae6[_0x92e0('0x45')][_0x92e0('0x6c')]),'OpenchannelAccountId':Number(_0x16dae6[_0x92e0('0x59')]['id'])});}});}})[_0x92e0('0x32')](respondWithStatusCode(_0x9b1ba5,null))[_0x92e0('0x29')](handleError(_0x9b1ba5,null));};exports[_0x92e0('0xb2')]=function(_0x5cc096,_0x5b3edd,_0x35ba17){var _0x4b39f9={};var _0x4eddc3={};var _0xd568c4;var _0x1ff56f;return db['OpenchannelAccount'][_0x92e0('0x69')]({'where':{'id':_0x5cc096[_0x92e0('0x59')]['id']}})[_0x92e0('0x32')](handleEntityNotFound(_0x5b3edd,null))[_0x92e0('0x32')](function(_0x540f72){if(_0x540f72){_0xd568c4=_0x540f72;_0x4eddc3['model']=_[_0x92e0('0x42')](db[_0x92e0('0x98')][_0x92e0('0x3c')]);_0x4eddc3['query']=_[_0x92e0('0x42')](_0x5cc096[_0x92e0('0x45')]);_0x4eddc3[_0x92e0('0x43')]=_['intersection'](_0x4eddc3[_0x92e0('0x40')],_0x4eddc3['query']);_0x4b39f9['attributes']=_['intersection'](_0x4eddc3[_0x92e0('0x40')],qs[_0x92e0('0x47')](_0x5cc096['query'][_0x92e0('0x47')]));_0x4b39f9['attributes']=_0x4b39f9['attributes'][_0x92e0('0x48')]?_0x4b39f9[_0x92e0('0x46')]:_0x4eddc3[_0x92e0('0x40')];_0x4b39f9['order']=qs['sort'](_0x5cc096[_0x92e0('0x45')]['sort']);_0x4b39f9['where']=qs[_0x92e0('0x43')](_['pick'](_0x5cc096[_0x92e0('0x45')],_0x4eddc3['filters']));if(_0x5cc096[_0x92e0('0x45')]['filter']){_0x4b39f9[_0x92e0('0x4e')]=_[_0x92e0('0x51')](_0x4b39f9['where'],{'$or':_[_0x92e0('0x41')](_0x4b39f9[_0x92e0('0x46')],function(_0x4c9996){var _0xe5356b={};_0xe5356b[_0x4c9996]={'$like':'%'+_0x5cc096[_0x92e0('0x45')][_0x92e0('0x50')]+'%'};return _0xe5356b;})});}_0x4b39f9=_[_0x92e0('0x51')]({},_0x4b39f9,_0x5cc096[_0x92e0('0x53')]);return _0xd568c4['getAgents'](_0x4b39f9);}})['then'](function(_0x23e57e){if(_0x23e57e){_0x1ff56f=_0x23e57e[_0x92e0('0x48')];if(!_0x5cc096[_0x92e0('0x45')][_0x92e0('0x49')](_0x92e0('0x4a'))){_0x4b39f9[_0x92e0('0x4b')]=qs['limit'](_0x5cc096[_0x92e0('0x45')][_0x92e0('0x4b')]);_0x4b39f9[_0x92e0('0x2e')]=qs[_0x92e0('0x2e')](_0x5cc096['query'][_0x92e0('0x2e')]);}return _0xd568c4[_0x92e0('0xb2')](_0x4b39f9);}})[_0x92e0('0x32')](function(_0x5bdfad){if(_0x5bdfad){return _0x5bdfad?{'count':_0x1ff56f,'rows':_0x5bdfad}:null;}})[_0x92e0('0x32')](respondWithResult(_0x5b3edd,null))[_0x92e0('0x29')](handleError(_0x5b3edd,null));};exports['send']=function(_0x41b9c2,_0x3ce654,_0xbaa2c0){var _0x1739f3,_0xe28088,_0x3beb31;if(_[_0x92e0('0x77')](_0x41b9c2[_0x92e0('0x5b')][_0x92e0('0x5b')])||_0x41b9c2[_0x92e0('0x5b')][_0x92e0('0x5b')]===''){throw new db[(_0x92e0('0x70'))][(_0x92e0('0x71'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x92e0('0x77')](_0x41b9c2['body']['to'])){}_0x1739f3=_0x41b9c2['body']['to'];return db[_0x92e0('0x3b')][_0x92e0('0x69')]({'where':{'id':_0x41b9c2[_0x92e0('0x59')]['id']}})[_0x92e0('0x32')](handleEntityNotFound(_0x3ce654,null))[_0x92e0('0x32')](function(_0x2eec8e){if(_0x2eec8e){return db[_0x92e0('0x3b')]['find']({'where':{'id':_0x2eec8e['id']},'include':[{'model':db[_0x92e0('0xb3')],'as':_0x92e0('0x7e'),'include':[{'model':db[_0x92e0('0x6e')],'as':_0x92e0('0x86'),'where':{[_0x2eec8e['mapKey']]:_0x1739f3},'limit':0x1,'order':[[_0x92e0('0x75'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x3ce654,null))[_0x92e0('0x32')](function(_0x37f7bd){if(_0x37f7bd&&_0x37f7bd['List']){_0xe28088=_0x37f7bd[_0x92e0('0x5c')]({'plain':!![]});if(_0xe28088['List']&&_0xe28088['List']['Contacts'][_0x92e0('0x48')]){return _0xe28088['List'][_0x92e0('0x86')][0x0];}return db['CmContact'][_0x92e0('0x5a')](_['defaults'](_0x41b9c2[_0x92e0('0x5b')],{'firstName':_0x1739f3,[_0x37f7bd[_0x92e0('0x7c')]]:_0x1739f3,'phone':_0x1739f3,'ListId':_0xe28088[_0x92e0('0x76')]}));}})['then'](handleEntityNotFound(_0x3ce654,null))['then'](function(_0x58dd3f){if(_0x58dd3f){_0x3beb31=_0x58dd3f;return db[_0x92e0('0x8a')][_0x92e0('0x61')]({'where':{'ContactId':_0x3beb31['id'],'closed':![],'OpenchannelAccountId':_0xe28088['id']}})[_0x92e0('0x32')](function(_0x3a28c4){if(_0x3a28c4){return[_0x3a28c4,![]];}return db[_0x92e0('0x8a')][_0x92e0('0x5a')]({'UserId':_0x41b9c2['user']['id'],'ContactId':_0x3beb31['id'],'OpenchannelAccountId':_0xe28088['id'],'lastMsgDirection':_0x92e0('0xb4'),'Messages':[_['merge'](_0x41b9c2[_0x92e0('0x5b')],{'read':![],'body':_0x41b9c2['body'][_0x92e0('0x5b')],'OpenchannelAccountId':_0xe28088['id'],'UserId':_0x41b9c2[_0x92e0('0x5f')]['id'],'ContactId':_0x3beb31['id']})]},{'include':[{'model':db[_0x92e0('0x95')],'as':_0x92e0('0xb5')}]})['then'](function(_0x12227f){return[_0x12227f,!![]];});});}})[_0x92e0('0x8c')](function(_0x3cb8a8,_0x1c2d9a){if(_0x1c2d9a){return _0x3cb8a8;}return db[_0x92e0('0x95')][_0x92e0('0x5a')](_[_0x92e0('0x51')](_0x41b9c2[_0x92e0('0x5b')],{'read':![],'body':_0x41b9c2['body'][_0x92e0('0x5b')],'OpenchannelAccountId':_0xe28088['id'],'OpenchannelInteractionId':_0x3cb8a8['id'],'UserId':_0x41b9c2[_0x92e0('0x5f')]['id'],'ContactId':_0x3beb31['id']}))['then'](function(_0x201998){_0x3cb8a8[_0x92e0('0xb6')][_0x92e0('0xb5')]=[];_0x3cb8a8[_0x92e0('0xb6')][_0x92e0('0xb5')][_0x92e0('0x91')](_0x201998[_0x92e0('0xb6')]);return _0x3cb8a8;});});}})[_0x92e0('0x32')](respondWithResult(_0x3ce654,null))['catch'](handleError(_0x3ce654,null));}; \ No newline at end of file +var _0xbee9=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpenchannelAccountId','Disposition','findOne','nolimit','order','findAll','rows','ids','getAnswers','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','Applications','account','list','applications','priority','asc','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','options','getInteractions','Owner','fullname','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','Messages','dataValues','html-pdf','rimraf','request-promise','moment','bluebird','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','params','keys','includeAll','include'];(function(_0x4e6bd9,_0x3e5d9f){var _0x479e81=function(_0x4a1e9e){while(--_0x4a1e9e){_0x4e6bd9['push'](_0x4e6bd9['shift']());}};_0x479e81(++_0x3e5d9f);}(_0xbee9,0x117));var _0x9bee=function(_0x35349a,_0x4f6a7b){_0x35349a=_0x35349a-0x0;var _0x3f1c82=_0xbee9[_0x35349a];return _0x3f1c82;};'use strict';var pdf=require(_0x9bee('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9bee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9bee('0x2'));var moment=require(_0x9bee('0x3'));var BPromise=require(_0x9bee('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9bee('0x5'));var sox=require(_0x9bee('0x6'));var csv=require(_0x9bee('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x9bee('0x8'));var crypto=require(_0x9bee('0x9'));var jsforce=require(_0x9bee('0xa'));var deskjs=require(_0x9bee('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9bee('0xc'));var Redis=require(_0x9bee('0xd'));var authService=require(_0x9bee('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9bee('0xf'));var hardwareService=require(_0x9bee('0x10'));var logger=require('../../config/logger')(_0x9bee('0x11'));var utils=require(_0x9bee('0x12'));var config=require(_0x9bee('0x13'));var licenseUtil=require(_0x9bee('0x14'));var db=require(_0x9bee('0x15'))['db'];config[_0x9bee('0x16')]=_[_0x9bee('0x17')](config[_0x9bee('0x16')],{'host':_0x9bee('0x18'),'port':0x18eb});var socket=require(_0x9bee('0x19'))(new Redis(config[_0x9bee('0x16')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x9bee('0x1a')]({'port':0x232c});var client9002=jayson['client'][_0x9bee('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x147bcb,_0x21c846,_0x473bcc,_0x3aa5a7){return new BPromise(function(_0x48715d,_0x3bbf00){var _0x35d46b=_0x3aa5a7||client;return _0x35d46b[_0x9bee('0x1b')](_0x147bcb,_0x473bcc)[_0x9bee('0x1c')](function(_0x10d5ea){logger[_0x9bee('0x1d')](_0x9bee('0x1e'),_0x21c846,_0x9bee('0x1f'));logger[_0x9bee('0x20')](_0x9bee('0x21'),_0x21c846,_0x9bee('0x1f'),JSON[_0x9bee('0x22')](_0x10d5ea));if(_0x10d5ea[_0x9bee('0x23')]){if(_0x10d5ea['error']['code']===0x1f4){logger['error'](_0x9bee('0x1e'),_0x21c846,_0x10d5ea[_0x9bee('0x23')]['message']);return _0x3bbf00(_0x10d5ea[_0x9bee('0x23')][_0x9bee('0x24')]);}logger[_0x9bee('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x21c846,_0x10d5ea['error']['message']);return _0x48715d(_0x10d5ea[_0x9bee('0x23')][_0x9bee('0x24')]);}else{logger[_0x9bee('0x1d')]('OpenchannelAccount,\x20%s,\x20%s',_0x21c846,_0x9bee('0x1f'));_0x48715d(_0x10d5ea['result'][_0x9bee('0x24')]);}})[_0x9bee('0x25')](function(_0x442232){logger[_0x9bee('0x23')](_0x9bee('0x1e'),_0x21c846,_0x442232);_0x3bbf00(_0x442232);});});}function respondWithStatusCode(_0x5512a3,_0x1f63b1){_0x1f63b1=_0x1f63b1||0xcc;return function(_0x39d824){if(_0x39d824){return _0x5512a3['sendStatus'](_0x1f63b1);}return _0x5512a3[_0x9bee('0x26')](_0x1f63b1)[_0x9bee('0x27')]();};}function respondWithResult(_0x836fb0,_0x1d9d70){_0x1d9d70=_0x1d9d70||0xc8;return function(_0x4758b3){if(_0x4758b3){return _0x836fb0['status'](_0x1d9d70)[_0x9bee('0x28')](_0x4758b3);}};}function respondWithFilteredResult(_0x1d6109,_0x53821e){return function(_0x508f0b){if(_0x508f0b){var _0x21eb2a=_0x508f0b[_0x9bee('0x29')],_0x510ecb=_0x53821e[_0x9bee('0x2a')],_0x55ca7e=_0x53821e[_0x9bee('0x2a')]+_0x53821e[_0x9bee('0x2b')],_0x57d693;if(_0x55ca7e>=_0x21eb2a){_0x55ca7e=_0x21eb2a;_0x57d693=0xc8;}else{_0x57d693=0xce;}_0x1d6109['status'](_0x57d693);return _0x1d6109[_0x9bee('0x2c')](_0x9bee('0x2d'),_0x510ecb+'-'+_0x55ca7e+'/'+_0x21eb2a)[_0x9bee('0x28')](_0x508f0b);}return null;};}function patchUpdates(_0x469ce3){return function(_0x565c0a){try{jsonpatch['apply'](_0x565c0a,_0x469ce3,!![]);}catch(_0x10ca48){return BPromise[_0x9bee('0x2e')](_0x10ca48);}return _0x565c0a['save']();};}function saveUpdates(_0x221702,_0x36265d){return function(_0x13155b){if(_0x13155b){return _0x13155b[_0x9bee('0x2f')](_0x221702)[_0x9bee('0x1c')](function(_0x48d6ec){return _0x48d6ec;});}return null;};}function removeEntity(_0x36318a,_0x1129cf){return function(_0x56dcd1){if(_0x56dcd1){return _0x56dcd1[_0x9bee('0x30')]()['then'](function(){var _0x285187=_0x56dcd1['get']({'plain':!![]});var _0x5bd26a=_0x9bee('0x31');return db[_0x9bee('0x32')][_0x9bee('0x30')]({'where':{'type':_0x5bd26a,'resourceId':_0x285187['id']}})['then'](function(){return _0x56dcd1;});})['then'](function(){_0x36318a[_0x9bee('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cd9f6,_0x5ce4a6){return function(_0x340bdc){if(!_0x340bdc){_0x2cd9f6[_0x9bee('0x33')](0x194);}return _0x340bdc;};}function handleError(_0x179ce6,_0x5eede4){_0x5eede4=_0x5eede4||0x1f4;return function(_0x95de06){logger[_0x9bee('0x23')](_0x95de06[_0x9bee('0x34')]);if(_0x95de06[_0x9bee('0x35')]){delete _0x95de06[_0x9bee('0x35')];}_0x179ce6[_0x9bee('0x26')](_0x5eede4)[_0x9bee('0x36')](_0x95de06);};}exports[_0x9bee('0x37')]=function(_0x1ab769,_0x2e2d21){var _0x5eb006={'include':[{'model':db['Pause'],'as':_0x9bee('0x38')}]},_0x7f8952={},_0x1cd2d9={'count':0x0,'rows':[]};var _0x4d406b=_[_0x9bee('0x39')](db[_0x9bee('0x3a')][_0x9bee('0x3b')],function(_0x48298a){return{'name':_0x48298a[_0x9bee('0x3c')],'type':_0x48298a[_0x9bee('0x3d')][_0x9bee('0x3e')]};});_0x7f8952[_0x9bee('0x3f')]=_[_0x9bee('0x39')](_0x4d406b,_0x9bee('0x35'));_0x7f8952[_0x9bee('0x40')]=_['keys'](_0x1ab769[_0x9bee('0x40')]);_0x7f8952[_0x9bee('0x41')]=_[_0x9bee('0x42')](_0x7f8952['model'],_0x7f8952[_0x9bee('0x40')]);_0x5eb006[_0x9bee('0x43')]=_['intersection'](_0x7f8952[_0x9bee('0x3f')],qs[_0x9bee('0x44')](_0x1ab769[_0x9bee('0x40')][_0x9bee('0x44')]));_0x5eb006[_0x9bee('0x43')]=_0x5eb006['attributes'][_0x9bee('0x45')]?_0x5eb006[_0x9bee('0x43')]:_0x7f8952[_0x9bee('0x3f')];if(!_0x1ab769[_0x9bee('0x40')][_0x9bee('0x46')]('nolimit')){_0x5eb006[_0x9bee('0x2b')]=qs[_0x9bee('0x2b')](_0x1ab769['query']['limit']);_0x5eb006[_0x9bee('0x2a')]=qs[_0x9bee('0x2a')](_0x1ab769['query'][_0x9bee('0x2a')]);}_0x5eb006['order']=qs['sort'](_0x1ab769[_0x9bee('0x40')][_0x9bee('0x47')]);_0x5eb006[_0x9bee('0x48')]=qs[_0x9bee('0x41')](_[_0x9bee('0x49')](_0x1ab769[_0x9bee('0x40')],_0x7f8952[_0x9bee('0x41')]),_0x4d406b);if(_0x1ab769[_0x9bee('0x40')][_0x9bee('0x4a')]){_0x5eb006['where']=_['merge'](_0x5eb006['where'],{'$or':_[_0x9bee('0x39')](_0x4d406b,function(_0x2beaa3){if(_0x2beaa3[_0x9bee('0x3d')]!==_0x9bee('0x4b')){var _0x19de25={};_0x19de25[_0x2beaa3[_0x9bee('0x35')]]={'$like':'%'+_0x1ab769[_0x9bee('0x40')][_0x9bee('0x4a')]+'%'};return _0x19de25;}})});}_0x5eb006=_[_0x9bee('0x4c')]({},_0x5eb006,_0x1ab769['options']);var _0x2d91f7={'where':_0x5eb006[_0x9bee('0x48')]};return db[_0x9bee('0x3a')][_0x9bee('0x29')](_0x2d91f7)[_0x9bee('0x1c')](function(_0x8a50a1){_0x1cd2d9['count']=_0x8a50a1;if(_0x1ab769[_0x9bee('0x40')]['includeAll']){_0x5eb006['include']=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x5eb006);})['then'](function(_0x22372f){_0x1cd2d9['rows']=_0x22372f;return _0x1cd2d9;})[_0x9bee('0x1c')](respondWithFilteredResult(_0x2e2d21,_0x5eb006))[_0x9bee('0x25')](handleError(_0x2e2d21,null));};exports['show']=function(_0x270922,_0x47e9ad){var _0x546240={'raw':![],'where':{'id':_0x270922[_0x9bee('0x4d')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2a9e77={};_0x2a9e77[_0x9bee('0x3f')]=_[_0x9bee('0x4e')](db[_0x9bee('0x3a')][_0x9bee('0x3b')]);_0x2a9e77[_0x9bee('0x40')]=_[_0x9bee('0x4e')](_0x270922[_0x9bee('0x40')]);_0x2a9e77[_0x9bee('0x41')]=_['intersection'](_0x2a9e77[_0x9bee('0x3f')],_0x2a9e77[_0x9bee('0x40')]);_0x546240[_0x9bee('0x43')]=_[_0x9bee('0x42')](_0x2a9e77['model'],qs['fields'](_0x270922[_0x9bee('0x40')][_0x9bee('0x44')]));_0x546240[_0x9bee('0x43')]=_0x546240[_0x9bee('0x43')][_0x9bee('0x45')]?_0x546240[_0x9bee('0x43')]:_0x2a9e77[_0x9bee('0x3f')];if(_0x270922[_0x9bee('0x40')][_0x9bee('0x4f')]){_0x546240[_0x9bee('0x50')]=[{'all':!![]}];}_0x546240=_['merge']({},_0x546240,_0x270922['options']);return db[_0x9bee('0x3a')]['find'](_0x546240)[_0x9bee('0x1c')](handleEntityNotFound(_0x47e9ad,null))['then'](respondWithResult(_0x47e9ad,null))[_0x9bee('0x25')](handleError(_0x47e9ad,null));};exports['create']=function(_0x292584,_0x571052){return db[_0x9bee('0x3a')][_0x9bee('0x51')](_0x292584['body'],{})[_0x9bee('0x1c')](function(_0x33aacb){var _0x10d7ae=_0x292584[_0x9bee('0x52')]['get']({'plain':!![]});if(!_0x10d7ae)throw new Error(_0x9bee('0x53'));if(_0x10d7ae[_0x9bee('0x54')]==='user'){var _0xfae0ea=_0x33aacb[_0x9bee('0x55')]({'plain':!![]});var _0x338db0='OpenchannelAccounts';return db['UserProfileSection'][_0x9bee('0x56')]({'where':{'name':_0x338db0,'userProfileId':_0x10d7ae['userProfileId']},'raw':!![]})[_0x9bee('0x1c')](function(_0x3020bf){if(_0x3020bf&&_0x3020bf[_0x9bee('0x57')]===0x0){return db[_0x9bee('0x32')][_0x9bee('0x51')]({'name':_0xfae0ea[_0x9bee('0x35')],'resourceId':_0xfae0ea['id'],'type':_0x3020bf[_0x9bee('0x35')],'sectionId':_0x3020bf['id']},{})['then'](function(){return _0x33aacb;});}else{return _0x33aacb;}})[_0x9bee('0x25')](function(_0x58a334){logger[_0x9bee('0x23')](_0x9bee('0x58'),_0x58a334);throw _0x58a334;});}return _0x33aacb;})[_0x9bee('0x1c')](respondWithResult(_0x571052,0xc9))['catch'](handleError(_0x571052,null));};exports['update']=function(_0x59dd70,_0x5a326b){if(_0x59dd70[_0x9bee('0x59')]['id']){delete _0x59dd70[_0x9bee('0x59')]['id'];}return db[_0x9bee('0x3a')]['find']({'where':{'id':_0x59dd70[_0x9bee('0x4d')]['id']},'include':[{'model':db['Pause'],'as':_0x9bee('0x38')}]})['then'](handleEntityNotFound(_0x5a326b,null))[_0x9bee('0x1c')](saveUpdates(_0x59dd70[_0x9bee('0x59')],null))[_0x9bee('0x1c')](respondWithResult(_0x5a326b,null))[_0x9bee('0x25')](handleError(_0x5a326b,null));};exports[_0x9bee('0x30')]=function(_0x299895,_0x5e8684){return db[_0x9bee('0x3a')]['find']({'where':{'id':_0x299895[_0x9bee('0x4d')]['id']}})[_0x9bee('0x1c')](handleEntityNotFound(_0x5e8684,null))[_0x9bee('0x1c')](removeEntity(_0x5e8684,null))['catch'](handleError(_0x5e8684,null));};exports[_0x9bee('0x5a')]=function(_0x3a4f7b,_0x5f0dd8){return db['OpenchannelAccount'][_0x9bee('0x5a')]()[_0x9bee('0x1c')](respondWithResult(_0x5f0dd8,null))[_0x9bee('0x25')](handleError(_0x5f0dd8,null));};exports[_0x9bee('0x5b')]=function(_0x1c1dc5,_0x4a2f60,_0x56141a){if(_0x1c1dc5[_0x9bee('0x59')]['id']){delete _0x1c1dc5[_0x9bee('0x59')]['id'];}return db['OpenchannelAccount'][_0x9bee('0x56')]({'where':{'id':_0x1c1dc5['params']['id']}})[_0x9bee('0x1c')](handleEntityNotFound(_0x4a2f60,null))['then'](function(_0xc98fb8){if(_0xc98fb8){_0x1c1dc5[_0x9bee('0x59')][_0x9bee('0x5c')]=_0xc98fb8['id'];return db[_0x9bee('0x5d')][_0x9bee('0x51')](_0x1c1dc5[_0x9bee('0x59')]);}})[_0x9bee('0x1c')](respondWithResult(_0x4a2f60,null))[_0x9bee('0x25')](handleError(_0x4a2f60,null));};exports['getDispositions']=function(_0x2b5fbc,_0x1e1d7,_0x2dbfd9){var _0x1e333b={'raw':![],'where':{}};var _0x4d0f65={};var _0x1bba61={'count':0x0,'rows':[]};return db[_0x9bee('0x3a')][_0x9bee('0x5e')]({'where':{'id':_0x2b5fbc['params']['id']}})[_0x9bee('0x1c')](handleEntityNotFound(_0x1e1d7,null))[_0x9bee('0x1c')](function(_0x108fb7){if(_0x108fb7){_0x4d0f65[_0x9bee('0x3f')]=_[_0x9bee('0x4e')](db[_0x9bee('0x5d')][_0x9bee('0x3b')]);_0x4d0f65[_0x9bee('0x40')]=_['keys'](_0x2b5fbc[_0x9bee('0x40')]);_0x4d0f65[_0x9bee('0x41')]=_['intersection'](_0x4d0f65[_0x9bee('0x3f')],_0x4d0f65[_0x9bee('0x40')]);_0x1e333b[_0x9bee('0x43')]=_['intersection'](_0x4d0f65[_0x9bee('0x3f')],qs[_0x9bee('0x44')](_0x2b5fbc[_0x9bee('0x40')]['fields']));_0x1e333b[_0x9bee('0x43')]=_0x1e333b[_0x9bee('0x43')][_0x9bee('0x45')]?_0x1e333b[_0x9bee('0x43')]:_0x4d0f65['model'];if(!_0x2b5fbc['query'][_0x9bee('0x46')](_0x9bee('0x5f'))){_0x1e333b[_0x9bee('0x2b')]=qs['limit'](_0x2b5fbc[_0x9bee('0x40')][_0x9bee('0x2b')]);_0x1e333b[_0x9bee('0x2a')]=qs[_0x9bee('0x2a')](_0x2b5fbc[_0x9bee('0x40')][_0x9bee('0x2a')]);}_0x1e333b[_0x9bee('0x60')]=qs[_0x9bee('0x47')](_0x2b5fbc[_0x9bee('0x40')][_0x9bee('0x47')]);_0x1e333b[_0x9bee('0x48')]=qs[_0x9bee('0x41')](_['pick'](_0x2b5fbc['query'],_0x4d0f65[_0x9bee('0x41')]));_0x1e333b['where'][_0x9bee('0x5c')]=_0x108fb7['id'];if(_0x2b5fbc[_0x9bee('0x40')][_0x9bee('0x4a')]){_0x1e333b[_0x9bee('0x48')]=_[_0x9bee('0x4c')](_0x1e333b[_0x9bee('0x48')],{'$or':_['map'](_0x1e333b[_0x9bee('0x43')],function(_0x3b808e){var _0xdd8aa4={};_0xdd8aa4[_0x3b808e]={'$like':'%'+_0x2b5fbc[_0x9bee('0x40')][_0x9bee('0x4a')]+'%'};return _0xdd8aa4;})});}_0x1e333b=_['merge']({},_0x1e333b,_0x2b5fbc['options']);return db['Disposition'][_0x9bee('0x29')]({'where':_0x1e333b[_0x9bee('0x48')]})[_0x9bee('0x1c')](function(_0x9f2c38){_0x1bba61[_0x9bee('0x29')]=_0x9f2c38;if(_0x2b5fbc[_0x9bee('0x40')][_0x9bee('0x4f')]){_0x1e333b[_0x9bee('0x50')]=[{'all':!![]}];}return db[_0x9bee('0x5d')][_0x9bee('0x61')](_0x1e333b);})['then'](function(_0x3a2305){_0x1bba61[_0x9bee('0x62')]=_0x3a2305;return _0x1bba61;});}})[_0x9bee('0x1c')](respondWithFilteredResult(_0x1e1d7,_0x1e333b))[_0x9bee('0x25')](handleError(_0x1e1d7,null));};exports['removeDispositions']=function(_0x40e4b8,_0x5273c6,_0xa27ae){return db[_0x9bee('0x3a')]['find']({'where':{'id':_0x40e4b8[_0x9bee('0x4d')]['id']}})[_0x9bee('0x1c')](handleEntityNotFound(_0x5273c6,null))['then'](function(_0x1561e3){if(_0x1561e3){return _0x1561e3['removeDispositions'](_0x40e4b8['query'][_0x9bee('0x63')]);}})['then'](respondWithStatusCode(_0x5273c6,null))[_0x9bee('0x25')](handleError(_0x5273c6,null));};exports['addAnswer']=function(_0x203790,_0x5110f0,_0x12776c){if(_0x203790[_0x9bee('0x59')]['id']){delete _0x203790['body']['id'];}return db[_0x9bee('0x3a')][_0x9bee('0x56')]({'where':{'id':_0x203790[_0x9bee('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5110f0,null))[_0x9bee('0x1c')](function(_0x1d36d4){if(_0x1d36d4){_0x203790[_0x9bee('0x59')][_0x9bee('0x5c')]=_0x1d36d4['id'];return db['CannedAnswer'][_0x9bee('0x51')](_0x203790['body']);}})[_0x9bee('0x1c')](respondWithResult(_0x5110f0,null))[_0x9bee('0x25')](handleError(_0x5110f0,null));};exports[_0x9bee('0x64')]=function(_0x527114,_0x789a8c,_0x3d7ddc){var _0x141034={'raw':![],'where':{}};var _0xe015c1={};var _0x40b5be={'count':0x0,'rows':[]};return db[_0x9bee('0x3a')]['findOne']({'where':{'id':_0x527114[_0x9bee('0x4d')]['id']}})[_0x9bee('0x1c')](handleEntityNotFound(_0x789a8c,null))[_0x9bee('0x1c')](function(_0x198a8b){if(_0x198a8b){_0xe015c1[_0x9bee('0x3f')]=_[_0x9bee('0x4e')](db['CannedAnswer']['rawAttributes']);_0xe015c1['query']=_[_0x9bee('0x4e')](_0x527114['query']);_0xe015c1['filters']=_['intersection'](_0xe015c1[_0x9bee('0x3f')],_0xe015c1[_0x9bee('0x40')]);_0x141034[_0x9bee('0x43')]=_[_0x9bee('0x42')](_0xe015c1['model'],qs[_0x9bee('0x44')](_0x527114[_0x9bee('0x40')][_0x9bee('0x44')]));_0x141034[_0x9bee('0x43')]=_0x141034['attributes']['length']?_0x141034[_0x9bee('0x43')]:_0xe015c1[_0x9bee('0x3f')];if(!_0x527114['query'][_0x9bee('0x46')](_0x9bee('0x5f'))){_0x141034[_0x9bee('0x2b')]=qs[_0x9bee('0x2b')](_0x527114[_0x9bee('0x40')][_0x9bee('0x2b')]);_0x141034[_0x9bee('0x2a')]=qs[_0x9bee('0x2a')](_0x527114[_0x9bee('0x40')]['offset']);}_0x141034['order']=qs[_0x9bee('0x47')](_0x527114[_0x9bee('0x40')][_0x9bee('0x47')]);_0x141034[_0x9bee('0x48')]=qs[_0x9bee('0x41')](_[_0x9bee('0x49')](_0x527114[_0x9bee('0x40')],_0xe015c1['filters']));_0x141034['where'][_0x9bee('0x5c')]=_0x198a8b['id'];if(_0x527114[_0x9bee('0x40')][_0x9bee('0x4a')]){_0x141034['where']=_[_0x9bee('0x4c')](_0x141034['where'],{'$or':_[_0x9bee('0x39')](_0x141034['attributes'],function(_0x147173){var _0x26dc62={};_0x26dc62[_0x147173]={'$like':'%'+_0x527114[_0x9bee('0x40')][_0x9bee('0x4a')]+'%'};return _0x26dc62;})});}_0x141034=_[_0x9bee('0x4c')]({},_0x141034,_0x527114['options']);return db[_0x9bee('0x65')]['count']({'where':_0x141034['where']})[_0x9bee('0x1c')](function(_0x492ccb){_0x40b5be[_0x9bee('0x29')]=_0x492ccb;if(_0x527114[_0x9bee('0x40')][_0x9bee('0x4f')]){_0x141034[_0x9bee('0x50')]=[{'all':!![]}];}return db[_0x9bee('0x65')][_0x9bee('0x61')](_0x141034);})[_0x9bee('0x1c')](function(_0x11dc75){_0x40b5be[_0x9bee('0x62')]=_0x11dc75;return _0x40b5be;});}})[_0x9bee('0x1c')](respondWithFilteredResult(_0x789a8c,_0x141034))['catch'](handleError(_0x789a8c,null));};exports[_0x9bee('0x66')]=function(_0x2096da,_0x15ef73,_0x6b96f8){return db[_0x9bee('0x3a')][_0x9bee('0x56')]({'where':{'id':_0x2096da[_0x9bee('0x4d')]['id']}})[_0x9bee('0x1c')](handleEntityNotFound(_0x15ef73,null))[_0x9bee('0x1c')](function(_0x225abe){if(_0x225abe){return _0x225abe[_0x9bee('0x66')](_0x2096da[_0x9bee('0x40')][_0x9bee('0x63')]);}})[_0x9bee('0x1c')](respondWithStatusCode(_0x15ef73,null))[_0x9bee('0x25')](handleError(_0x15ef73,null));};exports[_0x9bee('0x67')]=function(_0xc46327,_0x31a321,_0x5a427e){var _0x1906a1={'body':_0xc46327[_0x9bee('0x59')],'channel':_0x9bee('0x68')};var _0x4e9adb=[];var _0xb230ca=[];var _0x3baff8={};var _0x7a58c5=![];return db[_0x9bee('0x69')][_0x9bee('0x5a')]()[_0x9bee('0x1c')](function(_0x547eee){if(!_0x547eee){throw new db[(_0x9bee('0x6a'))][(_0x9bee('0x6b'))](_0x9bee('0x6c'));}_0x4e9adb=_['difference'](_[_0x9bee('0x4e')](_0x547eee),[_0x9bee('0x6d'),_0x9bee('0x6e')]);_0xb230ca=_[_0x9bee('0x6f')](_['keys'](_0x547eee),[_0x9bee('0x6d'),_0x9bee('0x6e'),_0x9bee('0x70'),_0x9bee('0x71')]);if(_0xc46327[_0x9bee('0x59')]['id']){delete _0xc46327[_0x9bee('0x59')]['id'];}if(_[_0x9bee('0x72')](_0xc46327[_0x9bee('0x59')][_0x9bee('0x73')])){throw new db['Sequelize'][(_0x9bee('0x6b'))](_0x9bee('0x74'));}if(_[_0x9bee('0x72')](_0xc46327[_0x9bee('0x59')]['body'])||_0xc46327[_0x9bee('0x59')][_0x9bee('0x59')]===''){throw new db[(_0x9bee('0x6a'))][(_0x9bee('0x6b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9bee('0x72')](_0xc46327[_0x9bee('0x59')][_0x9bee('0x75')])){throw new db['Sequelize']['ValidationError'](_0x9bee('0x76')+_0xb230ca);}if(!_[_0x9bee('0x77')](_0xb230ca,_0xc46327['body'][_0x9bee('0x75')])){throw new db[(_0x9bee('0x6a'))][(_0x9bee('0x6b'))](_0x9bee('0x78')+_0xb230ca);}_0x3baff8[_0xc46327[_0x9bee('0x59')][_0x9bee('0x75')]]=_0xc46327[_0x9bee('0x59')][_0x9bee('0x73')];})['then'](function(){return db[_0x9bee('0x3a')][_0x9bee('0x56')]({'where':{'id':_0xc46327[_0x9bee('0x4d')]['id']},'include':[{'model':db['CmList'],'as':_0x9bee('0x79'),'include':[{'model':db['CmContact'],'as':_0x9bee('0x7a'),'where':_0x3baff8,'limit':0x1,'order':[[_0x9bee('0x6e'),_0x9bee('0x7b')]]}]},{'model':db[_0x9bee('0x7c')],'as':_0x9bee('0x7d')}]});})['then'](handleEntityNotFound(_0x31a321,null))[_0x9bee('0x1c')](function(_0x25f1cc){if(_0x25f1cc&&_0x25f1cc[_0x9bee('0x79')]){_0x1906a1[_0x9bee('0x7e')]=_0x25f1cc;_0x1906a1['applications']=_0x25f1cc[_0x9bee('0x7d')];_0x1906a1[_0x9bee('0x7f')]=_0x25f1cc[_0x9bee('0x79')];_0x1906a1[_0x9bee('0x80')]=_['orderBy'](_0x1906a1['applications'],[_0x9bee('0x81')],[_0x9bee('0x82')]);if(_0x1906a1[_0x9bee('0x7e')][_0x9bee('0x7d')]){delete _0x1906a1['account'][_0x9bee('0x7d')];}if(_0x1906a1[_0x9bee('0x7e')][_0x9bee('0x79')]&&_0x1906a1['account']['List'][_0x9bee('0x7a')][_0x9bee('0x45')]){return _0x1906a1['account'][_0x9bee('0x79')][_0x9bee('0x7a')][0x0];}var _0x35d4e3=_[_0x9bee('0x17')](_0xc46327[_0x9bee('0x59')],{'firstName':_0xc46327[_0x9bee('0x59')][_0x9bee('0x73')],'ListId':_0x25f1cc[_0x9bee('0x71')]});_0x35d4e3[_0xc46327[_0x9bee('0x59')][_0x9bee('0x75')]]=_0xc46327[_0x9bee('0x59')][_0x9bee('0x73')];return db['CmContact']['create'](_0x35d4e3,{'fields':_0x4e9adb,'raw':!![]});}})[_0x9bee('0x1c')](handleEntityNotFound(_0x31a321,null))[_0x9bee('0x1c')](function(_0x6f3065){_0x1906a1['contact']=_0x6f3065;if(_0x6f3065){var _0x2fdfeb={'ContactId':_0x6f3065['id'],'OpenchannelAccountId':_0xc46327[_0x9bee('0x4d')]['id'],'from':(_0x6f3065[_0x9bee('0x83')]||'')+'\x20'+(_0x6f3065['lastName']||'')};var _0x3edbce={'OpenchannelAccountId':_0xc46327[_0x9bee('0x4d')]['id'],'closed':![]};if(_0xc46327[_0x9bee('0x59')][_0x9bee('0x84')]){_0x3edbce['threadId']=_0xc46327['body'][_0x9bee('0x84')];return db[_0x9bee('0x85')][_0x9bee('0x56')]({'where':_0x3edbce})[_0x9bee('0x1c')](function(_0x582e9e){if(_0x582e9e){return[_0x582e9e,![]];}_0x2fdfeb[_0x9bee('0x84')]=_0xc46327[_0x9bee('0x59')][_0x9bee('0x84')];_0x2fdfeb[_0x9bee('0x86')]=_0xc46327[_0x9bee('0x59')][_0x9bee('0x86')];return db[_0x9bee('0x85')][_0x9bee('0x51')](_0x2fdfeb)[_0x9bee('0x1c')](function(_0x201f45){return[_0x201f45,!![]];});});}else{_0x3edbce[_0x9bee('0x84')]=null;}_0x3edbce[_0x9bee('0x87')]=_0x6f3065['id'];return db['OpenchannelInteraction'][_0x9bee('0x56')]({'where':_0x3edbce})[_0x9bee('0x1c')](function(_0xeadcc){if(_0xeadcc){return[_0xeadcc,![]];}return db[_0x9bee('0x85')]['create'](_0x2fdfeb)['then'](function(_0x5d0394){return[_0x5d0394,!![]];});});}})[_0x9bee('0x88')](function(_0x46d9a8,_0x58c126){if(_0x46d9a8){_0x7a58c5=_0x58c126;if(!_0x58c126){var _0x3f14da={'from':(_0x1906a1[_0x9bee('0x89')][_0x9bee('0x83')]||'')+'\x20'+(_0x1906a1[_0x9bee('0x89')]['lastName']||'')};if(_0xc46327['body']['threadId']&&_0xc46327[_0x9bee('0x59')][_0x9bee('0x8a')]&&_0xc46327[_0x9bee('0x59')]['threadId']!=_0xc46327[_0x9bee('0x59')]['messageId']){_0x3f14da[_0x9bee('0x84')]=_0xc46327[_0x9bee('0x59')]['messageId'];}return _0x46d9a8['update'](_0x3f14da);}else{return _0x46d9a8;}}})[_0x9bee('0x1c')](function(_0x1b1dce){_0x1906a1[_0x9bee('0x8b')]=_0x1b1dce['get']({'plain':!![]});_0x1906a1[_0x9bee('0x8b')][_0x9bee('0x8c')]=_0x7a58c5;if(_0x1906a1[_0x9bee('0x8b')][_0x9bee('0x8c')]){if(_0x1906a1[_0x9bee('0x7e')][_0x9bee('0x8d')]){_0x1906a1['applications'][_0x9bee('0x8e')]({'id':0x0,'priority':_0x1906a1[_0x9bee('0x80')][_0x9bee('0x45')]+0x1,'app':_0x9bee('0x8f'),'appdata':_0x9bee('0x90'),'interval':_0x9bee('0x91')});}}return db[_0x9bee('0x92')]['create']({'body':_0xc46327[_0x9bee('0x59')][_0x9bee('0x59')],'OpenchannelAccountId':_0xc46327[_0x9bee('0x4d')]['id'],'OpenchannelInteractionId':_0x1b1dce['id'],'direction':'in','ContactId':_0x1906a1[_0x9bee('0x89')]['id'],'AttachmentId':_0xc46327[_0x9bee('0x59')][_0x9bee('0x93')]});})[_0x9bee('0x1c')](function(_0x264c36){_0x1906a1[_0x9bee('0x24')]=_0x264c36;if(_0x1906a1[_0x9bee('0x8b')][_0x9bee('0x94')]){return db[_0x9bee('0x95')][_0x9bee('0x56')]({'attributes':['id',_0x9bee('0x35')],'where':{'id':_0x1906a1['interaction'][_0x9bee('0x94')]}})[_0x9bee('0x1c')](function(_0x47598d){if(_0x47598d){_0x1906a1['applications'][_0x9bee('0x96')]({'id':0x0,'priority':0x0,'app':_0x9bee('0x97'),'appdata':_0x47598d['name']+','+(_0x1906a1['account'][_0x9bee('0x98')]||0xa),'interval':_0x9bee('0x91')});_0x1906a1[_0x9bee('0x99')]=![];}return respondWithRpcPromise(_0x9bee('0x9a'),_0x9bee('0x9b'),_0x1906a1);});}return respondWithRpcPromise(_0x9bee('0x9a'),_0x9bee('0x9b'),_0x1906a1);})['then'](function(_0x3d0def){respondWithRpcPromise(_0x9bee('0x9c'),'EventManager',{'event':_0x9bee('0x67'),'message':_0x3d0def},client9002);return _0x3d0def;})[_0x9bee('0x1c')](respondWithResult(_0x31a321,null))[_0x9bee('0x25')](handleError(_0x31a321,null));};exports[_0x9bee('0x9d')]=function(_0x2d5788,_0x49c055,_0x259433){return db[_0x9bee('0x3a')][_0x9bee('0x5e')]({'where':{'id':_0x2d5788[_0x9bee('0x4d')]['id']}})[_0x9bee('0x1c')](handleEntityNotFound(_0x49c055,null))['then'](function(_0x4501cb){if(_0x4501cb){return db[_0x9bee('0x9e')][_0x9bee('0x9f')](function(_0xf38931){return db[_0x9bee('0x7c')][_0x9bee('0x30')]({'where':{'OpenchannelAccountId':_0x2d5788[_0x9bee('0x4d')]['id']},'transaction':_0xf38931})[_0x9bee('0x1c')](function(_0x34c7a5){var _0xde9347=_[_0x9bee('0x39')](_0x2d5788[_0x9bee('0x59')],function(_0x1b50de){_0x1b50de[_0x9bee('0x5c')]=_0x2d5788[_0x9bee('0x4d')]['id'];return _0x1b50de;});return db[_0x9bee('0x7c')][_0x9bee('0xa0')](_0xde9347,{'transaction':_0xf38931});});})[_0x9bee('0x1c')](function(){return db[_0x9bee('0x7c')][_0x9bee('0xa1')]({'where':{'OpenchannelAccountId':_0x2d5788[_0x9bee('0x4d')]['id']},'order':_0x9bee('0x81')});});}})[_0x9bee('0x1c')](respondWithResult(_0x49c055,null))[_0x9bee('0x25')](handleError(_0x49c055,null));};exports[_0x9bee('0xa2')]=function(_0x3cd18c,_0x3d7e51,_0x526e11){var _0x128b3d={};var _0x2b0d64={};var _0x700d54;var _0x4a0fde;return db[_0x9bee('0x3a')][_0x9bee('0x5e')]({'where':{'id':_0x3cd18c[_0x9bee('0x4d')]['id']}})[_0x9bee('0x1c')](handleEntityNotFound(_0x3d7e51,null))[_0x9bee('0x1c')](function(_0xe6c168){if(_0xe6c168){_0x700d54=_0xe6c168;_0x2b0d64[_0x9bee('0x3f')]=_[_0x9bee('0x4e')](db[_0x9bee('0x7c')][_0x9bee('0x3b')]);_0x2b0d64['query']=_['keys'](_0x3cd18c[_0x9bee('0x40')]);_0x2b0d64['filters']=_['intersection'](_0x2b0d64[_0x9bee('0x3f')],_0x2b0d64[_0x9bee('0x40')]);_0x128b3d['attributes']=_['intersection'](_0x2b0d64[_0x9bee('0x3f')],qs[_0x9bee('0x44')](_0x3cd18c['query'][_0x9bee('0x44')]));_0x128b3d[_0x9bee('0x43')]=_0x128b3d[_0x9bee('0x43')][_0x9bee('0x45')]?_0x128b3d[_0x9bee('0x43')]:_0x2b0d64[_0x9bee('0x3f')];_0x128b3d[_0x9bee('0x60')]=qs['sort'](_0x3cd18c[_0x9bee('0x40')][_0x9bee('0x47')]);_0x128b3d['where']=qs[_0x9bee('0x41')](_[_0x9bee('0x49')](_0x3cd18c[_0x9bee('0x40')],_0x2b0d64[_0x9bee('0x41')]));if(_0x3cd18c[_0x9bee('0x40')][_0x9bee('0x4a')]){_0x128b3d[_0x9bee('0x48')]=_[_0x9bee('0x4c')](_0x128b3d[_0x9bee('0x48')],{'$or':_[_0x9bee('0x39')](_0x128b3d['attributes'],function(_0x1176f3){var _0x28a71f={};_0x28a71f[_0x1176f3]={'$like':'%'+_0x3cd18c[_0x9bee('0x40')][_0x9bee('0x4a')]+'%'};return _0x28a71f;})});}_0x128b3d=_['merge']({},_0x128b3d,_0x3cd18c[_0x9bee('0xa3')]);return _0x700d54[_0x9bee('0xa2')](_0x128b3d);}})[_0x9bee('0x1c')](function(_0x378f09){if(_0x378f09){_0x4a0fde=_0x378f09[_0x9bee('0x45')];if(!_0x3cd18c['query']['hasOwnProperty'](_0x9bee('0x5f'))){_0x128b3d[_0x9bee('0x2b')]=qs[_0x9bee('0x2b')](_0x3cd18c[_0x9bee('0x40')][_0x9bee('0x2b')]);_0x128b3d[_0x9bee('0x2a')]=qs['offset'](_0x3cd18c[_0x9bee('0x40')]['offset']);}return _0x700d54[_0x9bee('0xa2')](_0x128b3d);}})['then'](function(_0x3c7364){if(_0x3c7364){return _0x3c7364?{'count':_0x4a0fde,'rows':_0x3c7364}:null;}})[_0x9bee('0x1c')](respondWithResult(_0x3d7e51,null))[_0x9bee('0x25')](handleError(_0x3d7e51,null));};exports[_0x9bee('0xa4')]=function(_0x59c603,_0x298b5c,_0x599831){var _0x3e07f3={'raw':![],'where':{}};var _0x1033e9={};var _0xf6af8e={'count':0x0,'rows':[]};return db[_0x9bee('0x3a')][_0x9bee('0x5e')]({'where':{'id':_0x59c603[_0x9bee('0x4d')]['id']}})['then'](handleEntityNotFound(_0x298b5c,null))['then'](function(_0xbea6e4){if(_0xbea6e4){_0x1033e9[_0x9bee('0x3f')]=_[_0x9bee('0x4e')](db[_0x9bee('0x85')][_0x9bee('0x3b')]);_0x1033e9[_0x9bee('0x40')]=_[_0x9bee('0x4e')](_0x59c603[_0x9bee('0x40')]);_0x1033e9['filters']=_[_0x9bee('0x42')](_0x1033e9[_0x9bee('0x3f')],_0x1033e9[_0x9bee('0x40')]);_0x3e07f3[_0x9bee('0x43')]=_[_0x9bee('0x42')](_0x1033e9['model'],qs['fields'](_0x59c603[_0x9bee('0x40')][_0x9bee('0x44')]));_0x3e07f3['attributes']=_0x3e07f3[_0x9bee('0x43')][_0x9bee('0x45')]?_0x3e07f3[_0x9bee('0x43')]:_0x1033e9[_0x9bee('0x3f')];if(!_0x59c603[_0x9bee('0x40')][_0x9bee('0x46')](_0x9bee('0x5f'))){_0x3e07f3[_0x9bee('0x2b')]=qs[_0x9bee('0x2b')](_0x59c603['query'][_0x9bee('0x2b')]);_0x3e07f3[_0x9bee('0x2a')]=qs[_0x9bee('0x2a')](_0x59c603[_0x9bee('0x40')]['offset']);}_0x3e07f3[_0x9bee('0x60')]=qs[_0x9bee('0x47')](_0x59c603[_0x9bee('0x40')][_0x9bee('0x47')]);_0x3e07f3[_0x9bee('0x48')]=qs[_0x9bee('0x41')](_[_0x9bee('0x49')](_0x59c603[_0x9bee('0x40')],_0x1033e9[_0x9bee('0x41')]));_0x3e07f3[_0x9bee('0x48')][_0x9bee('0x5c')]=_0xbea6e4['id'];if(_0x59c603[_0x9bee('0x40')][_0x9bee('0x4a')]){_0x3e07f3[_0x9bee('0x48')]=_['merge'](_0x3e07f3[_0x9bee('0x48')],{'$or':_[_0x9bee('0x39')](_0x3e07f3['attributes'],function(_0x620cad){var _0x14b94c={};_0x14b94c[_0x620cad]={'$like':'%'+_0x59c603[_0x9bee('0x40')]['filter']+'%'};return _0x14b94c;})});}_0x3e07f3=_['merge']({},_0x3e07f3,_0x59c603[_0x9bee('0xa3')]);return db[_0x9bee('0x85')]['count']({'where':_0x3e07f3[_0x9bee('0x48')]})[_0x9bee('0x1c')](function(_0x52a711){_0xf6af8e[_0x9bee('0x29')]=_0x52a711;if(_0x59c603[_0x9bee('0x40')]['includeAll']){_0x3e07f3[_0x9bee('0x50')]=[{'model':db[_0x9bee('0x69')],'as':'Contact','required':![]},{'model':db[_0x9bee('0x95')],'as':_0x9bee('0xa5'),'attributes':['name',_0x9bee('0xa6'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x9bee('0xa7'),'attributes':['id',_0x9bee('0x35'),'color'],'where':_0x59c603[_0x9bee('0x40')][_0x9bee('0xa8')]?{'id':_0x59c603['query'][_0x9bee('0xa8')]}:undefined,'required':_0x59c603[_0x9bee('0x40')][_0x9bee('0xa8')]?!![]:![]}];}return db[_0x9bee('0x85')][_0x9bee('0x61')](_0x3e07f3);})['then'](function(_0x3865a4){_0xf6af8e[_0x9bee('0x62')]=_0x3865a4;return _0xf6af8e;});}})['then'](respondWithFilteredResult(_0x298b5c,_0x3e07f3))[_0x9bee('0x25')](handleError(_0x298b5c,null));};exports[_0x9bee('0xa9')]=function(_0x3ca27b,_0x2996df,_0x5e815a){return db[_0x9bee('0x3a')]['find']({'where':{'id':_0x3ca27b['params']['id']}})['then'](handleEntityNotFound(_0x2996df,null))[_0x9bee('0x1c')](function(_0x2b05d1){if(_0x2b05d1){return _0x2b05d1[_0x9bee('0xa9')](_0x3ca27b[_0x9bee('0x59')]['ids'],_[_0x9bee('0xaa')](_0x3ca27b['body'],[_0x9bee('0x63'),'id'])||{})['spread'](function(_0x5b061a){for(var _0x34a44c=0x0;_0x34a44c<_0x3ca27b[_0x9bee('0x59')][_0x9bee('0x63')][_0x9bee('0x45')];_0x34a44c+=0x1){socket[_0x9bee('0xab')](_0x9bee('0xac'),{'UserId':_0x3ca27b[_0x9bee('0x59')][_0x9bee('0x63')][_0x34a44c],'OpenchannelAccountId':_0x3ca27b[_0x9bee('0x4d')]['id']});}return _0x5b061a;});}})[_0x9bee('0x1c')](respondWithResult(_0x2996df,null))['catch'](handleError(_0x2996df,null));};exports[_0x9bee('0xad')]=function(_0x561e71,_0x4e7079,_0x9b9436){return db[_0x9bee('0x3a')][_0x9bee('0x56')]({'where':{'id':_0x561e71['params']['id']}})[_0x9bee('0x1c')](handleEntityNotFound(_0x4e7079,null))[_0x9bee('0x1c')](function(_0x5a0437){if(_0x5a0437){return _0x5a0437[_0x9bee('0xad')](_0x561e71['query']['ids'])[_0x9bee('0x1c')](function(){if(_['isArray'](_0x561e71[_0x9bee('0x40')][_0x9bee('0x63')])){for(var _0xaa1701=0x0;_0xaa1701<_0x561e71[_0x9bee('0x40')]['ids'][_0x9bee('0x45')];_0xaa1701+=0x1){socket[_0x9bee('0xab')](_0x9bee('0xae'),{'UserId':Number(_0x561e71[_0x9bee('0x40')][_0x9bee('0x63')][_0xaa1701]),'OpenchannelAccountId':Number(_0x561e71['params']['id'])});}}else{socket['emit'](_0x9bee('0xae'),{'UserId':Number(_0x561e71['query'][_0x9bee('0x63')]),'OpenchannelAccountId':Number(_0x561e71[_0x9bee('0x4d')]['id'])});}});}})[_0x9bee('0x1c')](respondWithStatusCode(_0x4e7079,null))['catch'](handleError(_0x4e7079,null));};exports['getAgents']=function(_0x23de30,_0x41b0c8,_0x470087){var _0x296372={};var _0x508690={};var _0x2846a4;var _0x586121;return db['OpenchannelAccount'][_0x9bee('0x5e')]({'where':{'id':_0x23de30[_0x9bee('0x4d')]['id']}})[_0x9bee('0x1c')](handleEntityNotFound(_0x41b0c8,null))[_0x9bee('0x1c')](function(_0x24a20b){if(_0x24a20b){_0x2846a4=_0x24a20b;_0x508690[_0x9bee('0x3f')]=_[_0x9bee('0x4e')](db[_0x9bee('0x95')][_0x9bee('0x3b')]);_0x508690['query']=_[_0x9bee('0x4e')](_0x23de30['query']);_0x508690[_0x9bee('0x41')]=_[_0x9bee('0x42')](_0x508690[_0x9bee('0x3f')],_0x508690[_0x9bee('0x40')]);_0x296372[_0x9bee('0x43')]=_[_0x9bee('0x42')](_0x508690['model'],qs[_0x9bee('0x44')](_0x23de30[_0x9bee('0x40')][_0x9bee('0x44')]));_0x296372['attributes']=_0x296372['attributes'][_0x9bee('0x45')]?_0x296372[_0x9bee('0x43')]:_0x508690[_0x9bee('0x3f')];_0x296372[_0x9bee('0x60')]=qs['sort'](_0x23de30[_0x9bee('0x40')][_0x9bee('0x47')]);_0x296372[_0x9bee('0x48')]=qs[_0x9bee('0x41')](_[_0x9bee('0x49')](_0x23de30[_0x9bee('0x40')],_0x508690[_0x9bee('0x41')]));if(_0x23de30['query'][_0x9bee('0x4a')]){_0x296372['where']=_[_0x9bee('0x4c')](_0x296372['where'],{'$or':_[_0x9bee('0x39')](_0x296372[_0x9bee('0x43')],function(_0x2dead3){var _0x37a0a2={};_0x37a0a2[_0x2dead3]={'$like':'%'+_0x23de30[_0x9bee('0x40')][_0x9bee('0x4a')]+'%'};return _0x37a0a2;})});}_0x296372=_[_0x9bee('0x4c')]({},_0x296372,_0x23de30[_0x9bee('0xa3')]);return _0x2846a4['getAgents'](_0x296372);}})['then'](function(_0x256d37){if(_0x256d37){_0x586121=_0x256d37[_0x9bee('0x45')];if(!_0x23de30['query'][_0x9bee('0x46')]('nolimit')){_0x296372[_0x9bee('0x2b')]=qs[_0x9bee('0x2b')](_0x23de30[_0x9bee('0x40')][_0x9bee('0x2b')]);_0x296372['offset']=qs[_0x9bee('0x2a')](_0x23de30[_0x9bee('0x40')]['offset']);}return _0x2846a4[_0x9bee('0xaf')](_0x296372);}})[_0x9bee('0x1c')](function(_0x406919){if(_0x406919){return _0x406919?{'count':_0x586121,'rows':_0x406919}:null;}})[_0x9bee('0x1c')](respondWithResult(_0x41b0c8,null))['catch'](handleError(_0x41b0c8,null));};exports[_0x9bee('0x36')]=function(_0xdb28e2,_0x1ce53f,_0x2d38bd){var _0x4b1767,_0x17a5a3,_0x276f25;if(_[_0x9bee('0x72')](_0xdb28e2[_0x9bee('0x59')]['body'])||_0xdb28e2['body']['body']===''){throw new db['Sequelize']['ValidationError'](_0x9bee('0xb0'));}if(_[_0x9bee('0x72')](_0xdb28e2[_0x9bee('0x59')]['to'])){}_0x4b1767=_0xdb28e2['body']['to'];return db[_0x9bee('0x3a')]['findOne']({'where':{'id':_0xdb28e2[_0x9bee('0x4d')]['id']}})[_0x9bee('0x1c')](handleEntityNotFound(_0x1ce53f,null))[_0x9bee('0x1c')](function(_0x4b1402){if(_0x4b1402){return db[_0x9bee('0x3a')][_0x9bee('0x56')]({'where':{'id':_0x4b1402['id']},'include':[{'model':db[_0x9bee('0xb1')],'as':_0x9bee('0x79'),'include':[{'model':db[_0x9bee('0x69')],'as':'Contacts','where':{[_0x4b1402[_0x9bee('0x75')]]:_0x4b1767},'limit':0x1,'order':[[_0x9bee('0x6e'),'DESC']]}]}]})[_0x9bee('0x1c')](handleEntityNotFound(_0x1ce53f,null))[_0x9bee('0x1c')](function(_0x3f09dc){if(_0x3f09dc&&_0x3f09dc[_0x9bee('0x79')]){_0x17a5a3=_0x3f09dc[_0x9bee('0x55')]({'plain':!![]});if(_0x17a5a3[_0x9bee('0x79')]&&_0x17a5a3[_0x9bee('0x79')][_0x9bee('0x7a')][_0x9bee('0x45')]){return _0x17a5a3[_0x9bee('0x79')]['Contacts'][0x0];}return db[_0x9bee('0x69')][_0x9bee('0x51')](_[_0x9bee('0x17')](_0xdb28e2[_0x9bee('0x59')],{'firstName':_0x4b1767,[_0x3f09dc[_0x9bee('0x75')]]:_0x4b1767,'phone':_0x4b1767,'ListId':_0x17a5a3[_0x9bee('0x71')]}));}})['then'](handleEntityNotFound(_0x1ce53f,null))['then'](function(_0x988492){if(_0x988492){_0x276f25=_0x988492;return db['OpenchannelInteraction'][_0x9bee('0x56')]({'where':{'ContactId':_0x276f25['id'],'closed':![],'OpenchannelAccountId':_0x17a5a3['id']}})[_0x9bee('0x1c')](function(_0x40cfb3){if(_0x40cfb3){return[_0x40cfb3,![]];}return db[_0x9bee('0x85')]['create']({'UserId':_0xdb28e2[_0x9bee('0x52')]['id'],'ContactId':_0x276f25['id'],'OpenchannelAccountId':_0x17a5a3['id'],'lastMsgDirection':'out','Messages':[_[_0x9bee('0x4c')](_0xdb28e2[_0x9bee('0x59')],{'read':![],'body':_0xdb28e2['body'][_0x9bee('0x59')],'OpenchannelAccountId':_0x17a5a3['id'],'UserId':_0xdb28e2['user']['id'],'ContactId':_0x276f25['id']})]},{'include':[{'model':db[_0x9bee('0x92')],'as':_0x9bee('0xb2')}]})[_0x9bee('0x1c')](function(_0x5757b1){return[_0x5757b1,!![]];});});}})[_0x9bee('0x88')](function(_0x430c13,_0x260535){if(_0x260535){return _0x430c13;}return db[_0x9bee('0x92')]['create'](_[_0x9bee('0x4c')](_0xdb28e2[_0x9bee('0x59')],{'read':![],'body':_0xdb28e2[_0x9bee('0x59')][_0x9bee('0x59')],'OpenchannelAccountId':_0x17a5a3['id'],'OpenchannelInteractionId':_0x430c13['id'],'UserId':_0xdb28e2[_0x9bee('0x52')]['id'],'ContactId':_0x276f25['id']}))[_0x9bee('0x1c')](function(_0x15a893){_0x430c13[_0x9bee('0xb3')][_0x9bee('0xb2')]=[];_0x430c13[_0x9bee('0xb3')][_0x9bee('0xb2')][_0x9bee('0x8e')](_0x15a893['dataValues']);return _0x430c13;});});}})[_0x9bee('0x1c')](respondWithResult(_0x1ce53f,null))[_0x9bee('0x25')](handleError(_0x1ce53f,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 98bc541..ca234a5 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 _0xb008=['setMaxListeners','update','remove','emit','exports','events'];(function(_0x327072,_0x404b51){var _0x2235fb=function(_0x291b3b){while(--_0x291b3b){_0x327072['push'](_0x327072['shift']());}};_0x2235fb(++_0x404b51);}(_0xb008,0x155));var _0x8b00=function(_0x4af1fb,_0x34bad1){_0x4af1fb=_0x4af1fb-0x0;var _0x1ad4e3=_0xb008[_0x4af1fb];return _0x1ad4e3;};'use strict';var EventEmitter=require(_0x8b00('0x0'));var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8b00('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8b00('0x2'),'afterDestroy':_0x8b00('0x3')};function emitEvent(_0x14d38f){return function(_0x2781a1,_0x542897,_0x5f2de7){OpenchannelAccountEvents['emit'](_0x14d38f+':'+_0x2781a1['id'],_0x2781a1);OpenchannelAccountEvents[_0x8b00('0x4')](_0x14d38f,_0x2781a1);_0x5f2de7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x8b00('0x5')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xf1e4=['save','remove','emit','hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0x4a973e,_0x29034b){var _0x36b56e=function(_0x1f992a){while(--_0x1f992a){_0x4a973e['push'](_0x4a973e['shift']());}};_0x36b56e(++_0x29034b);}(_0xf1e4,0x140));var _0x4f1e=function(_0x2832c8,_0x1d3ade){_0x2832c8=_0x2832c8-0x0;var _0x55d535=_0xf1e4[_0x2832c8];return _0x55d535;};'use strict';var EventEmitter=require(_0x4f1e('0x0'));var OpenchannelAccount=require(_0x4f1e('0x1'))['db'][_0x4f1e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x4f1e('0x3')](0x0);var events={'afterCreate':_0x4f1e('0x4'),'afterUpdate':'update','afterDestroy':_0x4f1e('0x5')};function emitEvent(_0x29830c){return function(_0x2fa63e,_0x3af84b,_0x35cdef){OpenchannelAccountEvents[_0x4f1e('0x6')](_0x29830c+':'+_0x2fa63e['id'],_0x2fa63e);OpenchannelAccountEvents['emit'](_0x29830c,_0x2fa63e);_0x35cdef(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x4f1e('0x7')](e,emitEvent(event));}}module[_0x4f1e('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 1555cbe..97e02c1 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 _0x6d46=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x31dd6f,_0x483c94){var _0xf855e9=function(_0x436fe9){while(--_0x436fe9){_0x31dd6f['push'](_0x31dd6f['shift']());}};_0xf855e9(++_0x483c94);}(_0x6d46,0x72));var _0x66d4=function(_0x15c818,_0x22bc5a){_0x15c818=_0x15c818-0x0;var _0x26c610=_0x6d46[_0x15c818];return _0x26c610;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x66d4('0x0'))(_0x66d4('0x1'));var moment=require(_0x66d4('0x2'));var BPromise=require('bluebird');var rp=require(_0x66d4('0x3'));var fs=require('fs');var path=require(_0x66d4('0x4'));var rimraf=require(_0x66d4('0x5'));var config=require(_0x66d4('0x6'));var attributes=require(_0x66d4('0x7'));module[_0x66d4('0x8')]=function(_0x48342e,_0x1c56fd){return _0x48342e[_0x66d4('0x9')](_0x66d4('0xa'),attributes,{'tableName':_0x66d4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91f4=['exports','define','openchannel_accounts','util','bluebird','path'];(function(_0x17f04f,_0x17ddbd){var _0x212ed3=function(_0x394434){while(--_0x394434){_0x17f04f['push'](_0x17f04f['shift']());}};_0x212ed3(++_0x17ddbd);}(_0x91f4,0xc9));var _0x491f=function(_0xbbce09,_0x1f07d9){_0xbbce09=_0xbbce09-0x0;var _0x529b3f=_0x91f4[_0xbbce09];return _0x529b3f;};'use strict';var _=require('lodash');var util=require(_0x491f('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x491f('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x491f('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelAccount.attributes');module[_0x491f('0x3')]=function(_0x54d45c,_0x37df6a){return _0x54d45c[_0x491f('0x4')]('OpenchannelAccount',attributes,{'tableName':_0x491f('0x5'),'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 a1a0d37..b226c3e 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 _0x7bc1=['message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x38f3ac,_0x26d08f){var _0x2f484c=function(_0x3ff0e6){while(--_0x3ff0e6){_0x38f3ac['push'](_0x38f3ac['shift']());}};_0x2f484c(++_0x26d08f);}(_0x7bc1,0x113));var _0x17bc=function(_0x56a106,_0xdd347c){_0x56a106=_0x56a106-0x0;var _0xb202d9=_0x7bc1[_0x56a106];return _0xb202d9;};'use strict';var _=require(_0x17bc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x17bc('0x1'));var rs=require(_0x17bc('0x2'));var fs=require('fs');var Redis=require(_0x17bc('0x3'));var db=require(_0x17bc('0x4'))['db'];var utils=require(_0x17bc('0x5'));var logger=require(_0x17bc('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x17bc('0x7'));var client=jayson[_0x17bc('0x8')][_0x17bc('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x17bc('0xa')],{'host':_0x17bc('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x285ae7,_0x5c3773,_0x30e0ec){return new BPromise(function(_0x421fd5,_0xaf9641){return client[_0x17bc('0xc')](_0x285ae7,_0x30e0ec)[_0x17bc('0xd')](function(_0x4ee6a6){logger[_0x17bc('0xe')](_0x17bc('0xf'),_0x5c3773,'request\x20sent');logger['debug'](_0x17bc('0x10'),_0x5c3773,'request\x20sent',JSON['stringify'](_0x4ee6a6));if(_0x4ee6a6[_0x17bc('0x11')]){if(_0x4ee6a6[_0x17bc('0x11')][_0x17bc('0x12')]===0x1f4){logger[_0x17bc('0x11')](_0x17bc('0xf'),_0x5c3773,_0x4ee6a6[_0x17bc('0x11')][_0x17bc('0x13')]);return _0xaf9641(_0x4ee6a6[_0x17bc('0x11')][_0x17bc('0x13')]);}logger[_0x17bc('0x11')](_0x17bc('0xf'),_0x5c3773,_0x4ee6a6[_0x17bc('0x11')][_0x17bc('0x13')]);return _0x421fd5(_0x4ee6a6[_0x17bc('0x11')][_0x17bc('0x13')]);}else{logger[_0x17bc('0xe')](_0x17bc('0xf'),_0x5c3773,'request\x20sent');_0x421fd5(_0x4ee6a6['result'][_0x17bc('0x13')]);}})[_0x17bc('0x14')](function(_0x2e9429){logger[_0x17bc('0x11')](_0x17bc('0xf'),_0x5c3773,_0x2e9429);_0xaf9641(_0x2e9429);});});} \ No newline at end of file +var _0x234c=['rpc','../../config/environment','jayson/promise','client','redis','localhost','./openchannelAccount.socket','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x234c,0x9b));var _0xc234=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x234c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc234('0x0'));var util=require(_0xc234('0x1'));var moment=require('moment');var BPromise=require(_0xc234('0x2'));var rs=require(_0xc234('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc234('0x4'))['db'];var utils=require(_0xc234('0x5'));var logger=require(_0xc234('0x6'))(_0xc234('0x7'));var config=require(_0xc234('0x8'));var jayson=require(_0xc234('0x9'));var client=jayson[_0xc234('0xa')]['http']({'port':0x232a});config[_0xc234('0xb')]=_['defaults'](config[_0xc234('0xb')],{'host':_0xc234('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc234('0xb')]));require(_0xc234('0xd'))['register'](socket);function respondWithRpcPromise(_0x245a32,_0xad1ba7,_0x5741b3){return new BPromise(function(_0x45edd2,_0x466922){return client[_0xc234('0xe')](_0x245a32,_0x5741b3)[_0xc234('0xf')](function(_0x1f8384){logger[_0xc234('0x10')](_0xc234('0x11'),_0xad1ba7,_0xc234('0x12'));logger[_0xc234('0x13')](_0xc234('0x14'),_0xad1ba7,_0xc234('0x12'),JSON[_0xc234('0x15')](_0x1f8384));if(_0x1f8384[_0xc234('0x16')]){if(_0x1f8384[_0xc234('0x16')][_0xc234('0x17')]===0x1f4){logger['error'](_0xc234('0x11'),_0xad1ba7,_0x1f8384[_0xc234('0x16')]['message']);return _0x466922(_0x1f8384[_0xc234('0x16')][_0xc234('0x18')]);}logger['error'](_0xc234('0x11'),_0xad1ba7,_0x1f8384[_0xc234('0x16')]['message']);return _0x45edd2(_0x1f8384[_0xc234('0x16')][_0xc234('0x18')]);}else{logger['info'](_0xc234('0x11'),_0xad1ba7,_0xc234('0x12'));_0x45edd2(_0x1f8384[_0xc234('0x19')]['message']);}})[_0xc234('0x1a')](function(_0x24a5e8){logger[_0xc234('0x16')](_0xc234('0x11'),_0xad1ba7,_0x24a5e8);_0x466922(_0x24a5e8);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 837f77c..dbd5323 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 _0xa4fa=['update','emit','removeListener','register','openchannelAccount:','save','remove'];(function(_0x2170e5,_0x112ef8){var _0x224343=function(_0x32c50){while(--_0x32c50){_0x2170e5['push'](_0x2170e5['shift']());}};_0x224343(++_0x112ef8);}(_0xa4fa,0x1a2));var _0xaa4f=function(_0x3c8452,_0x45e97b){_0x3c8452=_0x3c8452-0x0;var _0x30def1=_0xa4fa[_0x3c8452];return _0x30def1;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xaa4f('0x0'),_0xaa4f('0x1'),_0xaa4f('0x2')];function createListener(_0x4503d3,_0x26c659){return function(_0x7ec8d7){_0x26c659[_0xaa4f('0x3')](_0x4503d3,_0x7ec8d7);};}function removeListener(_0x544fe7,_0x43fb62){return function(){OpenchannelAccountEvents[_0xaa4f('0x4')](_0x544fe7,_0x43fb62);};}exports[_0xaa4f('0x5')]=function(_0x50fd54){for(var _0x2ed66f=0x0,_0x3dc5f3=events['length'];_0x2ed66f<_0x3dc5f3;_0x2ed66f++){var _0x3e4302=events[_0x2ed66f];var _0xd86019=createListener(_0xaa4f('0x6')+_0x3e4302,_0x50fd54);OpenchannelAccountEvents['on'](_0x3e4302,_0xd86019);}}; \ No newline at end of file +var _0x1357=['openchannelAccount:','./openchannelAccount.events','save','remove','emit','removeListener','register','length'];(function(_0xea2304,_0x4182a7){var _0x41be44=function(_0x2feb29){while(--_0x2feb29){_0xea2304['push'](_0xea2304['shift']());}};_0x41be44(++_0x4182a7);}(_0x1357,0x71));var _0x7135=function(_0x5a1fe2,_0x3e9e80){_0x5a1fe2=_0x5a1fe2-0x0;var _0x35266a=_0x1357[_0x5a1fe2];return _0x35266a;};'use strict';var OpenchannelAccountEvents=require(_0x7135('0x0'));var events=[_0x7135('0x1'),_0x7135('0x2'),'update'];function createListener(_0x50631c,_0x5d4760){return function(_0x3add97){_0x5d4760[_0x7135('0x3')](_0x50631c,_0x3add97);};}function removeListener(_0x4e4541,_0x43f93e){return function(){OpenchannelAccountEvents[_0x7135('0x4')](_0x4e4541,_0x43f93e);};}exports[_0x7135('0x5')]=function(_0xeba3c8){for(var _0x1c73d8=0x0,_0x27f09c=events[_0x7135('0x6')];_0x1c73d8<_0x27f09c;_0x1c73d8++){var _0x480665=events[_0x1c73d8];var _0x1d052d=createListener(_0x7135('0x7')+_0x480665,_0xeba3c8);OpenchannelAccountEvents['on'](_0x480665,_0x1d052d);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 7dd46de..67f4386 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 _0xa4fc=['index','/:id','post','create','put','update','delete','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated'];(function(_0x567312,_0x33020e){var _0xea4df1=function(_0x4a9ada){while(--_0x4a9ada){_0x567312['push'](_0x567312['shift']());}};_0xea4df1(++_0x33020e);}(_0xa4fc,0x6f));var _0xca4f=function(_0x1ddbee,_0x5c0373){_0x1ddbee=_0x1ddbee-0x0;var _0x5c6189=_0xa4fc[_0x1ddbee];return _0x5c6189;};'use strict';var multer=require(_0xca4f('0x0'));var util=require('util');var path=require(_0xca4f('0x1'));var timeout=require('connect-timeout');var express=require(_0xca4f('0x2'));var router=express['Router']();var auth=require(_0xca4f('0x3'));var interaction=require(_0xca4f('0x4'));var config=require('../../config/environment');var controller=require(_0xca4f('0x5'));router[_0xca4f('0x6')]('/',auth[_0xca4f('0x7')](),controller[_0xca4f('0x8')]);router[_0xca4f('0x6')](_0xca4f('0x9'),auth[_0xca4f('0x7')](),controller['show']);router[_0xca4f('0xa')]('/',auth[_0xca4f('0x7')](),controller[_0xca4f('0xb')]);router[_0xca4f('0xc')]('/:id',auth[_0xca4f('0x7')](),controller[_0xca4f('0xd')]);router[_0xca4f('0xe')]('/:id',auth[_0xca4f('0x7')](),controller[_0xca4f('0xf')]);module[_0xca4f('0x10')]=router; \ No newline at end of file +var _0x51ce=['../../config/environment','get','isAuthenticated','/:id','show','post','create','update','exports','multer','connect-timeout','express'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x51ce,0x165));var _0xe51c=function(_0x3cec8c,_0x3f6c1d){_0x3cec8c=_0x3cec8c-0x0;var _0x38032e=_0x51ce[_0x3cec8c];return _0x38032e;};'use strict';var multer=require(_0xe51c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe51c('0x1'));var express=require(_0xe51c('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe51c('0x3'));var controller=require('./openchannelApplication.controller');router[_0xe51c('0x4')]('/',auth[_0xe51c('0x5')](),controller['index']);router[_0xe51c('0x4')](_0xe51c('0x6'),auth[_0xe51c('0x5')](),controller[_0xe51c('0x7')]);router[_0xe51c('0x8')]('/',auth[_0xe51c('0x5')](),controller[_0xe51c('0x9')]);router['put'](_0xe51c('0x6'),auth[_0xe51c('0x5')](),controller[_0xe51c('0xa')]);router['delete'](_0xe51c('0x6'),auth['isAuthenticated'](),controller['destroy']);module[_0xe51c('0xb')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index c5fd300..a242113 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 _0x1841=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x4ea88f,_0x3c0018){var _0x4e2b3b=function(_0x2f166d){while(--_0x2f166d){_0x4ea88f['push'](_0x4ea88f['shift']());}};_0x4e2b3b(++_0x3c0018);}(_0x1841,0x65));var _0x1184=function(_0xfc215f,_0xd9a464){_0xfc215f=_0xfc215f-0x0;var _0x3e4031=_0x1841[_0xfc215f];return _0x3e4031;};'use strict';var Sequelize=require(_0x1184('0x0'));module[_0x1184('0x1')]={'priority':{'type':Sequelize[_0x1184('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1184('0x3')],'allowNull':![],'defaultValue':_0x1184('0x4')},'appdata':{'type':Sequelize[_0x1184('0x5')]()},'description':{'type':Sequelize[_0x1184('0x3')]},'interval':{'type':Sequelize[_0x1184('0x3')],'defaultValue':_0x1184('0x6')}}; \ No newline at end of file +var _0x8f47=['*,*,*,*','exports','INTEGER','TEXT','STRING'];(function(_0x4f9036,_0x38e6b4){var _0x5b35bc=function(_0x1d65a7){while(--_0x1d65a7){_0x4f9036['push'](_0x4f9036['shift']());}};_0x5b35bc(++_0x38e6b4);}(_0x8f47,0x1aa));var _0x78f4=function(_0x45655c,_0x407b81){_0x45655c=_0x45655c-0x0;var _0x24a8d9=_0x8f47[_0x45655c];return _0x24a8d9;};'use strict';var Sequelize=require('sequelize');module[_0x78f4('0x0')]={'priority':{'type':Sequelize[_0x78f4('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x78f4('0x2')]()},'description':{'type':Sequelize[_0x78f4('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x78f4('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 93642b7..ed991ca 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 _0xf48f=['../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','merge','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','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'];(function(_0x1bc77a,_0x2f0207){var _0x3103c1=function(_0x320dfb){while(--_0x320dfb){_0x1bc77a['push'](_0x1bc77a['shift']());}};_0x3103c1(++_0x2f0207);}(_0xf48f,0x14b));var _0xff48=function(_0x23af81,_0xb2ca42){_0x23af81=_0x23af81-0x0;var _0x303873=_0xf48f[_0x23af81];return _0x303873;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xff48('0x0'));var rimraf=require(_0xff48('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xff48('0x2'));var rp=require(_0xff48('0x3'));var moment=require(_0xff48('0x4'));var BPromise=require(_0xff48('0x5'));var Mustache=require(_0xff48('0x6'));var util=require(_0xff48('0x7'));var path=require(_0xff48('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xff48('0x9'));var fs=require('fs');var _=require(_0xff48('0xa'));var squel=require(_0xff48('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xff48('0xc'));var toCsv=require('to-csv');var querystring=require(_0xff48('0xd'));var Papa=require(_0xff48('0xe'));var Redis=require(_0xff48('0xf'));var authService=require(_0xff48('0x10'));var qs=require(_0xff48('0x11'));var as=require(_0xff48('0x12'));var hardwareService=require(_0xff48('0x13'));var logger=require(_0xff48('0x14'))(_0xff48('0x15'));var utils=require(_0xff48('0x16'));var config=require(_0xff48('0x17'));var licenseUtil=require(_0xff48('0x18'));var db=require(_0xff48('0x19'))['db'];function respondWithStatusCode(_0x3f7266,_0x52d37a){_0x52d37a=_0x52d37a||0xcc;return function(_0x455f39){if(_0x455f39){return _0x3f7266[_0xff48('0x1a')](_0x52d37a);}return _0x3f7266[_0xff48('0x1b')](_0x52d37a)['end']();};}function respondWithResult(_0xbb5c0e,_0x6730b0){_0x6730b0=_0x6730b0||0xc8;return function(_0x5e9b77){if(_0x5e9b77){return _0xbb5c0e['status'](_0x6730b0)[_0xff48('0x1c')](_0x5e9b77);}};}function respondWithFilteredResult(_0x521b66,_0x4a026b){return function(_0x1e8225){if(_0x1e8225){var _0x5366fc=_0x1e8225[_0xff48('0x1d')],_0x577b71=_0x4a026b[_0xff48('0x1e')],_0x2e80a4=_0x4a026b[_0xff48('0x1e')]+_0x4a026b[_0xff48('0x1f')],_0x5b0590;if(_0x2e80a4>=_0x5366fc){_0x2e80a4=_0x5366fc;_0x5b0590=0xc8;}else{_0x5b0590=0xce;}_0x521b66[_0xff48('0x1b')](_0x5b0590);return _0x521b66[_0xff48('0x20')](_0xff48('0x21'),_0x577b71+'-'+_0x2e80a4+'/'+_0x5366fc)[_0xff48('0x1c')](_0x1e8225);}return null;};}function patchUpdates(_0x3d6b68){return function(_0x509697){try{jsonpatch[_0xff48('0x22')](_0x509697,_0x3d6b68,!![]);}catch(_0x9c2fae){return BPromise['reject'](_0x9c2fae);}return _0x509697['save']();};}function saveUpdates(_0xd2224a,_0x1052ce){return function(_0x440944){if(_0x440944){return _0x440944[_0xff48('0x23')](_0xd2224a)[_0xff48('0x24')](function(_0x577b07){return _0x577b07;});}return null;};}function removeEntity(_0x5a087c,_0x5bb9ac){return function(_0x50e08e){if(_0x50e08e){return _0x50e08e[_0xff48('0x25')]()[_0xff48('0x24')](function(){_0x5a087c[_0xff48('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe705ec,_0xc3817){return function(_0x478e4c){if(!_0x478e4c){_0xe705ec[_0xff48('0x1a')](0x194);}return _0x478e4c;};}function handleError(_0x497910,_0x3a3d72){_0x3a3d72=_0x3a3d72||0x1f4;return function(_0xc9ef88){logger[_0xff48('0x26')](_0xc9ef88[_0xff48('0x27')]);if(_0xc9ef88[_0xff48('0x28')]){delete _0xc9ef88[_0xff48('0x28')];}_0x497910[_0xff48('0x1b')](_0x3a3d72)['send'](_0xc9ef88);};}exports[_0xff48('0x29')]=function(_0x1d49f6,_0x1ed9ad){var _0x21ee75={},_0xc7e786={},_0x435657={'count':0x0,'rows':[]};var _0x24201f=_[_0xff48('0x2a')](db[_0xff48('0x2b')][_0xff48('0x2c')],function(_0x372b47){return{'name':_0x372b47[_0xff48('0x2d')],'type':_0x372b47[_0xff48('0x2e')][_0xff48('0x2f')]};});_0xc7e786[_0xff48('0x30')]=_[_0xff48('0x2a')](_0x24201f,'name');_0xc7e786['query']=_['keys'](_0x1d49f6[_0xff48('0x31')]);_0xc7e786[_0xff48('0x32')]=_[_0xff48('0x33')](_0xc7e786[_0xff48('0x30')],_0xc7e786[_0xff48('0x31')]);_0x21ee75[_0xff48('0x34')]=_[_0xff48('0x33')](_0xc7e786[_0xff48('0x30')],qs['fields'](_0x1d49f6[_0xff48('0x31')][_0xff48('0x35')]));_0x21ee75[_0xff48('0x34')]=_0x21ee75[_0xff48('0x34')][_0xff48('0x36')]?_0x21ee75[_0xff48('0x34')]:_0xc7e786['model'];if(!_0x1d49f6[_0xff48('0x31')][_0xff48('0x37')]('nolimit')){_0x21ee75['limit']=qs[_0xff48('0x1f')](_0x1d49f6[_0xff48('0x31')][_0xff48('0x1f')]);_0x21ee75[_0xff48('0x1e')]=qs[_0xff48('0x1e')](_0x1d49f6[_0xff48('0x31')][_0xff48('0x1e')]);}_0x21ee75['order']=qs['sort'](_0x1d49f6[_0xff48('0x31')]['sort']);_0x21ee75[_0xff48('0x38')]=qs[_0xff48('0x32')](_[_0xff48('0x39')](_0x1d49f6['query'],_0xc7e786['filters']),_0x24201f);if(_0x1d49f6[_0xff48('0x31')]['filter']){_0x21ee75[_0xff48('0x38')]=_['merge'](_0x21ee75['where'],{'$or':_['map'](_0x24201f,function(_0x318584){if(_0x318584['type']!==_0xff48('0x3a')){var _0x43643e={};_0x43643e[_0x318584[_0xff48('0x28')]]={'$like':'%'+_0x1d49f6['query']['filter']+'%'};return _0x43643e;}})});}_0x21ee75=_['merge']({},_0x21ee75,_0x1d49f6['options']);var _0x4a2979={'where':_0x21ee75[_0xff48('0x38')]};return db[_0xff48('0x2b')][_0xff48('0x1d')](_0x4a2979)[_0xff48('0x24')](function(_0x4d4940){_0x435657[_0xff48('0x1d')]=_0x4d4940;if(_0x1d49f6[_0xff48('0x31')][_0xff48('0x3b')]){_0x21ee75[_0xff48('0x3c')]=[{'all':!![]}];}return db[_0xff48('0x2b')][_0xff48('0x3d')](_0x21ee75);})[_0xff48('0x24')](function(_0x191290){_0x435657[_0xff48('0x3e')]=_0x191290;return _0x435657;})['then'](respondWithFilteredResult(_0x1ed9ad,_0x21ee75))[_0xff48('0x3f')](handleError(_0x1ed9ad,null));};exports['show']=function(_0x145352,_0x3ba31b){var _0xbef7d6={'raw':!![],'where':{'id':_0x145352[_0xff48('0x40')]['id']}},_0x9df1aa={};_0x9df1aa[_0xff48('0x30')]=_['keys'](db[_0xff48('0x2b')][_0xff48('0x2c')]);_0x9df1aa['query']=_[_0xff48('0x41')](_0x145352[_0xff48('0x31')]);_0x9df1aa['filters']=_['intersection'](_0x9df1aa[_0xff48('0x30')],_0x9df1aa['query']);_0xbef7d6[_0xff48('0x34')]=_[_0xff48('0x33')](_0x9df1aa[_0xff48('0x30')],qs['fields'](_0x145352[_0xff48('0x31')]['fields']));_0xbef7d6[_0xff48('0x34')]=_0xbef7d6['attributes'][_0xff48('0x36')]?_0xbef7d6[_0xff48('0x34')]:_0x9df1aa[_0xff48('0x30')];if(_0x145352['query'][_0xff48('0x3b')]){_0xbef7d6['include']=[{'all':!![]}];}_0xbef7d6=_[_0xff48('0x42')]({},_0xbef7d6,_0x145352[_0xff48('0x43')]);return db['OpenchannelApplication'][_0xff48('0x44')](_0xbef7d6)[_0xff48('0x24')](handleEntityNotFound(_0x3ba31b,null))[_0xff48('0x24')](respondWithResult(_0x3ba31b,null))[_0xff48('0x3f')](handleError(_0x3ba31b,null));};exports[_0xff48('0x45')]=function(_0x19cd05,_0x2fd4d1){return db[_0xff48('0x2b')][_0xff48('0x45')](_0x19cd05[_0xff48('0x46')],{})[_0xff48('0x24')](respondWithResult(_0x2fd4d1,0xc9))[_0xff48('0x3f')](handleError(_0x2fd4d1,null));};exports['update']=function(_0x419319,_0xe4b187){if(_0x419319[_0xff48('0x46')]['id']){delete _0x419319[_0xff48('0x46')]['id'];}return db[_0xff48('0x2b')][_0xff48('0x44')]({'where':{'id':_0x419319[_0xff48('0x40')]['id']}})[_0xff48('0x24')](handleEntityNotFound(_0xe4b187,null))[_0xff48('0x24')](saveUpdates(_0x419319[_0xff48('0x46')],null))['then'](respondWithResult(_0xe4b187,null))[_0xff48('0x3f')](handleError(_0xe4b187,null));};exports[_0xff48('0x25')]=function(_0x579257,_0x1ab6c4){return db[_0xff48('0x2b')]['find']({'where':{'id':_0x579257[_0xff48('0x40')]['id']}})[_0xff48('0x24')](handleEntityNotFound(_0x1ab6c4,null))[_0xff48('0x24')](removeEntity(_0x1ab6c4,null))[_0xff48('0x3f')](handleError(_0x1ab6c4,null));}; \ No newline at end of file +var _0x687c=['catch','create','body','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','OpenchannelApplication','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','find'];(function(_0x2185e2,_0x4e23cd){var _0x415782=function(_0x42cc99){while(--_0x42cc99){_0x2185e2['push'](_0x2185e2['shift']());}};_0x415782(++_0x4e23cd);}(_0x687c,0x92));var _0xc687=function(_0x81b05d,_0x6ed24d){_0x81b05d=_0x81b05d-0x0;var _0x1163e8=_0x687c[_0x81b05d];return _0x1163e8;};'use strict';var pdf=require(_0xc687('0x0'));var emlformat=require(_0xc687('0x1'));var rimraf=require(_0xc687('0x2'));var zipdir=require(_0xc687('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc687('0x4'));var moment=require(_0xc687('0x5'));var BPromise=require(_0xc687('0x6'));var Mustache=require(_0xc687('0x7'));var util=require('util');var path=require(_0xc687('0x8'));var sox=require('sox');var csv=require(_0xc687('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc687('0xa'));var squel=require('squel');var crypto=require(_0xc687('0xb'));var jsforce=require(_0xc687('0xc'));var deskjs=require(_0xc687('0xd'));var toCsv=require(_0xc687('0x9'));var querystring=require(_0xc687('0xe'));var Papa=require(_0xc687('0xf'));var Redis=require(_0xc687('0x10'));var authService=require(_0xc687('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc687('0x12'))(_0xc687('0x13'));var utils=require(_0xc687('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc687('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x244480,_0x1e4b9d){_0x1e4b9d=_0x1e4b9d||0xcc;return function(_0x3a1f19){if(_0x3a1f19){return _0x244480['sendStatus'](_0x1e4b9d);}return _0x244480[_0xc687('0x16')](_0x1e4b9d)[_0xc687('0x17')]();};}function respondWithResult(_0x2d8550,_0xe35f80){_0xe35f80=_0xe35f80||0xc8;return function(_0x3fa871){if(_0x3fa871){return _0x2d8550['status'](_0xe35f80)[_0xc687('0x18')](_0x3fa871);}};}function respondWithFilteredResult(_0x4fc42c,_0x5b35f8){return function(_0xa683be){if(_0xa683be){var _0x1fbc37=_0xa683be[_0xc687('0x19')],_0x42a4ac=_0x5b35f8[_0xc687('0x1a')],_0x4706fc=_0x5b35f8[_0xc687('0x1a')]+_0x5b35f8[_0xc687('0x1b')],_0x5a00cd;if(_0x4706fc>=_0x1fbc37){_0x4706fc=_0x1fbc37;_0x5a00cd=0xc8;}else{_0x5a00cd=0xce;}_0x4fc42c[_0xc687('0x16')](_0x5a00cd);return _0x4fc42c[_0xc687('0x1c')](_0xc687('0x1d'),_0x42a4ac+'-'+_0x4706fc+'/'+_0x1fbc37)['json'](_0xa683be);}return null;};}function patchUpdates(_0x34cdf1){return function(_0x408b0b){try{jsonpatch[_0xc687('0x1e')](_0x408b0b,_0x34cdf1,!![]);}catch(_0x3ce727){return BPromise[_0xc687('0x1f')](_0x3ce727);}return _0x408b0b[_0xc687('0x20')]();};}function saveUpdates(_0x364f8c,_0x31f6c5){return function(_0xe51492){if(_0xe51492){return _0xe51492['update'](_0x364f8c)[_0xc687('0x21')](function(_0x431f6b){return _0x431f6b;});}return null;};}function removeEntity(_0x3e8ba4,_0x3807b6){return function(_0x4c3342){if(_0x4c3342){return _0x4c3342[_0xc687('0x22')]()[_0xc687('0x21')](function(){_0x3e8ba4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x434710,_0x248117){return function(_0x1c836b){if(!_0x1c836b){_0x434710[_0xc687('0x23')](0x194);}return _0x1c836b;};}function handleError(_0x346312,_0x1be99b){_0x1be99b=_0x1be99b||0x1f4;return function(_0x2cbf56){logger['error'](_0x2cbf56[_0xc687('0x24')]);if(_0x2cbf56[_0xc687('0x25')]){delete _0x2cbf56[_0xc687('0x25')];}_0x346312[_0xc687('0x16')](_0x1be99b)[_0xc687('0x26')](_0x2cbf56);};}exports['index']=function(_0xd06314,_0x5a0665){var _0x188b34={},_0x1527d1={},_0x3e9efd={'count':0x0,'rows':[]};var _0x298c5a=_['map'](db[_0xc687('0x27')][_0xc687('0x28')],function(_0x2d6042){return{'name':_0x2d6042[_0xc687('0x29')],'type':_0x2d6042[_0xc687('0x2a')]['key']};});_0x1527d1[_0xc687('0x2b')]=_[_0xc687('0x2c')](_0x298c5a,_0xc687('0x25'));_0x1527d1['query']=_[_0xc687('0x2d')](_0xd06314[_0xc687('0x2e')]);_0x1527d1[_0xc687('0x2f')]=_[_0xc687('0x30')](_0x1527d1[_0xc687('0x2b')],_0x1527d1['query']);_0x188b34[_0xc687('0x31')]=_[_0xc687('0x30')](_0x1527d1[_0xc687('0x2b')],qs['fields'](_0xd06314[_0xc687('0x2e')][_0xc687('0x32')]));_0x188b34[_0xc687('0x31')]=_0x188b34[_0xc687('0x31')][_0xc687('0x33')]?_0x188b34[_0xc687('0x31')]:_0x1527d1[_0xc687('0x2b')];if(!_0xd06314['query'][_0xc687('0x34')](_0xc687('0x35'))){_0x188b34[_0xc687('0x1b')]=qs[_0xc687('0x1b')](_0xd06314['query']['limit']);_0x188b34['offset']=qs[_0xc687('0x1a')](_0xd06314['query'][_0xc687('0x1a')]);}_0x188b34[_0xc687('0x36')]=qs['sort'](_0xd06314['query'][_0xc687('0x37')]);_0x188b34['where']=qs[_0xc687('0x2f')](_['pick'](_0xd06314[_0xc687('0x2e')],_0x1527d1[_0xc687('0x2f')]),_0x298c5a);if(_0xd06314['query']['filter']){_0x188b34['where']=_['merge'](_0x188b34[_0xc687('0x38')],{'$or':_[_0xc687('0x2c')](_0x298c5a,function(_0x175bf5){if(_0x175bf5['type']!==_0xc687('0x39')){var _0x14960d={};_0x14960d[_0x175bf5['name']]={'$like':'%'+_0xd06314[_0xc687('0x2e')]['filter']+'%'};return _0x14960d;}})});}_0x188b34=_['merge']({},_0x188b34,_0xd06314[_0xc687('0x3a')]);var _0x1bd6f9={'where':_0x188b34[_0xc687('0x38')]};return db[_0xc687('0x27')][_0xc687('0x19')](_0x1bd6f9)[_0xc687('0x21')](function(_0x3439d2){_0x3e9efd[_0xc687('0x19')]=_0x3439d2;if(_0xd06314['query'][_0xc687('0x3b')]){_0x188b34[_0xc687('0x3c')]=[{'all':!![]}];}return db[_0xc687('0x27')][_0xc687('0x3d')](_0x188b34);})[_0xc687('0x21')](function(_0x57eda8){_0x3e9efd[_0xc687('0x3e')]=_0x57eda8;return _0x3e9efd;})[_0xc687('0x21')](respondWithFilteredResult(_0x5a0665,_0x188b34))['catch'](handleError(_0x5a0665,null));};exports[_0xc687('0x3f')]=function(_0x4f10d4,_0x3c65fb){var _0xf7eeed={'raw':!![],'where':{'id':_0x4f10d4[_0xc687('0x40')]['id']}},_0x293ef4={};_0x293ef4[_0xc687('0x2b')]=_[_0xc687('0x2d')](db[_0xc687('0x27')][_0xc687('0x28')]);_0x293ef4['query']=_[_0xc687('0x2d')](_0x4f10d4[_0xc687('0x2e')]);_0x293ef4['filters']=_[_0xc687('0x30')](_0x293ef4[_0xc687('0x2b')],_0x293ef4['query']);_0xf7eeed[_0xc687('0x31')]=_[_0xc687('0x30')](_0x293ef4[_0xc687('0x2b')],qs[_0xc687('0x32')](_0x4f10d4[_0xc687('0x2e')][_0xc687('0x32')]));_0xf7eeed[_0xc687('0x31')]=_0xf7eeed[_0xc687('0x31')][_0xc687('0x33')]?_0xf7eeed[_0xc687('0x31')]:_0x293ef4[_0xc687('0x2b')];if(_0x4f10d4[_0xc687('0x2e')][_0xc687('0x3b')]){_0xf7eeed['include']=[{'all':!![]}];}_0xf7eeed=_[_0xc687('0x41')]({},_0xf7eeed,_0x4f10d4['options']);return db[_0xc687('0x27')][_0xc687('0x42')](_0xf7eeed)['then'](handleEntityNotFound(_0x3c65fb,null))[_0xc687('0x21')](respondWithResult(_0x3c65fb,null))[_0xc687('0x43')](handleError(_0x3c65fb,null));};exports[_0xc687('0x44')]=function(_0x4280b0,_0x33a450){return db['OpenchannelApplication'][_0xc687('0x44')](_0x4280b0[_0xc687('0x45')],{})['then'](respondWithResult(_0x33a450,0xc9))[_0xc687('0x43')](handleError(_0x33a450,null));};exports[_0xc687('0x46')]=function(_0x1ff387,_0x31f097){if(_0x1ff387[_0xc687('0x45')]['id']){delete _0x1ff387[_0xc687('0x45')]['id'];}return db[_0xc687('0x27')][_0xc687('0x42')]({'where':{'id':_0x1ff387[_0xc687('0x40')]['id']}})[_0xc687('0x21')](handleEntityNotFound(_0x31f097,null))[_0xc687('0x21')](saveUpdates(_0x1ff387[_0xc687('0x45')],null))[_0xc687('0x21')](respondWithResult(_0x31f097,null))[_0xc687('0x43')](handleError(_0x31f097,null));};exports[_0xc687('0x22')]=function(_0x1814a7,_0x440975){return db[_0xc687('0x27')]['find']({'where':{'id':_0x1814a7['params']['id']}})['then'](handleEntityNotFound(_0x440975,null))['then'](removeEntity(_0x440975,null))[_0xc687('0x43')](handleError(_0x440975,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 3723b5c..8346355 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 _0x6db9=['../../config/environment','exports','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x6db9,0x92));var _0x96db=function(_0x525ef8,_0x5de54a){_0x525ef8=_0x525ef8-0x0;var _0x2b5dda=_0x6db9[_0x525ef8];return _0x2b5dda;};'use strict';var _=require(_0x96db('0x0'));var util=require(_0x96db('0x1'));var logger=require(_0x96db('0x2'))(_0x96db('0x3'));var moment=require(_0x96db('0x4'));var BPromise=require(_0x96db('0x5'));var rp=require(_0x96db('0x6'));var fs=require('fs');var path=require(_0x96db('0x7'));var rimraf=require('rimraf');var config=require(_0x96db('0x8'));var attributes=require('./openchannelApplication.attributes');module[_0x96db('0x9')]=function(_0x563b6f,_0x121463){return _0x563b6f['define'](_0x96db('0xa'),attributes,{'tableName':_0x96db('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x96db('0xc'),'collate':_0x96db('0xd')});}; \ No newline at end of file +var _0x6d9d=['rimraf','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','path'];(function(_0x1e9b13,_0x78c34b){var _0x27254f=function(_0x3aa64d){while(--_0x3aa64d){_0x1e9b13['push'](_0x1e9b13['shift']());}};_0x27254f(++_0x78c34b);}(_0x6d9d,0xd8));var _0xd6d9=function(_0x339853,_0xa73742){_0x339853=_0x339853-0x0;var _0x176f6d=_0x6d9d[_0x339853];return _0x176f6d;};'use strict';var _=require(_0xd6d9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd6d9('0x1'));var moment=require(_0xd6d9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd6d9('0x3'));var rimraf=require(_0xd6d9('0x4'));var config=require('../../config/environment');var attributes=require(_0xd6d9('0x5'));module[_0xd6d9('0x6')]=function(_0x5c0d53,_0x3e8bc7){return _0x5c0d53[_0xd6d9('0x7')]('OpenchannelApplication',attributes,{'tableName':_0xd6d9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd6d9('0x9'),'collate':_0xd6d9('0xa')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 231c5fb..7cef670 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(_0x1815e5,_0x58fc74){var _0x2d212b=function(_0x38b5be){while(--_0x38b5be){_0x1815e5['push'](_0x1815e5['shift']());}};_0x2d212b(++_0x58fc74);}(_0xb10b,0x12a));var _0xbb10=function(_0x2d00d4,_0x3e7d3d){_0x2d00d4=_0x2d00d4-0x0;var _0x45f2b6=_0xb10b[_0x2d00d4];return _0x45f2b6;};'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 _0x5f2f=['error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify'];(function(_0x23b7e4,_0x1c9417){var _0x40d91b=function(_0x398d53){while(--_0x398d53){_0x23b7e4['push'](_0x23b7e4['shift']());}};_0x40d91b(++_0x1c9417);}(_0x5f2f,0x73));var _0xf5f2=function(_0x227eec,_0x4a4027){_0x227eec=_0x227eec-0x0;var _0x2ee592=_0x5f2f[_0x227eec];return _0x2ee592;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index a3e8fa7..493992d 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 _0x6f9a=['removeTags','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download','post','create','/:id/tags','tracked','openchannel','addTags','put','update','delete','openchannelinteraction:destroy','destroy'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x6f9a,0x18a));var _0xa6f9=function(_0x5b2138,_0x3d613e){_0x5b2138=_0x5b2138-0x0;var _0x4217ad=_0x6f9a[_0x5b2138];return _0x4217ad;};'use strict';var multer=require(_0xa6f9('0x0'));var util=require(_0xa6f9('0x1'));var path=require('path');var timeout=require(_0xa6f9('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xa6f9('0x3'));var interaction=require(_0xa6f9('0x4'));var config=require('../../config/environment');var controller=require(_0xa6f9('0x5'));router[_0xa6f9('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa6f9('0x7'),auth['isAuthenticated'](),controller[_0xa6f9('0x8')]);router[_0xa6f9('0x6')](_0xa6f9('0x9'),auth[_0xa6f9('0xa')](),controller[_0xa6f9('0xb')]);router[_0xa6f9('0x6')](_0xa6f9('0xc'),auth['isAuthenticated'](),controller[_0xa6f9('0xd')]);router[_0xa6f9('0x6')](_0xa6f9('0xe'),auth[_0xa6f9('0xa')](),controller['download']);router[_0xa6f9('0xf')]('/',auth[_0xa6f9('0xa')](),controller[_0xa6f9('0x10')]);router['post'](_0xa6f9('0xc'),auth[_0xa6f9('0xa')](),controller['addMessage']);router['post'](_0xa6f9('0x11'),auth[_0xa6f9('0xa')](),interaction[_0xa6f9('0x12')](_0xa6f9('0x13'),'openchannelinteraction:addtags'),controller[_0xa6f9('0x14')]);router[_0xa6f9('0x15')]('/:id',auth[_0xa6f9('0xa')](),interaction[_0xa6f9('0x12')]('openchannel','openchannelinteraction:update'),controller[_0xa6f9('0x16')]);router[_0xa6f9('0x17')](_0xa6f9('0x9'),auth[_0xa6f9('0xa')](),interaction[_0xa6f9('0x12')](_0xa6f9('0x13'),_0xa6f9('0x18')),controller[_0xa6f9('0x19')]);router[_0xa6f9('0x17')](_0xa6f9('0x11'),auth['isAuthenticated'](),controller[_0xa6f9('0x1a')]);module[_0xa6f9('0x1b')]=router; \ No newline at end of file +var _0x7245=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller'];(function(_0x132887,_0x8a429e){var _0x4edd79=function(_0x58096b){while(--_0x58096b){_0x132887['push'](_0x132887['shift']());}};_0x4edd79(++_0x8a429e);}(_0x7245,0x1c8));var _0x5724=function(_0x1720ad,_0xb6307d){_0x1720ad=_0x1720ad-0x0;var _0x347f37=_0x7245[_0x1720ad];return _0x347f37;};'use strict';var multer=require(_0x5724('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5724('0x1'));var router=express[_0x5724('0x2')]();var auth=require(_0x5724('0x3'));var interaction=require(_0x5724('0x4'));var config=require('../../config/environment');var controller=require(_0x5724('0x5'));router[_0x5724('0x6')]('/',auth[_0x5724('0x7')](),controller[_0x5724('0x8')]);router[_0x5724('0x6')](_0x5724('0x9'),auth['isAuthenticated'](),controller[_0x5724('0xa')]);router[_0x5724('0x6')](_0x5724('0xb'),auth[_0x5724('0x7')](),controller[_0x5724('0xc')]);router[_0x5724('0x6')](_0x5724('0xd'),auth[_0x5724('0x7')](),controller[_0x5724('0xe')]);router[_0x5724('0x6')](_0x5724('0xf'),auth['isAuthenticated'](),controller[_0x5724('0x10')]);router[_0x5724('0x11')]('/',auth[_0x5724('0x7')](),controller[_0x5724('0x12')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x5724('0x13')]);router[_0x5724('0x11')](_0x5724('0x14'),auth[_0x5724('0x7')](),interaction[_0x5724('0x15')](_0x5724('0x16'),_0x5724('0x17')),controller[_0x5724('0x18')]);router[_0x5724('0x19')]('/:id',auth[_0x5724('0x7')](),interaction[_0x5724('0x15')](_0x5724('0x16'),_0x5724('0x1a')),controller[_0x5724('0x1b')]);router['delete'](_0x5724('0xb'),auth[_0x5724('0x7')](),interaction['tracked'](_0x5724('0x16'),_0x5724('0x1c')),controller[_0x5724('0x1d')]);router[_0x5724('0x1e')](_0x5724('0x14'),auth[_0x5724('0x7')](),controller[_0x5724('0x1f')]);module[_0x5724('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 5066045..15e0bb5 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 _0x0dac=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x520049,_0x3955e1){var _0xee310=function(_0x57d417){while(--_0x57d417){_0x520049['push'](_0x520049['shift']());}};_0xee310(++_0x3955e1);}(_0x0dac,0x151));var _0xc0da=function(_0x822cbc,_0x1cff94){_0x822cbc=_0x822cbc-0x0;var _0x409ddb=_0x0dac[_0x822cbc];return _0x409ddb;};'use strict';var Sequelize=require(_0xc0da('0x0'));module[_0xc0da('0x1')]={'closed':{'type':Sequelize[_0xc0da('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc0da('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc0da('0x4')]},'note':{'type':Sequelize[_0xc0da('0x4')]},'read1stAt':{'type':Sequelize[_0xc0da('0x3')]},'threadId':{'type':Sequelize[_0xc0da('0x4')]},'externalUrl':{'type':Sequelize[_0xc0da('0x4')]},'lastMsgAt':{'type':Sequelize[_0xc0da('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc0da('0x5')]('in',_0xc0da('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6a6f=['STRING','ENUM','out','sequelize','exports','DATE'];(function(_0x22d1ef,_0x4a5152){var _0x47c5a3=function(_0x9a2c48){while(--_0x9a2c48){_0x22d1ef['push'](_0x22d1ef['shift']());}};_0x47c5a3(++_0x4a5152);}(_0x6a6f,0x129));var _0xf6a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a6f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf6a6('0x0'));module[_0xf6a6('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf6a6('0x2')]},'disposition':{'type':Sequelize[_0xf6a6('0x3')]},'secondDisposition':{'type':Sequelize[_0xf6a6('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf6a6('0x3')]},'note':{'type':Sequelize[_0xf6a6('0x3')]},'read1stAt':{'type':Sequelize[_0xf6a6('0x2')]},'threadId':{'type':Sequelize[_0xf6a6('0x3')]},'externalUrl':{'type':Sequelize[_0xf6a6('0x3')]},'lastMsgAt':{'type':Sequelize[_0xf6a6('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xf6a6('0x4')]('in',_0xf6a6('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xf6a6('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 0e44035..4b4ade1 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 _0x05c9=['groupBy','OpenchannelInteractionId','rows','show','params','keys','intersection','includeAll','include','create','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread','removeTags','download','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','CmContact','lastName','Attachment','Messages','OpenchannelAccount','Account','Owner','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\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','pipe','createWriteStream','out','System','firstName','direction','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','sendStatus','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','stack','name','Users','map','fullname','Tags','split','forEach','push','TagIds','catch','index','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','field','color','select','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','left_join','openchannel_interactions','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','Contact','operator','$substring','getFullTextValue','value','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','body','some','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','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','i.id','Sequelize','QueryTypes','SELECT','order','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','OpenchannelInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.OpenchannelInteractionId\x20IN\x20?'];(function(_0x22199f,_0x45988b){var _0x444c74=function(_0x2c2f0){while(--_0x2c2f0){_0x22199f['push'](_0x22199f['shift']());}};_0x444c74(++_0x45988b);}(_0x05c9,0x13f));var _0x905c=function(_0x315468,_0x29662e){_0x315468=_0x315468-0x0;var _0x414112=_0x05c9[_0x315468];return _0x414112;};'use strict';var pdf=require(_0x905c('0x0'));var emlformat=require(_0x905c('0x1'));var rimraf=require(_0x905c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x905c('0x3'));var rp=require(_0x905c('0x4'));var moment=require(_0x905c('0x5'));var BPromise=require(_0x905c('0x6'));var Mustache=require(_0x905c('0x7'));var util=require(_0x905c('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x905c('0x9'));var ejs=require(_0x905c('0xa'));var fs=require('fs');var _=require(_0x905c('0xb'));var squel=require(_0x905c('0xc'));var crypto=require(_0x905c('0xd'));var jsforce=require(_0x905c('0xe'));var deskjs=require(_0x905c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x905c('0x10'));var Papa=require(_0x905c('0x11'));var Redis=require(_0x905c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x905c('0x13'));var as=require(_0x905c('0x14'));var hardwareService=require(_0x905c('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x905c('0x16'));var config=require(_0x905c('0x17'));var licenseUtil=require(_0x905c('0x18'));var db=require(_0x905c('0x19'))['db'];config[_0x905c('0x1a')]=_['defaults'](config[_0x905c('0x1a')],{'host':_0x905c('0x1b'),'port':0x18eb});var socket=require(_0x905c('0x1c'))(new Redis(config[_0x905c('0x1a')]));require('./openchannelInteraction.socket')[_0x905c('0x1d')](socket);function respondWithStatusCode(_0x4fee1c,_0x154f95){_0x154f95=_0x154f95||0xcc;return function(_0x56f154){if(_0x56f154){return _0x4fee1c['sendStatus'](_0x154f95);}return _0x4fee1c[_0x905c('0x1e')](_0x154f95)[_0x905c('0x1f')]();};}function respondWithResult(_0x5ea8f1,_0x40992f){_0x40992f=_0x40992f||0xc8;return function(_0x539e1f){if(_0x539e1f){return _0x5ea8f1[_0x905c('0x1e')](_0x40992f)[_0x905c('0x20')](_0x539e1f);}};}function respondWithFilteredResult(_0x53c5ed,_0x3e1d5c){return function(_0x10b63e){if(_0x10b63e){var _0x2371a2=_0x10b63e[_0x905c('0x21')],_0x1b0aa3=_0x3e1d5c[_0x905c('0x22')],_0x48f5ce=_0x3e1d5c[_0x905c('0x22')]+_0x3e1d5c[_0x905c('0x23')],_0x24a367;if(_0x48f5ce>=_0x2371a2){_0x48f5ce=_0x2371a2;_0x24a367=0xc8;}else{_0x24a367=0xce;}_0x53c5ed[_0x905c('0x1e')](_0x24a367);return _0x53c5ed[_0x905c('0x24')](_0x905c('0x25'),_0x1b0aa3+'-'+_0x48f5ce+'/'+_0x2371a2)['json'](_0x10b63e);}return null;};}function patchUpdates(_0x4f251b){return function(_0x5785c3){try{jsonpatch[_0x905c('0x26')](_0x5785c3,_0x4f251b,!![]);}catch(_0x3fa2e4){return BPromise['reject'](_0x3fa2e4);}return _0x5785c3['save']();};}function saveUpdates(_0x316a9b,_0x334177){return function(_0x44fe85){if(_0x44fe85){return _0x44fe85[_0x905c('0x27')](_0x316a9b)[_0x905c('0x28')](function(_0x1fa831){return _0x1fa831;});}return null;};}function removeEntity(_0x4954b8,_0x57a298){return function(_0x26bb79){if(_0x26bb79){return _0x26bb79[_0x905c('0x29')]()[_0x905c('0x28')](function(){_0x4954b8[_0x905c('0x1e')](0xcc)[_0x905c('0x1f')]();});}};}function handleEntityNotFound(_0x2f7500,_0x3e7bfd){return function(_0x2335aa){if(!_0x2335aa){_0x2f7500['sendStatus'](0x194);}return _0x2335aa;};}function handleError(_0x7bd963,_0x586655){_0x586655=_0x586655||0x1f4;return function(_0x55ff27){logger['error'](_0x55ff27[_0x905c('0x2a')]);if(_0x55ff27[_0x905c('0x2b')]){delete _0x55ff27[_0x905c('0x2b')];}_0x7bd963[_0x905c('0x1e')](_0x586655)['send'](_0x55ff27);};}function getInteractionUsers(_0x5addcd,_0x596fb9){return new BPromise(function(_0x30ec81,_0x6f3b03){try{if(_0x596fb9[_0x5addcd['id']]){_0x5addcd[_0x905c('0x2c')]=_[_0x905c('0x2d')](_0x596fb9[_0x5addcd['id']],function(_0x2e6167){return{'id':_0x2e6167['id'],'fullname':_0x2e6167[_0x905c('0x2e')]};});}}catch(_0xf5002){_0x6f3b03(_0xf5002);}_0x30ec81(_0x5addcd);});}function getInteractionTags(_0x4f4005,_0x2226bd){return new BPromise(function(_0x3f847d,_0x8499fb){try{if(_0x4f4005['TagIds']){_0x4f4005[_0x905c('0x2f')]=[];_0x4f4005['TagIds'][_0x905c('0x30')](',')[_0x905c('0x31')](function(_0x400e65){_0x4f4005[_0x905c('0x2f')][_0x905c('0x32')](_0x2226bd[_0x400e65]);});}delete _0x4f4005[_0x905c('0x33')];}catch(_0x4b58d1){_0x8499fb(_0x4b58d1);}_0x3f847d(_0x4f4005);});}function updateOpenchannelInteraction(_0x12917f,_0x57d902,_0x3868a1){return new BPromise(function(_0x156b2c,_0x10b1b9){return getInteractionUsers(_0x12917f,_0x3868a1)['then'](function(_0x1bc87b){return getInteractionTags(_0x1bc87b,_0x57d902);})[_0x905c('0x28')](function(_0x2a3408){_0x156b2c(_0x2a3408);})[_0x905c('0x34')](function(_0x423190){_0x10b1b9(_0x423190);});});}exports[_0x905c('0x35')]=function(_0x576215,_0x57df8a){var _0x26a63e={},_0x2deb8a={},_0x2d8091={'count':0x0,'rows':[]};var _0x2abd59=_[_0x905c('0x2d')](db['OpenchannelInteraction'][_0x905c('0x36')],function(_0x476381){return{'name':_0x476381[_0x905c('0x37')],'type':_0x476381[_0x905c('0x38')][_0x905c('0x39')]};});_0x2deb8a[_0x905c('0x3a')]=_[_0x905c('0x2d')](_0x2abd59,_0x905c('0x2b'));_0x2deb8a[_0x905c('0x3b')]=_['keys'](_0x576215['query']);_0x2deb8a[_0x905c('0x3c')]=_['intersection'](_0x2deb8a['model'],_0x2deb8a['query']);_0x26a63e[_0x905c('0x3d')]=_['intersection'](_0x2deb8a['model'],qs[_0x905c('0x3e')](_0x576215[_0x905c('0x3b')]['fields']));_0x26a63e['attributes']=_0x26a63e[_0x905c('0x3d')][_0x905c('0x3f')]?_0x26a63e['attributes']:_0x2deb8a['model'];if(!_0x576215[_0x905c('0x3b')][_0x905c('0x40')](_0x905c('0x41'))){_0x26a63e[_0x905c('0x23')]=qs['limit'](_0x576215[_0x905c('0x3b')][_0x905c('0x23')]);_0x26a63e[_0x905c('0x22')]=qs[_0x905c('0x22')](_0x576215[_0x905c('0x3b')][_0x905c('0x22')]);}_0x26a63e['order']=qs['sort'](_0x576215['query'][_0x905c('0x42')]);_0x26a63e[_0x905c('0x43')]=qs[_0x905c('0x3c')](_['pick'](_0x576215[_0x905c('0x3b')],_0x2deb8a[_0x905c('0x3c')]),_0x2abd59);var _0x453d45=[];var _0x2f2e65=squel['select']()[_0x905c('0x44')]('id')[_0x905c('0x44')](_0x905c('0x2b'))[_0x905c('0x44')](_0x905c('0x45'))['from']('tools_tags');var _0xf09a6f=squel[_0x905c('0x46')]()[_0x905c('0x44')]('u.id')[_0x905c('0x44')](_0x905c('0x47'))[_0x905c('0x44')](_0x905c('0x48'))[_0x905c('0x49')](_0x905c('0x4a'),'ui')[_0x905c('0x4b')]('users','u','u.id\x20=\x20ui.UserId');var _0x1a0cdc=squel[_0x905c('0x46')]()[_0x905c('0x49')](_0x905c('0x4c'),'i')['left_join']('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x905c('0x4d'),'o',_0x905c('0x4e'))[_0x905c('0x4b')](_0x905c('0x4f'),'a',_0x905c('0x50'))[_0x905c('0x4b')](_0x905c('0x51'),'me',_0x905c('0x52'))[_0x905c('0x4b')](_0x905c('0x53'),'it',_0x905c('0x54'))['left_join']('tools_tags','t',_0x905c('0x55'));var _0x1dccfd=squel[_0x905c('0x56')]();var _0xea8f0a=[];var _0x462fff=squel[_0x905c('0x56')]();var _0x1a279c;if(_0x576215[_0x905c('0x3b')][_0x905c('0x57')]){_0x1a279c=as[_0x905c('0x58')](_0x576215[_0x905c('0x3b')][_0x905c('0x57')]);var _0x448d91=_0x1a279c[_0x905c('0x59')];for(var _0x48c1d0=0x0;_0x48c1d0<_0x1a279c[_0x905c('0x5a')]['length'];_0x48c1d0++){var _0x34c393=_0x1a279c[_0x905c('0x5a')][_0x48c1d0];var _0x174910='i';var _0x125607=_[_0x905c('0x5b')](_0x2abd59,[_0x905c('0x2b'),_0x34c393[_0x905c('0x44')]]);if(!_0x125607){switch(_0x34c393['field']){case _0x905c('0x5c'):if(_0x34c393['value']==0x1){_0x1a0cdc['having']('`'+_0x34c393[_0x905c('0x44')]+_0x905c('0x5d'));}else{_0x1a0cdc[_0x905c('0x5e')]('`'+_0x34c393[_0x905c('0x44')]+'`\x20>\x200');}break;case _0x905c('0x5f'):if(_0x34c393[_0x905c('0x60')]===_0x905c('0x61')){if(_0x34c393['value'][_0x905c('0x30')]('\x20')['length']>0x1){_0x1dccfd[_0x448d91]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x905c('0x62')](_0x34c393['value']),null);}else{var _0x72a53f='%'+_0x34c393[_0x905c('0x63')]+'%';_0x1dccfd[_0x448d91]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x72a53f,_0x72a53f,_0x72a53f);}}else{_0x125607=_[_0x905c('0x5b')](_0x2abd59,[_0x905c('0x2b'),_0x905c('0x64')]);_0x34c393[_0x905c('0x44')]=_0x905c('0x64');_0x251653=as[_0x905c('0x65')](_0x174910,_0x125607['type'],_0x34c393);_0x1dccfd[_0x448d91](_0x251653[_0x905c('0x66')],_0x251653[_0x905c('0x63')][_0x905c('0x67')],_0x251653[_0x905c('0x63')]['end']);}break;case _0x905c('0x68'):var _0x5c23e5=_0x34c393[_0x905c('0x63')][_0x905c('0x30')](',')[_0x905c('0x2d')](function(_0x21fa1e){return Number(_0x21fa1e);});_0x5c23e5[_0x905c('0x31')](function(_0x1d1af9){_0x462fff['or'](_0x905c('0x69'),'%,'+_0x1d1af9+',%');});_0xea8f0a=_[_0x905c('0x6a')](_0xea8f0a,_0x5c23e5);break;case _0x905c('0x6b'):if(_0x34c393[_0x905c('0x60')]===_0x905c('0x61')){_0x1dccfd[_0x448d91]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x34c393['value']+'%',null);}else{_0x125607=_[_0x905c('0x5b')](_0x2abd59,[_0x905c('0x2b'),_0x905c('0x6c')]);_0x34c393[_0x905c('0x44')]=_0x905c('0x6c');_0x251653=as[_0x905c('0x65')](_0x174910,_0x125607[_0x905c('0x38')],_0x34c393);_0x1dccfd[_0x448d91](_0x251653[_0x905c('0x66')],_0x251653[_0x905c('0x63')][_0x905c('0x67')],_0x251653['value']['end']);}break;case _0x905c('0x6d'):_0x251653=as[_0x905c('0x65')]('me',null,_0x34c393);_0x1dccfd[_0x448d91](_0x251653[_0x905c('0x66')],_0x251653[_0x905c('0x63')][_0x905c('0x67')],_0x251653[_0x905c('0x63')][_0x905c('0x1f')]);break;}}else{var _0x251653=as[_0x905c('0x65')](_0x174910,_0x125607[_0x905c('0x38')],_0x34c393);_0x1dccfd[_0x448d91](_0x251653[_0x905c('0x66')],_0x251653[_0x905c('0x63')][_0x905c('0x67')],_0x251653[_0x905c('0x63')][_0x905c('0x1f')]);}}}else{var _0x21d23f=_(_0x576215[_0x905c('0x3b')])['keys']()['map'](function(_0x4ecb38){return _[_0x905c('0x6e')](_0x2abd59,['name',_0x4ecb38])?_0x4ecb38:undefined;})[_0x905c('0x6f')]()[_0x905c('0x63')]();if(!_[_0x905c('0x70')](_0x21d23f)){_0x21d23f[_0x905c('0x31')](function(_0x43bc4a){if(_0x43bc4a==='OpenchannelAccountId'){_0x1a0cdc['where'](_0x905c('0x71'),[]['concat'](_0x576215[_0x905c('0x3b')][_0x43bc4a]));}else if(_0x43bc4a===_0x905c('0x72')){var _0xbcf43a=JSON[_0x905c('0x73')](_0x576215[_0x905c('0x3b')][_0x43bc4a])['$gte'];var _0x35453d=JSON[_0x905c('0x73')](_0x576215[_0x905c('0x3b')][_0x43bc4a])['$lte'];_0x1a0cdc['where'](_0x905c('0x74'),_0xbcf43a,_0x35453d);}else{if(_0x576215['query'][_0x43bc4a]===_0x905c('0x75')){_0x1a0cdc['where']('i.'+_0x43bc4a+_0x905c('0x76'));}else{_0x1a0cdc[_0x905c('0x43')]('i.'+_0x43bc4a+_0x905c('0x77'),_0x576215['query'][_0x43bc4a]);}}});}if(_0x576215[_0x905c('0x3b')][_0x905c('0x78')]){if(_0x576215[_0x905c('0x3b')]['read']==0x1){_0x1a0cdc[_0x905c('0x5e')]('`unreadMessages`\x20=\x200');}else{_0x1a0cdc['having'](_0x905c('0x79'));}}if(_0x576215[_0x905c('0x3b')][_0x905c('0x7a')]){_0xea8f0a=_[_0x905c('0x7b')](_0x576215[_0x905c('0x3b')][_0x905c('0x7a')])?_0x576215[_0x905c('0x3b')]['tag']:new Array(_0x576215[_0x905c('0x3b')][_0x905c('0x7a')]);_0xea8f0a[_0x905c('0x31')](function(_0x3f0521){_0x462fff['or'](_0x905c('0x69'),'%,'+_0x3f0521+',%');});}if(_0x576215['query'][_0x905c('0x7c')]){var _0x41f201=_0x576215[_0x905c('0x3b')][_0x905c('0x7c')][_0x905c('0x7d')]('\x5c','\x5c\x5c')[_0x905c('0x7d')](/'/g,'\x27\x27');if(qs[_0x905c('0x7e')](_0x41f201)){_0x1dccfd['or'](_0x905c('0x7f'),_0x41f201+'%');}else{_0x1dccfd['or'](_0x905c('0x80'),qs[_0x905c('0x62')](_0x41f201))['or'](_0x905c('0x81'),_0x41f201+'%')['or'](_0x905c('0x82'),_0x41f201+'%');}}}_0x1a0cdc[_0x905c('0x43')](_0x1dccfd);_0x1a0cdc[_0x905c('0x83')](_0x905c('0x84'));var _0x374b83={'type':db[_0x905c('0x85')][_0x905c('0x86')][_0x905c('0x87')],'raw':!![]};var _0x1b0a9f=_0x1a0cdc['clone']();_0x1b0a9f[_0x905c('0x44')](_0x905c('0x84'));_0x1b0a9f['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x26a63e[_0x905c('0x88')]){_0x26a63e[_0x905c('0x88')]['forEach'](function(_0xa7b907){var _0x4098c5=_0xa7b907[0x0]==='contactName'?_0xa7b907[0x0]:'i.'+_0xa7b907[0x0];_0x1a0cdc[_0x905c('0x88')](_0x4098c5,_0xa7b907[0x1]==='DESC'?![]:!![]);});}if(!_[_0x905c('0x70')](_0xea8f0a)){_0x1a0cdc[_0x905c('0x5e')](_0x462fff);_0x1b0a9f[_0x905c('0x43')]('t.id\x20IN\x20?',_0xea8f0a);}BPromise[_0x905c('0x89')]()[_0x905c('0x28')](function(){if(!_0x1a279c){if(_0x576215['query'][_0x905c('0x8a')])return;_0x1b0a9f['where'](_0x905c('0x8b'));_0x1a0cdc['where'](_0x905c('0x8b'));return;}if(_0x576215[_0x905c('0x8c')][_0x905c('0x8d')]!==_0x905c('0x8e'))return;return _0x576215[_0x905c('0x8c')][_0x905c('0x8f')]({'attributes':['id'],'raw':!![]})[_0x905c('0x28')](function(_0x80d0d9){if(_[_0x905c('0x70')](_0x80d0d9)){_0x1b0a9f['where'](_0x905c('0x90'));_0x1a0cdc['where']('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x1b0a9f[_0x905c('0x43')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x80d0d9,'id'));_0x1a0cdc[_0x905c('0x43')](_0x905c('0x71'),_[_0x905c('0x2d')](_0x80d0d9,'id'));}});})[_0x905c('0x28')](function(){if(_0x576215[_0x905c('0x8c')][_0x905c('0x8d')]===_0x905c('0x8e')&&!_0x1a279c&&!_0x576215[_0x905c('0x3b')][_0x905c('0x8a')])return[];return db['sequelize'][_0x905c('0x3b')](_0x1b0a9f[_0x905c('0x91')](),_0x374b83);})['then'](function(_0x3add4b){_0x2d8091['count']=_0x3add4b[_0x905c('0x3f')];if(_0x2d8091['count']===0x0)return[];return db[_0x905c('0x92')]['query'](_0x2f2e65[_0x905c('0x91')](),_0x374b83)[_0x905c('0x28')](function(_0x3e2a93){_0x453d45=_[_0x905c('0x93')](_0x3e2a93,'id');_0x374b83=_[_0x905c('0x94')](_0x374b83,{'model':db[_0x905c('0x95')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x576215['query'][_0x905c('0x3e')]){_0x26a63e[_0x905c('0x3d')][_0x905c('0x31')](function(_0x5bd39){_0x1a0cdc[_0x905c('0x44')]('i.'+_0x5bd39);});}else{_0x1a0cdc[_0x905c('0x44')](_0x905c('0x96'),_0x905c('0x5c'));_0x1a0cdc['field'](_0x905c('0x97'),'Account.key');_0x1a0cdc[_0x905c('0x44')](_0x905c('0x98'),_0x905c('0x99'));_0x1a0cdc['field'](_0x905c('0x9a'),_0x905c('0x9b'));_0x1a0cdc[_0x905c('0x44')]('i.*');_0x1a0cdc[_0x905c('0x44')](_0x905c('0x9c'),_0x905c('0x9d'));_0x1a0cdc[_0x905c('0x44')]('c.lastName',_0x905c('0x9e'));_0x1a0cdc[_0x905c('0x44')](_0x905c('0x9f'),_0x905c('0xa0'));_0x1a0cdc[_0x905c('0x44')](_0x905c('0xa1'),_0x905c('0xa2'));_0x1a0cdc['field'](_0x905c('0xa3'),_0x905c('0xa4'));_0x1a0cdc['field'](_0x905c('0xa5'),_0x905c('0xa6'));_0x1a0cdc['field'](_0x905c('0xa7'),_0x905c('0xa8'));_0x1a0cdc[_0x905c('0x44')](_0x905c('0xa9'),'Owner.internal');_0x1a0cdc[_0x905c('0x44')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x905c('0x33'));}if(_0x26a63e['limit'])_0x1a0cdc[_0x905c('0x23')](_0x26a63e[_0x905c('0x23')]);if(_0x26a63e['offset'])_0x1a0cdc['offset'](_0x26a63e[_0x905c('0x22')]);return db[_0x905c('0x92')][_0x905c('0x3b')](_0x1a0cdc[_0x905c('0x91')](),_0x374b83);})[_0x905c('0x28')](function(_0x3ca36b){_0xf09a6f[_0x905c('0x43')](_0x905c('0xaa'),_[_0x905c('0x2d')](_0x3ca36b,'id'));return db[_0x905c('0x92')][_0x905c('0x3b')](_0xf09a6f[_0x905c('0x91')](),_0x374b83)[_0x905c('0x28')](function(_0xa1c80a){var _0xc5c237=_[_0x905c('0xab')](_0xa1c80a,_0x905c('0xac'));var _0x3e9dea=[];_0x3ca36b[_0x905c('0x31')](function(_0x5de63f){_0x3e9dea[_0x905c('0x32')](updateOpenchannelInteraction(_0x5de63f,_0x453d45,_0xc5c237));});return BPromise['all'](_0x3e9dea);});});})[_0x905c('0x28')](function(_0x221f26){_0x2d8091[_0x905c('0xad')]=_0x221f26;return _0x2d8091;})[_0x905c('0x28')](respondWithFilteredResult(_0x57df8a,_0x26a63e))['catch'](handleError(_0x57df8a,null));};exports[_0x905c('0xae')]=function(_0x52945f,_0xb4882d){var _0xcdc00e={};if(_0x52945f[_0x905c('0x3b')][_0x905c('0x38')]&&_0x52945f[_0x905c('0x3b')][_0x905c('0x38')]==='from'){_0xcdc00e[_0x905c('0x49')]=_0x52945f[_0x905c('0xaf')]['id'];}else{_0xcdc00e['id']=_0x52945f['params']['id'];}var _0x407748={'raw':![],'where':_0xcdc00e},_0x3643fd={};_0x3643fd[_0x905c('0x3a')]=_[_0x905c('0xb0')](db[_0x905c('0x95')][_0x905c('0x36')]);_0x3643fd[_0x905c('0x3b')]=_[_0x905c('0xb0')](_0x52945f[_0x905c('0x3b')]);_0x3643fd[_0x905c('0x3c')]=_[_0x905c('0xb1')](_0x3643fd[_0x905c('0x3a')],_0x3643fd['query']);_0x407748['attributes']=_[_0x905c('0xb1')](_0x3643fd[_0x905c('0x3a')],qs[_0x905c('0x3e')](_0x52945f[_0x905c('0x3b')][_0x905c('0x3e')]));_0x407748[_0x905c('0x3d')]=_0x407748[_0x905c('0x3d')][_0x905c('0x3f')]?_0x407748[_0x905c('0x3d')]:_0x3643fd[_0x905c('0x3a')];if(_0x52945f['query'][_0x905c('0xb2')]){_0x407748[_0x905c('0xb3')]=[{'all':!![]}];}_0x407748=_[_0x905c('0x94')]({},_0x407748,_0x52945f['options']);return db[_0x905c('0x95')][_0x905c('0x5b')](_0x407748)[_0x905c('0x28')](handleEntityNotFound(_0xb4882d,null))[_0x905c('0x28')](respondWithResult(_0xb4882d,null))[_0x905c('0x34')](handleError(_0xb4882d,null));};exports[_0x905c('0xb4')]=function(_0x2ddfb4,_0x2cc176){return db[_0x905c('0x95')]['create'](_0x2ddfb4[_0x905c('0x6d')],{})[_0x905c('0x28')](respondWithResult(_0x2cc176,0xc9))[_0x905c('0x34')](handleError(_0x2cc176,null));};exports[_0x905c('0x27')]=function(_0x3c8aba,_0x10d8e1){if(_0x3c8aba['body']['id']){delete _0x3c8aba['body']['id'];}return db[_0x905c('0x95')][_0x905c('0x5b')]({'where':{'id':_0x3c8aba[_0x905c('0xaf')]['id']}})[_0x905c('0x28')](handleEntityNotFound(_0x10d8e1,null))['then'](saveUpdates(_0x3c8aba[_0x905c('0x6d')],null))[_0x905c('0x28')](respondWithResult(_0x10d8e1,null))[_0x905c('0x34')](handleError(_0x10d8e1,null));};exports['destroy']=function(_0x3e6aa4,_0x118bfc){return db['OpenchannelInteraction'][_0x905c('0x5b')]({'where':{'id':_0x3e6aa4[_0x905c('0xaf')]['id']}})[_0x905c('0x28')](handleEntityNotFound(_0x118bfc,null))[_0x905c('0x28')](removeEntity(_0x118bfc,null))['catch'](handleError(_0x118bfc,null));};exports[_0x905c('0xb5')]=function(_0xfb679,_0x33c176){return db[_0x905c('0x95')][_0x905c('0xb5')]()['then'](respondWithResult(_0x33c176,null))[_0x905c('0x34')](handleError(_0x33c176,null));};exports[_0x905c('0xb6')]=function(_0x45af90,_0x196f72,_0xc4b708){return db[_0x905c('0xb7')][_0x905c('0x5b')]({'where':{'id':_0x45af90[_0x905c('0xaf')]['id']}})[_0x905c('0x28')](handleEntityNotFound(_0x196f72,null))[_0x905c('0x28')](function(_0xb2eb67){if(_0xb2eb67){return _0xb2eb67[_0x905c('0xb6')](_0x45af90[_0x905c('0x6d')][_0x905c('0xb8')],_[_0x905c('0xb9')](_0x45af90[_0x905c('0x6d')],[_0x905c('0xb8'),'id'])||{});}})[_0x905c('0x28')](respondWithResult(_0x196f72,null))['catch'](handleError(_0x196f72,null));};exports[_0x905c('0xba')]=function(_0x4a603c,_0x5d8da8,_0x2a012f){var _0x4c7d96={'raw':![],'where':{}};var _0x10287e={};var _0x3388b0={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x905c('0xbb')]({'where':{'id':_0x4a603c[_0x905c('0xaf')]['id']}})[_0x905c('0x28')](handleEntityNotFound(_0x5d8da8,null))[_0x905c('0x28')](function(_0x321c3d){if(_0x321c3d){_0x10287e['model']=_[_0x905c('0xb0')](db['OpenchannelMessage'][_0x905c('0x36')]);_0x10287e['query']=_[_0x905c('0xb0')](_0x4a603c[_0x905c('0x3b')]);_0x10287e[_0x905c('0x3c')]=_[_0x905c('0xb1')](_0x10287e[_0x905c('0x3a')],_0x10287e[_0x905c('0x3b')]);_0x4c7d96[_0x905c('0x3d')]=_[_0x905c('0xb1')](_0x10287e[_0x905c('0x3a')],qs['fields'](_0x4a603c[_0x905c('0x3b')][_0x905c('0x3e')]));_0x4c7d96[_0x905c('0x3d')]=_0x4c7d96[_0x905c('0x3d')][_0x905c('0x3f')]?_0x4c7d96[_0x905c('0x3d')]:_0x10287e[_0x905c('0x3a')];if(!_0x4a603c[_0x905c('0x3b')]['hasOwnProperty'](_0x905c('0x41'))){_0x4c7d96[_0x905c('0x23')]=qs[_0x905c('0x23')](_0x4a603c[_0x905c('0x3b')][_0x905c('0x23')]);_0x4c7d96[_0x905c('0x22')]=qs['offset'](_0x4a603c[_0x905c('0x3b')]['offset']);}_0x4c7d96[_0x905c('0x88')]=qs['sort'](_0x4a603c[_0x905c('0x3b')]['sort']);_0x4c7d96[_0x905c('0x43')]=qs[_0x905c('0x3c')](_[_0x905c('0xbc')](_0x4a603c[_0x905c('0x3b')],_0x10287e['filters']));_0x4c7d96[_0x905c('0x43')][_0x905c('0xac')]=_0x321c3d['id'];if(_0x4a603c[_0x905c('0x3b')]['filter']){_0x4c7d96['where']=_[_0x905c('0x94')](_0x4c7d96[_0x905c('0x43')],{'$or':_[_0x905c('0x2d')](_0x4c7d96['attributes'],function(_0x222de0){var _0x36570e={};_0x36570e[_0x222de0]={'$like':'%'+_0x4a603c[_0x905c('0x3b')][_0x905c('0x7c')]+'%'};return _0x36570e;})});}if(_0x4a603c['query'][_0x905c('0xbd')]){var _0x431ee4=_0x4a603c[_0x905c('0x3b')]['$gte'][_0x905c('0x30')](',');var _0x38b14b={};_0x38b14b[_0x431ee4[0x0]]={'$gte':moment(_0x431ee4[0x1])[_0x905c('0xbe')](_0x905c('0xbf'))};_0x4c7d96[_0x905c('0x43')]=_[_0x905c('0x94')](_0x4c7d96[_0x905c('0x43')],_0x38b14b);}_0x4c7d96=_[_0x905c('0x94')]({},_0x4c7d96,_0x4a603c['options']);return db[_0x905c('0xb7')][_0x905c('0x21')]({'where':_0x4c7d96[_0x905c('0x43')]})[_0x905c('0x28')](function(_0x470f7f){_0x3388b0[_0x905c('0x21')]=_0x470f7f;if(_0x4a603c[_0x905c('0x3b')]['includeAll']){_0x4c7d96[_0x905c('0xb3')]=[{'all':!![]}];}return db[_0x905c('0xb7')][_0x905c('0xc0')](_0x4c7d96);})[_0x905c('0x28')](function(_0x1683b1){_0x3388b0[_0x905c('0xad')]=_0x1683b1;return _0x3388b0;});}})[_0x905c('0x28')](respondWithFilteredResult(_0x5d8da8,_0x4c7d96))[_0x905c('0x34')](handleError(_0x5d8da8,null));};exports['addTags']=function(_0x2770df,_0xe7d238,_0xce3adf){return db[_0x905c('0x95')][_0x905c('0x5b')]({'where':{'id':_0x2770df[_0x905c('0xaf')]['id']}})[_0x905c('0x28')](handleEntityNotFound(_0xe7d238,null))[_0x905c('0x28')](function(_0x5b9fc4){if(_0x5b9fc4){return _0x5b9fc4[_0x905c('0xc1')](_0x2770df[_0x905c('0x6d')][_0x905c('0xb8')],_[_0x905c('0xb9')](_0x2770df[_0x905c('0x6d')],[_0x905c('0xb8'),'id'])||{})[_0x905c('0xc2')](function(){return db['Tag'][_0x905c('0xc0')]({'attributes':['id',_0x905c('0x2b'),_0x905c('0x45')],'where':{'id':_0x2770df['body'][_0x905c('0xb8')]}});})[_0x905c('0x28')](function(_0x27e3d3){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x2770df['params']['id']),'tags':_0x27e3d3||[]});return{'id':Number(_0x2770df[_0x905c('0xaf')]['id']),'tags':_0x27e3d3||[]};});}})['then'](respondWithResult(_0xe7d238,null))[_0x905c('0x34')](handleError(_0xe7d238,null));};exports[_0x905c('0xc3')]=function(_0x23dc5a,_0x708fb,_0x4c096e){return db[_0x905c('0x95')][_0x905c('0x5b')]({'where':{'id':_0x23dc5a[_0x905c('0xaf')]['id']}})[_0x905c('0x28')](handleEntityNotFound(_0x708fb,null))[_0x905c('0x28')](function(_0x551b37){if(_0x551b37){return _0x551b37[_0x905c('0xc3')](_0x23dc5a[_0x905c('0x3b')]['ids']);}})[_0x905c('0x28')](respondWithStatusCode(_0x708fb,null))[_0x905c('0x34')](handleError(_0x708fb,null));};exports[_0x905c('0xc4')]=function(_0x450e64,_0xd737b8){var _0x3e6702=moment()[_0x905c('0xc5')]()['toString']();var _0x175c5f=path[_0x905c('0xc6')](config['root'],_0x905c('0xc7'),_0x905c('0xc8'),_0x905c('0xc9'));var _0x58b44b=path['join'](config[_0x905c('0xca')],'server',_0x905c('0xc8'),_0x905c('0xcb'));var _0x2be320=path[_0x905c('0xc6')](_0x175c5f,_0x3e6702);var _0xea8bbe=util['format'](_0x905c('0xcc'),_0x450e64[_0x905c('0xaf')]['id'],_0x3e6702);var _0x1e466f=path[_0x905c('0xc6')](_0x175c5f,_0xea8bbe);var _0x424510=[];_0x424510[_0x905c('0x32')]({'model':db[_0x905c('0x6b')],'as':_0x905c('0x6b'),'attributes':['id',_0x905c('0x2e')],'raw':!![]});_0x424510['push']({'model':db[_0x905c('0xcd')],'as':_0x905c('0x5f'),'attributes':['id','firstName',_0x905c('0xce')],'raw':!![]});if(_0x450e64[_0x905c('0x3b')][_0x905c('0xcb')]){_0x424510[_0x905c('0x32')]({'model':db[_0x905c('0xcf')],'as':_0x905c('0xcf'),'raw':!![]});}var _0xbd11ee=[{'model':db['OpenchannelMessage'],'as':_0x905c('0xd0'),'attributes':['id',_0x905c('0x6d'),_0x905c('0x72'),'direction','secret',_0x905c('0x78')],'include':_0x424510}];_0xbd11ee[_0x905c('0x32')]({'model':db[_0x905c('0xd1')],'as':_0x905c('0xd2'),'attributes':['id',_0x905c('0x2b')]});_0xbd11ee[_0x905c('0x32')]({'model':db[_0x905c('0x6b')],'as':_0x905c('0xd3'),'attributes':['id',_0x905c('0x2e')]});return db[_0x905c('0x95')][_0x905c('0x5b')]({'where':{'id':_0x450e64['params']['id']},'include':_0xbd11ee})[_0x905c('0x28')](handleEntityNotFound(_0xd737b8,null))[_0x905c('0x28')](function(_0x408290){if(_0x408290){var _0x10f2a4=_0x408290[_0x905c('0xd4')]({'plain':!![]});fs[_0x905c('0xd5')](_0x2be320);var _0x398daf={'format':'A4','border':'10px','header':{'height':_0x905c('0xd6'),'contents':{'first':_0x905c('0xd7')}},'footer':{'height':_0x905c('0xd8'),'contents':{'default':util[_0x905c('0xbe')](_0x905c('0xd9'),util[_0x905c('0xbe')]('%s\x20#%d',_0x905c('0xda'),_0x10f2a4['id']),moment()[_0x905c('0xbe')](_0x905c('0xdb'))[_0x905c('0x91')]())}}};var _0x21b456={'channel':_0x905c('0xda'),'account':_0x10f2a4[_0x905c('0xd2')][_0x905c('0x2b')],'agent':_0x10f2a4[_0x905c('0xd3')]?_0x10f2a4[_0x905c('0xd3')][_0x905c('0x2e')]:_0x905c('0xdc'),'createdAt':moment(_0x10f2a4[_0x905c('0x72')])['format'](_0x905c('0xbf'))[_0x905c('0x91')](),'closedAt':_0x10f2a4[_0x905c('0xdd')]?moment(_0x10f2a4[_0x905c('0xde')])[_0x905c('0xbe')](_0x905c('0xbf'))[_0x905c('0x91')]():'','disposition':_0x10f2a4[_0x905c('0xdf')],'visibility':_0x10f2a4[_0x905c('0xe0')]?_0x905c('0xe1'):_0x905c('0xe2'),'messages':_(_0x10f2a4[_0x905c('0xd0')])[_0x905c('0x7c')]({'secret':![]})[_0x905c('0x2d')](function(_0x34e8e8){if(_0x34e8e8[_0x905c('0xcf')]){var _0x355ea4=path['join'](_0x58b44b,_0x34e8e8['Attachment'][_0x905c('0xe3')]);if(fs['existsSync'](_0x355ea4)){fs['createReadStream'](_0x355ea4)[_0x905c('0xe4')](fs[_0x905c('0xe5')](path[_0x905c('0xc6')](_0x2be320,_0x34e8e8[_0x905c('0xcf')][_0x905c('0xe3')])));}}return{'date':moment(_0x34e8e8['createdAt'])[_0x905c('0xbe')](_0x905c('0xbf'))[_0x905c('0x91')](),'sender':_0x34e8e8['direction']===_0x905c('0xe6')?_0x34e8e8['User']?_0x34e8e8[_0x905c('0x6b')][_0x905c('0x2e')]:_0x905c('0xe7'):_0x34e8e8[_0x905c('0x5f')][_0x905c('0xe8')]+(_0x34e8e8[_0x905c('0x5f')][_0x905c('0xce')]?'\x20'+_0x34e8e8[_0x905c('0x5f')][_0x905c('0xce')]:''),'body':_0x34e8e8[_0x905c('0xcf')]?_0x34e8e8['Attachment'][_0x905c('0xe3')]:_0x34e8e8['body'],'direction':_0x34e8e8[_0x905c('0xe9')]===_0x905c('0xe6')?'A':'C','secret':_0x34e8e8[_0x905c('0xea')],'read':_0x34e8e8[_0x905c('0x78')],'attachment':_0x34e8e8[_0x905c('0xcf')]};})[_0x905c('0x63')]()};return ejs[_0x905c('0xeb')](path[_0x905c('0xc6')](config[_0x905c('0xca')],_0x905c('0xc7'),_0x905c('0xec'),_0x905c('0xed')),{'interaction':_0x21b456})[_0x905c('0x28')](function(_0x180402){return new BPromise(function(_0x256e3e,_0x3e13ac){pdf[_0x905c('0xb4')](_0x180402,_0x398daf)[_0x905c('0xee')](path['join'](_0x2be320,_0x905c('0xef')+_0x10f2a4['id']+'-'+_0x3e6702+_0x905c('0xf0')),function(_0x277112,_0x2f9474){if(_0x277112)return _0x3e13ac(_0x277112);_0x256e3e(_0x2f9474);});});})[_0x905c('0x28')](function(){return new BPromise(function(_0x3a3bc1,_0x4ac320){zipdir(_0x2be320,{'saveTo':_0x1e466f},function(_0x29e89f,_0x17bd22){if(_0x29e89f)return _0x4ac320(_0x29e89f);return _0x3a3bc1(_0x17bd22);});})[_0x905c('0x28')](function(){return new BPromise(function(_0x21ba5c,_0x9c0e19){rimraf(_0x2be320,function(_0x1a6bd6){if(_0x1a6bd6)_0x9c0e19(_0x1a6bd6);return _0x21ba5c();});});})[_0x905c('0x28')](function(){return _0xd737b8[_0x905c('0xc4')](_0x1e466f,_0xea8bbe,function(_0x40007b){if(_0x40007b){console[_0x905c('0xf1')](_0x905c('0xf2'),_0x40007b);}else{fs[_0x905c('0xf3')](_0x1e466f);}});});});}else{return _0xd737b8[_0x905c('0xf4')](0xc8);}})[_0x905c('0x34')](handleError(_0xd737b8,null));}; \ No newline at end of file +var _0x000a=['openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','Contact','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','text','start','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','role','agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','count','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','all','rows','show','params','include','options','create','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','pick','OpenchannelInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','merge','findAll','setTags','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','transcript-%d-%s.zip','lastName','attachments','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','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','\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','N.A.','closed','disposition','threadId','Public','existsSync','createReadStream','pipe','basename','out','System','firstName','renderFile','downloadInteraction.html','toFile','.pdf','err','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','field','color','from','tools_tags','select','u.id','u.fullname','user_has_openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId'];(function(_0x281714,_0x46e82e){var _0x5ea95d=function(_0x12289a){while(--_0x12289a){_0x281714['push'](_0x281714['shift']());}};_0x5ea95d(++_0x46e82e);}(_0x000a,0x17f));var _0xa000=function(_0x3254ef,_0x3a221b){_0x3254ef=_0x3254ef-0x0;var _0x522ef2=_0x000a[_0x3254ef];return _0x522ef2;};'use strict';var pdf=require(_0xa000('0x0'));var emlformat=require(_0xa000('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa000('0x2'));var rp=require(_0xa000('0x3'));var moment=require(_0xa000('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa000('0x5'));var util=require(_0xa000('0x6'));var path=require(_0xa000('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa000('0x8'));var fs=require('fs');var _=require(_0xa000('0x9'));var squel=require(_0xa000('0xa'));var crypto=require(_0xa000('0xb'));var jsforce=require(_0xa000('0xc'));var deskjs=require(_0xa000('0xd'));var toCsv=require(_0xa000('0xe'));var querystring=require(_0xa000('0xf'));var Papa=require(_0xa000('0x10'));var Redis=require('ioredis');var authService=require(_0xa000('0x11'));var qs=require(_0xa000('0x12'));var as=require(_0xa000('0x13'));var hardwareService=require(_0xa000('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xa000('0x15'));var config=require(_0xa000('0x16'));var licenseUtil=require(_0xa000('0x17'));var db=require(_0xa000('0x18'))['db'];config[_0xa000('0x19')]=_[_0xa000('0x1a')](config['redis'],{'host':_0xa000('0x1b'),'port':0x18eb});var socket=require(_0xa000('0x1c'))(new Redis(config[_0xa000('0x19')]));require('./openchannelInteraction.socket')[_0xa000('0x1d')](socket);function respondWithStatusCode(_0x13bf03,_0x4e508b){_0x4e508b=_0x4e508b||0xcc;return function(_0x45e703){if(_0x45e703){return _0x13bf03[_0xa000('0x1e')](_0x4e508b);}return _0x13bf03[_0xa000('0x1f')](_0x4e508b)[_0xa000('0x20')]();};}function respondWithResult(_0xd33da7,_0x1703f8){_0x1703f8=_0x1703f8||0xc8;return function(_0x5a3542){if(_0x5a3542){return _0xd33da7[_0xa000('0x1f')](_0x1703f8)[_0xa000('0x21')](_0x5a3542);}};}function respondWithFilteredResult(_0x38280d,_0x34231c){return function(_0x43c14b){if(_0x43c14b){var _0x5ab1de=_0x43c14b['count'],_0x2f930c=_0x34231c[_0xa000('0x22')],_0x4b670f=_0x34231c[_0xa000('0x22')]+_0x34231c[_0xa000('0x23')],_0x48f212;if(_0x4b670f>=_0x5ab1de){_0x4b670f=_0x5ab1de;_0x48f212=0xc8;}else{_0x48f212=0xce;}_0x38280d[_0xa000('0x1f')](_0x48f212);return _0x38280d[_0xa000('0x24')](_0xa000('0x25'),_0x2f930c+'-'+_0x4b670f+'/'+_0x5ab1de)['json'](_0x43c14b);}return null;};}function patchUpdates(_0x18a8ef){return function(_0x10a2c9){try{jsonpatch['apply'](_0x10a2c9,_0x18a8ef,!![]);}catch(_0xe7d283){return BPromise[_0xa000('0x26')](_0xe7d283);}return _0x10a2c9[_0xa000('0x27')]();};}function saveUpdates(_0x465dc8,_0x487af8){return function(_0x33f443){if(_0x33f443){return _0x33f443[_0xa000('0x28')](_0x465dc8)[_0xa000('0x29')](function(_0x52c576){return _0x52c576;});}return null;};}function removeEntity(_0x578e2f,_0x4f145e){return function(_0x5e5e38){if(_0x5e5e38){return _0x5e5e38[_0xa000('0x2a')]()['then'](function(){_0x578e2f[_0xa000('0x1f')](0xcc)[_0xa000('0x20')]();});}};}function handleEntityNotFound(_0x555f3e,_0x4fc120){return function(_0x4b5817){if(!_0x4b5817){_0x555f3e[_0xa000('0x1e')](0x194);}return _0x4b5817;};}function handleError(_0x49ac16,_0x5fb49a){_0x5fb49a=_0x5fb49a||0x1f4;return function(_0x5d28f2){logger[_0xa000('0x2b')](_0x5d28f2[_0xa000('0x2c')]);if(_0x5d28f2[_0xa000('0x2d')]){delete _0x5d28f2[_0xa000('0x2d')];}_0x49ac16[_0xa000('0x1f')](_0x5fb49a)[_0xa000('0x2e')](_0x5d28f2);};}function getInteractionUsers(_0xa3f794,_0x2bd0cb){return new BPromise(function(_0x138cd4,_0x233cab){try{if(_0x2bd0cb[_0xa3f794['id']]){_0xa3f794[_0xa000('0x2f')]=_[_0xa000('0x30')](_0x2bd0cb[_0xa3f794['id']],function(_0x52b34c){return{'id':_0x52b34c['id'],'fullname':_0x52b34c[_0xa000('0x31')]};});}}catch(_0x29ee82){_0x233cab(_0x29ee82);}_0x138cd4(_0xa3f794);});}function getInteractionTags(_0x508f24,_0xff90eb){return new BPromise(function(_0x1173c9,_0x3a0178){try{if(_0x508f24[_0xa000('0x32')]){_0x508f24[_0xa000('0x33')]=[];_0x508f24[_0xa000('0x32')]['split'](',')[_0xa000('0x34')](function(_0x2bd993){_0x508f24[_0xa000('0x33')][_0xa000('0x35')](_0xff90eb[_0x2bd993]);});}delete _0x508f24['TagIds'];}catch(_0xfaa646){_0x3a0178(_0xfaa646);}_0x1173c9(_0x508f24);});}function updateOpenchannelInteraction(_0x1bc9bd,_0x5a1c35,_0x5b19a6){return new BPromise(function(_0x1b9331,_0x170942){return getInteractionUsers(_0x1bc9bd,_0x5b19a6)[_0xa000('0x29')](function(_0x1cc5f3){return getInteractionTags(_0x1cc5f3,_0x5a1c35);})[_0xa000('0x29')](function(_0x3c6431){_0x1b9331(_0x3c6431);})[_0xa000('0x36')](function(_0x5dd322){_0x170942(_0x5dd322);});});}exports[_0xa000('0x37')]=function(_0x25fd5e,_0x475d99){var _0x894224={},_0x38f46a={},_0x3f6151={'count':0x0,'rows':[]};var _0x188f4d=_[_0xa000('0x30')](db[_0xa000('0x38')][_0xa000('0x39')],function(_0x1ecf88){return{'name':_0x1ecf88['fieldName'],'type':_0x1ecf88[_0xa000('0x3a')]['key']};});_0x38f46a[_0xa000('0x3b')]=_[_0xa000('0x30')](_0x188f4d,_0xa000('0x2d'));_0x38f46a['query']=_[_0xa000('0x3c')](_0x25fd5e[_0xa000('0x3d')]);_0x38f46a[_0xa000('0x3e')]=_[_0xa000('0x3f')](_0x38f46a[_0xa000('0x3b')],_0x38f46a[_0xa000('0x3d')]);_0x894224['attributes']=_[_0xa000('0x3f')](_0x38f46a[_0xa000('0x3b')],qs[_0xa000('0x40')](_0x25fd5e['query']['fields']));_0x894224[_0xa000('0x41')]=_0x894224[_0xa000('0x41')][_0xa000('0x42')]?_0x894224['attributes']:_0x38f46a[_0xa000('0x3b')];if(!_0x25fd5e[_0xa000('0x3d')][_0xa000('0x43')](_0xa000('0x44'))){_0x894224[_0xa000('0x23')]=qs['limit'](_0x25fd5e['query'][_0xa000('0x23')]);_0x894224[_0xa000('0x22')]=qs[_0xa000('0x22')](_0x25fd5e[_0xa000('0x3d')][_0xa000('0x22')]);}_0x894224[_0xa000('0x45')]=qs[_0xa000('0x46')](_0x25fd5e[_0xa000('0x3d')][_0xa000('0x46')]);_0x894224[_0xa000('0x47')]=qs[_0xa000('0x3e')](_['pick'](_0x25fd5e[_0xa000('0x3d')],_0x38f46a[_0xa000('0x3e')]),_0x188f4d);var _0x6c2cb7=[];var _0x2f8ac3=squel['select']()[_0xa000('0x48')]('id')[_0xa000('0x48')](_0xa000('0x2d'))[_0xa000('0x48')](_0xa000('0x49'))[_0xa000('0x4a')](_0xa000('0x4b'));var _0x3ae4dd=squel[_0xa000('0x4c')]()['field'](_0xa000('0x4d'))[_0xa000('0x48')](_0xa000('0x4e'))[_0xa000('0x48')]('ui.OpenchannelInteractionId')[_0xa000('0x4a')](_0xa000('0x4f'),'ui')[_0xa000('0x50')]('users','u','u.id\x20=\x20ui.UserId');var _0x4f47cb=squel[_0xa000('0x4c')]()[_0xa000('0x4a')]('openchannel_interactions','i')['left_join'](_0xa000('0x51'),'c',_0xa000('0x52'))[_0xa000('0x50')](_0xa000('0x53'),'o',_0xa000('0x54'))[_0xa000('0x50')](_0xa000('0x55'),'a',_0xa000('0x56'))['left_join'](_0xa000('0x57'),'me',_0xa000('0x58'))['left_join'](_0xa000('0x59'),'it',_0xa000('0x5a'))[_0xa000('0x50')]('tools_tags','t',_0xa000('0x5b'));var _0x2e5d1d=squel['expr']();var _0x464da9=[];var _0xa11139=squel[_0xa000('0x5c')]();var _0xf8c818;if(_0x25fd5e[_0xa000('0x3d')]['search']){_0xf8c818=as[_0xa000('0x5d')](_0x25fd5e[_0xa000('0x3d')][_0xa000('0x5e')]);var _0x345ad4=_0xf8c818[_0xa000('0x5f')];for(var _0xce827=0x0;_0xce827<_0xf8c818[_0xa000('0x60')][_0xa000('0x42')];_0xce827++){var _0x521f8b=_0xf8c818[_0xa000('0x60')][_0xce827];var _0x10b017='i';var _0x31b991=_[_0xa000('0x61')](_0x188f4d,[_0xa000('0x2d'),_0x521f8b[_0xa000('0x48')]]);if(!_0x31b991){switch(_0x521f8b[_0xa000('0x48')]){case _0xa000('0x62'):if(_0x521f8b[_0xa000('0x63')]==0x1){_0x4f47cb['having']('`'+_0x521f8b[_0xa000('0x48')]+'`\x20=\x200');}else{_0x4f47cb[_0xa000('0x64')]('`'+_0x521f8b[_0xa000('0x48')]+'`\x20>\x200');}break;case _0xa000('0x65'):if(_0x521f8b['operator']===_0xa000('0x66')){if(_0x521f8b[_0xa000('0x63')][_0xa000('0x67')]('\x20')[_0xa000('0x42')]>0x1){_0x2e5d1d[_0x345ad4](_0xa000('0x68'),qs['getFullTextValue'](_0x521f8b[_0xa000('0x63')]),null);}else{var _0x48db3f='%'+_0x521f8b['value']+'%';_0x2e5d1d[_0x345ad4]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x48db3f,_0x48db3f,_0x48db3f);}}else{_0x31b991=_[_0xa000('0x61')](_0x188f4d,[_0xa000('0x2d'),_0xa000('0x69')]);_0x521f8b[_0xa000('0x48')]=_0xa000('0x69');_0x171ec3=as[_0xa000('0x6a')](_0x10b017,_0x31b991['type'],_0x521f8b);_0x2e5d1d[_0x345ad4](_0x171ec3[_0xa000('0x6b')],_0x171ec3[_0xa000('0x63')][_0xa000('0x6c')],_0x171ec3[_0xa000('0x63')][_0xa000('0x20')]);}break;case'Tag':var _0x1591b5=_0x521f8b['value']['split'](',')[_0xa000('0x30')](function(_0x21772d){return Number(_0x21772d);});_0x1591b5[_0xa000('0x34')](function(_0xba7f1f){_0xa11139['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xba7f1f+',%');});_0x464da9=_[_0xa000('0x6d')](_0x464da9,_0x1591b5);break;case _0xa000('0x6e'):if(_0x521f8b[_0xa000('0x6f')]===_0xa000('0x66')){_0x2e5d1d[_0x345ad4](_0xa000('0x70'),'%'+_0x521f8b['value']+'%',null);}else{_0x31b991=_[_0xa000('0x61')](_0x188f4d,[_0xa000('0x2d'),_0xa000('0x71')]);_0x521f8b[_0xa000('0x48')]=_0xa000('0x71');_0x171ec3=as[_0xa000('0x6a')](_0x10b017,_0x31b991[_0xa000('0x3a')],_0x521f8b);_0x2e5d1d[_0x345ad4](_0x171ec3[_0xa000('0x6b')],_0x171ec3[_0xa000('0x63')][_0xa000('0x6c')],_0x171ec3[_0xa000('0x63')][_0xa000('0x20')]);}break;case _0xa000('0x72'):_0x171ec3=as['buildExpression']('me',null,_0x521f8b);_0x2e5d1d[_0x345ad4](_0x171ec3['text'],_0x171ec3[_0xa000('0x63')]['start'],_0x171ec3[_0xa000('0x63')][_0xa000('0x20')]);break;}}else{var _0x171ec3=as[_0xa000('0x6a')](_0x10b017,_0x31b991['type'],_0x521f8b);_0x2e5d1d[_0x345ad4](_0x171ec3[_0xa000('0x6b')],_0x171ec3[_0xa000('0x63')]['start'],_0x171ec3[_0xa000('0x63')][_0xa000('0x20')]);}}}else{var _0xe76222=_(_0x25fd5e[_0xa000('0x3d')])['keys']()[_0xa000('0x30')](function(_0x48735a){return _['some'](_0x188f4d,[_0xa000('0x2d'),_0x48735a])?_0x48735a:undefined;})['compact']()[_0xa000('0x63')]();if(!_[_0xa000('0x73')](_0xe76222)){_0xe76222[_0xa000('0x34')](function(_0x5f25b9){if(_0x5f25b9===_0xa000('0x74')){_0x4f47cb[_0xa000('0x47')](_0xa000('0x75'),[][_0xa000('0x76')](_0x25fd5e[_0xa000('0x3d')][_0x5f25b9]));}else if(_0x5f25b9===_0xa000('0x77')){var _0x2e5d6b=JSON[_0xa000('0x78')](_0x25fd5e['query'][_0x5f25b9])[_0xa000('0x79')];var _0x3de8b2=JSON[_0xa000('0x78')](_0x25fd5e[_0xa000('0x3d')][_0x5f25b9])[_0xa000('0x7a')];_0x4f47cb[_0xa000('0x47')](_0xa000('0x7b'),_0x2e5d6b,_0x3de8b2);}else{if(_0x25fd5e[_0xa000('0x3d')][_0x5f25b9]==='null'){_0x4f47cb[_0xa000('0x47')]('i.'+_0x5f25b9+_0xa000('0x7c'));}else{_0x4f47cb[_0xa000('0x47')]('i.'+_0x5f25b9+_0xa000('0x7d'),_0x25fd5e['query'][_0x5f25b9]);}}});}if(_0x25fd5e[_0xa000('0x3d')]['read']){if(_0x25fd5e[_0xa000('0x3d')][_0xa000('0x7e')]==0x1){_0x4f47cb[_0xa000('0x64')](_0xa000('0x7f'));}else{_0x4f47cb[_0xa000('0x64')]('`unreadMessages`\x20>\x200');}}if(_0x25fd5e[_0xa000('0x3d')][_0xa000('0x80')]){_0x464da9=_[_0xa000('0x81')](_0x25fd5e[_0xa000('0x3d')][_0xa000('0x80')])?_0x25fd5e[_0xa000('0x3d')][_0xa000('0x80')]:new Array(_0x25fd5e[_0xa000('0x3d')][_0xa000('0x80')]);_0x464da9['forEach'](function(_0x3dfe0f){_0xa11139['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3dfe0f+',%');});}if(_0x25fd5e['query']['filter']){var _0x4753e5=_0x25fd5e[_0xa000('0x3d')][_0xa000('0x82')]['replace']('\x5c','\x5c\x5c')[_0xa000('0x83')](/'/g,'\x27\x27');if(qs[_0xa000('0x84')](_0x4753e5)){_0x2e5d1d['or']('i.id\x20LIKE\x20?',_0x4753e5+'%');}else{_0x2e5d1d['or'](_0xa000('0x85'),qs[_0xa000('0x86')](_0x4753e5))['or'](_0xa000('0x87'),_0x4753e5+'%')['or'](_0xa000('0x88'),_0x4753e5+'%');}}}_0x4f47cb[_0xa000('0x47')](_0x2e5d1d);_0x4f47cb[_0xa000('0x89')](_0xa000('0x8a'));var _0x10f869={'type':db['Sequelize'][_0xa000('0x8b')][_0xa000('0x8c')],'raw':!![]};var _0x3879dc=_0x4f47cb[_0xa000('0x8d')]();_0x3879dc[_0xa000('0x48')](_0xa000('0x8a'));_0x3879dc['field'](_0xa000('0x8e'),_0xa000('0x62'));if(_0x894224['order']){_0x894224[_0xa000('0x45')][_0xa000('0x34')](function(_0xb5d90){var _0x499fc7=_0xb5d90[0x0]===_0xa000('0x8f')?_0xb5d90[0x0]:'i.'+_0xb5d90[0x0];_0x4f47cb[_0xa000('0x45')](_0x499fc7,_0xb5d90[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x464da9)){_0x4f47cb['having'](_0xa11139);_0x3879dc[_0xa000('0x47')]('t.id\x20IN\x20?',_0x464da9);}BPromise['resolve']()[_0xa000('0x29')](function(){if(!_0xf8c818){if(_0x25fd5e['query'][_0xa000('0x74')])return;_0x3879dc[_0xa000('0x47')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x4f47cb['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x25fd5e['user'][_0xa000('0x90')]!==_0xa000('0x91'))return;return _0x25fd5e[_0xa000('0x92')][_0xa000('0x93')]({'attributes':['id'],'raw':!![]})[_0xa000('0x29')](function(_0x1372d2){if(_[_0xa000('0x73')](_0x1372d2)){_0x3879dc[_0xa000('0x47')](_0xa000('0x94'));_0x4f47cb[_0xa000('0x47')](_0xa000('0x94'));}else{_0x3879dc[_0xa000('0x47')](_0xa000('0x75'),_['map'](_0x1372d2,'id'));_0x4f47cb['where'](_0xa000('0x75'),_[_0xa000('0x30')](_0x1372d2,'id'));}});})[_0xa000('0x29')](function(){if(_0x25fd5e['user'][_0xa000('0x90')]===_0xa000('0x91')&&!_0xf8c818&&!_0x25fd5e[_0xa000('0x3d')][_0xa000('0x74')])return[];return db[_0xa000('0x95')][_0xa000('0x3d')](_0x3879dc[_0xa000('0x96')](),_0x10f869);})[_0xa000('0x29')](function(_0x3ae1c5){_0x3f6151[_0xa000('0x97')]=_0x3ae1c5[_0xa000('0x42')];if(_0x3f6151['count']===0x0)return[];return db[_0xa000('0x95')][_0xa000('0x3d')](_0x2f8ac3[_0xa000('0x96')](),_0x10f869)[_0xa000('0x29')](function(_0xe51ed1){_0x6c2cb7=_['keyBy'](_0xe51ed1,'id');_0x10f869=_['merge'](_0x10f869,{'model':db[_0xa000('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x25fd5e[_0xa000('0x3d')][_0xa000('0x40')]){_0x894224['attributes']['forEach'](function(_0x43f18f){_0x4f47cb[_0xa000('0x48')]('i.'+_0x43f18f);});}else{_0x4f47cb[_0xa000('0x48')](_0xa000('0x8e'),_0xa000('0x62'));_0x4f47cb['field'](_0xa000('0x98'),'Account.key');_0x4f47cb[_0xa000('0x48')](_0xa000('0x99'),_0xa000('0x9a'));_0x4f47cb[_0xa000('0x48')]('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',_0xa000('0x8f'));_0x4f47cb[_0xa000('0x48')](_0xa000('0x9b'));_0x4f47cb['field'](_0xa000('0x9c'),_0xa000('0x9d'));_0x4f47cb[_0xa000('0x48')](_0xa000('0x9e'),'Contact.lastName');_0x4f47cb['field']('c.email','Contact.email');_0x4f47cb[_0xa000('0x48')](_0xa000('0x9f'),_0xa000('0xa0'));_0x4f47cb['field'](_0xa000('0xa1'),'Contact.mobile');_0x4f47cb['field'](_0xa000('0xa2'),_0xa000('0xa3'));_0x4f47cb[_0xa000('0x48')](_0xa000('0xa4'),_0xa000('0xa5'));_0x4f47cb[_0xa000('0x48')](_0xa000('0xa6'),'Owner.internal');_0x4f47cb[_0xa000('0x48')](_0xa000('0xa7'),'TagIds');}if(_0x894224[_0xa000('0x23')])_0x4f47cb[_0xa000('0x23')](_0x894224[_0xa000('0x23')]);if(_0x894224[_0xa000('0x22')])_0x4f47cb[_0xa000('0x22')](_0x894224[_0xa000('0x22')]);return db[_0xa000('0x95')][_0xa000('0x3d')](_0x4f47cb[_0xa000('0x96')](),_0x10f869);})[_0xa000('0x29')](function(_0x58f676){_0x3ae4dd[_0xa000('0x47')](_0xa000('0xa8'),_[_0xa000('0x30')](_0x58f676,'id'));return db[_0xa000('0x95')][_0xa000('0x3d')](_0x3ae4dd[_0xa000('0x96')](),_0x10f869)['then'](function(_0x5b98f1){var _0x3e9f74=_[_0xa000('0xa9')](_0x5b98f1,'OpenchannelInteractionId');var _0x36df70=[];_0x58f676['forEach'](function(_0x144897){_0x36df70[_0xa000('0x35')](updateOpenchannelInteraction(_0x144897,_0x6c2cb7,_0x3e9f74));});return BPromise[_0xa000('0xaa')](_0x36df70);});});})[_0xa000('0x29')](function(_0x14c0e0){_0x3f6151[_0xa000('0xab')]=_0x14c0e0;return _0x3f6151;})[_0xa000('0x29')](respondWithFilteredResult(_0x475d99,_0x894224))[_0xa000('0x36')](handleError(_0x475d99,null));};exports[_0xa000('0xac')]=function(_0x17a5e7,_0x569dd2){var _0x40ff17={};if(_0x17a5e7[_0xa000('0x3d')][_0xa000('0x3a')]&&_0x17a5e7['query'][_0xa000('0x3a')]===_0xa000('0x4a')){_0x40ff17['from']=_0x17a5e7['params']['id'];}else{_0x40ff17['id']=_0x17a5e7[_0xa000('0xad')]['id'];}var _0x56c412={'raw':![],'where':_0x40ff17},_0x2e09af={};_0x2e09af[_0xa000('0x3b')]=_[_0xa000('0x3c')](db[_0xa000('0x38')][_0xa000('0x39')]);_0x2e09af[_0xa000('0x3d')]=_['keys'](_0x17a5e7['query']);_0x2e09af['filters']=_[_0xa000('0x3f')](_0x2e09af['model'],_0x2e09af[_0xa000('0x3d')]);_0x56c412[_0xa000('0x41')]=_[_0xa000('0x3f')](_0x2e09af['model'],qs['fields'](_0x17a5e7['query'][_0xa000('0x40')]));_0x56c412[_0xa000('0x41')]=_0x56c412[_0xa000('0x41')]['length']?_0x56c412[_0xa000('0x41')]:_0x2e09af[_0xa000('0x3b')];if(_0x17a5e7[_0xa000('0x3d')]['includeAll']){_0x56c412[_0xa000('0xae')]=[{'all':!![]}];}_0x56c412=_['merge']({},_0x56c412,_0x17a5e7[_0xa000('0xaf')]);return db[_0xa000('0x38')][_0xa000('0x61')](_0x56c412)[_0xa000('0x29')](handleEntityNotFound(_0x569dd2,null))[_0xa000('0x29')](respondWithResult(_0x569dd2,null))[_0xa000('0x36')](handleError(_0x569dd2,null));};exports['create']=function(_0x3ac3eb,_0x4c0fd1){return db['OpenchannelInteraction'][_0xa000('0xb0')](_0x3ac3eb[_0xa000('0x72')],{})[_0xa000('0x29')](respondWithResult(_0x4c0fd1,0xc9))[_0xa000('0x36')](handleError(_0x4c0fd1,null));};exports['update']=function(_0x3b4b4a,_0x202822){if(_0x3b4b4a[_0xa000('0x72')]['id']){delete _0x3b4b4a[_0xa000('0x72')]['id'];}return db[_0xa000('0x38')]['find']({'where':{'id':_0x3b4b4a['params']['id']}})[_0xa000('0x29')](handleEntityNotFound(_0x202822,null))[_0xa000('0x29')](saveUpdates(_0x3b4b4a[_0xa000('0x72')],null))[_0xa000('0x29')](respondWithResult(_0x202822,null))[_0xa000('0x36')](handleError(_0x202822,null));};exports[_0xa000('0x2a')]=function(_0x4ec748,_0x3f87ec){return db[_0xa000('0x38')][_0xa000('0x61')]({'where':{'id':_0x4ec748[_0xa000('0xad')]['id']}})['then'](handleEntityNotFound(_0x3f87ec,null))[_0xa000('0x29')](removeEntity(_0x3f87ec,null))[_0xa000('0x36')](handleError(_0x3f87ec,null));};exports[_0xa000('0xb1')]=function(_0x7655fe,_0x3a1406){return db['OpenchannelInteraction'][_0xa000('0xb1')]()['then'](respondWithResult(_0x3a1406,null))[_0xa000('0x36')](handleError(_0x3a1406,null));};exports[_0xa000('0xb2')]=function(_0x442f3b,_0x2d7f0d,_0x2e97ea){return db[_0xa000('0xb3')][_0xa000('0x61')]({'where':{'id':_0x442f3b[_0xa000('0xad')]['id']}})[_0xa000('0x29')](handleEntityNotFound(_0x2d7f0d,null))['then'](function(_0x5d983d){if(_0x5d983d){return _0x5d983d[_0xa000('0xb2')](_0x442f3b[_0xa000('0x72')][_0xa000('0xb4')],_[_0xa000('0xb5')](_0x442f3b[_0xa000('0x72')],[_0xa000('0xb4'),'id'])||{});}})[_0xa000('0x29')](respondWithResult(_0x2d7f0d,null))[_0xa000('0x36')](handleError(_0x2d7f0d,null));};exports[_0xa000('0xb6')]=function(_0x463f02,_0x51a2b0,_0x5b8bf3){var _0x1d6865={'raw':![],'where':{}};var _0x33c3bc={};var _0x11c657={'count':0x0,'rows':[]};return db[_0xa000('0x38')][_0xa000('0xb7')]({'where':{'id':_0x463f02['params']['id']}})[_0xa000('0x29')](handleEntityNotFound(_0x51a2b0,null))[_0xa000('0x29')](function(_0x39d231){if(_0x39d231){_0x33c3bc[_0xa000('0x3b')]=_['keys'](db[_0xa000('0xb3')][_0xa000('0x39')]);_0x33c3bc[_0xa000('0x3d')]=_[_0xa000('0x3c')](_0x463f02[_0xa000('0x3d')]);_0x33c3bc['filters']=_[_0xa000('0x3f')](_0x33c3bc['model'],_0x33c3bc[_0xa000('0x3d')]);_0x1d6865['attributes']=_[_0xa000('0x3f')](_0x33c3bc['model'],qs[_0xa000('0x40')](_0x463f02[_0xa000('0x3d')]['fields']));_0x1d6865['attributes']=_0x1d6865[_0xa000('0x41')][_0xa000('0x42')]?_0x1d6865[_0xa000('0x41')]:_0x33c3bc['model'];if(!_0x463f02[_0xa000('0x3d')][_0xa000('0x43')](_0xa000('0x44'))){_0x1d6865['limit']=qs[_0xa000('0x23')](_0x463f02[_0xa000('0x3d')]['limit']);_0x1d6865[_0xa000('0x22')]=qs[_0xa000('0x22')](_0x463f02[_0xa000('0x3d')][_0xa000('0x22')]);}_0x1d6865['order']=qs[_0xa000('0x46')](_0x463f02['query'][_0xa000('0x46')]);_0x1d6865[_0xa000('0x47')]=qs[_0xa000('0x3e')](_[_0xa000('0xb8')](_0x463f02[_0xa000('0x3d')],_0x33c3bc[_0xa000('0x3e')]));_0x1d6865[_0xa000('0x47')][_0xa000('0xb9')]=_0x39d231['id'];if(_0x463f02[_0xa000('0x3d')][_0xa000('0x82')]){_0x1d6865[_0xa000('0x47')]=_['merge'](_0x1d6865[_0xa000('0x47')],{'$or':_[_0xa000('0x30')](_0x1d6865[_0xa000('0x41')],function(_0x1205c1){var _0x1f57be={};_0x1f57be[_0x1205c1]={'$like':'%'+_0x463f02['query']['filter']+'%'};return _0x1f57be;})});}if(_0x463f02[_0xa000('0x3d')][_0xa000('0x79')]){var _0x5620c5=_0x463f02[_0xa000('0x3d')]['$gte']['split'](',');var _0x3febf0={};_0x3febf0[_0x5620c5[0x0]]={'$gte':moment(_0x5620c5[0x1])[_0xa000('0xba')](_0xa000('0xbb'))};_0x1d6865['where']=_[_0xa000('0xbc')](_0x1d6865[_0xa000('0x47')],_0x3febf0);}_0x1d6865=_[_0xa000('0xbc')]({},_0x1d6865,_0x463f02[_0xa000('0xaf')]);return db[_0xa000('0xb3')][_0xa000('0x97')]({'where':_0x1d6865[_0xa000('0x47')]})[_0xa000('0x29')](function(_0x36d7b0){_0x11c657[_0xa000('0x97')]=_0x36d7b0;if(_0x463f02[_0xa000('0x3d')]['includeAll']){_0x1d6865['include']=[{'all':!![]}];}return db[_0xa000('0xb3')][_0xa000('0xbd')](_0x1d6865);})[_0xa000('0x29')](function(_0x44adb4){_0x11c657[_0xa000('0xab')]=_0x44adb4;return _0x11c657;});}})['then'](respondWithFilteredResult(_0x51a2b0,_0x1d6865))[_0xa000('0x36')](handleError(_0x51a2b0,null));};exports['addTags']=function(_0x525ecd,_0x5d2ff1,_0x5695f9){return db[_0xa000('0x38')][_0xa000('0x61')]({'where':{'id':_0x525ecd[_0xa000('0xad')]['id']}})[_0xa000('0x29')](handleEntityNotFound(_0x5d2ff1,null))[_0xa000('0x29')](function(_0x1a1039){if(_0x1a1039){return _0x1a1039[_0xa000('0xbe')](_0x525ecd[_0xa000('0x72')][_0xa000('0xb4')],_[_0xa000('0xb5')](_0x525ecd[_0xa000('0x72')],[_0xa000('0xb4'),'id'])||{})[_0xa000('0xbf')](function(){return db[_0xa000('0xc0')][_0xa000('0xbd')]({'attributes':['id',_0xa000('0x2d'),_0xa000('0x49')],'where':{'id':_0x525ecd['body']['ids']}});})['then'](function(_0x3d676c){socket[_0xa000('0xc1')](_0xa000('0xc2'),{'id':Number(_0x525ecd[_0xa000('0xad')]['id']),'tags':_0x3d676c||[]});return{'id':Number(_0x525ecd[_0xa000('0xad')]['id']),'tags':_0x3d676c||[]};});}})[_0xa000('0x29')](respondWithResult(_0x5d2ff1,null))[_0xa000('0x36')](handleError(_0x5d2ff1,null));};exports[_0xa000('0xc3')]=function(_0x4fa82c,_0x2b2242,_0x3a284f){return db[_0xa000('0x38')][_0xa000('0x61')]({'where':{'id':_0x4fa82c[_0xa000('0xad')]['id']}})[_0xa000('0x29')](handleEntityNotFound(_0x2b2242,null))['then'](function(_0x403648){if(_0x403648){return _0x403648['removeTags'](_0x4fa82c['query']['ids']);}})[_0xa000('0x29')](respondWithStatusCode(_0x2b2242,null))[_0xa000('0x36')](handleError(_0x2b2242,null));};exports[_0xa000('0xc4')]=function(_0x34d6e3,_0x1490f3){var _0xcd79b1=moment()[_0xa000('0xc5')]()[_0xa000('0x96')]();var _0x3a0012=path[_0xa000('0xc6')](config[_0xa000('0xc7')],_0xa000('0xc8'),_0xa000('0xc9'),'tmp');var _0x4d99de=path[_0xa000('0xc6')](config[_0xa000('0xc7')],_0xa000('0xc8'),'files','attachments');var _0x5f0cab=path[_0xa000('0xc6')](_0x3a0012,_0xcd79b1);var _0x427704=util['format'](_0xa000('0xca'),_0x34d6e3[_0xa000('0xad')]['id'],_0xcd79b1);var _0xb3284=path['join'](_0x3a0012,_0x427704);var _0x54dc6b=[];_0x54dc6b[_0xa000('0x35')]({'model':db[_0xa000('0x6e')],'as':'User','attributes':['id',_0xa000('0x31')],'raw':!![]});_0x54dc6b[_0xa000('0x35')]({'model':db['CmContact'],'as':_0xa000('0x65'),'attributes':['id','firstName',_0xa000('0xcb')],'raw':!![]});if(_0x34d6e3[_0xa000('0x3d')][_0xa000('0xcc')]){_0x54dc6b[_0xa000('0x35')]({'model':db[_0xa000('0xcd')],'as':_0xa000('0xcd'),'raw':!![]});}var _0x1e2c97=[{'model':db[_0xa000('0xb3')],'as':_0xa000('0xce'),'attributes':['id','body','createdAt',_0xa000('0xcf'),_0xa000('0xd0'),_0xa000('0x7e')],'include':_0x54dc6b}];_0x1e2c97[_0xa000('0x35')]({'model':db[_0xa000('0xd1')],'as':_0xa000('0xd2'),'attributes':['id',_0xa000('0x2d')]});_0x1e2c97[_0xa000('0x35')]({'model':db['User'],'as':_0xa000('0xd3'),'attributes':['id',_0xa000('0x31')]});return db['OpenchannelInteraction'][_0xa000('0x61')]({'where':{'id':_0x34d6e3['params']['id']},'include':_0x1e2c97})['then'](handleEntityNotFound(_0x1490f3,null))[_0xa000('0x29')](function(_0xabbcc6){if(_0xabbcc6){var _0x5b68ee=_0xabbcc6['get']({'plain':!![]});fs['mkdirSync'](_0x5f0cab);var _0x425405={'format':'A4','border':_0xa000('0xd4'),'header':{'height':_0xa000('0xd5'),'contents':{'first':_0xa000('0xd6')}},'footer':{'height':'30px','contents':{'default':util[_0xa000('0xba')](_0xa000('0xd7'),util[_0xa000('0xba')](_0xa000('0xd8'),_0xa000('0xd9'),_0x5b68ee['id']),moment()[_0xa000('0xba')]('YYYY-MM-DD')['toString']())}}};var _0x488727={'channel':'Openchannel','account':_0x5b68ee[_0xa000('0xd2')][_0xa000('0x2d')],'agent':_0x5b68ee[_0xa000('0xd3')]?_0x5b68ee[_0xa000('0xd3')][_0xa000('0x31')]:_0xa000('0xda'),'createdAt':moment(_0x5b68ee[_0xa000('0x77')])[_0xa000('0xba')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa000('0x96')](),'closedAt':_0x5b68ee[_0xa000('0xdb')]?moment(_0x5b68ee['closedAt'])[_0xa000('0xba')](_0xa000('0xbb'))[_0xa000('0x96')]():'','disposition':_0x5b68ee[_0xa000('0xdc')],'visibility':_0x5b68ee[_0xa000('0xdd')]?_0xa000('0xde'):'Private','messages':_(_0x5b68ee[_0xa000('0xce')])[_0xa000('0x82')]({'secret':![]})[_0xa000('0x30')](function(_0x3bb0f2){if(_0x3bb0f2[_0xa000('0xcd')]){var _0x4292d8=path[_0xa000('0xc6')](_0x4d99de,_0x3bb0f2[_0xa000('0xcd')]['basename']);if(fs[_0xa000('0xdf')](_0x4292d8)){fs[_0xa000('0xe0')](_0x4292d8)[_0xa000('0xe1')](fs['createWriteStream'](path[_0xa000('0xc6')](_0x5f0cab,_0x3bb0f2['Attachment'][_0xa000('0xe2')])));}}return{'date':moment(_0x3bb0f2[_0xa000('0x77')])[_0xa000('0xba')](_0xa000('0xbb'))['toString'](),'sender':_0x3bb0f2['direction']===_0xa000('0xe3')?_0x3bb0f2[_0xa000('0x6e')]?_0x3bb0f2[_0xa000('0x6e')][_0xa000('0x31')]:_0xa000('0xe4'):_0x3bb0f2[_0xa000('0x65')][_0xa000('0xe5')]+(_0x3bb0f2[_0xa000('0x65')][_0xa000('0xcb')]?'\x20'+_0x3bb0f2[_0xa000('0x65')][_0xa000('0xcb')]:''),'body':_0x3bb0f2[_0xa000('0xcd')]?_0x3bb0f2[_0xa000('0xcd')][_0xa000('0xe2')]:_0x3bb0f2['body'],'direction':_0x3bb0f2[_0xa000('0xcf')]===_0xa000('0xe3')?'A':'C','secret':_0x3bb0f2['secret'],'read':_0x3bb0f2[_0xa000('0x7e')],'attachment':_0x3bb0f2[_0xa000('0xcd')]};})['value']()};return ejs[_0xa000('0xe6')](path[_0xa000('0xc6')](config[_0xa000('0xc7')],'server','views',_0xa000('0xe7')),{'interaction':_0x488727})[_0xa000('0x29')](function(_0x3c7356){return new BPromise(function(_0x507696,_0x37dd8c){pdf[_0xa000('0xb0')](_0x3c7356,_0x425405)[_0xa000('0xe8')](path[_0xa000('0xc6')](_0x5f0cab,'transcript-'+_0x5b68ee['id']+'-'+_0xcd79b1+_0xa000('0xe9')),function(_0x251793,_0x25efbd){if(_0x251793)return _0x37dd8c(_0x251793);_0x507696(_0x25efbd);});});})[_0xa000('0x29')](function(){return new BPromise(function(_0x1b3769,_0x34975f){zipdir(_0x5f0cab,{'saveTo':_0xb3284},function(_0x2770ef,_0xe975c0){if(_0x2770ef)return _0x34975f(_0x2770ef);return _0x1b3769(_0xe975c0);});})['then'](function(){return new BPromise(function(_0x2f8fa4,_0x4693de){rimraf(_0x5f0cab,function(_0x5401fe){if(_0x5401fe)_0x4693de(_0x5401fe);return _0x2f8fa4();});});})[_0xa000('0x29')](function(){return _0x1490f3[_0xa000('0xc4')](_0xb3284,_0x427704,function(_0x35b727){if(_0x35b727){console['log'](_0xa000('0xea'),_0x35b727);}else{fs['unlinkSync'](_0xb3284);}});});});}else{return _0x1490f3[_0xa000('0x1e')](0xc8);}})['catch'](handleError(_0x1490f3,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 2f4ac1d..edc5b28 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 _0xe59d=['then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x5b3e72,_0x1ddf3c){var _0x2c5677=function(_0xf4eb9a){while(--_0xf4eb9a){_0x5b3e72['push'](_0x5b3e72['shift']());}};_0x2c5677(++_0x1ddf3c);}(_0xe59d,0x173));var _0xde59=function(_0x26bfb0,_0x5b0ffc){_0x26bfb0=_0x26bfb0-0x0;var _0x4454b3=_0xe59d[_0x26bfb0];return _0x4454b3;};'use strict';var EventEmitter=require(_0xde59('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xde59('0x1')];var OpenchannelMessage=require(_0xde59('0x2'))['db'][_0xde59('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xde59('0x4')](0x0);var events={'afterCreate':_0xde59('0x5'),'afterUpdate':_0xde59('0x6'),'afterDestroy':_0xde59('0x7')};function emitEvent(_0xcaea3){return function(_0x1a8fb7,_0x3aee93,_0x4d768d){_0x1a8fb7[_0xde59('0x8')]({'attributes':['id'],'raw':!![]})[_0xde59('0x9')](function(_0x31d141){_0x1a8fb7[_0xde59('0xa')](_0xde59('0xb'),_0x31d141[_0xde59('0xc')](function(_0x188511){return{'id':_0x188511['id']};}));return OpenchannelMessage[_0xde59('0xd')]({'where':{'OpenchannelInteractionId':_0x1a8fb7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xde59('0x9')](function(_0x555f3f){_0x1a8fb7[_0xde59('0xa')]('unreadMessages',_0x555f3f[_0xde59('0xe')]);OpenchannelInteractionEvents[_0xde59('0xf')](_0xcaea3+':'+_0x1a8fb7['id'],_0x1a8fb7);OpenchannelInteractionEvents['emit'](_0xcaea3,_0x1a8fb7);_0x4d768d(null);})[_0xde59('0x10')](_0x4d768d(null));};}for(var e in events){if(events[_0xde59('0x11')](e)){var event=events[e];OpenchannelInteraction[_0xde59('0x12')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xfe4c=['then','Users','map','setDataValue','length','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','getUsers'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xfe4c,0x1da));var _0xcfe4=function(_0x3af532,_0x1434d1){_0x3af532=_0x3af532-0x0;var _0x2e4598=_0xfe4c[_0x3af532];return _0x2e4598;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xcfe4('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xcfe4('0x0'))['db'][_0xcfe4('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xcfe4('0x2')](0x0);var events={'afterCreate':_0xcfe4('0x3'),'afterUpdate':_0xcfe4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4ba70a){return function(_0x2d2dd3,_0x28000b,_0x438750){_0x2d2dd3[_0xcfe4('0x5')]({'attributes':['id'],'raw':!![]})[_0xcfe4('0x6')](function(_0x1a671f){_0x2d2dd3['setDataValue'](_0xcfe4('0x7'),_0x1a671f[_0xcfe4('0x8')](function(_0x3d4219){return{'id':_0x3d4219['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x2d2dd3['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5f0248){_0x2d2dd3[_0xcfe4('0x9')]('unreadMessages',_0x5f0248[_0xcfe4('0xa')]);OpenchannelInteractionEvents[_0xcfe4('0xb')](_0x4ba70a+':'+_0x2d2dd3['id'],_0x2d2dd3);OpenchannelInteractionEvents['emit'](_0x4ba70a,_0x2d2dd3);_0x438750(null);})['catch'](_0x438750(null));};}for(var e in events){if(events[_0xcfe4('0xc')](e)){var event=events[e];OpenchannelInteraction[_0xcfe4('0xd')](e,emitEvent(event));}}module[_0xcfe4('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index f28672e..5639301 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 _0x326f=['openchannel_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x326f,0xd1));var _0xf326=function(_0x69d1ea,_0x541e88){_0x69d1ea=_0x69d1ea-0x0;var _0x2f4ab5=_0x326f[_0x69d1ea];return _0x2f4ab5;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e7b8a,_0x515bfa,_0x4c206c){if(_0x1e7b8a['changed'](_0xf326('0xd'))){_0x1e7b8a[_0xf326('0xe')]=moment()[_0xf326('0xf')](_0xf326('0x10'));}_0x4c206c(null,_0x1e7b8a);}}});}; \ No newline at end of file +var _0x02a7=['define','OpenchannelInteraction','openchannel_interactions','changed','closedAt','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x02a7,0x7a));var _0x702a=function(_0x5717ac,_0x21f489){_0x5717ac=_0x5717ac-0x0;var _0x37a79f=_0x02a7[_0x5717ac];return _0x37a79f;};'use strict';var _=require('lodash');var util=require(_0x702a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x702a('0x1'));var BPromise=require(_0x702a('0x2'));var rp=require(_0x702a('0x3'));var fs=require('fs');var path=require(_0x702a('0x4'));var rimraf=require(_0x702a('0x5'));var config=require(_0x702a('0x6'));var attributes=require(_0x702a('0x7'));module['exports']=function(_0x1bcfe5,_0x5b7d8c){return _0x1bcfe5[_0x702a('0x8')](_0x702a('0x9'),attributes,{'tableName':_0x702a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x161dee,_0x430cf3,_0x20c009){if(_0x161dee[_0x702a('0xb')]('closed')){_0x161dee[_0x702a('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x20c009(null,_0x161dee);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 0435553..79e15cf 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 _0x1edb=['redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelInteraction','body','options','limit','AddTagsToOpenchannelInteraction','OpenchannelInteraction','addTags','ids','omit','info','AddTags','lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x35ead7,_0x453d3a){var _0x33b761=function(_0x1c28b9){while(--_0x1c28b9){_0x35ead7['push'](_0x35ead7['shift']());}};_0x33b761(++_0x453d3a);}(_0x1edb,0x169));var _0xb1ed=function(_0x581ea5,_0x1a885c){_0x581ea5=_0x581ea5-0x0;var _0x47b178=_0x1edb[_0x581ea5];return _0x47b178;};'use strict';var _=require(_0xb1ed('0x0'));var util=require(_0xb1ed('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb1ed('0x2'));var fs=require('fs');var Redis=require(_0xb1ed('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb1ed('0x4'));var logger=require('../../config/logger')(_0xb1ed('0x5'));var config=require(_0xb1ed('0x6'));var jayson=require(_0xb1ed('0x7'));var client=jayson['client'][_0xb1ed('0x8')]({'port':0x232a});config[_0xb1ed('0x9')]=_[_0xb1ed('0xa')](config['redis'],{'host':_0xb1ed('0xb'),'port':0x18eb});var socket=require(_0xb1ed('0xc'))(new Redis(config['redis']));require(_0xb1ed('0xd'))[_0xb1ed('0xe')](socket);function respondWithRpcPromise(_0x48cc7e,_0x472419,_0x17cf43){return new BPromise(function(_0xe7e598,_0x3606ce){return client[_0xb1ed('0xf')](_0x48cc7e,_0x17cf43)[_0xb1ed('0x10')](function(_0x56aa1b){logger['info'](_0xb1ed('0x11'),_0x472419,_0xb1ed('0x12'));logger[_0xb1ed('0x13')](_0xb1ed('0x14'),_0x472419,_0xb1ed('0x12'),JSON[_0xb1ed('0x15')](_0x56aa1b));if(_0x56aa1b['error']){if(_0x56aa1b[_0xb1ed('0x16')]['code']===0x1f4){logger[_0xb1ed('0x16')](_0xb1ed('0x11'),_0x472419,_0x56aa1b[_0xb1ed('0x16')][_0xb1ed('0x17')]);return _0x3606ce(_0x56aa1b[_0xb1ed('0x16')][_0xb1ed('0x17')]);}logger[_0xb1ed('0x16')](_0xb1ed('0x11'),_0x472419,_0x56aa1b[_0xb1ed('0x16')][_0xb1ed('0x17')]);return _0xe7e598(_0x56aa1b[_0xb1ed('0x16')][_0xb1ed('0x17')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x472419,_0xb1ed('0x12'));_0xe7e598(_0x56aa1b[_0xb1ed('0x18')]['message']);}})[_0xb1ed('0x19')](function(_0x2b8351){logger['error'](_0xb1ed('0x11'),_0x472419,_0x2b8351);_0x3606ce(_0x2b8351);});});}exports[_0xb1ed('0x1a')]=function(_0x36f97a){var _0x26ccd3=this;return new Promise(function(_0x43d592,_0x58acc0){return db['OpenchannelInteraction']['update'](_0x36f97a[_0xb1ed('0x1b')],{'raw':_0x36f97a[_0xb1ed('0x1c')]?_0x36f97a[_0xb1ed('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36f97a['options']?_0x36f97a[_0xb1ed('0x1c')]['where']||null:null,'attributes':_0x36f97a[_0xb1ed('0x1c')]?_0x36f97a['options']['attributes']||null:null,'limit':_0x36f97a[_0xb1ed('0x1c')]?_0x36f97a[_0xb1ed('0x1c')][_0xb1ed('0x1d')]||null:null})[_0xb1ed('0x10')](function(_0x555ca5){logger['info'](_0xb1ed('0x1a'),_0x36f97a);logger[_0xb1ed('0x13')](_0xb1ed('0x1a'),_0x36f97a,JSON[_0xb1ed('0x15')](_0x555ca5));_0x43d592(_0x555ca5);})[_0xb1ed('0x19')](function(_0x3cf982){logger[_0xb1ed('0x16')](_0xb1ed('0x1a'),_0x3cf982['message'],_0x36f97a);_0x58acc0(_0x26ccd3[_0xb1ed('0x16')](0x1f4,_0x3cf982[_0xb1ed('0x17')]));});});};exports[_0xb1ed('0x1e')]=function(_0x147a75){return new Promise(function(_0x1fee73,_0x2c068c){return db[_0xb1ed('0x1f')]['find']({'where':_0x147a75[_0xb1ed('0x1c')]?_0x147a75[_0xb1ed('0x1c')]['where']||null:null})[_0xb1ed('0x10')](function(_0x15684a){if(_0x15684a){return _0x15684a[_0xb1ed('0x20')](_0x147a75[_0xb1ed('0x1b')][_0xb1ed('0x21')],_[_0xb1ed('0x22')](_0x147a75[_0xb1ed('0x1b')],['ids','id'])||{});}})['spread'](function(_0xd13ff7){logger[_0xb1ed('0x23')](_0xb1ed('0x24'),_0x147a75);logger[_0xb1ed('0x13')](_0xb1ed('0x24'),_0x147a75,JSON[_0xb1ed('0x15')](_0xd13ff7));_0x1fee73(_0xd13ff7);})['catch'](function(_0x48f3a8){logger['error'](_0xb1ed('0x24'),_0x48f3a8['message'],_0x147a75);_0x2c068c(_this['error'](0x1f4,_0x48f3a8['message']));});});}; \ No newline at end of file +var _0x1a2c=['result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where','then','AddTagsToOpenchannelInteraction','find','body','ids','spread','AddTags','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1a2c,0xf3));var _0xc1a2=function(_0x36909f,_0x4f45a5){_0x36909f=_0x36909f-0x0;var _0x512c12=_0x1a2c[_0x36909f];return _0x512c12;};'use strict';var _=require('lodash');var util=require(_0xc1a2('0x0'));var moment=require('moment');var BPromise=require(_0xc1a2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc1a2('0x2'))['db'];var utils=require(_0xc1a2('0x3'));var logger=require(_0xc1a2('0x4'))(_0xc1a2('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc1a2('0x6')][_0xc1a2('0x7')]({'port':0x232a});config[_0xc1a2('0x8')]=_[_0xc1a2('0x9')](config[_0xc1a2('0x8')],{'host':_0xc1a2('0xa'),'port':0x18eb});var socket=require(_0xc1a2('0xb'))(new Redis(config[_0xc1a2('0x8')]));require('./openchannelInteraction.socket')[_0xc1a2('0xc')](socket);function respondWithRpcPromise(_0x4ec5ac,_0x2843f0,_0x1d5bab){return new BPromise(function(_0x449c68,_0x21de52){return client[_0xc1a2('0xd')](_0x4ec5ac,_0x1d5bab)['then'](function(_0x10182e){logger[_0xc1a2('0xe')](_0xc1a2('0xf'),_0x2843f0,'request\x20sent');logger[_0xc1a2('0x10')](_0xc1a2('0x11'),_0x2843f0,_0xc1a2('0x12'),JSON[_0xc1a2('0x13')](_0x10182e));if(_0x10182e[_0xc1a2('0x14')]){if(_0x10182e[_0xc1a2('0x14')][_0xc1a2('0x15')]===0x1f4){logger[_0xc1a2('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2843f0,_0x10182e[_0xc1a2('0x14')][_0xc1a2('0x16')]);return _0x21de52(_0x10182e[_0xc1a2('0x14')][_0xc1a2('0x16')]);}logger[_0xc1a2('0x14')](_0xc1a2('0xf'),_0x2843f0,_0x10182e[_0xc1a2('0x14')][_0xc1a2('0x16')]);return _0x449c68(_0x10182e[_0xc1a2('0x14')][_0xc1a2('0x16')]);}else{logger['info'](_0xc1a2('0xf'),_0x2843f0,_0xc1a2('0x12'));_0x449c68(_0x10182e[_0xc1a2('0x17')][_0xc1a2('0x16')]);}})[_0xc1a2('0x18')](function(_0x58e43c){logger['error'](_0xc1a2('0xf'),_0x2843f0,_0x58e43c);_0x21de52(_0x58e43c);});});}exports[_0xc1a2('0x19')]=function(_0x4a3229){var _0x155ba4=this;return new Promise(function(_0x23b958,_0x1054c4){return db[_0xc1a2('0x1a')][_0xc1a2('0x1b')](_0x4a3229['body'],{'raw':_0x4a3229[_0xc1a2('0x1c')]?_0x4a3229[_0xc1a2('0x1c')][_0xc1a2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a3229[_0xc1a2('0x1c')]?_0x4a3229[_0xc1a2('0x1c')][_0xc1a2('0x1e')]||null:null,'attributes':_0x4a3229[_0xc1a2('0x1c')]?_0x4a3229[_0xc1a2('0x1c')]['attributes']||null:null,'limit':_0x4a3229[_0xc1a2('0x1c')]?_0x4a3229[_0xc1a2('0x1c')]['limit']||null:null})[_0xc1a2('0x1f')](function(_0x5a6348){logger['info'](_0xc1a2('0x19'),_0x4a3229);logger[_0xc1a2('0x10')](_0xc1a2('0x19'),_0x4a3229,JSON[_0xc1a2('0x13')](_0x5a6348));_0x23b958(_0x5a6348);})[_0xc1a2('0x18')](function(_0x132666){logger[_0xc1a2('0x14')]('UpdateOpenchannelInteraction',_0x132666[_0xc1a2('0x16')],_0x4a3229);_0x1054c4(_0x155ba4[_0xc1a2('0x14')](0x1f4,_0x132666['message']));});});};exports[_0xc1a2('0x20')]=function(_0x394d1e){return new Promise(function(_0x54b363,_0x48ec8b){return db[_0xc1a2('0x1a')][_0xc1a2('0x21')]({'where':_0x394d1e['options']?_0x394d1e[_0xc1a2('0x1c')][_0xc1a2('0x1e')]||null:null})[_0xc1a2('0x1f')](function(_0x18a388){if(_0x18a388){return _0x18a388['addTags'](_0x394d1e[_0xc1a2('0x22')]['ids'],_['omit'](_0x394d1e[_0xc1a2('0x22')],[_0xc1a2('0x23'),'id'])||{});}})[_0xc1a2('0x24')](function(_0x477163){logger[_0xc1a2('0xe')](_0xc1a2('0x25'),_0x394d1e);logger[_0xc1a2('0x10')]('AddTags',_0x394d1e,JSON[_0xc1a2('0x13')](_0x477163));_0x54b363(_0x477163);})[_0xc1a2('0x18')](function(_0x3d1e7c){logger[_0xc1a2('0x14')](_0xc1a2('0x25'),_0x3d1e7c['message'],_0x394d1e);_0x48ec8b(_this[_0xc1a2('0x14')](0x1f4,_0x3d1e7c['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 89ee44a..6030844 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 _0xa933=['removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','emit'];(function(_0x2dd4e6,_0x46211f){var _0x461f3c=function(_0x571217){while(--_0x571217){_0x2dd4e6['push'](_0x2dd4e6['shift']());}};_0x461f3c(++_0x46211f);}(_0xa933,0x104));var _0x3a93=function(_0x484399,_0x4e02d3){_0x484399=_0x484399-0x0;var _0x23b6b8=_0xa933[_0x484399];return _0x23b6b8;};'use strict';var OpenchannelInteractionEvents=require(_0x3a93('0x0'));var events=[_0x3a93('0x1'),_0x3a93('0x2'),'update'];function createListener(_0x3fba29,_0x358fac){return function(_0xedf51a){_0x358fac[_0x3a93('0x3')](_0x3fba29,_0xedf51a);};}function removeListener(_0xd73b2,_0x650ecc){return function(){OpenchannelInteractionEvents[_0x3a93('0x4')](_0xd73b2,_0x650ecc);};}exports[_0x3a93('0x5')]=function(_0x446839){for(var _0x8c2d4f=0x0,_0x27ea56=events[_0x3a93('0x6')];_0x8c2d4f<_0x27ea56;_0x8c2d4f++){var _0xee02b7=events[_0x8c2d4f];var _0x32e9cc=createListener(_0x3a93('0x7')+_0xee02b7,_0x446839);OpenchannelInteractionEvents['on'](_0xee02b7,_0x32e9cc);}}; \ No newline at end of file +var _0x1feb=['emit','openchannelInteraction:','save','remove','update'];(function(_0x5697fa,_0x3defe5){var _0x47c84f=function(_0x11918e){while(--_0x11918e){_0x5697fa['push'](_0x5697fa['shift']());}};_0x47c84f(++_0x3defe5);}(_0x1feb,0x7f));var _0xb1fe=function(_0x382168,_0xe03b6a){_0x382168=_0x382168-0x0;var _0x3ecf7e=_0x1feb[_0x382168];return _0x3ecf7e;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xb1fe('0x0'),_0xb1fe('0x1'),_0xb1fe('0x2')];function createListener(_0x40214a,_0xc798ab){return function(_0x55967f){_0xc798ab[_0xb1fe('0x3')](_0x40214a,_0x55967f);};}function removeListener(_0x124736,_0x27e6bf){return function(){OpenchannelInteractionEvents['removeListener'](_0x124736,_0x27e6bf);};}exports['register']=function(_0xbca47a){for(var _0x49ec8d=0x0,_0x16c23f=events['length'];_0x49ec8d<_0x16c23f;_0x49ec8d++){var _0x48c3bf=events[_0x49ec8d];var _0x562591=createListener(_0xb1fe('0x4')+_0x48c3bf,_0xbca47a);OpenchannelInteractionEvents['on'](_0x48c3bf,_0x562591);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 5630e93..4c53a7f 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 _0x5135=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','openchannel','openchannelmessage:create','create','update','put','/:id/accept','/:id/reject','reject','delete','destroy'];(function(_0x32cc22,_0x52c987){var _0x5f1406=function(_0x2bf4f3){while(--_0x2bf4f3){_0x32cc22['push'](_0x32cc22['shift']());}};_0x5f1406(++_0x52c987);}(_0x5135,0xea));var _0x5513=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x5135[_0x4e6ae6];return _0x23c108;};'use strict';var multer=require(_0x5513('0x0'));var util=require(_0x5513('0x1'));var path=require(_0x5513('0x2'));var timeout=require(_0x5513('0x3'));var express=require('express');var router=express[_0x5513('0x4')]();var auth=require(_0x5513('0x5'));var interaction=require(_0x5513('0x6'));var config=require(_0x5513('0x7'));var controller=require(_0x5513('0x8'));router[_0x5513('0x9')]('/',auth[_0x5513('0xa')](),controller[_0x5513('0xb')]);router[_0x5513('0x9')](_0x5513('0xc'),auth[_0x5513('0xa')](),controller[_0x5513('0xd')]);router['get']('/:id',auth[_0x5513('0xa')](),controller[_0x5513('0xe')]);router[_0x5513('0xf')]('/',auth[_0x5513('0xa')](),interaction['tracked'](_0x5513('0x10'),_0x5513('0x11')),controller[_0x5513('0x12')]);router['put']('/:id',auth[_0x5513('0xa')](),controller[_0x5513('0x13')]);router[_0x5513('0x14')](_0x5513('0x15'),auth['isAuthenticated'](),controller['accept']);router[_0x5513('0x14')](_0x5513('0x16'),auth['isAuthenticated'](),controller[_0x5513('0x17')]);router[_0x5513('0x18')]('/:id',auth[_0x5513('0xa')](),controller[_0x5513('0x19')]);module['exports']=router; \ No newline at end of file +var _0xa392=['openchannelmessage:create','create','put','update','accept','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel'];(function(_0x524959,_0x55eec4){var _0x5610b7=function(_0xf3a644){while(--_0xf3a644){_0x524959['push'](_0x524959['shift']());}};_0x5610b7(++_0x55eec4);}(_0xa392,0x17e));var _0x2a39=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xa392[_0x2e4e19];return _0x9ba20b;};'use strict';var multer=require(_0x2a39('0x0'));var util=require('util');var path=require(_0x2a39('0x1'));var timeout=require(_0x2a39('0x2'));var express=require(_0x2a39('0x3'));var router=express[_0x2a39('0x4')]();var auth=require(_0x2a39('0x5'));var interaction=require(_0x2a39('0x6'));var config=require(_0x2a39('0x7'));var controller=require('./openchannelMessage.controller');router[_0x2a39('0x8')]('/',auth[_0x2a39('0x9')](),controller[_0x2a39('0xa')]);router[_0x2a39('0x8')](_0x2a39('0xb'),auth[_0x2a39('0x9')](),controller[_0x2a39('0xc')]);router['get'](_0x2a39('0xd'),auth[_0x2a39('0x9')](),controller[_0x2a39('0xe')]);router[_0x2a39('0xf')]('/',auth[_0x2a39('0x9')](),interaction[_0x2a39('0x10')](_0x2a39('0x11'),_0x2a39('0x12')),controller[_0x2a39('0x13')]);router[_0x2a39('0x14')]('/:id',auth[_0x2a39('0x9')](),controller[_0x2a39('0x15')]);router[_0x2a39('0x14')]('/:id/accept',auth['isAuthenticated'](),controller[_0x2a39('0x16')]);router['put']('/:id/reject',auth[_0x2a39('0x9')](),controller['reject']);router['delete'](_0x2a39('0xd'),auth[_0x2a39('0x9')](),controller[_0x2a39('0x17')]);module[_0x2a39('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 455506c..70fae37 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 _0x88d4=['DATE','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x5a184b,_0x457876){var _0x713964=function(_0x1f6d49){while(--_0x1f6d49){_0x5a184b['push'](_0x5a184b['shift']());}};_0x713964(++_0x457876);}(_0x88d4,0x19e));var _0x488d=function(_0x1bc6e4,_0x565547){_0x1bc6e4=_0x1bc6e4-0x0;var _0x4129b7=_0x88d4[_0x1bc6e4];return _0x4129b7;};'use strict';var Sequelize=require('sequelize');module[_0x488d('0x0')]={'body':{'type':Sequelize[_0x488d('0x1')](_0x488d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x488d('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x488d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x488d('0x4')]('in',_0x488d('0x5')),'defaultValue':_0x488d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x488d('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x488d('0x1')]}}; \ No newline at end of file +var _0xacd7=['TEXT','medium','BOOLEAN','sequelize','exports'];(function(_0x1174c0,_0x205c56){var _0x4a99fa=function(_0x34aff0){while(--_0x34aff0){_0x1174c0['push'](_0x1174c0['shift']());}};_0x4a99fa(++_0x205c56);}(_0xacd7,0x116));var _0x7acd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xacd7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7acd('0x0'));module[_0x7acd('0x1')]={'body':{'type':Sequelize[_0x7acd('0x2')](_0x7acd('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7acd('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7acd('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x7acd('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index bbdc9ea..d813611 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 _0xe32a=['role','stringify','acceptMessage','interface','channel','event','EventManager','acceptmessage','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SIP/%s','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','options','find','create','body','describe','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','OpenchannelInteractionId','isNil','interaction'];(function(_0x523da3,_0x3e0b89){var _0x266024=function(_0x8a5b8){while(--_0x8a5b8){_0x523da3['push'](_0x523da3['shift']());}};_0x266024(++_0x3e0b89);}(_0xe32a,0x186));var _0xae32=function(_0x2f62aa,_0x108e95){_0x2f62aa=_0x2f62aa-0x0;var _0x1a341f=_0xe32a[_0x2f62aa];return _0x1a341f;};'use strict';var pdf=require(_0xae32('0x0'));var emlformat=require(_0xae32('0x1'));var rimraf=require(_0xae32('0x2'));var zipdir=require(_0xae32('0x3'));var jsonpatch=require(_0xae32('0x4'));var rp=require(_0xae32('0x5'));var moment=require(_0xae32('0x6'));var BPromise=require(_0xae32('0x7'));var Mustache=require(_0xae32('0x8'));var util=require('util');var path=require(_0xae32('0x9'));var sox=require(_0xae32('0xa'));var csv=require(_0xae32('0xb'));var ejs=require(_0xae32('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xae32('0xd'));var crypto=require(_0xae32('0xe'));var jsforce=require(_0xae32('0xf'));var deskjs=require(_0xae32('0x10'));var toCsv=require(_0xae32('0xb'));var querystring=require(_0xae32('0x11'));var Papa=require(_0xae32('0x12'));var Redis=require(_0xae32('0x13'));var authService=require(_0xae32('0x14'));var qs=require(_0xae32('0x15'));var as=require(_0xae32('0x16'));var hardwareService=require(_0xae32('0x17'));var logger=require(_0xae32('0x18'))(_0xae32('0x19'));var utils=require(_0xae32('0x1a'));var config=require(_0xae32('0x1b'));var licenseUtil=require(_0xae32('0x1c'));var db=require(_0xae32('0x1d'))['db'];config['redis']=_[_0xae32('0x1e')](config['redis'],{'host':_0xae32('0x1f'),'port':0x18eb});var socket=require(_0xae32('0x20'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0xae32('0x21')](socket);var jayson=require(_0xae32('0x22'));var client=jayson[_0xae32('0x23')][_0xae32('0x24')]({'port':0x232c});var client9002=jayson[_0xae32('0x23')][_0xae32('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x49e87a,_0xafae1e,_0x7f001f,_0xf5ea3){return new BPromise(function(_0x17830b,_0x1997b9){var _0x50eefa=_0xf5ea3||client;return _0x50eefa['request'](_0x49e87a,_0x7f001f)[_0xae32('0x25')](function(_0xf61a3c){logger[_0xae32('0x26')](_0xae32('0x27'),_0xafae1e,_0xae32('0x28'));logger[_0xae32('0x29')](_0xae32('0x2a'),_0xafae1e,_0xae32('0x28'),JSON['stringify'](_0xf61a3c));if(_0xf61a3c[_0xae32('0x2b')]){if(_0xf61a3c['error'][_0xae32('0x2c')]===0x1f4){logger[_0xae32('0x2b')](_0xae32('0x27'),_0xafae1e,_0xf61a3c[_0xae32('0x2b')][_0xae32('0x2d')]);return _0x1997b9(_0xf61a3c[_0xae32('0x2b')][_0xae32('0x2d')]);}logger[_0xae32('0x2b')](_0xae32('0x27'),_0xafae1e,_0xf61a3c['error'][_0xae32('0x2d')]);return _0x17830b(_0xf61a3c[_0xae32('0x2b')][_0xae32('0x2d')]);}else{logger[_0xae32('0x26')](_0xae32('0x27'),_0xafae1e,_0xae32('0x28'));_0x17830b(_0xf61a3c['result'][_0xae32('0x2d')]);}})['catch'](function(_0x459e27){logger[_0xae32('0x2b')]('OpenchannelMessage,\x20%s,\x20%s',_0xafae1e,_0x459e27);_0x1997b9(_0x459e27);});});}function respondWithStatusCode(_0x396bd6,_0x55493a){_0x55493a=_0x55493a||0xcc;return function(_0x244a8d){if(_0x244a8d){return _0x396bd6[_0xae32('0x2e')](_0x55493a);}return _0x396bd6[_0xae32('0x2f')](_0x55493a)[_0xae32('0x30')]();};}function respondWithResult(_0x5444b3,_0x50ab75){_0x50ab75=_0x50ab75||0xc8;return function(_0x31a313){if(_0x31a313){return _0x5444b3['status'](_0x50ab75)[_0xae32('0x31')](_0x31a313);}};}function respondWithFilteredResult(_0x185630,_0x3de694){return function(_0x1fc155){if(_0x1fc155){var _0x7839a4=_0x1fc155[_0xae32('0x32')],_0x56bdb8=_0x3de694[_0xae32('0x33')],_0x199674=_0x3de694[_0xae32('0x33')]+_0x3de694[_0xae32('0x34')],_0x307603;if(_0x199674>=_0x7839a4){_0x199674=_0x7839a4;_0x307603=0xc8;}else{_0x307603=0xce;}_0x185630[_0xae32('0x2f')](_0x307603);return _0x185630[_0xae32('0x35')](_0xae32('0x36'),_0x56bdb8+'-'+_0x199674+'/'+_0x7839a4)[_0xae32('0x31')](_0x1fc155);}return null;};}function patchUpdates(_0x3d40af){return function(_0x311ea3){try{jsonpatch['apply'](_0x311ea3,_0x3d40af,!![]);}catch(_0x267cd3){return BPromise[_0xae32('0x37')](_0x267cd3);}return _0x311ea3[_0xae32('0x38')]();};}function saveUpdates(_0x5c98f6,_0x50d067){return function(_0x422b72){if(_0x422b72){return _0x422b72[_0xae32('0x39')](_0x5c98f6)[_0xae32('0x25')](function(_0x2283bd){return _0x2283bd;});}return null;};}function removeEntity(_0x2ed5cd,_0x16a768){return function(_0x1d6f77){if(_0x1d6f77){return _0x1d6f77[_0xae32('0x3a')]()[_0xae32('0x25')](function(){_0x2ed5cd[_0xae32('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a33c7,_0x467720){return function(_0x178fa5){if(!_0x178fa5){_0x2a33c7['sendStatus'](0x194);}return _0x178fa5;};}function handleError(_0x2c82fc,_0x5c0c3e){_0x5c0c3e=_0x5c0c3e||0x1f4;return function(_0xb205b9){logger[_0xae32('0x2b')](_0xb205b9[_0xae32('0x3b')]);if(_0xb205b9[_0xae32('0x3c')]){delete _0xb205b9[_0xae32('0x3c')];}_0x2c82fc['status'](_0x5c0c3e)[_0xae32('0x3d')](_0xb205b9);};}exports['index']=function(_0x163ebc,_0xdb3f28){var _0x8541ab={},_0xa7b62f={},_0x3b3245={'count':0x0,'rows':[]};var _0x4dbd1=_[_0xae32('0x3e')](db[_0xae32('0x3f')][_0xae32('0x40')],function(_0x340b3b){return{'name':_0x340b3b[_0xae32('0x41')],'type':_0x340b3b[_0xae32('0x42')][_0xae32('0x43')]};});_0xa7b62f[_0xae32('0x44')]=_[_0xae32('0x3e')](_0x4dbd1,'name');_0xa7b62f[_0xae32('0x45')]=_[_0xae32('0x46')](_0x163ebc[_0xae32('0x45')]);_0xa7b62f[_0xae32('0x47')]=_[_0xae32('0x48')](_0xa7b62f['model'],_0xa7b62f[_0xae32('0x45')]);_0x8541ab[_0xae32('0x49')]=_[_0xae32('0x48')](_0xa7b62f[_0xae32('0x44')],qs[_0xae32('0x4a')](_0x163ebc[_0xae32('0x45')]['fields']));_0x8541ab[_0xae32('0x49')]=_0x8541ab[_0xae32('0x49')][_0xae32('0x4b')]?_0x8541ab[_0xae32('0x49')]:_0xa7b62f[_0xae32('0x44')];if(!_0x163ebc[_0xae32('0x45')][_0xae32('0x4c')]('nolimit')){_0x8541ab[_0xae32('0x34')]=qs['limit'](_0x163ebc['query'][_0xae32('0x34')]);_0x8541ab[_0xae32('0x33')]=qs[_0xae32('0x33')](_0x163ebc[_0xae32('0x45')][_0xae32('0x33')]);}_0x8541ab[_0xae32('0x4d')]=qs[_0xae32('0x4e')](_0x163ebc['query']['sort']);_0x8541ab[_0xae32('0x4f')]=qs['filters'](_[_0xae32('0x50')](_0x163ebc['query'],_0xa7b62f[_0xae32('0x47')]),_0x4dbd1);if(_0x163ebc[_0xae32('0x45')]['filter']){_0x8541ab[_0xae32('0x4f')]=_[_0xae32('0x51')](_0x8541ab[_0xae32('0x4f')],{'$or':_['map'](_0x4dbd1,function(_0x44a0bd){if(_0x44a0bd[_0xae32('0x42')]!==_0xae32('0x52')){var _0x2cd80d={};_0x2cd80d[_0x44a0bd[_0xae32('0x3c')]]={'$like':'%'+_0x163ebc['query'][_0xae32('0x53')]+'%'};return _0x2cd80d;}})});}_0x8541ab=_[_0xae32('0x51')]({},_0x8541ab,_0x163ebc['options']);var _0x54a277={'where':_0x8541ab[_0xae32('0x4f')]};return db['OpenchannelMessage'][_0xae32('0x32')](_0x54a277)[_0xae32('0x25')](function(_0x1f1cf1){_0x3b3245['count']=_0x1f1cf1;if(_0x163ebc[_0xae32('0x45')][_0xae32('0x54')]){_0x8541ab[_0xae32('0x55')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x8541ab);})[_0xae32('0x25')](function(_0x2e98c9){_0x3b3245[_0xae32('0x56')]=_0x2e98c9;return _0x3b3245;})[_0xae32('0x25')](respondWithFilteredResult(_0xdb3f28,_0x8541ab))[_0xae32('0x57')](handleError(_0xdb3f28,null));};exports[_0xae32('0x58')]=function(_0x4691ef,_0x16f928){var _0xf6f1b2={'raw':!![],'where':{'id':_0x4691ef[_0xae32('0x59')]['id']}},_0x23b1cf={};_0x23b1cf[_0xae32('0x44')]=_['keys'](db[_0xae32('0x3f')][_0xae32('0x40')]);_0x23b1cf[_0xae32('0x45')]=_[_0xae32('0x46')](_0x4691ef[_0xae32('0x45')]);_0x23b1cf[_0xae32('0x47')]=_[_0xae32('0x48')](_0x23b1cf[_0xae32('0x44')],_0x23b1cf['query']);_0xf6f1b2['attributes']=_[_0xae32('0x48')](_0x23b1cf[_0xae32('0x44')],qs[_0xae32('0x4a')](_0x4691ef[_0xae32('0x45')][_0xae32('0x4a')]));_0xf6f1b2['attributes']=_0xf6f1b2['attributes'][_0xae32('0x4b')]?_0xf6f1b2[_0xae32('0x49')]:_0x23b1cf[_0xae32('0x44')];if(_0x4691ef[_0xae32('0x45')][_0xae32('0x54')]){_0xf6f1b2[_0xae32('0x55')]=[{'all':!![]}];}_0xf6f1b2=_[_0xae32('0x51')]({},_0xf6f1b2,_0x4691ef[_0xae32('0x5a')]);return db[_0xae32('0x3f')][_0xae32('0x5b')](_0xf6f1b2)[_0xae32('0x25')](handleEntityNotFound(_0x16f928,null))[_0xae32('0x25')](respondWithResult(_0x16f928,null))[_0xae32('0x57')](handleError(_0x16f928,null));};exports[_0xae32('0x5c')]=function(_0x4019dd,_0x13f1bf){return db[_0xae32('0x3f')]['create'](_0x4019dd[_0xae32('0x5d')],{})[_0xae32('0x25')](respondWithResult(_0x13f1bf,0xc9))['catch'](handleError(_0x13f1bf,null));};exports['update']=function(_0xf6840f,_0xf6455){if(_0xf6840f[_0xae32('0x5d')]['id']){delete _0xf6840f[_0xae32('0x5d')]['id'];}return db[_0xae32('0x3f')][_0xae32('0x5b')]({'where':{'id':_0xf6840f[_0xae32('0x59')]['id']}})[_0xae32('0x25')](handleEntityNotFound(_0xf6455,null))['then'](saveUpdates(_0xf6840f[_0xae32('0x5d')],null))['then'](respondWithResult(_0xf6455,null))[_0xae32('0x57')](handleError(_0xf6455,null));};exports[_0xae32('0x3a')]=function(_0x1b6571,_0x1f4dfc){return db[_0xae32('0x3f')][_0xae32('0x5b')]({'where':{'id':_0x1b6571[_0xae32('0x59')]['id']}})[_0xae32('0x25')](handleEntityNotFound(_0x1f4dfc,null))[_0xae32('0x25')](removeEntity(_0x1f4dfc,null))[_0xae32('0x57')](handleError(_0x1f4dfc,null));};exports[_0xae32('0x5e')]=function(_0xa641d8,_0x19af05){return db[_0xae32('0x3f')][_0xae32('0x5e')]()[_0xae32('0x25')](respondWithResult(_0x19af05,null))[_0xae32('0x57')](handleError(_0x19af05,null));};var interaction_log=require('../../config/logger')(_0xae32('0x5f'));exports[_0xae32('0x60')]=function(_0x5d3498,_0x440fa1,_0x2619f1){var _0x5c6986={'agent':{},'channel':_0xae32('0x61')};if(_0x5d3498[_0xae32('0x5d')]['id']){delete _0x5d3498[_0xae32('0x5d')]['id'];}_0x5d3498['body']['read']=!![];_0x5d3498[_0xae32('0x5d')][_0xae32('0x62')]=moment()[_0xae32('0x63')](_0xae32('0x64'));_0x5d3498[_0xae32('0x5d')]['UserId']=_0x5d3498[_0xae32('0x5d')][_0xae32('0x65')]||_0x5d3498[_0xae32('0x66')]['id'];_0x5c6986[_0xae32('0x67')]['id']=_0x5d3498[_0xae32('0x5d')][_0xae32('0x65')];return db[_0xae32('0x3f')][_0xae32('0x5b')]({'where':{'id':_0x5d3498[_0xae32('0x59')]['id'],'UserId':null},'include':[{'model':db[_0xae32('0x68')],'as':_0xae32('0x69')}]})[_0xae32('0x25')](handleEntityNotFound(_0x440fa1,null))[_0xae32('0x25')](saveUpdates(_0x5d3498[_0xae32('0x5d')],null))[_0xae32('0x25')](function(_0x2e85c6){if(_0x2e85c6){_0x5c6986[_0xae32('0x2d')]=_0x2e85c6[_0xae32('0x6a')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x2e85c6[_0xae32('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0x440fa1,null))[_0xae32('0x25')](function(_0x422d06){if(_0x422d06){return _0x422d06['update']({'UserId':_0x5d3498[_0xae32('0x5d')][_0xae32('0x65')],'read1stAt':_[_0xae32('0x6c')](_0x422d06['read1stAt'])?moment()[_0xae32('0x63')](_0xae32('0x64')):undefined});}return null;})[_0xae32('0x25')](function(_0x4c79bb){if(_0x4c79bb){_0x5c6986[_0xae32('0x6d')]=_0x4c79bb[_0xae32('0x6a')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5d3498[_0xae32('0x66')]['id'],_0x5d3498[_0xae32('0x66')][_0xae32('0x3c')],_0x5d3498[_0xae32('0x66')][_0xae32('0x6e')],_0x5c6986[_0xae32('0x6d')]['id'],_0x5d3498[_0xae32('0x5d')]?JSON[_0xae32('0x6f')](_0x5d3498[_0xae32('0x5d')]):'null');return respondWithRpcPromise('AcceptMessage',_0xae32('0x70'),_0x5c6986);}return null;})['then'](function(_0x1adbf0){if(_0x1adbf0){if(_0x5d3498[_0xae32('0x5d')]['manual']){_0x5c6986[_0xae32('0x2d')][_0xae32('0x71')]=util[_0xae32('0x63')]('SIP/%s',_0x5d3498[_0xae32('0x66')]['name']);_0x5c6986['message'][_0xae32('0x72')]=_0x5c6986[_0xae32('0x72')];_0x5c6986['message'][_0xae32('0x73')]=_0xae32('0x60');return respondWithRpcPromise('EventManager',_0xae32('0x74'),{'event':_0xae32('0x75'),'message':_0x5c6986['message']},client9002)[_0xae32('0x25')](function(){return _0x5c6986;});}return _0x5c6986;}return null;})['then'](respondWithResult(_0x440fa1,null))[_0xae32('0x57')](handleError(_0x440fa1,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0xae32('0x37')]=function(_0x429765,_0x599a70,_0x11520d){var _0x5a57d1={'agent':{},'channel':_0xae32('0x61')};if(_0x429765['body']['id']){delete _0x429765[_0xae32('0x5d')]['id'];}_0x429765['body'][_0xae32('0x65')]=_0x429765[_0xae32('0x5d')][_0xae32('0x65')]||_0x429765['user']['id'];_0x5a57d1[_0xae32('0x67')]['id']=_0x429765['body'][_0xae32('0x65')];return db[_0xae32('0x3f')][_0xae32('0x5b')]({'where':{'id':_0x429765[_0xae32('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x599a70,null))['then'](function(_0x396e8f){if(_0x396e8f){_0x5a57d1['message']=_0x396e8f['get']({'plain':!![]});return db[_0xae32('0x76')]['find']({'where':{'id':_0x396e8f[_0xae32('0x6b')]}});}return null;})[_0xae32('0x25')](handleEntityNotFound(_0x599a70,null))['then'](function(_0x4109ea){if(_0x4109ea){_0x5a57d1[_0xae32('0x6d')]=_0x4109ea[_0xae32('0x6a')]({'plain':!![]});interaction_log[_0xae32('0x26')](_0xae32('0x77'),_0x429765[_0xae32('0x66')]['id'],_0x429765[_0xae32('0x66')][_0xae32('0x3c')],_0x429765[_0xae32('0x66')][_0xae32('0x6e')],_0x5a57d1[_0xae32('0x6d')]['id'],_0x429765[_0xae32('0x5d')]?JSON[_0xae32('0x6f')](_0x429765[_0xae32('0x5d')]):_0xae32('0x78'));return respondWithRpcPromise(_0xae32('0x79'),_0xae32('0x7a'),_0x5a57d1);}return null;})[_0xae32('0x25')](function(_0x2e0200){if(_0x2e0200){_0x2e0200[_0xae32('0x2d')][_0xae32('0x71')]=util[_0xae32('0x63')](_0xae32('0x7b'),_0x429765['user'][_0xae32('0x3c')]);_0x2e0200[_0xae32('0x2d')][_0xae32('0x72')]=_0x5a57d1['channel'];_0x2e0200[_0xae32('0x2d')][_0xae32('0x73')]=_0xae32('0x37');respondWithRpcPromise('EventManager','EventManager',{'event':_0xae32('0x7c'),'message':_0x2e0200[_0xae32('0x2d')]},client9002);return _0x5a57d1;}return null;})[_0xae32('0x25')](respondWithResult(_0x599a70,null))['catch'](handleError(_0x599a70,null));}; \ No newline at end of file +var _0x97b1=['to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./openchannelMessage.socket','register','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','offset','set','Content-Range','reject','save','update','destroy','sendStatus','stack','name','send','map','rawAttributes','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','OpenchannelMessage','count','include','rows','show','params','keys','find','create','body','describe','openchannel-interactions','openchannel','read','readAt','format','UserId','agent','Contact','get','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','OpenchannelInteraction','null','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','desk.js'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x97b1,0x6b));var _0x197b=function(_0x5eca50,_0xc1e3f8){_0x5eca50=_0x5eca50-0x0;var _0x41fb84=_0x97b1[_0x5eca50];return _0x41fb84;};'use strict';var pdf=require(_0x197b('0x0'));var emlformat=require(_0x197b('0x1'));var rimraf=require(_0x197b('0x2'));var zipdir=require(_0x197b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x197b('0x4'));var moment=require(_0x197b('0x5'));var BPromise=require(_0x197b('0x6'));var Mustache=require(_0x197b('0x7'));var util=require(_0x197b('0x8'));var path=require('path');var sox=require(_0x197b('0x9'));var csv=require('to-csv');var ejs=require(_0x197b('0xa'));var fs=require('fs');var _=require(_0x197b('0xb'));var squel=require(_0x197b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x197b('0xd'));var toCsv=require(_0x197b('0xe'));var querystring=require('querystring');var Papa=require(_0x197b('0xf'));var Redis=require(_0x197b('0x10'));var authService=require(_0x197b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x197b('0x12'));var hardwareService=require(_0x197b('0x13'));var logger=require(_0x197b('0x14'))(_0x197b('0x15'));var utils=require(_0x197b('0x16'));var config=require(_0x197b('0x17'));var licenseUtil=require(_0x197b('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x197b('0x19')](config[_0x197b('0x1a')],{'host':_0x197b('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x197b('0x1c'))[_0x197b('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x197b('0x1e')][_0x197b('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x104c0d,_0xd81ce9,_0x2a7aa7,_0x57b76b){return new BPromise(function(_0x1e4d12,_0xdbe105){var _0xba2418=_0x57b76b||client;return _0xba2418[_0x197b('0x20')](_0x104c0d,_0x2a7aa7)[_0x197b('0x21')](function(_0x557efe){logger['info'](_0x197b('0x22'),_0xd81ce9,_0x197b('0x23'));logger[_0x197b('0x24')](_0x197b('0x25'),_0xd81ce9,_0x197b('0x23'),JSON[_0x197b('0x26')](_0x557efe));if(_0x557efe[_0x197b('0x27')]){if(_0x557efe['error'][_0x197b('0x28')]===0x1f4){logger[_0x197b('0x27')](_0x197b('0x22'),_0xd81ce9,_0x557efe['error'][_0x197b('0x29')]);return _0xdbe105(_0x557efe[_0x197b('0x27')][_0x197b('0x29')]);}logger[_0x197b('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0xd81ce9,_0x557efe[_0x197b('0x27')]['message']);return _0x1e4d12(_0x557efe['error'][_0x197b('0x29')]);}else{logger[_0x197b('0x2a')](_0x197b('0x22'),_0xd81ce9,_0x197b('0x23'));_0x1e4d12(_0x557efe[_0x197b('0x2b')][_0x197b('0x29')]);}})[_0x197b('0x2c')](function(_0x20ad82){logger[_0x197b('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0xd81ce9,_0x20ad82);_0xdbe105(_0x20ad82);});});}function respondWithStatusCode(_0x585b01,_0x481b78){_0x481b78=_0x481b78||0xcc;return function(_0x3d65b0){if(_0x3d65b0){return _0x585b01['sendStatus'](_0x481b78);}return _0x585b01[_0x197b('0x2d')](_0x481b78)[_0x197b('0x2e')]();};}function respondWithResult(_0x4353c3,_0x13d878){_0x13d878=_0x13d878||0xc8;return function(_0x56a7a7){if(_0x56a7a7){return _0x4353c3['status'](_0x13d878)[_0x197b('0x2f')](_0x56a7a7);}};}function respondWithFilteredResult(_0x54ef6a,_0x17ddce){return function(_0xb81950){if(_0xb81950){var _0x5cdd1b=_0xb81950['count'],_0x25b7fb=_0x17ddce[_0x197b('0x30')],_0x25b9e3=_0x17ddce[_0x197b('0x30')]+_0x17ddce['limit'],_0x5d2e40;if(_0x25b9e3>=_0x5cdd1b){_0x25b9e3=_0x5cdd1b;_0x5d2e40=0xc8;}else{_0x5d2e40=0xce;}_0x54ef6a[_0x197b('0x2d')](_0x5d2e40);return _0x54ef6a[_0x197b('0x31')](_0x197b('0x32'),_0x25b7fb+'-'+_0x25b9e3+'/'+_0x5cdd1b)[_0x197b('0x2f')](_0xb81950);}return null;};}function patchUpdates(_0x96f0db){return function(_0x2e9ce8){try{jsonpatch['apply'](_0x2e9ce8,_0x96f0db,!![]);}catch(_0x25417c){return BPromise[_0x197b('0x33')](_0x25417c);}return _0x2e9ce8[_0x197b('0x34')]();};}function saveUpdates(_0xd199a2,_0x590a3c){return function(_0x1e35cc){if(_0x1e35cc){return _0x1e35cc[_0x197b('0x35')](_0xd199a2)[_0x197b('0x21')](function(_0x2cc373){return _0x2cc373;});}return null;};}function removeEntity(_0x2ca985,_0x1e8634){return function(_0x22cb8){if(_0x22cb8){return _0x22cb8[_0x197b('0x36')]()[_0x197b('0x21')](function(){_0x2ca985['status'](0xcc)[_0x197b('0x2e')]();});}};}function handleEntityNotFound(_0x4c99b3,_0x343b16){return function(_0x49a3e5){if(!_0x49a3e5){_0x4c99b3[_0x197b('0x37')](0x194);}return _0x49a3e5;};}function handleError(_0x1f72a4,_0x4beb41){_0x4beb41=_0x4beb41||0x1f4;return function(_0x197b26){logger[_0x197b('0x27')](_0x197b26[_0x197b('0x38')]);if(_0x197b26[_0x197b('0x39')]){delete _0x197b26[_0x197b('0x39')];}_0x1f72a4['status'](_0x4beb41)[_0x197b('0x3a')](_0x197b26);};}exports['index']=function(_0x1ea359,_0x49bba5){var _0x1b36ae={},_0x3b8348={},_0x4e1052={'count':0x0,'rows':[]};var _0x26d640=_[_0x197b('0x3b')](db['OpenchannelMessage'][_0x197b('0x3c')],function(_0xe6c221){return{'name':_0xe6c221['fieldName'],'type':_0xe6c221[_0x197b('0x3d')][_0x197b('0x3e')]};});_0x3b8348['model']=_[_0x197b('0x3b')](_0x26d640,_0x197b('0x39'));_0x3b8348['query']=_['keys'](_0x1ea359[_0x197b('0x3f')]);_0x3b8348['filters']=_[_0x197b('0x40')](_0x3b8348[_0x197b('0x41')],_0x3b8348['query']);_0x1b36ae[_0x197b('0x42')]=_[_0x197b('0x40')](_0x3b8348['model'],qs['fields'](_0x1ea359[_0x197b('0x3f')][_0x197b('0x43')]));_0x1b36ae['attributes']=_0x1b36ae[_0x197b('0x42')][_0x197b('0x44')]?_0x1b36ae['attributes']:_0x3b8348[_0x197b('0x41')];if(!_0x1ea359[_0x197b('0x3f')][_0x197b('0x45')](_0x197b('0x46'))){_0x1b36ae[_0x197b('0x47')]=qs[_0x197b('0x47')](_0x1ea359['query']['limit']);_0x1b36ae[_0x197b('0x30')]=qs[_0x197b('0x30')](_0x1ea359[_0x197b('0x3f')][_0x197b('0x30')]);}_0x1b36ae[_0x197b('0x48')]=qs[_0x197b('0x49')](_0x1ea359[_0x197b('0x3f')][_0x197b('0x49')]);_0x1b36ae[_0x197b('0x4a')]=qs[_0x197b('0x4b')](_[_0x197b('0x4c')](_0x1ea359[_0x197b('0x3f')],_0x3b8348['filters']),_0x26d640);if(_0x1ea359[_0x197b('0x3f')][_0x197b('0x4d')]){_0x1b36ae[_0x197b('0x4a')]=_[_0x197b('0x4e')](_0x1b36ae[_0x197b('0x4a')],{'$or':_[_0x197b('0x3b')](_0x26d640,function(_0x39d18a){if(_0x39d18a[_0x197b('0x3d')]!==_0x197b('0x4f')){var _0x28833e={};_0x28833e[_0x39d18a['name']]={'$like':'%'+_0x1ea359[_0x197b('0x3f')][_0x197b('0x4d')]+'%'};return _0x28833e;}})});}_0x1b36ae=_[_0x197b('0x4e')]({},_0x1b36ae,_0x1ea359[_0x197b('0x50')]);var _0x1dfd12={'where':_0x1b36ae[_0x197b('0x4a')]};return db[_0x197b('0x51')]['count'](_0x1dfd12)[_0x197b('0x21')](function(_0x382d35){_0x4e1052[_0x197b('0x52')]=_0x382d35;if(_0x1ea359[_0x197b('0x3f')]['includeAll']){_0x1b36ae[_0x197b('0x53')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x1b36ae);})[_0x197b('0x21')](function(_0x180ba4){_0x4e1052[_0x197b('0x54')]=_0x180ba4;return _0x4e1052;})[_0x197b('0x21')](respondWithFilteredResult(_0x49bba5,_0x1b36ae))[_0x197b('0x2c')](handleError(_0x49bba5,null));};exports[_0x197b('0x55')]=function(_0x191566,_0x2e8b86){var _0x57400c={'raw':!![],'where':{'id':_0x191566[_0x197b('0x56')]['id']}},_0x48a034={};_0x48a034[_0x197b('0x41')]=_['keys'](db[_0x197b('0x51')][_0x197b('0x3c')]);_0x48a034['query']=_[_0x197b('0x57')](_0x191566['query']);_0x48a034[_0x197b('0x4b')]=_[_0x197b('0x40')](_0x48a034[_0x197b('0x41')],_0x48a034[_0x197b('0x3f')]);_0x57400c['attributes']=_['intersection'](_0x48a034[_0x197b('0x41')],qs[_0x197b('0x43')](_0x191566[_0x197b('0x3f')][_0x197b('0x43')]));_0x57400c[_0x197b('0x42')]=_0x57400c[_0x197b('0x42')][_0x197b('0x44')]?_0x57400c[_0x197b('0x42')]:_0x48a034[_0x197b('0x41')];if(_0x191566['query']['includeAll']){_0x57400c['include']=[{'all':!![]}];}_0x57400c=_['merge']({},_0x57400c,_0x191566[_0x197b('0x50')]);return db[_0x197b('0x51')][_0x197b('0x58')](_0x57400c)[_0x197b('0x21')](handleEntityNotFound(_0x2e8b86,null))[_0x197b('0x21')](respondWithResult(_0x2e8b86,null))[_0x197b('0x2c')](handleError(_0x2e8b86,null));};exports['create']=function(_0x4510bb,_0x55cb98){return db[_0x197b('0x51')][_0x197b('0x59')](_0x4510bb[_0x197b('0x5a')],{})['then'](respondWithResult(_0x55cb98,0xc9))['catch'](handleError(_0x55cb98,null));};exports[_0x197b('0x35')]=function(_0x545f20,_0x99f5d9){if(_0x545f20[_0x197b('0x5a')]['id']){delete _0x545f20['body']['id'];}return db[_0x197b('0x51')][_0x197b('0x58')]({'where':{'id':_0x545f20[_0x197b('0x56')]['id']}})['then'](handleEntityNotFound(_0x99f5d9,null))['then'](saveUpdates(_0x545f20['body'],null))['then'](respondWithResult(_0x99f5d9,null))[_0x197b('0x2c')](handleError(_0x99f5d9,null));};exports['destroy']=function(_0x226fd3,_0x514932){return db['OpenchannelMessage'][_0x197b('0x58')]({'where':{'id':_0x226fd3[_0x197b('0x56')]['id']}})['then'](handleEntityNotFound(_0x514932,null))[_0x197b('0x21')](removeEntity(_0x514932,null))['catch'](handleError(_0x514932,null));};exports[_0x197b('0x5b')]=function(_0x3a05dd,_0x205a01){return db['OpenchannelMessage'][_0x197b('0x5b')]()[_0x197b('0x21')](respondWithResult(_0x205a01,null))[_0x197b('0x2c')](handleError(_0x205a01,null));};var interaction_log=require('../../config/logger')(_0x197b('0x5c'));exports['accept']=function(_0x1ef14e,_0x22fc99,_0x5acc9f){var _0x206ad9={'agent':{},'channel':_0x197b('0x5d')};if(_0x1ef14e['body']['id']){delete _0x1ef14e[_0x197b('0x5a')]['id'];}_0x1ef14e[_0x197b('0x5a')][_0x197b('0x5e')]=!![];_0x1ef14e[_0x197b('0x5a')][_0x197b('0x5f')]=moment()[_0x197b('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ef14e[_0x197b('0x5a')][_0x197b('0x61')]=_0x1ef14e[_0x197b('0x5a')][_0x197b('0x61')]||_0x1ef14e['user']['id'];_0x206ad9[_0x197b('0x62')]['id']=_0x1ef14e[_0x197b('0x5a')][_0x197b('0x61')];return db[_0x197b('0x51')][_0x197b('0x58')]({'where':{'id':_0x1ef14e[_0x197b('0x56')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x197b('0x63')}]})['then'](handleEntityNotFound(_0x22fc99,null))[_0x197b('0x21')](saveUpdates(_0x1ef14e[_0x197b('0x5a')],null))[_0x197b('0x21')](function(_0x1dbd2d){if(_0x1dbd2d){_0x206ad9[_0x197b('0x29')]=_0x1dbd2d[_0x197b('0x64')]({'plain':!![]});return db['OpenchannelInteraction'][_0x197b('0x58')]({'where':{'id':_0x1dbd2d[_0x197b('0x65')]}});}return null;})[_0x197b('0x21')](handleEntityNotFound(_0x22fc99,null))[_0x197b('0x21')](function(_0x25aed0){if(_0x25aed0){return _0x25aed0[_0x197b('0x35')]({'UserId':_0x1ef14e[_0x197b('0x5a')][_0x197b('0x61')],'read1stAt':_[_0x197b('0x66')](_0x25aed0[_0x197b('0x67')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x197b('0x21')](function(_0x3ce460){if(_0x3ce460){_0x206ad9[_0x197b('0x68')]=_0x3ce460[_0x197b('0x64')]({'plain':!![]});interaction_log[_0x197b('0x2a')](_0x197b('0x69'),_0x1ef14e['user']['id'],_0x1ef14e[_0x197b('0x6a')][_0x197b('0x39')],_0x1ef14e[_0x197b('0x6a')][_0x197b('0x6b')],_0x206ad9[_0x197b('0x68')]['id'],_0x1ef14e[_0x197b('0x5a')]?JSON[_0x197b('0x26')](_0x1ef14e['body']):'null');return respondWithRpcPromise(_0x197b('0x6c'),'acceptMessage',_0x206ad9);}return null;})[_0x197b('0x21')](function(_0x29e8e5){if(_0x29e8e5){if(_0x1ef14e['body'][_0x197b('0x6d')]){_0x206ad9['message'][_0x197b('0x6e')]=util[_0x197b('0x60')](_0x197b('0x6f'),_0x1ef14e[_0x197b('0x6a')][_0x197b('0x39')]);_0x206ad9[_0x197b('0x29')][_0x197b('0x70')]=_0x206ad9['channel'];_0x206ad9['message'][_0x197b('0x71')]='accept';return respondWithRpcPromise(_0x197b('0x72'),_0x197b('0x72'),{'event':_0x197b('0x73'),'message':_0x206ad9['message']},client9002)['then'](function(){return _0x206ad9;});}return _0x206ad9;}return null;})[_0x197b('0x21')](respondWithResult(_0x22fc99,null))[_0x197b('0x2c')](handleError(_0x22fc99,null));};var interaction_log=require(_0x197b('0x14'))(_0x197b('0x5c'));exports[_0x197b('0x33')]=function(_0xd60d6a,_0x170647,_0xc17bdb){var _0x9c55b1={'agent':{},'channel':'openchannel'};if(_0xd60d6a[_0x197b('0x5a')]['id']){delete _0xd60d6a[_0x197b('0x5a')]['id'];}_0xd60d6a[_0x197b('0x5a')][_0x197b('0x61')]=_0xd60d6a['body'][_0x197b('0x61')]||_0xd60d6a[_0x197b('0x6a')]['id'];_0x9c55b1[_0x197b('0x62')]['id']=_0xd60d6a[_0x197b('0x5a')][_0x197b('0x61')];return db[_0x197b('0x51')][_0x197b('0x58')]({'where':{'id':_0xd60d6a[_0x197b('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x170647,null))[_0x197b('0x21')](function(_0x469543){if(_0x469543){_0x9c55b1['message']=_0x469543[_0x197b('0x64')]({'plain':!![]});return db[_0x197b('0x74')][_0x197b('0x58')]({'where':{'id':_0x469543[_0x197b('0x65')]}});}return null;})[_0x197b('0x21')](handleEntityNotFound(_0x170647,null))[_0x197b('0x21')](function(_0xe39a29){if(_0xe39a29){_0x9c55b1[_0x197b('0x68')]=_0xe39a29[_0x197b('0x64')]({'plain':!![]});interaction_log[_0x197b('0x2a')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xd60d6a['user']['id'],_0xd60d6a[_0x197b('0x6a')]['name'],_0xd60d6a[_0x197b('0x6a')]['role'],_0x9c55b1[_0x197b('0x68')]['id'],_0xd60d6a['body']?JSON[_0x197b('0x26')](_0xd60d6a[_0x197b('0x5a')]):_0x197b('0x75'));return respondWithRpcPromise(_0x197b('0x76'),_0x197b('0x77'),_0x9c55b1);}return null;})[_0x197b('0x21')](function(_0x594027){if(_0x594027){_0x594027[_0x197b('0x29')][_0x197b('0x6e')]=util[_0x197b('0x60')](_0x197b('0x6f'),_0xd60d6a['user'][_0x197b('0x39')]);_0x594027['message'][_0x197b('0x70')]=_0x9c55b1['channel'];_0x594027[_0x197b('0x29')]['event']=_0x197b('0x33');respondWithRpcPromise(_0x197b('0x72'),_0x197b('0x72'),{'event':_0x197b('0x78'),'message':_0x594027[_0x197b('0x29')]},client9002);return _0x9c55b1;}return null;})['then'](respondWithResult(_0x170647,null))['catch'](handleError(_0x170647,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 71b2c4d..301834c 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 _0x9bb2=['OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x10a008,_0x2b9b9d){var _0x116386=function(_0x3c95b6){while(--_0x3c95b6){_0x10a008['push'](_0x10a008['shift']());}};_0x116386(++_0x2b9b9d);}(_0x9bb2,0xb9));var _0x29bb=function(_0x26ba1e,_0x30d06a){_0x26ba1e=_0x26ba1e-0x0;var _0x1eb274=_0x9bb2[_0x26ba1e];return _0x1eb274;};'use strict';var EventEmitter=require(_0x29bb('0x0'));var OpenchannelMessage=require(_0x29bb('0x1'))['db'][_0x29bb('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x29bb('0x3')](0x0);var events={'afterCreate':_0x29bb('0x4'),'afterUpdate':_0x29bb('0x5'),'afterDestroy':_0x29bb('0x6')};function emitEvent(_0x330f4f){return function(_0x335612,_0x1ab466,_0x569767){OpenchannelMessageEvents[_0x29bb('0x7')](_0x330f4f+':'+_0x335612['id'],_0x335612);OpenchannelMessageEvents['emit'](_0x330f4f,_0x335612);_0x569767(null);};}for(var e in events){if(events[_0x29bb('0x8')](e)){var event=events[e];OpenchannelMessage[_0x29bb('0x9')](e,emitEvent(event));}}module[_0x29bb('0xa')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x2605=['setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events','OpenchannelMessage'];(function(_0x453ccb,_0x43ce64){var _0x4326ea=function(_0x5f23a8){while(--_0x5f23a8){_0x453ccb['push'](_0x453ccb['shift']());}};_0x4326ea(++_0x43ce64);}(_0x2605,0xdf));var _0x5260=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x2605[_0x134c2e];return _0x2825db;};'use strict';var EventEmitter=require(_0x5260('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x5260('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x5260('0x2')](0x0);var events={'afterCreate':_0x5260('0x3'),'afterUpdate':_0x5260('0x4'),'afterDestroy':_0x5260('0x5')};function emitEvent(_0x237e5b){return function(_0x359421,_0x5d266d,_0x177447){OpenchannelMessageEvents['emit'](_0x237e5b+':'+_0x359421['id'],_0x359421);OpenchannelMessageEvents['emit'](_0x237e5b,_0x359421);_0x177447(null);};}for(var e in events){if(events[_0x5260('0x6')](e)){var event=events[e];OpenchannelMessage[_0x5260('0x7')](e,emitEvent(event));}}module[_0x5260('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 49687c9..26fa80f 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 _0x4ed9=['Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','POST','method','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','body','inspect','util','bluebird','request-promise','rimraf','../../config/environment','exports','define','OpenchannelMessage','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch','error','CmContact','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate'];(function(_0x331a09,_0x1b42e6){var _0x45f936=function(_0x495b0c){while(--_0x495b0c){_0x331a09['push'](_0x331a09['shift']());}};_0x45f936(++_0x1b42e6);}(_0x4ed9,0x16a));var _0x94ed=function(_0x532d03,_0x5c8e26){_0x532d03=_0x532d03-0x0;var _0x52e954=_0x4ed9[_0x532d03];return _0x52e954;};'use strict';var _=require('lodash');var util=require(_0x94ed('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x94ed('0x1'));var rp=require(_0x94ed('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x94ed('0x3'));var config=require(_0x94ed('0x4'));var attributes=require('./openchannelMessage.attributes');module[_0x94ed('0x5')]=function(_0x2e23a6,_0x410555){return _0x2e23a6[_0x94ed('0x6')](_0x94ed('0x7'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':['body'],'type':_0x94ed('0x8')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xbc33a9,_0x5420ee,_0x1b7039){var _0x5aeb8a=_0x2e23a6[_0x94ed('0x9')];var _0x246325=_0xbc33a9['get']({'plain':!![]});if(_0x246325[_0x94ed('0xa')][_0x94ed('0xb')]()==='in'||_0x246325[_0x94ed('0xa')][_0x94ed('0xb')]()===_0x94ed('0xc')&&!_0x246325['secret']&&!_[_0x94ed('0xd')](_0x246325[_0x94ed('0xe')])){_0x5aeb8a[_0x94ed('0xf')][_0x94ed('0x10')]({'where':{'id':_0x246325[_0x94ed('0x11')]}})[_0x94ed('0x12')](function(_0x30082b){if(_0x30082b){_0x30082b[_0x94ed('0x13')]({'lastMsgAt':_0x246325['createdAt'],'lastMsgDirection':_0x246325[_0x94ed('0xa')][_0x94ed('0xb')]()});}})[_0x94ed('0x14')](function(_0x3b8fa0){console[_0x94ed('0x15')](_0x3b8fa0);});}if(_0x246325[_0x94ed('0xa')]==='out'&&!_0x246325['secret']){var _0x1aa805;_0x5aeb8a[_0x94ed('0x16')]['describe']()[_0x94ed('0x12')](function(_0x47d26c){return _0x5aeb8a[_0x94ed('0x17')][_0x94ed('0x18')]({'where':{'id':_0x246325[_0x94ed('0x19')]},'include':[{'model':_0x5aeb8a[_0x94ed('0xf')],'as':_0x94ed('0x1a'),'where':{'id':_0x246325[_0x94ed('0x11')]},'limit':0x1,'include':[{'model':_0x5aeb8a['CmContact'],'as':_0x94ed('0x1b'),'attributes':_[_0x94ed('0x1c')](_0x47d26c)}]}]});})[_0x94ed('0x12')](function(_0x58c408){_0x1aa805=_0x58c408[_0x94ed('0x1d')]({'plain':!![]});if(_0x1aa805&&_0x1aa805[_0x94ed('0x1e')]){logger[_0x94ed('0x1f')](_0x94ed('0x20'),_0x94ed('0x21'),util['format'](_0x94ed('0x22'),_0x246325['id'],_0x1aa805[_0x94ed('0x1e')]));if(_0x1aa805[_0x94ed('0x1a')]&&_0x1aa805[_0x94ed('0x1a')][_0x94ed('0x23')]){_0x246325[_0x94ed('0x24')]=_['omit'](_0x1aa805[_0x94ed('0x1a')][0x0],_0x94ed('0x1b'));_0x246325[_0x94ed('0x1b')]=_0x1aa805['Interactions'][0x0]['Contact'];}var _0x5420ee={'method':_0x94ed('0x25'),'uri':encodeURI(_0x1aa805[_0x94ed('0x1e')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5420ee[_0x94ed('0x26')]){case'GET':_0x5420ee['qs']=_0x246325;break;case _0x94ed('0x25'):_0x5420ee['body']=_0x246325;break;}return rp(_0x5420ee)[_0x94ed('0x12')](function(_0xe36012){logger[_0x94ed('0x1f')](_0x94ed('0x20'),'afterCreate',util[_0x94ed('0x27')](_0x94ed('0x28'),_0x246325['id'],_0x1aa805[_0x94ed('0x1e')]));if(_0xe36012['body'][_0x94ed('0x29')]&&_0xe36012[_0x94ed('0x2a')]['threadId']!=_0x246325[_0x94ed('0x24')]['threadId']){return _0x5aeb8a[_0x94ed('0xf')]['update']({'threadId':_0xe36012['body']['threadId']},{'logging':!![],'where':{'id':_0x246325[_0x94ed('0x24')]['id']}});}else{return;}})[_0x94ed('0x12')](function(){return _0xbc33a9[_0x94ed('0x13')]({'read':!![]});})[_0x94ed('0x14')](function(_0x1ea1f5){logger[_0x94ed('0x15')]('OpenchannelMessage,\x20%s,\x20%s',_0x94ed('0x21'),util[_0x94ed('0x2b')](_0x1ea1f5,{'showHidden':![],'depth':null}));_0x1b7039();});}else{_0x1b7039();}})['finally'](function(){_0x1b7039();});}else{_0x1b7039();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xfa6f=['length','omit','method','GET','body','info','Message\x20%d\x20forwarded\x20to\x20%s','Interaction','threadId','error','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions'];(function(_0x1612e9,_0x272ff8){var _0x5a39fd=function(_0x358eb9){while(--_0x358eb9){_0x1612e9['push'](_0x1612e9['shift']());}};_0x5a39fd(++_0x272ff8);}(_0xfa6f,0x120));var _0xffa6=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0xfa6f[_0x489b87];return _0x1823b6;};'use strict';var _=require(_0xffa6('0x0'));var util=require(_0xffa6('0x1'));var logger=require(_0xffa6('0x2'))(_0xffa6('0x3'));var moment=require(_0xffa6('0x4'));var BPromise=require(_0xffa6('0x5'));var rp=require(_0xffa6('0x6'));var fs=require('fs');var path=require(_0xffa6('0x7'));var rimraf=require(_0xffa6('0x8'));var config=require(_0xffa6('0x9'));var attributes=require(_0xffa6('0xa'));module['exports']=function(_0x166ac7,_0x5583e4){return _0x166ac7['define'](_0xffa6('0xb'),attributes,{'tableName':_0xffa6('0xc'),'paranoid':![],'indexes':[{'name':_0xffa6('0xd'),'fields':['body'],'type':_0xffa6('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x27faba,_0xf982a5,_0x212d3c){var _0x3bbf5c=_0x166ac7[_0xffa6('0xf')];var _0x4c5704=_0x27faba[_0xffa6('0x10')]({'plain':!![]});if(_0x4c5704[_0xffa6('0x11')][_0xffa6('0x12')]()==='in'||_0x4c5704[_0xffa6('0x11')][_0xffa6('0x12')]()==='out'&&!_0x4c5704[_0xffa6('0x13')]&&!_[_0xffa6('0x14')](_0x4c5704[_0xffa6('0x15')])){_0x3bbf5c[_0xffa6('0x16')][_0xffa6('0x17')]({'where':{'id':_0x4c5704[_0xffa6('0x18')]}})[_0xffa6('0x19')](function(_0xa43d67){if(_0xa43d67){_0xa43d67[_0xffa6('0x1a')]({'lastMsgAt':_0x4c5704[_0xffa6('0x1b')],'lastMsgDirection':_0x4c5704[_0xffa6('0x11')][_0xffa6('0x12')]()});}})[_0xffa6('0x1c')](function(_0x502f3c){console['error'](_0x502f3c);});}if(_0x4c5704['direction']==='out'&&!_0x4c5704[_0xffa6('0x13')]){var _0x12bfaf;_0x3bbf5c[_0xffa6('0x1d')][_0xffa6('0x1e')]()[_0xffa6('0x19')](function(_0x2d5348){return _0x3bbf5c[_0xffa6('0x1f')][_0xffa6('0x20')]({'where':{'id':_0x4c5704[_0xffa6('0x21')]},'include':[{'model':_0x3bbf5c[_0xffa6('0x16')],'as':'Interactions','where':{'id':_0x4c5704[_0xffa6('0x18')]},'limit':0x1,'include':[{'model':_0x3bbf5c[_0xffa6('0x1d')],'as':_0xffa6('0x22'),'attributes':_[_0xffa6('0x23')](_0x2d5348)}]}]});})[_0xffa6('0x19')](function(_0x2cebdf){_0x12bfaf=_0x2cebdf[_0xffa6('0x10')]({'plain':!![]});if(_0x12bfaf&&_0x12bfaf[_0xffa6('0x24')]){logger['info'](_0xffa6('0x25'),_0xffa6('0x26'),util[_0xffa6('0x27')](_0xffa6('0x28'),_0x4c5704['id'],_0x12bfaf[_0xffa6('0x24')]));if(_0x12bfaf['Interactions']&&_0x12bfaf[_0xffa6('0x29')][_0xffa6('0x2a')]){_0x4c5704['Interaction']=_[_0xffa6('0x2b')](_0x12bfaf[_0xffa6('0x29')][0x0],'Contact');_0x4c5704['Contact']=_0x12bfaf['Interactions'][0x0][_0xffa6('0x22')];}var _0xf982a5={'method':'POST','uri':encodeURI(_0x12bfaf['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0xf982a5[_0xffa6('0x2c')]){case _0xffa6('0x2d'):_0xf982a5['qs']=_0x4c5704;break;case'POST':_0xf982a5[_0xffa6('0x2e')]=_0x4c5704;break;}return rp(_0xf982a5)[_0xffa6('0x19')](function(_0x2f7c7c){logger[_0xffa6('0x2f')]('OpenchannelMessage,\x20%s,\x20%s',_0xffa6('0x26'),util[_0xffa6('0x27')](_0xffa6('0x30'),_0x4c5704['id'],_0x12bfaf[_0xffa6('0x24')]));if(_0x2f7c7c[_0xffa6('0x2e')]['threadId']&&_0x2f7c7c[_0xffa6('0x2e')]['threadId']!=_0x4c5704[_0xffa6('0x31')][_0xffa6('0x32')]){return _0x3bbf5c[_0xffa6('0x16')][_0xffa6('0x1a')]({'threadId':_0x2f7c7c['body']['threadId']},{'logging':!![],'where':{'id':_0x4c5704[_0xffa6('0x31')]['id']}});}else{return;}})[_0xffa6('0x19')](function(){return _0x27faba[_0xffa6('0x1a')]({'read':!![]});})['catch'](function(_0x379a72){logger[_0xffa6('0x33')](_0xffa6('0x25'),'afterCreate',util[_0xffa6('0x34')](_0x379a72,{'showHidden':![],'depth':null}));_0x212d3c();});}else{_0x212d3c();}})['finally'](function(){_0x212d3c();});}else{_0x212d3c();}}},'charset':_0xffa6('0x35'),'collate':_0xffa6('0x36')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 6710755..6adef43 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0x4f44bb,_0x110a44){var _0x2082bc=function(_0x12c40b){while(--_0x12c40b){_0x4f44bb['push'](_0x4f44bb['shift']());}};_0x2082bc(++_0x110a44);}(_0xb10b,0x12a));var _0xbb10=function(_0x3b07d7,_0x374e44){_0x3b07d7=_0x3b07d7-0x0;var _0x2a9b53=_0xb10b[_0x3b07d7];return _0x2a9b53;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file +var _0xd8b0=['util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','./openchannelMessage.socket','register','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','options','lodash'];(function(_0x543bad,_0x32b63d){var _0x598682=function(_0x42390e){while(--_0x42390e){_0x543bad['push'](_0x543bad['shift']());}};_0x598682(++_0x32b63d);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});config[_0x0d8b('0x9')]=_['defaults'](config[_0x0d8b('0x9')],{'host':_0x0d8b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d8b('0x9')]));require(_0x0d8b('0xb'))[_0x0d8b('0xc')](socket);function respondWithRpcPromise(_0x1f4800,_0x28ff7f,_0x1cac62){return new BPromise(function(_0x2c5e9e,_0x28f87c){return client['request'](_0x1f4800,_0x1cac62)[_0x0d8b('0xd')](function(_0x4e0269){logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));logger[_0x0d8b('0x11')](_0x0d8b('0x12'),_0x28ff7f,_0x0d8b('0x10'),JSON[_0x0d8b('0x13')](_0x4e0269));if(_0x4e0269[_0x0d8b('0x14')]){if(_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x15')]===0x1f4){logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x28f87c(_0x4e0269['error'][_0x0d8b('0x16')]);}logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x2c5e9e(_0x4e0269['error'][_0x0d8b('0x16')]);}else{logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));_0x2c5e9e(_0x4e0269[_0x0d8b('0x17')][_0x0d8b('0x16')]);}})[_0x0d8b('0x18')](function(_0xa3612a){logger['error'](_0x0d8b('0xf'),_0x28ff7f,_0xa3612a);_0x28f87c(_0xa3612a);});});}exports[_0x0d8b('0x19')]=function(_0x196c0a){var _0x143372=this;return new Promise(function(_0x24e8ed,_0x5b709c){return db[_0x0d8b('0x1a')][_0x0d8b('0x1b')](_0x196c0a['body'],{'raw':_0x196c0a['options']?_0x196c0a[_0x0d8b('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5527d8){logger[_0x0d8b('0xe')](_0x0d8b('0x19'),_0x196c0a);logger[_0x0d8b('0x11')](_0x0d8b('0x19'),_0x196c0a,JSON[_0x0d8b('0x13')](_0x5527d8));_0x24e8ed(_0x5527d8);})[_0x0d8b('0x18')](function(_0x30980c){logger[_0x0d8b('0x14')](_0x0d8b('0x19'),_0x30980c['message'],_0x196c0a);_0x5b709c(_0x143372[_0x0d8b('0x14')](0x1f4,_0x30980c[_0x0d8b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 3254639..d668ec5 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 _0xb43b=['./openchannelMessage.events','save','update','emit','removeListener','length','openchannelMessage:'];(function(_0x34fb19,_0xc493c6){var _0x3a1dcd=function(_0xed1626){while(--_0xed1626){_0x34fb19['push'](_0x34fb19['shift']());}};_0x3a1dcd(++_0xc493c6);}(_0xb43b,0x1b2));var _0xbb43=function(_0x54f1a7,_0x2d911b){_0x54f1a7=_0x54f1a7-0x0;var _0x21ebc4=_0xb43b[_0x54f1a7];return _0x21ebc4;};'use strict';var OpenchannelMessageEvents=require(_0xbb43('0x0'));var events=[_0xbb43('0x1'),'remove',_0xbb43('0x2')];function createListener(_0x1995f8,_0x22bc86){return function(_0x4cf605){_0x22bc86[_0xbb43('0x3')](_0x1995f8,_0x4cf605);};}function removeListener(_0x41aff6,_0x351254){return function(){OpenchannelMessageEvents[_0xbb43('0x4')](_0x41aff6,_0x351254);};}exports['register']=function(_0x491fb9){for(var _0x378df5=0x0,_0x553520=events[_0xbb43('0x5')];_0x378df5<_0x553520;_0x378df5++){var _0x1ccd49=events[_0x378df5];var _0x2a2f11=createListener(_0xbb43('0x6')+_0x1ccd49,_0x491fb9);OpenchannelMessageEvents['on'](_0x1ccd49,_0x2a2f11);}}; \ No newline at end of file +var _0xac4a=['save','remove','update','removeListener','./openchannelMessage.events'];(function(_0x13ff53,_0x5e1424){var _0x290228=function(_0x3e3133){while(--_0x3e3133){_0x13ff53['push'](_0x13ff53['shift']());}};_0x290228(++_0x5e1424);}(_0xac4a,0x13f));var _0xaac4=function(_0x9d4032,_0x2184e2){_0x9d4032=_0x9d4032-0x0;var _0x274c9e=_0xac4a[_0x9d4032];return _0x274c9e;};'use strict';var OpenchannelMessageEvents=require(_0xaac4('0x0'));var events=[_0xaac4('0x1'),_0xaac4('0x2'),_0xaac4('0x3')];function createListener(_0x38f4f4,_0x1dc251){return function(_0x5aeb7d){_0x1dc251['emit'](_0x38f4f4,_0x5aeb7d);};}function removeListener(_0x2af0f6,_0x2a5762){return function(){OpenchannelMessageEvents[_0xaac4('0x4')](_0x2af0f6,_0x2a5762);};}exports['register']=function(_0x1283a5){for(var _0x53d03a=0x0,_0x1cdfc5=events['length'];_0x53d03a<_0x1cdfc5;_0x53d03a++){var _0x1e4283=events[_0x53d03a];var _0x27354c=createListener('openchannelMessage:'+_0x1e4283,_0x1283a5);OpenchannelMessageEvents['on'](_0x1e4283,_0x27354c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 7281e73..0fa233c 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 _0xbf07=['post','create','/:id/teams','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','get','/describe','describe','/:id','isAuthenticated','show','/:id/members','getTeams','/:id/users','getAgents'];(function(_0x5ce069,_0x126368){var _0x24d350=function(_0x5325a1){while(--_0x5325a1){_0x5ce069['push'](_0x5ce069['shift']());}};_0x24d350(++_0x126368);}(_0xbf07,0x77));var _0x7bf0=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0xbf07[_0x2becba];return _0x90b5dd;};'use strict';var multer=require(_0x7bf0('0x0'));var util=require(_0x7bf0('0x1'));var path=require(_0x7bf0('0x2'));var timeout=require(_0x7bf0('0x3'));var express=require('express');var router=express[_0x7bf0('0x4')]();var auth=require(_0x7bf0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0x7bf0('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7bf0('0x7'),auth['isAuthenticated'](),controller[_0x7bf0('0x8')]);router['get'](_0x7bf0('0x9'),auth[_0x7bf0('0xa')](),controller[_0x7bf0('0xb')]);router[_0x7bf0('0x6')](_0x7bf0('0xc'),auth[_0x7bf0('0xa')](),controller['getMembers']);router[_0x7bf0('0x6')]('/:id/teams',auth[_0x7bf0('0xa')](),controller[_0x7bf0('0xd')]);router[_0x7bf0('0x6')](_0x7bf0('0xe'),auth[_0x7bf0('0xa')](),controller[_0x7bf0('0xf')]);router[_0x7bf0('0x10')]('/',auth[_0x7bf0('0xa')](),controller[_0x7bf0('0x11')]);router[_0x7bf0('0x10')](_0x7bf0('0x12'),auth[_0x7bf0('0xa')](),controller[_0x7bf0('0x13')]);router[_0x7bf0('0x10')](_0x7bf0('0xe'),auth[_0x7bf0('0xa')](),controller[_0x7bf0('0x14')]);router[_0x7bf0('0x15')](_0x7bf0('0x9'),auth[_0x7bf0('0xa')](),controller['update']);router[_0x7bf0('0x16')](_0x7bf0('0x9'),auth[_0x7bf0('0xa')](),controller[_0x7bf0('0x17')]);router[_0x7bf0('0x16')]('/:id/teams',auth[_0x7bf0('0xa')](),controller[_0x7bf0('0x18')]);router[_0x7bf0('0x16')](_0x7bf0('0xe'),auth[_0x7bf0('0xa')](),controller[_0x7bf0('0x19')]);module[_0x7bf0('0x1a')]=router; \ No newline at end of file +var _0x1883=['removeTeams','/:id/users','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','update','delete'];(function(_0x4987ae,_0x1705ad){var _0x5bfb3e=function(_0x2575fa){while(--_0x2575fa){_0x4987ae['push'](_0x4987ae['shift']());}};_0x5bfb3e(++_0x1705ad);}(_0x1883,0xab));var _0x3188=function(_0x69aeab,_0x39e857){_0x69aeab=_0x69aeab-0x0;var _0x3e93cd=_0x1883[_0x69aeab];return _0x3e93cd;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var auth=require(_0x3188('0x6'));var interaction=require(_0x3188('0x7'));var config=require(_0x3188('0x8'));var controller=require(_0x3188('0x9'));router[_0x3188('0xa')]('/',auth[_0x3188('0xb')](),controller[_0x3188('0xc')]);router[_0x3188('0xa')](_0x3188('0xd'),auth[_0x3188('0xb')](),controller[_0x3188('0xe')]);router['get'](_0x3188('0xf'),auth[_0x3188('0xb')](),controller['show']);router[_0x3188('0xa')]('/:id/members',auth[_0x3188('0xb')](),controller[_0x3188('0x10')]);router[_0x3188('0xa')](_0x3188('0x11'),auth['isAuthenticated'](),controller[_0x3188('0x12')]);router[_0x3188('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0x3188('0x13')]);router[_0x3188('0x14')]('/',auth[_0x3188('0xb')](),controller[_0x3188('0x15')]);router[_0x3188('0x14')](_0x3188('0x11'),auth['isAuthenticated'](),controller[_0x3188('0x16')]);router['post']('/:id/users',auth[_0x3188('0xb')](),controller['addAgents']);router['put'](_0x3188('0xf'),auth[_0x3188('0xb')](),controller[_0x3188('0x17')]);router[_0x3188('0x18')](_0x3188('0xf'),auth[_0x3188('0xb')](),controller['destroy']);router[_0x3188('0x18')](_0x3188('0x11'),auth[_0x3188('0xb')](),controller[_0x3188('0x19')]);router[_0x3188('0x18')](_0x3188('0x1a'),auth[_0x3188('0xb')](),controller[_0x3188('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index e59eed5..ae9d2e0 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 _0x020a=['roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x4f5f9d,_0x4ce99a){var _0x3b79b2=function(_0x58d567){while(--_0x58d567){_0x4f5f9d['push'](_0x4f5f9d['shift']());}};_0x3b79b2(++_0x4ce99a);}(_0x020a,0xc9));var _0xa020=function(_0x2b78e5,_0x3126f8){_0x2b78e5=_0x2b78e5-0x0;var _0xa8d52d=_0x020a[_0x2b78e5];return _0xa8d52d;};'use strict';var Sequelize=require(_0xa020('0x0'));module[_0xa020('0x1')]={'name':{'type':Sequelize[_0xa020('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa020('0x2')]},'timeout':{'type':Sequelize[_0xa020('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa020('0x4')](_0xa020('0x5'),_0xa020('0x6'),_0xa020('0x7'))}}; \ No newline at end of file +var _0x1c77=['STRING','name','INTEGER','rrmemory','beepall','roundrobin','exports'];(function(_0x5b291c,_0xaeafc0){var _0x327b25=function(_0x5d6e6f){while(--_0x5d6e6f){_0x5b291c['push'](_0x5b291c['shift']());}};_0x327b25(++_0xaeafc0);}(_0x1c77,0xed));var _0x71c7=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x1c77[_0x3ce2c4];return _0x4047c1;};'use strict';var Sequelize=require('sequelize');module[_0x71c7('0x0')]={'name':{'type':Sequelize[_0x71c7('0x1')],'unique':_0x71c7('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x71c7('0x1')]},'timeout':{'type':Sequelize[_0x71c7('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x71c7('0x4'),_0x71c7('0x5'),_0x71c7('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 306dad1..ad737ab 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 _0x0e7b=['key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','OpenchannelQueue','includeAll','include','catch','show','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserOpenchannelQueue','pick','OpenchannelQueueId','filter','findAll','agent','openchannelPause','rows','format','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','sequelize','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','field','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','emit','isArray','getAgents','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','json','count','offset','limit','set','reject','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type'];(function(_0x520ce3,_0x196a74){var _0x1fbdb0=function(_0x364da9){while(--_0x364da9){_0x520ce3['push'](_0x520ce3['shift']());}};_0x1fbdb0(++_0x196a74);}(_0x0e7b,0x172));var _0xb0e7=function(_0x4a02a3,_0x5235b9){_0x4a02a3=_0x4a02a3-0x0;var _0x175d27=_0x0e7b[_0x4a02a3];return _0x175d27;};'use strict';var pdf=require(_0xb0e7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb0e7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb0e7('0x2'));var rp=require(_0xb0e7('0x3'));var moment=require('moment');var BPromise=require(_0xb0e7('0x4'));var Mustache=require(_0xb0e7('0x5'));var util=require(_0xb0e7('0x6'));var path=require(_0xb0e7('0x7'));var sox=require(_0xb0e7('0x8'));var csv=require(_0xb0e7('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb0e7('0xa'));var squel=require(_0xb0e7('0xb'));var crypto=require('crypto');var jsforce=require(_0xb0e7('0xc'));var deskjs=require(_0xb0e7('0xd'));var toCsv=require(_0xb0e7('0x9'));var querystring=require(_0xb0e7('0xe'));var Papa=require(_0xb0e7('0xf'));var Redis=require(_0xb0e7('0x10'));var authService=require(_0xb0e7('0x11'));var qs=require(_0xb0e7('0x12'));var as=require(_0xb0e7('0x13'));var hardwareService=require(_0xb0e7('0x14'));var logger=require('../../config/logger')(_0xb0e7('0x15'));var utils=require(_0xb0e7('0x16'));var config=require(_0xb0e7('0x17'));var licenseUtil=require(_0xb0e7('0x18'));var db=require('../../mysqldb')['db'];config[_0xb0e7('0x19')]=_[_0xb0e7('0x1a')](config[_0xb0e7('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xb0e7('0x1b'))(new Redis(config['redis']));require(_0xb0e7('0x1c'))[_0xb0e7('0x1d')](socket);function respondWithStatusCode(_0x16969b,_0x2375c4){_0x2375c4=_0x2375c4||0xcc;return function(_0x106dd6){if(_0x106dd6){return _0x16969b[_0xb0e7('0x1e')](_0x2375c4);}return _0x16969b['status'](_0x2375c4)[_0xb0e7('0x1f')]();};}function respondWithResult(_0xea793b,_0x5af23e){_0x5af23e=_0x5af23e||0xc8;return function(_0x4449aa){if(_0x4449aa){return _0xea793b[_0xb0e7('0x20')](_0x5af23e)[_0xb0e7('0x21')](_0x4449aa);}};}function respondWithFilteredResult(_0x4033d8,_0x4a4dc4){return function(_0x3a1e43){if(_0x3a1e43){var _0x276e59=_0x3a1e43[_0xb0e7('0x22')],_0x575084=_0x4a4dc4[_0xb0e7('0x23')],_0x63b9cd=_0x4a4dc4['offset']+_0x4a4dc4[_0xb0e7('0x24')],_0x5643db;if(_0x63b9cd>=_0x276e59){_0x63b9cd=_0x276e59;_0x5643db=0xc8;}else{_0x5643db=0xce;}_0x4033d8[_0xb0e7('0x20')](_0x5643db);return _0x4033d8[_0xb0e7('0x25')]('Content-Range',_0x575084+'-'+_0x63b9cd+'/'+_0x276e59)['json'](_0x3a1e43);}return null;};}function patchUpdates(_0x4733a8){return function(_0x405521){try{jsonpatch['apply'](_0x405521,_0x4733a8,!![]);}catch(_0x14e988){return BPromise[_0xb0e7('0x26')](_0x14e988);}return _0x405521['save']();};}function saveUpdates(_0x2af2ff,_0x3f1dd0){return function(_0x3d4e89){if(_0x3d4e89){return _0x3d4e89[_0xb0e7('0x27')](_0x2af2ff)[_0xb0e7('0x28')](function(_0x509a76){return _0x509a76;});}return null;};}function removeEntity(_0x2b47a3,_0x3fe844){return function(_0x1372e5){if(_0x1372e5){return _0x1372e5[_0xb0e7('0x29')]()[_0xb0e7('0x28')](function(){var _0xbf4111=_0x1372e5[_0xb0e7('0x2a')]({'plain':!![]});var _0x107507=_0xb0e7('0x2b');return db[_0xb0e7('0x2c')][_0xb0e7('0x29')]({'where':{'type':_0x107507,'resourceId':_0xbf4111['id']}})[_0xb0e7('0x28')](function(){return _0x1372e5;});})[_0xb0e7('0x28')](function(){_0x2b47a3[_0xb0e7('0x20')](0xcc)[_0xb0e7('0x1f')]();});}};}function handleEntityNotFound(_0x3ccd60,_0x35da79){return function(_0x40239f){if(!_0x40239f){_0x3ccd60['sendStatus'](0x194);}return _0x40239f;};}function handleError(_0x47adcb,_0x490671){_0x490671=_0x490671||0x1f4;return function(_0x434ecb){logger[_0xb0e7('0x2d')](_0x434ecb[_0xb0e7('0x2e')]);if(_0x434ecb['name']){delete _0x434ecb[_0xb0e7('0x2f')];}_0x47adcb[_0xb0e7('0x20')](_0x490671)[_0xb0e7('0x30')](_0x434ecb);};}exports[_0xb0e7('0x31')]=function(_0x330b65,_0x5c5895){var _0x5a981a={},_0x5ddf85={},_0x3596dd={'count':0x0,'rows':[]};var _0x2e5d4f=_[_0xb0e7('0x32')](db['OpenchannelQueue'][_0xb0e7('0x33')],function(_0x54567f){return{'name':_0x54567f['fieldName'],'type':_0x54567f[_0xb0e7('0x34')][_0xb0e7('0x35')]};});_0x5ddf85[_0xb0e7('0x36')]=_[_0xb0e7('0x32')](_0x2e5d4f,_0xb0e7('0x2f'));_0x5ddf85[_0xb0e7('0x37')]=_[_0xb0e7('0x38')](_0x330b65[_0xb0e7('0x37')]);_0x5ddf85[_0xb0e7('0x39')]=_['intersection'](_0x5ddf85[_0xb0e7('0x36')],_0x5ddf85[_0xb0e7('0x37')]);_0x5a981a['attributes']=_[_0xb0e7('0x3a')](_0x5ddf85[_0xb0e7('0x36')],qs[_0xb0e7('0x3b')](_0x330b65['query']['fields']));_0x5a981a['attributes']=_0x5a981a[_0xb0e7('0x3c')]['length']?_0x5a981a['attributes']:_0x5ddf85[_0xb0e7('0x36')];if(!_0x330b65[_0xb0e7('0x37')][_0xb0e7('0x3d')](_0xb0e7('0x3e'))){_0x5a981a[_0xb0e7('0x24')]=qs[_0xb0e7('0x24')](_0x330b65[_0xb0e7('0x37')][_0xb0e7('0x24')]);_0x5a981a['offset']=qs['offset'](_0x330b65[_0xb0e7('0x37')][_0xb0e7('0x23')]);}_0x5a981a[_0xb0e7('0x3f')]=qs[_0xb0e7('0x40')](_0x330b65[_0xb0e7('0x37')][_0xb0e7('0x40')]);_0x5a981a[_0xb0e7('0x41')]=qs[_0xb0e7('0x39')](_['pick'](_0x330b65[_0xb0e7('0x37')],_0x5ddf85[_0xb0e7('0x39')]),_0x2e5d4f);if(_0x330b65[_0xb0e7('0x37')]['filter']){_0x5a981a[_0xb0e7('0x41')]=_[_0xb0e7('0x42')](_0x5a981a['where'],{'$or':_[_0xb0e7('0x32')](_0x2e5d4f,function(_0x436975){if(_0x436975[_0xb0e7('0x34')]!==_0xb0e7('0x43')){var _0x420f72={};_0x420f72[_0x436975[_0xb0e7('0x2f')]]={'$like':'%'+_0x330b65[_0xb0e7('0x37')]['filter']+'%'};return _0x420f72;}})});}_0x5a981a=_['merge']({},_0x5a981a,_0x330b65['options']);var _0x5d62ff={'where':_0x5a981a[_0xb0e7('0x41')]};return db[_0xb0e7('0x44')][_0xb0e7('0x22')](_0x5d62ff)['then'](function(_0x2830d7){_0x3596dd[_0xb0e7('0x22')]=_0x2830d7;if(_0x330b65['query'][_0xb0e7('0x45')]){_0x5a981a[_0xb0e7('0x46')]=[{'all':!![]}];}return db[_0xb0e7('0x44')]['findAll'](_0x5a981a);})[_0xb0e7('0x28')](function(_0x258a7f){_0x3596dd['rows']=_0x258a7f;return _0x3596dd;})[_0xb0e7('0x28')](respondWithFilteredResult(_0x5c5895,_0x5a981a))[_0xb0e7('0x47')](handleError(_0x5c5895,null));};exports[_0xb0e7('0x48')]=function(_0x5a9b3b,_0x4f8ac3){var _0x51a840={'raw':!![],'where':{'id':_0x5a9b3b['params']['id']}},_0x4f1339={};_0x4f1339[_0xb0e7('0x36')]=_[_0xb0e7('0x38')](db[_0xb0e7('0x44')][_0xb0e7('0x33')]);_0x4f1339[_0xb0e7('0x37')]=_[_0xb0e7('0x38')](_0x5a9b3b[_0xb0e7('0x37')]);_0x4f1339['filters']=_[_0xb0e7('0x3a')](_0x4f1339[_0xb0e7('0x36')],_0x4f1339[_0xb0e7('0x37')]);_0x51a840['attributes']=_['intersection'](_0x4f1339[_0xb0e7('0x36')],qs['fields'](_0x5a9b3b[_0xb0e7('0x37')][_0xb0e7('0x3b')]));_0x51a840['attributes']=_0x51a840['attributes'][_0xb0e7('0x49')]?_0x51a840[_0xb0e7('0x3c')]:_0x4f1339[_0xb0e7('0x36')];if(_0x5a9b3b['query'][_0xb0e7('0x45')]){_0x51a840[_0xb0e7('0x46')]=[{'all':!![]}];}_0x51a840=_[_0xb0e7('0x42')]({},_0x51a840,_0x5a9b3b[_0xb0e7('0x4a')]);return db['OpenchannelQueue'][_0xb0e7('0x4b')](_0x51a840)['then'](handleEntityNotFound(_0x4f8ac3,null))[_0xb0e7('0x28')](respondWithResult(_0x4f8ac3,null))[_0xb0e7('0x47')](handleError(_0x4f8ac3,null));};exports[_0xb0e7('0x4c')]=function(_0x3815dd,_0x279972){return db['OpenchannelQueue'][_0xb0e7('0x4c')](_0x3815dd[_0xb0e7('0x4d')],{})['then'](function(_0x1ae56e){var _0x4c179a=_0x3815dd['user'][_0xb0e7('0x2a')]({'plain':!![]});if(!_0x4c179a)throw new Error(_0xb0e7('0x4e'));if(_0x4c179a[_0xb0e7('0x4f')]===_0xb0e7('0x50')){var _0x114df3=_0x1ae56e[_0xb0e7('0x2a')]({'plain':!![]});var _0x515665=_0xb0e7('0x2b');return db['UserProfileSection'][_0xb0e7('0x4b')]({'where':{'name':_0x515665,'userProfileId':_0x4c179a[_0xb0e7('0x51')]},'raw':!![]})['then'](function(_0x6ea921){if(_0x6ea921&&_0x6ea921['autoAssociation']===0x0){return db[_0xb0e7('0x2c')]['create']({'name':_0x114df3[_0xb0e7('0x2f')],'resourceId':_0x114df3['id'],'type':_0x6ea921[_0xb0e7('0x2f')],'sectionId':_0x6ea921['id']},{})[_0xb0e7('0x28')](function(){return _0x1ae56e;});}else{return _0x1ae56e;}})[_0xb0e7('0x47')](function(_0x53ee52){logger[_0xb0e7('0x2d')](_0xb0e7('0x52'),_0x53ee52);throw _0x53ee52;});}return _0x1ae56e;})[_0xb0e7('0x28')](respondWithResult(_0x279972,0xc9))['catch'](handleError(_0x279972,null));};exports[_0xb0e7('0x27')]=function(_0x4c00ea,_0x271b43){if(_0x4c00ea[_0xb0e7('0x4d')]['id']){delete _0x4c00ea[_0xb0e7('0x4d')]['id'];}return db[_0xb0e7('0x44')][_0xb0e7('0x4b')]({'where':{'id':_0x4c00ea['params']['id']}})[_0xb0e7('0x28')](handleEntityNotFound(_0x271b43,null))['then'](saveUpdates(_0x4c00ea[_0xb0e7('0x4d')],null))[_0xb0e7('0x28')](respondWithResult(_0x271b43,null))[_0xb0e7('0x47')](handleError(_0x271b43,null));};exports['destroy']=function(_0x78327f,_0x6a6791){return db[_0xb0e7('0x44')][_0xb0e7('0x4b')]({'where':{'id':_0x78327f[_0xb0e7('0x53')]['id']}})['then'](handleEntityNotFound(_0x6a6791,null))[_0xb0e7('0x28')](removeEntity(_0x6a6791,null))[_0xb0e7('0x47')](handleError(_0x6a6791,null));};exports[_0xb0e7('0x54')]=function(_0x105f69,_0x1ae0bb){return db['OpenchannelQueue'][_0xb0e7('0x54')]()[_0xb0e7('0x28')](respondWithResult(_0x1ae0bb,null))[_0xb0e7('0x47')](handleError(_0x1ae0bb,null));};exports[_0xb0e7('0x55')]=function(_0x58cc9a,_0x577ade,_0x5091b9){var _0x161d0c={'raw':!![],'where':{}},_0x4d8eb8={},_0x4e268e;return db[_0xb0e7('0x44')][_0xb0e7('0x56')]({'where':{'id':_0x58cc9a[_0xb0e7('0x53')]['id']}})[_0xb0e7('0x28')](handleEntityNotFound(_0x577ade,null))[_0xb0e7('0x28')](function(_0x14f597){if(_0x14f597){_0x4e268e=_0x14f597[_0xb0e7('0x2a')]({'plain':!![]});_0x4d8eb8[_0xb0e7('0x36')]=_[_0xb0e7('0x38')](db[_0xb0e7('0x57')][_0xb0e7('0x33')]);_0x4d8eb8[_0xb0e7('0x37')]=_[_0xb0e7('0x38')](_0x58cc9a[_0xb0e7('0x37')]);_0x4d8eb8['filters']=_[_0xb0e7('0x3a')](_0x4d8eb8[_0xb0e7('0x36')],_0x4d8eb8[_0xb0e7('0x37')]);_0x161d0c['attributes']=_['intersection'](_0x4d8eb8[_0xb0e7('0x36')],qs[_0xb0e7('0x3b')](_0x58cc9a[_0xb0e7('0x37')][_0xb0e7('0x3b')]));_0x161d0c[_0xb0e7('0x3c')]=_0x161d0c[_0xb0e7('0x3c')][_0xb0e7('0x49')]?_0x161d0c[_0xb0e7('0x3c')]:_0x4d8eb8[_0xb0e7('0x36')];if(!_0x58cc9a[_0xb0e7('0x37')]['hasOwnProperty']('nolimit')){_0x161d0c[_0xb0e7('0x24')]=qs[_0xb0e7('0x24')](_0x58cc9a[_0xb0e7('0x37')][_0xb0e7('0x24')]);_0x161d0c[_0xb0e7('0x23')]=qs['offset'](_0x58cc9a['query'][_0xb0e7('0x23')]);}_0x161d0c['order']=qs['sort'](_0x58cc9a[_0xb0e7('0x37')][_0xb0e7('0x40')]);_0x161d0c['where']=qs[_0xb0e7('0x39')](_[_0xb0e7('0x58')](_0x58cc9a[_0xb0e7('0x37')],_0x4d8eb8['filters']));_0x161d0c[_0xb0e7('0x41')][_0xb0e7('0x59')]=_0x14f597['id'];if(_0x58cc9a[_0xb0e7('0x37')][_0xb0e7('0x5a')]){_0x161d0c[_0xb0e7('0x41')]=_['merge'](_0x161d0c[_0xb0e7('0x41')],{'$or':_[_0xb0e7('0x32')](_0x161d0c['attributes'],function(_0x137a84){var _0xfaa934={};_0xfaa934[_0x137a84]={'$like':'%'+_0x58cc9a[_0xb0e7('0x37')]['filter']+'%'};return _0xfaa934;})});}_0x161d0c=_[_0xb0e7('0x42')]({},_0x161d0c,_0x58cc9a['options']);return db['UserOpenchannelQueue'][_0xb0e7('0x5b')](_0x161d0c);}})[_0xb0e7('0x28')](function(_0x48e80f){if(_0x48e80f){return db['User']['findAndCountAll']({'where':{'id':_[_0xb0e7('0x32')](_0x48e80f,'UserId'),'role':_0xb0e7('0x5c')},'attributes':['id',_0xb0e7('0x2f'),_0xb0e7('0x5d'),'updatedAt','createdAt']});}})[_0xb0e7('0x28')](function(_0x32930a){if(_0x32930a){return{'count':_0x32930a['count'],'rows':_[_0xb0e7('0x32')](_0x32930a[_0xb0e7('0x5e')],function(_0x3cbfe4){return{'membername':_0x3cbfe4['name'],'UserId':_0x3cbfe4['id'],'queue_name':_0x4e268e[_0xb0e7('0x2f')],'OpenchannelQueueId':_0x4e268e['id'],'interface':util[_0xb0e7('0x5f')](_0xb0e7('0x60'),_0xb0e7('0x61'),_0x3cbfe4[_0xb0e7('0x2f')]),'penalty':0x0,'paused':_0x3cbfe4[_0xb0e7('0x5d')],'createdAt':_0x3cbfe4[_0xb0e7('0x62')],'updatedAt':_0x3cbfe4[_0xb0e7('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x577ade,_0x161d0c))[_0xb0e7('0x47')](handleError(_0x577ade,null));};exports[_0xb0e7('0x64')]=function(_0x333a39,_0x3b898f,_0x2a2c78){var _0x45c7a7={};var _0x1261a6={};var _0x1a36d5;var _0x3ac506;return db[_0xb0e7('0x44')][_0xb0e7('0x56')]({'where':{'id':_0x333a39[_0xb0e7('0x53')]['id']}})['then'](handleEntityNotFound(_0x3b898f,null))[_0xb0e7('0x28')](function(_0x5707ef){if(_0x5707ef){_0x1a36d5=_0x5707ef;_0x1261a6[_0xb0e7('0x36')]=_[_0xb0e7('0x38')](db[_0xb0e7('0x65')]['rawAttributes']);_0x1261a6['query']=_['keys'](_0x333a39[_0xb0e7('0x37')]);_0x1261a6[_0xb0e7('0x39')]=_['intersection'](_0x1261a6[_0xb0e7('0x36')],_0x1261a6['query']);_0x45c7a7['attributes']=_['intersection'](_0x1261a6['model'],qs[_0xb0e7('0x3b')](_0x333a39[_0xb0e7('0x37')]['fields']));_0x45c7a7['attributes']=_0x45c7a7['attributes'][_0xb0e7('0x49')]?_0x45c7a7[_0xb0e7('0x3c')]:_0x1261a6[_0xb0e7('0x36')];_0x45c7a7[_0xb0e7('0x3f')]=qs[_0xb0e7('0x40')](_0x333a39[_0xb0e7('0x37')][_0xb0e7('0x40')]);_0x45c7a7[_0xb0e7('0x41')]=qs[_0xb0e7('0x39')](_[_0xb0e7('0x58')](_0x333a39[_0xb0e7('0x37')],_0x1261a6[_0xb0e7('0x39')]));if(_0x333a39[_0xb0e7('0x37')][_0xb0e7('0x5a')]){_0x45c7a7[_0xb0e7('0x41')]=_['merge'](_0x45c7a7[_0xb0e7('0x41')],{'$or':_[_0xb0e7('0x32')](_0x45c7a7[_0xb0e7('0x3c')],function(_0x4b84d5){var _0x4478f5={};_0x4478f5[_0x4b84d5]={'$like':'%'+_0x333a39[_0xb0e7('0x37')][_0xb0e7('0x5a')]+'%'};return _0x4478f5;})});}_0x45c7a7=_[_0xb0e7('0x42')]({},_0x45c7a7,_0x333a39[_0xb0e7('0x4a')]);return _0x1a36d5[_0xb0e7('0x64')](_0x45c7a7);}})[_0xb0e7('0x28')](function(_0x1a60a1){if(_0x1a60a1){_0x3ac506=_0x1a60a1['length'];if(!_0x333a39[_0xb0e7('0x37')][_0xb0e7('0x3d')](_0xb0e7('0x3e'))){_0x45c7a7[_0xb0e7('0x24')]=qs['limit'](_0x333a39['query'][_0xb0e7('0x24')]);_0x45c7a7[_0xb0e7('0x23')]=qs[_0xb0e7('0x23')](_0x333a39[_0xb0e7('0x37')][_0xb0e7('0x23')]);}return _0x1a36d5[_0xb0e7('0x64')](_0x45c7a7);}})[_0xb0e7('0x28')](function(_0xac456b){if(_0xac456b){return _0xac456b?{'count':_0x3ac506,'rows':_0xac456b}:null;}})[_0xb0e7('0x28')](respondWithResult(_0x3b898f,null))[_0xb0e7('0x47')](handleError(_0x3b898f,null));};exports[_0xb0e7('0x66')]=function(_0x43f969,_0x1a316b,_0x1256cc){var _0x3b2f85=_0x43f969[_0xb0e7('0x4d')][_0xb0e7('0x67')];return db[_0xb0e7('0x65')][_0xb0e7('0x5b')]({'where':{'id':_0x3b2f85},'attributes':['id'],'include':[{'model':db[_0xb0e7('0x68')],'as':_0xb0e7('0x69'),'attributes':['id','name',_0xb0e7('0x6a'),_0xb0e7('0x6b'),'interface'],'raw':!![]}]})['then'](function(_0x3cf843){if(_0x3cf843){var _0x4e6460=_['flatMap'](_0x3cf843,function(_0xfb5af){var _0x5f176e=_0xfb5af['get']({'plain':!![]});return _0x5f176e[_0xb0e7('0x69')];});return db[_0xb0e7('0x44')][_0xb0e7('0x4b')]({'where':{'id':_0x43f969[_0xb0e7('0x53')]['id']}})['then'](function(_0x5272a3){return db[_0xb0e7('0x6c')][_0xb0e7('0x6d')](function(_0x37ad62){return _0x5272a3[_0xb0e7('0x66')](_0x3b2f85,{'transaction':_0x37ad62})['then'](function(){return BPromise[_0xb0e7('0x6e')](_0x4e6460,function(_0x1fd082){return db[_0xb0e7('0x57')][_0xb0e7('0x6f')]({'where':{'UserId':_0x1fd082['id'],'OpenchannelQueueId':_0x43f969[_0xb0e7('0x53')]['id']},'transaction':_0x37ad62});});})[_0xb0e7('0x28')](function(){_0x4e6460[_0xb0e7('0x70')](function(_0x167203){socket['emit'](_0xb0e7('0x71'),{'UserId':_0x167203['id'],'OpenchannelQueueId':_0x5272a3['id']});});});});});}})['then'](respondWithStatusCode(_0x1a316b,null))[_0xb0e7('0x47')](handleError(_0x1a316b,null));};exports[_0xb0e7('0x72')]=function(_0x4690bf,_0xdf9fa8,_0x9ac4f5){return db[_0xb0e7('0x65')][_0xb0e7('0x5b')]({'where':{'id':_0x4690bf['query'][_0xb0e7('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb0e7('0x69'),'attributes':['id'],'raw':!![]}]})[_0xb0e7('0x28')](handleEntityNotFound(_0xdf9fa8,null))[_0xb0e7('0x28')](function(_0x5c53dd){var _0x4ae3cc=_[_0xb0e7('0x32')](_0x5c53dd,'id');var _0x192d80=[];var _0x39007b=[];var _0x3446a7=squel[_0xb0e7('0x73')]();_0x3446a7[_0xb0e7('0x74')]('tq.TeamId')[_0xb0e7('0x75')](_0xb0e7('0x76'),'tq')['join'](_0xb0e7('0x77'),'ut',_0xb0e7('0x78'))['where'](_0xb0e7('0x79'),_0x4690bf[_0xb0e7('0x53')]['id']);for(var _0x4aa3e2=0x0;_0x4aa3e2<_0x5c53dd['length'];_0x4aa3e2+=0x1){let _0x55e7fc=_0x5c53dd[_0x4aa3e2];for(var _0x5efcd7=0x0;_0x5efcd7<_0x55e7fc[_0xb0e7('0x69')][_0xb0e7('0x49')];_0x5efcd7+=0x1){let _0x1419ce=_0x55e7fc[_0xb0e7('0x69')][_0x5efcd7];var _0x144b14=_0x3446a7[_0xb0e7('0x7a')]();_0x144b14['where'](_0xb0e7('0x7b'),_0x1419ce['id']);_0x39007b['push'](db[_0xb0e7('0x6c')][_0xb0e7('0x37')](_0x144b14[_0xb0e7('0x7c')](),{'type':db[_0xb0e7('0x6c')][_0xb0e7('0x7d')][_0xb0e7('0x7e')]})['then'](function(_0x284a53){if(_0x284a53['length']===0x1){return _0x1419ce['id'];}else{var _0x4ec197=_[_0xb0e7('0x7f')](_[_0xb0e7('0x32')](_0x284a53,_0xb0e7('0x80')),function(_0x355a42){return _[_0xb0e7('0x81')](_0x4ae3cc,_0x355a42);});if(_0x4ec197){return _0x1419ce['id'];}}}));}}return BPromise['all'](_0x39007b)[_0xb0e7('0x28')](function(_0xa0571f){_0x192d80=_(_0x192d80)[_0xb0e7('0x82')](_0xa0571f)[_0xb0e7('0x83')]()[_0xb0e7('0x84')]();return db[_0xb0e7('0x44')][_0xb0e7('0x4b')]({'where':{'id':_0x4690bf[_0xb0e7('0x53')]['id']}})['then'](function(_0x32692c){return db[_0xb0e7('0x6c')][_0xb0e7('0x6d')](function(_0x56b714){return _0x32692c['removeTeams'](_0x4690bf[_0xb0e7('0x37')]['ids'],{'transaction':_0x56b714})[_0xb0e7('0x28')](function(){if(!_[_0xb0e7('0x85')](_0x192d80)){return _0x32692c[_0xb0e7('0x86')](_0x192d80,{'transaction':_0x56b714});}})[_0xb0e7('0x28')](function(){_0x192d80[_0xb0e7('0x70')](function(_0x293d0d){socket['emit'](_0xb0e7('0x87'),{'UserId':_0x293d0d,'OpenchannelQueueId':_0x32692c['id']});});});});});});})[_0xb0e7('0x28')](respondWithStatusCode(_0xdf9fa8,null))[_0xb0e7('0x47')](handleError(_0xdf9fa8,null));};exports[_0xb0e7('0x88')]=function(_0x1f93e9,_0x328ccc,_0x497cea){return db[_0xb0e7('0x44')][_0xb0e7('0x4b')]({'where':{'id':_0x1f93e9[_0xb0e7('0x53')]['id']}})[_0xb0e7('0x28')](handleEntityNotFound(_0x328ccc,null))[_0xb0e7('0x28')](function(_0x4332a5){if(_0x4332a5){return _0x4332a5[_0xb0e7('0x88')](_0x1f93e9[_0xb0e7('0x4d')]['ids'],_[_0xb0e7('0x89')](_0x1f93e9[_0xb0e7('0x4d')],[_0xb0e7('0x67'),'id'])||{})['spread'](function(_0x572d7d){for(var _0x587f62=0x0;_0x587f62<_0x1f93e9[_0xb0e7('0x4d')][_0xb0e7('0x67')][_0xb0e7('0x49')];_0x587f62+=0x1){socket[_0xb0e7('0x8a')]('userOpenchannelQueue:save',{'UserId':_0x1f93e9[_0xb0e7('0x4d')][_0xb0e7('0x67')][_0x587f62],'OpenchannelQueueId':_0x1f93e9[_0xb0e7('0x53')]['id']});}return _0x572d7d;});}})['then'](respondWithResult(_0x328ccc,null))[_0xb0e7('0x47')](handleError(_0x328ccc,null));};exports[_0xb0e7('0x86')]=function(_0x55ec6e,_0x42a239,_0x450591){return db[_0xb0e7('0x44')][_0xb0e7('0x4b')]({'where':{'id':_0x55ec6e['params']['id']}})[_0xb0e7('0x28')](handleEntityNotFound(_0x42a239,null))['then'](function(_0xf07a0f){if(_0xf07a0f){return _0xf07a0f[_0xb0e7('0x86')](_0x55ec6e[_0xb0e7('0x37')][_0xb0e7('0x67')])[_0xb0e7('0x28')](function(){if(_[_0xb0e7('0x8b')](_0x55ec6e[_0xb0e7('0x37')][_0xb0e7('0x67')])){for(var _0x508980=0x0;_0x508980<_0x55ec6e[_0xb0e7('0x37')]['ids'][_0xb0e7('0x49')];_0x508980+=0x1){socket[_0xb0e7('0x8a')](_0xb0e7('0x87'),{'UserId':Number(_0x55ec6e[_0xb0e7('0x37')][_0xb0e7('0x67')][_0x508980]),'OpenchannelQueueId':Number(_0x55ec6e[_0xb0e7('0x53')]['id'])});}}else{socket[_0xb0e7('0x8a')](_0xb0e7('0x87'),{'UserId':Number(_0x55ec6e[_0xb0e7('0x37')]['ids']),'OpenchannelQueueId':Number(_0x55ec6e[_0xb0e7('0x53')]['id'])});}});}})[_0xb0e7('0x28')](respondWithStatusCode(_0x42a239,null))[_0xb0e7('0x47')](handleError(_0x42a239,null));};exports[_0xb0e7('0x8c')]=function(_0x573d32,_0x41c3aa,_0x27cbbe){var _0x4f1cdc={};var _0x31257f={};var _0x37882e;var _0x5076a7;return db[_0xb0e7('0x44')]['findOne']({'where':{'id':_0x573d32[_0xb0e7('0x53')]['id']}})[_0xb0e7('0x28')](handleEntityNotFound(_0x41c3aa,null))[_0xb0e7('0x28')](function(_0x179ba7){if(_0x179ba7){_0x37882e=_0x179ba7;_0x31257f[_0xb0e7('0x36')]=_['keys'](db[_0xb0e7('0x68')]['rawAttributes']);_0x31257f[_0xb0e7('0x37')]=_[_0xb0e7('0x38')](_0x573d32[_0xb0e7('0x37')]);_0x31257f[_0xb0e7('0x39')]=_[_0xb0e7('0x3a')](_0x31257f[_0xb0e7('0x36')],_0x31257f['query']);_0x4f1cdc[_0xb0e7('0x3c')]=_[_0xb0e7('0x3a')](_0x31257f['model'],qs['fields'](_0x573d32[_0xb0e7('0x37')][_0xb0e7('0x3b')]));_0x4f1cdc[_0xb0e7('0x3c')]=_0x4f1cdc[_0xb0e7('0x3c')][_0xb0e7('0x49')]?_0x4f1cdc[_0xb0e7('0x3c')]:_0x31257f[_0xb0e7('0x36')];_0x4f1cdc[_0xb0e7('0x3f')]=qs[_0xb0e7('0x40')](_0x573d32['query'][_0xb0e7('0x40')]);_0x4f1cdc[_0xb0e7('0x41')]=qs['filters'](_[_0xb0e7('0x58')](_0x573d32[_0xb0e7('0x37')],_0x31257f[_0xb0e7('0x39')]));if(_0x573d32[_0xb0e7('0x37')]['filter']){_0x4f1cdc[_0xb0e7('0x41')]=_[_0xb0e7('0x42')](_0x4f1cdc[_0xb0e7('0x41')],{'$or':_[_0xb0e7('0x32')](_0x4f1cdc['attributes'],function(_0x2833b5){var _0x1fcc1d={};_0x1fcc1d[_0x2833b5]={'$like':'%'+_0x573d32[_0xb0e7('0x37')][_0xb0e7('0x5a')]+'%'};return _0x1fcc1d;})});}_0x4f1cdc=_[_0xb0e7('0x42')]({},_0x4f1cdc,_0x573d32[_0xb0e7('0x4a')]);return _0x37882e['getAgents'](_0x4f1cdc);}})['then'](function(_0x3df88b){if(_0x3df88b){_0x5076a7=_0x3df88b[_0xb0e7('0x49')];if(!_0x573d32[_0xb0e7('0x37')]['hasOwnProperty'](_0xb0e7('0x3e'))){_0x4f1cdc['limit']=qs[_0xb0e7('0x24')](_0x573d32['query']['limit']);_0x4f1cdc['offset']=qs['offset'](_0x573d32[_0xb0e7('0x37')][_0xb0e7('0x23')]);}return _0x37882e[_0xb0e7('0x8c')](_0x4f1cdc);}})['then'](function(_0x4598f5){if(_0x4598f5){return _0x4598f5?{'count':_0x5076a7,'rows':_0x4598f5}:null;}})[_0xb0e7('0x28')](respondWithResult(_0x41c3aa,null))[_0xb0e7('0x47')](handleError(_0x41c3aa,null));}; \ No newline at end of file +var _0x66a9=['push','toString','QueryTypes','every','TeamId','includes','union','compact','value','removeTeams','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','getAgents','html-pdf','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','count','offset','apply','reject','update','then','get','OpenchannelQueues','UserProfileResource','destroy','error','name','send','index','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','OpenchannelQueue','includeAll','include','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','OpenchannelQueueId','UserOpenchannelQueue','findAll','User','UserId','agent','openchannelPause','createdAt','rows','format','%s/%s','updatedAt','getTeams','hasOwnProperty','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','userOpenchannelQueue:save','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?'];(function(_0x515f65,_0x5b3ccc){var _0x188b04=function(_0x1dd711){while(--_0x1dd711){_0x515f65['push'](_0x515f65['shift']());}};_0x188b04(++_0x5b3ccc);}(_0x66a9,0x12d));var _0x966a=function(_0x33d5d6,_0x2ad866){_0x33d5d6=_0x33d5d6-0x0;var _0x27032e=_0x66a9[_0x33d5d6];return _0x27032e;};'use strict';var pdf=require(_0x966a('0x0'));var emlformat=require(_0x966a('0x1'));var rimraf=require(_0x966a('0x2'));var zipdir=require(_0x966a('0x3'));var jsonpatch=require(_0x966a('0x4'));var rp=require(_0x966a('0x5'));var moment=require(_0x966a('0x6'));var BPromise=require(_0x966a('0x7'));var Mustache=require(_0x966a('0x8'));var util=require(_0x966a('0x9'));var path=require(_0x966a('0xa'));var sox=require(_0x966a('0xb'));var csv=require(_0x966a('0xc'));var ejs=require(_0x966a('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x966a('0xe'));var crypto=require(_0x966a('0xf'));var jsforce=require(_0x966a('0x10'));var deskjs=require(_0x966a('0x11'));var toCsv=require(_0x966a('0xc'));var querystring=require(_0x966a('0x12'));var Papa=require(_0x966a('0x13'));var Redis=require(_0x966a('0x14'));var authService=require(_0x966a('0x15'));var qs=require(_0x966a('0x16'));var as=require(_0x966a('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x966a('0x18'))(_0x966a('0x19'));var utils=require(_0x966a('0x1a'));var config=require(_0x966a('0x1b'));var licenseUtil=require(_0x966a('0x1c'));var db=require('../../mysqldb')['db'];config[_0x966a('0x1d')]=_[_0x966a('0x1e')](config[_0x966a('0x1d')],{'host':_0x966a('0x1f'),'port':0x18eb});var socket=require(_0x966a('0x20'))(new Redis(config[_0x966a('0x1d')]));require(_0x966a('0x21'))['register'](socket);function respondWithStatusCode(_0x10afb0,_0x3ac467){_0x3ac467=_0x3ac467||0xcc;return function(_0x3003b8){if(_0x3003b8){return _0x10afb0[_0x966a('0x22')](_0x3ac467);}return _0x10afb0[_0x966a('0x23')](_0x3ac467)[_0x966a('0x24')]();};}function respondWithResult(_0x559bd6,_0x214bea){_0x214bea=_0x214bea||0xc8;return function(_0x38fc9e){if(_0x38fc9e){return _0x559bd6['status'](_0x214bea)[_0x966a('0x25')](_0x38fc9e);}};}function respondWithFilteredResult(_0x18f8c9,_0x144e69){return function(_0x2610b5){if(_0x2610b5){var _0x3caf70=_0x2610b5[_0x966a('0x26')],_0x3d5532=_0x144e69[_0x966a('0x27')],_0x2160fe=_0x144e69[_0x966a('0x27')]+_0x144e69['limit'],_0x31ae94;if(_0x2160fe>=_0x3caf70){_0x2160fe=_0x3caf70;_0x31ae94=0xc8;}else{_0x31ae94=0xce;}_0x18f8c9[_0x966a('0x23')](_0x31ae94);return _0x18f8c9['set']('Content-Range',_0x3d5532+'-'+_0x2160fe+'/'+_0x3caf70)[_0x966a('0x25')](_0x2610b5);}return null;};}function patchUpdates(_0x57f91c){return function(_0x5404a6){try{jsonpatch[_0x966a('0x28')](_0x5404a6,_0x57f91c,!![]);}catch(_0x421f5a){return BPromise[_0x966a('0x29')](_0x421f5a);}return _0x5404a6['save']();};}function saveUpdates(_0x5bdb86,_0x3202fd){return function(_0x433d0c){if(_0x433d0c){return _0x433d0c[_0x966a('0x2a')](_0x5bdb86)[_0x966a('0x2b')](function(_0x1b1740){return _0x1b1740;});}return null;};}function removeEntity(_0x3e3a5a,_0x32e5fd){return function(_0x84c37b){if(_0x84c37b){return _0x84c37b['destroy']()[_0x966a('0x2b')](function(){var _0x36f66f=_0x84c37b[_0x966a('0x2c')]({'plain':!![]});var _0x106994=_0x966a('0x2d');return db[_0x966a('0x2e')][_0x966a('0x2f')]({'where':{'type':_0x106994,'resourceId':_0x36f66f['id']}})['then'](function(){return _0x84c37b;});})['then'](function(){_0x3e3a5a[_0x966a('0x23')](0xcc)[_0x966a('0x24')]();});}};}function handleEntityNotFound(_0x3c3544,_0x1f6f87){return function(_0x13fac2){if(!_0x13fac2){_0x3c3544[_0x966a('0x22')](0x194);}return _0x13fac2;};}function handleError(_0x2814e2,_0x264487){_0x264487=_0x264487||0x1f4;return function(_0x28f7f1){logger[_0x966a('0x30')](_0x28f7f1['stack']);if(_0x28f7f1[_0x966a('0x31')]){delete _0x28f7f1[_0x966a('0x31')];}_0x2814e2[_0x966a('0x23')](_0x264487)[_0x966a('0x32')](_0x28f7f1);};}exports[_0x966a('0x33')]=function(_0xb6cd1,_0x266f35){var _0x445706={},_0x7e3c6a={},_0x548416={'count':0x0,'rows':[]};var _0x1bf011=_['map'](db['OpenchannelQueue'][_0x966a('0x34')],function(_0x1a5ed3){return{'name':_0x1a5ed3['fieldName'],'type':_0x1a5ed3[_0x966a('0x35')]['key']};});_0x7e3c6a['model']=_['map'](_0x1bf011,_0x966a('0x31'));_0x7e3c6a[_0x966a('0x36')]=_[_0x966a('0x37')](_0xb6cd1[_0x966a('0x36')]);_0x7e3c6a[_0x966a('0x38')]=_[_0x966a('0x39')](_0x7e3c6a[_0x966a('0x3a')],_0x7e3c6a[_0x966a('0x36')]);_0x445706[_0x966a('0x3b')]=_[_0x966a('0x39')](_0x7e3c6a['model'],qs[_0x966a('0x3c')](_0xb6cd1[_0x966a('0x36')][_0x966a('0x3c')]));_0x445706[_0x966a('0x3b')]=_0x445706['attributes'][_0x966a('0x3d')]?_0x445706['attributes']:_0x7e3c6a['model'];if(!_0xb6cd1['query']['hasOwnProperty'](_0x966a('0x3e'))){_0x445706[_0x966a('0x3f')]=qs[_0x966a('0x3f')](_0xb6cd1['query']['limit']);_0x445706[_0x966a('0x27')]=qs[_0x966a('0x27')](_0xb6cd1[_0x966a('0x36')][_0x966a('0x27')]);}_0x445706[_0x966a('0x40')]=qs[_0x966a('0x41')](_0xb6cd1[_0x966a('0x36')][_0x966a('0x41')]);_0x445706['where']=qs[_0x966a('0x38')](_[_0x966a('0x42')](_0xb6cd1[_0x966a('0x36')],_0x7e3c6a[_0x966a('0x38')]),_0x1bf011);if(_0xb6cd1[_0x966a('0x36')][_0x966a('0x43')]){_0x445706[_0x966a('0x44')]=_[_0x966a('0x45')](_0x445706['where'],{'$or':_[_0x966a('0x46')](_0x1bf011,function(_0x20482e){if(_0x20482e['type']!==_0x966a('0x47')){var _0x3f3b62={};_0x3f3b62[_0x20482e['name']]={'$like':'%'+_0xb6cd1[_0x966a('0x36')][_0x966a('0x43')]+'%'};return _0x3f3b62;}})});}_0x445706=_[_0x966a('0x45')]({},_0x445706,_0xb6cd1[_0x966a('0x48')]);var _0x23222c={'where':_0x445706[_0x966a('0x44')]};return db[_0x966a('0x49')][_0x966a('0x26')](_0x23222c)[_0x966a('0x2b')](function(_0x5dbbbb){_0x548416[_0x966a('0x26')]=_0x5dbbbb;if(_0xb6cd1[_0x966a('0x36')][_0x966a('0x4a')]){_0x445706[_0x966a('0x4b')]=[{'all':!![]}];}return db[_0x966a('0x49')]['findAll'](_0x445706);})['then'](function(_0xdd1726){_0x548416['rows']=_0xdd1726;return _0x548416;})[_0x966a('0x2b')](respondWithFilteredResult(_0x266f35,_0x445706))['catch'](handleError(_0x266f35,null));};exports[_0x966a('0x4c')]=function(_0x25fec1,_0xa7d1d4){var _0x6093e4={'raw':!![],'where':{'id':_0x25fec1[_0x966a('0x4d')]['id']}},_0x2800bc={};_0x2800bc[_0x966a('0x3a')]=_[_0x966a('0x37')](db['OpenchannelQueue'][_0x966a('0x34')]);_0x2800bc[_0x966a('0x36')]=_[_0x966a('0x37')](_0x25fec1[_0x966a('0x36')]);_0x2800bc[_0x966a('0x38')]=_['intersection'](_0x2800bc['model'],_0x2800bc[_0x966a('0x36')]);_0x6093e4[_0x966a('0x3b')]=_[_0x966a('0x39')](_0x2800bc[_0x966a('0x3a')],qs['fields'](_0x25fec1['query']['fields']));_0x6093e4[_0x966a('0x3b')]=_0x6093e4[_0x966a('0x3b')][_0x966a('0x3d')]?_0x6093e4[_0x966a('0x3b')]:_0x2800bc[_0x966a('0x3a')];if(_0x25fec1[_0x966a('0x36')][_0x966a('0x4a')]){_0x6093e4[_0x966a('0x4b')]=[{'all':!![]}];}_0x6093e4=_[_0x966a('0x45')]({},_0x6093e4,_0x25fec1[_0x966a('0x48')]);return db[_0x966a('0x49')]['find'](_0x6093e4)[_0x966a('0x2b')](handleEntityNotFound(_0xa7d1d4,null))['then'](respondWithResult(_0xa7d1d4,null))[_0x966a('0x4e')](handleError(_0xa7d1d4,null));};exports[_0x966a('0x4f')]=function(_0x1860b9,_0x2d31b7){return db[_0x966a('0x49')][_0x966a('0x4f')](_0x1860b9[_0x966a('0x50')],{})[_0x966a('0x2b')](function(_0x195aa5){var _0x143168=_0x1860b9[_0x966a('0x51')][_0x966a('0x2c')]({'plain':!![]});if(!_0x143168)throw new Error(_0x966a('0x52'));if(_0x143168['role']===_0x966a('0x51')){var _0x2a7e18=_0x195aa5[_0x966a('0x2c')]({'plain':!![]});var _0x2df498=_0x966a('0x2d');return db['UserProfileSection'][_0x966a('0x53')]({'where':{'name':_0x2df498,'userProfileId':_0x143168[_0x966a('0x54')]},'raw':!![]})[_0x966a('0x2b')](function(_0x5114c4){if(_0x5114c4&&_0x5114c4['autoAssociation']===0x0){return db[_0x966a('0x2e')][_0x966a('0x4f')]({'name':_0x2a7e18[_0x966a('0x31')],'resourceId':_0x2a7e18['id'],'type':_0x5114c4['name'],'sectionId':_0x5114c4['id']},{})[_0x966a('0x2b')](function(){return _0x195aa5;});}else{return _0x195aa5;}})[_0x966a('0x4e')](function(_0x11829a){logger[_0x966a('0x30')](_0x966a('0x55'),_0x11829a);throw _0x11829a;});}return _0x195aa5;})['then'](respondWithResult(_0x2d31b7,0xc9))['catch'](handleError(_0x2d31b7,null));};exports[_0x966a('0x2a')]=function(_0x309318,_0x5cc58e){if(_0x309318['body']['id']){delete _0x309318[_0x966a('0x50')]['id'];}return db[_0x966a('0x49')][_0x966a('0x53')]({'where':{'id':_0x309318['params']['id']}})[_0x966a('0x2b')](handleEntityNotFound(_0x5cc58e,null))[_0x966a('0x2b')](saveUpdates(_0x309318[_0x966a('0x50')],null))[_0x966a('0x2b')](respondWithResult(_0x5cc58e,null))[_0x966a('0x4e')](handleError(_0x5cc58e,null));};exports['destroy']=function(_0x4c6c80,_0x5c384a){return db['OpenchannelQueue'][_0x966a('0x53')]({'where':{'id':_0x4c6c80[_0x966a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5c384a,null))[_0x966a('0x2b')](removeEntity(_0x5c384a,null))[_0x966a('0x4e')](handleError(_0x5c384a,null));};exports[_0x966a('0x56')]=function(_0x51cf70,_0x52b9e0){return db[_0x966a('0x49')][_0x966a('0x56')]()[_0x966a('0x2b')](respondWithResult(_0x52b9e0,null))[_0x966a('0x4e')](handleError(_0x52b9e0,null));};exports[_0x966a('0x57')]=function(_0x58340c,_0x577fec,_0x342550){var _0x3fdeca={'raw':!![],'where':{}},_0x420fe2={},_0x37697e;return db[_0x966a('0x49')][_0x966a('0x58')]({'where':{'id':_0x58340c['params']['id']}})['then'](handleEntityNotFound(_0x577fec,null))['then'](function(_0x20ac2c){if(_0x20ac2c){_0x37697e=_0x20ac2c[_0x966a('0x2c')]({'plain':!![]});_0x420fe2[_0x966a('0x3a')]=_['keys'](db['UserOpenchannelQueue'][_0x966a('0x34')]);_0x420fe2[_0x966a('0x36')]=_[_0x966a('0x37')](_0x58340c[_0x966a('0x36')]);_0x420fe2[_0x966a('0x38')]=_['intersection'](_0x420fe2['model'],_0x420fe2['query']);_0x3fdeca[_0x966a('0x3b')]=_[_0x966a('0x39')](_0x420fe2[_0x966a('0x3a')],qs['fields'](_0x58340c[_0x966a('0x36')][_0x966a('0x3c')]));_0x3fdeca[_0x966a('0x3b')]=_0x3fdeca[_0x966a('0x3b')][_0x966a('0x3d')]?_0x3fdeca[_0x966a('0x3b')]:_0x420fe2[_0x966a('0x3a')];if(!_0x58340c['query']['hasOwnProperty']('nolimit')){_0x3fdeca[_0x966a('0x3f')]=qs['limit'](_0x58340c[_0x966a('0x36')][_0x966a('0x3f')]);_0x3fdeca[_0x966a('0x27')]=qs[_0x966a('0x27')](_0x58340c[_0x966a('0x36')][_0x966a('0x27')]);}_0x3fdeca[_0x966a('0x40')]=qs[_0x966a('0x41')](_0x58340c[_0x966a('0x36')][_0x966a('0x41')]);_0x3fdeca[_0x966a('0x44')]=qs['filters'](_[_0x966a('0x42')](_0x58340c[_0x966a('0x36')],_0x420fe2[_0x966a('0x38')]));_0x3fdeca['where'][_0x966a('0x59')]=_0x20ac2c['id'];if(_0x58340c['query'][_0x966a('0x43')]){_0x3fdeca[_0x966a('0x44')]=_[_0x966a('0x45')](_0x3fdeca[_0x966a('0x44')],{'$or':_['map'](_0x3fdeca[_0x966a('0x3b')],function(_0x180318){var _0x1d861d={};_0x1d861d[_0x180318]={'$like':'%'+_0x58340c[_0x966a('0x36')][_0x966a('0x43')]+'%'};return _0x1d861d;})});}_0x3fdeca=_[_0x966a('0x45')]({},_0x3fdeca,_0x58340c[_0x966a('0x48')]);return db[_0x966a('0x5a')][_0x966a('0x5b')](_0x3fdeca);}})[_0x966a('0x2b')](function(_0x10d982){if(_0x10d982){return db[_0x966a('0x5c')]['findAndCountAll']({'where':{'id':_['map'](_0x10d982,_0x966a('0x5d')),'role':_0x966a('0x5e')},'attributes':['id',_0x966a('0x31'),_0x966a('0x5f'),'updatedAt',_0x966a('0x60')]});}})[_0x966a('0x2b')](function(_0x45e0a4){if(_0x45e0a4){return{'count':_0x45e0a4[_0x966a('0x26')],'rows':_[_0x966a('0x46')](_0x45e0a4[_0x966a('0x61')],function(_0x3f8bbf){return{'membername':_0x3f8bbf[_0x966a('0x31')],'UserId':_0x3f8bbf['id'],'queue_name':_0x37697e['name'],'OpenchannelQueueId':_0x37697e['id'],'interface':util[_0x966a('0x62')](_0x966a('0x63'),'SIP',_0x3f8bbf[_0x966a('0x31')]),'penalty':0x0,'paused':_0x3f8bbf[_0x966a('0x5f')],'createdAt':_0x3f8bbf['createdAt'],'updatedAt':_0x3f8bbf[_0x966a('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x966a('0x2b')](respondWithFilteredResult(_0x577fec,_0x3fdeca))[_0x966a('0x4e')](handleError(_0x577fec,null));};exports['getTeams']=function(_0x7b3527,_0x5677f6,_0x32d987){var _0xfb7083={};var _0x2cde0a={};var _0x4de5cb;var _0x57118b;return db['OpenchannelQueue'][_0x966a('0x58')]({'where':{'id':_0x7b3527[_0x966a('0x4d')]['id']}})[_0x966a('0x2b')](handleEntityNotFound(_0x5677f6,null))['then'](function(_0x4e55ad){if(_0x4e55ad){_0x4de5cb=_0x4e55ad;_0x2cde0a['model']=_['keys'](db['Team']['rawAttributes']);_0x2cde0a[_0x966a('0x36')]=_[_0x966a('0x37')](_0x7b3527['query']);_0x2cde0a['filters']=_['intersection'](_0x2cde0a[_0x966a('0x3a')],_0x2cde0a['query']);_0xfb7083[_0x966a('0x3b')]=_[_0x966a('0x39')](_0x2cde0a[_0x966a('0x3a')],qs[_0x966a('0x3c')](_0x7b3527[_0x966a('0x36')][_0x966a('0x3c')]));_0xfb7083['attributes']=_0xfb7083[_0x966a('0x3b')]['length']?_0xfb7083[_0x966a('0x3b')]:_0x2cde0a['model'];_0xfb7083['order']=qs[_0x966a('0x41')](_0x7b3527[_0x966a('0x36')][_0x966a('0x41')]);_0xfb7083[_0x966a('0x44')]=qs[_0x966a('0x38')](_[_0x966a('0x42')](_0x7b3527['query'],_0x2cde0a[_0x966a('0x38')]));if(_0x7b3527['query'][_0x966a('0x43')]){_0xfb7083[_0x966a('0x44')]=_['merge'](_0xfb7083[_0x966a('0x44')],{'$or':_['map'](_0xfb7083['attributes'],function(_0x2cfc49){var _0xd577b2={};_0xd577b2[_0x2cfc49]={'$like':'%'+_0x7b3527[_0x966a('0x36')]['filter']+'%'};return _0xd577b2;})});}_0xfb7083=_['merge']({},_0xfb7083,_0x7b3527[_0x966a('0x48')]);return _0x4de5cb[_0x966a('0x65')](_0xfb7083);}})[_0x966a('0x2b')](function(_0x2da6c3){if(_0x2da6c3){_0x57118b=_0x2da6c3[_0x966a('0x3d')];if(!_0x7b3527[_0x966a('0x36')][_0x966a('0x66')](_0x966a('0x3e'))){_0xfb7083[_0x966a('0x3f')]=qs[_0x966a('0x3f')](_0x7b3527[_0x966a('0x36')][_0x966a('0x3f')]);_0xfb7083[_0x966a('0x27')]=qs[_0x966a('0x27')](_0x7b3527[_0x966a('0x36')][_0x966a('0x27')]);}return _0x4de5cb[_0x966a('0x65')](_0xfb7083);}})[_0x966a('0x2b')](function(_0x5ac915){if(_0x5ac915){return _0x5ac915?{'count':_0x57118b,'rows':_0x5ac915}:null;}})['then'](respondWithResult(_0x5677f6,null))['catch'](handleError(_0x5677f6,null));};exports[_0x966a('0x67')]=function(_0x2edf1d,_0x357a5f,_0x2b4ff2){var _0x19611c=_0x2edf1d['body'][_0x966a('0x68')];return db[_0x966a('0x69')]['findAll']({'where':{'id':_0x19611c},'attributes':['id'],'include':[{'model':db[_0x966a('0x5c')],'as':_0x966a('0x6a'),'attributes':['id',_0x966a('0x31'),_0x966a('0x6b'),_0x966a('0x6c'),_0x966a('0x6d')],'raw':!![]}]})[_0x966a('0x2b')](function(_0x37ca08){if(_0x37ca08){var _0xe1c556=_[_0x966a('0x6e')](_0x37ca08,function(_0x272b37){var _0x22b6d9=_0x272b37[_0x966a('0x2c')]({'plain':!![]});return _0x22b6d9[_0x966a('0x6a')];});return db[_0x966a('0x49')][_0x966a('0x53')]({'where':{'id':_0x2edf1d[_0x966a('0x4d')]['id']}})[_0x966a('0x2b')](function(_0x120728){return db[_0x966a('0x6f')][_0x966a('0x70')](function(_0xfb009b){return _0x120728['addTeams'](_0x19611c,{'transaction':_0xfb009b})[_0x966a('0x2b')](function(){return BPromise['each'](_0xe1c556,function(_0x1848bd){return db[_0x966a('0x5a')][_0x966a('0x71')]({'where':{'UserId':_0x1848bd['id'],'OpenchannelQueueId':_0x2edf1d[_0x966a('0x4d')]['id']},'transaction':_0xfb009b});});})[_0x966a('0x2b')](function(){_0xe1c556[_0x966a('0x72')](function(_0x2e1216){socket['emit'](_0x966a('0x73'),{'UserId':_0x2e1216['id'],'OpenchannelQueueId':_0x120728['id']});});});});});}})[_0x966a('0x2b')](respondWithStatusCode(_0x357a5f,null))[_0x966a('0x4e')](handleError(_0x357a5f,null));};exports['removeTeams']=function(_0x1f1126,_0x348db5,_0x4fa1e5){return db['Team'][_0x966a('0x5b')]({'where':{'id':_0x1f1126[_0x966a('0x36')][_0x966a('0x68')]},'attributes':['id'],'include':[{'model':db[_0x966a('0x5c')],'as':_0x966a('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x966a('0x2b')](handleEntityNotFound(_0x348db5,null))[_0x966a('0x2b')](function(_0x91589b){var _0x2e12a3=_[_0x966a('0x46')](_0x91589b,'id');var _0xbb06ef=[];var _0xefad6c=[];var _0x100894=squel['select']();_0x100894[_0x966a('0x74')](_0x966a('0x75'))['from'](_0x966a('0x76'),'tq')[_0x966a('0x77')](_0x966a('0x78'),'ut',_0x966a('0x79'))[_0x966a('0x44')](_0x966a('0x7a'),_0x1f1126[_0x966a('0x4d')]['id']);for(var _0xb71900=0x0;_0xb71900<_0x91589b[_0x966a('0x3d')];_0xb71900+=0x1){let _0x31ce16=_0x91589b[_0xb71900];for(var _0x11dac9=0x0;_0x11dac9<_0x31ce16[_0x966a('0x6a')]['length'];_0x11dac9+=0x1){let _0x549203=_0x31ce16[_0x966a('0x6a')][_0x11dac9];var _0x3d6d2f=_0x100894[_0x966a('0x7b')]();_0x3d6d2f[_0x966a('0x44')](_0x966a('0x7c'),_0x549203['id']);_0xefad6c[_0x966a('0x7d')](db[_0x966a('0x6f')]['query'](_0x3d6d2f[_0x966a('0x7e')](),{'type':db[_0x966a('0x6f')][_0x966a('0x7f')]['SELECT']})[_0x966a('0x2b')](function(_0x437ec6){if(_0x437ec6[_0x966a('0x3d')]===0x1){return _0x549203['id'];}else{var _0x33f638=_[_0x966a('0x80')](_[_0x966a('0x46')](_0x437ec6,_0x966a('0x81')),function(_0x421c16){return _[_0x966a('0x82')](_0x2e12a3,_0x421c16);});if(_0x33f638){return _0x549203['id'];}}}));}}return BPromise['all'](_0xefad6c)[_0x966a('0x2b')](function(_0x1d5278){_0xbb06ef=_(_0xbb06ef)[_0x966a('0x83')](_0x1d5278)[_0x966a('0x84')]()[_0x966a('0x85')]();return db[_0x966a('0x49')][_0x966a('0x53')]({'where':{'id':_0x1f1126[_0x966a('0x4d')]['id']}})[_0x966a('0x2b')](function(_0x1a2dd8){return db[_0x966a('0x6f')][_0x966a('0x70')](function(_0x273fce){return _0x1a2dd8[_0x966a('0x86')](_0x1f1126['query'][_0x966a('0x68')],{'transaction':_0x273fce})['then'](function(){if(!_[_0x966a('0x87')](_0xbb06ef)){return _0x1a2dd8[_0x966a('0x88')](_0xbb06ef,{'transaction':_0x273fce});}})['then'](function(){_0xbb06ef[_0x966a('0x72')](function(_0x872851){socket[_0x966a('0x89')](_0x966a('0x8a'),{'UserId':_0x872851,'OpenchannelQueueId':_0x1a2dd8['id']});});});});});});})[_0x966a('0x2b')](respondWithStatusCode(_0x348db5,null))[_0x966a('0x4e')](handleError(_0x348db5,null));};exports[_0x966a('0x8b')]=function(_0x4d7fcf,_0x2ac64c,_0x5e2e7d){return db['OpenchannelQueue'][_0x966a('0x53')]({'where':{'id':_0x4d7fcf[_0x966a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2ac64c,null))['then'](function(_0x4d1c5f){if(_0x4d1c5f){return _0x4d1c5f[_0x966a('0x8b')](_0x4d7fcf[_0x966a('0x50')][_0x966a('0x68')],_[_0x966a('0x8c')](_0x4d7fcf[_0x966a('0x50')],[_0x966a('0x68'),'id'])||{})['spread'](function(_0x233e64){for(var _0x2524f9=0x0;_0x2524f9<_0x4d7fcf['body']['ids'][_0x966a('0x3d')];_0x2524f9+=0x1){socket[_0x966a('0x89')](_0x966a('0x73'),{'UserId':_0x4d7fcf[_0x966a('0x50')][_0x966a('0x68')][_0x2524f9],'OpenchannelQueueId':_0x4d7fcf[_0x966a('0x4d')]['id']});}return _0x233e64;});}})['then'](respondWithResult(_0x2ac64c,null))[_0x966a('0x4e')](handleError(_0x2ac64c,null));};exports[_0x966a('0x88')]=function(_0x44920d,_0x58ae16,_0x44f237){return db[_0x966a('0x49')][_0x966a('0x53')]({'where':{'id':_0x44920d[_0x966a('0x4d')]['id']}})[_0x966a('0x2b')](handleEntityNotFound(_0x58ae16,null))[_0x966a('0x2b')](function(_0x4bfa26){if(_0x4bfa26){return _0x4bfa26[_0x966a('0x88')](_0x44920d['query'][_0x966a('0x68')])[_0x966a('0x2b')](function(){if(_['isArray'](_0x44920d['query'][_0x966a('0x68')])){for(var _0x4dc646=0x0;_0x4dc646<_0x44920d['query'][_0x966a('0x68')][_0x966a('0x3d')];_0x4dc646+=0x1){socket[_0x966a('0x89')](_0x966a('0x8a'),{'UserId':Number(_0x44920d[_0x966a('0x36')][_0x966a('0x68')][_0x4dc646]),'OpenchannelQueueId':Number(_0x44920d['params']['id'])});}}else{socket[_0x966a('0x89')](_0x966a('0x8a'),{'UserId':Number(_0x44920d[_0x966a('0x36')][_0x966a('0x68')]),'OpenchannelQueueId':Number(_0x44920d[_0x966a('0x4d')]['id'])});}});}})[_0x966a('0x2b')](respondWithStatusCode(_0x58ae16,null))['catch'](handleError(_0x58ae16,null));};exports[_0x966a('0x8d')]=function(_0x315319,_0x5091ac,_0x22b157){var _0xc8882b={};var _0x255f98={};var _0x47f891;var _0x51dcbb;return db[_0x966a('0x49')][_0x966a('0x58')]({'where':{'id':_0x315319[_0x966a('0x4d')]['id']}})[_0x966a('0x2b')](handleEntityNotFound(_0x5091ac,null))[_0x966a('0x2b')](function(_0x573bc3){if(_0x573bc3){_0x47f891=_0x573bc3;_0x255f98[_0x966a('0x3a')]=_[_0x966a('0x37')](db[_0x966a('0x5c')][_0x966a('0x34')]);_0x255f98[_0x966a('0x36')]=_['keys'](_0x315319[_0x966a('0x36')]);_0x255f98['filters']=_[_0x966a('0x39')](_0x255f98[_0x966a('0x3a')],_0x255f98[_0x966a('0x36')]);_0xc8882b['attributes']=_['intersection'](_0x255f98[_0x966a('0x3a')],qs[_0x966a('0x3c')](_0x315319['query']['fields']));_0xc8882b['attributes']=_0xc8882b[_0x966a('0x3b')][_0x966a('0x3d')]?_0xc8882b['attributes']:_0x255f98[_0x966a('0x3a')];_0xc8882b[_0x966a('0x40')]=qs['sort'](_0x315319[_0x966a('0x36')][_0x966a('0x41')]);_0xc8882b[_0x966a('0x44')]=qs[_0x966a('0x38')](_[_0x966a('0x42')](_0x315319[_0x966a('0x36')],_0x255f98[_0x966a('0x38')]));if(_0x315319[_0x966a('0x36')]['filter']){_0xc8882b[_0x966a('0x44')]=_['merge'](_0xc8882b[_0x966a('0x44')],{'$or':_[_0x966a('0x46')](_0xc8882b[_0x966a('0x3b')],function(_0x12753a){var _0x476fa1={};_0x476fa1[_0x12753a]={'$like':'%'+_0x315319['query'][_0x966a('0x43')]+'%'};return _0x476fa1;})});}_0xc8882b=_[_0x966a('0x45')]({},_0xc8882b,_0x315319[_0x966a('0x48')]);return _0x47f891['getAgents'](_0xc8882b);}})[_0x966a('0x2b')](function(_0x216ef2){if(_0x216ef2){_0x51dcbb=_0x216ef2[_0x966a('0x3d')];if(!_0x315319['query']['hasOwnProperty'](_0x966a('0x3e'))){_0xc8882b[_0x966a('0x3f')]=qs['limit'](_0x315319['query'][_0x966a('0x3f')]);_0xc8882b['offset']=qs[_0x966a('0x27')](_0x315319[_0x966a('0x36')][_0x966a('0x27')]);}return _0x47f891[_0x966a('0x8d')](_0xc8882b);}})['then'](function(_0x5a9d5f){if(_0x5a9d5f){return _0x5a9d5f?{'count':_0x51dcbb,'rows':_0x5a9d5f}:null;}})[_0x966a('0x2b')](respondWithResult(_0x5091ac,null))[_0x966a('0x4e')](handleError(_0x5091ac,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 964be1b..cc88c55 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 _0x623e=['exports','events','OpenchannelQueue','setMaxListeners','save','remove','emit','hook'];(function(_0x44b3f6,_0x2f0b79){var _0x4a6207=function(_0x5835fb){while(--_0x5835fb){_0x44b3f6['push'](_0x44b3f6['shift']());}};_0x4a6207(++_0x2f0b79);}(_0x623e,0x71));var _0xe623=function(_0x11048a,_0x3efc7f){_0x11048a=_0x11048a-0x0;var _0x2dbfbe=_0x623e[_0x11048a];return _0x2dbfbe;};'use strict';var EventEmitter=require(_0xe623('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xe623('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xe623('0x2')](0x0);var events={'afterCreate':_0xe623('0x3'),'afterUpdate':'update','afterDestroy':_0xe623('0x4')};function emitEvent(_0xcf223d){return function(_0x55b1b5,_0x2db59a,_0x5e9fa7){OpenchannelQueueEvents[_0xe623('0x5')](_0xcf223d+':'+_0x55b1b5['id'],_0x55b1b5);OpenchannelQueueEvents[_0xe623('0x5')](_0xcf223d,_0x55b1b5);_0x5e9fa7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xe623('0x6')](e,emitEvent(event));}}module[_0xe623('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xce17=['../../mysqldb','OpenchannelQueue','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x37b327,_0x47b877){var _0x184e2f=function(_0x5d692d){while(--_0x5d692d){_0x37b327['push'](_0x37b327['shift']());}};_0x184e2f(++_0x47b877);}(_0xce17,0x18f));var _0x7ce1=function(_0x2718c7,_0x5a1636){_0x2718c7=_0x2718c7-0x0;var _0x59d89c=_0xce17[_0x2718c7];return _0x59d89c;};'use strict';var EventEmitter=require(_0x7ce1('0x0'));var OpenchannelQueue=require(_0x7ce1('0x1'))['db'][_0x7ce1('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7ce1('0x3'),'afterDestroy':_0x7ce1('0x4')};function emitEvent(_0x238de9){return function(_0x39587c,_0x4b7bbb,_0x41bbd8){OpenchannelQueueEvents[_0x7ce1('0x5')](_0x238de9+':'+_0x39587c['id'],_0x39587c);OpenchannelQueueEvents[_0x7ce1('0x5')](_0x238de9,_0x39587c);_0x41bbd8(null);};}for(var e in events){if(events[_0x7ce1('0x6')](e)){var event=events[e];OpenchannelQueue[_0x7ce1('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 7c8ca41..0d3e95a 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 _0xd959=['bluebird','request-promise','path','rimraf','./openchannelQueue.attributes','define','OpenchannelQueue','lodash','util','../../config/logger','api','moment'];(function(_0x4a9ddd,_0x288c67){var _0x480224=function(_0xe9450f){while(--_0xe9450f){_0x4a9ddd['push'](_0x4a9ddd['shift']());}};_0x480224(++_0x288c67);}(_0xd959,0x1f3));var _0x9d95=function(_0x578ce9,_0x29655b){_0x578ce9=_0x578ce9-0x0;var _0xe1aeea=_0xd959[_0x578ce9];return _0xe1aeea;};'use strict';var _=require(_0x9d95('0x0'));var util=require(_0x9d95('0x1'));var logger=require(_0x9d95('0x2'))(_0x9d95('0x3'));var moment=require(_0x9d95('0x4'));var BPromise=require(_0x9d95('0x5'));var rp=require(_0x9d95('0x6'));var fs=require('fs');var path=require(_0x9d95('0x7'));var rimraf=require(_0x9d95('0x8'));var config=require('../../config/environment');var attributes=require(_0x9d95('0x9'));module['exports']=function(_0x226c6f,_0x3d4bae){return _0x226c6f[_0x9d95('0xa')](_0x9d95('0xb'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0047=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues','lodash'];(function(_0x35ccde,_0xbe027){var _0xbd6110=function(_0xba7aea){while(--_0xba7aea){_0x35ccde['push'](_0x35ccde['shift']());}};_0xbd6110(++_0xbe027);}(_0x0047,0x197));var _0x7004=function(_0x461c18,_0x5605b9){_0x461c18=_0x461c18-0x0;var _0x35501c=_0x0047[_0x461c18];return _0x35501c;};'use strict';var _=require(_0x7004('0x0'));var util=require(_0x7004('0x1'));var logger=require(_0x7004('0x2'))(_0x7004('0x3'));var moment=require(_0x7004('0x4'));var BPromise=require(_0x7004('0x5'));var rp=require(_0x7004('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7004('0x7'));var config=require('../../config/environment');var attributes=require(_0x7004('0x8'));module['exports']=function(_0x21573d,_0x43b60f){return _0x21573d[_0x7004('0x9')](_0x7004('0xa'),attributes,{'tableName':_0x7004('0xb'),'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 32d24bc..a5b1317 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 _0x61d7=['client','http','redis','socket.io-emitter','./openchannelQueue.socket','register','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetOpenchannelQueue','options','raw','where','attributes','include','map','model','then','catch','ShowOpenchannelQueue','OpenchannelQueue','find','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x183b97,_0x2d297c){var _0x629cf7=function(_0x4ffd24){while(--_0x4ffd24){_0x183b97['push'](_0x183b97['shift']());}};_0x629cf7(++_0x2d297c);}(_0x61d7,0x1c0));var _0x761d=function(_0x5650ad,_0x16d8df){_0x5650ad=_0x5650ad-0x0;var _0x4ec6e4=_0x61d7[_0x5650ad];return _0x4ec6e4;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x761d('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x761d('0x1'));var db=require(_0x761d('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x761d('0x3'))(_0x761d('0x4'));var config=require(_0x761d('0x5'));var jayson=require(_0x761d('0x6'));var client=jayson[_0x761d('0x7')][_0x761d('0x8')]({'port':0x232a});config[_0x761d('0x9')]=_['defaults'](config[_0x761d('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x761d('0xa'))(new Redis(config['redis']));require(_0x761d('0xb'))[_0x761d('0xc')](socket);function respondWithRpcPromise(_0xe09829,_0x492c2c,_0x34ba46){return new BPromise(function(_0x2cf9a3,_0x52402e){return client['request'](_0xe09829,_0x34ba46)['then'](function(_0x317085){logger[_0x761d('0xd')](_0x761d('0xe'),_0x492c2c,_0x761d('0xf'));logger['debug'](_0x761d('0x10'),_0x492c2c,_0x761d('0xf'),JSON[_0x761d('0x11')](_0x317085));if(_0x317085[_0x761d('0x12')]){if(_0x317085[_0x761d('0x12')][_0x761d('0x13')]===0x1f4){logger['error'](_0x761d('0xe'),_0x492c2c,_0x317085[_0x761d('0x12')]['message']);return _0x52402e(_0x317085[_0x761d('0x12')][_0x761d('0x14')]);}logger[_0x761d('0x12')](_0x761d('0xe'),_0x492c2c,_0x317085[_0x761d('0x12')][_0x761d('0x14')]);return _0x2cf9a3(_0x317085[_0x761d('0x12')][_0x761d('0x14')]);}else{logger[_0x761d('0xd')](_0x761d('0xe'),_0x492c2c,_0x761d('0xf'));_0x2cf9a3(_0x317085[_0x761d('0x15')][_0x761d('0x14')]);}})['catch'](function(_0x2035dc){logger['error'](_0x761d('0xe'),_0x492c2c,_0x2035dc);_0x52402e(_0x2035dc);});});}exports[_0x761d('0x16')]=function(_0x336f20){var _0x33cef5=this;return new Promise(function(_0xacc03,_0x338486){return db['OpenchannelQueue']['findAll']({'raw':_0x336f20[_0x761d('0x17')]?_0x336f20['options'][_0x761d('0x18')]===undefined?!![]:![]:!![],'where':_0x336f20['options']?_0x336f20[_0x761d('0x17')][_0x761d('0x19')]||null:null,'attributes':_0x336f20['options']?_0x336f20['options'][_0x761d('0x1a')]||null:null,'limit':_0x336f20[_0x761d('0x17')]?_0x336f20[_0x761d('0x17')]['limit']||null:null,'include':_0x336f20[_0x761d('0x17')]?_0x336f20[_0x761d('0x17')][_0x761d('0x1b')]?_[_0x761d('0x1c')](_0x336f20[_0x761d('0x17')][_0x761d('0x1b')],function(_0x212262){return{'model':db[_0x212262['model']],'as':_0x212262['as'],'attributes':_0x212262[_0x761d('0x1a')],'include':_0x212262[_0x761d('0x1b')]?_[_0x761d('0x1c')](_0x212262[_0x761d('0x1b')],function(_0x51cb09){return{'model':db[_0x51cb09[_0x761d('0x1d')]],'as':_0x51cb09['as'],'attributes':_0x51cb09[_0x761d('0x1a')],'include':_0x51cb09[_0x761d('0x1b')]?_[_0x761d('0x1c')](_0x51cb09[_0x761d('0x1b')],function(_0xcb06ab){return{'model':db[_0xcb06ab[_0x761d('0x1d')]],'as':_0xcb06ab['as'],'attributes':_0xcb06ab[_0x761d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x761d('0x1e')](function(_0x2151a7){logger[_0x761d('0xd')](_0x761d('0x16'),_0x336f20);logger['debug'](_0x761d('0x16'),_0x336f20,JSON[_0x761d('0x11')](_0x2151a7));_0xacc03(_0x2151a7);})[_0x761d('0x1f')](function(_0x44aca9){logger[_0x761d('0x12')]('GetOpenchannelQueue',_0x44aca9[_0x761d('0x14')],_0x336f20);_0x338486(_0x33cef5[_0x761d('0x12')](0x1f4,_0x44aca9[_0x761d('0x14')]));});});};exports[_0x761d('0x20')]=function(_0x271a4d){var _0x140f75=this;return new Promise(function(_0x48a476,_0x62fe22){return db[_0x761d('0x21')][_0x761d('0x22')]({'raw':_0x271a4d[_0x761d('0x17')]?_0x271a4d[_0x761d('0x17')][_0x761d('0x18')]===undefined?!![]:![]:!![],'where':_0x271a4d['options']?_0x271a4d[_0x761d('0x17')]['where']||null:null,'attributes':_0x271a4d[_0x761d('0x17')]?_0x271a4d[_0x761d('0x17')]['attributes']||null:null,'include':_0x271a4d[_0x761d('0x17')]?_0x271a4d[_0x761d('0x17')][_0x761d('0x1b')]?_[_0x761d('0x1c')](_0x271a4d[_0x761d('0x17')][_0x761d('0x1b')],function(_0x4fe6f6){return{'model':db[_0x4fe6f6['model']],'as':_0x4fe6f6['as'],'attributes':_0x4fe6f6[_0x761d('0x1a')],'include':_0x4fe6f6[_0x761d('0x1b')]?_[_0x761d('0x1c')](_0x4fe6f6['include'],function(_0x4e5ba2){return{'model':db[_0x4e5ba2[_0x761d('0x1d')]],'as':_0x4e5ba2['as'],'attributes':_0x4e5ba2[_0x761d('0x1a')],'include':_0x4e5ba2[_0x761d('0x1b')]?_['map'](_0x4e5ba2['include'],function(_0x149d44){return{'model':db[_0x149d44[_0x761d('0x1d')]],'as':_0x149d44['as'],'attributes':_0x149d44[_0x761d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x761d('0x1e')](function(_0x43743a){logger[_0x761d('0xd')](_0x761d('0x20'),_0x271a4d);logger['debug'](_0x761d('0x20'),_0x271a4d,JSON['stringify'](_0x43743a));_0x48a476(_0x43743a);})[_0x761d('0x1f')](function(_0x236142){logger[_0x761d('0x12')]('ShowOpenchannelQueue',_0x236142[_0x761d('0x14')],_0x271a4d);_0x62fe22(_0x140f75[_0x761d('0x12')](0x1f4,_0x236142[_0x761d('0x14')]));});});}; \ No newline at end of file +var _0x1037=['options','where','limit','include','map','model','attributes','debug','catch','ShowOpenchannelQueue','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetOpenchannelQueue','OpenchannelQueue','findAll'];(function(_0x445369,_0x3de2d9){var _0x2f72ef=function(_0x33e31b){while(--_0x33e31b){_0x445369['push'](_0x445369['shift']());}};_0x2f72ef(++_0x3de2d9);}(_0x1037,0xa8));var _0x7103=function(_0x152aa1,_0x307718){_0x152aa1=_0x152aa1-0x0;var _0x1bc01a=_0x1037[_0x152aa1];return _0x1bc01a;};'use strict';var _=require(_0x7103('0x0'));var util=require(_0x7103('0x1'));var moment=require(_0x7103('0x2'));var BPromise=require(_0x7103('0x3'));var rs=require(_0x7103('0x4'));var fs=require('fs');var Redis=require(_0x7103('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7103('0x6'));var logger=require(_0x7103('0x7'))(_0x7103('0x8'));var config=require(_0x7103('0x9'));var jayson=require(_0x7103('0xa'));var client=jayson['client'][_0x7103('0xb')]({'port':0x232a});config[_0x7103('0xc')]=_[_0x7103('0xd')](config[_0x7103('0xc')],{'host':_0x7103('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7103('0xc')]));require('./openchannelQueue.socket')[_0x7103('0xf')](socket);function respondWithRpcPromise(_0x4faa28,_0x1dfc98,_0x931099){return new BPromise(function(_0x44d84f,_0xdd573f){return client[_0x7103('0x10')](_0x4faa28,_0x931099)['then'](function(_0x4cb2e6){logger[_0x7103('0x11')](_0x7103('0x12'),_0x1dfc98,_0x7103('0x13'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1dfc98,_0x7103('0x13'),JSON[_0x7103('0x14')](_0x4cb2e6));if(_0x4cb2e6[_0x7103('0x15')]){if(_0x4cb2e6[_0x7103('0x15')]['code']===0x1f4){logger[_0x7103('0x15')](_0x7103('0x12'),_0x1dfc98,_0x4cb2e6['error'][_0x7103('0x16')]);return _0xdd573f(_0x4cb2e6['error'][_0x7103('0x16')]);}logger['error'](_0x7103('0x12'),_0x1dfc98,_0x4cb2e6['error'][_0x7103('0x16')]);return _0x44d84f(_0x4cb2e6[_0x7103('0x15')][_0x7103('0x16')]);}else{logger['info'](_0x7103('0x12'),_0x1dfc98,_0x7103('0x13'));_0x44d84f(_0x4cb2e6[_0x7103('0x17')][_0x7103('0x16')]);}})['catch'](function(_0x47e076){logger[_0x7103('0x15')](_0x7103('0x12'),_0x1dfc98,_0x47e076);_0xdd573f(_0x47e076);});});}exports[_0x7103('0x18')]=function(_0x1be374){var _0x5e61bc=this;return new Promise(function(_0x4cb7d5,_0x1d2039){return db[_0x7103('0x19')][_0x7103('0x1a')]({'raw':_0x1be374[_0x7103('0x1b')]?_0x1be374[_0x7103('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1be374[_0x7103('0x1b')]?_0x1be374[_0x7103('0x1b')][_0x7103('0x1c')]||null:null,'attributes':_0x1be374[_0x7103('0x1b')]?_0x1be374['options']['attributes']||null:null,'limit':_0x1be374[_0x7103('0x1b')]?_0x1be374['options'][_0x7103('0x1d')]||null:null,'include':_0x1be374['options']?_0x1be374[_0x7103('0x1b')][_0x7103('0x1e')]?_[_0x7103('0x1f')](_0x1be374[_0x7103('0x1b')][_0x7103('0x1e')],function(_0x48b90a){return{'model':db[_0x48b90a[_0x7103('0x20')]],'as':_0x48b90a['as'],'attributes':_0x48b90a[_0x7103('0x21')],'include':_0x48b90a[_0x7103('0x1e')]?_[_0x7103('0x1f')](_0x48b90a[_0x7103('0x1e')],function(_0x3cdaa4){return{'model':db[_0x3cdaa4[_0x7103('0x20')]],'as':_0x3cdaa4['as'],'attributes':_0x3cdaa4[_0x7103('0x21')],'include':_0x3cdaa4[_0x7103('0x1e')]?_[_0x7103('0x1f')](_0x3cdaa4[_0x7103('0x1e')],function(_0x3f935b){return{'model':db[_0x3f935b[_0x7103('0x20')]],'as':_0x3f935b['as'],'attributes':_0x3f935b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x57b3cf){logger[_0x7103('0x11')](_0x7103('0x18'),_0x1be374);logger[_0x7103('0x22')]('GetOpenchannelQueue',_0x1be374,JSON[_0x7103('0x14')](_0x57b3cf));_0x4cb7d5(_0x57b3cf);})[_0x7103('0x23')](function(_0x2d5bbf){logger['error'](_0x7103('0x18'),_0x2d5bbf[_0x7103('0x16')],_0x1be374);_0x1d2039(_0x5e61bc[_0x7103('0x15')](0x1f4,_0x2d5bbf['message']));});});};exports[_0x7103('0x24')]=function(_0x476868){var _0x2c7d7b=this;return new Promise(function(_0x1ac8ad,_0x5cfcd9){return db[_0x7103('0x19')][_0x7103('0x25')]({'raw':_0x476868[_0x7103('0x1b')]?_0x476868[_0x7103('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x476868[_0x7103('0x1b')]?_0x476868['options'][_0x7103('0x1c')]||null:null,'attributes':_0x476868[_0x7103('0x1b')]?_0x476868[_0x7103('0x1b')]['attributes']||null:null,'include':_0x476868[_0x7103('0x1b')]?_0x476868[_0x7103('0x1b')][_0x7103('0x1e')]?_[_0x7103('0x1f')](_0x476868[_0x7103('0x1b')][_0x7103('0x1e')],function(_0xdd7167){return{'model':db[_0xdd7167[_0x7103('0x20')]],'as':_0xdd7167['as'],'attributes':_0xdd7167[_0x7103('0x21')],'include':_0xdd7167[_0x7103('0x1e')]?_[_0x7103('0x1f')](_0xdd7167[_0x7103('0x1e')],function(_0x2f03c2){return{'model':db[_0x2f03c2['model']],'as':_0x2f03c2['as'],'attributes':_0x2f03c2[_0x7103('0x21')],'include':_0x2f03c2[_0x7103('0x1e')]?_['map'](_0x2f03c2[_0x7103('0x1e')],function(_0x6e3277){return{'model':db[_0x6e3277[_0x7103('0x20')]],'as':_0x6e3277['as'],'attributes':_0x6e3277[_0x7103('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7103('0x26')](function(_0x128a16){logger[_0x7103('0x11')](_0x7103('0x24'),_0x476868);logger[_0x7103('0x22')](_0x7103('0x24'),_0x476868,JSON[_0x7103('0x14')](_0x128a16));_0x1ac8ad(_0x128a16);})[_0x7103('0x23')](function(_0x26890e){logger[_0x7103('0x15')](_0x7103('0x24'),_0x26890e[_0x7103('0x16')],_0x476868);_0x5cfcd9(_0x2c7d7b[_0x7103('0x15')](0x1f4,_0x26890e[_0x7103('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 8b6c1e7..5cf1dee 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 _0x6cd0=['./openchannelQueue.events','update','emit','register','length','openchannelQueue:'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x6cd0,0x1ce));var _0x06cd=function(_0x179af6,_0x578c93){_0x179af6=_0x179af6-0x0;var _0x23718d=_0x6cd0[_0x179af6];return _0x23718d;};'use strict';var OpenchannelQueueEvents=require(_0x06cd('0x0'));var events=['save','remove',_0x06cd('0x1')];function createListener(_0x5d85f3,_0x5eba2c){return function(_0x3fbd7d){_0x5eba2c[_0x06cd('0x2')](_0x5d85f3,_0x3fbd7d);};}function removeListener(_0x4da2fc,_0x27cfa3){return function(){OpenchannelQueueEvents['removeListener'](_0x4da2fc,_0x27cfa3);};}exports[_0x06cd('0x3')]=function(_0x1c0f56){for(var _0x4997de=0x0,_0x4d75d7=events[_0x06cd('0x4')];_0x4997de<_0x4d75d7;_0x4997de++){var _0x42e321=events[_0x4997de];var _0x17d458=createListener(_0x06cd('0x5')+_0x42e321,_0x1c0f56);OpenchannelQueueEvents['on'](_0x42e321,_0x17d458);}}; \ No newline at end of file +var _0x4b6d=['update','removeListener','register','length','./openchannelQueue.events','save','remove'];(function(_0xc471d2,_0x26ab16){var _0x334c68=function(_0x2deae4){while(--_0x2deae4){_0xc471d2['push'](_0xc471d2['shift']());}};_0x334c68(++_0x26ab16);}(_0x4b6d,0x1d9));var _0xd4b6=function(_0x1eee9e,_0x176ffb){_0x1eee9e=_0x1eee9e-0x0;var _0x253622=_0x4b6d[_0x1eee9e];return _0x253622;};'use strict';var OpenchannelQueueEvents=require(_0xd4b6('0x0'));var events=[_0xd4b6('0x1'),_0xd4b6('0x2'),_0xd4b6('0x3')];function createListener(_0x30db81,_0xea9a55){return function(_0x2ef43b){_0xea9a55['emit'](_0x30db81,_0x2ef43b);};}function removeListener(_0x975803,_0x187069){return function(){OpenchannelQueueEvents[_0xd4b6('0x4')](_0x975803,_0x187069);};}exports[_0xd4b6('0x5')]=function(_0x18beb9){for(var _0x52597e=0x0,_0x4e021b=events[_0xd4b6('0x6')];_0x52597e<_0x4e021b;_0x52597e++){var _0x34eb47=events[_0x52597e];var _0x42116e=createListener('openchannelQueue:'+_0x34eb47,_0x18beb9);OpenchannelQueueEvents['on'](_0x34eb47,_0x42116e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 7ae3783..e41b148 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 _0xaab0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','express'];(function(_0xcf36bc,_0x57b09a){var _0x4c75fc=function(_0x146e2a){while(--_0x146e2a){_0xcf36bc['push'](_0xcf36bc['shift']());}};_0x4c75fc(++_0x57b09a);}(_0xaab0,0x1de));var _0x0aab=function(_0x4b7e4d,_0x82d2ab){_0x4b7e4d=_0x4b7e4d-0x0;var _0x38d6af=_0xaab0[_0x4b7e4d];return _0x38d6af;};'use strict';var multer=require(_0x0aab('0x0'));var util=require(_0x0aab('0x1'));var path=require(_0x0aab('0x2'));var timeout=require(_0x0aab('0x3'));var express=require(_0x0aab('0x4'));var router=express[_0x0aab('0x5')]();var auth=require(_0x0aab('0x6'));var interaction=require(_0x0aab('0x7'));var config=require(_0x0aab('0x8'));var controller=require(_0x0aab('0x9'));router[_0x0aab('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0aab('0xa')](_0x0aab('0xb'),auth[_0x0aab('0xc')](),controller[_0x0aab('0xd')]);router[_0x0aab('0xa')](_0x0aab('0xe'),auth[_0x0aab('0xc')](),controller[_0x0aab('0xf')]);router[_0x0aab('0x10')]('/',auth[_0x0aab('0xc')](),controller[_0x0aab('0x11')]);router[_0x0aab('0x12')](_0x0aab('0xe'),auth[_0x0aab('0xc')](),controller[_0x0aab('0x13')]);router[_0x0aab('0x14')](_0x0aab('0xe'),auth[_0x0aab('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc05c=['create','update','destroy','exports','multer','util','path','connect-timeout','./openchannelQueueReport.controller','get','isAuthenticated','describe','/:id','post'];(function(_0x1a0016,_0x3d80e1){var _0x2945df=function(_0x2e82b2){while(--_0x2e82b2){_0x1a0016['push'](_0x1a0016['shift']());}};_0x2945df(++_0x3d80e1);}(_0xc05c,0x146));var _0xcc05=function(_0x65f1b5,_0x50c1eb){_0x65f1b5=_0x65f1b5-0x0;var _0xd2fbda=_0xc05c[_0x65f1b5];return _0xd2fbda;};'use strict';var multer=require(_0xcc05('0x0'));var util=require(_0xcc05('0x1'));var path=require(_0xcc05('0x2'));var timeout=require(_0xcc05('0x3'));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(_0xcc05('0x4'));router[_0xcc05('0x5')]('/',auth[_0xcc05('0x6')](),controller['index']);router[_0xcc05('0x5')]('/describe',auth[_0xcc05('0x6')](),controller[_0xcc05('0x7')]);router[_0xcc05('0x5')](_0xcc05('0x8'),auth[_0xcc05('0x6')](),controller['show']);router[_0xcc05('0x9')]('/',auth[_0xcc05('0x6')](),controller[_0xcc05('0xa')]);router['put'](_0xcc05('0x8'),auth[_0xcc05('0x6')](),controller[_0xcc05('0xb')]);router['delete'](_0xcc05('0x8'),auth[_0xcc05('0x6')](),controller[_0xcc05('0xc')]);module[_0xcc05('0xd')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index fdc7393..82a95d2 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 _0xd3e9=['sequelize','STRING','DATE','moment'];(function(_0x4fb9fa,_0x145e04){var _0x55b512=function(_0xaf3b79){while(--_0xaf3b79){_0x4fb9fa['push'](_0x4fb9fa['shift']());}};_0x55b512(++_0x145e04);}(_0xd3e9,0x12b));var _0x9d3e=function(_0x478a55,_0x476fc9){_0x478a55=_0x478a55-0x0;var _0x5b79f2=_0xd3e9[_0x478a55];return _0x5b79f2;};'use strict';var moment=require(_0x9d3e('0x0'));var Sequelize=require(_0x9d3e('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x9d3e('0x2')]},'joinAt':{'type':Sequelize[_0x9d3e('0x3')]},'leaveAt':{'type':Sequelize[_0x9d3e('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9d3e('0x3')]},'reason':{'type':Sequelize[_0x9d3e('0x2')]}}; \ No newline at end of file +var _0xfdd9=['DATE','sequelize','exports','STRING'];(function(_0xf8b597,_0x2a2ea7){var _0x3f3357=function(_0xf186d3){while(--_0xf186d3){_0xf8b597['push'](_0xf8b597['shift']());}};_0x3f3357(++_0x2a2ea7);}(_0xfdd9,0xc9));var _0x9fdd=function(_0x51874d,_0x293315){_0x51874d=_0x51874d-0x0;var _0xacfc5=_0xfdd9[_0x51874d];return _0xacfc5;};'use strict';var moment=require('moment');var Sequelize=require(_0x9fdd('0x0'));module[_0x9fdd('0x1')]={'uniqueid':{'type':Sequelize[_0x9fdd('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9fdd('0x2')]},'joinAt':{'type':Sequelize[_0x9fdd('0x3')]},'leaveAt':{'type':Sequelize[_0x9fdd('0x3')]},'acceptAt':{'type':Sequelize[_0x9fdd('0x3')]},'exitAt':{'type':Sequelize[_0x9fdd('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index f09e485..381d253 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 _0x524a=['limit','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','map','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','pick','where','merge','filter','includeAll','include','OpenchannelQueueReport','findAll','show','params','options','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','count','offset'];(function(_0x3dea84,_0x24c5bc){var _0x9776cc=function(_0x122f22){while(--_0x122f22){_0x3dea84['push'](_0x3dea84['shift']());}};_0x9776cc(++_0x24c5bc);}(_0x524a,0xf5));var _0xa524=function(_0x1e1c2b,_0x459395){_0x1e1c2b=_0x1e1c2b-0x0;var _0x284aab=_0x524a[_0x1e1c2b];return _0x284aab;};'use strict';var pdf=require(_0xa524('0x0'));var emlformat=require(_0xa524('0x1'));var rimraf=require(_0xa524('0x2'));var zipdir=require(_0xa524('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa524('0x4'));var moment=require(_0xa524('0x5'));var BPromise=require(_0xa524('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa524('0x7'));var sox=require(_0xa524('0x8'));var csv=require(_0xa524('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa524('0xa'));var squel=require('squel');var crypto=require(_0xa524('0xb'));var jsforce=require(_0xa524('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa524('0x9'));var querystring=require(_0xa524('0xd'));var Papa=require(_0xa524('0xe'));var Redis=require(_0xa524('0xf'));var authService=require(_0xa524('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa524('0x11'));var hardwareService=require(_0xa524('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xa524('0x13'));var config=require(_0xa524('0x14'));var licenseUtil=require(_0xa524('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55117f,_0x14a0d6){_0x14a0d6=_0x14a0d6||0xcc;return function(_0x4aa46d){if(_0x4aa46d){return _0x55117f[_0xa524('0x16')](_0x14a0d6);}return _0x55117f['status'](_0x14a0d6)[_0xa524('0x17')]();};}function respondWithResult(_0x5c7e6a,_0x75bfe8){_0x75bfe8=_0x75bfe8||0xc8;return function(_0x281137){if(_0x281137){return _0x5c7e6a['status'](_0x75bfe8)[_0xa524('0x18')](_0x281137);}};}function respondWithFilteredResult(_0x15b14c,_0xe85361){return function(_0x1de01e){if(_0x1de01e){var _0x45347f=_0x1de01e[_0xa524('0x19')],_0x433c8a=_0xe85361[_0xa524('0x1a')],_0x371385=_0xe85361[_0xa524('0x1a')]+_0xe85361[_0xa524('0x1b')],_0x4fc42f;if(_0x371385>=_0x45347f){_0x371385=_0x45347f;_0x4fc42f=0xc8;}else{_0x4fc42f=0xce;}_0x15b14c[_0xa524('0x1c')](_0x4fc42f);return _0x15b14c[_0xa524('0x1d')](_0xa524('0x1e'),_0x433c8a+'-'+_0x371385+'/'+_0x45347f)[_0xa524('0x18')](_0x1de01e);}return null;};}function patchUpdates(_0x54b249){return function(_0x304dea){try{jsonpatch[_0xa524('0x1f')](_0x304dea,_0x54b249,!![]);}catch(_0xb31e2d){return BPromise[_0xa524('0x20')](_0xb31e2d);}return _0x304dea['save']();};}function saveUpdates(_0x5510fa,_0x40f4bd){return function(_0xc560dd){if(_0xc560dd){return _0xc560dd[_0xa524('0x21')](_0x5510fa)[_0xa524('0x22')](function(_0x1e6abb){return _0x1e6abb;});}return null;};}function removeEntity(_0x3866e2,_0x4abffe){return function(_0x262eac){if(_0x262eac){return _0x262eac[_0xa524('0x23')]()[_0xa524('0x22')](function(){_0x3866e2[_0xa524('0x1c')](0xcc)[_0xa524('0x17')]();});}};}function handleEntityNotFound(_0x45cdcc,_0x26e931){return function(_0x4babac){if(!_0x4babac){_0x45cdcc[_0xa524('0x16')](0x194);}return _0x4babac;};}function handleError(_0x221bf,_0x5de496){_0x5de496=_0x5de496||0x1f4;return function(_0x47efb3){logger[_0xa524('0x24')](_0x47efb3[_0xa524('0x25')]);if(_0x47efb3[_0xa524('0x26')]){delete _0x47efb3[_0xa524('0x26')];}_0x221bf[_0xa524('0x1c')](_0x5de496)['send'](_0x47efb3);};}exports['index']=function(_0x1aeabc,_0x869b22){var _0x1582fa={},_0x9e9e5e={},_0x505c42={'count':0x0,'rows':[]};var _0x1c84c6=_[_0xa524('0x27')](db['OpenchannelQueueReport'][_0xa524('0x28')],function(_0x147094){return{'name':_0x147094['fieldName'],'type':_0x147094[_0xa524('0x29')]['key']};});_0x9e9e5e[_0xa524('0x2a')]=_[_0xa524('0x27')](_0x1c84c6,_0xa524('0x26'));_0x9e9e5e[_0xa524('0x2b')]=_[_0xa524('0x2c')](_0x1aeabc[_0xa524('0x2b')]);_0x9e9e5e[_0xa524('0x2d')]=_[_0xa524('0x2e')](_0x9e9e5e[_0xa524('0x2a')],_0x9e9e5e['query']);_0x1582fa['attributes']=_[_0xa524('0x2e')](_0x9e9e5e['model'],qs['fields'](_0x1aeabc[_0xa524('0x2b')][_0xa524('0x2f')]));_0x1582fa[_0xa524('0x30')]=_0x1582fa[_0xa524('0x30')]['length']?_0x1582fa['attributes']:_0x9e9e5e[_0xa524('0x2a')];if(!_0x1aeabc['query']['hasOwnProperty'](_0xa524('0x31'))){_0x1582fa[_0xa524('0x1b')]=qs[_0xa524('0x1b')](_0x1aeabc[_0xa524('0x2b')][_0xa524('0x1b')]);_0x1582fa[_0xa524('0x1a')]=qs[_0xa524('0x1a')](_0x1aeabc[_0xa524('0x2b')][_0xa524('0x1a')]);}_0x1582fa[_0xa524('0x32')]=qs[_0xa524('0x33')](_0x1aeabc[_0xa524('0x2b')]['sort']);_0x1582fa['where']=qs['filters'](_[_0xa524('0x34')](_0x1aeabc[_0xa524('0x2b')],_0x9e9e5e['filters']),_0x1c84c6);if(_0x1aeabc[_0xa524('0x2b')]['filter']){_0x1582fa[_0xa524('0x35')]=_[_0xa524('0x36')](_0x1582fa['where'],{'$or':_[_0xa524('0x27')](_0x1c84c6,function(_0x259532){if(_0x259532[_0xa524('0x29')]!=='VIRTUAL'){var _0x42efb5={};_0x42efb5[_0x259532[_0xa524('0x26')]]={'$like':'%'+_0x1aeabc['query'][_0xa524('0x37')]+'%'};return _0x42efb5;}})});}_0x1582fa=_[_0xa524('0x36')]({},_0x1582fa,_0x1aeabc['options']);var _0x191e0f={'where':_0x1582fa[_0xa524('0x35')]};return db['OpenchannelQueueReport'][_0xa524('0x19')](_0x191e0f)[_0xa524('0x22')](function(_0x186395){_0x505c42[_0xa524('0x19')]=_0x186395;if(_0x1aeabc[_0xa524('0x2b')][_0xa524('0x38')]){_0x1582fa[_0xa524('0x39')]=[{'all':!![]}];}return db[_0xa524('0x3a')][_0xa524('0x3b')](_0x1582fa);})[_0xa524('0x22')](function(_0x38e745){_0x505c42['rows']=_0x38e745;return _0x505c42;})[_0xa524('0x22')](respondWithFilteredResult(_0x869b22,_0x1582fa))['catch'](handleError(_0x869b22,null));};exports[_0xa524('0x3c')]=function(_0x24237c,_0x35d92d){var _0x11cd3f={'raw':!![],'where':{'id':_0x24237c[_0xa524('0x3d')]['id']}},_0x33068e={};_0x33068e[_0xa524('0x2a')]=_[_0xa524('0x2c')](db[_0xa524('0x3a')][_0xa524('0x28')]);_0x33068e['query']=_[_0xa524('0x2c')](_0x24237c[_0xa524('0x2b')]);_0x33068e['filters']=_[_0xa524('0x2e')](_0x33068e[_0xa524('0x2a')],_0x33068e['query']);_0x11cd3f['attributes']=_['intersection'](_0x33068e['model'],qs['fields'](_0x24237c[_0xa524('0x2b')][_0xa524('0x2f')]));_0x11cd3f[_0xa524('0x30')]=_0x11cd3f[_0xa524('0x30')]['length']?_0x11cd3f[_0xa524('0x30')]:_0x33068e[_0xa524('0x2a')];if(_0x24237c[_0xa524('0x2b')][_0xa524('0x38')]){_0x11cd3f['include']=[{'all':!![]}];}_0x11cd3f=_[_0xa524('0x36')]({},_0x11cd3f,_0x24237c[_0xa524('0x3e')]);return db[_0xa524('0x3a')][_0xa524('0x3f')](_0x11cd3f)[_0xa524('0x22')](handleEntityNotFound(_0x35d92d,null))['then'](respondWithResult(_0x35d92d,null))[_0xa524('0x40')](handleError(_0x35d92d,null));};exports[_0xa524('0x41')]=function(_0x16164d,_0x150428){return db[_0xa524('0x3a')][_0xa524('0x41')](_0x16164d[_0xa524('0x42')],{})[_0xa524('0x22')](respondWithResult(_0x150428,0xc9))[_0xa524('0x40')](handleError(_0x150428,null));};exports['update']=function(_0x4b1207,_0x14ab60){if(_0x4b1207[_0xa524('0x42')]['id']){delete _0x4b1207[_0xa524('0x42')]['id'];}return db[_0xa524('0x3a')][_0xa524('0x3f')]({'where':{'id':_0x4b1207[_0xa524('0x3d')]['id']}})['then'](handleEntityNotFound(_0x14ab60,null))[_0xa524('0x22')](saveUpdates(_0x4b1207[_0xa524('0x42')],null))[_0xa524('0x22')](respondWithResult(_0x14ab60,null))[_0xa524('0x40')](handleError(_0x14ab60,null));};exports[_0xa524('0x23')]=function(_0x451bbe,_0x550415){return db[_0xa524('0x3a')][_0xa524('0x3f')]({'where':{'id':_0x451bbe[_0xa524('0x3d')]['id']}})[_0xa524('0x22')](handleEntityNotFound(_0x550415,null))[_0xa524('0x22')](removeEntity(_0x550415,null))[_0xa524('0x40')](handleError(_0x550415,null));};exports[_0xa524('0x43')]=function(_0xa35e5d,_0x41473f){return db[_0xa524('0x3a')][_0xa524('0x43')]()[_0xa524('0x22')](respondWithResult(_0x41473f,null))[_0xa524('0x40')](handleError(_0x41473f,null));}; \ No newline at end of file +var _0x40ca=['create','body','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','destroy','then','end','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','merge','filter','includeAll','include','findAll','catch','show','find'];(function(_0xcc69fe,_0x504c26){var _0x1fcb22=function(_0x16aa69){while(--_0x16aa69){_0xcc69fe['push'](_0xcc69fe['shift']());}};_0x1fcb22(++_0x504c26);}(_0x40ca,0x1a1));var _0xa40c=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x40ca[_0x49ca18];return _0x145d54;};'use strict';var pdf=require(_0xa40c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa40c('0x1'));var jsonpatch=require(_0xa40c('0x2'));var rp=require(_0xa40c('0x3'));var moment=require(_0xa40c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa40c('0x5'));var util=require('util');var path=require(_0xa40c('0x6'));var sox=require('sox');var csv=require(_0xa40c('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa40c('0x8'));var squel=require(_0xa40c('0x9'));var crypto=require(_0xa40c('0xa'));var jsforce=require(_0xa40c('0xb'));var deskjs=require(_0xa40c('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa40c('0xd'));var Papa=require(_0xa40c('0xe'));var Redis=require(_0xa40c('0xf'));var authService=require(_0xa40c('0x10'));var qs=require(_0xa40c('0x11'));var as=require(_0xa40c('0x12'));var hardwareService=require(_0xa40c('0x13'));var logger=require(_0xa40c('0x14'))(_0xa40c('0x15'));var utils=require(_0xa40c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa40c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x177629,_0x15e176){_0x15e176=_0x15e176||0xcc;return function(_0x41b25a){if(_0x41b25a){return _0x177629[_0xa40c('0x18')](_0x15e176);}return _0x177629[_0xa40c('0x19')](_0x15e176)['end']();};}function respondWithResult(_0x30202b,_0x16d2fc){_0x16d2fc=_0x16d2fc||0xc8;return function(_0x4bebe6){if(_0x4bebe6){return _0x30202b[_0xa40c('0x19')](_0x16d2fc)['json'](_0x4bebe6);}};}function respondWithFilteredResult(_0x39e072,_0x1f7d00){return function(_0x6081b7){if(_0x6081b7){var _0x50421f=_0x6081b7[_0xa40c('0x1a')],_0x55ff88=_0x1f7d00[_0xa40c('0x1b')],_0xbeacab=_0x1f7d00[_0xa40c('0x1b')]+_0x1f7d00[_0xa40c('0x1c')],_0x13c73a;if(_0xbeacab>=_0x50421f){_0xbeacab=_0x50421f;_0x13c73a=0xc8;}else{_0x13c73a=0xce;}_0x39e072[_0xa40c('0x19')](_0x13c73a);return _0x39e072[_0xa40c('0x1d')](_0xa40c('0x1e'),_0x55ff88+'-'+_0xbeacab+'/'+_0x50421f)[_0xa40c('0x1f')](_0x6081b7);}return null;};}function patchUpdates(_0x36956c){return function(_0x2c45c0){try{jsonpatch['apply'](_0x2c45c0,_0x36956c,!![]);}catch(_0x166022){return BPromise[_0xa40c('0x20')](_0x166022);}return _0x2c45c0['save']();};}function saveUpdates(_0x508ee7,_0xa9fc69){return function(_0x185019){if(_0x185019){return _0x185019['update'](_0x508ee7)['then'](function(_0x121606){return _0x121606;});}return null;};}function removeEntity(_0x24d469,_0x26bc3b){return function(_0x2e3020){if(_0x2e3020){return _0x2e3020[_0xa40c('0x21')]()[_0xa40c('0x22')](function(){_0x24d469[_0xa40c('0x19')](0xcc)[_0xa40c('0x23')]();});}};}function handleEntityNotFound(_0x11f17f,_0x2f177d){return function(_0x5bba37){if(!_0x5bba37){_0x11f17f['sendStatus'](0x194);}return _0x5bba37;};}function handleError(_0x19d6f3,_0x198ad2){_0x198ad2=_0x198ad2||0x1f4;return function(_0x503b52){logger[_0xa40c('0x24')](_0x503b52[_0xa40c('0x25')]);if(_0x503b52[_0xa40c('0x26')]){delete _0x503b52['name'];}_0x19d6f3['status'](_0x198ad2)[_0xa40c('0x27')](_0x503b52);};}exports[_0xa40c('0x28')]=function(_0x3ea4d8,_0x382e63){var _0x4dd589={},_0xb9f0c5={},_0x15a1c4={'count':0x0,'rows':[]};var _0x487145=_[_0xa40c('0x29')](db[_0xa40c('0x2a')][_0xa40c('0x2b')],function(_0x29e1cd){return{'name':_0x29e1cd[_0xa40c('0x2c')],'type':_0x29e1cd[_0xa40c('0x2d')]['key']};});_0xb9f0c5[_0xa40c('0x2e')]=_[_0xa40c('0x29')](_0x487145,_0xa40c('0x26'));_0xb9f0c5[_0xa40c('0x2f')]=_[_0xa40c('0x30')](_0x3ea4d8[_0xa40c('0x2f')]);_0xb9f0c5[_0xa40c('0x31')]=_['intersection'](_0xb9f0c5[_0xa40c('0x2e')],_0xb9f0c5[_0xa40c('0x2f')]);_0x4dd589['attributes']=_[_0xa40c('0x32')](_0xb9f0c5[_0xa40c('0x2e')],qs[_0xa40c('0x33')](_0x3ea4d8[_0xa40c('0x2f')][_0xa40c('0x33')]));_0x4dd589[_0xa40c('0x34')]=_0x4dd589[_0xa40c('0x34')][_0xa40c('0x35')]?_0x4dd589[_0xa40c('0x34')]:_0xb9f0c5[_0xa40c('0x2e')];if(!_0x3ea4d8[_0xa40c('0x2f')]['hasOwnProperty']('nolimit')){_0x4dd589[_0xa40c('0x1c')]=qs[_0xa40c('0x1c')](_0x3ea4d8[_0xa40c('0x2f')][_0xa40c('0x1c')]);_0x4dd589[_0xa40c('0x1b')]=qs[_0xa40c('0x1b')](_0x3ea4d8[_0xa40c('0x2f')]['offset']);}_0x4dd589[_0xa40c('0x36')]=qs[_0xa40c('0x37')](_0x3ea4d8[_0xa40c('0x2f')][_0xa40c('0x37')]);_0x4dd589[_0xa40c('0x38')]=qs[_0xa40c('0x31')](_[_0xa40c('0x39')](_0x3ea4d8[_0xa40c('0x2f')],_0xb9f0c5[_0xa40c('0x31')]),_0x487145);if(_0x3ea4d8[_0xa40c('0x2f')]['filter']){_0x4dd589[_0xa40c('0x38')]=_[_0xa40c('0x3a')](_0x4dd589[_0xa40c('0x38')],{'$or':_[_0xa40c('0x29')](_0x487145,function(_0x5903ca){if(_0x5903ca[_0xa40c('0x2d')]!=='VIRTUAL'){var _0x33a3c1={};_0x33a3c1[_0x5903ca['name']]={'$like':'%'+_0x3ea4d8[_0xa40c('0x2f')][_0xa40c('0x3b')]+'%'};return _0x33a3c1;}})});}_0x4dd589=_[_0xa40c('0x3a')]({},_0x4dd589,_0x3ea4d8['options']);var _0x48105d={'where':_0x4dd589[_0xa40c('0x38')]};return db[_0xa40c('0x2a')][_0xa40c('0x1a')](_0x48105d)[_0xa40c('0x22')](function(_0x16b692){_0x15a1c4[_0xa40c('0x1a')]=_0x16b692;if(_0x3ea4d8['query'][_0xa40c('0x3c')]){_0x4dd589[_0xa40c('0x3d')]=[{'all':!![]}];}return db[_0xa40c('0x2a')][_0xa40c('0x3e')](_0x4dd589);})[_0xa40c('0x22')](function(_0x53f19b){_0x15a1c4['rows']=_0x53f19b;return _0x15a1c4;})[_0xa40c('0x22')](respondWithFilteredResult(_0x382e63,_0x4dd589))[_0xa40c('0x3f')](handleError(_0x382e63,null));};exports[_0xa40c('0x40')]=function(_0x441c68,_0x29717e){var _0xc3305a={'raw':!![],'where':{'id':_0x441c68['params']['id']}},_0xe56ed1={};_0xe56ed1['model']=_[_0xa40c('0x30')](db['OpenchannelQueueReport']['rawAttributes']);_0xe56ed1[_0xa40c('0x2f')]=_['keys'](_0x441c68['query']);_0xe56ed1['filters']=_[_0xa40c('0x32')](_0xe56ed1[_0xa40c('0x2e')],_0xe56ed1[_0xa40c('0x2f')]);_0xc3305a[_0xa40c('0x34')]=_['intersection'](_0xe56ed1[_0xa40c('0x2e')],qs[_0xa40c('0x33')](_0x441c68[_0xa40c('0x2f')][_0xa40c('0x33')]));_0xc3305a[_0xa40c('0x34')]=_0xc3305a['attributes'][_0xa40c('0x35')]?_0xc3305a[_0xa40c('0x34')]:_0xe56ed1['model'];if(_0x441c68['query'][_0xa40c('0x3c')]){_0xc3305a['include']=[{'all':!![]}];}_0xc3305a=_['merge']({},_0xc3305a,_0x441c68['options']);return db[_0xa40c('0x2a')][_0xa40c('0x41')](_0xc3305a)[_0xa40c('0x22')](handleEntityNotFound(_0x29717e,null))[_0xa40c('0x22')](respondWithResult(_0x29717e,null))['catch'](handleError(_0x29717e,null));};exports['create']=function(_0xdf15ab,_0x404a28){return db['OpenchannelQueueReport'][_0xa40c('0x42')](_0xdf15ab['body'],{})[_0xa40c('0x22')](respondWithResult(_0x404a28,0xc9))[_0xa40c('0x3f')](handleError(_0x404a28,null));};exports['update']=function(_0x495243,_0x526eb5){if(_0x495243[_0xa40c('0x43')]['id']){delete _0x495243[_0xa40c('0x43')]['id'];}return db[_0xa40c('0x2a')][_0xa40c('0x41')]({'where':{'id':_0x495243['params']['id']}})[_0xa40c('0x22')](handleEntityNotFound(_0x526eb5,null))[_0xa40c('0x22')](saveUpdates(_0x495243[_0xa40c('0x43')],null))[_0xa40c('0x22')](respondWithResult(_0x526eb5,null))[_0xa40c('0x3f')](handleError(_0x526eb5,null));};exports[_0xa40c('0x21')]=function(_0x449a2a,_0x47c506){return db['OpenchannelQueueReport'][_0xa40c('0x41')]({'where':{'id':_0x449a2a['params']['id']}})[_0xa40c('0x22')](handleEntityNotFound(_0x47c506,null))[_0xa40c('0x22')](removeEntity(_0x47c506,null))[_0xa40c('0x3f')](handleError(_0x47c506,null));};exports[_0xa40c('0x44')]=function(_0x4c9a4c,_0x385577){return db['OpenchannelQueueReport']['describe']()['then'](respondWithResult(_0x385577,null))['catch'](handleError(_0x385577,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 81f3d27..2471b24 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 _0x35aa=['api','moment','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport','uniqueid','util','../../config/logger'];(function(_0x7b9830,_0x2f4934){var _0x5df933=function(_0x5ae80f){while(--_0x5ae80f){_0x7b9830['push'](_0x7b9830['shift']());}};_0x5df933(++_0x2f4934);}(_0x35aa,0xbe));var _0xa35a=function(_0x42b949,_0x5ef2cd){_0x42b949=_0x42b949-0x0;var _0x1bd737=_0x35aa[_0x42b949];return _0x1bd737;};'use strict';var _=require('lodash');var util=require(_0xa35a('0x0'));var logger=require(_0xa35a('0x1'))(_0xa35a('0x2'));var moment=require(_0xa35a('0x3'));var BPromise=require('bluebird');var rp=require(_0xa35a('0x4'));var fs=require('fs');var path=require(_0xa35a('0x5'));var rimraf=require(_0xa35a('0x6'));var config=require(_0xa35a('0x7'));var attributes=require(_0xa35a('0x8'));module[_0xa35a('0x9')]=function(_0x449cfe,_0x10917d){return _0x449cfe['define'](_0xa35a('0xa'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xa35a('0xb'),'fields':[_0xa35a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb2ef=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x3f3d76,_0xd4bac4){var _0x4a465b=function(_0x5aaaaa){while(--_0x5aaaaa){_0x3f3d76['push'](_0x3f3d76['shift']());}};_0x4a465b(++_0xd4bac4);}(_0xb2ef,0xa7));var _0xfb2e=function(_0x3a7665,_0x59a51a){_0x3a7665=_0x3a7665-0x0;var _0x12549d=_0xb2ef[_0x3a7665];return _0x12549d;};'use strict';var _=require(_0xfb2e('0x0'));var util=require(_0xfb2e('0x1'));var logger=require(_0xfb2e('0x2'))('api');var moment=require(_0xfb2e('0x3'));var BPromise=require(_0xfb2e('0x4'));var rp=require(_0xfb2e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb2e('0x6'));var config=require(_0xfb2e('0x7'));var attributes=require(_0xfb2e('0x8'));module[_0xfb2e('0x9')]=function(_0x3069a,_0x2a1c23){return _0x3069a[_0xfb2e('0xa')](_0xfb2e('0xb'),attributes,{'tableName':_0xfb2e('0xc'),'paranoid':![],'indexes':[{'name':_0xfb2e('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 6b8e021..bd6a2c4 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 _0xae56=['update','body','where','attributes','limit','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','debug','stringify','UpdateOpenchannelQueueReport'];(function(_0x12aa57,_0x50db96){var _0x3122cf=function(_0x3fc588){while(--_0x3fc588){_0x12aa57['push'](_0x12aa57['shift']());}};_0x3122cf(++_0x50db96);}(_0xae56,0x1b7));var _0x6ae5=function(_0x43e741,_0x34d1dc){_0x43e741=_0x43e741-0x0;var _0x22be58=_0xae56[_0x43e741];return _0x22be58;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6ae5('0x0'));var BPromise=require(_0x6ae5('0x1'));var rs=require(_0x6ae5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ae5('0x3'))['db'];var utils=require(_0x6ae5('0x4'));var logger=require(_0x6ae5('0x5'))(_0x6ae5('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6ae5('0x7')][_0x6ae5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x338545,_0x337031,_0x28cd2f){return new BPromise(function(_0x5332d9,_0x2d0fa7){return client['request'](_0x338545,_0x28cd2f)[_0x6ae5('0x9')](function(_0x16e4cc){logger[_0x6ae5('0xa')](_0x6ae5('0xb'),_0x337031,'request\x20sent');logger['debug'](_0x6ae5('0xc'),_0x337031,_0x6ae5('0xd'),JSON['stringify'](_0x16e4cc));if(_0x16e4cc[_0x6ae5('0xe')]){if(_0x16e4cc['error'][_0x6ae5('0xf')]===0x1f4){logger[_0x6ae5('0xe')](_0x6ae5('0xb'),_0x337031,_0x16e4cc[_0x6ae5('0xe')]['message']);return _0x2d0fa7(_0x16e4cc['error'][_0x6ae5('0x10')]);}logger['error'](_0x6ae5('0xb'),_0x337031,_0x16e4cc['error'][_0x6ae5('0x10')]);return _0x5332d9(_0x16e4cc[_0x6ae5('0xe')][_0x6ae5('0x10')]);}else{logger[_0x6ae5('0xa')](_0x6ae5('0xb'),_0x337031,_0x6ae5('0xd'));_0x5332d9(_0x16e4cc[_0x6ae5('0x11')]['message']);}})[_0x6ae5('0x12')](function(_0x44dac4){logger[_0x6ae5('0xe')](_0x6ae5('0xb'),_0x337031,_0x44dac4);_0x2d0fa7(_0x44dac4);});});}exports[_0x6ae5('0x13')]=function(_0x5cc200){var _0x15fa16=this;return new Promise(function(_0xbe0d0e,_0x23f9d0){return db[_0x6ae5('0x14')][_0x6ae5('0x15')](_0x5cc200['body'],{'raw':_0x5cc200['options']?_0x5cc200[_0x6ae5('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x6ae5('0x9')](function(_0x976ca9){logger[_0x6ae5('0xa')](_0x6ae5('0x13'),_0x5cc200);logger[_0x6ae5('0x17')](_0x6ae5('0x13'),_0x5cc200,JSON[_0x6ae5('0x18')](_0x976ca9));_0xbe0d0e(_0x976ca9);})['catch'](function(_0x2157f3){logger[_0x6ae5('0xe')](_0x6ae5('0x13'),_0x2157f3['message'],_0x5cc200);_0x23f9d0(_0x15fa16[_0x6ae5('0xe')](0x1f4,_0x2157f3[_0x6ae5('0x10')]));});});};exports[_0x6ae5('0x19')]=function(_0x1a636e){var _0x20a5dd=this;return new Promise(function(_0x17792e,_0x5735a6){return db[_0x6ae5('0x14')][_0x6ae5('0x1a')](_0x1a636e[_0x6ae5('0x1b')],{'raw':_0x1a636e[_0x6ae5('0x16')]?_0x1a636e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a636e[_0x6ae5('0x16')]?_0x1a636e[_0x6ae5('0x16')][_0x6ae5('0x1c')]||null:null,'attributes':_0x1a636e[_0x6ae5('0x16')]?_0x1a636e['options'][_0x6ae5('0x1d')]||null:null,'limit':_0x1a636e['options']?_0x1a636e['options'][_0x6ae5('0x1e')]||null:null})['then'](function(_0x4bf12e){logger['info']('UpdateOpenchannelQueueReport',_0x1a636e);logger[_0x6ae5('0x17')](_0x6ae5('0x19'),_0x1a636e,JSON[_0x6ae5('0x18')](_0x4bf12e));_0x17792e(_0x4bf12e);})[_0x6ae5('0x12')](function(_0xeca704){logger[_0x6ae5('0xe')]('UpdateOpenchannelQueueReport',_0xeca704['message'],_0x1a636e);_0x5735a6(_0x20a5dd[_0x6ae5('0xe')](0x1f4,_0xeca704[_0x6ae5('0x10')]));});});}; \ No newline at end of file +var _0x1897=['http','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelQueueReport,\x20%s,\x20%s','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','catch','UpdateOpenchannelQueueReport','update','attributes','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4bdfd1,_0x379cdc){var _0x4ac0c0=function(_0x479196){while(--_0x479196){_0x4bdfd1['push'](_0x4bdfd1['shift']());}};_0x4ac0c0(++_0x379cdc);}(_0x1897,0xdc));var _0x7189=function(_0x211b80,_0x5cb5fa){_0x211b80=_0x211b80-0x0;var _0x1c3037=_0x1897[_0x211b80];return _0x1c3037;};'use strict';var _=require(_0x7189('0x0'));var util=require(_0x7189('0x1'));var moment=require(_0x7189('0x2'));var BPromise=require(_0x7189('0x3'));var rs=require(_0x7189('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7189('0x5'));var logger=require(_0x7189('0x6'))(_0x7189('0x7'));var config=require(_0x7189('0x8'));var jayson=require(_0x7189('0x9'));var client=jayson[_0x7189('0xa')][_0x7189('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x597ffc,_0x3fc7f5,_0x3ec4c8){return new BPromise(function(_0x5ee15b,_0x1d3c79){return client[_0x7189('0xc')](_0x597ffc,_0x3ec4c8)[_0x7189('0xd')](function(_0x480894){logger[_0x7189('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3fc7f5,_0x7189('0xf'));logger[_0x7189('0x10')](_0x7189('0x11'),_0x3fc7f5,_0x7189('0xf'),JSON[_0x7189('0x12')](_0x480894));if(_0x480894[_0x7189('0x13')]){if(_0x480894[_0x7189('0x13')][_0x7189('0x14')]===0x1f4){logger[_0x7189('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3fc7f5,_0x480894[_0x7189('0x13')][_0x7189('0x15')]);return _0x1d3c79(_0x480894[_0x7189('0x13')][_0x7189('0x15')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3fc7f5,_0x480894['error'][_0x7189('0x15')]);return _0x5ee15b(_0x480894[_0x7189('0x13')][_0x7189('0x15')]);}else{logger[_0x7189('0xe')](_0x7189('0x16'),_0x3fc7f5,_0x7189('0xf'));_0x5ee15b(_0x480894[_0x7189('0x17')][_0x7189('0x15')]);}})['catch'](function(_0x21a721){logger['error'](_0x7189('0x16'),_0x3fc7f5,_0x21a721);_0x1d3c79(_0x21a721);});});}exports[_0x7189('0x18')]=function(_0x4872fa){var _0x430479=this;return new Promise(function(_0x4f8407,_0x2f1001){return db[_0x7189('0x19')]['create'](_0x4872fa[_0x7189('0x1a')],{'raw':_0x4872fa[_0x7189('0x1b')]?_0x4872fa['options'][_0x7189('0x1c')]===undefined?!![]:![]:!![]})[_0x7189('0xd')](function(_0x1ed8bf){logger['info'](_0x7189('0x18'),_0x4872fa);logger['debug']('CreateOpenchannelQueueReport',_0x4872fa,JSON[_0x7189('0x12')](_0x1ed8bf));_0x4f8407(_0x1ed8bf);})[_0x7189('0x1d')](function(_0x1ed5f6){logger[_0x7189('0x13')]('CreateOpenchannelQueueReport',_0x1ed5f6[_0x7189('0x15')],_0x4872fa);_0x2f1001(_0x430479['error'](0x1f4,_0x1ed5f6[_0x7189('0x15')]));});});};exports[_0x7189('0x1e')]=function(_0x26d4ac){var _0x111f9e=this;return new Promise(function(_0x1d81c1,_0x5d255d){return db[_0x7189('0x19')][_0x7189('0x1f')](_0x26d4ac[_0x7189('0x1a')],{'raw':_0x26d4ac['options']?_0x26d4ac[_0x7189('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26d4ac[_0x7189('0x1b')]?_0x26d4ac[_0x7189('0x1b')]['where']||null:null,'attributes':_0x26d4ac[_0x7189('0x1b')]?_0x26d4ac[_0x7189('0x1b')][_0x7189('0x20')]||null:null,'limit':_0x26d4ac['options']?_0x26d4ac[_0x7189('0x1b')]['limit']||null:null})['then'](function(_0x353a66){logger[_0x7189('0xe')](_0x7189('0x1e'),_0x26d4ac);logger[_0x7189('0x10')]('UpdateOpenchannelQueueReport',_0x26d4ac,JSON[_0x7189('0x12')](_0x353a66));_0x1d81c1(_0x353a66);})[_0x7189('0x1d')](function(_0x393a91){logger[_0x7189('0x13')](_0x7189('0x1e'),_0x393a91['message'],_0x26d4ac);_0x5d255d(_0x111f9e[_0x7189('0x13')](0x1f4,_0x393a91['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 37ed63a..750a42b 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(_0x411e71,_0xf9652){var _0x226ae3=function(_0x1339f6){while(--_0x1339f6){_0x411e71['push'](_0x411e71['shift']());}};_0x226ae3(++_0xf9652);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x36bfe3,_0x358938){var _0x9b0436=function(_0x86e47d){while(--_0x86e47d){_0x36bfe3['push'](_0x36bfe3['shift']());}};_0x9b0436(++_0x358938);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 a08345e..e661e4c 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 _0x8ee4=['queue','DATE','NOW','sequelize','exports','STRING','ENUM','agent'];(function(_0x2a9ddf,_0x26baae){var _0x1dd186=function(_0x2f2983){while(--_0x2f2983){_0x2a9ddf['push'](_0x2a9ddf['shift']());}};_0x1dd186(++_0x26baae);}(_0x8ee4,0x1b3));var _0x48ee=function(_0x4245e6,_0x1c68ee){_0x4245e6=_0x4245e6-0x0;var _0x51406e=_0x8ee4[_0x4245e6];return _0x51406e;};'use strict';var moment=require('moment');var Sequelize=require(_0x48ee('0x0'));module[_0x48ee('0x1')]={'uniqueid':{'type':Sequelize[_0x48ee('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x48ee('0x3')]('account',_0x48ee('0x4'),'queue'),'allowNull':![],'defaultValue':_0x48ee('0x5')},'transferredAt':{'type':Sequelize[_0x48ee('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x48ee('0x7')]}}; \ No newline at end of file +var _0x1b99=['agent','queue','DATE','moment','sequelize','STRING','ENUM','account'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1b99,0xb3));var _0x91b9=function(_0x2f227c,_0x360c3a){_0x2f227c=_0x2f227c-0x0;var _0x5032bc=_0x1b99[_0x2f227c];return _0x5032bc;};'use strict';var moment=require(_0x91b9('0x0'));var Sequelize=require(_0x91b9('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x91b9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x91b9('0x3')](_0x91b9('0x4'),_0x91b9('0x5'),_0x91b9('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x91b9('0x7')],'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 4edb7c0..3896bcc 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 _0xd319=['merge','options','OpenchannelTransferReport','count','includeAll','include','findAll','show','params','find','catch','create','body','describe','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','offset','order','sort','where','pick','filter'];(function(_0x400766,_0x368660){var _0x3ae58b=function(_0x4c6a6e){while(--_0x4c6a6e){_0x400766['push'](_0x400766['shift']());}};_0x3ae58b(++_0x368660);}(_0xd319,0x12e));var _0x9d31=function(_0x18a538,_0x30d8ad){_0x18a538=_0x18a538-0x0;var _0xad0d97=_0xd319[_0x18a538];return _0xad0d97;};'use strict';var pdf=require(_0x9d31('0x0'));var emlformat=require(_0x9d31('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9d31('0x2'));var moment=require(_0x9d31('0x3'));var BPromise=require(_0x9d31('0x4'));var Mustache=require(_0x9d31('0x5'));var util=require(_0x9d31('0x6'));var path=require(_0x9d31('0x7'));var sox=require('sox');var csv=require(_0x9d31('0x8'));var ejs=require(_0x9d31('0x9'));var fs=require('fs');var _=require(_0x9d31('0xa'));var squel=require(_0x9d31('0xb'));var crypto=require('crypto');var jsforce=require(_0x9d31('0xc'));var deskjs=require(_0x9d31('0xd'));var toCsv=require(_0x9d31('0x8'));var querystring=require(_0x9d31('0xe'));var Papa=require(_0x9d31('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9d31('0x10'));var as=require(_0x9d31('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d31('0x12'))(_0x9d31('0x13'));var utils=require(_0x9d31('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9d31('0x15'));var db=require(_0x9d31('0x16'))['db'];function respondWithStatusCode(_0x3bef26,_0x15cb68){_0x15cb68=_0x15cb68||0xcc;return function(_0x7ef70){if(_0x7ef70){return _0x3bef26[_0x9d31('0x17')](_0x15cb68);}return _0x3bef26[_0x9d31('0x18')](_0x15cb68)[_0x9d31('0x19')]();};}function respondWithResult(_0x464ba9,_0x312060){_0x312060=_0x312060||0xc8;return function(_0x8c1ea3){if(_0x8c1ea3){return _0x464ba9[_0x9d31('0x18')](_0x312060)[_0x9d31('0x1a')](_0x8c1ea3);}};}function respondWithFilteredResult(_0x2c6788,_0x12b1e3){return function(_0x22be20){if(_0x22be20){var _0x9d80b3=_0x22be20['count'],_0x21869f=_0x12b1e3['offset'],_0x32e80a=_0x12b1e3['offset']+_0x12b1e3[_0x9d31('0x1b')],_0x399e50;if(_0x32e80a>=_0x9d80b3){_0x32e80a=_0x9d80b3;_0x399e50=0xc8;}else{_0x399e50=0xce;}_0x2c6788[_0x9d31('0x18')](_0x399e50);return _0x2c6788['set'](_0x9d31('0x1c'),_0x21869f+'-'+_0x32e80a+'/'+_0x9d80b3)[_0x9d31('0x1a')](_0x22be20);}return null;};}function patchUpdates(_0x2855f7){return function(_0x4b6554){try{jsonpatch[_0x9d31('0x1d')](_0x4b6554,_0x2855f7,!![]);}catch(_0x55da6c){return BPromise[_0x9d31('0x1e')](_0x55da6c);}return _0x4b6554[_0x9d31('0x1f')]();};}function saveUpdates(_0x1d7e50,_0x15b3d7){return function(_0x5bf274){if(_0x5bf274){return _0x5bf274[_0x9d31('0x20')](_0x1d7e50)[_0x9d31('0x21')](function(_0x72513d){return _0x72513d;});}return null;};}function removeEntity(_0x47a52d,_0x4c4d88){return function(_0xaaaf09){if(_0xaaaf09){return _0xaaaf09[_0x9d31('0x22')]()[_0x9d31('0x21')](function(){_0x47a52d[_0x9d31('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bb125,_0x5d482c){return function(_0x54eb0b){if(!_0x54eb0b){_0x1bb125[_0x9d31('0x17')](0x194);}return _0x54eb0b;};}function handleError(_0x45983e,_0x332efa){_0x332efa=_0x332efa||0x1f4;return function(_0x2ce063){logger['error'](_0x2ce063[_0x9d31('0x23')]);if(_0x2ce063['name']){delete _0x2ce063[_0x9d31('0x24')];}_0x45983e['status'](_0x332efa)[_0x9d31('0x25')](_0x2ce063);};}exports[_0x9d31('0x26')]=function(_0x52c04e,_0x33a164){var _0x3bb976={},_0x5ce862={},_0x5c96b5={'count':0x0,'rows':[]};var _0x48a277=_[_0x9d31('0x27')](db['OpenchannelTransferReport'][_0x9d31('0x28')],function(_0x13ec12){return{'name':_0x13ec12['fieldName'],'type':_0x13ec12[_0x9d31('0x29')][_0x9d31('0x2a')]};});_0x5ce862[_0x9d31('0x2b')]=_[_0x9d31('0x27')](_0x48a277,_0x9d31('0x24'));_0x5ce862['query']=_[_0x9d31('0x2c')](_0x52c04e[_0x9d31('0x2d')]);_0x5ce862[_0x9d31('0x2e')]=_[_0x9d31('0x2f')](_0x5ce862[_0x9d31('0x2b')],_0x5ce862[_0x9d31('0x2d')]);_0x3bb976['attributes']=_[_0x9d31('0x2f')](_0x5ce862['model'],qs[_0x9d31('0x30')](_0x52c04e['query']['fields']));_0x3bb976[_0x9d31('0x31')]=_0x3bb976['attributes'][_0x9d31('0x32')]?_0x3bb976['attributes']:_0x5ce862[_0x9d31('0x2b')];if(!_0x52c04e[_0x9d31('0x2d')]['hasOwnProperty'](_0x9d31('0x33'))){_0x3bb976[_0x9d31('0x1b')]=qs[_0x9d31('0x1b')](_0x52c04e[_0x9d31('0x2d')]['limit']);_0x3bb976[_0x9d31('0x34')]=qs['offset'](_0x52c04e[_0x9d31('0x2d')][_0x9d31('0x34')]);}_0x3bb976[_0x9d31('0x35')]=qs[_0x9d31('0x36')](_0x52c04e[_0x9d31('0x2d')]['sort']);_0x3bb976[_0x9d31('0x37')]=qs[_0x9d31('0x2e')](_[_0x9d31('0x38')](_0x52c04e[_0x9d31('0x2d')],_0x5ce862[_0x9d31('0x2e')]),_0x48a277);if(_0x52c04e[_0x9d31('0x2d')][_0x9d31('0x39')]){_0x3bb976[_0x9d31('0x37')]=_['merge'](_0x3bb976['where'],{'$or':_[_0x9d31('0x27')](_0x48a277,function(_0x24f238){if(_0x24f238['type']!=='VIRTUAL'){var _0x1045e3={};_0x1045e3[_0x24f238[_0x9d31('0x24')]]={'$like':'%'+_0x52c04e[_0x9d31('0x2d')]['filter']+'%'};return _0x1045e3;}})});}_0x3bb976=_[_0x9d31('0x3a')]({},_0x3bb976,_0x52c04e[_0x9d31('0x3b')]);var _0x401901={'where':_0x3bb976[_0x9d31('0x37')]};return db[_0x9d31('0x3c')][_0x9d31('0x3d')](_0x401901)['then'](function(_0x2d14ae){_0x5c96b5['count']=_0x2d14ae;if(_0x52c04e[_0x9d31('0x2d')][_0x9d31('0x3e')]){_0x3bb976[_0x9d31('0x3f')]=[{'all':!![]}];}return db[_0x9d31('0x3c')][_0x9d31('0x40')](_0x3bb976);})[_0x9d31('0x21')](function(_0x392f30){_0x5c96b5['rows']=_0x392f30;return _0x5c96b5;})[_0x9d31('0x21')](respondWithFilteredResult(_0x33a164,_0x3bb976))['catch'](handleError(_0x33a164,null));};exports[_0x9d31('0x41')]=function(_0x28c4de,_0x51ca0d){var _0x3f932d={'raw':!![],'where':{'id':_0x28c4de[_0x9d31('0x42')]['id']}},_0x2df9d2={};_0x2df9d2[_0x9d31('0x2b')]=_[_0x9d31('0x2c')](db[_0x9d31('0x3c')][_0x9d31('0x28')]);_0x2df9d2[_0x9d31('0x2d')]=_['keys'](_0x28c4de['query']);_0x2df9d2[_0x9d31('0x2e')]=_[_0x9d31('0x2f')](_0x2df9d2[_0x9d31('0x2b')],_0x2df9d2[_0x9d31('0x2d')]);_0x3f932d[_0x9d31('0x31')]=_['intersection'](_0x2df9d2[_0x9d31('0x2b')],qs[_0x9d31('0x30')](_0x28c4de[_0x9d31('0x2d')]['fields']));_0x3f932d[_0x9d31('0x31')]=_0x3f932d[_0x9d31('0x31')][_0x9d31('0x32')]?_0x3f932d[_0x9d31('0x31')]:_0x2df9d2[_0x9d31('0x2b')];if(_0x28c4de[_0x9d31('0x2d')][_0x9d31('0x3e')]){_0x3f932d[_0x9d31('0x3f')]=[{'all':!![]}];}_0x3f932d=_[_0x9d31('0x3a')]({},_0x3f932d,_0x28c4de[_0x9d31('0x3b')]);return db[_0x9d31('0x3c')][_0x9d31('0x43')](_0x3f932d)['then'](handleEntityNotFound(_0x51ca0d,null))[_0x9d31('0x21')](respondWithResult(_0x51ca0d,null))[_0x9d31('0x44')](handleError(_0x51ca0d,null));};exports[_0x9d31('0x45')]=function(_0x276d27,_0x5dce55){return db[_0x9d31('0x3c')][_0x9d31('0x45')](_0x276d27[_0x9d31('0x46')],{})[_0x9d31('0x21')](respondWithResult(_0x5dce55,0xc9))[_0x9d31('0x44')](handleError(_0x5dce55,null));};exports[_0x9d31('0x20')]=function(_0x12e242,_0x549b9c){if(_0x12e242['body']['id']){delete _0x12e242[_0x9d31('0x46')]['id'];}return db[_0x9d31('0x3c')][_0x9d31('0x43')]({'where':{'id':_0x12e242[_0x9d31('0x42')]['id']}})[_0x9d31('0x21')](handleEntityNotFound(_0x549b9c,null))['then'](saveUpdates(_0x12e242['body'],null))[_0x9d31('0x21')](respondWithResult(_0x549b9c,null))[_0x9d31('0x44')](handleError(_0x549b9c,null));};exports[_0x9d31('0x22')]=function(_0x58380d,_0x2daca3){return db[_0x9d31('0x3c')][_0x9d31('0x43')]({'where':{'id':_0x58380d[_0x9d31('0x42')]['id']}})[_0x9d31('0x21')](handleEntityNotFound(_0x2daca3,null))['then'](removeEntity(_0x2daca3,null))[_0x9d31('0x44')](handleError(_0x2daca3,null));};exports[_0x9d31('0x47')]=function(_0x178b9,_0x1608e8){return db[_0x9d31('0x3c')][_0x9d31('0x47')]()[_0x9d31('0x21')](respondWithResult(_0x1608e8,null))[_0x9d31('0x44')](handleError(_0x1608e8,null));}; \ No newline at end of file +var _0x1421=['fieldName','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','rawAttributes','keys','include','find','catch','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','update','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x1421,0x1cd));var _0x1142=function(_0x3e0bd8,_0x49a4a8){_0x3e0bd8=_0x3e0bd8-0x0;var _0x1361eb=_0x1421[_0x3e0bd8];return _0x1361eb;};'use strict';var pdf=require(_0x1142('0x0'));var emlformat=require(_0x1142('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1142('0x2'));var jsonpatch=require(_0x1142('0x3'));var rp=require('request-promise');var moment=require(_0x1142('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1142('0x5'));var path=require('path');var sox=require(_0x1142('0x6'));var csv=require(_0x1142('0x7'));var ejs=require(_0x1142('0x8'));var fs=require('fs');var _=require(_0x1142('0x9'));var squel=require(_0x1142('0xa'));var crypto=require(_0x1142('0xb'));var jsforce=require(_0x1142('0xc'));var deskjs=require(_0x1142('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1142('0xe'));var Papa=require('papaparse');var Redis=require(_0x1142('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1142('0x10'));var as=require(_0x1142('0x11'));var hardwareService=require(_0x1142('0x12'));var logger=require(_0x1142('0x13'))(_0x1142('0x14'));var utils=require(_0x1142('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1142('0x16'));var db=require(_0x1142('0x17'))['db'];function respondWithStatusCode(_0x2f9271,_0x36bf74){_0x36bf74=_0x36bf74||0xcc;return function(_0x23ad36){if(_0x23ad36){return _0x2f9271[_0x1142('0x18')](_0x36bf74);}return _0x2f9271[_0x1142('0x19')](_0x36bf74)[_0x1142('0x1a')]();};}function respondWithResult(_0x472e25,_0x168a64){_0x168a64=_0x168a64||0xc8;return function(_0xc7e477){if(_0xc7e477){return _0x472e25[_0x1142('0x19')](_0x168a64)[_0x1142('0x1b')](_0xc7e477);}};}function respondWithFilteredResult(_0x225f1a,_0xa043f8){return function(_0x1856fa){if(_0x1856fa){var _0x2cd9eb=_0x1856fa[_0x1142('0x1c')],_0x2efbfc=_0xa043f8[_0x1142('0x1d')],_0x20282d=_0xa043f8[_0x1142('0x1d')]+_0xa043f8[_0x1142('0x1e')],_0x68723a;if(_0x20282d>=_0x2cd9eb){_0x20282d=_0x2cd9eb;_0x68723a=0xc8;}else{_0x68723a=0xce;}_0x225f1a[_0x1142('0x19')](_0x68723a);return _0x225f1a[_0x1142('0x1f')]('Content-Range',_0x2efbfc+'-'+_0x20282d+'/'+_0x2cd9eb)['json'](_0x1856fa);}return null;};}function patchUpdates(_0x1e53cf){return function(_0x52d260){try{jsonpatch[_0x1142('0x20')](_0x52d260,_0x1e53cf,!![]);}catch(_0x5a6b09){return BPromise['reject'](_0x5a6b09);}return _0x52d260['save']();};}function saveUpdates(_0x58f4b5,_0x204e7d){return function(_0x26e4c3){if(_0x26e4c3){return _0x26e4c3[_0x1142('0x21')](_0x58f4b5)[_0x1142('0x22')](function(_0x2c0ecd){return _0x2c0ecd;});}return null;};}function removeEntity(_0x400752,_0x48835e){return function(_0x222d80){if(_0x222d80){return _0x222d80[_0x1142('0x23')]()[_0x1142('0x22')](function(){_0x400752[_0x1142('0x19')](0xcc)[_0x1142('0x1a')]();});}};}function handleEntityNotFound(_0x3b2e7b,_0x19c130){return function(_0x2bb9e8){if(!_0x2bb9e8){_0x3b2e7b[_0x1142('0x18')](0x194);}return _0x2bb9e8;};}function handleError(_0x587ff9,_0x2a2089){_0x2a2089=_0x2a2089||0x1f4;return function(_0x4b9e6e){logger[_0x1142('0x24')](_0x4b9e6e[_0x1142('0x25')]);if(_0x4b9e6e[_0x1142('0x26')]){delete _0x4b9e6e[_0x1142('0x26')];}_0x587ff9[_0x1142('0x19')](_0x2a2089)[_0x1142('0x27')](_0x4b9e6e);};}exports[_0x1142('0x28')]=function(_0x12b1a2,_0x16d719){var _0x1d7200={},_0x250ffc={},_0x3e0e52={'count':0x0,'rows':[]};var _0xd8d0b4=_[_0x1142('0x29')](db[_0x1142('0x2a')]['rawAttributes'],function(_0x3644d5){return{'name':_0x3644d5[_0x1142('0x2b')],'type':_0x3644d5[_0x1142('0x2c')][_0x1142('0x2d')]};});_0x250ffc[_0x1142('0x2e')]=_[_0x1142('0x29')](_0xd8d0b4,'name');_0x250ffc[_0x1142('0x2f')]=_['keys'](_0x12b1a2[_0x1142('0x2f')]);_0x250ffc['filters']=_[_0x1142('0x30')](_0x250ffc[_0x1142('0x2e')],_0x250ffc[_0x1142('0x2f')]);_0x1d7200[_0x1142('0x31')]=_[_0x1142('0x30')](_0x250ffc['model'],qs[_0x1142('0x32')](_0x12b1a2[_0x1142('0x2f')][_0x1142('0x32')]));_0x1d7200['attributes']=_0x1d7200[_0x1142('0x31')]['length']?_0x1d7200[_0x1142('0x31')]:_0x250ffc[_0x1142('0x2e')];if(!_0x12b1a2[_0x1142('0x2f')]['hasOwnProperty'](_0x1142('0x33'))){_0x1d7200['limit']=qs[_0x1142('0x1e')](_0x12b1a2[_0x1142('0x2f')][_0x1142('0x1e')]);_0x1d7200[_0x1142('0x1d')]=qs['offset'](_0x12b1a2[_0x1142('0x2f')][_0x1142('0x1d')]);}_0x1d7200[_0x1142('0x34')]=qs[_0x1142('0x35')](_0x12b1a2[_0x1142('0x2f')][_0x1142('0x35')]);_0x1d7200[_0x1142('0x36')]=qs[_0x1142('0x37')](_['pick'](_0x12b1a2[_0x1142('0x2f')],_0x250ffc[_0x1142('0x37')]),_0xd8d0b4);if(_0x12b1a2[_0x1142('0x2f')][_0x1142('0x38')]){_0x1d7200[_0x1142('0x36')]=_['merge'](_0x1d7200['where'],{'$or':_[_0x1142('0x29')](_0xd8d0b4,function(_0x5095f0){if(_0x5095f0[_0x1142('0x2c')]!==_0x1142('0x39')){var _0x10a9da={};_0x10a9da[_0x5095f0[_0x1142('0x26')]]={'$like':'%'+_0x12b1a2[_0x1142('0x2f')][_0x1142('0x38')]+'%'};return _0x10a9da;}})});}_0x1d7200=_[_0x1142('0x3a')]({},_0x1d7200,_0x12b1a2[_0x1142('0x3b')]);var _0x3ac870={'where':_0x1d7200['where']};return db[_0x1142('0x2a')]['count'](_0x3ac870)[_0x1142('0x22')](function(_0x22e03f){_0x3e0e52[_0x1142('0x1c')]=_0x22e03f;if(_0x12b1a2[_0x1142('0x2f')][_0x1142('0x3c')]){_0x1d7200['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x1142('0x3d')](_0x1d7200);})[_0x1142('0x22')](function(_0x1a14c1){_0x3e0e52[_0x1142('0x3e')]=_0x1a14c1;return _0x3e0e52;})[_0x1142('0x22')](respondWithFilteredResult(_0x16d719,_0x1d7200))['catch'](handleError(_0x16d719,null));};exports[_0x1142('0x3f')]=function(_0x49c35a,_0x13b6a7){var _0x29cee4={'raw':!![],'where':{'id':_0x49c35a[_0x1142('0x40')]['id']}},_0x50776c={};_0x50776c[_0x1142('0x2e')]=_['keys'](db[_0x1142('0x2a')][_0x1142('0x41')]);_0x50776c[_0x1142('0x2f')]=_[_0x1142('0x42')](_0x49c35a[_0x1142('0x2f')]);_0x50776c[_0x1142('0x37')]=_[_0x1142('0x30')](_0x50776c[_0x1142('0x2e')],_0x50776c[_0x1142('0x2f')]);_0x29cee4[_0x1142('0x31')]=_[_0x1142('0x30')](_0x50776c['model'],qs['fields'](_0x49c35a[_0x1142('0x2f')]['fields']));_0x29cee4[_0x1142('0x31')]=_0x29cee4[_0x1142('0x31')]['length']?_0x29cee4[_0x1142('0x31')]:_0x50776c[_0x1142('0x2e')];if(_0x49c35a['query'][_0x1142('0x3c')]){_0x29cee4[_0x1142('0x43')]=[{'all':!![]}];}_0x29cee4=_[_0x1142('0x3a')]({},_0x29cee4,_0x49c35a['options']);return db['OpenchannelTransferReport'][_0x1142('0x44')](_0x29cee4)['then'](handleEntityNotFound(_0x13b6a7,null))[_0x1142('0x22')](respondWithResult(_0x13b6a7,null))[_0x1142('0x45')](handleError(_0x13b6a7,null));};exports['create']=function(_0x376802,_0x289e7b){return db[_0x1142('0x2a')]['create'](_0x376802[_0x1142('0x46')],{})[_0x1142('0x22')](respondWithResult(_0x289e7b,0xc9))[_0x1142('0x45')](handleError(_0x289e7b,null));};exports[_0x1142('0x21')]=function(_0x1d34f3,_0x4baac5){if(_0x1d34f3['body']['id']){delete _0x1d34f3[_0x1142('0x46')]['id'];}return db['OpenchannelTransferReport'][_0x1142('0x44')]({'where':{'id':_0x1d34f3[_0x1142('0x40')]['id']}})[_0x1142('0x22')](handleEntityNotFound(_0x4baac5,null))[_0x1142('0x22')](saveUpdates(_0x1d34f3[_0x1142('0x46')],null))[_0x1142('0x22')](respondWithResult(_0x4baac5,null))[_0x1142('0x45')](handleError(_0x4baac5,null));};exports[_0x1142('0x23')]=function(_0x33244d,_0xbd60bc){return db[_0x1142('0x2a')][_0x1142('0x44')]({'where':{'id':_0x33244d[_0x1142('0x40')]['id']}})['then'](handleEntityNotFound(_0xbd60bc,null))[_0x1142('0x22')](removeEntity(_0xbd60bc,null))[_0x1142('0x45')](handleError(_0xbd60bc,null));};exports[_0x1142('0x47')]=function(_0x53c999,_0x215971){return db[_0x1142('0x2a')][_0x1142('0x47')]()[_0x1142('0x22')](respondWithResult(_0x215971,null))[_0x1142('0x45')](handleError(_0x215971,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index bbf4a06..d8bc442 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 _0x88e4=['define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','api','moment','bluebird','path','../../config/environment','./openchannelTransferReport.attributes','exports'];(function(_0x3e91a9,_0x53c466){var _0x25c9ad=function(_0x69ee2d){while(--_0x69ee2d){_0x3e91a9['push'](_0x3e91a9['shift']());}};_0x25c9ad(++_0x53c466);}(_0x88e4,0xac));var _0x488e=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x88e4[_0x47b15f];return _0x55bf25;};'use strict';var _=require('lodash');var util=require(_0x488e('0x0'));var logger=require('../../config/logger')(_0x488e('0x1'));var moment=require(_0x488e('0x2'));var BPromise=require(_0x488e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x488e('0x4'));var rimraf=require('rimraf');var config=require(_0x488e('0x5'));var attributes=require(_0x488e('0x6'));module[_0x488e('0x7')]=function(_0x7033a,_0x4a0bdd){return _0x7033a[_0x488e('0x8')](_0x488e('0x9'),attributes,{'tableName':_0x488e('0xa'),'paranoid':![],'indexes':[{'name':_0x488e('0xb'),'fields':[_0x488e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfbb4=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','api','moment','bluebird','request-promise'];(function(_0x758ec9,_0xe5f0a7){var _0x55e2dc=function(_0x2c1e58){while(--_0x2c1e58){_0x758ec9['push'](_0x758ec9['shift']());}};_0x55e2dc(++_0xe5f0a7);}(_0xfbb4,0xff));var _0x4fbb=function(_0x377972,_0x21dd9f){_0x377972=_0x377972-0x0;var _0x551b81=_0xfbb4[_0x377972];return _0x551b81;};'use strict';var _=require(_0x4fbb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4fbb('0x1'));var moment=require(_0x4fbb('0x2'));var BPromise=require(_0x4fbb('0x3'));var rp=require(_0x4fbb('0x4'));var fs=require('fs');var path=require(_0x4fbb('0x5'));var rimraf=require(_0x4fbb('0x6'));var config=require(_0x4fbb('0x7'));var attributes=require(_0x4fbb('0x8'));module[_0x4fbb('0x9')]=function(_0x7bd9b,_0x13dbb5){return _0x7bd9b['define'](_0x4fbb('0xa'),attributes,{'tableName':_0x4fbb('0xb'),'paranoid':![],'indexes':[{'name':_0x4fbb('0xc'),'fields':[_0x4fbb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 8d04d3a..f690170 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 _0xbd19=['../../config/logger','rpc','http','request','info','request\x20sent','error','OpenchannelTransferReport,\x20%s,\x20%s','message','result','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2ab3d9,_0x50e716){var _0x210a54=function(_0x24c479){while(--_0x24c479){_0x2ab3d9['push'](_0x2ab3d9['shift']());}};_0x210a54(++_0x50e716);}(_0xbd19,0x192));var _0x9bd1=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xbd19[_0x4ed520];return _0x4415a6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9bd1('0x0'));var rs=require(_0x9bd1('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bd1('0x2'))['db'];var utils=require(_0x9bd1('0x3'));var logger=require(_0x9bd1('0x4'))(_0x9bd1('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9bd1('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x119bfa,_0x1e8e27,_0x526f34){return new BPromise(function(_0x1d0693,_0x32ad6d){return client[_0x9bd1('0x7')](_0x119bfa,_0x526f34)['then'](function(_0x2f3540){logger[_0x9bd1('0x8')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1e8e27,_0x9bd1('0x9'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x1e8e27,'request\x20sent',JSON['stringify'](_0x2f3540));if(_0x2f3540[_0x9bd1('0xa')]){if(_0x2f3540['error']['code']===0x1f4){logger['error'](_0x9bd1('0xb'),_0x1e8e27,_0x2f3540[_0x9bd1('0xa')][_0x9bd1('0xc')]);return _0x32ad6d(_0x2f3540[_0x9bd1('0xa')][_0x9bd1('0xc')]);}logger[_0x9bd1('0xa')](_0x9bd1('0xb'),_0x1e8e27,_0x2f3540[_0x9bd1('0xa')][_0x9bd1('0xc')]);return _0x1d0693(_0x2f3540['error'][_0x9bd1('0xc')]);}else{logger[_0x9bd1('0x8')](_0x9bd1('0xb'),_0x1e8e27,_0x9bd1('0x9'));_0x1d0693(_0x2f3540[_0x9bd1('0xd')]['message']);}})['catch'](function(_0x13747f){logger[_0x9bd1('0xa')](_0x9bd1('0xb'),_0x1e8e27,_0x13747f);_0x32ad6d(_0x13747f);});});} \ No newline at end of file +var _0x2f18=['debug','stringify','error','OpenchannelTransferReport,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','request\x20sent'];(function(_0x9be28f,_0x231334){var _0xa9f52d=function(_0x239dad){while(--_0x239dad){_0x9be28f['push'](_0x9be28f['shift']());}};_0xa9f52d(++_0x231334);}(_0x2f18,0xd9));var _0x82f1=function(_0x335cfa,_0x1e7634){_0x335cfa=_0x335cfa-0x0;var _0xb7a81b=_0x2f18[_0x335cfa];return _0xb7a81b;};'use strict';var _=require('lodash');var util=require(_0x82f1('0x0'));var moment=require(_0x82f1('0x1'));var BPromise=require(_0x82f1('0x2'));var rs=require(_0x82f1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82f1('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x82f1('0x5'));var config=require('../../config/environment');var jayson=require(_0x82f1('0x6'));var client=jayson[_0x82f1('0x7')][_0x82f1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c1452,_0x5d8666,_0x440191){return new BPromise(function(_0x13908f,_0xaeb68e){return client[_0x82f1('0x9')](_0x1c1452,_0x440191)['then'](function(_0x4be045){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x5d8666,_0x82f1('0xa'));logger[_0x82f1('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x5d8666,'request\x20sent',JSON[_0x82f1('0xc')](_0x4be045));if(_0x4be045[_0x82f1('0xd')]){if(_0x4be045[_0x82f1('0xd')]['code']===0x1f4){logger[_0x82f1('0xd')](_0x82f1('0xe'),_0x5d8666,_0x4be045[_0x82f1('0xd')][_0x82f1('0xf')]);return _0xaeb68e(_0x4be045[_0x82f1('0xd')][_0x82f1('0xf')]);}logger[_0x82f1('0xd')](_0x82f1('0xe'),_0x5d8666,_0x4be045[_0x82f1('0xd')][_0x82f1('0xf')]);return _0x13908f(_0x4be045['error'][_0x82f1('0xf')]);}else{logger[_0x82f1('0x10')](_0x82f1('0xe'),_0x5d8666,_0x82f1('0xa'));_0x13908f(_0x4be045[_0x82f1('0x11')][_0x82f1('0xf')]);}})[_0x82f1('0x12')](function(_0x103083){logger[_0x82f1('0xd')](_0x82f1('0xe'),_0x5d8666,_0x103083);_0xaeb68e(_0x103083);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 8521afc..b6dce64 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 _0xa940=['put','update','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x3dc4c2,_0x26ef0d){var _0x21c531=function(_0x4c68ed){while(--_0x4c68ed){_0x3dc4c2['push'](_0x3dc4c2['shift']());}};_0x21c531(++_0x26ef0d);}(_0xa940,0x1f3));var _0x0a94=function(_0x2d363f,_0x35d255){_0x2d363f=_0x2d363f-0x0;var _0x69f7e9=_0xa940[_0x2d363f];return _0x69f7e9;};'use strict';var multer=require('multer');var util=require(_0x0a94('0x0'));var path=require(_0x0a94('0x1'));var timeout=require('connect-timeout');var express=require(_0x0a94('0x2'));var router=express[_0x0a94('0x3')]();var auth=require(_0x0a94('0x4'));var interaction=require(_0x0a94('0x5'));var config=require(_0x0a94('0x6'));var controller=require('./pause.controller');router['get']('/',auth[_0x0a94('0x7')](),controller[_0x0a94('0x8')]);router[_0x0a94('0x9')](_0x0a94('0xa'),auth[_0x0a94('0x7')](),controller['show']);router['post']('/',auth[_0x0a94('0x7')](),controller['create']);router[_0x0a94('0xb')](_0x0a94('0xa'),auth[_0x0a94('0x7')](),controller[_0x0a94('0xc')]);router[_0x0a94('0xd')](_0x0a94('0xa'),auth[_0x0a94('0x7')](),controller['destroy']);module[_0x0a94('0xe')]=router; \ No newline at end of file +var _0xf418=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','multer'];(function(_0x5f5100,_0x560364){var _0x5d2307=function(_0x574398){while(--_0x574398){_0x5f5100['push'](_0x5f5100['shift']());}};_0x5d2307(++_0x560364);}(_0xf418,0x18b));var _0x8f41=function(_0x196e77,_0x275087){_0x196e77=_0x196e77-0x0;var _0x10a5d9=_0xf418[_0x196e77];return _0x10a5d9;};'use strict';var multer=require(_0x8f41('0x0'));var util=require('util');var path=require(_0x8f41('0x1'));var timeout=require(_0x8f41('0x2'));var express=require(_0x8f41('0x3'));var router=express[_0x8f41('0x4')]();var auth=require(_0x8f41('0x5'));var interaction=require(_0x8f41('0x6'));var config=require(_0x8f41('0x7'));var controller=require(_0x8f41('0x8'));router['get']('/',auth[_0x8f41('0x9')](),controller[_0x8f41('0xa')]);router['get'](_0x8f41('0xb'),auth[_0x8f41('0x9')](),controller['show']);router[_0x8f41('0xc')]('/',auth[_0x8f41('0x9')](),controller[_0x8f41('0xd')]);router[_0x8f41('0xe')](_0x8f41('0xb'),auth[_0x8f41('0x9')](),controller['update']);router[_0x8f41('0xf')](_0x8f41('0xb'),auth['isAuthenticated'](),controller[_0x8f41('0x10')]);module[_0x8f41('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 246e9ea..414e2ef 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 _0x6a02=['STRING','name','exports'];(function(_0x5e32f3,_0x3386c1){var _0x4d4e03=function(_0xe86f5){while(--_0xe86f5){_0x5e32f3['push'](_0x5e32f3['shift']());}};_0x4d4e03(++_0x3386c1);}(_0x6a02,0x15e));var _0x26a0=function(_0xb07631,_0x47585d){_0xb07631=_0xb07631-0x0;var _0x25febd=_0x6a02[_0xb07631];return _0x25febd;};'use strict';var Sequelize=require('sequelize');module[_0x26a0('0x0')]={'name':{'type':Sequelize[_0x26a0('0x1')],'unique':_0x26a0('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x26a0('0x1')]}}; \ No newline at end of file +var _0xfd51=['exports','name','STRING','sequelize'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xfd51,0x1d7));var _0x1fd5=function(_0x2bf1e8,_0x666d17){_0x2bf1e8=_0x2bf1e8-0x0;var _0x1bf59f=_0xfd51[_0x2bf1e8];return _0x1bf59f;};'use strict';var Sequelize=require(_0x1fd5('0x0'));module[_0x1fd5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1fd5('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x1fd5('0x3')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 1472809..b47ce5f 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 _0x83ed=['create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','json','apply','reject','save','update','then','get','Pauses','UserProfileResource','destroy','stack','name','send','index','map','Pause','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','find'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x83ed,0xb7));var _0xd83e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x83ed[_0x47b58b];return _0x46bebe;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd83e('0x0'));var rimraf=require(_0xd83e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd83e('0x2'));var rp=require(_0xd83e('0x3'));var moment=require(_0xd83e('0x4'));var BPromise=require(_0xd83e('0x5'));var Mustache=require(_0xd83e('0x6'));var util=require(_0xd83e('0x7'));var path=require(_0xd83e('0x8'));var sox=require('sox');var csv=require(_0xd83e('0x9'));var ejs=require(_0xd83e('0xa'));var fs=require('fs');var _=require(_0xd83e('0xb'));var squel=require(_0xd83e('0xc'));var crypto=require('crypto');var jsforce=require(_0xd83e('0xd'));var deskjs=require(_0xd83e('0xe'));var toCsv=require(_0xd83e('0x9'));var querystring=require(_0xd83e('0xf'));var Papa=require(_0xd83e('0x10'));var Redis=require(_0xd83e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd83e('0x12'));var as=require(_0xd83e('0x13'));var hardwareService=require(_0xd83e('0x14'));var logger=require(_0xd83e('0x15'))(_0xd83e('0x16'));var utils=require('../../config/utils');var config=require(_0xd83e('0x17'));var licenseUtil=require(_0xd83e('0x18'));var db=require(_0xd83e('0x19'))['db'];function respondWithStatusCode(_0x5b1979,_0x581c51){_0x581c51=_0x581c51||0xcc;return function(_0x23a62d){if(_0x23a62d){return _0x5b1979[_0xd83e('0x1a')](_0x581c51);}return _0x5b1979[_0xd83e('0x1b')](_0x581c51)[_0xd83e('0x1c')]();};}function respondWithResult(_0x55ea99,_0x153e7f){_0x153e7f=_0x153e7f||0xc8;return function(_0x7cd7ed){if(_0x7cd7ed){return _0x55ea99[_0xd83e('0x1b')](_0x153e7f)['json'](_0x7cd7ed);}};}function respondWithFilteredResult(_0x53367a,_0xd7ff84){return function(_0x2f9ab6){if(_0x2f9ab6){var _0xc6105b=_0x2f9ab6['count'],_0x5f411f=_0xd7ff84[_0xd83e('0x1d')],_0x412e8e=_0xd7ff84[_0xd83e('0x1d')]+_0xd7ff84[_0xd83e('0x1e')],_0x53a3aa;if(_0x412e8e>=_0xc6105b){_0x412e8e=_0xc6105b;_0x53a3aa=0xc8;}else{_0x53a3aa=0xce;}_0x53367a[_0xd83e('0x1b')](_0x53a3aa);return _0x53367a[_0xd83e('0x1f')]('Content-Range',_0x5f411f+'-'+_0x412e8e+'/'+_0xc6105b)[_0xd83e('0x20')](_0x2f9ab6);}return null;};}function patchUpdates(_0x4db5b4){return function(_0x141189){try{jsonpatch[_0xd83e('0x21')](_0x141189,_0x4db5b4,!![]);}catch(_0x384145){return BPromise[_0xd83e('0x22')](_0x384145);}return _0x141189[_0xd83e('0x23')]();};}function saveUpdates(_0x4b75c4,_0x5b4862){return function(_0x5d2bae){if(_0x5d2bae){return _0x5d2bae[_0xd83e('0x24')](_0x4b75c4)[_0xd83e('0x25')](function(_0x32851d){return _0x32851d;});}return null;};}function removeEntity(_0x166622,_0x20d403){return function(_0x1aa900){if(_0x1aa900){return _0x1aa900['destroy']()[_0xd83e('0x25')](function(){var _0x57362a=_0x1aa900[_0xd83e('0x26')]({'plain':!![]});var _0xce439=_0xd83e('0x27');return db[_0xd83e('0x28')][_0xd83e('0x29')]({'where':{'type':_0xce439,'resourceId':_0x57362a['id']}})[_0xd83e('0x25')](function(){return _0x1aa900;});})[_0xd83e('0x25')](function(){_0x166622[_0xd83e('0x1b')](0xcc)[_0xd83e('0x1c')]();});}};}function handleEntityNotFound(_0x41617e,_0x52aa06){return function(_0x456a8c){if(!_0x456a8c){_0x41617e['sendStatus'](0x194);}return _0x456a8c;};}function handleError(_0x216403,_0x3a65b7){_0x3a65b7=_0x3a65b7||0x1f4;return function(_0x40b289){logger['error'](_0x40b289[_0xd83e('0x2a')]);if(_0x40b289[_0xd83e('0x2b')]){delete _0x40b289[_0xd83e('0x2b')];}_0x216403[_0xd83e('0x1b')](_0x3a65b7)[_0xd83e('0x2c')](_0x40b289);};}exports[_0xd83e('0x2d')]=function(_0x1b1ddf,_0x4045c7){var _0x2a8900={},_0x41c7c5={},_0x3ea034={'count':0x0,'rows':[]};var _0x88776a=_[_0xd83e('0x2e')](db[_0xd83e('0x2f')]['rawAttributes'],function(_0x1a1d1c){return{'name':_0x1a1d1c[_0xd83e('0x30')],'type':_0x1a1d1c[_0xd83e('0x31')][_0xd83e('0x32')]};});_0x41c7c5[_0xd83e('0x33')]=_[_0xd83e('0x2e')](_0x88776a,_0xd83e('0x2b'));_0x41c7c5[_0xd83e('0x34')]=_[_0xd83e('0x35')](_0x1b1ddf[_0xd83e('0x34')]);_0x41c7c5['filters']=_[_0xd83e('0x36')](_0x41c7c5[_0xd83e('0x33')],_0x41c7c5[_0xd83e('0x34')]);_0x2a8900['attributes']=_['intersection'](_0x41c7c5[_0xd83e('0x33')],qs[_0xd83e('0x37')](_0x1b1ddf['query']['fields']));_0x2a8900[_0xd83e('0x38')]=_0x2a8900[_0xd83e('0x38')][_0xd83e('0x39')]?_0x2a8900[_0xd83e('0x38')]:_0x41c7c5[_0xd83e('0x33')];if(!_0x1b1ddf[_0xd83e('0x34')]['hasOwnProperty'](_0xd83e('0x3a'))){_0x2a8900['limit']=qs[_0xd83e('0x1e')](_0x1b1ddf[_0xd83e('0x34')][_0xd83e('0x1e')]);_0x2a8900[_0xd83e('0x1d')]=qs[_0xd83e('0x1d')](_0x1b1ddf[_0xd83e('0x34')][_0xd83e('0x1d')]);}_0x2a8900[_0xd83e('0x3b')]=qs[_0xd83e('0x3c')](_0x1b1ddf[_0xd83e('0x34')][_0xd83e('0x3c')]);_0x2a8900['where']=qs[_0xd83e('0x3d')](_['pick'](_0x1b1ddf['query'],_0x41c7c5[_0xd83e('0x3d')]),_0x88776a);if(_0x1b1ddf[_0xd83e('0x34')][_0xd83e('0x3e')]){_0x2a8900['where']=_['merge'](_0x2a8900[_0xd83e('0x3f')],{'$or':_['map'](_0x88776a,function(_0x545995){if(_0x545995['type']!==_0xd83e('0x40')){var _0xf9e810={};_0xf9e810[_0x545995[_0xd83e('0x2b')]]={'$like':'%'+_0x1b1ddf[_0xd83e('0x34')][_0xd83e('0x3e')]+'%'};return _0xf9e810;}})});}_0x2a8900=_[_0xd83e('0x41')]({},_0x2a8900,_0x1b1ddf[_0xd83e('0x42')]);var _0x7bdd5e={'where':_0x2a8900[_0xd83e('0x3f')]};return db['Pause'][_0xd83e('0x43')](_0x7bdd5e)[_0xd83e('0x25')](function(_0x205adf){_0x3ea034[_0xd83e('0x43')]=_0x205adf;if(_0x1b1ddf[_0xd83e('0x34')][_0xd83e('0x44')]){_0x2a8900[_0xd83e('0x45')]=[{'all':!![]}];}return db[_0xd83e('0x2f')][_0xd83e('0x46')](_0x2a8900);})[_0xd83e('0x25')](function(_0x26b02e){_0x3ea034[_0xd83e('0x47')]=_0x26b02e;return _0x3ea034;})[_0xd83e('0x25')](respondWithFilteredResult(_0x4045c7,_0x2a8900))[_0xd83e('0x48')](handleError(_0x4045c7,null));};exports[_0xd83e('0x49')]=function(_0x489bf4,_0x5cd11d){var _0x14ca00={'raw':!![],'where':{'id':_0x489bf4['params']['id']}},_0x2ff5fd={};_0x2ff5fd['model']=_[_0xd83e('0x35')](db[_0xd83e('0x2f')]['rawAttributes']);_0x2ff5fd[_0xd83e('0x34')]=_['keys'](_0x489bf4[_0xd83e('0x34')]);_0x2ff5fd[_0xd83e('0x3d')]=_['intersection'](_0x2ff5fd[_0xd83e('0x33')],_0x2ff5fd[_0xd83e('0x34')]);_0x14ca00[_0xd83e('0x38')]=_[_0xd83e('0x36')](_0x2ff5fd['model'],qs[_0xd83e('0x37')](_0x489bf4['query']['fields']));_0x14ca00['attributes']=_0x14ca00[_0xd83e('0x38')]['length']?_0x14ca00['attributes']:_0x2ff5fd[_0xd83e('0x33')];if(_0x489bf4[_0xd83e('0x34')][_0xd83e('0x44')]){_0x14ca00[_0xd83e('0x45')]=[{'all':!![]}];}_0x14ca00=_['merge']({},_0x14ca00,_0x489bf4[_0xd83e('0x42')]);return db[_0xd83e('0x2f')][_0xd83e('0x4a')](_0x14ca00)[_0xd83e('0x25')](handleEntityNotFound(_0x5cd11d,null))[_0xd83e('0x25')](respondWithResult(_0x5cd11d,null))[_0xd83e('0x48')](handleError(_0x5cd11d,null));};exports[_0xd83e('0x4b')]=function(_0x5d85e8,_0x113b23){return db[_0xd83e('0x2f')][_0xd83e('0x4b')](_0x5d85e8[_0xd83e('0x4c')],{})[_0xd83e('0x25')](function(_0x3c0a8b){var _0x221d18=_0x5d85e8['user'][_0xd83e('0x26')]({'plain':!![]});if(!_0x221d18)throw new Error(_0xd83e('0x4d'));if(_0x221d18[_0xd83e('0x4e')]===_0xd83e('0x4f')){var _0x3036b6=_0x3c0a8b[_0xd83e('0x26')]({'plain':!![]});var _0x1d0d95='Pauses';return db[_0xd83e('0x50')]['find']({'where':{'name':_0x1d0d95,'userProfileId':_0x221d18[_0xd83e('0x51')]},'raw':!![]})[_0xd83e('0x25')](function(_0x24c88b){if(_0x24c88b&&_0x24c88b[_0xd83e('0x52')]===0x0){return db[_0xd83e('0x28')][_0xd83e('0x4b')]({'name':_0x3036b6[_0xd83e('0x2b')],'resourceId':_0x3036b6['id'],'type':_0x24c88b[_0xd83e('0x2b')],'sectionId':_0x24c88b['id']},{})[_0xd83e('0x25')](function(){return _0x3c0a8b;});}else{return _0x3c0a8b;}})['catch'](function(_0x50adf7){logger[_0xd83e('0x53')](_0xd83e('0x54'),_0x50adf7);throw _0x50adf7;});}return _0x3c0a8b;})[_0xd83e('0x25')](respondWithResult(_0x113b23,0xc9))[_0xd83e('0x48')](handleError(_0x113b23,null));};exports[_0xd83e('0x24')]=function(_0x22f6e0,_0x94da8f){if(_0x22f6e0[_0xd83e('0x4c')]['id']){delete _0x22f6e0['body']['id'];}return db['Pause'][_0xd83e('0x4a')]({'where':{'id':_0x22f6e0['params']['id']}})['then'](handleEntityNotFound(_0x94da8f,null))[_0xd83e('0x25')](saveUpdates(_0x22f6e0[_0xd83e('0x4c')],null))[_0xd83e('0x25')](respondWithResult(_0x94da8f,null))[_0xd83e('0x48')](handleError(_0x94da8f,null));};exports[_0xd83e('0x29')]=function(_0x5a3294,_0x4598cb){return db[_0xd83e('0x2f')][_0xd83e('0x4a')]({'where':{'id':_0x5a3294[_0xd83e('0x55')]['id']}})[_0xd83e('0x25')](handleEntityNotFound(_0x4598cb,null))[_0xd83e('0x25')](removeEntity(_0x4598cb,null))[_0xd83e('0x48')](handleError(_0x4598cb,null));}; \ No newline at end of file +var _0x80a1=['../../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','offset','limit','set','Content-Range','apply','reject','update','then','destroy','Pauses','error','stack','name','send','index','map','Pause','fieldName','type','key','keys','query','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','rows','catch','params','rawAttributes','intersection','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring'];(function(_0x21a706,_0x18ac12){var _0x56dea0=function(_0x6215e0){while(--_0x6215e0){_0x21a706['push'](_0x21a706['shift']());}};_0x56dea0(++_0x18ac12);}(_0x80a1,0x185));var _0x180a=function(_0x122c50,_0x3840b6){_0x122c50=_0x122c50-0x0;var _0x29d7eb=_0x80a1[_0x122c50];return _0x29d7eb;};'use strict';var pdf=require(_0x180a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x180a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x180a('0x2'));var moment=require(_0x180a('0x3'));var BPromise=require(_0x180a('0x4'));var Mustache=require(_0x180a('0x5'));var util=require(_0x180a('0x6'));var path=require(_0x180a('0x7'));var sox=require(_0x180a('0x8'));var csv=require(_0x180a('0x9'));var ejs=require(_0x180a('0xa'));var fs=require('fs');var _=require(_0x180a('0xb'));var squel=require(_0x180a('0xc'));var crypto=require('crypto');var jsforce=require(_0x180a('0xd'));var deskjs=require(_0x180a('0xe'));var toCsv=require(_0x180a('0x9'));var querystring=require(_0x180a('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x180a('0x10'));var qs=require(_0x180a('0x11'));var as=require(_0x180a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x180a('0x13'))(_0x180a('0x14'));var utils=require(_0x180a('0x15'));var config=require(_0x180a('0x16'));var licenseUtil=require(_0x180a('0x17'));var db=require(_0x180a('0x18'))['db'];function respondWithStatusCode(_0x27dd06,_0x3ce231){_0x3ce231=_0x3ce231||0xcc;return function(_0x592b2b){if(_0x592b2b){return _0x27dd06[_0x180a('0x19')](_0x3ce231);}return _0x27dd06[_0x180a('0x1a')](_0x3ce231)[_0x180a('0x1b')]();};}function respondWithResult(_0x2c560a,_0x1b0499){_0x1b0499=_0x1b0499||0xc8;return function(_0x2496b5){if(_0x2496b5){return _0x2c560a[_0x180a('0x1a')](_0x1b0499)[_0x180a('0x1c')](_0x2496b5);}};}function respondWithFilteredResult(_0x3447d9,_0x3f3781){return function(_0x2ef772){if(_0x2ef772){var _0xa7557d=_0x2ef772[_0x180a('0x1d')],_0x18c491=_0x3f3781[_0x180a('0x1e')],_0x4b5d86=_0x3f3781['offset']+_0x3f3781[_0x180a('0x1f')],_0x8464a7;if(_0x4b5d86>=_0xa7557d){_0x4b5d86=_0xa7557d;_0x8464a7=0xc8;}else{_0x8464a7=0xce;}_0x3447d9[_0x180a('0x1a')](_0x8464a7);return _0x3447d9[_0x180a('0x20')](_0x180a('0x21'),_0x18c491+'-'+_0x4b5d86+'/'+_0xa7557d)[_0x180a('0x1c')](_0x2ef772);}return null;};}function patchUpdates(_0xb53e8){return function(_0x56977b){try{jsonpatch[_0x180a('0x22')](_0x56977b,_0xb53e8,!![]);}catch(_0x1f9522){return BPromise[_0x180a('0x23')](_0x1f9522);}return _0x56977b['save']();};}function saveUpdates(_0xe906e8,_0x94fb59){return function(_0x1f2e49){if(_0x1f2e49){return _0x1f2e49[_0x180a('0x24')](_0xe906e8)[_0x180a('0x25')](function(_0x5bbefb){return _0x5bbefb;});}return null;};}function removeEntity(_0xe654b1,_0x12a5ba){return function(_0x10a063){if(_0x10a063){return _0x10a063[_0x180a('0x26')]()[_0x180a('0x25')](function(){var _0x3570ec=_0x10a063['get']({'plain':!![]});var _0x52ffdb=_0x180a('0x27');return db['UserProfileResource'][_0x180a('0x26')]({'where':{'type':_0x52ffdb,'resourceId':_0x3570ec['id']}})[_0x180a('0x25')](function(){return _0x10a063;});})[_0x180a('0x25')](function(){_0xe654b1['status'](0xcc)[_0x180a('0x1b')]();});}};}function handleEntityNotFound(_0x2e7b67,_0x313138){return function(_0x4e27f0){if(!_0x4e27f0){_0x2e7b67[_0x180a('0x19')](0x194);}return _0x4e27f0;};}function handleError(_0x423a62,_0x203baf){_0x203baf=_0x203baf||0x1f4;return function(_0x3f5fc1){logger[_0x180a('0x28')](_0x3f5fc1[_0x180a('0x29')]);if(_0x3f5fc1[_0x180a('0x2a')]){delete _0x3f5fc1['name'];}_0x423a62[_0x180a('0x1a')](_0x203baf)[_0x180a('0x2b')](_0x3f5fc1);};}exports[_0x180a('0x2c')]=function(_0x4de830,_0x265dde){var _0x46c863={},_0x466362={},_0x17a4c6={'count':0x0,'rows':[]};var _0x58367b=_[_0x180a('0x2d')](db[_0x180a('0x2e')]['rawAttributes'],function(_0x3fce7e){return{'name':_0x3fce7e[_0x180a('0x2f')],'type':_0x3fce7e[_0x180a('0x30')][_0x180a('0x31')]};});_0x466362['model']=_[_0x180a('0x2d')](_0x58367b,'name');_0x466362['query']=_[_0x180a('0x32')](_0x4de830[_0x180a('0x33')]);_0x466362[_0x180a('0x34')]=_['intersection'](_0x466362['model'],_0x466362[_0x180a('0x33')]);_0x46c863['attributes']=_['intersection'](_0x466362[_0x180a('0x35')],qs['fields'](_0x4de830[_0x180a('0x33')][_0x180a('0x36')]));_0x46c863[_0x180a('0x37')]=_0x46c863[_0x180a('0x37')]['length']?_0x46c863['attributes']:_0x466362['model'];if(!_0x4de830['query'][_0x180a('0x38')](_0x180a('0x39'))){_0x46c863['limit']=qs[_0x180a('0x1f')](_0x4de830['query'][_0x180a('0x1f')]);_0x46c863[_0x180a('0x1e')]=qs[_0x180a('0x1e')](_0x4de830['query']['offset']);}_0x46c863[_0x180a('0x3a')]=qs[_0x180a('0x3b')](_0x4de830[_0x180a('0x33')][_0x180a('0x3b')]);_0x46c863[_0x180a('0x3c')]=qs[_0x180a('0x34')](_[_0x180a('0x3d')](_0x4de830[_0x180a('0x33')],_0x466362[_0x180a('0x34')]),_0x58367b);if(_0x4de830['query'][_0x180a('0x3e')]){_0x46c863[_0x180a('0x3c')]=_['merge'](_0x46c863[_0x180a('0x3c')],{'$or':_[_0x180a('0x2d')](_0x58367b,function(_0x293729){if(_0x293729['type']!=='VIRTUAL'){var _0x1ce28a={};_0x1ce28a[_0x293729[_0x180a('0x2a')]]={'$like':'%'+_0x4de830['query'][_0x180a('0x3e')]+'%'};return _0x1ce28a;}})});}_0x46c863=_[_0x180a('0x3f')]({},_0x46c863,_0x4de830['options']);var _0x568a3a={'where':_0x46c863['where']};return db['Pause']['count'](_0x568a3a)[_0x180a('0x25')](function(_0x25e244){_0x17a4c6[_0x180a('0x1d')]=_0x25e244;if(_0x4de830['query']['includeAll']){_0x46c863[_0x180a('0x40')]=[{'all':!![]}];}return db[_0x180a('0x2e')]['findAll'](_0x46c863);})[_0x180a('0x25')](function(_0x3047a8){_0x17a4c6[_0x180a('0x41')]=_0x3047a8;return _0x17a4c6;})[_0x180a('0x25')](respondWithFilteredResult(_0x265dde,_0x46c863))[_0x180a('0x42')](handleError(_0x265dde,null));};exports['show']=function(_0x1e23e0,_0x389dd3){var _0x1d8659={'raw':!![],'where':{'id':_0x1e23e0[_0x180a('0x43')]['id']}},_0x4f7704={};_0x4f7704['model']=_['keys'](db['Pause'][_0x180a('0x44')]);_0x4f7704['query']=_[_0x180a('0x32')](_0x1e23e0[_0x180a('0x33')]);_0x4f7704['filters']=_[_0x180a('0x45')](_0x4f7704[_0x180a('0x35')],_0x4f7704[_0x180a('0x33')]);_0x1d8659[_0x180a('0x37')]=_[_0x180a('0x45')](_0x4f7704[_0x180a('0x35')],qs[_0x180a('0x36')](_0x1e23e0[_0x180a('0x33')][_0x180a('0x36')]));_0x1d8659[_0x180a('0x37')]=_0x1d8659['attributes']['length']?_0x1d8659[_0x180a('0x37')]:_0x4f7704[_0x180a('0x35')];if(_0x1e23e0[_0x180a('0x33')][_0x180a('0x46')]){_0x1d8659[_0x180a('0x40')]=[{'all':!![]}];}_0x1d8659=_[_0x180a('0x3f')]({},_0x1d8659,_0x1e23e0['options']);return db[_0x180a('0x2e')][_0x180a('0x47')](_0x1d8659)['then'](handleEntityNotFound(_0x389dd3,null))[_0x180a('0x25')](respondWithResult(_0x389dd3,null))['catch'](handleError(_0x389dd3,null));};exports[_0x180a('0x48')]=function(_0x4c5867,_0x49fd26){return db[_0x180a('0x2e')][_0x180a('0x48')](_0x4c5867[_0x180a('0x49')],{})[_0x180a('0x25')](function(_0x116a20){var _0x26cd1e=_0x4c5867['user']['get']({'plain':!![]});if(!_0x26cd1e)throw new Error(_0x180a('0x4a'));if(_0x26cd1e[_0x180a('0x4b')]===_0x180a('0x4c')){var _0x7a5e47=_0x116a20['get']({'plain':!![]});var _0x4782ff=_0x180a('0x27');return db[_0x180a('0x4d')]['find']({'where':{'name':_0x4782ff,'userProfileId':_0x26cd1e[_0x180a('0x4e')]},'raw':!![]})['then'](function(_0x162e8e){if(_0x162e8e&&_0x162e8e[_0x180a('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x7a5e47[_0x180a('0x2a')],'resourceId':_0x7a5e47['id'],'type':_0x162e8e[_0x180a('0x2a')],'sectionId':_0x162e8e['id']},{})['then'](function(){return _0x116a20;});}else{return _0x116a20;}})[_0x180a('0x42')](function(_0x2a04ca){logger['error'](_0x180a('0x50'),_0x2a04ca);throw _0x2a04ca;});}return _0x116a20;})['then'](respondWithResult(_0x49fd26,0xc9))['catch'](handleError(_0x49fd26,null));};exports[_0x180a('0x24')]=function(_0x580f0d,_0x2518a9){if(_0x580f0d['body']['id']){delete _0x580f0d[_0x180a('0x49')]['id'];}return db[_0x180a('0x2e')][_0x180a('0x47')]({'where':{'id':_0x580f0d[_0x180a('0x43')]['id']}})[_0x180a('0x25')](handleEntityNotFound(_0x2518a9,null))[_0x180a('0x25')](saveUpdates(_0x580f0d['body'],null))[_0x180a('0x25')](respondWithResult(_0x2518a9,null))[_0x180a('0x42')](handleError(_0x2518a9,null));};exports[_0x180a('0x26')]=function(_0x4fb0dc,_0x2479c0){return db['Pause'][_0x180a('0x47')]({'where':{'id':_0x4fb0dc[_0x180a('0x43')]['id']}})[_0x180a('0x25')](handleEntityNotFound(_0x2479c0,null))['then'](removeEntity(_0x2479c0,null))[_0x180a('0x42')](handleError(_0x2479c0,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 2ae0717..9def9db 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 _0x0a6b=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','Pause'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0a6b,0x120));var _0xb0a6=function(_0x1ee0a1,_0x51058e){_0x1ee0a1=_0x1ee0a1-0x0;var _0x1d2d5b=_0x0a6b[_0x1ee0a1];return _0x1d2d5b;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var logger=require(_0xb0a6('0x1'))(_0xb0a6('0x2'));var moment=require(_0xb0a6('0x3'));var BPromise=require(_0xb0a6('0x4'));var rp=require(_0xb0a6('0x5'));var fs=require('fs');var path=require(_0xb0a6('0x6'));var rimraf=require(_0xb0a6('0x7'));var config=require(_0xb0a6('0x8'));var attributes=require(_0xb0a6('0x9'));module[_0xb0a6('0xa')]=function(_0x4b47bc,_0x30b3b7){return _0x4b47bc['define'](_0xb0a6('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4639=['bluebird','request-promise','path','rimraf','../../config/environment','exports','Pause','lodash','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4639,0x115));var _0x9463=function(_0x53a7a8,_0xed2bff){_0x53a7a8=_0x53a7a8-0x0;var _0x555f71=_0x4639[_0x53a7a8];return _0x555f71;};'use strict';var _=require(_0x9463('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9463('0x1'));var moment=require(_0x9463('0x2'));var BPromise=require(_0x9463('0x3'));var rp=require(_0x9463('0x4'));var fs=require('fs');var path=require(_0x9463('0x5'));var rimraf=require(_0x9463('0x6'));var config=require(_0x9463('0x7'));var attributes=require('./pause.attributes');module[_0x9463('0x8')]=function(_0x10d647,_0x493fdc){return _0x10d647['define'](_0x9463('0x9'),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 d6fd5e5..ed2e895 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 _0xc0c5=['error','message','info','result','ShowPause','Pause','find','options','raw','attributes','map','model','include','then','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Pause,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x1fc5c4,_0x308d64){var _0x1aed48=function(_0x5f3573){while(--_0x5f3573){_0x1fc5c4['push'](_0x1fc5c4['shift']());}};_0x1aed48(++_0x308d64);}(_0xc0c5,0x126));var _0x5c0c=function(_0x26a906,_0x3d135c){_0x26a906=_0x26a906-0x0;var _0x495575=_0xc0c5[_0x26a906];return _0x495575;};'use strict';var _=require(_0x5c0c('0x0'));var util=require(_0x5c0c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5c0c('0x2'));var fs=require('fs');var Redis=require(_0x5c0c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5c0c('0x4'));var logger=require(_0x5c0c('0x5'))(_0x5c0c('0x6'));var config=require(_0x5c0c('0x7'));var jayson=require(_0x5c0c('0x8'));var client=jayson[_0x5c0c('0x9')][_0x5c0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeec9ed,_0x1503eb,_0x39f826){return new BPromise(function(_0x2580f8,_0x5d94ca){return client[_0x5c0c('0xb')](_0xeec9ed,_0x39f826)['then'](function(_0x1cc94b){logger['info'](_0x5c0c('0xc'),_0x1503eb,_0x5c0c('0xd'));logger[_0x5c0c('0xe')]('Pause,\x20%s,\x20%s,\x20%s',_0x1503eb,'request\x20sent',JSON[_0x5c0c('0xf')](_0x1cc94b));if(_0x1cc94b['error']){if(_0x1cc94b['error']['code']===0x1f4){logger[_0x5c0c('0x10')](_0x5c0c('0xc'),_0x1503eb,_0x1cc94b['error'][_0x5c0c('0x11')]);return _0x5d94ca(_0x1cc94b[_0x5c0c('0x10')][_0x5c0c('0x11')]);}logger['error']('Pause,\x20%s,\x20%s',_0x1503eb,_0x1cc94b['error']['message']);return _0x2580f8(_0x1cc94b[_0x5c0c('0x10')][_0x5c0c('0x11')]);}else{logger[_0x5c0c('0x12')](_0x5c0c('0xc'),_0x1503eb,'request\x20sent');_0x2580f8(_0x1cc94b[_0x5c0c('0x13')]['message']);}})['catch'](function(_0x4d2429){logger[_0x5c0c('0x10')](_0x5c0c('0xc'),_0x1503eb,_0x4d2429);_0x5d94ca(_0x4d2429);});});}exports[_0x5c0c('0x14')]=function(_0x46fccf){var _0x37f32c=this;return new Promise(function(_0x49fb8e,_0x2cd0d8){return db[_0x5c0c('0x15')][_0x5c0c('0x16')]({'raw':_0x46fccf['options']?_0x46fccf[_0x5c0c('0x17')][_0x5c0c('0x18')]===undefined?!![]:![]:!![],'where':_0x46fccf[_0x5c0c('0x17')]?_0x46fccf[_0x5c0c('0x17')]['where']||null:null,'attributes':_0x46fccf[_0x5c0c('0x17')]?_0x46fccf[_0x5c0c('0x17')][_0x5c0c('0x19')]||null:null,'include':_0x46fccf[_0x5c0c('0x17')]?_0x46fccf[_0x5c0c('0x17')]['include']?_[_0x5c0c('0x1a')](_0x46fccf['options']['include'],function(_0x42fd2d){return{'model':db[_0x42fd2d[_0x5c0c('0x1b')]],'as':_0x42fd2d['as'],'attributes':_0x42fd2d[_0x5c0c('0x19')],'include':_0x42fd2d[_0x5c0c('0x1c')]?_[_0x5c0c('0x1a')](_0x42fd2d[_0x5c0c('0x1c')],function(_0x4f2907){return{'model':db[_0x4f2907[_0x5c0c('0x1b')]],'as':_0x4f2907['as'],'attributes':_0x4f2907[_0x5c0c('0x19')],'include':_0x4f2907[_0x5c0c('0x1c')]?_[_0x5c0c('0x1a')](_0x4f2907[_0x5c0c('0x1c')],function(_0x23b602){return{'model':db[_0x23b602[_0x5c0c('0x1b')]],'as':_0x23b602['as'],'attributes':_0x23b602[_0x5c0c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5c0c('0x1d')](function(_0x5e1d56){logger[_0x5c0c('0x12')](_0x5c0c('0x14'),_0x46fccf);logger['debug']('ShowPause',_0x46fccf,JSON[_0x5c0c('0xf')](_0x5e1d56));_0x49fb8e(_0x5e1d56);})[_0x5c0c('0x1e')](function(_0x1f9dff){logger['error'](_0x5c0c('0x14'),_0x1f9dff[_0x5c0c('0x11')],_0x46fccf);_0x2cd0d8(_0x37f32c[_0x5c0c('0x10')](0x1f4,_0x1f9dff['message']));});});}; \ No newline at end of file +var _0x0447=['ShowPause','Pause','find','options','raw','where','include','map','attributes','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x1b1400,_0x6571c){var _0x559df5=function(_0x5030ea){while(--_0x5030ea){_0x1b1400['push'](_0x1b1400['shift']());}};_0x559df5(++_0x6571c);}(_0x0447,0x133));var _0x7044=function(_0x50068c,_0x38a87a){_0x50068c=_0x50068c-0x0;var _0x11826a=_0x0447[_0x50068c];return _0x11826a;};'use strict';var _=require(_0x7044('0x0'));var util=require(_0x7044('0x1'));var moment=require(_0x7044('0x2'));var BPromise=require(_0x7044('0x3'));var rs=require(_0x7044('0x4'));var fs=require('fs');var Redis=require(_0x7044('0x5'));var db=require(_0x7044('0x6'))['db'];var utils=require(_0x7044('0x7'));var logger=require('../../config/logger')(_0x7044('0x8'));var config=require('../../config/environment');var jayson=require(_0x7044('0x9'));var client=jayson['client'][_0x7044('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x455b73,_0x36343c,_0x337cbe){return new BPromise(function(_0x249d2a,_0xde41c0){return client[_0x7044('0xb')](_0x455b73,_0x337cbe)[_0x7044('0xc')](function(_0x45ef8c){logger[_0x7044('0xd')](_0x7044('0xe'),_0x36343c,_0x7044('0xf'));logger[_0x7044('0x10')](_0x7044('0x11'),_0x36343c,_0x7044('0xf'),JSON[_0x7044('0x12')](_0x45ef8c));if(_0x45ef8c[_0x7044('0x13')]){if(_0x45ef8c['error'][_0x7044('0x14')]===0x1f4){logger[_0x7044('0x13')](_0x7044('0xe'),_0x36343c,_0x45ef8c[_0x7044('0x13')][_0x7044('0x15')]);return _0xde41c0(_0x45ef8c[_0x7044('0x13')][_0x7044('0x15')]);}logger['error'](_0x7044('0xe'),_0x36343c,_0x45ef8c[_0x7044('0x13')][_0x7044('0x15')]);return _0x249d2a(_0x45ef8c['error'][_0x7044('0x15')]);}else{logger[_0x7044('0xd')](_0x7044('0xe'),_0x36343c,_0x7044('0xf'));_0x249d2a(_0x45ef8c['result'][_0x7044('0x15')]);}})[_0x7044('0x16')](function(_0xb41b4d){logger[_0x7044('0x13')](_0x7044('0xe'),_0x36343c,_0xb41b4d);_0xde41c0(_0xb41b4d);});});}exports[_0x7044('0x17')]=function(_0x184893){var _0x462782=this;return new Promise(function(_0x57a9b1,_0x580b00){return db[_0x7044('0x18')][_0x7044('0x19')]({'raw':_0x184893['options']?_0x184893[_0x7044('0x1a')][_0x7044('0x1b')]===undefined?!![]:![]:!![],'where':_0x184893[_0x7044('0x1a')]?_0x184893[_0x7044('0x1a')][_0x7044('0x1c')]||null:null,'attributes':_0x184893[_0x7044('0x1a')]?_0x184893['options']['attributes']||null:null,'include':_0x184893[_0x7044('0x1a')]?_0x184893[_0x7044('0x1a')][_0x7044('0x1d')]?_[_0x7044('0x1e')](_0x184893[_0x7044('0x1a')][_0x7044('0x1d')],function(_0x34188f){return{'model':db[_0x34188f['model']],'as':_0x34188f['as'],'attributes':_0x34188f[_0x7044('0x1f')],'include':_0x34188f[_0x7044('0x1d')]?_['map'](_0x34188f[_0x7044('0x1d')],function(_0x73944c){return{'model':db[_0x73944c[_0x7044('0x20')]],'as':_0x73944c['as'],'attributes':_0x73944c[_0x7044('0x1f')],'include':_0x73944c[_0x7044('0x1d')]?_[_0x7044('0x1e')](_0x73944c[_0x7044('0x1d')],function(_0xd9ac55){return{'model':db[_0xd9ac55[_0x7044('0x20')]],'as':_0xd9ac55['as'],'attributes':_0xd9ac55[_0x7044('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2eb978){logger[_0x7044('0xd')](_0x7044('0x17'),_0x184893);logger['debug'](_0x7044('0x17'),_0x184893,JSON[_0x7044('0x12')](_0x2eb978));_0x57a9b1(_0x2eb978);})[_0x7044('0x16')](function(_0x4404dd){logger[_0x7044('0x13')](_0x7044('0x17'),_0x4404dd[_0x7044('0x15')],_0x184893);_0x580b00(_0x462782['error'](0x1f4,_0x4404dd[_0x7044('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 3c39331..b47bb1c 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 _0xd7f2=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','upload','webhookPost','delete'];(function(_0x477c0c,_0x48b400){var _0x37d540=function(_0x2d95e2){while(--_0x2d95e2){_0x477c0c['push'](_0x477c0c['shift']());}};_0x37d540(++_0x48b400);}(_0xd7f2,0x89));var _0x2d7f=function(_0xe1b529,_0x434826){_0xe1b529=_0xe1b529-0x0;var _0x4f550c=_0xd7f2[_0xe1b529];return _0x4f550c;};'use strict';var multer=require(_0x2d7f('0x0'));var util=require(_0x2d7f('0x1'));var path=require(_0x2d7f('0x2'));var timeout=require(_0x2d7f('0x3'));var express=require(_0x2d7f('0x4'));var router=express['Router']();var auth=require(_0x2d7f('0x5'));var interaction=require(_0x2d7f('0x6'));var config=require('../../config/environment');var controller=require(_0x2d7f('0x7'));router[_0x2d7f('0x8')]('/',auth[_0x2d7f('0x9')](),controller[_0x2d7f('0xa')]);router[_0x2d7f('0x8')](_0x2d7f('0xb'),controller[_0x2d7f('0xc')]);router[_0x2d7f('0x8')](_0x2d7f('0xd'),auth[_0x2d7f('0x9')](),controller[_0x2d7f('0xe')]);router['get'](_0x2d7f('0xf'),auth[_0x2d7f('0x9')](),controller[_0x2d7f('0x10')]);var upload=multer({'storage':multer[_0x2d7f('0x11')]({'destination':function(_0x14f9bb,_0x20b4ef,_0x309edf){_0x309edf(null,path[_0x2d7f('0x12')](config[_0x2d7f('0x13')],_0x2d7f('0x14')));},'filename':function(_0x3ff7ce,_0x83e9ee,_0x3d722a){_0x83e9ee[_0x2d7f('0x15')]=_0x83e9ee['originalname'][_0x2d7f('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3d722a(null,util[_0x2d7f('0x17')](_0x2d7f('0x18'),path[_0x2d7f('0x19')](_0x83e9ee[_0x2d7f('0x15')],path[_0x2d7f('0x1a')](_0x83e9ee[_0x2d7f('0x15')])),Date[_0x2d7f('0x1b')](),path[_0x2d7f('0x1a')](_0x83e9ee[_0x2d7f('0x15')])));}})});router[_0x2d7f('0x1c')]('/',upload[_0x2d7f('0x1d')]('file'),controller[_0x2d7f('0x1e')]);router[_0x2d7f('0x1c')](_0x2d7f('0xb'),controller[_0x2d7f('0x1f')]);router['put'](_0x2d7f('0xd'),auth[_0x2d7f('0x9')](),controller['update']);router[_0x2d7f('0x20')](_0x2d7f('0xd'),auth[_0x2d7f('0x9')](),controller['delete']);module[_0x2d7f('0x21')]=router; \ No newline at end of file +var _0xa10f=['%s-%s%s','extname','now','post','single','upload','webhookPost','put','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','root','originalname','replace'];(function(_0x5bd3f5,_0x4ec7cb){var _0x5eea77=function(_0x141d78){while(--_0x141d78){_0x5bd3f5['push'](_0x5bd3f5['shift']());}};_0x5eea77(++_0x4ec7cb);}(_0xa10f,0x78));var _0xfa10=function(_0x1faa4f,_0x2989bb){_0x1faa4f=_0x1faa4f-0x0;var _0xe6822b=_0xa10f[_0x1faa4f];return _0xe6822b;};'use strict';var multer=require(_0xfa10('0x0'));var util=require(_0xfa10('0x1'));var path=require(_0xfa10('0x2'));var timeout=require('connect-timeout');var express=require(_0xfa10('0x3'));var router=express[_0xfa10('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xfa10('0x5'));var config=require(_0xfa10('0x6'));var controller=require('./plugin.controller');router[_0xfa10('0x7')]('/',auth[_0xfa10('0x8')](),controller[_0xfa10('0x9')]);router[_0xfa10('0x7')](_0xfa10('0xa'),controller[_0xfa10('0xb')]);router[_0xfa10('0x7')](_0xfa10('0xc'),auth[_0xfa10('0x8')](),controller[_0xfa10('0xd')]);router[_0xfa10('0x7')](_0xfa10('0xe'),auth[_0xfa10('0x8')](),controller[_0xfa10('0xf')]);var upload=multer({'storage':multer[_0xfa10('0x10')]({'destination':function(_0x12c4d2,_0x4936df,_0x29a655){_0x29a655(null,path['join'](config[_0xfa10('0x11')],'server/files/plugins'));},'filename':function(_0x8b688c,_0x3296e3,_0x4de4c3){_0x3296e3[_0xfa10('0x12')]=_0x3296e3[_0xfa10('0x12')][_0xfa10('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4de4c3(null,util['format'](_0xfa10('0x14'),path['basename'](_0x3296e3['originalname'],path[_0xfa10('0x15')](_0x3296e3[_0xfa10('0x12')])),Date[_0xfa10('0x16')](),path['extname'](_0x3296e3[_0xfa10('0x12')])));}})});router[_0xfa10('0x17')]('/',upload[_0xfa10('0x18')]('file'),controller[_0xfa10('0x19')]);router[_0xfa10('0x17')](_0xfa10('0xa'),controller[_0xfa10('0x1a')]);router[_0xfa10('0x1b')](_0xfa10('0xc'),auth[_0xfa10('0x8')](),controller['update']);router['delete'](_0xfa10('0xc'),auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 1a6dfab..7cb5cd9 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 _0xb85f=['ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING'];(function(_0x257037,_0x5cdce0){var _0x4d871e=function(_0xdcb8ff){while(--_0xdcb8ff){_0x257037['push'](_0x257037['shift']());}};_0x4d871e(++_0x5cdce0);}(_0xb85f,0x176));var _0xfb85=function(_0xc2334d,_0x4c9393){_0xc2334d=_0xc2334d-0x0;var _0xbb7b65=_0xb85f[_0xc2334d];return _0xbb7b65;};'use strict';var Sequelize=require(_0xfb85('0x0'));module[_0xfb85('0x1')]={'name':{'type':Sequelize[_0xfb85('0x2')]},'type':{'type':Sequelize[_0xfb85('0x3')](_0xfb85('0x4'),'script')},'description':{'type':Sequelize[_0xfb85('0x5')]},'version':{'type':Sequelize[_0xfb85('0x5')]},'path':{'type':Sequelize[_0xfb85('0x2')],'comment':_0xfb85('0x6')},'active':{'type':Sequelize[_0xfb85('0x7')],'defaultValue':0x0,'comment':_0xfb85('0x8')},'sidebar':{'type':Sequelize[_0xfb85('0x3')](_0xfb85('0x9'),'agentOnly',_0xfb85('0xa'),_0xfb85('0xb')),'defaultValue':_0xfb85('0xa'),'comment':_0xfb85('0xc')},'icon':{'type':Sequelize[_0xfb85('0x2')]},'adminUrl':{'type':Sequelize[_0xfb85('0x2')]},'agentUrl':{'type':Sequelize[_0xfb85('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x411c=['never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly'];(function(_0xab7f37,_0x30c537){var _0x276282=function(_0x3f9adf){while(--_0x3f9adf){_0xab7f37['push'](_0xab7f37['shift']());}};_0x276282(++_0x30c537);}(_0x411c,0x1ca));var _0xc411=function(_0x276b9f,_0x2c2164){_0x276b9f=_0x276b9f-0x0;var _0x15acc5=_0x411c[_0x276b9f];return _0x15acc5;};'use strict';var Sequelize=require(_0xc411('0x0'));module['exports']={'name':{'type':Sequelize[_0xc411('0x1')]},'type':{'type':Sequelize[_0xc411('0x2')](_0xc411('0x3'),_0xc411('0x4'))},'description':{'type':Sequelize[_0xc411('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xc411('0x1')],'comment':_0xc411('0x6')},'active':{'type':Sequelize[_0xc411('0x7')],'defaultValue':0x0,'comment':_0xc411('0x8')},'sidebar':{'type':Sequelize[_0xc411('0x2')]('adminOnly',_0xc411('0x9'),'always',_0xc411('0xa')),'defaultValue':_0xc411('0xb'),'comment':_0xc411('0xc')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xc411('0x1')]},'agentUrl':{'type':Sequelize[_0xc411('0x1')]},'scriptName':{'type':Sequelize[_0xc411('0x1')]},'scriptPath':{'type':Sequelize[_0xc411('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 9b25fbc..188fe2a 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 _0x5ef3=['find','catch','download','join','root','server/files/plugins','basename','createWriteStream','zip','warning','ENOENT','Sequelize','Error','pipe','**/*','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','readdirSync','length','Invalid\x20plugin\x20structure','lstatSync','isFile','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','undefined','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','agent','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','script','scriptName','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','json','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','count','offset','set','apply','save','update','destroy','Plugins','UserProfileResource','then','end','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll'];(function(_0x4e6c3e,_0x3988a9){var _0xd94c31=function(_0x4f2962){while(--_0x4f2962){_0x4e6c3e['push'](_0x4e6c3e['shift']());}};_0xd94c31(++_0x3988a9);}(_0x5ef3,0x10c));var _0x35ef=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x5ef3[_0x486f4a];return _0x135d99;};'use strict';var pdf=require(_0x35ef('0x0'));var emlformat=require(_0x35ef('0x1'));var rimraf=require(_0x35ef('0x2'));var zipdir=require(_0x35ef('0x3'));var jsonpatch=require(_0x35ef('0x4'));var rp=require(_0x35ef('0x5'));var moment=require(_0x35ef('0x6'));var BPromise=require(_0x35ef('0x7'));var Mustache=require(_0x35ef('0x8'));var util=require(_0x35ef('0x9'));var path=require(_0x35ef('0xa'));var sox=require(_0x35ef('0xb'));var csv=require(_0x35ef('0xc'));var ejs=require(_0x35ef('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x35ef('0xe'));var crypto=require(_0x35ef('0xf'));var jsforce=require(_0x35ef('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x35ef('0xc'));var querystring=require('querystring');var Papa=require(_0x35ef('0x11'));var extract=require(_0x35ef('0x12'));var rimraf=require('rimraf');var archiver=require(_0x35ef('0x13'));var Redis=require(_0x35ef('0x14'));var authService=require(_0x35ef('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x35ef('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35ef('0x17'))(_0x35ef('0x18'));var utils=require(_0x35ef('0x19'));var config=require(_0x35ef('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x35ef('0x1b')]=_[_0x35ef('0x1c')](config[_0x35ef('0x1b')],{'host':_0x35ef('0x1d'),'port':0x18eb});var socket=require(_0x35ef('0x1e'))(new Redis(config['redis']));require('./plugin.socket')[_0x35ef('0x1f')](socket);function respondWithStatusCode(_0x394f74,_0x575808){_0x575808=_0x575808||0xcc;return function(_0x1640d2){if(_0x1640d2){return _0x394f74[_0x35ef('0x20')](_0x575808);}return _0x394f74[_0x35ef('0x21')](_0x575808)['end']();};}function respondWithResult(_0xe794aa,_0x1244af){_0x1244af=_0x1244af||0xc8;return function(_0x47205d){if(_0x47205d){return _0xe794aa[_0x35ef('0x21')](_0x1244af)['json'](_0x47205d);}};}function respondWithFilteredResult(_0x2605df,_0x40b41f){return function(_0x4b2829){if(_0x4b2829){var _0x3535c7=_0x4b2829[_0x35ef('0x22')],_0x4c6cd1=_0x40b41f[_0x35ef('0x23')],_0x554ca2=_0x40b41f[_0x35ef('0x23')]+_0x40b41f['limit'],_0xd6e0ab;if(_0x554ca2>=_0x3535c7){_0x554ca2=_0x3535c7;_0xd6e0ab=0xc8;}else{_0xd6e0ab=0xce;}_0x2605df['status'](_0xd6e0ab);return _0x2605df[_0x35ef('0x24')]('Content-Range',_0x4c6cd1+'-'+_0x554ca2+'/'+_0x3535c7)['json'](_0x4b2829);}return null;};}function patchUpdates(_0x5167a2){return function(_0x5352b4){try{jsonpatch[_0x35ef('0x25')](_0x5352b4,_0x5167a2,!![]);}catch(_0x4a6583){return BPromise['reject'](_0x4a6583);}return _0x5352b4[_0x35ef('0x26')]();};}function saveUpdates(_0x4a020d,_0x3aa0e7){return function(_0x2ad727){if(_0x2ad727){return _0x2ad727[_0x35ef('0x27')](_0x4a020d)['then'](function(_0x4cc2f0){return _0x4cc2f0;});}return null;};}function removeEntity(_0x44ff19,_0x42ab88){return function(_0x243679){if(_0x243679){return _0x243679[_0x35ef('0x28')]()['then'](function(){var _0x47cf30=_0x243679['get']({'plain':!![]});var _0x25df26=_0x35ef('0x29');return db[_0x35ef('0x2a')]['destroy']({'where':{'type':_0x25df26,'resourceId':_0x47cf30['id']}})['then'](function(){return _0x243679;});})[_0x35ef('0x2b')](function(){_0x44ff19[_0x35ef('0x21')](0xcc)[_0x35ef('0x2c')]();});}};}function handleEntityNotFound(_0x4dee48,_0x4a5e3f){return function(_0x4db1a0){if(!_0x4db1a0){_0x4dee48['sendStatus'](0x194);}return _0x4db1a0;};}function handleError(_0x3bfe55,_0x218d8e){_0x218d8e=_0x218d8e||0x1f4;return function(_0x521e7a){logger[_0x35ef('0x2d')](_0x521e7a[_0x35ef('0x2e')]);if(_0x521e7a['name']){delete _0x521e7a[_0x35ef('0x2f')];}_0x3bfe55[_0x35ef('0x21')](_0x218d8e)[_0x35ef('0x30')](_0x521e7a);};}exports[_0x35ef('0x31')]=function(_0x2f9f02,_0x3398b4){var _0x19026b={},_0x256a88={},_0x1dc3fb={'count':0x0,'rows':[]};var _0x52a2af=_[_0x35ef('0x32')](db[_0x35ef('0x33')][_0x35ef('0x34')],function(_0x1ff7f4){return{'name':_0x1ff7f4[_0x35ef('0x35')],'type':_0x1ff7f4[_0x35ef('0x36')][_0x35ef('0x37')]};});_0x256a88['model']=_['map'](_0x52a2af,'name');_0x256a88[_0x35ef('0x38')]=_[_0x35ef('0x39')](_0x2f9f02[_0x35ef('0x38')]);_0x256a88['filters']=_[_0x35ef('0x3a')](_0x256a88[_0x35ef('0x3b')],_0x256a88[_0x35ef('0x38')]);_0x19026b[_0x35ef('0x3c')]=_[_0x35ef('0x3a')](_0x256a88[_0x35ef('0x3b')],qs[_0x35ef('0x3d')](_0x2f9f02[_0x35ef('0x38')][_0x35ef('0x3d')]));_0x19026b[_0x35ef('0x3c')]=_0x19026b[_0x35ef('0x3c')]['length']?_0x19026b['attributes']:_0x256a88[_0x35ef('0x3b')];if(!_0x2f9f02[_0x35ef('0x38')]['hasOwnProperty']('nolimit')){_0x19026b[_0x35ef('0x3e')]=qs[_0x35ef('0x3e')](_0x2f9f02[_0x35ef('0x38')][_0x35ef('0x3e')]);_0x19026b[_0x35ef('0x23')]=qs['offset'](_0x2f9f02[_0x35ef('0x38')][_0x35ef('0x23')]);}_0x19026b[_0x35ef('0x3f')]=qs[_0x35ef('0x40')](_0x2f9f02['query']['sort']);_0x19026b[_0x35ef('0x41')]=qs[_0x35ef('0x42')](_[_0x35ef('0x43')](_0x2f9f02[_0x35ef('0x38')],_0x256a88[_0x35ef('0x42')]),_0x52a2af);if(_0x2f9f02[_0x35ef('0x38')][_0x35ef('0x44')]){_0x19026b[_0x35ef('0x41')]=_[_0x35ef('0x45')](_0x19026b['where'],{'$or':_[_0x35ef('0x32')](_0x52a2af,function(_0x3b9ac2){if(_0x3b9ac2[_0x35ef('0x36')]!==_0x35ef('0x46')){var _0x2d2dbb={};_0x2d2dbb[_0x3b9ac2[_0x35ef('0x2f')]]={'$like':'%'+_0x2f9f02[_0x35ef('0x38')][_0x35ef('0x44')]+'%'};return _0x2d2dbb;}})});}_0x19026b=_[_0x35ef('0x45')]({},_0x19026b,_0x2f9f02[_0x35ef('0x47')]);var _0x10aeab={'where':_0x19026b[_0x35ef('0x41')]};return db['Plugin'][_0x35ef('0x22')](_0x10aeab)[_0x35ef('0x2b')](function(_0x1f2e7a){_0x1dc3fb[_0x35ef('0x22')]=_0x1f2e7a;if(_0x2f9f02[_0x35ef('0x38')]['includeAll']){_0x19026b[_0x35ef('0x48')]=[{'all':!![]}];}return db[_0x35ef('0x33')][_0x35ef('0x49')](_0x19026b);})[_0x35ef('0x2b')](function(_0x1d1d8d){_0x1dc3fb[_0x35ef('0x4a')]=_0x1d1d8d;return _0x1dc3fb;})[_0x35ef('0x2b')](respondWithFilteredResult(_0x3398b4,_0x19026b))['catch'](handleError(_0x3398b4,null));};exports[_0x35ef('0x4b')]=function(_0x5161b7,_0x509ddc){var _0x29c601={'raw':!![],'where':{'id':_0x5161b7[_0x35ef('0x4c')]['id']}},_0x26bba8={};_0x26bba8['model']=_[_0x35ef('0x39')](db['Plugin'][_0x35ef('0x34')]);_0x26bba8[_0x35ef('0x38')]=_['keys'](_0x5161b7[_0x35ef('0x38')]);_0x26bba8[_0x35ef('0x42')]=_[_0x35ef('0x3a')](_0x26bba8[_0x35ef('0x3b')],_0x26bba8[_0x35ef('0x38')]);_0x29c601['attributes']=_[_0x35ef('0x3a')](_0x26bba8[_0x35ef('0x3b')],qs[_0x35ef('0x3d')](_0x5161b7[_0x35ef('0x38')][_0x35ef('0x3d')]));_0x29c601[_0x35ef('0x3c')]=_0x29c601['attributes']['length']?_0x29c601[_0x35ef('0x3c')]:_0x26bba8['model'];if(_0x5161b7[_0x35ef('0x38')][_0x35ef('0x4d')]){_0x29c601[_0x35ef('0x48')]=[{'all':!![]}];}_0x29c601=_[_0x35ef('0x45')]({},_0x29c601,_0x5161b7['options']);return db[_0x35ef('0x33')][_0x35ef('0x4e')](_0x29c601)[_0x35ef('0x2b')](handleEntityNotFound(_0x509ddc,null))[_0x35ef('0x2b')](respondWithResult(_0x509ddc,null))[_0x35ef('0x4f')](handleError(_0x509ddc,null));};exports[_0x35ef('0x50')]=function(_0x264e57,_0x46791a,_0xc8c47a){return db[_0x35ef('0x33')][_0x35ef('0x4e')]({'where':{'id':_0x264e57[_0x35ef('0x4c')]['id']},'attributes':[_0x35ef('0x2f'),_0x35ef('0xa')],'raw':!![]})['then'](handleEntityNotFound(_0x46791a,null))['then'](function(_0x44f332){if(_0x44f332){var _0x45cf43=path[_0x35ef('0x51')](config[_0x35ef('0x52')],_0x35ef('0x53'),util['format']('%s.zip',path[_0x35ef('0x54')](_0x44f332[_0x35ef('0xa')])));var _0x1ef305=fs[_0x35ef('0x55')](_0x45cf43);var _0x59631c=archiver(_0x35ef('0x56'),{'zlib':{'level':0x9}});_0x59631c['on'](_0x35ef('0x57'),function(_0x485e75){if(_0x485e75['code']===_0x35ef('0x58')){logger[_0x35ef('0x2d')](_0x485e75);}else{throw new db[(_0x35ef('0x59'))][(_0x35ef('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x59631c['on'](_0x35ef('0x2d'),function(_0x4bc2fd){throw new db[(_0x35ef('0x59'))][(_0x35ef('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x59631c[_0x35ef('0x5b')](_0x1ef305);_0x59631c['glob'](_0x35ef('0x5c'),{'cwd':path[_0x35ef('0x51')](config[_0x35ef('0x52')],_0x35ef('0x53'),path['dirname'](_0x44f332[_0x35ef('0xa')])),'ignore':[path[_0x35ef('0x51')](path[_0x35ef('0x54')](_0x44f332['path']),_0x35ef('0x5d')),path[_0x35ef('0x51')](path[_0x35ef('0x54')](_0x44f332[_0x35ef('0xa')]),_0x35ef('0x5e'))],'nodir':!![]})[_0x35ef('0x5f')]();_0x1ef305['on'](_0x35ef('0x60'),function(){if(!fs['existsSync'](_0x45cf43)){throw new db[(_0x35ef('0x59'))][(_0x35ef('0x5a'))](_0x35ef('0x61'));}return _0x46791a['download'](_0x45cf43,util[_0x35ef('0x62')]('%s.zip',path[_0x35ef('0x54')](_0x44f332['path'])),function(_0x2d3f3d){if(_0x2d3f3d){throw new db[(_0x35ef('0x59'))][(_0x35ef('0x5a'))](_0x35ef('0x63'));}fs['unlinkSync'](_0x45cf43);logger[_0x35ef('0x64')](_0x35ef('0x65'));logger[_0x35ef('0x64')](_0x35ef('0x66'));});});}return null;})[_0x35ef('0x4f')](handleError(_0x46791a,null));};exports['upload']=function(_0x4c4052,_0x5e905f,_0x2a63d9){var _0x1eb16f=path[_0x35ef('0x54')](_0x4c4052[_0x35ef('0x67')][_0x35ef('0x68')],path[_0x35ef('0x69')](_0x4c4052[_0x35ef('0x67')][_0x35ef('0x68')]));var _0x36e2ff=path[_0x35ef('0x51')](config[_0x35ef('0x52')],_0x35ef('0x53'),_0x4c4052[_0x35ef('0x67')]['filename']);var _0x57c6ea=path[_0x35ef('0x51')](config[_0x35ef('0x52')],_0x35ef('0x53'),_0x1eb16f);logger[_0x35ef('0x64')](_0x35ef('0x6a'),_0x36e2ff);logger[_0x35ef('0x64')](_0x35ef('0x6b'),_0x57c6ea);try{fs['chmodSync'](_0x36e2ff,parseInt('0777',0x8));extract(_0x36e2ff,{'dir':_0x57c6ea},function(_0x3a6b52){if(_0x3a6b52){logger[_0x35ef('0x2d')](_0x3a6b52);handleError(_0x3a6b52,!![]);};var _0x12c461=fs[_0x35ef('0x6c')](_0x57c6ea);if(_0x12c461[_0x35ef('0x6d')]>0x1){removeReferences(_0x36e2ff,_0x57c6ea);logger['error'](_0x35ef('0x6e'));return _0x2a63d9(new Error('Invalid\x20plugin\x20structure'));}var _0x4385f2=fs[_0x35ef('0x6f')](path['join'](_0x57c6ea,_0x12c461[0x0]));if(_0x4385f2[_0x35ef('0x70')]()){removeReferences(_0x36e2ff,_0x57c6ea);logger[_0x35ef('0x2d')](_0x35ef('0x6e'));return _0x2a63d9(new Error(_0x35ef('0x6e')));}if(_0x4385f2['isDirectory']()){var _0x100007=fs[_0x35ef('0x6c')](path[_0x35ef('0x51')](_0x57c6ea,_0x12c461[0x0]));if(_0x100007[_0x35ef('0x6d')]===0x0){removeReferences(_0x36e2ff,_0x57c6ea);logger[_0x35ef('0x2d')](_0x35ef('0x6e'));return _0x2a63d9(new Error(_0x35ef('0x6e')));}var _0x49cc7e=_0x100007['some'](function(_0x7ea5e2){return _0x7ea5e2===_0x35ef('0x71');});if(!_0x49cc7e){return _0x2a63d9(new Error(_0x35ef('0x72')));}var _0x36f672=fs[_0x35ef('0x73')](path['join'](_0x57c6ea,_0x12c461[0x0],_0x35ef('0x71')));var _0x55acfe=JSON['parse'](_0x36f672);if('undefined'==typeof _0x55acfe[_0x35ef('0x2f')]){return _0x2a63d9(new Error(_0x35ef('0x74')));}if('undefined'==typeof _0x55acfe[_0x35ef('0x36')]){return _0x2a63d9(new Error(_0x35ef('0x75')));}if(_0x35ef('0x76')==typeof _0x55acfe[_0x35ef('0x77')]){return _0x2a63d9(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x35ef('0x76')==typeof _0x55acfe[_0x35ef('0x78')]){return _0x2a63d9(new Error(_0x35ef('0x79')));}if(_0x55acfe[_0x35ef('0x36')]===_0x35ef('0x7a')){if('undefined'==typeof _0x55acfe[_0x35ef('0x78')]['views']){return _0x2a63d9(new Error(_0x35ef('0x7b')));}if(_0x35ef('0x76')==typeof _0x55acfe[_0x35ef('0x78')][_0x35ef('0x7c')]['admin']&&_0x35ef('0x76')==typeof _0x55acfe[_0x35ef('0x78')][_0x35ef('0x7c')][_0x35ef('0x7d')]){return _0x2a63d9(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x55acfe[_0x35ef('0x36')]==='script'){if(_0x35ef('0x76')==typeof _0x55acfe[_0x35ef('0x78')]['scriptName']){return _0x2a63d9(new Error(_0x35ef('0x7e')));}if(_0x35ef('0x76')==typeof _0x55acfe[_0x35ef('0x78')][_0x35ef('0x7f')]){return _0x2a63d9(new Error(_0x35ef('0x80')));}}else{return _0x2a63d9(new Error(_0x35ef('0x81')));}var _0x2190bf=_0x55acfe[_0x35ef('0x2f')];var _0x4219c5=_0x55acfe[_0x35ef('0x82')];var _0x367841=_0x55acfe[_0x35ef('0x36')];var _0x2c2559=_0x55acfe[_0x35ef('0x83')]?_0x55acfe[_0x35ef('0x83')]:_0x35ef('0x84');var _0x39b120=_0x55acfe[_0x35ef('0x85')]?_0x55acfe[_0x35ef('0x85')]:_0x35ef('0x86');var _0x2a38e8='';var _0x1ba453='';var _0x111453='';var _0x512c37='';var _0x100851=_0x55acfe[_0x35ef('0x77')];if(_0x367841===_0x35ef('0x7a')){if(_0x35ef('0x76')!=typeof _0x55acfe['parameters'][_0x35ef('0x7c')][_0x35ef('0x87')]){var _0x5cad38=_0x55acfe[_0x35ef('0x78')][_0x35ef('0x7c')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x35ef('0x88')](_0x5cad38)){_0x2a38e8=path[_0x35ef('0x51')]('plugins',_0x1eb16f,_0x12c461[0x0],_0x5cad38);}else{_0x2a38e8=_0x5cad38;}}else{logger[_0x35ef('0x64')](_0x35ef('0x89'));}if(_0x35ef('0x76')!=typeof _0x55acfe[_0x35ef('0x78')][_0x35ef('0x7c')][_0x35ef('0x7d')]){var _0xe492be=_0x55acfe[_0x35ef('0x78')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x35ef('0x88')](_0xe492be)){_0x1ba453=path[_0x35ef('0x51')](_0x35ef('0x8a'),_0x1eb16f,_0x12c461[0x0],_0xe492be);}else{_0x1ba453=_0xe492be;}}else{logger['info'](_0x35ef('0x8b'));}}else if(_0x367841===_0x35ef('0x8c')){_0x111453=_0x55acfe[_0x35ef('0x78')][_0x35ef('0x8d')];_0x512c37=_0x55acfe[_0x35ef('0x78')]['scriptPath'];if('undefined'!=typeof _0x55acfe[_0x35ef('0x78')]['views']){if(_0x35ef('0x76')!=typeof _0x55acfe['parameters'][_0x35ef('0x7c')][_0x35ef('0x87')]){var _0x5cad38=_0x55acfe[_0x35ef('0x78')][_0x35ef('0x7c')][_0x35ef('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x35ef('0x88')](_0x5cad38)){_0x2a38e8=path[_0x35ef('0x51')](_0x35ef('0x8a'),_0x1eb16f,_0x12c461[0x0],_0x5cad38);}else{_0x2a38e8=_0x5cad38;}}if(_0x35ef('0x76')!=typeof _0x55acfe[_0x35ef('0x78')][_0x35ef('0x7c')][_0x35ef('0x7d')]){var _0xe492be=_0x55acfe[_0x35ef('0x78')]['views'][_0x35ef('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x35ef('0x88')](_0xe492be)){_0x1ba453=path[_0x35ef('0x51')](_0x35ef('0x8a'),_0x1eb16f,_0x12c461[0x0],_0xe492be);}else{_0x1ba453=_0xe492be;}}}}var _0x37c8ac={'name':_0x2190bf,'description':_0x4219c5,'path':path[_0x35ef('0x51')](_0x1eb16f,_0x12c461[0x0]),'type':_0x367841,'sidebar':_0x2c2559,'icon':_0x39b120,'adminUrl':_0x2a38e8,'agentUrl':_0x1ba453,'scriptName':_0x111453,'scriptPath':_0x512c37,'version':_0x100851};removeReferences(_0x36e2ff,null);return db[_0x35ef('0x33')][_0x35ef('0x8e')](_0x37c8ac)['then'](function(_0x568617){var _0x3bd2bb={'role':_0x4c4052[_0x35ef('0x8f')][_0x35ef('0x90')],'userProfileId':_0x4c4052[_0x35ef('0x8f')][_0x35ef('0x91')]};if(!_0x3bd2bb)throw new Error(_0x35ef('0x92'));if(_0x3bd2bb[_0x35ef('0x90')]===_0x35ef('0x93')){var _0x3ed9cc=_0x568617[_0x35ef('0x94')]({'plain':!![]});return db[_0x35ef('0x95')][_0x35ef('0x4e')]({'where':{'name':_0x35ef('0x29'),'userProfileId':_0x3bd2bb[_0x35ef('0x91')]},'raw':!![]})['then'](function(_0x5a129e){if(_0x5a129e&&_0x5a129e[_0x35ef('0x96')]===0x0){return db['UserProfileResource'][_0x35ef('0x8e')]({'name':_0x3ed9cc[_0x35ef('0x2f')],'resourceId':_0x3ed9cc['id'],'type':_0x5a129e['name'],'sectionId':_0x5a129e['id']},{})[_0x35ef('0x2b')](function(){return _0x568617;});}else{return _0x568617;}})[_0x35ef('0x4f')](function(_0x231ac2){logger['error'](_0x35ef('0x97'),_0x231ac2);throw _0x231ac2;});}return _0x568617;})[_0x35ef('0x2b')](respondWithResult(_0x5e905f,null))['catch'](handleError(_0x5e905f,null));}});}catch(_0x208bec){_0x5e905f[_0x35ef('0x21')](0x1f4)[_0x35ef('0x30')](_0x208bec);}};function removeReferences(_0x15d34e,_0x37aab7){try{if(_0x15d34e){fs[_0x35ef('0x98')](_0x15d34e);logger[_0x35ef('0x64')](_0x35ef('0x99'));}if(_0x37aab7){rimraf(_0x37aab7,function(){});logger[_0x35ef('0x64')](_0x35ef('0x9a'));}}catch(_0x3bae58){logger[_0x35ef('0x2d')](_0x3bae58);}}exports[_0x35ef('0x27')]=function(_0x1b352c,_0x3aab76,_0x330219){return db['Plugin']['find']({'where':{'id':_0x1b352c['params']['id']}})[_0x35ef('0x2b')](handleEntityNotFound(_0x3aab76,null))[_0x35ef('0x2b')](saveUpdates(_0x1b352c[_0x35ef('0x8f')],null))[_0x35ef('0x2b')](respondWithResult(_0x3aab76,null))[_0x35ef('0x4f')](handleError(_0x3aab76,null));};exports[_0x35ef('0x9b')]=function(_0x38a2f8,_0x51e769,_0x2335c3){return db[_0x35ef('0x33')][_0x35ef('0x4e')]({'where':{'id':_0x38a2f8['params']['id']}})[_0x35ef('0x2b')](function(_0x285250){if(_0x285250){return _0x285250[_0x35ef('0x28')]();}})[_0x35ef('0x2b')](function(_0x567a75){rimraf(path[_0x35ef('0x51')](config[_0x35ef('0x52')],_0x35ef('0x53'),path[_0x35ef('0x9c')](_0x567a75[_0x35ef('0xa')])),function(){});return _0x567a75;})[_0x35ef('0x2b')](handleEntityNotFound(_0x51e769,null))['then'](respondWithStatusCode(_0x51e769,null))['catch'](handleError(_0x51e769,null));};exports[_0x35ef('0x9d')]=function(_0x501c6b,_0x41c311,_0x5e7c13){return BPromise[_0x35ef('0x9e')]()[_0x35ef('0x2b')](function(){if(!_0x501c6b['query'][_0x35ef('0xa')]){throw new Error(_0x35ef('0x9f'));}if(!_0x501c6b['query'][_0x35ef('0xa0')]){throw new Error(_0x35ef('0xa1'));}var _0x43b9d9=_0x501c6b[_0x35ef('0x38')][_0x35ef('0xa2')]?_0x501c6b[_0x35ef('0x38')][_0x35ef('0xa2')]+':'+_0x501c6b[_0x35ef('0x38')][_0x35ef('0xa0')]:_0x35ef('0xa3')+_0x501c6b[_0x35ef('0x38')][_0x35ef('0xa0')];var _0x132aa9=_0x501c6b[_0x35ef('0x38')]['json']?_0x501c6b['query'][_0x35ef('0xa4')]:!![];var _0x563ff2=_0x501c6b['query'][_0x35ef('0xa5')]?_0x501c6b[_0x35ef('0x38')][_0x35ef('0xa5')]:null;var _0x4946ec={'method':_0x501c6b[_0x35ef('0xa6')],'uri':util[_0x35ef('0x62')](_0x35ef('0xa7'),_0x43b9d9,_0x501c6b[_0x35ef('0x38')][_0x35ef('0xa')]),'json':_0x132aa9,'resolveWithFullResponse':!![],'encoding':_0x563ff2,'qs':_0x501c6b[_0x35ef('0x38')]};if(_0x501c6b[_0x35ef('0xa8')]){_0x4946ec[_0x35ef('0xa8')]=_0x501c6b[_0x35ef('0xa8')];if(_0x4946ec[_0x35ef('0xa8')][_0x35ef('0xa9')]){delete _0x4946ec[_0x35ef('0xa8')]['content-length'];}}if(_0x4946ec[_0x35ef('0xa8')][_0x35ef('0xaa')]){delete _0x4946ec[_0x35ef('0xa8')][_0x35ef('0xaa')];}return rp(_0x4946ec);})['then'](function(_0x277d9f){if(_0x277d9f){_0x41c311['set'](_0x277d9f['headers']);logger[_0x35ef('0x64')](_0x277d9f[_0x35ef('0x8f')]);if(_[_0x35ef('0xab')](_0x501c6b[_0x35ef('0x38')][_0x35ef('0xa')],_0x35ef('0x50'))&&_0x277d9f[_0x35ef('0xac')]==0x1f4){return _0x41c311[_0x35ef('0x20')](_0x277d9f[_0x35ef('0xac')]);}else{return _0x41c311['status'](_0x277d9f[_0x35ef('0xac')])[_0x35ef('0x30')](_0x277d9f[_0x35ef('0x8f')]);}}else{return _0x41c311[_0x35ef('0x20')](0xc8);}})['catch'](handleError(_0x41c311,null));};exports['webhookPost']=function(_0x42a0e0,_0x5ca604,_0x43f56d){return BPromise[_0x35ef('0x9e')]()[_0x35ef('0x2b')](function(){if(!_0x42a0e0[_0x35ef('0x38')]['path']){throw new Error(_0x35ef('0x9f'));}if(!_0x42a0e0['query'][_0x35ef('0xa0')]){throw new Error(_0x35ef('0xa1'));}var _0x5d6752=_0x42a0e0['query'][_0x35ef('0xa2')]?_0x42a0e0[_0x35ef('0x38')][_0x35ef('0xa2')]+':'+_0x42a0e0[_0x35ef('0x38')]['port']:_0x35ef('0xa3')+_0x42a0e0[_0x35ef('0x38')][_0x35ef('0xa0')];var _0x43eee5=_0x42a0e0[_0x35ef('0x38')][_0x35ef('0xa4')]?_0x42a0e0['query'][_0x35ef('0xa4')]:!![];var _0x458fee=_0x42a0e0[_0x35ef('0x38')][_0x35ef('0xa5')]?_0x42a0e0[_0x35ef('0x38')][_0x35ef('0xa5')]:null;var _0x1f616e={'method':_0x42a0e0['method'],'uri':util[_0x35ef('0x62')](_0x35ef('0xa7'),_0x5d6752,_0x42a0e0[_0x35ef('0x38')][_0x35ef('0xa')]),'json':_0x43eee5,'resolveWithFullResponse':!![],'encoding':_0x458fee,'body':_0x42a0e0['body']};if(_0x42a0e0[_0x35ef('0xa8')]){_0x1f616e[_0x35ef('0xa8')]=_0x42a0e0[_0x35ef('0xa8')];if(_0x1f616e['headers'][_0x35ef('0xa9')]){delete _0x1f616e[_0x35ef('0xa8')][_0x35ef('0xa9')];}}if(_0x1f616e[_0x35ef('0xa8')][_0x35ef('0xaa')]){delete _0x1f616e[_0x35ef('0xa8')]['content-type'];}return rp(_0x1f616e);})[_0x35ef('0x2b')](function(_0x25bbde){if(_0x25bbde){_0x5ca604[_0x35ef('0x24')](_0x25bbde[_0x35ef('0xa8')]);logger[_0x35ef('0x64')](_0x25bbde[_0x35ef('0x8f')]);return _0x5ca604[_0x35ef('0x21')](_0x25bbde[_0x35ef('0xac')])['send'](_0x25bbde[_0x35ef('0x8f')]);}else{return _0x5ca604[_0x35ef('0x20')](0xc8);}})['catch'](handleError(_0x5ca604,null));}; \ No newline at end of file +var _0x7620=['isFile','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','undefined','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','admin','views','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','dirname','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','headers','content-length','content-type','endsWith','statusCode','method','%s%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','status','end','offset','limit','set','json','save','update','destroy','then','Plugins','UserProfileResource','error','name','send','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','Plugin','find','path','join','root','server/files/plugins','format','basename','createWriteStream','warning','code','ENOENT','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','pipe','**/*','node_modules/**/*','attachments/**/*','finalize','existsSync','Error\x20while\x20downloading\x20the\x20plugin','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync'];(function(_0x3e4a29,_0x40b8e8){var _0x29b23b=function(_0x5d742b){while(--_0x5d742b){_0x3e4a29['push'](_0x3e4a29['shift']());}};_0x29b23b(++_0x40b8e8);}(_0x7620,0x174));var _0x0762=function(_0x355535,_0x1e2607){_0x355535=_0x355535-0x0;var _0x2a4242=_0x7620[_0x355535];return _0x2a4242;};'use strict';var pdf=require(_0x0762('0x0'));var emlformat=require(_0x0762('0x1'));var rimraf=require(_0x0762('0x2'));var zipdir=require(_0x0762('0x3'));var jsonpatch=require(_0x0762('0x4'));var rp=require(_0x0762('0x5'));var moment=require(_0x0762('0x6'));var BPromise=require(_0x0762('0x7'));var Mustache=require(_0x0762('0x8'));var util=require(_0x0762('0x9'));var path=require('path');var sox=require(_0x0762('0xa'));var csv=require(_0x0762('0xb'));var ejs=require(_0x0762('0xc'));var fs=require('fs');var _=require(_0x0762('0xd'));var squel=require(_0x0762('0xe'));var crypto=require(_0x0762('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x0762('0x10'));var toCsv=require(_0x0762('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0x0762('0x2'));var archiver=require(_0x0762('0x11'));var Redis=require(_0x0762('0x12'));var authService=require(_0x0762('0x13'));var qs=require(_0x0762('0x14'));var as=require(_0x0762('0x15'));var hardwareService=require(_0x0762('0x16'));var logger=require(_0x0762('0x17'))(_0x0762('0x18'));var utils=require(_0x0762('0x19'));var config=require(_0x0762('0x1a'));var licenseUtil=require(_0x0762('0x1b'));var db=require(_0x0762('0x1c'))['db'];config['redis']=_['defaults'](config[_0x0762('0x1d')],{'host':_0x0762('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0762('0x1d')]));require('./plugin.socket')[_0x0762('0x1f')](socket);function respondWithStatusCode(_0x14ec86,_0x5af5fe){_0x5af5fe=_0x5af5fe||0xcc;return function(_0x1f57e3){if(_0x1f57e3){return _0x14ec86[_0x0762('0x20')](_0x5af5fe);}return _0x14ec86[_0x0762('0x21')](_0x5af5fe)[_0x0762('0x22')]();};}function respondWithResult(_0xae58b8,_0x1ee5de){_0x1ee5de=_0x1ee5de||0xc8;return function(_0x2778fc){if(_0x2778fc){return _0xae58b8[_0x0762('0x21')](_0x1ee5de)['json'](_0x2778fc);}};}function respondWithFilteredResult(_0x2ff128,_0x53c058){return function(_0x2d8d09){if(_0x2d8d09){var _0x57a654=_0x2d8d09['count'],_0x2bb3f9=_0x53c058['offset'],_0x500246=_0x53c058[_0x0762('0x23')]+_0x53c058[_0x0762('0x24')],_0x5ea67e;if(_0x500246>=_0x57a654){_0x500246=_0x57a654;_0x5ea67e=0xc8;}else{_0x5ea67e=0xce;}_0x2ff128[_0x0762('0x21')](_0x5ea67e);return _0x2ff128[_0x0762('0x25')]('Content-Range',_0x2bb3f9+'-'+_0x500246+'/'+_0x57a654)[_0x0762('0x26')](_0x2d8d09);}return null;};}function patchUpdates(_0x471ff4){return function(_0x23d17e){try{jsonpatch['apply'](_0x23d17e,_0x471ff4,!![]);}catch(_0x110e63){return BPromise['reject'](_0x110e63);}return _0x23d17e[_0x0762('0x27')]();};}function saveUpdates(_0x162ff0,_0x2a2733){return function(_0x51c9f4){if(_0x51c9f4){return _0x51c9f4[_0x0762('0x28')](_0x162ff0)['then'](function(_0x53fc69){return _0x53fc69;});}return null;};}function removeEntity(_0x10dcfd,_0x267b2c){return function(_0x62be51){if(_0x62be51){return _0x62be51[_0x0762('0x29')]()[_0x0762('0x2a')](function(){var _0x426033=_0x62be51['get']({'plain':!![]});var _0x3b3aa6=_0x0762('0x2b');return db[_0x0762('0x2c')]['destroy']({'where':{'type':_0x3b3aa6,'resourceId':_0x426033['id']}})[_0x0762('0x2a')](function(){return _0x62be51;});})['then'](function(){_0x10dcfd[_0x0762('0x21')](0xcc)[_0x0762('0x22')]();});}};}function handleEntityNotFound(_0x31cc6f,_0x4b4dd7){return function(_0x2b2c4e){if(!_0x2b2c4e){_0x31cc6f['sendStatus'](0x194);}return _0x2b2c4e;};}function handleError(_0x1af968,_0x2607a3){_0x2607a3=_0x2607a3||0x1f4;return function(_0xdf84b0){logger[_0x0762('0x2d')](_0xdf84b0['stack']);if(_0xdf84b0[_0x0762('0x2e')]){delete _0xdf84b0[_0x0762('0x2e')];}_0x1af968['status'](_0x2607a3)[_0x0762('0x2f')](_0xdf84b0);};}exports['index']=function(_0x34ec91,_0x107d74){var _0x1ece82={},_0x4185ce={},_0x18a2bb={'count':0x0,'rows':[]};var _0x3c5ea4=_[_0x0762('0x30')](db['Plugin'][_0x0762('0x31')],function(_0x51b0a6){return{'name':_0x51b0a6['fieldName'],'type':_0x51b0a6[_0x0762('0x32')][_0x0762('0x33')]};});_0x4185ce[_0x0762('0x34')]=_[_0x0762('0x30')](_0x3c5ea4,_0x0762('0x2e'));_0x4185ce[_0x0762('0x35')]=_[_0x0762('0x36')](_0x34ec91[_0x0762('0x35')]);_0x4185ce['filters']=_[_0x0762('0x37')](_0x4185ce[_0x0762('0x34')],_0x4185ce[_0x0762('0x35')]);_0x1ece82['attributes']=_[_0x0762('0x37')](_0x4185ce[_0x0762('0x34')],qs[_0x0762('0x38')](_0x34ec91[_0x0762('0x35')]['fields']));_0x1ece82[_0x0762('0x39')]=_0x1ece82[_0x0762('0x39')][_0x0762('0x3a')]?_0x1ece82[_0x0762('0x39')]:_0x4185ce['model'];if(!_0x34ec91[_0x0762('0x35')][_0x0762('0x3b')](_0x0762('0x3c'))){_0x1ece82[_0x0762('0x24')]=qs[_0x0762('0x24')](_0x34ec91[_0x0762('0x35')]['limit']);_0x1ece82['offset']=qs[_0x0762('0x23')](_0x34ec91[_0x0762('0x35')][_0x0762('0x23')]);}_0x1ece82[_0x0762('0x3d')]=qs[_0x0762('0x3e')](_0x34ec91['query'][_0x0762('0x3e')]);_0x1ece82[_0x0762('0x3f')]=qs['filters'](_['pick'](_0x34ec91[_0x0762('0x35')],_0x4185ce[_0x0762('0x40')]),_0x3c5ea4);if(_0x34ec91[_0x0762('0x35')][_0x0762('0x41')]){_0x1ece82[_0x0762('0x3f')]=_[_0x0762('0x42')](_0x1ece82[_0x0762('0x3f')],{'$or':_[_0x0762('0x30')](_0x3c5ea4,function(_0x373c0d){if(_0x373c0d[_0x0762('0x32')]!==_0x0762('0x43')){var _0xe41c93={};_0xe41c93[_0x373c0d['name']]={'$like':'%'+_0x34ec91[_0x0762('0x35')]['filter']+'%'};return _0xe41c93;}})});}_0x1ece82=_[_0x0762('0x42')]({},_0x1ece82,_0x34ec91[_0x0762('0x44')]);var _0x4121d5={'where':_0x1ece82[_0x0762('0x3f')]};return db['Plugin']['count'](_0x4121d5)[_0x0762('0x2a')](function(_0x3e42f4){_0x18a2bb[_0x0762('0x45')]=_0x3e42f4;if(_0x34ec91[_0x0762('0x35')][_0x0762('0x46')]){_0x1ece82[_0x0762('0x47')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x1ece82);})[_0x0762('0x2a')](function(_0x31f8b4){_0x18a2bb[_0x0762('0x48')]=_0x31f8b4;return _0x18a2bb;})[_0x0762('0x2a')](respondWithFilteredResult(_0x107d74,_0x1ece82))[_0x0762('0x49')](handleError(_0x107d74,null));};exports[_0x0762('0x4a')]=function(_0x14f7d6,_0x259cd0){var _0x629654={'raw':!![],'where':{'id':_0x14f7d6[_0x0762('0x4b')]['id']}},_0x17361c={};_0x17361c['model']=_[_0x0762('0x36')](db[_0x0762('0x4c')][_0x0762('0x31')]);_0x17361c[_0x0762('0x35')]=_[_0x0762('0x36')](_0x14f7d6[_0x0762('0x35')]);_0x17361c[_0x0762('0x40')]=_[_0x0762('0x37')](_0x17361c[_0x0762('0x34')],_0x17361c[_0x0762('0x35')]);_0x629654[_0x0762('0x39')]=_[_0x0762('0x37')](_0x17361c[_0x0762('0x34')],qs[_0x0762('0x38')](_0x14f7d6[_0x0762('0x35')][_0x0762('0x38')]));_0x629654['attributes']=_0x629654['attributes'][_0x0762('0x3a')]?_0x629654[_0x0762('0x39')]:_0x17361c['model'];if(_0x14f7d6[_0x0762('0x35')]['includeAll']){_0x629654['include']=[{'all':!![]}];}_0x629654=_['merge']({},_0x629654,_0x14f7d6[_0x0762('0x44')]);return db[_0x0762('0x4c')][_0x0762('0x4d')](_0x629654)[_0x0762('0x2a')](handleEntityNotFound(_0x259cd0,null))[_0x0762('0x2a')](respondWithResult(_0x259cd0,null))[_0x0762('0x49')](handleError(_0x259cd0,null));};exports['download']=function(_0x204589,_0x5f9c2b,_0x17d84e){return db[_0x0762('0x4c')]['find']({'where':{'id':_0x204589[_0x0762('0x4b')]['id']},'attributes':['name',_0x0762('0x4e')],'raw':!![]})[_0x0762('0x2a')](handleEntityNotFound(_0x5f9c2b,null))[_0x0762('0x2a')](function(_0x4d67a){if(_0x4d67a){var _0x7811f=path[_0x0762('0x4f')](config[_0x0762('0x50')],_0x0762('0x51'),util[_0x0762('0x52')]('%s.zip',path[_0x0762('0x53')](_0x4d67a[_0x0762('0x4e')])));var _0x5396b=fs[_0x0762('0x54')](_0x7811f);var _0x5b7b17=archiver('zip',{'zlib':{'level':0x9}});_0x5b7b17['on'](_0x0762('0x55'),function(_0x2fcb0f){if(_0x2fcb0f[_0x0762('0x56')]===_0x0762('0x57')){logger['error'](_0x2fcb0f);}else{throw new db['Sequelize']['Error'](_0x0762('0x58'));}});_0x5b7b17['on'](_0x0762('0x2d'),function(_0x1f9a10){throw new db[(_0x0762('0x59'))][(_0x0762('0x5a'))](_0x0762('0x58'));});_0x5b7b17[_0x0762('0x5b')](_0x5396b);_0x5b7b17['glob'](_0x0762('0x5c'),{'cwd':path[_0x0762('0x4f')](config[_0x0762('0x50')],_0x0762('0x51'),path['dirname'](_0x4d67a[_0x0762('0x4e')])),'ignore':[path['join'](path[_0x0762('0x53')](_0x4d67a['path']),_0x0762('0x5d')),path[_0x0762('0x4f')](path[_0x0762('0x53')](_0x4d67a[_0x0762('0x4e')]),_0x0762('0x5e'))],'nodir':!![]})[_0x0762('0x5f')]();_0x5396b['on']('close',function(){if(!fs[_0x0762('0x60')](_0x7811f)){throw new db['Sequelize'][(_0x0762('0x5a'))]('Plugin\x20not\x20found');}return _0x5f9c2b['download'](_0x7811f,util['format']('%s.zip',path['basename'](_0x4d67a[_0x0762('0x4e')])),function(_0x471e5b){if(_0x471e5b){throw new db[(_0x0762('0x59'))][(_0x0762('0x5a'))](_0x0762('0x61'));}fs['unlinkSync'](_0x7811f);logger[_0x0762('0x62')]('Download\x20completed');logger[_0x0762('0x62')](_0x0762('0x63'));});});}return null;})[_0x0762('0x49')](handleError(_0x5f9c2b,null));};exports[_0x0762('0x64')]=function(_0x2544a4,_0x30850f,_0x21aa5a){var _0x3a720f=path['basename'](_0x2544a4[_0x0762('0x65')][_0x0762('0x66')],path[_0x0762('0x67')](_0x2544a4[_0x0762('0x65')][_0x0762('0x66')]));var _0x125bf0=path[_0x0762('0x4f')](config['root'],_0x0762('0x51'),_0x2544a4[_0x0762('0x65')][_0x0762('0x66')]);var _0xe91bdd=path[_0x0762('0x4f')](config[_0x0762('0x50')],_0x0762('0x51'),_0x3a720f);logger[_0x0762('0x62')](_0x0762('0x68'),_0x125bf0);logger[_0x0762('0x62')](_0x0762('0x69'),_0xe91bdd);try{fs[_0x0762('0x6a')](_0x125bf0,parseInt(_0x0762('0x6b'),0x8));extract(_0x125bf0,{'dir':_0xe91bdd},function(_0x462d80){if(_0x462d80){logger['error'](_0x462d80);handleError(_0x462d80,!![]);};var _0x1b6c7c=fs[_0x0762('0x6c')](_0xe91bdd);if(_0x1b6c7c[_0x0762('0x3a')]>0x1){removeReferences(_0x125bf0,_0xe91bdd);logger[_0x0762('0x2d')](_0x0762('0x6d'));return _0x21aa5a(new Error(_0x0762('0x6d')));}var _0x55ccaf=fs[_0x0762('0x6e')](path[_0x0762('0x4f')](_0xe91bdd,_0x1b6c7c[0x0]));if(_0x55ccaf[_0x0762('0x6f')]()){removeReferences(_0x125bf0,_0xe91bdd);logger[_0x0762('0x2d')](_0x0762('0x6d'));return _0x21aa5a(new Error('Invalid\x20plugin\x20structure'));}if(_0x55ccaf['isDirectory']()){var _0x518f85=fs['readdirSync'](path[_0x0762('0x4f')](_0xe91bdd,_0x1b6c7c[0x0]));if(_0x518f85[_0x0762('0x3a')]===0x0){removeReferences(_0x125bf0,_0xe91bdd);logger[_0x0762('0x2d')](_0x0762('0x6d'));return _0x21aa5a(new Error(_0x0762('0x6d')));}var _0xab74e2=_0x518f85['some'](function(_0xf3b1fa){return _0xf3b1fa===_0x0762('0x70');});if(!_0xab74e2){return _0x21aa5a(new Error('Plugin\x20manifest\x20missing'));}var _0x3ad6f0=fs[_0x0762('0x71')](path['join'](_0xe91bdd,_0x1b6c7c[0x0],_0x0762('0x70')));var _0x323c90=JSON[_0x0762('0x72')](_0x3ad6f0);if('undefined'==typeof _0x323c90[_0x0762('0x2e')]){return _0x21aa5a(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x323c90[_0x0762('0x32')]){return _0x21aa5a(new Error(_0x0762('0x73')));}if(_0x0762('0x74')==typeof _0x323c90[_0x0762('0x75')]){return _0x21aa5a(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x323c90[_0x0762('0x76')]){return _0x21aa5a(new Error(_0x0762('0x77')));}if(_0x323c90[_0x0762('0x32')]===_0x0762('0x78')){if(_0x0762('0x74')==typeof _0x323c90[_0x0762('0x76')]['views']){return _0x21aa5a(new Error(_0x0762('0x79')));}if(_0x0762('0x74')==typeof _0x323c90[_0x0762('0x76')]['views'][_0x0762('0x7a')]&&'undefined'==typeof _0x323c90[_0x0762('0x76')][_0x0762('0x7b')][_0x0762('0x7c')]){return _0x21aa5a(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x323c90['type']===_0x0762('0x7d')){if(_0x0762('0x74')==typeof _0x323c90[_0x0762('0x76')][_0x0762('0x7e')]){return _0x21aa5a(new Error(_0x0762('0x7f')));}if(_0x0762('0x74')==typeof _0x323c90['parameters']['scriptPath']){return _0x21aa5a(new Error(_0x0762('0x80')));}}else{return _0x21aa5a(new Error(_0x0762('0x81')));}var _0x482b0c=_0x323c90['name'];var _0x478c41=_0x323c90['description'];var _0xa6ee31=_0x323c90['type'];var _0x15920e=_0x323c90[_0x0762('0x82')]?_0x323c90[_0x0762('0x82')]:_0x0762('0x83');var _0x2581e2=_0x323c90[_0x0762('0x84')]?_0x323c90[_0x0762('0x84')]:_0x0762('0x85');var _0x5525f6='';var _0x556341='';var _0xa66546='';var _0x2028ef='';var _0x2b5bef=_0x323c90['version'];if(_0xa6ee31==='html'){if(_0x0762('0x74')!=typeof _0x323c90[_0x0762('0x76')][_0x0762('0x7b')][_0x0762('0x7a')]){var _0x50a788=_0x323c90['parameters'][_0x0762('0x7b')][_0x0762('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x0762('0x86')](_0x50a788)){_0x5525f6=path[_0x0762('0x4f')](_0x0762('0x87'),_0x3a720f,_0x1b6c7c[0x0],_0x50a788);}else{_0x5525f6=_0x50a788;}}else{logger[_0x0762('0x62')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x0762('0x74')!=typeof _0x323c90[_0x0762('0x76')][_0x0762('0x7b')][_0x0762('0x7c')]){var _0x282434=_0x323c90['parameters'][_0x0762('0x7b')][_0x0762('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x0762('0x86')](_0x282434)){_0x556341=path['join'](_0x0762('0x87'),_0x3a720f,_0x1b6c7c[0x0],_0x282434);}else{_0x556341=_0x282434;}}else{logger[_0x0762('0x62')](_0x0762('0x88'));}}else if(_0xa6ee31===_0x0762('0x7d')){_0xa66546=_0x323c90['parameters']['scriptName'];_0x2028ef=_0x323c90[_0x0762('0x76')][_0x0762('0x89')];if(_0x0762('0x74')!=typeof _0x323c90[_0x0762('0x76')][_0x0762('0x7b')]){if('undefined'!=typeof _0x323c90[_0x0762('0x76')][_0x0762('0x7b')][_0x0762('0x7a')]){var _0x50a788=_0x323c90[_0x0762('0x76')][_0x0762('0x7b')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x0762('0x86')](_0x50a788)){_0x5525f6=path[_0x0762('0x4f')](_0x0762('0x87'),_0x3a720f,_0x1b6c7c[0x0],_0x50a788);}else{_0x5525f6=_0x50a788;}}if(_0x0762('0x74')!=typeof _0x323c90[_0x0762('0x76')][_0x0762('0x7b')][_0x0762('0x7c')]){var _0x282434=_0x323c90[_0x0762('0x76')][_0x0762('0x7b')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x282434)){_0x556341=path[_0x0762('0x4f')](_0x0762('0x87'),_0x3a720f,_0x1b6c7c[0x0],_0x282434);}else{_0x556341=_0x282434;}}}}var _0x36bb08={'name':_0x482b0c,'description':_0x478c41,'path':path[_0x0762('0x4f')](_0x3a720f,_0x1b6c7c[0x0]),'type':_0xa6ee31,'sidebar':_0x15920e,'icon':_0x2581e2,'adminUrl':_0x5525f6,'agentUrl':_0x556341,'scriptName':_0xa66546,'scriptPath':_0x2028ef,'version':_0x2b5bef};removeReferences(_0x125bf0,null);return db[_0x0762('0x4c')][_0x0762('0x8a')](_0x36bb08)[_0x0762('0x2a')](function(_0x5dfd52){var _0x2bb7d1={'role':_0x2544a4[_0x0762('0x8b')][_0x0762('0x8c')],'userProfileId':_0x2544a4[_0x0762('0x8b')][_0x0762('0x8d')]};if(!_0x2bb7d1)throw new Error(_0x0762('0x8e'));if(_0x2bb7d1[_0x0762('0x8c')]===_0x0762('0x8f')){var _0x3ab5a0=_0x5dfd52[_0x0762('0x90')]({'plain':!![]});return db[_0x0762('0x91')][_0x0762('0x4d')]({'where':{'name':_0x0762('0x2b'),'userProfileId':_0x2bb7d1[_0x0762('0x8d')]},'raw':!![]})['then'](function(_0x47623e){if(_0x47623e&&_0x47623e[_0x0762('0x92')]===0x0){return db[_0x0762('0x2c')]['create']({'name':_0x3ab5a0['name'],'resourceId':_0x3ab5a0['id'],'type':_0x47623e[_0x0762('0x2e')],'sectionId':_0x47623e['id']},{})[_0x0762('0x2a')](function(){return _0x5dfd52;});}else{return _0x5dfd52;}})['catch'](function(_0x6d149d){logger[_0x0762('0x2d')](_0x0762('0x93'),_0x6d149d);throw _0x6d149d;});}return _0x5dfd52;})[_0x0762('0x2a')](respondWithResult(_0x30850f,null))['catch'](handleError(_0x30850f,null));}});}catch(_0x5cd072){_0x30850f[_0x0762('0x21')](0x1f4)[_0x0762('0x2f')](_0x5cd072);}};function removeReferences(_0x23fb64,_0x2308a5){try{if(_0x23fb64){fs[_0x0762('0x94')](_0x23fb64);logger[_0x0762('0x62')]('Zip\x20archive\x20removed');}if(_0x2308a5){rimraf(_0x2308a5,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x50056b){logger[_0x0762('0x2d')](_0x50056b);}}exports[_0x0762('0x28')]=function(_0x20a685,_0x4be89d,_0x38512d){return db[_0x0762('0x4c')][_0x0762('0x4d')]({'where':{'id':_0x20a685[_0x0762('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4be89d,null))[_0x0762('0x2a')](saveUpdates(_0x20a685[_0x0762('0x8b')],null))[_0x0762('0x2a')](respondWithResult(_0x4be89d,null))[_0x0762('0x49')](handleError(_0x4be89d,null));};exports['delete']=function(_0x1fd1d4,_0x4b2a49,_0x54829d){return db['Plugin'][_0x0762('0x4d')]({'where':{'id':_0x1fd1d4['params']['id']}})[_0x0762('0x2a')](function(_0x3df492){if(_0x3df492){return _0x3df492[_0x0762('0x29')]();}})['then'](function(_0x59c9c8){rimraf(path['join'](config[_0x0762('0x50')],'server/files/plugins',path[_0x0762('0x95')](_0x59c9c8['path'])),function(){});return _0x59c9c8;})['then'](handleEntityNotFound(_0x4b2a49,null))[_0x0762('0x2a')](respondWithStatusCode(_0x4b2a49,null))[_0x0762('0x49')](handleError(_0x4b2a49,null));};exports['webhookGet']=function(_0x1339a3,_0x309f2e,_0x2a7641){return BPromise['resolve']()[_0x0762('0x2a')](function(){if(!_0x1339a3[_0x0762('0x35')][_0x0762('0x4e')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1339a3[_0x0762('0x35')][_0x0762('0x96')]){throw new Error(_0x0762('0x97'));}var _0x354b1e=_0x1339a3[_0x0762('0x35')]['hostname']?_0x1339a3[_0x0762('0x35')][_0x0762('0x98')]+':'+_0x1339a3[_0x0762('0x35')][_0x0762('0x96')]:'http://localhost:'+_0x1339a3[_0x0762('0x35')]['port'];var _0x50e6da=_0x1339a3[_0x0762('0x35')][_0x0762('0x26')]?_0x1339a3[_0x0762('0x35')][_0x0762('0x26')]:!![];var _0x28f77c=_0x1339a3['query'][_0x0762('0x99')]?_0x1339a3[_0x0762('0x35')][_0x0762('0x99')]:null;var _0x1c025b={'method':_0x1339a3['method'],'uri':util['format']('%s%s',_0x354b1e,_0x1339a3[_0x0762('0x35')][_0x0762('0x4e')]),'json':_0x50e6da,'resolveWithFullResponse':!![],'encoding':_0x28f77c,'qs':_0x1339a3[_0x0762('0x35')]};if(_0x1339a3[_0x0762('0x9a')]){_0x1c025b[_0x0762('0x9a')]=_0x1339a3[_0x0762('0x9a')];if(_0x1c025b[_0x0762('0x9a')][_0x0762('0x9b')]){delete _0x1c025b[_0x0762('0x9a')][_0x0762('0x9b')];}}if(_0x1c025b[_0x0762('0x9a')][_0x0762('0x9c')]){delete _0x1c025b[_0x0762('0x9a')]['content-type'];}return rp(_0x1c025b);})[_0x0762('0x2a')](function(_0x13d8d){if(_0x13d8d){_0x309f2e['set'](_0x13d8d[_0x0762('0x9a')]);logger[_0x0762('0x62')](_0x13d8d[_0x0762('0x8b')]);if(_[_0x0762('0x9d')](_0x1339a3['query'][_0x0762('0x4e')],'download')&&_0x13d8d[_0x0762('0x9e')]==0x1f4){return _0x309f2e['sendStatus'](_0x13d8d[_0x0762('0x9e')]);}else{return _0x309f2e[_0x0762('0x21')](_0x13d8d[_0x0762('0x9e')])[_0x0762('0x2f')](_0x13d8d[_0x0762('0x8b')]);}}else{return _0x309f2e[_0x0762('0x20')](0xc8);}})[_0x0762('0x49')](handleError(_0x309f2e,null));};exports['webhookPost']=function(_0x34cc0d,_0x2b9976,_0x549805){return BPromise['resolve']()[_0x0762('0x2a')](function(){if(!_0x34cc0d[_0x0762('0x35')][_0x0762('0x4e')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x34cc0d[_0x0762('0x35')][_0x0762('0x96')]){throw new Error(_0x0762('0x97'));}var _0x5bb231=_0x34cc0d[_0x0762('0x35')]['hostname']?_0x34cc0d['query']['hostname']+':'+_0x34cc0d[_0x0762('0x35')]['port']:'http://localhost:'+_0x34cc0d[_0x0762('0x35')][_0x0762('0x96')];var _0x17390b=_0x34cc0d[_0x0762('0x35')][_0x0762('0x26')]?_0x34cc0d['query'][_0x0762('0x26')]:!![];var _0x3c365e=_0x34cc0d['query']['encoding']?_0x34cc0d[_0x0762('0x35')][_0x0762('0x99')]:null;var _0x4d2b3a={'method':_0x34cc0d[_0x0762('0x9f')],'uri':util[_0x0762('0x52')](_0x0762('0xa0'),_0x5bb231,_0x34cc0d['query'][_0x0762('0x4e')]),'json':_0x17390b,'resolveWithFullResponse':!![],'encoding':_0x3c365e,'body':_0x34cc0d['body']};if(_0x34cc0d[_0x0762('0x9a')]){_0x4d2b3a[_0x0762('0x9a')]=_0x34cc0d[_0x0762('0x9a')];if(_0x4d2b3a[_0x0762('0x9a')]['content-length']){delete _0x4d2b3a[_0x0762('0x9a')]['content-length'];}}if(_0x4d2b3a[_0x0762('0x9a')]['content-type']){delete _0x4d2b3a[_0x0762('0x9a')]['content-type'];}return rp(_0x4d2b3a);})[_0x0762('0x2a')](function(_0x1ff25c){if(_0x1ff25c){_0x2b9976[_0x0762('0x25')](_0x1ff25c[_0x0762('0x9a')]);logger[_0x0762('0x62')](_0x1ff25c['body']);return _0x2b9976[_0x0762('0x21')](_0x1ff25c[_0x0762('0x9e')])[_0x0762('0x2f')](_0x1ff25c[_0x0762('0x8b')]);}else{return _0x2b9976[_0x0762('0x20')](0xc8);}})[_0x0762('0x49')](handleError(_0x2b9976,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 5d3e85f..f5ff504 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 _0x32b6=['exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0xa24985,_0x1d2c15){var _0x2f7c36=function(_0x28219c){while(--_0x28219c){_0xa24985['push'](_0xa24985['shift']());}};_0x2f7c36(++_0x1d2c15);}(_0x32b6,0x1d1));var _0x632b=function(_0x4a5da0,_0x115b6d){_0x4a5da0=_0x4a5da0-0x0;var _0x4ae1a8=_0x32b6[_0x4a5da0];return _0x4ae1a8;};'use strict';var EventEmitter=require(_0x632b('0x0'));var Plugin=require(_0x632b('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x632b('0x2')](0x0);var events={'afterCreate':_0x632b('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2e2173){return function(_0x3435e8,_0x3ba3a7,_0x3a0e0e){PluginEvents[_0x632b('0x4')](_0x2e2173+':'+_0x3435e8['id'],_0x3435e8);PluginEvents[_0x632b('0x4')](_0x2e2173,_0x3435e8);_0x3a0e0e(null);};}for(var e in events){if(events[_0x632b('0x5')](e)){var event=events[e];Plugin[_0x632b('0x6')](e,emitEvent(event));}}module[_0x632b('0x7')]=PluginEvents; \ No newline at end of file +var _0xb145=['exports','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2530f4,_0x2b0a7e){var _0x54cf4b=function(_0x1d8549){while(--_0x1d8549){_0x2530f4['push'](_0x2530f4['shift']());}};_0x54cf4b(++_0x2b0a7e);}(_0xb145,0xa3));var _0x5b14=function(_0x3b1a49,_0x35a393){_0x3b1a49=_0x3b1a49-0x0;var _0x4cef6f=_0xb145[_0x3b1a49];return _0x4cef6f;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x5b14('0x0'))['db'][_0x5b14('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x5b14('0x2')](0x0);var events={'afterCreate':_0x5b14('0x3'),'afterUpdate':_0x5b14('0x4'),'afterDestroy':_0x5b14('0x5')};function emitEvent(_0x31f6f0){return function(_0x34b4cd,_0x5111cd,_0x1e0b5b){PluginEvents[_0x5b14('0x6')](_0x31f6f0+':'+_0x34b4cd['id'],_0x34b4cd);PluginEvents[_0x5b14('0x6')](_0x31f6f0,_0x34b4cd);_0x1e0b5b(null);};}for(var e in events){if(events[_0x5b14('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x5b14('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 48c0d58..a13e9b9 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 _0x24ca=['Plugin','plugins','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define'];(function(_0x12e0d4,_0x3cf530){var _0xf4e0f5=function(_0x4c387b){while(--_0x4c387b){_0x12e0d4['push'](_0x12e0d4['shift']());}};_0xf4e0f5(++_0x3cf530);}(_0x24ca,0x1bc));var _0xa24c=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x24ca[_0x53abe5];return _0xc1c37e;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var logger=require(_0xa24c('0x1'))(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa24c('0x4'));var fs=require('fs');var path=require(_0xa24c('0x5'));var rimraf=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var attributes=require(_0xa24c('0x8'));module[_0xa24c('0x9')]=function(_0xf0511,_0x3c0aaa){return _0xf0511[_0xa24c('0xa')](_0xa24c('0xb'),attributes,{'tableName':_0xa24c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c4e=['moment','request-promise','path','rimraf','./plugin.attributes','define','Plugin','plugins','lodash','../../config/logger','api'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4c4e,0x152));var _0xe4c4=function(_0x53fcab,_0x54d419){_0x53fcab=_0x53fcab-0x0;var _0x2fc523=_0x4c4e[_0x53fcab];return _0x2fc523;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var logger=require(_0xe4c4('0x1'))(_0xe4c4('0x2'));var moment=require(_0xe4c4('0x3'));var BPromise=require('bluebird');var rp=require(_0xe4c4('0x4'));var fs=require('fs');var path=require(_0xe4c4('0x5'));var rimraf=require(_0xe4c4('0x6'));var config=require('../../config/environment');var attributes=require(_0xe4c4('0x7'));module['exports']=function(_0x177732,_0x1a12a6){return _0x177732[_0xe4c4('0x8')](_0xe4c4('0x9'),attributes,{'tableName':_0xe4c4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 86381c3..e80a3c8 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 _0xf7fc=['./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','info','CreatePlugin','Plugin','create','body','options','stringify','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter'];(function(_0x203c12,_0x39fb64){var _0x20bbeb=function(_0x5c0784){while(--_0x5c0784){_0x203c12['push'](_0x203c12['shift']());}};_0x20bbeb(++_0x39fb64);}(_0xf7fc,0x97));var _0xcf7f=function(_0x1ae747,_0x592fdb){_0x1ae747=_0x1ae747-0x0;var _0x9112c3=_0xf7fc[_0x1ae747];return _0x9112c3;};'use strict';var _=require(_0xcf7f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcf7f('0x1'));var rs=require(_0xcf7f('0x2'));var fs=require('fs');var Redis=require(_0xcf7f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcf7f('0x4'));var logger=require(_0xcf7f('0x5'))(_0xcf7f('0x6'));var config=require(_0xcf7f('0x7'));var jayson=require(_0xcf7f('0x8'));var client=jayson[_0xcf7f('0x9')][_0xcf7f('0xa')]({'port':0x232a});config['redis']=_[_0xcf7f('0xb')](config[_0xcf7f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xcf7f('0xd'))(new Redis(config[_0xcf7f('0xc')]));require(_0xcf7f('0xe'))[_0xcf7f('0xf')](socket);function respondWithRpcPromise(_0x5af623,_0x3daef1,_0x5d4e9d){return new BPromise(function(_0x5cf37d,_0x53ddd0){return client[_0xcf7f('0x10')](_0x5af623,_0x5d4e9d)[_0xcf7f('0x11')](function(_0x38ad57){logger['info'](_0xcf7f('0x12'),_0x3daef1,_0xcf7f('0x13'));logger[_0xcf7f('0x14')](_0xcf7f('0x15'),_0x3daef1,'request\x20sent',JSON['stringify'](_0x38ad57));if(_0x38ad57[_0xcf7f('0x16')]){if(_0x38ad57[_0xcf7f('0x16')][_0xcf7f('0x17')]===0x1f4){logger[_0xcf7f('0x16')](_0xcf7f('0x12'),_0x3daef1,_0x38ad57['error']['message']);return _0x53ddd0(_0x38ad57[_0xcf7f('0x16')][_0xcf7f('0x18')]);}logger[_0xcf7f('0x16')](_0xcf7f('0x12'),_0x3daef1,_0x38ad57[_0xcf7f('0x16')][_0xcf7f('0x18')]);return _0x5cf37d(_0x38ad57['error'][_0xcf7f('0x18')]);}else{logger[_0xcf7f('0x19')]('Plugin,\x20%s,\x20%s',_0x3daef1,'request\x20sent');_0x5cf37d(_0x38ad57['result']['message']);}})['catch'](function(_0x32f62b){logger[_0xcf7f('0x16')](_0xcf7f('0x12'),_0x3daef1,_0x32f62b);_0x53ddd0(_0x32f62b);});});}exports[_0xcf7f('0x1a')]=function(_0xda1939){var _0x26dd55=this;return new Promise(function(_0x5624cf,_0x504b4a){return db[_0xcf7f('0x1b')][_0xcf7f('0x1c')](_0xda1939[_0xcf7f('0x1d')],{'raw':_0xda1939[_0xcf7f('0x1e')]?_0xda1939[_0xcf7f('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xcf7f('0x11')](function(_0x3f9b1a){logger[_0xcf7f('0x19')](_0xcf7f('0x1a'),_0xda1939);logger[_0xcf7f('0x14')](_0xcf7f('0x1a'),_0xda1939,JSON[_0xcf7f('0x1f')](_0x3f9b1a));_0x5624cf(_0x3f9b1a);})[_0xcf7f('0x20')](function(_0x4ccf21){logger['error'](_0xcf7f('0x1a'),_0x4ccf21[_0xcf7f('0x18')],_0xda1939);_0x504b4a(_0x26dd55[_0xcf7f('0x16')](0x1f4,_0x4ccf21[_0xcf7f('0x18')]));});});}; \ No newline at end of file +var _0xbd14=['options','raw','then','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xbd14,0x199));var _0x4bd1=function(_0x5d99db,_0xe9473f){_0x5d99db=_0x5d99db-0x0;var _0x7d0598=_0xbd14[_0x5d99db];return _0x7d0598;};'use strict';var _=require('lodash');var util=require(_0x4bd1('0x0'));var moment=require(_0x4bd1('0x1'));var BPromise=require('bluebird');var rs=require(_0x4bd1('0x2'));var fs=require('fs');var Redis=require(_0x4bd1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4bd1('0x4'))('rpc');var config=require(_0x4bd1('0x5'));var jayson=require(_0x4bd1('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x4bd1('0x7')]=_[_0x4bd1('0x8')](config[_0x4bd1('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x4bd1('0x9'))(new Redis(config['redis']));require(_0x4bd1('0xa'))[_0x4bd1('0xb')](socket);function respondWithRpcPromise(_0x23dc41,_0x39c806,_0xbbd7dd){return new BPromise(function(_0x42b1ab,_0x21e4d6){return client[_0x4bd1('0xc')](_0x23dc41,_0xbbd7dd)['then'](function(_0x1b252d){logger[_0x4bd1('0xd')](_0x4bd1('0xe'),_0x39c806,_0x4bd1('0xf'));logger[_0x4bd1('0x10')](_0x4bd1('0x11'),_0x39c806,'request\x20sent',JSON[_0x4bd1('0x12')](_0x1b252d));if(_0x1b252d[_0x4bd1('0x13')]){if(_0x1b252d[_0x4bd1('0x13')][_0x4bd1('0x14')]===0x1f4){logger[_0x4bd1('0x13')]('Plugin,\x20%s,\x20%s',_0x39c806,_0x1b252d[_0x4bd1('0x13')][_0x4bd1('0x15')]);return _0x21e4d6(_0x1b252d[_0x4bd1('0x13')][_0x4bd1('0x15')]);}logger[_0x4bd1('0x13')](_0x4bd1('0xe'),_0x39c806,_0x1b252d[_0x4bd1('0x13')]['message']);return _0x42b1ab(_0x1b252d[_0x4bd1('0x13')]['message']);}else{logger[_0x4bd1('0xd')](_0x4bd1('0xe'),_0x39c806,_0x4bd1('0xf'));_0x42b1ab(_0x1b252d[_0x4bd1('0x16')][_0x4bd1('0x15')]);}})[_0x4bd1('0x17')](function(_0x3b7534){logger['error'](_0x4bd1('0xe'),_0x39c806,_0x3b7534);_0x21e4d6(_0x3b7534);});});}exports[_0x4bd1('0x18')]=function(_0x264700){var _0x377804=this;return new Promise(function(_0x3ef79a,_0x3450bc){return db[_0x4bd1('0x19')]['create'](_0x264700['body'],{'raw':_0x264700[_0x4bd1('0x1a')]?_0x264700[_0x4bd1('0x1a')][_0x4bd1('0x1b')]===undefined?!![]:![]:!![]})[_0x4bd1('0x1c')](function(_0x32812f){logger[_0x4bd1('0xd')](_0x4bd1('0x18'),_0x264700);logger[_0x4bd1('0x10')](_0x4bd1('0x18'),_0x264700,JSON[_0x4bd1('0x12')](_0x32812f));_0x3ef79a(_0x32812f);})[_0x4bd1('0x17')](function(_0x556c35){logger[_0x4bd1('0x13')](_0x4bd1('0x18'),_0x556c35['message'],_0x264700);_0x3450bc(_0x377804[_0x4bd1('0x13')](0x1f4,_0x556c35[_0x4bd1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 8f8404b..5067f09 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 _0x2b84=['register','length','plugin:','./plugin.events','save','update','emit'];(function(_0x1e3329,_0x162371){var _0x2a8d8d=function(_0x1186f3){while(--_0x1186f3){_0x1e3329['push'](_0x1e3329['shift']());}};_0x2a8d8d(++_0x162371);}(_0x2b84,0x1ed));var _0x42b8=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x2b84[_0x49ca18];return _0x145d54;};'use strict';var PluginEvents=require(_0x42b8('0x0'));var events=[_0x42b8('0x1'),'remove',_0x42b8('0x2')];function createListener(_0x2d23f9,_0xc3642b){return function(_0x5e22a3){_0xc3642b[_0x42b8('0x3')](_0x2d23f9,_0x5e22a3);};}function removeListener(_0x5630ae,_0x365c8c){return function(){PluginEvents['removeListener'](_0x5630ae,_0x365c8c);};}exports[_0x42b8('0x4')]=function(_0xb151dc){for(var _0x4d0fe0=0x0,_0x4a040d=events[_0x42b8('0x5')];_0x4d0fe0<_0x4a040d;_0x4d0fe0++){var _0x23459e=events[_0x4d0fe0];var _0x1c6323=createListener(_0x42b8('0x6')+_0x23459e,_0xb151dc);PluginEvents['on'](_0x23459e,_0x1c6323);}}; \ No newline at end of file +var _0xa9fc=['plugin:','./plugin.events','save','remove','update','length'];(function(_0x2cd3d8,_0x5ddfb0){var _0x1ee6e1=function(_0x39b230){while(--_0x39b230){_0x2cd3d8['push'](_0x2cd3d8['shift']());}};_0x1ee6e1(++_0x5ddfb0);}(_0xa9fc,0x19f));var _0xca9f=function(_0x37c07d,_0xdbdb5f){_0x37c07d=_0x37c07d-0x0;var _0x10dadc=_0xa9fc[_0x37c07d];return _0x10dadc;};'use strict';var PluginEvents=require(_0xca9f('0x0'));var events=[_0xca9f('0x1'),_0xca9f('0x2'),_0xca9f('0x3')];function createListener(_0x2d786d,_0x5af164){return function(_0x379e68){_0x5af164['emit'](_0x2d786d,_0x379e68);};}function removeListener(_0xe81cd,_0x32709b){return function(){PluginEvents['removeListener'](_0xe81cd,_0x32709b);};}exports['register']=function(_0x5c7268){for(var _0x234d90=0x0,_0x48f9ca=events[_0xca9f('0x4')];_0x234d90<_0x48f9ca;_0x234d90++){var _0x61b1b6=events[_0x234d90];var _0x400980=createListener(_0xca9f('0x5')+_0x61b1b6,_0x5c7268);PluginEvents['on'](_0x61b1b6,_0x400980);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index d6540eb..a898efa 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 _0xc8ea=['create','put','/:id','update','delete','destroy','Router','../../components/auth/service','get','index','post','isAuthenticated'];(function(_0x4d180c,_0x45c68e){var _0x49b57e=function(_0x264741){while(--_0x264741){_0x4d180c['push'](_0x4d180c['shift']());}};_0x49b57e(++_0x45c68e);}(_0xc8ea,0xd2));var _0xac8e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xc8ea[_0x47a7d0];return _0xb9bd08;};'use strict';var express=require('express');var router=express[_0xac8e('0x0')]();var auth=require(_0xac8e('0x1'));var controller=require('./pm2.controller');router[_0xac8e('0x2')]('/',auth['isAuthenticated'](),controller[_0xac8e('0x3')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xac8e('0x4')]('/',auth[_0xac8e('0x5')](),controller[_0xac8e('0x6')]);router[_0xac8e('0x7')](_0xac8e('0x8'),auth['isAuthenticated'](),controller[_0xac8e('0x9')]);router[_0xac8e('0xa')](_0xac8e('0x8'),auth[_0xac8e('0x5')](),controller[_0xac8e('0xb')]);module['exports']=router; \ No newline at end of file +var _0xa78b=['create','put','update','delete','destroy','exports','express','Router','../../components/auth/service','./pm2.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5c5b73,_0x26c7e4){var _0x3975db=function(_0x129032){while(--_0x129032){_0x5c5b73['push'](_0x5c5b73['shift']());}};_0x3975db(++_0x26c7e4);}(_0xa78b,0x6f));var _0xba78=function(_0x140ed3,_0x3396f0){_0x140ed3=_0x140ed3-0x0;var _0x1660df=_0xa78b[_0x140ed3];return _0x1660df;};'use strict';var express=require(_0xba78('0x0'));var router=express[_0xba78('0x1')]();var auth=require(_0xba78('0x2'));var controller=require(_0xba78('0x3'));router[_0xba78('0x4')]('/',auth[_0xba78('0x5')](),controller[_0xba78('0x6')]);router[_0xba78('0x4')](_0xba78('0x7'),auth[_0xba78('0x5')](),controller[_0xba78('0x8')]);router['post']('/',auth[_0xba78('0x5')](),controller[_0xba78('0x9')]);router[_0xba78('0xa')]('/:id',auth[_0xba78('0x5')](),controller[_0xba78('0xb')]);router[_0xba78('0xc')](_0xba78('0x7'),auth[_0xba78('0x5')](),controller[_0xba78('0xd')]);module[_0xba78('0xe')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index dd69f80..4ca791c 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 _0x39f7=['body','script','join','cwd','chdir','start','send','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','delete','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','json','error','stack','name','status','npm\x20install','info','index','list','reject','express','motion2','then','catch','describe','params','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39f7,0x145));var _0x739f=function(_0x36909d,_0x2795f1){_0x36909d=_0x36909d-0x0;var _0x1fd29d=_0x39f7[_0x36909d];return _0x1fd29d;};'use strict';var _=require(_0x739f('0x0'));var pm2=require(_0x739f('0x1'));var logger=require(_0x739f('0x2'))(_0x739f('0x3'));var path=require(_0x739f('0x4'));var exec=require(_0x739f('0x5'))[_0x739f('0x6')];var BPromise=require(_0x739f('0x7'));function handleEntityNotFound(_0x321829,_0x2e52e8){return function(_0x396eee){if(!_0x396eee){_0x321829[_0x739f('0x8')](0x194);;}return _0x396eee;};}function respondWithResult(_0xdf5f6f,_0x599b9f){_0x599b9f=_0x599b9f||0xc8;return function(_0x50fb11){if(_0x50fb11){return _0xdf5f6f['status'](_0x599b9f)[_0x739f('0x9')](_0x50fb11);}return null;};}function handleError(_0x128448,_0x21f690){_0x21f690=_0x21f690||0x1f4;return function(_0x4c09b3){logger[_0x739f('0xa')](_0x4c09b3[_0x739f('0xb')]);if(_0x4c09b3[_0x739f('0xc')]){delete _0x4c09b3[_0x739f('0xc')];}_0x128448[_0x739f('0xd')](_0x21f690)['send'](_0x4c09b3);};}function execChildProcess(){return new BPromise(function(_0x2229f3,_0x2e59ff){exec(_0x739f('0xe'),function(_0x58549a,_0x4683bb,_0x91677e){logger[_0x739f('0xf')](_0x4683bb);logger[_0x739f('0xf')](_0x91677e);if(_0x58549a){logger[_0x739f('0xa')](_0x58549a);return _0x2e59ff(_0x58549a);}return _0x2229f3(_0x4683bb);});});}exports[_0x739f('0x10')]=function(_0x3315ab,_0x598d72){return pm2[_0x739f('0x11')]()['then'](function(_0x4cff21){if(_0x4cff21){var _0x5a7ce8=_[_0x739f('0x12')](_0x4cff21,function(_0x1f4ce5){return _0x1f4ce5[_0x739f('0xc')]===_0x739f('0x13')||_0x1f4ce5[_0x739f('0xc')]===_0x739f('0x14');});return{'rows':_0x5a7ce8,'count':_0x5a7ce8['length']};}return null;})[_0x739f('0x15')](respondWithResult(_0x598d72,null))[_0x739f('0x16')](handleError(_0x598d72,null));};exports['show']=function(_0xfc6ff0,_0x247981){return pm2[_0x739f('0x17')](_0xfc6ff0[_0x739f('0x18')]['id'])[_0x739f('0x15')](respondWithResult(_0x247981,null))['then'](handleEntityNotFound(_0x247981,null))[_0x739f('0x16')](handleError(_0x247981,null));};exports[_0x739f('0x19')]=function(_0x374b8c,_0xb52d57){if(_0x374b8c[_0x739f('0x1a')][_0x739f('0xc')]&&_0x374b8c[_0x739f('0x1a')][_0x739f('0x1b')]){var _0x4b286a=path[_0x739f('0x1c')](__dirname,'../../files/plugins',_0x374b8c[_0x739f('0x1a')][_0x739f('0x1b')]);var _0x555c92=process[_0x739f('0x1d')]();process[_0x739f('0x1e')](path['dirname'](_0x4b286a));return execChildProcess()[_0x739f('0x15')](function(_0x99b64){process['chdir'](_0x555c92);return pm2[_0x739f('0x1f')]({'name':_0x374b8c['body'][_0x739f('0xc')],'script':_0x4b286a});})[_0x739f('0x15')](function(_0x5b2903){pm2['dump']();return _0x5b2903[0x0];})[_0x739f('0x15')](respondWithResult(_0xb52d57,0xc9))[_0x739f('0x16')](handleError(_0xb52d57,null));}else{return _0xb52d57['status'](0x1f4)[_0x739f('0x20')]({'message':_0x739f('0x21')});}};exports[_0x739f('0x22')]=function(_0x34c90e,_0x4b539b){if(_0x34c90e[_0x739f('0x1a')]['id']){delete _0x34c90e['body']['id'];}var _0x210a04={'online':'restart','stopped':_0x739f('0x23')};if(_0x210a04[_0x739f('0x24')](_0x34c90e[_0x739f('0x1a')][_0x739f('0xd')])){return pm2[_0x210a04[_0x34c90e[_0x739f('0x1a')][_0x739f('0xd')]]](_0x34c90e[_0x739f('0x18')]['id'])['then'](respondWithResult(_0x4b539b,0xc8))['catch'](handleError(_0x4b539b,null));}else{return _0x4b539b[_0x739f('0xd')](0x1f4)[_0x739f('0x20')]({'message':_0x739f('0x25')});}};exports['destroy']=function(_0x11820a,_0x20019d){if(_0x11820a['body']['id']){delete _0x11820a[_0x739f('0x1a')]['id'];}if(_0x11820a[_0x739f('0x18')]['id']){return pm2[_0x739f('0x26')](_0x11820a[_0x739f('0x18')]['id'])['then'](function(_0x2380bf){pm2['dump']();return _0x2380bf[0x0];})[_0x739f('0x15')](respondWithResult(_0x20019d,null))[_0x739f('0x16')](handleError(_0x20019d,null));}else{return _0x20019d['status'](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x926d=['json','error','stack','name','send','npm\x20install','info','motion2','length','then','catch','show','describe','params','body','script','join','../../files/plugins','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','api','path','exec','bluebird','sendStatus','status'];(function(_0xe1f999,_0x4b9cd0){var _0x165847=function(_0x53ccc8){while(--_0x53ccc8){_0xe1f999['push'](_0xe1f999['shift']());}};_0x165847(++_0x4b9cd0);}(_0x926d,0x6c));var _0xd926=function(_0x3a7be9,_0x17d289){_0x3a7be9=_0x3a7be9-0x0;var _0x240707=_0x926d[_0x3a7be9];return _0x240707;};'use strict';var _=require(_0xd926('0x0'));var pm2=require(_0xd926('0x1'));var logger=require(_0xd926('0x2'))(_0xd926('0x3'));var path=require(_0xd926('0x4'));var exec=require('child_process')[_0xd926('0x5')];var BPromise=require(_0xd926('0x6'));function handleEntityNotFound(_0x857d32,_0x3e98ac){return function(_0x530e60){if(!_0x530e60){_0x857d32[_0xd926('0x7')](0x194);;}return _0x530e60;};}function respondWithResult(_0xda0c92,_0x30cd4a){_0x30cd4a=_0x30cd4a||0xc8;return function(_0x3c2ed0){if(_0x3c2ed0){return _0xda0c92[_0xd926('0x8')](_0x30cd4a)[_0xd926('0x9')](_0x3c2ed0);}return null;};}function handleError(_0x1acef1,_0x4ee91b){_0x4ee91b=_0x4ee91b||0x1f4;return function(_0x37bdfb){logger[_0xd926('0xa')](_0x37bdfb[_0xd926('0xb')]);if(_0x37bdfb[_0xd926('0xc')]){delete _0x37bdfb['name'];}_0x1acef1['status'](_0x4ee91b)[_0xd926('0xd')](_0x37bdfb);};}function execChildProcess(){return new BPromise(function(_0x38c810,_0x26de31){exec(_0xd926('0xe'),function(_0x5c4f35,_0x558a3d,_0x4e392f){logger[_0xd926('0xf')](_0x558a3d);logger['info'](_0x4e392f);if(_0x5c4f35){logger[_0xd926('0xa')](_0x5c4f35);return _0x26de31(_0x5c4f35);}return _0x38c810(_0x558a3d);});});}exports['index']=function(_0x52b246,_0x2adc64){return pm2['list']()['then'](function(_0xc1714c){if(_0xc1714c){var _0x57dc04=_['reject'](_0xc1714c,function(_0x167752){return _0x167752[_0xd926('0xc')]==='express'||_0x167752['name']===_0xd926('0x10');});return{'rows':_0x57dc04,'count':_0x57dc04[_0xd926('0x11')]};}return null;})[_0xd926('0x12')](respondWithResult(_0x2adc64,null))[_0xd926('0x13')](handleError(_0x2adc64,null));};exports[_0xd926('0x14')]=function(_0x3814c1,_0xd0b374){return pm2[_0xd926('0x15')](_0x3814c1[_0xd926('0x16')]['id'])[_0xd926('0x12')](respondWithResult(_0xd0b374,null))[_0xd926('0x12')](handleEntityNotFound(_0xd0b374,null))[_0xd926('0x13')](handleError(_0xd0b374,null));};exports['create']=function(_0x4092c4,_0x58359d){if(_0x4092c4['body'][_0xd926('0xc')]&&_0x4092c4[_0xd926('0x17')][_0xd926('0x18')]){var _0x20810f=path[_0xd926('0x19')](__dirname,_0xd926('0x1a'),_0x4092c4[_0xd926('0x17')][_0xd926('0x18')]);var _0x3a67ae=process['cwd']();process[_0xd926('0x1b')](path[_0xd926('0x1c')](_0x20810f));return execChildProcess()[_0xd926('0x12')](function(_0x28656c){process[_0xd926('0x1b')](_0x3a67ae);return pm2[_0xd926('0x1d')]({'name':_0x4092c4['body'][_0xd926('0xc')],'script':_0x20810f});})[_0xd926('0x12')](function(_0x326a47){pm2[_0xd926('0x1e')]();return _0x326a47[0x0];})[_0xd926('0x12')](respondWithResult(_0x58359d,0xc9))['catch'](handleError(_0x58359d,null));}else{return _0x58359d['status'](0x1f4)[_0xd926('0xd')]({'message':_0xd926('0x1f')});}};exports[_0xd926('0x20')]=function(_0x2159a9,_0x66fca3){if(_0x2159a9[_0xd926('0x17')]['id']){delete _0x2159a9['body']['id'];}var _0x5303ce={'online':_0xd926('0x21'),'stopped':_0xd926('0x22')};if(_0x5303ce[_0xd926('0x23')](_0x2159a9[_0xd926('0x17')][_0xd926('0x8')])){return pm2[_0x5303ce[_0x2159a9[_0xd926('0x17')][_0xd926('0x8')]]](_0x2159a9[_0xd926('0x16')]['id'])[_0xd926('0x12')](respondWithResult(_0x66fca3,0xc8))[_0xd926('0x13')](handleError(_0x66fca3,null));}else{return _0x66fca3[_0xd926('0x8')](0x1f4)[_0xd926('0xd')]({'message':_0xd926('0x24')});}};exports[_0xd926('0x25')]=function(_0x16e767,_0xc58fb9){if(_0x16e767[_0xd926('0x17')]['id']){delete _0x16e767['body']['id'];}if(_0x16e767[_0xd926('0x16')]['id']){return pm2[_0xd926('0x26')](_0x16e767[_0xd926('0x16')]['id'])[_0xd926('0x12')](function(_0x334f03){pm2['dump']();return _0x334f03[0x0];})[_0xd926('0x12')](respondWithResult(_0xc58fb9,null))[_0xd926('0x13')](handleError(_0xc58fb9,null));}else{return _0xc58fb9[_0xd926('0x8')](0x1f4)[_0xd926('0xd')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index cc3a1ee..2504533 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 _0x74b0=['connect-timeout','express','Router','../../components/interaction/service','exports','multer','path'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0x74b0,0x171));var _0x074b=function(_0x35c86f,_0x399bc4){_0x35c86f=_0x35c86f-0x0;var _0x28c841=_0x74b0[_0x35c86f];return _0x28c841;};'use strict';var multer=require(_0x074b('0x0'));var util=require('util');var path=require(_0x074b('0x1'));var timeout=require(_0x074b('0x2'));var express=require(_0x074b('0x3'));var router=express[_0x074b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x074b('0x5'));var config=require('../../config/environment');module[_0x074b('0x6')]=router; \ No newline at end of file +var _0x8d7b=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports'];(function(_0x4904c5,_0x4c9816){var _0x3a5d94=function(_0xcc18a0){while(--_0xcc18a0){_0x4904c5['push'](_0x4904c5['shift']());}};_0x3a5d94(++_0x4c9816);}(_0x8d7b,0x1e8));var _0xb8d7=function(_0x4a919f,_0x553927){_0x4a919f=_0x4a919f-0x0;var _0x2cd4ab=_0x8d7b[_0x4a919f];return _0x2cd4ab;};'use strict';var multer=require(_0xb8d7('0x0'));var util=require('util');var path=require(_0xb8d7('0x1'));var timeout=require(_0xb8d7('0x2'));var express=require(_0xb8d7('0x3'));var router=express[_0xb8d7('0x4')]();var auth=require(_0xb8d7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb8d7('0x6'));module[_0xb8d7('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 923244a..0f62352 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 _0x74e0=['INTEGER','sequelize','exports','DATE','STRING'];(function(_0x2d1314,_0x567214){var _0x34f655=function(_0x124b4a){while(--_0x124b4a){_0x2d1314['push'](_0x2d1314['shift']());}};_0x34f655(++_0x567214);}(_0x74e0,0x79));var _0x074e=function(_0x1aa444,_0x4d6b5f){_0x1aa444=_0x1aa444-0x0;var _0xb36b20=_0x74e0[_0x1aa444];return _0xb36b20;};'use strict';var Sequelize=require(_0x074e('0x0'));module[_0x074e('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x074e('0x2')]},'uniqueid':{'type':Sequelize[_0x074e('0x3')]},'starttime':{'type':Sequelize[_0x074e('0x2')]},'responsetime':{'type':Sequelize[_0x074e('0x2')]},'ringtime':{'type':Sequelize[_0x074e('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x074e('0x3')]},'membername':{'type':Sequelize[_0x074e('0x3')]}}; \ No newline at end of file +var _0x7da6=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7da6,0x1e9));var _0x67da=function(_0x2a7210,_0x2f3d23){_0x2a7210=_0x2a7210-0x0;var _0x460766=_0x7da6[_0x2a7210];return _0x460766;};'use strict';var Sequelize=require(_0x67da('0x0'));module[_0x67da('0x1')]={'state':{'type':Sequelize[_0x67da('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x67da('0x3')]},'starttime':{'type':Sequelize[_0x67da('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x67da('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x67da('0x3')]},'campaigntype':{'type':Sequelize[_0x67da('0x3')]},'membername':{'type':Sequelize[_0x67da('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index bad06ad..3c30b8a 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 _0x3411=['util','moment','bluebird','request-promise','path','rimraf','define','report_agent_preview','lodash'];(function(_0x224eb1,_0x3edea1){var _0x300298=function(_0x59e174){while(--_0x59e174){_0x224eb1['push'](_0x224eb1['shift']());}};_0x300298(++_0x3edea1);}(_0x3411,0x128));var _0x1341=function(_0x1acdbe,_0x2cb9fb){_0x1acdbe=_0x1acdbe-0x0;var _0x4b662c=_0x3411[_0x1acdbe];return _0x4b662c;};'use strict';var _=require(_0x1341('0x0'));var util=require(_0x1341('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1341('0x2'));var BPromise=require(_0x1341('0x3'));var rp=require(_0x1341('0x4'));var fs=require('fs');var path=require(_0x1341('0x5'));var rimraf=require(_0x1341('0x6'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x41afa6,_0x28993a){return _0x41afa6[_0x1341('0x7')]('ReportAgentPreview',attributes,{'tableName':_0x1341('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe7e=['exports','define','ReportAgentPreview','report_agent_preview','lodash','util','api','bluebird','rimraf','./reportAgentPreview.attributes'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfe7e,0x11c));var _0xefe7=function(_0x2fdee0,_0x59542a){_0x2fdee0=_0x2fdee0-0x0;var _0x456bbc=_0xfe7e[_0x2fdee0];return _0x456bbc;};'use strict';var _=require(_0xefe7('0x0'));var util=require(_0xefe7('0x1'));var logger=require('../../config/logger')(_0xefe7('0x2'));var moment=require('moment');var BPromise=require(_0xefe7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xefe7('0x4'));var config=require('../../config/environment');var attributes=require(_0xefe7('0x5'));module[_0xefe7('0x6')]=function(_0x5c83c6,_0x29d279){return _0x5c83c6[_0xefe7('0x7')](_0xefe7('0x8'),attributes,{'tableName':_0xefe7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 32c04f3..939a820 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 _0xf13f=['request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','create','body','options','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ReportAgentPreview,\x20%s,\x20%s'];(function(_0x2e3d4a,_0x5172a3){var _0x2f12f2=function(_0x49fb52){while(--_0x49fb52){_0x2e3d4a['push'](_0x2e3d4a['shift']());}};_0x2f12f2(++_0x5172a3);}(_0xf13f,0x1a3));var _0xff13=function(_0x5a5492,_0x500453){_0x5a5492=_0x5a5492-0x0;var _0x268bb5=_0xf13f[_0x5a5492];return _0x268bb5;};'use strict';var _=require(_0xff13('0x0'));var util=require('util');var moment=require(_0xff13('0x1'));var BPromise=require(_0xff13('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff13('0x3'));var db=require(_0xff13('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xff13('0x5'))(_0xff13('0x6'));var config=require(_0xff13('0x7'));var jayson=require(_0xff13('0x8'));var client=jayson[_0xff13('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36192d,_0x443d09,_0x522fcf){return new BPromise(function(_0x27b2bd,_0x3a3fc5){return client['request'](_0x36192d,_0x522fcf)[_0xff13('0xa')](function(_0x2aef58){logger[_0xff13('0xb')](_0xff13('0xc'),_0x443d09,_0xff13('0xd'));logger[_0xff13('0xe')](_0xff13('0xf'),_0x443d09,'request\x20sent',JSON[_0xff13('0x10')](_0x2aef58));if(_0x2aef58[_0xff13('0x11')]){if(_0x2aef58[_0xff13('0x11')][_0xff13('0x12')]===0x1f4){logger[_0xff13('0x11')](_0xff13('0xc'),_0x443d09,_0x2aef58[_0xff13('0x11')][_0xff13('0x13')]);return _0x3a3fc5(_0x2aef58[_0xff13('0x11')][_0xff13('0x13')]);}logger[_0xff13('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x443d09,_0x2aef58[_0xff13('0x11')]['message']);return _0x27b2bd(_0x2aef58[_0xff13('0x11')][_0xff13('0x13')]);}else{logger[_0xff13('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x443d09,_0xff13('0xd'));_0x27b2bd(_0x2aef58[_0xff13('0x14')][_0xff13('0x13')]);}})[_0xff13('0x15')](function(_0x11ba75){logger[_0xff13('0x11')](_0xff13('0xc'),_0x443d09,_0x11ba75);_0x3a3fc5(_0x11ba75);});});}exports[_0xff13('0x16')]=function(_0x12e19f){var _0x3919f0=this;return new Promise(function(_0x1727e4,_0x433faa){return db['ReportAgentPreview'][_0xff13('0x17')](_0x12e19f[_0xff13('0x18')],{'raw':_0x12e19f['options']?_0x12e19f[_0xff13('0x19')][_0xff13('0x1a')]===undefined?!![]:![]:!![]})[_0xff13('0xa')](function(_0x3267c0){logger['info'](_0xff13('0x16'),_0x12e19f);logger[_0xff13('0xe')]('CreateReportAgentPreview',_0x12e19f,JSON[_0xff13('0x10')](_0x3267c0));_0x1727e4(_0x3267c0);})[_0xff13('0x15')](function(_0x19d0bb){logger['error']('CreateReportAgentPreview',_0x19d0bb['message'],_0x12e19f);_0x433faa(_0x3919f0['error'](0x1f4,_0x19d0bb[_0xff13('0x13')]));});});}; \ No newline at end of file +var _0x5b22=['then','ReportAgentPreview,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','CreateReportAgentPreview','create','options','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4d431b,_0x231cbf){var _0x202f9b=function(_0x18f9a2){while(--_0x18f9a2){_0x4d431b['push'](_0x4d431b['shift']());}};_0x202f9b(++_0x231cbf);}(_0x5b22,0x145));var _0x25b2=function(_0x1c30b1,_0x3ff473){_0x1c30b1=_0x1c30b1-0x0;var _0x59c74f=_0x5b22[_0x1c30b1];return _0x59c74f;};'use strict';var _=require(_0x25b2('0x0'));var util=require('util');var moment=require(_0x25b2('0x1'));var BPromise=require(_0x25b2('0x2'));var rs=require(_0x25b2('0x3'));var fs=require('fs');var Redis=require(_0x25b2('0x4'));var db=require(_0x25b2('0x5'))['db'];var utils=require(_0x25b2('0x6'));var logger=require(_0x25b2('0x7'))(_0x25b2('0x8'));var config=require(_0x25b2('0x9'));var jayson=require(_0x25b2('0xa'));var client=jayson[_0x25b2('0xb')][_0x25b2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x301be8,_0x3281c5,_0x4ea1a0){return new BPromise(function(_0x410f9e,_0x241dc7){return client['request'](_0x301be8,_0x4ea1a0)[_0x25b2('0xd')](function(_0x2ed7c2){logger['info'](_0x25b2('0xe'),_0x3281c5,'request\x20sent');logger[_0x25b2('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x3281c5,_0x25b2('0x10'),JSON['stringify'](_0x2ed7c2));if(_0x2ed7c2[_0x25b2('0x11')]){if(_0x2ed7c2['error'][_0x25b2('0x12')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x3281c5,_0x2ed7c2[_0x25b2('0x11')][_0x25b2('0x13')]);return _0x241dc7(_0x2ed7c2[_0x25b2('0x11')][_0x25b2('0x13')]);}logger[_0x25b2('0x11')](_0x25b2('0xe'),_0x3281c5,_0x2ed7c2[_0x25b2('0x11')][_0x25b2('0x13')]);return _0x410f9e(_0x2ed7c2['error'][_0x25b2('0x13')]);}else{logger['info'](_0x25b2('0xe'),_0x3281c5,_0x25b2('0x10'));_0x410f9e(_0x2ed7c2[_0x25b2('0x14')]['message']);}})[_0x25b2('0x15')](function(_0x501c7e){logger['error'](_0x25b2('0xe'),_0x3281c5,_0x501c7e);_0x241dc7(_0x501c7e);});});}exports[_0x25b2('0x16')]=function(_0x1e36a0){var _0x512adc=this;return new Promise(function(_0x4ab839,_0x564755){return db['ReportAgentPreview'][_0x25b2('0x17')](_0x1e36a0['body'],{'raw':_0x1e36a0[_0x25b2('0x18')]?_0x1e36a0[_0x25b2('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x25b2('0xd')](function(_0xc7c9c4){logger['info'](_0x25b2('0x16'),_0x1e36a0);logger[_0x25b2('0xf')](_0x25b2('0x16'),_0x1e36a0,JSON[_0x25b2('0x19')](_0xc7c9c4));_0x4ab839(_0xc7c9c4);})[_0x25b2('0x15')](function(_0x1530c7){logger['error'](_0x25b2('0x16'),_0x1530c7[_0x25b2('0x13')],_0x1e36a0);_0x564755(_0x512adc['error'](0x1f4,_0x1530c7[_0x25b2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 6c40ce7..351e1ab 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 _0x3c73=['/chat/queues','chatQueues','/mail/queues','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','/outbound','outbound','outboundChannels','/agents','agents','put','/telephones','telephones','/trunks','trunks','campaigns','faxAccounts','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','openchannel','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','path','express','../../components/auth/service','./rpc.controller','get','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','isAuthenticated','/voice/queues'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3c73,0x154));var _0x33c7=function(_0x194b11,_0x448638){_0x194b11=_0x194b11-0x0;var _0x558395=_0x3c73[_0x194b11];return _0x558395;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x33c7('0x0'));var express=require(_0x33c7('0x1'));var router=express['Router']();var auth=require(_0x33c7('0x2'));var controller=require(_0x33c7('0x3'));router[_0x33c7('0x4')]('/voice/channels',auth['isAuthenticated'](),controller[_0x33c7('0x5')]);router[_0x33c7('0x4')](_0x33c7('0x6'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router['get'](_0x33c7('0x7'),auth[_0x33c7('0x8')](),controller['voiceChannelStopMixMonitor']);router['get'](_0x33c7('0x9'),auth[_0x33c7('0x8')](),controller['voiceQueues']);router[_0x33c7('0x4')](_0x33c7('0xa'),auth[_0x33c7('0x8')](),controller[_0x33c7('0xb')]);router['get'](_0x33c7('0xc'),auth['isAuthenticated'](),controller['mailQueues']);router[_0x33c7('0x4')]('/mail/accounts',auth[_0x33c7('0x8')](),controller['mailAccounts']);router[_0x33c7('0x4')](_0x33c7('0xd'),auth[_0x33c7('0x8')](),controller[_0x33c7('0xe')]);router[_0x33c7('0x4')](_0x33c7('0xf'),auth[_0x33c7('0x8')](),controller['smsQueues']);router[_0x33c7('0x4')](_0x33c7('0x10'),auth['isAuthenticated'](),controller['whatsappQueues']);router[_0x33c7('0x4')]('/fax/queues',auth[_0x33c7('0x8')](),controller[_0x33c7('0x11')]);router['get'](_0x33c7('0x12'),auth['isAuthenticated'](),controller[_0x33c7('0x13')]);router[_0x33c7('0x4')](_0x33c7('0x14'),auth[_0x33c7('0x8')](),controller[_0x33c7('0x15')]);router[_0x33c7('0x4')](_0x33c7('0x16'),auth[_0x33c7('0x8')](),controller[_0x33c7('0x17')]);router['get'](_0x33c7('0x18'),auth[_0x33c7('0x8')](),controller[_0x33c7('0x19')]);router['get'](_0x33c7('0x1a'),auth[_0x33c7('0x8')](),controller[_0x33c7('0x1b')]);router[_0x33c7('0x4')](_0x33c7('0x1c'),auth[_0x33c7('0x8')](),controller['showVoiceQueues']);router[_0x33c7('0x4')](_0x33c7('0x1d'),auth[_0x33c7('0x8')](),controller[_0x33c7('0x1e')]);router['get']('/outbound/channels',auth[_0x33c7('0x8')](),controller[_0x33c7('0x1f')]);router[_0x33c7('0x4')](_0x33c7('0x20'),auth[_0x33c7('0x8')](),controller[_0x33c7('0x21')]);router[_0x33c7('0x22')]('/agents/:id/capacity',auth[_0x33c7('0x8')](),controller['agentCapacity']);router[_0x33c7('0x4')](_0x33c7('0x23'),auth[_0x33c7('0x8')](),controller[_0x33c7('0x24')]);router[_0x33c7('0x4')](_0x33c7('0x25'),auth[_0x33c7('0x8')](),controller[_0x33c7('0x26')]);router[_0x33c7('0x4')]('/campaigns',auth[_0x33c7('0x8')](),controller[_0x33c7('0x27')]);router[_0x33c7('0x4')]('/fax/accounts',auth[_0x33c7('0x8')](),controller[_0x33c7('0x28')]);router['get']('/chat/queues/waitinginteractions',auth[_0x33c7('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0x33c7('0x4')](_0x33c7('0x29'),auth[_0x33c7('0x8')](),controller[_0x33c7('0x2a')]);router[_0x33c7('0x4')]('/openchannel/queues/waitinginteractions',auth[_0x33c7('0x8')](),controller[_0x33c7('0x2b')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0x33c7('0x8')](),controller[_0x33c7('0x2c')]);router[_0x33c7('0x4')](_0x33c7('0x2d'),auth[_0x33c7('0x8')](),controller[_0x33c7('0x2e')]);router[_0x33c7('0x4')]('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router[_0x33c7('0x4')](_0x33c7('0x2f'),auth['isAuthenticated'](),controller[_0x33c7('0x30')]);router[_0x33c7('0x31')](_0x33c7('0x32'),auth[_0x33c7('0x8')](),controller[_0x33c7('0x33')]('mail'));router[_0x33c7('0x4')](_0x33c7('0x34'),auth[_0x33c7('0x8')](),controller[_0x33c7('0x35')]);router[_0x33c7('0x31')](_0x33c7('0x36'),auth[_0x33c7('0x8')](),controller[_0x33c7('0x33')](_0x33c7('0x37')));router['get']('/chat/queues/:id',auth[_0x33c7('0x8')](),controller[_0x33c7('0x38')]);router[_0x33c7('0x31')](_0x33c7('0x39'),auth[_0x33c7('0x8')](),controller[_0x33c7('0x33')](_0x33c7('0x3a')));router[_0x33c7('0x4')](_0x33c7('0x3b'),auth[_0x33c7('0x8')](),controller[_0x33c7('0x3c')]);router[_0x33c7('0x31')]('/openchannel/queues/:id/notify',auth[_0x33c7('0x8')](),controller[_0x33c7('0x33')](_0x33c7('0x3d')));router[_0x33c7('0x4')]('/openchannel/queues/:id',auth[_0x33c7('0x8')](),controller[_0x33c7('0x3e')]);router['post']('/sms/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x33c7('0x3f')));router[_0x33c7('0x31')](_0x33c7('0x40'),auth[_0x33c7('0x8')](),controller[_0x33c7('0x33')](_0x33c7('0x41')));router[_0x33c7('0x4')]('/sms/queues/:id',auth[_0x33c7('0x8')](),controller[_0x33c7('0x42')]);router['get']('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0x33c7('0x43')]);router[_0x33c7('0x31')](_0x33c7('0x44'),auth[_0x33c7('0x8')](),controller[_0x33c7('0x45')]);module['exports']=router; \ No newline at end of file +var _0x1309=['Router','../../components/auth/service','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','outbound','/outbound/channels','/agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','express'];(function(_0x3327e2,_0x251554){var _0x59fb5c=function(_0xf092ac){while(--_0xf092ac){_0x3327e2['push'](_0x3327e2['shift']());}};_0x59fb5c(++_0x251554);}(_0x1309,0x170));var _0x9130=function(_0x7667ca,_0x51aa9a){_0x7667ca=_0x7667ca-0x0;var _0x171e68=_0x1309[_0x7667ca];return _0x171e68;};'use strict';var multer=require(_0x9130('0x0'));var util=require('util');var path=require('path');var express=require(_0x9130('0x1'));var router=express[_0x9130('0x2')]();var auth=require(_0x9130('0x3'));var controller=require('./rpc.controller');router[_0x9130('0x4')]('/voice/channels',auth[_0x9130('0x5')](),controller[_0x9130('0x6')]);router[_0x9130('0x4')](_0x9130('0x7'),auth['isAuthenticated'](),controller[_0x9130('0x8')]);router[_0x9130('0x4')](_0x9130('0x9'),auth['isAuthenticated'](),controller[_0x9130('0xa')]);router[_0x9130('0x4')](_0x9130('0xb'),auth[_0x9130('0x5')](),controller['voiceQueues']);router[_0x9130('0x4')](_0x9130('0xc'),auth[_0x9130('0x5')](),controller[_0x9130('0xd')]);router[_0x9130('0x4')]('/mail/queues',auth[_0x9130('0x5')](),controller[_0x9130('0xe')]);router[_0x9130('0x4')](_0x9130('0xf'),auth[_0x9130('0x5')](),controller[_0x9130('0x10')]);router[_0x9130('0x4')]('/openchannel/queues',auth['isAuthenticated'](),controller['openchannelQueues']);router[_0x9130('0x4')](_0x9130('0x11'),auth[_0x9130('0x5')](),controller['smsQueues']);router[_0x9130('0x4')](_0x9130('0x12'),auth[_0x9130('0x5')](),controller[_0x9130('0x13')]);router['get'](_0x9130('0x14'),auth[_0x9130('0x5')](),controller[_0x9130('0x15')]);router['get']('/voice/queues/preview/:id',auth[_0x9130('0x5')](),controller['voiceQueuesPreview']);router[_0x9130('0x4')](_0x9130('0x16'),auth[_0x9130('0x5')](),controller['voiceQueuesChannels']);router['get'](_0x9130('0x17'),auth['isAuthenticated'](),controller[_0x9130('0x18')]);router[_0x9130('0x4')](_0x9130('0x19'),auth[_0x9130('0x5')](),controller[_0x9130('0x1a')]);router[_0x9130('0x4')](_0x9130('0x1b'),auth['isAuthenticated'](),controller[_0x9130('0x1c')]);router[_0x9130('0x4')](_0x9130('0x1d'),auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0x9130('0x4')]('/outbound',auth[_0x9130('0x5')](),controller[_0x9130('0x1e')]);router[_0x9130('0x4')](_0x9130('0x1f'),auth[_0x9130('0x5')](),controller['outboundChannels']);router[_0x9130('0x4')](_0x9130('0x20'),auth['isAuthenticated'](),controller['agents']);router['put'](_0x9130('0x21'),auth[_0x9130('0x5')](),controller[_0x9130('0x22')]);router[_0x9130('0x4')](_0x9130('0x23'),auth[_0x9130('0x5')](),controller['telephones']);router['get'](_0x9130('0x24'),auth[_0x9130('0x5')](),controller[_0x9130('0x25')]);router[_0x9130('0x4')](_0x9130('0x26'),auth['isAuthenticated'](),controller[_0x9130('0x27')]);router[_0x9130('0x4')](_0x9130('0x28'),auth[_0x9130('0x5')](),controller[_0x9130('0x29')]);router[_0x9130('0x4')](_0x9130('0x2a'),auth[_0x9130('0x5')](),controller[_0x9130('0x2b')]);router['get'](_0x9130('0x2c'),auth[_0x9130('0x5')](),controller[_0x9130('0x2d')]);router[_0x9130('0x4')](_0x9130('0x2e'),auth[_0x9130('0x5')](),controller[_0x9130('0x2f')]);router[_0x9130('0x4')](_0x9130('0x30'),auth[_0x9130('0x5')](),controller[_0x9130('0x31')]);router[_0x9130('0x4')](_0x9130('0x32'),auth[_0x9130('0x5')](),controller[_0x9130('0x33')]);router[_0x9130('0x4')](_0x9130('0x34'),auth[_0x9130('0x5')](),controller[_0x9130('0x35')]);router[_0x9130('0x4')](_0x9130('0x36'),auth[_0x9130('0x5')](),controller['faxQueuesWaitingInteractions']);router[_0x9130('0x37')](_0x9130('0x38'),auth[_0x9130('0x5')](),controller[_0x9130('0x39')](_0x9130('0x3a')));router[_0x9130('0x4')]('/mail/queues/:id',auth[_0x9130('0x5')](),controller['showMailQueues']);router[_0x9130('0x37')](_0x9130('0x3b'),auth[_0x9130('0x5')](),controller[_0x9130('0x39')]('chat'));router['get'](_0x9130('0x3c'),auth[_0x9130('0x5')](),controller[_0x9130('0x3d')]);router[_0x9130('0x37')](_0x9130('0x3e'),auth[_0x9130('0x5')](),controller[_0x9130('0x39')]('fax'));router[_0x9130('0x4')]('/fax/queues/:id',auth[_0x9130('0x5')](),controller[_0x9130('0x3f')]);router['post'](_0x9130('0x40'),auth[_0x9130('0x5')](),controller[_0x9130('0x39')]('openchannel'));router['get'](_0x9130('0x41'),auth[_0x9130('0x5')](),controller[_0x9130('0x42')]);router['post'](_0x9130('0x43'),auth[_0x9130('0x5')](),controller[_0x9130('0x39')](_0x9130('0x44')));router['post']('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0x9130('0x39')](_0x9130('0x45')));router[_0x9130('0x4')]('/sms/queues/:id',auth[_0x9130('0x5')](),controller['showSmsQueues']);router[_0x9130('0x4')](_0x9130('0x46'),auth['isAuthenticated'](),controller[_0x9130('0x47')]);router['post']('/agents/:id/notify',auth[_0x9130('0x5')](),controller[_0x9130('0x48')]);module[_0x9130('0x49')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index d1bde83..4f42184 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 _0x32c9=['channel','Channel\x20field\x20is\x20mandatory','User','findOne','update','From','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','result','catch','status','json','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','body','hasOwnProperty','MemberReport','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','capacity','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','queue_id','value','filter','indexOf','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','Queue','Message','messageId','Interaction','\x20Message\x20not\x20found','queue','MessageId','InteractionId','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x32c9,0x105));var _0x932c=function(_0x2483f6,_0x70bc75){_0x2483f6=_0x2483f6-0x0;var _0x44f7b9=_0x32c9[_0x2483f6];return _0x44f7b9;};'use strict';var BPromise=require(_0x932c('0x0'));var moment=require(_0x932c('0x1'));var _=require(_0x932c('0x2'));var util=require(_0x932c('0x3'));var db=require(_0x932c('0x4'))['db'];var logger=require(_0x932c('0x5'))(_0x932c('0x6'));var jayson=require(_0x932c('0x7'));var amiClient=jayson[_0x932c('0x8')][_0x932c('0x9')]({'port':0x232a});var mailClient=jayson['client'][_0x932c('0x9')]({'port':0x232b});var routingClient=jayson[_0x932c('0x8')]['http']({'port':0x232c});function respondWithRpcPromise(_0x46a489,_0x185867,_0x44e727){return new BPromise(function(_0x406da0,_0x485b01){var _0x188150=_0x44e727?_0x44e727:amiClient;return _0x188150[_0x932c('0xa')](_0x46a489,_0x185867)[_0x932c('0xb')](function(_0x573c72){if(_0x573c72['error']){if(_0x573c72[_0x932c('0xc')]['code']===0x1f4){return _0x485b01(_0x573c72[_0x932c('0xc')]['message']);}return _0x406da0(_0x573c72[_0x932c('0xc')]['message']);}else{_0x406da0(_0x573c72[_0x932c('0xd')]);}})[_0x932c('0xe')](function(_0x26b961){_0x485b01(_0x26b961);});});}function respondWithResult(_0x4be56d,_0x5db43d){_0x5db43d=_0x5db43d||0xc8;return function(_0x2cc737){if(_0x2cc737){return _0x4be56d[_0x932c('0xf')](_0x5db43d)[_0x932c('0x10')](_0x2cc737);}return _0x4be56d['sendStatus'](0x194);};}function handleError(_0x2a7cb5,_0x41302d){_0x41302d=_0x41302d||0x1f4;return function(_0x445a51){logger['error'](_0x445a51[_0x932c('0x11')]);if(_0x445a51['name']){delete _0x445a51[_0x932c('0x12')];}_0x2a7cb5[_0x932c('0xf')](_0x41302d)[_0x932c('0x13')](_0x445a51);};}function findById(_0x4d08ea){return function(_0x4f9c3b){if(!_[_0x932c('0x14')](_0x4d08ea)&&!_[_0x932c('0x14')](_0x4f9c3b)&&!_['isNil'](_0x4f9c3b[_0x932c('0x15')])){return _[_0x932c('0x16')](_0x4f9c3b[_0x932c('0x15')],function(_0x5124a4){return _0x5124a4['id']==_0x4d08ea;});}return null;};}exports[_0x932c('0x17')]=function(_0x33a072,_0x33513a){return respondWithRpcPromise(_0x932c('0x18'),_0x33a072[_0x932c('0x19')])[_0x932c('0xb')](respondWithResult(_0x33513a,null))[_0x932c('0xe')](handleError(_0x33513a,null));};exports[_0x932c('0x1a')]=function(_0x51af2f,_0xbf91e8){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x932c('0x1b')](_0x51af2f[_0x932c('0x19')],_0x51af2f[_0x932c('0x1c')]))['then'](respondWithResult(_0xbf91e8,null))[_0x932c('0xe')](handleError(_0xbf91e8,null));};exports[_0x932c('0x1d')]=function(_0x3d0b70,_0x1d08a8){return respondWithRpcPromise(_0x932c('0x1e'),_[_0x932c('0x1b')](_0x3d0b70[_0x932c('0x19')],_0x3d0b70['params']))[_0x932c('0xb')](respondWithResult(_0x1d08a8,null))[_0x932c('0xe')](handleError(_0x1d08a8,null));};exports[_0x932c('0x1f')]=function(_0x263163,_0x292b19){return respondWithRpcPromise(_0x932c('0x20'),_0x263163[_0x932c('0x19')])[_0x932c('0xb')](respondWithResult(_0x292b19,null))[_0x932c('0xe')](handleError(_0x292b19,null));};exports['showVoiceQueues']=function(_0x1d3578,_0x56f722){return respondWithRpcPromise(_0x932c('0x20'),_0x1d3578['query'])[_0x932c('0xb')](findById(_0x1d3578['params']['id']))[_0x932c('0xb')](respondWithResult(_0x56f722,null))[_0x932c('0xe')](handleError(_0x56f722,null));};exports[_0x932c('0x21')]=function(_0x89b48c,_0x3a80ec){return respondWithRpcPromise(_0x932c('0x22'),_['merge'](_0x89b48c['query'],_0x89b48c['params']))[_0x932c('0xb')](respondWithResult(_0x3a80ec,null))[_0x932c('0xe')](handleError(_0x3a80ec,null));};exports[_0x932c('0x23')]=function(_0x5e5c0f,_0x2dcaa4){return respondWithRpcPromise(_0x932c('0x24'),_0x5e5c0f[_0x932c('0x19')])[_0x932c('0xb')](respondWithResult(_0x2dcaa4,null))['catch'](handleError(_0x2dcaa4,null));};exports[_0x932c('0x25')]=function(_0x2fad4e,_0x3d613e){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x932c('0x1b')](_0x2fad4e[_0x932c('0x19')],_0x2fad4e['params']))[_0x932c('0xb')](respondWithResult(_0x3d613e,null))[_0x932c('0xe')](handleError(_0x3d613e,null));};exports[_0x932c('0x26')]=function(_0x3c2125,_0x2a3234){return respondWithRpcPromise(_0x932c('0x27'),_[_0x932c('0x1b')](_0x3c2125[_0x932c('0x19')],_0x3c2125[_0x932c('0x1c')]))[_0x932c('0xb')](respondWithResult(_0x2a3234,null))['catch'](handleError(_0x2a3234,null));};exports[_0x932c('0x28')]=function(_0x60237c,_0x4280c8){return respondWithRpcPromise(_0x932c('0x29'),_[_0x932c('0x1b')](_0x60237c[_0x932c('0x19')],_0x60237c['params']))[_0x932c('0xb')](respondWithResult(_0x4280c8,null))[_0x932c('0xe')](handleError(_0x4280c8,null));};exports[_0x932c('0x2a')]=function(_0x41964,_0x1752f7){return respondWithRpcPromise(_0x932c('0x2b'),_0x41964[_0x932c('0x19')])['then'](respondWithResult(_0x1752f7,null))[_0x932c('0xe')](handleError(_0x1752f7,null));};exports[_0x932c('0x2c')]=function(_0x577486,_0x524e4c){return respondWithRpcPromise(_0x932c('0x2d'),_0x577486['query'])[_0x932c('0xb')](respondWithResult(_0x524e4c,null))[_0x932c('0xe')](handleError(_0x524e4c,null));};exports[_0x932c('0x2e')]=function(_0x5dd19d,_0x1e0d64){var _0x16e874;return respondWithRpcPromise(_0x932c('0x2f'),_0x5dd19d[_0x932c('0x19')])[_0x932c('0xb')](function(_0x135770){_0x16e874=_0x135770;return respondWithRpcPromise(_0x932c('0x2f'),_0x5dd19d[_0x932c('0x19')],routingClient);})[_0x932c('0xb')](function(_0x36d5a2){return _[_0x932c('0x1b')]({},_0x36d5a2,_0x16e874);})[_0x932c('0xb')](respondWithResult(_0x1e0d64,null))['catch'](handleError(_0x1e0d64,null));};exports[_0x932c('0x30')]=function(_0x1ca3df,_0x2df18b){if(_0x1ca3df['body']&&_0x1ca3df['body'][_0x932c('0x31')]&&_0x1ca3df[_0x932c('0x32')]&&_0x1ca3df['user'][_0x932c('0x12')]){for(var _0x14e765 in _0x1ca3df[_0x932c('0x33')]['interaction']){if(_0x1ca3df[_0x932c('0x33')][_0x932c('0x31')][_0x932c('0x34')](_0x14e765)){db[_0x932c('0x35')]['findAll']({'where':{'channel':_0x14e765,'membername':_0x1ca3df['user'][_0x932c('0x12')],'type':_0x932c('0x36'),'exitAt':null,'uniqueid':_0x1ca3df[_0x932c('0x33')][_0x932c('0x31')][_0x14e765]&&_0x1ca3df[_0x932c('0x33')]['interaction'][_0x14e765]['length']?{'$notIn':_0x1ca3df['body'][_0x932c('0x31')][_0x14e765]}:{'$ne':null}}})[_0x932c('0xb')](function(_0x39813d){var _0x53d7a5=moment()[_0x932c('0x37')](_0x932c('0x38'));for(var _0x544111=0x0,_0x4c895d=_0x39813d['length'];_0x544111<_0x4c895d;_0x544111+=0x1){_0x39813d[_0x544111][_0x932c('0x39')]({'exitAt':_0x53d7a5});}});for(var _0x289788=0x0;_0x289788<_0x1ca3df[_0x932c('0x33')]['interaction'][_0x14e765]['length'];_0x289788+=0x1){db[_0x932c('0x35')][_0x932c('0x3a')]({'where':{'channel':_0x14e765,'membername':_0x1ca3df[_0x932c('0x32')][_0x932c('0x12')],'type':_0x932c('0x36'),'uniqueid':_0x1ca3df[_0x932c('0x33')][_0x932c('0x31')][_0x14e765][_0x289788],'exitAt':null},'defaults':{'channel':_0x14e765,'membername':_0x1ca3df[_0x932c('0x32')][_0x932c('0x12')],'interface':_[_0x932c('0x14')](_0x1ca3df[_0x932c('0x32')][_0x932c('0x3b')])?util[_0x932c('0x37')](_0x932c('0x3c'),_0x1ca3df[_0x932c('0x32')][_0x932c('0x12')]):_0x1ca3df[_0x932c('0x32')][_0x932c('0x3b')],'type':_0x932c('0x36'),'enterAt':moment()[_0x932c('0x37')](_0x932c('0x38')),'role':_0x932c('0x3d'),'internal':_0x1ca3df['user'][_0x932c('0x3e')],'uniqueid':_0x1ca3df[_0x932c('0x33')][_0x932c('0x31')][_0x14e765][_0x289788]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x1ca3df[_0x932c('0x1c')]['id'],'capacity':_0x1ca3df[_0x932c('0x33')][_0x932c('0x3f')]},routingClient)[_0x932c('0xb')](respondWithResult(_0x2df18b,null))[_0x932c('0xe')](handleError(_0x2df18b,null));};exports['telephones']=function(_0x4d539c,_0x2423e6){return respondWithRpcPromise(_0x932c('0x40'),_0x4d539c[_0x932c('0x19')])[_0x932c('0xb')](respondWithResult(_0x2423e6,null))[_0x932c('0xe')](handleError(_0x2423e6,null));};exports[_0x932c('0x41')]=function(_0x3b8de1,_0x1a28a2){return respondWithRpcPromise('Trunks',_0x3b8de1[_0x932c('0x19')])[_0x932c('0xb')](respondWithResult(_0x1a28a2,null))[_0x932c('0xe')](handleError(_0x1a28a2,null));};exports[_0x932c('0x42')]=function(_0x2fc0de,_0x1e8951){return respondWithRpcPromise(_0x932c('0x43'),_0x2fc0de[_0x932c('0x19')])[_0x932c('0xb')](respondWithResult(_0x1e8951,null))['catch'](handleError(_0x1e8951,null));};exports[_0x932c('0x44')]=function(_0x4d2dbe,_0x2f1cf1){return respondWithRpcPromise(_0x932c('0x45'),_0x4d2dbe[_0x932c('0x19')],routingClient)[_0x932c('0xb')](respondWithResult(_0x2f1cf1,null))[_0x932c('0xe')](handleError(_0x2f1cf1,null));};exports[_0x932c('0x46')]=function(_0x2a372d,_0x459ffe){return respondWithRpcPromise(_0x932c('0x45'),_0x2a372d[_0x932c('0x19')],routingClient)[_0x932c('0xb')](findById(_0x2a372d['params']['id']))[_0x932c('0xb')](respondWithResult(_0x459ffe,null))['catch'](handleError(_0x459ffe,null));};exports[_0x932c('0x47')]=function(_0x3aabd3,_0x4c4673){return respondWithRpcPromise(_0x932c('0x48'),_0x3aabd3['query'],routingClient)[_0x932c('0xb')](respondWithResult(_0x4c4673,null))[_0x932c('0xe')](handleError(_0x4c4673,null));};exports['showMailQueues']=function(_0x1cec6e,_0x414fab){return respondWithRpcPromise(_0x932c('0x48'),_0x1cec6e[_0x932c('0x19')],routingClient)[_0x932c('0xb')](findById(_0x1cec6e['params']['id']))[_0x932c('0xb')](respondWithResult(_0x414fab,null))[_0x932c('0xe')](handleError(_0x414fab,null));};exports['mailAccounts']=function(_0x414278,_0x489323){return respondWithRpcPromise(_0x932c('0x49'),_0x414278[_0x932c('0x19')],mailClient)[_0x932c('0xb')](respondWithResult(_0x489323,null))[_0x932c('0xe')](handleError(_0x489323,null));};exports[_0x932c('0x4a')]=function(_0x3959a0,_0x2224ed){return respondWithRpcPromise(_0x932c('0x4b'),_0x3959a0[_0x932c('0x19')],routingClient)[_0x932c('0xb')](respondWithResult(_0x2224ed,null))[_0x932c('0xe')](handleError(_0x2224ed,null));};exports[_0x932c('0x4c')]=function(_0xda856,_0x41d6b0){return respondWithRpcPromise('OpenchannelQueues',_0xda856[_0x932c('0x19')],routingClient)['then'](findById(_0xda856['params']['id']))[_0x932c('0xb')](respondWithResult(_0x41d6b0,null))[_0x932c('0xe')](handleError(_0x41d6b0,null));};exports[_0x932c('0x4d')]=function(_0x2c0f73,_0x4e3eef){return respondWithRpcPromise(_0x932c('0x4e'),_0x2c0f73['query'],routingClient)[_0x932c('0xb')](respondWithResult(_0x4e3eef,null))[_0x932c('0xe')](handleError(_0x4e3eef,null));};exports[_0x932c('0x4f')]=function(_0x532943,_0x1d88f2){return respondWithRpcPromise(_0x932c('0x4e'),_0x532943[_0x932c('0x19')],routingClient)[_0x932c('0xb')](findById(_0x532943[_0x932c('0x1c')]['id']))[_0x932c('0xb')](respondWithResult(_0x1d88f2,null))[_0x932c('0xe')](handleError(_0x1d88f2,null));};exports[_0x932c('0x50')]=function(_0x59029b,_0x5c176){return respondWithRpcPromise(_0x932c('0x51'),_0x59029b[_0x932c('0x19')],routingClient)[_0x932c('0xb')](respondWithResult(_0x5c176,null))[_0x932c('0xe')](handleError(_0x5c176,null));};exports[_0x932c('0x52')]=function(_0x49f796,_0x1fb7e5){return respondWithRpcPromise('WhatsappQueues',_0x49f796[_0x932c('0x19')],routingClient)[_0x932c('0xb')](findById(_0x49f796['params']['id']))[_0x932c('0xb')](respondWithResult(_0x1fb7e5,null))['catch'](handleError(_0x1fb7e5,null));};exports[_0x932c('0x53')]=function(_0x356022,_0x5855ee){return respondWithRpcPromise(_0x932c('0x54'),_0x356022[_0x932c('0x19')],routingClient)[_0x932c('0xb')](respondWithResult(_0x5855ee,null))[_0x932c('0xe')](handleError(_0x5855ee,null));};exports[_0x932c('0x55')]=function(_0x48a188,_0x1f068b){return respondWithRpcPromise(_0x932c('0x54'),_0x48a188[_0x932c('0x19')],routingClient)[_0x932c('0xb')](findById(_0x48a188[_0x932c('0x1c')]['id']))['then'](respondWithResult(_0x1f068b,null))[_0x932c('0xe')](handleError(_0x1f068b,null));};exports['faxAccounts']=function(_0x4ec9c2,_0x539037){return respondWithRpcPromise(_0x932c('0x56'),_0x4ec9c2[_0x932c('0x19')])[_0x932c('0xb')](respondWithResult(_0x539037,null))[_0x932c('0xe')](handleError(_0x539037,null));};exports[_0x932c('0x57')]=function(_0x4998d7,_0x4c98ba){return respondWithRpcPromise(_0x932c('0x58'),_0x4998d7[_0x932c('0x19')],routingClient)[_0x932c('0xb')](respondWithResult(_0x4c98ba,null))['catch'](handleError(_0x4c98ba,null));};exports[_0x932c('0x59')]=function(_0x497b99,_0x433ecf){return respondWithRpcPromise(_0x932c('0x5a'),_0x497b99[_0x932c('0x19')],routingClient)[_0x932c('0xb')](respondWithResult(_0x433ecf,null))[_0x932c('0xe')](handleError(_0x433ecf,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x542b1c,_0x5c09cd){return respondWithRpcPromise(_0x932c('0x5b'),_0x542b1c[_0x932c('0x19')],routingClient)['then'](respondWithResult(_0x5c09cd,null))[_0x932c('0xe')](handleError(_0x5c09cd,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x5e8c3a,_0x3fc39b){return respondWithRpcPromise(_0x932c('0x5b'),_0x5e8c3a['query'],routingClient)[_0x932c('0xb')](function(_0x51e610){if(_0x5e8c3a['query']['type']!==undefined){var _0x243ee6=_(_0x51e610['rows'])['filter']([_0x5e8c3a[_0x932c('0x19')][_0x932c('0x5c')],_0x5e8c3a['params']['id']])[_0x932c('0x5d')](_0x932c('0x5e'))['uniq']()[_0x932c('0x5f')]();return _0x51e610[_0x932c('0x15')][_0x932c('0x60')](function(_0x28ae02){return _0x243ee6[_0x932c('0x61')](_0x28ae02['queue_id'])>-0x1;});}else{return _0x51e610[_0x932c('0x15')][_0x932c('0x60')](function(_0xc7d9c2){return _0xc7d9c2[_0x932c('0x5e')]===parseInt(_0x5e8c3a[_0x932c('0x1c')]['id']);});}})[_0x932c('0xb')](respondWithResult(_0x3fc39b,null))['catch'](handleError(_0x3fc39b,null));};exports['smsQueuesWaitingInteractions']=function(_0x3900e6,_0x8f6471){return respondWithRpcPromise(_0x932c('0x62'),_0x3900e6['query'],routingClient)['then'](respondWithResult(_0x8f6471,null))[_0x932c('0xe')](handleError(_0x8f6471,null));};exports[_0x932c('0x63')]=function(_0x308816,_0x542518){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x308816[_0x932c('0x19')],routingClient)[_0x932c('0xb')](respondWithResult(_0x542518,null))['catch'](handleError(_0x542518,null));};exports[_0x932c('0x64')]=function(_0x30fcb0,_0x4e51c2){return respondWithRpcPromise(_0x932c('0x65'),_0x30fcb0['query'],routingClient)[_0x932c('0xb')](respondWithResult(_0x4e51c2,null))[_0x932c('0xe')](handleError(_0x4e51c2,null));};exports['queueNotify']=function(_0x506b79){return function(_0x3b43ef,_0x1804fc){var _0x3baab3,_0x42ab40;var _0x3a3901=_[_0x932c('0x66')](_0x506b79);var _0x1e9c34=_0x506b79===_0x932c('0x67')?_0x932c('0x68'):_0x932c('0x69');return db[_0x3a3901+_0x932c('0x6a')]['findOne']({'raw':!![],'where':{'id':_0x3b43ef[_0x932c('0x1c')]['id']}})['then'](function(_0xcbf0ef){if(_[_0x932c('0x14')](_0xcbf0ef)){throw new Error(_0x3a3901+'\x20Queue\x20not\x20found');}_0x3baab3=_0xcbf0ef;return db[_0x3a3901+_0x932c('0x6b')]['findOne']({'where':{'id':_0x3b43ef[_0x932c('0x33')][_0x932c('0x6c')]},'include':[{'model':db[_0x3a3901+_0x932c('0x6d')],'as':_0x932c('0x6d')},{'model':db[_0x3a3901+_0x1e9c34],'as':_0x932c('0x69')}]});})[_0x932c('0xb')](function(_0x591039){if(_['isNil'](_0x591039)){throw new Error(_0x3a3901+_0x932c('0x6e'));}_0x42ab40=_0x591039;return _0x591039['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x932c('0xb')](function(){var _0x334617={'uniqueid':_0x506b79+'.'+_0x42ab40['id']+'.'+_0x42ab40['Interaction']['id'],'FromUserId':_0x3b43ef[_0x932c('0x32')]['id'],'type':_0x932c('0x6f')};_0x334617[_0x3a3901+_0x932c('0x70')]=_0x42ab40['id'];_0x334617[_0x3a3901+_0x932c('0x71')]=_0x42ab40['Interaction']['id'];_0x334617['From'+_0x3a3901+_0x1e9c34+'Id']=_0x42ab40[_0x932c('0x69')]['id'];_0x334617['To'+_0x3a3901+_0x932c('0x72')]=_0x3baab3['id'];return db[_0x3a3901+_0x932c('0x73')][_0x932c('0x74')](_0x334617);})[_0x932c('0xb')](function(){return respondWithRpcPromise(_0x932c('0x75'),{'channel':_0x506b79,'interaction':_0x42ab40[_0x932c('0x6d')],'message':_0x42ab40,'account':_0x42ab40[_0x932c('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0x932c('0x6f'),'appdata':_0x3baab3[_0x932c('0x12')]+','+(_0x42ab40['Account'][_0x932c('0x76')]||0x12c),'interval':_0x932c('0x77')}]},routingClient);})['then'](respondWithResult(_0x1804fc,null))[_0x932c('0xe')](handleError(_0x1804fc,null));};};exports['agentNotify']=function(_0x2c8d08,_0x51237e){var _0x216a08,_0x53422b;if(_[_0x932c('0x14')](_0x2c8d08[_0x932c('0x33')][_0x932c('0x78')])){throw new Error(_0x932c('0x79'));}var _0x5c707e=_0x2c8d08[_0x932c('0x33')][_0x932c('0x78')];var _0x51fcba=_['capitalize'](_0x5c707e);var _0x4a5683=_0x5c707e===_0x932c('0x67')?_0x932c('0x68'):'Account';return db[_0x932c('0x7a')][_0x932c('0x7b')]({'raw':!![],'where':{'id':_0x2c8d08[_0x932c('0x1c')]['id'],'role':_0x932c('0x3d')}})['then'](function(_0x21389c){if(_[_0x932c('0x14')](_0x21389c)){throw new Error('Agent\x20not\x20found');}_0x216a08=_0x21389c;return db[_0x51fcba+_0x932c('0x6b')][_0x932c('0x7b')]({'where':{'id':_0x2c8d08[_0x932c('0x33')]['messageId']},'include':[{'model':db[_0x51fcba+_0x932c('0x6d')],'as':'Interaction'},{'model':db[_0x51fcba+_0x4a5683],'as':'Account'}]});})[_0x932c('0xb')](function(_0xc53b0c){if(_[_0x932c('0x14')](_0xc53b0c)){throw new Error(_0x51fcba+'\x20Message\x20not\x20found');}_0x53422b=_0xc53b0c;return _0xc53b0c[_0x932c('0x7c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x932c('0xb')](function(){var _0x3f319b={'uniqueid':_0x5c707e+'.'+_0x53422b['id']+'.'+_0x53422b[_0x932c('0x6d')]['id'],'FromUserId':_0x2c8d08[_0x932c('0x32')]['id'],'type':'queue','ToUserId':_0x216a08['id']};_0x3f319b[_0x51fcba+'MessageId']=_0x53422b['id'];_0x3f319b[_0x51fcba+_0x932c('0x71')]=_0x53422b[_0x932c('0x6d')]['id'];_0x3f319b[_0x932c('0x7d')+_0x51fcba+_0x4a5683+'Id']=_0x53422b['Account']['id'];return db[_0x51fcba+'TransferReport']['create'](_0x3f319b);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x5c707e,'interaction':_0x53422b['Interaction'],'message':_0x53422b,'account':_0x53422b[_0x932c('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x216a08[_0x932c('0x12')]+','+(_0x53422b['Account'][_0x932c('0x7e')]||0x12c),'interval':_0x932c('0x77')}]},routingClient);})[_0x932c('0xb')](respondWithResult(_0x51237e,null))['catch'](handleError(_0x51237e,null));}; \ No newline at end of file +var _0xeadc=['OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','length','INTERACTION','SIP/%s','interface','internal','AgentCapacity','Telephones','trunks','Trunks','campaigns','showChatQueues','ChatQueues','mailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','Website','Account','findOne','Message','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','channel','capitalize','chat','User','agent','Agent\x20not\x20found','messageId','From','agentTransferTimeout','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','error','code','message','catch','json','sendStatus','stack','name','status','isNil','rows','find','voiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','outbound','Outbound'];(function(_0x226f50,_0x55da2f){var _0x4c0544=function(_0x22ec9e){while(--_0x22ec9e){_0x226f50['push'](_0x226f50['shift']());}};_0x4c0544(++_0x55da2f);}(_0xeadc,0xcd));var _0xcead=function(_0xa94d36,_0x1693af){_0xa94d36=_0xa94d36-0x0;var _0x5e81fc=_0xeadc[_0xa94d36];return _0x5e81fc;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require('lodash');var util=require(_0xcead('0x0'));var db=require(_0xcead('0x1'))['db'];var logger=require(_0xcead('0x2'))('api');var jayson=require(_0xcead('0x3'));var amiClient=jayson[_0xcead('0x4')]['http']({'port':0x232a});var mailClient=jayson[_0xcead('0x4')][_0xcead('0x5')]({'port':0x232b});var routingClient=jayson[_0xcead('0x4')][_0xcead('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x36f83b,_0x133de0,_0x48d005){return new BPromise(function(_0x1c07ab,_0x5a4985){var _0x224539=_0x48d005?_0x48d005:amiClient;return _0x224539[_0xcead('0x6')](_0x36f83b,_0x133de0)[_0xcead('0x7')](function(_0x5fd51a){if(_0x5fd51a[_0xcead('0x8')]){if(_0x5fd51a['error'][_0xcead('0x9')]===0x1f4){return _0x5a4985(_0x5fd51a['error']['message']);}return _0x1c07ab(_0x5fd51a['error'][_0xcead('0xa')]);}else{_0x1c07ab(_0x5fd51a['result']);}})[_0xcead('0xb')](function(_0xd4097b){_0x5a4985(_0xd4097b);});});}function respondWithResult(_0x3dec7d,_0x59d0b0){_0x59d0b0=_0x59d0b0||0xc8;return function(_0x4681bf){if(_0x4681bf){return _0x3dec7d['status'](_0x59d0b0)[_0xcead('0xc')](_0x4681bf);}return _0x3dec7d[_0xcead('0xd')](0x194);};}function handleError(_0x5b4865,_0x204506){_0x204506=_0x204506||0x1f4;return function(_0x5336ce){logger[_0xcead('0x8')](_0x5336ce[_0xcead('0xe')]);if(_0x5336ce[_0xcead('0xf')]){delete _0x5336ce[_0xcead('0xf')];}_0x5b4865[_0xcead('0x10')](_0x204506)['send'](_0x5336ce);};}function findById(_0x3a6026){return function(_0x40c3f4){if(!_[_0xcead('0x11')](_0x3a6026)&&!_[_0xcead('0x11')](_0x40c3f4)&&!_[_0xcead('0x11')](_0x40c3f4[_0xcead('0x12')])){return _[_0xcead('0x13')](_0x40c3f4[_0xcead('0x12')],function(_0x5159e8){return _0x5159e8['id']==_0x3a6026;});}return null;};}exports[_0xcead('0x14')]=function(_0x2b6711,_0x1fafce){return respondWithRpcPromise('VoiceChannels',_0x2b6711['query'])[_0xcead('0x7')](respondWithResult(_0x1fafce,null))['catch'](handleError(_0x1fafce,null));};exports[_0xcead('0x15')]=function(_0x337a0f,_0x3fbaf4){return respondWithRpcPromise(_0xcead('0x16'),_[_0xcead('0x17')](_0x337a0f[_0xcead('0x18')],_0x337a0f['params']))[_0xcead('0x7')](respondWithResult(_0x3fbaf4,null))[_0xcead('0xb')](handleError(_0x3fbaf4,null));};exports[_0xcead('0x19')]=function(_0xb22f7a,_0x2d94f4){return respondWithRpcPromise(_0xcead('0x1a'),_['merge'](_0xb22f7a['query'],_0xb22f7a[_0xcead('0x1b')]))[_0xcead('0x7')](respondWithResult(_0x2d94f4,null))[_0xcead('0xb')](handleError(_0x2d94f4,null));};exports[_0xcead('0x1c')]=function(_0x3e453b,_0x260d92){return respondWithRpcPromise('VoiceQueues',_0x3e453b[_0xcead('0x18')])['then'](respondWithResult(_0x260d92,null))[_0xcead('0xb')](handleError(_0x260d92,null));};exports['showVoiceQueues']=function(_0x6c095d,_0x4ce0e7){return respondWithRpcPromise(_0xcead('0x1d'),_0x6c095d['query'])['then'](findById(_0x6c095d['params']['id']))[_0xcead('0x7')](respondWithResult(_0x4ce0e7,null))['catch'](handleError(_0x4ce0e7,null));};exports['voiceQueuesPreview']=function(_0x1f56ff,_0x201bc5){return respondWithRpcPromise(_0xcead('0x1e'),_[_0xcead('0x17')](_0x1f56ff[_0xcead('0x18')],_0x1f56ff[_0xcead('0x1b')]))[_0xcead('0x7')](respondWithResult(_0x201bc5,null))[_0xcead('0xb')](handleError(_0x201bc5,null));};exports[_0xcead('0x1f')]=function(_0x27ef95,_0x4fec9d){return respondWithRpcPromise('VoiceQueuesChannels',_0x27ef95[_0xcead('0x18')])[_0xcead('0x7')](respondWithResult(_0x4fec9d,null))[_0xcead('0xb')](handleError(_0x4fec9d,null));};exports[_0xcead('0x20')]=function(_0x146625,_0xf5e5db){return respondWithRpcPromise(_0xcead('0x21'),_['merge'](_0x146625[_0xcead('0x18')],_0x146625[_0xcead('0x1b')]))[_0xcead('0x7')](respondWithResult(_0xf5e5db,null))[_0xcead('0xb')](handleError(_0xf5e5db,null));};exports[_0xcead('0x22')]=function(_0xd62a88,_0x28b368){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xcead('0x17')](_0xd62a88[_0xcead('0x18')],_0xd62a88['params']))['then'](respondWithResult(_0x28b368,null))[_0xcead('0xb')](handleError(_0x28b368,null));};exports['voiceQueuesChannelRedirect']=function(_0x5611d8,_0x569216){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xcead('0x17')](_0x5611d8['query'],_0x5611d8['params']))[_0xcead('0x7')](respondWithResult(_0x569216,null))[_0xcead('0xb')](handleError(_0x569216,null));};exports[_0xcead('0x23')]=function(_0x43523a,_0x421a20){return respondWithRpcPromise(_0xcead('0x24'),_0x43523a[_0xcead('0x18')])['then'](respondWithResult(_0x421a20,null))[_0xcead('0xb')](handleError(_0x421a20,null));};exports['outboundChannels']=function(_0x52724b,_0x21ad46){return respondWithRpcPromise(_0xcead('0x25'),_0x52724b[_0xcead('0x18')])[_0xcead('0x7')](respondWithResult(_0x21ad46,null))[_0xcead('0xb')](handleError(_0x21ad46,null));};exports[_0xcead('0x26')]=function(_0x528020,_0x5d8bc0){var _0x40acd1;return respondWithRpcPromise(_0xcead('0x27'),_0x528020[_0xcead('0x18')])[_0xcead('0x7')](function(_0x34e7cd){_0x40acd1=_0x34e7cd;return respondWithRpcPromise(_0xcead('0x27'),_0x528020[_0xcead('0x18')],routingClient);})[_0xcead('0x7')](function(_0x283f5c){return _[_0xcead('0x17')]({},_0x283f5c,_0x40acd1);})[_0xcead('0x7')](respondWithResult(_0x5d8bc0,null))[_0xcead('0xb')](handleError(_0x5d8bc0,null));};exports[_0xcead('0x28')]=function(_0x1c23fe,_0x1d8e7a){if(_0x1c23fe[_0xcead('0x29')]&&_0x1c23fe[_0xcead('0x29')][_0xcead('0x2a')]&&_0x1c23fe['user']&&_0x1c23fe[_0xcead('0x2b')]['name']){for(var _0x24ba83 in _0x1c23fe['body'][_0xcead('0x2a')]){if(_0x1c23fe[_0xcead('0x29')][_0xcead('0x2a')][_0xcead('0x2c')](_0x24ba83)){db[_0xcead('0x2d')]['findAll']({'where':{'channel':_0x24ba83,'membername':_0x1c23fe[_0xcead('0x2b')][_0xcead('0xf')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1c23fe[_0xcead('0x29')][_0xcead('0x2a')][_0x24ba83]&&_0x1c23fe[_0xcead('0x29')]['interaction'][_0x24ba83]['length']?{'$notIn':_0x1c23fe[_0xcead('0x29')][_0xcead('0x2a')][_0x24ba83]}:{'$ne':null}}})[_0xcead('0x7')](function(_0x274cee){var _0xf1b398=moment()[_0xcead('0x2e')](_0xcead('0x2f'));for(var _0x299618=0x0,_0x104e88=_0x274cee['length'];_0x299618<_0x104e88;_0x299618+=0x1){_0x274cee[_0x299618][_0xcead('0x30')]({'exitAt':_0xf1b398});}});for(var _0x28d426=0x0;_0x28d426<_0x1c23fe[_0xcead('0x29')][_0xcead('0x2a')][_0x24ba83][_0xcead('0x31')];_0x28d426+=0x1){db[_0xcead('0x2d')]['findOrCreate']({'where':{'channel':_0x24ba83,'membername':_0x1c23fe['user'][_0xcead('0xf')],'type':_0xcead('0x32'),'uniqueid':_0x1c23fe[_0xcead('0x29')][_0xcead('0x2a')][_0x24ba83][_0x28d426],'exitAt':null},'defaults':{'channel':_0x24ba83,'membername':_0x1c23fe[_0xcead('0x2b')][_0xcead('0xf')],'interface':_[_0xcead('0x11')](_0x1c23fe[_0xcead('0x2b')]['interface'])?util[_0xcead('0x2e')](_0xcead('0x33'),_0x1c23fe[_0xcead('0x2b')]['name']):_0x1c23fe[_0xcead('0x2b')][_0xcead('0x34')],'type':_0xcead('0x32'),'enterAt':moment()[_0xcead('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x1c23fe[_0xcead('0x2b')][_0xcead('0x35')],'uniqueid':_0x1c23fe[_0xcead('0x29')][_0xcead('0x2a')][_0x24ba83][_0x28d426]}});}}}}return respondWithRpcPromise(_0xcead('0x36'),{'id':_0x1c23fe[_0xcead('0x1b')]['id'],'capacity':_0x1c23fe[_0xcead('0x29')]['capacity']},routingClient)[_0xcead('0x7')](respondWithResult(_0x1d8e7a,null))[_0xcead('0xb')](handleError(_0x1d8e7a,null));};exports['telephones']=function(_0x46142c,_0x4e754a){return respondWithRpcPromise(_0xcead('0x37'),_0x46142c[_0xcead('0x18')])[_0xcead('0x7')](respondWithResult(_0x4e754a,null))[_0xcead('0xb')](handleError(_0x4e754a,null));};exports[_0xcead('0x38')]=function(_0x1ee4ec,_0xeaffeb){return respondWithRpcPromise(_0xcead('0x39'),_0x1ee4ec['query'])[_0xcead('0x7')](respondWithResult(_0xeaffeb,null))['catch'](handleError(_0xeaffeb,null));};exports[_0xcead('0x3a')]=function(_0x444c8c,_0x28e07f){return respondWithRpcPromise('Campaigns',_0x444c8c['query'])[_0xcead('0x7')](respondWithResult(_0x28e07f,null))[_0xcead('0xb')](handleError(_0x28e07f,null));};exports['chatQueues']=function(_0x5ed9cf,_0x585a9c){return respondWithRpcPromise('ChatQueues',_0x5ed9cf[_0xcead('0x18')],routingClient)[_0xcead('0x7')](respondWithResult(_0x585a9c,null))[_0xcead('0xb')](handleError(_0x585a9c,null));};exports[_0xcead('0x3b')]=function(_0x3d8dc9,_0x21a172){return respondWithRpcPromise(_0xcead('0x3c'),_0x3d8dc9[_0xcead('0x18')],routingClient)[_0xcead('0x7')](findById(_0x3d8dc9['params']['id']))[_0xcead('0x7')](respondWithResult(_0x21a172,null))['catch'](handleError(_0x21a172,null));};exports[_0xcead('0x3d')]=function(_0x6ad29,_0x45876a){return respondWithRpcPromise('MailQueues',_0x6ad29['query'],routingClient)[_0xcead('0x7')](respondWithResult(_0x45876a,null))[_0xcead('0xb')](handleError(_0x45876a,null));};exports[_0xcead('0x3e')]=function(_0x5a64ef,_0x5da9ce){return respondWithRpcPromise('MailQueues',_0x5a64ef['query'],routingClient)[_0xcead('0x7')](findById(_0x5a64ef[_0xcead('0x1b')]['id']))[_0xcead('0x7')](respondWithResult(_0x5da9ce,null))[_0xcead('0xb')](handleError(_0x5da9ce,null));};exports[_0xcead('0x3f')]=function(_0xb0fa5e,_0x3bbcc3){return respondWithRpcPromise(_0xcead('0x40'),_0xb0fa5e['query'],mailClient)['then'](respondWithResult(_0x3bbcc3,null))['catch'](handleError(_0x3bbcc3,null));};exports[_0xcead('0x41')]=function(_0x224803,_0x5c65f2){return respondWithRpcPromise('OpenchannelQueues',_0x224803['query'],routingClient)[_0xcead('0x7')](respondWithResult(_0x5c65f2,null))[_0xcead('0xb')](handleError(_0x5c65f2,null));};exports[_0xcead('0x42')]=function(_0x5740dc,_0xb5785f){return respondWithRpcPromise(_0xcead('0x43'),_0x5740dc[_0xcead('0x18')],routingClient)[_0xcead('0x7')](findById(_0x5740dc[_0xcead('0x1b')]['id']))[_0xcead('0x7')](respondWithResult(_0xb5785f,null))[_0xcead('0xb')](handleError(_0xb5785f,null));};exports[_0xcead('0x44')]=function(_0x473e0d,_0x27f9f4){return respondWithRpcPromise(_0xcead('0x45'),_0x473e0d[_0xcead('0x18')],routingClient)[_0xcead('0x7')](respondWithResult(_0x27f9f4,null))[_0xcead('0xb')](handleError(_0x27f9f4,null));};exports[_0xcead('0x46')]=function(_0x2cf99d,_0x5880c5){return respondWithRpcPromise(_0xcead('0x45'),_0x2cf99d[_0xcead('0x18')],routingClient)[_0xcead('0x7')](findById(_0x2cf99d[_0xcead('0x1b')]['id']))[_0xcead('0x7')](respondWithResult(_0x5880c5,null))[_0xcead('0xb')](handleError(_0x5880c5,null));};exports[_0xcead('0x47')]=function(_0x1de9b7,_0x5c9d47){return respondWithRpcPromise(_0xcead('0x48'),_0x1de9b7[_0xcead('0x18')],routingClient)[_0xcead('0x7')](respondWithResult(_0x5c9d47,null))['catch'](handleError(_0x5c9d47,null));};exports[_0xcead('0x49')]=function(_0x4dd8df,_0x45ad93){return respondWithRpcPromise(_0xcead('0x48'),_0x4dd8df[_0xcead('0x18')],routingClient)['then'](findById(_0x4dd8df['params']['id']))['then'](respondWithResult(_0x45ad93,null))[_0xcead('0xb')](handleError(_0x45ad93,null));};exports[_0xcead('0x4a')]=function(_0x3be828,_0xc0ff62){return respondWithRpcPromise(_0xcead('0x4b'),_0x3be828[_0xcead('0x18')],routingClient)[_0xcead('0x7')](respondWithResult(_0xc0ff62,null))[_0xcead('0xb')](handleError(_0xc0ff62,null));};exports[_0xcead('0x4c')]=function(_0x5290d6,_0x619468){return respondWithRpcPromise(_0xcead('0x4b'),_0x5290d6[_0xcead('0x18')],routingClient)['then'](findById(_0x5290d6[_0xcead('0x1b')]['id']))[_0xcead('0x7')](respondWithResult(_0x619468,null))[_0xcead('0xb')](handleError(_0x619468,null));};exports[_0xcead('0x4d')]=function(_0x15edb7,_0xd2357c){return respondWithRpcPromise(_0xcead('0x4e'),_0x15edb7[_0xcead('0x18')])[_0xcead('0x7')](respondWithResult(_0xd2357c,null))[_0xcead('0xb')](handleError(_0xd2357c,null));};exports[_0xcead('0x4f')]=function(_0x1290dc,_0x2f49a5){return respondWithRpcPromise(_0xcead('0x50'),_0x1290dc[_0xcead('0x18')],routingClient)['then'](respondWithResult(_0x2f49a5,null))[_0xcead('0xb')](handleError(_0x2f49a5,null));};exports[_0xcead('0x51')]=function(_0x49bd45,_0x8b5546){return respondWithRpcPromise(_0xcead('0x52'),_0x49bd45[_0xcead('0x18')],routingClient)[_0xcead('0x7')](respondWithResult(_0x8b5546,null))[_0xcead('0xb')](handleError(_0x8b5546,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x1803e8,_0x3b5a4c){return respondWithRpcPromise(_0xcead('0x53'),_0x1803e8['query'],routingClient)['then'](respondWithResult(_0x3b5a4c,null))[_0xcead('0xb')](handleError(_0x3b5a4c,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x9ab9db,_0x4ddc8e){return respondWithRpcPromise(_0xcead('0x53'),_0x9ab9db[_0xcead('0x18')],routingClient)[_0xcead('0x7')](function(_0x471df6){if(_0x9ab9db[_0xcead('0x18')]['type']!==undefined){var _0x3138a6=_(_0x471df6[_0xcead('0x12')])['filter']([_0x9ab9db['query'][_0xcead('0x54')],_0x9ab9db['params']['id']])['map'](_0xcead('0x55'))[_0xcead('0x56')]()[_0xcead('0x57')]();return _0x471df6[_0xcead('0x12')][_0xcead('0x58')](function(_0xcfe3b){return _0x3138a6[_0xcead('0x59')](_0xcfe3b[_0xcead('0x55')])>-0x1;});}else{return _0x471df6['rows']['filter'](function(_0x56aa03){return _0x56aa03[_0xcead('0x55')]===parseInt(_0x9ab9db[_0xcead('0x1b')]['id']);});}})[_0xcead('0x7')](respondWithResult(_0x4ddc8e,null))[_0xcead('0xb')](handleError(_0x4ddc8e,null));};exports[_0xcead('0x5a')]=function(_0x1c99ef,_0x57d4e9){return respondWithRpcPromise(_0xcead('0x5b'),_0x1c99ef['query'],routingClient)[_0xcead('0x7')](respondWithResult(_0x57d4e9,null))[_0xcead('0xb')](handleError(_0x57d4e9,null));};exports[_0xcead('0x5c')]=function(_0x3cfed9,_0x2dff70){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x3cfed9[_0xcead('0x18')],routingClient)[_0xcead('0x7')](respondWithResult(_0x2dff70,null))[_0xcead('0xb')](handleError(_0x2dff70,null));};exports[_0xcead('0x5d')]=function(_0x4afc5f,_0x4e1797){return respondWithRpcPromise(_0xcead('0x5e'),_0x4afc5f['query'],routingClient)['then'](respondWithResult(_0x4e1797,null))[_0xcead('0xb')](handleError(_0x4e1797,null));};exports[_0xcead('0x5f')]=function(_0x49b4b8){return function(_0x4355f0,_0x5719b2){var _0x51b580,_0x322a8b;var _0x493a0a=_['capitalize'](_0x49b4b8);var _0x22e588=_0x49b4b8==='chat'?_0xcead('0x60'):_0xcead('0x61');return db[_0x493a0a+'Queue'][_0xcead('0x62')]({'raw':!![],'where':{'id':_0x4355f0[_0xcead('0x1b')]['id']}})['then'](function(_0x259e9f){if(_[_0xcead('0x11')](_0x259e9f)){throw new Error(_0x493a0a+'\x20Queue\x20not\x20found');}_0x51b580=_0x259e9f;return db[_0x493a0a+_0xcead('0x63')][_0xcead('0x62')]({'where':{'id':_0x4355f0['body']['messageId']},'include':[{'model':db[_0x493a0a+_0xcead('0x64')],'as':_0xcead('0x64')},{'model':db[_0x493a0a+_0x22e588],'as':_0xcead('0x61')}]});})[_0xcead('0x7')](function(_0x28943b){if(_[_0xcead('0x11')](_0x28943b)){throw new Error(_0x493a0a+_0xcead('0x65'));}_0x322a8b=_0x28943b;return _0x28943b[_0xcead('0x66')]({'read':0x0,'readAt':null,'UserId':null});})[_0xcead('0x7')](function(){var _0x2030ce={'uniqueid':_0x49b4b8+'.'+_0x322a8b['id']+'.'+_0x322a8b[_0xcead('0x64')]['id'],'FromUserId':_0x4355f0[_0xcead('0x2b')]['id'],'type':_0xcead('0x67')};_0x2030ce[_0x493a0a+_0xcead('0x68')]=_0x322a8b['id'];_0x2030ce[_0x493a0a+_0xcead('0x69')]=_0x322a8b[_0xcead('0x64')]['id'];_0x2030ce['From'+_0x493a0a+_0x22e588+'Id']=_0x322a8b[_0xcead('0x61')]['id'];_0x2030ce['To'+_0x493a0a+_0xcead('0x6a')]=_0x51b580['id'];return db[_0x493a0a+_0xcead('0x6b')][_0xcead('0x6c')](_0x2030ce);})['then'](function(){return respondWithRpcPromise(_0xcead('0x6d'),{'channel':_0x49b4b8,'interaction':_0x322a8b[_0xcead('0x64')],'message':_0x322a8b,'account':_0x322a8b['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xcead('0x67'),'appdata':_0x51b580[_0xcead('0xf')]+','+(_0x322a8b[_0xcead('0x61')][_0xcead('0x6e')]||0x12c),'interval':_0xcead('0x6f')}]},routingClient);})[_0xcead('0x7')](respondWithResult(_0x5719b2,null))[_0xcead('0xb')](handleError(_0x5719b2,null));};};exports['agentNotify']=function(_0x4ab761,_0xd38526){var _0x4ea62f,_0x434492;if(_['isNil'](_0x4ab761[_0xcead('0x29')]['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x524e5c=_0x4ab761['body'][_0xcead('0x70')];var _0x187be3=_[_0xcead('0x71')](_0x524e5c);var _0x38e7b7=_0x524e5c===_0xcead('0x72')?_0xcead('0x60'):_0xcead('0x61');return db[_0xcead('0x73')][_0xcead('0x62')]({'raw':!![],'where':{'id':_0x4ab761['params']['id'],'role':_0xcead('0x74')}})['then'](function(_0x3cb90b){if(_[_0xcead('0x11')](_0x3cb90b)){throw new Error(_0xcead('0x75'));}_0x4ea62f=_0x3cb90b;return db[_0x187be3+_0xcead('0x63')][_0xcead('0x62')]({'where':{'id':_0x4ab761[_0xcead('0x29')][_0xcead('0x76')]},'include':[{'model':db[_0x187be3+_0xcead('0x64')],'as':_0xcead('0x64')},{'model':db[_0x187be3+_0x38e7b7],'as':'Account'}]});})[_0xcead('0x7')](function(_0x245e3b){if(_[_0xcead('0x11')](_0x245e3b)){throw new Error(_0x187be3+_0xcead('0x65'));}_0x434492=_0x245e3b;return _0x245e3b[_0xcead('0x66')]({'read':0x0,'readAt':null,'UserId':null});})[_0xcead('0x7')](function(){var _0x56b998={'uniqueid':_0x524e5c+'.'+_0x434492['id']+'.'+_0x434492[_0xcead('0x64')]['id'],'FromUserId':_0x4ab761[_0xcead('0x2b')]['id'],'type':_0xcead('0x67'),'ToUserId':_0x4ea62f['id']};_0x56b998[_0x187be3+'MessageId']=_0x434492['id'];_0x56b998[_0x187be3+_0xcead('0x69')]=_0x434492[_0xcead('0x64')]['id'];_0x56b998[_0xcead('0x77')+_0x187be3+_0x38e7b7+'Id']=_0x434492[_0xcead('0x61')]['id'];return db[_0x187be3+_0xcead('0x6b')][_0xcead('0x6c')](_0x56b998);})[_0xcead('0x7')](function(){return respondWithRpcPromise(_0xcead('0x6d'),{'channel':_0x524e5c,'interaction':_0x434492[_0xcead('0x64')],'message':_0x434492,'account':_0x434492[_0xcead('0x61')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x4ea62f[_0xcead('0xf')]+','+(_0x434492[_0xcead('0x61')][_0xcead('0x78')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xcead('0x7')](respondWithResult(_0xd38526,null))[_0xcead('0xb')](handleError(_0xd38526,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 76ac94d..d238c73 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 _0xd0b6=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/run','run','post','create','put','delete','/:id','exports','multer','util','connect-timeout','Router'];(function(_0x37c285,_0x142ac7){var _0x458a2b=function(_0x534fae){while(--_0x534fae){_0x37c285['push'](_0x37c285['shift']());}};_0x458a2b(++_0x142ac7);}(_0xd0b6,0x81));var _0x6d0b=function(_0x21eb04,_0x44cb7f){_0x21eb04=_0x21eb04-0x0;var _0x11b38a=_0xd0b6[_0x21eb04];return _0x11b38a;};'use strict';var multer=require(_0x6d0b('0x0'));var util=require(_0x6d0b('0x1'));var path=require('path');var timeout=require(_0x6d0b('0x2'));var express=require('express');var router=express[_0x6d0b('0x3')]();var auth=require(_0x6d0b('0x4'));var interaction=require(_0x6d0b('0x5'));var config=require(_0x6d0b('0x6'));var controller=require('./schedule.controller');router[_0x6d0b('0x7')]('/',auth[_0x6d0b('0x8')](),controller[_0x6d0b('0x9')]);router[_0x6d0b('0x7')]('/:id',auth[_0x6d0b('0x8')](),controller[_0x6d0b('0xa')]);router['get'](_0x6d0b('0xb'),auth['isAuthenticated'](),controller[_0x6d0b('0xc')]);router[_0x6d0b('0xd')]('/',auth[_0x6d0b('0x8')](),controller[_0x6d0b('0xe')]);router[_0x6d0b('0xf')]('/:id',auth[_0x6d0b('0x8')](),controller['update']);router[_0x6d0b('0x10')](_0x6d0b('0x11'),auth[_0x6d0b('0x8')](),controller['destroy']);module[_0x6d0b('0x12')]=router; \ No newline at end of file +var _0x4106=['update','/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index','/:id/run','post','put'];(function(_0x25ea67,_0x2fc5ca){var _0x3d58f4=function(_0x419243){while(--_0x419243){_0x25ea67['push'](_0x25ea67['shift']());}};_0x3d58f4(++_0x2fc5ca);}(_0x4106,0xdb));var _0x6410=function(_0x57837b,_0x21268c){_0x57837b=_0x57837b-0x0;var _0x288b0f=_0x4106[_0x57837b];return _0x288b0f;};'use strict';var multer=require(_0x6410('0x0'));var util=require(_0x6410('0x1'));var path=require(_0x6410('0x2'));var timeout=require(_0x6410('0x3'));var express=require(_0x6410('0x4'));var router=express[_0x6410('0x5')]();var auth=require(_0x6410('0x6'));var interaction=require(_0x6410('0x7'));var config=require('../../config/environment');var controller=require(_0x6410('0x8'));router[_0x6410('0x9')]('/',auth[_0x6410('0xa')](),controller[_0x6410('0xb')]);router[_0x6410('0x9')]('/:id',auth[_0x6410('0xa')](),controller['show']);router[_0x6410('0x9')](_0x6410('0xc'),auth[_0x6410('0xa')](),controller['run']);router[_0x6410('0xd')]('/',auth[_0x6410('0xa')](),controller['create']);router[_0x6410('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x6410('0xf')]);router['delete'](_0x6410('0x10'),auth[_0x6410('0xa')](),controller[_0x6410('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 6d5726a..493706a 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 _0xc43c=['hours','minutes','csv','pdf','custom','default','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','ENUM','years','quarters','weeks','days'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc43c,0xd4));var _0xcc43=function(_0x1c11bd,_0x53ab90){_0x1c11bd=_0x1c11bd-0x0;var _0x318aae=_0xc43c[_0x1c11bd];return _0x318aae;};'use strict';var Sequelize=require(_0xcc43('0x0'));module[_0xcc43('0x1')]={'name':{'type':Sequelize[_0xcc43('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcc43('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xcc43('0x4')](_0xcc43('0x5'),_0xcc43('0x6'),'months',_0xcc43('0x7'),_0xcc43('0x8'),_0xcc43('0x9'),_0xcc43('0xa')),'allowNull':![],'defaultValue':_0xcc43('0x8')},'output':{'type':Sequelize[_0xcc43('0x4')](_0xcc43('0xb'),_0xcc43('0xc'),'xlsx'),'allowNull':![],'defaultValue':_0xcc43('0xb')},'type':{'type':Sequelize[_0xcc43('0x4')](_0xcc43('0xd'),_0xcc43('0xe')),'allowNull':![],'defaultValue':_0xcc43('0xd')},'sendMail':{'type':Sequelize[_0xcc43('0xf')],'defaultValue':![]},'email':{'type':Sequelize[_0xcc43('0x2')]},'cc':{'type':Sequelize[_0xcc43('0x10')]},'bcc':{'type':Sequelize[_0xcc43('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xcc43('0xf')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5a2a=['hours','minutes','days','pdf','xlsx','csv','custom','BOOLEAN','TEXT','sequelize','exports','STRING','DATE','ENUM','years','quarters','weeks'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x5a2a,0x1c3));var _0xa5a2=function(_0x3fd179,_0x1a2829){_0x3fd179=_0x3fd179-0x0;var _0x2fc68e=_0x5a2a[_0x3fd179];return _0x2fc68e;};'use strict';var Sequelize=require(_0xa5a2('0x0'));module[_0xa5a2('0x1')]={'name':{'type':Sequelize[_0xa5a2('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa5a2('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xa5a2('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xa5a2('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xa5a2('0x4')](_0xa5a2('0x5'),_0xa5a2('0x6'),'months',_0xa5a2('0x7'),'days',_0xa5a2('0x8'),_0xa5a2('0x9')),'allowNull':![],'defaultValue':_0xa5a2('0xa')},'output':{'type':Sequelize['ENUM']('csv',_0xa5a2('0xb'),_0xa5a2('0xc')),'allowNull':![],'defaultValue':_0xa5a2('0xd')},'type':{'type':Sequelize[_0xa5a2('0x4')](_0xa5a2('0xe'),'default'),'allowNull':![],'defaultValue':_0xa5a2('0xe')},'sendMail':{'type':Sequelize[_0xa5a2('0xf')],'defaultValue':![]},'email':{'type':Sequelize[_0xa5a2('0x2')]},'cc':{'type':Sequelize[_0xa5a2('0x10')]},'bcc':{'type':Sequelize[_0xa5a2('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xa5a2('0xf')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index fa08ba5..812ebc2 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 _0xc5e8=['api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','Scheduler','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','Schedule','includeAll','include','findAll','rows','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','run','../../config/schedule','zip-dir','request-promise','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4ad8c6,_0xfb3455){var _0x20f6b9=function(_0x449068){while(--_0x449068){_0x4ad8c6['push'](_0x4ad8c6['shift']());}};_0x20f6b9(++_0xfb3455);}(_0xc5e8,0x184));var _0x8c5e=function(_0x1caf03,_0x5a7a04){_0x1caf03=_0x1caf03-0x0;var _0x40db47=_0xc5e8[_0x1caf03];return _0x40db47;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8c5e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c5e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8c5e('0x2'));var util=require(_0x8c5e('0x3'));var path=require(_0x8c5e('0x4'));var sox=require(_0x8c5e('0x5'));var csv=require(_0x8c5e('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8c5e('0x7'));var squel=require('squel');var crypto=require(_0x8c5e('0x8'));var jsforce=require(_0x8c5e('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8c5e('0xa'));var Papa=require(_0x8c5e('0xb'));var Redis=require('ioredis');var authService=require(_0x8c5e('0xc'));var qs=require(_0x8c5e('0xd'));var as=require(_0x8c5e('0xe'));var hardwareService=require(_0x8c5e('0xf'));var logger=require(_0x8c5e('0x10'))(_0x8c5e('0x11'));var utils=require(_0x8c5e('0x12'));var config=require(_0x8c5e('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55ebcd,_0x7511ef){_0x7511ef=_0x7511ef||0xcc;return function(_0x2b6c7b){if(_0x2b6c7b){return _0x55ebcd[_0x8c5e('0x14')](_0x7511ef);}return _0x55ebcd[_0x8c5e('0x15')](_0x7511ef)[_0x8c5e('0x16')]();};}function respondWithResult(_0x43ad31,_0x3adfad){_0x3adfad=_0x3adfad||0xc8;return function(_0x20b517){if(_0x20b517){return _0x43ad31[_0x8c5e('0x15')](_0x3adfad)[_0x8c5e('0x17')](_0x20b517);}};}function respondWithFilteredResult(_0x2626e8,_0x333856){return function(_0x4b0930){if(_0x4b0930){var _0xe7da7d=_0x4b0930[_0x8c5e('0x18')],_0x276489=_0x333856[_0x8c5e('0x19')],_0xbedeff=_0x333856['offset']+_0x333856[_0x8c5e('0x1a')],_0x4c37da;if(_0xbedeff>=_0xe7da7d){_0xbedeff=_0xe7da7d;_0x4c37da=0xc8;}else{_0x4c37da=0xce;}_0x2626e8[_0x8c5e('0x15')](_0x4c37da);return _0x2626e8[_0x8c5e('0x1b')](_0x8c5e('0x1c'),_0x276489+'-'+_0xbedeff+'/'+_0xe7da7d)['json'](_0x4b0930);}return null;};}function patchUpdates(_0x520437){return function(_0x518296){try{jsonpatch['apply'](_0x518296,_0x520437,!![]);}catch(_0x22be30){return BPromise[_0x8c5e('0x1d')](_0x22be30);}return _0x518296['save']();};}function saveUpdates(_0x2f76ed,_0x32fd65){return function(_0x21fd2e){if(_0x21fd2e){return _0x21fd2e[_0x8c5e('0x1e')](_0x2f76ed)[_0x8c5e('0x1f')](function(_0x188555){return _0x188555;});}return null;};}function removeEntity(_0x4da9c5,_0x1cd5f1){return function(_0x240e0d){if(_0x240e0d){return _0x240e0d[_0x8c5e('0x20')]()['then'](function(){var _0x5996a0=_0x240e0d['get']({'plain':!![]});var _0x201313=_0x8c5e('0x21');return db['UserProfileResource'][_0x8c5e('0x20')]({'where':{'type':_0x201313,'resourceId':_0x5996a0['id']}})[_0x8c5e('0x1f')](function(){return _0x240e0d;});})[_0x8c5e('0x1f')](function(){_0x4da9c5[_0x8c5e('0x15')](0xcc)[_0x8c5e('0x16')]();});}};}function handleEntityNotFound(_0x4379d5,_0x8b4f21){return function(_0xee5d9e){if(!_0xee5d9e){_0x4379d5[_0x8c5e('0x14')](0x194);}return _0xee5d9e;};}function handleError(_0xed3683,_0x2f9c2a){_0x2f9c2a=_0x2f9c2a||0x1f4;return function(_0x4e4b5d){logger['error'](_0x4e4b5d[_0x8c5e('0x22')]);if(_0x4e4b5d[_0x8c5e('0x23')]){delete _0x4e4b5d[_0x8c5e('0x23')];}_0xed3683[_0x8c5e('0x15')](_0x2f9c2a)[_0x8c5e('0x24')](_0x4e4b5d);};}exports[_0x8c5e('0x25')]=function(_0x241ebc,_0x28ac86){var _0x581714={},_0x2a9265={},_0x56a7a7={'count':0x0,'rows':[]};var _0x40f6a5=_[_0x8c5e('0x26')](db['Schedule'][_0x8c5e('0x27')],function(_0x423bfc){return{'name':_0x423bfc[_0x8c5e('0x28')],'type':_0x423bfc['type'][_0x8c5e('0x29')]};});_0x2a9265[_0x8c5e('0x2a')]=_[_0x8c5e('0x26')](_0x40f6a5,_0x8c5e('0x23'));_0x2a9265[_0x8c5e('0x2b')]=_[_0x8c5e('0x2c')](_0x241ebc[_0x8c5e('0x2b')]);_0x2a9265[_0x8c5e('0x2d')]=_[_0x8c5e('0x2e')](_0x2a9265[_0x8c5e('0x2a')],_0x2a9265[_0x8c5e('0x2b')]);_0x581714[_0x8c5e('0x2f')]=_[_0x8c5e('0x2e')](_0x2a9265[_0x8c5e('0x2a')],qs['fields'](_0x241ebc[_0x8c5e('0x2b')][_0x8c5e('0x30')]));_0x581714[_0x8c5e('0x2f')]=_0x581714[_0x8c5e('0x2f')][_0x8c5e('0x31')]?_0x581714[_0x8c5e('0x2f')]:_0x2a9265['model'];if(!_0x241ebc[_0x8c5e('0x2b')][_0x8c5e('0x32')](_0x8c5e('0x33'))){_0x581714['limit']=qs[_0x8c5e('0x1a')](_0x241ebc[_0x8c5e('0x2b')][_0x8c5e('0x1a')]);_0x581714[_0x8c5e('0x19')]=qs[_0x8c5e('0x19')](_0x241ebc[_0x8c5e('0x2b')][_0x8c5e('0x19')]);}_0x581714['order']=qs[_0x8c5e('0x34')](_0x241ebc['query']['sort']);_0x581714[_0x8c5e('0x35')]=qs[_0x8c5e('0x2d')](_[_0x8c5e('0x36')](_0x241ebc['query'],_0x2a9265['filters']),_0x40f6a5);if(_0x241ebc[_0x8c5e('0x2b')][_0x8c5e('0x37')]){_0x581714[_0x8c5e('0x35')]=_['merge'](_0x581714[_0x8c5e('0x35')],{'$or':_[_0x8c5e('0x26')](_0x40f6a5,function(_0x17d9c9){if(_0x17d9c9[_0x8c5e('0x38')]!==_0x8c5e('0x39')){var _0x40f72f={};_0x40f72f[_0x17d9c9[_0x8c5e('0x23')]]={'$like':'%'+_0x241ebc[_0x8c5e('0x2b')][_0x8c5e('0x37')]+'%'};return _0x40f72f;}})});}_0x581714=_[_0x8c5e('0x3a')]({},_0x581714,_0x241ebc[_0x8c5e('0x3b')]);var _0x401590={'where':_0x581714['where']};return db[_0x8c5e('0x3c')][_0x8c5e('0x18')](_0x401590)[_0x8c5e('0x1f')](function(_0x15a2ec){_0x56a7a7[_0x8c5e('0x18')]=_0x15a2ec;if(_0x241ebc[_0x8c5e('0x2b')][_0x8c5e('0x3d')]){_0x581714[_0x8c5e('0x3e')]=[{'all':!![]}];}return db['Schedule'][_0x8c5e('0x3f')](_0x581714);})[_0x8c5e('0x1f')](function(_0x1c24d3){_0x56a7a7[_0x8c5e('0x40')]=_0x1c24d3;return _0x56a7a7;})['then'](respondWithFilteredResult(_0x28ac86,_0x581714))['catch'](handleError(_0x28ac86,null));};exports[_0x8c5e('0x41')]=function(_0x355dcf,_0x14bb74){var _0x5f1636={'raw':![],'where':{'id':_0x355dcf[_0x8c5e('0x42')]['id']}},_0x180809={};_0x180809[_0x8c5e('0x2a')]=_[_0x8c5e('0x2c')](db[_0x8c5e('0x3c')][_0x8c5e('0x27')]);_0x180809['query']=_[_0x8c5e('0x2c')](_0x355dcf[_0x8c5e('0x2b')]);_0x180809[_0x8c5e('0x2d')]=_['intersection'](_0x180809['model'],_0x180809[_0x8c5e('0x2b')]);_0x5f1636[_0x8c5e('0x2f')]=_['intersection'](_0x180809[_0x8c5e('0x2a')],qs[_0x8c5e('0x30')](_0x355dcf[_0x8c5e('0x2b')]['fields']));_0x5f1636[_0x8c5e('0x2f')]=_0x5f1636[_0x8c5e('0x2f')]['length']?_0x5f1636[_0x8c5e('0x2f')]:_0x180809[_0x8c5e('0x2a')];if(_0x355dcf[_0x8c5e('0x2b')][_0x8c5e('0x3d')]){_0x5f1636[_0x8c5e('0x3e')]=[{'all':!![]}];}_0x5f1636=_['merge']({},_0x5f1636,_0x355dcf[_0x8c5e('0x3b')]);return db[_0x8c5e('0x3c')][_0x8c5e('0x43')](_0x5f1636)[_0x8c5e('0x1f')](handleEntityNotFound(_0x14bb74,null))[_0x8c5e('0x1f')](respondWithResult(_0x14bb74,null))['catch'](handleError(_0x14bb74,null));};exports['create']=function(_0x3d3d10,_0x15a770){return db['Schedule'][_0x8c5e('0x44')](_0x3d3d10[_0x8c5e('0x45')],{})['then'](function(_0x29088b){var _0x3cb50a=_0x3d3d10[_0x8c5e('0x46')][_0x8c5e('0x47')]({'plain':!![]});if(!_0x3cb50a)throw new Error(_0x8c5e('0x48'));if(_0x3cb50a[_0x8c5e('0x49')]===_0x8c5e('0x46')){var _0x25d6c0=_0x29088b[_0x8c5e('0x47')]({'plain':!![]});var _0xe792fa='Scheduler';return db[_0x8c5e('0x4a')][_0x8c5e('0x43')]({'where':{'name':_0xe792fa,'userProfileId':_0x3cb50a[_0x8c5e('0x4b')]},'raw':!![]})[_0x8c5e('0x1f')](function(_0x184efa){if(_0x184efa&&_0x184efa['autoAssociation']===0x0){return db[_0x8c5e('0x4c')][_0x8c5e('0x44')]({'name':_0x25d6c0[_0x8c5e('0x23')],'resourceId':_0x25d6c0['id'],'type':_0x184efa[_0x8c5e('0x23')],'sectionId':_0x184efa['id']},{})[_0x8c5e('0x1f')](function(){return _0x29088b;});}else{return _0x29088b;}})['catch'](function(_0x597a5a){logger['error'](_0x8c5e('0x4d'),_0x597a5a);throw _0x597a5a;});}return _0x29088b;})[_0x8c5e('0x1f')](respondWithResult(_0x15a770,0xc9))[_0x8c5e('0x4e')](handleError(_0x15a770,null));};exports['update']=function(_0xe3c1f3,_0x896c59){if(_0xe3c1f3[_0x8c5e('0x45')]['id']){delete _0xe3c1f3[_0x8c5e('0x45')]['id'];}return db[_0x8c5e('0x3c')]['find']({'where':{'id':_0xe3c1f3[_0x8c5e('0x42')]['id']}})[_0x8c5e('0x1f')](handleEntityNotFound(_0x896c59,null))[_0x8c5e('0x1f')](saveUpdates(_0xe3c1f3['body'],null))[_0x8c5e('0x1f')](respondWithResult(_0x896c59,null))[_0x8c5e('0x4e')](handleError(_0x896c59,null));};exports[_0x8c5e('0x20')]=function(_0x5056ce,_0x3fe10c){return db[_0x8c5e('0x3c')]['find']({'where':{'id':_0x5056ce[_0x8c5e('0x42')]['id']}})[_0x8c5e('0x1f')](handleEntityNotFound(_0x3fe10c,null))[_0x8c5e('0x1f')](removeEntity(_0x3fe10c,null))['catch'](handleError(_0x3fe10c,null));};exports[_0x8c5e('0x4f')]=function(_0x437801,_0x219d3b,_0x32ab18){var _0x26bb9c=require(_0x8c5e('0x50'));return db[_0x8c5e('0x3c')][_0x8c5e('0x43')]({'where':{'id':_0x437801[_0x8c5e('0x42')]['id']},'raw':!![]})[_0x8c5e('0x1f')](handleEntityNotFound(_0x219d3b,null))[_0x8c5e('0x1f')](function(){_0x26bb9c[_0x8c5e('0x4f')](_0x437801['params']['id']);})[_0x8c5e('0x1f')](respondWithStatusCode(_0x219d3b,null))['catch'](handleError(_0x219d3b,null));}; \ No newline at end of file +var _0x681c=['end','json','count','offset','limit','set','apply','reject','save','destroy','then','get','UserProfileResource','sendStatus','error','stack','name','send','Schedule','rawAttributes','type','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','keys','create','body','user','role','Scheduler','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status'];(function(_0x2dac3e,_0x3ffb48){var _0x1da1a7=function(_0x6c95e7){while(--_0x6c95e7){_0x2dac3e['push'](_0x2dac3e['shift']());}};_0x1da1a7(++_0x3ffb48);}(_0x681c,0x1cd));var _0xc681=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x681c[_0x17d9e3];return _0x14192d;};'use strict';var pdf=require(_0xc681('0x0'));var emlformat=require(_0xc681('0x1'));var rimraf=require(_0xc681('0x2'));var zipdir=require(_0xc681('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc681('0x4'));var moment=require('moment');var BPromise=require(_0xc681('0x5'));var Mustache=require(_0xc681('0x6'));var util=require(_0xc681('0x7'));var path=require(_0xc681('0x8'));var sox=require('sox');var csv=require(_0xc681('0x9'));var ejs=require(_0xc681('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc681('0xb'));var crypto=require(_0xc681('0xc'));var jsforce=require(_0xc681('0xd'));var deskjs=require(_0xc681('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc681('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc681('0x10'));var qs=require(_0xc681('0x11'));var as=require(_0xc681('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc681('0x13'))(_0xc681('0x14'));var utils=require(_0xc681('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc681('0x16'));var db=require(_0xc681('0x17'))['db'];function respondWithStatusCode(_0x8c952a,_0x5e5eda){_0x5e5eda=_0x5e5eda||0xcc;return function(_0x27b0ce){if(_0x27b0ce){return _0x8c952a['sendStatus'](_0x5e5eda);}return _0x8c952a[_0xc681('0x18')](_0x5e5eda)[_0xc681('0x19')]();};}function respondWithResult(_0xfaf117,_0x3675ac){_0x3675ac=_0x3675ac||0xc8;return function(_0x573574){if(_0x573574){return _0xfaf117[_0xc681('0x18')](_0x3675ac)[_0xc681('0x1a')](_0x573574);}};}function respondWithFilteredResult(_0x56b149,_0x23e839){return function(_0xb05a82){if(_0xb05a82){var _0x244bd1=_0xb05a82[_0xc681('0x1b')],_0x169aa4=_0x23e839['offset'],_0xe020a9=_0x23e839[_0xc681('0x1c')]+_0x23e839[_0xc681('0x1d')],_0x57a747;if(_0xe020a9>=_0x244bd1){_0xe020a9=_0x244bd1;_0x57a747=0xc8;}else{_0x57a747=0xce;}_0x56b149['status'](_0x57a747);return _0x56b149[_0xc681('0x1e')]('Content-Range',_0x169aa4+'-'+_0xe020a9+'/'+_0x244bd1)['json'](_0xb05a82);}return null;};}function patchUpdates(_0x2f1186){return function(_0x23a3a6){try{jsonpatch[_0xc681('0x1f')](_0x23a3a6,_0x2f1186,!![]);}catch(_0x47299f){return BPromise[_0xc681('0x20')](_0x47299f);}return _0x23a3a6[_0xc681('0x21')]();};}function saveUpdates(_0x55f0ac,_0x5835d8){return function(_0x5e7f51){if(_0x5e7f51){return _0x5e7f51['update'](_0x55f0ac)['then'](function(_0x5d68ce){return _0x5d68ce;});}return null;};}function removeEntity(_0x5d451b,_0x5863cd){return function(_0x343b62){if(_0x343b62){return _0x343b62[_0xc681('0x22')]()[_0xc681('0x23')](function(){var _0x6fc569=_0x343b62[_0xc681('0x24')]({'plain':!![]});var _0x284f0e='Scheduler';return db[_0xc681('0x25')][_0xc681('0x22')]({'where':{'type':_0x284f0e,'resourceId':_0x6fc569['id']}})['then'](function(){return _0x343b62;});})[_0xc681('0x23')](function(){_0x5d451b['status'](0xcc)[_0xc681('0x19')]();});}};}function handleEntityNotFound(_0x70922d,_0xef0615){return function(_0x1277e2){if(!_0x1277e2){_0x70922d[_0xc681('0x26')](0x194);}return _0x1277e2;};}function handleError(_0x52760a,_0x5a7e3a){_0x5a7e3a=_0x5a7e3a||0x1f4;return function(_0x39b593){logger[_0xc681('0x27')](_0x39b593[_0xc681('0x28')]);if(_0x39b593[_0xc681('0x29')]){delete _0x39b593[_0xc681('0x29')];}_0x52760a[_0xc681('0x18')](_0x5a7e3a)[_0xc681('0x2a')](_0x39b593);};}exports['index']=function(_0x5eb1d7,_0x29f9bd){var _0x5b0116={},_0x4fa766={},_0x4c43c1={'count':0x0,'rows':[]};var _0x477f0f=_['map'](db[_0xc681('0x2b')][_0xc681('0x2c')],function(_0x51e5ca){return{'name':_0x51e5ca['fieldName'],'type':_0x51e5ca[_0xc681('0x2d')]['key']};});_0x4fa766[_0xc681('0x2e')]=_['map'](_0x477f0f,'name');_0x4fa766[_0xc681('0x2f')]=_['keys'](_0x5eb1d7[_0xc681('0x2f')]);_0x4fa766['filters']=_[_0xc681('0x30')](_0x4fa766[_0xc681('0x2e')],_0x4fa766[_0xc681('0x2f')]);_0x5b0116[_0xc681('0x31')]=_[_0xc681('0x30')](_0x4fa766[_0xc681('0x2e')],qs['fields'](_0x5eb1d7['query'][_0xc681('0x32')]));_0x5b0116['attributes']=_0x5b0116[_0xc681('0x31')][_0xc681('0x33')]?_0x5b0116[_0xc681('0x31')]:_0x4fa766['model'];if(!_0x5eb1d7['query'][_0xc681('0x34')]('nolimit')){_0x5b0116[_0xc681('0x1d')]=qs[_0xc681('0x1d')](_0x5eb1d7[_0xc681('0x2f')][_0xc681('0x1d')]);_0x5b0116[_0xc681('0x1c')]=qs[_0xc681('0x1c')](_0x5eb1d7[_0xc681('0x2f')][_0xc681('0x1c')]);}_0x5b0116[_0xc681('0x35')]=qs[_0xc681('0x36')](_0x5eb1d7['query'][_0xc681('0x36')]);_0x5b0116[_0xc681('0x37')]=qs['filters'](_[_0xc681('0x38')](_0x5eb1d7['query'],_0x4fa766[_0xc681('0x39')]),_0x477f0f);if(_0x5eb1d7[_0xc681('0x2f')]['filter']){_0x5b0116[_0xc681('0x37')]=_[_0xc681('0x3a')](_0x5b0116[_0xc681('0x37')],{'$or':_[_0xc681('0x3b')](_0x477f0f,function(_0x4cb979){if(_0x4cb979[_0xc681('0x2d')]!==_0xc681('0x3c')){var _0x4c1b93={};_0x4c1b93[_0x4cb979[_0xc681('0x29')]]={'$like':'%'+_0x5eb1d7[_0xc681('0x2f')][_0xc681('0x3d')]+'%'};return _0x4c1b93;}})});}_0x5b0116=_[_0xc681('0x3a')]({},_0x5b0116,_0x5eb1d7[_0xc681('0x3e')]);var _0x5d345c={'where':_0x5b0116[_0xc681('0x37')]};return db[_0xc681('0x2b')][_0xc681('0x1b')](_0x5d345c)[_0xc681('0x23')](function(_0x4a1fee){_0x4c43c1[_0xc681('0x1b')]=_0x4a1fee;if(_0x5eb1d7[_0xc681('0x2f')][_0xc681('0x3f')]){_0x5b0116[_0xc681('0x40')]=[{'all':!![]}];}return db['Schedule'][_0xc681('0x41')](_0x5b0116);})[_0xc681('0x23')](function(_0x1e2441){_0x4c43c1[_0xc681('0x42')]=_0x1e2441;return _0x4c43c1;})[_0xc681('0x23')](respondWithFilteredResult(_0x29f9bd,_0x5b0116))[_0xc681('0x43')](handleError(_0x29f9bd,null));};exports['show']=function(_0x39e5bc,_0x55d74e){var _0x23c366={'raw':![],'where':{'id':_0x39e5bc[_0xc681('0x44')]['id']}},_0x5b7ba5={};_0x5b7ba5['model']=_[_0xc681('0x45')](db[_0xc681('0x2b')]['rawAttributes']);_0x5b7ba5[_0xc681('0x2f')]=_[_0xc681('0x45')](_0x39e5bc[_0xc681('0x2f')]);_0x5b7ba5[_0xc681('0x39')]=_[_0xc681('0x30')](_0x5b7ba5[_0xc681('0x2e')],_0x5b7ba5[_0xc681('0x2f')]);_0x23c366[_0xc681('0x31')]=_['intersection'](_0x5b7ba5[_0xc681('0x2e')],qs[_0xc681('0x32')](_0x39e5bc[_0xc681('0x2f')][_0xc681('0x32')]));_0x23c366['attributes']=_0x23c366[_0xc681('0x31')][_0xc681('0x33')]?_0x23c366[_0xc681('0x31')]:_0x5b7ba5[_0xc681('0x2e')];if(_0x39e5bc[_0xc681('0x2f')][_0xc681('0x3f')]){_0x23c366['include']=[{'all':!![]}];}_0x23c366=_[_0xc681('0x3a')]({},_0x23c366,_0x39e5bc['options']);return db[_0xc681('0x2b')]['find'](_0x23c366)[_0xc681('0x23')](handleEntityNotFound(_0x55d74e,null))[_0xc681('0x23')](respondWithResult(_0x55d74e,null))[_0xc681('0x43')](handleError(_0x55d74e,null));};exports[_0xc681('0x46')]=function(_0xf5fe5a,_0x21bf77){return db[_0xc681('0x2b')][_0xc681('0x46')](_0xf5fe5a[_0xc681('0x47')],{})['then'](function(_0x1423a1){var _0x3861a9=_0xf5fe5a[_0xc681('0x48')]['get']({'plain':!![]});if(!_0x3861a9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3861a9[_0xc681('0x49')]===_0xc681('0x48')){var _0x3b25dd=_0x1423a1[_0xc681('0x24')]({'plain':!![]});var _0x4a59c0=_0xc681('0x4a');return db['UserProfileSection'][_0xc681('0x4b')]({'where':{'name':_0x4a59c0,'userProfileId':_0x3861a9[_0xc681('0x4c')]},'raw':!![]})[_0xc681('0x23')](function(_0x1247cb){if(_0x1247cb&&_0x1247cb[_0xc681('0x4d')]===0x0){return db[_0xc681('0x25')][_0xc681('0x46')]({'name':_0x3b25dd[_0xc681('0x29')],'resourceId':_0x3b25dd['id'],'type':_0x1247cb[_0xc681('0x29')],'sectionId':_0x1247cb['id']},{})[_0xc681('0x23')](function(){return _0x1423a1;});}else{return _0x1423a1;}})[_0xc681('0x43')](function(_0x40800b){logger[_0xc681('0x27')](_0xc681('0x4e'),_0x40800b);throw _0x40800b;});}return _0x1423a1;})['then'](respondWithResult(_0x21bf77,0xc9))[_0xc681('0x43')](handleError(_0x21bf77,null));};exports['update']=function(_0x15db9d,_0x1637ac){if(_0x15db9d['body']['id']){delete _0x15db9d[_0xc681('0x47')]['id'];}return db[_0xc681('0x2b')][_0xc681('0x4b')]({'where':{'id':_0x15db9d[_0xc681('0x44')]['id']}})['then'](handleEntityNotFound(_0x1637ac,null))[_0xc681('0x23')](saveUpdates(_0x15db9d[_0xc681('0x47')],null))[_0xc681('0x23')](respondWithResult(_0x1637ac,null))['catch'](handleError(_0x1637ac,null));};exports[_0xc681('0x22')]=function(_0x50e9b8,_0xd61855){return db[_0xc681('0x2b')][_0xc681('0x4b')]({'where':{'id':_0x50e9b8[_0xc681('0x44')]['id']}})[_0xc681('0x23')](handleEntityNotFound(_0xd61855,null))[_0xc681('0x23')](removeEntity(_0xd61855,null))[_0xc681('0x43')](handleError(_0xd61855,null));};exports[_0xc681('0x4f')]=function(_0x497a6b,_0x17239a,_0x180b25){var _0x296c9e=require(_0xc681('0x50'));return db[_0xc681('0x2b')][_0xc681('0x4b')]({'where':{'id':_0x497a6b['params']['id']},'raw':!![]})[_0xc681('0x23')](handleEntityNotFound(_0x17239a,null))[_0xc681('0x23')](function(){_0x296c9e[_0xc681('0x4f')](_0x497a6b[_0xc681('0x44')]['id']);})[_0xc681('0x23')](respondWithStatusCode(_0x17239a,null))[_0xc681('0x43')](handleError(_0x17239a,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index c9aef20..3f5fa05 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 _0x88f8=['define','tools_schedules','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes'];(function(_0x5bc959,_0x29cf85){var _0x345c47=function(_0x36f77e){while(--_0x36f77e){_0x5bc959['push'](_0x5bc959['shift']());}};_0x345c47(++_0x29cf85);}(_0x88f8,0x18e));var _0x888f=function(_0x34a361,_0x595ee0){_0x34a361=_0x34a361-0x0;var _0x24956b=_0x88f8[_0x34a361];return _0x24956b;};'use strict';var _=require(_0x888f('0x0'));var util=require(_0x888f('0x1'));var logger=require('../../config/logger')(_0x888f('0x2'));var moment=require('moment');var BPromise=require(_0x888f('0x3'));var rp=require(_0x888f('0x4'));var fs=require('fs');var path=require(_0x888f('0x5'));var rimraf=require(_0x888f('0x6'));var config=require(_0x888f('0x7'));var attributes=require(_0x888f('0x8'));module['exports']=function(_0x274726,_0x170d4a){return _0x274726[_0x888f('0x9')]('Schedule',attributes,{'tableName':_0x888f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ae8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','tools_schedules','lodash','util','api'];(function(_0x3ec504,_0x29c06f){var _0x50c9b6=function(_0x2e7b37){while(--_0x2e7b37){_0x3ec504['push'](_0x3ec504['shift']());}};_0x50c9b6(++_0x29c06f);}(_0x2ae8,0x135));var _0x82ae=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x2ae8[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x82ae('0x0'));var util=require(_0x82ae('0x1'));var logger=require('../../config/logger')(_0x82ae('0x2'));var moment=require(_0x82ae('0x3'));var BPromise=require(_0x82ae('0x4'));var rp=require(_0x82ae('0x5'));var fs=require('fs');var path=require(_0x82ae('0x6'));var rimraf=require(_0x82ae('0x7'));var config=require(_0x82ae('0x8'));var attributes=require(_0x82ae('0x9'));module[_0x82ae('0xa')]=function(_0x1e1805,_0xb4b4de){return _0x1e1805[_0x82ae('0xb')]('Schedule',attributes,{'tableName':_0x82ae('0xc'),'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 3d6c084..debd5a3 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 _0x30ed=['code','Schedule,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error'];(function(_0x3e91a9,_0x53c466){var _0x25c9ad=function(_0x69ee2d){while(--_0x69ee2d){_0x3e91a9['push'](_0x3e91a9['shift']());}};_0x25c9ad(++_0x53c466);}(_0x30ed,0x1e8));var _0xd30e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x30ed[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd30e('0x0'));var moment=require(_0xd30e('0x1'));var BPromise=require(_0xd30e('0x2'));var rs=require(_0xd30e('0x3'));var fs=require('fs');var Redis=require(_0xd30e('0x4'));var db=require(_0xd30e('0x5'))['db'];var utils=require(_0xd30e('0x6'));var logger=require('../../config/logger')(_0xd30e('0x7'));var config=require(_0xd30e('0x8'));var jayson=require(_0xd30e('0x9'));var client=jayson[_0xd30e('0xa')][_0xd30e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c8c9b,_0x54ca1c,_0x29ea77){return new BPromise(function(_0x4946fc,_0x3706d0){return client[_0xd30e('0xc')](_0x5c8c9b,_0x29ea77)['then'](function(_0x4276c6){logger[_0xd30e('0xd')]('Schedule,\x20%s,\x20%s',_0x54ca1c,_0xd30e('0xe'));logger[_0xd30e('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x54ca1c,_0xd30e('0xe'),JSON[_0xd30e('0x10')](_0x4276c6));if(_0x4276c6[_0xd30e('0x11')]){if(_0x4276c6[_0xd30e('0x11')][_0xd30e('0x12')]===0x1f4){logger[_0xd30e('0x11')](_0xd30e('0x13'),_0x54ca1c,_0x4276c6[_0xd30e('0x11')][_0xd30e('0x14')]);return _0x3706d0(_0x4276c6[_0xd30e('0x11')][_0xd30e('0x14')]);}logger[_0xd30e('0x11')]('Schedule,\x20%s,\x20%s',_0x54ca1c,_0x4276c6[_0xd30e('0x11')][_0xd30e('0x14')]);return _0x4946fc(_0x4276c6[_0xd30e('0x11')][_0xd30e('0x14')]);}else{logger[_0xd30e('0xd')]('Schedule,\x20%s,\x20%s',_0x54ca1c,_0xd30e('0xe'));_0x4946fc(_0x4276c6[_0xd30e('0x15')]['message']);}})[_0xd30e('0x16')](function(_0x534abd){logger[_0xd30e('0x11')](_0xd30e('0x13'),_0x54ca1c,_0x534abd);_0x3706d0(_0x534abd);});});} \ No newline at end of file +var _0xbc79=['../../mysqldb','../../config/utils','../../config/logger','client','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1935b9,_0x523a80){var _0x3e7323=function(_0x706dc9){while(--_0x706dc9){_0x1935b9['push'](_0x1935b9['shift']());}};_0x3e7323(++_0x523a80);}(_0xbc79,0x1b3));var _0x9bc7=function(_0x313bee,_0x46e36f){_0x313bee=_0x313bee-0x0;var _0x36e56e=_0xbc79[_0x313bee];return _0x36e56e;};'use strict';var _=require(_0x9bc7('0x0'));var util=require(_0x9bc7('0x1'));var moment=require(_0x9bc7('0x2'));var BPromise=require(_0x9bc7('0x3'));var rs=require(_0x9bc7('0x4'));var fs=require('fs');var Redis=require(_0x9bc7('0x5'));var db=require(_0x9bc7('0x6'))['db'];var utils=require(_0x9bc7('0x7'));var logger=require(_0x9bc7('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9bc7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b6ffd,_0x1d722e,_0x199937){return new BPromise(function(_0xe1a1da,_0x2d2e7b){return client[_0x9bc7('0xa')](_0x2b6ffd,_0x199937)[_0x9bc7('0xb')](function(_0x185ef3){logger[_0x9bc7('0xc')](_0x9bc7('0xd'),_0x1d722e,_0x9bc7('0xe'));logger[_0x9bc7('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x1d722e,'request\x20sent',JSON[_0x9bc7('0x10')](_0x185ef3));if(_0x185ef3[_0x9bc7('0x11')]){if(_0x185ef3['error'][_0x9bc7('0x12')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x1d722e,_0x185ef3[_0x9bc7('0x11')][_0x9bc7('0x13')]);return _0x2d2e7b(_0x185ef3[_0x9bc7('0x11')][_0x9bc7('0x13')]);}logger[_0x9bc7('0x11')](_0x9bc7('0xd'),_0x1d722e,_0x185ef3[_0x9bc7('0x11')][_0x9bc7('0x13')]);return _0xe1a1da(_0x185ef3['error'][_0x9bc7('0x13')]);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x1d722e,_0x9bc7('0xe'));_0xe1a1da(_0x185ef3['result'][_0x9bc7('0x13')]);}})[_0x9bc7('0x14')](function(_0x39cf4d){logger[_0x9bc7('0x11')](_0x9bc7('0xd'),_0x1d722e,_0x39cf4d);_0x2d2e7b(_0x39cf4d);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index a82eb62..0c13698 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 _0x624c=['connect-timeout','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x355177,_0x3b83f4){var _0x42c863=function(_0x418b9e){while(--_0x418b9e){_0x355177['push'](_0x355177['shift']());}};_0x42c863(++_0x3b83f4);}(_0x624c,0x1e0));var _0xc624=function(_0xc9b565,_0x14970d){_0xc9b565=_0xc9b565-0x0;var _0x3ce997=_0x624c[_0xc9b565];return _0x3ce997;};'use strict';var multer=require(_0xc624('0x0'));var util=require(_0xc624('0x1'));var path=require(_0xc624('0x2'));var timeout=require(_0xc624('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xc624('0x4'));var interaction=require(_0xc624('0x5'));var config=require('../../config/environment');var controller=require(_0xc624('0x6'));router[_0xc624('0x7')]('/',auth[_0xc624('0x8')](),controller[_0xc624('0x9')]);router['get'](_0xc624('0xa'),auth[_0xc624('0x8')](),controller[_0xc624('0xb')]);router[_0xc624('0x7')](_0xc624('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc624('0x7')](_0xc624('0xd'),auth['isAuthenticated'](),controller[_0xc624('0xe')]);router['post']('/',auth[_0xc624('0x8')](),controller[_0xc624('0xf')]);router[_0xc624('0x10')](_0xc624('0xc'),auth[_0xc624('0x8')](),controller[_0xc624('0x11')]);router[_0xc624('0x12')]('/:id',auth[_0xc624('0x8')](),controller[_0xc624('0x13')]);module[_0xc624('0x14')]=router; \ No newline at end of file +var _0x5ed5=['isAuthenticated','/:id/download','download','post','create','put','/:id','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','/describe','describe'];(function(_0x37b27d,_0x5c4e90){var _0xf08107=function(_0x42877b){while(--_0x42877b){_0x37b27d['push'](_0x37b27d['shift']());}};_0xf08107(++_0x5c4e90);}(_0x5ed5,0x1ac));var _0x55ed=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5ed5[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x55ed('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x55ed('0x1'));var express=require(_0x55ed('0x2'));var router=express[_0x55ed('0x3')]();var auth=require(_0x55ed('0x4'));var interaction=require(_0x55ed('0x5'));var config=require(_0x55ed('0x6'));var controller=require(_0x55ed('0x7'));router[_0x55ed('0x8')]('/',auth['isAuthenticated'](),controller[_0x55ed('0x9')]);router['get'](_0x55ed('0xa'),auth['isAuthenticated'](),controller[_0x55ed('0xb')]);router[_0x55ed('0x8')]('/:id',auth[_0x55ed('0xc')](),controller['show']);router[_0x55ed('0x8')](_0x55ed('0xd'),auth['isAuthenticated'](),controller[_0x55ed('0xe')]);router[_0x55ed('0xf')]('/',auth[_0x55ed('0xc')](),controller[_0x55ed('0x10')]);router[_0x55ed('0x11')](_0x55ed('0x12'),auth[_0x55ed('0xc')](),controller['update']);router[_0x55ed('0x13')](_0x55ed('0x12'),auth[_0x55ed('0xc')](),controller[_0x55ed('0x14')]);module[_0x55ed('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index ba39838..1af3d7e 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 _0xd6d6=['STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path','../../config/environment','VIRTUAL','getDataValue','value','extname'];(function(_0x47a962,_0x15c103){var _0x26af5f=function(_0x48114e){while(--_0x48114e){_0x47a962['push'](_0x47a962['shift']());}};_0x26af5f(++_0x15c103);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x5dad68,_0xdabdaa){_0x5dad68=_0x5dad68-0x0;var _0xc22502=_0xd6d6[_0x5dad68];return _0xc22502;};'use strict';var Sequelize=require(_0x6d6d('0x0'));var moment=require(_0x6d6d('0x1'));var path=require(_0x6d6d('0x2'));var config=require(_0x6d6d('0x3'));module['exports']={'format':{'type':Sequelize[_0x6d6d('0x4')],'get':function(){return this[_0x6d6d('0x5')](_0x6d6d('0x6'))?path[_0x6d6d('0x7')](this[_0x6d6d('0x5')](_0x6d6d('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x6d6d('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x6d6d('0x8')],'set':function(_0x1bf731){var _0x44f83d=_0x1bf731[_0x6d6d('0x9')](/\\/g,'/');this[_0x6d6d('0xa')](_0x6d6d('0x6'),_0x44f83d);}},'rating':{'type':Sequelize[_0x6d6d('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x51dd38){this[_0x6d6d('0xa')](_0x6d6d('0xc'),moment()[_0x6d6d('0xd')](_0x51dd38,'ms'));this[_0x6d6d('0xa')](_0x6d6d('0xe'),moment());this['setDataValue'](_0x6d6d('0xf'),_0x51dd38);}},'startedAt':{'type':Sequelize[_0x6d6d('0x10')],'get':function(){return moment(this['getDataValue']('startedAt'))[_0x6d6d('0x11')](_0x6d6d('0x12'))[_0x6d6d('0x13')]();}},'closedAt':{'type':Sequelize[_0x6d6d('0x10')],'get':function(){return moment(this[_0x6d6d('0x5')](_0x6d6d('0xe')))[_0x6d6d('0x11')](_0x6d6d('0x12'))['toString']();}},'createdAt':{'type':Sequelize[_0x6d6d('0x10')],'get':function(){return moment(this[_0x6d6d('0x5')](_0x6d6d('0x14')))[_0x6d6d('0x11')](_0x6d6d('0x12'))['toString']();}},'updatedAt':{'type':Sequelize[_0x6d6d('0x10')],'get':function(){return moment(this['getDataValue'](_0x6d6d('0x15')))[_0x6d6d('0x11')](_0x6d6d('0x12'))['toString']();}}}; \ No newline at end of file +var _0x4bc3=['setDataValue','INTEGER','closedAt','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','../../config/environment','exports','getDataValue','value','extname','STRING'];(function(_0x2e396d,_0x69bb1b){var _0x2502eb=function(_0x4aebe7){while(--_0x4aebe7){_0x2e396d['push'](_0x2e396d['shift']());}};_0x2502eb(++_0x69bb1b);}(_0x4bc3,0x16e));var _0x34bc=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x4bc3[_0x11ce46];return _0x368a1e;};'use strict';var Sequelize=require(_0x34bc('0x0'));var moment=require(_0x34bc('0x1'));var path=require('path');var config=require(_0x34bc('0x2'));module[_0x34bc('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x34bc('0x4')](_0x34bc('0x5'))?path[_0x34bc('0x6')](this[_0x34bc('0x4')](_0x34bc('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x34bc('0x7')]},'channel':{'type':Sequelize[_0x34bc('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x21451b){var _0x50320d=_0x21451b['replace'](/\\/g,'/');this[_0x34bc('0x8')](_0x34bc('0x5'),_0x50320d);}},'rating':{'type':Sequelize[_0x34bc('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x34bc('0x9')],'set':function(_0x409105){this[_0x34bc('0x8')]('startedAt',moment()['subtract'](_0x409105,'ms'));this[_0x34bc('0x8')](_0x34bc('0xa'),moment());this[_0x34bc('0x8')]('duration',_0x409105);}},'startedAt':{'type':Sequelize[_0x34bc('0xb')],'get':function(){return moment(this['getDataValue'](_0x34bc('0xc')))[_0x34bc('0xd')](_0x34bc('0xe'))['toString']();}},'closedAt':{'type':Sequelize[_0x34bc('0xb')],'get':function(){return moment(this['getDataValue'](_0x34bc('0xa')))[_0x34bc('0xd')](_0x34bc('0xe'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x34bc('0x4')]('createdAt'))[_0x34bc('0xd')](_0x34bc('0xe'))[_0x34bc('0xf')]();}},'updatedAt':{'type':Sequelize[_0x34bc('0xb')],'get':function(){return moment(this[_0x34bc('0x4')](_0x34bc('0x10')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 0d7cb2d..ca4f853 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 _0x7b2f=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','set','json','apply','save','update','destroy','then','error','stack','name','send','index','ScreenRecording','rawAttributes','fieldName','type','key','model','map','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','duration','describe','download','uniqueid','join','root','server/files/screen_recordings','value','%s.cypher','decryptFile','secrets','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','eml-format'];(function(_0x17f20e,_0x3948f8){var _0x4cd1f3=function(_0x55a668){while(--_0x55a668){_0x17f20e['push'](_0x17f20e['shift']());}};_0x4cd1f3(++_0x3948f8);}(_0x7b2f,0x66));var _0xf7b2=function(_0x455e0e,_0x5c3ac1){_0x455e0e=_0x455e0e-0x0;var _0x3cd9a1=_0x7b2f[_0x455e0e];return _0x3cd9a1;};'use strict';var pdf=require(_0xf7b2('0x0'));var emlformat=require(_0xf7b2('0x1'));var rimraf=require(_0xf7b2('0x2'));var zipdir=require(_0xf7b2('0x3'));var jsonpatch=require(_0xf7b2('0x4'));var rp=require(_0xf7b2('0x5'));var moment=require('moment');var BPromise=require(_0xf7b2('0x6'));var Mustache=require(_0xf7b2('0x7'));var util=require(_0xf7b2('0x8'));var path=require(_0xf7b2('0x9'));var sox=require(_0xf7b2('0xa'));var csv=require(_0xf7b2('0xb'));var ejs=require(_0xf7b2('0xc'));var fs=require('fs');var _=require(_0xf7b2('0xd'));var squel=require('squel');var crypto=require(_0xf7b2('0xe'));var jsforce=require(_0xf7b2('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf7b2('0xb'));var querystring=require(_0xf7b2('0x10'));var Papa=require(_0xf7b2('0x11'));var Redis=require(_0xf7b2('0x12'));var authService=require(_0xf7b2('0x13'));var qs=require(_0xf7b2('0x14'));var as=require(_0xf7b2('0x15'));var hardwareService=require(_0xf7b2('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf7b2('0x17'));var licenseUtil=require(_0xf7b2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dc87c,_0x1698a9){_0x1698a9=_0x1698a9||0xcc;return function(_0x1d6b4e){if(_0x1d6b4e){return _0x4dc87c[_0xf7b2('0x19')](_0x1698a9);}return _0x4dc87c[_0xf7b2('0x1a')](_0x1698a9)[_0xf7b2('0x1b')]();};}function respondWithResult(_0x256534,_0x4e9540){_0x4e9540=_0x4e9540||0xc8;return function(_0xf74236){if(_0xf74236){return _0x256534[_0xf7b2('0x1a')](_0x4e9540)['json'](_0xf74236);}};}function respondWithFilteredResult(_0x2118a9,_0x26688c){return function(_0x447f50){if(_0x447f50){var _0x2b9d0f=_0x447f50[_0xf7b2('0x1c')],_0x16b986=_0x26688c[_0xf7b2('0x1d')],_0x27d38c=_0x26688c[_0xf7b2('0x1d')]+_0x26688c[_0xf7b2('0x1e')],_0x3ffe91;if(_0x27d38c>=_0x2b9d0f){_0x27d38c=_0x2b9d0f;_0x3ffe91=0xc8;}else{_0x3ffe91=0xce;}_0x2118a9[_0xf7b2('0x1a')](_0x3ffe91);return _0x2118a9[_0xf7b2('0x1f')]('Content-Range',_0x16b986+'-'+_0x27d38c+'/'+_0x2b9d0f)[_0xf7b2('0x20')](_0x447f50);}return null;};}function patchUpdates(_0x1e7b9c){return function(_0x44e620){try{jsonpatch[_0xf7b2('0x21')](_0x44e620,_0x1e7b9c,!![]);}catch(_0x21d59e){return BPromise['reject'](_0x21d59e);}return _0x44e620[_0xf7b2('0x22')]();};}function saveUpdates(_0x335b7b,_0x3c6034){return function(_0x42b3a8){if(_0x42b3a8){return _0x42b3a8[_0xf7b2('0x23')](_0x335b7b)['then'](function(_0x13c23e){return _0x13c23e;});}return null;};}function removeEntity(_0x8d9f05,_0x296a1e){return function(_0x30a234){if(_0x30a234){return _0x30a234[_0xf7b2('0x24')]()[_0xf7b2('0x25')](function(){_0x8d9f05[_0xf7b2('0x1a')](0xcc)[_0xf7b2('0x1b')]();});}};}function handleEntityNotFound(_0xf391c0,_0x44390b){return function(_0x296027){if(!_0x296027){_0xf391c0['sendStatus'](0x194);}return _0x296027;};}function handleError(_0x785929,_0x23523a){_0x23523a=_0x23523a||0x1f4;return function(_0x5201fb){logger[_0xf7b2('0x26')](_0x5201fb[_0xf7b2('0x27')]);if(_0x5201fb[_0xf7b2('0x28')]){delete _0x5201fb[_0xf7b2('0x28')];}_0x785929[_0xf7b2('0x1a')](_0x23523a)[_0xf7b2('0x29')](_0x5201fb);};}exports[_0xf7b2('0x2a')]=function(_0xad6162,_0x548bca){var _0x30530d={},_0x47c4c={},_0x42c909={'count':0x0,'rows':[]};var _0x232108=_['map'](db[_0xf7b2('0x2b')][_0xf7b2('0x2c')],function(_0x20180d){return{'name':_0x20180d[_0xf7b2('0x2d')],'type':_0x20180d[_0xf7b2('0x2e')][_0xf7b2('0x2f')]};});_0x47c4c[_0xf7b2('0x30')]=_['differenceBy'](_[_0xf7b2('0x31')](_0x232108,_0xf7b2('0x28')),[_0xf7b2('0x32')]);_0x47c4c[_0xf7b2('0x33')]=_[_0xf7b2('0x34')](_0xad6162[_0xf7b2('0x33')]);_0x47c4c[_0xf7b2('0x35')]=_[_0xf7b2('0x36')](_0x47c4c[_0xf7b2('0x30')],_0x47c4c[_0xf7b2('0x33')]);_0x30530d[_0xf7b2('0x37')]=_['intersection'](_0x47c4c['model'],qs[_0xf7b2('0x38')](_0xad6162[_0xf7b2('0x33')][_0xf7b2('0x38')]));_0x30530d['attributes']=_0x30530d[_0xf7b2('0x37')][_0xf7b2('0x39')]?_0x30530d[_0xf7b2('0x37')]:_0x47c4c['model'];if(!_0xad6162[_0xf7b2('0x33')][_0xf7b2('0x3a')](_0xf7b2('0x3b'))){_0x30530d[_0xf7b2('0x1e')]=qs[_0xf7b2('0x1e')](_0xad6162[_0xf7b2('0x33')][_0xf7b2('0x1e')]);_0x30530d['offset']=qs[_0xf7b2('0x1d')](_0xad6162[_0xf7b2('0x33')][_0xf7b2('0x1d')]);}_0x30530d[_0xf7b2('0x3c')]=qs[_0xf7b2('0x3d')](_0xad6162[_0xf7b2('0x33')]['sort']);_0x30530d[_0xf7b2('0x3e')]=qs[_0xf7b2('0x35')](_[_0xf7b2('0x3f')](_0xad6162[_0xf7b2('0x33')],_0x47c4c[_0xf7b2('0x35')]),_0x232108);if(_0xad6162['query']['filter']){_0x30530d[_0xf7b2('0x3e')]=_[_0xf7b2('0x40')](_0x30530d[_0xf7b2('0x3e')],{'$or':_[_0xf7b2('0x31')](_0x232108,function(_0x2d7067){if(_0x2d7067['type']!==_0xf7b2('0x41')){var _0x48787f={};_0x48787f[_0x2d7067[_0xf7b2('0x28')]]={'$like':'%'+_0xad6162[_0xf7b2('0x33')][_0xf7b2('0x42')]+'%'};return _0x48787f;}})});}_0x30530d=_['merge']({},_0x30530d,_0xad6162[_0xf7b2('0x43')]);var _0x427213={'where':_0x30530d['where']};return db['ScreenRecording'][_0xf7b2('0x1c')](_0x427213)[_0xf7b2('0x25')](function(_0x58eb04){_0x42c909['count']=_0x58eb04;if(_0xad6162[_0xf7b2('0x33')][_0xf7b2('0x44')]){_0x30530d[_0xf7b2('0x45')]=[{'all':!![]}];}return db['ScreenRecording'][_0xf7b2('0x46')](_0x30530d);})['then'](function(_0x80fe43){_0x42c909[_0xf7b2('0x47')]=_0x80fe43;return _0x42c909;})[_0xf7b2('0x25')](respondWithFilteredResult(_0x548bca,_0x30530d))[_0xf7b2('0x48')](handleError(_0x548bca,null));};exports[_0xf7b2('0x49')]=function(_0x279246,_0x54f33){var _0x1e3929={'raw':![],'where':{'id':_0x279246[_0xf7b2('0x4a')]['id']}},_0x173f18={};_0x173f18['model']=_[_0xf7b2('0x34')](db[_0xf7b2('0x2b')][_0xf7b2('0x2c')]);_0x173f18[_0xf7b2('0x33')]=_[_0xf7b2('0x34')](_0x279246[_0xf7b2('0x33')]);_0x173f18[_0xf7b2('0x35')]=_[_0xf7b2('0x36')](_0x173f18['model'],_0x173f18['query']);_0x1e3929[_0xf7b2('0x37')]=_[_0xf7b2('0x36')](_0x173f18[_0xf7b2('0x30')],qs[_0xf7b2('0x38')](_0x279246[_0xf7b2('0x33')]['fields']));_0x1e3929[_0xf7b2('0x37')]=_0x1e3929['attributes'][_0xf7b2('0x39')]?_0x1e3929['attributes']:_0x173f18[_0xf7b2('0x30')];if(_0x279246[_0xf7b2('0x33')]['includeAll']){_0x1e3929[_0xf7b2('0x45')]=[{'all':!![]}];}_0x1e3929=_[_0xf7b2('0x40')]({},_0x1e3929,_0x279246[_0xf7b2('0x43')]);return db['ScreenRecording'][_0xf7b2('0x4b')](_0x1e3929)['then'](handleEntityNotFound(_0x54f33,null))[_0xf7b2('0x25')](respondWithResult(_0x54f33,null))[_0xf7b2('0x48')](handleError(_0x54f33,null));};exports[_0xf7b2('0x4c')]=function(_0x3780ed,_0x318b73){return db['ScreenRecording']['create'](_0x3780ed[_0xf7b2('0x4d')],{})[_0xf7b2('0x25')](respondWithResult(_0x318b73,0xc9))['catch'](handleError(_0x318b73,null));};exports['update']=function(_0x455c89,_0x151641){if(_0x455c89['body']['id']){delete _0x455c89['body']['id'];}delete _0x455c89[_0xf7b2('0x4d')][_0xf7b2('0x4e')];delete _0x455c89[_0xf7b2('0x4d')]['createdAt'];delete _0x455c89['body']['closedAt'];delete _0x455c89[_0xf7b2('0x4d')]['value'];return db[_0xf7b2('0x2b')][_0xf7b2('0x4b')]({'where':{'id':_0x455c89['params']['id']}})[_0xf7b2('0x25')](handleEntityNotFound(_0x151641,null))['then'](saveUpdates(_0x455c89[_0xf7b2('0x4d')],null))[_0xf7b2('0x25')](respondWithResult(_0x151641,null))[_0xf7b2('0x48')](handleError(_0x151641,null));};exports[_0xf7b2('0x4f')]=function(_0x426741,_0x1ac631){return db['ScreenRecording'][_0xf7b2('0x4f')]()['then'](respondWithResult(_0x1ac631,null))[_0xf7b2('0x48')](handleError(_0x1ac631,null));};exports[_0xf7b2('0x50')]=function(_0x3c0e6c,_0x56d9e3,_0x305bef){var _0x39b978=require('../../components/encryptor');var _0x59c290=![];var _0x2ce2cf={};if(_0x3c0e6c['query'][_0xf7b2('0x2e')]&&_0x3c0e6c[_0xf7b2('0x33')][_0xf7b2('0x2e')]===_0xf7b2('0x51')){_0x2ce2cf[_0xf7b2('0x51')]=_0x3c0e6c[_0xf7b2('0x4a')]['id'];}else{_0x2ce2cf['id']=_0x3c0e6c[_0xf7b2('0x4a')]['id'];}return db[_0xf7b2('0x2b')][_0xf7b2('0x4b')]({'where':_0x2ce2cf,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x56d9e3,null))['then'](function(_0x20f51f){if(_0x20f51f){var _0x2a3058=path[_0xf7b2('0x52')](config[_0xf7b2('0x53')],_0xf7b2('0x54'),_0x20f51f[_0xf7b2('0x55')]);var _0x35748b=util[_0xf7b2('0x32')](_0xf7b2('0x56'),_0x2a3058);if(fs['existsSync'](_0x35748b)){_0x59c290=!![];return _0x39b978[_0xf7b2('0x57')](_0x35748b,_0x2a3058,config[_0xf7b2('0x58')]['recording'])[_0xf7b2('0x25')](function(){return _0x20f51f;});}return _0x20f51f;}})[_0xf7b2('0x25')](function(_0x16fbaf){if(_0x16fbaf){var _0x2299ff=path[_0xf7b2('0x52')](config[_0xf7b2('0x53')],_0xf7b2('0x54'),_0x16fbaf['value']);if(!fs[_0xf7b2('0x59')](_0x2299ff)){throw new db[(_0xf7b2('0x5a'))][(_0xf7b2('0x5b'))](_0xf7b2('0x5c'));}if(_0x16fbaf[_0xf7b2('0x5d')]){return _0x56d9e3[_0xf7b2('0x50')](_0x2299ff,_0x16fbaf['filename']+path['extname'](_0x2299ff),function(){if(_0x59c290){fs[_0xf7b2('0x5e')](_0x2299ff);}});}else{return _0x56d9e3[_0xf7b2('0x50')](_0x2299ff,function(_0x43ec86){if(_0x59c290){fs[_0xf7b2('0x5e')](_0x2299ff);}});}}})['catch'](function(_0x2778bd){if(_0x2778bd[_0xf7b2('0x5f')]==='ScreenRecording\x20not\x20found'){_0x56d9e3[_0xf7b2('0x1a')](0x194)['send'](_0xf7b2('0x60'));}else{return handleError(_0x56d9e3,null);}});};exports['destroy']=function(_0x2a61f4,_0x3219e5){return db[_0xf7b2('0x2b')][_0xf7b2('0x4b')]({'where':{'id':_0x2a61f4[_0xf7b2('0x4a')]['id']}})['then'](function(_0x292f4f){if(!_0x292f4f)throw new ReferenceError(_0xf7b2('0x61'));return _0x292f4f;})[_0xf7b2('0x25')](function(_0xe4ec8c){var _0x3a8734=path[_0xf7b2('0x52')](config['root'],_0xf7b2('0x54'),_0xe4ec8c[_0xf7b2('0x55')]);logger[_0xf7b2('0x62')](_0xf7b2('0x63'),_0x3a8734);if(!_[_0xf7b2('0x64')](_0xe4ec8c[_0xf7b2('0x55')])&&fs[_0xf7b2('0x59')](_0x3a8734)){logger[_0xf7b2('0x62')](_0xf7b2('0x65')+_0x3a8734+_0xf7b2('0x66'));fs[_0xf7b2('0x67')](_0x3a8734);}_0x3a8734=_0x3a8734+'.cypher';if(!_[_0xf7b2('0x64')](_0xe4ec8c[_0xf7b2('0x55')])&&fs[_0xf7b2('0x59')](_0x3a8734)){logger[_0xf7b2('0x62')]('File:\x20\x22'+_0x3a8734+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x3a8734);}return _0xe4ec8c;})[_0xf7b2('0x25')](function(_0x2c66b2){if(!_0x2c66b2)throw new InternalError();return _0x2c66b2[_0xf7b2('0x24')]();})[_0xf7b2('0x25')](function(){_0x3219e5[_0xf7b2('0x1a')](0xcc)['end']();})['catch'](handleError(_0x3219e5,null));}; \ No newline at end of file +var _0x763a=['eml-format','rimraf','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','Content-Range','json','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','options','ScreenRecording','count','include','findAll','catch','params','includeAll','find','create','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','decryptFile','secrets','recording','ValidationError','filename','extname','unlink','ScreenRecording\x20not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','existsSync','unlinkSync','destroy','html-pdf'];(function(_0x2898bc,_0x310976){var _0xf47cf4=function(_0x403954){while(--_0x403954){_0x2898bc['push'](_0x2898bc['shift']());}};_0xf47cf4(++_0x310976);}(_0x763a,0x128));var _0xa763=function(_0x46c7bd,_0x4b858d){_0x46c7bd=_0x46c7bd-0x0;var _0x2422fc=_0x763a[_0x46c7bd];return _0x2422fc;};'use strict';var pdf=require(_0xa763('0x0'));var emlformat=require(_0xa763('0x1'));var rimraf=require(_0xa763('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa763('0x3'));var BPromise=require(_0xa763('0x4'));var Mustache=require(_0xa763('0x5'));var util=require(_0xa763('0x6'));var path=require(_0xa763('0x7'));var sox=require(_0xa763('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa763('0x9'));var squel=require(_0xa763('0xa'));var crypto=require(_0xa763('0xb'));var jsforce=require(_0xa763('0xc'));var deskjs=require(_0xa763('0xd'));var toCsv=require(_0xa763('0xe'));var querystring=require('querystring');var Papa=require(_0xa763('0xf'));var Redis=require('ioredis');var authService=require(_0xa763('0x10'));var qs=require(_0xa763('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa763('0x12'));var utils=require(_0xa763('0x13'));var config=require(_0xa763('0x14'));var licenseUtil=require(_0xa763('0x15'));var db=require(_0xa763('0x16'))['db'];function respondWithStatusCode(_0x53d061,_0x25a297){_0x25a297=_0x25a297||0xcc;return function(_0x4b1e63){if(_0x4b1e63){return _0x53d061['sendStatus'](_0x25a297);}return _0x53d061[_0xa763('0x17')](_0x25a297)[_0xa763('0x18')]();};}function respondWithResult(_0x1de0ac,_0x56d3f9){_0x56d3f9=_0x56d3f9||0xc8;return function(_0x57216a){if(_0x57216a){return _0x1de0ac['status'](_0x56d3f9)['json'](_0x57216a);}};}function respondWithFilteredResult(_0x641ccb,_0x5c674d){return function(_0x590bda){if(_0x590bda){var _0x26db62=_0x590bda['count'],_0x5bb696=_0x5c674d[_0xa763('0x19')],_0x4487a1=_0x5c674d[_0xa763('0x19')]+_0x5c674d[_0xa763('0x1a')],_0x328894;if(_0x4487a1>=_0x26db62){_0x4487a1=_0x26db62;_0x328894=0xc8;}else{_0x328894=0xce;}_0x641ccb[_0xa763('0x17')](_0x328894);return _0x641ccb['set'](_0xa763('0x1b'),_0x5bb696+'-'+_0x4487a1+'/'+_0x26db62)[_0xa763('0x1c')](_0x590bda);}return null;};}function patchUpdates(_0x4d09e4){return function(_0x1ebbcc){try{jsonpatch[_0xa763('0x1d')](_0x1ebbcc,_0x4d09e4,!![]);}catch(_0x521817){return BPromise[_0xa763('0x1e')](_0x521817);}return _0x1ebbcc['save']();};}function saveUpdates(_0x12f9b8,_0x31443a){return function(_0x3d1f08){if(_0x3d1f08){return _0x3d1f08[_0xa763('0x1f')](_0x12f9b8)[_0xa763('0x20')](function(_0x55caa1){return _0x55caa1;});}return null;};}function removeEntity(_0x29a3a3,_0x3db6b4){return function(_0x4c24ca){if(_0x4c24ca){return _0x4c24ca['destroy']()[_0xa763('0x20')](function(){_0x29a3a3[_0xa763('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35bc2e,_0xb980b7){return function(_0x26b5d6){if(!_0x26b5d6){_0x35bc2e['sendStatus'](0x194);}return _0x26b5d6;};}function handleError(_0x16f2ce,_0x2d34d4){_0x2d34d4=_0x2d34d4||0x1f4;return function(_0x3f084b){logger[_0xa763('0x21')](_0x3f084b[_0xa763('0x22')]);if(_0x3f084b['name']){delete _0x3f084b[_0xa763('0x23')];}_0x16f2ce[_0xa763('0x17')](_0x2d34d4)[_0xa763('0x24')](_0x3f084b);};}exports[_0xa763('0x25')]=function(_0x1845ad,_0x512f46){var _0x286db9={},_0x97d3fa={},_0x350c21={'count':0x0,'rows':[]};var _0x428572=_[_0xa763('0x26')](db['ScreenRecording'][_0xa763('0x27')],function(_0x5dc3bc){return{'name':_0x5dc3bc[_0xa763('0x28')],'type':_0x5dc3bc[_0xa763('0x29')][_0xa763('0x2a')]};});_0x97d3fa['model']=_[_0xa763('0x2b')](_[_0xa763('0x26')](_0x428572,_0xa763('0x23')),['format']);_0x97d3fa[_0xa763('0x2c')]=_[_0xa763('0x2d')](_0x1845ad[_0xa763('0x2c')]);_0x97d3fa[_0xa763('0x2e')]=_[_0xa763('0x2f')](_0x97d3fa[_0xa763('0x30')],_0x97d3fa[_0xa763('0x2c')]);_0x286db9[_0xa763('0x31')]=_['intersection'](_0x97d3fa[_0xa763('0x30')],qs[_0xa763('0x32')](_0x1845ad['query']['fields']));_0x286db9[_0xa763('0x31')]=_0x286db9['attributes'][_0xa763('0x33')]?_0x286db9['attributes']:_0x97d3fa[_0xa763('0x30')];if(!_0x1845ad[_0xa763('0x2c')][_0xa763('0x34')](_0xa763('0x35'))){_0x286db9[_0xa763('0x1a')]=qs[_0xa763('0x1a')](_0x1845ad[_0xa763('0x2c')][_0xa763('0x1a')]);_0x286db9[_0xa763('0x19')]=qs[_0xa763('0x19')](_0x1845ad['query'][_0xa763('0x19')]);}_0x286db9[_0xa763('0x36')]=qs[_0xa763('0x37')](_0x1845ad[_0xa763('0x2c')]['sort']);_0x286db9['where']=qs[_0xa763('0x2e')](_['pick'](_0x1845ad[_0xa763('0x2c')],_0x97d3fa[_0xa763('0x2e')]),_0x428572);if(_0x1845ad[_0xa763('0x2c')][_0xa763('0x38')]){_0x286db9['where']=_[_0xa763('0x39')](_0x286db9[_0xa763('0x3a')],{'$or':_[_0xa763('0x26')](_0x428572,function(_0x471955){if(_0x471955[_0xa763('0x29')]!=='VIRTUAL'){var _0x10940f={};_0x10940f[_0x471955[_0xa763('0x23')]]={'$like':'%'+_0x1845ad[_0xa763('0x2c')][_0xa763('0x38')]+'%'};return _0x10940f;}})});}_0x286db9=_[_0xa763('0x39')]({},_0x286db9,_0x1845ad[_0xa763('0x3b')]);var _0x1ddaa0={'where':_0x286db9[_0xa763('0x3a')]};return db[_0xa763('0x3c')][_0xa763('0x3d')](_0x1ddaa0)[_0xa763('0x20')](function(_0x1c8e76){_0x350c21[_0xa763('0x3d')]=_0x1c8e76;if(_0x1845ad[_0xa763('0x2c')]['includeAll']){_0x286db9[_0xa763('0x3e')]=[{'all':!![]}];}return db[_0xa763('0x3c')][_0xa763('0x3f')](_0x286db9);})[_0xa763('0x20')](function(_0x45eeeb){_0x350c21['rows']=_0x45eeeb;return _0x350c21;})[_0xa763('0x20')](respondWithFilteredResult(_0x512f46,_0x286db9))[_0xa763('0x40')](handleError(_0x512f46,null));};exports['show']=function(_0x24d307,_0x108156){var _0x3dc747={'raw':![],'where':{'id':_0x24d307[_0xa763('0x41')]['id']}},_0x51fe21={};_0x51fe21[_0xa763('0x30')]=_[_0xa763('0x2d')](db[_0xa763('0x3c')]['rawAttributes']);_0x51fe21[_0xa763('0x2c')]=_['keys'](_0x24d307[_0xa763('0x2c')]);_0x51fe21[_0xa763('0x2e')]=_[_0xa763('0x2f')](_0x51fe21[_0xa763('0x30')],_0x51fe21[_0xa763('0x2c')]);_0x3dc747[_0xa763('0x31')]=_[_0xa763('0x2f')](_0x51fe21[_0xa763('0x30')],qs[_0xa763('0x32')](_0x24d307[_0xa763('0x2c')][_0xa763('0x32')]));_0x3dc747['attributes']=_0x3dc747[_0xa763('0x31')][_0xa763('0x33')]?_0x3dc747['attributes']:_0x51fe21['model'];if(_0x24d307[_0xa763('0x2c')][_0xa763('0x42')]){_0x3dc747[_0xa763('0x3e')]=[{'all':!![]}];}_0x3dc747=_[_0xa763('0x39')]({},_0x3dc747,_0x24d307[_0xa763('0x3b')]);return db[_0xa763('0x3c')][_0xa763('0x43')](_0x3dc747)[_0xa763('0x20')](handleEntityNotFound(_0x108156,null))['then'](respondWithResult(_0x108156,null))['catch'](handleError(_0x108156,null));};exports[_0xa763('0x44')]=function(_0x212f2a,_0x1e8b5a){return db[_0xa763('0x3c')][_0xa763('0x44')](_0x212f2a[_0xa763('0x45')],{})['then'](respondWithResult(_0x1e8b5a,0xc9))[_0xa763('0x40')](handleError(_0x1e8b5a,null));};exports[_0xa763('0x1f')]=function(_0x3f7656,_0x499bff){if(_0x3f7656[_0xa763('0x45')]['id']){delete _0x3f7656[_0xa763('0x45')]['id'];}delete _0x3f7656['body'][_0xa763('0x46')];delete _0x3f7656['body'][_0xa763('0x47')];delete _0x3f7656[_0xa763('0x45')][_0xa763('0x48')];delete _0x3f7656[_0xa763('0x45')][_0xa763('0x49')];return db[_0xa763('0x3c')]['find']({'where':{'id':_0x3f7656[_0xa763('0x41')]['id']}})['then'](handleEntityNotFound(_0x499bff,null))[_0xa763('0x20')](saveUpdates(_0x3f7656[_0xa763('0x45')],null))[_0xa763('0x20')](respondWithResult(_0x499bff,null))['catch'](handleError(_0x499bff,null));};exports[_0xa763('0x4a')]=function(_0x2fa8bb,_0x153b6b){return db[_0xa763('0x3c')]['describe']()[_0xa763('0x20')](respondWithResult(_0x153b6b,null))[_0xa763('0x40')](handleError(_0x153b6b,null));};exports[_0xa763('0x4b')]=function(_0x4e1cb4,_0x492d1e,_0x56241e){var _0x4dc86e=require(_0xa763('0x4c'));var _0x316b4a=![];var _0x1bfe96={};if(_0x4e1cb4[_0xa763('0x2c')][_0xa763('0x29')]&&_0x4e1cb4[_0xa763('0x2c')][_0xa763('0x29')]===_0xa763('0x4d')){_0x1bfe96[_0xa763('0x4d')]=_0x4e1cb4[_0xa763('0x41')]['id'];}else{_0x1bfe96['id']=_0x4e1cb4[_0xa763('0x41')]['id'];}return db['ScreenRecording'][_0xa763('0x43')]({'where':_0x1bfe96,'attributes':['id','value'],'raw':!![]})[_0xa763('0x20')](handleEntityNotFound(_0x492d1e,null))[_0xa763('0x20')](function(_0x26759b){if(_0x26759b){var _0x3ec6cc=path[_0xa763('0x4e')](config[_0xa763('0x4f')],_0xa763('0x50'),_0x26759b[_0xa763('0x49')]);var _0x4b5d0c=util[_0xa763('0x51')]('%s.cypher',_0x3ec6cc);if(fs['existsSync'](_0x4b5d0c)){_0x316b4a=!![];return _0x4dc86e[_0xa763('0x52')](_0x4b5d0c,_0x3ec6cc,config[_0xa763('0x53')][_0xa763('0x54')])[_0xa763('0x20')](function(){return _0x26759b;});}return _0x26759b;}})[_0xa763('0x20')](function(_0x455471){if(_0x455471){var _0x5a2196=path[_0xa763('0x4e')](config[_0xa763('0x4f')],_0xa763('0x50'),_0x455471[_0xa763('0x49')]);if(!fs['existsSync'](_0x5a2196)){throw new db['Sequelize'][(_0xa763('0x55'))]('ScreenRecording\x20not\x20found');}if(_0x455471[_0xa763('0x56')]){return _0x492d1e[_0xa763('0x4b')](_0x5a2196,_0x455471[_0xa763('0x56')]+path[_0xa763('0x57')](_0x5a2196),function(){if(_0x316b4a){fs[_0xa763('0x58')](_0x5a2196);}});}else{return _0x492d1e[_0xa763('0x4b')](_0x5a2196,function(_0x17fbe5){if(_0x316b4a){fs[_0xa763('0x58')](_0x5a2196);}});}}})[_0xa763('0x40')](function(_0x24fba8){if(_0x24fba8['message']===_0xa763('0x59')){_0x492d1e[_0xa763('0x17')](0x194)['send']('Not\x20found');}else{return handleError(_0x492d1e,null);}});};exports['destroy']=function(_0x3bd998,_0x2f231d){return db[_0xa763('0x3c')][_0xa763('0x43')]({'where':{'id':_0x3bd998[_0xa763('0x41')]['id']}})[_0xa763('0x20')](function(_0x4bbaa3){if(!_0x4bbaa3)throw new ReferenceError(_0xa763('0x5a'));return _0x4bbaa3;})[_0xa763('0x20')](function(_0x3de2ff){var _0x42e7ef=path[_0xa763('0x4e')](config[_0xa763('0x4f')],'server/files/screen_recordings',_0x3de2ff[_0xa763('0x49')]);logger[_0xa763('0x5b')]('cancellazione\x20fisica\x20documento\x20%s',_0x42e7ef);if(!_[_0xa763('0x5c')](_0x3de2ff[_0xa763('0x49')])&&fs['existsSync'](_0x42e7ef)){logger['info'](_0xa763('0x5d')+_0x42e7ef+_0xa763('0x5e'));fs['unlinkSync'](_0x42e7ef);}_0x42e7ef=_0x42e7ef+_0xa763('0x5f');if(!_[_0xa763('0x5c')](_0x3de2ff[_0xa763('0x49')])&&fs[_0xa763('0x60')](_0x42e7ef)){logger[_0xa763('0x5b')]('File:\x20\x22'+_0x42e7ef+_0xa763('0x5e'));fs[_0xa763('0x61')](_0x42e7ef);}return _0x3de2ff;})[_0xa763('0x20')](function(_0x464a9b){if(!_0x464a9b)throw new InternalError();return _0x464a9b[_0xa763('0x62')]();})[_0xa763('0x20')](function(){_0x2f231d[_0xa763('0x17')](0xcc)['end']();})['catch'](handleError(_0x2f231d,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index e5d8a6e..a13ae10 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 _0x8d72=['bluebird','request-promise','path','rimraf','./screenRecording.attributes','define','screen_recordings','interactionid','../../config/logger','api'];(function(_0x2c2d42,_0x369378){var _0x22db53=function(_0x437cd0){while(--_0x437cd0){_0x2c2d42['push'](_0x2c2d42['shift']());}};_0x22db53(++_0x369378);}(_0x8d72,0xee));var _0x28d7=function(_0xe67d26,_0x44e170){_0xe67d26=_0xe67d26-0x0;var _0x43b3ab=_0x8d72[_0xe67d26];return _0x43b3ab;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x28d7('0x0'))(_0x28d7('0x1'));var moment=require('moment');var BPromise=require(_0x28d7('0x2'));var rp=require(_0x28d7('0x3'));var fs=require('fs');var path=require(_0x28d7('0x4'));var rimraf=require(_0x28d7('0x5'));var config=require('../../config/environment');var attributes=require(_0x28d7('0x6'));module['exports']=function(_0x4df7c8,_0x59ba5f){return _0x4df7c8[_0x28d7('0x7')]('ScreenRecording',attributes,{'tableName':_0x28d7('0x8'),'paranoid':![],'indexes':[{'name':_0x28d7('0x9'),'fields':[_0x28d7('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x507b=['ScreenRecording','screen_recordings','interactionid','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x237da8,_0x37b77a){var _0x558825=function(_0x45d7f1){while(--_0x45d7f1){_0x237da8['push'](_0x237da8['shift']());}};_0x558825(++_0x37b77a);}(_0x507b,0x100));var _0xb507=function(_0x329e25,_0x1ad759){_0x329e25=_0x329e25-0x0;var _0x535939=_0x507b[_0x329e25];return _0x535939;};'use strict';var _=require('lodash');var util=require(_0xb507('0x0'));var logger=require(_0xb507('0x1'))('api');var moment=require(_0xb507('0x2'));var BPromise=require(_0xb507('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb507('0x4'));var rimraf=require(_0xb507('0x5'));var config=require(_0xb507('0x6'));var attributes=require('./screenRecording.attributes');module[_0xb507('0x7')]=function(_0x4edb99,_0x20b147){return _0x4edb99['define'](_0xb507('0x8'),attributes,{'tableName':_0xb507('0x9'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xb507('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index b8f8b1a..faf7294 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(_0x25ef6b,_0x1cde7e){var _0x5b2240=function(_0x415ba0){while(--_0x415ba0){_0x25ef6b['push'](_0x25ef6b['shift']());}};_0x5b2240(++_0x1cde7e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x31a746,_0xb3dfc5){var _0x634807=function(_0x974656){while(--_0x974656){_0x31a746['push'](_0x31a746['shift']());}};_0x634807(++_0xb3dfc5);}(_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 diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 4646c95..0064a26 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 _0xbfa7=['extname','format','preferred','originalname','/:id/preferred','addPreferred','addFavicon','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/now','getDate','/:id','show','getLogo','/:id/logo_login','gdpr','getPreferred','/:id/favicon','join','root','%s%s','logo','post','single','file','addLogo','server/files/images/logos/','logologin'];(function(_0x33ebf5,_0x258ec6){var _0x66957b=function(_0x49739a){while(--_0x49739a){_0x33ebf5['push'](_0x33ebf5['shift']());}};_0x66957b(++_0x258ec6);}(_0xbfa7,0x11b));var _0x7bfa=function(_0x239a15,_0xe568d3){_0x239a15=_0x239a15-0x0;var _0x4504bd=_0xbfa7[_0x239a15];return _0x4504bd;};'use strict';var multer=require(_0x7bfa('0x0'));var util=require(_0x7bfa('0x1'));var path=require(_0x7bfa('0x2'));var timeout=require(_0x7bfa('0x3'));var express=require(_0x7bfa('0x4'));var router=express[_0x7bfa('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7bfa('0x6'));var config=require(_0x7bfa('0x7'));var controller=require('./setting.controller');router[_0x7bfa('0x8')]('/',auth[_0x7bfa('0x9')](),controller['index']);router[_0x7bfa('0x8')](_0x7bfa('0xa'),controller[_0x7bfa('0xb')]);router[_0x7bfa('0x8')](_0x7bfa('0xc'),controller[_0x7bfa('0xd')]);router[_0x7bfa('0x8')]('/:id/logo',controller[_0x7bfa('0xe')]);router[_0x7bfa('0x8')](_0x7bfa('0xf'),controller['getLogoLogin']);router[_0x7bfa('0x8')]('/:id/gdpr',controller[_0x7bfa('0x10')]);router[_0x7bfa('0x8')]('/:id/preferred',controller[_0x7bfa('0x11')]);router['get'](_0x7bfa('0x12'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x23526a,_0x28c75b,_0x46344a){_0x46344a(null,path[_0x7bfa('0x13')](config[_0x7bfa('0x14')],'server/files/images/logos/'));},'filename':function(_0x52ed82,_0x33b563,_0x5289d7){_0x5289d7(null,util['format'](_0x7bfa('0x15'),_0x7bfa('0x16'),path['extname'](_0x33b563['originalname'])));}})});router[_0x7bfa('0x17')]('/:id/logo',upload[_0x7bfa('0x18')](_0x7bfa('0x19')),controller[_0x7bfa('0x1a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2c98c1,_0x2f6878,_0x34579d){_0x34579d(null,path['join'](config['root'],_0x7bfa('0x1b')));},'filename':function(_0x407731,_0xa407da,_0x49fb2d){_0x49fb2d(null,util['format'](_0x7bfa('0x15'),_0x7bfa('0x1c'),path[_0x7bfa('0x1d')](_0xa407da['originalname'])));}})});router[_0x7bfa('0x17')]('/:id/logo_login',upload['single']('file'),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x357d66,_0x511717,_0x1a1a98){_0x1a1a98(null,path[_0x7bfa('0x13')](config[_0x7bfa('0x14')],_0x7bfa('0x1b')));},'filename':function(_0xcb6a86,_0x52b4eb,_0x4bf116){_0x4bf116(null,util[_0x7bfa('0x1e')]('%s%s',_0x7bfa('0x1f'),path[_0x7bfa('0x1d')](_0x52b4eb[_0x7bfa('0x20')])));}})});router[_0x7bfa('0x17')](_0x7bfa('0x21'),upload[_0x7bfa('0x18')](_0x7bfa('0x19')),controller[_0x7bfa('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a7810,_0x3950bb,_0x69384a){_0x69384a(null,path[_0x7bfa('0x13')](config[_0x7bfa('0x14')],'server/files/images/logos/'));},'filename':function(_0x1f7ba9,_0x42c5a6,_0x40cada){_0x40cada(null,util[_0x7bfa('0x1e')](_0x7bfa('0x15'),'favicon',path[_0x7bfa('0x1d')](_0x42c5a6[_0x7bfa('0x20')])));}})});router['post']('/:id/favicon',upload['single']('file'),controller[_0x7bfa('0x23')]);router[_0x7bfa('0x24')](_0x7bfa('0xc'),auth[_0x7bfa('0x9')](),controller[_0x7bfa('0x25')]);module[_0x7bfa('0x26')]=router; \ No newline at end of file +var _0xb6ce=['addLogoLogin','join','preferred','addPreferred','favicon','addFavicon','/:id','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./setting.controller','get','index','/now','getDate','show','/:id/logo','getLogo','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','root','format','%s%s','logo','extname','originalname','single','addLogo','server/files/images/logos/','logologin','post','file'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xb6ce,0x170));var _0xeb6c=function(_0x5b4ada,_0x10735f){_0x5b4ada=_0x5b4ada-0x0;var _0x6636=_0xb6ce[_0x5b4ada];return _0x6636;};'use strict';var multer=require('multer');var util=require(_0xeb6c('0x0'));var path=require(_0xeb6c('0x1'));var timeout=require(_0xeb6c('0x2'));var express=require(_0xeb6c('0x3'));var router=express['Router']();var auth=require(_0xeb6c('0x4'));var interaction=require(_0xeb6c('0x5'));var config=require('../../config/environment');var controller=require(_0xeb6c('0x6'));router[_0xeb6c('0x7')]('/',auth['isAuthenticated'](),controller[_0xeb6c('0x8')]);router[_0xeb6c('0x7')](_0xeb6c('0x9'),controller[_0xeb6c('0xa')]);router[_0xeb6c('0x7')]('/:id',controller[_0xeb6c('0xb')]);router['get'](_0xeb6c('0xc'),controller[_0xeb6c('0xd')]);router[_0xeb6c('0x7')]('/:id/logo_login',controller['getLogoLogin']);router[_0xeb6c('0x7')](_0xeb6c('0xe'),controller[_0xeb6c('0xf')]);router[_0xeb6c('0x7')](_0xeb6c('0x10'),controller[_0xeb6c('0x11')]);router['get']('/:id/favicon',controller[_0xeb6c('0x12')]);var upload=multer({'storage':multer[_0xeb6c('0x13')]({'destination':function(_0x4c080d,_0x14226b,_0x45cfd5){_0x45cfd5(null,path['join'](config[_0xeb6c('0x14')],'server/files/images/logos/'));},'filename':function(_0x29a887,_0xf33dd7,_0x2c030b){_0x2c030b(null,util[_0xeb6c('0x15')](_0xeb6c('0x16'),_0xeb6c('0x17'),path[_0xeb6c('0x18')](_0xf33dd7[_0xeb6c('0x19')])));}})});router['post'](_0xeb6c('0xc'),upload[_0xeb6c('0x1a')]('file'),controller[_0xeb6c('0x1b')]);var upload=multer({'storage':multer[_0xeb6c('0x13')]({'destination':function(_0x275d58,_0x4c4cd0,_0x97acb){_0x97acb(null,path['join'](config[_0xeb6c('0x14')],_0xeb6c('0x1c')));},'filename':function(_0x532c5c,_0x130127,_0x462f2a){_0x462f2a(null,util[_0xeb6c('0x15')](_0xeb6c('0x16'),_0xeb6c('0x1d'),path[_0xeb6c('0x18')](_0x130127[_0xeb6c('0x19')])));}})});router[_0xeb6c('0x1e')]('/:id/logo_login',upload[_0xeb6c('0x1a')](_0xeb6c('0x1f')),controller[_0xeb6c('0x20')]);var upload=multer({'storage':multer[_0xeb6c('0x13')]({'destination':function(_0x1dc044,_0x592cd0,_0x481952){_0x481952(null,path[_0xeb6c('0x21')](config[_0xeb6c('0x14')],_0xeb6c('0x1c')));},'filename':function(_0xb8d844,_0x59b6e6,_0xe33b7c){_0xe33b7c(null,util[_0xeb6c('0x15')](_0xeb6c('0x16'),_0xeb6c('0x22'),path[_0xeb6c('0x18')](_0x59b6e6[_0xeb6c('0x19')])));}})});router[_0xeb6c('0x1e')](_0xeb6c('0x10'),upload[_0xeb6c('0x1a')]('file'),controller[_0xeb6c('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5a0665,_0xcee9af,_0x1ff63b){_0x1ff63b(null,path[_0xeb6c('0x21')](config[_0xeb6c('0x14')],_0xeb6c('0x1c')));},'filename':function(_0x5478c7,_0x2aebfa,_0x1e3de6){_0x1e3de6(null,util[_0xeb6c('0x15')]('%s%s',_0xeb6c('0x24'),path[_0xeb6c('0x18')](_0x2aebfa[_0xeb6c('0x19')])));}})});router[_0xeb6c('0x1e')]('/:id/favicon',upload[_0xeb6c('0x1a')]('file'),controller[_0xeb6c('0x25')]);router['put'](_0xeb6c('0x26'),auth['isAuthenticated'](),controller['update']);module[_0xeb6c('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 1233883..8a7fd40 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 _0xdcae=['sequelize','exports','INTEGER','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED'];(function(_0xf97c20,_0x5c8c94){var _0x3d7df5=function(_0x5f3863){while(--_0x5f3863){_0xf97c20['push'](_0xf97c20['shift']());}};_0x3d7df5(++_0x5c8c94);}(_0xdcae,0xb4));var _0xedca=function(_0x9d1d1f,_0x3d6e3f){_0x9d1d1f=_0x9d1d1f-0x0;var _0x19e276=_0xdcae[_0x9d1d1f];return _0x19e276;};'use strict';var Sequelize=require(_0xedca('0x0'));module[_0xedca('0x1')]={'min_internal':{'type':Sequelize[_0xedca('0x2')](0xb),'unique':_0xedca('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xedca('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xedca('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xedca('0x4')],'defaultValue':_0xedca('0x5')},'logo':{'type':Sequelize[_0xedca('0x4')]},'defaultLogo':{'type':Sequelize[_0xedca('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xedca('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xedca('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xedca('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xedca('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xedca('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xedca('0x4')]},'turnaddr':{'type':Sequelize[_0xedca('0x4')]},'turnusername':{'type':Sequelize[_0xedca('0x4')]},'turnpassword':{'type':Sequelize[_0xedca('0x4')]},'pageTitle':{'type':Sequelize[_0xedca('0x4')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xedca('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xedca('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xedca('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xedca('0x4')],'defaultValue':_0xedca('0x7')},'enableEmailPreview':{'type':Sequelize[_0xedca('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xedca('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xedca('0x8')},'chatTimeout':{'type':Sequelize[_0xedca('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xedca('0x4')]},'defaultPreferred':{'type':Sequelize[_0xedca('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xedca('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xedca('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xedca('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xedca('0x4')]},'defaultFavicon':{'type':Sequelize[_0xedca('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xedca('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xedca('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xedca('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xedca('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xedca('0x2')]},'sentimentRegion':{'type':Sequelize[_0xedca('0x4')]},'language':{'type':Sequelize[_0xedca('0x4')]},'bucket':{'type':Sequelize[_0xedca('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0xedca('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xedca('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xedca('0x2')](0x2)[_0xedca('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0xedca('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xedca('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xedca('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xedca('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xedca('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x75ec=['https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','sequelize','exports','min_internal','INTEGER','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN'];(function(_0x6814d,_0x3a38d5){var _0x33f9e8=function(_0x38ab7a){while(--_0x38ab7a){_0x6814d['push'](_0x6814d['shift']());}};_0x33f9e8(++_0x3a38d5);}(_0x75ec,0xe3));var _0xc75e=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x75ec[_0x88cd7b];return _0x56fcc8;};'use strict';var Sequelize=require(_0xc75e('0x0'));module[_0xc75e('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xc75e('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xc75e('0x3')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xc75e('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0xc75e('0x4')},'logo':{'type':Sequelize[_0xc75e('0x5')]},'defaultLogo':{'type':Sequelize[_0xc75e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xc75e('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xc75e('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xc75e('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xc75e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xc75e('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xc75e('0x5')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xc75e('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xc75e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xc75e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xc75e('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xc75e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xc75e('0x5')],'defaultValue':_0xc75e('0x7')},'enableEmailPreview':{'type':Sequelize[_0xc75e('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xc75e('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xc75e('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xc75e('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xc75e('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xc75e('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0xc75e('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xc75e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xc75e('0x5')]},'defaultPreferred':{'type':Sequelize[_0xc75e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xc75e('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0xc75e('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xc75e('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xc75e('0x5')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xc75e('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xc75e('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xc75e('0x3')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0xc75e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xc75e('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xc75e('0x3')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc75e('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xc75e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xc75e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xc75e('0x3')](0x2)[_0xc75e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0xc75e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xc75e('0x3')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xc75e('0x3')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xc75e('0x3')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xc75e('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 0238244..c2ca064 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 _0x950a=['sort','where','pick','merge','map','VIRTUAL','filter','options','findAll','rows','params','includeAll','include','find','body','addLogo','file','logo','filename','loginLogo','getLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultPreferred','join','root','toLower','default_logo.svg','default','upperFirst','custom','existsSync','Sequelize','\x20not\x20found','getLogoLogin','defaultLoginLogo','default_loginLogo.svg','ValidationError','download','securePassword','addPreferred','getLicense','defaultFavicon','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','format','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','Setting','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit'];(function(_0x28f765,_0x1c8bd4){var _0x8f050f=function(_0x36ba57){while(--_0x36ba57){_0x28f765['push'](_0x28f765['shift']());}};_0x8f050f(++_0x1c8bd4);}(_0x950a,0xaa));var _0xa950=function(_0x523031,_0x355d4f){_0x523031=_0x523031-0x0;var _0x2c0acc=_0x950a[_0x523031];return _0x2c0acc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa950('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa950('0x1'));var jsonpatch=require(_0xa950('0x2'));var rp=require('request-promise');var moment=require(_0xa950('0x3'));var BPromise=require(_0xa950('0x4'));var Mustache=require(_0xa950('0x5'));var util=require('util');var path=require(_0xa950('0x6'));var sox=require(_0xa950('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa950('0x8'));var squel=require('squel');var crypto=require(_0xa950('0x9'));var jsforce=require(_0xa950('0xa'));var deskjs=require(_0xa950('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa950('0xc'));var Papa=require(_0xa950('0xd'));var Redis=require(_0xa950('0xe'));var authService=require(_0xa950('0xf'));var qs=require(_0xa950('0x10'));var as=require(_0xa950('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa950('0x12'))(_0xa950('0x13'));var utils=require(_0xa950('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa950('0x15'));var db=require(_0xa950('0x16'))['db'];var jayson=require(_0xa950('0x17'));var client=jayson['client'][_0xa950('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1546f3,_0x38f41a,_0x1fe475,_0x58dfd3){return new BPromise(function(_0xd531e3,_0x2601f9){var _0x9b0bb5=_0x58dfd3||client;return _0x9b0bb5[_0xa950('0x19')](_0x1546f3,_0x1fe475)[_0xa950('0x1a')](function(_0x20684a){logger['info'](_0xa950('0x1b'),_0x38f41a,_0xa950('0x1c'));logger[_0xa950('0x1d')]('Setting,\x20%s,\x20%s,\x20%s',_0x38f41a,_0xa950('0x1c'),JSON[_0xa950('0x1e')](_0x20684a));if(_0x20684a[_0xa950('0x1f')]){if(_0x20684a['error'][_0xa950('0x20')]===0x1f4){logger[_0xa950('0x1f')](_0xa950('0x1b'),_0x38f41a,_0x20684a[_0xa950('0x1f')]['message']);return _0x2601f9(_0x20684a['error'][_0xa950('0x21')]);}logger[_0xa950('0x1f')](_0xa950('0x1b'),_0x38f41a,_0x20684a[_0xa950('0x1f')][_0xa950('0x21')]);return _0xd531e3(_0x20684a['error'][_0xa950('0x21')]);}else{logger['info'](_0xa950('0x1b'),_0x38f41a,_0xa950('0x1c'));_0xd531e3(_0x20684a[_0xa950('0x22')][_0xa950('0x21')]);}})[_0xa950('0x23')](function(_0x4f4659){logger[_0xa950('0x1f')]('Setting,\x20%s,\x20%s',_0x38f41a,_0x4f4659);_0x2601f9(_0x4f4659);});});}function respondWithStatusCode(_0x122741,_0x6a578d){_0x6a578d=_0x6a578d||0xcc;return function(_0xb9ad11){if(_0xb9ad11){return _0x122741[_0xa950('0x24')](_0x6a578d);}return _0x122741[_0xa950('0x25')](_0x6a578d)['end']();};}function respondWithResult(_0xfc8cc1,_0x5359f5){_0x5359f5=_0x5359f5||0xc8;return function(_0x58661f){if(_0x58661f){return _0xfc8cc1['status'](_0x5359f5)[_0xa950('0x26')](_0x58661f);}};}function respondWithFilteredResult(_0x4c0083,_0x2ef145){return function(_0x438941){if(_0x438941){var _0x1f0055=_0x438941[_0xa950('0x27')],_0x25800d=_0x2ef145[_0xa950('0x28')],_0x8337ea=_0x2ef145[_0xa950('0x28')]+_0x2ef145[_0xa950('0x29')],_0x5a2de0;if(_0x8337ea>=_0x1f0055){_0x8337ea=_0x1f0055;_0x5a2de0=0xc8;}else{_0x5a2de0=0xce;}_0x4c0083['status'](_0x5a2de0);return _0x4c0083[_0xa950('0x2a')](_0xa950('0x2b'),_0x25800d+'-'+_0x8337ea+'/'+_0x1f0055)[_0xa950('0x26')](_0x438941);}return null;};}function patchUpdates(_0x4e0bf5){return function(_0x3bf239){try{jsonpatch[_0xa950('0x2c')](_0x3bf239,_0x4e0bf5,!![]);}catch(_0xd053ff){return BPromise[_0xa950('0x2d')](_0xd053ff);}return _0x3bf239[_0xa950('0x2e')]();};}function saveUpdates(_0x1fdf0d,_0x1fb356){return function(_0x11a85c){if(_0x11a85c){return _0x11a85c[_0xa950('0x2f')](_0x1fdf0d)[_0xa950('0x1a')](function(_0x525a69){return _0x525a69;});}return null;};}function removeEntity(_0x5b2354,_0xa33fdb){return function(_0x348bb3){if(_0x348bb3){return _0x348bb3[_0xa950('0x30')]()['then'](function(){_0x5b2354[_0xa950('0x25')](0xcc)[_0xa950('0x31')]();});}};}function handleEntityNotFound(_0x29747a,_0x5a645b){return function(_0x3ddae6){if(!_0x3ddae6){_0x29747a[_0xa950('0x24')](0x194);}return _0x3ddae6;};}function handleError(_0x266bff,_0x473688){_0x473688=_0x473688||0x1f4;return function(_0x15b187){logger[_0xa950('0x1f')](_0x15b187[_0xa950('0x32')]);if(_0x15b187[_0xa950('0x33')]){delete _0x15b187[_0xa950('0x33')];}_0x266bff['status'](_0x473688)[_0xa950('0x34')](_0x15b187);};}exports[_0xa950('0x35')]=function(_0x47d7a9,_0x4f5774){var _0x271490={},_0x447995={},_0x103a79={'count':0x0,'rows':[]};var _0x1cb21e=_['map'](db[_0xa950('0x36')][_0xa950('0x37')],function(_0x2f8d25){return{'name':_0x2f8d25['fieldName'],'type':_0x2f8d25[_0xa950('0x38')]['key']};});_0x447995[_0xa950('0x39')]=_['map'](_0x1cb21e,_0xa950('0x33'));_0x447995['query']=_[_0xa950('0x3a')](_0x47d7a9[_0xa950('0x3b')]);_0x447995[_0xa950('0x3c')]=_[_0xa950('0x3d')](_0x447995[_0xa950('0x39')],_0x447995[_0xa950('0x3b')]);_0x271490[_0xa950('0x3e')]=_[_0xa950('0x3d')](_0x447995[_0xa950('0x39')],qs[_0xa950('0x3f')](_0x47d7a9[_0xa950('0x3b')][_0xa950('0x3f')]));_0x271490[_0xa950('0x3e')]=_0x271490[_0xa950('0x3e')][_0xa950('0x40')]?_0x271490[_0xa950('0x3e')]:_0x447995['model'];if(!_0x47d7a9['query']['hasOwnProperty'](_0xa950('0x41'))){_0x271490['limit']=qs[_0xa950('0x29')](_0x47d7a9['query'][_0xa950('0x29')]);_0x271490[_0xa950('0x28')]=qs[_0xa950('0x28')](_0x47d7a9[_0xa950('0x3b')][_0xa950('0x28')]);}_0x271490['order']=qs[_0xa950('0x42')](_0x47d7a9[_0xa950('0x3b')][_0xa950('0x42')]);_0x271490[_0xa950('0x43')]=qs[_0xa950('0x3c')](_[_0xa950('0x44')](_0x47d7a9[_0xa950('0x3b')],_0x447995['filters']),_0x1cb21e);if(_0x47d7a9['query']['filter']){_0x271490[_0xa950('0x43')]=_[_0xa950('0x45')](_0x271490[_0xa950('0x43')],{'$or':_[_0xa950('0x46')](_0x1cb21e,function(_0x29a6b5){if(_0x29a6b5[_0xa950('0x38')]!==_0xa950('0x47')){var _0x78cb01={};_0x78cb01[_0x29a6b5[_0xa950('0x33')]]={'$like':'%'+_0x47d7a9[_0xa950('0x3b')][_0xa950('0x48')]+'%'};return _0x78cb01;}})});}_0x271490=_[_0xa950('0x45')]({},_0x271490,_0x47d7a9[_0xa950('0x49')]);var _0x4c01b1={'where':_0x271490['where']};return db[_0xa950('0x36')]['count'](_0x4c01b1)[_0xa950('0x1a')](function(_0x56142f){_0x103a79[_0xa950('0x27')]=_0x56142f;if(_0x47d7a9[_0xa950('0x3b')]['includeAll']){_0x271490['include']=[{'all':!![]}];}return db[_0xa950('0x36')][_0xa950('0x4a')](_0x271490);})['then'](function(_0x57b480){_0x103a79[_0xa950('0x4b')]=_0x57b480;return _0x103a79;})[_0xa950('0x1a')](respondWithFilteredResult(_0x4f5774,_0x271490))[_0xa950('0x23')](handleError(_0x4f5774,null));};exports['show']=function(_0x56f4b8,_0x56220c){var _0xa56847={'raw':![],'where':{'id':_0x56f4b8[_0xa950('0x4c')]['id']}},_0x4d8b5a={};_0x4d8b5a[_0xa950('0x39')]=_[_0xa950('0x3a')](db[_0xa950('0x36')]['rawAttributes']);_0x4d8b5a[_0xa950('0x3b')]=_[_0xa950('0x3a')](_0x56f4b8[_0xa950('0x3b')]);_0x4d8b5a[_0xa950('0x3c')]=_[_0xa950('0x3d')](_0x4d8b5a[_0xa950('0x39')],_0x4d8b5a['query']);_0xa56847['attributes']=_[_0xa950('0x3d')](_0x4d8b5a['model'],qs[_0xa950('0x3f')](_0x56f4b8['query'][_0xa950('0x3f')]));_0xa56847[_0xa950('0x3e')]=_0xa56847[_0xa950('0x3e')]['length']?_0xa56847['attributes']:_0x4d8b5a[_0xa950('0x39')];if(_0x56f4b8[_0xa950('0x3b')][_0xa950('0x4d')]){_0xa56847[_0xa950('0x4e')]=[{'all':!![]}];}_0xa56847=_['merge']({},_0xa56847,_0x56f4b8[_0xa950('0x49')]);return db[_0xa950('0x36')][_0xa950('0x4f')](_0xa56847)[_0xa950('0x1a')](handleEntityNotFound(_0x56220c,null))['then'](respondWithResult(_0x56220c,null))['catch'](handleError(_0x56220c,null));};exports[_0xa950('0x2f')]=function(_0x3e6220,_0x35437e){if(_0x3e6220[_0xa950('0x50')]['id']){delete _0x3e6220[_0xa950('0x50')]['id'];}return db['Setting'][_0xa950('0x4f')]({'where':{'id':_0x3e6220[_0xa950('0x4c')]['id']}})['then'](handleEntityNotFound(_0x35437e,null))[_0xa950('0x1a')](saveUpdates(_0x3e6220[_0xa950('0x50')],null))['then'](respondWithResult(_0x35437e,null))[_0xa950('0x23')](handleError(_0x35437e,null));};exports[_0xa950('0x51')]=function(_0x145f65,_0x4f6fc2,_0x1204a0){if(_0x145f65[_0xa950('0x52')]&&_0x145f65[_0xa950('0x52')]['filename']){_0x145f65[_0xa950('0x50')][_0xa950('0x53')]=_0x145f65['file']['filename'];}return db[_0xa950('0x36')][_0xa950('0x4f')]({'where':{'id':_0x145f65['params']['id']}})[_0xa950('0x1a')](handleEntityNotFound(_0x4f6fc2,null))[_0xa950('0x1a')](saveUpdates(_0x145f65['body'],null))[_0xa950('0x1a')](respondWithResult(_0x4f6fc2,null))['catch'](handleError(_0x4f6fc2,null));};exports['addLogoLogin']=function(_0x32bbb3,_0x4d7881,_0x9cf0ec){if(_0x32bbb3[_0xa950('0x52')]&&_0x32bbb3['file'][_0xa950('0x54')]){_0x32bbb3[_0xa950('0x50')][_0xa950('0x55')]=_0x32bbb3['file'][_0xa950('0x54')];}return db['Setting']['find']({'where':{'id':_0x32bbb3['params']['id']}})[_0xa950('0x1a')](handleEntityNotFound(_0x4d7881,null))[_0xa950('0x1a')](saveUpdates(_0x32bbb3[_0xa950('0x50')],null))[_0xa950('0x1a')](respondWithResult(_0x4d7881,null))[_0xa950('0x23')](handleError(_0x4d7881,null));};var utilLicense=require('../../config/license/util');exports[_0xa950('0x56')]=function(_0x2c86f2,_0x3bc489,_0x1db1b5){var _0x280268=_0xa950('0x57');var _0x12b7dd={'custom':![]};return utilLicense['getLicense']()[_0xa950('0x1a')](function(_0x3a9344){if(_0x3a9344){_0x12b7dd=_0x3a9344;}return db[_0xa950('0x36')][_0xa950('0x4f')]({'where':{'id':_0x2c86f2[_0xa950('0x4c')]['id']},'attributes':[_0xa950('0x53'),_0xa950('0x55'),_0xa950('0x58'),_0xa950('0x59'),_0xa950('0x5a'),'defaultLoginLogo',_0xa950('0x5b'),'defaultFavicon'],'raw':!![]});})[_0xa950('0x1a')](handleEntityNotFound(_0x3bc489,null))[_0xa950('0x1a')](function(_0x225666){if(_0x225666){var _0x50d696=_0x225666['logo']&&fs['existsSync'](path[_0xa950('0x5c')](config[_0xa950('0x5d')],_0x280268,_['toLower'](_0x225666['logo'])))?path[_0xa950('0x5c')](config[_0xa950('0x5d')],_0x280268,_[_0xa950('0x5e')](_0x225666[_0xa950('0x53')])):path[_0xa950('0x5c')](config[_0xa950('0x5d')],_0x280268,_[_0xa950('0x5e')](_0xa950('0x5f')));var _0x218b95=_0xa950('0x60')+_[_0xa950('0x61')]('logo');if(_0x225666[_0x218b95]||!_0x12b7dd[_0xa950('0x62')]){_0x50d696=path['join'](config[_0xa950('0x5d')],_0x280268,_[_0xa950('0x5e')](_0xa950('0x5f')));}if(!fs[_0xa950('0x63')](_0x50d696)){throw new db[(_0xa950('0x64'))]['ValidationError'](_['upperFirst'](_0xa950('0x53'))+_0xa950('0x65'));}return _0x3bc489['download'](_0x50d696);}})[_0xa950('0x23')](handleError(_0x3bc489,null));};var utilLicense=require(_0xa950('0x15'));exports[_0xa950('0x66')]=function(_0x3ffe87,_0x35c04c,_0x47ef22){var _0x1d234c=_0xa950('0x57');var _0x4f1b3b={'custom':![]};return utilLicense['getLicense']()[_0xa950('0x1a')](function(_0x51a88d){if(_0x51a88d){_0x4f1b3b=_0x51a88d;}return db[_0xa950('0x36')][_0xa950('0x4f')]({'where':{'id':_0x3ffe87['params']['id']},'attributes':[_0xa950('0x53'),_0xa950('0x55'),'preferred',_0xa950('0x59'),_0xa950('0x5a'),_0xa950('0x67'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xa950('0x1a')](handleEntityNotFound(_0x35c04c,null))[_0xa950('0x1a')](function(_0x533f8d){if(_0x533f8d){var _0x22db75=_0x533f8d[_0xa950('0x55')]&&fs[_0xa950('0x63')](path[_0xa950('0x5c')](config[_0xa950('0x5d')],_0x1d234c,_['toLower'](_0x533f8d[_0xa950('0x55')])))?path[_0xa950('0x5c')](config[_0xa950('0x5d')],_0x1d234c,_[_0xa950('0x5e')](_0x533f8d[_0xa950('0x55')])):path['join'](config['root'],_0x1d234c,_['toLower'](_0xa950('0x68')));var _0x133c2f=_0xa950('0x60')+_[_0xa950('0x61')]('loginLogo');if(_0x533f8d[_0x133c2f]||!_0x4f1b3b[_0xa950('0x62')]){_0x22db75=path[_0xa950('0x5c')](config[_0xa950('0x5d')],_0x1d234c,_[_0xa950('0x5e')]('default_loginLogo.svg'));}if(!fs[_0xa950('0x63')](_0x22db75)){throw new db[(_0xa950('0x64'))][(_0xa950('0x69'))](_['upperFirst']('loginLogo')+_0xa950('0x65'));}return _0x35c04c[_0xa950('0x6a')](_0x22db75);}})[_0xa950('0x23')](handleError(_0x35c04c,null));};exports['gdpr']=function(_0x408d82,_0x4a8ec2){return db[_0xa950('0x36')][_0xa950('0x4f')]({'where':{'id':_0x408d82['params']['id']},'attributes':[_0xa950('0x6b')]})[_0xa950('0x1a')](respondWithResult(_0x4a8ec2,null))[_0xa950('0x23')](handleError(_0x4a8ec2,null));};exports[_0xa950('0x6c')]=function(_0x1b818d,_0x574e94,_0x5d7931){if(_0x1b818d[_0xa950('0x52')]&&_0x1b818d[_0xa950('0x52')][_0xa950('0x54')]){_0x1b818d[_0xa950('0x50')][_0xa950('0x58')]=_0x1b818d[_0xa950('0x52')][_0xa950('0x54')];}return db[_0xa950('0x36')][_0xa950('0x4f')]({'where':{'id':_0x1b818d['params']['id']}})[_0xa950('0x1a')](handleEntityNotFound(_0x574e94,null))[_0xa950('0x1a')](saveUpdates(_0x1b818d['body'],null))[_0xa950('0x1a')](respondWithResult(_0x574e94,null))[_0xa950('0x23')](handleError(_0x574e94,null));};var utilLicense=require(_0xa950('0x15'));exports['getPreferred']=function(_0x1f90d3,_0xe5f55,_0x3b93e2){var _0x257999=_0xa950('0x57');var _0x33aadc={'custom':![]};return utilLicense[_0xa950('0x6d')]()[_0xa950('0x1a')](function(_0x381a75){if(_0x381a75){_0x33aadc=_0x381a75;}return db[_0xa950('0x36')]['find']({'where':{'id':_0x1f90d3[_0xa950('0x4c')]['id']},'attributes':['logo',_0xa950('0x55'),_0xa950('0x58'),'favicon',_0xa950('0x5a'),'defaultLoginLogo',_0xa950('0x5b'),_0xa950('0x6e')],'raw':!![]});})['then'](handleEntityNotFound(_0xe5f55,null))[_0xa950('0x1a')](function(_0x4420cb){if(_0x4420cb){var _0x29014e=_0x4420cb[_0xa950('0x58')]&&fs[_0xa950('0x63')](path[_0xa950('0x5c')](config['root'],_0x257999,_[_0xa950('0x5e')](_0x4420cb[_0xa950('0x58')])))?path[_0xa950('0x5c')](config[_0xa950('0x5d')],_0x257999,_[_0xa950('0x5e')](_0x4420cb[_0xa950('0x58')])):path['join'](config[_0xa950('0x5d')],_0x257999,_[_0xa950('0x5e')](_0xa950('0x6f')));var _0x1e3ffd='default'+_[_0xa950('0x61')]('preferred');if(_0x4420cb[_0x1e3ffd]||!_0x33aadc[_0xa950('0x62')]||!_0x33aadc[_0xa950('0x58')]){_0x29014e=path[_0xa950('0x5c')](config[_0xa950('0x5d')],_0x257999,_[_0xa950('0x5e')](_0xa950('0x6f')));}if(!fs[_0xa950('0x63')](_0x29014e)){throw new db[(_0xa950('0x64'))][(_0xa950('0x69'))](_['upperFirst']('preferred')+_0xa950('0x65'));}return _0xe5f55[_0xa950('0x6a')](_0x29014e);}})[_0xa950('0x23')](handleError(_0xe5f55,null));};exports[_0xa950('0x70')]=function(_0x46acb7,_0x238df6,_0x1cf9f4){if(_0x46acb7['file']&&_0x46acb7[_0xa950('0x52')][_0xa950('0x54')]){_0x46acb7[_0xa950('0x50')][_0xa950('0x59')]=_0x46acb7[_0xa950('0x52')][_0xa950('0x54')];}return db[_0xa950('0x36')][_0xa950('0x4f')]({'where':{'id':_0x46acb7['params']['id']}})[_0xa950('0x1a')](handleEntityNotFound(_0x238df6,null))[_0xa950('0x1a')](saveUpdates(_0x46acb7[_0xa950('0x50')],null))[_0xa950('0x1a')](respondWithResult(_0x238df6,null))[_0xa950('0x23')](handleError(_0x238df6,null));};var utilLicense=require(_0xa950('0x15'));exports[_0xa950('0x71')]=function(_0x17cc16,_0x20dbd7,_0x120c2e){var _0x44d85e=_0xa950('0x57');var _0x47a5ed={'custom':![]};return utilLicense[_0xa950('0x6d')]()[_0xa950('0x1a')](function(_0x2ce832){if(_0x2ce832){_0x47a5ed=_0x2ce832;}return db[_0xa950('0x36')][_0xa950('0x4f')]({'where':{'id':_0x17cc16[_0xa950('0x4c')]['id']},'attributes':['logo',_0xa950('0x55'),_0xa950('0x58'),_0xa950('0x59'),'defaultLogo','defaultLoginLogo',_0xa950('0x5b'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x20dbd7,null))['then'](function(_0x18b45a){if(_0x18b45a){var _0x52b0b6=_0x18b45a[_0xa950('0x59')]&&fs[_0xa950('0x63')](path[_0xa950('0x5c')](config[_0xa950('0x5d')],_0x44d85e,_[_0xa950('0x5e')](_0x18b45a[_0xa950('0x59')])))?path[_0xa950('0x5c')](config[_0xa950('0x5d')],_0x44d85e,_[_0xa950('0x5e')](_0x18b45a[_0xa950('0x59')])):path[_0xa950('0x5c')](config['root'],_0x44d85e,_[_0xa950('0x5e')](_0xa950('0x72')));var _0x2ca906=_0xa950('0x60')+_['upperFirst'](_0xa950('0x59'));if(_0x18b45a[_0x2ca906]||!_0x47a5ed['custom']){_0x52b0b6=path[_0xa950('0x5c')](config[_0xa950('0x5d')],_0x44d85e,_[_0xa950('0x5e')](_0xa950('0x72')));}if(!fs[_0xa950('0x63')](_0x52b0b6)){throw new db[(_0xa950('0x64'))][(_0xa950('0x69'))](_[_0xa950('0x61')](_0xa950('0x59'))+'\x20not\x20found');}return _0x20dbd7[_0xa950('0x6a')](_0x52b0b6);}})[_0xa950('0x23')](handleError(_0x20dbd7,null));};exports[_0xa950('0x73')]=function(_0x501a68,_0x1e0822){var _0xdc142b={'offset':moment()['utcOffset']()};_0xdc142b[_0xa950('0x74')]=moment()['utcOffset'](_0xdc142b[_0xa950('0x28')])[_0xa950('0x75')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x1e0822[_0xa950('0x25')](0xc8)[_0xa950('0x34')](_0xdc142b);}; \ No newline at end of file +var _0xe0f6=['squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','count','includeAll','include','rows','params','keys','length','options','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','root','toLower','join','default_logo.svg','upperFirst','custom','existsSync','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultLogo','default_loginLogo.svg','default','gdpr','securePassword','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','YYYY-MM-DD\x20HH:mm:ss:SSS','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe0f6,0x159));var _0x6e0f=function(_0x3b4bd4,_0x5ed589){_0x3b4bd4=_0x3b4bd4-0x0;var _0x430bd1=_0xe0f6[_0x3b4bd4];return _0x430bd1;};'use strict';var pdf=require(_0x6e0f('0x0'));var emlformat=require(_0x6e0f('0x1'));var rimraf=require(_0x6e0f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e0f('0x3'));var rp=require(_0x6e0f('0x4'));var moment=require(_0x6e0f('0x5'));var BPromise=require(_0x6e0f('0x6'));var Mustache=require(_0x6e0f('0x7'));var util=require(_0x6e0f('0x8'));var path=require('path');var sox=require(_0x6e0f('0x9'));var csv=require(_0x6e0f('0xa'));var ejs=require(_0x6e0f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6e0f('0xc'));var crypto=require('crypto');var jsforce=require(_0x6e0f('0xd'));var deskjs=require(_0x6e0f('0xe'));var toCsv=require(_0x6e0f('0xa'));var querystring=require(_0x6e0f('0xf'));var Papa=require(_0x6e0f('0x10'));var Redis=require(_0x6e0f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6e0f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e0f('0x13'));var logger=require(_0x6e0f('0x14'))(_0x6e0f('0x15'));var utils=require(_0x6e0f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6e0f('0x17'));var db=require(_0x6e0f('0x18'))['db'];var jayson=require(_0x6e0f('0x19'));var client=jayson[_0x6e0f('0x1a')][_0x6e0f('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x500d2a,_0x296cab,_0x165702,_0x20fc20){return new BPromise(function(_0x3458e1,_0x165b90){var _0x1aa58c=_0x20fc20||client;return _0x1aa58c[_0x6e0f('0x1c')](_0x500d2a,_0x165702)['then'](function(_0x4b54dd){logger[_0x6e0f('0x1d')](_0x6e0f('0x1e'),_0x296cab,'request\x20sent');logger['debug'](_0x6e0f('0x1f'),_0x296cab,_0x6e0f('0x20'),JSON[_0x6e0f('0x21')](_0x4b54dd));if(_0x4b54dd[_0x6e0f('0x22')]){if(_0x4b54dd[_0x6e0f('0x22')][_0x6e0f('0x23')]===0x1f4){logger[_0x6e0f('0x22')](_0x6e0f('0x1e'),_0x296cab,_0x4b54dd[_0x6e0f('0x22')][_0x6e0f('0x24')]);return _0x165b90(_0x4b54dd[_0x6e0f('0x22')][_0x6e0f('0x24')]);}logger[_0x6e0f('0x22')](_0x6e0f('0x1e'),_0x296cab,_0x4b54dd['error']['message']);return _0x3458e1(_0x4b54dd[_0x6e0f('0x22')][_0x6e0f('0x24')]);}else{logger['info'](_0x6e0f('0x1e'),_0x296cab,_0x6e0f('0x20'));_0x3458e1(_0x4b54dd['result'][_0x6e0f('0x24')]);}})[_0x6e0f('0x25')](function(_0x52bd23){logger[_0x6e0f('0x22')](_0x6e0f('0x1e'),_0x296cab,_0x52bd23);_0x165b90(_0x52bd23);});});}function respondWithStatusCode(_0x1edae3,_0xc7a38f){_0xc7a38f=_0xc7a38f||0xcc;return function(_0x15742e){if(_0x15742e){return _0x1edae3['sendStatus'](_0xc7a38f);}return _0x1edae3[_0x6e0f('0x26')](_0xc7a38f)[_0x6e0f('0x27')]();};}function respondWithResult(_0x47ec2d,_0x443dbc){_0x443dbc=_0x443dbc||0xc8;return function(_0x3b280c){if(_0x3b280c){return _0x47ec2d[_0x6e0f('0x26')](_0x443dbc)[_0x6e0f('0x28')](_0x3b280c);}};}function respondWithFilteredResult(_0xa97c97,_0x1bbfc2){return function(_0x5b308e){if(_0x5b308e){var _0x2cb195=_0x5b308e['count'],_0x33a394=_0x1bbfc2[_0x6e0f('0x29')],_0x506456=_0x1bbfc2[_0x6e0f('0x29')]+_0x1bbfc2[_0x6e0f('0x2a')],_0x2f801f;if(_0x506456>=_0x2cb195){_0x506456=_0x2cb195;_0x2f801f=0xc8;}else{_0x2f801f=0xce;}_0xa97c97[_0x6e0f('0x26')](_0x2f801f);return _0xa97c97[_0x6e0f('0x2b')](_0x6e0f('0x2c'),_0x33a394+'-'+_0x506456+'/'+_0x2cb195)[_0x6e0f('0x28')](_0x5b308e);}return null;};}function patchUpdates(_0x1e244b){return function(_0x454790){try{jsonpatch[_0x6e0f('0x2d')](_0x454790,_0x1e244b,!![]);}catch(_0x28a358){return BPromise['reject'](_0x28a358);}return _0x454790[_0x6e0f('0x2e')]();};}function saveUpdates(_0x58c7ef,_0x4234aa){return function(_0x24eddc){if(_0x24eddc){return _0x24eddc[_0x6e0f('0x2f')](_0x58c7ef)[_0x6e0f('0x30')](function(_0x5ee2c4){return _0x5ee2c4;});}return null;};}function removeEntity(_0xaa322a,_0x2ad9c8){return function(_0x1ed20e){if(_0x1ed20e){return _0x1ed20e[_0x6e0f('0x31')]()['then'](function(){_0xaa322a['status'](0xcc)[_0x6e0f('0x27')]();});}};}function handleEntityNotFound(_0x349659,_0x1dd1a5){return function(_0xcf724b){if(!_0xcf724b){_0x349659[_0x6e0f('0x32')](0x194);}return _0xcf724b;};}function handleError(_0x50a22f,_0xf82fc6){_0xf82fc6=_0xf82fc6||0x1f4;return function(_0x3a9c92){logger[_0x6e0f('0x22')](_0x3a9c92[_0x6e0f('0x33')]);if(_0x3a9c92[_0x6e0f('0x34')]){delete _0x3a9c92['name'];}_0x50a22f[_0x6e0f('0x26')](_0xf82fc6)[_0x6e0f('0x35')](_0x3a9c92);};}exports[_0x6e0f('0x36')]=function(_0x3fc19d,_0x35af99){var _0x5ee812={},_0x43fb4c={},_0x1a71c1={'count':0x0,'rows':[]};var _0x5af0a1=_[_0x6e0f('0x37')](db[_0x6e0f('0x38')][_0x6e0f('0x39')],function(_0x3a701e){return{'name':_0x3a701e[_0x6e0f('0x3a')],'type':_0x3a701e[_0x6e0f('0x3b')]['key']};});_0x43fb4c[_0x6e0f('0x3c')]=_[_0x6e0f('0x37')](_0x5af0a1,_0x6e0f('0x34'));_0x43fb4c[_0x6e0f('0x3d')]=_['keys'](_0x3fc19d[_0x6e0f('0x3d')]);_0x43fb4c[_0x6e0f('0x3e')]=_[_0x6e0f('0x3f')](_0x43fb4c[_0x6e0f('0x3c')],_0x43fb4c[_0x6e0f('0x3d')]);_0x5ee812[_0x6e0f('0x40')]=_[_0x6e0f('0x3f')](_0x43fb4c[_0x6e0f('0x3c')],qs[_0x6e0f('0x41')](_0x3fc19d[_0x6e0f('0x3d')][_0x6e0f('0x41')]));_0x5ee812[_0x6e0f('0x40')]=_0x5ee812[_0x6e0f('0x40')]['length']?_0x5ee812[_0x6e0f('0x40')]:_0x43fb4c[_0x6e0f('0x3c')];if(!_0x3fc19d[_0x6e0f('0x3d')][_0x6e0f('0x42')](_0x6e0f('0x43'))){_0x5ee812[_0x6e0f('0x2a')]=qs[_0x6e0f('0x2a')](_0x3fc19d[_0x6e0f('0x3d')]['limit']);_0x5ee812[_0x6e0f('0x29')]=qs[_0x6e0f('0x29')](_0x3fc19d[_0x6e0f('0x3d')][_0x6e0f('0x29')]);}_0x5ee812[_0x6e0f('0x44')]=qs['sort'](_0x3fc19d[_0x6e0f('0x3d')][_0x6e0f('0x45')]);_0x5ee812[_0x6e0f('0x46')]=qs[_0x6e0f('0x3e')](_[_0x6e0f('0x47')](_0x3fc19d['query'],_0x43fb4c[_0x6e0f('0x3e')]),_0x5af0a1);if(_0x3fc19d[_0x6e0f('0x3d')][_0x6e0f('0x48')]){_0x5ee812[_0x6e0f('0x46')]=_['merge'](_0x5ee812['where'],{'$or':_[_0x6e0f('0x37')](_0x5af0a1,function(_0x51f8a1){if(_0x51f8a1['type']!==_0x6e0f('0x49')){var _0x177f3c={};_0x177f3c[_0x51f8a1[_0x6e0f('0x34')]]={'$like':'%'+_0x3fc19d[_0x6e0f('0x3d')]['filter']+'%'};return _0x177f3c;}})});}_0x5ee812=_['merge']({},_0x5ee812,_0x3fc19d['options']);var _0x5bc10d={'where':_0x5ee812[_0x6e0f('0x46')]};return db[_0x6e0f('0x38')][_0x6e0f('0x4a')](_0x5bc10d)['then'](function(_0x224d44){_0x1a71c1[_0x6e0f('0x4a')]=_0x224d44;if(_0x3fc19d[_0x6e0f('0x3d')][_0x6e0f('0x4b')]){_0x5ee812[_0x6e0f('0x4c')]=[{'all':!![]}];}return db[_0x6e0f('0x38')]['findAll'](_0x5ee812);})['then'](function(_0x55643f){_0x1a71c1[_0x6e0f('0x4d')]=_0x55643f;return _0x1a71c1;})[_0x6e0f('0x30')](respondWithFilteredResult(_0x35af99,_0x5ee812))[_0x6e0f('0x25')](handleError(_0x35af99,null));};exports['show']=function(_0x585ecf,_0x56415d){var _0x4c9e43={'raw':![],'where':{'id':_0x585ecf[_0x6e0f('0x4e')]['id']}},_0x252578={};_0x252578[_0x6e0f('0x3c')]=_[_0x6e0f('0x4f')](db[_0x6e0f('0x38')]['rawAttributes']);_0x252578[_0x6e0f('0x3d')]=_[_0x6e0f('0x4f')](_0x585ecf['query']);_0x252578[_0x6e0f('0x3e')]=_[_0x6e0f('0x3f')](_0x252578[_0x6e0f('0x3c')],_0x252578[_0x6e0f('0x3d')]);_0x4c9e43[_0x6e0f('0x40')]=_[_0x6e0f('0x3f')](_0x252578['model'],qs[_0x6e0f('0x41')](_0x585ecf['query'][_0x6e0f('0x41')]));_0x4c9e43[_0x6e0f('0x40')]=_0x4c9e43[_0x6e0f('0x40')][_0x6e0f('0x50')]?_0x4c9e43[_0x6e0f('0x40')]:_0x252578[_0x6e0f('0x3c')];if(_0x585ecf[_0x6e0f('0x3d')]['includeAll']){_0x4c9e43[_0x6e0f('0x4c')]=[{'all':!![]}];}_0x4c9e43=_['merge']({},_0x4c9e43,_0x585ecf[_0x6e0f('0x51')]);return db[_0x6e0f('0x38')][_0x6e0f('0x52')](_0x4c9e43)[_0x6e0f('0x30')](handleEntityNotFound(_0x56415d,null))[_0x6e0f('0x30')](respondWithResult(_0x56415d,null))[_0x6e0f('0x25')](handleError(_0x56415d,null));};exports[_0x6e0f('0x2f')]=function(_0x29d396,_0x56f5c3){if(_0x29d396[_0x6e0f('0x53')]['id']){delete _0x29d396[_0x6e0f('0x53')]['id'];}return db[_0x6e0f('0x38')][_0x6e0f('0x52')]({'where':{'id':_0x29d396['params']['id']}})[_0x6e0f('0x30')](handleEntityNotFound(_0x56f5c3,null))[_0x6e0f('0x30')](saveUpdates(_0x29d396[_0x6e0f('0x53')],null))['then'](respondWithResult(_0x56f5c3,null))[_0x6e0f('0x25')](handleError(_0x56f5c3,null));};exports[_0x6e0f('0x54')]=function(_0x15d106,_0x38e650,_0xb49dc8){if(_0x15d106[_0x6e0f('0x55')]&&_0x15d106[_0x6e0f('0x55')][_0x6e0f('0x56')]){_0x15d106[_0x6e0f('0x53')][_0x6e0f('0x57')]=_0x15d106[_0x6e0f('0x55')][_0x6e0f('0x56')];}return db[_0x6e0f('0x38')][_0x6e0f('0x52')]({'where':{'id':_0x15d106[_0x6e0f('0x4e')]['id']}})[_0x6e0f('0x30')](handleEntityNotFound(_0x38e650,null))['then'](saveUpdates(_0x15d106[_0x6e0f('0x53')],null))[_0x6e0f('0x30')](respondWithResult(_0x38e650,null))[_0x6e0f('0x25')](handleError(_0x38e650,null));};exports[_0x6e0f('0x58')]=function(_0x570662,_0x43cb58,_0x10cef4){if(_0x570662[_0x6e0f('0x55')]&&_0x570662['file'][_0x6e0f('0x56')]){_0x570662[_0x6e0f('0x53')][_0x6e0f('0x59')]=_0x570662[_0x6e0f('0x55')]['filename'];}return db[_0x6e0f('0x38')][_0x6e0f('0x52')]({'where':{'id':_0x570662[_0x6e0f('0x4e')]['id']}})[_0x6e0f('0x30')](handleEntityNotFound(_0x43cb58,null))[_0x6e0f('0x30')](saveUpdates(_0x570662[_0x6e0f('0x53')],null))[_0x6e0f('0x30')](respondWithResult(_0x43cb58,null))['catch'](handleError(_0x43cb58,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x28888c,_0xd55246,_0x193fd1){var _0x3e77b0=_0x6e0f('0x5a');var _0x109b43={'custom':![]};return utilLicense[_0x6e0f('0x5b')]()[_0x6e0f('0x30')](function(_0x3f765b){if(_0x3f765b){_0x109b43=_0x3f765b;}return db[_0x6e0f('0x38')][_0x6e0f('0x52')]({'where':{'id':_0x28888c[_0x6e0f('0x4e')]['id']},'attributes':['logo','loginLogo',_0x6e0f('0x5c'),_0x6e0f('0x5d'),'defaultLogo',_0x6e0f('0x5e'),_0x6e0f('0x5f'),_0x6e0f('0x60')],'raw':!![]});})[_0x6e0f('0x30')](handleEntityNotFound(_0xd55246,null))[_0x6e0f('0x30')](function(_0x5a90cf){if(_0x5a90cf){var _0x4a32f3=_0x5a90cf[_0x6e0f('0x57')]&&fs['existsSync'](path['join'](config[_0x6e0f('0x61')],_0x3e77b0,_[_0x6e0f('0x62')](_0x5a90cf['logo'])))?path[_0x6e0f('0x63')](config[_0x6e0f('0x61')],_0x3e77b0,_['toLower'](_0x5a90cf['logo'])):path[_0x6e0f('0x63')](config[_0x6e0f('0x61')],_0x3e77b0,_[_0x6e0f('0x62')](_0x6e0f('0x64')));var _0x4104b9='default'+_[_0x6e0f('0x65')](_0x6e0f('0x57'));if(_0x5a90cf[_0x4104b9]||!_0x109b43[_0x6e0f('0x66')]){_0x4a32f3=path['join'](config['root'],_0x3e77b0,_[_0x6e0f('0x62')](_0x6e0f('0x64')));}if(!fs[_0x6e0f('0x67')](_0x4a32f3)){throw new db[(_0x6e0f('0x68'))][(_0x6e0f('0x69'))](_[_0x6e0f('0x65')](_0x6e0f('0x57'))+_0x6e0f('0x6a'));}return _0xd55246[_0x6e0f('0x6b')](_0x4a32f3);}})[_0x6e0f('0x25')](handleError(_0xd55246,null));};var utilLicense=require(_0x6e0f('0x17'));exports[_0x6e0f('0x6c')]=function(_0x2a8cd3,_0x59e96b,_0x4d87a9){var _0x201bc8=_0x6e0f('0x5a');var _0x32b48f={'custom':![]};return utilLicense[_0x6e0f('0x5b')]()['then'](function(_0x286878){if(_0x286878){_0x32b48f=_0x286878;}return db['Setting'][_0x6e0f('0x52')]({'where':{'id':_0x2a8cd3[_0x6e0f('0x4e')]['id']},'attributes':['logo',_0x6e0f('0x59'),_0x6e0f('0x5c'),'favicon',_0x6e0f('0x6d'),_0x6e0f('0x5e'),_0x6e0f('0x5f'),_0x6e0f('0x60')],'raw':!![]});})[_0x6e0f('0x30')](handleEntityNotFound(_0x59e96b,null))['then'](function(_0xe8265c){if(_0xe8265c){var _0x4a113d=_0xe8265c[_0x6e0f('0x59')]&&fs[_0x6e0f('0x67')](path[_0x6e0f('0x63')](config[_0x6e0f('0x61')],_0x201bc8,_[_0x6e0f('0x62')](_0xe8265c[_0x6e0f('0x59')])))?path[_0x6e0f('0x63')](config['root'],_0x201bc8,_[_0x6e0f('0x62')](_0xe8265c[_0x6e0f('0x59')])):path[_0x6e0f('0x63')](config['root'],_0x201bc8,_[_0x6e0f('0x62')](_0x6e0f('0x6e')));var _0x5d81d9=_0x6e0f('0x6f')+_[_0x6e0f('0x65')]('loginLogo');if(_0xe8265c[_0x5d81d9]||!_0x32b48f['custom']){_0x4a113d=path[_0x6e0f('0x63')](config[_0x6e0f('0x61')],_0x201bc8,_[_0x6e0f('0x62')](_0x6e0f('0x6e')));}if(!fs[_0x6e0f('0x67')](_0x4a113d)){throw new db[(_0x6e0f('0x68'))][(_0x6e0f('0x69'))](_[_0x6e0f('0x65')](_0x6e0f('0x59'))+'\x20not\x20found');}return _0x59e96b[_0x6e0f('0x6b')](_0x4a113d);}})[_0x6e0f('0x25')](handleError(_0x59e96b,null));};exports[_0x6e0f('0x70')]=function(_0x1ccfdd,_0x24412c){return db['Setting'][_0x6e0f('0x52')]({'where':{'id':_0x1ccfdd[_0x6e0f('0x4e')]['id']},'attributes':[_0x6e0f('0x71')]})['then'](respondWithResult(_0x24412c,null))['catch'](handleError(_0x24412c,null));};exports['addPreferred']=function(_0x2f2880,_0x265c71,_0x4bda6a){if(_0x2f2880[_0x6e0f('0x55')]&&_0x2f2880[_0x6e0f('0x55')]['filename']){_0x2f2880['body'][_0x6e0f('0x5c')]=_0x2f2880[_0x6e0f('0x55')][_0x6e0f('0x56')];}return db['Setting'][_0x6e0f('0x52')]({'where':{'id':_0x2f2880[_0x6e0f('0x4e')]['id']}})[_0x6e0f('0x30')](handleEntityNotFound(_0x265c71,null))[_0x6e0f('0x30')](saveUpdates(_0x2f2880[_0x6e0f('0x53')],null))[_0x6e0f('0x30')](respondWithResult(_0x265c71,null))[_0x6e0f('0x25')](handleError(_0x265c71,null));};var utilLicense=require(_0x6e0f('0x17'));exports['getPreferred']=function(_0xc8c310,_0x4e68d1,_0x308a21){var _0x11d781='server/files/images/logos';var _0x3ff7cd={'custom':![]};return utilLicense[_0x6e0f('0x5b')]()[_0x6e0f('0x30')](function(_0x39ae0e){if(_0x39ae0e){_0x3ff7cd=_0x39ae0e;}return db[_0x6e0f('0x38')][_0x6e0f('0x52')]({'where':{'id':_0xc8c310[_0x6e0f('0x4e')]['id']},'attributes':['logo',_0x6e0f('0x59'),_0x6e0f('0x5c'),'favicon','defaultLogo',_0x6e0f('0x5e'),_0x6e0f('0x5f'),_0x6e0f('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x4e68d1,null))['then'](function(_0x44b8c3){if(_0x44b8c3){var _0x13ffbb=_0x44b8c3[_0x6e0f('0x5c')]&&fs['existsSync'](path['join'](config[_0x6e0f('0x61')],_0x11d781,_[_0x6e0f('0x62')](_0x44b8c3[_0x6e0f('0x5c')])))?path[_0x6e0f('0x63')](config[_0x6e0f('0x61')],_0x11d781,_[_0x6e0f('0x62')](_0x44b8c3[_0x6e0f('0x5c')])):path['join'](config['root'],_0x11d781,_[_0x6e0f('0x62')](_0x6e0f('0x72')));var _0x47dfbc=_0x6e0f('0x6f')+_[_0x6e0f('0x65')](_0x6e0f('0x5c'));if(_0x44b8c3[_0x47dfbc]||!_0x3ff7cd[_0x6e0f('0x66')]||!_0x3ff7cd[_0x6e0f('0x5c')]){_0x13ffbb=path[_0x6e0f('0x63')](config[_0x6e0f('0x61')],_0x11d781,_[_0x6e0f('0x62')](_0x6e0f('0x72')));}if(!fs['existsSync'](_0x13ffbb)){throw new db['Sequelize'][(_0x6e0f('0x69'))](_[_0x6e0f('0x65')]('preferred')+_0x6e0f('0x6a'));}return _0x4e68d1[_0x6e0f('0x6b')](_0x13ffbb);}})['catch'](handleError(_0x4e68d1,null));};exports[_0x6e0f('0x73')]=function(_0x307f10,_0x525bb9,_0x1e4409){if(_0x307f10['file']&&_0x307f10['file']['filename']){_0x307f10[_0x6e0f('0x53')][_0x6e0f('0x5d')]=_0x307f10[_0x6e0f('0x55')][_0x6e0f('0x56')];}return db['Setting'][_0x6e0f('0x52')]({'where':{'id':_0x307f10[_0x6e0f('0x4e')]['id']}})[_0x6e0f('0x30')](handleEntityNotFound(_0x525bb9,null))[_0x6e0f('0x30')](saveUpdates(_0x307f10[_0x6e0f('0x53')],null))[_0x6e0f('0x30')](respondWithResult(_0x525bb9,null))['catch'](handleError(_0x525bb9,null));};var utilLicense=require(_0x6e0f('0x17'));exports[_0x6e0f('0x74')]=function(_0x4ec5aa,_0x1f1392,_0x442eeb){var _0x575bfc=_0x6e0f('0x5a');var _0x6ee536={'custom':![]};return utilLicense[_0x6e0f('0x5b')]()[_0x6e0f('0x30')](function(_0x43a2c1){if(_0x43a2c1){_0x6ee536=_0x43a2c1;}return db['Setting']['find']({'where':{'id':_0x4ec5aa['params']['id']},'attributes':[_0x6e0f('0x57'),_0x6e0f('0x59'),'preferred',_0x6e0f('0x5d'),_0x6e0f('0x6d'),_0x6e0f('0x5e'),_0x6e0f('0x5f'),_0x6e0f('0x60')],'raw':!![]});})[_0x6e0f('0x30')](handleEntityNotFound(_0x1f1392,null))['then'](function(_0x1800f1){if(_0x1800f1){var _0x102285=_0x1800f1[_0x6e0f('0x5d')]&&fs[_0x6e0f('0x67')](path[_0x6e0f('0x63')](config[_0x6e0f('0x61')],_0x575bfc,_[_0x6e0f('0x62')](_0x1800f1['favicon'])))?path[_0x6e0f('0x63')](config['root'],_0x575bfc,_[_0x6e0f('0x62')](_0x1800f1['favicon'])):path['join'](config[_0x6e0f('0x61')],_0x575bfc,_[_0x6e0f('0x62')](_0x6e0f('0x75')));var _0x1de08e='default'+_['upperFirst'](_0x6e0f('0x5d'));if(_0x1800f1[_0x1de08e]||!_0x6ee536[_0x6e0f('0x66')]){_0x102285=path['join'](config['root'],_0x575bfc,_[_0x6e0f('0x62')](_0x6e0f('0x75')));}if(!fs[_0x6e0f('0x67')](_0x102285)){throw new db[(_0x6e0f('0x68'))][(_0x6e0f('0x69'))](_[_0x6e0f('0x65')](_0x6e0f('0x5d'))+'\x20not\x20found');}return _0x1f1392[_0x6e0f('0x6b')](_0x102285);}})[_0x6e0f('0x25')](handleError(_0x1f1392,null));};exports['getDate']=function(_0x3d6a14,_0x2efdc0){var _0x468778={'offset':moment()['utcOffset']()};_0x468778['now']=moment()['utcOffset'](_0x468778[_0x6e0f('0x29')])['format'](_0x6e0f('0x76'));return _0x2efdc0[_0x6e0f('0x26')](0xc8)['send'](_0x468778);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index edfe2ee..4374174 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 _0x147a=['Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x147592,_0x545856){var _0x1f836c=function(_0xe3fb30){while(--_0xe3fb30){_0x147592['push'](_0x147592['shift']());}};_0x1f836c(++_0x545856);}(_0x147a,0xd2));var _0xa147=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0x147a[_0xadde88];return _0x3b8eb6;};'use strict';var _=require(_0xa147('0x0'));var util=require(_0xa147('0x1'));var logger=require(_0xa147('0x2'))(_0xa147('0x3'));var moment=require('moment');var BPromise=require(_0xa147('0x4'));var rp=require(_0xa147('0x5'));var fs=require('fs');var path=require(_0xa147('0x6'));var rimraf=require('rimraf');var config=require(_0xa147('0x7'));var attributes=require('./setting.attributes');module[_0xa147('0x8')]=function(_0xfff453,_0x42a6c7){return _0xfff453[_0xa147('0x9')](_0xa147('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb57d=['./setting.attributes','exports','define','Setting','lodash','../../config/logger','moment','request-promise','../../config/environment'];(function(_0xf54dc8,_0x47c28d){var _0x18da0d=function(_0x8b6cc4){while(--_0x8b6cc4){_0xf54dc8['push'](_0xf54dc8['shift']());}};_0x18da0d(++_0x47c28d);}(_0xb57d,0xb8));var _0xdb57=function(_0x1f1305,_0x2435f5){_0x1f1305=_0x1f1305-0x0;var _0x571a9d=_0xb57d[_0x1f1305];return _0x571a9d;};'use strict';var _=require(_0xdb57('0x0'));var util=require('util');var logger=require(_0xdb57('0x1'))('api');var moment=require(_0xdb57('0x2'));var BPromise=require('bluebird');var rp=require(_0xdb57('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdb57('0x4'));var attributes=require(_0xdb57('0x5'));module[_0xdb57('0x6')]=function(_0x1b439e,_0x375705){return _0x1b439e[_0xdb57('0x7')](_0xdb57('0x8'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index bb982b6..13e0ca4 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 _0xf8c9=['request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','then','info','Setting,\x20%s,\x20%s'];(function(_0x1c588c,_0x2fcded){var _0x4f8cb2=function(_0x31340b){while(--_0x31340b){_0x1c588c['push'](_0x1c588c['shift']());}};_0x4f8cb2(++_0x2fcded);}(_0xf8c9,0x143));var _0x9f8c=function(_0x938b6a,_0x318dc1){_0x938b6a=_0x938b6a-0x0;var _0x376cfa=_0xf8c9[_0x938b6a];return _0x376cfa;};'use strict';var _=require(_0x9f8c('0x0'));var util=require(_0x9f8c('0x1'));var moment=require(_0x9f8c('0x2'));var BPromise=require(_0x9f8c('0x3'));var rs=require(_0x9f8c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f8c('0x5'))['db'];var utils=require(_0x9f8c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9f8c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9f8c('0x8')][_0x9f8c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fe33f,_0x2414fb,_0x54a988){return new BPromise(function(_0x4274ac,_0x243d84){return client['request'](_0x4fe33f,_0x54a988)[_0x9f8c('0xa')](function(_0x4e890d){logger[_0x9f8c('0xb')](_0x9f8c('0xc'),_0x2414fb,_0x9f8c('0xd'));logger[_0x9f8c('0xe')](_0x9f8c('0xf'),_0x2414fb,_0x9f8c('0xd'),JSON[_0x9f8c('0x10')](_0x4e890d));if(_0x4e890d['error']){if(_0x4e890d[_0x9f8c('0x11')][_0x9f8c('0x12')]===0x1f4){logger['error'](_0x9f8c('0xc'),_0x2414fb,_0x4e890d['error'][_0x9f8c('0x13')]);return _0x243d84(_0x4e890d[_0x9f8c('0x11')][_0x9f8c('0x13')]);}logger['error'](_0x9f8c('0xc'),_0x2414fb,_0x4e890d[_0x9f8c('0x11')][_0x9f8c('0x13')]);return _0x4274ac(_0x4e890d[_0x9f8c('0x11')][_0x9f8c('0x13')]);}else{logger[_0x9f8c('0xb')]('Setting,\x20%s,\x20%s',_0x2414fb,_0x9f8c('0xd'));_0x4274ac(_0x4e890d[_0x9f8c('0x14')][_0x9f8c('0x13')]);}})['catch'](function(_0x48e38b){logger[_0x9f8c('0x11')](_0x9f8c('0xc'),_0x2414fb,_0x48e38b);_0x243d84(_0x48e38b);});});} \ No newline at end of file +var _0xe427=['result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x277e70,_0xb80685){var _0x5bf735=function(_0x5bd9fb){while(--_0x5bd9fb){_0x277e70['push'](_0x277e70['shift']());}};_0x5bf735(++_0xb80685);}(_0xe427,0x162));var _0x7e42=function(_0x40ba6c,_0x5e4c8f){_0x40ba6c=_0x40ba6c-0x0;var _0x2237a9=_0xe427[_0x40ba6c];return _0x2237a9;};'use strict';var _=require(_0x7e42('0x0'));var util=require('util');var moment=require(_0x7e42('0x1'));var BPromise=require('bluebird');var rs=require(_0x7e42('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e42('0x3'))['db'];var utils=require(_0x7e42('0x4'));var logger=require('../../config/logger')(_0x7e42('0x5'));var config=require('../../config/environment');var jayson=require(_0x7e42('0x6'));var client=jayson[_0x7e42('0x7')][_0x7e42('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x13e3e2,_0x4297ce,_0x1b0912){return new BPromise(function(_0x16e3bc,_0x5b581b){return client[_0x7e42('0x9')](_0x13e3e2,_0x1b0912)[_0x7e42('0xa')](function(_0x4f951a){logger[_0x7e42('0xb')](_0x7e42('0xc'),_0x4297ce,_0x7e42('0xd'));logger[_0x7e42('0xe')](_0x7e42('0xf'),_0x4297ce,'request\x20sent',JSON[_0x7e42('0x10')](_0x4f951a));if(_0x4f951a['error']){if(_0x4f951a[_0x7e42('0x11')][_0x7e42('0x12')]===0x1f4){logger['error'](_0x7e42('0xc'),_0x4297ce,_0x4f951a[_0x7e42('0x11')][_0x7e42('0x13')]);return _0x5b581b(_0x4f951a['error'][_0x7e42('0x13')]);}logger[_0x7e42('0x11')](_0x7e42('0xc'),_0x4297ce,_0x4f951a[_0x7e42('0x11')][_0x7e42('0x13')]);return _0x16e3bc(_0x4f951a['error'][_0x7e42('0x13')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x4297ce,_0x7e42('0xd'));_0x16e3bc(_0x4f951a[_0x7e42('0x14')][_0x7e42('0x13')]);}})[_0x7e42('0x15')](function(_0x293084){logger[_0x7e42('0x11')](_0x7e42('0xc'),_0x4297ce,_0x293084);_0x5b581b(_0x293084);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 5d51bf9..944db57 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 _0x41a2=['index','get','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/status','/:id/users','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','addAgents','put','update','delete','destroy','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','isAuthenticated'];(function(_0x3b4433,_0x5bcce6){var _0x357365=function(_0x87c520){while(--_0x87c520){_0x3b4433['push'](_0x3b4433['shift']());}};_0x357365(++_0x5bcce6);}(_0x41a2,0x10e));var _0x241a=function(_0x1b1ce5,_0x508743){_0x1b1ce5=_0x1b1ce5-0x0;var _0x432ff6=_0x41a2[_0x1b1ce5];return _0x432ff6;};'use strict';var multer=require(_0x241a('0x0'));var util=require(_0x241a('0x1'));var path=require(_0x241a('0x2'));var timeout=require(_0x241a('0x3'));var express=require(_0x241a('0x4'));var router=express[_0x241a('0x5')]();var auth=require(_0x241a('0x6'));var interaction=require(_0x241a('0x7'));var config=require('../../config/environment');var controller=require(_0x241a('0x8'));router['get']('/',auth[_0x241a('0x9')](),controller[_0x241a('0xa')]);router[_0x241a('0xb')](_0x241a('0xc'),auth['isAuthenticated'](),controller[_0x241a('0xd')]);router['get'](_0x241a('0xe'),auth[_0x241a('0x9')](),controller[_0x241a('0xf')]);router[_0x241a('0xb')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0x241a('0xb')](_0x241a('0x10'),auth[_0x241a('0x9')](),controller[_0x241a('0x11')]);router[_0x241a('0xb')](_0x241a('0x12'),auth[_0x241a('0x9')](),controller[_0x241a('0x13')]);router[_0x241a('0xb')](_0x241a('0x14'),auth[_0x241a('0x9')](),controller['getInteractions']);router[_0x241a('0xb')](_0x241a('0x15'),controller['statusGet']);router[_0x241a('0xb')](_0x241a('0x16'),auth[_0x241a('0x9')](),controller['getAgents']);router[_0x241a('0x17')]('/',auth[_0x241a('0x9')](),controller[_0x241a('0x18')]);router[_0x241a('0x17')](_0x241a('0x19'),auth['isAuthenticated'](),controller[_0x241a('0x1a')]);router[_0x241a('0x17')](_0x241a('0x10'),auth[_0x241a('0x9')](),controller[_0x241a('0x1b')]);router[_0x241a('0x17')](_0x241a('0x1c'),controller[_0x241a('0x1d')]);router[_0x241a('0x17')](_0x241a('0x12'),auth['isAuthenticated'](),controller[_0x241a('0x1e')]);router[_0x241a('0x17')](_0x241a('0x1f'),auth[_0x241a('0x9')](),controller[_0x241a('0x20')]);router['post'](_0x241a('0x15'),controller['status']);router[_0x241a('0x17')](_0x241a('0x16'),auth[_0x241a('0x9')](),controller[_0x241a('0x21')]);router[_0x241a('0x22')](_0x241a('0xe'),auth[_0x241a('0x9')](),controller[_0x241a('0x23')]);router[_0x241a('0x24')](_0x241a('0xe'),auth['isAuthenticated'](),controller[_0x241a('0x25')]);router[_0x241a('0x24')](_0x241a('0x19'),auth[_0x241a('0x9')](),controller['removeDispositions']);router[_0x241a('0x24')](_0x241a('0x10'),auth[_0x241a('0x9')](),controller[_0x241a('0x26')]);router[_0x241a('0x24')]('/:id/users',auth[_0x241a('0x9')](),controller[_0x241a('0x27')]);module['exports']=router; \ No newline at end of file +var _0x11a2=['index','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','getInteractions','statusGet','create','post','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller'];(function(_0x255e8b,_0x52c66a){var _0xb242fa=function(_0x469720){while(--_0x469720){_0x255e8b['push'](_0x255e8b['shift']());}};_0xb242fa(++_0x52c66a);}(_0x11a2,0x108));var _0x211a=function(_0x28b55d,_0x141c41){_0x28b55d=_0x28b55d-0x0;var _0x509c48=_0x11a2[_0x28b55d];return _0x509c48;};'use strict';var multer=require(_0x211a('0x0'));var util=require('util');var path=require(_0x211a('0x1'));var timeout=require(_0x211a('0x2'));var express=require(_0x211a('0x3'));var router=express[_0x211a('0x4')]();var auth=require(_0x211a('0x5'));var interaction=require(_0x211a('0x6'));var config=require(_0x211a('0x7'));var controller=require(_0x211a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x211a('0x9')]);router[_0x211a('0xa')](_0x211a('0xb'),auth[_0x211a('0xc')](),controller[_0x211a('0xd')]);router[_0x211a('0xa')](_0x211a('0xe'),auth['isAuthenticated'](),controller[_0x211a('0xf')]);router['get'](_0x211a('0x10'),auth[_0x211a('0xc')](),controller[_0x211a('0x11')]);router[_0x211a('0xa')](_0x211a('0x12'),auth['isAuthenticated'](),controller[_0x211a('0x13')]);router['get']('/:id/applications',auth[_0x211a('0xc')](),controller[_0x211a('0x14')]);router[_0x211a('0xa')]('/:id/interactions',auth[_0x211a('0xc')](),controller[_0x211a('0x15')]);router['get']('/:id/status',controller[_0x211a('0x16')]);router['get']('/:id/users',auth[_0x211a('0xc')](),controller['getAgents']);router['post']('/',auth[_0x211a('0xc')](),controller[_0x211a('0x17')]);router[_0x211a('0x18')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x211a('0x19')]);router[_0x211a('0x18')](_0x211a('0x12'),auth[_0x211a('0xc')](),controller[_0x211a('0x1a')]);router[_0x211a('0x18')](_0x211a('0x1b'),controller[_0x211a('0x1c')]);router[_0x211a('0x18')]('/:id/applications',auth[_0x211a('0xc')](),controller[_0x211a('0x1d')]);router[_0x211a('0x18')](_0x211a('0x1e'),auth[_0x211a('0xc')](),controller[_0x211a('0x1f')]);router[_0x211a('0x18')]('/:id/status',controller['status']);router[_0x211a('0x18')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x211a('0x20')]('/:id',auth[_0x211a('0xc')](),controller['update']);router[_0x211a('0x21')](_0x211a('0xe'),auth[_0x211a('0xc')](),controller[_0x211a('0x22')]);router[_0x211a('0x21')](_0x211a('0x10'),auth[_0x211a('0xc')](),controller[_0x211a('0x23')]);router['delete']('/:id/canned_answers',auth[_0x211a('0xc')](),controller[_0x211a('0x24')]);router[_0x211a('0x21')]('/:id/users',auth[_0x211a('0xc')](),controller[_0x211a('0x25')]);module[_0x211a('0x26')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 55e6956..d83afc2 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 _0x3870=['BOOLEAN','TEXT','INTEGER','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','ENUM','twilio','connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer'];(function(_0x561b71,_0x6cfa47){var _0x520fd7=function(_0x5e8d31){while(--_0x5e8d31){_0x561b71['push'](_0x561b71['shift']());}};_0x520fd7(++_0x6cfa47);}(_0x3870,0x146));var _0x0387=function(_0x3ec663,_0x52d758){_0x3ec663=_0x3ec663-0x0;var _0x43bc8e=_0x3870[_0x3ec663];return _0x43bc8e;};'use strict';var Sequelize=require(_0x0387('0x0'));var rs=require(_0x0387('0x1'));module[_0x0387('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x0387('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x0387('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x0387('0x4')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x0387('0x4')]},'type':{'type':Sequelize[_0x0387('0x5')](_0x0387('0x6'),'skebby',_0x0387('0x7'),_0x0387('0x8'),_0x0387('0x9'),_0x0387('0xa'),'bandwidth',_0x0387('0xb'),_0x0387('0xc'),_0x0387('0xd'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x0387('0x4')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x0387('0x4')]},'password':{'type':Sequelize[_0x0387('0x4')]},'apiKey':{'type':Sequelize[_0x0387('0x4')]},'applicationId':{'type':Sequelize[_0x0387('0x4')]},'accountId':{'type':Sequelize[_0x0387('0x4')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x0387('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x0387('0x4')]},'notificationTemplate':{'type':Sequelize[_0x0387('0xf')],'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[_0x0387('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0387('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0387('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0387('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x0387('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0387('0xe')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3fc119){if(!_0x3fc119)this['setDataValue'](_0x0387('0x11'),null);this[_0x0387('0x12')](_0x0387('0x13'),_0x3fc119);}}}; \ No newline at end of file +var _0x2e21=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','infobip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x353fba,_0x46db7e){var _0x4694e4=function(_0x2c122a){while(--_0x2c122a){_0x353fba['push'](_0x353fba['shift']());}};_0x4694e4(++_0x46db7e);}(_0x2e21,0xba));var _0x12e2=function(_0x49e3fb,_0x3521f1){_0x49e3fb=_0x49e3fb-0x0;var _0x33652a=_0x2e21[_0x49e3fb];return _0x33652a;};'use strict';var Sequelize=require(_0x12e2('0x0'));var rs=require(_0x12e2('0x1'));module[_0x12e2('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x12e2('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x12e2('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x12e2('0x4')],'defaultValue':function(){return rs[_0x12e2('0x5')]();}},'phone':{'type':Sequelize[_0x12e2('0x4')]},'type':{'type':Sequelize[_0x12e2('0x6')](_0x12e2('0x7'),_0x12e2('0x8'),_0x12e2('0x9'),_0x12e2('0xa'),_0x12e2('0xb'),_0x12e2('0xc'),_0x12e2('0xd'),'csc',_0x12e2('0xe'),'intelepeer')},'accountSid':{'type':Sequelize[_0x12e2('0x4')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x12e2('0x4')]},'smsMethod':{'type':Sequelize[_0x12e2('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x12e2('0x4')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x12e2('0x4')]},'applicationId':{'type':Sequelize[_0x12e2('0x4')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x12e2('0x4')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x12e2('0x4')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x12e2('0xf');}},'notificationSound':{'type':Sequelize[_0x12e2('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x12e2('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x12e2('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x12e2('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x12e2('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x12e2('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x12e2('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x12e2('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x12e2('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x12e2('0x10')],'defaultValue':![],'comment':_0x12e2('0x13'),'set':function(_0x285ff7){if(!_0x285ff7)this[_0x12e2('0x14')](_0x12e2('0x15'),null);this[_0x12e2('0x14')](_0x12e2('0x16'),_0x285ff7);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index e265e9c..1150972 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 _0xaf29=['internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','DESC','List','user','out','dataValues','inspect','skebby_dispatch_id','connectel','statusInt','status_code','groupName','DELIVERED','redif','update','clickatell','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','debug','received\x20delivery\x20report\x20from','message-id','state','addAgents','ids','emit','userSmsAccount:save','userSmsAccount:remove','getAgents','html-pdf','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./smsAccount.socket','register','client','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','SmsAccounts','UserProfileResource','stack','name','index','Pause','map','SmsAccount','rawAttributes','fieldName','type','keys','filters','model','query','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','length','find','create','get','UserProfileSection','userProfileId','autoAssociation','body','mandatoryDispositionPause','describe','addDisposition','SmsAccountId','Disposition','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','sms','SmsApplication','account','applications','Applications','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','mobile','twilio','from','Body','messageId','skebby','sender','text','clicksend','message_id','plivo','From','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','bandwidth','intelepeer','isNil','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','omit','Contacts','contact','SmsInteraction','spread','created','push','close','unmanaged','interaction','SmsMessage','User','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','send','\x0a','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','priority','getApplications','hasOwnProperty','getInteractions','Owner','fullname'];(function(_0x2c74ab,_0x4a4ebf){var _0x5245b1=function(_0x2ab366){while(--_0x2ab366){_0x2c74ab['push'](_0x2c74ab['shift']());}};_0x5245b1(++_0x4a4ebf);}(_0xaf29,0x1e2));var _0x9af2=function(_0x2ecbc0,_0x26ee68){_0x2ecbc0=_0x2ecbc0-0x0;var _0x5c25db=_0xaf29[_0x2ecbc0];return _0x5c25db;};'use strict';var pdf=require(_0x9af2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9af2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9af2('0x2'));var moment=require('moment');var BPromise=require(_0x9af2('0x3'));var Mustache=require(_0x9af2('0x4'));var util=require(_0x9af2('0x5'));var path=require(_0x9af2('0x6'));var sox=require(_0x9af2('0x7'));var csv=require(_0x9af2('0x8'));var ejs=require(_0x9af2('0x9'));var fs=require('fs');var _=require(_0x9af2('0xa'));var squel=require(_0x9af2('0xb'));var crypto=require('crypto');var jsforce=require(_0x9af2('0xc'));var deskjs=require(_0x9af2('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9af2('0xe'));var Papa=require(_0x9af2('0xf'));var Redis=require('ioredis');var authService=require(_0x9af2('0x10'));var qs=require(_0x9af2('0x11'));var as=require(_0x9af2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9af2('0x13'));var utils=require(_0x9af2('0x14'));var config=require(_0x9af2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9af2('0x16'))['db'];config['redis']=_[_0x9af2('0x17')](config[_0x9af2('0x18')],{'host':_0x9af2('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9af2('0x18')]));require(_0x9af2('0x1a'))[_0x9af2('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9af2('0x1c')]['http']({'port':0x232c});function respondWithRpcPromise(_0x8299da,_0x31e1be,_0x185214,_0x1ac655){return new BPromise(function(_0x92383f,_0x551602){var _0x2e80a9=_0x1ac655||client;return _0x2e80a9[_0x9af2('0x1d')](_0x8299da,_0x185214)['then'](function(_0x16542e){logger[_0x9af2('0x1e')](_0x9af2('0x1f'),_0x31e1be,_0x9af2('0x20'));logger['debug'](_0x9af2('0x21'),_0x31e1be,'request\x20sent',JSON[_0x9af2('0x22')](_0x16542e));if(_0x16542e[_0x9af2('0x23')]){if(_0x16542e[_0x9af2('0x23')][_0x9af2('0x24')]===0x1f4){logger['error'](_0x9af2('0x1f'),_0x31e1be,_0x16542e[_0x9af2('0x23')]['message']);return _0x551602(_0x16542e[_0x9af2('0x23')][_0x9af2('0x25')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x31e1be,_0x16542e[_0x9af2('0x23')]['message']);return _0x92383f(_0x16542e['error'][_0x9af2('0x25')]);}else{logger[_0x9af2('0x1e')](_0x9af2('0x1f'),_0x31e1be,_0x9af2('0x20'));_0x92383f(_0x16542e[_0x9af2('0x26')][_0x9af2('0x25')]);}})[_0x9af2('0x27')](function(_0x459b6f){logger[_0x9af2('0x23')](_0x9af2('0x1f'),_0x31e1be,_0x459b6f);_0x551602(_0x459b6f);});});}function respondWithStatusCode(_0x508809,_0x3fa4ce){_0x3fa4ce=_0x3fa4ce||0xcc;return function(_0x35f4bc){if(_0x35f4bc){return _0x508809[_0x9af2('0x28')](_0x3fa4ce);}return _0x508809[_0x9af2('0x29')](_0x3fa4ce)[_0x9af2('0x2a')]();};}function respondWithResult(_0x1116e0,_0x3ce4b0){_0x3ce4b0=_0x3ce4b0||0xc8;return function(_0x14963f){if(_0x14963f){return _0x1116e0[_0x9af2('0x29')](_0x3ce4b0)[_0x9af2('0x2b')](_0x14963f);}};}function respondWithFilteredResult(_0x3675d7,_0x13013e){return function(_0x15616e){if(_0x15616e){var _0x1921aa=_0x15616e[_0x9af2('0x2c')],_0x58a198=_0x13013e[_0x9af2('0x2d')],_0x1b965f=_0x13013e[_0x9af2('0x2d')]+_0x13013e[_0x9af2('0x2e')],_0x3ca691;if(_0x1b965f>=_0x1921aa){_0x1b965f=_0x1921aa;_0x3ca691=0xc8;}else{_0x3ca691=0xce;}_0x3675d7[_0x9af2('0x29')](_0x3ca691);return _0x3675d7['set'](_0x9af2('0x2f'),_0x58a198+'-'+_0x1b965f+'/'+_0x1921aa)[_0x9af2('0x2b')](_0x15616e);}return null;};}function patchUpdates(_0x15163f){return function(_0x1c12cf){try{jsonpatch[_0x9af2('0x30')](_0x1c12cf,_0x15163f,!![]);}catch(_0x116136){return BPromise[_0x9af2('0x31')](_0x116136);}return _0x1c12cf[_0x9af2('0x32')]();};}function saveUpdates(_0x4a9825,_0x2a1722){return function(_0x84f3a7){if(_0x84f3a7){return _0x84f3a7['update'](_0x4a9825)[_0x9af2('0x33')](function(_0xb5b596){return _0xb5b596;});}return null;};}function removeEntity(_0xb6b089,_0x47e6b7){return function(_0x4de213){if(_0x4de213){return _0x4de213[_0x9af2('0x34')]()['then'](function(){var _0x193cd9=_0x4de213['get']({'plain':!![]});var _0x228230=_0x9af2('0x35');return db[_0x9af2('0x36')][_0x9af2('0x34')]({'where':{'type':_0x228230,'resourceId':_0x193cd9['id']}})[_0x9af2('0x33')](function(){return _0x4de213;});})[_0x9af2('0x33')](function(){_0xb6b089[_0x9af2('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e6945,_0xff02ca){return function(_0x170ed8){if(!_0x170ed8){_0x5e6945[_0x9af2('0x28')](0x194);}return _0x170ed8;};}function handleError(_0x382a9e,_0x307854){_0x307854=_0x307854||0x1f4;return function(_0x26314b){logger['error'](_0x26314b[_0x9af2('0x37')]);if(_0x26314b[_0x9af2('0x38')]){delete _0x26314b[_0x9af2('0x38')];}_0x382a9e[_0x9af2('0x29')](_0x307854)['send'](_0x26314b);};}exports[_0x9af2('0x39')]=function(_0x59313b,_0x43d7d4){var _0xf974f2={'include':[{'model':db[_0x9af2('0x3a')],'as':'mandatoryDispositionPause'}]},_0x2a7ad={},_0xf72817={'count':0x0,'rows':[]};var _0x311740=_[_0x9af2('0x3b')](db[_0x9af2('0x3c')][_0x9af2('0x3d')],function(_0x4064a7){return{'name':_0x4064a7[_0x9af2('0x3e')],'type':_0x4064a7[_0x9af2('0x3f')]['key']};});_0x2a7ad['model']=_['map'](_0x311740,_0x9af2('0x38'));_0x2a7ad['query']=_[_0x9af2('0x40')](_0x59313b['query']);_0x2a7ad[_0x9af2('0x41')]=_['intersection'](_0x2a7ad[_0x9af2('0x42')],_0x2a7ad[_0x9af2('0x43')]);_0xf974f2['attributes']=_['intersection'](_0x2a7ad[_0x9af2('0x42')],qs[_0x9af2('0x44')](_0x59313b[_0x9af2('0x43')][_0x9af2('0x44')]));_0xf974f2['attributes']=_0xf974f2[_0x9af2('0x45')]['length']?_0xf974f2[_0x9af2('0x45')]:_0x2a7ad[_0x9af2('0x42')];if(!_0x59313b[_0x9af2('0x43')]['hasOwnProperty'](_0x9af2('0x46'))){_0xf974f2[_0x9af2('0x2e')]=qs[_0x9af2('0x2e')](_0x59313b[_0x9af2('0x43')][_0x9af2('0x2e')]);_0xf974f2[_0x9af2('0x2d')]=qs[_0x9af2('0x2d')](_0x59313b[_0x9af2('0x43')][_0x9af2('0x2d')]);}_0xf974f2[_0x9af2('0x47')]=qs[_0x9af2('0x48')](_0x59313b[_0x9af2('0x43')]['sort']);_0xf974f2[_0x9af2('0x49')]=qs[_0x9af2('0x41')](_[_0x9af2('0x4a')](_0x59313b[_0x9af2('0x43')],_0x2a7ad[_0x9af2('0x41')]),_0x311740);if(_0x59313b[_0x9af2('0x43')][_0x9af2('0x4b')]){_0xf974f2[_0x9af2('0x49')]=_[_0x9af2('0x4c')](_0xf974f2[_0x9af2('0x49')],{'$or':_[_0x9af2('0x3b')](_0x311740,function(_0x53dd51){if(_0x53dd51['type']!==_0x9af2('0x4d')){var _0x3501b4={};_0x3501b4[_0x53dd51['name']]={'$like':'%'+_0x59313b[_0x9af2('0x43')][_0x9af2('0x4b')]+'%'};return _0x3501b4;}})});}_0xf974f2=_[_0x9af2('0x4c')]({},_0xf974f2,_0x59313b[_0x9af2('0x4e')]);var _0x1d5683={'where':_0xf974f2['where']};return db['SmsAccount'][_0x9af2('0x2c')](_0x1d5683)[_0x9af2('0x33')](function(_0x2479f9){_0xf72817['count']=_0x2479f9;if(_0x59313b['query'][_0x9af2('0x4f')]){_0xf974f2[_0x9af2('0x50')]=[{'all':!![]}];}return db['SmsAccount'][_0x9af2('0x51')](_0xf974f2);})[_0x9af2('0x33')](function(_0x4db4e7){_0xf72817[_0x9af2('0x52')]=_0x4db4e7;return _0xf72817;})[_0x9af2('0x33')](respondWithFilteredResult(_0x43d7d4,_0xf974f2))[_0x9af2('0x27')](handleError(_0x43d7d4,null));};exports[_0x9af2('0x53')]=function(_0x50e081,_0x4c02fb){var _0x57f817={'raw':![],'where':{'id':_0x50e081[_0x9af2('0x54')]['id']},'include':[{'model':db[_0x9af2('0x3a')],'as':'mandatoryDispositionPause'}]},_0x4bd7e5={};_0x4bd7e5[_0x9af2('0x42')]=_['keys'](db['SmsAccount']['rawAttributes']);_0x4bd7e5[_0x9af2('0x43')]=_['keys'](_0x50e081['query']);_0x4bd7e5[_0x9af2('0x41')]=_[_0x9af2('0x55')](_0x4bd7e5[_0x9af2('0x42')],_0x4bd7e5[_0x9af2('0x43')]);_0x57f817[_0x9af2('0x45')]=_[_0x9af2('0x55')](_0x4bd7e5[_0x9af2('0x42')],qs[_0x9af2('0x44')](_0x50e081['query'][_0x9af2('0x44')]));_0x57f817[_0x9af2('0x45')]=_0x57f817[_0x9af2('0x45')][_0x9af2('0x56')]?_0x57f817['attributes']:_0x4bd7e5[_0x9af2('0x42')];if(_0x50e081[_0x9af2('0x43')]['includeAll']){_0x57f817[_0x9af2('0x50')]=[{'all':!![]}];}_0x57f817=_['merge']({},_0x57f817,_0x50e081[_0x9af2('0x4e')]);return db[_0x9af2('0x3c')][_0x9af2('0x57')](_0x57f817)[_0x9af2('0x33')](handleEntityNotFound(_0x4c02fb,null))[_0x9af2('0x33')](respondWithResult(_0x4c02fb,null))[_0x9af2('0x27')](handleError(_0x4c02fb,null));};exports['create']=function(_0x391431,_0x53fc6f){return db[_0x9af2('0x3c')][_0x9af2('0x58')](_0x391431['body'],{})['then'](function(_0x4b85aa){var _0x159126=_0x391431['user']['get']({'plain':!![]});if(!_0x159126)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x159126['role']==='user'){var _0x27d6a4=_0x4b85aa[_0x9af2('0x59')]({'plain':!![]});var _0x41dbd9=_0x9af2('0x35');return db[_0x9af2('0x5a')]['find']({'where':{'name':_0x41dbd9,'userProfileId':_0x159126[_0x9af2('0x5b')]},'raw':!![]})[_0x9af2('0x33')](function(_0x4d96eb){if(_0x4d96eb&&_0x4d96eb[_0x9af2('0x5c')]===0x0){return db[_0x9af2('0x36')]['create']({'name':_0x27d6a4[_0x9af2('0x38')],'resourceId':_0x27d6a4['id'],'type':_0x4d96eb[_0x9af2('0x38')],'sectionId':_0x4d96eb['id']},{})['then'](function(){return _0x4b85aa;});}else{return _0x4b85aa;}})['catch'](function(_0xfb637e){logger[_0x9af2('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfb637e);throw _0xfb637e;});}return _0x4b85aa;})['then'](respondWithResult(_0x53fc6f,0xc9))['catch'](handleError(_0x53fc6f,null));};exports['update']=function(_0x441d63,_0x38aee3){if(_0x441d63['body']['id']){delete _0x441d63[_0x9af2('0x5d')]['id'];}return db[_0x9af2('0x3c')][_0x9af2('0x57')]({'where':{'id':_0x441d63[_0x9af2('0x54')]['id']},'include':[{'model':db[_0x9af2('0x3a')],'as':_0x9af2('0x5e')}]})[_0x9af2('0x33')](handleEntityNotFound(_0x38aee3,null))['then'](saveUpdates(_0x441d63['body'],null))[_0x9af2('0x33')](respondWithResult(_0x38aee3,null))[_0x9af2('0x27')](handleError(_0x38aee3,null));};exports[_0x9af2('0x34')]=function(_0x459160,_0x36c187){return db['SmsAccount'][_0x9af2('0x57')]({'where':{'id':_0x459160['params']['id']}})[_0x9af2('0x33')](handleEntityNotFound(_0x36c187,null))['then'](removeEntity(_0x36c187,null))['catch'](handleError(_0x36c187,null));};exports[_0x9af2('0x5f')]=function(_0x58e1bc,_0x3bbf00){return db['SmsAccount']['describe']()[_0x9af2('0x33')](respondWithResult(_0x3bbf00,null))[_0x9af2('0x27')](handleError(_0x3bbf00,null));};exports[_0x9af2('0x60')]=function(_0x5a3d1c,_0x4afb43,_0x371b67){if(_0x5a3d1c[_0x9af2('0x5d')]['id']){delete _0x5a3d1c[_0x9af2('0x5d')]['id'];}return db[_0x9af2('0x3c')][_0x9af2('0x57')]({'where':{'id':_0x5a3d1c['params']['id']}})['then'](handleEntityNotFound(_0x4afb43,null))['then'](function(_0x165976){if(_0x165976){_0x5a3d1c['body'][_0x9af2('0x61')]=_0x165976['id'];return db[_0x9af2('0x62')][_0x9af2('0x58')](_0x5a3d1c[_0x9af2('0x5d')]);}})['then'](respondWithResult(_0x4afb43,null))[_0x9af2('0x27')](handleError(_0x4afb43,null));};exports['getDispositions']=function(_0x57b30f,_0x1a9af3,_0x5d5d81){var _0x3c2f2e={'raw':![],'where':{}};var _0x411cc0={};var _0x536570={'count':0x0,'rows':[]};return db[_0x9af2('0x3c')]['findOne']({'where':{'id':_0x57b30f[_0x9af2('0x54')]['id']}})[_0x9af2('0x33')](handleEntityNotFound(_0x1a9af3,null))['then'](function(_0x44efb2){if(_0x44efb2){_0x411cc0[_0x9af2('0x42')]=_[_0x9af2('0x40')](db['Disposition'][_0x9af2('0x3d')]);_0x411cc0[_0x9af2('0x43')]=_[_0x9af2('0x40')](_0x57b30f[_0x9af2('0x43')]);_0x411cc0[_0x9af2('0x41')]=_[_0x9af2('0x55')](_0x411cc0[_0x9af2('0x42')],_0x411cc0['query']);_0x3c2f2e[_0x9af2('0x45')]=_['intersection'](_0x411cc0[_0x9af2('0x42')],qs[_0x9af2('0x44')](_0x57b30f[_0x9af2('0x43')][_0x9af2('0x44')]));_0x3c2f2e[_0x9af2('0x45')]=_0x3c2f2e['attributes'][_0x9af2('0x56')]?_0x3c2f2e[_0x9af2('0x45')]:_0x411cc0[_0x9af2('0x42')];if(!_0x57b30f[_0x9af2('0x43')]['hasOwnProperty']('nolimit')){_0x3c2f2e[_0x9af2('0x2e')]=qs[_0x9af2('0x2e')](_0x57b30f['query'][_0x9af2('0x2e')]);_0x3c2f2e[_0x9af2('0x2d')]=qs[_0x9af2('0x2d')](_0x57b30f[_0x9af2('0x43')][_0x9af2('0x2d')]);}_0x3c2f2e[_0x9af2('0x47')]=qs[_0x9af2('0x48')](_0x57b30f[_0x9af2('0x43')][_0x9af2('0x48')]);_0x3c2f2e['where']=qs[_0x9af2('0x41')](_[_0x9af2('0x4a')](_0x57b30f[_0x9af2('0x43')],_0x411cc0[_0x9af2('0x41')]));_0x3c2f2e[_0x9af2('0x49')][_0x9af2('0x61')]=_0x44efb2['id'];if(_0x57b30f[_0x9af2('0x43')][_0x9af2('0x4b')]){_0x3c2f2e[_0x9af2('0x49')]=_['merge'](_0x3c2f2e[_0x9af2('0x49')],{'$or':_[_0x9af2('0x3b')](_0x3c2f2e[_0x9af2('0x45')],function(_0x7fee9a){var _0x10edea={};_0x10edea[_0x7fee9a]={'$like':'%'+_0x57b30f[_0x9af2('0x43')]['filter']+'%'};return _0x10edea;})});}_0x3c2f2e=_[_0x9af2('0x4c')]({},_0x3c2f2e,_0x57b30f['options']);return db[_0x9af2('0x62')]['count']({'where':_0x3c2f2e[_0x9af2('0x49')]})[_0x9af2('0x33')](function(_0x4c7033){_0x536570[_0x9af2('0x2c')]=_0x4c7033;if(_0x57b30f[_0x9af2('0x43')][_0x9af2('0x4f')]){_0x3c2f2e[_0x9af2('0x50')]=[{'all':!![]}];}return db[_0x9af2('0x62')][_0x9af2('0x51')](_0x3c2f2e);})[_0x9af2('0x33')](function(_0x5aa5a1){_0x536570[_0x9af2('0x52')]=_0x5aa5a1;return _0x536570;});}})[_0x9af2('0x33')](respondWithFilteredResult(_0x1a9af3,_0x3c2f2e))[_0x9af2('0x27')](handleError(_0x1a9af3,null));};exports[_0x9af2('0x63')]=function(_0x26fe08,_0x523b1a,_0x2b6548){return db[_0x9af2('0x3c')][_0x9af2('0x57')]({'where':{'id':_0x26fe08['params']['id']}})[_0x9af2('0x33')](handleEntityNotFound(_0x523b1a,null))['then'](function(_0x40d102){if(_0x40d102){return _0x40d102['removeDispositions'](_0x26fe08['query']['ids']);}})[_0x9af2('0x33')](respondWithStatusCode(_0x523b1a,null))[_0x9af2('0x27')](handleError(_0x523b1a,null));};exports[_0x9af2('0x64')]=function(_0x37df84,_0x1862ee,_0x7de004){if(_0x37df84[_0x9af2('0x5d')]['id']){delete _0x37df84[_0x9af2('0x5d')]['id'];}return db['SmsAccount'][_0x9af2('0x57')]({'where':{'id':_0x37df84[_0x9af2('0x54')]['id']}})[_0x9af2('0x33')](handleEntityNotFound(_0x1862ee,null))['then'](function(_0x19f784){if(_0x19f784){_0x37df84[_0x9af2('0x5d')][_0x9af2('0x61')]=_0x19f784['id'];return db[_0x9af2('0x65')]['create'](_0x37df84[_0x9af2('0x5d')]);}})['then'](respondWithResult(_0x1862ee,null))[_0x9af2('0x27')](handleError(_0x1862ee,null));};exports[_0x9af2('0x66')]=function(_0x17da73,_0x19b793,_0x43bdf9){var _0x576e99={'raw':![],'where':{}};var _0x1f1aaf={};var _0x5d1ff4={'count':0x0,'rows':[]};return db[_0x9af2('0x3c')][_0x9af2('0x67')]({'where':{'id':_0x17da73[_0x9af2('0x54')]['id']}})[_0x9af2('0x33')](handleEntityNotFound(_0x19b793,null))[_0x9af2('0x33')](function(_0x33dcdd){if(_0x33dcdd){_0x1f1aaf['model']=_[_0x9af2('0x40')](db[_0x9af2('0x65')]['rawAttributes']);_0x1f1aaf[_0x9af2('0x43')]=_[_0x9af2('0x40')](_0x17da73[_0x9af2('0x43')]);_0x1f1aaf[_0x9af2('0x41')]=_['intersection'](_0x1f1aaf[_0x9af2('0x42')],_0x1f1aaf[_0x9af2('0x43')]);_0x576e99['attributes']=_[_0x9af2('0x55')](_0x1f1aaf[_0x9af2('0x42')],qs['fields'](_0x17da73[_0x9af2('0x43')][_0x9af2('0x44')]));_0x576e99['attributes']=_0x576e99['attributes']['length']?_0x576e99[_0x9af2('0x45')]:_0x1f1aaf[_0x9af2('0x42')];if(!_0x17da73[_0x9af2('0x43')]['hasOwnProperty'](_0x9af2('0x46'))){_0x576e99['limit']=qs[_0x9af2('0x2e')](_0x17da73['query'][_0x9af2('0x2e')]);_0x576e99[_0x9af2('0x2d')]=qs[_0x9af2('0x2d')](_0x17da73[_0x9af2('0x43')][_0x9af2('0x2d')]);}_0x576e99['order']=qs[_0x9af2('0x48')](_0x17da73[_0x9af2('0x43')]['sort']);_0x576e99['where']=qs[_0x9af2('0x41')](_[_0x9af2('0x4a')](_0x17da73[_0x9af2('0x43')],_0x1f1aaf[_0x9af2('0x41')]));_0x576e99[_0x9af2('0x49')][_0x9af2('0x61')]=_0x33dcdd['id'];if(_0x17da73[_0x9af2('0x43')][_0x9af2('0x4b')]){_0x576e99[_0x9af2('0x49')]=_[_0x9af2('0x4c')](_0x576e99[_0x9af2('0x49')],{'$or':_[_0x9af2('0x3b')](_0x576e99[_0x9af2('0x45')],function(_0x17b78e){var _0x114183={};_0x114183[_0x17b78e]={'$like':'%'+_0x17da73[_0x9af2('0x43')]['filter']+'%'};return _0x114183;})});}_0x576e99=_[_0x9af2('0x4c')]({},_0x576e99,_0x17da73['options']);return db['CannedAnswer']['count']({'where':_0x576e99[_0x9af2('0x49')]})['then'](function(_0x5aa472){_0x5d1ff4[_0x9af2('0x2c')]=_0x5aa472;if(_0x17da73['query']['includeAll']){_0x576e99[_0x9af2('0x50')]=[{'all':!![]}];}return db[_0x9af2('0x65')]['findAll'](_0x576e99);})[_0x9af2('0x33')](function(_0x5f31d6){_0x5d1ff4[_0x9af2('0x52')]=_0x5f31d6;return _0x5d1ff4;});}})['then'](respondWithFilteredResult(_0x19b793,_0x576e99))[_0x9af2('0x27')](handleError(_0x19b793,null));};exports['removeAnswers']=function(_0x29da87,_0x4aabef,_0x5943b2){return db[_0x9af2('0x3c')][_0x9af2('0x57')]({'where':{'id':_0x29da87[_0x9af2('0x54')]['id']}})['then'](handleEntityNotFound(_0x4aabef,null))[_0x9af2('0x33')](function(_0x566910){if(_0x566910){return _0x566910[_0x9af2('0x68')](_0x29da87[_0x9af2('0x43')]['ids']);}})[_0x9af2('0x33')](respondWithStatusCode(_0x4aabef,null))['catch'](handleError(_0x4aabef,null));};exports['notify']=function(_0x2d03ef,_0x1fd7cb,_0x12f80e){var _0x4fdff5={'channel':_0x9af2('0x69')};var _0x94ff00=[];var _0x1ad027=[];var _0x5310e1={};return db[_0x9af2('0x3c')][_0x9af2('0x57')]({'where':{'id':_0x2d03ef['params']['id']},'include':[{'model':db[_0x9af2('0x6a')],'as':'Applications'}]})[_0x9af2('0x33')](handleEntityNotFound(_0x1fd7cb,null))[_0x9af2('0x33')](function(_0x332d20){_0x4fdff5[_0x9af2('0x6b')]=_0x332d20;_0x4fdff5[_0x9af2('0x6c')]=_['orderBy'](_0x332d20[_0x9af2('0x6d')],['priority'],[_0x9af2('0x6e')]);if(_0x4fdff5[_0x9af2('0x6b')][_0x9af2('0x6d')]){delete _0x4fdff5[_0x9af2('0x6b')][_0x9af2('0x6d')];}return db[_0x9af2('0x6f')][_0x9af2('0x5f')]();})[_0x9af2('0x33')](function(_0x3df8be){if(!_0x3df8be){throw new db['Sequelize'][(_0x9af2('0x70'))](_0x9af2('0x71'));}_0x94ff00=_[_0x9af2('0x72')](_[_0x9af2('0x40')](_0x3df8be),[_0x9af2('0x73'),'updatedAt']);_0x1ad027=_['difference'](_[_0x9af2('0x40')](_0x3df8be),[_0x9af2('0x73'),_0x9af2('0x74'),'CompanyId','ListId']);_0x4fdff5[_0x9af2('0x5d')]={'mapKey':_0x9af2('0x75')};if(_0x4fdff5[_0x9af2('0x6b')][_0x9af2('0x3f')]){switch(_0x4fdff5[_0x9af2('0x6b')][_0x9af2('0x3f')]){case _0x9af2('0x76'):_0x4fdff5[_0x9af2('0x5d')][_0x9af2('0x77')]=_0x2d03ef[_0x9af2('0x5d')]['From'];_0x4fdff5[_0x9af2('0x5d')][_0x9af2('0x5d')]=_0x2d03ef[_0x9af2('0x5d')][_0x9af2('0x78')];_0x4fdff5[_0x9af2('0x5d')][_0x9af2('0x79')]=_0x2d03ef[_0x9af2('0x5d')]['MessageSid'];break;case _0x9af2('0x7a'):_0x4fdff5[_0x9af2('0x5d')]['from']='+'+_0x2d03ef[_0x9af2('0x5d')][_0x9af2('0x7b')];_0x4fdff5[_0x9af2('0x5d')][_0x9af2('0x5d')]=_0x2d03ef[_0x9af2('0x5d')][_0x9af2('0x7c')];break;case'connectel':_0x4fdff5['body'][_0x9af2('0x77')]=_0x2d03ef[_0x9af2('0x5d')]['from'];_0x4fdff5['body']['body']=_0x2d03ef[_0x9af2('0x5d')][_0x9af2('0x25')];break;case _0x9af2('0x7d'):_0x4fdff5['body'][_0x9af2('0x77')]=_0x2d03ef['body'][_0x9af2('0x77')];_0x4fdff5[_0x9af2('0x5d')]['body']=_0x2d03ef[_0x9af2('0x5d')][_0x9af2('0x5d')];_0x4fdff5[_0x9af2('0x5d')][_0x9af2('0x79')]=_0x2d03ef['body'][_0x9af2('0x7e')];break;case _0x9af2('0x7f'):_0x4fdff5[_0x9af2('0x5d')]['from']=_0x2d03ef[_0x9af2('0x5d')][_0x9af2('0x80')];_0x4fdff5[_0x9af2('0x5d')][_0x9af2('0x5d')]=_0x2d03ef[_0x9af2('0x5d')][_0x9af2('0x81')];_0x4fdff5['body']['messageId']=_0x2d03ef[_0x9af2('0x5d')][_0x9af2('0x82')];break;case _0x9af2('0x83'):_0x4fdff5[_0x9af2('0x5d')]['from']='+'+_0x2d03ef[_0x9af2('0x5d')]['results'][0x0][_0x9af2('0x77')];_0x4fdff5[_0x9af2('0x5d')]['body']=_0x2d03ef[_0x9af2('0x5d')]['results'][0x0][_0x9af2('0x7c')];_0x4fdff5[_0x9af2('0x5d')][_0x9af2('0x79')]=_0x2d03ef[_0x9af2('0x5d')][_0x9af2('0x84')][0x0][_0x9af2('0x79')];break;case _0x9af2('0x85'):_0x4fdff5[_0x9af2('0x5d')][_0x9af2('0x77')]=_0x2d03ef['body'][_0x9af2('0x86')];_0x4fdff5['body'][_0x9af2('0x5d')]=_0x2d03ef[_0x9af2('0x5d')][_0x9af2('0x87')][_0x9af2('0x25')];break;case'clickatell':_0x4fdff5['body'][_0x9af2('0x77')]=_0x2d03ef['body'][_0x9af2('0x88')];_0x4fdff5[_0x9af2('0x5d')]['body']=_0x2d03ef[_0x9af2('0x5d')][_0x9af2('0x7c')];_0x4fdff5[_0x9af2('0x5d')][_0x9af2('0x79')]=_0x2d03ef[_0x9af2('0x5d')][_0x9af2('0x89')];break;case _0x9af2('0x8a'):_0x4fdff5[_0x9af2('0x5d')][_0x9af2('0x79')]=_0x2d03ef[_0x9af2('0x5d')][0x0][_0x9af2('0x25')]['id'];_0x4fdff5[_0x9af2('0x5d')][_0x9af2('0x77')]=_0x2d03ef[_0x9af2('0x5d')][0x0][_0x9af2('0x25')]['from'];_0x4fdff5[_0x9af2('0x5d')][_0x9af2('0x5d')]=_0x2d03ef['body'][0x0][_0x9af2('0x25')][_0x9af2('0x7c')];break;case _0x9af2('0x8b'):_0x4fdff5[_0x9af2('0x5d')][_0x9af2('0x77')]=_0x2d03ef[_0x9af2('0x5d')][_0x9af2('0x77')];_0x4fdff5['body'][_0x9af2('0x5d')]=_0x2d03ef[_0x9af2('0x5d')][_0x9af2('0x25')];_0x4fdff5[_0x9af2('0x5d')]['messageId']=_0x2d03ef['body']['refid'];break;}}if(_0x4fdff5[_0x9af2('0x5d')]['id']){delete _0x4fdff5[_0x9af2('0x5d')]['id'];}if(_[_0x9af2('0x8c')](_0x4fdff5['body'][_0x9af2('0x77')])){throw new db[(_0x9af2('0x8d'))][(_0x9af2('0x70'))](_0x9af2('0x8e'));}if(_[_0x9af2('0x8c')](_0x4fdff5[_0x9af2('0x5d')][_0x9af2('0x5d')])||_0x4fdff5['body'][_0x9af2('0x5d')]===''){throw new db[(_0x9af2('0x8d'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4fdff5[_0x9af2('0x5d')][_0x9af2('0x8f')])){throw new db[(_0x9af2('0x8d'))]['ValidationError'](_0x9af2('0x90')+_0x1ad027);}if(!_[_0x9af2('0x91')](_0x1ad027,_0x4fdff5['body']['mapKey'])){throw new db[(_0x9af2('0x8d'))][(_0x9af2('0x70'))](_0x9af2('0x92')+_0x1ad027);}_0x5310e1[_0x4fdff5[_0x9af2('0x5d')][_0x9af2('0x8f')]]=_0x4fdff5['body'][_0x9af2('0x77')];return db[_0x9af2('0x93')][_0x9af2('0x57')]({'where':{'id':_0x4fdff5[_0x9af2('0x6b')][_0x9af2('0x94')]},'include':[{'model':db[_0x9af2('0x6f')],'as':'Contacts','where':_0x5310e1,'limit':0x1,'order':[[_0x9af2('0x74'),'DESC']]}]});})['then'](handleEntityNotFound(_0x1fd7cb,null))[_0x9af2('0x33')](function(_0x174323){if(_0x174323){_0x4fdff5['list']=_[_0x9af2('0x95')](_0x174323,['Contacts']);if(_0x174323['Contacts']['length']){return _0x174323[_0x9af2('0x96')][0x0];}var _0x53bc72=_[_0x9af2('0x17')](_0x4fdff5[_0x9af2('0x5d')],{'firstName':_0x4fdff5[_0x9af2('0x5d')][_0x9af2('0x77')],'ListId':_0x174323['id']});_0x53bc72[_0x4fdff5[_0x9af2('0x5d')][_0x9af2('0x8f')]]=_0x4fdff5[_0x9af2('0x5d')]['from'];return db[_0x9af2('0x6f')][_0x9af2('0x58')](_0x53bc72,{'fields':_0x94ff00,'raw':!![]});}})['then'](handleEntityNotFound(_0x1fd7cb,null))[_0x9af2('0x33')](function(_0x25e837){if(_0x25e837){_0x4fdff5[_0x9af2('0x97')]=_0x25e837;var _0x2d716f={'ContactId':_0x25e837['id'],'phone':_0x4fdff5['body'][_0x9af2('0x77')],'SmsAccountId':_0x2d03ef['params']['id']};var _0x6275={'ContactId':_0x25e837['id'],'SmsAccountId':_0x2d03ef[_0x9af2('0x54')]['id'],'closed':![]};return db[_0x9af2('0x98')][_0x9af2('0x57')]({'where':_0x6275})['then'](function(_0x579a51){if(_0x579a51){return[_0x579a51,![]];}return db[_0x9af2('0x98')]['create'](_0x2d716f)[_0x9af2('0x33')](function(_0x57478b){return[_0x57478b,!![]];});});}})[_0x9af2('0x99')](function(_0x6e7eb5,_0x48f53d){_0x4fdff5['interaction']=_0x6e7eb5[_0x9af2('0x59')]({'plain':!![]});_0x4fdff5['interaction'][_0x9af2('0x9a')]=![];if(_0x48f53d){if(_0x4fdff5[_0x9af2('0x6b')]['autoclose']){_0x4fdff5[_0x9af2('0x6c')][_0x9af2('0x9b')]({'id':0x0,'priority':_0x4fdff5['applications'][_0x9af2('0x56')]+0x1,'app':_0x9af2('0x9c'),'appdata':_0x9af2('0x9d'),'interval':'*,*,*,*'});}_0x4fdff5[_0x9af2('0x9e')][_0x9af2('0x9a')]=!![];}return db[_0x9af2('0x9f')]['create']({'phone':_0x4fdff5['body'][_0x9af2('0x77')],'messageId':_0x4fdff5['body'][_0x9af2('0x79')],'body':_0x4fdff5[_0x9af2('0x5d')]['body'],'SmsAccountId':_0x2d03ef[_0x9af2('0x54')]['id'],'SmsInteractionId':_0x6e7eb5['id'],'direction':'in','ContactId':_0x6e7eb5['ContactId'],'AttachmentId':_0x4fdff5['body']['AttachmentId']});})[_0x9af2('0x33')](function(_0x18b388){_0x4fdff5['message']=_0x18b388;if(_0x4fdff5['interaction']['UserId']){return db[_0x9af2('0xa0')][_0x9af2('0x57')]({'attributes':['id',_0x9af2('0x38')],'where':{'id':_0x4fdff5[_0x9af2('0x9e')][_0x9af2('0xa1')]}})[_0x9af2('0x33')](function(_0x2b34f9){if(_0x2b34f9){_0x4fdff5[_0x9af2('0x6c')][_0x9af2('0xa2')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2b34f9[_0x9af2('0x38')]+','+(_0x4fdff5[_0x9af2('0x6b')][_0x9af2('0xa3')]||0xa),'interval':_0x9af2('0xa4')});}return respondWithRpcPromise(_0x9af2('0xa5'),'startRouting',_0x4fdff5);});}return respondWithRpcPromise('Start',_0x9af2('0xa6'),_0x4fdff5);})[_0x9af2('0x33')](function(_0xe74316){if(_0xe74316){var _0x33a2e7=0xc8;var _0x14a20b=_0x9af2('0xa7');logger[_0x9af2('0x1e')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x14a20b,_0x33a2e7,'entity\x20found');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x14a20b,_0x33a2e7,_0x9af2('0xa8'),JSON['stringify'](_0xe74316));if(_0x4fdff5[_0x9af2('0x6b')][_0x9af2('0x3f')]===_0x9af2('0x76')){return _0x1fd7cb[_0x9af2('0x29')](_0x33a2e7)['set'](_0x9af2('0xa9'),_0x9af2('0xaa'))[_0x9af2('0xab')](_0x9af2('0xac'));}else{return _0x1fd7cb['status'](_0x33a2e7)[_0x9af2('0x2b')](_0xe74316);}}})[_0x9af2('0x27')](handleError(_0x1fd7cb,null));};exports[_0x9af2('0xad')]=function(_0x51f0aa,_0x582057,_0x3c6d4c){return db[_0x9af2('0x3c')]['findOne']({'where':{'id':_0x51f0aa['params']['id']}})['then'](handleEntityNotFound(_0x582057,null))[_0x9af2('0x33')](function(_0xf30c32){if(_0xf30c32){return db[_0x9af2('0xae')][_0x9af2('0xaf')](function(_0x10740a){return db[_0x9af2('0x6a')][_0x9af2('0x34')]({'where':{'SmsAccountId':_0x51f0aa['params']['id']},'transaction':_0x10740a})[_0x9af2('0x33')](function(_0x3bfd01){var _0x384839=_[_0x9af2('0x3b')](_0x51f0aa[_0x9af2('0x5d')],function(_0x426493){_0x426493[_0x9af2('0x61')]=_0x51f0aa[_0x9af2('0x54')]['id'];return _0x426493;});return db['SmsApplication'][_0x9af2('0xb0')](_0x384839,{'transaction':_0x10740a});});})[_0x9af2('0x33')](function(){return db['SmsApplication'][_0x9af2('0xb1')]({'where':{'SmsAccountId':_0x51f0aa[_0x9af2('0x54')]['id']},'order':_0x9af2('0xb2')});});}})[_0x9af2('0x33')](respondWithResult(_0x582057,null))[_0x9af2('0x27')](handleError(_0x582057,null));};exports['getApplications']=function(_0x19dee6,_0x22e849,_0xda0270){var _0x4a3e65={};var _0x363578={};var _0x2b4a03;var _0x371a6b;return db[_0x9af2('0x3c')][_0x9af2('0x67')]({'where':{'id':_0x19dee6['params']['id']}})[_0x9af2('0x33')](handleEntityNotFound(_0x22e849,null))['then'](function(_0x2719ed){if(_0x2719ed){_0x2b4a03=_0x2719ed;_0x363578['model']=_['keys'](db['SmsApplication'][_0x9af2('0x3d')]);_0x363578[_0x9af2('0x43')]=_['keys'](_0x19dee6[_0x9af2('0x43')]);_0x363578[_0x9af2('0x41')]=_[_0x9af2('0x55')](_0x363578[_0x9af2('0x42')],_0x363578[_0x9af2('0x43')]);_0x4a3e65[_0x9af2('0x45')]=_[_0x9af2('0x55')](_0x363578[_0x9af2('0x42')],qs[_0x9af2('0x44')](_0x19dee6[_0x9af2('0x43')][_0x9af2('0x44')]));_0x4a3e65[_0x9af2('0x45')]=_0x4a3e65[_0x9af2('0x45')][_0x9af2('0x56')]?_0x4a3e65[_0x9af2('0x45')]:_0x363578['model'];_0x4a3e65[_0x9af2('0x47')]=qs[_0x9af2('0x48')](_0x19dee6['query'][_0x9af2('0x48')]);_0x4a3e65[_0x9af2('0x49')]=qs[_0x9af2('0x41')](_[_0x9af2('0x4a')](_0x19dee6[_0x9af2('0x43')],_0x363578[_0x9af2('0x41')]));if(_0x19dee6['query']['filter']){_0x4a3e65[_0x9af2('0x49')]=_[_0x9af2('0x4c')](_0x4a3e65[_0x9af2('0x49')],{'$or':_[_0x9af2('0x3b')](_0x4a3e65['attributes'],function(_0x3baef4){var _0x4b67a7={};_0x4b67a7[_0x3baef4]={'$like':'%'+_0x19dee6[_0x9af2('0x43')][_0x9af2('0x4b')]+'%'};return _0x4b67a7;})});}_0x4a3e65=_['merge']({},_0x4a3e65,_0x19dee6[_0x9af2('0x4e')]);return _0x2b4a03[_0x9af2('0xb3')](_0x4a3e65);}})[_0x9af2('0x33')](function(_0x5718d4){if(_0x5718d4){_0x371a6b=_0x5718d4[_0x9af2('0x56')];if(!_0x19dee6[_0x9af2('0x43')][_0x9af2('0xb4')]('nolimit')){_0x4a3e65[_0x9af2('0x2e')]=qs[_0x9af2('0x2e')](_0x19dee6[_0x9af2('0x43')][_0x9af2('0x2e')]);_0x4a3e65[_0x9af2('0x2d')]=qs[_0x9af2('0x2d')](_0x19dee6[_0x9af2('0x43')]['offset']);}return _0x2b4a03[_0x9af2('0xb3')](_0x4a3e65);}})[_0x9af2('0x33')](function(_0x28b2d8){if(_0x28b2d8){return _0x28b2d8?{'count':_0x371a6b,'rows':_0x28b2d8}:null;}})[_0x9af2('0x33')](respondWithResult(_0x22e849,null))['catch'](handleError(_0x22e849,null));};exports[_0x9af2('0xb5')]=function(_0x30ba19,_0xcbd5e3,_0x33775f){var _0xdcc199={'raw':![],'where':{}};var _0x4af78d={};var _0x4385f4={'count':0x0,'rows':[]};return db[_0x9af2('0x3c')][_0x9af2('0x67')]({'where':{'id':_0x30ba19[_0x9af2('0x54')]['id']}})[_0x9af2('0x33')](handleEntityNotFound(_0xcbd5e3,null))[_0x9af2('0x33')](function(_0x221a1e){if(_0x221a1e){_0x4af78d['model']=_[_0x9af2('0x40')](db[_0x9af2('0x98')][_0x9af2('0x3d')]);_0x4af78d[_0x9af2('0x43')]=_[_0x9af2('0x40')](_0x30ba19[_0x9af2('0x43')]);_0x4af78d['filters']=_[_0x9af2('0x55')](_0x4af78d['model'],_0x4af78d[_0x9af2('0x43')]);_0xdcc199[_0x9af2('0x45')]=_[_0x9af2('0x55')](_0x4af78d['model'],qs['fields'](_0x30ba19[_0x9af2('0x43')][_0x9af2('0x44')]));_0xdcc199[_0x9af2('0x45')]=_0xdcc199[_0x9af2('0x45')][_0x9af2('0x56')]?_0xdcc199[_0x9af2('0x45')]:_0x4af78d[_0x9af2('0x42')];if(!_0x30ba19['query'][_0x9af2('0xb4')](_0x9af2('0x46'))){_0xdcc199['limit']=qs[_0x9af2('0x2e')](_0x30ba19['query']['limit']);_0xdcc199[_0x9af2('0x2d')]=qs['offset'](_0x30ba19[_0x9af2('0x43')][_0x9af2('0x2d')]);}_0xdcc199[_0x9af2('0x47')]=qs[_0x9af2('0x48')](_0x30ba19[_0x9af2('0x43')][_0x9af2('0x48')]);_0xdcc199[_0x9af2('0x49')]=qs['filters'](_['pick'](_0x30ba19[_0x9af2('0x43')],_0x4af78d[_0x9af2('0x41')]));_0xdcc199[_0x9af2('0x49')][_0x9af2('0x61')]=_0x221a1e['id'];if(_0x30ba19['query']['filter']){_0xdcc199[_0x9af2('0x49')]=_[_0x9af2('0x4c')](_0xdcc199['where'],{'$or':_[_0x9af2('0x3b')](_0xdcc199['attributes'],function(_0x488755){var _0x42a06e={};_0x42a06e[_0x488755]={'$like':'%'+_0x30ba19[_0x9af2('0x43')][_0x9af2('0x4b')]+'%'};return _0x42a06e;})});}_0xdcc199=_['merge']({},_0xdcc199,_0x30ba19[_0x9af2('0x4e')]);return db[_0x9af2('0x98')][_0x9af2('0x2c')]({'where':_0xdcc199[_0x9af2('0x49')]})[_0x9af2('0x33')](function(_0x29de94){_0x4385f4[_0x9af2('0x2c')]=_0x29de94;if(_0x30ba19['query'][_0x9af2('0x4f')]){_0xdcc199[_0x9af2('0x50')]=[{'model':db[_0x9af2('0x6f')],'as':'Contact','required':![]},{'model':db[_0x9af2('0xa0')],'as':_0x9af2('0xb6'),'attributes':['name',_0x9af2('0xb7'),_0x9af2('0xb8')],'required':![]},{'model':db[_0x9af2('0xb9')],'as':_0x9af2('0xba'),'attributes':['id',_0x9af2('0x38'),_0x9af2('0xbb')],'where':_0x30ba19[_0x9af2('0x43')][_0x9af2('0xbc')]?{'id':_0x30ba19['query']['tag']}:undefined,'required':_0x30ba19[_0x9af2('0x43')][_0x9af2('0xbc')]?!![]:![]}];}return db[_0x9af2('0x98')][_0x9af2('0x51')](_0xdcc199);})[_0x9af2('0x33')](function(_0x1ef207){_0x4385f4[_0x9af2('0x52')]=_0x1ef207;return _0x4385f4;});}})[_0x9af2('0x33')](respondWithFilteredResult(_0xcbd5e3,_0xdcc199))[_0x9af2('0x27')](handleError(_0xcbd5e3,null));};exports[_0x9af2('0xab')]=function(_0x15e6b0,_0x2c19d1,_0x4e44ba){var _0xc6898,_0x2d6a87,_0x1a4855;if(_['isNil'](_0x15e6b0['body']['body'])||_0x15e6b0[_0x9af2('0x5d')][_0x9af2('0x5d')]===''){throw new db[(_0x9af2('0x8d'))][(_0x9af2('0x70'))](_0x9af2('0xbd'));}if(_[_0x9af2('0x8c')](_0x15e6b0[_0x9af2('0x5d')]['to'])){throw new db[(_0x9af2('0x8d'))][(_0x9af2('0x70'))](_0x9af2('0xbe'));}_0xc6898=_0x15e6b0[_0x9af2('0x5d')]['to'];return db[_0x9af2('0x3c')][_0x9af2('0x57')]({'where':{'id':_0x15e6b0[_0x9af2('0x54')]['id']},'include':[{'model':db[_0x9af2('0x93')],'as':'List','include':[{'model':db['CmContact'],'as':_0x9af2('0x96'),'where':{'mobile':_0xc6898},'limit':0x1,'order':[[_0x9af2('0x74'),_0x9af2('0xbf')]]}]}]})[_0x9af2('0x33')](handleEntityNotFound(_0x2c19d1,null))['then'](function(_0x1fcf99){if(_0x1fcf99&&_0x1fcf99[_0x9af2('0xc0')]){_0x2d6a87=_0x1fcf99[_0x9af2('0x59')]({'plain':!![]});if(_0x2d6a87[_0x9af2('0xc0')]&&_0x2d6a87[_0x9af2('0xc0')]['Contacts'][_0x9af2('0x56')]){return _0x2d6a87[_0x9af2('0xc0')]['Contacts'][0x0];}return db['CmContact'][_0x9af2('0x58')](_[_0x9af2('0x17')](_0x15e6b0['body'],{'firstName':_0xc6898,'mobile':_0xc6898,'phone':_0xc6898,'ListId':_0x2d6a87[_0x9af2('0x94')]}));}})[_0x9af2('0x33')](handleEntityNotFound(_0x2c19d1,null))['then'](function(_0x2a53cc){if(_0x2a53cc){_0x1a4855=_0x2a53cc;return db['SmsInteraction']['find']({'where':{'ContactId':_0x1a4855['id'],'closed':![],'SmsAccountId':_0x2d6a87['id']}})[_0x9af2('0x33')](function(_0x15398c){if(_0x15398c){return[_0x15398c,![]];}return db[_0x9af2('0x98')][_0x9af2('0x58')]({'UserId':_0x15e6b0[_0x9af2('0xc1')]['id'],'ContactId':_0x1a4855['id'],'SmsAccountId':_0x2d6a87['id'],'phone':_0xc6898,'firstMsgDirection':_0x9af2('0xc2'),'Messages':[_['merge'](_0x15e6b0[_0x9af2('0x5d')],{'read':![],'body':_0x15e6b0[_0x9af2('0x5d')][_0x9af2('0x5d')],'phone':_0xc6898,'SmsAccountId':_0x2d6a87['id'],'UserId':_0x15e6b0[_0x9af2('0xc1')]['id'],'ContactId':_0x1a4855['id']})]},{'include':[{'model':db[_0x9af2('0x9f')],'as':'Messages'}]})[_0x9af2('0x33')](function(_0x548a34){return[_0x548a34,!![]];});});}})['spread'](function(_0x5103f3,_0x5dd03c){if(_0x5dd03c){return _0x5103f3;}return db[_0x9af2('0x9f')]['create'](_[_0x9af2('0x4c')](_0x15e6b0['body'],{'read':![],'body':_0x15e6b0['body'][_0x9af2('0x5d')],'phone':_0xc6898,'SmsAccountId':_0x2d6a87['id'],'SmsInteractionId':_0x5103f3['id'],'UserId':_0x15e6b0['user']['id'],'ContactId':_0x1a4855['id']}))[_0x9af2('0x33')](function(_0x9d01e8){_0x5103f3[_0x9af2('0xc3')]['Messages']=[];_0x5103f3['dataValues']['Messages'][_0x9af2('0x9b')](_0x9d01e8[_0x9af2('0xc3')]);return _0x5103f3;});})[_0x9af2('0x33')](respondWithResult(_0x2c19d1,null))['catch'](handleError(_0x2c19d1,null));};exports[_0x9af2('0x29')]=function(_0x729b33,_0x1c070b,_0x1cb57c){if(_0x729b33['body']['id']){delete _0x729b33[_0x9af2('0x5d')]['id'];}var _0x50bdc0,_0xa445ae,_0x48fd6b;return db['SmsAccount'][_0x9af2('0x57')]({'where':{'id':_0x729b33[_0x9af2('0x54')]['id']}})[_0x9af2('0x33')](handleEntityNotFound(_0x1c070b,null))[_0x9af2('0x33')](function(_0x1b0446){if(_0x1b0446){_0x48fd6b=_0x1b0446;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x1b0446[_0x9af2('0x3f')],util[_0x9af2('0xc4')](_0x729b33[_0x9af2('0x5d')],{'showHidden':![],'depth':null}));switch(_0x1b0446[_0x9af2('0x3f')]){case'skebby':if(_0x729b33[_0x9af2('0x5d')][_0x9af2('0xc5')]&&_0x729b33[_0x9af2('0x5d')]['status']){_0xa445ae=_0x729b33[_0x9af2('0x5d')]['status'];return db[_0x9af2('0x9f')][_0x9af2('0x57')]({'where':{'messageId':_0x729b33['body'][_0x9af2('0xc5')]}});}break;case _0x9af2('0xc6'):if(_0x729b33[_0x9af2('0x5d')]['requestid']&&_0x729b33['body'][_0x9af2('0xc7')]){_0xa445ae=_0x729b33[_0x9af2('0x5d')]['statusInt'];return db[_0x9af2('0x9f')][_0x9af2('0x57')]({'where':{'messageId':_0x729b33[_0x9af2('0x5d')]['requestid']}});}break;case _0x9af2('0x7d'):if(_0x729b33['body'][_0x9af2('0x7e')]&&_0x729b33[_0x9af2('0x5d')][_0x9af2('0xc8')]){_0xa445ae=_0x729b33['body'][_0x9af2('0xc8')];return db[_0x9af2('0x9f')][_0x9af2('0x57')]({'where':{'messageId':_0x729b33[_0x9af2('0x5d')][_0x9af2('0x7e')]}});}break;case'infobip':var _0xb03f64=_0x729b33[_0x9af2('0x5d')]['results'][0x0];if(_0xb03f64[_0x9af2('0x79')]&&_0xb03f64['status'][_0x9af2('0xc9')]===_0x9af2('0xca')){_0xa445ae=_0xb03f64[_0x9af2('0x29')][_0x9af2('0xc9')];return db['SmsMessage'][_0x9af2('0x57')]({'where':{'messageId':_0xb03f64['messageId']}});}break;case'clickatell':if(_0x729b33[_0x9af2('0x5d')][_0x9af2('0x79')]&&_0x729b33[_0x9af2('0x5d')][_0x9af2('0x29')]){_0xa445ae=_0x729b33[_0x9af2('0x5d')]['status'];return db[_0x9af2('0x9f')][_0x9af2('0x57')]({'where':{'messageId':_0x729b33['body']['messageId']}});}break;case _0x9af2('0x8a'):if(_0x729b33[_0x9af2('0x5d')][0x0][_0x9af2('0x25')]['id']){_0xa445ae=_0x729b33['body'][0x0]['type'];return db[_0x9af2('0x9f')][_0x9af2('0x57')]({'where':{'messageId':_0x729b33['body'][0x0]['message']['id']}});}break;case _0x9af2('0x8b'):if(_0x729b33[_0x9af2('0x5d')][_0x9af2('0xcb')]&&_0x729b33[_0x9af2('0x5d')][_0x9af2('0x29')]){_0xa445ae=_0x729b33[_0x9af2('0x5d')][_0x9af2('0x29')];return db['SmsMessage'][_0x9af2('0x57')]({'where':{'messageId':_0x729b33[_0x9af2('0x5d')][_0x9af2('0xcb')]}});}break;}}})[_0x9af2('0x33')](handleEntityNotFound(_0x1c070b,null))[_0x9af2('0x33')](function(_0x59e5ca){if(_0x59e5ca){_0x50bdc0=_0x59e5ca;switch(_0x48fd6b['type']){case'skebby':if(_0xa445ae===_0x9af2('0xca')){return _0x50bdc0[_0x9af2('0xcc')]({'read':!![]});}else{logger[_0x9af2('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9af2('0x29'),_0x9af2('0x7a'),util[_0x9af2('0xc4')](_0x729b33[_0x9af2('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x9af2('0xc6'):if(_0xa445ae==='1'){return _0x50bdc0[_0x9af2('0xcc')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9af2('0x29'),_0x9af2('0x7a'),util[_0x9af2('0xc4')](_0x729b33[_0x9af2('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x9af2('0x7d'):if(!_0x729b33[_0x9af2('0x5d')]['error_code']&&_0xa445ae>=0xc8&&_0xa445ae<=0xce){return _0x50bdc0[_0x9af2('0xcc')]({'read':!![]});}else{logger[_0x9af2('0x23')](_0x9af2('0x21'),_0x9af2('0x29'),_0x9af2('0x7d'),util[_0x9af2('0xc4')](_0x729b33[_0x9af2('0x5d')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0xd3d562=_0x729b33[_0x9af2('0x5d')][_0x9af2('0x84')][0x0];if(_0xd3d562[_0x9af2('0x29')][_0x9af2('0xc9')]==='DELIVERED'){return _0x50bdc0[_0x9af2('0xcc')]({'read':!![]});}else{logger['error'](_0x9af2('0x21'),_0x9af2('0x29'),'infobip',util[_0x9af2('0xc4')](_0x729b33[_0x9af2('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x9af2('0xcd'):if(_0xa445ae==_0x9af2('0xce')||_0xa445ae==_0x9af2('0xcf')){return _0x50bdc0[_0x9af2('0xcc')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9af2('0x29'),_0x9af2('0xcd'),util[_0x9af2('0xc4')](_0x729b33[_0x9af2('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x9af2('0x8a'):if(_0xa445ae==_0x9af2('0xd0')){return _0x50bdc0[_0x9af2('0xcc')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9af2('0x29'),'bandwidth',util[_0x9af2('0xc4')](_0x729b33[_0x9af2('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x9af2('0x8b'):if(_0xa445ae===_0x9af2('0xd1')||_0xa445ae===_0x9af2('0xd2')){return _0x50bdc0['update']({'read':!![]});}else{logger[_0x9af2('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9af2('0x29'),'intelepeer',util[_0x9af2('0xc4')](_0x729b33[_0x9af2('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x50bdc0;}})[_0x9af2('0x33')](respondWithResult(_0x1c070b,null))['catch'](handleError(_0x1c070b,null));};exports[_0x9af2('0xd3')]=function(_0x24df09,_0x26e93a,_0x1c01a9){var _0x4dc805,_0x464e2d,_0x3883d0;return db[_0x9af2('0x3c')][_0x9af2('0x57')]({'where':{'id':_0x24df09[_0x9af2('0x54')]['id']}})['then'](handleEntityNotFound(_0x26e93a,null))[_0x9af2('0x33')](function(_0x4c2bcb){if(_0x4c2bcb){_0x3883d0=_0x4c2bcb;logger[_0x9af2('0xd4')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9af2('0x29'),_0x9af2('0xd5'),_0x4c2bcb[_0x9af2('0x3f')],util['inspect'](_0x24df09['query'],{'showHidden':![],'depth':null}));switch(_0x4c2bcb[_0x9af2('0x3f')]){case _0x9af2('0x85'):if(_0x24df09['query'][_0x9af2('0xd6')]&&_0x24df09['query'][_0x9af2('0xd7')]){_0x464e2d=_0x24df09['query'][_0x9af2('0xd7')];return db[_0x9af2('0x9f')][_0x9af2('0x57')]({'where':{'messageId':_0x24df09[_0x9af2('0x43')][_0x9af2('0xd6')]}});}break;}}})[_0x9af2('0x33')](handleEntityNotFound(_0x26e93a,null))['then'](function(_0x43ac2c){if(_0x43ac2c){_0x4dc805=_0x43ac2c;switch(_0x3883d0[_0x9af2('0x3f')]){case _0x9af2('0x85'):if(_0x464e2d==='2'||_0x464e2d==='6'){return _0x4dc805['update']({'read':!![]});}else{logger[_0x9af2('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9af2('0x29'),_0x9af2('0x85'),util[_0x9af2('0xc4')](_0x24df09[_0x9af2('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x4dc805;}})[_0x9af2('0x33')](respondWithResult(_0x26e93a,null))['catch'](handleError(_0x26e93a,null));};exports[_0x9af2('0xd8')]=function(_0xfc9b,_0xb180ec,_0x58cf20){return db[_0x9af2('0x3c')][_0x9af2('0x57')]({'where':{'id':_0xfc9b[_0x9af2('0x54')]['id']}})[_0x9af2('0x33')](handleEntityNotFound(_0xb180ec,null))[_0x9af2('0x33')](function(_0x470cdb){if(_0x470cdb){return _0x470cdb[_0x9af2('0xd8')](_0xfc9b[_0x9af2('0x5d')][_0x9af2('0xd9')],_['omit'](_0xfc9b[_0x9af2('0x5d')],[_0x9af2('0xd9'),'id'])||{})[_0x9af2('0x99')](function(_0x168896){for(var _0xac65ef=0x0;_0xac65ef<_0xfc9b[_0x9af2('0x5d')][_0x9af2('0xd9')][_0x9af2('0x56')];_0xac65ef+=0x1){socket[_0x9af2('0xda')](_0x9af2('0xdb'),{'UserId':_0xfc9b[_0x9af2('0x5d')][_0x9af2('0xd9')][_0xac65ef],'SmsAccountId':_0xfc9b[_0x9af2('0x54')]['id']});}return _0x168896;});}})[_0x9af2('0x33')](respondWithResult(_0xb180ec,null))['catch'](handleError(_0xb180ec,null));};exports['removeAgents']=function(_0x5c36ee,_0x49081e,_0x375a61){return db[_0x9af2('0x3c')][_0x9af2('0x57')]({'where':{'id':_0x5c36ee[_0x9af2('0x54')]['id']}})[_0x9af2('0x33')](handleEntityNotFound(_0x49081e,null))[_0x9af2('0x33')](function(_0x2bc48d){if(_0x2bc48d){return _0x2bc48d['removeAgents'](_0x5c36ee[_0x9af2('0x43')]['ids'])[_0x9af2('0x33')](function(){if(_['isArray'](_0x5c36ee['query']['ids'])){for(var _0x3cbb93=0x0;_0x3cbb93<_0x5c36ee['query'][_0x9af2('0xd9')][_0x9af2('0x56')];_0x3cbb93+=0x1){socket[_0x9af2('0xda')](_0x9af2('0xdc'),{'UserId':Number(_0x5c36ee[_0x9af2('0x43')][_0x9af2('0xd9')][_0x3cbb93]),'SmsAccountId':Number(_0x5c36ee[_0x9af2('0x54')]['id'])});}}else{socket[_0x9af2('0xda')](_0x9af2('0xdc'),{'UserId':Number(_0x5c36ee[_0x9af2('0x43')][_0x9af2('0xd9')]),'SmsAccountId':Number(_0x5c36ee[_0x9af2('0x54')]['id'])});}});}})[_0x9af2('0x33')](respondWithStatusCode(_0x49081e,null))[_0x9af2('0x27')](handleError(_0x49081e,null));};exports[_0x9af2('0xdd')]=function(_0x5d152e,_0xea56bb,_0x661e63){var _0x4fb5ef={};var _0x2e5d0f={};var _0x5cd1dc;var _0x1b81db;return db[_0x9af2('0x3c')][_0x9af2('0x67')]({'where':{'id':_0x5d152e[_0x9af2('0x54')]['id']}})[_0x9af2('0x33')](handleEntityNotFound(_0xea56bb,null))[_0x9af2('0x33')](function(_0x2cbe72){if(_0x2cbe72){_0x5cd1dc=_0x2cbe72;_0x2e5d0f[_0x9af2('0x42')]=_[_0x9af2('0x40')](db[_0x9af2('0xa0')][_0x9af2('0x3d')]);_0x2e5d0f[_0x9af2('0x43')]=_[_0x9af2('0x40')](_0x5d152e['query']);_0x2e5d0f[_0x9af2('0x41')]=_[_0x9af2('0x55')](_0x2e5d0f[_0x9af2('0x42')],_0x2e5d0f[_0x9af2('0x43')]);_0x4fb5ef[_0x9af2('0x45')]=_[_0x9af2('0x55')](_0x2e5d0f[_0x9af2('0x42')],qs[_0x9af2('0x44')](_0x5d152e['query'][_0x9af2('0x44')]));_0x4fb5ef[_0x9af2('0x45')]=_0x4fb5ef[_0x9af2('0x45')][_0x9af2('0x56')]?_0x4fb5ef[_0x9af2('0x45')]:_0x2e5d0f['model'];_0x4fb5ef[_0x9af2('0x47')]=qs[_0x9af2('0x48')](_0x5d152e[_0x9af2('0x43')][_0x9af2('0x48')]);_0x4fb5ef[_0x9af2('0x49')]=qs[_0x9af2('0x41')](_['pick'](_0x5d152e[_0x9af2('0x43')],_0x2e5d0f[_0x9af2('0x41')]));if(_0x5d152e[_0x9af2('0x43')][_0x9af2('0x4b')]){_0x4fb5ef[_0x9af2('0x49')]=_[_0x9af2('0x4c')](_0x4fb5ef['where'],{'$or':_[_0x9af2('0x3b')](_0x4fb5ef['attributes'],function(_0x5c17d7){var _0x51bf29={};_0x51bf29[_0x5c17d7]={'$like':'%'+_0x5d152e[_0x9af2('0x43')]['filter']+'%'};return _0x51bf29;})});}_0x4fb5ef=_[_0x9af2('0x4c')]({},_0x4fb5ef,_0x5d152e[_0x9af2('0x4e')]);return _0x5cd1dc[_0x9af2('0xdd')](_0x4fb5ef);}})[_0x9af2('0x33')](function(_0x434f12){if(_0x434f12){_0x1b81db=_0x434f12[_0x9af2('0x56')];if(!_0x5d152e['query'][_0x9af2('0xb4')](_0x9af2('0x46'))){_0x4fb5ef[_0x9af2('0x2e')]=qs[_0x9af2('0x2e')](_0x5d152e['query'][_0x9af2('0x2e')]);_0x4fb5ef[_0x9af2('0x2d')]=qs[_0x9af2('0x2d')](_0x5d152e[_0x9af2('0x43')]['offset']);}return _0x5cd1dc[_0x9af2('0xdd')](_0x4fb5ef);}})['then'](function(_0x1e039e){if(_0x1e039e){return _0x1e039e?{'count':_0x1b81db,'rows':_0x1e039e}:null;}})[_0x9af2('0x33')](respondWithResult(_0xea56bb,null))['catch'](handleError(_0xea56bb,null));}; \ No newline at end of file +var _0xb8b3=['register','client','http','then','info','request\x20sent','debug','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','update','destroy','get','SmsAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','SmsAccount','includeAll','include','findAll','rows','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','account','applications','orderBy','Applications','priority','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','omit','defaults','contact','SmsInteraction','interaction','push','close','*,*,*,*','created','SmsMessage','ContactId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','\x0a','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','fullname','Tags','color','tag','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','error_code','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','addAgents','spread','emit','userSmsAccount:save','userSmsAccount:remove','getAgents','eml-format','fast-json-patch','moment','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter'];(function(_0x4cf354,_0x11fe21){var _0x3930bd=function(_0x3835ca){while(--_0x3835ca){_0x4cf354['push'](_0x4cf354['shift']());}};_0x3930bd(++_0x11fe21);}(_0xb8b3,0x1ad));var _0x3b8b=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0xb8b3[_0x351509];return _0x4e9861;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3b8b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3b8b('0x1'));var rp=require('request-promise');var moment=require(_0x3b8b('0x2'));var BPromise=require(_0x3b8b('0x3'));var Mustache=require('mustache');var util=require(_0x3b8b('0x4'));var path=require(_0x3b8b('0x5'));var sox=require(_0x3b8b('0x6'));var csv=require(_0x3b8b('0x7'));var ejs=require(_0x3b8b('0x8'));var fs=require('fs');var _=require(_0x3b8b('0x9'));var squel=require(_0x3b8b('0xa'));var crypto=require('crypto');var jsforce=require(_0x3b8b('0xb'));var deskjs=require(_0x3b8b('0xc'));var toCsv=require(_0x3b8b('0x7'));var querystring=require(_0x3b8b('0xd'));var Papa=require(_0x3b8b('0xe'));var Redis=require(_0x3b8b('0xf'));var authService=require(_0x3b8b('0x10'));var qs=require(_0x3b8b('0x11'));var as=require(_0x3b8b('0x12'));var hardwareService=require(_0x3b8b('0x13'));var logger=require('../../config/logger')(_0x3b8b('0x14'));var utils=require(_0x3b8b('0x15'));var config=require(_0x3b8b('0x16'));var licenseUtil=require(_0x3b8b('0x17'));var db=require(_0x3b8b('0x18'))['db'];config[_0x3b8b('0x19')]=_['defaults'](config[_0x3b8b('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x3b8b('0x1a'))(new Redis(config[_0x3b8b('0x19')]));require('./smsAccount.socket')[_0x3b8b('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3b8b('0x1c')][_0x3b8b('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x511fc3,_0x404a28,_0x4f3752,_0x5c8404){return new BPromise(function(_0x47c4c6,_0x2b17f8){var _0x144eed=_0x5c8404||client;return _0x144eed['request'](_0x511fc3,_0x4f3752)[_0x3b8b('0x1e')](function(_0x507fcd){logger[_0x3b8b('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x404a28,_0x3b8b('0x20'));logger[_0x3b8b('0x21')](_0x3b8b('0x22'),_0x404a28,'request\x20sent',JSON['stringify'](_0x507fcd));if(_0x507fcd[_0x3b8b('0x23')]){if(_0x507fcd[_0x3b8b('0x23')][_0x3b8b('0x24')]===0x1f4){logger[_0x3b8b('0x23')](_0x3b8b('0x25'),_0x404a28,_0x507fcd['error']['message']);return _0x2b17f8(_0x507fcd[_0x3b8b('0x23')][_0x3b8b('0x26')]);}logger['error'](_0x3b8b('0x25'),_0x404a28,_0x507fcd[_0x3b8b('0x23')][_0x3b8b('0x26')]);return _0x47c4c6(_0x507fcd['error'][_0x3b8b('0x26')]);}else{logger[_0x3b8b('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x404a28,'request\x20sent');_0x47c4c6(_0x507fcd[_0x3b8b('0x27')][_0x3b8b('0x26')]);}})[_0x3b8b('0x28')](function(_0x1a0510){logger[_0x3b8b('0x23')](_0x3b8b('0x25'),_0x404a28,_0x1a0510);_0x2b17f8(_0x1a0510);});});}function respondWithStatusCode(_0x289bcb,_0x22c99f){_0x22c99f=_0x22c99f||0xcc;return function(_0x4fc6aa){if(_0x4fc6aa){return _0x289bcb[_0x3b8b('0x29')](_0x22c99f);}return _0x289bcb[_0x3b8b('0x2a')](_0x22c99f)[_0x3b8b('0x2b')]();};}function respondWithResult(_0x287429,_0xa69f0a){_0xa69f0a=_0xa69f0a||0xc8;return function(_0x640fc9){if(_0x640fc9){return _0x287429['status'](_0xa69f0a)[_0x3b8b('0x2c')](_0x640fc9);}};}function respondWithFilteredResult(_0x5f0cf3,_0x601604){return function(_0x21065d){if(_0x21065d){var _0x5da108=_0x21065d[_0x3b8b('0x2d')],_0x56d3b8=_0x601604[_0x3b8b('0x2e')],_0x31fe70=_0x601604['offset']+_0x601604[_0x3b8b('0x2f')],_0x236d98;if(_0x31fe70>=_0x5da108){_0x31fe70=_0x5da108;_0x236d98=0xc8;}else{_0x236d98=0xce;}_0x5f0cf3['status'](_0x236d98);return _0x5f0cf3[_0x3b8b('0x30')](_0x3b8b('0x31'),_0x56d3b8+'-'+_0x31fe70+'/'+_0x5da108)['json'](_0x21065d);}return null;};}function patchUpdates(_0x36daea){return function(_0x48cede){try{jsonpatch[_0x3b8b('0x32')](_0x48cede,_0x36daea,!![]);}catch(_0x3e72ff){return BPromise[_0x3b8b('0x33')](_0x3e72ff);}return _0x48cede[_0x3b8b('0x34')]();};}function saveUpdates(_0xe781a5,_0x4337f1){return function(_0x3ff155){if(_0x3ff155){return _0x3ff155[_0x3b8b('0x35')](_0xe781a5)[_0x3b8b('0x1e')](function(_0xbb7c6f){return _0xbb7c6f;});}return null;};}function removeEntity(_0x19a7e9,_0x5c5fc3){return function(_0x5dd32d){if(_0x5dd32d){return _0x5dd32d[_0x3b8b('0x36')]()[_0x3b8b('0x1e')](function(){var _0x3b2d89=_0x5dd32d[_0x3b8b('0x37')]({'plain':!![]});var _0x323745=_0x3b8b('0x38');return db[_0x3b8b('0x39')][_0x3b8b('0x36')]({'where':{'type':_0x323745,'resourceId':_0x3b2d89['id']}})[_0x3b8b('0x1e')](function(){return _0x5dd32d;});})['then'](function(){_0x19a7e9[_0x3b8b('0x2a')](0xcc)[_0x3b8b('0x2b')]();});}};}function handleEntityNotFound(_0x799831,_0x5cb4d7){return function(_0x1da5c8){if(!_0x1da5c8){_0x799831[_0x3b8b('0x29')](0x194);}return _0x1da5c8;};}function handleError(_0x196f30,_0x1a4f59){_0x1a4f59=_0x1a4f59||0x1f4;return function(_0x5c7078){logger[_0x3b8b('0x23')](_0x5c7078['stack']);if(_0x5c7078[_0x3b8b('0x3a')]){delete _0x5c7078[_0x3b8b('0x3a')];}_0x196f30['status'](_0x1a4f59)[_0x3b8b('0x3b')](_0x5c7078);};}exports[_0x3b8b('0x3c')]=function(_0x3850b6,_0x11667c){var _0x195086={'include':[{'model':db[_0x3b8b('0x3d')],'as':_0x3b8b('0x3e')}]},_0x175c00={},_0xf8bf3={'count':0x0,'rows':[]};var _0x33d307=_[_0x3b8b('0x3f')](db['SmsAccount'][_0x3b8b('0x40')],function(_0xc383f4){return{'name':_0xc383f4[_0x3b8b('0x41')],'type':_0xc383f4[_0x3b8b('0x42')]['key']};});_0x175c00[_0x3b8b('0x43')]=_[_0x3b8b('0x3f')](_0x33d307,_0x3b8b('0x3a'));_0x175c00[_0x3b8b('0x44')]=_[_0x3b8b('0x45')](_0x3850b6[_0x3b8b('0x44')]);_0x175c00[_0x3b8b('0x46')]=_[_0x3b8b('0x47')](_0x175c00[_0x3b8b('0x43')],_0x175c00[_0x3b8b('0x44')]);_0x195086[_0x3b8b('0x48')]=_[_0x3b8b('0x47')](_0x175c00['model'],qs[_0x3b8b('0x49')](_0x3850b6[_0x3b8b('0x44')][_0x3b8b('0x49')]));_0x195086[_0x3b8b('0x48')]=_0x195086[_0x3b8b('0x48')][_0x3b8b('0x4a')]?_0x195086[_0x3b8b('0x48')]:_0x175c00['model'];if(!_0x3850b6[_0x3b8b('0x44')][_0x3b8b('0x4b')](_0x3b8b('0x4c'))){_0x195086[_0x3b8b('0x2f')]=qs['limit'](_0x3850b6[_0x3b8b('0x44')][_0x3b8b('0x2f')]);_0x195086[_0x3b8b('0x2e')]=qs[_0x3b8b('0x2e')](_0x3850b6[_0x3b8b('0x44')][_0x3b8b('0x2e')]);}_0x195086[_0x3b8b('0x4d')]=qs[_0x3b8b('0x4e')](_0x3850b6[_0x3b8b('0x44')][_0x3b8b('0x4e')]);_0x195086[_0x3b8b('0x4f')]=qs['filters'](_[_0x3b8b('0x50')](_0x3850b6[_0x3b8b('0x44')],_0x175c00[_0x3b8b('0x46')]),_0x33d307);if(_0x3850b6[_0x3b8b('0x44')][_0x3b8b('0x51')]){_0x195086[_0x3b8b('0x4f')]=_['merge'](_0x195086[_0x3b8b('0x4f')],{'$or':_[_0x3b8b('0x3f')](_0x33d307,function(_0x20e220){if(_0x20e220[_0x3b8b('0x42')]!==_0x3b8b('0x52')){var _0xd649d5={};_0xd649d5[_0x20e220[_0x3b8b('0x3a')]]={'$like':'%'+_0x3850b6['query'][_0x3b8b('0x51')]+'%'};return _0xd649d5;}})});}_0x195086=_[_0x3b8b('0x53')]({},_0x195086,_0x3850b6[_0x3b8b('0x54')]);var _0x5ed681={'where':_0x195086[_0x3b8b('0x4f')]};return db[_0x3b8b('0x55')][_0x3b8b('0x2d')](_0x5ed681)[_0x3b8b('0x1e')](function(_0x3a6164){_0xf8bf3[_0x3b8b('0x2d')]=_0x3a6164;if(_0x3850b6[_0x3b8b('0x44')][_0x3b8b('0x56')]){_0x195086[_0x3b8b('0x57')]=[{'all':!![]}];}return db[_0x3b8b('0x55')][_0x3b8b('0x58')](_0x195086);})['then'](function(_0x18e9a1){_0xf8bf3[_0x3b8b('0x59')]=_0x18e9a1;return _0xf8bf3;})[_0x3b8b('0x1e')](respondWithFilteredResult(_0x11667c,_0x195086))['catch'](handleError(_0x11667c,null));};exports[_0x3b8b('0x5a')]=function(_0x4c8881,_0x4207f4){var _0x4b3198={'raw':![],'where':{'id':_0x4c8881[_0x3b8b('0x5b')]['id']},'include':[{'model':db[_0x3b8b('0x3d')],'as':_0x3b8b('0x3e')}]},_0xc989bd={};_0xc989bd['model']=_[_0x3b8b('0x45')](db[_0x3b8b('0x55')][_0x3b8b('0x40')]);_0xc989bd['query']=_['keys'](_0x4c8881['query']);_0xc989bd[_0x3b8b('0x46')]=_['intersection'](_0xc989bd[_0x3b8b('0x43')],_0xc989bd['query']);_0x4b3198['attributes']=_['intersection'](_0xc989bd[_0x3b8b('0x43')],qs[_0x3b8b('0x49')](_0x4c8881['query'][_0x3b8b('0x49')]));_0x4b3198['attributes']=_0x4b3198['attributes'][_0x3b8b('0x4a')]?_0x4b3198['attributes']:_0xc989bd[_0x3b8b('0x43')];if(_0x4c8881[_0x3b8b('0x44')]['includeAll']){_0x4b3198['include']=[{'all':!![]}];}_0x4b3198=_[_0x3b8b('0x53')]({},_0x4b3198,_0x4c8881['options']);return db['SmsAccount']['find'](_0x4b3198)[_0x3b8b('0x1e')](handleEntityNotFound(_0x4207f4,null))[_0x3b8b('0x1e')](respondWithResult(_0x4207f4,null))['catch'](handleError(_0x4207f4,null));};exports[_0x3b8b('0x5c')]=function(_0x9afca0,_0x41918a){return db[_0x3b8b('0x55')]['create'](_0x9afca0['body'],{})[_0x3b8b('0x1e')](function(_0x624330){var _0x376fd6=_0x9afca0[_0x3b8b('0x5d')][_0x3b8b('0x37')]({'plain':!![]});if(!_0x376fd6)throw new Error(_0x3b8b('0x5e'));if(_0x376fd6[_0x3b8b('0x5f')]===_0x3b8b('0x5d')){var _0x17166b=_0x624330[_0x3b8b('0x37')]({'plain':!![]});var _0x5c5647='SmsAccounts';return db[_0x3b8b('0x60')]['find']({'where':{'name':_0x5c5647,'userProfileId':_0x376fd6[_0x3b8b('0x61')]},'raw':!![]})[_0x3b8b('0x1e')](function(_0x612fa1){if(_0x612fa1&&_0x612fa1['autoAssociation']===0x0){return db[_0x3b8b('0x39')][_0x3b8b('0x5c')]({'name':_0x17166b[_0x3b8b('0x3a')],'resourceId':_0x17166b['id'],'type':_0x612fa1[_0x3b8b('0x3a')],'sectionId':_0x612fa1['id']},{})[_0x3b8b('0x1e')](function(){return _0x624330;});}else{return _0x624330;}})[_0x3b8b('0x28')](function(_0x1b316d){logger[_0x3b8b('0x23')](_0x3b8b('0x62'),_0x1b316d);throw _0x1b316d;});}return _0x624330;})[_0x3b8b('0x1e')](respondWithResult(_0x41918a,0xc9))[_0x3b8b('0x28')](handleError(_0x41918a,null));};exports['update']=function(_0x511817,_0x53c8c0){if(_0x511817['body']['id']){delete _0x511817[_0x3b8b('0x63')]['id'];}return db['SmsAccount'][_0x3b8b('0x64')]({'where':{'id':_0x511817[_0x3b8b('0x5b')]['id']},'include':[{'model':db[_0x3b8b('0x3d')],'as':_0x3b8b('0x3e')}]})[_0x3b8b('0x1e')](handleEntityNotFound(_0x53c8c0,null))[_0x3b8b('0x1e')](saveUpdates(_0x511817[_0x3b8b('0x63')],null))['then'](respondWithResult(_0x53c8c0,null))['catch'](handleError(_0x53c8c0,null));};exports[_0x3b8b('0x36')]=function(_0x9bfc45,_0x223cc0){return db[_0x3b8b('0x55')][_0x3b8b('0x64')]({'where':{'id':_0x9bfc45[_0x3b8b('0x5b')]['id']}})[_0x3b8b('0x1e')](handleEntityNotFound(_0x223cc0,null))[_0x3b8b('0x1e')](removeEntity(_0x223cc0,null))[_0x3b8b('0x28')](handleError(_0x223cc0,null));};exports[_0x3b8b('0x65')]=function(_0x208707,_0x19ce50){return db[_0x3b8b('0x55')][_0x3b8b('0x65')]()['then'](respondWithResult(_0x19ce50,null))['catch'](handleError(_0x19ce50,null));};exports[_0x3b8b('0x66')]=function(_0x5c1b82,_0x576e32,_0x256661){if(_0x5c1b82[_0x3b8b('0x63')]['id']){delete _0x5c1b82[_0x3b8b('0x63')]['id'];}return db[_0x3b8b('0x55')][_0x3b8b('0x64')]({'where':{'id':_0x5c1b82[_0x3b8b('0x5b')]['id']}})[_0x3b8b('0x1e')](handleEntityNotFound(_0x576e32,null))['then'](function(_0x540bdf){if(_0x540bdf){_0x5c1b82[_0x3b8b('0x63')][_0x3b8b('0x67')]=_0x540bdf['id'];return db[_0x3b8b('0x68')][_0x3b8b('0x5c')](_0x5c1b82[_0x3b8b('0x63')]);}})[_0x3b8b('0x1e')](respondWithResult(_0x576e32,null))[_0x3b8b('0x28')](handleError(_0x576e32,null));};exports[_0x3b8b('0x69')]=function(_0x39b390,_0x4b7c28,_0x518323){var _0x56d2b6={'raw':![],'where':{}};var _0x224f77={};var _0x5f48e2={'count':0x0,'rows':[]};return db[_0x3b8b('0x55')][_0x3b8b('0x6a')]({'where':{'id':_0x39b390[_0x3b8b('0x5b')]['id']}})[_0x3b8b('0x1e')](handleEntityNotFound(_0x4b7c28,null))['then'](function(_0x64d28e){if(_0x64d28e){_0x224f77['model']=_[_0x3b8b('0x45')](db['Disposition']['rawAttributes']);_0x224f77[_0x3b8b('0x44')]=_[_0x3b8b('0x45')](_0x39b390[_0x3b8b('0x44')]);_0x224f77[_0x3b8b('0x46')]=_[_0x3b8b('0x47')](_0x224f77[_0x3b8b('0x43')],_0x224f77['query']);_0x56d2b6[_0x3b8b('0x48')]=_['intersection'](_0x224f77[_0x3b8b('0x43')],qs[_0x3b8b('0x49')](_0x39b390['query'][_0x3b8b('0x49')]));_0x56d2b6[_0x3b8b('0x48')]=_0x56d2b6['attributes'][_0x3b8b('0x4a')]?_0x56d2b6[_0x3b8b('0x48')]:_0x224f77['model'];if(!_0x39b390[_0x3b8b('0x44')][_0x3b8b('0x4b')](_0x3b8b('0x4c'))){_0x56d2b6['limit']=qs['limit'](_0x39b390['query'][_0x3b8b('0x2f')]);_0x56d2b6[_0x3b8b('0x2e')]=qs['offset'](_0x39b390[_0x3b8b('0x44')][_0x3b8b('0x2e')]);}_0x56d2b6[_0x3b8b('0x4d')]=qs[_0x3b8b('0x4e')](_0x39b390['query'][_0x3b8b('0x4e')]);_0x56d2b6[_0x3b8b('0x4f')]=qs[_0x3b8b('0x46')](_['pick'](_0x39b390['query'],_0x224f77[_0x3b8b('0x46')]));_0x56d2b6[_0x3b8b('0x4f')][_0x3b8b('0x67')]=_0x64d28e['id'];if(_0x39b390[_0x3b8b('0x44')][_0x3b8b('0x51')]){_0x56d2b6[_0x3b8b('0x4f')]=_[_0x3b8b('0x53')](_0x56d2b6['where'],{'$or':_['map'](_0x56d2b6[_0x3b8b('0x48')],function(_0x1d613a){var _0xe8525a={};_0xe8525a[_0x1d613a]={'$like':'%'+_0x39b390[_0x3b8b('0x44')]['filter']+'%'};return _0xe8525a;})});}_0x56d2b6=_['merge']({},_0x56d2b6,_0x39b390[_0x3b8b('0x54')]);return db[_0x3b8b('0x68')][_0x3b8b('0x2d')]({'where':_0x56d2b6['where']})[_0x3b8b('0x1e')](function(_0x5c207e){_0x5f48e2['count']=_0x5c207e;if(_0x39b390['query'][_0x3b8b('0x56')]){_0x56d2b6[_0x3b8b('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x3b8b('0x58')](_0x56d2b6);})[_0x3b8b('0x1e')](function(_0x2aaedd){_0x5f48e2[_0x3b8b('0x59')]=_0x2aaedd;return _0x5f48e2;});}})[_0x3b8b('0x1e')](respondWithFilteredResult(_0x4b7c28,_0x56d2b6))[_0x3b8b('0x28')](handleError(_0x4b7c28,null));};exports['removeDispositions']=function(_0x52129f,_0x3ebea7,_0x5ae064){return db[_0x3b8b('0x55')][_0x3b8b('0x64')]({'where':{'id':_0x52129f[_0x3b8b('0x5b')]['id']}})[_0x3b8b('0x1e')](handleEntityNotFound(_0x3ebea7,null))[_0x3b8b('0x1e')](function(_0x7e7848){if(_0x7e7848){return _0x7e7848['removeDispositions'](_0x52129f[_0x3b8b('0x44')][_0x3b8b('0x6b')]);}})['then'](respondWithStatusCode(_0x3ebea7,null))[_0x3b8b('0x28')](handleError(_0x3ebea7,null));};exports[_0x3b8b('0x6c')]=function(_0x2f5a21,_0x2e6c77,_0x570305){if(_0x2f5a21[_0x3b8b('0x63')]['id']){delete _0x2f5a21['body']['id'];}return db[_0x3b8b('0x55')]['find']({'where':{'id':_0x2f5a21[_0x3b8b('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2e6c77,null))[_0x3b8b('0x1e')](function(_0x59098b){if(_0x59098b){_0x2f5a21[_0x3b8b('0x63')][_0x3b8b('0x67')]=_0x59098b['id'];return db['CannedAnswer'][_0x3b8b('0x5c')](_0x2f5a21[_0x3b8b('0x63')]);}})[_0x3b8b('0x1e')](respondWithResult(_0x2e6c77,null))['catch'](handleError(_0x2e6c77,null));};exports[_0x3b8b('0x6d')]=function(_0x48735e,_0x4fb413,_0x54fbab){var _0x18a3e7={'raw':![],'where':{}};var _0x107d5d={};var _0x293766={'count':0x0,'rows':[]};return db[_0x3b8b('0x55')][_0x3b8b('0x6a')]({'where':{'id':_0x48735e[_0x3b8b('0x5b')]['id']}})[_0x3b8b('0x1e')](handleEntityNotFound(_0x4fb413,null))['then'](function(_0x267da4){if(_0x267da4){_0x107d5d[_0x3b8b('0x43')]=_[_0x3b8b('0x45')](db['CannedAnswer'][_0x3b8b('0x40')]);_0x107d5d[_0x3b8b('0x44')]=_[_0x3b8b('0x45')](_0x48735e[_0x3b8b('0x44')]);_0x107d5d[_0x3b8b('0x46')]=_[_0x3b8b('0x47')](_0x107d5d[_0x3b8b('0x43')],_0x107d5d['query']);_0x18a3e7[_0x3b8b('0x48')]=_[_0x3b8b('0x47')](_0x107d5d[_0x3b8b('0x43')],qs[_0x3b8b('0x49')](_0x48735e[_0x3b8b('0x44')]['fields']));_0x18a3e7[_0x3b8b('0x48')]=_0x18a3e7[_0x3b8b('0x48')][_0x3b8b('0x4a')]?_0x18a3e7[_0x3b8b('0x48')]:_0x107d5d['model'];if(!_0x48735e[_0x3b8b('0x44')][_0x3b8b('0x4b')](_0x3b8b('0x4c'))){_0x18a3e7[_0x3b8b('0x2f')]=qs[_0x3b8b('0x2f')](_0x48735e[_0x3b8b('0x44')][_0x3b8b('0x2f')]);_0x18a3e7[_0x3b8b('0x2e')]=qs[_0x3b8b('0x2e')](_0x48735e[_0x3b8b('0x44')][_0x3b8b('0x2e')]);}_0x18a3e7[_0x3b8b('0x4d')]=qs[_0x3b8b('0x4e')](_0x48735e[_0x3b8b('0x44')][_0x3b8b('0x4e')]);_0x18a3e7[_0x3b8b('0x4f')]=qs[_0x3b8b('0x46')](_[_0x3b8b('0x50')](_0x48735e[_0x3b8b('0x44')],_0x107d5d[_0x3b8b('0x46')]));_0x18a3e7[_0x3b8b('0x4f')][_0x3b8b('0x67')]=_0x267da4['id'];if(_0x48735e[_0x3b8b('0x44')]['filter']){_0x18a3e7['where']=_['merge'](_0x18a3e7[_0x3b8b('0x4f')],{'$or':_[_0x3b8b('0x3f')](_0x18a3e7[_0x3b8b('0x48')],function(_0x4fe836){var _0x54eff2={};_0x54eff2[_0x4fe836]={'$like':'%'+_0x48735e['query']['filter']+'%'};return _0x54eff2;})});}_0x18a3e7=_[_0x3b8b('0x53')]({},_0x18a3e7,_0x48735e[_0x3b8b('0x54')]);return db['CannedAnswer'][_0x3b8b('0x2d')]({'where':_0x18a3e7[_0x3b8b('0x4f')]})['then'](function(_0x3badf2){_0x293766[_0x3b8b('0x2d')]=_0x3badf2;if(_0x48735e[_0x3b8b('0x44')]['includeAll']){_0x18a3e7[_0x3b8b('0x57')]=[{'all':!![]}];}return db[_0x3b8b('0x6e')][_0x3b8b('0x58')](_0x18a3e7);})[_0x3b8b('0x1e')](function(_0x577ead){_0x293766['rows']=_0x577ead;return _0x293766;});}})[_0x3b8b('0x1e')](respondWithFilteredResult(_0x4fb413,_0x18a3e7))[_0x3b8b('0x28')](handleError(_0x4fb413,null));};exports[_0x3b8b('0x6f')]=function(_0x50d3ea,_0x3ffaa4,_0x40817d){return db[_0x3b8b('0x55')][_0x3b8b('0x64')]({'where':{'id':_0x50d3ea['params']['id']}})['then'](handleEntityNotFound(_0x3ffaa4,null))[_0x3b8b('0x1e')](function(_0x3582d7){if(_0x3582d7){return _0x3582d7[_0x3b8b('0x6f')](_0x50d3ea['query'][_0x3b8b('0x6b')]);}})[_0x3b8b('0x1e')](respondWithStatusCode(_0x3ffaa4,null))['catch'](handleError(_0x3ffaa4,null));};exports[_0x3b8b('0x70')]=function(_0x4c7a31,_0x58927f,_0x59a472){var _0x444709={'channel':_0x3b8b('0x71')};var _0x3e961b=[];var _0x43690a=[];var _0x511655={};return db[_0x3b8b('0x55')][_0x3b8b('0x64')]({'where':{'id':_0x4c7a31[_0x3b8b('0x5b')]['id']},'include':[{'model':db[_0x3b8b('0x72')],'as':'Applications'}]})[_0x3b8b('0x1e')](handleEntityNotFound(_0x58927f,null))[_0x3b8b('0x1e')](function(_0xad778b){_0x444709[_0x3b8b('0x73')]=_0xad778b;_0x444709[_0x3b8b('0x74')]=_[_0x3b8b('0x75')](_0xad778b[_0x3b8b('0x76')],[_0x3b8b('0x77')],['asc']);if(_0x444709['account'][_0x3b8b('0x76')]){delete _0x444709[_0x3b8b('0x73')][_0x3b8b('0x76')];}return db[_0x3b8b('0x78')][_0x3b8b('0x65')]();})['then'](function(_0xb4c538){if(!_0xb4c538){throw new db['Sequelize'][(_0x3b8b('0x79'))](_0x3b8b('0x7a'));}_0x3e961b=_[_0x3b8b('0x7b')](_[_0x3b8b('0x45')](_0xb4c538),[_0x3b8b('0x7c'),_0x3b8b('0x7d')]);_0x43690a=_[_0x3b8b('0x7b')](_[_0x3b8b('0x45')](_0xb4c538),[_0x3b8b('0x7c'),'updatedAt',_0x3b8b('0x7e'),_0x3b8b('0x7f')]);_0x444709[_0x3b8b('0x63')]={'mapKey':_0x3b8b('0x80')};if(_0x444709['account']['type']){switch(_0x444709[_0x3b8b('0x73')][_0x3b8b('0x42')]){case _0x3b8b('0x81'):_0x444709[_0x3b8b('0x63')][_0x3b8b('0x82')]=_0x4c7a31['body'][_0x3b8b('0x83')];_0x444709[_0x3b8b('0x63')]['body']=_0x4c7a31['body'][_0x3b8b('0x84')];_0x444709[_0x3b8b('0x63')][_0x3b8b('0x85')]=_0x4c7a31[_0x3b8b('0x63')][_0x3b8b('0x86')];break;case _0x3b8b('0x87'):_0x444709[_0x3b8b('0x63')][_0x3b8b('0x82')]='+'+_0x4c7a31[_0x3b8b('0x63')][_0x3b8b('0x88')];_0x444709[_0x3b8b('0x63')][_0x3b8b('0x63')]=_0x4c7a31[_0x3b8b('0x63')][_0x3b8b('0x89')];break;case _0x3b8b('0x8a'):_0x444709[_0x3b8b('0x63')][_0x3b8b('0x82')]=_0x4c7a31['body'][_0x3b8b('0x82')];_0x444709[_0x3b8b('0x63')][_0x3b8b('0x63')]=_0x4c7a31[_0x3b8b('0x63')][_0x3b8b('0x26')];break;case _0x3b8b('0x8b'):_0x444709[_0x3b8b('0x63')][_0x3b8b('0x82')]=_0x4c7a31[_0x3b8b('0x63')][_0x3b8b('0x82')];_0x444709[_0x3b8b('0x63')]['body']=_0x4c7a31[_0x3b8b('0x63')]['body'];_0x444709['body'][_0x3b8b('0x85')]=_0x4c7a31['body'][_0x3b8b('0x8c')];break;case _0x3b8b('0x8d'):_0x444709[_0x3b8b('0x63')][_0x3b8b('0x82')]=_0x4c7a31[_0x3b8b('0x63')]['From'];_0x444709[_0x3b8b('0x63')][_0x3b8b('0x63')]=_0x4c7a31[_0x3b8b('0x63')][_0x3b8b('0x8e')];_0x444709[_0x3b8b('0x63')][_0x3b8b('0x85')]=_0x4c7a31[_0x3b8b('0x63')][_0x3b8b('0x8f')];break;case _0x3b8b('0x90'):_0x444709[_0x3b8b('0x63')][_0x3b8b('0x82')]='+'+_0x4c7a31[_0x3b8b('0x63')]['results'][0x0][_0x3b8b('0x82')];_0x444709[_0x3b8b('0x63')][_0x3b8b('0x63')]=_0x4c7a31['body'][_0x3b8b('0x91')][0x0][_0x3b8b('0x89')];_0x444709[_0x3b8b('0x63')]['messageId']=_0x4c7a31[_0x3b8b('0x63')][_0x3b8b('0x91')][0x0]['messageId'];break;case _0x3b8b('0x92'):_0x444709[_0x3b8b('0x63')][_0x3b8b('0x82')]=_0x4c7a31[_0x3b8b('0x63')][_0x3b8b('0x93')];_0x444709[_0x3b8b('0x63')][_0x3b8b('0x63')]=_0x4c7a31[_0x3b8b('0x63')][_0x3b8b('0x94')]['message'];break;case _0x3b8b('0x95'):_0x444709[_0x3b8b('0x63')][_0x3b8b('0x82')]=_0x4c7a31[_0x3b8b('0x63')][_0x3b8b('0x96')];_0x444709[_0x3b8b('0x63')][_0x3b8b('0x63')]=_0x4c7a31[_0x3b8b('0x63')][_0x3b8b('0x89')];_0x444709[_0x3b8b('0x63')][_0x3b8b('0x85')]=_0x4c7a31[_0x3b8b('0x63')][_0x3b8b('0x97')];break;case _0x3b8b('0x98'):_0x444709[_0x3b8b('0x63')][_0x3b8b('0x85')]=_0x4c7a31[_0x3b8b('0x63')][0x0][_0x3b8b('0x26')]['id'];_0x444709['body']['from']=_0x4c7a31['body'][0x0][_0x3b8b('0x26')]['from'];_0x444709[_0x3b8b('0x63')]['body']=_0x4c7a31[_0x3b8b('0x63')][0x0]['message'][_0x3b8b('0x89')];break;case _0x3b8b('0x99'):_0x444709[_0x3b8b('0x63')]['from']=_0x4c7a31[_0x3b8b('0x63')][_0x3b8b('0x82')];_0x444709['body'][_0x3b8b('0x63')]=_0x4c7a31[_0x3b8b('0x63')][_0x3b8b('0x26')];_0x444709[_0x3b8b('0x63')][_0x3b8b('0x85')]=_0x4c7a31[_0x3b8b('0x63')][_0x3b8b('0x9a')];break;}}if(_0x444709[_0x3b8b('0x63')]['id']){delete _0x444709[_0x3b8b('0x63')]['id'];}if(_[_0x3b8b('0x9b')](_0x444709[_0x3b8b('0x63')][_0x3b8b('0x82')])){throw new db['Sequelize'][(_0x3b8b('0x79'))](_0x3b8b('0x9c'));}if(_['isNil'](_0x444709[_0x3b8b('0x63')][_0x3b8b('0x63')])||_0x444709[_0x3b8b('0x63')][_0x3b8b('0x63')]===''){throw new db[(_0x3b8b('0x9d'))][(_0x3b8b('0x79'))](_0x3b8b('0x9e'));}if(_[_0x3b8b('0x9b')](_0x444709[_0x3b8b('0x63')][_0x3b8b('0x9f')])){throw new db[(_0x3b8b('0x9d'))][(_0x3b8b('0x79'))](_0x3b8b('0xa0')+_0x43690a);}if(!_['includes'](_0x43690a,_0x444709[_0x3b8b('0x63')][_0x3b8b('0x9f')])){throw new db[(_0x3b8b('0x9d'))][(_0x3b8b('0x79'))](_0x3b8b('0xa1')+_0x43690a);}_0x511655[_0x444709[_0x3b8b('0x63')][_0x3b8b('0x9f')]]=_0x444709[_0x3b8b('0x63')][_0x3b8b('0x82')];return db[_0x3b8b('0xa2')]['find']({'where':{'id':_0x444709['account']['ListId']},'include':[{'model':db[_0x3b8b('0x78')],'as':_0x3b8b('0xa3'),'where':_0x511655,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x3b8b('0x1e')](handleEntityNotFound(_0x58927f,null))['then'](function(_0x2903c7){if(_0x2903c7){_0x444709[_0x3b8b('0xa4')]=_[_0x3b8b('0xa5')](_0x2903c7,[_0x3b8b('0xa3')]);if(_0x2903c7[_0x3b8b('0xa3')][_0x3b8b('0x4a')]){return _0x2903c7[_0x3b8b('0xa3')][0x0];}var _0x4890ab=_[_0x3b8b('0xa6')](_0x444709[_0x3b8b('0x63')],{'firstName':_0x444709[_0x3b8b('0x63')]['from'],'ListId':_0x2903c7['id']});_0x4890ab[_0x444709[_0x3b8b('0x63')]['mapKey']]=_0x444709[_0x3b8b('0x63')]['from'];return db[_0x3b8b('0x78')][_0x3b8b('0x5c')](_0x4890ab,{'fields':_0x3e961b,'raw':!![]});}})[_0x3b8b('0x1e')](handleEntityNotFound(_0x58927f,null))['then'](function(_0x1f5d88){if(_0x1f5d88){_0x444709[_0x3b8b('0xa7')]=_0x1f5d88;var _0x1fd626={'ContactId':_0x1f5d88['id'],'phone':_0x444709[_0x3b8b('0x63')][_0x3b8b('0x82')],'SmsAccountId':_0x4c7a31[_0x3b8b('0x5b')]['id']};var _0x165ca2={'ContactId':_0x1f5d88['id'],'SmsAccountId':_0x4c7a31[_0x3b8b('0x5b')]['id'],'closed':![]};return db[_0x3b8b('0xa8')][_0x3b8b('0x64')]({'where':_0x165ca2})[_0x3b8b('0x1e')](function(_0x2f0e38){if(_0x2f0e38){return[_0x2f0e38,![]];}return db[_0x3b8b('0xa8')][_0x3b8b('0x5c')](_0x1fd626)[_0x3b8b('0x1e')](function(_0x563e69){return[_0x563e69,!![]];});});}})['spread'](function(_0x40df8b,_0xa86f26){_0x444709[_0x3b8b('0xa9')]=_0x40df8b['get']({'plain':!![]});_0x444709['interaction']['created']=![];if(_0xa86f26){if(_0x444709[_0x3b8b('0x73')]['autoclose']){_0x444709[_0x3b8b('0x74')][_0x3b8b('0xaa')]({'id':0x0,'priority':_0x444709[_0x3b8b('0x74')][_0x3b8b('0x4a')]+0x1,'app':_0x3b8b('0xab'),'appdata':'unmanaged','interval':_0x3b8b('0xac')});}_0x444709[_0x3b8b('0xa9')][_0x3b8b('0xad')]=!![];}return db[_0x3b8b('0xae')]['create']({'phone':_0x444709[_0x3b8b('0x63')]['from'],'messageId':_0x444709[_0x3b8b('0x63')][_0x3b8b('0x85')],'body':_0x444709[_0x3b8b('0x63')][_0x3b8b('0x63')],'SmsAccountId':_0x4c7a31['params']['id'],'SmsInteractionId':_0x40df8b['id'],'direction':'in','ContactId':_0x40df8b[_0x3b8b('0xaf')],'AttachmentId':_0x444709[_0x3b8b('0x63')]['AttachmentId']});})['then'](function(_0x119bda){_0x444709[_0x3b8b('0x26')]=_0x119bda;if(_0x444709['interaction'][_0x3b8b('0xb0')]){return db[_0x3b8b('0xb1')][_0x3b8b('0x64')]({'attributes':['id',_0x3b8b('0x3a')],'where':{'id':_0x444709[_0x3b8b('0xa9')][_0x3b8b('0xb0')]}})[_0x3b8b('0x1e')](function(_0x3ae3e9){if(_0x3ae3e9){_0x444709[_0x3b8b('0x74')][_0x3b8b('0xb2')]({'id':0x0,'priority':0x0,'app':_0x3b8b('0xb3'),'appdata':_0x3ae3e9[_0x3b8b('0x3a')]+','+(_0x444709[_0x3b8b('0x73')][_0x3b8b('0xb4')]||0xa),'interval':_0x3b8b('0xac')});}return respondWithRpcPromise(_0x3b8b('0xb5'),_0x3b8b('0xb6'),_0x444709);});}return respondWithRpcPromise(_0x3b8b('0xb5'),'startRouting',_0x444709);})[_0x3b8b('0x1e')](function(_0x27ed67){if(_0x27ed67){var _0x16a0e4=0xc8;var _0x4bd4ab=_0x3b8b('0xb7');logger['info'](_0x3b8b('0x22'),_0x4bd4ab,_0x16a0e4,_0x3b8b('0xb8'));logger[_0x3b8b('0x21')](_0x3b8b('0xb9'),_0x4bd4ab,_0x16a0e4,_0x3b8b('0xb8'),JSON[_0x3b8b('0xba')](_0x27ed67));if(_0x444709[_0x3b8b('0x73')][_0x3b8b('0x42')]===_0x3b8b('0x81')){return _0x58927f['status'](_0x16a0e4)['set'](_0x3b8b('0xbb'),'text/xml')[_0x3b8b('0x3b')](_0x3b8b('0xbc'));}else{return _0x58927f[_0x3b8b('0x2a')](_0x16a0e4)[_0x3b8b('0x2c')](_0x27ed67);}}})[_0x3b8b('0x28')](handleError(_0x58927f,null));};exports[_0x3b8b('0xbd')]=function(_0x240167,_0x66fa24,_0x4ce1a6){return db[_0x3b8b('0x55')][_0x3b8b('0x6a')]({'where':{'id':_0x240167[_0x3b8b('0x5b')]['id']}})[_0x3b8b('0x1e')](handleEntityNotFound(_0x66fa24,null))['then'](function(_0xddfcc1){if(_0xddfcc1){return db[_0x3b8b('0xbe')]['transaction'](function(_0x25b561){return db[_0x3b8b('0x72')][_0x3b8b('0x36')]({'where':{'SmsAccountId':_0x240167[_0x3b8b('0x5b')]['id']},'transaction':_0x25b561})['then'](function(_0x285664){var _0x256569=_[_0x3b8b('0x3f')](_0x240167[_0x3b8b('0x63')],function(_0x10bb9b){_0x10bb9b['SmsAccountId']=_0x240167[_0x3b8b('0x5b')]['id'];return _0x10bb9b;});return db[_0x3b8b('0x72')][_0x3b8b('0xbf')](_0x256569,{'transaction':_0x25b561});});})[_0x3b8b('0x1e')](function(){return db['SmsApplication'][_0x3b8b('0xc0')]({'where':{'SmsAccountId':_0x240167['params']['id']},'order':_0x3b8b('0x77')});});}})[_0x3b8b('0x1e')](respondWithResult(_0x66fa24,null))[_0x3b8b('0x28')](handleError(_0x66fa24,null));};exports[_0x3b8b('0xc1')]=function(_0x1fc8ec,_0x110f96,_0x229e6e){var _0x1c3bed={};var _0x4fe977={};var _0x3217f7;var _0x1d6271;return db[_0x3b8b('0x55')]['findOne']({'where':{'id':_0x1fc8ec[_0x3b8b('0x5b')]['id']}})[_0x3b8b('0x1e')](handleEntityNotFound(_0x110f96,null))[_0x3b8b('0x1e')](function(_0x325ae3){if(_0x325ae3){_0x3217f7=_0x325ae3;_0x4fe977[_0x3b8b('0x43')]=_['keys'](db['SmsApplication'][_0x3b8b('0x40')]);_0x4fe977['query']=_['keys'](_0x1fc8ec[_0x3b8b('0x44')]);_0x4fe977[_0x3b8b('0x46')]=_['intersection'](_0x4fe977[_0x3b8b('0x43')],_0x4fe977[_0x3b8b('0x44')]);_0x1c3bed[_0x3b8b('0x48')]=_[_0x3b8b('0x47')](_0x4fe977[_0x3b8b('0x43')],qs[_0x3b8b('0x49')](_0x1fc8ec[_0x3b8b('0x44')][_0x3b8b('0x49')]));_0x1c3bed['attributes']=_0x1c3bed[_0x3b8b('0x48')][_0x3b8b('0x4a')]?_0x1c3bed[_0x3b8b('0x48')]:_0x4fe977['model'];_0x1c3bed['order']=qs[_0x3b8b('0x4e')](_0x1fc8ec['query'][_0x3b8b('0x4e')]);_0x1c3bed[_0x3b8b('0x4f')]=qs[_0x3b8b('0x46')](_[_0x3b8b('0x50')](_0x1fc8ec[_0x3b8b('0x44')],_0x4fe977[_0x3b8b('0x46')]));if(_0x1fc8ec['query'][_0x3b8b('0x51')]){_0x1c3bed[_0x3b8b('0x4f')]=_[_0x3b8b('0x53')](_0x1c3bed[_0x3b8b('0x4f')],{'$or':_['map'](_0x1c3bed[_0x3b8b('0x48')],function(_0x3f93c0){var _0x43e308={};_0x43e308[_0x3f93c0]={'$like':'%'+_0x1fc8ec[_0x3b8b('0x44')][_0x3b8b('0x51')]+'%'};return _0x43e308;})});}_0x1c3bed=_['merge']({},_0x1c3bed,_0x1fc8ec['options']);return _0x3217f7[_0x3b8b('0xc1')](_0x1c3bed);}})[_0x3b8b('0x1e')](function(_0x3b7907){if(_0x3b7907){_0x1d6271=_0x3b7907['length'];if(!_0x1fc8ec[_0x3b8b('0x44')][_0x3b8b('0x4b')]('nolimit')){_0x1c3bed[_0x3b8b('0x2f')]=qs[_0x3b8b('0x2f')](_0x1fc8ec['query']['limit']);_0x1c3bed['offset']=qs[_0x3b8b('0x2e')](_0x1fc8ec[_0x3b8b('0x44')][_0x3b8b('0x2e')]);}return _0x3217f7[_0x3b8b('0xc1')](_0x1c3bed);}})[_0x3b8b('0x1e')](function(_0x362bd6){if(_0x362bd6){return _0x362bd6?{'count':_0x1d6271,'rows':_0x362bd6}:null;}})['then'](respondWithResult(_0x110f96,null))[_0x3b8b('0x28')](handleError(_0x110f96,null));};exports[_0x3b8b('0xc2')]=function(_0x8b85b8,_0x10d485,_0x38699d){var _0x1ae3b2={'raw':![],'where':{}};var _0x3bb3e6={};var _0x5ab16a={'count':0x0,'rows':[]};return db[_0x3b8b('0x55')][_0x3b8b('0x6a')]({'where':{'id':_0x8b85b8[_0x3b8b('0x5b')]['id']}})[_0x3b8b('0x1e')](handleEntityNotFound(_0x10d485,null))[_0x3b8b('0x1e')](function(_0x264801){if(_0x264801){_0x3bb3e6[_0x3b8b('0x43')]=_[_0x3b8b('0x45')](db[_0x3b8b('0xa8')]['rawAttributes']);_0x3bb3e6[_0x3b8b('0x44')]=_[_0x3b8b('0x45')](_0x8b85b8[_0x3b8b('0x44')]);_0x3bb3e6['filters']=_[_0x3b8b('0x47')](_0x3bb3e6[_0x3b8b('0x43')],_0x3bb3e6[_0x3b8b('0x44')]);_0x1ae3b2[_0x3b8b('0x48')]=_[_0x3b8b('0x47')](_0x3bb3e6[_0x3b8b('0x43')],qs[_0x3b8b('0x49')](_0x8b85b8[_0x3b8b('0x44')]['fields']));_0x1ae3b2['attributes']=_0x1ae3b2[_0x3b8b('0x48')][_0x3b8b('0x4a')]?_0x1ae3b2[_0x3b8b('0x48')]:_0x3bb3e6['model'];if(!_0x8b85b8['query'][_0x3b8b('0x4b')]('nolimit')){_0x1ae3b2[_0x3b8b('0x2f')]=qs[_0x3b8b('0x2f')](_0x8b85b8['query']['limit']);_0x1ae3b2[_0x3b8b('0x2e')]=qs[_0x3b8b('0x2e')](_0x8b85b8['query'][_0x3b8b('0x2e')]);}_0x1ae3b2[_0x3b8b('0x4d')]=qs[_0x3b8b('0x4e')](_0x8b85b8[_0x3b8b('0x44')][_0x3b8b('0x4e')]);_0x1ae3b2['where']=qs[_0x3b8b('0x46')](_[_0x3b8b('0x50')](_0x8b85b8[_0x3b8b('0x44')],_0x3bb3e6['filters']));_0x1ae3b2[_0x3b8b('0x4f')][_0x3b8b('0x67')]=_0x264801['id'];if(_0x8b85b8['query']['filter']){_0x1ae3b2['where']=_[_0x3b8b('0x53')](_0x1ae3b2[_0x3b8b('0x4f')],{'$or':_[_0x3b8b('0x3f')](_0x1ae3b2[_0x3b8b('0x48')],function(_0x5e4698){var _0x6cca83={};_0x6cca83[_0x5e4698]={'$like':'%'+_0x8b85b8[_0x3b8b('0x44')][_0x3b8b('0x51')]+'%'};return _0x6cca83;})});}_0x1ae3b2=_[_0x3b8b('0x53')]({},_0x1ae3b2,_0x8b85b8[_0x3b8b('0x54')]);return db[_0x3b8b('0xa8')][_0x3b8b('0x2d')]({'where':_0x1ae3b2[_0x3b8b('0x4f')]})[_0x3b8b('0x1e')](function(_0x2d54a0){_0x5ab16a[_0x3b8b('0x2d')]=_0x2d54a0;if(_0x8b85b8[_0x3b8b('0x44')][_0x3b8b('0x56')]){_0x1ae3b2[_0x3b8b('0x57')]=[{'model':db[_0x3b8b('0x78')],'as':_0x3b8b('0xc3'),'required':![]},{'model':db[_0x3b8b('0xb1')],'as':'Owner','attributes':[_0x3b8b('0x3a'),_0x3b8b('0xc4'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x3b8b('0xc5'),'attributes':['id',_0x3b8b('0x3a'),_0x3b8b('0xc6')],'where':_0x8b85b8[_0x3b8b('0x44')]['tag']?{'id':_0x8b85b8['query'][_0x3b8b('0xc7')]}:undefined,'required':_0x8b85b8[_0x3b8b('0x44')][_0x3b8b('0xc7')]?!![]:![]}];}return db[_0x3b8b('0xa8')][_0x3b8b('0x58')](_0x1ae3b2);})[_0x3b8b('0x1e')](function(_0x4749b5){_0x5ab16a[_0x3b8b('0x59')]=_0x4749b5;return _0x5ab16a;});}})['then'](respondWithFilteredResult(_0x10d485,_0x1ae3b2))[_0x3b8b('0x28')](handleError(_0x10d485,null));};exports['send']=function(_0x4d9172,_0x5b236c,_0x3c8903){var _0x35f15d,_0x88a1ef,_0x1148d2;if(_[_0x3b8b('0x9b')](_0x4d9172[_0x3b8b('0x63')][_0x3b8b('0x63')])||_0x4d9172[_0x3b8b('0x63')][_0x3b8b('0x63')]===''){throw new db[(_0x3b8b('0x9d'))]['ValidationError'](_0x3b8b('0x9e'));}if(_[_0x3b8b('0x9b')](_0x4d9172[_0x3b8b('0x63')]['to'])){throw new db[(_0x3b8b('0x9d'))]['ValidationError'](_0x3b8b('0xc8'));}_0x35f15d=_0x4d9172[_0x3b8b('0x63')]['to'];return db['SmsAccount']['find']({'where':{'id':_0x4d9172[_0x3b8b('0x5b')]['id']},'include':[{'model':db[_0x3b8b('0xa2')],'as':_0x3b8b('0xc9'),'include':[{'model':db[_0x3b8b('0x78')],'as':_0x3b8b('0xa3'),'where':{'mobile':_0x35f15d},'limit':0x1,'order':[['updatedAt',_0x3b8b('0xca')]]}]}]})[_0x3b8b('0x1e')](handleEntityNotFound(_0x5b236c,null))['then'](function(_0x1b5d12){if(_0x1b5d12&&_0x1b5d12['List']){_0x88a1ef=_0x1b5d12[_0x3b8b('0x37')]({'plain':!![]});if(_0x88a1ef['List']&&_0x88a1ef[_0x3b8b('0xc9')][_0x3b8b('0xa3')][_0x3b8b('0x4a')]){return _0x88a1ef[_0x3b8b('0xc9')][_0x3b8b('0xa3')][0x0];}return db['CmContact']['create'](_[_0x3b8b('0xa6')](_0x4d9172[_0x3b8b('0x63')],{'firstName':_0x35f15d,'mobile':_0x35f15d,'phone':_0x35f15d,'ListId':_0x88a1ef[_0x3b8b('0x7f')]}));}})['then'](handleEntityNotFound(_0x5b236c,null))[_0x3b8b('0x1e')](function(_0x3b62f9){if(_0x3b62f9){_0x1148d2=_0x3b62f9;return db[_0x3b8b('0xa8')]['find']({'where':{'ContactId':_0x1148d2['id'],'closed':![],'SmsAccountId':_0x88a1ef['id']}})[_0x3b8b('0x1e')](function(_0x223c3f){if(_0x223c3f){return[_0x223c3f,![]];}return db[_0x3b8b('0xa8')]['create']({'UserId':_0x4d9172[_0x3b8b('0x5d')]['id'],'ContactId':_0x1148d2['id'],'SmsAccountId':_0x88a1ef['id'],'phone':_0x35f15d,'firstMsgDirection':_0x3b8b('0xcb'),'Messages':[_['merge'](_0x4d9172[_0x3b8b('0x63')],{'read':![],'body':_0x4d9172[_0x3b8b('0x63')][_0x3b8b('0x63')],'phone':_0x35f15d,'SmsAccountId':_0x88a1ef['id'],'UserId':_0x4d9172['user']['id'],'ContactId':_0x1148d2['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x3b8b('0xcc')}]})[_0x3b8b('0x1e')](function(_0x1bc2d1){return[_0x1bc2d1,!![]];});});}})['spread'](function(_0x3080c5,_0x3fb04e){if(_0x3fb04e){return _0x3080c5;}return db['SmsMessage'][_0x3b8b('0x5c')](_[_0x3b8b('0x53')](_0x4d9172[_0x3b8b('0x63')],{'read':![],'body':_0x4d9172[_0x3b8b('0x63')][_0x3b8b('0x63')],'phone':_0x35f15d,'SmsAccountId':_0x88a1ef['id'],'SmsInteractionId':_0x3080c5['id'],'UserId':_0x4d9172[_0x3b8b('0x5d')]['id'],'ContactId':_0x1148d2['id']}))[_0x3b8b('0x1e')](function(_0x1e9cdb){_0x3080c5[_0x3b8b('0xcd')]['Messages']=[];_0x3080c5['dataValues']['Messages'][_0x3b8b('0xaa')](_0x1e9cdb['dataValues']);return _0x3080c5;});})[_0x3b8b('0x1e')](respondWithResult(_0x5b236c,null))[_0x3b8b('0x28')](handleError(_0x5b236c,null));};exports['status']=function(_0x1a99d5,_0x10aba0,_0x4a21e9){if(_0x1a99d5['body']['id']){delete _0x1a99d5[_0x3b8b('0x63')]['id'];}var _0xb74b78,_0x4a8da4,_0x131738;return db[_0x3b8b('0x55')]['find']({'where':{'id':_0x1a99d5['params']['id']}})[_0x3b8b('0x1e')](handleEntityNotFound(_0x10aba0,null))['then'](function(_0x666ee){if(_0x666ee){_0x131738=_0x666ee;logger[_0x3b8b('0x21')](_0x3b8b('0x22'),'status',_0x3b8b('0xce'),_0x666ee['type'],util[_0x3b8b('0xcf')](_0x1a99d5[_0x3b8b('0x63')],{'showHidden':![],'depth':null}));switch(_0x666ee[_0x3b8b('0x42')]){case'skebby':if(_0x1a99d5[_0x3b8b('0x63')][_0x3b8b('0xd0')]&&_0x1a99d5[_0x3b8b('0x63')][_0x3b8b('0x2a')]){_0x4a8da4=_0x1a99d5['body'][_0x3b8b('0x2a')];return db[_0x3b8b('0xae')]['find']({'where':{'messageId':_0x1a99d5[_0x3b8b('0x63')][_0x3b8b('0xd0')]}});}break;case _0x3b8b('0x8a'):if(_0x1a99d5['body'][_0x3b8b('0xd1')]&&_0x1a99d5[_0x3b8b('0x63')][_0x3b8b('0xd2')]){_0x4a8da4=_0x1a99d5['body']['statusInt'];return db['SmsMessage'][_0x3b8b('0x64')]({'where':{'messageId':_0x1a99d5['body']['requestid']}});}break;case'clicksend':if(_0x1a99d5[_0x3b8b('0x63')][_0x3b8b('0x8c')]&&_0x1a99d5[_0x3b8b('0x63')][_0x3b8b('0xd3')]){_0x4a8da4=_0x1a99d5[_0x3b8b('0x63')][_0x3b8b('0xd3')];return db[_0x3b8b('0xae')][_0x3b8b('0x64')]({'where':{'messageId':_0x1a99d5['body'][_0x3b8b('0x8c')]}});}break;case _0x3b8b('0x90'):var _0x50ed9b=_0x1a99d5[_0x3b8b('0x63')][_0x3b8b('0x91')][0x0];if(_0x50ed9b[_0x3b8b('0x85')]&&_0x50ed9b[_0x3b8b('0x2a')][_0x3b8b('0xd4')]===_0x3b8b('0xd5')){_0x4a8da4=_0x50ed9b[_0x3b8b('0x2a')][_0x3b8b('0xd4')];return db[_0x3b8b('0xae')][_0x3b8b('0x64')]({'where':{'messageId':_0x50ed9b[_0x3b8b('0x85')]}});}break;case _0x3b8b('0x95'):if(_0x1a99d5[_0x3b8b('0x63')][_0x3b8b('0x85')]&&_0x1a99d5['body'][_0x3b8b('0x2a')]){_0x4a8da4=_0x1a99d5[_0x3b8b('0x63')][_0x3b8b('0x2a')];return db['SmsMessage'][_0x3b8b('0x64')]({'where':{'messageId':_0x1a99d5[_0x3b8b('0x63')][_0x3b8b('0x85')]}});}break;case _0x3b8b('0x98'):if(_0x1a99d5['body'][0x0]['message']['id']){_0x4a8da4=_0x1a99d5[_0x3b8b('0x63')][0x0][_0x3b8b('0x42')];return db[_0x3b8b('0xae')][_0x3b8b('0x64')]({'where':{'messageId':_0x1a99d5[_0x3b8b('0x63')][0x0][_0x3b8b('0x26')]['id']}});}break;case _0x3b8b('0x99'):if(_0x1a99d5[_0x3b8b('0x63')][_0x3b8b('0xd6')]&&_0x1a99d5[_0x3b8b('0x63')]['status']){_0x4a8da4=_0x1a99d5[_0x3b8b('0x63')][_0x3b8b('0x2a')];return db[_0x3b8b('0xae')][_0x3b8b('0x64')]({'where':{'messageId':_0x1a99d5[_0x3b8b('0x63')]['redif']}});}break;}}})[_0x3b8b('0x1e')](handleEntityNotFound(_0x10aba0,null))[_0x3b8b('0x1e')](function(_0x2ccb03){if(_0x2ccb03){_0xb74b78=_0x2ccb03;switch(_0x131738['type']){case'skebby':if(_0x4a8da4===_0x3b8b('0xd5')){return _0xb74b78['update']({'read':!![]});}else{logger[_0x3b8b('0x23')](_0x3b8b('0x22'),_0x3b8b('0x2a'),_0x3b8b('0x87'),util['inspect'](_0x1a99d5[_0x3b8b('0x63')],{'showHidden':![],'depth':null}));}break;case _0x3b8b('0x8a'):if(_0x4a8da4==='1'){return _0xb74b78['update']({'read':!![]});}else{logger[_0x3b8b('0x23')](_0x3b8b('0x22'),'status','skebby',util['inspect'](_0x1a99d5['body'],{'showHidden':![],'depth':null}));}break;case _0x3b8b('0x8b'):if(!_0x1a99d5[_0x3b8b('0x63')][_0x3b8b('0xd7')]&&_0x4a8da4>=0xc8&&_0x4a8da4<=0xce){return _0xb74b78[_0x3b8b('0x35')]({'read':!![]});}else{logger[_0x3b8b('0x23')](_0x3b8b('0x22'),_0x3b8b('0x2a'),'clicksend',util[_0x3b8b('0xcf')](_0x1a99d5['body'],{'showHidden':![],'depth':null}));}break;case _0x3b8b('0x90'):var _0x2fc99f=_0x1a99d5['body'][_0x3b8b('0x91')][0x0];if(_0x2fc99f[_0x3b8b('0x2a')][_0x3b8b('0xd4')]==='DELIVERED'){return _0xb74b78[_0x3b8b('0x35')]({'read':!![]});}else{logger[_0x3b8b('0x23')](_0x3b8b('0x22'),_0x3b8b('0x2a'),_0x3b8b('0x90'),util['inspect'](_0x1a99d5[_0x3b8b('0x63')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4a8da4=='DELIVERED_TO_GATEWAY'||_0x4a8da4==_0x3b8b('0xd8')){return _0xb74b78[_0x3b8b('0x35')]({'read':!![]});}else{logger[_0x3b8b('0x23')](_0x3b8b('0x22'),_0x3b8b('0x2a'),_0x3b8b('0x95'),util[_0x3b8b('0xcf')](_0x1a99d5[_0x3b8b('0x63')],{'showHidden':![],'depth':null}));}break;case _0x3b8b('0x98'):if(_0x4a8da4==_0x3b8b('0xd9')){return _0xb74b78[_0x3b8b('0x35')]({'read':!![]});}else{logger[_0x3b8b('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3b8b('0x2a'),_0x3b8b('0x98'),util['inspect'](_0x1a99d5['body'],{'showHidden':![],'depth':null}));}break;case _0x3b8b('0x99'):if(_0x4a8da4===_0x3b8b('0xda')||_0x4a8da4===_0x3b8b('0xdb')){return _0xb74b78[_0x3b8b('0x35')]({'read':!![]});}else{logger[_0x3b8b('0x23')](_0x3b8b('0x22'),'status',_0x3b8b('0x99'),util[_0x3b8b('0xcf')](_0x1a99d5[_0x3b8b('0x63')],{'showHidden':![],'depth':null}));}break;}return _0xb74b78;}})['then'](respondWithResult(_0x10aba0,null))['catch'](handleError(_0x10aba0,null));};exports[_0x3b8b('0xdc')]=function(_0x1c95b7,_0x1ccda1,_0x7f8216){var _0xb29cf,_0x3a4206,_0x31a3e6;return db['SmsAccount'][_0x3b8b('0x64')]({'where':{'id':_0x1c95b7[_0x3b8b('0x5b')]['id']}})[_0x3b8b('0x1e')](handleEntityNotFound(_0x1ccda1,null))[_0x3b8b('0x1e')](function(_0x5757cb){if(_0x5757cb){_0x31a3e6=_0x5757cb;logger[_0x3b8b('0x21')](_0x3b8b('0x22'),'status','received\x20delivery\x20report\x20from',_0x5757cb[_0x3b8b('0x42')],util['inspect'](_0x1c95b7['query'],{'showHidden':![],'depth':null}));switch(_0x5757cb[_0x3b8b('0x42')]){case _0x3b8b('0x92'):if(_0x1c95b7['query'][_0x3b8b('0xdd')]&&_0x1c95b7[_0x3b8b('0x44')]['state']){_0x3a4206=_0x1c95b7[_0x3b8b('0x44')]['state'];return db[_0x3b8b('0xae')][_0x3b8b('0x64')]({'where':{'messageId':_0x1c95b7[_0x3b8b('0x44')]['message-id']}});}break;}}})[_0x3b8b('0x1e')](handleEntityNotFound(_0x1ccda1,null))['then'](function(_0x194c82){if(_0x194c82){_0xb29cf=_0x194c82;switch(_0x31a3e6['type']){case'csc':if(_0x3a4206==='2'||_0x3a4206==='6'){return _0xb29cf[_0x3b8b('0x35')]({'read':!![]});}else{logger[_0x3b8b('0x23')](_0x3b8b('0x22'),_0x3b8b('0x2a'),'csc',util[_0x3b8b('0xcf')](_0x1c95b7['query'],{'showHidden':![],'depth':null}));};break;}return _0xb29cf;}})[_0x3b8b('0x1e')](respondWithResult(_0x1ccda1,null))[_0x3b8b('0x28')](handleError(_0x1ccda1,null));};exports[_0x3b8b('0xde')]=function(_0xf600ae,_0x46376e,_0x14675f){return db[_0x3b8b('0x55')][_0x3b8b('0x64')]({'where':{'id':_0xf600ae['params']['id']}})[_0x3b8b('0x1e')](handleEntityNotFound(_0x46376e,null))[_0x3b8b('0x1e')](function(_0x1dbc5b){if(_0x1dbc5b){return _0x1dbc5b[_0x3b8b('0xde')](_0xf600ae['body'][_0x3b8b('0x6b')],_[_0x3b8b('0xa5')](_0xf600ae['body'],[_0x3b8b('0x6b'),'id'])||{})[_0x3b8b('0xdf')](function(_0x5019dd){for(var _0x40f772=0x0;_0x40f772<_0xf600ae['body'][_0x3b8b('0x6b')][_0x3b8b('0x4a')];_0x40f772+=0x1){socket[_0x3b8b('0xe0')](_0x3b8b('0xe1'),{'UserId':_0xf600ae['body'][_0x3b8b('0x6b')][_0x40f772],'SmsAccountId':_0xf600ae[_0x3b8b('0x5b')]['id']});}return _0x5019dd;});}})['then'](respondWithResult(_0x46376e,null))[_0x3b8b('0x28')](handleError(_0x46376e,null));};exports['removeAgents']=function(_0x56daee,_0xb5a441,_0x23bb84){return db[_0x3b8b('0x55')][_0x3b8b('0x64')]({'where':{'id':_0x56daee['params']['id']}})[_0x3b8b('0x1e')](handleEntityNotFound(_0xb5a441,null))[_0x3b8b('0x1e')](function(_0x4015a9){if(_0x4015a9){return _0x4015a9['removeAgents'](_0x56daee[_0x3b8b('0x44')][_0x3b8b('0x6b')])[_0x3b8b('0x1e')](function(){if(_['isArray'](_0x56daee[_0x3b8b('0x44')][_0x3b8b('0x6b')])){for(var _0x4abf91=0x0;_0x4abf91<_0x56daee[_0x3b8b('0x44')]['ids'][_0x3b8b('0x4a')];_0x4abf91+=0x1){socket[_0x3b8b('0xe0')]('userSmsAccount:remove',{'UserId':Number(_0x56daee[_0x3b8b('0x44')]['ids'][_0x4abf91]),'SmsAccountId':Number(_0x56daee[_0x3b8b('0x5b')]['id'])});}}else{socket['emit'](_0x3b8b('0xe2'),{'UserId':Number(_0x56daee[_0x3b8b('0x44')]['ids']),'SmsAccountId':Number(_0x56daee['params']['id'])});}});}})[_0x3b8b('0x1e')](respondWithStatusCode(_0xb5a441,null))[_0x3b8b('0x28')](handleError(_0xb5a441,null));};exports['getAgents']=function(_0x3bb0b1,_0x4d0f8c,_0x22eb46){var _0x59c30a={};var _0x4c9298={};var _0x1cd4f3;var _0x49a992;return db['SmsAccount']['findOne']({'where':{'id':_0x3bb0b1['params']['id']}})[_0x3b8b('0x1e')](handleEntityNotFound(_0x4d0f8c,null))[_0x3b8b('0x1e')](function(_0x469e76){if(_0x469e76){_0x1cd4f3=_0x469e76;_0x4c9298[_0x3b8b('0x43')]=_[_0x3b8b('0x45')](db[_0x3b8b('0xb1')][_0x3b8b('0x40')]);_0x4c9298[_0x3b8b('0x44')]=_['keys'](_0x3bb0b1[_0x3b8b('0x44')]);_0x4c9298[_0x3b8b('0x46')]=_[_0x3b8b('0x47')](_0x4c9298[_0x3b8b('0x43')],_0x4c9298[_0x3b8b('0x44')]);_0x59c30a[_0x3b8b('0x48')]=_['intersection'](_0x4c9298[_0x3b8b('0x43')],qs[_0x3b8b('0x49')](_0x3bb0b1[_0x3b8b('0x44')]['fields']));_0x59c30a['attributes']=_0x59c30a[_0x3b8b('0x48')][_0x3b8b('0x4a')]?_0x59c30a[_0x3b8b('0x48')]:_0x4c9298[_0x3b8b('0x43')];_0x59c30a['order']=qs[_0x3b8b('0x4e')](_0x3bb0b1[_0x3b8b('0x44')][_0x3b8b('0x4e')]);_0x59c30a[_0x3b8b('0x4f')]=qs[_0x3b8b('0x46')](_[_0x3b8b('0x50')](_0x3bb0b1[_0x3b8b('0x44')],_0x4c9298[_0x3b8b('0x46')]));if(_0x3bb0b1[_0x3b8b('0x44')][_0x3b8b('0x51')]){_0x59c30a['where']=_[_0x3b8b('0x53')](_0x59c30a[_0x3b8b('0x4f')],{'$or':_[_0x3b8b('0x3f')](_0x59c30a[_0x3b8b('0x48')],function(_0x22cd98){var _0x61266c={};_0x61266c[_0x22cd98]={'$like':'%'+_0x3bb0b1[_0x3b8b('0x44')][_0x3b8b('0x51')]+'%'};return _0x61266c;})});}_0x59c30a=_['merge']({},_0x59c30a,_0x3bb0b1[_0x3b8b('0x54')]);return _0x1cd4f3[_0x3b8b('0xe3')](_0x59c30a);}})[_0x3b8b('0x1e')](function(_0x3ab196){if(_0x3ab196){_0x49a992=_0x3ab196[_0x3b8b('0x4a')];if(!_0x3bb0b1[_0x3b8b('0x44')][_0x3b8b('0x4b')](_0x3b8b('0x4c'))){_0x59c30a[_0x3b8b('0x2f')]=qs[_0x3b8b('0x2f')](_0x3bb0b1[_0x3b8b('0x44')][_0x3b8b('0x2f')]);_0x59c30a[_0x3b8b('0x2e')]=qs[_0x3b8b('0x2e')](_0x3bb0b1[_0x3b8b('0x44')]['offset']);}return _0x1cd4f3['getAgents'](_0x59c30a);}})['then'](function(_0x5c0fb2){if(_0x5c0fb2){return _0x5c0fb2?{'count':_0x49a992,'rows':_0x5c0fb2}:null;}})[_0x3b8b('0x1e')](respondWithResult(_0x4d0f8c,null))[_0x3b8b('0x28')](handleError(_0x4d0f8c,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 23e290b..8f771e4 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 _0x6c51=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x38771f,_0x150b0a){var _0x58ef54=function(_0x3a9b1b){while(--_0x3a9b1b){_0x38771f['push'](_0x38771f['shift']());}};_0x58ef54(++_0x150b0a);}(_0x6c51,0x130));var _0x16c5=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6c51[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x16c5('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x16c5('0x1')](0x0);var events={'afterCreate':_0x16c5('0x2'),'afterUpdate':_0x16c5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1bb816){return function(_0x31a341,_0x4c6f03,_0x218f21){SmsAccountEvents[_0x16c5('0x4')](_0x1bb816+':'+_0x31a341['id'],_0x31a341);SmsAccountEvents['emit'](_0x1bb816,_0x31a341);_0x218f21(null);};}for(var e in events){if(events[_0x16c5('0x5')](e)){var event=events[e];SmsAccount[_0x16c5('0x6')](e,emitEvent(event));}}module[_0x16c5('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x1311=['update','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4d0f0c,_0x3c225a){var _0x1fe673=function(_0x12f7d7){while(--_0x12f7d7){_0x4d0f0c['push'](_0x4d0f0c['shift']());}};_0x1fe673(++_0x3c225a);}(_0x1311,0x112));var _0x1131=function(_0x53a437,_0x6f0aaa){_0x53a437=_0x53a437-0x0;var _0x56c57e=_0x1311[_0x53a437];return _0x56c57e;};'use strict';var EventEmitter=require(_0x1131('0x0'));var SmsAccount=require(_0x1131('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1131('0x2'),'afterDestroy':'remove'};function emitEvent(_0x14e2bf){return function(_0x2c3202,_0x468e2f,_0x240d5e){SmsAccountEvents['emit'](_0x14e2bf+':'+_0x2c3202['id'],_0x2c3202);SmsAccountEvents['emit'](_0x14e2bf,_0x2c3202);_0x240d5e(null);};}for(var e in events){if(events[_0x1131('0x3')](e)){var event=events[e];SmsAccount[_0x1131('0x4')](e,emitEvent(event));}}module[_0x1131('0x5')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 3621717..4e6b909 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 _0x33c9=['sms_accounts','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','exports','define','SmsAccount'];(function(_0x29c3b2,_0x3c12ac){var _0x4b3aa7=function(_0x622a9d){while(--_0x622a9d){_0x29c3b2['push'](_0x29c3b2['shift']());}};_0x4b3aa7(++_0x3c12ac);}(_0x33c9,0xd2));var _0x933c=function(_0x50b592,_0x2828d5){_0x50b592=_0x50b592-0x0;var _0x3a564f=_0x33c9[_0x50b592];return _0x3a564f;};'use strict';var _=require(_0x933c('0x0'));var util=require(_0x933c('0x1'));var logger=require(_0x933c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x933c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x933c('0x4'));var rimraf=require(_0x933c('0x5'));var config=require(_0x933c('0x6'));var attributes=require('./smsAccount.attributes');module[_0x933c('0x7')]=function(_0x16537c,_0x27fbcc){return _0x16537c[_0x933c('0x8')](_0x933c('0x9'),attributes,{'tableName':_0x933c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x323e=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','SmsAccount','sms_accounts'];(function(_0x50713a,_0x545e85){var _0x536dd0=function(_0x451d18){while(--_0x451d18){_0x50713a['push'](_0x50713a['shift']());}};_0x536dd0(++_0x545e85);}(_0x323e,0xfc));var _0xe323=function(_0x4cb17f,_0x3dd558){_0x4cb17f=_0x4cb17f-0x0;var _0x5add10=_0x323e[_0x4cb17f];return _0x5add10;};'use strict';var _=require(_0xe323('0x0'));var util=require(_0xe323('0x1'));var logger=require(_0xe323('0x2'))(_0xe323('0x3'));var moment=require(_0xe323('0x4'));var BPromise=require(_0xe323('0x5'));var rp=require(_0xe323('0x6'));var fs=require('fs');var path=require(_0xe323('0x7'));var rimraf=require(_0xe323('0x8'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0xe323('0x9')]=function(_0x1dccae,_0x2d4281){return _0x1dccae['define'](_0xe323('0xa'),attributes,{'tableName':_0xe323('0xb'),'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 0ba7f82..6111f9e 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 _0x4d6a=['redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','SmsAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','SmsAccount','find','options','where','attributes','include','map','model','then','ShowSmsAccount','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x2891d1,_0x2ddd3e){var _0x486948=function(_0x13fa0f){while(--_0x13fa0f){_0x2891d1['push'](_0x2891d1['shift']());}};_0x486948(++_0x2ddd3e);}(_0x4d6a,0x1e2));var _0xa4d6=function(_0x432663,_0x52779e){_0x432663=_0x432663-0x0;var _0x50172e=_0x4d6a[_0x432663];return _0x50172e;};'use strict';var _=require(_0xa4d6('0x0'));var util=require(_0xa4d6('0x1'));var moment=require(_0xa4d6('0x2'));var BPromise=require(_0xa4d6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4d6('0x4'));var db=require(_0xa4d6('0x5'))['db'];var utils=require(_0xa4d6('0x6'));var logger=require(_0xa4d6('0x7'))(_0xa4d6('0x8'));var config=require('../../config/environment');var jayson=require(_0xa4d6('0x9'));var client=jayson[_0xa4d6('0xa')][_0xa4d6('0xb')]({'port':0x232a});config[_0xa4d6('0xc')]=_['defaults'](config[_0xa4d6('0xc')],{'host':_0xa4d6('0xd'),'port':0x18eb});var socket=require(_0xa4d6('0xe'))(new Redis(config[_0xa4d6('0xc')]));require(_0xa4d6('0xf'))[_0xa4d6('0x10')](socket);function respondWithRpcPromise(_0x3774fd,_0x4eb5c7,_0xe52b5d){return new BPromise(function(_0x2116cd,_0x545e9c){return client[_0xa4d6('0x11')](_0x3774fd,_0xe52b5d)['then'](function(_0x5e7182){logger['info'](_0xa4d6('0x12'),_0x4eb5c7,'request\x20sent');logger[_0xa4d6('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4eb5c7,_0xa4d6('0x14'),JSON['stringify'](_0x5e7182));if(_0x5e7182[_0xa4d6('0x15')]){if(_0x5e7182[_0xa4d6('0x15')][_0xa4d6('0x16')]===0x1f4){logger[_0xa4d6('0x15')](_0xa4d6('0x12'),_0x4eb5c7,_0x5e7182[_0xa4d6('0x15')][_0xa4d6('0x17')]);return _0x545e9c(_0x5e7182[_0xa4d6('0x15')][_0xa4d6('0x17')]);}logger[_0xa4d6('0x15')](_0xa4d6('0x12'),_0x4eb5c7,_0x5e7182[_0xa4d6('0x15')][_0xa4d6('0x17')]);return _0x2116cd(_0x5e7182[_0xa4d6('0x15')]['message']);}else{logger[_0xa4d6('0x18')]('SmsAccount,\x20%s,\x20%s',_0x4eb5c7,'request\x20sent');_0x2116cd(_0x5e7182[_0xa4d6('0x19')][_0xa4d6('0x17')]);}})[_0xa4d6('0x1a')](function(_0x2cb92e){logger[_0xa4d6('0x15')](_0xa4d6('0x12'),_0x4eb5c7,_0x2cb92e);_0x545e9c(_0x2cb92e);});});}exports['ShowSmsAccount']=function(_0x18f10b){var _0x41a165=this;return new Promise(function(_0x21f2eb,_0x1193ab){return db[_0xa4d6('0x1b')][_0xa4d6('0x1c')]({'raw':_0x18f10b['options']?_0x18f10b[_0xa4d6('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x18f10b[_0xa4d6('0x1d')]?_0x18f10b[_0xa4d6('0x1d')][_0xa4d6('0x1e')]||null:null,'attributes':_0x18f10b[_0xa4d6('0x1d')]?_0x18f10b[_0xa4d6('0x1d')][_0xa4d6('0x1f')]||null:null,'include':_0x18f10b['options']?_0x18f10b['options'][_0xa4d6('0x20')]?_[_0xa4d6('0x21')](_0x18f10b[_0xa4d6('0x1d')]['include'],function(_0x5148e8){return{'model':db[_0x5148e8['model']],'as':_0x5148e8['as'],'attributes':_0x5148e8['attributes'],'include':_0x5148e8[_0xa4d6('0x20')]?_[_0xa4d6('0x21')](_0x5148e8[_0xa4d6('0x20')],function(_0x280cb8){return{'model':db[_0x280cb8['model']],'as':_0x280cb8['as'],'attributes':_0x280cb8[_0xa4d6('0x1f')],'include':_0x280cb8[_0xa4d6('0x20')]?_['map'](_0x280cb8[_0xa4d6('0x20')],function(_0x50958e){return{'model':db[_0x50958e[_0xa4d6('0x22')]],'as':_0x50958e['as'],'attributes':_0x50958e[_0xa4d6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa4d6('0x23')](function(_0x5d16ce){logger[_0xa4d6('0x18')](_0xa4d6('0x24'),_0x18f10b);logger[_0xa4d6('0x13')](_0xa4d6('0x24'),_0x18f10b,JSON[_0xa4d6('0x25')](_0x5d16ce));_0x21f2eb(_0x5d16ce);})['catch'](function(_0x4fa4de){logger[_0xa4d6('0x15')](_0xa4d6('0x24'),_0x4fa4de['message'],_0x18f10b);_0x1193ab(_0x41a165[_0xa4d6('0x15')](0x1f4,_0x4fa4de[_0xa4d6('0x17')]));});});}; \ No newline at end of file +var _0x4c05=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','SmsAccount','find','options','attributes','include','map','model','then','ShowSmsAccount','lodash','util','moment','randomstring','ioredis'];(function(_0x1ff275,_0x12b011){var _0x156912=function(_0x47bf8b){while(--_0x47bf8b){_0x1ff275['push'](_0x1ff275['shift']());}};_0x156912(++_0x12b011);}(_0x4c05,0xd3));var _0x54c0=function(_0x39e36c,_0x3be58a){_0x39e36c=_0x39e36c-0x0;var _0x1ba8c6=_0x4c05[_0x39e36c];return _0x1ba8c6;};'use strict';var _=require(_0x54c0('0x0'));var util=require(_0x54c0('0x1'));var moment=require(_0x54c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x54c0('0x3'));var fs=require('fs');var Redis=require(_0x54c0('0x4'));var db=require(_0x54c0('0x5'))['db'];var utils=require(_0x54c0('0x6'));var logger=require(_0x54c0('0x7'))(_0x54c0('0x8'));var config=require(_0x54c0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x54c0('0xa')]({'port':0x232a});config[_0x54c0('0xb')]=_[_0x54c0('0xc')](config[_0x54c0('0xb')],{'host':_0x54c0('0xd'),'port':0x18eb});var socket=require(_0x54c0('0xe'))(new Redis(config[_0x54c0('0xb')]));require(_0x54c0('0xf'))[_0x54c0('0x10')](socket);function respondWithRpcPromise(_0x484447,_0x40bff3,_0x42615b){return new BPromise(function(_0x251eb2,_0x1b39cb){return client['request'](_0x484447,_0x42615b)['then'](function(_0x259a62){logger['info'](_0x54c0('0x11'),_0x40bff3,_0x54c0('0x12'));logger[_0x54c0('0x13')](_0x54c0('0x14'),_0x40bff3,_0x54c0('0x12'),JSON[_0x54c0('0x15')](_0x259a62));if(_0x259a62[_0x54c0('0x16')]){if(_0x259a62[_0x54c0('0x16')][_0x54c0('0x17')]===0x1f4){logger['error'](_0x54c0('0x11'),_0x40bff3,_0x259a62['error'][_0x54c0('0x18')]);return _0x1b39cb(_0x259a62[_0x54c0('0x16')]['message']);}logger[_0x54c0('0x16')]('SmsAccount,\x20%s,\x20%s',_0x40bff3,_0x259a62[_0x54c0('0x16')][_0x54c0('0x18')]);return _0x251eb2(_0x259a62[_0x54c0('0x16')][_0x54c0('0x18')]);}else{logger[_0x54c0('0x19')](_0x54c0('0x11'),_0x40bff3,_0x54c0('0x12'));_0x251eb2(_0x259a62['result'][_0x54c0('0x18')]);}})[_0x54c0('0x1a')](function(_0x51585f){logger['error'](_0x54c0('0x11'),_0x40bff3,_0x51585f);_0x1b39cb(_0x51585f);});});}exports['ShowSmsAccount']=function(_0x50dbd5){var _0x4fcbfa=this;return new Promise(function(_0x19ddb7,_0xbf2ba6){return db[_0x54c0('0x1b')][_0x54c0('0x1c')]({'raw':_0x50dbd5[_0x54c0('0x1d')]?_0x50dbd5['options']['raw']===undefined?!![]:![]:!![],'where':_0x50dbd5[_0x54c0('0x1d')]?_0x50dbd5[_0x54c0('0x1d')]['where']||null:null,'attributes':_0x50dbd5[_0x54c0('0x1d')]?_0x50dbd5[_0x54c0('0x1d')][_0x54c0('0x1e')]||null:null,'include':_0x50dbd5['options']?_0x50dbd5[_0x54c0('0x1d')][_0x54c0('0x1f')]?_[_0x54c0('0x20')](_0x50dbd5['options']['include'],function(_0x3dfd86){return{'model':db[_0x3dfd86[_0x54c0('0x21')]],'as':_0x3dfd86['as'],'attributes':_0x3dfd86[_0x54c0('0x1e')],'include':_0x3dfd86[_0x54c0('0x1f')]?_['map'](_0x3dfd86['include'],function(_0x19eee0){return{'model':db[_0x19eee0[_0x54c0('0x21')]],'as':_0x19eee0['as'],'attributes':_0x19eee0[_0x54c0('0x1e')],'include':_0x19eee0[_0x54c0('0x1f')]?_[_0x54c0('0x20')](_0x19eee0[_0x54c0('0x1f')],function(_0x302a05){return{'model':db[_0x302a05[_0x54c0('0x21')]],'as':_0x302a05['as'],'attributes':_0x302a05['attributes']};}):[]};}):[]};}):[]:[]})[_0x54c0('0x22')](function(_0x54b9ec){logger[_0x54c0('0x19')](_0x54c0('0x23'),_0x50dbd5);logger[_0x54c0('0x13')](_0x54c0('0x23'),_0x50dbd5,JSON[_0x54c0('0x15')](_0x54b9ec));_0x19ddb7(_0x54b9ec);})[_0x54c0('0x1a')](function(_0x3e8b46){logger['error'](_0x54c0('0x23'),_0x3e8b46[_0x54c0('0x18')],_0x50dbd5);_0xbf2ba6(_0x4fcbfa[_0x54c0('0x16')](0x1f4,_0x3e8b46['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 8779a25..ad2853f 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 _0x3f74=['smsAccount:','./smsAccount.events','save','remove','update','emit','removeListener','length'];(function(_0x3c0203,_0x82d067){var _0x21acf5=function(_0x5f2d29){while(--_0x5f2d29){_0x3c0203['push'](_0x3c0203['shift']());}};_0x21acf5(++_0x82d067);}(_0x3f74,0x121));var _0x43f7=function(_0x2e7948,_0x5890eb){_0x2e7948=_0x2e7948-0x0;var _0x49e648=_0x3f74[_0x2e7948];return _0x49e648;};'use strict';var SmsAccountEvents=require(_0x43f7('0x0'));var events=[_0x43f7('0x1'),_0x43f7('0x2'),_0x43f7('0x3')];function createListener(_0x20bda0,_0x90cc42){return function(_0x19286c){_0x90cc42[_0x43f7('0x4')](_0x20bda0,_0x19286c);};}function removeListener(_0x591452,_0x1f5e13){return function(){SmsAccountEvents[_0x43f7('0x5')](_0x591452,_0x1f5e13);};}exports['register']=function(_0x4fa0e1){for(var _0x37e991=0x0,_0x4f64a6=events[_0x43f7('0x6')];_0x37e991<_0x4f64a6;_0x37e991++){var _0x574b8a=events[_0x37e991];var _0x115f89=createListener(_0x43f7('0x7')+_0x574b8a,_0x4fa0e1);SmsAccountEvents['on'](_0x574b8a,_0x115f89);}}; \ No newline at end of file +var _0xcf45=['./smsAccount.events','save','remove','removeListener','length','smsAccount:'];(function(_0x84f3ca,_0x3ddcea){var _0x410b13=function(_0xc579){while(--_0xc579){_0x84f3ca['push'](_0x84f3ca['shift']());}};_0x410b13(++_0x3ddcea);}(_0xcf45,0x168));var _0x5cf4=function(_0x71f075,_0x165b97){_0x71f075=_0x71f075-0x0;var _0x446c0a=_0xcf45[_0x71f075];return _0x446c0a;};'use strict';var SmsAccountEvents=require(_0x5cf4('0x0'));var events=[_0x5cf4('0x1'),_0x5cf4('0x2'),'update'];function createListener(_0x3a5999,_0x8b13f4){return function(_0x1abdf8){_0x8b13f4['emit'](_0x3a5999,_0x1abdf8);};}function removeListener(_0xca63bc,_0x365130){return function(){SmsAccountEvents[_0x5cf4('0x3')](_0xca63bc,_0x365130);};}exports['register']=function(_0x196a84){for(var _0x325ac6=0x0,_0x244b19=events[_0x5cf4('0x4')];_0x325ac6<_0x244b19;_0x325ac6++){var _0x20605e=events[_0x325ac6];var _0x255c17=createListener(_0x5cf4('0x5')+_0x20605e,_0x196a84);SmsAccountEvents['on'](_0x20605e,_0x255c17);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index f022917..6655aeb 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 _0x6de6=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x12f78f,_0x433347){var _0x357600=function(_0x1859a2){while(--_0x1859a2){_0x12f78f['push'](_0x12f78f['shift']());}};_0x357600(++_0x433347);}(_0x6de6,0xe0));var _0x66de=function(_0x4fd5bc,_0x56f503){_0x4fd5bc=_0x4fd5bc-0x0;var _0x6b69d7=_0x6de6[_0x4fd5bc];return _0x6b69d7;};'use strict';var multer=require(_0x66de('0x0'));var util=require(_0x66de('0x1'));var path=require(_0x66de('0x2'));var timeout=require(_0x66de('0x3'));var express=require(_0x66de('0x4'));var router=express['Router']();var auth=require(_0x66de('0x5'));var interaction=require(_0x66de('0x6'));var config=require(_0x66de('0x7'));var controller=require('./smsApplication.controller');router[_0x66de('0x8')]('/',auth[_0x66de('0x9')](),controller[_0x66de('0xa')]);router[_0x66de('0x8')](_0x66de('0xb'),auth[_0x66de('0x9')](),controller['show']);router[_0x66de('0xc')]('/',auth[_0x66de('0x9')](),controller[_0x66de('0xd')]);router[_0x66de('0xe')](_0x66de('0xb'),auth[_0x66de('0x9')](),controller[_0x66de('0xf')]);router[_0x66de('0x10')](_0x66de('0xb'),auth[_0x66de('0x9')](),controller[_0x66de('0x11')]);module[_0x66de('0x12')]=router; \ No newline at end of file +var _0x74b5=['index','/:id','show','post','create','update','delete','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated'];(function(_0x51fc03,_0x1bf803){var _0x1c6323=function(_0x189d96){while(--_0x189d96){_0x51fc03['push'](_0x51fc03['shift']());}};_0x1c6323(++_0x1bf803);}(_0x74b5,0xa7));var _0x574b=function(_0x3aa032,_0x566691){_0x3aa032=_0x3aa032-0x0;var _0x5120f9=_0x74b5[_0x3aa032];return _0x5120f9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x574b('0x0'));var timeout=require(_0x574b('0x1'));var express=require(_0x574b('0x2'));var router=express['Router']();var auth=require(_0x574b('0x3'));var interaction=require(_0x574b('0x4'));var config=require(_0x574b('0x5'));var controller=require(_0x574b('0x6'));router[_0x574b('0x7')]('/',auth[_0x574b('0x8')](),controller[_0x574b('0x9')]);router[_0x574b('0x7')](_0x574b('0xa'),auth['isAuthenticated'](),controller[_0x574b('0xb')]);router[_0x574b('0xc')]('/',auth[_0x574b('0x8')](),controller[_0x574b('0xd')]);router['put'](_0x574b('0xa'),auth[_0x574b('0x8')](),controller[_0x574b('0xe')]);router[_0x574b('0xf')](_0x574b('0xa'),auth[_0x574b('0x8')](),controller['destroy']);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 78367e5..278bcac 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 _0x53ae=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x2115c6,_0x194e1c){var _0x52ff95=function(_0x287fe0){while(--_0x287fe0){_0x2115c6['push'](_0x2115c6['shift']());}};_0x52ff95(++_0x194e1c);}(_0x53ae,0x13d));var _0xe53a=function(_0x279301,_0x2891fc){_0x279301=_0x279301-0x0;var _0x27fa01=_0x53ae[_0x279301];return _0x27fa01;};'use strict';var Sequelize=require(_0xe53a('0x0'));module[_0xe53a('0x1')]={'priority':{'type':Sequelize[_0xe53a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe53a('0x3')],'allowNull':![],'defaultValue':_0xe53a('0x4')},'appdata':{'type':Sequelize[_0xe53a('0x5')]()},'description':{'type':Sequelize[_0xe53a('0x3')]},'interval':{'type':Sequelize[_0xe53a('0x3')],'defaultValue':_0xe53a('0x6')}}; \ No newline at end of file +var _0x79b6=['exports','STRING','noop','TEXT','sequelize'];(function(_0x140dcd,_0xe99058){var _0x346705=function(_0x38a521){while(--_0x38a521){_0x140dcd['push'](_0x140dcd['shift']());}};_0x346705(++_0xe99058);}(_0x79b6,0x144));var _0x679b=function(_0xf747c4,_0x4b25a2){_0xf747c4=_0xf747c4-0x0;var _0x6d1c3a=_0x79b6[_0xf747c4];return _0x6d1c3a;};'use strict';var Sequelize=require(_0x679b('0x0'));module[_0x679b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x679b('0x2')],'allowNull':![],'defaultValue':_0x679b('0x3')},'appdata':{'type':Sequelize[_0x679b('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x679b('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 261d778..d6d1fd4 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 _0xde1a=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','query','keys'];(function(_0x493f53,_0x1dfeec){var _0x363c60=function(_0x1fc50d){while(--_0x1fc50d){_0x493f53['push'](_0x493f53['shift']());}};_0x363c60(++_0x1dfeec);}(_0xde1a,0xfd));var _0xade1=function(_0x556ded,_0x8cfb7a){_0x556ded=_0x556ded-0x0;var _0x2c6760=_0xde1a[_0x556ded];return _0x2c6760;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xade1('0x0'));var rimraf=require(_0xade1('0x1'));var zipdir=require(_0xade1('0x2'));var jsonpatch=require(_0xade1('0x3'));var rp=require(_0xade1('0x4'));var moment=require(_0xade1('0x5'));var BPromise=require(_0xade1('0x6'));var Mustache=require(_0xade1('0x7'));var util=require('util');var path=require(_0xade1('0x8'));var sox=require(_0xade1('0x9'));var csv=require(_0xade1('0xa'));var ejs=require(_0xade1('0xb'));var fs=require('fs');var _=require(_0xade1('0xc'));var squel=require(_0xade1('0xd'));var crypto=require('crypto');var jsforce=require(_0xade1('0xe'));var deskjs=require(_0xade1('0xf'));var toCsv=require(_0xade1('0xa'));var querystring=require(_0xade1('0x10'));var Papa=require(_0xade1('0x11'));var Redis=require(_0xade1('0x12'));var authService=require(_0xade1('0x13'));var qs=require(_0xade1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xade1('0x15'));var logger=require(_0xade1('0x16'))('api');var utils=require(_0xade1('0x17'));var config=require(_0xade1('0x18'));var licenseUtil=require(_0xade1('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34ef60,_0x10f67f){_0x10f67f=_0x10f67f||0xcc;return function(_0x222a49){if(_0x222a49){return _0x34ef60[_0xade1('0x1a')](_0x10f67f);}return _0x34ef60[_0xade1('0x1b')](_0x10f67f)[_0xade1('0x1c')]();};}function respondWithResult(_0x525f90,_0x1431d7){_0x1431d7=_0x1431d7||0xc8;return function(_0x13dda2){if(_0x13dda2){return _0x525f90[_0xade1('0x1b')](_0x1431d7)[_0xade1('0x1d')](_0x13dda2);}};}function respondWithFilteredResult(_0x1c9717,_0x5bd472){return function(_0x44c001){if(_0x44c001){var _0x4623a1=_0x44c001['count'],_0x290566=_0x5bd472[_0xade1('0x1e')],_0x232e06=_0x5bd472[_0xade1('0x1e')]+_0x5bd472[_0xade1('0x1f')],_0x994e75;if(_0x232e06>=_0x4623a1){_0x232e06=_0x4623a1;_0x994e75=0xc8;}else{_0x994e75=0xce;}_0x1c9717[_0xade1('0x1b')](_0x994e75);return _0x1c9717[_0xade1('0x20')](_0xade1('0x21'),_0x290566+'-'+_0x232e06+'/'+_0x4623a1)[_0xade1('0x1d')](_0x44c001);}return null;};}function patchUpdates(_0x43f559){return function(_0x16f23a){try{jsonpatch[_0xade1('0x22')](_0x16f23a,_0x43f559,!![]);}catch(_0x1d7c21){return BPromise[_0xade1('0x23')](_0x1d7c21);}return _0x16f23a['save']();};}function saveUpdates(_0x5c6624,_0xdbecaf){return function(_0x241f5e){if(_0x241f5e){return _0x241f5e[_0xade1('0x24')](_0x5c6624)[_0xade1('0x25')](function(_0xd017f7){return _0xd017f7;});}return null;};}function removeEntity(_0x1efe83,_0x2da7a5){return function(_0xd9d2e1){if(_0xd9d2e1){return _0xd9d2e1[_0xade1('0x26')]()[_0xade1('0x25')](function(){_0x1efe83[_0xade1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6260d3,_0x5c2837){return function(_0x17f9df){if(!_0x17f9df){_0x6260d3['sendStatus'](0x194);}return _0x17f9df;};}function handleError(_0x14eec9,_0x385e8b){_0x385e8b=_0x385e8b||0x1f4;return function(_0x183fa2){logger[_0xade1('0x27')](_0x183fa2[_0xade1('0x28')]);if(_0x183fa2[_0xade1('0x29')]){delete _0x183fa2[_0xade1('0x29')];}_0x14eec9['status'](_0x385e8b)[_0xade1('0x2a')](_0x183fa2);};}exports[_0xade1('0x2b')]=function(_0x4bf5cd,_0x582e5b){var _0x38dd9f={},_0x1a1d17={},_0x59d64b={'count':0x0,'rows':[]};var _0x592920=_[_0xade1('0x2c')](db[_0xade1('0x2d')][_0xade1('0x2e')],function(_0x51d9e7){return{'name':_0x51d9e7[_0xade1('0x2f')],'type':_0x51d9e7[_0xade1('0x30')]['key']};});_0x1a1d17['model']=_['map'](_0x592920,_0xade1('0x29'));_0x1a1d17[_0xade1('0x31')]=_[_0xade1('0x32')](_0x4bf5cd[_0xade1('0x31')]);_0x1a1d17[_0xade1('0x33')]=_[_0xade1('0x34')](_0x1a1d17[_0xade1('0x35')],_0x1a1d17[_0xade1('0x31')]);_0x38dd9f[_0xade1('0x36')]=_['intersection'](_0x1a1d17[_0xade1('0x35')],qs[_0xade1('0x37')](_0x4bf5cd[_0xade1('0x31')]['fields']));_0x38dd9f[_0xade1('0x36')]=_0x38dd9f[_0xade1('0x36')][_0xade1('0x38')]?_0x38dd9f['attributes']:_0x1a1d17[_0xade1('0x35')];if(!_0x4bf5cd[_0xade1('0x31')][_0xade1('0x39')](_0xade1('0x3a'))){_0x38dd9f[_0xade1('0x1f')]=qs['limit'](_0x4bf5cd[_0xade1('0x31')][_0xade1('0x1f')]);_0x38dd9f[_0xade1('0x1e')]=qs['offset'](_0x4bf5cd[_0xade1('0x31')][_0xade1('0x1e')]);}_0x38dd9f[_0xade1('0x3b')]=qs[_0xade1('0x3c')](_0x4bf5cd[_0xade1('0x31')][_0xade1('0x3c')]);_0x38dd9f[_0xade1('0x3d')]=qs[_0xade1('0x33')](_[_0xade1('0x3e')](_0x4bf5cd[_0xade1('0x31')],_0x1a1d17[_0xade1('0x33')]),_0x592920);if(_0x4bf5cd[_0xade1('0x31')]['filter']){_0x38dd9f['where']=_[_0xade1('0x3f')](_0x38dd9f[_0xade1('0x3d')],{'$or':_[_0xade1('0x2c')](_0x592920,function(_0x23f9f8){if(_0x23f9f8['type']!==_0xade1('0x40')){var _0x551e4f={};_0x551e4f[_0x23f9f8['name']]={'$like':'%'+_0x4bf5cd[_0xade1('0x31')][_0xade1('0x41')]+'%'};return _0x551e4f;}})});}_0x38dd9f=_[_0xade1('0x3f')]({},_0x38dd9f,_0x4bf5cd['options']);var _0x3a6b18={'where':_0x38dd9f['where']};return db[_0xade1('0x2d')][_0xade1('0x42')](_0x3a6b18)[_0xade1('0x25')](function(_0x3cdffd){_0x59d64b['count']=_0x3cdffd;if(_0x4bf5cd['query'][_0xade1('0x43')]){_0x38dd9f[_0xade1('0x44')]=[{'all':!![]}];}return db[_0xade1('0x2d')][_0xade1('0x45')](_0x38dd9f);})[_0xade1('0x25')](function(_0x14b71e){_0x59d64b['rows']=_0x14b71e;return _0x59d64b;})['then'](respondWithFilteredResult(_0x582e5b,_0x38dd9f))[_0xade1('0x46')](handleError(_0x582e5b,null));};exports[_0xade1('0x47')]=function(_0x165997,_0x455ca0){var _0x414b61={'raw':!![],'where':{'id':_0x165997[_0xade1('0x48')]['id']}},_0xdefc8={};_0xdefc8[_0xade1('0x35')]=_[_0xade1('0x32')](db[_0xade1('0x2d')][_0xade1('0x2e')]);_0xdefc8[_0xade1('0x31')]=_[_0xade1('0x32')](_0x165997[_0xade1('0x31')]);_0xdefc8[_0xade1('0x33')]=_[_0xade1('0x34')](_0xdefc8['model'],_0xdefc8[_0xade1('0x31')]);_0x414b61['attributes']=_[_0xade1('0x34')](_0xdefc8[_0xade1('0x35')],qs[_0xade1('0x37')](_0x165997['query']['fields']));_0x414b61[_0xade1('0x36')]=_0x414b61[_0xade1('0x36')]['length']?_0x414b61[_0xade1('0x36')]:_0xdefc8[_0xade1('0x35')];if(_0x165997['query'][_0xade1('0x43')]){_0x414b61[_0xade1('0x44')]=[{'all':!![]}];}_0x414b61=_[_0xade1('0x3f')]({},_0x414b61,_0x165997['options']);return db[_0xade1('0x2d')]['find'](_0x414b61)[_0xade1('0x25')](handleEntityNotFound(_0x455ca0,null))[_0xade1('0x25')](respondWithResult(_0x455ca0,null))[_0xade1('0x46')](handleError(_0x455ca0,null));};exports[_0xade1('0x49')]=function(_0x1f9f26,_0x38198b){return db[_0xade1('0x2d')]['create'](_0x1f9f26[_0xade1('0x4a')],{})[_0xade1('0x25')](respondWithResult(_0x38198b,0xc9))['catch'](handleError(_0x38198b,null));};exports['update']=function(_0x15cf1e,_0x391e9e){if(_0x15cf1e[_0xade1('0x4a')]['id']){delete _0x15cf1e[_0xade1('0x4a')]['id'];}return db[_0xade1('0x2d')][_0xade1('0x4b')]({'where':{'id':_0x15cf1e[_0xade1('0x48')]['id']}})[_0xade1('0x25')](handleEntityNotFound(_0x391e9e,null))[_0xade1('0x25')](saveUpdates(_0x15cf1e['body'],null))['then'](respondWithResult(_0x391e9e,null))[_0xade1('0x46')](handleError(_0x391e9e,null));};exports[_0xade1('0x26')]=function(_0x23a213,_0x3ff5a1){return db[_0xade1('0x2d')]['find']({'where':{'id':_0x23a213['params']['id']}})[_0xade1('0x25')](handleEntityNotFound(_0x3ff5a1,null))[_0xade1('0x25')](removeEntity(_0x3ff5a1,null))[_0xade1('0x46')](handleError(_0x3ff5a1,null));}; \ No newline at end of file +var _0xa0b9=['rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','options','findAll','rows','catch','show','params','includeAll','include','create','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','SmsApplication'];(function(_0xe825c5,_0x634664){var _0x3e58c1=function(_0x20a6c7){while(--_0x20a6c7){_0xe825c5['push'](_0xe825c5['shift']());}};_0x3e58c1(++_0x634664);}(_0xa0b9,0xf1));var _0x9a0b=function(_0x492543,_0x5b98a4){_0x492543=_0x492543-0x0;var _0x11c12a=_0xa0b9[_0x492543];return _0x11c12a;};'use strict';var pdf=require(_0x9a0b('0x0'));var emlformat=require(_0x9a0b('0x1'));var rimraf=require(_0x9a0b('0x2'));var zipdir=require(_0x9a0b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9a0b('0x4'));var moment=require(_0x9a0b('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9a0b('0x6'));var path=require('path');var sox=require(_0x9a0b('0x7'));var csv=require(_0x9a0b('0x8'));var ejs=require(_0x9a0b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9a0b('0xa'));var crypto=require(_0x9a0b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9a0b('0xc'));var toCsv=require(_0x9a0b('0x8'));var querystring=require('querystring');var Papa=require(_0x9a0b('0xd'));var Redis=require(_0x9a0b('0xe'));var authService=require(_0x9a0b('0xf'));var qs=require(_0x9a0b('0x10'));var as=require(_0x9a0b('0x11'));var hardwareService=require(_0x9a0b('0x12'));var logger=require('../../config/logger')(_0x9a0b('0x13'));var utils=require('../../config/utils');var config=require(_0x9a0b('0x14'));var licenseUtil=require(_0x9a0b('0x15'));var db=require(_0x9a0b('0x16'))['db'];function respondWithStatusCode(_0xd94ccb,_0x421666){_0x421666=_0x421666||0xcc;return function(_0x4544ec){if(_0x4544ec){return _0xd94ccb[_0x9a0b('0x17')](_0x421666);}return _0xd94ccb[_0x9a0b('0x18')](_0x421666)[_0x9a0b('0x19')]();};}function respondWithResult(_0x441322,_0x5b6cea){_0x5b6cea=_0x5b6cea||0xc8;return function(_0x451d44){if(_0x451d44){return _0x441322[_0x9a0b('0x18')](_0x5b6cea)[_0x9a0b('0x1a')](_0x451d44);}};}function respondWithFilteredResult(_0x24e38b,_0x38626b){return function(_0x52ac86){if(_0x52ac86){var _0x1fd229=_0x52ac86[_0x9a0b('0x1b')],_0x1f923a=_0x38626b[_0x9a0b('0x1c')],_0xf48565=_0x38626b[_0x9a0b('0x1c')]+_0x38626b[_0x9a0b('0x1d')],_0x451acb;if(_0xf48565>=_0x1fd229){_0xf48565=_0x1fd229;_0x451acb=0xc8;}else{_0x451acb=0xce;}_0x24e38b[_0x9a0b('0x18')](_0x451acb);return _0x24e38b[_0x9a0b('0x1e')](_0x9a0b('0x1f'),_0x1f923a+'-'+_0xf48565+'/'+_0x1fd229)[_0x9a0b('0x1a')](_0x52ac86);}return null;};}function patchUpdates(_0x537696){return function(_0x37c63e){try{jsonpatch[_0x9a0b('0x20')](_0x37c63e,_0x537696,!![]);}catch(_0xdd612c){return BPromise[_0x9a0b('0x21')](_0xdd612c);}return _0x37c63e[_0x9a0b('0x22')]();};}function saveUpdates(_0x3cf731,_0x53ebe7){return function(_0x1df2bc){if(_0x1df2bc){return _0x1df2bc[_0x9a0b('0x23')](_0x3cf731)['then'](function(_0xd056ae){return _0xd056ae;});}return null;};}function removeEntity(_0x2fc1f7,_0x221856){return function(_0x1a08eb){if(_0x1a08eb){return _0x1a08eb[_0x9a0b('0x24')]()[_0x9a0b('0x25')](function(){_0x2fc1f7[_0x9a0b('0x18')](0xcc)[_0x9a0b('0x19')]();});}};}function handleEntityNotFound(_0x333cb6,_0x4db02d){return function(_0x9b4977){if(!_0x9b4977){_0x333cb6['sendStatus'](0x194);}return _0x9b4977;};}function handleError(_0x57a4cc,_0x1595eb){_0x1595eb=_0x1595eb||0x1f4;return function(_0x4a5fc0){logger[_0x9a0b('0x26')](_0x4a5fc0[_0x9a0b('0x27')]);if(_0x4a5fc0[_0x9a0b('0x28')]){delete _0x4a5fc0[_0x9a0b('0x28')];}_0x57a4cc[_0x9a0b('0x18')](_0x1595eb)['send'](_0x4a5fc0);};}exports[_0x9a0b('0x29')]=function(_0x4690a8,_0x3516ee){var _0x5aca6d={},_0x5a5110={},_0x2aa8b2={'count':0x0,'rows':[]};var _0x36a0fa=_['map'](db[_0x9a0b('0x2a')][_0x9a0b('0x2b')],function(_0x1b39f0){return{'name':_0x1b39f0[_0x9a0b('0x2c')],'type':_0x1b39f0['type'][_0x9a0b('0x2d')]};});_0x5a5110['model']=_[_0x9a0b('0x2e')](_0x36a0fa,'name');_0x5a5110[_0x9a0b('0x2f')]=_[_0x9a0b('0x30')](_0x4690a8[_0x9a0b('0x2f')]);_0x5a5110[_0x9a0b('0x31')]=_[_0x9a0b('0x32')](_0x5a5110[_0x9a0b('0x33')],_0x5a5110[_0x9a0b('0x2f')]);_0x5aca6d[_0x9a0b('0x34')]=_[_0x9a0b('0x32')](_0x5a5110[_0x9a0b('0x33')],qs['fields'](_0x4690a8[_0x9a0b('0x2f')][_0x9a0b('0x35')]));_0x5aca6d[_0x9a0b('0x34')]=_0x5aca6d['attributes'][_0x9a0b('0x36')]?_0x5aca6d[_0x9a0b('0x34')]:_0x5a5110[_0x9a0b('0x33')];if(!_0x4690a8[_0x9a0b('0x2f')][_0x9a0b('0x37')]('nolimit')){_0x5aca6d[_0x9a0b('0x1d')]=qs[_0x9a0b('0x1d')](_0x4690a8[_0x9a0b('0x2f')][_0x9a0b('0x1d')]);_0x5aca6d[_0x9a0b('0x1c')]=qs[_0x9a0b('0x1c')](_0x4690a8[_0x9a0b('0x2f')][_0x9a0b('0x1c')]);}_0x5aca6d['order']=qs[_0x9a0b('0x38')](_0x4690a8[_0x9a0b('0x2f')][_0x9a0b('0x38')]);_0x5aca6d['where']=qs['filters'](_['pick'](_0x4690a8[_0x9a0b('0x2f')],_0x5a5110[_0x9a0b('0x31')]),_0x36a0fa);if(_0x4690a8[_0x9a0b('0x2f')][_0x9a0b('0x39')]){_0x5aca6d[_0x9a0b('0x3a')]=_[_0x9a0b('0x3b')](_0x5aca6d['where'],{'$or':_[_0x9a0b('0x2e')](_0x36a0fa,function(_0x4d43f9){if(_0x4d43f9['type']!=='VIRTUAL'){var _0x5b27f8={};_0x5b27f8[_0x4d43f9[_0x9a0b('0x28')]]={'$like':'%'+_0x4690a8[_0x9a0b('0x2f')][_0x9a0b('0x39')]+'%'};return _0x5b27f8;}})});}_0x5aca6d=_[_0x9a0b('0x3b')]({},_0x5aca6d,_0x4690a8[_0x9a0b('0x3c')]);var _0x23e913={'where':_0x5aca6d[_0x9a0b('0x3a')]};return db[_0x9a0b('0x2a')][_0x9a0b('0x1b')](_0x23e913)[_0x9a0b('0x25')](function(_0x2cd7e2){_0x2aa8b2[_0x9a0b('0x1b')]=_0x2cd7e2;if(_0x4690a8[_0x9a0b('0x2f')]['includeAll']){_0x5aca6d['include']=[{'all':!![]}];}return db[_0x9a0b('0x2a')][_0x9a0b('0x3d')](_0x5aca6d);})[_0x9a0b('0x25')](function(_0x4ee43c){_0x2aa8b2[_0x9a0b('0x3e')]=_0x4ee43c;return _0x2aa8b2;})[_0x9a0b('0x25')](respondWithFilteredResult(_0x3516ee,_0x5aca6d))[_0x9a0b('0x3f')](handleError(_0x3516ee,null));};exports[_0x9a0b('0x40')]=function(_0x2ce4aa,_0x5b32a0){var _0x156045={'raw':!![],'where':{'id':_0x2ce4aa[_0x9a0b('0x41')]['id']}},_0x3ff3aa={};_0x3ff3aa[_0x9a0b('0x33')]=_[_0x9a0b('0x30')](db[_0x9a0b('0x2a')][_0x9a0b('0x2b')]);_0x3ff3aa[_0x9a0b('0x2f')]=_['keys'](_0x2ce4aa[_0x9a0b('0x2f')]);_0x3ff3aa['filters']=_['intersection'](_0x3ff3aa[_0x9a0b('0x33')],_0x3ff3aa[_0x9a0b('0x2f')]);_0x156045['attributes']=_[_0x9a0b('0x32')](_0x3ff3aa[_0x9a0b('0x33')],qs[_0x9a0b('0x35')](_0x2ce4aa[_0x9a0b('0x2f')][_0x9a0b('0x35')]));_0x156045[_0x9a0b('0x34')]=_0x156045[_0x9a0b('0x34')][_0x9a0b('0x36')]?_0x156045['attributes']:_0x3ff3aa[_0x9a0b('0x33')];if(_0x2ce4aa[_0x9a0b('0x2f')][_0x9a0b('0x42')]){_0x156045[_0x9a0b('0x43')]=[{'all':!![]}];}_0x156045=_[_0x9a0b('0x3b')]({},_0x156045,_0x2ce4aa[_0x9a0b('0x3c')]);return db['SmsApplication']['find'](_0x156045)[_0x9a0b('0x25')](handleEntityNotFound(_0x5b32a0,null))['then'](respondWithResult(_0x5b32a0,null))[_0x9a0b('0x3f')](handleError(_0x5b32a0,null));};exports[_0x9a0b('0x44')]=function(_0x5491e8,_0x2f156d){return db[_0x9a0b('0x2a')][_0x9a0b('0x44')](_0x5491e8[_0x9a0b('0x45')],{})[_0x9a0b('0x25')](respondWithResult(_0x2f156d,0xc9))[_0x9a0b('0x3f')](handleError(_0x2f156d,null));};exports[_0x9a0b('0x23')]=function(_0x4b6134,_0x1eecf1){if(_0x4b6134[_0x9a0b('0x45')]['id']){delete _0x4b6134[_0x9a0b('0x45')]['id'];}return db[_0x9a0b('0x2a')]['find']({'where':{'id':_0x4b6134[_0x9a0b('0x41')]['id']}})[_0x9a0b('0x25')](handleEntityNotFound(_0x1eecf1,null))[_0x9a0b('0x25')](saveUpdates(_0x4b6134[_0x9a0b('0x45')],null))[_0x9a0b('0x25')](respondWithResult(_0x1eecf1,null))[_0x9a0b('0x3f')](handleError(_0x1eecf1,null));};exports['destroy']=function(_0x5f2f45,_0x1000db){return db[_0x9a0b('0x2a')][_0x9a0b('0x46')]({'where':{'id':_0x5f2f45[_0x9a0b('0x41')]['id']}})[_0x9a0b('0x25')](handleEntityNotFound(_0x1000db,null))[_0x9a0b('0x25')](removeEntity(_0x1000db,null))['catch'](handleError(_0x1000db,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 2ae2646..de4d5d5 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 _0x0739=['moment','request-promise','path','../../config/environment','exports','SmsApplication','sms_applications','utf8mb4','util','api'];(function(_0x944797,_0x147b4c){var _0x1908ca=function(_0x5bde5f){while(--_0x5bde5f){_0x944797['push'](_0x944797['shift']());}};_0x1908ca(++_0x147b4c);}(_0x0739,0x17a));var _0x9073=function(_0x428a85,_0x1296c3){_0x428a85=_0x428a85-0x0;var _0x179299=_0x0739[_0x428a85];return _0x179299;};'use strict';var _=require('lodash');var util=require(_0x9073('0x0'));var logger=require('../../config/logger')(_0x9073('0x1'));var moment=require(_0x9073('0x2'));var BPromise=require('bluebird');var rp=require(_0x9073('0x3'));var fs=require('fs');var path=require(_0x9073('0x4'));var rimraf=require('rimraf');var config=require(_0x9073('0x5'));var attributes=require('./smsApplication.attributes');module[_0x9073('0x6')]=function(_0x428436,_0x204a0a){return _0x428436['define'](_0x9073('0x7'),attributes,{'tableName':_0x9073('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9073('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x305e=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications'];(function(_0x48d218,_0x38ae7b){var _0x5d86c7=function(_0x362ae9){while(--_0x362ae9){_0x48d218['push'](_0x48d218['shift']());}};_0x5d86c7(++_0x38ae7b);}(_0x305e,0x1d2));var _0xe305=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x305e[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xe305('0x0'));var util=require(_0xe305('0x1'));var logger=require(_0xe305('0x2'))('api');var moment=require(_0xe305('0x3'));var BPromise=require(_0xe305('0x4'));var rp=require(_0xe305('0x5'));var fs=require('fs');var path=require(_0xe305('0x6'));var rimraf=require(_0xe305('0x7'));var config=require(_0xe305('0x8'));var attributes=require(_0xe305('0x9'));module[_0xe305('0xa')]=function(_0x260033,_0x3e9096){return _0x260033[_0xe305('0xb')](_0xe305('0xc'),attributes,{'tableName':_0xe305('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe305('0xe'),'collate':_0xe305('0xf')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 755bc91..09dfc0e 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 _0xd2bb=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x3415bf,_0x243805){var _0x30b7c1=function(_0xe4762){while(--_0xe4762){_0x3415bf['push'](_0x3415bf['shift']());}};_0x30b7c1(++_0x243805);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x4fc266,_0x1480bf){_0x4fc266=_0x4fc266-0x0;var _0x12c575=_0xd2bb[_0x4fc266];return _0x12c575;};'use strict';var _=require('lodash');var util=require(_0xbd2b('0x0'));var moment=require('moment');var BPromise=require(_0xbd2b('0x1'));var rs=require(_0xbd2b('0x2'));var fs=require('fs');var Redis=require(_0xbd2b('0x3'));var db=require(_0xbd2b('0x4'))['db'];var utils=require(_0xbd2b('0x5'));var logger=require(_0xbd2b('0x6'))('rpc');var config=require(_0xbd2b('0x7'));var jayson=require(_0xbd2b('0x8'));var client=jayson[_0xbd2b('0x9')][_0xbd2b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x296d68,_0x3751df,_0x42fee1){return new BPromise(function(_0x30cd3f,_0x259bca){return client[_0xbd2b('0xb')](_0x296d68,_0x42fee1)['then'](function(_0x172aef){logger['info'](_0xbd2b('0xc'),_0x3751df,_0xbd2b('0xd'));logger['debug'](_0xbd2b('0xe'),_0x3751df,_0xbd2b('0xd'),JSON[_0xbd2b('0xf')](_0x172aef));if(_0x172aef[_0xbd2b('0x10')]){if(_0x172aef[_0xbd2b('0x10')][_0xbd2b('0x11')]===0x1f4){logger[_0xbd2b('0x10')](_0xbd2b('0xc'),_0x3751df,_0x172aef['error'][_0xbd2b('0x12')]);return _0x259bca(_0x172aef[_0xbd2b('0x10')][_0xbd2b('0x12')]);}logger[_0xbd2b('0x10')](_0xbd2b('0xc'),_0x3751df,_0x172aef['error'][_0xbd2b('0x12')]);return _0x30cd3f(_0x172aef[_0xbd2b('0x10')][_0xbd2b('0x12')]);}else{logger[_0xbd2b('0x13')](_0xbd2b('0xc'),_0x3751df,_0xbd2b('0xd'));_0x30cd3f(_0x172aef[_0xbd2b('0x14')][_0xbd2b('0x12')]);}})[_0xbd2b('0x15')](function(_0x571596){logger[_0xbd2b('0x10')](_0xbd2b('0xc'),_0x3751df,_0x571596);_0x259bca(_0x571596);});});} \ No newline at end of file +var _0x7cab=['jayson/promise','client','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x5d3989,_0x58af48){var _0x3354d3=function(_0x487337){while(--_0x487337){_0x5d3989['push'](_0x5d3989['shift']());}};_0x3354d3(++_0x58af48);}(_0x7cab,0x91));var _0xb7ca=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0x7cab[_0x154192];return _0x3c2792;};'use strict';var _=require(_0xb7ca('0x0'));var util=require(_0xb7ca('0x1'));var moment=require(_0xb7ca('0x2'));var BPromise=require('bluebird');var rs=require(_0xb7ca('0x3'));var fs=require('fs');var Redis=require(_0xb7ca('0x4'));var db=require(_0xb7ca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb7ca('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb7ca('0x7'));var client=jayson[_0xb7ca('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42656e,_0x5e64bf,_0x16f21b){return new BPromise(function(_0x462848,_0x45ccae){return client[_0xb7ca('0x9')](_0x42656e,_0x16f21b)[_0xb7ca('0xa')](function(_0x232276){logger['info'](_0xb7ca('0xb'),_0x5e64bf,_0xb7ca('0xc'));logger[_0xb7ca('0xd')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x5e64bf,_0xb7ca('0xc'),JSON[_0xb7ca('0xe')](_0x232276));if(_0x232276['error']){if(_0x232276[_0xb7ca('0xf')][_0xb7ca('0x10')]===0x1f4){logger[_0xb7ca('0xf')](_0xb7ca('0xb'),_0x5e64bf,_0x232276[_0xb7ca('0xf')]['message']);return _0x45ccae(_0x232276['error']['message']);}logger[_0xb7ca('0xf')](_0xb7ca('0xb'),_0x5e64bf,_0x232276[_0xb7ca('0xf')][_0xb7ca('0x11')]);return _0x462848(_0x232276[_0xb7ca('0xf')][_0xb7ca('0x11')]);}else{logger['info'](_0xb7ca('0xb'),_0x5e64bf,_0xb7ca('0xc'));_0x462848(_0x232276[_0xb7ca('0x12')][_0xb7ca('0x11')]);}})['catch'](function(_0x4e9354){logger['error'](_0xb7ca('0xb'),_0x5e64bf,_0x4e9354);_0x45ccae(_0x4e9354);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 4aba828..36a6f97 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 _0x0d8d=['smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','./smsInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','/:id/tags','tracked','sms'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0d8d,0x151));var _0xd0d8=function(_0x449864,_0x49b5a2){_0x449864=_0x449864-0x0;var _0x406fff=_0x0d8d[_0x449864];return _0x406fff;};'use strict';var multer=require(_0xd0d8('0x0'));var util=require(_0xd0d8('0x1'));var path=require(_0xd0d8('0x2'));var timeout=require(_0xd0d8('0x3'));var express=require(_0xd0d8('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd0d8('0x5'));var config=require('../../config/environment');var controller=require(_0xd0d8('0x6'));router['get']('/',auth[_0xd0d8('0x7')](),controller[_0xd0d8('0x8')]);router[_0xd0d8('0x9')](_0xd0d8('0xa'),auth[_0xd0d8('0x7')](),controller[_0xd0d8('0xb')]);router[_0xd0d8('0x9')](_0xd0d8('0xc'),auth[_0xd0d8('0x7')](),controller[_0xd0d8('0xd')]);router[_0xd0d8('0x9')](_0xd0d8('0xe'),auth[_0xd0d8('0x7')](),controller[_0xd0d8('0xf')]);router['get'](_0xd0d8('0x10'),auth[_0xd0d8('0x7')](),controller[_0xd0d8('0x11')]);router['post']('/',auth[_0xd0d8('0x7')](),controller[_0xd0d8('0x12')]);router[_0xd0d8('0x13')](_0xd0d8('0xe'),auth[_0xd0d8('0x7')](),controller['addMessage']);router[_0xd0d8('0x13')](_0xd0d8('0x14'),auth['isAuthenticated'](),interaction[_0xd0d8('0x15')](_0xd0d8('0x16'),_0xd0d8('0x17')),controller[_0xd0d8('0x18')]);router[_0xd0d8('0x19')](_0xd0d8('0xc'),auth[_0xd0d8('0x7')](),interaction['tracked'](_0xd0d8('0x16'),_0xd0d8('0x1a')),controller[_0xd0d8('0x1b')]);router[_0xd0d8('0x1c')]('/:id',auth[_0xd0d8('0x7')](),interaction[_0xd0d8('0x15')](_0xd0d8('0x16'),'smsinteraction:destroy'),controller[_0xd0d8('0x1d')]);router[_0xd0d8('0x1c')](_0xd0d8('0x14'),auth[_0xd0d8('0x7')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xb99e=['/:id/download','post','create','addMessage','sms','addTags','put','smsinteraction:update','update','delete','tracked','smsinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages'];(function(_0x800d80,_0x5c8f16){var _0x42e7ff=function(_0x111661){while(--_0x111661){_0x800d80['push'](_0x800d80['shift']());}};_0x42e7ff(++_0x5c8f16);}(_0xb99e,0x73));var _0xeb99=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb99e[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xeb99('0x0'));var util=require(_0xeb99('0x1'));var path=require(_0xeb99('0x2'));var timeout=require(_0xeb99('0x3'));var express=require(_0xeb99('0x4'));var router=express[_0xeb99('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xeb99('0x6'));var config=require(_0xeb99('0x7'));var controller=require(_0xeb99('0x8'));router[_0xeb99('0x9')]('/',auth[_0xeb99('0xa')](),controller[_0xeb99('0xb')]);router[_0xeb99('0x9')](_0xeb99('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xeb99('0xd'),auth[_0xeb99('0xa')](),controller[_0xeb99('0xe')]);router[_0xeb99('0x9')](_0xeb99('0xf'),auth['isAuthenticated'](),controller[_0xeb99('0x10')]);router[_0xeb99('0x9')](_0xeb99('0x11'),auth['isAuthenticated'](),controller['download']);router[_0xeb99('0x12')]('/',auth['isAuthenticated'](),controller[_0xeb99('0x13')]);router[_0xeb99('0x12')](_0xeb99('0xf'),auth[_0xeb99('0xa')](),controller[_0xeb99('0x14')]);router[_0xeb99('0x12')]('/:id/tags',auth[_0xeb99('0xa')](),interaction['tracked'](_0xeb99('0x15'),'smsinteraction:addtags'),controller[_0xeb99('0x16')]);router[_0xeb99('0x17')](_0xeb99('0xd'),auth[_0xeb99('0xa')](),interaction['tracked'](_0xeb99('0x15'),_0xeb99('0x18')),controller[_0xeb99('0x19')]);router[_0xeb99('0x1a')](_0xeb99('0xd'),auth[_0xeb99('0xa')](),interaction[_0xeb99('0x1b')](_0xeb99('0x15'),_0xeb99('0x1c')),controller[_0xeb99('0x1d')]);router['delete'](_0xeb99('0x1e'),auth[_0xeb99('0xa')](),controller[_0xeb99('0x1f')]);module[_0xeb99('0x20')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 13ec92b..db5ccc2 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 _0xf718=['exports','BOOLEAN','DATE','STRING','ENUM','out','moment'];(function(_0x779a2e,_0x3f0b6b){var _0x59982e=function(_0x232313){while(--_0x232313){_0x779a2e['push'](_0x779a2e['shift']());}};_0x59982e(++_0x3f0b6b);}(_0xf718,0xdf));var _0x8f71=function(_0x413e52,_0x430a92){_0x413e52=_0x413e52-0x0;var _0x3411c7=_0xf718[_0x413e52];return _0x3411c7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8f71('0x0'));module[_0x8f71('0x1')]={'closed':{'type':Sequelize[_0x8f71('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8f71('0x3')]},'disposition':{'type':Sequelize[_0x8f71('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8f71('0x4')]},'note':{'type':Sequelize[_0x8f71('0x4')]},'phone':{'type':Sequelize[_0x8f71('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x8f71('0x5')]('in',_0x8f71('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x8f71('0x5')]('in',_0x8f71('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x4fa9=['STRING','DATE','out','ENUM','sequelize','exports'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0x4fa9,0xdc));var _0x94fa=function(_0x3d3177,_0x37b376){_0x3d3177=_0x3d3177-0x0;var _0x3e3cf3=_0x4fa9[_0x3d3177];return _0x3e3cf3;};'use strict';var Sequelize=require(_0x94fa('0x0'));var moment=require('moment');module[_0x94fa('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x94fa('0x2')]},'thirdDisposition':{'type':Sequelize[_0x94fa('0x2')]},'note':{'type':Sequelize[_0x94fa('0x2')]},'phone':{'type':Sequelize[_0x94fa('0x2')]},'read1stAt':{'type':Sequelize[_0x94fa('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x94fa('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x94fa('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x94fa('0x5')]('in',_0x94fa('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 8d626e7..9a5dd8d 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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var 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 5580cf3..79b96d3 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 _0x4b1f=['emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','findAll','length'];(function(_0x1b8d87,_0x4168fb){var _0x182b74=function(_0x12b570){while(--_0x12b570){_0x1b8d87['push'](_0x1b8d87['shift']());}};_0x182b74(++_0x4168fb);}(_0x4b1f,0x195));var _0xf4b1=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x4b1f[_0x2dadb9];return _0x2f0097;};'use strict';var EventEmitter=require(_0xf4b1('0x0'));var SmsInteraction=require(_0xf4b1('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xf4b1('0x1'))['db'][_0xf4b1('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xf4b1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf4b1('0x4'),'afterDestroy':_0xf4b1('0x5')};function emitEvent(_0x31acb0){return function(_0x51a07e,_0x5f26a3,_0x1ab96b){_0x51a07e[_0xf4b1('0x6')]({'attributes':['id'],'raw':!![]})[_0xf4b1('0x7')](function(_0x3b9c78){_0x51a07e[_0xf4b1('0x8')]('Users',_0x3b9c78['map'](function(_0x4bcd22){return{'id':_0x4bcd22['id']};}));return SmsMessage[_0xf4b1('0x9')]({'where':{'SmsInteractionId':_0x51a07e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xb243d6){_0x51a07e['setDataValue']('unreadMessages',_0xb243d6[_0xf4b1('0xa')]);SmsInteractionEvents[_0xf4b1('0xb')](_0x31acb0+':'+_0x51a07e['id'],_0x51a07e);SmsInteractionEvents[_0xf4b1('0xb')](_0x31acb0,_0x51a07e);_0x1ab96b(null);})[_0xf4b1('0xc')](_0x1ab96b(null));};}for(var e in events){if(events[_0xf4b1('0xd')](e)){var event=events[e];SmsInteraction[_0xf4b1('0xe')](e,emitEvent(event));}}module[_0xf4b1('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x6b8f=['length','emit','hook','exports','../../mysqldb','save','update','getUsers','then','setDataValue','unreadMessages'];(function(_0x39a732,_0x275cc2){var _0x30f97c=function(_0x16bc51){while(--_0x16bc51){_0x39a732['push'](_0x39a732['shift']());}};_0x30f97c(++_0x275cc2);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x5e9795,_0x37a5ad){_0x5e9795=_0x5e9795-0x0;var _0x292f43=_0x6b8f[_0x5e9795];return _0x292f43;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xf6b8('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0xf6b8('0x0'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf6b8('0x1'),'afterUpdate':_0xf6b8('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2b5ca9){return function(_0xf25536,_0x347a0b,_0x549eac){_0xf25536[_0xf6b8('0x3')]({'attributes':['id'],'raw':!![]})[_0xf6b8('0x4')](function(_0x446336){_0xf25536[_0xf6b8('0x5')]('Users',_0x446336['map'](function(_0x33e9a0){return{'id':_0x33e9a0['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0xf25536['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf6b8('0x4')](function(_0x7ac5fd){_0xf25536[_0xf6b8('0x5')](_0xf6b8('0x6'),_0x7ac5fd[_0xf6b8('0x7')]);SmsInteractionEvents[_0xf6b8('0x8')](_0x2b5ca9+':'+_0xf25536['id'],_0xf25536);SmsInteractionEvents['emit'](_0x2b5ca9,_0xf25536);_0x549eac(null);})['catch'](_0x549eac(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xf6b8('0x9')](e,emitEvent(event));}}module[_0xf6b8('0xa')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 93787f2..509a434 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 _0x5a6a=['SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./smsInteraction.attributes','exports','define'];(function(_0x376c9f,_0x4c479a){var _0x54f7fa=function(_0x3cb746){while(--_0x3cb746){_0x376c9f['push'](_0x376c9f['shift']());}};_0x54f7fa(++_0x4c479a);}(_0x5a6a,0x97));var _0xa5a6=function(_0xb08a7e,_0x5d00f8){_0xb08a7e=_0xb08a7e-0x0;var _0x11ea08=_0x5a6a[_0xb08a7e];return _0x11ea08;};'use strict';var _=require(_0xa5a6('0x0'));var util=require(_0xa5a6('0x1'));var logger=require(_0xa5a6('0x2'))('api');var moment=require(_0xa5a6('0x3'));var BPromise=require(_0xa5a6('0x4'));var rp=require(_0xa5a6('0x5'));var fs=require('fs');var path=require(_0xa5a6('0x6'));var rimraf=require('rimraf');var config=require(_0xa5a6('0x7'));var attributes=require(_0xa5a6('0x8'));module[_0xa5a6('0x9')]=function(_0x15ff4b,_0x268c3f){return _0x15ff4b[_0xa5a6('0xa')](_0xa5a6('0xb'),attributes,{'tableName':_0xa5a6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b6273,_0x7e85e5,_0x46a9e5){if(_0x4b6273[_0xa5a6('0xd')](_0xa5a6('0xe'))){_0x4b6273[_0xa5a6('0xf')]=moment()[_0xa5a6('0x10')](_0xa5a6('0x11'));}_0x46a9e5(null,_0x4b6273);}}});}; \ No newline at end of file +var _0xec54=['path','../../config/environment','define','SmsInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','moment','bluebird','request-promise'];(function(_0x1e273d,_0x2ecdf1){var _0x5e1418=function(_0x8f045e){while(--_0x8f045e){_0x1e273d['push'](_0x1e273d['shift']());}};_0x5e1418(++_0x2ecdf1);}(_0xec54,0x134));var _0x4ec5=function(_0x38198f,_0x1a93f6){_0x38198f=_0x38198f-0x0;var _0x2b764d=_0xec54[_0x38198f];return _0x2b764d;};'use strict';var _=require('lodash');var util=require(_0x4ec5('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x4ec5('0x1'));var BPromise=require(_0x4ec5('0x2'));var rp=require(_0x4ec5('0x3'));var fs=require('fs');var path=require(_0x4ec5('0x4'));var rimraf=require('rimraf');var config=require(_0x4ec5('0x5'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x3d75d3,_0x30263b){return _0x3d75d3[_0x4ec5('0x6')](_0x4ec5('0x7'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3acb99,_0x5e882a,_0x4653bb){if(_0x3acb99[_0x4ec5('0x8')](_0x4ec5('0x9'))){_0x3acb99[_0x4ec5('0xa')]=moment()[_0x4ec5('0xb')](_0x4ec5('0xc'));}_0x4653bb(null,_0x3acb99);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index bc7d4ab..118027a 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 _0xeaac=['AddTags','debug','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./smsInteraction.socket','register','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','attributes','then','find','where','addTags','spread'];(function(_0x32b328,_0x193941){var _0x2f2373=function(_0x5b80af){while(--_0x5b80af){_0x32b328['push'](_0x32b328['shift']());}};_0x2f2373(++_0x193941);}(_0xeaac,0x1a4));var _0xceaa=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xeaac[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xceaa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xceaa('0x1'));var rs=require(_0xceaa('0x2'));var fs=require('fs');var Redis=require(_0xceaa('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xceaa('0x4'));var logger=require(_0xceaa('0x5'))('rpc');var config=require(_0xceaa('0x6'));var jayson=require(_0xceaa('0x7'));var client=jayson[_0xceaa('0x8')][_0xceaa('0x9')]({'port':0x232a});config['redis']=_[_0xceaa('0xa')](config[_0xceaa('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xceaa('0xc'))(new Redis(config[_0xceaa('0xb')]));require(_0xceaa('0xd'))[_0xceaa('0xe')](socket);function respondWithRpcPromise(_0x1ab902,_0x38b263,_0x1dc79b){return new BPromise(function(_0x2e163b,_0x2e78ee){return client['request'](_0x1ab902,_0x1dc79b)['then'](function(_0xe49702){logger[_0xceaa('0xf')](_0xceaa('0x10'),_0x38b263,_0xceaa('0x11'));logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x38b263,_0xceaa('0x11'),JSON[_0xceaa('0x12')](_0xe49702));if(_0xe49702[_0xceaa('0x13')]){if(_0xe49702[_0xceaa('0x13')][_0xceaa('0x14')]===0x1f4){logger[_0xceaa('0x13')](_0xceaa('0x10'),_0x38b263,_0xe49702[_0xceaa('0x13')][_0xceaa('0x15')]);return _0x2e78ee(_0xe49702[_0xceaa('0x13')][_0xceaa('0x15')]);}logger[_0xceaa('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x38b263,_0xe49702['error']['message']);return _0x2e163b(_0xe49702[_0xceaa('0x13')][_0xceaa('0x15')]);}else{logger[_0xceaa('0xf')]('SmsInteraction,\x20%s,\x20%s',_0x38b263,_0xceaa('0x11'));_0x2e163b(_0xe49702[_0xceaa('0x16')][_0xceaa('0x15')]);}})[_0xceaa('0x17')](function(_0x4161b4){logger[_0xceaa('0x13')](_0xceaa('0x10'),_0x38b263,_0x4161b4);_0x2e78ee(_0x4161b4);});});}exports[_0xceaa('0x18')]=function(_0x46bbc2){var _0x42d53a=this;return new Promise(function(_0x20af7f,_0x42d80){return db[_0xceaa('0x19')][_0xceaa('0x1a')](_0x46bbc2[_0xceaa('0x1b')],{'raw':_0x46bbc2[_0xceaa('0x1c')]?_0x46bbc2[_0xceaa('0x1c')][_0xceaa('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46bbc2[_0xceaa('0x1c')]?_0x46bbc2['options']['where']||null:null,'attributes':_0x46bbc2[_0xceaa('0x1c')]?_0x46bbc2['options'][_0xceaa('0x1e')]||null:null,'limit':_0x46bbc2[_0xceaa('0x1c')]?_0x46bbc2['options']['limit']||null:null})[_0xceaa('0x1f')](function(_0x56deb7){logger[_0xceaa('0xf')](_0xceaa('0x18'),_0x46bbc2);logger['debug'](_0xceaa('0x18'),_0x46bbc2,JSON[_0xceaa('0x12')](_0x56deb7));_0x20af7f(_0x56deb7);})[_0xceaa('0x17')](function(_0x30efd0){logger[_0xceaa('0x13')](_0xceaa('0x18'),_0x30efd0['message'],_0x46bbc2);_0x42d80(_0x42d53a[_0xceaa('0x13')](0x1f4,_0x30efd0['message']));});});};exports['AddTagsToSmsInteraction']=function(_0xba9604){return new Promise(function(_0x1455c7,_0x1113dc){return db['SmsInteraction'][_0xceaa('0x20')]({'where':_0xba9604[_0xceaa('0x1c')]?_0xba9604[_0xceaa('0x1c')][_0xceaa('0x21')]||null:null})[_0xceaa('0x1f')](function(_0x2653e){if(_0x2653e){return _0x2653e[_0xceaa('0x22')](_0xba9604[_0xceaa('0x1b')]['ids'],_['omit'](_0xba9604[_0xceaa('0x1b')],['ids','id'])||{});}})[_0xceaa('0x23')](function(_0x20e14f){logger['info'](_0xceaa('0x24'),_0xba9604);logger[_0xceaa('0x25')]('AddTags',_0xba9604,JSON[_0xceaa('0x12')](_0x20e14f));_0x1455c7(_0x20e14f);})[_0xceaa('0x17')](function(_0x5d0be1){logger['error'](_0xceaa('0x24'),_0x5d0be1['message'],_0xba9604);_0x1113dc(_this[_0xceaa('0x13')](0x1f4,_0x5d0be1['message']));});});}; \ No newline at end of file +var _0x7ce0=['UpdateSmsInteraction','SmsInteraction','body','options','raw','attributes','limit','AddTagsToSmsInteraction','find','where','ids','omit','spread','AddTags','debug','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x5bfdc4,_0x22165b){var _0x17f547=function(_0x111c59){while(--_0x111c59){_0x5bfdc4['push'](_0x5bfdc4['shift']());}};_0x17f547(++_0x22165b);}(_0x7ce0,0xa7));var _0x07ce=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x7ce0[_0x53cf8e];return _0x459197;};'use strict';var _=require(_0x07ce('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x07ce('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x07ce('0x2'));var db=require(_0x07ce('0x3'))['db'];var utils=require(_0x07ce('0x4'));var logger=require(_0x07ce('0x5'))('rpc');var config=require(_0x07ce('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x07ce('0x7')]({'port':0x232a});config[_0x07ce('0x8')]=_[_0x07ce('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x07ce('0xa'))[_0x07ce('0xb')](socket);function respondWithRpcPromise(_0x1e8da1,_0x3b8719,_0x5dc0e8){return new BPromise(function(_0x56d819,_0x530079){return client[_0x07ce('0xc')](_0x1e8da1,_0x5dc0e8)[_0x07ce('0xd')](function(_0x379b4a){logger[_0x07ce('0xe')](_0x07ce('0xf'),_0x3b8719,_0x07ce('0x10'));logger['debug'](_0x07ce('0x11'),_0x3b8719,_0x07ce('0x10'),JSON[_0x07ce('0x12')](_0x379b4a));if(_0x379b4a[_0x07ce('0x13')]){if(_0x379b4a[_0x07ce('0x13')][_0x07ce('0x14')]===0x1f4){logger[_0x07ce('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x3b8719,_0x379b4a[_0x07ce('0x13')][_0x07ce('0x15')]);return _0x530079(_0x379b4a[_0x07ce('0x13')][_0x07ce('0x15')]);}logger['error'](_0x07ce('0xf'),_0x3b8719,_0x379b4a[_0x07ce('0x13')][_0x07ce('0x15')]);return _0x56d819(_0x379b4a[_0x07ce('0x13')][_0x07ce('0x15')]);}else{logger[_0x07ce('0xe')](_0x07ce('0xf'),_0x3b8719,_0x07ce('0x10'));_0x56d819(_0x379b4a['result'][_0x07ce('0x15')]);}})[_0x07ce('0x16')](function(_0x51fadc){logger['error'](_0x07ce('0xf'),_0x3b8719,_0x51fadc);_0x530079(_0x51fadc);});});}exports[_0x07ce('0x17')]=function(_0x39ae42){var _0x41dea6=this;return new Promise(function(_0x284de8,_0x4c24ba){return db[_0x07ce('0x18')]['update'](_0x39ae42[_0x07ce('0x19')],{'raw':_0x39ae42['options']?_0x39ae42[_0x07ce('0x1a')][_0x07ce('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39ae42['options']?_0x39ae42[_0x07ce('0x1a')]['where']||null:null,'attributes':_0x39ae42[_0x07ce('0x1a')]?_0x39ae42[_0x07ce('0x1a')][_0x07ce('0x1c')]||null:null,'limit':_0x39ae42[_0x07ce('0x1a')]?_0x39ae42[_0x07ce('0x1a')][_0x07ce('0x1d')]||null:null})['then'](function(_0x1e9072){logger[_0x07ce('0xe')](_0x07ce('0x17'),_0x39ae42);logger['debug']('UpdateSmsInteraction',_0x39ae42,JSON[_0x07ce('0x12')](_0x1e9072));_0x284de8(_0x1e9072);})['catch'](function(_0x1036cf){logger[_0x07ce('0x13')]('UpdateSmsInteraction',_0x1036cf['message'],_0x39ae42);_0x4c24ba(_0x41dea6[_0x07ce('0x13')](0x1f4,_0x1036cf['message']));});});};exports[_0x07ce('0x1e')]=function(_0x963cf5){return new Promise(function(_0x5d5723,_0x1b9f00){return db[_0x07ce('0x18')][_0x07ce('0x1f')]({'where':_0x963cf5['options']?_0x963cf5['options'][_0x07ce('0x20')]||null:null})[_0x07ce('0xd')](function(_0x37a0d7){if(_0x37a0d7){return _0x37a0d7['addTags'](_0x963cf5[_0x07ce('0x19')][_0x07ce('0x21')],_[_0x07ce('0x22')](_0x963cf5[_0x07ce('0x19')],[_0x07ce('0x21'),'id'])||{});}})[_0x07ce('0x23')](function(_0x10a8ab){logger[_0x07ce('0xe')](_0x07ce('0x24'),_0x963cf5);logger[_0x07ce('0x25')](_0x07ce('0x24'),_0x963cf5,JSON[_0x07ce('0x12')](_0x10a8ab));_0x5d5723(_0x10a8ab);})['catch'](function(_0x7cbdfb){logger['error'](_0x07ce('0x24'),_0x7cbdfb['message'],_0x963cf5);_0x1b9f00(_this[_0x07ce('0x13')](0x1f4,_0x7cbdfb[_0x07ce('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 45f80c6..44b77a2 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 _0x0b0e=['smsInteraction:','./smsInteraction.events','remove','emit','removeListener','register'];(function(_0x5c212a,_0x28e788){var _0x21b2e0=function(_0x516294){while(--_0x516294){_0x5c212a['push'](_0x5c212a['shift']());}};_0x21b2e0(++_0x28e788);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5a7dd3,_0x26b7cf){_0x5a7dd3=_0x5a7dd3-0x0;var _0x2f4d07=_0x0b0e[_0x5a7dd3];return _0x2f4d07;};'use strict';var SmsInteractionEvents=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(){SmsInteractionEvents[_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);SmsInteractionEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file +var _0x757a=['save','remove','emit','removeListener','register','smsInteraction:'];(function(_0x7464aa,_0x1fd3fd){var _0x4f99af=function(_0x813933){while(--_0x813933){_0x7464aa['push'](_0x7464aa['shift']());}};_0x4f99af(++_0x1fd3fd);}(_0x757a,0xde));var _0xa757=function(_0x5d6bdd,_0x39c93a){_0x5d6bdd=_0x5d6bdd-0x0;var _0xe981b8=_0x757a[_0x5d6bdd];return _0xe981b8;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xa757('0x0'),_0xa757('0x1'),'update'];function createListener(_0x5c03c3,_0x5709ed){return function(_0x32be3b){_0x5709ed[_0xa757('0x2')](_0x5c03c3,_0x32be3b);};}function removeListener(_0x1c2932,_0x453d07){return function(){SmsInteractionEvents[_0xa757('0x3')](_0x1c2932,_0x453d07);};}exports[_0xa757('0x4')]=function(_0x5edca8){for(var _0xae0e7c=0x0,_0x4343b6=events['length'];_0xae0e7c<_0x4343b6;_0xae0e7c++){var _0x2930fa=events[_0xae0e7c];var _0x2f7793=createListener(_0xa757('0x5')+_0x2930fa,_0x5edca8);SmsInteractionEvents['on'](_0x2930fa,_0x2f7793);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index bd33d4e..6b35add 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 _0x73d3=['/describe','/:id','post','smsmessage:create','create','/:id/status','status','put','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0x73d3,0x19d));var _0x373d=function(_0x1df4b0,_0x31fa0d){_0x1df4b0=_0x1df4b0-0x0;var _0x208b72=_0x73d3[_0x1df4b0];return _0x208b72;};'use strict';var multer=require(_0x373d('0x0'));var util=require(_0x373d('0x1'));var path=require(_0x373d('0x2'));var timeout=require(_0x373d('0x3'));var express=require(_0x373d('0x4'));var router=express[_0x373d('0x5')]();var auth=require(_0x373d('0x6'));var interaction=require(_0x373d('0x7'));var config=require(_0x373d('0x8'));var controller=require(_0x373d('0x9'));router[_0x373d('0xa')]('/',auth[_0x373d('0xb')](),controller['index']);router[_0x373d('0xa')](_0x373d('0xc'),auth[_0x373d('0xb')](),controller['describe']);router['get'](_0x373d('0xd'),auth[_0x373d('0xb')](),controller['show']);router[_0x373d('0xe')]('/',auth[_0x373d('0xb')](),interaction['tracked']('sms',_0x373d('0xf')),controller[_0x373d('0x10')]);router[_0x373d('0xe')](_0x373d('0x11'),controller[_0x373d('0x12')]);router['put'](_0x373d('0xd'),auth[_0x373d('0xb')](),controller['update']);router[_0x373d('0x13')]('/:id/accept',auth[_0x373d('0xb')](),controller['accept']);router[_0x373d('0x13')](_0x373d('0x14'),auth['isAuthenticated'](),controller[_0x373d('0x15')]);router[_0x373d('0x16')](_0x373d('0xd'),auth['isAuthenticated'](),controller[_0x373d('0x17')]);module[_0x373d('0x18')]=router; \ No newline at end of file +var _0xf673=['sms','create','/:id/status','put','update','/:id/accept','/:id/reject','reject','delete','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','tracked'];(function(_0x20bc10,_0x35bed9){var _0x3bd5ce=function(_0x8d1e4c){while(--_0x8d1e4c){_0x20bc10['push'](_0x20bc10['shift']());}};_0x3bd5ce(++_0x35bed9);}(_0xf673,0x111));var _0x3f67=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0xf673[_0x9e0cb3];return _0x5926b7;};'use strict';var multer=require(_0x3f67('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3f67('0x1'));var express=require(_0x3f67('0x2'));var router=express[_0x3f67('0x3')]();var auth=require(_0x3f67('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3f67('0x5'));var controller=require(_0x3f67('0x6'));router[_0x3f67('0x7')]('/',auth[_0x3f67('0x8')](),controller[_0x3f67('0x9')]);router[_0x3f67('0x7')](_0x3f67('0xa'),auth[_0x3f67('0x8')](),controller[_0x3f67('0xb')]);router['get'](_0x3f67('0xc'),auth[_0x3f67('0x8')](),controller[_0x3f67('0xd')]);router['post']('/',auth[_0x3f67('0x8')](),interaction[_0x3f67('0xe')](_0x3f67('0xf'),'smsmessage:create'),controller[_0x3f67('0x10')]);router['post'](_0x3f67('0x11'),controller['status']);router[_0x3f67('0x12')](_0x3f67('0xc'),auth[_0x3f67('0x8')](),controller[_0x3f67('0x13')]);router['put'](_0x3f67('0x14'),auth['isAuthenticated'](),controller['accept']);router[_0x3f67('0x12')](_0x3f67('0x15'),auth[_0x3f67('0x8')](),controller[_0x3f67('0x16')]);router[_0x3f67('0x17')](_0x3f67('0xc'),auth[_0x3f67('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 040555e..47d5fe9 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 _0xc6b0=['medium','BOOLEAN','out','STRING','DATE','sequelize'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xc6b0,0x179));var _0x0c6b=function(_0xd0875c,_0x23073a){_0xd0875c=_0xd0875c-0x0;var _0x18a925=_0xc6b0[_0xd0875c];return _0x18a925;};'use strict';var Sequelize=require(_0x0c6b('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x0c6b('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x0c6b('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x0c6b('0x3')),'defaultValue':_0x0c6b('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0c6b('0x4')](0xbe)},'phone':{'type':Sequelize[_0x0c6b('0x4')]},'readAt':{'type':Sequelize[_0x0c6b('0x5')]},'secret':{'type':Sequelize[_0x0c6b('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x8f0b=['TEXT','exports','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x3df7d9,_0x2c2f99){var _0x55007a=function(_0x30ae47){while(--_0x30ae47){_0x3df7d9['push'](_0x3df7d9['shift']());}};_0x55007a(++_0x2c2f99);}(_0x8f0b,0x1f1));var _0xb8f0=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x8f0b[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require('sequelize');module[_0xb8f0('0x0')]={'body':{'type':Sequelize['TEXT'](_0xb8f0('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xb8f0('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb8f0('0x3')]('in',_0xb8f0('0x4')),'defaultValue':_0xb8f0('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb8f0('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xb8f0('0x6')]},'secret':{'type':Sequelize[_0xb8f0('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xb8f0('0x5')]},'providerResponse':{'type':Sequelize[_0xb8f0('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 9b1a915..44f196c 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 _0xdc21=['name','index','SmsMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','intersection','find','create','body','destroy','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','Contact','SmsInteraction','isNil','read1stAt','format','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','sms-interactions','sms','SmsInteractionId','null','RejectMessage','rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','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','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','count','offset','limit','set','apply','reject','save','update','end','sendStatus','stack'];(function(_0x4ed1d,_0x170a36){var _0x2d0a69=function(_0x58272e){while(--_0x58272e){_0x4ed1d['push'](_0x4ed1d['shift']());}};_0x2d0a69(++_0x170a36);}(_0xdc21,0x1f1));var _0x1dc2=function(_0x792de1,_0xca8f17){_0x792de1=_0x792de1-0x0;var _0x184930=_0xdc21[_0x792de1];return _0x184930;};'use strict';var pdf=require(_0x1dc2('0x0'));var emlformat=require(_0x1dc2('0x1'));var rimraf=require(_0x1dc2('0x2'));var zipdir=require(_0x1dc2('0x3'));var jsonpatch=require(_0x1dc2('0x4'));var rp=require(_0x1dc2('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1dc2('0x6'));var path=require(_0x1dc2('0x7'));var sox=require(_0x1dc2('0x8'));var csv=require('to-csv');var ejs=require(_0x1dc2('0x9'));var fs=require('fs');var _=require(_0x1dc2('0xa'));var squel=require(_0x1dc2('0xb'));var crypto=require(_0x1dc2('0xc'));var jsforce=require(_0x1dc2('0xd'));var deskjs=require(_0x1dc2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1dc2('0xf'));var Papa=require(_0x1dc2('0x10'));var Redis=require(_0x1dc2('0x11'));var authService=require(_0x1dc2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1dc2('0x13'));var hardwareService=require(_0x1dc2('0x14'));var logger=require(_0x1dc2('0x15'))(_0x1dc2('0x16'));var utils=require(_0x1dc2('0x17'));var config=require(_0x1dc2('0x18'));var licenseUtil=require(_0x1dc2('0x19'));var db=require(_0x1dc2('0x1a'))['db'];config[_0x1dc2('0x1b')]=_[_0x1dc2('0x1c')](config[_0x1dc2('0x1b')],{'host':_0x1dc2('0x1d'),'port':0x18eb});var socket=require(_0x1dc2('0x1e'))(new Redis(config[_0x1dc2('0x1b')]));require(_0x1dc2('0x1f'))[_0x1dc2('0x20')](socket);var jayson=require(_0x1dc2('0x21'));var client=jayson[_0x1dc2('0x22')][_0x1dc2('0x23')]({'port':0x232c});var client9002=jayson[_0x1dc2('0x22')][_0x1dc2('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x32ce69,_0xd73f62,_0x472c87,_0x1b66c4){return new BPromise(function(_0x3a1fd9,_0x3a0602){var _0x208bdb=_0x1b66c4||client;return _0x208bdb['request'](_0x32ce69,_0x472c87)[_0x1dc2('0x24')](function(_0x44f6fa){logger[_0x1dc2('0x25')](_0x1dc2('0x26'),_0xd73f62,_0x1dc2('0x27'));logger['debug'](_0x1dc2('0x28'),_0xd73f62,_0x1dc2('0x27'),JSON[_0x1dc2('0x29')](_0x44f6fa));if(_0x44f6fa[_0x1dc2('0x2a')]){if(_0x44f6fa['error'][_0x1dc2('0x2b')]===0x1f4){logger[_0x1dc2('0x2a')](_0x1dc2('0x26'),_0xd73f62,_0x44f6fa[_0x1dc2('0x2a')][_0x1dc2('0x2c')]);return _0x3a0602(_0x44f6fa['error']['message']);}logger[_0x1dc2('0x2a')](_0x1dc2('0x26'),_0xd73f62,_0x44f6fa[_0x1dc2('0x2a')][_0x1dc2('0x2c')]);return _0x3a1fd9(_0x44f6fa[_0x1dc2('0x2a')]['message']);}else{logger[_0x1dc2('0x25')](_0x1dc2('0x26'),_0xd73f62,_0x1dc2('0x27'));_0x3a1fd9(_0x44f6fa['result'][_0x1dc2('0x2c')]);}})[_0x1dc2('0x2d')](function(_0x3582bb){logger[_0x1dc2('0x2a')](_0x1dc2('0x26'),_0xd73f62,_0x3582bb);_0x3a0602(_0x3582bb);});});}function respondWithStatusCode(_0x1c9c90,_0x276503){_0x276503=_0x276503||0xcc;return function(_0x21e1eb){if(_0x21e1eb){return _0x1c9c90['sendStatus'](_0x276503);}return _0x1c9c90['status'](_0x276503)['end']();};}function respondWithResult(_0x2d4df3,_0x2cd607){_0x2cd607=_0x2cd607||0xc8;return function(_0x5cd028){if(_0x5cd028){return _0x2d4df3[_0x1dc2('0x2e')](_0x2cd607)[_0x1dc2('0x2f')](_0x5cd028);}};}function respondWithFilteredResult(_0x8c985e,_0x268a5c){return function(_0x1837db){if(_0x1837db){var _0x11cd4b=_0x1837db[_0x1dc2('0x30')],_0x1b2d86=_0x268a5c[_0x1dc2('0x31')],_0x113cb4=_0x268a5c[_0x1dc2('0x31')]+_0x268a5c[_0x1dc2('0x32')],_0x417463;if(_0x113cb4>=_0x11cd4b){_0x113cb4=_0x11cd4b;_0x417463=0xc8;}else{_0x417463=0xce;}_0x8c985e[_0x1dc2('0x2e')](_0x417463);return _0x8c985e[_0x1dc2('0x33')]('Content-Range',_0x1b2d86+'-'+_0x113cb4+'/'+_0x11cd4b)[_0x1dc2('0x2f')](_0x1837db);}return null;};}function patchUpdates(_0x197579){return function(_0xbed3c6){try{jsonpatch[_0x1dc2('0x34')](_0xbed3c6,_0x197579,!![]);}catch(_0x195430){return BPromise[_0x1dc2('0x35')](_0x195430);}return _0xbed3c6[_0x1dc2('0x36')]();};}function saveUpdates(_0x5263b1,_0x4f9694){return function(_0x338d33){if(_0x338d33){return _0x338d33[_0x1dc2('0x37')](_0x5263b1)[_0x1dc2('0x24')](function(_0x1ed9af){return _0x1ed9af;});}return null;};}function removeEntity(_0x4b0a47,_0x1a229f){return function(_0x2fd934){if(_0x2fd934){return _0x2fd934['destroy']()[_0x1dc2('0x24')](function(){_0x4b0a47['status'](0xcc)[_0x1dc2('0x38')]();});}};}function handleEntityNotFound(_0x12fe1e,_0xa0da57){return function(_0x1e726b){if(!_0x1e726b){_0x12fe1e[_0x1dc2('0x39')](0x194);}return _0x1e726b;};}function handleError(_0x590a88,_0x39eef2){_0x39eef2=_0x39eef2||0x1f4;return function(_0x420459){logger[_0x1dc2('0x2a')](_0x420459[_0x1dc2('0x3a')]);if(_0x420459[_0x1dc2('0x3b')]){delete _0x420459[_0x1dc2('0x3b')];}_0x590a88[_0x1dc2('0x2e')](_0x39eef2)['send'](_0x420459);};}exports[_0x1dc2('0x3c')]=function(_0x26476c,_0x2e6161){var _0x547713={},_0xc3ce31={},_0x4c13f2={'count':0x0,'rows':[]};var _0x760c93=_['map'](db[_0x1dc2('0x3d')][_0x1dc2('0x3e')],function(_0x160d00){return{'name':_0x160d00[_0x1dc2('0x3f')],'type':_0x160d00[_0x1dc2('0x40')]['key']};});_0xc3ce31[_0x1dc2('0x41')]=_[_0x1dc2('0x42')](_0x760c93,_0x1dc2('0x3b'));_0xc3ce31[_0x1dc2('0x43')]=_[_0x1dc2('0x44')](_0x26476c[_0x1dc2('0x43')]);_0xc3ce31[_0x1dc2('0x45')]=_['intersection'](_0xc3ce31[_0x1dc2('0x41')],_0xc3ce31[_0x1dc2('0x43')]);_0x547713[_0x1dc2('0x46')]=_['intersection'](_0xc3ce31['model'],qs[_0x1dc2('0x47')](_0x26476c[_0x1dc2('0x43')][_0x1dc2('0x47')]));_0x547713[_0x1dc2('0x46')]=_0x547713[_0x1dc2('0x46')]['length']?_0x547713[_0x1dc2('0x46')]:_0xc3ce31[_0x1dc2('0x41')];if(!_0x26476c[_0x1dc2('0x43')][_0x1dc2('0x48')]('nolimit')){_0x547713[_0x1dc2('0x32')]=qs[_0x1dc2('0x32')](_0x26476c[_0x1dc2('0x43')][_0x1dc2('0x32')]);_0x547713[_0x1dc2('0x31')]=qs[_0x1dc2('0x31')](_0x26476c[_0x1dc2('0x43')][_0x1dc2('0x31')]);}_0x547713['order']=qs['sort'](_0x26476c[_0x1dc2('0x43')][_0x1dc2('0x49')]);_0x547713[_0x1dc2('0x4a')]=qs[_0x1dc2('0x45')](_['pick'](_0x26476c['query'],_0xc3ce31[_0x1dc2('0x45')]),_0x760c93);if(_0x26476c[_0x1dc2('0x43')]['filter']){_0x547713[_0x1dc2('0x4a')]=_[_0x1dc2('0x4b')](_0x547713[_0x1dc2('0x4a')],{'$or':_[_0x1dc2('0x42')](_0x760c93,function(_0x1db1f2){if(_0x1db1f2[_0x1dc2('0x40')]!==_0x1dc2('0x4c')){var _0x727560={};_0x727560[_0x1db1f2[_0x1dc2('0x3b')]]={'$like':'%'+_0x26476c['query'][_0x1dc2('0x4d')]+'%'};return _0x727560;}})});}_0x547713=_[_0x1dc2('0x4b')]({},_0x547713,_0x26476c[_0x1dc2('0x4e')]);var _0x482841={'where':_0x547713['where']};return db[_0x1dc2('0x3d')][_0x1dc2('0x30')](_0x482841)[_0x1dc2('0x24')](function(_0x4e3719){_0x4c13f2[_0x1dc2('0x30')]=_0x4e3719;if(_0x26476c[_0x1dc2('0x43')][_0x1dc2('0x4f')]){_0x547713[_0x1dc2('0x50')]=[{'all':!![]}];}return db['SmsMessage'][_0x1dc2('0x51')](_0x547713);})[_0x1dc2('0x24')](function(_0x696297){_0x4c13f2[_0x1dc2('0x52')]=_0x696297;return _0x4c13f2;})[_0x1dc2('0x24')](respondWithFilteredResult(_0x2e6161,_0x547713))[_0x1dc2('0x2d')](handleError(_0x2e6161,null));};exports[_0x1dc2('0x53')]=function(_0x45d955,_0x4cdc7c){var _0x3a0e72={'raw':!![],'where':{'id':_0x45d955[_0x1dc2('0x54')]['id']}},_0x3b5669={};_0x3b5669[_0x1dc2('0x41')]=_[_0x1dc2('0x44')](db['SmsMessage'][_0x1dc2('0x3e')]);_0x3b5669[_0x1dc2('0x43')]=_['keys'](_0x45d955[_0x1dc2('0x43')]);_0x3b5669[_0x1dc2('0x45')]=_['intersection'](_0x3b5669[_0x1dc2('0x41')],_0x3b5669[_0x1dc2('0x43')]);_0x3a0e72[_0x1dc2('0x46')]=_[_0x1dc2('0x55')](_0x3b5669[_0x1dc2('0x41')],qs['fields'](_0x45d955[_0x1dc2('0x43')][_0x1dc2('0x47')]));_0x3a0e72['attributes']=_0x3a0e72[_0x1dc2('0x46')]['length']?_0x3a0e72['attributes']:_0x3b5669[_0x1dc2('0x41')];if(_0x45d955['query'][_0x1dc2('0x4f')]){_0x3a0e72[_0x1dc2('0x50')]=[{'all':!![]}];}_0x3a0e72=_[_0x1dc2('0x4b')]({},_0x3a0e72,_0x45d955[_0x1dc2('0x4e')]);return db[_0x1dc2('0x3d')][_0x1dc2('0x56')](_0x3a0e72)[_0x1dc2('0x24')](handleEntityNotFound(_0x4cdc7c,null))[_0x1dc2('0x24')](respondWithResult(_0x4cdc7c,null))[_0x1dc2('0x2d')](handleError(_0x4cdc7c,null));};exports[_0x1dc2('0x57')]=function(_0xcca3df,_0x45c08f){return db['SmsMessage'][_0x1dc2('0x57')](_0xcca3df[_0x1dc2('0x58')],{})[_0x1dc2('0x24')](respondWithResult(_0x45c08f,0xc9))[_0x1dc2('0x2d')](handleError(_0x45c08f,null));};exports[_0x1dc2('0x37')]=function(_0x203d8a,_0x5ba191){if(_0x203d8a[_0x1dc2('0x58')]['id']){delete _0x203d8a['body']['id'];}return db[_0x1dc2('0x3d')][_0x1dc2('0x56')]({'where':{'id':_0x203d8a[_0x1dc2('0x54')]['id']}})['then'](handleEntityNotFound(_0x5ba191,null))[_0x1dc2('0x24')](saveUpdates(_0x203d8a[_0x1dc2('0x58')],null))[_0x1dc2('0x24')](respondWithResult(_0x5ba191,null))[_0x1dc2('0x2d')](handleError(_0x5ba191,null));};exports[_0x1dc2('0x59')]=function(_0x20bced,_0x5765bf){return db['SmsMessage'][_0x1dc2('0x56')]({'where':{'id':_0x20bced[_0x1dc2('0x54')]['id']}})[_0x1dc2('0x24')](handleEntityNotFound(_0x5765bf,null))[_0x1dc2('0x24')](removeEntity(_0x5765bf,null))['catch'](handleError(_0x5765bf,null));};exports['describe']=function(_0x3e4f34,_0x3d554e){return db['SmsMessage']['describe']()['then'](respondWithResult(_0x3d554e,null))[_0x1dc2('0x2d')](handleError(_0x3d554e,null));};var interaction_log=require(_0x1dc2('0x15'))('sms-interactions');exports['accept']=function(_0x476d9a,_0xc47e58,_0x27a4fc){var _0x36d18f={'agent':{},'channel':'sms'};if(_0x476d9a[_0x1dc2('0x58')]['id']){delete _0x476d9a['body']['id'];}_0x476d9a[_0x1dc2('0x58')][_0x1dc2('0x5a')]=!![];_0x476d9a[_0x1dc2('0x58')][_0x1dc2('0x5b')]=moment()['format'](_0x1dc2('0x5c'));_0x476d9a[_0x1dc2('0x58')][_0x1dc2('0x5d')]=_0x476d9a[_0x1dc2('0x58')][_0x1dc2('0x5d')]||_0x476d9a['user']['id'];_0x36d18f[_0x1dc2('0x5e')]['id']=_0x476d9a[_0x1dc2('0x58')][_0x1dc2('0x5d')];return db['SmsMessage']['find']({'where':{'id':_0x476d9a['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x1dc2('0x5f')}]})[_0x1dc2('0x24')](handleEntityNotFound(_0xc47e58,null))[_0x1dc2('0x24')](saveUpdates(_0x476d9a[_0x1dc2('0x58')],null))['then'](function(_0x14ad84){if(_0x14ad84){_0x36d18f[_0x1dc2('0x2c')]=_0x14ad84['get']({'plain':!![]});return db[_0x1dc2('0x60')][_0x1dc2('0x56')]({'where':{'id':_0x14ad84['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0xc47e58,null))[_0x1dc2('0x24')](function(_0x428c47){if(_0x428c47){return _0x428c47['update']({'UserId':_0x476d9a[_0x1dc2('0x58')][_0x1dc2('0x5d')],'read1stAt':_[_0x1dc2('0x61')](_0x428c47[_0x1dc2('0x62')])?moment()[_0x1dc2('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x1dc2('0x24')](function(_0x5a53f9){if(_0x5a53f9){_0x36d18f['interaction']=_0x5a53f9[_0x1dc2('0x64')]({'plain':!![]});interaction_log[_0x1dc2('0x25')](_0x1dc2('0x65'),_0x476d9a[_0x1dc2('0x66')]['id'],_0x476d9a[_0x1dc2('0x66')][_0x1dc2('0x3b')],_0x476d9a[_0x1dc2('0x66')]['role'],_0x36d18f[_0x1dc2('0x67')]['id'],_0x476d9a[_0x1dc2('0x58')]?JSON[_0x1dc2('0x29')](_0x476d9a[_0x1dc2('0x58')]):'null');return respondWithRpcPromise(_0x1dc2('0x68'),_0x1dc2('0x69'),_0x36d18f);}return null;})[_0x1dc2('0x24')](function(_0x2a2082){if(_0x2a2082){if(_0x476d9a[_0x1dc2('0x58')]['manual']){_0x36d18f[_0x1dc2('0x2c')][_0x1dc2('0x6a')]=util[_0x1dc2('0x63')](_0x1dc2('0x6b'),_0x476d9a[_0x1dc2('0x66')][_0x1dc2('0x3b')]);_0x36d18f[_0x1dc2('0x2c')][_0x1dc2('0x6c')]=_0x36d18f['channel'];_0x36d18f[_0x1dc2('0x2c')][_0x1dc2('0x6d')]=_0x1dc2('0x6e');return respondWithRpcPromise(_0x1dc2('0x6f'),_0x1dc2('0x6f'),{'event':_0x1dc2('0x70'),'message':_0x36d18f[_0x1dc2('0x2c')]},client9002)[_0x1dc2('0x24')](function(){return _0x36d18f;});}return _0x36d18f;}return null;})[_0x1dc2('0x24')](respondWithResult(_0xc47e58,null))[_0x1dc2('0x2d')](handleError(_0xc47e58,null));};var interaction_log=require(_0x1dc2('0x15'))(_0x1dc2('0x71'));exports[_0x1dc2('0x35')]=function(_0x234ed5,_0x909484,_0x7979c7){var _0x1f9d33={'agent':{},'channel':_0x1dc2('0x72')};if(_0x234ed5[_0x1dc2('0x58')]['id']){delete _0x234ed5[_0x1dc2('0x58')]['id'];}_0x234ed5['body'][_0x1dc2('0x5d')]=_0x234ed5[_0x1dc2('0x58')]['UserId']||_0x234ed5[_0x1dc2('0x66')]['id'];_0x1f9d33[_0x1dc2('0x5e')]['id']=_0x234ed5[_0x1dc2('0x58')][_0x1dc2('0x5d')];return db[_0x1dc2('0x3d')][_0x1dc2('0x56')]({'where':{'id':_0x234ed5['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x909484,null))[_0x1dc2('0x24')](function(_0x5dbe33){if(_0x5dbe33){_0x1f9d33['message']=_0x5dbe33[_0x1dc2('0x64')]({'plain':!![]});return db[_0x1dc2('0x60')]['find']({'where':{'id':_0x5dbe33[_0x1dc2('0x73')]}});}return null;})[_0x1dc2('0x24')](handleEntityNotFound(_0x909484,null))[_0x1dc2('0x24')](function(_0x432f59){if(_0x432f59){_0x1f9d33[_0x1dc2('0x67')]=_0x432f59[_0x1dc2('0x64')]({'plain':!![]});interaction_log[_0x1dc2('0x25')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x234ed5['user']['id'],_0x234ed5[_0x1dc2('0x66')]['name'],_0x234ed5[_0x1dc2('0x66')]['role'],_0x1f9d33[_0x1dc2('0x67')]['id'],_0x234ed5[_0x1dc2('0x58')]?JSON['stringify'](_0x234ed5[_0x1dc2('0x58')]):_0x1dc2('0x74'));return respondWithRpcPromise(_0x1dc2('0x75'),'rejectMessage',_0x1f9d33);}return null;})[_0x1dc2('0x24')](function(_0x2b5444){if(_0x2b5444){_0x2b5444[_0x1dc2('0x2c')][_0x1dc2('0x6a')]=util['format'](_0x1dc2('0x6b'),_0x234ed5[_0x1dc2('0x66')][_0x1dc2('0x3b')]);_0x2b5444['message']['channel']=_0x1f9d33[_0x1dc2('0x6c')];_0x2b5444['message'][_0x1dc2('0x6d')]='reject';respondWithRpcPromise(_0x1dc2('0x6f'),_0x1dc2('0x6f'),{'event':_0x1dc2('0x76'),'message':_0x2b5444['message']},client9002);return _0x1f9d33;}return null;})[_0x1dc2('0x24')](respondWithResult(_0x909484,null))[_0x1dc2('0x2d')](handleError(_0x909484,null));};exports['status']=function(_0x36c09b,_0xb46f16,_0x47675b){if(_0x36c09b[_0x1dc2('0x58')]['id']){delete _0x36c09b[_0x1dc2('0x58')]['id'];}var _0x1cb9a7;return db['SmsMessage'][_0x1dc2('0x56')]({'where':{'id':_0x36c09b[_0x1dc2('0x54')]['id']}})['then'](handleEntityNotFound(_0xb46f16,null))[_0x1dc2('0x24')](function(_0x3cd763){if(_0x3cd763){_0x1cb9a7=_0x3cd763;return db[_0x1dc2('0x77')]['find']({'where':{'id':_0x3cd763[_0x1dc2('0x78')]}});}})[_0x1dc2('0x24')](handleEntityNotFound(_0xb46f16,null))[_0x1dc2('0x24')](function(_0x346946){if(_0x346946){logger[_0x1dc2('0x79')](_0x1dc2('0x28'),_0x1dc2('0x2e'),_0x1dc2('0x7a'),_0x346946[_0x1dc2('0x40')],util[_0x1dc2('0x7b')](_0x36c09b[_0x1dc2('0x58')],{'showHidden':![],'depth':null}));switch(_0x346946[_0x1dc2('0x40')]){case _0x1dc2('0x7c'):if(_0x36c09b[_0x1dc2('0x58')][_0x1dc2('0x7d')]&&_0x36c09b[_0x1dc2('0x58')][_0x1dc2('0x7d')]===_0x1cb9a7[_0x1dc2('0x7e')]){return _0x1cb9a7[_0x1dc2('0x37')]({'read':!![]});}else{logger[_0x1dc2('0x2a')](_0x1dc2('0x7f'),_0x1dc2('0x2e'),_0x1dc2('0x7c'),util[_0x1dc2('0x7b')](_0x36c09b['body'],{'showHidden':![],'depth':null}));}break;case _0x1dc2('0x80'):if(_0x36c09b['body']['MessageUUID']&&_0x36c09b[_0x1dc2('0x58')][_0x1dc2('0x81')]===_0x1cb9a7['messageId']&&_[_0x1dc2('0x82')]([_0x1dc2('0x83'),_0x1dc2('0x84')],_0x36c09b[_0x1dc2('0x58')][_0x1dc2('0x85')])>=0x0){return _0x1cb9a7[_0x1dc2('0x37')]({'read':!![]});}else{logger['error'](_0x1dc2('0x7f'),_0x1dc2('0x2e'),_0x1dc2('0x86'),util[_0x1dc2('0x7b')](_0x36c09b[_0x1dc2('0x58')],{'showHidden':![],'depth':null}));}break;case _0x1dc2('0x87'):var _0x2442ac=_0x36c09b[_0x1dc2('0x58')][_0x1dc2('0x88')][0x0];if(_0x2442ac[_0x1dc2('0x2e')][_0x1dc2('0x89')]===_0x1dc2('0x8a')){return _0x1cb9a7[_0x1dc2('0x37')]({'read':!![]});}else{logger[_0x1dc2('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x1dc2('0x87'),util[_0x1dc2('0x7b')](_0x36c09b[_0x1dc2('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x1cb9a7;}})[_0x1dc2('0x24')](respondWithResult(_0xb46f16,null))[_0x1dc2('0x2d')](handleError(_0xb46f16,null));}; \ No newline at end of file +var _0xaba8=['save','update','destroy','end','stack','name','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','SmsMessage','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','describe','../../config/logger','sms-interactions','accept','sms','read','readAt','UserId','agent','CmContact','get','SmsInteraction','isNil','format','YYYY-MM-DD\x20HH:mm:ss','interaction','user','role','AcceptMessage','acceptMessage','manual','interface','event','EventManager','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SIP/%s','channel','rejectmessage','SmsAccount','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','delivered','Status','plivio','infobip','results','groupName','DELIVERED','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','json','count','offset','limit','set','reject'];(function(_0x12ef05,_0xd866ed){var _0x3adf51=function(_0x728114){while(--_0x728114){_0x12ef05['push'](_0x12ef05['shift']());}};_0x3adf51(++_0xd866ed);}(_0xaba8,0x15f));var _0x8aba=function(_0x500363,_0x3bfe57){_0x500363=_0x500363-0x0;var _0x530688=_0xaba8[_0x500363];return _0x530688;};'use strict';var pdf=require(_0x8aba('0x0'));var emlformat=require(_0x8aba('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8aba('0x2'));var rp=require('request-promise');var moment=require(_0x8aba('0x3'));var BPromise=require(_0x8aba('0x4'));var Mustache=require(_0x8aba('0x5'));var util=require('util');var path=require(_0x8aba('0x6'));var sox=require(_0x8aba('0x7'));var csv=require(_0x8aba('0x8'));var ejs=require(_0x8aba('0x9'));var fs=require('fs');var _=require(_0x8aba('0xa'));var squel=require(_0x8aba('0xb'));var crypto=require(_0x8aba('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8aba('0x8'));var querystring=require(_0x8aba('0xd'));var Papa=require('papaparse');var Redis=require(_0x8aba('0xe'));var authService=require(_0x8aba('0xf'));var qs=require(_0x8aba('0x10'));var as=require(_0x8aba('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8aba('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8aba('0x13'));var db=require(_0x8aba('0x14'))['db'];config[_0x8aba('0x15')]=_[_0x8aba('0x16')](config[_0x8aba('0x15')],{'host':_0x8aba('0x17'),'port':0x18eb});var socket=require(_0x8aba('0x18'))(new Redis(config['redis']));require(_0x8aba('0x19'))[_0x8aba('0x1a')](socket);var jayson=require(_0x8aba('0x1b'));var client=jayson[_0x8aba('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x8aba('0x1c')][_0x8aba('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x15b234,_0x39bf81,_0x1d76be,_0x476443){return new BPromise(function(_0x1f67a4,_0x639f1){var _0x2c9180=_0x476443||client;return _0x2c9180['request'](_0x15b234,_0x1d76be)[_0x8aba('0x1e')](function(_0x549219){logger[_0x8aba('0x1f')](_0x8aba('0x20'),_0x39bf81,_0x8aba('0x21'));logger[_0x8aba('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x39bf81,_0x8aba('0x21'),JSON[_0x8aba('0x23')](_0x549219));if(_0x549219[_0x8aba('0x24')]){if(_0x549219[_0x8aba('0x24')][_0x8aba('0x25')]===0x1f4){logger['error'](_0x8aba('0x20'),_0x39bf81,_0x549219[_0x8aba('0x24')][_0x8aba('0x26')]);return _0x639f1(_0x549219[_0x8aba('0x24')][_0x8aba('0x26')]);}logger[_0x8aba('0x24')](_0x8aba('0x20'),_0x39bf81,_0x549219['error']['message']);return _0x1f67a4(_0x549219[_0x8aba('0x24')]['message']);}else{logger[_0x8aba('0x1f')]('SmsMessage,\x20%s,\x20%s',_0x39bf81,'request\x20sent');_0x1f67a4(_0x549219[_0x8aba('0x27')][_0x8aba('0x26')]);}})['catch'](function(_0x550518){logger[_0x8aba('0x24')](_0x8aba('0x20'),_0x39bf81,_0x550518);_0x639f1(_0x550518);});});}function respondWithStatusCode(_0x38883e,_0x171a2e){_0x171a2e=_0x171a2e||0xcc;return function(_0x428eb8){if(_0x428eb8){return _0x38883e[_0x8aba('0x28')](_0x171a2e);}return _0x38883e['status'](_0x171a2e)['end']();};}function respondWithResult(_0x538cd3,_0x115793){_0x115793=_0x115793||0xc8;return function(_0x43e94c){if(_0x43e94c){return _0x538cd3[_0x8aba('0x29')](_0x115793)[_0x8aba('0x2a')](_0x43e94c);}};}function respondWithFilteredResult(_0x19a601,_0x29422d){return function(_0x27878e){if(_0x27878e){var _0x4e6a1d=_0x27878e[_0x8aba('0x2b')],_0x19f3c5=_0x29422d[_0x8aba('0x2c')],_0x47403b=_0x29422d[_0x8aba('0x2c')]+_0x29422d[_0x8aba('0x2d')],_0x4fbb73;if(_0x47403b>=_0x4e6a1d){_0x47403b=_0x4e6a1d;_0x4fbb73=0xc8;}else{_0x4fbb73=0xce;}_0x19a601[_0x8aba('0x29')](_0x4fbb73);return _0x19a601[_0x8aba('0x2e')]('Content-Range',_0x19f3c5+'-'+_0x47403b+'/'+_0x4e6a1d)['json'](_0x27878e);}return null;};}function patchUpdates(_0xd5d409){return function(_0x229879){try{jsonpatch['apply'](_0x229879,_0xd5d409,!![]);}catch(_0x319e69){return BPromise[_0x8aba('0x2f')](_0x319e69);}return _0x229879[_0x8aba('0x30')]();};}function saveUpdates(_0x55bcb3,_0x1b696c){return function(_0x10690c){if(_0x10690c){return _0x10690c[_0x8aba('0x31')](_0x55bcb3)[_0x8aba('0x1e')](function(_0x42d9c5){return _0x42d9c5;});}return null;};}function removeEntity(_0x325b94,_0x547b34){return function(_0x5f1b17){if(_0x5f1b17){return _0x5f1b17[_0x8aba('0x32')]()[_0x8aba('0x1e')](function(){_0x325b94[_0x8aba('0x29')](0xcc)[_0x8aba('0x33')]();});}};}function handleEntityNotFound(_0x509609,_0x4613d1){return function(_0x4cd828){if(!_0x4cd828){_0x509609[_0x8aba('0x28')](0x194);}return _0x4cd828;};}function handleError(_0x429baa,_0x36de5c){_0x36de5c=_0x36de5c||0x1f4;return function(_0x4d0a8b){logger[_0x8aba('0x24')](_0x4d0a8b[_0x8aba('0x34')]);if(_0x4d0a8b[_0x8aba('0x35')]){delete _0x4d0a8b[_0x8aba('0x35')];}_0x429baa[_0x8aba('0x29')](_0x36de5c)['send'](_0x4d0a8b);};}exports['index']=function(_0x1200b9,_0x58b435){var _0x201e94={},_0x109ef0={},_0x1bbacd={'count':0x0,'rows':[]};var _0x66f7bb=_['map'](db['SmsMessage'][_0x8aba('0x36')],function(_0x52104e){return{'name':_0x52104e['fieldName'],'type':_0x52104e[_0x8aba('0x37')][_0x8aba('0x38')]};});_0x109ef0[_0x8aba('0x39')]=_[_0x8aba('0x3a')](_0x66f7bb,_0x8aba('0x35'));_0x109ef0[_0x8aba('0x3b')]=_['keys'](_0x1200b9['query']);_0x109ef0[_0x8aba('0x3c')]=_[_0x8aba('0x3d')](_0x109ef0[_0x8aba('0x39')],_0x109ef0[_0x8aba('0x3b')]);_0x201e94[_0x8aba('0x3e')]=_[_0x8aba('0x3d')](_0x109ef0[_0x8aba('0x39')],qs[_0x8aba('0x3f')](_0x1200b9[_0x8aba('0x3b')][_0x8aba('0x3f')]));_0x201e94[_0x8aba('0x3e')]=_0x201e94[_0x8aba('0x3e')]['length']?_0x201e94['attributes']:_0x109ef0[_0x8aba('0x39')];if(!_0x1200b9['query'][_0x8aba('0x40')](_0x8aba('0x41'))){_0x201e94['limit']=qs['limit'](_0x1200b9[_0x8aba('0x3b')][_0x8aba('0x2d')]);_0x201e94[_0x8aba('0x2c')]=qs[_0x8aba('0x2c')](_0x1200b9['query']['offset']);}_0x201e94[_0x8aba('0x42')]=qs[_0x8aba('0x43')](_0x1200b9[_0x8aba('0x3b')]['sort']);_0x201e94['where']=qs[_0x8aba('0x3c')](_[_0x8aba('0x44')](_0x1200b9[_0x8aba('0x3b')],_0x109ef0[_0x8aba('0x3c')]),_0x66f7bb);if(_0x1200b9['query'][_0x8aba('0x45')]){_0x201e94['where']=_[_0x8aba('0x46')](_0x201e94[_0x8aba('0x47')],{'$or':_['map'](_0x66f7bb,function(_0x3cb5d5){if(_0x3cb5d5[_0x8aba('0x37')]!==_0x8aba('0x48')){var _0x301f8d={};_0x301f8d[_0x3cb5d5[_0x8aba('0x35')]]={'$like':'%'+_0x1200b9[_0x8aba('0x3b')][_0x8aba('0x45')]+'%'};return _0x301f8d;}})});}_0x201e94=_[_0x8aba('0x46')]({},_0x201e94,_0x1200b9[_0x8aba('0x49')]);var _0x1369d6={'where':_0x201e94[_0x8aba('0x47')]};return db[_0x8aba('0x4a')][_0x8aba('0x2b')](_0x1369d6)[_0x8aba('0x1e')](function(_0x3539bf){_0x1bbacd['count']=_0x3539bf;if(_0x1200b9[_0x8aba('0x3b')][_0x8aba('0x4b')]){_0x201e94[_0x8aba('0x4c')]=[{'all':!![]}];}return db['SmsMessage'][_0x8aba('0x4d')](_0x201e94);})['then'](function(_0x14925d){_0x1bbacd[_0x8aba('0x4e')]=_0x14925d;return _0x1bbacd;})[_0x8aba('0x1e')](respondWithFilteredResult(_0x58b435,_0x201e94))[_0x8aba('0x4f')](handleError(_0x58b435,null));};exports[_0x8aba('0x50')]=function(_0x36f644,_0x23ebb6){var _0x442e6c={'raw':!![],'where':{'id':_0x36f644[_0x8aba('0x51')]['id']}},_0x2ab355={};_0x2ab355['model']=_[_0x8aba('0x52')](db['SmsMessage'][_0x8aba('0x36')]);_0x2ab355[_0x8aba('0x3b')]=_[_0x8aba('0x52')](_0x36f644[_0x8aba('0x3b')]);_0x2ab355['filters']=_[_0x8aba('0x3d')](_0x2ab355[_0x8aba('0x39')],_0x2ab355['query']);_0x442e6c[_0x8aba('0x3e')]=_[_0x8aba('0x3d')](_0x2ab355['model'],qs[_0x8aba('0x3f')](_0x36f644['query'][_0x8aba('0x3f')]));_0x442e6c[_0x8aba('0x3e')]=_0x442e6c[_0x8aba('0x3e')][_0x8aba('0x53')]?_0x442e6c[_0x8aba('0x3e')]:_0x2ab355[_0x8aba('0x39')];if(_0x36f644[_0x8aba('0x3b')][_0x8aba('0x4b')]){_0x442e6c[_0x8aba('0x4c')]=[{'all':!![]}];}_0x442e6c=_[_0x8aba('0x46')]({},_0x442e6c,_0x36f644['options']);return db[_0x8aba('0x4a')][_0x8aba('0x54')](_0x442e6c)['then'](handleEntityNotFound(_0x23ebb6,null))[_0x8aba('0x1e')](respondWithResult(_0x23ebb6,null))[_0x8aba('0x4f')](handleError(_0x23ebb6,null));};exports[_0x8aba('0x55')]=function(_0x3c2788,_0x338041){return db[_0x8aba('0x4a')][_0x8aba('0x55')](_0x3c2788[_0x8aba('0x56')],{})[_0x8aba('0x1e')](respondWithResult(_0x338041,0xc9))[_0x8aba('0x4f')](handleError(_0x338041,null));};exports[_0x8aba('0x31')]=function(_0x52e014,_0x85e7cd){if(_0x52e014['body']['id']){delete _0x52e014[_0x8aba('0x56')]['id'];}return db[_0x8aba('0x4a')][_0x8aba('0x54')]({'where':{'id':_0x52e014[_0x8aba('0x51')]['id']}})[_0x8aba('0x1e')](handleEntityNotFound(_0x85e7cd,null))['then'](saveUpdates(_0x52e014['body'],null))[_0x8aba('0x1e')](respondWithResult(_0x85e7cd,null))[_0x8aba('0x4f')](handleError(_0x85e7cd,null));};exports[_0x8aba('0x32')]=function(_0x3287ad,_0xc83eba){return db[_0x8aba('0x4a')]['find']({'where':{'id':_0x3287ad[_0x8aba('0x51')]['id']}})[_0x8aba('0x1e')](handleEntityNotFound(_0xc83eba,null))['then'](removeEntity(_0xc83eba,null))[_0x8aba('0x4f')](handleError(_0xc83eba,null));};exports[_0x8aba('0x57')]=function(_0xa21af0,_0x10f9fa){return db[_0x8aba('0x4a')]['describe']()[_0x8aba('0x1e')](respondWithResult(_0x10f9fa,null))[_0x8aba('0x4f')](handleError(_0x10f9fa,null));};var interaction_log=require(_0x8aba('0x58'))(_0x8aba('0x59'));exports[_0x8aba('0x5a')]=function(_0x71e8d,_0x165c20,_0x242cb3){var _0x18cc7e={'agent':{},'channel':_0x8aba('0x5b')};if(_0x71e8d[_0x8aba('0x56')]['id']){delete _0x71e8d[_0x8aba('0x56')]['id'];}_0x71e8d[_0x8aba('0x56')][_0x8aba('0x5c')]=!![];_0x71e8d[_0x8aba('0x56')][_0x8aba('0x5d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x71e8d['body'][_0x8aba('0x5e')]=_0x71e8d[_0x8aba('0x56')][_0x8aba('0x5e')]||_0x71e8d['user']['id'];_0x18cc7e[_0x8aba('0x5f')]['id']=_0x71e8d[_0x8aba('0x56')][_0x8aba('0x5e')];return db['SmsMessage'][_0x8aba('0x54')]({'where':{'id':_0x71e8d[_0x8aba('0x51')]['id'],'UserId':null},'include':[{'model':db[_0x8aba('0x60')],'as':'Contact'}]})[_0x8aba('0x1e')](handleEntityNotFound(_0x165c20,null))['then'](saveUpdates(_0x71e8d[_0x8aba('0x56')],null))['then'](function(_0x282a0d){if(_0x282a0d){_0x18cc7e['message']=_0x282a0d[_0x8aba('0x61')]({'plain':!![]});return db[_0x8aba('0x62')][_0x8aba('0x54')]({'where':{'id':_0x282a0d['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x165c20,null))[_0x8aba('0x1e')](function(_0x23d624){if(_0x23d624){return _0x23d624[_0x8aba('0x31')]({'UserId':_0x71e8d[_0x8aba('0x56')][_0x8aba('0x5e')],'read1stAt':_[_0x8aba('0x63')](_0x23d624['read1stAt'])?moment()[_0x8aba('0x64')](_0x8aba('0x65')):undefined});}return null;})[_0x8aba('0x1e')](function(_0x2758fe){if(_0x2758fe){_0x18cc7e[_0x8aba('0x66')]=_0x2758fe['get']({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x71e8d[_0x8aba('0x67')]['id'],_0x71e8d['user'][_0x8aba('0x35')],_0x71e8d['user'][_0x8aba('0x68')],_0x18cc7e[_0x8aba('0x66')]['id'],_0x71e8d[_0x8aba('0x56')]?JSON[_0x8aba('0x23')](_0x71e8d['body']):'null');return respondWithRpcPromise(_0x8aba('0x69'),_0x8aba('0x6a'),_0x18cc7e);}return null;})[_0x8aba('0x1e')](function(_0x55dbaf){if(_0x55dbaf){if(_0x71e8d['body'][_0x8aba('0x6b')]){_0x18cc7e[_0x8aba('0x26')][_0x8aba('0x6c')]=util[_0x8aba('0x64')]('SIP/%s',_0x71e8d[_0x8aba('0x67')][_0x8aba('0x35')]);_0x18cc7e[_0x8aba('0x26')]['channel']=_0x18cc7e['channel'];_0x18cc7e['message'][_0x8aba('0x6d')]=_0x8aba('0x5a');return respondWithRpcPromise(_0x8aba('0x6e'),_0x8aba('0x6e'),{'event':'acceptmessage','message':_0x18cc7e[_0x8aba('0x26')]},client9002)[_0x8aba('0x1e')](function(){return _0x18cc7e;});}return _0x18cc7e;}return null;})[_0x8aba('0x1e')](respondWithResult(_0x165c20,null))[_0x8aba('0x4f')](handleError(_0x165c20,null));};var interaction_log=require(_0x8aba('0x58'))('sms-interactions');exports[_0x8aba('0x2f')]=function(_0x322be9,_0x3ac260,_0x1a2930){var _0x3c6f09={'agent':{},'channel':'sms'};if(_0x322be9[_0x8aba('0x56')]['id']){delete _0x322be9[_0x8aba('0x56')]['id'];}_0x322be9[_0x8aba('0x56')][_0x8aba('0x5e')]=_0x322be9[_0x8aba('0x56')]['UserId']||_0x322be9[_0x8aba('0x67')]['id'];_0x3c6f09[_0x8aba('0x5f')]['id']=_0x322be9[_0x8aba('0x56')][_0x8aba('0x5e')];return db[_0x8aba('0x4a')][_0x8aba('0x54')]({'where':{'id':_0x322be9[_0x8aba('0x51')]['id'],'UserId':null}})[_0x8aba('0x1e')](handleEntityNotFound(_0x3ac260,null))[_0x8aba('0x1e')](function(_0x256ff2){if(_0x256ff2){_0x3c6f09[_0x8aba('0x26')]=_0x256ff2[_0x8aba('0x61')]({'plain':!![]});return db[_0x8aba('0x62')][_0x8aba('0x54')]({'where':{'id':_0x256ff2['SmsInteractionId']}});}return null;})[_0x8aba('0x1e')](handleEntityNotFound(_0x3ac260,null))[_0x8aba('0x1e')](function(_0x487486){if(_0x487486){_0x3c6f09[_0x8aba('0x66')]=_0x487486[_0x8aba('0x61')]({'plain':!![]});interaction_log[_0x8aba('0x1f')](_0x8aba('0x6f'),_0x322be9[_0x8aba('0x67')]['id'],_0x322be9[_0x8aba('0x67')][_0x8aba('0x35')],_0x322be9[_0x8aba('0x67')][_0x8aba('0x68')],_0x3c6f09[_0x8aba('0x66')]['id'],_0x322be9[_0x8aba('0x56')]?JSON['stringify'](_0x322be9[_0x8aba('0x56')]):'null');return respondWithRpcPromise(_0x8aba('0x70'),'rejectMessage',_0x3c6f09);}return null;})[_0x8aba('0x1e')](function(_0x402bec){if(_0x402bec){_0x402bec[_0x8aba('0x26')][_0x8aba('0x6c')]=util['format'](_0x8aba('0x71'),_0x322be9[_0x8aba('0x67')]['name']);_0x402bec[_0x8aba('0x26')]['channel']=_0x3c6f09[_0x8aba('0x72')];_0x402bec['message']['event']=_0x8aba('0x2f');respondWithRpcPromise('EventManager',_0x8aba('0x6e'),{'event':_0x8aba('0x73'),'message':_0x402bec[_0x8aba('0x26')]},client9002);return _0x3c6f09;}return null;})['then'](respondWithResult(_0x3ac260,null))[_0x8aba('0x4f')](handleError(_0x3ac260,null));};exports['status']=function(_0x13be6e,_0x321ab3,_0x4a2d45){if(_0x13be6e[_0x8aba('0x56')]['id']){delete _0x13be6e['body']['id'];}var _0x1d7134;return db['SmsMessage']['find']({'where':{'id':_0x13be6e[_0x8aba('0x51')]['id']}})[_0x8aba('0x1e')](handleEntityNotFound(_0x321ab3,null))[_0x8aba('0x1e')](function(_0x5eedc1){if(_0x5eedc1){_0x1d7134=_0x5eedc1;return db[_0x8aba('0x74')][_0x8aba('0x54')]({'where':{'id':_0x5eedc1['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x321ab3,null))[_0x8aba('0x1e')](function(_0x4b17f4){if(_0x4b17f4){logger['debug'](_0x8aba('0x75'),_0x8aba('0x29'),_0x8aba('0x76'),_0x4b17f4[_0x8aba('0x37')],util[_0x8aba('0x77')](_0x13be6e[_0x8aba('0x56')],{'showHidden':![],'depth':null}));switch(_0x4b17f4['type']){case _0x8aba('0x78'):if(_0x13be6e[_0x8aba('0x56')][_0x8aba('0x79')]&&_0x13be6e[_0x8aba('0x56')][_0x8aba('0x79')]===_0x1d7134[_0x8aba('0x7a')]){return _0x1d7134[_0x8aba('0x31')]({'read':!![]});}else{logger[_0x8aba('0x24')](_0x8aba('0x7b'),'status',_0x8aba('0x78'),util[_0x8aba('0x77')](_0x13be6e['body'],{'showHidden':![],'depth':null}));}break;case _0x8aba('0x7c'):if(_0x13be6e['body'][_0x8aba('0x7d')]&&_0x13be6e[_0x8aba('0x56')][_0x8aba('0x7d')]===_0x1d7134['messageId']&&_['indexOf'](['sent',_0x8aba('0x7e')],_0x13be6e['body'][_0x8aba('0x7f')])>=0x0){return _0x1d7134[_0x8aba('0x31')]({'read':!![]});}else{logger[_0x8aba('0x24')](_0x8aba('0x7b'),_0x8aba('0x29'),_0x8aba('0x80'),util[_0x8aba('0x77')](_0x13be6e['body'],{'showHidden':![],'depth':null}));}break;case _0x8aba('0x81'):var _0x24b4d3=_0x13be6e[_0x8aba('0x56')][_0x8aba('0x82')][0x0];if(_0x24b4d3[_0x8aba('0x29')][_0x8aba('0x83')]===_0x8aba('0x84')){return _0x1d7134[_0x8aba('0x31')]({'read':!![]});}else{logger[_0x8aba('0x24')](_0x8aba('0x7b'),_0x8aba('0x29'),_0x8aba('0x81'),util[_0x8aba('0x77')](_0x13be6e[_0x8aba('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x1d7134;}})['then'](respondWithResult(_0x321ab3,null))[_0x8aba('0x4f')](handleError(_0x321ab3,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 7feeda9..645134c 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 _0x6718=['events','../../mysqldb','SmsMessage','save','emit','hasOwnProperty','exports'];(function(_0x1bb58c,_0x2c8a4d){var _0x277586=function(_0x11fd4c){while(--_0x11fd4c){_0x1bb58c['push'](_0x1bb58c['shift']());}};_0x277586(++_0x2c8a4d);}(_0x6718,0x17a));var _0x8671=function(_0xe501ff,_0x955b7e){_0xe501ff=_0xe501ff-0x0;var _0x17135d=_0x6718[_0xe501ff];return _0x17135d;};'use strict';var EventEmitter=require(_0x8671('0x0'));var SmsMessage=require(_0x8671('0x1'))['db'][_0x8671('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8671('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3d24bf){return function(_0x15eb66,_0x5324c1,_0x12ede1){SmsMessageEvents[_0x8671('0x4')](_0x3d24bf+':'+_0x15eb66['id'],_0x15eb66);SmsMessageEvents[_0x8671('0x4')](_0x3d24bf,_0x15eb66);_0x12ede1(null);};}for(var e in events){if(events[_0x8671('0x5')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x8671('0x6')]=SmsMessageEvents; \ No newline at end of file +var _0xb51d=['remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update'];(function(_0x390476,_0x54d33b){var _0x5c969b=function(_0x31d19f){while(--_0x31d19f){_0x390476['push'](_0x390476['shift']());}};_0x5c969b(++_0x54d33b);}(_0xb51d,0xdd));var _0xdb51=function(_0x1c028e,_0x252cc5){_0x1c028e=_0x1c028e-0x0;var _0x126c1c=_0xb51d[_0x1c028e];return _0x126c1c;};'use strict';var EventEmitter=require(_0xdb51('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xdb51('0x1')](0x0);var events={'afterCreate':_0xdb51('0x2'),'afterUpdate':_0xdb51('0x3'),'afterDestroy':_0xdb51('0x4')};function emitEvent(_0x50227c){return function(_0xd21b3f,_0x5cd978,_0xc3220b){SmsMessageEvents[_0xdb51('0x5')](_0x50227c+':'+_0xd21b3f['id'],_0xd21b3f);SmsMessageEvents[_0xdb51('0x5')](_0x50227c,_0xd21b3f);_0xc3220b(null);};}for(var e in events){if(events[_0xdb51('0x6')](e)){var event=events[e];SmsMessage[_0xdb51('0x7')](e,emitEvent(event));}}module[_0xdb51('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index e2f87d4..5d031e3 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 _0xfbb2=['body','/status?token=','token','sid','error','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','message_id','clickSend','plivo','authId','remote','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','keys','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','then','update','catch','SmsAccount','find','type','twilio','authToken','phone','accountSid','messages','create'];(function(_0x273713,_0x435ebd){var _0x2b4385=function(_0x4080cd){while(--_0x4080cd){_0x273713['push'](_0x273713['shift']());}};_0x2b4385(++_0x435ebd);}(_0xfbb2,0x15a));var _0x2fbb=function(_0x502773,_0xe55d92){_0x502773=_0x502773-0x0;var _0x568f34=_0xfbb2[_0x502773];return _0x568f34;};'use strict';var _=require(_0x2fbb('0x0'));var util=require(_0x2fbb('0x1'));var logger=require(_0x2fbb('0x2'))(_0x2fbb('0x3'));var moment=require(_0x2fbb('0x4'));var BPromise=require(_0x2fbb('0x5'));var rp=require(_0x2fbb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2fbb('0x7'));var attributes=require(_0x2fbb('0x8'));module[_0x2fbb('0x9')]=function(_0x2439c6,_0x79e2a){return _0x2439c6[_0x2fbb('0xa')](_0x2fbb('0xb'),attributes,{'tableName':_0x2fbb('0xc'),'paranoid':![],'indexes':[{'name':_0x2fbb('0xd'),'fields':[_0x2fbb('0xd')]},{'name':_0x2fbb('0xe'),'fields':['body'],'type':_0x2fbb('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x24b53d,_0x106940,_0xd69176){var _0x3a494c=_0x2439c6[_0x2fbb('0x10')];var _0x40b411=_0x24b53d[_0x2fbb('0x11')]({'plain':!![]});if(_0x40b411[_0x2fbb('0x12')][_0x2fbb('0x13')]()==='in'||_0x40b411[_0x2fbb('0x12')]['toLowerCase']()===_0x2fbb('0x14')&&!_0x40b411[_0x2fbb('0x15')]&&!_[_0x2fbb('0x16')](_0x40b411[_0x2fbb('0x17')])){_0x3a494c[_0x2fbb('0x18')][_0x2fbb('0x19')]({'where':{'id':_0x40b411['SmsInteractionId']}})[_0x2fbb('0x1a')](function(_0x179696){if(_0x179696){_0x179696[_0x2fbb('0x1b')]({'lastMsgAt':_0x40b411['createdAt'],'lastMsgDirection':_0x40b411['direction']['toLowerCase']()});}})[_0x2fbb('0x1c')](function(_0x3885b0){console['error'](_0x3885b0);});}if(_0x40b411['direction']==='out'&&!_0x40b411[_0x2fbb('0x15')]){var _0x20ddcd;_0x3a494c[_0x2fbb('0x1d')][_0x2fbb('0x1e')]({'where':{'id':_0x40b411['SmsAccountId']},'raw':!![]})[_0x2fbb('0x1a')](function(_0x700331){_0x20ddcd=_0x700331;if(_0x20ddcd&&_0x20ddcd['type']){switch(_0x20ddcd[_0x2fbb('0x1f')]){case _0x2fbb('0x20'):var _0xcc8136=require(_0x2fbb('0x20'));if(_0x20ddcd['accountSid']&&_0x20ddcd[_0x2fbb('0x21')]&&_0x20ddcd[_0x2fbb('0x22')]){var _0x30de5c=new _0xcc8136(_0x20ddcd[_0x2fbb('0x23')],_0x20ddcd[_0x2fbb('0x21')]);_0x30de5c[_0x2fbb('0x24')][_0x2fbb('0x25')]({'body':_0x40b411[_0x2fbb('0x26')],'to':_0x40b411['phone'],'from':_0x20ddcd['phone'],'statusCallback':_0x20ddcd['remote']+'/api/sms/messages/'+_0x40b411['id']+_0x2fbb('0x27')+_0x20ddcd[_0x2fbb('0x28')]})[_0x2fbb('0x1a')](function(_0x479338){if(_0x479338[_0x2fbb('0x29')]){return _0x24b53d[_0x2fbb('0x1b')]({'messageId':_0x479338[_0x2fbb('0x29')]});}})['catch'](function(_0x181a96){logger[_0x2fbb('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2fbb('0x2b'),_0x2fbb('0x20'),util[_0x2fbb('0x2c')](_0x181a96,{'showHidden':![],'depth':null}));});}else{logger[_0x2fbb('0x2a')](_0x2fbb('0x2d'),_0x2fbb('0x2b'),_0x2fbb('0x20'),_0x2fbb('0x2e'));}break;case _0x2fbb('0x2f'):var _0x58f9bf=_0x2fbb('0x30');if(_0x20ddcd[_0x2fbb('0x31')]&&_0x20ddcd[_0x2fbb('0x32')]){var _0x163f88={'recipient':[_0x40b411[_0x2fbb('0x22')]],'message':_0x40b411[_0x2fbb('0x26')],'message_type':_0x20ddcd[_0x2fbb('0x33')]};if(_0x20ddcd[_0x2fbb('0x33')]&&_0x20ddcd[_0x2fbb('0x33')]!=='SI'){_0x163f88[_0x2fbb('0x34')]=_0x20ddcd[_0x2fbb('0x22')];}var _0x5e40da={'url':_0x58f9bf+_0x2fbb('0x35')+_0x20ddcd[_0x2fbb('0x31')]+_0x2fbb('0x36')+_0x20ddcd[_0x2fbb('0x32')],'method':_0x2fbb('0x37')};rp(_0x5e40da)[_0x2fbb('0x1a')](function(_0x5f20b6){var _0x2f93e8=_0x5f20b6[_0x2fbb('0x38')](';');var _0x5c9910={'user_key':_0x2f93e8[0x0],'session_key':_0x2f93e8[0x1]};_0x5e40da={'url':_0x58f9bf+_0x2fbb('0x39'),'method':_0x2fbb('0x3a'),'headers':{'user_key':_0x5c9910[_0x2fbb('0x3b')],'Session_key':_0x5c9910[_0x2fbb('0x3c')]},'json':!![],'body':_0x163f88};return rp(_0x5e40da);})[_0x2fbb('0x1a')](function(_0x12795f){if(_0x12795f['total_sent']>=0x1){var _0x46be43={'messageId':_0x12795f[_0x2fbb('0x3d')]};if(_0x20ddcd[_0x2fbb('0x33')]!=='GP'||!_0x20ddcd[_0x2fbb('0x3e')]){_0x46be43[_0x2fbb('0x3f')]=!![];}return _0x24b53d['update'](_0x46be43);}else{return logger['error'](_0x2fbb('0x2d'),_0x2fbb('0x2b'),_0x2fbb('0x2f'),util[_0x2fbb('0x2c')](_0x12795f,{'showHidden':![],'depth':null}));}})[_0x2fbb('0x1c')](function(_0x2c4b04){return logger[_0x2fbb('0x2a')](_0x2fbb('0x2d'),_0x2fbb('0x2b'),_0x2fbb('0x2f'),util[_0x2fbb('0x2c')](_0x2c4b04,{'showHidden':![],'depth':null}));});}else{logger[_0x2fbb('0x2a')](_0x2fbb('0x2d'),_0x2fbb('0x2b'),_0x2fbb('0x2f'),_0x2fbb('0x40'));}break;case _0x2fbb('0x41'):if(_0x20ddcd[_0x2fbb('0x21')]){var _0x52f3d1={'recipient':_0x40b411[_0x2fbb('0x22')],'message':_0x40b411[_0x2fbb('0x26')],'sender':_0x20ddcd['senderString']||_0x20ddcd[_0x2fbb('0x22')],'authorization':_0x20ddcd['authToken']};var _0x106940={'method':_0x2fbb('0x3a'),'uri':_0x2fbb('0x42'),'body':_0x52f3d1,'json':!![]};rp(_0x106940)[_0x2fbb('0x1a')](function(_0x436dc7){var _0x51706a={'messageId':_0x436dc7[_0x2fbb('0x43')]};if(!_0x20ddcd['deliveryReport']){_0x51706a[_0x2fbb('0x3f')]=!![];}return _0x24b53d[_0x2fbb('0x1b')](_0x51706a);})[_0x2fbb('0x1c')](function(_0x310211){logger[_0x2fbb('0x2a')](_0x2fbb('0x2d'),_0x2fbb('0x2b'),_0x2fbb('0x41'),util[_0x2fbb('0x2c')](_0x310211,{'showHidden':![],'depth':null}));});}else{logger[_0x2fbb('0x2a')](_0x2fbb('0x2d'),_0x2fbb('0x2b'),_0x2fbb('0x41'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x20ddcd['username']&&_0x20ddcd['password']){var _0x52f3d1={'messages':[{'source':'xCALLY\x20Motion','to':_0x40b411['phone'],'body':_0x40b411[_0x2fbb('0x26')],'from':_0x20ddcd[_0x2fbb('0x44')]||_0x20ddcd[_0x2fbb('0x22')]}]};var _0x5627c6=util[_0x2fbb('0x45')](_0x2fbb('0x46'),_0x20ddcd[_0x2fbb('0x31')],_0x20ddcd['password']);var _0x106940={'method':'POST','uri':_0x2fbb('0x47'),'body':_0x52f3d1,'headers':{'Authorization':util['format'](_0x2fbb('0x48'),new Buffer(_0x5627c6)[_0x2fbb('0x49')](_0x2fbb('0x4a')))},'json':!![]};rp(_0x106940)[_0x2fbb('0x1a')](function(_0x3efe13){if(_0x3efe13[_0x2fbb('0x4b')]>=0xc8&&_0x3efe13[_0x2fbb('0x4b')]<=0xce){if(_0x3efe13[_0x2fbb('0x4c')]&&_0x3efe13[_0x2fbb('0x4c')][_0x2fbb('0x4d')]>0x0){var _0x49c74d=_['head'](_0x3efe13[_0x2fbb('0x4c')]['messages']);var _0x272f99={'messageId':_0x49c74d[_0x2fbb('0x4e')]};if(!_0x20ddcd['deliveryReport']){_0x272f99[_0x2fbb('0x3f')]=!![];}return _0x24b53d[_0x2fbb('0x1b')](_0x272f99);}else{logger[_0x2fbb('0x2a')](_0x2fbb('0x2d'),_0x2fbb('0x2b'),'clickSend',util[_0x2fbb('0x2c')](_0x3efe13,{'showHidden':![],'depth':null}));}}else{logger[_0x2fbb('0x2a')](_0x2fbb('0x2d'),_0x2fbb('0x2b'),_0x2fbb('0x4f'),util[_0x2fbb('0x2c')](_0x3efe13,{'showHidden':![],'depth':null}));}})[_0x2fbb('0x1c')](function(_0x26541f){logger['error'](_0x2fbb('0x2d'),_0x2fbb('0x2b'),_0x2fbb('0x4f'),util[_0x2fbb('0x2c')](_0x26541f,{'showHidden':![],'depth':null}));});}else{logger[_0x2fbb('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2fbb('0x2b'),'clickSend',_0x2fbb('0x40'));}break;case _0x2fbb('0x50'):if(_0x20ddcd[_0x2fbb('0x51')]&&_0x20ddcd[_0x2fbb('0x21')]){var _0x52f3d1={'dst':_0x40b411[_0x2fbb('0x22')],'text':_0x40b411[_0x2fbb('0x26')],'src':_0x20ddcd[_0x2fbb('0x44')]||_0x20ddcd['phone'],'url':_0x20ddcd[_0x2fbb('0x52')]+_0x2fbb('0x53')+_0x40b411['id']+_0x2fbb('0x27')+_0x20ddcd[_0x2fbb('0x28')]};var _0x5627c6=util['format'](_0x2fbb('0x46'),_0x20ddcd[_0x2fbb('0x51')],_0x20ddcd[_0x2fbb('0x21')]);var _0x106940={'method':_0x2fbb('0x3a'),'uri':util[_0x2fbb('0x45')](_0x2fbb('0x54'),_0x20ddcd[_0x2fbb('0x51')]),'body':_0x52f3d1,'headers':{'Authorization':util['format'](_0x2fbb('0x48'),new Buffer(_0x5627c6)[_0x2fbb('0x49')](_0x2fbb('0x4a')))},'json':!![]};rp(_0x106940)[_0x2fbb('0x1a')](function(_0x3f1bee){var _0x58c342={'messageId':_0x3f1bee[_0x2fbb('0x55')][0x0]};return _0x24b53d['update'](_0x58c342);})[_0x2fbb('0x1c')](function(_0xa92337){logger[_0x2fbb('0x2a')](_0x2fbb('0x2d'),_0x2fbb('0x2b'),_0x2fbb('0x50'),util['inspect'](_0xa92337,{'showHidden':![],'depth':null}));});}else{logger[_0x2fbb('0x2a')](_0x2fbb('0x2d'),'afterCreate',_0x2fbb('0x50'),_0x2fbb('0x56'));}break;case _0x2fbb('0x57'):if(_0x20ddcd[_0x2fbb('0x31')]&&_0x20ddcd[_0x2fbb('0x32')]){if(_0x20ddcd[_0x2fbb('0x58')]){var _0x5b0305={'method':'POST','uri':_0x20ddcd[_0x2fbb('0x58')]+'/auth/1/session','body':{'username':_0x20ddcd['username'],'password':_0x20ddcd['password']},'json':!![]};return rp(_0x5b0305)[_0x2fbb('0x1a')](function(_0x39c052){var _0x59b756={'method':_0x2fbb('0x3a'),'uri':_0x20ddcd[_0x2fbb('0x58')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x20ddcd[_0x2fbb('0x22')],'destinations':[{'to':_0x40b411[_0x2fbb('0x22')]}],'text':_0x40b411[_0x2fbb('0x26')],'notifyUrl':_0x20ddcd[_0x2fbb('0x52')]+_0x2fbb('0x53')+_0x40b411['id']+_0x2fbb('0x27')+_0x20ddcd[_0x2fbb('0x28')],'notifyContentType':_0x2fbb('0x59'),'callbackData':_0x20ddcd[_0x2fbb('0x22')]+';'+_0x40b411[_0x2fbb('0x26')]}]},'headers':{'Authorization':_0x2fbb('0x5a')+_0x39c052['token']},'json':!![]};return rp(_0x59b756)[_0x2fbb('0x1a')](function(_0x270ac0){if(_0x270ac0[_0x2fbb('0x24')]){var _0x13b132={'messageId':_0x270ac0[_0x2fbb('0x24')][0x0]['messageId']};if(!_0x20ddcd['deliveryReport']){_0x13b132[_0x2fbb('0x3f')]=!![];}return _0x24b53d[_0x2fbb('0x1b')](_0x13b132);}else{return logger[_0x2fbb('0x2a')](_0x2fbb('0x2d'),_0x2fbb('0x2b'),'infobip',util['inspect'](_0x270ac0,{'showHidden':![],'depth':null}));}});})[_0x2fbb('0x1c')](function(_0x2a38f6){return logger['error'](_0x2fbb('0x2d'),_0x2fbb('0x2b'),_0x2fbb('0x57'),util['inspect'](_0x2a38f6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2fbb('0x2d'),_0x2fbb('0x2b'),_0x2fbb('0x57'),_0x2fbb('0x5b'));}}else{logger[_0x2fbb('0x2a')](_0x2fbb('0x2d'),_0x2fbb('0x2b'),_0x2fbb('0x57'),_0x2fbb('0x40'));}break;case _0x2fbb('0x5c'):var _0x33fcf0=require(_0x2fbb('0x5d'));if(_0x20ddcd[_0x2fbb('0x5e')]){var _0x51cf76={};_0x51cf76[_0x2fbb('0x5f')]=_0x20ddcd['username'];_0x51cf76[_0x2fbb('0x22')]=_0x40b411[_0x2fbb('0x22')];_0x51cf76[_0x2fbb('0x34')]=_0x20ddcd[_0x2fbb('0x22')];_0x51cf76[_0x2fbb('0x60')]=_0x40b411['body'];_0x51cf76['timestamp']=+new Date();var _0x1bd8a8='';var _0x57cfcd='';var _0x31dfd2=Object['keys'](_0x51cf76);_0x31dfd2[_0x2fbb('0x61')]();for(var _0x219cd8=0x0;_0x219cd8<_0x31dfd2[_0x2fbb('0x62')];_0x219cd8++){if(_0x1bd8a8!=''){_0x1bd8a8+='&';}_0x1bd8a8+=_0x31dfd2[_0x219cd8]+'='+encodeURIComponent(_0x51cf76[_0x31dfd2[_0x219cd8]]);_0x57cfcd+=_0x51cf76[_0x31dfd2[_0x219cd8]];}_0x57cfcd+=_0x20ddcd['apiKey'];_0x57cfcd=_0x33fcf0[_0x2fbb('0x63')](_0x2fbb('0x64'))['update'](_0x57cfcd)[_0x2fbb('0x65')](_0x2fbb('0x66'));if(_0x1bd8a8!==''){_0x1bd8a8+='&';}_0x1bd8a8+=_0x2fbb('0x67')+_0x57cfcd;var _0x5e40da={'method':'GET','uri':_0x20ddcd[_0x2fbb('0x58')]+_0x2fbb('0x68')+_0x1bd8a8,'json':!![]};return rp(_0x5e40da)[_0x2fbb('0x1a')](function(_0x4491c9){var _0x4c1590=Object[_0x2fbb('0x69')](_0x4491c9);if(_0x4491c9[_0x4c1590[0x0]][_0x2fbb('0x2a')]&&parseInt(_0x4491c9[_0x4c1590[0x0]][_0x2fbb('0x2a')])===0x0){var _0x3da58f={'messageId':_0x4491c9[_0x4c1590[0x0]][_0x2fbb('0x6a')]};if(!_0x20ddcd[_0x2fbb('0x3e')]){_0x3da58f['read']=!![];}return _0x24b53d[_0x2fbb('0x1b')](_0x3da58f);}else{return logger[_0x2fbb('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2fbb('0x2b'),'csc',util[_0x2fbb('0x2c')](_0x4491c9[_0x2fbb('0x2a')],{'showHidden':![],'depth':null}));}})[_0x2fbb('0x1c')](function(_0x46e3a7){return logger[_0x2fbb('0x2a')](_0x2fbb('0x2d'),_0x2fbb('0x2b'),_0x2fbb('0x5c'),util[_0x2fbb('0x2c')](_0x46e3a7,{'showHidden':![],'depth':null}));});}else{logger[_0x2fbb('0x2a')](_0x2fbb('0x2d'),_0x2fbb('0x2b'),_0x2fbb('0x5c'),'Missing\x20parameters:\x20apiKey');}break;case _0x2fbb('0x6b'):if(_0x20ddcd['apiKey']){var _0x51909e={'method':'POST','uri':_0x2fbb('0x6c'),'headers':{'Authorization':_0x20ddcd[_0x2fbb('0x5e')]},'body':{'content':_0x40b411[_0x2fbb('0x26')],'to':[_0x40b411[_0x2fbb('0x22')]],'from':_0x20ddcd[_0x2fbb('0x22')],'binary':![],'clientMessageId':_0x2fbb('0x6d'),'charset':_0x2fbb('0x6e')},'json':!![]};rp(_0x51909e)['then'](function(_0x54fdac){if(!_0x54fdac['error']){var _0x1a59f4={'messageId':_0x54fdac['messages'][0x0][_0x2fbb('0x6f')]};if(!_0x20ddcd[_0x2fbb('0x3e')]){_0x1a59f4[_0x2fbb('0x3f')]=!![];}return _0x24b53d[_0x2fbb('0x1b')](_0x1a59f4);}else{return logger['error'](_0x2fbb('0x2d'),_0x2fbb('0x2b'),_0x2fbb('0x6b'),util[_0x2fbb('0x2c')](_0x54fdac[_0x2fbb('0x2a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0xe80df1){return logger[_0x2fbb('0x2a')](_0x2fbb('0x2d'),_0x2fbb('0x2b'),_0x2fbb('0x6b'),util['inspect'](_0xe80df1,{'showHidden':![],'depth':null}));});}else{logger[_0x2fbb('0x2a')](_0x2fbb('0x2d'),_0x2fbb('0x2b'),_0x2fbb('0x6b'),'Missing\x20parameters:\x20apiKey');}break;case _0x2fbb('0x70'):if(_0x20ddcd[_0x2fbb('0x31')]&&_0x20ddcd[_0x2fbb('0x32')]){var _0x5627c6=util[_0x2fbb('0x45')](_0x2fbb('0x46'),_0x20ddcd[_0x2fbb('0x31')],_0x20ddcd['password']);var _0x106940={'method':_0x2fbb('0x3a'),'uri':_0x2fbb('0x71')+_0x20ddcd[_0x2fbb('0x72')]+_0x2fbb('0x73'),'body':{'to':[_0x40b411['phone']],'text':_0x40b411['body'],'from':_0x20ddcd[_0x2fbb('0x22')],'applicationId':_0x20ddcd[_0x2fbb('0x74')]},'headers':{'Authorization':util[_0x2fbb('0x45')](_0x2fbb('0x48'),new Buffer(_0x5627c6)[_0x2fbb('0x49')](_0x2fbb('0x4a')))},'json':!![]};rp(_0x106940)[_0x2fbb('0x1a')](function(_0x5a184a){if(_0x5a184a['id']){var _0x590f9c={'messageId':_0x5a184a['id']};return _0x24b53d[_0x2fbb('0x1b')](_0x590f9c);}else{logger[_0x2fbb('0x2a')](_0x2fbb('0x2d'),_0x2fbb('0x2b'),_0x2fbb('0x70'),util['inspect'](_0x5a184a,{'showHidden':![],'depth':null}));}})[_0x2fbb('0x1c')](function(_0x123bf7){logger[_0x2fbb('0x2a')](_0x2fbb('0x2d'),_0x2fbb('0x2b'),'bandwidth',util[_0x2fbb('0x2c')](_0x123bf7,{'showHidden':![],'depth':null}));});}else{logger[_0x2fbb('0x2a')](_0x2fbb('0x2d'),'afterCreate','bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0x2fbb('0x75'):if(_0x20ddcd[_0x2fbb('0x5e')]){var _0x448d4c={};var _0x5e40da={'method':'POST','uri':_0x2fbb('0x76'),'headers':{'Authorization':_0x2fbb('0x77')+_0x20ddcd['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x20ddcd[_0x2fbb('0x22')],'to':_0x40b411[_0x2fbb('0x22')],'text':_0x40b411[_0x2fbb('0x26')]},'json':!![]};return rp(_0x5e40da)[_0x2fbb('0x1a')](function(_0x2fbb65){if(_0x2fbb65[_0x2fbb('0x78')]==0xca){_0x448d4c['message']=_0x2fbb65;var _0x176172={'method':_0x2fbb('0x3a'),'uri':_0x2fbb('0x79'),'headers':{'Authorization':_0x2fbb('0x77')+_0x20ddcd[_0x2fbb('0x5e')],'Content-Type':_0x2fbb('0x59')},'body':{'refid':_0x448d4c[_0x2fbb('0x7a')][_0x2fbb('0x7b')]},'json':!![]};return rp(_0x176172)[_0x2fbb('0x1a')](function(_0x3405c0){_0x448d4c[_0x2fbb('0x7c')]=_0x3405c0;var _0x50f950={'messageId':_0x448d4c[_0x2fbb('0x7a')]['refid'],'read':!![]};return _0x24b53d['update'](_0x50f950);});}else{return logger[_0x2fbb('0x2a')](_0x2fbb('0x2d'),_0x2fbb('0x2b'),_0x2fbb('0x75'),util[_0x2fbb('0x2c')](_0x2fbb65,{'showHidden':![],'depth':null}));}})[_0x2fbb('0x1c')](function(_0x4f96b0){return logger[_0x2fbb('0x2a')](_0x2fbb('0x2d'),_0x2fbb('0x2b'),_0x2fbb('0x75'),util[_0x2fbb('0x2c')](_0x4f96b0,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x2fbb('0x2d'),_0x2fbb('0x2b'),'intelepeer',_0x2fbb('0x7d'));}break;}}})[_0x2fbb('0x7e')](function(){_0xd69176();});}else{_0xd69176();}}},'charset':_0x2fbb('0x7f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x76d5=['token','sid','catch','error','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','Missing\x20parameters:\x20authToken','username','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','message_id','read','clickSend','plivo','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','toString','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','createHash','digest','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','accountId','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','status','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','SmsInteractionId','then','update','createdAt','SmsAccount','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','remote','/status?token='];(function(_0x30ffd8,_0x22bbab){var _0x2f9ef4=function(_0x5e7803){while(--_0x5e7803){_0x30ffd8['push'](_0x30ffd8['shift']());}};_0x2f9ef4(++_0x22bbab);}(_0x76d5,0x145));var _0x576d=function(_0x257f69,_0xb49d46){_0x257f69=_0x257f69-0x0;var _0xf98ab6=_0x76d5[_0x257f69];return _0xf98ab6;};'use strict';var _=require(_0x576d('0x0'));var util=require(_0x576d('0x1'));var logger=require('../../config/logger')(_0x576d('0x2'));var moment=require(_0x576d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x576d('0x4'));var rimraf=require(_0x576d('0x5'));var config=require(_0x576d('0x6'));var attributes=require(_0x576d('0x7'));module[_0x576d('0x8')]=function(_0x2ef839,_0x53ac2b){return _0x2ef839[_0x576d('0x9')](_0x576d('0xa'),attributes,{'tableName':_0x576d('0xb'),'paranoid':![],'indexes':[{'name':_0x576d('0xc'),'fields':[_0x576d('0xc')]},{'name':'fti_sms_messages','fields':[_0x576d('0xd')],'type':_0x576d('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x120b38,_0x58af00,_0x14374b){var _0x51b8e7=_0x2ef839['models'];var _0x186038=_0x120b38[_0x576d('0xf')]({'plain':!![]});if(_0x186038[_0x576d('0x10')][_0x576d('0x11')]()==='in'||_0x186038[_0x576d('0x10')][_0x576d('0x11')]()===_0x576d('0x12')&&!_0x186038[_0x576d('0x13')]&&!_[_0x576d('0x14')](_0x186038[_0x576d('0x15')])){_0x51b8e7[_0x576d('0x16')]['findOne']({'where':{'id':_0x186038[_0x576d('0x17')]}})[_0x576d('0x18')](function(_0x2528db){if(_0x2528db){_0x2528db[_0x576d('0x19')]({'lastMsgAt':_0x186038[_0x576d('0x1a')],'lastMsgDirection':_0x186038['direction'][_0x576d('0x11')]()});}})['catch'](function(_0x1cfc51){console['error'](_0x1cfc51);});}if(_0x186038[_0x576d('0x10')]===_0x576d('0x12')&&!_0x186038[_0x576d('0x13')]){var _0x35db4c;_0x51b8e7[_0x576d('0x1b')]['find']({'where':{'id':_0x186038[_0x576d('0x1c')]},'raw':!![]})['then'](function(_0x5d4b6b){_0x35db4c=_0x5d4b6b;if(_0x35db4c&&_0x35db4c[_0x576d('0x1d')]){switch(_0x35db4c[_0x576d('0x1d')]){case _0x576d('0x1e'):var _0x2d1a10=require('twilio');if(_0x35db4c[_0x576d('0x1f')]&&_0x35db4c['authToken']&&_0x35db4c[_0x576d('0x20')]){var _0x5d6413=new _0x2d1a10(_0x35db4c[_0x576d('0x1f')],_0x35db4c[_0x576d('0x21')]);_0x5d6413[_0x576d('0x22')][_0x576d('0x23')]({'body':_0x186038[_0x576d('0xd')],'to':_0x186038[_0x576d('0x20')],'from':_0x35db4c[_0x576d('0x20')],'statusCallback':_0x35db4c[_0x576d('0x24')]+'/api/sms/messages/'+_0x186038['id']+_0x576d('0x25')+_0x35db4c[_0x576d('0x26')]})[_0x576d('0x18')](function(_0xaba517){if(_0xaba517['sid']){return _0x120b38[_0x576d('0x19')]({'messageId':_0xaba517[_0x576d('0x27')]});}})[_0x576d('0x28')](function(_0xc6b057){logger[_0x576d('0x29')](_0x576d('0x2a'),'afterCreate',_0x576d('0x1e'),util[_0x576d('0x2b')](_0xc6b057,{'showHidden':![],'depth':null}));});}else{logger[_0x576d('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x576d('0x2c'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x576d('0x2d'):var _0x512204=_0x576d('0x2e');if(_0x35db4c['username']&&_0x35db4c[_0x576d('0x2f')]){var _0x264435={'recipient':[_0x186038[_0x576d('0x20')]],'message':_0x186038['body'],'message_type':_0x35db4c['smsMethod']};if(_0x35db4c[_0x576d('0x30')]&&_0x35db4c[_0x576d('0x30')]!=='SI'){_0x264435[_0x576d('0x31')]=_0x35db4c['phone'];}var _0x479f34={'url':_0x512204+'login?username='+_0x35db4c['username']+_0x576d('0x32')+_0x35db4c[_0x576d('0x2f')],'method':_0x576d('0x33')};rp(_0x479f34)[_0x576d('0x18')](function(_0x172e88){var _0xae3c6b=_0x172e88[_0x576d('0x34')](';');var _0x208860={'user_key':_0xae3c6b[0x0],'session_key':_0xae3c6b[0x1]};_0x479f34={'url':_0x512204+_0x576d('0x35'),'method':_0x576d('0x36'),'headers':{'user_key':_0x208860[_0x576d('0x37')],'Session_key':_0x208860[_0x576d('0x38')]},'json':!![],'body':_0x264435};return rp(_0x479f34);})[_0x576d('0x18')](function(_0x298a38){if(_0x298a38[_0x576d('0x39')]>=0x1){var _0x1cc10d={'messageId':_0x298a38[_0x576d('0x3a')]};if(_0x35db4c[_0x576d('0x30')]!=='GP'||!_0x35db4c[_0x576d('0x3b')]){_0x1cc10d['read']=!![];}return _0x120b38[_0x576d('0x19')](_0x1cc10d);}else{return logger['error'](_0x576d('0x2a'),_0x576d('0x2c'),_0x576d('0x2d'),util[_0x576d('0x2b')](_0x298a38,{'showHidden':![],'depth':null}));}})['catch'](function(_0x65a7e4){return logger[_0x576d('0x29')](_0x576d('0x2a'),'afterCreate',_0x576d('0x2d'),util[_0x576d('0x2b')](_0x65a7e4,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x576d('0x2a'),_0x576d('0x2c'),_0x576d('0x2d'),_0x576d('0x3c'));}break;case'connectel':if(_0x35db4c[_0x576d('0x21')]){var _0x5340fe={'recipient':_0x186038['phone'],'message':_0x186038[_0x576d('0xd')],'sender':_0x35db4c[_0x576d('0x3d')]||_0x35db4c[_0x576d('0x20')],'authorization':_0x35db4c[_0x576d('0x21')]};var _0x58af00={'method':_0x576d('0x36'),'uri':_0x576d('0x3e'),'body':_0x5340fe,'json':!![]};rp(_0x58af00)[_0x576d('0x18')](function(_0x42b7cf){var _0x30a6ac={'messageId':_0x42b7cf[_0x576d('0x3f')]};if(!_0x35db4c[_0x576d('0x3b')]){_0x30a6ac['read']=!![];}return _0x120b38[_0x576d('0x19')](_0x30a6ac);})['catch'](function(_0x1aabd9){logger[_0x576d('0x29')](_0x576d('0x2a'),'afterCreate',_0x576d('0x40'),util[_0x576d('0x2b')](_0x1aabd9,{'showHidden':![],'depth':null}));});}else{logger[_0x576d('0x29')](_0x576d('0x2a'),'afterCreate',_0x576d('0x40'),_0x576d('0x41'));}break;case'clicksend':if(_0x35db4c[_0x576d('0x42')]&&_0x35db4c[_0x576d('0x2f')]){var _0x5340fe={'messages':[{'source':_0x576d('0x43'),'to':_0x186038[_0x576d('0x20')],'body':_0x186038[_0x576d('0xd')],'from':_0x35db4c[_0x576d('0x3d')]||_0x35db4c[_0x576d('0x20')]}]};var _0x7c621d=util[_0x576d('0x44')](_0x576d('0x45'),_0x35db4c['username'],_0x35db4c[_0x576d('0x2f')]);var _0x58af00={'method':_0x576d('0x36'),'uri':_0x576d('0x46'),'body':_0x5340fe,'headers':{'Authorization':util[_0x576d('0x44')](_0x576d('0x47'),new Buffer(_0x7c621d)['toString'](_0x576d('0x48')))},'json':!![]};rp(_0x58af00)[_0x576d('0x18')](function(_0x2de9c7){if(_0x2de9c7[_0x576d('0x49')]>=0xc8&&_0x2de9c7['http_code']<=0xce){if(_0x2de9c7[_0x576d('0x4a')]&&_0x2de9c7[_0x576d('0x4a')][_0x576d('0x4b')]>0x0){var _0x3122b6=_['head'](_0x2de9c7[_0x576d('0x4a')][_0x576d('0x22')]);var _0x41a197={'messageId':_0x3122b6[_0x576d('0x4c')]};if(!_0x35db4c[_0x576d('0x3b')]){_0x41a197[_0x576d('0x4d')]=!![];}return _0x120b38['update'](_0x41a197);}else{logger[_0x576d('0x29')](_0x576d('0x2a'),_0x576d('0x2c'),'clickSend',util[_0x576d('0x2b')](_0x2de9c7,{'showHidden':![],'depth':null}));}}else{logger[_0x576d('0x29')](_0x576d('0x2a'),_0x576d('0x2c'),_0x576d('0x4e'),util[_0x576d('0x2b')](_0x2de9c7,{'showHidden':![],'depth':null}));}})[_0x576d('0x28')](function(_0x338d80){logger[_0x576d('0x29')](_0x576d('0x2a'),'afterCreate',_0x576d('0x4e'),util[_0x576d('0x2b')](_0x338d80,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x576d('0x2a'),_0x576d('0x2c'),_0x576d('0x4e'),_0x576d('0x3c'));}break;case _0x576d('0x4f'):if(_0x35db4c[_0x576d('0x50')]&&_0x35db4c['authToken']){var _0x5340fe={'dst':_0x186038[_0x576d('0x20')],'text':_0x186038[_0x576d('0xd')],'src':_0x35db4c[_0x576d('0x3d')]||_0x35db4c[_0x576d('0x20')],'url':_0x35db4c[_0x576d('0x24')]+_0x576d('0x51')+_0x186038['id']+_0x576d('0x25')+_0x35db4c['token']};var _0x7c621d=util['format'](_0x576d('0x45'),_0x35db4c['authId'],_0x35db4c['authToken']);var _0x58af00={'method':_0x576d('0x36'),'uri':util[_0x576d('0x44')](_0x576d('0x52'),_0x35db4c[_0x576d('0x50')]),'body':_0x5340fe,'headers':{'Authorization':util[_0x576d('0x44')](_0x576d('0x47'),new Buffer(_0x7c621d)[_0x576d('0x53')](_0x576d('0x48')))},'json':!![]};rp(_0x58af00)['then'](function(_0x54064f){var _0x170129={'messageId':_0x54064f['message_uuid'][0x0]};return _0x120b38[_0x576d('0x19')](_0x170129);})[_0x576d('0x28')](function(_0x232e9d){logger[_0x576d('0x29')](_0x576d('0x2a'),_0x576d('0x2c'),_0x576d('0x4f'),util[_0x576d('0x2b')](_0x232e9d,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x576d('0x4f'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x576d('0x54'):if(_0x35db4c[_0x576d('0x42')]&&_0x35db4c[_0x576d('0x2f')]){if(_0x35db4c[_0x576d('0x55')]){var _0x1ad87a={'method':_0x576d('0x36'),'uri':_0x35db4c[_0x576d('0x55')]+_0x576d('0x56'),'body':{'username':_0x35db4c[_0x576d('0x42')],'password':_0x35db4c['password']},'json':!![]};return rp(_0x1ad87a)[_0x576d('0x18')](function(_0x42c030){var _0x453f16={'method':_0x576d('0x36'),'uri':_0x35db4c['baseUrl']+_0x576d('0x57'),'body':{'messages':[{'from':_0x35db4c[_0x576d('0x20')],'destinations':[{'to':_0x186038[_0x576d('0x20')]}],'text':_0x186038[_0x576d('0xd')],'notifyUrl':_0x35db4c['remote']+_0x576d('0x51')+_0x186038['id']+_0x576d('0x25')+_0x35db4c[_0x576d('0x26')],'notifyContentType':_0x576d('0x58'),'callbackData':_0x35db4c[_0x576d('0x20')]+';'+_0x186038['body']}]},'headers':{'Authorization':_0x576d('0x59')+_0x42c030[_0x576d('0x26')]},'json':!![]};return rp(_0x453f16)[_0x576d('0x18')](function(_0x1139ec){if(_0x1139ec[_0x576d('0x22')]){var _0x3fde87={'messageId':_0x1139ec[_0x576d('0x22')][0x0][_0x576d('0xc')]};if(!_0x35db4c[_0x576d('0x3b')]){_0x3fde87[_0x576d('0x4d')]=!![];}return _0x120b38[_0x576d('0x19')](_0x3fde87);}else{return logger[_0x576d('0x29')](_0x576d('0x2a'),_0x576d('0x2c'),'infobip',util['inspect'](_0x1139ec,{'showHidden':![],'depth':null}));}});})[_0x576d('0x28')](function(_0x37647d){return logger['error'](_0x576d('0x2a'),_0x576d('0x2c'),_0x576d('0x54'),util[_0x576d('0x2b')](_0x37647d,{'showHidden':![],'depth':null}));});}else{logger[_0x576d('0x29')](_0x576d('0x2a'),_0x576d('0x2c'),'infobip',_0x576d('0x5a'));}}else{logger['error'](_0x576d('0x2a'),_0x576d('0x2c'),_0x576d('0x54'),_0x576d('0x3c'));}break;case _0x576d('0x5b'):var _0x586319=require(_0x576d('0x5c'));if(_0x35db4c[_0x576d('0x5d')]){var _0x2a0cc7={};_0x2a0cc7[_0x576d('0x5e')]=_0x35db4c[_0x576d('0x42')];_0x2a0cc7[_0x576d('0x20')]=_0x186038[_0x576d('0x20')];_0x2a0cc7[_0x576d('0x31')]=_0x35db4c['phone'];_0x2a0cc7['text']=_0x186038[_0x576d('0xd')];_0x2a0cc7['timestamp']=+new Date();var _0x1922a1='';var _0x4076d5='';var _0x2cc708=Object['keys'](_0x2a0cc7);_0x2cc708['sort']();for(var _0x15516e=0x0;_0x15516e<_0x2cc708['length'];_0x15516e++){if(_0x1922a1!=''){_0x1922a1+='&';}_0x1922a1+=_0x2cc708[_0x15516e]+'='+encodeURIComponent(_0x2a0cc7[_0x2cc708[_0x15516e]]);_0x4076d5+=_0x2a0cc7[_0x2cc708[_0x15516e]];}_0x4076d5+=_0x35db4c[_0x576d('0x5d')];_0x4076d5=_0x586319[_0x576d('0x5f')]('md5')[_0x576d('0x19')](_0x4076d5)[_0x576d('0x60')]('hex');if(_0x1922a1!==''){_0x1922a1+='&';}_0x1922a1+=_0x576d('0x61')+_0x4076d5;var _0x479f34={'method':_0x576d('0x33'),'uri':_0x35db4c[_0x576d('0x55')]+_0x576d('0x62')+_0x1922a1,'json':!![]};return rp(_0x479f34)[_0x576d('0x18')](function(_0x492909){var _0x19c492=Object['keys'](_0x492909);if(_0x492909[_0x19c492[0x0]]['error']&&parseInt(_0x492909[_0x19c492[0x0]][_0x576d('0x29')])===0x0){var _0x255f5e={'messageId':_0x492909[_0x19c492[0x0]][_0x576d('0x63')]};if(!_0x35db4c[_0x576d('0x3b')]){_0x255f5e[_0x576d('0x4d')]=!![];}return _0x120b38[_0x576d('0x19')](_0x255f5e);}else{return logger[_0x576d('0x29')](_0x576d('0x2a'),_0x576d('0x2c'),_0x576d('0x5b'),util['inspect'](_0x492909[_0x576d('0x29')],{'showHidden':![],'depth':null}));}})[_0x576d('0x28')](function(_0x47720e){return logger[_0x576d('0x29')](_0x576d('0x2a'),_0x576d('0x2c'),_0x576d('0x5b'),util[_0x576d('0x2b')](_0x47720e,{'showHidden':![],'depth':null}));});}else{logger[_0x576d('0x29')](_0x576d('0x2a'),'afterCreate',_0x576d('0x5b'),_0x576d('0x64'));}break;case'clickatell':if(_0x35db4c[_0x576d('0x5d')]){var _0x532735={'method':_0x576d('0x36'),'uri':_0x576d('0x65'),'headers':{'Authorization':_0x35db4c[_0x576d('0x5d')]},'body':{'content':_0x186038[_0x576d('0xd')],'to':[_0x186038[_0x576d('0x20')]],'from':_0x35db4c[_0x576d('0x20')],'binary':![],'clientMessageId':_0x576d('0x66'),'charset':_0x576d('0x67')},'json':!![]};rp(_0x532735)[_0x576d('0x18')](function(_0x277374){if(!_0x277374[_0x576d('0x29')]){var _0x661866={'messageId':_0x277374[_0x576d('0x22')][0x0][_0x576d('0x68')]};if(!_0x35db4c[_0x576d('0x3b')]){_0x661866['read']=!![];}return _0x120b38[_0x576d('0x19')](_0x661866);}else{return logger['error'](_0x576d('0x2a'),_0x576d('0x2c'),'clickatell',util[_0x576d('0x2b')](_0x277374[_0x576d('0x29')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x5cf886){return logger[_0x576d('0x29')](_0x576d('0x2a'),_0x576d('0x2c'),_0x576d('0x69'),util[_0x576d('0x2b')](_0x5cf886,{'showHidden':![],'depth':null}));});}else{logger[_0x576d('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x576d('0x2c'),_0x576d('0x69'),_0x576d('0x64'));}break;case'bandwidth':if(_0x35db4c[_0x576d('0x42')]&&_0x35db4c['password']){var _0x7c621d=util['format'](_0x576d('0x45'),_0x35db4c['username'],_0x35db4c[_0x576d('0x2f')]);var _0x58af00={'method':_0x576d('0x36'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x35db4c[_0x576d('0x6a')]+_0x576d('0x6b'),'body':{'to':[_0x186038[_0x576d('0x20')]],'text':_0x186038['body'],'from':_0x35db4c['phone'],'applicationId':_0x35db4c[_0x576d('0x6c')]},'headers':{'Authorization':util[_0x576d('0x44')](_0x576d('0x47'),new Buffer(_0x7c621d)[_0x576d('0x53')](_0x576d('0x48')))},'json':!![]};rp(_0x58af00)[_0x576d('0x18')](function(_0x2e8061){if(_0x2e8061['id']){var _0x332a8d={'messageId':_0x2e8061['id']};return _0x120b38[_0x576d('0x19')](_0x332a8d);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x576d('0x6d'),util[_0x576d('0x2b')](_0x2e8061,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1a755d){logger[_0x576d('0x29')](_0x576d('0x2a'),'afterCreate',_0x576d('0x6d'),util[_0x576d('0x2b')](_0x1a755d,{'showHidden':![],'depth':null}));});}else{logger[_0x576d('0x29')](_0x576d('0x2a'),_0x576d('0x2c'),_0x576d('0x6d'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x576d('0x6e'):if(_0x35db4c[_0x576d('0x5d')]){var _0x1e4b9f={};var _0x479f34={'method':_0x576d('0x36'),'uri':_0x576d('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0x35db4c[_0x576d('0x5d')],'Content-Type':_0x576d('0x58')},'body':{'from':_0x35db4c[_0x576d('0x20')],'to':_0x186038[_0x576d('0x20')],'text':_0x186038[_0x576d('0xd')]},'json':!![]};return rp(_0x479f34)[_0x576d('0x18')](function(_0x42bdb8){if(_0x42bdb8['code']==0xca){_0x1e4b9f[_0x576d('0x70')]=_0x42bdb8;var _0x4c61bc={'method':_0x576d('0x36'),'uri':_0x576d('0x71'),'headers':{'Authorization':_0x576d('0x72')+_0x35db4c[_0x576d('0x5d')],'Content-Type':'application/json'},'body':{'refid':_0x1e4b9f[_0x576d('0x70')]['refid']},'json':!![]};return rp(_0x4c61bc)[_0x576d('0x18')](function(_0x2bea41){_0x1e4b9f[_0x576d('0x73')]=_0x2bea41;var _0x4c2d19={'messageId':_0x1e4b9f[_0x576d('0x70')][_0x576d('0x74')],'read':!![]};return _0x120b38['update'](_0x4c2d19);});}else{return logger[_0x576d('0x29')](_0x576d('0x2a'),_0x576d('0x2c'),_0x576d('0x6e'),util[_0x576d('0x2b')](_0x42bdb8,{'showHidden':![],'depth':null}));}})['catch'](function(_0x236a93){return logger[_0x576d('0x29')](_0x576d('0x2a'),_0x576d('0x2c'),_0x576d('0x6e'),util[_0x576d('0x2b')](_0x236a93,{'showHidden':![],'depth':null}));});}else{return logger[_0x576d('0x29')](_0x576d('0x2a'),_0x576d('0x2c'),_0x576d('0x6e'),_0x576d('0x75'));}break;}}})[_0x576d('0x76')](function(){_0x14374b();});}else{_0x14374b();}}},'charset':_0x576d('0x77'),'collate':_0x576d('0x78')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 145e872..a88d9da 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 _0x6911=['stringify','error','SmsMessage,\x20%s,\x20%s','message','result','catch','create','options','raw','info','CreateSmsMessage','debug','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','socket.io-emitter','./smsMessage.socket','register','then','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4994ed,_0x3e82a1){var _0x1cada9=function(_0x3bf92d){while(--_0x3bf92d){_0x4994ed['push'](_0x4994ed['shift']());}};_0x1cada9(++_0x3e82a1);}(_0x6911,0xb4));var _0x1691=function(_0x74dcb9,_0xf02794){_0x74dcb9=_0x74dcb9-0x0;var _0x360e7f=_0x6911[_0x74dcb9];return _0x360e7f;};'use strict';var _=require(_0x1691('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1691('0x1'));var rs=require(_0x1691('0x2'));var fs=require('fs');var Redis=require(_0x1691('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1691('0x4'));var logger=require(_0x1691('0x5'))(_0x1691('0x6'));var config=require('../../config/environment');var jayson=require(_0x1691('0x7'));var client=jayson['client'][_0x1691('0x8')]({'port':0x232a});config[_0x1691('0x9')]=_['defaults'](config[_0x1691('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x1691('0xa'))(new Redis(config[_0x1691('0x9')]));require(_0x1691('0xb'))[_0x1691('0xc')](socket);function respondWithRpcPromise(_0x455863,_0x232dca,_0x68aeb){return new BPromise(function(_0x59529b,_0x3232e6){return client['request'](_0x455863,_0x68aeb)[_0x1691('0xd')](function(_0xa82822){logger['info']('SmsMessage,\x20%s,\x20%s',_0x232dca,'request\x20sent');logger['debug'](_0x1691('0xe'),_0x232dca,_0x1691('0xf'),JSON[_0x1691('0x10')](_0xa82822));if(_0xa82822[_0x1691('0x11')]){if(_0xa82822[_0x1691('0x11')]['code']===0x1f4){logger['error'](_0x1691('0x12'),_0x232dca,_0xa82822[_0x1691('0x11')][_0x1691('0x13')]);return _0x3232e6(_0xa82822[_0x1691('0x11')][_0x1691('0x13')]);}logger[_0x1691('0x11')](_0x1691('0x12'),_0x232dca,_0xa82822[_0x1691('0x11')][_0x1691('0x13')]);return _0x59529b(_0xa82822[_0x1691('0x11')][_0x1691('0x13')]);}else{logger['info'](_0x1691('0x12'),_0x232dca,_0x1691('0xf'));_0x59529b(_0xa82822[_0x1691('0x14')]['message']);}})[_0x1691('0x15')](function(_0x292ee5){logger[_0x1691('0x11')]('SmsMessage,\x20%s,\x20%s',_0x232dca,_0x292ee5);_0x3232e6(_0x292ee5);});});}exports['CreateSmsMessage']=function(_0x37628d){var _0x586fa0=this;return new Promise(function(_0x5e3b1a,_0x58a9c7){return db['SmsMessage'][_0x1691('0x16')](_0x37628d['body'],{'raw':_0x37628d[_0x1691('0x17')]?_0x37628d[_0x1691('0x17')][_0x1691('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x1a327d){logger[_0x1691('0x19')](_0x1691('0x1a'),_0x37628d);logger[_0x1691('0x1b')]('CreateSmsMessage',_0x37628d,JSON[_0x1691('0x10')](_0x1a327d));_0x5e3b1a(_0x1a327d);})[_0x1691('0x15')](function(_0x31abb5){logger[_0x1691('0x11')](_0x1691('0x1a'),_0x31abb5[_0x1691('0x13')],_0x37628d);_0x58a9c7(_0x586fa0[_0x1691('0x11')](0x1f4,_0x31abb5[_0x1691('0x13')]));});});}; \ No newline at end of file +var _0xcc10=['lodash','util','moment','../../config/utils','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsMessage','create','body','options','raw','CreateSmsMessage'];(function(_0x10e983,_0x2f4eda){var _0x324138=function(_0x17a377){while(--_0x17a377){_0x10e983['push'](_0x10e983['shift']());}};_0x324138(++_0x2f4eda);}(_0xcc10,0xcb));var _0x0cc1=function(_0x5bf098,_0x2115c5){_0x5bf098=_0x5bf098-0x0;var _0x12fc1e=_0xcc10[_0x5bf098];return _0x12fc1e;};'use strict';var _=require(_0x0cc1('0x0'));var util=require(_0x0cc1('0x1'));var moment=require(_0x0cc1('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(_0x0cc1('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x0cc1('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x0cc1('0x5')][_0x0cc1('0x6')]({'port':0x232a});config[_0x0cc1('0x7')]=_['defaults'](config[_0x0cc1('0x7')],{'host':_0x0cc1('0x8'),'port':0x18eb});var socket=require(_0x0cc1('0x9'))(new Redis(config[_0x0cc1('0x7')]));require('./smsMessage.socket')[_0x0cc1('0xa')](socket);function respondWithRpcPromise(_0x28ad76,_0xe6fdd2,_0x2796d9){return new BPromise(function(_0x249818,_0x59ade6){return client[_0x0cc1('0xb')](_0x28ad76,_0x2796d9)[_0x0cc1('0xc')](function(_0x47fd90){logger['info'](_0x0cc1('0xd'),_0xe6fdd2,_0x0cc1('0xe'));logger[_0x0cc1('0xf')](_0x0cc1('0x10'),_0xe6fdd2,'request\x20sent',JSON[_0x0cc1('0x11')](_0x47fd90));if(_0x47fd90[_0x0cc1('0x12')]){if(_0x47fd90['error'][_0x0cc1('0x13')]===0x1f4){logger[_0x0cc1('0x12')](_0x0cc1('0xd'),_0xe6fdd2,_0x47fd90[_0x0cc1('0x12')][_0x0cc1('0x14')]);return _0x59ade6(_0x47fd90[_0x0cc1('0x12')][_0x0cc1('0x14')]);}logger[_0x0cc1('0x12')](_0x0cc1('0xd'),_0xe6fdd2,_0x47fd90[_0x0cc1('0x12')][_0x0cc1('0x14')]);return _0x249818(_0x47fd90[_0x0cc1('0x12')]['message']);}else{logger['info'](_0x0cc1('0xd'),_0xe6fdd2,_0x0cc1('0xe'));_0x249818(_0x47fd90[_0x0cc1('0x15')][_0x0cc1('0x14')]);}})[_0x0cc1('0x16')](function(_0x3b28e1){logger['error'](_0x0cc1('0xd'),_0xe6fdd2,_0x3b28e1);_0x59ade6(_0x3b28e1);});});}exports['CreateSmsMessage']=function(_0x50e447){var _0x46b845=this;return new Promise(function(_0x55b617,_0x11295f){return db[_0x0cc1('0x17')][_0x0cc1('0x18')](_0x50e447[_0x0cc1('0x19')],{'raw':_0x50e447[_0x0cc1('0x1a')]?_0x50e447[_0x0cc1('0x1a')][_0x0cc1('0x1b')]===undefined?!![]:![]:!![]})[_0x0cc1('0xc')](function(_0x39d6e2){logger['info'](_0x0cc1('0x1c'),_0x50e447);logger[_0x0cc1('0xf')]('CreateSmsMessage',_0x50e447,JSON['stringify'](_0x39d6e2));_0x55b617(_0x39d6e2);})[_0x0cc1('0x16')](function(_0x23d587){logger[_0x0cc1('0x12')](_0x0cc1('0x1c'),_0x23d587['message'],_0x50e447);_0x11295f(_0x46b845['error'](0x1f4,_0x23d587[_0x0cc1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 1f98e90..6cf207d 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 _0x9113=['./smsMessage.events','save','remove','update','removeListener','register','length','smsMessage:'];(function(_0x23900a,_0x4eff17){var _0x55431e=function(_0x1df270){while(--_0x1df270){_0x23900a['push'](_0x23900a['shift']());}};_0x55431e(++_0x4eff17);}(_0x9113,0x80));var _0x3911=function(_0x5812e9,_0xd5038e){_0x5812e9=_0x5812e9-0x0;var _0x8567cc=_0x9113[_0x5812e9];return _0x8567cc;};'use strict';var SmsMessageEvents=require(_0x3911('0x0'));var events=[_0x3911('0x1'),_0x3911('0x2'),_0x3911('0x3')];function createListener(_0x713a02,_0x397412){return function(_0x162db3){_0x397412['emit'](_0x713a02,_0x162db3);};}function removeListener(_0x2d304e,_0x1f9dc1){return function(){SmsMessageEvents[_0x3911('0x4')](_0x2d304e,_0x1f9dc1);};}exports[_0x3911('0x5')]=function(_0x2b6af0){for(var _0x354393=0x0,_0x4e4956=events[_0x3911('0x6')];_0x354393<_0x4e4956;_0x354393++){var _0x19794f=events[_0x354393];var _0x33dbb1=createListener(_0x3911('0x7')+_0x19794f,_0x2b6af0);SmsMessageEvents['on'](_0x19794f,_0x33dbb1);}}; \ No newline at end of file +var _0x6365=['./smsMessage.events','save','remove','update','emit','removeListener','register','length','smsMessage:'];(function(_0x4cdbc8,_0x4d8e1d){var _0x311448=function(_0x3f37b1){while(--_0x3f37b1){_0x4cdbc8['push'](_0x4cdbc8['shift']());}};_0x311448(++_0x4d8e1d);}(_0x6365,0xcf));var _0x5636=function(_0x514942,_0x490fb5){_0x514942=_0x514942-0x0;var _0x3b3a8b=_0x6365[_0x514942];return _0x3b3a8b;};'use strict';var SmsMessageEvents=require(_0x5636('0x0'));var events=[_0x5636('0x1'),_0x5636('0x2'),_0x5636('0x3')];function createListener(_0x2a9b7e,_0x33bde6){return function(_0xa637a7){_0x33bde6[_0x5636('0x4')](_0x2a9b7e,_0xa637a7);};}function removeListener(_0xcc6a60,_0x316c0e){return function(){SmsMessageEvents[_0x5636('0x5')](_0xcc6a60,_0x316c0e);};}exports[_0x5636('0x6')]=function(_0x145aa8){for(var _0xa62dfb=0x0,_0x595256=events[_0x5636('0x7')];_0xa62dfb<_0x595256;_0xa62dfb++){var _0xde6a75=events[_0xa62dfb];var _0x3d92de=createListener(_0x5636('0x8')+_0xde6a75,_0x145aa8);SmsMessageEvents['on'](_0xde6a75,_0x3d92de);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index d1d39eb..ad2be55 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 _0x13f5=['addTeams','addAgents','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','Router','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams'];(function(_0xddf105,_0x51c527){var _0x3aa0bd=function(_0x1ee5cc){while(--_0x1ee5cc){_0xddf105['push'](_0xddf105['shift']());}};_0x3aa0bd(++_0x51c527);}(_0x13f5,0xc3));var _0x513f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x13f5[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x513f('0x0'));var util=require(_0x513f('0x1'));var path=require(_0x513f('0x2'));var timeout=require(_0x513f('0x3'));var express=require('express');var router=express[_0x513f('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x513f('0x5'));var controller=require(_0x513f('0x6'));router[_0x513f('0x7')]('/',auth[_0x513f('0x8')](),controller[_0x513f('0x9')]);router[_0x513f('0x7')](_0x513f('0xa'),auth[_0x513f('0x8')](),controller[_0x513f('0xb')]);router[_0x513f('0x7')](_0x513f('0xc'),auth[_0x513f('0x8')](),controller['show']);router[_0x513f('0x7')](_0x513f('0xd'),auth[_0x513f('0x8')](),controller[_0x513f('0xe')]);router[_0x513f('0x7')]('/:id/teams',auth[_0x513f('0x8')](),controller[_0x513f('0xf')]);router['get'](_0x513f('0x10'),auth[_0x513f('0x8')](),controller[_0x513f('0x11')]);router[_0x513f('0x12')]('/',auth[_0x513f('0x8')](),controller[_0x513f('0x13')]);router[_0x513f('0x12')](_0x513f('0x14'),auth[_0x513f('0x8')](),controller[_0x513f('0x15')]);router[_0x513f('0x12')](_0x513f('0x10'),auth[_0x513f('0x8')](),controller[_0x513f('0x16')]);router['put'](_0x513f('0xc'),auth['isAuthenticated'](),controller[_0x513f('0x17')]);router[_0x513f('0x18')](_0x513f('0xc'),auth[_0x513f('0x8')](),controller[_0x513f('0x19')]);router['delete'](_0x513f('0x14'),auth[_0x513f('0x8')](),controller['removeTeams']);router[_0x513f('0x18')]('/:id/users',auth[_0x513f('0x8')](),controller[_0x513f('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xac4f=['describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','destroy','multer','path','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x55a465,_0x54b133){var _0x2c9c73=function(_0x532d8e){while(--_0x532d8e){_0x55a465['push'](_0x55a465['shift']());}};_0x2c9c73(++_0x54b133);}(_0xac4f,0x122));var _0xfac4=function(_0x477bd1,_0x43589b){_0x477bd1=_0x477bd1-0x0;var _0x1186c2=_0xac4f[_0x477bd1];return _0x1186c2;};'use strict';var multer=require(_0xfac4('0x0'));var util=require('util');var path=require(_0xfac4('0x1'));var timeout=require('connect-timeout');var express=require(_0xfac4('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfac4('0x3'));var config=require(_0xfac4('0x4'));var controller=require('./smsQueue.controller');router[_0xfac4('0x5')]('/',auth[_0xfac4('0x6')](),controller[_0xfac4('0x7')]);router['get'](_0xfac4('0x8'),auth[_0xfac4('0x6')](),controller[_0xfac4('0x9')]);router[_0xfac4('0x5')](_0xfac4('0xa'),auth[_0xfac4('0x6')](),controller['show']);router[_0xfac4('0x5')](_0xfac4('0xb'),auth[_0xfac4('0x6')](),controller[_0xfac4('0xc')]);router[_0xfac4('0x5')](_0xfac4('0xd'),auth[_0xfac4('0x6')](),controller[_0xfac4('0xe')]);router[_0xfac4('0x5')](_0xfac4('0xf'),auth[_0xfac4('0x6')](),controller[_0xfac4('0x10')]);router['post']('/',auth[_0xfac4('0x6')](),controller['create']);router[_0xfac4('0x11')](_0xfac4('0xd'),auth[_0xfac4('0x6')](),controller[_0xfac4('0x12')]);router[_0xfac4('0x11')](_0xfac4('0xf'),auth[_0xfac4('0x6')](),controller[_0xfac4('0x13')]);router['put'](_0xfac4('0xa'),auth[_0xfac4('0x6')](),controller[_0xfac4('0x14')]);router[_0xfac4('0x15')](_0xfac4('0xa'),auth[_0xfac4('0x6')](),controller[_0xfac4('0x16')]);router[_0xfac4('0x15')](_0xfac4('0xd'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0xfac4('0xf'),auth[_0xfac4('0x6')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index ad6839e..1531842 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 _0x7944=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x280e03,_0x5421fc){var _0x431e2d=function(_0x3e5448){while(--_0x3e5448){_0x280e03['push'](_0x280e03['shift']());}};_0x431e2d(++_0x5421fc);}(_0x7944,0x9a));var _0x4794=function(_0x17a329,_0x5d2f43){_0x17a329=_0x17a329-0x0;var _0x761387=_0x7944[_0x17a329];return _0x761387;};'use strict';var Sequelize=require(_0x4794('0x0'));module[_0x4794('0x1')]={'name':{'type':Sequelize[_0x4794('0x2')],'unique':_0x4794('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x4794('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4794('0x5')](_0x4794('0x6'),_0x4794('0x7'),_0x4794('0x8'))}}; \ No newline at end of file +var _0xd38f=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x4f3735,_0x24b696){var _0x4a4e50=function(_0x4edd14){while(--_0x4edd14){_0x4f3735['push'](_0x4f3735['shift']());}};_0x4a4e50(++_0x24b696);}(_0xd38f,0xce));var _0xfd38=function(_0x1f52d9,_0x211a00){_0x1f52d9=_0x1f52d9-0x0;var _0x3a4e7c=_0xd38f[_0x1f52d9];return _0x3a4e7c;};'use strict';var Sequelize=require(_0xfd38('0x0'));module[_0xfd38('0x1')]={'name':{'type':Sequelize[_0xfd38('0x2')],'unique':_0xfd38('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfd38('0x2')]},'timeout':{'type':Sequelize[_0xfd38('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfd38('0x5')](_0xfd38('0x6'),_0xfd38('0x7'),_0xfd38('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index c00af0c..6ef266c 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 _0xf006=['rawAttributes','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','%s/%s','SIP','createdAt','getTeams','ids','Team','Agents','online','voicePause','flatMap','find','sequelize','transaction','addTeams','each','findOrCreate','emit','userSmsQueue:save','removeTeams','from','team_has_sms_queues','join','user_has_teams','clone','push','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','order','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','count','offset','limit','set','apply','save','update','then','destroy','get','SmsQueues','error','stack','name','send','index','SmsQueue','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','options','where','include','findAll','rows','catch','show','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserSmsQueue'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xf006,0x146));var _0x6f00=function(_0x1bbd18,_0x3ca09d){_0x1bbd18=_0x1bbd18-0x0;var _0x242518=_0xf006[_0x1bbd18];return _0x242518;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6f00('0x0'));var zipdir=require(_0x6f00('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f00('0x2'));var moment=require('moment');var BPromise=require(_0x6f00('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6f00('0x4'));var sox=require(_0x6f00('0x5'));var csv=require(_0x6f00('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6f00('0x7'));var squel=require('squel');var crypto=require(_0x6f00('0x8'));var jsforce=require(_0x6f00('0x9'));var deskjs=require(_0x6f00('0xa'));var toCsv=require(_0x6f00('0x6'));var querystring=require(_0x6f00('0xb'));var Papa=require(_0x6f00('0xc'));var Redis=require(_0x6f00('0xd'));var authService=require(_0x6f00('0xe'));var qs=require(_0x6f00('0xf'));var as=require(_0x6f00('0x10'));var hardwareService=require(_0x6f00('0x11'));var logger=require(_0x6f00('0x12'))(_0x6f00('0x13'));var utils=require('../../config/utils');var config=require(_0x6f00('0x14'));var licenseUtil=require(_0x6f00('0x15'));var db=require(_0x6f00('0x16'))['db'];config[_0x6f00('0x17')]=_[_0x6f00('0x18')](config['redis'],{'host':_0x6f00('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f00('0x17')]));require('./smsQueue.socket')[_0x6f00('0x1a')](socket);function respondWithStatusCode(_0x220e68,_0x327e10){_0x327e10=_0x327e10||0xcc;return function(_0x33f3a2){if(_0x33f3a2){return _0x220e68[_0x6f00('0x1b')](_0x327e10);}return _0x220e68[_0x6f00('0x1c')](_0x327e10)[_0x6f00('0x1d')]();};}function respondWithResult(_0x4d8aee,_0x342c7f){_0x342c7f=_0x342c7f||0xc8;return function(_0x4bfac3){if(_0x4bfac3){return _0x4d8aee[_0x6f00('0x1c')](_0x342c7f)['json'](_0x4bfac3);}};}function respondWithFilteredResult(_0x534275,_0x7c047e){return function(_0x6cf83f){if(_0x6cf83f){var _0x466c7c=_0x6cf83f[_0x6f00('0x1e')],_0x340f78=_0x7c047e[_0x6f00('0x1f')],_0x13f09f=_0x7c047e[_0x6f00('0x1f')]+_0x7c047e[_0x6f00('0x20')],_0x27e466;if(_0x13f09f>=_0x466c7c){_0x13f09f=_0x466c7c;_0x27e466=0xc8;}else{_0x27e466=0xce;}_0x534275[_0x6f00('0x1c')](_0x27e466);return _0x534275[_0x6f00('0x21')]('Content-Range',_0x340f78+'-'+_0x13f09f+'/'+_0x466c7c)['json'](_0x6cf83f);}return null;};}function patchUpdates(_0x5850dd){return function(_0x2a5286){try{jsonpatch[_0x6f00('0x22')](_0x2a5286,_0x5850dd,!![]);}catch(_0x43bfb8){return BPromise['reject'](_0x43bfb8);}return _0x2a5286[_0x6f00('0x23')]();};}function saveUpdates(_0x9066ff,_0x321e26){return function(_0x1da9b9){if(_0x1da9b9){return _0x1da9b9[_0x6f00('0x24')](_0x9066ff)[_0x6f00('0x25')](function(_0x90d74c){return _0x90d74c;});}return null;};}function removeEntity(_0x1ea061,_0x533d70){return function(_0x3c05ef){if(_0x3c05ef){return _0x3c05ef[_0x6f00('0x26')]()[_0x6f00('0x25')](function(){var _0x4d41ef=_0x3c05ef[_0x6f00('0x27')]({'plain':!![]});var _0x4f7e29=_0x6f00('0x28');return db['UserProfileResource'][_0x6f00('0x26')]({'where':{'type':_0x4f7e29,'resourceId':_0x4d41ef['id']}})[_0x6f00('0x25')](function(){return _0x3c05ef;});})[_0x6f00('0x25')](function(){_0x1ea061[_0x6f00('0x1c')](0xcc)[_0x6f00('0x1d')]();});}};}function handleEntityNotFound(_0x49eb87,_0x23a346){return function(_0x25cc71){if(!_0x25cc71){_0x49eb87[_0x6f00('0x1b')](0x194);}return _0x25cc71;};}function handleError(_0x4366a4,_0x2671fe){_0x2671fe=_0x2671fe||0x1f4;return function(_0x235a86){logger[_0x6f00('0x29')](_0x235a86[_0x6f00('0x2a')]);if(_0x235a86[_0x6f00('0x2b')]){delete _0x235a86[_0x6f00('0x2b')];}_0x4366a4[_0x6f00('0x1c')](_0x2671fe)[_0x6f00('0x2c')](_0x235a86);};}exports[_0x6f00('0x2d')]=function(_0x17d9d1,_0x5dde51){var _0x5775c5={},_0x5d16ad={},_0x5df06d={'count':0x0,'rows':[]};var _0x522d4f=_['map'](db[_0x6f00('0x2e')]['rawAttributes'],function(_0x3c0e5d){return{'name':_0x3c0e5d[_0x6f00('0x2f')],'type':_0x3c0e5d[_0x6f00('0x30')][_0x6f00('0x31')]};});_0x5d16ad[_0x6f00('0x32')]=_[_0x6f00('0x33')](_0x522d4f,'name');_0x5d16ad[_0x6f00('0x34')]=_[_0x6f00('0x35')](_0x17d9d1[_0x6f00('0x34')]);_0x5d16ad[_0x6f00('0x36')]=_[_0x6f00('0x37')](_0x5d16ad['model'],_0x5d16ad['query']);_0x5775c5['attributes']=_[_0x6f00('0x37')](_0x5d16ad[_0x6f00('0x32')],qs[_0x6f00('0x38')](_0x17d9d1[_0x6f00('0x34')][_0x6f00('0x38')]));_0x5775c5['attributes']=_0x5775c5[_0x6f00('0x39')][_0x6f00('0x3a')]?_0x5775c5[_0x6f00('0x39')]:_0x5d16ad[_0x6f00('0x32')];if(!_0x17d9d1[_0x6f00('0x34')][_0x6f00('0x3b')](_0x6f00('0x3c'))){_0x5775c5['limit']=qs[_0x6f00('0x20')](_0x17d9d1[_0x6f00('0x34')][_0x6f00('0x20')]);_0x5775c5['offset']=qs[_0x6f00('0x1f')](_0x17d9d1[_0x6f00('0x34')][_0x6f00('0x1f')]);}_0x5775c5['order']=qs[_0x6f00('0x3d')](_0x17d9d1['query'][_0x6f00('0x3d')]);_0x5775c5['where']=qs[_0x6f00('0x36')](_[_0x6f00('0x3e')](_0x17d9d1[_0x6f00('0x34')],_0x5d16ad[_0x6f00('0x36')]),_0x522d4f);if(_0x17d9d1['query'][_0x6f00('0x3f')]){_0x5775c5['where']=_[_0x6f00('0x40')](_0x5775c5['where'],{'$or':_[_0x6f00('0x33')](_0x522d4f,function(_0x2f1ef1){if(_0x2f1ef1[_0x6f00('0x30')]!==_0x6f00('0x41')){var _0x57c72d={};_0x57c72d[_0x2f1ef1['name']]={'$like':'%'+_0x17d9d1[_0x6f00('0x34')]['filter']+'%'};return _0x57c72d;}})});}_0x5775c5=_[_0x6f00('0x40')]({},_0x5775c5,_0x17d9d1[_0x6f00('0x42')]);var _0x4a70ea={'where':_0x5775c5[_0x6f00('0x43')]};return db['SmsQueue']['count'](_0x4a70ea)[_0x6f00('0x25')](function(_0x3c19bb){_0x5df06d[_0x6f00('0x1e')]=_0x3c19bb;if(_0x17d9d1[_0x6f00('0x34')]['includeAll']){_0x5775c5[_0x6f00('0x44')]=[{'all':!![]}];}return db[_0x6f00('0x2e')][_0x6f00('0x45')](_0x5775c5);})[_0x6f00('0x25')](function(_0x2788ad){_0x5df06d[_0x6f00('0x46')]=_0x2788ad;return _0x5df06d;})['then'](respondWithFilteredResult(_0x5dde51,_0x5775c5))[_0x6f00('0x47')](handleError(_0x5dde51,null));};exports[_0x6f00('0x48')]=function(_0x8d4dde,_0x1c8b81){var _0x303a32={'raw':!![],'where':{'id':_0x8d4dde['params']['id']}},_0x35ce8d={};_0x35ce8d[_0x6f00('0x32')]=_[_0x6f00('0x35')](db[_0x6f00('0x2e')]['rawAttributes']);_0x35ce8d[_0x6f00('0x34')]=_['keys'](_0x8d4dde[_0x6f00('0x34')]);_0x35ce8d[_0x6f00('0x36')]=_['intersection'](_0x35ce8d[_0x6f00('0x32')],_0x35ce8d['query']);_0x303a32[_0x6f00('0x39')]=_[_0x6f00('0x37')](_0x35ce8d[_0x6f00('0x32')],qs[_0x6f00('0x38')](_0x8d4dde['query'][_0x6f00('0x38')]));_0x303a32['attributes']=_0x303a32[_0x6f00('0x39')]['length']?_0x303a32[_0x6f00('0x39')]:_0x35ce8d[_0x6f00('0x32')];if(_0x8d4dde[_0x6f00('0x34')][_0x6f00('0x49')]){_0x303a32[_0x6f00('0x44')]=[{'all':!![]}];}_0x303a32=_[_0x6f00('0x40')]({},_0x303a32,_0x8d4dde[_0x6f00('0x42')]);return db[_0x6f00('0x2e')]['find'](_0x303a32)[_0x6f00('0x25')](handleEntityNotFound(_0x1c8b81,null))['then'](respondWithResult(_0x1c8b81,null))[_0x6f00('0x47')](handleError(_0x1c8b81,null));};exports[_0x6f00('0x4a')]=function(_0x27f38b,_0x5eec08){return db['SmsQueue'][_0x6f00('0x4a')](_0x27f38b[_0x6f00('0x4b')],{})['then'](function(_0x3b15c6){var _0x4b2386=_0x27f38b[_0x6f00('0x4c')]['get']({'plain':!![]});if(!_0x4b2386)throw new Error(_0x6f00('0x4d'));if(_0x4b2386[_0x6f00('0x4e')]==='user'){var _0x52ee5a=_0x3b15c6[_0x6f00('0x27')]({'plain':!![]});var _0x2520ff='SmsQueues';return db[_0x6f00('0x4f')]['find']({'where':{'name':_0x2520ff,'userProfileId':_0x4b2386[_0x6f00('0x50')]},'raw':!![]})[_0x6f00('0x25')](function(_0x3100ee){if(_0x3100ee&&_0x3100ee[_0x6f00('0x51')]===0x0){return db[_0x6f00('0x52')][_0x6f00('0x4a')]({'name':_0x52ee5a[_0x6f00('0x2b')],'resourceId':_0x52ee5a['id'],'type':_0x3100ee[_0x6f00('0x2b')],'sectionId':_0x3100ee['id']},{})[_0x6f00('0x25')](function(){return _0x3b15c6;});}else{return _0x3b15c6;}})[_0x6f00('0x47')](function(_0x1ddfa2){logger[_0x6f00('0x29')](_0x6f00('0x53'),_0x1ddfa2);throw _0x1ddfa2;});}return _0x3b15c6;})[_0x6f00('0x25')](respondWithResult(_0x5eec08,0xc9))[_0x6f00('0x47')](handleError(_0x5eec08,null));};exports[_0x6f00('0x24')]=function(_0x2ba83e,_0x1bf8d8){if(_0x2ba83e[_0x6f00('0x4b')]['id']){delete _0x2ba83e[_0x6f00('0x4b')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x2ba83e[_0x6f00('0x54')]['id']}})['then'](handleEntityNotFound(_0x1bf8d8,null))[_0x6f00('0x25')](saveUpdates(_0x2ba83e[_0x6f00('0x4b')],null))['then'](respondWithResult(_0x1bf8d8,null))[_0x6f00('0x47')](handleError(_0x1bf8d8,null));};exports[_0x6f00('0x26')]=function(_0x2c87b5,_0x4e2ddb){return db[_0x6f00('0x2e')]['find']({'where':{'id':_0x2c87b5[_0x6f00('0x54')]['id']}})[_0x6f00('0x25')](handleEntityNotFound(_0x4e2ddb,null))['then'](removeEntity(_0x4e2ddb,null))[_0x6f00('0x47')](handleError(_0x4e2ddb,null));};exports[_0x6f00('0x55')]=function(_0xd2e139,_0x111fd4){return db[_0x6f00('0x2e')][_0x6f00('0x55')]()[_0x6f00('0x25')](respondWithResult(_0x111fd4,null))['catch'](handleError(_0x111fd4,null));};exports['getMembers']=function(_0x5bd485,_0x4a421b,_0x197555){var _0x269753={'raw':!![],'where':{}},_0x5bbfdb={},_0x53e735;return db[_0x6f00('0x2e')][_0x6f00('0x56')]({'where':{'id':_0x5bd485[_0x6f00('0x54')]['id']}})[_0x6f00('0x25')](handleEntityNotFound(_0x4a421b,null))['then'](function(_0x37f5d4){if(_0x37f5d4){_0x53e735=_0x37f5d4['get']({'plain':!![]});_0x5bbfdb['model']=_[_0x6f00('0x35')](db[_0x6f00('0x57')][_0x6f00('0x58')]);_0x5bbfdb[_0x6f00('0x34')]=_[_0x6f00('0x35')](_0x5bd485['query']);_0x5bbfdb[_0x6f00('0x36')]=_[_0x6f00('0x37')](_0x5bbfdb[_0x6f00('0x32')],_0x5bbfdb[_0x6f00('0x34')]);_0x269753['attributes']=_['intersection'](_0x5bbfdb[_0x6f00('0x32')],qs['fields'](_0x5bd485[_0x6f00('0x34')][_0x6f00('0x38')]));_0x269753[_0x6f00('0x39')]=_0x269753[_0x6f00('0x39')]['length']?_0x269753['attributes']:_0x5bbfdb[_0x6f00('0x32')];if(!_0x5bd485[_0x6f00('0x34')][_0x6f00('0x3b')](_0x6f00('0x3c'))){_0x269753['limit']=qs[_0x6f00('0x20')](_0x5bd485[_0x6f00('0x34')][_0x6f00('0x20')]);_0x269753[_0x6f00('0x1f')]=qs[_0x6f00('0x1f')](_0x5bd485['query']['offset']);}_0x269753['order']=qs[_0x6f00('0x3d')](_0x5bd485[_0x6f00('0x34')]['sort']);_0x269753['where']=qs[_0x6f00('0x36')](_[_0x6f00('0x3e')](_0x5bd485['query'],_0x5bbfdb['filters']));_0x269753[_0x6f00('0x43')][_0x6f00('0x59')]=_0x37f5d4['id'];if(_0x5bd485[_0x6f00('0x34')][_0x6f00('0x3f')]){_0x269753[_0x6f00('0x43')]=_[_0x6f00('0x40')](_0x269753[_0x6f00('0x43')],{'$or':_[_0x6f00('0x33')](_0x269753['attributes'],function(_0x5b16e6){var _0x38471c={};_0x38471c[_0x5b16e6]={'$like':'%'+_0x5bd485[_0x6f00('0x34')][_0x6f00('0x3f')]+'%'};return _0x38471c;})});}_0x269753=_[_0x6f00('0x40')]({},_0x269753,_0x5bd485[_0x6f00('0x42')]);return db[_0x6f00('0x57')][_0x6f00('0x45')](_0x269753);}})[_0x6f00('0x25')](function(_0xd212a6){if(_0xd212a6){return db[_0x6f00('0x5a')][_0x6f00('0x5b')]({'where':{'id':_[_0x6f00('0x33')](_0xd212a6,_0x6f00('0x5c')),'role':_0x6f00('0x5d')},'attributes':['id',_0x6f00('0x2b'),_0x6f00('0x5e'),_0x6f00('0x5f'),'createdAt']});}})['then'](function(_0x28bdeb){if(_0x28bdeb){return{'count':_0x28bdeb['count'],'rows':_[_0x6f00('0x33')](_0x28bdeb[_0x6f00('0x46')],function(_0x3d14db){return{'membername':_0x3d14db[_0x6f00('0x2b')],'UserId':_0x3d14db['id'],'queue_name':_0x53e735[_0x6f00('0x2b')],'SmsQueueId':_0x53e735['id'],'interface':util['format'](_0x6f00('0x60'),_0x6f00('0x61'),_0x3d14db[_0x6f00('0x2b')]),'penalty':0x0,'paused':_0x3d14db[_0x6f00('0x5e')],'createdAt':_0x3d14db[_0x6f00('0x62')],'updatedAt':_0x3d14db[_0x6f00('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6f00('0x25')](respondWithFilteredResult(_0x4a421b,_0x269753))[_0x6f00('0x47')](handleError(_0x4a421b,null));};exports[_0x6f00('0x63')]=function(_0x1cc857,_0x19b5eb,_0x58a7b8){var _0x1ca7ad={};var _0xb3bb9a={};var _0x422318;var _0x511905;return db['SmsQueue'][_0x6f00('0x56')]({'where':{'id':_0x1cc857[_0x6f00('0x54')]['id']}})[_0x6f00('0x25')](handleEntityNotFound(_0x19b5eb,null))[_0x6f00('0x25')](function(_0x5a9b42){if(_0x5a9b42){_0x422318=_0x5a9b42;_0xb3bb9a['model']=_['keys'](db['Team'][_0x6f00('0x58')]);_0xb3bb9a[_0x6f00('0x34')]=_[_0x6f00('0x35')](_0x1cc857[_0x6f00('0x34')]);_0xb3bb9a[_0x6f00('0x36')]=_['intersection'](_0xb3bb9a[_0x6f00('0x32')],_0xb3bb9a[_0x6f00('0x34')]);_0x1ca7ad['attributes']=_[_0x6f00('0x37')](_0xb3bb9a[_0x6f00('0x32')],qs[_0x6f00('0x38')](_0x1cc857[_0x6f00('0x34')][_0x6f00('0x38')]));_0x1ca7ad[_0x6f00('0x39')]=_0x1ca7ad[_0x6f00('0x39')][_0x6f00('0x3a')]?_0x1ca7ad['attributes']:_0xb3bb9a[_0x6f00('0x32')];_0x1ca7ad['order']=qs[_0x6f00('0x3d')](_0x1cc857[_0x6f00('0x34')][_0x6f00('0x3d')]);_0x1ca7ad[_0x6f00('0x43')]=qs[_0x6f00('0x36')](_[_0x6f00('0x3e')](_0x1cc857[_0x6f00('0x34')],_0xb3bb9a[_0x6f00('0x36')]));if(_0x1cc857[_0x6f00('0x34')][_0x6f00('0x3f')]){_0x1ca7ad[_0x6f00('0x43')]=_[_0x6f00('0x40')](_0x1ca7ad[_0x6f00('0x43')],{'$or':_[_0x6f00('0x33')](_0x1ca7ad['attributes'],function(_0x3ba021){var _0xdfa8ff={};_0xdfa8ff[_0x3ba021]={'$like':'%'+_0x1cc857[_0x6f00('0x34')]['filter']+'%'};return _0xdfa8ff;})});}_0x1ca7ad=_[_0x6f00('0x40')]({},_0x1ca7ad,_0x1cc857[_0x6f00('0x42')]);return _0x422318['getTeams'](_0x1ca7ad);}})[_0x6f00('0x25')](function(_0x44762e){if(_0x44762e){_0x511905=_0x44762e[_0x6f00('0x3a')];if(!_0x1cc857[_0x6f00('0x34')]['hasOwnProperty']('nolimit')){_0x1ca7ad['limit']=qs[_0x6f00('0x20')](_0x1cc857[_0x6f00('0x34')][_0x6f00('0x20')]);_0x1ca7ad[_0x6f00('0x1f')]=qs['offset'](_0x1cc857[_0x6f00('0x34')][_0x6f00('0x1f')]);}return _0x422318[_0x6f00('0x63')](_0x1ca7ad);}})[_0x6f00('0x25')](function(_0x163885){if(_0x163885){return _0x163885?{'count':_0x511905,'rows':_0x163885}:null;}})[_0x6f00('0x25')](respondWithResult(_0x19b5eb,null))['catch'](handleError(_0x19b5eb,null));};exports['addTeams']=function(_0x31ce4f,_0x179fb7,_0x2f97cd){var _0x1abd35=_0x31ce4f[_0x6f00('0x4b')][_0x6f00('0x64')];return db[_0x6f00('0x65')]['findAll']({'where':{'id':_0x1abd35},'attributes':['id'],'include':[{'model':db[_0x6f00('0x5a')],'as':_0x6f00('0x66'),'attributes':['id','name',_0x6f00('0x67'),_0x6f00('0x68'),'interface'],'raw':!![]}]})['then'](function(_0x340f76){if(_0x340f76){var _0x422649=_[_0x6f00('0x69')](_0x340f76,function(_0x1e6f2c){var _0x1fb213=_0x1e6f2c[_0x6f00('0x27')]({'plain':!![]});return _0x1fb213[_0x6f00('0x66')];});return db['SmsQueue'][_0x6f00('0x6a')]({'where':{'id':_0x31ce4f[_0x6f00('0x54')]['id']}})[_0x6f00('0x25')](function(_0x431eae){return db[_0x6f00('0x6b')][_0x6f00('0x6c')](function(_0xc77edd){return _0x431eae[_0x6f00('0x6d')](_0x1abd35,{'transaction':_0xc77edd})[_0x6f00('0x25')](function(){return BPromise[_0x6f00('0x6e')](_0x422649,function(_0x25ad68){return db[_0x6f00('0x57')][_0x6f00('0x6f')]({'where':{'UserId':_0x25ad68['id'],'SmsQueueId':_0x31ce4f[_0x6f00('0x54')]['id']},'transaction':_0xc77edd});});})[_0x6f00('0x25')](function(){_0x422649['forEach'](function(_0x2dd18c){socket[_0x6f00('0x70')](_0x6f00('0x71'),{'UserId':_0x2dd18c['id'],'SmsQueueId':_0x431eae['id']});});});});});}})[_0x6f00('0x25')](respondWithStatusCode(_0x179fb7,null))['catch'](handleError(_0x179fb7,null));};exports[_0x6f00('0x72')]=function(_0x426ce1,_0x3a47ac,_0x101480){return db[_0x6f00('0x65')][_0x6f00('0x45')]({'where':{'id':_0x426ce1[_0x6f00('0x34')][_0x6f00('0x64')]},'attributes':['id'],'include':[{'model':db[_0x6f00('0x5a')],'as':_0x6f00('0x66'),'attributes':['id'],'raw':!![]}]})[_0x6f00('0x25')](handleEntityNotFound(_0x3a47ac,null))[_0x6f00('0x25')](function(_0x3692dd){var _0x2fb417=_['map'](_0x3692dd,'id');var _0x37fdfd=[];var _0x190139=[];var _0x39b2ce=squel['select']();_0x39b2ce['field']('tq.TeamId')[_0x6f00('0x73')](_0x6f00('0x74'),'tq')[_0x6f00('0x75')](_0x6f00('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6f00('0x43')]('SmsQueueId\x20=\x20?',_0x426ce1['params']['id']);for(var _0x44568b=0x0;_0x44568b<_0x3692dd[_0x6f00('0x3a')];_0x44568b+=0x1){let _0x260f1d=_0x3692dd[_0x44568b];for(var _0x1d8637=0x0;_0x1d8637<_0x260f1d[_0x6f00('0x66')][_0x6f00('0x3a')];_0x1d8637+=0x1){let _0x31b66c=_0x260f1d[_0x6f00('0x66')][_0x1d8637];var _0xae32c4=_0x39b2ce[_0x6f00('0x77')]();_0xae32c4[_0x6f00('0x43')]('ut.UserId\x20=\x20?',_0x31b66c['id']);_0x190139[_0x6f00('0x78')](db[_0x6f00('0x6b')][_0x6f00('0x34')](_0xae32c4['toString'](),{'type':db['sequelize'][_0x6f00('0x79')][_0x6f00('0x7a')]})[_0x6f00('0x25')](function(_0x1f148e){if(_0x1f148e[_0x6f00('0x3a')]===0x1){return _0x31b66c['id'];}else{var _0x338a00=_[_0x6f00('0x7b')](_[_0x6f00('0x33')](_0x1f148e,'TeamId'),function(_0x2728e0){return _[_0x6f00('0x7c')](_0x2fb417,_0x2728e0);});if(_0x338a00){return _0x31b66c['id'];}}}));}}return BPromise[_0x6f00('0x7d')](_0x190139)[_0x6f00('0x25')](function(_0x365dec){_0x37fdfd=_(_0x37fdfd)[_0x6f00('0x7e')](_0x365dec)[_0x6f00('0x7f')]()[_0x6f00('0x80')]();return db[_0x6f00('0x2e')][_0x6f00('0x6a')]({'where':{'id':_0x426ce1[_0x6f00('0x54')]['id']}})['then'](function(_0x4ba02d){return db[_0x6f00('0x6b')]['transaction'](function(_0xfc0777){return _0x4ba02d[_0x6f00('0x72')](_0x426ce1[_0x6f00('0x34')]['ids'],{'transaction':_0xfc0777})[_0x6f00('0x25')](function(){if(!_[_0x6f00('0x81')](_0x37fdfd)){return _0x4ba02d[_0x6f00('0x82')](_0x37fdfd,{'transaction':_0xfc0777});}})[_0x6f00('0x25')](function(){_0x37fdfd['forEach'](function(_0x415682){socket[_0x6f00('0x70')](_0x6f00('0x83'),{'UserId':_0x415682,'SmsQueueId':_0x4ba02d['id']});});});});});});})[_0x6f00('0x25')](respondWithStatusCode(_0x3a47ac,null))[_0x6f00('0x47')](handleError(_0x3a47ac,null));};exports[_0x6f00('0x84')]=function(_0x517813,_0x28c0a7,_0x1e78d3){return db[_0x6f00('0x2e')][_0x6f00('0x6a')]({'where':{'id':_0x517813[_0x6f00('0x54')]['id']}})['then'](handleEntityNotFound(_0x28c0a7,null))[_0x6f00('0x25')](function(_0x4d2d70){if(_0x4d2d70){return _0x4d2d70[_0x6f00('0x84')](_0x517813[_0x6f00('0x4b')][_0x6f00('0x64')],_[_0x6f00('0x85')](_0x517813['body'],[_0x6f00('0x64'),'id'])||{})[_0x6f00('0x86')](function(_0x4f8d5f){for(var _0x9e969c=0x0;_0x9e969c<_0x517813[_0x6f00('0x4b')]['ids'][_0x6f00('0x3a')];_0x9e969c+=0x1){socket[_0x6f00('0x70')](_0x6f00('0x71'),{'UserId':_0x517813[_0x6f00('0x4b')]['ids'][_0x9e969c],'SmsQueueId':_0x517813[_0x6f00('0x54')]['id']});}return _0x4f8d5f;});}})[_0x6f00('0x25')](respondWithResult(_0x28c0a7,null))[_0x6f00('0x47')](handleError(_0x28c0a7,null));};exports[_0x6f00('0x82')]=function(_0x2e76ff,_0x31384d,_0x2e2c1d){return db[_0x6f00('0x2e')][_0x6f00('0x6a')]({'where':{'id':_0x2e76ff[_0x6f00('0x54')]['id']}})[_0x6f00('0x25')](handleEntityNotFound(_0x31384d,null))['then'](function(_0x37b970){if(_0x37b970){return _0x37b970[_0x6f00('0x82')](_0x2e76ff[_0x6f00('0x34')][_0x6f00('0x64')])['then'](function(){if(_[_0x6f00('0x87')](_0x2e76ff[_0x6f00('0x34')]['ids'])){for(var _0x3e6526=0x0;_0x3e6526<_0x2e76ff['query'][_0x6f00('0x64')]['length'];_0x3e6526+=0x1){socket[_0x6f00('0x70')]('userSmsQueue:remove',{'UserId':Number(_0x2e76ff[_0x6f00('0x34')][_0x6f00('0x64')][_0x3e6526]),'SmsQueueId':Number(_0x2e76ff['params']['id'])});}}else{socket[_0x6f00('0x70')](_0x6f00('0x83'),{'UserId':Number(_0x2e76ff['query'][_0x6f00('0x64')]),'SmsQueueId':Number(_0x2e76ff[_0x6f00('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x31384d,null))[_0x6f00('0x47')](handleError(_0x31384d,null));};exports[_0x6f00('0x88')]=function(_0x2150c3,_0x9b3729,_0x5337d3){var _0x460034={};var _0x1dc864={};var _0x1f542d;var _0x4f97e4;return db['SmsQueue'][_0x6f00('0x56')]({'where':{'id':_0x2150c3[_0x6f00('0x54')]['id']}})[_0x6f00('0x25')](handleEntityNotFound(_0x9b3729,null))[_0x6f00('0x25')](function(_0xead7d4){if(_0xead7d4){_0x1f542d=_0xead7d4;_0x1dc864['model']=_[_0x6f00('0x35')](db[_0x6f00('0x5a')]['rawAttributes']);_0x1dc864[_0x6f00('0x34')]=_[_0x6f00('0x35')](_0x2150c3['query']);_0x1dc864[_0x6f00('0x36')]=_['intersection'](_0x1dc864[_0x6f00('0x32')],_0x1dc864[_0x6f00('0x34')]);_0x460034[_0x6f00('0x39')]=_[_0x6f00('0x37')](_0x1dc864[_0x6f00('0x32')],qs[_0x6f00('0x38')](_0x2150c3[_0x6f00('0x34')]['fields']));_0x460034[_0x6f00('0x39')]=_0x460034[_0x6f00('0x39')]['length']?_0x460034[_0x6f00('0x39')]:_0x1dc864[_0x6f00('0x32')];_0x460034[_0x6f00('0x89')]=qs[_0x6f00('0x3d')](_0x2150c3[_0x6f00('0x34')][_0x6f00('0x3d')]);_0x460034[_0x6f00('0x43')]=qs[_0x6f00('0x36')](_['pick'](_0x2150c3[_0x6f00('0x34')],_0x1dc864['filters']));if(_0x2150c3[_0x6f00('0x34')]['filter']){_0x460034[_0x6f00('0x43')]=_[_0x6f00('0x40')](_0x460034[_0x6f00('0x43')],{'$or':_[_0x6f00('0x33')](_0x460034[_0x6f00('0x39')],function(_0x12149c){var _0x177243={};_0x177243[_0x12149c]={'$like':'%'+_0x2150c3[_0x6f00('0x34')][_0x6f00('0x3f')]+'%'};return _0x177243;})});}_0x460034=_[_0x6f00('0x40')]({},_0x460034,_0x2150c3[_0x6f00('0x42')]);return _0x1f542d['getAgents'](_0x460034);}})[_0x6f00('0x25')](function(_0x11b4ff){if(_0x11b4ff){_0x4f97e4=_0x11b4ff[_0x6f00('0x3a')];if(!_0x2150c3[_0x6f00('0x34')][_0x6f00('0x3b')]('nolimit')){_0x460034[_0x6f00('0x20')]=qs[_0x6f00('0x20')](_0x2150c3[_0x6f00('0x34')]['limit']);_0x460034['offset']=qs[_0x6f00('0x1f')](_0x2150c3[_0x6f00('0x34')]['offset']);}return _0x1f542d[_0x6f00('0x88')](_0x460034);}})[_0x6f00('0x25')](function(_0x540ea3){if(_0x540ea3){return _0x540ea3?{'count':_0x4f97e4,'rows':_0x540ea3}:null;}})[_0x6f00('0x25')](respondWithResult(_0x9b3729,null))[_0x6f00('0x47')](handleError(_0x9b3729,null));}; \ No newline at end of file +var _0x24ca=['ids','isEmpty','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsQueue.socket','register','end','status','json','offset','limit','apply','save','then','get','SmsQueues','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','SmsQueue','count','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','nolimit','pick','SmsQueueId','UserSmsQueue','User','findAndCountAll','UserId','agent','updatedAt','rows','format','%s/%s','SIP','createdAt','findOne','Team','getTeams','addTeams','Agents','interface','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','removeTeams'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x24ca,0x1bc));var _0xa24c=function(_0xca1f0e,_0x2713d5){_0xca1f0e=_0xca1f0e-0x0;var _0x35e4ef=_0x24ca[_0xca1f0e];return _0x35e4ef;};'use strict';var pdf=require(_0xa24c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa24c('0x1'));var zipdir=require(_0xa24c('0x2'));var jsonpatch=require(_0xa24c('0x3'));var rp=require('request-promise');var moment=require(_0xa24c('0x4'));var BPromise=require(_0xa24c('0x5'));var Mustache=require(_0xa24c('0x6'));var util=require(_0xa24c('0x7'));var path=require(_0xa24c('0x8'));var sox=require(_0xa24c('0x9'));var csv=require(_0xa24c('0xa'));var ejs=require(_0xa24c('0xb'));var fs=require('fs');var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0xa'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];config[_0xa24c('0x1b')]=_[_0xa24c('0x1c')](config[_0xa24c('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xa24c('0x1d'))(new Redis(config[_0xa24c('0x1b')]));require(_0xa24c('0x1e'))[_0xa24c('0x1f')](socket);function respondWithStatusCode(_0x1cb08e,_0x2d185c){_0x2d185c=_0x2d185c||0xcc;return function(_0x448275){if(_0x448275){return _0x1cb08e['sendStatus'](_0x2d185c);}return _0x1cb08e['status'](_0x2d185c)[_0xa24c('0x20')]();};}function respondWithResult(_0x87aa90,_0x49ce53){_0x49ce53=_0x49ce53||0xc8;return function(_0x5babb5){if(_0x5babb5){return _0x87aa90[_0xa24c('0x21')](_0x49ce53)[_0xa24c('0x22')](_0x5babb5);}};}function respondWithFilteredResult(_0x5c479e,_0x2a64ff){return function(_0x5de3e6){if(_0x5de3e6){var _0x558dc7=_0x5de3e6['count'],_0x2a610a=_0x2a64ff[_0xa24c('0x23')],_0x1fcd4b=_0x2a64ff[_0xa24c('0x23')]+_0x2a64ff[_0xa24c('0x24')],_0xefdbd9;if(_0x1fcd4b>=_0x558dc7){_0x1fcd4b=_0x558dc7;_0xefdbd9=0xc8;}else{_0xefdbd9=0xce;}_0x5c479e['status'](_0xefdbd9);return _0x5c479e['set']('Content-Range',_0x2a610a+'-'+_0x1fcd4b+'/'+_0x558dc7)['json'](_0x5de3e6);}return null;};}function patchUpdates(_0x2173f6){return function(_0x174b69){try{jsonpatch[_0xa24c('0x25')](_0x174b69,_0x2173f6,!![]);}catch(_0x180297){return BPromise['reject'](_0x180297);}return _0x174b69[_0xa24c('0x26')]();};}function saveUpdates(_0x5f299e,_0x224bca){return function(_0xb81d97){if(_0xb81d97){return _0xb81d97['update'](_0x5f299e)[_0xa24c('0x27')](function(_0x363d52){return _0x363d52;});}return null;};}function removeEntity(_0x43a0c0,_0x188ee2){return function(_0x14cc65){if(_0x14cc65){return _0x14cc65['destroy']()[_0xa24c('0x27')](function(){var _0x5cc9cb=_0x14cc65[_0xa24c('0x28')]({'plain':!![]});var _0x3951ae=_0xa24c('0x29');return db['UserProfileResource'][_0xa24c('0x2a')]({'where':{'type':_0x3951ae,'resourceId':_0x5cc9cb['id']}})[_0xa24c('0x27')](function(){return _0x14cc65;});})[_0xa24c('0x27')](function(){_0x43a0c0[_0xa24c('0x21')](0xcc)[_0xa24c('0x20')]();});}};}function handleEntityNotFound(_0x3ad0e6,_0x39609a){return function(_0x5b23f4){if(!_0x5b23f4){_0x3ad0e6[_0xa24c('0x2b')](0x194);}return _0x5b23f4;};}function handleError(_0x28675f,_0x152120){_0x152120=_0x152120||0x1f4;return function(_0x12dbdc){logger['error'](_0x12dbdc[_0xa24c('0x2c')]);if(_0x12dbdc[_0xa24c('0x2d')]){delete _0x12dbdc[_0xa24c('0x2d')];}_0x28675f['status'](_0x152120)[_0xa24c('0x2e')](_0x12dbdc);};}exports[_0xa24c('0x2f')]=function(_0x253d83,_0x4ae35c){var _0x245fb2={},_0x5e0226={},_0x1102ab={'count':0x0,'rows':[]};var _0x3a0c14=_[_0xa24c('0x30')](db['SmsQueue'][_0xa24c('0x31')],function(_0x53f90){return{'name':_0x53f90[_0xa24c('0x32')],'type':_0x53f90['type'][_0xa24c('0x33')]};});_0x5e0226['model']=_[_0xa24c('0x30')](_0x3a0c14,_0xa24c('0x2d'));_0x5e0226['query']=_['keys'](_0x253d83[_0xa24c('0x34')]);_0x5e0226[_0xa24c('0x35')]=_[_0xa24c('0x36')](_0x5e0226[_0xa24c('0x37')],_0x5e0226[_0xa24c('0x34')]);_0x245fb2[_0xa24c('0x38')]=_[_0xa24c('0x36')](_0x5e0226['model'],qs[_0xa24c('0x39')](_0x253d83[_0xa24c('0x34')][_0xa24c('0x39')]));_0x245fb2[_0xa24c('0x38')]=_0x245fb2[_0xa24c('0x38')][_0xa24c('0x3a')]?_0x245fb2[_0xa24c('0x38')]:_0x5e0226[_0xa24c('0x37')];if(!_0x253d83[_0xa24c('0x34')][_0xa24c('0x3b')]('nolimit')){_0x245fb2[_0xa24c('0x24')]=qs[_0xa24c('0x24')](_0x253d83[_0xa24c('0x34')][_0xa24c('0x24')]);_0x245fb2['offset']=qs['offset'](_0x253d83[_0xa24c('0x34')]['offset']);}_0x245fb2[_0xa24c('0x3c')]=qs[_0xa24c('0x3d')](_0x253d83[_0xa24c('0x34')][_0xa24c('0x3d')]);_0x245fb2[_0xa24c('0x3e')]=qs['filters'](_['pick'](_0x253d83[_0xa24c('0x34')],_0x5e0226[_0xa24c('0x35')]),_0x3a0c14);if(_0x253d83[_0xa24c('0x34')][_0xa24c('0x3f')]){_0x245fb2[_0xa24c('0x3e')]=_[_0xa24c('0x40')](_0x245fb2['where'],{'$or':_['map'](_0x3a0c14,function(_0x2a9317){if(_0x2a9317[_0xa24c('0x41')]!==_0xa24c('0x42')){var _0x2101f8={};_0x2101f8[_0x2a9317[_0xa24c('0x2d')]]={'$like':'%'+_0x253d83['query'][_0xa24c('0x3f')]+'%'};return _0x2101f8;}})});}_0x245fb2=_[_0xa24c('0x40')]({},_0x245fb2,_0x253d83['options']);var _0x599627={'where':_0x245fb2[_0xa24c('0x3e')]};return db[_0xa24c('0x43')][_0xa24c('0x44')](_0x599627)['then'](function(_0x58ac8b){_0x1102ab[_0xa24c('0x44')]=_0x58ac8b;if(_0x253d83[_0xa24c('0x34')][_0xa24c('0x45')]){_0x245fb2[_0xa24c('0x46')]=[{'all':!![]}];}return db[_0xa24c('0x43')][_0xa24c('0x47')](_0x245fb2);})[_0xa24c('0x27')](function(_0x394d19){_0x1102ab['rows']=_0x394d19;return _0x1102ab;})['then'](respondWithFilteredResult(_0x4ae35c,_0x245fb2))[_0xa24c('0x48')](handleError(_0x4ae35c,null));};exports[_0xa24c('0x49')]=function(_0x455256,_0x5972d7){var _0x472c1e={'raw':!![],'where':{'id':_0x455256[_0xa24c('0x4a')]['id']}},_0x51df93={};_0x51df93[_0xa24c('0x37')]=_[_0xa24c('0x4b')](db[_0xa24c('0x43')][_0xa24c('0x31')]);_0x51df93[_0xa24c('0x34')]=_[_0xa24c('0x4b')](_0x455256[_0xa24c('0x34')]);_0x51df93['filters']=_[_0xa24c('0x36')](_0x51df93[_0xa24c('0x37')],_0x51df93[_0xa24c('0x34')]);_0x472c1e['attributes']=_[_0xa24c('0x36')](_0x51df93[_0xa24c('0x37')],qs[_0xa24c('0x39')](_0x455256[_0xa24c('0x34')][_0xa24c('0x39')]));_0x472c1e[_0xa24c('0x38')]=_0x472c1e[_0xa24c('0x38')][_0xa24c('0x3a')]?_0x472c1e[_0xa24c('0x38')]:_0x51df93[_0xa24c('0x37')];if(_0x455256[_0xa24c('0x34')]['includeAll']){_0x472c1e[_0xa24c('0x46')]=[{'all':!![]}];}_0x472c1e=_[_0xa24c('0x40')]({},_0x472c1e,_0x455256[_0xa24c('0x4c')]);return db[_0xa24c('0x43')][_0xa24c('0x4d')](_0x472c1e)[_0xa24c('0x27')](handleEntityNotFound(_0x5972d7,null))[_0xa24c('0x27')](respondWithResult(_0x5972d7,null))[_0xa24c('0x48')](handleError(_0x5972d7,null));};exports[_0xa24c('0x4e')]=function(_0x4f56ae,_0x540da8){return db[_0xa24c('0x43')]['create'](_0x4f56ae[_0xa24c('0x4f')],{})[_0xa24c('0x27')](function(_0x4ec677){var _0x24b3df=_0x4f56ae[_0xa24c('0x50')][_0xa24c('0x28')]({'plain':!![]});if(!_0x24b3df)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24b3df['role']===_0xa24c('0x50')){var _0x5ba726=_0x4ec677[_0xa24c('0x28')]({'plain':!![]});var _0x2a3665=_0xa24c('0x29');return db[_0xa24c('0x51')][_0xa24c('0x4d')]({'where':{'name':_0x2a3665,'userProfileId':_0x24b3df[_0xa24c('0x52')]},'raw':!![]})[_0xa24c('0x27')](function(_0x286d57){if(_0x286d57&&_0x286d57[_0xa24c('0x53')]===0x0){return db[_0xa24c('0x54')]['create']({'name':_0x5ba726[_0xa24c('0x2d')],'resourceId':_0x5ba726['id'],'type':_0x286d57[_0xa24c('0x2d')],'sectionId':_0x286d57['id']},{})[_0xa24c('0x27')](function(){return _0x4ec677;});}else{return _0x4ec677;}})['catch'](function(_0x5bde94){logger['error'](_0xa24c('0x55'),_0x5bde94);throw _0x5bde94;});}return _0x4ec677;})['then'](respondWithResult(_0x540da8,0xc9))[_0xa24c('0x48')](handleError(_0x540da8,null));};exports[_0xa24c('0x56')]=function(_0x5a35e5,_0x25c6e5){if(_0x5a35e5[_0xa24c('0x4f')]['id']){delete _0x5a35e5[_0xa24c('0x4f')]['id'];}return db[_0xa24c('0x43')][_0xa24c('0x4d')]({'where':{'id':_0x5a35e5[_0xa24c('0x4a')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x25c6e5,null))[_0xa24c('0x27')](saveUpdates(_0x5a35e5['body'],null))[_0xa24c('0x27')](respondWithResult(_0x25c6e5,null))['catch'](handleError(_0x25c6e5,null));};exports['destroy']=function(_0x565f0a,_0x5bd2af){return db['SmsQueue'][_0xa24c('0x4d')]({'where':{'id':_0x565f0a['params']['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x5bd2af,null))[_0xa24c('0x27')](removeEntity(_0x5bd2af,null))[_0xa24c('0x48')](handleError(_0x5bd2af,null));};exports[_0xa24c('0x57')]=function(_0xa371d2,_0x2e1feb){return db[_0xa24c('0x43')][_0xa24c('0x57')]()[_0xa24c('0x27')](respondWithResult(_0x2e1feb,null))[_0xa24c('0x48')](handleError(_0x2e1feb,null));};exports[_0xa24c('0x58')]=function(_0x37dbbd,_0x358b48,_0x348086){var _0x136d6b={'raw':!![],'where':{}},_0x5c3d11={},_0x25c571;return db[_0xa24c('0x43')]['findOne']({'where':{'id':_0x37dbbd[_0xa24c('0x4a')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x358b48,null))[_0xa24c('0x27')](function(_0x21d0ca){if(_0x21d0ca){_0x25c571=_0x21d0ca['get']({'plain':!![]});_0x5c3d11['model']=_[_0xa24c('0x4b')](db['UserSmsQueue']['rawAttributes']);_0x5c3d11[_0xa24c('0x34')]=_[_0xa24c('0x4b')](_0x37dbbd[_0xa24c('0x34')]);_0x5c3d11[_0xa24c('0x35')]=_['intersection'](_0x5c3d11['model'],_0x5c3d11[_0xa24c('0x34')]);_0x136d6b['attributes']=_['intersection'](_0x5c3d11[_0xa24c('0x37')],qs[_0xa24c('0x39')](_0x37dbbd[_0xa24c('0x34')]['fields']));_0x136d6b[_0xa24c('0x38')]=_0x136d6b[_0xa24c('0x38')]['length']?_0x136d6b[_0xa24c('0x38')]:_0x5c3d11[_0xa24c('0x37')];if(!_0x37dbbd[_0xa24c('0x34')]['hasOwnProperty'](_0xa24c('0x59'))){_0x136d6b[_0xa24c('0x24')]=qs[_0xa24c('0x24')](_0x37dbbd[_0xa24c('0x34')][_0xa24c('0x24')]);_0x136d6b['offset']=qs[_0xa24c('0x23')](_0x37dbbd[_0xa24c('0x34')][_0xa24c('0x23')]);}_0x136d6b[_0xa24c('0x3c')]=qs[_0xa24c('0x3d')](_0x37dbbd[_0xa24c('0x34')][_0xa24c('0x3d')]);_0x136d6b['where']=qs[_0xa24c('0x35')](_[_0xa24c('0x5a')](_0x37dbbd['query'],_0x5c3d11[_0xa24c('0x35')]));_0x136d6b[_0xa24c('0x3e')][_0xa24c('0x5b')]=_0x21d0ca['id'];if(_0x37dbbd[_0xa24c('0x34')][_0xa24c('0x3f')]){_0x136d6b[_0xa24c('0x3e')]=_[_0xa24c('0x40')](_0x136d6b[_0xa24c('0x3e')],{'$or':_[_0xa24c('0x30')](_0x136d6b[_0xa24c('0x38')],function(_0x50141e){var _0x2771a1={};_0x2771a1[_0x50141e]={'$like':'%'+_0x37dbbd[_0xa24c('0x34')][_0xa24c('0x3f')]+'%'};return _0x2771a1;})});}_0x136d6b=_['merge']({},_0x136d6b,_0x37dbbd[_0xa24c('0x4c')]);return db[_0xa24c('0x5c')][_0xa24c('0x47')](_0x136d6b);}})['then'](function(_0x3ac3a0){if(_0x3ac3a0){return db[_0xa24c('0x5d')][_0xa24c('0x5e')]({'where':{'id':_[_0xa24c('0x30')](_0x3ac3a0,_0xa24c('0x5f')),'role':_0xa24c('0x60')},'attributes':['id','name','smsPause',_0xa24c('0x61'),'createdAt']});}})[_0xa24c('0x27')](function(_0x1879ae){if(_0x1879ae){return{'count':_0x1879ae[_0xa24c('0x44')],'rows':_[_0xa24c('0x30')](_0x1879ae[_0xa24c('0x62')],function(_0x58e328){return{'membername':_0x58e328[_0xa24c('0x2d')],'UserId':_0x58e328['id'],'queue_name':_0x25c571[_0xa24c('0x2d')],'SmsQueueId':_0x25c571['id'],'interface':util[_0xa24c('0x63')](_0xa24c('0x64'),_0xa24c('0x65'),_0x58e328[_0xa24c('0x2d')]),'penalty':0x0,'paused':_0x58e328['smsPause'],'createdAt':_0x58e328[_0xa24c('0x66')],'updatedAt':_0x58e328[_0xa24c('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa24c('0x27')](respondWithFilteredResult(_0x358b48,_0x136d6b))[_0xa24c('0x48')](handleError(_0x358b48,null));};exports['getTeams']=function(_0x403bf1,_0x4d8e3a,_0x2069b3){var _0x22c9b0={};var _0x342442={};var _0x180da2;var _0x5726e1;return db[_0xa24c('0x43')][_0xa24c('0x67')]({'where':{'id':_0x403bf1['params']['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x4d8e3a,null))[_0xa24c('0x27')](function(_0x135cef){if(_0x135cef){_0x180da2=_0x135cef;_0x342442[_0xa24c('0x37')]=_[_0xa24c('0x4b')](db[_0xa24c('0x68')][_0xa24c('0x31')]);_0x342442[_0xa24c('0x34')]=_['keys'](_0x403bf1[_0xa24c('0x34')]);_0x342442[_0xa24c('0x35')]=_[_0xa24c('0x36')](_0x342442[_0xa24c('0x37')],_0x342442[_0xa24c('0x34')]);_0x22c9b0[_0xa24c('0x38')]=_[_0xa24c('0x36')](_0x342442[_0xa24c('0x37')],qs[_0xa24c('0x39')](_0x403bf1[_0xa24c('0x34')][_0xa24c('0x39')]));_0x22c9b0['attributes']=_0x22c9b0[_0xa24c('0x38')][_0xa24c('0x3a')]?_0x22c9b0['attributes']:_0x342442[_0xa24c('0x37')];_0x22c9b0[_0xa24c('0x3c')]=qs[_0xa24c('0x3d')](_0x403bf1['query']['sort']);_0x22c9b0[_0xa24c('0x3e')]=qs[_0xa24c('0x35')](_['pick'](_0x403bf1[_0xa24c('0x34')],_0x342442[_0xa24c('0x35')]));if(_0x403bf1[_0xa24c('0x34')][_0xa24c('0x3f')]){_0x22c9b0[_0xa24c('0x3e')]=_[_0xa24c('0x40')](_0x22c9b0['where'],{'$or':_['map'](_0x22c9b0['attributes'],function(_0x263dab){var _0x521894={};_0x521894[_0x263dab]={'$like':'%'+_0x403bf1['query'][_0xa24c('0x3f')]+'%'};return _0x521894;})});}_0x22c9b0=_[_0xa24c('0x40')]({},_0x22c9b0,_0x403bf1[_0xa24c('0x4c')]);return _0x180da2[_0xa24c('0x69')](_0x22c9b0);}})[_0xa24c('0x27')](function(_0x45b2fe){if(_0x45b2fe){_0x5726e1=_0x45b2fe[_0xa24c('0x3a')];if(!_0x403bf1[_0xa24c('0x34')][_0xa24c('0x3b')]('nolimit')){_0x22c9b0[_0xa24c('0x24')]=qs[_0xa24c('0x24')](_0x403bf1[_0xa24c('0x34')][_0xa24c('0x24')]);_0x22c9b0[_0xa24c('0x23')]=qs[_0xa24c('0x23')](_0x403bf1[_0xa24c('0x34')][_0xa24c('0x23')]);}return _0x180da2[_0xa24c('0x69')](_0x22c9b0);}})[_0xa24c('0x27')](function(_0x34be25){if(_0x34be25){return _0x34be25?{'count':_0x5726e1,'rows':_0x34be25}:null;}})[_0xa24c('0x27')](respondWithResult(_0x4d8e3a,null))['catch'](handleError(_0x4d8e3a,null));};exports[_0xa24c('0x6a')]=function(_0xf00f4b,_0x51e256,_0x257941){var _0x1a0afd=_0xf00f4b[_0xa24c('0x4f')]['ids'];return db[_0xa24c('0x68')][_0xa24c('0x47')]({'where':{'id':_0x1a0afd},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa24c('0x6b'),'attributes':['id',_0xa24c('0x2d'),'online','voicePause',_0xa24c('0x6c')],'raw':!![]}]})[_0xa24c('0x27')](function(_0x22719a){if(_0x22719a){var _0x10c89f=_['flatMap'](_0x22719a,function(_0x25183a){var _0x350036=_0x25183a[_0xa24c('0x28')]({'plain':!![]});return _0x350036['Agents'];});return db['SmsQueue'][_0xa24c('0x4d')]({'where':{'id':_0xf00f4b[_0xa24c('0x4a')]['id']}})[_0xa24c('0x27')](function(_0x54ba70){return db['sequelize'][_0xa24c('0x6d')](function(_0x51e48a){return _0x54ba70['addTeams'](_0x1a0afd,{'transaction':_0x51e48a})['then'](function(){return BPromise[_0xa24c('0x6e')](_0x10c89f,function(_0x2c47bf){return db[_0xa24c('0x5c')][_0xa24c('0x6f')]({'where':{'UserId':_0x2c47bf['id'],'SmsQueueId':_0xf00f4b[_0xa24c('0x4a')]['id']},'transaction':_0x51e48a});});})[_0xa24c('0x27')](function(){_0x10c89f[_0xa24c('0x70')](function(_0x2cb601){socket[_0xa24c('0x71')](_0xa24c('0x72'),{'UserId':_0x2cb601['id'],'SmsQueueId':_0x54ba70['id']});});});});});}})[_0xa24c('0x27')](respondWithStatusCode(_0x51e256,null))[_0xa24c('0x48')](handleError(_0x51e256,null));};exports['removeTeams']=function(_0x2e21e0,_0x292c22,_0x4f71e5){return db[_0xa24c('0x68')]['findAll']({'where':{'id':_0x2e21e0['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xa24c('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa24c('0x27')](handleEntityNotFound(_0x292c22,null))['then'](function(_0x22b445){var _0x144c3b=_['map'](_0x22b445,'id');var _0x1ff360=[];var _0x512238=[];var _0x3cc886=squel[_0xa24c('0x73')]();_0x3cc886[_0xa24c('0x74')](_0xa24c('0x75'))[_0xa24c('0x76')]('team_has_sms_queues','tq')[_0xa24c('0x77')]('user_has_teams','ut',_0xa24c('0x78'))[_0xa24c('0x3e')](_0xa24c('0x79'),_0x2e21e0[_0xa24c('0x4a')]['id']);for(var _0x4b848d=0x0;_0x4b848d<_0x22b445[_0xa24c('0x3a')];_0x4b848d+=0x1){let _0x131d83=_0x22b445[_0x4b848d];for(var _0x233681=0x0;_0x233681<_0x131d83[_0xa24c('0x6b')]['length'];_0x233681+=0x1){let _0x31e107=_0x131d83[_0xa24c('0x6b')][_0x233681];var _0x419496=_0x3cc886[_0xa24c('0x7a')]();_0x419496[_0xa24c('0x3e')](_0xa24c('0x7b'),_0x31e107['id']);_0x512238[_0xa24c('0x7c')](db[_0xa24c('0x7d')][_0xa24c('0x34')](_0x419496[_0xa24c('0x7e')](),{'type':db[_0xa24c('0x7d')][_0xa24c('0x7f')][_0xa24c('0x80')]})['then'](function(_0x3dbd9e){if(_0x3dbd9e[_0xa24c('0x3a')]===0x1){return _0x31e107['id'];}else{var _0x56465a=_[_0xa24c('0x81')](_[_0xa24c('0x30')](_0x3dbd9e,_0xa24c('0x82')),function(_0x418a3f){return _[_0xa24c('0x83')](_0x144c3b,_0x418a3f);});if(_0x56465a){return _0x31e107['id'];}}}));}}return BPromise['all'](_0x512238)[_0xa24c('0x27')](function(_0x172ef3){_0x1ff360=_(_0x1ff360)[_0xa24c('0x84')](_0x172ef3)[_0xa24c('0x85')]()[_0xa24c('0x86')]();return db[_0xa24c('0x43')][_0xa24c('0x4d')]({'where':{'id':_0x2e21e0['params']['id']}})[_0xa24c('0x27')](function(_0x454a82){return db[_0xa24c('0x7d')][_0xa24c('0x6d')](function(_0x9c3018){return _0x454a82[_0xa24c('0x87')](_0x2e21e0[_0xa24c('0x34')][_0xa24c('0x88')],{'transaction':_0x9c3018})[_0xa24c('0x27')](function(){if(!_[_0xa24c('0x89')](_0x1ff360)){return _0x454a82['removeAgents'](_0x1ff360,{'transaction':_0x9c3018});}})[_0xa24c('0x27')](function(){_0x1ff360[_0xa24c('0x70')](function(_0x12ff71){socket[_0xa24c('0x71')](_0xa24c('0x8a'),{'UserId':_0x12ff71,'SmsQueueId':_0x454a82['id']});});});});});});})[_0xa24c('0x27')](respondWithStatusCode(_0x292c22,null))[_0xa24c('0x48')](handleError(_0x292c22,null));};exports[_0xa24c('0x8b')]=function(_0x517a09,_0x7b03d2,_0x4d7d5e){return db['SmsQueue']['find']({'where':{'id':_0x517a09['params']['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x7b03d2,null))[_0xa24c('0x27')](function(_0x85da2b){if(_0x85da2b){return _0x85da2b[_0xa24c('0x8b')](_0x517a09[_0xa24c('0x4f')]['ids'],_[_0xa24c('0x8c')](_0x517a09[_0xa24c('0x4f')],[_0xa24c('0x88'),'id'])||{})[_0xa24c('0x8d')](function(_0xdac03){for(var _0x259789=0x0;_0x259789<_0x517a09[_0xa24c('0x4f')][_0xa24c('0x88')][_0xa24c('0x3a')];_0x259789+=0x1){socket['emit'](_0xa24c('0x72'),{'UserId':_0x517a09[_0xa24c('0x4f')][_0xa24c('0x88')][_0x259789],'SmsQueueId':_0x517a09[_0xa24c('0x4a')]['id']});}return _0xdac03;});}})[_0xa24c('0x27')](respondWithResult(_0x7b03d2,null))['catch'](handleError(_0x7b03d2,null));};exports[_0xa24c('0x8e')]=function(_0x161d6d,_0x410b10,_0x47fecb){return db[_0xa24c('0x43')][_0xa24c('0x4d')]({'where':{'id':_0x161d6d[_0xa24c('0x4a')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x410b10,null))[_0xa24c('0x27')](function(_0x5d517c){if(_0x5d517c){return _0x5d517c['removeAgents'](_0x161d6d[_0xa24c('0x34')]['ids'])[_0xa24c('0x27')](function(){if(_[_0xa24c('0x8f')](_0x161d6d['query'][_0xa24c('0x88')])){for(var _0x327b23=0x0;_0x327b23<_0x161d6d[_0xa24c('0x34')][_0xa24c('0x88')][_0xa24c('0x3a')];_0x327b23+=0x1){socket[_0xa24c('0x71')]('userSmsQueue:remove',{'UserId':Number(_0x161d6d[_0xa24c('0x34')][_0xa24c('0x88')][_0x327b23]),'SmsQueueId':Number(_0x161d6d[_0xa24c('0x4a')]['id'])});}}else{socket[_0xa24c('0x71')]('userSmsQueue:remove',{'UserId':Number(_0x161d6d[_0xa24c('0x34')][_0xa24c('0x88')]),'SmsQueueId':Number(_0x161d6d[_0xa24c('0x4a')]['id'])});}});}})[_0xa24c('0x27')](respondWithStatusCode(_0x410b10,null))[_0xa24c('0x48')](handleError(_0x410b10,null));};exports[_0xa24c('0x90')]=function(_0x19bf4e,_0x50ef98,_0x19cb04){var _0x2b9e77={};var _0x3df316={};var _0x5d8cdf;var _0x5e3586;return db[_0xa24c('0x43')][_0xa24c('0x67')]({'where':{'id':_0x19bf4e[_0xa24c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x50ef98,null))[_0xa24c('0x27')](function(_0x5ccaad){if(_0x5ccaad){_0x5d8cdf=_0x5ccaad;_0x3df316['model']=_[_0xa24c('0x4b')](db[_0xa24c('0x5d')][_0xa24c('0x31')]);_0x3df316[_0xa24c('0x34')]=_[_0xa24c('0x4b')](_0x19bf4e[_0xa24c('0x34')]);_0x3df316[_0xa24c('0x35')]=_[_0xa24c('0x36')](_0x3df316[_0xa24c('0x37')],_0x3df316['query']);_0x2b9e77[_0xa24c('0x38')]=_[_0xa24c('0x36')](_0x3df316[_0xa24c('0x37')],qs[_0xa24c('0x39')](_0x19bf4e[_0xa24c('0x34')][_0xa24c('0x39')]));_0x2b9e77['attributes']=_0x2b9e77['attributes'][_0xa24c('0x3a')]?_0x2b9e77[_0xa24c('0x38')]:_0x3df316[_0xa24c('0x37')];_0x2b9e77[_0xa24c('0x3c')]=qs[_0xa24c('0x3d')](_0x19bf4e[_0xa24c('0x34')]['sort']);_0x2b9e77[_0xa24c('0x3e')]=qs['filters'](_[_0xa24c('0x5a')](_0x19bf4e[_0xa24c('0x34')],_0x3df316[_0xa24c('0x35')]));if(_0x19bf4e[_0xa24c('0x34')][_0xa24c('0x3f')]){_0x2b9e77['where']=_[_0xa24c('0x40')](_0x2b9e77[_0xa24c('0x3e')],{'$or':_[_0xa24c('0x30')](_0x2b9e77['attributes'],function(_0x23db6f){var _0x91dc0f={};_0x91dc0f[_0x23db6f]={'$like':'%'+_0x19bf4e[_0xa24c('0x34')][_0xa24c('0x3f')]+'%'};return _0x91dc0f;})});}_0x2b9e77=_['merge']({},_0x2b9e77,_0x19bf4e['options']);return _0x5d8cdf[_0xa24c('0x90')](_0x2b9e77);}})[_0xa24c('0x27')](function(_0x4cb8e2){if(_0x4cb8e2){_0x5e3586=_0x4cb8e2[_0xa24c('0x3a')];if(!_0x19bf4e[_0xa24c('0x34')][_0xa24c('0x3b')]('nolimit')){_0x2b9e77[_0xa24c('0x24')]=qs[_0xa24c('0x24')](_0x19bf4e['query']['limit']);_0x2b9e77['offset']=qs[_0xa24c('0x23')](_0x19bf4e[_0xa24c('0x34')][_0xa24c('0x23')]);}return _0x5d8cdf['getAgents'](_0x2b9e77);}})['then'](function(_0x17c162){if(_0x17c162){return _0x17c162?{'count':_0x5e3586,'rows':_0x17c162}:null;}})[_0xa24c('0x27')](respondWithResult(_0x50ef98,null))[_0xa24c('0x48')](handleError(_0x50ef98,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index b3ad98d..efac20d 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 _0xd189=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb','SmsQueue'];(function(_0xaf365b,_0x3b1ee2){var _0x608a9d=function(_0x2f0ab7){while(--_0x2f0ab7){_0xaf365b['push'](_0xaf365b['shift']());}};_0x608a9d(++_0x3b1ee2);}(_0xd189,0x9f));var _0x9d18=function(_0x399fee,_0x34adba){_0x399fee=_0x399fee-0x0;var _0x57d88c=_0xd189[_0x399fee];return _0x57d88c;};'use strict';var EventEmitter=require(_0x9d18('0x0'));var SmsQueue=require(_0x9d18('0x1'))['db'][_0x9d18('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x9d18('0x3')](0x0);var events={'afterCreate':_0x9d18('0x4'),'afterUpdate':_0x9d18('0x5'),'afterDestroy':_0x9d18('0x6')};function emitEvent(_0x494961){return function(_0x4167a1,_0x6908d1,_0x4ed1e2){SmsQueueEvents[_0x9d18('0x7')](_0x494961+':'+_0x4167a1['id'],_0x4167a1);SmsQueueEvents[_0x9d18('0x7')](_0x494961,_0x4167a1);_0x4ed1e2(null);};}for(var e in events){if(events[_0x9d18('0x8')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xe0c0=['SmsQueue','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x2b6d09,_0x4c21a0){var _0x3577d2=function(_0x29ce81){while(--_0x29ce81){_0x2b6d09['push'](_0x2b6d09['shift']());}};_0x3577d2(++_0x4c21a0);}(_0xe0c0,0xa7));var _0x0e0c=function(_0x1f53b7,_0xab9e2){_0x1f53b7=_0x1f53b7-0x0;var _0xdd36c2=_0xe0c0[_0x1f53b7];return _0xdd36c2;};'use strict';var EventEmitter=require(_0x0e0c('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x0e0c('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x0e0c('0x2')](0x0);var events={'afterCreate':_0x0e0c('0x3'),'afterUpdate':_0x0e0c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x7371ed){return function(_0x289810,_0x373046,_0x54c73b){SmsQueueEvents[_0x0e0c('0x5')](_0x7371ed+':'+_0x289810['id'],_0x289810);SmsQueueEvents[_0x0e0c('0x5')](_0x7371ed,_0x289810);_0x54c73b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x0e0c('0x6')](e,emitEvent(event));}}module[_0x0e0c('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 96e065e..07faf5c 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 _0x36e2=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','lodash'];(function(_0x4d6c44,_0x5210c4){var _0xc069e3=function(_0x4f4e4b){while(--_0x4f4e4b){_0x4d6c44['push'](_0x4d6c44['shift']());}};_0xc069e3(++_0x5210c4);}(_0x36e2,0x1f3));var _0x236e=function(_0x351c9e,_0x236adf){_0x351c9e=_0x351c9e-0x0;var _0x5c044e=_0x36e2[_0x351c9e];return _0x5c044e;};'use strict';var _=require(_0x236e('0x0'));var util=require('util');var logger=require(_0x236e('0x1'))(_0x236e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x236e('0x3'));var fs=require('fs');var path=require(_0x236e('0x4'));var rimraf=require(_0x236e('0x5'));var config=require(_0x236e('0x6'));var attributes=require(_0x236e('0x7'));module[_0x236e('0x8')]=function(_0x2c0901,_0x513670){return _0x2c0901[_0x236e('0x9')]('SmsQueue',attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad97=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SmsQueue','sms_queues'];(function(_0x4b9f6a,_0x168997){var _0x325108=function(_0xf08571){while(--_0xf08571){_0x4b9f6a['push'](_0x4b9f6a['shift']());}};_0x325108(++_0x168997);}(_0xad97,0xdc));var _0x7ad9=function(_0x50953e,_0x39fb47){_0x50953e=_0x50953e-0x0;var _0x396fa0=_0xad97[_0x50953e];return _0x396fa0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7ad9('0x0'))('api');var moment=require(_0x7ad9('0x1'));var BPromise=require(_0x7ad9('0x2'));var rp=require(_0x7ad9('0x3'));var fs=require('fs');var path=require(_0x7ad9('0x4'));var rimraf=require(_0x7ad9('0x5'));var config=require(_0x7ad9('0x6'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x1f4dd0,_0x2903a6){return _0x1f4dd0[_0x7ad9('0x7')](_0x7ad9('0x8'),attributes,{'tableName':_0x7ad9('0x9'),'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 014449d..413afb7 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 _0x9e04=['stringify','error','code','message','result','catch','GetSmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','info','ShowSmsQueue','SmsQueue','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./smsQueue.socket','register','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x25110a,_0x3b3852){var _0xe42822=function(_0x283a82){while(--_0x283a82){_0x25110a['push'](_0x25110a['shift']());}};_0xe42822(++_0x3b3852);}(_0x9e04,0x18f));var _0x49e0=function(_0x161890,_0x25a20b){_0x161890=_0x161890-0x0;var _0x244cbc=_0x9e04[_0x161890];return _0x244cbc;};'use strict';var _=require(_0x49e0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x49e0('0x1'));var fs=require('fs');var Redis=require(_0x49e0('0x2'));var db=require(_0x49e0('0x3'))['db'];var utils=require(_0x49e0('0x4'));var logger=require(_0x49e0('0x5'))(_0x49e0('0x6'));var config=require(_0x49e0('0x7'));var jayson=require(_0x49e0('0x8'));var client=jayson[_0x49e0('0x9')][_0x49e0('0xa')]({'port':0x232a});config[_0x49e0('0xb')]=_['defaults'](config[_0x49e0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x49e0('0xc'))(new Redis(config[_0x49e0('0xb')]));require(_0x49e0('0xd'))[_0x49e0('0xe')](socket);function respondWithRpcPromise(_0x2ac907,_0x2f3684,_0x3e458b){return new BPromise(function(_0x5d1c47,_0x182d00){return client['request'](_0x2ac907,_0x3e458b)[_0x49e0('0xf')](function(_0x2001db){logger['info'](_0x49e0('0x10'),_0x2f3684,_0x49e0('0x11'));logger[_0x49e0('0x12')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x2f3684,_0x49e0('0x11'),JSON[_0x49e0('0x13')](_0x2001db));if(_0x2001db[_0x49e0('0x14')]){if(_0x2001db[_0x49e0('0x14')][_0x49e0('0x15')]===0x1f4){logger[_0x49e0('0x14')](_0x49e0('0x10'),_0x2f3684,_0x2001db['error']['message']);return _0x182d00(_0x2001db['error'][_0x49e0('0x16')]);}logger[_0x49e0('0x14')](_0x49e0('0x10'),_0x2f3684,_0x2001db[_0x49e0('0x14')][_0x49e0('0x16')]);return _0x5d1c47(_0x2001db[_0x49e0('0x14')][_0x49e0('0x16')]);}else{logger['info'](_0x49e0('0x10'),_0x2f3684,_0x49e0('0x11'));_0x5d1c47(_0x2001db[_0x49e0('0x17')][_0x49e0('0x16')]);}})[_0x49e0('0x18')](function(_0x2377c5){logger[_0x49e0('0x14')](_0x49e0('0x10'),_0x2f3684,_0x2377c5);_0x182d00(_0x2377c5);});});}exports[_0x49e0('0x19')]=function(_0x41e928){var _0x1a3a3d=this;return new Promise(function(_0x542ca6,_0x8e41f0){return db['SmsQueue'][_0x49e0('0x1a')]({'raw':_0x41e928[_0x49e0('0x1b')]?_0x41e928[_0x49e0('0x1b')][_0x49e0('0x1c')]===undefined?!![]:![]:!![],'where':_0x41e928['options']?_0x41e928[_0x49e0('0x1b')][_0x49e0('0x1d')]||null:null,'attributes':_0x41e928[_0x49e0('0x1b')]?_0x41e928[_0x49e0('0x1b')][_0x49e0('0x1e')]||null:null,'limit':_0x41e928['options']?_0x41e928[_0x49e0('0x1b')][_0x49e0('0x1f')]||null:null,'include':_0x41e928[_0x49e0('0x1b')]?_0x41e928[_0x49e0('0x1b')][_0x49e0('0x20')]?_[_0x49e0('0x21')](_0x41e928['options'][_0x49e0('0x20')],function(_0x25a8e6){return{'model':db[_0x25a8e6[_0x49e0('0x22')]],'as':_0x25a8e6['as'],'attributes':_0x25a8e6['attributes'],'include':_0x25a8e6[_0x49e0('0x20')]?_[_0x49e0('0x21')](_0x25a8e6[_0x49e0('0x20')],function(_0x5abd29){return{'model':db[_0x5abd29[_0x49e0('0x22')]],'as':_0x5abd29['as'],'attributes':_0x5abd29[_0x49e0('0x1e')],'include':_0x5abd29[_0x49e0('0x20')]?_['map'](_0x5abd29['include'],function(_0x3f0878){return{'model':db[_0x3f0878[_0x49e0('0x22')]],'as':_0x3f0878['as'],'attributes':_0x3f0878['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a7aa8){logger[_0x49e0('0x23')](_0x49e0('0x19'),_0x41e928);logger[_0x49e0('0x12')](_0x49e0('0x19'),_0x41e928,JSON[_0x49e0('0x13')](_0x2a7aa8));_0x542ca6(_0x2a7aa8);})['catch'](function(_0x3a0dc2){logger['error'](_0x49e0('0x19'),_0x3a0dc2['message'],_0x41e928);_0x8e41f0(_0x1a3a3d[_0x49e0('0x14')](0x1f4,_0x3a0dc2[_0x49e0('0x16')]));});});};exports[_0x49e0('0x24')]=function(_0x180990){var _0x48996f=this;return new Promise(function(_0x7fda85,_0x510c2b){return db[_0x49e0('0x25')]['find']({'raw':_0x180990[_0x49e0('0x1b')]?_0x180990[_0x49e0('0x1b')][_0x49e0('0x1c')]===undefined?!![]:![]:!![],'where':_0x180990['options']?_0x180990[_0x49e0('0x1b')][_0x49e0('0x1d')]||null:null,'attributes':_0x180990[_0x49e0('0x1b')]?_0x180990[_0x49e0('0x1b')]['attributes']||null:null,'include':_0x180990[_0x49e0('0x1b')]?_0x180990['options'][_0x49e0('0x20')]?_[_0x49e0('0x21')](_0x180990[_0x49e0('0x1b')][_0x49e0('0x20')],function(_0x3a1dab){return{'model':db[_0x3a1dab['model']],'as':_0x3a1dab['as'],'attributes':_0x3a1dab['attributes'],'include':_0x3a1dab[_0x49e0('0x20')]?_[_0x49e0('0x21')](_0x3a1dab[_0x49e0('0x20')],function(_0x235002){return{'model':db[_0x235002[_0x49e0('0x22')]],'as':_0x235002['as'],'attributes':_0x235002[_0x49e0('0x1e')],'include':_0x235002[_0x49e0('0x20')]?_[_0x49e0('0x21')](_0x235002[_0x49e0('0x20')],function(_0xfaf723){return{'model':db[_0xfaf723[_0x49e0('0x22')]],'as':_0xfaf723['as'],'attributes':_0xfaf723[_0x49e0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x49e0('0xf')](function(_0x5796ee){logger['info'](_0x49e0('0x24'),_0x180990);logger['debug'](_0x49e0('0x24'),_0x180990,JSON[_0x49e0('0x13')](_0x5796ee));_0x7fda85(_0x5796ee);})['catch'](function(_0x3c322f){logger[_0x49e0('0x14')](_0x49e0('0x24'),_0x3c322f[_0x49e0('0x16')],_0x180990);_0x510c2b(_0x48996f[_0x49e0('0x14')](0x1f4,_0x3c322f[_0x49e0('0x16')]));});});}; \ No newline at end of file +var _0x04fe=['find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','where','attributes','include','map','model','debug','ShowSmsQueue'];(function(_0x187ee1,_0x486fdd){var _0x174752=function(_0xd96a00){while(--_0xd96a00){_0x187ee1['push'](_0x187ee1['shift']());}};_0x174752(++_0x486fdd);}(_0x04fe,0x141));var _0xe04f=function(_0x1a3217,_0x562c3f){_0x1a3217=_0x1a3217-0x0;var _0x3a5ff9=_0x04fe[_0x1a3217];return _0x3a5ff9;};'use strict';var _=require(_0xe04f('0x0'));var util=require(_0xe04f('0x1'));var moment=require(_0xe04f('0x2'));var BPromise=require(_0xe04f('0x3'));var rs=require(_0xe04f('0x4'));var fs=require('fs');var Redis=require(_0xe04f('0x5'));var db=require(_0xe04f('0x6'))['db'];var utils=require(_0xe04f('0x7'));var logger=require(_0xe04f('0x8'))(_0xe04f('0x9'));var config=require(_0xe04f('0xa'));var jayson=require(_0xe04f('0xb'));var client=jayson[_0xe04f('0xc')][_0xe04f('0xd')]({'port':0x232a});config[_0xe04f('0xe')]=_[_0xe04f('0xf')](config['redis'],{'host':_0xe04f('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe04f('0xe')]));require('./smsQueue.socket')[_0xe04f('0x11')](socket);function respondWithRpcPromise(_0x11feab,_0xb773ec,_0x485404){return new BPromise(function(_0x371a8a,_0x28d74e){return client['request'](_0x11feab,_0x485404)[_0xe04f('0x12')](function(_0x3530cd){logger[_0xe04f('0x13')](_0xe04f('0x14'),_0xb773ec,_0xe04f('0x15'));logger['debug'](_0xe04f('0x16'),_0xb773ec,_0xe04f('0x15'),JSON[_0xe04f('0x17')](_0x3530cd));if(_0x3530cd[_0xe04f('0x18')]){if(_0x3530cd[_0xe04f('0x18')]['code']===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0xb773ec,_0x3530cd[_0xe04f('0x18')][_0xe04f('0x19')]);return _0x28d74e(_0x3530cd[_0xe04f('0x18')][_0xe04f('0x19')]);}logger[_0xe04f('0x18')](_0xe04f('0x14'),_0xb773ec,_0x3530cd['error'][_0xe04f('0x19')]);return _0x371a8a(_0x3530cd[_0xe04f('0x18')][_0xe04f('0x19')]);}else{logger['info'](_0xe04f('0x14'),_0xb773ec,_0xe04f('0x15'));_0x371a8a(_0x3530cd[_0xe04f('0x1a')][_0xe04f('0x19')]);}})[_0xe04f('0x1b')](function(_0x57810e){logger[_0xe04f('0x18')](_0xe04f('0x14'),_0xb773ec,_0x57810e);_0x28d74e(_0x57810e);});});}exports[_0xe04f('0x1c')]=function(_0x412edf){var _0x2a22a5=this;return new Promise(function(_0x2e6cc2,_0x51ab8b){return db[_0xe04f('0x1d')][_0xe04f('0x1e')]({'raw':_0x412edf[_0xe04f('0x1f')]?_0x412edf[_0xe04f('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x412edf[_0xe04f('0x1f')]?_0x412edf[_0xe04f('0x1f')][_0xe04f('0x20')]||null:null,'attributes':_0x412edf[_0xe04f('0x1f')]?_0x412edf[_0xe04f('0x1f')][_0xe04f('0x21')]||null:null,'limit':_0x412edf[_0xe04f('0x1f')]?_0x412edf[_0xe04f('0x1f')]['limit']||null:null,'include':_0x412edf[_0xe04f('0x1f')]?_0x412edf[_0xe04f('0x1f')][_0xe04f('0x22')]?_[_0xe04f('0x23')](_0x412edf[_0xe04f('0x1f')]['include'],function(_0x50fa78){return{'model':db[_0x50fa78[_0xe04f('0x24')]],'as':_0x50fa78['as'],'attributes':_0x50fa78[_0xe04f('0x21')],'include':_0x50fa78[_0xe04f('0x22')]?_[_0xe04f('0x23')](_0x50fa78[_0xe04f('0x22')],function(_0x581074){return{'model':db[_0x581074['model']],'as':_0x581074['as'],'attributes':_0x581074[_0xe04f('0x21')],'include':_0x581074['include']?_[_0xe04f('0x23')](_0x581074['include'],function(_0x126cd3){return{'model':db[_0x126cd3['model']],'as':_0x126cd3['as'],'attributes':_0x126cd3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x77fccd){logger[_0xe04f('0x13')](_0xe04f('0x1c'),_0x412edf);logger[_0xe04f('0x25')](_0xe04f('0x1c'),_0x412edf,JSON[_0xe04f('0x17')](_0x77fccd));_0x2e6cc2(_0x77fccd);})['catch'](function(_0x241387){logger[_0xe04f('0x18')](_0xe04f('0x1c'),_0x241387[_0xe04f('0x19')],_0x412edf);_0x51ab8b(_0x2a22a5[_0xe04f('0x18')](0x1f4,_0x241387[_0xe04f('0x19')]));});});};exports[_0xe04f('0x26')]=function(_0x36aba3){var _0x217f28=this;return new Promise(function(_0x3cc75b,_0x100165){return db[_0xe04f('0x1d')][_0xe04f('0x27')]({'raw':_0x36aba3[_0xe04f('0x1f')]?_0x36aba3[_0xe04f('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x36aba3[_0xe04f('0x1f')]?_0x36aba3[_0xe04f('0x1f')][_0xe04f('0x20')]||null:null,'attributes':_0x36aba3[_0xe04f('0x1f')]?_0x36aba3[_0xe04f('0x1f')]['attributes']||null:null,'include':_0x36aba3['options']?_0x36aba3[_0xe04f('0x1f')]['include']?_['map'](_0x36aba3[_0xe04f('0x1f')][_0xe04f('0x22')],function(_0x716b3){return{'model':db[_0x716b3[_0xe04f('0x24')]],'as':_0x716b3['as'],'attributes':_0x716b3['attributes'],'include':_0x716b3[_0xe04f('0x22')]?_[_0xe04f('0x23')](_0x716b3[_0xe04f('0x22')],function(_0x3a202a){return{'model':db[_0x3a202a[_0xe04f('0x24')]],'as':_0x3a202a['as'],'attributes':_0x3a202a[_0xe04f('0x21')],'include':_0x3a202a[_0xe04f('0x22')]?_[_0xe04f('0x23')](_0x3a202a['include'],function(_0x101320){return{'model':db[_0x101320[_0xe04f('0x24')]],'as':_0x101320['as'],'attributes':_0x101320[_0xe04f('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe04f('0x12')](function(_0x19d5a5){logger[_0xe04f('0x13')](_0xe04f('0x26'),_0x36aba3);logger[_0xe04f('0x25')](_0xe04f('0x26'),_0x36aba3,JSON[_0xe04f('0x17')](_0x19d5a5));_0x3cc75b(_0x19d5a5);})['catch'](function(_0x5aa951){logger[_0xe04f('0x18')](_0xe04f('0x26'),_0x5aa951[_0xe04f('0x19')],_0x36aba3);_0x100165(_0x217f28[_0xe04f('0x18')](0x1f4,_0x5aa951[_0xe04f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 9f4c150..024deff 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 _0x0c5f=['./smsQueue.events','update','removeListener','register','length','smsQueue:'];(function(_0x4a6d2b,_0x37b07b){var _0x415979=function(_0x12aa3f){while(--_0x12aa3f){_0x4a6d2b['push'](_0x4a6d2b['shift']());}};_0x415979(++_0x37b07b);}(_0x0c5f,0xf6));var _0xf0c5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0c5f[_0x20a584];return _0x4b41a8;};'use strict';var SmsQueueEvents=require(_0xf0c5('0x0'));var events=['save','remove',_0xf0c5('0x1')];function createListener(_0x456d25,_0xaea928){return function(_0x46c4c2){_0xaea928['emit'](_0x456d25,_0x46c4c2);};}function removeListener(_0x2e64ad,_0x2d2f3d){return function(){SmsQueueEvents[_0xf0c5('0x2')](_0x2e64ad,_0x2d2f3d);};}exports[_0xf0c5('0x3')]=function(_0x59aa6b){for(var _0x577322=0x0,_0x141b35=events[_0xf0c5('0x4')];_0x577322<_0x141b35;_0x577322++){var _0x11f864=events[_0x577322];var _0x400255=createListener(_0xf0c5('0x5')+_0x11f864,_0x59aa6b);SmsQueueEvents['on'](_0x11f864,_0x400255);}}; \ No newline at end of file +var _0xbb67=['removeListener','register','length','./smsQueue.events','remove'];(function(_0x1a53b2,_0x514cd5){var _0x17a3db=function(_0x518787){while(--_0x518787){_0x1a53b2['push'](_0x1a53b2['shift']());}};_0x17a3db(++_0x514cd5);}(_0xbb67,0xe9));var _0x7bb6=function(_0x4df3e4,_0xa9d72c){_0x4df3e4=_0x4df3e4-0x0;var _0x1ae8dd=_0xbb67[_0x4df3e4];return _0x1ae8dd;};'use strict';var SmsQueueEvents=require(_0x7bb6('0x0'));var events=['save',_0x7bb6('0x1'),'update'];function createListener(_0x25355a,_0x382b7e){return function(_0x3bafca){_0x382b7e['emit'](_0x25355a,_0x3bafca);};}function removeListener(_0x414c85,_0x209318){return function(){SmsQueueEvents[_0x7bb6('0x2')](_0x414c85,_0x209318);};}exports[_0x7bb6('0x3')]=function(_0x44748a){for(var _0x51573c=0x0,_0x4f6dea=events[_0x7bb6('0x4')];_0x51573c<_0x4f6dea;_0x51573c++){var _0x5a330c=events[_0x51573c];var _0x30cecb=createListener('smsQueue:'+_0x5a330c,_0x44748a);SmsQueueEvents['on'](_0x5a330c,_0x30cecb);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 232ba0e..ae071fd 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 _0xbe32=['exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','delete','destroy'];(function(_0x39f91b,_0x5741c8){var _0x4f9f2d=function(_0x55bb8d){while(--_0x55bb8d){_0x39f91b['push'](_0x39f91b['shift']());}};_0x4f9f2d(++_0x5741c8);}(_0xbe32,0x8d));var _0x2be3=function(_0x28fa10,_0x39a879){_0x28fa10=_0x28fa10-0x0;var _0x25287a=_0xbe32[_0x28fa10];return _0x25287a;};'use strict';var multer=require(_0x2be3('0x0'));var util=require(_0x2be3('0x1'));var path=require(_0x2be3('0x2'));var timeout=require('connect-timeout');var express=require(_0x2be3('0x3'));var router=express[_0x2be3('0x4')]();var auth=require(_0x2be3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2be3('0x6'));var controller=require(_0x2be3('0x7'));router[_0x2be3('0x8')]('/',auth[_0x2be3('0x9')](),controller[_0x2be3('0xa')]);router[_0x2be3('0x8')](_0x2be3('0xb'),auth[_0x2be3('0x9')](),controller[_0x2be3('0xc')]);router['get'](_0x2be3('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x2be3('0x9')](),controller[_0x2be3('0xe')]);router[_0x2be3('0xf')](_0x2be3('0xd'),auth[_0x2be3('0x9')](),controller[_0x2be3('0x10')]);router[_0x2be3('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x2be3('0x12')]);module[_0x2be3('0x13')]=router; \ No newline at end of file +var _0x22a2=['get','isAuthenticated','index','/describe','describe','/:id','post','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x22a2,0xab));var _0x222a=function(_0x56b8d4,_0x192bed){_0x56b8d4=_0x56b8d4-0x0;var _0x35486d=_0x22a2[_0x56b8d4];return _0x35486d;};'use strict';var multer=require(_0x222a('0x0'));var util=require(_0x222a('0x1'));var path=require('path');var timeout=require(_0x222a('0x2'));var express=require(_0x222a('0x3'));var router=express[_0x222a('0x4')]();var auth=require(_0x222a('0x5'));var interaction=require(_0x222a('0x6'));var config=require(_0x222a('0x7'));var controller=require(_0x222a('0x8'));router[_0x222a('0x9')]('/',auth[_0x222a('0xa')](),controller[_0x222a('0xb')]);router[_0x222a('0x9')](_0x222a('0xc'),auth[_0x222a('0xa')](),controller[_0x222a('0xd')]);router[_0x222a('0x9')](_0x222a('0xe'),auth[_0x222a('0xa')](),controller['show']);router[_0x222a('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x222a('0xa')](),controller['update']);router['delete'](_0x222a('0xe'),auth[_0x222a('0xa')](),controller[_0x222a('0x10')]);module[_0x222a('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 3a2a17d..7e685c4 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 _0xf078=['sequelize','exports','STRING','DATE','moment'];(function(_0x395b31,_0x5c8443){var _0x3167fe=function(_0x11bed1){while(--_0x11bed1){_0x395b31['push'](_0x395b31['shift']());}};_0x3167fe(++_0x5c8443);}(_0xf078,0x9a));var _0x8f07=function(_0x43ea6f,_0x28cf88){_0x43ea6f=_0x43ea6f-0x0;var _0x506914=_0xf078[_0x43ea6f];return _0x506914;};'use strict';var moment=require(_0x8f07('0x0'));var Sequelize=require(_0x8f07('0x1'));module[_0x8f07('0x2')]={'uniqueid':{'type':Sequelize[_0x8f07('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8f07('0x3')]},'joinAt':{'type':Sequelize[_0x8f07('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x8f07('0x4')]},'exitAt':{'type':Sequelize[_0x8f07('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3130=['sequelize','exports','STRING','DATE','moment'];(function(_0x446d88,_0x1e4453){var _0x40077e=function(_0x14a4fd){while(--_0x14a4fd){_0x446d88['push'](_0x446d88['shift']());}};_0x40077e(++_0x1e4453);}(_0x3130,0x180));var _0x0313=function(_0x1549d1,_0x2d64be){_0x1549d1=_0x1549d1-0x0;var _0x145285=_0x3130[_0x1549d1];return _0x145285;};'use strict';var moment=require(_0x0313('0x0'));var Sequelize=require(_0x0313('0x1'));module[_0x0313('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x0313('0x3')]},'joinAt':{'type':Sequelize[_0x0313('0x4')]},'leaveAt':{'type':Sequelize[_0x0313('0x4')]},'acceptAt':{'type':Sequelize[_0x0313('0x4')]},'exitAt':{'type':Sequelize[_0x0313('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 82594cc..237c23f 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 _0x3aed=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','map','SmsQueueReport'];(function(_0x5acf9a,_0x119675){var _0x530b18=function(_0x1d5586){while(--_0x1d5586){_0x5acf9a['push'](_0x5acf9a['shift']());}};_0x530b18(++_0x119675);}(_0x3aed,0x1dd));var _0xd3ae=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x3aed[_0x273c39];return _0x46d6b5;};'use strict';var pdf=require(_0xd3ae('0x0'));var emlformat=require(_0xd3ae('0x1'));var rimraf=require(_0xd3ae('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd3ae('0x3'));var rp=require(_0xd3ae('0x4'));var moment=require('moment');var BPromise=require(_0xd3ae('0x5'));var Mustache=require('mustache');var util=require(_0xd3ae('0x6'));var path=require('path');var sox=require(_0xd3ae('0x7'));var csv=require('to-csv');var ejs=require(_0xd3ae('0x8'));var fs=require('fs');var _=require(_0xd3ae('0x9'));var squel=require('squel');var crypto=require(_0xd3ae('0xa'));var jsforce=require(_0xd3ae('0xb'));var deskjs=require(_0xd3ae('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd3ae('0xd'));var Papa=require(_0xd3ae('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd3ae('0xf'));var as=require(_0xd3ae('0x10'));var hardwareService=require(_0xd3ae('0x11'));var logger=require(_0xd3ae('0x12'))(_0xd3ae('0x13'));var utils=require(_0xd3ae('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd3ae('0x15'));var db=require(_0xd3ae('0x16'))['db'];function respondWithStatusCode(_0x3845a4,_0x4149ff){_0x4149ff=_0x4149ff||0xcc;return function(_0x41a272){if(_0x41a272){return _0x3845a4['sendStatus'](_0x4149ff);}return _0x3845a4[_0xd3ae('0x17')](_0x4149ff)[_0xd3ae('0x18')]();};}function respondWithResult(_0x482064,_0x34ebd7){_0x34ebd7=_0x34ebd7||0xc8;return function(_0x1a1dbb){if(_0x1a1dbb){return _0x482064[_0xd3ae('0x17')](_0x34ebd7)[_0xd3ae('0x19')](_0x1a1dbb);}};}function respondWithFilteredResult(_0x14b0dc,_0x57b231){return function(_0x304b46){if(_0x304b46){var _0x4eb696=_0x304b46[_0xd3ae('0x1a')],_0x34c434=_0x57b231[_0xd3ae('0x1b')],_0x3df012=_0x57b231['offset']+_0x57b231[_0xd3ae('0x1c')],_0x130c63;if(_0x3df012>=_0x4eb696){_0x3df012=_0x4eb696;_0x130c63=0xc8;}else{_0x130c63=0xce;}_0x14b0dc[_0xd3ae('0x17')](_0x130c63);return _0x14b0dc[_0xd3ae('0x1d')](_0xd3ae('0x1e'),_0x34c434+'-'+_0x3df012+'/'+_0x4eb696)['json'](_0x304b46);}return null;};}function patchUpdates(_0x21e4a9){return function(_0x2e5b0c){try{jsonpatch[_0xd3ae('0x1f')](_0x2e5b0c,_0x21e4a9,!![]);}catch(_0x4afc31){return BPromise[_0xd3ae('0x20')](_0x4afc31);}return _0x2e5b0c['save']();};}function saveUpdates(_0x4cb63a,_0x16eca1){return function(_0x3ebf67){if(_0x3ebf67){return _0x3ebf67[_0xd3ae('0x21')](_0x4cb63a)[_0xd3ae('0x22')](function(_0x167b8b){return _0x167b8b;});}return null;};}function removeEntity(_0x144b0c,_0x142fe5){return function(_0xce5046){if(_0xce5046){return _0xce5046[_0xd3ae('0x23')]()[_0xd3ae('0x22')](function(){_0x144b0c[_0xd3ae('0x17')](0xcc)[_0xd3ae('0x18')]();});}};}function handleEntityNotFound(_0x1cd533,_0x28f1d8){return function(_0x5a8168){if(!_0x5a8168){_0x1cd533[_0xd3ae('0x24')](0x194);}return _0x5a8168;};}function handleError(_0x524761,_0x2383c0){_0x2383c0=_0x2383c0||0x1f4;return function(_0x5cb072){logger[_0xd3ae('0x25')](_0x5cb072['stack']);if(_0x5cb072[_0xd3ae('0x26')]){delete _0x5cb072['name'];}_0x524761[_0xd3ae('0x17')](_0x2383c0)['send'](_0x5cb072);};}exports['index']=function(_0xe78780,_0x6eb76e){var _0x5f507a={},_0x271fed={},_0x9ddd3e={'count':0x0,'rows':[]};var _0x1746df=_[_0xd3ae('0x27')](db[_0xd3ae('0x28')]['rawAttributes'],function(_0x2a09cf){return{'name':_0x2a09cf[_0xd3ae('0x29')],'type':_0x2a09cf[_0xd3ae('0x2a')][_0xd3ae('0x2b')]};});_0x271fed[_0xd3ae('0x2c')]=_['map'](_0x1746df,_0xd3ae('0x26'));_0x271fed[_0xd3ae('0x2d')]=_[_0xd3ae('0x2e')](_0xe78780[_0xd3ae('0x2d')]);_0x271fed[_0xd3ae('0x2f')]=_[_0xd3ae('0x30')](_0x271fed[_0xd3ae('0x2c')],_0x271fed[_0xd3ae('0x2d')]);_0x5f507a[_0xd3ae('0x31')]=_['intersection'](_0x271fed[_0xd3ae('0x2c')],qs[_0xd3ae('0x32')](_0xe78780['query'][_0xd3ae('0x32')]));_0x5f507a['attributes']=_0x5f507a[_0xd3ae('0x31')][_0xd3ae('0x33')]?_0x5f507a[_0xd3ae('0x31')]:_0x271fed['model'];if(!_0xe78780[_0xd3ae('0x2d')][_0xd3ae('0x34')](_0xd3ae('0x35'))){_0x5f507a[_0xd3ae('0x1c')]=qs[_0xd3ae('0x1c')](_0xe78780[_0xd3ae('0x2d')][_0xd3ae('0x1c')]);_0x5f507a[_0xd3ae('0x1b')]=qs[_0xd3ae('0x1b')](_0xe78780[_0xd3ae('0x2d')][_0xd3ae('0x1b')]);}_0x5f507a[_0xd3ae('0x36')]=qs[_0xd3ae('0x37')](_0xe78780[_0xd3ae('0x2d')][_0xd3ae('0x37')]);_0x5f507a[_0xd3ae('0x38')]=qs[_0xd3ae('0x2f')](_[_0xd3ae('0x39')](_0xe78780[_0xd3ae('0x2d')],_0x271fed[_0xd3ae('0x2f')]),_0x1746df);if(_0xe78780[_0xd3ae('0x2d')][_0xd3ae('0x3a')]){_0x5f507a[_0xd3ae('0x38')]=_[_0xd3ae('0x3b')](_0x5f507a[_0xd3ae('0x38')],{'$or':_[_0xd3ae('0x27')](_0x1746df,function(_0x5898cb){if(_0x5898cb['type']!==_0xd3ae('0x3c')){var _0x265fb9={};_0x265fb9[_0x5898cb[_0xd3ae('0x26')]]={'$like':'%'+_0xe78780['query'][_0xd3ae('0x3a')]+'%'};return _0x265fb9;}})});}_0x5f507a=_[_0xd3ae('0x3b')]({},_0x5f507a,_0xe78780[_0xd3ae('0x3d')]);var _0x1ba57a={'where':_0x5f507a[_0xd3ae('0x38')]};return db['SmsQueueReport'][_0xd3ae('0x1a')](_0x1ba57a)[_0xd3ae('0x22')](function(_0x2fca65){_0x9ddd3e[_0xd3ae('0x1a')]=_0x2fca65;if(_0xe78780[_0xd3ae('0x2d')][_0xd3ae('0x3e')]){_0x5f507a['include']=[{'all':!![]}];}return db[_0xd3ae('0x28')][_0xd3ae('0x3f')](_0x5f507a);})[_0xd3ae('0x22')](function(_0x9f7410){_0x9ddd3e[_0xd3ae('0x40')]=_0x9f7410;return _0x9ddd3e;})[_0xd3ae('0x22')](respondWithFilteredResult(_0x6eb76e,_0x5f507a))['catch'](handleError(_0x6eb76e,null));};exports[_0xd3ae('0x41')]=function(_0x553712,_0x5dd5fc){var _0x1f2e07={'raw':!![],'where':{'id':_0x553712[_0xd3ae('0x42')]['id']}},_0x57af7e={};_0x57af7e[_0xd3ae('0x2c')]=_['keys'](db['SmsQueueReport'][_0xd3ae('0x43')]);_0x57af7e[_0xd3ae('0x2d')]=_[_0xd3ae('0x2e')](_0x553712[_0xd3ae('0x2d')]);_0x57af7e['filters']=_[_0xd3ae('0x30')](_0x57af7e[_0xd3ae('0x2c')],_0x57af7e['query']);_0x1f2e07['attributes']=_[_0xd3ae('0x30')](_0x57af7e[_0xd3ae('0x2c')],qs[_0xd3ae('0x32')](_0x553712[_0xd3ae('0x2d')][_0xd3ae('0x32')]));_0x1f2e07[_0xd3ae('0x31')]=_0x1f2e07[_0xd3ae('0x31')][_0xd3ae('0x33')]?_0x1f2e07[_0xd3ae('0x31')]:_0x57af7e[_0xd3ae('0x2c')];if(_0x553712['query'][_0xd3ae('0x3e')]){_0x1f2e07[_0xd3ae('0x44')]=[{'all':!![]}];}_0x1f2e07=_[_0xd3ae('0x3b')]({},_0x1f2e07,_0x553712['options']);return db[_0xd3ae('0x28')][_0xd3ae('0x45')](_0x1f2e07)[_0xd3ae('0x22')](handleEntityNotFound(_0x5dd5fc,null))[_0xd3ae('0x22')](respondWithResult(_0x5dd5fc,null))[_0xd3ae('0x46')](handleError(_0x5dd5fc,null));};exports[_0xd3ae('0x47')]=function(_0x4ec5ce,_0x455bb4){return db[_0xd3ae('0x28')][_0xd3ae('0x47')](_0x4ec5ce[_0xd3ae('0x48')],{})[_0xd3ae('0x22')](respondWithResult(_0x455bb4,0xc9))[_0xd3ae('0x46')](handleError(_0x455bb4,null));};exports[_0xd3ae('0x21')]=function(_0x27c040,_0x1f95cd){if(_0x27c040[_0xd3ae('0x48')]['id']){delete _0x27c040[_0xd3ae('0x48')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x27c040['params']['id']}})[_0xd3ae('0x22')](handleEntityNotFound(_0x1f95cd,null))[_0xd3ae('0x22')](saveUpdates(_0x27c040['body'],null))[_0xd3ae('0x22')](respondWithResult(_0x1f95cd,null))[_0xd3ae('0x46')](handleError(_0x1f95cd,null));};exports[_0xd3ae('0x23')]=function(_0x5bd2bf,_0x559d02){return db['SmsQueueReport'][_0xd3ae('0x45')]({'where':{'id':_0x5bd2bf[_0xd3ae('0x42')]['id']}})[_0xd3ae('0x22')](handleEntityNotFound(_0x559d02,null))['then'](removeEntity(_0x559d02,null))[_0xd3ae('0x46')](handleError(_0x559d02,null));};exports[_0xd3ae('0x49')]=function(_0x16bede,_0x302bbe){return db[_0xd3ae('0x28')][_0xd3ae('0x49')]()[_0xd3ae('0x22')](respondWithResult(_0x302bbe,null))[_0xd3ae('0x46')](handleError(_0x302bbe,null));}; \ No newline at end of file +var _0xbb10=['pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','attributes','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','apply','save','update','then','destroy','error','stack','send','index','map','SmsQueueReport','type','key','model','name','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x122eb3,_0x4f7f2b){var _0x4fd611=function(_0x1bc0a6){while(--_0x1bc0a6){_0x122eb3['push'](_0x122eb3['shift']());}};_0x4fd611(++_0x4f7f2b);}(_0xbb10,0x169));var _0x0bb1=function(_0x3222ee,_0x26d21c){_0x3222ee=_0x3222ee-0x0;var _0xd1238f=_0xbb10[_0x3222ee];return _0xd1238f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0bb1('0x0'));var rimraf=require(_0x0bb1('0x1'));var zipdir=require(_0x0bb1('0x2'));var jsonpatch=require(_0x0bb1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0bb1('0x4'));var path=require(_0x0bb1('0x5'));var sox=require(_0x0bb1('0x6'));var csv=require(_0x0bb1('0x7'));var ejs=require(_0x0bb1('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0bb1('0x9'));var jsforce=require(_0x0bb1('0xa'));var deskjs=require(_0x0bb1('0xb'));var toCsv=require(_0x0bb1('0x7'));var querystring=require('querystring');var Papa=require(_0x0bb1('0xc'));var Redis=require(_0x0bb1('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0bb1('0xe'));var hardwareService=require(_0x0bb1('0xf'));var logger=require('../../config/logger')(_0x0bb1('0x10'));var utils=require(_0x0bb1('0x11'));var config=require(_0x0bb1('0x12'));var licenseUtil=require(_0x0bb1('0x13'));var db=require(_0x0bb1('0x14'))['db'];function respondWithStatusCode(_0x4014e5,_0x5eb250){_0x5eb250=_0x5eb250||0xcc;return function(_0x4a7aab){if(_0x4a7aab){return _0x4014e5[_0x0bb1('0x15')](_0x5eb250);}return _0x4014e5[_0x0bb1('0x16')](_0x5eb250)[_0x0bb1('0x17')]();};}function respondWithResult(_0x551863,_0x2abf7c){_0x2abf7c=_0x2abf7c||0xc8;return function(_0x26d6de){if(_0x26d6de){return _0x551863[_0x0bb1('0x16')](_0x2abf7c)['json'](_0x26d6de);}};}function respondWithFilteredResult(_0x37000,_0x2583d1){return function(_0x6f6526){if(_0x6f6526){var _0x191aab=_0x6f6526[_0x0bb1('0x18')],_0x17f50d=_0x2583d1[_0x0bb1('0x19')],_0x3a8002=_0x2583d1[_0x0bb1('0x19')]+_0x2583d1[_0x0bb1('0x1a')],_0x27e1b4;if(_0x3a8002>=_0x191aab){_0x3a8002=_0x191aab;_0x27e1b4=0xc8;}else{_0x27e1b4=0xce;}_0x37000[_0x0bb1('0x16')](_0x27e1b4);return _0x37000['set'](_0x0bb1('0x1b'),_0x17f50d+'-'+_0x3a8002+'/'+_0x191aab)['json'](_0x6f6526);}return null;};}function patchUpdates(_0x145f2d){return function(_0x3d05d7){try{jsonpatch[_0x0bb1('0x1c')](_0x3d05d7,_0x145f2d,!![]);}catch(_0x4c4c93){return BPromise['reject'](_0x4c4c93);}return _0x3d05d7[_0x0bb1('0x1d')]();};}function saveUpdates(_0x366eae,_0x26ef48){return function(_0x1bc3a4){if(_0x1bc3a4){return _0x1bc3a4[_0x0bb1('0x1e')](_0x366eae)[_0x0bb1('0x1f')](function(_0x3d4117){return _0x3d4117;});}return null;};}function removeEntity(_0x375448,_0x3bc188){return function(_0x41ea14){if(_0x41ea14){return _0x41ea14[_0x0bb1('0x20')]()[_0x0bb1('0x1f')](function(){_0x375448[_0x0bb1('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x460d97,_0x5a4d02){return function(_0x58e2a9){if(!_0x58e2a9){_0x460d97[_0x0bb1('0x15')](0x194);}return _0x58e2a9;};}function handleError(_0x2cb345,_0x21c1fa){_0x21c1fa=_0x21c1fa||0x1f4;return function(_0xf9e9c9){logger[_0x0bb1('0x21')](_0xf9e9c9[_0x0bb1('0x22')]);if(_0xf9e9c9['name']){delete _0xf9e9c9['name'];}_0x2cb345['status'](_0x21c1fa)[_0x0bb1('0x23')](_0xf9e9c9);};}exports[_0x0bb1('0x24')]=function(_0x2bffd9,_0x4e4323){var _0x7e449c={},_0x4ff617={},_0x4d03f0={'count':0x0,'rows':[]};var _0xa82cfd=_[_0x0bb1('0x25')](db[_0x0bb1('0x26')]['rawAttributes'],function(_0x48540b){return{'name':_0x48540b['fieldName'],'type':_0x48540b[_0x0bb1('0x27')][_0x0bb1('0x28')]};});_0x4ff617[_0x0bb1('0x29')]=_[_0x0bb1('0x25')](_0xa82cfd,_0x0bb1('0x2a'));_0x4ff617['query']=_['keys'](_0x2bffd9[_0x0bb1('0x2b')]);_0x4ff617[_0x0bb1('0x2c')]=_[_0x0bb1('0x2d')](_0x4ff617[_0x0bb1('0x29')],_0x4ff617['query']);_0x7e449c['attributes']=_['intersection'](_0x4ff617[_0x0bb1('0x29')],qs[_0x0bb1('0x2e')](_0x2bffd9[_0x0bb1('0x2b')]['fields']));_0x7e449c['attributes']=_0x7e449c['attributes'][_0x0bb1('0x2f')]?_0x7e449c['attributes']:_0x4ff617[_0x0bb1('0x29')];if(!_0x2bffd9[_0x0bb1('0x2b')][_0x0bb1('0x30')](_0x0bb1('0x31'))){_0x7e449c['limit']=qs[_0x0bb1('0x1a')](_0x2bffd9[_0x0bb1('0x2b')][_0x0bb1('0x1a')]);_0x7e449c['offset']=qs[_0x0bb1('0x19')](_0x2bffd9[_0x0bb1('0x2b')][_0x0bb1('0x19')]);}_0x7e449c[_0x0bb1('0x32')]=qs[_0x0bb1('0x33')](_0x2bffd9[_0x0bb1('0x2b')][_0x0bb1('0x33')]);_0x7e449c[_0x0bb1('0x34')]=qs[_0x0bb1('0x2c')](_[_0x0bb1('0x35')](_0x2bffd9[_0x0bb1('0x2b')],_0x4ff617[_0x0bb1('0x2c')]),_0xa82cfd);if(_0x2bffd9['query'][_0x0bb1('0x36')]){_0x7e449c['where']=_[_0x0bb1('0x37')](_0x7e449c[_0x0bb1('0x34')],{'$or':_['map'](_0xa82cfd,function(_0x3f2a42){if(_0x3f2a42['type']!=='VIRTUAL'){var _0x565095={};_0x565095[_0x3f2a42[_0x0bb1('0x2a')]]={'$like':'%'+_0x2bffd9[_0x0bb1('0x2b')]['filter']+'%'};return _0x565095;}})});}_0x7e449c=_['merge']({},_0x7e449c,_0x2bffd9[_0x0bb1('0x38')]);var _0x2a7d64={'where':_0x7e449c[_0x0bb1('0x34')]};return db[_0x0bb1('0x26')]['count'](_0x2a7d64)['then'](function(_0xe5a692){_0x4d03f0[_0x0bb1('0x18')]=_0xe5a692;if(_0x2bffd9['query'][_0x0bb1('0x39')]){_0x7e449c[_0x0bb1('0x3a')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x0bb1('0x3b')](_0x7e449c);})[_0x0bb1('0x1f')](function(_0x221bdc){_0x4d03f0[_0x0bb1('0x3c')]=_0x221bdc;return _0x4d03f0;})[_0x0bb1('0x1f')](respondWithFilteredResult(_0x4e4323,_0x7e449c))[_0x0bb1('0x3d')](handleError(_0x4e4323,null));};exports[_0x0bb1('0x3e')]=function(_0x361b73,_0x15ef2d){var _0x42e837={'raw':!![],'where':{'id':_0x361b73[_0x0bb1('0x3f')]['id']}},_0x2bfa2={};_0x2bfa2[_0x0bb1('0x29')]=_['keys'](db['SmsQueueReport'][_0x0bb1('0x40')]);_0x2bfa2['query']=_['keys'](_0x361b73[_0x0bb1('0x2b')]);_0x2bfa2['filters']=_[_0x0bb1('0x2d')](_0x2bfa2[_0x0bb1('0x29')],_0x2bfa2[_0x0bb1('0x2b')]);_0x42e837[_0x0bb1('0x41')]=_['intersection'](_0x2bfa2['model'],qs[_0x0bb1('0x2e')](_0x361b73[_0x0bb1('0x2b')][_0x0bb1('0x2e')]));_0x42e837[_0x0bb1('0x41')]=_0x42e837[_0x0bb1('0x41')]['length']?_0x42e837[_0x0bb1('0x41')]:_0x2bfa2['model'];if(_0x361b73[_0x0bb1('0x2b')][_0x0bb1('0x39')]){_0x42e837['include']=[{'all':!![]}];}_0x42e837=_[_0x0bb1('0x37')]({},_0x42e837,_0x361b73[_0x0bb1('0x38')]);return db[_0x0bb1('0x26')]['find'](_0x42e837)[_0x0bb1('0x1f')](handleEntityNotFound(_0x15ef2d,null))[_0x0bb1('0x1f')](respondWithResult(_0x15ef2d,null))[_0x0bb1('0x3d')](handleError(_0x15ef2d,null));};exports[_0x0bb1('0x42')]=function(_0x4d8a1d,_0x4ef7e0){return db['SmsQueueReport']['create'](_0x4d8a1d['body'],{})[_0x0bb1('0x1f')](respondWithResult(_0x4ef7e0,0xc9))[_0x0bb1('0x3d')](handleError(_0x4ef7e0,null));};exports[_0x0bb1('0x1e')]=function(_0x5e9499,_0x12ecc0){if(_0x5e9499[_0x0bb1('0x43')]['id']){delete _0x5e9499[_0x0bb1('0x43')]['id'];}return db[_0x0bb1('0x26')]['find']({'where':{'id':_0x5e9499[_0x0bb1('0x3f')]['id']}})[_0x0bb1('0x1f')](handleEntityNotFound(_0x12ecc0,null))[_0x0bb1('0x1f')](saveUpdates(_0x5e9499[_0x0bb1('0x43')],null))[_0x0bb1('0x1f')](respondWithResult(_0x12ecc0,null))[_0x0bb1('0x3d')](handleError(_0x12ecc0,null));};exports[_0x0bb1('0x20')]=function(_0x5ed101,_0x43e924){return db['SmsQueueReport']['find']({'where':{'id':_0x5ed101[_0x0bb1('0x3f')]['id']}})[_0x0bb1('0x1f')](handleEntityNotFound(_0x43e924,null))['then'](removeEntity(_0x43e924,null))[_0x0bb1('0x3d')](handleError(_0x43e924,null));};exports[_0x0bb1('0x44')]=function(_0x57bb6f,_0x18ac60){return db[_0x0bb1('0x26')][_0x0bb1('0x44')]()['then'](respondWithResult(_0x18ac60,null))[_0x0bb1('0x3d')](handleError(_0x18ac60,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 22a5c01..bd37eed 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 _0xbe31=['exports','define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5096fb,_0x24eacb){var _0x327e78=function(_0x3dea9c){while(--_0x3dea9c){_0x5096fb['push'](_0x5096fb['shift']());}};_0x327e78(++_0x24eacb);}(_0xbe31,0x83));var _0x1be3=function(_0x4e0403,_0x23bb0a){_0x4e0403=_0x4e0403-0x0;var _0xb4ab4f=_0xbe31[_0x4e0403];return _0xb4ab4f;};'use strict';var _=require('lodash');var util=require(_0x1be3('0x0'));var logger=require(_0x1be3('0x1'))(_0x1be3('0x2'));var moment=require(_0x1be3('0x3'));var BPromise=require(_0x1be3('0x4'));var rp=require(_0x1be3('0x5'));var fs=require('fs');var path=require(_0x1be3('0x6'));var rimraf=require(_0x1be3('0x7'));var config=require(_0x1be3('0x8'));var attributes=require('./smsQueueReport.attributes');module[_0x1be3('0x9')]=function(_0x57e6b0,_0x1f09ec){return _0x57e6b0[_0x1be3('0xa')](_0x1be3('0xb'),attributes,{'tableName':_0x1be3('0xc'),'paranoid':![],'indexes':[{'name':_0x1be3('0xd'),'fields':[_0x1be3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4e6e=['api','moment','bluebird','request-promise','./smsQueueReport.attributes','lodash','../../config/logger'];(function(_0x4d8204,_0x58a57f){var _0x141381=function(_0x101625){while(--_0x101625){_0x4d8204['push'](_0x4d8204['shift']());}};_0x141381(++_0x58a57f);}(_0x4e6e,0x1c5));var _0xe4e6=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x4e6e[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0xe4e6('0x0'));var util=require('util');var logger=require(_0xe4e6('0x1'))(_0xe4e6('0x2'));var moment=require(_0xe4e6('0x3'));var BPromise=require(_0xe4e6('0x4'));var rp=require(_0xe4e6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe4e6('0x6'));module['exports']=function(_0x4a3e3a,_0x582dec){return _0x4a3e3a['define']('SmsQueueReport',attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','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 eda3abe..fc56b80 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 _0x0fee=['client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','update','where','attributes','limit','UpdateSmsQueueReport','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0fee,0x138));var _0xe0fe=function(_0xd68aaa,_0x491585){_0xd68aaa=_0xd68aaa-0x0;var _0x3531e7=_0x0fee[_0xd68aaa];return _0x3531e7;};'use strict';var _=require(_0xe0fe('0x0'));var util=require(_0xe0fe('0x1'));var moment=require('moment');var BPromise=require(_0xe0fe('0x2'));var rs=require(_0xe0fe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe0fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe0fe('0x5'))(_0xe0fe('0x6'));var config=require('../../config/environment');var jayson=require(_0xe0fe('0x7'));var client=jayson[_0xe0fe('0x8')][_0xe0fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e5aa6,_0x238dcd,_0x5b3ae5){return new BPromise(function(_0x466fe9,_0x2db05d){return client[_0xe0fe('0xa')](_0x5e5aa6,_0x5b3ae5)[_0xe0fe('0xb')](function(_0x31f6ba){logger[_0xe0fe('0xc')](_0xe0fe('0xd'),_0x238dcd,_0xe0fe('0xe'));logger[_0xe0fe('0xf')](_0xe0fe('0x10'),_0x238dcd,'request\x20sent',JSON[_0xe0fe('0x11')](_0x31f6ba));if(_0x31f6ba[_0xe0fe('0x12')]){if(_0x31f6ba[_0xe0fe('0x12')]['code']===0x1f4){logger[_0xe0fe('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x238dcd,_0x31f6ba[_0xe0fe('0x12')][_0xe0fe('0x13')]);return _0x2db05d(_0x31f6ba['error']['message']);}logger['error'](_0xe0fe('0xd'),_0x238dcd,_0x31f6ba[_0xe0fe('0x12')][_0xe0fe('0x13')]);return _0x466fe9(_0x31f6ba[_0xe0fe('0x12')][_0xe0fe('0x13')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x238dcd,_0xe0fe('0xe'));_0x466fe9(_0x31f6ba[_0xe0fe('0x14')][_0xe0fe('0x13')]);}})['catch'](function(_0x24c92d){logger[_0xe0fe('0x12')](_0xe0fe('0xd'),_0x238dcd,_0x24c92d);_0x2db05d(_0x24c92d);});});}exports[_0xe0fe('0x15')]=function(_0x9d0f55){var _0x2170b3=this;return new Promise(function(_0x55032d,_0x2b538e){return db[_0xe0fe('0x16')][_0xe0fe('0x17')](_0x9d0f55[_0xe0fe('0x18')],{'raw':_0x9d0f55[_0xe0fe('0x19')]?_0x9d0f55['options'][_0xe0fe('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1d69b1){logger[_0xe0fe('0xc')](_0xe0fe('0x15'),_0x9d0f55);logger['debug'](_0xe0fe('0x15'),_0x9d0f55,JSON[_0xe0fe('0x11')](_0x1d69b1));_0x55032d(_0x1d69b1);})['catch'](function(_0x28cfe1){logger[_0xe0fe('0x12')](_0xe0fe('0x15'),_0x28cfe1[_0xe0fe('0x13')],_0x9d0f55);_0x2b538e(_0x2170b3[_0xe0fe('0x12')](0x1f4,_0x28cfe1['message']));});});};exports['UpdateSmsQueueReport']=function(_0x397cc8){var _0x30fcca=this;return new Promise(function(_0x4cbd48,_0x425cc0){return db['SmsQueueReport'][_0xe0fe('0x1b')](_0x397cc8[_0xe0fe('0x18')],{'raw':_0x397cc8[_0xe0fe('0x19')]?_0x397cc8[_0xe0fe('0x19')][_0xe0fe('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x397cc8['options']?_0x397cc8[_0xe0fe('0x19')][_0xe0fe('0x1c')]||null:null,'attributes':_0x397cc8['options']?_0x397cc8[_0xe0fe('0x19')][_0xe0fe('0x1d')]||null:null,'limit':_0x397cc8['options']?_0x397cc8[_0xe0fe('0x19')][_0xe0fe('0x1e')]||null:null})[_0xe0fe('0xb')](function(_0x4ccfbe){logger[_0xe0fe('0xc')]('UpdateSmsQueueReport',_0x397cc8);logger[_0xe0fe('0xf')](_0xe0fe('0x1f'),_0x397cc8,JSON[_0xe0fe('0x11')](_0x4ccfbe));_0x4cbd48(_0x4ccfbe);})['catch'](function(_0x2f5825){logger[_0xe0fe('0x12')](_0xe0fe('0x1f'),_0x2f5825[_0xe0fe('0x13')],_0x397cc8);_0x425cc0(_0x30fcca[_0xe0fe('0x12')](0x1f4,_0x2f5825[_0xe0fe('0x13')]));});});}; \ No newline at end of file +var _0xc373=['CreateSmsQueueReport','SmsQueueReport','body','options','raw','UpdateSmsQueueReport','update','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x316a42,_0x2c7e58){var _0x500784=function(_0x5c6387){while(--_0x5c6387){_0x316a42['push'](_0x316a42['shift']());}};_0x500784(++_0x2c7e58);}(_0xc373,0x9f));var _0x3c37=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xc373[_0x39e283];return _0x7de89f;};'use strict';var _=require(_0x3c37('0x0'));var util=require('util');var moment=require(_0x3c37('0x1'));var BPromise=require('bluebird');var rs=require(_0x3c37('0x2'));var fs=require('fs');var Redis=require(_0x3c37('0x3'));var db=require(_0x3c37('0x4'))['db'];var utils=require(_0x3c37('0x5'));var logger=require(_0x3c37('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3c37('0x7'));var client=jayson['client'][_0x3c37('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4cc1f2,_0x50f71f,_0x28c746){return new BPromise(function(_0xba47df,_0x2e0382){return client[_0x3c37('0x9')](_0x4cc1f2,_0x28c746)[_0x3c37('0xa')](function(_0x4ad5d2){logger[_0x3c37('0xb')](_0x3c37('0xc'),_0x50f71f,_0x3c37('0xd'));logger[_0x3c37('0xe')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x50f71f,_0x3c37('0xd'),JSON[_0x3c37('0xf')](_0x4ad5d2));if(_0x4ad5d2[_0x3c37('0x10')]){if(_0x4ad5d2['error'][_0x3c37('0x11')]===0x1f4){logger['error'](_0x3c37('0xc'),_0x50f71f,_0x4ad5d2[_0x3c37('0x10')][_0x3c37('0x12')]);return _0x2e0382(_0x4ad5d2['error']['message']);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x50f71f,_0x4ad5d2[_0x3c37('0x10')]['message']);return _0xba47df(_0x4ad5d2[_0x3c37('0x10')]['message']);}else{logger[_0x3c37('0xb')](_0x3c37('0xc'),_0x50f71f,_0x3c37('0xd'));_0xba47df(_0x4ad5d2[_0x3c37('0x13')][_0x3c37('0x12')]);}})[_0x3c37('0x14')](function(_0x5fde8){logger[_0x3c37('0x10')](_0x3c37('0xc'),_0x50f71f,_0x5fde8);_0x2e0382(_0x5fde8);});});}exports[_0x3c37('0x15')]=function(_0x12b453){var _0x3c2f4d=this;return new Promise(function(_0x151396,_0x356b5e){return db[_0x3c37('0x16')]['create'](_0x12b453[_0x3c37('0x17')],{'raw':_0x12b453[_0x3c37('0x18')]?_0x12b453[_0x3c37('0x18')][_0x3c37('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3d4cce){logger[_0x3c37('0xb')](_0x3c37('0x15'),_0x12b453);logger[_0x3c37('0xe')](_0x3c37('0x15'),_0x12b453,JSON[_0x3c37('0xf')](_0x3d4cce));_0x151396(_0x3d4cce);})[_0x3c37('0x14')](function(_0x1d7ce6){logger[_0x3c37('0x10')]('CreateSmsQueueReport',_0x1d7ce6[_0x3c37('0x12')],_0x12b453);_0x356b5e(_0x3c2f4d[_0x3c37('0x10')](0x1f4,_0x1d7ce6['message']));});});};exports[_0x3c37('0x1a')]=function(_0x4e8e0c){var _0x23baf1=this;return new Promise(function(_0xa1db5,_0x2c35db){return db['SmsQueueReport'][_0x3c37('0x1b')](_0x4e8e0c[_0x3c37('0x17')],{'raw':_0x4e8e0c[_0x3c37('0x18')]?_0x4e8e0c[_0x3c37('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e8e0c[_0x3c37('0x18')]?_0x4e8e0c[_0x3c37('0x18')]['where']||null:null,'attributes':_0x4e8e0c[_0x3c37('0x18')]?_0x4e8e0c['options'][_0x3c37('0x1c')]||null:null,'limit':_0x4e8e0c[_0x3c37('0x18')]?_0x4e8e0c[_0x3c37('0x18')][_0x3c37('0x1d')]||null:null})['then'](function(_0x4fd33f){logger['info'](_0x3c37('0x1a'),_0x4e8e0c);logger[_0x3c37('0xe')](_0x3c37('0x1a'),_0x4e8e0c,JSON[_0x3c37('0xf')](_0x4fd33f));_0xa1db5(_0x4fd33f);})[_0x3c37('0x14')](function(_0x586cc1){logger['error'](_0x3c37('0x1a'),_0x586cc1['message'],_0x4e8e0c);_0x2c35db(_0x23baf1[_0x3c37('0x10')](0x1f4,_0x586cc1['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index c34e7ef..7ba8aec 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 _0xb03e=['describe','/:id','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x1555b0,_0x1d1d4b){var _0x360a0c=function(_0xcb29e3){while(--_0xcb29e3){_0x1555b0['push'](_0x1555b0['shift']());}};_0x360a0c(++_0x1d1d4b);}(_0xb03e,0x1eb));var _0xeb03=function(_0x5219f6,_0x1c289c){_0x5219f6=_0x5219f6-0x0;var _0x32c4fc=_0xb03e[_0x5219f6];return _0x32c4fc;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var auth=require(_0xeb03('0x5'));var interaction=require(_0xeb03('0x6'));var config=require(_0xeb03('0x7'));var controller=require(_0xeb03('0x8'));router[_0xeb03('0x9')]('/',auth[_0xeb03('0xa')](),controller[_0xeb03('0xb')]);router['get'](_0xeb03('0xc'),auth[_0xeb03('0xa')](),controller[_0xeb03('0xd')]);router[_0xeb03('0x9')](_0xeb03('0xe'),auth[_0xeb03('0xa')](),controller['show']);router[_0xeb03('0xf')]('/',auth[_0xeb03('0xa')](),controller[_0xeb03('0x10')]);router['put'](_0xeb03('0xe'),auth['isAuthenticated'](),controller[_0xeb03('0x11')]);router[_0xeb03('0x12')](_0xeb03('0xe'),auth[_0xeb03('0xa')](),controller[_0xeb03('0x13')]);module[_0xeb03('0x14')]=router; \ No newline at end of file +var _0x80ed=['get','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index'];(function(_0x517e95,_0x43d132){var _0xf47b01=function(_0x317620){while(--_0x317620){_0x517e95['push'](_0x517e95['shift']());}};_0xf47b01(++_0x43d132);}(_0x80ed,0x11c));var _0xd80e=function(_0x4a0c47,_0x12d66b){_0x4a0c47=_0x4a0c47-0x0;var _0x56cc4c=_0x80ed[_0x4a0c47];return _0x56cc4c;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var auth=require(_0xd80e('0x4'));var interaction=require(_0xd80e('0x5'));var config=require(_0xd80e('0x6'));var controller=require(_0xd80e('0x7'));router['get']('/',auth[_0xd80e('0x8')](),controller[_0xd80e('0x9')]);router[_0xd80e('0xa')]('/describe',auth[_0xd80e('0x8')](),controller[_0xd80e('0xb')]);router[_0xd80e('0xa')](_0xd80e('0xc'),auth[_0xd80e('0x8')](),controller[_0xd80e('0xd')]);router[_0xd80e('0xe')]('/',auth[_0xd80e('0x8')](),controller[_0xd80e('0xf')]);router[_0xd80e('0x10')]('/:id',auth[_0xd80e('0x8')](),controller[_0xd80e('0x11')]);router[_0xd80e('0x12')](_0xd80e('0xc'),auth[_0xd80e('0x8')](),controller[_0xd80e('0x13')]);module[_0xd80e('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 5d4e7f3..184f3a2 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 _0xdd86=['queue','DATE','moment','sequelize','exports','STRING','account','agent'];(function(_0x144b30,_0x77072d){var _0x1bb7bc=function(_0x1082cc){while(--_0x1082cc){_0x144b30['push'](_0x144b30['shift']());}};_0x1bb7bc(++_0x77072d);}(_0xdd86,0x72));var _0x6dd8=function(_0x3cfad6,_0x2b840f){_0x3cfad6=_0x3cfad6-0x0;var _0x7b60c1=_0xdd86[_0x3cfad6];return _0x7b60c1;};'use strict';var moment=require(_0x6dd8('0x0'));var Sequelize=require(_0x6dd8('0x1'));module[_0x6dd8('0x2')]={'uniqueid':{'type':Sequelize[_0x6dd8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6dd8('0x4'),_0x6dd8('0x5'),_0x6dd8('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x6dd8('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x5839=['exports','STRING','ENUM','account','agent','queue','DATE'];(function(_0x554db0,_0x4eda6b){var _0x2ac209=function(_0x528c51){while(--_0x528c51){_0x554db0['push'](_0x554db0['shift']());}};_0x2ac209(++_0x4eda6b);}(_0x5839,0x134));var _0x9583=function(_0x1d61de,_0x2a303d){_0x1d61de=_0x1d61de-0x0;var _0x446d8f=_0x5839[_0x1d61de];return _0x446d8f;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x9583('0x0')]={'uniqueid':{'type':Sequelize[_0x9583('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9583('0x2')](_0x9583('0x3'),_0x9583('0x4'),_0x9583('0x5')),'allowNull':![],'defaultValue':_0x9583('0x5')},'transferredAt':{'type':Sequelize[_0x9583('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 4e4636a..3158fe2 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 _0x9b87=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','stack','name','index','map','SmsTransferReport','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3857b1,_0x8ac71f){var _0x1ad85c=function(_0x1c7849){while(--_0x1c7849){_0x3857b1['push'](_0x3857b1['shift']());}};_0x1ad85c(++_0x8ac71f);}(_0x9b87,0x8e));var _0x79b8=function(_0x10bde1,_0x2bb5fe){_0x10bde1=_0x10bde1-0x0;var _0x49d844=_0x9b87[_0x10bde1];return _0x49d844;};'use strict';var pdf=require(_0x79b8('0x0'));var emlformat=require(_0x79b8('0x1'));var rimraf=require(_0x79b8('0x2'));var zipdir=require(_0x79b8('0x3'));var jsonpatch=require(_0x79b8('0x4'));var rp=require(_0x79b8('0x5'));var moment=require(_0x79b8('0x6'));var BPromise=require(_0x79b8('0x7'));var Mustache=require(_0x79b8('0x8'));var util=require(_0x79b8('0x9'));var path=require(_0x79b8('0xa'));var sox=require(_0x79b8('0xb'));var csv=require(_0x79b8('0xc'));var ejs=require(_0x79b8('0xd'));var fs=require('fs');var _=require(_0x79b8('0xe'));var squel=require(_0x79b8('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x79b8('0x10'));var Papa=require(_0x79b8('0x11'));var Redis=require(_0x79b8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x79b8('0x13'));var as=require(_0x79b8('0x14'));var hardwareService=require(_0x79b8('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x79b8('0x16'));var config=require(_0x79b8('0x17'));var licenseUtil=require(_0x79b8('0x18'));var db=require(_0x79b8('0x19'))['db'];function respondWithStatusCode(_0x21ad20,_0x33227b){_0x33227b=_0x33227b||0xcc;return function(_0x41095c){if(_0x41095c){return _0x21ad20[_0x79b8('0x1a')](_0x33227b);}return _0x21ad20[_0x79b8('0x1b')](_0x33227b)[_0x79b8('0x1c')]();};}function respondWithResult(_0x43ec09,_0x59e229){_0x59e229=_0x59e229||0xc8;return function(_0x150fb7){if(_0x150fb7){return _0x43ec09['status'](_0x59e229)['json'](_0x150fb7);}};}function respondWithFilteredResult(_0x3142e9,_0x21aae0){return function(_0x57a248){if(_0x57a248){var _0x5ddab5=_0x57a248[_0x79b8('0x1d')],_0x3e3de3=_0x21aae0[_0x79b8('0x1e')],_0x49e40b=_0x21aae0[_0x79b8('0x1e')]+_0x21aae0[_0x79b8('0x1f')],_0x5ef869;if(_0x49e40b>=_0x5ddab5){_0x49e40b=_0x5ddab5;_0x5ef869=0xc8;}else{_0x5ef869=0xce;}_0x3142e9[_0x79b8('0x1b')](_0x5ef869);return _0x3142e9[_0x79b8('0x20')]('Content-Range',_0x3e3de3+'-'+_0x49e40b+'/'+_0x5ddab5)[_0x79b8('0x21')](_0x57a248);}return null;};}function patchUpdates(_0x5bdfb9){return function(_0x53d386){try{jsonpatch[_0x79b8('0x22')](_0x53d386,_0x5bdfb9,!![]);}catch(_0x131d04){return BPromise[_0x79b8('0x23')](_0x131d04);}return _0x53d386[_0x79b8('0x24')]();};}function saveUpdates(_0x1e24cf,_0x1e7507){return function(_0x3611c3){if(_0x3611c3){return _0x3611c3[_0x79b8('0x25')](_0x1e24cf)[_0x79b8('0x26')](function(_0x48ba32){return _0x48ba32;});}return null;};}function removeEntity(_0x3e9d83,_0x255207){return function(_0x4dbfcf){if(_0x4dbfcf){return _0x4dbfcf[_0x79b8('0x27')]()[_0x79b8('0x26')](function(){_0x3e9d83['status'](0xcc)[_0x79b8('0x1c')]();});}};}function handleEntityNotFound(_0x4f543f,_0x5e8228){return function(_0x257ea5){if(!_0x257ea5){_0x4f543f[_0x79b8('0x1a')](0x194);}return _0x257ea5;};}function handleError(_0x262b48,_0x665170){_0x665170=_0x665170||0x1f4;return function(_0x9deb6c){logger['error'](_0x9deb6c[_0x79b8('0x28')]);if(_0x9deb6c[_0x79b8('0x29')]){delete _0x9deb6c[_0x79b8('0x29')];}_0x262b48[_0x79b8('0x1b')](_0x665170)['send'](_0x9deb6c);};}exports[_0x79b8('0x2a')]=function(_0x2b6fad,_0x14a4d6){var _0x4aa92c={},_0x43a09e={},_0x4a4ef6={'count':0x0,'rows':[]};var _0x43058e=_[_0x79b8('0x2b')](db[_0x79b8('0x2c')][_0x79b8('0x2d')],function(_0x4f51d1){return{'name':_0x4f51d1[_0x79b8('0x2e')],'type':_0x4f51d1['type'][_0x79b8('0x2f')]};});_0x43a09e['model']=_[_0x79b8('0x2b')](_0x43058e,_0x79b8('0x29'));_0x43a09e[_0x79b8('0x30')]=_['keys'](_0x2b6fad[_0x79b8('0x30')]);_0x43a09e[_0x79b8('0x31')]=_[_0x79b8('0x32')](_0x43a09e[_0x79b8('0x33')],_0x43a09e['query']);_0x4aa92c[_0x79b8('0x34')]=_['intersection'](_0x43a09e['model'],qs[_0x79b8('0x35')](_0x2b6fad[_0x79b8('0x30')]['fields']));_0x4aa92c[_0x79b8('0x34')]=_0x4aa92c['attributes']['length']?_0x4aa92c[_0x79b8('0x34')]:_0x43a09e['model'];if(!_0x2b6fad[_0x79b8('0x30')][_0x79b8('0x36')]('nolimit')){_0x4aa92c[_0x79b8('0x1f')]=qs[_0x79b8('0x1f')](_0x2b6fad[_0x79b8('0x30')][_0x79b8('0x1f')]);_0x4aa92c[_0x79b8('0x1e')]=qs[_0x79b8('0x1e')](_0x2b6fad['query'][_0x79b8('0x1e')]);}_0x4aa92c[_0x79b8('0x37')]=qs[_0x79b8('0x38')](_0x2b6fad[_0x79b8('0x30')][_0x79b8('0x38')]);_0x4aa92c[_0x79b8('0x39')]=qs[_0x79b8('0x31')](_[_0x79b8('0x3a')](_0x2b6fad[_0x79b8('0x30')],_0x43a09e[_0x79b8('0x31')]),_0x43058e);if(_0x2b6fad[_0x79b8('0x30')]['filter']){_0x4aa92c[_0x79b8('0x39')]=_[_0x79b8('0x3b')](_0x4aa92c[_0x79b8('0x39')],{'$or':_['map'](_0x43058e,function(_0x3cbf9b){if(_0x3cbf9b[_0x79b8('0x3c')]!==_0x79b8('0x3d')){var _0x1f0dea={};_0x1f0dea[_0x3cbf9b[_0x79b8('0x29')]]={'$like':'%'+_0x2b6fad[_0x79b8('0x30')]['filter']+'%'};return _0x1f0dea;}})});}_0x4aa92c=_[_0x79b8('0x3b')]({},_0x4aa92c,_0x2b6fad['options']);var _0x512d04={'where':_0x4aa92c[_0x79b8('0x39')]};return db['SmsTransferReport']['count'](_0x512d04)[_0x79b8('0x26')](function(_0x1f211a){_0x4a4ef6[_0x79b8('0x1d')]=_0x1f211a;if(_0x2b6fad[_0x79b8('0x30')][_0x79b8('0x3e')]){_0x4aa92c[_0x79b8('0x3f')]=[{'all':!![]}];}return db[_0x79b8('0x2c')][_0x79b8('0x40')](_0x4aa92c);})[_0x79b8('0x26')](function(_0x37fe86){_0x4a4ef6[_0x79b8('0x41')]=_0x37fe86;return _0x4a4ef6;})[_0x79b8('0x26')](respondWithFilteredResult(_0x14a4d6,_0x4aa92c))[_0x79b8('0x42')](handleError(_0x14a4d6,null));};exports['show']=function(_0x317fe2,_0x13b041){var _0x4da364={'raw':!![],'where':{'id':_0x317fe2[_0x79b8('0x43')]['id']}},_0x3c4ce7={};_0x3c4ce7['model']=_[_0x79b8('0x44')](db[_0x79b8('0x2c')][_0x79b8('0x2d')]);_0x3c4ce7[_0x79b8('0x30')]=_[_0x79b8('0x44')](_0x317fe2[_0x79b8('0x30')]);_0x3c4ce7[_0x79b8('0x31')]=_[_0x79b8('0x32')](_0x3c4ce7[_0x79b8('0x33')],_0x3c4ce7[_0x79b8('0x30')]);_0x4da364[_0x79b8('0x34')]=_[_0x79b8('0x32')](_0x3c4ce7['model'],qs['fields'](_0x317fe2[_0x79b8('0x30')][_0x79b8('0x35')]));_0x4da364[_0x79b8('0x34')]=_0x4da364[_0x79b8('0x34')]['length']?_0x4da364[_0x79b8('0x34')]:_0x3c4ce7[_0x79b8('0x33')];if(_0x317fe2[_0x79b8('0x30')][_0x79b8('0x3e')]){_0x4da364['include']=[{'all':!![]}];}_0x4da364=_[_0x79b8('0x3b')]({},_0x4da364,_0x317fe2[_0x79b8('0x45')]);return db[_0x79b8('0x2c')][_0x79b8('0x46')](_0x4da364)['then'](handleEntityNotFound(_0x13b041,null))[_0x79b8('0x26')](respondWithResult(_0x13b041,null))[_0x79b8('0x42')](handleError(_0x13b041,null));};exports[_0x79b8('0x47')]=function(_0x181f52,_0x354ddc){return db[_0x79b8('0x2c')]['create'](_0x181f52[_0x79b8('0x48')],{})[_0x79b8('0x26')](respondWithResult(_0x354ddc,0xc9))[_0x79b8('0x42')](handleError(_0x354ddc,null));};exports[_0x79b8('0x25')]=function(_0x478940,_0x49ec63){if(_0x478940[_0x79b8('0x48')]['id']){delete _0x478940[_0x79b8('0x48')]['id'];}return db[_0x79b8('0x2c')][_0x79b8('0x46')]({'where':{'id':_0x478940[_0x79b8('0x43')]['id']}})[_0x79b8('0x26')](handleEntityNotFound(_0x49ec63,null))[_0x79b8('0x26')](saveUpdates(_0x478940[_0x79b8('0x48')],null))[_0x79b8('0x26')](respondWithResult(_0x49ec63,null))['catch'](handleError(_0x49ec63,null));};exports[_0x79b8('0x27')]=function(_0x374fe9,_0xe82504){return db['SmsTransferReport'][_0x79b8('0x46')]({'where':{'id':_0x374fe9['params']['id']}})['then'](handleEntityNotFound(_0xe82504,null))[_0x79b8('0x26')](removeEntity(_0xe82504,null))[_0x79b8('0x42')](handleError(_0xe82504,null));};exports[_0x79b8('0x49')]=function(_0xac07cc,_0x4cdcf9){return db['SmsTransferReport'][_0x79b8('0x49')]()[_0x79b8('0x26')](respondWithResult(_0x4cdcf9,null))[_0x79b8('0x42')](handleError(_0x4cdcf9,null));}; \ No newline at end of file +var _0xd58c=['then','destroy','stack','name','index','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SmsTransferReport','include','catch','show','params','length','includeAll','find','create','body','update','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','json','apply'];(function(_0x833c18,_0x310c91){var _0x4ffa3d=function(_0x589283){while(--_0x589283){_0x833c18['push'](_0x833c18['shift']());}};_0x4ffa3d(++_0x310c91);}(_0xd58c,0xb6));var _0xcd58=function(_0x206f5a,_0x6cf023){_0x206f5a=_0x206f5a-0x0;var _0x3f8f31=_0xd58c[_0x206f5a];return _0x3f8f31;};'use strict';var pdf=require(_0xcd58('0x0'));var emlformat=require(_0xcd58('0x1'));var rimraf=require(_0xcd58('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcd58('0x3'));var rp=require('request-promise');var moment=require(_0xcd58('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcd58('0x5'));var util=require(_0xcd58('0x6'));var path=require(_0xcd58('0x7'));var sox=require(_0xcd58('0x8'));var csv=require(_0xcd58('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xcd58('0xa'));var crypto=require(_0xcd58('0xb'));var jsforce=require(_0xcd58('0xc'));var deskjs=require(_0xcd58('0xd'));var toCsv=require(_0xcd58('0x9'));var querystring=require('querystring');var Papa=require(_0xcd58('0xe'));var Redis=require(_0xcd58('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcd58('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcd58('0x11'));var logger=require(_0xcd58('0x12'))(_0xcd58('0x13'));var utils=require('../../config/utils');var config=require(_0xcd58('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xcd58('0x15'))['db'];function respondWithStatusCode(_0x51880c,_0x477d19){_0x477d19=_0x477d19||0xcc;return function(_0x42b221){if(_0x42b221){return _0x51880c[_0xcd58('0x16')](_0x477d19);}return _0x51880c[_0xcd58('0x17')](_0x477d19)[_0xcd58('0x18')]();};}function respondWithResult(_0x202412,_0xda9091){_0xda9091=_0xda9091||0xc8;return function(_0x3376f3){if(_0x3376f3){return _0x202412['status'](_0xda9091)['json'](_0x3376f3);}};}function respondWithFilteredResult(_0x3ce190,_0xa225e3){return function(_0x3d5e86){if(_0x3d5e86){var _0x51f5b6=_0x3d5e86[_0xcd58('0x19')],_0x515fc3=_0xa225e3['offset'],_0xea2532=_0xa225e3['offset']+_0xa225e3[_0xcd58('0x1a')],_0xeaee1f;if(_0xea2532>=_0x51f5b6){_0xea2532=_0x51f5b6;_0xeaee1f=0xc8;}else{_0xeaee1f=0xce;}_0x3ce190['status'](_0xeaee1f);return _0x3ce190[_0xcd58('0x1b')](_0xcd58('0x1c'),_0x515fc3+'-'+_0xea2532+'/'+_0x51f5b6)[_0xcd58('0x1d')](_0x3d5e86);}return null;};}function patchUpdates(_0x149641){return function(_0x491198){try{jsonpatch[_0xcd58('0x1e')](_0x491198,_0x149641,!![]);}catch(_0x49881d){return BPromise['reject'](_0x49881d);}return _0x491198['save']();};}function saveUpdates(_0x503c5,_0x1e6ce7){return function(_0x44b002){if(_0x44b002){return _0x44b002['update'](_0x503c5)[_0xcd58('0x1f')](function(_0x2a8681){return _0x2a8681;});}return null;};}function removeEntity(_0x5c241c,_0x18f953){return function(_0x1765d3){if(_0x1765d3){return _0x1765d3[_0xcd58('0x20')]()['then'](function(){_0x5c241c['status'](0xcc)[_0xcd58('0x18')]();});}};}function handleEntityNotFound(_0x3eae55,_0x135b0a){return function(_0x33feb3){if(!_0x33feb3){_0x3eae55[_0xcd58('0x16')](0x194);}return _0x33feb3;};}function handleError(_0x38a559,_0x2ea852){_0x2ea852=_0x2ea852||0x1f4;return function(_0x50f8a7){logger['error'](_0x50f8a7[_0xcd58('0x21')]);if(_0x50f8a7[_0xcd58('0x22')]){delete _0x50f8a7['name'];}_0x38a559[_0xcd58('0x17')](_0x2ea852)['send'](_0x50f8a7);};}exports[_0xcd58('0x23')]=function(_0x2ec6b1,_0x75bb8e){var _0x1784ff={},_0x2b64b8={},_0x30cf55={'count':0x0,'rows':[]};var _0x52b205=_[_0xcd58('0x24')](db['SmsTransferReport'][_0xcd58('0x25')],function(_0x5e1b62){return{'name':_0x5e1b62[_0xcd58('0x26')],'type':_0x5e1b62['type'][_0xcd58('0x27')]};});_0x2b64b8['model']=_[_0xcd58('0x24')](_0x52b205,_0xcd58('0x22'));_0x2b64b8[_0xcd58('0x28')]=_[_0xcd58('0x29')](_0x2ec6b1['query']);_0x2b64b8[_0xcd58('0x2a')]=_['intersection'](_0x2b64b8[_0xcd58('0x2b')],_0x2b64b8[_0xcd58('0x28')]);_0x1784ff[_0xcd58('0x2c')]=_[_0xcd58('0x2d')](_0x2b64b8[_0xcd58('0x2b')],qs[_0xcd58('0x2e')](_0x2ec6b1['query']['fields']));_0x1784ff[_0xcd58('0x2c')]=_0x1784ff['attributes']['length']?_0x1784ff[_0xcd58('0x2c')]:_0x2b64b8[_0xcd58('0x2b')];if(!_0x2ec6b1[_0xcd58('0x28')][_0xcd58('0x2f')](_0xcd58('0x30'))){_0x1784ff[_0xcd58('0x1a')]=qs['limit'](_0x2ec6b1['query'][_0xcd58('0x1a')]);_0x1784ff[_0xcd58('0x31')]=qs[_0xcd58('0x31')](_0x2ec6b1['query'][_0xcd58('0x31')]);}_0x1784ff[_0xcd58('0x32')]=qs[_0xcd58('0x33')](_0x2ec6b1['query']['sort']);_0x1784ff[_0xcd58('0x34')]=qs[_0xcd58('0x2a')](_[_0xcd58('0x35')](_0x2ec6b1[_0xcd58('0x28')],_0x2b64b8[_0xcd58('0x2a')]),_0x52b205);if(_0x2ec6b1[_0xcd58('0x28')][_0xcd58('0x36')]){_0x1784ff[_0xcd58('0x34')]=_[_0xcd58('0x37')](_0x1784ff[_0xcd58('0x34')],{'$or':_[_0xcd58('0x24')](_0x52b205,function(_0x37e840){if(_0x37e840[_0xcd58('0x38')]!==_0xcd58('0x39')){var _0xc50333={};_0xc50333[_0x37e840[_0xcd58('0x22')]]={'$like':'%'+_0x2ec6b1[_0xcd58('0x28')][_0xcd58('0x36')]+'%'};return _0xc50333;}})});}_0x1784ff=_[_0xcd58('0x37')]({},_0x1784ff,_0x2ec6b1[_0xcd58('0x3a')]);var _0x32e7eb={'where':_0x1784ff['where']};return db[_0xcd58('0x3b')][_0xcd58('0x19')](_0x32e7eb)[_0xcd58('0x1f')](function(_0x5d774d){_0x30cf55[_0xcd58('0x19')]=_0x5d774d;if(_0x2ec6b1[_0xcd58('0x28')]['includeAll']){_0x1784ff[_0xcd58('0x3c')]=[{'all':!![]}];}return db['SmsTransferReport']['findAll'](_0x1784ff);})[_0xcd58('0x1f')](function(_0x4ca4b6){_0x30cf55['rows']=_0x4ca4b6;return _0x30cf55;})[_0xcd58('0x1f')](respondWithFilteredResult(_0x75bb8e,_0x1784ff))[_0xcd58('0x3d')](handleError(_0x75bb8e,null));};exports[_0xcd58('0x3e')]=function(_0x52e7b1,_0x50520b){var _0x257cee={'raw':!![],'where':{'id':_0x52e7b1[_0xcd58('0x3f')]['id']}},_0x55fdf9={};_0x55fdf9[_0xcd58('0x2b')]=_['keys'](db['SmsTransferReport'][_0xcd58('0x25')]);_0x55fdf9[_0xcd58('0x28')]=_[_0xcd58('0x29')](_0x52e7b1[_0xcd58('0x28')]);_0x55fdf9[_0xcd58('0x2a')]=_[_0xcd58('0x2d')](_0x55fdf9[_0xcd58('0x2b')],_0x55fdf9[_0xcd58('0x28')]);_0x257cee[_0xcd58('0x2c')]=_[_0xcd58('0x2d')](_0x55fdf9[_0xcd58('0x2b')],qs[_0xcd58('0x2e')](_0x52e7b1[_0xcd58('0x28')]['fields']));_0x257cee[_0xcd58('0x2c')]=_0x257cee[_0xcd58('0x2c')][_0xcd58('0x40')]?_0x257cee['attributes']:_0x55fdf9[_0xcd58('0x2b')];if(_0x52e7b1[_0xcd58('0x28')][_0xcd58('0x41')]){_0x257cee[_0xcd58('0x3c')]=[{'all':!![]}];}_0x257cee=_['merge']({},_0x257cee,_0x52e7b1[_0xcd58('0x3a')]);return db[_0xcd58('0x3b')][_0xcd58('0x42')](_0x257cee)[_0xcd58('0x1f')](handleEntityNotFound(_0x50520b,null))[_0xcd58('0x1f')](respondWithResult(_0x50520b,null))[_0xcd58('0x3d')](handleError(_0x50520b,null));};exports[_0xcd58('0x43')]=function(_0x18e993,_0x452e7e){return db[_0xcd58('0x3b')]['create'](_0x18e993[_0xcd58('0x44')],{})[_0xcd58('0x1f')](respondWithResult(_0x452e7e,0xc9))[_0xcd58('0x3d')](handleError(_0x452e7e,null));};exports[_0xcd58('0x45')]=function(_0x2bd4c9,_0x435e95){if(_0x2bd4c9[_0xcd58('0x44')]['id']){delete _0x2bd4c9[_0xcd58('0x44')]['id'];}return db[_0xcd58('0x3b')][_0xcd58('0x42')]({'where':{'id':_0x2bd4c9[_0xcd58('0x3f')]['id']}})[_0xcd58('0x1f')](handleEntityNotFound(_0x435e95,null))['then'](saveUpdates(_0x2bd4c9[_0xcd58('0x44')],null))[_0xcd58('0x1f')](respondWithResult(_0x435e95,null))['catch'](handleError(_0x435e95,null));};exports[_0xcd58('0x20')]=function(_0x2cb2e4,_0x40665f){return db[_0xcd58('0x3b')][_0xcd58('0x42')]({'where':{'id':_0x2cb2e4[_0xcd58('0x3f')]['id']}})['then'](handleEntityNotFound(_0x40665f,null))['then'](removeEntity(_0x40665f,null))[_0xcd58('0x3d')](handleError(_0x40665f,null));};exports['describe']=function(_0x3c8076,_0xfb3f8a){return db[_0xcd58('0x3b')][_0xcd58('0x46')]()['then'](respondWithResult(_0xfb3f8a,null))['catch'](handleError(_0xfb3f8a,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 808cc58..9357da9 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 _0x1883=['bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x5c2d52,_0x3c2518){var _0x45cae5=function(_0x1ecb8f){while(--_0x1ecb8f){_0x5c2d52['push'](_0x5c2d52['shift']());}};_0x45cae5(++_0x3c2518);}(_0x1883,0xab));var _0x3188=function(_0x114771,_0x54f43c){_0x114771=_0x114771-0x0;var _0x1aa2fc=_0x1883[_0x114771];return _0x1aa2fc;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));module[_0x3188('0xb')]=function(_0x408ae0,_0x33b62d){return _0x408ae0[_0x3188('0xc')](_0x3188('0xd'),attributes,{'tableName':_0x3188('0xe'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3188('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6a55=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','moment','path','../../config/environment','exports','define'];(function(_0x2567f1,_0x16d4c1){var _0x8a4cda=function(_0x52d2d1){while(--_0x52d2d1){_0x2567f1['push'](_0x2567f1['shift']());}};_0x8a4cda(++_0x16d4c1);}(_0x6a55,0xdb));var _0x56a5=function(_0x3ef2d5,_0x423d46){_0x3ef2d5=_0x3ef2d5-0x0;var _0x2fefb2=_0x6a55[_0x3ef2d5];return _0x2fefb2;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x56a5('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x56a5('0x2'));var rimraf=require('rimraf');var config=require(_0x56a5('0x3'));var attributes=require('./smsTransferReport.attributes');module[_0x56a5('0x4')]=function(_0x380b1b,_0x42d164){return _0x380b1b[_0x56a5('0x5')](_0x56a5('0x6'),attributes,{'tableName':_0x56a5('0x7'),'paranoid':![],'indexes':[{'name':_0x56a5('0x8'),'fields':[_0x56a5('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 859181f..52c74dd 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 _0x4245=['http','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x2e3a71,_0x522691){var _0x2a04b7=function(_0x7838f3){while(--_0x7838f3){_0x2e3a71['push'](_0x2e3a71['shift']());}};_0x2a04b7(++_0x522691);}(_0x4245,0x188));var _0x5424=function(_0x382044,_0x23db69){_0x382044=_0x382044-0x0;var _0x5cba3b=_0x4245[_0x382044];return _0x5cba3b;};'use strict';var _=require('lodash');var util=require(_0x5424('0x0'));var moment=require(_0x5424('0x1'));var BPromise=require(_0x5424('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5424('0x3'))('rpc');var config=require(_0x5424('0x4'));var jayson=require(_0x5424('0x5'));var client=jayson[_0x5424('0x6')][_0x5424('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x28d6af,_0x229449,_0x3e05a9){return new BPromise(function(_0x97c8f,_0x4448de){return client['request'](_0x28d6af,_0x3e05a9)['then'](function(_0x168140){logger[_0x5424('0x8')](_0x5424('0x9'),_0x229449,_0x5424('0xa'));logger[_0x5424('0xb')](_0x5424('0xc'),_0x229449,_0x5424('0xa'),JSON[_0x5424('0xd')](_0x168140));if(_0x168140[_0x5424('0xe')]){if(_0x168140['error'][_0x5424('0xf')]===0x1f4){logger[_0x5424('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x229449,_0x168140[_0x5424('0xe')]['message']);return _0x4448de(_0x168140[_0x5424('0xe')]['message']);}logger[_0x5424('0xe')](_0x5424('0x9'),_0x229449,_0x168140[_0x5424('0xe')][_0x5424('0x10')]);return _0x97c8f(_0x168140['error'][_0x5424('0x10')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x229449,_0x5424('0xa'));_0x97c8f(_0x168140[_0x5424('0x11')][_0x5424('0x10')]);}})[_0x5424('0x12')](function(_0x475241){logger[_0x5424('0xe')](_0x5424('0x9'),_0x229449,_0x475241);_0x4448de(_0x475241);});});} \ No newline at end of file +var _0x9bdc=['message','result','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2576ab,_0x127a1e){var _0x26d9f0=function(_0x5d406f){while(--_0x5d406f){_0x2576ab['push'](_0x2576ab['shift']());}};_0x26d9f0(++_0x127a1e);}(_0x9bdc,0x1cf));var _0xc9bd=function(_0xe11dbb,_0x33e4be){_0xe11dbb=_0xe11dbb-0x0;var _0x14d551=_0x9bdc[_0xe11dbb];return _0x14d551;};'use strict';var _=require(_0xc9bd('0x0'));var util=require('util');var moment=require(_0xc9bd('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9bd('0x2'))['db'];var utils=require(_0xc9bd('0x3'));var logger=require(_0xc9bd('0x4'))(_0xc9bd('0x5'));var config=require(_0xc9bd('0x6'));var jayson=require(_0xc9bd('0x7'));var client=jayson[_0xc9bd('0x8')][_0xc9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25ef72,_0x10c99e,_0x10c5b6){return new BPromise(function(_0x4291da,_0x28d965){return client[_0xc9bd('0xa')](_0x25ef72,_0x10c5b6)[_0xc9bd('0xb')](function(_0x207196){logger[_0xc9bd('0xc')](_0xc9bd('0xd'),_0x10c99e,_0xc9bd('0xe'));logger[_0xc9bd('0xf')](_0xc9bd('0x10'),_0x10c99e,_0xc9bd('0xe'),JSON[_0xc9bd('0x11')](_0x207196));if(_0x207196[_0xc9bd('0x12')]){if(_0x207196['error'][_0xc9bd('0x13')]===0x1f4){logger['error'](_0xc9bd('0xd'),_0x10c99e,_0x207196[_0xc9bd('0x12')]['message']);return _0x28d965(_0x207196['error']['message']);}logger[_0xc9bd('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x10c99e,_0x207196[_0xc9bd('0x12')]['message']);return _0x4291da(_0x207196[_0xc9bd('0x12')][_0xc9bd('0x14')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x10c99e,'request\x20sent');_0x4291da(_0x207196[_0xc9bd('0x15')][_0xc9bd('0x14')]);}})[_0xc9bd('0x16')](function(_0x5d23d9){logger['error'](_0xc9bd('0xd'),_0x10c99e,_0x5d23d9);_0x28d965(_0x5d23d9);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index a4c6162..ebf9350 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 _0xf74b=['./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','diskStorage','server/files/sounds/original/','originalname','replace','%s-%s%s','extname','now','post','single','file','put','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xf74b,0x9b));var _0xbf74=function(_0xc14f23,_0x37459e){_0xc14f23=_0xc14f23-0x0;var _0x429e83=_0xf74b[_0xc14f23];return _0x429e83;};'use strict';var multer=require('multer');var util=require(_0xbf74('0x0'));var path=require('path');var timeout=require(_0xbf74('0x1'));var express=require(_0xbf74('0x2'));var router=express[_0xbf74('0x3')]();var auth=require(_0xbf74('0x4'));var interaction=require(_0xbf74('0x5'));var config=require(_0xbf74('0x6'));var controller=require(_0xbf74('0x7'));router[_0xbf74('0x8')]('/',auth[_0xbf74('0x9')](),controller[_0xbf74('0xa')]);router[_0xbf74('0x8')](_0xbf74('0xb'),auth[_0xbf74('0x9')](),controller[_0xbf74('0xc')]);router[_0xbf74('0x8')](_0xbf74('0xd'),auth[_0xbf74('0x9')](),controller['download']);var upload=multer({'storage':multer[_0xbf74('0xe')]({'destination':function(_0x33df74,_0x29fa98,_0x517688){_0x517688(null,path['join'](config['root'],_0xbf74('0xf')));},'filename':function(_0x2fa4e3,_0x2486ed,_0x16ec84){_0x2486ed[_0xbf74('0x10')]=_0x2486ed['originalname'][_0xbf74('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x16ec84(null,util['format'](_0xbf74('0x12'),path['basename'](_0x2486ed[_0xbf74('0x10')],path[_0xbf74('0x13')](_0x2486ed[_0xbf74('0x10')])),Date[_0xbf74('0x14')](),path['extname'](_0x2486ed[_0xbf74('0x10')])));}})});router[_0xbf74('0x15')]('/',upload[_0xbf74('0x16')](_0xbf74('0x17')),controller['create']);router[_0xbf74('0x18')](_0xbf74('0xb'),auth[_0xbf74('0x9')](),controller['update']);router[_0xbf74('0x19')](_0xbf74('0xb'),auth[_0xbf74('0x9')](),controller[_0xbf74('0x19')]);module[_0xbf74('0x1a')]=router; \ No newline at end of file +var _0x8a56=['root','originalname','replace','format','%s-%s%s','extname','now','post','file','create','put','delete','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','download','diskStorage','join'];(function(_0x54c038,_0xca5c70){var _0x1b932f=function(_0x4e38c9){while(--_0x4e38c9){_0x54c038['push'](_0x54c038['shift']());}};_0x1b932f(++_0xca5c70);}(_0x8a56,0x1a2));var _0x68a5=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x8a56[_0x381589];return _0x2a075d;};'use strict';var multer=require('multer');var util=require(_0x68a5('0x0'));var path=require(_0x68a5('0x1'));var timeout=require('connect-timeout');var express=require(_0x68a5('0x2'));var router=express[_0x68a5('0x3')]();var auth=require(_0x68a5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x68a5('0x5'));var controller=require(_0x68a5('0x6'));router[_0x68a5('0x7')]('/',auth[_0x68a5('0x8')](),controller['index']);router[_0x68a5('0x7')](_0x68a5('0x9'),auth[_0x68a5('0x8')](),controller[_0x68a5('0xa')]);router[_0x68a5('0x7')]('/:id/download',auth[_0x68a5('0x8')](),controller[_0x68a5('0xb')]);var upload=multer({'storage':multer[_0x68a5('0xc')]({'destination':function(_0xf50133,_0x42cd79,_0x47a84a){_0x47a84a(null,path[_0x68a5('0xd')](config[_0x68a5('0xe')],'server/files/sounds/original/'));},'filename':function(_0x1ce6fd,_0x1776ec,_0x475795){_0x1776ec[_0x68a5('0xf')]=_0x1776ec[_0x68a5('0xf')][_0x68a5('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x475795(null,util[_0x68a5('0x11')](_0x68a5('0x12'),path['basename'](_0x1776ec[_0x68a5('0xf')],path[_0x68a5('0x13')](_0x1776ec[_0x68a5('0xf')])),Date[_0x68a5('0x14')](),path['extname'](_0x1776ec[_0x68a5('0xf')])));}})});router[_0x68a5('0x15')]('/',upload['single'](_0x68a5('0x16')),controller[_0x68a5('0x17')]);router[_0x68a5('0x18')](_0x68a5('0x9'),auth[_0x68a5('0x8')](),controller['update']);router[_0x68a5('0x19')](_0x68a5('0x9'),auth['isAuthenticated'](),controller['delete']);module[_0x68a5('0x1a')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 520070c..4ce91ca 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 _0x1ac7=['name','INTEGER','BIGINT','FLOAT','sequelize','STRING'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1ac7,0xf4));var _0x71ac=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x1ac7[_0x2283dc];return _0x16db90;};'use strict';var Sequelize=require(_0x71ac('0x0'));module['exports']={'name':{'type':Sequelize[_0x71ac('0x1')],'unique':_0x71ac('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x71ac('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x71ac('0x1')]},'original_format':{'type':Sequelize[_0x71ac('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x71ac('0x3')]},'original_bitRate':{'type':Sequelize[_0x71ac('0x4')]},'original_sampleRate':{'type':Sequelize[_0x71ac('0x3')]},'converted_format':{'type':Sequelize[_0x71ac('0x1')]},'converted_duration':{'type':Sequelize[_0x71ac('0x5')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x71ac('0x3')]},'converted_bitRate':{'type':Sequelize[_0x71ac('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x71ac('0x3')]}}; \ No newline at end of file +var _0xdadb=['exports','STRING','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x3a52f3,_0x1966e5){var _0x1d01bb=function(_0x5663e4){while(--_0x5663e4){_0x3a52f3['push'](_0x3a52f3['shift']());}};_0x1d01bb(++_0x1966e5);}(_0xdadb,0x107));var _0xbdad=function(_0x41b3d6,_0x21daa8){_0x41b3d6=_0x41b3d6-0x0;var _0x3e60ca=_0xdadb[_0x41b3d6];return _0x3e60ca;};'use strict';var Sequelize=require(_0xbdad('0x0'));module[_0xbdad('0x1')]={'name':{'type':Sequelize[_0xbdad('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xbdad('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xbdad('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xbdad('0x3')]},'original_sampleCount':{'type':Sequelize[_0xbdad('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xbdad('0x4')]},'original_sampleRate':{'type':Sequelize[_0xbdad('0x5')]},'converted_format':{'type':Sequelize[_0xbdad('0x2')]},'converted_duration':{'type':Sequelize[_0xbdad('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xbdad('0x4')]},'converted_channelCount':{'type':Sequelize[_0xbdad('0x5')]},'converted_bitRate':{'type':Sequelize[_0xbdad('0x4')]},'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 696ef50..4a9b19c 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 _0x56d6=['sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','Sound','includeAll','findAll','rows','catch','show','include','options','download','find','params','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','save_name','create','basename','file','originalname','extname','filename','wav','root','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x4cbfde,_0x5eb566){var _0x13bb24=function(_0x2cdf2e){while(--_0x2cdf2e){_0x4cbfde['push'](_0x4cbfde['shift']());}};_0x13bb24(++_0x5eb566);}(_0x56d6,0x6d));var _0x656d=function(_0x266062,_0x772259){_0x266062=_0x266062-0x0;var _0x31ce26=_0x56d6[_0x266062];return _0x31ce26;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x656d('0x0'));var rimraf=require(_0x656d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x656d('0x2'));var rp=require(_0x656d('0x3'));var moment=require(_0x656d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x656d('0x5'));var util=require(_0x656d('0x6'));var path=require('path');var sox=require(_0x656d('0x7'));var csv=require(_0x656d('0x8'));var ejs=require(_0x656d('0x9'));var fs=require('fs');var _=require(_0x656d('0xa'));var squel=require(_0x656d('0xb'));var crypto=require('crypto');var jsforce=require(_0x656d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x656d('0x8'));var querystring=require(_0x656d('0xd'));var Papa=require('papaparse');var Redis=require(_0x656d('0xe'));var authService=require(_0x656d('0xf'));var qs=require(_0x656d('0x10'));var as=require(_0x656d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x656d('0x12'));var utils=require(_0x656d('0x13'));var config=require(_0x656d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x656d('0x15'))['db'];function respondWithStatusCode(_0xbe56de,_0x4739de){_0x4739de=_0x4739de||0xcc;return function(_0x1d6c30){if(_0x1d6c30){return _0xbe56de[_0x656d('0x16')](_0x4739de);}return _0xbe56de[_0x656d('0x17')](_0x4739de)[_0x656d('0x18')]();};}function respondWithResult(_0x59d318,_0x24b139){_0x24b139=_0x24b139||0xc8;return function(_0x285f55){if(_0x285f55){return _0x59d318[_0x656d('0x17')](_0x24b139)[_0x656d('0x19')](_0x285f55);}};}function respondWithFilteredResult(_0x3dc5ea,_0x10c622){return function(_0x53dfa8){if(_0x53dfa8){var _0x1fdcff=_0x53dfa8[_0x656d('0x1a')],_0x5c955a=_0x10c622['offset'],_0x357184=_0x10c622['offset']+_0x10c622[_0x656d('0x1b')],_0x47094a;if(_0x357184>=_0x1fdcff){_0x357184=_0x1fdcff;_0x47094a=0xc8;}else{_0x47094a=0xce;}_0x3dc5ea['status'](_0x47094a);return _0x3dc5ea[_0x656d('0x1c')](_0x656d('0x1d'),_0x5c955a+'-'+_0x357184+'/'+_0x1fdcff)[_0x656d('0x19')](_0x53dfa8);}return null;};}function patchUpdates(_0x3faf0a){return function(_0x1ab0d5){try{jsonpatch[_0x656d('0x1e')](_0x1ab0d5,_0x3faf0a,!![]);}catch(_0x36bb6a){return BPromise[_0x656d('0x1f')](_0x36bb6a);}return _0x1ab0d5[_0x656d('0x20')]();};}function saveUpdates(_0x39b2b7,_0x14811e){return function(_0x516bb0){if(_0x516bb0){return _0x516bb0[_0x656d('0x21')](_0x39b2b7)[_0x656d('0x22')](function(_0x44ad16){return _0x44ad16;});}return null;};}function removeEntity(_0x2d6248,_0x1ea80e){return function(_0x2fe5e7){if(_0x2fe5e7){return _0x2fe5e7[_0x656d('0x23')]()['then'](function(){var _0x668802=_0x2fe5e7[_0x656d('0x24')]({'plain':!![]});var _0x3e8f7a=_0x656d('0x25');return db[_0x656d('0x26')]['destroy']({'where':{'type':_0x3e8f7a,'resourceId':_0x668802['id']}})['then'](function(){return _0x2fe5e7;});})[_0x656d('0x22')](function(){_0x2d6248[_0x656d('0x17')](0xcc)[_0x656d('0x18')]();});}};}function handleEntityNotFound(_0x209323,_0x326a80){return function(_0x1bcd5c){if(!_0x1bcd5c){_0x209323[_0x656d('0x16')](0x194);}return _0x1bcd5c;};}function handleError(_0x2a6bf4,_0x38a2f1){_0x38a2f1=_0x38a2f1||0x1f4;return function(_0x244194){logger[_0x656d('0x27')](_0x244194[_0x656d('0x28')]);if(_0x244194[_0x656d('0x29')]){delete _0x244194[_0x656d('0x29')];}_0x2a6bf4['status'](_0x38a2f1)['send'](_0x244194);};}exports[_0x656d('0x2a')]=function(_0x32d51d,_0x422187){var _0x4e0577={},_0xcb4896={},_0xdecc75={'count':0x0,'rows':[]};var _0x4164a3=_[_0x656d('0x2b')](db['Sound'][_0x656d('0x2c')],function(_0x515be3){return{'name':_0x515be3[_0x656d('0x2d')],'type':_0x515be3[_0x656d('0x2e')][_0x656d('0x2f')]};});_0xcb4896['model']=_['map'](_0x4164a3,_0x656d('0x29'));_0xcb4896[_0x656d('0x30')]=_[_0x656d('0x31')](_0x32d51d[_0x656d('0x30')]);_0xcb4896[_0x656d('0x32')]=_['intersection'](_0xcb4896[_0x656d('0x33')],_0xcb4896[_0x656d('0x30')]);_0x4e0577[_0x656d('0x34')]=_[_0x656d('0x35')](_0xcb4896[_0x656d('0x33')],qs[_0x656d('0x36')](_0x32d51d[_0x656d('0x30')][_0x656d('0x36')]));_0x4e0577[_0x656d('0x34')]=_0x4e0577[_0x656d('0x34')][_0x656d('0x37')]?_0x4e0577[_0x656d('0x34')]:_0xcb4896[_0x656d('0x33')];if(!_0x32d51d[_0x656d('0x30')][_0x656d('0x38')](_0x656d('0x39'))){_0x4e0577['limit']=qs['limit'](_0x32d51d[_0x656d('0x30')][_0x656d('0x1b')]);_0x4e0577[_0x656d('0x3a')]=qs[_0x656d('0x3a')](_0x32d51d[_0x656d('0x30')][_0x656d('0x3a')]);}_0x4e0577[_0x656d('0x3b')]=qs['sort'](_0x32d51d['query'][_0x656d('0x3c')]);_0x4e0577[_0x656d('0x3d')]=qs['filters'](_[_0x656d('0x3e')](_0x32d51d['query'],_0xcb4896[_0x656d('0x32')]),_0x4164a3);if(_0x32d51d[_0x656d('0x30')][_0x656d('0x3f')]){_0x4e0577[_0x656d('0x3d')]=_[_0x656d('0x40')](_0x4e0577[_0x656d('0x3d')],{'$or':_[_0x656d('0x2b')](_0x4164a3,function(_0x1e860e){if(_0x1e860e[_0x656d('0x2e')]!=='VIRTUAL'){var _0x7bbc49={};_0x7bbc49[_0x1e860e[_0x656d('0x29')]]={'$like':'%'+_0x32d51d['query'][_0x656d('0x3f')]+'%'};return _0x7bbc49;}})});}_0x4e0577=_[_0x656d('0x40')]({},_0x4e0577,_0x32d51d['options']);var _0x1a68af={'where':_0x4e0577[_0x656d('0x3d')]};return db[_0x656d('0x41')][_0x656d('0x1a')](_0x1a68af)[_0x656d('0x22')](function(_0x4719c8){_0xdecc75['count']=_0x4719c8;if(_0x32d51d[_0x656d('0x30')][_0x656d('0x42')]){_0x4e0577['include']=[{'all':!![]}];}return db['Sound'][_0x656d('0x43')](_0x4e0577);})[_0x656d('0x22')](function(_0x502118){_0xdecc75[_0x656d('0x44')]=_0x502118;return _0xdecc75;})[_0x656d('0x22')](respondWithFilteredResult(_0x422187,_0x4e0577))[_0x656d('0x45')](handleError(_0x422187,null));};exports[_0x656d('0x46')]=function(_0x51c79b,_0x309a2c){var _0x4f26cb={'raw':!![],'where':{'id':_0x51c79b['params']['id']}},_0x2c6046={};_0x2c6046[_0x656d('0x33')]=_['keys'](db[_0x656d('0x41')][_0x656d('0x2c')]);_0x2c6046[_0x656d('0x30')]=_['keys'](_0x51c79b['query']);_0x2c6046[_0x656d('0x32')]=_['intersection'](_0x2c6046['model'],_0x2c6046[_0x656d('0x30')]);_0x4f26cb[_0x656d('0x34')]=_['intersection'](_0x2c6046[_0x656d('0x33')],qs[_0x656d('0x36')](_0x51c79b[_0x656d('0x30')][_0x656d('0x36')]));_0x4f26cb[_0x656d('0x34')]=_0x4f26cb['attributes'][_0x656d('0x37')]?_0x4f26cb['attributes']:_0x2c6046[_0x656d('0x33')];if(_0x51c79b['query'][_0x656d('0x42')]){_0x4f26cb[_0x656d('0x47')]=[{'all':!![]}];}_0x4f26cb=_[_0x656d('0x40')]({},_0x4f26cb,_0x51c79b[_0x656d('0x48')]);return db[_0x656d('0x41')]['find'](_0x4f26cb)[_0x656d('0x22')](handleEntityNotFound(_0x309a2c,null))[_0x656d('0x22')](respondWithResult(_0x309a2c,null))[_0x656d('0x45')](handleError(_0x309a2c,null));};exports[_0x656d('0x49')]=function(_0x4e092a,_0x451328,_0x399f6b){return db[_0x656d('0x41')][_0x656d('0x4a')]({'where':{'id':_0x4e092a[_0x656d('0x4b')]['id']},'attributes':['name','save_name',_0x656d('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x451328,null))[_0x656d('0x22')](function(_0x2df5c4){if(_0x2df5c4){if(!fs[_0x656d('0x4d')](path[_0x656d('0x4e')](config['root'],_0x656d('0x4f'),_0x2df5c4['save_name']+'.'+_0x2df5c4[_0x656d('0x4c')]))){throw new db[(_0x656d('0x50'))][(_0x656d('0x51'))](_0x656d('0x52'));}return _0x451328[_0x656d('0x49')](path[_0x656d('0x4e')](config['root'],_0x656d('0x4f'),util[_0x656d('0x53')](_0x656d('0x54'),_0x2df5c4[_0x656d('0x55')],_0x2df5c4[_0x656d('0x4c')])),util[_0x656d('0x53')]('%s.%s',_0x2df5c4[_0x656d('0x29')],_0x2df5c4['converted_format']));}return null;})[_0x656d('0x45')](handleError(_0x451328,null));};exports[_0x656d('0x56')]=function(_0x2bebb7,_0x1a5cad,_0x37973f){var _0x249812={'name':path[_0x656d('0x57')](_0x2bebb7[_0x656d('0x58')][_0x656d('0x59')],path[_0x656d('0x5a')](_0x2bebb7['file'][_0x656d('0x59')])),'save_name':path[_0x656d('0x57')](_0x2bebb7[_0x656d('0x58')][_0x656d('0x5b')],path[_0x656d('0x5a')](_0x2bebb7[_0x656d('0x58')][_0x656d('0x5b')])),'original_format':path[_0x656d('0x5a')](_0x2bebb7[_0x656d('0x58')][_0x656d('0x59')])['substring'](0x1),'converted_format':_0x656d('0x5c')};var _0xcf9eee=path['join'](config[_0x656d('0x5d')],_0x656d('0x5e'),_0x2bebb7[_0x656d('0x58')][_0x656d('0x5b')]);var _0x507cea=path[_0x656d('0x4e')](config[_0x656d('0x5d')],'server/files/sounds/converted',util['format'](_0x656d('0x54'),path['basename'](_0x2bebb7[_0x656d('0x58')][_0x656d('0x5b')],path[_0x656d('0x5a')](_0x2bebb7[_0x656d('0x58')][_0x656d('0x5b')])),_0x249812['converted_format']));logger[_0x656d('0x5f')](_0x656d('0x60'),_0xcf9eee);logger['info'](_0x656d('0x61'),_0x507cea);try{fs[_0x656d('0x62')](_0xcf9eee,parseInt(_0x656d('0x63'),0x8));var _0x3f25bc=sox[_0x656d('0x64')](_0xcf9eee,_0x507cea,{'sampleRate':0x1f40,'format':_0x656d('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3f25bc['on']('error',function(_0x47a059){fs['unlinkSync'](_0xcf9eee);_0x1a5cad[_0x656d('0x17')](0x1f4)['send'](_0x47a059);});_0x3f25bc['on'](_0x656d('0x65'),function(_0x3e9b89){_0x249812[_0x656d('0x66')]=isNaN(_0x3e9b89[_0x656d('0x67')])?null:_0x3e9b89[_0x656d('0x67')]*0x3e8;_0x249812[_0x656d('0x68')]=isNaN(_0x3e9b89[_0x656d('0x69')])?null:_0x3e9b89['sampleCount'];_0x249812[_0x656d('0x6a')]=isNaN(_0x3e9b89[_0x656d('0x6b')])?null:_0x3e9b89[_0x656d('0x6b')];_0x249812[_0x656d('0x6c')]=isNaN(_0x3e9b89[_0x656d('0x6d')])?null:_0x3e9b89[_0x656d('0x6d')];_0x249812[_0x656d('0x6e')]=isNaN(_0x3e9b89[_0x656d('0x6f')])?null:_0x3e9b89[_0x656d('0x6f')];});_0x3f25bc['on'](_0x656d('0x70'),function(_0x576499){_0x249812[_0x656d('0x71')]=isNaN(_0x576499[_0x656d('0x67')])?null:_0x576499[_0x656d('0x67')]*0x3e8;_0x249812[_0x656d('0x72')]=isNaN(_0x576499[_0x656d('0x69')])?null:_0x576499[_0x656d('0x69')];_0x249812[_0x656d('0x73')]=isNaN(_0x576499[_0x656d('0x6b')])?null:_0x576499[_0x656d('0x6b')];_0x249812[_0x656d('0x74')]=isNaN(_0x576499[_0x656d('0x6d')])?null:_0x576499[_0x656d('0x6d')];_0x249812[_0x656d('0x75')]=isNaN(_0x576499[_0x656d('0x6f')])?null:_0x576499[_0x656d('0x6f')];});_0x3f25bc['on'](_0x656d('0x18'),function(){fs[_0x656d('0x62')](_0x507cea,parseInt(_0x656d('0x63'),0x8));return db[_0x656d('0x41')]['create'](_0x249812)['then'](function(_0xb16279){var _0x20d44c={'role':_0x2bebb7[_0x656d('0x76')][_0x656d('0x77')],'userProfileId':_0x2bebb7[_0x656d('0x76')]['userProfileId']};if(!_0x20d44c)throw new Error(_0x656d('0x78'));if(_0x20d44c[_0x656d('0x77')]===_0x656d('0x79')){var _0x2ecdda=_0xb16279['get']({'plain':!![]});return db[_0x656d('0x7a')]['find']({'where':{'name':_0x656d('0x25'),'userProfileId':_0x20d44c[_0x656d('0x7b')]},'raw':!![]})[_0x656d('0x22')](function(_0x3e5844){if(_0x3e5844&&_0x3e5844[_0x656d('0x7c')]===0x0){return db[_0x656d('0x26')]['create']({'name':_0x2ecdda[_0x656d('0x29')],'resourceId':_0x2ecdda['id'],'type':_0x3e5844['name'],'sectionId':_0x3e5844['id']},{})[_0x656d('0x22')](function(){return _0xb16279;});}else{return _0xb16279;}})[_0x656d('0x45')](function(_0x22d0d8){logger[_0x656d('0x27')](_0x656d('0x7d'),_0x22d0d8);throw _0x22d0d8;});}return _0xb16279;})[_0x656d('0x22')](respondWithResult(_0x1a5cad,null))[_0x656d('0x45')](handleError(_0x1a5cad,null));});_0x3f25bc[_0x656d('0x7e')]();}catch(_0x36ee5d){_0x1a5cad[_0x656d('0x17')](0x1f4)['send'](_0x36ee5d);}};exports[_0x656d('0x21')]=function(_0x3d5066,_0x3327fd,_0x499673){return db[_0x656d('0x41')][_0x656d('0x4a')]({'where':{'id':_0x3d5066[_0x656d('0x4b')]['id']}})[_0x656d('0x22')](handleEntityNotFound(_0x3327fd,null))['then'](saveUpdates(_[_0x656d('0x3e')](_0x3d5066[_0x656d('0x76')],[_0x656d('0x29'),_0x656d('0x7f')]),null))[_0x656d('0x22')](respondWithResult(_0x3327fd,null))[_0x656d('0x45')](handleError(_0x3327fd,null));};exports[_0x656d('0x80')]=function(_0x440ca0,_0x18e037,_0x38dc02){return db[_0x656d('0x41')][_0x656d('0x4a')]({'where':{'id':_0x440ca0[_0x656d('0x4b')]['id']}})[_0x656d('0x22')](function(_0x471d70){if(_0x471d70){return _0x471d70[_0x656d('0x23')]();}})[_0x656d('0x22')](function(_0x5f0212){var _0x3a8a77=path[_0x656d('0x4e')](config[_0x656d('0x5d')],_0x656d('0x5e'),util[_0x656d('0x53')](_0x656d('0x54'),_0x5f0212[_0x656d('0x55')],_0x5f0212[_0x656d('0x81')]));var _0x503e90=path[_0x656d('0x4e')](config[_0x656d('0x5d')],_0x656d('0x4f'),util[_0x656d('0x53')](_0x656d('0x54'),_0x5f0212[_0x656d('0x55')],_0x5f0212[_0x656d('0x4c')]));fs[_0x656d('0x82')](_0x3a8a77);fs[_0x656d('0x82')](_0x503e90);return _0x5f0212;})[_0x656d('0x22')](function(_0x4dcb5d){if(_0x4dcb5d){return _0x18e037[_0x656d('0x17')](0xcc)['end']();}})[_0x656d('0x22')](handleEntityNotFound(_0x18e037,null))[_0x656d('0x45')](handleError(_0x18e037,null));}; \ No newline at end of file +var _0x6a37=['sampleRate','dest','converted_duration','duration','converted_channelCount','converted_bitRate','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','pick','description','delete','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','Sounds','UserProfileResource','then','error','stack','name','send','index','Sound','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','VIRTUAL','options','includeAll','include','show','params','keys','rawAttributes','catch','existsSync','root','server/files/sounds/converted','save_name','converted_format','Sequelize','Sound\x20not\x20found','download','join','format','%s.%s','create','basename','file','originalname','filename','extname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6a37,0x92));var _0x76a3=function(_0x273dc5,_0x268a81){_0x273dc5=_0x273dc5-0x0;var _0x46dae7=_0x6a37[_0x273dc5];return _0x46dae7;};'use strict';var pdf=require(_0x76a3('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x76a3('0x1'));var jsonpatch=require(_0x76a3('0x2'));var rp=require(_0x76a3('0x3'));var moment=require(_0x76a3('0x4'));var BPromise=require(_0x76a3('0x5'));var Mustache=require(_0x76a3('0x6'));var util=require(_0x76a3('0x7'));var path=require(_0x76a3('0x8'));var sox=require(_0x76a3('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x76a3('0xa'));var squel=require(_0x76a3('0xb'));var crypto=require(_0x76a3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x76a3('0xd'));var toCsv=require(_0x76a3('0xe'));var querystring=require(_0x76a3('0xf'));var Papa=require(_0x76a3('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x76a3('0x11'));var hardwareService=require(_0x76a3('0x12'));var logger=require(_0x76a3('0x13'))(_0x76a3('0x14'));var utils=require(_0x76a3('0x15'));var config=require(_0x76a3('0x16'));var licenseUtil=require(_0x76a3('0x17'));var db=require(_0x76a3('0x18'))['db'];function respondWithStatusCode(_0x7c96f5,_0x1cc42e){_0x1cc42e=_0x1cc42e||0xcc;return function(_0x1efb23){if(_0x1efb23){return _0x7c96f5[_0x76a3('0x19')](_0x1cc42e);}return _0x7c96f5['status'](_0x1cc42e)[_0x76a3('0x1a')]();};}function respondWithResult(_0x101705,_0x7f7945){_0x7f7945=_0x7f7945||0xc8;return function(_0x4d75e5){if(_0x4d75e5){return _0x101705[_0x76a3('0x1b')](_0x7f7945)[_0x76a3('0x1c')](_0x4d75e5);}};}function respondWithFilteredResult(_0x7b14ec,_0x71a6d8){return function(_0x5b5bd){if(_0x5b5bd){var _0x4b852d=_0x5b5bd[_0x76a3('0x1d')],_0xc078ee=_0x71a6d8[_0x76a3('0x1e')],_0x4a0cd1=_0x71a6d8[_0x76a3('0x1e')]+_0x71a6d8[_0x76a3('0x1f')],_0x244a58;if(_0x4a0cd1>=_0x4b852d){_0x4a0cd1=_0x4b852d;_0x244a58=0xc8;}else{_0x244a58=0xce;}_0x7b14ec[_0x76a3('0x1b')](_0x244a58);return _0x7b14ec[_0x76a3('0x20')](_0x76a3('0x21'),_0xc078ee+'-'+_0x4a0cd1+'/'+_0x4b852d)[_0x76a3('0x1c')](_0x5b5bd);}return null;};}function patchUpdates(_0x43b168){return function(_0x1b91ad){try{jsonpatch['apply'](_0x1b91ad,_0x43b168,!![]);}catch(_0xd0be1d){return BPromise[_0x76a3('0x22')](_0xd0be1d);}return _0x1b91ad[_0x76a3('0x23')]();};}function saveUpdates(_0x146c9d,_0x55e778){return function(_0x573b8e){if(_0x573b8e){return _0x573b8e['update'](_0x146c9d)['then'](function(_0x3bce6f){return _0x3bce6f;});}return null;};}function removeEntity(_0x4358ed,_0x1ee65f){return function(_0x3858dd){if(_0x3858dd){return _0x3858dd[_0x76a3('0x24')]()['then'](function(){var _0x1efc27=_0x3858dd['get']({'plain':!![]});var _0x24fbe7=_0x76a3('0x25');return db[_0x76a3('0x26')][_0x76a3('0x24')]({'where':{'type':_0x24fbe7,'resourceId':_0x1efc27['id']}})['then'](function(){return _0x3858dd;});})[_0x76a3('0x27')](function(){_0x4358ed[_0x76a3('0x1b')](0xcc)[_0x76a3('0x1a')]();});}};}function handleEntityNotFound(_0x56a5c8,_0x24862a){return function(_0xb81b3c){if(!_0xb81b3c){_0x56a5c8[_0x76a3('0x19')](0x194);}return _0xb81b3c;};}function handleError(_0x53de6f,_0x2a08cf){_0x2a08cf=_0x2a08cf||0x1f4;return function(_0x4168fd){logger[_0x76a3('0x28')](_0x4168fd[_0x76a3('0x29')]);if(_0x4168fd[_0x76a3('0x2a')]){delete _0x4168fd['name'];}_0x53de6f[_0x76a3('0x1b')](_0x2a08cf)[_0x76a3('0x2b')](_0x4168fd);};}exports[_0x76a3('0x2c')]=function(_0x41128e,_0x5f0a01){var _0x171165={},_0x4687ed={},_0x2c4e0e={'count':0x0,'rows':[]};var _0x219d99=_['map'](db[_0x76a3('0x2d')]['rawAttributes'],function(_0x2ad539){return{'name':_0x2ad539[_0x76a3('0x2e')],'type':_0x2ad539['type']['key']};});_0x4687ed[_0x76a3('0x2f')]=_['map'](_0x219d99,_0x76a3('0x2a'));_0x4687ed[_0x76a3('0x30')]=_['keys'](_0x41128e['query']);_0x4687ed[_0x76a3('0x31')]=_[_0x76a3('0x32')](_0x4687ed[_0x76a3('0x2f')],_0x4687ed[_0x76a3('0x30')]);_0x171165[_0x76a3('0x33')]=_[_0x76a3('0x32')](_0x4687ed[_0x76a3('0x2f')],qs[_0x76a3('0x34')](_0x41128e['query'][_0x76a3('0x34')]));_0x171165[_0x76a3('0x33')]=_0x171165[_0x76a3('0x33')][_0x76a3('0x35')]?_0x171165[_0x76a3('0x33')]:_0x4687ed['model'];if(!_0x41128e['query'][_0x76a3('0x36')](_0x76a3('0x37'))){_0x171165['limit']=qs[_0x76a3('0x1f')](_0x41128e[_0x76a3('0x30')][_0x76a3('0x1f')]);_0x171165[_0x76a3('0x1e')]=qs[_0x76a3('0x1e')](_0x41128e['query'][_0x76a3('0x1e')]);}_0x171165[_0x76a3('0x38')]=qs[_0x76a3('0x39')](_0x41128e[_0x76a3('0x30')][_0x76a3('0x39')]);_0x171165[_0x76a3('0x3a')]=qs[_0x76a3('0x31')](_['pick'](_0x41128e[_0x76a3('0x30')],_0x4687ed[_0x76a3('0x31')]),_0x219d99);if(_0x41128e[_0x76a3('0x30')][_0x76a3('0x3b')]){_0x171165[_0x76a3('0x3a')]=_[_0x76a3('0x3c')](_0x171165['where'],{'$or':_[_0x76a3('0x3d')](_0x219d99,function(_0x13f23b){if(_0x13f23b[_0x76a3('0x3e')]!==_0x76a3('0x3f')){var _0x3370e5={};_0x3370e5[_0x13f23b['name']]={'$like':'%'+_0x41128e[_0x76a3('0x30')][_0x76a3('0x3b')]+'%'};return _0x3370e5;}})});}_0x171165=_[_0x76a3('0x3c')]({},_0x171165,_0x41128e[_0x76a3('0x40')]);var _0x3942a4={'where':_0x171165[_0x76a3('0x3a')]};return db[_0x76a3('0x2d')][_0x76a3('0x1d')](_0x3942a4)['then'](function(_0x20772b){_0x2c4e0e[_0x76a3('0x1d')]=_0x20772b;if(_0x41128e[_0x76a3('0x30')][_0x76a3('0x41')]){_0x171165[_0x76a3('0x42')]=[{'all':!![]}];}return db[_0x76a3('0x2d')]['findAll'](_0x171165);})[_0x76a3('0x27')](function(_0x29a6ec){_0x2c4e0e['rows']=_0x29a6ec;return _0x2c4e0e;})[_0x76a3('0x27')](respondWithFilteredResult(_0x5f0a01,_0x171165))['catch'](handleError(_0x5f0a01,null));};exports[_0x76a3('0x43')]=function(_0x287080,_0xcbecb7){var _0x41b763={'raw':!![],'where':{'id':_0x287080[_0x76a3('0x44')]['id']}},_0x1b6a2c={};_0x1b6a2c[_0x76a3('0x2f')]=_[_0x76a3('0x45')](db[_0x76a3('0x2d')][_0x76a3('0x46')]);_0x1b6a2c[_0x76a3('0x30')]=_[_0x76a3('0x45')](_0x287080['query']);_0x1b6a2c[_0x76a3('0x31')]=_[_0x76a3('0x32')](_0x1b6a2c['model'],_0x1b6a2c['query']);_0x41b763[_0x76a3('0x33')]=_[_0x76a3('0x32')](_0x1b6a2c[_0x76a3('0x2f')],qs[_0x76a3('0x34')](_0x287080[_0x76a3('0x30')][_0x76a3('0x34')]));_0x41b763[_0x76a3('0x33')]=_0x41b763[_0x76a3('0x33')][_0x76a3('0x35')]?_0x41b763['attributes']:_0x1b6a2c[_0x76a3('0x2f')];if(_0x287080[_0x76a3('0x30')][_0x76a3('0x41')]){_0x41b763[_0x76a3('0x42')]=[{'all':!![]}];}_0x41b763=_[_0x76a3('0x3c')]({},_0x41b763,_0x287080[_0x76a3('0x40')]);return db['Sound']['find'](_0x41b763)[_0x76a3('0x27')](handleEntityNotFound(_0xcbecb7,null))['then'](respondWithResult(_0xcbecb7,null))[_0x76a3('0x47')](handleError(_0xcbecb7,null));};exports['download']=function(_0x33b456,_0x449c9c,_0x3fc0a8){return db['Sound']['find']({'where':{'id':_0x33b456[_0x76a3('0x44')]['id']},'attributes':[_0x76a3('0x2a'),'save_name','converted_format'],'raw':!![]})[_0x76a3('0x27')](handleEntityNotFound(_0x449c9c,null))['then'](function(_0x3f08ba){if(_0x3f08ba){if(!fs[_0x76a3('0x48')](path['join'](config[_0x76a3('0x49')],_0x76a3('0x4a'),_0x3f08ba[_0x76a3('0x4b')]+'.'+_0x3f08ba[_0x76a3('0x4c')]))){throw new db[(_0x76a3('0x4d'))]['ValidationError'](_0x76a3('0x4e'));}return _0x449c9c[_0x76a3('0x4f')](path[_0x76a3('0x50')](config['root'],_0x76a3('0x4a'),util[_0x76a3('0x51')](_0x76a3('0x52'),_0x3f08ba[_0x76a3('0x4b')],_0x3f08ba['converted_format'])),util['format']('%s.%s',_0x3f08ba[_0x76a3('0x2a')],_0x3f08ba['converted_format']));}return null;})[_0x76a3('0x47')](handleError(_0x449c9c,null));};exports[_0x76a3('0x53')]=function(_0x3c1bed,_0x3a1552,_0x14ccee){var _0x12f8f6={'name':path[_0x76a3('0x54')](_0x3c1bed[_0x76a3('0x55')][_0x76a3('0x56')],path['extname'](_0x3c1bed[_0x76a3('0x55')][_0x76a3('0x56')])),'save_name':path['basename'](_0x3c1bed[_0x76a3('0x55')][_0x76a3('0x57')],path[_0x76a3('0x58')](_0x3c1bed[_0x76a3('0x55')][_0x76a3('0x57')])),'original_format':path[_0x76a3('0x58')](_0x3c1bed[_0x76a3('0x55')][_0x76a3('0x56')])[_0x76a3('0x59')](0x1),'converted_format':_0x76a3('0x5a')};var _0x2a66aa=path[_0x76a3('0x50')](config['root'],_0x76a3('0x5b'),_0x3c1bed[_0x76a3('0x55')][_0x76a3('0x57')]);var _0x5695d5=path[_0x76a3('0x50')](config[_0x76a3('0x49')],_0x76a3('0x4a'),util[_0x76a3('0x51')]('%s.%s',path['basename'](_0x3c1bed[_0x76a3('0x55')][_0x76a3('0x57')],path[_0x76a3('0x58')](_0x3c1bed[_0x76a3('0x55')][_0x76a3('0x57')])),_0x12f8f6[_0x76a3('0x4c')]));logger[_0x76a3('0x5c')](_0x76a3('0x5d'),_0x2a66aa);logger[_0x76a3('0x5c')]('Sound\x20upload\x20destination:\x20%s',_0x5695d5);try{fs[_0x76a3('0x5e')](_0x2a66aa,parseInt(_0x76a3('0x5f'),0x8));var _0x455085=sox[_0x76a3('0x60')](_0x2a66aa,_0x5695d5,{'sampleRate':0x1f40,'format':_0x76a3('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x455085['on'](_0x76a3('0x28'),function(_0x2265e4){fs[_0x76a3('0x61')](_0x2a66aa);_0x3a1552[_0x76a3('0x1b')](0x1f4)[_0x76a3('0x2b')](_0x2265e4);});_0x455085['on'](_0x76a3('0x62'),function(_0x5edae2){_0x12f8f6[_0x76a3('0x63')]=isNaN(_0x5edae2['duration'])?null:_0x5edae2['duration']*0x3e8;_0x12f8f6[_0x76a3('0x64')]=isNaN(_0x5edae2[_0x76a3('0x65')])?null:_0x5edae2[_0x76a3('0x65')];_0x12f8f6['original_channelCount']=isNaN(_0x5edae2[_0x76a3('0x66')])?null:_0x5edae2[_0x76a3('0x66')];_0x12f8f6[_0x76a3('0x67')]=isNaN(_0x5edae2[_0x76a3('0x68')])?null:_0x5edae2['bitRate'];_0x12f8f6[_0x76a3('0x69')]=isNaN(_0x5edae2[_0x76a3('0x6a')])?null:_0x5edae2[_0x76a3('0x6a')];});_0x455085['on'](_0x76a3('0x6b'),function(_0xe8153d){_0x12f8f6[_0x76a3('0x6c')]=isNaN(_0xe8153d[_0x76a3('0x6d')])?null:_0xe8153d[_0x76a3('0x6d')]*0x3e8;_0x12f8f6['converted_sampleCount']=isNaN(_0xe8153d['sampleCount'])?null:_0xe8153d['sampleCount'];_0x12f8f6[_0x76a3('0x6e')]=isNaN(_0xe8153d['channelCount'])?null:_0xe8153d['channelCount'];_0x12f8f6[_0x76a3('0x6f')]=isNaN(_0xe8153d[_0x76a3('0x68')])?null:_0xe8153d[_0x76a3('0x68')];_0x12f8f6['converted_sampleRate']=isNaN(_0xe8153d[_0x76a3('0x6a')])?null:_0xe8153d[_0x76a3('0x6a')];});_0x455085['on'](_0x76a3('0x1a'),function(){fs[_0x76a3('0x5e')](_0x5695d5,parseInt(_0x76a3('0x5f'),0x8));return db[_0x76a3('0x2d')]['create'](_0x12f8f6)[_0x76a3('0x27')](function(_0x116499){var _0x5a81bc={'role':_0x3c1bed[_0x76a3('0x70')][_0x76a3('0x71')],'userProfileId':_0x3c1bed['body']['userProfileId']};if(!_0x5a81bc)throw new Error(_0x76a3('0x72'));if(_0x5a81bc['role']===_0x76a3('0x73')){var _0x40a7b9=_0x116499[_0x76a3('0x74')]({'plain':!![]});return db[_0x76a3('0x75')]['find']({'where':{'name':_0x76a3('0x25'),'userProfileId':_0x5a81bc[_0x76a3('0x76')]},'raw':!![]})['then'](function(_0x50f6e2){if(_0x50f6e2&&_0x50f6e2[_0x76a3('0x77')]===0x0){return db[_0x76a3('0x26')][_0x76a3('0x53')]({'name':_0x40a7b9[_0x76a3('0x2a')],'resourceId':_0x40a7b9['id'],'type':_0x50f6e2[_0x76a3('0x2a')],'sectionId':_0x50f6e2['id']},{})[_0x76a3('0x27')](function(){return _0x116499;});}else{return _0x116499;}})[_0x76a3('0x47')](function(_0xa6165e){logger[_0x76a3('0x28')](_0x76a3('0x78'),_0xa6165e);throw _0xa6165e;});}return _0x116499;})['then'](respondWithResult(_0x3a1552,null))['catch'](handleError(_0x3a1552,null));});_0x455085['start']();}catch(_0x2740dd){_0x3a1552['status'](0x1f4)[_0x76a3('0x2b')](_0x2740dd);}};exports[_0x76a3('0x79')]=function(_0x375af8,_0xbc64ad,_0x231ee8){return db['Sound'][_0x76a3('0x7a')]({'where':{'id':_0x375af8[_0x76a3('0x44')]['id']}})[_0x76a3('0x27')](handleEntityNotFound(_0xbc64ad,null))[_0x76a3('0x27')](saveUpdates(_[_0x76a3('0x7b')](_0x375af8[_0x76a3('0x70')],[_0x76a3('0x2a'),_0x76a3('0x7c')]),null))[_0x76a3('0x27')](respondWithResult(_0xbc64ad,null))[_0x76a3('0x47')](handleError(_0xbc64ad,null));};exports[_0x76a3('0x7d')]=function(_0x3ffc20,_0xe66268,_0xd5fa00){return db[_0x76a3('0x2d')][_0x76a3('0x7a')]({'where':{'id':_0x3ffc20[_0x76a3('0x44')]['id']}})[_0x76a3('0x27')](function(_0x7fd113){if(_0x7fd113){return _0x7fd113[_0x76a3('0x24')]();}})[_0x76a3('0x27')](function(_0xf37e73){var _0x4f6b8c=path['join'](config['root'],_0x76a3('0x5b'),util[_0x76a3('0x51')](_0x76a3('0x52'),_0xf37e73[_0x76a3('0x4b')],_0xf37e73['original_format']));var _0x56cacf=path[_0x76a3('0x50')](config[_0x76a3('0x49')],'server/files/sounds/converted',util[_0x76a3('0x51')]('%s.%s',_0xf37e73[_0x76a3('0x4b')],_0xf37e73['converted_format']));fs['unlinkSync'](_0x4f6b8c);fs[_0x76a3('0x61')](_0x56cacf);return _0xf37e73;})[_0x76a3('0x27')](function(_0x1319ca){if(_0x1319ca){return _0xe66268[_0x76a3('0x1b')](0xcc)[_0x76a3('0x1a')]();}})[_0x76a3('0x27')](handleEntityNotFound(_0xe66268,null))[_0x76a3('0x47')](handleError(_0xe66268,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 5e14689..b2023e5 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 _0xe500=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','define','tools_sounds','lodash'];(function(_0x100228,_0x16d269){var _0x2c0a2b=function(_0x345ca1){while(--_0x345ca1){_0x100228['push'](_0x100228['shift']());}};_0x2c0a2b(++_0x16d269);}(_0xe500,0x151));var _0x0e50=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0xe500[_0x4a3898];return _0x25ceb0;};'use strict';var _=require(_0x0e50('0x0'));var util=require(_0x0e50('0x1'));var logger=require(_0x0e50('0x2'))(_0x0e50('0x3'));var moment=require(_0x0e50('0x4'));var BPromise=require(_0x0e50('0x5'));var rp=require(_0x0e50('0x6'));var fs=require('fs');var path=require(_0x0e50('0x7'));var rimraf=require(_0x0e50('0x8'));var config=require(_0x0e50('0x9'));var attributes=require(_0x0e50('0xa'));module['exports']=function(_0x3b68ea,_0x2885b9){return _0x3b68ea[_0x0e50('0xb')]('Sound',attributes,{'tableName':_0x0e50('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf839=['bluebird','request-promise','path','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds'];(function(_0x4d3e06,_0x4b33f4){var _0x4161f4=function(_0x4e6dc0){while(--_0x4e6dc0){_0x4d3e06['push'](_0x4d3e06['shift']());}};_0x4161f4(++_0x4b33f4);}(_0xf839,0x13b));var _0x9f83=function(_0x1943d4,_0x489641){_0x1943d4=_0x1943d4-0x0;var _0x51c8fe=_0xf839[_0x1943d4];return _0x51c8fe;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9f83('0x0'));var rp=require(_0x9f83('0x1'));var fs=require('fs');var path=require(_0x9f83('0x2'));var rimraf=require('rimraf');var config=require(_0x9f83('0x3'));var attributes=require(_0x9f83('0x4'));module[_0x9f83('0x5')]=function(_0x3085a9,_0x3285a5){return _0x3085a9[_0x9f83('0x6')](_0x9f83('0x7'),attributes,{'tableName':_0x9f83('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 6b395c3..cd7f32c 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 _0xa6ce=['Sound','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowSound'];(function(_0x1ca93c,_0x3271ab){var _0x185169=function(_0x507763){while(--_0x507763){_0x1ca93c['push'](_0x1ca93c['shift']());}};_0x185169(++_0x3271ab);}(_0xa6ce,0x1a8));var _0xea6c=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0xa6ce[_0x556927];return _0x5f1235;};'use strict';var _=require(_0xea6c('0x0'));var util=require(_0xea6c('0x1'));var moment=require(_0xea6c('0x2'));var BPromise=require(_0xea6c('0x3'));var rs=require(_0xea6c('0x4'));var fs=require('fs');var Redis=require(_0xea6c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xea6c('0x6'));var logger=require(_0xea6c('0x7'))('rpc');var config=require(_0xea6c('0x8'));var jayson=require(_0xea6c('0x9'));var client=jayson[_0xea6c('0xa')][_0xea6c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5453ce,_0x3e654c,_0x37e981){return new BPromise(function(_0x2e1a52,_0x3a52e0){return client[_0xea6c('0xc')](_0x5453ce,_0x37e981)[_0xea6c('0xd')](function(_0x3bda91){logger[_0xea6c('0xe')](_0xea6c('0xf'),_0x3e654c,_0xea6c('0x10'));logger[_0xea6c('0x11')]('Sound,\x20%s,\x20%s,\x20%s',_0x3e654c,_0xea6c('0x10'),JSON['stringify'](_0x3bda91));if(_0x3bda91[_0xea6c('0x12')]){if(_0x3bda91['error'][_0xea6c('0x13')]===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x3e654c,_0x3bda91[_0xea6c('0x12')][_0xea6c('0x14')]);return _0x3a52e0(_0x3bda91[_0xea6c('0x12')][_0xea6c('0x14')]);}logger['error'](_0xea6c('0xf'),_0x3e654c,_0x3bda91[_0xea6c('0x12')]['message']);return _0x2e1a52(_0x3bda91[_0xea6c('0x12')][_0xea6c('0x14')]);}else{logger[_0xea6c('0xe')](_0xea6c('0xf'),_0x3e654c,_0xea6c('0x10'));_0x2e1a52(_0x3bda91[_0xea6c('0x15')][_0xea6c('0x14')]);}})[_0xea6c('0x16')](function(_0x275996){logger['error'](_0xea6c('0xf'),_0x3e654c,_0x275996);_0x3a52e0(_0x275996);});});}exports[_0xea6c('0x17')]=function(_0x116a34){var _0x45147d=this;return new Promise(function(_0x47465b,_0x3253c0){return db[_0xea6c('0x18')]['find']({'raw':_0x116a34[_0xea6c('0x19')]?_0x116a34['options'][_0xea6c('0x1a')]===undefined?!![]:![]:!![],'where':_0x116a34['options']?_0x116a34['options'][_0xea6c('0x1b')]||null:null,'attributes':_0x116a34[_0xea6c('0x19')]?_0x116a34[_0xea6c('0x19')][_0xea6c('0x1c')]||null:null,'include':_0x116a34[_0xea6c('0x19')]?_0x116a34[_0xea6c('0x19')][_0xea6c('0x1d')]?_[_0xea6c('0x1e')](_0x116a34[_0xea6c('0x19')]['include'],function(_0xee07b0){return{'model':db[_0xee07b0['model']],'as':_0xee07b0['as'],'attributes':_0xee07b0['attributes'],'include':_0xee07b0['include']?_[_0xea6c('0x1e')](_0xee07b0[_0xea6c('0x1d')],function(_0x1816f9){return{'model':db[_0x1816f9['model']],'as':_0x1816f9['as'],'attributes':_0x1816f9[_0xea6c('0x1c')],'include':_0x1816f9[_0xea6c('0x1d')]?_[_0xea6c('0x1e')](_0x1816f9['include'],function(_0x416320){return{'model':db[_0x416320[_0xea6c('0x1f')]],'as':_0x416320['as'],'attributes':_0x416320[_0xea6c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xea6c('0xd')](function(_0x4cbfac){logger[_0xea6c('0xe')](_0xea6c('0x17'),_0x116a34);logger[_0xea6c('0x11')](_0xea6c('0x17'),_0x116a34,JSON['stringify'](_0x4cbfac));_0x47465b(_0x4cbfac);})['catch'](function(_0x33ca77){logger[_0xea6c('0x12')](_0xea6c('0x17'),_0x33ca77[_0xea6c('0x14')],_0x116a34);_0x3253c0(_0x45147d['error'](0x1f4,_0x33ca77[_0xea6c('0x14')]));});});}; \ No newline at end of file +var _0x89eb=['util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Sound,\x20%s,\x20%s','result','catch','Sound','find','options','raw','where','attributes','include','map','model','ShowSound','lodash'];(function(_0x40ad4e,_0x7341c7){var _0x357575=function(_0x49b291){while(--_0x49b291){_0x40ad4e['push'](_0x40ad4e['shift']());}};_0x357575(++_0x7341c7);}(_0x89eb,0x1df));var _0xb89e=function(_0x39cbc1,_0x2001b2){_0x39cbc1=_0x39cbc1-0x0;var _0x1339d5=_0x89eb[_0x39cbc1];return _0x1339d5;};'use strict';var _=require(_0xb89e('0x0'));var util=require(_0xb89e('0x1'));var moment=require(_0xb89e('0x2'));var BPromise=require(_0xb89e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb89e('0x4'))(_0xb89e('0x5'));var config=require(_0xb89e('0x6'));var jayson=require(_0xb89e('0x7'));var client=jayson[_0xb89e('0x8')][_0xb89e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf73007,_0x3674d9,_0x4f4dca){return new BPromise(function(_0x1867c6,_0x3d5f3d){return client[_0xb89e('0xa')](_0xf73007,_0x4f4dca)[_0xb89e('0xb')](function(_0x2c82f5){logger[_0xb89e('0xc')]('Sound,\x20%s,\x20%s',_0x3674d9,'request\x20sent');logger[_0xb89e('0xd')](_0xb89e('0xe'),_0x3674d9,_0xb89e('0xf'),JSON[_0xb89e('0x10')](_0x2c82f5));if(_0x2c82f5[_0xb89e('0x11')]){if(_0x2c82f5[_0xb89e('0x11')]['code']===0x1f4){logger[_0xb89e('0x11')]('Sound,\x20%s,\x20%s',_0x3674d9,_0x2c82f5[_0xb89e('0x11')][_0xb89e('0x12')]);return _0x3d5f3d(_0x2c82f5[_0xb89e('0x11')][_0xb89e('0x12')]);}logger[_0xb89e('0x11')](_0xb89e('0x13'),_0x3674d9,_0x2c82f5['error'][_0xb89e('0x12')]);return _0x1867c6(_0x2c82f5[_0xb89e('0x11')][_0xb89e('0x12')]);}else{logger[_0xb89e('0xc')](_0xb89e('0x13'),_0x3674d9,_0xb89e('0xf'));_0x1867c6(_0x2c82f5[_0xb89e('0x14')]['message']);}})[_0xb89e('0x15')](function(_0x276e09){logger[_0xb89e('0x11')]('Sound,\x20%s,\x20%s',_0x3674d9,_0x276e09);_0x3d5f3d(_0x276e09);});});}exports['ShowSound']=function(_0x15c724){var _0x2bdd11=this;return new Promise(function(_0x599911,_0x374dcb){return db[_0xb89e('0x16')][_0xb89e('0x17')]({'raw':_0x15c724['options']?_0x15c724[_0xb89e('0x18')][_0xb89e('0x19')]===undefined?!![]:![]:!![],'where':_0x15c724['options']?_0x15c724[_0xb89e('0x18')][_0xb89e('0x1a')]||null:null,'attributes':_0x15c724['options']?_0x15c724[_0xb89e('0x18')][_0xb89e('0x1b')]||null:null,'include':_0x15c724['options']?_0x15c724[_0xb89e('0x18')][_0xb89e('0x1c')]?_[_0xb89e('0x1d')](_0x15c724[_0xb89e('0x18')]['include'],function(_0x44299d){return{'model':db[_0x44299d[_0xb89e('0x1e')]],'as':_0x44299d['as'],'attributes':_0x44299d[_0xb89e('0x1b')],'include':_0x44299d[_0xb89e('0x1c')]?_[_0xb89e('0x1d')](_0x44299d[_0xb89e('0x1c')],function(_0x9c54fb){return{'model':db[_0x9c54fb[_0xb89e('0x1e')]],'as':_0x9c54fb['as'],'attributes':_0x9c54fb[_0xb89e('0x1b')],'include':_0x9c54fb['include']?_['map'](_0x9c54fb['include'],function(_0x531857){return{'model':db[_0x531857[_0xb89e('0x1e')]],'as':_0x531857['as'],'attributes':_0x531857['attributes']};}):[]};}):[]};}):[]:[]})[_0xb89e('0xb')](function(_0x4055a7){logger[_0xb89e('0xc')](_0xb89e('0x1f'),_0x15c724);logger[_0xb89e('0xd')]('ShowSound',_0x15c724,JSON[_0xb89e('0x10')](_0x4055a7));_0x599911(_0x4055a7);})[_0xb89e('0x15')](function(_0x5b5c5c){logger[_0xb89e('0x11')](_0xb89e('0x1f'),_0x5b5c5c[_0xb89e('0x12')],_0x15c724);_0x374dcb(_0x2bdd11[_0xb89e('0x11')](0x1f4,_0x5b5c5c['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 00dc1e3..909f4c5 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 _0x3d7b=['/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./squareMessage.controller','get','isAuthenticated','index'];(function(_0x4d830b,_0x27f78d){var _0x238c89=function(_0x3eead9){while(--_0x3eead9){_0x4d830b['push'](_0x4d830b['shift']());}};_0x238c89(++_0x27f78d);}(_0x3d7b,0x194));var _0xb3d7=function(_0x2acbce,_0x1bba43){_0x2acbce=_0x2acbce-0x0;var _0x5f0461=_0x3d7b[_0x2acbce];return _0x5f0461;};'use strict';var multer=require(_0xb3d7('0x0'));var util=require('util');var path=require(_0xb3d7('0x1'));var timeout=require(_0xb3d7('0x2'));var express=require(_0xb3d7('0x3'));var router=express[_0xb3d7('0x4')]();var auth=require(_0xb3d7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb3d7('0x6'));router[_0xb3d7('0x7')]('/',auth[_0xb3d7('0x8')](),controller[_0xb3d7('0x9')]);router[_0xb3d7('0x7')](_0xb3d7('0xa'),auth[_0xb3d7('0x8')](),controller[_0xb3d7('0xb')]);router[_0xb3d7('0xc')]('/',auth[_0xb3d7('0x8')](),controller[_0xb3d7('0xd')]);router['put'](_0xb3d7('0xa'),auth[_0xb3d7('0x8')](),controller[_0xb3d7('0xe')]);router[_0xb3d7('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb3d7('0x10')]);module[_0xb3d7('0x11')]=router; \ No newline at end of file +var _0xc2ee=['Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x5afc77,_0x130139){var _0x218d5d=function(_0x518eed){while(--_0x518eed){_0x5afc77['push'](_0x5afc77['shift']());}};_0x218d5d(++_0x130139);}(_0xc2ee,0x10c));var _0xec2e=function(_0x53ff3b,_0x58f396){_0x53ff3b=_0x53ff3b-0x0;var _0x4d7ac2=_0xc2ee[_0x53ff3b];return _0x4d7ac2;};'use strict';var multer=require(_0xec2e('0x0'));var util=require(_0xec2e('0x1'));var path=require('path');var timeout=require(_0xec2e('0x2'));var express=require(_0xec2e('0x3'));var router=express[_0xec2e('0x4')]();var auth=require(_0xec2e('0x5'));var interaction=require(_0xec2e('0x6'));var config=require('../../config/environment');var controller=require('./squareMessage.controller');router[_0xec2e('0x7')]('/',auth['isAuthenticated'](),controller[_0xec2e('0x8')]);router['get'](_0xec2e('0x9'),auth[_0xec2e('0xa')](),controller[_0xec2e('0xb')]);router[_0xec2e('0xc')]('/',auth['isAuthenticated'](),controller[_0xec2e('0xd')]);router['put']('/:id',auth[_0xec2e('0xa')](),controller[_0xec2e('0xe')]);router[_0xec2e('0xf')](_0xec2e('0x9'),auth[_0xec2e('0xa')](),controller[_0xec2e('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 7ef6dae..d159e18 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 _0x2123=['out','sequelize','exports','STRING','TEXT','medium','ENUM'];(function(_0x531fb5,_0x2f6d55){var _0x457328=function(_0x4f9199){while(--_0x4f9199){_0x531fb5['push'](_0x531fb5['shift']());}};_0x457328(++_0x2f6d55);}(_0x2123,0x190));var _0x3212=function(_0x1bb37d,_0x56496a){_0x1bb37d=_0x1bb37d-0x0;var _0x29e971=_0x2123[_0x1bb37d];return _0x29e971;};'use strict';var Sequelize=require(_0x3212('0x0'));module[_0x3212('0x1')]={'uniqueid':{'type':Sequelize[_0x3212('0x2')]},'body':{'type':Sequelize[_0x3212('0x3')](_0x3212('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x3212('0x5')]('in',_0x3212('0x6')),'defaultValue':_0x3212('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x3212('0x2')]},'providerResponse':{'type':Sequelize[_0x3212('0x3')]}}; \ No newline at end of file +var _0xb66c=['TEXT','sequelize','STRING','medium','ENUM','out'];(function(_0x483f99,_0x4800fa){var _0x375a41=function(_0x1a242f){while(--_0x1a242f){_0x483f99['push'](_0x483f99['shift']());}};_0x375a41(++_0x4800fa);}(_0xb66c,0x175));var _0xcb66=function(_0x311766,_0x39a409){_0x311766=_0x311766-0x0;var _0x450489=_0xb66c[_0x311766];return _0x450489;};'use strict';var Sequelize=require(_0xcb66('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xcb66('0x1')]},'body':{'type':Sequelize['TEXT'](_0xcb66('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0xcb66('0x3')]('in',_0xcb66('0x4')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0xcb66('0x1')]},'providerResponse':{'type':Sequelize[_0xcb66('0x5')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index aa137dc..4a3ea2d 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 _0xb3e8=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','fields','find','create','update','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','length','order'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0xb3e8,0x1b5));var _0x8b3e=function(_0x5bcdb9,_0x2bef44){_0x5bcdb9=_0x5bcdb9-0x0;var _0x4f0dda=_0xb3e8[_0x5bcdb9];return _0x4f0dda;};'use strict';var pdf=require(_0x8b3e('0x0'));var emlformat=require(_0x8b3e('0x1'));var rimraf=require(_0x8b3e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8b3e('0x3'));var rp=require(_0x8b3e('0x4'));var moment=require(_0x8b3e('0x5'));var BPromise=require(_0x8b3e('0x6'));var Mustache=require(_0x8b3e('0x7'));var util=require('util');var path=require(_0x8b3e('0x8'));var sox=require(_0x8b3e('0x9'));var csv=require('to-csv');var ejs=require(_0x8b3e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8b3e('0xb'));var crypto=require(_0x8b3e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8b3e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8b3e('0xe'));var Papa=require('papaparse');var Redis=require(_0x8b3e('0xf'));var authService=require(_0x8b3e('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b3e('0x11'));var logger=require(_0x8b3e('0x12'))(_0x8b3e('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8b3e('0x14'));var db=require(_0x8b3e('0x15'))['db'];function respondWithStatusCode(_0x195ce1,_0x149ca4){_0x149ca4=_0x149ca4||0xcc;return function(_0x4290eb){if(_0x4290eb){return _0x195ce1[_0x8b3e('0x16')](_0x149ca4);}return _0x195ce1[_0x8b3e('0x17')](_0x149ca4)[_0x8b3e('0x18')]();};}function respondWithResult(_0x42dfc0,_0x29a0d8){_0x29a0d8=_0x29a0d8||0xc8;return function(_0x1c23df){if(_0x1c23df){return _0x42dfc0[_0x8b3e('0x17')](_0x29a0d8)[_0x8b3e('0x19')](_0x1c23df);}};}function respondWithFilteredResult(_0x2a4a60,_0x52e3d2){return function(_0x1ea3a4){if(_0x1ea3a4){var _0x269246=_0x1ea3a4['count'],_0x4cacec=_0x52e3d2[_0x8b3e('0x1a')],_0x256ac4=_0x52e3d2[_0x8b3e('0x1a')]+_0x52e3d2[_0x8b3e('0x1b')],_0x3240c5;if(_0x256ac4>=_0x269246){_0x256ac4=_0x269246;_0x3240c5=0xc8;}else{_0x3240c5=0xce;}_0x2a4a60['status'](_0x3240c5);return _0x2a4a60[_0x8b3e('0x1c')](_0x8b3e('0x1d'),_0x4cacec+'-'+_0x256ac4+'/'+_0x269246)['json'](_0x1ea3a4);}return null;};}function patchUpdates(_0x4eae40){return function(_0x338c98){try{jsonpatch[_0x8b3e('0x1e')](_0x338c98,_0x4eae40,!![]);}catch(_0x2ef980){return BPromise[_0x8b3e('0x1f')](_0x2ef980);}return _0x338c98[_0x8b3e('0x20')]();};}function saveUpdates(_0x3f9cc7,_0x310f5d){return function(_0x4a175e){if(_0x4a175e){return _0x4a175e['update'](_0x3f9cc7)[_0x8b3e('0x21')](function(_0x11e2db){return _0x11e2db;});}return null;};}function removeEntity(_0x1ec6a3,_0x57632e){return function(_0xc03f33){if(_0xc03f33){return _0xc03f33[_0x8b3e('0x22')]()[_0x8b3e('0x21')](function(){_0x1ec6a3[_0x8b3e('0x17')](0xcc)[_0x8b3e('0x18')]();});}};}function handleEntityNotFound(_0x4da469,_0x164370){return function(_0x18032f){if(!_0x18032f){_0x4da469[_0x8b3e('0x16')](0x194);}return _0x18032f;};}function handleError(_0x2f3717,_0x4e3287){_0x4e3287=_0x4e3287||0x1f4;return function(_0x45ce21){logger['error'](_0x45ce21[_0x8b3e('0x23')]);if(_0x45ce21['name']){delete _0x45ce21[_0x8b3e('0x24')];}_0x2f3717['status'](_0x4e3287)[_0x8b3e('0x25')](_0x45ce21);};}exports[_0x8b3e('0x26')]=function(_0x154c22,_0x5c90d1){var _0x28ca8f={},_0x3cf045={},_0x19ce82={'count':0x0,'rows':[]};var _0x4eda2a=_[_0x8b3e('0x27')](db[_0x8b3e('0x28')][_0x8b3e('0x29')],function(_0x41e6de){return{'name':_0x41e6de[_0x8b3e('0x2a')],'type':_0x41e6de[_0x8b3e('0x2b')][_0x8b3e('0x2c')]};});_0x3cf045['model']=_['map'](_0x4eda2a,'name');_0x3cf045[_0x8b3e('0x2d')]=_[_0x8b3e('0x2e')](_0x154c22[_0x8b3e('0x2d')]);_0x3cf045[_0x8b3e('0x2f')]=_['intersection'](_0x3cf045[_0x8b3e('0x30')],_0x3cf045[_0x8b3e('0x2d')]);_0x28ca8f[_0x8b3e('0x31')]=_[_0x8b3e('0x32')](_0x3cf045[_0x8b3e('0x30')],qs['fields'](_0x154c22[_0x8b3e('0x2d')]['fields']));_0x28ca8f[_0x8b3e('0x31')]=_0x28ca8f[_0x8b3e('0x31')][_0x8b3e('0x33')]?_0x28ca8f['attributes']:_0x3cf045[_0x8b3e('0x30')];if(!_0x154c22[_0x8b3e('0x2d')]['hasOwnProperty']('nolimit')){_0x28ca8f[_0x8b3e('0x1b')]=qs[_0x8b3e('0x1b')](_0x154c22[_0x8b3e('0x2d')][_0x8b3e('0x1b')]);_0x28ca8f['offset']=qs[_0x8b3e('0x1a')](_0x154c22[_0x8b3e('0x2d')]['offset']);}_0x28ca8f[_0x8b3e('0x34')]=qs[_0x8b3e('0x35')](_0x154c22[_0x8b3e('0x2d')][_0x8b3e('0x35')]);_0x28ca8f[_0x8b3e('0x36')]=qs[_0x8b3e('0x2f')](_[_0x8b3e('0x37')](_0x154c22['query'],_0x3cf045[_0x8b3e('0x2f')]),_0x4eda2a);if(_0x154c22[_0x8b3e('0x2d')][_0x8b3e('0x38')]){_0x28ca8f[_0x8b3e('0x36')]=_[_0x8b3e('0x39')](_0x28ca8f[_0x8b3e('0x36')],{'$or':_[_0x8b3e('0x27')](_0x4eda2a,function(_0xec74e9){if(_0xec74e9[_0x8b3e('0x2b')]!==_0x8b3e('0x3a')){var _0x58ab0c={};_0x58ab0c[_0xec74e9[_0x8b3e('0x24')]]={'$like':'%'+_0x154c22[_0x8b3e('0x2d')]['filter']+'%'};return _0x58ab0c;}})});}_0x28ca8f=_[_0x8b3e('0x39')]({},_0x28ca8f,_0x154c22[_0x8b3e('0x3b')]);var _0x309e1c={'where':_0x28ca8f[_0x8b3e('0x36')]};return db[_0x8b3e('0x28')]['count'](_0x309e1c)[_0x8b3e('0x21')](function(_0x29ab73){_0x19ce82['count']=_0x29ab73;if(_0x154c22[_0x8b3e('0x2d')][_0x8b3e('0x3c')]){_0x28ca8f[_0x8b3e('0x3d')]=[{'all':!![]}];}return db[_0x8b3e('0x28')][_0x8b3e('0x3e')](_0x28ca8f);})[_0x8b3e('0x21')](function(_0x56ed25){_0x19ce82[_0x8b3e('0x3f')]=_0x56ed25;return _0x19ce82;})['then'](respondWithFilteredResult(_0x5c90d1,_0x28ca8f))[_0x8b3e('0x40')](handleError(_0x5c90d1,null));};exports['show']=function(_0x58746f,_0x2c3751){var _0xcc974c={'raw':!![],'where':{'id':_0x58746f['params']['id']}},_0x26520b={};_0x26520b[_0x8b3e('0x30')]=_[_0x8b3e('0x2e')](db[_0x8b3e('0x28')][_0x8b3e('0x29')]);_0x26520b[_0x8b3e('0x2d')]=_[_0x8b3e('0x2e')](_0x58746f['query']);_0x26520b[_0x8b3e('0x2f')]=_['intersection'](_0x26520b[_0x8b3e('0x30')],_0x26520b['query']);_0xcc974c['attributes']=_['intersection'](_0x26520b['model'],qs[_0x8b3e('0x41')](_0x58746f[_0x8b3e('0x2d')]['fields']));_0xcc974c[_0x8b3e('0x31')]=_0xcc974c[_0x8b3e('0x31')][_0x8b3e('0x33')]?_0xcc974c[_0x8b3e('0x31')]:_0x26520b[_0x8b3e('0x30')];if(_0x58746f[_0x8b3e('0x2d')][_0x8b3e('0x3c')]){_0xcc974c[_0x8b3e('0x3d')]=[{'all':!![]}];}_0xcc974c=_[_0x8b3e('0x39')]({},_0xcc974c,_0x58746f[_0x8b3e('0x3b')]);return db[_0x8b3e('0x28')][_0x8b3e('0x42')](_0xcc974c)[_0x8b3e('0x21')](handleEntityNotFound(_0x2c3751,null))[_0x8b3e('0x21')](respondWithResult(_0x2c3751,null))[_0x8b3e('0x40')](handleError(_0x2c3751,null));};exports[_0x8b3e('0x43')]=function(_0x594617,_0x56a0d2){return db['SquareMessage'][_0x8b3e('0x43')](_0x594617['body'],{})[_0x8b3e('0x21')](respondWithResult(_0x56a0d2,0xc9))['catch'](handleError(_0x56a0d2,null));};exports[_0x8b3e('0x44')]=function(_0x3b1fe5,_0x1effce){if(_0x3b1fe5[_0x8b3e('0x45')]['id']){delete _0x3b1fe5['body']['id'];}return db['SquareMessage'][_0x8b3e('0x42')]({'where':{'id':_0x3b1fe5['params']['id']}})[_0x8b3e('0x21')](handleEntityNotFound(_0x1effce,null))[_0x8b3e('0x21')](saveUpdates(_0x3b1fe5[_0x8b3e('0x45')],null))[_0x8b3e('0x21')](respondWithResult(_0x1effce,null))[_0x8b3e('0x40')](handleError(_0x1effce,null));};exports[_0x8b3e('0x22')]=function(_0x1950e6,_0x39bc73){return db[_0x8b3e('0x28')][_0x8b3e('0x42')]({'where':{'id':_0x1950e6['params']['id']}})[_0x8b3e('0x21')](handleEntityNotFound(_0x39bc73,null))[_0x8b3e('0x21')](removeEntity(_0x39bc73,null))[_0x8b3e('0x40')](handleError(_0x39bc73,null));}; \ No newline at end of file +var _0xaaad=['include','findAll','rows','catch','show','params','filters','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','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/environment','../../config/license/util','status','end','json','offset','limit','set','Content-Range','reject','save','destroy','then','sendStatus','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll'];(function(_0x41756f,_0x345bfa){var _0x384783=function(_0x3cd1d9){while(--_0x3cd1d9){_0x41756f['push'](_0x41756f['shift']());}};_0x384783(++_0x345bfa);}(_0xaaad,0x132));var _0xdaaa=function(_0xf2e6bd,_0x22014f){_0xf2e6bd=_0xf2e6bd-0x0;var _0x45bda9=_0xaaad[_0xf2e6bd];return _0x45bda9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xdaaa('0x0'));var zipdir=require(_0xdaaa('0x1'));var jsonpatch=require(_0xdaaa('0x2'));var rp=require(_0xdaaa('0x3'));var moment=require(_0xdaaa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdaaa('0x5'));var util=require('util');var path=require(_0xdaaa('0x6'));var sox=require('sox');var csv=require(_0xdaaa('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdaaa('0x8'));var squel=require(_0xdaaa('0x9'));var crypto=require(_0xdaaa('0xa'));var jsforce=require(_0xdaaa('0xb'));var deskjs=require(_0xdaaa('0xc'));var toCsv=require(_0xdaaa('0x7'));var querystring=require(_0xdaaa('0xd'));var Papa=require('papaparse');var Redis=require(_0xdaaa('0xe'));var authService=require(_0xdaaa('0xf'));var qs=require(_0xdaaa('0x10'));var as=require(_0xdaaa('0x11'));var hardwareService=require(_0xdaaa('0x12'));var logger=require(_0xdaaa('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xdaaa('0x14'));var licenseUtil=require(_0xdaaa('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15c68d,_0x5c44e7){_0x5c44e7=_0x5c44e7||0xcc;return function(_0x13464b){if(_0x13464b){return _0x15c68d['sendStatus'](_0x5c44e7);}return _0x15c68d[_0xdaaa('0x16')](_0x5c44e7)[_0xdaaa('0x17')]();};}function respondWithResult(_0x43049c,_0x256725){_0x256725=_0x256725||0xc8;return function(_0x57addb){if(_0x57addb){return _0x43049c[_0xdaaa('0x16')](_0x256725)[_0xdaaa('0x18')](_0x57addb);}};}function respondWithFilteredResult(_0x445ad3,_0x1c2783){return function(_0x527f24){if(_0x527f24){var _0x306452=_0x527f24['count'],_0x5153e1=_0x1c2783[_0xdaaa('0x19')],_0x2da5fc=_0x1c2783['offset']+_0x1c2783[_0xdaaa('0x1a')],_0x44a0a8;if(_0x2da5fc>=_0x306452){_0x2da5fc=_0x306452;_0x44a0a8=0xc8;}else{_0x44a0a8=0xce;}_0x445ad3[_0xdaaa('0x16')](_0x44a0a8);return _0x445ad3[_0xdaaa('0x1b')](_0xdaaa('0x1c'),_0x5153e1+'-'+_0x2da5fc+'/'+_0x306452)['json'](_0x527f24);}return null;};}function patchUpdates(_0x49ad83){return function(_0x46aa64){try{jsonpatch['apply'](_0x46aa64,_0x49ad83,!![]);}catch(_0x595762){return BPromise[_0xdaaa('0x1d')](_0x595762);}return _0x46aa64[_0xdaaa('0x1e')]();};}function saveUpdates(_0x67ef6e,_0x428eb9){return function(_0x382996){if(_0x382996){return _0x382996['update'](_0x67ef6e)['then'](function(_0x2de78d){return _0x2de78d;});}return null;};}function removeEntity(_0x258407,_0x3aa682){return function(_0x470a20){if(_0x470a20){return _0x470a20[_0xdaaa('0x1f')]()[_0xdaaa('0x20')](function(){_0x258407[_0xdaaa('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dbee9,_0x32cc3a){return function(_0xde88d6){if(!_0xde88d6){_0x5dbee9[_0xdaaa('0x21')](0x194);}return _0xde88d6;};}function handleError(_0x2c19ce,_0x24a89f){_0x24a89f=_0x24a89f||0x1f4;return function(_0x1ba1d6){logger[_0xdaaa('0x22')](_0x1ba1d6[_0xdaaa('0x23')]);if(_0x1ba1d6[_0xdaaa('0x24')]){delete _0x1ba1d6[_0xdaaa('0x24')];}_0x2c19ce[_0xdaaa('0x16')](_0x24a89f)[_0xdaaa('0x25')](_0x1ba1d6);};}exports[_0xdaaa('0x26')]=function(_0x9bff69,_0x5e3b32){var _0x28a0d2={},_0xee87dc={},_0x1a2440={'count':0x0,'rows':[]};var _0x164257=_[_0xdaaa('0x27')](db[_0xdaaa('0x28')][_0xdaaa('0x29')],function(_0x13112d){return{'name':_0x13112d[_0xdaaa('0x2a')],'type':_0x13112d['type'][_0xdaaa('0x2b')]};});_0xee87dc[_0xdaaa('0x2c')]=_[_0xdaaa('0x27')](_0x164257,_0xdaaa('0x24'));_0xee87dc['query']=_[_0xdaaa('0x2d')](_0x9bff69['query']);_0xee87dc['filters']=_['intersection'](_0xee87dc['model'],_0xee87dc[_0xdaaa('0x2e')]);_0x28a0d2[_0xdaaa('0x2f')]=_[_0xdaaa('0x30')](_0xee87dc['model'],qs['fields'](_0x9bff69[_0xdaaa('0x2e')][_0xdaaa('0x31')]));_0x28a0d2[_0xdaaa('0x2f')]=_0x28a0d2[_0xdaaa('0x2f')][_0xdaaa('0x32')]?_0x28a0d2[_0xdaaa('0x2f')]:_0xee87dc[_0xdaaa('0x2c')];if(!_0x9bff69[_0xdaaa('0x2e')][_0xdaaa('0x33')](_0xdaaa('0x34'))){_0x28a0d2[_0xdaaa('0x1a')]=qs['limit'](_0x9bff69[_0xdaaa('0x2e')][_0xdaaa('0x1a')]);_0x28a0d2[_0xdaaa('0x19')]=qs['offset'](_0x9bff69['query']['offset']);}_0x28a0d2[_0xdaaa('0x35')]=qs[_0xdaaa('0x36')](_0x9bff69[_0xdaaa('0x2e')][_0xdaaa('0x36')]);_0x28a0d2[_0xdaaa('0x37')]=qs['filters'](_[_0xdaaa('0x38')](_0x9bff69[_0xdaaa('0x2e')],_0xee87dc['filters']),_0x164257);if(_0x9bff69[_0xdaaa('0x2e')][_0xdaaa('0x39')]){_0x28a0d2[_0xdaaa('0x37')]=_[_0xdaaa('0x3a')](_0x28a0d2[_0xdaaa('0x37')],{'$or':_[_0xdaaa('0x27')](_0x164257,function(_0x2de21b){if(_0x2de21b[_0xdaaa('0x3b')]!==_0xdaaa('0x3c')){var _0x589b21={};_0x589b21[_0x2de21b[_0xdaaa('0x24')]]={'$like':'%'+_0x9bff69['query'][_0xdaaa('0x39')]+'%'};return _0x589b21;}})});}_0x28a0d2=_[_0xdaaa('0x3a')]({},_0x28a0d2,_0x9bff69[_0xdaaa('0x3d')]);var _0x3a5fd8={'where':_0x28a0d2[_0xdaaa('0x37')]};return db[_0xdaaa('0x28')][_0xdaaa('0x3e')](_0x3a5fd8)[_0xdaaa('0x20')](function(_0x4ef9dc){_0x1a2440[_0xdaaa('0x3e')]=_0x4ef9dc;if(_0x9bff69['query'][_0xdaaa('0x3f')]){_0x28a0d2[_0xdaaa('0x40')]=[{'all':!![]}];}return db[_0xdaaa('0x28')][_0xdaaa('0x41')](_0x28a0d2);})['then'](function(_0xeac2b8){_0x1a2440[_0xdaaa('0x42')]=_0xeac2b8;return _0x1a2440;})[_0xdaaa('0x20')](respondWithFilteredResult(_0x5e3b32,_0x28a0d2))[_0xdaaa('0x43')](handleError(_0x5e3b32,null));};exports[_0xdaaa('0x44')]=function(_0xea7522,_0x527a29){var _0x2a3f05={'raw':!![],'where':{'id':_0xea7522[_0xdaaa('0x45')]['id']}},_0x28b75c={};_0x28b75c[_0xdaaa('0x2c')]=_[_0xdaaa('0x2d')](db[_0xdaaa('0x28')][_0xdaaa('0x29')]);_0x28b75c[_0xdaaa('0x2e')]=_[_0xdaaa('0x2d')](_0xea7522[_0xdaaa('0x2e')]);_0x28b75c[_0xdaaa('0x46')]=_[_0xdaaa('0x30')](_0x28b75c[_0xdaaa('0x2c')],_0x28b75c[_0xdaaa('0x2e')]);_0x2a3f05[_0xdaaa('0x2f')]=_[_0xdaaa('0x30')](_0x28b75c['model'],qs[_0xdaaa('0x31')](_0xea7522[_0xdaaa('0x2e')][_0xdaaa('0x31')]));_0x2a3f05[_0xdaaa('0x2f')]=_0x2a3f05[_0xdaaa('0x2f')][_0xdaaa('0x32')]?_0x2a3f05[_0xdaaa('0x2f')]:_0x28b75c[_0xdaaa('0x2c')];if(_0xea7522['query'][_0xdaaa('0x3f')]){_0x2a3f05[_0xdaaa('0x40')]=[{'all':!![]}];}_0x2a3f05=_[_0xdaaa('0x3a')]({},_0x2a3f05,_0xea7522[_0xdaaa('0x3d')]);return db[_0xdaaa('0x28')][_0xdaaa('0x47')](_0x2a3f05)['then'](handleEntityNotFound(_0x527a29,null))['then'](respondWithResult(_0x527a29,null))['catch'](handleError(_0x527a29,null));};exports[_0xdaaa('0x48')]=function(_0x46ec25,_0x3b7971){return db['SquareMessage']['create'](_0x46ec25[_0xdaaa('0x49')],{})['then'](respondWithResult(_0x3b7971,0xc9))['catch'](handleError(_0x3b7971,null));};exports['update']=function(_0x3f8141,_0x2e6339){if(_0x3f8141['body']['id']){delete _0x3f8141[_0xdaaa('0x49')]['id'];}return db[_0xdaaa('0x28')][_0xdaaa('0x47')]({'where':{'id':_0x3f8141[_0xdaaa('0x45')]['id']}})[_0xdaaa('0x20')](handleEntityNotFound(_0x2e6339,null))['then'](saveUpdates(_0x3f8141[_0xdaaa('0x49')],null))[_0xdaaa('0x20')](respondWithResult(_0x2e6339,null))['catch'](handleError(_0x2e6339,null));};exports[_0xdaaa('0x1f')]=function(_0x54601b,_0xf25655){return db[_0xdaaa('0x28')][_0xdaaa('0x47')]({'where':{'id':_0x54601b[_0xdaaa('0x45')]['id']}})[_0xdaaa('0x20')](handleEntityNotFound(_0xf25655,null))['then'](removeEntity(_0xf25655,null))['catch'](handleError(_0xf25655,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 6213cc3..97e251d 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 _0xe02f=['rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe02f,0x111));var _0xfe02=function(_0x35e124,_0x1d85e2){_0x35e124=_0x35e124-0x0;var _0x53c482=_0xe02f[_0x35e124];return _0x53c482;};'use strict';var _=require(_0xfe02('0x0'));var util=require('util');var logger=require(_0xfe02('0x1'))(_0xfe02('0x2'));var moment=require(_0xfe02('0x3'));var BPromise=require(_0xfe02('0x4'));var rp=require(_0xfe02('0x5'));var fs=require('fs');var path=require(_0xfe02('0x6'));var rimraf=require(_0xfe02('0x7'));var config=require(_0xfe02('0x8'));var attributes=require(_0xfe02('0x9'));module[_0xfe02('0xa')]=function(_0x3757a0,_0x23ec02){return _0x3757a0[_0xfe02('0xb')](_0xfe02('0xc'),attributes,{'tableName':_0xfe02('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c1f=['bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','util','../../config/logger','moment'];(function(_0x39c386,_0x3e81bb){var _0x11cdb7=function(_0x21ffca){while(--_0x21ffca){_0x39c386['push'](_0x39c386['shift']());}};_0x11cdb7(++_0x3e81bb);}(_0x1c1f,0x168));var _0xf1c1=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x1c1f[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xf1c1('0x0'));var util=require(_0xf1c1('0x1'));var logger=require(_0xf1c1('0x2'))('api');var moment=require(_0xf1c1('0x3'));var BPromise=require(_0xf1c1('0x4'));var rp=require(_0xf1c1('0x5'));var fs=require('fs');var path=require(_0xf1c1('0x6'));var rimraf=require(_0xf1c1('0x7'));var config=require(_0xf1c1('0x8'));var attributes=require(_0xf1c1('0x9'));module[_0xf1c1('0xa')]=function(_0x43932f,_0x55b565){return _0x43932f['define'](_0xf1c1('0xb'),attributes,{'tableName':_0xf1c1('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 fbb0cd4..d60d541 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(_0x30e4a3,_0x153080){var _0x58aa84=function(_0x51081f){while(--_0x51081f){_0x30e4a3['push'](_0x30e4a3['shift']());}};_0x58aa84(++_0x153080);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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(_0xc165a1,_0x246799){var _0x461777=function(_0x1fd23c){while(--_0x1fd23c){_0xc165a1['push'](_0xc165a1['shift']());}};_0x461777(++_0x246799);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 2021c3d..d775b2a 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 _0x7a92=['post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','15s','test'];(function(_0x3a887a,_0x3f7069){var _0x3d634a=function(_0x1200bf){while(--_0x1200bf){_0x3a887a['push'](_0x3a887a['shift']());}};_0x3d634a(++_0x3f7069);}(_0x7a92,0x1bc));var _0x27a9=function(_0x3ddd8b,_0x143279){_0x3ddd8b=_0x3ddd8b-0x0;var _0x3a8d00=_0x7a92[_0x3ddd8b];return _0x3a8d00;};'use strict';var multer=require(_0x27a9('0x0'));var util=require(_0x27a9('0x1'));var path=require('path');var timeout=require(_0x27a9('0x2'));var express=require(_0x27a9('0x3'));var router=express[_0x27a9('0x4')]();var auth=require(_0x27a9('0x5'));var interaction=require(_0x27a9('0x6'));var config=require(_0x27a9('0x7'));var controller=require(_0x27a9('0x8'));router[_0x27a9('0x9')]('/',auth[_0x27a9('0xa')](),controller[_0x27a9('0xb')]);router[_0x27a9('0x9')](_0x27a9('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x27a9('0x9')](_0x27a9('0xd'),auth[_0x27a9('0xa')](),timeout(_0x27a9('0xe')),controller[_0x27a9('0xf')]);router[_0x27a9('0x10')]('/',auth['isAuthenticated'](),controller[_0x27a9('0x11')]);router[_0x27a9('0x12')](_0x27a9('0xc'),auth[_0x27a9('0xa')](),controller[_0x27a9('0x13')]);router[_0x27a9('0x14')](_0x27a9('0xc'),auth[_0x27a9('0xa')](),controller[_0x27a9('0x15')]);module[_0x27a9('0x16')]=router; \ No newline at end of file +var _0x9c5b=['multer','path','express','Router','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','/:id','show','/:id/test','15s','put','delete','destroy','exports'];(function(_0x53790a,_0x3fb2d9){var _0xbc50db=function(_0x43bdeb){while(--_0x43bdeb){_0x53790a['push'](_0x53790a['shift']());}};_0xbc50db(++_0x3fb2d9);}(_0x9c5b,0x1cb));var _0xb9c5=function(_0x1ecd50,_0x270330){_0x1ecd50=_0x1ecd50-0x0;var _0x12e9a0=_0x9c5b[_0x1ecd50];return _0x12e9a0;};'use strict';var multer=require(_0xb9c5('0x0'));var util=require('util');var path=require(_0xb9c5('0x1'));var timeout=require('connect-timeout');var express=require(_0xb9c5('0x2'));var router=express[_0xb9c5('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb9c5('0x4'));var config=require(_0xb9c5('0x5'));var controller=require(_0xb9c5('0x6'));router[_0xb9c5('0x7')]('/',auth[_0xb9c5('0x8')](),controller['index']);router[_0xb9c5('0x7')](_0xb9c5('0x9'),auth['isAuthenticated'](),controller[_0xb9c5('0xa')]);router[_0xb9c5('0x7')](_0xb9c5('0xb'),auth['isAuthenticated'](),timeout(_0xb9c5('0xc')),controller['test']);router['post']('/',auth[_0xb9c5('0x8')](),controller['create']);router[_0xb9c5('0xd')](_0xb9c5('0x9'),auth[_0xb9c5('0x8')](),controller['update']);router[_0xb9c5('0xe')](_0xb9c5('0x9'),auth[_0xb9c5('0x8')](),controller[_0xb9c5('0xf')]);module[_0xb9c5('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 66fbde8..3e45d38 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 _0x74ed=['exports','STRING','name','sequelize'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0x74ed,0x11b));var _0xd74e=function(_0x2d2f58,_0xbf0d69){_0x2d2f58=_0x2d2f58-0x0;var _0x187049=_0x74ed[_0x2d2f58];return _0x187049;};'use strict';var Sequelize=require(_0xd74e('0x0'));module[_0xd74e('0x1')]={'name':{'type':Sequelize[_0xd74e('0x2')],'unique':_0xd74e('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xd74e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0460=['exports','STRING'];(function(_0x25d673,_0xfc873b){var _0x4900f2=function(_0x53605c){while(--_0x53605c){_0x25d673['push'](_0x25d673['shift']());}};_0x4900f2(++_0xfc873b);}(_0x0460,0x1ea));var _0x0046=function(_0x4fcc6a,_0x424309){_0x4fcc6a=_0x4fcc6a-0x0;var _0xf07df0=_0x0460[_0x4fcc6a];return _0xf07df0;};'use strict';var Sequelize=require('sequelize');module[_0x0046('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x0046('0x1')]},'description':{'type':Sequelize[_0x0046('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 0d45d1b..6029d4f 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 _0x52d3=['../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','ODBC','error','stack','name','send','index','map','SquareOdbc','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','count','include','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','odbc','openSync','dsn','closeSync','eml-format','moment','bluebird','path','sox','to-csv','lodash','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'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x52d3,0x186));var _0x352d=function(_0x14f841,_0xa05174){_0x14f841=_0x14f841-0x0;var _0x437415=_0x52d3[_0x14f841];return _0x437415;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x352d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x352d('0x1'));var BPromise=require(_0x352d('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x352d('0x3'));var sox=require(_0x352d('0x4'));var csv=require(_0x352d('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x352d('0x6'));var squel=require('squel');var crypto=require(_0x352d('0x7'));var jsforce=require(_0x352d('0x8'));var deskjs=require(_0x352d('0x9'));var toCsv=require(_0x352d('0x5'));var querystring=require(_0x352d('0xa'));var Papa=require(_0x352d('0xb'));var Redis=require('ioredis');var authService=require(_0x352d('0xc'));var qs=require(_0x352d('0xd'));var as=require(_0x352d('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x352d('0xf'))(_0x352d('0x10'));var utils=require(_0x352d('0x11'));var config=require(_0x352d('0x12'));var licenseUtil=require(_0x352d('0x13'));var db=require(_0x352d('0x14'))['db'];function respondWithStatusCode(_0x559408,_0x553e4e){_0x553e4e=_0x553e4e||0xcc;return function(_0x518beb){if(_0x518beb){return _0x559408[_0x352d('0x15')](_0x553e4e);}return _0x559408[_0x352d('0x16')](_0x553e4e)[_0x352d('0x17')]();};}function respondWithResult(_0x25e84f,_0x46639e){_0x46639e=_0x46639e||0xc8;return function(_0x194231){if(_0x194231){return _0x25e84f[_0x352d('0x16')](_0x46639e)[_0x352d('0x18')](_0x194231);}};}function respondWithFilteredResult(_0x20e35d,_0x2f53d6){return function(_0x22c099){if(_0x22c099){var _0x13c2e9=_0x22c099['count'],_0xf596b9=_0x2f53d6[_0x352d('0x19')],_0x249bf4=_0x2f53d6[_0x352d('0x19')]+_0x2f53d6[_0x352d('0x1a')],_0x16ac77;if(_0x249bf4>=_0x13c2e9){_0x249bf4=_0x13c2e9;_0x16ac77=0xc8;}else{_0x16ac77=0xce;}_0x20e35d[_0x352d('0x16')](_0x16ac77);return _0x20e35d[_0x352d('0x1b')](_0x352d('0x1c'),_0xf596b9+'-'+_0x249bf4+'/'+_0x13c2e9)[_0x352d('0x18')](_0x22c099);}return null;};}function patchUpdates(_0x2047e1){return function(_0x491c2f){try{jsonpatch[_0x352d('0x1d')](_0x491c2f,_0x2047e1,!![]);}catch(_0xa11e6f){return BPromise['reject'](_0xa11e6f);}return _0x491c2f[_0x352d('0x1e')]();};}function saveUpdates(_0x5e35d2,_0x19d608){return function(_0x397b58){if(_0x397b58){return _0x397b58[_0x352d('0x1f')](_0x5e35d2)[_0x352d('0x20')](function(_0x321bb4){return _0x321bb4;});}return null;};}function removeEntity(_0x1f702d,_0x3ab6ce){return function(_0x507eaf){if(_0x507eaf){return _0x507eaf[_0x352d('0x21')]()[_0x352d('0x20')](function(){var _0x22b622=_0x507eaf[_0x352d('0x22')]({'plain':!![]});var _0x5cdcd7=_0x352d('0x23');return db['UserProfileResource'][_0x352d('0x21')]({'where':{'type':_0x5cdcd7,'resourceId':_0x22b622['id']}})[_0x352d('0x20')](function(){return _0x507eaf;});})['then'](function(){_0x1f702d[_0x352d('0x16')](0xcc)[_0x352d('0x17')]();});}};}function handleEntityNotFound(_0x36b4c1,_0x190378){return function(_0x5c29a3){if(!_0x5c29a3){_0x36b4c1[_0x352d('0x15')](0x194);}return _0x5c29a3;};}function handleError(_0x2695af,_0x48aa6e){_0x48aa6e=_0x48aa6e||0x1f4;return function(_0x521f53){logger[_0x352d('0x24')](_0x521f53[_0x352d('0x25')]);if(_0x521f53[_0x352d('0x26')]){delete _0x521f53[_0x352d('0x26')];}_0x2695af[_0x352d('0x16')](_0x48aa6e)[_0x352d('0x27')](_0x521f53);};}exports[_0x352d('0x28')]=function(_0x4a3e48,_0x1e8490){var _0x2161ad={},_0x512a0b={},_0x7b3ca={'count':0x0,'rows':[]};var _0x89da73=_[_0x352d('0x29')](db[_0x352d('0x2a')][_0x352d('0x2b')],function(_0x2666ae){return{'name':_0x2666ae['fieldName'],'type':_0x2666ae[_0x352d('0x2c')][_0x352d('0x2d')]};});_0x512a0b[_0x352d('0x2e')]=_[_0x352d('0x29')](_0x89da73,_0x352d('0x26'));_0x512a0b[_0x352d('0x2f')]=_[_0x352d('0x30')](_0x4a3e48[_0x352d('0x2f')]);_0x512a0b['filters']=_['intersection'](_0x512a0b[_0x352d('0x2e')],_0x512a0b['query']);_0x2161ad[_0x352d('0x31')]=_[_0x352d('0x32')](_0x512a0b['model'],qs['fields'](_0x4a3e48[_0x352d('0x2f')][_0x352d('0x33')]));_0x2161ad[_0x352d('0x31')]=_0x2161ad['attributes'][_0x352d('0x34')]?_0x2161ad[_0x352d('0x31')]:_0x512a0b['model'];if(!_0x4a3e48[_0x352d('0x2f')][_0x352d('0x35')](_0x352d('0x36'))){_0x2161ad[_0x352d('0x1a')]=qs[_0x352d('0x1a')](_0x4a3e48[_0x352d('0x2f')][_0x352d('0x1a')]);_0x2161ad['offset']=qs['offset'](_0x4a3e48[_0x352d('0x2f')][_0x352d('0x19')]);}_0x2161ad[_0x352d('0x37')]=qs[_0x352d('0x38')](_0x4a3e48[_0x352d('0x2f')][_0x352d('0x38')]);_0x2161ad[_0x352d('0x39')]=qs[_0x352d('0x3a')](_[_0x352d('0x3b')](_0x4a3e48[_0x352d('0x2f')],_0x512a0b['filters']),_0x89da73);if(_0x4a3e48[_0x352d('0x2f')]['filter']){_0x2161ad[_0x352d('0x39')]=_['merge'](_0x2161ad[_0x352d('0x39')],{'$or':_['map'](_0x89da73,function(_0x2dca27){if(_0x2dca27[_0x352d('0x2c')]!==_0x352d('0x3c')){var _0x3beeae={};_0x3beeae[_0x2dca27[_0x352d('0x26')]]={'$like':'%'+_0x4a3e48[_0x352d('0x2f')][_0x352d('0x3d')]+'%'};return _0x3beeae;}})});}_0x2161ad=_[_0x352d('0x3e')]({},_0x2161ad,_0x4a3e48[_0x352d('0x3f')]);var _0x3b79c7={'where':_0x2161ad[_0x352d('0x39')]};return db[_0x352d('0x2a')][_0x352d('0x40')](_0x3b79c7)[_0x352d('0x20')](function(_0x294ca9){_0x7b3ca['count']=_0x294ca9;if(_0x4a3e48['query']['includeAll']){_0x2161ad[_0x352d('0x41')]=[{'all':!![]}];}return db[_0x352d('0x2a')]['findAll'](_0x2161ad);})[_0x352d('0x20')](function(_0x48d9ed){_0x7b3ca['rows']=_0x48d9ed;return _0x7b3ca;})[_0x352d('0x20')](respondWithFilteredResult(_0x1e8490,_0x2161ad))['catch'](handleError(_0x1e8490,null));};exports[_0x352d('0x42')]=function(_0x2549e7,_0x4a6896){var _0x4c048e={'raw':!![],'where':{'id':_0x2549e7[_0x352d('0x43')]['id']}},_0x485cab={};_0x485cab['model']=_['keys'](db['SquareOdbc'][_0x352d('0x2b')]);_0x485cab[_0x352d('0x2f')]=_[_0x352d('0x30')](_0x2549e7[_0x352d('0x2f')]);_0x485cab[_0x352d('0x3a')]=_[_0x352d('0x32')](_0x485cab[_0x352d('0x2e')],_0x485cab[_0x352d('0x2f')]);_0x4c048e[_0x352d('0x31')]=_[_0x352d('0x32')](_0x485cab[_0x352d('0x2e')],qs[_0x352d('0x33')](_0x2549e7[_0x352d('0x2f')][_0x352d('0x33')]));_0x4c048e[_0x352d('0x31')]=_0x4c048e[_0x352d('0x31')][_0x352d('0x34')]?_0x4c048e[_0x352d('0x31')]:_0x485cab['model'];if(_0x2549e7[_0x352d('0x2f')][_0x352d('0x44')]){_0x4c048e[_0x352d('0x41')]=[{'all':!![]}];}_0x4c048e=_[_0x352d('0x3e')]({},_0x4c048e,_0x2549e7[_0x352d('0x3f')]);return db['SquareOdbc'][_0x352d('0x45')](_0x4c048e)[_0x352d('0x20')](handleEntityNotFound(_0x4a6896,null))[_0x352d('0x20')](respondWithResult(_0x4a6896,null))['catch'](handleError(_0x4a6896,null));};exports[_0x352d('0x46')]=function(_0x2ed45a,_0x57e95e){return db[_0x352d('0x2a')][_0x352d('0x46')](_0x2ed45a[_0x352d('0x47')],{})[_0x352d('0x20')](function(_0x23885f){var _0x92dba0=_0x2ed45a['user'][_0x352d('0x22')]({'plain':!![]});if(!_0x92dba0)throw new Error(_0x352d('0x48'));if(_0x92dba0['role']==='user'){var _0x385122=_0x23885f[_0x352d('0x22')]({'plain':!![]});var _0x53566b=_0x352d('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x53566b,'userProfileId':_0x92dba0[_0x352d('0x49')]},'raw':!![]})[_0x352d('0x20')](function(_0x4ce694){if(_0x4ce694&&_0x4ce694['autoAssociation']===0x0){return db[_0x352d('0x4a')][_0x352d('0x46')]({'name':_0x385122[_0x352d('0x26')],'resourceId':_0x385122['id'],'type':_0x4ce694[_0x352d('0x26')],'sectionId':_0x4ce694['id']},{})['then'](function(){return _0x23885f;});}else{return _0x23885f;}})[_0x352d('0x4b')](function(_0x1fc321){logger[_0x352d('0x24')](_0x352d('0x4c'),_0x1fc321);throw _0x1fc321;});}return _0x23885f;})[_0x352d('0x20')](respondWithResult(_0x57e95e,0xc9))[_0x352d('0x4b')](handleError(_0x57e95e,null));};exports[_0x352d('0x1f')]=function(_0x192252,_0x51608d){if(_0x192252['body']['id']){delete _0x192252[_0x352d('0x47')]['id'];}return db[_0x352d('0x2a')][_0x352d('0x45')]({'where':{'id':_0x192252[_0x352d('0x43')]['id']}})['then'](handleEntityNotFound(_0x51608d,null))['then'](saveUpdates(_0x192252[_0x352d('0x47')],null))[_0x352d('0x20')](respondWithResult(_0x51608d,null))[_0x352d('0x4b')](handleError(_0x51608d,null));};exports[_0x352d('0x21')]=function(_0x578041,_0x12d0ba){return db['SquareOdbc'][_0x352d('0x45')]({'where':{'id':_0x578041[_0x352d('0x43')]['id']}})[_0x352d('0x20')](handleEntityNotFound(_0x12d0ba,null))[_0x352d('0x20')](removeEntity(_0x12d0ba,null))[_0x352d('0x4b')](handleError(_0x12d0ba,null));};exports[_0x352d('0x4d')]=function(_0x138242,_0x32e93a,_0x564f93){var _0x2c740d;return db[_0x352d('0x2a')][_0x352d('0x45')]({'where':{'id':_0x138242[_0x352d('0x43')]['id']},'attributes':['id','dsn']})[_0x352d('0x20')](handleEntityNotFound(_0x32e93a,null))[_0x352d('0x20')](function(_0x48962d){if(_0x48962d){var _0x4442f3=require(_0x352d('0x4e'))();_0x4442f3[_0x352d('0x4f')](_0x48962d[_0x352d('0x50')]);_0x4442f3[_0x352d('0x51')]();return _0x48962d;}})[_0x352d('0x20')](respondWithResult(_0x32e93a,null))[_0x352d('0x4b')](handleError(_0x32e93a,null));}; \ No newline at end of file +var _0xc747=['include','find','catch','create','user','ODBC','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','test','dsn','odbc','openSync','closeSync','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','json','count','offset','Content-Range','apply','reject','save','update','then','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','fields','attributes','length','hasOwnProperty','nolimit','limit','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','intersection'];(function(_0x54fa8c,_0xc2d9d0){var _0x26e2d6=function(_0x5013bc){while(--_0x5013bc){_0x54fa8c['push'](_0x54fa8c['shift']());}};_0x26e2d6(++_0xc2d9d0);}(_0xc747,0x153));var _0x7c74=function(_0x431807,_0x187385){_0x431807=_0x431807-0x0;var _0x51d062=_0xc747[_0x431807];return _0x51d062;};'use strict';var pdf=require(_0x7c74('0x0'));var emlformat=require(_0x7c74('0x1'));var rimraf=require(_0x7c74('0x2'));var zipdir=require(_0x7c74('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7c74('0x4'));var BPromise=require(_0x7c74('0x5'));var Mustache=require(_0x7c74('0x6'));var util=require(_0x7c74('0x7'));var path=require(_0x7c74('0x8'));var sox=require('sox');var csv=require(_0x7c74('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7c74('0xa'));var squel=require(_0x7c74('0xb'));var crypto=require(_0x7c74('0xc'));var jsforce=require(_0x7c74('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7c74('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7c74('0xf'));var as=require(_0x7c74('0x10'));var hardwareService=require(_0x7c74('0x11'));var logger=require('../../config/logger')(_0x7c74('0x12'));var utils=require('../../config/utils');var config=require(_0x7c74('0x13'));var licenseUtil=require(_0x7c74('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1823ae,_0x350272){_0x350272=_0x350272||0xcc;return function(_0x46d722){if(_0x46d722){return _0x1823ae['sendStatus'](_0x350272);}return _0x1823ae[_0x7c74('0x15')](_0x350272)['end']();};}function respondWithResult(_0x578dca,_0x353799){_0x353799=_0x353799||0xc8;return function(_0x42d821){if(_0x42d821){return _0x578dca[_0x7c74('0x15')](_0x353799)[_0x7c74('0x16')](_0x42d821);}};}function respondWithFilteredResult(_0x30ee69,_0x1dc5e0){return function(_0x34451a){if(_0x34451a){var _0x254f0b=_0x34451a[_0x7c74('0x17')],_0x49accb=_0x1dc5e0[_0x7c74('0x18')],_0x17b7e1=_0x1dc5e0['offset']+_0x1dc5e0['limit'],_0x2b5c04;if(_0x17b7e1>=_0x254f0b){_0x17b7e1=_0x254f0b;_0x2b5c04=0xc8;}else{_0x2b5c04=0xce;}_0x30ee69[_0x7c74('0x15')](_0x2b5c04);return _0x30ee69['set'](_0x7c74('0x19'),_0x49accb+'-'+_0x17b7e1+'/'+_0x254f0b)['json'](_0x34451a);}return null;};}function patchUpdates(_0x5a353a){return function(_0x33be60){try{jsonpatch[_0x7c74('0x1a')](_0x33be60,_0x5a353a,!![]);}catch(_0xf37e9b){return BPromise[_0x7c74('0x1b')](_0xf37e9b);}return _0x33be60[_0x7c74('0x1c')]();};}function saveUpdates(_0x5ae415,_0x121117){return function(_0x59b780){if(_0x59b780){return _0x59b780[_0x7c74('0x1d')](_0x5ae415)[_0x7c74('0x1e')](function(_0x19198d){return _0x19198d;});}return null;};}function removeEntity(_0x603e88,_0x2d35fb){return function(_0x333586){if(_0x333586){return _0x333586['destroy']()[_0x7c74('0x1e')](function(){var _0x1e7f3c=_0x333586[_0x7c74('0x1f')]({'plain':!![]});var _0x1e274d='ODBC';return db[_0x7c74('0x20')]['destroy']({'where':{'type':_0x1e274d,'resourceId':_0x1e7f3c['id']}})[_0x7c74('0x1e')](function(){return _0x333586;});})[_0x7c74('0x1e')](function(){_0x603e88[_0x7c74('0x15')](0xcc)[_0x7c74('0x21')]();});}};}function handleEntityNotFound(_0x51e8fb,_0x36d562){return function(_0x2c68e8){if(!_0x2c68e8){_0x51e8fb[_0x7c74('0x22')](0x194);}return _0x2c68e8;};}function handleError(_0x285b3c,_0x5d6ad1){_0x5d6ad1=_0x5d6ad1||0x1f4;return function(_0x5d7213){logger[_0x7c74('0x23')](_0x5d7213[_0x7c74('0x24')]);if(_0x5d7213[_0x7c74('0x25')]){delete _0x5d7213[_0x7c74('0x25')];}_0x285b3c[_0x7c74('0x15')](_0x5d6ad1)[_0x7c74('0x26')](_0x5d7213);};}exports[_0x7c74('0x27')]=function(_0x3e94c5,_0x136141){var _0x721de7={},_0x38f16b={},_0x10a5f9={'count':0x0,'rows':[]};var _0x1f0a96=_[_0x7c74('0x28')](db[_0x7c74('0x29')][_0x7c74('0x2a')],function(_0x44401a){return{'name':_0x44401a[_0x7c74('0x2b')],'type':_0x44401a[_0x7c74('0x2c')][_0x7c74('0x2d')]};});_0x38f16b[_0x7c74('0x2e')]=_[_0x7c74('0x28')](_0x1f0a96,_0x7c74('0x25'));_0x38f16b[_0x7c74('0x2f')]=_[_0x7c74('0x30')](_0x3e94c5[_0x7c74('0x2f')]);_0x38f16b['filters']=_['intersection'](_0x38f16b['model'],_0x38f16b[_0x7c74('0x2f')]);_0x721de7['attributes']=_['intersection'](_0x38f16b[_0x7c74('0x2e')],qs[_0x7c74('0x31')](_0x3e94c5[_0x7c74('0x2f')][_0x7c74('0x31')]));_0x721de7[_0x7c74('0x32')]=_0x721de7[_0x7c74('0x32')][_0x7c74('0x33')]?_0x721de7[_0x7c74('0x32')]:_0x38f16b[_0x7c74('0x2e')];if(!_0x3e94c5['query'][_0x7c74('0x34')](_0x7c74('0x35'))){_0x721de7[_0x7c74('0x36')]=qs[_0x7c74('0x36')](_0x3e94c5[_0x7c74('0x2f')][_0x7c74('0x36')]);_0x721de7[_0x7c74('0x18')]=qs[_0x7c74('0x18')](_0x3e94c5[_0x7c74('0x2f')]['offset']);}_0x721de7['order']=qs['sort'](_0x3e94c5['query']['sort']);_0x721de7[_0x7c74('0x37')]=qs[_0x7c74('0x38')](_['pick'](_0x3e94c5[_0x7c74('0x2f')],_0x38f16b['filters']),_0x1f0a96);if(_0x3e94c5[_0x7c74('0x2f')][_0x7c74('0x39')]){_0x721de7[_0x7c74('0x37')]=_[_0x7c74('0x3a')](_0x721de7[_0x7c74('0x37')],{'$or':_[_0x7c74('0x28')](_0x1f0a96,function(_0x54843a){if(_0x54843a[_0x7c74('0x2c')]!==_0x7c74('0x3b')){var _0x386053={};_0x386053[_0x54843a['name']]={'$like':'%'+_0x3e94c5[_0x7c74('0x2f')][_0x7c74('0x39')]+'%'};return _0x386053;}})});}_0x721de7=_[_0x7c74('0x3a')]({},_0x721de7,_0x3e94c5[_0x7c74('0x3c')]);var _0x3f407f={'where':_0x721de7[_0x7c74('0x37')]};return db['SquareOdbc']['count'](_0x3f407f)['then'](function(_0x413619){_0x10a5f9['count']=_0x413619;if(_0x3e94c5[_0x7c74('0x2f')][_0x7c74('0x3d')]){_0x721de7['include']=[{'all':!![]}];}return db[_0x7c74('0x29')][_0x7c74('0x3e')](_0x721de7);})[_0x7c74('0x1e')](function(_0xd4a02){_0x10a5f9[_0x7c74('0x3f')]=_0xd4a02;return _0x10a5f9;})[_0x7c74('0x1e')](respondWithFilteredResult(_0x136141,_0x721de7))['catch'](handleError(_0x136141,null));};exports['show']=function(_0x5eea83,_0xa29226){var _0x17e0f0={'raw':!![],'where':{'id':_0x5eea83[_0x7c74('0x40')]['id']}},_0x17d4d7={};_0x17d4d7[_0x7c74('0x2e')]=_['keys'](db[_0x7c74('0x29')][_0x7c74('0x2a')]);_0x17d4d7[_0x7c74('0x2f')]=_[_0x7c74('0x30')](_0x5eea83[_0x7c74('0x2f')]);_0x17d4d7[_0x7c74('0x38')]=_[_0x7c74('0x41')](_0x17d4d7[_0x7c74('0x2e')],_0x17d4d7[_0x7c74('0x2f')]);_0x17e0f0[_0x7c74('0x32')]=_[_0x7c74('0x41')](_0x17d4d7[_0x7c74('0x2e')],qs[_0x7c74('0x31')](_0x5eea83[_0x7c74('0x2f')][_0x7c74('0x31')]));_0x17e0f0[_0x7c74('0x32')]=_0x17e0f0['attributes'][_0x7c74('0x33')]?_0x17e0f0['attributes']:_0x17d4d7[_0x7c74('0x2e')];if(_0x5eea83[_0x7c74('0x2f')][_0x7c74('0x3d')]){_0x17e0f0[_0x7c74('0x42')]=[{'all':!![]}];}_0x17e0f0=_[_0x7c74('0x3a')]({},_0x17e0f0,_0x5eea83['options']);return db[_0x7c74('0x29')][_0x7c74('0x43')](_0x17e0f0)[_0x7c74('0x1e')](handleEntityNotFound(_0xa29226,null))[_0x7c74('0x1e')](respondWithResult(_0xa29226,null))[_0x7c74('0x44')](handleError(_0xa29226,null));};exports[_0x7c74('0x45')]=function(_0x1164ab,_0x46dc33){return db[_0x7c74('0x29')][_0x7c74('0x45')](_0x1164ab['body'],{})[_0x7c74('0x1e')](function(_0x32b6d4){var _0x3e1e22=_0x1164ab[_0x7c74('0x46')][_0x7c74('0x1f')]({'plain':!![]});if(!_0x3e1e22)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e1e22['role']==='user'){var _0x4ab6b1=_0x32b6d4['get']({'plain':!![]});var _0x2fbbf3=_0x7c74('0x47');return db[_0x7c74('0x48')]['find']({'where':{'name':_0x2fbbf3,'userProfileId':_0x3e1e22['userProfileId']},'raw':!![]})['then'](function(_0x1991f2){if(_0x1991f2&&_0x1991f2['autoAssociation']===0x0){return db['UserProfileResource'][_0x7c74('0x45')]({'name':_0x4ab6b1['name'],'resourceId':_0x4ab6b1['id'],'type':_0x1991f2['name'],'sectionId':_0x1991f2['id']},{})['then'](function(){return _0x32b6d4;});}else{return _0x32b6d4;}})[_0x7c74('0x44')](function(_0x102f6b){logger[_0x7c74('0x23')](_0x7c74('0x49'),_0x102f6b);throw _0x102f6b;});}return _0x32b6d4;})[_0x7c74('0x1e')](respondWithResult(_0x46dc33,0xc9))['catch'](handleError(_0x46dc33,null));};exports[_0x7c74('0x1d')]=function(_0xaf9365,_0x4da962){if(_0xaf9365['body']['id']){delete _0xaf9365[_0x7c74('0x4a')]['id'];}return db['SquareOdbc'][_0x7c74('0x43')]({'where':{'id':_0xaf9365[_0x7c74('0x40')]['id']}})[_0x7c74('0x1e')](handleEntityNotFound(_0x4da962,null))[_0x7c74('0x1e')](saveUpdates(_0xaf9365['body'],null))[_0x7c74('0x1e')](respondWithResult(_0x4da962,null))[_0x7c74('0x44')](handleError(_0x4da962,null));};exports[_0x7c74('0x4b')]=function(_0x539c41,_0x18ca8a){return db[_0x7c74('0x29')][_0x7c74('0x43')]({'where':{'id':_0x539c41[_0x7c74('0x40')]['id']}})[_0x7c74('0x1e')](handleEntityNotFound(_0x18ca8a,null))[_0x7c74('0x1e')](removeEntity(_0x18ca8a,null))[_0x7c74('0x44')](handleError(_0x18ca8a,null));};exports[_0x7c74('0x4c')]=function(_0x589cc6,_0x39b4cf,_0x538f83){var _0x1177f1;return db[_0x7c74('0x29')][_0x7c74('0x43')]({'where':{'id':_0x589cc6[_0x7c74('0x40')]['id']},'attributes':['id',_0x7c74('0x4d')]})[_0x7c74('0x1e')](handleEntityNotFound(_0x39b4cf,null))[_0x7c74('0x1e')](function(_0x100b8d){if(_0x100b8d){var _0x3d85ad=require(_0x7c74('0x4e'))();_0x3d85ad[_0x7c74('0x4f')](_0x100b8d[_0x7c74('0x4d')]);_0x3d85ad[_0x7c74('0x50')]();return _0x100b8d;}})['then'](respondWithResult(_0x39b4cf,null))[_0x7c74('0x44')](handleError(_0x39b4cf,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 51cab98..8af02f5 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 _0x8f83=['util','../../config/logger','api','moment','bluebird','path','./squareOdbc.attributes','define','SquareOdbc','square_odbc','lodash'];(function(_0x53d17e,_0xf979c9){var _0x35b0cc=function(_0x556323){while(--_0x556323){_0x53d17e['push'](_0x53d17e['shift']());}};_0x35b0cc(++_0xf979c9);}(_0x8f83,0x6d));var _0x38f8=function(_0x5cb43c,_0x2c1bb5){_0x5cb43c=_0x5cb43c-0x0;var _0x5fd1a=_0x8f83[_0x5cb43c];return _0x5fd1a;};'use strict';var _=require(_0x38f8('0x0'));var util=require(_0x38f8('0x1'));var logger=require(_0x38f8('0x2'))(_0x38f8('0x3'));var moment=require(_0x38f8('0x4'));var BPromise=require(_0x38f8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x38f8('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x38f8('0x7'));module['exports']=function(_0x261e58,_0x371c92){return _0x261e58[_0x38f8('0x8')](_0x38f8('0x9'),attributes,{'tableName':_0x38f8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6947=['./squareOdbc.attributes','exports','define','square_odbc','util','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x500f56,_0x1c06e4){var _0x9ea20=function(_0x35d63f){while(--_0x35d63f){_0x500f56['push'](_0x500f56['shift']());}};_0x9ea20(++_0x1c06e4);}(_0x6947,0x72));var _0x7694=function(_0x52468d,_0x160458){_0x52468d=_0x52468d-0x0;var _0xbafd7a=_0x6947[_0x52468d];return _0xbafd7a;};'use strict';var _=require('lodash');var util=require(_0x7694('0x0'));var logger=require('../../config/logger')(_0x7694('0x1'));var moment=require(_0x7694('0x2'));var BPromise=require(_0x7694('0x3'));var rp=require(_0x7694('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7694('0x5'));var attributes=require(_0x7694('0x6'));module[_0x7694('0x7')]=function(_0x5730,_0x36776b){return _0x5730[_0x7694('0x8')]('SquareOdbc',attributes,{'tableName':_0x7694('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 95751bb..75b28ee 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 _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(_0x58be0a,_0x3472a4){var _0x11bfa9=function(_0x12a475){while(--_0x12a475){_0x58be0a['push'](_0x58be0a['shift']());}};_0x11bfa9(++_0x3472a4);}(_0xe14b,0x93));var _0xbe14=function(_0x1cb3e7,_0x5af431){_0x1cb3e7=_0x1cb3e7-0x0;var _0x1daf37=_0xe14b[_0x1cb3e7];return _0x1daf37;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file +var _0x7217=['where','attributes','map','include','model','ShowSquareOdbc','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareOdbc','find','options','raw'];(function(_0x4114f5,_0xb3b0cc){var _0x5db3b5=function(_0x3bec59){while(--_0x3bec59){_0x4114f5['push'](_0x4114f5['shift']());}};_0x5db3b5(++_0xb3b0cc);}(_0x7217,0x19e));var _0x7721=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x7217[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowSquareOdbc']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowSquareOdbc',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 3751bf6..1758ed6 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 _0xd74a=['create','delete','destroy','removeUsers','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/users','post'];(function(_0x2a3bad,_0x227f4e){var _0x4bd6ea=function(_0x2968e5){while(--_0x2968e5){_0x2a3bad['push'](_0x2a3bad['shift']());}};_0x4bd6ea(++_0x227f4e);}(_0xd74a,0x8d));var _0xad74=function(_0x2fab63,_0x6fad7){_0x2fab63=_0x2fab63-0x0;var _0x3c0e3e=_0xd74a[_0x2fab63];return _0x3c0e3e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xad74('0x0'));var timeout=require('connect-timeout');var express=require(_0xad74('0x1'));var router=express[_0xad74('0x2')]();var auth=require(_0xad74('0x3'));var interaction=require(_0xad74('0x4'));var config=require('../../config/environment');var controller=require('./squareProject.controller');router[_0xad74('0x5')]('/',auth['isAuthenticated'](),controller[_0xad74('0x6')]);router['get'](_0xad74('0x7'),auth[_0xad74('0x8')](),controller[_0xad74('0x9')]);router[_0xad74('0x5')](_0xad74('0xa'),auth[_0xad74('0x8')](),controller['getUsers']);router[_0xad74('0xb')]('/',auth[_0xad74('0x8')](),controller[_0xad74('0xc')]);router[_0xad74('0xb')](_0xad74('0xa'),auth[_0xad74('0x8')](),controller['addUsers']);router['put'](_0xad74('0x7'),auth['isAuthenticated'](),controller['update']);router[_0xad74('0xd')](_0xad74('0x7'),auth[_0xad74('0x8')](),controller[_0xad74('0xe')]);router['delete'](_0xad74('0xa'),auth[_0xad74('0x8')](),controller[_0xad74('0xf')]);module[_0xad74('0x10')]=router; \ No newline at end of file +var _0x132e=['update','delete','destroy','removeUsers','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','getUsers','post','isAuthenticated','create','/:id/users','addUsers','put'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x132e,0x17a));var _0xe132=function(_0x4bdf64,_0x3022b2){_0x4bdf64=_0x4bdf64-0x0;var _0x9a1a19=_0x132e[_0x4bdf64];return _0x9a1a19;};'use strict';var multer=require('multer');var util=require(_0xe132('0x0'));var path=require('path');var timeout=require(_0xe132('0x1'));var express=require(_0xe132('0x2'));var router=express[_0xe132('0x3')]();var auth=require(_0xe132('0x4'));var interaction=require(_0xe132('0x5'));var config=require(_0xe132('0x6'));var controller=require('./squareProject.controller');router[_0xe132('0x7')]('/',auth['isAuthenticated'](),controller[_0xe132('0x8')]);router['get'](_0xe132('0x9'),auth['isAuthenticated'](),controller[_0xe132('0xa')]);router[_0xe132('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0xe132('0xb')]);router[_0xe132('0xc')]('/',auth[_0xe132('0xd')](),controller[_0xe132('0xe')]);router[_0xe132('0xc')](_0xe132('0xf'),auth['isAuthenticated'](),controller[_0xe132('0x10')]);router[_0xe132('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xe132('0x12')]);router[_0xe132('0x13')]('/:id',auth[_0xe132('0xd')](),controller[_0xe132('0x14')]);router[_0xe132('0x13')](_0xe132('0xf'),auth[_0xe132('0xd')](),controller[_0xe132('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index c173d1c..9bb6972 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 _0x0b0a=['getDataValue','preproduction','toString','production','utf8','DATE','sequelize','name','STRING','TEXT','BLOB','long'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0b0a,0x156));var _0xa0b0=function(_0x156a97,_0x2edddd){_0x156a97=_0x156a97-0x0;var _0xf92a71=_0x0b0a[_0x156a97];return _0xf92a71;};'use strict';var Sequelize=require(_0xa0b0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xa0b0('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xa0b0('0x2')]},'notes':{'type':Sequelize[_0xa0b0('0x3')]},'preproduction':{'type':Sequelize[_0xa0b0('0x4')](_0xa0b0('0x5')),'get':function(){if(this[_0xa0b0('0x6')]('preproduction')){return this[_0xa0b0('0x6')](_0xa0b0('0x7'))[_0xa0b0('0x8')]('utf8');}}},'production':{'type':Sequelize[_0xa0b0('0x4')](_0xa0b0('0x5')),'get':function(){if(this['getDataValue'](_0xa0b0('0x9'))){return this[_0xa0b0('0x6')](_0xa0b0('0x9'))[_0xa0b0('0x8')](_0xa0b0('0xa'));}}},'savedAt':{'type':Sequelize[_0xa0b0('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xd4bb=['exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd4bb,0x144));var _0xbd4b=function(_0x485ee0,_0x2d7c02){_0x485ee0=_0x485ee0-0x0;var _0x19583e=_0xd4bb[_0x485ee0];return _0x19583e;};'use strict';var Sequelize=require(_0xbd4b('0x0'));module[_0xbd4b('0x1')]={'name':{'type':Sequelize[_0xbd4b('0x2')],'unique':_0xbd4b('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xbd4b('0x4')]},'preproduction':{'type':Sequelize[_0xbd4b('0x5')](_0xbd4b('0x6')),'get':function(){if(this[_0xbd4b('0x7')](_0xbd4b('0x8'))){return this['getDataValue'](_0xbd4b('0x8'))[_0xbd4b('0x9')](_0xbd4b('0xa'));}}},'production':{'type':Sequelize[_0xbd4b('0x5')](_0xbd4b('0x6')),'get':function(){if(this[_0xbd4b('0x7')](_0xbd4b('0xb'))){return this[_0xbd4b('0x7')](_0xbd4b('0xb'))[_0xbd4b('0x9')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xbd4b('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 23e7466..b894e81 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 _0xf2ae=['userSquareProject:remove','findOne','User','keys','getUsers','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','SquareProject','rows','catch','params','includeAll','include','options','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','addUsers','omit','ids','removeUsers','isArray','emit'];(function(_0x174bfa,_0x290c26){var _0x522f9b=function(_0x15a952){while(--_0x15a952){_0x174bfa['push'](_0x174bfa['shift']());}};_0x522f9b(++_0x290c26);}(_0xf2ae,0x69));var _0xef2a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xf2ae[_0x51020b];return _0x371e47;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xef2a('0x0'));var rimraf=require(_0xef2a('0x1'));var zipdir=require(_0xef2a('0x2'));var jsonpatch=require(_0xef2a('0x3'));var rp=require(_0xef2a('0x4'));var moment=require(_0xef2a('0x5'));var BPromise=require(_0xef2a('0x6'));var Mustache=require(_0xef2a('0x7'));var util=require(_0xef2a('0x8'));var path=require(_0xef2a('0x9'));var sox=require(_0xef2a('0xa'));var csv=require(_0xef2a('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xef2a('0xc'));var crypto=require(_0xef2a('0xd'));var jsforce=require(_0xef2a('0xe'));var deskjs=require(_0xef2a('0xf'));var toCsv=require(_0xef2a('0xb'));var querystring=require(_0xef2a('0x10'));var Papa=require(_0xef2a('0x11'));var Redis=require(_0xef2a('0x12'));var authService=require(_0xef2a('0x13'));var qs=require(_0xef2a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xef2a('0x15'))(_0xef2a('0x16'));var utils=require(_0xef2a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xef2a('0x18'));var db=require(_0xef2a('0x19'))['db'];config[_0xef2a('0x1a')]=_[_0xef2a('0x1b')](config[_0xef2a('0x1a')],{'host':_0xef2a('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xef2a('0x1a')]));require(_0xef2a('0x1d'))[_0xef2a('0x1e')](socket);function respondWithStatusCode(_0x37eef8,_0xd02647){_0xd02647=_0xd02647||0xcc;return function(_0x20c364){if(_0x20c364){return _0x37eef8[_0xef2a('0x1f')](_0xd02647);}return _0x37eef8['status'](_0xd02647)[_0xef2a('0x20')]();};}function respondWithResult(_0x427f5b,_0x3f1973){_0x3f1973=_0x3f1973||0xc8;return function(_0x5d2808){if(_0x5d2808){return _0x427f5b[_0xef2a('0x21')](_0x3f1973)[_0xef2a('0x22')](_0x5d2808);}};}function respondWithFilteredResult(_0xcacaef,_0x3318c9){return function(_0x2b7726){if(_0x2b7726){var _0x39525c=_0x2b7726[_0xef2a('0x23')],_0x5bfb07=_0x3318c9[_0xef2a('0x24')],_0x8e3e33=_0x3318c9['offset']+_0x3318c9[_0xef2a('0x25')],_0x167856;if(_0x8e3e33>=_0x39525c){_0x8e3e33=_0x39525c;_0x167856=0xc8;}else{_0x167856=0xce;}_0xcacaef[_0xef2a('0x21')](_0x167856);return _0xcacaef[_0xef2a('0x26')]('Content-Range',_0x5bfb07+'-'+_0x8e3e33+'/'+_0x39525c)[_0xef2a('0x22')](_0x2b7726);}return null;};}function patchUpdates(_0x3d957a){return function(_0x4a58fe){try{jsonpatch[_0xef2a('0x27')](_0x4a58fe,_0x3d957a,!![]);}catch(_0x199f8b){return BPromise[_0xef2a('0x28')](_0x199f8b);}return _0x4a58fe[_0xef2a('0x29')]();};}function saveUpdates(_0x48d774,_0x5297a9){return function(_0x40c26e){if(_0x40c26e){return _0x40c26e[_0xef2a('0x2a')](_0x48d774)[_0xef2a('0x2b')](function(_0x10013c){return _0x10013c;});}return null;};}function removeEntity(_0x4deb13,_0x3b42a2){return function(_0x4e6e2c){if(_0x4e6e2c){return _0x4e6e2c[_0xef2a('0x2c')]()[_0xef2a('0x2b')](function(){var _0x5762aa=_0x4e6e2c[_0xef2a('0x2d')]({'plain':!![]});var _0x179b42=_0xef2a('0x2e');return db[_0xef2a('0x2f')]['destroy']({'where':{'type':_0x179b42,'resourceId':_0x5762aa['id']}})['then'](function(){return _0x4e6e2c;});})['then'](function(){_0x4deb13[_0xef2a('0x21')](0xcc)[_0xef2a('0x20')]();});}};}function handleEntityNotFound(_0x114054,_0x17fb02){return function(_0x1872f3){if(!_0x1872f3){_0x114054[_0xef2a('0x1f')](0x194);}return _0x1872f3;};}function handleError(_0x6dc065,_0x1143bc){_0x1143bc=_0x1143bc||0x1f4;return function(_0x547bd4){logger[_0xef2a('0x30')](_0x547bd4[_0xef2a('0x31')]);if(_0x547bd4[_0xef2a('0x32')]){delete _0x547bd4['name'];}_0x6dc065['status'](_0x1143bc)[_0xef2a('0x33')](_0x547bd4);};}exports['index']=function(_0x171bfd,_0x3fbd3e){var _0x455453={},_0x5e7d60={},_0x24de2e={'count':0x0,'rows':[]};var _0x1dd7c5=_[_0xef2a('0x34')](db['SquareProject'][_0xef2a('0x35')],function(_0x27511b){return{'name':_0x27511b['fieldName'],'type':_0x27511b[_0xef2a('0x36')][_0xef2a('0x37')]};});_0x5e7d60[_0xef2a('0x38')]=_[_0xef2a('0x34')](_0x1dd7c5,_0xef2a('0x32'));_0x5e7d60[_0xef2a('0x39')]=_['keys'](_0x171bfd[_0xef2a('0x39')]);_0x5e7d60[_0xef2a('0x3a')]=_[_0xef2a('0x3b')](_0x5e7d60[_0xef2a('0x38')],_0x5e7d60[_0xef2a('0x39')]);_0x455453[_0xef2a('0x3c')]=_[_0xef2a('0x3b')](_0x5e7d60[_0xef2a('0x38')],qs[_0xef2a('0x3d')](_0x171bfd['query'][_0xef2a('0x3d')]));_0x455453[_0xef2a('0x3c')]=_0x455453[_0xef2a('0x3c')][_0xef2a('0x3e')]?_0x455453['attributes']:_0x5e7d60[_0xef2a('0x38')];if(!_0x171bfd['query'][_0xef2a('0x3f')](_0xef2a('0x40'))){_0x455453[_0xef2a('0x25')]=qs['limit'](_0x171bfd[_0xef2a('0x39')]['limit']);_0x455453[_0xef2a('0x24')]=qs[_0xef2a('0x24')](_0x171bfd[_0xef2a('0x39')][_0xef2a('0x24')]);}_0x455453[_0xef2a('0x41')]=qs[_0xef2a('0x42')](_0x171bfd[_0xef2a('0x39')][_0xef2a('0x42')]);_0x455453['where']=qs['filters'](_[_0xef2a('0x43')](_0x171bfd[_0xef2a('0x39')],_0x5e7d60[_0xef2a('0x3a')]),_0x1dd7c5);if(_0x171bfd[_0xef2a('0x39')][_0xef2a('0x44')]){_0x455453[_0xef2a('0x45')]=_[_0xef2a('0x46')](_0x455453['where'],{'$or':_[_0xef2a('0x34')](_0x1dd7c5,function(_0x3a0a46){if(_0x3a0a46[_0xef2a('0x36')]!==_0xef2a('0x47')){var _0x144050={};_0x144050[_0x3a0a46['name']]={'$like':'%'+_0x171bfd['query'][_0xef2a('0x44')]+'%'};return _0x144050;}})});}_0x455453=_['merge']({},_0x455453,_0x171bfd['options']);var _0x4e5c9d={'where':_0x455453[_0xef2a('0x45')]};return db[_0xef2a('0x48')][_0xef2a('0x23')](_0x4e5c9d)[_0xef2a('0x2b')](function(_0x72320a){_0x24de2e['count']=_0x72320a;if(_0x171bfd[_0xef2a('0x39')]['includeAll']){_0x455453['include']=[{'all':!![]}];}return db[_0xef2a('0x48')]['findAll'](_0x455453);})[_0xef2a('0x2b')](function(_0xcfc4df){_0x24de2e[_0xef2a('0x49')]=_0xcfc4df;return _0x24de2e;})[_0xef2a('0x2b')](respondWithFilteredResult(_0x3fbd3e,_0x455453))[_0xef2a('0x4a')](handleError(_0x3fbd3e,null));};exports['show']=function(_0x36b89c,_0x276da7){var _0x3a7f79={'raw':![],'where':{'id':_0x36b89c[_0xef2a('0x4b')]['id']}},_0x2cb575={};_0x2cb575[_0xef2a('0x38')]=_['keys'](db[_0xef2a('0x48')][_0xef2a('0x35')]);_0x2cb575[_0xef2a('0x39')]=_['keys'](_0x36b89c['query']);_0x2cb575[_0xef2a('0x3a')]=_[_0xef2a('0x3b')](_0x2cb575['model'],_0x2cb575[_0xef2a('0x39')]);_0x3a7f79[_0xef2a('0x3c')]=_[_0xef2a('0x3b')](_0x2cb575[_0xef2a('0x38')],qs[_0xef2a('0x3d')](_0x36b89c[_0xef2a('0x39')]['fields']));_0x3a7f79[_0xef2a('0x3c')]=_0x3a7f79[_0xef2a('0x3c')]['length']?_0x3a7f79[_0xef2a('0x3c')]:_0x2cb575[_0xef2a('0x38')];if(_0x36b89c[_0xef2a('0x39')][_0xef2a('0x4c')]){_0x3a7f79[_0xef2a('0x4d')]=[{'all':!![]}];}_0x3a7f79=_[_0xef2a('0x46')]({},_0x3a7f79,_0x36b89c[_0xef2a('0x4e')]);return db[_0xef2a('0x48')][_0xef2a('0x4f')](_0x3a7f79)[_0xef2a('0x2b')](handleEntityNotFound(_0x276da7,null))[_0xef2a('0x2b')](respondWithResult(_0x276da7,null))[_0xef2a('0x4a')](handleError(_0x276da7,null));};exports[_0xef2a('0x50')]=function(_0x521f3f,_0x1486b9){return db[_0xef2a('0x48')][_0xef2a('0x50')](_0x521f3f[_0xef2a('0x51')],{})[_0xef2a('0x2b')](function(_0x8ebc3d){var _0x44be13=_0x521f3f[_0xef2a('0x52')][_0xef2a('0x2d')]({'plain':!![]});if(!_0x44be13)throw new Error(_0xef2a('0x53'));if(_0x44be13[_0xef2a('0x54')]===_0xef2a('0x52')){var _0xf5dbc2=_0x8ebc3d[_0xef2a('0x2d')]({'plain':!![]});var _0x317e67=_0xef2a('0x2e');return db[_0xef2a('0x55')][_0xef2a('0x4f')]({'where':{'name':_0x317e67,'userProfileId':_0x44be13[_0xef2a('0x56')]},'raw':!![]})[_0xef2a('0x2b')](function(_0xd61c09){if(_0xd61c09&&_0xd61c09[_0xef2a('0x57')]===0x0){return db[_0xef2a('0x2f')][_0xef2a('0x50')]({'name':_0xf5dbc2[_0xef2a('0x32')],'resourceId':_0xf5dbc2['id'],'type':_0xd61c09[_0xef2a('0x32')],'sectionId':_0xd61c09['id']},{})[_0xef2a('0x2b')](function(){return _0x8ebc3d;});}else{return _0x8ebc3d;}})[_0xef2a('0x4a')](function(_0x103e5e){logger[_0xef2a('0x30')](_0xef2a('0x58'),_0x103e5e);throw _0x103e5e;});}return _0x8ebc3d;})[_0xef2a('0x2b')](respondWithResult(_0x1486b9,0xc9))[_0xef2a('0x4a')](handleError(_0x1486b9,null));};exports[_0xef2a('0x2a')]=function(_0x1c1c0e,_0x30017d){if(_0x1c1c0e[_0xef2a('0x51')]['id']){delete _0x1c1c0e[_0xef2a('0x51')]['id'];}return db[_0xef2a('0x48')][_0xef2a('0x4f')]({'where':{'id':_0x1c1c0e[_0xef2a('0x4b')]['id']}})[_0xef2a('0x2b')](handleEntityNotFound(_0x30017d,null))[_0xef2a('0x2b')](saveUpdates(_0x1c1c0e[_0xef2a('0x51')],null))[_0xef2a('0x2b')](respondWithResult(_0x30017d,null))[_0xef2a('0x4a')](handleError(_0x30017d,null));};exports['destroy']=function(_0x35e8e5,_0x415bc4){return db['SquareProject'][_0xef2a('0x4f')]({'where':{'id':_0x35e8e5['params']['id']}})[_0xef2a('0x2b')](handleEntityNotFound(_0x415bc4,null))[_0xef2a('0x2b')](removeEntity(_0x415bc4,null))[_0xef2a('0x4a')](handleError(_0x415bc4,null));};exports[_0xef2a('0x59')]=function(_0x2ab0dc,_0x1ea61a,_0x3a2584){return db['SquareProject'][_0xef2a('0x4f')]({'where':{'id':_0x2ab0dc['params']['id']}})[_0xef2a('0x2b')](handleEntityNotFound(_0x1ea61a,null))['then'](function(_0xbcdac9){if(_0xbcdac9){return _0xbcdac9['addUsers'](_0x2ab0dc[_0xef2a('0x51')]['ids'],_[_0xef2a('0x5a')](_0x2ab0dc[_0xef2a('0x51')],[_0xef2a('0x5b'),'id'])||{});}})[_0xef2a('0x2b')](respondWithResult(_0x1ea61a,null))[_0xef2a('0x4a')](handleError(_0x1ea61a,null));};exports[_0xef2a('0x5c')]=function(_0x179f15,_0x2bf480,_0x409ab6){return db[_0xef2a('0x48')][_0xef2a('0x4f')]({'where':{'id':_0x179f15[_0xef2a('0x4b')]['id']}})[_0xef2a('0x2b')](handleEntityNotFound(_0x2bf480,null))[_0xef2a('0x2b')](function(_0x5d23db){if(_0x5d23db){return _0x5d23db[_0xef2a('0x5c')](_0x179f15['query'][_0xef2a('0x5b')])[_0xef2a('0x2b')](function(){if(_[_0xef2a('0x5d')](_0x179f15[_0xef2a('0x39')][_0xef2a('0x5b')])){for(var _0x241c21=0x0;_0x241c21<_0x179f15[_0xef2a('0x39')][_0xef2a('0x5b')][_0xef2a('0x3e')];_0x241c21+=0x1){socket[_0xef2a('0x5e')](_0xef2a('0x5f'),{'UserId':Number(_0x179f15[_0xef2a('0x39')][_0xef2a('0x5b')][_0x241c21]),'SquareProjectId':Number(_0x179f15[_0xef2a('0x4b')]['id'])});}}else{socket['emit'](_0xef2a('0x5f'),{'UserId':Number(_0x179f15['query'][_0xef2a('0x5b')]),'SquareProjectId':Number(_0x179f15[_0xef2a('0x4b')]['id'])});}});}})[_0xef2a('0x2b')](respondWithStatusCode(_0x2bf480,null))[_0xef2a('0x4a')](handleError(_0x2bf480,null));};exports['getUsers']=function(_0x40ce82,_0x51545c,_0x5e81d0){var _0xb70a3f={};var _0x6cfbd4={};var _0x21ac91;var _0x53fb73;return db[_0xef2a('0x48')][_0xef2a('0x60')]({'where':{'id':_0x40ce82[_0xef2a('0x4b')]['id']}})[_0xef2a('0x2b')](handleEntityNotFound(_0x51545c,null))[_0xef2a('0x2b')](function(_0x5a7c61){if(_0x5a7c61){_0x21ac91=_0x5a7c61;_0x6cfbd4[_0xef2a('0x38')]=_['keys'](db[_0xef2a('0x61')][_0xef2a('0x35')]);_0x6cfbd4[_0xef2a('0x39')]=_[_0xef2a('0x62')](_0x40ce82['query']);_0x6cfbd4[_0xef2a('0x3a')]=_['intersection'](_0x6cfbd4['model'],_0x6cfbd4[_0xef2a('0x39')]);_0xb70a3f['attributes']=_[_0xef2a('0x3b')](_0x6cfbd4[_0xef2a('0x38')],qs[_0xef2a('0x3d')](_0x40ce82['query'][_0xef2a('0x3d')]));_0xb70a3f['attributes']=_0xb70a3f[_0xef2a('0x3c')]['length']?_0xb70a3f[_0xef2a('0x3c')]:_0x6cfbd4['model'];_0xb70a3f[_0xef2a('0x41')]=qs[_0xef2a('0x42')](_0x40ce82[_0xef2a('0x39')]['sort']);_0xb70a3f[_0xef2a('0x45')]=qs[_0xef2a('0x3a')](_['pick'](_0x40ce82[_0xef2a('0x39')],_0x6cfbd4[_0xef2a('0x3a')]));if(_0x40ce82[_0xef2a('0x39')][_0xef2a('0x44')]){_0xb70a3f['where']=_[_0xef2a('0x46')](_0xb70a3f[_0xef2a('0x45')],{'$or':_[_0xef2a('0x34')](_0xb70a3f[_0xef2a('0x3c')],function(_0x3da754){var _0x9b41c0={};_0x9b41c0[_0x3da754]={'$like':'%'+_0x40ce82[_0xef2a('0x39')]['filter']+'%'};return _0x9b41c0;})});}_0xb70a3f=_['merge']({},_0xb70a3f,_0x40ce82[_0xef2a('0x4e')]);return _0x21ac91[_0xef2a('0x63')](_0xb70a3f);}})[_0xef2a('0x2b')](function(_0x461fb9){if(_0x461fb9){_0x53fb73=_0x461fb9[_0xef2a('0x3e')];if(!_0x40ce82[_0xef2a('0x39')]['hasOwnProperty'](_0xef2a('0x40'))){_0xb70a3f[_0xef2a('0x25')]=qs[_0xef2a('0x25')](_0x40ce82[_0xef2a('0x39')]['limit']);_0xb70a3f[_0xef2a('0x24')]=qs[_0xef2a('0x24')](_0x40ce82[_0xef2a('0x39')][_0xef2a('0x24')]);}return _0x21ac91[_0xef2a('0x63')](_0xb70a3f);}})[_0xef2a('0x2b')](function(_0x4432bc){if(_0x4432bc){return _0x4432bc?{'count':_0x53fb73,'rows':_0x4432bc}:null;}})[_0xef2a('0x2b')](respondWithResult(_0x51545c,null))['catch'](handleError(_0x51545c,null));}; \ No newline at end of file +var _0x3d3f=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','role','userProfileId','autoAssociation','error','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','nolimit','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','to-csv','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','get','SquareProjects','UserProfileResource','sendStatus','name','send','index','map','SquareProject'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x3d3f,0x80));var _0xf3d3=function(_0x262548,_0x15dc38){_0x262548=_0x262548-0x0;var _0x4d16aa=_0x3d3f[_0x262548];return _0x4d16aa;};'use strict';var pdf=require(_0xf3d3('0x0'));var emlformat=require(_0xf3d3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf3d3('0x2'));var jsonpatch=require(_0xf3d3('0x3'));var rp=require(_0xf3d3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf3d3('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf3d3('0x6'));var squel=require('squel');var crypto=require(_0xf3d3('0x7'));var jsforce=require(_0xf3d3('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf3d3('0x9'));var Redis=require(_0xf3d3('0xa'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf3d3('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3d3('0xc'))(_0xf3d3('0xd'));var utils=require('../../config/utils');var config=require(_0xf3d3('0xe'));var licenseUtil=require(_0xf3d3('0xf'));var db=require(_0xf3d3('0x10'))['db'];config[_0xf3d3('0x11')]=_[_0xf3d3('0x12')](config[_0xf3d3('0x11')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./squareProject.socket')['register'](socket);function respondWithStatusCode(_0x343b51,_0x1b9161){_0x1b9161=_0x1b9161||0xcc;return function(_0x4d0b29){if(_0x4d0b29){return _0x343b51['sendStatus'](_0x1b9161);}return _0x343b51[_0xf3d3('0x13')](_0x1b9161)[_0xf3d3('0x14')]();};}function respondWithResult(_0x28dbae,_0x1952ce){_0x1952ce=_0x1952ce||0xc8;return function(_0x2538b9){if(_0x2538b9){return _0x28dbae[_0xf3d3('0x13')](_0x1952ce)[_0xf3d3('0x15')](_0x2538b9);}};}function respondWithFilteredResult(_0x42b165,_0x27a549){return function(_0x25824d){if(_0x25824d){var _0x5951c9=_0x25824d[_0xf3d3('0x16')],_0x4f5646=_0x27a549[_0xf3d3('0x17')],_0x49443c=_0x27a549['offset']+_0x27a549[_0xf3d3('0x18')],_0x46cfb6;if(_0x49443c>=_0x5951c9){_0x49443c=_0x5951c9;_0x46cfb6=0xc8;}else{_0x46cfb6=0xce;}_0x42b165['status'](_0x46cfb6);return _0x42b165[_0xf3d3('0x19')]('Content-Range',_0x4f5646+'-'+_0x49443c+'/'+_0x5951c9)[_0xf3d3('0x15')](_0x25824d);}return null;};}function patchUpdates(_0x27f5c6){return function(_0x1efe4d){try{jsonpatch[_0xf3d3('0x1a')](_0x1efe4d,_0x27f5c6,!![]);}catch(_0x3d1bcf){return BPromise[_0xf3d3('0x1b')](_0x3d1bcf);}return _0x1efe4d['save']();};}function saveUpdates(_0xf1a284,_0x350609){return function(_0x5c0a03){if(_0x5c0a03){return _0x5c0a03[_0xf3d3('0x1c')](_0xf1a284)[_0xf3d3('0x1d')](function(_0x573fb6){return _0x573fb6;});}return null;};}function removeEntity(_0x58b673,_0x817036){return function(_0x242f0b){if(_0x242f0b){return _0x242f0b[_0xf3d3('0x1e')]()[_0xf3d3('0x1d')](function(){var _0x13a4fd=_0x242f0b[_0xf3d3('0x1f')]({'plain':!![]});var _0x1d75db=_0xf3d3('0x20');return db[_0xf3d3('0x21')][_0xf3d3('0x1e')]({'where':{'type':_0x1d75db,'resourceId':_0x13a4fd['id']}})[_0xf3d3('0x1d')](function(){return _0x242f0b;});})[_0xf3d3('0x1d')](function(){_0x58b673['status'](0xcc)[_0xf3d3('0x14')]();});}};}function handleEntityNotFound(_0x7ce89d,_0x5f16e3){return function(_0x147599){if(!_0x147599){_0x7ce89d[_0xf3d3('0x22')](0x194);}return _0x147599;};}function handleError(_0x19f5d8,_0x1a871d){_0x1a871d=_0x1a871d||0x1f4;return function(_0x3cdd29){logger['error'](_0x3cdd29['stack']);if(_0x3cdd29['name']){delete _0x3cdd29[_0xf3d3('0x23')];}_0x19f5d8[_0xf3d3('0x13')](_0x1a871d)[_0xf3d3('0x24')](_0x3cdd29);};}exports[_0xf3d3('0x25')]=function(_0x47511d,_0x668a1a){var _0x16af4b={},_0x267bf9={},_0x93a372={'count':0x0,'rows':[]};var _0x1141f4=_[_0xf3d3('0x26')](db[_0xf3d3('0x27')][_0xf3d3('0x28')],function(_0x2eb414){return{'name':_0x2eb414[_0xf3d3('0x29')],'type':_0x2eb414[_0xf3d3('0x2a')][_0xf3d3('0x2b')]};});_0x267bf9[_0xf3d3('0x2c')]=_['map'](_0x1141f4,_0xf3d3('0x23'));_0x267bf9[_0xf3d3('0x2d')]=_[_0xf3d3('0x2e')](_0x47511d[_0xf3d3('0x2d')]);_0x267bf9[_0xf3d3('0x2f')]=_[_0xf3d3('0x30')](_0x267bf9[_0xf3d3('0x2c')],_0x267bf9[_0xf3d3('0x2d')]);_0x16af4b[_0xf3d3('0x31')]=_[_0xf3d3('0x30')](_0x267bf9['model'],qs[_0xf3d3('0x32')](_0x47511d[_0xf3d3('0x2d')][_0xf3d3('0x32')]));_0x16af4b[_0xf3d3('0x31')]=_0x16af4b[_0xf3d3('0x31')][_0xf3d3('0x33')]?_0x16af4b[_0xf3d3('0x31')]:_0x267bf9[_0xf3d3('0x2c')];if(!_0x47511d['query'][_0xf3d3('0x34')]('nolimit')){_0x16af4b['limit']=qs[_0xf3d3('0x18')](_0x47511d[_0xf3d3('0x2d')][_0xf3d3('0x18')]);_0x16af4b[_0xf3d3('0x17')]=qs[_0xf3d3('0x17')](_0x47511d[_0xf3d3('0x2d')]['offset']);}_0x16af4b[_0xf3d3('0x35')]=qs[_0xf3d3('0x36')](_0x47511d[_0xf3d3('0x2d')]['sort']);_0x16af4b[_0xf3d3('0x37')]=qs[_0xf3d3('0x2f')](_[_0xf3d3('0x38')](_0x47511d[_0xf3d3('0x2d')],_0x267bf9[_0xf3d3('0x2f')]),_0x1141f4);if(_0x47511d[_0xf3d3('0x2d')][_0xf3d3('0x39')]){_0x16af4b[_0xf3d3('0x37')]=_['merge'](_0x16af4b[_0xf3d3('0x37')],{'$or':_[_0xf3d3('0x26')](_0x1141f4,function(_0xa7e271){if(_0xa7e271[_0xf3d3('0x2a')]!=='VIRTUAL'){var _0x2686f8={};_0x2686f8[_0xa7e271[_0xf3d3('0x23')]]={'$like':'%'+_0x47511d[_0xf3d3('0x2d')][_0xf3d3('0x39')]+'%'};return _0x2686f8;}})});}_0x16af4b=_[_0xf3d3('0x3a')]({},_0x16af4b,_0x47511d[_0xf3d3('0x3b')]);var _0x47db61={'where':_0x16af4b[_0xf3d3('0x37')]};return db['SquareProject'][_0xf3d3('0x16')](_0x47db61)[_0xf3d3('0x1d')](function(_0x374710){_0x93a372[_0xf3d3('0x16')]=_0x374710;if(_0x47511d[_0xf3d3('0x2d')][_0xf3d3('0x3c')]){_0x16af4b['include']=[{'all':!![]}];}return db[_0xf3d3('0x27')][_0xf3d3('0x3d')](_0x16af4b);})[_0xf3d3('0x1d')](function(_0x554f62){_0x93a372[_0xf3d3('0x3e')]=_0x554f62;return _0x93a372;})[_0xf3d3('0x1d')](respondWithFilteredResult(_0x668a1a,_0x16af4b))[_0xf3d3('0x3f')](handleError(_0x668a1a,null));};exports[_0xf3d3('0x40')]=function(_0x3d1008,_0x2758ad){var _0x5aa371={'raw':![],'where':{'id':_0x3d1008[_0xf3d3('0x41')]['id']}},_0x3ff9a6={};_0x3ff9a6[_0xf3d3('0x2c')]=_[_0xf3d3('0x2e')](db[_0xf3d3('0x27')][_0xf3d3('0x28')]);_0x3ff9a6[_0xf3d3('0x2d')]=_[_0xf3d3('0x2e')](_0x3d1008[_0xf3d3('0x2d')]);_0x3ff9a6[_0xf3d3('0x2f')]=_[_0xf3d3('0x30')](_0x3ff9a6['model'],_0x3ff9a6[_0xf3d3('0x2d')]);_0x5aa371[_0xf3d3('0x31')]=_['intersection'](_0x3ff9a6[_0xf3d3('0x2c')],qs['fields'](_0x3d1008[_0xf3d3('0x2d')][_0xf3d3('0x32')]));_0x5aa371[_0xf3d3('0x31')]=_0x5aa371[_0xf3d3('0x31')][_0xf3d3('0x33')]?_0x5aa371['attributes']:_0x3ff9a6[_0xf3d3('0x2c')];if(_0x3d1008[_0xf3d3('0x2d')]['includeAll']){_0x5aa371[_0xf3d3('0x42')]=[{'all':!![]}];}_0x5aa371=_[_0xf3d3('0x3a')]({},_0x5aa371,_0x3d1008[_0xf3d3('0x3b')]);return db[_0xf3d3('0x27')][_0xf3d3('0x43')](_0x5aa371)[_0xf3d3('0x1d')](handleEntityNotFound(_0x2758ad,null))[_0xf3d3('0x1d')](respondWithResult(_0x2758ad,null))[_0xf3d3('0x3f')](handleError(_0x2758ad,null));};exports[_0xf3d3('0x44')]=function(_0x237de4,_0x58141d){return db['SquareProject'][_0xf3d3('0x44')](_0x237de4[_0xf3d3('0x45')],{})[_0xf3d3('0x1d')](function(_0x25a064){var _0x14c071=_0x237de4['user'][_0xf3d3('0x1f')]({'plain':!![]});if(!_0x14c071)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14c071[_0xf3d3('0x46')]==='user'){var _0x4fd8a1=_0x25a064['get']({'plain':!![]});var _0xa39ef0=_0xf3d3('0x20');return db['UserProfileSection'][_0xf3d3('0x43')]({'where':{'name':_0xa39ef0,'userProfileId':_0x14c071[_0xf3d3('0x47')]},'raw':!![]})[_0xf3d3('0x1d')](function(_0x3737d5){if(_0x3737d5&&_0x3737d5[_0xf3d3('0x48')]===0x0){return db[_0xf3d3('0x21')][_0xf3d3('0x44')]({'name':_0x4fd8a1['name'],'resourceId':_0x4fd8a1['id'],'type':_0x3737d5[_0xf3d3('0x23')],'sectionId':_0x3737d5['id']},{})[_0xf3d3('0x1d')](function(){return _0x25a064;});}else{return _0x25a064;}})[_0xf3d3('0x3f')](function(_0x8d4cf5){logger[_0xf3d3('0x49')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8d4cf5);throw _0x8d4cf5;});}return _0x25a064;})[_0xf3d3('0x1d')](respondWithResult(_0x58141d,0xc9))[_0xf3d3('0x3f')](handleError(_0x58141d,null));};exports[_0xf3d3('0x1c')]=function(_0xe79310,_0x5642b7){if(_0xe79310[_0xf3d3('0x45')]['id']){delete _0xe79310['body']['id'];}return db[_0xf3d3('0x27')][_0xf3d3('0x43')]({'where':{'id':_0xe79310[_0xf3d3('0x41')]['id']}})[_0xf3d3('0x1d')](handleEntityNotFound(_0x5642b7,null))['then'](saveUpdates(_0xe79310['body'],null))['then'](respondWithResult(_0x5642b7,null))[_0xf3d3('0x3f')](handleError(_0x5642b7,null));};exports['destroy']=function(_0x59ad42,_0x5f29a3){return db['SquareProject']['find']({'where':{'id':_0x59ad42[_0xf3d3('0x41')]['id']}})[_0xf3d3('0x1d')](handleEntityNotFound(_0x5f29a3,null))[_0xf3d3('0x1d')](removeEntity(_0x5f29a3,null))['catch'](handleError(_0x5f29a3,null));};exports[_0xf3d3('0x4a')]=function(_0xb5f78,_0x4490f5,_0x214c8d){return db[_0xf3d3('0x27')][_0xf3d3('0x43')]({'where':{'id':_0xb5f78[_0xf3d3('0x41')]['id']}})[_0xf3d3('0x1d')](handleEntityNotFound(_0x4490f5,null))[_0xf3d3('0x1d')](function(_0x3a6522){if(_0x3a6522){return _0x3a6522[_0xf3d3('0x4a')](_0xb5f78[_0xf3d3('0x45')][_0xf3d3('0x4b')],_[_0xf3d3('0x4c')](_0xb5f78[_0xf3d3('0x45')],[_0xf3d3('0x4b'),'id'])||{});}})[_0xf3d3('0x1d')](respondWithResult(_0x4490f5,null))[_0xf3d3('0x3f')](handleError(_0x4490f5,null));};exports[_0xf3d3('0x4d')]=function(_0x316422,_0x5f136b,_0x5a3cdf){return db[_0xf3d3('0x27')][_0xf3d3('0x43')]({'where':{'id':_0x316422[_0xf3d3('0x41')]['id']}})[_0xf3d3('0x1d')](handleEntityNotFound(_0x5f136b,null))[_0xf3d3('0x1d')](function(_0x5ec2af){if(_0x5ec2af){return _0x5ec2af['removeUsers'](_0x316422[_0xf3d3('0x2d')][_0xf3d3('0x4b')])[_0xf3d3('0x1d')](function(){if(_[_0xf3d3('0x4e')](_0x316422[_0xf3d3('0x2d')][_0xf3d3('0x4b')])){for(var _0x4f528e=0x0;_0x4f528e<_0x316422[_0xf3d3('0x2d')][_0xf3d3('0x4b')][_0xf3d3('0x33')];_0x4f528e+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x316422[_0xf3d3('0x2d')][_0xf3d3('0x4b')][_0x4f528e]),'SquareProjectId':Number(_0x316422[_0xf3d3('0x41')]['id'])});}}else{socket[_0xf3d3('0x4f')](_0xf3d3('0x50'),{'UserId':Number(_0x316422[_0xf3d3('0x2d')][_0xf3d3('0x4b')]),'SquareProjectId':Number(_0x316422[_0xf3d3('0x41')]['id'])});}});}})['then'](respondWithStatusCode(_0x5f136b,null))['catch'](handleError(_0x5f136b,null));};exports[_0xf3d3('0x51')]=function(_0xe56a66,_0x39a452,_0x39ace9){var _0xfae67c={};var _0x249bc3={};var _0x4841f4;var _0x225439;return db[_0xf3d3('0x27')][_0xf3d3('0x52')]({'where':{'id':_0xe56a66[_0xf3d3('0x41')]['id']}})['then'](handleEntityNotFound(_0x39a452,null))['then'](function(_0x3fda3f){if(_0x3fda3f){_0x4841f4=_0x3fda3f;_0x249bc3['model']=_[_0xf3d3('0x2e')](db['User']['rawAttributes']);_0x249bc3[_0xf3d3('0x2d')]=_[_0xf3d3('0x2e')](_0xe56a66['query']);_0x249bc3[_0xf3d3('0x2f')]=_[_0xf3d3('0x30')](_0x249bc3[_0xf3d3('0x2c')],_0x249bc3[_0xf3d3('0x2d')]);_0xfae67c['attributes']=_['intersection'](_0x249bc3[_0xf3d3('0x2c')],qs[_0xf3d3('0x32')](_0xe56a66[_0xf3d3('0x2d')][_0xf3d3('0x32')]));_0xfae67c[_0xf3d3('0x31')]=_0xfae67c[_0xf3d3('0x31')]['length']?_0xfae67c['attributes']:_0x249bc3[_0xf3d3('0x2c')];_0xfae67c['order']=qs[_0xf3d3('0x36')](_0xe56a66['query'][_0xf3d3('0x36')]);_0xfae67c[_0xf3d3('0x37')]=qs[_0xf3d3('0x2f')](_['pick'](_0xe56a66[_0xf3d3('0x2d')],_0x249bc3[_0xf3d3('0x2f')]));if(_0xe56a66[_0xf3d3('0x2d')][_0xf3d3('0x39')]){_0xfae67c[_0xf3d3('0x37')]=_['merge'](_0xfae67c['where'],{'$or':_[_0xf3d3('0x26')](_0xfae67c[_0xf3d3('0x31')],function(_0x46a26f){var _0x334e4b={};_0x334e4b[_0x46a26f]={'$like':'%'+_0xe56a66['query']['filter']+'%'};return _0x334e4b;})});}_0xfae67c=_[_0xf3d3('0x3a')]({},_0xfae67c,_0xe56a66[_0xf3d3('0x3b')]);return _0x4841f4[_0xf3d3('0x51')](_0xfae67c);}})[_0xf3d3('0x1d')](function(_0x44f546){if(_0x44f546){_0x225439=_0x44f546['length'];if(!_0xe56a66[_0xf3d3('0x2d')][_0xf3d3('0x34')](_0xf3d3('0x53'))){_0xfae67c[_0xf3d3('0x18')]=qs['limit'](_0xe56a66[_0xf3d3('0x2d')]['limit']);_0xfae67c['offset']=qs[_0xf3d3('0x17')](_0xe56a66[_0xf3d3('0x2d')]['offset']);}return _0x4841f4[_0xf3d3('0x51')](_0xfae67c);}})[_0xf3d3('0x1d')](function(_0x49d666){if(_0x49d666){return _0x49d666?{'count':_0x225439,'rows':_0x49d666}:null;}})[_0xf3d3('0x1d')](respondWithResult(_0x39a452,null))[_0xf3d3('0x3f')](handleError(_0x39a452,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 7f7ec05..1e57f10 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 _0x5620=['hook','exports','events','SquareProject','setMaxListeners','emit','hasOwnProperty'];(function(_0x2e78b5,_0x2fe06d){var _0x28447d=function(_0x5aefc3){while(--_0x5aefc3){_0x2e78b5['push'](_0x2e78b5['shift']());}};_0x28447d(++_0x2fe06d);}(_0x5620,0xbf));var _0x0562=function(_0x3f940e,_0x140c3b){_0x3f940e=_0x3f940e-0x0;var _0x424b2e=_0x5620[_0x3f940e];return _0x424b2e;};'use strict';var EventEmitter=require(_0x0562('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x0562('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x0562('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x215fe5){return function(_0x4ef07f,_0x18ea87,_0x530400){SquareProjectEvents[_0x0562('0x3')](_0x215fe5+':'+_0x4ef07f['id'],_0x4ef07f);SquareProjectEvents[_0x0562('0x3')](_0x215fe5,_0x4ef07f);_0x530400(null);};}for(var e in events){if(events[_0x0562('0x4')](e)){var event=events[e];SquareProject[_0x0562('0x5')](e,emitEvent(event));}}module[_0x0562('0x6')]=SquareProjectEvents; \ No newline at end of file +var _0x00b7=['events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3213b4,_0x3cddd0){var _0xa97785=function(_0x3c9282){while(--_0x3c9282){_0x3213b4['push'](_0x3213b4['shift']());}};_0xa97785(++_0x3cddd0);}(_0x00b7,0x160));var _0x700b=function(_0x480e41,_0x51caae){_0x480e41=_0x480e41-0x0;var _0x1a1c52=_0x00b7[_0x480e41];return _0x1a1c52;};'use strict';var EventEmitter=require(_0x700b('0x0'));var SquareProject=require(_0x700b('0x1'))['db'][_0x700b('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x700b('0x3')](0x0);var events={'afterCreate':_0x700b('0x4'),'afterUpdate':_0x700b('0x5'),'afterDestroy':_0x700b('0x6')};function emitEvent(_0x3a5678){return function(_0x26252a,_0x2ee4cc,_0x5687eb){SquareProjectEvents['emit'](_0x3a5678+':'+_0x26252a['id'],_0x26252a);SquareProjectEvents[_0x700b('0x7')](_0x3a5678,_0x26252a);_0x5687eb(null);};}for(var e in events){if(events[_0x700b('0x8')](e)){var event=events[e];SquareProject[_0x700b('0x9')](e,emitEvent(event));}}module[_0x700b('0xa')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 931c41a..ddad2d7 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 _0xe77f=['square_projects','changed','preproduction','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','api','moment','request-promise','path','../../config/environment','./squareProject.attributes','exports'];(function(_0x231752,_0x306eab){var _0x227cb7=function(_0x324ee3){while(--_0x324ee3){_0x231752['push'](_0x231752['shift']());}};_0x227cb7(++_0x306eab);}(_0xe77f,0xba));var _0xfe77=function(_0x540ded,_0x3a336b){_0x540ded=_0x540ded-0x0;var _0x2871ec=_0xe77f[_0x540ded];return _0x2871ec;};'use strict';var _=require(_0xfe77('0x0'));var util=require(_0xfe77('0x1'));var logger=require('../../config/logger')(_0xfe77('0x2'));var moment=require(_0xfe77('0x3'));var BPromise=require('bluebird');var rp=require(_0xfe77('0x4'));var fs=require('fs');var path=require(_0xfe77('0x5'));var rimraf=require('rimraf');var config=require(_0xfe77('0x6'));var attributes=require(_0xfe77('0x7'));module[_0xfe77('0x8')]=function(_0x1ce970,_0x130b85){return _0x1ce970['define']('SquareProject',attributes,{'tableName':_0xfe77('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xc2b8f4,_0x1bb5e0,_0x1a2809){if(_0xc2b8f4[_0xfe77('0xa')](_0xfe77('0xb'))){_0xc2b8f4['savedAt']=moment()['format'](_0xfe77('0xc'));}if(_0xc2b8f4[_0xfe77('0xa')](_0xfe77('0xd'))){_0xc2b8f4[_0xfe77('0xe')]=moment()['format'](_0xfe77('0xc'));}_0x1a2809(null,_0xc2b8f4);}}});}; \ No newline at end of file +var _0x6fad=['rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','changed','preproduction','savedAt','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x29741d,_0x32a89c){var _0x3f8c6b=function(_0x176c44){while(--_0x176c44){_0x29741d['push'](_0x29741d['shift']());}};_0x3f8c6b(++_0x32a89c);}(_0x6fad,0x174));var _0xd6fa=function(_0x21ab42,_0x8ab09a){_0x21ab42=_0x21ab42-0x0;var _0x4f6351=_0x6fad[_0x21ab42];return _0x4f6351;};'use strict';var _=require(_0xd6fa('0x0'));var util=require(_0xd6fa('0x1'));var logger=require(_0xd6fa('0x2'))(_0xd6fa('0x3'));var moment=require('moment');var BPromise=require(_0xd6fa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd6fa('0x5'));var rimraf=require(_0xd6fa('0x6'));var config=require(_0xd6fa('0x7'));var attributes=require(_0xd6fa('0x8'));module['exports']=function(_0x45dad4,_0x329390){return _0x45dad4[_0xd6fa('0x9')](_0xd6fa('0xa'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d2aaa,_0x566a11,_0x92911b){if(_0x1d2aaa[_0xd6fa('0xb')](_0xd6fa('0xc'))){_0x1d2aaa[_0xd6fa('0xd')]=moment()[_0xd6fa('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1d2aaa['changed'](_0xd6fa('0xf'))){_0x1d2aaa[_0xd6fa('0x10')]=moment()[_0xd6fa('0xe')](_0xd6fa('0x11'));}_0x92911b(null,_0x1d2aaa);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 2f95caa..f296a8c 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 _0x58bb=['./squareProject.socket','request','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareProject','SquareProject','options','raw','where','attributes','include','model','map','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','client','http','redis','defaults','socket.io-emitter'];(function(_0x43247e,_0x5c1d17){var _0x518e6a=function(_0x4fad41){while(--_0x4fad41){_0x43247e['push'](_0x43247e['shift']());}};_0x518e6a(++_0x5c1d17);}(_0x58bb,0xfc));var _0xb58b=function(_0x4dbc75,_0x4fe512){_0x4dbc75=_0x4dbc75-0x0;var _0x1991c4=_0x58bb[_0x4dbc75];return _0x1991c4;};'use strict';var _=require(_0xb58b('0x0'));var util=require(_0xb58b('0x1'));var moment=require(_0xb58b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb58b('0x3'));var fs=require('fs');var Redis=require(_0xb58b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb58b('0x5'));var logger=require(_0xb58b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb58b('0x7')][_0xb58b('0x8')]({'port':0x232a});config[_0xb58b('0x9')]=_[_0xb58b('0xa')](config[_0xb58b('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xb58b('0xb'))(new Redis(config['redis']));require(_0xb58b('0xc'))['register'](socket);function respondWithRpcPromise(_0xff499,_0x3b51e0,_0x288053){return new BPromise(function(_0x2650d2,_0x5159f3){return client[_0xb58b('0xd')](_0xff499,_0x288053)['then'](function(_0x4194bf){logger[_0xb58b('0xe')](_0xb58b('0xf'),_0x3b51e0,_0xb58b('0x10'));logger[_0xb58b('0x11')](_0xb58b('0x12'),_0x3b51e0,_0xb58b('0x10'),JSON['stringify'](_0x4194bf));if(_0x4194bf[_0xb58b('0x13')]){if(_0x4194bf[_0xb58b('0x13')][_0xb58b('0x14')]===0x1f4){logger['error'](_0xb58b('0xf'),_0x3b51e0,_0x4194bf[_0xb58b('0x13')][_0xb58b('0x15')]);return _0x5159f3(_0x4194bf['error'][_0xb58b('0x15')]);}logger[_0xb58b('0x13')]('SquareProject,\x20%s,\x20%s',_0x3b51e0,_0x4194bf[_0xb58b('0x13')][_0xb58b('0x15')]);return _0x2650d2(_0x4194bf[_0xb58b('0x13')]['message']);}else{logger[_0xb58b('0xe')](_0xb58b('0xf'),_0x3b51e0,'request\x20sent');_0x2650d2(_0x4194bf[_0xb58b('0x16')]['message']);}})[_0xb58b('0x17')](function(_0x27936){logger[_0xb58b('0x13')]('SquareProject,\x20%s,\x20%s',_0x3b51e0,_0x27936);_0x5159f3(_0x27936);});});}exports[_0xb58b('0x18')]=function(_0x4a344c){var _0x4683d5=this;return new Promise(function(_0x1522a8,_0x1ce683){return db[_0xb58b('0x19')]['find']({'raw':_0x4a344c[_0xb58b('0x1a')]?_0x4a344c[_0xb58b('0x1a')][_0xb58b('0x1b')]===undefined?!![]:![]:!![],'where':_0x4a344c[_0xb58b('0x1a')]?_0x4a344c[_0xb58b('0x1a')][_0xb58b('0x1c')]||null:null,'attributes':_0x4a344c['options']?_0x4a344c[_0xb58b('0x1a')][_0xb58b('0x1d')]||null:null,'include':_0x4a344c['options']?_0x4a344c[_0xb58b('0x1a')]['include']?_['map'](_0x4a344c[_0xb58b('0x1a')][_0xb58b('0x1e')],function(_0x5d1ca8){return{'model':db[_0x5d1ca8[_0xb58b('0x1f')]],'as':_0x5d1ca8['as'],'attributes':_0x5d1ca8[_0xb58b('0x1d')],'include':_0x5d1ca8[_0xb58b('0x1e')]?_[_0xb58b('0x20')](_0x5d1ca8[_0xb58b('0x1e')],function(_0x73589c){return{'model':db[_0x73589c[_0xb58b('0x1f')]],'as':_0x73589c['as'],'attributes':_0x73589c[_0xb58b('0x1d')],'include':_0x73589c['include']?_['map'](_0x73589c[_0xb58b('0x1e')],function(_0x3bd03d){return{'model':db[_0x3bd03d[_0xb58b('0x1f')]],'as':_0x3bd03d['as'],'attributes':_0x3bd03d[_0xb58b('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b1a06){logger[_0xb58b('0xe')](_0xb58b('0x18'),_0x4a344c);logger[_0xb58b('0x11')](_0xb58b('0x18'),_0x4a344c,JSON['stringify'](_0x2b1a06));_0x1522a8(_0x2b1a06);})[_0xb58b('0x17')](function(_0x1579e8){logger[_0xb58b('0x13')](_0xb58b('0x18'),_0x1579e8[_0xb58b('0x15')],_0x4a344c);_0x1ce683(_0x4683d5[_0xb58b('0x13')](0x1f4,_0x1579e8[_0xb58b('0x15')]));});});}; \ No newline at end of file +var _0x5cb1=['raw','where','attributes','map','include','model','info','catch','lodash','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowSquareProject','SquareProject','find','options'];(function(_0x57d6c3,_0x5ac8b8){var _0x4c101c=function(_0x445ef6){while(--_0x445ef6){_0x57d6c3['push'](_0x57d6c3['shift']());}};_0x4c101c(++_0x5ac8b8);}(_0x5cb1,0xc8));var _0x15cb=function(_0x5bdb83,_0x3605de){_0x5bdb83=_0x5bdb83-0x0;var _0x1986bb=_0x5cb1[_0x5bdb83];return _0x1986bb;};'use strict';var _=require(_0x15cb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x15cb('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x15cb('0x2'))['db'];var utils=require(_0x15cb('0x3'));var logger=require('../../config/logger')(_0x15cb('0x4'));var config=require(_0x15cb('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x15cb('0x6')]['http']({'port':0x232a});config[_0x15cb('0x7')]=_[_0x15cb('0x8')](config[_0x15cb('0x7')],{'host':_0x15cb('0x9'),'port':0x18eb});var socket=require(_0x15cb('0xa'))(new Redis(config['redis']));require('./squareProject.socket')['register'](socket);function respondWithRpcPromise(_0x1fc220,_0x4976a5,_0x5cdb47){return new BPromise(function(_0x2ed8b0,_0x512b08){return client['request'](_0x1fc220,_0x5cdb47)[_0x15cb('0xb')](function(_0x3a9316){logger['info'](_0x15cb('0xc'),_0x4976a5,_0x15cb('0xd'));logger[_0x15cb('0xe')](_0x15cb('0xf'),_0x4976a5,_0x15cb('0xd'),JSON[_0x15cb('0x10')](_0x3a9316));if(_0x3a9316['error']){if(_0x3a9316[_0x15cb('0x11')][_0x15cb('0x12')]===0x1f4){logger[_0x15cb('0x11')]('SquareProject,\x20%s,\x20%s',_0x4976a5,_0x3a9316[_0x15cb('0x11')]['message']);return _0x512b08(_0x3a9316[_0x15cb('0x11')][_0x15cb('0x13')]);}logger[_0x15cb('0x11')]('SquareProject,\x20%s,\x20%s',_0x4976a5,_0x3a9316[_0x15cb('0x11')][_0x15cb('0x13')]);return _0x2ed8b0(_0x3a9316[_0x15cb('0x11')][_0x15cb('0x13')]);}else{logger['info'](_0x15cb('0xc'),_0x4976a5,_0x15cb('0xd'));_0x2ed8b0(_0x3a9316['result'][_0x15cb('0x13')]);}})['catch'](function(_0xce9ed3){logger[_0x15cb('0x11')](_0x15cb('0xc'),_0x4976a5,_0xce9ed3);_0x512b08(_0xce9ed3);});});}exports[_0x15cb('0x14')]=function(_0x53fcf5){var _0x5cfe67=this;return new Promise(function(_0x7418a5,_0x42ec07){return db[_0x15cb('0x15')][_0x15cb('0x16')]({'raw':_0x53fcf5[_0x15cb('0x17')]?_0x53fcf5[_0x15cb('0x17')][_0x15cb('0x18')]===undefined?!![]:![]:!![],'where':_0x53fcf5['options']?_0x53fcf5[_0x15cb('0x17')][_0x15cb('0x19')]||null:null,'attributes':_0x53fcf5[_0x15cb('0x17')]?_0x53fcf5['options'][_0x15cb('0x1a')]||null:null,'include':_0x53fcf5[_0x15cb('0x17')]?_0x53fcf5['options']['include']?_[_0x15cb('0x1b')](_0x53fcf5[_0x15cb('0x17')][_0x15cb('0x1c')],function(_0x519e18){return{'model':db[_0x519e18[_0x15cb('0x1d')]],'as':_0x519e18['as'],'attributes':_0x519e18['attributes'],'include':_0x519e18[_0x15cb('0x1c')]?_['map'](_0x519e18['include'],function(_0x8e7863){return{'model':db[_0x8e7863[_0x15cb('0x1d')]],'as':_0x8e7863['as'],'attributes':_0x8e7863[_0x15cb('0x1a')],'include':_0x8e7863[_0x15cb('0x1c')]?_[_0x15cb('0x1b')](_0x8e7863[_0x15cb('0x1c')],function(_0x4246a6){return{'model':db[_0x4246a6[_0x15cb('0x1d')]],'as':_0x4246a6['as'],'attributes':_0x4246a6[_0x15cb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x15cb('0xb')](function(_0x22b8e3){logger[_0x15cb('0x1e')](_0x15cb('0x14'),_0x53fcf5);logger[_0x15cb('0xe')](_0x15cb('0x14'),_0x53fcf5,JSON[_0x15cb('0x10')](_0x22b8e3));_0x7418a5(_0x22b8e3);})[_0x15cb('0x1f')](function(_0x2b8954){logger[_0x15cb('0x11')]('ShowSquareProject',_0x2b8954[_0x15cb('0x13')],_0x53fcf5);_0x42ec07(_0x5cfe67['error'](0x1f4,_0x2b8954[_0x15cb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 22d804d..d53d868 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 _0x4137=['emit','removeListener','register','length','squareProject:','./squareProject.events','save','remove','update'];(function(_0x5a5b67,_0x22c983){var _0x404444=function(_0x1a6fa1){while(--_0x1a6fa1){_0x5a5b67['push'](_0x5a5b67['shift']());}};_0x404444(++_0x22c983);}(_0x4137,0xf8));var _0x7413=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4137[_0x5d6456];return _0x4d66c1;};'use strict';var SquareProjectEvents=require(_0x7413('0x0'));var events=[_0x7413('0x1'),_0x7413('0x2'),_0x7413('0x3')];function createListener(_0x392ebc,_0x410971){return function(_0x2e6df7){_0x410971[_0x7413('0x4')](_0x392ebc,_0x2e6df7);};}function removeListener(_0x258255,_0x3dc48a){return function(){SquareProjectEvents[_0x7413('0x5')](_0x258255,_0x3dc48a);};}exports[_0x7413('0x6')]=function(_0x4fbade){for(var _0xc808cd=0x0,_0x188d89=events[_0x7413('0x7')];_0xc808cd<_0x188d89;_0xc808cd++){var _0x15af0d=events[_0xc808cd];var _0x5f4cd0=createListener(_0x7413('0x8')+_0x15af0d,_0x4fbade);SquareProjectEvents['on'](_0x15af0d,_0x5f4cd0);}}; \ No newline at end of file +var _0x9536=['length','./squareProject.events','save','remove','update','emit','removeListener','register'];(function(_0x1c289a,_0x277fe7){var _0x28d68e=function(_0x2f8e98){while(--_0x2f8e98){_0x1c289a['push'](_0x1c289a['shift']());}};_0x28d68e(++_0x277fe7);}(_0x9536,0x179));var _0x6953=function(_0x5311a1,_0x304912){_0x5311a1=_0x5311a1-0x0;var _0x2acb9f=_0x9536[_0x5311a1];return _0x2acb9f;};'use strict';var SquareProjectEvents=require(_0x6953('0x0'));var events=[_0x6953('0x1'),_0x6953('0x2'),_0x6953('0x3')];function createListener(_0x4d218f,_0xc3e4dd){return function(_0x53b172){_0xc3e4dd[_0x6953('0x4')](_0x4d218f,_0x53b172);};}function removeListener(_0x3c32c7,_0x1dee7c){return function(){SquareProjectEvents[_0x6953('0x5')](_0x3c32c7,_0x1dee7c);};}exports[_0x6953('0x6')]=function(_0x494ac2){for(var _0x2b273e=0x0,_0x2bb026=events[_0x6953('0x7')];_0x2b273e<_0x2bb026;_0x2b273e++){var _0x3e1aff=events[_0x2b273e];var _0x1c8225=createListener('squareProject:'+_0x3e1aff,_0x494ac2);SquareProjectEvents['on'](_0x3e1aff,_0x1c8225);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 88d7605..f3f61c3 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 _0x9c14=['delete','/:id/delete','destroy','multer','util','path','Router','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update'];(function(_0x3c59a8,_0x2f2591){var _0x2ef850=function(_0x4f820e){while(--_0x4f820e){_0x3c59a8['push'](_0x3c59a8['shift']());}};_0x2ef850(++_0x2f2591);}(_0x9c14,0x67));var _0x49c1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c14[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x49c1('0x0'));var util=require(_0x49c1('0x1'));var path=require(_0x49c1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x49c1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x49c1('0x4'));var config=require(_0x49c1('0x5'));var controller=require(_0x49c1('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x49c1('0x7')](_0x49c1('0x8'),auth[_0x49c1('0x9')](),controller[_0x49c1('0xa')]);router['get'](_0x49c1('0xb'),auth['isAuthenticated'](),controller[_0x49c1('0xc')]);router[_0x49c1('0xd')]('/',auth[_0x49c1('0x9')](),controller[_0x49c1('0xe')]);router[_0x49c1('0xf')](_0x49c1('0x8'),auth[_0x49c1('0x9')](),controller[_0x49c1('0x10')]);router[_0x49c1('0x11')](_0x49c1('0x12'),auth[_0x49c1('0x9')](),controller[_0x49c1('0x13')]);module['exports']=router; \ No newline at end of file +var _0xca75=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get','/:id','isAuthenticated','show','/:id/download','download','create','put','update','delete','/:id/delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x353088,_0x24fec3){var _0x5d0068=function(_0x45226d){while(--_0x45226d){_0x353088['push'](_0x353088['shift']());}};_0x5d0068(++_0x24fec3);}(_0xca75,0x6e));var _0x5ca7=function(_0x536866,_0x54e594){_0x536866=_0x536866-0x0;var _0x3f8cee=_0xca75[_0x536866];return _0x3f8cee;};'use strict';var multer=require(_0x5ca7('0x0'));var util=require(_0x5ca7('0x1'));var path=require(_0x5ca7('0x2'));var timeout=require(_0x5ca7('0x3'));var express=require('express');var router=express[_0x5ca7('0x4')]();var auth=require(_0x5ca7('0x5'));var interaction=require(_0x5ca7('0x6'));var config=require(_0x5ca7('0x7'));var controller=require(_0x5ca7('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5ca7('0x9')]);router[_0x5ca7('0xa')](_0x5ca7('0xb'),auth[_0x5ca7('0xc')](),controller[_0x5ca7('0xd')]);router[_0x5ca7('0xa')](_0x5ca7('0xe'),auth[_0x5ca7('0xc')](),controller[_0x5ca7('0xf')]);router['post']('/',auth[_0x5ca7('0xc')](),controller[_0x5ca7('0x10')]);router[_0x5ca7('0x11')]('/:id',auth[_0x5ca7('0xc')](),controller[_0x5ca7('0x12')]);router[_0x5ca7('0x13')](_0x5ca7('0x14'),auth[_0x5ca7('0xc')](),controller[_0x5ca7('0x15')]);module[_0x5ca7('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 5800d6d..e223c35 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 _0x109b=['STRING','getDataValue','savePath','sequelize','exports'];(function(_0x4d01c5,_0x30dbac){var _0x6bb942=function(_0x1a2980){while(--_0x1a2980){_0x4d01c5['push'](_0x4d01c5['shift']());}};_0x6bb942(++_0x30dbac);}(_0x109b,0x175));var _0xb109=function(_0x55dd85,_0x8d7291){_0x55dd85=_0x55dd85-0x0;var _0x505d3b=_0x109b[_0x55dd85];return _0x505d3b;};'use strict';var Sequelize=require(_0xb109('0x0'));module[_0xb109('0x1')]={'uniqueid':{'type':Sequelize[_0xb109('0x2')]},'callerid':{'type':Sequelize[_0xb109('0x2')]},'calleridname':{'type':Sequelize[_0xb109('0x2')]},'context':{'type':Sequelize[_0xb109('0x2')]},'extension':{'type':Sequelize[_0xb109('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb109('0x2')]},'dnid':{'type':Sequelize[_0xb109('0x2')]},'projectName':{'type':Sequelize[_0xb109('0x2')]},'saveName':{'type':Sequelize[_0xb109('0x2')]},'filename':{'type':Sequelize[_0xb109('0x2')]},'savePath':{'type':Sequelize[_0xb109('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x8e5c9c='';var _0x2e6278=this[_0xb109('0x3')](_0xb109('0x4'));if(_0x2e6278){_0x8e5c9c=_0x2e6278['substring'](_0x2e6278['lastIndexOf']('.'));}return _0x8e5c9c;}}}; \ No newline at end of file +var _0xaf11=['exports','STRING','savePath','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf11,0x12f));var _0x1af1=function(_0x48316e,_0x2a6f85){_0x48316e=_0x48316e-0x0;var _0x34b707=_0xaf11[_0x48316e];return _0x34b707;};'use strict';var Sequelize=require(_0x1af1('0x0'));module[_0x1af1('0x1')]={'uniqueid':{'type':Sequelize[_0x1af1('0x2')]},'callerid':{'type':Sequelize[_0x1af1('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1af1('0x2')]},'extension':{'type':Sequelize[_0x1af1('0x2')]},'priority':{'type':Sequelize[_0x1af1('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x1af1('0x2')]},'projectName':{'type':Sequelize[_0x1af1('0x2')]},'saveName':{'type':Sequelize[_0x1af1('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x1af1('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x20ba8b='';var _0x26d917=this['getDataValue'](_0x1af1('0x3'));if(_0x26d917){_0x20ba8b=_0x26d917['substring'](_0x26d917['lastIndexOf']('.'));}return _0x20ba8b;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index c29ba52..a79d99d 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 _0x5684=['%s.cypher','existsSync','secrets','recording','ValidationError','extname','message','SquareRecording\x20not\x20found','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','apply','save','update','then','destroy','error','stack','name','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','where','merge','VIRTUAL','filter','include','findAll','rows','show','options','find','create','body','params','catch','download','../../components/encryptor','uniqueid','savePath','filename','format'];(function(_0x42506a,_0x18914e){var _0x52d1ac=function(_0x380844){while(--_0x380844){_0x42506a['push'](_0x42506a['shift']());}};_0x52d1ac(++_0x18914e);}(_0x5684,0x6c));var _0x4568=function(_0x25875c,_0xc144a9){_0x25875c=_0x25875c-0x0;var _0x48a9e6=_0x5684[_0x25875c];return _0x48a9e6;};'use strict';var pdf=require(_0x4568('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4568('0x1'));var zipdir=require(_0x4568('0x2'));var jsonpatch=require(_0x4568('0x3'));var rp=require(_0x4568('0x4'));var moment=require(_0x4568('0x5'));var BPromise=require(_0x4568('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4568('0x7'));var csv=require(_0x4568('0x8'));var ejs=require(_0x4568('0x9'));var fs=require('fs');var _=require(_0x4568('0xa'));var squel=require(_0x4568('0xb'));var crypto=require(_0x4568('0xc'));var jsforce=require(_0x4568('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4568('0xe'));var authService=require(_0x4568('0xf'));var qs=require(_0x4568('0x10'));var as=require(_0x4568('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4568('0x12'))(_0x4568('0x13'));var utils=require('../../config/utils');var config=require(_0x4568('0x14'));var licenseUtil=require(_0x4568('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ccfb6,_0x4b0f09){_0x4b0f09=_0x4b0f09||0xcc;return function(_0x50ad24){if(_0x50ad24){return _0x2ccfb6[_0x4568('0x16')](_0x4b0f09);}return _0x2ccfb6[_0x4568('0x17')](_0x4b0f09)[_0x4568('0x18')]();};}function respondWithResult(_0x2dc5d2,_0x113b3e){_0x113b3e=_0x113b3e||0xc8;return function(_0x2964ee){if(_0x2964ee){return _0x2dc5d2[_0x4568('0x17')](_0x113b3e)[_0x4568('0x19')](_0x2964ee);}};}function respondWithFilteredResult(_0x4330dc,_0x1a93ef){return function(_0x4b84cd){if(_0x4b84cd){var _0x466b6c=_0x4b84cd[_0x4568('0x1a')],_0x186d3=_0x1a93ef[_0x4568('0x1b')],_0xd65626=_0x1a93ef[_0x4568('0x1b')]+_0x1a93ef[_0x4568('0x1c')],_0x31ea40;if(_0xd65626>=_0x466b6c){_0xd65626=_0x466b6c;_0x31ea40=0xc8;}else{_0x31ea40=0xce;}_0x4330dc[_0x4568('0x17')](_0x31ea40);return _0x4330dc['set']('Content-Range',_0x186d3+'-'+_0xd65626+'/'+_0x466b6c)[_0x4568('0x19')](_0x4b84cd);}return null;};}function patchUpdates(_0x30b24e){return function(_0x1b1ef8){try{jsonpatch[_0x4568('0x1d')](_0x1b1ef8,_0x30b24e,!![]);}catch(_0x22eb25){return BPromise['reject'](_0x22eb25);}return _0x1b1ef8[_0x4568('0x1e')]();};}function saveUpdates(_0x2a8d07,_0x179964){return function(_0x325cbd){if(_0x325cbd){return _0x325cbd[_0x4568('0x1f')](_0x2a8d07)[_0x4568('0x20')](function(_0x5a1943){return _0x5a1943;});}return null;};}function removeEntity(_0x5b4573,_0x518621){return function(_0x11b46b){if(_0x11b46b){return _0x11b46b[_0x4568('0x21')]()[_0x4568('0x20')](function(){_0x5b4573[_0x4568('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xabca6b,_0x32cb46){return function(_0x2742c4){if(!_0x2742c4){_0xabca6b['sendStatus'](0x194);}return _0x2742c4;};}function handleError(_0x3acfd3,_0x5ac58d){_0x5ac58d=_0x5ac58d||0x1f4;return function(_0x2c287e){logger[_0x4568('0x22')](_0x2c287e[_0x4568('0x23')]);if(_0x2c287e[_0x4568('0x24')]){delete _0x2c287e[_0x4568('0x24')];}_0x3acfd3['status'](_0x5ac58d)['send'](_0x2c287e);};}exports['index']=function(_0x3b7aa,_0x4b874c){var _0x2eefed={},_0x2a5f41={},_0x569fb3={'count':0x0,'rows':[]};var _0x1a42a7=_[_0x4568('0x25')](db[_0x4568('0x26')][_0x4568('0x27')],function(_0x4b3495){return{'name':_0x4b3495[_0x4568('0x28')],'type':_0x4b3495[_0x4568('0x29')][_0x4568('0x2a')]};});_0x2a5f41[_0x4568('0x2b')]=_[_0x4568('0x25')](_0x1a42a7,_0x4568('0x24'));_0x2a5f41[_0x4568('0x2c')]=_[_0x4568('0x2d')](_0x3b7aa['query']);_0x2a5f41['filters']=_[_0x4568('0x2e')](_0x2a5f41['model'],_0x2a5f41[_0x4568('0x2c')]);_0x2eefed[_0x4568('0x2f')]=_['intersection'](_0x2a5f41[_0x4568('0x2b')],qs[_0x4568('0x30')](_0x3b7aa[_0x4568('0x2c')][_0x4568('0x30')]));_0x2eefed['attributes']=_0x2eefed['attributes'][_0x4568('0x31')]?_0x2eefed['attributes']:_0x2a5f41[_0x4568('0x2b')];if(!_0x3b7aa[_0x4568('0x2c')][_0x4568('0x32')]('nolimit')){_0x2eefed[_0x4568('0x1c')]=qs[_0x4568('0x1c')](_0x3b7aa[_0x4568('0x2c')][_0x4568('0x1c')]);_0x2eefed[_0x4568('0x1b')]=qs[_0x4568('0x1b')](_0x3b7aa['query'][_0x4568('0x1b')]);}_0x2eefed[_0x4568('0x33')]=qs[_0x4568('0x34')](_0x3b7aa['query'][_0x4568('0x34')]);_0x2eefed['where']=qs['filters'](_['pick'](_0x3b7aa[_0x4568('0x2c')],_0x2a5f41[_0x4568('0x35')]),_0x1a42a7);if(_0x3b7aa['query']['filter']){_0x2eefed[_0x4568('0x36')]=_[_0x4568('0x37')](_0x2eefed[_0x4568('0x36')],{'$or':_[_0x4568('0x25')](_0x1a42a7,function(_0x4aacea){if(_0x4aacea[_0x4568('0x29')]!==_0x4568('0x38')){var _0x21ebe2={};_0x21ebe2[_0x4aacea[_0x4568('0x24')]]={'$like':'%'+_0x3b7aa[_0x4568('0x2c')][_0x4568('0x39')]+'%'};return _0x21ebe2;}})});}_0x2eefed=_[_0x4568('0x37')]({},_0x2eefed,_0x3b7aa['options']);var _0x2d14de={'where':_0x2eefed['where']};return db[_0x4568('0x26')][_0x4568('0x1a')](_0x2d14de)[_0x4568('0x20')](function(_0x22ddf4){_0x569fb3[_0x4568('0x1a')]=_0x22ddf4;if(_0x3b7aa[_0x4568('0x2c')]['includeAll']){_0x2eefed[_0x4568('0x3a')]=[{'all':!![]}];}return db[_0x4568('0x26')][_0x4568('0x3b')](_0x2eefed);})[_0x4568('0x20')](function(_0x55a8c8){_0x569fb3[_0x4568('0x3c')]=_0x55a8c8;return _0x569fb3;})[_0x4568('0x20')](respondWithFilteredResult(_0x4b874c,_0x2eefed))['catch'](handleError(_0x4b874c,null));};exports[_0x4568('0x3d')]=function(_0xd77f7e,_0x3660f0){var _0x454110={'raw':!![],'where':{'id':_0xd77f7e['params']['id']}},_0x40b543={};_0x40b543[_0x4568('0x2b')]=_[_0x4568('0x2d')](db['SquareRecording']['rawAttributes']);_0x40b543[_0x4568('0x2c')]=_[_0x4568('0x2d')](_0xd77f7e[_0x4568('0x2c')]);_0x40b543[_0x4568('0x35')]=_['intersection'](_0x40b543[_0x4568('0x2b')],_0x40b543[_0x4568('0x2c')]);_0x454110[_0x4568('0x2f')]=_[_0x4568('0x2e')](_0x40b543[_0x4568('0x2b')],qs[_0x4568('0x30')](_0xd77f7e[_0x4568('0x2c')][_0x4568('0x30')]));_0x454110[_0x4568('0x2f')]=_0x454110['attributes'][_0x4568('0x31')]?_0x454110[_0x4568('0x2f')]:_0x40b543[_0x4568('0x2b')];if(_0xd77f7e[_0x4568('0x2c')]['includeAll']){_0x454110[_0x4568('0x3a')]=[{'all':!![]}];}_0x454110=_[_0x4568('0x37')]({},_0x454110,_0xd77f7e[_0x4568('0x3e')]);return db[_0x4568('0x26')][_0x4568('0x3f')](_0x454110)[_0x4568('0x20')](handleEntityNotFound(_0x3660f0,null))[_0x4568('0x20')](respondWithResult(_0x3660f0,null))['catch'](handleError(_0x3660f0,null));};exports['create']=function(_0x5b233a,_0x59f6b6){return db['SquareRecording'][_0x4568('0x40')](_0x5b233a[_0x4568('0x41')],{})[_0x4568('0x20')](respondWithResult(_0x59f6b6,0xc9))['catch'](handleError(_0x59f6b6,null));};exports[_0x4568('0x1f')]=function(_0xf13806,_0x52b23e){if(_0xf13806['body']['id']){delete _0xf13806[_0x4568('0x41')]['id'];}return db[_0x4568('0x26')][_0x4568('0x3f')]({'where':{'id':_0xf13806[_0x4568('0x42')]['id']}})['then'](handleEntityNotFound(_0x52b23e,null))[_0x4568('0x20')](saveUpdates(_0xf13806[_0x4568('0x41')],null))[_0x4568('0x20')](respondWithResult(_0x52b23e,null))[_0x4568('0x43')](handleError(_0x52b23e,null));};exports[_0x4568('0x44')]=function(_0x278d82,_0x2e84d4,_0x48e907){var _0x1c642d=require(_0x4568('0x45'));var _0xe27223=![];var _0x537ed2={};if(_0x278d82[_0x4568('0x2c')][_0x4568('0x29')]&&_0x278d82[_0x4568('0x2c')][_0x4568('0x29')]==='uniqueid'){_0x537ed2[_0x4568('0x46')]=_0x278d82[_0x4568('0x42')]['id'];}else{_0x537ed2['id']=_0x278d82[_0x4568('0x42')]['id'];}return db[_0x4568('0x26')][_0x4568('0x3f')]({'where':_0x537ed2,'attributes':['id',_0x4568('0x47'),_0x4568('0x48')],'raw':!![]})[_0x4568('0x20')](handleEntityNotFound(_0x2e84d4,null))[_0x4568('0x20')](function(_0x230d15){if(_0x230d15){var _0x507512=_0x230d15['savePath'];var _0x347319=util[_0x4568('0x49')](_0x4568('0x4a'),_0x507512);if(fs[_0x4568('0x4b')](_0x347319)){_0xe27223=!![];return _0x1c642d['decryptFile'](_0x347319,_0x507512,config[_0x4568('0x4c')][_0x4568('0x4d')])[_0x4568('0x20')](function(){return _0x230d15;});}return _0x230d15;}})[_0x4568('0x20')](function(_0x5e0fe1){if(_0x5e0fe1){var _0x397981=_0x5e0fe1[_0x4568('0x47')];if(!fs[_0x4568('0x4b')](_0x397981)){throw new db['Sequelize'][(_0x4568('0x4e'))]('SquareRecording\x20not\x20found');}if(_0x5e0fe1[_0x4568('0x48')]){return _0x2e84d4['download'](_0x397981,_0x5e0fe1[_0x4568('0x48')]+path[_0x4568('0x4f')](_0x397981),function(){if(_0xe27223){fs['unlink'](_0x397981);}});}else{return _0x2e84d4[_0x4568('0x44')](_0x397981,function(_0x23549f){if(_0xe27223){fs['unlink'](_0x397981);}});}}})[_0x4568('0x43')](function(_0x1d7d3f){if(_0x1d7d3f[_0x4568('0x50')]===_0x4568('0x51')){_0x2e84d4['status'](0x194)['send'](_0x4568('0x52'));}else{return handleError(_0x2e84d4,null);}});};exports['destroy']=function(_0xa86413,_0x5b5c91){return db[_0x4568('0x26')][_0x4568('0x3f')]({'where':{'id':_0xa86413['params']['id']}})[_0x4568('0x20')](function(_0x5978ed){if(!_0x5978ed)throw new ReferenceError(_0x4568('0x53'));return _0x5978ed;})[_0x4568('0x20')](function(_0x377fd0){var _0xde9b3=_0x377fd0['savePath'];logger['info'](_0x4568('0x54'),_0xde9b3);if(!_[_0x4568('0x55')](_0x377fd0[_0x4568('0x47')])&&fs[_0x4568('0x4b')](_0xde9b3)){logger[_0x4568('0x56')](_0x4568('0x57')+_0xde9b3+_0x4568('0x58'));fs[_0x4568('0x59')](_0xde9b3);}_0xde9b3=_0xde9b3+_0x4568('0x5a');if(!_['isNil'](_0x377fd0[_0x4568('0x47')])&&fs[_0x4568('0x4b')](_0xde9b3)){logger[_0x4568('0x56')](_0x4568('0x57')+_0xde9b3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0xde9b3);}return _0x377fd0;})['then'](function(_0x4705c5){if(!_0x4705c5)throw new InternalError();return _0x4705c5[_0x4568('0x21')]();})['then'](function(){_0x5b5c91['status'](0xcc)['end']();})[_0x4568('0x43')](handleError(_0x5b5c91,null));}; \ No newline at end of file +var _0xe67b=['catch','params','length','find','create','body','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','message','send','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','destroy','then','end','error','name','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','SquareRecording','includeAll','findAll','rows'];(function(_0x910b22,_0x57e873){var _0x1f594d=function(_0x19dfa3){while(--_0x19dfa3){_0x910b22['push'](_0x910b22['shift']());}};_0x1f594d(++_0x57e873);}(_0xe67b,0x81));var _0xbe67=function(_0x2ab365,_0xa3812e){_0x2ab365=_0x2ab365-0x0;var _0x49fef3=_0xe67b[_0x2ab365];return _0x49fef3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbe67('0x0'));var rimraf=require(_0xbe67('0x1'));var zipdir=require(_0xbe67('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe67('0x3'));var moment=require(_0xbe67('0x4'));var BPromise=require(_0xbe67('0x5'));var Mustache=require(_0xbe67('0x6'));var util=require(_0xbe67('0x7'));var path=require(_0xbe67('0x8'));var sox=require(_0xbe67('0x9'));var csv=require(_0xbe67('0xa'));var ejs=require(_0xbe67('0xb'));var fs=require('fs');var _=require(_0xbe67('0xc'));var squel=require(_0xbe67('0xd'));var crypto=require(_0xbe67('0xe'));var jsforce=require(_0xbe67('0xf'));var deskjs=require(_0xbe67('0x10'));var toCsv=require(_0xbe67('0xa'));var querystring=require('querystring');var Papa=require(_0xbe67('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbe67('0x12'));var as=require(_0xbe67('0x13'));var hardwareService=require(_0xbe67('0x14'));var logger=require(_0xbe67('0x15'))('api');var utils=require(_0xbe67('0x16'));var config=require(_0xbe67('0x17'));var licenseUtil=require(_0xbe67('0x18'));var db=require(_0xbe67('0x19'))['db'];function respondWithStatusCode(_0x996307,_0x18746e){_0x18746e=_0x18746e||0xcc;return function(_0x2ab734){if(_0x2ab734){return _0x996307[_0xbe67('0x1a')](_0x18746e);}return _0x996307[_0xbe67('0x1b')](_0x18746e)['end']();};}function respondWithResult(_0x524a55,_0x3f6d09){_0x3f6d09=_0x3f6d09||0xc8;return function(_0x515949){if(_0x515949){return _0x524a55[_0xbe67('0x1b')](_0x3f6d09)[_0xbe67('0x1c')](_0x515949);}};}function respondWithFilteredResult(_0x29727a,_0x43389c){return function(_0x5bcc02){if(_0x5bcc02){var _0x559c6b=_0x5bcc02[_0xbe67('0x1d')],_0x22f52b=_0x43389c[_0xbe67('0x1e')],_0x3b4592=_0x43389c[_0xbe67('0x1e')]+_0x43389c[_0xbe67('0x1f')],_0x33bd14;if(_0x3b4592>=_0x559c6b){_0x3b4592=_0x559c6b;_0x33bd14=0xc8;}else{_0x33bd14=0xce;}_0x29727a[_0xbe67('0x1b')](_0x33bd14);return _0x29727a[_0xbe67('0x20')]('Content-Range',_0x22f52b+'-'+_0x3b4592+'/'+_0x559c6b)[_0xbe67('0x1c')](_0x5bcc02);}return null;};}function patchUpdates(_0x2e2936){return function(_0x4a55cd){try{jsonpatch[_0xbe67('0x21')](_0x4a55cd,_0x2e2936,!![]);}catch(_0x476381){return BPromise[_0xbe67('0x22')](_0x476381);}return _0x4a55cd[_0xbe67('0x23')]();};}function saveUpdates(_0x930655,_0x477718){return function(_0xf90481){if(_0xf90481){return _0xf90481[_0xbe67('0x24')](_0x930655)['then'](function(_0x3121f3){return _0x3121f3;});}return null;};}function removeEntity(_0x5d5633,_0x463c9c){return function(_0x521356){if(_0x521356){return _0x521356[_0xbe67('0x25')]()[_0xbe67('0x26')](function(){_0x5d5633[_0xbe67('0x1b')](0xcc)[_0xbe67('0x27')]();});}};}function handleEntityNotFound(_0x4e0aed,_0x51014a){return function(_0x45dde3){if(!_0x45dde3){_0x4e0aed[_0xbe67('0x1a')](0x194);}return _0x45dde3;};}function handleError(_0x2ae0f8,_0x135ee0){_0x135ee0=_0x135ee0||0x1f4;return function(_0x14f420){logger[_0xbe67('0x28')](_0x14f420['stack']);if(_0x14f420[_0xbe67('0x29')]){delete _0x14f420[_0xbe67('0x29')];}_0x2ae0f8['status'](_0x135ee0)['send'](_0x14f420);};}exports[_0xbe67('0x2a')]=function(_0x136ba1,_0xab4f22){var _0x3e7a45={},_0xc1c59f={},_0x1557db={'count':0x0,'rows':[]};var _0x268059=_[_0xbe67('0x2b')](db['SquareRecording'][_0xbe67('0x2c')],function(_0x2cdae7){return{'name':_0x2cdae7['fieldName'],'type':_0x2cdae7[_0xbe67('0x2d')][_0xbe67('0x2e')]};});_0xc1c59f[_0xbe67('0x2f')]=_[_0xbe67('0x2b')](_0x268059,_0xbe67('0x29'));_0xc1c59f['query']=_[_0xbe67('0x30')](_0x136ba1[_0xbe67('0x31')]);_0xc1c59f[_0xbe67('0x32')]=_[_0xbe67('0x33')](_0xc1c59f['model'],_0xc1c59f['query']);_0x3e7a45[_0xbe67('0x34')]=_['intersection'](_0xc1c59f[_0xbe67('0x2f')],qs[_0xbe67('0x35')](_0x136ba1[_0xbe67('0x31')][_0xbe67('0x35')]));_0x3e7a45[_0xbe67('0x34')]=_0x3e7a45[_0xbe67('0x34')]['length']?_0x3e7a45[_0xbe67('0x34')]:_0xc1c59f[_0xbe67('0x2f')];if(!_0x136ba1['query'][_0xbe67('0x36')](_0xbe67('0x37'))){_0x3e7a45[_0xbe67('0x1f')]=qs[_0xbe67('0x1f')](_0x136ba1['query'][_0xbe67('0x1f')]);_0x3e7a45['offset']=qs[_0xbe67('0x1e')](_0x136ba1[_0xbe67('0x31')]['offset']);}_0x3e7a45[_0xbe67('0x38')]=qs['sort'](_0x136ba1[_0xbe67('0x31')][_0xbe67('0x39')]);_0x3e7a45[_0xbe67('0x3a')]=qs[_0xbe67('0x32')](_[_0xbe67('0x3b')](_0x136ba1['query'],_0xc1c59f[_0xbe67('0x32')]),_0x268059);if(_0x136ba1[_0xbe67('0x31')][_0xbe67('0x3c')]){_0x3e7a45[_0xbe67('0x3a')]=_[_0xbe67('0x3d')](_0x3e7a45[_0xbe67('0x3a')],{'$or':_['map'](_0x268059,function(_0x43ec9d){if(_0x43ec9d[_0xbe67('0x2d')]!=='VIRTUAL'){var _0xa71aa7={};_0xa71aa7[_0x43ec9d['name']]={'$like':'%'+_0x136ba1[_0xbe67('0x31')][_0xbe67('0x3c')]+'%'};return _0xa71aa7;}})});}_0x3e7a45=_[_0xbe67('0x3d')]({},_0x3e7a45,_0x136ba1[_0xbe67('0x3e')]);var _0x3bc77e={'where':_0x3e7a45[_0xbe67('0x3a')]};return db[_0xbe67('0x3f')][_0xbe67('0x1d')](_0x3bc77e)[_0xbe67('0x26')](function(_0xe726fd){_0x1557db[_0xbe67('0x1d')]=_0xe726fd;if(_0x136ba1[_0xbe67('0x31')][_0xbe67('0x40')]){_0x3e7a45['include']=[{'all':!![]}];}return db[_0xbe67('0x3f')][_0xbe67('0x41')](_0x3e7a45);})[_0xbe67('0x26')](function(_0x55c362){_0x1557db[_0xbe67('0x42')]=_0x55c362;return _0x1557db;})[_0xbe67('0x26')](respondWithFilteredResult(_0xab4f22,_0x3e7a45))[_0xbe67('0x43')](handleError(_0xab4f22,null));};exports['show']=function(_0x17e1d2,_0x1f85b5){var _0x546d47={'raw':!![],'where':{'id':_0x17e1d2[_0xbe67('0x44')]['id']}},_0x21e70c={};_0x21e70c[_0xbe67('0x2f')]=_[_0xbe67('0x30')](db['SquareRecording'][_0xbe67('0x2c')]);_0x21e70c[_0xbe67('0x31')]=_[_0xbe67('0x30')](_0x17e1d2[_0xbe67('0x31')]);_0x21e70c[_0xbe67('0x32')]=_['intersection'](_0x21e70c[_0xbe67('0x2f')],_0x21e70c[_0xbe67('0x31')]);_0x546d47[_0xbe67('0x34')]=_['intersection'](_0x21e70c[_0xbe67('0x2f')],qs[_0xbe67('0x35')](_0x17e1d2['query'][_0xbe67('0x35')]));_0x546d47[_0xbe67('0x34')]=_0x546d47['attributes'][_0xbe67('0x45')]?_0x546d47[_0xbe67('0x34')]:_0x21e70c[_0xbe67('0x2f')];if(_0x17e1d2[_0xbe67('0x31')][_0xbe67('0x40')]){_0x546d47['include']=[{'all':!![]}];}_0x546d47=_['merge']({},_0x546d47,_0x17e1d2[_0xbe67('0x3e')]);return db['SquareRecording'][_0xbe67('0x46')](_0x546d47)[_0xbe67('0x26')](handleEntityNotFound(_0x1f85b5,null))[_0xbe67('0x26')](respondWithResult(_0x1f85b5,null))[_0xbe67('0x43')](handleError(_0x1f85b5,null));};exports[_0xbe67('0x47')]=function(_0x123d96,_0x2c4000){return db[_0xbe67('0x3f')][_0xbe67('0x47')](_0x123d96[_0xbe67('0x48')],{})[_0xbe67('0x26')](respondWithResult(_0x2c4000,0xc9))[_0xbe67('0x43')](handleError(_0x2c4000,null));};exports[_0xbe67('0x24')]=function(_0x5e8a61,_0x48f886){if(_0x5e8a61[_0xbe67('0x48')]['id']){delete _0x5e8a61['body']['id'];}return db[_0xbe67('0x3f')][_0xbe67('0x46')]({'where':{'id':_0x5e8a61[_0xbe67('0x44')]['id']}})[_0xbe67('0x26')](handleEntityNotFound(_0x48f886,null))[_0xbe67('0x26')](saveUpdates(_0x5e8a61['body'],null))[_0xbe67('0x26')](respondWithResult(_0x48f886,null))[_0xbe67('0x43')](handleError(_0x48f886,null));};exports[_0xbe67('0x49')]=function(_0x3cecc0,_0x39109b,_0x205dba){var _0x57b695=require(_0xbe67('0x4a'));var _0xad66a=![];var _0x1e2f8a={};if(_0x3cecc0['query'][_0xbe67('0x2d')]&&_0x3cecc0[_0xbe67('0x31')][_0xbe67('0x2d')]===_0xbe67('0x4b')){_0x1e2f8a[_0xbe67('0x4b')]=_0x3cecc0['params']['id'];}else{_0x1e2f8a['id']=_0x3cecc0['params']['id'];}return db['SquareRecording']['find']({'where':_0x1e2f8a,'attributes':['id',_0xbe67('0x4c'),'filename'],'raw':!![]})[_0xbe67('0x26')](handleEntityNotFound(_0x39109b,null))['then'](function(_0x1a1070){if(_0x1a1070){var _0xfcac89=_0x1a1070[_0xbe67('0x4c')];var _0x4940fa=util[_0xbe67('0x4d')](_0xbe67('0x4e'),_0xfcac89);if(fs[_0xbe67('0x4f')](_0x4940fa)){_0xad66a=!![];return _0x57b695[_0xbe67('0x50')](_0x4940fa,_0xfcac89,config[_0xbe67('0x51')][_0xbe67('0x52')])[_0xbe67('0x26')](function(){return _0x1a1070;});}return _0x1a1070;}})[_0xbe67('0x26')](function(_0x482855){if(_0x482855){var _0x5619d8=_0x482855[_0xbe67('0x4c')];if(!fs['existsSync'](_0x5619d8)){throw new db[(_0xbe67('0x53'))][(_0xbe67('0x54'))]('SquareRecording\x20not\x20found');}if(_0x482855['filename']){return _0x39109b[_0xbe67('0x49')](_0x5619d8,_0x482855[_0xbe67('0x55')]+path[_0xbe67('0x56')](_0x5619d8),function(){if(_0xad66a){fs[_0xbe67('0x57')](_0x5619d8);}});}else{return _0x39109b[_0xbe67('0x49')](_0x5619d8,function(_0x3c4d8e){if(_0xad66a){fs[_0xbe67('0x57')](_0x5619d8);}});}}})[_0xbe67('0x43')](function(_0x2b9817){if(_0x2b9817[_0xbe67('0x58')]==='SquareRecording\x20not\x20found'){_0x39109b['status'](0x194)[_0xbe67('0x59')]('Not\x20found');}else{return handleError(_0x39109b,null);}});};exports[_0xbe67('0x25')]=function(_0x1be75a,_0x3c551a){return db[_0xbe67('0x3f')][_0xbe67('0x46')]({'where':{'id':_0x1be75a[_0xbe67('0x44')]['id']}})['then'](function(_0x3692d4){if(!_0x3692d4)throw new ReferenceError(_0xbe67('0x5a'));return _0x3692d4;})['then'](function(_0x40e489){var _0x5f384b=_0x40e489[_0xbe67('0x4c')];logger['info'](_0xbe67('0x5b'),_0x5f384b);if(!_[_0xbe67('0x5c')](_0x40e489[_0xbe67('0x4c')])&&fs[_0xbe67('0x4f')](_0x5f384b)){logger[_0xbe67('0x5d')](_0xbe67('0x5e')+_0x5f384b+_0xbe67('0x5f'));fs[_0xbe67('0x60')](_0x5f384b);}_0x5f384b=_0x5f384b+_0xbe67('0x61');if(!_[_0xbe67('0x5c')](_0x40e489[_0xbe67('0x4c')])&&fs[_0xbe67('0x4f')](_0x5f384b)){logger['info'](_0xbe67('0x5e')+_0x5f384b+_0xbe67('0x5f'));fs[_0xbe67('0x60')](_0x5f384b);}return _0x40e489;})[_0xbe67('0x26')](function(_0x1dd0d2){if(!_0x1dd0d2)throw new InternalError();return _0x1dd0d2[_0xbe67('0x25')]();})['then'](function(){_0x3c551a[_0xbe67('0x1b')](0xcc)['end']();})[_0xbe67('0x43')](handleError(_0x3c551a,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 6a37b77..8673887 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 _0xe511=['bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','lodash','util','api'];(function(_0x12d6e1,_0x14e7e1){var _0x2663c0=function(_0x1129dd){while(--_0x1129dd){_0x12d6e1['push'](_0x12d6e1['shift']());}};_0x2663c0(++_0x14e7e1);}(_0xe511,0x16f));var _0x1e51=function(_0x26e3cb,_0x3e38c3){_0x26e3cb=_0x26e3cb-0x0;var _0x15e990=_0xe511[_0x26e3cb];return _0x15e990;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var logger=require('../../config/logger')(_0x1e51('0x2'));var moment=require('moment');var BPromise=require(_0x1e51('0x3'));var rp=require(_0x1e51('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var attributes=require(_0x1e51('0x7'));module[_0x1e51('0x8')]=function(_0x480cca,_0x26b22c){return _0x480cca[_0x1e51('0x9')]('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc9b=['define','square_recordings','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0xe61544,_0x30b2d2){var _0x58cc3e=function(_0x4fa6c7){while(--_0x4fa6c7){_0xe61544['push'](_0xe61544['shift']());}};_0x58cc3e(++_0x30b2d2);}(_0xdc9b,0x70));var _0xbdc9=function(_0x3565e7,_0x23163a){_0x3565e7=_0x3565e7-0x0;var _0x498ee8=_0xdc9b[_0x3565e7];return _0x498ee8;};'use strict';var _=require(_0xbdc9('0x0'));var util=require(_0xbdc9('0x1'));var logger=require(_0xbdc9('0x2'))('api');var moment=require(_0xbdc9('0x3'));var BPromise=require(_0xbdc9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbdc9('0x5'));var config=require(_0xbdc9('0x6'));var attributes=require('./squareRecording.attributes');module[_0xbdc9('0x7')]=function(_0x3065a8,_0x5bf8bc){return _0x3065a8[_0xbdc9('0x8')]('SquareRecording',attributes,{'tableName':_0xbdc9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index a7961ad..b9945d9 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 _0x5c39=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateSquareRecording','SquareRecording','body','options','raw','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c39,0xc3));var _0x95c3=function(_0x58cfd6,_0x4fc792){_0x58cfd6=_0x58cfd6-0x0;var _0x4ea1b0=_0x5c39[_0x58cfd6];return _0x4ea1b0;};'use strict';var _=require(_0x95c3('0x0'));var util=require(_0x95c3('0x1'));var moment=require(_0x95c3('0x2'));var BPromise=require('bluebird');var rs=require(_0x95c3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95c3('0x4'))['db'];var utils=require(_0x95c3('0x5'));var logger=require(_0x95c3('0x6'))(_0x95c3('0x7'));var config=require(_0x95c3('0x8'));var jayson=require(_0x95c3('0x9'));var client=jayson[_0x95c3('0xa')][_0x95c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3dba98,_0x316692,_0x16f6b3){return new BPromise(function(_0x28af76,_0x4924d5){return client[_0x95c3('0xc')](_0x3dba98,_0x16f6b3)[_0x95c3('0xd')](function(_0x21f8fd){logger[_0x95c3('0xe')](_0x95c3('0xf'),_0x316692,_0x95c3('0x10'));logger[_0x95c3('0x11')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x316692,'request\x20sent',JSON[_0x95c3('0x12')](_0x21f8fd));if(_0x21f8fd['error']){if(_0x21f8fd[_0x95c3('0x13')][_0x95c3('0x14')]===0x1f4){logger['error'](_0x95c3('0xf'),_0x316692,_0x21f8fd[_0x95c3('0x13')][_0x95c3('0x15')]);return _0x4924d5(_0x21f8fd[_0x95c3('0x13')][_0x95c3('0x15')]);}logger[_0x95c3('0x13')](_0x95c3('0xf'),_0x316692,_0x21f8fd[_0x95c3('0x13')][_0x95c3('0x15')]);return _0x28af76(_0x21f8fd[_0x95c3('0x13')]['message']);}else{logger[_0x95c3('0xe')](_0x95c3('0xf'),_0x316692,_0x95c3('0x10'));_0x28af76(_0x21f8fd['result'][_0x95c3('0x15')]);}})[_0x95c3('0x16')](function(_0x3a66ab){logger[_0x95c3('0x13')]('SquareRecording,\x20%s,\x20%s',_0x316692,_0x3a66ab);_0x4924d5(_0x3a66ab);});});}exports[_0x95c3('0x17')]=function(_0x29a555){var _0x47fc43=this;return new Promise(function(_0x400c3f,_0x4d9041){return db[_0x95c3('0x18')]['create'](_0x29a555[_0x95c3('0x19')],{'raw':_0x29a555[_0x95c3('0x1a')]?_0x29a555[_0x95c3('0x1a')][_0x95c3('0x1b')]===undefined?!![]:![]:!![]})[_0x95c3('0xd')](function(_0xcf11a4){logger[_0x95c3('0xe')]('CreateSquareRecording',_0x29a555);logger['debug']('CreateSquareRecording',_0x29a555,JSON[_0x95c3('0x12')](_0xcf11a4));_0x400c3f(_0xcf11a4);})[_0x95c3('0x16')](function(_0xa1e6e5){logger[_0x95c3('0x13')](_0x95c3('0x17'),_0xa1e6e5[_0x95c3('0x15')],_0x29a555);_0x4d9041(_0x47fc43[_0x95c3('0x13')](0x1f4,_0xa1e6e5[_0x95c3('0x15')]));});});}; \ No newline at end of file +var _0x0a7f=['CreateSquareRecording','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','catch','SquareRecording','create','body','options','raw'];(function(_0x566cb1,_0xf25323){var _0x385b2b=function(_0x2bd46c){while(--_0x2bd46c){_0x566cb1['push'](_0x566cb1['shift']());}};_0x385b2b(++_0xf25323);}(_0x0a7f,0xc6));var _0xf0a7=function(_0x3e1438,_0xc6962a){_0x3e1438=_0x3e1438-0x0;var _0x39ee96=_0x0a7f[_0x3e1438];return _0x39ee96;};'use strict';var _=require(_0xf0a7('0x0'));var util=require(_0xf0a7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf0a7('0x2'));var fs=require('fs');var Redis=require(_0xf0a7('0x3'));var db=require(_0xf0a7('0x4'))['db'];var utils=require(_0xf0a7('0x5'));var logger=require(_0xf0a7('0x6'))('rpc');var config=require(_0xf0a7('0x7'));var jayson=require(_0xf0a7('0x8'));var client=jayson['client'][_0xf0a7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cf676,_0x5ccc7a,_0x49aa17){return new BPromise(function(_0x54d12d,_0x23208e){return client[_0xf0a7('0xa')](_0x1cf676,_0x49aa17)[_0xf0a7('0xb')](function(_0x1fc299){logger[_0xf0a7('0xc')]('SquareRecording,\x20%s,\x20%s',_0x5ccc7a,_0xf0a7('0xd'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x5ccc7a,_0xf0a7('0xd'),JSON[_0xf0a7('0xe')](_0x1fc299));if(_0x1fc299[_0xf0a7('0xf')]){if(_0x1fc299[_0xf0a7('0xf')][_0xf0a7('0x10')]===0x1f4){logger[_0xf0a7('0xf')](_0xf0a7('0x11'),_0x5ccc7a,_0x1fc299[_0xf0a7('0xf')][_0xf0a7('0x12')]);return _0x23208e(_0x1fc299[_0xf0a7('0xf')][_0xf0a7('0x12')]);}logger[_0xf0a7('0xf')](_0xf0a7('0x11'),_0x5ccc7a,_0x1fc299[_0xf0a7('0xf')][_0xf0a7('0x12')]);return _0x54d12d(_0x1fc299['error']['message']);}else{logger[_0xf0a7('0xc')](_0xf0a7('0x11'),_0x5ccc7a,_0xf0a7('0xd'));_0x54d12d(_0x1fc299[_0xf0a7('0x13')][_0xf0a7('0x12')]);}})[_0xf0a7('0x14')](function(_0x471e56){logger[_0xf0a7('0xf')]('SquareRecording,\x20%s,\x20%s',_0x5ccc7a,_0x471e56);_0x23208e(_0x471e56);});});}exports['CreateSquareRecording']=function(_0x25dad9){var _0x27445f=this;return new Promise(function(_0x2aeb06,_0x52ed9c){return db[_0xf0a7('0x15')][_0xf0a7('0x16')](_0x25dad9[_0xf0a7('0x17')],{'raw':_0x25dad9['options']?_0x25dad9[_0xf0a7('0x18')][_0xf0a7('0x19')]===undefined?!![]:![]:!![]})[_0xf0a7('0xb')](function(_0x4013e3){logger[_0xf0a7('0xc')](_0xf0a7('0x1a'),_0x25dad9);logger[_0xf0a7('0x1b')](_0xf0a7('0x1a'),_0x25dad9,JSON[_0xf0a7('0xe')](_0x4013e3));_0x2aeb06(_0x4013e3);})[_0xf0a7('0x14')](function(_0x2ca14f){logger[_0xf0a7('0xf')](_0xf0a7('0x1a'),_0x2ca14f['message'],_0x25dad9);_0x52ed9c(_0x27445f[_0xf0a7('0xf')](0x1f4,_0x2ca14f[_0xf0a7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index b0e4e01..adbf67c 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 _0x1fc4=['create','update','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./squareReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post'];(function(_0x4e2bfb,_0x3a1897){var _0x5965ae=function(_0x41f9f2){while(--_0x41f9f2){_0x4e2bfb['push'](_0x4e2bfb['shift']());}};_0x5965ae(++_0x3a1897);}(_0x1fc4,0x1bc));var _0x41fc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x1fc4[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x41fc('0x0'));var util=require(_0x41fc('0x1'));var path=require(_0x41fc('0x2'));var timeout=require(_0x41fc('0x3'));var express=require(_0x41fc('0x4'));var router=express[_0x41fc('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x41fc('0x6'));var config=require('../../config/environment');var controller=require(_0x41fc('0x7'));router['get']('/',auth[_0x41fc('0x8')](),controller[_0x41fc('0x9')]);router[_0x41fc('0xa')](_0x41fc('0xb'),auth[_0x41fc('0x8')](),controller[_0x41fc('0xc')]);router[_0x41fc('0xa')](_0x41fc('0xd'),auth[_0x41fc('0x8')](),controller['show']);router[_0x41fc('0xe')]('/',auth[_0x41fc('0x8')](),controller[_0x41fc('0xf')]);router['put'](_0x41fc('0xd'),auth['isAuthenticated'](),controller[_0x41fc('0x10')]);router['delete'](_0x41fc('0xd'),auth[_0x41fc('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6072=['delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','post','create','put','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6072,0x1bc));var _0x2607=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x6072[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x2607('0x0'));var util=require(_0x2607('0x1'));var path=require('path');var timeout=require(_0x2607('0x2'));var express=require(_0x2607('0x3'));var router=express['Router']();var auth=require(_0x2607('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2607('0x5'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x2607('0x6')](),controller['index']);router[_0x2607('0x7')](_0x2607('0x8'),auth[_0x2607('0x6')](),controller[_0x2607('0x9')]);router[_0x2607('0x7')](_0x2607('0xa'),auth[_0x2607('0x6')](),controller['show']);router[_0x2607('0xb')]('/',auth[_0x2607('0x6')](),controller[_0x2607('0xc')]);router[_0x2607('0xd')](_0x2607('0xa'),auth[_0x2607('0x6')](),controller[_0x2607('0xe')]);router[_0x2607('0xf')](_0x2607('0xa'),auth['isAuthenticated'](),controller[_0x2607('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 ec6f866..bb89f34 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 _0x03d0=['STRING','DATE','BOOLEAN','exports'];(function(_0x50cd36,_0x2b77f7){var _0x1c8ffd=function(_0xecc66b){while(--_0xecc66b){_0x50cd36['push'](_0x50cd36['shift']());}};_0x1c8ffd(++_0x2b77f7);}(_0x03d0,0x183));var _0x003d=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x03d0[_0x4b2863];return _0x567d67;};'use strict';var Sequelize=require('sequelize');module[_0x003d('0x0')]={'network':{'type':Sequelize[_0x003d('0x1')]},'network_script':{'type':Sequelize[_0x003d('0x1')]},'request':{'type':Sequelize[_0x003d('0x1')]},'channel':{'type':Sequelize[_0x003d('0x1')]},'language':{'type':Sequelize[_0x003d('0x1')]},'type':{'type':Sequelize[_0x003d('0x1')]},'uniqueid':{'type':Sequelize[_0x003d('0x1')]},'version':{'type':Sequelize[_0x003d('0x1')]},'callerid':{'type':Sequelize[_0x003d('0x1')]},'calleridname':{'type':Sequelize[_0x003d('0x1')]},'callingpres':{'type':Sequelize[_0x003d('0x1')]},'callingani2':{'type':Sequelize[_0x003d('0x1')]},'callington':{'type':Sequelize[_0x003d('0x1')]},'callingtns':{'type':Sequelize[_0x003d('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x003d('0x1')]},'context':{'type':Sequelize[_0x003d('0x1')]},'extension':{'type':Sequelize[_0x003d('0x1')]},'priority':{'type':Sequelize[_0x003d('0x1')]},'enhanced':{'type':Sequelize[_0x003d('0x1')]},'accountcode':{'type':Sequelize[_0x003d('0x1')]},'threadid':{'type':Sequelize[_0x003d('0x1')]},'project_name':{'type':Sequelize[_0x003d('0x1')]},'joinAt':{'type':Sequelize[_0x003d('0x2')]},'leaveAt':{'type':Sequelize[_0x003d('0x2')]},'bot':{'type':Sequelize[_0x003d('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xdb8f=['DATE','BOOLEAN','sequelize','STRING'];(function(_0x5d4817,_0x3bbdff){var _0x39bdd7=function(_0x433124){while(--_0x433124){_0x5d4817['push'](_0x5d4817['shift']());}};_0x39bdd7(++_0x3bbdff);}(_0xdb8f,0x15e));var _0xfdb8=function(_0xa3c06b,_0x490f99){_0xa3c06b=_0xa3c06b-0x0;var _0x33aa1d=_0xdb8f[_0xa3c06b];return _0x33aa1d;};'use strict';var Sequelize=require(_0xfdb8('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xfdb8('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xfdb8('0x1')]},'type':{'type':Sequelize[_0xfdb8('0x1')]},'uniqueid':{'type':Sequelize[_0xfdb8('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xfdb8('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xfdb8('0x1')]},'callingani2':{'type':Sequelize[_0xfdb8('0x1')]},'callington':{'type':Sequelize[_0xfdb8('0x1')]},'callingtns':{'type':Sequelize[_0xfdb8('0x1')]},'dnid':{'type':Sequelize[_0xfdb8('0x1')]},'rdnis':{'type':Sequelize[_0xfdb8('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xfdb8('0x1')]},'enhanced':{'type':Sequelize[_0xfdb8('0x1')]},'accountcode':{'type':Sequelize[_0xfdb8('0x1')]},'threadid':{'type':Sequelize[_0xfdb8('0x1')]},'project_name':{'type':Sequelize[_0xfdb8('0x1')]},'joinAt':{'type':Sequelize[_0xfdb8('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xfdb8('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 4901a2e..cd40253 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 _0x032e=['sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','SquareReport','rawAttributes','type','keys','query','filters','attributes','intersection','model','fields','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','params','length','include','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb'];(function(_0x1cb1fc,_0x55afb2){var _0x1c0fbf=function(_0x2deb56){while(--_0x2deb56){_0x1cb1fc['push'](_0x1cb1fc['shift']());}};_0x1c0fbf(++_0x55afb2);}(_0x032e,0x1cc));var _0xe032=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x032e[_0x484e36];return _0xafc85d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe032('0x0'));var rimraf=require(_0xe032('0x1'));var zipdir=require(_0xe032('0x2'));var jsonpatch=require(_0xe032('0x3'));var rp=require(_0xe032('0x4'));var moment=require('moment');var BPromise=require(_0xe032('0x5'));var Mustache=require(_0xe032('0x6'));var util=require(_0xe032('0x7'));var path=require(_0xe032('0x8'));var sox=require(_0xe032('0x9'));var csv=require(_0xe032('0xa'));var ejs=require(_0xe032('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe032('0xc'));var crypto=require(_0xe032('0xd'));var jsforce=require(_0xe032('0xe'));var deskjs=require(_0xe032('0xf'));var toCsv=require(_0xe032('0xa'));var querystring=require(_0xe032('0x10'));var Papa=require('papaparse');var Redis=require(_0xe032('0x11'));var authService=require(_0xe032('0x12'));var qs=require(_0xe032('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe032('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe032('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe032('0x16'))['db'];function respondWithStatusCode(_0x48555b,_0x405184){_0x405184=_0x405184||0xcc;return function(_0x12c535){if(_0x12c535){return _0x48555b[_0xe032('0x17')](_0x405184);}return _0x48555b[_0xe032('0x18')](_0x405184)[_0xe032('0x19')]();};}function respondWithResult(_0x140e56,_0x10aac3){_0x10aac3=_0x10aac3||0xc8;return function(_0x1cc0bb){if(_0x1cc0bb){return _0x140e56[_0xe032('0x18')](_0x10aac3)[_0xe032('0x1a')](_0x1cc0bb);}};}function respondWithFilteredResult(_0x23883c,_0x16a36e){return function(_0x3f3010){if(_0x3f3010){var _0x40a175=_0x3f3010['count'],_0x2dc16f=_0x16a36e[_0xe032('0x1b')],_0x2e868b=_0x16a36e['offset']+_0x16a36e[_0xe032('0x1c')],_0x49c0c6;if(_0x2e868b>=_0x40a175){_0x2e868b=_0x40a175;_0x49c0c6=0xc8;}else{_0x49c0c6=0xce;}_0x23883c[_0xe032('0x18')](_0x49c0c6);return _0x23883c[_0xe032('0x1d')](_0xe032('0x1e'),_0x2dc16f+'-'+_0x2e868b+'/'+_0x40a175)[_0xe032('0x1a')](_0x3f3010);}return null;};}function patchUpdates(_0x3ca2d0){return function(_0x39031b){try{jsonpatch[_0xe032('0x1f')](_0x39031b,_0x3ca2d0,!![]);}catch(_0x1a6281){return BPromise[_0xe032('0x20')](_0x1a6281);}return _0x39031b[_0xe032('0x21')]();};}function saveUpdates(_0x230656,_0x35093e){return function(_0x3930a3){if(_0x3930a3){return _0x3930a3[_0xe032('0x22')](_0x230656)[_0xe032('0x23')](function(_0x35c3a9){return _0x35c3a9;});}return null;};}function removeEntity(_0x448e8a,_0x39f019){return function(_0x5e37f9){if(_0x5e37f9){return _0x5e37f9[_0xe032('0x24')]()['then'](function(){_0x448e8a[_0xe032('0x18')](0xcc)[_0xe032('0x19')]();});}};}function handleEntityNotFound(_0x330030,_0x36b8f7){return function(_0x51d0e5){if(!_0x51d0e5){_0x330030[_0xe032('0x17')](0x194);}return _0x51d0e5;};}function handleError(_0x394213,_0x25aa53){_0x25aa53=_0x25aa53||0x1f4;return function(_0x52db98){logger['error'](_0x52db98[_0xe032('0x25')]);if(_0x52db98[_0xe032('0x26')]){delete _0x52db98[_0xe032('0x26')];}_0x394213[_0xe032('0x18')](_0x25aa53)[_0xe032('0x27')](_0x52db98);};}exports['index']=function(_0x3542c7,_0x19226c){var _0x282ec0={},_0x5dad93={},_0x43c355={'count':0x0,'rows':[]};var _0x5b917d=_[_0xe032('0x28')](db[_0xe032('0x29')][_0xe032('0x2a')],function(_0x1911fb){return{'name':_0x1911fb['fieldName'],'type':_0x1911fb[_0xe032('0x2b')]['key']};});_0x5dad93['model']=_['map'](_0x5b917d,'name');_0x5dad93['query']=_[_0xe032('0x2c')](_0x3542c7[_0xe032('0x2d')]);_0x5dad93[_0xe032('0x2e')]=_['intersection'](_0x5dad93['model'],_0x5dad93[_0xe032('0x2d')]);_0x282ec0[_0xe032('0x2f')]=_[_0xe032('0x30')](_0x5dad93[_0xe032('0x31')],qs[_0xe032('0x32')](_0x3542c7[_0xe032('0x2d')][_0xe032('0x32')]));_0x282ec0[_0xe032('0x2f')]=_0x282ec0[_0xe032('0x2f')]['length']?_0x282ec0['attributes']:_0x5dad93[_0xe032('0x31')];if(!_0x3542c7[_0xe032('0x2d')]['hasOwnProperty'](_0xe032('0x33'))){_0x282ec0[_0xe032('0x1c')]=qs[_0xe032('0x1c')](_0x3542c7[_0xe032('0x2d')][_0xe032('0x1c')]);_0x282ec0[_0xe032('0x1b')]=qs[_0xe032('0x1b')](_0x3542c7[_0xe032('0x2d')][_0xe032('0x1b')]);}_0x282ec0['order']=qs[_0xe032('0x34')](_0x3542c7[_0xe032('0x2d')][_0xe032('0x34')]);_0x282ec0[_0xe032('0x35')]=qs[_0xe032('0x2e')](_[_0xe032('0x36')](_0x3542c7[_0xe032('0x2d')],_0x5dad93[_0xe032('0x2e')]),_0x5b917d);if(_0x3542c7['query']['filter']){_0x282ec0[_0xe032('0x35')]=_[_0xe032('0x37')](_0x282ec0[_0xe032('0x35')],{'$or':_[_0xe032('0x28')](_0x5b917d,function(_0x4bc210){if(_0x4bc210[_0xe032('0x2b')]!==_0xe032('0x38')){var _0x33807d={};_0x33807d[_0x4bc210[_0xe032('0x26')]]={'$like':'%'+_0x3542c7[_0xe032('0x2d')][_0xe032('0x39')]+'%'};return _0x33807d;}})});}_0x282ec0=_[_0xe032('0x37')]({},_0x282ec0,_0x3542c7[_0xe032('0x3a')]);var _0x5401d3={'where':_0x282ec0[_0xe032('0x35')]};return db['SquareReport'][_0xe032('0x3b')](_0x5401d3)[_0xe032('0x23')](function(_0x13c3fd){_0x43c355[_0xe032('0x3b')]=_0x13c3fd;if(_0x3542c7[_0xe032('0x2d')][_0xe032('0x3c')]){_0x282ec0['include']=[{'all':!![]}];}return db[_0xe032('0x29')]['findAll'](_0x282ec0);})['then'](function(_0x315dc3){_0x43c355['rows']=_0x315dc3;return _0x43c355;})[_0xe032('0x23')](respondWithFilteredResult(_0x19226c,_0x282ec0))['catch'](handleError(_0x19226c,null));};exports['show']=function(_0x504d65,_0x24e0bc){var _0x1079f6={'raw':!![],'where':{'id':_0x504d65[_0xe032('0x3d')]['id']}},_0x21021a={};_0x21021a[_0xe032('0x31')]=_[_0xe032('0x2c')](db[_0xe032('0x29')][_0xe032('0x2a')]);_0x21021a[_0xe032('0x2d')]=_[_0xe032('0x2c')](_0x504d65[_0xe032('0x2d')]);_0x21021a[_0xe032('0x2e')]=_[_0xe032('0x30')](_0x21021a[_0xe032('0x31')],_0x21021a[_0xe032('0x2d')]);_0x1079f6[_0xe032('0x2f')]=_['intersection'](_0x21021a['model'],qs[_0xe032('0x32')](_0x504d65[_0xe032('0x2d')][_0xe032('0x32')]));_0x1079f6[_0xe032('0x2f')]=_0x1079f6[_0xe032('0x2f')][_0xe032('0x3e')]?_0x1079f6['attributes']:_0x21021a[_0xe032('0x31')];if(_0x504d65[_0xe032('0x2d')][_0xe032('0x3c')]){_0x1079f6[_0xe032('0x3f')]=[{'all':!![]}];}_0x1079f6=_[_0xe032('0x37')]({},_0x1079f6,_0x504d65[_0xe032('0x3a')]);return db[_0xe032('0x29')][_0xe032('0x40')](_0x1079f6)['then'](handleEntityNotFound(_0x24e0bc,null))['then'](respondWithResult(_0x24e0bc,null))['catch'](handleError(_0x24e0bc,null));};exports[_0xe032('0x41')]=function(_0x56015b,_0x1f3ad4){return db[_0xe032('0x29')][_0xe032('0x41')](_0x56015b[_0xe032('0x42')],{})[_0xe032('0x23')](respondWithResult(_0x1f3ad4,0xc9))[_0xe032('0x43')](handleError(_0x1f3ad4,null));};exports['update']=function(_0x1b8960,_0x43537f){if(_0x1b8960[_0xe032('0x42')]['id']){delete _0x1b8960[_0xe032('0x42')]['id'];}return db[_0xe032('0x29')]['find']({'where':{'id':_0x1b8960['params']['id']}})[_0xe032('0x23')](handleEntityNotFound(_0x43537f,null))[_0xe032('0x23')](saveUpdates(_0x1b8960[_0xe032('0x42')],null))[_0xe032('0x23')](respondWithResult(_0x43537f,null))[_0xe032('0x43')](handleError(_0x43537f,null));};exports[_0xe032('0x24')]=function(_0x2c812b,_0xbbfb43){return db[_0xe032('0x29')]['find']({'where':{'id':_0x2c812b[_0xe032('0x3d')]['id']}})['then'](handleEntityNotFound(_0xbbfb43,null))['then'](removeEntity(_0xbbfb43,null))['catch'](handleError(_0xbbfb43,null));};exports[_0xe032('0x44')]=function(_0x1c0fdb,_0x23f067){return db['SquareReport'][_0xe032('0x44')]()['then'](respondWithResult(_0x23f067,null))['catch'](handleError(_0x23f067,null));}; \ No newline at end of file +var _0x5226=['moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','send','map','SquareReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','findAll','rows','catch','show','keys','includeAll','include','options','create','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5226,0x137));var _0x6522=function(_0xbf972e,_0x17819b){_0xbf972e=_0xbf972e-0x0;var _0x246a27=_0x5226[_0xbf972e];return _0x246a27;};'use strict';var pdf=require(_0x6522('0x0'));var emlformat=require(_0x6522('0x1'));var rimraf=require(_0x6522('0x2'));var zipdir=require(_0x6522('0x3'));var jsonpatch=require(_0x6522('0x4'));var rp=require('request-promise');var moment=require(_0x6522('0x5'));var BPromise=require(_0x6522('0x6'));var Mustache=require(_0x6522('0x7'));var util=require('util');var path=require(_0x6522('0x8'));var sox=require('sox');var csv=require(_0x6522('0x9'));var ejs=require(_0x6522('0xa'));var fs=require('fs');var _=require(_0x6522('0xb'));var squel=require(_0x6522('0xc'));var crypto=require(_0x6522('0xd'));var jsforce=require(_0x6522('0xe'));var deskjs=require(_0x6522('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6522('0x10'));var Redis=require(_0x6522('0x11'));var authService=require(_0x6522('0x12'));var qs=require(_0x6522('0x13'));var as=require(_0x6522('0x14'));var hardwareService=require(_0x6522('0x15'));var logger=require(_0x6522('0x16'))(_0x6522('0x17'));var utils=require(_0x6522('0x18'));var config=require(_0x6522('0x19'));var licenseUtil=require(_0x6522('0x1a'));var db=require(_0x6522('0x1b'))['db'];function respondWithStatusCode(_0xf95f99,_0x5a0361){_0x5a0361=_0x5a0361||0xcc;return function(_0x15cb73){if(_0x15cb73){return _0xf95f99[_0x6522('0x1c')](_0x5a0361);}return _0xf95f99[_0x6522('0x1d')](_0x5a0361)[_0x6522('0x1e')]();};}function respondWithResult(_0x469436,_0x56f7ef){_0x56f7ef=_0x56f7ef||0xc8;return function(_0x3c855a){if(_0x3c855a){return _0x469436[_0x6522('0x1d')](_0x56f7ef)[_0x6522('0x1f')](_0x3c855a);}};}function respondWithFilteredResult(_0x1b7e38,_0xc1470c){return function(_0x3e0369){if(_0x3e0369){var _0x31ddff=_0x3e0369[_0x6522('0x20')],_0x1e12b7=_0xc1470c[_0x6522('0x21')],_0x36a557=_0xc1470c['offset']+_0xc1470c[_0x6522('0x22')],_0x2de2e5;if(_0x36a557>=_0x31ddff){_0x36a557=_0x31ddff;_0x2de2e5=0xc8;}else{_0x2de2e5=0xce;}_0x1b7e38[_0x6522('0x1d')](_0x2de2e5);return _0x1b7e38[_0x6522('0x23')](_0x6522('0x24'),_0x1e12b7+'-'+_0x36a557+'/'+_0x31ddff)['json'](_0x3e0369);}return null;};}function patchUpdates(_0x27a89a){return function(_0x9a5622){try{jsonpatch['apply'](_0x9a5622,_0x27a89a,!![]);}catch(_0x38aae6){return BPromise['reject'](_0x38aae6);}return _0x9a5622[_0x6522('0x25')]();};}function saveUpdates(_0xe419a9,_0x90cd3b){return function(_0x392001){if(_0x392001){return _0x392001[_0x6522('0x26')](_0xe419a9)[_0x6522('0x27')](function(_0x4d2ef2){return _0x4d2ef2;});}return null;};}function removeEntity(_0x1b6ad2,_0x174004){return function(_0x13ec44){if(_0x13ec44){return _0x13ec44[_0x6522('0x28')]()[_0x6522('0x27')](function(){_0x1b6ad2[_0x6522('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11ed35,_0x415f16){return function(_0xcb377c){if(!_0xcb377c){_0x11ed35[_0x6522('0x1c')](0x194);}return _0xcb377c;};}function handleError(_0x47d185,_0x5f58b6){_0x5f58b6=_0x5f58b6||0x1f4;return function(_0x263d7d){logger[_0x6522('0x29')](_0x263d7d[_0x6522('0x2a')]);if(_0x263d7d[_0x6522('0x2b')]){delete _0x263d7d['name'];}_0x47d185[_0x6522('0x1d')](_0x5f58b6)[_0x6522('0x2c')](_0x263d7d);};}exports['index']=function(_0x375555,_0x2f6e86){var _0x23dc77={},_0x20a6f2={},_0x5db9bb={'count':0x0,'rows':[]};var _0x204305=_[_0x6522('0x2d')](db[_0x6522('0x2e')][_0x6522('0x2f')],function(_0x13a851){return{'name':_0x13a851[_0x6522('0x30')],'type':_0x13a851[_0x6522('0x31')][_0x6522('0x32')]};});_0x20a6f2[_0x6522('0x33')]=_[_0x6522('0x2d')](_0x204305,_0x6522('0x2b'));_0x20a6f2[_0x6522('0x34')]=_['keys'](_0x375555[_0x6522('0x34')]);_0x20a6f2[_0x6522('0x35')]=_[_0x6522('0x36')](_0x20a6f2[_0x6522('0x33')],_0x20a6f2[_0x6522('0x34')]);_0x23dc77[_0x6522('0x37')]=_['intersection'](_0x20a6f2[_0x6522('0x33')],qs[_0x6522('0x38')](_0x375555[_0x6522('0x34')][_0x6522('0x38')]));_0x23dc77[_0x6522('0x37')]=_0x23dc77[_0x6522('0x37')][_0x6522('0x39')]?_0x23dc77[_0x6522('0x37')]:_0x20a6f2[_0x6522('0x33')];if(!_0x375555[_0x6522('0x34')][_0x6522('0x3a')](_0x6522('0x3b'))){_0x23dc77[_0x6522('0x22')]=qs['limit'](_0x375555['query']['limit']);_0x23dc77[_0x6522('0x21')]=qs[_0x6522('0x21')](_0x375555[_0x6522('0x34')][_0x6522('0x21')]);}_0x23dc77[_0x6522('0x3c')]=qs[_0x6522('0x3d')](_0x375555['query'][_0x6522('0x3d')]);_0x23dc77[_0x6522('0x3e')]=qs[_0x6522('0x35')](_[_0x6522('0x3f')](_0x375555[_0x6522('0x34')],_0x20a6f2['filters']),_0x204305);if(_0x375555['query']['filter']){_0x23dc77[_0x6522('0x3e')]=_[_0x6522('0x40')](_0x23dc77['where'],{'$or':_['map'](_0x204305,function(_0xed4641){if(_0xed4641['type']!=='VIRTUAL'){var _0x3fc095={};_0x3fc095[_0xed4641[_0x6522('0x2b')]]={'$like':'%'+_0x375555[_0x6522('0x34')][_0x6522('0x41')]+'%'};return _0x3fc095;}})});}_0x23dc77=_[_0x6522('0x40')]({},_0x23dc77,_0x375555['options']);var _0x283375={'where':_0x23dc77[_0x6522('0x3e')]};return db[_0x6522('0x2e')][_0x6522('0x20')](_0x283375)[_0x6522('0x27')](function(_0x5ae0ce){_0x5db9bb[_0x6522('0x20')]=_0x5ae0ce;if(_0x375555[_0x6522('0x34')]['includeAll']){_0x23dc77['include']=[{'all':!![]}];}return db[_0x6522('0x2e')][_0x6522('0x42')](_0x23dc77);})[_0x6522('0x27')](function(_0x7d2bdf){_0x5db9bb[_0x6522('0x43')]=_0x7d2bdf;return _0x5db9bb;})['then'](respondWithFilteredResult(_0x2f6e86,_0x23dc77))[_0x6522('0x44')](handleError(_0x2f6e86,null));};exports[_0x6522('0x45')]=function(_0x2e082b,_0x3acdd0){var _0x3b643a={'raw':!![],'where':{'id':_0x2e082b['params']['id']}},_0x266cc8={};_0x266cc8[_0x6522('0x33')]=_['keys'](db['SquareReport'][_0x6522('0x2f')]);_0x266cc8[_0x6522('0x34')]=_[_0x6522('0x46')](_0x2e082b[_0x6522('0x34')]);_0x266cc8['filters']=_[_0x6522('0x36')](_0x266cc8[_0x6522('0x33')],_0x266cc8[_0x6522('0x34')]);_0x3b643a['attributes']=_[_0x6522('0x36')](_0x266cc8['model'],qs[_0x6522('0x38')](_0x2e082b[_0x6522('0x34')][_0x6522('0x38')]));_0x3b643a['attributes']=_0x3b643a[_0x6522('0x37')][_0x6522('0x39')]?_0x3b643a[_0x6522('0x37')]:_0x266cc8[_0x6522('0x33')];if(_0x2e082b[_0x6522('0x34')][_0x6522('0x47')]){_0x3b643a[_0x6522('0x48')]=[{'all':!![]}];}_0x3b643a=_[_0x6522('0x40')]({},_0x3b643a,_0x2e082b[_0x6522('0x49')]);return db[_0x6522('0x2e')]['find'](_0x3b643a)[_0x6522('0x27')](handleEntityNotFound(_0x3acdd0,null))[_0x6522('0x27')](respondWithResult(_0x3acdd0,null))[_0x6522('0x44')](handleError(_0x3acdd0,null));};exports[_0x6522('0x4a')]=function(_0x18dbc7,_0x44156d){return db[_0x6522('0x2e')][_0x6522('0x4a')](_0x18dbc7[_0x6522('0x4b')],{})[_0x6522('0x27')](respondWithResult(_0x44156d,0xc9))['catch'](handleError(_0x44156d,null));};exports['update']=function(_0x4560ef,_0x2b14e1){if(_0x4560ef['body']['id']){delete _0x4560ef[_0x6522('0x4b')]['id'];}return db[_0x6522('0x2e')]['find']({'where':{'id':_0x4560ef['params']['id']}})['then'](handleEntityNotFound(_0x2b14e1,null))['then'](saveUpdates(_0x4560ef[_0x6522('0x4b')],null))[_0x6522('0x27')](respondWithResult(_0x2b14e1,null))[_0x6522('0x44')](handleError(_0x2b14e1,null));};exports[_0x6522('0x28')]=function(_0x314d6c,_0x38d9fa){return db['SquareReport'][_0x6522('0x4c')]({'where':{'id':_0x314d6c[_0x6522('0x4d')]['id']}})['then'](handleEntityNotFound(_0x38d9fa,null))[_0x6522('0x27')](removeEntity(_0x38d9fa,null))[_0x6522('0x44')](handleError(_0x38d9fa,null));};exports[_0x6522('0x4e')]=function(_0x508c5d,_0x40d372){return db['SquareReport'][_0x6522('0x4e')]()[_0x6522('0x27')](respondWithResult(_0x40d372,null))[_0x6522('0x44')](handleError(_0x40d372,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 9a1ba23..62e0d85 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 _0x576f=['exports','define','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReport.attributes'];(function(_0x1b8e43,_0x5a2f01){var _0x4cf943=function(_0x42c8ad){while(--_0x42c8ad){_0x1b8e43['push'](_0x1b8e43['shift']());}};_0x4cf943(++_0x5a2f01);}(_0x576f,0xc6));var _0xf576=function(_0xdac26,_0x185b87){_0xdac26=_0xdac26-0x0;var _0x35f23d=_0x576f[_0xdac26];return _0x35f23d;};'use strict';var _=require(_0xf576('0x0'));var util=require(_0xf576('0x1'));var logger=require(_0xf576('0x2'))(_0xf576('0x3'));var moment=require(_0xf576('0x4'));var BPromise=require(_0xf576('0x5'));var rp=require(_0xf576('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf576('0x7'));var config=require(_0xf576('0x8'));var attributes=require(_0xf576('0x9'));module[_0xf576('0xa')]=function(_0x53c7e0,_0x1eb5ca){return _0x53c7e0[_0xf576('0xb')]('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xf576('0xc'),'fields':[_0xf576('0xd'),_0xf576('0xe')]},{'name':_0xf576('0xf'),'fields':[_0xf576('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6a56=['bluebird','request-promise','path','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','project_name','leaveAt','util','../../config/logger','moment'];(function(_0x491578,_0x473a4d){var _0x3bd608=function(_0x4dff3b){while(--_0x4dff3b){_0x491578['push'](_0x491578['shift']());}};_0x3bd608(++_0x473a4d);}(_0x6a56,0x14d));var _0x66a5=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0x6a56[_0x5eef05];return _0x56d4b8;};'use strict';var _=require('lodash');var util=require(_0x66a5('0x0'));var logger=require(_0x66a5('0x1'))('api');var moment=require(_0x66a5('0x2'));var BPromise=require(_0x66a5('0x3'));var rp=require(_0x66a5('0x4'));var fs=require('fs');var path=require(_0x66a5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x66a5('0x6'));module[_0x66a5('0x7')]=function(_0x6d240,_0x15ab0f){return _0x6d240[_0x66a5('0x8')](_0x66a5('0x9'),attributes,{'tableName':_0x66a5('0xa'),'paranoid':![],'indexes':[{'name':_0x66a5('0xb'),'fields':['uniqueid',_0x66a5('0xc')]},{'name':_0x66a5('0xd'),'fields':[_0x66a5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 3ef26fb..973cfa3 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 _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(_0x5311a1,_0x304912){var _0x2acb9f=function(_0x4803e7){while(--_0x4803e7){_0x5311a1['push'](_0x5311a1['shift']());}};_0x2acb9f(++_0x304912);}(_0x7da7,0x10d));var _0x77da=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x7da7[_0x1ae5ab];return _0x1ce001;};'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 +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(_0x301dab,_0x38050a){var _0x2500a2=function(_0x4d3dff){while(--_0x4d3dff){_0x301dab['push'](_0x301dab['shift']());}};_0x2500a2(++_0x38050a);}(_0x8ef6,0xf2));var _0x68ef=function(_0x331ff,_0x1fb6e6){_0x331ff=_0x331ff-0x0;var _0x1cfc4d=_0x8ef6[_0x331ff];return _0x1cfc4d;};'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 diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 7bd59ad..f5cd667 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(_0xaca7f4,_0x5aa1fd){var _0x5a1d83=function(_0xac45f1){while(--_0xac45f1){_0xaca7f4['push'](_0xaca7f4['shift']());}};_0x5a1d83(++_0x5aa1fd);}(_0x7a54,0x106));var _0x47a5=function(_0x30f628,_0xd47486){_0x30f628=_0x30f628-0x0;var _0x176bb4=_0x7a54[_0x30f628];return _0x176bb4;};'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 _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x4ece5c,_0x40d38d){var _0x4589d9=function(_0x2f4d35){while(--_0x2f4d35){_0x4ece5c['push'](_0x4ece5c['shift']());}};_0x4589d9(++_0x40d38d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x467ac9,_0x473d88){_0x467ac9=_0x467ac9-0x0;var _0x375231=_0x5f2f[_0x467ac9];return _0x375231;};'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('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 8425ab3..a163022 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 _0xb127=['STRING','TEXT','sequelize','exports'];(function(_0x2e3a55,_0x50c3aa){var _0x1b40f2=function(_0x2617dd){while(--_0x2617dd){_0x2e3a55['push'](_0x2e3a55['shift']());}};_0x1b40f2(++_0x50c3aa);}(_0xb127,0x19e));var _0x7b12=function(_0x3a36a3,_0x15f5c2){_0x3a36a3=_0x3a36a3-0x0;var _0x2152a2=_0xb127[_0x3a36a3];return _0x2152a2;};'use strict';var Sequelize=require(_0x7b12('0x0'));module[_0x7b12('0x1')]={'uniqueid':{'type':Sequelize[_0x7b12('0x2')]},'node':{'type':Sequelize[_0x7b12('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x7b12('0x3')]},'project_name':{'type':Sequelize[_0x7b12('0x2')]},'callerid':{'type':Sequelize[_0x7b12('0x2')]}}; \ No newline at end of file +var _0xdf57=['STRING','TEXT','exports'];(function(_0x12807b,_0x7c0dfb){var _0x5a676e=function(_0x2cb9d9){while(--_0x2cb9d9){_0x12807b['push'](_0x12807b['shift']());}};_0x5a676e(++_0x7c0dfb);}(_0xdf57,0x68));var _0x7df5=function(_0x946779,_0x31cd75){_0x946779=_0x946779-0x0;var _0x40292f=_0xdf57[_0x946779];return _0x40292f;};'use strict';var Sequelize=require('sequelize');module[_0x7df5('0x0')]={'uniqueid':{'type':Sequelize[_0x7df5('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x7df5('0x1')]},'data':{'type':Sequelize[_0x7df5('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7df5('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 30cee5c..ca3265a 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 _0xc664=['bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','error','stack','name','send','map','SquareDetailsReport','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','include','create','body','find','destroy','describe','html-pdf','eml-format','zip-dir','request-promise','moment'];(function(_0x3920a2,_0x51e985){var _0x3a1f5c=function(_0x2cebe2){while(--_0x2cebe2){_0x3920a2['push'](_0x3920a2['shift']());}};_0x3a1f5c(++_0x51e985);}(_0xc664,0x127));var _0x4c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc664[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x4c66('0x0'));var emlformat=require(_0x4c66('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4c66('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c66('0x3'));var moment=require(_0x4c66('0x4'));var BPromise=require(_0x4c66('0x5'));var Mustache=require(_0x4c66('0x6'));var util=require(_0x4c66('0x7'));var path=require(_0x4c66('0x8'));var sox=require(_0x4c66('0x9'));var csv=require(_0x4c66('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4c66('0xb'));var squel=require(_0x4c66('0xc'));var crypto=require(_0x4c66('0xd'));var jsforce=require(_0x4c66('0xe'));var deskjs=require(_0x4c66('0xf'));var toCsv=require(_0x4c66('0xa'));var querystring=require(_0x4c66('0x10'));var Papa=require(_0x4c66('0x11'));var Redis=require(_0x4c66('0x12'));var authService=require(_0x4c66('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4c66('0x14'));var hardwareService=require(_0x4c66('0x15'));var logger=require(_0x4c66('0x16'))(_0x4c66('0x17'));var utils=require(_0x4c66('0x18'));var config=require(_0x4c66('0x19'));var licenseUtil=require(_0x4c66('0x1a'));var db=require(_0x4c66('0x1b'))['db'];function respondWithStatusCode(_0x518fd3,_0x535201){_0x535201=_0x535201||0xcc;return function(_0x3c697a){if(_0x3c697a){return _0x518fd3[_0x4c66('0x1c')](_0x535201);}return _0x518fd3[_0x4c66('0x1d')](_0x535201)[_0x4c66('0x1e')]();};}function respondWithResult(_0x58a81,_0x19523d){_0x19523d=_0x19523d||0xc8;return function(_0x75a3){if(_0x75a3){return _0x58a81['status'](_0x19523d)[_0x4c66('0x1f')](_0x75a3);}};}function respondWithFilteredResult(_0x4c41da,_0x574159){return function(_0x14fd8f){if(_0x14fd8f){var _0x5c0aff=_0x14fd8f[_0x4c66('0x20')],_0xae8627=_0x574159[_0x4c66('0x21')],_0x32e855=_0x574159[_0x4c66('0x21')]+_0x574159[_0x4c66('0x22')],_0x5cfc4b;if(_0x32e855>=_0x5c0aff){_0x32e855=_0x5c0aff;_0x5cfc4b=0xc8;}else{_0x5cfc4b=0xce;}_0x4c41da['status'](_0x5cfc4b);return _0x4c41da['set'](_0x4c66('0x23'),_0xae8627+'-'+_0x32e855+'/'+_0x5c0aff)[_0x4c66('0x1f')](_0x14fd8f);}return null;};}function patchUpdates(_0x4f2449){return function(_0x4a16d0){try{jsonpatch[_0x4c66('0x24')](_0x4a16d0,_0x4f2449,!![]);}catch(_0x27e8f4){return BPromise[_0x4c66('0x25')](_0x27e8f4);}return _0x4a16d0['save']();};}function saveUpdates(_0x4217ef,_0x106709){return function(_0x411126){if(_0x411126){return _0x411126[_0x4c66('0x26')](_0x4217ef)[_0x4c66('0x27')](function(_0x58e1c6){return _0x58e1c6;});}return null;};}function removeEntity(_0x50b2eb,_0x399317){return function(_0xb1507a){if(_0xb1507a){return _0xb1507a['destroy']()[_0x4c66('0x27')](function(){_0x50b2eb[_0x4c66('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20a924,_0x500467){return function(_0x45af16){if(!_0x45af16){_0x20a924['sendStatus'](0x194);}return _0x45af16;};}function handleError(_0x585ce0,_0x3ba771){_0x3ba771=_0x3ba771||0x1f4;return function(_0x2618d3){logger[_0x4c66('0x28')](_0x2618d3[_0x4c66('0x29')]);if(_0x2618d3['name']){delete _0x2618d3[_0x4c66('0x2a')];}_0x585ce0['status'](_0x3ba771)[_0x4c66('0x2b')](_0x2618d3);};}exports['index']=function(_0x34b64b,_0x1fd5ce){var _0xee0489={},_0x425e8e={},_0x16a539={'count':0x0,'rows':[]};var _0x233384=_[_0x4c66('0x2c')](db[_0x4c66('0x2d')][_0x4c66('0x2e')],function(_0x1656cd){return{'name':_0x1656cd['fieldName'],'type':_0x1656cd['type']['key']};});_0x425e8e[_0x4c66('0x2f')]=_['map'](_0x233384,'name');_0x425e8e[_0x4c66('0x30')]=_['keys'](_0x34b64b[_0x4c66('0x30')]);_0x425e8e[_0x4c66('0x31')]=_[_0x4c66('0x32')](_0x425e8e[_0x4c66('0x2f')],_0x425e8e[_0x4c66('0x30')]);_0xee0489[_0x4c66('0x33')]=_['intersection'](_0x425e8e['model'],qs[_0x4c66('0x34')](_0x34b64b[_0x4c66('0x30')][_0x4c66('0x34')]));_0xee0489[_0x4c66('0x33')]=_0xee0489[_0x4c66('0x33')][_0x4c66('0x35')]?_0xee0489[_0x4c66('0x33')]:_0x425e8e[_0x4c66('0x2f')];if(!_0x34b64b['query'][_0x4c66('0x36')](_0x4c66('0x37'))){_0xee0489[_0x4c66('0x22')]=qs[_0x4c66('0x22')](_0x34b64b[_0x4c66('0x30')]['limit']);_0xee0489['offset']=qs[_0x4c66('0x21')](_0x34b64b[_0x4c66('0x30')]['offset']);}_0xee0489[_0x4c66('0x38')]=qs[_0x4c66('0x39')](_0x34b64b[_0x4c66('0x30')][_0x4c66('0x39')]);_0xee0489[_0x4c66('0x3a')]=qs['filters'](_['pick'](_0x34b64b[_0x4c66('0x30')],_0x425e8e[_0x4c66('0x31')]),_0x233384);if(_0x34b64b[_0x4c66('0x30')][_0x4c66('0x3b')]){_0xee0489[_0x4c66('0x3a')]=_[_0x4c66('0x3c')](_0xee0489[_0x4c66('0x3a')],{'$or':_['map'](_0x233384,function(_0x37b87e){if(_0x37b87e['type']!==_0x4c66('0x3d')){var _0x48dce3={};_0x48dce3[_0x37b87e[_0x4c66('0x2a')]]={'$like':'%'+_0x34b64b[_0x4c66('0x30')][_0x4c66('0x3b')]+'%'};return _0x48dce3;}})});}_0xee0489=_['merge']({},_0xee0489,_0x34b64b[_0x4c66('0x3e')]);var _0x1e63c2={'where':_0xee0489[_0x4c66('0x3a')]};return db[_0x4c66('0x2d')][_0x4c66('0x20')](_0x1e63c2)['then'](function(_0x792c45){_0x16a539[_0x4c66('0x20')]=_0x792c45;if(_0x34b64b[_0x4c66('0x30')]['includeAll']){_0xee0489['include']=[{'all':!![]}];}return db[_0x4c66('0x2d')][_0x4c66('0x3f')](_0xee0489);})[_0x4c66('0x27')](function(_0x4995c4){_0x16a539[_0x4c66('0x40')]=_0x4995c4;return _0x16a539;})[_0x4c66('0x27')](respondWithFilteredResult(_0x1fd5ce,_0xee0489))[_0x4c66('0x41')](handleError(_0x1fd5ce,null));};exports[_0x4c66('0x42')]=function(_0xf7cb3b,_0x507c3f){var _0x44d42f={'raw':!![],'where':{'id':_0xf7cb3b[_0x4c66('0x43')]['id']}},_0x490aa2={};_0x490aa2[_0x4c66('0x2f')]=_[_0x4c66('0x44')](db[_0x4c66('0x2d')][_0x4c66('0x2e')]);_0x490aa2['query']=_['keys'](_0xf7cb3b[_0x4c66('0x30')]);_0x490aa2[_0x4c66('0x31')]=_['intersection'](_0x490aa2[_0x4c66('0x2f')],_0x490aa2[_0x4c66('0x30')]);_0x44d42f[_0x4c66('0x33')]=_[_0x4c66('0x32')](_0x490aa2[_0x4c66('0x2f')],qs[_0x4c66('0x34')](_0xf7cb3b['query'][_0x4c66('0x34')]));_0x44d42f[_0x4c66('0x33')]=_0x44d42f[_0x4c66('0x33')][_0x4c66('0x35')]?_0x44d42f['attributes']:_0x490aa2[_0x4c66('0x2f')];if(_0xf7cb3b[_0x4c66('0x30')]['includeAll']){_0x44d42f[_0x4c66('0x45')]=[{'all':!![]}];}_0x44d42f=_[_0x4c66('0x3c')]({},_0x44d42f,_0xf7cb3b['options']);return db[_0x4c66('0x2d')]['find'](_0x44d42f)[_0x4c66('0x27')](handleEntityNotFound(_0x507c3f,null))[_0x4c66('0x27')](respondWithResult(_0x507c3f,null))[_0x4c66('0x41')](handleError(_0x507c3f,null));};exports['create']=function(_0x2f4ef5,_0x45388f){return db[_0x4c66('0x2d')][_0x4c66('0x46')](_0x2f4ef5[_0x4c66('0x47')],{})[_0x4c66('0x27')](respondWithResult(_0x45388f,0xc9))[_0x4c66('0x41')](handleError(_0x45388f,null));};exports[_0x4c66('0x26')]=function(_0x38b4e6,_0x5721b2){if(_0x38b4e6['body']['id']){delete _0x38b4e6[_0x4c66('0x47')]['id'];}return db[_0x4c66('0x2d')][_0x4c66('0x48')]({'where':{'id':_0x38b4e6['params']['id']}})[_0x4c66('0x27')](handleEntityNotFound(_0x5721b2,null))[_0x4c66('0x27')](saveUpdates(_0x38b4e6[_0x4c66('0x47')],null))[_0x4c66('0x27')](respondWithResult(_0x5721b2,null))[_0x4c66('0x41')](handleError(_0x5721b2,null));};exports[_0x4c66('0x49')]=function(_0x395756,_0x149d4f){return db['SquareDetailsReport'][_0x4c66('0x48')]({'where':{'id':_0x395756[_0x4c66('0x43')]['id']}})[_0x4c66('0x27')](handleEntityNotFound(_0x149d4f,null))[_0x4c66('0x27')](removeEntity(_0x149d4f,null))[_0x4c66('0x41')](handleError(_0x149d4f,null));};exports[_0x4c66('0x4a')]=function(_0x152c51,_0x1d664f){return db[_0x4c66('0x2d')][_0x4c66('0x4a')]()[_0x4c66('0x27')](respondWithResult(_0x1d664f,null))[_0x4c66('0x41')](handleError(_0x1d664f,null));}; \ No newline at end of file +var _0xe5a9=['filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','intersection','length','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','limit','set','save','update','then','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','type','key','model','query','fields','attributes','hasOwnProperty','offset','order','where','pick'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe5a9,0x9e));var _0x9e5a=function(_0x8806a6,_0x686e06){_0x8806a6=_0x8806a6-0x0;var _0x49cdd3=_0xe5a9[_0x8806a6];return _0x49cdd3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9e5a('0x0'));var rimraf=require(_0x9e5a('0x1'));var zipdir=require(_0x9e5a('0x2'));var jsonpatch=require(_0x9e5a('0x3'));var rp=require(_0x9e5a('0x4'));var moment=require(_0x9e5a('0x5'));var BPromise=require(_0x9e5a('0x6'));var Mustache=require('mustache');var util=require(_0x9e5a('0x7'));var path=require(_0x9e5a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9e5a('0x9'));var squel=require(_0x9e5a('0xa'));var crypto=require(_0x9e5a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9e5a('0xc'));var toCsv=require(_0x9e5a('0xd'));var querystring=require(_0x9e5a('0xe'));var Papa=require(_0x9e5a('0xf'));var Redis=require('ioredis');var authService=require(_0x9e5a('0x10'));var qs=require(_0x9e5a('0x11'));var as=require(_0x9e5a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9e5a('0x13'));var utils=require('../../config/utils');var config=require(_0x9e5a('0x14'));var licenseUtil=require(_0x9e5a('0x15'));var db=require(_0x9e5a('0x16'))['db'];function respondWithStatusCode(_0x540bb8,_0xb6899){_0xb6899=_0xb6899||0xcc;return function(_0x143d50){if(_0x143d50){return _0x540bb8[_0x9e5a('0x17')](_0xb6899);}return _0x540bb8['status'](_0xb6899)[_0x9e5a('0x18')]();};}function respondWithResult(_0x39a12c,_0x493409){_0x493409=_0x493409||0xc8;return function(_0xc7cbd){if(_0xc7cbd){return _0x39a12c[_0x9e5a('0x19')](_0x493409)[_0x9e5a('0x1a')](_0xc7cbd);}};}function respondWithFilteredResult(_0x2cdfda,_0x208c9a){return function(_0xb57cc5){if(_0xb57cc5){var _0x32f4c9=_0xb57cc5[_0x9e5a('0x1b')],_0x608276=_0x208c9a['offset'],_0x100972=_0x208c9a['offset']+_0x208c9a[_0x9e5a('0x1c')],_0x36536e;if(_0x100972>=_0x32f4c9){_0x100972=_0x32f4c9;_0x36536e=0xc8;}else{_0x36536e=0xce;}_0x2cdfda[_0x9e5a('0x19')](_0x36536e);return _0x2cdfda[_0x9e5a('0x1d')]('Content-Range',_0x608276+'-'+_0x100972+'/'+_0x32f4c9)[_0x9e5a('0x1a')](_0xb57cc5);}return null;};}function patchUpdates(_0x437051){return function(_0x1f6969){try{jsonpatch['apply'](_0x1f6969,_0x437051,!![]);}catch(_0x26518f){return BPromise['reject'](_0x26518f);}return _0x1f6969[_0x9e5a('0x1e')]();};}function saveUpdates(_0xf3b052,_0x59c2ee){return function(_0x4daa8b){if(_0x4daa8b){return _0x4daa8b[_0x9e5a('0x1f')](_0xf3b052)[_0x9e5a('0x20')](function(_0x426513){return _0x426513;});}return null;};}function removeEntity(_0x2b8447,_0x2ac1a1){return function(_0x4e1207){if(_0x4e1207){return _0x4e1207['destroy']()[_0x9e5a('0x20')](function(){_0x2b8447['status'](0xcc)[_0x9e5a('0x18')]();});}};}function handleEntityNotFound(_0x3bdb55,_0x343662){return function(_0x5d9de8){if(!_0x5d9de8){_0x3bdb55['sendStatus'](0x194);}return _0x5d9de8;};}function handleError(_0x160373,_0x219152){_0x219152=_0x219152||0x1f4;return function(_0x51a12a){logger[_0x9e5a('0x21')](_0x51a12a[_0x9e5a('0x22')]);if(_0x51a12a[_0x9e5a('0x23')]){delete _0x51a12a['name'];}_0x160373[_0x9e5a('0x19')](_0x219152)[_0x9e5a('0x24')](_0x51a12a);};}exports[_0x9e5a('0x25')]=function(_0x4b0383,_0x21c6f3){var _0x2a795a={},_0x3e49aa={},_0x5d1aea={'count':0x0,'rows':[]};var _0x528e69=_[_0x9e5a('0x26')](db[_0x9e5a('0x27')][_0x9e5a('0x28')],function(_0x171c93){return{'name':_0x171c93['fieldName'],'type':_0x171c93[_0x9e5a('0x29')][_0x9e5a('0x2a')]};});_0x3e49aa[_0x9e5a('0x2b')]=_[_0x9e5a('0x26')](_0x528e69,_0x9e5a('0x23'));_0x3e49aa[_0x9e5a('0x2c')]=_['keys'](_0x4b0383['query']);_0x3e49aa['filters']=_['intersection'](_0x3e49aa[_0x9e5a('0x2b')],_0x3e49aa[_0x9e5a('0x2c')]);_0x2a795a['attributes']=_['intersection'](_0x3e49aa[_0x9e5a('0x2b')],qs[_0x9e5a('0x2d')](_0x4b0383[_0x9e5a('0x2c')][_0x9e5a('0x2d')]));_0x2a795a['attributes']=_0x2a795a[_0x9e5a('0x2e')]['length']?_0x2a795a[_0x9e5a('0x2e')]:_0x3e49aa['model'];if(!_0x4b0383[_0x9e5a('0x2c')][_0x9e5a('0x2f')]('nolimit')){_0x2a795a[_0x9e5a('0x1c')]=qs['limit'](_0x4b0383[_0x9e5a('0x2c')][_0x9e5a('0x1c')]);_0x2a795a[_0x9e5a('0x30')]=qs[_0x9e5a('0x30')](_0x4b0383[_0x9e5a('0x2c')][_0x9e5a('0x30')]);}_0x2a795a[_0x9e5a('0x31')]=qs['sort'](_0x4b0383[_0x9e5a('0x2c')]['sort']);_0x2a795a[_0x9e5a('0x32')]=qs['filters'](_[_0x9e5a('0x33')](_0x4b0383[_0x9e5a('0x2c')],_0x3e49aa[_0x9e5a('0x34')]),_0x528e69);if(_0x4b0383[_0x9e5a('0x2c')][_0x9e5a('0x35')]){_0x2a795a[_0x9e5a('0x32')]=_['merge'](_0x2a795a[_0x9e5a('0x32')],{'$or':_[_0x9e5a('0x26')](_0x528e69,function(_0x1e428d){if(_0x1e428d[_0x9e5a('0x29')]!==_0x9e5a('0x36')){var _0x5e65c7={};_0x5e65c7[_0x1e428d[_0x9e5a('0x23')]]={'$like':'%'+_0x4b0383[_0x9e5a('0x2c')][_0x9e5a('0x35')]+'%'};return _0x5e65c7;}})});}_0x2a795a=_[_0x9e5a('0x37')]({},_0x2a795a,_0x4b0383[_0x9e5a('0x38')]);var _0x2373d0={'where':_0x2a795a[_0x9e5a('0x32')]};return db[_0x9e5a('0x27')][_0x9e5a('0x1b')](_0x2373d0)[_0x9e5a('0x20')](function(_0x450e6d){_0x5d1aea[_0x9e5a('0x1b')]=_0x450e6d;if(_0x4b0383['query'][_0x9e5a('0x39')]){_0x2a795a[_0x9e5a('0x3a')]=[{'all':!![]}];}return db[_0x9e5a('0x27')][_0x9e5a('0x3b')](_0x2a795a);})[_0x9e5a('0x20')](function(_0x2bd8ac){_0x5d1aea[_0x9e5a('0x3c')]=_0x2bd8ac;return _0x5d1aea;})[_0x9e5a('0x20')](respondWithFilteredResult(_0x21c6f3,_0x2a795a))[_0x9e5a('0x3d')](handleError(_0x21c6f3,null));};exports['show']=function(_0x1768e4,_0xd36923){var _0x2f3b74={'raw':!![],'where':{'id':_0x1768e4[_0x9e5a('0x3e')]['id']}},_0x4f661d={};_0x4f661d[_0x9e5a('0x2b')]=_[_0x9e5a('0x3f')](db['SquareDetailsReport'][_0x9e5a('0x28')]);_0x4f661d[_0x9e5a('0x2c')]=_['keys'](_0x1768e4[_0x9e5a('0x2c')]);_0x4f661d[_0x9e5a('0x34')]=_[_0x9e5a('0x40')](_0x4f661d[_0x9e5a('0x2b')],_0x4f661d[_0x9e5a('0x2c')]);_0x2f3b74[_0x9e5a('0x2e')]=_[_0x9e5a('0x40')](_0x4f661d['model'],qs['fields'](_0x1768e4[_0x9e5a('0x2c')][_0x9e5a('0x2d')]));_0x2f3b74['attributes']=_0x2f3b74['attributes'][_0x9e5a('0x41')]?_0x2f3b74['attributes']:_0x4f661d[_0x9e5a('0x2b')];if(_0x1768e4[_0x9e5a('0x2c')][_0x9e5a('0x39')]){_0x2f3b74[_0x9e5a('0x3a')]=[{'all':!![]}];}_0x2f3b74=_[_0x9e5a('0x37')]({},_0x2f3b74,_0x1768e4[_0x9e5a('0x38')]);return db[_0x9e5a('0x27')]['find'](_0x2f3b74)[_0x9e5a('0x20')](handleEntityNotFound(_0xd36923,null))[_0x9e5a('0x20')](respondWithResult(_0xd36923,null))[_0x9e5a('0x3d')](handleError(_0xd36923,null));};exports[_0x9e5a('0x42')]=function(_0x2f7128,_0x2f5a61){return db['SquareDetailsReport'][_0x9e5a('0x42')](_0x2f7128[_0x9e5a('0x43')],{})['then'](respondWithResult(_0x2f5a61,0xc9))[_0x9e5a('0x3d')](handleError(_0x2f5a61,null));};exports[_0x9e5a('0x1f')]=function(_0x36d892,_0x56e288){if(_0x36d892[_0x9e5a('0x43')]['id']){delete _0x36d892[_0x9e5a('0x43')]['id'];}return db[_0x9e5a('0x27')][_0x9e5a('0x44')]({'where':{'id':_0x36d892[_0x9e5a('0x3e')]['id']}})[_0x9e5a('0x20')](handleEntityNotFound(_0x56e288,null))[_0x9e5a('0x20')](saveUpdates(_0x36d892[_0x9e5a('0x43')],null))['then'](respondWithResult(_0x56e288,null))['catch'](handleError(_0x56e288,null));};exports['destroy']=function(_0x177305,_0x1c9ca1){return db[_0x9e5a('0x27')][_0x9e5a('0x44')]({'where':{'id':_0x177305['params']['id']}})[_0x9e5a('0x20')](handleEntityNotFound(_0x1c9ca1,null))[_0x9e5a('0x20')](removeEntity(_0x1c9ca1,null))[_0x9e5a('0x3d')](handleError(_0x1c9ca1,null));};exports['describe']=function(_0x1dbece,_0x2ad115){return db[_0x9e5a('0x27')][_0x9e5a('0x45')]()[_0x9e5a('0x20')](respondWithResult(_0x2ad115,null))[_0x9e5a('0x3d')](handleError(_0x2ad115,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index f1bf40e..45714f0 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 _0xc161=['report_square_details','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','SquareDetailsReport'];(function(_0x3a1fcb,_0x5e0a4c){var _0x2d6ca3=function(_0x134d4b){while(--_0x134d4b){_0x3a1fcb['push'](_0x3a1fcb['shift']());}};_0x2d6ca3(++_0x5e0a4c);}(_0xc161,0x6f));var _0x1c16=function(_0x4b49c9,_0x290d55){_0x4b49c9=_0x4b49c9-0x0;var _0xab2d67=_0xc161[_0x4b49c9];return _0xab2d67;};'use strict';var _=require(_0x1c16('0x0'));var util=require(_0x1c16('0x1'));var logger=require(_0x1c16('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1c16('0x3'));var rp=require(_0x1c16('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c16('0x5'));var config=require(_0x1c16('0x6'));var attributes=require('./squareReportDetail.attributes');module[_0x1c16('0x7')]=function(_0x156b13,_0x373b84){return _0x156b13[_0x1c16('0x8')](_0x1c16('0x9'),attributes,{'tableName':_0x1c16('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10b8=['bluebird','request-promise','path','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','util','moment'];(function(_0x56b190,_0xe49b49){var _0x11a6e3=function(_0x47f481){while(--_0x47f481){_0x56b190['push'](_0x56b190['shift']());}};_0x11a6e3(++_0xe49b49);}(_0x10b8,0x198));var _0x810b=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x10b8[_0x556bb1];return _0x45455f;};'use strict';var _=require('lodash');var util=require(_0x810b('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x810b('0x1'));var BPromise=require(_0x810b('0x2'));var rp=require(_0x810b('0x3'));var fs=require('fs');var path=require(_0x810b('0x4'));var rimraf=require('rimraf');var config=require(_0x810b('0x5'));var attributes=require(_0x810b('0x6'));module[_0x810b('0x7')]=function(_0x1662ba,_0x98b602){return _0x1662ba[_0x810b('0x8')](_0x810b('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 9a9a58d..993dc26 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 _0x8a8a=['then','info','request\x20sent','debug','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','catch','create','CreateSquareDetailsReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x47bd71,_0x472a41){var _0x8c475b=function(_0x25f1bf){while(--_0x25f1bf){_0x47bd71['push'](_0x47bd71['shift']());}};_0x8c475b(++_0x472a41);}(_0x8a8a,0x155));var _0xa8a8=function(_0x14592e,_0xb1e197){_0x14592e=_0x14592e-0x0;var _0x278172=_0x8a8a[_0x14592e];return _0x278172;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa8a8('0x0'));var BPromise=require(_0xa8a8('0x1'));var rs=require(_0xa8a8('0x2'));var fs=require('fs');var Redis=require(_0xa8a8('0x3'));var db=require(_0xa8a8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa8a8('0x5'))(_0xa8a8('0x6'));var config=require(_0xa8a8('0x7'));var jayson=require(_0xa8a8('0x8'));var client=jayson['client'][_0xa8a8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a3e88,_0x367de5,_0x149760){return new BPromise(function(_0x57a87f,_0x3a401c){return client[_0xa8a8('0xa')](_0x2a3e88,_0x149760)[_0xa8a8('0xb')](function(_0x4b2d78){logger[_0xa8a8('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x367de5,_0xa8a8('0xd'));logger[_0xa8a8('0xe')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x367de5,_0xa8a8('0xd'),JSON[_0xa8a8('0xf')](_0x4b2d78));if(_0x4b2d78[_0xa8a8('0x10')]){if(_0x4b2d78[_0xa8a8('0x10')]['code']===0x1f4){logger['error'](_0xa8a8('0x11'),_0x367de5,_0x4b2d78[_0xa8a8('0x10')][_0xa8a8('0x12')]);return _0x3a401c(_0x4b2d78[_0xa8a8('0x10')][_0xa8a8('0x12')]);}logger[_0xa8a8('0x10')](_0xa8a8('0x11'),_0x367de5,_0x4b2d78['error']['message']);return _0x57a87f(_0x4b2d78['error']['message']);}else{logger[_0xa8a8('0xc')](_0xa8a8('0x11'),_0x367de5,'request\x20sent');_0x57a87f(_0x4b2d78['result'][_0xa8a8('0x12')]);}})[_0xa8a8('0x13')](function(_0x2a988b){logger[_0xa8a8('0x10')](_0xa8a8('0x11'),_0x367de5,_0x2a988b);_0x3a401c(_0x2a988b);});});}exports['CreateSquareDetailsReport']=function(_0x3deccf){var _0x6802e4=this;return new Promise(function(_0x336292,_0x25fbf9){return db['SquareDetailsReport'][_0xa8a8('0x14')](_0x3deccf['body'],{'raw':_0x3deccf['options']?_0x3deccf['options']['raw']===undefined?!![]:![]:!![]})[_0xa8a8('0xb')](function(_0x172c3f){logger[_0xa8a8('0xc')](_0xa8a8('0x15'),_0x3deccf);logger['debug']('CreateSquareDetailsReport',_0x3deccf,JSON[_0xa8a8('0xf')](_0x172c3f));_0x336292(_0x172c3f);})[_0xa8a8('0x13')](function(_0x57b2f6){logger[_0xa8a8('0x10')](_0xa8a8('0x15'),_0x57b2f6[_0xa8a8('0x12')],_0x3deccf);_0x25fbf9(_0x6802e4[_0xa8a8('0x10')](0x1f4,_0x57b2f6[_0xa8a8('0x12')]));});});}; \ No newline at end of file +var _0x94ba=['info','result','SquareDetailsReport','create','body','options','CreateSquareDetailsReport','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message'];(function(_0x316c25,_0x2f684c){var _0x51d1a0=function(_0x5bec7f){while(--_0x5bec7f){_0x316c25['push'](_0x316c25['shift']());}};_0x51d1a0(++_0x2f684c);}(_0x94ba,0x10b));var _0xa94b=function(_0x135704,_0x539aee){_0x135704=_0x135704-0x0;var _0x24e9fd=_0x94ba[_0x135704];return _0x24e9fd;};'use strict';var _=require(_0xa94b('0x0'));var util=require(_0xa94b('0x1'));var moment=require('moment');var BPromise=require(_0xa94b('0x2'));var rs=require(_0xa94b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa94b('0x4'));var logger=require(_0xa94b('0x5'))(_0xa94b('0x6'));var config=require(_0xa94b('0x7'));var jayson=require(_0xa94b('0x8'));var client=jayson[_0xa94b('0x9')][_0xa94b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a96de,_0x5f3283,_0x5a2f23){return new BPromise(function(_0x5566ee,_0x342054){return client[_0xa94b('0xb')](_0x5a96de,_0x5a2f23)['then'](function(_0x43c0e2){logger['info'](_0xa94b('0xc'),_0x5f3283,_0xa94b('0xd'));logger[_0xa94b('0xe')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x5f3283,'request\x20sent',JSON[_0xa94b('0xf')](_0x43c0e2));if(_0x43c0e2['error']){if(_0x43c0e2['error'][_0xa94b('0x10')]===0x1f4){logger[_0xa94b('0x11')](_0xa94b('0xc'),_0x5f3283,_0x43c0e2[_0xa94b('0x11')][_0xa94b('0x12')]);return _0x342054(_0x43c0e2[_0xa94b('0x11')][_0xa94b('0x12')]);}logger[_0xa94b('0x11')](_0xa94b('0xc'),_0x5f3283,_0x43c0e2[_0xa94b('0x11')][_0xa94b('0x12')]);return _0x5566ee(_0x43c0e2[_0xa94b('0x11')][_0xa94b('0x12')]);}else{logger[_0xa94b('0x13')](_0xa94b('0xc'),_0x5f3283,_0xa94b('0xd'));_0x5566ee(_0x43c0e2[_0xa94b('0x14')]['message']);}})['catch'](function(_0x46477f){logger['error'](_0xa94b('0xc'),_0x5f3283,_0x46477f);_0x342054(_0x46477f);});});}exports['CreateSquareDetailsReport']=function(_0x462d92){var _0x2836f9=this;return new Promise(function(_0x2834d5,_0x43d112){return db[_0xa94b('0x15')][_0xa94b('0x16')](_0x462d92[_0xa94b('0x17')],{'raw':_0x462d92['options']?_0x462d92[_0xa94b('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x122b5b){logger[_0xa94b('0x13')](_0xa94b('0x19'),_0x462d92);logger[_0xa94b('0xe')](_0xa94b('0x19'),_0x462d92,JSON['stringify'](_0x122b5b));_0x2834d5(_0x122b5b);})['catch'](function(_0x1541a3){logger['error'](_0xa94b('0x19'),_0x1541a3[_0xa94b('0x12')],_0x462d92);_0x43d112(_0x2836f9['error'](0x1f4,_0x1541a3['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index bd30e34..ba7ec56 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 _0x52c4=['exports','express','Router','../../components/auth/service','./system.controller','get','/process/:pid/kill','isAuthenticated'];(function(_0x80864e,_0x4deeb8){var _0x4e456e=function(_0x137d9d){while(--_0x137d9d){_0x80864e['push'](_0x80864e['shift']());}};_0x4e456e(++_0x4deeb8);}(_0x52c4,0x1b1));var _0x452c=function(_0x4dde86,_0x109773){_0x4dde86=_0x4dde86-0x0;var _0x6a4d07=_0x52c4[_0x4dde86];return _0x6a4d07;};'use strict';var express=require(_0x452c('0x0'));var router=express[_0x452c('0x1')]();var auth=require(_0x452c('0x2'));var controller=require(_0x452c('0x3'));router[_0x452c('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0x452c('0x4')](_0x452c('0x5'),auth[_0x452c('0x6')](),controller['killProcess']);module[_0x452c('0x7')]=router; \ No newline at end of file +var _0xc12a=['exports','express','Router','./system.controller','get','isAuthenticated','index','/process/:pid/kill'];(function(_0x43fb9f,_0x1ee589){var _0x5ecace=function(_0x1831e8){while(--_0x1831e8){_0x43fb9f['push'](_0x43fb9f['shift']());}};_0x5ecace(++_0x1ee589);}(_0xc12a,0x1c1));var _0xac12=function(_0x5a0a30,_0x1a5046){_0x5a0a30=_0x5a0a30-0x0;var _0x4ff7bf=_0xc12a[_0x5a0a30];return _0x4ff7bf;};'use strict';var express=require(_0xac12('0x0'));var router=express[_0xac12('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xac12('0x2'));router[_0xac12('0x3')]('/',auth[_0xac12('0x4')](),controller[_0xac12('0x5')]);router[_0xac12('0x3')](_0xac12('0x6'),auth[_0xac12('0x4')](),controller['killProcess']);module[_0xac12('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index f8048d7..cc0fcf3 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 _0xfca5=['params','length','indexOf','pid','kill','SIGINT','catch','systeminformation','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','index','getAllData','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args'];(function(_0x41e8c4,_0x30d9ff){var _0x54ffbe=function(_0x4131af){while(--_0x4131af){_0x41e8c4['push'](_0x41e8c4['shift']());}};_0x54ffbe(++_0x30d9ff);}(_0xfca5,0xcf));var _0x5fca=function(_0x1a8bbc,_0x17a086){_0x1a8bbc=_0x1a8bbc-0x0;var _0x212fc2=_0xfca5[_0x1a8bbc];return _0x212fc2;};'use strict';var info=require(_0x5fca('0x0'));var exec=require('child_process')[_0x5fca('0x1')];var logger=require(_0x5fca('0x2'))(_0x5fca('0x3'));var util=require(_0x5fca('0x4'));var BPromise=require(_0x5fca('0x5'));var _=require(_0x5fca('0x6'));function handleError(_0x2c0e61,_0x1e4dfa,_0x365133){_0x1e4dfa=_0x1e4dfa||0x1f4;return function(_0x24b606){logger[_0x5fca('0x7')](_0x5fca('0x8'),_0x365133,_0x1e4dfa,util['inspect'](_0x24b606,{'showHidden':![],'depth':null}));delete _0x24b606[_0x5fca('0x9')];_0x2c0e61[_0x5fca('0xa')](_0x1e4dfa)['send'](_0x24b606);};}exports[_0x5fca('0xb')]=function(_0x319e03,_0x2ed2df){return info[_0x5fca('0xc')]()['then'](function(_0x1cde5a){return _0x2ed2df[_0x5fca('0xa')](0xc8)['json'](_0x1cde5a);})['catch'](function(_0x2ea810){return _0x2ed2df[_0x5fca('0xa')](0x1f4)[_0x5fca('0xd')](_0x2ea810);});};exports[_0x5fca('0xe')]=function(_0x32b77c,_0x524bc9){var _0x4968f4=[_0x5fca('0xf')];return new BPromise(function(_0x56e0de,_0x58c2f1){return exec(util[_0x5fca('0x10')](_0x5fca('0x11'),_0x32b77c[_0x5fca('0x12')]['pid']),function(_0x4c1b81,_0x2e0b5b,_0x2271fb){if(_0x4c1b81){return _0x58c2f1(_0x4c1b81);}return _0x56e0de(_0x2e0b5b);});})['then'](function(_0x5ae2aa){var _0x5036f0=![];var _0x4cdd7b=_0x5ae2aa['split'](/\n/);for(var _0x4649fc=0x0,_0xb5e32e=_0x4968f4[_0x5fca('0x13')];_0x4649fc<_0xb5e32e,_0x5036f0===![];_0x4649fc+=0x1){if(_0x5ae2aa[_0x5fca('0x14')](_0x4968f4[_0x4649fc])>=0x0){_0x5036f0=!![];}}if(!_0x5036f0){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x32b77c[_0x5fca('0x12')][_0x5fca('0x15')]));}process[_0x5fca('0x16')](_0x32b77c[_0x5fca('0x12')][_0x5fca('0x15')],_0x5fca('0x17'));return _0x524bc9[_0x5fca('0xa')](0xc8)[_0x5fca('0xd')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x32b77c['params'][_0x5fca('0x15')])});})[_0x5fca('0x18')](handleError(_0x524bc9,null,_0x5fca('0xe')));}; \ No newline at end of file +var _0x3f90=['util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','index','getAllData','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api'];(function(_0x22b3a2,_0xba8b1e){var _0x102b4e=function(_0x366c06){while(--_0x366c06){_0x22b3a2['push'](_0x22b3a2['shift']());}};_0x102b4e(++_0xba8b1e);}(_0x3f90,0x175));var _0x03f9=function(_0x133cbc,_0x10f6ff){_0x133cbc=_0x133cbc-0x0;var _0x1bd1a1=_0x3f90[_0x133cbc];return _0x1bd1a1;};'use strict';var info=require('systeminformation');var exec=require(_0x03f9('0x0'))[_0x03f9('0x1')];var logger=require(_0x03f9('0x2'))(_0x03f9('0x3'));var util=require(_0x03f9('0x4'));var BPromise=require(_0x03f9('0x5'));var _=require(_0x03f9('0x6'));function handleError(_0x230651,_0x1a5fb8,_0x8a9679){_0x1a5fb8=_0x1a5fb8||0x1f4;return function(_0x4124cc){logger[_0x03f9('0x7')](_0x03f9('0x8'),_0x8a9679,_0x1a5fb8,util[_0x03f9('0x9')](_0x4124cc,{'showHidden':![],'depth':null}));delete _0x4124cc['name'];_0x230651[_0x03f9('0xa')](_0x1a5fb8)[_0x03f9('0xb')](_0x4124cc);};}exports[_0x03f9('0xc')]=function(_0x532e36,_0x7e6894){return info[_0x03f9('0xd')]()['then'](function(_0x2c944e){return _0x7e6894[_0x03f9('0xa')](0xc8)[_0x03f9('0xe')](_0x2c944e);})[_0x03f9('0xf')](function(_0x2b219e){return _0x7e6894['status'](0x1f4)[_0x03f9('0xe')](_0x2b219e);});};exports[_0x03f9('0x10')]=function(_0x30aa93,_0x50ebde){var _0x42af44=[_0x03f9('0x11')];return new BPromise(function(_0x56d36f,_0x115815){return exec(util[_0x03f9('0x12')](_0x03f9('0x13'),_0x30aa93[_0x03f9('0x14')]['pid']),function(_0x1550dd,_0xe11c2f,_0x271030){if(_0x1550dd){return _0x115815(_0x1550dd);}return _0x56d36f(_0xe11c2f);});})['then'](function(_0x4a8eea){var _0x493a31=![];var _0x2ae85f=_0x4a8eea[_0x03f9('0x15')](/\n/);for(var _0xf2a4de=0x0,_0x44fb4a=_0x42af44[_0x03f9('0x16')];_0xf2a4de<_0x44fb4a,_0x493a31===![];_0xf2a4de+=0x1){if(_0x4a8eea[_0x03f9('0x17')](_0x42af44[_0xf2a4de])>=0x0){_0x493a31=!![];}}if(!_0x493a31){throw new Error(util[_0x03f9('0x12')](_0x03f9('0x18'),_0x30aa93['params'][_0x03f9('0x19')]));}process[_0x03f9('0x1a')](_0x30aa93[_0x03f9('0x14')]['pid'],_0x03f9('0x1b'));return _0x50ebde[_0x03f9('0xa')](0xc8)[_0x03f9('0xe')]({'message':util[_0x03f9('0x12')](_0x03f9('0x1c'),_0x30aa93[_0x03f9('0x14')][_0x03f9('0x19')])});})[_0x03f9('0xf')](handleError(_0x50ebde,null,_0x03f9('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index c85169f..d19a0d6 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 _0xbdb7=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','post','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3d6e29,_0x1fff8a){var _0x163bc0=function(_0x2da656){while(--_0x2da656){_0x3d6e29['push'](_0x3d6e29['shift']());}};_0x163bc0(++_0x1fff8a);}(_0xbdb7,0x12e));var _0x7bdb=function(_0xa57c50,_0x1c6754){_0xa57c50=_0xa57c50-0x0;var _0x2c55b4=_0xbdb7[_0xa57c50];return _0x2c55b4;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var auth=require(_0x7bdb('0x6'));var interaction=require(_0x7bdb('0x7'));var config=require(_0x7bdb('0x8'));var controller=require('./tag.controller');router[_0x7bdb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7bdb('0x9')](_0x7bdb('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x7bdb('0xb')]('/',auth[_0x7bdb('0xc')](),controller['create']);router['put'](_0x7bdb('0xa'),auth[_0x7bdb('0xc')](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xe')](_0x7bdb('0xa'),auth[_0x7bdb('0xc')](),controller[_0x7bdb('0xf')]);module[_0x7bdb('0x10')]=router; \ No newline at end of file +var _0x99e9=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports'];(function(_0x42bafd,_0x3f0fe3){var _0x2ed705=function(_0x4311ea){while(--_0x4311ea){_0x42bafd['push'](_0x42bafd['shift']());}};_0x2ed705(++_0x3f0fe3);}(_0x99e9,0xb4));var _0x999e=function(_0x5b13c3,_0x378e0a){_0x5b13c3=_0x5b13c3-0x0;var _0x3d6780=_0x99e9[_0x5b13c3];return _0x3d6780;};'use strict';var multer=require('multer');var util=require(_0x999e('0x0'));var path=require(_0x999e('0x1'));var timeout=require(_0x999e('0x2'));var express=require(_0x999e('0x3'));var router=express['Router']();var auth=require(_0x999e('0x4'));var interaction=require(_0x999e('0x5'));var config=require(_0x999e('0x6'));var controller=require('./tag.controller');router[_0x999e('0x7')]('/',auth['isAuthenticated'](),controller[_0x999e('0x8')]);router[_0x999e('0x7')](_0x999e('0x9'),auth[_0x999e('0xa')](),controller['show']);router[_0x999e('0xb')]('/',auth[_0x999e('0xa')](),controller[_0x999e('0xc')]);router[_0x999e('0xd')](_0x999e('0x9'),auth[_0x999e('0xa')](),controller[_0x999e('0xe')]);router[_0x999e('0xf')](_0x999e('0x9'),auth[_0x999e('0xa')](),controller[_0x999e('0x10')]);module[_0x999e('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 8d34e34..6832858 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 _0x36ee=['STRING','#0091EA'];(function(_0x208959,_0x33803e){var _0x3f7776=function(_0x19b7f5){while(--_0x19b7f5){_0x208959['push'](_0x208959['shift']());}};_0x3f7776(++_0x33803e);}(_0x36ee,0xe8));var _0xe36e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36ee[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe36e('0x0')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xe36e('0x0')],'defaultValue':_0xe36e('0x1')},'description':{'type':Sequelize[_0xe36e('0x0')]}}; \ No newline at end of file +var _0xe5b5=['exports','STRING','name','#0091EA','sequelize'];(function(_0x491249,_0x3acad4){var _0xc507ce=function(_0x274cec){while(--_0x274cec){_0x491249['push'](_0x491249['shift']());}};_0xc507ce(++_0x3acad4);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x178668,_0x1ec300){_0x178668=_0x178668-0x0;var _0x26107d=_0xe5b5[_0x178668];return _0x26107d;};'use strict';var Sequelize=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]={'name':{'type':Sequelize[_0x5e5b('0x2')],'unique':_0x5e5b('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x5e5b('0x2')],'defaultValue':_0x5e5b('0x4')},'description':{'type':Sequelize[_0x5e5b('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 44b48a8..2d3db13 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 _0xe1a1=['query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','Tag','includeAll','include','findAll','rows','catch','params','keys','length','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','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','status','end','json','count','offset','limit','apply','reject','save','update','then','get','Tags','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','type','model'];(function(_0x48ec91,_0x212edc){var _0x22766c=function(_0x136751){while(--_0x136751){_0x48ec91['push'](_0x48ec91['shift']());}};_0x22766c(++_0x212edc);}(_0xe1a1,0x104));var _0x1e1a=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xe1a1[_0x4ae6ef];return _0x3cbb4e;};'use strict';var pdf=require(_0x1e1a('0x0'));var emlformat=require(_0x1e1a('0x1'));var rimraf=require(_0x1e1a('0x2'));var zipdir=require(_0x1e1a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1e1a('0x4'));var Mustache=require(_0x1e1a('0x5'));var util=require(_0x1e1a('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1e1a('0x7'));var ejs=require(_0x1e1a('0x8'));var fs=require('fs');var _=require(_0x1e1a('0x9'));var squel=require(_0x1e1a('0xa'));var crypto=require(_0x1e1a('0xb'));var jsforce=require(_0x1e1a('0xc'));var deskjs=require(_0x1e1a('0xd'));var toCsv=require(_0x1e1a('0x7'));var querystring=require(_0x1e1a('0xe'));var Papa=require(_0x1e1a('0xf'));var Redis=require(_0x1e1a('0x10'));var authService=require(_0x1e1a('0x11'));var qs=require(_0x1e1a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1e1a('0x13'));var utils=require(_0x1e1a('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x329186,_0x5ee217){_0x5ee217=_0x5ee217||0xcc;return function(_0x143269){if(_0x143269){return _0x329186['sendStatus'](_0x5ee217);}return _0x329186[_0x1e1a('0x15')](_0x5ee217)[_0x1e1a('0x16')]();};}function respondWithResult(_0x515ac1,_0x5cf880){_0x5cf880=_0x5cf880||0xc8;return function(_0x55b6d9){if(_0x55b6d9){return _0x515ac1[_0x1e1a('0x15')](_0x5cf880)[_0x1e1a('0x17')](_0x55b6d9);}};}function respondWithFilteredResult(_0x34f172,_0x180380){return function(_0x2627e7){if(_0x2627e7){var _0x229e3e=_0x2627e7[_0x1e1a('0x18')],_0x42cdb8=_0x180380[_0x1e1a('0x19')],_0x5b8876=_0x180380[_0x1e1a('0x19')]+_0x180380[_0x1e1a('0x1a')],_0x1c7cd7;if(_0x5b8876>=_0x229e3e){_0x5b8876=_0x229e3e;_0x1c7cd7=0xc8;}else{_0x1c7cd7=0xce;}_0x34f172['status'](_0x1c7cd7);return _0x34f172['set']('Content-Range',_0x42cdb8+'-'+_0x5b8876+'/'+_0x229e3e)['json'](_0x2627e7);}return null;};}function patchUpdates(_0x14d3a4){return function(_0x52e001){try{jsonpatch[_0x1e1a('0x1b')](_0x52e001,_0x14d3a4,!![]);}catch(_0x599d4f){return BPromise[_0x1e1a('0x1c')](_0x599d4f);}return _0x52e001[_0x1e1a('0x1d')]();};}function saveUpdates(_0x2a5b4d,_0xd26d01){return function(_0x30f162){if(_0x30f162){return _0x30f162[_0x1e1a('0x1e')](_0x2a5b4d)[_0x1e1a('0x1f')](function(_0x573704){return _0x573704;});}return null;};}function removeEntity(_0x16ab49,_0x1161b7){return function(_0x7e2fa3){if(_0x7e2fa3){return _0x7e2fa3['destroy']()['then'](function(){var _0x45c1cf=_0x7e2fa3[_0x1e1a('0x20')]({'plain':!![]});var _0x357368=_0x1e1a('0x21');return db[_0x1e1a('0x22')][_0x1e1a('0x23')]({'where':{'type':_0x357368,'resourceId':_0x45c1cf['id']}})[_0x1e1a('0x1f')](function(){return _0x7e2fa3;});})[_0x1e1a('0x1f')](function(){_0x16ab49[_0x1e1a('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x330ad6,_0x360723){return function(_0x15fc14){if(!_0x15fc14){_0x330ad6['sendStatus'](0x194);}return _0x15fc14;};}function handleError(_0x5b0b62,_0x4124d0){_0x4124d0=_0x4124d0||0x1f4;return function(_0x657384){logger[_0x1e1a('0x24')](_0x657384['stack']);if(_0x657384[_0x1e1a('0x25')]){delete _0x657384['name'];}_0x5b0b62['status'](_0x4124d0)[_0x1e1a('0x26')](_0x657384);};}exports[_0x1e1a('0x27')]=function(_0x412338,_0x49ccf7){var _0x381b41={},_0x3e5e58={},_0x1a0f44={'count':0x0,'rows':[]};var _0xd1021=_[_0x1e1a('0x28')](db['Tag'][_0x1e1a('0x29')],function(_0x3906e2){return{'name':_0x3906e2['fieldName'],'type':_0x3906e2[_0x1e1a('0x2a')]['key']};});_0x3e5e58[_0x1e1a('0x2b')]=_['map'](_0xd1021,_0x1e1a('0x25'));_0x3e5e58[_0x1e1a('0x2c')]=_['keys'](_0x412338[_0x1e1a('0x2c')]);_0x3e5e58['filters']=_[_0x1e1a('0x2d')](_0x3e5e58[_0x1e1a('0x2b')],_0x3e5e58[_0x1e1a('0x2c')]);_0x381b41[_0x1e1a('0x2e')]=_[_0x1e1a('0x2d')](_0x3e5e58[_0x1e1a('0x2b')],qs[_0x1e1a('0x2f')](_0x412338['query'][_0x1e1a('0x2f')]));_0x381b41['attributes']=_0x381b41[_0x1e1a('0x2e')]['length']?_0x381b41[_0x1e1a('0x2e')]:_0x3e5e58[_0x1e1a('0x2b')];if(!_0x412338[_0x1e1a('0x2c')][_0x1e1a('0x30')](_0x1e1a('0x31'))){_0x381b41[_0x1e1a('0x1a')]=qs[_0x1e1a('0x1a')](_0x412338['query'][_0x1e1a('0x1a')]);_0x381b41[_0x1e1a('0x19')]=qs[_0x1e1a('0x19')](_0x412338[_0x1e1a('0x2c')][_0x1e1a('0x19')]);}_0x381b41[_0x1e1a('0x32')]=qs[_0x1e1a('0x33')](_0x412338[_0x1e1a('0x2c')][_0x1e1a('0x33')]);_0x381b41['where']=qs['filters'](_['pick'](_0x412338[_0x1e1a('0x2c')],_0x3e5e58[_0x1e1a('0x34')]),_0xd1021);if(_0x412338[_0x1e1a('0x2c')][_0x1e1a('0x35')]){_0x381b41[_0x1e1a('0x36')]=_[_0x1e1a('0x37')](_0x381b41[_0x1e1a('0x36')],{'$or':_[_0x1e1a('0x28')](_0xd1021,function(_0x8089){if(_0x8089[_0x1e1a('0x2a')]!==_0x1e1a('0x38')){var _0x1ce729={};_0x1ce729[_0x8089[_0x1e1a('0x25')]]={'$like':'%'+_0x412338[_0x1e1a('0x2c')][_0x1e1a('0x35')]+'%'};return _0x1ce729;}})});}_0x381b41=_[_0x1e1a('0x37')]({},_0x381b41,_0x412338[_0x1e1a('0x39')]);var _0x28722f={'where':_0x381b41['where']};return db[_0x1e1a('0x3a')]['count'](_0x28722f)[_0x1e1a('0x1f')](function(_0x16d993){_0x1a0f44['count']=_0x16d993;if(_0x412338['query'][_0x1e1a('0x3b')]){_0x381b41[_0x1e1a('0x3c')]=[{'all':!![]}];}return db[_0x1e1a('0x3a')][_0x1e1a('0x3d')](_0x381b41);})[_0x1e1a('0x1f')](function(_0x827a43){_0x1a0f44[_0x1e1a('0x3e')]=_0x827a43;return _0x1a0f44;})[_0x1e1a('0x1f')](respondWithFilteredResult(_0x49ccf7,_0x381b41))[_0x1e1a('0x3f')](handleError(_0x49ccf7,null));};exports['show']=function(_0x397c76,_0x5789ca){var _0x17efdb={'raw':!![],'where':{'id':_0x397c76[_0x1e1a('0x40')]['id']}},_0x247bb6={};_0x247bb6[_0x1e1a('0x2b')]=_[_0x1e1a('0x41')](db[_0x1e1a('0x3a')][_0x1e1a('0x29')]);_0x247bb6[_0x1e1a('0x2c')]=_[_0x1e1a('0x41')](_0x397c76['query']);_0x247bb6[_0x1e1a('0x34')]=_[_0x1e1a('0x2d')](_0x247bb6['model'],_0x247bb6[_0x1e1a('0x2c')]);_0x17efdb[_0x1e1a('0x2e')]=_[_0x1e1a('0x2d')](_0x247bb6[_0x1e1a('0x2b')],qs[_0x1e1a('0x2f')](_0x397c76['query'][_0x1e1a('0x2f')]));_0x17efdb[_0x1e1a('0x2e')]=_0x17efdb[_0x1e1a('0x2e')][_0x1e1a('0x42')]?_0x17efdb[_0x1e1a('0x2e')]:_0x247bb6[_0x1e1a('0x2b')];if(_0x397c76['query'][_0x1e1a('0x3b')]){_0x17efdb[_0x1e1a('0x3c')]=[{'all':!![]}];}_0x17efdb=_[_0x1e1a('0x37')]({},_0x17efdb,_0x397c76[_0x1e1a('0x39')]);return db['Tag'][_0x1e1a('0x43')](_0x17efdb)[_0x1e1a('0x1f')](handleEntityNotFound(_0x5789ca,null))[_0x1e1a('0x1f')](respondWithResult(_0x5789ca,null))[_0x1e1a('0x3f')](handleError(_0x5789ca,null));};exports[_0x1e1a('0x44')]=function(_0x14a080,_0x2ca7ed){return db[_0x1e1a('0x3a')][_0x1e1a('0x44')](_0x14a080[_0x1e1a('0x45')],{})[_0x1e1a('0x1f')](function(_0x51ecbb){var _0x31a2bb=_0x14a080[_0x1e1a('0x46')]['get']({'plain':!![]});if(!_0x31a2bb)throw new Error(_0x1e1a('0x47'));if(_0x31a2bb[_0x1e1a('0x48')]==='user'){var _0x1b89d6=_0x51ecbb['get']({'plain':!![]});var _0x14673a=_0x1e1a('0x21');return db[_0x1e1a('0x49')][_0x1e1a('0x43')]({'where':{'name':_0x14673a,'userProfileId':_0x31a2bb[_0x1e1a('0x4a')]},'raw':!![]})[_0x1e1a('0x1f')](function(_0x155062){if(_0x155062&&_0x155062['autoAssociation']===0x0){return db[_0x1e1a('0x22')][_0x1e1a('0x44')]({'name':_0x1b89d6['name'],'resourceId':_0x1b89d6['id'],'type':_0x155062[_0x1e1a('0x25')],'sectionId':_0x155062['id']},{})[_0x1e1a('0x1f')](function(){return _0x51ecbb;});}else{return _0x51ecbb;}})[_0x1e1a('0x3f')](function(_0x4190f4){logger[_0x1e1a('0x24')](_0x1e1a('0x4b'),_0x4190f4);throw _0x4190f4;});}return _0x51ecbb;})[_0x1e1a('0x1f')](respondWithResult(_0x2ca7ed,0xc9))[_0x1e1a('0x3f')](handleError(_0x2ca7ed,null));};exports[_0x1e1a('0x1e')]=function(_0x16dffd,_0x2c5f3b){if(_0x16dffd[_0x1e1a('0x45')]['id']){delete _0x16dffd[_0x1e1a('0x45')]['id'];}return db[_0x1e1a('0x3a')][_0x1e1a('0x43')]({'where':{'id':_0x16dffd[_0x1e1a('0x40')]['id']}})[_0x1e1a('0x1f')](handleEntityNotFound(_0x2c5f3b,null))[_0x1e1a('0x1f')](saveUpdates(_0x16dffd[_0x1e1a('0x45')],null))[_0x1e1a('0x1f')](respondWithResult(_0x2c5f3b,null))[_0x1e1a('0x3f')](handleError(_0x2c5f3b,null));};exports['destroy']=function(_0x243540,_0x548f00){return db[_0x1e1a('0x3a')][_0x1e1a('0x43')]({'where':{'id':_0x243540[_0x1e1a('0x40')]['id']}})['then'](handleEntityNotFound(_0x548f00,null))['then'](removeEntity(_0x548f00,null))[_0x1e1a('0x3f')](handleError(_0x548f00,null));}; \ No newline at end of file +var _0x1ed9=['intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','name','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Tags','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','get','UserProfileResource','destroy','then','end','error','stack','send','index','map','Tag','rawAttributes','fieldName','type','key','query','filters'];(function(_0xf07bce,_0x4cdc06){var _0x5c3181=function(_0x5d1d93){while(--_0x5d1d93){_0xf07bce['push'](_0xf07bce['shift']());}};_0x5c3181(++_0x4cdc06);}(_0x1ed9,0xc5));var _0x91ed=function(_0x151991,_0x16d0e5){_0x151991=_0x151991-0x0;var _0x1d3f06=_0x1ed9[_0x151991];return _0x1d3f06;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x91ed('0x0'));var rimraf=require(_0x91ed('0x1'));var zipdir=require(_0x91ed('0x2'));var jsonpatch=require(_0x91ed('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x91ed('0x4'));var Mustache=require(_0x91ed('0x5'));var util=require(_0x91ed('0x6'));var path=require(_0x91ed('0x7'));var sox=require(_0x91ed('0x8'));var csv=require(_0x91ed('0x9'));var ejs=require(_0x91ed('0xa'));var fs=require('fs');var _=require(_0x91ed('0xb'));var squel=require(_0x91ed('0xc'));var crypto=require(_0x91ed('0xd'));var jsforce=require(_0x91ed('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x91ed('0x9'));var querystring=require(_0x91ed('0xf'));var Papa=require(_0x91ed('0x10'));var Redis=require(_0x91ed('0x11'));var authService=require(_0x91ed('0x12'));var qs=require(_0x91ed('0x13'));var as=require(_0x91ed('0x14'));var hardwareService=require(_0x91ed('0x15'));var logger=require(_0x91ed('0x16'))('api');var utils=require(_0x91ed('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x91ed('0x18'))['db'];function respondWithStatusCode(_0x2fe260,_0xd7b8a9){_0xd7b8a9=_0xd7b8a9||0xcc;return function(_0x1303a1){if(_0x1303a1){return _0x2fe260[_0x91ed('0x19')](_0xd7b8a9);}return _0x2fe260[_0x91ed('0x1a')](_0xd7b8a9)['end']();};}function respondWithResult(_0x5e417b,_0x51b1c9){_0x51b1c9=_0x51b1c9||0xc8;return function(_0x249412){if(_0x249412){return _0x5e417b[_0x91ed('0x1a')](_0x51b1c9)[_0x91ed('0x1b')](_0x249412);}};}function respondWithFilteredResult(_0x114222,_0x100455){return function(_0x19d453){if(_0x19d453){var _0x237846=_0x19d453[_0x91ed('0x1c')],_0x46465f=_0x100455[_0x91ed('0x1d')],_0x464f76=_0x100455['offset']+_0x100455[_0x91ed('0x1e')],_0x5eea02;if(_0x464f76>=_0x237846){_0x464f76=_0x237846;_0x5eea02=0xc8;}else{_0x5eea02=0xce;}_0x114222[_0x91ed('0x1a')](_0x5eea02);return _0x114222['set'](_0x91ed('0x1f'),_0x46465f+'-'+_0x464f76+'/'+_0x237846)[_0x91ed('0x1b')](_0x19d453);}return null;};}function patchUpdates(_0x19b75a){return function(_0x2f6d11){try{jsonpatch[_0x91ed('0x20')](_0x2f6d11,_0x19b75a,!![]);}catch(_0x1cb93c){return BPromise[_0x91ed('0x21')](_0x1cb93c);}return _0x2f6d11[_0x91ed('0x22')]();};}function saveUpdates(_0x45e544,_0x4ae00b){return function(_0xa16cff){if(_0xa16cff){return _0xa16cff['update'](_0x45e544)['then'](function(_0x5a39ae){return _0x5a39ae;});}return null;};}function removeEntity(_0x5847a5,_0x4ce5da){return function(_0x5ae100){if(_0x5ae100){return _0x5ae100['destroy']()['then'](function(){var _0x4f3ea8=_0x5ae100[_0x91ed('0x23')]({'plain':!![]});var _0x2a2e54='Tags';return db[_0x91ed('0x24')][_0x91ed('0x25')]({'where':{'type':_0x2a2e54,'resourceId':_0x4f3ea8['id']}})[_0x91ed('0x26')](function(){return _0x5ae100;});})['then'](function(){_0x5847a5[_0x91ed('0x1a')](0xcc)[_0x91ed('0x27')]();});}};}function handleEntityNotFound(_0x4215dd,_0x51538d){return function(_0x45a129){if(!_0x45a129){_0x4215dd[_0x91ed('0x19')](0x194);}return _0x45a129;};}function handleError(_0x4303cd,_0x1e11e3){_0x1e11e3=_0x1e11e3||0x1f4;return function(_0x5ac6d9){logger[_0x91ed('0x28')](_0x5ac6d9[_0x91ed('0x29')]);if(_0x5ac6d9['name']){delete _0x5ac6d9['name'];}_0x4303cd[_0x91ed('0x1a')](_0x1e11e3)[_0x91ed('0x2a')](_0x5ac6d9);};}exports[_0x91ed('0x2b')]=function(_0x27b89c,_0xb8df78){var _0x44cc63={},_0x2df360={},_0x19ab54={'count':0x0,'rows':[]};var _0x42ea57=_[_0x91ed('0x2c')](db[_0x91ed('0x2d')][_0x91ed('0x2e')],function(_0x4c6828){return{'name':_0x4c6828[_0x91ed('0x2f')],'type':_0x4c6828[_0x91ed('0x30')][_0x91ed('0x31')]};});_0x2df360['model']=_[_0x91ed('0x2c')](_0x42ea57,'name');_0x2df360[_0x91ed('0x32')]=_['keys'](_0x27b89c[_0x91ed('0x32')]);_0x2df360[_0x91ed('0x33')]=_[_0x91ed('0x34')](_0x2df360[_0x91ed('0x35')],_0x2df360[_0x91ed('0x32')]);_0x44cc63['attributes']=_[_0x91ed('0x34')](_0x2df360[_0x91ed('0x35')],qs[_0x91ed('0x36')](_0x27b89c['query'][_0x91ed('0x36')]));_0x44cc63[_0x91ed('0x37')]=_0x44cc63['attributes'][_0x91ed('0x38')]?_0x44cc63['attributes']:_0x2df360[_0x91ed('0x35')];if(!_0x27b89c[_0x91ed('0x32')][_0x91ed('0x39')](_0x91ed('0x3a'))){_0x44cc63[_0x91ed('0x1e')]=qs[_0x91ed('0x1e')](_0x27b89c['query']['limit']);_0x44cc63[_0x91ed('0x1d')]=qs['offset'](_0x27b89c['query']['offset']);}_0x44cc63[_0x91ed('0x3b')]=qs['sort'](_0x27b89c[_0x91ed('0x32')][_0x91ed('0x3c')]);_0x44cc63['where']=qs['filters'](_['pick'](_0x27b89c[_0x91ed('0x32')],_0x2df360[_0x91ed('0x33')]),_0x42ea57);if(_0x27b89c['query'][_0x91ed('0x3d')]){_0x44cc63[_0x91ed('0x3e')]=_[_0x91ed('0x3f')](_0x44cc63['where'],{'$or':_[_0x91ed('0x2c')](_0x42ea57,function(_0x3d9ce1){if(_0x3d9ce1[_0x91ed('0x30')]!==_0x91ed('0x40')){var _0x4f7068={};_0x4f7068[_0x3d9ce1[_0x91ed('0x41')]]={'$like':'%'+_0x27b89c[_0x91ed('0x32')][_0x91ed('0x3d')]+'%'};return _0x4f7068;}})});}_0x44cc63=_[_0x91ed('0x3f')]({},_0x44cc63,_0x27b89c['options']);var _0xfd70f1={'where':_0x44cc63[_0x91ed('0x3e')]};return db[_0x91ed('0x2d')][_0x91ed('0x1c')](_0xfd70f1)[_0x91ed('0x26')](function(_0x2a13e6){_0x19ab54[_0x91ed('0x1c')]=_0x2a13e6;if(_0x27b89c[_0x91ed('0x32')][_0x91ed('0x42')]){_0x44cc63[_0x91ed('0x43')]=[{'all':!![]}];}return db[_0x91ed('0x2d')][_0x91ed('0x44')](_0x44cc63);})[_0x91ed('0x26')](function(_0x2de26d){_0x19ab54[_0x91ed('0x45')]=_0x2de26d;return _0x19ab54;})[_0x91ed('0x26')](respondWithFilteredResult(_0xb8df78,_0x44cc63))[_0x91ed('0x46')](handleError(_0xb8df78,null));};exports[_0x91ed('0x47')]=function(_0x26a2bd,_0x2c31c8){var _0x3e4ab2={'raw':!![],'where':{'id':_0x26a2bd[_0x91ed('0x48')]['id']}},_0x463630={};_0x463630[_0x91ed('0x35')]=_[_0x91ed('0x49')](db['Tag'][_0x91ed('0x2e')]);_0x463630[_0x91ed('0x32')]=_['keys'](_0x26a2bd[_0x91ed('0x32')]);_0x463630[_0x91ed('0x33')]=_[_0x91ed('0x34')](_0x463630[_0x91ed('0x35')],_0x463630['query']);_0x3e4ab2['attributes']=_['intersection'](_0x463630[_0x91ed('0x35')],qs[_0x91ed('0x36')](_0x26a2bd[_0x91ed('0x32')][_0x91ed('0x36')]));_0x3e4ab2[_0x91ed('0x37')]=_0x3e4ab2[_0x91ed('0x37')][_0x91ed('0x38')]?_0x3e4ab2['attributes']:_0x463630[_0x91ed('0x35')];if(_0x26a2bd['query'][_0x91ed('0x42')]){_0x3e4ab2[_0x91ed('0x43')]=[{'all':!![]}];}_0x3e4ab2=_[_0x91ed('0x3f')]({},_0x3e4ab2,_0x26a2bd['options']);return db[_0x91ed('0x2d')][_0x91ed('0x4a')](_0x3e4ab2)[_0x91ed('0x26')](handleEntityNotFound(_0x2c31c8,null))[_0x91ed('0x26')](respondWithResult(_0x2c31c8,null))[_0x91ed('0x46')](handleError(_0x2c31c8,null));};exports[_0x91ed('0x4b')]=function(_0x2ac08a,_0x328346){return db[_0x91ed('0x2d')][_0x91ed('0x4b')](_0x2ac08a[_0x91ed('0x4c')],{})[_0x91ed('0x26')](function(_0x3114f6){var _0x216d00=_0x2ac08a[_0x91ed('0x4d')][_0x91ed('0x23')]({'plain':!![]});if(!_0x216d00)throw new Error(_0x91ed('0x4e'));if(_0x216d00['role']===_0x91ed('0x4d')){var _0x578016=_0x3114f6[_0x91ed('0x23')]({'plain':!![]});var _0x484403=_0x91ed('0x4f');return db['UserProfileSection'][_0x91ed('0x4a')]({'where':{'name':_0x484403,'userProfileId':_0x216d00[_0x91ed('0x50')]},'raw':!![]})[_0x91ed('0x26')](function(_0x188477){if(_0x188477&&_0x188477[_0x91ed('0x51')]===0x0){return db[_0x91ed('0x24')]['create']({'name':_0x578016[_0x91ed('0x41')],'resourceId':_0x578016['id'],'type':_0x188477[_0x91ed('0x41')],'sectionId':_0x188477['id']},{})[_0x91ed('0x26')](function(){return _0x3114f6;});}else{return _0x3114f6;}})['catch'](function(_0x50628e){logger[_0x91ed('0x28')](_0x91ed('0x52'),_0x50628e);throw _0x50628e;});}return _0x3114f6;})[_0x91ed('0x26')](respondWithResult(_0x328346,0xc9))[_0x91ed('0x46')](handleError(_0x328346,null));};exports['update']=function(_0x3b18d7,_0x1f10db){if(_0x3b18d7[_0x91ed('0x4c')]['id']){delete _0x3b18d7[_0x91ed('0x4c')]['id'];}return db[_0x91ed('0x2d')]['find']({'where':{'id':_0x3b18d7[_0x91ed('0x48')]['id']}})[_0x91ed('0x26')](handleEntityNotFound(_0x1f10db,null))['then'](saveUpdates(_0x3b18d7['body'],null))[_0x91ed('0x26')](respondWithResult(_0x1f10db,null))[_0x91ed('0x46')](handleError(_0x1f10db,null));};exports[_0x91ed('0x25')]=function(_0xb74a01,_0x311e5a){return db[_0x91ed('0x2d')]['find']({'where':{'id':_0xb74a01[_0x91ed('0x48')]['id']}})['then'](handleEntityNotFound(_0x311e5a,null))[_0x91ed('0x26')](removeEntity(_0x311e5a,null))['catch'](handleError(_0x311e5a,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 38b110e..698ae82 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 _0x9b05=['moment','bluebird','request-promise','path','./tag.attributes','exports','Tag','tools_tags','util','../../config/logger','api'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9b05,0x1cb));var _0x59b0=function(_0x74c392,_0x29cc28){_0x74c392=_0x74c392-0x0;var _0x306791=_0x9b05[_0x74c392];return _0x306791;};'use strict';var _=require('lodash');var util=require(_0x59b0('0x0'));var logger=require(_0x59b0('0x1'))(_0x59b0('0x2'));var moment=require(_0x59b0('0x3'));var BPromise=require(_0x59b0('0x4'));var rp=require(_0x59b0('0x5'));var fs=require('fs');var path=require(_0x59b0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x59b0('0x7'));module[_0x59b0('0x8')]=function(_0x3691bd,_0x41d3e4){return _0x3691bd['define'](_0x59b0('0x9'),attributes,{'tableName':_0x59b0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7996=['./tag.attributes','define','tools_tags','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4c06ac,_0x568788){var _0x2333cb=function(_0xdb5c64){while(--_0xdb5c64){_0x4c06ac['push'](_0x4c06ac['shift']());}};_0x2333cb(++_0x568788);}(_0x7996,0x14d));var _0x6799=function(_0x14090e,_0x30c2f7){_0x14090e=_0x14090e-0x0;var _0x554da7=_0x7996[_0x14090e];return _0x554da7;};'use strict';var _=require('lodash');var util=require(_0x6799('0x0'));var logger=require(_0x6799('0x1'))(_0x6799('0x2'));var moment=require(_0x6799('0x3'));var BPromise=require(_0x6799('0x4'));var rp=require(_0x6799('0x5'));var fs=require('fs');var path=require(_0x6799('0x6'));var rimraf=require(_0x6799('0x7'));var config=require('../../config/environment');var attributes=require(_0x6799('0x8'));module['exports']=function(_0x3f3d1f,_0x534d43){return _0x3f3d1f[_0x6799('0x9')]('Tag',attributes,{'tableName':_0x6799('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index d7b9dab..d1b6c9e 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 _0x0102=['info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/environment','jayson/promise','client','http','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0102,0x186));var _0x2010=function(_0x34f601,_0x380e82){_0x34f601=_0x34f601-0x0;var _0x582e9b=_0x0102[_0x34f601];return _0x582e9b;};'use strict';var _=require('lodash');var util=require(_0x2010('0x0'));var moment=require(_0x2010('0x1'));var BPromise=require(_0x2010('0x2'));var rs=require(_0x2010('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2010('0x4'));var jayson=require(_0x2010('0x5'));var client=jayson[_0x2010('0x6')][_0x2010('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4eeb67,_0x453fc0,_0x495d98){return new BPromise(function(_0x4728c0,_0x160e41){return client['request'](_0x4eeb67,_0x495d98)[_0x2010('0x8')](function(_0x3c2d98){logger[_0x2010('0x9')](_0x2010('0xa'),_0x453fc0,_0x2010('0xb'));logger[_0x2010('0xc')](_0x2010('0xd'),_0x453fc0,_0x2010('0xb'),JSON[_0x2010('0xe')](_0x3c2d98));if(_0x3c2d98[_0x2010('0xf')]){if(_0x3c2d98[_0x2010('0xf')][_0x2010('0x10')]===0x1f4){logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);return _0x160e41(_0x3c2d98['error']['message']);}logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);return _0x4728c0(_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);}else{logger['info'](_0x2010('0xa'),_0x453fc0,_0x2010('0xb'));_0x4728c0(_0x3c2d98['result'][_0x2010('0x11')]);}})[_0x2010('0x12')](function(_0x410889){logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x410889);_0x160e41(_0x410889);});});} \ No newline at end of file +var _0x7072=['randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird'];(function(_0x174a4d,_0x203ae3){var _0x240fa1=function(_0x7139f){while(--_0x7139f){_0x174a4d['push'](_0x174a4d['shift']());}};_0x240fa1(++_0x203ae3);}(_0x7072,0x138));var _0x2707=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x7072[_0x2283dc];return _0x16db90;};'use strict';var _=require('lodash');var util=require(_0x2707('0x0'));var moment=require(_0x2707('0x1'));var BPromise=require(_0x2707('0x2'));var rs=require(_0x2707('0x3'));var fs=require('fs');var Redis=require(_0x2707('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2707('0x5'))('rpc');var config=require(_0x2707('0x6'));var jayson=require(_0x2707('0x7'));var client=jayson[_0x2707('0x8')][_0x2707('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fd8ff,_0x128205,_0x21b0a0){return new BPromise(function(_0x745cfd,_0x4062b6){return client[_0x2707('0xa')](_0x2fd8ff,_0x21b0a0)['then'](function(_0x597ff9){logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));logger[_0x2707('0xe')](_0x2707('0xf'),_0x128205,_0x2707('0xd'),JSON[_0x2707('0x10')](_0x597ff9));if(_0x597ff9[_0x2707('0x11')]){if(_0x597ff9[_0x2707('0x11')][_0x2707('0x12')]===0x1f4){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')]['message']);return _0x4062b6(_0x597ff9[_0x2707('0x11')]['message']);}logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')][_0x2707('0x13')]);return _0x745cfd(_0x597ff9[_0x2707('0x11')]['message']);}else{logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));_0x745cfd(_0x597ff9['result'][_0x2707('0x13')]);}})[_0x2707('0x14')](function(_0x1a979e){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x1a979e);_0x4062b6(_0x1a979e);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index bcc021c..1d14454 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 _0x42bc=['create','post','addAgents','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./team.controller','isAuthenticated','get','/:id','show','getQueues','/:id/users','getAgents'];(function(_0x3e976f,_0x2ab042){var _0x4f8b8f=function(_0x38f410){while(--_0x38f410){_0x3e976f['push'](_0x3e976f['shift']());}};_0x4f8b8f(++_0x2ab042);}(_0x42bc,0x161));var _0xc42b=function(_0x340aa5,_0x2d5553){_0x340aa5=_0x340aa5-0x0;var _0x3a5b7f=_0x42bc[_0x340aa5];return _0x3a5b7f;};'use strict';var multer=require(_0xc42b('0x0'));var util=require(_0xc42b('0x1'));var path=require('path');var timeout=require(_0xc42b('0x2'));var express=require(_0xc42b('0x3'));var router=express[_0xc42b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc42b('0x5'));var config=require(_0xc42b('0x6'));var controller=require(_0xc42b('0x7'));router['get']('/',auth[_0xc42b('0x8')](),controller['index']);router[_0xc42b('0x9')](_0xc42b('0xa'),auth[_0xc42b('0x8')](),controller[_0xc42b('0xb')]);router[_0xc42b('0x9')]('/:id/queues',auth[_0xc42b('0x8')](),controller[_0xc42b('0xc')]);router['get'](_0xc42b('0xd'),auth[_0xc42b('0x8')](),controller[_0xc42b('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc42b('0xf')]);router[_0xc42b('0x10')]('/:id/queues',auth[_0xc42b('0x8')](),controller['addQueues']);router['post'](_0xc42b('0xd'),auth['isAuthenticated'](),controller[_0xc42b('0x11')]);router[_0xc42b('0x12')](_0xc42b('0xa'),auth[_0xc42b('0x8')](),controller[_0xc42b('0x13')]);router[_0xc42b('0x14')](_0xc42b('0xa'),auth[_0xc42b('0x8')](),controller[_0xc42b('0x15')]);router[_0xc42b('0x14')]('/:id/queues',auth[_0xc42b('0x8')](),controller['removeQueues']);router['delete']('/:id/users',auth[_0xc42b('0x8')](),controller['removeAgents']);module[_0xc42b('0x16')]=router; \ No newline at end of file +var _0x4eed=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./team.controller','get','isAuthenticated','index','/:id','show','/:id/queues','getQueues','/:id/users','getAgents','post','addQueues','addAgents','put','update','delete','removeQueues','removeAgents'];(function(_0xd59dbe,_0x23bf85){var _0x34811c=function(_0x59d44d){while(--_0x59d44d){_0xd59dbe['push'](_0xd59dbe['shift']());}};_0x34811c(++_0x23bf85);}(_0x4eed,0x12c));var _0xd4ee=function(_0x3334e1,_0x3d5774){_0x3334e1=_0x3334e1-0x0;var _0x1c675e=_0x4eed[_0x3334e1];return _0x1c675e;};'use strict';var multer=require(_0xd4ee('0x0'));var util=require(_0xd4ee('0x1'));var path=require(_0xd4ee('0x2'));var timeout=require(_0xd4ee('0x3'));var express=require('express');var router=express[_0xd4ee('0x4')]();var auth=require(_0xd4ee('0x5'));var interaction=require(_0xd4ee('0x6'));var config=require('../../config/environment');var controller=require(_0xd4ee('0x7'));router[_0xd4ee('0x8')]('/',auth[_0xd4ee('0x9')](),controller[_0xd4ee('0xa')]);router[_0xd4ee('0x8')](_0xd4ee('0xb'),auth[_0xd4ee('0x9')](),controller[_0xd4ee('0xc')]);router[_0xd4ee('0x8')](_0xd4ee('0xd'),auth[_0xd4ee('0x9')](),controller[_0xd4ee('0xe')]);router[_0xd4ee('0x8')](_0xd4ee('0xf'),auth[_0xd4ee('0x9')](),controller[_0xd4ee('0x10')]);router['post']('/',auth[_0xd4ee('0x9')](),controller['create']);router[_0xd4ee('0x11')](_0xd4ee('0xd'),auth[_0xd4ee('0x9')](),controller[_0xd4ee('0x12')]);router[_0xd4ee('0x11')]('/:id/users',auth[_0xd4ee('0x9')](),controller[_0xd4ee('0x13')]);router[_0xd4ee('0x14')](_0xd4ee('0xb'),auth[_0xd4ee('0x9')](),controller[_0xd4ee('0x15')]);router[_0xd4ee('0x16')](_0xd4ee('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xd4ee('0x16')](_0xd4ee('0xd'),auth[_0xd4ee('0x9')](),controller[_0xd4ee('0x17')]);router[_0xd4ee('0x16')](_0xd4ee('0xf'),auth[_0xd4ee('0x9')](),controller[_0xd4ee('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 025466c..9b20ac1 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 _0x3e97=['exports','STRING','name'];(function(_0x2df3eb,_0x3e7cf0){var _0x1a5fb9=function(_0x1f2b8e){while(--_0x1f2b8e){_0x2df3eb['push'](_0x2df3eb['shift']());}};_0x1a5fb9(++_0x3e7cf0);}(_0x3e97,0x105));var _0x73e9=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3e97[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require('sequelize');module[_0x73e9('0x0')]={'name':{'type':Sequelize[_0x73e9('0x1')],'allowNull':![],'unique':_0x73e9('0x2')},'description':{'type':Sequelize[_0x73e9('0x1')]}}; \ No newline at end of file +var _0xd7f0=['exports','STRING','name','sequelize'];(function(_0x3daeb8,_0x4ebd74){var _0x12487f=function(_0x55af08){while(--_0x55af08){_0x3daeb8['push'](_0x3daeb8['shift']());}};_0x12487f(++_0x4ebd74);}(_0xd7f0,0x183));var _0x0d7f=function(_0x40940a,_0x46bde6){_0x40940a=_0x40940a-0x0;var _0x4a23ef=_0xd7f0[_0x40940a];return _0x4a23ef;};'use strict';var Sequelize=require(_0x0d7f('0x0'));module[_0x0d7f('0x1')]={'name':{'type':Sequelize[_0x0d7f('0x2')],'allowNull':![],'unique':_0x0d7f('0x3')},'description':{'type':Sequelize[_0x0d7f('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index f4a5a89..23d388b 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 _0x1b0e=['show','rawAttributes','length','find','create','body','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','findOne','channel','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','Sequelize','add','ids','remove','Chat','Mail','Sms','Openchannel','sequelize','transaction','Voice','QueueId','findOrCreate','User','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','addAgents','spread','removeAgents','Fax','Whatsapp','Queue:remove','getAgents','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','then','Teams','UserProfileResource','destroy','error','stack','name','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','Team','includeAll','include','findAll','rows','catch'];(function(_0x2b3e3c,_0x5aa525){var _0x136023=function(_0x292e38){while(--_0x292e38){_0x2b3e3c['push'](_0x2b3e3c['shift']());}};_0x136023(++_0x5aa525);}(_0x1b0e,0x132));var _0xe1b0=function(_0x249f10,_0x478106){_0x249f10=_0x249f10-0x0;var _0xcd54f4=_0x1b0e[_0x249f10];return _0xcd54f4;};'use strict';var pdf=require(_0xe1b0('0x0'));var emlformat=require(_0xe1b0('0x1'));var rimraf=require(_0xe1b0('0x2'));var zipdir=require(_0xe1b0('0x3'));var jsonpatch=require(_0xe1b0('0x4'));var rp=require(_0xe1b0('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe1b0('0x6'));var util=require(_0xe1b0('0x7'));var path=require('path');var sox=require(_0xe1b0('0x8'));var csv=require(_0xe1b0('0x9'));var ejs=require(_0xe1b0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe1b0('0xb'));var crypto=require(_0xe1b0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe1b0('0xd'));var toCsv=require(_0xe1b0('0x9'));var querystring=require(_0xe1b0('0xe'));var Papa=require(_0xe1b0('0xf'));var Redis=require(_0xe1b0('0x10'));var authService=require(_0xe1b0('0x11'));var qs=require(_0xe1b0('0x12'));var as=require(_0xe1b0('0x13'));var hardwareService=require(_0xe1b0('0x14'));var logger=require(_0xe1b0('0x15'))('api');var utils=require(_0xe1b0('0x16'));var config=require(_0xe1b0('0x17'));var licenseUtil=require(_0xe1b0('0x18'));var db=require(_0xe1b0('0x19'))['db'];config[_0xe1b0('0x1a')]=_[_0xe1b0('0x1b')](config[_0xe1b0('0x1a')],{'host':_0xe1b0('0x1c'),'port':0x18eb});var socket=require(_0xe1b0('0x1d'))(new Redis(config['redis']));require(_0xe1b0('0x1e'))[_0xe1b0('0x1f')](socket);function respondWithStatusCode(_0xf08245,_0x5078e5){_0x5078e5=_0x5078e5||0xcc;return function(_0x506e77){if(_0x506e77){return _0xf08245[_0xe1b0('0x20')](_0x5078e5);}return _0xf08245[_0xe1b0('0x21')](_0x5078e5)[_0xe1b0('0x22')]();};}function respondWithResult(_0x3d3c2e,_0x23efb3){_0x23efb3=_0x23efb3||0xc8;return function(_0x10f27d){if(_0x10f27d){return _0x3d3c2e['status'](_0x23efb3)[_0xe1b0('0x23')](_0x10f27d);}};}function respondWithFilteredResult(_0x36af39,_0x7d491){return function(_0x2928b6){if(_0x2928b6){var _0x349f90=_0x2928b6[_0xe1b0('0x24')],_0x5c195f=_0x7d491['offset'],_0x5b300e=_0x7d491[_0xe1b0('0x25')]+_0x7d491[_0xe1b0('0x26')],_0x579fe2;if(_0x5b300e>=_0x349f90){_0x5b300e=_0x349f90;_0x579fe2=0xc8;}else{_0x579fe2=0xce;}_0x36af39[_0xe1b0('0x21')](_0x579fe2);return _0x36af39['set'](_0xe1b0('0x27'),_0x5c195f+'-'+_0x5b300e+'/'+_0x349f90)[_0xe1b0('0x23')](_0x2928b6);}return null;};}function patchUpdates(_0x47e42a){return function(_0xa537db){try{jsonpatch[_0xe1b0('0x28')](_0xa537db,_0x47e42a,!![]);}catch(_0x3876de){return BPromise['reject'](_0x3876de);}return _0xa537db[_0xe1b0('0x29')]();};}function saveUpdates(_0x49dd41,_0x58cc00){return function(_0x53bac0){if(_0x53bac0){return _0x53bac0['update'](_0x49dd41)[_0xe1b0('0x2a')](function(_0x4a387d){return _0x4a387d;});}return null;};}function removeEntity(_0x289ed3,_0x28e39a){return function(_0x37d006){if(_0x37d006){return _0x37d006['destroy']()[_0xe1b0('0x2a')](function(){var _0x3ef159=_0x37d006['get']({'plain':!![]});var _0x1ab8ef=_0xe1b0('0x2b');return db[_0xe1b0('0x2c')][_0xe1b0('0x2d')]({'where':{'type':_0x1ab8ef,'resourceId':_0x3ef159['id']}})[_0xe1b0('0x2a')](function(){return _0x37d006;});})['then'](function(){_0x289ed3[_0xe1b0('0x21')](0xcc)[_0xe1b0('0x22')]();});}};}function handleEntityNotFound(_0x1a30d0,_0x14fcc4){return function(_0x2d3dc9){if(!_0x2d3dc9){_0x1a30d0[_0xe1b0('0x20')](0x194);}return _0x2d3dc9;};}function handleError(_0x13dc9d,_0x1c19cd){_0x1c19cd=_0x1c19cd||0x1f4;return function(_0x5ea3fe){logger[_0xe1b0('0x2e')](_0x5ea3fe[_0xe1b0('0x2f')]);if(_0x5ea3fe['name']){delete _0x5ea3fe[_0xe1b0('0x30')];}_0x13dc9d[_0xe1b0('0x21')](_0x1c19cd)['send'](_0x5ea3fe);};}exports['index']=function(_0x5cc8e3,_0x9c4710){var _0x3f2f25={},_0xae9a36={},_0x1cb538={'count':0x0,'rows':[]};var _0x1b5e6a=_[_0xe1b0('0x31')](db['Team']['rawAttributes'],function(_0x218716){return{'name':_0x218716[_0xe1b0('0x32')],'type':_0x218716[_0xe1b0('0x33')][_0xe1b0('0x34')]};});_0xae9a36[_0xe1b0('0x35')]=_[_0xe1b0('0x31')](_0x1b5e6a,_0xe1b0('0x30'));_0xae9a36[_0xe1b0('0x36')]=_[_0xe1b0('0x37')](_0x5cc8e3[_0xe1b0('0x36')]);_0xae9a36['filters']=_['intersection'](_0xae9a36['model'],_0xae9a36[_0xe1b0('0x36')]);_0x3f2f25['attributes']=_[_0xe1b0('0x38')](_0xae9a36[_0xe1b0('0x35')],qs[_0xe1b0('0x39')](_0x5cc8e3[_0xe1b0('0x36')][_0xe1b0('0x39')]));_0x3f2f25[_0xe1b0('0x3a')]=_0x3f2f25[_0xe1b0('0x3a')]['length']?_0x3f2f25['attributes']:_0xae9a36['model'];if(!_0x5cc8e3[_0xe1b0('0x36')]['hasOwnProperty'](_0xe1b0('0x3b'))){_0x3f2f25['limit']=qs['limit'](_0x5cc8e3['query'][_0xe1b0('0x26')]);_0x3f2f25[_0xe1b0('0x25')]=qs[_0xe1b0('0x25')](_0x5cc8e3[_0xe1b0('0x36')][_0xe1b0('0x25')]);}_0x3f2f25[_0xe1b0('0x3c')]=qs['sort'](_0x5cc8e3['query'][_0xe1b0('0x3d')]);_0x3f2f25[_0xe1b0('0x3e')]=qs['filters'](_[_0xe1b0('0x3f')](_0x5cc8e3[_0xe1b0('0x36')],_0xae9a36[_0xe1b0('0x40')]),_0x1b5e6a);if(_0x5cc8e3[_0xe1b0('0x36')][_0xe1b0('0x41')]){_0x3f2f25[_0xe1b0('0x3e')]=_[_0xe1b0('0x42')](_0x3f2f25[_0xe1b0('0x3e')],{'$or':_[_0xe1b0('0x31')](_0x1b5e6a,function(_0xf6da19){if(_0xf6da19[_0xe1b0('0x33')]!==_0xe1b0('0x43')){var _0x27845f={};_0x27845f[_0xf6da19[_0xe1b0('0x30')]]={'$like':'%'+_0x5cc8e3[_0xe1b0('0x36')]['filter']+'%'};return _0x27845f;}})});}_0x3f2f25=_[_0xe1b0('0x42')]({},_0x3f2f25,_0x5cc8e3[_0xe1b0('0x44')]);var _0x18efee={'where':_0x3f2f25[_0xe1b0('0x3e')]};return db[_0xe1b0('0x45')][_0xe1b0('0x24')](_0x18efee)[_0xe1b0('0x2a')](function(_0x1ec565){_0x1cb538[_0xe1b0('0x24')]=_0x1ec565;if(_0x5cc8e3[_0xe1b0('0x36')][_0xe1b0('0x46')]){_0x3f2f25[_0xe1b0('0x47')]=[{'all':!![]}];}return db['Team'][_0xe1b0('0x48')](_0x3f2f25);})['then'](function(_0x1f56dd){_0x1cb538[_0xe1b0('0x49')]=_0x1f56dd;return _0x1cb538;})[_0xe1b0('0x2a')](respondWithFilteredResult(_0x9c4710,_0x3f2f25))[_0xe1b0('0x4a')](handleError(_0x9c4710,null));};exports[_0xe1b0('0x4b')]=function(_0x3edd15,_0x57741c){var _0x1b3983={'raw':![],'where':{'id':_0x3edd15['params']['id']}},_0x30b23c={};_0x30b23c['model']=_[_0xe1b0('0x37')](db[_0xe1b0('0x45')][_0xe1b0('0x4c')]);_0x30b23c[_0xe1b0('0x36')]=_['keys'](_0x3edd15[_0xe1b0('0x36')]);_0x30b23c['filters']=_[_0xe1b0('0x38')](_0x30b23c[_0xe1b0('0x35')],_0x30b23c[_0xe1b0('0x36')]);_0x1b3983[_0xe1b0('0x3a')]=_['intersection'](_0x30b23c['model'],qs[_0xe1b0('0x39')](_0x3edd15['query'][_0xe1b0('0x39')]));_0x1b3983[_0xe1b0('0x3a')]=_0x1b3983[_0xe1b0('0x3a')][_0xe1b0('0x4d')]?_0x1b3983[_0xe1b0('0x3a')]:_0x30b23c[_0xe1b0('0x35')];if(_0x3edd15[_0xe1b0('0x36')][_0xe1b0('0x46')]){_0x1b3983[_0xe1b0('0x47')]=[{'all':!![]}];}_0x1b3983=_[_0xe1b0('0x42')]({},_0x1b3983,_0x3edd15[_0xe1b0('0x44')]);return db[_0xe1b0('0x45')][_0xe1b0('0x4e')](_0x1b3983)[_0xe1b0('0x2a')](handleEntityNotFound(_0x57741c,null))[_0xe1b0('0x2a')](respondWithResult(_0x57741c,null))[_0xe1b0('0x4a')](handleError(_0x57741c,null));};exports[_0xe1b0('0x4f')]=function(_0x15274d,_0x12f000){return db['Team'][_0xe1b0('0x4f')](_0x15274d[_0xe1b0('0x50')],{})[_0xe1b0('0x2a')](function(_0x2179a3){var _0x4f93a9=_0x15274d[_0xe1b0('0x51')][_0xe1b0('0x52')]({'plain':!![]});if(!_0x4f93a9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f93a9['role']===_0xe1b0('0x51')){var _0x4f3452=_0x2179a3['get']({'plain':!![]});var _0x412367=_0xe1b0('0x2b');return db[_0xe1b0('0x53')]['find']({'where':{'name':_0x412367,'userProfileId':_0x4f93a9['userProfileId']},'raw':!![]})[_0xe1b0('0x2a')](function(_0x4f2897){if(_0x4f2897&&_0x4f2897[_0xe1b0('0x54')]===0x0){return db[_0xe1b0('0x2c')][_0xe1b0('0x4f')]({'name':_0x4f3452[_0xe1b0('0x30')],'resourceId':_0x4f3452['id'],'type':_0x4f2897[_0xe1b0('0x30')],'sectionId':_0x4f2897['id']},{})['then'](function(){return _0x2179a3;});}else{return _0x2179a3;}})[_0xe1b0('0x4a')](function(_0x4cb65f){logger[_0xe1b0('0x2e')](_0xe1b0('0x55'),_0x4cb65f);throw _0x4cb65f;});}return _0x2179a3;})['then'](respondWithResult(_0x12f000,0xc9))[_0xe1b0('0x4a')](handleError(_0x12f000,null));};exports[_0xe1b0('0x56')]=function(_0x493ea5,_0x5cd7e4){if(_0x493ea5['body']['id']){delete _0x493ea5[_0xe1b0('0x50')]['id'];}return db[_0xe1b0('0x45')][_0xe1b0('0x4e')]({'where':{'id':_0x493ea5[_0xe1b0('0x57')]['id']}})[_0xe1b0('0x2a')](handleEntityNotFound(_0x5cd7e4,null))[_0xe1b0('0x2a')](saveUpdates(_0x493ea5['body'],null))[_0xe1b0('0x2a')](respondWithResult(_0x5cd7e4,null))['catch'](handleError(_0x5cd7e4,null));};exports[_0xe1b0('0x2d')]=function(_0x32e5c9,_0x252c8b){return db[_0xe1b0('0x45')]['find']({'where':{'id':_0x32e5c9[_0xe1b0('0x57')]['id']}})['then'](handleEntityNotFound(_0x252c8b,null))[_0xe1b0('0x2a')](removeEntity(_0x252c8b,null))[_0xe1b0('0x4a')](handleError(_0x252c8b,null));};exports['getQueues']=function(_0xe7e1f2,_0x1dab5e,_0x2e6b75){return db[_0xe1b0('0x45')][_0xe1b0('0x58')]({'where':{'id':_0xe7e1f2['params']['id']}})[_0xe1b0('0x2a')](handleEntityNotFound(_0x1dab5e,null))[_0xe1b0('0x2a')](function(_0x11eedb){if(!_0xe7e1f2[_0xe1b0('0x36')][_0xe1b0('0x59')]||!utils[_0xe1b0('0x5a')](_0xe7e1f2[_0xe1b0('0x36')][_0xe1b0('0x59')])){throw new db['Sequelize']['ValidationError'](_0xe1b0('0x5b'));}var _0x32403b={};var _0x132f47={};_0x132f47[_0xe1b0('0x35')]=_[_0xe1b0('0x37')](db[_[_0xe1b0('0x5c')](_0xe7e1f2['query'][_0xe1b0('0x59')][_0xe1b0('0x5d')]())+_0xe1b0('0x5e')][_0xe1b0('0x4c')]);_0x132f47[_0xe1b0('0x36')]=_[_0xe1b0('0x37')](_0xe7e1f2['query']);_0x132f47[_0xe1b0('0x40')]=_[_0xe1b0('0x38')](_0x132f47[_0xe1b0('0x35')],_0x132f47[_0xe1b0('0x36')]);_0x32403b['attributes']=_[_0xe1b0('0x38')](_0x132f47[_0xe1b0('0x35')],qs['fields'](_0xe7e1f2[_0xe1b0('0x36')][_0xe1b0('0x39')]));_0x32403b[_0xe1b0('0x3a')]=_0x32403b[_0xe1b0('0x3a')][_0xe1b0('0x4d')]?_0x32403b[_0xe1b0('0x3a')]:_0x132f47[_0xe1b0('0x35')];_0x32403b[_0xe1b0('0x26')]=qs['limit'](_0xe7e1f2[_0xe1b0('0x36')][_0xe1b0('0x26')]);_0x32403b[_0xe1b0('0x25')]=qs[_0xe1b0('0x25')](_0xe7e1f2[_0xe1b0('0x36')][_0xe1b0('0x25')]);_0x32403b['order']=qs['sort'](_0xe7e1f2[_0xe1b0('0x36')][_0xe1b0('0x3d')]);_0x32403b[_0xe1b0('0x3e')]=qs[_0xe1b0('0x40')](_[_0xe1b0('0x3f')](_0xe7e1f2[_0xe1b0('0x36')],_0x132f47[_0xe1b0('0x40')]));_0x32403b=_['merge']({},_0x32403b,_0xe7e1f2[_0xe1b0('0x44')]);return _0x11eedb[_0xe1b0('0x52')+_[_0xe1b0('0x5c')](_0xe7e1f2[_0xe1b0('0x36')][_0xe1b0('0x59')][_0xe1b0('0x5d')]())+_0xe1b0('0x5f')](_0x32403b);})[_0xe1b0('0x2a')](respondWithResult(_0x1dab5e,null))[_0xe1b0('0x4a')](handleError(_0x1dab5e,null));};exports['addQueues']=function(_0x3a93d3,_0x2d0419,_0x1df811){return db[_0xe1b0('0x45')][_0xe1b0('0x58')]({'where':{'id':_0x3a93d3[_0xe1b0('0x57')]['id']}})[_0xe1b0('0x2a')](function(_0x3d71ed){if(_0x3d71ed){if(!_0x3a93d3[_0xe1b0('0x50')][_0xe1b0('0x59')]||!utils[_0xe1b0('0x5a')](_0x3a93d3['body'][_0xe1b0('0x59')])){throw new db[(_0xe1b0('0x60'))]['ValidationError'](_0xe1b0('0x5b'));}return _0x3d71ed[_0xe1b0('0x61')+_[_0xe1b0('0x5c')](_0x3a93d3[_0xe1b0('0x50')][_0xe1b0('0x59')][_0xe1b0('0x5d')]())+'Queues'](_0x3a93d3['body'][_0xe1b0('0x62')]);}return null;})[_0xe1b0('0x2a')](handleEntityNotFound(_0x2d0419,null))[_0xe1b0('0x2a')](respondWithStatusCode(_0x2d0419,null))['catch'](handleError(_0x2d0419,null));};exports['removeQueues']=function(_0xedb90b,_0x1e1fcd,_0x23398d){return db[_0xe1b0('0x45')][_0xe1b0('0x58')]({'where':{'id':_0xedb90b[_0xe1b0('0x57')]['id']}})[_0xe1b0('0x2a')](function(_0x13be88){if(_0x13be88){if(!_0xedb90b[_0xe1b0('0x36')][_0xe1b0('0x59')]||!utils[_0xe1b0('0x5a')](_0xedb90b[_0xe1b0('0x36')][_0xe1b0('0x59')])){throw new db[(_0xe1b0('0x60'))]['ValidationError'](_0xe1b0('0x5b'));}return _0x13be88[_0xe1b0('0x63')+_[_0xe1b0('0x5c')](_0xedb90b[_0xe1b0('0x36')][_0xe1b0('0x59')][_0xe1b0('0x5d')]())+_0xe1b0('0x5f')](_0xedb90b[_0xe1b0('0x36')][_0xe1b0('0x62')]);}return null;})['then'](handleEntityNotFound(_0x1e1fcd,null))['then'](respondWithStatusCode(_0x1e1fcd,null))[_0xe1b0('0x4a')](handleError(_0x1e1fcd,null));};exports['addAgents']=function(_0x23e8e1,_0x4224dc){return db[_0xe1b0('0x45')][_0xe1b0('0x4e')]({'where':{'id':_0x23e8e1['params']['id']}})['then'](handleEntityNotFound(_0x4224dc,null))['then'](function(_0x4462a8){if(_0x4462a8){var _0x54c8c5=['Voice',_0xe1b0('0x64'),_0xe1b0('0x65'),_0xe1b0('0x66'),'Fax',_0xe1b0('0x67'),'Whatsapp'];return db[_0xe1b0('0x68')][_0xe1b0('0x69')](function(_0x527451){var _0x356893=_['map'](_0x54c8c5,function(_0xed0e3a){var _0x50125e={'attributes':['id',_0xe1b0('0x30')]};if(_0xed0e3a===_0xe1b0('0x6a')){_0x50125e['through']={'attributes':['penalty']};}return _0x4462a8['get'+_0xed0e3a+_0xe1b0('0x5f')](_0x50125e)[_0xe1b0('0x2a')](function(_0x5e0db2){var _0x305f74=_[_0xe1b0('0x31')](_0x5e0db2,function(_0x2d0640){var _0xced3c4=_[_0xe1b0('0x31')](_0x23e8e1['body'][_0xe1b0('0x62')],function(_0x44155a){var _0x5c905a={'where':{'UserId':_0x44155a,[_0xed0e3a+_0xe1b0('0x6b')]:_0x2d0640['id']},'transaction':_0x527451};if(_0xed0e3a==='Voice'){_0x5c905a[_0xe1b0('0x1b')]={'penalty':_0x2d0640['TeamVoiceQueue']['penalty']};}return db['User'+_0xed0e3a+_0xe1b0('0x5e')][_0xe1b0('0x6c')](_0x5c905a)[_0xe1b0('0x2a')](function(){socket['emit'](_0xe1b0('0x51')+_0xed0e3a+'Queue:save',{'UserId':_0x44155a,[_0xed0e3a+_0xe1b0('0x6b')]:_0x2d0640['id']});if(_0xed0e3a!==_0xe1b0('0x6a'))return;return db[_0xe1b0('0x6d')][_0xe1b0('0x48')]({'where':{'id':_0x23e8e1[_0xe1b0('0x50')]['ids'],'online':0x1},'attributes':['id',_0xe1b0('0x30'),_0xe1b0('0x6e'),_0xe1b0('0x6f'),_0xe1b0('0x70')],'raw':!![]})[_0xe1b0('0x2a')](function(_0x5467ca){var _0x3b4af2=_[_0xe1b0('0x31')](_0x5467ca,function(_0xa1f961){return db[_0xe1b0('0x71')][_0xe1b0('0x72')]({'membername':_0xa1f961[_0xe1b0('0x30')],'UserId':_0xa1f961['id'],'queue_name':_0x2d0640['name'],'VoiceQueueId':_0x2d0640['id'],'interface':_[_0xe1b0('0x73')](_0xa1f961[_0xe1b0('0x70')])?util[_0xe1b0('0x74')](_0xe1b0('0x75'),_0xa1f961[_0xe1b0('0x30')]):_0xa1f961[_0xe1b0('0x70')],'paused':_0xa1f961[_0xe1b0('0x6f')]||![],'penalty':_0x2d0640['TeamVoiceQueue']['penalty']},{'transaction':_0x527451});});return Promise['all'](_0x3b4af2);});});});return Promise[_0xe1b0('0x76')](_0xced3c4);});return Promise[_0xe1b0('0x76')](_0x305f74);});});return Promise['all'](_0x356893)['then'](function(){return _0x4462a8[_0xe1b0('0x77')](_0x23e8e1[_0xe1b0('0x50')][_0xe1b0('0x62')],{'transaction':_0x527451})[_0xe1b0('0x78')](function(_0x509ad3){return _0x509ad3;});});});}})[_0xe1b0('0x2a')](respondWithResult(_0x4224dc,null))['catch'](handleError(_0x4224dc,null));};exports[_0xe1b0('0x79')]=function(_0x3567a4,_0xf1aba8){return db[_0xe1b0('0x45')][_0xe1b0('0x4e')]({'where':{'id':_0x3567a4[_0xe1b0('0x57')]['id']}})[_0xe1b0('0x2a')](handleEntityNotFound(_0xf1aba8,null))[_0xe1b0('0x2a')](function(_0x4c66b2){if(_0x4c66b2){var _0x264c53=['Voice',_0xe1b0('0x64'),'Mail','Sms',_0xe1b0('0x7a'),_0xe1b0('0x67'),_0xe1b0('0x7b')];return db[_0xe1b0('0x68')][_0xe1b0('0x69')](function(_0x485dfb){var _0x178369=_['map'](_0x264c53,function(_0x1cc416){var _0x57f96d={'attributes':['id',_0xe1b0('0x30')]};return _0x4c66b2[_0xe1b0('0x52')+_0x1cc416+_0xe1b0('0x5f')](_0x57f96d)[_0xe1b0('0x2a')](function(_0x1cc012){var _0x3df14e=_[_0xe1b0('0x31')](_0x1cc012,function(_0x48360e){return _0x48360e[_0xe1b0('0x79')](_0x3567a4[_0xe1b0('0x36')]['ids'],{'transaction':_0x485dfb})[_0xe1b0('0x2a')](function(){var _0x5d4cd1=JSON['parse']('['+_0x3567a4['query'][_0xe1b0('0x62')]+']');var _0x21161d=_[_0xe1b0('0x31')](_0x5d4cd1,function(_0x4c9d48){socket['emit'](_0xe1b0('0x51')+_0x1cc416+_0xe1b0('0x7c'),{'UserId':Number(_0x4c9d48),[_0x1cc416+_0xe1b0('0x6b')]:_0x48360e['id']});if(_0x1cc416!==_0xe1b0('0x6a'))return;return db['UserVoiceQueueRt'][_0xe1b0('0x2d')]({'where':{'VoiceQueueId':_0x48360e['id'],'UserId':_0x4c9d48},'transaction':_0x485dfb});});return Promise[_0xe1b0('0x76')](_0x21161d);});});return Promise[_0xe1b0('0x76')](_0x3df14e);});});return Promise['all'](_0x178369)[_0xe1b0('0x2a')](function(){return _0x4c66b2[_0xe1b0('0x79')](_0x3567a4[_0xe1b0('0x36')][_0xe1b0('0x62')],{'transaction':_0x485dfb});});});}})[_0xe1b0('0x2a')](respondWithStatusCode(_0xf1aba8,null))[_0xe1b0('0x4a')](handleError(_0xf1aba8,null));};exports[_0xe1b0('0x7d')]=function(_0x296722,_0x205dce,_0x370d94){var _0x5bfe08={};var _0x4a51ef={};var _0x50cad1;var _0x398e7e;return db[_0xe1b0('0x45')][_0xe1b0('0x58')]({'where':{'id':_0x296722['params']['id']}})[_0xe1b0('0x2a')](handleEntityNotFound(_0x205dce,null))['then'](function(_0x5b3fef){if(_0x5b3fef){_0x50cad1=_0x5b3fef;_0x4a51ef[_0xe1b0('0x35')]=_['keys'](db[_0xe1b0('0x6d')][_0xe1b0('0x4c')]);_0x4a51ef[_0xe1b0('0x36')]=_['keys'](_0x296722[_0xe1b0('0x36')]);_0x4a51ef[_0xe1b0('0x40')]=_[_0xe1b0('0x38')](_0x4a51ef['model'],_0x4a51ef['query']);_0x5bfe08[_0xe1b0('0x3a')]=_[_0xe1b0('0x38')](_0x4a51ef[_0xe1b0('0x35')],qs[_0xe1b0('0x39')](_0x296722[_0xe1b0('0x36')]['fields']));_0x5bfe08[_0xe1b0('0x3a')]=_0x5bfe08[_0xe1b0('0x3a')][_0xe1b0('0x4d')]?_0x5bfe08['attributes']:_0x4a51ef[_0xe1b0('0x35')];_0x5bfe08[_0xe1b0('0x3c')]=qs[_0xe1b0('0x3d')](_0x296722[_0xe1b0('0x36')]['sort']);_0x5bfe08[_0xe1b0('0x3e')]=qs[_0xe1b0('0x40')](_[_0xe1b0('0x3f')](_0x296722['query'],_0x4a51ef[_0xe1b0('0x40')]));if(_0x296722[_0xe1b0('0x36')][_0xe1b0('0x41')]){_0x5bfe08[_0xe1b0('0x3e')]=_[_0xe1b0('0x42')](_0x5bfe08[_0xe1b0('0x3e')],{'$or':_[_0xe1b0('0x31')](_0x5bfe08[_0xe1b0('0x3a')],function(_0x2bf23f){var _0x401bae={};_0x401bae[_0x2bf23f]={'$like':'%'+_0x296722[_0xe1b0('0x36')]['filter']+'%'};return _0x401bae;})});}_0x5bfe08=_[_0xe1b0('0x42')]({},_0x5bfe08,_0x296722[_0xe1b0('0x44')]);return _0x50cad1[_0xe1b0('0x7d')](_0x5bfe08);}})[_0xe1b0('0x2a')](function(_0x1a2eb5){if(_0x1a2eb5){_0x398e7e=_0x1a2eb5['length'];if(!_0x296722[_0xe1b0('0x36')][_0xe1b0('0x7e')](_0xe1b0('0x3b'))){_0x5bfe08[_0xe1b0('0x26')]=qs[_0xe1b0('0x26')](_0x296722[_0xe1b0('0x36')][_0xe1b0('0x26')]);_0x5bfe08['offset']=qs[_0xe1b0('0x25')](_0x296722[_0xe1b0('0x36')][_0xe1b0('0x25')]);}return _0x50cad1[_0xe1b0('0x7d')](_0x5bfe08);}})['then'](function(_0x20da20){if(_0x20da20){return _0x20da20?{'count':_0x398e7e,'rows':_0x20da20}:null;}})[_0xe1b0('0x2a')](respondWithResult(_0x205dce,null))[_0xe1b0('0x4a')](handleError(_0x205dce,null));}; \ No newline at end of file +var _0x32d5=['toLowerCase','ids','removeQueues','remove','addAgents','Chat','Mail','Sms','Openchannel','Whatsapp','sequelize','Voice','through','penalty','QueueId','User','Queue','findOrCreate','emit','findAll','online','voicePause','interface','UserVoiceQueueRt','isNil','SIP/%s','all','spread','Fax','transaction','removeAgents','Queue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','get','UserProfileResource','destroy','then','name','send','index','map','Team','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','include','rows','catch','filters','includeAll','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','findOne','channel','Sequelize','ValidationError','Unknown\x20channel','order','capitalize','Queues','addQueues','isValidChannel','add'];(function(_0x253c8e,_0x544c5e){var _0x27129a=function(_0x4b905a){while(--_0x4b905a){_0x253c8e['push'](_0x253c8e['shift']());}};_0x27129a(++_0x544c5e);}(_0x32d5,0x1aa));var _0x532d=function(_0x213e99,_0x262492){_0x213e99=_0x213e99-0x0;var _0x25c578=_0x32d5[_0x213e99];return _0x25c578;};'use strict';var pdf=require(_0x532d('0x0'));var emlformat=require(_0x532d('0x1'));var rimraf=require(_0x532d('0x2'));var zipdir=require(_0x532d('0x3'));var jsonpatch=require(_0x532d('0x4'));var rp=require(_0x532d('0x5'));var moment=require(_0x532d('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x532d('0x7'));var util=require(_0x532d('0x8'));var path=require('path');var sox=require(_0x532d('0x9'));var csv=require(_0x532d('0xa'));var ejs=require(_0x532d('0xb'));var fs=require('fs');var _=require(_0x532d('0xc'));var squel=require(_0x532d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x532d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x532d('0xf'));var Papa=require(_0x532d('0x10'));var Redis=require(_0x532d('0x11'));var authService=require(_0x532d('0x12'));var qs=require(_0x532d('0x13'));var as=require(_0x532d('0x14'));var hardwareService=require(_0x532d('0x15'));var logger=require(_0x532d('0x16'))(_0x532d('0x17'));var utils=require(_0x532d('0x18'));var config=require(_0x532d('0x19'));var licenseUtil=require(_0x532d('0x1a'));var db=require('../../mysqldb')['db'];config[_0x532d('0x1b')]=_[_0x532d('0x1c')](config[_0x532d('0x1b')],{'host':_0x532d('0x1d'),'port':0x18eb});var socket=require(_0x532d('0x1e'))(new Redis(config['redis']));require(_0x532d('0x1f'))['register'](socket);function respondWithStatusCode(_0x10e3b6,_0x12e2bd){_0x12e2bd=_0x12e2bd||0xcc;return function(_0x45546f){if(_0x45546f){return _0x10e3b6[_0x532d('0x20')](_0x12e2bd);}return _0x10e3b6[_0x532d('0x21')](_0x12e2bd)[_0x532d('0x22')]();};}function respondWithResult(_0x3747e4,_0x176595){_0x176595=_0x176595||0xc8;return function(_0x427c9e){if(_0x427c9e){return _0x3747e4['status'](_0x176595)[_0x532d('0x23')](_0x427c9e);}};}function respondWithFilteredResult(_0x20c080,_0x42dbe9){return function(_0x1a7fb9){if(_0x1a7fb9){var _0x771ff1=_0x1a7fb9[_0x532d('0x24')],_0x2fa662=_0x42dbe9['offset'],_0x3a9388=_0x42dbe9[_0x532d('0x25')]+_0x42dbe9[_0x532d('0x26')],_0x2ee70f;if(_0x3a9388>=_0x771ff1){_0x3a9388=_0x771ff1;_0x2ee70f=0xc8;}else{_0x2ee70f=0xce;}_0x20c080[_0x532d('0x21')](_0x2ee70f);return _0x20c080[_0x532d('0x27')](_0x532d('0x28'),_0x2fa662+'-'+_0x3a9388+'/'+_0x771ff1)['json'](_0x1a7fb9);}return null;};}function patchUpdates(_0x139981){return function(_0x8a7168){try{jsonpatch[_0x532d('0x29')](_0x8a7168,_0x139981,!![]);}catch(_0x268741){return BPromise[_0x532d('0x2a')](_0x268741);}return _0x8a7168['save']();};}function saveUpdates(_0x4c85bb,_0x121d30){return function(_0x3f57f1){if(_0x3f57f1){return _0x3f57f1[_0x532d('0x2b')](_0x4c85bb)['then'](function(_0x4e7ad1){return _0x4e7ad1;});}return null;};}function removeEntity(_0x442604,_0x3d6c0c){return function(_0x3fdd06){if(_0x3fdd06){return _0x3fdd06['destroy']()['then'](function(){var _0x5751ff=_0x3fdd06[_0x532d('0x2c')]({'plain':!![]});var _0xd79b03='Teams';return db[_0x532d('0x2d')][_0x532d('0x2e')]({'where':{'type':_0xd79b03,'resourceId':_0x5751ff['id']}})[_0x532d('0x2f')](function(){return _0x3fdd06;});})[_0x532d('0x2f')](function(){_0x442604[_0x532d('0x21')](0xcc)[_0x532d('0x22')]();});}};}function handleEntityNotFound(_0x4da7c8,_0xbf606b){return function(_0x2d8226){if(!_0x2d8226){_0x4da7c8[_0x532d('0x20')](0x194);}return _0x2d8226;};}function handleError(_0x3ca076,_0x3288b5){_0x3288b5=_0x3288b5||0x1f4;return function(_0x5ac1c9){logger['error'](_0x5ac1c9['stack']);if(_0x5ac1c9[_0x532d('0x30')]){delete _0x5ac1c9['name'];}_0x3ca076[_0x532d('0x21')](_0x3288b5)[_0x532d('0x31')](_0x5ac1c9);};}exports[_0x532d('0x32')]=function(_0x2d196a,_0x2c13af){var _0x41f984={},_0x56d7c2={},_0x477f59={'count':0x0,'rows':[]};var _0x1c0037=_[_0x532d('0x33')](db[_0x532d('0x34')][_0x532d('0x35')],function(_0x7bddcf){return{'name':_0x7bddcf['fieldName'],'type':_0x7bddcf[_0x532d('0x36')][_0x532d('0x37')]};});_0x56d7c2[_0x532d('0x38')]=_[_0x532d('0x33')](_0x1c0037,_0x532d('0x30'));_0x56d7c2['query']=_[_0x532d('0x39')](_0x2d196a[_0x532d('0x3a')]);_0x56d7c2['filters']=_[_0x532d('0x3b')](_0x56d7c2[_0x532d('0x38')],_0x56d7c2[_0x532d('0x3a')]);_0x41f984[_0x532d('0x3c')]=_[_0x532d('0x3b')](_0x56d7c2[_0x532d('0x38')],qs['fields'](_0x2d196a[_0x532d('0x3a')][_0x532d('0x3d')]));_0x41f984['attributes']=_0x41f984['attributes'][_0x532d('0x3e')]?_0x41f984[_0x532d('0x3c')]:_0x56d7c2[_0x532d('0x38')];if(!_0x2d196a[_0x532d('0x3a')][_0x532d('0x3f')](_0x532d('0x40'))){_0x41f984[_0x532d('0x26')]=qs[_0x532d('0x26')](_0x2d196a[_0x532d('0x3a')][_0x532d('0x26')]);_0x41f984[_0x532d('0x25')]=qs[_0x532d('0x25')](_0x2d196a[_0x532d('0x3a')][_0x532d('0x25')]);}_0x41f984['order']=qs[_0x532d('0x41')](_0x2d196a[_0x532d('0x3a')][_0x532d('0x41')]);_0x41f984[_0x532d('0x42')]=qs['filters'](_[_0x532d('0x43')](_0x2d196a[_0x532d('0x3a')],_0x56d7c2['filters']),_0x1c0037);if(_0x2d196a[_0x532d('0x3a')][_0x532d('0x44')]){_0x41f984[_0x532d('0x42')]=_['merge'](_0x41f984['where'],{'$or':_[_0x532d('0x33')](_0x1c0037,function(_0x67c447){if(_0x67c447[_0x532d('0x36')]!=='VIRTUAL'){var _0x2f8c58={};_0x2f8c58[_0x67c447[_0x532d('0x30')]]={'$like':'%'+_0x2d196a[_0x532d('0x3a')][_0x532d('0x44')]+'%'};return _0x2f8c58;}})});}_0x41f984=_['merge']({},_0x41f984,_0x2d196a[_0x532d('0x45')]);var _0x3f1797={'where':_0x41f984[_0x532d('0x42')]};return db[_0x532d('0x34')][_0x532d('0x24')](_0x3f1797)[_0x532d('0x2f')](function(_0x885948){_0x477f59[_0x532d('0x24')]=_0x885948;if(_0x2d196a['query']['includeAll']){_0x41f984[_0x532d('0x46')]=[{'all':!![]}];}return db[_0x532d('0x34')]['findAll'](_0x41f984);})[_0x532d('0x2f')](function(_0x1f9151){_0x477f59[_0x532d('0x47')]=_0x1f9151;return _0x477f59;})[_0x532d('0x2f')](respondWithFilteredResult(_0x2c13af,_0x41f984))[_0x532d('0x48')](handleError(_0x2c13af,null));};exports['show']=function(_0xca980f,_0x25be17){var _0x11a553={'raw':![],'where':{'id':_0xca980f['params']['id']}},_0x24024c={};_0x24024c[_0x532d('0x38')]=_[_0x532d('0x39')](db[_0x532d('0x34')]['rawAttributes']);_0x24024c['query']=_[_0x532d('0x39')](_0xca980f[_0x532d('0x3a')]);_0x24024c[_0x532d('0x49')]=_['intersection'](_0x24024c[_0x532d('0x38')],_0x24024c['query']);_0x11a553[_0x532d('0x3c')]=_[_0x532d('0x3b')](_0x24024c[_0x532d('0x38')],qs['fields'](_0xca980f[_0x532d('0x3a')][_0x532d('0x3d')]));_0x11a553[_0x532d('0x3c')]=_0x11a553['attributes'][_0x532d('0x3e')]?_0x11a553[_0x532d('0x3c')]:_0x24024c['model'];if(_0xca980f['query'][_0x532d('0x4a')]){_0x11a553[_0x532d('0x46')]=[{'all':!![]}];}_0x11a553=_[_0x532d('0x4b')]({},_0x11a553,_0xca980f[_0x532d('0x45')]);return db[_0x532d('0x34')]['find'](_0x11a553)[_0x532d('0x2f')](handleEntityNotFound(_0x25be17,null))['then'](respondWithResult(_0x25be17,null))['catch'](handleError(_0x25be17,null));};exports[_0x532d('0x4c')]=function(_0x17b046,_0x5af504){return db[_0x532d('0x34')][_0x532d('0x4c')](_0x17b046[_0x532d('0x4d')],{})[_0x532d('0x2f')](function(_0x136b84){var _0x3997bd=_0x17b046[_0x532d('0x4e')][_0x532d('0x2c')]({'plain':!![]});if(!_0x3997bd)throw new Error(_0x532d('0x4f'));if(_0x3997bd[_0x532d('0x50')]===_0x532d('0x4e')){var _0x32082b=_0x136b84[_0x532d('0x2c')]({'plain':!![]});var _0x429e13='Teams';return db['UserProfileSection']['find']({'where':{'name':_0x429e13,'userProfileId':_0x3997bd[_0x532d('0x51')]},'raw':!![]})['then'](function(_0x12bbe4){if(_0x12bbe4&&_0x12bbe4[_0x532d('0x52')]===0x0){return db[_0x532d('0x2d')]['create']({'name':_0x32082b[_0x532d('0x30')],'resourceId':_0x32082b['id'],'type':_0x12bbe4[_0x532d('0x30')],'sectionId':_0x12bbe4['id']},{})['then'](function(){return _0x136b84;});}else{return _0x136b84;}})[_0x532d('0x48')](function(_0x2fd36b){logger[_0x532d('0x53')](_0x532d('0x54'),_0x2fd36b);throw _0x2fd36b;});}return _0x136b84;})['then'](respondWithResult(_0x5af504,0xc9))[_0x532d('0x48')](handleError(_0x5af504,null));};exports[_0x532d('0x2b')]=function(_0x18f25a,_0x4cf530){if(_0x18f25a[_0x532d('0x4d')]['id']){delete _0x18f25a['body']['id'];}return db['Team'][_0x532d('0x55')]({'where':{'id':_0x18f25a[_0x532d('0x56')]['id']}})[_0x532d('0x2f')](handleEntityNotFound(_0x4cf530,null))[_0x532d('0x2f')](saveUpdates(_0x18f25a[_0x532d('0x4d')],null))[_0x532d('0x2f')](respondWithResult(_0x4cf530,null))[_0x532d('0x48')](handleError(_0x4cf530,null));};exports[_0x532d('0x2e')]=function(_0x39e9d5,_0x15b6bc){return db[_0x532d('0x34')][_0x532d('0x55')]({'where':{'id':_0x39e9d5[_0x532d('0x56')]['id']}})[_0x532d('0x2f')](handleEntityNotFound(_0x15b6bc,null))[_0x532d('0x2f')](removeEntity(_0x15b6bc,null))['catch'](handleError(_0x15b6bc,null));};exports['getQueues']=function(_0x3b01ee,_0xfc2b0,_0x432641){return db[_0x532d('0x34')][_0x532d('0x57')]({'where':{'id':_0x3b01ee[_0x532d('0x56')]['id']}})[_0x532d('0x2f')](handleEntityNotFound(_0xfc2b0,null))[_0x532d('0x2f')](function(_0x2467e5){if(!_0x3b01ee[_0x532d('0x3a')]['channel']||!utils['isValidChannel'](_0x3b01ee[_0x532d('0x3a')][_0x532d('0x58')])){throw new db[(_0x532d('0x59'))][(_0x532d('0x5a'))](_0x532d('0x5b'));}var _0x3f55f2={};var _0x301f22={};_0x301f22[_0x532d('0x38')]=_[_0x532d('0x39')](db[_['capitalize'](_0x3b01ee['query'][_0x532d('0x58')]['toLowerCase']())+'Queue'][_0x532d('0x35')]);_0x301f22['query']=_[_0x532d('0x39')](_0x3b01ee['query']);_0x301f22[_0x532d('0x49')]=_['intersection'](_0x301f22['model'],_0x301f22[_0x532d('0x3a')]);_0x3f55f2[_0x532d('0x3c')]=_[_0x532d('0x3b')](_0x301f22[_0x532d('0x38')],qs['fields'](_0x3b01ee[_0x532d('0x3a')][_0x532d('0x3d')]));_0x3f55f2[_0x532d('0x3c')]=_0x3f55f2['attributes'][_0x532d('0x3e')]?_0x3f55f2[_0x532d('0x3c')]:_0x301f22['model'];_0x3f55f2['limit']=qs[_0x532d('0x26')](_0x3b01ee[_0x532d('0x3a')][_0x532d('0x26')]);_0x3f55f2[_0x532d('0x25')]=qs['offset'](_0x3b01ee[_0x532d('0x3a')][_0x532d('0x25')]);_0x3f55f2[_0x532d('0x5c')]=qs[_0x532d('0x41')](_0x3b01ee[_0x532d('0x3a')]['sort']);_0x3f55f2[_0x532d('0x42')]=qs['filters'](_[_0x532d('0x43')](_0x3b01ee[_0x532d('0x3a')],_0x301f22[_0x532d('0x49')]));_0x3f55f2=_[_0x532d('0x4b')]({},_0x3f55f2,_0x3b01ee[_0x532d('0x45')]);return _0x2467e5[_0x532d('0x2c')+_[_0x532d('0x5d')](_0x3b01ee[_0x532d('0x3a')][_0x532d('0x58')]['toLowerCase']())+_0x532d('0x5e')](_0x3f55f2);})[_0x532d('0x2f')](respondWithResult(_0xfc2b0,null))[_0x532d('0x48')](handleError(_0xfc2b0,null));};exports[_0x532d('0x5f')]=function(_0x215d9c,_0x472889,_0xad86ce){return db[_0x532d('0x34')][_0x532d('0x57')]({'where':{'id':_0x215d9c[_0x532d('0x56')]['id']}})[_0x532d('0x2f')](function(_0x1b4116){if(_0x1b4116){if(!_0x215d9c['body'][_0x532d('0x58')]||!utils[_0x532d('0x60')](_0x215d9c[_0x532d('0x4d')][_0x532d('0x58')])){throw new db[(_0x532d('0x59'))][(_0x532d('0x5a'))](_0x532d('0x5b'));}return _0x1b4116[_0x532d('0x61')+_[_0x532d('0x5d')](_0x215d9c[_0x532d('0x4d')][_0x532d('0x58')][_0x532d('0x62')]())+'Queues'](_0x215d9c['body'][_0x532d('0x63')]);}return null;})[_0x532d('0x2f')](handleEntityNotFound(_0x472889,null))['then'](respondWithStatusCode(_0x472889,null))[_0x532d('0x48')](handleError(_0x472889,null));};exports[_0x532d('0x64')]=function(_0x318938,_0x56a830,_0x33e073){return db[_0x532d('0x34')][_0x532d('0x57')]({'where':{'id':_0x318938[_0x532d('0x56')]['id']}})[_0x532d('0x2f')](function(_0x430b78){if(_0x430b78){if(!_0x318938[_0x532d('0x3a')]['channel']||!utils[_0x532d('0x60')](_0x318938[_0x532d('0x3a')]['channel'])){throw new db[(_0x532d('0x59'))][(_0x532d('0x5a'))](_0x532d('0x5b'));}return _0x430b78[_0x532d('0x65')+_[_0x532d('0x5d')](_0x318938[_0x532d('0x3a')][_0x532d('0x58')][_0x532d('0x62')]())+'Queues'](_0x318938[_0x532d('0x3a')][_0x532d('0x63')]);}return null;})['then'](handleEntityNotFound(_0x56a830,null))['then'](respondWithStatusCode(_0x56a830,null))[_0x532d('0x48')](handleError(_0x56a830,null));};exports[_0x532d('0x66')]=function(_0x57e1e2,_0x1b41eb){return db[_0x532d('0x34')][_0x532d('0x55')]({'where':{'id':_0x57e1e2[_0x532d('0x56')]['id']}})[_0x532d('0x2f')](handleEntityNotFound(_0x1b41eb,null))[_0x532d('0x2f')](function(_0x502d40){if(_0x502d40){var _0x2cad0a=['Voice',_0x532d('0x67'),_0x532d('0x68'),_0x532d('0x69'),'Fax',_0x532d('0x6a'),_0x532d('0x6b')];return db[_0x532d('0x6c')]['transaction'](function(_0x1a7526){var _0x4149b2=_[_0x532d('0x33')](_0x2cad0a,function(_0x18e59c){var _0x2db601={'attributes':['id',_0x532d('0x30')]};if(_0x18e59c===_0x532d('0x6d')){_0x2db601[_0x532d('0x6e')]={'attributes':[_0x532d('0x6f')]};}return _0x502d40['get'+_0x18e59c+_0x532d('0x5e')](_0x2db601)[_0x532d('0x2f')](function(_0x5d40d1){var _0x4cc856=_['map'](_0x5d40d1,function(_0xc4a5d5){var _0x53b233=_[_0x532d('0x33')](_0x57e1e2[_0x532d('0x4d')][_0x532d('0x63')],function(_0x2b130a){var _0x2d43ca={'where':{'UserId':_0x2b130a,[_0x18e59c+_0x532d('0x70')]:_0xc4a5d5['id']},'transaction':_0x1a7526};if(_0x18e59c===_0x532d('0x6d')){_0x2d43ca['defaults']={'penalty':_0xc4a5d5['TeamVoiceQueue']['penalty']};}return db[_0x532d('0x71')+_0x18e59c+_0x532d('0x72')][_0x532d('0x73')](_0x2d43ca)[_0x532d('0x2f')](function(){socket[_0x532d('0x74')](_0x532d('0x4e')+_0x18e59c+'Queue:save',{'UserId':_0x2b130a,[_0x18e59c+_0x532d('0x70')]:_0xc4a5d5['id']});if(_0x18e59c!==_0x532d('0x6d'))return;return db['User'][_0x532d('0x75')]({'where':{'id':_0x57e1e2[_0x532d('0x4d')][_0x532d('0x63')],'online':0x1},'attributes':['id',_0x532d('0x30'),_0x532d('0x76'),_0x532d('0x77'),_0x532d('0x78')],'raw':!![]})[_0x532d('0x2f')](function(_0x5873bf){var _0x6f2f89=_[_0x532d('0x33')](_0x5873bf,function(_0x48802c){return db[_0x532d('0x79')]['upsert']({'membername':_0x48802c[_0x532d('0x30')],'UserId':_0x48802c['id'],'queue_name':_0xc4a5d5['name'],'VoiceQueueId':_0xc4a5d5['id'],'interface':_[_0x532d('0x7a')](_0x48802c[_0x532d('0x78')])?util['format'](_0x532d('0x7b'),_0x48802c[_0x532d('0x30')]):_0x48802c[_0x532d('0x78')],'paused':_0x48802c[_0x532d('0x77')]||![],'penalty':_0xc4a5d5['TeamVoiceQueue'][_0x532d('0x6f')]},{'transaction':_0x1a7526});});return Promise['all'](_0x6f2f89);});});});return Promise['all'](_0x53b233);});return Promise[_0x532d('0x7c')](_0x4cc856);});});return Promise[_0x532d('0x7c')](_0x4149b2)['then'](function(){return _0x502d40[_0x532d('0x66')](_0x57e1e2[_0x532d('0x4d')][_0x532d('0x63')],{'transaction':_0x1a7526})[_0x532d('0x7d')](function(_0x42aff7){return _0x42aff7;});});});}})[_0x532d('0x2f')](respondWithResult(_0x1b41eb,null))[_0x532d('0x48')](handleError(_0x1b41eb,null));};exports['removeAgents']=function(_0xef65e6,_0x1f99c6){return db[_0x532d('0x34')][_0x532d('0x55')]({'where':{'id':_0xef65e6['params']['id']}})[_0x532d('0x2f')](handleEntityNotFound(_0x1f99c6,null))[_0x532d('0x2f')](function(_0x3b67c6){if(_0x3b67c6){var _0x37af45=[_0x532d('0x6d'),_0x532d('0x67'),_0x532d('0x68'),_0x532d('0x69'),_0x532d('0x7e'),_0x532d('0x6a'),_0x532d('0x6b')];return db[_0x532d('0x6c')][_0x532d('0x7f')](function(_0x4f37fd){var _0xcc483f=_[_0x532d('0x33')](_0x37af45,function(_0x54d37d){var _0x58fc9b={'attributes':['id',_0x532d('0x30')]};return _0x3b67c6[_0x532d('0x2c')+_0x54d37d+_0x532d('0x5e')](_0x58fc9b)[_0x532d('0x2f')](function(_0x24a7a2){var _0x22b74f=_[_0x532d('0x33')](_0x24a7a2,function(_0x4c9242){return _0x4c9242[_0x532d('0x80')](_0xef65e6[_0x532d('0x3a')][_0x532d('0x63')],{'transaction':_0x4f37fd})[_0x532d('0x2f')](function(){var _0x4e686f=JSON['parse']('['+_0xef65e6[_0x532d('0x3a')]['ids']+']');var _0x20cf5a=_[_0x532d('0x33')](_0x4e686f,function(_0x1141b7){socket[_0x532d('0x74')](_0x532d('0x4e')+_0x54d37d+_0x532d('0x81'),{'UserId':Number(_0x1141b7),[_0x54d37d+_0x532d('0x70')]:_0x4c9242['id']});if(_0x54d37d!=='Voice')return;return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x4c9242['id'],'UserId':_0x1141b7},'transaction':_0x4f37fd});});return Promise[_0x532d('0x7c')](_0x20cf5a);});});return Promise[_0x532d('0x7c')](_0x22b74f);});});return Promise[_0x532d('0x7c')](_0xcc483f)['then'](function(){return _0x3b67c6[_0x532d('0x80')](_0xef65e6[_0x532d('0x3a')]['ids'],{'transaction':_0x4f37fd});});});}})['then'](respondWithStatusCode(_0x1f99c6,null))[_0x532d('0x48')](handleError(_0x1f99c6,null));};exports['getAgents']=function(_0x58e3bd,_0x17afd2,_0x22ed54){var _0x21071c={};var _0x147eb7={};var _0x434d0d;var _0x2b17e4;return db[_0x532d('0x34')]['findOne']({'where':{'id':_0x58e3bd[_0x532d('0x56')]['id']}})['then'](handleEntityNotFound(_0x17afd2,null))['then'](function(_0x89f446){if(_0x89f446){_0x434d0d=_0x89f446;_0x147eb7[_0x532d('0x38')]=_[_0x532d('0x39')](db[_0x532d('0x71')][_0x532d('0x35')]);_0x147eb7[_0x532d('0x3a')]=_['keys'](_0x58e3bd[_0x532d('0x3a')]);_0x147eb7['filters']=_['intersection'](_0x147eb7[_0x532d('0x38')],_0x147eb7[_0x532d('0x3a')]);_0x21071c[_0x532d('0x3c')]=_[_0x532d('0x3b')](_0x147eb7[_0x532d('0x38')],qs[_0x532d('0x3d')](_0x58e3bd[_0x532d('0x3a')][_0x532d('0x3d')]));_0x21071c[_0x532d('0x3c')]=_0x21071c['attributes']['length']?_0x21071c[_0x532d('0x3c')]:_0x147eb7[_0x532d('0x38')];_0x21071c[_0x532d('0x5c')]=qs[_0x532d('0x41')](_0x58e3bd[_0x532d('0x3a')][_0x532d('0x41')]);_0x21071c[_0x532d('0x42')]=qs[_0x532d('0x49')](_['pick'](_0x58e3bd['query'],_0x147eb7[_0x532d('0x49')]));if(_0x58e3bd[_0x532d('0x3a')][_0x532d('0x44')]){_0x21071c[_0x532d('0x42')]=_['merge'](_0x21071c[_0x532d('0x42')],{'$or':_[_0x532d('0x33')](_0x21071c[_0x532d('0x3c')],function(_0x1b3d7a){var _0x537f3d={};_0x537f3d[_0x1b3d7a]={'$like':'%'+_0x58e3bd[_0x532d('0x3a')]['filter']+'%'};return _0x537f3d;})});}_0x21071c=_[_0x532d('0x4b')]({},_0x21071c,_0x58e3bd[_0x532d('0x45')]);return _0x434d0d[_0x532d('0x82')](_0x21071c);}})[_0x532d('0x2f')](function(_0x4e5ff5){if(_0x4e5ff5){_0x2b17e4=_0x4e5ff5[_0x532d('0x3e')];if(!_0x58e3bd[_0x532d('0x3a')]['hasOwnProperty'](_0x532d('0x40'))){_0x21071c[_0x532d('0x26')]=qs[_0x532d('0x26')](_0x58e3bd[_0x532d('0x3a')][_0x532d('0x26')]);_0x21071c[_0x532d('0x25')]=qs['offset'](_0x58e3bd['query']['offset']);}return _0x434d0d['getAgents'](_0x21071c);}})['then'](function(_0x1eb00b){if(_0x1eb00b){return _0x1eb00b?{'count':_0x2b17e4,'rows':_0x1eb00b}:null;}})[_0x532d('0x2f')](respondWithResult(_0x17afd2,null))[_0x532d('0x48')](handleError(_0x17afd2,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index a01c118..7b44ec9 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 _0x3ee6=['hook','exports','events','../../mysqldb','Team','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x1f4ce6,_0x2b8299){var _0x220d64=function(_0x525ba2){while(--_0x525ba2){_0x1f4ce6['push'](_0x1f4ce6['shift']());}};_0x220d64(++_0x2b8299);}(_0x3ee6,0x1e2));var _0x63ee=function(_0x1251bf,_0x875dd){_0x1251bf=_0x1251bf-0x0;var _0x10273c=_0x3ee6[_0x1251bf];return _0x10273c;};'use strict';var EventEmitter=require(_0x63ee('0x0'));var Team=require(_0x63ee('0x1'))['db'][_0x63ee('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x63ee('0x3')](0x0);var events={'afterCreate':_0x63ee('0x4'),'afterUpdate':_0x63ee('0x5'),'afterDestroy':_0x63ee('0x6')};function emitEvent(_0xbdff36){return function(_0x24567a,_0x4d6607,_0x15ca47){TeamEvents['emit'](_0xbdff36+':'+_0x24567a['id'],_0x24567a);TeamEvents['emit'](_0xbdff36,_0x24567a);_0x15ca47(null);};}for(var e in events){if(events[_0x63ee('0x7')](e)){var event=events[e];Team[_0x63ee('0x8')](e,emitEvent(event));}}module[_0x63ee('0x9')]=TeamEvents; \ No newline at end of file +var _0x3893=['Team','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x1ed034,_0x5d495d){var _0x4a82b7=function(_0x348231){while(--_0x348231){_0x1ed034['push'](_0x1ed034['shift']());}};_0x4a82b7(++_0x5d495d);}(_0x3893,0x1c7));var _0x3389=function(_0x819e48,_0x430040){_0x819e48=_0x819e48-0x0;var _0x522d4a=_0x3893[_0x819e48];return _0x522d4a;};'use strict';var EventEmitter=require(_0x3389('0x0'));var Team=require('../../mysqldb')['db'][_0x3389('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x3389('0x2')](0x0);var events={'afterCreate':_0x3389('0x3'),'afterUpdate':'update','afterDestroy':_0x3389('0x4')};function emitEvent(_0x31f7d1){return function(_0x5a1e05,_0x3978c7,_0x4b006f){TeamEvents[_0x3389('0x5')](_0x31f7d1+':'+_0x5a1e05['id'],_0x5a1e05);TeamEvents['emit'](_0x31f7d1,_0x5a1e05);_0x4b006f(null);};}for(var e in events){if(events[_0x3389('0x6')](e)){var event=events[e];Team[_0x3389('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 0202a60..5423e66 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 _0xe479=['bluebird','request-promise','path','rimraf','define','teams','lodash','../../config/logger','api','moment'];(function(_0xe35ef2,_0xb5d232){var _0x360c87=function(_0xefe1bd){while(--_0xefe1bd){_0xe35ef2['push'](_0xe35ef2['shift']());}};_0x360c87(++_0xb5d232);}(_0xe479,0x196));var _0x9e47=function(_0x2d87b9,_0x53e5d3){_0x2d87b9=_0x2d87b9-0x0;var _0x2b08b1=_0xe479[_0x2d87b9];return _0x2b08b1;};'use strict';var _=require(_0x9e47('0x0'));var util=require('util');var logger=require(_0x9e47('0x1'))(_0x9e47('0x2'));var moment=require(_0x9e47('0x3'));var BPromise=require(_0x9e47('0x4'));var rp=require(_0x9e47('0x5'));var fs=require('fs');var path=require(_0x9e47('0x6'));var rimraf=require(_0x9e47('0x7'));var config=require('../../config/environment');var attributes=require('./team.attributes');module['exports']=function(_0x2131b8,_0x528256){return _0x2131b8[_0x9e47('0x8')]('Team',attributes,{'tableName':_0x9e47('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2eb=['bluebird','request-promise','../../config/environment','define','teams','util','api','moment'];(function(_0x1fdb40,_0x51351c){var _0x281f93=function(_0x35eebe){while(--_0x35eebe){_0x1fdb40['push'](_0x1fdb40['shift']());}};_0x281f93(++_0x51351c);}(_0xc2eb,0x1e5));var _0xbc2e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xc2eb[_0x28947d];return _0x12d2ee;};'use strict';var _=require('lodash');var util=require(_0xbc2e('0x0'));var logger=require('../../config/logger')(_0xbc2e('0x1'));var moment=require(_0xbc2e('0x2'));var BPromise=require(_0xbc2e('0x3'));var rp=require(_0xbc2e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbc2e('0x5'));var attributes=require('./team.attributes');module['exports']=function(_0x2ad906,_0x37ad58){return _0x2ad906[_0xbc2e('0x6')]('Team',attributes,{'tableName':_0xbc2e('0x7'),'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 840958b..b5f1d19 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 _0xac3b=['client','http','redis','localhost','socket.io-emitter','./team.socket','request','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0xb0d9a8,_0x4843db){var _0x2b893b=function(_0xb1c1fc){while(--_0xb1c1fc){_0xb0d9a8['push'](_0xb0d9a8['shift']());}};_0x2b893b(++_0x4843db);}(_0xac3b,0x1b9));var _0xbac3=function(_0x5c4f6b,_0x2cdfce){_0x5c4f6b=_0x5c4f6b-0x0;var _0x104c4e=_0xac3b[_0x5c4f6b];return _0x104c4e;};'use strict';var _=require(_0xbac3('0x0'));var util=require('util');var moment=require(_0xbac3('0x1'));var BPromise=require(_0xbac3('0x2'));var rs=require(_0xbac3('0x3'));var fs=require('fs');var Redis=require(_0xbac3('0x4'));var db=require(_0xbac3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbac3('0x6'))(_0xbac3('0x7'));var config=require('../../config/environment');var jayson=require(_0xbac3('0x8'));var client=jayson[_0xbac3('0x9')][_0xbac3('0xa')]({'port':0x232a});config[_0xbac3('0xb')]=_['defaults'](config['redis'],{'host':_0xbac3('0xc'),'port':0x18eb});var socket=require(_0xbac3('0xd'))(new Redis(config['redis']));require(_0xbac3('0xe'))['register'](socket);function respondWithRpcPromise(_0x4ba0b6,_0x11530a,_0x1dc209){return new BPromise(function(_0x3b8cff,_0x48d666){return client[_0xbac3('0xf')](_0x4ba0b6,_0x1dc209)['then'](function(_0x1e1aa6){logger[_0xbac3('0x10')](_0xbac3('0x11'),_0x11530a,_0xbac3('0x12'));logger[_0xbac3('0x13')](_0xbac3('0x14'),_0x11530a,_0xbac3('0x12'),JSON[_0xbac3('0x15')](_0x1e1aa6));if(_0x1e1aa6[_0xbac3('0x16')]){if(_0x1e1aa6[_0xbac3('0x16')]['code']===0x1f4){logger[_0xbac3('0x16')](_0xbac3('0x11'),_0x11530a,_0x1e1aa6[_0xbac3('0x16')][_0xbac3('0x17')]);return _0x48d666(_0x1e1aa6[_0xbac3('0x16')][_0xbac3('0x17')]);}logger[_0xbac3('0x16')](_0xbac3('0x11'),_0x11530a,_0x1e1aa6[_0xbac3('0x16')]['message']);return _0x3b8cff(_0x1e1aa6[_0xbac3('0x16')][_0xbac3('0x17')]);}else{logger[_0xbac3('0x10')](_0xbac3('0x11'),_0x11530a,_0xbac3('0x12'));_0x3b8cff(_0x1e1aa6['result']['message']);}})[_0xbac3('0x18')](function(_0x14ae01){logger['error'](_0xbac3('0x11'),_0x11530a,_0x14ae01);_0x48d666(_0x14ae01);});});} \ No newline at end of file +var _0xbe01=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./team.socket','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Team,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2e655a,_0x6d5799){var _0x26f13b=function(_0x2dd535){while(--_0x2dd535){_0x2e655a['push'](_0x2e655a['shift']());}};_0x26f13b(++_0x6d5799);}(_0xbe01,0xff));var _0x1be0=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xbe01[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x1be0('0x0'));var util=require('util');var moment=require(_0x1be0('0x1'));var BPromise=require(_0x1be0('0x2'));var rs=require(_0x1be0('0x3'));var fs=require('fs');var Redis=require(_0x1be0('0x4'));var db=require(_0x1be0('0x5'))['db'];var utils=require(_0x1be0('0x6'));var logger=require(_0x1be0('0x7'))(_0x1be0('0x8'));var config=require(_0x1be0('0x9'));var jayson=require(_0x1be0('0xa'));var client=jayson['client'][_0x1be0('0xb')]({'port':0x232a});config[_0x1be0('0xc')]=_[_0x1be0('0xd')](config[_0x1be0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x1be0('0xe'))(new Redis(config[_0x1be0('0xc')]));require(_0x1be0('0xf'))[_0x1be0('0x10')](socket);function respondWithRpcPromise(_0x242237,_0x2ec909,_0x4bb58f){return new BPromise(function(_0x4aa784,_0x175e94){return client[_0x1be0('0x11')](_0x242237,_0x4bb58f)[_0x1be0('0x12')](function(_0x2e8837){logger[_0x1be0('0x13')]('Team,\x20%s,\x20%s',_0x2ec909,_0x1be0('0x14'));logger[_0x1be0('0x15')](_0x1be0('0x16'),_0x2ec909,_0x1be0('0x14'),JSON[_0x1be0('0x17')](_0x2e8837));if(_0x2e8837[_0x1be0('0x18')]){if(_0x2e8837[_0x1be0('0x18')][_0x1be0('0x19')]===0x1f4){logger[_0x1be0('0x18')]('Team,\x20%s,\x20%s',_0x2ec909,_0x2e8837[_0x1be0('0x18')]['message']);return _0x175e94(_0x2e8837[_0x1be0('0x18')][_0x1be0('0x1a')]);}logger[_0x1be0('0x18')](_0x1be0('0x1b'),_0x2ec909,_0x2e8837[_0x1be0('0x18')]['message']);return _0x4aa784(_0x2e8837[_0x1be0('0x18')]['message']);}else{logger[_0x1be0('0x13')](_0x1be0('0x1b'),_0x2ec909,_0x1be0('0x14'));_0x4aa784(_0x2e8837['result'][_0x1be0('0x1a')]);}})[_0x1be0('0x1c')](function(_0x47e219){logger[_0x1be0('0x18')](_0x1be0('0x1b'),_0x2ec909,_0x47e219);_0x175e94(_0x47e219);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 039cc2a..ee64d96 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 _0xdd68=['update','emit','removeListener','register','length','team:','./team.events','remove'];(function(_0x2d0d9f,_0x22c0d8){var _0x30243d=function(_0x29a92b){while(--_0x29a92b){_0x2d0d9f['push'](_0x2d0d9f['shift']());}};_0x30243d(++_0x22c0d8);}(_0xdd68,0x196));var _0x8dd6=function(_0x2b55b5,_0x78505e){_0x2b55b5=_0x2b55b5-0x0;var _0x103d28=_0xdd68[_0x2b55b5];return _0x103d28;};'use strict';var TeamEvents=require(_0x8dd6('0x0'));var events=['save',_0x8dd6('0x1'),_0x8dd6('0x2')];function createListener(_0x1aa630,_0x437161){return function(_0x5be787){_0x437161[_0x8dd6('0x3')](_0x1aa630,_0x5be787);};}function removeListener(_0x469e0c,_0x5c7c72){return function(){TeamEvents[_0x8dd6('0x4')](_0x469e0c,_0x5c7c72);};}exports[_0x8dd6('0x5')]=function(_0x5aa303){for(var _0x54708f=0x0,_0x4c021f=events[_0x8dd6('0x6')];_0x54708f<_0x4c021f;_0x54708f++){var _0x51f78e=events[_0x54708f];var _0x199f07=createListener(_0x8dd6('0x7')+_0x51f78e,_0x5aa303);TeamEvents['on'](_0x51f78e,_0x199f07);}}; \ No newline at end of file +var _0x00f0=['removeListener','register','length','team:','./team.events','save','remove','update'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x00f0,0xec));var _0x000f=function(_0x31a32e,_0x53241d){_0x31a32e=_0x31a32e-0x0;var _0x1fb572=_0x00f0[_0x31a32e];return _0x1fb572;};'use strict';var TeamEvents=require(_0x000f('0x0'));var events=[_0x000f('0x1'),_0x000f('0x2'),_0x000f('0x3')];function createListener(_0x55b9cf,_0x4d5c3d){return function(_0x4095d5){_0x4d5c3d['emit'](_0x55b9cf,_0x4095d5);};}function removeListener(_0x3cd8ed,_0x53989d){return function(){TeamEvents[_0x000f('0x4')](_0x3cd8ed,_0x53989d);};}exports[_0x000f('0x5')]=function(_0x4ce2d9){for(var _0x7827b=0x0,_0x3c54d0=events[_0x000f('0x6')];_0x7827b<_0x3c54d0;_0x7827b++){var _0x621ab6=events[_0x7827b];var _0x330e11=createListener(_0x000f('0x7')+_0x621ab6,_0x4ce2d9);TeamEvents['on'](_0x621ab6,_0x330e11);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 0155e19..d3a4e32 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 _0xa0a3=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports','multer','util'];(function(_0x167214,_0x37c9fa){var _0x51e481=function(_0x13f9e3){while(--_0x13f9e3){_0x167214['push'](_0x167214['shift']());}};_0x51e481(++_0x37c9fa);}(_0xa0a3,0x154));var _0x3a0a=function(_0x4a0e70,_0x4f609a){_0x4a0e70=_0x4a0e70-0x0;var _0x3e1875=_0xa0a3[_0x4a0e70];return _0x3e1875;};'use strict';var multer=require(_0x3a0a('0x0'));var util=require(_0x3a0a('0x1'));var path=require(_0x3a0a('0x2'));var timeout=require(_0x3a0a('0x3'));var express=require(_0x3a0a('0x4'));var router=express[_0x3a0a('0x5')]();var auth=require(_0x3a0a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3a0a('0x7'));module[_0x3a0a('0x8')]=router; \ No newline at end of file +var _0x4f96=['express','Router','../../components/interaction/service','multer','util','path','connect-timeout'];(function(_0x271e26,_0xeaa798){var _0x4c3771=function(_0x594c71){while(--_0x594c71){_0x271e26['push'](_0x271e26['shift']());}};_0x4c3771(++_0xeaa798);}(_0x4f96,0xb9));var _0x64f9=function(_0x53c29b,_0x581cbb){_0x53c29b=_0x53c29b-0x0;var _0x168403=_0x4f96[_0x53c29b];return _0x168403;};'use strict';var multer=require(_0x64f9('0x0'));var util=require(_0x64f9('0x1'));var path=require(_0x64f9('0x2'));var timeout=require(_0x64f9('0x3'));var express=require(_0x64f9('0x4'));var router=express[_0x64f9('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x64f9('0x6'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 608c276..bdd3974 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 _0xbaf0=['exports','INTEGER'];(function(_0x574159,_0x952110){var _0x5dd226=function(_0x5a32f2){while(--_0x5a32f2){_0x574159['push'](_0x574159['shift']());}};_0x5dd226(++_0x952110);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x208505,_0x241a77){var _0x1a985f=function(_0x4a5110){while(--_0x4a5110){_0x208505['push'](_0x208505['shift']());}};_0x1a985f(++_0x241a77);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index cc080cd..efbe102 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 _0x8e93=['exports','TeamVoiceQueue','team_has_voice_queues','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x4c0411,_0x102a92){var _0x23945a=function(_0x5475ec){while(--_0x5475ec){_0x4c0411['push'](_0x4c0411['shift']());}};_0x23945a(++_0x102a92);}(_0x8e93,0x179));var _0x38e9=function(_0xdd8575,_0x2a8cbb){_0xdd8575=_0xdd8575-0x0;var _0x467354=_0x8e93[_0xdd8575];return _0x467354;};'use strict';var _=require(_0x38e9('0x0'));var util=require(_0x38e9('0x1'));var logger=require('../../config/logger')(_0x38e9('0x2'));var moment=require(_0x38e9('0x3'));var BPromise=require(_0x38e9('0x4'));var rp=require(_0x38e9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x38e9('0x6'));var attributes=require(_0x38e9('0x7'));module[_0x38e9('0x8')]=function(_0x168682,_0x2dff33){return _0x168682['define'](_0x38e9('0x9'),attributes,{'tableName':_0x38e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x344a=['define','TeamVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x278b91,_0x29bea9){var _0x3fcbcb=function(_0x19e58a){while(--_0x19e58a){_0x278b91['push'](_0x278b91['shift']());}};_0x3fcbcb(++_0x29bea9);}(_0x344a,0x120));var _0xa344=function(_0x1856c6,_0x254e4c){_0x1856c6=_0x1856c6-0x0;var _0x3a8ef1=_0x344a[_0x1856c6];return _0x3a8ef1;};'use strict';var _=require(_0xa344('0x0'));var util=require(_0xa344('0x1'));var logger=require(_0xa344('0x2'))(_0xa344('0x3'));var moment=require(_0xa344('0x4'));var BPromise=require(_0xa344('0x5'));var rp=require(_0xa344('0x6'));var fs=require('fs');var path=require(_0xa344('0x7'));var rimraf=require(_0xa344('0x8'));var config=require(_0xa344('0x9'));var attributes=require('./teamVoiceQueue.attributes');module[_0xa344('0xa')]=function(_0x1500cb,_0xf8ab61){return _0x1500cb[_0xa344('0xb')](_0xa344('0xc'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 0fff471..2526b2e 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 _0xa187=['bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','catch','lodash','util','moment'];(function(_0x5b9dd7,_0x43a06e){var _0x49ec19=function(_0x45d4b7){while(--_0x45d4b7){_0x5b9dd7['push'](_0x5b9dd7['shift']());}};_0x49ec19(++_0x43a06e);}(_0xa187,0x115));var _0x7a18=function(_0x3a8b9b,_0x4b1728){_0x3a8b9b=_0x3a8b9b-0x0;var _0x1a3bba=_0xa187[_0x3a8b9b];return _0x1a3bba;};'use strict';var _=require(_0x7a18('0x0'));var util=require(_0x7a18('0x1'));var moment=require(_0x7a18('0x2'));var BPromise=require(_0x7a18('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a18('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a18('0x5'));var logger=require('../../config/logger')(_0x7a18('0x6'));var config=require(_0x7a18('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7a18('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f29f7,_0x213cf3,_0x1301db){return new BPromise(function(_0x2911d8,_0x161f53){return client[_0x7a18('0x9')](_0x1f29f7,_0x1301db)[_0x7a18('0xa')](function(_0x3faa1a){logger[_0x7a18('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x213cf3,'request\x20sent');logger[_0x7a18('0xc')](_0x7a18('0xd'),_0x213cf3,'request\x20sent',JSON[_0x7a18('0xe')](_0x3faa1a));if(_0x3faa1a[_0x7a18('0xf')]){if(_0x3faa1a[_0x7a18('0xf')]['code']===0x1f4){logger[_0x7a18('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x213cf3,_0x3faa1a[_0x7a18('0xf')][_0x7a18('0x10')]);return _0x161f53(_0x3faa1a[_0x7a18('0xf')]['message']);}logger[_0x7a18('0xf')](_0x7a18('0x11'),_0x213cf3,_0x3faa1a['error'][_0x7a18('0x10')]);return _0x2911d8(_0x3faa1a['error'][_0x7a18('0x10')]);}else{logger[_0x7a18('0xb')](_0x7a18('0x11'),_0x213cf3,_0x7a18('0x12'));_0x2911d8(_0x3faa1a['result']['message']);}})[_0x7a18('0x13')](function(_0x588596){logger[_0x7a18('0xf')](_0x7a18('0x11'),_0x213cf3,_0x588596);_0x161f53(_0x588596);});});} \ No newline at end of file +var _0x5295=['../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x2ada07,_0x4107fb){var _0x57322d=function(_0x5c71fa){while(--_0x5c71fa){_0x2ada07['push'](_0x2ada07['shift']());}};_0x57322d(++_0x4107fb);}(_0x5295,0x19d));var _0x5529=function(_0x1dfaa6,_0x3f063b){_0x1dfaa6=_0x1dfaa6-0x0;var _0x4ba657=_0x5295[_0x1dfaa6];return _0x4ba657;};'use strict';var _=require(_0x5529('0x0'));var util=require(_0x5529('0x1'));var moment=require(_0x5529('0x2'));var BPromise=require(_0x5529('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5529('0x4'));var db=require(_0x5529('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5529('0x6'))('rpc');var config=require(_0x5529('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5529('0x8')][_0x5529('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f36e5,_0x2aadd8,_0x232323){return new BPromise(function(_0x68cfda,_0x21c0d4){return client[_0x5529('0xa')](_0x5f36e5,_0x232323)[_0x5529('0xb')](function(_0x6e5e96){logger[_0x5529('0xc')](_0x5529('0xd'),_0x2aadd8,_0x5529('0xe'));logger[_0x5529('0xf')](_0x5529('0x10'),_0x2aadd8,_0x5529('0xe'),JSON[_0x5529('0x11')](_0x6e5e96));if(_0x6e5e96[_0x5529('0x12')]){if(_0x6e5e96[_0x5529('0x12')]['code']===0x1f4){logger[_0x5529('0x12')](_0x5529('0xd'),_0x2aadd8,_0x6e5e96[_0x5529('0x12')][_0x5529('0x13')]);return _0x21c0d4(_0x6e5e96[_0x5529('0x12')]['message']);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x2aadd8,_0x6e5e96['error'][_0x5529('0x13')]);return _0x68cfda(_0x6e5e96['error'][_0x5529('0x13')]);}else{logger['info'](_0x5529('0xd'),_0x2aadd8,'request\x20sent');_0x68cfda(_0x6e5e96[_0x5529('0x14')][_0x5529('0x13')]);}})[_0x5529('0x15')](function(_0x4e70b6){logger[_0x5529('0x12')](_0x5529('0xd'),_0x2aadd8,_0x4e70b6);_0x21c0d4(_0x4e70b6);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index c196183..1d8667f 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 _0xfc52=['../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x22d655,_0x3941dd){var _0x257739=function(_0x98136e){while(--_0x98136e){_0x22d655['push'](_0x22d655['shift']());}};_0x257739(++_0x3941dd);}(_0xfc52,0xf6));var _0x2fc5=function(_0x1d0fa7,_0x1ad70f){_0x1d0fa7=_0x1d0fa7-0x0;var _0x5b2d91=_0xfc52[_0x1d0fa7];return _0x5b2d91;};'use strict';var multer=require(_0x2fc5('0x0'));var util=require(_0x2fc5('0x1'));var path=require(_0x2fc5('0x2'));var timeout=require(_0x2fc5('0x3'));var express=require(_0x2fc5('0x4'));var router=express[_0x2fc5('0x5')]();var auth=require(_0x2fc5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2fc5('0x7'));var controller=require(_0x2fc5('0x8'));router[_0x2fc5('0x9')]('/',auth[_0x2fc5('0xa')](),controller[_0x2fc5('0xb')]);router[_0x2fc5('0x9')](_0x2fc5('0xc'),auth[_0x2fc5('0xa')](),controller[_0x2fc5('0xd')]);router[_0x2fc5('0xe')]('/',auth[_0x2fc5('0xa')](),controller[_0x2fc5('0xf')]);router[_0x2fc5('0x10')](_0x2fc5('0xc'),auth[_0x2fc5('0xa')](),controller[_0x2fc5('0x11')]);router[_0x2fc5('0x12')](_0x2fc5('0xc'),auth['isAuthenticated'](),controller[_0x2fc5('0x13')]);module[_0x2fc5('0x14')]=router; \ No newline at end of file +var _0x2f39=['show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./template.controller','isAuthenticated','index','get','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2f39,0x80));var _0x92f3=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0x2f39[_0x1e4a8e];return _0x5408f9;};'use strict';var multer=require(_0x92f3('0x0'));var util=require(_0x92f3('0x1'));var path=require(_0x92f3('0x2'));var timeout=require('connect-timeout');var express=require(_0x92f3('0x3'));var router=express[_0x92f3('0x4')]();var auth=require(_0x92f3('0x5'));var interaction=require(_0x92f3('0x6'));var config=require('../../config/environment');var controller=require(_0x92f3('0x7'));router['get']('/',auth[_0x92f3('0x8')](),controller[_0x92f3('0x9')]);router[_0x92f3('0xa')](_0x92f3('0xb'),auth[_0x92f3('0x8')](),controller[_0x92f3('0xc')]);router[_0x92f3('0xd')]('/',auth[_0x92f3('0x8')](),controller[_0x92f3('0xe')]);router[_0x92f3('0xf')](_0x92f3('0xb'),auth[_0x92f3('0x8')](),controller[_0x92f3('0x10')]);router[_0x92f3('0x11')](_0x92f3('0xb'),auth[_0x92f3('0x8')](),controller[_0x92f3('0x12')]);module[_0x92f3('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index e3e73b5..e293e68 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 _0xc9cb=['sequelize','STRING','TEXT'];(function(_0x13f258,_0x2a6c5d){var _0x47e7a=function(_0x1ec238){while(--_0x1ec238){_0x13f258['push'](_0x13f258['shift']());}};_0x47e7a(++_0x2a6c5d);}(_0xc9cb,0x14d));var _0xbc9c=function(_0xf3fabf,_0x5cecd9){_0xf3fabf=_0xf3fabf-0x0;var _0x3d6b37=_0xc9cb[_0xf3fabf];return _0x3d6b37;};'use strict';var Sequelize=require(_0xbc9c('0x0'));module['exports']={'name':{'type':Sequelize[_0xbc9c('0x1')]},'description':{'type':Sequelize[_0xbc9c('0x1')]},'html':{'type':Sequelize[_0xbc9c('0x2')]}}; \ No newline at end of file +var _0x1ff8=['TEXT','sequelize','STRING'];(function(_0x235c39,_0x171f8f){var _0x554284=function(_0x5380ab){while(--_0x5380ab){_0x235c39['push'](_0x235c39['shift']());}};_0x554284(++_0x171f8f);}(_0x1ff8,0x16f));var _0x81ff=function(_0x153da6,_0xc9bfde){_0x153da6=_0x153da6-0x0;var _0xf01a0d=_0x1ff8[_0x153da6];return _0xf01a0d;};'use strict';var Sequelize=require(_0x81ff('0x0'));module['exports']={'name':{'type':Sequelize[_0x81ff('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x81ff('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 2010a98..ff3a7ed 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 _0xe14b=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','get','Templates','then','error','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','catch','show','fields','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x5ae52f,_0x3541b6){var _0x5cbd81=function(_0x5eb772){while(--_0x5eb772){_0x5ae52f['push'](_0x5ae52f['shift']());}};_0x5cbd81(++_0x3541b6);}(_0xe14b,0x93));var _0xbe14=function(_0x420e97,_0xb0ef){_0x420e97=_0x420e97-0x0;var _0x49356a=_0xe14b[_0x420e97];return _0x49356a;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=_0xf4ac9[_0xbe14('0x19')],_0x4e8f34=_0x3dc4a9[_0xbe14('0x1a')],_0x21c789=_0x3dc4a9[_0xbe14('0x1a')]+_0x3dc4a9[_0xbe14('0x1b')],_0xe9c3ec;if(_0x21c789>=_0x37ce4e){_0x21c789=_0x37ce4e;_0xe9c3ec=0xc8;}else{_0xe9c3ec=0xce;}_0x3f58f5[_0xbe14('0x17')](_0xe9c3ec);return _0x3f58f5['set'](_0xbe14('0x1c'),_0x4e8f34+'-'+_0x21c789+'/'+_0x37ce4e)[_0xbe14('0x1d')](_0xf4ac9);}return null;};}function patchUpdates(_0x329588){return function(_0x433459){try{jsonpatch[_0xbe14('0x1e')](_0x433459,_0x329588,!![]);}catch(_0x37e4c1){return BPromise['reject'](_0x37e4c1);}return _0x433459[_0xbe14('0x1f')]();};}function saveUpdates(_0x4a1bbd,_0x417c8d){return function(_0xc12977){if(_0xc12977){return _0xc12977[_0xbe14('0x20')](_0x4a1bbd)['then'](function(_0xe60f42){return _0xe60f42;});}return null;};}function removeEntity(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')]()['then'](function(){var _0x274018=_0x56e80c[_0xbe14('0x22')]({'plain':!![]});var _0x505dbd=_0xbe14('0x23');return db['UserProfileResource'][_0xbe14('0x21')]({'where':{'type':_0x505dbd,'resourceId':_0x274018['id']}})['then'](function(){return _0x56e80c;});})[_0xbe14('0x24')](function(){_0x56d845[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x39cc81,_0x15ef02){return function(_0x2703f5){if(!_0x2703f5){_0x39cc81['sendStatus'](0x194);}return _0x2703f5;};}function handleError(_0x1822e0,_0x1ba46a){_0x1ba46a=_0x1ba46a||0x1f4;return function(_0x391556){logger[_0xbe14('0x25')](_0x391556['stack']);if(_0x391556[_0xbe14('0x26')]){delete _0x391556[_0xbe14('0x26')];}_0x1822e0['status'](_0x1ba46a)[_0xbe14('0x27')](_0x391556);};}exports[_0xbe14('0x28')]=function(_0x1c7cc7,_0x19252f){var _0x34d648={},_0x36d4b2={},_0x31a664={'count':0x0,'rows':[]};var _0x2b05cb=_[_0xbe14('0x29')](db[_0xbe14('0x2a')][_0xbe14('0x2b')],function(_0x3bf43c){return{'name':_0x3bf43c[_0xbe14('0x2c')],'type':_0x3bf43c[_0xbe14('0x2d')][_0xbe14('0x2e')]};});_0x36d4b2[_0xbe14('0x2f')]=_[_0xbe14('0x29')](_0x2b05cb,_0xbe14('0x26'));_0x36d4b2[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x1c7cc7['query']);_0x36d4b2[_0xbe14('0x32')]=_['intersection'](_0x36d4b2['model'],_0x36d4b2[_0xbe14('0x30')]);_0x34d648['attributes']=_[_0xbe14('0x33')](_0x36d4b2[_0xbe14('0x2f')],qs['fields'](_0x1c7cc7['query']['fields']));_0x34d648[_0xbe14('0x34')]=_0x34d648[_0xbe14('0x34')]['length']?_0x34d648[_0xbe14('0x34')]:_0x36d4b2[_0xbe14('0x2f')];if(!_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x34d648['limit']=qs['limit'](_0x1c7cc7[_0xbe14('0x30')]['limit']);_0x34d648['offset']=qs['offset'](_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x1a')]);}_0x34d648[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x38')]);_0x34d648[_0xbe14('0x39')]=qs[_0xbe14('0x32')](_[_0xbe14('0x3a')](_0x1c7cc7[_0xbe14('0x30')],_0x36d4b2[_0xbe14('0x32')]),_0x2b05cb);if(_0x1c7cc7[_0xbe14('0x30')]['filter']){_0x34d648['where']=_[_0xbe14('0x3b')](_0x34d648[_0xbe14('0x39')],{'$or':_[_0xbe14('0x29')](_0x2b05cb,function(_0x520e09){if(_0x520e09[_0xbe14('0x2d')]!==_0xbe14('0x3c')){var _0xeda70e={};_0xeda70e[_0x520e09[_0xbe14('0x26')]]={'$like':'%'+_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x3d')]+'%'};return _0xeda70e;}})});}_0x34d648=_[_0xbe14('0x3b')]({},_0x34d648,_0x1c7cc7[_0xbe14('0x3e')]);var _0x1b2608={'where':_0x34d648['where']};return db[_0xbe14('0x2a')][_0xbe14('0x19')](_0x1b2608)[_0xbe14('0x24')](function(_0x1b3118){_0x31a664[_0xbe14('0x19')]=_0x1b3118;if(_0x1c7cc7[_0xbe14('0x30')]['includeAll']){_0x34d648[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x2a')][_0xbe14('0x40')](_0x34d648);})[_0xbe14('0x24')](function(_0x5cf713){_0x31a664['rows']=_0x5cf713;return _0x31a664;})[_0xbe14('0x24')](respondWithFilteredResult(_0x19252f,_0x34d648))[_0xbe14('0x41')](handleError(_0x19252f,null));};exports[_0xbe14('0x42')]=function(_0x51c859,_0x5d5318){var _0x6b6aa8={'raw':!![],'where':{'id':_0x51c859['params']['id']}},_0x59ae4d={};_0x59ae4d[_0xbe14('0x2f')]=_[_0xbe14('0x31')](db[_0xbe14('0x2a')]['rawAttributes']);_0x59ae4d['query']=_['keys'](_0x51c859[_0xbe14('0x30')]);_0x59ae4d[_0xbe14('0x32')]=_[_0xbe14('0x33')](_0x59ae4d['model'],_0x59ae4d[_0xbe14('0x30')]);_0x6b6aa8[_0xbe14('0x34')]=_[_0xbe14('0x33')](_0x59ae4d[_0xbe14('0x2f')],qs['fields'](_0x51c859['query'][_0xbe14('0x43')]));_0x6b6aa8[_0xbe14('0x34')]=_0x6b6aa8[_0xbe14('0x34')][_0xbe14('0x44')]?_0x6b6aa8[_0xbe14('0x34')]:_0x59ae4d['model'];if(_0x51c859['query'][_0xbe14('0x45')]){_0x6b6aa8[_0xbe14('0x3f')]=[{'all':!![]}];}_0x6b6aa8=_[_0xbe14('0x3b')]({},_0x6b6aa8,_0x51c859[_0xbe14('0x3e')]);return db['Template'][_0xbe14('0x46')](_0x6b6aa8)[_0xbe14('0x24')](handleEntityNotFound(_0x5d5318,null))['then'](respondWithResult(_0x5d5318,null))[_0xbe14('0x41')](handleError(_0x5d5318,null));};exports[_0xbe14('0x47')]=function(_0x2d6ee8,_0x36c20c){return db['Template']['create'](_0x2d6ee8[_0xbe14('0x48')],{})[_0xbe14('0x24')](function(_0x4a1a37){var _0x5acf90=_0x2d6ee8[_0xbe14('0x49')][_0xbe14('0x22')]({'plain':!![]});if(!_0x5acf90)throw new Error(_0xbe14('0x4a'));if(_0x5acf90[_0xbe14('0x4b')]===_0xbe14('0x49')){var _0xd04fd5=_0x4a1a37[_0xbe14('0x22')]({'plain':!![]});var _0x5a4068=_0xbe14('0x23');return db[_0xbe14('0x4c')][_0xbe14('0x46')]({'where':{'name':_0x5a4068,'userProfileId':_0x5acf90[_0xbe14('0x4d')]},'raw':!![]})[_0xbe14('0x24')](function(_0x494c32){if(_0x494c32&&_0x494c32[_0xbe14('0x4e')]===0x0){return db[_0xbe14('0x4f')][_0xbe14('0x47')]({'name':_0xd04fd5[_0xbe14('0x26')],'resourceId':_0xd04fd5['id'],'type':_0x494c32[_0xbe14('0x26')],'sectionId':_0x494c32['id']},{})[_0xbe14('0x24')](function(){return _0x4a1a37;});}else{return _0x4a1a37;}})['catch'](function(_0x5aeea9){logger[_0xbe14('0x25')](_0xbe14('0x50'),_0x5aeea9);throw _0x5aeea9;});}return _0x4a1a37;})[_0xbe14('0x24')](respondWithResult(_0x36c20c,0xc9))['catch'](handleError(_0x36c20c,null));};exports['update']=function(_0x44fe0d,_0x134878){if(_0x44fe0d['body']['id']){delete _0x44fe0d[_0xbe14('0x48')]['id'];}return db[_0xbe14('0x2a')]['find']({'where':{'id':_0x44fe0d[_0xbe14('0x51')]['id']}})['then'](handleEntityNotFound(_0x134878,null))[_0xbe14('0x24')](saveUpdates(_0x44fe0d[_0xbe14('0x48')],null))[_0xbe14('0x24')](respondWithResult(_0x134878,null))['catch'](handleError(_0x134878,null));};exports[_0xbe14('0x21')]=function(_0x404212,_0x5dc78a){return db[_0xbe14('0x2a')][_0xbe14('0x46')]({'where':{'id':_0x404212[_0xbe14('0x51')]['id']}})[_0xbe14('0x24')](handleEntityNotFound(_0x5dc78a,null))[_0xbe14('0x24')](removeEntity(_0x5dc78a,null))['catch'](handleError(_0x5dc78a,null));}; \ No newline at end of file +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(_0x12881c,_0x363794){var _0x2709e0=function(_0x2af837){while(--_0x2af837){_0x12881c['push'](_0x12881c['shift']());}};_0x2709e0(++_0x363794);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc4aa[_0x2641f9];return _0x585741;};'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 diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index f5b64f2..32d371a 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 _0x582e=['api','moment','request-promise','path','../../config/environment','./template.attributes','exports','define','Template','tools_templates','util','../../config/logger'];(function(_0x2b77d0,_0x195d54){var _0x3a1d32=function(_0x168620){while(--_0x168620){_0x2b77d0['push'](_0x2b77d0['shift']());}};_0x3a1d32(++_0x195d54);}(_0x582e,0x18a));var _0xe582=function(_0x1d9bc1,_0x52f0a6){_0x1d9bc1=_0x1d9bc1-0x0;var _0x540128=_0x582e[_0x1d9bc1];return _0x540128;};'use strict';var _=require('lodash');var util=require(_0xe582('0x0'));var logger=require(_0xe582('0x1'))(_0xe582('0x2'));var moment=require(_0xe582('0x3'));var BPromise=require('bluebird');var rp=require(_0xe582('0x4'));var fs=require('fs');var path=require(_0xe582('0x5'));var rimraf=require('rimraf');var config=require(_0xe582('0x6'));var attributes=require(_0xe582('0x7'));module[_0xe582('0x8')]=function(_0x2eb2db,_0xd95933){return _0x2eb2db[_0xe582('0x9')](_0xe582('0xa'),attributes,{'tableName':_0xe582('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5ef=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','Template','tools_templates','lodash','util'];(function(_0x4082f8,_0x423bb4){var _0x59054e=function(_0x3b431d){while(--_0x3b431d){_0x4082f8['push'](_0x4082f8['shift']());}};_0x59054e(++_0x423bb4);}(_0xb5ef,0x166));var _0xfb5e=function(_0x5b65b9,_0xb57482){_0x5b65b9=_0x5b65b9-0x0;var _0x5adec0=_0xb5ef[_0x5b65b9];return _0x5adec0;};'use strict';var _=require(_0xfb5e('0x0'));var util=require(_0xfb5e('0x1'));var logger=require(_0xfb5e('0x2'))('api');var moment=require(_0xfb5e('0x3'));var BPromise=require(_0xfb5e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb5e('0x5'));var rimraf=require(_0xfb5e('0x6'));var config=require(_0xfb5e('0x7'));var attributes=require('./template.attributes');module[_0xfb5e('0x8')]=function(_0x11acd3,_0xcf0c2b){return _0x11acd3[_0xfb5e('0x9')](_0xfb5e('0xa'),attributes,{'tableName':_0xfb5e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 8a298c9..38143d0 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 _0xde73=['error','code','message','result','catch','Template','findAll','options','raw','where','attributes','include','map','model','GetTemplate','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x53ddbd,_0x37643f){var _0xafa86e=function(_0x8ffb8a){while(--_0x8ffb8a){_0x53ddbd['push'](_0x53ddbd['shift']());}};_0xafa86e(++_0x37643f);}(_0xde73,0x141));var _0x3de7=function(_0x4d89a8,_0x1e2b17){_0x4d89a8=_0x4d89a8-0x0;var _0x2ede60=_0xde73[_0x4d89a8];return _0x2ede60;};'use strict';var _=require(_0x3de7('0x0'));var util=require(_0x3de7('0x1'));var moment=require(_0x3de7('0x2'));var BPromise=require(_0x3de7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3de7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3de7('0x5'));var logger=require(_0x3de7('0x6'))(_0x3de7('0x7'));var config=require(_0x3de7('0x8'));var jayson=require(_0x3de7('0x9'));var client=jayson[_0x3de7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ca7ec,_0x916b05,_0x553176){return new BPromise(function(_0x1da89b,_0x11a9d2){return client[_0x3de7('0xb')](_0x2ca7ec,_0x553176)[_0x3de7('0xc')](function(_0x40810c){logger[_0x3de7('0xd')](_0x3de7('0xe'),_0x916b05,_0x3de7('0xf'));logger[_0x3de7('0x10')](_0x3de7('0x11'),_0x916b05,'request\x20sent',JSON[_0x3de7('0x12')](_0x40810c));if(_0x40810c[_0x3de7('0x13')]){if(_0x40810c[_0x3de7('0x13')][_0x3de7('0x14')]===0x1f4){logger[_0x3de7('0x13')](_0x3de7('0xe'),_0x916b05,_0x40810c['error'][_0x3de7('0x15')]);return _0x11a9d2(_0x40810c[_0x3de7('0x13')][_0x3de7('0x15')]);}logger[_0x3de7('0x13')](_0x3de7('0xe'),_0x916b05,_0x40810c[_0x3de7('0x13')][_0x3de7('0x15')]);return _0x1da89b(_0x40810c[_0x3de7('0x13')][_0x3de7('0x15')]);}else{logger[_0x3de7('0xd')]('Template,\x20%s,\x20%s',_0x916b05,_0x3de7('0xf'));_0x1da89b(_0x40810c[_0x3de7('0x16')][_0x3de7('0x15')]);}})[_0x3de7('0x17')](function(_0xfa11){logger[_0x3de7('0x13')](_0x3de7('0xe'),_0x916b05,_0xfa11);_0x11a9d2(_0xfa11);});});}exports['GetTemplate']=function(_0x1c119e){var _0x5ca12f=this;return new Promise(function(_0x780d82,_0x42b0c2){return db[_0x3de7('0x18')][_0x3de7('0x19')]({'raw':_0x1c119e[_0x3de7('0x1a')]?_0x1c119e[_0x3de7('0x1a')][_0x3de7('0x1b')]===undefined?!![]:![]:!![],'where':_0x1c119e['options']?_0x1c119e[_0x3de7('0x1a')][_0x3de7('0x1c')]||null:null,'attributes':_0x1c119e['options']?_0x1c119e[_0x3de7('0x1a')][_0x3de7('0x1d')]||null:null,'limit':_0x1c119e[_0x3de7('0x1a')]?_0x1c119e['options']['limit']||null:null,'include':_0x1c119e[_0x3de7('0x1a')]?_0x1c119e[_0x3de7('0x1a')][_0x3de7('0x1e')]?_[_0x3de7('0x1f')](_0x1c119e[_0x3de7('0x1a')][_0x3de7('0x1e')],function(_0x7ae750){return{'model':db[_0x7ae750['model']],'as':_0x7ae750['as'],'attributes':_0x7ae750[_0x3de7('0x1d')],'include':_0x7ae750['include']?_[_0x3de7('0x1f')](_0x7ae750['include'],function(_0x115e4d){return{'model':db[_0x115e4d[_0x3de7('0x20')]],'as':_0x115e4d['as'],'attributes':_0x115e4d[_0x3de7('0x1d')],'include':_0x115e4d[_0x3de7('0x1e')]?_[_0x3de7('0x1f')](_0x115e4d[_0x3de7('0x1e')],function(_0xaaf5bb){return{'model':db[_0xaaf5bb[_0x3de7('0x20')]],'as':_0xaaf5bb['as'],'attributes':_0xaaf5bb[_0x3de7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3de7('0xc')](function(_0x7cde9){logger[_0x3de7('0xd')](_0x3de7('0x21'),_0x1c119e);logger[_0x3de7('0x10')](_0x3de7('0x21'),_0x1c119e,JSON[_0x3de7('0x12')](_0x7cde9));_0x780d82(_0x7cde9);})[_0x3de7('0x17')](function(_0x577a0e){logger[_0x3de7('0x13')]('GetTemplate',_0x577a0e['message'],_0x1c119e);_0x42b0c2(_0x5ca12f[_0x3de7('0x13')](0x1f4,_0x577a0e[_0x3de7('0x15')]));});});}; \ No newline at end of file +var _0xe2dc=['model','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','raw','where','options','attributes','limit','include','map'];(function(_0x5dcf36,_0x8598ec){var _0x418644=function(_0x5a1314){while(--_0x5a1314){_0x5dcf36['push'](_0x5dcf36['shift']());}};_0x418644(++_0x8598ec);}(_0xe2dc,0x1d5));var _0xce2d=function(_0x1b9f3c,_0x302d35){_0x1b9f3c=_0x1b9f3c-0x0;var _0x1e18f7=_0xe2dc[_0x1b9f3c];return _0x1e18f7;};'use strict';var _=require(_0xce2d('0x0'));var util=require(_0xce2d('0x1'));var moment=require('moment');var BPromise=require(_0xce2d('0x2'));var rs=require(_0xce2d('0x3'));var fs=require('fs');var Redis=require(_0xce2d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xce2d('0x5'));var logger=require(_0xce2d('0x6'))(_0xce2d('0x7'));var config=require(_0xce2d('0x8'));var jayson=require(_0xce2d('0x9'));var client=jayson[_0xce2d('0xa')][_0xce2d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3795be,_0x2e99f9,_0x151f03){return new BPromise(function(_0x1eaae4,_0x592402){return client[_0xce2d('0xc')](_0x3795be,_0x151f03)[_0xce2d('0xd')](function(_0xdabd2c){logger[_0xce2d('0xe')](_0xce2d('0xf'),_0x2e99f9,_0xce2d('0x10'));logger[_0xce2d('0x11')](_0xce2d('0x12'),_0x2e99f9,_0xce2d('0x10'),JSON[_0xce2d('0x13')](_0xdabd2c));if(_0xdabd2c[_0xce2d('0x14')]){if(_0xdabd2c[_0xce2d('0x14')][_0xce2d('0x15')]===0x1f4){logger['error'](_0xce2d('0xf'),_0x2e99f9,_0xdabd2c[_0xce2d('0x14')][_0xce2d('0x16')]);return _0x592402(_0xdabd2c['error'][_0xce2d('0x16')]);}logger[_0xce2d('0x14')](_0xce2d('0xf'),_0x2e99f9,_0xdabd2c[_0xce2d('0x14')]['message']);return _0x1eaae4(_0xdabd2c[_0xce2d('0x14')][_0xce2d('0x16')]);}else{logger[_0xce2d('0xe')](_0xce2d('0xf'),_0x2e99f9,'request\x20sent');_0x1eaae4(_0xdabd2c[_0xce2d('0x17')]['message']);}})[_0xce2d('0x18')](function(_0x3aa4cc){logger[_0xce2d('0x14')](_0xce2d('0xf'),_0x2e99f9,_0x3aa4cc);_0x592402(_0x3aa4cc);});});}exports[_0xce2d('0x19')]=function(_0x4d9a78){var _0x120f65=this;return new Promise(function(_0x22d7b1,_0x579eac){return db[_0xce2d('0x1a')][_0xce2d('0x1b')]({'raw':_0x4d9a78['options']?_0x4d9a78['options'][_0xce2d('0x1c')]===undefined?!![]:![]:!![],'where':_0x4d9a78['options']?_0x4d9a78['options'][_0xce2d('0x1d')]||null:null,'attributes':_0x4d9a78['options']?_0x4d9a78[_0xce2d('0x1e')][_0xce2d('0x1f')]||null:null,'limit':_0x4d9a78['options']?_0x4d9a78[_0xce2d('0x1e')][_0xce2d('0x20')]||null:null,'include':_0x4d9a78[_0xce2d('0x1e')]?_0x4d9a78[_0xce2d('0x1e')][_0xce2d('0x21')]?_[_0xce2d('0x22')](_0x4d9a78[_0xce2d('0x1e')][_0xce2d('0x21')],function(_0x45beb8){return{'model':db[_0x45beb8[_0xce2d('0x23')]],'as':_0x45beb8['as'],'attributes':_0x45beb8[_0xce2d('0x1f')],'include':_0x45beb8['include']?_[_0xce2d('0x22')](_0x45beb8[_0xce2d('0x21')],function(_0x3de937){return{'model':db[_0x3de937[_0xce2d('0x23')]],'as':_0x3de937['as'],'attributes':_0x3de937[_0xce2d('0x1f')],'include':_0x3de937['include']?_[_0xce2d('0x22')](_0x3de937[_0xce2d('0x21')],function(_0x2130c1){return{'model':db[_0x2130c1[_0xce2d('0x23')]],'as':_0x2130c1['as'],'attributes':_0x2130c1[_0xce2d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xce2d('0xd')](function(_0x5b9a46){logger[_0xce2d('0xe')](_0xce2d('0x19'),_0x4d9a78);logger['debug'](_0xce2d('0x19'),_0x4d9a78,JSON[_0xce2d('0x13')](_0x5b9a46));_0x22d7b1(_0x5b9a46);})['catch'](function(_0x580ea6){logger[_0xce2d('0x14')]('GetTemplate',_0x580ea6[_0xce2d('0x16')],_0x4d9a78);_0x579eac(_0x120f65['error'](0x1f4,_0x580ea6[_0xce2d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index aa9cb66..0ac6177 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 _0x0c0f=['getAllConditions','getActions','post','/:id/all_conditions','addAllCondition','/:id/any_conditions','addAnyCondition','update','delete','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id'];(function(_0x12c67f,_0x270a0c){var _0x5cc849=function(_0x10f795){while(--_0x10f795){_0x12c67f['push'](_0x12c67f['shift']());}};_0x5cc849(++_0x270a0c);}(_0x0c0f,0xb2));var _0xf0c0=function(_0x4f59b5,_0x5b3f43){_0x4f59b5=_0x4f59b5-0x0;var _0x6b611=_0x0c0f[_0x4f59b5];return _0x6b611;};'use strict';var multer=require('multer');var util=require(_0xf0c0('0x0'));var path=require('path');var timeout=require(_0xf0c0('0x1'));var express=require(_0xf0c0('0x2'));var router=express['Router']();var auth=require(_0xf0c0('0x3'));var interaction=require(_0xf0c0('0x4'));var config=require(_0xf0c0('0x5'));var controller=require(_0xf0c0('0x6'));router[_0xf0c0('0x7')]('/',auth[_0xf0c0('0x8')](),controller[_0xf0c0('0x9')]);router[_0xf0c0('0x7')](_0xf0c0('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xf0c0('0x7')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xf0c0('0xb')]);router[_0xf0c0('0x7')]('/:id/any_conditions',auth[_0xf0c0('0x8')](),controller['getAnyConditions']);router[_0xf0c0('0x7')]('/:id/actions',auth['isAuthenticated'](),controller[_0xf0c0('0xc')]);router[_0xf0c0('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf0c0('0xd')](_0xf0c0('0xe'),auth['isAuthenticated'](),controller[_0xf0c0('0xf')]);router[_0xf0c0('0xd')](_0xf0c0('0x10'),auth['isAuthenticated'](),controller[_0xf0c0('0x11')]);router[_0xf0c0('0xd')]('/:id/actions',auth[_0xf0c0('0x8')](),controller['addAction']);router['put'](_0xf0c0('0xa'),auth[_0xf0c0('0x8')](),controller[_0xf0c0('0x12')]);router[_0xf0c0('0x13')](_0xf0c0('0xa'),auth[_0xf0c0('0x8')](),controller['destroy']);module[_0xf0c0('0x14')]=router; \ No newline at end of file +var _0x6517=['get','/:id','show','getAllConditions','getAnyConditions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','/:id/actions','addAction','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated'];(function(_0x2dee81,_0x58c3df){var _0xa3a214=function(_0x459326){while(--_0x459326){_0x2dee81['push'](_0x2dee81['shift']());}};_0xa3a214(++_0x58c3df);}(_0x6517,0x1b9));var _0x7651=function(_0x2b4a79,_0x5c71d8){_0x2b4a79=_0x2b4a79-0x0;var _0x15fd59=_0x6517[_0x2b4a79];return _0x15fd59;};'use strict';var multer=require(_0x7651('0x0'));var util=require('util');var path=require(_0x7651('0x1'));var timeout=require(_0x7651('0x2'));var express=require(_0x7651('0x3'));var router=express['Router']();var auth=require(_0x7651('0x4'));var interaction=require(_0x7651('0x5'));var config=require(_0x7651('0x6'));var controller=require(_0x7651('0x7'));router['get']('/',auth[_0x7651('0x8')](),controller['index']);router[_0x7651('0x9')](_0x7651('0xa'),auth['isAuthenticated'](),controller[_0x7651('0xb')]);router['get']('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x7651('0xc')]);router['get']('/:id/any_conditions',auth[_0x7651('0x8')](),controller[_0x7651('0xd')]);router[_0x7651('0x9')]('/:id/actions',auth[_0x7651('0x8')](),controller[_0x7651('0xe')]);router[_0x7651('0xf')]('/',auth[_0x7651('0x8')](),controller[_0x7651('0x10')]);router[_0x7651('0xf')]('/:id/all_conditions',auth[_0x7651('0x8')](),controller[_0x7651('0x11')]);router[_0x7651('0xf')](_0x7651('0x12'),auth['isAuthenticated'](),controller[_0x7651('0x13')]);router[_0x7651('0xf')](_0x7651('0x14'),auth[_0x7651('0x8')](),controller[_0x7651('0x15')]);router['put'](_0x7651('0xa'),auth[_0x7651('0x8')](),controller[_0x7651('0x16')]);router[_0x7651('0x17')](_0x7651('0xa'),auth[_0x7651('0x8')](),controller['destroy']);module[_0x7651('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index f88c650..731efd7 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 _0x224f=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2a1e89,_0x2d9e5a){var _0x1b0188=function(_0x140d68){while(--_0x140d68){_0x2a1e89['push'](_0x2a1e89['shift']());}};_0x1b0188(++_0x2d9e5a);}(_0x224f,0xe4));var _0xf224=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0x224f[_0x2dd390];return _0x3afe47;};'use strict';var Sequelize=require(_0xf224('0x0'));module[_0xf224('0x1')]={'name':{'type':Sequelize[_0xf224('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf224('0x2')]},'status':{'type':Sequelize[_0xf224('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xa0f4=['STRING','exports'];(function(_0x33758e,_0x14edb8){var _0x5c37e5=function(_0x3ea222){while(--_0x3ea222){_0x33758e['push'](_0x33758e['shift']());}};_0x5c37e5(++_0x14edb8);}(_0xa0f4,0xed));var _0x4a0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0f4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x4a0f('0x0')]={'name':{'type':Sequelize[_0x4a0f('0x1')]},'channel':{'type':Sequelize[_0x4a0f('0x1')]},'description':{'type':Sequelize[_0x4a0f('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 15a68c9..2b93c46 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 _0xd6d6=['TriggerAnyId','getAllConditions','findOne','order','getAnyConditions','addAction','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','name','index','map','Trigger','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','options','include','findAll','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','params','TriggerAllId','Condition'];(function(_0x153c6d,_0x370848){var _0x1b8e42=function(_0x3e5a7f){while(--_0x3e5a7f){_0x153c6d['push'](_0x153c6d['shift']());}};_0x1b8e42(++_0x370848);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x436e24,_0x1be6b5){_0x436e24=_0x436e24-0x0;var _0xbdfe46=_0xd6d6[_0x436e24];return _0xbdfe46;};'use strict';var pdf=require(_0x6d6d('0x0'));var emlformat=require(_0x6d6d('0x1'));var rimraf=require(_0x6d6d('0x2'));var zipdir=require(_0x6d6d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d6d('0x4'));var moment=require(_0x6d6d('0x5'));var BPromise=require(_0x6d6d('0x6'));var Mustache=require(_0x6d6d('0x7'));var util=require(_0x6d6d('0x8'));var path=require(_0x6d6d('0x9'));var sox=require(_0x6d6d('0xa'));var csv=require('to-csv');var ejs=require(_0x6d6d('0xb'));var fs=require('fs');var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x12'));var authService=require(_0x6d6d('0x13'));var qs=require(_0x6d6d('0x14'));var as=require(_0x6d6d('0x15'));var hardwareService=require(_0x6d6d('0x16'));var logger=require('../../config/logger')(_0x6d6d('0x17'));var utils=require(_0x6d6d('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x19'))['db'];function respondWithStatusCode(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xcc;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0x1a')](_0xe61c36);}return _0x32146d[_0x6d6d('0x1b')](_0xe61c36)[_0x6d6d('0x1c')]();};}function respondWithResult(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0xc8;return function(_0xd09ea7){if(_0xd09ea7){return _0x2cb2dd[_0x6d6d('0x1b')](_0x5f4154)[_0x6d6d('0x1d')](_0xd09ea7);}};}function respondWithFilteredResult(_0xa3b05d,_0x29cbd8){return function(_0x5d80c0){if(_0x5d80c0){var _0x2e6fdb=_0x5d80c0[_0x6d6d('0x1e')],_0x587338=_0x29cbd8['offset'],_0x27830d=_0x29cbd8['offset']+_0x29cbd8[_0x6d6d('0x1f')],_0x2cbc86;if(_0x27830d>=_0x2e6fdb){_0x27830d=_0x2e6fdb;_0x2cbc86=0xc8;}else{_0x2cbc86=0xce;}_0xa3b05d[_0x6d6d('0x1b')](_0x2cbc86);return _0xa3b05d[_0x6d6d('0x20')](_0x6d6d('0x21'),_0x587338+'-'+_0x27830d+'/'+_0x2e6fdb)['json'](_0x5d80c0);}return null;};}function patchUpdates(_0x554392){return function(_0x474873){try{jsonpatch['apply'](_0x474873,_0x554392,!![]);}catch(_0x26f631){return BPromise[_0x6d6d('0x22')](_0x26f631);}return _0x474873[_0x6d6d('0x23')]();};}function saveUpdates(_0x450352,_0x40d35b){return function(_0x3242d8){if(_0x3242d8){return _0x3242d8[_0x6d6d('0x24')](_0x450352)[_0x6d6d('0x25')](function(_0x115a3c){return _0x115a3c;});}return null;};}function removeEntity(_0x6f64e3,_0x24b10d){return function(_0x6e58e3){if(_0x6e58e3){return _0x6e58e3[_0x6d6d('0x26')]()[_0x6d6d('0x25')](function(){var _0x1f7f88=_0x6e58e3[_0x6d6d('0x27')]({'plain':!![]});var _0xced622='Triggers';return db[_0x6d6d('0x28')][_0x6d6d('0x26')]({'where':{'type':_0xced622,'resourceId':_0x1f7f88['id']}})[_0x6d6d('0x25')](function(){return _0x6e58e3;});})[_0x6d6d('0x25')](function(){_0x6f64e3[_0x6d6d('0x1b')](0xcc)[_0x6d6d('0x1c')]();});}};}function handleEntityNotFound(_0x554f8e,_0x2851dd){return function(_0x2b5e31){if(!_0x2b5e31){_0x554f8e[_0x6d6d('0x1a')](0x194);}return _0x2b5e31;};}function handleError(_0x126ac8,_0x25c121){_0x25c121=_0x25c121||0x1f4;return function(_0x408f98){logger[_0x6d6d('0x29')](_0x408f98['stack']);if(_0x408f98[_0x6d6d('0x2a')]){delete _0x408f98[_0x6d6d('0x2a')];}_0x126ac8['status'](_0x25c121)['send'](_0x408f98);};}exports[_0x6d6d('0x2b')]=function(_0x5273cd,_0x8a9a84){var _0x57341f={},_0xde3272={},_0x20255e={'count':0x0,'rows':[]};var _0x3851d1=_[_0x6d6d('0x2c')](db[_0x6d6d('0x2d')][_0x6d6d('0x2e')],function(_0xdda3f2){return{'name':_0xdda3f2[_0x6d6d('0x2f')],'type':_0xdda3f2[_0x6d6d('0x30')][_0x6d6d('0x31')]};});_0xde3272['model']=_[_0x6d6d('0x2c')](_0x3851d1,'name');_0xde3272[_0x6d6d('0x32')]=_[_0x6d6d('0x33')](_0x5273cd[_0x6d6d('0x32')]);_0xde3272[_0x6d6d('0x34')]=_['intersection'](_0xde3272[_0x6d6d('0x35')],_0xde3272['query']);_0x57341f[_0x6d6d('0x36')]=_[_0x6d6d('0x37')](_0xde3272['model'],qs[_0x6d6d('0x38')](_0x5273cd[_0x6d6d('0x32')][_0x6d6d('0x38')]));_0x57341f[_0x6d6d('0x36')]=_0x57341f[_0x6d6d('0x36')][_0x6d6d('0x39')]?_0x57341f[_0x6d6d('0x36')]:_0xde3272[_0x6d6d('0x35')];if(!_0x5273cd[_0x6d6d('0x32')][_0x6d6d('0x3a')](_0x6d6d('0x3b'))){_0x57341f[_0x6d6d('0x1f')]=qs[_0x6d6d('0x1f')](_0x5273cd[_0x6d6d('0x32')]['limit']);_0x57341f[_0x6d6d('0x3c')]=qs[_0x6d6d('0x3c')](_0x5273cd[_0x6d6d('0x32')][_0x6d6d('0x3c')]);}_0x57341f['order']=qs['sort'](_0x5273cd[_0x6d6d('0x32')][_0x6d6d('0x3d')]);_0x57341f[_0x6d6d('0x3e')]=qs['filters'](_[_0x6d6d('0x3f')](_0x5273cd[_0x6d6d('0x32')],_0xde3272[_0x6d6d('0x34')]),_0x3851d1);if(_0x5273cd[_0x6d6d('0x32')]['filter']){_0x57341f['where']=_['merge'](_0x57341f[_0x6d6d('0x3e')],{'$or':_[_0x6d6d('0x2c')](_0x3851d1,function(_0x33c8f2){if(_0x33c8f2[_0x6d6d('0x30')]!=='VIRTUAL'){var _0x253416={};_0x253416[_0x33c8f2[_0x6d6d('0x2a')]]={'$like':'%'+_0x5273cd[_0x6d6d('0x32')][_0x6d6d('0x40')]+'%'};return _0x253416;}})});}_0x57341f=_[_0x6d6d('0x41')]({},_0x57341f,_0x5273cd[_0x6d6d('0x42')]);var _0x4b457d={'where':_0x57341f[_0x6d6d('0x3e')]};return db[_0x6d6d('0x2d')][_0x6d6d('0x1e')](_0x4b457d)[_0x6d6d('0x25')](function(_0x32275b){_0x20255e[_0x6d6d('0x1e')]=_0x32275b;if(_0x5273cd[_0x6d6d('0x32')]['includeAll']){_0x57341f[_0x6d6d('0x43')]=[{'all':!![]}];}return db[_0x6d6d('0x2d')][_0x6d6d('0x44')](_0x57341f);})[_0x6d6d('0x25')](function(_0xe1aa77){_0x20255e['rows']=_0xe1aa77;return _0x20255e;})[_0x6d6d('0x25')](respondWithFilteredResult(_0x8a9a84,_0x57341f))[_0x6d6d('0x45')](handleError(_0x8a9a84,null));};exports['show']=function(_0x452de2,_0x50dc17){var _0x15bf62={'raw':![],'where':{'id':_0x452de2['params']['id']}},_0x43c03c={};_0x43c03c[_0x6d6d('0x35')]=_[_0x6d6d('0x33')](db[_0x6d6d('0x2d')][_0x6d6d('0x2e')]);_0x43c03c[_0x6d6d('0x32')]=_['keys'](_0x452de2['query']);_0x43c03c[_0x6d6d('0x34')]=_['intersection'](_0x43c03c['model'],_0x43c03c[_0x6d6d('0x32')]);_0x15bf62[_0x6d6d('0x36')]=_[_0x6d6d('0x37')](_0x43c03c['model'],qs[_0x6d6d('0x38')](_0x452de2['query'][_0x6d6d('0x38')]));_0x15bf62[_0x6d6d('0x36')]=_0x15bf62[_0x6d6d('0x36')][_0x6d6d('0x39')]?_0x15bf62[_0x6d6d('0x36')]:_0x43c03c[_0x6d6d('0x35')];if(_0x452de2[_0x6d6d('0x32')]['includeAll']){_0x15bf62[_0x6d6d('0x43')]=[{'all':!![]}];}_0x15bf62=_[_0x6d6d('0x41')]({},_0x15bf62,_0x452de2[_0x6d6d('0x42')]);return db[_0x6d6d('0x2d')][_0x6d6d('0x46')](_0x15bf62)[_0x6d6d('0x25')](handleEntityNotFound(_0x50dc17,null))[_0x6d6d('0x25')](respondWithResult(_0x50dc17,null))[_0x6d6d('0x45')](handleError(_0x50dc17,null));};exports[_0x6d6d('0x47')]=function(_0x5e4c04,_0x4d78bb){return db[_0x6d6d('0x2d')][_0x6d6d('0x47')](_0x5e4c04[_0x6d6d('0x48')],{})[_0x6d6d('0x25')](function(_0xe2a20e){var _0x492834=_0x5e4c04[_0x6d6d('0x49')][_0x6d6d('0x27')]({'plain':!![]});if(!_0x492834)throw new Error(_0x6d6d('0x4a'));if(_0x492834[_0x6d6d('0x4b')]===_0x6d6d('0x49')){var _0x23c2db=_0xe2a20e[_0x6d6d('0x27')]({'plain':!![]});var _0x39ec2a=_0x6d6d('0x4c');return db[_0x6d6d('0x4d')][_0x6d6d('0x46')]({'where':{'name':_0x39ec2a,'userProfileId':_0x492834[_0x6d6d('0x4e')]},'raw':!![]})['then'](function(_0x190786){if(_0x190786&&_0x190786[_0x6d6d('0x4f')]===0x0){return db[_0x6d6d('0x28')][_0x6d6d('0x47')]({'name':_0x23c2db[_0x6d6d('0x2a')],'resourceId':_0x23c2db['id'],'type':_0x190786['name'],'sectionId':_0x190786['id']},{})[_0x6d6d('0x25')](function(){return _0xe2a20e;});}else{return _0xe2a20e;}})[_0x6d6d('0x45')](function(_0x45340b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45340b);throw _0x45340b;});}return _0xe2a20e;})[_0x6d6d('0x25')](respondWithResult(_0x4d78bb,0xc9))['catch'](handleError(_0x4d78bb,null));};exports[_0x6d6d('0x24')]=function(_0x995fe2,_0x32aaae){if(_0x995fe2[_0x6d6d('0x48')]['id']){delete _0x995fe2[_0x6d6d('0x48')]['id'];}return db[_0x6d6d('0x2d')][_0x6d6d('0x46')]({'where':{'id':_0x995fe2[_0x6d6d('0x50')]['id']}})[_0x6d6d('0x25')](handleEntityNotFound(_0x32aaae,null))[_0x6d6d('0x25')](saveUpdates(_0x995fe2['body'],null))[_0x6d6d('0x25')](respondWithResult(_0x32aaae,null))[_0x6d6d('0x45')](handleError(_0x32aaae,null));};exports[_0x6d6d('0x26')]=function(_0x8000b6,_0x1f98d4){return db[_0x6d6d('0x2d')][_0x6d6d('0x46')]({'where':{'id':_0x8000b6['params']['id']}})['then'](handleEntityNotFound(_0x1f98d4,null))[_0x6d6d('0x25')](removeEntity(_0x1f98d4,null))[_0x6d6d('0x45')](handleError(_0x1f98d4,null));};exports['addAllCondition']=function(_0x3e98a0,_0x1531c4,_0x347a60){if(_0x3e98a0[_0x6d6d('0x48')]['id']){delete _0x3e98a0[_0x6d6d('0x48')]['id'];}return db[_0x6d6d('0x2d')][_0x6d6d('0x46')]({'where':{'id':_0x3e98a0[_0x6d6d('0x50')]['id']}})[_0x6d6d('0x25')](handleEntityNotFound(_0x1531c4,null))[_0x6d6d('0x25')](function(_0x444f6a){if(_0x444f6a){_0x3e98a0[_0x6d6d('0x48')][_0x6d6d('0x51')]=_0x444f6a['id'];return db[_0x6d6d('0x52')][_0x6d6d('0x47')](_0x3e98a0['body']);}})[_0x6d6d('0x25')](respondWithResult(_0x1531c4,null))[_0x6d6d('0x45')](handleError(_0x1531c4,null));};exports['addAnyCondition']=function(_0x1ab22b,_0x466778,_0x1f99ef){if(_0x1ab22b[_0x6d6d('0x48')]['id']){delete _0x1ab22b[_0x6d6d('0x48')]['id'];}return db[_0x6d6d('0x2d')][_0x6d6d('0x46')]({'where':{'id':_0x1ab22b[_0x6d6d('0x50')]['id']}})[_0x6d6d('0x25')](handleEntityNotFound(_0x466778,null))['then'](function(_0x5dfa4f){if(_0x5dfa4f){_0x1ab22b[_0x6d6d('0x48')][_0x6d6d('0x53')]=_0x5dfa4f['id'];return db[_0x6d6d('0x52')]['create'](_0x1ab22b['body']);}})[_0x6d6d('0x25')](respondWithResult(_0x466778,null))['catch'](handleError(_0x466778,null));};exports[_0x6d6d('0x54')]=function(_0x5b6f58,_0x395fa9,_0x367a6f){var _0x21f14c={};var _0x46f84f={};var _0x3a07a2;var _0xad3eb;return db['Trigger'][_0x6d6d('0x55')]({'where':{'id':_0x5b6f58['params']['id']}})[_0x6d6d('0x25')](handleEntityNotFound(_0x395fa9,null))['then'](function(_0x2a21d8){if(_0x2a21d8){_0x3a07a2=_0x2a21d8;_0x46f84f[_0x6d6d('0x35')]=_[_0x6d6d('0x33')](db[_0x6d6d('0x52')][_0x6d6d('0x2e')]);_0x46f84f[_0x6d6d('0x32')]=_[_0x6d6d('0x33')](_0x5b6f58['query']);_0x46f84f['filters']=_[_0x6d6d('0x37')](_0x46f84f['model'],_0x46f84f[_0x6d6d('0x32')]);_0x21f14c['attributes']=_[_0x6d6d('0x37')](_0x46f84f[_0x6d6d('0x35')],qs[_0x6d6d('0x38')](_0x5b6f58[_0x6d6d('0x32')][_0x6d6d('0x38')]));_0x21f14c[_0x6d6d('0x36')]=_0x21f14c['attributes'][_0x6d6d('0x39')]?_0x21f14c[_0x6d6d('0x36')]:_0x46f84f[_0x6d6d('0x35')];_0x21f14c[_0x6d6d('0x56')]=qs[_0x6d6d('0x3d')](_0x5b6f58[_0x6d6d('0x32')][_0x6d6d('0x3d')]);_0x21f14c['where']=qs[_0x6d6d('0x34')](_[_0x6d6d('0x3f')](_0x5b6f58[_0x6d6d('0x32')],_0x46f84f[_0x6d6d('0x34')]));if(_0x5b6f58[_0x6d6d('0x32')][_0x6d6d('0x40')]){_0x21f14c[_0x6d6d('0x3e')]=_[_0x6d6d('0x41')](_0x21f14c[_0x6d6d('0x3e')],{'$or':_[_0x6d6d('0x2c')](_0x21f14c[_0x6d6d('0x36')],function(_0x4ea594){var _0x488b2f={};_0x488b2f[_0x4ea594]={'$like':'%'+_0x5b6f58[_0x6d6d('0x32')]['filter']+'%'};return _0x488b2f;})});}_0x21f14c=_['merge']({},_0x21f14c,_0x5b6f58['options']);return _0x3a07a2[_0x6d6d('0x54')](_0x21f14c);}})[_0x6d6d('0x25')](function(_0x4d11e9){if(_0x4d11e9){_0xad3eb=_0x4d11e9[_0x6d6d('0x39')];if(!_0x5b6f58[_0x6d6d('0x32')][_0x6d6d('0x3a')]('nolimit')){_0x21f14c['limit']=qs[_0x6d6d('0x1f')](_0x5b6f58['query']['limit']);_0x21f14c['offset']=qs[_0x6d6d('0x3c')](_0x5b6f58['query'][_0x6d6d('0x3c')]);}return _0x3a07a2['getAllConditions'](_0x21f14c);}})[_0x6d6d('0x25')](function(_0x1a7661){if(_0x1a7661){return _0x1a7661?{'count':_0xad3eb,'rows':_0x1a7661}:null;}})['then'](respondWithResult(_0x395fa9,null))['catch'](handleError(_0x395fa9,null));};exports[_0x6d6d('0x57')]=function(_0x202bf6,_0x26812a,_0x36bdfd){var _0x5785c3={};var _0x2a5ba9={};var _0x264d24;var _0x1fb21d;return db[_0x6d6d('0x2d')]['findOne']({'where':{'id':_0x202bf6[_0x6d6d('0x50')]['id']}})['then'](handleEntityNotFound(_0x26812a,null))['then'](function(_0x580001){if(_0x580001){_0x264d24=_0x580001;_0x2a5ba9[_0x6d6d('0x35')]=_['keys'](db[_0x6d6d('0x52')][_0x6d6d('0x2e')]);_0x2a5ba9[_0x6d6d('0x32')]=_['keys'](_0x202bf6['query']);_0x2a5ba9[_0x6d6d('0x34')]=_[_0x6d6d('0x37')](_0x2a5ba9['model'],_0x2a5ba9['query']);_0x5785c3[_0x6d6d('0x36')]=_[_0x6d6d('0x37')](_0x2a5ba9[_0x6d6d('0x35')],qs[_0x6d6d('0x38')](_0x202bf6[_0x6d6d('0x32')][_0x6d6d('0x38')]));_0x5785c3[_0x6d6d('0x36')]=_0x5785c3['attributes']['length']?_0x5785c3['attributes']:_0x2a5ba9['model'];_0x5785c3['order']=qs['sort'](_0x202bf6[_0x6d6d('0x32')][_0x6d6d('0x3d')]);_0x5785c3[_0x6d6d('0x3e')]=qs[_0x6d6d('0x34')](_['pick'](_0x202bf6['query'],_0x2a5ba9['filters']));if(_0x202bf6[_0x6d6d('0x32')][_0x6d6d('0x40')]){_0x5785c3[_0x6d6d('0x3e')]=_[_0x6d6d('0x41')](_0x5785c3['where'],{'$or':_['map'](_0x5785c3[_0x6d6d('0x36')],function(_0x1e1c4e){var _0x478ed4={};_0x478ed4[_0x1e1c4e]={'$like':'%'+_0x202bf6[_0x6d6d('0x32')][_0x6d6d('0x40')]+'%'};return _0x478ed4;})});}_0x5785c3=_[_0x6d6d('0x41')]({},_0x5785c3,_0x202bf6[_0x6d6d('0x42')]);return _0x264d24[_0x6d6d('0x57')](_0x5785c3);}})['then'](function(_0xf5586f){if(_0xf5586f){_0x1fb21d=_0xf5586f['length'];if(!_0x202bf6[_0x6d6d('0x32')]['hasOwnProperty'](_0x6d6d('0x3b'))){_0x5785c3['limit']=qs[_0x6d6d('0x1f')](_0x202bf6[_0x6d6d('0x32')][_0x6d6d('0x1f')]);_0x5785c3[_0x6d6d('0x3c')]=qs[_0x6d6d('0x3c')](_0x202bf6[_0x6d6d('0x32')][_0x6d6d('0x3c')]);}return _0x264d24[_0x6d6d('0x57')](_0x5785c3);}})[_0x6d6d('0x25')](function(_0x10bab4){if(_0x10bab4){return _0x10bab4?{'count':_0x1fb21d,'rows':_0x10bab4}:null;}})[_0x6d6d('0x25')](respondWithResult(_0x26812a,null))[_0x6d6d('0x45')](handleError(_0x26812a,null));};exports[_0x6d6d('0x58')]=function(_0x16b699,_0x227066,_0x1ee7b2){if(_0x16b699['body']['id']){delete _0x16b699['body']['id'];}return db[_0x6d6d('0x2d')]['find']({'where':{'id':_0x16b699[_0x6d6d('0x50')]['id']}})[_0x6d6d('0x25')](handleEntityNotFound(_0x227066,null))['then'](function(_0x59d1cd){if(_0x59d1cd){_0x16b699[_0x6d6d('0x48')]['TriggerId']=_0x59d1cd['id'];return db[_0x6d6d('0x59')][_0x6d6d('0x47')](_0x16b699[_0x6d6d('0x48')]);}})[_0x6d6d('0x25')](respondWithResult(_0x227066,null))[_0x6d6d('0x45')](handleError(_0x227066,null));};exports[_0x6d6d('0x5a')]=function(_0x3b7bdd,_0x24ee5c,_0x4c59b5){var _0x363cfd={};var _0x26ddb5={};var _0x3f939c;var _0x51c1df;return db['Trigger'][_0x6d6d('0x55')]({'where':{'id':_0x3b7bdd[_0x6d6d('0x50')]['id']}})[_0x6d6d('0x25')](handleEntityNotFound(_0x24ee5c,null))['then'](function(_0x2cf030){if(_0x2cf030){_0x3f939c=_0x2cf030;_0x26ddb5[_0x6d6d('0x35')]=_['keys'](db[_0x6d6d('0x59')][_0x6d6d('0x2e')]);_0x26ddb5[_0x6d6d('0x32')]=_[_0x6d6d('0x33')](_0x3b7bdd[_0x6d6d('0x32')]);_0x26ddb5['filters']=_[_0x6d6d('0x37')](_0x26ddb5[_0x6d6d('0x35')],_0x26ddb5['query']);_0x363cfd['attributes']=_[_0x6d6d('0x37')](_0x26ddb5[_0x6d6d('0x35')],qs[_0x6d6d('0x38')](_0x3b7bdd[_0x6d6d('0x32')]['fields']));_0x363cfd[_0x6d6d('0x36')]=_0x363cfd['attributes'][_0x6d6d('0x39')]?_0x363cfd[_0x6d6d('0x36')]:_0x26ddb5[_0x6d6d('0x35')];_0x363cfd[_0x6d6d('0x56')]=qs[_0x6d6d('0x3d')](_0x3b7bdd[_0x6d6d('0x32')][_0x6d6d('0x3d')]);_0x363cfd[_0x6d6d('0x3e')]=qs[_0x6d6d('0x34')](_[_0x6d6d('0x3f')](_0x3b7bdd[_0x6d6d('0x32')],_0x26ddb5[_0x6d6d('0x34')]));if(_0x3b7bdd[_0x6d6d('0x32')][_0x6d6d('0x40')]){_0x363cfd[_0x6d6d('0x3e')]=_[_0x6d6d('0x41')](_0x363cfd[_0x6d6d('0x3e')],{'$or':_[_0x6d6d('0x2c')](_0x363cfd[_0x6d6d('0x36')],function(_0x270280){var _0x527c11={};_0x527c11[_0x270280]={'$like':'%'+_0x3b7bdd['query'][_0x6d6d('0x40')]+'%'};return _0x527c11;})});}_0x363cfd=_[_0x6d6d('0x41')]({},_0x363cfd,_0x3b7bdd[_0x6d6d('0x42')]);return _0x3f939c[_0x6d6d('0x5a')](_0x363cfd);}})[_0x6d6d('0x25')](function(_0x6a5ed1){if(_0x6a5ed1){_0x51c1df=_0x6a5ed1[_0x6d6d('0x39')];if(!_0x3b7bdd[_0x6d6d('0x32')][_0x6d6d('0x3a')](_0x6d6d('0x3b'))){_0x363cfd[_0x6d6d('0x1f')]=qs[_0x6d6d('0x1f')](_0x3b7bdd[_0x6d6d('0x32')][_0x6d6d('0x1f')]);_0x363cfd[_0x6d6d('0x3c')]=qs['offset'](_0x3b7bdd[_0x6d6d('0x32')][_0x6d6d('0x3c')]);}return _0x3f939c[_0x6d6d('0x5a')](_0x363cfd);}})['then'](function(_0x5e08f0){if(_0x5e08f0){return _0x5e08f0?{'count':_0x51c1df,'rows':_0x5e08f0}:null;}})['then'](respondWithResult(_0x24ee5c,null))[_0x6d6d('0x45')](handleError(_0x24ee5c,null));}; \ No newline at end of file +var _0x52ad=['filter','options','include','findAll','catch','show','rawAttributes','length','merge','find','body','user','role','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','Condition','addAnyCondition','TriggerAnyId','getAllConditions','order','getAnyConditions','findOne','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','get','Triggers','error','stack','name','send','index','map','Trigger','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x32ab87,_0x5d8eeb){var _0x447a2a=function(_0x405773){while(--_0x405773){_0x32ab87['push'](_0x32ab87['shift']());}};_0x447a2a(++_0x5d8eeb);}(_0x52ad,0x1d8));var _0xd52a=function(_0x7e2110,_0x590709){_0x7e2110=_0x7e2110-0x0;var _0x423bd1=_0x52ad[_0x7e2110];return _0x423bd1;};'use strict';var pdf=require(_0xd52a('0x0'));var emlformat=require(_0xd52a('0x1'));var rimraf=require(_0xd52a('0x2'));var zipdir=require(_0xd52a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd52a('0x4'));var moment=require(_0xd52a('0x5'));var BPromise=require(_0xd52a('0x6'));var Mustache=require(_0xd52a('0x7'));var util=require(_0xd52a('0x8'));var path=require(_0xd52a('0x9'));var sox=require(_0xd52a('0xa'));var csv=require(_0xd52a('0xb'));var ejs=require(_0xd52a('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd52a('0xd'));var crypto=require(_0xd52a('0xe'));var jsforce=require(_0xd52a('0xf'));var deskjs=require(_0xd52a('0x10'));var toCsv=require('to-csv');var querystring=require(_0xd52a('0x11'));var Papa=require(_0xd52a('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd52a('0x13'));var as=require(_0xd52a('0x14'));var hardwareService=require(_0xd52a('0x15'));var logger=require(_0xd52a('0x16'))(_0xd52a('0x17'));var utils=require(_0xd52a('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd52a('0x19'));var db=require(_0xd52a('0x1a'))['db'];function respondWithStatusCode(_0x4285d,_0x20642e){_0x20642e=_0x20642e||0xcc;return function(_0x171417){if(_0x171417){return _0x4285d[_0xd52a('0x1b')](_0x20642e);}return _0x4285d[_0xd52a('0x1c')](_0x20642e)[_0xd52a('0x1d')]();};}function respondWithResult(_0xb7ba81,_0x43f050){_0x43f050=_0x43f050||0xc8;return function(_0x2cf9eb){if(_0x2cf9eb){return _0xb7ba81[_0xd52a('0x1c')](_0x43f050)[_0xd52a('0x1e')](_0x2cf9eb);}};}function respondWithFilteredResult(_0xe4d4d1,_0x2288bf){return function(_0x22fe90){if(_0x22fe90){var _0x180457=_0x22fe90[_0xd52a('0x1f')],_0x3d1e28=_0x2288bf[_0xd52a('0x20')],_0x2066d4=_0x2288bf[_0xd52a('0x20')]+_0x2288bf[_0xd52a('0x21')],_0x1aa59f;if(_0x2066d4>=_0x180457){_0x2066d4=_0x180457;_0x1aa59f=0xc8;}else{_0x1aa59f=0xce;}_0xe4d4d1[_0xd52a('0x1c')](_0x1aa59f);return _0xe4d4d1[_0xd52a('0x22')]('Content-Range',_0x3d1e28+'-'+_0x2066d4+'/'+_0x180457)['json'](_0x22fe90);}return null;};}function patchUpdates(_0x3adbd7){return function(_0x5bca9c){try{jsonpatch['apply'](_0x5bca9c,_0x3adbd7,!![]);}catch(_0x66b26f){return BPromise[_0xd52a('0x23')](_0x66b26f);}return _0x5bca9c[_0xd52a('0x24')]();};}function saveUpdates(_0x4526f7,_0x2c6589){return function(_0xdf3de3){if(_0xdf3de3){return _0xdf3de3[_0xd52a('0x25')](_0x4526f7)[_0xd52a('0x26')](function(_0x3be32b){return _0x3be32b;});}return null;};}function removeEntity(_0x53881a,_0x167166){return function(_0x3fdc08){if(_0x3fdc08){return _0x3fdc08[_0xd52a('0x27')]()[_0xd52a('0x26')](function(){var _0x24e8b4=_0x3fdc08[_0xd52a('0x28')]({'plain':!![]});var _0x3644c1=_0xd52a('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x3644c1,'resourceId':_0x24e8b4['id']}})[_0xd52a('0x26')](function(){return _0x3fdc08;});})['then'](function(){_0x53881a[_0xd52a('0x1c')](0xcc)[_0xd52a('0x1d')]();});}};}function handleEntityNotFound(_0x4cd29f,_0x517bb4){return function(_0x10dc66){if(!_0x10dc66){_0x4cd29f[_0xd52a('0x1b')](0x194);}return _0x10dc66;};}function handleError(_0x275244,_0x267c65){_0x267c65=_0x267c65||0x1f4;return function(_0x385240){logger[_0xd52a('0x2a')](_0x385240[_0xd52a('0x2b')]);if(_0x385240[_0xd52a('0x2c')]){delete _0x385240[_0xd52a('0x2c')];}_0x275244[_0xd52a('0x1c')](_0x267c65)[_0xd52a('0x2d')](_0x385240);};}exports[_0xd52a('0x2e')]=function(_0x1e4e0e,_0x4ad3e4){var _0x2d4ce1={},_0x436de3={},_0x5dd24c={'count':0x0,'rows':[]};var _0x515068=_[_0xd52a('0x2f')](db[_0xd52a('0x30')]['rawAttributes'],function(_0x59e328){return{'name':_0x59e328['fieldName'],'type':_0x59e328[_0xd52a('0x31')]['key']};});_0x436de3['model']=_['map'](_0x515068,_0xd52a('0x2c'));_0x436de3[_0xd52a('0x32')]=_[_0xd52a('0x33')](_0x1e4e0e[_0xd52a('0x32')]);_0x436de3[_0xd52a('0x34')]=_[_0xd52a('0x35')](_0x436de3[_0xd52a('0x36')],_0x436de3[_0xd52a('0x32')]);_0x2d4ce1[_0xd52a('0x37')]=_['intersection'](_0x436de3[_0xd52a('0x36')],qs[_0xd52a('0x38')](_0x1e4e0e[_0xd52a('0x32')]['fields']));_0x2d4ce1['attributes']=_0x2d4ce1[_0xd52a('0x37')]['length']?_0x2d4ce1[_0xd52a('0x37')]:_0x436de3[_0xd52a('0x36')];if(!_0x1e4e0e[_0xd52a('0x32')][_0xd52a('0x39')](_0xd52a('0x3a'))){_0x2d4ce1[_0xd52a('0x21')]=qs[_0xd52a('0x21')](_0x1e4e0e[_0xd52a('0x32')]['limit']);_0x2d4ce1['offset']=qs['offset'](_0x1e4e0e[_0xd52a('0x32')][_0xd52a('0x20')]);}_0x2d4ce1['order']=qs['sort'](_0x1e4e0e[_0xd52a('0x32')][_0xd52a('0x3b')]);_0x2d4ce1[_0xd52a('0x3c')]=qs[_0xd52a('0x34')](_[_0xd52a('0x3d')](_0x1e4e0e[_0xd52a('0x32')],_0x436de3[_0xd52a('0x34')]),_0x515068);if(_0x1e4e0e['query'][_0xd52a('0x3e')]){_0x2d4ce1[_0xd52a('0x3c')]=_['merge'](_0x2d4ce1['where'],{'$or':_['map'](_0x515068,function(_0x4f2129){if(_0x4f2129['type']!=='VIRTUAL'){var _0x5b9745={};_0x5b9745[_0x4f2129[_0xd52a('0x2c')]]={'$like':'%'+_0x1e4e0e[_0xd52a('0x32')][_0xd52a('0x3e')]+'%'};return _0x5b9745;}})});}_0x2d4ce1=_['merge']({},_0x2d4ce1,_0x1e4e0e[_0xd52a('0x3f')]);var _0x55c4e0={'where':_0x2d4ce1[_0xd52a('0x3c')]};return db[_0xd52a('0x30')][_0xd52a('0x1f')](_0x55c4e0)['then'](function(_0x296d1a){_0x5dd24c[_0xd52a('0x1f')]=_0x296d1a;if(_0x1e4e0e[_0xd52a('0x32')]['includeAll']){_0x2d4ce1[_0xd52a('0x40')]=[{'all':!![]}];}return db[_0xd52a('0x30')][_0xd52a('0x41')](_0x2d4ce1);})[_0xd52a('0x26')](function(_0xa86bab){_0x5dd24c['rows']=_0xa86bab;return _0x5dd24c;})[_0xd52a('0x26')](respondWithFilteredResult(_0x4ad3e4,_0x2d4ce1))[_0xd52a('0x42')](handleError(_0x4ad3e4,null));};exports[_0xd52a('0x43')]=function(_0x16f4cc,_0x4015f8){var _0x266aca={'raw':![],'where':{'id':_0x16f4cc['params']['id']}},_0x50d0cb={};_0x50d0cb[_0xd52a('0x36')]=_[_0xd52a('0x33')](db[_0xd52a('0x30')][_0xd52a('0x44')]);_0x50d0cb[_0xd52a('0x32')]=_[_0xd52a('0x33')](_0x16f4cc[_0xd52a('0x32')]);_0x50d0cb[_0xd52a('0x34')]=_[_0xd52a('0x35')](_0x50d0cb[_0xd52a('0x36')],_0x50d0cb[_0xd52a('0x32')]);_0x266aca[_0xd52a('0x37')]=_[_0xd52a('0x35')](_0x50d0cb[_0xd52a('0x36')],qs[_0xd52a('0x38')](_0x16f4cc[_0xd52a('0x32')][_0xd52a('0x38')]));_0x266aca[_0xd52a('0x37')]=_0x266aca[_0xd52a('0x37')][_0xd52a('0x45')]?_0x266aca[_0xd52a('0x37')]:_0x50d0cb[_0xd52a('0x36')];if(_0x16f4cc[_0xd52a('0x32')]['includeAll']){_0x266aca['include']=[{'all':!![]}];}_0x266aca=_[_0xd52a('0x46')]({},_0x266aca,_0x16f4cc[_0xd52a('0x3f')]);return db[_0xd52a('0x30')][_0xd52a('0x47')](_0x266aca)[_0xd52a('0x26')](handleEntityNotFound(_0x4015f8,null))[_0xd52a('0x26')](respondWithResult(_0x4015f8,null))[_0xd52a('0x42')](handleError(_0x4015f8,null));};exports['create']=function(_0x5deec,_0x3999a7){return db[_0xd52a('0x30')]['create'](_0x5deec[_0xd52a('0x48')],{})[_0xd52a('0x26')](function(_0x3446d8){var _0x1f33e4=_0x5deec[_0xd52a('0x49')]['get']({'plain':!![]});if(!_0x1f33e4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f33e4[_0xd52a('0x4a')]===_0xd52a('0x49')){var _0x52e2a6=_0x3446d8[_0xd52a('0x28')]({'plain':!![]});var _0xf82382=_0xd52a('0x29');return db['UserProfileSection'][_0xd52a('0x47')]({'where':{'name':_0xf82382,'userProfileId':_0x1f33e4['userProfileId']},'raw':!![]})[_0xd52a('0x26')](function(_0x1e02f0){if(_0x1e02f0&&_0x1e02f0[_0xd52a('0x4b')]===0x0){return db['UserProfileResource'][_0xd52a('0x4c')]({'name':_0x52e2a6[_0xd52a('0x2c')],'resourceId':_0x52e2a6['id'],'type':_0x1e02f0[_0xd52a('0x2c')],'sectionId':_0x1e02f0['id']},{})[_0xd52a('0x26')](function(){return _0x3446d8;});}else{return _0x3446d8;}})['catch'](function(_0x3c3672){logger[_0xd52a('0x2a')](_0xd52a('0x4d'),_0x3c3672);throw _0x3c3672;});}return _0x3446d8;})['then'](respondWithResult(_0x3999a7,0xc9))['catch'](handleError(_0x3999a7,null));};exports[_0xd52a('0x25')]=function(_0x1244aa,_0x507af0){if(_0x1244aa[_0xd52a('0x48')]['id']){delete _0x1244aa[_0xd52a('0x48')]['id'];}return db['Trigger'][_0xd52a('0x47')]({'where':{'id':_0x1244aa[_0xd52a('0x4e')]['id']}})[_0xd52a('0x26')](handleEntityNotFound(_0x507af0,null))[_0xd52a('0x26')](saveUpdates(_0x1244aa[_0xd52a('0x48')],null))[_0xd52a('0x26')](respondWithResult(_0x507af0,null))['catch'](handleError(_0x507af0,null));};exports[_0xd52a('0x27')]=function(_0x1e75fa,_0x226430){return db[_0xd52a('0x30')]['find']({'where':{'id':_0x1e75fa[_0xd52a('0x4e')]['id']}})[_0xd52a('0x26')](handleEntityNotFound(_0x226430,null))[_0xd52a('0x26')](removeEntity(_0x226430,null))[_0xd52a('0x42')](handleError(_0x226430,null));};exports['addAllCondition']=function(_0x517432,_0x122112,_0xc0018f){if(_0x517432[_0xd52a('0x48')]['id']){delete _0x517432['body']['id'];}return db[_0xd52a('0x30')][_0xd52a('0x47')]({'where':{'id':_0x517432[_0xd52a('0x4e')]['id']}})[_0xd52a('0x26')](handleEntityNotFound(_0x122112,null))[_0xd52a('0x26')](function(_0x3590fb){if(_0x3590fb){_0x517432['body']['TriggerAllId']=_0x3590fb['id'];return db[_0xd52a('0x4f')][_0xd52a('0x4c')](_0x517432[_0xd52a('0x48')]);}})[_0xd52a('0x26')](respondWithResult(_0x122112,null))[_0xd52a('0x42')](handleError(_0x122112,null));};exports[_0xd52a('0x50')]=function(_0x2297a4,_0x346d72,_0x561673){if(_0x2297a4[_0xd52a('0x48')]['id']){delete _0x2297a4[_0xd52a('0x48')]['id'];}return db[_0xd52a('0x30')][_0xd52a('0x47')]({'where':{'id':_0x2297a4[_0xd52a('0x4e')]['id']}})[_0xd52a('0x26')](handleEntityNotFound(_0x346d72,null))[_0xd52a('0x26')](function(_0x56e5a0){if(_0x56e5a0){_0x2297a4[_0xd52a('0x48')][_0xd52a('0x51')]=_0x56e5a0['id'];return db[_0xd52a('0x4f')][_0xd52a('0x4c')](_0x2297a4[_0xd52a('0x48')]);}})[_0xd52a('0x26')](respondWithResult(_0x346d72,null))[_0xd52a('0x42')](handleError(_0x346d72,null));};exports[_0xd52a('0x52')]=function(_0x12d36e,_0x260842,_0x12724a){var _0x516ed4={};var _0x208861={};var _0x180352;var _0x522647;return db['Trigger']['findOne']({'where':{'id':_0x12d36e['params']['id']}})[_0xd52a('0x26')](handleEntityNotFound(_0x260842,null))['then'](function(_0x4a18ae){if(_0x4a18ae){_0x180352=_0x4a18ae;_0x208861[_0xd52a('0x36')]=_[_0xd52a('0x33')](db[_0xd52a('0x4f')][_0xd52a('0x44')]);_0x208861[_0xd52a('0x32')]=_['keys'](_0x12d36e[_0xd52a('0x32')]);_0x208861[_0xd52a('0x34')]=_['intersection'](_0x208861[_0xd52a('0x36')],_0x208861[_0xd52a('0x32')]);_0x516ed4['attributes']=_['intersection'](_0x208861[_0xd52a('0x36')],qs[_0xd52a('0x38')](_0x12d36e[_0xd52a('0x32')][_0xd52a('0x38')]));_0x516ed4['attributes']=_0x516ed4[_0xd52a('0x37')][_0xd52a('0x45')]?_0x516ed4[_0xd52a('0x37')]:_0x208861[_0xd52a('0x36')];_0x516ed4[_0xd52a('0x53')]=qs['sort'](_0x12d36e['query']['sort']);_0x516ed4[_0xd52a('0x3c')]=qs['filters'](_[_0xd52a('0x3d')](_0x12d36e[_0xd52a('0x32')],_0x208861[_0xd52a('0x34')]));if(_0x12d36e['query']['filter']){_0x516ed4[_0xd52a('0x3c')]=_[_0xd52a('0x46')](_0x516ed4[_0xd52a('0x3c')],{'$or':_[_0xd52a('0x2f')](_0x516ed4[_0xd52a('0x37')],function(_0x13e217){var _0x117bc9={};_0x117bc9[_0x13e217]={'$like':'%'+_0x12d36e[_0xd52a('0x32')]['filter']+'%'};return _0x117bc9;})});}_0x516ed4=_[_0xd52a('0x46')]({},_0x516ed4,_0x12d36e['options']);return _0x180352[_0xd52a('0x52')](_0x516ed4);}})[_0xd52a('0x26')](function(_0x224230){if(_0x224230){_0x522647=_0x224230[_0xd52a('0x45')];if(!_0x12d36e['query'][_0xd52a('0x39')](_0xd52a('0x3a'))){_0x516ed4[_0xd52a('0x21')]=qs[_0xd52a('0x21')](_0x12d36e[_0xd52a('0x32')][_0xd52a('0x21')]);_0x516ed4[_0xd52a('0x20')]=qs[_0xd52a('0x20')](_0x12d36e[_0xd52a('0x32')]['offset']);}return _0x180352[_0xd52a('0x52')](_0x516ed4);}})['then'](function(_0x31eb4e){if(_0x31eb4e){return _0x31eb4e?{'count':_0x522647,'rows':_0x31eb4e}:null;}})['then'](respondWithResult(_0x260842,null))[_0xd52a('0x42')](handleError(_0x260842,null));};exports[_0xd52a('0x54')]=function(_0x675baf,_0x13b197,_0x38d557){var _0x4f58b2={};var _0x3076f5={};var _0xd6b297;var _0x11883f;return db['Trigger'][_0xd52a('0x55')]({'where':{'id':_0x675baf['params']['id']}})[_0xd52a('0x26')](handleEntityNotFound(_0x13b197,null))['then'](function(_0x19b616){if(_0x19b616){_0xd6b297=_0x19b616;_0x3076f5[_0xd52a('0x36')]=_[_0xd52a('0x33')](db['Condition'][_0xd52a('0x44')]);_0x3076f5[_0xd52a('0x32')]=_['keys'](_0x675baf[_0xd52a('0x32')]);_0x3076f5[_0xd52a('0x34')]=_[_0xd52a('0x35')](_0x3076f5[_0xd52a('0x36')],_0x3076f5[_0xd52a('0x32')]);_0x4f58b2[_0xd52a('0x37')]=_[_0xd52a('0x35')](_0x3076f5[_0xd52a('0x36')],qs['fields'](_0x675baf[_0xd52a('0x32')]['fields']));_0x4f58b2[_0xd52a('0x37')]=_0x4f58b2['attributes'][_0xd52a('0x45')]?_0x4f58b2['attributes']:_0x3076f5[_0xd52a('0x36')];_0x4f58b2[_0xd52a('0x53')]=qs[_0xd52a('0x3b')](_0x675baf[_0xd52a('0x32')]['sort']);_0x4f58b2[_0xd52a('0x3c')]=qs[_0xd52a('0x34')](_['pick'](_0x675baf[_0xd52a('0x32')],_0x3076f5['filters']));if(_0x675baf[_0xd52a('0x32')][_0xd52a('0x3e')]){_0x4f58b2[_0xd52a('0x3c')]=_[_0xd52a('0x46')](_0x4f58b2[_0xd52a('0x3c')],{'$or':_[_0xd52a('0x2f')](_0x4f58b2[_0xd52a('0x37')],function(_0x165a04){var _0x1dd15a={};_0x1dd15a[_0x165a04]={'$like':'%'+_0x675baf[_0xd52a('0x32')][_0xd52a('0x3e')]+'%'};return _0x1dd15a;})});}_0x4f58b2=_['merge']({},_0x4f58b2,_0x675baf['options']);return _0xd6b297['getAnyConditions'](_0x4f58b2);}})[_0xd52a('0x26')](function(_0x4f9de5){if(_0x4f9de5){_0x11883f=_0x4f9de5[_0xd52a('0x45')];if(!_0x675baf['query'][_0xd52a('0x39')](_0xd52a('0x3a'))){_0x4f58b2[_0xd52a('0x21')]=qs['limit'](_0x675baf[_0xd52a('0x32')][_0xd52a('0x21')]);_0x4f58b2[_0xd52a('0x20')]=qs[_0xd52a('0x20')](_0x675baf[_0xd52a('0x32')][_0xd52a('0x20')]);}return _0xd6b297[_0xd52a('0x54')](_0x4f58b2);}})[_0xd52a('0x26')](function(_0x5102aa){if(_0x5102aa){return _0x5102aa?{'count':_0x11883f,'rows':_0x5102aa}:null;}})['then'](respondWithResult(_0x13b197,null))[_0xd52a('0x42')](handleError(_0x13b197,null));};exports['addAction']=function(_0x4cc4bd,_0x4f7629,_0x1ef335){if(_0x4cc4bd[_0xd52a('0x48')]['id']){delete _0x4cc4bd[_0xd52a('0x48')]['id'];}return db[_0xd52a('0x30')]['find']({'where':{'id':_0x4cc4bd[_0xd52a('0x4e')]['id']}})[_0xd52a('0x26')](handleEntityNotFound(_0x4f7629,null))[_0xd52a('0x26')](function(_0x16f6e8){if(_0x16f6e8){_0x4cc4bd[_0xd52a('0x48')][_0xd52a('0x56')]=_0x16f6e8['id'];return db[_0xd52a('0x57')][_0xd52a('0x4c')](_0x4cc4bd['body']);}})['then'](respondWithResult(_0x4f7629,null))[_0xd52a('0x42')](handleError(_0x4f7629,null));};exports[_0xd52a('0x58')]=function(_0x2270ca,_0x2665f4,_0x212a81){var _0x35b8d1={};var _0x4f31a6={};var _0x82fb31;var _0x5d7549;return db[_0xd52a('0x30')][_0xd52a('0x55')]({'where':{'id':_0x2270ca[_0xd52a('0x4e')]['id']}})[_0xd52a('0x26')](handleEntityNotFound(_0x2665f4,null))[_0xd52a('0x26')](function(_0x381bf4){if(_0x381bf4){_0x82fb31=_0x381bf4;_0x4f31a6[_0xd52a('0x36')]=_[_0xd52a('0x33')](db[_0xd52a('0x57')][_0xd52a('0x44')]);_0x4f31a6[_0xd52a('0x32')]=_[_0xd52a('0x33')](_0x2270ca['query']);_0x4f31a6[_0xd52a('0x34')]=_[_0xd52a('0x35')](_0x4f31a6['model'],_0x4f31a6[_0xd52a('0x32')]);_0x35b8d1[_0xd52a('0x37')]=_[_0xd52a('0x35')](_0x4f31a6[_0xd52a('0x36')],qs['fields'](_0x2270ca[_0xd52a('0x32')]['fields']));_0x35b8d1[_0xd52a('0x37')]=_0x35b8d1['attributes'][_0xd52a('0x45')]?_0x35b8d1['attributes']:_0x4f31a6[_0xd52a('0x36')];_0x35b8d1[_0xd52a('0x53')]=qs[_0xd52a('0x3b')](_0x2270ca[_0xd52a('0x32')]['sort']);_0x35b8d1[_0xd52a('0x3c')]=qs[_0xd52a('0x34')](_['pick'](_0x2270ca[_0xd52a('0x32')],_0x4f31a6[_0xd52a('0x34')]));if(_0x2270ca['query'][_0xd52a('0x3e')]){_0x35b8d1[_0xd52a('0x3c')]=_[_0xd52a('0x46')](_0x35b8d1[_0xd52a('0x3c')],{'$or':_[_0xd52a('0x2f')](_0x35b8d1['attributes'],function(_0x39aac2){var _0x59026d={};_0x59026d[_0x39aac2]={'$like':'%'+_0x2270ca['query']['filter']+'%'};return _0x59026d;})});}_0x35b8d1=_['merge']({},_0x35b8d1,_0x2270ca['options']);return _0x82fb31['getActions'](_0x35b8d1);}})['then'](function(_0x17280a){if(_0x17280a){_0x5d7549=_0x17280a['length'];if(!_0x2270ca[_0xd52a('0x32')][_0xd52a('0x39')](_0xd52a('0x3a'))){_0x35b8d1[_0xd52a('0x21')]=qs[_0xd52a('0x21')](_0x2270ca[_0xd52a('0x32')][_0xd52a('0x21')]);_0x35b8d1['offset']=qs[_0xd52a('0x20')](_0x2270ca[_0xd52a('0x32')][_0xd52a('0x20')]);}return _0x82fb31[_0xd52a('0x58')](_0x35b8d1);}})[_0xd52a('0x26')](function(_0x2e9890){if(_0x2e9890){return _0x2e9890?{'count':_0x5d7549,'rows':_0x2e9890}:null;}})[_0xd52a('0x26')](respondWithResult(_0x2665f4,null))[_0xd52a('0x42')](handleError(_0x2665f4,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 05b94d5..c7248a5 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 _0x2ec6=['bluebird','request-promise','path','rimraf','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','../../config/logger','api','moment'];(function(_0x2d7799,_0x5bcf4a){var _0x38d4a2=function(_0x564800){while(--_0x564800){_0x2d7799['push'](_0x2d7799['shift']());}};_0x38d4a2(++_0x5bcf4a);}(_0x2ec6,0xd9));var _0x62ec=function(_0x5886c9,_0x494294){_0x5886c9=_0x5886c9-0x0;var _0x181b61=_0x2ec6[_0x5886c9];return _0x181b61;};'use strict';var _=require(_0x62ec('0x0'));var util=require('util');var logger=require(_0x62ec('0x1'))(_0x62ec('0x2'));var moment=require(_0x62ec('0x3'));var BPromise=require(_0x62ec('0x4'));var rp=require(_0x62ec('0x5'));var fs=require('fs');var path=require(_0x62ec('0x6'));var rimraf=require(_0x62ec('0x7'));var config=require('../../config/environment');var attributes=require(_0x62ec('0x8'));module[_0x62ec('0x9')]=function(_0x5b068f,_0x3ac022){return _0x5b068f[_0x62ec('0xa')](_0x62ec('0xb'),attributes,{'tableName':_0x62ec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb40f=['path','rimraf','../../config/environment','define','lodash','../../config/logger','api','moment','request-promise'];(function(_0xe5855d,_0xaa2bb1){var _0xe994b5=function(_0x137970){while(--_0x137970){_0xe5855d['push'](_0xe5855d['shift']());}};_0xe994b5(++_0xaa2bb1);}(_0xb40f,0x148));var _0xfb40=function(_0x3f2228,_0x3b27d5){_0x3f2228=_0x3f2228-0x0;var _0x285ae4=_0xb40f[_0x3f2228];return _0x285ae4;};'use strict';var _=require(_0xfb40('0x0'));var util=require('util');var logger=require(_0xfb40('0x1'))(_0xfb40('0x2'));var moment=require(_0xfb40('0x3'));var BPromise=require('bluebird');var rp=require(_0xfb40('0x4'));var fs=require('fs');var path=require(_0xfb40('0x5'));var rimraf=require(_0xfb40('0x6'));var config=require(_0xfb40('0x7'));var attributes=require('./trigger.attributes');module['exports']=function(_0x118634,_0x44fb85){return _0x118634[_0xfb40('0x8')]('Trigger',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 747ef32..f9d5cf2 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 _0x3f8c=['jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTrigger','Trigger','findAll','options','where','attributes','limit','include','map','model','debug','catch','find','raw','ShowTrigger','moment','bluebird','randomstring','ioredis'];(function(_0x4bacb6,_0x2b299d){var _0x58c029=function(_0x2faaf5){while(--_0x2faaf5){_0x4bacb6['push'](_0x4bacb6['shift']());}};_0x58c029(++_0x2b299d);}(_0x3f8c,0x104));var _0xc3f8=function(_0x4c32dd,_0x381d6c){_0x4c32dd=_0x4c32dd-0x0;var _0x43e569=_0x3f8c[_0x4c32dd];return _0x43e569;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3f8('0x0'));var BPromise=require(_0xc3f8('0x1'));var rs=require(_0xc3f8('0x2'));var fs=require('fs');var Redis=require(_0xc3f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc3f8('0x4'));var client=jayson[_0xc3f8('0x5')][_0xc3f8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x44c25d,_0x2bbaa5,_0x15512a){return new BPromise(function(_0x51093a,_0x28397e){return client[_0xc3f8('0x7')](_0x44c25d,_0x15512a)[_0xc3f8('0x8')](function(_0x3c340c){logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));logger['debug'](_0xc3f8('0xc'),_0x2bbaa5,_0xc3f8('0xb'),JSON[_0xc3f8('0xd')](_0x3c340c));if(_0x3c340c[_0xc3f8('0xe')]){if(_0x3c340c['error'][_0xc3f8('0xf')]===0x1f4){logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')]['message']);return _0x28397e(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);return _0x51093a(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}else{logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));_0x51093a(_0x3c340c[_0xc3f8('0x11')][_0xc3f8('0x10')]);}})['catch'](function(_0x14b3ed){logger['error']('Trigger,\x20%s,\x20%s',_0x2bbaa5,_0x14b3ed);_0x28397e(_0x14b3ed);});});}exports[_0xc3f8('0x12')]=function(_0x2e7c0f){var _0x35500f=this;return new Promise(function(_0xb4ab67,_0x47a185){return db[_0xc3f8('0x13')][_0xc3f8('0x14')]({'raw':_0x2e7c0f['options']?_0x2e7c0f[_0xc3f8('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f[_0xc3f8('0x15')][_0xc3f8('0x16')]||null:null,'attributes':_0x2e7c0f['options']?_0x2e7c0f['options'][_0xc3f8('0x17')]||null:null,'limit':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f[_0xc3f8('0x15')][_0xc3f8('0x18')]||null:null,'include':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f[_0xc3f8('0x15')][_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x2e7c0f['options']['include'],function(_0x4b83f0){return{'model':db[_0x4b83f0[_0xc3f8('0x1b')]],'as':_0x4b83f0['as'],'attributes':_0x4b83f0['attributes'],'include':_0x4b83f0[_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x4b83f0['include'],function(_0x4569c2){return{'model':db[_0x4569c2[_0xc3f8('0x1b')]],'as':_0x4569c2['as'],'attributes':_0x4569c2[_0xc3f8('0x17')],'include':_0x4569c2[_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x4569c2[_0xc3f8('0x19')],function(_0xf1d460){return{'model':db[_0xf1d460[_0xc3f8('0x1b')]],'as':_0xf1d460['as'],'attributes':_0xf1d460[_0xc3f8('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc3f8('0x8')](function(_0x22c8e6){logger[_0xc3f8('0x9')](_0xc3f8('0x12'),_0x2e7c0f);logger[_0xc3f8('0x1c')]('GetTrigger',_0x2e7c0f,JSON[_0xc3f8('0xd')](_0x22c8e6));_0xb4ab67(_0x22c8e6);})[_0xc3f8('0x1d')](function(_0x218029){logger['error'](_0xc3f8('0x12'),_0x218029['message'],_0x2e7c0f);_0x47a185(_0x35500f[_0xc3f8('0xe')](0x1f4,_0x218029[_0xc3f8('0x10')]));});});};exports['ShowTrigger']=function(_0x48b32e){var _0x21a225=this;return new Promise(function(_0x25df65,_0xd32b09){return db[_0xc3f8('0x13')][_0xc3f8('0x1e')]({'raw':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')][_0xc3f8('0x1f')]===undefined?!![]:![]:!![],'where':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')]['where']||null:null,'attributes':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')][_0xc3f8('0x17')]||null:null,'include':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')]['include']?_['map'](_0x48b32e[_0xc3f8('0x15')][_0xc3f8('0x19')],function(_0x76ef00){return{'model':db[_0x76ef00[_0xc3f8('0x1b')]],'as':_0x76ef00['as'],'attributes':_0x76ef00[_0xc3f8('0x17')],'include':_0x76ef00['include']?_[_0xc3f8('0x1a')](_0x76ef00[_0xc3f8('0x19')],function(_0x2ba6aa){return{'model':db[_0x2ba6aa['model']],'as':_0x2ba6aa['as'],'attributes':_0x2ba6aa[_0xc3f8('0x17')],'include':_0x2ba6aa[_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x2ba6aa['include'],function(_0x21a725){return{'model':db[_0x21a725[_0xc3f8('0x1b')]],'as':_0x21a725['as'],'attributes':_0x21a725['attributes']};}):[]};}):[]};}):[]:[]})[_0xc3f8('0x8')](function(_0x84d5d2){logger[_0xc3f8('0x9')](_0xc3f8('0x20'),_0x48b32e);logger[_0xc3f8('0x1c')](_0xc3f8('0x20'),_0x48b32e,JSON['stringify'](_0x84d5d2));_0x25df65(_0x84d5d2);})[_0xc3f8('0x1d')](function(_0x2e4880){logger[_0xc3f8('0xe')](_0xc3f8('0x20'),_0x2e4880[_0xc3f8('0x10')],_0x48b32e);_0xd32b09(_0x21a225['error'](0x1f4,_0x2e4880[_0xc3f8('0x10')]));});});}; \ No newline at end of file +var _0x97c1=['error','message','result','catch','Trigger','findAll','options','raw','attributes','limit','include','map','model','then','GetTrigger','debug','find','where','ShowTrigger','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4eaace,_0x314251){var _0x52e9a3=function(_0xce013f){while(--_0xce013f){_0x4eaace['push'](_0x4eaace['shift']());}};_0x52e9a3(++_0x314251);}(_0x97c1,0xdf));var _0x197c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x97c1[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var moment=require('moment');var BPromise=require(_0x197c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x197c('0x3'))['db'];var utils=require(_0x197c('0x4'));var logger=require(_0x197c('0x5'))(_0x197c('0x6'));var config=require(_0x197c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x197c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x437214,_0x60fab2,_0xfcee35){return new BPromise(function(_0x5cf5cb,_0x5d42c5){return client[_0x197c('0x9')](_0x437214,_0xfcee35)['then'](function(_0x339fab){logger[_0x197c('0xa')](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));logger['debug'](_0x197c('0xd'),_0x60fab2,_0x197c('0xc'),JSON[_0x197c('0xe')](_0x339fab));if(_0x339fab[_0x197c('0xf')]){if(_0x339fab[_0x197c('0xf')]['code']===0x1f4){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5d42c5(_0x339fab['error'][_0x197c('0x10')]);}logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5cf5cb(_0x339fab[_0x197c('0xf')]['message']);}else{logger['info'](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));_0x5cf5cb(_0x339fab[_0x197c('0x11')][_0x197c('0x10')]);}})[_0x197c('0x12')](function(_0x7e302f){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x7e302f);_0x5d42c5(_0x7e302f);});});}exports['GetTrigger']=function(_0x372311){var _0x47aaa9=this;return new Promise(function(_0x50ac52,_0x1725d9){return db[_0x197c('0x13')][_0x197c('0x14')]({'raw':_0x372311[_0x197c('0x15')]?_0x372311['options'][_0x197c('0x16')]===undefined?!![]:![]:!![],'where':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')]['where']||null:null,'attributes':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')][_0x197c('0x17')]||null:null,'limit':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')][_0x197c('0x18')]||null:null,'include':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')][_0x197c('0x19')]?_[_0x197c('0x1a')](_0x372311[_0x197c('0x15')][_0x197c('0x19')],function(_0x174942){return{'model':db[_0x174942[_0x197c('0x1b')]],'as':_0x174942['as'],'attributes':_0x174942[_0x197c('0x17')],'include':_0x174942[_0x197c('0x19')]?_['map'](_0x174942[_0x197c('0x19')],function(_0x2911dd){return{'model':db[_0x2911dd[_0x197c('0x1b')]],'as':_0x2911dd['as'],'attributes':_0x2911dd['attributes'],'include':_0x2911dd[_0x197c('0x19')]?_[_0x197c('0x1a')](_0x2911dd['include'],function(_0x5e7bc9){return{'model':db[_0x5e7bc9[_0x197c('0x1b')]],'as':_0x5e7bc9['as'],'attributes':_0x5e7bc9['attributes']};}):[]};}):[]};}):[]:[]})[_0x197c('0x1c')](function(_0x14b0aa){logger[_0x197c('0xa')](_0x197c('0x1d'),_0x372311);logger[_0x197c('0x1e')](_0x197c('0x1d'),_0x372311,JSON[_0x197c('0xe')](_0x14b0aa));_0x50ac52(_0x14b0aa);})[_0x197c('0x12')](function(_0x4422d1){logger['error']('GetTrigger',_0x4422d1['message'],_0x372311);_0x1725d9(_0x47aaa9['error'](0x1f4,_0x4422d1[_0x197c('0x10')]));});});};exports['ShowTrigger']=function(_0x252cde){var _0x35dbf3=this;return new Promise(function(_0x58bc60,_0x422ac6){return db['Trigger'][_0x197c('0x1f')]({'raw':_0x252cde[_0x197c('0x15')]?_0x252cde[_0x197c('0x15')][_0x197c('0x16')]===undefined?!![]:![]:!![],'where':_0x252cde[_0x197c('0x15')]?_0x252cde[_0x197c('0x15')][_0x197c('0x20')]||null:null,'attributes':_0x252cde[_0x197c('0x15')]?_0x252cde[_0x197c('0x15')]['attributes']||null:null,'include':_0x252cde['options']?_0x252cde[_0x197c('0x15')][_0x197c('0x19')]?_[_0x197c('0x1a')](_0x252cde[_0x197c('0x15')][_0x197c('0x19')],function(_0x1cb7e8){return{'model':db[_0x1cb7e8[_0x197c('0x1b')]],'as':_0x1cb7e8['as'],'attributes':_0x1cb7e8['attributes'],'include':_0x1cb7e8['include']?_[_0x197c('0x1a')](_0x1cb7e8[_0x197c('0x19')],function(_0x4d085b){return{'model':db[_0x4d085b['model']],'as':_0x4d085b['as'],'attributes':_0x4d085b[_0x197c('0x17')],'include':_0x4d085b[_0x197c('0x19')]?_[_0x197c('0x1a')](_0x4d085b[_0x197c('0x19')],function(_0x45095c){return{'model':db[_0x45095c[_0x197c('0x1b')]],'as':_0x45095c['as'],'attributes':_0x45095c[_0x197c('0x17')]};}):[]};}):[]};}):[]:[]})[_0x197c('0x1c')](function(_0x44ce68){logger['info'](_0x197c('0x21'),_0x252cde);logger[_0x197c('0x1e')](_0x197c('0x21'),_0x252cde,JSON[_0x197c('0xe')](_0x44ce68));_0x58bc60(_0x44ce68);})[_0x197c('0x12')](function(_0x151e2f){logger['error'](_0x197c('0x21'),_0x151e2f[_0x197c('0x10')],_0x252cde);_0x422ac6(_0x35dbf3[_0x197c('0xf')](0x1f4,_0x151e2f['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index f8cbf33..b6f5673 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 _0x7217=['./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1e5e11,_0x2d9817){var _0x33a9d6=function(_0x4b5681){while(--_0x4b5681){_0x1e5e11['push'](_0x1e5e11['shift']());}};_0x33a9d6(++_0x2d9817);}(_0x7217,0x19e));var _0x7721=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x7217[_0x3ce3c];return _0x55a2c9;};'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')](_0x7721('0xd'),auth[_0x7721('0x8')](),controller[_0x7721('0xe')]);router[_0x7721('0xc')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['put'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x10')]);router[_0x7721('0x11')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x12')]);module[_0x7721('0x13')]=router; \ No newline at end of file +var _0x24ca=['put','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone','clone','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x24ca,0x1bc));var _0xa24c=function(_0x4695ba,_0x5a7f2a){_0x4695ba=_0x4695ba-0x0;var _0x524b7d=_0x24ca[_0x4695ba];return _0x524b7d;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var auth=require(_0xa24c('0x4'));var interaction=require(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var controller=require(_0xa24c('0x7'));router[_0xa24c('0x8')]('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xa')]);router[_0xa24c('0x8')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xc')]);router['post'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xe')]);router['post']('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xf')]);router[_0xa24c('0x10')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x11')]);router[_0xa24c('0x12')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller['destroy']);module[_0xa24c('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 3342446..9c63dbd 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 _0x9c04=['force_rport,comedia','setDataValue','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','never','INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','udp','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','auto','yes','nonat','update','outgoing'];(function(_0x1f2b44,_0x520cf3){var _0x4abbf0=function(_0x2f21fd){while(--_0x2f21fd){_0x1f2b44['push'](_0x1f2b44['shift']());}};_0x4abbf0(++_0x520cf3);}(_0x9c04,0x1bb));var _0x49c0=function(_0x272d8a,_0x45184b){_0x272d8a=_0x272d8a-0x0;var _0x26286e=_0x9c04[_0x272d8a];return _0x26286e;};'use strict';var Sequelize=require(_0x49c0('0x0'));module['exports']={'name':{'type':Sequelize[_0x49c0('0x1')],'allowNull':![],'unique':_0x49c0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x49c0('0x3')](_0x49c0('0x4'),_0x49c0('0x5'),_0x49c0('0x6')),'allowNull':![],'defaultValue':_0x49c0('0x4')},'context':{'type':Sequelize[_0x49c0('0x1')],'allowNull':![],'defaultValue':_0x49c0('0x7')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x49c0('0x8'),_0x49c0('0x9'),_0x49c0('0xa'),_0x49c0('0xb'),_0x49c0('0xc'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0x49c0('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x49c0('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x49c0('0x1')]},'transport':{'type':Sequelize[_0x49c0('0x1')],'defaultValue':_0x49c0('0xd'),'set':function(_0x26df30){this['setDataValue'](_0x49c0('0xe'),_0x26df30?_0x26df30['join'](','):null);},'get':function(){return this[_0x49c0('0xf')](_0x49c0('0xe'))?this[_0x49c0('0xf')](_0x49c0('0xe'))[_0x49c0('0x10')](','):null;},'comment':_0x49c0('0x11')},'dtmfmode':{'type':Sequelize[_0x49c0('0x3')]('rfc2833',_0x49c0('0x12'),_0x49c0('0x13'),'inband',_0x49c0('0x14')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x49c0('0x3')](_0x49c0('0x15'),'no',_0x49c0('0x16'),_0x49c0('0x17'),_0x49c0('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x49c0('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x49c0('0x1')]},'directmediadeny':{'type':Sequelize[_0x49c0('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x49c0('0x19'),'set':function(_0x10a212){this[_0x49c0('0x1a')](_0x49c0('0x1b'),_0x10a212?_0x10a212[_0x49c0('0x1c')](','):null);},'get':function(){return this[_0x49c0('0xf')](_0x49c0('0x1b'))?this['getDataValue'](_0x49c0('0x1b'))[_0x49c0('0x10')](','):null;},'comment':_0x49c0('0x1d')},'callgroup':{'type':Sequelize[_0x49c0('0x1')]},'namedcallgroup':{'type':Sequelize[_0x49c0('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x49c0('0x1')]},'language':{'type':Sequelize[_0x49c0('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x49c0('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x49c0('0x1')],'defaultValue':_0x49c0('0x1e')},'allow':{'type':Sequelize[_0x49c0('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x570b04){this[_0x49c0('0x1a')](_0x49c0('0x1f'),_0x570b04?_0x570b04[_0x49c0('0x1c')](';'):_0x49c0('0x20'));},'get':function(){return this['getDataValue'](_0x49c0('0x1f'))?this[_0x49c0('0xf')](_0x49c0('0x1f'))[_0x49c0('0x10')](';'):null;},'comment':_0x49c0('0x21')},'autoframing':{'type':Sequelize[_0x49c0('0x3')](_0x49c0('0x15'),'no')},'insecure':{'type':Sequelize[_0x49c0('0x1')],'defaultValue':'port,invite','set':function(_0x5b9e21){this[_0x49c0('0x1a')](_0x49c0('0x22'),_0x5b9e21?_0x5b9e21[_0x49c0('0x1c')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x49c0('0xf')](_0x49c0('0x22'))[_0x49c0('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x49c0('0x3')](_0x49c0('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x49c0('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x49c0('0x3')](_0x49c0('0x15'),'no',_0x49c0('0x23'))},'promiscredir':{'type':Sequelize[_0x49c0('0x3')](_0x49c0('0x15'),'no')},'useclientcode':{'type':Sequelize[_0x49c0('0x3')](_0x49c0('0x15'),'no')},'accountcode':{'type':Sequelize[_0x49c0('0x24')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x49c0('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x49c0('0x1')]},'callcounter':{'type':Sequelize[_0x49c0('0x3')](_0x49c0('0x15'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x49c0('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x49c0('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x49c0('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0x49c0('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize[_0x49c0('0x1')]},'template':{'type':Sequelize[_0x49c0('0x1')]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0x49c0('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x49c0('0x3')](_0x49c0('0x15'),'no')},'mailbox':{'type':Sequelize[_0x49c0('0x1')]},'session_timers':{'type':Sequelize[_0x49c0('0x3')](_0x49c0('0x26'),_0x49c0('0x27'),_0x49c0('0x28'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x49c0('0x29'),_0x49c0('0x2a')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x49c0('0x1')]},'regexten':{'type':Sequelize[_0x49c0('0x1')]},'fromdomain':{'type':Sequelize[_0x49c0('0x1')]},'fromuser':{'type':Sequelize[_0x49c0('0x1')]},'port':{'type':Sequelize[_0x49c0('0x24')](0x5)},'qualify':{'type':Sequelize[_0x49c0('0x3')](_0x49c0('0x15'),'no'),'defaultValue':_0x49c0('0x15')},'keepalive':{'type':Sequelize[_0x49c0('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x49c0('0x1')]},'defaultuser':{'type':Sequelize[_0x49c0('0x1')]},'rtptimeout':{'type':Sequelize[_0x49c0('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x49c0('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x49c0('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x49c0('0x3')](_0x49c0('0x15'),'no',_0x49c0('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x49c0('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x49c0('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x49c0('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x49c0('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x49c0('0x1')]},'use_q850_reason':{'type':Sequelize[_0x49c0('0x1')]},'maxforwards':{'type':Sequelize[_0x49c0('0x24')](0xb)},'encryption':{'type':Sequelize[_0x49c0('0x3')](_0x49c0('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x49c0('0x15'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x49c0('0x15'),'no')},'icesupport':{'type':Sequelize[_0x49c0('0x3')](_0x49c0('0x15'),'no')},'dtlsenable':{'type':Sequelize[_0x49c0('0x3')](_0x49c0('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0x49c0('0x3')]('yes','no',_0x49c0('0x2c'),_0x49c0('0x2d'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x49c0('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x49c0('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x49c0('0x1')]},'dtlscapath':{'type':Sequelize[_0x49c0('0x1')]},'dtlssetup':{'type':Sequelize[_0x49c0('0x3')](_0x49c0('0x2e'),_0x49c0('0x2f'),_0x49c0('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x49c0('0x1')]},'usereqphone':{'type':Sequelize[_0x49c0('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x49c0('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x49c0('0x15'),'no')},'subscribemwi':{'type':Sequelize[_0x49c0('0x3')](_0x49c0('0x15'),'no')},'vmexten':{'type':Sequelize[_0x49c0('0x1')]},'mohinterpret':{'type':Sequelize[_0x49c0('0x1')]},'mohsuggest':{'type':Sequelize[_0x49c0('0x1')]},'parkinglot':{'type':Sequelize[_0x49c0('0x1')]},'description':{'type':Sequelize[_0x49c0('0x1')]},'host':{'type':Sequelize[_0x49c0('0x1')],'defaultValue':_0x49c0('0x31')},'canreinvite':{'type':Sequelize[_0x49c0('0x3')](_0x49c0('0x15'),'no',_0x49c0('0x16'),_0x49c0('0x17'),_0x49c0('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x49c0('0x1')]},'otherFields':{'type':Sequelize[_0x49c0('0x1')]},'active':{'type':Sequelize[_0x49c0('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x49c0('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x5dfa=['split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','accept','refuse','originate','uac','uas','pai','active','passive','actpass','dynamic','nonat','BOOLEAN','sequelize','exports','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport'];(function(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0x5dfa,0x15f));var _0xa5df=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5dfa[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xa5df('0x0'));module[_0xa5df('0x1')]={'name':{'type':Sequelize[_0xa5df('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa5df('0x3')](_0xa5df('0x4'),_0xa5df('0x5'),_0xa5df('0x6')),'allowNull':![],'defaultValue':_0xa5df('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa5df('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0xa5df('0x8'),_0xa5df('0x9'),_0xa5df('0xa'),_0xa5df('0xb'),_0xa5df('0xc'),_0xa5df('0xd'),'PROHIB_FAILED_SCREEN',_0xa5df('0xe'))},'deny':{'type':Sequelize[_0xa5df('0x2')]},'permit':{'type':Sequelize[_0xa5df('0x2')]},'secret':{'type':Sequelize[_0xa5df('0x2')]},'md5secret':{'type':Sequelize[_0xa5df('0x2')]},'remotesecret':{'type':Sequelize[_0xa5df('0x2')]},'transport':{'type':Sequelize[_0xa5df('0x2')],'defaultValue':_0xa5df('0xf'),'set':function(_0x2d9d42){this[_0xa5df('0x10')]('transport',_0x2d9d42?_0x2d9d42[_0xa5df('0x11')](','):null);},'get':function(){return this[_0xa5df('0x12')]('transport')?this[_0xa5df('0x12')](_0xa5df('0x13'))[_0xa5df('0x14')](','):null;},'comment':_0xa5df('0x15')},'dtmfmode':{'type':Sequelize['ENUM'](_0xa5df('0x16'),_0xa5df('0x17'),'shortinfo',_0xa5df('0x18'),_0xa5df('0x19')),'defaultValue':_0xa5df('0x16')},'directmedia':{'type':Sequelize['ENUM'](_0xa5df('0x1a'),'no','nonat',_0xa5df('0x1b'),_0xa5df('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa5df('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xa5df('0x2')],'defaultValue':_0xa5df('0x1d'),'set':function(_0x2303f5){this[_0xa5df('0x10')](_0xa5df('0x1e'),_0x2303f5?_0x2303f5[_0xa5df('0x11')](','):null);},'get':function(){return this[_0xa5df('0x12')](_0xa5df('0x1e'))?this['getDataValue'](_0xa5df('0x1e'))[_0xa5df('0x14')](','):null;},'comment':_0xa5df('0x1f')},'callgroup':{'type':Sequelize[_0xa5df('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xa5df('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xa5df('0x2')]},'language':{'type':Sequelize[_0xa5df('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa5df('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xa5df('0x20')},'allow':{'type':Sequelize[_0xa5df('0x2')],'allowNull':![],'defaultValue':_0xa5df('0x21'),'set':function(_0x106704){this[_0xa5df('0x10')](_0xa5df('0x22'),_0x106704?_0x106704[_0xa5df('0x11')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xa5df('0x12')](_0xa5df('0x22'))?this[_0xa5df('0x12')](_0xa5df('0x22'))[_0xa5df('0x14')](';'):null;},'comment':_0xa5df('0x23')},'autoframing':{'type':Sequelize[_0xa5df('0x3')](_0xa5df('0x1a'),'no')},'insecure':{'type':Sequelize[_0xa5df('0x2')],'defaultValue':_0xa5df('0x24'),'set':function(_0x32a48e){this[_0xa5df('0x10')](_0xa5df('0x25'),_0x32a48e?_0x32a48e[_0xa5df('0x11')](','):null);},'get':function(){return this[_0xa5df('0x12')]('insecure')?this[_0xa5df('0x12')](_0xa5df('0x25'))[_0xa5df('0x14')](','):null;},'comment':_0xa5df('0x26')},'trustrpid':{'type':Sequelize['ENUM'](_0xa5df('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa5df('0x3')](_0xa5df('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xa5df('0x1a'),'no',_0xa5df('0x27'))},'promiscredir':{'type':Sequelize['ENUM'](_0xa5df('0x1a'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xa5df('0x1a'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa5df('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xa5df('0x2')]},'callcounter':{'type':Sequelize[_0xa5df('0x3')](_0xa5df('0x1a'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xa5df('0x28')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0xa5df('0x3')](_0xa5df('0x1a'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xa5df('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xa5df('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0xa5df('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xa5df('0x3')](_0xa5df('0x1a'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa5df('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xa5df('0x3')](_0xa5df('0x1a'),'no')},'mailbox':{'type':Sequelize[_0xa5df('0x2')]},'session_timers':{'type':Sequelize[_0xa5df('0x3')](_0xa5df('0x29'),_0xa5df('0x2a'),_0xa5df('0x2b'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xa5df('0x28')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xa5df('0x2c'),_0xa5df('0x2d')),'defaultValue':_0xa5df('0x2d')},'t38pt_usertpsource':{'type':Sequelize[_0xa5df('0x2')]},'regexten':{'type':Sequelize[_0xa5df('0x2')]},'fromdomain':{'type':Sequelize[_0xa5df('0x2')]},'fromuser':{'type':Sequelize[_0xa5df('0x2')]},'port':{'type':Sequelize[_0xa5df('0x28')](0x5)},'qualify':{'type':Sequelize[_0xa5df('0x3')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xa5df('0x28')](0xb)},'defaultip':{'type':Sequelize[_0xa5df('0x2')]},'defaultuser':{'type':Sequelize[_0xa5df('0x2')]},'rtptimeout':{'type':Sequelize[_0xa5df('0x28')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xa5df('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xa5df('0x28')](0xb)},'sendrpid':{'type':Sequelize[_0xa5df('0x3')](_0xa5df('0x1a'),'no',_0xa5df('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa5df('0x2')]},'callbackextension':{'type':Sequelize[_0xa5df('0x2')]},'timert1':{'type':Sequelize[_0xa5df('0x28')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xa5df('0x2')]},'contactdeny':{'type':Sequelize[_0xa5df('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xa5df('0x2')]},'use_q850_reason':{'type':Sequelize[_0xa5df('0x2')]},'maxforwards':{'type':Sequelize[_0xa5df('0x28')](0xb)},'encryption':{'type':Sequelize[_0xa5df('0x3')](_0xa5df('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xa5df('0x1a'),'no')},'force_avp':{'type':Sequelize[_0xa5df('0x3')](_0xa5df('0x1a'),'no')},'icesupport':{'type':Sequelize[_0xa5df('0x3')](_0xa5df('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0xa5df('0x3')](_0xa5df('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0xa5df('0x3')](_0xa5df('0x1a'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0xa5df('0x28')](0xb)},'dtlscertfile':{'type':Sequelize[_0xa5df('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xa5df('0x2')]},'dtlscipher':{'type':Sequelize[_0xa5df('0x2')]},'dtlscafile':{'type':Sequelize[_0xa5df('0x2')]},'dtlscapath':{'type':Sequelize[_0xa5df('0x2')]},'dtlssetup':{'type':Sequelize[_0xa5df('0x3')](_0xa5df('0x2f'),_0xa5df('0x30'),_0xa5df('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa5df('0x2')]},'usereqphone':{'type':Sequelize[_0xa5df('0x3')](_0xa5df('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa5df('0x2')]},'recordofffeature':{'type':Sequelize[_0xa5df('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xa5df('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0xa5df('0x3')](_0xa5df('0x1a'),'no')},'vmexten':{'type':Sequelize[_0xa5df('0x2')]},'mohinterpret':{'type':Sequelize[_0xa5df('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xa5df('0x2')]},'description':{'type':Sequelize[_0xa5df('0x2')]},'host':{'type':Sequelize[_0xa5df('0x2')],'defaultValue':_0xa5df('0x32')},'canreinvite':{'type':Sequelize[_0xa5df('0x3')](_0xa5df('0x1a'),'no',_0xa5df('0x33'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xa5df('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xa5df('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xa5df('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 14324bd..98c9cb2 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 _0xc9c6=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_registers.conf','update','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','send','map','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','options','find','clone','omit','body','createdAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','role'];(function(_0x5a9e9e,_0x3d1985){var _0x130841=function(_0x2bb557){while(--_0x2bb557){_0x5a9e9e['push'](_0x5a9e9e['shift']());}};_0x130841(++_0x3d1985);}(_0xc9c6,0x165));var _0x6c9c=function(_0x12363c,_0x464c7b){_0x12363c=_0x12363c-0x0;var _0x2ab2c2=_0xc9c6[_0x12363c];return _0x2ab2c2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6c9c('0x0'));var rimraf=require(_0x6c9c('0x1'));var zipdir=require(_0x6c9c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c9c('0x3'));var moment=require(_0x6c9c('0x4'));var BPromise=require(_0x6c9c('0x5'));var Mustache=require(_0x6c9c('0x6'));var util=require(_0x6c9c('0x7'));var path=require(_0x6c9c('0x8'));var sox=require(_0x6c9c('0x9'));var csv=require(_0x6c9c('0xa'));var ejs=require(_0x6c9c('0xb'));var fs=require('fs');var _=require(_0x6c9c('0xc'));var squel=require(_0x6c9c('0xd'));var crypto=require(_0x6c9c('0xe'));var jsforce=require(_0x6c9c('0xf'));var deskjs=require(_0x6c9c('0x10'));var toCsv=require(_0x6c9c('0xa'));var querystring=require(_0x6c9c('0x11'));var Papa=require(_0x6c9c('0x12'));var Redis=require(_0x6c9c('0x13'));var authService=require(_0x6c9c('0x14'));var qs=require(_0x6c9c('0x15'));var as=require(_0x6c9c('0x16'));var hardwareService=require(_0x6c9c('0x17'));var logger=require(_0x6c9c('0x18'))(_0x6c9c('0x19'));var utils=require(_0x6c9c('0x1a'));var config=require(_0x6c9c('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c9c('0x1c'))['db'];var jayson=require(_0x6c9c('0x1d'));var client=jayson[_0x6c9c('0x1e')][_0x6c9c('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3a0db7,_0x58ea17,_0x2ed95b,_0x16beeb){return new BPromise(function(_0x5efb4e,_0x3bca7a){var _0x4030da=_0x16beeb||client;return _0x4030da[_0x6c9c('0x20')](_0x3a0db7,_0x2ed95b)[_0x6c9c('0x21')](function(_0x5ce995){logger[_0x6c9c('0x22')](_0x6c9c('0x23'),_0x58ea17,_0x6c9c('0x24'));logger[_0x6c9c('0x25')](_0x6c9c('0x26'),_0x58ea17,_0x6c9c('0x24'),JSON[_0x6c9c('0x27')](_0x5ce995));if(_0x5ce995[_0x6c9c('0x28')]){if(_0x5ce995[_0x6c9c('0x28')][_0x6c9c('0x29')]===0x1f4){logger[_0x6c9c('0x28')](_0x6c9c('0x23'),_0x58ea17,_0x5ce995[_0x6c9c('0x28')]['message']);return _0x3bca7a(_0x5ce995[_0x6c9c('0x28')][_0x6c9c('0x2a')]);}logger[_0x6c9c('0x28')](_0x6c9c('0x23'),_0x58ea17,_0x5ce995[_0x6c9c('0x28')]['message']);return _0x5efb4e(_0x5ce995[_0x6c9c('0x28')][_0x6c9c('0x2a')]);}else{logger[_0x6c9c('0x22')](_0x6c9c('0x23'),_0x58ea17,_0x6c9c('0x24'));_0x5efb4e(_0x5ce995[_0x6c9c('0x2b')][_0x6c9c('0x2a')]);}})[_0x6c9c('0x2c')](function(_0x2c9251){logger[_0x6c9c('0x28')](_0x6c9c('0x23'),_0x58ea17,_0x2c9251);_0x3bca7a(_0x2c9251);});});}function respondWithStatusCode(_0x7e0df,_0x5a367f){_0x5a367f=_0x5a367f||0xcc;return function(_0x211f8f){if(_0x211f8f){return _0x7e0df[_0x6c9c('0x2d')](_0x5a367f);}return _0x7e0df['status'](_0x5a367f)[_0x6c9c('0x2e')]();};}function respondWithResult(_0x184479,_0x3638e7){_0x3638e7=_0x3638e7||0xc8;return function(_0x49fd2b){if(_0x49fd2b){return _0x184479[_0x6c9c('0x2f')](_0x3638e7)[_0x6c9c('0x30')](_0x49fd2b);}};}function respondWithFilteredResult(_0x623042,_0x2a2eaa){return function(_0x3143e7){if(_0x3143e7){var _0xfd6198=_0x3143e7[_0x6c9c('0x31')],_0x281dc7=_0x2a2eaa['offset'],_0x35ce95=_0x2a2eaa[_0x6c9c('0x32')]+_0x2a2eaa[_0x6c9c('0x33')],_0x1fb6be;if(_0x35ce95>=_0xfd6198){_0x35ce95=_0xfd6198;_0x1fb6be=0xc8;}else{_0x1fb6be=0xce;}_0x623042[_0x6c9c('0x2f')](_0x1fb6be);return _0x623042[_0x6c9c('0x34')](_0x6c9c('0x35'),_0x281dc7+'-'+_0x35ce95+'/'+_0xfd6198)['json'](_0x3143e7);}return null;};}function patchUpdates(_0x56c902){return function(_0x354b55){try{jsonpatch[_0x6c9c('0x36')](_0x354b55,_0x56c902,!![]);}catch(_0x1b9466){return BPromise[_0x6c9c('0x37')](_0x1b9466);}return _0x354b55[_0x6c9c('0x38')]();};}function saveUpdates(_0x2db0f2,_0x4dc09d){return function(_0x253feb){if(_0x253feb){return _0x253feb['update'](_0x2db0f2)[_0x6c9c('0x21')](function(_0x45a88a){return _0x45a88a;});}return null;};}function removeEntity(_0xd9cf5,_0xa36181){return function(_0x8e95df){if(_0x8e95df){return _0x8e95df[_0x6c9c('0x39')]()[_0x6c9c('0x21')](function(){var _0x3b69ff=_0x8e95df[_0x6c9c('0x3a')]({'plain':!![]});var _0x107f2c=_0x6c9c('0x3b');return db[_0x6c9c('0x3c')][_0x6c9c('0x39')]({'where':{'type':_0x107f2c,'resourceId':_0x3b69ff['id']}})['then'](function(){return _0x8e95df;});})[_0x6c9c('0x21')](function(){_0xd9cf5[_0x6c9c('0x2f')](0xcc)[_0x6c9c('0x2e')]();});}};}function handleEntityNotFound(_0x56d4f2,_0x246d61){return function(_0x1b88bb){if(!_0x1b88bb){_0x56d4f2[_0x6c9c('0x2d')](0x194);}return _0x1b88bb;};}function handleError(_0x3ace14,_0x407197){_0x407197=_0x407197||0x1f4;return function(_0x34364f){logger[_0x6c9c('0x28')](_0x34364f[_0x6c9c('0x3d')]);if(_0x34364f[_0x6c9c('0x3e')]){delete _0x34364f[_0x6c9c('0x3e')];}_0x3ace14[_0x6c9c('0x2f')](_0x407197)[_0x6c9c('0x3f')](_0x34364f);};}exports['index']=function(_0x44d293,_0x2d99c2){var _0x4de60c={},_0x459d9a={},_0x72f4b3={'count':0x0,'rows':[]};var _0x324c1c=_[_0x6c9c('0x40')](db[_0x6c9c('0x41')][_0x6c9c('0x42')],function(_0x207fc6){return{'name':_0x207fc6[_0x6c9c('0x43')],'type':_0x207fc6[_0x6c9c('0x44')][_0x6c9c('0x45')]};});_0x459d9a[_0x6c9c('0x46')]=_[_0x6c9c('0x40')](_0x324c1c,'name');_0x459d9a[_0x6c9c('0x47')]=_[_0x6c9c('0x48')](_0x44d293['query']);_0x459d9a[_0x6c9c('0x49')]=_[_0x6c9c('0x4a')](_0x459d9a[_0x6c9c('0x46')],_0x459d9a['query']);_0x4de60c['attributes']=_['intersection'](_0x459d9a['model'],qs[_0x6c9c('0x4b')](_0x44d293[_0x6c9c('0x47')][_0x6c9c('0x4b')]));_0x4de60c[_0x6c9c('0x4c')]=_0x4de60c[_0x6c9c('0x4c')][_0x6c9c('0x4d')]?_0x4de60c['attributes']:_0x459d9a[_0x6c9c('0x46')];if(!_0x44d293[_0x6c9c('0x47')]['hasOwnProperty'](_0x6c9c('0x4e'))){_0x4de60c[_0x6c9c('0x33')]=qs['limit'](_0x44d293['query'][_0x6c9c('0x33')]);_0x4de60c['offset']=qs[_0x6c9c('0x32')](_0x44d293[_0x6c9c('0x47')]['offset']);}_0x4de60c[_0x6c9c('0x4f')]=qs['sort'](_0x44d293[_0x6c9c('0x47')]['sort']);_0x4de60c[_0x6c9c('0x50')]=qs[_0x6c9c('0x49')](_[_0x6c9c('0x51')](_0x44d293[_0x6c9c('0x47')],_0x459d9a[_0x6c9c('0x49')]),_0x324c1c);if(_0x44d293['query'][_0x6c9c('0x52')]){_0x4de60c[_0x6c9c('0x50')]=_[_0x6c9c('0x53')](_0x4de60c[_0x6c9c('0x50')],{'$or':_[_0x6c9c('0x40')](_0x324c1c,function(_0x535d42){if(_0x535d42[_0x6c9c('0x44')]!==_0x6c9c('0x54')){var _0x3d7b82={};_0x3d7b82[_0x535d42[_0x6c9c('0x3e')]]={'$like':'%'+_0x44d293['query']['filter']+'%'};return _0x3d7b82;}})});}_0x4de60c=_['merge']({},_0x4de60c,_0x44d293['options']);var _0x5ea6c3={'where':_0x4de60c[_0x6c9c('0x50')]};return db[_0x6c9c('0x41')][_0x6c9c('0x31')](_0x5ea6c3)['then'](function(_0x2316b9){_0x72f4b3[_0x6c9c('0x31')]=_0x2316b9;if(_0x44d293[_0x6c9c('0x47')][_0x6c9c('0x55')]){_0x4de60c[_0x6c9c('0x56')]=[{'all':!![]}];}return db[_0x6c9c('0x41')][_0x6c9c('0x57')](_0x4de60c);})[_0x6c9c('0x21')](function(_0x385b55){_0x72f4b3[_0x6c9c('0x58')]=_0x385b55;return _0x72f4b3;})['then'](respondWithFilteredResult(_0x2d99c2,_0x4de60c))['catch'](handleError(_0x2d99c2,null));};exports['show']=function(_0x49bad9,_0x2dd2c1){var _0x1126f4={'raw':![],'where':{'id':_0x49bad9['params']['id']}},_0x351e98={};_0x351e98[_0x6c9c('0x46')]=_[_0x6c9c('0x48')](db[_0x6c9c('0x41')][_0x6c9c('0x42')]);_0x351e98[_0x6c9c('0x47')]=_[_0x6c9c('0x48')](_0x49bad9[_0x6c9c('0x47')]);_0x351e98[_0x6c9c('0x49')]=_[_0x6c9c('0x4a')](_0x351e98[_0x6c9c('0x46')],_0x351e98[_0x6c9c('0x47')]);_0x1126f4[_0x6c9c('0x4c')]=_['intersection'](_0x351e98[_0x6c9c('0x46')],qs[_0x6c9c('0x4b')](_0x49bad9[_0x6c9c('0x47')][_0x6c9c('0x4b')]));_0x1126f4[_0x6c9c('0x4c')]=_0x1126f4[_0x6c9c('0x4c')][_0x6c9c('0x4d')]?_0x1126f4[_0x6c9c('0x4c')]:_0x351e98[_0x6c9c('0x46')];if(_0x49bad9[_0x6c9c('0x47')][_0x6c9c('0x55')]){_0x1126f4['include']=[{'all':!![]}];}_0x1126f4=_[_0x6c9c('0x53')]({},_0x1126f4,_0x49bad9[_0x6c9c('0x59')]);return db[_0x6c9c('0x41')][_0x6c9c('0x5a')](_0x1126f4)['then'](handleEntityNotFound(_0x2dd2c1,null))[_0x6c9c('0x21')](respondWithResult(_0x2dd2c1,null))[_0x6c9c('0x2c')](handleError(_0x2dd2c1,null));};exports[_0x6c9c('0x5b')]=function(_0x29a319,_0x313256){var _0x3e8302={'where':{'id':_0x29a319['params']['id']}},_0x2d6ef7={};_0x2d6ef7[_0x6c9c('0x46')]=_[_0x6c9c('0x48')](db[_0x6c9c('0x41')][_0x6c9c('0x42')]);_0x3e8302[_0x6c9c('0x4c')]=_[_0x6c9c('0x4a')](_0x2d6ef7[_0x6c9c('0x46')],qs[_0x6c9c('0x4b')](_0x29a319[_0x6c9c('0x47')]['fields']));_0x3e8302[_0x6c9c('0x4c')]=_0x3e8302[_0x6c9c('0x4c')][_0x6c9c('0x4d')]?_0x3e8302[_0x6c9c('0x4c')]:_0x2d6ef7[_0x6c9c('0x46')];if(_0x29a319['query']['includeAll']){_0x3e8302[_0x6c9c('0x56')]=[{'all':!![]}];}_0x3e8302=_[_0x6c9c('0x53')]({},_0x3e8302,_0x29a319[_0x6c9c('0x59')]);return db[_0x6c9c('0x41')][_0x6c9c('0x5a')](_0x3e8302)[_0x6c9c('0x21')](handleEntityNotFound(_0x313256,null))[_0x6c9c('0x21')](function(_0x4a39dd){if(_0x4a39dd){var _0x3ca3be=_0x4a39dd['get']({'plain':!![]});_0x3ca3be=qs[_0x6c9c('0x5c')](_0x3ca3be,['id','createdAt','updatedAt']);_0x29a319[_0x6c9c('0x5d')]=_[_0x6c9c('0x5c')](_0x29a319['body'],['id',_0x6c9c('0x5e'),'updatedAt']);return db[_0x6c9c('0x41')]['create'](_[_0x6c9c('0x53')](_0x3ca3be,_0x29a319[_0x6c9c('0x5d')]),{'include':_0x29a319[_0x6c9c('0x47')][_0x6c9c('0x55')]?[{'all':!![]}]:undefined})[_0x6c9c('0x21')](function(_0x56fc60){var _0x542c9b=_0x29a319[_0x6c9c('0x5f')]['get']({'plain':!![]});if(!_0x542c9b)throw new Error(_0x6c9c('0x60'));if(_0x542c9b['role']==='user'){var _0x1b7196=_0x56fc60[_0x6c9c('0x3a')]({'plain':!![]});var _0x2700a6=_0x6c9c('0x3b');return db[_0x6c9c('0x61')][_0x6c9c('0x5a')]({'where':{'name':_0x2700a6,'userProfileId':_0x542c9b[_0x6c9c('0x62')]},'raw':!![]})[_0x6c9c('0x21')](function(_0x5849e2){if(_0x5849e2&&_0x5849e2[_0x6c9c('0x63')]===0x0){return db[_0x6c9c('0x3c')][_0x6c9c('0x64')]({'name':_0x1b7196[_0x6c9c('0x3e')],'resourceId':_0x1b7196['id'],'type':_0x5849e2['name'],'sectionId':_0x5849e2['id']},{})[_0x6c9c('0x21')](function(){return _0x56fc60;});}else{return _0x56fc60;}})[_0x6c9c('0x2c')](function(_0x113ba4){logger[_0x6c9c('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x113ba4);throw _0x113ba4;});}return _0x56fc60;});}})[_0x6c9c('0x21')](respondWithResult(_0x313256,0xc9))[_0x6c9c('0x2c')](handleError(_0x313256,null));};exports['create']=function(_0xeb2b2d,_0x4e3a1b,_0x1a54c7){var _0x461cce;return db[_0x6c9c('0x41')][_0x6c9c('0x64')](_0xeb2b2d['body'],{'raw':!![]})[_0x6c9c('0x21')](function(_0x400007){_0x461cce=_0x400007;return db[_0x6c9c('0x41')][_0x6c9c('0x57')]({'raw':!![]});})['then'](function(_0x28f237){var _0x6c18d9=fs[_0x6c9c('0x65')](path[_0x6c9c('0x66')](config[_0x6c9c('0x67')],_0x6c9c('0x68')),_0x6c9c('0x69'));var _0x1c8477=fs[_0x6c9c('0x65')](path[_0x6c9c('0x66')](config[_0x6c9c('0x67')],'server/files/templates/registry.ejs'),_0x6c9c('0x69'));var _0x4d840f=ejs[_0x6c9c('0x6a')](_0x6c18d9,{'trunks':_0x28f237||[]});fs[_0x6c9c('0x6b')](_0x6c9c('0x6c'),_0x4d840f);if(_0x461cce['registry']){var _0x3ac2f7=ejs[_0x6c9c('0x6a')](_0x1c8477,{'trunks':_0x28f237||[]});fs[_0x6c9c('0x6b')]('/etc/asterisk/sip_xcally_registers.conf',_0x3ac2f7);}})[_0x6c9c('0x21')](function(){return respondWithRpcPromise(_0x6c9c('0x6d'),_0x6c9c('0x64'),{'module':'chan_sip.so'});})[_0x6c9c('0x21')](function(){var _0x1ea977=_0xeb2b2d[_0x6c9c('0x5f')][_0x6c9c('0x3a')]({'plain':!![]});if(!_0x1ea977)throw new Error(_0x6c9c('0x60'));if(_0x1ea977[_0x6c9c('0x6e')]===_0x6c9c('0x5f')){var _0x3efe9b=_0x461cce[_0x6c9c('0x3a')]({'plain':!![]});return db['UserProfileSection'][_0x6c9c('0x5a')]({'where':{'name':'Trunks','userProfileId':_0x1ea977[_0x6c9c('0x62')]},'raw':!![]})[_0x6c9c('0x21')](function(_0x100190){if(_0x100190&&_0x100190[_0x6c9c('0x63')]===0x0){return db[_0x6c9c('0x3c')][_0x6c9c('0x64')]({'name':_0x3efe9b[_0x6c9c('0x3e')],'resourceId':_0x3efe9b['id'],'type':_0x100190['name'],'sectionId':_0x100190['id']},{})[_0x6c9c('0x21')](function(){return _0x461cce;});}else{return _0x461cce;}})[_0x6c9c('0x2c')](function(_0x38b077){logger[_0x6c9c('0x28')](_0x6c9c('0x6f'),_0x38b077);throw _0x38b077;});}return _0x461cce;})['then'](respondWithResult(_0x4e3a1b,0xc9))[_0x6c9c('0x2c')](handleError(_0x4e3a1b,null));};exports['update']=function(_0x16247b,_0xbc435a,_0x4f4ee6){var _0x2ed9eb;return db[_0x6c9c('0x41')][_0x6c9c('0x5a')]({'where':{'id':_0x16247b[_0x6c9c('0x70')]['id']}})[_0x6c9c('0x21')](handleEntityNotFound(_0xbc435a,null))[_0x6c9c('0x21')](saveUpdates(_0x16247b[_0x6c9c('0x5d')],null))['then'](function(_0x56cee3){if(_0x56cee3){_0x2ed9eb=_0x56cee3;return db[_0x6c9c('0x41')][_0x6c9c('0x57')]({'raw':!![]});}})[_0x6c9c('0x21')](function(_0xe6c9ee){if(_0xe6c9ee){var _0x1d83e2=fs[_0x6c9c('0x65')](path['join'](config['root'],_0x6c9c('0x68')),_0x6c9c('0x69'));var _0x9f5466=fs[_0x6c9c('0x65')](path[_0x6c9c('0x66')](config['root'],_0x6c9c('0x71')),_0x6c9c('0x69'));var _0x5afa81=ejs[_0x6c9c('0x6a')](_0x1d83e2,{'trunks':_0xe6c9ee||[]});fs[_0x6c9c('0x6b')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5afa81);var _0x5c536f=ejs['render'](_0x9f5466,{'trunks':_0xe6c9ee||[]});fs[_0x6c9c('0x6b')](_0x6c9c('0x72'),_0x5c536f);return respondWithRpcPromise(_0x6c9c('0x6d'),_0x6c9c('0x73'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x24071e){if(_0x24071e){return _0x2ed9eb;}})[_0x6c9c('0x21')](respondWithResult(_0xbc435a,null))[_0x6c9c('0x2c')](handleError(_0xbc435a,null));};exports['destroy']=function(_0x152242,_0x504644,_0x32b8fe){var _0x33a6ca;return db[_0x6c9c('0x41')]['find']({'where':{'id':_0x152242[_0x6c9c('0x70')]['id']}})[_0x6c9c('0x21')](handleEntityNotFound(_0x504644,null))[_0x6c9c('0x21')](removeEntity(_0x504644,null))[_0x6c9c('0x21')](function(){return db[_0x6c9c('0x41')]['findAll']({'raw':!![]});})['then'](function(_0x2ccea9){var _0x1a5381=fs[_0x6c9c('0x65')](path[_0x6c9c('0x66')](config[_0x6c9c('0x67')],_0x6c9c('0x68')),'utf8');var _0x2917f3=fs[_0x6c9c('0x65')](path['join'](config[_0x6c9c('0x67')],'server/files/templates/registry.ejs'),_0x6c9c('0x69'));var _0xd918fb=ejs[_0x6c9c('0x6a')](_0x1a5381,{'trunks':_0x2ccea9});var _0x17bf30=ejs[_0x6c9c('0x6a')](_0x2917f3,{'trunks':_0x2ccea9});fs[_0x6c9c('0x6b')](_0x6c9c('0x6c'),_0xd918fb);fs[_0x6c9c('0x6b')](_0x6c9c('0x72'),_0x17bf30);return respondWithRpcPromise('Reload','destroy',{'module':_0x6c9c('0x74')});})['catch'](handleError(_0x504644,null));}; \ No newline at end of file +var _0x9126=['update','/etc/asterisk/sip_xcally_registers.conf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','destroy','Trunks','UserProfileResource','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','Trunk','includeAll','include','findAll','rows','show','params','length','find','clone','omit','createdAt','updatedAt','body','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','utf8','render','writeFileSync','registry','chan_sip.so','UserProfileSection','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','Reload'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x9126,0x6f));var _0x6912=function(_0x5cf8f9,_0xedf39b){_0x5cf8f9=_0x5cf8f9-0x0;var _0x5b34ec=_0x9126[_0x5cf8f9];return _0x5b34ec;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6912('0x0'));var jsonpatch=require(_0x6912('0x1'));var rp=require(_0x6912('0x2'));var moment=require(_0x6912('0x3'));var BPromise=require(_0x6912('0x4'));var Mustache=require(_0x6912('0x5'));var util=require(_0x6912('0x6'));var path=require(_0x6912('0x7'));var sox=require('sox');var csv=require(_0x6912('0x8'));var ejs=require(_0x6912('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6912('0xa'));var crypto=require(_0x6912('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6912('0xc'));var toCsv=require(_0x6912('0x8'));var querystring=require(_0x6912('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6912('0xe'));var as=require(_0x6912('0xf'));var hardwareService=require(_0x6912('0x10'));var logger=require(_0x6912('0x11'))(_0x6912('0x12'));var utils=require(_0x6912('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x6912('0x14')][_0x6912('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x1b043f,_0x34ec27,_0x463218,_0x5cd0c6){return new BPromise(function(_0x2dde10,_0x363b36){var _0x281522=_0x5cd0c6||client;return _0x281522[_0x6912('0x16')](_0x1b043f,_0x463218)[_0x6912('0x17')](function(_0x5801a0){logger['info'](_0x6912('0x18'),_0x34ec27,_0x6912('0x19'));logger[_0x6912('0x1a')](_0x6912('0x1b'),_0x34ec27,'request\x20sent',JSON[_0x6912('0x1c')](_0x5801a0));if(_0x5801a0[_0x6912('0x1d')]){if(_0x5801a0[_0x6912('0x1d')][_0x6912('0x1e')]===0x1f4){logger[_0x6912('0x1d')]('Trunk,\x20%s,\x20%s',_0x34ec27,_0x5801a0[_0x6912('0x1d')][_0x6912('0x1f')]);return _0x363b36(_0x5801a0[_0x6912('0x1d')][_0x6912('0x1f')]);}logger[_0x6912('0x1d')](_0x6912('0x18'),_0x34ec27,_0x5801a0[_0x6912('0x1d')][_0x6912('0x1f')]);return _0x2dde10(_0x5801a0[_0x6912('0x1d')][_0x6912('0x1f')]);}else{logger[_0x6912('0x20')](_0x6912('0x18'),_0x34ec27,_0x6912('0x19'));_0x2dde10(_0x5801a0[_0x6912('0x21')]['message']);}})['catch'](function(_0x19d8e0){logger['error'](_0x6912('0x18'),_0x34ec27,_0x19d8e0);_0x363b36(_0x19d8e0);});});}function respondWithStatusCode(_0x54a4a0,_0x440a48){_0x440a48=_0x440a48||0xcc;return function(_0x5dd8cb){if(_0x5dd8cb){return _0x54a4a0[_0x6912('0x22')](_0x440a48);}return _0x54a4a0[_0x6912('0x23')](_0x440a48)[_0x6912('0x24')]();};}function respondWithResult(_0x1668b3,_0x34ace6){_0x34ace6=_0x34ace6||0xc8;return function(_0x855b19){if(_0x855b19){return _0x1668b3['status'](_0x34ace6)['json'](_0x855b19);}};}function respondWithFilteredResult(_0x227b36,_0x365c1c){return function(_0x5e4e0c){if(_0x5e4e0c){var _0x19987e=_0x5e4e0c[_0x6912('0x25')],_0xaa2086=_0x365c1c[_0x6912('0x26')],_0x5e25e3=_0x365c1c[_0x6912('0x26')]+_0x365c1c[_0x6912('0x27')],_0x346668;if(_0x5e25e3>=_0x19987e){_0x5e25e3=_0x19987e;_0x346668=0xc8;}else{_0x346668=0xce;}_0x227b36[_0x6912('0x23')](_0x346668);return _0x227b36['set'](_0x6912('0x28'),_0xaa2086+'-'+_0x5e25e3+'/'+_0x19987e)[_0x6912('0x29')](_0x5e4e0c);}return null;};}function patchUpdates(_0x43d238){return function(_0x5de2d2){try{jsonpatch[_0x6912('0x2a')](_0x5de2d2,_0x43d238,!![]);}catch(_0x34c567){return BPromise['reject'](_0x34c567);}return _0x5de2d2[_0x6912('0x2b')]();};}function saveUpdates(_0x200618,_0x400b6b){return function(_0xbc55b3){if(_0xbc55b3){return _0xbc55b3['update'](_0x200618)[_0x6912('0x17')](function(_0x2bf804){return _0x2bf804;});}return null;};}function removeEntity(_0x351d29,_0x5addde){return function(_0x2eae96){if(_0x2eae96){return _0x2eae96[_0x6912('0x2c')]()[_0x6912('0x17')](function(){var _0x3d3828=_0x2eae96['get']({'plain':!![]});var _0x31de8d=_0x6912('0x2d');return db[_0x6912('0x2e')][_0x6912('0x2c')]({'where':{'type':_0x31de8d,'resourceId':_0x3d3828['id']}})[_0x6912('0x17')](function(){return _0x2eae96;});})['then'](function(){_0x351d29[_0x6912('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x255895,_0x25881b){return function(_0x1455f2){if(!_0x1455f2){_0x255895[_0x6912('0x22')](0x194);}return _0x1455f2;};}function handleError(_0x476529,_0x353ec5){_0x353ec5=_0x353ec5||0x1f4;return function(_0x4ee8be){logger[_0x6912('0x1d')](_0x4ee8be['stack']);if(_0x4ee8be[_0x6912('0x2f')]){delete _0x4ee8be[_0x6912('0x2f')];}_0x476529[_0x6912('0x23')](_0x353ec5)[_0x6912('0x30')](_0x4ee8be);};}exports[_0x6912('0x31')]=function(_0x4e95a6,_0x242ebe){var _0x4c42be={},_0x56a0e1={},_0x14374b={'count':0x0,'rows':[]};var _0x524fdf=_[_0x6912('0x32')](db['Trunk'][_0x6912('0x33')],function(_0x25d4d2){return{'name':_0x25d4d2[_0x6912('0x34')],'type':_0x25d4d2[_0x6912('0x35')][_0x6912('0x36')]};});_0x56a0e1[_0x6912('0x37')]=_[_0x6912('0x32')](_0x524fdf,_0x6912('0x2f'));_0x56a0e1[_0x6912('0x38')]=_[_0x6912('0x39')](_0x4e95a6[_0x6912('0x38')]);_0x56a0e1[_0x6912('0x3a')]=_[_0x6912('0x3b')](_0x56a0e1[_0x6912('0x37')],_0x56a0e1[_0x6912('0x38')]);_0x4c42be['attributes']=_[_0x6912('0x3b')](_0x56a0e1[_0x6912('0x37')],qs[_0x6912('0x3c')](_0x4e95a6['query'][_0x6912('0x3c')]));_0x4c42be[_0x6912('0x3d')]=_0x4c42be[_0x6912('0x3d')]['length']?_0x4c42be[_0x6912('0x3d')]:_0x56a0e1[_0x6912('0x37')];if(!_0x4e95a6[_0x6912('0x38')][_0x6912('0x3e')](_0x6912('0x3f'))){_0x4c42be[_0x6912('0x27')]=qs[_0x6912('0x27')](_0x4e95a6[_0x6912('0x38')][_0x6912('0x27')]);_0x4c42be[_0x6912('0x26')]=qs['offset'](_0x4e95a6[_0x6912('0x38')]['offset']);}_0x4c42be[_0x6912('0x40')]=qs[_0x6912('0x41')](_0x4e95a6[_0x6912('0x38')][_0x6912('0x41')]);_0x4c42be[_0x6912('0x42')]=qs[_0x6912('0x3a')](_['pick'](_0x4e95a6[_0x6912('0x38')],_0x56a0e1['filters']),_0x524fdf);if(_0x4e95a6[_0x6912('0x38')]['filter']){_0x4c42be[_0x6912('0x42')]=_[_0x6912('0x43')](_0x4c42be[_0x6912('0x42')],{'$or':_[_0x6912('0x32')](_0x524fdf,function(_0x2e797e){if(_0x2e797e['type']!==_0x6912('0x44')){var _0x365acd={};_0x365acd[_0x2e797e[_0x6912('0x2f')]]={'$like':'%'+_0x4e95a6['query'][_0x6912('0x45')]+'%'};return _0x365acd;}})});}_0x4c42be=_[_0x6912('0x43')]({},_0x4c42be,_0x4e95a6[_0x6912('0x46')]);var _0x5e72c5={'where':_0x4c42be[_0x6912('0x42')]};return db[_0x6912('0x47')]['count'](_0x5e72c5)[_0x6912('0x17')](function(_0x27d0d5){_0x14374b['count']=_0x27d0d5;if(_0x4e95a6[_0x6912('0x38')][_0x6912('0x48')]){_0x4c42be[_0x6912('0x49')]=[{'all':!![]}];}return db[_0x6912('0x47')][_0x6912('0x4a')](_0x4c42be);})[_0x6912('0x17')](function(_0x541127){_0x14374b[_0x6912('0x4b')]=_0x541127;return _0x14374b;})[_0x6912('0x17')](respondWithFilteredResult(_0x242ebe,_0x4c42be))['catch'](handleError(_0x242ebe,null));};exports[_0x6912('0x4c')]=function(_0x5a2b92,_0x2581db){var _0x34ac40={'raw':![],'where':{'id':_0x5a2b92[_0x6912('0x4d')]['id']}},_0x48a0e5={};_0x48a0e5[_0x6912('0x37')]=_['keys'](db[_0x6912('0x47')][_0x6912('0x33')]);_0x48a0e5[_0x6912('0x38')]=_[_0x6912('0x39')](_0x5a2b92[_0x6912('0x38')]);_0x48a0e5[_0x6912('0x3a')]=_[_0x6912('0x3b')](_0x48a0e5[_0x6912('0x37')],_0x48a0e5['query']);_0x34ac40['attributes']=_['intersection'](_0x48a0e5[_0x6912('0x37')],qs[_0x6912('0x3c')](_0x5a2b92[_0x6912('0x38')][_0x6912('0x3c')]));_0x34ac40[_0x6912('0x3d')]=_0x34ac40['attributes'][_0x6912('0x4e')]?_0x34ac40[_0x6912('0x3d')]:_0x48a0e5[_0x6912('0x37')];if(_0x5a2b92[_0x6912('0x38')][_0x6912('0x48')]){_0x34ac40[_0x6912('0x49')]=[{'all':!![]}];}_0x34ac40=_[_0x6912('0x43')]({},_0x34ac40,_0x5a2b92[_0x6912('0x46')]);return db[_0x6912('0x47')][_0x6912('0x4f')](_0x34ac40)[_0x6912('0x17')](handleEntityNotFound(_0x2581db,null))[_0x6912('0x17')](respondWithResult(_0x2581db,null))['catch'](handleError(_0x2581db,null));};exports[_0x6912('0x50')]=function(_0x3b7f20,_0x3f21aa){var _0x54cb26={'where':{'id':_0x3b7f20['params']['id']}},_0x4e20db={};_0x4e20db['model']=_[_0x6912('0x39')](db['Trunk']['rawAttributes']);_0x54cb26['attributes']=_['intersection'](_0x4e20db['model'],qs[_0x6912('0x3c')](_0x3b7f20[_0x6912('0x38')][_0x6912('0x3c')]));_0x54cb26[_0x6912('0x3d')]=_0x54cb26[_0x6912('0x3d')][_0x6912('0x4e')]?_0x54cb26[_0x6912('0x3d')]:_0x4e20db['model'];if(_0x3b7f20[_0x6912('0x38')]['includeAll']){_0x54cb26[_0x6912('0x49')]=[{'all':!![]}];}_0x54cb26=_[_0x6912('0x43')]({},_0x54cb26,_0x3b7f20['options']);return db[_0x6912('0x47')][_0x6912('0x4f')](_0x54cb26)[_0x6912('0x17')](handleEntityNotFound(_0x3f21aa,null))[_0x6912('0x17')](function(_0x18e8db){if(_0x18e8db){var _0x2a98e5=_0x18e8db['get']({'plain':!![]});_0x2a98e5=qs[_0x6912('0x51')](_0x2a98e5,['id',_0x6912('0x52'),_0x6912('0x53')]);_0x3b7f20[_0x6912('0x54')]=_[_0x6912('0x51')](_0x3b7f20[_0x6912('0x54')],['id',_0x6912('0x52'),_0x6912('0x53')]);return db['Trunk'][_0x6912('0x55')](_[_0x6912('0x43')](_0x2a98e5,_0x3b7f20[_0x6912('0x54')]),{'include':_0x3b7f20[_0x6912('0x38')][_0x6912('0x48')]?[{'all':!![]}]:undefined})[_0x6912('0x17')](function(_0x1fb332){var _0x5522c5=_0x3b7f20[_0x6912('0x56')][_0x6912('0x57')]({'plain':!![]});if(!_0x5522c5)throw new Error(_0x6912('0x58'));if(_0x5522c5[_0x6912('0x59')]===_0x6912('0x56')){var _0x160a89=_0x1fb332[_0x6912('0x57')]({'plain':!![]});var _0x1222e0='Trunks';return db['UserProfileSection'][_0x6912('0x4f')]({'where':{'name':_0x1222e0,'userProfileId':_0x5522c5[_0x6912('0x5a')]},'raw':!![]})[_0x6912('0x17')](function(_0x4f7dae){if(_0x4f7dae&&_0x4f7dae[_0x6912('0x5b')]===0x0){return db[_0x6912('0x2e')]['create']({'name':_0x160a89[_0x6912('0x2f')],'resourceId':_0x160a89['id'],'type':_0x4f7dae[_0x6912('0x2f')],'sectionId':_0x4f7dae['id']},{})[_0x6912('0x17')](function(){return _0x1fb332;});}else{return _0x1fb332;}})[_0x6912('0x5c')](function(_0x4e5d3e){logger[_0x6912('0x1d')](_0x6912('0x5d'),_0x4e5d3e);throw _0x4e5d3e;});}return _0x1fb332;});}})[_0x6912('0x17')](respondWithResult(_0x3f21aa,0xc9))[_0x6912('0x5c')](handleError(_0x3f21aa,null));};exports['create']=function(_0x368b7a,_0x1b8946,_0x3f51d4){var _0xd464ca;return db[_0x6912('0x47')][_0x6912('0x55')](_0x368b7a[_0x6912('0x54')],{'raw':!![]})['then'](function(_0x3cf342){_0xd464ca=_0x3cf342;return db['Trunk'][_0x6912('0x4a')]({'raw':!![]});})[_0x6912('0x17')](function(_0x50dbd0){var _0x199995=fs[_0x6912('0x5e')](path[_0x6912('0x5f')](config[_0x6912('0x60')],'server/files/templates/trunk.ejs'),_0x6912('0x61'));var _0x27b3cd=fs[_0x6912('0x5e')](path[_0x6912('0x5f')](config[_0x6912('0x60')],'server/files/templates/registry.ejs'),'utf8');var _0x346109=ejs[_0x6912('0x62')](_0x199995,{'trunks':_0x50dbd0||[]});fs[_0x6912('0x63')]('/etc/asterisk/sip_xcally_trunks.conf',_0x346109);if(_0xd464ca[_0x6912('0x64')]){var _0x12f640=ejs[_0x6912('0x62')](_0x27b3cd,{'trunks':_0x50dbd0||[]});fs[_0x6912('0x63')]('/etc/asterisk/sip_xcally_registers.conf',_0x12f640);}})[_0x6912('0x17')](function(){return respondWithRpcPromise('Reload',_0x6912('0x55'),{'module':_0x6912('0x65')});})[_0x6912('0x17')](function(){var _0x5bb522=_0x368b7a[_0x6912('0x56')]['get']({'plain':!![]});if(!_0x5bb522)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5bb522[_0x6912('0x59')]===_0x6912('0x56')){var _0x3ccfea=_0xd464ca[_0x6912('0x57')]({'plain':!![]});return db[_0x6912('0x66')][_0x6912('0x4f')]({'where':{'name':_0x6912('0x2d'),'userProfileId':_0x5bb522[_0x6912('0x5a')]},'raw':!![]})[_0x6912('0x17')](function(_0x2437b0){if(_0x2437b0&&_0x2437b0['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3ccfea[_0x6912('0x2f')],'resourceId':_0x3ccfea['id'],'type':_0x2437b0[_0x6912('0x2f')],'sectionId':_0x2437b0['id']},{})[_0x6912('0x17')](function(){return _0xd464ca;});}else{return _0xd464ca;}})['catch'](function(_0x500c66){logger[_0x6912('0x1d')](_0x6912('0x5d'),_0x500c66);throw _0x500c66;});}return _0xd464ca;})[_0x6912('0x17')](respondWithResult(_0x1b8946,0xc9))[_0x6912('0x5c')](handleError(_0x1b8946,null));};exports['update']=function(_0x70643,_0x28f722,_0x531219){var _0x5db7e4;return db['Trunk'][_0x6912('0x4f')]({'where':{'id':_0x70643[_0x6912('0x4d')]['id']}})[_0x6912('0x17')](handleEntityNotFound(_0x28f722,null))[_0x6912('0x17')](saveUpdates(_0x70643[_0x6912('0x54')],null))[_0x6912('0x17')](function(_0x33485f){if(_0x33485f){_0x5db7e4=_0x33485f;return db[_0x6912('0x47')][_0x6912('0x4a')]({'raw':!![]});}})[_0x6912('0x17')](function(_0x308759){if(_0x308759){var _0x524b73=fs[_0x6912('0x5e')](path[_0x6912('0x5f')](config[_0x6912('0x60')],_0x6912('0x67')),_0x6912('0x61'));var _0x1a90e3=fs[_0x6912('0x5e')](path[_0x6912('0x5f')](config[_0x6912('0x60')],_0x6912('0x68')),_0x6912('0x61'));var _0x30507e=ejs[_0x6912('0x62')](_0x524b73,{'trunks':_0x308759||[]});fs['writeFileSync'](_0x6912('0x69'),_0x30507e);var _0xecb559=ejs[_0x6912('0x62')](_0x1a90e3,{'trunks':_0x308759||[]});fs[_0x6912('0x63')]('/etc/asterisk/sip_xcally_registers.conf',_0xecb559);return respondWithRpcPromise(_0x6912('0x6a'),_0x6912('0x6b'),{'module':_0x6912('0x65')});}return null;})[_0x6912('0x17')](function(_0x30e6){if(_0x30e6){return _0x5db7e4;}})[_0x6912('0x17')](respondWithResult(_0x28f722,null))[_0x6912('0x5c')](handleError(_0x28f722,null));};exports[_0x6912('0x2c')]=function(_0x1660ca,_0x2a9cb3,_0x182700){var _0xf17ce7;return db[_0x6912('0x47')][_0x6912('0x4f')]({'where':{'id':_0x1660ca[_0x6912('0x4d')]['id']}})[_0x6912('0x17')](handleEntityNotFound(_0x2a9cb3,null))[_0x6912('0x17')](removeEntity(_0x2a9cb3,null))['then'](function(){return db[_0x6912('0x47')]['findAll']({'raw':!![]});})[_0x6912('0x17')](function(_0x57c456){var _0x4919df=fs[_0x6912('0x5e')](path[_0x6912('0x5f')](config[_0x6912('0x60')],'server/files/templates/trunk.ejs'),_0x6912('0x61'));var _0x3cdc9a=fs['readFileSync'](path['join'](config['root'],_0x6912('0x68')),_0x6912('0x61'));var _0x46a84e=ejs[_0x6912('0x62')](_0x4919df,{'trunks':_0x57c456});var _0x584ca3=ejs[_0x6912('0x62')](_0x3cdc9a,{'trunks':_0x57c456});fs[_0x6912('0x63')](_0x6912('0x69'),_0x46a84e);fs[_0x6912('0x63')](_0x6912('0x6c'),_0x584ca3);return respondWithRpcPromise(_0x6912('0x6a'),_0x6912('0x2c'),{'module':'chan_sip.so'});})[_0x6912('0x5c')](handleError(_0x2a9cb3,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 3c9774e..55b93ca 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 _0x948c=['Trunk','tools_trunks','lodash','api','moment','request-promise','rimraf','./trunk.attributes','exports','define'];(function(_0x1f447f,_0x4308f4){var _0x3f6dbe=function(_0x2d7a0a){while(--_0x2d7a0a){_0x1f447f['push'](_0x1f447f['shift']());}};_0x3f6dbe(++_0x4308f4);}(_0x948c,0x160));var _0xc948=function(_0x23c741,_0x4ed6f2){_0x23c741=_0x23c741-0x0;var _0x3bed53=_0x948c[_0x23c741];return _0x3bed53;};'use strict';var _=require(_0xc948('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc948('0x1'));var moment=require(_0xc948('0x2'));var BPromise=require('bluebird');var rp=require(_0xc948('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc948('0x4'));var config=require('../../config/environment');var attributes=require(_0xc948('0x5'));module[_0xc948('0x6')]=function(_0x352c20,_0x5f1a95){return _0x352c20[_0xc948('0x7')](_0xc948('0x8'),attributes,{'tableName':_0xc948('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa44f=['exports','Trunk','tools_trunks','util','api','moment','bluebird','request-promise','path','./trunk.attributes'];(function(_0x27715e,_0x7b1561){var _0x32b234=function(_0x2ee5de){while(--_0x2ee5de){_0x27715e['push'](_0x27715e['shift']());}};_0x32b234(++_0x7b1561);}(_0xa44f,0x1e3));var _0xfa44=function(_0x1f280a,_0x2587fd){_0x1f280a=_0x1f280a-0x0;var _0x37061c=_0xa44f[_0x1f280a];return _0x37061c;};'use strict';var _=require('lodash');var util=require(_0xfa44('0x0'));var logger=require('../../config/logger')(_0xfa44('0x1'));var moment=require(_0xfa44('0x2'));var BPromise=require(_0xfa44('0x3'));var rp=require(_0xfa44('0x4'));var fs=require('fs');var path=require(_0xfa44('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfa44('0x6'));module[_0xfa44('0x7')]=function(_0x551975,_0xbeb8cb){return _0x551975['define'](_0xfa44('0x8'),attributes,{'tableName':_0xfa44('0x9'),'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 98a73eb..5549529 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 _0x2032=['error','code','message','info','result','catch','GetTrunk','Trunk','options','raw','where','map','model','attributes','include','stringify','ShowTrunk','find','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x31fdc9,_0x2188f1){var _0x3ab939=function(_0x4d6b17){while(--_0x4d6b17){_0x31fdc9['push'](_0x31fdc9['shift']());}};_0x3ab939(++_0x2188f1);}(_0x2032,0xd9));var _0x2203=function(_0xe205bd,_0x58e87c){_0xe205bd=_0xe205bd-0x0;var _0x7a1064=_0x2032[_0xe205bd];return _0x7a1064;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('Trunk,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('Trunk,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});}exports[_0x2203('0x14')]=function(_0x4893ff){var _0x3f9ef6=this;return new Promise(function(_0x8906e1,_0x4aeb9f){return db[_0x2203('0x15')]['findAll']({'raw':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x18')]||null:null,'attributes':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['attributes']||null:null,'limit':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['limit']||null:null,'include':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')]['include']?_[_0x2203('0x19')](_0x4893ff['options']['include'],function(_0x226374){return{'model':db[_0x226374[_0x2203('0x1a')]],'as':_0x226374['as'],'attributes':_0x226374[_0x2203('0x1b')],'include':_0x226374[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x226374[_0x2203('0x1c')],function(_0x49c12){return{'model':db[_0x49c12[_0x2203('0x1a')]],'as':_0x49c12['as'],'attributes':_0x49c12['attributes'],'include':_0x49c12[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x49c12[_0x2203('0x1c')],function(_0x5f11bf){return{'model':db[_0x5f11bf[_0x2203('0x1a')]],'as':_0x5f11bf['as'],'attributes':_0x5f11bf[_0x2203('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd6e109){logger[_0x2203('0x11')](_0x2203('0x14'),_0x4893ff);logger[_0x2203('0xd')](_0x2203('0x14'),_0x4893ff,JSON[_0x2203('0x1d')](_0xd6e109));_0x8906e1(_0xd6e109);})[_0x2203('0x13')](function(_0x5a95c1){logger[_0x2203('0xe')](_0x2203('0x14'),_0x5a95c1[_0x2203('0x10')],_0x4893ff);_0x4aeb9f(_0x3f9ef6[_0x2203('0xe')](0x1f4,_0x5a95c1['message']));});});};exports[_0x2203('0x1e')]=function(_0x21ff0d){var _0x287c95=this;return new Promise(function(_0xf59954,_0x520602){return db[_0x2203('0x15')][_0x2203('0x1f')]({'raw':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x18')]||null:null,'attributes':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d[_0x2203('0x16')][_0x2203('0x1b')]||null:null,'include':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d['options'][_0x2203('0x1c')]?_[_0x2203('0x19')](_0x21ff0d['options'][_0x2203('0x1c')],function(_0x20fbe1){return{'model':db[_0x20fbe1[_0x2203('0x1a')]],'as':_0x20fbe1['as'],'attributes':_0x20fbe1[_0x2203('0x1b')],'include':_0x20fbe1[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x20fbe1[_0x2203('0x1c')],function(_0x44228e){return{'model':db[_0x44228e[_0x2203('0x1a')]],'as':_0x44228e['as'],'attributes':_0x44228e['attributes'],'include':_0x44228e[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x44228e['include'],function(_0x54b90b){return{'model':db[_0x54b90b[_0x2203('0x1a')]],'as':_0x54b90b['as'],'attributes':_0x54b90b['attributes']};}):[]};}):[]};}):[]:[]})[_0x2203('0x20')](function(_0x3b1eeb){logger[_0x2203('0x11')]('ShowTrunk',_0x21ff0d);logger['debug'](_0x2203('0x1e'),_0x21ff0d,JSON['stringify'](_0x3b1eeb));_0xf59954(_0x3b1eeb);})[_0x2203('0x13')](function(_0x5cfe5e){logger[_0x2203('0xe')]('ShowTrunk',_0x5cfe5e[_0x2203('0x10')],_0x21ff0d);_0x520602(_0x287c95[_0x2203('0xe')](0x1f4,_0x5cfe5e[_0x2203('0x10')]));});});}; \ No newline at end of file +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(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x1a85,0x178));var _0x51a8=function(_0x59ae80,_0x56b205){_0x59ae80=_0x59ae80-0x0;var _0x473bf9=_0x1a85[_0x59ae80];return _0x473bf9;};'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 diff --git a/server/api/user/index.js b/server/api/user/index.js index b9346cb..1a89dcb 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 _0x0d28=['/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','/:id/openchannel_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id/password','changePassword','delete','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./user.controller','isAuthenticated','get','describe','/whoami','whoami','/:id','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','addContacts','post','create','/create_many','addQueues','root','server/files/images/','format','%s-%s','originalname','single','file','addAvatar','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams'];(function(_0x425d5e,_0x3b9040){var _0x3cc67b=function(_0x121446){while(--_0x121446){_0x425d5e['push'](_0x425d5e['shift']());}};_0x3cc67b(++_0x3b9040);}(_0x0d28,0x94));var _0x80d2=function(_0x2c1923,_0x5446e9){_0x2c1923=_0x2c1923-0x0;var _0x73c9b4=_0x0d28[_0x2c1923];return _0x73c9b4;};'use strict';var multer=require(_0x80d2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x80d2('0x1'));var express=require(_0x80d2('0x2'));var router=express[_0x80d2('0x3')]();var auth=require(_0x80d2('0x4'));var interaction=require(_0x80d2('0x5'));var config=require('../../config/environment');var controller=require(_0x80d2('0x6'));router['get']('/',auth[_0x80d2('0x7')](),controller['index']);router[_0x80d2('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x80d2('0x9')]);router['get'](_0x80d2('0xa'),auth[_0x80d2('0x7')](),controller[_0x80d2('0xb')]);router['get']('/presence',auth[_0x80d2('0x7')](),controller['getPresence']);router['get'](_0x80d2('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x80d2('0x8')](_0x80d2('0xd'),controller[_0x80d2('0xe')]);router['get'](_0x80d2('0xf'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x10')]);router[_0x80d2('0x8')](_0x80d2('0x11'),auth['isAuthenticated'](),controller['getQueues']);router[_0x80d2('0x8')](_0x80d2('0x12'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x13')]);router['get'](_0x80d2('0x14'),auth[_0x80d2('0x7')](),controller['getGroups']);router['get'](_0x80d2('0x15'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x16')]);router[_0x80d2('0x8')]('/:id/screen_recordings',auth[_0x80d2('0x7')](),controller[_0x80d2('0x17')]);router['get']('/:id/chat/interactions',auth[_0x80d2('0x7')](),controller[_0x80d2('0x18')]);router[_0x80d2('0x8')](_0x80d2('0x19'),auth['isAuthenticated'](),controller[_0x80d2('0x1a')]);router[_0x80d2('0x8')](_0x80d2('0x1b'),auth['isAuthenticated'](),controller[_0x80d2('0x1c')]);router[_0x80d2('0x8')](_0x80d2('0x1d'),auth[_0x80d2('0x7')](),controller['getSmsInteractions']);router['get'](_0x80d2('0x1e'),auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0x80d2('0x8')](_0x80d2('0x1f'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x20')]);router[_0x80d2('0x8')](_0x80d2('0x21'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x22')]);router[_0x80d2('0x8')](_0x80d2('0x23'),auth[_0x80d2('0x7')](),controller['getLists']);router[_0x80d2('0x8')](_0x80d2('0x24'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x25')]);router[_0x80d2('0x8')](_0x80d2('0x26'),auth['isAuthenticated'](),controller[_0x80d2('0x27')]);router['get'](_0x80d2('0x28'),auth[_0x80d2('0x7')](),controller['getFaxAccounts']);router['get'](_0x80d2('0x29'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0x80d2('0x8')]('/:id/openchannel_accounts',auth[_0x80d2('0x7')](),controller[_0x80d2('0x2a')]);router[_0x80d2('0x8')](_0x80d2('0x2b'),auth[_0x80d2('0x7')](),controller['getSmsAccounts']);router[_0x80d2('0x8')](_0x80d2('0x2c'),auth['isAuthenticated'](),controller[_0x80d2('0x2d')]);router[_0x80d2('0x8')](_0x80d2('0x2e'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x2f')]);router[_0x80d2('0x8')](_0x80d2('0x30'),auth['isAuthenticated'](),controller['getSquareProjects']);router[_0x80d2('0x8')](_0x80d2('0x31'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x32')]);router[_0x80d2('0x8')](_0x80d2('0x33'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x34')]);router['post'](_0x80d2('0xf'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x35')]);router[_0x80d2('0x36')]('/',auth[_0x80d2('0x7')](),controller[_0x80d2('0x37')]);router[_0x80d2('0x36')](_0x80d2('0x38'),auth[_0x80d2('0x7')](),controller['bulkCreate']);router['post'](_0x80d2('0x11'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x39')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3877cf,_0x1714cb,_0x45239c){_0x45239c(null,path['join'](config[_0x80d2('0x3a')],_0x80d2('0x3b')));},'filename':function(_0x3d5efc,_0x418ce6,_0x2af536){_0x2af536(null,util[_0x80d2('0x3c')](_0x80d2('0x3d'),Date['now'](),_0x418ce6[_0x80d2('0x3e')]));}})});router['post']('/:id/avatar',upload[_0x80d2('0x3f')](_0x80d2('0x40')),controller[_0x80d2('0x41')]);router[_0x80d2('0x36')]('/:id/login',auth[_0x80d2('0x7')](),controller[_0x80d2('0x42')]);router[_0x80d2('0x36')](_0x80d2('0x43'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x44')]);router['post'](_0x80d2('0x45'),auth['isAuthenticated'](),controller[_0x80d2('0x46')]);router[_0x80d2('0x36')](_0x80d2('0x47'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x48')]);router[_0x80d2('0x36')](_0x80d2('0x21'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x49')]);router['post'](_0x80d2('0x4a'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x4b')]);router[_0x80d2('0x36')](_0x80d2('0x4c'),auth[_0x80d2('0x7')](),controller['addMailInteractions']);router[_0x80d2('0x36')](_0x80d2('0x4d'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x4e')]);router[_0x80d2('0x36')](_0x80d2('0x4f'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x50')]);router[_0x80d2('0x36')](_0x80d2('0x51'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x52')]);router[_0x80d2('0x36')](_0x80d2('0x53'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x54')]);router[_0x80d2('0x36')](_0x80d2('0x28'),auth[_0x80d2('0x7')](),controller['addFaxAccounts']);router[_0x80d2('0x36')](_0x80d2('0x29'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x55')]);router[_0x80d2('0x36')](_0x80d2('0x56'),auth[_0x80d2('0x7')](),controller['addOpenchannelAccounts']);router['post'](_0x80d2('0x2b'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x57')]);router[_0x80d2('0x36')](_0x80d2('0x2c'),auth['isAuthenticated'](),controller[_0x80d2('0x58')]);router[_0x80d2('0x36')](_0x80d2('0x2e'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x59')]);router['post'](_0x80d2('0x30'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x5a')]);router[_0x80d2('0x36')](_0x80d2('0x33'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x5b')]);router[_0x80d2('0x5c')](_0x80d2('0xc'),auth[_0x80d2('0x7')](),controller['update']);router['put'](_0x80d2('0x5d'),auth['isAuthenticated'](),controller[_0x80d2('0x5e')]);router[_0x80d2('0x5f')](_0x80d2('0x11'),auth[_0x80d2('0x7')](),controller['removeQueues']);router[_0x80d2('0x5f')](_0x80d2('0x21'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x60')]);router[_0x80d2('0x5f')](_0x80d2('0xc'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x61')]);router[_0x80d2('0x5f')](_0x80d2('0x4a'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x62')]);router['delete'](_0x80d2('0x4c'),auth[_0x80d2('0x7')](),controller['removeMailInteractions']);router[_0x80d2('0x5f')](_0x80d2('0x4d'),auth['isAuthenticated'](),controller[_0x80d2('0x63')]);router[_0x80d2('0x5f')]('/:id/sms_interactions',auth[_0x80d2('0x7')](),controller[_0x80d2('0x64')]);router[_0x80d2('0x5f')]('/:id/openchannel_interactions',auth[_0x80d2('0x7')](),controller[_0x80d2('0x65')]);router[_0x80d2('0x5f')](_0x80d2('0x53'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x66')]);router[_0x80d2('0x5f')](_0x80d2('0x28'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x67')]);router[_0x80d2('0x5f')](_0x80d2('0x29'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x68')]);router[_0x80d2('0x5f')](_0x80d2('0x56'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x69')]);router[_0x80d2('0x5f')](_0x80d2('0x2b'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x6a')]);router[_0x80d2('0x5f')](_0x80d2('0x2c'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x6b')]);router[_0x80d2('0x5f')](_0x80d2('0x2e'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x6c')]);router[_0x80d2('0x5f')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x80d2('0x6d')]);router['delete'](_0x80d2('0x33'),auth[_0x80d2('0x7')](),controller[_0x80d2('0x6e')]);module['exports']=router; \ No newline at end of file +var _0x609e=['/:id/square_projects','getSquareProjects','/:id/scheduled_calls','post','addContacts','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','root','%s-%s','now','originalname','single','file','/:id/login','/:id/logout','/:id/pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addOpenchannelAccounts','addChatWebsites','addSquareProjects','/:id/api_key','createApiKey','update','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','removeFaxInteractions','removeSmsInteractions','removeFaxAccounts','/:id/openchannel_accounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','path','connect-timeout','express','Router','../../components/auth/service','./user.controller','get','isAuthenticated','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','/:id/contacts','getContacts','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getWhatsappAccounts'];(function(_0x999f30,_0x2b8d55){var _0x2b4ea9=function(_0x3639fc){while(--_0x3639fc){_0x999f30['push'](_0x999f30['shift']());}};_0x2b4ea9(++_0x2b8d55);}(_0x609e,0x176));var _0xe609=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x609e[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe609('0x0'));var timeout=require(_0xe609('0x1'));var express=require(_0xe609('0x2'));var router=express[_0xe609('0x3')]();var auth=require(_0xe609('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe609('0x5'));router[_0xe609('0x6')]('/',auth[_0xe609('0x7')](),controller['index']);router['get'](_0xe609('0x8'),auth[_0xe609('0x7')](),controller[_0xe609('0x9')]);router[_0xe609('0x6')](_0xe609('0xa'),auth[_0xe609('0x7')](),controller[_0xe609('0xb')]);router[_0xe609('0x6')](_0xe609('0xc'),auth[_0xe609('0x7')](),controller[_0xe609('0xd')]);router[_0xe609('0x6')](_0xe609('0xe'),auth[_0xe609('0x7')](),controller[_0xe609('0xf')]);router[_0xe609('0x6')](_0xe609('0x10'),controller['getAvatar']);router[_0xe609('0x6')](_0xe609('0x11'),auth[_0xe609('0x7')](),controller[_0xe609('0x12')]);router[_0xe609('0x6')]('/:id/queues',auth['isAuthenticated'](),controller['getQueues']);router[_0xe609('0x6')](_0xe609('0x13'),auth['isAuthenticated'](),controller[_0xe609('0x14')]);router[_0xe609('0x6')](_0xe609('0x15'),auth[_0xe609('0x7')](),controller[_0xe609('0x16')]);router[_0xe609('0x6')](_0xe609('0x17'),auth['isAuthenticated'](),controller[_0xe609('0x18')]);router[_0xe609('0x6')]('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0xe609('0x19')]);router[_0xe609('0x6')](_0xe609('0x1a'),auth[_0xe609('0x7')](),controller[_0xe609('0x1b')]);router['get'](_0xe609('0x1c'),auth[_0xe609('0x7')](),controller[_0xe609('0x1d')]);router[_0xe609('0x6')](_0xe609('0x1e'),auth[_0xe609('0x7')](),controller['getMailInteractions']);router['get'](_0xe609('0x1f'),auth[_0xe609('0x7')](),controller[_0xe609('0x20')]);router[_0xe609('0x6')](_0xe609('0x21'),auth['isAuthenticated'](),controller[_0xe609('0x22')]);router[_0xe609('0x6')](_0xe609('0x23'),auth['isAuthenticated'](),controller[_0xe609('0x24')]);router['get'](_0xe609('0x25'),auth[_0xe609('0x7')](),controller['getTeams']);router[_0xe609('0x6')](_0xe609('0x26'),auth[_0xe609('0x7')](),controller[_0xe609('0x27')]);router[_0xe609('0x6')](_0xe609('0x28'),auth[_0xe609('0x7')](),controller[_0xe609('0x29')]);router[_0xe609('0x6')]('/:id/prefixes',auth[_0xe609('0x7')](),controller[_0xe609('0x2a')]);router[_0xe609('0x6')]('/:id/fax_accounts',auth[_0xe609('0x7')](),controller['getFaxAccounts']);router['get'](_0xe609('0x2b'),auth[_0xe609('0x7')](),controller[_0xe609('0x2c')]);router[_0xe609('0x6')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xe609('0x2d')]);router[_0xe609('0x6')](_0xe609('0x2e'),auth[_0xe609('0x7')](),controller[_0xe609('0x2f')]);router[_0xe609('0x6')](_0xe609('0x30'),auth['isAuthenticated'](),controller['getChatWebsites']);router[_0xe609('0x6')]('/:id/whatsapp_accounts',auth[_0xe609('0x7')](),controller[_0xe609('0x31')]);router[_0xe609('0x6')](_0xe609('0x32'),auth[_0xe609('0x7')](),controller[_0xe609('0x33')]);router['get'](_0xe609('0x34'),auth[_0xe609('0x7')](),controller['getScheduledCalls']);router['get']('/:id/api_key',auth[_0xe609('0x7')](),controller['getApiKey']);router[_0xe609('0x35')](_0xe609('0x11'),auth[_0xe609('0x7')](),controller[_0xe609('0x36')]);router[_0xe609('0x35')]('/',auth[_0xe609('0x7')](),controller['create']);router[_0xe609('0x35')](_0xe609('0x37'),auth[_0xe609('0x7')](),controller[_0xe609('0x38')]);router[_0xe609('0x35')](_0xe609('0x39'),auth[_0xe609('0x7')](),controller[_0xe609('0x3a')]);var upload=multer({'storage':multer[_0xe609('0x3b')]({'destination':function(_0x27940b,_0x3c9135,_0x24b904){_0x24b904(null,path['join'](config[_0xe609('0x3c')],'server/files/images/'));},'filename':function(_0x4f6980,_0x2959ce,_0x2106b3){_0x2106b3(null,util['format'](_0xe609('0x3d'),Date[_0xe609('0x3e')](),_0x2959ce[_0xe609('0x3f')]));}})});router[_0xe609('0x35')](_0xe609('0x10'),upload[_0xe609('0x40')](_0xe609('0x41')),controller['addAvatar']);router[_0xe609('0x35')](_0xe609('0x42'),auth[_0xe609('0x7')](),controller['login']);router[_0xe609('0x35')](_0xe609('0x43'),auth[_0xe609('0x7')](),controller['logout']);router[_0xe609('0x35')](_0xe609('0x44'),auth[_0xe609('0x7')](),controller['pause']);router['post'](_0xe609('0x45'),auth[_0xe609('0x7')](),controller[_0xe609('0x46')]);router[_0xe609('0x35')](_0xe609('0x25'),auth[_0xe609('0x7')](),controller['addTeams']);router[_0xe609('0x35')](_0xe609('0x47'),auth[_0xe609('0x7')](),controller[_0xe609('0x48')]);router['post'](_0xe609('0x49'),auth[_0xe609('0x7')](),controller['addMailInteractions']);router[_0xe609('0x35')](_0xe609('0x4a'),auth[_0xe609('0x7')](),controller[_0xe609('0x4b')]);router[_0xe609('0x35')](_0xe609('0x4c'),auth[_0xe609('0x7')](),controller['addSmsInteractions']);router[_0xe609('0x35')](_0xe609('0x4d'),auth[_0xe609('0x7')](),controller[_0xe609('0x4e')]);router['post'](_0xe609('0x4f'),auth['isAuthenticated'](),controller[_0xe609('0x50')]);router[_0xe609('0x35')](_0xe609('0x51'),auth[_0xe609('0x7')](),controller[_0xe609('0x52')]);router[_0xe609('0x35')](_0xe609('0x2b'),auth[_0xe609('0x7')](),controller['addMailAccounts']);router[_0xe609('0x35')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xe609('0x53')]);router[_0xe609('0x35')](_0xe609('0x2e'),auth[_0xe609('0x7')](),controller['addSmsAccounts']);router[_0xe609('0x35')]('/:id/chat_websites',auth[_0xe609('0x7')](),controller[_0xe609('0x54')]);router[_0xe609('0x35')]('/:id/whatsapp_accounts',auth[_0xe609('0x7')](),controller['addWhatsappAccounts']);router[_0xe609('0x35')](_0xe609('0x32'),auth[_0xe609('0x7')](),controller[_0xe609('0x55')]);router[_0xe609('0x35')](_0xe609('0x56'),auth[_0xe609('0x7')](),controller[_0xe609('0x57')]);router['put']('/:id',auth[_0xe609('0x7')](),controller[_0xe609('0x58')]);router['put'](_0xe609('0x59'),auth['isAuthenticated'](),controller[_0xe609('0x5a')]);router['delete'](_0xe609('0x39'),auth['isAuthenticated'](),controller[_0xe609('0x5b')]);router[_0xe609('0x5c')]('/:id/teams',auth[_0xe609('0x7')](),controller[_0xe609('0x5d')]);router[_0xe609('0x5c')](_0xe609('0xe'),auth['isAuthenticated'](),controller[_0xe609('0x5e')]);router[_0xe609('0x5c')](_0xe609('0x47'),auth[_0xe609('0x7')](),controller['removeChatInteractions']);router[_0xe609('0x5c')](_0xe609('0x49'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0xe609('0x5c')](_0xe609('0x4a'),auth[_0xe609('0x7')](),controller[_0xe609('0x5f')]);router[_0xe609('0x5c')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xe609('0x60')]);router[_0xe609('0x5c')](_0xe609('0x4d'),auth[_0xe609('0x7')](),controller['removeOpenchannelInteractions']);router[_0xe609('0x5c')](_0xe609('0x4f'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0xe609('0x5c')](_0xe609('0x51'),auth['isAuthenticated'](),controller[_0xe609('0x61')]);router['delete']('/:id/mail_accounts',auth[_0xe609('0x7')](),controller['removeMailAccounts']);router[_0xe609('0x5c')](_0xe609('0x62'),auth[_0xe609('0x7')](),controller[_0xe609('0x63')]);router[_0xe609('0x5c')](_0xe609('0x2e'),auth['isAuthenticated'](),controller[_0xe609('0x64')]);router['delete']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xe609('0x65')]);router[_0xe609('0x5c')]('/:id/whatsapp_accounts',auth[_0xe609('0x7')](),controller[_0xe609('0x66')]);router[_0xe609('0x5c')]('/:id/square_projects',auth[_0xe609('0x7')](),controller[_0xe609('0x67')]);router[_0xe609('0x5c')](_0xe609('0x56'),auth[_0xe609('0x7')](),controller[_0xe609('0x68')]);module[_0xe609('0x69')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 5e02303..a6a75dc 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 _0xbae3=['getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','auto','nonat','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','active','passive','update','showWebBar','isArray','encryption','avpf','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','force_avp','dtlsenable','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','moment','util','lodash','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','user','agent','telephone','local','INTEGER','accountcode','format','BOOLEAN','DATE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join'];(function(_0x29639c,_0x3bf9cf){var _0x4d10a6=function(_0x1bb1b7){while(--_0x1bb1b7){_0x29639c['push'](_0x29639c['shift']());}};_0x4d10a6(++_0x3bf9cf);}(_0xbae3,0xe1));var _0x3bae=function(_0x36d199,_0x45242f){_0x36d199=_0x36d199-0x0;var _0x3ac35b=_0xbae3[_0x36d199];return _0x3ac35b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3bae('0x0'));var util=require(_0x3bae('0x1'));var _=require(_0x3bae('0x2'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3bae('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x594427){this[_0x3bae('0x4')](_0x3bae('0x3'),_0x594427);this[_0x3bae('0x4')](_0x3bae('0x5'),_0x594427);},'comment':_0x3bae('0x6')},'fullname':{'type':Sequelize[_0x3bae('0x7')],'allowNull':![],'set':function(_0x24f412){this['setDataValue'](_0x3bae('0x8'),_0x24f412);this[_0x3bae('0x4')](_0x3bae('0x9'),util['format'](_0x3bae('0xa'),_0x24f412,this['getDataValue'](_0x3bae('0xb'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3bae('0x7')],'allowNull':![],'unique':_0x3bae('0xc'),'validate':{'isEmail':!![]},'set':function(_0x513641){if(_0x513641){this[_0x3bae('0x4')](_0x3bae('0xc'),_0x513641[_0x3bae('0xd')]());}}},'role':{'type':Sequelize[_0x3bae('0xe')]('admin',_0x3bae('0xf'),_0x3bae('0x10'),_0x3bae('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x3bae('0x7')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x3bae('0x7')],'defaultValue':_0x3bae('0x12')},'internal':{'type':Sequelize[_0x3bae('0x13')](0xb),'allowNull':![],'unique':_0x3bae('0xb'),'set':function(_0x29d238){this[_0x3bae('0x4')]('internal',_0x29d238);this[_0x3bae('0x4')](_0x3bae('0x14'),_0x29d238);this[_0x3bae('0x4')](_0x3bae('0x9'),util[_0x3bae('0x15')](_0x3bae('0xa'),this['getDataValue']('fullname'),_0x29d238));}},'salt':{'type':Sequelize[_0x3bae('0x7')]},'phone':{'type':Sequelize[_0x3bae('0x7')]},'mobile':{'type':Sequelize[_0x3bae('0x7')]},'address':{'type':Sequelize[_0x3bae('0x7')]},'zipcode':{'type':Sequelize[_0x3bae('0x7')]},'userpic':{'type':Sequelize[_0x3bae('0x7')]},'city':{'type':Sequelize[_0x3bae('0x7')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x3bae('0x17')]},'voicePause':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x3bae('0x17')]},'chatCapacity':{'type':Sequelize[_0x3bae('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x3bae('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x3bae('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x3bae('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x3bae('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x3bae('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x3bae('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'host':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![],'defaultValue':_0x3bae('0x18')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x3bae('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x3bae('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x3bae('0x19'),_0x3bae('0xf'),_0x3bae('0x1a')),'allowNull':!![],'defaultValue':_0x3bae('0x19')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x3bae('0x1b')},'callingpres':{'type':Sequelize[_0x3bae('0xe')](_0x3bae('0x1c'),_0x3bae('0x1d'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x3bae('0x1e'),_0x3bae('0x1f'),_0x3bae('0x20'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'transport':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![],'defaultValue':_0x3bae('0x21'),'set':function(_0x52c723){this[_0x3bae('0x4')](_0x3bae('0x22'),_0x52c723?_0x52c723[_0x3bae('0x23')](','):null);},'get':function(){return this[_0x3bae('0x24')](_0x3bae('0x22'))?this[_0x3bae('0x24')]('transport')[_0x3bae('0x25')](','):null;},'comment':_0x3bae('0x26')},'dtmfmode':{'type':Sequelize['ENUM'](_0x3bae('0x27'),'info','shortinfo','inband',_0x3bae('0x28')),'allowNull':!![],'defaultValue':_0x3bae('0x27')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x3bae('0x29'),'update',_0x3bae('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3bae('0xe')](_0x3bae('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'nat':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![],'defaultValue':_0x3bae('0x2c'),'set':function(_0x40dafc){this['setDataValue'](_0x3bae('0x2d'),_0x40dafc?_0x40dafc['join'](','):null);},'get':function(){return this[_0x3bae('0x24')](_0x3bae('0x2d'))?this[_0x3bae('0x24')](_0x3bae('0x2d'))[_0x3bae('0x25')](','):null;},'comment':_0x3bae('0x2e')},'callgroup':{'type':Sequelize[_0x3bae('0x7')]},'namedcallgroup':{'type':Sequelize[_0x3bae('0x7')]},'pickupgroup':{'type':Sequelize[_0x3bae('0x7')]},'namedpickupgroup':{'type':Sequelize[_0x3bae('0x7')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3bae('0x7')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3bae('0x2f')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3bae('0x30'),'set':function(_0x3cad63){this['setDataValue']('allow',_0x3cad63?_0x3cad63[_0x3bae('0x23')](';'):_0x3bae('0x30'));},'get':function(){return this[_0x3bae('0x24')](_0x3bae('0x31'))?this[_0x3bae('0x24')](_0x3bae('0x31'))[_0x3bae('0x25')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x3bae('0xe')](_0x3bae('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![],'set':function(_0x387a70){this[_0x3bae('0x4')]('insecure',_0x387a70?_0x387a70[_0x3bae('0x23')](','):null);},'get':function(){return this[_0x3bae('0x24')](_0x3bae('0x32'))?this[_0x3bae('0x24')](_0x3bae('0x32'))[_0x3bae('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x3bae('0xe')](_0x3bae('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3bae('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3bae('0xe')](_0x3bae('0x2b'),'no',_0x3bae('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x3bae('0xe')](_0x3bae('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x3bae('0xe')](_0x3bae('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x3bae('0x34')},'amaflags':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x3bae('0xe')](_0x3bae('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x3bae('0x2b')},'busylevel':{'type':Sequelize[_0x3bae('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x3bae('0xe')](_0x3bae('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x3bae('0xe')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x3bae('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x3bae('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'template':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x3bae('0xe')](_0x3bae('0x2b'),'no',_0x3bae('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x3bae('0xe')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x3bae('0xe')](_0x3bae('0x36'),_0x3bae('0x37'),_0x3bae('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x3bae('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x3bae('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x3bae('0xe')](_0x3bae('0x39'),_0x3bae('0x3a')),'allowNull':!![],'defaultValue':_0x3bae('0x3a')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x3bae('0xe')](_0x3bae('0x2b'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x3bae('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x3bae('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x3bae('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x3bae('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x3bae('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x3bae('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x3bae('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x3bae('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x3bae('0xe')](_0x3bae('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x3bae('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x3bae('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x3bae('0xe')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x3bae('0xe')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x3bae('0xe')](_0x3bae('0x2b'),'no','fingerprint',_0x3bae('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x3bae('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x3bae('0xe')](_0x3bae('0x3c'),_0x3bae('0x3d'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x3bae('0xe')](_0x3bae('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x3bae('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x3bae('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x3bae('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x3bae('0xe')](_0x3bae('0x2b'),'no',_0x3bae('0x29'),_0x3bae('0x3e'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x3bae('0x7')]},'resetPasswordExpires':{'type':Sequelize[_0x3bae('0x17')]},'passwordResetAt':{'type':Sequelize[_0x3bae('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x3bae('0x7')]},'showWebBar':{'type':Sequelize[_0x3bae('0x13')],'defaultValue':0x0,'set':function(_0x3ff04c){this[_0x3bae('0x4')](_0x3bae('0x3f'),_0x3ff04c);var _0x23400e=this['get']({'plain':!![]});switch(_0x3ff04c){case 0x0:case 0x1:var _0x24b597=_0x23400e[_0x3bae('0x22')]?_[_0x3bae('0x40')](_0x23400e[_0x3bae('0x22')])?_0x23400e['transport']['join']():_0x23400e['transport']:_0x3bae('0x21');if(_0x24b597==='wss'){_0x24b597='udp';}this[_0x3bae('0x4')](_0x3bae('0x22'),_0x24b597);this[_0x3bae('0x4')](_0x3bae('0x41'),'no');this[_0x3bae('0x4')](_0x3bae('0x42'),null);this[_0x3bae('0x4')]('force_avp',null);this['setDataValue'](_0x3bae('0x43'),null);this['setDataValue']('dtlsenable',null);this[_0x3bae('0x4')](_0x3bae('0x44'),null);this['setDataValue'](_0x3bae('0x45'),null);this[_0x3bae('0x4')](_0x3bae('0x46'),null);this[_0x3bae('0x4')](_0x3bae('0x47'),null);this[_0x3bae('0x4')](_0x3bae('0x48'),'no');break;case 0x2:this[_0x3bae('0x4')](_0x3bae('0x22'),_0x3bae('0x49'));this[_0x3bae('0x4')](_0x3bae('0x41'),_0x3bae('0x2b'));this['setDataValue'](_0x3bae('0x42'),_0x3bae('0x2b'));this[_0x3bae('0x4')](_0x3bae('0x4a'),_0x3bae('0x2b'));this['setDataValue'](_0x3bae('0x43'),_0x3bae('0x2b'));this[_0x3bae('0x4')](_0x3bae('0x4b'),'yes');this[_0x3bae('0x4')]('dtlsverify','no');this['setDataValue']('dtlssetup',_0x3bae('0x4c'));this[_0x3bae('0x4')](_0x3bae('0x46'),_0x23400e[_0x3bae('0x46')]||_0x3bae('0x4d'));this[_0x3bae('0x4')](_0x3bae('0x47'),_0x23400e[_0x3bae('0x47')]||_0x3bae('0x4e'));this['setDataValue'](_0x3bae('0x48'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x500090){this[_0x3bae('0x4')](_0x3bae('0x4f'),_0x500090?_0x500090[_0x3bae('0x23')](','):[]);},'get':function(){return this[_0x3bae('0x24')](_0x3bae('0x4f'))?_['map'](this[_0x3bae('0x24')]('permissions')[_0x3bae('0x25')](','),function(_0x208a09){return parseInt(_0x208a09,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x3bae('0x7')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x3bae('0x7')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x3bae('0x7')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x3bae('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x3bae('0xe')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x3bae('0x7')]},'phoneBarEnableJaws':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3bae('0x24')](_0x3bae('0x50'))?this[_0x3bae('0x24')](_0x3bae('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x3bae('0x7')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x3bae('0x7')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':![],'set':function(_0x32ca62){if(typeof _0x32ca62===_0x3bae('0x51')){var _0xa29974=_0x32ca62==='1'?!![]:_0x32ca62==='0'?![]:_0x32ca62===_0x3bae('0x52')?!![]:_0x32ca62===_0x3bae('0x53')?![]:![];this[_0x3bae('0x4')]('screenrecording',_0xa29974);}else{this['setDataValue'](_0x3bae('0x54'),_0x32ca62);}}},'blocked':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':![],'set':function(_0x5870a8){this[_0x3bae('0x4')](_0x3bae('0x55'),_0x5870a8);if(_0x5870a8===!![]){this[_0x3bae('0x4')](_0x3bae('0x56'),moment());this['setDataValue']('loginAttempts',0x0);}else{this['setDataValue'](_0x3bae('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0x3bae('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x3bae('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x3bae('0x16')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6fde=['actpass','update,nonat','showWebBar','isArray','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blockedAt','sequelize','util','exports','name','setDataValue','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','user','telephone','INTEGER','accountcode','BOOLEAN','DATE','dynamic','ENUM','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','passive'];(function(_0x2c6120,_0x1f3e60){var _0x5fb114=function(_0x45a72d){while(--_0x45a72d){_0x2c6120['push'](_0x2c6120['shift']());}};_0x5fb114(++_0x1f3e60);}(_0x6fde,0xc3));var _0xe6fd=function(_0xf83832,_0x49bf0d){_0xf83832=_0xf83832-0x0;var _0x2f3b7c=_0x6fde[_0xf83832];return _0x2f3b7c;};'use strict';var Sequelize=require(_0xe6fd('0x0'));var moment=require('moment');var util=require(_0xe6fd('0x1'));var _=require('lodash');module[_0xe6fd('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe6fd('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x291c39){this['setDataValue'](_0xe6fd('0x3'),_0x291c39);this[_0xe6fd('0x4')]('defaultuser',_0x291c39);},'comment':_0xe6fd('0x5')},'fullname':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':![],'set':function(_0x1ae0ac){this['setDataValue'](_0xe6fd('0x7'),_0x1ae0ac);this[_0xe6fd('0x4')](_0xe6fd('0x8'),util[_0xe6fd('0x9')](_0xe6fd('0xa'),_0x1ae0ac,this[_0xe6fd('0xb')](_0xe6fd('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':![],'unique':_0xe6fd('0xd'),'validate':{'isEmail':!![]},'set':function(_0x33348b){if(_0x33348b){this[_0xe6fd('0x4')](_0xe6fd('0xd'),_0x33348b[_0xe6fd('0xe')]());}}},'role':{'type':Sequelize['ENUM']('admin',_0xe6fd('0xf'),'agent',_0xe6fd('0x10')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xe6fd('0x6')],'defaultValue':'local'},'internal':{'type':Sequelize[_0xe6fd('0x11')](0xb),'allowNull':![],'unique':_0xe6fd('0xc'),'set':function(_0x327bc6){this[_0xe6fd('0x4')](_0xe6fd('0xc'),_0x327bc6);this['setDataValue'](_0xe6fd('0x12'),_0x327bc6);this[_0xe6fd('0x4')](_0xe6fd('0x8'),util[_0xe6fd('0x9')](_0xe6fd('0xa'),this[_0xe6fd('0xb')](_0xe6fd('0x7')),_0x327bc6));}},'salt':{'type':Sequelize[_0xe6fd('0x6')]},'phone':{'type':Sequelize[_0xe6fd('0x6')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0xe6fd('0x6')]},'zipcode':{'type':Sequelize[_0xe6fd('0x6')]},'userpic':{'type':Sequelize[_0xe6fd('0x6')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xe6fd('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xe6fd('0x6')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xe6fd('0x11')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xe6fd('0x11')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xe6fd('0x11')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xe6fd('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'host':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![],'defaultValue':_0xe6fd('0x15')},'ipaddr':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xe6fd('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xe6fd('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xe6fd('0x16')](_0xe6fd('0x17'),_0xe6fd('0xf'),'peer'),'allowNull':!![],'defaultValue':_0xe6fd('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xe6fd('0x18')},'callingpres':{'type':Sequelize[_0xe6fd('0x16')](_0xe6fd('0x19'),'ALLOWED_PASSED_SCREEN',_0xe6fd('0x1a'),_0xe6fd('0x1b'),'PROHIB_NOT_SCREENED',_0xe6fd('0x1c'),_0xe6fd('0x1d'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'transport':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![],'defaultValue':_0xe6fd('0x1e'),'set':function(_0x34f8b2){this[_0xe6fd('0x4')]('transport',_0x34f8b2?_0x34f8b2[_0xe6fd('0x1f')](','):null);},'get':function(){return this[_0xe6fd('0xb')](_0xe6fd('0x20'))?this[_0xe6fd('0xb')](_0xe6fd('0x20'))[_0xe6fd('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xe6fd('0x16')](_0xe6fd('0x22'),_0xe6fd('0x23'),_0xe6fd('0x24'),_0xe6fd('0x25'),_0xe6fd('0x26')),'allowNull':!![],'defaultValue':_0xe6fd('0x22')},'directmedia':{'type':Sequelize['ENUM'](_0xe6fd('0x27'),'no',_0xe6fd('0x28'),_0xe6fd('0x29'),_0xe6fd('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xe6fd('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'nat':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0xe037ab){this[_0xe6fd('0x4')](_0xe6fd('0x2b'),_0xe037ab?_0xe037ab[_0xe6fd('0x1f')](','):null);},'get':function(){return this['getDataValue'](_0xe6fd('0x2b'))?this['getDataValue']('nat')[_0xe6fd('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xe6fd('0x6')]},'namedcallgroup':{'type':Sequelize[_0xe6fd('0x6')]},'pickupgroup':{'type':Sequelize[_0xe6fd('0x6')]},'namedpickupgroup':{'type':Sequelize[_0xe6fd('0x6')]},'language':{'type':Sequelize[_0xe6fd('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe6fd('0x6')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe6fd('0x2c')},'allow':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':![],'defaultValue':_0xe6fd('0x2d'),'set':function(_0x2b677e){this['setDataValue'](_0xe6fd('0x2e'),_0x2b677e?_0x2b677e[_0xe6fd('0x1f')](';'):_0xe6fd('0x2d'));},'get':function(){return this[_0xe6fd('0xb')](_0xe6fd('0x2e'))?this[_0xe6fd('0xb')]('allow')[_0xe6fd('0x21')](';'):null;},'comment':_0xe6fd('0x2f')},'autoframing':{'type':Sequelize[_0xe6fd('0x16')](_0xe6fd('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x560b6a){this[_0xe6fd('0x4')]('insecure',_0x560b6a?_0x560b6a[_0xe6fd('0x1f')](','):null);},'get':function(){return this[_0xe6fd('0xb')](_0xe6fd('0x30'))?this[_0xe6fd('0xb')](_0xe6fd('0x30'))['split'](','):null;},'comment':_0xe6fd('0x31')},'trustrpid':{'type':Sequelize['ENUM'](_0xe6fd('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe6fd('0x16')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0xe6fd('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xe6fd('0x16')](_0xe6fd('0x27'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xe6fd('0x16')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xe6fd('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![],'defaultValue':_0xe6fd('0x33')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xe6fd('0x16')](_0xe6fd('0x27'),'no'),'allowNull':!![],'defaultValue':_0xe6fd('0x27')},'busylevel':{'type':Sequelize[_0xe6fd('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xe6fd('0x16')](_0xe6fd('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xe6fd('0x16')](_0xe6fd('0x27'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0xe6fd('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xe6fd('0x16')](_0xe6fd('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xe6fd('0x16')](_0xe6fd('0x27'),'no',_0xe6fd('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xe6fd('0x16')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xe6fd('0x16')](_0xe6fd('0x35'),_0xe6fd('0x36'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xe6fd('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xe6fd('0x11')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xe6fd('0x16')](_0xe6fd('0x37'),'uas'),'allowNull':!![],'defaultValue':_0xe6fd('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xe6fd('0x16')](_0xe6fd('0x27'),'no'),'allowNull':!![],'defaultValue':_0xe6fd('0x27')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xe6fd('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xe6fd('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xe6fd('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xe6fd('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xe6fd('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xe6fd('0x11')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xe6fd('0x16')](_0xe6fd('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe6fd('0x16')](_0xe6fd('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xe6fd('0x16')](_0xe6fd('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xe6fd('0x16')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xe6fd('0x27'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xe6fd('0x27'),'no',_0xe6fd('0x39'),_0xe6fd('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xe6fd('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xe6fd('0x16')]('active',_0xe6fd('0x3b'),_0xe6fd('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xe6fd('0x16')](_0xe6fd('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xe6fd('0x16')](_0xe6fd('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xe6fd('0x16')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xe6fd('0x16')](_0xe6fd('0x27'),'no',_0xe6fd('0x28'),_0xe6fd('0x29'),_0xe6fd('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xe6fd('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xe6fd('0x6')]},'showWebBar':{'type':Sequelize[_0xe6fd('0x11')],'defaultValue':0x0,'set':function(_0x393077){this[_0xe6fd('0x4')](_0xe6fd('0x3e'),_0x393077);var _0x3eb370=this['get']({'plain':!![]});switch(_0x393077){case 0x0:case 0x1:var _0x2d03b6=_0x3eb370[_0xe6fd('0x20')]?_[_0xe6fd('0x3f')](_0x3eb370[_0xe6fd('0x20')])?_0x3eb370[_0xe6fd('0x20')]['join']():_0x3eb370[_0xe6fd('0x20')]:'udp';if(_0x2d03b6===_0xe6fd('0x40')){_0x2d03b6=_0xe6fd('0x1e');}this[_0xe6fd('0x4')](_0xe6fd('0x20'),_0x2d03b6);this['setDataValue'](_0xe6fd('0x41'),'no');this['setDataValue'](_0xe6fd('0x42'),null);this[_0xe6fd('0x4')]('force_avp',null);this[_0xe6fd('0x4')](_0xe6fd('0x43'),null);this[_0xe6fd('0x4')](_0xe6fd('0x44'),null);this[_0xe6fd('0x4')](_0xe6fd('0x45'),null);this[_0xe6fd('0x4')]('dtlssetup',null);this[_0xe6fd('0x4')](_0xe6fd('0x46'),null);this['setDataValue'](_0xe6fd('0x47'),null);this['setDataValue'](_0xe6fd('0x48'),'no');break;case 0x2:this[_0xe6fd('0x4')](_0xe6fd('0x20'),_0xe6fd('0x40'));this[_0xe6fd('0x4')]('encryption',_0xe6fd('0x27'));this[_0xe6fd('0x4')](_0xe6fd('0x42'),'yes');this[_0xe6fd('0x4')](_0xe6fd('0x49'),'yes');this[_0xe6fd('0x4')](_0xe6fd('0x43'),_0xe6fd('0x27'));this[_0xe6fd('0x4')]('dtlsenable','yes');this['setDataValue'](_0xe6fd('0x45'),'no');this[_0xe6fd('0x4')]('dtlssetup',_0xe6fd('0x3c'));this[_0xe6fd('0x4')](_0xe6fd('0x46'),_0x3eb370[_0xe6fd('0x46')]||_0xe6fd('0x4a'));this['setDataValue'](_0xe6fd('0x47'),_0x3eb370['dtlsprivatekey']||_0xe6fd('0x4b'));this['setDataValue'](_0xe6fd('0x48'),_0xe6fd('0x27'));break;default:}}},'permissions':{'type':Sequelize[_0xe6fd('0x4c')],'set':function(_0x2f0fcc){this[_0xe6fd('0x4')](_0xe6fd('0x4d'),_0x2f0fcc?_0x2f0fcc['join'](','):[]);},'get':function(){return this[_0xe6fd('0xb')](_0xe6fd('0x4d'))?_[_0xe6fd('0x4e')](this[_0xe6fd('0xb')](_0xe6fd('0x4d'))[_0xe6fd('0x21')](','),function(_0xe50047){return parseInt(_0xe50047,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xe6fd('0x6')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xe6fd('0x6')]},'phoneBarUnconditional':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xe6fd('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xe6fd('0x16')](_0xe6fd('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xe6fd('0x4f')],'get':function(){return this['getDataValue'](_0xe6fd('0x50'))?this['getDataValue'](_0xe6fd('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xe6fd('0x6')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xe6fd('0x6')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':![],'set':function(_0x43f612){if(typeof _0x43f612==='string'){var _0x325d53=_0x43f612==='1'?!![]:_0x43f612==='0'?![]:_0x43f612===_0xe6fd('0x51')?!![]:_0x43f612===_0xe6fd('0x52')?![]:![];this['setDataValue'](_0xe6fd('0x53'),_0x325d53);}else{this[_0xe6fd('0x4')](_0xe6fd('0x53'),_0x43f612);}}},'blocked':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':![],'set':function(_0x394c00){this['setDataValue']('blocked',_0x394c00);if(_0x394c00===!![]){this[_0xe6fd('0x4')](_0xe6fd('0x54'),moment());this[_0xe6fd('0x4')]('loginAttempts',0x0);}else{this[_0xe6fd('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xe6fd('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xe6fd('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xe6fd('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 8f1ed52..4a7be44 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 _0x88c8=['from','isNil','mailbox','VoiceMail','email','permissions','101','102','103','104','105','106','107','108','109','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','userProfileId','UserProfileSection','Telephones','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','push','all','each','isEmpty','compact','changePassword','params','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','oldPassword','Wrong\x20credentials','Setting','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','penalty','spread','QueueId','emit','voice','online','SIP/%s','upsert','remove','destroy','userpic','file','filename','getAvatar','root','download','existsSync','join','server/files/images/','getContacts','CmContact','CmList','List','Tag','Tags','color','tag','getQueues','Queue','Queues','Unknown\x20role','getVoiceQueuesRt','UserVoiceQueueRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','mobile','LOCAL/%s@from-sip/n','intrf','format','user:%s','user:forcelogout','headers','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','concat','isMiddleware','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','mail','chat','fax','sms','whatsapp','openchannel','%s%s','getTeams','Team','addTeams','setDataValue','Voice','Chat','getMailQueues','Sms','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','getDataValue','Queue:save','removeTeams','getChatQueues','getWhatsappQueues','transaction','removeAgent','Queue:remove','getLists','getAgents','values','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','$and','$or','$gt','$gte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$notILike','$overlap','$contains','$any','firstName','lastName','Contact','dialActive','CmHopper','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','token','apiKeyNonce','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','teams','queues','resolve','VoiceQueue','inbound','toString','desc','asc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','request','offline','idle','unknown','unavailable','voiceStatus','slice','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./user.socket','register','jayson/promise','client','http','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','get','role','admin','Users','user','Agents','agent','telephone','filter','map','value','includes','find','name','UserProfileResource','stack','send','index','User','fieldName','type','key','model','password','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','sequelize','lower','col','merge','options','include','findAll','rows','show','differenceBy','rawAttributes','salt','includeAll','update','body','describe','addContacts','ids','omit','internal','findById','securePassword','validatePasswordPattern','max','min_internal','QueryTypes','SELECT'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x88c8,0x117));var _0x888c=function(_0x21b4cc,_0xe15021){_0x21b4cc=_0x21b4cc-0x0;var _0x1e282a=_0x88c8[_0x21b4cc];return _0x1e282a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x888c('0x0'));var rimraf=require(_0x888c('0x1'));var zipdir=require(_0x888c('0x2'));var jsonpatch=require(_0x888c('0x3'));var rp=require(_0x888c('0x4'));var moment=require('moment');var BPromise=require(_0x888c('0x5'));var Mustache=require(_0x888c('0x6'));var util=require(_0x888c('0x7'));var path=require(_0x888c('0x8'));var sox=require('sox');var csv=require(_0x888c('0x9'));var ejs=require(_0x888c('0xa'));var fs=require('fs');var _=require(_0x888c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x888c('0xc'));var deskjs=require(_0x888c('0xd'));var toCsv=require(_0x888c('0x9'));var querystring=require(_0x888c('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x888c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x888c('0x10'))(_0x888c('0x11'));var utils=require('../../config/utils');var config=require(_0x888c('0x12'));var licenseUtil=require(_0x888c('0x13'));var db=require('../../mysqldb')['db'];config[_0x888c('0x14')]=_[_0x888c('0x15')](config['redis'],{'host':_0x888c('0x16'),'port':0x18eb});var socket=require(_0x888c('0x17'))(new Redis(config[_0x888c('0x14')]));require(_0x888c('0x18'))[_0x888c('0x19')](socket);var jayson=require(_0x888c('0x1a'));var client=jayson[_0x888c('0x1b')][_0x888c('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x56263c,_0x1cde30,_0xc25010,_0x4e0aee){return new BPromise(function(_0x1511e9,_0x53e448){var _0x412629=_0x4e0aee||client;return _0x412629['request'](_0x56263c,_0xc25010)[_0x888c('0x1d')](function(_0x22b98e){logger[_0x888c('0x1e')](_0x888c('0x1f'),_0x1cde30,_0x888c('0x20'));logger['debug'](_0x888c('0x21'),_0x1cde30,_0x888c('0x20'),JSON[_0x888c('0x22')](_0x22b98e));if(_0x22b98e[_0x888c('0x23')]){if(_0x22b98e[_0x888c('0x23')][_0x888c('0x24')]===0x1f4){logger[_0x888c('0x23')](_0x888c('0x1f'),_0x1cde30,_0x22b98e[_0x888c('0x23')][_0x888c('0x25')]);return _0x53e448(_0x22b98e[_0x888c('0x23')][_0x888c('0x25')]);}logger[_0x888c('0x23')](_0x888c('0x1f'),_0x1cde30,_0x22b98e['error']['message']);return _0x1511e9(_0x22b98e['error'][_0x888c('0x25')]);}else{logger['info'](_0x888c('0x1f'),_0x1cde30,_0x888c('0x20'));_0x1511e9(_0x22b98e[_0x888c('0x26')]['message']);}})[_0x888c('0x27')](function(_0x3ec336){logger[_0x888c('0x23')]('User,\x20%s,\x20%s',_0x1cde30,_0x3ec336);_0x53e448(_0x3ec336);});});}function respondWithStatusCode(_0x1569d2,_0x2ca60f){_0x2ca60f=_0x2ca60f||0xcc;return function(_0x5b6257){if(_0x5b6257){return _0x1569d2[_0x888c('0x28')](_0x2ca60f);}return _0x1569d2[_0x888c('0x29')](_0x2ca60f)[_0x888c('0x2a')]();};}function respondWithResult(_0x443d4a,_0x3219de){_0x3219de=_0x3219de||0xc8;return function(_0x173659){if(_0x173659){return _0x443d4a['status'](_0x3219de)[_0x888c('0x2b')](_0x173659);}};}function respondWithFilteredResult(_0x5e7fac,_0x3a6436){return function(_0x1e148b){if(_0x1e148b){var _0x29fa1e=_0x1e148b[_0x888c('0x2c')],_0x387e45=_0x3a6436[_0x888c('0x2d')],_0x24342b=_0x3a6436[_0x888c('0x2d')]+_0x3a6436[_0x888c('0x2e')],_0x162c93;if(_0x24342b>=_0x29fa1e){_0x24342b=_0x29fa1e;_0x162c93=0xc8;}else{_0x162c93=0xce;}_0x5e7fac[_0x888c('0x29')](_0x162c93);return _0x5e7fac[_0x888c('0x2f')](_0x888c('0x30'),_0x387e45+'-'+_0x24342b+'/'+_0x29fa1e)[_0x888c('0x2b')](_0x1e148b);}return null;};}function patchUpdates(_0x3a5052){return function(_0x581a27){try{jsonpatch[_0x888c('0x31')](_0x581a27,_0x3a5052,!![]);}catch(_0x37640c){return BPromise['reject'](_0x37640c);}return _0x581a27[_0x888c('0x32')]();};}function saveUpdates(_0x4e45b7,_0xcceefc){return function(_0x5c5d36){if(_0x5c5d36){return _0x5c5d36['update'](_0x4e45b7)['then'](function(_0x4eacdd){return _0x4eacdd;});}return null;};}function removeEntity(_0xe420a,_0x4315c4){return function(_0x5bd1f8){if(_0x5bd1f8){return _0x5bd1f8['destroy']()[_0x888c('0x1d')](function(){var _0x3fe5a8=_0x5bd1f8[_0x888c('0x33')]({'plain':!![]});if(_0x3fe5a8[_0x888c('0x34')]===_0x888c('0x35'))return;var _0x5ad541=[{'name':_0x888c('0x36'),'value':_0x888c('0x37'),'ignore':!![]},{'name':_0x888c('0x38'),'value':_0x888c('0x39'),'ignore':![]},{'name':'Telephones','value':_0x888c('0x3a'),'ignore':![]}];var _0x294ae7=_(_0x5ad541)[_0x888c('0x3b')]('ignore')[_0x888c('0x3c')](_0x888c('0x3d'))['value']();if(_[_0x888c('0x3e')](_0x294ae7,_0x3fe5a8[_0x888c('0x34')])){return;}var _0xcc2460=_[_0x888c('0x3f')](_0x5ad541,[_0x888c('0x3d'),_0x3fe5a8[_0x888c('0x34')]])[_0x888c('0x40')];return db[_0x888c('0x41')]['destroy']({'where':{'type':_0xcc2460,'resourceId':_0x3fe5a8['id']}})[_0x888c('0x1d')](function(){return _0x5bd1f8;});})[_0x888c('0x1d')](function(){_0xe420a[_0x888c('0x29')](0xcc)[_0x888c('0x2a')]();});}};}function handleEntityNotFound(_0x3b032a,_0x170a17){return function(_0x2f8577){if(!_0x2f8577){_0x3b032a[_0x888c('0x28')](0x194);}return _0x2f8577;};}function handleError(_0xdde4d4,_0x3dd6c0){_0x3dd6c0=_0x3dd6c0||0x1f4;return function(_0x4da4da){logger[_0x888c('0x23')](_0x4da4da[_0x888c('0x42')]);if(_0x4da4da[_0x888c('0x40')]){delete _0x4da4da[_0x888c('0x40')];}_0xdde4d4[_0x888c('0x29')](_0x3dd6c0)[_0x888c('0x43')](_0x4da4da);};}exports[_0x888c('0x44')]=function(_0x4bbb3f,_0x222e72){var _0x3127e9={},_0x4c0ea2={},_0x50466e={'count':0x0,'rows':[]};var _0xf298b5=_[_0x888c('0x3c')](db[_0x888c('0x45')]['rawAttributes'],function(_0x2758df){return{'name':_0x2758df[_0x888c('0x46')],'type':_0x2758df[_0x888c('0x47')][_0x888c('0x48')]};});_0x4c0ea2[_0x888c('0x49')]=_['differenceBy'](_[_0x888c('0x3c')](_0xf298b5,_0x888c('0x40')),[_0x888c('0x4a'),'salt']);_0x4c0ea2[_0x888c('0x4b')]=_[_0x888c('0x4c')](_0x4bbb3f[_0x888c('0x4b')]);_0x4c0ea2[_0x888c('0x4d')]=_[_0x888c('0x4e')](_0x4c0ea2[_0x888c('0x49')],_0x4c0ea2[_0x888c('0x4b')]);_0x3127e9[_0x888c('0x4f')]=_['intersection'](_0x4c0ea2[_0x888c('0x49')],qs[_0x888c('0x50')](_0x4bbb3f[_0x888c('0x4b')][_0x888c('0x50')]));_0x3127e9[_0x888c('0x4f')]=_0x3127e9[_0x888c('0x4f')][_0x888c('0x51')]?_0x3127e9[_0x888c('0x4f')]:_0x4c0ea2[_0x888c('0x49')];if(!_0x4bbb3f[_0x888c('0x4b')][_0x888c('0x52')](_0x888c('0x53'))){_0x3127e9['limit']=qs[_0x888c('0x2e')](_0x4bbb3f[_0x888c('0x4b')][_0x888c('0x2e')]);_0x3127e9[_0x888c('0x2d')]=qs[_0x888c('0x2d')](_0x4bbb3f[_0x888c('0x4b')][_0x888c('0x2d')]);}_0x3127e9[_0x888c('0x54')]=qs[_0x888c('0x55')](_0x4bbb3f[_0x888c('0x4b')][_0x888c('0x55')]);_0x3127e9[_0x888c('0x56')]=qs['filters'](_[_0x888c('0x57')](_0x4bbb3f[_0x888c('0x4b')],_0x4c0ea2['filters']),_0xf298b5);if(_0x4bbb3f['query'][_0x888c('0x3b')]){_0x3127e9[_0x888c('0x56')]=_['merge'](_0x3127e9[_0x888c('0x56')],{'$or':_[_0x888c('0x3c')](_0xf298b5,function(_0x576df7){if(_0x576df7[_0x888c('0x47')]!=='VIRTUAL'){return db[_0x888c('0x58')][_0x888c('0x56')](db[_0x888c('0x58')]['fn'](_0x888c('0x59'),db['sequelize'][_0x888c('0x5a')](_0x576df7[_0x888c('0x40')])),{'$like':db['sequelize']['fn'](_0x888c('0x59'),'%'+_0x4bbb3f[_0x888c('0x4b')][_0x888c('0x3b')]+'%')});}})});}_0x3127e9=_[_0x888c('0x5b')]({},_0x3127e9,_0x4bbb3f[_0x888c('0x5c')]);var _0x2bdf7e={'where':_0x3127e9[_0x888c('0x56')]};return db[_0x888c('0x45')][_0x888c('0x2c')](_0x2bdf7e)[_0x888c('0x1d')](function(_0x1be8a6){_0x50466e[_0x888c('0x2c')]=_0x1be8a6;if(_0x4bbb3f[_0x888c('0x4b')]['includeAll']){_0x3127e9[_0x888c('0x5d')]=[{'all':!![]}];}return db[_0x888c('0x45')][_0x888c('0x5e')](_0x3127e9);})[_0x888c('0x1d')](function(_0x285e73){_0x50466e[_0x888c('0x5f')]=_0x285e73;return _0x50466e;})[_0x888c('0x1d')](respondWithFilteredResult(_0x222e72,_0x3127e9))[_0x888c('0x27')](handleError(_0x222e72,null));};exports[_0x888c('0x60')]=function(_0x427727,_0x469f6d){var _0x422f54={'raw':![],'where':{'id':_0x427727['params']['id']}},_0x5b10df={};_0x5b10df['model']=_[_0x888c('0x61')](_[_0x888c('0x4c')](db[_0x888c('0x45')][_0x888c('0x62')]),['password',_0x888c('0x63')]);_0x5b10df['query']=_[_0x888c('0x4c')](_0x427727[_0x888c('0x4b')]);_0x5b10df[_0x888c('0x4d')]=_[_0x888c('0x4e')](_0x5b10df[_0x888c('0x49')],_0x5b10df['query']);_0x422f54['attributes']=_[_0x888c('0x4e')](_0x5b10df[_0x888c('0x49')],qs[_0x888c('0x50')](_0x427727[_0x888c('0x4b')][_0x888c('0x50')]));_0x422f54[_0x888c('0x4f')]=_0x422f54[_0x888c('0x4f')][_0x888c('0x51')]?_0x422f54[_0x888c('0x4f')]:_0x5b10df['model'];if(_0x427727[_0x888c('0x4b')][_0x888c('0x64')]){_0x422f54[_0x888c('0x5d')]=[{'all':!![]}];}_0x422f54=_[_0x888c('0x5b')]({},_0x422f54,_0x427727['options']);return db[_0x888c('0x45')][_0x888c('0x3f')](_0x422f54)['then'](handleEntityNotFound(_0x469f6d,null))[_0x888c('0x1d')](respondWithResult(_0x469f6d,null))['catch'](handleError(_0x469f6d,null));};exports[_0x888c('0x65')]=function(_0x42c786,_0x525063){if(_0x42c786[_0x888c('0x66')]['id']){delete _0x42c786[_0x888c('0x66')]['id'];}delete _0x42c786['body'][_0x888c('0x34')];return db['User']['find']({'where':{'id':_0x42c786['params']['id']}})['then'](handleEntityNotFound(_0x525063,null))['then'](saveUpdates(_0x42c786[_0x888c('0x66')],null))[_0x888c('0x1d')](respondWithResult(_0x525063,null))[_0x888c('0x27')](handleError(_0x525063,null));};exports[_0x888c('0x67')]=function(_0x485302,_0x59c1f4){return db['User']['describe']()[_0x888c('0x1d')](respondWithResult(_0x59c1f4,null))['catch'](handleError(_0x59c1f4,null));};exports[_0x888c('0x68')]=function(_0x2b9dba,_0x4c74b1,_0x357c1f){return db[_0x888c('0x45')][_0x888c('0x3f')]({'where':{'id':_0x2b9dba['params']['id']}})[_0x888c('0x1d')](handleEntityNotFound(_0x4c74b1,null))[_0x888c('0x1d')](function(_0x2ce328){if(_0x2ce328){return _0x2ce328['addContacts'](_0x2b9dba[_0x888c('0x66')][_0x888c('0x69')],_[_0x888c('0x6a')](_0x2b9dba[_0x888c('0x66')],[_0x888c('0x69'),'id'])||{});}})[_0x888c('0x1d')](respondWithResult(_0x4c74b1,null))[_0x888c('0x27')](handleError(_0x4c74b1,null));};function validateUser(_0x2bd8ea){return new BPromise(function(_0x1fd460,_0x254737){if(_0x2bd8ea[_0x888c('0x6b')])return _0x1fd460(_0x2bd8ea);return db['Setting'][_0x888c('0x6c')](0x1)[_0x888c('0x1d')](function(_0x292101){if(_0x292101[_0x888c('0x6d')])authService[_0x888c('0x6e')](_0x2bd8ea[_0x888c('0x4a')]);db[_0x888c('0x45')][_0x888c('0x6f')]('internal')[_0x888c('0x1d')](function(_0x177c9c){if(_['isNil'](_0x177c9c)){_0x2bd8ea['internal']=_0x292101[_0x888c('0x70')]||0x1;return;}if(_['isNil'](_0x292101[_0x888c('0x70')])||_0x292101[_0x888c('0x70')]===_0x177c9c){_0x2bd8ea[_0x888c('0x6b')]=_0x177c9c+0x1;return;}if(_0x292101[_0x888c('0x70')]>_0x177c9c){_0x2bd8ea[_0x888c('0x6b')]=_0x292101[_0x888c('0x70')];return;}return db['sequelize'][_0x888c('0x4b')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x888c('0x58')][_0x888c('0x71')][_0x888c('0x72')]})[_0x888c('0x1d')](function(_0x301aaf){if(_0x301aaf&&_0x301aaf['length']){for(var _0x416af4=0x0,_0x3694f5=_0x301aaf['length'];_0x416af4<_0x3694f5&&_['isNil'](_0x2bd8ea['internal']);_0x416af4++){if(_0x292101[_0x888c('0x70')]<=_0x301aaf[_0x416af4][_0x888c('0x73')]){_0x2bd8ea[_0x888c('0x6b')]=_0x301aaf[_0x416af4][_0x888c('0x73')];}else if(_0x292101['min_internal']>_0x301aaf[_0x416af4]['from']&&_0x292101[_0x888c('0x70')]<=_0x301aaf[_0x416af4]['to']){_0x2bd8ea[_0x888c('0x6b')]=_0x292101[_0x888c('0x70')];}}}if(_[_0x888c('0x74')](_0x2bd8ea[_0x888c('0x6b')])){_0x2bd8ea['internal']=_0x177c9c+0x1;}return _0x1fd460(_0x2bd8ea);});});})[_0x888c('0x27')](function(_0x4597aa){_0x254737(_0x4597aa);});});}function updateUser(_0x360ea3){return new BPromise(function(_0x1bc79a,_0x1f753f){try{if(_0x360ea3['voicemail']){_0x360ea3[_0x888c('0x75')]=_0x360ea3[_0x888c('0x6b')];_0x360ea3[_0x888c('0x76')]={'mailbox':_0x360ea3[_0x888c('0x6b')],'password':_0x360ea3[_0x888c('0x4a')],'fullname':_0x360ea3['fullname'],'email':_0x360ea3[_0x888c('0x77')]};}if(_0x360ea3[_0x888c('0x34')]===_0x888c('0x39')){if(!_0x360ea3['permissions'])_0x360ea3[_0x888c('0x78')]=[_0x888c('0x79'),_0x888c('0x7a'),_0x888c('0x7b'),'113','110',_0x888c('0x7c'),_0x888c('0x7d'),_0x888c('0x7e'),_0x888c('0x7f'),_0x888c('0x80'),_0x888c('0x81'),'100',_0x888c('0x82'),_0x888c('0x83'),_0x888c('0x84')];}_0x1bc79a(_0x360ea3);}catch(_0x186e02){_0x1f753f(_0x186e02);}});}exports[_0x888c('0x85')]=function(_0x139b03,_0x319723){if(_0x139b03[_0x888c('0x37')]['role']==='agent')throw new Error(_0x888c('0x86'));if(_0x139b03[_0x888c('0x66')][_0x888c('0x34')]===_0x888c('0x37')&&_0x139b03[_0x888c('0x37')]['role']!==_0x888c('0x35')){throw new Error(_0x888c('0x87'));}if(_0x139b03['body']['role']===_0x888c('0x35')&&_0x139b03[_0x888c('0x37')][_0x888c('0x34')]!=='admin'){throw new Error(_0x888c('0x88'));}return licenseUtil['checkUserLimits']([_0x139b03[_0x888c('0x66')]])[_0x888c('0x1d')](function(){return validateUser(_0x139b03['body']);})[_0x888c('0x1d')](function(_0x29518b){return updateUser(_0x29518b)[_0x888c('0x1d')](function(_0x25b895){if(_0x25b895[_0x888c('0x34')]===_0x888c('0x35')){_0x25b895['settingsEnabled']=_0x139b03[_0x888c('0x37')]['settingsEnabled'];delete _0x25b895[_0x888c('0x89')];}return _0x25b895;});})[_0x888c('0x1d')](function(_0x53b352){return db['User']['create'](_0x53b352,{'include':[{'model':db[_0x888c('0x76')],'as':'VoiceMail'}]});})['then'](function(_0x15152e){if(_0x139b03[_0x888c('0x66')][_0x888c('0x34')]===_0x888c('0x37'))return _0x15152e;if(_0x139b03[_0x888c('0x37')][_0x888c('0x34')]!=='user')return _0x15152e;return db[_0x888c('0x8a')][_0x888c('0x3f')]({'where':{'name':_0x15152e[_0x888c('0x34')]===_0x888c('0x39')?'Agents':_0x888c('0x8b'),'userProfileId':_0x139b03[_0x888c('0x37')]['userProfileId']},'raw':!![]})[_0x888c('0x1d')](function(_0x363804){if(!_0x363804||_0x363804[_0x888c('0x8c')]!=0x0)return _0x15152e;return db['UserProfileResource'][_0x888c('0x85')]({'name':_0x15152e[_0x888c('0x40')],'resourceId':_0x15152e['id'],'type':_0x363804[_0x888c('0x40')],'sectionId':_0x363804['id']},{})['then'](function(){return _0x15152e;});})[_0x888c('0x27')](function(_0x3edbae){logger['error'](_0x888c('0x8d'),_0x3edbae);throw _0x3edbae;});})[_0x888c('0x1d')](respondWithResult(_0x319723,0xc9))['catch'](handleError(_0x319723,null));};exports[_0x888c('0x8e')]=function(_0x1c74ef,_0xce14fb){var _0x264c5a=_0x1c74ef[_0x888c('0x66')];var _0x6aec1b=[];if(_0x1c74ef[_0x888c('0x37')][_0x888c('0x34')]===_0x888c('0x39'))throw new Error('Unauthorized');if(_[_0x888c('0x8f')](_0x264c5a,['role',_0x888c('0x37')])&&_0x1c74ef[_0x888c('0x37')]['role']!==_0x888c('0x35')){throw new Error(_0x888c('0x87'));}if(_[_0x888c('0x8f')](_0x264c5a,['role',_0x888c('0x35')])&&_0x1c74ef['user']['role']!==_0x888c('0x35')){throw new Error(_0x888c('0x90'));}return licenseUtil['checkUserLimits'](_0x264c5a)['then'](function(){return validateUser(_0x264c5a[0x0]);})[_0x888c('0x1d')](function(){for(var _0x5c39a6=0x1;_0x5c39a6<_0x264c5a[_0x888c('0x51')];_0x5c39a6++){var _0x1b8a2e=_0x264c5a[_0x5c39a6-0x1]['internal'];if(!_0x264c5a[_0x5c39a6][_0x888c('0x6b')])_0x264c5a[_0x5c39a6][_0x888c('0x6b')]=_0x1b8a2e+0x1;_0x6aec1b[_0x888c('0x91')](validateUser(_0x264c5a[_0x5c39a6]));}return BPromise[_0x888c('0x92')](_0x6aec1b);})[_0x888c('0x1d')](function(){_0x6aec1b=[];for(var _0x4814af=0x0;_0x4814af<_0x264c5a[_0x888c('0x51')];_0x4814af++){_0x6aec1b['push'](updateUser(_0x264c5a[_0x4814af]));}return BPromise[_0x888c('0x92')](_0x6aec1b);})[_0x888c('0x1d')](function(){return BPromise[_0x888c('0x93')](_0x264c5a,function(_0x33fe5e){return db[_0x888c('0x45')][_0x888c('0x85')](_0x33fe5e,{'include':[{'model':db[_0x888c('0x76')],'as':_0x888c('0x76')}]})[_0x888c('0x1d')](function(_0x259aa9){_0x33fe5e['id']=_0x259aa9['id'];return _0x33fe5e;});});})[_0x888c('0x1d')](function(_0x5d0646){if(_0x1c74ef['body'][_0x888c('0x34')]===_0x888c('0x37'))return _0x5d0646;if(_0x1c74ef[_0x888c('0x37')][_0x888c('0x34')]!==_0x888c('0x37'))return _0x5d0646;var _0x61be04=_['some'](_0x5d0646,function(_0x220375){return _0x220375[_0x888c('0x34')]===_0x888c('0x39')||_0x220375[_0x888c('0x34')]==='telephone';});if(!_0x61be04)return _0x5d0646;return db['UserProfileSection'][_0x888c('0x5e')]({'where':{'name':{'$or':[_0x888c('0x38'),_0x888c('0x8b')]},'userProfileId':_0x1c74ef['user']['userProfileId']},'raw':!![]})[_0x888c('0x1d')](function(_0x29641e){if(_[_0x888c('0x94')](_0x29641e)||!_[_0x888c('0x8f')](_0x29641e,['autoAssociation',0x0]))return _0x5d0646;_0x6aec1b=[];var _0x12bdd6=_(_0x29641e)[_0x888c('0x3c')](function(_0x2e8162){if(_0x2e8162[_0x888c('0x8c')]===0x1)return;return _0x2e8162['name']===_0x888c('0x38')?'agent':_0x888c('0x3a');})[_0x888c('0x95')]()[_0x888c('0x3d')]();for(var _0x140c8f=0x0;_0x140c8f<_0x5d0646['length'];_0x140c8f++){if(!_[_0x888c('0x3e')](_0x12bdd6,_0x5d0646[_0x140c8f][_0x888c('0x34')]))return;var _0x48e786=_0x5d0646[_0x140c8f][_0x888c('0x34')]===_0x888c('0x39')?_0x888c('0x38'):'Telephones';_0x6aec1b[_0x888c('0x91')](db['UserProfileResource'][_0x888c('0x85')]({'name':_0x5d0646[_0x140c8f]['name'],'resourceId':_0x5d0646[_0x140c8f]['id'],'type':_0x48e786,'sectionId':_[_0x888c('0x3f')](_0x29641e,[_0x888c('0x40'),_0x48e786])['id']},{}));}return BPromise['all'](_0x6aec1b);});})[_0x888c('0x1d')](respondWithResult(_0xce14fb,0xc9))[_0x888c('0x27')](handleError(_0xce14fb,null));};exports[_0x888c('0x96')]=function(_0x38f7ec,_0x58c22c,_0x434632){if(_0x38f7ec[_0x888c('0x66')]['id']){delete _0x38f7ec[_0x888c('0x66')]['id'];}return db[_0x888c('0x45')][_0x888c('0x3f')]({'where':{'id':_0x38f7ec[_0x888c('0x97')]['id']}})[_0x888c('0x1d')](function(_0x404247){if(!_0x404247)return null;if(_0x404247['id']===_0x38f7ec[_0x888c('0x37')]['id']){if(!_0x38f7ec['body']['oldPassword']||!_0x38f7ec[_0x888c('0x66')][_0x888c('0x98')]){throw new db[(_0x888c('0x99'))][(_0x888c('0x9a'))](_0x888c('0x9b'));}if(!_0x404247[_0x888c('0x9c')](_0x38f7ec[_0x888c('0x66')][_0x888c('0x9d')])){throw new db[(_0x888c('0x99'))]['ValidationError'](_0x888c('0x9e'));}if(_0x38f7ec[_0x888c('0x66')][_0x888c('0x9d')]===_0x38f7ec[_0x888c('0x66')][_0x888c('0x98')]){throw new db['Sequelize'][(_0x888c('0x9a'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x38f7ec['user']['role']===_0x888c('0x35')){if(!_0x38f7ec[_0x888c('0x66')][_0x888c('0x98')]){throw new db[(_0x888c('0x99'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x38f7ec['user'][_0x888c('0x34')]==='user'){if(!_0x38f7ec['body']['newPassword']){throw new db[(_0x888c('0x99'))][(_0x888c('0x9a'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x404247[_0x888c('0x34')]!=='agent'){throw new db[(_0x888c('0x99'))][(_0x888c('0x9a'))](_0x888c('0x86'));}}else{throw new db[(_0x888c('0x99'))][(_0x888c('0x9a'))](_0x888c('0x86'));}return _0x404247;})['then'](handleEntityNotFound(_0x58c22c,null))[_0x888c('0x1d')](function(_0x2b21d0){return db[_0x888c('0x9f')][_0x888c('0xa0')]({'attributes':['id',_0x888c('0x6d'),_0x888c('0xa1'),_0x888c('0xa2')]})[_0x888c('0x1d')](function(_0x9387ea){if(_0x9387ea[_0x888c('0x6d')])authService[_0x888c('0x6e')](_0x38f7ec['body'][_0x888c('0x98')]);if(!_0x9387ea[_0x888c('0xa1')]||!_0x2b21d0[_0x888c('0xa3')])return _0x2b21d0;authService[_0x888c('0xa4')](_0x38f7ec[_0x888c('0x66')][_0x888c('0x98')],_0x2b21d0[_0x888c('0xa3')],_0x9387ea['passwordHistoryLimit']);return _0x2b21d0;})[_0x888c('0x1d')](saveUpdates({'password':_0x38f7ec[_0x888c('0x66')][_0x888c('0x98')],'passwordResetAt':_0x38f7ec['user']['id']==_0x38f7ec[_0x888c('0x97')]['id']?moment():null,'previousPasswords':authService[_0x888c('0xa5')](_0x38f7ec['body'][_0x888c('0x98')],_0x2b21d0['previousPasswords'])},null));})[_0x888c('0x1d')](respondWithResult(_0x58c22c,null))[_0x888c('0x27')](handleError(_0x58c22c,null));};exports[_0x888c('0xa6')]=function(_0x515401,_0x4a7527,_0x32386d){var _0x59171f=_0x515401[_0x888c('0x66')][_0x888c('0xa7')];return db[_0x888c('0x45')][_0x888c('0x3f')]({'where':{'id':_0x515401[_0x888c('0x97')]['id']},'attributes':['id',_0x888c('0x40'),_0x888c('0x34'),'online',_0x888c('0xa8'),_0x888c('0xa9'),_0x888c('0xaa')]})['then'](handleEntityNotFound(_0x4a7527,null))[_0x888c('0x1d')](function(_0x45fca6){if(_0x45fca6){if(!utils[_0x888c('0xab')](_0x59171f)){throw new db[(_0x888c('0x99'))][(_0x888c('0x9a'))](_0x888c('0xac'));}return _0x45fca6[_0x888c('0xad')+_[_0x888c('0xae')](_0x59171f[_0x888c('0xaf')]())+'Queues'](_0x515401['body'][_0x888c('0x69')],{'penalty':_0x515401[_0x888c('0x66')][_0x888c('0xb0')]||0x0})[_0x888c('0xb1')](function(_0xf7c1b4){for(var _0x54dea7=0x0;_0x54dea7<_0x515401[_0x888c('0x66')][_0x888c('0x69')][_0x888c('0x51')];_0x54dea7+=0x1){var _0x33103e={'UserId':_0x515401[_0x888c('0x97')]['id']};_0x33103e[_[_0x888c('0xae')](_0x59171f['toLowerCase']())+_0x888c('0xb2')]=_0x515401[_0x888c('0x66')][_0x888c('0x69')][_0x54dea7];socket[_0x888c('0xb3')](_0x888c('0x37')+_[_0x888c('0xae')](_0x59171f['toLowerCase']())+'Queue:save',_0x33103e);}return _0xf7c1b4;})['then'](function(){if(_0x59171f==='voice'){return db['VoiceQueue']['findAll']({'where':{'id':_0x515401[_0x888c('0x66')][_0x888c('0x69')]||[]},'raw':!![],'attributes':['id',_0x888c('0x40')]});}})[_0x888c('0x1d')](function(_0x2a60fd){var _0x6345=_0x45fca6[_0x888c('0x33')]({'plain':!![]});var _0x4064f7=[];if(_0x59171f===_0x888c('0xb4')&&_0x6345[_0x888c('0x34')]===_0x888c('0x39')&&_0x6345[_0x888c('0xb5')]){for(var _0x3d6145=0x0;_0x3d6145<_0x2a60fd['length'];_0x3d6145+=0x1){_0x4064f7[_0x888c('0x91')]({'membername':_0x6345[_0x888c('0x40')],'UserId':_0x6345['id'],'queue_name':_0x2a60fd[_0x3d6145][_0x888c('0x40')],'VoiceQueueId':_0x2a60fd[_0x3d6145]['id'],'interface':_['isNil'](_0x6345[_0x888c('0xaa')])?util['format'](_0x888c('0xb6'),_0x6345[_0x888c('0x40')]):_0x6345[_0x888c('0xaa')],'paused':_0x6345[_0x888c('0xa9')]||![],'penalty':_0x515401[_0x888c('0x66')][_0x888c('0xb0')]||0x0});}return BPromise[_0x888c('0x93')](_0x4064f7,function(_0x5c9c10){return db['UserVoiceQueueRt'][_0x888c('0xb7')](_0x5c9c10);});}return _0x45fca6;});}})[_0x888c('0x1d')](respondWithStatusCode(_0x4a7527,null))[_0x888c('0x27')](handleError(_0x4a7527,null));};exports['removeQueues']=function(_0x3e5bed,_0x5e98b5,_0xf2ecf1){var _0x49ce49;return db[_0x888c('0x45')][_0x888c('0x3f')]({'where':{'id':_0x3e5bed[_0x888c('0x97')]['id']},'attributes':['id',_0x888c('0x40'),_0x888c('0x34')]})[_0x888c('0x1d')](handleEntityNotFound(_0x5e98b5,null))[_0x888c('0x1d')](function(_0x4cf2f0){if(_0x4cf2f0){_0x49ce49=_0x4cf2f0;if(!_0x3e5bed[_0x888c('0x4b')]['channel']||!utils[_0x888c('0xab')](_0x3e5bed[_0x888c('0x4b')]['channel'])){throw new db[(_0x888c('0x99'))][(_0x888c('0x9a'))](_0x888c('0xac'));}return _0x4cf2f0[_0x888c('0xb8')+_[_0x888c('0xae')](_0x3e5bed['query']['channel'][_0x888c('0xaf')]())+'Queues'](_0x3e5bed[_0x888c('0x4b')][_0x888c('0x69')]);}})[_0x888c('0x1d')](function(_0x592197){for(var _0xf4d46a=0x0;_0xf4d46a<_0x3e5bed['query'][_0x888c('0x69')][_0x888c('0x51')];_0xf4d46a+=0x1){var _0x551103={'UserId':_0x3e5bed[_0x888c('0x97')]['id']};_0x551103[_[_0x888c('0xae')](_0x3e5bed['query'][_0x888c('0xa7')][_0x888c('0xaf')]())+_0x888c('0xb2')]=_0x3e5bed[_0x888c('0x4b')][_0x888c('0x69')][_0xf4d46a];socket[_0x888c('0xb3')]('user'+_[_0x888c('0xae')](_0x3e5bed['query']['channel']['toLowerCase']())+'Queue:remove',_0x551103);}return _0x592197;})[_0x888c('0x1d')](function(){if(_0x3e5bed[_0x888c('0x4b')][_0x888c('0xa7')]===_0x888c('0xb4')){return db['UserVoiceQueueRt'][_0x888c('0xb9')]({'where':{'UserId':_0x3e5bed['params']['id'],'VoiceQueueId':_0x3e5bed['query'][_0x888c('0x69')]},'individualHooks':!![]})[_0x888c('0x1d')](function(){return _0x49ce49;});}return _0x49ce49;})[_0x888c('0x1d')](respondWithStatusCode(_0x5e98b5,null))[_0x888c('0x27')](handleError(_0x5e98b5,null));};exports['addAvatar']=function(_0x2afd70,_0x1b8235,_0x5de142){_0x2afd70[_0x888c('0x66')][_0x888c('0xba')]=_0x2afd70[_0x888c('0xbb')][_0x888c('0xbc')];return db[_0x888c('0x45')]['find']({'where':{'id':_0x2afd70[_0x888c('0x97')]['id']}})[_0x888c('0x1d')](handleEntityNotFound(_0x1b8235,null))[_0x888c('0x1d')](saveUpdates(_0x2afd70['body'],null))['then'](respondWithResult(_0x1b8235,null))[_0x888c('0x27')](handleError(_0x1b8235,null));};exports[_0x888c('0xbd')]=function(_0x28e0c6,_0x56ea3e,_0x5bd3f1){var _0x2cb0a6=path['join'](config[_0x888c('0xbe')],'server/files/images/logos/default_profile.png');return db[_0x888c('0x45')][_0x888c('0x3f')]({'where':{'id':_0x28e0c6[_0x888c('0x97')]['id']},'attributes':['id',_0x888c('0xba')],'raw':!![]})[_0x888c('0x1d')](handleEntityNotFound(_0x56ea3e,null))[_0x888c('0x1d')](function(_0x21a955){if(_0x21a955){if(_[_0x888c('0x74')](_0x21a955[_0x888c('0xba')])){return _0x56ea3e[_0x888c('0xbf')](_0x2cb0a6);}else{if(!fs[_0x888c('0xc0')](path[_0x888c('0xc1')](config[_0x888c('0xbe')],'server/files/images/',_0x21a955[_0x888c('0xba')]))){return _0x56ea3e['download'](_0x2cb0a6);}return _0x56ea3e[_0x888c('0xbf')](path[_0x888c('0xc1')](config['root'],_0x888c('0xc2'),_0x21a955[_0x888c('0xba')]));}}})[_0x888c('0x27')](handleError(_0x56ea3e,null));};exports[_0x888c('0xc3')]=function(_0x4d22f8,_0x15f1f8,_0x5bad1a){var _0x38ecd5={};var _0x5287b0={};var _0x396977;var _0x2742d2;return db[_0x888c('0x45')]['findOne']({'where':{'id':_0x4d22f8[_0x888c('0x97')]['id']}})[_0x888c('0x1d')](handleEntityNotFound(_0x15f1f8,null))[_0x888c('0x1d')](function(_0x13fd8c){if(_0x13fd8c){_0x396977=_0x13fd8c;_0x5287b0[_0x888c('0x49')]=_[_0x888c('0x4c')](db[_0x888c('0xc4')]['rawAttributes']);_0x5287b0[_0x888c('0x4b')]=_[_0x888c('0x4c')](_0x4d22f8[_0x888c('0x4b')]);_0x5287b0[_0x888c('0x4d')]=_[_0x888c('0x4e')](_0x5287b0[_0x888c('0x49')],_0x5287b0[_0x888c('0x4b')]);_0x38ecd5['attributes']=_[_0x888c('0x4e')](_0x5287b0[_0x888c('0x49')],qs['fields'](_0x4d22f8[_0x888c('0x4b')][_0x888c('0x50')]));_0x38ecd5[_0x888c('0x4f')]=_0x38ecd5[_0x888c('0x4f')][_0x888c('0x51')]?_0x38ecd5['attributes']:_0x5287b0['model'];_0x38ecd5[_0x888c('0x54')]=qs[_0x888c('0x55')](_0x4d22f8[_0x888c('0x4b')][_0x888c('0x55')]);_0x38ecd5['where']=qs['filters'](_[_0x888c('0x57')](_0x4d22f8['query'],_0x5287b0['filters']));if(_0x4d22f8[_0x888c('0x4b')][_0x888c('0x3b')]){_0x38ecd5[_0x888c('0x56')]=_[_0x888c('0x5b')](_0x38ecd5['where'],{'$or':_[_0x888c('0x3c')](_0x38ecd5['attributes'],function(_0x2bf854){var _0x1edd84={};_0x1edd84[_0x2bf854]={'$like':'%'+_0x4d22f8[_0x888c('0x4b')][_0x888c('0x3b')]+'%'};return _0x1edd84;})});}_0x38ecd5=_[_0x888c('0x5b')]({},_0x38ecd5,_0x4d22f8[_0x888c('0x5c')]);return _0x396977[_0x888c('0xc3')](_0x38ecd5);}})[_0x888c('0x1d')](function(_0xa88237){if(_0xa88237){_0x2742d2=_0xa88237[_0x888c('0x51')];if(_0x4d22f8[_0x888c('0x4b')][_0x888c('0x52')](_0x888c('0x64'))){_0x38ecd5[_0x888c('0x5d')]=[{'model':db[_0x888c('0xc5')],'as':_0x888c('0xc6'),'required':![]},{'model':db[_0x888c('0xc7')],'as':_0x888c('0xc8'),'attributes':['id',_0x888c('0x40'),_0x888c('0xc9')],'where':_0x4d22f8[_0x888c('0x4b')][_0x888c('0xca')]?{'id':_0x4d22f8[_0x888c('0x4b')][_0x888c('0xca')]}:undefined,'required':_0x4d22f8[_0x888c('0x4b')][_0x888c('0xca')]?!![]:![]}];}if(!_0x4d22f8[_0x888c('0x4b')]['hasOwnProperty'](_0x888c('0x53'))){_0x38ecd5['limit']=qs[_0x888c('0x2e')](_0x4d22f8[_0x888c('0x4b')][_0x888c('0x2e')]);_0x38ecd5[_0x888c('0x2d')]=qs[_0x888c('0x2d')](_0x4d22f8[_0x888c('0x4b')]['offset']);}return _0x396977['getContacts'](_0x38ecd5);}})['then'](function(_0x414f62){if(_0x414f62){return _0x414f62?{'count':_0x2742d2,'rows':_0x414f62}:null;}})[_0x888c('0x1d')](respondWithResult(_0x15f1f8,null))[_0x888c('0x27')](handleError(_0x15f1f8,null));};exports[_0x888c('0xcb')]=function(_0x2a9f6c,_0x173976,_0x1177f8){var _0x41bde2;var _0x6dc9b;var _0x47ab0c={};var _0x3a1e33;return db[_0x888c('0x45')][_0x888c('0xa0')]({'where':{'id':_0x2a9f6c[_0x888c('0x97')]['id']},'attributes':['id',_0x888c('0x40'),'role']})['then'](handleEntityNotFound(_0x173976,null))[_0x888c('0x1d')](function(_0x5083ea){if(!utils['isValidChannel'](_0x2a9f6c[_0x888c('0x4b')][_0x888c('0xa7')])){throw new db[(_0x888c('0x99'))]['ValidationError']('Unknown\x20channel');}_0x41bde2=_0x5083ea;var _0x1396fd={};_0x1396fd[_0x888c('0x49')]=_['keys'](db[_[_0x888c('0xae')](_0x2a9f6c[_0x888c('0x4b')]['channel'])+'Queue']['rawAttributes']);_0x1396fd[_0x888c('0x4b')]=_[_0x888c('0x4c')](_0x2a9f6c[_0x888c('0x4b')]);_0x1396fd['filters']=_[_0x888c('0x4e')](_0x1396fd[_0x888c('0x49')],_0x1396fd['query']);_0x47ab0c[_0x888c('0x4f')]=_[_0x888c('0x4e')](_0x1396fd[_0x888c('0x49')],qs[_0x888c('0x50')](_0x2a9f6c['query'][_0x888c('0x50')]));_0x47ab0c['attributes']=_0x47ab0c[_0x888c('0x4f')][_0x888c('0x51')]?_0x47ab0c['attributes']:_0x1396fd[_0x888c('0x49')];_0x47ab0c[_0x888c('0x54')]=qs[_0x888c('0x55')](_0x2a9f6c['query'][_0x888c('0x55')]);_0x47ab0c[_0x888c('0x56')]=qs[_0x888c('0x4d')](_[_0x888c('0x57')](_0x2a9f6c[_0x888c('0x4b')],_0x1396fd[_0x888c('0x4d')]));if(_0x2a9f6c[_0x888c('0x4b')][_0x888c('0x3b')]){_0x47ab0c[_0x888c('0x56')]=_[_0x888c('0x5b')](_0x47ab0c[_0x888c('0x56')],{'$or':_['map'](_0x47ab0c[_0x888c('0x4f')],function(_0x8c61e7){var _0x52b596={};_0x52b596[_0x8c61e7]={'$like':'%'+_0x2a9f6c['query'][_0x888c('0x3b')]+'%'};return _0x52b596;})});}_0x47ab0c=_['merge']({},_0x47ab0c,_0x2a9f6c[_0x888c('0x5c')]);switch(_0x41bde2[_0x888c('0x34')]){case _0x888c('0x35'):return db[_[_0x888c('0xae')](_0x2a9f6c['query'][_0x888c('0xa7')])+_0x888c('0xcc')][_0x888c('0x5e')](_0x47ab0c);case _0x888c('0x37'):case _0x888c('0x39'):return _0x41bde2[_0x888c('0x33')+_[_0x888c('0xae')](_0x2a9f6c[_0x888c('0x4b')]['channel'])+_0x888c('0xcd')](_0x47ab0c);default:throw new db['Sequelize'][(_0x888c('0x9a'))](_0x888c('0xce'));}})[_0x888c('0x1d')](function(_0x25c9bc){_0x3a1e33=_0x25c9bc[_0x888c('0x51')];if(!_0x2a9f6c[_0x888c('0x4b')][_0x888c('0x52')]('nolimit')){_0x47ab0c[_0x888c('0x2e')]=qs[_0x888c('0x2e')](_0x2a9f6c[_0x888c('0x4b')]['limit']);_0x47ab0c[_0x888c('0x2d')]=qs['offset'](_0x2a9f6c[_0x888c('0x4b')][_0x888c('0x2d')]);}switch(_0x41bde2['role']){case _0x888c('0x35'):return db[_[_0x888c('0xae')](_0x2a9f6c[_0x888c('0x4b')][_0x888c('0xa7')])+_0x888c('0xcc')]['findAll'](_0x47ab0c);case'user':case _0x888c('0x39'):return _0x41bde2[_0x888c('0x33')+_['capitalize'](_0x2a9f6c[_0x888c('0x4b')]['channel'])+_0x888c('0xcd')](_0x47ab0c);}})['then'](function(_0x57ca23){return{'count':_0x3a1e33,'rows':_0x57ca23};})['then'](respondWithResult(_0x173976,null))[_0x888c('0x27')](handleError(_0x173976,null));};exports[_0x888c('0xcf')]=function(_0x235f3b,_0x9d58c4,_0x5ae655){var _0xdd3b1a={};var _0x2a6b38={};var _0x5cb1ba;var _0x412119;return db[_0x888c('0x45')][_0x888c('0xa0')]({'where':{'id':_0x235f3b['params']['id']}})['then'](handleEntityNotFound(_0x9d58c4,null))[_0x888c('0x1d')](function(_0x16d165){if(_0x16d165){_0x5cb1ba=_0x16d165;_0x2a6b38['model']=_[_0x888c('0x4c')](db[_0x888c('0xd0')][_0x888c('0x62')]);_0x2a6b38[_0x888c('0x4b')]=_[_0x888c('0x4c')](_0x235f3b[_0x888c('0x4b')]);_0x2a6b38[_0x888c('0x4d')]=_['intersection'](_0x2a6b38['model'],_0x2a6b38[_0x888c('0x4b')]);_0xdd3b1a[_0x888c('0x4f')]=_[_0x888c('0x4e')](_0x2a6b38[_0x888c('0x49')],qs[_0x888c('0x50')](_0x235f3b['query'][_0x888c('0x50')]));_0xdd3b1a[_0x888c('0x4f')]=_0xdd3b1a[_0x888c('0x4f')][_0x888c('0x51')]?_0xdd3b1a[_0x888c('0x4f')]:_0x2a6b38[_0x888c('0x49')];_0xdd3b1a[_0x888c('0x54')]=qs['sort'](_0x235f3b[_0x888c('0x4b')]['sort']);_0xdd3b1a['where']=qs[_0x888c('0x4d')](_[_0x888c('0x57')](_0x235f3b['query'],_0x2a6b38[_0x888c('0x4d')]));if(_0x235f3b[_0x888c('0x4b')][_0x888c('0x3b')]){_0xdd3b1a['where']=_[_0x888c('0x5b')](_0xdd3b1a['where'],{'$or':_[_0x888c('0x3c')](_0xdd3b1a['attributes'],function(_0x291f4e){var _0x1eac14={};_0x1eac14[_0x291f4e]={'$like':'%'+_0x235f3b['query']['filter']+'%'};return _0x1eac14;})});}_0xdd3b1a=_[_0x888c('0x5b')]({},_0xdd3b1a,_0x235f3b['options']);return _0x5cb1ba['getVoiceQueuesRt'](_0xdd3b1a);}})[_0x888c('0x1d')](function(_0x1b3acd){if(_0x1b3acd){_0x412119=_0x1b3acd['length'];if(!_0x235f3b[_0x888c('0x4b')]['hasOwnProperty']('nolimit')){_0xdd3b1a[_0x888c('0x2e')]=qs[_0x888c('0x2e')](_0x235f3b['query']['limit']);_0xdd3b1a['offset']=qs[_0x888c('0x2d')](_0x235f3b['query'][_0x888c('0x2d')]);}return _0x5cb1ba[_0x888c('0xcf')](_0xdd3b1a);}})[_0x888c('0x1d')](function(_0x5f0467){if(_0x5f0467){return _0x5f0467?{'count':_0x412119,'rows':_0x5f0467}:null;}})[_0x888c('0x1d')](respondWithResult(_0x9d58c4,null))['catch'](handleError(_0x9d58c4,null));};exports[_0x888c('0xd1')]=function(_0x4254df,_0x5d874d,_0x55d5ab){var _0x180232={};var _0x1ad6a1={};var _0x420e3b;var _0x2fe21f;return db[_0x888c('0x45')][_0x888c('0xa0')]({'where':{'id':_0x4254df[_0x888c('0x97')]['id']}})[_0x888c('0x1d')](handleEntityNotFound(_0x5d874d,null))['then'](function(_0x559727){if(_0x559727){_0x420e3b=_0x559727;_0x1ad6a1[_0x888c('0x49')]=_[_0x888c('0x4c')](db[_0x888c('0xd2')][_0x888c('0x62')]);_0x1ad6a1[_0x888c('0x4b')]=_[_0x888c('0x4c')](_0x4254df[_0x888c('0x4b')]);_0x1ad6a1[_0x888c('0x4d')]=_[_0x888c('0x4e')](_0x1ad6a1[_0x888c('0x49')],_0x1ad6a1['query']);_0x180232[_0x888c('0x4f')]=_[_0x888c('0x4e')](_0x1ad6a1[_0x888c('0x49')],qs[_0x888c('0x50')](_0x4254df['query'][_0x888c('0x50')]));_0x180232[_0x888c('0x4f')]=_0x180232['attributes'][_0x888c('0x51')]?_0x180232['attributes']:_0x1ad6a1[_0x888c('0x49')];_0x180232[_0x888c('0x54')]=qs[_0x888c('0x55')](_0x4254df[_0x888c('0x4b')][_0x888c('0x55')]);_0x180232[_0x888c('0x56')]=qs['filters'](_[_0x888c('0x57')](_0x4254df[_0x888c('0x4b')],_0x1ad6a1[_0x888c('0x4d')]));if(_0x4254df[_0x888c('0x4b')]['filter']){_0x180232[_0x888c('0x56')]=_[_0x888c('0x5b')](_0x180232[_0x888c('0x56')],{'$or':_[_0x888c('0x3c')](_0x180232[_0x888c('0x4f')],function(_0x511d2f){var _0x3b67c1={};_0x3b67c1[_0x511d2f]={'$like':'%'+_0x4254df[_0x888c('0x4b')][_0x888c('0x3b')]+'%'};return _0x3b67c1;})});}_0x180232=_[_0x888c('0x5b')]({},_0x180232,_0x4254df[_0x888c('0x5c')]);return _0x420e3b[_0x888c('0xd1')](_0x180232);}})[_0x888c('0x1d')](function(_0x4daae8){if(_0x4daae8){_0x2fe21f=_0x4daae8['length'];if(!_0x4254df['query'][_0x888c('0x52')]('nolimit')){_0x180232[_0x888c('0x2e')]=qs[_0x888c('0x2e')](_0x4254df[_0x888c('0x4b')][_0x888c('0x2e')]);_0x180232['offset']=qs[_0x888c('0x2d')](_0x4254df[_0x888c('0x4b')]['offset']);}return _0x420e3b[_0x888c('0xd1')](_0x180232);}})[_0x888c('0x1d')](function(_0x2d4a72){if(_0x2d4a72){return _0x2d4a72?{'count':_0x2fe21f,'rows':_0x2d4a72}:null;}})[_0x888c('0x1d')](respondWithResult(_0x5d874d,null))[_0x888c('0x27')](handleError(_0x5d874d,null));};exports[_0x888c('0xd3')]=function(_0xf668bb,_0x3955b6,_0x26f471){var _0xd2a3f2={'raw':!![],'where':{}};var _0x1903fd={};var _0x3ea39e={'count':0x0,'rows':[]};return db[_0x888c('0x45')]['findOne']({'where':{'id':_0xf668bb[_0x888c('0x97')]['id']}})[_0x888c('0x1d')](handleEntityNotFound(_0x3955b6,null))[_0x888c('0x1d')](function(_0x590659){if(_0x590659){_0x1903fd[_0x888c('0x49')]=_[_0x888c('0x4c')](db[_0x888c('0xd4')][_0x888c('0x62')]);_0x1903fd['query']=_['keys'](_0xf668bb[_0x888c('0x4b')]);_0x1903fd['filters']=_[_0x888c('0x4e')](_0x1903fd[_0x888c('0x49')],_0x1903fd[_0x888c('0x4b')]);_0xd2a3f2['attributes']=_[_0x888c('0x4e')](_0x1903fd[_0x888c('0x49')],qs[_0x888c('0x50')](_0xf668bb[_0x888c('0x4b')][_0x888c('0x50')]));_0xd2a3f2[_0x888c('0x4f')]=_0xd2a3f2[_0x888c('0x4f')][_0x888c('0x51')]?_0xd2a3f2[_0x888c('0x4f')]:_0x1903fd[_0x888c('0x49')];if(!_0xf668bb[_0x888c('0x4b')]['hasOwnProperty']('nolimit')){_0xd2a3f2[_0x888c('0x2e')]=qs[_0x888c('0x2e')](_0xf668bb[_0x888c('0x4b')][_0x888c('0x2e')]);_0xd2a3f2['offset']=qs[_0x888c('0x2d')](_0xf668bb['query'][_0x888c('0x2d')]);}_0xd2a3f2[_0x888c('0x54')]=qs[_0x888c('0x55')](_0xf668bb[_0x888c('0x4b')][_0x888c('0x55')]);_0xd2a3f2[_0x888c('0x56')]=qs[_0x888c('0x4d')](_[_0x888c('0x57')](_0xf668bb['query'],_0x1903fd['filters']));_0xd2a3f2['where'][_0x888c('0xd5')]=_0x590659['id'];if(_0xf668bb['query'][_0x888c('0x3b')]){_0xd2a3f2['where']=_[_0x888c('0x5b')](_0xd2a3f2[_0x888c('0x56')],{'$or':_[_0x888c('0x3c')](_0xd2a3f2['attributes'],function(_0x50efcb){var _0x53665d={};_0x53665d[_0x50efcb]={'$like':'%'+_0xf668bb[_0x888c('0x4b')][_0x888c('0x3b')]+'%'};return _0x53665d;})});}_0xd2a3f2=_[_0x888c('0x5b')]({},_0xd2a3f2,_0xf668bb['options']);return db[_0x888c('0xd4')][_0x888c('0x2c')]({'where':_0xd2a3f2[_0x888c('0x56')]})[_0x888c('0x1d')](function(_0x1828e8){_0x3ea39e[_0x888c('0x2c')]=_0x1828e8;if(_0xf668bb[_0x888c('0x4b')][_0x888c('0x64')]){_0xd2a3f2[_0x888c('0x5d')]=[{'all':!![]}];}return db[_0x888c('0xd4')][_0x888c('0x5e')](_0xd2a3f2);})[_0x888c('0x1d')](function(_0x21e0ab){_0x3ea39e[_0x888c('0x5f')]=_0x21e0ab;return _0x3ea39e;});}})[_0x888c('0x1d')](respondWithFilteredResult(_0x3955b6,_0xd2a3f2))[_0x888c('0x27')](handleError(_0x3955b6,null));};exports[_0x888c('0xd6')]=function(_0x3b424e,_0x1cbbf2,_0x5df695){var _0x2dd66f={'raw':!![],'where':{}};var _0x246827={};var _0x551ef6={'count':0x0,'rows':[]};return db[_0x888c('0x45')][_0x888c('0xa0')]({'where':{'id':_0x3b424e[_0x888c('0x97')]['id']}})[_0x888c('0x1d')](handleEntityNotFound(_0x1cbbf2,null))[_0x888c('0x1d')](function(_0x3acfe0){if(_0x3acfe0){_0x246827['model']=_['keys'](db[_0x888c('0xd7')][_0x888c('0x62')]);_0x246827[_0x888c('0x4b')]=_['keys'](_0x3b424e['query']);_0x246827['filters']=_['intersection'](_0x246827['model'],_0x246827['query']);_0x2dd66f[_0x888c('0x4f')]=_[_0x888c('0x4e')](_0x246827[_0x888c('0x49')],qs[_0x888c('0x50')](_0x3b424e[_0x888c('0x4b')][_0x888c('0x50')]));_0x2dd66f[_0x888c('0x4f')]=_0x2dd66f[_0x888c('0x4f')][_0x888c('0x51')]?_0x2dd66f['attributes']:_0x246827[_0x888c('0x49')];if(!_0x3b424e[_0x888c('0x4b')][_0x888c('0x52')]('nolimit')){_0x2dd66f[_0x888c('0x2e')]=qs[_0x888c('0x2e')](_0x3b424e[_0x888c('0x4b')]['limit']);_0x2dd66f[_0x888c('0x2d')]=qs[_0x888c('0x2d')](_0x3b424e[_0x888c('0x4b')][_0x888c('0x2d')]);}_0x2dd66f['order']=qs[_0x888c('0x55')](_0x3b424e[_0x888c('0x4b')]['sort']);_0x2dd66f[_0x888c('0x56')]=qs['filters'](_[_0x888c('0x57')](_0x3b424e[_0x888c('0x4b')],_0x246827[_0x888c('0x4d')]));_0x2dd66f[_0x888c('0x56')][_0x888c('0xd5')]=_0x3acfe0['id'];if(_0x3b424e[_0x888c('0x4b')]['filter']){_0x2dd66f[_0x888c('0x56')]=_['merge'](_0x2dd66f[_0x888c('0x56')],{'$or':_[_0x888c('0x3c')](_0x2dd66f['attributes'],function(_0x5a5325){var _0x4a7378={};_0x4a7378[_0x5a5325]={'$like':'%'+_0x3b424e[_0x888c('0x4b')]['filter']+'%'};return _0x4a7378;})});}_0x2dd66f=_['merge']({},_0x2dd66f,_0x3b424e[_0x888c('0x5c')]);return db['ScreenRecording'][_0x888c('0x2c')]({'where':_0x2dd66f[_0x888c('0x56')]})['then'](function(_0x4ebb19){_0x551ef6[_0x888c('0x2c')]=_0x4ebb19;if(_0x3b424e[_0x888c('0x4b')]['includeAll']){_0x2dd66f[_0x888c('0x5d')]=[{'all':!![]}];}return db[_0x888c('0xd7')][_0x888c('0x5e')](_0x2dd66f);})[_0x888c('0x1d')](function(_0x50d603){_0x551ef6[_0x888c('0x5f')]=_0x50d603;return _0x551ef6;});}})['then'](respondWithFilteredResult(_0x1cbbf2,_0x2dd66f))[_0x888c('0x27')](handleError(_0x1cbbf2,null));};exports[_0x888c('0xd8')]=function(_0x2b81f0,_0x225b56,_0x1bdb13){var _0x24e8ad={};var _0x365502={};var _0x54e15c;var _0xb9fec2;return db[_0x888c('0x45')][_0x888c('0xa0')]({'where':{'id':_0x2b81f0[_0x888c('0x97')]['id']}})[_0x888c('0x1d')](handleEntityNotFound(_0x225b56,null))['then'](function(_0x4641dc){if(_0x4641dc){_0x54e15c=_0x4641dc;_0x365502[_0x888c('0x49')]=_[_0x888c('0x4c')](db['ChatInteraction'][_0x888c('0x62')]);_0x365502[_0x888c('0x4b')]=_['keys'](_0x2b81f0['query']);_0x365502[_0x888c('0x4d')]=_[_0x888c('0x4e')](_0x365502[_0x888c('0x49')],_0x365502[_0x888c('0x4b')]);_0x24e8ad['attributes']=_['intersection'](_0x365502[_0x888c('0x49')],qs['fields'](_0x2b81f0[_0x888c('0x4b')][_0x888c('0x50')]));_0x24e8ad['attributes']=_0x24e8ad[_0x888c('0x4f')][_0x888c('0x51')]?_0x24e8ad[_0x888c('0x4f')]:_0x365502[_0x888c('0x49')];_0x24e8ad[_0x888c('0x54')]=qs[_0x888c('0x55')](_0x2b81f0[_0x888c('0x4b')][_0x888c('0x55')]);_0x24e8ad['where']=qs[_0x888c('0x4d')](_[_0x888c('0x57')](_0x2b81f0[_0x888c('0x4b')],_0x365502['filters']));if(_0x2b81f0[_0x888c('0x4b')][_0x888c('0x3b')]){_0x24e8ad['where']=_[_0x888c('0x5b')](_0x24e8ad['where'],{'$or':_[_0x888c('0x3c')](_0x24e8ad[_0x888c('0x4f')],function(_0x21ce65){var _0x2816e7={};_0x2816e7[_0x21ce65]={'$like':'%'+_0x2b81f0['query']['filter']+'%'};return _0x2816e7;})});}_0x24e8ad=_['merge']({},_0x24e8ad,_0x2b81f0[_0x888c('0x5c')]);return _0x54e15c[_0x888c('0xd8')](_0x24e8ad);}})[_0x888c('0x1d')](function(_0x32601c){if(_0x32601c){_0xb9fec2=_0x32601c[_0x888c('0x51')];if(!_0x2b81f0[_0x888c('0x4b')][_0x888c('0x52')]('nolimit')){_0x24e8ad[_0x888c('0x2e')]=qs[_0x888c('0x2e')](_0x2b81f0[_0x888c('0x4b')][_0x888c('0x2e')]);_0x24e8ad[_0x888c('0x2d')]=qs['offset'](_0x2b81f0[_0x888c('0x4b')][_0x888c('0x2d')]);}return _0x54e15c[_0x888c('0xd8')](_0x24e8ad);}})[_0x888c('0x1d')](function(_0x18178c){if(_0x18178c){return _0x18178c?{'count':_0xb9fec2,'rows':_0x18178c}:null;}})['then'](respondWithResult(_0x225b56,null))['catch'](handleError(_0x225b56,null));};exports['getOpenchannelInteractions']=function(_0xacacec,_0x36d7ce,_0x2dd956){var _0xe049f2={};var _0x422d12={};var _0x599925;var _0x1bf817;return db[_0x888c('0x45')][_0x888c('0xa0')]({'where':{'id':_0xacacec[_0x888c('0x97')]['id']}})[_0x888c('0x1d')](handleEntityNotFound(_0x36d7ce,null))[_0x888c('0x1d')](function(_0x456093){if(_0x456093){_0x599925=_0x456093;_0x422d12['model']=_['keys'](db['OpenchannelInteraction'][_0x888c('0x62')]);_0x422d12['query']=_[_0x888c('0x4c')](_0xacacec['query']);_0x422d12[_0x888c('0x4d')]=_[_0x888c('0x4e')](_0x422d12[_0x888c('0x49')],_0x422d12['query']);_0xe049f2[_0x888c('0x4f')]=_[_0x888c('0x4e')](_0x422d12['model'],qs[_0x888c('0x50')](_0xacacec['query'][_0x888c('0x50')]));_0xe049f2[_0x888c('0x4f')]=_0xe049f2[_0x888c('0x4f')][_0x888c('0x51')]?_0xe049f2[_0x888c('0x4f')]:_0x422d12[_0x888c('0x49')];_0xe049f2[_0x888c('0x54')]=qs[_0x888c('0x55')](_0xacacec[_0x888c('0x4b')][_0x888c('0x55')]);_0xe049f2['where']=qs[_0x888c('0x4d')](_[_0x888c('0x57')](_0xacacec[_0x888c('0x4b')],_0x422d12['filters']));if(_0xacacec[_0x888c('0x4b')][_0x888c('0x3b')]){_0xe049f2[_0x888c('0x56')]=_[_0x888c('0x5b')](_0xe049f2[_0x888c('0x56')],{'$or':_[_0x888c('0x3c')](_0xe049f2[_0x888c('0x4f')],function(_0x14c46b){var _0x11d511={};_0x11d511[_0x14c46b]={'$like':'%'+_0xacacec['query']['filter']+'%'};return _0x11d511;})});}_0xe049f2=_[_0x888c('0x5b')]({},_0xe049f2,_0xacacec[_0x888c('0x5c')]);return _0x599925[_0x888c('0xd9')](_0xe049f2);}})[_0x888c('0x1d')](function(_0x50995f){if(_0x50995f){_0x1bf817=_0x50995f['length'];if(!_0xacacec[_0x888c('0x4b')][_0x888c('0x52')](_0x888c('0x53'))){_0xe049f2[_0x888c('0x2e')]=qs['limit'](_0xacacec[_0x888c('0x4b')][_0x888c('0x2e')]);_0xe049f2['offset']=qs['offset'](_0xacacec['query'][_0x888c('0x2d')]);}return _0x599925['getOpenchannelInteractions'](_0xe049f2);}})[_0x888c('0x1d')](function(_0xa6064b){if(_0xa6064b){return _0xa6064b?{'count':_0x1bf817,'rows':_0xa6064b}:null;}})[_0x888c('0x1d')](respondWithResult(_0x36d7ce,null))[_0x888c('0x27')](handleError(_0x36d7ce,null));};exports[_0x888c('0xda')]=function(_0x521d2a,_0x4259df,_0x3ea7c8){var _0x5d1b02={'raw':!![],'where':{}};var _0x5f2913={};var _0x49c2ee={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x521d2a[_0x888c('0x97')]['id']}})[_0x888c('0x1d')](handleEntityNotFound(_0x4259df,null))[_0x888c('0x1d')](function(_0x30877f){if(_0x30877f){_0x5f2913[_0x888c('0x49')]=_[_0x888c('0x4c')](db['MailInteraction'][_0x888c('0x62')]);_0x5f2913['query']=_['keys'](_0x521d2a[_0x888c('0x4b')]);_0x5f2913['filters']=_[_0x888c('0x4e')](_0x5f2913['model'],_0x5f2913[_0x888c('0x4b')]);_0x5d1b02[_0x888c('0x4f')]=_[_0x888c('0x4e')](_0x5f2913[_0x888c('0x49')],qs[_0x888c('0x50')](_0x521d2a[_0x888c('0x4b')][_0x888c('0x50')]));_0x5d1b02['attributes']=_0x5d1b02[_0x888c('0x4f')][_0x888c('0x51')]?_0x5d1b02[_0x888c('0x4f')]:_0x5f2913['model'];if(!_0x521d2a['query'][_0x888c('0x52')](_0x888c('0x53'))){_0x5d1b02[_0x888c('0x2e')]=qs[_0x888c('0x2e')](_0x521d2a['query']['limit']);_0x5d1b02[_0x888c('0x2d')]=qs['offset'](_0x521d2a[_0x888c('0x4b')][_0x888c('0x2d')]);}_0x5d1b02[_0x888c('0x54')]=qs[_0x888c('0x55')](_0x521d2a[_0x888c('0x4b')][_0x888c('0x55')]);_0x5d1b02[_0x888c('0x56')]=qs[_0x888c('0x4d')](_[_0x888c('0x57')](_0x521d2a[_0x888c('0x4b')],_0x5f2913['filters']));_0x5d1b02['where'][_0x888c('0xd5')]=_0x30877f['id'];if(_0x521d2a[_0x888c('0x4b')][_0x888c('0x3b')]){_0x5d1b02[_0x888c('0x56')]=_['merge'](_0x5d1b02[_0x888c('0x56')],{'$or':_[_0x888c('0x3c')](_0x5d1b02[_0x888c('0x4f')],function(_0x450525){var _0x17965e={};_0x17965e[_0x450525]={'$like':'%'+_0x521d2a[_0x888c('0x4b')][_0x888c('0x3b')]+'%'};return _0x17965e;})});}_0x5d1b02=_[_0x888c('0x5b')]({},_0x5d1b02,_0x521d2a[_0x888c('0x5c')]);return db[_0x888c('0xdb')]['count']({'where':_0x5d1b02[_0x888c('0x56')]})[_0x888c('0x1d')](function(_0x18395a){_0x49c2ee[_0x888c('0x2c')]=_0x18395a;if(_0x521d2a[_0x888c('0x4b')][_0x888c('0x64')]){_0x5d1b02['include']=[{'all':!![]}];}return db[_0x888c('0xdb')]['findAll'](_0x5d1b02);})[_0x888c('0x1d')](function(_0x5f0b95){_0x49c2ee[_0x888c('0x5f')]=_0x5f0b95;return _0x49c2ee;});}})[_0x888c('0x1d')](respondWithFilteredResult(_0x4259df,_0x5d1b02))[_0x888c('0x27')](handleError(_0x4259df,null));};exports['getSmsInteractions']=function(_0x5e2de2,_0x3b7962,_0xd550d1){var _0x36f759={};var _0x358df1={};var _0x112785;var _0x4ee141;return db[_0x888c('0x45')][_0x888c('0xa0')]({'where':{'id':_0x5e2de2['params']['id']}})['then'](handleEntityNotFound(_0x3b7962,null))[_0x888c('0x1d')](function(_0x5248d8){if(_0x5248d8){_0x112785=_0x5248d8;_0x358df1[_0x888c('0x49')]=_['keys'](db[_0x888c('0xdc')][_0x888c('0x62')]);_0x358df1['query']=_['keys'](_0x5e2de2[_0x888c('0x4b')]);_0x358df1['filters']=_[_0x888c('0x4e')](_0x358df1['model'],_0x358df1[_0x888c('0x4b')]);_0x36f759[_0x888c('0x4f')]=_[_0x888c('0x4e')](_0x358df1['model'],qs['fields'](_0x5e2de2[_0x888c('0x4b')]['fields']));_0x36f759[_0x888c('0x4f')]=_0x36f759[_0x888c('0x4f')][_0x888c('0x51')]?_0x36f759[_0x888c('0x4f')]:_0x358df1[_0x888c('0x49')];_0x36f759['order']=qs[_0x888c('0x55')](_0x5e2de2[_0x888c('0x4b')]['sort']);_0x36f759['where']=qs['filters'](_[_0x888c('0x57')](_0x5e2de2[_0x888c('0x4b')],_0x358df1[_0x888c('0x4d')]));if(_0x5e2de2[_0x888c('0x4b')][_0x888c('0x3b')]){_0x36f759[_0x888c('0x56')]=_[_0x888c('0x5b')](_0x36f759['where'],{'$or':_['map'](_0x36f759['attributes'],function(_0x609ad8){var _0x5a3d3c={};_0x5a3d3c[_0x609ad8]={'$like':'%'+_0x5e2de2[_0x888c('0x4b')][_0x888c('0x3b')]+'%'};return _0x5a3d3c;})});}_0x36f759=_[_0x888c('0x5b')]({},_0x36f759,_0x5e2de2[_0x888c('0x5c')]);return _0x112785[_0x888c('0xdd')](_0x36f759);}})[_0x888c('0x1d')](function(_0x3095a2){if(_0x3095a2){_0x4ee141=_0x3095a2[_0x888c('0x51')];if(!_0x5e2de2[_0x888c('0x4b')][_0x888c('0x52')](_0x888c('0x53'))){_0x36f759[_0x888c('0x2e')]=qs[_0x888c('0x2e')](_0x5e2de2[_0x888c('0x4b')]['limit']);_0x36f759[_0x888c('0x2d')]=qs[_0x888c('0x2d')](_0x5e2de2['query'][_0x888c('0x2d')]);}return _0x112785['getSmsInteractions'](_0x36f759);}})['then'](function(_0x5d4024){if(_0x5d4024){return _0x5d4024?{'count':_0x4ee141,'rows':_0x5d4024}:null;}})[_0x888c('0x1d')](respondWithResult(_0x3b7962,null))[_0x888c('0x27')](handleError(_0x3b7962,null));};exports[_0x888c('0xde')]=function(_0x440ad6,_0x2a67b5,_0x1edcd0){var _0x55473b={};var _0x1acf27={};var _0x30be8f;var _0xbddbf0;return db[_0x888c('0x45')]['findOne']({'where':{'id':_0x440ad6[_0x888c('0x97')]['id']}})[_0x888c('0x1d')](handleEntityNotFound(_0x2a67b5,null))[_0x888c('0x1d')](function(_0x5a9a7e){if(_0x5a9a7e){_0x30be8f=_0x5a9a7e;_0x1acf27[_0x888c('0x49')]=_[_0x888c('0x4c')](db[_0x888c('0xdf')][_0x888c('0x62')]);_0x1acf27['query']=_['keys'](_0x440ad6['query']);_0x1acf27['filters']=_['intersection'](_0x1acf27['model'],_0x1acf27[_0x888c('0x4b')]);_0x55473b[_0x888c('0x4f')]=_['intersection'](_0x1acf27[_0x888c('0x49')],qs[_0x888c('0x50')](_0x440ad6[_0x888c('0x4b')][_0x888c('0x50')]));_0x55473b[_0x888c('0x4f')]=_0x55473b[_0x888c('0x4f')][_0x888c('0x51')]?_0x55473b[_0x888c('0x4f')]:_0x1acf27[_0x888c('0x49')];_0x55473b[_0x888c('0x54')]=qs[_0x888c('0x55')](_0x440ad6[_0x888c('0x4b')]['sort']);_0x55473b[_0x888c('0x56')]=qs[_0x888c('0x4d')](_[_0x888c('0x57')](_0x440ad6[_0x888c('0x4b')],_0x1acf27[_0x888c('0x4d')]));if(_0x440ad6[_0x888c('0x4b')][_0x888c('0x3b')]){_0x55473b['where']=_[_0x888c('0x5b')](_0x55473b[_0x888c('0x56')],{'$or':_['map'](_0x55473b['attributes'],function(_0x33f076){var _0x2e7d75={};_0x2e7d75[_0x33f076]={'$like':'%'+_0x440ad6[_0x888c('0x4b')][_0x888c('0x3b')]+'%'};return _0x2e7d75;})});}_0x55473b=_[_0x888c('0x5b')]({},_0x55473b,_0x440ad6[_0x888c('0x5c')]);return _0x30be8f[_0x888c('0xde')](_0x55473b);}})[_0x888c('0x1d')](function(_0x59edaf){if(_0x59edaf){_0xbddbf0=_0x59edaf[_0x888c('0x51')];if(!_0x440ad6['query']['hasOwnProperty'](_0x888c('0x53'))){_0x55473b[_0x888c('0x2e')]=qs['limit'](_0x440ad6['query']['limit']);_0x55473b['offset']=qs[_0x888c('0x2d')](_0x440ad6[_0x888c('0x4b')]['offset']);}return _0x30be8f[_0x888c('0xde')](_0x55473b);}})['then'](function(_0x434d3b){if(_0x434d3b){return _0x434d3b?{'count':_0xbddbf0,'rows':_0x434d3b}:null;}})['then'](respondWithResult(_0x2a67b5,null))[_0x888c('0x27')](handleError(_0x2a67b5,null));};exports[_0x888c('0xe0')]=function(_0x188477,_0x2ae9af,_0x47c32b){var _0x1c0ab1={};var _0x3ee02e={};var _0x36bdd2;var _0x5154a5;return db['User'][_0x888c('0xa0')]({'where':{'id':_0x188477[_0x888c('0x97')]['id']}})[_0x888c('0x1d')](handleEntityNotFound(_0x2ae9af,null))[_0x888c('0x1d')](function(_0x3be6f4){if(_0x3be6f4){_0x36bdd2=_0x3be6f4;_0x3ee02e[_0x888c('0x49')]=_[_0x888c('0x4c')](db[_0x888c('0xe1')]['rawAttributes']);_0x3ee02e['query']=_[_0x888c('0x4c')](_0x188477[_0x888c('0x4b')]);_0x3ee02e['filters']=_[_0x888c('0x4e')](_0x3ee02e['model'],_0x3ee02e[_0x888c('0x4b')]);_0x1c0ab1[_0x888c('0x4f')]=_[_0x888c('0x4e')](_0x3ee02e[_0x888c('0x49')],qs[_0x888c('0x50')](_0x188477[_0x888c('0x4b')][_0x888c('0x50')]));_0x1c0ab1[_0x888c('0x4f')]=_0x1c0ab1['attributes'][_0x888c('0x51')]?_0x1c0ab1[_0x888c('0x4f')]:_0x3ee02e[_0x888c('0x49')];_0x1c0ab1[_0x888c('0x54')]=qs[_0x888c('0x55')](_0x188477[_0x888c('0x4b')][_0x888c('0x55')]);_0x1c0ab1[_0x888c('0x56')]=qs['filters'](_[_0x888c('0x57')](_0x188477['query'],_0x3ee02e[_0x888c('0x4d')]));if(_0x188477[_0x888c('0x4b')][_0x888c('0x3b')]){_0x1c0ab1[_0x888c('0x56')]=_[_0x888c('0x5b')](_0x1c0ab1[_0x888c('0x56')],{'$or':_[_0x888c('0x3c')](_0x1c0ab1[_0x888c('0x4f')],function(_0x168fd1){var _0x1b2f5a={};_0x1b2f5a[_0x168fd1]={'$like':'%'+_0x188477['query'][_0x888c('0x3b')]+'%'};return _0x1b2f5a;})});}_0x1c0ab1=_['merge']({},_0x1c0ab1,_0x188477[_0x888c('0x5c')]);return _0x36bdd2[_0x888c('0xe0')](_0x1c0ab1);}})[_0x888c('0x1d')](function(_0xdf2ead){if(_0xdf2ead){_0x5154a5=_0xdf2ead['length'];if(!_0x188477[_0x888c('0x4b')][_0x888c('0x52')]('nolimit')){_0x1c0ab1['limit']=qs['limit'](_0x188477['query']['limit']);_0x1c0ab1[_0x888c('0x2d')]=qs[_0x888c('0x2d')](_0x188477['query'][_0x888c('0x2d')]);}return _0x36bdd2[_0x888c('0xe0')](_0x1c0ab1);}})['then'](function(_0x9a673c){if(_0x9a673c){return _0x9a673c?{'count':_0x5154a5,'rows':_0x9a673c}:null;}})[_0x888c('0x1d')](respondWithResult(_0x2ae9af,null))[_0x888c('0x27')](handleError(_0x2ae9af,null));};exports['login']=function(_0x188b8d,_0x16ba56,_0x33d2f2){var _0x15d2e9;var _0x2cf4b0;var _0x406a0b;var _0x3264b3=!_[_0x888c('0x74')](_0x188b8d[_0x888c('0x97')]['id'])?_0x188b8d[_0x888c('0x97')]['id']:!_['isNil'](_0x188b8d[_0x888c('0x37')]['id'])?_0x188b8d[_0x888c('0x37')]['id']:null;return db[_0x888c('0x45')][_0x888c('0x3f')]({'where':{'id':_0x3264b3,'role':{'$or':[_0x888c('0x35'),_0x888c('0x37'),_0x888c('0x39')]}},'attributes':['id',_0x888c('0x40'),'phone',_0x888c('0xe2'),_0x888c('0x34'),_0x888c('0x6b'),_0x888c('0xa8')]})[_0x888c('0x1d')](function(_0x36217d){if(_0x36217d){if(_0x36217d[_0x888c('0x34')]===_0x888c('0x39')){_0x15d2e9=_0x36217d;if(_0x188b8d[_0x888c('0x66')][_0x888c('0xaa')]){_0x406a0b=util['format'](_0x888c('0xe3'),_0x15d2e9[_0x188b8d[_0x888c('0x66')][_0x888c('0xaa')]]);}else if(_0x188b8d[_0x888c('0x66')][_0x888c('0xe4')]){_0x406a0b=util[_0x888c('0xe5')](_0x888c('0xb6'),_0x188b8d[_0x888c('0x66')][_0x888c('0xe4')]);}else{_0x406a0b=util[_0x888c('0xe5')](_0x888c('0xb6'),_0x15d2e9['name']);}socket['to'](util[_0x888c('0xe5')](_0x888c('0xe6'),_0x15d2e9[_0x888c('0x40')]))[_0x888c('0xb3')](_0x888c('0xe7'),{'user':{'id':_0x15d2e9['id'],'name':_0x15d2e9[_0x888c('0x40')]},'ip':_0x188b8d[_0x888c('0xe8')]['x-forwarded-for']||_0x188b8d['connection'][_0x888c('0xe9')]||_0x188b8d['socket'][_0x888c('0xe9')]||_0x188b8d['connection'][_0x888c('0xea')][_0x888c('0xe9')]});return db[_0x888c('0xd0')][_0x888c('0xb9')]({'where':{'membername':_0x15d2e9[_0x888c('0x40')]},'individualHooks':!![]});}}else{throw new db[(_0x888c('0x99'))][(_0x888c('0x9a'))](_0x888c('0xeb'));}})[_0x888c('0x1d')](function(){if(_0x15d2e9){return _0x15d2e9[_0x888c('0xec')]({'raw':!![]});}})[_0x888c('0x1d')](function(_0x231f61){if(_0x15d2e9){var _0x2237eb=[];if(_0x231f61){_0x2cf4b0=_0x231f61;if(_0x2cf4b0[_0x888c('0x51')]){for(var _0xf187a2=0x0;_0xf187a2<_0x2cf4b0[_0x888c('0x51')];_0xf187a2++){_0x2237eb[_0x888c('0x91')]({'membername':_0x15d2e9[_0x888c('0x40')],'UserId':_0x15d2e9['id'],'queue_name':_0x2cf4b0[_0xf187a2][_0x888c('0x40')],'VoiceQueueId':_0x2cf4b0[_0xf187a2]['id'],'interface':_0x406a0b,'paused':_0x15d2e9['loginInPause']||![],'penalty':_0x2cf4b0[_0xf187a2][_0x888c('0xed')]||0x0});}return BPromise[_0x888c('0x93')](_0x2237eb,function(_0x6366b9){return db[_0x888c('0xd0')][_0x888c('0xb7')](_0x6366b9);});}}}})['then'](function(){if(_0x15d2e9){return db[_0x888c('0xee')][_0x888c('0x5e')]({'where':{'membername':_0x15d2e9[_0x888c('0x40')],'exitAt':null}});}})['then'](function(_0x274947){if(_0x15d2e9){var _0x3341e6=[];_0x274947[_0x888c('0xef')](function(_0x36c0ef){_0x3341e6[_0x888c('0x91')](_0x36c0ef[_0x888c('0x65')]({'exitAt':moment()[_0x888c('0xe5')](_0x888c('0xf0'))}));});return BPromise[_0x888c('0x92')](_0x3341e6);}})['then'](function(){if(_0x15d2e9){var _0xcaf555=[];var _0x59722f=[];var _0x1ebeca=utils[_0x888c('0xf1')]();var _0x40a477={'membername':_0x15d2e9[_0x888c('0x40')],'interface':_0x406a0b,'enterAt':moment()['format'](_0x888c('0xf0')),'role':_0x15d2e9[_0x888c('0x34')],'internal':_0x15d2e9[_0x888c('0x6b')]};_0x1ebeca[_0x888c('0xef')](function(_0x2a2638){_0xcaf555[_0x888c('0x91')](_[_0x888c('0x5b')]({'channel':_0x2a2638,'type':_0x888c('0xf2'),'data1':_0x188b8d[_0x888c('0x66')][_0x888c('0xf3')],'data2':_0x406a0b},_0x40a477));if(_0x15d2e9[_0x888c('0xa8')]){_0x59722f['push'](_[_0x888c('0x5b')]({'channel':_0x2a2638,'type':_0x888c('0xf4'),'data1':_0x888c('0xf5')},_0x40a477));}});return db['MemberReport']['bulkCreate'](_0xcaf555[_0x888c('0xf6')](_0x59722f),{'individualHooks':!![]});}})[_0x888c('0x1d')](function(){if(_0x15d2e9){return _0x15d2e9[_0x888c('0x65')]({'online':!![],'lastLoginAt':moment()[_0x888c('0xe5')](_0x888c('0xf0')),'voicePause':_0x15d2e9[_0x888c('0xa8')]||![],'mailPause':_0x15d2e9[_0x888c('0xa8')]||![],'chatPause':_0x15d2e9[_0x888c('0xa8')]||![],'faxPause':_0x15d2e9[_0x888c('0xa8')]||![],'smsPause':_0x15d2e9[_0x888c('0xa8')]||![],'openchannelPause':_0x15d2e9[_0x888c('0xa8')]||![],'whatsappPause':_0x15d2e9[_0x888c('0xa8')]||![],'pauseType':_0x15d2e9[_0x888c('0xa8')]?_0x888c('0xf5'):null,'interface':_0x406a0b,'lastPauseAt':moment()[_0x888c('0xe5')](_0x888c('0xf0'))});}})['then'](function(_0x504846){if(_0x188b8d[_0x888c('0xf7')]){return _0x33d2f2();}else{return BPromise['resolve'](_0x504846)[_0x888c('0x1d')](respondWithResult(_0x16ba56,null));}})[_0x888c('0x27')](handleError(_0x16ba56,null));};exports['logout']=function(_0xb9a702,_0x1dcdd6,_0x47b35a){var _0x16cd1c;return db[_0x888c('0x45')][_0x888c('0x3f')]({'where':{'id':_0xb9a702['params']['id'],'role':'agent'},'attributes':['id',_0x888c('0x40'),_0x888c('0x34')]})[_0x888c('0x1d')](handleEntityNotFound(_0x1dcdd6,null))[_0x888c('0x1d')](function(_0x29e522){if(_0x29e522){_0x16cd1c=_0x29e522;return db[_0x888c('0xd0')]['destroy']({'where':{'membername':_0x16cd1c[_0x888c('0x40')]},'individualHooks':!![]});}})[_0x888c('0x1d')](function(){return db[_0x888c('0xee')]['findAll']({'where':{'membername':_0x16cd1c['name'],'exitAt':null}});})[_0x888c('0x1d')](function(_0x21ad4f){var _0x1d7225=[];_0x21ad4f[_0x888c('0xef')](function(_0x3e3767){_0x1d7225[_0x888c('0x91')](_0x3e3767[_0x888c('0x65')]({'exitAt':moment()[_0x888c('0xe5')](_0x888c('0xf0'))}));});return BPromise[_0x888c('0x92')](_0x1d7225);})[_0x888c('0x1d')](function(){return _0x16cd1c['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x888c('0x1d')](respondWithResult(_0x1dcdd6,null))[_0x888c('0x27')](handleError(_0x1dcdd6,null));};exports[_0x888c('0xf8')]=function(_0x2b5b73,_0x533da9,_0x1b8fdb){var _0xb6e20b;return db[_0x888c('0xd0')][_0x888c('0x65')]({'paused':0x1},{'where':{'UserId':_0x2b5b73['params']['id']},'individualHooks':!![]})[_0x888c('0x1d')](function(){return db[_0x888c('0x45')]['find']({'where':{'id':_0x2b5b73[_0x888c('0x97')]['id'],'role':'agent'},'attributes':['id',_0x888c('0x40'),'role',_0x888c('0x6b'),_0x888c('0xaa')]});})[_0x888c('0x1d')](handleEntityNotFound(_0x533da9,null))['then'](function(_0xef89ff){if(_0xef89ff){_0xb6e20b=_0xef89ff;return respondWithRpcPromise(_0x888c('0xf9'),'pause',{'id':_0xb6e20b['id'],'name':_0xb6e20b[_0x888c('0x40')],'pause':!![]});}})[_0x888c('0x1d')](function(){if(_0xb6e20b){return db[_0x888c('0xee')]['findAll']({'where':{'membername':_0xb6e20b['name'],'type':'PAUSE','exitAt':null}});}})[_0x888c('0x1d')](function(_0x4ad82c){if(_0x4ad82c['length']){var _0x413821=moment()[_0x888c('0xe5')](_0x888c('0xf0'));for(var _0x5da778=0x0,_0x234eec=_0x4ad82c[_0x888c('0x51')];_0x5da778<_0x234eec;_0x5da778++){_0x4ad82c[_0x5da778][_0x888c('0xfa')]({'exitAt':_0x413821});}}})[_0x888c('0x1d')](function(){var _0x2ce66c=[];var _0x417ec6=utils[_0x888c('0xf1')]();_0x417ec6[_0x888c('0xef')](function(_0x4aff14){_0x2ce66c['push']({'channel':_0x4aff14,'membername':_0xb6e20b[_0x888c('0x40')],'interface':_['isNil'](_0xb6e20b[_0x888c('0xaa')])?util['format']('SIP/%s',_0xb6e20b[_0x888c('0x40')]):_0xb6e20b[_0x888c('0xaa')],'type':_0x888c('0xf4'),'enterAt':moment()['format'](_0x888c('0xf0')),'data1':_0x2b5b73[_0x888c('0x66')][_0x888c('0x47')]||_0x888c('0xfb'),'role':_0xb6e20b[_0x888c('0x34')],'internal':_0xb6e20b[_0x888c('0x6b')]});});return db['MemberReport']['bulkCreate'](_0x2ce66c,{'individualHooks':!![]});})[_0x888c('0x1d')](function(){return _0xb6e20b[_0x888c('0x65')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2b5b73[_0x888c('0x66')][_0x888c('0x47')]||_0x888c('0xfb'),'lastPauseAt':moment()[_0x888c('0xe5')](_0x888c('0xf0'))});})[_0x888c('0x1d')](respondWithResult(_0x533da9,null))[_0x888c('0x27')](handleError(_0x533da9,null));};exports[_0x888c('0xfc')]=function(_0x5645ae,_0x4b6fc2,_0x33d834){var _0x827b17;return db[_0x888c('0x45')][_0x888c('0x3f')]({'where':{'id':_0x5645ae[_0x888c('0x97')]['id']},'attributes':['id',_0x888c('0x40'),_0x888c('0x34'),_0x888c('0xa9'),_0x888c('0xfd'),_0x888c('0xfe'),'faxPause',_0x888c('0xff'),_0x888c('0x100'),_0x888c('0x101'),_0x888c('0x102'),_0x888c('0x103')]})[_0x888c('0x1d')](handleEntityNotFound(_0x4b6fc2,null))[_0x888c('0x1d')](function(_0x104508){if(_0x104508){_0x827b17=_0x104508;if(_0x5645ae[_0x888c('0x66')][_0x888c('0xa7')]&&!utils[_0x888c('0xab')](_0x5645ae['body'][_0x888c('0xa7')])){throw new db[(_0x888c('0x99'))][(_0x888c('0x9a'))]('Unknown\x20channel');}switch(_0x5645ae[_0x888c('0x66')][_0x888c('0xa7')]){case _0x888c('0xb4'):return respondWithRpcPromise(_0x888c('0xf9'),_0x888c('0xfc'),{'id':_0x827b17['id'],'name':_0x827b17['name'],'pause':![]})[_0x888c('0x1d')](function(){return db['UserVoiceQueueRt'][_0x888c('0x65')]({'paused':0x0},{'where':{'UserId':_0x827b17['id']},'individualHooks':!![]});})[_0x888c('0x1d')](function(){return db[_0x888c('0xee')][_0x888c('0x3f')]({'where':{'channel':_0x5645ae[_0x888c('0x66')][_0x888c('0xa7')],'membername':_0x827b17[_0x888c('0x40')],'type':_0x888c('0xf4'),'exitAt':null}});})[_0x888c('0x1d')](function(_0x563c3d){if(_0x563c3d){return _0x563c3d[_0x888c('0x65')]({'exitAt':moment()[_0x888c('0xe5')](_0x888c('0xf0')),'data2':_0x888c('0x104')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x827b17[_0x888c('0x65')]({'voicePause':![]});});case _0x888c('0x105'):case _0x888c('0x106'):case _0x888c('0x107'):case _0x888c('0x108'):case _0x888c('0x109'):case _0x888c('0x10a'):return db['MemberReport'][_0x888c('0x3f')]({'where':{'channel':_0x5645ae['body'][_0x888c('0xa7')],'membername':_0x827b17[_0x888c('0x40')],'type':_0x888c('0xf4'),'exitAt':null}})[_0x888c('0x1d')](function(_0x4c9af2){if(_0x4c9af2){return _0x4c9af2[_0x888c('0x65')]({'exitAt':moment()['format'](_0x888c('0xf0')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x888c('0x1d')](function(){var _0x4098c6={};_[_0x888c('0x2f')](_0x4098c6,util[_0x888c('0xe5')](_0x888c('0x10b'),_0x5645ae[_0x888c('0x66')][_0x888c('0xa7')],'Pause'),![]);return _0x827b17[_0x888c('0x65')](_0x4098c6);});default:return respondWithRpcPromise(_0x888c('0xf9'),'unpause',{'id':_0x827b17['id'],'name':_0x827b17['name'],'pause':![]})[_0x888c('0x1d')](function(){return db[_0x888c('0xd0')][_0x888c('0x65')]({'paused':0x0},{'where':{'UserId':_0x827b17['id']}});})[_0x888c('0x1d')](function(){return db[_0x888c('0xee')][_0x888c('0x5e')]({'where':{'membername':_0x827b17[_0x888c('0x40')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x151a7e){var _0x5ba5b0=[];_0x151a7e[_0x888c('0xef')](function(_0x13d64d){_0x5ba5b0[_0x888c('0x91')](_0x13d64d['update']({'exitAt':moment()[_0x888c('0xe5')](_0x888c('0xf0')),'data2':'manual'}));});return BPromise[_0x888c('0x92')](_0x5ba5b0);})['then'](function(){return _0x827b17['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x888c('0x1d')](respondWithResult(_0x4b6fc2,null))[_0x888c('0x27')](handleError(_0x4b6fc2,null));};exports[_0x888c('0x10c')]=function(_0x20bdad,_0x3246c4,_0x58f418){var _0x1155ec={};var _0x573b2d={};var _0x31085d;var _0x44e346;return db[_0x888c('0x45')][_0x888c('0xa0')]({'where':{'id':_0x20bdad[_0x888c('0x97')]['id']}})['then'](handleEntityNotFound(_0x3246c4,null))[_0x888c('0x1d')](function(_0x5e7e6c){if(_0x5e7e6c){_0x31085d=_0x5e7e6c;_0x573b2d['model']=_['keys'](db[_0x888c('0x10d')][_0x888c('0x62')]);_0x573b2d[_0x888c('0x4b')]=_['keys'](_0x20bdad['query']);_0x573b2d['filters']=_['intersection'](_0x573b2d[_0x888c('0x49')],_0x573b2d[_0x888c('0x4b')]);_0x1155ec['attributes']=_[_0x888c('0x4e')](_0x573b2d[_0x888c('0x49')],qs[_0x888c('0x50')](_0x20bdad[_0x888c('0x4b')]['fields']));_0x1155ec[_0x888c('0x4f')]=_0x1155ec['attributes'][_0x888c('0x51')]?_0x1155ec[_0x888c('0x4f')]:_0x573b2d[_0x888c('0x49')];_0x1155ec[_0x888c('0x54')]=qs[_0x888c('0x55')](_0x20bdad[_0x888c('0x4b')][_0x888c('0x55')]);_0x1155ec[_0x888c('0x56')]=qs['filters'](_[_0x888c('0x57')](_0x20bdad['query'],_0x573b2d['filters']));if(_0x20bdad[_0x888c('0x4b')][_0x888c('0x3b')]){_0x1155ec[_0x888c('0x56')]=_[_0x888c('0x5b')](_0x1155ec[_0x888c('0x56')],{'$or':_[_0x888c('0x3c')](_0x1155ec[_0x888c('0x4f')],function(_0x7b762e){var _0x1e0dc5={};_0x1e0dc5[_0x7b762e]={'$like':'%'+_0x20bdad[_0x888c('0x4b')][_0x888c('0x3b')]+'%'};return _0x1e0dc5;})});}_0x1155ec=_[_0x888c('0x5b')]({},_0x1155ec,_0x20bdad['options']);return _0x31085d[_0x888c('0x10c')](_0x1155ec);}})['then'](function(_0xc8ff11){if(_0xc8ff11){_0x44e346=_0xc8ff11[_0x888c('0x51')];if(!_0x20bdad[_0x888c('0x4b')][_0x888c('0x52')](_0x888c('0x53'))){_0x1155ec[_0x888c('0x2e')]=qs[_0x888c('0x2e')](_0x20bdad[_0x888c('0x4b')][_0x888c('0x2e')]);_0x1155ec[_0x888c('0x2d')]=qs['offset'](_0x20bdad[_0x888c('0x4b')]['offset']);}return _0x31085d[_0x888c('0x10c')](_0x1155ec);}})[_0x888c('0x1d')](function(_0x3500d7){if(_0x3500d7){return _0x3500d7?{'count':_0x44e346,'rows':_0x3500d7}:null;}})[_0x888c('0x1d')](respondWithResult(_0x3246c4,null))[_0x888c('0x27')](handleError(_0x3246c4,null));};exports[_0x888c('0x10e')]=function(_0x57a575,_0x23203c){return db['User'][_0x888c('0x3f')]({'where':{'id':_0x57a575['params']['id']}})['then'](handleEntityNotFound(_0x23203c,null))[_0x888c('0x1d')](function(_0x19cdcc){if(_0x19cdcc){var _0xf44c79=_0x19cdcc['get']({'plain':!![]});return _0x19cdcc[_0x888c('0x10e')](_0x57a575[_0x888c('0x66')][_0x888c('0x69')],_[_0x888c('0x6a')](_0x57a575['body'],[_0x888c('0x69'),'id'])||{})['then'](function(){for(var _0x3f66c7=0x0;_0x3f66c7<_0x57a575['body']['ids']['length'];_0x3f66c7++){var _0x2367a5=[];db[_0x888c('0x10d')][_0x888c('0xa0')]({'where':{'id':_0x57a575['body'][_0x888c('0x69')][_0x3f66c7]}})[_0x888c('0x1d')](function(_0x3911a0){_0x2367a5['push'](_0x3911a0[_0x888c('0xec')]()[_0x888c('0x1d')](function(_0xe56172){for(var _0x3c4766=0x0;_0x3c4766<_0xe56172[_0x888c('0x51')];_0x3c4766++){_0xe56172[_0x3c4766][_0x888c('0x10f')]('channel',_0x888c('0x110'));}return _0xe56172;}));_0x2367a5[_0x888c('0x91')](_0x3911a0['getChatQueues']()[_0x888c('0x1d')](function(_0x133585){for(var _0x144805=0x0;_0x144805<_0x133585[_0x888c('0x51')];_0x144805++){_0x133585[_0x144805][_0x888c('0x10f')](_0x888c('0xa7'),_0x888c('0x111'));}return _0x133585;}));_0x2367a5['push'](_0x3911a0[_0x888c('0x112')]()[_0x888c('0x1d')](function(_0x30e0fb){for(var _0x1be9e1=0x0;_0x1be9e1<_0x30e0fb[_0x888c('0x51')];_0x1be9e1++){_0x30e0fb[_0x1be9e1]['setDataValue']('channel','Mail');}return _0x30e0fb;}));_0x2367a5[_0x888c('0x91')](_0x3911a0['getSmsQueues']()[_0x888c('0x1d')](function(_0x7428db){for(var _0x581bad=0x0;_0x581bad<_0x7428db[_0x888c('0x51')];_0x581bad++){_0x7428db[_0x581bad]['setDataValue'](_0x888c('0xa7'),_0x888c('0x113'));}return _0x7428db;}));_0x2367a5[_0x888c('0x91')](_0x3911a0['getWhatsappQueues']()[_0x888c('0x1d')](function(_0x1d0746){for(var _0x244c60=0x0;_0x244c60<_0x1d0746[_0x888c('0x51')];_0x244c60++){_0x1d0746[_0x244c60][_0x888c('0x10f')](_0x888c('0xa7'),_0x888c('0x114'));}return _0x1d0746;}));_0x2367a5[_0x888c('0x91')](_0x3911a0[_0x888c('0x115')]()[_0x888c('0x1d')](function(_0x31abfe){for(var _0x887b86=0x0;_0x887b86<_0x31abfe['length'];_0x887b86++){_0x31abfe[_0x887b86][_0x888c('0x10f')](_0x888c('0xa7'),_0x888c('0x116'));}return _0x31abfe;}));_0x2367a5[_0x888c('0x91')](_0x3911a0[_0x888c('0x117')]()['then'](function(_0x2c9fdb){for(var _0x6974bf=0x0;_0x6974bf<_0x2c9fdb[_0x888c('0x51')];_0x6974bf++){_0x2c9fdb[_0x6974bf][_0x888c('0x10f')](_0x888c('0xa7'),_0x888c('0x118'));}return _0x2c9fdb;}));return BPromise[_0x888c('0x92')](_0x2367a5);})[_0x888c('0x1d')](function(_0x3b3c19){var _0x2b48f8=_[_0x888c('0x119')](_0x3b3c19);_0x2367a5=[];return db[_0x888c('0x58')]['transaction'](function(_0x45a3fb){for(var _0x45d304=0x0;_0x45d304<_0x2b48f8['length'];_0x45d304++){_0x2367a5[_0x888c('0x91')](_0x2b48f8[_0x45d304]['addAgent'](_0xf44c79['id']),{'transaction':_0x45a3fb});}return BPromise[_0x888c('0x92')](_0x2367a5)['then'](function(){if(_0xf44c79['online']){return BPromise[_0x888c('0x93')](_[_0x888c('0x3b')](_0x2b48f8,function(_0x41a754){return _0x41a754[_0x888c('0x11a')](_0x888c('0xa7'))===_0x888c('0x110');}),function(_0xaef1a6){return db[_0x888c('0xd0')][_0x888c('0xb7')]({'membername':_0xf44c79[_0x888c('0x40')],'UserId':_0xf44c79['id'],'queue_name':_0xaef1a6['name'],'VoiceQueueId':_0xaef1a6['id'],'interface':_[_0x888c('0x74')](_0xf44c79[_0x888c('0xaa')])?util[_0x888c('0xe5')](_0x888c('0xb6'),_0xf44c79['name']):_0xf44c79[_0x888c('0xaa')],'paused':_0xf44c79[_0x888c('0xa9')]||![],'penalty':_0xf44c79['penalty']},{'transaction':_0x45a3fb});});}else{return;}})[_0x888c('0x1d')](function(){for(var _0x421612=0x0;_0x421612<_0x2b48f8['length'];_0x421612++){var _0x128728=_0x2b48f8[_0x421612][_0x888c('0x11a')](_0x888c('0xa7'));var _0x43b449=_0x128728+_0x888c('0xb2');socket[_0x888c('0xb3')](_0x888c('0x37')+_0x128728+_0x888c('0x11b'),{'UserId':_0xf44c79['id'],['queueField']:_0x2b48f8[_0x421612]['id']});}});});});}});}})[_0x888c('0x1d')](respondWithStatusCode(_0x23203c,null))[_0x888c('0x27')](handleError(_0x23203c,null));};exports[_0x888c('0x11c')]=function(_0x2511ac,_0x4b3a16){return db[_0x888c('0x45')]['findOne']({'where':{'id':_0x2511ac['params']['id']}})['then'](handleEntityNotFound(_0x4b3a16,null))['then'](function(_0x3dbe5c){if(_0x3dbe5c){var _0x2bee52=_0x3dbe5c[_0x888c('0x33')]({'plain':!![]});var _0x194abb=_0x2511ac[_0x888c('0x4b')][_0x888c('0x69')];return _0x3dbe5c['removeTeams'](_0x194abb)['then'](function(){for(var _0x832269=0x0;_0x832269<_0x194abb[_0x888c('0x51')];_0x832269++){var _0x10e81e=[];db[_0x888c('0x10d')][_0x888c('0xa0')]({'where':{'id':_0x194abb[_0x832269]}})[_0x888c('0x1d')](function(_0x2641c7){_0x10e81e[_0x888c('0x91')](_0x2641c7['getVoiceQueues']()[_0x888c('0x1d')](function(_0x4a7d52){for(var _0x10222d=0x0;_0x10222d<_0x4a7d52[_0x888c('0x51')];_0x10222d++){_0x4a7d52[_0x10222d][_0x888c('0x10f')](_0x888c('0xa7'),_0x888c('0x110'));}return _0x4a7d52;}));_0x10e81e[_0x888c('0x91')](_0x2641c7[_0x888c('0x11d')]()['then'](function(_0x4a182f){for(var _0xbb011f=0x0;_0xbb011f<_0x4a182f['length'];_0xbb011f++){_0x4a182f[_0xbb011f][_0x888c('0x10f')](_0x888c('0xa7'),_0x888c('0x111'));}return _0x4a182f;}));_0x10e81e['push'](_0x2641c7['getMailQueues']()[_0x888c('0x1d')](function(_0x1f1ce1){for(var _0x2a12b0=0x0;_0x2a12b0<_0x1f1ce1[_0x888c('0x51')];_0x2a12b0++){_0x1f1ce1[_0x2a12b0]['setDataValue'](_0x888c('0xa7'),'Mail');}return _0x1f1ce1;}));_0x10e81e[_0x888c('0x91')](_0x2641c7['getSmsQueues']()[_0x888c('0x1d')](function(_0x27d391){for(var _0x33d764=0x0;_0x33d764<_0x27d391['length'];_0x33d764++){_0x27d391[_0x33d764][_0x888c('0x10f')](_0x888c('0xa7'),'Sms');}return _0x27d391;}));_0x10e81e[_0x888c('0x91')](_0x2641c7[_0x888c('0x11e')]()[_0x888c('0x1d')](function(_0x29f8f8){for(var _0x3ee5d8=0x0;_0x3ee5d8<_0x29f8f8[_0x888c('0x51')];_0x3ee5d8++){_0x29f8f8[_0x3ee5d8][_0x888c('0x10f')](_0x888c('0xa7'),_0x888c('0x114'));}return _0x29f8f8;}));_0x10e81e[_0x888c('0x91')](_0x2641c7[_0x888c('0x115')]()['then'](function(_0x71d6b1){for(var _0x3e6a43=0x0;_0x3e6a43<_0x71d6b1[_0x888c('0x51')];_0x3e6a43++){_0x71d6b1[_0x3e6a43][_0x888c('0x10f')](_0x888c('0xa7'),_0x888c('0x116'));}return _0x71d6b1;}));_0x10e81e['push'](_0x2641c7[_0x888c('0x117')]()[_0x888c('0x1d')](function(_0x2b3036){for(var _0x57f517=0x0;_0x57f517<_0x2b3036[_0x888c('0x51')];_0x57f517++){_0x2b3036[_0x57f517][_0x888c('0x10f')](_0x888c('0xa7'),'Openchannel');}return _0x2b3036;}));return BPromise[_0x888c('0x92')](_0x10e81e);})[_0x888c('0x1d')](function(_0x4f37e2){var _0x52da4f=_[_0x888c('0x119')](_0x4f37e2);_0x10e81e=[];return db['sequelize'][_0x888c('0x11f')](function(_0x24a967){for(var _0x4656f7=0x0;_0x4656f7<_0x52da4f[_0x888c('0x51')];_0x4656f7++){_0x10e81e[_0x888c('0x91')](_0x52da4f[_0x4656f7][_0x888c('0x120')](_0x2bee52['id']),{'transaction':_0x24a967});}return BPromise[_0x888c('0x92')](_0x10e81e)[_0x888c('0x1d')](function(){if(_0x2bee52[_0x888c('0xb5')]){return BPromise['each'](_['filter'](_0x52da4f,function(_0xeced28){return _0xeced28[_0x888c('0x11a')](_0x888c('0xa7'))==='Voice';}),function(_0x298b8d){return db['UserVoiceQueueRt'][_0x888c('0xb9')]({'where':{'VoiceQueueId':_0x298b8d['id'],'UserId':_0x2bee52['id']},'transaction':_0x24a967});});}else{return;}})[_0x888c('0x1d')](function(){for(var _0x5d7fa9=0x0;_0x5d7fa9<_0x52da4f['length'];_0x5d7fa9++){var _0x53ff09=_0x52da4f[_0x5d7fa9][_0x888c('0x11a')](_0x888c('0xa7'));var _0x29f4d9=_0x53ff09+_0x888c('0xb2');socket['emit'](_0x888c('0x37')+_0x53ff09+_0x888c('0x121'),{'UserId':_0x2bee52['id'],['queueField']:_0x52da4f[_0x5d7fa9]['id']});}});});});}});}})[_0x888c('0x1d')](respondWithStatusCode(_0x4b3a16,null))['catch'](handleError(_0x4b3a16,null));};exports['getLists']=function(_0x1a8286,_0x7ba30e,_0x46c325){var _0x54011a={};var _0x5c8b5d={};var _0x46a7ae;var _0x68031e;return db['User']['findOne']({'where':{'id':_0x1a8286[_0x888c('0x97')]['id']}})[_0x888c('0x1d')](handleEntityNotFound(_0x7ba30e,null))[_0x888c('0x1d')](function(_0x4d8092){if(_0x4d8092){_0x46a7ae=_0x4d8092;_0x5c8b5d[_0x888c('0x49')]=_[_0x888c('0x4c')](db[_0x888c('0xc5')][_0x888c('0x62')]);_0x5c8b5d[_0x888c('0x4b')]=_[_0x888c('0x4c')](_0x1a8286[_0x888c('0x4b')]);_0x5c8b5d[_0x888c('0x4d')]=_[_0x888c('0x4e')](_0x5c8b5d[_0x888c('0x49')],_0x5c8b5d[_0x888c('0x4b')]);_0x54011a[_0x888c('0x4f')]=_[_0x888c('0x4e')](_0x5c8b5d['model'],qs[_0x888c('0x50')](_0x1a8286[_0x888c('0x4b')][_0x888c('0x50')]));_0x54011a[_0x888c('0x4f')]=_0x54011a[_0x888c('0x4f')][_0x888c('0x51')]?_0x54011a[_0x888c('0x4f')]:_0x5c8b5d[_0x888c('0x49')];_0x54011a['order']=qs[_0x888c('0x55')](_0x1a8286[_0x888c('0x4b')][_0x888c('0x55')]);_0x54011a[_0x888c('0x56')]=qs[_0x888c('0x4d')](_[_0x888c('0x57')](_0x1a8286[_0x888c('0x4b')],_0x5c8b5d[_0x888c('0x4d')]));if(_0x1a8286[_0x888c('0x4b')][_0x888c('0x3b')]){_0x54011a[_0x888c('0x56')]=_[_0x888c('0x5b')](_0x54011a[_0x888c('0x56')],{'$or':_['map'](_0x54011a[_0x888c('0x4f')],function(_0x5c5d2f){var _0x557e18={};_0x557e18[_0x5c5d2f]={'$like':'%'+_0x1a8286[_0x888c('0x4b')][_0x888c('0x3b')]+'%'};return _0x557e18;})});}_0x54011a=_[_0x888c('0x5b')]({},_0x54011a,_0x1a8286[_0x888c('0x5c')]);return _0x46a7ae[_0x888c('0x122')](_0x54011a);}})[_0x888c('0x1d')](function(_0x4ab044){if(_0x4ab044){_0x68031e=_0x4ab044[_0x888c('0x51')];if(!_0x1a8286[_0x888c('0x4b')][_0x888c('0x52')](_0x888c('0x53'))){_0x54011a['limit']=qs[_0x888c('0x2e')](_0x1a8286['query'][_0x888c('0x2e')]);_0x54011a['offset']=qs[_0x888c('0x2d')](_0x1a8286[_0x888c('0x4b')][_0x888c('0x2d')]);}return _0x46a7ae[_0x888c('0x122')](_0x54011a);}})[_0x888c('0x1d')](function(_0x5abb21){if(_0x5abb21){return _0x5abb21?{'count':_0x68031e,'rows':_0x5abb21}:null;}})[_0x888c('0x1d')](respondWithResult(_0x7ba30e,null))[_0x888c('0x27')](handleError(_0x7ba30e,null));};exports[_0x888c('0x123')]=function(_0x4da790,_0x5b761d,_0x56772e){var _0x31dbfc={};var _0xbbd739={};var _0x1af524;var _0x1100bc;return db['User'][_0x888c('0xa0')]({'where':{'id':_0x4da790[_0x888c('0x97')]['id']}})[_0x888c('0x1d')](handleEntityNotFound(_0x5b761d,null))[_0x888c('0x1d')](function(_0x374520){if(_0x374520){_0x1af524=_0x374520;_0xbbd739['model']=_['keys'](db[_0x888c('0x45')]['rawAttributes']);_0xbbd739[_0x888c('0x4b')]=_[_0x888c('0x4c')](_0x4da790[_0x888c('0x4b')]);_0xbbd739[_0x888c('0x4d')]=_[_0x888c('0x4e')](_0xbbd739[_0x888c('0x49')],_0xbbd739['query']);_0x31dbfc['attributes']=_[_0x888c('0x4e')](_0xbbd739['model'],qs[_0x888c('0x50')](_0x4da790['query'][_0x888c('0x50')]));_0x31dbfc['attributes']=_0x31dbfc[_0x888c('0x4f')][_0x888c('0x51')]?_0x31dbfc[_0x888c('0x4f')]:_0xbbd739[_0x888c('0x49')];_0x31dbfc['order']=qs[_0x888c('0x55')](_0x4da790[_0x888c('0x4b')][_0x888c('0x55')]);_0x31dbfc[_0x888c('0x56')]=qs['filters'](_[_0x888c('0x57')](_0x4da790[_0x888c('0x4b')],_0xbbd739[_0x888c('0x4d')]));if(_0x4da790[_0x888c('0x4b')][_0x888c('0x3b')]){_0x31dbfc[_0x888c('0x56')]=_[_0x888c('0x5b')](_0x31dbfc[_0x888c('0x56')],{'$or':_[_0x888c('0x3c')](_0x31dbfc[_0x888c('0x4f')],function(_0x24488e){var _0x13f25a={};_0x13f25a[_0x24488e]={'$like':'%'+_0x4da790[_0x888c('0x4b')]['filter']+'%'};return _0x13f25a;})});}_0x31dbfc['model']=db[_0x888c('0x45')];_0x31dbfc['as']=_0x888c('0x38');_0x31dbfc=_[_0x888c('0x5b')]({},_0x31dbfc,_0x4da790['options']);return _0x1af524['getVoiceQueues']({'include':[_0x31dbfc]});}})['then'](function(_0x5f3a3e){if(_0x5f3a3e){var _0x278438={},_0x305d2d=[],_0x1e629e=0x0;for(var _0x178f96=0x0;_0x178f96<_0x5f3a3e[_0x888c('0x51')];_0x178f96+=0x1){for(var _0x2bf75b=0x0,_0x5c81d3;_0x2bf75b<_0x5f3a3e[_0x178f96][_0x888c('0x38')][_0x888c('0x51')];_0x2bf75b+=0x1){_0x5c81d3=_0x5f3a3e[_0x178f96]['Agents'][_0x2bf75b][_0x888c('0x33')]({'plain':!![]});_0x278438[_0x5c81d3['id']]=_0x5c81d3;}}_0x278438=_[_0x888c('0x124')](_0x278438);for(var _0x4f4807=qs[_0x888c('0x2d')](_0x4da790[_0x888c('0x4b')][_0x888c('0x2d')]);_0x4f4807<_0x278438[_0x888c('0x51')]&&_0x305d2d[_0x888c('0x51')]=_0x3de6cd){_0x372f12=_0x3de6cd;_0x412b1f=0xc8;}else{_0x412b1f=0xce;}_0x139157[_0xb92b('0x26')](_0x412b1f);return _0x139157['set'](_0xb92b('0x2b'),_0x7b3f45+'-'+_0x372f12+'/'+_0x3de6cd)[_0xb92b('0x2c')](_0xc2cf37);}return null;};}function patchUpdates(_0x46f124){return function(_0x3f21e1){try{jsonpatch[_0xb92b('0x2d')](_0x3f21e1,_0x46f124,!![]);}catch(_0x2c1767){return BPromise[_0xb92b('0x2e')](_0x2c1767);}return _0x3f21e1[_0xb92b('0x2f')]();};}function saveUpdates(_0x4c0106,_0x1dca64){return function(_0xfe0cda){if(_0xfe0cda){return _0xfe0cda[_0xb92b('0x30')](_0x4c0106)['then'](function(_0x2acf93){return _0x2acf93;});}return null;};}function removeEntity(_0x4fb791,_0x5d4652){return function(_0x18a45b){if(_0x18a45b){return _0x18a45b[_0xb92b('0x31')]()[_0xb92b('0x32')](function(){var _0x5c97b9=_0x18a45b[_0xb92b('0x33')]({'plain':!![]});if(_0x5c97b9['role']===_0xb92b('0x34'))return;var _0x4b17ca=[{'name':'Users','value':_0xb92b('0x35'),'ignore':!![]},{'name':_0xb92b('0x36'),'value':_0xb92b('0x37'),'ignore':![]},{'name':_0xb92b('0x38'),'value':_0xb92b('0x39'),'ignore':![]}];var _0x3d8ed3=_(_0x4b17ca)[_0xb92b('0x3a')](_0xb92b('0x3b'))[_0xb92b('0x3c')]('value')[_0xb92b('0x3d')]();if(_[_0xb92b('0x3e')](_0x3d8ed3,_0x5c97b9[_0xb92b('0x3f')])){return;}var _0x69db1f=_[_0xb92b('0x40')](_0x4b17ca,[_0xb92b('0x3d'),_0x5c97b9[_0xb92b('0x3f')]])['name'];return db[_0xb92b('0x41')][_0xb92b('0x31')]({'where':{'type':_0x69db1f,'resourceId':_0x5c97b9['id']}})[_0xb92b('0x32')](function(){return _0x18a45b;});})[_0xb92b('0x32')](function(){_0x4fb791['status'](0xcc)[_0xb92b('0x27')]();});}};}function handleEntityNotFound(_0x16ace6,_0x114236){return function(_0x4fb873){if(!_0x4fb873){_0x16ace6[_0xb92b('0x42')](0x194);}return _0x4fb873;};}function handleError(_0x3d7ea9,_0x29f9e2){_0x29f9e2=_0x29f9e2||0x1f4;return function(_0x5dde9b){logger[_0xb92b('0x20')](_0x5dde9b[_0xb92b('0x43')]);if(_0x5dde9b['name']){delete _0x5dde9b['name'];}_0x3d7ea9[_0xb92b('0x26')](_0x29f9e2)[_0xb92b('0x44')](_0x5dde9b);};}exports['index']=function(_0x3a8b6a,_0x590c46){var _0x2390a8={},_0x1e4f85={},_0x1ae761={'count':0x0,'rows':[]};var _0x5d8628=_[_0xb92b('0x3c')](db[_0xb92b('0x45')][_0xb92b('0x46')],function(_0x152efa){return{'name':_0x152efa[_0xb92b('0x47')],'type':_0x152efa[_0xb92b('0x48')]['key']};});_0x1e4f85[_0xb92b('0x49')]=_[_0xb92b('0x4a')](_[_0xb92b('0x3c')](_0x5d8628,_0xb92b('0x4b')),['password',_0xb92b('0x4c')]);_0x1e4f85['query']=_[_0xb92b('0x4d')](_0x3a8b6a[_0xb92b('0x4e')]);_0x1e4f85[_0xb92b('0x4f')]=_[_0xb92b('0x50')](_0x1e4f85[_0xb92b('0x49')],_0x1e4f85[_0xb92b('0x4e')]);_0x2390a8[_0xb92b('0x51')]=_['intersection'](_0x1e4f85['model'],qs[_0xb92b('0x52')](_0x3a8b6a[_0xb92b('0x4e')][_0xb92b('0x52')]));_0x2390a8[_0xb92b('0x51')]=_0x2390a8[_0xb92b('0x51')][_0xb92b('0x53')]?_0x2390a8[_0xb92b('0x51')]:_0x1e4f85[_0xb92b('0x49')];if(!_0x3a8b6a[_0xb92b('0x4e')][_0xb92b('0x54')](_0xb92b('0x55'))){_0x2390a8[_0xb92b('0x2a')]=qs['limit'](_0x3a8b6a[_0xb92b('0x4e')]['limit']);_0x2390a8[_0xb92b('0x29')]=qs[_0xb92b('0x29')](_0x3a8b6a[_0xb92b('0x4e')][_0xb92b('0x29')]);}_0x2390a8[_0xb92b('0x56')]=qs[_0xb92b('0x57')](_0x3a8b6a[_0xb92b('0x4e')][_0xb92b('0x57')]);_0x2390a8[_0xb92b('0x58')]=qs[_0xb92b('0x4f')](_[_0xb92b('0x59')](_0x3a8b6a[_0xb92b('0x4e')],_0x1e4f85[_0xb92b('0x4f')]),_0x5d8628);if(_0x3a8b6a['query'][_0xb92b('0x3a')]){_0x2390a8['where']=_['merge'](_0x2390a8[_0xb92b('0x58')],{'$or':_[_0xb92b('0x3c')](_0x5d8628,function(_0x87c8b6){if(_0x87c8b6[_0xb92b('0x48')]!==_0xb92b('0x5a')){return db[_0xb92b('0x5b')][_0xb92b('0x58')](db[_0xb92b('0x5b')]['fn'](_0xb92b('0x5c'),db[_0xb92b('0x5b')][_0xb92b('0x5d')](_0x87c8b6[_0xb92b('0x4b')])),{'$like':db[_0xb92b('0x5b')]['fn']('lower','%'+_0x3a8b6a[_0xb92b('0x4e')][_0xb92b('0x3a')]+'%')});}})});}_0x2390a8=_[_0xb92b('0x5e')]({},_0x2390a8,_0x3a8b6a['options']);var _0x307eea={'where':_0x2390a8[_0xb92b('0x58')]};return db[_0xb92b('0x45')][_0xb92b('0x28')](_0x307eea)['then'](function(_0x275396){_0x1ae761[_0xb92b('0x28')]=_0x275396;if(_0x3a8b6a[_0xb92b('0x4e')][_0xb92b('0x5f')]){_0x2390a8['include']=[{'all':!![]}];}return db[_0xb92b('0x45')]['findAll'](_0x2390a8);})[_0xb92b('0x32')](function(_0x1ac2fc){_0x1ae761[_0xb92b('0x60')]=_0x1ac2fc;return _0x1ae761;})[_0xb92b('0x32')](respondWithFilteredResult(_0x590c46,_0x2390a8))['catch'](handleError(_0x590c46,null));};exports[_0xb92b('0x61')]=function(_0x2b6f17,_0x5035cf){var _0x1dd2f7={'raw':![],'where':{'id':_0x2b6f17['params']['id']}},_0x44bc13={};_0x44bc13[_0xb92b('0x49')]=_[_0xb92b('0x4a')](_['keys'](db[_0xb92b('0x45')][_0xb92b('0x46')]),[_0xb92b('0x62'),'salt']);_0x44bc13[_0xb92b('0x4e')]=_[_0xb92b('0x4d')](_0x2b6f17[_0xb92b('0x4e')]);_0x44bc13[_0xb92b('0x4f')]=_[_0xb92b('0x50')](_0x44bc13[_0xb92b('0x49')],_0x44bc13[_0xb92b('0x4e')]);_0x1dd2f7[_0xb92b('0x51')]=_[_0xb92b('0x50')](_0x44bc13[_0xb92b('0x49')],qs[_0xb92b('0x52')](_0x2b6f17[_0xb92b('0x4e')][_0xb92b('0x52')]));_0x1dd2f7[_0xb92b('0x51')]=_0x1dd2f7[_0xb92b('0x51')]['length']?_0x1dd2f7[_0xb92b('0x51')]:_0x44bc13[_0xb92b('0x49')];if(_0x2b6f17[_0xb92b('0x4e')]['includeAll']){_0x1dd2f7[_0xb92b('0x63')]=[{'all':!![]}];}_0x1dd2f7=_['merge']({},_0x1dd2f7,_0x2b6f17[_0xb92b('0x64')]);return db[_0xb92b('0x45')]['find'](_0x1dd2f7)[_0xb92b('0x32')](handleEntityNotFound(_0x5035cf,null))[_0xb92b('0x32')](respondWithResult(_0x5035cf,null))[_0xb92b('0x25')](handleError(_0x5035cf,null));};exports[_0xb92b('0x30')]=function(_0x869043,_0xd770d5){if(_0x869043[_0xb92b('0x65')]['id']){delete _0x869043[_0xb92b('0x65')]['id'];}delete _0x869043[_0xb92b('0x65')]['role'];return db['User'][_0xb92b('0x40')]({'where':{'id':_0x869043[_0xb92b('0x66')]['id']}})[_0xb92b('0x32')](handleEntityNotFound(_0xd770d5,null))[_0xb92b('0x32')](saveUpdates(_0x869043['body'],null))[_0xb92b('0x32')](respondWithResult(_0xd770d5,null))['catch'](handleError(_0xd770d5,null));};exports[_0xb92b('0x67')]=function(_0x25802b,_0x26aca5){return db[_0xb92b('0x45')][_0xb92b('0x67')]()['then'](respondWithResult(_0x26aca5,null))['catch'](handleError(_0x26aca5,null));};exports[_0xb92b('0x68')]=function(_0x135bf3,_0x5e6880,_0x239b5a){return db[_0xb92b('0x45')][_0xb92b('0x40')]({'where':{'id':_0x135bf3[_0xb92b('0x66')]['id']}})[_0xb92b('0x32')](handleEntityNotFound(_0x5e6880,null))[_0xb92b('0x32')](function(_0xd07d23){if(_0xd07d23){return _0xd07d23[_0xb92b('0x68')](_0x135bf3[_0xb92b('0x65')][_0xb92b('0x69')],_[_0xb92b('0x6a')](_0x135bf3[_0xb92b('0x65')],[_0xb92b('0x69'),'id'])||{});}})[_0xb92b('0x32')](respondWithResult(_0x5e6880,null))[_0xb92b('0x25')](handleError(_0x5e6880,null));};function validateUser(_0x92121f){return new BPromise(function(_0x5e0877,_0x3fb573){if(_0x92121f['internal'])return _0x5e0877(_0x92121f);return db[_0xb92b('0x6b')][_0xb92b('0x6c')](0x1)[_0xb92b('0x32')](function(_0x196129){if(_0x196129[_0xb92b('0x6d')])authService[_0xb92b('0x6e')](_0x92121f[_0xb92b('0x62')]);db[_0xb92b('0x45')][_0xb92b('0x6f')]('internal')[_0xb92b('0x32')](function(_0x22dcf1){if(_['isNil'](_0x22dcf1)){_0x92121f['internal']=_0x196129[_0xb92b('0x70')]||0x1;return;}if(_['isNil'](_0x196129[_0xb92b('0x70')])||_0x196129['min_internal']===_0x22dcf1){_0x92121f[_0xb92b('0x71')]=_0x22dcf1+0x1;return;}if(_0x196129[_0xb92b('0x70')]>_0x22dcf1){_0x92121f[_0xb92b('0x71')]=_0x196129[_0xb92b('0x70')];return;}return db[_0xb92b('0x5b')][_0xb92b('0x4e')](_0xb92b('0x72'),{'type':db['sequelize'][_0xb92b('0x73')][_0xb92b('0x74')]})[_0xb92b('0x32')](function(_0x292b7f){if(_0x292b7f&&_0x292b7f[_0xb92b('0x53')]){for(var _0x57c62f=0x0,_0x2605f8=_0x292b7f[_0xb92b('0x53')];_0x57c62f<_0x2605f8&&_[_0xb92b('0x75')](_0x92121f['internal']);_0x57c62f++){if(_0x196129[_0xb92b('0x70')]<=_0x292b7f[_0x57c62f][_0xb92b('0x76')]){_0x92121f['internal']=_0x292b7f[_0x57c62f]['from'];}else if(_0x196129[_0xb92b('0x70')]>_0x292b7f[_0x57c62f][_0xb92b('0x76')]&&_0x196129[_0xb92b('0x70')]<=_0x292b7f[_0x57c62f]['to']){_0x92121f[_0xb92b('0x71')]=_0x196129[_0xb92b('0x70')];}}}if(_[_0xb92b('0x75')](_0x92121f['internal'])){_0x92121f[_0xb92b('0x71')]=_0x22dcf1+0x1;}return _0x5e0877(_0x92121f);});});})['catch'](function(_0x1b574a){_0x3fb573(_0x1b574a);});});}function updateUser(_0x3735b6){return new BPromise(function(_0x416a98,_0x455e27){try{if(_0x3735b6[_0xb92b('0x77')]){_0x3735b6['mailbox']=_0x3735b6[_0xb92b('0x71')];_0x3735b6[_0xb92b('0x78')]={'mailbox':_0x3735b6[_0xb92b('0x71')],'password':_0x3735b6[_0xb92b('0x62')],'fullname':_0x3735b6[_0xb92b('0x79')],'email':_0x3735b6[_0xb92b('0x7a')]};}if(_0x3735b6[_0xb92b('0x3f')]==='agent'){if(!_0x3735b6[_0xb92b('0x7b')])_0x3735b6[_0xb92b('0x7b')]=[_0xb92b('0x7c'),_0xb92b('0x7d'),_0xb92b('0x7e'),_0xb92b('0x7f'),_0xb92b('0x80'),_0xb92b('0x81'),_0xb92b('0x82'),_0xb92b('0x83'),'107',_0xb92b('0x84'),_0xb92b('0x85'),_0xb92b('0x86'),_0xb92b('0x87'),'114',_0xb92b('0x88')];}_0x416a98(_0x3735b6);}catch(_0x461eb5){_0x455e27(_0x461eb5);}});}exports[_0xb92b('0x89')]=function(_0xeff487,_0x540d7a){if(_0xeff487[_0xb92b('0x35')][_0xb92b('0x3f')]===_0xb92b('0x37'))throw new Error('Unauthorized');if(_0xeff487[_0xb92b('0x65')][_0xb92b('0x3f')]===_0xb92b('0x35')&&_0xeff487[_0xb92b('0x35')][_0xb92b('0x3f')]!=='admin'){throw new Error(_0xb92b('0x8a'));}if(_0xeff487[_0xb92b('0x65')][_0xb92b('0x3f')]===_0xb92b('0x34')&&_0xeff487[_0xb92b('0x35')][_0xb92b('0x3f')]!==_0xb92b('0x34')){throw new Error(_0xb92b('0x8b'));}return licenseUtil[_0xb92b('0x8c')]([_0xeff487[_0xb92b('0x65')]])[_0xb92b('0x32')](function(){return validateUser(_0xeff487[_0xb92b('0x65')]);})[_0xb92b('0x32')](function(_0x1a0256){return updateUser(_0x1a0256)['then'](function(_0x548f89){if(_0x548f89[_0xb92b('0x3f')]===_0xb92b('0x34')){_0x548f89[_0xb92b('0x8d')]=_0xeff487[_0xb92b('0x35')][_0xb92b('0x8d')];delete _0x548f89['userProfileId'];}return _0x548f89;});})[_0xb92b('0x32')](function(_0x32bddb){return db[_0xb92b('0x45')]['create'](_0x32bddb,{'include':[{'model':db[_0xb92b('0x78')],'as':_0xb92b('0x78')}]});})[_0xb92b('0x32')](function(_0x317b94){if(_0xeff487[_0xb92b('0x65')][_0xb92b('0x3f')]===_0xb92b('0x35'))return _0x317b94;if(_0xeff487['user'][_0xb92b('0x3f')]!==_0xb92b('0x35'))return _0x317b94;return db[_0xb92b('0x8e')][_0xb92b('0x40')]({'where':{'name':_0x317b94[_0xb92b('0x3f')]===_0xb92b('0x37')?'Agents':_0xb92b('0x38'),'userProfileId':_0xeff487[_0xb92b('0x35')][_0xb92b('0x8f')]},'raw':!![]})[_0xb92b('0x32')](function(_0x68af69){if(!_0x68af69||_0x68af69['autoAssociation']!=0x0)return _0x317b94;return db[_0xb92b('0x41')][_0xb92b('0x89')]({'name':_0x317b94[_0xb92b('0x4b')],'resourceId':_0x317b94['id'],'type':_0x68af69['name'],'sectionId':_0x68af69['id']},{})[_0xb92b('0x32')](function(){return _0x317b94;});})[_0xb92b('0x25')](function(_0x323674){logger['error'](_0xb92b('0x90'),_0x323674);throw _0x323674;});})[_0xb92b('0x32')](respondWithResult(_0x540d7a,0xc9))[_0xb92b('0x25')](handleError(_0x540d7a,null));};exports[_0xb92b('0x91')]=function(_0x58112b,_0x20866a){var _0x49bb9f=_0x58112b['body'];var _0x2b6a29=[];if(_0x58112b['user'][_0xb92b('0x3f')]==='agent')throw new Error(_0xb92b('0x92'));if(_['some'](_0x49bb9f,[_0xb92b('0x3f'),_0xb92b('0x35')])&&_0x58112b[_0xb92b('0x35')][_0xb92b('0x3f')]!==_0xb92b('0x34')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x49bb9f,['role',_0xb92b('0x34')])&&_0x58112b[_0xb92b('0x35')][_0xb92b('0x3f')]!==_0xb92b('0x34')){throw new Error(_0xb92b('0x93'));}return licenseUtil['checkUserLimits'](_0x49bb9f)['then'](function(){return validateUser(_0x49bb9f[0x0]);})[_0xb92b('0x32')](function(){for(var _0x471e5f=0x1;_0x471e5f<_0x49bb9f[_0xb92b('0x53')];_0x471e5f++){var _0x2989ca=_0x49bb9f[_0x471e5f-0x1][_0xb92b('0x71')];if(!_0x49bb9f[_0x471e5f][_0xb92b('0x71')])_0x49bb9f[_0x471e5f][_0xb92b('0x71')]=_0x2989ca+0x1;_0x2b6a29[_0xb92b('0x94')](validateUser(_0x49bb9f[_0x471e5f]));}return BPromise['all'](_0x2b6a29);})['then'](function(){_0x2b6a29=[];for(var _0x1a391c=0x0;_0x1a391c<_0x49bb9f['length'];_0x1a391c++){_0x2b6a29[_0xb92b('0x94')](updateUser(_0x49bb9f[_0x1a391c]));}return BPromise[_0xb92b('0x95')](_0x2b6a29);})['then'](function(){return BPromise['each'](_0x49bb9f,function(_0x49099a){return db[_0xb92b('0x45')][_0xb92b('0x89')](_0x49099a,{'include':[{'model':db[_0xb92b('0x78')],'as':'VoiceMail'}]})[_0xb92b('0x32')](function(_0x5e6c7d){_0x49099a['id']=_0x5e6c7d['id'];return _0x49099a;});});})['then'](function(_0x11c53e){if(_0x58112b[_0xb92b('0x65')][_0xb92b('0x3f')]===_0xb92b('0x35'))return _0x11c53e;if(_0x58112b[_0xb92b('0x35')][_0xb92b('0x3f')]!=='user')return _0x11c53e;var _0x33a117=_[_0xb92b('0x96')](_0x11c53e,function(_0x1f2952){return _0x1f2952[_0xb92b('0x3f')]===_0xb92b('0x37')||_0x1f2952[_0xb92b('0x3f')]===_0xb92b('0x39');});if(!_0x33a117)return _0x11c53e;return db[_0xb92b('0x8e')][_0xb92b('0x97')]({'where':{'name':{'$or':[_0xb92b('0x36'),'Telephones']},'userProfileId':_0x58112b[_0xb92b('0x35')]['userProfileId']},'raw':!![]})[_0xb92b('0x32')](function(_0x156d71){if(_[_0xb92b('0x98')](_0x156d71)||!_[_0xb92b('0x96')](_0x156d71,[_0xb92b('0x99'),0x0]))return _0x11c53e;_0x2b6a29=[];var _0x26dd37=_(_0x156d71)['map'](function(_0x12a340){if(_0x12a340[_0xb92b('0x99')]===0x1)return;return _0x12a340['name']===_0xb92b('0x36')?_0xb92b('0x37'):_0xb92b('0x39');})[_0xb92b('0x9a')]()[_0xb92b('0x3d')]();for(var _0x5efeee=0x0;_0x5efeee<_0x11c53e[_0xb92b('0x53')];_0x5efeee++){if(!_[_0xb92b('0x3e')](_0x26dd37,_0x11c53e[_0x5efeee]['role']))return;var _0x4ca747=_0x11c53e[_0x5efeee][_0xb92b('0x3f')]===_0xb92b('0x37')?'Agents':_0xb92b('0x38');_0x2b6a29[_0xb92b('0x94')](db[_0xb92b('0x41')][_0xb92b('0x89')]({'name':_0x11c53e[_0x5efeee]['name'],'resourceId':_0x11c53e[_0x5efeee]['id'],'type':_0x4ca747,'sectionId':_[_0xb92b('0x40')](_0x156d71,[_0xb92b('0x4b'),_0x4ca747])['id']},{}));}return BPromise[_0xb92b('0x95')](_0x2b6a29);});})[_0xb92b('0x32')](respondWithResult(_0x20866a,0xc9))[_0xb92b('0x25')](handleError(_0x20866a,null));};exports['changePassword']=function(_0x5b833e,_0xeea91d,_0x20b4be){if(_0x5b833e[_0xb92b('0x65')]['id']){delete _0x5b833e[_0xb92b('0x65')]['id'];}return db[_0xb92b('0x45')][_0xb92b('0x40')]({'where':{'id':_0x5b833e[_0xb92b('0x66')]['id']}})[_0xb92b('0x32')](function(_0x598604){if(!_0x598604)return null;if(_0x598604['id']===_0x5b833e[_0xb92b('0x35')]['id']){if(!_0x5b833e[_0xb92b('0x65')][_0xb92b('0x9b')]||!_0x5b833e[_0xb92b('0x65')][_0xb92b('0x9c')]){throw new db[(_0xb92b('0x9d'))][(_0xb92b('0x9e'))](_0xb92b('0x9f'));}if(!_0x598604[_0xb92b('0xa0')](_0x5b833e['body'][_0xb92b('0x9b')])){throw new db[(_0xb92b('0x9d'))]['ValidationError'](_0xb92b('0xa1'));}if(_0x5b833e[_0xb92b('0x65')][_0xb92b('0x9b')]===_0x5b833e[_0xb92b('0x65')][_0xb92b('0x9c')]){throw new db[(_0xb92b('0x9d'))]['ValidationError'](_0xb92b('0xa2'));}}else if(_0x5b833e[_0xb92b('0x35')][_0xb92b('0x3f')]===_0xb92b('0x34')){if(!_0x5b833e[_0xb92b('0x65')][_0xb92b('0x9c')]){throw new db['Sequelize'][(_0xb92b('0x9e'))](_0xb92b('0xa3'));}}else if(_0x5b833e[_0xb92b('0x35')][_0xb92b('0x3f')]===_0xb92b('0x35')){if(!_0x5b833e[_0xb92b('0x65')][_0xb92b('0x9c')]){throw new db['Sequelize']['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x598604[_0xb92b('0x3f')]!==_0xb92b('0x37')){throw new db[(_0xb92b('0x9d'))]['ValidationError'](_0xb92b('0x92'));}}else{throw new db[(_0xb92b('0x9d'))][(_0xb92b('0x9e'))]('Unauthorized');}return _0x598604;})[_0xb92b('0x32')](handleEntityNotFound(_0xeea91d,null))[_0xb92b('0x32')](function(_0x355407){return db['Setting']['findOne']({'attributes':['id',_0xb92b('0x6d'),_0xb92b('0xa4'),_0xb92b('0xa5')]})['then'](function(_0xef0490){if(_0xef0490[_0xb92b('0x6d')])authService[_0xb92b('0x6e')](_0x5b833e[_0xb92b('0x65')][_0xb92b('0x9c')]);if(!_0xef0490['enforcePasswordHistory']||!_0x355407['previousPasswords'])return _0x355407;authService['validatePasswordHistory'](_0x5b833e[_0xb92b('0x65')]['newPassword'],_0x355407[_0xb92b('0xa6')],_0xef0490[_0xb92b('0xa5')]);return _0x355407;})['then'](saveUpdates({'password':_0x5b833e[_0xb92b('0x65')][_0xb92b('0x9c')],'passwordResetAt':_0x5b833e[_0xb92b('0x35')]['id']==_0x5b833e[_0xb92b('0x66')]['id']?moment():null,'previousPasswords':authService[_0xb92b('0xa7')](_0x5b833e[_0xb92b('0x65')][_0xb92b('0x9c')],_0x355407[_0xb92b('0xa6')])},null));})['then'](respondWithResult(_0xeea91d,null))[_0xb92b('0x25')](handleError(_0xeea91d,null));};exports[_0xb92b('0xa8')]=function(_0xc0d447,_0x17efb2,_0x43d808){var _0x287948=_0xc0d447['body'][_0xb92b('0xa9')];return db[_0xb92b('0x45')]['find']({'where':{'id':_0xc0d447[_0xb92b('0x66')]['id']},'attributes':['id',_0xb92b('0x4b'),_0xb92b('0x3f'),_0xb92b('0xaa'),_0xb92b('0xab'),_0xb92b('0xac'),_0xb92b('0xad')]})[_0xb92b('0x32')](handleEntityNotFound(_0x17efb2,null))[_0xb92b('0x32')](function(_0x3cf19d){if(_0x3cf19d){if(!utils[_0xb92b('0xae')](_0x287948)){throw new db[(_0xb92b('0x9d'))][(_0xb92b('0x9e'))]('Unknown\x20channel');}return _0x3cf19d[_0xb92b('0xaf')+_[_0xb92b('0xb0')](_0x287948[_0xb92b('0xb1')]())+_0xb92b('0xb2')](_0xc0d447[_0xb92b('0x65')][_0xb92b('0x69')],{'penalty':_0xc0d447['body'][_0xb92b('0xb3')]||0x0})['spread'](function(_0x560397){for(var _0x355307=0x0;_0x355307<_0xc0d447[_0xb92b('0x65')]['ids'][_0xb92b('0x53')];_0x355307+=0x1){var _0x4a13bf={'UserId':_0xc0d447[_0xb92b('0x66')]['id']};_0x4a13bf[_['capitalize'](_0x287948['toLowerCase']())+_0xb92b('0xb4')]=_0xc0d447['body'][_0xb92b('0x69')][_0x355307];socket[_0xb92b('0xb5')](_0xb92b('0x35')+_['capitalize'](_0x287948['toLowerCase']())+_0xb92b('0xb6'),_0x4a13bf);}return _0x560397;})[_0xb92b('0x32')](function(){if(_0x287948==='voice'){return db[_0xb92b('0xb7')]['findAll']({'where':{'id':_0xc0d447['body'][_0xb92b('0x69')]||[]},'raw':!![],'attributes':['id',_0xb92b('0x4b')]});}})['then'](function(_0xcd73d){var _0xc38197=_0x3cf19d[_0xb92b('0x33')]({'plain':!![]});var _0x576924=[];if(_0x287948===_0xb92b('0xb8')&&_0xc38197[_0xb92b('0x3f')]==='agent'&&_0xc38197[_0xb92b('0xaa')]){for(var _0x1571cf=0x0;_0x1571cf<_0xcd73d[_0xb92b('0x53')];_0x1571cf+=0x1){_0x576924[_0xb92b('0x94')]({'membername':_0xc38197[_0xb92b('0x4b')],'UserId':_0xc38197['id'],'queue_name':_0xcd73d[_0x1571cf][_0xb92b('0x4b')],'VoiceQueueId':_0xcd73d[_0x1571cf]['id'],'interface':_['isNil'](_0xc38197['interface'])?util[_0xb92b('0xb9')](_0xb92b('0xba'),_0xc38197[_0xb92b('0x4b')]):_0xc38197['interface'],'paused':_0xc38197[_0xb92b('0xac')]||![],'penalty':_0xc0d447[_0xb92b('0x65')][_0xb92b('0xb3')]||0x0});}return BPromise[_0xb92b('0xbb')](_0x576924,function(_0x5162a5){return db[_0xb92b('0xbc')]['upsert'](_0x5162a5);});}return _0x3cf19d;});}})['then'](respondWithStatusCode(_0x17efb2,null))[_0xb92b('0x25')](handleError(_0x17efb2,null));};exports[_0xb92b('0xbd')]=function(_0x481d93,_0x2ddcd3,_0xde1190){var _0x27cb91;return db[_0xb92b('0x45')][_0xb92b('0x40')]({'where':{'id':_0x481d93[_0xb92b('0x66')]['id']},'attributes':['id',_0xb92b('0x4b'),_0xb92b('0x3f')]})[_0xb92b('0x32')](handleEntityNotFound(_0x2ddcd3,null))[_0xb92b('0x32')](function(_0x3cad77){if(_0x3cad77){_0x27cb91=_0x3cad77;if(!_0x481d93[_0xb92b('0x4e')]['channel']||!utils[_0xb92b('0xae')](_0x481d93[_0xb92b('0x4e')][_0xb92b('0xa9')])){throw new db[(_0xb92b('0x9d'))][(_0xb92b('0x9e'))](_0xb92b('0xbe'));}return _0x3cad77[_0xb92b('0xbf')+_[_0xb92b('0xb0')](_0x481d93[_0xb92b('0x4e')][_0xb92b('0xa9')][_0xb92b('0xb1')]())+_0xb92b('0xb2')](_0x481d93[_0xb92b('0x4e')][_0xb92b('0x69')]);}})[_0xb92b('0x32')](function(_0x3afdc3){for(var _0x1abcea=0x0;_0x1abcea<_0x481d93[_0xb92b('0x4e')][_0xb92b('0x69')]['length'];_0x1abcea+=0x1){var _0x5dd961={'UserId':_0x481d93[_0xb92b('0x66')]['id']};_0x5dd961[_[_0xb92b('0xb0')](_0x481d93['query'][_0xb92b('0xa9')][_0xb92b('0xb1')]())+_0xb92b('0xb4')]=_0x481d93[_0xb92b('0x4e')]['ids'][_0x1abcea];socket['emit']('user'+_['capitalize'](_0x481d93[_0xb92b('0x4e')][_0xb92b('0xa9')][_0xb92b('0xb1')]())+'Queue:remove',_0x5dd961);}return _0x3afdc3;})[_0xb92b('0x32')](function(){if(_0x481d93[_0xb92b('0x4e')][_0xb92b('0xa9')]===_0xb92b('0xb8')){return db['UserVoiceQueueRt'][_0xb92b('0x31')]({'where':{'UserId':_0x481d93[_0xb92b('0x66')]['id'],'VoiceQueueId':_0x481d93[_0xb92b('0x4e')][_0xb92b('0x69')]},'individualHooks':!![]})[_0xb92b('0x32')](function(){return _0x27cb91;});}return _0x27cb91;})[_0xb92b('0x32')](respondWithStatusCode(_0x2ddcd3,null))[_0xb92b('0x25')](handleError(_0x2ddcd3,null));};exports[_0xb92b('0xc0')]=function(_0x4d5aeb,_0x4a0277,_0x2bffce){_0x4d5aeb[_0xb92b('0x65')][_0xb92b('0xc1')]=_0x4d5aeb[_0xb92b('0xc2')][_0xb92b('0xc3')];return db['User'][_0xb92b('0x40')]({'where':{'id':_0x4d5aeb[_0xb92b('0x66')]['id']}})['then'](handleEntityNotFound(_0x4a0277,null))['then'](saveUpdates(_0x4d5aeb[_0xb92b('0x65')],null))[_0xb92b('0x32')](respondWithResult(_0x4a0277,null))['catch'](handleError(_0x4a0277,null));};exports['getAvatar']=function(_0x930023,_0x149f97,_0x531d76){var _0x259415=path['join'](config['root'],_0xb92b('0xc4'));return db[_0xb92b('0x45')][_0xb92b('0x40')]({'where':{'id':_0x930023[_0xb92b('0x66')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0xb92b('0x32')](handleEntityNotFound(_0x149f97,null))['then'](function(_0x254c40){if(_0x254c40){if(_[_0xb92b('0x75')](_0x254c40['userpic'])){return _0x149f97[_0xb92b('0xc5')](_0x259415);}else{if(!fs[_0xb92b('0xc6')](path[_0xb92b('0xc7')](config['root'],_0xb92b('0xc8'),_0x254c40[_0xb92b('0xc1')]))){return _0x149f97['download'](_0x259415);}return _0x149f97[_0xb92b('0xc5')](path['join'](config['root'],'server/files/images/',_0x254c40[_0xb92b('0xc1')]));}}})[_0xb92b('0x25')](handleError(_0x149f97,null));};exports[_0xb92b('0xc9')]=function(_0x332268,_0x435790,_0x43d827){var _0x272cc1={};var _0x538e72={};var _0x104772;var _0x167af5;return db[_0xb92b('0x45')][_0xb92b('0xca')]({'where':{'id':_0x332268[_0xb92b('0x66')]['id']}})[_0xb92b('0x32')](handleEntityNotFound(_0x435790,null))[_0xb92b('0x32')](function(_0x462095){if(_0x462095){_0x104772=_0x462095;_0x538e72[_0xb92b('0x49')]=_[_0xb92b('0x4d')](db[_0xb92b('0xcb')][_0xb92b('0x46')]);_0x538e72[_0xb92b('0x4e')]=_[_0xb92b('0x4d')](_0x332268[_0xb92b('0x4e')]);_0x538e72[_0xb92b('0x4f')]=_['intersection'](_0x538e72[_0xb92b('0x49')],_0x538e72[_0xb92b('0x4e')]);_0x272cc1['attributes']=_[_0xb92b('0x50')](_0x538e72[_0xb92b('0x49')],qs[_0xb92b('0x52')](_0x332268[_0xb92b('0x4e')][_0xb92b('0x52')]));_0x272cc1[_0xb92b('0x51')]=_0x272cc1[_0xb92b('0x51')]['length']?_0x272cc1[_0xb92b('0x51')]:_0x538e72[_0xb92b('0x49')];_0x272cc1[_0xb92b('0x56')]=qs[_0xb92b('0x57')](_0x332268[_0xb92b('0x4e')][_0xb92b('0x57')]);_0x272cc1[_0xb92b('0x58')]=qs[_0xb92b('0x4f')](_[_0xb92b('0x59')](_0x332268[_0xb92b('0x4e')],_0x538e72['filters']));if(_0x332268[_0xb92b('0x4e')][_0xb92b('0x3a')]){_0x272cc1[_0xb92b('0x58')]=_[_0xb92b('0x5e')](_0x272cc1[_0xb92b('0x58')],{'$or':_[_0xb92b('0x3c')](_0x272cc1[_0xb92b('0x51')],function(_0x59a36e){var _0x509b53={};_0x509b53[_0x59a36e]={'$like':'%'+_0x332268[_0xb92b('0x4e')][_0xb92b('0x3a')]+'%'};return _0x509b53;})});}_0x272cc1=_[_0xb92b('0x5e')]({},_0x272cc1,_0x332268[_0xb92b('0x64')]);return _0x104772[_0xb92b('0xc9')](_0x272cc1);}})[_0xb92b('0x32')](function(_0x2453eb){if(_0x2453eb){_0x167af5=_0x2453eb['length'];if(_0x332268[_0xb92b('0x4e')][_0xb92b('0x54')](_0xb92b('0x5f'))){_0x272cc1[_0xb92b('0x63')]=[{'model':db[_0xb92b('0xcc')],'as':_0xb92b('0xcd'),'required':![]},{'model':db[_0xb92b('0xce')],'as':'Tags','attributes':['id','name',_0xb92b('0xcf')],'where':_0x332268['query']['tag']?{'id':_0x332268[_0xb92b('0x4e')]['tag']}:undefined,'required':_0x332268['query'][_0xb92b('0xd0')]?!![]:![]}];}if(!_0x332268[_0xb92b('0x4e')]['hasOwnProperty'](_0xb92b('0x55'))){_0x272cc1['limit']=qs[_0xb92b('0x2a')](_0x332268[_0xb92b('0x4e')][_0xb92b('0x2a')]);_0x272cc1[_0xb92b('0x29')]=qs[_0xb92b('0x29')](_0x332268['query'][_0xb92b('0x29')]);}return _0x104772[_0xb92b('0xc9')](_0x272cc1);}})['then'](function(_0x405382){if(_0x405382){return _0x405382?{'count':_0x167af5,'rows':_0x405382}:null;}})[_0xb92b('0x32')](respondWithResult(_0x435790,null))[_0xb92b('0x25')](handleError(_0x435790,null));};exports[_0xb92b('0xd1')]=function(_0x4b5f43,_0x3cc40a,_0x17259d){var _0x53e43d;var _0x474b2e;var _0x4a4ac5={};var _0x8716cc;return db[_0xb92b('0x45')][_0xb92b('0xca')]({'where':{'id':_0x4b5f43[_0xb92b('0x66')]['id']},'attributes':['id',_0xb92b('0x4b'),_0xb92b('0x3f')]})['then'](handleEntityNotFound(_0x3cc40a,null))[_0xb92b('0x32')](function(_0x553c12){if(!utils['isValidChannel'](_0x4b5f43[_0xb92b('0x4e')][_0xb92b('0xa9')])){throw new db[(_0xb92b('0x9d'))]['ValidationError'](_0xb92b('0xbe'));}_0x53e43d=_0x553c12;var _0x15a0cd={};_0x15a0cd['model']=_['keys'](db[_[_0xb92b('0xb0')](_0x4b5f43[_0xb92b('0x4e')][_0xb92b('0xa9')])+_0xb92b('0xd2')][_0xb92b('0x46')]);_0x15a0cd[_0xb92b('0x4e')]=_[_0xb92b('0x4d')](_0x4b5f43[_0xb92b('0x4e')]);_0x15a0cd[_0xb92b('0x4f')]=_[_0xb92b('0x50')](_0x15a0cd[_0xb92b('0x49')],_0x15a0cd[_0xb92b('0x4e')]);_0x4a4ac5['attributes']=_['intersection'](_0x15a0cd[_0xb92b('0x49')],qs[_0xb92b('0x52')](_0x4b5f43[_0xb92b('0x4e')][_0xb92b('0x52')]));_0x4a4ac5[_0xb92b('0x51')]=_0x4a4ac5[_0xb92b('0x51')]['length']?_0x4a4ac5[_0xb92b('0x51')]:_0x15a0cd['model'];_0x4a4ac5[_0xb92b('0x56')]=qs[_0xb92b('0x57')](_0x4b5f43['query'][_0xb92b('0x57')]);_0x4a4ac5[_0xb92b('0x58')]=qs[_0xb92b('0x4f')](_['pick'](_0x4b5f43[_0xb92b('0x4e')],_0x15a0cd['filters']));if(_0x4b5f43['query'][_0xb92b('0x3a')]){_0x4a4ac5[_0xb92b('0x58')]=_[_0xb92b('0x5e')](_0x4a4ac5['where'],{'$or':_[_0xb92b('0x3c')](_0x4a4ac5['attributes'],function(_0x46c79a){var _0xe84c31={};_0xe84c31[_0x46c79a]={'$like':'%'+_0x4b5f43[_0xb92b('0x4e')][_0xb92b('0x3a')]+'%'};return _0xe84c31;})});}_0x4a4ac5=_[_0xb92b('0x5e')]({},_0x4a4ac5,_0x4b5f43['options']);switch(_0x53e43d[_0xb92b('0x3f')]){case'admin':return db[_[_0xb92b('0xb0')](_0x4b5f43[_0xb92b('0x4e')][_0xb92b('0xa9')])+_0xb92b('0xd2')][_0xb92b('0x97')](_0x4a4ac5);case _0xb92b('0x35'):case _0xb92b('0x37'):return _0x53e43d[_0xb92b('0x33')+_[_0xb92b('0xb0')](_0x4b5f43[_0xb92b('0x4e')]['channel'])+_0xb92b('0xb2')](_0x4a4ac5);default:throw new db[(_0xb92b('0x9d'))]['ValidationError'](_0xb92b('0xd3'));}})['then'](function(_0x3bddb9){_0x8716cc=_0x3bddb9[_0xb92b('0x53')];if(!_0x4b5f43['query'][_0xb92b('0x54')](_0xb92b('0x55'))){_0x4a4ac5[_0xb92b('0x2a')]=qs[_0xb92b('0x2a')](_0x4b5f43[_0xb92b('0x4e')][_0xb92b('0x2a')]);_0x4a4ac5[_0xb92b('0x29')]=qs[_0xb92b('0x29')](_0x4b5f43[_0xb92b('0x4e')][_0xb92b('0x29')]);}switch(_0x53e43d[_0xb92b('0x3f')]){case _0xb92b('0x34'):return db[_['capitalize'](_0x4b5f43[_0xb92b('0x4e')][_0xb92b('0xa9')])+_0xb92b('0xd2')][_0xb92b('0x97')](_0x4a4ac5);case _0xb92b('0x35'):case'agent':return _0x53e43d[_0xb92b('0x33')+_[_0xb92b('0xb0')](_0x4b5f43[_0xb92b('0x4e')][_0xb92b('0xa9')])+_0xb92b('0xb2')](_0x4a4ac5);}})[_0xb92b('0x32')](function(_0x8de242){return{'count':_0x8716cc,'rows':_0x8de242};})['then'](respondWithResult(_0x3cc40a,null))['catch'](handleError(_0x3cc40a,null));};exports[_0xb92b('0xd4')]=function(_0x37936a,_0x5d9dd7,_0x33a38e){var _0x3d6fde={};var _0x124bcc={};var _0x5b0da4;var _0x59a12d;return db[_0xb92b('0x45')][_0xb92b('0xca')]({'where':{'id':_0x37936a[_0xb92b('0x66')]['id']}})[_0xb92b('0x32')](handleEntityNotFound(_0x5d9dd7,null))['then'](function(_0x21d204){if(_0x21d204){_0x5b0da4=_0x21d204;_0x124bcc[_0xb92b('0x49')]=_['keys'](db[_0xb92b('0xbc')][_0xb92b('0x46')]);_0x124bcc['query']=_[_0xb92b('0x4d')](_0x37936a[_0xb92b('0x4e')]);_0x124bcc['filters']=_[_0xb92b('0x50')](_0x124bcc[_0xb92b('0x49')],_0x124bcc['query']);_0x3d6fde['attributes']=_[_0xb92b('0x50')](_0x124bcc[_0xb92b('0x49')],qs['fields'](_0x37936a[_0xb92b('0x4e')][_0xb92b('0x52')]));_0x3d6fde[_0xb92b('0x51')]=_0x3d6fde[_0xb92b('0x51')][_0xb92b('0x53')]?_0x3d6fde['attributes']:_0x124bcc['model'];_0x3d6fde[_0xb92b('0x56')]=qs[_0xb92b('0x57')](_0x37936a[_0xb92b('0x4e')]['sort']);_0x3d6fde[_0xb92b('0x58')]=qs['filters'](_[_0xb92b('0x59')](_0x37936a[_0xb92b('0x4e')],_0x124bcc[_0xb92b('0x4f')]));if(_0x37936a[_0xb92b('0x4e')][_0xb92b('0x3a')]){_0x3d6fde[_0xb92b('0x58')]=_['merge'](_0x3d6fde[_0xb92b('0x58')],{'$or':_[_0xb92b('0x3c')](_0x3d6fde['attributes'],function(_0x567e31){var _0x6c939d={};_0x6c939d[_0x567e31]={'$like':'%'+_0x37936a[_0xb92b('0x4e')][_0xb92b('0x3a')]+'%'};return _0x6c939d;})});}_0x3d6fde=_['merge']({},_0x3d6fde,_0x37936a[_0xb92b('0x64')]);return _0x5b0da4[_0xb92b('0xd4')](_0x3d6fde);}})[_0xb92b('0x32')](function(_0x1abdab){if(_0x1abdab){_0x59a12d=_0x1abdab['length'];if(!_0x37936a[_0xb92b('0x4e')][_0xb92b('0x54')]('nolimit')){_0x3d6fde['limit']=qs[_0xb92b('0x2a')](_0x37936a[_0xb92b('0x4e')][_0xb92b('0x2a')]);_0x3d6fde[_0xb92b('0x29')]=qs[_0xb92b('0x29')](_0x37936a['query'][_0xb92b('0x29')]);}return _0x5b0da4[_0xb92b('0xd4')](_0x3d6fde);}})[_0xb92b('0x32')](function(_0x1452a7){if(_0x1452a7){return _0x1452a7?{'count':_0x59a12d,'rows':_0x1452a7}:null;}})['then'](respondWithResult(_0x5d9dd7,null))['catch'](handleError(_0x5d9dd7,null));};exports['getGroups']=function(_0x371282,_0x3ddcea,_0x59f1af){var _0x13663e={};var _0x47f2e8={};var _0x436a84;var _0x5220fe;return db['User']['findOne']({'where':{'id':_0x371282['params']['id']}})['then'](handleEntityNotFound(_0x3ddcea,null))[_0xb92b('0x32')](function(_0x23c5c5){if(_0x23c5c5){_0x436a84=_0x23c5c5;_0x47f2e8[_0xb92b('0x49')]=_[_0xb92b('0x4d')](db[_0xb92b('0xd5')][_0xb92b('0x46')]);_0x47f2e8[_0xb92b('0x4e')]=_[_0xb92b('0x4d')](_0x371282[_0xb92b('0x4e')]);_0x47f2e8['filters']=_[_0xb92b('0x50')](_0x47f2e8[_0xb92b('0x49')],_0x47f2e8['query']);_0x13663e[_0xb92b('0x51')]=_[_0xb92b('0x50')](_0x47f2e8[_0xb92b('0x49')],qs['fields'](_0x371282[_0xb92b('0x4e')][_0xb92b('0x52')]));_0x13663e[_0xb92b('0x51')]=_0x13663e[_0xb92b('0x51')][_0xb92b('0x53')]?_0x13663e[_0xb92b('0x51')]:_0x47f2e8['model'];_0x13663e[_0xb92b('0x56')]=qs[_0xb92b('0x57')](_0x371282[_0xb92b('0x4e')][_0xb92b('0x57')]);_0x13663e['where']=qs['filters'](_['pick'](_0x371282[_0xb92b('0x4e')],_0x47f2e8[_0xb92b('0x4f')]));if(_0x371282[_0xb92b('0x4e')]['filter']){_0x13663e['where']=_[_0xb92b('0x5e')](_0x13663e[_0xb92b('0x58')],{'$or':_[_0xb92b('0x3c')](_0x13663e['attributes'],function(_0x338a7e){var _0x1d3751={};_0x1d3751[_0x338a7e]={'$like':'%'+_0x371282[_0xb92b('0x4e')]['filter']+'%'};return _0x1d3751;})});}_0x13663e=_[_0xb92b('0x5e')]({},_0x13663e,_0x371282[_0xb92b('0x64')]);return _0x436a84[_0xb92b('0xd6')](_0x13663e);}})['then'](function(_0x331608){if(_0x331608){_0x5220fe=_0x331608[_0xb92b('0x53')];if(!_0x371282[_0xb92b('0x4e')]['hasOwnProperty'](_0xb92b('0x55'))){_0x13663e['limit']=qs[_0xb92b('0x2a')](_0x371282[_0xb92b('0x4e')][_0xb92b('0x2a')]);_0x13663e[_0xb92b('0x29')]=qs['offset'](_0x371282[_0xb92b('0x4e')][_0xb92b('0x29')]);}return _0x436a84[_0xb92b('0xd6')](_0x13663e);}})[_0xb92b('0x32')](function(_0xd98b3a){if(_0xd98b3a){return _0xd98b3a?{'count':_0x5220fe,'rows':_0xd98b3a}:null;}})['then'](respondWithResult(_0x3ddcea,null))['catch'](handleError(_0x3ddcea,null));};exports['getRecordings']=function(_0x575ab2,_0x564c40,_0x5d8bb4){var _0x519d7d={'raw':!![],'where':{}};var _0x1a7b8a={};var _0x543d6b={'count':0x0,'rows':[]};return db[_0xb92b('0x45')]['findOne']({'where':{'id':_0x575ab2[_0xb92b('0x66')]['id']}})['then'](handleEntityNotFound(_0x564c40,null))[_0xb92b('0x32')](function(_0x3a9d7a){if(_0x3a9d7a){_0x1a7b8a['model']=_[_0xb92b('0x4d')](db[_0xb92b('0xd7')][_0xb92b('0x46')]);_0x1a7b8a['query']=_[_0xb92b('0x4d')](_0x575ab2[_0xb92b('0x4e')]);_0x1a7b8a[_0xb92b('0x4f')]=_[_0xb92b('0x50')](_0x1a7b8a[_0xb92b('0x49')],_0x1a7b8a[_0xb92b('0x4e')]);_0x519d7d[_0xb92b('0x51')]=_[_0xb92b('0x50')](_0x1a7b8a[_0xb92b('0x49')],qs[_0xb92b('0x52')](_0x575ab2[_0xb92b('0x4e')][_0xb92b('0x52')]));_0x519d7d[_0xb92b('0x51')]=_0x519d7d[_0xb92b('0x51')][_0xb92b('0x53')]?_0x519d7d[_0xb92b('0x51')]:_0x1a7b8a[_0xb92b('0x49')];if(!_0x575ab2['query'][_0xb92b('0x54')]('nolimit')){_0x519d7d[_0xb92b('0x2a')]=qs[_0xb92b('0x2a')](_0x575ab2[_0xb92b('0x4e')][_0xb92b('0x2a')]);_0x519d7d['offset']=qs[_0xb92b('0x29')](_0x575ab2['query'][_0xb92b('0x29')]);}_0x519d7d[_0xb92b('0x56')]=qs['sort'](_0x575ab2['query'][_0xb92b('0x57')]);_0x519d7d['where']=qs[_0xb92b('0x4f')](_['pick'](_0x575ab2[_0xb92b('0x4e')],_0x1a7b8a[_0xb92b('0x4f')]));_0x519d7d[_0xb92b('0x58')]['UserId']=_0x3a9d7a['id'];if(_0x575ab2['query'][_0xb92b('0x3a')]){_0x519d7d['where']=_['merge'](_0x519d7d['where'],{'$or':_[_0xb92b('0x3c')](_0x519d7d[_0xb92b('0x51')],function(_0x5609ad){var _0x209722={};_0x209722[_0x5609ad]={'$like':'%'+_0x575ab2[_0xb92b('0x4e')]['filter']+'%'};return _0x209722;})});}_0x519d7d=_['merge']({},_0x519d7d,_0x575ab2[_0xb92b('0x64')]);return db[_0xb92b('0xd7')][_0xb92b('0x28')]({'where':_0x519d7d['where']})[_0xb92b('0x32')](function(_0x544ac6){_0x543d6b[_0xb92b('0x28')]=_0x544ac6;if(_0x575ab2['query'][_0xb92b('0x5f')]){_0x519d7d['include']=[{'all':!![]}];}return db['VoiceRecording'][_0xb92b('0x97')](_0x519d7d);})[_0xb92b('0x32')](function(_0x34a61f){_0x543d6b[_0xb92b('0x60')]=_0x34a61f;return _0x543d6b;});}})[_0xb92b('0x32')](respondWithFilteredResult(_0x564c40,_0x519d7d))[_0xb92b('0x25')](handleError(_0x564c40,null));};exports['getScreenRecordings']=function(_0x13b9d5,_0x5d855c,_0x1182c8){var _0x3c1a8d={'raw':!![],'where':{}};var _0x4e7a3d={};var _0x456627={'count':0x0,'rows':[]};return db[_0xb92b('0x45')][_0xb92b('0xca')]({'where':{'id':_0x13b9d5[_0xb92b('0x66')]['id']}})['then'](handleEntityNotFound(_0x5d855c,null))['then'](function(_0x2a577c){if(_0x2a577c){_0x4e7a3d['model']=_[_0xb92b('0x4d')](db[_0xb92b('0xd8')][_0xb92b('0x46')]);_0x4e7a3d['query']=_['keys'](_0x13b9d5[_0xb92b('0x4e')]);_0x4e7a3d[_0xb92b('0x4f')]=_[_0xb92b('0x50')](_0x4e7a3d[_0xb92b('0x49')],_0x4e7a3d[_0xb92b('0x4e')]);_0x3c1a8d['attributes']=_[_0xb92b('0x50')](_0x4e7a3d[_0xb92b('0x49')],qs['fields'](_0x13b9d5['query'][_0xb92b('0x52')]));_0x3c1a8d[_0xb92b('0x51')]=_0x3c1a8d['attributes'][_0xb92b('0x53')]?_0x3c1a8d['attributes']:_0x4e7a3d['model'];if(!_0x13b9d5[_0xb92b('0x4e')][_0xb92b('0x54')](_0xb92b('0x55'))){_0x3c1a8d[_0xb92b('0x2a')]=qs['limit'](_0x13b9d5[_0xb92b('0x4e')][_0xb92b('0x2a')]);_0x3c1a8d['offset']=qs['offset'](_0x13b9d5[_0xb92b('0x4e')][_0xb92b('0x29')]);}_0x3c1a8d[_0xb92b('0x56')]=qs[_0xb92b('0x57')](_0x13b9d5['query'][_0xb92b('0x57')]);_0x3c1a8d['where']=qs[_0xb92b('0x4f')](_[_0xb92b('0x59')](_0x13b9d5[_0xb92b('0x4e')],_0x4e7a3d[_0xb92b('0x4f')]));_0x3c1a8d['where'][_0xb92b('0xd9')]=_0x2a577c['id'];if(_0x13b9d5['query'][_0xb92b('0x3a')]){_0x3c1a8d['where']=_[_0xb92b('0x5e')](_0x3c1a8d[_0xb92b('0x58')],{'$or':_[_0xb92b('0x3c')](_0x3c1a8d[_0xb92b('0x51')],function(_0x2a06a5){var _0x244866={};_0x244866[_0x2a06a5]={'$like':'%'+_0x13b9d5[_0xb92b('0x4e')][_0xb92b('0x3a')]+'%'};return _0x244866;})});}_0x3c1a8d=_[_0xb92b('0x5e')]({},_0x3c1a8d,_0x13b9d5[_0xb92b('0x64')]);return db['ScreenRecording'][_0xb92b('0x28')]({'where':_0x3c1a8d[_0xb92b('0x58')]})[_0xb92b('0x32')](function(_0x4bdff4){_0x456627[_0xb92b('0x28')]=_0x4bdff4;if(_0x13b9d5['query'][_0xb92b('0x5f')]){_0x3c1a8d[_0xb92b('0x63')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x3c1a8d);})[_0xb92b('0x32')](function(_0xcff918){_0x456627['rows']=_0xcff918;return _0x456627;});}})['then'](respondWithFilteredResult(_0x5d855c,_0x3c1a8d))[_0xb92b('0x25')](handleError(_0x5d855c,null));};exports[_0xb92b('0xda')]=function(_0x4a528d,_0x3dac27,_0x352d51){var _0x515442={};var _0x1789d5={};var _0x1957ad;var _0x61fa7b;return db[_0xb92b('0x45')][_0xb92b('0xca')]({'where':{'id':_0x4a528d['params']['id']}})[_0xb92b('0x32')](handleEntityNotFound(_0x3dac27,null))[_0xb92b('0x32')](function(_0x20c999){if(_0x20c999){_0x1957ad=_0x20c999;_0x1789d5[_0xb92b('0x49')]=_[_0xb92b('0x4d')](db[_0xb92b('0xdb')][_0xb92b('0x46')]);_0x1789d5[_0xb92b('0x4e')]=_['keys'](_0x4a528d[_0xb92b('0x4e')]);_0x1789d5['filters']=_[_0xb92b('0x50')](_0x1789d5[_0xb92b('0x49')],_0x1789d5[_0xb92b('0x4e')]);_0x515442[_0xb92b('0x51')]=_[_0xb92b('0x50')](_0x1789d5[_0xb92b('0x49')],qs['fields'](_0x4a528d[_0xb92b('0x4e')]['fields']));_0x515442[_0xb92b('0x51')]=_0x515442['attributes'][_0xb92b('0x53')]?_0x515442[_0xb92b('0x51')]:_0x1789d5[_0xb92b('0x49')];_0x515442[_0xb92b('0x56')]=qs[_0xb92b('0x57')](_0x4a528d[_0xb92b('0x4e')][_0xb92b('0x57')]);_0x515442[_0xb92b('0x58')]=qs['filters'](_['pick'](_0x4a528d[_0xb92b('0x4e')],_0x1789d5[_0xb92b('0x4f')]));if(_0x4a528d['query'][_0xb92b('0x3a')]){_0x515442['where']=_[_0xb92b('0x5e')](_0x515442['where'],{'$or':_[_0xb92b('0x3c')](_0x515442[_0xb92b('0x51')],function(_0x3b9105){var _0x5c7994={};_0x5c7994[_0x3b9105]={'$like':'%'+_0x4a528d[_0xb92b('0x4e')]['filter']+'%'};return _0x5c7994;})});}_0x515442=_['merge']({},_0x515442,_0x4a528d[_0xb92b('0x64')]);return _0x1957ad[_0xb92b('0xda')](_0x515442);}})['then'](function(_0xd2c579){if(_0xd2c579){_0x61fa7b=_0xd2c579['length'];if(!_0x4a528d[_0xb92b('0x4e')][_0xb92b('0x54')](_0xb92b('0x55'))){_0x515442[_0xb92b('0x2a')]=qs[_0xb92b('0x2a')](_0x4a528d[_0xb92b('0x4e')][_0xb92b('0x2a')]);_0x515442[_0xb92b('0x29')]=qs['offset'](_0x4a528d[_0xb92b('0x4e')][_0xb92b('0x29')]);}return _0x1957ad['getChatInteractions'](_0x515442);}})[_0xb92b('0x32')](function(_0x4c2de3){if(_0x4c2de3){return _0x4c2de3?{'count':_0x61fa7b,'rows':_0x4c2de3}:null;}})[_0xb92b('0x32')](respondWithResult(_0x3dac27,null))['catch'](handleError(_0x3dac27,null));};exports[_0xb92b('0xdc')]=function(_0x2b4389,_0x34d35f,_0x1d8252){var _0x18e06={};var _0x457405={};var _0x3cc714;var _0x5ee750;return db[_0xb92b('0x45')][_0xb92b('0xca')]({'where':{'id':_0x2b4389[_0xb92b('0x66')]['id']}})[_0xb92b('0x32')](handleEntityNotFound(_0x34d35f,null))[_0xb92b('0x32')](function(_0x2a90e6){if(_0x2a90e6){_0x3cc714=_0x2a90e6;_0x457405[_0xb92b('0x49')]=_[_0xb92b('0x4d')](db[_0xb92b('0xdd')][_0xb92b('0x46')]);_0x457405['query']=_[_0xb92b('0x4d')](_0x2b4389[_0xb92b('0x4e')]);_0x457405['filters']=_[_0xb92b('0x50')](_0x457405[_0xb92b('0x49')],_0x457405[_0xb92b('0x4e')]);_0x18e06[_0xb92b('0x51')]=_[_0xb92b('0x50')](_0x457405[_0xb92b('0x49')],qs[_0xb92b('0x52')](_0x2b4389[_0xb92b('0x4e')][_0xb92b('0x52')]));_0x18e06[_0xb92b('0x51')]=_0x18e06['attributes'][_0xb92b('0x53')]?_0x18e06[_0xb92b('0x51')]:_0x457405[_0xb92b('0x49')];_0x18e06['order']=qs[_0xb92b('0x57')](_0x2b4389[_0xb92b('0x4e')][_0xb92b('0x57')]);_0x18e06[_0xb92b('0x58')]=qs[_0xb92b('0x4f')](_['pick'](_0x2b4389[_0xb92b('0x4e')],_0x457405[_0xb92b('0x4f')]));if(_0x2b4389['query'][_0xb92b('0x3a')]){_0x18e06[_0xb92b('0x58')]=_['merge'](_0x18e06[_0xb92b('0x58')],{'$or':_['map'](_0x18e06['attributes'],function(_0x24c7f){var _0x2210ce={};_0x2210ce[_0x24c7f]={'$like':'%'+_0x2b4389[_0xb92b('0x4e')][_0xb92b('0x3a')]+'%'};return _0x2210ce;})});}_0x18e06=_[_0xb92b('0x5e')]({},_0x18e06,_0x2b4389[_0xb92b('0x64')]);return _0x3cc714['getOpenchannelInteractions'](_0x18e06);}})[_0xb92b('0x32')](function(_0x4a6d4b){if(_0x4a6d4b){_0x5ee750=_0x4a6d4b[_0xb92b('0x53')];if(!_0x2b4389[_0xb92b('0x4e')][_0xb92b('0x54')](_0xb92b('0x55'))){_0x18e06[_0xb92b('0x2a')]=qs[_0xb92b('0x2a')](_0x2b4389[_0xb92b('0x4e')][_0xb92b('0x2a')]);_0x18e06['offset']=qs[_0xb92b('0x29')](_0x2b4389['query'][_0xb92b('0x29')]);}return _0x3cc714[_0xb92b('0xdc')](_0x18e06);}})[_0xb92b('0x32')](function(_0x13c0b4){if(_0x13c0b4){return _0x13c0b4?{'count':_0x5ee750,'rows':_0x13c0b4}:null;}})[_0xb92b('0x32')](respondWithResult(_0x34d35f,null))[_0xb92b('0x25')](handleError(_0x34d35f,null));};exports[_0xb92b('0xde')]=function(_0x44256d,_0x1e7efb,_0x1be60e){var _0x5bf032={'raw':!![],'where':{}};var _0x43709a={};var _0x413b8b={'count':0x0,'rows':[]};return db[_0xb92b('0x45')][_0xb92b('0xca')]({'where':{'id':_0x44256d['params']['id']}})[_0xb92b('0x32')](handleEntityNotFound(_0x1e7efb,null))['then'](function(_0x3c9f12){if(_0x3c9f12){_0x43709a['model']=_['keys'](db[_0xb92b('0xdf')]['rawAttributes']);_0x43709a[_0xb92b('0x4e')]=_[_0xb92b('0x4d')](_0x44256d[_0xb92b('0x4e')]);_0x43709a[_0xb92b('0x4f')]=_[_0xb92b('0x50')](_0x43709a[_0xb92b('0x49')],_0x43709a[_0xb92b('0x4e')]);_0x5bf032[_0xb92b('0x51')]=_[_0xb92b('0x50')](_0x43709a[_0xb92b('0x49')],qs['fields'](_0x44256d[_0xb92b('0x4e')][_0xb92b('0x52')]));_0x5bf032[_0xb92b('0x51')]=_0x5bf032['attributes'][_0xb92b('0x53')]?_0x5bf032[_0xb92b('0x51')]:_0x43709a[_0xb92b('0x49')];if(!_0x44256d[_0xb92b('0x4e')][_0xb92b('0x54')]('nolimit')){_0x5bf032[_0xb92b('0x2a')]=qs[_0xb92b('0x2a')](_0x44256d[_0xb92b('0x4e')]['limit']);_0x5bf032['offset']=qs[_0xb92b('0x29')](_0x44256d[_0xb92b('0x4e')]['offset']);}_0x5bf032[_0xb92b('0x56')]=qs[_0xb92b('0x57')](_0x44256d[_0xb92b('0x4e')][_0xb92b('0x57')]);_0x5bf032[_0xb92b('0x58')]=qs[_0xb92b('0x4f')](_[_0xb92b('0x59')](_0x44256d[_0xb92b('0x4e')],_0x43709a[_0xb92b('0x4f')]));_0x5bf032[_0xb92b('0x58')][_0xb92b('0xd9')]=_0x3c9f12['id'];if(_0x44256d[_0xb92b('0x4e')]['filter']){_0x5bf032[_0xb92b('0x58')]=_[_0xb92b('0x5e')](_0x5bf032['where'],{'$or':_[_0xb92b('0x3c')](_0x5bf032[_0xb92b('0x51')],function(_0x209087){var _0x162694={};_0x162694[_0x209087]={'$like':'%'+_0x44256d[_0xb92b('0x4e')][_0xb92b('0x3a')]+'%'};return _0x162694;})});}_0x5bf032=_[_0xb92b('0x5e')]({},_0x5bf032,_0x44256d[_0xb92b('0x64')]);return db[_0xb92b('0xdf')][_0xb92b('0x28')]({'where':_0x5bf032[_0xb92b('0x58')]})['then'](function(_0x285390){_0x413b8b[_0xb92b('0x28')]=_0x285390;if(_0x44256d[_0xb92b('0x4e')][_0xb92b('0x5f')]){_0x5bf032['include']=[{'all':!![]}];}return db['MailInteraction'][_0xb92b('0x97')](_0x5bf032);})[_0xb92b('0x32')](function(_0x29b51d){_0x413b8b['rows']=_0x29b51d;return _0x413b8b;});}})[_0xb92b('0x32')](respondWithFilteredResult(_0x1e7efb,_0x5bf032))[_0xb92b('0x25')](handleError(_0x1e7efb,null));};exports[_0xb92b('0xe0')]=function(_0x52b6a2,_0x415cb6,_0x495ef4){var _0x1d53d4={};var _0x669e2a={};var _0x323a52;var _0x11c2cb;return db['User']['findOne']({'where':{'id':_0x52b6a2[_0xb92b('0x66')]['id']}})[_0xb92b('0x32')](handleEntityNotFound(_0x415cb6,null))[_0xb92b('0x32')](function(_0x199b89){if(_0x199b89){_0x323a52=_0x199b89;_0x669e2a[_0xb92b('0x49')]=_['keys'](db[_0xb92b('0xe1')][_0xb92b('0x46')]);_0x669e2a[_0xb92b('0x4e')]=_[_0xb92b('0x4d')](_0x52b6a2[_0xb92b('0x4e')]);_0x669e2a[_0xb92b('0x4f')]=_[_0xb92b('0x50')](_0x669e2a[_0xb92b('0x49')],_0x669e2a[_0xb92b('0x4e')]);_0x1d53d4[_0xb92b('0x51')]=_['intersection'](_0x669e2a['model'],qs[_0xb92b('0x52')](_0x52b6a2['query'][_0xb92b('0x52')]));_0x1d53d4['attributes']=_0x1d53d4[_0xb92b('0x51')][_0xb92b('0x53')]?_0x1d53d4['attributes']:_0x669e2a['model'];_0x1d53d4[_0xb92b('0x56')]=qs['sort'](_0x52b6a2[_0xb92b('0x4e')][_0xb92b('0x57')]);_0x1d53d4['where']=qs[_0xb92b('0x4f')](_['pick'](_0x52b6a2[_0xb92b('0x4e')],_0x669e2a[_0xb92b('0x4f')]));if(_0x52b6a2[_0xb92b('0x4e')][_0xb92b('0x3a')]){_0x1d53d4[_0xb92b('0x58')]=_[_0xb92b('0x5e')](_0x1d53d4[_0xb92b('0x58')],{'$or':_[_0xb92b('0x3c')](_0x1d53d4[_0xb92b('0x51')],function(_0x56e97a){var _0x832652={};_0x832652[_0x56e97a]={'$like':'%'+_0x52b6a2[_0xb92b('0x4e')][_0xb92b('0x3a')]+'%'};return _0x832652;})});}_0x1d53d4=_[_0xb92b('0x5e')]({},_0x1d53d4,_0x52b6a2[_0xb92b('0x64')]);return _0x323a52[_0xb92b('0xe0')](_0x1d53d4);}})[_0xb92b('0x32')](function(_0x4ab8cc){if(_0x4ab8cc){_0x11c2cb=_0x4ab8cc[_0xb92b('0x53')];if(!_0x52b6a2[_0xb92b('0x4e')]['hasOwnProperty'](_0xb92b('0x55'))){_0x1d53d4[_0xb92b('0x2a')]=qs[_0xb92b('0x2a')](_0x52b6a2[_0xb92b('0x4e')][_0xb92b('0x2a')]);_0x1d53d4[_0xb92b('0x29')]=qs['offset'](_0x52b6a2[_0xb92b('0x4e')][_0xb92b('0x29')]);}return _0x323a52[_0xb92b('0xe0')](_0x1d53d4);}})['then'](function(_0x372556){if(_0x372556){return _0x372556?{'count':_0x11c2cb,'rows':_0x372556}:null;}})['then'](respondWithResult(_0x415cb6,null))['catch'](handleError(_0x415cb6,null));};exports['getFaxInteractions']=function(_0x3288a1,_0x24446d,_0x44f952){var _0x1aa4a0={};var _0xbe350={};var _0x4b6e30;var _0x283731;return db[_0xb92b('0x45')][_0xb92b('0xca')]({'where':{'id':_0x3288a1['params']['id']}})[_0xb92b('0x32')](handleEntityNotFound(_0x24446d,null))['then'](function(_0x680b5b){if(_0x680b5b){_0x4b6e30=_0x680b5b;_0xbe350['model']=_[_0xb92b('0x4d')](db[_0xb92b('0xe2')][_0xb92b('0x46')]);_0xbe350[_0xb92b('0x4e')]=_[_0xb92b('0x4d')](_0x3288a1[_0xb92b('0x4e')]);_0xbe350[_0xb92b('0x4f')]=_[_0xb92b('0x50')](_0xbe350[_0xb92b('0x49')],_0xbe350[_0xb92b('0x4e')]);_0x1aa4a0[_0xb92b('0x51')]=_[_0xb92b('0x50')](_0xbe350[_0xb92b('0x49')],qs[_0xb92b('0x52')](_0x3288a1[_0xb92b('0x4e')][_0xb92b('0x52')]));_0x1aa4a0[_0xb92b('0x51')]=_0x1aa4a0[_0xb92b('0x51')][_0xb92b('0x53')]?_0x1aa4a0[_0xb92b('0x51')]:_0xbe350[_0xb92b('0x49')];_0x1aa4a0[_0xb92b('0x56')]=qs[_0xb92b('0x57')](_0x3288a1['query']['sort']);_0x1aa4a0[_0xb92b('0x58')]=qs[_0xb92b('0x4f')](_['pick'](_0x3288a1['query'],_0xbe350[_0xb92b('0x4f')]));if(_0x3288a1['query'][_0xb92b('0x3a')]){_0x1aa4a0[_0xb92b('0x58')]=_[_0xb92b('0x5e')](_0x1aa4a0[_0xb92b('0x58')],{'$or':_['map'](_0x1aa4a0[_0xb92b('0x51')],function(_0x859451){var _0x3e61fb={};_0x3e61fb[_0x859451]={'$like':'%'+_0x3288a1['query'][_0xb92b('0x3a')]+'%'};return _0x3e61fb;})});}_0x1aa4a0=_['merge']({},_0x1aa4a0,_0x3288a1[_0xb92b('0x64')]);return _0x4b6e30['getFaxInteractions'](_0x1aa4a0);}})[_0xb92b('0x32')](function(_0x38d00a){if(_0x38d00a){_0x283731=_0x38d00a['length'];if(!_0x3288a1[_0xb92b('0x4e')][_0xb92b('0x54')](_0xb92b('0x55'))){_0x1aa4a0[_0xb92b('0x2a')]=qs[_0xb92b('0x2a')](_0x3288a1[_0xb92b('0x4e')]['limit']);_0x1aa4a0['offset']=qs[_0xb92b('0x29')](_0x3288a1[_0xb92b('0x4e')][_0xb92b('0x29')]);}return _0x4b6e30[_0xb92b('0xe3')](_0x1aa4a0);}})[_0xb92b('0x32')](function(_0x29b66c){if(_0x29b66c){return _0x29b66c?{'count':_0x283731,'rows':_0x29b66c}:null;}})[_0xb92b('0x32')](respondWithResult(_0x24446d,null))[_0xb92b('0x25')](handleError(_0x24446d,null));};exports[_0xb92b('0xe4')]=function(_0x2fa174,_0x242b17,_0x308181){var _0x34bb44={};var _0x1d78e3={};var _0x466d5b;var _0x7ad5d7;return db['User']['findOne']({'where':{'id':_0x2fa174[_0xb92b('0x66')]['id']}})['then'](handleEntityNotFound(_0x242b17,null))[_0xb92b('0x32')](function(_0xe45648){if(_0xe45648){_0x466d5b=_0xe45648;_0x1d78e3[_0xb92b('0x49')]=_['keys'](db[_0xb92b('0xe5')]['rawAttributes']);_0x1d78e3[_0xb92b('0x4e')]=_[_0xb92b('0x4d')](_0x2fa174[_0xb92b('0x4e')]);_0x1d78e3['filters']=_[_0xb92b('0x50')](_0x1d78e3[_0xb92b('0x49')],_0x1d78e3[_0xb92b('0x4e')]);_0x34bb44[_0xb92b('0x51')]=_[_0xb92b('0x50')](_0x1d78e3[_0xb92b('0x49')],qs['fields'](_0x2fa174[_0xb92b('0x4e')][_0xb92b('0x52')]));_0x34bb44[_0xb92b('0x51')]=_0x34bb44[_0xb92b('0x51')][_0xb92b('0x53')]?_0x34bb44[_0xb92b('0x51')]:_0x1d78e3[_0xb92b('0x49')];_0x34bb44['order']=qs[_0xb92b('0x57')](_0x2fa174[_0xb92b('0x4e')][_0xb92b('0x57')]);_0x34bb44[_0xb92b('0x58')]=qs[_0xb92b('0x4f')](_[_0xb92b('0x59')](_0x2fa174['query'],_0x1d78e3[_0xb92b('0x4f')]));if(_0x2fa174[_0xb92b('0x4e')][_0xb92b('0x3a')]){_0x34bb44[_0xb92b('0x58')]=_[_0xb92b('0x5e')](_0x34bb44[_0xb92b('0x58')],{'$or':_[_0xb92b('0x3c')](_0x34bb44['attributes'],function(_0x5cd478){var _0x5f06c6={};_0x5f06c6[_0x5cd478]={'$like':'%'+_0x2fa174[_0xb92b('0x4e')][_0xb92b('0x3a')]+'%'};return _0x5f06c6;})});}_0x34bb44=_[_0xb92b('0x5e')]({},_0x34bb44,_0x2fa174[_0xb92b('0x64')]);return _0x466d5b[_0xb92b('0xe4')](_0x34bb44);}})[_0xb92b('0x32')](function(_0x66b06b){if(_0x66b06b){_0x7ad5d7=_0x66b06b[_0xb92b('0x53')];if(!_0x2fa174[_0xb92b('0x4e')][_0xb92b('0x54')](_0xb92b('0x55'))){_0x34bb44[_0xb92b('0x2a')]=qs['limit'](_0x2fa174[_0xb92b('0x4e')]['limit']);_0x34bb44[_0xb92b('0x29')]=qs[_0xb92b('0x29')](_0x2fa174[_0xb92b('0x4e')][_0xb92b('0x29')]);}return _0x466d5b['getWhatsappInteractions'](_0x34bb44);}})[_0xb92b('0x32')](function(_0x52bd80){if(_0x52bd80){return _0x52bd80?{'count':_0x7ad5d7,'rows':_0x52bd80}:null;}})[_0xb92b('0x32')](respondWithResult(_0x242b17,null))[_0xb92b('0x25')](handleError(_0x242b17,null));};exports[_0xb92b('0xe6')]=function(_0x9c0dd0,_0x17e6b3,_0xe4ee4a){var _0x1c917c;var _0x59e033;var _0x3e03ba;var _0x47c5c3=!_['isNil'](_0x9c0dd0[_0xb92b('0x66')]['id'])?_0x9c0dd0['params']['id']:!_['isNil'](_0x9c0dd0[_0xb92b('0x35')]['id'])?_0x9c0dd0[_0xb92b('0x35')]['id']:null;return db[_0xb92b('0x45')]['find']({'where':{'id':_0x47c5c3,'role':{'$or':['admin',_0xb92b('0x35'),'agent']}},'attributes':['id',_0xb92b('0x4b'),_0xb92b('0xe7'),_0xb92b('0xe8'),_0xb92b('0x3f'),'internal',_0xb92b('0xab')]})[_0xb92b('0x32')](function(_0xdb0a97){if(_0xdb0a97){if(_0xdb0a97['role']===_0xb92b('0x37')){_0x1c917c=_0xdb0a97;if(_0x9c0dd0['body'][_0xb92b('0xad')]){_0x3e03ba=util['format'](_0xb92b('0xe9'),_0x1c917c[_0x9c0dd0[_0xb92b('0x65')][_0xb92b('0xad')]]);}else if(_0x9c0dd0[_0xb92b('0x65')][_0xb92b('0xea')]){_0x3e03ba=util[_0xb92b('0xb9')](_0xb92b('0xba'),_0x9c0dd0[_0xb92b('0x65')][_0xb92b('0xea')]);}else{_0x3e03ba=util[_0xb92b('0xb9')](_0xb92b('0xba'),_0x1c917c[_0xb92b('0x4b')]);}socket['to'](util[_0xb92b('0xb9')](_0xb92b('0xeb'),_0x1c917c['name']))[_0xb92b('0xb5')](_0xb92b('0xec'),{'user':{'id':_0x1c917c['id'],'name':_0x1c917c[_0xb92b('0x4b')]},'ip':_0x9c0dd0[_0xb92b('0xed')][_0xb92b('0xee')]||_0x9c0dd0['connection'][_0xb92b('0xef')]||_0x9c0dd0[_0xb92b('0xf0')][_0xb92b('0xef')]||_0x9c0dd0['connection'][_0xb92b('0xf0')]['remoteAddress']});return db[_0xb92b('0xbc')][_0xb92b('0x31')]({'where':{'membername':_0x1c917c[_0xb92b('0x4b')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xb92b('0x9e'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0xb92b('0x32')](function(){if(_0x1c917c){return _0x1c917c[_0xb92b('0xf1')]({'raw':!![]});}})[_0xb92b('0x32')](function(_0x1623b2){if(_0x1c917c){var _0x30f32a=[];if(_0x1623b2){_0x59e033=_0x1623b2;if(_0x59e033[_0xb92b('0x53')]){for(var _0xd60a9e=0x0;_0xd60a9e<_0x59e033[_0xb92b('0x53')];_0xd60a9e++){_0x30f32a[_0xb92b('0x94')]({'membername':_0x1c917c['name'],'UserId':_0x1c917c['id'],'queue_name':_0x59e033[_0xd60a9e][_0xb92b('0x4b')],'VoiceQueueId':_0x59e033[_0xd60a9e]['id'],'interface':_0x3e03ba,'paused':_0x1c917c[_0xb92b('0xab')]||![],'penalty':_0x59e033[_0xd60a9e]['UserVoiceQueue.penalty']||0x0});}return BPromise['each'](_0x30f32a,function(_0x2c56a3){return db[_0xb92b('0xbc')][_0xb92b('0xf2')](_0x2c56a3);});}}}})['then'](function(){if(_0x1c917c){return db[_0xb92b('0xf3')][_0xb92b('0x97')]({'where':{'membername':_0x1c917c[_0xb92b('0x4b')],'exitAt':null}});}})[_0xb92b('0x32')](function(_0x52ab9d){if(_0x1c917c){var _0x466638=[];_0x52ab9d[_0xb92b('0xf4')](function(_0x2cc37d){_0x466638['push'](_0x2cc37d['update']({'exitAt':moment()[_0xb92b('0xb9')](_0xb92b('0xf5'))}));});return BPromise[_0xb92b('0x95')](_0x466638);}})[_0xb92b('0x32')](function(){if(_0x1c917c){var _0x4466a4=[];var _0x5a4e75=[];var _0x1c8222=utils[_0xb92b('0xf6')]();var _0x493854={'membername':_0x1c917c[_0xb92b('0x4b')],'interface':_0x3e03ba,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1c917c[_0xb92b('0x3f')],'internal':_0x1c917c['internal']};_0x1c8222[_0xb92b('0xf4')](function(_0x658d3){_0x4466a4[_0xb92b('0x94')](_[_0xb92b('0x5e')]({'channel':_0x658d3,'type':'LOGIN','data1':_0x9c0dd0['body'][_0xb92b('0xf7')],'data2':_0x3e03ba},_0x493854));if(_0x1c917c[_0xb92b('0xab')]){_0x5a4e75[_0xb92b('0x94')](_[_0xb92b('0x5e')]({'channel':_0x658d3,'type':_0xb92b('0xf8'),'data1':'LOGININPAUSE'},_0x493854));}});return db[_0xb92b('0xf3')][_0xb92b('0x91')](_0x4466a4[_0xb92b('0xf9')](_0x5a4e75),{'individualHooks':!![]});}})[_0xb92b('0x32')](function(){if(_0x1c917c){return _0x1c917c[_0xb92b('0x30')]({'online':!![],'lastLoginAt':moment()['format'](_0xb92b('0xf5')),'voicePause':_0x1c917c[_0xb92b('0xab')]||![],'mailPause':_0x1c917c[_0xb92b('0xab')]||![],'chatPause':_0x1c917c['loginInPause']||![],'faxPause':_0x1c917c[_0xb92b('0xab')]||![],'smsPause':_0x1c917c['loginInPause']||![],'openchannelPause':_0x1c917c[_0xb92b('0xab')]||![],'whatsappPause':_0x1c917c[_0xb92b('0xab')]||![],'pauseType':_0x1c917c['loginInPause']?_0xb92b('0xfa'):null,'interface':_0x3e03ba,'lastPauseAt':moment()[_0xb92b('0xb9')](_0xb92b('0xf5'))});}})[_0xb92b('0x32')](function(_0x586f96){if(_0x9c0dd0[_0xb92b('0xfb')]){return _0xe4ee4a();}else{return BPromise['resolve'](_0x586f96)['then'](respondWithResult(_0x17e6b3,null));}})['catch'](handleError(_0x17e6b3,null));};exports[_0xb92b('0xfc')]=function(_0x3579af,_0x3156b2,_0x455397){var _0x81c633;return db[_0xb92b('0x45')][_0xb92b('0x40')]({'where':{'id':_0x3579af[_0xb92b('0x66')]['id'],'role':_0xb92b('0x37')},'attributes':['id',_0xb92b('0x4b'),_0xb92b('0x3f')]})[_0xb92b('0x32')](handleEntityNotFound(_0x3156b2,null))['then'](function(_0x50b891){if(_0x50b891){_0x81c633=_0x50b891;return db[_0xb92b('0xbc')]['destroy']({'where':{'membername':_0x81c633[_0xb92b('0x4b')]},'individualHooks':!![]});}})[_0xb92b('0x32')](function(){return db[_0xb92b('0xf3')][_0xb92b('0x97')]({'where':{'membername':_0x81c633['name'],'exitAt':null}});})['then'](function(_0x39294b){var _0x4052ff=[];_0x39294b[_0xb92b('0xf4')](function(_0x3f51cc){_0x4052ff[_0xb92b('0x94')](_0x3f51cc[_0xb92b('0x30')]({'exitAt':moment()[_0xb92b('0xb9')](_0xb92b('0xf5'))}));});return BPromise[_0xb92b('0x95')](_0x4052ff);})[_0xb92b('0x32')](function(){return _0x81c633[_0xb92b('0x30')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x3156b2,null))[_0xb92b('0x25')](handleError(_0x3156b2,null));};exports['pause']=function(_0x27a1a0,_0x4891a8,_0x348e93){var _0x16a993;return db[_0xb92b('0xbc')][_0xb92b('0x30')]({'paused':0x1},{'where':{'UserId':_0x27a1a0[_0xb92b('0x66')]['id']},'individualHooks':!![]})[_0xb92b('0x32')](function(){return db[_0xb92b('0x45')][_0xb92b('0x40')]({'where':{'id':_0x27a1a0[_0xb92b('0x66')]['id'],'role':_0xb92b('0x37')},'attributes':['id',_0xb92b('0x4b'),_0xb92b('0x3f'),_0xb92b('0x71'),_0xb92b('0xad')]});})['then'](handleEntityNotFound(_0x4891a8,null))['then'](function(_0x3d798a){if(_0x3d798a){_0x16a993=_0x3d798a;return respondWithRpcPromise('QueuePause',_0xb92b('0xfd'),{'id':_0x16a993['id'],'name':_0x16a993[_0xb92b('0x4b')],'pause':!![]});}})[_0xb92b('0x32')](function(){if(_0x16a993){return db['MemberReport']['findAll']({'where':{'membername':_0x16a993[_0xb92b('0x4b')],'type':_0xb92b('0xf8'),'exitAt':null}});}})['then'](function(_0x3448cb){if(_0x3448cb[_0xb92b('0x53')]){var _0x23cd8a=moment()[_0xb92b('0xb9')](_0xb92b('0xf5'));for(var _0x346817=0x0,_0x534944=_0x3448cb[_0xb92b('0x53')];_0x346817<_0x534944;_0x346817++){_0x3448cb[_0x346817][_0xb92b('0xfe')]({'exitAt':_0x23cd8a});}}})['then'](function(){var _0x32c3d4=[];var _0x433aaa=utils[_0xb92b('0xf6')]();_0x433aaa[_0xb92b('0xf4')](function(_0xbd6aec){_0x32c3d4['push']({'channel':_0xbd6aec,'membername':_0x16a993[_0xb92b('0x4b')],'interface':_[_0xb92b('0x75')](_0x16a993['interface'])?util[_0xb92b('0xb9')](_0xb92b('0xba'),_0x16a993[_0xb92b('0x4b')]):_0x16a993[_0xb92b('0xad')],'type':_0xb92b('0xf8'),'enterAt':moment()[_0xb92b('0xb9')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x27a1a0[_0xb92b('0x65')]['type']||_0xb92b('0xff'),'role':_0x16a993[_0xb92b('0x3f')],'internal':_0x16a993[_0xb92b('0x71')]});});return db[_0xb92b('0xf3')][_0xb92b('0x91')](_0x32c3d4,{'individualHooks':!![]});})[_0xb92b('0x32')](function(){return _0x16a993[_0xb92b('0x30')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x27a1a0[_0xb92b('0x65')][_0xb92b('0x48')]||_0xb92b('0xff'),'lastPauseAt':moment()[_0xb92b('0xb9')](_0xb92b('0xf5'))});})['then'](respondWithResult(_0x4891a8,null))[_0xb92b('0x25')](handleError(_0x4891a8,null));};exports[_0xb92b('0x100')]=function(_0x70c8f5,_0xf3052d,_0x48f6dc){var _0x3ea841;return db[_0xb92b('0x45')][_0xb92b('0x40')]({'where':{'id':_0x70c8f5[_0xb92b('0x66')]['id']},'attributes':['id','name',_0xb92b('0x3f'),_0xb92b('0xac'),_0xb92b('0x101'),_0xb92b('0x102'),_0xb92b('0x103'),_0xb92b('0x104'),_0xb92b('0x105'),_0xb92b('0x106'),_0xb92b('0x107'),'lastPauseAt']})[_0xb92b('0x32')](handleEntityNotFound(_0xf3052d,null))[_0xb92b('0x32')](function(_0xbf2e0f){if(_0xbf2e0f){_0x3ea841=_0xbf2e0f;if(_0x70c8f5[_0xb92b('0x65')][_0xb92b('0xa9')]&&!utils[_0xb92b('0xae')](_0x70c8f5[_0xb92b('0x65')]['channel'])){throw new db[(_0xb92b('0x9d'))][(_0xb92b('0x9e'))](_0xb92b('0xbe'));}switch(_0x70c8f5[_0xb92b('0x65')][_0xb92b('0xa9')]){case _0xb92b('0xb8'):return respondWithRpcPromise(_0xb92b('0x108'),_0xb92b('0x100'),{'id':_0x3ea841['id'],'name':_0x3ea841[_0xb92b('0x4b')],'pause':![]})[_0xb92b('0x32')](function(){return db[_0xb92b('0xbc')][_0xb92b('0x30')]({'paused':0x0},{'where':{'UserId':_0x3ea841['id']},'individualHooks':!![]});})[_0xb92b('0x32')](function(){return db[_0xb92b('0xf3')]['find']({'where':{'channel':_0x70c8f5[_0xb92b('0x65')]['channel'],'membername':_0x3ea841['name'],'type':_0xb92b('0xf8'),'exitAt':null}});})[_0xb92b('0x32')](function(_0x133acb){if(_0x133acb){return _0x133acb['update']({'exitAt':moment()[_0xb92b('0xb9')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xb92b('0x32')](function(){return _0x3ea841[_0xb92b('0x30')]({'voicePause':![]});});case'mail':case _0xb92b('0x109'):case _0xb92b('0x10a'):case _0xb92b('0x10b'):case'whatsapp':case'openchannel':return db[_0xb92b('0xf3')]['find']({'where':{'channel':_0x70c8f5[_0xb92b('0x65')][_0xb92b('0xa9')],'membername':_0x3ea841[_0xb92b('0x4b')],'type':_0xb92b('0xf8'),'exitAt':null}})[_0xb92b('0x32')](function(_0x32ce0e){if(_0x32ce0e){return _0x32ce0e[_0xb92b('0x30')]({'exitAt':moment()[_0xb92b('0xb9')](_0xb92b('0xf5')),'data2':_0xb92b('0x10c')},{'individualHooks':!![]});}return null;})[_0xb92b('0x32')](function(){var _0x2b473f={};_[_0xb92b('0x10d')](_0x2b473f,util[_0xb92b('0xb9')](_0xb92b('0x10e'),_0x70c8f5[_0xb92b('0x65')]['channel'],'Pause'),![]);return _0x3ea841[_0xb92b('0x30')](_0x2b473f);});default:return respondWithRpcPromise(_0xb92b('0x108'),_0xb92b('0x100'),{'id':_0x3ea841['id'],'name':_0x3ea841[_0xb92b('0x4b')],'pause':![]})[_0xb92b('0x32')](function(){return db['UserVoiceQueueRt'][_0xb92b('0x30')]({'paused':0x0},{'where':{'UserId':_0x3ea841['id']}});})[_0xb92b('0x32')](function(){return db[_0xb92b('0xf3')]['findAll']({'where':{'membername':_0x3ea841[_0xb92b('0x4b')],'type':_0xb92b('0xf8'),'exitAt':null}});})['then'](function(_0x4f1662){var _0x176634=[];_0x4f1662[_0xb92b('0xf4')](function(_0x4d041e){_0x176634[_0xb92b('0x94')](_0x4d041e[_0xb92b('0x30')]({'exitAt':moment()[_0xb92b('0xb9')](_0xb92b('0xf5')),'data2':'manual'}));});return BPromise[_0xb92b('0x95')](_0x176634);})[_0xb92b('0x32')](function(){return _0x3ea841[_0xb92b('0x30')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0xf3052d,null))[_0xb92b('0x25')](handleError(_0xf3052d,null));};exports[_0xb92b('0x10f')]=function(_0x21efe7,_0x53a4e3,_0x9adbb3){var _0x596e1f={};var _0x422063={};var _0x11997b;var _0x6c426d;return db[_0xb92b('0x45')][_0xb92b('0xca')]({'where':{'id':_0x21efe7[_0xb92b('0x66')]['id']}})[_0xb92b('0x32')](handleEntityNotFound(_0x53a4e3,null))[_0xb92b('0x32')](function(_0x318fbc){if(_0x318fbc){_0x11997b=_0x318fbc;_0x422063[_0xb92b('0x49')]=_[_0xb92b('0x4d')](db[_0xb92b('0x110')]['rawAttributes']);_0x422063[_0xb92b('0x4e')]=_[_0xb92b('0x4d')](_0x21efe7[_0xb92b('0x4e')]);_0x422063[_0xb92b('0x4f')]=_[_0xb92b('0x50')](_0x422063[_0xb92b('0x49')],_0x422063[_0xb92b('0x4e')]);_0x596e1f[_0xb92b('0x51')]=_[_0xb92b('0x50')](_0x422063[_0xb92b('0x49')],qs[_0xb92b('0x52')](_0x21efe7[_0xb92b('0x4e')][_0xb92b('0x52')]));_0x596e1f[_0xb92b('0x51')]=_0x596e1f[_0xb92b('0x51')][_0xb92b('0x53')]?_0x596e1f[_0xb92b('0x51')]:_0x422063[_0xb92b('0x49')];_0x596e1f['order']=qs['sort'](_0x21efe7['query'][_0xb92b('0x57')]);_0x596e1f['where']=qs['filters'](_[_0xb92b('0x59')](_0x21efe7[_0xb92b('0x4e')],_0x422063['filters']));if(_0x21efe7[_0xb92b('0x4e')][_0xb92b('0x3a')]){_0x596e1f[_0xb92b('0x58')]=_['merge'](_0x596e1f[_0xb92b('0x58')],{'$or':_[_0xb92b('0x3c')](_0x596e1f['attributes'],function(_0x3d485f){var _0x33932f={};_0x33932f[_0x3d485f]={'$like':'%'+_0x21efe7[_0xb92b('0x4e')][_0xb92b('0x3a')]+'%'};return _0x33932f;})});}_0x596e1f=_[_0xb92b('0x5e')]({},_0x596e1f,_0x21efe7[_0xb92b('0x64')]);return _0x11997b['getTeams'](_0x596e1f);}})['then'](function(_0x3d38da){if(_0x3d38da){_0x6c426d=_0x3d38da['length'];if(!_0x21efe7[_0xb92b('0x4e')][_0xb92b('0x54')](_0xb92b('0x55'))){_0x596e1f[_0xb92b('0x2a')]=qs['limit'](_0x21efe7[_0xb92b('0x4e')][_0xb92b('0x2a')]);_0x596e1f[_0xb92b('0x29')]=qs[_0xb92b('0x29')](_0x21efe7[_0xb92b('0x4e')][_0xb92b('0x29')]);}return _0x11997b[_0xb92b('0x10f')](_0x596e1f);}})[_0xb92b('0x32')](function(_0x8b6eae){if(_0x8b6eae){return _0x8b6eae?{'count':_0x6c426d,'rows':_0x8b6eae}:null;}})[_0xb92b('0x32')](respondWithResult(_0x53a4e3,null))['catch'](handleError(_0x53a4e3,null));};exports[_0xb92b('0x111')]=function(_0x2fce03,_0x27e3f2){return db['User'][_0xb92b('0x40')]({'where':{'id':_0x2fce03[_0xb92b('0x66')]['id']}})[_0xb92b('0x32')](handleEntityNotFound(_0x27e3f2,null))[_0xb92b('0x32')](function(_0x334250){if(_0x334250){var _0x59c25a=_0x334250[_0xb92b('0x33')]({'plain':!![]});return _0x334250[_0xb92b('0x111')](_0x2fce03['body'][_0xb92b('0x69')],_['omit'](_0x2fce03[_0xb92b('0x65')],[_0xb92b('0x69'),'id'])||{})[_0xb92b('0x32')](function(){for(var _0x5a29f7=0x0;_0x5a29f7<_0x2fce03[_0xb92b('0x65')][_0xb92b('0x69')][_0xb92b('0x53')];_0x5a29f7++){var _0x38e5af=[];db[_0xb92b('0x110')]['findOne']({'where':{'id':_0x2fce03['body'][_0xb92b('0x69')][_0x5a29f7]}})[_0xb92b('0x32')](function(_0x5d3072){_0x38e5af['push'](_0x5d3072[_0xb92b('0xf1')]()[_0xb92b('0x32')](function(_0x597aa3){for(var _0x43fa70=0x0;_0x43fa70<_0x597aa3[_0xb92b('0x53')];_0x43fa70++){_0x597aa3[_0x43fa70][_0xb92b('0x112')]('channel',_0xb92b('0x113'));}return _0x597aa3;}));_0x38e5af[_0xb92b('0x94')](_0x5d3072[_0xb92b('0x114')]()['then'](function(_0x4d7e3b){for(var _0x17330a=0x0;_0x17330a<_0x4d7e3b[_0xb92b('0x53')];_0x17330a++){_0x4d7e3b[_0x17330a][_0xb92b('0x112')](_0xb92b('0xa9'),'Chat');}return _0x4d7e3b;}));_0x38e5af['push'](_0x5d3072[_0xb92b('0x115')]()[_0xb92b('0x32')](function(_0x317ca0){for(var _0x1c5416=0x0;_0x1c5416<_0x317ca0[_0xb92b('0x53')];_0x1c5416++){_0x317ca0[_0x1c5416][_0xb92b('0x112')](_0xb92b('0xa9'),_0xb92b('0x116'));}return _0x317ca0;}));_0x38e5af[_0xb92b('0x94')](_0x5d3072[_0xb92b('0x117')]()[_0xb92b('0x32')](function(_0x9af114){for(var _0x30f240=0x0;_0x30f240<_0x9af114[_0xb92b('0x53')];_0x30f240++){_0x9af114[_0x30f240][_0xb92b('0x112')](_0xb92b('0xa9'),_0xb92b('0x118'));}return _0x9af114;}));_0x38e5af[_0xb92b('0x94')](_0x5d3072[_0xb92b('0x119')]()[_0xb92b('0x32')](function(_0x2d8858){for(var _0x25675b=0x0;_0x25675b<_0x2d8858[_0xb92b('0x53')];_0x25675b++){_0x2d8858[_0x25675b][_0xb92b('0x112')](_0xb92b('0xa9'),_0xb92b('0x11a'));}return _0x2d8858;}));_0x38e5af['push'](_0x5d3072[_0xb92b('0x11b')]()[_0xb92b('0x32')](function(_0x3dbd5d){for(var _0x5b534=0x0;_0x5b534<_0x3dbd5d[_0xb92b('0x53')];_0x5b534++){_0x3dbd5d[_0x5b534][_0xb92b('0x112')](_0xb92b('0xa9'),_0xb92b('0x11c'));}return _0x3dbd5d;}));_0x38e5af[_0xb92b('0x94')](_0x5d3072['getOpenchannelQueues']()['then'](function(_0x3f4f45){for(var _0x237123=0x0;_0x237123<_0x3f4f45[_0xb92b('0x53')];_0x237123++){_0x3f4f45[_0x237123][_0xb92b('0x112')](_0xb92b('0xa9'),_0xb92b('0x11d'));}return _0x3f4f45;}));return BPromise[_0xb92b('0x95')](_0x38e5af);})[_0xb92b('0x32')](function(_0x165b65){var _0x34e827=_[_0xb92b('0x11e')](_0x165b65);_0x38e5af=[];return db['sequelize'][_0xb92b('0x11f')](function(_0x515f3a){for(var _0x58e74e=0x0;_0x58e74e<_0x34e827['length'];_0x58e74e++){_0x38e5af['push'](_0x34e827[_0x58e74e][_0xb92b('0x120')](_0x59c25a['id']),{'transaction':_0x515f3a});}return BPromise[_0xb92b('0x95')](_0x38e5af)[_0xb92b('0x32')](function(){if(_0x59c25a[_0xb92b('0xaa')]){return BPromise[_0xb92b('0xbb')](_[_0xb92b('0x3a')](_0x34e827,function(_0x1fbcaf){return _0x1fbcaf[_0xb92b('0x121')](_0xb92b('0xa9'))===_0xb92b('0x113');}),function(_0x17b3e8){return db[_0xb92b('0xbc')][_0xb92b('0xf2')]({'membername':_0x59c25a[_0xb92b('0x4b')],'UserId':_0x59c25a['id'],'queue_name':_0x17b3e8['name'],'VoiceQueueId':_0x17b3e8['id'],'interface':_[_0xb92b('0x75')](_0x59c25a[_0xb92b('0xad')])?util['format'](_0xb92b('0xba'),_0x59c25a[_0xb92b('0x4b')]):_0x59c25a[_0xb92b('0xad')],'paused':_0x59c25a['voicePause']||![],'penalty':_0x59c25a[_0xb92b('0xb3')]},{'transaction':_0x515f3a});});}else{return;}})[_0xb92b('0x32')](function(){for(var _0x38020a=0x0;_0x38020a<_0x34e827[_0xb92b('0x53')];_0x38020a++){var _0x1b511d=_0x34e827[_0x38020a][_0xb92b('0x121')](_0xb92b('0xa9'));var _0x262fd8=_0x1b511d+_0xb92b('0xb4');socket[_0xb92b('0xb5')](_0xb92b('0x35')+_0x1b511d+'Queue:save',{'UserId':_0x59c25a['id'],['queueField']:_0x34e827[_0x38020a]['id']});}});});});}});}})[_0xb92b('0x32')](respondWithStatusCode(_0x27e3f2,null))[_0xb92b('0x25')](handleError(_0x27e3f2,null));};exports[_0xb92b('0x122')]=function(_0x2d4966,_0x5599a3){return db['User'][_0xb92b('0xca')]({'where':{'id':_0x2d4966[_0xb92b('0x66')]['id']}})['then'](handleEntityNotFound(_0x5599a3,null))['then'](function(_0x394415){if(_0x394415){var _0x2b2a44=_0x394415[_0xb92b('0x33')]({'plain':!![]});var _0x4734da=_0x2d4966[_0xb92b('0x4e')][_0xb92b('0x69')];return _0x394415[_0xb92b('0x122')](_0x4734da)['then'](function(){for(var _0x26f0d7=0x0;_0x26f0d7<_0x4734da[_0xb92b('0x53')];_0x26f0d7++){var _0x405995=[];db[_0xb92b('0x110')][_0xb92b('0xca')]({'where':{'id':_0x4734da[_0x26f0d7]}})[_0xb92b('0x32')](function(_0x446d68){_0x405995[_0xb92b('0x94')](_0x446d68[_0xb92b('0xf1')]()[_0xb92b('0x32')](function(_0x1bd37f){for(var _0x16b120=0x0;_0x16b120<_0x1bd37f[_0xb92b('0x53')];_0x16b120++){_0x1bd37f[_0x16b120][_0xb92b('0x112')](_0xb92b('0xa9'),'Voice');}return _0x1bd37f;}));_0x405995[_0xb92b('0x94')](_0x446d68['getChatQueues']()[_0xb92b('0x32')](function(_0x2c11a5){for(var _0x1d1959=0x0;_0x1d1959<_0x2c11a5[_0xb92b('0x53')];_0x1d1959++){_0x2c11a5[_0x1d1959][_0xb92b('0x112')](_0xb92b('0xa9'),'Chat');}return _0x2c11a5;}));_0x405995[_0xb92b('0x94')](_0x446d68['getMailQueues']()[_0xb92b('0x32')](function(_0x13c17c){for(var _0x1475e0=0x0;_0x1475e0<_0x13c17c[_0xb92b('0x53')];_0x1475e0++){_0x13c17c[_0x1475e0][_0xb92b('0x112')](_0xb92b('0xa9'),_0xb92b('0x116'));}return _0x13c17c;}));_0x405995[_0xb92b('0x94')](_0x446d68[_0xb92b('0x117')]()[_0xb92b('0x32')](function(_0x3e349f){for(var _0x182fd1=0x0;_0x182fd1<_0x3e349f[_0xb92b('0x53')];_0x182fd1++){_0x3e349f[_0x182fd1]['setDataValue']('channel',_0xb92b('0x118'));}return _0x3e349f;}));_0x405995[_0xb92b('0x94')](_0x446d68[_0xb92b('0x119')]()[_0xb92b('0x32')](function(_0x2489c6){for(var _0x7eed64=0x0;_0x7eed64<_0x2489c6['length'];_0x7eed64++){_0x2489c6[_0x7eed64][_0xb92b('0x112')](_0xb92b('0xa9'),'Whatsapp');}return _0x2489c6;}));_0x405995['push'](_0x446d68[_0xb92b('0x11b')]()[_0xb92b('0x32')](function(_0x4b4028){for(var _0x17af70=0x0;_0x17af70<_0x4b4028[_0xb92b('0x53')];_0x17af70++){_0x4b4028[_0x17af70][_0xb92b('0x112')]('channel',_0xb92b('0x11c'));}return _0x4b4028;}));_0x405995['push'](_0x446d68[_0xb92b('0x123')]()['then'](function(_0x10748c){for(var _0x265668=0x0;_0x265668<_0x10748c[_0xb92b('0x53')];_0x265668++){_0x10748c[_0x265668][_0xb92b('0x112')](_0xb92b('0xa9'),'Openchannel');}return _0x10748c;}));return BPromise[_0xb92b('0x95')](_0x405995);})['then'](function(_0x55be60){var _0xb3d2e4=_['flatten'](_0x55be60);_0x405995=[];return db['sequelize'][_0xb92b('0x11f')](function(_0x326661){for(var _0x3fcd45=0x0;_0x3fcd45<_0xb3d2e4[_0xb92b('0x53')];_0x3fcd45++){_0x405995[_0xb92b('0x94')](_0xb3d2e4[_0x3fcd45][_0xb92b('0x124')](_0x2b2a44['id']),{'transaction':_0x326661});}return BPromise['all'](_0x405995)[_0xb92b('0x32')](function(){if(_0x2b2a44['online']){return BPromise[_0xb92b('0xbb')](_[_0xb92b('0x3a')](_0xb3d2e4,function(_0x424865){return _0x424865[_0xb92b('0x121')](_0xb92b('0xa9'))===_0xb92b('0x113');}),function(_0x1a642d){return db['UserVoiceQueueRt'][_0xb92b('0x31')]({'where':{'VoiceQueueId':_0x1a642d['id'],'UserId':_0x2b2a44['id']},'transaction':_0x326661});});}else{return;}})[_0xb92b('0x32')](function(){for(var _0x100e2f=0x0;_0x100e2f<_0xb3d2e4['length'];_0x100e2f++){var _0x3596ee=_0xb3d2e4[_0x100e2f][_0xb92b('0x121')](_0xb92b('0xa9'));var _0x2cc43c=_0x3596ee+_0xb92b('0xb4');socket[_0xb92b('0xb5')](_0xb92b('0x35')+_0x3596ee+_0xb92b('0x125'),{'UserId':_0x2b2a44['id'],['queueField']:_0xb3d2e4[_0x100e2f]['id']});}});});});}});}})[_0xb92b('0x32')](respondWithStatusCode(_0x5599a3,null))['catch'](handleError(_0x5599a3,null));};exports[_0xb92b('0x126')]=function(_0x183669,_0x580cf8,_0x2e19c2){var _0x46bc94={};var _0x1ce529={};var _0x3fb3ad;var _0xd02fd4;return db[_0xb92b('0x45')][_0xb92b('0xca')]({'where':{'id':_0x183669[_0xb92b('0x66')]['id']}})['then'](handleEntityNotFound(_0x580cf8,null))[_0xb92b('0x32')](function(_0x4aa038){if(_0x4aa038){_0x3fb3ad=_0x4aa038;_0x1ce529[_0xb92b('0x49')]=_[_0xb92b('0x4d')](db[_0xb92b('0xcc')]['rawAttributes']);_0x1ce529['query']=_['keys'](_0x183669['query']);_0x1ce529[_0xb92b('0x4f')]=_[_0xb92b('0x50')](_0x1ce529[_0xb92b('0x49')],_0x1ce529[_0xb92b('0x4e')]);_0x46bc94[_0xb92b('0x51')]=_[_0xb92b('0x50')](_0x1ce529[_0xb92b('0x49')],qs[_0xb92b('0x52')](_0x183669[_0xb92b('0x4e')][_0xb92b('0x52')]));_0x46bc94[_0xb92b('0x51')]=_0x46bc94[_0xb92b('0x51')][_0xb92b('0x53')]?_0x46bc94[_0xb92b('0x51')]:_0x1ce529['model'];_0x46bc94[_0xb92b('0x56')]=qs[_0xb92b('0x57')](_0x183669['query'][_0xb92b('0x57')]);_0x46bc94[_0xb92b('0x58')]=qs[_0xb92b('0x4f')](_['pick'](_0x183669[_0xb92b('0x4e')],_0x1ce529['filters']));if(_0x183669[_0xb92b('0x4e')]['filter']){_0x46bc94[_0xb92b('0x58')]=_[_0xb92b('0x5e')](_0x46bc94['where'],{'$or':_[_0xb92b('0x3c')](_0x46bc94[_0xb92b('0x51')],function(_0x5a0bc4){var _0x2c250b={};_0x2c250b[_0x5a0bc4]={'$like':'%'+_0x183669[_0xb92b('0x4e')][_0xb92b('0x3a')]+'%'};return _0x2c250b;})});}_0x46bc94=_[_0xb92b('0x5e')]({},_0x46bc94,_0x183669[_0xb92b('0x64')]);return _0x3fb3ad['getLists'](_0x46bc94);}})[_0xb92b('0x32')](function(_0x20f69a){if(_0x20f69a){_0xd02fd4=_0x20f69a[_0xb92b('0x53')];if(!_0x183669['query'][_0xb92b('0x54')](_0xb92b('0x55'))){_0x46bc94[_0xb92b('0x2a')]=qs['limit'](_0x183669[_0xb92b('0x4e')][_0xb92b('0x2a')]);_0x46bc94['offset']=qs[_0xb92b('0x29')](_0x183669[_0xb92b('0x4e')]['offset']);}return _0x3fb3ad[_0xb92b('0x126')](_0x46bc94);}})[_0xb92b('0x32')](function(_0x532bae){if(_0x532bae){return _0x532bae?{'count':_0xd02fd4,'rows':_0x532bae}:null;}})[_0xb92b('0x32')](respondWithResult(_0x580cf8,null))['catch'](handleError(_0x580cf8,null));};exports[_0xb92b('0x127')]=function(_0x4fd267,_0x2d2a75,_0x545182){var _0x50ea4c={};var _0x31c2c3={};var _0x3a5ef1;var _0xf17486;return db[_0xb92b('0x45')][_0xb92b('0xca')]({'where':{'id':_0x4fd267['params']['id']}})[_0xb92b('0x32')](handleEntityNotFound(_0x2d2a75,null))['then'](function(_0xa17dc){if(_0xa17dc){_0x3a5ef1=_0xa17dc;_0x31c2c3[_0xb92b('0x49')]=_[_0xb92b('0x4d')](db[_0xb92b('0x45')][_0xb92b('0x46')]);_0x31c2c3[_0xb92b('0x4e')]=_[_0xb92b('0x4d')](_0x4fd267['query']);_0x31c2c3[_0xb92b('0x4f')]=_['intersection'](_0x31c2c3[_0xb92b('0x49')],_0x31c2c3[_0xb92b('0x4e')]);_0x50ea4c[_0xb92b('0x51')]=_[_0xb92b('0x50')](_0x31c2c3[_0xb92b('0x49')],qs[_0xb92b('0x52')](_0x4fd267[_0xb92b('0x4e')][_0xb92b('0x52')]));_0x50ea4c['attributes']=_0x50ea4c[_0xb92b('0x51')]['length']?_0x50ea4c[_0xb92b('0x51')]:_0x31c2c3[_0xb92b('0x49')];_0x50ea4c['order']=qs[_0xb92b('0x57')](_0x4fd267[_0xb92b('0x4e')][_0xb92b('0x57')]);_0x50ea4c[_0xb92b('0x58')]=qs[_0xb92b('0x4f')](_[_0xb92b('0x59')](_0x4fd267['query'],_0x31c2c3[_0xb92b('0x4f')]));if(_0x4fd267['query'][_0xb92b('0x3a')]){_0x50ea4c[_0xb92b('0x58')]=_[_0xb92b('0x5e')](_0x50ea4c[_0xb92b('0x58')],{'$or':_['map'](_0x50ea4c[_0xb92b('0x51')],function(_0x110d34){var _0x41163d={};_0x41163d[_0x110d34]={'$like':'%'+_0x4fd267[_0xb92b('0x4e')][_0xb92b('0x3a')]+'%'};return _0x41163d;})});}_0x50ea4c['model']=db[_0xb92b('0x45')];_0x50ea4c['as']=_0xb92b('0x36');_0x50ea4c=_[_0xb92b('0x5e')]({},_0x50ea4c,_0x4fd267[_0xb92b('0x64')]);return _0x3a5ef1[_0xb92b('0xf1')]({'include':[_0x50ea4c]});}})['then'](function(_0x4872d0){if(_0x4872d0){var _0x24f318={},_0x7f8510=[],_0x480d00=0x0;for(var _0xa75c06=0x0;_0xa75c06<_0x4872d0[_0xb92b('0x53')];_0xa75c06+=0x1){for(var _0x517339=0x0,_0x28868d;_0x517339<_0x4872d0[_0xa75c06]['Agents'][_0xb92b('0x53')];_0x517339+=0x1){_0x28868d=_0x4872d0[_0xa75c06][_0xb92b('0x36')][_0x517339][_0xb92b('0x33')]({'plain':!![]});_0x24f318[_0x28868d['id']]=_0x28868d;}}_0x24f318=_['values'](_0x24f318);for(var _0x490c51=qs[_0xb92b('0x29')](_0x4fd267[_0xb92b('0x4e')][_0xb92b('0x29')]);_0x490c51<_0x24f318[_0xb92b('0x53')]&&_0x7f8510[_0xb92b('0x53')]=_0xcc8cab['agents']){throw new Error(_0x1f0f('0x54'));}})[_0x1f0f('0xe')](function(){if(_0x62efd){return db[_0x1f0f('0x29')][_0x1f0f('0x4a')]({'where':{'membername':_0x62efd['name']},'individualHooks':!![]});}})[_0x1f0f('0xe')](function(){if(_0x62efd){return _0x62efd[_0x1f0f('0x55')]({'raw':!![]});}})['then'](function(_0x545c7d){if(_0x62efd){if(_0x545c7d){var _0x4fa556=[];_0x5429cf=_0x545c7d;if(_0x5429cf[_0x1f0f('0x2d')]){for(var _0x200374=0x0;_0x200374<_0x5429cf['length'];_0x200374++){_0x4fa556[_0x1f0f('0x31')](db['UserVoiceQueueRt'][_0x1f0f('0x56')]({'membername':_0x62efd[_0x1f0f('0x2b')],'UserId':_0x62efd['id'],'queue_name':_0x5429cf[_0x200374][_0x1f0f('0x2b')],'VoiceQueueId':_0x5429cf[_0x200374]['id'],'interface':_0x4ec691,'paused':_0x62efd[_0x1f0f('0x4e')]||![],'penalty':_0x5429cf[_0x200374][_0x1f0f('0x57')]||0x0}));}return BPromise['all'](_0x4fa556);}}}})[_0x1f0f('0xe')](function(){if(_0x62efd){return db['MemberReport'][_0x1f0f('0x19')]({'where':{'membername':_0x62efd[_0x1f0f('0x2b')],'exitAt':null}});}})[_0x1f0f('0xe')](function(_0x5a4d1b){if(_0x62efd){if(_0x5a4d1b&&_0x5a4d1b[_0x1f0f('0x2d')]){var _0x2c2b69=[];_0x5a4d1b['forEach'](function(_0x51ed46){_0x2c2b69['push'](_0x51ed46['update']({'exitAt':moment()[_0x1f0f('0x33')](_0x1f0f('0x2e'))}));});return BPromise[_0x1f0f('0x48')](_0x2c2b69);}}})[_0x1f0f('0xe')](function(_0x254701){if(_0x62efd){var _0x32f62a=[];var _0xba0d80=[];var _0x5071e1=utils[_0x1f0f('0x58')]();var _0x4ec457={'membername':_0x62efd[_0x1f0f('0x2b')],'interface':_0x4ec691,'enterAt':moment()['format'](_0x1f0f('0x2e')),'role':_0x62efd[_0x1f0f('0x27')],'internal':_0x62efd['internal']};_0x5071e1['forEach'](function(_0x4c1381){_0x32f62a[_0x1f0f('0x31')](_[_0x1f0f('0x59')]({'channel':_0x4c1381,'type':_0x1f0f('0x5a'),'data1':'callysquare','data2':_0x4ec691},_0x4ec457));if(_0x62efd[_0x1f0f('0x4e')]){_0xba0d80[_0x1f0f('0x31')](_[_0x1f0f('0x59')]({'channel':_0x4c1381,'type':'PAUSE','data1':_0x1f0f('0x5b')},_0x4ec457));}});return db[_0x1f0f('0x2a')][_0x1f0f('0x3a')](_0x32f62a['concat'](_0xba0d80),{'individualHooks':!![]});}})['then'](function(){if(_0x62efd){return _0x62efd[_0x1f0f('0x3b')]({'online':!![],'lastLoginAt':moment()[_0x1f0f('0x33')](_0x1f0f('0x2e')),'voicePause':_0x62efd[_0x1f0f('0x4e')]||![],'mailPause':_0x62efd[_0x1f0f('0x4e')]||![],'chatPause':_0x62efd['loginInPause']||![],'faxPause':_0x62efd[_0x1f0f('0x4e')]||![],'smsPause':_0x62efd[_0x1f0f('0x4e')]||![],'openchannelPause':_0x62efd[_0x1f0f('0x4e')]||![],'pauseType':_0x62efd[_0x1f0f('0x4e')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x1f0f('0x33')](_0x1f0f('0x2e')),'interface':_0x4ec691});}})['then'](function(_0x458de2){_0x23d4d2(_0x458de2);})[_0x1f0f('0x22')](function(_0x20701c){_0x1ba427(_0x4cbd65['error'](0x1f4,_0x20701c[_0x1f0f('0x16')]));});});}; \ No newline at end of file +var _0x5360=['findAll','raw','options','where','attributes','limit','include','map','model','catch','ShowUser','find','PauseUser','User','name','role','internal','UserVoiceQueueRt','update','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','push','isNil','interface','PAUSE','body','type','DEFAULT\x20PAUSE','UnpauseUser','findOne','isValidChannel','channel','Unknown\x20channel','voice','system','mail','chat','fax','sms','openchannel','whatsapp','set','%s%s','Pause','all','LogoutUser','mobile','loginInPause','SIP/%s','count','agent','getLicense','agents','destroy','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','bulkCreate','concat','LOGININPAUSE','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','http','redis','defaults','socket.io-emitter','./user.socket','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetUser'];(function(_0x210a5e,_0x1add9f){var _0x4790e0=function(_0x34d181){while(--_0x34d181){_0x210a5e['push'](_0x210a5e['shift']());}};_0x4790e0(++_0x1add9f);}(_0x5360,0x157));var _0x0536=function(_0x596ed3,_0x106880){_0x596ed3=_0x596ed3-0x0;var _0xe2a883=_0x5360[_0x596ed3];return _0xe2a883;};'use strict';var _=require(_0x0536('0x0'));var util=require(_0x0536('0x1'));var moment=require(_0x0536('0x2'));var BPromise=require(_0x0536('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0536('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0536('0x5'))(_0x0536('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0536('0x7')]({'port':0x232a});config[_0x0536('0x8')]=_[_0x0536('0x9')](config[_0x0536('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x0536('0xa'))(new Redis(config[_0x0536('0x8')]));require(_0x0536('0xb'))['register'](socket);function respondWithRpcPromise(_0x2ae1be,_0x53d6fd,_0x4a9530){return new BPromise(function(_0x5548ba,_0x532ab9){return client[_0x0536('0xc')](_0x2ae1be,_0x4a9530)[_0x0536('0xd')](function(_0x25b060){logger[_0x0536('0xe')](_0x0536('0xf'),_0x53d6fd,_0x0536('0x10'));logger[_0x0536('0x11')](_0x0536('0x12'),_0x53d6fd,_0x0536('0x10'),JSON[_0x0536('0x13')](_0x25b060));if(_0x25b060[_0x0536('0x14')]){if(_0x25b060[_0x0536('0x14')][_0x0536('0x15')]===0x1f4){logger['error'](_0x0536('0xf'),_0x53d6fd,_0x25b060[_0x0536('0x14')][_0x0536('0x16')]);return _0x532ab9(_0x25b060[_0x0536('0x14')][_0x0536('0x16')]);}logger['error'](_0x0536('0xf'),_0x53d6fd,_0x25b060[_0x0536('0x14')][_0x0536('0x16')]);return _0x5548ba(_0x25b060[_0x0536('0x14')]['message']);}else{logger['info'](_0x0536('0xf'),_0x53d6fd,_0x0536('0x10'));_0x5548ba(_0x25b060[_0x0536('0x17')]['message']);}})['catch'](function(_0x260faa){logger[_0x0536('0x14')]('User,\x20%s,\x20%s',_0x53d6fd,_0x260faa);_0x532ab9(_0x260faa);});});}exports[_0x0536('0x18')]=function(_0xe7d2f){var _0x23a389=this;return new Promise(function(_0x43730f,_0x3e1d66){return db['User'][_0x0536('0x19')]({'raw':_0xe7d2f['options']?_0xe7d2f['options'][_0x0536('0x1a')]===undefined?!![]:![]:!![],'where':_0xe7d2f[_0x0536('0x1b')]?_0xe7d2f[_0x0536('0x1b')][_0x0536('0x1c')]||null:null,'attributes':_0xe7d2f[_0x0536('0x1b')]?_0xe7d2f[_0x0536('0x1b')][_0x0536('0x1d')]||null:null,'limit':_0xe7d2f['options']?_0xe7d2f[_0x0536('0x1b')][_0x0536('0x1e')]||null:null,'include':_0xe7d2f['options']?_0xe7d2f[_0x0536('0x1b')][_0x0536('0x1f')]?_[_0x0536('0x20')](_0xe7d2f['options'][_0x0536('0x1f')],function(_0x290701){return{'model':db[_0x290701[_0x0536('0x21')]],'as':_0x290701['as'],'attributes':_0x290701['attributes'],'include':_0x290701[_0x0536('0x1f')]?_[_0x0536('0x20')](_0x290701[_0x0536('0x1f')],function(_0x24c2ed){return{'model':db[_0x24c2ed[_0x0536('0x21')]],'as':_0x24c2ed['as'],'attributes':_0x24c2ed[_0x0536('0x1d')],'include':_0x24c2ed[_0x0536('0x1f')]?_[_0x0536('0x20')](_0x24c2ed[_0x0536('0x1f')],function(_0x2e3ab1){return{'model':db[_0x2e3ab1['model']],'as':_0x2e3ab1['as'],'attributes':_0x2e3ab1[_0x0536('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0536('0xd')](function(_0x4d8c31){logger[_0x0536('0xe')](_0x0536('0x18'),_0xe7d2f);logger[_0x0536('0x11')](_0x0536('0x18'),_0xe7d2f,JSON['stringify'](_0x4d8c31));_0x43730f(_0x4d8c31);})[_0x0536('0x22')](function(_0x562ce1){logger['error'](_0x0536('0x18'),_0x562ce1[_0x0536('0x16')],_0xe7d2f);_0x3e1d66(_0x23a389[_0x0536('0x14')](0x1f4,_0x562ce1[_0x0536('0x16')]));});});};exports[_0x0536('0x23')]=function(_0x455fdd){var _0x5830e0=this;return new Promise(function(_0x2b1fbf,_0x180b3f){return db['User'][_0x0536('0x24')]({'raw':_0x455fdd['options']?_0x455fdd[_0x0536('0x1b')][_0x0536('0x1a')]===undefined?!![]:![]:!![],'where':_0x455fdd[_0x0536('0x1b')]?_0x455fdd[_0x0536('0x1b')][_0x0536('0x1c')]||null:null,'attributes':_0x455fdd[_0x0536('0x1b')]?_0x455fdd['options'][_0x0536('0x1d')]||null:null,'include':_0x455fdd['options']?_0x455fdd['options'][_0x0536('0x1f')]?_[_0x0536('0x20')](_0x455fdd[_0x0536('0x1b')]['include'],function(_0x3eaba7){return{'model':db[_0x3eaba7[_0x0536('0x21')]],'as':_0x3eaba7['as'],'attributes':_0x3eaba7[_0x0536('0x1d')],'include':_0x3eaba7[_0x0536('0x1f')]?_[_0x0536('0x20')](_0x3eaba7['include'],function(_0x46a60c){return{'model':db[_0x46a60c[_0x0536('0x21')]],'as':_0x46a60c['as'],'attributes':_0x46a60c[_0x0536('0x1d')],'include':_0x46a60c[_0x0536('0x1f')]?_[_0x0536('0x20')](_0x46a60c['include'],function(_0xd8c560){return{'model':db[_0xd8c560['model']],'as':_0xd8c560['as'],'attributes':_0xd8c560[_0x0536('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0536('0xd')](function(_0xdda12c){logger['info'](_0x0536('0x23'),_0x455fdd);logger[_0x0536('0x11')](_0x0536('0x23'),_0x455fdd,JSON[_0x0536('0x13')](_0xdda12c));_0x2b1fbf(_0xdda12c);})['catch'](function(_0x142835){logger[_0x0536('0x14')]('ShowUser',_0x142835[_0x0536('0x16')],_0x455fdd);_0x180b3f(_0x5830e0['error'](0x1f4,_0x142835['message']));});});};exports[_0x0536('0x25')]=function(_0x17fad0){var _0x29c9df=this;return new Promise(function(_0x4c6ca5,_0x47deb4){var _0x582325;return db[_0x0536('0x26')][_0x0536('0x24')]({'where':_0x17fad0['options'][_0x0536('0x1c')]||{},'attributes':['id',_0x0536('0x27'),_0x0536('0x28'),_0x0536('0x29'),'interface']})[_0x0536('0xd')](function(_0x1b3c95){if(_0x1b3c95){_0x582325=_0x1b3c95;return db[_0x0536('0x2a')][_0x0536('0x2b')]({'paused':0x1},{'where':{'UserId':_0x582325['id']},'individualHooks':!![]});}})[_0x0536('0xd')](function(){if(_0x582325){return db[_0x0536('0x2c')][_0x0536('0x19')]({'where':{'membername':_0x582325[_0x0536('0x27')],'type':'PAUSE','exitAt':null}});}})[_0x0536('0xd')](function(_0x18f9da){if(_0x582325){if(_0x18f9da&&_0x18f9da[_0x0536('0x2d')]){var _0x4c0d88=moment()[_0x0536('0x2e')](_0x0536('0x2f'));for(var _0x41deb2=0x0,_0x251555=_0x18f9da[_0x0536('0x2d')];_0x41deb2<_0x251555;_0x41deb2++){_0x18f9da[_0x41deb2]['updateAttributes']({'exitAt':_0x4c0d88});}}}})[_0x0536('0xd')](function(){if(_0x582325){var _0x3d4b33=[];var _0x565abc=utils[_0x0536('0x30')]();_0x565abc[_0x0536('0x31')](function(_0xcdd1b6){_0x3d4b33[_0x0536('0x32')]({'channel':_0xcdd1b6,'membername':_0x582325[_0x0536('0x27')],'interface':_[_0x0536('0x33')](_0x582325[_0x0536('0x34')])?util['format']('SIP/%s',_0x582325[_0x0536('0x27')]):_0x582325[_0x0536('0x34')],'type':_0x0536('0x35'),'enterAt':moment()[_0x0536('0x2e')](_0x0536('0x2f')),'data1':_0x17fad0[_0x0536('0x36')][_0x0536('0x37')]||_0x0536('0x38'),'role':_0x582325['role'],'internal':_0x582325[_0x0536('0x29')],'uniqueid':_0x17fad0[_0x0536('0x36')]['uniqueid']||null});});return db[_0x0536('0x2c')]['bulkCreate'](_0x3d4b33,{'individualHooks':!![]});}})[_0x0536('0xd')](function(){if(_0x582325){return _0x582325[_0x0536('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x17fad0['body']['type']||_0x0536('0x38'),'lastPauseAt':moment()[_0x0536('0x2e')](_0x0536('0x2f'))});}})[_0x0536('0xd')](function(_0x284c5b){_0x4c6ca5(_0x284c5b);})[_0x0536('0x22')](function(_0x2f1608){_0x47deb4(_0x29c9df[_0x0536('0x14')](0x1f4,_0x2f1608[_0x0536('0x16')]));});});};exports[_0x0536('0x39')]=function(_0x632a91){var _0x2a801b=this;return new Promise(function(_0x530817,_0x5c31a1){var _0x2daf5a;return db[_0x0536('0x26')][_0x0536('0x3a')]({'where':_0x632a91['options'][_0x0536('0x1c')]||{},'attributes':['id',_0x0536('0x27')]})[_0x0536('0xd')](function(_0x4401d8){if(_0x4401d8){_0x2daf5a=_0x4401d8;if(_0x632a91[_0x0536('0x36')]['channel']&&!utils[_0x0536('0x3b')](_0x632a91[_0x0536('0x36')][_0x0536('0x3c')])){throw new Error(_0x0536('0x3d'));}switch(_0x632a91[_0x0536('0x36')][_0x0536('0x3c')]){case _0x0536('0x3e'):return db['UserVoiceQueueRt'][_0x0536('0x2b')]({'paused':0x0},{'where':{'UserId':_0x2daf5a['id']}})[_0x0536('0xd')](function(){return db['MemberReport']['find']({'where':{'channel':_0x632a91[_0x0536('0x36')][_0x0536('0x3c')],'membername':_0x2daf5a[_0x0536('0x27')],'type':_0x0536('0x35'),'exitAt':null}});})[_0x0536('0xd')](function(_0x5494a9){if(_0x5494a9){return _0x5494a9[_0x0536('0x2b')]({'exitAt':moment()['format'](_0x0536('0x2f')),'data2':_0x0536('0x3f')},{'individualHooks':!![]});}return null;})[_0x0536('0xd')](function(){return _0x2daf5a[_0x0536('0x2b')]({'voicePause':![]});});case _0x0536('0x40'):case _0x0536('0x41'):case _0x0536('0x42'):case _0x0536('0x43'):case _0x0536('0x44'):case _0x0536('0x45'):return db[_0x0536('0x2c')][_0x0536('0x24')]({'where':{'channel':_0x632a91[_0x0536('0x36')][_0x0536('0x3c')],'membername':_0x2daf5a['name'],'type':'PAUSE','exitAt':null}})['then'](function(_0x524553){return _0x524553[_0x0536('0x2b')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x0536('0x3f')},{'individualHooks':!![]});})[_0x0536('0xd')](function(){var _0x131589={};_[_0x0536('0x46')](_0x131589,util['format'](_0x0536('0x47'),_0x632a91[_0x0536('0x36')][_0x0536('0x3c')],_0x0536('0x48')),![]);return _0x2daf5a['update'](_0x131589);});default:return db[_0x0536('0x2a')]['update']({'paused':0x0},{'where':{'UserId':_0x2daf5a['id']}})['then'](function(){return db[_0x0536('0x2c')][_0x0536('0x19')]({'where':{'membername':_0x2daf5a[_0x0536('0x27')],'type':_0x0536('0x35'),'exitAt':null}});})[_0x0536('0xd')](function(_0x31837f){var _0x3cbb32=[];_0x31837f[_0x0536('0x31')](function(_0x291dae){_0x3cbb32['push'](_0x291dae[_0x0536('0x2b')]({'exitAt':moment()[_0x0536('0x2e')](_0x0536('0x2f')),'data2':_0x0536('0x3f')}));});return BPromise[_0x0536('0x49')](_0x3cbb32);})[_0x0536('0xd')](function(){return _0x2daf5a[_0x0536('0x2b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x0536('0xd')](function(_0x26cbf5){_0x530817(_0x26cbf5);})['catch'](function(_0x168708){_0x5c31a1(_0x2a801b[_0x0536('0x14')](0x1f4,_0x168708[_0x0536('0x16')]));});});};exports[_0x0536('0x4a')]=function(_0x245927){var _0x4000d2=this;return new Promise(function(_0x40e938,_0x5630f1){var _0x400843;return db[_0x0536('0x26')]['findOne']({'where':_0x245927[_0x0536('0x1b')][_0x0536('0x1c')]||{},'attributes':['id','name']})[_0x0536('0xd')](function(_0x2f7ae7){if(_0x2f7ae7){_0x400843=_0x2f7ae7;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x400843[_0x0536('0x27')]},'individualHooks':!![]});}})[_0x0536('0xd')](function(){if(_0x400843){return db[_0x0536('0x2c')][_0x0536('0x19')]({'where':{'membername':_0x400843['name'],'exitAt':null}});}})[_0x0536('0xd')](function(_0x2b8c0c){if(_0x400843){if(_0x2b8c0c&&_0x2b8c0c['length']){var _0x2ffe5e=[];_0x2b8c0c[_0x0536('0x31')](function(_0x21fdc6){_0x2ffe5e[_0x0536('0x32')](_0x21fdc6[_0x0536('0x2b')]({'exitAt':moment()[_0x0536('0x2e')](_0x0536('0x2f'))}));});return BPromise[_0x0536('0x49')](_0x2ffe5e);}}})[_0x0536('0xd')](function(){if(_0x400843){return _0x400843['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0xc2c734){_0x40e938(_0xc2c734);})['catch'](function(_0x21ceba){_0x5630f1(_0x4000d2[_0x0536('0x14')](0x1f4,_0x21ceba['message']));});});};exports['LoginUser']=function(_0x6de1ff){var _0xb904b6=this;return new Promise(function(_0x5aa832,_0xb109cc){var _0x2cb19f;var _0x3fe30b;var _0xdafe66;var _0x5c7117;return db[_0x0536('0x26')][_0x0536('0x3a')]({'where':_0x6de1ff[_0x0536('0x1b')]['where']||{},'attributes':['id',_0x0536('0x27'),_0x0536('0x28'),_0x0536('0x4b'),'phone',_0x0536('0x29'),_0x0536('0x4c'),_0x0536('0x34')]})[_0x0536('0xd')](function(_0x507619){if(_0x507619){_0x2cb19f=_0x507619;_0x5c7117=_0x6de1ff['body']['interface']?_0x6de1ff[_0x0536('0x36')]['interface']:util['format'](_0x0536('0x4d'),_0x2cb19f[_0x0536('0x27')]);return db['User'][_0x0536('0x4e')]({'where':{'role':_0x0536('0x4f'),'online':!![],'id':{'$ne':_0x2cb19f['id']}}});}})[_0x0536('0xd')](function(_0x201a67){if(_0x201a67){_0xdafe66=_0x201a67;return require('../../config/license/util')[_0x0536('0x50')]();}})[_0x0536('0xd')](function(_0x2db22e){if(_0x2db22e&&_0x2db22e[_0x0536('0x51')]&&_0xdafe66>=_0x2db22e[_0x0536('0x51')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x0536('0xd')](function(){if(_0x2cb19f){return db[_0x0536('0x2a')][_0x0536('0x52')]({'where':{'membername':_0x2cb19f[_0x0536('0x27')]},'individualHooks':!![]});}})[_0x0536('0xd')](function(){if(_0x2cb19f){return _0x2cb19f[_0x0536('0x53')]({'raw':!![]});}})['then'](function(_0x3c54b6){if(_0x2cb19f){if(_0x3c54b6){var _0x1ce621=[];_0x3fe30b=_0x3c54b6;if(_0x3fe30b[_0x0536('0x2d')]){for(var _0x4f028d=0x0;_0x4f028d<_0x3fe30b['length'];_0x4f028d++){_0x1ce621[_0x0536('0x32')](db[_0x0536('0x2a')][_0x0536('0x54')]({'membername':_0x2cb19f[_0x0536('0x27')],'UserId':_0x2cb19f['id'],'queue_name':_0x3fe30b[_0x4f028d][_0x0536('0x27')],'VoiceQueueId':_0x3fe30b[_0x4f028d]['id'],'interface':_0x5c7117,'paused':_0x2cb19f[_0x0536('0x4c')]||![],'penalty':_0x3fe30b[_0x4f028d][_0x0536('0x55')]||0x0}));}return BPromise[_0x0536('0x49')](_0x1ce621);}}}})[_0x0536('0xd')](function(){if(_0x2cb19f){return db[_0x0536('0x2c')][_0x0536('0x19')]({'where':{'membername':_0x2cb19f[_0x0536('0x27')],'exitAt':null}});}})[_0x0536('0xd')](function(_0x14c532){if(_0x2cb19f){if(_0x14c532&&_0x14c532['length']){var _0x1a136f=[];_0x14c532[_0x0536('0x31')](function(_0x21003b){_0x1a136f[_0x0536('0x32')](_0x21003b[_0x0536('0x2b')]({'exitAt':moment()['format'](_0x0536('0x2f'))}));});return BPromise['all'](_0x1a136f);}}})[_0x0536('0xd')](function(_0x215811){if(_0x2cb19f){var _0xe638c8=[];var _0x2f9dc9=[];var _0x436023=utils[_0x0536('0x30')]();var _0x2c9fb0={'membername':_0x2cb19f[_0x0536('0x27')],'interface':_0x5c7117,'enterAt':moment()[_0x0536('0x2e')](_0x0536('0x2f')),'role':_0x2cb19f['role'],'internal':_0x2cb19f[_0x0536('0x29')]};_0x436023['forEach'](function(_0x4525c3){_0xe638c8[_0x0536('0x32')](_[_0x0536('0x56')]({'channel':_0x4525c3,'type':_0x0536('0x57'),'data1':_0x0536('0x58'),'data2':_0x5c7117},_0x2c9fb0));if(_0x2cb19f[_0x0536('0x4c')]){_0x2f9dc9[_0x0536('0x32')](_[_0x0536('0x56')]({'channel':_0x4525c3,'type':_0x0536('0x35'),'data1':'LOGININPAUSE'},_0x2c9fb0));}});return db[_0x0536('0x2c')][_0x0536('0x59')](_0xe638c8[_0x0536('0x5a')](_0x2f9dc9),{'individualHooks':!![]});}})['then'](function(){if(_0x2cb19f){return _0x2cb19f[_0x0536('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x0536('0x2e')](_0x0536('0x2f')),'voicePause':_0x2cb19f[_0x0536('0x4c')]||![],'mailPause':_0x2cb19f[_0x0536('0x4c')]||![],'chatPause':_0x2cb19f[_0x0536('0x4c')]||![],'faxPause':_0x2cb19f['loginInPause']||![],'smsPause':_0x2cb19f[_0x0536('0x4c')]||![],'openchannelPause':_0x2cb19f[_0x0536('0x4c')]||![],'pauseType':_0x2cb19f['loginInPause']?_0x0536('0x5b'):null,'lastPauseAt':moment()[_0x0536('0x2e')](_0x0536('0x2f')),'interface':_0x5c7117});}})['then'](function(_0x160aed){_0x5aa832(_0x160aed);})[_0x0536('0x22')](function(_0x18d427){_0xb109cc(_0xb904b6[_0x0536('0x14')](0x1f4,_0x18d427[_0x0536('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index c36619e..3de5928 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 _0x94e1=['save','remove','emit','register','length','user:','./user.events'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x94e1,0x18e));var _0x194e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x94e1[_0x122ef9];return _0x42fba0;};'use strict';var UserEvents=require(_0x194e('0x0'));var events=[_0x194e('0x1'),_0x194e('0x2'),'update'];function createListener(_0x1a542d,_0x221226){return function(_0x119aa9){_0x221226[_0x194e('0x3')](_0x1a542d,_0x119aa9);};}function removeListener(_0x473eb8,_0x4c7f48){return function(){UserEvents['removeListener'](_0x473eb8,_0x4c7f48);};}exports[_0x194e('0x4')]=function(_0x55b277){for(var _0x2e4028=0x0,_0xc770e8=events[_0x194e('0x5')];_0x2e4028<_0xc770e8;_0x2e4028++){var _0x4f926=events[_0x2e4028];var _0x2b4563=createListener(_0x194e('0x6')+_0x4f926,_0x55b277);UserEvents['on'](_0x4f926,_0x2b4563);}}; \ No newline at end of file +var _0x3ddc=['./user.events','save','remove','register','user:'];(function(_0x2390bd,_0x212fbd){var _0x3a969d=function(_0x3dd049){while(--_0x3dd049){_0x2390bd['push'](_0x2390bd['shift']());}};_0x3a969d(++_0x212fbd);}(_0x3ddc,0x1a4));var _0xc3dd=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x3ddc[_0x3e5086];return _0xfeb102;};'use strict';var UserEvents=require(_0xc3dd('0x0'));var events=[_0xc3dd('0x1'),_0xc3dd('0x2'),'update'];function createListener(_0x46856d,_0x360d97){return function(_0x3c8ed1){_0x360d97['emit'](_0x46856d,_0x3c8ed1);};}function removeListener(_0x433db9,_0x438735){return function(){UserEvents['removeListener'](_0x433db9,_0x438735);};}exports[_0xc3dd('0x3')]=function(_0x3c547){for(var _0x1eb59a=0x0,_0x121836=events['length'];_0x1eb59a<_0x121836;_0x1eb59a++){var _0x4ee3f5=events[_0x1eb59a];var _0x14fab4=createListener(_0xc3dd('0x4')+_0x4ee3f5,_0x3c547);UserEvents['on'](_0x4ee3f5,_0x14fab4);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index e91da06..c41a132 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 _0x7e35=['../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout','express'];(function(_0x40c23c,_0x1adc11){var _0x3a1919=function(_0x1e488d){while(--_0x1e488d){_0x40c23c['push'](_0x40c23c['shift']());}};_0x3a1919(++_0x1adc11);}(_0x7e35,0x1eb));var _0x57e3=function(_0x41e37e,_0x5a9e55){_0x41e37e=_0x41e37e-0x0;var _0x37bf85=_0x7e35[_0x41e37e];return _0x37bf85;};'use strict';var multer=require(_0x57e3('0x0'));var util=require(_0x57e3('0x1'));var path=require(_0x57e3('0x2'));var timeout=require(_0x57e3('0x3'));var express=require(_0x57e3('0x4'));var router=express['Router']();var auth=require(_0x57e3('0x5'));var interaction=require(_0x57e3('0x6'));var config=require(_0x57e3('0x7'));module['exports']=router; \ No newline at end of file +var _0xfbbf=['exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2993c1,_0x37681f){var _0x41c9cf=function(_0x2fd5f1){while(--_0x2fd5f1){_0x2993c1['push'](_0x2993c1['shift']());}};_0x41c9cf(++_0x37681f);}(_0xfbbf,0xc9));var _0xffbb=function(_0x3cde24,_0xe5ea61){_0x3cde24=_0x3cde24-0x0;var _0x6db8fd=_0xfbbf[_0x3cde24];return _0x6db8fd;};'use strict';var multer=require('multer');var util=require(_0xffbb('0x0'));var path=require('path');var timeout=require(_0xffbb('0x1'));var express=require(_0xffbb('0x2'));var router=express[_0xffbb('0x3')]();var auth=require(_0xffbb('0x4'));var interaction=require(_0xffbb('0x5'));var config=require(_0xffbb('0x6'));module[_0xffbb('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index a736b63..94869d9 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x205706,_0x3a4bce){var _0x5b7098=function(_0x50d891){while(--_0x50d891){_0x205706['push'](_0x205706['shift']());}};_0x5b7098(++_0x3a4bce);}(_0xe706,0xa3));var _0x6e70=function(_0x1c2051,_0x4cb6b9){_0x1c2051=_0x1c2051-0x0;var _0x2b58a0=_0xe706[_0x1c2051];return _0x2b58a0;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x3a4676,_0x2272df){var _0x453dec=function(_0x315e24){while(--_0x315e24){_0x3a4676['push'](_0x3a4676['shift']());}};_0x453dec(++_0x2272df);}(_0xe706,0xa3));var _0x6e70=function(_0x39b51c,_0x40010d){_0x39b51c=_0x39b51c-0x0;var _0x146312=_0xe706[_0x39b51c];return _0x146312;};'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/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 9c757de..394fc6e 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 _0xa13a=['moment','bluebird','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','user_has_chat_queues','lodash','api'];(function(_0x28ebd7,_0x15f6ff){var _0x3edaba=function(_0x2f13a9){while(--_0x2f13a9){_0x28ebd7['push'](_0x28ebd7['shift']());}};_0x3edaba(++_0x15f6ff);}(_0xa13a,0xae));var _0xaa13=function(_0x16d394,_0x4560eb){_0x16d394=_0x16d394-0x0;var _0x3ffb6f=_0xa13a[_0x16d394];return _0x3ffb6f;};'use strict';var _=require(_0xaa13('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaa13('0x1'));var moment=require(_0xaa13('0x2'));var BPromise=require(_0xaa13('0x3'));var rp=require(_0xaa13('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa13('0x5'));var config=require(_0xaa13('0x6'));var attributes=require(_0xaa13('0x7'));module[_0xaa13('0x8')]=function(_0x2d3581,_0x3a7fd3){return _0x2d3581[_0xaa13('0x9')]('UserChatQueue',attributes,{'tableName':_0xaa13('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeaba=['../../config/environment','./userChatQueue.attributes','exports','define','user_has_chat_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3b1abf,_0x505d76){var _0x56dfab=function(_0xf39419){while(--_0xf39419){_0x3b1abf['push'](_0x3b1abf['shift']());}};_0x56dfab(++_0x505d76);}(_0xeaba,0x87));var _0xaeab=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xeaba[_0x24f31b];return _0x488401;};'use strict';var _=require('lodash');var util=require(_0xaeab('0x0'));var logger=require(_0xaeab('0x1'))(_0xaeab('0x2'));var moment=require(_0xaeab('0x3'));var BPromise=require(_0xaeab('0x4'));var rp=require(_0xaeab('0x5'));var fs=require('fs');var path=require(_0xaeab('0x6'));var rimraf=require(_0xaeab('0x7'));var config=require(_0xaeab('0x8'));var attributes=require(_0xaeab('0x9'));module[_0xaeab('0xa')]=function(_0x6d3bf3,_0x57b687){return _0x6d3bf3[_0xaeab('0xb')]('UserChatQueue',attributes,{'tableName':_0xaeab('0xc'),'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 fed5094..cb344ce 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 _0xe9d1=['message','result','lodash','moment','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','then','info','UserChatQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x357f74,_0x102954){var _0x25de63=function(_0x2ee8ff){while(--_0x2ee8ff){_0x357f74['push'](_0x357f74['shift']());}};_0x25de63(++_0x102954);}(_0xe9d1,0x92));var _0x1e9d=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0xe9d1[_0x10f68e];return _0x4c8372;};'use strict';var _=require(_0x1e9d('0x0'));var util=require('util');var moment=require(_0x1e9d('0x1'));var BPromise=require('bluebird');var rs=require(_0x1e9d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1e9d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1e9d('0x4'));var jayson=require(_0x1e9d('0x5'));var client=jayson[_0x1e9d('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x490fcf,_0x42b931,_0x47dca6){return new BPromise(function(_0x3e0b20,_0x5c2db8){return client['request'](_0x490fcf,_0x47dca6)[_0x1e9d('0x7')](function(_0x52eeed){logger[_0x1e9d('0x8')](_0x1e9d('0x9'),_0x42b931,'request\x20sent');logger[_0x1e9d('0xa')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x42b931,_0x1e9d('0xb'),JSON[_0x1e9d('0xc')](_0x52eeed));if(_0x52eeed[_0x1e9d('0xd')]){if(_0x52eeed['error']['code']===0x1f4){logger['error'](_0x1e9d('0x9'),_0x42b931,_0x52eeed[_0x1e9d('0xd')][_0x1e9d('0xe')]);return _0x5c2db8(_0x52eeed[_0x1e9d('0xd')]['message']);}logger[_0x1e9d('0xd')](_0x1e9d('0x9'),_0x42b931,_0x52eeed['error'][_0x1e9d('0xe')]);return _0x3e0b20(_0x52eeed[_0x1e9d('0xd')][_0x1e9d('0xe')]);}else{logger['info'](_0x1e9d('0x9'),_0x42b931,_0x1e9d('0xb'));_0x3e0b20(_0x52eeed[_0x1e9d('0xf')][_0x1e9d('0xe')]);}})['catch'](function(_0x508c08){logger[_0x1e9d('0xd')](_0x1e9d('0x9'),_0x42b931,_0x508c08);_0x5c2db8(_0x508c08);});});} \ No newline at end of file +var _0xe7b5=['../../config/utils','rpc','client','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x4d1a4b,_0x157bd9){var _0x384cbe=function(_0x1f4e8f){while(--_0x1f4e8f){_0x4d1a4b['push'](_0x4d1a4b['shift']());}};_0x384cbe(++_0x157bd9);}(_0xe7b5,0x176));var _0x5e7b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xe7b5[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x5e7b('0x0'));var util=require(_0x5e7b('0x1'));var moment=require(_0x5e7b('0x2'));var BPromise=require(_0x5e7b('0x3'));var rs=require(_0x5e7b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e7b('0x5'))['db'];var utils=require(_0x5e7b('0x6'));var logger=require('../../config/logger')(_0x5e7b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5e7b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d7fcb,_0x1cc7b3,_0x4a0fda){return new BPromise(function(_0x36793d,_0x2a925f){return client['request'](_0x4d7fcb,_0x4a0fda)[_0x5e7b('0x9')](function(_0x4aa07e){logger[_0x5e7b('0xa')](_0x5e7b('0xb'),_0x1cc7b3,_0x5e7b('0xc'));logger[_0x5e7b('0xd')](_0x5e7b('0xe'),_0x1cc7b3,_0x5e7b('0xc'),JSON[_0x5e7b('0xf')](_0x4aa07e));if(_0x4aa07e[_0x5e7b('0x10')]){if(_0x4aa07e[_0x5e7b('0x10')][_0x5e7b('0x11')]===0x1f4){logger[_0x5e7b('0x10')](_0x5e7b('0xb'),_0x1cc7b3,_0x4aa07e[_0x5e7b('0x10')][_0x5e7b('0x12')]);return _0x2a925f(_0x4aa07e[_0x5e7b('0x10')][_0x5e7b('0x12')]);}logger[_0x5e7b('0x10')](_0x5e7b('0xb'),_0x1cc7b3,_0x4aa07e['error'][_0x5e7b('0x12')]);return _0x36793d(_0x4aa07e[_0x5e7b('0x10')][_0x5e7b('0x12')]);}else{logger['info'](_0x5e7b('0xb'),_0x1cc7b3,_0x5e7b('0xc'));_0x36793d(_0x4aa07e['result']['message']);}})[_0x5e7b('0x13')](function(_0xcffb83){logger['error'](_0x5e7b('0xb'),_0x1cc7b3,_0xcffb83);_0x2a925f(_0xcffb83);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 0b5613b..c6920bf 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 _0x01d1=['../../components/auth/service','../../config/environment','exports','path','connect-timeout','express','Router'];(function(_0x5ba1f0,_0x346480){var _0x3474d2=function(_0x27570c){while(--_0x27570c){_0x5ba1f0['push'](_0x5ba1f0['shift']());}};_0x3474d2(++_0x346480);}(_0x01d1,0x176));var _0x101d=function(_0x32e2f3,_0x5c9fe7){_0x32e2f3=_0x32e2f3-0x0;var _0xcc7735=_0x01d1[_0x32e2f3];return _0xcc7735;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x101d('0x0'));var timeout=require(_0x101d('0x1'));var express=require(_0x101d('0x2'));var router=express[_0x101d('0x3')]();var auth=require(_0x101d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x101d('0x5'));module[_0x101d('0x6')]=router; \ No newline at end of file +var _0xa2a6=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2a6,0x100));var _0x6a2a=function(_0x4c99f0,_0x56bf85){_0x4c99f0=_0x4c99f0-0x0;var _0x5c4c34=_0xa2a6[_0x4c99f0];return _0x5c4c34;};'use strict';var multer=require('multer');var util=require(_0x6a2a('0x0'));var path=require(_0x6a2a('0x1'));var timeout=require('connect-timeout');var express=require(_0x6a2a('0x2'));var router=express[_0x6a2a('0x3')]();var auth=require(_0x6a2a('0x4'));var interaction=require(_0x6a2a('0x5'));var config=require(_0x6a2a('0x6'));module[_0x6a2a('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 dcc86ee..93d8f81 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 _0xdd4f=['sequelize','STRING'];(function(_0x3b9ce0,_0xff81a){var _0x33c8fc=function(_0x287e4a){while(--_0x287e4a){_0x3b9ce0['push'](_0x3b9ce0['shift']());}};_0x33c8fc(++_0xff81a);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0xf3aebe,_0x35d680){_0xf3aebe=_0xf3aebe-0x0;var _0xcf6fd6=_0xdd4f[_0xf3aebe];return _0xcf6fd6;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xfdd4('0x1')]}}; \ No newline at end of file +var _0x8e3f=['STRING','sequelize','exports','INTEGER'];(function(_0x1e32c2,_0x304335){var _0x15d709=function(_0x131542){while(--_0x131542){_0x1e32c2['push'](_0x1e32c2['shift']());}};_0x15d709(++_0x304335);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x8e3f[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xf8e3('0x0'));module[_0xf8e3('0x1')]={'penalty':{'type':Sequelize[_0xf8e3('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xf8e3('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 9d13a36..c777af1 100644 --- a/server/api/userFaxQueue/userFaxQueue.model.js +++ b/server/api/userFaxQueue/userFaxQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ca3=['user_has_fax_queues','util','api','bluebird','path','rimraf','../../config/environment','./userFaxQueue.attributes','UserFaxQueue'];(function(_0xf4dfca,_0x406935){var _0x3e0cb9=function(_0x585a60){while(--_0x585a60){_0xf4dfca['push'](_0xf4dfca['shift']());}};_0x3e0cb9(++_0x406935);}(_0x1ca3,0x1ba));var _0x31ca=function(_0x4927fb,_0x3636d1){_0x4927fb=_0x4927fb-0x0;var _0x2224d9=_0x1ca3[_0x4927fb];return _0x2224d9;};'use strict';var _=require('lodash');var util=require(_0x31ca('0x0'));var logger=require('../../config/logger')(_0x31ca('0x1'));var moment=require('moment');var BPromise=require(_0x31ca('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31ca('0x3'));var rimraf=require(_0x31ca('0x4'));var config=require(_0x31ca('0x5'));var attributes=require(_0x31ca('0x6'));module['exports']=function(_0x33e149,_0xa2a9de){return _0x33e149['define'](_0x31ca('0x7'),attributes,{'tableName':_0x31ca('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74ba=['UserFaxQueue','user_has_fax_queues','lodash','api','request-promise','path','rimraf','./userFaxQueue.attributes','exports','define'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x74ba,0x174));var _0xa74b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x74ba[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa74b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa74b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa74b('0x2'));var fs=require('fs');var path=require(_0xa74b('0x3'));var rimraf=require(_0xa74b('0x4'));var config=require('../../config/environment');var attributes=require(_0xa74b('0x5'));module[_0xa74b('0x6')]=function(_0x594e0e,_0x39ef56){return _0x594e0e[_0xa74b('0x7')](_0xa74b('0x8'),attributes,{'tableName':_0xa74b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 5571411..057429e 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 _0xaefa=['request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3c3f05,_0x237b97){var _0x36a25c=function(_0x239375){while(--_0x239375){_0x3c3f05['push'](_0x3c3f05['shift']());}};_0x36a25c(++_0x237b97);}(_0xaefa,0xf2));var _0xaaef=function(_0x141970,_0x1eda33){_0x141970=_0x141970-0x0;var _0x5bb09e=_0xaefa[_0x141970];return _0x5bb09e;};'use strict';var _=require(_0xaaef('0x0'));var util=require(_0xaaef('0x1'));var moment=require(_0xaaef('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaaef('0x3'));var db=require(_0xaaef('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaaef('0x5'))(_0xaaef('0x6'));var config=require(_0xaaef('0x7'));var jayson=require(_0xaaef('0x8'));var client=jayson['client'][_0xaaef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28db0c,_0x16d084,_0x323457){return new BPromise(function(_0x2eb8d8,_0x20355c){return client[_0xaaef('0xa')](_0x28db0c,_0x323457)[_0xaaef('0xb')](function(_0x1eb729){logger[_0xaaef('0xc')](_0xaaef('0xd'),_0x16d084,_0xaaef('0xe'));logger[_0xaaef('0xf')](_0xaaef('0x10'),_0x16d084,_0xaaef('0xe'),JSON[_0xaaef('0x11')](_0x1eb729));if(_0x1eb729[_0xaaef('0x12')]){if(_0x1eb729['error']['code']===0x1f4){logger[_0xaaef('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x16d084,_0x1eb729[_0xaaef('0x12')][_0xaaef('0x13')]);return _0x20355c(_0x1eb729[_0xaaef('0x12')]['message']);}logger['error'](_0xaaef('0xd'),_0x16d084,_0x1eb729[_0xaaef('0x12')][_0xaaef('0x13')]);return _0x2eb8d8(_0x1eb729['error'][_0xaaef('0x13')]);}else{logger[_0xaaef('0xc')](_0xaaef('0xd'),_0x16d084,_0xaaef('0xe'));_0x2eb8d8(_0x1eb729['result'][_0xaaef('0x13')]);}})[_0xaaef('0x14')](function(_0xe34bc1){logger[_0xaaef('0x12')](_0xaaef('0xd'),_0x16d084,_0xe34bc1);_0x20355c(_0xe34bc1);});});} \ No newline at end of file +var _0x62cf=['message','result','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x62cf,0x81));var _0xf62c=function(_0x22f8e3,_0x4508c4){_0x22f8e3=_0x22f8e3-0x0;var _0x322b14=_0x62cf[_0x22f8e3];return _0x322b14;};'use strict';var _=require(_0xf62c('0x0'));var util=require('util');var moment=require(_0xf62c('0x1'));var BPromise=require('bluebird');var rs=require(_0xf62c('0x2'));var fs=require('fs');var Redis=require(_0xf62c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf62c('0x4'))(_0xf62c('0x5'));var config=require(_0xf62c('0x6'));var jayson=require(_0xf62c('0x7'));var client=jayson[_0xf62c('0x8')][_0xf62c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45749c,_0x314609,_0x372f7b){return new BPromise(function(_0x54389e,_0x181f87){return client['request'](_0x45749c,_0x372f7b)[_0xf62c('0xa')](function(_0x8038ed){logger[_0xf62c('0xb')](_0xf62c('0xc'),_0x314609,_0xf62c('0xd'));logger[_0xf62c('0xe')](_0xf62c('0xf'),_0x314609,_0xf62c('0xd'),JSON[_0xf62c('0x10')](_0x8038ed));if(_0x8038ed[_0xf62c('0x11')]){if(_0x8038ed[_0xf62c('0x11')]['code']===0x1f4){logger[_0xf62c('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x314609,_0x8038ed['error'][_0xf62c('0x12')]);return _0x181f87(_0x8038ed[_0xf62c('0x11')]['message']);}logger[_0xf62c('0x11')](_0xf62c('0xc'),_0x314609,_0x8038ed['error'][_0xf62c('0x12')]);return _0x54389e(_0x8038ed['error'][_0xf62c('0x12')]);}else{logger[_0xf62c('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x314609,_0xf62c('0xd'));_0x54389e(_0x8038ed[_0xf62c('0x13')]['message']);}})[_0xf62c('0x14')](function(_0x14b26e){logger[_0xf62c('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x314609,_0x14b26e);_0x181f87(_0x14b26e);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index fc999a6..9902d5b 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 _0xc048=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1e1fb0,_0x57757c){var _0x41a435=function(_0x1babcc){while(--_0x1babcc){_0x1e1fb0['push'](_0x1e1fb0['shift']());}};_0x41a435(++_0x57757c);}(_0xc048,0x70));var _0x8c04=function(_0x4717ae,_0x3d4210){_0x4717ae=_0x4717ae-0x0;var _0x59e81c=_0xc048[_0x4717ae];return _0x59e81c;};'use strict';var multer=require(_0x8c04('0x0'));var util=require(_0x8c04('0x1'));var path=require('path');var timeout=require(_0x8c04('0x2'));var express=require(_0x8c04('0x3'));var router=express[_0x8c04('0x4')]();var auth=require(_0x8c04('0x5'));var interaction=require(_0x8c04('0x6'));var config=require('../../config/environment');module[_0x8c04('0x7')]=router; \ No newline at end of file +var _0x5019=['express','../../components/auth/service','../../config/environment','util','path','connect-timeout'];(function(_0x1d3722,_0x3158aa){var _0x1492de=function(_0x4b7c4b){while(--_0x4b7c4b){_0x1d3722['push'](_0x1d3722['shift']());}};_0x1492de(++_0x3158aa);}(_0x5019,0x183));var _0x9501=function(_0x21e037,_0x1782ad){_0x21e037=_0x21e037-0x0;var _0x4b3220=_0x5019[_0x21e037];return _0x4b3220;};'use strict';var multer=require('multer');var util=require(_0x9501('0x0'));var path=require(_0x9501('0x1'));var timeout=require(_0x9501('0x2'));var express=require(_0x9501('0x3'));var router=express['Router']();var auth=require(_0x9501('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9501('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 909dcd3..59b5d60 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x5e06af,_0x4cfd75){var _0x31c5c0=function(_0x4becd3){while(--_0x4becd3){_0x5e06af['push'](_0x5e06af['shift']());}};_0x31c5c0(++_0x4cfd75);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x5161fc,_0x37c5f6){var _0x38490b=function(_0x49ebd8){while(--_0x49ebd8){_0x5161fc['push'](_0x5161fc['shift']());}};_0x38490b(++_0x37c5f6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 9c68254..594fa7e 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util'];(function(_0x3c76c3,_0x4e0a3c){var _0x46c23d=function(_0x10c750){while(--_0x10c750){_0x3c76c3['push'](_0x3c76c3['shift']());}};_0x46c23d(++_0x4e0a3c);}(_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 logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','user_has_mail_queues','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x44c209,_0x50cac3){var _0x43df16=function(_0x4c7ea5){while(--_0x4c7ea5){_0x44c209['push'](_0x44c209['shift']());}};_0x43df16(++_0x50cac3);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('UserMailQueue',attributes,{'tableName':_0x0d8b('0x8'),'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 d958d37..5250f1c 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 _0x2178=['client','http','then','info','request\x20sent','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4f0536,_0x3c0b2d){var _0x528017=function(_0x1418c0){while(--_0x1418c0){_0x4f0536['push'](_0x4f0536['shift']());}};_0x528017(++_0x3c0b2d);}(_0x2178,0x1b0));var _0x8217=function(_0x154f66,_0x116f85){_0x154f66=_0x154f66-0x0;var _0x3f947a=_0x2178[_0x154f66];return _0x3f947a;};'use strict';var _=require(_0x8217('0x0'));var util=require('util');var moment=require(_0x8217('0x1'));var BPromise=require(_0x8217('0x2'));var rs=require(_0x8217('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8217('0x4'))['db'];var utils=require(_0x8217('0x5'));var logger=require('../../config/logger')(_0x8217('0x6'));var config=require(_0x8217('0x7'));var jayson=require(_0x8217('0x8'));var client=jayson[_0x8217('0x9')][_0x8217('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6938ca,_0x1100c8,_0x1cddd1){return new BPromise(function(_0x67d6b2,_0x5d1987){return client['request'](_0x6938ca,_0x1cddd1)[_0x8217('0xb')](function(_0x26e802){logger[_0x8217('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x1100c8,_0x8217('0xd'));logger['debug']('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x1100c8,_0x8217('0xd'),JSON[_0x8217('0xe')](_0x26e802));if(_0x26e802[_0x8217('0xf')]){if(_0x26e802[_0x8217('0xf')][_0x8217('0x10')]===0x1f4){logger[_0x8217('0xf')](_0x8217('0x11'),_0x1100c8,_0x26e802['error']['message']);return _0x5d1987(_0x26e802['error'][_0x8217('0x12')]);}logger[_0x8217('0xf')](_0x8217('0x11'),_0x1100c8,_0x26e802[_0x8217('0xf')]['message']);return _0x67d6b2(_0x26e802[_0x8217('0xf')][_0x8217('0x12')]);}else{logger[_0x8217('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x1100c8,_0x8217('0xd'));_0x67d6b2(_0x26e802[_0x8217('0x13')][_0x8217('0x12')]);}})[_0x8217('0x14')](function(_0xe4d1ea){logger[_0x8217('0xf')](_0x8217('0x11'),_0x1100c8,_0xe4d1ea);_0x5d1987(_0xe4d1ea);});});} \ No newline at end of file +var _0x5a93=['debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x554a2d,_0x1d2b32){var _0x38358b=function(_0x59a082){while(--_0x59a082){_0x554a2d['push'](_0x554a2d['shift']());}};_0x38358b(++_0x1d2b32);}(_0x5a93,0xf6));var _0x35a9=function(_0x2f76f0,_0x40d23a){_0x2f76f0=_0x2f76f0-0x0;var _0x1bc68a=_0x5a93[_0x2f76f0];return _0x1bc68a;};'use strict';var _=require('lodash');var util=require(_0x35a9('0x0'));var moment=require('moment');var BPromise=require(_0x35a9('0x1'));var rs=require(_0x35a9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x35a9('0x3'));var logger=require(_0x35a9('0x4'))(_0x35a9('0x5'));var config=require('../../config/environment');var jayson=require(_0x35a9('0x6'));var client=jayson[_0x35a9('0x7')][_0x35a9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x354490,_0x271228,_0x45e6f7){return new BPromise(function(_0x71d143,_0x22d770){return client[_0x35a9('0x9')](_0x354490,_0x45e6f7)[_0x35a9('0xa')](function(_0x5b4f25){logger[_0x35a9('0xb')](_0x35a9('0xc'),_0x271228,_0x35a9('0xd'));logger[_0x35a9('0xe')](_0x35a9('0xf'),_0x271228,_0x35a9('0xd'),JSON['stringify'](_0x5b4f25));if(_0x5b4f25[_0x35a9('0x10')]){if(_0x5b4f25[_0x35a9('0x10')][_0x35a9('0x11')]===0x1f4){logger[_0x35a9('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x271228,_0x5b4f25[_0x35a9('0x10')][_0x35a9('0x12')]);return _0x22d770(_0x5b4f25[_0x35a9('0x10')][_0x35a9('0x12')]);}logger['error'](_0x35a9('0xc'),_0x271228,_0x5b4f25[_0x35a9('0x10')][_0x35a9('0x12')]);return _0x71d143(_0x5b4f25[_0x35a9('0x10')]['message']);}else{logger[_0x35a9('0xb')](_0x35a9('0xc'),_0x271228,_0x35a9('0xd'));_0x71d143(_0x5b4f25['result'][_0x35a9('0x12')]);}})[_0x35a9('0x13')](function(_0x14eeb5){logger[_0x35a9('0x10')](_0x35a9('0xc'),_0x271228,_0x14eeb5);_0x22d770(_0x14eeb5);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 26d3b13..3750f8b 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 _0xcad3=['multer','util','express','Router','../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated','exports'];(function(_0x37897a,_0x1a355a){var _0x2701fb=function(_0x545c7e){while(--_0x545c7e){_0x37897a['push'](_0x37897a['shift']());}};_0x2701fb(++_0x1a355a);}(_0xcad3,0x87));var _0x3cad=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xcad3[_0x1a72f3];return _0x57ef47;};'use strict';var multer=require(_0x3cad('0x0'));var util=require(_0x3cad('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3cad('0x2'));var router=express[_0x3cad('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3cad('0x4'));var config=require(_0x3cad('0x5'));var controller=require(_0x3cad('0x6'));router['post']('/',auth[_0x3cad('0x7')](),controller['sendUserNotification']);module[_0x3cad('0x8')]=router; \ No newline at end of file +var _0x86cd=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post','isAuthenticated','sendUserNotification'];(function(_0x474fad,_0x524fee){var _0x13e7fd=function(_0x2fba5b){while(--_0x2fba5b){_0x474fad['push'](_0x474fad['shift']());}};_0x13e7fd(++_0x524fee);}(_0x86cd,0x6e));var _0xd86c=function(_0x350182,_0x2a9feb){_0x350182=_0x350182-0x0;var _0x4a0892=_0x86cd[_0x350182];return _0x4a0892;};'use strict';var multer=require(_0xd86c('0x0'));var util=require('util');var path=require(_0xd86c('0x1'));var timeout=require('connect-timeout');var express=require(_0xd86c('0x2'));var router=express[_0xd86c('0x3')]();var auth=require(_0xd86c('0x4'));var interaction=require(_0xd86c('0x5'));var config=require('../../config/environment');var controller=require(_0xd86c('0x6'));router[_0xd86c('0x7')]('/',auth[_0xd86c('0x8')](),controller[_0xd86c('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 7b649f6..8b9ff69 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 _0xac2f=['BOOLEAN','sequelize','exports','STRING'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xac2f,0x131));var _0xfac2=function(_0x47b7d2,_0x519b05){_0x47b7d2=_0x47b7d2-0x0;var _0x52e71f=_0xac2f[_0x47b7d2];return _0x52e71f;};'use strict';var Sequelize=require(_0xfac2('0x0'));module[_0xfac2('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xfac2('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xfac2('0x2')]},'beep':{'type':Sequelize[_0xfac2('0x3')]}}; \ No newline at end of file +var _0x33b2=['exports','TEXT','BOOLEAN','sequelize'];(function(_0x2823fa,_0xd94439){var _0x2ca446=function(_0x430f92){while(--_0x430f92){_0x2823fa['push'](_0x2823fa['shift']());}};_0x2ca446(++_0xd94439);}(_0x33b2,0x133));var _0x233b=function(_0x4d112b,_0x5ce092){_0x4d112b=_0x4d112b-0x0;var _0x1500ed=_0x33b2[_0x4d112b];return _0x1500ed;};'use strict';var Sequelize=require(_0x233b('0x0'));module[_0x233b('0x1')]={'body':{'type':Sequelize[_0x233b('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x233b('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x233b('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index f5817f9..697337a 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 _0x22a9=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','sendStatus','end','status','json','count','offset','set','Content-Range','reject','save','then','destroy','error','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','view','startCase','User','union','ids','includes','queue','replace','Queue','push','flatten','getAgents','map','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'];(function(_0x56be39,_0x456f9e){var _0x338a89=function(_0x2c6b6a){while(--_0x2c6b6a){_0x56be39['push'](_0x56be39['shift']());}};_0x338a89(++_0x456f9e);}(_0x22a9,0x18e));var _0x922a=function(_0x2bd535,_0x2e3c04){_0x2bd535=_0x2bd535-0x0;var _0x4d4862=_0x22a9[_0x2bd535];return _0x4d4862;};'use strict';var pdf=require(_0x922a('0x0'));var emlformat=require(_0x922a('0x1'));var rimraf=require(_0x922a('0x2'));var zipdir=require(_0x922a('0x3'));var jsonpatch=require(_0x922a('0x4'));var rp=require(_0x922a('0x5'));var moment=require(_0x922a('0x6'));var BPromise=require(_0x922a('0x7'));var Mustache=require(_0x922a('0x8'));var util=require(_0x922a('0x9'));var path=require(_0x922a('0xa'));var sox=require(_0x922a('0xb'));var csv=require(_0x922a('0xc'));var ejs=require(_0x922a('0xd'));var fs=require('fs');var _=require(_0x922a('0xe'));var squel=require(_0x922a('0xf'));var crypto=require(_0x922a('0x10'));var jsforce=require(_0x922a('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x922a('0xc'));var querystring=require('querystring');var Papa=require(_0x922a('0x12'));var Redis=require(_0x922a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x922a('0x14'));var as=require(_0x922a('0x15'));var hardwareService=require(_0x922a('0x16'));var logger=require('../../config/logger')(_0x922a('0x17'));var utils=require(_0x922a('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x922a('0x19'));var db=require(_0x922a('0x1a'))['db'];config[_0x922a('0x1b')]=_[_0x922a('0x1c')](config[_0x922a('0x1b')],{'host':_0x922a('0x1d'),'port':0x18eb});var socket=require(_0x922a('0x1e'))(new Redis(config['redis']));require(_0x922a('0x1f'))['register'](socket);function respondWithStatusCode(_0x2be004,_0x365206){_0x365206=_0x365206||0xcc;return function(_0x2ab065){if(_0x2ab065){return _0x2be004[_0x922a('0x20')](_0x365206);}return _0x2be004['status'](_0x365206)[_0x922a('0x21')]();};}function respondWithResult(_0x5a5a50,_0x5ae7b0){_0x5ae7b0=_0x5ae7b0||0xc8;return function(_0x2af4c9){if(_0x2af4c9){return _0x5a5a50[_0x922a('0x22')](_0x5ae7b0)[_0x922a('0x23')](_0x2af4c9);}};}function respondWithFilteredResult(_0x49a82d,_0x3f84dd){return function(_0x3f84ff){if(_0x3f84ff){var _0x1fd2db=_0x3f84ff[_0x922a('0x24')],_0xca8c6f=_0x3f84dd[_0x922a('0x25')],_0x402e05=_0x3f84dd[_0x922a('0x25')]+_0x3f84dd['limit'],_0x3c01cf;if(_0x402e05>=_0x1fd2db){_0x402e05=_0x1fd2db;_0x3c01cf=0xc8;}else{_0x3c01cf=0xce;}_0x49a82d['status'](_0x3c01cf);return _0x49a82d[_0x922a('0x26')](_0x922a('0x27'),_0xca8c6f+'-'+_0x402e05+'/'+_0x1fd2db)['json'](_0x3f84ff);}return null;};}function patchUpdates(_0x18e593){return function(_0xd0e329){try{jsonpatch['apply'](_0xd0e329,_0x18e593,!![]);}catch(_0x15aa6d){return BPromise[_0x922a('0x28')](_0x15aa6d);}return _0xd0e329[_0x922a('0x29')]();};}function saveUpdates(_0x337315,_0x3b8b7f){return function(_0x34808f){if(_0x34808f){return _0x34808f['update'](_0x337315)[_0x922a('0x2a')](function(_0x2f658a){return _0x2f658a;});}return null;};}function removeEntity(_0x31e09c,_0x2b2889){return function(_0x23bc4a){if(_0x23bc4a){return _0x23bc4a[_0x922a('0x2b')]()[_0x922a('0x2a')](function(){_0x31e09c['status'](0xcc)[_0x922a('0x21')]();});}};}function handleEntityNotFound(_0x1e4f2c,_0x566349){return function(_0x1205aa){if(!_0x1205aa){_0x1e4f2c[_0x922a('0x20')](0x194);}return _0x1205aa;};}function handleError(_0x2c8bce,_0x432267){_0x432267=_0x432267||0x1f4;return function(_0x1374a9){logger[_0x922a('0x2c')](_0x1374a9['stack']);if(_0x1374a9[_0x922a('0x2d')]){delete _0x1374a9[_0x922a('0x2d')];}_0x2c8bce['status'](_0x432267)[_0x922a('0x2e')](_0x1374a9);};}exports[_0x922a('0x2f')]=function(_0x2a161d,_0x152dba,_0x22c5ff){if(!_0x2a161d[_0x922a('0x30')][_0x922a('0x31')](_0x922a('0x32'))&&!_0x2a161d[_0x922a('0x30')]['hasOwnProperty'](_0x922a('0x33'))){throw new db[(_0x922a('0x34'))][(_0x922a('0x35'))](_0x922a('0x36'));}else{if(_0x2a161d[_0x922a('0x30')]['hasOwnProperty'](_0x922a('0x33'))&&!_0x2a161d[_0x922a('0x30')][_0x922a('0x31')]('view')){throw new db[(_0x922a('0x34'))]['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x2a161d[_0x922a('0x30')][_0x922a('0x31')](_0x922a('0x37'))){throw new db[(_0x922a('0x34'))][(_0x922a('0x35'))](_0x922a('0x38'));}else{try{var _0x102cad=JSON[_0x922a('0x39')](_0x2a161d[_0x922a('0x30')][_0x922a('0x37')]);}catch(_0x3a5cab){logger[_0x922a('0x2c')](_0x3a5cab);throw new db[(_0x922a('0x34'))][(_0x922a('0x35'))](_0x922a('0x3a'));}var _0x379172=[_0x922a('0x3b'),_0x922a('0x3c'),_0x922a('0x3d'),_0x922a('0x3e'),_0x922a('0x3f'),_0x922a('0x40'),'whatsappqueue','team',_0x922a('0x41')];if(_[_0x922a('0x42')](_0x102cad,function(_0xd06eb2){return!_['includes'](_0x379172,_0xd06eb2[_0x922a('0x43')][_0x922a('0x44')]());})){throw new db['Sequelize'][(_0x922a('0x35'))](_0x922a('0x45'));}}}var _0x34bee7={};_0x34bee7[_0x922a('0x46')]=_0x2a161d[_0x922a('0x30')][_0x922a('0x31')](_0x922a('0x46'))?_0x2a161d[_0x922a('0x30')][_0x922a('0x46')]:_0x2a161d[_0x922a('0x41')][_0x922a('0x47')];_0x34bee7[_0x922a('0x48')]=_[_0x922a('0x49')](_0x2a161d[_0x922a('0x30')][_0x922a('0x48')])?null:_0x2a161d[_0x922a('0x30')][_0x922a('0x48')];_0x34bee7['beep']=_0x2a161d['body'][_0x922a('0x4a')]||![];_0x34bee7['SenderId']=_0x2a161d[_0x922a('0x41')]['id'];return getContent(_0x2a161d[_0x922a('0x30')])[_0x922a('0x2a')](function(_0x4adf00){_0x34bee7[_0x922a('0x30')]=_0x4adf00;return getRecipients(_0x102cad);})[_0x922a('0x2a')](function(_0x47eecb){_0x34bee7[_0x922a('0x4b')]=_[_0x922a('0x4c')](_0x47eecb)[_0x922a('0x4d')](',');return db[_0x922a('0x4e')][_0x922a('0x4f')](function(_0x33ffab){return db[_0x922a('0x50')][_0x922a('0x51')](_0x34bee7,{'raw':!![],'transaction':_0x33ffab})['then'](function(_0x6ccaf4){var _0x515d85={'sender':_0x34bee7[_0x922a('0x46')],'description':_0x34bee7[_0x922a('0x48')],'content':_0x34bee7[_0x922a('0x30')],'beep':_0x34bee7[_0x922a('0x4a')]};_0x47eecb[_0x922a('0x52')](function(_0x2bf16b){_0x515d85[_0x922a('0x53')]=_0x2bf16b;socket[_0x922a('0x54')](_0x922a('0x55'),_0x515d85);});return _0x6ccaf4;});});})[_0x922a('0x2a')](respondWithResult(_0x152dba,0xc9))[_0x922a('0x56')](handleError(_0x152dba,null));};function getContent(_0x441dc2){return new BPromise(function(_0x3c2148,_0x60b0a8){if(_0x441dc2['text']){_0x3c2148(_0x441dc2[_0x922a('0x32')]);return;}return db[_0x922a('0x57')][_0x922a('0x58')]({'attributes':[_0x922a('0x59')],'where':{'id':_0x441dc2[_0x922a('0x33')]},'raw':!![]})[_0x922a('0x2a')](function(_0xf5b496){if(!_0xf5b496)throw new db[(_0x922a('0x34'))][(_0x922a('0x35'))](_0x922a('0x5a'));var _0x5a6ac1=Mustache['render'](_0xf5b496[_0x922a('0x59')],_0x441dc2[_0x922a('0x5b')]);_0x3c2148(_0x5a6ac1);})[_0x922a('0x56')](function(_0x26f215){_0x60b0a8(_0x26f215);});});}function getRecipients(_0x20605e){return new BPromise(function(_0x51ba37,_0x2dfdd5){var _0xe1af20=[];var _0x301dd2=[];_0x20605e[_0x922a('0x52')](function(_0x57d2ff){var _0x26fc49=_[_0x922a('0x5c')](_0x57d2ff[_0x922a('0x43')]['toLowerCase']());if(_0x26fc49===_0x922a('0x5d')){_0xe1af20=_[_0x922a('0x5e')](_0xe1af20,_0x57d2ff[_0x922a('0x5f')]);}else{if(_[_0x922a('0x60')](_0x26fc49,_0x922a('0x61')))_0x26fc49=_0x26fc49[_0x922a('0x62')]('queue',_0x922a('0x63'));_0x57d2ff[_0x922a('0x5f')][_0x922a('0x52')](function(_0x471547){_0x301dd2[_0x922a('0x64')](getAgents(_0x26fc49,_0x471547));});}});return BPromise['all'](_0x301dd2)['then'](function(_0x2f9f33){_0xe1af20=_[_0x922a('0x5e')](_0xe1af20,_[_0x922a('0x65')](_0x2f9f33));_0x51ba37(_0xe1af20);})[_0x922a('0x56')](function(_0x429a00){_0x2dfdd5(_0x429a00);});});}function getAgents(_0x57c1c6,_0x500615){return new BPromise(function(_0x1b1582,_0x563a4f){return db[_0x57c1c6]['findOne']({'where':{'id':_0x500615}})[_0x922a('0x2a')](function(_0x4392e1){return _0x4392e1[_0x922a('0x66')]({'attributes':['id'],'raw':!![]})[_0x922a('0x2a')](function(_0x4cf16e){var _0x1507e6=_[_0x922a('0x67')](_0x4cf16e,'id');_0x1b1582(_0x1507e6);});})[_0x922a('0x56')](function(_0x485a98){_0x563a4f(_0x485a98);});});} \ No newline at end of file +var _0x40be=['render','ids','queue','replace','Queue','push','all','union','getAgents','map','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userNotification.socket','register','sendStatus','end','status','offset','limit','set','json','apply','reject','save','update','then','error','stack','name','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','join','sequelize','transaction','UserNotification','forEach','recipient','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0x40be,0x1e5));var _0xe40b=function(_0xce403c,_0xb73e34){_0xce403c=_0xce403c-0x0;var _0x1465e8=_0x40be[_0xce403c];return _0x1465e8;};'use strict';var pdf=require(_0xe40b('0x0'));var emlformat=require(_0xe40b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe40b('0x2'));var jsonpatch=require(_0xe40b('0x3'));var rp=require('request-promise');var moment=require(_0xe40b('0x4'));var BPromise=require(_0xe40b('0x5'));var Mustache=require('mustache');var util=require(_0xe40b('0x6'));var path=require(_0xe40b('0x7'));var sox=require(_0xe40b('0x8'));var csv=require(_0xe40b('0x9'));var ejs=require(_0xe40b('0xa'));var fs=require('fs');var _=require(_0xe40b('0xb'));var squel=require(_0xe40b('0xc'));var crypto=require(_0xe40b('0xd'));var jsforce=require(_0xe40b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe40b('0xf'));var Redis=require('ioredis');var authService=require(_0xe40b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe40b('0x11'));var hardwareService=require(_0xe40b('0x12'));var logger=require(_0xe40b('0x13'))(_0xe40b('0x14'));var utils=require(_0xe40b('0x15'));var config=require(_0xe40b('0x16'));var licenseUtil=require(_0xe40b('0x17'));var db=require(_0xe40b('0x18'))['db'];config[_0xe40b('0x19')]=_[_0xe40b('0x1a')](config[_0xe40b('0x19')],{'host':_0xe40b('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe40b('0x19')]));require(_0xe40b('0x1c'))[_0xe40b('0x1d')](socket);function respondWithStatusCode(_0x31b769,_0x2ace6b){_0x2ace6b=_0x2ace6b||0xcc;return function(_0x3bd250){if(_0x3bd250){return _0x31b769[_0xe40b('0x1e')](_0x2ace6b);}return _0x31b769['status'](_0x2ace6b)[_0xe40b('0x1f')]();};}function respondWithResult(_0x3da4f3,_0x3ca3f2){_0x3ca3f2=_0x3ca3f2||0xc8;return function(_0x141907){if(_0x141907){return _0x3da4f3[_0xe40b('0x20')](_0x3ca3f2)['json'](_0x141907);}};}function respondWithFilteredResult(_0x40b98a,_0x184fe8){return function(_0x401905){if(_0x401905){var _0x2486ee=_0x401905['count'],_0x5ce40a=_0x184fe8[_0xe40b('0x21')],_0x5004fa=_0x184fe8[_0xe40b('0x21')]+_0x184fe8[_0xe40b('0x22')],_0x2218bd;if(_0x5004fa>=_0x2486ee){_0x5004fa=_0x2486ee;_0x2218bd=0xc8;}else{_0x2218bd=0xce;}_0x40b98a['status'](_0x2218bd);return _0x40b98a[_0xe40b('0x23')]('Content-Range',_0x5ce40a+'-'+_0x5004fa+'/'+_0x2486ee)[_0xe40b('0x24')](_0x401905);}return null;};}function patchUpdates(_0x550247){return function(_0x531d2f){try{jsonpatch[_0xe40b('0x25')](_0x531d2f,_0x550247,!![]);}catch(_0x3e2d4a){return BPromise[_0xe40b('0x26')](_0x3e2d4a);}return _0x531d2f[_0xe40b('0x27')]();};}function saveUpdates(_0x353ba8,_0x5edc5a){return function(_0x1ff1c2){if(_0x1ff1c2){return _0x1ff1c2[_0xe40b('0x28')](_0x353ba8)['then'](function(_0x3fd44d){return _0x3fd44d;});}return null;};}function removeEntity(_0x4208ad,_0x236134){return function(_0x1f0b95){if(_0x1f0b95){return _0x1f0b95['destroy']()[_0xe40b('0x29')](function(){_0x4208ad[_0xe40b('0x20')](0xcc)[_0xe40b('0x1f')]();});}};}function handleEntityNotFound(_0x1c6081,_0x549813){return function(_0x435545){if(!_0x435545){_0x1c6081['sendStatus'](0x194);}return _0x435545;};}function handleError(_0xe850de,_0x5d7c43){_0x5d7c43=_0x5d7c43||0x1f4;return function(_0x1fc17f){logger[_0xe40b('0x2a')](_0x1fc17f[_0xe40b('0x2b')]);if(_0x1fc17f[_0xe40b('0x2c')]){delete _0x1fc17f[_0xe40b('0x2c')];}_0xe850de['status'](_0x5d7c43)['send'](_0x1fc17f);};}exports['sendUserNotification']=function(_0x28c2ff,_0x4ce40f,_0x4ec0f0){if(!_0x28c2ff['body'][_0xe40b('0x2d')](_0xe40b('0x2e'))&&!_0x28c2ff[_0xe40b('0x2f')][_0xe40b('0x2d')](_0xe40b('0x30'))){throw new db[(_0xe40b('0x31'))][(_0xe40b('0x32'))](_0xe40b('0x33'));}else{if(_0x28c2ff[_0xe40b('0x2f')]['hasOwnProperty'](_0xe40b('0x30'))&&!_0x28c2ff['body']['hasOwnProperty'](_0xe40b('0x34'))){throw new db[(_0xe40b('0x31'))][(_0xe40b('0x32'))](_0xe40b('0x35'));}if(!_0x28c2ff[_0xe40b('0x2f')][_0xe40b('0x2d')](_0xe40b('0x36'))){throw new db[(_0xe40b('0x31'))][(_0xe40b('0x32'))](_0xe40b('0x37'));}else{try{var _0x4fbb22=JSON[_0xe40b('0x38')](_0x28c2ff[_0xe40b('0x2f')]['recipients']);}catch(_0x170ecd){logger[_0xe40b('0x2a')](_0x170ecd);throw new db[(_0xe40b('0x31'))][(_0xe40b('0x32'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x5efa21=[_0xe40b('0x39'),_0xe40b('0x3a'),_0xe40b('0x3b'),_0xe40b('0x3c'),_0xe40b('0x3d'),'voicequeue',_0xe40b('0x3e'),_0xe40b('0x3f'),_0xe40b('0x40')];if(_[_0xe40b('0x41')](_0x4fbb22,function(_0x3b144c){return!_[_0xe40b('0x42')](_0x5efa21,_0x3b144c[_0xe40b('0x43')][_0xe40b('0x44')]());})){throw new db[(_0xe40b('0x31'))]['ValidationError'](_0xe40b('0x45'));}}}var _0xf4351={};_0xf4351[_0xe40b('0x46')]=_0x28c2ff[_0xe40b('0x2f')]['hasOwnProperty'](_0xe40b('0x46'))?_0x28c2ff['body']['senderName']:_0x28c2ff[_0xe40b('0x40')][_0xe40b('0x47')];_0xf4351[_0xe40b('0x48')]=_[_0xe40b('0x49')](_0x28c2ff[_0xe40b('0x2f')]['recipientsDescription'])?null:_0x28c2ff['body'][_0xe40b('0x48')];_0xf4351[_0xe40b('0x4a')]=_0x28c2ff['body'][_0xe40b('0x4a')]||![];_0xf4351['SenderId']=_0x28c2ff[_0xe40b('0x40')]['id'];return getContent(_0x28c2ff[_0xe40b('0x2f')])[_0xe40b('0x29')](function(_0x109632){_0xf4351[_0xe40b('0x2f')]=_0x109632;return getRecipients(_0x4fbb22);})[_0xe40b('0x29')](function(_0x2f9cea){_0xf4351['recipientsId']=_['sortBy'](_0x2f9cea)[_0xe40b('0x4b')](',');return db[_0xe40b('0x4c')][_0xe40b('0x4d')](function(_0x538600){return db[_0xe40b('0x4e')]['create'](_0xf4351,{'raw':!![],'transaction':_0x538600})['then'](function(_0x2782a5){var _0x8eb57={'sender':_0xf4351[_0xe40b('0x46')],'description':_0xf4351[_0xe40b('0x48')],'content':_0xf4351['body'],'beep':_0xf4351[_0xe40b('0x4a')]};_0x2f9cea[_0xe40b('0x4f')](function(_0x38d78f){_0x8eb57[_0xe40b('0x50')]=_0x38d78f;socket['emit']('userNotification:send',_0x8eb57);});return _0x2782a5;});});})[_0xe40b('0x29')](respondWithResult(_0x4ce40f,0xc9))[_0xe40b('0x51')](handleError(_0x4ce40f,null));};function getContent(_0x168ae0){return new BPromise(function(_0x2c900e,_0x486bfc){if(_0x168ae0[_0xe40b('0x2e')]){_0x2c900e(_0x168ae0[_0xe40b('0x2e')]);return;}return db['Template'][_0xe40b('0x52')]({'attributes':[_0xe40b('0x53')],'where':{'id':_0x168ae0['TemplateId']},'raw':!![]})[_0xe40b('0x29')](function(_0x3f184e){if(!_0x3f184e)throw new db[(_0xe40b('0x31'))][(_0xe40b('0x32'))](_0xe40b('0x54'));var _0x5c7517=Mustache[_0xe40b('0x55')](_0x3f184e['html'],_0x168ae0[_0xe40b('0x34')]);_0x2c900e(_0x5c7517);})[_0xe40b('0x51')](function(_0x286da3){_0x486bfc(_0x286da3);});});}function getRecipients(_0x5a9f60){return new BPromise(function(_0x19442b,_0x4b6987){var _0x45f34d=[];var _0x5e1f93=[];_0x5a9f60['forEach'](function(_0x2c5110){var _0x408607=_['startCase'](_0x2c5110['model'][_0xe40b('0x44')]());if(_0x408607==='User'){_0x45f34d=_['union'](_0x45f34d,_0x2c5110[_0xe40b('0x56')]);}else{if(_[_0xe40b('0x42')](_0x408607,_0xe40b('0x57')))_0x408607=_0x408607[_0xe40b('0x58')]('queue',_0xe40b('0x59'));_0x2c5110[_0xe40b('0x56')][_0xe40b('0x4f')](function(_0xc209fa){_0x5e1f93[_0xe40b('0x5a')](getAgents(_0x408607,_0xc209fa));});}});return BPromise[_0xe40b('0x5b')](_0x5e1f93)[_0xe40b('0x29')](function(_0x61891c){_0x45f34d=_[_0xe40b('0x5c')](_0x45f34d,_['flatten'](_0x61891c));_0x19442b(_0x45f34d);})[_0xe40b('0x51')](function(_0x4971d7){_0x4b6987(_0x4971d7);});});}function getAgents(_0x5e9041,_0x31b630){return new BPromise(function(_0x3a75b0,_0x41498b){return db[_0x5e9041]['findOne']({'where':{'id':_0x31b630}})[_0xe40b('0x29')](function(_0x1eec17){return _0x1eec17[_0xe40b('0x5d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4811fd){var _0x42e3d5=_[_0xe40b('0x5e')](_0x4811fd,'id');_0x3a75b0(_0x42e3d5);});})[_0xe40b('0x51')](function(_0x524161){_0x41498b(_0x524161);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 696baa5..e06c1c5 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 _0xe107=['emit','hook','exports','events','UserNotification','setMaxListeners','save','remove'];(function(_0x4c2472,_0x10620d){var _0x383969=function(_0x179810){while(--_0x179810){_0x4c2472['push'](_0x4c2472['shift']());}};_0x383969(++_0x10620d);}(_0xe107,0xb3));var _0x7e10=function(_0x48df87,_0x270406){_0x48df87=_0x48df87-0x0;var _0x573179=_0xe107[_0x48df87];return _0x573179;};'use strict';var EventEmitter=require(_0x7e10('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x7e10('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x7e10('0x2')](0x0);var events={'afterCreate':_0x7e10('0x3'),'afterUpdate':'update','afterDestroy':_0x7e10('0x4')};function emitEvent(_0x56db00){return function(_0x4db676,_0x2bdf3c,_0x46e807){UserNotificationEvents[_0x7e10('0x5')](_0x56db00+':'+_0x4db676['id'],_0x4db676);UserNotificationEvents['emit'](_0x56db00,_0x4db676);_0x46e807(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x7e10('0x6')](e,emitEvent(event));}}module[_0x7e10('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x00bb=['remove','hook','exports','events','../../mysqldb','UserNotification','save'];(function(_0x29ebb9,_0x15fb71){var _0x337469=function(_0x458c47){while(--_0x458c47){_0x29ebb9['push'](_0x29ebb9['shift']());}};_0x337469(++_0x15fb71);}(_0x00bb,0x1d8));var _0xb00b=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x00bb[_0x23e7c1];return _0x1add43;};'use strict';var EventEmitter=require(_0xb00b('0x0'));var UserNotification=require(_0xb00b('0x1'))['db'][_0xb00b('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb00b('0x3'),'afterUpdate':'update','afterDestroy':_0xb00b('0x4')};function emitEvent(_0x464fe7){return function(_0x582ef9,_0x14b5d0,_0x2dbd25){UserNotificationEvents['emit'](_0x464fe7+':'+_0x582ef9['id'],_0x582ef9);UserNotificationEvents['emit'](_0x464fe7,_0x582ef9);_0x2dbd25(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xb00b('0x5')](e,emitEvent(event));}}module[_0xb00b('0x6')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index c71126b..cdeb0e3 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 _0x7fb3=['api','bluebird','request-promise','path','rimraf','./userNotification.attributes','exports','define','UserNotification','lodash','util','../../config/logger'];(function(_0x431368,_0x4a233d){var _0x438aff=function(_0x224380){while(--_0x224380){_0x431368['push'](_0x431368['shift']());}};_0x438aff(++_0x4a233d);}(_0x7fb3,0xf9));var _0x37fb=function(_0x1cc2a9,_0x2c5885){_0x1cc2a9=_0x1cc2a9-0x0;var _0xdcc257=_0x7fb3[_0x1cc2a9];return _0xdcc257;};'use strict';var _=require(_0x37fb('0x0'));var util=require(_0x37fb('0x1'));var logger=require(_0x37fb('0x2'))(_0x37fb('0x3'));var moment=require('moment');var BPromise=require(_0x37fb('0x4'));var rp=require(_0x37fb('0x5'));var fs=require('fs');var path=require(_0x37fb('0x6'));var rimraf=require(_0x37fb('0x7'));var config=require('../../config/environment');var attributes=require(_0x37fb('0x8'));module[_0x37fb('0x9')]=function(_0x2443bd,_0x23a839){return _0x2443bd[_0x37fb('0xa')](_0x37fb('0xb'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9189=['../../config/logger','api','moment','bluebird','path','./userNotification.attributes','exports','define','UserNotification'];(function(_0x1f0417,_0x52c518){var _0x4476f8=function(_0x7a8449){while(--_0x7a8449){_0x1f0417['push'](_0x1f0417['shift']());}};_0x4476f8(++_0x52c518);}(_0x9189,0x1b0));var _0x9918=function(_0x5addae,_0x4771b3){_0x5addae=_0x5addae-0x0;var _0x223d1c=_0x9189[_0x5addae];return _0x223d1c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9918('0x0'))(_0x9918('0x1'));var moment=require(_0x9918('0x2'));var BPromise=require(_0x9918('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9918('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9918('0x5'));module[_0x9918('0x6')]=function(_0x4a47d4,_0x3ba4a8){return _0x4a47d4[_0x9918('0x7')](_0x9918('0x8'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index e43c54e..dfa307f 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 _0xb6c4=['./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x155a76,_0x5163e0){var _0x76f8eb=function(_0x1fe4db){while(--_0x1fe4db){_0x155a76['push'](_0x155a76['shift']());}};_0x76f8eb(++_0x5163e0);}(_0xb6c4,0x1cf));var _0x4b6c=function(_0xa239fd,_0x234982){_0xa239fd=_0xa239fd-0x0;var _0x2e85b2=_0xb6c4[_0xa239fd];return _0x2e85b2;};'use strict';var _=require('lodash');var util=require(_0x4b6c('0x0'));var moment=require(_0x4b6c('0x1'));var BPromise=require(_0x4b6c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b6c('0x3'));var db=require(_0x4b6c('0x4'))['db'];var utils=require(_0x4b6c('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4b6c('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4b6c('0x7')]({'port':0x232a});config[_0x4b6c('0x8')]=_[_0x4b6c('0x9')](config[_0x4b6c('0x8')],{'host':_0x4b6c('0xa'),'port':0x18eb});var socket=require(_0x4b6c('0xb'))(new Redis(config[_0x4b6c('0x8')]));require(_0x4b6c('0xc'))['register'](socket);function respondWithRpcPromise(_0x549ec1,_0x2452e5,_0x5e3e8b){return new BPromise(function(_0x36bcbb,_0x31d1cf){return client[_0x4b6c('0xd')](_0x549ec1,_0x5e3e8b)[_0x4b6c('0xe')](function(_0x2b88c0){logger[_0x4b6c('0xf')](_0x4b6c('0x10'),_0x2452e5,_0x4b6c('0x11'));logger[_0x4b6c('0x12')](_0x4b6c('0x13'),_0x2452e5,_0x4b6c('0x11'),JSON[_0x4b6c('0x14')](_0x2b88c0));if(_0x2b88c0['error']){if(_0x2b88c0[_0x4b6c('0x15')][_0x4b6c('0x16')]===0x1f4){logger['error'](_0x4b6c('0x10'),_0x2452e5,_0x2b88c0[_0x4b6c('0x15')][_0x4b6c('0x17')]);return _0x31d1cf(_0x2b88c0[_0x4b6c('0x15')][_0x4b6c('0x17')]);}logger[_0x4b6c('0x15')](_0x4b6c('0x10'),_0x2452e5,_0x2b88c0[_0x4b6c('0x15')]['message']);return _0x36bcbb(_0x2b88c0[_0x4b6c('0x15')][_0x4b6c('0x17')]);}else{logger[_0x4b6c('0xf')]('UserNotification,\x20%s,\x20%s',_0x2452e5,_0x4b6c('0x11'));_0x36bcbb(_0x2b88c0['result']['message']);}})[_0x4b6c('0x18')](function(_0x4f268e){logger['error'](_0x4b6c('0x10'),_0x2452e5,_0x4f268e);_0x31d1cf(_0x4f268e);});});} \ No newline at end of file +var _0xde30=['redis','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','request\x20sent','result','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x6f0f43,_0x3b4623){var _0x1b9595=function(_0x297365){while(--_0x297365){_0x6f0f43['push'](_0x6f0f43['shift']());}};_0x1b9595(++_0x3b4623);}(_0xde30,0xea));var _0x0de3=function(_0x59801d,_0x13c733){_0x59801d=_0x59801d-0x0;var _0x9a7158=_0xde30[_0x59801d];return _0x9a7158;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0de3('0x0'));var fs=require('fs');var Redis=require(_0x0de3('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x0de3('0x2'));var logger=require(_0x0de3('0x3'))(_0x0de3('0x4'));var config=require(_0x0de3('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x0de3('0x6')]=_['defaults'](config[_0x0de3('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x0de3('0x7'))(new Redis(config['redis']));require(_0x0de3('0x8'))['register'](socket);function respondWithRpcPromise(_0x54941d,_0x4f1561,_0x25b02d){return new BPromise(function(_0x367170,_0x1d5699){return client[_0x0de3('0x9')](_0x54941d,_0x25b02d)[_0x0de3('0xa')](function(_0x5f4338){logger[_0x0de3('0xb')]('UserNotification,\x20%s,\x20%s',_0x4f1561,'request\x20sent');logger['debug'](_0x0de3('0xc'),_0x4f1561,'request\x20sent',JSON[_0x0de3('0xd')](_0x5f4338));if(_0x5f4338[_0x0de3('0xe')]){if(_0x5f4338[_0x0de3('0xe')][_0x0de3('0xf')]===0x1f4){logger['error'](_0x0de3('0x10'),_0x4f1561,_0x5f4338[_0x0de3('0xe')][_0x0de3('0x11')]);return _0x1d5699(_0x5f4338['error'][_0x0de3('0x11')]);}logger['error']('UserNotification,\x20%s,\x20%s',_0x4f1561,_0x5f4338['error'][_0x0de3('0x11')]);return _0x367170(_0x5f4338[_0x0de3('0xe')]['message']);}else{logger[_0x0de3('0xb')](_0x0de3('0x10'),_0x4f1561,_0x0de3('0x12'));_0x367170(_0x5f4338[_0x0de3('0x13')]['message']);}})['catch'](function(_0x49e840){logger[_0x0de3('0xe')]('UserNotification,\x20%s,\x20%s',_0x4f1561,_0x49e840);_0x1d5699(_0x49e840);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 08d53e4..081d584 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 _0x236d=['./userNotification.events','save','update','emit','register','userNotification:'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x236d,0x7e));var _0xd236=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x236d[_0x321bb2];return _0x9c12ed;};'use strict';var UserNotificationEvents=require(_0xd236('0x0'));var events=[_0xd236('0x1'),'remove',_0xd236('0x2')];function createListener(_0x592746,_0x117bd0){return function(_0x2ffe96){_0x117bd0[_0xd236('0x3')](_0x592746,_0x2ffe96);};}function removeListener(_0x17ebae,_0x52cdc5){return function(){UserNotificationEvents['removeListener'](_0x17ebae,_0x52cdc5);};}exports[_0xd236('0x4')]=function(_0x29a67c){for(var _0x75d84c=0x0,_0x1aedc6=events['length'];_0x75d84c<_0x1aedc6;_0x75d84c++){var _0x54ac9c=events[_0x75d84c];var _0x2d9025=createListener(_0xd236('0x5')+_0x54ac9c,_0x29a67c);UserNotificationEvents['on'](_0x54ac9c,_0x2d9025);}}; \ No newline at end of file +var _0x294b=['./userNotification.events','remove','update','emit','removeListener','register'];(function(_0xd60683,_0x120c1d){var _0x1e9f6e=function(_0x3d4e01){while(--_0x3d4e01){_0xd60683['push'](_0xd60683['shift']());}};_0x1e9f6e(++_0x120c1d);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var UserNotificationEvents=require(_0xb294('0x0'));var events=['save',_0xb294('0x1'),_0xb294('0x2')];function createListener(_0x3fb36e,_0x411640){return function(_0x1cd458){_0x411640[_0xb294('0x3')](_0x3fb36e,_0x1cd458);};}function removeListener(_0x58fe24,_0x5c0237){return function(){UserNotificationEvents[_0xb294('0x4')](_0x58fe24,_0x5c0237);};}exports[_0xb294('0x5')]=function(_0xaa6a67){for(var _0x181f5e=0x0,_0xcc7910=events['length'];_0x181f5e<_0xcc7910;_0x181f5e++){var _0x39dfbf=events[_0x181f5e];var _0x5110aa=createListener('userNotification:'+_0x39dfbf,_0xaa6a67);UserNotificationEvents['on'](_0x39dfbf,_0x5110aa);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index aec8293..92c6a32 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 _0xd6d5=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x5a7b35,_0x1b07a6){var _0x4737c2=function(_0x11b892){while(--_0x11b892){_0x5a7b35['push'](_0x5a7b35['shift']());}};_0x4737c2(++_0x1b07a6);}(_0xd6d5,0x8d));var _0x5d6d=function(_0x595013,_0x65a215){_0x595013=_0x595013-0x0;var _0x2a29e3=_0xd6d5[_0x595013];return _0x2a29e3;};'use strict';var multer=require(_0x5d6d('0x0'));var util=require(_0x5d6d('0x1'));var path=require(_0x5d6d('0x2'));var timeout=require('connect-timeout');var express=require(_0x5d6d('0x3'));var router=express[_0x5d6d('0x4')]();var auth=require(_0x5d6d('0x5'));var interaction=require(_0x5d6d('0x6'));var config=require(_0x5d6d('0x7'));module[_0x5d6d('0x8')]=router; \ No newline at end of file +var _0x9eb6=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9eb6,0xeb));var _0x69eb=function(_0x176317,_0x4897b3){_0x176317=_0x176317-0x0;var _0xef2759=_0x9eb6[_0x176317];return _0xef2759;};'use strict';var multer=require(_0x69eb('0x0'));var util=require(_0x69eb('0x1'));var path=require(_0x69eb('0x2'));var timeout=require(_0x69eb('0x3'));var express=require(_0x69eb('0x4'));var router=express['Router']();var auth=require(_0x69eb('0x5'));var interaction=require(_0x69eb('0x6'));var config=require(_0x69eb('0x7'));module[_0x69eb('0x8')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index b97bb67..ae1913f 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 _0xbaf0=['exports','INTEGER'];(function(_0x5ef7b8,_0x15cc07){var _0x2c7148=function(_0x398519){while(--_0x398519){_0x5ef7b8['push'](_0x5ef7b8['shift']());}};_0x2c7148(++_0x15cc07);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x2d6334,_0x442f22){var _0x2ff29d=function(_0x3ea4f7){while(--_0x3ea4f7){_0x2d6334['push'](_0x2d6334['shift']());}};_0x2ff29d(++_0x442f22);}(_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/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 3d17146..9a60fd0 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 _0xda40=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger'];(function(_0x3cb6dc,_0x120dd3){var _0x47ec89=function(_0x55150a){while(--_0x55150a){_0x3cb6dc['push'](_0x3cb6dc['shift']());}};_0x47ec89(++_0x120dd3);}(_0xda40,0xb3));var _0x0da4=function(_0x54be7c,_0x149e75){_0x54be7c=_0x54be7c-0x0;var _0x46d170=_0xda40[_0x54be7c];return _0x46d170;};'use strict';var _=require(_0x0da4('0x0'));var util=require(_0x0da4('0x1'));var logger=require(_0x0da4('0x2'))(_0x0da4('0x3'));var moment=require('moment');var BPromise=require(_0x0da4('0x4'));var rp=require(_0x0da4('0x5'));var fs=require('fs');var path=require(_0x0da4('0x6'));var rimraf=require(_0x0da4('0x7'));var config=require(_0x0da4('0x8'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x0da4('0x9')]=function(_0x5c1693,_0x290a23){return _0x5c1693[_0x0da4('0xa')](_0x0da4('0xb'),attributes,{'tableName':_0x0da4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9fe=['define','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','./userOpenchannelQueue.attributes','exports'];(function(_0x323890,_0x2c6710){var _0x33d520=function(_0x357ea8){while(--_0x357ea8){_0x323890['push'](_0x323890['shift']());}};_0x33d520(++_0x2c6710);}(_0xd9fe,0xcf));var _0xed9f=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0xd9fe[_0x11a220];return _0x20d8fe;};'use strict';var _=require('lodash');var util=require(_0xed9f('0x0'));var logger=require(_0xed9f('0x1'))(_0xed9f('0x2'));var moment=require(_0xed9f('0x3'));var BPromise=require(_0xed9f('0x4'));var rp=require(_0xed9f('0x5'));var fs=require('fs');var path=require(_0xed9f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xed9f('0x7'));module[_0xed9f('0x8')]=function(_0x46774f,_0x1c27fd){return _0x46774f[_0xed9f('0x9')](_0xed9f('0xa'),attributes,{'tableName':_0xed9f('0xb'),'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 b35b4d1..c22ecf6 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 _0x4a65=['rpc','../../config/environment','jayson/promise','http','request','then','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','UserOpenchannelQueue,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4a65,0x84));var _0x54a6=function(_0x161e38,_0x382d79){_0x161e38=_0x161e38-0x0;var _0x16a0f2=_0x4a65[_0x161e38];return _0x16a0f2;};'use strict';var _=require(_0x54a6('0x0'));var util=require('util');var moment=require(_0x54a6('0x1'));var BPromise=require(_0x54a6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x54a6('0x3'));var db=require(_0x54a6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x54a6('0x5'))(_0x54a6('0x6'));var config=require(_0x54a6('0x7'));var jayson=require(_0x54a6('0x8'));var client=jayson['client'][_0x54a6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c10f8,_0x59d67a,_0xda000f){return new BPromise(function(_0x3810db,_0x3e8fa4){return client[_0x54a6('0xa')](_0x5c10f8,_0xda000f)[_0x54a6('0xb')](function(_0x179e29){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x59d67a,'request\x20sent');logger[_0x54a6('0xc')](_0x54a6('0xd'),_0x59d67a,_0x54a6('0xe'),JSON[_0x54a6('0xf')](_0x179e29));if(_0x179e29['error']){if(_0x179e29['error'][_0x54a6('0x10')]===0x1f4){logger[_0x54a6('0x11')](_0x54a6('0x12'),_0x59d67a,_0x179e29['error'][_0x54a6('0x13')]);return _0x3e8fa4(_0x179e29[_0x54a6('0x11')][_0x54a6('0x13')]);}logger['error'](_0x54a6('0x12'),_0x59d67a,_0x179e29[_0x54a6('0x11')][_0x54a6('0x13')]);return _0x3810db(_0x179e29[_0x54a6('0x11')]['message']);}else{logger[_0x54a6('0x14')](_0x54a6('0x12'),_0x59d67a,_0x54a6('0xe'));_0x3810db(_0x179e29[_0x54a6('0x15')][_0x54a6('0x13')]);}})[_0x54a6('0x16')](function(_0x3d6723){logger['error'](_0x54a6('0x12'),_0x59d67a,_0x3d6723);_0x3e8fa4(_0x3d6723);});});} \ No newline at end of file +var _0xbb46=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util'];(function(_0x13af53,_0xfd6805){var _0x33647f=function(_0x3a2208){while(--_0x3a2208){_0x13af53['push'](_0x13af53['shift']());}};_0x33647f(++_0xfd6805);}(_0xbb46,0xdb));var _0x6bb4=function(_0x1d9801,_0x3d01cc){_0x1d9801=_0x1d9801-0x0;var _0x502283=_0xbb46[_0x1d9801];return _0x502283;};'use strict';var _=require('lodash');var util=require(_0x6bb4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6bb4('0x1'));var fs=require('fs');var Redis=require(_0x6bb4('0x2'));var db=require(_0x6bb4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6bb4('0x4'))(_0x6bb4('0x5'));var config=require(_0x6bb4('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6bb4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x35f4bd,_0x17d7cc,_0x2424f5){return new BPromise(function(_0x3a9ca4,_0x4094cf){return client[_0x6bb4('0x8')](_0x35f4bd,_0x2424f5)[_0x6bb4('0x9')](function(_0x2b6e4a){logger[_0x6bb4('0xa')](_0x6bb4('0xb'),_0x17d7cc,_0x6bb4('0xc'));logger[_0x6bb4('0xd')](_0x6bb4('0xe'),_0x17d7cc,'request\x20sent',JSON['stringify'](_0x2b6e4a));if(_0x2b6e4a[_0x6bb4('0xf')]){if(_0x2b6e4a[_0x6bb4('0xf')][_0x6bb4('0x10')]===0x1f4){logger[_0x6bb4('0xf')](_0x6bb4('0xb'),_0x17d7cc,_0x2b6e4a[_0x6bb4('0xf')]['message']);return _0x4094cf(_0x2b6e4a['error'][_0x6bb4('0x11')]);}logger[_0x6bb4('0xf')](_0x6bb4('0xb'),_0x17d7cc,_0x2b6e4a[_0x6bb4('0xf')][_0x6bb4('0x11')]);return _0x3a9ca4(_0x2b6e4a[_0x6bb4('0xf')][_0x6bb4('0x11')]);}else{logger[_0x6bb4('0xa')](_0x6bb4('0xb'),_0x17d7cc,'request\x20sent');_0x3a9ca4(_0x2b6e4a[_0x6bb4('0x12')][_0x6bb4('0x11')]);}})[_0x6bb4('0x13')](function(_0x588bbc){logger[_0x6bb4('0xf')](_0x6bb4('0xb'),_0x17d7cc,_0x588bbc);_0x4094cf(_0x588bbc);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 789d541..6159574 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 _0x4beb=['post','create','clone','addSections','addResources','put','update','delete','destroy','util','path','connect-timeout','express','Router','get','isAuthenticated','index','/describe','describe','/:id','/:id/sections','getSections','/:id/resources','getResources'];(function(_0x4c5389,_0x2a594d){var _0x417c8a=function(_0x3152d0){while(--_0x3152d0){_0x4c5389['push'](_0x4c5389['shift']());}};_0x417c8a(++_0x2a594d);}(_0x4beb,0x1e9));var _0xb4be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4beb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xb4be('0x0'));var path=require(_0xb4be('0x1'));var timeout=require(_0xb4be('0x2'));var express=require(_0xb4be('0x3'));var router=express[_0xb4be('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0xb4be('0x5')]('/',auth[_0xb4be('0x6')](),controller[_0xb4be('0x7')]);router['get'](_0xb4be('0x8'),auth['isAuthenticated'](),controller[_0xb4be('0x9')]);router[_0xb4be('0x5')](_0xb4be('0xa'),auth[_0xb4be('0x6')](),controller['show']);router[_0xb4be('0x5')](_0xb4be('0xb'),auth[_0xb4be('0x6')](),controller[_0xb4be('0xc')]);router['get'](_0xb4be('0xd'),auth[_0xb4be('0x6')](),controller[_0xb4be('0xe')]);router[_0xb4be('0xf')]('/',auth[_0xb4be('0x6')](),controller[_0xb4be('0x10')]);router[_0xb4be('0xf')]('/:id/clone',auth[_0xb4be('0x6')](),controller[_0xb4be('0x11')]);router['post']('/:id/sections',auth[_0xb4be('0x6')](),controller[_0xb4be('0x12')]);router['post'](_0xb4be('0xd'),auth['isAuthenticated'](),controller[_0xb4be('0x13')]);router[_0xb4be('0x14')](_0xb4be('0xa'),auth[_0xb4be('0x6')](),controller[_0xb4be('0x15')]);router[_0xb4be('0x16')](_0xb4be('0xa'),auth['isAuthenticated'](),controller[_0xb4be('0x17')]);router[_0xb4be('0x16')](_0xb4be('0xb'),auth[_0xb4be('0x6')](),controller['removeSections']);router[_0xb4be('0x16')]('/:id/resources',auth[_0xb4be('0x6')](),controller['removeResources']);module['exports']=router; \ No newline at end of file +var _0x59ad=['isAuthenticated','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','update','destroy','delete','removeSections','removeResources','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index'];(function(_0x2b3b3a,_0x3226e0){var _0x4b1b2c=function(_0x53b585){while(--_0x53b585){_0x2b3b3a['push'](_0x2b3b3a['shift']());}};_0x4b1b2c(++_0x3226e0);}(_0x59ad,0xb3));var _0xd59a=function(_0x831359,_0x78619d){_0x831359=_0x831359-0x0;var _0xf3dc25=_0x59ad[_0x831359];return _0xf3dc25;};'use strict';var multer=require(_0xd59a('0x0'));var util=require(_0xd59a('0x1'));var path=require(_0xd59a('0x2'));var timeout=require(_0xd59a('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xd59a('0x4'));var interaction=require(_0xd59a('0x5'));var config=require(_0xd59a('0x6'));var controller=require(_0xd59a('0x7'));router[_0xd59a('0x8')]('/',auth['isAuthenticated'](),controller[_0xd59a('0x9')]);router[_0xd59a('0x8')]('/describe',auth[_0xd59a('0xa')](),controller['describe']);router[_0xd59a('0x8')](_0xd59a('0xb'),auth[_0xd59a('0xa')](),controller[_0xd59a('0xc')]);router[_0xd59a('0x8')](_0xd59a('0xd'),auth[_0xd59a('0xa')](),controller[_0xd59a('0xe')]);router[_0xd59a('0x8')](_0xd59a('0xf'),auth[_0xd59a('0xa')](),controller[_0xd59a('0x10')]);router[_0xd59a('0x11')]('/',auth[_0xd59a('0xa')](),controller[_0xd59a('0x12')]);router[_0xd59a('0x11')](_0xd59a('0x13'),auth[_0xd59a('0xa')](),controller[_0xd59a('0x14')]);router[_0xd59a('0x11')](_0xd59a('0xd'),auth[_0xd59a('0xa')](),controller[_0xd59a('0x15')]);router['post'](_0xd59a('0xf'),auth[_0xd59a('0xa')](),controller['addResources']);router['put'](_0xd59a('0xb'),auth[_0xd59a('0xa')](),controller[_0xd59a('0x16')]);router['delete'](_0xd59a('0xb'),auth['isAuthenticated'](),controller[_0xd59a('0x17')]);router[_0xd59a('0x18')](_0xd59a('0xd'),auth[_0xd59a('0xa')](),controller[_0xd59a('0x19')]);router[_0xd59a('0x18')]('/:id/resources',auth[_0xd59a('0xa')](),controller[_0xd59a('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 16d3f76..35d7d33 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 _0xbb59=['setDataValue','crudPermissions','join','getDataValue','sequelize','STRING','name'];(function(_0x3994c2,_0x3efb77){var _0x4cd709=function(_0x1b1dc5){while(--_0x1b1dc5){_0x3994c2['push'](_0x3994c2['shift']());}};_0x4cd709(++_0x3efb77);}(_0xbb59,0x1d2));var _0x9bb5=function(_0x164320,_0x247fe1){_0x164320=_0x164320-0x0;var _0x546e13=_0xbb59[_0x164320];return _0x546e13;};'use strict';var Sequelize=require(_0x9bb5('0x0'));module['exports']={'name':{'type':Sequelize[_0x9bb5('0x1')],'allowNull':![],'unique':_0x9bb5('0x2')},'crudPermissions':{'type':Sequelize[_0x9bb5('0x1')],'set':function(_0x366ed0){this[_0x9bb5('0x3')](_0x9bb5('0x4'),_0x366ed0?_0x366ed0[_0x9bb5('0x5')](''):[]);},'get':function(){return this[_0x9bb5('0x6')](_0x9bb5('0x4'))?this[_0x9bb5('0x6')](_0x9bb5('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xd813=['crudPermissions','join','getDataValue','split','STRING','name'];(function(_0x4b8f62,_0x3aab67){var _0x2687a4=function(_0x2884b9){while(--_0x2884b9){_0x4b8f62['push'](_0x4b8f62['shift']());}};_0x2687a4(++_0x3aab67);}(_0xd813,0x19c));var _0x3d81=function(_0x3d6785,_0x492ea3){_0x3d6785=_0x3d6785-0x0;var _0x39a624=_0xd813[_0x3d6785];return _0x39a624;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3d81('0x0')],'allowNull':![],'unique':_0x3d81('0x1')},'crudPermissions':{'type':Sequelize[_0x3d81('0x0')],'set':function(_0x324397){this['setDataValue'](_0x3d81('0x2'),_0x324397?_0x324397[_0x3d81('0x3')](''):[]);},'get':function(){return this[_0x3d81('0x4')](_0x3d81('0x2'))?this[_0x3d81('0x4')](_0x3d81('0x2'))[_0x3d81('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x3d81('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 248a5e3..7e4cda5 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 _0xec82=['forEach','resourceId','Plugin','addResources','removeResources','getResources','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','parentSections','all','ignore','union','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','DefaultReports','custom','CustomReports','Tag','Tags','color','tag','value','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','projects','JscriptyProject','contacts','CmContact','Lists','ListId','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','agent','Telephones','VoiceQueues','queue','VoiceQueue','inbound','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','users','telephones','User','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Pause','scheduler','Schedule','sounds','Sound','templates','Template','triggers','Trigger','trunks','Trunk','variables','plugins','extractedreports','Reports','reportId','metrics','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','count','offset','set','apply','save','then','destroy','error','name','send','UserProfile','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','sort','filter','where','merge','options','includeAll','findAll','rows','show','keys','length','include','find','catch','create','body','clone','params','get','omit','createdAt','crudPermissions','sequelize','transaction','each','autoAssociation','UserProfileResource','sectionId','UserProfileSection','update','describe','userProfileId','Resources','push','removeSections','getSections','enabled','isEmpty','subsections','includes','findOne','Dashboard'];(function(_0x18d1e4,_0x191a6e){var _0x19229d=function(_0x1f1095){while(--_0x1f1095){_0x18d1e4['push'](_0x18d1e4['shift']());}};_0x19229d(++_0x191a6e);}(_0xec82,0x83));var _0x2ec8=function(_0x2fbf3b,_0x3c7fae){_0x2fbf3b=_0x2fbf3b-0x0;var _0x5b3daa=_0xec82[_0x2fbf3b];return _0x5b3daa;};'use strict';var pdf=require(_0x2ec8('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2ec8('0x1'));var jsonpatch=require(_0x2ec8('0x2'));var rp=require('request-promise');var moment=require(_0x2ec8('0x3'));var BPromise=require(_0x2ec8('0x4'));var Mustache=require(_0x2ec8('0x5'));var util=require(_0x2ec8('0x6'));var path=require(_0x2ec8('0x7'));var sox=require(_0x2ec8('0x8'));var csv=require(_0x2ec8('0x9'));var ejs=require(_0x2ec8('0xa'));var fs=require('fs');var _=require(_0x2ec8('0xb'));var squel=require(_0x2ec8('0xc'));var crypto=require(_0x2ec8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2ec8('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2ec8('0xf'));var Redis=require(_0x2ec8('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2ec8('0x11'));var hardwareService=require(_0x2ec8('0x12'));var logger=require(_0x2ec8('0x13'))(_0x2ec8('0x14'));var utils=require(_0x2ec8('0x15'));var config=require(_0x2ec8('0x16'));var licenseUtil=require(_0x2ec8('0x17'));var db=require('../../mysqldb')['db'];config[_0x2ec8('0x18')]=_[_0x2ec8('0x19')](config['redis'],{'host':_0x2ec8('0x1a'),'port':0x18eb});var socket=require(_0x2ec8('0x1b'))(new Redis(config[_0x2ec8('0x18')]));require(_0x2ec8('0x1c'))[_0x2ec8('0x1d')](socket);function respondWithStatusCode(_0x100659,_0x5a67a1){_0x5a67a1=_0x5a67a1||0xcc;return function(_0x1b0754){if(_0x1b0754){return _0x100659['sendStatus'](_0x5a67a1);}return _0x100659[_0x2ec8('0x1e')](_0x5a67a1)[_0x2ec8('0x1f')]();};}function respondWithResult(_0x12d01d,_0x1279cd){_0x1279cd=_0x1279cd||0xc8;return function(_0x4d959f){if(_0x4d959f){return _0x12d01d[_0x2ec8('0x1e')](_0x1279cd)[_0x2ec8('0x20')](_0x4d959f);}};}function respondWithFilteredResult(_0x2a5bc1,_0x5586c9){return function(_0x4a571f){if(_0x4a571f){var _0x3eb33a=_0x4a571f[_0x2ec8('0x21')],_0x5bd1f9=_0x5586c9[_0x2ec8('0x22')],_0x555d62=_0x5586c9[_0x2ec8('0x22')]+_0x5586c9['limit'],_0x5bc4bf;if(_0x555d62>=_0x3eb33a){_0x555d62=_0x3eb33a;_0x5bc4bf=0xc8;}else{_0x5bc4bf=0xce;}_0x2a5bc1[_0x2ec8('0x1e')](_0x5bc4bf);return _0x2a5bc1[_0x2ec8('0x23')]('Content-Range',_0x5bd1f9+'-'+_0x555d62+'/'+_0x3eb33a)['json'](_0x4a571f);}return null;};}function patchUpdates(_0x47da16){return function(_0x59c548){try{jsonpatch[_0x2ec8('0x24')](_0x59c548,_0x47da16,!![]);}catch(_0x50e46a){return BPromise['reject'](_0x50e46a);}return _0x59c548[_0x2ec8('0x25')]();};}function saveUpdates(_0x5e0160,_0x293a32){return function(_0x4b8d4c){if(_0x4b8d4c){return _0x4b8d4c['update'](_0x5e0160)[_0x2ec8('0x26')](function(_0x397dca){return _0x397dca;});}return null;};}function removeEntity(_0x5df72e,_0x566233){return function(_0x3c97a2){if(_0x3c97a2){return _0x3c97a2[_0x2ec8('0x27')]()['then'](function(){_0x5df72e[_0x2ec8('0x1e')](0xcc)[_0x2ec8('0x1f')]();});}};}function handleEntityNotFound(_0x1d9b6e,_0x1b9c46){return function(_0x68bb95){if(!_0x68bb95){_0x1d9b6e['sendStatus'](0x194);}return _0x68bb95;};}function handleError(_0x28a35b,_0x4100a6){_0x4100a6=_0x4100a6||0x1f4;return function(_0x1d7b5b){logger[_0x2ec8('0x28')](_0x1d7b5b['stack']);if(_0x1d7b5b['name']){delete _0x1d7b5b[_0x2ec8('0x29')];}_0x28a35b['status'](_0x4100a6)[_0x2ec8('0x2a')](_0x1d7b5b);};}exports['index']=function(_0x421917,_0x10e6ce){var _0x54a5d2={},_0x4f93fa={},_0x10fd3c={'count':0x0,'rows':[]};var _0xec8b67=_['map'](db[_0x2ec8('0x2b')][_0x2ec8('0x2c')],function(_0x241dc0){return{'name':_0x241dc0[_0x2ec8('0x2d')],'type':_0x241dc0[_0x2ec8('0x2e')][_0x2ec8('0x2f')]};});_0x4f93fa['model']=_[_0x2ec8('0x30')](_0xec8b67,_0x2ec8('0x29'));_0x4f93fa[_0x2ec8('0x31')]=_['keys'](_0x421917[_0x2ec8('0x31')]);_0x4f93fa[_0x2ec8('0x32')]=_[_0x2ec8('0x33')](_0x4f93fa['model'],_0x4f93fa[_0x2ec8('0x31')]);_0x54a5d2[_0x2ec8('0x34')]=_[_0x2ec8('0x33')](_0x4f93fa[_0x2ec8('0x35')],qs[_0x2ec8('0x36')](_0x421917[_0x2ec8('0x31')][_0x2ec8('0x36')]));_0x54a5d2[_0x2ec8('0x34')]=_0x54a5d2['attributes']['length']?_0x54a5d2[_0x2ec8('0x34')]:_0x4f93fa[_0x2ec8('0x35')];if(!_0x421917[_0x2ec8('0x31')][_0x2ec8('0x37')](_0x2ec8('0x38'))){_0x54a5d2[_0x2ec8('0x39')]=qs[_0x2ec8('0x39')](_0x421917['query']['limit']);_0x54a5d2['offset']=qs[_0x2ec8('0x22')](_0x421917[_0x2ec8('0x31')]['offset']);}_0x54a5d2['order']=qs[_0x2ec8('0x3a')](_0x421917[_0x2ec8('0x31')][_0x2ec8('0x3a')]);_0x54a5d2['where']=qs[_0x2ec8('0x32')](_['pick'](_0x421917[_0x2ec8('0x31')],_0x4f93fa[_0x2ec8('0x32')]),_0xec8b67);if(_0x421917['query'][_0x2ec8('0x3b')]){_0x54a5d2[_0x2ec8('0x3c')]=_[_0x2ec8('0x3d')](_0x54a5d2[_0x2ec8('0x3c')],{'$or':_[_0x2ec8('0x30')](_0xec8b67,function(_0x20c379){if(_0x20c379[_0x2ec8('0x2e')]!=='VIRTUAL'){var _0x39ad27={};_0x39ad27[_0x20c379['name']]={'$like':'%'+_0x421917[_0x2ec8('0x31')][_0x2ec8('0x3b')]+'%'};return _0x39ad27;}})});}_0x54a5d2=_[_0x2ec8('0x3d')]({},_0x54a5d2,_0x421917[_0x2ec8('0x3e')]);var _0x4f98bb={'where':_0x54a5d2[_0x2ec8('0x3c')]};return db['UserProfile'][_0x2ec8('0x21')](_0x4f98bb)[_0x2ec8('0x26')](function(_0x40faab){_0x10fd3c['count']=_0x40faab;if(_0x421917['query'][_0x2ec8('0x3f')]){_0x54a5d2['include']=[{'all':!![]}];}return db[_0x2ec8('0x2b')][_0x2ec8('0x40')](_0x54a5d2);})['then'](function(_0x21f408){_0x10fd3c[_0x2ec8('0x41')]=_0x21f408;return _0x10fd3c;})[_0x2ec8('0x26')](respondWithFilteredResult(_0x10e6ce,_0x54a5d2))['catch'](handleError(_0x10e6ce,null));};exports[_0x2ec8('0x42')]=function(_0x5e7536,_0xe375dc){var _0x20f8be={'raw':![],'where':{'id':_0x5e7536['params']['id']}},_0x1c6fac={};_0x1c6fac['model']=_[_0x2ec8('0x43')](db[_0x2ec8('0x2b')][_0x2ec8('0x2c')]);_0x1c6fac[_0x2ec8('0x31')]=_[_0x2ec8('0x43')](_0x5e7536[_0x2ec8('0x31')]);_0x1c6fac['filters']=_[_0x2ec8('0x33')](_0x1c6fac[_0x2ec8('0x35')],_0x1c6fac[_0x2ec8('0x31')]);_0x20f8be[_0x2ec8('0x34')]=_[_0x2ec8('0x33')](_0x1c6fac[_0x2ec8('0x35')],qs[_0x2ec8('0x36')](_0x5e7536[_0x2ec8('0x31')][_0x2ec8('0x36')]));_0x20f8be[_0x2ec8('0x34')]=_0x20f8be[_0x2ec8('0x34')][_0x2ec8('0x44')]?_0x20f8be[_0x2ec8('0x34')]:_0x1c6fac[_0x2ec8('0x35')];if(_0x5e7536['query'][_0x2ec8('0x3f')]){_0x20f8be[_0x2ec8('0x45')]=[{'all':!![]}];}_0x20f8be=_[_0x2ec8('0x3d')]({},_0x20f8be,_0x5e7536[_0x2ec8('0x3e')]);return db[_0x2ec8('0x2b')][_0x2ec8('0x46')](_0x20f8be)[_0x2ec8('0x26')](handleEntityNotFound(_0xe375dc,null))[_0x2ec8('0x26')](respondWithResult(_0xe375dc,null))[_0x2ec8('0x47')](handleError(_0xe375dc,null));};exports['create']=function(_0x188f5c,_0x49d819){return db[_0x2ec8('0x2b')][_0x2ec8('0x48')](_0x188f5c[_0x2ec8('0x49')],{})[_0x2ec8('0x26')](respondWithResult(_0x49d819,0xc9))['catch'](handleError(_0x49d819,null));};exports[_0x2ec8('0x4a')]=function(_0x21828d,_0x10199f){var _0x27419d={'where':{'id':_0x21828d[_0x2ec8('0x4b')]['id']}},_0x5d038f={};_0x5d038f[_0x2ec8('0x35')]=_[_0x2ec8('0x43')](db[_0x2ec8('0x2b')][_0x2ec8('0x2c')]);_0x27419d[_0x2ec8('0x34')]=_['intersection'](_0x5d038f['model'],qs[_0x2ec8('0x36')](_0x21828d[_0x2ec8('0x31')][_0x2ec8('0x36')]));_0x27419d[_0x2ec8('0x34')]=_0x27419d[_0x2ec8('0x34')]['length']?_0x27419d['attributes']:_0x5d038f[_0x2ec8('0x35')];if(_0x21828d[_0x2ec8('0x31')]['includeAll']){_0x27419d['include']=[{'all':!![]}];}_0x27419d=_['merge']({},_0x27419d,_0x21828d[_0x2ec8('0x3e')]);return db['UserProfile'][_0x2ec8('0x46')](_0x27419d)[_0x2ec8('0x26')](handleEntityNotFound(_0x10199f,null))[_0x2ec8('0x26')](function(_0x5422f7){if(_0x5422f7){var _0x2d4dc3=_0x5422f7[_0x2ec8('0x4c')]({'plain':!![]});_0x2d4dc3=qs[_0x2ec8('0x4d')](_0x2d4dc3,['id',_0x2ec8('0x4e'),'updatedAt',_0x2ec8('0x4f')]);_0x21828d[_0x2ec8('0x49')]=_[_0x2ec8('0x4d')](_0x21828d['body'],['id',_0x2ec8('0x4e'),'updatedAt']);return db[_0x2ec8('0x50')][_0x2ec8('0x51')](function(_0x524b0e){return db['UserProfile'][_0x2ec8('0x48')](_['merge'](_0x2d4dc3,_0x21828d[_0x2ec8('0x49')]),{'include':_0x21828d[_0x2ec8('0x31')][_0x2ec8('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0x524b0e})[_0x2ec8('0x26')](function(_0x1352fb){var _0x5500ef=_0x1352fb[_0x2ec8('0x4c')]({'plain':!![]});return db['UserProfileSection'][_0x2ec8('0x40')]({'where':{'userProfileId':_0x21828d[_0x2ec8('0x4b')]['id']},'raw':!![]})['then'](function(_0x32d182){if(_0x32d182){return BPromise[_0x2ec8('0x52')](_0x32d182,function(_0x2a6b8f){return new BPromise(function(_0x144d81,_0x1d1616){if(_0x2a6b8f[_0x2ec8('0x53')]===null||_0x2a6b8f[_0x2ec8('0x53')]===0x1)_0x144d81(null);return db[_0x2ec8('0x54')][_0x2ec8('0x40')]({'where':{'sectionId':_0x2a6b8f['id']},'raw':!![]})[_0x2ec8('0x26')](function(_0x3b18c8){var _0x1bbf7a=_[_0x2ec8('0x30')](_0x3b18c8,function(_0x54090e){return qs['omit'](_0x54090e,['id',_0x2ec8('0x4e'),'updatedAt',_0x2ec8('0x55')]);});_0x144d81(_0x1bbf7a);})[_0x2ec8('0x47')](function(_0x5c8fa3){_0x1d1616(_0x5c8fa3);});})['then'](function(_0x5d299c){var _0x569272=qs['omit'](_0x2a6b8f,['id',_0x2ec8('0x4e'),'updatedAt']);_0x569272['userProfileId']=_0x5500ef['id'];if(_0x5d299c)_0x569272['Resources']=_0x5d299c;return _0x569272;})[_0x2ec8('0x26')](function(_0x4cd920){return db[_0x2ec8('0x56')][_0x2ec8('0x48')](_0x4cd920,{'include':[{'model':db[_0x2ec8('0x54')],'as':'Resources'}],'raw':!![],'transaction':_0x524b0e});});})['then'](function(){return _0x5500ef;});}});});});}})[_0x2ec8('0x26')](respondWithResult(_0x10199f,0xc9))[_0x2ec8('0x47')](handleError(_0x10199f,null));};exports[_0x2ec8('0x57')]=function(_0x3237cf,_0x4aa0b0){if(_0x3237cf[_0x2ec8('0x49')]['id']){delete _0x3237cf[_0x2ec8('0x49')]['id'];}return db[_0x2ec8('0x2b')][_0x2ec8('0x46')]({'where':{'id':_0x3237cf[_0x2ec8('0x4b')]['id']}})[_0x2ec8('0x26')](handleEntityNotFound(_0x4aa0b0,null))[_0x2ec8('0x26')](saveUpdates(_0x3237cf[_0x2ec8('0x49')],null))[_0x2ec8('0x26')](respondWithResult(_0x4aa0b0,null))[_0x2ec8('0x47')](handleError(_0x4aa0b0,null));};exports['destroy']=function(_0x5af4ab,_0x41772a){return db[_0x2ec8('0x2b')][_0x2ec8('0x46')]({'where':{'id':_0x5af4ab[_0x2ec8('0x4b')]['id']}})[_0x2ec8('0x26')](handleEntityNotFound(_0x41772a,null))['then'](removeEntity(_0x41772a,null))[_0x2ec8('0x47')](handleError(_0x41772a,null));};exports[_0x2ec8('0x58')]=function(_0x2886ae,_0x4b49ac){return db[_0x2ec8('0x2b')][_0x2ec8('0x58')]()[_0x2ec8('0x26')](respondWithResult(_0x4b49ac,null))[_0x2ec8('0x47')](handleError(_0x4b49ac,null));};exports['addSections']=function(_0x34e973,_0x24ecc5){var _0x35e84e=_0x34e973[_0x2ec8('0x49')];return db[_0x2ec8('0x2b')][_0x2ec8('0x46')]({'where':{'id':_0x34e973[_0x2ec8('0x4b')]['id']}})[_0x2ec8('0x26')](handleEntityNotFound(_0x24ecc5,null))['then'](function(_0x365632){if(_0x365632){return db[_0x2ec8('0x50')][_0x2ec8('0x51')](function(_0x38d722){return db[_0x2ec8('0x56')]['destroy']({'where':{'userProfileId':_0x34e973[_0x2ec8('0x4b')]['id'],'sectionId':_[_0x2ec8('0x30')](_0x35e84e,function(_0x44d26a){return _0x44d26a[_0x2ec8('0x55')];})},'transaction':_0x38d722})[_0x2ec8('0x26')](function(){var _0x426be3=_['map'](_0x35e84e,function(_0x5a7617){_0x5a7617[_0x2ec8('0x59')]=_0x34e973[_0x2ec8('0x4b')]['id'];return _0x5a7617;});var _0x4e00f3=[];return BPromise[_0x2ec8('0x52')](_0x426be3,function(_0x741658){return db[_0x2ec8('0x56')][_0x2ec8('0x48')](_0x741658,{'include':[{'model':db['UserProfileResource'],'as':_0x2ec8('0x5a')}],'raw':!![],'transaction':_0x38d722})[_0x2ec8('0x26')](function(_0x940100){_0x4e00f3[_0x2ec8('0x5b')](_0x940100[_0x2ec8('0x4c')]({'plain':!![]}));});})[_0x2ec8('0x26')](function(){return _0x4e00f3;});});});}})[_0x2ec8('0x26')](function(_0x12958e){return _0x12958e;})[_0x2ec8('0x26')](respondWithResult(_0x24ecc5,null))[_0x2ec8('0x47')](handleError(_0x24ecc5,null));};exports[_0x2ec8('0x5c')]=function(_0x3e00c7,_0x50250e){var _0x333f16;return db[_0x2ec8('0x2b')][_0x2ec8('0x46')]({'where':{'id':_0x3e00c7[_0x2ec8('0x4b')]['id']},'attributes':['id',_0x2ec8('0x29')]})['then'](handleEntityNotFound(_0x50250e,null))[_0x2ec8('0x26')](function(_0x737e92){if(_0x737e92){_0x333f16=_0x737e92;return db['UserProfileSection'][_0x2ec8('0x27')]({'where':{'userProfileId':_0x3e00c7[_0x2ec8('0x4b')]['id'],'sectionId':_0x3e00c7[_0x2ec8('0x31')]['ids']}});}})[_0x2ec8('0x26')](function(){return _0x333f16;})[_0x2ec8('0x26')](respondWithStatusCode(_0x50250e,null))[_0x2ec8('0x47')](handleError(_0x50250e,null));};exports[_0x2ec8('0x5d')]=function(_0x1752f4,_0x3188b2){var _0x24e95b=[];var _0x1d903b=[];return db[_0x2ec8('0x56')][_0x2ec8('0x40')]({'where':{'userProfileId':_0x1752f4[_0x2ec8('0x4b')]['id']},'raw':!![]})['then'](function(_0x1296d4){_0x24e95b=_[_0x2ec8('0x3b')](_0x1296d4,function(_0x3f6219){return _0x3f6219[_0x2ec8('0x5e')]===0x1||_['includes']([0x3eb,0x709],_0x3f6219[_0x2ec8('0x55')]);});if(!_[_0x2ec8('0x5f')](_0x24e95b)){return _[_0x2ec8('0x30')](_0x24e95b,function(_0x2c5068){return _0x2c5068[_0x2ec8('0x55')];});}else{return;}})[_0x2ec8('0x26')](function(_0x5dc5fd){if(_0x5dc5fd)_0x1d903b=_0x5dc5fd;if(_['includes'](_0x1d903b,0x64)){var _0x3bdf26=_['find'](_0x24e95b,{'sectionId':0x64});return hasDefaultDashboard(_0x3bdf26)['then'](function(_0x264b65){return _[_0x2ec8('0x30')](_0x24e95b,function(_0xc28256){if(_0xc28256[_0x2ec8('0x55')]===0x64){_0xc28256[_0x2ec8('0x60')]=_0x264b65;}return _0xc28256;});});}else{return;}})[_0x2ec8('0x26')](function(_0x2bc809){if(_0x2bc809)_0x24e95b=_0x2bc809;if(_['includes'](_0x1d903b,0x3eb)){var _0x232c85=_['find'](_0x24e95b,{'sectionId':0x3eb});return getCustomDashboards(_0x232c85)['then'](function(_0x1f96e2){return _[_0x2ec8('0x30')](_0x24e95b,function(_0x4c00af){if(_0x232c85['enabled']){if(_0x4c00af[_0x2ec8('0x55')]===0x3eb){_0x4c00af[_0x2ec8('0x60')]=_0x1f96e2;}}else{if(_0x4c00af[_0x2ec8('0x55')]===0x64){_0x4c00af['subsections']=_0x1f96e2;}}return _0x4c00af;});});}else{return;}})[_0x2ec8('0x26')](function(_0x17d10d){if(_0x17d10d)_0x24e95b=_0x17d10d;if(_[_0x2ec8('0x61')](_0x1d903b,0x709)){var _0x7e9432=_[_0x2ec8('0x46')](_0x24e95b,{'sectionId':0x709});return getPlugins(_0x7e9432)['then'](function(_0x4a1eee){if(_0x7e9432[_0x2ec8('0x5e')]){return _[_0x2ec8('0x30')](_0x24e95b,function(_0x4f7ca0){if(_0x4f7ca0[_0x2ec8('0x55')]===0x709){_0x4f7ca0['subsections']=_0x4a1eee;}return _0x4f7ca0;});}else{var _0x26d59c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4a1eee};var _0x35c0de=_[_0x2ec8('0x30')](_0x24e95b);_0x35c0de[_0x2ec8('0x5b')](_0x26d59c);return _0x35c0de;}});}else{return;}})[_0x2ec8('0x26')](function(_0x3b38e8){if(_0x3b38e8)_0x24e95b=_0x3b38e8;return _[_0x2ec8('0x3b')](_0x24e95b,['enabled',0x1]);})[_0x2ec8('0x26')](respondWithResult(_0x3188b2,null))[_0x2ec8('0x47')](handleError(_0x3188b2,null));};function hasDefaultDashboard(_0x2f0f0f){var _0x56c561=[0x65];return new BPromise(function(_0x1d1eff,_0x558119){try{if(_0x2f0f0f['autoAssociation']){_0x1d1eff(_0x56c561);}else{return db[_0x2ec8('0x54')][_0x2ec8('0x62')]({'where':{'sectionId':_0x2f0f0f['id']},'raw':!![]})['then'](function(_0x57a649){_0x57a649?_0x1d1eff(_0x56c561):_0x1d1eff();});}}catch(_0xfe0ac){_0x558119(_0xfe0ac);}});}function getCustomDashboards(_0x4dc458){var _0x29d738=[];return new BPromise(function(_0x137405,_0x148eab){try{if(_0x4dc458[_0x2ec8('0x53')]){return db[_0x2ec8('0x63')]['findAll']({'raw':!![]})[_0x2ec8('0x26')](function(_0x31d5ce){_0x31d5ce[_0x2ec8('0x64')](function(_0xa8cce0){_0x29d738[_0x2ec8('0x5b')](_0xa8cce0['id']+0x1869f);});_0x137405(_0x29d738);});}else{return db[_0x2ec8('0x54')]['findAll']({'where':{'sectionId':_0x4dc458['id']},'raw':!![]})['then'](function(_0x29edf2){_0x29edf2[_0x2ec8('0x64')](function(_0x19259f){_0x29d738[_0x2ec8('0x5b')](_0x19259f[_0x2ec8('0x65')]+0x1869f);});_0x137405(_0x29d738);});}}catch(_0xf1dc3f){_0x148eab(_0xf1dc3f);}});}function getPlugins(_0x30e85f){var _0x3f8e70=[];return new BPromise(function(_0x5dd5a4,_0x34f2b8){try{if(_0x30e85f['autoAssociation']){return db[_0x2ec8('0x66')][_0x2ec8('0x40')]({'raw':!![]})['then'](function(_0x42c9a9){_0x42c9a9['forEach'](function(_0x5225b9){_0x3f8e70[_0x2ec8('0x5b')](_0x5225b9['id']+0x15b38);});_0x5dd5a4(_0x3f8e70);});}else{return db[_0x2ec8('0x54')][_0x2ec8('0x40')]({'where':{'sectionId':_0x30e85f['id']},'raw':!![]})[_0x2ec8('0x26')](function(_0x20289e){_0x20289e['forEach'](function(_0x1b0a5f){_0x3f8e70[_0x2ec8('0x5b')](_0x1b0a5f[_0x2ec8('0x65')]+0x15b38);});_0x5dd5a4(_0x3f8e70);});}}catch(_0xa88734){_0x34f2b8(_0xa88734);}});}exports[_0x2ec8('0x67')]=function(_0x1a6a5d,_0x530daa){return db[_0x2ec8('0x2b')][_0x2ec8('0x46')]({'where':{'id':_0x1a6a5d['params']['id']}})[_0x2ec8('0x26')](handleEntityNotFound(_0x530daa,null))[_0x2ec8('0x26')](function(_0x288bec){if(_0x288bec){return db['sequelize'][_0x2ec8('0x51')](function(_0x6c6b55){return db['UserProfileSection'][_0x2ec8('0x40')]({'where':{'userProfileId':_0x1a6a5d[_0x2ec8('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0x2ec8('0x26')](function(_0x3a5928){if(_0x3a5928){return db['UserProfileSection'][_0x2ec8('0x27')]({'where':{'userProfileId':_0x1a6a5d['params']['id'],'id':_[_0x2ec8('0x30')](_0x3a5928,function(_0x1e2b04){return _0x1e2b04['id'];})},'transaction':_0x6c6b55});}})[_0x2ec8('0x26')](function(_0x5e505a){var _0x5bc0e3=_[_0x2ec8('0x30')](_0x1a6a5d[_0x2ec8('0x49')],function(_0x5556f1){_0x5556f1[_0x2ec8('0x59')]=_0x1a6a5d[_0x2ec8('0x4b')]['id'];return _0x5556f1;});return db[_0x2ec8('0x56')]['bulkCreate'](_0x5bc0e3,{'raw':!![],'transaction':_0x6c6b55});})[_0x2ec8('0x26')](function(_0x3d4052){var _0x1561f8=_[_0x2ec8('0x3b')](_[_0x2ec8('0x30')](_0x3d4052,function(_0x2e8dc1){return _0x2e8dc1[_0x2ec8('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x1561f8){return db[_0x2ec8('0x56')]['findAll']({'where':{'userProfileId':_0x1a6a5d[_0x2ec8('0x4b')]['id'],'sectionId':_[_0x2ec8('0x30')](_0x1561f8,function(_0x282d99){return _0x282d99['sectionId'];})},'attributes':['id',_0x2ec8('0x55')],'raw':!![]})['then'](function(_0x2ef9bc){var _0xbbaa73=_[_0x2ec8('0x30')](_0x1a6a5d[_0x2ec8('0x49')],function(_0x3791ba){_0x3791ba[_0x2ec8('0x59')]=_0x1a6a5d[_0x2ec8('0x4b')]['id'];return _0x3791ba;});return db['UserProfileResource']['bulkCreate'](_0xbbaa73,{'raw':!![],'transaction':_0x6c6b55});});}})[_0x2ec8('0x47')](handleError(_0x530daa,null));});}})[_0x2ec8('0x26')](function(_0x4549d4){var _0x163dae=_[_0x2ec8('0x30')](_0x4549d4,function(_0x5f4d00){return _0x5f4d00[_0x2ec8('0x4c')]({'plain':!![]});});})[_0x2ec8('0x26')](respondWithResult(_0x530daa,null))[_0x2ec8('0x47')](handleError(_0x530daa,null));};exports[_0x2ec8('0x68')]=function(_0xf31004,_0x851d87,_0x5dac46){return db[_0x2ec8('0x2b')][_0x2ec8('0x46')]({'where':{'id':_0xf31004[_0x2ec8('0x4b')]['id']}})[_0x2ec8('0x26')](handleEntityNotFound(_0x851d87,null))[_0x2ec8('0x26')](function(_0x3ac7e5){if(_0x3ac7e5){return _0x3ac7e5[_0x2ec8('0x68')](_0xf31004[_0x2ec8('0x31')]['ids']);}})[_0x2ec8('0x26')](respondWithStatusCode(_0x851d87,null))[_0x2ec8('0x47')](handleError(_0x851d87,null));};exports[_0x2ec8('0x69')]=function(_0x50092d,_0x1f60af){var _0x3db8a4={'raw':![],'where':{}};var _0x38a0f1={};var _0x5b1cd7={'count':0x0,'rows':[]};var _0x7dd2b7=_0x50092d[_0x2ec8('0x31')]['section'];if(typeof _0x7dd2b7==='undefined'){throw new db[(_0x2ec8('0x6a'))][(_0x2ec8('0x6b'))](_0x2ec8('0x6c'));}var _0x4a36a7=_0x50092d['query'][_0x2ec8('0x6d')]||![];var _0x23087c=getQueryModels(_0x7dd2b7,_0x4a36a7);if(typeof _0x23087c[_0x2ec8('0x6e')]==='undefined'){throw new db[(_0x2ec8('0x6a'))][(_0x2ec8('0x6b'))]('Invalid\x20section\x20\x27'+_0x7dd2b7+'\x27');}var _0x2a608c=[];if(!_[_0x2ec8('0x5f')](_0x23087c['parentSections'])){_0x2a608c=_0x23087c[_0x2ec8('0x6f')];}else{_0x2a608c=[{'name':_0x7dd2b7}];}return db['UserProfile']['findOne']({'where':{'id':_0x50092d[_0x2ec8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1f60af,null))[_0x2ec8('0x26')](function(_0x3ef839){if(_0x3ef839){var _0x4f2f09=[];for(var _0x4ae740=0x0;_0x4ae740<_0x2a608c[_0x2ec8('0x44')];_0x4ae740++){_0x4f2f09[_0x2ec8('0x5b')](db[_0x2ec8('0x56')]['findOne']({'where':{'userProfileId':_0x3ef839['id'],'name':_0x2a608c[_0x4ae740][_0x2ec8('0x29')]},'raw':!![]}));}return BPromise[_0x2ec8('0x70')](_0x4f2f09);}})['then'](function(_0x1fb089){var _0x18a28d=_['filter'](_0x1fb089,function(_0x3c12ff){return _0x3c12ff?_0x3c12ff:undefined;});var _0x21c777=_[_0x2ec8('0x3b')](_0x2a608c,[_0x2ec8('0x71'),!![]]);var _0x2ffb27=_['isEmpty'](_0x18a28d)&&_[_0x2ec8('0x5f')](_0x21c777)?null:_[_0x2ec8('0x72')](_0x21c777,_0x18a28d);if(_0x2ffb27){var _0x2cc2a4=[];for(var _0x50c498=0x0;_0x50c498<_0x2ffb27[_0x2ec8('0x44')];_0x50c498++){var _0x2378b1=_[_0x2ec8('0x46')](_0x2a608c,function(_0x203bc9){return _0x2ffb27[_0x50c498]?_0x203bc9[_0x2ec8('0x29')]===_0x2ffb27[_0x50c498]['name']:null;});if(_0x2378b1){if(_0x2ffb27[_0x50c498][_0x2ec8('0x71')]){_0x2cc2a4[_0x2ec8('0x5b')](getAllResources(_0x23087c[_0x2ec8('0x6e')],_0x2ffb27[_0x50c498]));}else{if(!_0x2ffb27[_0x50c498][_0x2ec8('0x53')]){_0x2cc2a4['push'](getAllowedResources(_0x2378b1,_0x2ffb27[_0x50c498],_0x23087c[_0x2ec8('0x6e')]));}else{if(_0x2378b1[_0x2ec8('0x35')]){_0x2cc2a4[_0x2ec8('0x5b')](getAllFilteredResources(_0x2378b1,_0x2ffb27[_0x50c498]));}}}}}return BPromise[_0x2ec8('0x70')](_0x2cc2a4);}else{return null;}})[_0x2ec8('0x26')](function(_0x217f6a){var _0x274d11=_0x217f6a;var _0x21cfb0=null;if(_0x274d11){_0x21cfb0=_0x274d11[_0x2ec8('0x44')]===0x1?_0x274d11[0x0]:null;}if(_0x21cfb0||_0x274d11){var _0x16c291=db[_0x23087c[_0x2ec8('0x6e')]][_0x2ec8('0x2c')];_0x38a0f1[_0x2ec8('0x35')]=_['keys'](_0x16c291);_0x38a0f1[_0x2ec8('0x31')]=_[_0x2ec8('0x43')](_0x50092d[_0x2ec8('0x31')]);_0x38a0f1[_0x2ec8('0x32')]=_[_0x2ec8('0x33')](_0x38a0f1[_0x2ec8('0x35')],_0x38a0f1[_0x2ec8('0x31')]);_0x3db8a4[_0x2ec8('0x34')]=_['intersection'](_0x38a0f1[_0x2ec8('0x35')],qs[_0x2ec8('0x36')](_0x50092d[_0x2ec8('0x31')][_0x2ec8('0x36')]));_0x3db8a4['attributes']=_0x3db8a4[_0x2ec8('0x34')][_0x2ec8('0x44')]?_0x3db8a4[_0x2ec8('0x34')]:_0x38a0f1[_0x2ec8('0x35')];if(!_0x50092d['query']['hasOwnProperty'](_0x2ec8('0x38'))){_0x3db8a4['limit']=qs['limit'](_0x50092d[_0x2ec8('0x31')][_0x2ec8('0x39')]);_0x3db8a4[_0x2ec8('0x22')]=qs['offset'](_0x50092d[_0x2ec8('0x31')][_0x2ec8('0x22')]);}_0x3db8a4['order']=qs[_0x2ec8('0x3a')](_0x50092d['query']['sort']);_0x3db8a4[_0x2ec8('0x3c')]=qs['filters'](_['pick'](_0x50092d[_0x2ec8('0x31')],_0x38a0f1[_0x2ec8('0x32')]));if(_0x50092d[_0x2ec8('0x31')][_0x2ec8('0x3b')]){_0x3db8a4[_0x2ec8('0x3c')]=_[_0x2ec8('0x3d')](_0x3db8a4['where'],{'$or':_[_0x2ec8('0x30')](_0x16c291,function(_0x364b6d){if(_0x364b6d[_0x2ec8('0x2e')][_0x2ec8('0x2f')]!==_0x2ec8('0x73')){var _0x3d9cb8={};_0x3d9cb8[_0x364b6d[_0x2ec8('0x74')]]={'$like':'%'+_0x50092d[_0x2ec8('0x31')][_0x2ec8('0x3b')]+'%'};return _0x3d9cb8;}})});}var _0x253040=[];if(_0x21cfb0){var _0x40334a=_[_0x2ec8('0x46')](_0x2a608c,[_0x2ec8('0x29'),_0x21cfb0[_0x2ec8('0x29')]]);if(_0x40334a['field']){var _0x147e81={};if(_0x23087c[_0x2ec8('0x6e')]===_0x2ec8('0x75')){_0x147e81[_0x40334a[_0x2ec8('0x76')]]=_['map'](_0x21cfb0[_0x2ec8('0x77')],'id');}else{_0x147e81[_0x40334a[_0x2ec8('0x76')]]=_0x21cfb0[_0x2ec8('0x77')];}_0x253040[_0x2ec8('0x5b')](_0x147e81);}else{_0x3db8a4[_0x2ec8('0x3c')]['id']=_0x21cfb0[_0x2ec8('0x77')];}}else{for(var _0x34326f=0x0;_0x34326f<_0x274d11['length'];_0x34326f++){var _0x40334a=_['find'](_0x2a608c,[_0x2ec8('0x29'),_0x274d11[_0x34326f][_0x2ec8('0x29')]]);if(_0x40334a[_0x2ec8('0x74')]){var _0x147e81={};_0x147e81[_0x40334a[_0x2ec8('0x76')]]=_0x274d11[_0x34326f][_0x2ec8('0x77')];_0x253040[_0x2ec8('0x5b')](_0x147e81);}else{if(!_0x3db8a4[_0x2ec8('0x3c')]['id'])_0x3db8a4[_0x2ec8('0x3c')]['id']=[];_0x274d11[_0x34326f][_0x2ec8('0x77')][_0x2ec8('0x64')](function(_0x23ef81){_0x3db8a4[_0x2ec8('0x3c')]['id'][_0x2ec8('0x5b')](_0x23ef81);});}}}if(!_[_0x2ec8('0x5f')](_0x253040)){_0x3db8a4[_0x2ec8('0x3c')]=_[_0x2ec8('0x3d')](_0x3db8a4[_0x2ec8('0x3c')],{'$and':{'$or':_0x253040}});}_0x3db8a4=_[_0x2ec8('0x3d')]({},_0x3db8a4,_0x50092d[_0x2ec8('0x3e')]);if(_0x21cfb0&&!_0x21cfb0['autoAssociation']&&_0x23087c[_0x2ec8('0x6e')]==='AnalyticExtractedReport'){if(_0x50092d[_0x2ec8('0x31')][_0x2ec8('0x3f')]){_0x3db8a4[_0x2ec8('0x45')]=[{'all':!![]}];}return db[_0x23087c['childModel']][_0x2ec8('0x40')](_0x3db8a4)['then'](function(_0x50582a){var _0x386dc8=[];_0x50582a[_0x2ec8('0x64')](function(_0x2ba72e){var _0xf940e0;switch(_0x2ba72e[_0x2ec8('0x78')]){case _0x2ec8('0x79'):_0xf940e0=_[_0x2ec8('0x46')](_0x21cfb0['associatedResources'],function(_0x2087f1){return _0x2087f1['id']===_0x2ba72e['reportId']&&_0x2087f1[_0x2ec8('0x2e')]===_0x2ec8('0x7a');});break;case _0x2ec8('0x7b'):_0xf940e0=_[_0x2ec8('0x46')](_0x21cfb0[_0x2ec8('0x77')],function(_0x60e3bf){return _0x60e3bf['id']===_0x2ba72e['reportId']&&_0x60e3bf['type']===_0x2ec8('0x7c');});break;}if(_0xf940e0)_0x386dc8[_0x2ec8('0x5b')](_0x2ba72e);});_0x5b1cd7[_0x2ec8('0x21')]=_0x386dc8[_0x2ec8('0x44')];_0x5b1cd7[_0x2ec8('0x41')]=_0x386dc8;return _0x5b1cd7;});}else{return db[_0x23087c['childModel']][_0x2ec8('0x21')]({'where':_0x3db8a4['where']})['then'](function(_0x3c811e){_0x5b1cd7[_0x2ec8('0x21')]=_0x3c811e;if(_0x50092d['query'][_0x2ec8('0x3f')]){if(_0x23087c['childModel']==='CmContact'){_0x3db8a4[_0x2ec8('0x45')]=[{'model':db[_0x2ec8('0x7d')],'as':_0x2ec8('0x7e'),'attributes':['id','name',_0x2ec8('0x7f')],'required':_0x50092d['query'][_0x2ec8('0x80')]?!![]:![]},{'model':db['Tag'],'as':'ThroughTags','attributes':['id','name',_0x2ec8('0x7f')],'through':_0x50092d[_0x2ec8('0x31')][_0x2ec8('0x80')]?{'attributes':[],'where':{'TagId':_0x50092d[_0x2ec8('0x31')][_0x2ec8('0x80')]||undefined}}:{},'required':_0x50092d[_0x2ec8('0x31')][_0x2ec8('0x80')]?!![]:![]}];}else{_0x3db8a4[_0x2ec8('0x45')]=[{'all':!![]}];}}return db[_0x23087c['childModel']][_0x2ec8('0x40')](_0x3db8a4);})[_0x2ec8('0x26')](function(_0x39ca43){_0x5b1cd7[_0x2ec8('0x41')]=_0x39ca43;return _0x5b1cd7;});}}else{return _0x5b1cd7;}})[_0x2ec8('0x26')](respondWithFilteredResult(_0x1f60af,_0x3db8a4))[_0x2ec8('0x47')](handleError(_0x1f60af,null));};function getAllResources(_0x16912d,_0x1241f1){return new BPromise(function(_0x85a724,_0x5f3d79){if(_0x1241f1){var _0x6aea5e=_0x1241f1['filter']?{[_0x1241f1[_0x2ec8('0x3b')]['field']]:_0x1241f1[_0x2ec8('0x3b')][_0x2ec8('0x81')]}:undefined;return db[_0x16912d][_0x2ec8('0x40')]({'where':_0x6aea5e,'raw':!![]})[_0x2ec8('0x26')](function(_0x2817d4){_0x1241f1[_0x2ec8('0x77')]=_[_0x2ec8('0x30')](_0x2817d4,'id');_0x85a724(_0x1241f1);})[_0x2ec8('0x47')](function(_0x2a4ee5){_0x5f3d79(_0x2a4ee5);});}else{_0x85a724(null);}});}function getAllFilteredResources(_0x2d085d,_0x478391){return new BPromise(function(_0x31f17f,_0x54e6f9){var _0x157a33=_0x2d085d[_0x2ec8('0x3b')]?{[_0x2d085d[_0x2ec8('0x3b')][_0x2ec8('0x74')]]:_0x2d085d[_0x2ec8('0x3b')][_0x2ec8('0x81')]}:undefined;return db[_0x2d085d[_0x2ec8('0x35')]]['findAll']({'where':_0x157a33,'raw':!![]})[_0x2ec8('0x26')](function(_0x2e813b){_0x478391[_0x2ec8('0x77')]=_[_0x2ec8('0x30')](_0x2e813b,function(_0x437b4a){return _0x437b4a[_0x2ec8('0x29')];});_0x31f17f(_0x478391);})['catch'](function(_0x489aaf){_0x54e6f9(_0x489aaf);});});}function getAllowedResources(_0x55f619,_0xa88223,_0x1b6538){return new BPromise(function(_0x2aa0c6,_0x4c1ad2){if(_0xa88223){return db[_0x2ec8('0x54')][_0x2ec8('0x40')]({'where':{'sectionId':_0xa88223['id']},'raw':!![]})[_0x2ec8('0x26')](function(_0x45f110){if(_0x55f619[_0x2ec8('0x74')]&&_0x55f619[_0x2ec8('0x74')]!=='id'){_0xa88223[_0x2ec8('0x77')]=_['map'](_0x45f110,function(_0x2b8857){return _0x2b8857[_0x55f619[_0x2ec8('0x74')]];});}else{if(_0x1b6538===_0x2ec8('0x75')){_0xa88223['associatedResources']=_['map'](_0x45f110,function(_0x49979e){return{'id':_0x49979e['resourceId'],'type':_0x49979e['type']};});}else{_0xa88223['associatedResources']=_[_0x2ec8('0x30')](_0x45f110,function(_0x337a54){return _0x337a54[_0x2ec8('0x65')];});}}_0x2aa0c6(_0xa88223);})[_0x2ec8('0x47')](function(_0x27451d){_0x4c1ad2(_0x27451d);});}else{_0x2aa0c6(null);}});}function getQueryModels(_0x4d31f1,_0x48dfe5){var _0x3f9c1b=_0x4d31f1['toLowerCase']();var _0x4ee536={'childModel':undefined,'parentSections':[]};switch(_0x3f9c1b){case _0x2ec8('0x82'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0x83');break;case _0x2ec8('0x84'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0x85');break;case _0x2ec8('0x86'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0x87');_0x4ee536['parentSections']=[{'name':'SquareProjects','field':_0x2ec8('0x29'),'foreignKey':'projectName'}];break;case _0x2ec8('0x88'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0x89');break;case _0x2ec8('0x8a'):_0x4ee536['childModel']=_0x2ec8('0x8b');_0x4ee536[_0x2ec8('0x6f')]=[{'name':_0x2ec8('0x8c'),'field':'id','foreignKey':_0x2ec8('0x8d')}];break;case'lists':_0x4ee536[_0x2ec8('0x6e')]='CmList';break;case'companies':_0x4ee536[_0x2ec8('0x6e')]='CmCompany';break;case'globalcustomfields':_0x4ee536[_0x2ec8('0x6e')]='CmCustomField';break;case _0x2ec8('0x8e'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0x8f');break;case'chatwebsites':_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0x90');break;case _0x2ec8('0x91'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0x92');break;case _0x2ec8('0x93'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0x94');break;case _0x2ec8('0x95'):case _0x2ec8('0x96'):case _0x2ec8('0x97'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0x98');break;case _0x2ec8('0x99'):_0x4ee536[_0x2ec8('0x6e')]='VoiceContext';break;case _0x2ec8('0x9a'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0x9b');break;case _0x2ec8('0x9c'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0x9d');_0x4ee536['parentSections']=[{'name':_0x2ec8('0x9e'),'field':_0x2ec8('0x29'),'foreignKey':_0x2ec8('0x9f'),'model':'User','filter':{'field':_0x2ec8('0xa0'),'value':[_0x2ec8('0xa1')]}},{'name':_0x2ec8('0xa2'),'field':'name','foreignKey':_0x2ec8('0x9f'),'model':'User','filter':{'field':_0x2ec8('0xa0'),'value':['telephone']}},{'name':_0x2ec8('0xa3'),'field':_0x2ec8('0x29'),'foreignKey':_0x2ec8('0xa4'),'model':_0x2ec8('0xa5'),'filter':{'field':_0x2ec8('0x2e'),'value':[_0x2ec8('0xa6')]}},{'name':'QueueCampaigns','field':_0x2ec8('0x29'),'foreignKey':_0x2ec8('0xa4'),'model':_0x2ec8('0xa5'),'filter':{'field':_0x2ec8('0x2e'),'value':[_0x2ec8('0xa7')]}}];break;case _0x2ec8('0xa8'):_0x4ee536['childModel']='VoiceMusicOnHold';break;case _0x2ec8('0xa9'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0xaa');break;case _0x2ec8('0xab'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0xac');break;case _0x2ec8('0xad'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0xae');break;case _0x2ec8('0xaf'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0xb0');break;case _0x2ec8('0xb1'):_0x4ee536[_0x2ec8('0x6e')]='MailAccount';break;case _0x2ec8('0xb2'):_0x4ee536['childModel']=_0x2ec8('0xb3');break;case _0x2ec8('0xb4'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0xb5');break;case _0x2ec8('0xb6'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0xb7');break;case'smsqueues':_0x4ee536[_0x2ec8('0x6e')]='SmsQueue';break;case'smsaccounts':_0x4ee536['childModel']=_0x2ec8('0xb8');break;case'whatsappqueues':_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0xb9');break;case _0x2ec8('0xba'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0xbb');break;case _0x2ec8('0xbc'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0xbd');break;case'voicequeues':case _0x2ec8('0xbe'):_0x4ee536['childModel']='VoiceQueue';if(_0x48dfe5){_0x4ee536[_0x2ec8('0x6f')]=[{'name':_0x2ec8('0xa3')},{'name':'QueueCampaigns'}];}break;case _0x2ec8('0xbf'):case'agents':case _0x2ec8('0xc0'):_0x4ee536['childModel']=_0x2ec8('0xc1');if(_0x48dfe5){_0x4ee536[_0x2ec8('0x6f')]=[{'name':'Users','filter':{'field':_0x2ec8('0xa0'),'value':[_0x2ec8('0xc2'),_0x2ec8('0xc3')]},'ignore':!![]},{'name':_0x2ec8('0x9e')},{'name':_0x2ec8('0xa2')}];}break;case _0x2ec8('0xc4'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0xc5');break;case _0x2ec8('0xc6'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0xc7');break;case'freshdeskaccounts':_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0xc8');break;case _0x2ec8('0xc9'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0xca');break;case _0x2ec8('0xcb'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0xcc');break;case _0x2ec8('0xcd'):_0x4ee536['childModel']=_0x2ec8('0xce');break;case _0x2ec8('0xcf'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0xc1');break;case _0x2ec8('0xd0'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0xd1');break;case _0x2ec8('0xd2'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0xd3');break;case _0x2ec8('0xd4'):_0x4ee536['childModel']=_0x2ec8('0x63');break;case _0x2ec8('0xd5'):_0x4ee536['childModel']='Interval';break;case'pauses':_0x4ee536['childModel']=_0x2ec8('0xd6');break;case _0x2ec8('0xd7'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0xd8');break;case _0x2ec8('0xd9'):_0x4ee536['childModel']=_0x2ec8('0xda');break;case'tags':_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0x7d');break;case _0x2ec8('0xdb'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0xdc');break;case _0x2ec8('0xdd'):_0x4ee536['childModel']=_0x2ec8('0xde');break;case _0x2ec8('0xdf'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0xe0');break;case _0x2ec8('0xe1'):_0x4ee536[_0x2ec8('0x6e')]='Variable';break;case _0x2ec8('0xe2'):_0x4ee536[_0x2ec8('0x6e')]='Plugin';break;case _0x2ec8('0xe3'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0x75');_0x4ee536['parentSections']=[{'name':_0x2ec8('0xe4'),'field':'id','foreignKey':_0x2ec8('0xe5')}];break;case _0x2ec8('0xe6'):_0x4ee536[_0x2ec8('0x6e')]='AnalyticMetric';break;case _0x2ec8('0xba'):_0x4ee536[_0x2ec8('0x6e')]=_0x2ec8('0xbb');break;default:return _0x4ee536;}return _0x4ee536;} \ No newline at end of file +var _0x2054=['destroy','describe','addSections','removeSections','ids','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','push','resourceId','bulkCreate','removeResources','getResources','undefined','Sequelize','Unknown\x20section','mergeResources','childModel','ValidationError','Invalid\x20section\x20\x27','parentSections','all','ignore','pick','field','AnalyticExtractedReport','foreignKey','associatedResources','default','reportId','DefaultReports','CustomReports','CmContact','Tag','color','ThroughTags','tag','value','toLowerCase','SquareProject','odbc','SquareRecording','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','membername','agent','Telephones','User','role','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','intervals','Interval','pauses','Pause','Schedule','sounds','Sound','tags','templates','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','WhatsappAccount','html-pdf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','sendStatus','error','name','send','index','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','UserProfile','includeAll','rows','catch','show','params','keys','include','options','find','create','body','get','omit','createdAt','crudPermissions','updatedAt','sequelize','transaction','findAll','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection'];(function(_0x5caf38,_0x16565d){var _0x5b9553=function(_0x2830a5){while(--_0x2830a5){_0x5caf38['push'](_0x5caf38['shift']());}};_0x5b9553(++_0x16565d);}(_0x2054,0x176));var _0x4205=function(_0x27a0a9,_0x1e7dd1){_0x27a0a9=_0x27a0a9-0x0;var _0x11cb3b=_0x2054[_0x27a0a9];return _0x11cb3b;};'use strict';var pdf=require(_0x4205('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4205('0x1'));var rp=require(_0x4205('0x2'));var moment=require(_0x4205('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4205('0x4'));var sox=require(_0x4205('0x5'));var csv=require(_0x4205('0x6'));var ejs=require(_0x4205('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4205('0x8'));var crypto=require('crypto');var jsforce=require(_0x4205('0x9'));var deskjs=require(_0x4205('0xa'));var toCsv=require(_0x4205('0x6'));var querystring=require(_0x4205('0xb'));var Papa=require(_0x4205('0xc'));var Redis=require(_0x4205('0xd'));var authService=require(_0x4205('0xe'));var qs=require(_0x4205('0xf'));var as=require(_0x4205('0x10'));var hardwareService=require(_0x4205('0x11'));var logger=require(_0x4205('0x12'))(_0x4205('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4205('0x14'));var db=require(_0x4205('0x15'))['db'];config['redis']=_[_0x4205('0x16')](config['redis'],{'host':_0x4205('0x17'),'port':0x18eb});var socket=require(_0x4205('0x18'))(new Redis(config['redis']));require(_0x4205('0x19'))[_0x4205('0x1a')](socket);function respondWithStatusCode(_0x52d1a3,_0x4e660b){_0x4e660b=_0x4e660b||0xcc;return function(_0xe88024){if(_0xe88024){return _0x52d1a3['sendStatus'](_0x4e660b);}return _0x52d1a3[_0x4205('0x1b')](_0x4e660b)[_0x4205('0x1c')]();};}function respondWithResult(_0x37249d,_0x194895){_0x194895=_0x194895||0xc8;return function(_0xddc017){if(_0xddc017){return _0x37249d['status'](_0x194895)[_0x4205('0x1d')](_0xddc017);}};}function respondWithFilteredResult(_0x57a3ef,_0x311820){return function(_0x2ba0d5){if(_0x2ba0d5){var _0x496426=_0x2ba0d5[_0x4205('0x1e')],_0x3345c2=_0x311820[_0x4205('0x1f')],_0x337593=_0x311820[_0x4205('0x1f')]+_0x311820[_0x4205('0x20')],_0x51a84f;if(_0x337593>=_0x496426){_0x337593=_0x496426;_0x51a84f=0xc8;}else{_0x51a84f=0xce;}_0x57a3ef[_0x4205('0x1b')](_0x51a84f);return _0x57a3ef['set'](_0x4205('0x21'),_0x3345c2+'-'+_0x337593+'/'+_0x496426)[_0x4205('0x1d')](_0x2ba0d5);}return null;};}function patchUpdates(_0x2ec2c9){return function(_0x769164){try{jsonpatch[_0x4205('0x22')](_0x769164,_0x2ec2c9,!![]);}catch(_0x1e2b77){return BPromise['reject'](_0x1e2b77);}return _0x769164[_0x4205('0x23')]();};}function saveUpdates(_0x5153c7,_0x2edf47){return function(_0xda1b9d){if(_0xda1b9d){return _0xda1b9d[_0x4205('0x24')](_0x5153c7)[_0x4205('0x25')](function(_0x4cff77){return _0x4cff77;});}return null;};}function removeEntity(_0x9b7df0,_0x1c66a8){return function(_0x28c931){if(_0x28c931){return _0x28c931['destroy']()[_0x4205('0x25')](function(){_0x9b7df0[_0x4205('0x1b')](0xcc)[_0x4205('0x1c')]();});}};}function handleEntityNotFound(_0x59e1d0,_0x37d66c){return function(_0x4511df){if(!_0x4511df){_0x59e1d0[_0x4205('0x26')](0x194);}return _0x4511df;};}function handleError(_0x2299b0,_0x4de791){_0x4de791=_0x4de791||0x1f4;return function(_0xe4d382){logger[_0x4205('0x27')](_0xe4d382['stack']);if(_0xe4d382[_0x4205('0x28')]){delete _0xe4d382[_0x4205('0x28')];}_0x2299b0['status'](_0x4de791)[_0x4205('0x29')](_0xe4d382);};}exports[_0x4205('0x2a')]=function(_0x14ee18,_0x56fb7b){var _0x20bc29={},_0x502f2a={},_0x4d524e={'count':0x0,'rows':[]};var _0x41ca3f=_['map'](db['UserProfile'][_0x4205('0x2b')],function(_0x6d1fa){return{'name':_0x6d1fa[_0x4205('0x2c')],'type':_0x6d1fa[_0x4205('0x2d')][_0x4205('0x2e')]};});_0x502f2a['model']=_[_0x4205('0x2f')](_0x41ca3f,_0x4205('0x28'));_0x502f2a[_0x4205('0x30')]=_['keys'](_0x14ee18[_0x4205('0x30')]);_0x502f2a[_0x4205('0x31')]=_[_0x4205('0x32')](_0x502f2a[_0x4205('0x33')],_0x502f2a[_0x4205('0x30')]);_0x20bc29[_0x4205('0x34')]=_['intersection'](_0x502f2a['model'],qs[_0x4205('0x35')](_0x14ee18[_0x4205('0x30')][_0x4205('0x35')]));_0x20bc29[_0x4205('0x34')]=_0x20bc29[_0x4205('0x34')][_0x4205('0x36')]?_0x20bc29[_0x4205('0x34')]:_0x502f2a['model'];if(!_0x14ee18['query'][_0x4205('0x37')](_0x4205('0x38'))){_0x20bc29[_0x4205('0x20')]=qs[_0x4205('0x20')](_0x14ee18['query'][_0x4205('0x20')]);_0x20bc29[_0x4205('0x1f')]=qs[_0x4205('0x1f')](_0x14ee18[_0x4205('0x30')][_0x4205('0x1f')]);}_0x20bc29[_0x4205('0x39')]=qs[_0x4205('0x3a')](_0x14ee18[_0x4205('0x30')]['sort']);_0x20bc29[_0x4205('0x3b')]=qs['filters'](_['pick'](_0x14ee18['query'],_0x502f2a[_0x4205('0x31')]),_0x41ca3f);if(_0x14ee18[_0x4205('0x30')][_0x4205('0x3c')]){_0x20bc29[_0x4205('0x3b')]=_[_0x4205('0x3d')](_0x20bc29['where'],{'$or':_[_0x4205('0x2f')](_0x41ca3f,function(_0x30491b){if(_0x30491b['type']!==_0x4205('0x3e')){var _0x5dcfb4={};_0x5dcfb4[_0x30491b[_0x4205('0x28')]]={'$like':'%'+_0x14ee18['query'][_0x4205('0x3c')]+'%'};return _0x5dcfb4;}})});}_0x20bc29=_['merge']({},_0x20bc29,_0x14ee18['options']);var _0x4c28f5={'where':_0x20bc29[_0x4205('0x3b')]};return db[_0x4205('0x3f')][_0x4205('0x1e')](_0x4c28f5)[_0x4205('0x25')](function(_0x16d065){_0x4d524e[_0x4205('0x1e')]=_0x16d065;if(_0x14ee18['query'][_0x4205('0x40')]){_0x20bc29['include']=[{'all':!![]}];}return db[_0x4205('0x3f')]['findAll'](_0x20bc29);})['then'](function(_0xd3d46f){_0x4d524e[_0x4205('0x41')]=_0xd3d46f;return _0x4d524e;})[_0x4205('0x25')](respondWithFilteredResult(_0x56fb7b,_0x20bc29))[_0x4205('0x42')](handleError(_0x56fb7b,null));};exports[_0x4205('0x43')]=function(_0x557f61,_0x12cd4f){var _0x589f74={'raw':![],'where':{'id':_0x557f61[_0x4205('0x44')]['id']}},_0x487492={};_0x487492['model']=_['keys'](db[_0x4205('0x3f')]['rawAttributes']);_0x487492[_0x4205('0x30')]=_[_0x4205('0x45')](_0x557f61[_0x4205('0x30')]);_0x487492['filters']=_[_0x4205('0x32')](_0x487492[_0x4205('0x33')],_0x487492[_0x4205('0x30')]);_0x589f74[_0x4205('0x34')]=_[_0x4205('0x32')](_0x487492[_0x4205('0x33')],qs[_0x4205('0x35')](_0x557f61[_0x4205('0x30')][_0x4205('0x35')]));_0x589f74[_0x4205('0x34')]=_0x589f74[_0x4205('0x34')][_0x4205('0x36')]?_0x589f74[_0x4205('0x34')]:_0x487492['model'];if(_0x557f61['query'][_0x4205('0x40')]){_0x589f74[_0x4205('0x46')]=[{'all':!![]}];}_0x589f74=_['merge']({},_0x589f74,_0x557f61[_0x4205('0x47')]);return db[_0x4205('0x3f')][_0x4205('0x48')](_0x589f74)[_0x4205('0x25')](handleEntityNotFound(_0x12cd4f,null))[_0x4205('0x25')](respondWithResult(_0x12cd4f,null))[_0x4205('0x42')](handleError(_0x12cd4f,null));};exports['create']=function(_0x3ff14b,_0x1a2030){return db[_0x4205('0x3f')][_0x4205('0x49')](_0x3ff14b[_0x4205('0x4a')],{})[_0x4205('0x25')](respondWithResult(_0x1a2030,0xc9))[_0x4205('0x42')](handleError(_0x1a2030,null));};exports['clone']=function(_0x43aa3f,_0x16b52c){var _0x47d69c={'where':{'id':_0x43aa3f['params']['id']}},_0x2bfa9f={};_0x2bfa9f['model']=_[_0x4205('0x45')](db[_0x4205('0x3f')]['rawAttributes']);_0x47d69c[_0x4205('0x34')]=_[_0x4205('0x32')](_0x2bfa9f[_0x4205('0x33')],qs[_0x4205('0x35')](_0x43aa3f[_0x4205('0x30')][_0x4205('0x35')]));_0x47d69c[_0x4205('0x34')]=_0x47d69c['attributes'][_0x4205('0x36')]?_0x47d69c[_0x4205('0x34')]:_0x2bfa9f[_0x4205('0x33')];if(_0x43aa3f[_0x4205('0x30')][_0x4205('0x40')]){_0x47d69c[_0x4205('0x46')]=[{'all':!![]}];}_0x47d69c=_[_0x4205('0x3d')]({},_0x47d69c,_0x43aa3f[_0x4205('0x47')]);return db[_0x4205('0x3f')]['find'](_0x47d69c)[_0x4205('0x25')](handleEntityNotFound(_0x16b52c,null))[_0x4205('0x25')](function(_0x44dd2b){if(_0x44dd2b){var _0x15eee7=_0x44dd2b[_0x4205('0x4b')]({'plain':!![]});_0x15eee7=qs[_0x4205('0x4c')](_0x15eee7,['id',_0x4205('0x4d'),'updatedAt',_0x4205('0x4e')]);_0x43aa3f['body']=_['omit'](_0x43aa3f[_0x4205('0x4a')],['id',_0x4205('0x4d'),_0x4205('0x4f')]);return db[_0x4205('0x50')][_0x4205('0x51')](function(_0xea5750){return db[_0x4205('0x3f')][_0x4205('0x49')](_[_0x4205('0x3d')](_0x15eee7,_0x43aa3f[_0x4205('0x4a')]),{'include':_0x43aa3f[_0x4205('0x30')][_0x4205('0x40')]?[{'all':!![]}]:undefined,'transaction':_0xea5750})['then'](function(_0x4c0419){var _0x21105f=_0x4c0419[_0x4205('0x4b')]({'plain':!![]});return db['UserProfileSection'][_0x4205('0x52')]({'where':{'userProfileId':_0x43aa3f[_0x4205('0x44')]['id']},'raw':!![]})[_0x4205('0x25')](function(_0x15c33f){if(_0x15c33f){return BPromise[_0x4205('0x53')](_0x15c33f,function(_0x4a8d87){return new BPromise(function(_0x42ebee,_0x489daf){if(_0x4a8d87[_0x4205('0x54')]===null||_0x4a8d87[_0x4205('0x54')]===0x1)_0x42ebee(null);return db[_0x4205('0x55')][_0x4205('0x52')]({'where':{'sectionId':_0x4a8d87['id']},'raw':!![]})[_0x4205('0x25')](function(_0x6c5e05){var _0x23c401=_[_0x4205('0x2f')](_0x6c5e05,function(_0x1e78a1){return qs[_0x4205('0x4c')](_0x1e78a1,['id','createdAt',_0x4205('0x4f'),_0x4205('0x56')]);});_0x42ebee(_0x23c401);})['catch'](function(_0x452e8d){_0x489daf(_0x452e8d);});})[_0x4205('0x25')](function(_0x3d15cc){var _0x501249=qs['omit'](_0x4a8d87,['id',_0x4205('0x4d'),'updatedAt']);_0x501249[_0x4205('0x57')]=_0x21105f['id'];if(_0x3d15cc)_0x501249[_0x4205('0x58')]=_0x3d15cc;return _0x501249;})[_0x4205('0x25')](function(_0x59c086){return db[_0x4205('0x59')][_0x4205('0x49')](_0x59c086,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0xea5750});});})[_0x4205('0x25')](function(){return _0x21105f;});}});});});}})['then'](respondWithResult(_0x16b52c,0xc9))[_0x4205('0x42')](handleError(_0x16b52c,null));};exports[_0x4205('0x24')]=function(_0x4afaee,_0x21d71e){if(_0x4afaee[_0x4205('0x4a')]['id']){delete _0x4afaee[_0x4205('0x4a')]['id'];}return db[_0x4205('0x3f')][_0x4205('0x48')]({'where':{'id':_0x4afaee[_0x4205('0x44')]['id']}})['then'](handleEntityNotFound(_0x21d71e,null))['then'](saveUpdates(_0x4afaee[_0x4205('0x4a')],null))['then'](respondWithResult(_0x21d71e,null))[_0x4205('0x42')](handleError(_0x21d71e,null));};exports[_0x4205('0x5a')]=function(_0x20c4aa,_0x1ba040){return db['UserProfile'][_0x4205('0x48')]({'where':{'id':_0x20c4aa['params']['id']}})['then'](handleEntityNotFound(_0x1ba040,null))['then'](removeEntity(_0x1ba040,null))[_0x4205('0x42')](handleError(_0x1ba040,null));};exports[_0x4205('0x5b')]=function(_0x245faf,_0x2e402e){return db[_0x4205('0x3f')][_0x4205('0x5b')]()['then'](respondWithResult(_0x2e402e,null))['catch'](handleError(_0x2e402e,null));};exports[_0x4205('0x5c')]=function(_0x42e94c,_0x44daf4){var _0x3ac048=_0x42e94c[_0x4205('0x4a')];return db[_0x4205('0x3f')][_0x4205('0x48')]({'where':{'id':_0x42e94c[_0x4205('0x44')]['id']}})['then'](handleEntityNotFound(_0x44daf4,null))[_0x4205('0x25')](function(_0x2940dc){if(_0x2940dc){return db[_0x4205('0x50')][_0x4205('0x51')](function(_0x25ef6a){return db['UserProfileSection'][_0x4205('0x5a')]({'where':{'userProfileId':_0x42e94c[_0x4205('0x44')]['id'],'sectionId':_[_0x4205('0x2f')](_0x3ac048,function(_0x441dd7){return _0x441dd7[_0x4205('0x56')];})},'transaction':_0x25ef6a})[_0x4205('0x25')](function(){var _0x159676=_['map'](_0x3ac048,function(_0x1f9ebf){_0x1f9ebf['userProfileId']=_0x42e94c[_0x4205('0x44')]['id'];return _0x1f9ebf;});var _0x3ee3f9=[];return BPromise[_0x4205('0x53')](_0x159676,function(_0x21a019){return db[_0x4205('0x59')]['create'](_0x21a019,{'include':[{'model':db[_0x4205('0x55')],'as':_0x4205('0x58')}],'raw':!![],'transaction':_0x25ef6a})[_0x4205('0x25')](function(_0xa151b7){_0x3ee3f9['push'](_0xa151b7[_0x4205('0x4b')]({'plain':!![]}));});})[_0x4205('0x25')](function(){return _0x3ee3f9;});});});}})[_0x4205('0x25')](function(_0x2400f1){return _0x2400f1;})[_0x4205('0x25')](respondWithResult(_0x44daf4,null))[_0x4205('0x42')](handleError(_0x44daf4,null));};exports[_0x4205('0x5d')]=function(_0x462880,_0x58dffe){var _0x40882a;return db[_0x4205('0x3f')][_0x4205('0x48')]({'where':{'id':_0x462880['params']['id']},'attributes':['id',_0x4205('0x28')]})['then'](handleEntityNotFound(_0x58dffe,null))['then'](function(_0xa5a9b3){if(_0xa5a9b3){_0x40882a=_0xa5a9b3;return db[_0x4205('0x59')]['destroy']({'where':{'userProfileId':_0x462880[_0x4205('0x44')]['id'],'sectionId':_0x462880['query'][_0x4205('0x5e')]}});}})['then'](function(){return _0x40882a;})[_0x4205('0x25')](respondWithStatusCode(_0x58dffe,null))[_0x4205('0x42')](handleError(_0x58dffe,null));};exports['getSections']=function(_0x2585e1,_0x2af95d){var _0xc78e82=[];var _0x497882=[];return db[_0x4205('0x59')][_0x4205('0x52')]({'where':{'userProfileId':_0x2585e1['params']['id']},'raw':!![]})[_0x4205('0x25')](function(_0x247422){_0xc78e82=_['filter'](_0x247422,function(_0x5a1028){return _0x5a1028[_0x4205('0x5f')]===0x1||_[_0x4205('0x60')]([0x3eb,0x709],_0x5a1028[_0x4205('0x56')]);});if(!_[_0x4205('0x61')](_0xc78e82)){return _[_0x4205('0x2f')](_0xc78e82,function(_0x5d66f4){return _0x5d66f4['sectionId'];});}else{return;}})[_0x4205('0x25')](function(_0x2f2c17){if(_0x2f2c17)_0x497882=_0x2f2c17;if(_[_0x4205('0x60')](_0x497882,0x64)){var _0x1338ca=_[_0x4205('0x48')](_0xc78e82,{'sectionId':0x64});return hasDefaultDashboard(_0x1338ca)[_0x4205('0x25')](function(_0x387ae7){return _[_0x4205('0x2f')](_0xc78e82,function(_0x27808e){if(_0x27808e[_0x4205('0x56')]===0x64){_0x27808e[_0x4205('0x62')]=_0x387ae7;}return _0x27808e;});});}else{return;}})[_0x4205('0x25')](function(_0x42225c){if(_0x42225c)_0xc78e82=_0x42225c;if(_[_0x4205('0x60')](_0x497882,0x3eb)){var _0x448b93=_[_0x4205('0x48')](_0xc78e82,{'sectionId':0x3eb});return getCustomDashboards(_0x448b93)[_0x4205('0x25')](function(_0x336395){return _[_0x4205('0x2f')](_0xc78e82,function(_0x23c203){if(_0x448b93[_0x4205('0x5f')]){if(_0x23c203[_0x4205('0x56')]===0x3eb){_0x23c203[_0x4205('0x62')]=_0x336395;}}else{if(_0x23c203[_0x4205('0x56')]===0x64){_0x23c203[_0x4205('0x62')]=_0x336395;}}return _0x23c203;});});}else{return;}})['then'](function(_0x2f9efa){if(_0x2f9efa)_0xc78e82=_0x2f9efa;if(_[_0x4205('0x60')](_0x497882,0x709)){var _0x1a2d9b=_['find'](_0xc78e82,{'sectionId':0x709});return getPlugins(_0x1a2d9b)[_0x4205('0x25')](function(_0x44ac03){if(_0x1a2d9b['enabled']){return _[_0x4205('0x2f')](_0xc78e82,function(_0x1641c0){if(_0x1641c0[_0x4205('0x56')]===0x709){_0x1641c0[_0x4205('0x62')]=_0x44ac03;}return _0x1641c0;});}else{var _0x1274c0={'sectionId':0x76c,'enabled':0x1,'subsections':_0x44ac03};var _0xceec31=_[_0x4205('0x2f')](_0xc78e82);_0xceec31['push'](_0x1274c0);return _0xceec31;}});}else{return;}})['then'](function(_0x230ddb){if(_0x230ddb)_0xc78e82=_0x230ddb;return _[_0x4205('0x3c')](_0xc78e82,[_0x4205('0x5f'),0x1]);})[_0x4205('0x25')](respondWithResult(_0x2af95d,null))[_0x4205('0x42')](handleError(_0x2af95d,null));};function hasDefaultDashboard(_0x271cc4){var _0x2af572=[0x65];return new BPromise(function(_0x9acd16,_0x23eb6f){try{if(_0x271cc4[_0x4205('0x54')]){_0x9acd16(_0x2af572);}else{return db['UserProfileResource'][_0x4205('0x63')]({'where':{'sectionId':_0x271cc4['id']},'raw':!![]})['then'](function(_0x201969){_0x201969?_0x9acd16(_0x2af572):_0x9acd16();});}}catch(_0x4cf121){_0x23eb6f(_0x4cf121);}});}function getCustomDashboards(_0x37c32c){var _0x5513cc=[];return new BPromise(function(_0x3505af,_0x301965){try{if(_0x37c32c['autoAssociation']){return db[_0x4205('0x64')][_0x4205('0x52')]({'raw':!![]})['then'](function(_0x251338){_0x251338[_0x4205('0x65')](function(_0x24525e){_0x5513cc[_0x4205('0x66')](_0x24525e['id']+0x1869f);});_0x3505af(_0x5513cc);});}else{return db['UserProfileResource'][_0x4205('0x52')]({'where':{'sectionId':_0x37c32c['id']},'raw':!![]})[_0x4205('0x25')](function(_0x586f15){_0x586f15[_0x4205('0x65')](function(_0x321c73){_0x5513cc[_0x4205('0x66')](_0x321c73['resourceId']+0x1869f);});_0x3505af(_0x5513cc);});}}catch(_0x24c567){_0x301965(_0x24c567);}});}function getPlugins(_0x4f7ab0){var _0x3fc505=[];return new BPromise(function(_0x31396a,_0x3fa63b){try{if(_0x4f7ab0['autoAssociation']){return db['Plugin']['findAll']({'raw':!![]})['then'](function(_0x2234a0){_0x2234a0[_0x4205('0x65')](function(_0x5c4c5d){_0x3fc505['push'](_0x5c4c5d['id']+0x15b38);});_0x31396a(_0x3fc505);});}else{return db['UserProfileResource'][_0x4205('0x52')]({'where':{'sectionId':_0x4f7ab0['id']},'raw':!![]})[_0x4205('0x25')](function(_0x1ca056){_0x1ca056['forEach'](function(_0x13e3ec){_0x3fc505[_0x4205('0x66')](_0x13e3ec[_0x4205('0x67')]+0x15b38);});_0x31396a(_0x3fc505);});}}catch(_0x48fa77){_0x3fa63b(_0x48fa77);}});}exports['addResources']=function(_0x553f70,_0x17cc15){return db['UserProfile']['find']({'where':{'id':_0x553f70['params']['id']}})[_0x4205('0x25')](handleEntityNotFound(_0x17cc15,null))[_0x4205('0x25')](function(_0x1a6e44){if(_0x1a6e44){return db[_0x4205('0x50')]['transaction'](function(_0x432967){return db[_0x4205('0x59')][_0x4205('0x52')]({'where':{'userProfileId':_0x553f70['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x4f9aaf){if(_0x4f9aaf){return db[_0x4205('0x59')][_0x4205('0x5a')]({'where':{'userProfileId':_0x553f70[_0x4205('0x44')]['id'],'id':_[_0x4205('0x2f')](_0x4f9aaf,function(_0x5affc8){return _0x5affc8['id'];})},'transaction':_0x432967});}})[_0x4205('0x25')](function(_0x1627f2){var _0x17e022=_[_0x4205('0x2f')](_0x553f70[_0x4205('0x4a')],function(_0x1024f8){_0x1024f8[_0x4205('0x57')]=_0x553f70[_0x4205('0x44')]['id'];return _0x1024f8;});return db[_0x4205('0x59')][_0x4205('0x68')](_0x17e022,{'raw':!![],'transaction':_0x432967});})[_0x4205('0x25')](function(_0x1290d6){var _0x503516=_[_0x4205('0x3c')](_['map'](_0x1290d6,function(_0x567ca9){return _0x567ca9[_0x4205('0x4b')]({'plain':!![]});}),{'includeAll':![]});if(_0x503516){return db[_0x4205('0x59')][_0x4205('0x52')]({'where':{'userProfileId':_0x553f70[_0x4205('0x44')]['id'],'sectionId':_[_0x4205('0x2f')](_0x503516,function(_0x44fa5d){return _0x44fa5d['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x5a7e6f){var _0x274bac=_[_0x4205('0x2f')](_0x553f70[_0x4205('0x4a')],function(_0x29de4d){_0x29de4d[_0x4205('0x57')]=_0x553f70[_0x4205('0x44')]['id'];return _0x29de4d;});return db[_0x4205('0x55')][_0x4205('0x68')](_0x274bac,{'raw':!![],'transaction':_0x432967});});}})[_0x4205('0x42')](handleError(_0x17cc15,null));});}})[_0x4205('0x25')](function(_0x3d0d8c){var _0x550065=_[_0x4205('0x2f')](_0x3d0d8c,function(_0xf4946e){return _0xf4946e[_0x4205('0x4b')]({'plain':!![]});});})['then'](respondWithResult(_0x17cc15,null))[_0x4205('0x42')](handleError(_0x17cc15,null));};exports[_0x4205('0x69')]=function(_0x5c233f,_0x211abb,_0x1e59a4){return db[_0x4205('0x3f')][_0x4205('0x48')]({'where':{'id':_0x5c233f[_0x4205('0x44')]['id']}})[_0x4205('0x25')](handleEntityNotFound(_0x211abb,null))[_0x4205('0x25')](function(_0x56a3cf){if(_0x56a3cf){return _0x56a3cf[_0x4205('0x69')](_0x5c233f[_0x4205('0x30')][_0x4205('0x5e')]);}})['then'](respondWithStatusCode(_0x211abb,null))['catch'](handleError(_0x211abb,null));};exports[_0x4205('0x6a')]=function(_0x257797,_0x55b8fe){var _0x1a9be4={'raw':![],'where':{}};var _0x33e28d={};var _0x78956f={'count':0x0,'rows':[]};var _0x2e6c7c=_0x257797[_0x4205('0x30')]['section'];if(typeof _0x2e6c7c===_0x4205('0x6b')){throw new db[(_0x4205('0x6c'))]['ValidationError'](_0x4205('0x6d'));}var _0x181c95=_0x257797[_0x4205('0x30')][_0x4205('0x6e')]||![];var _0x5edbdd=getQueryModels(_0x2e6c7c,_0x181c95);if(typeof _0x5edbdd[_0x4205('0x6f')]==='undefined'){throw new db[(_0x4205('0x6c'))][(_0x4205('0x70'))](_0x4205('0x71')+_0x2e6c7c+'\x27');}var _0x45e33c=[];if(!_[_0x4205('0x61')](_0x5edbdd[_0x4205('0x72')])){_0x45e33c=_0x5edbdd[_0x4205('0x72')];}else{_0x45e33c=[{'name':_0x2e6c7c}];}return db[_0x4205('0x3f')][_0x4205('0x63')]({'where':{'id':_0x257797[_0x4205('0x44')]['id']}})[_0x4205('0x25')](handleEntityNotFound(_0x55b8fe,null))[_0x4205('0x25')](function(_0x33f340){if(_0x33f340){var _0x576c6e=[];for(var _0x23b5ae=0x0;_0x23b5ae<_0x45e33c[_0x4205('0x36')];_0x23b5ae++){_0x576c6e[_0x4205('0x66')](db[_0x4205('0x59')][_0x4205('0x63')]({'where':{'userProfileId':_0x33f340['id'],'name':_0x45e33c[_0x23b5ae][_0x4205('0x28')]},'raw':!![]}));}return BPromise[_0x4205('0x73')](_0x576c6e);}})[_0x4205('0x25')](function(_0x45236b){var _0x1de29d=_[_0x4205('0x3c')](_0x45236b,function(_0x37053e){return _0x37053e?_0x37053e:undefined;});var _0x2eba37=_[_0x4205('0x3c')](_0x45e33c,[_0x4205('0x74'),!![]]);var _0x22d244=_[_0x4205('0x61')](_0x1de29d)&&_['isEmpty'](_0x2eba37)?null:_['union'](_0x2eba37,_0x1de29d);if(_0x22d244){var _0xeaf488=[];for(var _0x7d15dc=0x0;_0x7d15dc<_0x22d244['length'];_0x7d15dc++){var _0x2f6b7a=_[_0x4205('0x48')](_0x45e33c,function(_0x4af000){return _0x22d244[_0x7d15dc]?_0x4af000[_0x4205('0x28')]===_0x22d244[_0x7d15dc][_0x4205('0x28')]:null;});if(_0x2f6b7a){if(_0x22d244[_0x7d15dc][_0x4205('0x74')]){_0xeaf488[_0x4205('0x66')](getAllResources(_0x5edbdd[_0x4205('0x6f')],_0x22d244[_0x7d15dc]));}else{if(!_0x22d244[_0x7d15dc][_0x4205('0x54')]){_0xeaf488[_0x4205('0x66')](getAllowedResources(_0x2f6b7a,_0x22d244[_0x7d15dc],_0x5edbdd[_0x4205('0x6f')]));}else{if(_0x2f6b7a[_0x4205('0x33')]){_0xeaf488[_0x4205('0x66')](getAllFilteredResources(_0x2f6b7a,_0x22d244[_0x7d15dc]));}}}}}return BPromise[_0x4205('0x73')](_0xeaf488);}else{return null;}})[_0x4205('0x25')](function(_0x501ce0){var _0x459a6c=_0x501ce0;var _0x2f36ee=null;if(_0x459a6c){_0x2f36ee=_0x459a6c[_0x4205('0x36')]===0x1?_0x459a6c[0x0]:null;}if(_0x2f36ee||_0x459a6c){var _0x4395d3=db[_0x5edbdd[_0x4205('0x6f')]]['rawAttributes'];_0x33e28d[_0x4205('0x33')]=_[_0x4205('0x45')](_0x4395d3);_0x33e28d[_0x4205('0x30')]=_[_0x4205('0x45')](_0x257797[_0x4205('0x30')]);_0x33e28d[_0x4205('0x31')]=_[_0x4205('0x32')](_0x33e28d[_0x4205('0x33')],_0x33e28d['query']);_0x1a9be4['attributes']=_[_0x4205('0x32')](_0x33e28d[_0x4205('0x33')],qs[_0x4205('0x35')](_0x257797[_0x4205('0x30')][_0x4205('0x35')]));_0x1a9be4[_0x4205('0x34')]=_0x1a9be4[_0x4205('0x34')][_0x4205('0x36')]?_0x1a9be4[_0x4205('0x34')]:_0x33e28d[_0x4205('0x33')];if(!_0x257797[_0x4205('0x30')][_0x4205('0x37')](_0x4205('0x38'))){_0x1a9be4[_0x4205('0x20')]=qs['limit'](_0x257797[_0x4205('0x30')][_0x4205('0x20')]);_0x1a9be4[_0x4205('0x1f')]=qs['offset'](_0x257797[_0x4205('0x30')][_0x4205('0x1f')]);}_0x1a9be4[_0x4205('0x39')]=qs['sort'](_0x257797[_0x4205('0x30')][_0x4205('0x3a')]);_0x1a9be4[_0x4205('0x3b')]=qs[_0x4205('0x31')](_[_0x4205('0x75')](_0x257797[_0x4205('0x30')],_0x33e28d['filters']));if(_0x257797[_0x4205('0x30')]['filter']){_0x1a9be4['where']=_['merge'](_0x1a9be4['where'],{'$or':_[_0x4205('0x2f')](_0x4395d3,function(_0x2a61e3){if(_0x2a61e3[_0x4205('0x2d')][_0x4205('0x2e')]!==_0x4205('0x3e')){var _0x41c018={};_0x41c018[_0x2a61e3[_0x4205('0x76')]]={'$like':'%'+_0x257797[_0x4205('0x30')]['filter']+'%'};return _0x41c018;}})});}var _0x8aece7=[];if(_0x2f36ee){var _0x8bddf1=_[_0x4205('0x48')](_0x45e33c,['name',_0x2f36ee['name']]);if(_0x8bddf1[_0x4205('0x76')]){var _0x1698bc={};if(_0x5edbdd['childModel']===_0x4205('0x77')){_0x1698bc[_0x8bddf1[_0x4205('0x78')]]=_['map'](_0x2f36ee['associatedResources'],'id');}else{_0x1698bc[_0x8bddf1[_0x4205('0x78')]]=_0x2f36ee[_0x4205('0x79')];}_0x8aece7[_0x4205('0x66')](_0x1698bc);}else{_0x1a9be4[_0x4205('0x3b')]['id']=_0x2f36ee[_0x4205('0x79')];}}else{for(var _0x1946e0=0x0;_0x1946e0<_0x459a6c[_0x4205('0x36')];_0x1946e0++){var _0x8bddf1=_[_0x4205('0x48')](_0x45e33c,[_0x4205('0x28'),_0x459a6c[_0x1946e0]['name']]);if(_0x8bddf1['field']){var _0x1698bc={};_0x1698bc[_0x8bddf1['foreignKey']]=_0x459a6c[_0x1946e0]['associatedResources'];_0x8aece7[_0x4205('0x66')](_0x1698bc);}else{if(!_0x1a9be4[_0x4205('0x3b')]['id'])_0x1a9be4['where']['id']=[];_0x459a6c[_0x1946e0]['associatedResources'][_0x4205('0x65')](function(_0x3129a8){_0x1a9be4[_0x4205('0x3b')]['id'][_0x4205('0x66')](_0x3129a8);});}}}if(!_[_0x4205('0x61')](_0x8aece7)){_0x1a9be4[_0x4205('0x3b')]=_[_0x4205('0x3d')](_0x1a9be4[_0x4205('0x3b')],{'$and':{'$or':_0x8aece7}});}_0x1a9be4=_['merge']({},_0x1a9be4,_0x257797[_0x4205('0x47')]);if(_0x2f36ee&&!_0x2f36ee['autoAssociation']&&_0x5edbdd['childModel']==='AnalyticExtractedReport'){if(_0x257797[_0x4205('0x30')][_0x4205('0x40')]){_0x1a9be4['include']=[{'all':!![]}];}return db[_0x5edbdd['childModel']][_0x4205('0x52')](_0x1a9be4)[_0x4205('0x25')](function(_0x1d0546){var _0x9bd37e=[];_0x1d0546[_0x4205('0x65')](function(_0x4f8d3a){var _0x4f545b;switch(_0x4f8d3a['reportType']){case _0x4205('0x7a'):_0x4f545b=_[_0x4205('0x48')](_0x2f36ee[_0x4205('0x79')],function(_0x3b2905){return _0x3b2905['id']===_0x4f8d3a[_0x4205('0x7b')]&&_0x3b2905[_0x4205('0x2d')]===_0x4205('0x7c');});break;case'custom':_0x4f545b=_['find'](_0x2f36ee[_0x4205('0x79')],function(_0x577e97){return _0x577e97['id']===_0x4f8d3a[_0x4205('0x7b')]&&_0x577e97[_0x4205('0x2d')]===_0x4205('0x7d');});break;}if(_0x4f545b)_0x9bd37e[_0x4205('0x66')](_0x4f8d3a);});_0x78956f[_0x4205('0x1e')]=_0x9bd37e[_0x4205('0x36')];_0x78956f['rows']=_0x9bd37e;return _0x78956f;});}else{return db[_0x5edbdd[_0x4205('0x6f')]]['count']({'where':_0x1a9be4[_0x4205('0x3b')]})['then'](function(_0x2b5df7){_0x78956f[_0x4205('0x1e')]=_0x2b5df7;if(_0x257797['query'][_0x4205('0x40')]){if(_0x5edbdd[_0x4205('0x6f')]===_0x4205('0x7e')){_0x1a9be4['include']=[{'model':db[_0x4205('0x7f')],'as':'Tags','attributes':['id',_0x4205('0x28'),_0x4205('0x80')],'required':_0x257797['query']['tag']?!![]:![]},{'model':db[_0x4205('0x7f')],'as':_0x4205('0x81'),'attributes':['id','name',_0x4205('0x80')],'through':_0x257797[_0x4205('0x30')]['tag']?{'attributes':[],'where':{'TagId':_0x257797[_0x4205('0x30')]['tag']||undefined}}:{},'required':_0x257797[_0x4205('0x30')][_0x4205('0x82')]?!![]:![]}];}else{_0x1a9be4[_0x4205('0x46')]=[{'all':!![]}];}}return db[_0x5edbdd[_0x4205('0x6f')]][_0x4205('0x52')](_0x1a9be4);})['then'](function(_0x437368){_0x78956f[_0x4205('0x41')]=_0x437368;return _0x78956f;});}}else{return _0x78956f;}})[_0x4205('0x25')](respondWithFilteredResult(_0x55b8fe,_0x1a9be4))['catch'](handleError(_0x55b8fe,null));};function getAllResources(_0x31f7f4,_0x4a26d4){return new BPromise(function(_0x59e134,_0x289dad){if(_0x4a26d4){var _0x5293a9=_0x4a26d4[_0x4205('0x3c')]?{[_0x4a26d4[_0x4205('0x3c')][_0x4205('0x76')]]:_0x4a26d4['filter'][_0x4205('0x83')]}:undefined;return db[_0x31f7f4][_0x4205('0x52')]({'where':_0x5293a9,'raw':!![]})[_0x4205('0x25')](function(_0x44a1cc){_0x4a26d4['associatedResources']=_['map'](_0x44a1cc,'id');_0x59e134(_0x4a26d4);})['catch'](function(_0xf6522f){_0x289dad(_0xf6522f);});}else{_0x59e134(null);}});}function getAllFilteredResources(_0xa7f512,_0x44157b){return new BPromise(function(_0x4e945a,_0x19e07c){var _0x3ca2bc=_0xa7f512[_0x4205('0x3c')]?{[_0xa7f512[_0x4205('0x3c')][_0x4205('0x76')]]:_0xa7f512[_0x4205('0x3c')][_0x4205('0x83')]}:undefined;return db[_0xa7f512['model']][_0x4205('0x52')]({'where':_0x3ca2bc,'raw':!![]})[_0x4205('0x25')](function(_0x254515){_0x44157b['associatedResources']=_['map'](_0x254515,function(_0x1e134f){return _0x1e134f['name'];});_0x4e945a(_0x44157b);})[_0x4205('0x42')](function(_0x3d16aa){_0x19e07c(_0x3d16aa);});});}function getAllowedResources(_0x44fb15,_0xe45bfa,_0x45189c){return new BPromise(function(_0x3d41eb,_0x2379e0){if(_0xe45bfa){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0xe45bfa['id']},'raw':!![]})[_0x4205('0x25')](function(_0x642d3e){if(_0x44fb15[_0x4205('0x76')]&&_0x44fb15['field']!=='id'){_0xe45bfa['associatedResources']=_['map'](_0x642d3e,function(_0x2db49e){return _0x2db49e[_0x44fb15['field']];});}else{if(_0x45189c==='AnalyticExtractedReport'){_0xe45bfa['associatedResources']=_[_0x4205('0x2f')](_0x642d3e,function(_0x5388f8){return{'id':_0x5388f8['resourceId'],'type':_0x5388f8[_0x4205('0x2d')]};});}else{_0xe45bfa[_0x4205('0x79')]=_[_0x4205('0x2f')](_0x642d3e,function(_0x2a387e){return _0x2a387e[_0x4205('0x67')];});}}_0x3d41eb(_0xe45bfa);})['catch'](function(_0x9a144a){_0x2379e0(_0x9a144a);});}else{_0x3d41eb(null);}});}function getQueryModels(_0x2cf31e,_0x38ac7b){var _0x4cc0f8=_0x2cf31e[_0x4205('0x84')]();var _0x2e3dcf={'childModel':undefined,'parentSections':[]};switch(_0x4cc0f8){case'squareprojects':_0x2e3dcf['childModel']=_0x4205('0x85');break;case _0x4205('0x86'):_0x2e3dcf[_0x4205('0x6f')]='SquareOdbc';break;case'squarerecordings':_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0x87');_0x2e3dcf[_0x4205('0x72')]=[{'name':'SquareProjects','field':_0x4205('0x28'),'foreignKey':_0x4205('0x88')}];break;case _0x4205('0x89'):_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0x8a');break;case _0x4205('0x8b'):_0x2e3dcf[_0x4205('0x6f')]='CmContact';_0x2e3dcf[_0x4205('0x72')]=[{'name':_0x4205('0x8c'),'field':'id','foreignKey':_0x4205('0x8d')}];break;case _0x4205('0x8e'):_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0x8f');break;case _0x4205('0x90'):_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0x91');break;case'globalcustomfields':_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0x92');break;case _0x4205('0x93'):_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0x94');break;case'chatwebsites':_0x2e3dcf['childModel']=_0x4205('0x95');break;case'faxqueues':_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0x96');break;case _0x4205('0x97'):_0x2e3dcf['childModel']=_0x4205('0x98');break;case'inboundroutes':case _0x4205('0x99'):case _0x4205('0x9a'):_0x2e3dcf[_0x4205('0x6f')]='VoiceExtension';break;case _0x4205('0x9b'):_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0x9c');break;case _0x4205('0x9d'):_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0x9e');break;case'voicerecordings':_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0x9f');_0x2e3dcf[_0x4205('0x72')]=[{'name':_0x4205('0xa0'),'field':_0x4205('0x28'),'foreignKey':_0x4205('0xa1'),'model':'User','filter':{'field':'role','value':[_0x4205('0xa2')]}},{'name':_0x4205('0xa3'),'field':_0x4205('0x28'),'foreignKey':_0x4205('0xa1'),'model':_0x4205('0xa4'),'filter':{'field':_0x4205('0xa5'),'value':[_0x4205('0xa6')]}},{'name':_0x4205('0xa7'),'field':'name','foreignKey':_0x4205('0xa8'),'model':_0x4205('0xa9'),'filter':{'field':'type','value':['inbound']}},{'name':_0x4205('0xaa'),'field':_0x4205('0x28'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x4205('0x2d'),'value':['outbound']}}];break;case _0x4205('0xab'):_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0xac');break;case _0x4205('0xad'):_0x2e3dcf['childModel']=_0x4205('0xae');break;case _0x4205('0xaf'):_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0xb0');break;case _0x4205('0xb1'):_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0xb2');break;case'mailqueues':_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0xb3');break;case'mailaccounts':_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0xb4');break;case'mailsubstatuses':_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0xb5');break;case _0x4205('0xb6'):_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0xb7');break;case'openchannelaccounts':_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0xb8');break;case _0x4205('0xb9'):_0x2e3dcf[_0x4205('0x6f')]='SmsQueue';break;case _0x4205('0xba'):_0x2e3dcf['childModel']=_0x4205('0xbb');break;case _0x4205('0xbc'):_0x2e3dcf['childModel']=_0x4205('0xbd');break;case _0x4205('0xbe'):_0x2e3dcf[_0x4205('0x6f')]='WhatsappAccount';break;case _0x4205('0xbf'):_0x2e3dcf['childModel']=_0x4205('0xc0');break;case'voicequeues':case'queuecampaigns':_0x2e3dcf[_0x4205('0x6f')]='VoiceQueue';if(_0x38ac7b){_0x2e3dcf[_0x4205('0x72')]=[{'name':_0x4205('0xa7')},{'name':'QueueCampaigns'}];}break;case'users':case'agents':case _0x4205('0xc1'):_0x2e3dcf['childModel']=_0x4205('0xa4');if(_0x38ac7b){_0x2e3dcf[_0x4205('0x72')]=[{'name':_0x4205('0xc2'),'filter':{'field':_0x4205('0xa5'),'value':[_0x4205('0xc3'),_0x4205('0xc4')]},'ignore':!![]},{'name':_0x4205('0xa0')},{'name':_0x4205('0xa3')}];}break;case _0x4205('0xc5'):_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0xc6');break;case _0x4205('0xc7'):_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0xc8');break;case _0x4205('0xc9'):_0x2e3dcf['childModel']=_0x4205('0xca');break;case'sugarcrmaccounts':_0x2e3dcf[_0x4205('0x6f')]='SugarcrmAccount';break;case _0x4205('0xcb'):_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0xcc');break;case _0x4205('0xcd'):_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0xce');break;case _0x4205('0xcf'):_0x2e3dcf[_0x4205('0x6f')]='User';break;case _0x4205('0xd0'):_0x2e3dcf['childModel']=_0x4205('0xd1');break;case _0x4205('0xd2'):_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0xd3');break;case'customdashboards':_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0x64');break;case _0x4205('0xd4'):_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0xd5');break;case _0x4205('0xd6'):_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0xd7');break;case'scheduler':_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0xd8');break;case _0x4205('0xd9'):_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0xda');break;case _0x4205('0xdb'):_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0x7f');break;case _0x4205('0xdc'):_0x2e3dcf[_0x4205('0x6f')]='Template';break;case'triggers':_0x2e3dcf['childModel']=_0x4205('0xdd');break;case _0x4205('0xde'):_0x2e3dcf['childModel']=_0x4205('0xdf');break;case _0x4205('0xe0'):_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0xe1');break;case _0x4205('0xe2'):_0x2e3dcf[_0x4205('0x6f')]='Plugin';break;case _0x4205('0xe3'):_0x2e3dcf[_0x4205('0x6f')]='AnalyticExtractedReport';_0x2e3dcf['parentSections']=[{'name':_0x4205('0xe4'),'field':'id','foreignKey':_0x4205('0x7b')}];break;case _0x4205('0xe5'):_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0xe6');break;case _0x4205('0xbe'):_0x2e3dcf[_0x4205('0x6f')]=_0x4205('0xe7');break;default:return _0x2e3dcf;}return _0x2e3dcf;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 96068ac..fac4474 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 _0xda04=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','update'];(function(_0x30fd2c,_0x253f5f){var _0x5b77b5=function(_0x58521d){while(--_0x58521d){_0x30fd2c['push'](_0x30fd2c['shift']());}};_0x5b77b5(++_0x253f5f);}(_0xda04,0x79));var _0x4da0=function(_0x426267,_0x422e6e){_0x426267=_0x426267-0x0;var _0x59e163=_0xda04[_0x426267];return _0x59e163;};'use strict';var EventEmitter=require(_0x4da0('0x0'));var UserProfile=require(_0x4da0('0x1'))['db'][_0x4da0('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x4da0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4da0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x120a43){return function(_0x1599f3,_0x89f8f7,_0x27a02b){UserProfileEvents[_0x4da0('0x5')](_0x120a43+':'+_0x1599f3['id'],_0x1599f3);UserProfileEvents[_0x4da0('0x5')](_0x120a43,_0x1599f3);_0x27a02b(null);};}for(var e in events){if(events[_0x4da0('0x6')](e)){var event=events[e];UserProfile[_0x4da0('0x7')](e,emitEvent(event));}}module[_0x4da0('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x0e0d=['hasOwnProperty','hook','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit'];(function(_0x1becca,_0x4bfcfe){var _0x277483=function(_0x38671a){while(--_0x38671a){_0x1becca['push'](_0x1becca['shift']());}};_0x277483(++_0x4bfcfe);}(_0x0e0d,0x65));var _0xd0e0=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x0e0d[_0x1d1779];return _0x2377e9;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xd0e0('0x0'))['db'][_0xd0e0('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xd0e0('0x2')](0x0);var events={'afterCreate':_0xd0e0('0x3'),'afterUpdate':_0xd0e0('0x4'),'afterDestroy':_0xd0e0('0x5')};function emitEvent(_0x315803){return function(_0x32ade0,_0x32a08c,_0x5e9467){UserProfileEvents[_0xd0e0('0x6')](_0x315803+':'+_0x32ade0['id'],_0x32ade0);UserProfileEvents[_0xd0e0('0x6')](_0x315803,_0x32ade0);_0x5e9467(null);};}for(var e in events){if(events[_0xd0e0('0x7')](e)){var event=events[e];UserProfile[_0xd0e0('0x8')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 3d74a33..08cd80d 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 _0x91a8=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfile.attributes','exports','define','UserProfile','user_profiles'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x91a8,0x75));var _0x891a=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x91a8[_0x6cf19c];return _0xce14f3;};'use strict';var _=require('lodash');var util=require(_0x891a('0x0'));var logger=require(_0x891a('0x1'))(_0x891a('0x2'));var moment=require(_0x891a('0x3'));var BPromise=require(_0x891a('0x4'));var rp=require(_0x891a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x891a('0x6'));var config=require(_0x891a('0x7'));var attributes=require(_0x891a('0x8'));module[_0x891a('0x9')]=function(_0x577c62,_0xb5dfcc){return _0x577c62[_0x891a('0xa')](_0x891a('0xb'),attributes,{'tableName':_0x891a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b0f=['moment','bluebird','path','rimraf','../../config/environment','define','UserProfile','user_profiles','util'];(function(_0x1e50ce,_0x330023){var _0x5af6a2=function(_0x113c4a){while(--_0x113c4a){_0x1e50ce['push'](_0x1e50ce['shift']());}};_0x5af6a2(++_0x330023);}(_0x4b0f,0x170));var _0xf4b0=function(_0x18c575,_0x3e74e0){_0x18c575=_0x18c575-0x0;var _0x150071=_0x4b0f[_0x18c575];return _0x150071;};'use strict';var _=require('lodash');var util=require(_0xf4b0('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf4b0('0x1'));var BPromise=require(_0xf4b0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4b0('0x3'));var rimraf=require(_0xf4b0('0x4'));var config=require(_0xf4b0('0x5'));var attributes=require('./userProfile.attributes');module['exports']=function(_0x4e1f68,_0x11ecf7){return _0x4e1f68[_0xf4b0('0x6')](_0xf4b0('0x7'),attributes,{'tableName':_0xf4b0('0x8'),'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 e9cf741..eaa1504 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 _0xeda8=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xeda8,0x104));var _0x8eda=function(_0x3e6833,_0x3d39ac){_0x3e6833=_0x3e6833-0x0;var _0x22e7a5=_0xeda8[_0x3e6833];return _0x22e7a5;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var moment=require('moment');var BPromise=require(_0x8eda('0x2'));var rs=require(_0x8eda('0x3'));var fs=require('fs');var Redis=require(_0x8eda('0x4'));var db=require(_0x8eda('0x5'))['db'];var utils=require(_0x8eda('0x6'));var logger=require(_0x8eda('0x7'))(_0x8eda('0x8'));var config=require(_0x8eda('0x9'));var jayson=require(_0x8eda('0xa'));var client=jayson[_0x8eda('0xb')][_0x8eda('0xc')]({'port':0x232a});config[_0x8eda('0xd')]=_['defaults'](config[_0x8eda('0xd')],{'host':_0x8eda('0xe'),'port':0x18eb});var socket=require(_0x8eda('0xf'))(new Redis(config[_0x8eda('0xd')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x488849,_0x4fbf0a,_0xe69181){return new BPromise(function(_0x2d3739,_0x41442d){return client['request'](_0x488849,_0xe69181)[_0x8eda('0x10')](function(_0x5a80ca){logger[_0x8eda('0x11')](_0x8eda('0x12'),_0x4fbf0a,_0x8eda('0x13'));logger[_0x8eda('0x14')](_0x8eda('0x15'),_0x4fbf0a,_0x8eda('0x13'),JSON[_0x8eda('0x16')](_0x5a80ca));if(_0x5a80ca[_0x8eda('0x17')]){if(_0x5a80ca['error']['code']===0x1f4){logger[_0x8eda('0x17')](_0x8eda('0x12'),_0x4fbf0a,_0x5a80ca['error'][_0x8eda('0x18')]);return _0x41442d(_0x5a80ca[_0x8eda('0x17')][_0x8eda('0x18')]);}logger['error'](_0x8eda('0x12'),_0x4fbf0a,_0x5a80ca['error'][_0x8eda('0x18')]);return _0x2d3739(_0x5a80ca['error'][_0x8eda('0x18')]);}else{logger['info'](_0x8eda('0x12'),_0x4fbf0a,_0x8eda('0x13'));_0x2d3739(_0x5a80ca['result']['message']);}})[_0x8eda('0x19')](function(_0x1b7e94){logger[_0x8eda('0x17')](_0x8eda('0x12'),_0x4fbf0a,_0x1b7e94);_0x41442d(_0x1b7e94);});});} \ No newline at end of file +var _0x7fbe=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment'];(function(_0x2f57b2,_0xa8e91a){var _0x5ace77=function(_0x59c00a){while(--_0x59c00a){_0x2f57b2['push'](_0x2f57b2['shift']());}};_0x5ace77(++_0xa8e91a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x41caac,_0x50c421){_0x41caac=_0x41caac-0x0;var _0x28d2ba=_0x7fbe[_0x41caac];return _0x28d2ba;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});config[_0xe7fb('0xc')]=_[_0xe7fb('0xd')](config['redis'],{'host':_0xe7fb('0xe'),'port':0x18eb});var socket=require(_0xe7fb('0xf'))(new Redis(config[_0xe7fb('0xc')]));require(_0xe7fb('0x10'))['register'](socket);function respondWithRpcPromise(_0x558857,_0x29edb2,_0x2f2ea0){return new BPromise(function(_0x41a514,_0x348a73){return client[_0xe7fb('0x11')](_0x558857,_0x2f2ea0)[_0xe7fb('0x12')](function(_0x3e934b){logger[_0xe7fb('0x13')](_0xe7fb('0x14'),_0x29edb2,_0xe7fb('0x15'));logger[_0xe7fb('0x16')](_0xe7fb('0x17'),_0x29edb2,_0xe7fb('0x15'),JSON[_0xe7fb('0x18')](_0x3e934b));if(_0x3e934b[_0xe7fb('0x19')]){if(_0x3e934b['error'][_0xe7fb('0x1a')]===0x1f4){logger[_0xe7fb('0x19')]('UserProfile,\x20%s,\x20%s',_0x29edb2,_0x3e934b[_0xe7fb('0x19')][_0xe7fb('0x1b')]);return _0x348a73(_0x3e934b['error'][_0xe7fb('0x1b')]);}logger['error'](_0xe7fb('0x14'),_0x29edb2,_0x3e934b[_0xe7fb('0x19')][_0xe7fb('0x1b')]);return _0x41a514(_0x3e934b[_0xe7fb('0x19')]['message']);}else{logger[_0xe7fb('0x13')]('UserProfile,\x20%s,\x20%s',_0x29edb2,_0xe7fb('0x15'));_0x41a514(_0x3e934b['result'][_0xe7fb('0x1b')]);}})[_0xe7fb('0x1c')](function(_0x3f96a7){logger[_0xe7fb('0x19')]('UserProfile,\x20%s,\x20%s',_0x29edb2,_0x3f96a7);_0x348a73(_0x3f96a7);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index a7a8a23..7a61442 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 _0x6e6d=['update','register','./userProfile.events','save','remove'];(function(_0x248449,_0x1cfa1c){var _0x1d1665=function(_0x2da8b9){while(--_0x2da8b9){_0x248449['push'](_0x248449['shift']());}};_0x1d1665(++_0x1cfa1c);}(_0x6e6d,0x1c9));var _0xd6e6=function(_0x49c064,_0x520c94){_0x49c064=_0x49c064-0x0;var _0x15fa6f=_0x6e6d[_0x49c064];return _0x15fa6f;};'use strict';var UserProfileEvents=require(_0xd6e6('0x0'));var events=[_0xd6e6('0x1'),_0xd6e6('0x2'),_0xd6e6('0x3')];function createListener(_0x45def8,_0x5c84fa){return function(_0x1c10eb){_0x5c84fa['emit'](_0x45def8,_0x1c10eb);};}function removeListener(_0x3ef604,_0x591621){return function(){UserProfileEvents['removeListener'](_0x3ef604,_0x591621);};}exports[_0xd6e6('0x4')]=function(_0x51eb21){for(var _0xd9a988=0x0,_0x421d90=events['length'];_0xd9a988<_0x421d90;_0xd9a988++){var _0x5648b1=events[_0xd9a988];var _0x129c93=createListener('userProfile:'+_0x5648b1,_0x51eb21);UserProfileEvents['on'](_0x5648b1,_0x129c93);}}; \ No newline at end of file +var _0x537b=['removeListener','length','./userProfile.events','save','update','emit'];(function(_0x2ead73,_0x1e5683){var _0x2fb701=function(_0x5f10c4){while(--_0x5f10c4){_0x2ead73['push'](_0x2ead73['shift']());}};_0x2fb701(++_0x1e5683);}(_0x537b,0x140));var _0xb537=function(_0x4bd97f,_0x16cca0){_0x4bd97f=_0x4bd97f-0x0;var _0xe038fe=_0x537b[_0x4bd97f];return _0xe038fe;};'use strict';var UserProfileEvents=require(_0xb537('0x0'));var events=[_0xb537('0x1'),'remove',_0xb537('0x2')];function createListener(_0x4c29cc,_0x425e2f){return function(_0x3179e9){_0x425e2f[_0xb537('0x3')](_0x4c29cc,_0x3179e9);};}function removeListener(_0x222736,_0xe97931){return function(){UserProfileEvents[_0xb537('0x4')](_0x222736,_0xe97931);};}exports['register']=function(_0x26b4b4){for(var _0x9e6022=0x0,_0x2a506f=events[_0xb537('0x5')];_0x9e6022<_0x2a506f;_0x9e6022++){var _0x257b77=events[_0x9e6022];var _0x5dbb01=createListener('userProfile:'+_0x257b77,_0x26b4b4);UserProfileEvents['on'](_0x257b77,_0x5dbb01);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 89f0061..13d9c01 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 _0xdab4=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xdab4,0x92));var _0x4dab=function(_0x14e06b,_0x55b8a9){_0x14e06b=_0x14e06b-0x0;var _0x4b54fd=_0xdab4[_0x14e06b];return _0x4b54fd;};'use strict';var multer=require(_0x4dab('0x0'));var util=require(_0x4dab('0x1'));var path=require(_0x4dab('0x2'));var timeout=require(_0x4dab('0x3'));var express=require(_0x4dab('0x4'));var router=express[_0x4dab('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4dab('0x6'));var controller=require(_0x4dab('0x7'));router[_0x4dab('0x8')]('/',auth[_0x4dab('0x9')](),controller[_0x4dab('0xa')]);router['get'](_0x4dab('0xb'),auth[_0x4dab('0x9')](),controller['describe']);router[_0x4dab('0x8')](_0x4dab('0xc'),auth['isAuthenticated'](),controller[_0x4dab('0xd')]);router[_0x4dab('0xe')]('/',auth['isAuthenticated'](),controller[_0x4dab('0xf')]);router[_0x4dab('0x10')](_0x4dab('0xc'),auth[_0x4dab('0x9')](),controller[_0x4dab('0x11')]);router[_0x4dab('0x12')](_0x4dab('0xc'),auth[_0x4dab('0x9')](),controller[_0x4dab('0x13')]);module['exports']=router; \ No newline at end of file +var _0xbd48=['../../config/environment','get','isAuthenticated','describe','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x198045,_0x1d3a53){var _0x405032=function(_0x324330){while(--_0x324330){_0x198045['push'](_0x198045['shift']());}};_0x405032(++_0x1d3a53);}(_0xbd48,0x191));var _0x8bd4=function(_0x17173c,_0x28e482){_0x17173c=_0x17173c-0x0;var _0x2df04a=_0xbd48[_0x17173c];return _0x2df04a;};'use strict';var multer=require(_0x8bd4('0x0'));var util=require(_0x8bd4('0x1'));var path=require(_0x8bd4('0x2'));var timeout=require(_0x8bd4('0x3'));var express=require('express');var router=express[_0x8bd4('0x4')]();var auth=require(_0x8bd4('0x5'));var interaction=require(_0x8bd4('0x6'));var config=require(_0x8bd4('0x7'));var controller=require('./userProfileResource.controller');router[_0x8bd4('0x8')]('/',auth[_0x8bd4('0x9')](),controller['index']);router[_0x8bd4('0x8')]('/describe',auth[_0x8bd4('0x9')](),controller[_0x8bd4('0xa')]);router[_0x8bd4('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x8bd4('0x9')](),controller['create']);router[_0x8bd4('0xb')](_0x8bd4('0xc'),auth['isAuthenticated'](),controller[_0x8bd4('0xd')]);router[_0x8bd4('0xe')](_0x8bd4('0xc'),auth[_0x8bd4('0x9')](),controller[_0x8bd4('0xf')]);module[_0x8bd4('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 350746d..fd3e6a7 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 _0x44d2=['STRING','sequelize'];(function(_0x824ac5,_0x42f954){var _0x7329f2=function(_0x46c217){while(--_0x46c217){_0x824ac5['push'](_0x824ac5['shift']());}};_0x7329f2(++_0x42f954);}(_0x44d2,0x109));var _0x244d=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x44d2[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require(_0x244d('0x0'));module['exports']={'name':{'type':Sequelize[_0x244d('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x244d('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xf634=['exports','sequelize'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xf634,0x14d));var _0x4f63=function(_0x5c155f,_0x5ab1ae){_0x5c155f=_0x5c155f-0x0;var _0x4fc5d6=_0xf634[_0x5c155f];return _0x4fc5d6;};'use strict';var Sequelize=require(_0x4f63('0x0'));module[_0x4f63('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 69092dc..b6a824d 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 _0x7fbe=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','includeAll','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection'];(function(_0x2401d2,_0x57caea){var _0x17c81f=function(_0x43259f){while(--_0x43259f){_0x2401d2['push'](_0x2401d2['shift']());}};_0x17c81f(++_0x57caea);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2ef252,_0x1993fe){_0x2ef252=_0x2ef252-0x0;var _0x1139ca=_0x7fbe[_0x2ef252];return _0x1139ca;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe7fb('0x0'));var zipdir=require(_0xe7fb('0x1'));var jsonpatch=require(_0xe7fb('0x2'));var rp=require(_0xe7fb('0x3'));var moment=require(_0xe7fb('0x4'));var BPromise=require(_0xe7fb('0x5'));var Mustache=require(_0xe7fb('0x6'));var util=require(_0xe7fb('0x7'));var path=require(_0xe7fb('0x8'));var sox=require(_0xe7fb('0x9'));var csv=require(_0xe7fb('0xa'));var ejs=require(_0xe7fb('0xb'));var fs=require('fs');var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0xa'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=_0x559129['count'],_0x18d23c=_0xa76acf[_0xe7fb('0x1e')],_0x12603d=_0xa76acf['offset']+_0xa76acf[_0xe7fb('0x1f')],_0x17e8a8;if(_0x12603d>=_0x12fff6){_0x12603d=_0x12fff6;_0x17e8a8=0xc8;}else{_0x17e8a8=0xce;}_0x482f7d['status'](_0x17e8a8);return _0x482f7d[_0xe7fb('0x20')](_0xe7fb('0x21'),_0x18d23c+'-'+_0x12603d+'/'+_0x12fff6)[_0xe7fb('0x1d')](_0x559129);}return null;};}function patchUpdates(_0x182269){return function(_0x5df1a1){try{jsonpatch[_0xe7fb('0x22')](_0x5df1a1,_0x182269,!![]);}catch(_0x5d1c87){return BPromise[_0xe7fb('0x23')](_0x5d1c87);}return _0x5df1a1['save']();};}function saveUpdates(_0x15f7a4,_0x4ea664){return function(_0xa5af01){if(_0xa5af01){return _0xa5af01[_0xe7fb('0x24')](_0x15f7a4)['then'](function(_0x143eb6){return _0x143eb6;});}return null;};}function removeEntity(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')]()[_0xe7fb('0x26')](function(){_0x4742bd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52f08b,_0x35e4db){return function(_0x53c43a){if(!_0x53c43a){_0x52f08b['sendStatus'](0x194);}return _0x53c43a;};}function handleError(_0x4026b1,_0x32e8b2){_0x32e8b2=_0x32e8b2||0x1f4;return function(_0x2996ae){logger['error'](_0x2996ae[_0xe7fb('0x27')]);if(_0x2996ae[_0xe7fb('0x28')]){delete _0x2996ae[_0xe7fb('0x28')];}_0x4026b1[_0xe7fb('0x1c')](_0x32e8b2)[_0xe7fb('0x29')](_0x2996ae);};}exports[_0xe7fb('0x2a')]=function(_0x380130,_0x59e015){var _0x5df9f2={},_0x1086e6={},_0x3bdee9={'count':0x0,'rows':[]};var _0xead63=_['map'](db[_0xe7fb('0x2b')][_0xe7fb('0x2c')],function(_0xd3fffe){return{'name':_0xd3fffe[_0xe7fb('0x2d')],'type':_0xd3fffe[_0xe7fb('0x2e')][_0xe7fb('0x2f')]};});_0x1086e6[_0xe7fb('0x30')]=_[_0xe7fb('0x31')](_0xead63,'name');_0x1086e6[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x380130[_0xe7fb('0x32')]);_0x1086e6['filters']=_['intersection'](_0x1086e6[_0xe7fb('0x30')],_0x1086e6['query']);_0x5df9f2[_0xe7fb('0x34')]=_[_0xe7fb('0x35')](_0x1086e6[_0xe7fb('0x30')],qs[_0xe7fb('0x36')](_0x380130['query'][_0xe7fb('0x36')]));_0x5df9f2[_0xe7fb('0x34')]=_0x5df9f2[_0xe7fb('0x34')][_0xe7fb('0x37')]?_0x5df9f2[_0xe7fb('0x34')]:_0x1086e6['model'];if(!_0x380130[_0xe7fb('0x32')][_0xe7fb('0x38')](_0xe7fb('0x39'))){_0x5df9f2[_0xe7fb('0x1f')]=qs[_0xe7fb('0x1f')](_0x380130[_0xe7fb('0x32')][_0xe7fb('0x1f')]);_0x5df9f2[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x380130['query'][_0xe7fb('0x1e')]);}_0x5df9f2[_0xe7fb('0x3a')]=qs[_0xe7fb('0x3b')](_0x380130['query'][_0xe7fb('0x3b')]);_0x5df9f2[_0xe7fb('0x3c')]=qs[_0xe7fb('0x3d')](_[_0xe7fb('0x3e')](_0x380130[_0xe7fb('0x32')],_0x1086e6[_0xe7fb('0x3d')]),_0xead63);if(_0x380130[_0xe7fb('0x32')][_0xe7fb('0x3f')]){_0x5df9f2[_0xe7fb('0x3c')]=_[_0xe7fb('0x40')](_0x5df9f2[_0xe7fb('0x3c')],{'$or':_[_0xe7fb('0x31')](_0xead63,function(_0x1544f2){if(_0x1544f2[_0xe7fb('0x2e')]!==_0xe7fb('0x41')){var _0x41e2d1={};_0x41e2d1[_0x1544f2[_0xe7fb('0x28')]]={'$like':'%'+_0x380130[_0xe7fb('0x32')][_0xe7fb('0x3f')]+'%'};return _0x41e2d1;}})});}_0x5df9f2=_['merge']({},_0x5df9f2,_0x380130[_0xe7fb('0x42')]);var _0x23f9f9={'where':_0x5df9f2[_0xe7fb('0x3c')]};return db[_0xe7fb('0x2b')]['count'](_0x23f9f9)[_0xe7fb('0x26')](function(_0x186418){_0x3bdee9[_0xe7fb('0x43')]=_0x186418;if(_0x380130[_0xe7fb('0x32')]['includeAll']){_0x5df9f2[_0xe7fb('0x44')]=[{'all':!![]}];}return db[_0xe7fb('0x2b')][_0xe7fb('0x45')](_0x5df9f2);})[_0xe7fb('0x26')](function(_0x468d16){_0x3bdee9[_0xe7fb('0x46')]=_0x468d16;return _0x3bdee9;})['then'](respondWithFilteredResult(_0x59e015,_0x5df9f2))[_0xe7fb('0x47')](handleError(_0x59e015,null));};exports[_0xe7fb('0x48')]=function(_0x3a96cd,_0x4b263d){var _0x36a341={'raw':![],'where':{'id':_0x3a96cd['params']['id']}},_0x3a8c52={};_0x3a8c52['model']=_['keys'](db['UserProfileResource']['rawAttributes']);_0x3a8c52[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x3a96cd[_0xe7fb('0x32')]);_0x3a8c52['filters']=_[_0xe7fb('0x35')](_0x3a8c52['model'],_0x3a8c52[_0xe7fb('0x32')]);_0x36a341[_0xe7fb('0x34')]=_['intersection'](_0x3a8c52[_0xe7fb('0x30')],qs[_0xe7fb('0x36')](_0x3a96cd[_0xe7fb('0x32')][_0xe7fb('0x36')]));_0x36a341['attributes']=_0x36a341[_0xe7fb('0x34')][_0xe7fb('0x37')]?_0x36a341[_0xe7fb('0x34')]:_0x3a8c52['model'];if(_0x3a96cd[_0xe7fb('0x32')][_0xe7fb('0x49')]){_0x36a341[_0xe7fb('0x44')]=[{'all':!![]}];}_0x36a341=_[_0xe7fb('0x40')]({},_0x36a341,_0x3a96cd[_0xe7fb('0x42')]);return db['UserProfileResource'][_0xe7fb('0x4a')](_0x36a341)['then'](handleEntityNotFound(_0x4b263d,null))[_0xe7fb('0x26')](respondWithResult(_0x4b263d,null))[_0xe7fb('0x47')](handleError(_0x4b263d,null));};exports[_0xe7fb('0x4b')]=function(_0x1ecbfd,_0x15cec3){return db['UserProfileResource'][_0xe7fb('0x4b')](_0x1ecbfd['body'],{})['then'](respondWithResult(_0x15cec3,0xc9))[_0xe7fb('0x47')](handleError(_0x15cec3,null));};exports[_0xe7fb('0x24')]=function(_0x16327f,_0x589555){if(_0x16327f[_0xe7fb('0x4c')]['id']){delete _0x16327f[_0xe7fb('0x4c')]['id'];}return db['UserProfileResource']['find']({'where':{'id':_0x16327f[_0xe7fb('0x4d')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x589555,null))[_0xe7fb('0x26')](saveUpdates(_0x16327f[_0xe7fb('0x4c')],null))[_0xe7fb('0x26')](respondWithResult(_0x589555,null))[_0xe7fb('0x47')](handleError(_0x589555,null));};exports[_0xe7fb('0x25')]=function(_0x347177,_0x5cd8e3){return db[_0xe7fb('0x2b')]['find']({'where':{'id':_0x347177[_0xe7fb('0x4d')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x5cd8e3,null))['then'](removeEntity(_0x5cd8e3,null))[_0xe7fb('0x47')](handleError(_0x5cd8e3,null));};exports['describe']=function(_0x239c56,_0x484bd8){return db[_0xe7fb('0x2b')]['describe']()[_0xe7fb('0x26')](respondWithResult(_0x484bd8,null))['catch'](handleError(_0x484bd8,null));}; \ No newline at end of file +var _0x8ef6=['nolimit','offset','order','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','limit','reject','save','then','stack','send','index','map','UserProfileResource','rawAttributes','fieldName','type','model','name','keys','filters','intersection','attributes','fields','query','length'];(function(_0x27c515,_0x3d7bbc){var _0x28c563=function(_0x8e03ba){while(--_0x8e03ba){_0x27c515['push'](_0x27c515['shift']());}};_0x28c563(++_0x3d7bbc);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1b91a0,_0x2bd471){_0x1b91a0=_0x1b91a0-0x0;var _0x400fcf=_0x8ef6[_0x1b91a0];return _0x400fcf;};'use strict';var pdf=require(_0x68ef('0x0'));var emlformat=require(_0x68ef('0x1'));var rimraf=require(_0x68ef('0x2'));var zipdir=require(_0x68ef('0x3'));var jsonpatch=require(_0x68ef('0x4'));var rp=require(_0x68ef('0x5'));var moment=require(_0x68ef('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x68ef('0x7'));var util=require(_0x68ef('0x8'));var path=require(_0x68ef('0x9'));var sox=require(_0x68ef('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xf'));var querystring=require(_0x68ef('0x10'));var Papa=require(_0x68ef('0x11'));var Redis=require(_0x68ef('0x12'));var authService=require(_0x68ef('0x13'));var qs=require(_0x68ef('0x14'));var as=require(_0x68ef('0x15'));var hardwareService=require(_0x68ef('0x16'));var logger=require(_0x68ef('0x17'))(_0x68ef('0x18'));var utils=require(_0x68ef('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x1a'));var db=require(_0x68ef('0x1b'))['db'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1c')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1d')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1e')](_0x2657c5)[_0x68ef('0x1f')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=_0x35493d[_0x68ef('0x20')],_0x3d1e90=_0x5005ba['offset'],_0x3780a4=_0x5005ba['offset']+_0x5005ba[_0x68ef('0x21')],_0x5c4456;if(_0x3780a4>=_0x37c4cc){_0x3780a4=_0x37c4cc;_0x5c4456=0xc8;}else{_0x5c4456=0xce;}_0x24682d[_0x68ef('0x1e')](_0x5c4456);return _0x24682d['set']('Content-Range',_0x3d1e90+'-'+_0x3780a4+'/'+_0x37c4cc)[_0x68ef('0x1f')](_0x35493d);}return null;};}function patchUpdates(_0x2cd92c){return function(_0x318514){try{jsonpatch['apply'](_0x318514,_0x2cd92c,!![]);}catch(_0x1dc49c){return BPromise[_0x68ef('0x22')](_0x1dc49c);}return _0x318514[_0x68ef('0x23')]();};}function saveUpdates(_0x5b246b,_0x3c46d4){return function(_0x3be4c0){if(_0x3be4c0){return _0x3be4c0['update'](_0x5b246b)[_0x68ef('0x24')](function(_0xf4760f){return _0xf4760f;});}return null;};}function removeEntity(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['destroy']()[_0x68ef('0x24')](function(){_0x19aa3d[_0x68ef('0x1e')](0xcc)[_0x68ef('0x1d')]();});}};}function handleEntityNotFound(_0x2e6e39,_0x438b4c){return function(_0xfe2595){if(!_0xfe2595){_0x2e6e39[_0x68ef('0x1c')](0x194);}return _0xfe2595;};}function handleError(_0x49374f,_0x65fd09){_0x65fd09=_0x65fd09||0x1f4;return function(_0x13280b){logger['error'](_0x13280b[_0x68ef('0x25')]);if(_0x13280b['name']){delete _0x13280b['name'];}_0x49374f['status'](_0x65fd09)[_0x68ef('0x26')](_0x13280b);};}exports[_0x68ef('0x27')]=function(_0x123041,_0x29518e){var _0x52e67e={},_0x4a0550={},_0x1cbe4f={'count':0x0,'rows':[]};var _0x28907a=_[_0x68ef('0x28')](db[_0x68ef('0x29')][_0x68ef('0x2a')],function(_0x201884){return{'name':_0x201884[_0x68ef('0x2b')],'type':_0x201884[_0x68ef('0x2c')]['key']};});_0x4a0550[_0x68ef('0x2d')]=_[_0x68ef('0x28')](_0x28907a,_0x68ef('0x2e'));_0x4a0550['query']=_[_0x68ef('0x2f')](_0x123041['query']);_0x4a0550[_0x68ef('0x30')]=_[_0x68ef('0x31')](_0x4a0550['model'],_0x4a0550['query']);_0x52e67e[_0x68ef('0x32')]=_[_0x68ef('0x31')](_0x4a0550['model'],qs[_0x68ef('0x33')](_0x123041[_0x68ef('0x34')][_0x68ef('0x33')]));_0x52e67e[_0x68ef('0x32')]=_0x52e67e['attributes'][_0x68ef('0x35')]?_0x52e67e[_0x68ef('0x32')]:_0x4a0550['model'];if(!_0x123041[_0x68ef('0x34')]['hasOwnProperty'](_0x68ef('0x36'))){_0x52e67e[_0x68ef('0x21')]=qs['limit'](_0x123041[_0x68ef('0x34')]['limit']);_0x52e67e[_0x68ef('0x37')]=qs['offset'](_0x123041[_0x68ef('0x34')][_0x68ef('0x37')]);}_0x52e67e[_0x68ef('0x38')]=qs['sort'](_0x123041[_0x68ef('0x34')]['sort']);_0x52e67e[_0x68ef('0x39')]=qs['filters'](_[_0x68ef('0x3a')](_0x123041[_0x68ef('0x34')],_0x4a0550[_0x68ef('0x30')]),_0x28907a);if(_0x123041[_0x68ef('0x34')][_0x68ef('0x3b')]){_0x52e67e[_0x68ef('0x39')]=_['merge'](_0x52e67e[_0x68ef('0x39')],{'$or':_[_0x68ef('0x28')](_0x28907a,function(_0x32074a){if(_0x32074a['type']!==_0x68ef('0x3c')){var _0x3c5de6={};_0x3c5de6[_0x32074a[_0x68ef('0x2e')]]={'$like':'%'+_0x123041['query']['filter']+'%'};return _0x3c5de6;}})});}_0x52e67e=_[_0x68ef('0x3d')]({},_0x52e67e,_0x123041[_0x68ef('0x3e')]);var _0x36213a={'where':_0x52e67e[_0x68ef('0x39')]};return db[_0x68ef('0x29')][_0x68ef('0x20')](_0x36213a)[_0x68ef('0x24')](function(_0x5b1246){_0x1cbe4f[_0x68ef('0x20')]=_0x5b1246;if(_0x123041[_0x68ef('0x34')][_0x68ef('0x3f')]){_0x52e67e[_0x68ef('0x40')]=[{'all':!![]}];}return db['UserProfileResource'][_0x68ef('0x41')](_0x52e67e);})[_0x68ef('0x24')](function(_0xcf595d){_0x1cbe4f[_0x68ef('0x42')]=_0xcf595d;return _0x1cbe4f;})[_0x68ef('0x24')](respondWithFilteredResult(_0x29518e,_0x52e67e))[_0x68ef('0x43')](handleError(_0x29518e,null));};exports['show']=function(_0x3f000f,_0x3f7699){var _0xf5010c={'raw':![],'where':{'id':_0x3f000f[_0x68ef('0x44')]['id']}},_0x43796b={};_0x43796b[_0x68ef('0x2d')]=_[_0x68ef('0x2f')](db[_0x68ef('0x29')][_0x68ef('0x2a')]);_0x43796b['query']=_[_0x68ef('0x2f')](_0x3f000f[_0x68ef('0x34')]);_0x43796b[_0x68ef('0x30')]=_[_0x68ef('0x31')](_0x43796b[_0x68ef('0x2d')],_0x43796b[_0x68ef('0x34')]);_0xf5010c[_0x68ef('0x32')]=_['intersection'](_0x43796b[_0x68ef('0x2d')],qs['fields'](_0x3f000f[_0x68ef('0x34')][_0x68ef('0x33')]));_0xf5010c[_0x68ef('0x32')]=_0xf5010c[_0x68ef('0x32')]['length']?_0xf5010c[_0x68ef('0x32')]:_0x43796b['model'];if(_0x3f000f[_0x68ef('0x34')]['includeAll']){_0xf5010c[_0x68ef('0x40')]=[{'all':!![]}];}_0xf5010c=_[_0x68ef('0x3d')]({},_0xf5010c,_0x3f000f[_0x68ef('0x3e')]);return db['UserProfileResource']['find'](_0xf5010c)[_0x68ef('0x24')](handleEntityNotFound(_0x3f7699,null))[_0x68ef('0x24')](respondWithResult(_0x3f7699,null))['catch'](handleError(_0x3f7699,null));};exports['create']=function(_0x4b4d6b,_0xe547c){return db[_0x68ef('0x29')][_0x68ef('0x45')](_0x4b4d6b[_0x68ef('0x46')],{})[_0x68ef('0x24')](respondWithResult(_0xe547c,0xc9))['catch'](handleError(_0xe547c,null));};exports['update']=function(_0xc39f5b,_0x21f064){if(_0xc39f5b[_0x68ef('0x46')]['id']){delete _0xc39f5b[_0x68ef('0x46')]['id'];}return db['UserProfileResource'][_0x68ef('0x47')]({'where':{'id':_0xc39f5b[_0x68ef('0x44')]['id']}})[_0x68ef('0x24')](handleEntityNotFound(_0x21f064,null))[_0x68ef('0x24')](saveUpdates(_0xc39f5b['body'],null))['then'](respondWithResult(_0x21f064,null))[_0x68ef('0x43')](handleError(_0x21f064,null));};exports[_0x68ef('0x48')]=function(_0x566e7c,_0xfc7a74){return db[_0x68ef('0x29')][_0x68ef('0x47')]({'where':{'id':_0x566e7c[_0x68ef('0x44')]['id']}})[_0x68ef('0x24')](handleEntityNotFound(_0xfc7a74,null))['then'](removeEntity(_0xfc7a74,null))[_0x68ef('0x43')](handleError(_0xfc7a74,null));};exports[_0x68ef('0x49')]=function(_0x340bfb,_0x581ac1){return db[_0x68ef('0x29')][_0x68ef('0x49')]()[_0x68ef('0x24')](respondWithResult(_0x581ac1,null))['catch'](handleError(_0x581ac1,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 2ee6cfc..4e7604d 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 _0xf9a3=['define','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userProfileResource.attributes'];(function(_0x5ed32c,_0x956025){var _0x271ea3=function(_0x206a21){while(--_0x206a21){_0x5ed32c['push'](_0x5ed32c['shift']());}};_0x271ea3(++_0x956025);}(_0xf9a3,0x140));var _0x3f9a=function(_0x3d5550,_0x112e43){_0x3d5550=_0x3d5550-0x0;var _0x2bd37c=_0xf9a3[_0x3d5550];return _0x2bd37c;};'use strict';var _=require(_0x3f9a('0x0'));var util=require(_0x3f9a('0x1'));var logger=require(_0x3f9a('0x2'))(_0x3f9a('0x3'));var moment=require(_0x3f9a('0x4'));var BPromise=require(_0x3f9a('0x5'));var rp=require(_0x3f9a('0x6'));var fs=require('fs');var path=require(_0x3f9a('0x7'));var rimraf=require(_0x3f9a('0x8'));var config=require('../../config/environment');var attributes=require(_0x3f9a('0x9'));module['exports']=function(_0x24a9d1,_0x29c45f){return _0x24a9d1[_0x3f9a('0xa')]('UserProfileResource',attributes,{'tableName':_0x3f9a('0xb'),'paranoid':![],'indexes':[{'name':_0x3f9a('0xc'),'fields':[_0x3f9a('0xd'),_0x3f9a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x11f8=['api','bluebird','request-promise','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','util','../../config/logger'];(function(_0x55b460,_0x497077){var _0x3ac537=function(_0xd709b3){while(--_0xd709b3){_0x55b460['push'](_0x55b460['shift']());}};_0x3ac537(++_0x497077);}(_0x11f8,0x136));var _0x811f=function(_0x562fdb,_0x1aa0a7){_0x562fdb=_0x562fdb-0x0;var _0xaee203=_0x11f8[_0x562fdb];return _0xaee203;};'use strict';var _=require('lodash');var util=require(_0x811f('0x0'));var logger=require(_0x811f('0x1'))(_0x811f('0x2'));var moment=require('moment');var BPromise=require(_0x811f('0x3'));var rp=require(_0x811f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x811f('0x5'));var attributes=require(_0x811f('0x6'));module[_0x811f('0x7')]=function(_0x598e8b,_0x7b5319){return _0x598e8b['define'](_0x811f('0x8'),attributes,{'tableName':_0x811f('0x9'),'paranoid':![],'indexes':[{'name':_0x811f('0xa'),'fields':['resourceId',_0x811f('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 2be83a7..c48c001 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 _0xfe8b=['request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe8b,0x1ac));var _0xbfe8=function(_0xf93076,_0x1acb30){_0xf93076=_0xf93076-0x0;var _0x33d1da=_0xfe8b[_0xf93076];return _0x33d1da;};'use strict';var _=require('lodash');var util=require(_0xbfe8('0x0'));var moment=require(_0xbfe8('0x1'));var BPromise=require(_0xbfe8('0x2'));var rs=require(_0xbfe8('0x3'));var fs=require('fs');var Redis=require(_0xbfe8('0x4'));var db=require(_0xbfe8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfe8('0x6'))('rpc');var config=require(_0xbfe8('0x7'));var jayson=require(_0xbfe8('0x8'));var client=jayson['client'][_0xbfe8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e7240,_0x11a38e,_0x3950a9){return new BPromise(function(_0x8eef4b,_0x663586){return client[_0xbfe8('0xa')](_0x2e7240,_0x3950a9)['then'](function(_0x11ca0c){logger[_0xbfe8('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x11a38e,_0xbfe8('0xc'));logger[_0xbfe8('0xd')](_0xbfe8('0xe'),_0x11a38e,_0xbfe8('0xc'),JSON[_0xbfe8('0xf')](_0x11ca0c));if(_0x11ca0c[_0xbfe8('0x10')]){if(_0x11ca0c[_0xbfe8('0x10')][_0xbfe8('0x11')]===0x1f4){logger['error'](_0xbfe8('0x12'),_0x11a38e,_0x11ca0c['error']['message']);return _0x663586(_0x11ca0c[_0xbfe8('0x10')][_0xbfe8('0x13')]);}logger[_0xbfe8('0x10')](_0xbfe8('0x12'),_0x11a38e,_0x11ca0c[_0xbfe8('0x10')][_0xbfe8('0x13')]);return _0x8eef4b(_0x11ca0c['error'][_0xbfe8('0x13')]);}else{logger['info'](_0xbfe8('0x12'),_0x11a38e,_0xbfe8('0xc'));_0x8eef4b(_0x11ca0c[_0xbfe8('0x14')][_0xbfe8('0x13')]);}})[_0xbfe8('0x15')](function(_0x1c3123){logger[_0xbfe8('0x10')](_0xbfe8('0x12'),_0x11a38e,_0x1c3123);_0x663586(_0x1c3123);});});} \ No newline at end of file +var _0x6b71=['UserProfileResource,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x13342f,_0x3d6303){var _0x2fc1fc=function(_0x2d991f){while(--_0x2d991f){_0x13342f['push'](_0x13342f['shift']());}};_0x2fc1fc(++_0x3d6303);}(_0x6b71,0x1a6));var _0x16b7=function(_0x4f0ac9,_0xf8844e){_0x4f0ac9=_0x4f0ac9-0x0;var _0x1d1f24=_0x6b71[_0x4f0ac9];return _0x1d1f24;};'use strict';var _=require(_0x16b7('0x0'));var util=require(_0x16b7('0x1'));var moment=require(_0x16b7('0x2'));var BPromise=require(_0x16b7('0x3'));var rs=require(_0x16b7('0x4'));var fs=require('fs');var Redis=require(_0x16b7('0x5'));var db=require(_0x16b7('0x6'))['db'];var utils=require(_0x16b7('0x7'));var logger=require(_0x16b7('0x8'))(_0x16b7('0x9'));var config=require(_0x16b7('0xa'));var jayson=require(_0x16b7('0xb'));var client=jayson[_0x16b7('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x83be2c,_0x904d91,_0x2978d8){return new BPromise(function(_0x357236,_0x55022b){return client[_0x16b7('0xd')](_0x83be2c,_0x2978d8)[_0x16b7('0xe')](function(_0x1e6635){logger['info'](_0x16b7('0xf'),_0x904d91,_0x16b7('0x10'));logger[_0x16b7('0x11')](_0x16b7('0x12'),_0x904d91,_0x16b7('0x10'),JSON['stringify'](_0x1e6635));if(_0x1e6635[_0x16b7('0x13')]){if(_0x1e6635['error']['code']===0x1f4){logger[_0x16b7('0x13')](_0x16b7('0xf'),_0x904d91,_0x1e6635[_0x16b7('0x13')]['message']);return _0x55022b(_0x1e6635[_0x16b7('0x13')][_0x16b7('0x14')]);}logger[_0x16b7('0x13')](_0x16b7('0xf'),_0x904d91,_0x1e6635[_0x16b7('0x13')][_0x16b7('0x14')]);return _0x357236(_0x1e6635[_0x16b7('0x13')][_0x16b7('0x14')]);}else{logger['info'](_0x16b7('0xf'),_0x904d91,_0x16b7('0x10'));_0x357236(_0x1e6635[_0x16b7('0x15')][_0x16b7('0x14')]);}})['catch'](function(_0x3d17d2){logger[_0x16b7('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x904d91,_0x3d17d2);_0x55022b(_0x3d17d2);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 9cf12d2..eafd89f 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 _0x149c=['show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x1c0be5,_0x2f8d8f){var _0x53e958=function(_0x58e3c9){while(--_0x58e3c9){_0x1c0be5['push'](_0x1c0be5['shift']());}};_0x53e958(++_0x2f8d8f);}(_0x149c,0x143));var _0xc149=function(_0x5ef15e,_0x2172dd){_0x5ef15e=_0x5ef15e-0x0;var _0x507815=_0x149c[_0x5ef15e];return _0x507815;};'use strict';var multer=require(_0xc149('0x0'));var util=require('util');var path=require(_0xc149('0x1'));var timeout=require(_0xc149('0x2'));var express=require(_0xc149('0x3'));var router=express['Router']();var auth=require(_0xc149('0x4'));var interaction=require(_0xc149('0x5'));var config=require(_0xc149('0x6'));var controller=require(_0xc149('0x7'));router[_0xc149('0x8')]('/',auth[_0xc149('0x9')](),controller[_0xc149('0xa')]);router['get']('/describe',auth[_0xc149('0x9')](),controller[_0xc149('0xb')]);router[_0xc149('0x8')](_0xc149('0xc'),auth[_0xc149('0x9')](),controller[_0xc149('0xd')]);router[_0xc149('0xe')]('/',auth[_0xc149('0x9')](),controller[_0xc149('0xf')]);router[_0xc149('0x10')](_0xc149('0xc'),auth[_0xc149('0x9')](),controller[_0xc149('0x11')]);router[_0xc149('0x12')](_0xc149('0xc'),auth[_0xc149('0x9')](),controller[_0xc149('0x13')]);module[_0xc149('0x14')]=router; \ No newline at end of file +var _0xdbbc=['../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','show','post','create','delete','/:id','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0xdbbc,0x19d));var _0xcdbb=function(_0x589eb7,_0x37eb7a){_0x589eb7=_0x589eb7-0x0;var _0x2382db=_0xdbbc[_0x589eb7];return _0x2382db;};'use strict';var multer=require(_0xcdbb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcdbb('0x1'));var express=require(_0xcdbb('0x2'));var router=express[_0xcdbb('0x3')]();var auth=require(_0xcdbb('0x4'));var interaction=require(_0xcdbb('0x5'));var config=require(_0xcdbb('0x6'));var controller=require(_0xcdbb('0x7'));router[_0xcdbb('0x8')]('/',auth[_0xcdbb('0x9')](),controller[_0xcdbb('0xa')]);router[_0xcdbb('0x8')](_0xcdbb('0xb'),auth['isAuthenticated'](),controller[_0xcdbb('0xc')]);router[_0xcdbb('0x8')]('/:id',auth[_0xcdbb('0x9')](),controller[_0xcdbb('0xd')]);router[_0xcdbb('0xe')]('/',auth[_0xcdbb('0x9')](),controller[_0xcdbb('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xcdbb('0x10')](_0xcdbb('0x11'),auth[_0xcdbb('0x9')](),controller['destroy']);module[_0xcdbb('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 1ea5862..18444da 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 _0x79d8=['STRING','BOOLEAN','setDataValue','crudPermissions','getDataValue','sequelize','exports'];(function(_0x280e2a,_0x5b7773){var _0x235ae4=function(_0x4652a3){while(--_0x4652a3){_0x280e2a['push'](_0x280e2a['shift']());}};_0x235ae4(++_0x5b7773);}(_0x79d8,0x67));var _0x879d=function(_0x57832d,_0xaf1c8){_0x57832d=_0x57832d-0x0;var _0x4c2a8c=_0x79d8[_0x57832d];return _0x4c2a8c;};'use strict';var Sequelize=require(_0x879d('0x0'));module[_0x879d('0x1')]={'name':{'type':Sequelize[_0x879d('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x879d('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x879d('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x879d('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x2b38f9){this[_0x879d('0x4')](_0x879d('0x5'),_0x2b38f9?_0x2b38f9['join'](''):[]);},'get':function(){return this[_0x879d('0x6')](_0x879d('0x5'))?this[_0x879d('0x6')](_0x879d('0x5'))['split'](''):[];}}}; \ No newline at end of file +var _0x09dd=['exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x09dd,0x81));var _0xd09d=function(_0x5279cb,_0x1601be){_0x5279cb=_0x5279cb-0x0;var _0x55785a=_0x09dd[_0x5279cb];return _0x55785a;};'use strict';var Sequelize=require(_0xd09d('0x0'));module[_0xd09d('0x1')]={'name':{'type':Sequelize[_0xd09d('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xd09d('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd09d('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xd09d('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xd09d('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xd09d('0x2')],'set':function(_0x44faf7){this[_0xd09d('0x5')](_0xd09d('0x6'),_0x44faf7?_0x44faf7[_0xd09d('0x7')](''):[]);},'get':function(){return this[_0xd09d('0x8')](_0xd09d('0x6'))?this['getDataValue'](_0xd09d('0x6'))[_0xd09d('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 8245c8a..4f36ab1 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 _0x6700=['key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','count','then','includeAll','show','params','keys','include','catch','create','body','find','destroy','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','stack','name','send','index','UserProfileSection','rawAttributes','fieldName','type'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6700,0x1d4));var _0x0670=function(_0xa0d291,_0x1f91a0){_0xa0d291=_0xa0d291-0x0;var _0x2eb9f2=_0x6700[_0xa0d291];return _0x2eb9f2;};'use strict';var pdf=require(_0x0670('0x0'));var emlformat=require(_0x0670('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0670('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0670('0x3'));var moment=require(_0x0670('0x4'));var BPromise=require(_0x0670('0x5'));var Mustache=require(_0x0670('0x6'));var util=require(_0x0670('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x0670('0x8'));var ejs=require(_0x0670('0x9'));var fs=require('fs');var _=require(_0x0670('0xa'));var squel=require(_0x0670('0xb'));var crypto=require(_0x0670('0xc'));var jsforce=require(_0x0670('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0670('0x8'));var querystring=require(_0x0670('0xe'));var Papa=require('papaparse');var Redis=require(_0x0670('0xf'));var authService=require(_0x0670('0x10'));var qs=require(_0x0670('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0670('0x12'));var logger=require(_0x0670('0x13'))(_0x0670('0x14'));var utils=require('../../config/utils');var config=require(_0x0670('0x15'));var licenseUtil=require(_0x0670('0x16'));var db=require(_0x0670('0x17'))['db'];function respondWithStatusCode(_0x5ec070,_0x4e2e27){_0x4e2e27=_0x4e2e27||0xcc;return function(_0x4b37a1){if(_0x4b37a1){return _0x5ec070[_0x0670('0x18')](_0x4e2e27);}return _0x5ec070[_0x0670('0x19')](_0x4e2e27)[_0x0670('0x1a')]();};}function respondWithResult(_0x17ace2,_0x917609){_0x917609=_0x917609||0xc8;return function(_0x2486a1){if(_0x2486a1){return _0x17ace2[_0x0670('0x19')](_0x917609)[_0x0670('0x1b')](_0x2486a1);}};}function respondWithFilteredResult(_0x48a41a,_0x3984aa){return function(_0x513656){if(_0x513656){var _0x4934b6=_0x513656['count'],_0x3977b2=_0x3984aa['offset'],_0x484867=_0x3984aa[_0x0670('0x1c')]+_0x3984aa[_0x0670('0x1d')],_0xd5bdde;if(_0x484867>=_0x4934b6){_0x484867=_0x4934b6;_0xd5bdde=0xc8;}else{_0xd5bdde=0xce;}_0x48a41a['status'](_0xd5bdde);return _0x48a41a[_0x0670('0x1e')](_0x0670('0x1f'),_0x3977b2+'-'+_0x484867+'/'+_0x4934b6)[_0x0670('0x1b')](_0x513656);}return null;};}function patchUpdates(_0x4b38aa){return function(_0x45c6af){try{jsonpatch[_0x0670('0x20')](_0x45c6af,_0x4b38aa,!![]);}catch(_0x38a79d){return BPromise[_0x0670('0x21')](_0x38a79d);}return _0x45c6af['save']();};}function saveUpdates(_0x46f861,_0x27a67b){return function(_0x65d03b){if(_0x65d03b){return _0x65d03b[_0x0670('0x22')](_0x46f861)['then'](function(_0x4774e7){return _0x4774e7;});}return null;};}function removeEntity(_0x37905f,_0x4eef6f){return function(_0x3d6927){if(_0x3d6927){return _0x3d6927['destroy']()['then'](function(){_0x37905f[_0x0670('0x19')](0xcc)[_0x0670('0x1a')]();});}};}function handleEntityNotFound(_0xa6c187,_0x342846){return function(_0x13c7a5){if(!_0x13c7a5){_0xa6c187[_0x0670('0x18')](0x194);}return _0x13c7a5;};}function handleError(_0x4ca399,_0xffaa60){_0xffaa60=_0xffaa60||0x1f4;return function(_0x389ea3){logger['error'](_0x389ea3[_0x0670('0x23')]);if(_0x389ea3['name']){delete _0x389ea3[_0x0670('0x24')];}_0x4ca399['status'](_0xffaa60)[_0x0670('0x25')](_0x389ea3);};}exports[_0x0670('0x26')]=function(_0x4e3447,_0x40bce3){var _0x558d7e={},_0x2d1aee={},_0x41c2b1={'count':0x0,'rows':[]};var _0x1a6df3=_['map'](db[_0x0670('0x27')][_0x0670('0x28')],function(_0x4ddca6){return{'name':_0x4ddca6[_0x0670('0x29')],'type':_0x4ddca6[_0x0670('0x2a')][_0x0670('0x2b')]};});_0x2d1aee[_0x0670('0x2c')]=_[_0x0670('0x2d')](_0x1a6df3,'name');_0x2d1aee[_0x0670('0x2e')]=_['keys'](_0x4e3447['query']);_0x2d1aee[_0x0670('0x2f')]=_[_0x0670('0x30')](_0x2d1aee[_0x0670('0x2c')],_0x2d1aee[_0x0670('0x2e')]);_0x558d7e[_0x0670('0x31')]=_[_0x0670('0x30')](_0x2d1aee[_0x0670('0x2c')],qs[_0x0670('0x32')](_0x4e3447[_0x0670('0x2e')][_0x0670('0x32')]));_0x558d7e[_0x0670('0x31')]=_0x558d7e[_0x0670('0x31')][_0x0670('0x33')]?_0x558d7e[_0x0670('0x31')]:_0x2d1aee[_0x0670('0x2c')];if(!_0x4e3447[_0x0670('0x2e')][_0x0670('0x34')]('nolimit')){_0x558d7e[_0x0670('0x1d')]=qs[_0x0670('0x1d')](_0x4e3447[_0x0670('0x2e')][_0x0670('0x1d')]);_0x558d7e['offset']=qs['offset'](_0x4e3447['query'][_0x0670('0x1c')]);}_0x558d7e['order']=qs[_0x0670('0x35')](_0x4e3447[_0x0670('0x2e')][_0x0670('0x35')]);_0x558d7e['where']=qs[_0x0670('0x2f')](_[_0x0670('0x36')](_0x4e3447['query'],_0x2d1aee[_0x0670('0x2f')]),_0x1a6df3);if(_0x4e3447[_0x0670('0x2e')][_0x0670('0x37')]){_0x558d7e[_0x0670('0x38')]=_[_0x0670('0x39')](_0x558d7e[_0x0670('0x38')],{'$or':_[_0x0670('0x2d')](_0x1a6df3,function(_0x436d0d){if(_0x436d0d[_0x0670('0x2a')]!==_0x0670('0x3a')){var _0x558826={};_0x558826[_0x436d0d[_0x0670('0x24')]]={'$like':'%'+_0x4e3447[_0x0670('0x2e')][_0x0670('0x37')]+'%'};return _0x558826;}})});}_0x558d7e=_[_0x0670('0x39')]({},_0x558d7e,_0x4e3447[_0x0670('0x3b')]);var _0x15eb95={'where':_0x558d7e[_0x0670('0x38')]};return db['UserProfileSection'][_0x0670('0x3c')](_0x15eb95)[_0x0670('0x3d')](function(_0x596b5b){_0x41c2b1['count']=_0x596b5b;if(_0x4e3447[_0x0670('0x2e')][_0x0670('0x3e')]){_0x558d7e['include']=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x558d7e);})[_0x0670('0x3d')](function(_0x47c282){_0x41c2b1['rows']=_0x47c282;return _0x41c2b1;})[_0x0670('0x3d')](respondWithFilteredResult(_0x40bce3,_0x558d7e))['catch'](handleError(_0x40bce3,null));};exports[_0x0670('0x3f')]=function(_0x55ec46,_0x236f8b){var _0x34d8cf={'raw':![],'where':{'id':_0x55ec46[_0x0670('0x40')]['id']}},_0x3b2f77={};_0x3b2f77[_0x0670('0x2c')]=_[_0x0670('0x41')](db[_0x0670('0x27')][_0x0670('0x28')]);_0x3b2f77[_0x0670('0x2e')]=_[_0x0670('0x41')](_0x55ec46['query']);_0x3b2f77[_0x0670('0x2f')]=_[_0x0670('0x30')](_0x3b2f77[_0x0670('0x2c')],_0x3b2f77['query']);_0x34d8cf[_0x0670('0x31')]=_[_0x0670('0x30')](_0x3b2f77[_0x0670('0x2c')],qs[_0x0670('0x32')](_0x55ec46[_0x0670('0x2e')][_0x0670('0x32')]));_0x34d8cf[_0x0670('0x31')]=_0x34d8cf['attributes'][_0x0670('0x33')]?_0x34d8cf[_0x0670('0x31')]:_0x3b2f77['model'];if(_0x55ec46[_0x0670('0x2e')][_0x0670('0x3e')]){_0x34d8cf[_0x0670('0x42')]=[{'all':!![]}];}_0x34d8cf=_[_0x0670('0x39')]({},_0x34d8cf,_0x55ec46['options']);return db[_0x0670('0x27')]['find'](_0x34d8cf)[_0x0670('0x3d')](handleEntityNotFound(_0x236f8b,null))[_0x0670('0x3d')](respondWithResult(_0x236f8b,null))[_0x0670('0x43')](handleError(_0x236f8b,null));};exports['create']=function(_0x428111,_0x251a83){return db['UserProfileSection'][_0x0670('0x44')](_0x428111[_0x0670('0x45')],{})[_0x0670('0x3d')](respondWithResult(_0x251a83,0xc9))[_0x0670('0x43')](handleError(_0x251a83,null));};exports[_0x0670('0x22')]=function(_0x1311d8,_0x5060f4){if(_0x1311d8[_0x0670('0x45')]['id']){delete _0x1311d8['body']['id'];}return db[_0x0670('0x27')][_0x0670('0x46')]({'where':{'id':_0x1311d8[_0x0670('0x40')]['id']}})[_0x0670('0x3d')](handleEntityNotFound(_0x5060f4,null))[_0x0670('0x3d')](saveUpdates(_0x1311d8['body'],null))['then'](respondWithResult(_0x5060f4,null))[_0x0670('0x43')](handleError(_0x5060f4,null));};exports[_0x0670('0x47')]=function(_0x1d0b00,_0x11710d){return db['UserProfileSection'][_0x0670('0x46')]({'where':{'id':_0x1d0b00[_0x0670('0x40')]['id']}})['then'](handleEntityNotFound(_0x11710d,null))[_0x0670('0x3d')](removeEntity(_0x11710d,null))[_0x0670('0x43')](handleError(_0x11710d,null));};exports['describe']=function(_0x1e79d6,_0x26e2dd){return db[_0x0670('0x27')][_0x0670('0x48')]()['then'](respondWithResult(_0x26e2dd,null))['catch'](handleError(_0x26e2dd,null));}; \ No newline at end of file +var _0x4757=['name','send','UserProfileSection','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack'];(function(_0x161e04,_0x15ea3d){var _0x26ab63=function(_0x2a66fa){while(--_0x2a66fa){_0x161e04['push'](_0x161e04['shift']());}};_0x26ab63(++_0x15ea3d);}(_0x4757,0x6f));var _0x7475=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4757[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0x7475('0x0'));var emlformat=require(_0x7475('0x1'));var rimraf=require(_0x7475('0x2'));var zipdir=require(_0x7475('0x3'));var jsonpatch=require(_0x7475('0x4'));var rp=require(_0x7475('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7475('0x6'));var path=require(_0x7475('0x7'));var sox=require(_0x7475('0x8'));var csv=require(_0x7475('0x9'));var ejs=require(_0x7475('0xa'));var fs=require('fs');var _=require(_0x7475('0xb'));var squel=require(_0x7475('0xc'));var crypto=require(_0x7475('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7475('0xe'));var toCsv=require(_0x7475('0x9'));var querystring=require(_0x7475('0xf'));var Papa=require('papaparse');var Redis=require(_0x7475('0x10'));var authService=require(_0x7475('0x11'));var qs=require(_0x7475('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7475('0x13'));var logger=require('../../config/logger')(_0x7475('0x14'));var utils=require('../../config/utils');var config=require(_0x7475('0x15'));var licenseUtil=require(_0x7475('0x16'));var db=require(_0x7475('0x17'))['db'];function respondWithStatusCode(_0x1f9231,_0x498844){_0x498844=_0x498844||0xcc;return function(_0x41f5b9){if(_0x41f5b9){return _0x1f9231['sendStatus'](_0x498844);}return _0x1f9231[_0x7475('0x18')](_0x498844)['end']();};}function respondWithResult(_0x3ee8b0,_0x5dce20){_0x5dce20=_0x5dce20||0xc8;return function(_0x158807){if(_0x158807){return _0x3ee8b0['status'](_0x5dce20)[_0x7475('0x19')](_0x158807);}};}function respondWithFilteredResult(_0x4616fb,_0x230d42){return function(_0xdc6448){if(_0xdc6448){var _0x4ff4b7=_0xdc6448[_0x7475('0x1a')],_0x5b79d2=_0x230d42['offset'],_0x36621b=_0x230d42[_0x7475('0x1b')]+_0x230d42[_0x7475('0x1c')],_0x631122;if(_0x36621b>=_0x4ff4b7){_0x36621b=_0x4ff4b7;_0x631122=0xc8;}else{_0x631122=0xce;}_0x4616fb[_0x7475('0x18')](_0x631122);return _0x4616fb[_0x7475('0x1d')](_0x7475('0x1e'),_0x5b79d2+'-'+_0x36621b+'/'+_0x4ff4b7)['json'](_0xdc6448);}return null;};}function patchUpdates(_0x48a51e){return function(_0x24dc28){try{jsonpatch[_0x7475('0x1f')](_0x24dc28,_0x48a51e,!![]);}catch(_0x52b334){return BPromise[_0x7475('0x20')](_0x52b334);}return _0x24dc28[_0x7475('0x21')]();};}function saveUpdates(_0x546f13,_0x328ff8){return function(_0x5de3a1){if(_0x5de3a1){return _0x5de3a1['update'](_0x546f13)[_0x7475('0x22')](function(_0x3f9334){return _0x3f9334;});}return null;};}function removeEntity(_0x1462a0,_0x285e44){return function(_0x2b1e3e){if(_0x2b1e3e){return _0x2b1e3e[_0x7475('0x23')]()[_0x7475('0x22')](function(){_0x1462a0[_0x7475('0x18')](0xcc)[_0x7475('0x24')]();});}};}function handleEntityNotFound(_0x23c591,_0x3a2dc8){return function(_0x54266b){if(!_0x54266b){_0x23c591['sendStatus'](0x194);}return _0x54266b;};}function handleError(_0x4807d6,_0x1896c7){_0x1896c7=_0x1896c7||0x1f4;return function(_0x105f8c){logger[_0x7475('0x25')](_0x105f8c[_0x7475('0x26')]);if(_0x105f8c[_0x7475('0x27')]){delete _0x105f8c[_0x7475('0x27')];}_0x4807d6[_0x7475('0x18')](_0x1896c7)[_0x7475('0x28')](_0x105f8c);};}exports['index']=function(_0x3cfad2,_0x17d27d){var _0x42f849={},_0x83826f={},_0x5aee76={'count':0x0,'rows':[]};var _0x3ee7ea=_['map'](db[_0x7475('0x29')][_0x7475('0x2a')],function(_0x11cecb){return{'name':_0x11cecb[_0x7475('0x2b')],'type':_0x11cecb['type'][_0x7475('0x2c')]};});_0x83826f[_0x7475('0x2d')]=_[_0x7475('0x2e')](_0x3ee7ea,_0x7475('0x27'));_0x83826f['query']=_[_0x7475('0x2f')](_0x3cfad2[_0x7475('0x30')]);_0x83826f[_0x7475('0x31')]=_[_0x7475('0x32')](_0x83826f[_0x7475('0x2d')],_0x83826f[_0x7475('0x30')]);_0x42f849[_0x7475('0x33')]=_[_0x7475('0x32')](_0x83826f[_0x7475('0x2d')],qs['fields'](_0x3cfad2[_0x7475('0x30')]['fields']));_0x42f849[_0x7475('0x33')]=_0x42f849[_0x7475('0x33')]['length']?_0x42f849[_0x7475('0x33')]:_0x83826f[_0x7475('0x2d')];if(!_0x3cfad2[_0x7475('0x30')][_0x7475('0x34')](_0x7475('0x35'))){_0x42f849[_0x7475('0x1c')]=qs['limit'](_0x3cfad2['query']['limit']);_0x42f849[_0x7475('0x1b')]=qs[_0x7475('0x1b')](_0x3cfad2['query'][_0x7475('0x1b')]);}_0x42f849[_0x7475('0x36')]=qs[_0x7475('0x37')](_0x3cfad2[_0x7475('0x30')][_0x7475('0x37')]);_0x42f849[_0x7475('0x38')]=qs[_0x7475('0x31')](_[_0x7475('0x39')](_0x3cfad2['query'],_0x83826f[_0x7475('0x31')]),_0x3ee7ea);if(_0x3cfad2[_0x7475('0x30')][_0x7475('0x3a')]){_0x42f849['where']=_[_0x7475('0x3b')](_0x42f849[_0x7475('0x38')],{'$or':_[_0x7475('0x2e')](_0x3ee7ea,function(_0x2c9b03){if(_0x2c9b03[_0x7475('0x3c')]!=='VIRTUAL'){var _0x308a39={};_0x308a39[_0x2c9b03[_0x7475('0x27')]]={'$like':'%'+_0x3cfad2['query'][_0x7475('0x3a')]+'%'};return _0x308a39;}})});}_0x42f849=_[_0x7475('0x3b')]({},_0x42f849,_0x3cfad2[_0x7475('0x3d')]);var _0x5a86ed={'where':_0x42f849[_0x7475('0x38')]};return db['UserProfileSection'][_0x7475('0x1a')](_0x5a86ed)[_0x7475('0x22')](function(_0x329004){_0x5aee76['count']=_0x329004;if(_0x3cfad2[_0x7475('0x30')][_0x7475('0x3e')]){_0x42f849[_0x7475('0x3f')]=[{'all':!![]}];}return db[_0x7475('0x29')][_0x7475('0x40')](_0x42f849);})['then'](function(_0x5eb0fc){_0x5aee76[_0x7475('0x41')]=_0x5eb0fc;return _0x5aee76;})[_0x7475('0x22')](respondWithFilteredResult(_0x17d27d,_0x42f849))[_0x7475('0x42')](handleError(_0x17d27d,null));};exports[_0x7475('0x43')]=function(_0x41f386,_0x1e9fbc){var _0x5d89c8={'raw':![],'where':{'id':_0x41f386[_0x7475('0x44')]['id']}},_0xd5b359={};_0xd5b359[_0x7475('0x2d')]=_[_0x7475('0x2f')](db[_0x7475('0x29')][_0x7475('0x2a')]);_0xd5b359[_0x7475('0x30')]=_['keys'](_0x41f386[_0x7475('0x30')]);_0xd5b359[_0x7475('0x31')]=_['intersection'](_0xd5b359[_0x7475('0x2d')],_0xd5b359[_0x7475('0x30')]);_0x5d89c8['attributes']=_[_0x7475('0x32')](_0xd5b359[_0x7475('0x2d')],qs[_0x7475('0x45')](_0x41f386[_0x7475('0x30')][_0x7475('0x45')]));_0x5d89c8[_0x7475('0x33')]=_0x5d89c8[_0x7475('0x33')]['length']?_0x5d89c8[_0x7475('0x33')]:_0xd5b359[_0x7475('0x2d')];if(_0x41f386['query'][_0x7475('0x3e')]){_0x5d89c8['include']=[{'all':!![]}];}_0x5d89c8=_[_0x7475('0x3b')]({},_0x5d89c8,_0x41f386[_0x7475('0x3d')]);return db[_0x7475('0x29')][_0x7475('0x46')](_0x5d89c8)[_0x7475('0x22')](handleEntityNotFound(_0x1e9fbc,null))[_0x7475('0x22')](respondWithResult(_0x1e9fbc,null))[_0x7475('0x42')](handleError(_0x1e9fbc,null));};exports['create']=function(_0x5b55f7,_0x48e91e){return db[_0x7475('0x29')][_0x7475('0x47')](_0x5b55f7[_0x7475('0x48')],{})['then'](respondWithResult(_0x48e91e,0xc9))[_0x7475('0x42')](handleError(_0x48e91e,null));};exports[_0x7475('0x49')]=function(_0x1fe286,_0x5a5f75){if(_0x1fe286['body']['id']){delete _0x1fe286[_0x7475('0x48')]['id'];}return db[_0x7475('0x29')][_0x7475('0x46')]({'where':{'id':_0x1fe286['params']['id']}})['then'](handleEntityNotFound(_0x5a5f75,null))['then'](saveUpdates(_0x1fe286[_0x7475('0x48')],null))[_0x7475('0x22')](respondWithResult(_0x5a5f75,null))[_0x7475('0x42')](handleError(_0x5a5f75,null));};exports[_0x7475('0x23')]=function(_0x1836f8,_0x1fc4c3){return db[_0x7475('0x29')][_0x7475('0x46')]({'where':{'id':_0x1836f8[_0x7475('0x44')]['id']}})['then'](handleEntityNotFound(_0x1fc4c3,null))['then'](removeEntity(_0x1fc4c3,null))['catch'](handleError(_0x1fc4c3,null));};exports[_0x7475('0x4a')]=function(_0x55f7b3,_0x306d2e){return db['UserProfileSection'][_0x7475('0x4a')]()[_0x7475('0x22')](respondWithResult(_0x306d2e,null))['catch'](handleError(_0x306d2e,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 44f7f69..c56ce17 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 _0x01ad=['bluebird','request-promise','path','../../config/environment','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','lodash','util','api','moment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x01ad,0x168));var _0xd01a=function(_0x189cbc,_0x18aa5a){_0x189cbc=_0x189cbc-0x0;var _0x31d0db=_0x01ad[_0x189cbc];return _0x31d0db;};'use strict';var _=require(_0xd01a('0x0'));var util=require(_0xd01a('0x1'));var logger=require('../../config/logger')(_0xd01a('0x2'));var moment=require(_0xd01a('0x3'));var BPromise=require(_0xd01a('0x4'));var rp=require(_0xd01a('0x5'));var fs=require('fs');var path=require(_0xd01a('0x6'));var rimraf=require('rimraf');var config=require(_0xd01a('0x7'));var attributes=require('./userProfileSection.attributes');module[_0xd01a('0x8')]=function(_0x1a23c6,_0x2a39b6){return _0x1a23c6[_0xd01a('0x9')](_0xd01a('0xa'),attributes,{'tableName':_0xd01a('0xb'),'paranoid':![],'indexes':[{'name':_0xd01a('0xc'),'fields':[_0xd01a('0xd'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb99b=['userProfileId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','user_profile_has_sections','compositeIndex'];(function(_0x3afb25,_0x5be96c){var _0x108fa4=function(_0x557cc7){while(--_0x557cc7){_0x3afb25['push'](_0x3afb25['shift']());}};_0x108fa4(++_0x5be96c);}(_0xb99b,0xa9));var _0xbb99=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb99b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbb99('0x0'));var util=require('util');var logger=require(_0xbb99('0x1'))(_0xbb99('0x2'));var moment=require('moment');var BPromise=require(_0xbb99('0x3'));var rp=require(_0xbb99('0x4'));var fs=require('fs');var path=require(_0xbb99('0x5'));var rimraf=require(_0xbb99('0x6'));var config=require(_0xbb99('0x7'));var attributes=require('./userProfileSection.attributes');module[_0xbb99('0x8')]=function(_0x156d6c,_0x91bc33){return _0x156d6c['define']('UserProfileSection',attributes,{'tableName':_0xbb99('0x9'),'paranoid':![],'indexes':[{'name':_0xbb99('0xa'),'fields':['sectionId',_0xbb99('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 6a87c27..888b324 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 _0x6e3b=['../../config/environment','jayson/promise','client','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','randomstring','../../mysqldb','rpc'];(function(_0x1a96de,_0x128794){var _0x1d139d=function(_0x5ec651){while(--_0x5ec651){_0x1a96de['push'](_0x1a96de['shift']());}};_0x1d139d(++_0x128794);}(_0x6e3b,0x19e));var _0xb6e3=function(_0x3e694a,_0x5ced71){_0x3e694a=_0x3e694a-0x0;var _0x4abd3d=_0x6e3b[_0x3e694a];return _0x4abd3d;};'use strict';var _=require(_0xb6e3('0x0'));var util=require(_0xb6e3('0x1'));var moment=require('moment');var BPromise=require(_0xb6e3('0x2'));var rs=require(_0xb6e3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb6e3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb6e3('0x5'));var config=require(_0xb6e3('0x6'));var jayson=require(_0xb6e3('0x7'));var client=jayson[_0xb6e3('0x8')][_0xb6e3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ad3bc,_0x798dee,_0x43d8f5){return new BPromise(function(_0x504645,_0x1c2593){return client[_0xb6e3('0xa')](_0x1ad3bc,_0x43d8f5)['then'](function(_0x54286a){logger[_0xb6e3('0xb')](_0xb6e3('0xc'),_0x798dee,_0xb6e3('0xd'));logger[_0xb6e3('0xe')](_0xb6e3('0xf'),_0x798dee,_0xb6e3('0xd'),JSON[_0xb6e3('0x10')](_0x54286a));if(_0x54286a[_0xb6e3('0x11')]){if(_0x54286a[_0xb6e3('0x11')][_0xb6e3('0x12')]===0x1f4){logger[_0xb6e3('0x11')](_0xb6e3('0xc'),_0x798dee,_0x54286a[_0xb6e3('0x11')][_0xb6e3('0x13')]);return _0x1c2593(_0x54286a['error'][_0xb6e3('0x13')]);}logger['error'](_0xb6e3('0xc'),_0x798dee,_0x54286a[_0xb6e3('0x11')][_0xb6e3('0x13')]);return _0x504645(_0x54286a[_0xb6e3('0x11')]['message']);}else{logger[_0xb6e3('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x798dee,_0xb6e3('0xd'));_0x504645(_0x54286a['result']['message']);}})['catch'](function(_0x6f4fe5){logger[_0xb6e3('0x11')](_0xb6e3('0xc'),_0x798dee,_0x6f4fe5);_0x1c2593(_0x6f4fe5);});});} \ No newline at end of file +var _0xaaae=['debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','UserProfileSection,\x20%s,\x20%s','request\x20sent'];(function(_0x5b7b26,_0x26bac8){var _0x1e9d89=function(_0x27477f){while(--_0x27477f){_0x5b7b26['push'](_0x5b7b26['shift']());}};_0x1e9d89(++_0x26bac8);}(_0xaaae,0x10b));var _0xeaaa=function(_0x44364f,_0x3bc378){_0x44364f=_0x44364f-0x0;var _0x67693c=_0xaaae[_0x44364f];return _0x67693c;};'use strict';var _=require('lodash');var util=require(_0xeaaa('0x0'));var moment=require('moment');var BPromise=require(_0xeaaa('0x1'));var rs=require(_0xeaaa('0x2'));var fs=require('fs');var Redis=require(_0xeaaa('0x3'));var db=require(_0xeaaa('0x4'))['db'];var utils=require(_0xeaaa('0x5'));var logger=require(_0xeaaa('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xeaaa('0x7'));var client=jayson[_0xeaaa('0x8')][_0xeaaa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xede1e4,_0x1de6a5,_0x1bd71b){return new BPromise(function(_0x5eb9a8,_0x167507){return client[_0xeaaa('0xa')](_0xede1e4,_0x1bd71b)['then'](function(_0x48bbc0){logger['info'](_0xeaaa('0xb'),_0x1de6a5,_0xeaaa('0xc'));logger[_0xeaaa('0xd')](_0xeaaa('0xe'),_0x1de6a5,_0xeaaa('0xc'),JSON['stringify'](_0x48bbc0));if(_0x48bbc0[_0xeaaa('0xf')]){if(_0x48bbc0[_0xeaaa('0xf')]['code']===0x1f4){logger[_0xeaaa('0xf')](_0xeaaa('0xb'),_0x1de6a5,_0x48bbc0['error'][_0xeaaa('0x10')]);return _0x167507(_0x48bbc0[_0xeaaa('0xf')]['message']);}logger[_0xeaaa('0xf')](_0xeaaa('0xb'),_0x1de6a5,_0x48bbc0[_0xeaaa('0xf')][_0xeaaa('0x10')]);return _0x5eb9a8(_0x48bbc0[_0xeaaa('0xf')][_0xeaaa('0x10')]);}else{logger[_0xeaaa('0x11')](_0xeaaa('0xb'),_0x1de6a5,_0xeaaa('0xc'));_0x5eb9a8(_0x48bbc0[_0xeaaa('0x12')]['message']);}})[_0xeaaa('0x13')](function(_0x59d428){logger[_0xeaaa('0xf')](_0xeaaa('0xb'),_0x1de6a5,_0x59d428);_0x167507(_0x59d428);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index c3386bf..4e0d37b 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 _0x8f18=['express','Router','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x5448e2,_0x2a0a3f){var _0x2f1ef=function(_0x285381){while(--_0x285381){_0x5448e2['push'](_0x5448e2['shift']());}};_0x2f1ef(++_0x2a0a3f);}(_0x8f18,0x108));var _0x88f1=function(_0x1faddc,_0x5c1146){_0x1faddc=_0x1faddc-0x0;var _0x4015de=_0x8f18[_0x1faddc];return _0x4015de;};'use strict';var multer=require(_0x88f1('0x0'));var util=require(_0x88f1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x88f1('0x2'));var router=express[_0x88f1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x88f1('0x4'));var config=require(_0x88f1('0x5'));module[_0x88f1('0x6')]=router; \ No newline at end of file +var _0xb1fc=['../../config/environment','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0xcf8113,_0x5158c7){var _0x1b9f84=function(_0x48c911){while(--_0x48c911){_0xcf8113['push'](_0xcf8113['shift']());}};_0x1b9f84(++_0x5158c7);}(_0xb1fc,0x17b));var _0xcb1f=function(_0x18c154,_0x5d7da5){_0x18c154=_0x18c154-0x0;var _0xa32d85=_0xb1fc[_0x18c154];return _0xa32d85;};'use strict';var multer=require(_0xcb1f('0x0'));var util=require(_0xcb1f('0x1'));var path=require('path');var timeout=require(_0xcb1f('0x2'));var express=require(_0xcb1f('0x3'));var router=express[_0xcb1f('0x4')]();var auth=require(_0xcb1f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcb1f('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index d473c69..4c04093 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x34ce80,_0x3207e1){var _0x32fb0d=function(_0x1b58c1){while(--_0x1b58c1){_0x34ce80['push'](_0x34ce80['shift']());}};_0x32fb0d(++_0x3207e1);}(_0xe706,0xa3));var _0x6e70=function(_0x20a005,_0x3267c4){_0x20a005=_0x20a005-0x0;var _0x318723=_0xe706[_0x20a005];return _0x318723;};'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(_0x310d10,_0x3fe887){var _0x1fb8af=function(_0x42965b){while(--_0x42965b){_0x310d10['push'](_0x310d10['shift']());}};_0x1fb8af(++_0x3fe887);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'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 b749e3c..3824ac2 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 _0x7b55=['./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x1ecbbb,_0x38811a){var _0x1327a6=function(_0x4a1d45){while(--_0x4a1d45){_0x1ecbbb['push'](_0x1ecbbb['shift']());}};_0x1327a6(++_0x38811a);}(_0x7b55,0x70));var _0x57b5=function(_0x5892e3,_0x4385d2){_0x5892e3=_0x5892e3-0x0;var _0x122e8d=_0x7b55[_0x5892e3];return _0x122e8d;};'use strict';var _=require(_0x57b5('0x0'));var util=require(_0x57b5('0x1'));var logger=require(_0x57b5('0x2'))(_0x57b5('0x3'));var moment=require(_0x57b5('0x4'));var BPromise=require(_0x57b5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x57b5('0x6'));var config=require(_0x57b5('0x7'));var attributes=require(_0x57b5('0x8'));module[_0x57b5('0x9')]=function(_0x1de597,_0x46312a){return _0x1de597[_0x57b5('0xa')]('UserSmsQueue',attributes,{'tableName':_0x57b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d46=['exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','path','../../config/environment'];(function(_0x2e0636,_0x52f599){var _0x391da1=function(_0x412a99){while(--_0x412a99){_0x2e0636['push'](_0x2e0636['shift']());}};_0x391da1(++_0x52f599);}(_0x8d46,0x138));var _0x68d4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8d46[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x68d4('0x0'));var util=require(_0x68d4('0x1'));var logger=require(_0x68d4('0x2'))(_0x68d4('0x3'));var moment=require(_0x68d4('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x68d4('0x5'));var rimraf=require('rimraf');var config=require(_0x68d4('0x6'));var attributes=require('./userSmsQueue.attributes');module[_0x68d4('0x7')]=function(_0x531618,_0x116563){return _0x531618[_0x68d4('0x8')](_0x68d4('0x9'),attributes,{'tableName':_0x68d4('0xa'),'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 e2ce0b9..4ed4a00 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 _0x6059=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserSmsQueue,\x20%s,\x20%s','message','result','lodash','moment','randomstring'];(function(_0x5d7212,_0x1732eb){var _0xa3ca4b=function(_0x49fbee){while(--_0x49fbee){_0x5d7212['push'](_0x5d7212['shift']());}};_0xa3ca4b(++_0x1732eb);}(_0x6059,0x131));var _0x9605=function(_0x2183ca,_0x3778a9){_0x2183ca=_0x2183ca-0x0;var _0x21d00e=_0x6059[_0x2183ca];return _0x21d00e;};'use strict';var _=require(_0x9605('0x0'));var util=require('util');var moment=require(_0x9605('0x1'));var BPromise=require('bluebird');var rs=require(_0x9605('0x2'));var fs=require('fs');var Redis=require(_0x9605('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9605('0x4'));var logger=require(_0x9605('0x5'))(_0x9605('0x6'));var config=require(_0x9605('0x7'));var jayson=require(_0x9605('0x8'));var client=jayson[_0x9605('0x9')][_0x9605('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d4b2f,_0x45b0a9,_0x4ad123){return new BPromise(function(_0x12ad27,_0x890b8e){return client[_0x9605('0xb')](_0x3d4b2f,_0x4ad123)[_0x9605('0xc')](function(_0x228905){logger[_0x9605('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x45b0a9,'request\x20sent');logger[_0x9605('0xe')](_0x9605('0xf'),_0x45b0a9,_0x9605('0x10'),JSON[_0x9605('0x11')](_0x228905));if(_0x228905['error']){if(_0x228905[_0x9605('0x12')]['code']===0x1f4){logger[_0x9605('0x12')](_0x9605('0x13'),_0x45b0a9,_0x228905[_0x9605('0x12')][_0x9605('0x14')]);return _0x890b8e(_0x228905[_0x9605('0x12')]['message']);}logger[_0x9605('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x45b0a9,_0x228905[_0x9605('0x12')][_0x9605('0x14')]);return _0x12ad27(_0x228905[_0x9605('0x12')][_0x9605('0x14')]);}else{logger[_0x9605('0xd')](_0x9605('0x13'),_0x45b0a9,'request\x20sent');_0x12ad27(_0x228905[_0x9605('0x15')][_0x9605('0x14')]);}})['catch'](function(_0x32311d){logger[_0x9605('0x12')](_0x9605('0x13'),_0x45b0a9,_0x32311d);_0x890b8e(_0x32311d);});});} \ No newline at end of file +var _0xd5df=['debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','UserSmsQueue,\x20%s,\x20%s'];(function(_0x4ef824,_0x5c0839){var _0x43d139=function(_0x4ba86d){while(--_0x4ba86d){_0x4ef824['push'](_0x4ef824['shift']());}};_0x43d139(++_0x5c0839);}(_0xd5df,0x1d8));var _0xfd5d=function(_0xaa74c9,_0x1ee8c4){_0xaa74c9=_0xaa74c9-0x0;var _0x3582ec=_0xd5df[_0xaa74c9];return _0x3582ec;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd5d('0x0'))['db'];var utils=require(_0xfd5d('0x1'));var logger=require(_0xfd5d('0x2'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfd5d('0x3'));var client=jayson[_0xfd5d('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2bfcf0,_0x30864c,_0x11ee7b){return new BPromise(function(_0x3e3451,_0x3759a5){return client[_0xfd5d('0x5')](_0x2bfcf0,_0x11ee7b)[_0xfd5d('0x6')](function(_0x3a6564){logger['info'](_0xfd5d('0x7'),_0x30864c,'request\x20sent');logger[_0xfd5d('0x8')](_0xfd5d('0x9'),_0x30864c,_0xfd5d('0xa'),JSON['stringify'](_0x3a6564));if(_0x3a6564[_0xfd5d('0xb')]){if(_0x3a6564[_0xfd5d('0xb')][_0xfd5d('0xc')]===0x1f4){logger[_0xfd5d('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x30864c,_0x3a6564[_0xfd5d('0xb')]['message']);return _0x3759a5(_0x3a6564[_0xfd5d('0xb')][_0xfd5d('0xd')]);}logger[_0xfd5d('0xb')](_0xfd5d('0x7'),_0x30864c,_0x3a6564[_0xfd5d('0xb')][_0xfd5d('0xd')]);return _0x3e3451(_0x3a6564['error'][_0xfd5d('0xd')]);}else{logger[_0xfd5d('0xe')](_0xfd5d('0x7'),_0x30864c,'request\x20sent');_0x3e3451(_0x3a6564[_0xfd5d('0xf')][_0xfd5d('0xd')]);}})['catch'](function(_0x4b2755){logger[_0xfd5d('0xb')](_0xfd5d('0x7'),_0x30864c,_0x4b2755);_0x3759a5(_0x4b2755);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index c62d20f..a2a4a37 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 _0xc5f7=['../../components/auth/service','../../components/interaction/service','exports','util','path','connect-timeout','Router'];(function(_0x3e5cee,_0x502eae){var _0xacc905=function(_0x440b56){while(--_0x440b56){_0x3e5cee['push'](_0x3e5cee['shift']());}};_0xacc905(++_0x502eae);}(_0xc5f7,0x184));var _0x7c5f=function(_0x4c1894,_0x167216){_0x4c1894=_0x4c1894-0x0;var _0x162f0f=_0xc5f7[_0x4c1894];return _0x162f0f;};'use strict';var multer=require('multer');var util=require(_0x7c5f('0x0'));var path=require(_0x7c5f('0x1'));var timeout=require(_0x7c5f('0x2'));var express=require('express');var router=express[_0x7c5f('0x3')]();var auth=require(_0x7c5f('0x4'));var interaction=require(_0x7c5f('0x5'));var config=require('../../config/environment');module[_0x7c5f('0x6')]=router; \ No newline at end of file +var _0xe9a9=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x1ebeea,_0x2f54f4){var _0x576465=function(_0x47fc77){while(--_0x47fc77){_0x1ebeea['push'](_0x1ebeea['shift']());}};_0x576465(++_0x2f54f4);}(_0xe9a9,0x1b0));var _0x9e9a=function(_0x2cb1bc,_0x5dabd7){_0x2cb1bc=_0x2cb1bc-0x0;var _0x465b10=_0xe9a9[_0x2cb1bc];return _0x465b10;};'use strict';var multer=require(_0x9e9a('0x0'));var util=require('util');var path=require(_0x9e9a('0x1'));var timeout=require(_0x9e9a('0x2'));var express=require(_0x9e9a('0x3'));var router=express[_0x9e9a('0x4')]();var auth=require(_0x9e9a('0x5'));var interaction=require(_0x9e9a('0x6'));var config=require(_0x9e9a('0x7'));module[_0x9e9a('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index f7818b8..7e451f6 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(_0x514df5,_0x3d07c3){var _0x5a63f2=function(_0x4cc1a5){while(--_0x4cc1a5){_0x514df5['push'](_0x514df5['shift']());}};_0x5a63f2(++_0x3d07c3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x52f159,_0x419d8a){var _0x156799=function(_0xf168e8){while(--_0xf168e8){_0x52f159['push'](_0x52f159['shift']());}};_0x156799(++_0x419d8a);}(_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 424c2a0..f16b1e6 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 _0x34e5=['request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','util','api','moment','bluebird'];(function(_0x33d715,_0xd039f4){var _0x516d7d=function(_0xff11aa){while(--_0xff11aa){_0x33d715['push'](_0x33d715['shift']());}};_0x516d7d(++_0xd039f4);}(_0x34e5,0x172));var _0x534e=function(_0x4a5d9a,_0x4501c1){_0x4a5d9a=_0x4a5d9a-0x0;var _0x37e2f5=_0x34e5[_0x4a5d9a];return _0x37e2f5;};'use strict';var _=require('lodash');var util=require(_0x534e('0x0'));var logger=require('../../config/logger')(_0x534e('0x1'));var moment=require(_0x534e('0x2'));var BPromise=require(_0x534e('0x3'));var rp=require(_0x534e('0x4'));var fs=require('fs');var path=require(_0x534e('0x5'));var rimraf=require('rimraf');var config=require(_0x534e('0x6'));var attributes=require(_0x534e('0x7'));module[_0x534e('0x8')]=function(_0x117f0c,_0x436a92){return _0x117f0c[_0x534e('0x9')](_0x534e('0xa'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f62=['api','moment','bluebird','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','util'];(function(_0x3c22cf,_0x4a14f4){var _0x36ec3f=function(_0x1953af){while(--_0x1953af){_0x3c22cf['push'](_0x3c22cf['shift']());}};_0x36ec3f(++_0x4a14f4);}(_0x9f62,0x154));var _0x29f6=function(_0x2781c0,_0x3a6b5b){_0x2781c0=_0x2781c0-0x0;var _0x3fa294=_0x9f62[_0x2781c0];return _0x3fa294;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 11812e5..c35f3ab 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 _0x867c=['lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x37abc1,_0x203e15){var _0x3c0527=function(_0x4c649a){while(--_0x4c649a){_0x37abc1['push'](_0x37abc1['shift']());}};_0x3c0527(++_0x203e15);}(_0x867c,0xa2));var _0xc867=function(_0x59162a,_0x10e547){_0x59162a=_0x59162a-0x0;var _0x35e50d=_0x867c[_0x59162a];return _0x35e50d;};'use strict';var _=require(_0xc867('0x0'));var util=require('util');var moment=require(_0xc867('0x1'));var BPromise=require(_0xc867('0x2'));var rs=require(_0xc867('0x3'));var fs=require('fs');var Redis=require(_0xc867('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc867('0x5'));var logger=require('../../config/logger')(_0xc867('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc867('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x32b3f0,_0x268243,_0x7c4a3f){return new BPromise(function(_0x392aeb,_0x3bc9ce){return client['request'](_0x32b3f0,_0x7c4a3f)[_0xc867('0x8')](function(_0x52c328){logger[_0xc867('0x9')](_0xc867('0xa'),_0x268243,_0xc867('0xb'));logger[_0xc867('0xc')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x268243,'request\x20sent',JSON[_0xc867('0xd')](_0x52c328));if(_0x52c328[_0xc867('0xe')]){if(_0x52c328[_0xc867('0xe')]['code']===0x1f4){logger[_0xc867('0xe')](_0xc867('0xa'),_0x268243,_0x52c328[_0xc867('0xe')][_0xc867('0xf')]);return _0x3bc9ce(_0x52c328[_0xc867('0xe')]['message']);}logger[_0xc867('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x268243,_0x52c328[_0xc867('0xe')]['message']);return _0x392aeb(_0x52c328[_0xc867('0xe')][_0xc867('0xf')]);}else{logger[_0xc867('0x9')](_0xc867('0xa'),_0x268243,_0xc867('0xb'));_0x392aeb(_0x52c328[_0xc867('0x10')][_0xc867('0xf')]);}})[_0xc867('0x11')](function(_0x2eaa94){logger['error'](_0xc867('0xa'),_0x268243,_0x2eaa94);_0x3bc9ce(_0x2eaa94);});});} \ No newline at end of file +var _0x80e3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','moment','randomstring'];(function(_0x1e4759,_0x5b023a){var _0x4ebe60=function(_0x52230a){while(--_0x52230a){_0x1e4759['push'](_0x1e4759['shift']());}};_0x4ebe60(++_0x5b023a);}(_0x80e3,0x14e));var _0x380e=function(_0x45614c,_0x58dbf1){_0x45614c=_0x45614c-0x0;var _0x361e4c=_0x80e3[_0x45614c];return _0x361e4c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x380e('0x0'));var BPromise=require('bluebird');var rs=require(_0x380e('0x1'));var fs=require('fs');var Redis=require(_0x380e('0x2'));var db=require(_0x380e('0x3'))['db'];var utils=require(_0x380e('0x4'));var logger=require(_0x380e('0x5'))(_0x380e('0x6'));var config=require(_0x380e('0x7'));var jayson=require(_0x380e('0x8'));var client=jayson[_0x380e('0x9')][_0x380e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c4be3,_0x3982a2,_0x1c855f){return new BPromise(function(_0x22d71a,_0x4d4a65){return client[_0x380e('0xb')](_0x3c4be3,_0x1c855f)[_0x380e('0xc')](function(_0x16c245){logger['info'](_0x380e('0xd'),_0x3982a2,'request\x20sent');logger[_0x380e('0xe')](_0x380e('0xf'),_0x3982a2,'request\x20sent',JSON[_0x380e('0x10')](_0x16c245));if(_0x16c245[_0x380e('0x11')]){if(_0x16c245['error'][_0x380e('0x12')]===0x1f4){logger[_0x380e('0x11')](_0x380e('0xd'),_0x3982a2,_0x16c245[_0x380e('0x11')][_0x380e('0x13')]);return _0x4d4a65(_0x16c245['error'][_0x380e('0x13')]);}logger[_0x380e('0x11')](_0x380e('0xd'),_0x3982a2,_0x16c245['error'][_0x380e('0x13')]);return _0x22d71a(_0x16c245[_0x380e('0x11')][_0x380e('0x13')]);}else{logger[_0x380e('0x14')](_0x380e('0xd'),_0x3982a2,_0x380e('0x15'));_0x22d71a(_0x16c245[_0x380e('0x16')]['message']);}})[_0x380e('0x17')](function(_0x46fc85){logger['error'](_0x380e('0xd'),_0x3982a2,_0x46fc85);_0x4d4a65(_0x46fc85);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 0f43f8e..76f5cc8 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 _0x9793=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path','connect-timeout'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0x9793,0x153));var _0x3979=function(_0x4ef3c2,_0x36e47b){_0x4ef3c2=_0x4ef3c2-0x0;var _0x486c19=_0x9793[_0x4ef3c2];return _0x486c19;};'use strict';var multer=require(_0x3979('0x0'));var util=require('util');var path=require(_0x3979('0x1'));var timeout=require(_0x3979('0x2'));var express=require(_0x3979('0x3'));var router=express[_0x3979('0x4')]();var auth=require(_0x3979('0x5'));var interaction=require(_0x3979('0x6'));var config=require(_0x3979('0x7'));module[_0x3979('0x8')]=router; \ No newline at end of file +var _0x16ca=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','Router'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x16ca,0x1b4));var _0xa16c=function(_0x1dfef9,_0x2f9407){_0x1dfef9=_0x1dfef9-0x0;var _0x532254=_0x16ca[_0x1dfef9];return _0x532254;};'use strict';var multer=require(_0xa16c('0x0'));var util=require(_0xa16c('0x1'));var path=require(_0xa16c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa16c('0x3')]();var auth=require(_0xa16c('0x4'));var interaction=require(_0xa16c('0x5'));var config=require(_0xa16c('0x6'));module[_0xa16c('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 fb991b5..272e837 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 _0xe7ce=['exports','STRING','Required\x20by\x20Asterisk','queue_interface','INTEGER','sequelize'];(function(_0xa3fbdc,_0x348243){var _0x495816=function(_0x26c657){while(--_0x26c657){_0xa3fbdc['push'](_0xa3fbdc['shift']());}};_0x495816(++_0x348243);}(_0xe7ce,0xe3));var _0xee7c=function(_0x5dee67,_0x5c4f71){_0x5dee67=_0x5dee67-0x0;var _0x3125f8=_0xe7ce[_0x5dee67];return _0x3125f8;};'use strict';var Sequelize=require(_0xee7c('0x0'));module[_0xee7c('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xee7c('0x2')],'allowNull':![],'comment':_0xee7c('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xee7c('0x2')],'allowNull':![],'unique':_0xee7c('0x4'),'comment':_0xee7c('0x3')},'VoiceQueueId':{'type':Sequelize[_0xee7c('0x5')],'allowNull':![]},'interface':{'type':Sequelize[_0xee7c('0x2')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xee7c('0x5')](0xb),'defaultValue':0x0,'comment':_0xee7c('0x3')},'paused':{'type':Sequelize[_0xee7c('0x5')](0xb),'defaultValue':0x0,'comment':_0xee7c('0x3')}}; \ No newline at end of file +var _0x7c89=['Required\x20by\x20Asterisk','queue_interface','sequelize','INTEGER'];(function(_0x468a77,_0x1382be){var _0x2d1c33=function(_0x2f2e83){while(--_0x2f2e83){_0x468a77['push'](_0x468a77['shift']());}};_0x2d1c33(++_0x1382be);}(_0x7c89,0x136));var _0x97c8=function(_0x13bfe3,_0x1011a6){_0x13bfe3=_0x13bfe3-0x0;var _0x4a8149=_0x7c89[_0x13bfe3];return _0x4a8149;};'use strict';var Sequelize=require(_0x97c8('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x97c8('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x97c8('0x2')},'VoiceQueueId':{'type':Sequelize[_0x97c8('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x97c8('0x3'),'comment':_0x97c8('0x2')},'penalty':{'type':Sequelize[_0x97c8('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x97c8('0x1')](0xb),'defaultValue':0x0,'comment':_0x97c8('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 145278c..8ad17d3 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 _0xaa1d=['hasOwnProperty','exports','events','../../mysqldb','update','remove'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0xaa1d,0xd4));var _0xdaa1=function(_0x336672,_0x5ea14b){_0x336672=_0x336672-0x0;var _0x126dbf=_0xaa1d[_0x336672];return _0x126dbf;};'use strict';var EventEmitter=require(_0xdaa1('0x0'));var UserVoiceQueueRt=require(_0xdaa1('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xdaa1('0x2'),'afterDestroy':_0xdaa1('0x3')};function emitEvent(_0x23b46d){return function(_0x1e1fb1,_0x4131b9,_0x4ecfb8){UserVoiceQueueRtEvents['emit'](_0x23b46d+':'+_0x1e1fb1['id'],_0x1e1fb1);UserVoiceQueueRtEvents['emit'](_0x23b46d,_0x1e1fb1);_0x4ecfb8(null);};}for(var e in events){if(events[_0xdaa1('0x4')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xdaa1('0x5')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x9bf2=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3b40ad,_0x5de340){var _0x24f656=function(_0x1e4218){while(--_0x1e4218){_0x3b40ad['push'](_0x3b40ad['shift']());}};_0x24f656(++_0x5de340);}(_0x9bf2,0x1d5));var _0x29bf=function(_0x293933,_0x357269){_0x293933=_0x293933-0x0;var _0x326572=_0x9bf2[_0x293933];return _0x326572;};'use strict';var EventEmitter=require(_0x29bf('0x0'));var UserVoiceQueueRt=require(_0x29bf('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x29bf('0x2')](0x0);var events={'afterCreate':_0x29bf('0x3'),'afterUpdate':_0x29bf('0x4'),'afterDestroy':_0x29bf('0x5')};function emitEvent(_0x2fb3ce){return function(_0x9484d7,_0x46dbb4,_0xd23513){UserVoiceQueueRtEvents[_0x29bf('0x6')](_0x2fb3ce+':'+_0x9484d7['id'],_0x9484d7);UserVoiceQueueRtEvents[_0x29bf('0x6')](_0x2fb3ce,_0x9484d7);_0xd23513(null);};}for(var e in events){if(events[_0x29bf('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x29bf('0x8')](e,emitEvent(event));}}module[_0x29bf('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 5f178d7..4730b4b 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 _0xa24c=['user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','UserVoiceQueueRt'];(function(_0x2a44bf,_0x3193ee){var _0x2d11da=function(_0x1e93a9){while(--_0x1e93a9){_0x2a44bf['push'](_0x2a44bf['shift']());}};_0x2d11da(++_0x3193ee);}(_0xa24c,0x109));var _0xca24=function(_0x16f7aa,_0x2b1fb1){_0x16f7aa=_0x16f7aa-0x0;var _0x324219=_0xa24c[_0x16f7aa];return _0x324219;};'use strict';var _=require(_0xca24('0x0'));var util=require(_0xca24('0x1'));var logger=require(_0xca24('0x2'))(_0xca24('0x3'));var moment=require(_0xca24('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xca24('0x5'));var rimraf=require(_0xca24('0x6'));var config=require(_0xca24('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x1bc61a,_0x4c297c){return _0x1bc61a[_0xca24('0x8')](_0xca24('0x9'),attributes,{'tableName':_0xca24('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f58=['define','UserVoiceQueueRt','../../config/logger','moment','bluebird','path','rimraf','./userVoiceQueueRt.attributes','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x2f58,0x110));var _0x82f5=function(_0x3b3fc0,_0x25d51e){_0x3b3fc0=_0x3b3fc0-0x0;var _0x30b970=_0x2f58[_0x3b3fc0];return _0x30b970;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x82f5('0x0'))('api');var moment=require(_0x82f5('0x1'));var BPromise=require(_0x82f5('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x82f5('0x3'));var rimraf=require(_0x82f5('0x4'));var config=require('../../config/environment');var attributes=require(_0x82f5('0x5'));module[_0x82f5('0x6')]=function(_0x2ccb69,_0x377c7c){return _0x2ccb69[_0x82f5('0x7')](_0x82f5('0x8'),attributes,{'tableName':'user_has_voice_queues_rt','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 582ab2c..dfa006a 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 _0x6b9e=['UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueRtPauses'];(function(_0x3c6049,_0x505f14){var _0x62de73=function(_0x356de0){while(--_0x356de0){_0x3c6049['push'](_0x3c6049['shift']());}};_0x62de73(++_0x505f14);}(_0x6b9e,0xd6));var _0xe6b9=function(_0x53e274,_0x108a91){_0x53e274=_0x53e274-0x0;var _0x4ecdfd=_0x6b9e[_0x53e274];return _0x4ecdfd;};'use strict';var _=require(_0xe6b9('0x0'));var util=require(_0xe6b9('0x1'));var moment=require(_0xe6b9('0x2'));var BPromise=require(_0xe6b9('0x3'));var rs=require(_0xe6b9('0x4'));var fs=require('fs');var Redis=require(_0xe6b9('0x5'));var db=require(_0xe6b9('0x6'))['db'];var utils=require(_0xe6b9('0x7'));var logger=require(_0xe6b9('0x8'))(_0xe6b9('0x9'));var config=require(_0xe6b9('0xa'));var jayson=require(_0xe6b9('0xb'));var client=jayson[_0xe6b9('0xc')][_0xe6b9('0xd')]({'port':0x232a});config[_0xe6b9('0xe')]=_[_0xe6b9('0xf')](config[_0xe6b9('0xe')],{'host':_0xe6b9('0x10'),'port':0x18eb});var socket=require(_0xe6b9('0x11'))(new Redis(config['redis']));require(_0xe6b9('0x12'))['register'](socket);function respondWithRpcPromise(_0x4e024e,_0x574cb3,_0x40a93a){return new BPromise(function(_0x185f52,_0x40a1e8){return client[_0xe6b9('0x13')](_0x4e024e,_0x40a93a)[_0xe6b9('0x14')](function(_0x1c2929){logger[_0xe6b9('0x15')](_0xe6b9('0x16'),_0x574cb3,_0xe6b9('0x17'));logger[_0xe6b9('0x18')](_0xe6b9('0x19'),_0x574cb3,_0xe6b9('0x17'),JSON['stringify'](_0x1c2929));if(_0x1c2929['error']){if(_0x1c2929[_0xe6b9('0x1a')][_0xe6b9('0x1b')]===0x1f4){logger['error'](_0xe6b9('0x16'),_0x574cb3,_0x1c2929[_0xe6b9('0x1a')][_0xe6b9('0x1c')]);return _0x40a1e8(_0x1c2929[_0xe6b9('0x1a')][_0xe6b9('0x1c')]);}logger[_0xe6b9('0x1a')](_0xe6b9('0x16'),_0x574cb3,_0x1c2929['error']['message']);return _0x185f52(_0x1c2929[_0xe6b9('0x1a')][_0xe6b9('0x1c')]);}else{logger['info'](_0xe6b9('0x16'),_0x574cb3,_0xe6b9('0x17'));_0x185f52(_0x1c2929[_0xe6b9('0x1d')][_0xe6b9('0x1c')]);}})[_0xe6b9('0x1e')](function(_0x136fcc){logger['error'](_0xe6b9('0x16'),_0x574cb3,_0x136fcc);_0x40a1e8(_0x136fcc);});});}exports[_0xe6b9('0x1f')]=function(_0x498f0f){var _0x36adba=this;return new Promise(function(_0x17bba6,_0x918be){return db[_0xe6b9('0x20')][_0xe6b9('0x21')]({'raw':_0x498f0f[_0xe6b9('0x22')]?_0x498f0f[_0xe6b9('0x22')][_0xe6b9('0x23')]===undefined?!![]:![]:!![],'where':_0x498f0f[_0xe6b9('0x22')]?_0x498f0f[_0xe6b9('0x22')]['where']||null:null,'attributes':[[db[_0xe6b9('0x24')]['fn'](_0xe6b9('0x25'),db[_0xe6b9('0x24')]['fn']('IF',db[_0xe6b9('0x24')][_0xe6b9('0x26')](_0xe6b9('0x27')))),'outboundQueuePauses']]})['then'](function(_0x2d1dca){logger[_0xe6b9('0x15')](_0xe6b9('0x1f'),_0x498f0f);logger[_0xe6b9('0x18')]('GetVoiceQueueRtPauses',_0x498f0f,JSON[_0xe6b9('0x28')](_0x2d1dca));_0x17bba6(_0x2d1dca);})[_0xe6b9('0x1e')](function(_0x2d6281){logger[_0xe6b9('0x1a')](_0xe6b9('0x1f'),_0x2d6281[_0xe6b9('0x1c')],_0x498f0f);_0x918be(_0x36adba['error'](0x1f4,_0x2d6281[_0xe6b9('0x1c')]));});});}; \ No newline at end of file +var _0xe3ad=['catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize'];(function(_0x291d12,_0x4d21bf){var _0x428e84=function(_0x1af8ac){while(--_0x1af8ac){_0x291d12['push'](_0x291d12['shift']());}};_0x428e84(++_0x4d21bf);}(_0xe3ad,0x1c3));var _0xde3a=function(_0x2dad86,_0x181f72){_0x2dad86=_0x2dad86-0x0;var _0x901306=_0xe3ad[_0x2dad86];return _0x901306;};'use strict';var _=require(_0xde3a('0x0'));var util=require(_0xde3a('0x1'));var moment=require(_0xde3a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde3a('0x3'));var db=require(_0xde3a('0x4'))['db'];var utils=require(_0xde3a('0x5'));var logger=require(_0xde3a('0x6'))('rpc');var config=require(_0xde3a('0x7'));var jayson=require(_0xde3a('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xde3a('0x9')]=_['defaults'](config[_0xde3a('0x9')],{'host':_0xde3a('0xa'),'port':0x18eb});var socket=require(_0xde3a('0xb'))(new Redis(config[_0xde3a('0x9')]));require(_0xde3a('0xc'))[_0xde3a('0xd')](socket);function respondWithRpcPromise(_0x2a2d19,_0x41ce25,_0x2c72f1){return new BPromise(function(_0x3f3baa,_0xfd25eb){return client[_0xde3a('0xe')](_0x2a2d19,_0x2c72f1)[_0xde3a('0xf')](function(_0x87785d){logger['info'](_0xde3a('0x10'),_0x41ce25,_0xde3a('0x11'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x41ce25,'request\x20sent',JSON[_0xde3a('0x12')](_0x87785d));if(_0x87785d[_0xde3a('0x13')]){if(_0x87785d[_0xde3a('0x13')]['code']===0x1f4){logger[_0xde3a('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x41ce25,_0x87785d[_0xde3a('0x13')]['message']);return _0xfd25eb(_0x87785d[_0xde3a('0x13')]['message']);}logger[_0xde3a('0x13')](_0xde3a('0x10'),_0x41ce25,_0x87785d[_0xde3a('0x13')]['message']);return _0x3f3baa(_0x87785d['error'][_0xde3a('0x14')]);}else{logger[_0xde3a('0x15')](_0xde3a('0x10'),_0x41ce25,'request\x20sent');_0x3f3baa(_0x87785d[_0xde3a('0x16')][_0xde3a('0x14')]);}})['catch'](function(_0x47b887){logger[_0xde3a('0x13')](_0xde3a('0x10'),_0x41ce25,_0x47b887);_0xfd25eb(_0x47b887);});});}exports[_0xde3a('0x17')]=function(_0x591350){var _0xb3bbb5=this;return new Promise(function(_0x5c576a,_0x2e7b38){return db[_0xde3a('0x18')]['findAll']({'raw':_0x591350[_0xde3a('0x19')]?_0x591350[_0xde3a('0x19')][_0xde3a('0x1a')]===undefined?!![]:![]:!![],'where':_0x591350[_0xde3a('0x19')]?_0x591350[_0xde3a('0x19')][_0xde3a('0x1b')]||null:null,'attributes':[[db[_0xde3a('0x1c')]['fn']('COUNT',db[_0xde3a('0x1c')]['fn']('IF',db[_0xde3a('0x1c')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0xde3a('0xf')](function(_0x461142){logger[_0xde3a('0x15')]('GetVoiceQueueRtPauses',_0x591350);logger['debug'](_0xde3a('0x17'),_0x591350,JSON[_0xde3a('0x12')](_0x461142));_0x5c576a(_0x461142);})[_0xde3a('0x1d')](function(_0x288326){logger[_0xde3a('0x13')]('GetVoiceQueueRtPauses',_0x288326[_0xde3a('0x14')],_0x591350);_0x2e7b38(_0xb3bbb5[_0xde3a('0x13')](0x1f4,_0x288326['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 2c7977f..0d3de1d 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 _0xf6c5=['emit','removeListener','length','userVoiceQueueRt:','remove'];(function(_0x400c69,_0x5d74da){var _0x45cda5=function(_0x243708){while(--_0x243708){_0x400c69['push'](_0x400c69['shift']());}};_0x45cda5(++_0x5d74da);}(_0xf6c5,0x1d5));var _0x5f6c=function(_0x595a4b,_0x18475a){_0x595a4b=_0x595a4b-0x0;var _0x3bc83c=_0xf6c5[_0x595a4b];return _0x3bc83c;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0x5f6c('0x0'),'update'];function createListener(_0x42b480,_0xabcb84){return function(_0x25231e){_0xabcb84[_0x5f6c('0x1')](_0x42b480,_0x25231e);};}function removeListener(_0x2e2182,_0x2d2551){return function(){UserVoiceQueueRtEvents[_0x5f6c('0x2')](_0x2e2182,_0x2d2551);};}exports['register']=function(_0xc8ebb9){for(var _0x6800cc=0x0,_0x2037ea=events[_0x5f6c('0x3')];_0x6800cc<_0x2037ea;_0x6800cc++){var _0xfc5dc1=events[_0x6800cc];var _0x539251=createListener(_0x5f6c('0x4')+_0xfc5dc1,_0xc8ebb9);UserVoiceQueueRtEvents['on'](_0xfc5dc1,_0x539251);}}; \ No newline at end of file +var _0xcfd5=['./userVoiceQueueRt.events','save','remove','update','removeListener','length','userVoiceQueueRt:'];(function(_0x10e03c,_0x527bc8){var _0x257b04=function(_0x8e71d2){while(--_0x8e71d2){_0x10e03c['push'](_0x10e03c['shift']());}};_0x257b04(++_0x527bc8);}(_0xcfd5,0x188));var _0x5cfd=function(_0x3c8163,_0x10f0b3){_0x3c8163=_0x3c8163-0x0;var _0x28317b=_0xcfd5[_0x3c8163];return _0x28317b;};'use strict';var UserVoiceQueueRtEvents=require(_0x5cfd('0x0'));var events=[_0x5cfd('0x1'),_0x5cfd('0x2'),_0x5cfd('0x3')];function createListener(_0x19d1ab,_0x30cda7){return function(_0x5a3406){_0x30cda7['emit'](_0x19d1ab,_0x5a3406);};}function removeListener(_0x4fdf8e,_0x2a1e7e){return function(){UserVoiceQueueRtEvents[_0x5cfd('0x4')](_0x4fdf8e,_0x2a1e7e);};}exports['register']=function(_0x199afc){for(var _0x11e743=0x0,_0x2522af=events[_0x5cfd('0x5')];_0x11e743<_0x2522af;_0x11e743++){var _0x4f3d82=events[_0x11e743];var _0x191937=createListener(_0x5cfd('0x6')+_0x4f3d82,_0x199afc);UserVoiceQueueRtEvents['on'](_0x4f3d82,_0x191937);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 41ada1f..9781437 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 _0x6e94=['express','Router','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x6e94,0x68));var _0x46e9=function(_0x5d44d7,_0x3c13ea){_0x5d44d7=_0x5d44d7-0x0;var _0xf7b8e7=_0x6e94[_0x5d44d7];return _0xf7b8e7;};'use strict';var multer=require(_0x46e9('0x0'));var util=require(_0x46e9('0x1'));var path=require(_0x46e9('0x2'));var timeout=require(_0x46e9('0x3'));var express=require(_0x46e9('0x4'));var router=express[_0x46e9('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x46e9('0x6'));var config=require(_0x46e9('0x7'));module[_0x46e9('0x8')]=router; \ No newline at end of file +var _0xe799=['express','Router','../../components/auth/service','../../config/environment','exports','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe799,0x10d));var _0x9e79=function(_0x563912,_0x5a2948){_0x563912=_0x563912-0x0;var _0x851ece=_0xe799[_0x563912];return _0x851ece;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9e79('0x0'));var timeout=require('connect-timeout');var express=require(_0x9e79('0x1'));var router=express[_0x9e79('0x2')]();var auth=require(_0x9e79('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9e79('0x4'));module[_0x9e79('0x5')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 31b853a..b788b1c 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x146ad2,_0x11d2fc){var _0x56b9fa=function(_0xf7695a){while(--_0xf7695a){_0x146ad2['push'](_0x146ad2['shift']());}};_0x56b9fa(++_0x11d2fc);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x77a117,_0x297c6f){var _0x39cca1=function(_0x30f31d){while(--_0x30f31d){_0x77a117['push'](_0x77a117['shift']());}};_0x39cca1(++_0x297c6f);}(_0xe706,0xa3));var _0x6e70=function(_0x373b3e,_0x347ac7){_0x373b3e=_0x373b3e-0x0;var _0xa4ce3=_0xe706[_0x373b3e];return _0xa4ce3;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 402d693..6280f2b 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 _0x351d=['../../config/environment','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x3e7afb,_0x3c72d9){var _0x37bb5b=function(_0x553357){while(--_0x553357){_0x3e7afb['push'](_0x3e7afb['shift']());}};_0x37bb5b(++_0x3c72d9);}(_0x351d,0x90));var _0xd351=function(_0x72cd75,_0x48f4a0){_0x72cd75=_0x72cd75-0x0;var _0x43dede=_0x351d[_0x72cd75];return _0x43dede;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var logger=require(_0xd351('0x1'))(_0xd351('0x2'));var moment=require(_0xd351('0x3'));var BPromise=require('bluebird');var rp=require(_0xd351('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd351('0x5'));var config=require(_0xd351('0x6'));var attributes=require('./userWhatsappQueue.attributes');module[_0xd351('0x7')]=function(_0x45e9e5,_0x88bd2b){return _0x45e9e5['define'](_0xd351('0x8'),attributes,{'tableName':_0xd351('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d25=['api','moment','bluebird','request-promise','path','define','UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger'];(function(_0x8666ec,_0x34fb14){var _0x496fe8=function(_0x52361d){while(--_0x52361d){_0x8666ec['push'](_0x8666ec['shift']());}};_0x496fe8(++_0x34fb14);}(_0x7d25,0x8a));var _0x57d2=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x7d25[_0x576170];return _0x397c70;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var logger=require(_0x57d2('0x1'))(_0x57d2('0x2'));var moment=require(_0x57d2('0x3'));var BPromise=require(_0x57d2('0x4'));var rp=require(_0x57d2('0x5'));var fs=require('fs');var path=require(_0x57d2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x3c5511,_0x49cc5f){return _0x3c5511[_0x57d2('0x7')](_0x57d2('0x8'),attributes,{'tableName':_0x57d2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 1013928..283dad2 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(_0xf2cb13,_0xab93e2){var _0x4e5416=function(_0x31efa7){while(--_0x31efa7){_0xf2cb13['push'](_0xf2cb13['shift']());}};_0x4e5416(++_0xab93e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x5804b5,_0x36d084){var _0x148e74=function(_0xdadf29){while(--_0xdadf29){_0x5804b5['push'](_0x5804b5['shift']());}};_0x148e74(++_0x36d084);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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 90fbe8c..a2002ac 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 _0x291c=['../../config/environment','./variable.controller','get','index','/:id','isAuthenticated','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x412912,_0x5e1916){var _0x3c518d=function(_0x692771){while(--_0x692771){_0x412912['push'](_0x412912['shift']());}};_0x3c518d(++_0x5e1916);}(_0x291c,0x6b));var _0xc291=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x291c[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0xc291('0x0'));var util=require(_0xc291('0x1'));var path=require(_0xc291('0x2'));var timeout=require(_0xc291('0x3'));var express=require(_0xc291('0x4'));var router=express[_0xc291('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc291('0x6'));var config=require(_0xc291('0x7'));var controller=require(_0xc291('0x8'));router[_0xc291('0x9')]('/',auth['isAuthenticated'](),controller[_0xc291('0xa')]);router[_0xc291('0x9')](_0xc291('0xb'),auth[_0xc291('0xc')](),controller['show']);router[_0xc291('0xd')]('/',auth[_0xc291('0xc')](),controller[_0xc291('0xe')]);router[_0xc291('0xf')](_0xc291('0xb'),auth[_0xc291('0xc')](),controller['update']);router[_0xc291('0x10')]('/:id',auth[_0xc291('0xc')](),controller[_0xc291('0x11')]);module[_0xc291('0x12')]=router; \ No newline at end of file +var _0x7802=['get','index','isAuthenticated','show','post','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./variable.controller'];(function(_0x52a1fb,_0x47b362){var _0x70b4d7=function(_0x544e2d){while(--_0x544e2d){_0x52a1fb['push'](_0x52a1fb['shift']());}};_0x70b4d7(++_0x47b362);}(_0x7802,0xe2));var _0x2780=function(_0x5b2155,_0x11bf44){_0x5b2155=_0x5b2155-0x0;var _0x1fd657=_0x7802[_0x5b2155];return _0x1fd657;};'use strict';var multer=require(_0x2780('0x0'));var util=require(_0x2780('0x1'));var path=require(_0x2780('0x2'));var timeout=require('connect-timeout');var express=require(_0x2780('0x3'));var router=express[_0x2780('0x4')]();var auth=require(_0x2780('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2780('0x6'));var controller=require(_0x2780('0x7'));router[_0x2780('0x8')]('/',auth['isAuthenticated'](),controller[_0x2780('0x9')]);router[_0x2780('0x8')]('/:id',auth[_0x2780('0xa')](),controller[_0x2780('0xb')]);router[_0x2780('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x2780('0xd'),auth[_0x2780('0xa')](),controller[_0x2780('0xe')]);router[_0x2780('0xf')](_0x2780('0xd'),auth['isAuthenticated'](),controller[_0x2780('0x10')]);module[_0x2780('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index d29a0f4..eb5b91b 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 _0xe84e=['name','STRING','sequelize','exports'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xe84e,0x162));var _0xee84=function(_0x1a3cc7,_0x2900e3){_0x1a3cc7=_0x1a3cc7-0x0;var _0x338438=_0xe84e[_0x1a3cc7];return _0x338438;};'use strict';var Sequelize=require(_0xee84('0x0'));module[_0xee84('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xee84('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xee84('0x3')]}}; \ No newline at end of file +var _0xb427=['name','STRING'];(function(_0x56eed0,_0x50c4d9){var _0x42b2f1=function(_0x339e8b){while(--_0x339e8b){_0x56eed0['push'](_0x56eed0['shift']());}};_0x42b2f1(++_0x50c4d9);}(_0xb427,0x1ed));var _0x7b42=function(_0x49f9f8,_0x16cc18){_0x49f9f8=_0x49f9f8-0x0;var _0x31fc43=_0xb427[_0x49f9f8];return _0x31fc43;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7b42('0x0')],'unique':_0x7b42('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7b42('0x0')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index bb6180a..fec3a60 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 _0xb6a7=['update','then','destroy','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','Variable','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','offset','limit','status','Content-Range','json','apply'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xb6a7,0x1bc));var _0x7b6a=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0xb6a7[_0x65c50e];return _0x4573e7;};'use strict';var pdf=require(_0x7b6a('0x0'));var emlformat=require(_0x7b6a('0x1'));var rimraf=require(_0x7b6a('0x2'));var zipdir=require(_0x7b6a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b6a('0x4'));var moment=require('moment');var BPromise=require(_0x7b6a('0x5'));var Mustache=require(_0x7b6a('0x6'));var util=require(_0x7b6a('0x7'));var path=require(_0x7b6a('0x8'));var sox=require(_0x7b6a('0x9'));var csv=require(_0x7b6a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7b6a('0xb'));var crypto=require('crypto');var jsforce=require(_0x7b6a('0xc'));var deskjs=require(_0x7b6a('0xd'));var toCsv=require(_0x7b6a('0xa'));var querystring=require(_0x7b6a('0xe'));var Papa=require(_0x7b6a('0xf'));var Redis=require(_0x7b6a('0x10'));var authService=require(_0x7b6a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7b6a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b6a('0x13'))(_0x7b6a('0x14'));var utils=require('../../config/utils');var config=require(_0x7b6a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7b6a('0x16'))['db'];function respondWithStatusCode(_0x3583c0,_0x2f68dc){_0x2f68dc=_0x2f68dc||0xcc;return function(_0x3653c4){if(_0x3653c4){return _0x3583c0[_0x7b6a('0x17')](_0x2f68dc);}return _0x3583c0['status'](_0x2f68dc)['end']();};}function respondWithResult(_0x66066c,_0x1208ea){_0x1208ea=_0x1208ea||0xc8;return function(_0x2edca2){if(_0x2edca2){return _0x66066c['status'](_0x1208ea)['json'](_0x2edca2);}};}function respondWithFilteredResult(_0x203a15,_0x3f20f0){return function(_0x27e465){if(_0x27e465){var _0x1b8d59=_0x27e465['count'],_0x3c7c28=_0x3f20f0[_0x7b6a('0x18')],_0x506bec=_0x3f20f0[_0x7b6a('0x18')]+_0x3f20f0[_0x7b6a('0x19')],_0x24f06b;if(_0x506bec>=_0x1b8d59){_0x506bec=_0x1b8d59;_0x24f06b=0xc8;}else{_0x24f06b=0xce;}_0x203a15[_0x7b6a('0x1a')](_0x24f06b);return _0x203a15['set'](_0x7b6a('0x1b'),_0x3c7c28+'-'+_0x506bec+'/'+_0x1b8d59)[_0x7b6a('0x1c')](_0x27e465);}return null;};}function patchUpdates(_0x40d783){return function(_0xb6dfa5){try{jsonpatch[_0x7b6a('0x1d')](_0xb6dfa5,_0x40d783,!![]);}catch(_0x228069){return BPromise['reject'](_0x228069);}return _0xb6dfa5['save']();};}function saveUpdates(_0x3212a0,_0x4fea2d){return function(_0x170492){if(_0x170492){return _0x170492[_0x7b6a('0x1e')](_0x3212a0)[_0x7b6a('0x1f')](function(_0x5cf2b5){return _0x5cf2b5;});}return null;};}function removeEntity(_0x2fee4a,_0xc85082){return function(_0x5327d8){if(_0x5327d8){return _0x5327d8[_0x7b6a('0x20')]()['then'](function(){var _0x2780ba=_0x5327d8['get']({'plain':!![]});var _0x4ecf8d='Variables';return db[_0x7b6a('0x21')][_0x7b6a('0x20')]({'where':{'type':_0x4ecf8d,'resourceId':_0x2780ba['id']}})[_0x7b6a('0x1f')](function(){return _0x5327d8;});})['then'](function(){_0x2fee4a[_0x7b6a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31aaea,_0x386157){return function(_0x18f426){if(!_0x18f426){_0x31aaea['sendStatus'](0x194);}return _0x18f426;};}function handleError(_0x5a00a3,_0x3f9490){_0x3f9490=_0x3f9490||0x1f4;return function(_0x46f7b7){logger[_0x7b6a('0x22')](_0x46f7b7[_0x7b6a('0x23')]);if(_0x46f7b7['name']){delete _0x46f7b7[_0x7b6a('0x24')];}_0x5a00a3[_0x7b6a('0x1a')](_0x3f9490)[_0x7b6a('0x25')](_0x46f7b7);};}exports[_0x7b6a('0x26')]=function(_0x3be404,_0x4d7fe9){var _0x1cd140={},_0xd1f105={},_0x14f750={'count':0x0,'rows':[]};var _0x40419a=_[_0x7b6a('0x27')](db['Variable']['rawAttributes'],function(_0x5ea715){return{'name':_0x5ea715[_0x7b6a('0x28')],'type':_0x5ea715[_0x7b6a('0x29')][_0x7b6a('0x2a')]};});_0xd1f105[_0x7b6a('0x2b')]=_[_0x7b6a('0x27')](_0x40419a,'name');_0xd1f105['query']=_[_0x7b6a('0x2c')](_0x3be404[_0x7b6a('0x2d')]);_0xd1f105[_0x7b6a('0x2e')]=_[_0x7b6a('0x2f')](_0xd1f105['model'],_0xd1f105[_0x7b6a('0x2d')]);_0x1cd140[_0x7b6a('0x30')]=_[_0x7b6a('0x2f')](_0xd1f105[_0x7b6a('0x2b')],qs[_0x7b6a('0x31')](_0x3be404[_0x7b6a('0x2d')]['fields']));_0x1cd140[_0x7b6a('0x30')]=_0x1cd140['attributes'][_0x7b6a('0x32')]?_0x1cd140[_0x7b6a('0x30')]:_0xd1f105[_0x7b6a('0x2b')];if(!_0x3be404[_0x7b6a('0x2d')]['hasOwnProperty'](_0x7b6a('0x33'))){_0x1cd140['limit']=qs['limit'](_0x3be404[_0x7b6a('0x2d')][_0x7b6a('0x19')]);_0x1cd140[_0x7b6a('0x18')]=qs[_0x7b6a('0x18')](_0x3be404[_0x7b6a('0x2d')]['offset']);}_0x1cd140[_0x7b6a('0x34')]=qs[_0x7b6a('0x35')](_0x3be404[_0x7b6a('0x2d')][_0x7b6a('0x35')]);_0x1cd140[_0x7b6a('0x36')]=qs['filters'](_[_0x7b6a('0x37')](_0x3be404[_0x7b6a('0x2d')],_0xd1f105[_0x7b6a('0x2e')]),_0x40419a);if(_0x3be404[_0x7b6a('0x2d')][_0x7b6a('0x38')]){_0x1cd140[_0x7b6a('0x36')]=_[_0x7b6a('0x39')](_0x1cd140[_0x7b6a('0x36')],{'$or':_[_0x7b6a('0x27')](_0x40419a,function(_0x536476){if(_0x536476['type']!==_0x7b6a('0x3a')){var _0x24c618={};_0x24c618[_0x536476[_0x7b6a('0x24')]]={'$like':'%'+_0x3be404['query'][_0x7b6a('0x38')]+'%'};return _0x24c618;}})});}_0x1cd140=_['merge']({},_0x1cd140,_0x3be404['options']);var _0x27dab7={'where':_0x1cd140['where']};return db['Variable'][_0x7b6a('0x3b')](_0x27dab7)['then'](function(_0x45d29d){_0x14f750['count']=_0x45d29d;if(_0x3be404[_0x7b6a('0x2d')][_0x7b6a('0x3c')]){_0x1cd140[_0x7b6a('0x3d')]=[{'all':!![]}];}return db[_0x7b6a('0x3e')]['findAll'](_0x1cd140);})[_0x7b6a('0x1f')](function(_0x30ba27){_0x14f750[_0x7b6a('0x3f')]=_0x30ba27;return _0x14f750;})[_0x7b6a('0x1f')](respondWithFilteredResult(_0x4d7fe9,_0x1cd140))[_0x7b6a('0x40')](handleError(_0x4d7fe9,null));};exports[_0x7b6a('0x41')]=function(_0x2ad610,_0x32935a){var _0x6a6326={'raw':!![],'where':{'id':_0x2ad610[_0x7b6a('0x42')]['id']}},_0x164ddf={};_0x164ddf[_0x7b6a('0x2b')]=_['keys'](db[_0x7b6a('0x3e')]['rawAttributes']);_0x164ddf[_0x7b6a('0x2d')]=_['keys'](_0x2ad610['query']);_0x164ddf[_0x7b6a('0x2e')]=_['intersection'](_0x164ddf['model'],_0x164ddf['query']);_0x6a6326['attributes']=_['intersection'](_0x164ddf['model'],qs[_0x7b6a('0x31')](_0x2ad610[_0x7b6a('0x2d')][_0x7b6a('0x31')]));_0x6a6326[_0x7b6a('0x30')]=_0x6a6326[_0x7b6a('0x30')]['length']?_0x6a6326[_0x7b6a('0x30')]:_0x164ddf['model'];if(_0x2ad610[_0x7b6a('0x2d')]['includeAll']){_0x6a6326['include']=[{'all':!![]}];}_0x6a6326=_[_0x7b6a('0x39')]({},_0x6a6326,_0x2ad610['options']);return db[_0x7b6a('0x3e')][_0x7b6a('0x43')](_0x6a6326)[_0x7b6a('0x1f')](handleEntityNotFound(_0x32935a,null))['then'](respondWithResult(_0x32935a,null))['catch'](handleError(_0x32935a,null));};exports[_0x7b6a('0x44')]=function(_0x2e9739,_0x106d23){return db['Variable'][_0x7b6a('0x44')](_0x2e9739[_0x7b6a('0x45')],{})[_0x7b6a('0x1f')](function(_0x5b17b2){var _0x3cdf47=_0x2e9739[_0x7b6a('0x46')][_0x7b6a('0x47')]({'plain':!![]});if(!_0x3cdf47)throw new Error(_0x7b6a('0x48'));if(_0x3cdf47[_0x7b6a('0x49')]===_0x7b6a('0x46')){var _0x290c42=_0x5b17b2[_0x7b6a('0x47')]({'plain':!![]});var _0x4d47ae=_0x7b6a('0x4a');return db[_0x7b6a('0x4b')][_0x7b6a('0x43')]({'where':{'name':_0x4d47ae,'userProfileId':_0x3cdf47[_0x7b6a('0x4c')]},'raw':!![]})[_0x7b6a('0x1f')](function(_0x3254e1){if(_0x3254e1&&_0x3254e1[_0x7b6a('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x290c42[_0x7b6a('0x24')],'resourceId':_0x290c42['id'],'type':_0x3254e1[_0x7b6a('0x24')],'sectionId':_0x3254e1['id']},{})[_0x7b6a('0x1f')](function(){return _0x5b17b2;});}else{return _0x5b17b2;}})['catch'](function(_0x3a055c){logger[_0x7b6a('0x22')](_0x7b6a('0x4e'),_0x3a055c);throw _0x3a055c;});}return _0x5b17b2;})[_0x7b6a('0x1f')](respondWithResult(_0x106d23,0xc9))[_0x7b6a('0x40')](handleError(_0x106d23,null));};exports['update']=function(_0x9095b5,_0x4531bd){if(_0x9095b5[_0x7b6a('0x45')]['id']){delete _0x9095b5[_0x7b6a('0x45')]['id'];}return db['Variable'][_0x7b6a('0x43')]({'where':{'id':_0x9095b5[_0x7b6a('0x42')]['id']}})[_0x7b6a('0x1f')](handleEntityNotFound(_0x4531bd,null))[_0x7b6a('0x1f')](saveUpdates(_0x9095b5['body'],null))[_0x7b6a('0x1f')](respondWithResult(_0x4531bd,null))[_0x7b6a('0x40')](handleError(_0x4531bd,null));};exports['destroy']=function(_0x4284ed,_0x564b0a){return db[_0x7b6a('0x3e')]['find']({'where':{'id':_0x4284ed['params']['id']}})[_0x7b6a('0x1f')](handleEntityNotFound(_0x564b0a,null))[_0x7b6a('0x1f')](removeEntity(_0x564b0a,null))[_0x7b6a('0x40')](handleError(_0x564b0a,null));}; \ No newline at end of file +var _0xe5aa=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','Variables','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Variable','includeAll','include','rows','catch','show','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0xd4c9fb,_0x4d3cf9){var _0x2f6206=function(_0xfca509){while(--_0xfca509){_0xd4c9fb['push'](_0xd4c9fb['shift']());}};_0x2f6206(++_0x4d3cf9);}(_0xe5aa,0x19b));var _0xae5a=function(_0x325032,_0x28d05a){_0x325032=_0x325032-0x0;var _0x17aaa3=_0xe5aa[_0x325032];return _0x17aaa3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xae5a('0x0'));var rimraf=require(_0xae5a('0x1'));var zipdir=require(_0xae5a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae5a('0x3'));var moment=require(_0xae5a('0x4'));var BPromise=require(_0xae5a('0x5'));var Mustache=require(_0xae5a('0x6'));var util=require(_0xae5a('0x7'));var path=require(_0xae5a('0x8'));var sox=require(_0xae5a('0x9'));var csv=require(_0xae5a('0xa'));var ejs=require(_0xae5a('0xb'));var fs=require('fs');var _=require(_0xae5a('0xc'));var squel=require(_0xae5a('0xd'));var crypto=require(_0xae5a('0xe'));var jsforce=require(_0xae5a('0xf'));var deskjs=require(_0xae5a('0x10'));var toCsv=require('to-csv');var querystring=require(_0xae5a('0x11'));var Papa=require(_0xae5a('0x12'));var Redis=require('ioredis');var authService=require(_0xae5a('0x13'));var qs=require(_0xae5a('0x14'));var as=require(_0xae5a('0x15'));var hardwareService=require(_0xae5a('0x16'));var logger=require(_0xae5a('0x17'))(_0xae5a('0x18'));var utils=require(_0xae5a('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xae5a('0x1a'));var db=require(_0xae5a('0x1b'))['db'];function respondWithStatusCode(_0x2677fb,_0x10f2bf){_0x10f2bf=_0x10f2bf||0xcc;return function(_0x65163f){if(_0x65163f){return _0x2677fb[_0xae5a('0x1c')](_0x10f2bf);}return _0x2677fb['status'](_0x10f2bf)[_0xae5a('0x1d')]();};}function respondWithResult(_0x38b97e,_0x15f092){_0x15f092=_0x15f092||0xc8;return function(_0x1de80a){if(_0x1de80a){return _0x38b97e[_0xae5a('0x1e')](_0x15f092)[_0xae5a('0x1f')](_0x1de80a);}};}function respondWithFilteredResult(_0x891f21,_0x5b44a5){return function(_0x493e4c){if(_0x493e4c){var _0x25a7a6=_0x493e4c[_0xae5a('0x20')],_0x1743b8=_0x5b44a5[_0xae5a('0x21')],_0x1d4b45=_0x5b44a5[_0xae5a('0x21')]+_0x5b44a5[_0xae5a('0x22')],_0x1b2beb;if(_0x1d4b45>=_0x25a7a6){_0x1d4b45=_0x25a7a6;_0x1b2beb=0xc8;}else{_0x1b2beb=0xce;}_0x891f21[_0xae5a('0x1e')](_0x1b2beb);return _0x891f21[_0xae5a('0x23')](_0xae5a('0x24'),_0x1743b8+'-'+_0x1d4b45+'/'+_0x25a7a6)[_0xae5a('0x1f')](_0x493e4c);}return null;};}function patchUpdates(_0x3e6bb8){return function(_0x248edd){try{jsonpatch['apply'](_0x248edd,_0x3e6bb8,!![]);}catch(_0x1ea941){return BPromise[_0xae5a('0x25')](_0x1ea941);}return _0x248edd[_0xae5a('0x26')]();};}function saveUpdates(_0x4ca7a6,_0x146ba2){return function(_0x2a2059){if(_0x2a2059){return _0x2a2059[_0xae5a('0x27')](_0x4ca7a6)[_0xae5a('0x28')](function(_0x1c2039){return _0x1c2039;});}return null;};}function removeEntity(_0x4c5272,_0x256375){return function(_0x75fb8){if(_0x75fb8){return _0x75fb8[_0xae5a('0x29')]()[_0xae5a('0x28')](function(){var _0x1f478f=_0x75fb8['get']({'plain':!![]});var _0x3250ea=_0xae5a('0x2a');return db['UserProfileResource'][_0xae5a('0x29')]({'where':{'type':_0x3250ea,'resourceId':_0x1f478f['id']}})[_0xae5a('0x28')](function(){return _0x75fb8;});})[_0xae5a('0x28')](function(){_0x4c5272[_0xae5a('0x1e')](0xcc)[_0xae5a('0x1d')]();});}};}function handleEntityNotFound(_0x2e03e7,_0x4387aa){return function(_0x168e5d){if(!_0x168e5d){_0x2e03e7[_0xae5a('0x1c')](0x194);}return _0x168e5d;};}function handleError(_0x3bb95e,_0x292257){_0x292257=_0x292257||0x1f4;return function(_0x52104a){logger[_0xae5a('0x2b')](_0x52104a[_0xae5a('0x2c')]);if(_0x52104a['name']){delete _0x52104a[_0xae5a('0x2d')];}_0x3bb95e[_0xae5a('0x1e')](_0x292257)[_0xae5a('0x2e')](_0x52104a);};}exports[_0xae5a('0x2f')]=function(_0x5a1d61,_0x3cc1d8){var _0x5e2b30={},_0x4367d8={},_0x62d633={'count':0x0,'rows':[]};var _0x3ec112=_['map'](db['Variable'][_0xae5a('0x30')],function(_0x3d0ea4){return{'name':_0x3d0ea4[_0xae5a('0x31')],'type':_0x3d0ea4['type'][_0xae5a('0x32')]};});_0x4367d8[_0xae5a('0x33')]=_[_0xae5a('0x34')](_0x3ec112,_0xae5a('0x2d'));_0x4367d8['query']=_['keys'](_0x5a1d61[_0xae5a('0x35')]);_0x4367d8[_0xae5a('0x36')]=_[_0xae5a('0x37')](_0x4367d8[_0xae5a('0x33')],_0x4367d8['query']);_0x5e2b30['attributes']=_['intersection'](_0x4367d8[_0xae5a('0x33')],qs[_0xae5a('0x38')](_0x5a1d61['query'][_0xae5a('0x38')]));_0x5e2b30[_0xae5a('0x39')]=_0x5e2b30[_0xae5a('0x39')][_0xae5a('0x3a')]?_0x5e2b30[_0xae5a('0x39')]:_0x4367d8[_0xae5a('0x33')];if(!_0x5a1d61['query'][_0xae5a('0x3b')](_0xae5a('0x3c'))){_0x5e2b30['limit']=qs['limit'](_0x5a1d61['query'][_0xae5a('0x22')]);_0x5e2b30[_0xae5a('0x21')]=qs['offset'](_0x5a1d61[_0xae5a('0x35')]['offset']);}_0x5e2b30[_0xae5a('0x3d')]=qs['sort'](_0x5a1d61[_0xae5a('0x35')][_0xae5a('0x3e')]);_0x5e2b30[_0xae5a('0x3f')]=qs['filters'](_[_0xae5a('0x40')](_0x5a1d61[_0xae5a('0x35')],_0x4367d8[_0xae5a('0x36')]),_0x3ec112);if(_0x5a1d61['query'][_0xae5a('0x41')]){_0x5e2b30[_0xae5a('0x3f')]=_[_0xae5a('0x42')](_0x5e2b30[_0xae5a('0x3f')],{'$or':_[_0xae5a('0x34')](_0x3ec112,function(_0x34a843){if(_0x34a843[_0xae5a('0x43')]!==_0xae5a('0x44')){var _0x299cee={};_0x299cee[_0x34a843['name']]={'$like':'%'+_0x5a1d61[_0xae5a('0x35')][_0xae5a('0x41')]+'%'};return _0x299cee;}})});}_0x5e2b30=_[_0xae5a('0x42')]({},_0x5e2b30,_0x5a1d61[_0xae5a('0x45')]);var _0x18ba3c={'where':_0x5e2b30[_0xae5a('0x3f')]};return db[_0xae5a('0x46')][_0xae5a('0x20')](_0x18ba3c)['then'](function(_0x34c9a5){_0x62d633[_0xae5a('0x20')]=_0x34c9a5;if(_0x5a1d61[_0xae5a('0x35')][_0xae5a('0x47')]){_0x5e2b30[_0xae5a('0x48')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x5e2b30);})['then'](function(_0x585548){_0x62d633[_0xae5a('0x49')]=_0x585548;return _0x62d633;})[_0xae5a('0x28')](respondWithFilteredResult(_0x3cc1d8,_0x5e2b30))[_0xae5a('0x4a')](handleError(_0x3cc1d8,null));};exports[_0xae5a('0x4b')]=function(_0x5cf9d8,_0xf26b01){var _0x140e16={'raw':!![],'where':{'id':_0x5cf9d8['params']['id']}},_0x12fd58={};_0x12fd58[_0xae5a('0x33')]=_[_0xae5a('0x4c')](db[_0xae5a('0x46')][_0xae5a('0x30')]);_0x12fd58['query']=_[_0xae5a('0x4c')](_0x5cf9d8['query']);_0x12fd58[_0xae5a('0x36')]=_[_0xae5a('0x37')](_0x12fd58[_0xae5a('0x33')],_0x12fd58[_0xae5a('0x35')]);_0x140e16[_0xae5a('0x39')]=_[_0xae5a('0x37')](_0x12fd58['model'],qs[_0xae5a('0x38')](_0x5cf9d8[_0xae5a('0x35')][_0xae5a('0x38')]));_0x140e16['attributes']=_0x140e16['attributes'][_0xae5a('0x3a')]?_0x140e16[_0xae5a('0x39')]:_0x12fd58[_0xae5a('0x33')];if(_0x5cf9d8[_0xae5a('0x35')][_0xae5a('0x47')]){_0x140e16['include']=[{'all':!![]}];}_0x140e16=_[_0xae5a('0x42')]({},_0x140e16,_0x5cf9d8[_0xae5a('0x45')]);return db[_0xae5a('0x46')][_0xae5a('0x4d')](_0x140e16)[_0xae5a('0x28')](handleEntityNotFound(_0xf26b01,null))['then'](respondWithResult(_0xf26b01,null))[_0xae5a('0x4a')](handleError(_0xf26b01,null));};exports[_0xae5a('0x4e')]=function(_0x400c21,_0x224a56){return db[_0xae5a('0x46')][_0xae5a('0x4e')](_0x400c21[_0xae5a('0x4f')],{})[_0xae5a('0x28')](function(_0x3a3903){var _0x222412=_0x400c21[_0xae5a('0x50')][_0xae5a('0x51')]({'plain':!![]});if(!_0x222412)throw new Error(_0xae5a('0x52'));if(_0x222412['role']==='user'){var _0x4cbcb5=_0x3a3903[_0xae5a('0x51')]({'plain':!![]});var _0x185d73='Variables';return db[_0xae5a('0x53')][_0xae5a('0x4d')]({'where':{'name':_0x185d73,'userProfileId':_0x222412['userProfileId']},'raw':!![]})['then'](function(_0x532109){if(_0x532109&&_0x532109['autoAssociation']===0x0){return db[_0xae5a('0x54')][_0xae5a('0x4e')]({'name':_0x4cbcb5['name'],'resourceId':_0x4cbcb5['id'],'type':_0x532109['name'],'sectionId':_0x532109['id']},{})[_0xae5a('0x28')](function(){return _0x3a3903;});}else{return _0x3a3903;}})[_0xae5a('0x4a')](function(_0x2d83ae){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d83ae);throw _0x2d83ae;});}return _0x3a3903;})[_0xae5a('0x28')](respondWithResult(_0x224a56,0xc9))[_0xae5a('0x4a')](handleError(_0x224a56,null));};exports[_0xae5a('0x27')]=function(_0x57d0dd,_0xdda43c){if(_0x57d0dd[_0xae5a('0x4f')]['id']){delete _0x57d0dd['body']['id'];}return db[_0xae5a('0x46')][_0xae5a('0x4d')]({'where':{'id':_0x57d0dd[_0xae5a('0x55')]['id']}})[_0xae5a('0x28')](handleEntityNotFound(_0xdda43c,null))[_0xae5a('0x28')](saveUpdates(_0x57d0dd[_0xae5a('0x4f')],null))['then'](respondWithResult(_0xdda43c,null))['catch'](handleError(_0xdda43c,null));};exports['destroy']=function(_0x24d0b0,_0x2d01b8){return db[_0xae5a('0x46')][_0xae5a('0x4d')]({'where':{'id':_0x24d0b0[_0xae5a('0x55')]['id']}})[_0xae5a('0x28')](handleEntityNotFound(_0x2d01b8,null))[_0xae5a('0x28')](removeEntity(_0x2d01b8,null))[_0xae5a('0x4a')](handleError(_0x2d01b8,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 52da3dd..3a086b0 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 _0xc0d6=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','tools_variables'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0xc0d6,0x1ce));var _0x6c0d=function(_0x514f0a,_0x18ba18){_0x514f0a=_0x514f0a-0x0;var _0x51a559=_0xc0d6[_0x514f0a];return _0x51a559;};'use strict';var _=require('lodash');var util=require(_0x6c0d('0x0'));var logger=require('../../config/logger')(_0x6c0d('0x1'));var moment=require(_0x6c0d('0x2'));var BPromise=require(_0x6c0d('0x3'));var rp=require(_0x6c0d('0x4'));var fs=require('fs');var path=require(_0x6c0d('0x5'));var rimraf=require(_0x6c0d('0x6'));var config=require(_0x6c0d('0x7'));var attributes=require(_0x6c0d('0x8'));module[_0x6c0d('0x9')]=function(_0x32cbb6,_0x4caa83){return _0x32cbb6['define']('Variable',attributes,{'tableName':_0x6c0d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdd7=['moment','request-promise','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger'];(function(_0x58df46,_0x292bc2){var _0x1b8adb=function(_0x204d75){while(--_0x204d75){_0x58df46['push'](_0x58df46['shift']());}};_0x1b8adb(++_0x292bc2);}(_0xbdd7,0xed));var _0x7bdd=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbdd7[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7bdd('0x0'));var util=require(_0x7bdd('0x1'));var logger=require(_0x7bdd('0x2'))('api');var moment=require(_0x7bdd('0x3'));var BPromise=require('bluebird');var rp=require(_0x7bdd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7bdd('0x5'));var config=require(_0x7bdd('0x6'));var attributes=require(_0x7bdd('0x7'));module[_0x7bdd('0x8')]=function(_0x4f3324,_0x37587c){return _0x4f3324[_0x7bdd('0x9')](_0x7bdd('0xa'),attributes,{'tableName':_0x7bdd('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 193a2da..0b1d781 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 _0xffd0=['debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','find','options','raw','attributes','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0xc4ad6c,_0x180bfe){var _0x5686d2=function(_0x32d0a2){while(--_0x32d0a2){_0xc4ad6c['push'](_0xc4ad6c['shift']());}};_0x5686d2(++_0x180bfe);}(_0xffd0,0x190));var _0x0ffd=function(_0x1b4ff5,_0x1a882f){_0x1b4ff5=_0x1b4ff5-0x0;var _0x43e94c=_0xffd0[_0x1b4ff5];return _0x43e94c;};'use strict';var _=require(_0x0ffd('0x0'));var util=require(_0x0ffd('0x1'));var moment=require(_0x0ffd('0x2'));var BPromise=require(_0x0ffd('0x3'));var rs=require(_0x0ffd('0x4'));var fs=require('fs');var Redis=require(_0x0ffd('0x5'));var db=require(_0x0ffd('0x6'))['db'];var utils=require(_0x0ffd('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x0ffd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0ffd('0x9')][_0x0ffd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27fba7,_0x4d671f,_0x433ff8){return new BPromise(function(_0x393db1,_0x59f88e){return client[_0x0ffd('0xb')](_0x27fba7,_0x433ff8)[_0x0ffd('0xc')](function(_0x5443ff){logger[_0x0ffd('0xd')](_0x0ffd('0xe'),_0x4d671f,_0x0ffd('0xf'));logger[_0x0ffd('0x10')](_0x0ffd('0x11'),_0x4d671f,_0x0ffd('0xf'),JSON['stringify'](_0x5443ff));if(_0x5443ff[_0x0ffd('0x12')]){if(_0x5443ff['error'][_0x0ffd('0x13')]===0x1f4){logger[_0x0ffd('0x12')](_0x0ffd('0xe'),_0x4d671f,_0x5443ff[_0x0ffd('0x12')][_0x0ffd('0x14')]);return _0x59f88e(_0x5443ff[_0x0ffd('0x12')][_0x0ffd('0x14')]);}logger['error'](_0x0ffd('0xe'),_0x4d671f,_0x5443ff[_0x0ffd('0x12')][_0x0ffd('0x14')]);return _0x393db1(_0x5443ff[_0x0ffd('0x12')]['message']);}else{logger[_0x0ffd('0xd')](_0x0ffd('0xe'),_0x4d671f,_0x0ffd('0xf'));_0x393db1(_0x5443ff[_0x0ffd('0x15')]['message']);}})[_0x0ffd('0x16')](function(_0x11464d){logger[_0x0ffd('0x12')]('Variable,\x20%s,\x20%s',_0x4d671f,_0x11464d);_0x59f88e(_0x11464d);});});}exports[_0x0ffd('0x17')]=function(_0x5d6eb5){var _0x4f80af=this;return new Promise(function(_0x205e7b,_0x4fd51c){return db['Variable'][_0x0ffd('0x18')]({'raw':_0x5d6eb5[_0x0ffd('0x19')]?_0x5d6eb5[_0x0ffd('0x19')][_0x0ffd('0x1a')]===undefined?!![]:![]:!![],'where':_0x5d6eb5['options']?_0x5d6eb5[_0x0ffd('0x19')]['where']||null:null,'attributes':_0x5d6eb5[_0x0ffd('0x19')]?_0x5d6eb5[_0x0ffd('0x19')][_0x0ffd('0x1b')]||null:null,'include':_0x5d6eb5['options']?_0x5d6eb5[_0x0ffd('0x19')][_0x0ffd('0x1c')]?_[_0x0ffd('0x1d')](_0x5d6eb5['options'][_0x0ffd('0x1c')],function(_0x5c339d){return{'model':db[_0x5c339d[_0x0ffd('0x1e')]],'as':_0x5c339d['as'],'attributes':_0x5c339d[_0x0ffd('0x1b')],'include':_0x5c339d[_0x0ffd('0x1c')]?_['map'](_0x5c339d[_0x0ffd('0x1c')],function(_0x327974){return{'model':db[_0x327974[_0x0ffd('0x1e')]],'as':_0x327974['as'],'attributes':_0x327974[_0x0ffd('0x1b')],'include':_0x327974[_0x0ffd('0x1c')]?_[_0x0ffd('0x1d')](_0x327974[_0x0ffd('0x1c')],function(_0x19a973){return{'model':db[_0x19a973[_0x0ffd('0x1e')]],'as':_0x19a973['as'],'attributes':_0x19a973[_0x0ffd('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34756f){logger[_0x0ffd('0xd')]('ShowVariable',_0x5d6eb5);logger[_0x0ffd('0x10')](_0x0ffd('0x17'),_0x5d6eb5,JSON[_0x0ffd('0x1f')](_0x34756f));_0x205e7b(_0x34756f);})[_0x0ffd('0x16')](function(_0x2233cd){logger[_0x0ffd('0x12')]('ShowVariable',_0x2233cd[_0x0ffd('0x14')],_0x5d6eb5);_0x4fd51c(_0x4f80af[_0x0ffd('0x12')](0x1f4,_0x2233cd[_0x0ffd('0x14')]));});});}; \ No newline at end of file +var _0x86b6=['client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowVariable','Variable','find','options','raw','attributes','map','include','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xbc3df2,_0x994bc1){var _0x4cd2e1=function(_0x182cc1){while(--_0x182cc1){_0xbc3df2['push'](_0xbc3df2['shift']());}};_0x4cd2e1(++_0x994bc1);}(_0x86b6,0x10c));var _0x686b=function(_0x34594d,_0x128cb0){_0x34594d=_0x34594d-0x0;var _0x321009=_0x86b6[_0x34594d];return _0x321009;};'use strict';var _=require(_0x686b('0x0'));var util=require(_0x686b('0x1'));var moment=require(_0x686b('0x2'));var BPromise=require(_0x686b('0x3'));var rs=require(_0x686b('0x4'));var fs=require('fs');var Redis=require(_0x686b('0x5'));var db=require(_0x686b('0x6'))['db'];var utils=require(_0x686b('0x7'));var logger=require(_0x686b('0x8'))(_0x686b('0x9'));var config=require(_0x686b('0xa'));var jayson=require(_0x686b('0xb'));var client=jayson[_0x686b('0xc')][_0x686b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5b1c1e,_0x424b72,_0x344aa0){return new BPromise(function(_0x400d7f,_0x1dcd33){return client[_0x686b('0xe')](_0x5b1c1e,_0x344aa0)['then'](function(_0x11828f){logger[_0x686b('0xf')](_0x686b('0x10'),_0x424b72,_0x686b('0x11'));logger[_0x686b('0x12')]('Variable,\x20%s,\x20%s,\x20%s',_0x424b72,_0x686b('0x11'),JSON[_0x686b('0x13')](_0x11828f));if(_0x11828f['error']){if(_0x11828f[_0x686b('0x14')][_0x686b('0x15')]===0x1f4){logger['error'](_0x686b('0x10'),_0x424b72,_0x11828f[_0x686b('0x14')][_0x686b('0x16')]);return _0x1dcd33(_0x11828f[_0x686b('0x14')]['message']);}logger[_0x686b('0x14')](_0x686b('0x10'),_0x424b72,_0x11828f[_0x686b('0x14')][_0x686b('0x16')]);return _0x400d7f(_0x11828f[_0x686b('0x14')][_0x686b('0x16')]);}else{logger['info'](_0x686b('0x10'),_0x424b72,_0x686b('0x11'));_0x400d7f(_0x11828f[_0x686b('0x17')][_0x686b('0x16')]);}})[_0x686b('0x18')](function(_0x2835e0){logger['error'](_0x686b('0x10'),_0x424b72,_0x2835e0);_0x1dcd33(_0x2835e0);});});}exports[_0x686b('0x19')]=function(_0x4224a1){var _0x55b0cc=this;return new Promise(function(_0x4dbb94,_0x4e5e4a){return db[_0x686b('0x1a')][_0x686b('0x1b')]({'raw':_0x4224a1[_0x686b('0x1c')]?_0x4224a1['options'][_0x686b('0x1d')]===undefined?!![]:![]:!![],'where':_0x4224a1[_0x686b('0x1c')]?_0x4224a1[_0x686b('0x1c')]['where']||null:null,'attributes':_0x4224a1[_0x686b('0x1c')]?_0x4224a1[_0x686b('0x1c')][_0x686b('0x1e')]||null:null,'include':_0x4224a1[_0x686b('0x1c')]?_0x4224a1['options']['include']?_[_0x686b('0x1f')](_0x4224a1[_0x686b('0x1c')][_0x686b('0x20')],function(_0x572d14){return{'model':db[_0x572d14['model']],'as':_0x572d14['as'],'attributes':_0x572d14[_0x686b('0x1e')],'include':_0x572d14[_0x686b('0x20')]?_[_0x686b('0x1f')](_0x572d14['include'],function(_0x3b4400){return{'model':db[_0x3b4400['model']],'as':_0x3b4400['as'],'attributes':_0x3b4400[_0x686b('0x1e')],'include':_0x3b4400[_0x686b('0x20')]?_[_0x686b('0x1f')](_0x3b4400[_0x686b('0x20')],function(_0x3cdfc4){return{'model':db[_0x3cdfc4[_0x686b('0x21')]],'as':_0x3cdfc4['as'],'attributes':_0x3cdfc4[_0x686b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x686b('0x22')](function(_0x53c471){logger[_0x686b('0xf')](_0x686b('0x19'),_0x4224a1);logger[_0x686b('0x12')](_0x686b('0x19'),_0x4224a1,JSON['stringify'](_0x53c471));_0x4dbb94(_0x53c471);})[_0x686b('0x18')](function(_0x1cc445){logger[_0x686b('0x14')]('ShowVariable',_0x1cc445['message'],_0x4224a1);_0x4e5e4a(_0x55b0cc[_0x686b('0x14')](0x1f4,_0x1cc445[_0x686b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 0f7056c..bcbdecb 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 _0x36da=['/pull','/restart','restart','/migrations','exports','Router','../../components/auth/service','./version.controller','get','index','isAuthenticated','canUpdate','fetch','/reset','reset'];(function(_0x56d829,_0x1d98bf){var _0x15e98e=function(_0x2995a2){while(--_0x2995a2){_0x56d829['push'](_0x56d829['shift']());}};_0x15e98e(++_0x1d98bf);}(_0x36da,0xd7));var _0xa36d=function(_0x558010,_0x4a71e6){_0x558010=_0x558010-0x0;var _0x3b9dba=_0x36da[_0x558010];return _0x3b9dba;};'use strict';var express=require('express');var router=express[_0xa36d('0x0')]();var auth=require(_0xa36d('0x1'));var controller=require(_0xa36d('0x2'));router[_0xa36d('0x3')]('/',controller[_0xa36d('0x4')]);router[_0xa36d('0x3')]('/fetch',auth[_0xa36d('0x5')](),auth[_0xa36d('0x6')](),controller[_0xa36d('0x7')]);router[_0xa36d('0x3')](_0xa36d('0x8'),auth[_0xa36d('0x5')](),auth[_0xa36d('0x6')](),controller[_0xa36d('0x9')]);router['get'](_0xa36d('0xa'),auth[_0xa36d('0x5')](),auth[_0xa36d('0x6')](),controller['pull']);router[_0xa36d('0x3')](_0xa36d('0xb'),auth[_0xa36d('0x5')](),controller[_0xa36d('0xc')]);router[_0xa36d('0x3')](_0xa36d('0xd'),controller['migrations']);module[_0xa36d('0xe')]=router; \ No newline at end of file +var _0x27e6=['./version.controller','index','get','canUpdate','fetch','isAuthenticated','reset','/pull','pull','/restart','restart','migrations','exports','express','../../components/auth/service'];(function(_0x536b35,_0x18acf3){var _0x548a06=function(_0x3273f4){while(--_0x3273f4){_0x536b35['push'](_0x536b35['shift']());}};_0x548a06(++_0x18acf3);}(_0x27e6,0x1a2));var _0x627e=function(_0x50b772,_0x5d324c){_0x50b772=_0x50b772-0x0;var _0x2be1a6=_0x27e6[_0x50b772];return _0x2be1a6;};'use strict';var express=require(_0x627e('0x0'));var router=express['Router']();var auth=require(_0x627e('0x1'));var controller=require(_0x627e('0x2'));router['get']('/',controller[_0x627e('0x3')]);router[_0x627e('0x4')]('/fetch',auth['isAuthenticated'](),auth[_0x627e('0x5')](),controller[_0x627e('0x6')]);router[_0x627e('0x4')]('/reset',auth[_0x627e('0x7')](),auth[_0x627e('0x5')](),controller[_0x627e('0x8')]);router[_0x627e('0x4')](_0x627e('0x9'),auth[_0x627e('0x7')](),auth[_0x627e('0x5')](),controller[_0x627e('0xa')]);router['get'](_0x627e('0xb'),auth['isAuthenticated'](),controller[_0x627e('0xc')]);router[_0x627e('0x4')]('/migrations',controller[_0x627e('0xd')]);module[_0x627e('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 9a063b0..1b79696 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 _0xd991=['migrations','readdirSync','join','server','length','replace','.js','push','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','exports','query','latest','fetch','status','json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch'];(function(_0x27f0db,_0x54f31b){var _0x4c4fa2=function(_0x4d17e5){while(--_0x4d17e5){_0x27f0db['push'](_0x27f0db['shift']());}};_0x4c4fa2(++_0x54f31b);}(_0xd991,0x115));var _0x1d99=function(_0x2dcde7,_0x3155da){_0x2dcde7=_0x2dcde7-0x0;var _0x5925b8=_0xd991[_0x2dcde7];return _0x5925b8;};'use strict';var Umzug=require(_0x1d99('0x0'));var path=require(_0x1d99('0x1'));var fs=require('fs');var _=require(_0x1d99('0x2'));var pkginfo=require(_0x1d99('0x3'))(module,_0x1d99('0x4'));var compareVersions=require('compare-versions');var exec=require(_0x1d99('0x5'))[_0x1d99('0x6')];var db=require(_0x1d99('0x7'))['db'];var config=require(_0x1d99('0x8'));var pm2=require(_0x1d99('0x9'));var logger=require(_0x1d99('0xa'))('update');var git=require(_0x1d99('0xb'))(config[_0x1d99('0xc')]);exports['index']=function(_0x21d746,_0x2f4502){var _0x6de8e8={'current':module[_0x1d99('0xd')][_0x1d99('0x4')],'phonebar':0x2};if(_0x21d746[_0x1d99('0xe')]&&_0x21d746[_0x1d99('0xe')][_0x1d99('0xf')]){return git[_0x1d99('0x10')]()['tags'](function(_0x3ca61a,_0x38119b){_0x6de8e8['latest']=(_0x3ca61a?module[_0x1d99('0xd')][_0x1d99('0x4')]:_0x38119b[_0x1d99('0xf')])||'2.0.0';return _0x2f4502[_0x1d99('0x11')](0xc8)[_0x1d99('0x12')](_0x6de8e8);});}else{return _0x2f4502[_0x1d99('0x11')](0xc8)[_0x1d99('0x12')](_0x6de8e8);}};exports[_0x1d99('0x10')]=function(_0x1e9bb8,_0x5f57a8){return git[_0x1d99('0x10')](['origin',_0x1d99('0x13')],function(_0x5835e1){if(_0x5835e1){logger[_0x1d99('0x14')](_0x5835e1);return _0x5f57a8[_0x1d99('0x11')](0x1f4)[_0x1d99('0x12')](_0x5835e1);}logger[_0x1d99('0x15')](_0x1d99('0x16'));return _0x5f57a8[_0x1d99('0x11')](0xc8)[_0x1d99('0x12')]({'output':_0x1d99('0x17')});});};exports['reset']=function(_0x430774,_0x4da463){return git[_0x1d99('0x18')]([_0x1d99('0x19'),_0x1d99('0x1a')],function(_0x34cd9b){if(_0x34cd9b){logger[_0x1d99('0x14')](_0x34cd9b);return _0x4da463['status'](0x1f4)['json'](_0x34cd9b);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x4da463[_0x1d99('0x11')](0xc8)[_0x1d99('0x12')]({'output':_0x1d99('0x1b')});});};exports[_0x1d99('0x1c')]=function(_0x1863c0,_0x51003a){exec(_0x1d99('0x1d'),function(_0x2e6c35,_0x4a72ac,_0x25bd22){logger[_0x1d99('0x15')](_0x4a72ac);logger[_0x1d99('0x15')](_0x25bd22);if(_0x2e6c35){logger[_0x1d99('0x14')](_0x2e6c35);return _0x51003a[_0x1d99('0x11')](0x1f4)[_0x1d99('0x12')](_0x2e6c35);}return _0x51003a[_0x1d99('0x11')](0xc8)[_0x1d99('0x12')]({'output':_0x4a72ac});});};exports[_0x1d99('0x1e')]=function(_0x489d3f,_0x18899c){return pm2[_0x1d99('0x1e')](_0x1d99('0x1f'))[_0x1d99('0x20')](function(_0x5c226a){logger[_0x1d99('0x15')]('pm2\x20restart\x20motion\x20%s',_0x5c226a);return _0x18899c[_0x1d99('0x11')](0xc8)[_0x1d99('0x12')]({'output':_0x1d99('0x21')});})[_0x1d99('0x22')](function(_0x53e108){logger[_0x1d99('0x14')](_0x53e108);return _0x18899c[_0x1d99('0x11')](0x1f4)[_0x1d99('0x12')](_0x53e108);});};exports[_0x1d99('0x23')]=function(_0x11bff3,_0x1aaf2b){var _0x5c0c0a=fs[_0x1d99('0x24')](path[_0x1d99('0x25')](config[_0x1d99('0xc')],_0x1d99('0x26'),_0x1d99('0x23')));var _0x4b5c90=[];for(var _0x25ad6f=0x0;_0x25ad6f<_0x5c0c0a[_0x1d99('0x27')];_0x25ad6f++){var _0x14f437=_0x5c0c0a[_0x25ad6f][_0x1d99('0x28')](_0x1d99('0x29'),'');if(compareVersions(module[_0x1d99('0xd')][_0x1d99('0x4')],_0x14f437)===-0x1){_0x4b5c90[_0x1d99('0x2a')](_0x14f437);}}if(_0x4b5c90[_0x1d99('0x27')]){var _0x3e5034=_0x4b5c90['sort'](compareVersions);var _0x24cccb=new Umzug({'storage':_0x1d99('0x2b'),'storageOptions':{'model':db[_0x1d99('0x2c')],'modelName':'Migration','columnName':_0x1d99('0x4')},'migrations':{'params':[db[_0x1d99('0x2b')]['getQueryInterface'](),db[_0x1d99('0x2b')][_0x1d99('0x2d')],function(){throw new Error(_0x1d99('0x2e'));}],'path':path[_0x1d99('0x25')](config[_0x1d99('0xc')],'server',_0x1d99('0x23')),'pattern':/\.js$/}});_0x24cccb['up']({'migrations':_[_0x1d99('0x2f')](_0x3e5034,function(_0x33e4da){return _0x33e4da+_0x1d99('0x29');})})[_0x1d99('0x20')](function(){return _0x1aaf2b[_0x1d99('0x11')](0xc8)[_0x1d99('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x1d99('0x4')]+_0x1d99('0x30')+_[_0x1d99('0x31')](_0x3e5034),'migrations':_[_0x1d99('0x25')](_0x3e5034)});})[_0x1d99('0x22')](function(_0x5b40bb){if(_0x5b40bb instanceof db[_0x1d99('0x2b')][_0x1d99('0x32')]){return _0x1aaf2b[_0x1d99('0x11')](0xc8)[_0x1d99('0x12')]({'output':_0x1d99('0x33')});}else{return _0x1aaf2b[_0x1d99('0x11')](0x1f4)[_0x1d99('0x12')](_0x5b40bb);}});}else{return _0x1aaf2b[_0x1d99('0x11')](0xc8)['json']({'output':_0x1d99('0x33')});}}; \ No newline at end of file +var _0x349f=['version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','exports','query','fetch','tags','latest','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','root','length','replace','.js','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','server','migrations','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash'];(function(_0x41414b,_0x58d03d){var _0x3f9c73=function(_0x16fedb){while(--_0x16fedb){_0x41414b['push'](_0x41414b['shift']());}};_0x3f9c73(++_0x58d03d);}(_0x349f,0xa8));var _0xf349=function(_0x3d4a2b,_0xca71a8){_0x3d4a2b=_0x3d4a2b-0x0;var _0x5c55c6=_0x349f[_0x3d4a2b];return _0x5c55c6;};'use strict';var Umzug=require(_0xf349('0x0'));var path=require(_0xf349('0x1'));var fs=require('fs');var _=require(_0xf349('0x2'));var pkginfo=require('pkginfo')(module,_0xf349('0x3'));var compareVersions=require(_0xf349('0x4'));var exec=require(_0xf349('0x5'))[_0xf349('0x6')];var db=require(_0xf349('0x7'))['db'];var config=require(_0xf349('0x8'));var pm2=require(_0xf349('0x9'));var logger=require(_0xf349('0xa'))(_0xf349('0xb'));var git=require(_0xf349('0xc'))(config['root']);exports[_0xf349('0xd')]=function(_0x23fb4b,_0x6c6cd2){var _0x21a480={'current':module[_0xf349('0xe')][_0xf349('0x3')],'phonebar':0x2};if(_0x23fb4b[_0xf349('0xf')]&&_0x23fb4b['query']['latest']){return git[_0xf349('0x10')]()[_0xf349('0x11')](function(_0x459747,_0x209408){_0x21a480[_0xf349('0x12')]=(_0x459747?module['exports']['version']:_0x209408['latest'])||_0xf349('0x13');return _0x6c6cd2[_0xf349('0x14')](0xc8)[_0xf349('0x15')](_0x21a480);});}else{return _0x6c6cd2[_0xf349('0x14')](0xc8)[_0xf349('0x15')](_0x21a480);}};exports['fetch']=function(_0x39ce84,_0x35d833){return git['fetch']([_0xf349('0x16'),_0xf349('0x17')],function(_0x590f02){if(_0x590f02){logger[_0xf349('0x18')](_0x590f02);return _0x35d833['status'](0x1f4)[_0xf349('0x15')](_0x590f02);}logger[_0xf349('0x19')](_0xf349('0x1a'));return _0x35d833[_0xf349('0x14')](0xc8)[_0xf349('0x15')]({'output':_0xf349('0x1b')});});};exports[_0xf349('0x1c')]=function(_0x47ba62,_0x44aa98){return git['reset']([_0xf349('0x1d'),_0xf349('0x1e')],function(_0x296894){if(_0x296894){logger[_0xf349('0x18')](_0x296894);return _0x44aa98[_0xf349('0x14')](0x1f4)[_0xf349('0x15')](_0x296894);}logger[_0xf349('0x19')](_0xf349('0x1f'));return _0x44aa98['status'](0xc8)[_0xf349('0x15')]({'output':'git\x20reset\x20--hard'});});};exports[_0xf349('0x20')]=function(_0x2b00f4,_0x2dccbc){exec('npm\x20install\x20--production',function(_0x311fc2,_0x1d2a26,_0x236970){logger['info'](_0x1d2a26);logger[_0xf349('0x19')](_0x236970);if(_0x311fc2){logger[_0xf349('0x18')](_0x311fc2);return _0x2dccbc['status'](0x1f4)['json'](_0x311fc2);}return _0x2dccbc['status'](0xc8)[_0xf349('0x15')]({'output':_0x1d2a26});});};exports[_0xf349('0x21')]=function(_0x2dd84a,_0x49e221){return pm2[_0xf349('0x21')](_0xf349('0x22'))[_0xf349('0x23')](function(_0x428396){logger[_0xf349('0x19')](_0xf349('0x24'),_0x428396);return _0x49e221[_0xf349('0x14')](0xc8)[_0xf349('0x15')]({'output':_0xf349('0x25')});})[_0xf349('0x26')](function(_0x403816){logger[_0xf349('0x18')](_0x403816);return _0x49e221[_0xf349('0x14')](0x1f4)[_0xf349('0x15')](_0x403816);});};exports['migrations']=function(_0x58e542,_0x554bc4){var _0x4f2ae2=fs[_0xf349('0x27')](path['join'](config[_0xf349('0x28')],'server','migrations'));var _0x5291ab=[];for(var _0x59a583=0x0;_0x59a583<_0x4f2ae2[_0xf349('0x29')];_0x59a583++){var _0xe3a5f7=_0x4f2ae2[_0x59a583][_0xf349('0x2a')](_0xf349('0x2b'),'');if(compareVersions(module[_0xf349('0xe')]['version'],_0xe3a5f7)===-0x1){_0x5291ab['push'](_0xe3a5f7);}}if(_0x5291ab[_0xf349('0x29')]){var _0x1b9b26=_0x5291ab[_0xf349('0x2c')](compareVersions);var _0x3c104a=new Umzug({'storage':_0xf349('0x2d'),'storageOptions':{'model':db['Migration'],'modelName':_0xf349('0x2e'),'columnName':_0xf349('0x3')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db['sequelize'][_0xf349('0x2f')],function(){throw new Error(_0xf349('0x30'));}],'path':path[_0xf349('0x31')](config['root'],_0xf349('0x32'),_0xf349('0x33')),'pattern':/\.js$/}});_0x3c104a['up']({'migrations':_[_0xf349('0x34')](_0x1b9b26,function(_0xc11a94){return _0xc11a94+_0xf349('0x2b');})})['then'](function(){return _0x554bc4[_0xf349('0x14')](0xc8)['json']({'output':_0xf349('0x35')+module[_0xf349('0xe')][_0xf349('0x3')]+_0xf349('0x36')+_[_0xf349('0x37')](_0x1b9b26),'migrations':_[_0xf349('0x31')](_0x1b9b26)});})[_0xf349('0x26')](function(_0x57dab6){if(_0x57dab6 instanceof db['sequelize']['UniqueConstraintError']){return _0x554bc4[_0xf349('0x14')](0xc8)[_0xf349('0x15')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x554bc4[_0xf349('0x14')](0x1f4)[_0xf349('0x15')](_0x57dab6);}});}else{return _0x554bc4['status'](0xc8)[_0xf349('0x15')]({'output':_0xf349('0x38')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 887c2f9..74ca16d 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 _0x7375=['util','path','connect-timeout','express','Router','../../components/auth/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0x449367,_0x30fd4b){var _0x50ea88=function(_0x14913c){while(--_0x14913c){_0x449367['push'](_0x449367['shift']());}};_0x50ea88(++_0x30fd4b);}(_0x7375,0xfb));var _0x5737=function(_0x44067c,_0x5a2285){_0x44067c=_0x44067c-0x0;var _0x423094=_0x7375[_0x44067c];return _0x423094;};'use strict';var multer=require(_0x5737('0x0'));var util=require(_0x5737('0x1'));var path=require(_0x5737('0x2'));var timeout=require(_0x5737('0x3'));var express=require(_0x5737('0x4'));var router=express[_0x5737('0x5')]();var auth=require(_0x5737('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5737('0x7'));router[_0x5737('0x8')]('/',auth[_0x5737('0x9')](),controller[_0x5737('0xa')]);router['get'](_0x5737('0xb'),auth[_0x5737('0x9')](),controller[_0x5737('0xc')]);router[_0x5737('0x8')](_0x5737('0xd'),auth[_0x5737('0x9')](),controller[_0x5737('0xe')]);router[_0x5737('0xf')]('/',auth['isAuthenticated'](),controller[_0x5737('0x10')]);router[_0x5737('0x11')]('/:id',auth[_0x5737('0x9')](),controller[_0x5737('0x12')]);router[_0x5737('0x13')](_0x5737('0xd'),auth[_0x5737('0x9')](),controller['destroy']);module[_0x5737('0x14')]=router; \ No newline at end of file +var _0xb978=['../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xb978,0x15a));var _0x8b97=function(_0x550ca1,_0x54fec3){_0x550ca1=_0x550ca1-0x0;var _0x524f84=_0xb978[_0x550ca1];return _0x524f84;};'use strict';var multer=require(_0x8b97('0x0'));var util=require(_0x8b97('0x1'));var path=require(_0x8b97('0x2'));var timeout=require(_0x8b97('0x3'));var express=require('express');var router=express[_0x8b97('0x4')]();var auth=require(_0x8b97('0x5'));var interaction=require(_0x8b97('0x6'));var config=require(_0x8b97('0x7'));var controller=require(_0x8b97('0x8'));router['get']('/',auth[_0x8b97('0x9')](),controller[_0x8b97('0xa')]);router[_0x8b97('0xb')](_0x8b97('0xc'),auth[_0x8b97('0x9')](),controller[_0x8b97('0xd')]);router['get'](_0x8b97('0xe'),auth[_0x8b97('0x9')](),controller[_0x8b97('0xf')]);router[_0x8b97('0x10')]('/',auth[_0x8b97('0x9')](),controller[_0x8b97('0x11')]);router[_0x8b97('0x12')](_0x8b97('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x8b97('0x13')](_0x8b97('0xe'),auth[_0x8b97('0x9')](),controller[_0x8b97('0x14')]);module[_0x8b97('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index bfb12db..e39f524 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 _0x7217=['sequelize','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7217,0x19e));var _0x7721=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x7217[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'type':{'type':Sequelize[_0x7721('0x1')]},'uniqueid':{'type':Sequelize[_0x7721('0x1')]},'calleridnum':{'type':Sequelize[_0x7721('0x1')]},'calleridname':{'type':Sequelize[_0x7721('0x1')]},'queue':{'type':Sequelize[_0x7721('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x7721('0x2')]},'agentconnectAt':{'type':Sequelize[_0x7721('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x7721('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x7721('0x2')]},'agentdumpAt':{'type':Sequelize[_0x7721('0x2')]},'holdtime':{'type':Sequelize[_0x7721('0x3')]},'agentcomplete':{'type':Sequelize[_0x7721('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x7721('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x7721('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x7721('0x3')]},'agentacw':{'type':Sequelize[_0x7721('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7721('0x3')]},'reason':{'type':Sequelize[_0x7721('0x1')]},'lastevent':{'type':Sequelize[_0x7721('0x1')]},'channel':{'type':Sequelize[_0x7721('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7721('0x1')]},'connectedlinenum':{'type':Sequelize[_0x7721('0x1')]},'connectedlinename':{'type':Sequelize[_0x7721('0x1')]},'language':{'type':Sequelize[_0x7721('0x1')]},'accountcode':{'type':Sequelize[_0x7721('0x1')]},'context':{'type':Sequelize[_0x7721('0x1')]},'exten':{'type':Sequelize[_0x7721('0x1')]},'priority':{'type':Sequelize[_0x7721('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x7721('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x7721('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x7721('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x7721('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x7721('0x1')]},'destlanguage':{'type':Sequelize[_0x7721('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x7721('0x1')]},'destexten':{'type':Sequelize[_0x7721('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x7721('0x1')]},'transfer':{'type':Sequelize[_0x7721('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7721('0x1')],'comment':_0x7721('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x7721('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x31990e,_0x2bda2c){var _0x43dc7e=function(_0x22c327){while(--_0x22c327){_0x31990e['push'](_0x31990e['shift']());}};_0x43dc7e(++_0x2bda2c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5ebc04,_0x14a363){_0x5ebc04=_0x5ebc04-0x0;var _0x17845c=_0x5fc3[_0x5ebc04];return _0x17845c;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x35fc('0x2')]},'calleridnum':{'type':Sequelize[_0x35fc('0x2')]},'calleridname':{'type':Sequelize[_0x35fc('0x2')]},'queue':{'type':Sequelize[_0x35fc('0x2')]},'interface':{'type':Sequelize[_0x35fc('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x35fc('0x3')]},'agentconnectAt':{'type':Sequelize[_0x35fc('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x35fc('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x35fc('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x35fc('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x35fc('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x35fc('0x4')]},'agentacw':{'type':Sequelize[_0x35fc('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x35fc('0x4')]},'reason':{'type':Sequelize[_0x35fc('0x2')]},'lastevent':{'type':Sequelize[_0x35fc('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x35fc('0x4')]},'channelstatedesc':{'type':Sequelize[_0x35fc('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x35fc('0x2')]},'language':{'type':Sequelize[_0x35fc('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x35fc('0x2')]},'exten':{'type':Sequelize[_0x35fc('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x35fc('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x35fc('0x2')]},'destcalleridname':{'type':Sequelize[_0x35fc('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x35fc('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x35fc('0x2')]},'destlanguage':{'type':Sequelize[_0x35fc('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x35fc('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x35fc('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x35fc('0x2')]},'transfer':{'type':Sequelize[_0x35fc('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x35fc('0x2')],'comment':_0x35fc('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x35fc('0x2')]},'agententerreason':{'type':Sequelize[_0x35fc('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 c73c1c2..614ee05 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 _0x48a8=['../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','error','name','send','VoiceAgentReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','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/license/hardware','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x295143,_0x105ade){var _0x7982e4=function(_0x210cc7){while(--_0x210cc7){_0x295143['push'](_0x295143['shift']());}};_0x7982e4(++_0x105ade);}(_0x48a8,0x112));var _0x848a=function(_0x4fbf45,_0x31e983){_0x4fbf45=_0x4fbf45-0x0;var _0x2a2a39=_0x48a8[_0x4fbf45];return _0x2a2a39;};'use strict';var pdf=require(_0x848a('0x0'));var emlformat=require(_0x848a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x848a('0x2'));var jsonpatch=require(_0x848a('0x3'));var rp=require(_0x848a('0x4'));var moment=require('moment');var BPromise=require(_0x848a('0x5'));var Mustache=require(_0x848a('0x6'));var util=require(_0x848a('0x7'));var path=require(_0x848a('0x8'));var sox=require(_0x848a('0x9'));var csv=require(_0x848a('0xa'));var ejs=require(_0x848a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x848a('0xc'));var crypto=require(_0x848a('0xd'));var jsforce=require(_0x848a('0xe'));var deskjs=require(_0x848a('0xf'));var toCsv=require(_0x848a('0xa'));var querystring=require(_0x848a('0x10'));var Papa=require(_0x848a('0x11'));var Redis=require(_0x848a('0x12'));var authService=require(_0x848a('0x13'));var qs=require(_0x848a('0x14'));var as=require(_0x848a('0x15'));var hardwareService=require(_0x848a('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x848a('0x17'));var config=require(_0x848a('0x18'));var licenseUtil=require(_0x848a('0x19'));var db=require(_0x848a('0x1a'))['db'];function respondWithStatusCode(_0x14b82e,_0x5cbca0){_0x5cbca0=_0x5cbca0||0xcc;return function(_0x169b56){if(_0x169b56){return _0x14b82e[_0x848a('0x1b')](_0x5cbca0);}return _0x14b82e[_0x848a('0x1c')](_0x5cbca0)[_0x848a('0x1d')]();};}function respondWithResult(_0x2280b7,_0x2e24a7){_0x2e24a7=_0x2e24a7||0xc8;return function(_0x4c5246){if(_0x4c5246){return _0x2280b7['status'](_0x2e24a7)['json'](_0x4c5246);}};}function respondWithFilteredResult(_0x404dad,_0x4f09d7){return function(_0x262e63){if(_0x262e63){var _0x4b4279=_0x262e63[_0x848a('0x1e')],_0x5a17dc=_0x4f09d7[_0x848a('0x1f')],_0x102c2b=_0x4f09d7[_0x848a('0x1f')]+_0x4f09d7[_0x848a('0x20')],_0xc2e621;if(_0x102c2b>=_0x4b4279){_0x102c2b=_0x4b4279;_0xc2e621=0xc8;}else{_0xc2e621=0xce;}_0x404dad[_0x848a('0x1c')](_0xc2e621);return _0x404dad[_0x848a('0x21')]('Content-Range',_0x5a17dc+'-'+_0x102c2b+'/'+_0x4b4279)[_0x848a('0x22')](_0x262e63);}return null;};}function patchUpdates(_0x58946e){return function(_0x384cef){try{jsonpatch[_0x848a('0x23')](_0x384cef,_0x58946e,!![]);}catch(_0x4e6810){return BPromise[_0x848a('0x24')](_0x4e6810);}return _0x384cef[_0x848a('0x25')]();};}function saveUpdates(_0x21b79a,_0x3c412f){return function(_0x9bf45c){if(_0x9bf45c){return _0x9bf45c[_0x848a('0x26')](_0x21b79a)[_0x848a('0x27')](function(_0x18f6b7){return _0x18f6b7;});}return null;};}function removeEntity(_0x231d4c,_0x5bf65a){return function(_0xc3d81c){if(_0xc3d81c){return _0xc3d81c[_0x848a('0x28')]()[_0x848a('0x27')](function(){_0x231d4c['status'](0xcc)[_0x848a('0x1d')]();});}};}function handleEntityNotFound(_0x4a48d1,_0x18afe5){return function(_0x3bb768){if(!_0x3bb768){_0x4a48d1[_0x848a('0x1b')](0x194);}return _0x3bb768;};}function handleError(_0x725c0a,_0x2a101b){_0x2a101b=_0x2a101b||0x1f4;return function(_0x2c8b50){logger[_0x848a('0x29')](_0x2c8b50['stack']);if(_0x2c8b50['name']){delete _0x2c8b50[_0x848a('0x2a')];}_0x725c0a[_0x848a('0x1c')](_0x2a101b)[_0x848a('0x2b')](_0x2c8b50);};}exports['index']=function(_0x2bbc9c,_0x557856){var _0x50f693={},_0xef48b={},_0x233ab6={'count':0x0,'rows':[]};var _0xf5082c=_['map'](db[_0x848a('0x2c')][_0x848a('0x2d')],function(_0xc6a29b){return{'name':_0xc6a29b[_0x848a('0x2e')],'type':_0xc6a29b[_0x848a('0x2f')]['key']};});_0xef48b[_0x848a('0x30')]=_['map'](_0xf5082c,'name');_0xef48b[_0x848a('0x31')]=_[_0x848a('0x32')](_0x2bbc9c['query']);_0xef48b[_0x848a('0x33')]=_['intersection'](_0xef48b['model'],_0xef48b['query']);_0x50f693['attributes']=_[_0x848a('0x34')](_0xef48b[_0x848a('0x30')],qs[_0x848a('0x35')](_0x2bbc9c[_0x848a('0x31')][_0x848a('0x35')]));_0x50f693[_0x848a('0x36')]=_0x50f693[_0x848a('0x36')]['length']?_0x50f693[_0x848a('0x36')]:_0xef48b[_0x848a('0x30')];if(!_0x2bbc9c[_0x848a('0x31')][_0x848a('0x37')](_0x848a('0x38'))){_0x50f693[_0x848a('0x20')]=qs[_0x848a('0x20')](_0x2bbc9c[_0x848a('0x31')][_0x848a('0x20')]);_0x50f693[_0x848a('0x1f')]=qs[_0x848a('0x1f')](_0x2bbc9c['query']['offset']);}_0x50f693[_0x848a('0x39')]=qs[_0x848a('0x3a')](_0x2bbc9c[_0x848a('0x31')][_0x848a('0x3a')]);_0x50f693[_0x848a('0x3b')]=qs['filters'](_[_0x848a('0x3c')](_0x2bbc9c[_0x848a('0x31')],_0xef48b[_0x848a('0x33')]),_0xf5082c);if(_0x2bbc9c[_0x848a('0x31')]['filter']){_0x50f693['where']=_[_0x848a('0x3d')](_0x50f693[_0x848a('0x3b')],{'$or':_['map'](_0xf5082c,function(_0x39fd78){if(_0x39fd78[_0x848a('0x2f')]!==_0x848a('0x3e')){var _0x372fc9={};_0x372fc9[_0x39fd78['name']]={'$like':'%'+_0x2bbc9c[_0x848a('0x31')][_0x848a('0x3f')]+'%'};return _0x372fc9;}})});}_0x50f693=_[_0x848a('0x3d')]({},_0x50f693,_0x2bbc9c[_0x848a('0x40')]);var _0x344977={'where':_0x50f693[_0x848a('0x3b')]};return db['VoiceAgentReport'][_0x848a('0x1e')](_0x344977)['then'](function(_0x403889){_0x233ab6[_0x848a('0x1e')]=_0x403889;if(_0x2bbc9c[_0x848a('0x31')][_0x848a('0x41')]){_0x50f693['include']=[{'all':!![]}];}return db['VoiceAgentReport'][_0x848a('0x42')](_0x50f693);})[_0x848a('0x27')](function(_0x280396){_0x233ab6[_0x848a('0x43')]=_0x280396;return _0x233ab6;})[_0x848a('0x27')](respondWithFilteredResult(_0x557856,_0x50f693))[_0x848a('0x44')](handleError(_0x557856,null));};exports[_0x848a('0x45')]=function(_0x1049cd,_0x362151){var _0x2dc83f={'raw':![],'where':{'id':_0x1049cd[_0x848a('0x46')]['id']}},_0x3bc5bf={};_0x3bc5bf[_0x848a('0x30')]=_[_0x848a('0x32')](db['VoiceAgentReport']['rawAttributes']);_0x3bc5bf[_0x848a('0x31')]=_[_0x848a('0x32')](_0x1049cd[_0x848a('0x31')]);_0x3bc5bf[_0x848a('0x33')]=_[_0x848a('0x34')](_0x3bc5bf[_0x848a('0x30')],_0x3bc5bf[_0x848a('0x31')]);_0x2dc83f['attributes']=_[_0x848a('0x34')](_0x3bc5bf[_0x848a('0x30')],qs[_0x848a('0x35')](_0x1049cd[_0x848a('0x31')][_0x848a('0x35')]));_0x2dc83f[_0x848a('0x36')]=_0x2dc83f[_0x848a('0x36')]['length']?_0x2dc83f[_0x848a('0x36')]:_0x3bc5bf[_0x848a('0x30')];if(_0x1049cd[_0x848a('0x31')][_0x848a('0x41')]){_0x2dc83f['include']=[{'all':!![]}];}_0x2dc83f=_[_0x848a('0x3d')]({},_0x2dc83f,_0x1049cd[_0x848a('0x40')]);return db[_0x848a('0x2c')][_0x848a('0x47')](_0x2dc83f)[_0x848a('0x27')](handleEntityNotFound(_0x362151,null))[_0x848a('0x27')](respondWithResult(_0x362151,null))[_0x848a('0x44')](handleError(_0x362151,null));};exports[_0x848a('0x48')]=function(_0x446939,_0x37ad71){return db[_0x848a('0x2c')][_0x848a('0x48')](_0x446939[_0x848a('0x49')],{})[_0x848a('0x27')](respondWithResult(_0x37ad71,0xc9))[_0x848a('0x44')](handleError(_0x37ad71,null));};exports[_0x848a('0x26')]=function(_0x44cfcf,_0x946f80){if(_0x44cfcf[_0x848a('0x49')]['id']){delete _0x44cfcf[_0x848a('0x49')]['id'];}return db[_0x848a('0x2c')][_0x848a('0x47')]({'where':{'id':_0x44cfcf[_0x848a('0x46')]['id']}})[_0x848a('0x27')](handleEntityNotFound(_0x946f80,null))[_0x848a('0x27')](saveUpdates(_0x44cfcf['body'],null))[_0x848a('0x27')](respondWithResult(_0x946f80,null))[_0x848a('0x44')](handleError(_0x946f80,null));};exports['destroy']=function(_0x1280f6,_0x4f9d7a){return db[_0x848a('0x2c')][_0x848a('0x47')]({'where':{'id':_0x1280f6['params']['id']}})[_0x848a('0x27')](handleEntityNotFound(_0x4f9d7a,null))[_0x848a('0x27')](removeEntity(_0x4f9d7a,null))[_0x848a('0x44')](handleError(_0x4f9d7a,null));};exports[_0x848a('0x4a')]=function(_0x557345,_0x42795a){return db['VoiceAgentReport'][_0x848a('0x4a')]()[_0x848a('0x27')](respondWithResult(_0x42795a,null))['catch'](handleError(_0x42795a,null));}; \ No newline at end of file +var _0x0a58=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','destroy','stack','name','map','VoiceAgentReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x0a58,0x1db));var _0x80a5=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0a58[_0x4b369d];return _0x571a98;};'use strict';var pdf=require(_0x80a5('0x0'));var emlformat=require(_0x80a5('0x1'));var rimraf=require(_0x80a5('0x2'));var zipdir=require(_0x80a5('0x3'));var jsonpatch=require(_0x80a5('0x4'));var rp=require(_0x80a5('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x80a5('0x6'));var path=require(_0x80a5('0x7'));var sox=require('sox');var csv=require(_0x80a5('0x8'));var ejs=require(_0x80a5('0x9'));var fs=require('fs');var _=require(_0x80a5('0xa'));var squel=require('squel');var crypto=require(_0x80a5('0xb'));var jsforce=require(_0x80a5('0xc'));var deskjs=require(_0x80a5('0xd'));var toCsv=require(_0x80a5('0x8'));var querystring=require(_0x80a5('0xe'));var Papa=require('papaparse');var Redis=require(_0x80a5('0xf'));var authService=require(_0x80a5('0x10'));var qs=require(_0x80a5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x80a5('0x12'))(_0x80a5('0x13'));var utils=require(_0x80a5('0x14'));var config=require(_0x80a5('0x15'));var licenseUtil=require(_0x80a5('0x16'));var db=require(_0x80a5('0x17'))['db'];function respondWithStatusCode(_0x4517b6,_0x592f14){_0x592f14=_0x592f14||0xcc;return function(_0x137d1d){if(_0x137d1d){return _0x4517b6[_0x80a5('0x18')](_0x592f14);}return _0x4517b6[_0x80a5('0x19')](_0x592f14)[_0x80a5('0x1a')]();};}function respondWithResult(_0x185b53,_0x39a714){_0x39a714=_0x39a714||0xc8;return function(_0x49cd66){if(_0x49cd66){return _0x185b53['status'](_0x39a714)[_0x80a5('0x1b')](_0x49cd66);}};}function respondWithFilteredResult(_0x869660,_0x4feb3d){return function(_0x9a0065){if(_0x9a0065){var _0x2fd77c=_0x9a0065[_0x80a5('0x1c')],_0x492c5c=_0x4feb3d[_0x80a5('0x1d')],_0x531c6b=_0x4feb3d[_0x80a5('0x1d')]+_0x4feb3d[_0x80a5('0x1e')],_0x521e22;if(_0x531c6b>=_0x2fd77c){_0x531c6b=_0x2fd77c;_0x521e22=0xc8;}else{_0x521e22=0xce;}_0x869660[_0x80a5('0x19')](_0x521e22);return _0x869660[_0x80a5('0x1f')]('Content-Range',_0x492c5c+'-'+_0x531c6b+'/'+_0x2fd77c)[_0x80a5('0x1b')](_0x9a0065);}return null;};}function patchUpdates(_0x249939){return function(_0x3e278b){try{jsonpatch[_0x80a5('0x20')](_0x3e278b,_0x249939,!![]);}catch(_0xdaa9){return BPromise[_0x80a5('0x21')](_0xdaa9);}return _0x3e278b['save']();};}function saveUpdates(_0x1005d8,_0x181bf5){return function(_0x24f8b4){if(_0x24f8b4){return _0x24f8b4[_0x80a5('0x22')](_0x1005d8)['then'](function(_0xb01427){return _0xb01427;});}return null;};}function removeEntity(_0x253e05,_0x3638f2){return function(_0x28036e){if(_0x28036e){return _0x28036e[_0x80a5('0x23')]()['then'](function(){_0x253e05[_0x80a5('0x19')](0xcc)[_0x80a5('0x1a')]();});}};}function handleEntityNotFound(_0x34da3b,_0x227d32){return function(_0x52e0c4){if(!_0x52e0c4){_0x34da3b[_0x80a5('0x18')](0x194);}return _0x52e0c4;};}function handleError(_0x58db63,_0x6743be){_0x6743be=_0x6743be||0x1f4;return function(_0x51a8f2){logger['error'](_0x51a8f2[_0x80a5('0x24')]);if(_0x51a8f2['name']){delete _0x51a8f2[_0x80a5('0x25')];}_0x58db63['status'](_0x6743be)['send'](_0x51a8f2);};}exports['index']=function(_0x1043f3,_0x385037){var _0x331212={},_0x44532d={},_0x1f814e={'count':0x0,'rows':[]};var _0x317231=_[_0x80a5('0x26')](db[_0x80a5('0x27')][_0x80a5('0x28')],function(_0x5477d3){return{'name':_0x5477d3[_0x80a5('0x29')],'type':_0x5477d3[_0x80a5('0x2a')][_0x80a5('0x2b')]};});_0x44532d[_0x80a5('0x2c')]=_['map'](_0x317231,'name');_0x44532d[_0x80a5('0x2d')]=_[_0x80a5('0x2e')](_0x1043f3['query']);_0x44532d[_0x80a5('0x2f')]=_[_0x80a5('0x30')](_0x44532d[_0x80a5('0x2c')],_0x44532d['query']);_0x331212[_0x80a5('0x31')]=_[_0x80a5('0x30')](_0x44532d[_0x80a5('0x2c')],qs[_0x80a5('0x32')](_0x1043f3['query']['fields']));_0x331212[_0x80a5('0x31')]=_0x331212[_0x80a5('0x31')]['length']?_0x331212[_0x80a5('0x31')]:_0x44532d['model'];if(!_0x1043f3[_0x80a5('0x2d')]['hasOwnProperty']('nolimit')){_0x331212[_0x80a5('0x1e')]=qs[_0x80a5('0x1e')](_0x1043f3[_0x80a5('0x2d')]['limit']);_0x331212[_0x80a5('0x1d')]=qs[_0x80a5('0x1d')](_0x1043f3[_0x80a5('0x2d')][_0x80a5('0x1d')]);}_0x331212[_0x80a5('0x33')]=qs['sort'](_0x1043f3[_0x80a5('0x2d')][_0x80a5('0x34')]);_0x331212[_0x80a5('0x35')]=qs[_0x80a5('0x2f')](_[_0x80a5('0x36')](_0x1043f3[_0x80a5('0x2d')],_0x44532d[_0x80a5('0x2f')]),_0x317231);if(_0x1043f3[_0x80a5('0x2d')][_0x80a5('0x37')]){_0x331212[_0x80a5('0x35')]=_['merge'](_0x331212[_0x80a5('0x35')],{'$or':_[_0x80a5('0x26')](_0x317231,function(_0x17cbe8){if(_0x17cbe8[_0x80a5('0x2a')]!==_0x80a5('0x38')){var _0x4d75de={};_0x4d75de[_0x17cbe8[_0x80a5('0x25')]]={'$like':'%'+_0x1043f3[_0x80a5('0x2d')][_0x80a5('0x37')]+'%'};return _0x4d75de;}})});}_0x331212=_[_0x80a5('0x39')]({},_0x331212,_0x1043f3[_0x80a5('0x3a')]);var _0x4e987c={'where':_0x331212[_0x80a5('0x35')]};return db[_0x80a5('0x27')]['count'](_0x4e987c)[_0x80a5('0x3b')](function(_0x57a88b){_0x1f814e[_0x80a5('0x1c')]=_0x57a88b;if(_0x1043f3[_0x80a5('0x2d')][_0x80a5('0x3c')]){_0x331212[_0x80a5('0x3d')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x80a5('0x3e')](_0x331212);})[_0x80a5('0x3b')](function(_0x3607df){_0x1f814e[_0x80a5('0x3f')]=_0x3607df;return _0x1f814e;})[_0x80a5('0x3b')](respondWithFilteredResult(_0x385037,_0x331212))[_0x80a5('0x40')](handleError(_0x385037,null));};exports[_0x80a5('0x41')]=function(_0x5b0491,_0x3ec415){var _0x5a3ab9={'raw':![],'where':{'id':_0x5b0491[_0x80a5('0x42')]['id']}},_0x2952ce={};_0x2952ce[_0x80a5('0x2c')]=_[_0x80a5('0x2e')](db[_0x80a5('0x27')][_0x80a5('0x28')]);_0x2952ce[_0x80a5('0x2d')]=_[_0x80a5('0x2e')](_0x5b0491['query']);_0x2952ce[_0x80a5('0x2f')]=_['intersection'](_0x2952ce[_0x80a5('0x2c')],_0x2952ce['query']);_0x5a3ab9[_0x80a5('0x31')]=_['intersection'](_0x2952ce['model'],qs[_0x80a5('0x32')](_0x5b0491['query'][_0x80a5('0x32')]));_0x5a3ab9[_0x80a5('0x31')]=_0x5a3ab9[_0x80a5('0x31')]['length']?_0x5a3ab9[_0x80a5('0x31')]:_0x2952ce[_0x80a5('0x2c')];if(_0x5b0491[_0x80a5('0x2d')][_0x80a5('0x3c')]){_0x5a3ab9[_0x80a5('0x3d')]=[{'all':!![]}];}_0x5a3ab9=_['merge']({},_0x5a3ab9,_0x5b0491[_0x80a5('0x3a')]);return db['VoiceAgentReport'][_0x80a5('0x43')](_0x5a3ab9)[_0x80a5('0x3b')](handleEntityNotFound(_0x3ec415,null))[_0x80a5('0x3b')](respondWithResult(_0x3ec415,null))[_0x80a5('0x40')](handleError(_0x3ec415,null));};exports['create']=function(_0x2e553e,_0x30458e){return db[_0x80a5('0x27')][_0x80a5('0x44')](_0x2e553e[_0x80a5('0x45')],{})[_0x80a5('0x3b')](respondWithResult(_0x30458e,0xc9))[_0x80a5('0x40')](handleError(_0x30458e,null));};exports[_0x80a5('0x22')]=function(_0x4a90a6,_0x5bf68c){if(_0x4a90a6[_0x80a5('0x45')]['id']){delete _0x4a90a6['body']['id'];}return db[_0x80a5('0x27')][_0x80a5('0x43')]({'where':{'id':_0x4a90a6[_0x80a5('0x42')]['id']}})['then'](handleEntityNotFound(_0x5bf68c,null))[_0x80a5('0x3b')](saveUpdates(_0x4a90a6[_0x80a5('0x45')],null))['then'](respondWithResult(_0x5bf68c,null))[_0x80a5('0x40')](handleError(_0x5bf68c,null));};exports[_0x80a5('0x23')]=function(_0x209043,_0x59e0bb){return db[_0x80a5('0x27')][_0x80a5('0x43')]({'where':{'id':_0x209043[_0x80a5('0x42')]['id']}})[_0x80a5('0x3b')](handleEntityNotFound(_0x59e0bb,null))['then'](removeEntity(_0x59e0bb,null))[_0x80a5('0x40')](handleError(_0x59e0bb,null));};exports['describe']=function(_0xeaac82,_0x4b778c){return db[_0x80a5('0x27')][_0x80a5('0x46')]()[_0x80a5('0x3b')](respondWithResult(_0x4b778c,null))[_0x80a5('0x40')](handleError(_0x4b778c,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 134f0ac..6eb9a6b 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 _0xb6d4=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid'];(function(_0xf3ad6d,_0x287f71){var _0x4721e1=function(_0x234f56){while(--_0x234f56){_0xf3ad6d['push'](_0xf3ad6d['shift']());}};_0x4721e1(++_0x287f71);}(_0xb6d4,0x16c));var _0x4b6d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb6d4[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x4b6d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4b6d('0x1'));var moment=require(_0x4b6d('0x2'));var BPromise=require(_0x4b6d('0x3'));var rp=require(_0x4b6d('0x4'));var fs=require('fs');var path=require(_0x4b6d('0x5'));var rimraf=require('rimraf');var config=require(_0x4b6d('0x6'));var attributes=require(_0x4b6d('0x7'));module[_0x4b6d('0x8')]=function(_0x1e3a59,_0x3acf7e){return _0x1e3a59[_0x4b6d('0x9')](_0x4b6d('0xa'),attributes,{'tableName':_0x4b6d('0xb'),'paranoid':![],'indexes':[{'fields':[_0x4b6d('0xc'),_0x4b6d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xead1=['destuniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','VoiceAgentReport','report_agent','uniqueid'];(function(_0x27b630,_0x2b7245){var _0x2d1a3d=function(_0xc56d60){while(--_0xc56d60){_0x27b630['push'](_0x27b630['shift']());}};_0x2d1a3d(++_0x2b7245);}(_0xead1,0x76));var _0x1ead=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xead1[_0x125ff8];return _0x2d9ef;};'use strict';var _=require('lodash');var util=require(_0x1ead('0x0'));var logger=require(_0x1ead('0x1'))(_0x1ead('0x2'));var moment=require(_0x1ead('0x3'));var BPromise=require(_0x1ead('0x4'));var rp=require(_0x1ead('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ead('0x6'));var config=require(_0x1ead('0x7'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x1a5124,_0x21170d){return _0x1a5124[_0x1ead('0x8')](_0x1ead('0x9'),attributes,{'tableName':_0x1ead('0xa'),'paranoid':![],'indexes':[{'fields':[_0x1ead('0xb'),_0x1ead('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index d611ae1..738be1e 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 _0xf5ea=['CreateVoiceAgentReport','create','body','options','raw','debug','stringify','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x3c6c96,_0x416166){var _0x268361=function(_0x252827){while(--_0x252827){_0x3c6c96['push'](_0x3c6c96['shift']());}};_0x268361(++_0x416166);}(_0xf5ea,0x156));var _0xaf5e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf5ea[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xaf5e('0x0'));var util=require(_0xaf5e('0x1'));var moment=require(_0xaf5e('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf5e('0x3'));var fs=require('fs');var Redis=require(_0xaf5e('0x4'));var db=require(_0xaf5e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaf5e('0x6'));var config=require(_0xaf5e('0x7'));var jayson=require(_0xaf5e('0x8'));var client=jayson[_0xaf5e('0x9')][_0xaf5e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f4c75,_0x104683,_0x2d3a93){return new BPromise(function(_0x10fdd8,_0x5a655d){return client['request'](_0x3f4c75,_0x2d3a93)[_0xaf5e('0xb')](function(_0x1ef1d1){logger[_0xaf5e('0xc')](_0xaf5e('0xd'),_0x104683,_0xaf5e('0xe'));logger['debug'](_0xaf5e('0xf'),_0x104683,_0xaf5e('0xe'),JSON['stringify'](_0x1ef1d1));if(_0x1ef1d1[_0xaf5e('0x10')]){if(_0x1ef1d1['error'][_0xaf5e('0x11')]===0x1f4){logger['error'](_0xaf5e('0xd'),_0x104683,_0x1ef1d1[_0xaf5e('0x10')][_0xaf5e('0x12')]);return _0x5a655d(_0x1ef1d1[_0xaf5e('0x10')][_0xaf5e('0x12')]);}logger[_0xaf5e('0x10')](_0xaf5e('0xd'),_0x104683,_0x1ef1d1[_0xaf5e('0x10')][_0xaf5e('0x12')]);return _0x10fdd8(_0x1ef1d1[_0xaf5e('0x10')][_0xaf5e('0x12')]);}else{logger[_0xaf5e('0xc')](_0xaf5e('0xd'),_0x104683,'request\x20sent');_0x10fdd8(_0x1ef1d1[_0xaf5e('0x13')][_0xaf5e('0x12')]);}})[_0xaf5e('0x14')](function(_0x54ad1f){logger[_0xaf5e('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x104683,_0x54ad1f);_0x5a655d(_0x54ad1f);});});}exports[_0xaf5e('0x15')]=function(_0x51295b){var _0x2835b6=this;return new Promise(function(_0x4e08c9,_0x5e108b){return db['VoiceAgentReport'][_0xaf5e('0x16')](_0x51295b[_0xaf5e('0x17')],{'raw':_0x51295b[_0xaf5e('0x18')]?_0x51295b[_0xaf5e('0x18')][_0xaf5e('0x19')]===undefined?!![]:![]:!![]})[_0xaf5e('0xb')](function(_0x4c4a39){logger['info'](_0xaf5e('0x15'),_0x51295b);logger[_0xaf5e('0x1a')](_0xaf5e('0x15'),_0x51295b,JSON[_0xaf5e('0x1b')](_0x4c4a39));_0x4e08c9(_0x4c4a39);})[_0xaf5e('0x14')](function(_0x37b539){logger[_0xaf5e('0x10')](_0xaf5e('0x15'),_0x37b539[_0xaf5e('0x12')],_0x51295b);_0x5e108b(_0x2835b6[_0xaf5e('0x10')](0x1f4,_0x37b539['message']));});});};exports[_0xaf5e('0x1c')]=function(_0x24b689){var _0x302544=this;return new Promise(function(_0x16d4d6,_0xe450f6){return db['VoiceAgentReport'][_0xaf5e('0x1d')](_0x24b689['body'],{'raw':_0x24b689[_0xaf5e('0x18')]?_0x24b689[_0xaf5e('0x18')][_0xaf5e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24b689[_0xaf5e('0x18')]?_0x24b689[_0xaf5e('0x18')][_0xaf5e('0x1e')]||null:null,'attributes':_0x24b689['options']?_0x24b689['options'][_0xaf5e('0x1f')]||null:null,'limit':_0x24b689[_0xaf5e('0x18')]?_0x24b689[_0xaf5e('0x18')][_0xaf5e('0x20')]||null:null})['then'](function(_0x57fec7){logger[_0xaf5e('0xc')](_0xaf5e('0x1c'),_0x24b689);logger['debug'](_0xaf5e('0x1c'),_0x24b689,JSON['stringify'](_0x57fec7));_0x16d4d6(_0x57fec7);})[_0xaf5e('0x14')](function(_0x37edec){logger['error'](_0xaf5e('0x1c'),_0x37edec[_0xaf5e('0x12')],_0x24b689);_0xe450f6(_0x302544[_0xaf5e('0x10')](0x1f4,_0x37edec[_0xaf5e('0x12')]));});});}; \ No newline at end of file +var _0xfe8e=['request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceAgentReport','create','body','options','debug','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','raw','where','attributes','limit','then','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfe8e,0x1bb));var _0xefe8=function(_0x1b2255,_0x3de34f){_0x1b2255=_0x1b2255-0x0;var _0x33e57d=_0xfe8e[_0x1b2255];return _0x33e57d;};'use strict';var _=require(_0xefe8('0x0'));var util=require(_0xefe8('0x1'));var moment=require(_0xefe8('0x2'));var BPromise=require('bluebird');var rs=require(_0xefe8('0x3'));var fs=require('fs');var Redis=require(_0xefe8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xefe8('0x5'));var logger=require(_0xefe8('0x6'))(_0xefe8('0x7'));var config=require(_0xefe8('0x8'));var jayson=require(_0xefe8('0x9'));var client=jayson[_0xefe8('0xa')][_0xefe8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b13ce,_0x2d062f,_0x8354d){return new BPromise(function(_0x49b8f1,_0x2e9d55){return client[_0xefe8('0xc')](_0x1b13ce,_0x8354d)['then'](function(_0x292a97){logger[_0xefe8('0xd')](_0xefe8('0xe'),_0x2d062f,_0xefe8('0xf'));logger['debug'](_0xefe8('0x10'),_0x2d062f,'request\x20sent',JSON[_0xefe8('0x11')](_0x292a97));if(_0x292a97[_0xefe8('0x12')]){if(_0x292a97['error'][_0xefe8('0x13')]===0x1f4){logger[_0xefe8('0x12')](_0xefe8('0xe'),_0x2d062f,_0x292a97[_0xefe8('0x12')][_0xefe8('0x14')]);return _0x2e9d55(_0x292a97[_0xefe8('0x12')][_0xefe8('0x14')]);}logger[_0xefe8('0x12')](_0xefe8('0xe'),_0x2d062f,_0x292a97[_0xefe8('0x12')]['message']);return _0x49b8f1(_0x292a97['error']['message']);}else{logger['info'](_0xefe8('0xe'),_0x2d062f,_0xefe8('0xf'));_0x49b8f1(_0x292a97['result'][_0xefe8('0x14')]);}})[_0xefe8('0x15')](function(_0x1fe0f8){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x2d062f,_0x1fe0f8);_0x2e9d55(_0x1fe0f8);});});}exports['CreateVoiceAgentReport']=function(_0x2df253){var _0x568e78=this;return new Promise(function(_0x810ec6,_0x3c3ae4){return db[_0xefe8('0x16')][_0xefe8('0x17')](_0x2df253[_0xefe8('0x18')],{'raw':_0x2df253[_0xefe8('0x19')]?_0x2df253[_0xefe8('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4aed4b){logger['info']('CreateVoiceAgentReport',_0x2df253);logger[_0xefe8('0x1a')](_0xefe8('0x1b'),_0x2df253,JSON['stringify'](_0x4aed4b));_0x810ec6(_0x4aed4b);})[_0xefe8('0x15')](function(_0x269e81){logger[_0xefe8('0x12')]('CreateVoiceAgentReport',_0x269e81[_0xefe8('0x14')],_0x2df253);_0x3c3ae4(_0x568e78[_0xefe8('0x12')](0x1f4,_0x269e81[_0xefe8('0x14')]));});});};exports[_0xefe8('0x1c')]=function(_0x240d78){var _0x34d255=this;return new Promise(function(_0x4e66db,_0x51fe53){return db[_0xefe8('0x16')][_0xefe8('0x1d')](_0x240d78['body'],{'raw':_0x240d78[_0xefe8('0x19')]?_0x240d78[_0xefe8('0x19')][_0xefe8('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x240d78[_0xefe8('0x19')]?_0x240d78[_0xefe8('0x19')][_0xefe8('0x1f')]||null:null,'attributes':_0x240d78[_0xefe8('0x19')]?_0x240d78[_0xefe8('0x19')][_0xefe8('0x20')]||null:null,'limit':_0x240d78['options']?_0x240d78[_0xefe8('0x19')][_0xefe8('0x21')]||null:null})[_0xefe8('0x22')](function(_0x2209d9){logger[_0xefe8('0xd')](_0xefe8('0x1c'),_0x240d78);logger['debug'](_0xefe8('0x1c'),_0x240d78,JSON['stringify'](_0x2209d9));_0x4e66db(_0x2209d9);})[_0xefe8('0x15')](function(_0x5b4bc2){logger[_0xefe8('0x12')](_0xefe8('0x1c'),_0x5b4bc2[_0xefe8('0x14')],_0x240d78);_0x51fe53(_0x34d255[_0xefe8('0x12')](0x1f4,_0x5b4bc2[_0xefe8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 388863c..6ec6f87 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 _0x9bc1=['isAuthenticated','describe','/:id','post','put','update','delete','exports','util','path','connect-timeout','express','Router','../../config/environment','./voiceCallReport.controller','index','get','/describe'];(function(_0x1b01f5,_0x3dcd0c){var _0x5e8220=function(_0x32c8a9){while(--_0x32c8a9){_0x1b01f5['push'](_0x1b01f5['shift']());}};_0x5e8220(++_0x3dcd0c);}(_0x9bc1,0x74));var _0x19bc=function(_0x528575,_0x2e067d){_0x528575=_0x528575-0x0;var _0x3063b7=_0x9bc1[_0x528575];return _0x3063b7;};'use strict';var multer=require('multer');var util=require(_0x19bc('0x0'));var path=require(_0x19bc('0x1'));var timeout=require(_0x19bc('0x2'));var express=require(_0x19bc('0x3'));var router=express[_0x19bc('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x19bc('0x5'));var controller=require(_0x19bc('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x19bc('0x7')]);router[_0x19bc('0x8')](_0x19bc('0x9'),auth[_0x19bc('0xa')](),controller[_0x19bc('0xb')]);router['get'](_0x19bc('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x19bc('0xd')]('/',auth[_0x19bc('0xa')](),controller['create']);router[_0x19bc('0xe')](_0x19bc('0xc'),auth[_0x19bc('0xa')](),controller[_0x19bc('0xf')]);router[_0x19bc('0x10')](_0x19bc('0xc'),auth[_0x19bc('0xa')](),controller['destroy']);module[_0x19bc('0x11')]=router; \ No newline at end of file +var _0x96ef=['./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x96ef,0x19d));var _0xf96e=function(_0x9a7cdd,_0x412e79){_0x9a7cdd=_0x9a7cdd-0x0;var _0x4394dd=_0x96ef[_0x9a7cdd];return _0x4394dd;};'use strict';var multer=require(_0xf96e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf96e('0x1'));var express=require(_0xf96e('0x2'));var router=express[_0xf96e('0x3')]();var auth=require(_0xf96e('0x4'));var interaction=require(_0xf96e('0x5'));var config=require(_0xf96e('0x6'));var controller=require(_0xf96e('0x7'));router[_0xf96e('0x8')]('/',auth[_0xf96e('0x9')](),controller[_0xf96e('0xa')]);router[_0xf96e('0x8')](_0xf96e('0xb'),auth[_0xf96e('0x9')](),controller[_0xf96e('0xc')]);router[_0xf96e('0x8')](_0xf96e('0xd'),auth['isAuthenticated'](),controller[_0xf96e('0xe')]);router[_0xf96e('0xf')]('/',auth[_0xf96e('0x9')](),controller[_0xf96e('0x10')]);router[_0xf96e('0x11')](_0xf96e('0xd'),auth[_0xf96e('0x9')](),controller[_0xf96e('0x12')]);router[_0xf96e('0x13')](_0xf96e('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xf96e('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index e8afaf4..eaeebfd 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 _0xe14b=['STRING','DATE','INTEGER','sequelize','exports','inbound','internal','inbound-fax'];(function(_0x34a8c8,_0x31e259){var _0x1fe6e5=function(_0x30f28d){while(--_0x30f28d){_0x34a8c8['push'](_0x34a8c8['shift']());}};_0x1fe6e5(++_0x31e259);}(_0xe14b,0x93));var _0xbe14=function(_0x5563e3,_0x28738d){_0x5563e3=_0x5563e3-0x0;var _0x1ed682=_0xe14b[_0x5563e3];return _0x1ed682;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xbe14('0x2'),_0xbe14('0x3'),'outbound',_0xbe14('0x4'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0xbe14('0x5')]},'accountcode':{'type':Sequelize[_0xbe14('0x5')]},'source':{'type':Sequelize[_0xbe14('0x5')]},'destination':{'type':Sequelize[_0xbe14('0x5')]},'destinationcontext':{'type':Sequelize[_0xbe14('0x5')]},'callerid':{'type':Sequelize[_0xbe14('0x5')]},'channel':{'type':Sequelize[_0xbe14('0x5')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xbe14('0x6')]},'systemanswertime':{'type':Sequelize[_0xbe14('0x6')]},'answertime':{'type':Sequelize[_0xbe14('0x6')]},'endtime':{'type':Sequelize[_0xbe14('0x6')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xbe14('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xbe14('0x5')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xbe14('0x5')]},'userDisposition':{'type':Sequelize[_0xbe14('0x5')]},'userSecondDisposition':{'type':Sequelize[_0xbe14('0x5')]},'userThirdDisposition':{'type':Sequelize[_0xbe14('0x5')]},'note':{'type':Sequelize[_0xbe14('0x5')]},'prefix':{'type':Sequelize[_0xbe14('0x5')]},'routeid':{'type':Sequelize[_0xbe14('0x7')]},'sipcallid':{'type':Sequelize[_0xbe14('0x5')]}}; \ No newline at end of file +var _0x46ed=['inbound','internal','inbound-fax','outbound-fax','STRING','TEXT','DATE','INTEGER','sequelize','exports','ENUM'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x46ed,0x168));var _0xd46e=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x46ed[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd46e('0x2')](_0xd46e('0x3'),_0xd46e('0x4'),'outbound',_0xd46e('0x5'),_0xd46e('0x6'),'dialer')},'tag':{'type':Sequelize[_0xd46e('0x7')]},'accountcode':{'type':Sequelize[_0xd46e('0x7')]},'source':{'type':Sequelize[_0xd46e('0x7')]},'destination':{'type':Sequelize[_0xd46e('0x7')]},'destinationcontext':{'type':Sequelize[_0xd46e('0x7')]},'callerid':{'type':Sequelize[_0xd46e('0x7')]},'channel':{'type':Sequelize[_0xd46e('0x7')]},'destinationchannel':{'type':Sequelize[_0xd46e('0x7')]},'lastapplication':{'type':Sequelize[_0xd46e('0x7')]},'lastdata':{'type':Sequelize[_0xd46e('0x8')]},'starttime':{'type':Sequelize[_0xd46e('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xd46e('0x9')]},'endtime':{'type':Sequelize[_0xd46e('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xd46e('0xa')]},'mohtime':{'type':Sequelize[_0xd46e('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd46e('0x7')]},'amaflags':{'type':Sequelize[_0xd46e('0x7')]},'userfield':{'type':Sequelize[_0xd46e('0x7')]},'userDisposition':{'type':Sequelize[_0xd46e('0x7')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xd46e('0x7')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xd46e('0xa')]},'sipcallid':{'type':Sequelize[_0xd46e('0x7')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index b5ea468..8eb81f5 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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_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'];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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 8a2490f..49dd6a8 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 _0x2ed5=['path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xd8aad0,_0x4da2cd){var _0x570860=function(_0x1acc03){while(--_0x1acc03){_0xd8aad0['push'](_0xd8aad0['shift']());}};_0x570860(++_0x4da2cd);}(_0x2ed5,0x189));var _0x52ed=function(_0x3c5cdf,_0x3fff40){_0x3c5cdf=_0x3c5cdf-0x0;var _0x341557=_0x2ed5[_0x3c5cdf];return _0x341557;};'use strict';var _=require(_0x52ed('0x0'));var util=require(_0x52ed('0x1'));var logger=require(_0x52ed('0x2'))(_0x52ed('0x3'));var moment=require(_0x52ed('0x4'));var BPromise=require(_0x52ed('0x5'));var rp=require(_0x52ed('0x6'));var fs=require('fs');var path=require(_0x52ed('0x7'));var rimraf=require(_0x52ed('0x8'));var config=require(_0x52ed('0x9'));var attributes=require(_0x52ed('0xa'));module[_0x52ed('0xb')]=function(_0x51ed3a,_0xc6c2f2){return _0x51ed3a[_0x52ed('0xc')](_0x52ed('0xd'),attributes,{'tableName':_0x52ed('0xe'),'paranoid':![],'indexes':[{'fields':[_0x52ed('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2867=['bluebird','request-promise','rimraf','../../config/environment','exports','define','report_call','uniqueid','lodash','util'];(function(_0x48763c,_0x2f3723){var _0x97c410=function(_0x325aa1){while(--_0x325aa1){_0x48763c['push'](_0x48763c['shift']());}};_0x97c410(++_0x2f3723);}(_0x2867,0x116));var _0x7286=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0x2867[_0x365be9];return _0x185c12;};'use strict';var _=require(_0x7286('0x0'));var util=require(_0x7286('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7286('0x2'));var rp=require(_0x7286('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7286('0x4'));var config=require(_0x7286('0x5'));var attributes=require('./voiceCallReport.attributes');module[_0x7286('0x6')]=function(_0xd2f0d,_0x1f28fc){return _0xd2f0d[_0x7286('0x7')]('VoiceCallReport',attributes,{'tableName':_0x7286('0x8'),'paranoid':![],'indexes':[{'fields':[_0x7286('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 4e19fe5..7567c46 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 _0xe5dd=['where','attributes','limit','include','map','model','then','VoiceCallReport','body','CreateVoiceCallReport','update','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','findAll','options','raw'];(function(_0x209302,_0x5826ac){var _0x1df8e9=function(_0x16ae49){while(--_0x16ae49){_0x209302['push'](_0x209302['shift']());}};_0x1df8e9(++_0x5826ac);}(_0xe5dd,0xa8));var _0xde5d=function(_0x4fb879,_0x3b9a72){_0x4fb879=_0x4fb879-0x0;var _0xaa6a4d=_0xe5dd[_0x4fb879];return _0xaa6a4d;};'use strict';var _=require(_0xde5d('0x0'));var util=require(_0xde5d('0x1'));var moment=require(_0xde5d('0x2'));var BPromise=require(_0xde5d('0x3'));var rs=require(_0xde5d('0x4'));var fs=require('fs');var Redis=require(_0xde5d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xde5d('0x6'));var logger=require(_0xde5d('0x7'))('rpc');var config=require(_0xde5d('0x8'));var jayson=require(_0xde5d('0x9'));var client=jayson[_0xde5d('0xa')][_0xde5d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47920a,_0x34150f,_0x2ca8e3){return new BPromise(function(_0x22803b,_0x36d3a0){return client['request'](_0x47920a,_0x2ca8e3)['then'](function(_0x35fba5){logger[_0xde5d('0xc')](_0xde5d('0xd'),_0x34150f,_0xde5d('0xe'));logger[_0xde5d('0xf')](_0xde5d('0x10'),_0x34150f,_0xde5d('0xe'),JSON[_0xde5d('0x11')](_0x35fba5));if(_0x35fba5[_0xde5d('0x12')]){if(_0x35fba5['error'][_0xde5d('0x13')]===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x34150f,_0x35fba5[_0xde5d('0x12')][_0xde5d('0x14')]);return _0x36d3a0(_0x35fba5[_0xde5d('0x12')][_0xde5d('0x14')]);}logger['error'](_0xde5d('0xd'),_0x34150f,_0x35fba5['error'][_0xde5d('0x14')]);return _0x22803b(_0x35fba5['error'][_0xde5d('0x14')]);}else{logger[_0xde5d('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x34150f,_0xde5d('0xe'));_0x22803b(_0x35fba5[_0xde5d('0x15')]['message']);}})[_0xde5d('0x16')](function(_0x2de905){logger[_0xde5d('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x34150f,_0x2de905);_0x36d3a0(_0x2de905);});});}exports[_0xde5d('0x17')]=function(_0x26dcc2){var _0x21b266=this;return new Promise(function(_0x5010c7,_0x2dc060){return db['VoiceCallReport'][_0xde5d('0x18')]({'raw':_0x26dcc2[_0xde5d('0x19')]?_0x26dcc2[_0xde5d('0x19')][_0xde5d('0x1a')]===undefined?!![]:![]:!![],'where':_0x26dcc2[_0xde5d('0x19')]?_0x26dcc2[_0xde5d('0x19')][_0xde5d('0x1b')]||null:null,'attributes':_0x26dcc2[_0xde5d('0x19')]?_0x26dcc2[_0xde5d('0x19')][_0xde5d('0x1c')]||null:null,'limit':_0x26dcc2[_0xde5d('0x19')]?_0x26dcc2[_0xde5d('0x19')][_0xde5d('0x1d')]||null:null,'include':_0x26dcc2['options']?_0x26dcc2['options'][_0xde5d('0x1e')]?_[_0xde5d('0x1f')](_0x26dcc2[_0xde5d('0x19')][_0xde5d('0x1e')],function(_0x3950b2){return{'model':db[_0x3950b2[_0xde5d('0x20')]],'as':_0x3950b2['as'],'attributes':_0x3950b2['attributes'],'include':_0x3950b2[_0xde5d('0x1e')]?_[_0xde5d('0x1f')](_0x3950b2[_0xde5d('0x1e')],function(_0x3a981f){return{'model':db[_0x3a981f[_0xde5d('0x20')]],'as':_0x3a981f['as'],'attributes':_0x3a981f[_0xde5d('0x1c')],'include':_0x3a981f['include']?_[_0xde5d('0x1f')](_0x3a981f['include'],function(_0x400c4c){return{'model':db[_0x400c4c[_0xde5d('0x20')]],'as':_0x400c4c['as'],'attributes':_0x400c4c[_0xde5d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xde5d('0x21')](function(_0x116bc2){logger[_0xde5d('0xc')](_0xde5d('0x17'),_0x26dcc2);logger[_0xde5d('0xf')](_0xde5d('0x17'),_0x26dcc2,JSON[_0xde5d('0x11')](_0x116bc2));_0x5010c7(_0x116bc2);})['catch'](function(_0x2ab995){logger[_0xde5d('0x12')](_0xde5d('0x17'),_0x2ab995[_0xde5d('0x14')],_0x26dcc2);_0x2dc060(_0x21b266['error'](0x1f4,_0x2ab995[_0xde5d('0x14')]));});});};exports['CreateVoiceCallReport']=function(_0x47ad77){var _0x49ba0d=this;return new Promise(function(_0x360213,_0x15120f){return db[_0xde5d('0x22')]['create'](_0x47ad77[_0xde5d('0x23')],{'raw':_0x47ad77['options']?_0x47ad77[_0xde5d('0x19')][_0xde5d('0x1a')]===undefined?!![]:![]:!![]})[_0xde5d('0x21')](function(_0x4b64a6){logger[_0xde5d('0xc')](_0xde5d('0x24'),_0x47ad77);logger[_0xde5d('0xf')]('CreateVoiceCallReport',_0x47ad77,JSON[_0xde5d('0x11')](_0x4b64a6));_0x360213(_0x4b64a6);})['catch'](function(_0x3dd4cb){logger[_0xde5d('0x12')](_0xde5d('0x24'),_0x3dd4cb['message'],_0x47ad77);_0x15120f(_0x49ba0d[_0xde5d('0x12')](0x1f4,_0x3dd4cb['message']));});});};exports['UpdateVoiceCallReport']=function(_0x534343){var _0x59a394=this;return new Promise(function(_0x19d894,_0x502431){return db[_0xde5d('0x22')][_0xde5d('0x25')](_0x534343['body'],{'raw':_0x534343['options']?_0x534343[_0xde5d('0x19')][_0xde5d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x534343[_0xde5d('0x19')]?_0x534343['options'][_0xde5d('0x1b')]||null:null,'attributes':_0x534343[_0xde5d('0x19')]?_0x534343[_0xde5d('0x19')][_0xde5d('0x1c')]||null:null,'limit':_0x534343[_0xde5d('0x19')]?_0x534343[_0xde5d('0x19')]['limit']||null:null})['then'](function(_0x1ae948){logger[_0xde5d('0xc')](_0xde5d('0x26'),_0x534343);logger[_0xde5d('0xf')](_0xde5d('0x26'),_0x534343,JSON[_0xde5d('0x11')](_0x1ae948));_0x19d894(_0x1ae948);})['catch'](function(_0x248f0b){logger['error']('UpdateVoiceCallReport',_0x248f0b[_0xde5d('0x14')],_0x534343);_0x502431(_0x59a394['error'](0x1f4,_0x248f0b[_0xde5d('0x14')]));});});}; \ No newline at end of file +var _0x7c12=['model','map','catch','VoiceCallReport','create','CreateVoiceCallReport','update','where','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','raw','options','attributes','limit','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c12,0x7e));var _0x27c1=function(_0x310d10,_0x3fe887){_0x310d10=_0x310d10-0x0;var _0x1fb8af=_0x7c12[_0x310d10];return _0x1fb8af;};'use strict';var _=require(_0x27c1('0x0'));var util=require(_0x27c1('0x1'));var moment=require(_0x27c1('0x2'));var BPromise=require(_0x27c1('0x3'));var rs=require(_0x27c1('0x4'));var fs=require('fs');var Redis=require(_0x27c1('0x5'));var db=require(_0x27c1('0x6'))['db'];var utils=require(_0x27c1('0x7'));var logger=require(_0x27c1('0x8'))(_0x27c1('0x9'));var config=require('../../config/environment');var jayson=require(_0x27c1('0xa'));var client=jayson[_0x27c1('0xb')][_0x27c1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c1f66,_0x464b0f,_0x313425){return new BPromise(function(_0x1b1385,_0x157539){return client[_0x27c1('0xd')](_0x5c1f66,_0x313425)[_0x27c1('0xe')](function(_0x510b6d){logger[_0x27c1('0xf')](_0x27c1('0x10'),_0x464b0f,_0x27c1('0x11'));logger[_0x27c1('0x12')](_0x27c1('0x13'),_0x464b0f,'request\x20sent',JSON[_0x27c1('0x14')](_0x510b6d));if(_0x510b6d[_0x27c1('0x15')]){if(_0x510b6d[_0x27c1('0x15')][_0x27c1('0x16')]===0x1f4){logger[_0x27c1('0x15')]('VoiceCallReport,\x20%s,\x20%s',_0x464b0f,_0x510b6d['error'][_0x27c1('0x17')]);return _0x157539(_0x510b6d[_0x27c1('0x15')][_0x27c1('0x17')]);}logger['error'](_0x27c1('0x10'),_0x464b0f,_0x510b6d[_0x27c1('0x15')][_0x27c1('0x17')]);return _0x1b1385(_0x510b6d[_0x27c1('0x15')][_0x27c1('0x17')]);}else{logger[_0x27c1('0xf')](_0x27c1('0x10'),_0x464b0f,_0x27c1('0x11'));_0x1b1385(_0x510b6d[_0x27c1('0x18')]['message']);}})['catch'](function(_0x5db2cd){logger[_0x27c1('0x15')](_0x27c1('0x10'),_0x464b0f,_0x5db2cd);_0x157539(_0x5db2cd);});});}exports['GetVoiceCallReport']=function(_0x4b2650){var _0x3022f3=this;return new Promise(function(_0x12303e,_0x199600){return db['VoiceCallReport']['findAll']({'raw':_0x4b2650['options']?_0x4b2650['options'][_0x27c1('0x19')]===undefined?!![]:![]:!![],'where':_0x4b2650[_0x27c1('0x1a')]?_0x4b2650[_0x27c1('0x1a')]['where']||null:null,'attributes':_0x4b2650[_0x27c1('0x1a')]?_0x4b2650[_0x27c1('0x1a')][_0x27c1('0x1b')]||null:null,'limit':_0x4b2650[_0x27c1('0x1a')]?_0x4b2650[_0x27c1('0x1a')][_0x27c1('0x1c')]||null:null,'include':_0x4b2650[_0x27c1('0x1a')]?_0x4b2650[_0x27c1('0x1a')][_0x27c1('0x1d')]?_['map'](_0x4b2650[_0x27c1('0x1a')][_0x27c1('0x1d')],function(_0x2ef2ae){return{'model':db[_0x2ef2ae[_0x27c1('0x1e')]],'as':_0x2ef2ae['as'],'attributes':_0x2ef2ae[_0x27c1('0x1b')],'include':_0x2ef2ae[_0x27c1('0x1d')]?_[_0x27c1('0x1f')](_0x2ef2ae['include'],function(_0x2ca287){return{'model':db[_0x2ca287[_0x27c1('0x1e')]],'as':_0x2ca287['as'],'attributes':_0x2ca287[_0x27c1('0x1b')],'include':_0x2ca287[_0x27c1('0x1d')]?_[_0x27c1('0x1f')](_0x2ca287[_0x27c1('0x1d')],function(_0x346970){return{'model':db[_0x346970['model']],'as':_0x346970['as'],'attributes':_0x346970[_0x27c1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x27c1('0xe')](function(_0x27b3f1){logger[_0x27c1('0xf')]('GetVoiceCallReport',_0x4b2650);logger[_0x27c1('0x12')]('GetVoiceCallReport',_0x4b2650,JSON[_0x27c1('0x14')](_0x27b3f1));_0x12303e(_0x27b3f1);})[_0x27c1('0x20')](function(_0x3e7070){logger['error']('GetVoiceCallReport',_0x3e7070[_0x27c1('0x17')],_0x4b2650);_0x199600(_0x3022f3[_0x27c1('0x15')](0x1f4,_0x3e7070[_0x27c1('0x17')]));});});};exports['CreateVoiceCallReport']=function(_0x58549e){var _0x20f9f1=this;return new Promise(function(_0x4174d7,_0x5d578e){return db[_0x27c1('0x21')][_0x27c1('0x22')](_0x58549e['body'],{'raw':_0x58549e[_0x27c1('0x1a')]?_0x58549e[_0x27c1('0x1a')][_0x27c1('0x19')]===undefined?!![]:![]:!![]})[_0x27c1('0xe')](function(_0x1387c8){logger[_0x27c1('0xf')](_0x27c1('0x23'),_0x58549e);logger['debug'](_0x27c1('0x23'),_0x58549e,JSON[_0x27c1('0x14')](_0x1387c8));_0x4174d7(_0x1387c8);})['catch'](function(_0x204fda){logger['error'](_0x27c1('0x23'),_0x204fda[_0x27c1('0x17')],_0x58549e);_0x5d578e(_0x20f9f1[_0x27c1('0x15')](0x1f4,_0x204fda['message']));});});};exports['UpdateVoiceCallReport']=function(_0x8c8404){var _0x508826=this;return new Promise(function(_0x30cb1b,_0x38a57f){return db[_0x27c1('0x21')][_0x27c1('0x24')](_0x8c8404['body'],{'raw':_0x8c8404['options']?_0x8c8404['options'][_0x27c1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8c8404['options']?_0x8c8404[_0x27c1('0x1a')][_0x27c1('0x25')]||null:null,'attributes':_0x8c8404[_0x27c1('0x1a')]?_0x8c8404['options'][_0x27c1('0x1b')]||null:null,'limit':_0x8c8404[_0x27c1('0x1a')]?_0x8c8404[_0x27c1('0x1a')][_0x27c1('0x1c')]||null:null})[_0x27c1('0xe')](function(_0x32c6d2){logger[_0x27c1('0xf')](_0x27c1('0x26'),_0x8c8404);logger[_0x27c1('0x12')]('UpdateVoiceCallReport',_0x8c8404,JSON[_0x27c1('0x14')](_0x32c6d2));_0x30cb1b(_0x32c6d2);})['catch'](function(_0xba9593){logger[_0x27c1('0x15')](_0x27c1('0x26'),_0xba9593['message'],_0x8c8404);_0x38a57f(_0x508826[_0x27c1('0x15')](0x1f4,_0xba9593['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 418f1a9..9ed8466 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 _0xee87=['get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller'];(function(_0xab7912,_0x12f79e){var _0x1c343e=function(_0x1009b3){while(--_0x1009b3){_0xab7912['push'](_0xab7912['shift']());}};_0x1c343e(++_0x12f79e);}(_0xee87,0x193));var _0x7ee8=function(_0x2b88c7,_0x570a7f){_0x2b88c7=_0x2b88c7-0x0;var _0x7d479f=_0xee87[_0x2b88c7];return _0x7d479f;};'use strict';var multer=require('multer');var util=require(_0x7ee8('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7ee8('0x1')]();var auth=require(_0x7ee8('0x2'));var interaction=require(_0x7ee8('0x3'));var config=require('../../config/environment');var controller=require(_0x7ee8('0x4'));router[_0x7ee8('0x5')]('/',auth['isAuthenticated'](),controller[_0x7ee8('0x6')]);router[_0x7ee8('0x5')](_0x7ee8('0x7'),auth[_0x7ee8('0x8')](),controller[_0x7ee8('0x9')]);router[_0x7ee8('0xa')]('/',auth[_0x7ee8('0x8')](),controller[_0x7ee8('0xb')]);router[_0x7ee8('0xc')](_0x7ee8('0x7'),auth[_0x7ee8('0x8')](),controller[_0x7ee8('0xd')]);router[_0x7ee8('0xe')]('/:id',auth[_0x7ee8('0x8')](),controller[_0x7ee8('0xf')]);module[_0x7ee8('0x10')]=router; \ No newline at end of file +var _0xa2d7=['multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','update','delete','/:id','destroy','exports'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0xa2d7,0x1ba));var _0x7a2d=function(_0x534121,_0x5cf20a){_0x534121=_0x534121-0x0;var _0x243ac9=_0xa2d7[_0x534121];return _0x243ac9;};'use strict';var multer=require(_0x7a2d('0x0'));var util=require(_0x7a2d('0x1'));var path=require(_0x7a2d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7a2d('0x3')]();var auth=require(_0x7a2d('0x4'));var interaction=require(_0x7a2d('0x5'));var config=require(_0x7a2d('0x6'));var controller=require('./voiceChanSpy.controller');router[_0x7a2d('0x7')]('/',auth[_0x7a2d('0x8')](),controller[_0x7a2d('0x9')]);router[_0x7a2d('0x7')]('/:id',auth[_0x7a2d('0x8')](),controller[_0x7a2d('0xa')]);router[_0x7a2d('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x7a2d('0x8')](),controller[_0x7a2d('0xc')]);router[_0x7a2d('0xd')](_0x7a2d('0xe'),auth[_0x7a2d('0x8')](),controller[_0x7a2d('0xf')]);module[_0x7a2d('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index fa88a74..56d24b7 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 _0xc5dc=['getDataValue','split','BOOLEAN','sequelize','STRING','name','setDataValue','options','join'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xc5dc,0x1e0));var _0xcc5d=function(_0x28f867,_0x17976f){_0x28f867=_0x28f867-0x0;var _0x12ef2b=_0xc5dc[_0x28f867];return _0x12ef2b;};'use strict';var Sequelize=require(_0xcc5d('0x0'));module['exports']={'name':{'type':Sequelize[_0xcc5d('0x1')]},'prefix':{'type':Sequelize[_0xcc5d('0x1')],'unique':_0xcc5d('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xcc5d('0x1')],'set':function(_0x221c89){this[_0xcc5d('0x3')](_0xcc5d('0x4'),_0x221c89?_0x221c89[_0xcc5d('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xcc5d('0x4'))?this[_0xcc5d('0x6')](_0xcc5d('0x4'))[_0xcc5d('0x7')](''):[];}},'auth':{'type':Sequelize[_0xcc5d('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xcc5d('0x1')]},'description':{'type':Sequelize[_0xcc5d('0x1')]}}; \ No newline at end of file +var _0xc7d8=['exports','STRING','setDataValue','options','join','getDataValue'];(function(_0x573be9,_0x813a1e){var _0x525537=function(_0x195200){while(--_0x195200){_0x573be9['push'](_0x573be9['shift']());}};_0x525537(++_0x813a1e);}(_0xc7d8,0x66));var _0x8c7d=function(_0x56dd69,_0x3bf1fc){_0x56dd69=_0x56dd69-0x0;var _0x59d84c=_0xc7d8[_0x56dd69];return _0x59d84c;};'use strict';var Sequelize=require('sequelize');module[_0x8c7d('0x0')]={'name':{'type':Sequelize[_0x8c7d('0x1')]},'prefix':{'type':Sequelize[_0x8c7d('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x8c7d('0x1')],'set':function(_0x4d4cc5){this[_0x8c7d('0x2')](_0x8c7d('0x3'),_0x4d4cc5?_0x4d4cc5[_0x8c7d('0x4')](''):[]);},'get':function(){return this[_0x8c7d('0x5')](_0x8c7d('0x3'))?this['getDataValue'](_0x8c7d('0x3'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x8c7d('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x8c7d('0x1')]},'description':{'type':Sequelize[_0x8c7d('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 263fbd0..b920243 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 _0x881a=['apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','send','index','VoiceChanSpy','key','model','map','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','intersection','includeAll','find','create','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','count','offset','set','Content-Range','json'];(function(_0x1d9a03,_0x44b1e8){var _0x46955b=function(_0x58b636){while(--_0x58b636){_0x1d9a03['push'](_0x1d9a03['shift']());}};_0x46955b(++_0x44b1e8);}(_0x881a,0xd8));var _0xa881=function(_0x2fa164,_0x489302){_0x2fa164=_0x2fa164-0x0;var _0x5e9ae5=_0x881a[_0x2fa164];return _0x5e9ae5;};'use strict';var pdf=require(_0xa881('0x0'));var emlformat=require(_0xa881('0x1'));var rimraf=require(_0xa881('0x2'));var zipdir=require(_0xa881('0x3'));var jsonpatch=require(_0xa881('0x4'));var rp=require(_0xa881('0x5'));var moment=require(_0xa881('0x6'));var BPromise=require(_0xa881('0x7'));var Mustache=require('mustache');var util=require(_0xa881('0x8'));var path=require('path');var sox=require(_0xa881('0x9'));var csv=require(_0xa881('0xa'));var ejs=require(_0xa881('0xb'));var fs=require('fs');var _=require(_0xa881('0xc'));var squel=require(_0xa881('0xd'));var crypto=require('crypto');var jsforce=require(_0xa881('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa881('0xf'));var Papa=require(_0xa881('0x10'));var Redis=require(_0xa881('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa881('0x12'));var hardwareService=require(_0xa881('0x13'));var logger=require(_0xa881('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xa881('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a856c,_0x204016){_0x204016=_0x204016||0xcc;return function(_0x245f64){if(_0x245f64){return _0x4a856c[_0xa881('0x16')](_0x204016);}return _0x4a856c[_0xa881('0x17')](_0x204016)[_0xa881('0x18')]();};}function respondWithResult(_0xf50e7f,_0x38e3e1){_0x38e3e1=_0x38e3e1||0xc8;return function(_0x35ca2f){if(_0x35ca2f){return _0xf50e7f[_0xa881('0x17')](_0x38e3e1)['json'](_0x35ca2f);}};}function respondWithFilteredResult(_0x499d83,_0x561ab7){return function(_0xe17d2c){if(_0xe17d2c){var _0x2c329b=_0xe17d2c[_0xa881('0x19')],_0x422375=_0x561ab7[_0xa881('0x1a')],_0x1f179b=_0x561ab7[_0xa881('0x1a')]+_0x561ab7['limit'],_0x2a9b2e;if(_0x1f179b>=_0x2c329b){_0x1f179b=_0x2c329b;_0x2a9b2e=0xc8;}else{_0x2a9b2e=0xce;}_0x499d83[_0xa881('0x17')](_0x2a9b2e);return _0x499d83[_0xa881('0x1b')](_0xa881('0x1c'),_0x422375+'-'+_0x1f179b+'/'+_0x2c329b)[_0xa881('0x1d')](_0xe17d2c);}return null;};}function patchUpdates(_0x34d935){return function(_0x566749){try{jsonpatch[_0xa881('0x1e')](_0x566749,_0x34d935,!![]);}catch(_0x26bfed){return BPromise[_0xa881('0x1f')](_0x26bfed);}return _0x566749[_0xa881('0x20')]();};}function saveUpdates(_0xdefb25,_0x26c949){return function(_0x32cd7a){if(_0x32cd7a){return _0x32cd7a[_0xa881('0x21')](_0xdefb25)[_0xa881('0x22')](function(_0x11cb5c){return _0x11cb5c;});}return null;};}function removeEntity(_0x2780e2,_0x5bf184){return function(_0x3c832e){if(_0x3c832e){return _0x3c832e[_0xa881('0x23')]()[_0xa881('0x22')](function(){var _0x494de6=_0x3c832e[_0xa881('0x24')]({'plain':!![]});var _0x2ef521=_0xa881('0x25');return db[_0xa881('0x26')]['destroy']({'where':{'type':_0x2ef521,'resourceId':_0x494de6['id']}})[_0xa881('0x22')](function(){return _0x3c832e;});})[_0xa881('0x22')](function(){_0x2780e2[_0xa881('0x17')](0xcc)[_0xa881('0x18')]();});}};}function handleEntityNotFound(_0x55e535,_0x21ee5d){return function(_0x2cce9b){if(!_0x2cce9b){_0x55e535[_0xa881('0x16')](0x194);}return _0x2cce9b;};}function handleError(_0x41a7d2,_0x12a2d3){_0x12a2d3=_0x12a2d3||0x1f4;return function(_0x244a48){logger[_0xa881('0x27')](_0x244a48[_0xa881('0x28')]);if(_0x244a48[_0xa881('0x29')]){delete _0x244a48[_0xa881('0x29')];}_0x41a7d2[_0xa881('0x17')](_0x12a2d3)[_0xa881('0x2a')](_0x244a48);};}exports[_0xa881('0x2b')]=function(_0x15d95e,_0x5c57d4){var _0x561a3c={},_0x3f20a0={},_0x1cbeb0={'count':0x0,'rows':[]};var _0xc92017=_['map'](db[_0xa881('0x2c')]['rawAttributes'],function(_0x3b415d){return{'name':_0x3b415d['fieldName'],'type':_0x3b415d['type'][_0xa881('0x2d')]};});_0x3f20a0[_0xa881('0x2e')]=_[_0xa881('0x2f')](_0xc92017,_0xa881('0x29'));_0x3f20a0[_0xa881('0x30')]=_[_0xa881('0x31')](_0x15d95e['query']);_0x3f20a0[_0xa881('0x32')]=_['intersection'](_0x3f20a0[_0xa881('0x2e')],_0x3f20a0[_0xa881('0x30')]);_0x561a3c['attributes']=_['intersection'](_0x3f20a0['model'],qs[_0xa881('0x33')](_0x15d95e[_0xa881('0x30')][_0xa881('0x33')]));_0x561a3c['attributes']=_0x561a3c[_0xa881('0x34')][_0xa881('0x35')]?_0x561a3c[_0xa881('0x34')]:_0x3f20a0['model'];if(!_0x15d95e[_0xa881('0x30')][_0xa881('0x36')](_0xa881('0x37'))){_0x561a3c['limit']=qs[_0xa881('0x38')](_0x15d95e['query']['limit']);_0x561a3c[_0xa881('0x1a')]=qs[_0xa881('0x1a')](_0x15d95e[_0xa881('0x30')]['offset']);}_0x561a3c[_0xa881('0x39')]=qs[_0xa881('0x3a')](_0x15d95e['query'][_0xa881('0x3a')]);_0x561a3c[_0xa881('0x3b')]=qs[_0xa881('0x32')](_[_0xa881('0x3c')](_0x15d95e[_0xa881('0x30')],_0x3f20a0['filters']),_0xc92017);if(_0x15d95e['query'][_0xa881('0x3d')]){_0x561a3c[_0xa881('0x3b')]=_[_0xa881('0x3e')](_0x561a3c[_0xa881('0x3b')],{'$or':_[_0xa881('0x2f')](_0xc92017,function(_0x260fe3){if(_0x260fe3[_0xa881('0x3f')]!==_0xa881('0x40')){var _0x12b897={};_0x12b897[_0x260fe3[_0xa881('0x29')]]={'$like':'%'+_0x15d95e[_0xa881('0x30')]['filter']+'%'};return _0x12b897;}})});}_0x561a3c=_[_0xa881('0x3e')]({},_0x561a3c,_0x15d95e[_0xa881('0x41')]);var _0x2e452c={'where':_0x561a3c['where']};return db[_0xa881('0x2c')][_0xa881('0x19')](_0x2e452c)[_0xa881('0x22')](function(_0x68602b){_0x1cbeb0[_0xa881('0x19')]=_0x68602b;if(_0x15d95e[_0xa881('0x30')]['includeAll']){_0x561a3c[_0xa881('0x42')]=[{'all':!![]}];}return db[_0xa881('0x2c')][_0xa881('0x43')](_0x561a3c);})[_0xa881('0x22')](function(_0x76989d){_0x1cbeb0[_0xa881('0x44')]=_0x76989d;return _0x1cbeb0;})['then'](respondWithFilteredResult(_0x5c57d4,_0x561a3c))[_0xa881('0x45')](handleError(_0x5c57d4,null));};exports['show']=function(_0xd64c52,_0x2f03c1){var _0x375795={'raw':![],'where':{'id':_0xd64c52[_0xa881('0x46')]['id']}},_0x931e8f={};_0x931e8f[_0xa881('0x2e')]=_['keys'](db[_0xa881('0x2c')][_0xa881('0x47')]);_0x931e8f[_0xa881('0x30')]=_['keys'](_0xd64c52[_0xa881('0x30')]);_0x931e8f[_0xa881('0x32')]=_[_0xa881('0x48')](_0x931e8f[_0xa881('0x2e')],_0x931e8f['query']);_0x375795[_0xa881('0x34')]=_['intersection'](_0x931e8f['model'],qs['fields'](_0xd64c52[_0xa881('0x30')][_0xa881('0x33')]));_0x375795[_0xa881('0x34')]=_0x375795['attributes'][_0xa881('0x35')]?_0x375795['attributes']:_0x931e8f[_0xa881('0x2e')];if(_0xd64c52[_0xa881('0x30')][_0xa881('0x49')]){_0x375795[_0xa881('0x42')]=[{'all':!![]}];}_0x375795=_[_0xa881('0x3e')]({},_0x375795,_0xd64c52['options']);return db['VoiceChanSpy'][_0xa881('0x4a')](_0x375795)[_0xa881('0x22')](handleEntityNotFound(_0x2f03c1,null))[_0xa881('0x22')](respondWithResult(_0x2f03c1,null))[_0xa881('0x45')](handleError(_0x2f03c1,null));};exports[_0xa881('0x4b')]=function(_0x4566e3,_0x387a49){return db['VoiceChanSpy'][_0xa881('0x4b')](_0x4566e3['body'],{})[_0xa881('0x22')](function(_0x23a5f1){var _0x1b3dcc=_0x4566e3[_0xa881('0x4c')][_0xa881('0x24')]({'plain':!![]});if(!_0x1b3dcc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b3dcc[_0xa881('0x4d')]===_0xa881('0x4c')){var _0x285e33=_0x23a5f1['get']({'plain':!![]});var _0x273d6f=_0xa881('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x273d6f,'userProfileId':_0x1b3dcc[_0xa881('0x4e')]},'raw':!![]})['then'](function(_0x1601e6){if(_0x1601e6&&_0x1601e6[_0xa881('0x4f')]===0x0){return db[_0xa881('0x26')]['create']({'name':_0x285e33['name'],'resourceId':_0x285e33['id'],'type':_0x1601e6[_0xa881('0x29')],'sectionId':_0x1601e6['id']},{})['then'](function(){return _0x23a5f1;});}else{return _0x23a5f1;}})[_0xa881('0x45')](function(_0x4027ec){logger['error'](_0xa881('0x50'),_0x4027ec);throw _0x4027ec;});}return _0x23a5f1;})[_0xa881('0x22')](respondWithResult(_0x387a49,0xc9))[_0xa881('0x45')](handleError(_0x387a49,null));};exports[_0xa881('0x21')]=function(_0x32401e,_0x36493c){if(_0x32401e['body']['id']){delete _0x32401e[_0xa881('0x51')]['id'];}return db['VoiceChanSpy'][_0xa881('0x4a')]({'where':{'id':_0x32401e[_0xa881('0x46')]['id']}})['then'](handleEntityNotFound(_0x36493c,null))['then'](saveUpdates(_0x32401e[_0xa881('0x51')],null))[_0xa881('0x22')](respondWithResult(_0x36493c,null))[_0xa881('0x45')](handleError(_0x36493c,null));};exports[_0xa881('0x23')]=function(_0x44c6f5,_0x70b61f){return db[_0xa881('0x2c')]['find']({'where':{'id':_0x44c6f5['params']['id']}})['then'](handleEntityNotFound(_0x70b61f,null))['then'](removeEntity(_0x70b61f,null))[_0xa881('0x45')](handleError(_0x70b61f,null));}; \ No newline at end of file +var _0x848f=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','VoiceChanSpy','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','fields','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','ioredis'];(function(_0x42f812,_0x29a707){var _0x473173=function(_0x17f99b){while(--_0x17f99b){_0x42f812['push'](_0x42f812['shift']());}};_0x473173(++_0x29a707);}(_0x848f,0x1bf));var _0xf848=function(_0x2010aa,_0x443857){_0x2010aa=_0x2010aa-0x0;var _0x47639d=_0x848f[_0x2010aa];return _0x47639d;};'use strict';var pdf=require(_0xf848('0x0'));var emlformat=require(_0xf848('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf848('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf848('0x3'));var moment=require(_0xf848('0x4'));var BPromise=require(_0xf848('0x5'));var Mustache=require(_0xf848('0x6'));var util=require(_0xf848('0x7'));var path=require('path');var sox=require(_0xf848('0x8'));var csv=require(_0xf848('0x9'));var ejs=require(_0xf848('0xa'));var fs=require('fs');var _=require(_0xf848('0xb'));var squel=require(_0xf848('0xc'));var crypto=require('crypto');var jsforce=require(_0xf848('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf848('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf848('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf848('0xf'));var as=require(_0xf848('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf848('0x11'))(_0xf848('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf848('0x13'));var db=require(_0xf848('0x14'))['db'];function respondWithStatusCode(_0x27dd2b,_0x35a739){_0x35a739=_0x35a739||0xcc;return function(_0x5a6b3f){if(_0x5a6b3f){return _0x27dd2b[_0xf848('0x15')](_0x35a739);}return _0x27dd2b[_0xf848('0x16')](_0x35a739)[_0xf848('0x17')]();};}function respondWithResult(_0x158f50,_0x491d72){_0x491d72=_0x491d72||0xc8;return function(_0x4ea8d){if(_0x4ea8d){return _0x158f50[_0xf848('0x16')](_0x491d72)[_0xf848('0x18')](_0x4ea8d);}};}function respondWithFilteredResult(_0x3cc3f5,_0x271673){return function(_0x2d2b77){if(_0x2d2b77){var _0x256087=_0x2d2b77[_0xf848('0x19')],_0x5acc78=_0x271673[_0xf848('0x1a')],_0x559267=_0x271673[_0xf848('0x1a')]+_0x271673[_0xf848('0x1b')],_0x2df1dc;if(_0x559267>=_0x256087){_0x559267=_0x256087;_0x2df1dc=0xc8;}else{_0x2df1dc=0xce;}_0x3cc3f5['status'](_0x2df1dc);return _0x3cc3f5['set']('Content-Range',_0x5acc78+'-'+_0x559267+'/'+_0x256087)['json'](_0x2d2b77);}return null;};}function patchUpdates(_0x46f864){return function(_0x2b4dfc){try{jsonpatch[_0xf848('0x1c')](_0x2b4dfc,_0x46f864,!![]);}catch(_0x454ec5){return BPromise[_0xf848('0x1d')](_0x454ec5);}return _0x2b4dfc[_0xf848('0x1e')]();};}function saveUpdates(_0x101335,_0x1e1b6a){return function(_0x2296a8){if(_0x2296a8){return _0x2296a8[_0xf848('0x1f')](_0x101335)[_0xf848('0x20')](function(_0x695337){return _0x695337;});}return null;};}function removeEntity(_0x3188f6,_0x146f15){return function(_0x32f146){if(_0x32f146){return _0x32f146[_0xf848('0x21')]()[_0xf848('0x20')](function(){var _0x322ed7=_0x32f146[_0xf848('0x22')]({'plain':!![]});var _0x297b64='ChanSpies';return db[_0xf848('0x23')]['destroy']({'where':{'type':_0x297b64,'resourceId':_0x322ed7['id']}})['then'](function(){return _0x32f146;});})[_0xf848('0x20')](function(){_0x3188f6[_0xf848('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b9f69,_0xe30a5d){return function(_0x3656d3){if(!_0x3656d3){_0x2b9f69[_0xf848('0x15')](0x194);}return _0x3656d3;};}function handleError(_0x3a9f95,_0x15d970){_0x15d970=_0x15d970||0x1f4;return function(_0x210e1f){logger[_0xf848('0x24')](_0x210e1f[_0xf848('0x25')]);if(_0x210e1f[_0xf848('0x26')]){delete _0x210e1f[_0xf848('0x26')];}_0x3a9f95['status'](_0x15d970)[_0xf848('0x27')](_0x210e1f);};}exports['index']=function(_0x266ce7,_0x191fe2){var _0x22afef={},_0x3ce88b={},_0xbe509={'count':0x0,'rows':[]};var _0x30f484=_[_0xf848('0x28')](db[_0xf848('0x29')]['rawAttributes'],function(_0x2cb1d1){return{'name':_0x2cb1d1['fieldName'],'type':_0x2cb1d1['type'][_0xf848('0x2a')]};});_0x3ce88b[_0xf848('0x2b')]=_[_0xf848('0x28')](_0x30f484,_0xf848('0x26'));_0x3ce88b[_0xf848('0x2c')]=_[_0xf848('0x2d')](_0x266ce7['query']);_0x3ce88b[_0xf848('0x2e')]=_[_0xf848('0x2f')](_0x3ce88b['model'],_0x3ce88b[_0xf848('0x2c')]);_0x22afef[_0xf848('0x30')]=_['intersection'](_0x3ce88b[_0xf848('0x2b')],qs['fields'](_0x266ce7[_0xf848('0x2c')]['fields']));_0x22afef[_0xf848('0x30')]=_0x22afef['attributes'][_0xf848('0x31')]?_0x22afef[_0xf848('0x30')]:_0x3ce88b['model'];if(!_0x266ce7[_0xf848('0x2c')][_0xf848('0x32')](_0xf848('0x33'))){_0x22afef[_0xf848('0x1b')]=qs[_0xf848('0x1b')](_0x266ce7['query'][_0xf848('0x1b')]);_0x22afef[_0xf848('0x1a')]=qs[_0xf848('0x1a')](_0x266ce7[_0xf848('0x2c')][_0xf848('0x1a')]);}_0x22afef[_0xf848('0x34')]=qs[_0xf848('0x35')](_0x266ce7[_0xf848('0x2c')][_0xf848('0x35')]);_0x22afef[_0xf848('0x36')]=qs[_0xf848('0x2e')](_[_0xf848('0x37')](_0x266ce7[_0xf848('0x2c')],_0x3ce88b[_0xf848('0x2e')]),_0x30f484);if(_0x266ce7[_0xf848('0x2c')][_0xf848('0x38')]){_0x22afef[_0xf848('0x36')]=_[_0xf848('0x39')](_0x22afef[_0xf848('0x36')],{'$or':_[_0xf848('0x28')](_0x30f484,function(_0x13e3c8){if(_0x13e3c8['type']!==_0xf848('0x3a')){var _0x2a8dfa={};_0x2a8dfa[_0x13e3c8[_0xf848('0x26')]]={'$like':'%'+_0x266ce7[_0xf848('0x2c')][_0xf848('0x38')]+'%'};return _0x2a8dfa;}})});}_0x22afef=_[_0xf848('0x39')]({},_0x22afef,_0x266ce7[_0xf848('0x3b')]);var _0x4fd3b1={'where':_0x22afef[_0xf848('0x36')]};return db[_0xf848('0x29')][_0xf848('0x19')](_0x4fd3b1)[_0xf848('0x20')](function(_0x42a8af){_0xbe509[_0xf848('0x19')]=_0x42a8af;if(_0x266ce7[_0xf848('0x2c')][_0xf848('0x3c')]){_0x22afef[_0xf848('0x3d')]=[{'all':!![]}];}return db[_0xf848('0x29')]['findAll'](_0x22afef);})[_0xf848('0x20')](function(_0x4ae78c){_0xbe509[_0xf848('0x3e')]=_0x4ae78c;return _0xbe509;})['then'](respondWithFilteredResult(_0x191fe2,_0x22afef))[_0xf848('0x3f')](handleError(_0x191fe2,null));};exports[_0xf848('0x40')]=function(_0x48442b,_0x2bbac3){var _0x4756a7={'raw':![],'where':{'id':_0x48442b[_0xf848('0x41')]['id']}},_0x247057={};_0x247057[_0xf848('0x2b')]=_[_0xf848('0x2d')](db['VoiceChanSpy'][_0xf848('0x42')]);_0x247057['query']=_['keys'](_0x48442b['query']);_0x247057[_0xf848('0x2e')]=_['intersection'](_0x247057[_0xf848('0x2b')],_0x247057[_0xf848('0x2c')]);_0x4756a7[_0xf848('0x30')]=_['intersection'](_0x247057[_0xf848('0x2b')],qs[_0xf848('0x43')](_0x48442b[_0xf848('0x2c')]['fields']));_0x4756a7['attributes']=_0x4756a7[_0xf848('0x30')]['length']?_0x4756a7[_0xf848('0x30')]:_0x247057[_0xf848('0x2b')];if(_0x48442b[_0xf848('0x2c')][_0xf848('0x3c')]){_0x4756a7[_0xf848('0x3d')]=[{'all':!![]}];}_0x4756a7=_[_0xf848('0x39')]({},_0x4756a7,_0x48442b['options']);return db['VoiceChanSpy'][_0xf848('0x44')](_0x4756a7)[_0xf848('0x20')](handleEntityNotFound(_0x2bbac3,null))[_0xf848('0x20')](respondWithResult(_0x2bbac3,null))[_0xf848('0x3f')](handleError(_0x2bbac3,null));};exports['create']=function(_0x282248,_0x1b6576){return db['VoiceChanSpy']['create'](_0x282248[_0xf848('0x45')],{})[_0xf848('0x20')](function(_0x4cad8d){var _0x5a9fc0=_0x282248['user']['get']({'plain':!![]});if(!_0x5a9fc0)throw new Error(_0xf848('0x46'));if(_0x5a9fc0[_0xf848('0x47')]==='user'){var _0x438a1e=_0x4cad8d['get']({'plain':!![]});var _0x4e8c1c=_0xf848('0x48');return db[_0xf848('0x49')][_0xf848('0x44')]({'where':{'name':_0x4e8c1c,'userProfileId':_0x5a9fc0[_0xf848('0x4a')]},'raw':!![]})['then'](function(_0x56015d){if(_0x56015d&&_0x56015d['autoAssociation']===0x0){return db[_0xf848('0x23')][_0xf848('0x4b')]({'name':_0x438a1e[_0xf848('0x26')],'resourceId':_0x438a1e['id'],'type':_0x56015d[_0xf848('0x26')],'sectionId':_0x56015d['id']},{})['then'](function(){return _0x4cad8d;});}else{return _0x4cad8d;}})[_0xf848('0x3f')](function(_0x55420e){logger['error'](_0xf848('0x4c'),_0x55420e);throw _0x55420e;});}return _0x4cad8d;})[_0xf848('0x20')](respondWithResult(_0x1b6576,0xc9))['catch'](handleError(_0x1b6576,null));};exports[_0xf848('0x1f')]=function(_0x595645,_0x4454bb){if(_0x595645[_0xf848('0x45')]['id']){delete _0x595645[_0xf848('0x45')]['id'];}return db[_0xf848('0x29')][_0xf848('0x44')]({'where':{'id':_0x595645[_0xf848('0x41')]['id']}})[_0xf848('0x20')](handleEntityNotFound(_0x4454bb,null))['then'](saveUpdates(_0x595645[_0xf848('0x45')],null))['then'](respondWithResult(_0x4454bb,null))[_0xf848('0x3f')](handleError(_0x4454bb,null));};exports[_0xf848('0x21')]=function(_0x8fd180,_0x32c3d8){return db[_0xf848('0x29')][_0xf848('0x44')]({'where':{'id':_0x8fd180[_0xf848('0x41')]['id']}})['then'](handleEntityNotFound(_0x32c3d8,null))['then'](removeEntity(_0x32c3d8,null))[_0xf848('0x3f')](handleError(_0x32c3d8,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 6aa2689..c7a4003 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 _0x870d=['User','findAll','agent','catch','exports','define','VoiceChanSpy','then','VoiceExtension','bulkCreate','destroy','length','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','merge','Set','format','CDR(type)=%s','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','SIP/%s,%s','options','join','StopMixMonitor','concat','internal','name'];(function(_0x8b4933,_0x2f5685){var _0x421ae8=function(_0x3fce9d){while(--_0x3fce9d){_0x8b4933['push'](_0x8b4933['shift']());}};_0x421ae8(++_0x2f5685);}(_0x870d,0x124));var _0xd870=function(_0x18418b,_0x444565){_0x18418b=_0x18418b-0x0;var _0x3c8c9a=_0x870d[_0x18418b];return _0x3c8c9a;};'use strict';var _=require(_0xd870('0x0'));var util=require(_0xd870('0x1'));var BPromise=require(_0xd870('0x2'));var attributes=require(_0xd870('0x3'));var getUserApplications=function(_0x4909d1,_0x9a6d03,_0x496447){var _0x5602de=0x1;var _0x3a92f4=[];var _0x53bdf0={'context':_0x9a6d03[_0xd870('0x4')]||_0xd870('0x5'),'exten':util['format'](_0xd870('0x6'),_0x4909d1[_0xd870('0x7')],_0x496447),'type':'system','isApp':![],'ChanSpyId':_0x4909d1['id'],'UserId':_0x9a6d03['id']};_0x3a92f4['push'](_[_0xd870('0x8')]({'app':_0xd870('0x9'),'appdata':util[_0xd870('0xa')](_0xd870('0xb'),_0xd870('0xc')),'priority':_0x5602de++},_0x53bdf0));if(_0x4909d1[_0xd870('0xd')]){_0x3a92f4[_0xd870('0xe')](_['merge']({'app':_0xd870('0xf'),'appdata':util[_0xd870('0xa')](_0xd870('0x10'),_0x4909d1[_0xd870('0x11')]),'priority':_0x5602de++},_0x53bdf0));}if(_0x4909d1[_0xd870('0x12')]){_0x3a92f4[_0xd870('0xe')](_[_0xd870('0x8')]({'app':_0xd870('0x13'),'appdata':_0x4909d1[_0xd870('0x14')],'priority':_0x5602de++},_0x53bdf0));}_0x3a92f4[_0xd870('0xe')](_[_0xd870('0x8')]({'app':'ChanSpy','appdata':util['format'](_0xd870('0x15'),_0x9a6d03['name'],_0x4909d1['options']?_0x4909d1[_0xd870('0x16')][_0xd870('0x17')](''):''),'priority':_0x5602de++},_0x53bdf0));if(_0x4909d1[_0xd870('0xd')]){_0x3a92f4[_0xd870('0xe')](_[_0xd870('0x8')]({'app':_0xd870('0x18'),'priority':_0x5602de++},_0x53bdf0));}return _0x3a92f4;};var getChanSpyApplications=function(_0x39e7eb,_0x4846c2){var _0x5b4f78=[];for(var _0x33529d=0x0,_0x3ade8c=0x1;_0x33529d<_0x4846c2['length'];_0x33529d++,_0x3ade8c=0x1){_0x5b4f78=_0x5b4f78[_0xd870('0x19')](getUserApplications(_0x39e7eb,_0x4846c2[_0x33529d],_0x4846c2[_0x33529d][_0xd870('0x1a')]));if(_0x4846c2[_0x33529d][_0xd870('0x1a')]!=_0x4846c2[_0x33529d][_0xd870('0x1b')]){_0x5b4f78=_0x5b4f78[_0xd870('0x19')](getUserApplications(_0x39e7eb,_0x4846c2[_0x33529d],_0x4846c2[_0x33529d][_0xd870('0x1b')]));}}return _0x5b4f78;};var getChanSpyPromise=function(_0x8055bd,_0x2456d9){return new BPromise(function(_0x433fe1,_0x308631){return _0x8055bd[_0xd870('0x1c')][_0xd870('0x1d')]({'attributes':['id',_0xd870('0x1b'),'internal'],'where':{'role':_0xd870('0x1e'),'chanspy':!![]},'raw':!![]})['then'](function(_0x4547c8){if(_0x4547c8){return _0x433fe1(getChanSpyApplications(_0x2456d9,_0x4547c8));}return _0x433fe1([]);})[_0xd870('0x1f')](function(_0x29644f){_0x308631(_0x29644f);});});};module[_0xd870('0x20')]=function(_0x35683a,_0x175fb7){var _0x191e65=_0x35683a['models'];return _0x35683a[_0xd870('0x21')](_0xd870('0x22'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xe8430c,_0x73ab23,_0x1bb29c){return getChanSpyPromise(_0x191e65,_0xe8430c)[_0xd870('0x23')](function(_0x5e0348){if(_0x5e0348&&_0x5e0348['length']){return _0x191e65[_0xd870('0x24')][_0xd870('0x25')](_0x5e0348);}})[_0xd870('0x23')](function(){_0x1bb29c();})['catch'](function(_0x18f04f){_0x1bb29c(_0x18f04f);});},'afterUpdate':function(_0x4d4f22,_0x1ee120,_0x467a8b){return _0x191e65[_0xd870('0x24')][_0xd870('0x26')]({'where':{'ChanSpyId':_0x4d4f22['id']}})[_0xd870('0x23')](function(){return getChanSpyPromise(_0x191e65,_0x4d4f22);})[_0xd870('0x23')](function(_0x444226){if(_0x444226&&_0x444226[_0xd870('0x27')]){return _0x191e65[_0xd870('0x24')][_0xd870('0x25')](_0x444226);}})[_0xd870('0x23')](function(){_0x467a8b();})[_0xd870('0x1f')](function(_0x3b793c){_0x467a8b(_0x3b793c);});},'afterDestroy':function(_0x3d7387,_0x366066,_0xeff0d6){return _0x191e65['VoiceExtension'][_0xd870('0x26')]({'where':{'ChanSpyId':_0x3d7387['id']}})[_0xd870('0x23')](function(){_0xeff0d6();})[_0xd870('0x1f')](function(_0x2bf8f7){_0xeff0d6(_0x2bf8f7);});}}});}; \ No newline at end of file +var _0xd41f=['then','exports','models','define','VoiceChanSpy','voice_chanspy','bulkCreate','catch','VoiceExtension','destroy','util','bluebird','from-sip','%s%s','prefix','system','push','Set','format','CDR(type)=%s','record','recordingFormat','merge','Authenticate','SIP/%s,%s','options','join','StopMixMonitor','length','internal','name','User','findAll'];(function(_0x246227,_0x12bfcb){var _0x37bd4a=function(_0x4670f4){while(--_0x4670f4){_0x246227['push'](_0x246227['shift']());}};_0x37bd4a(++_0x12bfcb);}(_0xd41f,0xf1));var _0xfd41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd41f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xfd41('0x0'));var BPromise=require(_0xfd41('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x2c5bc2,_0x10cd21,_0x13065a){var _0x886d89=0x1;var _0x502ab0=[];var _0x5cde41={'context':_0x10cd21['context']||_0xfd41('0x2'),'exten':util['format'](_0xfd41('0x3'),_0x2c5bc2[_0xfd41('0x4')],_0x13065a),'type':_0xfd41('0x5'),'isApp':![],'ChanSpyId':_0x2c5bc2['id'],'UserId':_0x10cd21['id']};_0x502ab0[_0xfd41('0x6')](_['merge']({'app':_0xfd41('0x7'),'appdata':util[_0xfd41('0x8')](_0xfd41('0x9'),'chanspy'),'priority':_0x886d89++},_0x5cde41));if(_0x2c5bc2[_0xfd41('0xa')]){_0x502ab0[_0xfd41('0x6')](_['merge']({'app':'MixMonitor','appdata':util['format']('${UNIQUEID}.%s,a',_0x2c5bc2[_0xfd41('0xb')]),'priority':_0x886d89++},_0x5cde41));}if(_0x2c5bc2['auth']){_0x502ab0['push'](_[_0xfd41('0xc')]({'app':_0xfd41('0xd'),'appdata':_0x2c5bc2['password'],'priority':_0x886d89++},_0x5cde41));}_0x502ab0[_0xfd41('0x6')](_['merge']({'app':'ChanSpy','appdata':util[_0xfd41('0x8')](_0xfd41('0xe'),_0x10cd21['name'],_0x2c5bc2[_0xfd41('0xf')]?_0x2c5bc2[_0xfd41('0xf')][_0xfd41('0x10')](''):''),'priority':_0x886d89++},_0x5cde41));if(_0x2c5bc2[_0xfd41('0xa')]){_0x502ab0[_0xfd41('0x6')](_[_0xfd41('0xc')]({'app':_0xfd41('0x11'),'priority':_0x886d89++},_0x5cde41));}return _0x502ab0;};var getChanSpyApplications=function(_0x4034bf,_0x17a904){var _0x18a783=[];for(var _0x5b9868=0x0,_0x26bbb8=0x1;_0x5b9868<_0x17a904[_0xfd41('0x12')];_0x5b9868++,_0x26bbb8=0x1){_0x18a783=_0x18a783['concat'](getUserApplications(_0x4034bf,_0x17a904[_0x5b9868],_0x17a904[_0x5b9868][_0xfd41('0x13')]));if(_0x17a904[_0x5b9868][_0xfd41('0x13')]!=_0x17a904[_0x5b9868][_0xfd41('0x14')]){_0x18a783=_0x18a783['concat'](getUserApplications(_0x4034bf,_0x17a904[_0x5b9868],_0x17a904[_0x5b9868][_0xfd41('0x14')]));}}return _0x18a783;};var getChanSpyPromise=function(_0x6c1f4b,_0x2910ad){return new BPromise(function(_0x3401b4,_0x96261e){return _0x6c1f4b[_0xfd41('0x15')][_0xfd41('0x16')]({'attributes':['id','name',_0xfd41('0x13')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xfd41('0x17')](function(_0x3b86a1){if(_0x3b86a1){return _0x3401b4(getChanSpyApplications(_0x2910ad,_0x3b86a1));}return _0x3401b4([]);})['catch'](function(_0xd3f33e){_0x96261e(_0xd3f33e);});});};module[_0xfd41('0x18')]=function(_0x18cd33,_0x595728){var _0x1fae45=_0x18cd33[_0xfd41('0x19')];return _0x18cd33[_0xfd41('0x1a')](_0xfd41('0x1b'),attributes,{'tableName':_0xfd41('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4739c0,_0x2ea394,_0x18ec63){return getChanSpyPromise(_0x1fae45,_0x4739c0)[_0xfd41('0x17')](function(_0x35fa3e){if(_0x35fa3e&&_0x35fa3e['length']){return _0x1fae45['VoiceExtension'][_0xfd41('0x1d')](_0x35fa3e);}})['then'](function(){_0x18ec63();})[_0xfd41('0x1e')](function(_0x238c5f){_0x18ec63(_0x238c5f);});},'afterUpdate':function(_0x50bb3a,_0x494745,_0x39da8a){return _0x1fae45[_0xfd41('0x1f')]['destroy']({'where':{'ChanSpyId':_0x50bb3a['id']}})['then'](function(){return getChanSpyPromise(_0x1fae45,_0x50bb3a);})[_0xfd41('0x17')](function(_0x59c5e3){if(_0x59c5e3&&_0x59c5e3['length']){return _0x1fae45[_0xfd41('0x1f')]['bulkCreate'](_0x59c5e3);}})[_0xfd41('0x17')](function(){_0x39da8a();})['catch'](function(_0x338658){_0x39da8a(_0x338658);});},'afterDestroy':function(_0x366578,_0x50f3c1,_0x211c4e){return _0x1fae45[_0xfd41('0x1f')][_0xfd41('0x20')]({'where':{'ChanSpyId':_0x366578['id']}})[_0xfd41('0x17')](function(){_0x211c4e();})['catch'](function(_0xc8054c){_0x211c4e(_0xc8054c);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index f4c19f8..c9accc1 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 _0x874e=['error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0xf0ec6e,_0xa183d3){var _0x8bbc27=function(_0x39822b){while(--_0x39822b){_0xf0ec6e['push'](_0xf0ec6e['shift']());}};_0x8bbc27(++_0xa183d3);}(_0x874e,0xd5));var _0xe874=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0x874e[_0x4b91c4];return _0x25cb80;};'use strict';var _=require(_0xe874('0x0'));var util=require('util');var moment=require(_0xe874('0x1'));var BPromise=require(_0xe874('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe874('0x3'));var db=require(_0xe874('0x4'))['db'];var utils=require(_0xe874('0x5'));var logger=require(_0xe874('0x6'))(_0xe874('0x7'));var config=require('../../config/environment');var jayson=require(_0xe874('0x8'));var client=jayson['client'][_0xe874('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d4411,_0x3f9559,_0x55e23f){return new BPromise(function(_0xf5a8a8,_0x4c3b92){return client[_0xe874('0xa')](_0x2d4411,_0x55e23f)[_0xe874('0xb')](function(_0x475741){logger[_0xe874('0xc')](_0xe874('0xd'),_0x3f9559,'request\x20sent');logger['debug'](_0xe874('0xe'),_0x3f9559,'request\x20sent',JSON['stringify'](_0x475741));if(_0x475741[_0xe874('0xf')]){if(_0x475741[_0xe874('0xf')]['code']===0x1f4){logger[_0xe874('0xf')](_0xe874('0xd'),_0x3f9559,_0x475741[_0xe874('0xf')][_0xe874('0x10')]);return _0x4c3b92(_0x475741[_0xe874('0xf')][_0xe874('0x10')]);}logger[_0xe874('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x3f9559,_0x475741[_0xe874('0xf')][_0xe874('0x10')]);return _0xf5a8a8(_0x475741[_0xe874('0xf')][_0xe874('0x10')]);}else{logger['info'](_0xe874('0xd'),_0x3f9559,'request\x20sent');_0xf5a8a8(_0x475741[_0xe874('0x11')][_0xe874('0x10')]);}})[_0xe874('0x12')](function(_0x4e81ee){logger['error'](_0xe874('0xd'),_0x3f9559,_0x4e81ee);_0x4c3b92(_0x4e81ee);});});} \ No newline at end of file +var _0x0d6c=['stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x37add7,_0x396960){var _0x41053d=function(_0x242477){while(--_0x242477){_0x37add7['push'](_0x37add7['shift']());}};_0x41053d(++_0x396960);}(_0x0d6c,0xae));var _0xc0d6=function(_0x1bfa59,_0x50b7cf){_0x1bfa59=_0x1bfa59-0x0;var _0x8f9e4b=_0x0d6c[_0x1bfa59];return _0x8f9e4b;};'use strict';var _=require(_0xc0d6('0x0'));var util=require(_0xc0d6('0x1'));var moment=require(_0xc0d6('0x2'));var BPromise=require(_0xc0d6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0d6('0x4'));var db=require(_0xc0d6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc0d6('0x6'));var config=require('../../config/environment');var jayson=require(_0xc0d6('0x7'));var client=jayson[_0xc0d6('0x8')][_0xc0d6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41b084,_0x31dd6d,_0x23c9f2){return new BPromise(function(_0x307359,_0x185354){return client['request'](_0x41b084,_0x23c9f2)[_0xc0d6('0xa')](function(_0x44e6e0){logger[_0xc0d6('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x31dd6d,_0xc0d6('0xc'));logger[_0xc0d6('0xd')](_0xc0d6('0xe'),_0x31dd6d,_0xc0d6('0xc'),JSON[_0xc0d6('0xf')](_0x44e6e0));if(_0x44e6e0[_0xc0d6('0x10')]){if(_0x44e6e0[_0xc0d6('0x10')][_0xc0d6('0x11')]===0x1f4){logger['error'](_0xc0d6('0x12'),_0x31dd6d,_0x44e6e0[_0xc0d6('0x10')][_0xc0d6('0x13')]);return _0x185354(_0x44e6e0[_0xc0d6('0x10')][_0xc0d6('0x13')]);}logger['error'](_0xc0d6('0x12'),_0x31dd6d,_0x44e6e0['error']['message']);return _0x307359(_0x44e6e0[_0xc0d6('0x10')][_0xc0d6('0x13')]);}else{logger[_0xc0d6('0xb')](_0xc0d6('0x12'),_0x31dd6d,_0xc0d6('0xc'));_0x307359(_0x44e6e0[_0xc0d6('0x14')][_0xc0d6('0x13')]);}})['catch'](function(_0x160882){logger[_0xc0d6('0x10')](_0xc0d6('0x12'),_0x31dd6d,_0x160882);_0x185354(_0x160882);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 38e6d77..508c58b 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 _0xdf18=['exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','index','get','/:id','isAuthenticated','show','post','create','update','delete','destroy'];(function(_0x4ce7f3,_0x7ac2d5){var _0x45fdaa=function(_0x2819ae){while(--_0x2819ae){_0x4ce7f3['push'](_0x4ce7f3['shift']());}};_0x45fdaa(++_0x7ac2d5);}(_0xdf18,0x86));var _0x8df1=function(_0x1e52cb,_0x1f9dc4){_0x1e52cb=_0x1e52cb-0x0;var _0x259b73=_0xdf18[_0x1e52cb];return _0x259b73;};'use strict';var multer=require(_0x8df1('0x0'));var util=require(_0x8df1('0x1'));var path=require('path');var timeout=require(_0x8df1('0x2'));var express=require('express');var router=express[_0x8df1('0x3')]();var auth=require(_0x8df1('0x4'));var interaction=require(_0x8df1('0x5'));var config=require(_0x8df1('0x6'));var controller=require(_0x8df1('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x8df1('0x8')]);router[_0x8df1('0x9')](_0x8df1('0xa'),auth[_0x8df1('0xb')](),controller[_0x8df1('0xc')]);router[_0x8df1('0xd')]('/',auth[_0x8df1('0xb')](),controller[_0x8df1('0xe')]);router['put'](_0x8df1('0xa'),auth[_0x8df1('0xb')](),controller[_0x8df1('0xf')]);router[_0x8df1('0x10')](_0x8df1('0xa'),auth['isAuthenticated'](),controller[_0x8df1('0x11')]);module[_0x8df1('0x12')]=router; \ No newline at end of file +var _0x45e0=['../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','Router'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x45e0,0x1a5));var _0x045e=function(_0x3945ac,_0x135de3){_0x3945ac=_0x3945ac-0x0;var _0x198691=_0x45e0[_0x3945ac];return _0x198691;};'use strict';var multer=require(_0x045e('0x0'));var util=require('util');var path=require(_0x045e('0x1'));var timeout=require(_0x045e('0x2'));var express=require('express');var router=express[_0x045e('0x3')]();var auth=require(_0x045e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x045e('0x5'));var controller=require(_0x045e('0x6'));router[_0x045e('0x7')]('/',auth[_0x045e('0x8')](),controller[_0x045e('0x9')]);router[_0x045e('0x7')](_0x045e('0xa'),auth[_0x045e('0x8')](),controller[_0x045e('0xb')]);router[_0x045e('0xc')]('/',auth[_0x045e('0x8')](),controller[_0x045e('0xd')]);router['put'](_0x045e('0xa'),auth['isAuthenticated'](),controller[_0x045e('0xe')]);router[_0x045e('0xf')](_0x045e('0xa'),auth[_0x045e('0x8')](),controller['destroy']);module[_0x045e('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 17ed990..bbb01fe 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(_0x1f51e7,_0x162a39){var _0x2a78dd=function(_0x4ff279){while(--_0x4ff279){_0x1f51e7['push'](_0x1f51e7['shift']());}};_0x2a78dd(++_0x162a39);}(_0x3e74,0x175));var _0x43e7=function(_0x4886d8,_0x182843){_0x4886d8=_0x4886d8-0x0;var _0xeb27b2=_0x3e74[_0x4886d8];return _0xeb27b2;};'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 _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x26921d,_0x105292){var _0x22d33e=function(_0x4d3372){while(--_0x4d3372){_0x26921d['push'](_0x26921d['shift']());}};_0x22d33e(++_0x105292);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'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 94d413d..b11303e 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 _0xe644=['update','destroy','UserProfileResource','end','name','map','VoiceContext','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','show','params','include','find','readFileSync','root','server/files/templates/context.ejs','utf8','render','writeFileSync','Reload','create','chan_sip.so','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','/etc/asterisk/extensions_xcally_contexts.conf','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','client','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','save'];(function(_0x4e713e,_0x1ac682){var _0x296ac0=function(_0x26a297){while(--_0x26a297){_0x4e713e['push'](_0x4e713e['shift']());}};_0x296ac0(++_0x1ac682);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x4e64('0x0'));var emlformat=require(_0x4e64('0x1'));var rimraf=require(_0x4e64('0x2'));var zipdir=require(_0x4e64('0x3'));var jsonpatch=require(_0x4e64('0x4'));var rp=require(_0x4e64('0x5'));var moment=require('moment');var BPromise=require(_0x4e64('0x6'));var Mustache=require(_0x4e64('0x7'));var util=require(_0x4e64('0x8'));var path=require(_0x4e64('0x9'));var sox=require(_0x4e64('0xa'));var csv=require(_0x4e64('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4e64('0xc'));var squel=require(_0x4e64('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4e64('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4e64('0xf'));var Redis=require(_0x4e64('0x10'));var authService=require(_0x4e64('0x11'));var qs=require(_0x4e64('0x12'));var as=require(_0x4e64('0x13'));var hardwareService=require(_0x4e64('0x14'));var logger=require('../../config/logger')(_0x4e64('0x15'));var utils=require(_0x4e64('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4e64('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x4e64('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7d1ad,_0xae8481,_0x9333fa,_0x2aa800){return new BPromise(function(_0x352eca,_0xb36502){var _0x207ed2=_0x2aa800||client;return _0x207ed2['request'](_0x7d1ad,_0x9333fa)[_0x4e64('0x19')](function(_0x5573af){logger[_0x4e64('0x1a')]('VoiceContext,\x20%s,\x20%s',_0xae8481,_0x4e64('0x1b'));logger[_0x4e64('0x1c')](_0x4e64('0x1d'),_0xae8481,_0x4e64('0x1b'),JSON[_0x4e64('0x1e')](_0x5573af));if(_0x5573af[_0x4e64('0x1f')]){if(_0x5573af[_0x4e64('0x1f')][_0x4e64('0x20')]===0x1f4){logger[_0x4e64('0x1f')](_0x4e64('0x21'),_0xae8481,_0x5573af['error'][_0x4e64('0x22')]);return _0xb36502(_0x5573af[_0x4e64('0x1f')]['message']);}logger[_0x4e64('0x1f')]('VoiceContext,\x20%s,\x20%s',_0xae8481,_0x5573af['error'][_0x4e64('0x22')]);return _0x352eca(_0x5573af[_0x4e64('0x1f')][_0x4e64('0x22')]);}else{logger['info'](_0x4e64('0x21'),_0xae8481,'request\x20sent');_0x352eca(_0x5573af[_0x4e64('0x23')][_0x4e64('0x22')]);}})[_0x4e64('0x24')](function(_0x4edbf9){logger[_0x4e64('0x1f')](_0x4e64('0x21'),_0xae8481,_0x4edbf9);_0xb36502(_0x4edbf9);});});}function respondWithStatusCode(_0x2431eb,_0x27d33e){_0x27d33e=_0x27d33e||0xcc;return function(_0x445864){if(_0x445864){return _0x2431eb[_0x4e64('0x25')](_0x27d33e);}return _0x2431eb[_0x4e64('0x26')](_0x27d33e)['end']();};}function respondWithResult(_0x83bebc,_0x29b4f8){_0x29b4f8=_0x29b4f8||0xc8;return function(_0x394a80){if(_0x394a80){return _0x83bebc['status'](_0x29b4f8)[_0x4e64('0x27')](_0x394a80);}};}function respondWithFilteredResult(_0x2f9637,_0x3a39ab){return function(_0x457023){if(_0x457023){var _0x45b458=_0x457023[_0x4e64('0x28')],_0x5f0d42=_0x3a39ab[_0x4e64('0x29')],_0x3185ba=_0x3a39ab[_0x4e64('0x29')]+_0x3a39ab[_0x4e64('0x2a')],_0x2b1f2b;if(_0x3185ba>=_0x45b458){_0x3185ba=_0x45b458;_0x2b1f2b=0xc8;}else{_0x2b1f2b=0xce;}_0x2f9637[_0x4e64('0x26')](_0x2b1f2b);return _0x2f9637[_0x4e64('0x2b')]('Content-Range',_0x5f0d42+'-'+_0x3185ba+'/'+_0x45b458)[_0x4e64('0x27')](_0x457023);}return null;};}function patchUpdates(_0xb17ca7){return function(_0x45ef44){try{jsonpatch[_0x4e64('0x2c')](_0x45ef44,_0xb17ca7,!![]);}catch(_0x3f00d5){return BPromise[_0x4e64('0x2d')](_0x3f00d5);}return _0x45ef44[_0x4e64('0x2e')]();};}function saveUpdates(_0x4c4559,_0x67698d){return function(_0x13c3e2){if(_0x13c3e2){return _0x13c3e2[_0x4e64('0x2f')](_0x4c4559)[_0x4e64('0x19')](function(_0x3d8042){return _0x3d8042;});}return null;};}function removeEntity(_0x3d6cec,_0x366905){return function(_0x5a9a36){if(_0x5a9a36){return _0x5a9a36[_0x4e64('0x30')]()[_0x4e64('0x19')](function(){var _0x1a4523=_0x5a9a36['get']({'plain':!![]});var _0x10f739='Contexts';return db[_0x4e64('0x31')][_0x4e64('0x30')]({'where':{'type':_0x10f739,'resourceId':_0x1a4523['id']}})['then'](function(){return _0x5a9a36;});})['then'](function(){_0x3d6cec['status'](0xcc)[_0x4e64('0x32')]();});}};}function handleEntityNotFound(_0x4caff1,_0x2c2397){return function(_0x22b20d){if(!_0x22b20d){_0x4caff1[_0x4e64('0x25')](0x194);}return _0x22b20d;};}function handleError(_0x18ca6c,_0x33b453){_0x33b453=_0x33b453||0x1f4;return function(_0x1ff3e7){logger[_0x4e64('0x1f')](_0x1ff3e7['stack']);if(_0x1ff3e7[_0x4e64('0x33')]){delete _0x1ff3e7['name'];}_0x18ca6c[_0x4e64('0x26')](_0x33b453)['send'](_0x1ff3e7);};}exports['index']=function(_0x557270,_0x14b80){var _0x5153bb={},_0x5679be={},_0x2975f7={'count':0x0,'rows':[]};var _0x2bb684=_[_0x4e64('0x34')](db[_0x4e64('0x35')][_0x4e64('0x36')],function(_0x19a170){return{'name':_0x19a170[_0x4e64('0x37')],'type':_0x19a170['type']['key']};});_0x5679be['model']=_[_0x4e64('0x34')](_0x2bb684,_0x4e64('0x33'));_0x5679be[_0x4e64('0x38')]=_[_0x4e64('0x39')](_0x557270['query']);_0x5679be[_0x4e64('0x3a')]=_[_0x4e64('0x3b')](_0x5679be[_0x4e64('0x3c')],_0x5679be[_0x4e64('0x38')]);_0x5153bb[_0x4e64('0x3d')]=_['intersection'](_0x5679be['model'],qs[_0x4e64('0x3e')](_0x557270['query'][_0x4e64('0x3e')]));_0x5153bb[_0x4e64('0x3d')]=_0x5153bb[_0x4e64('0x3d')][_0x4e64('0x3f')]?_0x5153bb[_0x4e64('0x3d')]:_0x5679be[_0x4e64('0x3c')];if(!_0x557270[_0x4e64('0x38')]['hasOwnProperty'](_0x4e64('0x40'))){_0x5153bb[_0x4e64('0x2a')]=qs[_0x4e64('0x2a')](_0x557270[_0x4e64('0x38')][_0x4e64('0x2a')]);_0x5153bb[_0x4e64('0x29')]=qs[_0x4e64('0x29')](_0x557270[_0x4e64('0x38')]['offset']);}_0x5153bb[_0x4e64('0x41')]=qs[_0x4e64('0x42')](_0x557270['query'][_0x4e64('0x42')]);_0x5153bb[_0x4e64('0x43')]=qs['filters'](_[_0x4e64('0x44')](_0x557270[_0x4e64('0x38')],_0x5679be[_0x4e64('0x3a')]),_0x2bb684);if(_0x557270[_0x4e64('0x38')][_0x4e64('0x45')]){_0x5153bb['where']=_[_0x4e64('0x46')](_0x5153bb[_0x4e64('0x43')],{'$or':_[_0x4e64('0x34')](_0x2bb684,function(_0x13307a){if(_0x13307a[_0x4e64('0x47')]!==_0x4e64('0x48')){var _0x39a713={};_0x39a713[_0x13307a[_0x4e64('0x33')]]={'$like':'%'+_0x557270['query']['filter']+'%'};return _0x39a713;}})});}_0x5153bb=_[_0x4e64('0x46')]({},_0x5153bb,_0x557270[_0x4e64('0x49')]);var _0x3cf687={'where':_0x5153bb['where']};return db[_0x4e64('0x35')][_0x4e64('0x28')](_0x3cf687)[_0x4e64('0x19')](function(_0x19a71b){_0x2975f7[_0x4e64('0x28')]=_0x19a71b;if(_0x557270['query'][_0x4e64('0x4a')]){_0x5153bb['include']=[{'all':!![]}];}return db[_0x4e64('0x35')][_0x4e64('0x4b')](_0x5153bb);})[_0x4e64('0x19')](function(_0x2ec4d8){_0x2975f7['rows']=_0x2ec4d8;return _0x2975f7;})[_0x4e64('0x19')](respondWithFilteredResult(_0x14b80,_0x5153bb))[_0x4e64('0x24')](handleError(_0x14b80,null));};exports[_0x4e64('0x4c')]=function(_0x38a885,_0x32db0b){var _0x5ecece={'raw':![],'where':{'id':_0x38a885[_0x4e64('0x4d')]['id']}},_0x26bbbe={};_0x26bbbe[_0x4e64('0x3c')]=_[_0x4e64('0x39')](db[_0x4e64('0x35')][_0x4e64('0x36')]);_0x26bbbe['query']=_[_0x4e64('0x39')](_0x38a885[_0x4e64('0x38')]);_0x26bbbe[_0x4e64('0x3a')]=_['intersection'](_0x26bbbe[_0x4e64('0x3c')],_0x26bbbe[_0x4e64('0x38')]);_0x5ecece['attributes']=_[_0x4e64('0x3b')](_0x26bbbe['model'],qs[_0x4e64('0x3e')](_0x38a885['query'][_0x4e64('0x3e')]));_0x5ecece['attributes']=_0x5ecece[_0x4e64('0x3d')][_0x4e64('0x3f')]?_0x5ecece[_0x4e64('0x3d')]:_0x26bbbe[_0x4e64('0x3c')];if(_0x38a885[_0x4e64('0x38')][_0x4e64('0x4a')]){_0x5ecece[_0x4e64('0x4e')]=[{'all':!![]}];}_0x5ecece=_['merge']({},_0x5ecece,_0x38a885[_0x4e64('0x49')]);return db[_0x4e64('0x35')][_0x4e64('0x4f')](_0x5ecece)['then'](handleEntityNotFound(_0x32db0b,null))['then'](respondWithResult(_0x32db0b,null))[_0x4e64('0x24')](handleError(_0x32db0b,null));};exports['create']=function(_0x198346,_0x1530e5,_0xb88807){var _0x42686e;return db[_0x4e64('0x35')]['create'](_0x198346['body'],{'raw':!![]})[_0x4e64('0x19')](function(_0x14fb9c){_0x42686e=_0x14fb9c;return db[_0x4e64('0x35')][_0x4e64('0x4b')]({'raw':!![]});})[_0x4e64('0x19')](function(_0x1cca5e){var _0x45398b=fs[_0x4e64('0x50')](path['join'](config[_0x4e64('0x51')],_0x4e64('0x52')),_0x4e64('0x53'));var _0x49da0c=ejs[_0x4e64('0x54')](_0x45398b,{'contexts':_0x1cca5e||[]});fs[_0x4e64('0x55')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x49da0c);})[_0x4e64('0x19')](function(){return respondWithRpcPromise(_0x4e64('0x56'),_0x4e64('0x57'),{'module':_0x4e64('0x58')});})[_0x4e64('0x19')](function(){var _0x10d2ac=_0x198346['user'][_0x4e64('0x59')]({'plain':!![]});if(!_0x10d2ac)throw new Error(_0x4e64('0x5a'));if(_0x10d2ac[_0x4e64('0x5b')]==='user'){var _0x23d9be=_0x42686e[_0x4e64('0x59')]({'plain':!![]});return db[_0x4e64('0x5c')][_0x4e64('0x4f')]({'where':{'name':'Contexts','userProfileId':_0x10d2ac[_0x4e64('0x5d')]},'raw':!![]})[_0x4e64('0x19')](function(_0x57b9bf){if(_0x57b9bf&&_0x57b9bf[_0x4e64('0x5e')]===0x0){return db[_0x4e64('0x31')][_0x4e64('0x57')]({'name':_0x23d9be[_0x4e64('0x33')],'resourceId':_0x23d9be['id'],'type':_0x57b9bf[_0x4e64('0x33')],'sectionId':_0x57b9bf['id']},{})[_0x4e64('0x19')](function(){return _0x42686e;});}else{return _0x42686e;}})[_0x4e64('0x24')](function(_0x40873c){logger['error'](_0x4e64('0x5f'),_0x40873c);throw _0x40873c;});}return _0x42686e;})[_0x4e64('0x19')](respondWithResult(_0x1530e5,0xc9))['catch'](handleError(_0x1530e5,null));};exports[_0x4e64('0x2f')]=function(_0x20f6c5,_0x3c78c8,_0x178ffb){var _0x1497c6;return db['VoiceContext'][_0x4e64('0x4f')]({'where':{'id':_0x20f6c5[_0x4e64('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3c78c8,null))[_0x4e64('0x19')](saveUpdates(_0x20f6c5[_0x4e64('0x60')],null))[_0x4e64('0x19')](function(_0x44c368){if(_0x44c368){_0x1497c6=_0x44c368;return db[_0x4e64('0x35')][_0x4e64('0x4b')]({'raw':!![]});}})['then'](function(_0x1ea82b){var _0x291fe8=fs[_0x4e64('0x50')](path['join'](config[_0x4e64('0x51')],_0x4e64('0x52')),_0x4e64('0x53'));var _0x5ed23f=ejs[_0x4e64('0x54')](_0x291fe8,{'contexts':_0x1ea82b||[]});fs[_0x4e64('0x55')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x5ed23f);})['then'](function(){return respondWithRpcPromise('Reload',_0x4e64('0x2f'),{'module':_0x4e64('0x58')});})[_0x4e64('0x19')](function(){return _0x1497c6;})[_0x4e64('0x19')](respondWithResult(_0x3c78c8,null))[_0x4e64('0x24')](handleError(_0x3c78c8,null));};exports[_0x4e64('0x30')]=function(_0x12e1dd,_0xc950f9,_0x42da25){var _0x4669a5;return db[_0x4e64('0x35')][_0x4e64('0x4f')]({'where':{'id':_0x12e1dd[_0x4e64('0x4d')]['id']}})[_0x4e64('0x19')](handleEntityNotFound(_0xc950f9,null))['then'](removeEntity(_0xc950f9,null))['then'](function(){return db[_0x4e64('0x35')][_0x4e64('0x4b')]({'raw':!![]});})[_0x4e64('0x19')](function(_0x123d2e){var _0x9377d5=fs[_0x4e64('0x50')](path['join'](config[_0x4e64('0x51')],_0x4e64('0x52')),_0x4e64('0x53'));var _0x1cd639=ejs['render'](_0x9377d5,{'contexts':_0x123d2e});fs['writeFileSync'](_0x4e64('0x61'),_0x1cd639);return respondWithRpcPromise(_0x4e64('0x56'),_0x4e64('0x30'),{'module':'chan_sip.so'});})[_0x4e64('0x24')](handleError(_0xc950f9,null));}; \ No newline at end of file +var _0xc02d=['utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','VoiceContext,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','sendStatus','end','status','count','offset','set','json','reject','save','then','destroy','get','Contexts','UserProfileResource','name','index','map','VoiceContext','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','length','include','catch','create','body','readFileSync','join','root','server/files/templates/context.ejs'];(function(_0x1a78f0,_0x398b53){var _0x3704e5=function(_0x210c13){while(--_0x210c13){_0x1a78f0['push'](_0x1a78f0['shift']());}};_0x3704e5(++_0x398b53);}(_0xc02d,0x1aa));var _0xdc02=function(_0x232715,_0x4bd63e){_0x232715=_0x232715-0x0;var _0x1e6090=_0xc02d[_0x232715];return _0x1e6090;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdc02('0x0'));var rimraf=require(_0xdc02('0x1'));var zipdir=require(_0xdc02('0x2'));var jsonpatch=require(_0xdc02('0x3'));var rp=require(_0xdc02('0x4'));var moment=require(_0xdc02('0x5'));var BPromise=require(_0xdc02('0x6'));var Mustache=require(_0xdc02('0x7'));var util=require(_0xdc02('0x8'));var path=require(_0xdc02('0x9'));var sox=require(_0xdc02('0xa'));var csv=require('to-csv');var ejs=require(_0xdc02('0xb'));var fs=require('fs');var _=require(_0xdc02('0xc'));var squel=require(_0xdc02('0xd'));var crypto=require(_0xdc02('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdc02('0xf'));var querystring=require(_0xdc02('0x10'));var Papa=require(_0xdc02('0x11'));var Redis=require('ioredis');var authService=require(_0xdc02('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdc02('0x13'));var hardwareService=require(_0xdc02('0x14'));var logger=require(_0xdc02('0x15'))(_0xdc02('0x16'));var utils=require('../../config/utils');var config=require(_0xdc02('0x17'));var licenseUtil=require(_0xdc02('0x18'));var db=require(_0xdc02('0x19'))['db'];var jayson=require(_0xdc02('0x1a'));var client=jayson['client'][_0xdc02('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x10ad0c,_0x1ecbfd,_0x5221da,_0x13d588){return new BPromise(function(_0x5a3246,_0x28837f){var _0x3ed657=_0x13d588||client;return _0x3ed657[_0xdc02('0x1c')](_0x10ad0c,_0x5221da)['then'](function(_0x32610d){logger[_0xdc02('0x1d')](_0xdc02('0x1e'),_0x1ecbfd,'request\x20sent');logger[_0xdc02('0x1f')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x1ecbfd,_0xdc02('0x20'),JSON[_0xdc02('0x21')](_0x32610d));if(_0x32610d[_0xdc02('0x22')]){if(_0x32610d[_0xdc02('0x22')]['code']===0x1f4){logger['error'](_0xdc02('0x1e'),_0x1ecbfd,_0x32610d[_0xdc02('0x22')][_0xdc02('0x23')]);return _0x28837f(_0x32610d[_0xdc02('0x22')][_0xdc02('0x23')]);}logger[_0xdc02('0x22')](_0xdc02('0x1e'),_0x1ecbfd,_0x32610d[_0xdc02('0x22')][_0xdc02('0x23')]);return _0x5a3246(_0x32610d[_0xdc02('0x22')][_0xdc02('0x23')]);}else{logger[_0xdc02('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x1ecbfd,_0xdc02('0x20'));_0x5a3246(_0x32610d[_0xdc02('0x24')][_0xdc02('0x23')]);}})['catch'](function(_0xc73504){logger[_0xdc02('0x22')](_0xdc02('0x1e'),_0x1ecbfd,_0xc73504);_0x28837f(_0xc73504);});});}function respondWithStatusCode(_0x18fd10,_0x4017d4){_0x4017d4=_0x4017d4||0xcc;return function(_0x3f708b){if(_0x3f708b){return _0x18fd10[_0xdc02('0x25')](_0x4017d4);}return _0x18fd10['status'](_0x4017d4)[_0xdc02('0x26')]();};}function respondWithResult(_0x3a0820,_0x11b57c){_0x11b57c=_0x11b57c||0xc8;return function(_0x430ef4){if(_0x430ef4){return _0x3a0820[_0xdc02('0x27')](_0x11b57c)['json'](_0x430ef4);}};}function respondWithFilteredResult(_0x2d236a,_0x3c6529){return function(_0x54ecd7){if(_0x54ecd7){var _0x2ebcb2=_0x54ecd7[_0xdc02('0x28')],_0xa7c8b1=_0x3c6529[_0xdc02('0x29')],_0x4ff852=_0x3c6529['offset']+_0x3c6529['limit'],_0x4492f8;if(_0x4ff852>=_0x2ebcb2){_0x4ff852=_0x2ebcb2;_0x4492f8=0xc8;}else{_0x4492f8=0xce;}_0x2d236a[_0xdc02('0x27')](_0x4492f8);return _0x2d236a[_0xdc02('0x2a')]('Content-Range',_0xa7c8b1+'-'+_0x4ff852+'/'+_0x2ebcb2)[_0xdc02('0x2b')](_0x54ecd7);}return null;};}function patchUpdates(_0xe81e3f){return function(_0x1c6111){try{jsonpatch['apply'](_0x1c6111,_0xe81e3f,!![]);}catch(_0x46394a){return BPromise[_0xdc02('0x2c')](_0x46394a);}return _0x1c6111[_0xdc02('0x2d')]();};}function saveUpdates(_0x1a1332,_0x10493e){return function(_0x970fdf){if(_0x970fdf){return _0x970fdf['update'](_0x1a1332)[_0xdc02('0x2e')](function(_0x41d3e6){return _0x41d3e6;});}return null;};}function removeEntity(_0xdccef3,_0x4f3731){return function(_0x4a05f5){if(_0x4a05f5){return _0x4a05f5[_0xdc02('0x2f')]()[_0xdc02('0x2e')](function(){var _0x81f000=_0x4a05f5[_0xdc02('0x30')]({'plain':!![]});var _0x726fa8=_0xdc02('0x31');return db[_0xdc02('0x32')][_0xdc02('0x2f')]({'where':{'type':_0x726fa8,'resourceId':_0x81f000['id']}})[_0xdc02('0x2e')](function(){return _0x4a05f5;});})[_0xdc02('0x2e')](function(){_0xdccef3[_0xdc02('0x27')](0xcc)[_0xdc02('0x26')]();});}};}function handleEntityNotFound(_0x16c531,_0x5dcaf6){return function(_0x3a9615){if(!_0x3a9615){_0x16c531[_0xdc02('0x25')](0x194);}return _0x3a9615;};}function handleError(_0x43c44c,_0x3ceaa6){_0x3ceaa6=_0x3ceaa6||0x1f4;return function(_0x2bc0bb){logger[_0xdc02('0x22')](_0x2bc0bb['stack']);if(_0x2bc0bb['name']){delete _0x2bc0bb[_0xdc02('0x33')];}_0x43c44c['status'](_0x3ceaa6)['send'](_0x2bc0bb);};}exports[_0xdc02('0x34')]=function(_0x5cca93,_0x3367b1){var _0x5ec0b7={},_0x31603a={},_0x4c3433={'count':0x0,'rows':[]};var _0x3e20f1=_[_0xdc02('0x35')](db[_0xdc02('0x36')][_0xdc02('0x37')],function(_0xa156a6){return{'name':_0xa156a6['fieldName'],'type':_0xa156a6[_0xdc02('0x38')][_0xdc02('0x39')]};});_0x31603a[_0xdc02('0x3a')]=_[_0xdc02('0x35')](_0x3e20f1,_0xdc02('0x33'));_0x31603a[_0xdc02('0x3b')]=_[_0xdc02('0x3c')](_0x5cca93['query']);_0x31603a[_0xdc02('0x3d')]=_[_0xdc02('0x3e')](_0x31603a[_0xdc02('0x3a')],_0x31603a[_0xdc02('0x3b')]);_0x5ec0b7[_0xdc02('0x3f')]=_[_0xdc02('0x3e')](_0x31603a[_0xdc02('0x3a')],qs[_0xdc02('0x40')](_0x5cca93[_0xdc02('0x3b')][_0xdc02('0x40')]));_0x5ec0b7['attributes']=_0x5ec0b7[_0xdc02('0x3f')]['length']?_0x5ec0b7[_0xdc02('0x3f')]:_0x31603a['model'];if(!_0x5cca93['query'][_0xdc02('0x41')](_0xdc02('0x42'))){_0x5ec0b7[_0xdc02('0x43')]=qs[_0xdc02('0x43')](_0x5cca93['query']['limit']);_0x5ec0b7[_0xdc02('0x29')]=qs[_0xdc02('0x29')](_0x5cca93[_0xdc02('0x3b')]['offset']);}_0x5ec0b7[_0xdc02('0x44')]=qs[_0xdc02('0x45')](_0x5cca93[_0xdc02('0x3b')][_0xdc02('0x45')]);_0x5ec0b7[_0xdc02('0x46')]=qs[_0xdc02('0x3d')](_[_0xdc02('0x47')](_0x5cca93[_0xdc02('0x3b')],_0x31603a[_0xdc02('0x3d')]),_0x3e20f1);if(_0x5cca93['query'][_0xdc02('0x48')]){_0x5ec0b7['where']=_[_0xdc02('0x49')](_0x5ec0b7[_0xdc02('0x46')],{'$or':_[_0xdc02('0x35')](_0x3e20f1,function(_0x18ee12){if(_0x18ee12['type']!==_0xdc02('0x4a')){var _0x33e014={};_0x33e014[_0x18ee12[_0xdc02('0x33')]]={'$like':'%'+_0x5cca93[_0xdc02('0x3b')][_0xdc02('0x48')]+'%'};return _0x33e014;}})});}_0x5ec0b7=_['merge']({},_0x5ec0b7,_0x5cca93['options']);var _0x44be60={'where':_0x5ec0b7[_0xdc02('0x46')]};return db[_0xdc02('0x36')][_0xdc02('0x28')](_0x44be60)[_0xdc02('0x2e')](function(_0x550d27){_0x4c3433[_0xdc02('0x28')]=_0x550d27;if(_0x5cca93[_0xdc02('0x3b')][_0xdc02('0x4b')]){_0x5ec0b7['include']=[{'all':!![]}];}return db[_0xdc02('0x36')][_0xdc02('0x4c')](_0x5ec0b7);})[_0xdc02('0x2e')](function(_0x282fc3){_0x4c3433[_0xdc02('0x4d')]=_0x282fc3;return _0x4c3433;})['then'](respondWithFilteredResult(_0x3367b1,_0x5ec0b7))['catch'](handleError(_0x3367b1,null));};exports[_0xdc02('0x4e')]=function(_0x1f00ed,_0x278a9e){var _0x2ad078={'raw':![],'where':{'id':_0x1f00ed[_0xdc02('0x4f')]['id']}},_0x3250e8={};_0x3250e8[_0xdc02('0x3a')]=_['keys'](db[_0xdc02('0x36')][_0xdc02('0x37')]);_0x3250e8[_0xdc02('0x3b')]=_[_0xdc02('0x3c')](_0x1f00ed['query']);_0x3250e8[_0xdc02('0x3d')]=_[_0xdc02('0x3e')](_0x3250e8['model'],_0x3250e8['query']);_0x2ad078[_0xdc02('0x3f')]=_[_0xdc02('0x3e')](_0x3250e8[_0xdc02('0x3a')],qs['fields'](_0x1f00ed[_0xdc02('0x3b')][_0xdc02('0x40')]));_0x2ad078['attributes']=_0x2ad078[_0xdc02('0x3f')][_0xdc02('0x50')]?_0x2ad078[_0xdc02('0x3f')]:_0x3250e8[_0xdc02('0x3a')];if(_0x1f00ed[_0xdc02('0x3b')][_0xdc02('0x4b')]){_0x2ad078[_0xdc02('0x51')]=[{'all':!![]}];}_0x2ad078=_['merge']({},_0x2ad078,_0x1f00ed['options']);return db[_0xdc02('0x36')]['find'](_0x2ad078)[_0xdc02('0x2e')](handleEntityNotFound(_0x278a9e,null))[_0xdc02('0x2e')](respondWithResult(_0x278a9e,null))[_0xdc02('0x52')](handleError(_0x278a9e,null));};exports[_0xdc02('0x53')]=function(_0x2af786,_0x513f51,_0x580412){var _0x23ce3d;return db['VoiceContext'][_0xdc02('0x53')](_0x2af786[_0xdc02('0x54')],{'raw':!![]})['then'](function(_0x39eaea){_0x23ce3d=_0x39eaea;return db['VoiceContext'][_0xdc02('0x4c')]({'raw':!![]});})[_0xdc02('0x2e')](function(_0x2b7fff){var _0x3b4ec9=fs[_0xdc02('0x55')](path[_0xdc02('0x56')](config[_0xdc02('0x57')],_0xdc02('0x58')),_0xdc02('0x59'));var _0x44204b=ejs[_0xdc02('0x5a')](_0x3b4ec9,{'contexts':_0x2b7fff||[]});fs[_0xdc02('0x5b')](_0xdc02('0x5c'),_0x44204b);})['then'](function(){return respondWithRpcPromise(_0xdc02('0x5d'),_0xdc02('0x53'),{'module':_0xdc02('0x5e')});})[_0xdc02('0x2e')](function(){var _0x5dd7e3=_0x2af786[_0xdc02('0x5f')][_0xdc02('0x30')]({'plain':!![]});if(!_0x5dd7e3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5dd7e3[_0xdc02('0x60')]==='user'){var _0x17b020=_0x23ce3d[_0xdc02('0x30')]({'plain':!![]});return db[_0xdc02('0x61')][_0xdc02('0x62')]({'where':{'name':_0xdc02('0x31'),'userProfileId':_0x5dd7e3[_0xdc02('0x63')]},'raw':!![]})[_0xdc02('0x2e')](function(_0x2e8e1d){if(_0x2e8e1d&&_0x2e8e1d[_0xdc02('0x64')]===0x0){return db['UserProfileResource'][_0xdc02('0x53')]({'name':_0x17b020[_0xdc02('0x33')],'resourceId':_0x17b020['id'],'type':_0x2e8e1d[_0xdc02('0x33')],'sectionId':_0x2e8e1d['id']},{})[_0xdc02('0x2e')](function(){return _0x23ce3d;});}else{return _0x23ce3d;}})[_0xdc02('0x52')](function(_0xab64a9){logger['error'](_0xdc02('0x65'),_0xab64a9);throw _0xab64a9;});}return _0x23ce3d;})[_0xdc02('0x2e')](respondWithResult(_0x513f51,0xc9))[_0xdc02('0x52')](handleError(_0x513f51,null));};exports['update']=function(_0x45e42a,_0xe088a7,_0x26ee1f){var _0x1824af;return db[_0xdc02('0x36')][_0xdc02('0x62')]({'where':{'id':_0x45e42a[_0xdc02('0x4f')]['id']}})['then'](handleEntityNotFound(_0xe088a7,null))['then'](saveUpdates(_0x45e42a[_0xdc02('0x54')],null))[_0xdc02('0x2e')](function(_0x29239d){if(_0x29239d){_0x1824af=_0x29239d;return db['VoiceContext'][_0xdc02('0x4c')]({'raw':!![]});}})[_0xdc02('0x2e')](function(_0x1d3e9e){var _0x2b9bf6=fs['readFileSync'](path[_0xdc02('0x56')](config[_0xdc02('0x57')],_0xdc02('0x58')),'utf8');var _0x15e89d=ejs[_0xdc02('0x5a')](_0x2b9bf6,{'contexts':_0x1d3e9e||[]});fs[_0xdc02('0x5b')](_0xdc02('0x5c'),_0x15e89d);})[_0xdc02('0x2e')](function(){return respondWithRpcPromise(_0xdc02('0x5d'),_0xdc02('0x66'),{'module':_0xdc02('0x5e')});})[_0xdc02('0x2e')](function(){return _0x1824af;})['then'](respondWithResult(_0xe088a7,null))[_0xdc02('0x52')](handleError(_0xe088a7,null));};exports[_0xdc02('0x2f')]=function(_0x53e04a,_0x24fe6f,_0x414671){var _0x6f007d;return db[_0xdc02('0x36')]['find']({'where':{'id':_0x53e04a['params']['id']}})[_0xdc02('0x2e')](handleEntityNotFound(_0x24fe6f,null))['then'](removeEntity(_0x24fe6f,null))['then'](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0xdc02('0x2e')](function(_0x4a1ce3){var _0x2369e9=fs[_0xdc02('0x55')](path[_0xdc02('0x56')](config[_0xdc02('0x57')],'server/files/templates/context.ejs'),_0xdc02('0x59'));var _0x187097=ejs[_0xdc02('0x5a')](_0x2369e9,{'contexts':_0x4a1ce3});fs[_0xdc02('0x5b')](_0xdc02('0x5c'),_0x187097);return respondWithRpcPromise(_0xdc02('0x5d'),'destroy',{'module':_0xdc02('0x5e')});})[_0xdc02('0x52')](handleError(_0x24fe6f,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index e71d203..fbd8c67 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 _0xc1cc=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','api'];(function(_0x1a2b3d,_0x18d67f){var _0x1eff3f=function(_0x20e5e4){while(--_0x20e5e4){_0x1a2b3d['push'](_0x1a2b3d['shift']());}};_0x1eff3f(++_0x18d67f);}(_0xc1cc,0x176));var _0xcc1c=function(_0x5f0573,_0x1368cc){_0x5f0573=_0x5f0573-0x0;var _0x505466=_0xc1cc[_0x5f0573];return _0x505466;};'use strict';var _=require(_0xcc1c('0x0'));var util=require(_0xcc1c('0x1'));var logger=require('../../config/logger')(_0xcc1c('0x2'));var moment=require(_0xcc1c('0x3'));var BPromise=require(_0xcc1c('0x4'));var rp=require(_0xcc1c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc1c('0x6'));var config=require(_0xcc1c('0x7'));var attributes=require(_0xcc1c('0x8'));module[_0xcc1c('0x9')]=function(_0x27c357,_0x34b1c4){return _0x27c357[_0xcc1c('0xa')](_0xcc1c('0xb'),attributes,{'tableName':_0xcc1c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3203=['path','rimraf','../../config/environment','./voiceContext.attributes','define','VoiceContext','lodash','util','moment'];(function(_0x102f97,_0x5bda2f){var _0xd22058=function(_0x2ccc1f){while(--_0x2ccc1f){_0x102f97['push'](_0x102f97['shift']());}};_0xd22058(++_0x5bda2f);}(_0x3203,0xc3));var _0x3320=function(_0x2786ea,_0x16c3c3){_0x2786ea=_0x2786ea-0x0;var _0x5c38e5=_0x3203[_0x2786ea];return _0x5c38e5;};'use strict';var _=require(_0x3320('0x0'));var util=require(_0x3320('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3320('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3320('0x3'));var rimraf=require(_0x3320('0x4'));var config=require(_0x3320('0x5'));var attributes=require(_0x3320('0x6'));module['exports']=function(_0x17309e,_0x457306){return _0x17309e[_0x3320('0x7')](_0x3320('0x8'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 0962711..50ca3ac 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 _0x5492=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xef3ae2,_0x4c63b8){var _0x1cc22b=function(_0x4de2da){while(--_0x4de2da){_0xef3ae2['push'](_0xef3ae2['shift']());}};_0x1cc22b(++_0x4c63b8);}(_0x5492,0xf8));var _0x2549=function(_0x216311,_0x5c9e50){_0x216311=_0x216311-0x0;var _0x157847=_0x5492[_0x216311];return _0x157847;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2549('0x0'));var BPromise=require(_0x2549('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2549('0x2'));var db=require(_0x2549('0x3'))['db'];var utils=require(_0x2549('0x4'));var logger=require(_0x2549('0x5'))(_0x2549('0x6'));var config=require(_0x2549('0x7'));var jayson=require(_0x2549('0x8'));var client=jayson[_0x2549('0x9')][_0x2549('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x323b09,_0x1e4372,_0x37e2f2){return new BPromise(function(_0x27893e,_0x19a3e0){return client[_0x2549('0xb')](_0x323b09,_0x37e2f2)[_0x2549('0xc')](function(_0x41bae7){logger[_0x2549('0xd')](_0x2549('0xe'),_0x1e4372,_0x2549('0xf'));logger[_0x2549('0x10')](_0x2549('0x11'),_0x1e4372,_0x2549('0xf'),JSON[_0x2549('0x12')](_0x41bae7));if(_0x41bae7['error']){if(_0x41bae7[_0x2549('0x13')]['code']===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x1e4372,_0x41bae7['error'][_0x2549('0x14')]);return _0x19a3e0(_0x41bae7[_0x2549('0x13')][_0x2549('0x14')]);}logger[_0x2549('0x13')](_0x2549('0xe'),_0x1e4372,_0x41bae7[_0x2549('0x13')][_0x2549('0x14')]);return _0x27893e(_0x41bae7['error'][_0x2549('0x14')]);}else{logger['info'](_0x2549('0xe'),_0x1e4372,_0x2549('0xf'));_0x27893e(_0x41bae7[_0x2549('0x15')]['message']);}})[_0x2549('0x16')](function(_0x5b0532){logger[_0x2549('0x13')](_0x2549('0xe'),_0x1e4372,_0x5b0532);_0x19a3e0(_0x5b0532);});});} \ No newline at end of file +var _0x2698=['info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','VoiceContext,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x3dd991,_0x4bef12){var _0x251609=function(_0x371481){while(--_0x371481){_0x3dd991['push'](_0x3dd991['shift']());}};_0x251609(++_0x4bef12);}(_0x2698,0x185));var _0x8269=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2698[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8269('0x0'));var util=require(_0x8269('0x1'));var moment=require(_0x8269('0x2'));var BPromise=require('bluebird');var rs=require(_0x8269('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8269('0x4'))(_0x8269('0x5'));var config=require('../../config/environment');var jayson=require(_0x8269('0x6'));var client=jayson[_0x8269('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24ec82,_0x3819d2,_0x15e133){return new BPromise(function(_0x548c08,_0x3c1cf4){return client[_0x8269('0x8')](_0x24ec82,_0x15e133)[_0x8269('0x9')](function(_0x330006){logger[_0x8269('0xa')]('VoiceContext,\x20%s,\x20%s',_0x3819d2,_0x8269('0xb'));logger[_0x8269('0xc')](_0x8269('0xd'),_0x3819d2,_0x8269('0xb'),JSON['stringify'](_0x330006));if(_0x330006[_0x8269('0xe')]){if(_0x330006[_0x8269('0xe')][_0x8269('0xf')]===0x1f4){logger['error'](_0x8269('0x10'),_0x3819d2,_0x330006[_0x8269('0xe')]['message']);return _0x3c1cf4(_0x330006['error'][_0x8269('0x11')]);}logger[_0x8269('0xe')](_0x8269('0x10'),_0x3819d2,_0x330006[_0x8269('0xe')]['message']);return _0x548c08(_0x330006['error']['message']);}else{logger['info'](_0x8269('0x10'),_0x3819d2,_0x8269('0xb'));_0x548c08(_0x330006['result'][_0x8269('0x11')]);}})[_0x8269('0x12')](function(_0x3ed8f8){logger['error'](_0x8269('0x10'),_0x3819d2,_0x3ed8f8);_0x3c1cf4(_0x3ed8f8);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 4779004..61f84ff 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 _0xa9f6=['put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0xc55d35,_0x43fefa){var _0x2da626=function(_0x582286){while(--_0x582286){_0xc55d35['push'](_0xc55d35['shift']());}};_0x2da626(++_0x43fefa);}(_0xa9f6,0x10c));var _0x6a9f=function(_0x2da2c1,_0x3ca856){_0x2da2c1=_0x2da2c1-0x0;var _0x1a0248=_0xa9f6[_0x2da2c1];return _0x1a0248;};'use strict';var multer=require(_0x6a9f('0x0'));var util=require('util');var path=require(_0x6a9f('0x1'));var timeout=require(_0x6a9f('0x2'));var express=require(_0x6a9f('0x3'));var router=express[_0x6a9f('0x4')]();var auth=require(_0x6a9f('0x5'));var interaction=require(_0x6a9f('0x6'));var config=require(_0x6a9f('0x7'));var controller=require(_0x6a9f('0x8'));router[_0x6a9f('0x9')]('/',auth[_0x6a9f('0xa')](),controller[_0x6a9f('0xb')]);router[_0x6a9f('0x9')](_0x6a9f('0xc'),auth[_0x6a9f('0xa')](),controller[_0x6a9f('0xd')]);router[_0x6a9f('0x9')](_0x6a9f('0xe'),auth[_0x6a9f('0xa')](),controller[_0x6a9f('0xf')]);router[_0x6a9f('0x10')]('/',auth[_0x6a9f('0xa')](),controller[_0x6a9f('0x11')]);router[_0x6a9f('0x12')](_0x6a9f('0xe'),auth[_0x6a9f('0xa')](),controller[_0x6a9f('0x13')]);router['delete'](_0x6a9f('0xe'),auth['isAuthenticated'](),controller[_0x6a9f('0x14')]);module[_0x6a9f('0x15')]=router; \ No newline at end of file +var _0x67ce=['express','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/:id','post','create','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67ce,0x1a1));var _0xe67c=function(_0x12fb57,_0x3c0c17){_0x12fb57=_0x12fb57-0x0;var _0x41c057=_0x67ce[_0x12fb57];return _0x41c057;};'use strict';var multer=require(_0xe67c('0x0'));var util=require(_0xe67c('0x1'));var path=require('path');var timeout=require(_0xe67c('0x2'));var express=require(_0xe67c('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe67c('0x4'));var controller=require(_0xe67c('0x5'));router[_0xe67c('0x6')]('/',auth[_0xe67c('0x7')](),controller[_0xe67c('0x8')]);router[_0xe67c('0x6')]('/describe',auth[_0xe67c('0x7')](),controller['describe']);router[_0xe67c('0x6')](_0xe67c('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xe67c('0xa')]('/',auth[_0xe67c('0x7')](),controller[_0xe67c('0xb')]);router['put']('/:id',auth[_0xe67c('0x7')](),controller['update']);router[_0xe67c('0xc')](_0xe67c('0x9'),auth[_0xe67c('0x7')](),controller[_0xe67c('0xd')]);module[_0xe67c('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 55a6e80..a5d42b6 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 _0xfeae=['STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x3c3039,_0xd0a1dc){var _0xc9710d=function(_0x191211){while(--_0x191211){_0x3c3039['push'](_0x3c3039['shift']());}};_0xc9710d(++_0xd0a1dc);}(_0xfeae,0x1e9));var _0xefea=function(_0x3a9bce,_0x186e18){_0x3a9bce=_0x3a9bce-0x0;var _0x31e189=_0xfeae[_0x3a9bce];return _0x31e189;};'use strict';var Sequelize=require(_0xefea('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xefea('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xefea('0x2')]},'channelstatedesc':{'type':Sequelize[_0xefea('0x1')]},'calleridnum':{'type':Sequelize[_0xefea('0x1')]},'calleridname':{'type':Sequelize[_0xefea('0x1')]},'connectedlinenum':{'type':Sequelize[_0xefea('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xefea('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xefea('0x1')]},'exten':{'type':Sequelize[_0xefea('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xefea('0x1')]},'destchannelstate':{'type':Sequelize[_0xefea('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xefea('0x1')]},'destcalleridname':{'type':Sequelize[_0xefea('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xefea('0x1')]},'destlanguage':{'type':Sequelize[_0xefea('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xefea('0x1')]},'destexten':{'type':Sequelize[_0xefea('0x1')]},'destpriority':{'type':Sequelize[_0xefea('0x2')]},'destuniqueid':{'type':Sequelize[_0xefea('0x1')]},'destlinkedid':{'type':Sequelize[_0xefea('0x1')]},'dialstring':{'type':Sequelize[_0xefea('0x1')]},'dialstatus':{'type':Sequelize[_0xefea('0x1')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xefea('0x3')]},'endtime':{'type':Sequelize[_0xefea('0x3')]},'lastevent':{'type':Sequelize[_0xefea('0x1')],'comment':_0xefea('0x4')},'routeId':{'type':Sequelize[_0xefea('0x2')]},'duration':{'type':Sequelize[_0xefea('0x2')]},'holdtime':{'type':Sequelize[_0xefea('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x97d4=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x106e5c,_0x1a4d48){var _0x292feb=function(_0x2c36e5){while(--_0x2c36e5){_0x106e5c['push'](_0x106e5c['shift']());}};_0x292feb(++_0x1a4d48);}(_0x97d4,0x186));var _0x497d=function(_0x551ed2,_0x197d2d){_0x551ed2=_0x551ed2-0x0;var _0x4bb9d1=_0x97d4[_0x551ed2];return _0x4bb9d1;};'use strict';var Sequelize=require(_0x497d('0x0'));module[_0x497d('0x1')]={'privilege':{'type':Sequelize[_0x497d('0x2')]},'channel':{'type':Sequelize[_0x497d('0x2')]},'channelstate':{'type':Sequelize[_0x497d('0x3')]},'channelstatedesc':{'type':Sequelize[_0x497d('0x2')]},'calleridnum':{'type':Sequelize[_0x497d('0x2')]},'calleridname':{'type':Sequelize[_0x497d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x497d('0x2')]},'connectedlinename':{'type':Sequelize[_0x497d('0x2')]},'language':{'type':Sequelize[_0x497d('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x497d('0x2')]},'priority':{'type':Sequelize[_0x497d('0x3')]},'uniqueid':{'type':Sequelize[_0x497d('0x2')]},'linkedid':{'type':Sequelize[_0x497d('0x2')]},'destchannel':{'type':Sequelize[_0x497d('0x2')]},'destchannelstate':{'type':Sequelize[_0x497d('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x497d('0x2')]},'destcalleridname':{'type':Sequelize[_0x497d('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x497d('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x497d('0x2')]},'destexten':{'type':Sequelize[_0x497d('0x2')]},'destpriority':{'type':Sequelize[_0x497d('0x3')]},'destuniqueid':{'type':Sequelize[_0x497d('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x497d('0x2')]},'dialstatus':{'type':Sequelize[_0x497d('0x2')]},'starttime':{'type':Sequelize[_0x497d('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x497d('0x4')]},'lastevent':{'type':Sequelize[_0x497d('0x2')],'comment':_0x497d('0x5')},'routeId':{'type':Sequelize[_0x497d('0x3')]},'duration':{'type':Sequelize[_0x497d('0x3')]},'holdtime':{'type':Sequelize[_0x497d('0x3')]},'billableseconds':{'type':Sequelize[_0x497d('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 6adbbf4..d51f3ff 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 _0xe866=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','count','offset','limit','status','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','VoiceDialReport','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','options','includeAll','include','catch','show','merge','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','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'];(function(_0x4091b7,_0x2c8b0f){var _0x519d9b=function(_0x19e7af){while(--_0x19e7af){_0x4091b7['push'](_0x4091b7['shift']());}};_0x519d9b(++_0x2c8b0f);}(_0xe866,0xbf));var _0x6e86=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe866[_0xfae23b];return _0x200640;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6e86('0x0'));var jsonpatch=require(_0x6e86('0x1'));var rp=require(_0x6e86('0x2'));var moment=require('moment');var BPromise=require(_0x6e86('0x3'));var Mustache=require(_0x6e86('0x4'));var util=require(_0x6e86('0x5'));var path=require(_0x6e86('0x6'));var sox=require(_0x6e86('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6e86('0x8'));var squel=require(_0x6e86('0x9'));var crypto=require('crypto');var jsforce=require(_0x6e86('0xa'));var deskjs=require(_0x6e86('0xb'));var toCsv=require(_0x6e86('0xc'));var querystring=require(_0x6e86('0xd'));var Papa=require(_0x6e86('0xe'));var Redis=require(_0x6e86('0xf'));var authService=require(_0x6e86('0x10'));var qs=require(_0x6e86('0x11'));var as=require(_0x6e86('0x12'));var hardwareService=require(_0x6e86('0x13'));var logger=require(_0x6e86('0x14'))(_0x6e86('0x15'));var utils=require(_0x6e86('0x16'));var config=require(_0x6e86('0x17'));var licenseUtil=require(_0x6e86('0x18'));var db=require(_0x6e86('0x19'))['db'];function respondWithStatusCode(_0x2d16e8,_0x268a7b){_0x268a7b=_0x268a7b||0xcc;return function(_0x595cb6){if(_0x595cb6){return _0x2d16e8['sendStatus'](_0x268a7b);}return _0x2d16e8['status'](_0x268a7b)[_0x6e86('0x1a')]();};}function respondWithResult(_0xac2b87,_0x1d29c7){_0x1d29c7=_0x1d29c7||0xc8;return function(_0x4447c1){if(_0x4447c1){return _0xac2b87['status'](_0x1d29c7)[_0x6e86('0x1b')](_0x4447c1);}};}function respondWithFilteredResult(_0x293ee0,_0x383b5f){return function(_0x504865){if(_0x504865){var _0x4d8bc3=_0x504865[_0x6e86('0x1c')],_0x54f2e1=_0x383b5f[_0x6e86('0x1d')],_0x5ace1e=_0x383b5f[_0x6e86('0x1d')]+_0x383b5f[_0x6e86('0x1e')],_0x469b18;if(_0x5ace1e>=_0x4d8bc3){_0x5ace1e=_0x4d8bc3;_0x469b18=0xc8;}else{_0x469b18=0xce;}_0x293ee0[_0x6e86('0x1f')](_0x469b18);return _0x293ee0['set']('Content-Range',_0x54f2e1+'-'+_0x5ace1e+'/'+_0x4d8bc3)['json'](_0x504865);}return null;};}function patchUpdates(_0x4ff299){return function(_0x417b66){try{jsonpatch[_0x6e86('0x20')](_0x417b66,_0x4ff299,!![]);}catch(_0x434260){return BPromise[_0x6e86('0x21')](_0x434260);}return _0x417b66[_0x6e86('0x22')]();};}function saveUpdates(_0x1e12bf,_0x408ba7){return function(_0x544839){if(_0x544839){return _0x544839[_0x6e86('0x23')](_0x1e12bf)[_0x6e86('0x24')](function(_0x1e177){return _0x1e177;});}return null;};}function removeEntity(_0x3e00da,_0x108a32){return function(_0x267715){if(_0x267715){return _0x267715[_0x6e86('0x25')]()[_0x6e86('0x24')](function(){_0x3e00da[_0x6e86('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6a9080,_0x5e6a34){return function(_0x1e91d8){if(!_0x1e91d8){_0x6a9080[_0x6e86('0x26')](0x194);}return _0x1e91d8;};}function handleError(_0x4899da,_0x1335f2){_0x1335f2=_0x1335f2||0x1f4;return function(_0x507dbb){logger[_0x6e86('0x27')](_0x507dbb[_0x6e86('0x28')]);if(_0x507dbb['name']){delete _0x507dbb[_0x6e86('0x29')];}_0x4899da[_0x6e86('0x1f')](_0x1335f2)['send'](_0x507dbb);};}exports[_0x6e86('0x2a')]=function(_0x478a36,_0x55172a){var _0x32d6ab={},_0x1c1c02={},_0x231153={'count':0x0,'rows':[]};var _0x1d455e=_['map'](db[_0x6e86('0x2b')][_0x6e86('0x2c')],function(_0x4ae6a4){return{'name':_0x4ae6a4[_0x6e86('0x2d')],'type':_0x4ae6a4[_0x6e86('0x2e')]['key']};});_0x1c1c02[_0x6e86('0x2f')]=_[_0x6e86('0x30')](_0x1d455e,_0x6e86('0x29'));_0x1c1c02[_0x6e86('0x31')]=_[_0x6e86('0x32')](_0x478a36[_0x6e86('0x31')]);_0x1c1c02['filters']=_[_0x6e86('0x33')](_0x1c1c02[_0x6e86('0x2f')],_0x1c1c02[_0x6e86('0x31')]);_0x32d6ab[_0x6e86('0x34')]=_[_0x6e86('0x33')](_0x1c1c02[_0x6e86('0x2f')],qs[_0x6e86('0x35')](_0x478a36[_0x6e86('0x31')][_0x6e86('0x35')]));_0x32d6ab[_0x6e86('0x34')]=_0x32d6ab['attributes'][_0x6e86('0x36')]?_0x32d6ab['attributes']:_0x1c1c02[_0x6e86('0x2f')];if(!_0x478a36[_0x6e86('0x31')]['hasOwnProperty'](_0x6e86('0x37'))){_0x32d6ab['limit']=qs[_0x6e86('0x1e')](_0x478a36[_0x6e86('0x31')]['limit']);_0x32d6ab[_0x6e86('0x1d')]=qs['offset'](_0x478a36[_0x6e86('0x31')][_0x6e86('0x1d')]);}_0x32d6ab[_0x6e86('0x38')]=qs[_0x6e86('0x39')](_0x478a36[_0x6e86('0x31')]['sort']);_0x32d6ab[_0x6e86('0x3a')]=qs[_0x6e86('0x3b')](_['pick'](_0x478a36[_0x6e86('0x31')],_0x1c1c02['filters']),_0x1d455e);if(_0x478a36[_0x6e86('0x31')]['filter']){_0x32d6ab['where']=_['merge'](_0x32d6ab[_0x6e86('0x3a')],{'$or':_[_0x6e86('0x30')](_0x1d455e,function(_0x2966bf){if(_0x2966bf['type']!=='VIRTUAL'){var _0x33523d={};_0x33523d[_0x2966bf['name']]={'$like':'%'+_0x478a36[_0x6e86('0x31')]['filter']+'%'};return _0x33523d;}})});}_0x32d6ab=_['merge']({},_0x32d6ab,_0x478a36[_0x6e86('0x3c')]);var _0x597d16={'where':_0x32d6ab[_0x6e86('0x3a')]};return db['VoiceDialReport']['count'](_0x597d16)[_0x6e86('0x24')](function(_0x4baa4d){_0x231153[_0x6e86('0x1c')]=_0x4baa4d;if(_0x478a36[_0x6e86('0x31')][_0x6e86('0x3d')]){_0x32d6ab[_0x6e86('0x3e')]=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x32d6ab);})[_0x6e86('0x24')](function(_0x12d1e4){_0x231153['rows']=_0x12d1e4;return _0x231153;})['then'](respondWithFilteredResult(_0x55172a,_0x32d6ab))[_0x6e86('0x3f')](handleError(_0x55172a,null));};exports[_0x6e86('0x40')]=function(_0x467318,_0x2b3012){var _0x34552c={'raw':!![],'where':{'id':_0x467318['params']['id']}},_0x388b9d={};_0x388b9d['model']=_[_0x6e86('0x32')](db[_0x6e86('0x2b')]['rawAttributes']);_0x388b9d['query']=_[_0x6e86('0x32')](_0x467318['query']);_0x388b9d[_0x6e86('0x3b')]=_['intersection'](_0x388b9d[_0x6e86('0x2f')],_0x388b9d[_0x6e86('0x31')]);_0x34552c[_0x6e86('0x34')]=_[_0x6e86('0x33')](_0x388b9d[_0x6e86('0x2f')],qs['fields'](_0x467318[_0x6e86('0x31')][_0x6e86('0x35')]));_0x34552c[_0x6e86('0x34')]=_0x34552c['attributes']['length']?_0x34552c[_0x6e86('0x34')]:_0x388b9d[_0x6e86('0x2f')];if(_0x467318[_0x6e86('0x31')][_0x6e86('0x3d')]){_0x34552c[_0x6e86('0x3e')]=[{'all':!![]}];}_0x34552c=_[_0x6e86('0x41')]({},_0x34552c,_0x467318[_0x6e86('0x3c')]);return db[_0x6e86('0x2b')][_0x6e86('0x42')](_0x34552c)[_0x6e86('0x24')](handleEntityNotFound(_0x2b3012,null))[_0x6e86('0x24')](respondWithResult(_0x2b3012,null))[_0x6e86('0x3f')](handleError(_0x2b3012,null));};exports['create']=function(_0xc18660,_0x58eb55){return db['VoiceDialReport'][_0x6e86('0x43')](_0xc18660[_0x6e86('0x44')],{})[_0x6e86('0x24')](respondWithResult(_0x58eb55,0xc9))[_0x6e86('0x3f')](handleError(_0x58eb55,null));};exports['update']=function(_0x19efce,_0x41c653){if(_0x19efce[_0x6e86('0x44')]['id']){delete _0x19efce[_0x6e86('0x44')]['id'];}return db['VoiceDialReport'][_0x6e86('0x42')]({'where':{'id':_0x19efce[_0x6e86('0x45')]['id']}})[_0x6e86('0x24')](handleEntityNotFound(_0x41c653,null))[_0x6e86('0x24')](saveUpdates(_0x19efce[_0x6e86('0x44')],null))[_0x6e86('0x24')](respondWithResult(_0x41c653,null))[_0x6e86('0x3f')](handleError(_0x41c653,null));};exports[_0x6e86('0x25')]=function(_0x34bc22,_0x20a12d){return db['VoiceDialReport'][_0x6e86('0x42')]({'where':{'id':_0x34bc22['params']['id']}})[_0x6e86('0x24')](handleEntityNotFound(_0x20a12d,null))[_0x6e86('0x24')](removeEntity(_0x20a12d,null))[_0x6e86('0x3f')](handleError(_0x20a12d,null));};exports[_0x6e86('0x46')]=function(_0xc376ee,_0x4ef90c){return db[_0x6e86('0x2b')]['describe']()['then'](respondWithResult(_0x4ef90c,null))[_0x6e86('0x3f')](handleError(_0x4ef90c,null));}; \ No newline at end of file +var _0x66e2=['options','includeAll','include','findAll','rows','catch','show','intersection','find','create','body','params','describe','html-pdf','zip-dir','bluebird','util','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','limit','Content-Range','json','apply','then','destroy','end','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','offset','order','sort','pick','filter','where','merge'];(function(_0x5e23c8,_0xb1125e){var _0x475e87=function(_0x20640a){while(--_0x20640a){_0x5e23c8['push'](_0x5e23c8['shift']());}};_0x475e87(++_0xb1125e);}(_0x66e2,0x1ab));var _0x266e=function(_0x146be0,_0x39a85e){_0x146be0=_0x146be0-0x0;var _0x1bcc25=_0x66e2[_0x146be0];return _0x1bcc25;};'use strict';var pdf=require(_0x266e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x266e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x266e('0x2'));var Mustache=require('mustache');var util=require(_0x266e('0x3'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x266e('0x4'));var squel=require(_0x266e('0x5'));var crypto=require(_0x266e('0x6'));var jsforce=require(_0x266e('0x7'));var deskjs=require(_0x266e('0x8'));var toCsv=require(_0x266e('0x9'));var querystring=require(_0x266e('0xa'));var Papa=require(_0x266e('0xb'));var Redis=require(_0x266e('0xc'));var authService=require(_0x266e('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x266e('0xe'));var hardwareService=require(_0x266e('0xf'));var logger=require(_0x266e('0x10'))(_0x266e('0x11'));var utils=require('../../config/utils');var config=require(_0x266e('0x12'));var licenseUtil=require(_0x266e('0x13'));var db=require(_0x266e('0x14'))['db'];function respondWithStatusCode(_0x5136af,_0x381411){_0x381411=_0x381411||0xcc;return function(_0x11b31b){if(_0x11b31b){return _0x5136af[_0x266e('0x15')](_0x381411);}return _0x5136af[_0x266e('0x16')](_0x381411)['end']();};}function respondWithResult(_0xb5fd9e,_0xb79995){_0xb79995=_0xb79995||0xc8;return function(_0x4364b4){if(_0x4364b4){return _0xb5fd9e[_0x266e('0x16')](_0xb79995)['json'](_0x4364b4);}};}function respondWithFilteredResult(_0x1c4c8a,_0x4b8cea){return function(_0x53e5d3){if(_0x53e5d3){var _0x424742=_0x53e5d3[_0x266e('0x17')],_0xaa997d=_0x4b8cea['offset'],_0x3f537b=_0x4b8cea['offset']+_0x4b8cea[_0x266e('0x18')],_0x3b3b12;if(_0x3f537b>=_0x424742){_0x3f537b=_0x424742;_0x3b3b12=0xc8;}else{_0x3b3b12=0xce;}_0x1c4c8a['status'](_0x3b3b12);return _0x1c4c8a['set'](_0x266e('0x19'),_0xaa997d+'-'+_0x3f537b+'/'+_0x424742)[_0x266e('0x1a')](_0x53e5d3);}return null;};}function patchUpdates(_0x23fc69){return function(_0x1ed118){try{jsonpatch[_0x266e('0x1b')](_0x1ed118,_0x23fc69,!![]);}catch(_0x449ce1){return BPromise['reject'](_0x449ce1);}return _0x1ed118['save']();};}function saveUpdates(_0x470f0a,_0x127c6e){return function(_0x567318){if(_0x567318){return _0x567318['update'](_0x470f0a)[_0x266e('0x1c')](function(_0x33117d){return _0x33117d;});}return null;};}function removeEntity(_0x4452d1,_0x19acc5){return function(_0x4cd181){if(_0x4cd181){return _0x4cd181[_0x266e('0x1d')]()['then'](function(){_0x4452d1[_0x266e('0x16')](0xcc)[_0x266e('0x1e')]();});}};}function handleEntityNotFound(_0x172fd8,_0x2f1580){return function(_0x1b7eb1){if(!_0x1b7eb1){_0x172fd8[_0x266e('0x15')](0x194);}return _0x1b7eb1;};}function handleError(_0x3adcf9,_0x40d0e2){_0x40d0e2=_0x40d0e2||0x1f4;return function(_0x46d56f){logger[_0x266e('0x1f')](_0x46d56f[_0x266e('0x20')]);if(_0x46d56f[_0x266e('0x21')]){delete _0x46d56f[_0x266e('0x21')];}_0x3adcf9[_0x266e('0x16')](_0x40d0e2)[_0x266e('0x22')](_0x46d56f);};}exports[_0x266e('0x23')]=function(_0x43d0bf,_0x196e2c){var _0x514949={},_0x332e52={},_0x15ef35={'count':0x0,'rows':[]};var _0x1d57f6=_[_0x266e('0x24')](db[_0x266e('0x25')][_0x266e('0x26')],function(_0x2a68ef){return{'name':_0x2a68ef[_0x266e('0x27')],'type':_0x2a68ef[_0x266e('0x28')][_0x266e('0x29')]};});_0x332e52[_0x266e('0x2a')]=_[_0x266e('0x24')](_0x1d57f6,_0x266e('0x21'));_0x332e52[_0x266e('0x2b')]=_[_0x266e('0x2c')](_0x43d0bf[_0x266e('0x2b')]);_0x332e52[_0x266e('0x2d')]=_['intersection'](_0x332e52[_0x266e('0x2a')],_0x332e52[_0x266e('0x2b')]);_0x514949[_0x266e('0x2e')]=_['intersection'](_0x332e52[_0x266e('0x2a')],qs[_0x266e('0x2f')](_0x43d0bf[_0x266e('0x2b')]['fields']));_0x514949[_0x266e('0x2e')]=_0x514949[_0x266e('0x2e')][_0x266e('0x30')]?_0x514949[_0x266e('0x2e')]:_0x332e52[_0x266e('0x2a')];if(!_0x43d0bf[_0x266e('0x2b')]['hasOwnProperty']('nolimit')){_0x514949['limit']=qs[_0x266e('0x18')](_0x43d0bf[_0x266e('0x2b')][_0x266e('0x18')]);_0x514949[_0x266e('0x31')]=qs[_0x266e('0x31')](_0x43d0bf['query'][_0x266e('0x31')]);}_0x514949[_0x266e('0x32')]=qs['sort'](_0x43d0bf[_0x266e('0x2b')][_0x266e('0x33')]);_0x514949['where']=qs['filters'](_[_0x266e('0x34')](_0x43d0bf[_0x266e('0x2b')],_0x332e52[_0x266e('0x2d')]),_0x1d57f6);if(_0x43d0bf['query'][_0x266e('0x35')]){_0x514949[_0x266e('0x36')]=_[_0x266e('0x37')](_0x514949[_0x266e('0x36')],{'$or':_[_0x266e('0x24')](_0x1d57f6,function(_0x191c20){if(_0x191c20[_0x266e('0x28')]!=='VIRTUAL'){var _0x53e6e0={};_0x53e6e0[_0x191c20['name']]={'$like':'%'+_0x43d0bf['query']['filter']+'%'};return _0x53e6e0;}})});}_0x514949=_['merge']({},_0x514949,_0x43d0bf[_0x266e('0x38')]);var _0x3056f0={'where':_0x514949[_0x266e('0x36')]};return db[_0x266e('0x25')][_0x266e('0x17')](_0x3056f0)['then'](function(_0x22d60d){_0x15ef35['count']=_0x22d60d;if(_0x43d0bf['query'][_0x266e('0x39')]){_0x514949[_0x266e('0x3a')]=[{'all':!![]}];}return db[_0x266e('0x25')][_0x266e('0x3b')](_0x514949);})[_0x266e('0x1c')](function(_0x1162f0){_0x15ef35[_0x266e('0x3c')]=_0x1162f0;return _0x15ef35;})[_0x266e('0x1c')](respondWithFilteredResult(_0x196e2c,_0x514949))[_0x266e('0x3d')](handleError(_0x196e2c,null));};exports[_0x266e('0x3e')]=function(_0x39767a,_0x1a521a){var _0x417df4={'raw':!![],'where':{'id':_0x39767a['params']['id']}},_0x306c6f={};_0x306c6f[_0x266e('0x2a')]=_['keys'](db[_0x266e('0x25')][_0x266e('0x26')]);_0x306c6f[_0x266e('0x2b')]=_[_0x266e('0x2c')](_0x39767a[_0x266e('0x2b')]);_0x306c6f['filters']=_[_0x266e('0x3f')](_0x306c6f[_0x266e('0x2a')],_0x306c6f[_0x266e('0x2b')]);_0x417df4[_0x266e('0x2e')]=_[_0x266e('0x3f')](_0x306c6f[_0x266e('0x2a')],qs[_0x266e('0x2f')](_0x39767a[_0x266e('0x2b')][_0x266e('0x2f')]));_0x417df4['attributes']=_0x417df4[_0x266e('0x2e')][_0x266e('0x30')]?_0x417df4[_0x266e('0x2e')]:_0x306c6f[_0x266e('0x2a')];if(_0x39767a[_0x266e('0x2b')]['includeAll']){_0x417df4['include']=[{'all':!![]}];}_0x417df4=_[_0x266e('0x37')]({},_0x417df4,_0x39767a['options']);return db[_0x266e('0x25')][_0x266e('0x40')](_0x417df4)[_0x266e('0x1c')](handleEntityNotFound(_0x1a521a,null))[_0x266e('0x1c')](respondWithResult(_0x1a521a,null))[_0x266e('0x3d')](handleError(_0x1a521a,null));};exports[_0x266e('0x41')]=function(_0x4f4a66,_0x43acd5){return db[_0x266e('0x25')][_0x266e('0x41')](_0x4f4a66[_0x266e('0x42')],{})[_0x266e('0x1c')](respondWithResult(_0x43acd5,0xc9))[_0x266e('0x3d')](handleError(_0x43acd5,null));};exports['update']=function(_0x45a8bd,_0x15644e){if(_0x45a8bd[_0x266e('0x42')]['id']){delete _0x45a8bd['body']['id'];}return db[_0x266e('0x25')][_0x266e('0x40')]({'where':{'id':_0x45a8bd[_0x266e('0x43')]['id']}})['then'](handleEntityNotFound(_0x15644e,null))[_0x266e('0x1c')](saveUpdates(_0x45a8bd[_0x266e('0x42')],null))['then'](respondWithResult(_0x15644e,null))[_0x266e('0x3d')](handleError(_0x15644e,null));};exports['destroy']=function(_0x57f9c0,_0x2f38c7){return db[_0x266e('0x25')]['find']({'where':{'id':_0x57f9c0[_0x266e('0x43')]['id']}})[_0x266e('0x1c')](handleEntityNotFound(_0x2f38c7,null))[_0x266e('0x1c')](removeEntity(_0x2f38c7,null))[_0x266e('0x3d')](handleError(_0x2f38c7,null));};exports[_0x266e('0x44')]=function(_0x41cec8,_0x27e796){return db[_0x266e('0x25')]['describe']()['then'](respondWithResult(_0x27e796,null))[_0x266e('0x3d')](handleError(_0x27e796,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 7a1f694..2e4517f 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 _0xd7a9=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceDialReport','report_dial'];(function(_0x31db45,_0x20abad){var _0xfe537e=function(_0x254f37){while(--_0x254f37){_0x31db45['push'](_0x31db45['shift']());}};_0xfe537e(++_0x20abad);}(_0xd7a9,0x8f));var _0x9d7a=function(_0x156bab,_0x438a0c){_0x156bab=_0x156bab-0x0;var _0xebdf00=_0xd7a9[_0x156bab];return _0xebdf00;};'use strict';var _=require(_0x9d7a('0x0'));var util=require(_0x9d7a('0x1'));var logger=require('../../config/logger')(_0x9d7a('0x2'));var moment=require('moment');var BPromise=require(_0x9d7a('0x3'));var rp=require(_0x9d7a('0x4'));var fs=require('fs');var path=require(_0x9d7a('0x5'));var rimraf=require(_0x9d7a('0x6'));var config=require(_0x9d7a('0x7'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x41395e,_0x29d051){return _0x41395e[_0x9d7a('0x8')](_0x9d7a('0x9'),attributes,{'tableName':_0x9d7a('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb392=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','VoiceDialReport','report_dial','uniqueid','lodash','../../config/logger'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0xb392,0xf5));var _0x2b39=function(_0x22f283,_0xa3390f){_0x22f283=_0x22f283-0x0;var _0x3b5eee=_0xb392[_0x22f283];return _0x3b5eee;};'use strict';var _=require(_0x2b39('0x0'));var util=require('util');var logger=require(_0x2b39('0x1'))(_0x2b39('0x2'));var moment=require(_0x2b39('0x3'));var BPromise=require(_0x2b39('0x4'));var rp=require(_0x2b39('0x5'));var fs=require('fs');var path=require(_0x2b39('0x6'));var rimraf=require(_0x2b39('0x7'));var config=require(_0x2b39('0x8'));var attributes=require(_0x2b39('0x9'));module['exports']=function(_0x13628d,_0x5c2ba0){return _0x13628d['define'](_0x2b39('0xa'),attributes,{'tableName':_0x2b39('0xb'),'paranoid':![],'indexes':[{'fields':[_0x2b39('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 24387e3..865fbb6 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 _0x1e55=['client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','VoiceDialReport','body','options','raw','CreateVoiceDialReport','UpdateVoiceDialReport','update','where','attributes','limit','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x50731e,_0x501b7b){var _0x2356b3=function(_0x19724d){while(--_0x19724d){_0x50731e['push'](_0x50731e['shift']());}};_0x2356b3(++_0x501b7b);}(_0x1e55,0x98));var _0x51e5=function(_0x47d7b1,_0x241c85){_0x47d7b1=_0x47d7b1-0x0;var _0x5c3094=_0x1e55[_0x47d7b1];return _0x5c3094;};'use strict';var _=require('lodash');var util=require(_0x51e5('0x0'));var moment=require('moment');var BPromise=require(_0x51e5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x51e5('0x2'));var db=require(_0x51e5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x51e5('0x4'))(_0x51e5('0x5'));var config=require(_0x51e5('0x6'));var jayson=require(_0x51e5('0x7'));var client=jayson[_0x51e5('0x8')][_0x51e5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ccc02,_0x488f3a,_0x458047){return new BPromise(function(_0x27da11,_0x57754a){return client[_0x51e5('0xa')](_0x5ccc02,_0x458047)[_0x51e5('0xb')](function(_0x2f9ebf){logger[_0x51e5('0xc')](_0x51e5('0xd'),_0x488f3a,'request\x20sent');logger[_0x51e5('0xe')](_0x51e5('0xf'),_0x488f3a,'request\x20sent',JSON[_0x51e5('0x10')](_0x2f9ebf));if(_0x2f9ebf[_0x51e5('0x11')]){if(_0x2f9ebf[_0x51e5('0x11')]['code']===0x1f4){logger[_0x51e5('0x11')](_0x51e5('0xd'),_0x488f3a,_0x2f9ebf[_0x51e5('0x11')][_0x51e5('0x12')]);return _0x57754a(_0x2f9ebf[_0x51e5('0x11')][_0x51e5('0x12')]);}logger[_0x51e5('0x11')](_0x51e5('0xd'),_0x488f3a,_0x2f9ebf[_0x51e5('0x11')][_0x51e5('0x12')]);return _0x27da11(_0x2f9ebf['error'][_0x51e5('0x12')]);}else{logger[_0x51e5('0xc')](_0x51e5('0xd'),_0x488f3a,_0x51e5('0x13'));_0x27da11(_0x2f9ebf[_0x51e5('0x14')][_0x51e5('0x12')]);}})[_0x51e5('0x15')](function(_0x3b5816){logger[_0x51e5('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x488f3a,_0x3b5816);_0x57754a(_0x3b5816);});});}exports['CreateVoiceDialReport']=function(_0x5caa35){var _0x4fed65=this;return new Promise(function(_0x5814c8,_0x452d8e){return db[_0x51e5('0x16')]['create'](_0x5caa35[_0x51e5('0x17')],{'raw':_0x5caa35[_0x51e5('0x18')]?_0x5caa35['options'][_0x51e5('0x19')]===undefined?!![]:![]:!![]})[_0x51e5('0xb')](function(_0x3b9fa6){logger['info'](_0x51e5('0x1a'),_0x5caa35);logger[_0x51e5('0xe')](_0x51e5('0x1a'),_0x5caa35,JSON[_0x51e5('0x10')](_0x3b9fa6));_0x5814c8(_0x3b9fa6);})[_0x51e5('0x15')](function(_0x5a2c40){logger[_0x51e5('0x11')](_0x51e5('0x1a'),_0x5a2c40['message'],_0x5caa35);_0x452d8e(_0x4fed65[_0x51e5('0x11')](0x1f4,_0x5a2c40[_0x51e5('0x12')]));});});};exports[_0x51e5('0x1b')]=function(_0x4cd132){var _0x20497b=this;return new Promise(function(_0x1f6d04,_0xc6f894){return db[_0x51e5('0x16')][_0x51e5('0x1c')](_0x4cd132[_0x51e5('0x17')],{'raw':_0x4cd132[_0x51e5('0x18')]?_0x4cd132[_0x51e5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cd132['options']?_0x4cd132[_0x51e5('0x18')][_0x51e5('0x1d')]||null:null,'attributes':_0x4cd132[_0x51e5('0x18')]?_0x4cd132[_0x51e5('0x18')][_0x51e5('0x1e')]||null:null,'limit':_0x4cd132[_0x51e5('0x18')]?_0x4cd132[_0x51e5('0x18')][_0x51e5('0x1f')]||null:null})[_0x51e5('0xb')](function(_0x28b2bf){logger[_0x51e5('0xc')](_0x51e5('0x1b'),_0x4cd132);logger['debug']('UpdateVoiceDialReport',_0x4cd132,JSON[_0x51e5('0x10')](_0x28b2bf));_0x1f6d04(_0x28b2bf);})[_0x51e5('0x15')](function(_0x557806){logger[_0x51e5('0x11')](_0x51e5('0x1b'),_0x557806[_0x51e5('0x12')],_0x4cd132);_0xc6f894(_0x20497b['error'](0x1f4,_0x557806[_0x51e5('0x12')]));});});}; \ No newline at end of file +var _0x2f3b=['VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','raw','info','UpdateVoiceDialReport','update','options','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code'];(function(_0x1c4c1e,_0x37ae2c){var _0x308b62=function(_0x485166){while(--_0x485166){_0x1c4c1e['push'](_0x1c4c1e['shift']());}};_0x308b62(++_0x37ae2c);}(_0x2f3b,0x158));var _0xb2f3=function(_0x15e7cc,_0x48f79b){_0x15e7cc=_0x15e7cc-0x0;var _0x195e34=_0x2f3b[_0x15e7cc];return _0x195e34;};'use strict';var _=require(_0xb2f3('0x0'));var util=require(_0xb2f3('0x1'));var moment=require(_0xb2f3('0x2'));var BPromise=require(_0xb2f3('0x3'));var rs=require(_0xb2f3('0x4'));var fs=require('fs');var Redis=require(_0xb2f3('0x5'));var db=require(_0xb2f3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb2f3('0x7'))(_0xb2f3('0x8'));var config=require(_0xb2f3('0x9'));var jayson=require(_0xb2f3('0xa'));var client=jayson[_0xb2f3('0xb')][_0xb2f3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43ee14,_0x2d4bb9,_0x4d58de){return new BPromise(function(_0x2a1032,_0x6cfa31){return client[_0xb2f3('0xd')](_0x43ee14,_0x4d58de)[_0xb2f3('0xe')](function(_0x3e255d){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x2d4bb9,'request\x20sent');logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x2d4bb9,_0xb2f3('0xf'),JSON[_0xb2f3('0x10')](_0x3e255d));if(_0x3e255d[_0xb2f3('0x11')]){if(_0x3e255d[_0xb2f3('0x11')][_0xb2f3('0x12')]===0x1f4){logger['error'](_0xb2f3('0x13'),_0x2d4bb9,_0x3e255d['error'][_0xb2f3('0x14')]);return _0x6cfa31(_0x3e255d[_0xb2f3('0x11')]['message']);}logger[_0xb2f3('0x11')](_0xb2f3('0x13'),_0x2d4bb9,_0x3e255d[_0xb2f3('0x11')][_0xb2f3('0x14')]);return _0x2a1032(_0x3e255d[_0xb2f3('0x11')][_0xb2f3('0x14')]);}else{logger['info'](_0xb2f3('0x13'),_0x2d4bb9,_0xb2f3('0xf'));_0x2a1032(_0x3e255d[_0xb2f3('0x15')][_0xb2f3('0x14')]);}})[_0xb2f3('0x16')](function(_0x7c4ac5){logger['error'](_0xb2f3('0x13'),_0x2d4bb9,_0x7c4ac5);_0x6cfa31(_0x7c4ac5);});});}exports[_0xb2f3('0x17')]=function(_0x34ecde){var _0xafc53a=this;return new Promise(function(_0x4d2113,_0x3ed3a8){return db[_0xb2f3('0x18')][_0xb2f3('0x19')](_0x34ecde[_0xb2f3('0x1a')],{'raw':_0x34ecde['options']?_0x34ecde['options'][_0xb2f3('0x1b')]===undefined?!![]:![]:!![]})[_0xb2f3('0xe')](function(_0x2cd4d8){logger[_0xb2f3('0x1c')]('CreateVoiceDialReport',_0x34ecde);logger['debug'](_0xb2f3('0x17'),_0x34ecde,JSON[_0xb2f3('0x10')](_0x2cd4d8));_0x4d2113(_0x2cd4d8);})[_0xb2f3('0x16')](function(_0x2848ff){logger[_0xb2f3('0x11')](_0xb2f3('0x17'),_0x2848ff[_0xb2f3('0x14')],_0x34ecde);_0x3ed3a8(_0xafc53a[_0xb2f3('0x11')](0x1f4,_0x2848ff[_0xb2f3('0x14')]));});});};exports[_0xb2f3('0x1d')]=function(_0x560ca7){var _0x137437=this;return new Promise(function(_0x3c5c19,_0x4d55bf){return db['VoiceDialReport'][_0xb2f3('0x1e')](_0x560ca7[_0xb2f3('0x1a')],{'raw':_0x560ca7[_0xb2f3('0x1f')]?_0x560ca7[_0xb2f3('0x1f')][_0xb2f3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x560ca7[_0xb2f3('0x1f')]?_0x560ca7[_0xb2f3('0x1f')]['where']||null:null,'attributes':_0x560ca7['options']?_0x560ca7[_0xb2f3('0x1f')]['attributes']||null:null,'limit':_0x560ca7[_0xb2f3('0x1f')]?_0x560ca7[_0xb2f3('0x1f')][_0xb2f3('0x20')]||null:null})['then'](function(_0x22af11){logger[_0xb2f3('0x1c')]('UpdateVoiceDialReport',_0x560ca7);logger['debug'](_0xb2f3('0x1d'),_0x560ca7,JSON[_0xb2f3('0x10')](_0x22af11));_0x3c5c19(_0x22af11);})[_0xb2f3('0x16')](function(_0x3e2355){logger[_0xb2f3('0x11')](_0xb2f3('0x1d'),_0x3e2355[_0xb2f3('0x14')],_0x560ca7);_0x4d55bf(_0x137437[_0xb2f3('0x11')](0x1f4,_0x3e2355[_0xb2f3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 2dae4db..23045ad 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 _0x8ee8=['../../config/environment','get','index','isAuthenticated','show','post','create','addApplications','put','/:id','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x19e870,_0x364831){var _0x274e94=function(_0x759a49){while(--_0x759a49){_0x19e870['push'](_0x19e870['shift']());}};_0x274e94(++_0x364831);}(_0x8ee8,0xe4));var _0x88ee=function(_0x2795dd,_0x157893){_0x2795dd=_0x2795dd-0x0;var _0x30f875=_0x8ee8[_0x2795dd];return _0x30f875;};'use strict';var multer=require(_0x88ee('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x88ee('0x1'));var express=require(_0x88ee('0x2'));var router=express[_0x88ee('0x3')]();var auth=require(_0x88ee('0x4'));var interaction=require(_0x88ee('0x5'));var config=require(_0x88ee('0x6'));var controller=require('./voiceExtension.controller');router[_0x88ee('0x7')]('/',auth['isAuthenticated'](),controller[_0x88ee('0x8')]);router[_0x88ee('0x7')]('/:id',auth[_0x88ee('0x9')](),controller[_0x88ee('0xa')]);router[_0x88ee('0xb')]('/',auth[_0x88ee('0x9')](),controller[_0x88ee('0xc')]);router[_0x88ee('0xb')]('/:id/applications',auth[_0x88ee('0x9')](),controller[_0x88ee('0xd')]);router[_0x88ee('0xe')](_0x88ee('0xf'),auth[_0x88ee('0x9')](),controller['update']);router[_0x88ee('0x10')](_0x88ee('0xf'),auth['isAuthenticated'](),controller[_0x88ee('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5969=['../../config/environment','get','isAuthenticated','index','/:id','show','post','addApplications','put','update','delete','destroy','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x1b3d60,_0x51583b){var _0x4abc3d=function(_0x5c9acb){while(--_0x5c9acb){_0x1b3d60['push'](_0x1b3d60['shift']());}};_0x4abc3d(++_0x51583b);}(_0x5969,0x18c));var _0x9596=function(_0x2b61c3,_0x183a3b){_0x2b61c3=_0x2b61c3-0x0;var _0x3731f7=_0x5969[_0x2b61c3];return _0x3731f7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9596('0x0'));var timeout=require('connect-timeout');var express=require(_0x9596('0x1'));var router=express['Router']();var auth=require(_0x9596('0x2'));var interaction=require(_0x9596('0x3'));var config=require(_0x9596('0x4'));var controller=require('./voiceExtension.controller');router[_0x9596('0x5')]('/',auth[_0x9596('0x6')](),controller[_0x9596('0x7')]);router[_0x9596('0x5')](_0x9596('0x8'),auth['isAuthenticated'](),controller[_0x9596('0x9')]);router['post']('/',auth[_0x9596('0x6')](),controller['create']);router[_0x9596('0xa')]('/:id/applications',auth[_0x9596('0x6')](),controller[_0x9596('0xb')]);router[_0x9596('0xc')](_0x9596('0x8'),auth[_0x9596('0x6')](),controller[_0x9596('0xd')]);router[_0x9596('0xe')](_0x9596('0x8'),auth[_0x9596('0x6')](),controller[_0x9596('0xf')]);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 3754ac0..2412049 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(_0x1b4cab,_0x133714){var _0x5189d3=function(_0x575713){while(--_0x575713){_0x1b4cab['push'](_0x1b4cab['shift']());}};_0x5189d3(++_0x133714);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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(_0x35e760,_0x4a42e6){var _0x59d5a7=function(_0x296a72){while(--_0x296a72){_0x35e760['push'](_0x35e760['shift']());}};_0x59d5a7(++_0x4a42e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 e1608f2..2fbe4a0 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 _0xd2b7=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./voiceExtension.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','includes','type','find','name','UserProfileResource','destroy','error','index','map','VoiceExtension','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','InboundRoutes','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x4745d9,_0x411b00){var _0x38f2ac=function(_0x436be3){while(--_0x436be3){_0x4745d9['push'](_0x4745d9['shift']());}};_0x38f2ac(++_0x411b00);}(_0xd2b7,0x1ac));var _0x7d2b=function(_0x474d97,_0x5909ce){_0x474d97=_0x474d97-0x0;var _0x1edf25=_0xd2b7[_0x474d97];return _0x1edf25;};'use strict';var pdf=require(_0x7d2b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7d2b('0x1'));var zipdir=require(_0x7d2b('0x2'));var jsonpatch=require(_0x7d2b('0x3'));var rp=require(_0x7d2b('0x4'));var moment=require(_0x7d2b('0x5'));var BPromise=require(_0x7d2b('0x6'));var Mustache=require(_0x7d2b('0x7'));var util=require(_0x7d2b('0x8'));var path=require(_0x7d2b('0x9'));var sox=require(_0x7d2b('0xa'));var csv=require(_0x7d2b('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7d2b('0xc'));var crypto=require(_0x7d2b('0xd'));var jsforce=require(_0x7d2b('0xe'));var deskjs=require(_0x7d2b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7d2b('0x10'));var Papa=require(_0x7d2b('0x11'));var Redis=require(_0x7d2b('0x12'));var authService=require(_0x7d2b('0x13'));var qs=require(_0x7d2b('0x14'));var as=require(_0x7d2b('0x15'));var hardwareService=require(_0x7d2b('0x16'));var logger=require('../../config/logger')(_0x7d2b('0x17'));var utils=require(_0x7d2b('0x18'));var config=require(_0x7d2b('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d2b('0x1a'))['db'];config[_0x7d2b('0x1b')]=_['defaults'](config[_0x7d2b('0x1b')],{'host':_0x7d2b('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7d2b('0x1b')]));require(_0x7d2b('0x1d'))[_0x7d2b('0x1e')](socket);function respondWithStatusCode(_0x57c078,_0x1f0503){_0x1f0503=_0x1f0503||0xcc;return function(_0xe20a03){if(_0xe20a03){return _0x57c078[_0x7d2b('0x1f')](_0x1f0503);}return _0x57c078[_0x7d2b('0x20')](_0x1f0503)[_0x7d2b('0x21')]();};}function respondWithResult(_0x11a68d,_0x2322b0){_0x2322b0=_0x2322b0||0xc8;return function(_0x17e528){if(_0x17e528){return _0x11a68d['status'](_0x2322b0)[_0x7d2b('0x22')](_0x17e528);}};}function respondWithFilteredResult(_0x1dc5ee,_0x3596e2){return function(_0xf638e){if(_0xf638e){var _0x257a97=_0xf638e[_0x7d2b('0x23')],_0x5deab4=_0x3596e2[_0x7d2b('0x24')],_0x34cb12=_0x3596e2[_0x7d2b('0x24')]+_0x3596e2[_0x7d2b('0x25')],_0x43ec06;if(_0x34cb12>=_0x257a97){_0x34cb12=_0x257a97;_0x43ec06=0xc8;}else{_0x43ec06=0xce;}_0x1dc5ee[_0x7d2b('0x20')](_0x43ec06);return _0x1dc5ee[_0x7d2b('0x26')](_0x7d2b('0x27'),_0x5deab4+'-'+_0x34cb12+'/'+_0x257a97)['json'](_0xf638e);}return null;};}function patchUpdates(_0x589022){return function(_0x4cb2c9){try{jsonpatch[_0x7d2b('0x28')](_0x4cb2c9,_0x589022,!![]);}catch(_0x165fdd){return BPromise[_0x7d2b('0x29')](_0x165fdd);}return _0x4cb2c9['save']();};}function saveUpdates(_0x58d12b,_0x4fe9b8){return function(_0x58a0d3){if(_0x58a0d3){return _0x58a0d3[_0x7d2b('0x2a')](_0x58d12b)[_0x7d2b('0x2b')](function(_0x2ae7a5){return _0x2ae7a5;});}return null;};}function removeEntity(_0x5d631d,_0x4672b2){return function(_0x3f0aa4){if(_0x3f0aa4){return _0x3f0aa4['destroy']()[_0x7d2b('0x2b')](function(){var _0x101a7a=_0x3f0aa4[_0x7d2b('0x2c')]({'plain':!![]});var _0x95164d=[{'name':'InboundRoutes','value':_0x7d2b('0x2d'),'ignore':![]},{'name':_0x7d2b('0x2e'),'value':_0x7d2b('0x2f'),'ignore':![]},{'name':_0x7d2b('0x30'),'value':_0x7d2b('0x31'),'ignore':![]}];var _0x3168fb=_(_0x95164d)[_0x7d2b('0x32')](_0x7d2b('0x33'))['map']('value')[_0x7d2b('0x34')]();if(_[_0x7d2b('0x35')](_0x3168fb,_0x101a7a[_0x7d2b('0x36')])){return;}var _0x5c5773=_[_0x7d2b('0x37')](_0x95164d,[_0x7d2b('0x34'),_0x101a7a['type']])[_0x7d2b('0x38')];return db[_0x7d2b('0x39')][_0x7d2b('0x3a')]({'where':{'type':_0x5c5773,'resourceId':_0x101a7a['id']}})[_0x7d2b('0x2b')](function(){return _0x3f0aa4;});})[_0x7d2b('0x2b')](function(){_0x5d631d['status'](0xcc)[_0x7d2b('0x21')]();});}};}function handleEntityNotFound(_0x3d4036,_0x2a60eb){return function(_0x12fc3d){if(!_0x12fc3d){_0x3d4036[_0x7d2b('0x1f')](0x194);}return _0x12fc3d;};}function handleError(_0x1a804b,_0x2f563f){_0x2f563f=_0x2f563f||0x1f4;return function(_0x3b5780){logger[_0x7d2b('0x3b')](_0x3b5780['stack']);if(_0x3b5780['name']){delete _0x3b5780['name'];}_0x1a804b[_0x7d2b('0x20')](_0x2f563f)['send'](_0x3b5780);};}exports[_0x7d2b('0x3c')]=function(_0x16d5f9,_0x3c407d){var _0x4cc81d={},_0x3f1c73={},_0x7b5b42={'count':0x0,'rows':[]};var _0x4ba6bf=_[_0x7d2b('0x3d')](db[_0x7d2b('0x3e')][_0x7d2b('0x3f')],function(_0x2edef5){return{'name':_0x2edef5['fieldName'],'type':_0x2edef5[_0x7d2b('0x36')][_0x7d2b('0x40')]};});_0x3f1c73[_0x7d2b('0x41')]=_[_0x7d2b('0x3d')](_0x4ba6bf,_0x7d2b('0x38'));_0x3f1c73[_0x7d2b('0x42')]=_[_0x7d2b('0x43')](_0x16d5f9[_0x7d2b('0x42')]);_0x3f1c73['filters']=_[_0x7d2b('0x44')](_0x3f1c73[_0x7d2b('0x41')],_0x3f1c73[_0x7d2b('0x42')]);_0x4cc81d[_0x7d2b('0x45')]=_['intersection'](_0x3f1c73['model'],qs[_0x7d2b('0x46')](_0x16d5f9['query'][_0x7d2b('0x46')]));_0x4cc81d[_0x7d2b('0x45')]=_0x4cc81d['attributes'][_0x7d2b('0x47')]?_0x4cc81d[_0x7d2b('0x45')]:_0x3f1c73['model'];if(!_0x16d5f9[_0x7d2b('0x42')][_0x7d2b('0x48')](_0x7d2b('0x49'))){_0x4cc81d[_0x7d2b('0x25')]=qs[_0x7d2b('0x25')](_0x16d5f9[_0x7d2b('0x42')][_0x7d2b('0x25')]);_0x4cc81d['offset']=qs[_0x7d2b('0x24')](_0x16d5f9['query']['offset']);}_0x4cc81d[_0x7d2b('0x4a')]=qs['sort'](_0x16d5f9[_0x7d2b('0x42')][_0x7d2b('0x4b')]);_0x4cc81d[_0x7d2b('0x4c')]=qs['filters'](_[_0x7d2b('0x4d')](_0x16d5f9[_0x7d2b('0x42')],_0x3f1c73[_0x7d2b('0x4e')]),_0x4ba6bf);if(_0x16d5f9[_0x7d2b('0x42')][_0x7d2b('0x32')]){_0x4cc81d[_0x7d2b('0x4c')]=_[_0x7d2b('0x4f')](_0x4cc81d['where'],{'$or':_[_0x7d2b('0x3d')](_0x4ba6bf,function(_0x20b7a0){if(_0x20b7a0[_0x7d2b('0x36')]!==_0x7d2b('0x50')){var _0x2ed660={};_0x2ed660[_0x20b7a0[_0x7d2b('0x38')]]={'$like':'%'+_0x16d5f9[_0x7d2b('0x42')]['filter']+'%'};return _0x2ed660;}})});}_0x4cc81d=_['merge']({},_0x4cc81d,_0x16d5f9[_0x7d2b('0x51')]);var _0x372043={'where':_0x4cc81d[_0x7d2b('0x4c')]};return db['VoiceExtension'][_0x7d2b('0x23')](_0x372043)[_0x7d2b('0x2b')](function(_0x27aaeb){_0x7b5b42['count']=_0x27aaeb;if(_0x16d5f9[_0x7d2b('0x42')][_0x7d2b('0x52')]){_0x4cc81d[_0x7d2b('0x53')]=[{'all':!![]}];}return db[_0x7d2b('0x3e')][_0x7d2b('0x54')](_0x4cc81d);})[_0x7d2b('0x2b')](function(_0x2300f5){_0x7b5b42[_0x7d2b('0x55')]=_0x2300f5;return _0x7b5b42;})[_0x7d2b('0x2b')](respondWithFilteredResult(_0x3c407d,_0x4cc81d))[_0x7d2b('0x56')](handleError(_0x3c407d,null));};exports[_0x7d2b('0x57')]=function(_0x536890,_0x460905){var _0x16d3b5={'raw':![],'where':{'id':_0x536890[_0x7d2b('0x58')]['id']}},_0x5c1ceb={};_0x5c1ceb[_0x7d2b('0x41')]=_[_0x7d2b('0x43')](db[_0x7d2b('0x3e')]['rawAttributes']);_0x5c1ceb[_0x7d2b('0x42')]=_[_0x7d2b('0x43')](_0x536890[_0x7d2b('0x42')]);_0x5c1ceb[_0x7d2b('0x4e')]=_['intersection'](_0x5c1ceb[_0x7d2b('0x41')],_0x5c1ceb['query']);_0x16d3b5['attributes']=_['intersection'](_0x5c1ceb['model'],qs[_0x7d2b('0x46')](_0x536890[_0x7d2b('0x42')][_0x7d2b('0x46')]));_0x16d3b5['attributes']=_0x16d3b5[_0x7d2b('0x45')][_0x7d2b('0x47')]?_0x16d3b5[_0x7d2b('0x45')]:_0x5c1ceb[_0x7d2b('0x41')];if(_0x536890['query'][_0x7d2b('0x52')]){_0x16d3b5[_0x7d2b('0x53')]=[{'all':!![]}];}_0x16d3b5=_[_0x7d2b('0x4f')]({},_0x16d3b5,_0x536890['options']);return db['VoiceExtension'][_0x7d2b('0x37')](_0x16d3b5)[_0x7d2b('0x2b')](handleEntityNotFound(_0x460905,null))[_0x7d2b('0x2b')](respondWithResult(_0x460905,null))[_0x7d2b('0x56')](handleError(_0x460905,null));};exports[_0x7d2b('0x3a')]=function(_0x50fcfe,_0x5081f4){return db['VoiceExtension'][_0x7d2b('0x37')]({'where':{'id':_0x50fcfe[_0x7d2b('0x58')]['id']}})[_0x7d2b('0x2b')](handleEntityNotFound(_0x5081f4,null))[_0x7d2b('0x2b')](removeEntity(_0x5081f4,null))[_0x7d2b('0x56')](handleError(_0x5081f4,null));};exports[_0x7d2b('0x59')]=function(_0x22c78d,_0x2b5a04){if(_0x22c78d[_0x7d2b('0x5a')][_0x7d2b('0x36')]===_0x7d2b('0x2f')&&!_[_0x7d2b('0x5b')](_0x22c78d[_0x7d2b('0x5a')][_0x7d2b('0x5c')],'_')){_0x22c78d[_0x7d2b('0x5a')][_0x7d2b('0x5c')]='_'[_0x7d2b('0x5d')](_0x22c78d[_0x7d2b('0x5a')][_0x7d2b('0x5c')]);}return db['VoiceExtension'][_0x7d2b('0x59')](_0x22c78d[_0x7d2b('0x5a')],{'raw':![]})['then'](function(_0x3b253f){var _0x20833e=_0x22c78d[_0x7d2b('0x5e')][_0x7d2b('0x2c')]({'plain':!![]});if(!_0x20833e)throw new Error(_0x7d2b('0x5f'));if(_0x20833e['role']===_0x7d2b('0x5e')){var _0x48c667=_0x3b253f[_0x7d2b('0x2c')]({'plain':!![]});var _0xa9e0b3=[{'name':_0x7d2b('0x60'),'value':_0x7d2b('0x2d')},{'name':_0x7d2b('0x2e'),'value':_0x7d2b('0x2f')},{'name':_0x7d2b('0x30'),'value':'internal'}];var _0x282310=_['find'](_0xa9e0b3,[_0x7d2b('0x34'),_0x48c667['type']])['name'];return db[_0x7d2b('0x61')][_0x7d2b('0x37')]({'where':{'name':_0x282310,'userProfileId':_0x20833e[_0x7d2b('0x62')]},'raw':!![]})[_0x7d2b('0x2b')](function(_0x753ba){if(_0x753ba&&_0x753ba['autoAssociation']===0x0){return db['UserProfileResource'][_0x7d2b('0x59')]({'name':_0x48c667[_0x7d2b('0x38')],'resourceId':_0x48c667['id'],'type':_0x753ba['name'],'sectionId':_0x753ba['id']},{})[_0x7d2b('0x2b')](function(){return _0x3b253f;});}else{return _0x3b253f;}})[_0x7d2b('0x56')](function(_0x251fad){logger[_0x7d2b('0x3b')](_0x7d2b('0x63'),_0x251fad);throw _0x251fad;});}return _0x3b253f;})['then'](respondWithResult(_0x2b5a04,0xc9))['catch'](handleError(_0x2b5a04,null));};exports[_0x7d2b('0x2a')]=function(_0x389a49,_0x403c6f){if(_0x389a49[_0x7d2b('0x5a')]['id']){delete _0x389a49['body']['id'];}return db[_0x7d2b('0x3e')][_0x7d2b('0x37')]({'where':{'id':_0x389a49[_0x7d2b('0x58')]['id']}})[_0x7d2b('0x2b')](handleEntityNotFound(_0x403c6f,null))['then'](function(_0x487e8c){if(_0x487e8c){return db[_0x7d2b('0x3e')][_0x7d2b('0x2a')](_[_0x7d2b('0x4d')](_0x389a49['body'],[_0x7d2b('0x5c'),_0x7d2b('0x64'),_0x7d2b('0x65'),_0x7d2b('0x66'),_0x7d2b('0x67'),_0x7d2b('0x68')]),{'where':{'context':_0x487e8c[_0x7d2b('0x64')],'exten':_0x487e8c['exten']},'individualHooks':!![]})[_0x7d2b('0x2b')](function(_0xd9ca1a){return _0xd9ca1a;});}return null;})[_0x7d2b('0x2b')](respondWithStatusCode(_0x403c6f,null))[_0x7d2b('0x56')](handleError(_0x403c6f,null));};exports[_0x7d2b('0x69')]=function(_0x383769,_0x21679f,_0x4394f9){return db['VoiceExtension'][_0x7d2b('0x6a')]({'where':{'id':_0x383769[_0x7d2b('0x58')]['id']}})['then'](handleEntityNotFound(_0x21679f,null))[_0x7d2b('0x2b')](function(_0x3b595d){if(_0x3b595d){return db['sequelize'][_0x7d2b('0x6b')](function(_0x16a925){return db[_0x7d2b('0x3e')][_0x7d2b('0x3a')]({'where':{'VoiceExtensionId':_0x383769[_0x7d2b('0x58')]['id']},'transaction':_0x16a925})[_0x7d2b('0x2b')](function(_0x3441f6){var _0x538f58=_[_0x7d2b('0x3d')](_0x383769[_0x7d2b('0x5a')],function(_0x324bf9){_0x324bf9[_0x7d2b('0x6c')]=_0x383769['params']['id'];return _0x324bf9;});return db[_0x7d2b('0x3e')][_0x7d2b('0x6d')](_0x538f58,{'transaction':_0x16a925});});})['then'](function(){return db['VoiceExtension'][_0x7d2b('0x6e')]({'where':{'isApp':!![],'VoiceExtensionId':_0x383769[_0x7d2b('0x58')]['id']},'order':_0x7d2b('0x6f')});});}})[_0x7d2b('0x2b')](respondWithResult(_0x21679f,null))[_0x7d2b('0x56')](handleError(_0x21679f,null));}; \ No newline at end of file +var _0x41f0=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','destroy','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','ignore','map','value','includes','type','find','name','UserProfileResource','then','send','index','rawAttributes','fieldName','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','VoiceExtension','includeAll','include','rows','catch','show','params','create','body','outbound','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','update','pick','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs'];(function(_0x29852c,_0x2342ab){var _0x239a4b=function(_0x11defe){while(--_0x11defe){_0x29852c['push'](_0x29852c['shift']());}};_0x239a4b(++_0x2342ab);}(_0x41f0,0xc2));var _0x041f=function(_0x2c4bcf,_0x12eaad){_0x2c4bcf=_0x2c4bcf-0x0;var _0x5e9ac1=_0x41f0[_0x2c4bcf];return _0x5e9ac1;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x041f('0x0'));var jsonpatch=require(_0x041f('0x1'));var rp=require(_0x041f('0x2'));var moment=require('moment');var BPromise=require(_0x041f('0x3'));var Mustache=require(_0x041f('0x4'));var util=require(_0x041f('0x5'));var path=require(_0x041f('0x6'));var sox=require(_0x041f('0x7'));var csv=require(_0x041f('0x8'));var ejs=require(_0x041f('0x9'));var fs=require('fs');var _=require(_0x041f('0xa'));var squel=require(_0x041f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x041f('0xc'));var toCsv=require(_0x041f('0x8'));var querystring=require('querystring');var Papa=require(_0x041f('0xd'));var Redis=require(_0x041f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x041f('0xf'));var as=require(_0x041f('0x10'));var hardwareService=require(_0x041f('0x11'));var logger=require(_0x041f('0x12'))(_0x041f('0x13'));var utils=require(_0x041f('0x14'));var config=require(_0x041f('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x041f('0x16')](config[_0x041f('0x17')],{'host':_0x041f('0x18'),'port':0x18eb});var socket=require(_0x041f('0x19'))(new Redis(config[_0x041f('0x17')]));require(_0x041f('0x1a'))[_0x041f('0x1b')](socket);function respondWithStatusCode(_0x3f59e3,_0x2c946b){_0x2c946b=_0x2c946b||0xcc;return function(_0x3b2fb0){if(_0x3b2fb0){return _0x3f59e3[_0x041f('0x1c')](_0x2c946b);}return _0x3f59e3[_0x041f('0x1d')](_0x2c946b)[_0x041f('0x1e')]();};}function respondWithResult(_0xa1a1dc,_0x325160){_0x325160=_0x325160||0xc8;return function(_0x92735){if(_0x92735){return _0xa1a1dc[_0x041f('0x1d')](_0x325160)[_0x041f('0x1f')](_0x92735);}};}function respondWithFilteredResult(_0x2e132f,_0x28f705){return function(_0x2b69fc){if(_0x2b69fc){var _0x19f1fc=_0x2b69fc[_0x041f('0x20')],_0x166264=_0x28f705[_0x041f('0x21')],_0x4cbb1c=_0x28f705[_0x041f('0x21')]+_0x28f705[_0x041f('0x22')],_0x59bf1f;if(_0x4cbb1c>=_0x19f1fc){_0x4cbb1c=_0x19f1fc;_0x59bf1f=0xc8;}else{_0x59bf1f=0xce;}_0x2e132f[_0x041f('0x1d')](_0x59bf1f);return _0x2e132f[_0x041f('0x23')](_0x041f('0x24'),_0x166264+'-'+_0x4cbb1c+'/'+_0x19f1fc)[_0x041f('0x1f')](_0x2b69fc);}return null;};}function patchUpdates(_0x5e1917){return function(_0x4dcc36){try{jsonpatch[_0x041f('0x25')](_0x4dcc36,_0x5e1917,!![]);}catch(_0x3c26ec){return BPromise['reject'](_0x3c26ec);}return _0x4dcc36['save']();};}function saveUpdates(_0x241ab6,_0x93514){return function(_0x1e9736){if(_0x1e9736){return _0x1e9736['update'](_0x241ab6)['then'](function(_0x244d84){return _0x244d84;});}return null;};}function removeEntity(_0x18a808,_0x159f6d){return function(_0x4dbe84){if(_0x4dbe84){return _0x4dbe84[_0x041f('0x26')]()['then'](function(){var _0x2b1ca0=_0x4dbe84[_0x041f('0x27')]({'plain':!![]});var _0x1713a7=[{'name':_0x041f('0x28'),'value':_0x041f('0x29'),'ignore':![]},{'name':_0x041f('0x2a'),'value':'outbound','ignore':![]},{'name':_0x041f('0x2b'),'value':_0x041f('0x2c'),'ignore':![]}];var _0x1fc5d6=_(_0x1713a7)['filter'](_0x041f('0x2d'))[_0x041f('0x2e')]('value')[_0x041f('0x2f')]();if(_[_0x041f('0x30')](_0x1fc5d6,_0x2b1ca0[_0x041f('0x31')])){return;}var _0x54455d=_[_0x041f('0x32')](_0x1713a7,[_0x041f('0x2f'),_0x2b1ca0[_0x041f('0x31')]])[_0x041f('0x33')];return db[_0x041f('0x34')][_0x041f('0x26')]({'where':{'type':_0x54455d,'resourceId':_0x2b1ca0['id']}})[_0x041f('0x35')](function(){return _0x4dbe84;});})[_0x041f('0x35')](function(){_0x18a808['status'](0xcc)[_0x041f('0x1e')]();});}};}function handleEntityNotFound(_0x411019,_0x272467){return function(_0x406ecb){if(!_0x406ecb){_0x411019[_0x041f('0x1c')](0x194);}return _0x406ecb;};}function handleError(_0x188ac7,_0x45c3b8){_0x45c3b8=_0x45c3b8||0x1f4;return function(_0x32ebfa){logger['error'](_0x32ebfa['stack']);if(_0x32ebfa[_0x041f('0x33')]){delete _0x32ebfa[_0x041f('0x33')];}_0x188ac7[_0x041f('0x1d')](_0x45c3b8)[_0x041f('0x36')](_0x32ebfa);};}exports[_0x041f('0x37')]=function(_0x11430e,_0x4d88ad){var _0x150772={},_0x51fdd1={},_0x125e6a={'count':0x0,'rows':[]};var _0x48510e=_[_0x041f('0x2e')](db['VoiceExtension'][_0x041f('0x38')],function(_0x4739a7){return{'name':_0x4739a7[_0x041f('0x39')],'type':_0x4739a7[_0x041f('0x31')]['key']};});_0x51fdd1['model']=_['map'](_0x48510e,_0x041f('0x33'));_0x51fdd1['query']=_[_0x041f('0x3a')](_0x11430e[_0x041f('0x3b')]);_0x51fdd1['filters']=_['intersection'](_0x51fdd1['model'],_0x51fdd1['query']);_0x150772['attributes']=_[_0x041f('0x3c')](_0x51fdd1[_0x041f('0x3d')],qs[_0x041f('0x3e')](_0x11430e[_0x041f('0x3b')]['fields']));_0x150772['attributes']=_0x150772[_0x041f('0x3f')][_0x041f('0x40')]?_0x150772[_0x041f('0x3f')]:_0x51fdd1[_0x041f('0x3d')];if(!_0x11430e[_0x041f('0x3b')][_0x041f('0x41')]('nolimit')){_0x150772[_0x041f('0x22')]=qs[_0x041f('0x22')](_0x11430e['query'][_0x041f('0x22')]);_0x150772['offset']=qs[_0x041f('0x21')](_0x11430e[_0x041f('0x3b')][_0x041f('0x21')]);}_0x150772[_0x041f('0x42')]=qs[_0x041f('0x43')](_0x11430e['query'][_0x041f('0x43')]);_0x150772['where']=qs[_0x041f('0x44')](_['pick'](_0x11430e[_0x041f('0x3b')],_0x51fdd1[_0x041f('0x44')]),_0x48510e);if(_0x11430e[_0x041f('0x3b')][_0x041f('0x45')]){_0x150772[_0x041f('0x46')]=_[_0x041f('0x47')](_0x150772['where'],{'$or':_[_0x041f('0x2e')](_0x48510e,function(_0x4b8b48){if(_0x4b8b48[_0x041f('0x31')]!==_0x041f('0x48')){var _0x161d50={};_0x161d50[_0x4b8b48['name']]={'$like':'%'+_0x11430e['query'][_0x041f('0x45')]+'%'};return _0x161d50;}})});}_0x150772=_[_0x041f('0x47')]({},_0x150772,_0x11430e[_0x041f('0x49')]);var _0x30962c={'where':_0x150772['where']};return db[_0x041f('0x4a')]['count'](_0x30962c)[_0x041f('0x35')](function(_0x4a6895){_0x125e6a[_0x041f('0x20')]=_0x4a6895;if(_0x11430e[_0x041f('0x3b')][_0x041f('0x4b')]){_0x150772[_0x041f('0x4c')]=[{'all':!![]}];}return db[_0x041f('0x4a')]['findAll'](_0x150772);})['then'](function(_0x31a953){_0x125e6a[_0x041f('0x4d')]=_0x31a953;return _0x125e6a;})['then'](respondWithFilteredResult(_0x4d88ad,_0x150772))[_0x041f('0x4e')](handleError(_0x4d88ad,null));};exports[_0x041f('0x4f')]=function(_0x242bef,_0xe5a726){var _0x309585={'raw':![],'where':{'id':_0x242bef[_0x041f('0x50')]['id']}},_0x305b86={};_0x305b86[_0x041f('0x3d')]=_[_0x041f('0x3a')](db[_0x041f('0x4a')]['rawAttributes']);_0x305b86['query']=_[_0x041f('0x3a')](_0x242bef[_0x041f('0x3b')]);_0x305b86[_0x041f('0x44')]=_['intersection'](_0x305b86['model'],_0x305b86[_0x041f('0x3b')]);_0x309585[_0x041f('0x3f')]=_[_0x041f('0x3c')](_0x305b86['model'],qs[_0x041f('0x3e')](_0x242bef[_0x041f('0x3b')]['fields']));_0x309585['attributes']=_0x309585['attributes'][_0x041f('0x40')]?_0x309585[_0x041f('0x3f')]:_0x305b86['model'];if(_0x242bef[_0x041f('0x3b')][_0x041f('0x4b')]){_0x309585[_0x041f('0x4c')]=[{'all':!![]}];}_0x309585=_[_0x041f('0x47')]({},_0x309585,_0x242bef[_0x041f('0x49')]);return db[_0x041f('0x4a')][_0x041f('0x32')](_0x309585)[_0x041f('0x35')](handleEntityNotFound(_0xe5a726,null))['then'](respondWithResult(_0xe5a726,null))[_0x041f('0x4e')](handleError(_0xe5a726,null));};exports['destroy']=function(_0x45c8bd,_0x3c1c0b){return db[_0x041f('0x4a')]['find']({'where':{'id':_0x45c8bd[_0x041f('0x50')]['id']}})[_0x041f('0x35')](handleEntityNotFound(_0x3c1c0b,null))[_0x041f('0x35')](removeEntity(_0x3c1c0b,null))[_0x041f('0x4e')](handleError(_0x3c1c0b,null));};exports[_0x041f('0x51')]=function(_0x1f47d5,_0x2f7067){if(_0x1f47d5[_0x041f('0x52')]['type']===_0x041f('0x53')&&!_[_0x041f('0x54')](_0x1f47d5[_0x041f('0x52')][_0x041f('0x55')],'_')){_0x1f47d5[_0x041f('0x52')][_0x041f('0x55')]='_'[_0x041f('0x56')](_0x1f47d5['body'][_0x041f('0x55')]);}return db[_0x041f('0x4a')]['create'](_0x1f47d5[_0x041f('0x52')],{'raw':![]})[_0x041f('0x35')](function(_0x95324d){var _0x19b8b8=_0x1f47d5[_0x041f('0x57')][_0x041f('0x27')]({'plain':!![]});if(!_0x19b8b8)throw new Error(_0x041f('0x58'));if(_0x19b8b8[_0x041f('0x59')]==='user'){var _0x538e05=_0x95324d[_0x041f('0x27')]({'plain':!![]});var _0x237928=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x041f('0x2a'),'value':_0x041f('0x53')},{'name':_0x041f('0x2b'),'value':_0x041f('0x2c')}];var _0xf92f8e=_['find'](_0x237928,['value',_0x538e05['type']])[_0x041f('0x33')];return db['UserProfileSection'][_0x041f('0x32')]({'where':{'name':_0xf92f8e,'userProfileId':_0x19b8b8[_0x041f('0x5a')]},'raw':!![]})['then'](function(_0xfe092){if(_0xfe092&&_0xfe092[_0x041f('0x5b')]===0x0){return db[_0x041f('0x34')]['create']({'name':_0x538e05['name'],'resourceId':_0x538e05['id'],'type':_0xfe092['name'],'sectionId':_0xfe092['id']},{})[_0x041f('0x35')](function(){return _0x95324d;});}else{return _0x95324d;}})['catch'](function(_0x347079){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x347079);throw _0x347079;});}return _0x95324d;})[_0x041f('0x35')](respondWithResult(_0x2f7067,0xc9))[_0x041f('0x4e')](handleError(_0x2f7067,null));};exports[_0x041f('0x5c')]=function(_0x1da91e,_0x5c21e9){if(_0x1da91e['body']['id']){delete _0x1da91e['body']['id'];}return db[_0x041f('0x4a')]['find']({'where':{'id':_0x1da91e[_0x041f('0x50')]['id']}})[_0x041f('0x35')](handleEntityNotFound(_0x5c21e9,null))['then'](function(_0x320e40){if(_0x320e40){return db[_0x041f('0x4a')][_0x041f('0x5c')](_[_0x041f('0x5d')](_0x1da91e[_0x041f('0x52')],['exten',_0x041f('0x5e'),_0x041f('0x5f'),_0x041f('0x60'),_0x041f('0x61'),_0x041f('0x62')]),{'where':{'context':_0x320e40[_0x041f('0x5e')],'exten':_0x320e40['exten']},'individualHooks':!![]})['then'](function(_0x309971){return _0x309971;});}return null;})[_0x041f('0x35')](respondWithStatusCode(_0x5c21e9,null))['catch'](handleError(_0x5c21e9,null));};exports[_0x041f('0x63')]=function(_0x4821af,_0x74c2f1,_0x408ce0){return db['VoiceExtension'][_0x041f('0x64')]({'where':{'id':_0x4821af[_0x041f('0x50')]['id']}})[_0x041f('0x35')](handleEntityNotFound(_0x74c2f1,null))[_0x041f('0x35')](function(_0x2c4418){if(_0x2c4418){return db[_0x041f('0x65')][_0x041f('0x66')](function(_0x2c31d1){return db['VoiceExtension'][_0x041f('0x26')]({'where':{'VoiceExtensionId':_0x4821af[_0x041f('0x50')]['id']},'transaction':_0x2c31d1})['then'](function(_0x43ecd7){var _0x12e299=_[_0x041f('0x2e')](_0x4821af[_0x041f('0x52')],function(_0x337fb2){_0x337fb2[_0x041f('0x67')]=_0x4821af['params']['id'];return _0x337fb2;});return db[_0x041f('0x4a')][_0x041f('0x68')](_0x12e299,{'transaction':_0x2c31d1});});})[_0x041f('0x35')](function(){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x4821af['params']['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})['then'](respondWithResult(_0x74c2f1,null))[_0x041f('0x4e')](handleError(_0x74c2f1,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index cfd31c3..c6bd6c4 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 _0x5d80=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x48e178,_0x32b219){var _0x38d099=function(_0x2caf8e){while(--_0x2caf8e){_0x48e178['push'](_0x48e178['shift']());}};_0x38d099(++_0x32b219);}(_0x5d80,0x1b2));var _0x05d8=function(_0x4a4053,_0x3d302e){_0x4a4053=_0x4a4053-0x0;var _0x31b530=_0x5d80[_0x4a4053];return _0x31b530;};'use strict';var EventEmitter=require(_0x05d8('0x0'));var VoiceExtension=require(_0x05d8('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x05d8('0x2')](0x0);var events={'afterCreate':_0x05d8('0x3'),'afterUpdate':_0x05d8('0x4'),'afterDestroy':_0x05d8('0x5')};function emitEvent(_0xc64ef){return function(_0x3112ec,_0x5d2c39,_0x291479){VoiceExtensionEvents[_0x05d8('0x6')](_0xc64ef+':'+_0x3112ec['id'],_0x3112ec);VoiceExtensionEvents['emit'](_0xc64ef,_0x3112ec);_0x291479(null);};}for(var e in events){if(events[_0x05d8('0x7')](e)){var event=events[e];VoiceExtension[_0x05d8('0x8')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x358c=['events','../../mysqldb','VoiceExtension','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x538950,_0x3fd9a9){var _0x28e658=function(_0x50ed99){while(--_0x50ed99){_0x538950['push'](_0x538950['shift']());}};_0x28e658(++_0x3fd9a9);}(_0x358c,0x87));var _0xc358=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x358c[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xc358('0x0'));var VoiceExtension=require(_0xc358('0x1'))['db'][_0xc358('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xc358('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc358('0x4'),'afterDestroy':_0xc358('0x5')};function emitEvent(_0x5d2cec){return function(_0x30e421,_0x3ff5d8,_0x13579a){VoiceExtensionEvents['emit'](_0x5d2cec+':'+_0x30e421['id'],_0x30e421);VoiceExtensionEvents[_0xc358('0x6')](_0x5d2cec,_0x30e421);_0x13579a(null);};}for(var e in events){if(events[_0xc358('0x7')](e)){var event=events[e];VoiceExtension[_0xc358('0x8')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 3fd1029..95a953e 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 _0x442e=['api','moment','bluebird','request-promise','rimraf','../../config/environment','define','VoiceExtension','lodash','util','../../config/logger'];(function(_0x51f4bc,_0x34870e){var _0x416811=function(_0x2783a4){while(--_0x2783a4){_0x51f4bc['push'](_0x51f4bc['shift']());}};_0x416811(++_0x34870e);}(_0x442e,0x1e1));var _0xe442=function(_0x30fe26,_0x1abe7c){_0x30fe26=_0x30fe26-0x0;var _0x3aaeb0=_0x442e[_0x30fe26];return _0x3aaeb0;};'use strict';var _=require(_0xe442('0x0'));var util=require(_0xe442('0x1'));var logger=require(_0xe442('0x2'))(_0xe442('0x3'));var moment=require(_0xe442('0x4'));var BPromise=require(_0xe442('0x5'));var rp=require(_0xe442('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe442('0x7'));var config=require(_0xe442('0x8'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x228c81,_0x4c970a){return _0x228c81[_0xe442('0x9')](_0xe442('0xa'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa685=['voice_extensions','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceExtension'];(function(_0x48f41f,_0x233a48){var _0x56005e=function(_0x3e7011){while(--_0x3e7011){_0x48f41f['push'](_0x48f41f['shift']());}};_0x56005e(++_0x233a48);}(_0xa685,0x12a));var _0x5a68=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa685[_0x38a7ac];return _0x53061a;};'use strict';var _=require('lodash');var util=require(_0x5a68('0x0'));var logger=require(_0x5a68('0x1'))('api');var moment=require(_0x5a68('0x2'));var BPromise=require(_0x5a68('0x3'));var rp=require(_0x5a68('0x4'));var fs=require('fs');var path=require(_0x5a68('0x5'));var rimraf=require(_0x5a68('0x6'));var config=require(_0x5a68('0x7'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x11361a,_0x15b90e){return _0x11361a[_0x5a68('0x8')](_0x5a68('0x9'),attributes,{'tableName':_0x5a68('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index d55ea2e..f501602 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 _0xea74=['options','raw','where','attributes','limit','map','model','include','GetVoiceExtension','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','redis','defaults','socket.io-emitter','register','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','VoiceExtension','findAll'];(function(_0x390623,_0x583799){var _0x55af68=function(_0x57da5b){while(--_0x57da5b){_0x390623['push'](_0x390623['shift']());}};_0x55af68(++_0x583799);}(_0xea74,0x75));var _0x4ea7=function(_0x38b097,_0xf7f7f4){_0x38b097=_0x38b097-0x0;var _0xdc8bb4=_0xea74[_0x38b097];return _0xdc8bb4;};'use strict';var _=require(_0x4ea7('0x0'));var util=require(_0x4ea7('0x1'));var moment=require(_0x4ea7('0x2'));var BPromise=require(_0x4ea7('0x3'));var rs=require(_0x4ea7('0x4'));var fs=require('fs');var Redis=require(_0x4ea7('0x5'));var db=require(_0x4ea7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4ea7('0x7'))(_0x4ea7('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4ea7('0x9')]({'port':0x232a});config[_0x4ea7('0xa')]=_[_0x4ea7('0xb')](config[_0x4ea7('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ea7('0xc'))(new Redis(config[_0x4ea7('0xa')]));require('./voiceExtension.socket')[_0x4ea7('0xd')](socket);function respondWithRpcPromise(_0x58c0a3,_0x43a705,_0x336eaf){return new BPromise(function(_0x9f0a08,_0x509c6f){return client['request'](_0x58c0a3,_0x336eaf)[_0x4ea7('0xe')](function(_0xce6734){logger['info'](_0x4ea7('0xf'),_0x43a705,_0x4ea7('0x10'));logger[_0x4ea7('0x11')](_0x4ea7('0x12'),_0x43a705,_0x4ea7('0x10'),JSON[_0x4ea7('0x13')](_0xce6734));if(_0xce6734[_0x4ea7('0x14')]){if(_0xce6734[_0x4ea7('0x14')]['code']===0x1f4){logger[_0x4ea7('0x14')](_0x4ea7('0xf'),_0x43a705,_0xce6734[_0x4ea7('0x14')][_0x4ea7('0x15')]);return _0x509c6f(_0xce6734[_0x4ea7('0x14')][_0x4ea7('0x15')]);}logger[_0x4ea7('0x14')](_0x4ea7('0xf'),_0x43a705,_0xce6734[_0x4ea7('0x14')][_0x4ea7('0x15')]);return _0x9f0a08(_0xce6734[_0x4ea7('0x14')]['message']);}else{logger[_0x4ea7('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x43a705,_0x4ea7('0x10'));_0x9f0a08(_0xce6734[_0x4ea7('0x17')][_0x4ea7('0x15')]);}})[_0x4ea7('0x18')](function(_0x4978ee){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x43a705,_0x4978ee);_0x509c6f(_0x4978ee);});});}exports['GetVoiceExtension']=function(_0x13ffdf){var _0x3a8925=this;return new Promise(function(_0x17428a,_0x23fdb4){return db[_0x4ea7('0x19')][_0x4ea7('0x1a')]({'raw':_0x13ffdf[_0x4ea7('0x1b')]?_0x13ffdf[_0x4ea7('0x1b')][_0x4ea7('0x1c')]===undefined?!![]:![]:!![],'where':_0x13ffdf[_0x4ea7('0x1b')]?_0x13ffdf[_0x4ea7('0x1b')][_0x4ea7('0x1d')]||null:null,'attributes':_0x13ffdf['options']?_0x13ffdf[_0x4ea7('0x1b')][_0x4ea7('0x1e')]||null:null,'limit':_0x13ffdf[_0x4ea7('0x1b')]?_0x13ffdf[_0x4ea7('0x1b')][_0x4ea7('0x1f')]||null:null,'include':_0x13ffdf[_0x4ea7('0x1b')]?_0x13ffdf[_0x4ea7('0x1b')]['include']?_[_0x4ea7('0x20')](_0x13ffdf[_0x4ea7('0x1b')]['include'],function(_0x41c9c2){return{'model':db[_0x41c9c2[_0x4ea7('0x21')]],'as':_0x41c9c2['as'],'attributes':_0x41c9c2[_0x4ea7('0x1e')],'include':_0x41c9c2[_0x4ea7('0x22')]?_['map'](_0x41c9c2['include'],function(_0x36815d){return{'model':db[_0x36815d[_0x4ea7('0x21')]],'as':_0x36815d['as'],'attributes':_0x36815d[_0x4ea7('0x1e')],'include':_0x36815d[_0x4ea7('0x22')]?_[_0x4ea7('0x20')](_0x36815d[_0x4ea7('0x22')],function(_0x4f9e19){return{'model':db[_0x4f9e19[_0x4ea7('0x21')]],'as':_0x4f9e19['as'],'attributes':_0x4f9e19['attributes']};}):[]};}):[]};}):[]:[]})[_0x4ea7('0xe')](function(_0x35068a){logger[_0x4ea7('0x16')](_0x4ea7('0x23'),_0x13ffdf);logger[_0x4ea7('0x11')]('GetVoiceExtension',_0x13ffdf,JSON[_0x4ea7('0x13')](_0x35068a));_0x17428a(_0x35068a);})['catch'](function(_0x2a8382){logger[_0x4ea7('0x14')]('GetVoiceExtension',_0x2a8382[_0x4ea7('0x15')],_0x13ffdf);_0x23fdb4(_0x3a8925[_0x4ea7('0x14')](0x1f4,_0x2a8382[_0x4ea7('0x15')]));});});}; \ No newline at end of file +var _0xf2b8=['request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceExtension','findAll','options','where','attributes','limit','map','model','include','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','./voiceExtension.socket','register'];(function(_0x56d3dd,_0x50cb43){var _0x3a6102=function(_0x168898){while(--_0x168898){_0x56d3dd['push'](_0x56d3dd['shift']());}};_0x3a6102(++_0x50cb43);}(_0xf2b8,0x196));var _0x8f2b=function(_0x2dbadf,_0x315583){_0x2dbadf=_0x2dbadf-0x0;var _0x26111d=_0xf2b8[_0x2dbadf];return _0x26111d;};'use strict';var _=require(_0x8f2b('0x0'));var util=require(_0x8f2b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8f2b('0x2'));var fs=require('fs');var Redis=require(_0x8f2b('0x3'));var db=require(_0x8f2b('0x4'))['db'];var utils=require(_0x8f2b('0x5'));var logger=require('../../config/logger')(_0x8f2b('0x6'));var config=require(_0x8f2b('0x7'));var jayson=require(_0x8f2b('0x8'));var client=jayson['client'][_0x8f2b('0x9')]({'port':0x232a});config[_0x8f2b('0xa')]=_['defaults'](config[_0x8f2b('0xa')],{'host':_0x8f2b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8f2b('0xc'))[_0x8f2b('0xd')](socket);function respondWithRpcPromise(_0xe358d4,_0x52b8c3,_0x5146dd){return new BPromise(function(_0x8d7b6a,_0x47e1d4){return client[_0x8f2b('0xe')](_0xe358d4,_0x5146dd)[_0x8f2b('0xf')](function(_0x12192d){logger[_0x8f2b('0x10')](_0x8f2b('0x11'),_0x52b8c3,_0x8f2b('0x12'));logger[_0x8f2b('0x13')](_0x8f2b('0x14'),_0x52b8c3,_0x8f2b('0x12'),JSON[_0x8f2b('0x15')](_0x12192d));if(_0x12192d[_0x8f2b('0x16')]){if(_0x12192d[_0x8f2b('0x16')][_0x8f2b('0x17')]===0x1f4){logger[_0x8f2b('0x16')](_0x8f2b('0x11'),_0x52b8c3,_0x12192d[_0x8f2b('0x16')][_0x8f2b('0x18')]);return _0x47e1d4(_0x12192d[_0x8f2b('0x16')][_0x8f2b('0x18')]);}logger['error'](_0x8f2b('0x11'),_0x52b8c3,_0x12192d[_0x8f2b('0x16')]['message']);return _0x8d7b6a(_0x12192d[_0x8f2b('0x16')][_0x8f2b('0x18')]);}else{logger[_0x8f2b('0x10')](_0x8f2b('0x11'),_0x52b8c3,_0x8f2b('0x12'));_0x8d7b6a(_0x12192d[_0x8f2b('0x19')][_0x8f2b('0x18')]);}})['catch'](function(_0x64b5c1){logger[_0x8f2b('0x16')](_0x8f2b('0x11'),_0x52b8c3,_0x64b5c1);_0x47e1d4(_0x64b5c1);});});}exports[_0x8f2b('0x1a')]=function(_0x2b35c6){var _0x4328b4=this;return new Promise(function(_0x288d2b,_0x1ede1b){return db['VoiceExtension'][_0x8f2b('0x1b')]({'raw':_0x2b35c6[_0x8f2b('0x1c')]?_0x2b35c6[_0x8f2b('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2b35c6[_0x8f2b('0x1c')]?_0x2b35c6[_0x8f2b('0x1c')][_0x8f2b('0x1d')]||null:null,'attributes':_0x2b35c6['options']?_0x2b35c6[_0x8f2b('0x1c')][_0x8f2b('0x1e')]||null:null,'limit':_0x2b35c6[_0x8f2b('0x1c')]?_0x2b35c6[_0x8f2b('0x1c')][_0x8f2b('0x1f')]||null:null,'include':_0x2b35c6['options']?_0x2b35c6[_0x8f2b('0x1c')]['include']?_[_0x8f2b('0x20')](_0x2b35c6['options']['include'],function(_0x5c468e){return{'model':db[_0x5c468e[_0x8f2b('0x21')]],'as':_0x5c468e['as'],'attributes':_0x5c468e[_0x8f2b('0x1e')],'include':_0x5c468e[_0x8f2b('0x22')]?_[_0x8f2b('0x20')](_0x5c468e[_0x8f2b('0x22')],function(_0x201c6e){return{'model':db[_0x201c6e[_0x8f2b('0x21')]],'as':_0x201c6e['as'],'attributes':_0x201c6e[_0x8f2b('0x1e')],'include':_0x201c6e[_0x8f2b('0x22')]?_['map'](_0x201c6e[_0x8f2b('0x22')],function(_0x16106f){return{'model':db[_0x16106f[_0x8f2b('0x21')]],'as':_0x16106f['as'],'attributes':_0x16106f[_0x8f2b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8f2b('0xf')](function(_0xf6f92a){logger[_0x8f2b('0x10')](_0x8f2b('0x1a'),_0x2b35c6);logger['debug'](_0x8f2b('0x1a'),_0x2b35c6,JSON[_0x8f2b('0x15')](_0xf6f92a));_0x288d2b(_0xf6f92a);})['catch'](function(_0x2255fe){logger[_0x8f2b('0x16')](_0x8f2b('0x1a'),_0x2255fe[_0x8f2b('0x18')],_0x2b35c6);_0x1ede1b(_0x4328b4['error'](0x1f4,_0x2255fe[_0x8f2b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index c49361e..82653a8 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 _0xce62=['voiceExtension:','./voiceExtension.events','save','remove','update','removeListener','register','length'];(function(_0x2d89ea,_0x1d9ad3){var _0x435498=function(_0x593754){while(--_0x593754){_0x2d89ea['push'](_0x2d89ea['shift']());}};_0x435498(++_0x1d9ad3);}(_0xce62,0x1f1));var _0x2ce6=function(_0x4d8ade,_0x5317a1){_0x4d8ade=_0x4d8ade-0x0;var _0x53f3a5=_0xce62[_0x4d8ade];return _0x53f3a5;};'use strict';var VoiceExtensionEvents=require(_0x2ce6('0x0'));var events=[_0x2ce6('0x1'),_0x2ce6('0x2'),_0x2ce6('0x3')];function createListener(_0x4c783b,_0x5b1a49){return function(_0x29bee5){_0x5b1a49['emit'](_0x4c783b,_0x29bee5);};}function removeListener(_0x174da8,_0x7b0a72){return function(){VoiceExtensionEvents[_0x2ce6('0x4')](_0x174da8,_0x7b0a72);};}exports[_0x2ce6('0x5')]=function(_0x44857d){for(var _0x14afd2=0x0,_0x26ed8f=events[_0x2ce6('0x6')];_0x14afd2<_0x26ed8f;_0x14afd2++){var _0x21bc8b=events[_0x14afd2];var _0x4563cd=createListener(_0x2ce6('0x7')+_0x21bc8b,_0x44857d);VoiceExtensionEvents['on'](_0x21bc8b,_0x4563cd);}}; \ No newline at end of file +var _0x3c88=['save','remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events'];(function(_0x50d788,_0x73ab6c){var _0x368bf7=function(_0x2432fb){while(--_0x2432fb){_0x50d788['push'](_0x50d788['shift']());}};_0x368bf7(++_0x73ab6c);}(_0x3c88,0x167));var _0x83c8=function(_0x321b55,_0x351675){_0x321b55=_0x321b55-0x0;var _0x4a7c81=_0x3c88[_0x321b55];return _0x4a7c81;};'use strict';var VoiceExtensionEvents=require(_0x83c8('0x0'));var events=[_0x83c8('0x1'),_0x83c8('0x2'),'update'];function createListener(_0x371cfb,_0x1a3776){return function(_0x57bc61){_0x1a3776[_0x83c8('0x3')](_0x371cfb,_0x57bc61);};}function removeListener(_0x4b0a9b,_0x12eb9f){return function(){VoiceExtensionEvents[_0x83c8('0x4')](_0x4b0a9b,_0x12eb9f);};}exports[_0x83c8('0x5')]=function(_0x519e65){for(var _0x55f0fc=0x0,_0x57eb1e=events[_0x83c8('0x6')];_0x55f0fc<_0x57eb1e;_0x55f0fc++){var _0x24dc5f=events[_0x55f0fc];var _0x5408ca=createListener(_0x83c8('0x7')+_0x24dc5f,_0x519e65);VoiceExtensionEvents['on'](_0x24dc5f,_0x5408ca);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 8ec159e..91d41ec 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 _0xf5a1=['put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','/:id','isAuthenticated','show','getMessages','post','create'];(function(_0x3adad8,_0x5aef55){var _0x177095=function(_0x5eadaa){while(--_0x5eadaa){_0x3adad8['push'](_0x3adad8['shift']());}};_0x177095(++_0x5aef55);}(_0xf5a1,0x144));var _0x1f5a=function(_0x48199b,_0x299b9d){_0x48199b=_0x48199b-0x0;var _0x1bd11e=_0xf5a1[_0x48199b];return _0x1bd11e;};'use strict';var multer=require('multer');var util=require(_0x1f5a('0x0'));var path=require(_0x1f5a('0x1'));var timeout=require(_0x1f5a('0x2'));var express=require(_0x1f5a('0x3'));var router=express[_0x1f5a('0x4')]();var auth=require(_0x1f5a('0x5'));var interaction=require(_0x1f5a('0x6'));var config=require(_0x1f5a('0x7'));var controller=require(_0x1f5a('0x8'));router[_0x1f5a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1f5a('0x9')](_0x1f5a('0xa'),auth[_0x1f5a('0xb')](),controller[_0x1f5a('0xc')]);router['get']('/:id/messages',auth[_0x1f5a('0xb')](),controller[_0x1f5a('0xd')]);router[_0x1f5a('0xe')]('/',auth[_0x1f5a('0xb')](),controller[_0x1f5a('0xf')]);router[_0x1f5a('0x10')](_0x1f5a('0xa'),auth[_0x1f5a('0xb')](),controller[_0x1f5a('0x11')]);router[_0x1f5a('0x12')](_0x1f5a('0xa'),auth[_0x1f5a('0xb')](),controller[_0x1f5a('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5f5b=['put','delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','post','create'];(function(_0x2ccf28,_0x34d86d){var _0x5ca416=function(_0x18fc3b){while(--_0x18fc3b){_0x2ccf28['push'](_0x2ccf28['shift']());}};_0x5ca416(++_0x34d86d);}(_0x5f5b,0xe1));var _0xb5f5=function(_0x466538,_0x24ca73){_0x466538=_0x466538-0x0;var _0x3e7489=_0x5f5b[_0x466538];return _0x3e7489;};'use strict';var multer=require('multer');var util=require(_0xb5f5('0x0'));var path=require('path');var timeout=require(_0xb5f5('0x1'));var express=require(_0xb5f5('0x2'));var router=express['Router']();var auth=require(_0xb5f5('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb5f5('0x4'));router[_0xb5f5('0x5')]('/',auth[_0xb5f5('0x6')](),controller[_0xb5f5('0x7')]);router[_0xb5f5('0x5')](_0xb5f5('0x8'),auth[_0xb5f5('0x6')](),controller[_0xb5f5('0x9')]);router[_0xb5f5('0x5')]('/:id/messages',auth[_0xb5f5('0x6')](),controller[_0xb5f5('0xa')]);router[_0xb5f5('0xb')]('/',auth[_0xb5f5('0x6')](),controller[_0xb5f5('0xc')]);router[_0xb5f5('0xd')](_0xb5f5('0x8'),auth[_0xb5f5('0x6')](),controller['update']);router[_0xb5f5('0xe')](_0xb5f5('0x8'),auth[_0xb5f5('0x6')](),controller[_0xb5f5('0xf')]);module[_0xb5f5('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index bb53a2a..2dfe1b2 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 _0x3c81=['TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','sequelize','exports','STRING','from-voicemail','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)'];(function(_0x2ef2cf,_0x55b72b){var _0x1ba4a0=function(_0x5131bb){while(--_0x5131bb){_0x2ef2cf['push'](_0x2ef2cf['shift']());}};_0x1ba4a0(++_0x55b72b);}(_0x3c81,0x102));var _0x13c8=function(_0x3b728d,_0x2a0600){_0x3b728d=_0x3b728d-0x0;var _0x34f7e9=_0x3c81[_0x3b728d];return _0x34f7e9;};'use strict';var Sequelize=require(_0x13c8('0x0'));module[_0x13c8('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x13c8('0x2')]},'email':{'type':Sequelize[_0x13c8('0x2')],'validate':{'isEmail':!![]},'set':function(_0x18bd0f){this[_0x13c8('0x4')](_0x13c8('0x5'),typeof _0x18bd0f===_0x13c8('0x6')&&_0x18bd0f[_0x13c8('0x7')]()?_0x18bd0f['trim']():null);}},'pager':{'type':Sequelize[_0x13c8('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x13c8('0x8')},'attach':{'type':Sequelize[_0x13c8('0x9')](_0x13c8('0xa'),'no'),'defaultValue':_0x13c8('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x13c8('0x9')](_0x13c8('0xa'),'no'),'defaultValue':_0x13c8('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x13c8('0x2')]},'callback':{'type':Sequelize[_0x13c8('0x2')]},'review':{'type':Sequelize[_0x13c8('0x9')](_0x13c8('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x13c8('0x9')](_0x13c8('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x13c8('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x13c8('0x9')](_0x13c8('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x13c8('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x13c8('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x13c8('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x13c8('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x13c8('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x13c8('0x9')](_0x13c8('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x13c8('0x9')]('yes','no'),'defaultValue':_0x13c8('0xa'),'allowNull':![]},'stamp':{'type':_0x13c8('0xc')},'emailsubject':{'type':Sequelize[_0x13c8('0x2')]},'emailbody':{'type':Sequelize[_0x13c8('0x2')]},'maxsecs':{'type':Sequelize[_0x13c8('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x13c8('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x13c8('0xe')],'get':function(){return this[_0x13c8('0xf')](_0x13c8('0x10'))+_0x13c8('0x11')+this[_0x13c8('0xf')]('mailbox');}}}; \ No newline at end of file +var _0x9c00=['STRING','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','\x20-\x20','mailbox','sequelize','exports','from-voicemail','contest_mailbox'];(function(_0x3bd276,_0x519e7b){var _0x50647f=function(_0x37d63c){while(--_0x37d63c){_0x3bd276['push'](_0x3bd276['shift']());}};_0x50647f(++_0x519e7b);}(_0x9c00,0x1a0));var _0x09c0=function(_0x2a5755,_0x17f587){_0x2a5755=_0x2a5755-0x0;var _0x1700da=_0x9c00[_0x2a5755];return _0x1700da;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0x09c0('0x2'),'unique':_0x09c0('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x09c0('0x3')},'password':{'type':Sequelize[_0x09c0('0x4')]},'fullname':{'type':Sequelize[_0x09c0('0x4')]},'email':{'type':Sequelize[_0x09c0('0x4')],'validate':{'isEmail':!![]},'set':function(_0x1cbf99){this['setDataValue']('email',typeof _0x1cbf99===_0x09c0('0x5')&&_0x1cbf99[_0x09c0('0x6')]()?_0x1cbf99[_0x09c0('0x6')]():null);}},'pager':{'type':Sequelize[_0x09c0('0x4')]},'tz':{'type':Sequelize[_0x09c0('0x4')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x09c0('0x7')](_0x09c0('0x8'),'no'),'defaultValue':_0x09c0('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x09c0('0x7')](_0x09c0('0x8'),'no'),'defaultValue':_0x09c0('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x09c0('0x4')]},'callback':{'type':Sequelize[_0x09c0('0x4')]},'review':{'type':Sequelize[_0x09c0('0x7')](_0x09c0('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x09c0('0x7')](_0x09c0('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x09c0('0x7')](_0x09c0('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x09c0('0x7')](_0x09c0('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x09c0('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x09c0('0x7')](_0x09c0('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x09c0('0x7')](_0x09c0('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x09c0('0x7')](_0x09c0('0x8'),'no'),'defaultValue':_0x09c0('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x09c0('0x7')](_0x09c0('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x09c0('0x8'),'no'),'defaultValue':_0x09c0('0x8'),'allowNull':![]},'stamp':{'type':_0x09c0('0xa')},'emailsubject':{'type':Sequelize[_0x09c0('0x4')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x09c0('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x09c0('0xc')]('fullname')+_0x09c0('0xd')+this[_0x09c0('0xc')](_0x09c0('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 7e411b8..748d04d 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 _0x2deb=['apply','reject','save','update','then','destroy','Voicemails','UserProfileResource','sendStatus','error','name','map','VoiceMail','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','params','getMessages','VoiceMailMessage','mailbox','options','findAndCountAll','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','status','json','count','offset','Content-Range'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2deb,0xdb));var _0xb2de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2deb[_0x321bb2];return _0x9c12ed;};'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'];function respondWithStatusCode(_0x1e2237,_0x343024){_0x343024=_0x343024||0xcc;return function(_0xec4373){if(_0xec4373){return _0x1e2237['sendStatus'](_0x343024);}return _0x1e2237[_0xb2de('0x16')](_0x343024)['end']();};}function respondWithResult(_0x160d61,_0x4feb90){_0x4feb90=_0x4feb90||0xc8;return function(_0x10ef21){if(_0x10ef21){return _0x160d61[_0xb2de('0x16')](_0x4feb90)[_0xb2de('0x17')](_0x10ef21);}};}function respondWithFilteredResult(_0x5a1f02,_0x209429){return function(_0x40f29d){if(_0x40f29d){var _0x2dc98f=_0x40f29d[_0xb2de('0x18')],_0x1413f6=_0x209429[_0xb2de('0x19')],_0x317528=_0x209429[_0xb2de('0x19')]+_0x209429['limit'],_0x2dc15c;if(_0x317528>=_0x2dc98f){_0x317528=_0x2dc98f;_0x2dc15c=0xc8;}else{_0x2dc15c=0xce;}_0x5a1f02[_0xb2de('0x16')](_0x2dc15c);return _0x5a1f02['set'](_0xb2de('0x1a'),_0x1413f6+'-'+_0x317528+'/'+_0x2dc98f)[_0xb2de('0x17')](_0x40f29d);}return null;};}function patchUpdates(_0x4c7ad4){return function(_0x2fbe63){try{jsonpatch[_0xb2de('0x1b')](_0x2fbe63,_0x4c7ad4,!![]);}catch(_0x499c2f){return BPromise[_0xb2de('0x1c')](_0x499c2f);}return _0x2fbe63[_0xb2de('0x1d')]();};}function saveUpdates(_0x34b228,_0x148c91){return function(_0x449edb){if(_0x449edb){return _0x449edb[_0xb2de('0x1e')](_0x34b228)[_0xb2de('0x1f')](function(_0x26e02f){return _0x26e02f;});}return null;};}function removeEntity(_0x20d7f8,_0x506a50){return function(_0x280644){if(_0x280644){return _0x280644[_0xb2de('0x20')]()[_0xb2de('0x1f')](function(){var _0xa97fb4=_0x280644['get']({'plain':!![]});var _0x55051f=_0xb2de('0x21');return db[_0xb2de('0x22')][_0xb2de('0x20')]({'where':{'type':_0x55051f,'resourceId':_0xa97fb4['id']}})['then'](function(){return _0x280644;});})[_0xb2de('0x1f')](function(){_0x20d7f8[_0xb2de('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16c249,_0x5b7c2f){return function(_0x2d9fd1){if(!_0x2d9fd1){_0x16c249[_0xb2de('0x23')](0x194);}return _0x2d9fd1;};}function handleError(_0x1c8eaf,_0x40517f){_0x40517f=_0x40517f||0x1f4;return function(_0xeb4e31){logger[_0xb2de('0x24')](_0xeb4e31['stack']);if(_0xeb4e31[_0xb2de('0x25')]){delete _0xeb4e31['name'];}_0x1c8eaf[_0xb2de('0x16')](_0x40517f)['send'](_0xeb4e31);};}exports['index']=function(_0x3ed36e,_0x4269ab){var _0x345e20={},_0x1b6c37={},_0xd60c6f={'count':0x0,'rows':[]};var _0x37f622=_[_0xb2de('0x26')](db[_0xb2de('0x27')][_0xb2de('0x28')],function(_0x379e5f){return{'name':_0x379e5f[_0xb2de('0x29')],'type':_0x379e5f[_0xb2de('0x2a')]['key']};});_0x1b6c37[_0xb2de('0x2b')]=_[_0xb2de('0x26')](_0x37f622,'name');_0x1b6c37[_0xb2de('0x2c')]=_[_0xb2de('0x2d')](_0x3ed36e['query']);_0x1b6c37[_0xb2de('0x2e')]=_[_0xb2de('0x2f')](_0x1b6c37[_0xb2de('0x2b')],_0x1b6c37['query']);_0x345e20[_0xb2de('0x30')]=_[_0xb2de('0x2f')](_0x1b6c37[_0xb2de('0x2b')],qs[_0xb2de('0x31')](_0x3ed36e[_0xb2de('0x2c')][_0xb2de('0x31')]));_0x345e20[_0xb2de('0x30')]=_0x345e20[_0xb2de('0x30')][_0xb2de('0x32')]?_0x345e20[_0xb2de('0x30')]:_0x1b6c37[_0xb2de('0x2b')];if(!_0x3ed36e['query'][_0xb2de('0x33')](_0xb2de('0x34'))){_0x345e20[_0xb2de('0x35')]=qs[_0xb2de('0x35')](_0x3ed36e[_0xb2de('0x2c')][_0xb2de('0x35')]);_0x345e20[_0xb2de('0x19')]=qs[_0xb2de('0x19')](_0x3ed36e[_0xb2de('0x2c')][_0xb2de('0x19')]);}_0x345e20[_0xb2de('0x36')]=qs[_0xb2de('0x37')](_0x3ed36e[_0xb2de('0x2c')][_0xb2de('0x37')]);_0x345e20[_0xb2de('0x38')]=qs['filters'](_[_0xb2de('0x39')](_0x3ed36e['query'],_0x1b6c37[_0xb2de('0x2e')]),_0x37f622);if(_0x3ed36e[_0xb2de('0x2c')][_0xb2de('0x3a')]){_0x345e20[_0xb2de('0x38')]=_[_0xb2de('0x3b')](_0x345e20[_0xb2de('0x38')],{'$or':_[_0xb2de('0x26')](_0x37f622,function(_0x270f85){if(_0x270f85[_0xb2de('0x2a')]!==_0xb2de('0x3c')){var _0x157bff={};_0x157bff[_0x270f85[_0xb2de('0x25')]]={'$like':'%'+_0x3ed36e[_0xb2de('0x2c')][_0xb2de('0x3a')]+'%'};return _0x157bff;}})});}_0x345e20=_[_0xb2de('0x3b')]({},_0x345e20,_0x3ed36e['options']);var _0x179a92={'where':_0x345e20[_0xb2de('0x38')]};return db['VoiceMail'][_0xb2de('0x18')](_0x179a92)[_0xb2de('0x1f')](function(_0x33427e){_0xd60c6f[_0xb2de('0x18')]=_0x33427e;if(_0x3ed36e['query'][_0xb2de('0x3d')]){_0x345e20[_0xb2de('0x3e')]=[{'all':!![]}];}return db['VoiceMail'][_0xb2de('0x3f')](_0x345e20);})[_0xb2de('0x1f')](function(_0x488992){_0xd60c6f[_0xb2de('0x40')]=_0x488992;return _0xd60c6f;})['then'](respondWithFilteredResult(_0x4269ab,_0x345e20))['catch'](handleError(_0x4269ab,null));};exports[_0xb2de('0x41')]=function(_0x5ad6cf,_0x514623){var _0x440f15={'raw':!![],'where':{'id':_0x5ad6cf['params']['id']}},_0xb474fc={};_0xb474fc[_0xb2de('0x2b')]=_[_0xb2de('0x2d')](db[_0xb2de('0x27')][_0xb2de('0x28')]);_0xb474fc['query']=_[_0xb2de('0x2d')](_0x5ad6cf[_0xb2de('0x2c')]);_0xb474fc[_0xb2de('0x2e')]=_[_0xb2de('0x2f')](_0xb474fc[_0xb2de('0x2b')],_0xb474fc[_0xb2de('0x2c')]);_0x440f15[_0xb2de('0x30')]=_['intersection'](_0xb474fc[_0xb2de('0x2b')],qs[_0xb2de('0x31')](_0x5ad6cf[_0xb2de('0x2c')]['fields']));_0x440f15[_0xb2de('0x30')]=_0x440f15['attributes'][_0xb2de('0x32')]?_0x440f15[_0xb2de('0x30')]:_0xb474fc[_0xb2de('0x2b')];if(_0x5ad6cf[_0xb2de('0x2c')]['includeAll']){_0x440f15[_0xb2de('0x3e')]=[{'all':!![]}];}_0x440f15=_[_0xb2de('0x3b')]({},_0x440f15,_0x5ad6cf['options']);return db['VoiceMail'][_0xb2de('0x42')](_0x440f15)[_0xb2de('0x1f')](handleEntityNotFound(_0x514623,null))[_0xb2de('0x1f')](respondWithResult(_0x514623,null))[_0xb2de('0x43')](handleError(_0x514623,null));};exports[_0xb2de('0x44')]=function(_0x541942,_0x304bab){return db['VoiceMail'][_0xb2de('0x44')](_0x541942['body'],{})[_0xb2de('0x1f')](function(_0x3dca27){var _0x4c52bc=_0x541942[_0xb2de('0x45')]['get']({'plain':!![]});if(!_0x4c52bc)throw new Error(_0xb2de('0x46'));if(_0x4c52bc[_0xb2de('0x47')]===_0xb2de('0x45')){var _0x39a9aa=_0x3dca27['get']({'plain':!![]});var _0x2e7506=_0xb2de('0x21');return db[_0xb2de('0x48')][_0xb2de('0x42')]({'where':{'name':_0x2e7506,'userProfileId':_0x4c52bc[_0xb2de('0x49')]},'raw':!![]})['then'](function(_0x36ab6a){if(_0x36ab6a&&_0x36ab6a[_0xb2de('0x4a')]===0x0){return db[_0xb2de('0x22')][_0xb2de('0x44')]({'name':_0x39a9aa[_0xb2de('0x25')],'resourceId':_0x39a9aa['id'],'type':_0x36ab6a['name'],'sectionId':_0x36ab6a['id']},{})[_0xb2de('0x1f')](function(){return _0x3dca27;});}else{return _0x3dca27;}})[_0xb2de('0x43')](function(_0x53f927){logger[_0xb2de('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f927);throw _0x53f927;});}return _0x3dca27;})[_0xb2de('0x1f')](respondWithResult(_0x304bab,0xc9))[_0xb2de('0x43')](handleError(_0x304bab,null));};exports[_0xb2de('0x1e')]=function(_0x42956a,_0x566fbc){if(_0x42956a[_0xb2de('0x4b')]['id']){delete _0x42956a[_0xb2de('0x4b')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x42956a[_0xb2de('0x4c')]['id']}})[_0xb2de('0x1f')](handleEntityNotFound(_0x566fbc,null))[_0xb2de('0x1f')](saveUpdates(_0x42956a[_0xb2de('0x4b')],null))[_0xb2de('0x1f')](respondWithResult(_0x566fbc,null))[_0xb2de('0x43')](handleError(_0x566fbc,null));};exports[_0xb2de('0x20')]=function(_0x1d8dd3,_0x15b113){return db[_0xb2de('0x27')][_0xb2de('0x42')]({'where':{'id':_0x1d8dd3['params']['id']}})['then'](handleEntityNotFound(_0x15b113,null))[_0xb2de('0x1f')](removeEntity(_0x15b113,null))[_0xb2de('0x43')](handleError(_0x15b113,null));};exports[_0xb2de('0x4d')]=function(_0x1a0ace,_0x2aba66,_0x446bb4){return db[_0xb2de('0x27')]['findOne']({'where':{'id':_0x1a0ace['params']['id']}})[_0xb2de('0x1f')](handleEntityNotFound(_0x2aba66,null))[_0xb2de('0x1f')](function(_0x10ac78){var _0x46282c;var _0x5b1ab2={},_0x5b47ba={};_0x5b47ba[_0xb2de('0x2b')]=_[_0xb2de('0x2d')](db[_0xb2de('0x4e')]['rawAttributes']);_0x5b47ba[_0xb2de('0x2c')]=_[_0xb2de('0x2d')](_0x1a0ace[_0xb2de('0x2c')]);_0x5b47ba[_0xb2de('0x2e')]=_[_0xb2de('0x2f')](_0x5b47ba[_0xb2de('0x2b')],_0x5b47ba['query']);_0x5b1ab2[_0xb2de('0x30')]=_[_0xb2de('0x2f')](_0x5b47ba[_0xb2de('0x2b')],qs[_0xb2de('0x31')](_0x1a0ace[_0xb2de('0x2c')][_0xb2de('0x31')]));_0x5b1ab2['attributes']=_0x5b1ab2[_0xb2de('0x30')]['length']?_0x5b1ab2[_0xb2de('0x30')]:_0x5b47ba[_0xb2de('0x2b')];if(!_0x1a0ace['query'][_0xb2de('0x33')]('nolimit')){_0x5b1ab2['limit']=qs['limit'](_0x1a0ace[_0xb2de('0x2c')]['limit']);_0x5b1ab2['offset']=qs['offset'](_0x1a0ace[_0xb2de('0x2c')][_0xb2de('0x19')]);}_0x5b1ab2[_0xb2de('0x36')]=qs[_0xb2de('0x37')](_0x1a0ace[_0xb2de('0x2c')][_0xb2de('0x37')]);_0x5b1ab2[_0xb2de('0x38')]=qs[_0xb2de('0x2e')](_['pick'](_0x1a0ace['query'],_0x5b47ba[_0xb2de('0x2e')]));if(_0x1a0ace['query']['filter']){_0x5b1ab2[_0xb2de('0x38')]=_['merge'](_0x5b1ab2[_0xb2de('0x38')],{'$or':_['map'](_0x5b1ab2['attributes'],function(_0x276cc6){var _0x4ed3ca={};_0x4ed3ca[_0x276cc6]={'$like':'%'+_0x1a0ace[_0xb2de('0x2c')][_0xb2de('0x3a')]+'%'};return _0x4ed3ca;})});}_0x5b1ab2[_0xb2de('0x38')]=_[_0xb2de('0x3b')](_0x5b1ab2[_0xb2de('0x38')],{'mailboxuser':_0x10ac78[_0xb2de('0x4f')]});_0x5b1ab2=_[_0xb2de('0x3b')]({},_0x5b1ab2,_0x1a0ace[_0xb2de('0x50')]);return db[_0xb2de('0x4e')][_0xb2de('0x51')](_0x5b1ab2)[_0xb2de('0x1f')](respondWithFilteredResult(_0x2aba66,_0x5b1ab2));})[_0xb2de('0x43')](handleError(_0x2aba66,null));}; \ No newline at end of file +var _0x4213=['intersection','attributes','fields','length','nolimit','order','sort','filter','merge','where','VIRTUAL','options','count','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','role','Voicemails','UserProfileSection','autoAssociation','UserProfileResource','getMessages','findOne','VoiceMailMessage','hasOwnProperty','pick','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','get','error','stack','name','index','map','VoiceMail','fieldName','type','model','query','keys','filters'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x4213,0x77));var _0x3421=function(_0xab6522,_0x1f16ec){_0xab6522=_0xab6522-0x0;var _0x3e5e21=_0x4213[_0xab6522];return _0x3e5e21;};'use strict';var pdf=require(_0x3421('0x0'));var emlformat=require(_0x3421('0x1'));var rimraf=require(_0x3421('0x2'));var zipdir=require(_0x3421('0x3'));var jsonpatch=require(_0x3421('0x4'));var rp=require(_0x3421('0x5'));var moment=require(_0x3421('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x3421('0x7'));var util=require('util');var path=require(_0x3421('0x8'));var sox=require(_0x3421('0x9'));var csv=require(_0x3421('0xa'));var ejs=require(_0x3421('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3421('0xc'));var crypto=require(_0x3421('0xd'));var jsforce=require(_0x3421('0xe'));var deskjs=require(_0x3421('0xf'));var toCsv=require(_0x3421('0xa'));var querystring=require('querystring');var Papa=require(_0x3421('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3421('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3421('0x12'));var logger=require(_0x3421('0x13'))(_0x3421('0x14'));var utils=require(_0x3421('0x15'));var config=require(_0x3421('0x16'));var licenseUtil=require(_0x3421('0x17'));var db=require(_0x3421('0x18'))['db'];function respondWithStatusCode(_0x59eaf1,_0x26d459){_0x26d459=_0x26d459||0xcc;return function(_0x3e2ecd){if(_0x3e2ecd){return _0x59eaf1[_0x3421('0x19')](_0x26d459);}return _0x59eaf1[_0x3421('0x1a')](_0x26d459)[_0x3421('0x1b')]();};}function respondWithResult(_0x3f4672,_0x25ffd4){_0x25ffd4=_0x25ffd4||0xc8;return function(_0x59ea4a){if(_0x59ea4a){return _0x3f4672[_0x3421('0x1a')](_0x25ffd4)['json'](_0x59ea4a);}};}function respondWithFilteredResult(_0x372d21,_0x5257ad){return function(_0x59ae45){if(_0x59ae45){var _0x1e33ab=_0x59ae45['count'],_0x4c6f7b=_0x5257ad[_0x3421('0x1c')],_0x16bc8f=_0x5257ad[_0x3421('0x1c')]+_0x5257ad[_0x3421('0x1d')],_0x23694b;if(_0x16bc8f>=_0x1e33ab){_0x16bc8f=_0x1e33ab;_0x23694b=0xc8;}else{_0x23694b=0xce;}_0x372d21[_0x3421('0x1a')](_0x23694b);return _0x372d21[_0x3421('0x1e')](_0x3421('0x1f'),_0x4c6f7b+'-'+_0x16bc8f+'/'+_0x1e33ab)[_0x3421('0x20')](_0x59ae45);}return null;};}function patchUpdates(_0x66a57a){return function(_0x197b83){try{jsonpatch[_0x3421('0x21')](_0x197b83,_0x66a57a,!![]);}catch(_0x538a8b){return BPromise['reject'](_0x538a8b);}return _0x197b83[_0x3421('0x22')]();};}function saveUpdates(_0x4b59a5,_0x5820f6){return function(_0x545b1c){if(_0x545b1c){return _0x545b1c[_0x3421('0x23')](_0x4b59a5)[_0x3421('0x24')](function(_0x45f826){return _0x45f826;});}return null;};}function removeEntity(_0x256cc5,_0x132e8e){return function(_0x39bed4){if(_0x39bed4){return _0x39bed4[_0x3421('0x25')]()[_0x3421('0x24')](function(){var _0xb9af5f=_0x39bed4[_0x3421('0x26')]({'plain':!![]});var _0x48fb3d='Voicemails';return db['UserProfileResource'][_0x3421('0x25')]({'where':{'type':_0x48fb3d,'resourceId':_0xb9af5f['id']}})[_0x3421('0x24')](function(){return _0x39bed4;});})[_0x3421('0x24')](function(){_0x256cc5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b65d0,_0x5b53b6){return function(_0x2bf001){if(!_0x2bf001){_0x1b65d0['sendStatus'](0x194);}return _0x2bf001;};}function handleError(_0x15e73c,_0x224796){_0x224796=_0x224796||0x1f4;return function(_0x36d75f){logger[_0x3421('0x27')](_0x36d75f[_0x3421('0x28')]);if(_0x36d75f['name']){delete _0x36d75f[_0x3421('0x29')];}_0x15e73c['status'](_0x224796)['send'](_0x36d75f);};}exports[_0x3421('0x2a')]=function(_0x5aa96b,_0x5074a2){var _0xb4eaf4={},_0x4ee4aa={},_0x20abc7={'count':0x0,'rows':[]};var _0x5bcd19=_[_0x3421('0x2b')](db[_0x3421('0x2c')]['rawAttributes'],function(_0x3f7c0b){return{'name':_0x3f7c0b[_0x3421('0x2d')],'type':_0x3f7c0b[_0x3421('0x2e')]['key']};});_0x4ee4aa[_0x3421('0x2f')]=_['map'](_0x5bcd19,_0x3421('0x29'));_0x4ee4aa[_0x3421('0x30')]=_[_0x3421('0x31')](_0x5aa96b[_0x3421('0x30')]);_0x4ee4aa[_0x3421('0x32')]=_[_0x3421('0x33')](_0x4ee4aa[_0x3421('0x2f')],_0x4ee4aa[_0x3421('0x30')]);_0xb4eaf4[_0x3421('0x34')]=_[_0x3421('0x33')](_0x4ee4aa['model'],qs['fields'](_0x5aa96b[_0x3421('0x30')][_0x3421('0x35')]));_0xb4eaf4['attributes']=_0xb4eaf4[_0x3421('0x34')][_0x3421('0x36')]?_0xb4eaf4[_0x3421('0x34')]:_0x4ee4aa[_0x3421('0x2f')];if(!_0x5aa96b[_0x3421('0x30')]['hasOwnProperty'](_0x3421('0x37'))){_0xb4eaf4[_0x3421('0x1d')]=qs[_0x3421('0x1d')](_0x5aa96b['query'][_0x3421('0x1d')]);_0xb4eaf4['offset']=qs[_0x3421('0x1c')](_0x5aa96b[_0x3421('0x30')][_0x3421('0x1c')]);}_0xb4eaf4[_0x3421('0x38')]=qs[_0x3421('0x39')](_0x5aa96b[_0x3421('0x30')][_0x3421('0x39')]);_0xb4eaf4['where']=qs['filters'](_['pick'](_0x5aa96b[_0x3421('0x30')],_0x4ee4aa['filters']),_0x5bcd19);if(_0x5aa96b['query'][_0x3421('0x3a')]){_0xb4eaf4['where']=_[_0x3421('0x3b')](_0xb4eaf4[_0x3421('0x3c')],{'$or':_['map'](_0x5bcd19,function(_0x167987){if(_0x167987[_0x3421('0x2e')]!==_0x3421('0x3d')){var _0x151a3d={};_0x151a3d[_0x167987['name']]={'$like':'%'+_0x5aa96b[_0x3421('0x30')][_0x3421('0x3a')]+'%'};return _0x151a3d;}})});}_0xb4eaf4=_[_0x3421('0x3b')]({},_0xb4eaf4,_0x5aa96b[_0x3421('0x3e')]);var _0x25de09={'where':_0xb4eaf4['where']};return db[_0x3421('0x2c')][_0x3421('0x3f')](_0x25de09)['then'](function(_0x15551c){_0x20abc7['count']=_0x15551c;if(_0x5aa96b['query']['includeAll']){_0xb4eaf4[_0x3421('0x40')]=[{'all':!![]}];}return db[_0x3421('0x2c')][_0x3421('0x41')](_0xb4eaf4);})[_0x3421('0x24')](function(_0x310ee2){_0x20abc7[_0x3421('0x42')]=_0x310ee2;return _0x20abc7;})[_0x3421('0x24')](respondWithFilteredResult(_0x5074a2,_0xb4eaf4))[_0x3421('0x43')](handleError(_0x5074a2,null));};exports[_0x3421('0x44')]=function(_0x14e30c,_0x3b9d15){var _0x12e610={'raw':!![],'where':{'id':_0x14e30c[_0x3421('0x45')]['id']}},_0x431643={};_0x431643['model']=_[_0x3421('0x31')](db[_0x3421('0x2c')][_0x3421('0x46')]);_0x431643[_0x3421('0x30')]=_['keys'](_0x14e30c[_0x3421('0x30')]);_0x431643['filters']=_[_0x3421('0x33')](_0x431643[_0x3421('0x2f')],_0x431643[_0x3421('0x30')]);_0x12e610[_0x3421('0x34')]=_[_0x3421('0x33')](_0x431643[_0x3421('0x2f')],qs[_0x3421('0x35')](_0x14e30c[_0x3421('0x30')][_0x3421('0x35')]));_0x12e610[_0x3421('0x34')]=_0x12e610[_0x3421('0x34')][_0x3421('0x36')]?_0x12e610[_0x3421('0x34')]:_0x431643['model'];if(_0x14e30c[_0x3421('0x30')]['includeAll']){_0x12e610[_0x3421('0x40')]=[{'all':!![]}];}_0x12e610=_[_0x3421('0x3b')]({},_0x12e610,_0x14e30c[_0x3421('0x3e')]);return db[_0x3421('0x2c')][_0x3421('0x47')](_0x12e610)[_0x3421('0x24')](handleEntityNotFound(_0x3b9d15,null))[_0x3421('0x24')](respondWithResult(_0x3b9d15,null))[_0x3421('0x43')](handleError(_0x3b9d15,null));};exports[_0x3421('0x48')]=function(_0x3cd2a3,_0x4c65b4){return db[_0x3421('0x2c')][_0x3421('0x48')](_0x3cd2a3[_0x3421('0x49')],{})['then'](function(_0x566f95){var _0x43a94f=_0x3cd2a3[_0x3421('0x4a')][_0x3421('0x26')]({'plain':!![]});if(!_0x43a94f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43a94f[_0x3421('0x4b')]===_0x3421('0x4a')){var _0x213e27=_0x566f95[_0x3421('0x26')]({'plain':!![]});var _0x57554a=_0x3421('0x4c');return db[_0x3421('0x4d')][_0x3421('0x47')]({'where':{'name':_0x57554a,'userProfileId':_0x43a94f['userProfileId']},'raw':!![]})['then'](function(_0x5a2004){if(_0x5a2004&&_0x5a2004[_0x3421('0x4e')]===0x0){return db[_0x3421('0x4f')]['create']({'name':_0x213e27['name'],'resourceId':_0x213e27['id'],'type':_0x5a2004[_0x3421('0x29')],'sectionId':_0x5a2004['id']},{})[_0x3421('0x24')](function(){return _0x566f95;});}else{return _0x566f95;}})[_0x3421('0x43')](function(_0x25b0d8){logger[_0x3421('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25b0d8);throw _0x25b0d8;});}return _0x566f95;})[_0x3421('0x24')](respondWithResult(_0x4c65b4,0xc9))[_0x3421('0x43')](handleError(_0x4c65b4,null));};exports[_0x3421('0x23')]=function(_0x2f9ce1,_0x535934){if(_0x2f9ce1[_0x3421('0x49')]['id']){delete _0x2f9ce1[_0x3421('0x49')]['id'];}return db[_0x3421('0x2c')]['find']({'where':{'id':_0x2f9ce1[_0x3421('0x45')]['id']}})['then'](handleEntityNotFound(_0x535934,null))['then'](saveUpdates(_0x2f9ce1[_0x3421('0x49')],null))['then'](respondWithResult(_0x535934,null))[_0x3421('0x43')](handleError(_0x535934,null));};exports[_0x3421('0x25')]=function(_0x12bd9a,_0x4cf96e){return db[_0x3421('0x2c')][_0x3421('0x47')]({'where':{'id':_0x12bd9a[_0x3421('0x45')]['id']}})[_0x3421('0x24')](handleEntityNotFound(_0x4cf96e,null))[_0x3421('0x24')](removeEntity(_0x4cf96e,null))[_0x3421('0x43')](handleError(_0x4cf96e,null));};exports[_0x3421('0x50')]=function(_0x21e3d4,_0x337c75,_0x484c92){return db[_0x3421('0x2c')][_0x3421('0x51')]({'where':{'id':_0x21e3d4['params']['id']}})[_0x3421('0x24')](handleEntityNotFound(_0x337c75,null))[_0x3421('0x24')](function(_0x394cb2){var _0x5df17c;var _0x3204a0={},_0x27085d={};_0x27085d[_0x3421('0x2f')]=_[_0x3421('0x31')](db[_0x3421('0x52')][_0x3421('0x46')]);_0x27085d[_0x3421('0x30')]=_[_0x3421('0x31')](_0x21e3d4[_0x3421('0x30')]);_0x27085d[_0x3421('0x32')]=_[_0x3421('0x33')](_0x27085d[_0x3421('0x2f')],_0x27085d[_0x3421('0x30')]);_0x3204a0[_0x3421('0x34')]=_[_0x3421('0x33')](_0x27085d['model'],qs[_0x3421('0x35')](_0x21e3d4[_0x3421('0x30')][_0x3421('0x35')]));_0x3204a0[_0x3421('0x34')]=_0x3204a0[_0x3421('0x34')][_0x3421('0x36')]?_0x3204a0[_0x3421('0x34')]:_0x27085d[_0x3421('0x2f')];if(!_0x21e3d4['query'][_0x3421('0x53')]('nolimit')){_0x3204a0[_0x3421('0x1d')]=qs[_0x3421('0x1d')](_0x21e3d4[_0x3421('0x30')][_0x3421('0x1d')]);_0x3204a0['offset']=qs[_0x3421('0x1c')](_0x21e3d4[_0x3421('0x30')][_0x3421('0x1c')]);}_0x3204a0[_0x3421('0x38')]=qs[_0x3421('0x39')](_0x21e3d4[_0x3421('0x30')]['sort']);_0x3204a0[_0x3421('0x3c')]=qs[_0x3421('0x32')](_[_0x3421('0x54')](_0x21e3d4[_0x3421('0x30')],_0x27085d[_0x3421('0x32')]));if(_0x21e3d4[_0x3421('0x30')][_0x3421('0x3a')]){_0x3204a0[_0x3421('0x3c')]=_['merge'](_0x3204a0[_0x3421('0x3c')],{'$or':_[_0x3421('0x2b')](_0x3204a0[_0x3421('0x34')],function(_0x40ae83){var _0x347299={};_0x347299[_0x40ae83]={'$like':'%'+_0x21e3d4['query']['filter']+'%'};return _0x347299;})});}_0x3204a0[_0x3421('0x3c')]=_[_0x3421('0x3b')](_0x3204a0[_0x3421('0x3c')],{'mailboxuser':_0x394cb2['mailbox']});_0x3204a0=_[_0x3421('0x3b')]({},_0x3204a0,_0x21e3d4['options']);return db[_0x3421('0x52')]['findAndCountAll'](_0x3204a0)['then'](respondWithFilteredResult(_0x337c75,_0x3204a0));})['catch'](handleError(_0x337c75,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 73c2906..5863e11 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 _0x7804=['moment','request-promise','path','./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox','lodash','../../config/logger','api'];(function(_0x35900f,_0x2fdb55){var _0x2aa732=function(_0x164001){while(--_0x164001){_0x35900f['push'](_0x35900f['shift']());}};_0x2aa732(++_0x2fdb55);}(_0x7804,0xc3));var _0x4780=function(_0x200ddf,_0x1a0085){_0x200ddf=_0x200ddf-0x0;var _0x29d6cb=_0x7804[_0x200ddf];return _0x29d6cb;};'use strict';var _=require(_0x4780('0x0'));var util=require('util');var logger=require(_0x4780('0x1'))(_0x4780('0x2'));var moment=require(_0x4780('0x3'));var BPromise=require('bluebird');var rp=require(_0x4780('0x4'));var fs=require('fs');var path=require(_0x4780('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4780('0x6'));module['exports']=function(_0x4914ae,_0x138148){return _0x4914ae[_0x4780('0x7')](_0x4780('0x8'),attributes,{'tableName':_0x4780('0x9'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x4780('0xa'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbd49=['mailbox','context','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','VoiceMail','mailbox_context'];(function(_0xf348ae,_0x331604){var _0x3c33e7=function(_0xf81d39){while(--_0xf81d39){_0xf348ae['push'](_0xf348ae['shift']());}};_0x3c33e7(++_0x331604);}(_0xbd49,0x86));var _0x9bd4=function(_0x5f38d9,_0x29e373){_0x5f38d9=_0x5f38d9-0x0;var _0x4d2426=_0xbd49[_0x5f38d9];return _0x4d2426;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9bd4('0x0'))(_0x9bd4('0x1'));var moment=require(_0x9bd4('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9bd4('0x3'));var rimraf=require(_0x9bd4('0x4'));var config=require(_0x9bd4('0x5'));var attributes=require('./voiceMail.attributes');module[_0x9bd4('0x6')]=function(_0xb3ab11,_0x25567a){return _0xb3ab11[_0x9bd4('0x7')](_0x9bd4('0x8'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x9bd4('0x9'),'fields':[_0x9bd4('0xa'),_0x9bd4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index e9bc86f..59b4b3b 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 _0x84c0=['client','request','then','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4e88e9,_0x1d1c24){var _0x343ee2=function(_0x31b71c){while(--_0x31b71c){_0x4e88e9['push'](_0x4e88e9['shift']());}};_0x343ee2(++_0x1d1c24);}(_0x84c0,0x1c4));var _0x084c=function(_0x4c399,_0x53188f){_0x4c399=_0x4c399-0x0;var _0x240111=_0x84c0[_0x4c399];return _0x240111;};'use strict';var _=require(_0x084c('0x0'));var util=require('util');var moment=require(_0x084c('0x1'));var BPromise=require('bluebird');var rs=require(_0x084c('0x2'));var fs=require('fs');var Redis=require(_0x084c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x084c('0x4'));var logger=require(_0x084c('0x5'))(_0x084c('0x6'));var config=require('../../config/environment');var jayson=require(_0x084c('0x7'));var client=jayson[_0x084c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xaf2e85,_0x3e1c77,_0x2cbe2e){return new BPromise(function(_0x373933,_0x12975a){return client[_0x084c('0x9')](_0xaf2e85,_0x2cbe2e)[_0x084c('0xa')](function(_0x22c375){logger[_0x084c('0xb')](_0x084c('0xc'),_0x3e1c77,'request\x20sent');logger[_0x084c('0xd')](_0x084c('0xe'),_0x3e1c77,_0x084c('0xf'),JSON['stringify'](_0x22c375));if(_0x22c375[_0x084c('0x10')]){if(_0x22c375[_0x084c('0x10')][_0x084c('0x11')]===0x1f4){logger[_0x084c('0x10')]('VoiceMail,\x20%s,\x20%s',_0x3e1c77,_0x22c375[_0x084c('0x10')][_0x084c('0x12')]);return _0x12975a(_0x22c375[_0x084c('0x10')][_0x084c('0x12')]);}logger[_0x084c('0x10')](_0x084c('0xc'),_0x3e1c77,_0x22c375[_0x084c('0x10')]['message']);return _0x373933(_0x22c375[_0x084c('0x10')][_0x084c('0x12')]);}else{logger['info'](_0x084c('0xc'),_0x3e1c77,'request\x20sent');_0x373933(_0x22c375[_0x084c('0x13')][_0x084c('0x12')]);}})['catch'](function(_0x59fb73){logger['error'](_0x084c('0xc'),_0x3e1c77,_0x59fb73);_0x12975a(_0x59fb73);});});} \ No newline at end of file +var _0xa0cb=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x581e01,_0x241cbd){var _0x558b54=function(_0x22a370){while(--_0x22a370){_0x581e01['push'](_0x581e01['shift']());}};_0x558b54(++_0x241cbd);}(_0xa0cb,0x170));var _0xba0c=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xa0cb[_0x5a95fa];return _0x1a61b8;};'use strict';var _=require(_0xba0c('0x0'));var util=require('util');var moment=require(_0xba0c('0x1'));var BPromise=require(_0xba0c('0x2'));var rs=require(_0xba0c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba0c('0x4'))['db'];var utils=require(_0xba0c('0x5'));var logger=require(_0xba0c('0x6'))(_0xba0c('0x7'));var config=require(_0xba0c('0x8'));var jayson=require(_0xba0c('0x9'));var client=jayson['client'][_0xba0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d413c,_0x1205f7,_0x28118a){return new BPromise(function(_0x5d11c9,_0x1e83c1){return client[_0xba0c('0xb')](_0x1d413c,_0x28118a)[_0xba0c('0xc')](function(_0x2d51df){logger['info'](_0xba0c('0xd'),_0x1205f7,_0xba0c('0xe'));logger['debug'](_0xba0c('0xf'),_0x1205f7,'request\x20sent',JSON[_0xba0c('0x10')](_0x2d51df));if(_0x2d51df[_0xba0c('0x11')]){if(_0x2d51df[_0xba0c('0x11')][_0xba0c('0x12')]===0x1f4){logger['error'](_0xba0c('0xd'),_0x1205f7,_0x2d51df[_0xba0c('0x11')][_0xba0c('0x13')]);return _0x1e83c1(_0x2d51df[_0xba0c('0x11')][_0xba0c('0x13')]);}logger[_0xba0c('0x11')](_0xba0c('0xd'),_0x1205f7,_0x2d51df[_0xba0c('0x11')]['message']);return _0x5d11c9(_0x2d51df[_0xba0c('0x11')][_0xba0c('0x13')]);}else{logger[_0xba0c('0x14')](_0xba0c('0xd'),_0x1205f7,_0xba0c('0xe'));_0x5d11c9(_0x2d51df['result'][_0xba0c('0x13')]);}})[_0xba0c('0x15')](function(_0x4b48e9){logger[_0xba0c('0x11')]('VoiceMail,\x20%s,\x20%s',_0x1205f7,_0x4b48e9);_0x1e83c1(_0x4b48e9);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 271ecdd..64f29fe 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 _0xe2fe=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','/:id','get','download','create','delete','exports','multer'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_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']('/',auth[_0xee2f('0x7')](),controller[_0xee2f('0x8')]);router['get'](_0xee2f('0x9'),auth[_0xee2f('0x7')](),controller['show']);router[_0xee2f('0xa')]('/:id/download',auth[_0xee2f('0x7')](),controller[_0xee2f('0xb')]);router['post']('/',auth[_0xee2f('0x7')](),controller[_0xee2f('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xee2f('0xd')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xee2f('0xe')]=router; \ No newline at end of file +var _0xe14b=['update','destroy','exports','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','download','post','create'];(function(_0x235264,_0x84844e){var _0x46b318=function(_0x22900a){while(--_0x22900a){_0x235264['push'](_0x235264['shift']());}};_0x46b318(++_0x84844e);}(_0xe14b,0x93));var _0xbe14=function(_0x11b5ba,_0x2fb326){_0x11b5ba=_0x11b5ba-0x0;var _0x2d44dc=_0xe14b[_0x11b5ba];return _0x2d44dc;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe14('0x4'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0xbe14('0x5')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0x7')]);router[_0xbe14('0x5')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x9')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0xc')]);router['put']('/:id',auth[_0xbe14('0x6')](),controller[_0xbe14('0xd')]);router['delete'](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xe')]);module[_0xbe14('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index ae4a433..a40c1c5 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 _0xd5ae=['TIMESTAMP','sequelize','VIRTUAL','getDataValue','INTEGER','STRING','long'];(function(_0x577716,_0x3b17c2){var _0x6ec072=function(_0x5d410a){while(--_0x5d410a){_0x577716['push'](_0x577716['shift']());}};_0x6ec072(++_0x3b17c2);}(_0xd5ae,0x6a));var _0xed5a=function(_0x3b1c53,_0x4f96ed){_0x3b1c53=_0x3b1c53-0x0;var _0x3b5d63=_0xd5ae[_0x3b1c53];return _0x3b5d63;};'use strict';var Sequelize=require(_0xed5a('0x0'));module['exports']={'name':{'type':Sequelize[_0xed5a('0x1')],'get':function(_0x529f5c){return this[_0xed5a('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xed5a('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xed5a('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xed5a('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xed5a('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xed5a('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xed5a('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xed5a('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xed5a('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xed5a('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xed5a('0x4')],'defaultValue':''},'stamp':{'type':_0xed5a('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0x7540=['STRING','BLOB','long','TIMESTAMP','sequelize','exports','getDataValue','INTEGER'];(function(_0x1f8e53,_0x58bfb1){var _0x394370=function(_0x552d57){while(--_0x552d57){_0x1f8e53['push'](_0x1f8e53['shift']());}};_0x394370(++_0x58bfb1);}(_0x7540,0xb4));var _0x0754=function(_0x2c0c8d,_0x4a86c7){_0x2c0c8d=_0x2c0c8d-0x0;var _0x114e7a=_0x7540[_0x2c0c8d];return _0x114e7a;};'use strict';var Sequelize=require(_0x0754('0x0'));module[_0x0754('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1e2290){return this[_0x0754('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x0754('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x0754('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x0754('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x0754('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x0754('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x0754('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x0754('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x0754('0x5')](_0x0754('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x0754('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x0754('0x4')],'defaultValue':''},'stamp':{'type':_0x0754('0x7'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 4f92f2f..3bd99be 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 _0xa0f8=['send','index','map','VoiceMailMessage','fieldName','type','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','nolimit','offset','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','reject','save','update','then','destroy','stack','name'];(function(_0x3d5d30,_0x1921b0){var _0x34993f=function(_0x1afdab){while(--_0x1afdab){_0x3d5d30['push'](_0x3d5d30['shift']());}};_0x34993f(++_0x1921b0);}(_0xa0f8,0x17c));var _0x8a0f=function(_0x5948dd,_0x1f6ac8){_0x5948dd=_0x5948dd-0x0;var _0xb1f8be=_0xa0f8[_0x5948dd];return _0xb1f8be;};'use strict';var pdf=require(_0x8a0f('0x0'));var emlformat=require(_0x8a0f('0x1'));var rimraf=require(_0x8a0f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8a0f('0x3'));var rp=require(_0x8a0f('0x4'));var moment=require(_0x8a0f('0x5'));var BPromise=require(_0x8a0f('0x6'));var Mustache=require('mustache');var util=require(_0x8a0f('0x7'));var path=require('path');var sox=require(_0x8a0f('0x8'));var csv=require('to-csv');var ejs=require(_0x8a0f('0x9'));var fs=require('fs');var _=require(_0x8a0f('0xa'));var squel=require('squel');var crypto=require(_0x8a0f('0xb'));var jsforce=require(_0x8a0f('0xc'));var deskjs=require(_0x8a0f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8a0f('0xe'));var Redis=require(_0x8a0f('0xf'));var authService=require(_0x8a0f('0x10'));var qs=require(_0x8a0f('0x11'));var as=require(_0x8a0f('0x12'));var hardwareService=require(_0x8a0f('0x13'));var logger=require(_0x8a0f('0x14'))(_0x8a0f('0x15'));var utils=require(_0x8a0f('0x16'));var config=require(_0x8a0f('0x17'));var licenseUtil=require(_0x8a0f('0x18'));var db=require(_0x8a0f('0x19'))['db'];function respondWithStatusCode(_0x54e8fb,_0x2e8ba8){_0x2e8ba8=_0x2e8ba8||0xcc;return function(_0x3bda95){if(_0x3bda95){return _0x54e8fb[_0x8a0f('0x1a')](_0x2e8ba8);}return _0x54e8fb[_0x8a0f('0x1b')](_0x2e8ba8)[_0x8a0f('0x1c')]();};}function respondWithResult(_0x368584,_0x455837){_0x455837=_0x455837||0xc8;return function(_0x29ce4f){if(_0x29ce4f){return _0x368584[_0x8a0f('0x1b')](_0x455837)['json'](_0x29ce4f);}};}function respondWithFilteredResult(_0x4b0332,_0x4b6c5f){return function(_0x20b792){if(_0x20b792){var _0x2a4641=_0x20b792[_0x8a0f('0x1d')],_0x427cdc=_0x4b6c5f['offset'],_0x5c7e18=_0x4b6c5f['offset']+_0x4b6c5f[_0x8a0f('0x1e')],_0x4e47fb;if(_0x5c7e18>=_0x2a4641){_0x5c7e18=_0x2a4641;_0x4e47fb=0xc8;}else{_0x4e47fb=0xce;}_0x4b0332[_0x8a0f('0x1b')](_0x4e47fb);return _0x4b0332[_0x8a0f('0x1f')](_0x8a0f('0x20'),_0x427cdc+'-'+_0x5c7e18+'/'+_0x2a4641)['json'](_0x20b792);}return null;};}function patchUpdates(_0x4277a5){return function(_0x353f32){try{jsonpatch['apply'](_0x353f32,_0x4277a5,!![]);}catch(_0x4ec9bf){return BPromise[_0x8a0f('0x21')](_0x4ec9bf);}return _0x353f32[_0x8a0f('0x22')]();};}function saveUpdates(_0x3fe958,_0x3fcdbc){return function(_0x49767e){if(_0x49767e){return _0x49767e[_0x8a0f('0x23')](_0x3fe958)[_0x8a0f('0x24')](function(_0x54933b){return _0x54933b;});}return null;};}function removeEntity(_0x4b1938,_0x44f218){return function(_0x4e9080){if(_0x4e9080){return _0x4e9080[_0x8a0f('0x25')]()['then'](function(){_0x4b1938[_0x8a0f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a89e6,_0x103389){return function(_0x12a847){if(!_0x12a847){_0x2a89e6['sendStatus'](0x194);}return _0x12a847;};}function handleError(_0xb64ad6,_0x2a27fb){_0x2a27fb=_0x2a27fb||0x1f4;return function(_0x23c2aa){logger['error'](_0x23c2aa[_0x8a0f('0x26')]);if(_0x23c2aa[_0x8a0f('0x27')]){delete _0x23c2aa['name'];}_0xb64ad6[_0x8a0f('0x1b')](_0x2a27fb)[_0x8a0f('0x28')](_0x23c2aa);};}exports[_0x8a0f('0x29')]=function(_0x381eba,_0x3adbf2){var _0x4630cc={},_0x339f41={},_0x16c640={'count':0x0,'rows':[]};var _0x3dd0e0=_[_0x8a0f('0x2a')](db[_0x8a0f('0x2b')]['rawAttributes'],function(_0x260e4a){return{'name':_0x260e4a[_0x8a0f('0x2c')],'type':_0x260e4a[_0x8a0f('0x2d')][_0x8a0f('0x2e')]};});_0x339f41['model']=_[_0x8a0f('0x2f')](_[_0x8a0f('0x2a')](_0x3dd0e0,_0x8a0f('0x27')),[_0x8a0f('0x27')]);_0x339f41[_0x8a0f('0x30')]=_[_0x8a0f('0x31')](_0x381eba['query']);_0x339f41[_0x8a0f('0x32')]=_[_0x8a0f('0x33')](_0x339f41[_0x8a0f('0x34')],_0x339f41[_0x8a0f('0x30')]);_0x4630cc[_0x8a0f('0x35')]=_['intersection'](_0x339f41['model'],qs[_0x8a0f('0x36')](_0x381eba[_0x8a0f('0x30')][_0x8a0f('0x36')]));_0x4630cc['attributes']=_0x4630cc[_0x8a0f('0x35')]['length']?_0x4630cc['attributes']:_0x339f41[_0x8a0f('0x34')];if(!_0x381eba[_0x8a0f('0x30')]['hasOwnProperty'](_0x8a0f('0x37'))){_0x4630cc[_0x8a0f('0x1e')]=qs[_0x8a0f('0x1e')](_0x381eba['query'][_0x8a0f('0x1e')]);_0x4630cc[_0x8a0f('0x38')]=qs[_0x8a0f('0x38')](_0x381eba[_0x8a0f('0x30')][_0x8a0f('0x38')]);}_0x4630cc['order']=qs['sort'](_0x381eba[_0x8a0f('0x30')][_0x8a0f('0x39')]);_0x4630cc[_0x8a0f('0x3a')]=qs['filters'](_['pick'](_0x381eba[_0x8a0f('0x30')],_0x339f41[_0x8a0f('0x32')]),_0x3dd0e0);if(_0x381eba[_0x8a0f('0x30')]['filter']){_0x4630cc[_0x8a0f('0x3a')]=_['merge'](_0x4630cc[_0x8a0f('0x3a')],{'$or':_[_0x8a0f('0x2a')](_0x3dd0e0,function(_0x499c0c){if(_0x499c0c[_0x8a0f('0x2d')]!=='VIRTUAL'){var _0x5dfdb7={};_0x5dfdb7[_0x499c0c[_0x8a0f('0x27')]]={'$like':'%'+_0x381eba[_0x8a0f('0x30')][_0x8a0f('0x3b')]+'%'};return _0x5dfdb7;}})});}_0x4630cc=_[_0x8a0f('0x3c')]({},_0x4630cc,_0x381eba[_0x8a0f('0x3d')]);var _0xcbac={'where':_0x4630cc[_0x8a0f('0x3a')]};return db[_0x8a0f('0x2b')][_0x8a0f('0x1d')](_0xcbac)[_0x8a0f('0x24')](function(_0xc63500){_0x16c640[_0x8a0f('0x1d')]=_0xc63500;if(_0x381eba[_0x8a0f('0x30')][_0x8a0f('0x3e')]){_0x4630cc[_0x8a0f('0x3f')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x8a0f('0x40')](_0x4630cc);})[_0x8a0f('0x24')](function(_0x5bb87f){_0x16c640[_0x8a0f('0x41')]=_0x5bb87f;return _0x16c640;})[_0x8a0f('0x24')](respondWithFilteredResult(_0x3adbf2,_0x4630cc))[_0x8a0f('0x42')](handleError(_0x3adbf2,null));};exports[_0x8a0f('0x43')]=function(_0x22b6c0,_0x56ee04){var _0x263407={'raw':!![],'where':{'id':_0x22b6c0[_0x8a0f('0x44')]['id']}},_0x46784f={};_0x46784f['model']=_[_0x8a0f('0x31')](db['VoiceMailMessage'][_0x8a0f('0x45')]);_0x46784f[_0x8a0f('0x30')]=_[_0x8a0f('0x31')](_0x22b6c0['query']);_0x46784f[_0x8a0f('0x32')]=_[_0x8a0f('0x33')](_0x46784f[_0x8a0f('0x34')],_0x46784f[_0x8a0f('0x30')]);_0x263407[_0x8a0f('0x35')]=_[_0x8a0f('0x33')](_0x46784f[_0x8a0f('0x34')],qs[_0x8a0f('0x36')](_0x22b6c0[_0x8a0f('0x30')][_0x8a0f('0x36')]));_0x263407[_0x8a0f('0x35')]=_0x263407['attributes'][_0x8a0f('0x46')]?_0x263407['attributes']:_0x46784f[_0x8a0f('0x34')];if(_0x22b6c0[_0x8a0f('0x30')][_0x8a0f('0x3e')]){_0x263407['include']=[{'all':!![]}];}_0x263407=_[_0x8a0f('0x3c')]({},_0x263407,_0x22b6c0[_0x8a0f('0x3d')]);return db[_0x8a0f('0x2b')][_0x8a0f('0x47')](_0x263407)['then'](handleEntityNotFound(_0x56ee04,null))[_0x8a0f('0x24')](respondWithResult(_0x56ee04,null))[_0x8a0f('0x42')](handleError(_0x56ee04,null));};exports[_0x8a0f('0x48')]=function(_0x5f3765,_0x4c3b93){return db[_0x8a0f('0x2b')][_0x8a0f('0x48')](_0x5f3765['body'],{})[_0x8a0f('0x24')](respondWithResult(_0x4c3b93,0xc9))[_0x8a0f('0x42')](handleError(_0x4c3b93,null));};exports[_0x8a0f('0x23')]=function(_0x212916,_0x116673){if(_0x212916[_0x8a0f('0x49')]['id']){delete _0x212916[_0x8a0f('0x49')]['id'];}return db['VoiceMailMessage'][_0x8a0f('0x47')]({'where':{'id':_0x212916['params']['id']}})[_0x8a0f('0x24')](handleEntityNotFound(_0x116673,null))[_0x8a0f('0x24')](saveUpdates(_0x212916[_0x8a0f('0x49')],null))['then'](respondWithResult(_0x116673,null))[_0x8a0f('0x42')](handleError(_0x116673,null));};exports[_0x8a0f('0x25')]=function(_0x3eb625,_0x3d56ab){return db[_0x8a0f('0x2b')][_0x8a0f('0x47')]({'where':{'id':_0x3eb625[_0x8a0f('0x44')]['id']}})[_0x8a0f('0x24')](handleEntityNotFound(_0x3d56ab,null))[_0x8a0f('0x24')](removeEntity(_0x3d56ab,null))[_0x8a0f('0x42')](handleError(_0x3d56ab,null));};exports[_0x8a0f('0x4a')]=function(_0xb05ee9,_0x396e62,_0x487e4e){return db[_0x8a0f('0x2b')][_0x8a0f('0x47')]({'where':{'id':_0xb05ee9['params']['id']},'attributes':['id',_0x8a0f('0x4b'),_0x8a0f('0x4c')]})['then'](handleEntityNotFound(_0x396e62,null))[_0x8a0f('0x24')](function(_0x33103){if(_0x33103){if(!_0x33103[_0x8a0f('0x4b')]){throw new db['Sequelize'][(_0x8a0f('0x4d'))](_0x8a0f('0x4e'));}var _0xcc6f72={'Content-Type':_0x8a0f('0x4f'),'Content-Disposition':_0x8a0f('0x50')};if(_0x33103[_0x8a0f('0x4c')]){_0xcc6f72[_0x8a0f('0x51')]=_0x8a0f('0x52')+_0x33103[_0x8a0f('0x4c')]+_0x8a0f('0x53');}_0x396e62[_0x8a0f('0x1f')](_0xcc6f72);return _0x396e62[_0x8a0f('0x28')](new Buffer(_0x33103[_0x8a0f('0x4b')]));}})[_0x8a0f('0x42')](handleError(_0x396e62,null));}; \ No newline at end of file +var _0xd932=['catch','params','length','find','create','body','download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','count','limit','set','Content-Range','json','apply','reject','then','error','stack','name','index','map','VoiceMailMessage','rawAttributes','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','where','pick','type','filter','merge','options','include','rows'];(function(_0x1f3b3f,_0x15c9f9){var _0x2c8036=function(_0x41b527){while(--_0x41b527){_0x1f3b3f['push'](_0x1f3b3f['shift']());}};_0x2c8036(++_0x15c9f9);}(_0xd932,0x101));var _0x2d93=function(_0x483713,_0x265354){_0x483713=_0x483713-0x0;var _0x175edd=_0xd932[_0x483713];return _0x175edd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2d93('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2d93('0x1'));var jsonpatch=require(_0x2d93('0x2'));var rp=require(_0x2d93('0x3'));var moment=require('moment');var BPromise=require(_0x2d93('0x4'));var Mustache=require(_0x2d93('0x5'));var util=require(_0x2d93('0x6'));var path=require(_0x2d93('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2d93('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2d93('0x9'));var crypto=require(_0x2d93('0xa'));var jsforce=require(_0x2d93('0xb'));var deskjs=require(_0x2d93('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2d93('0xd'));var Papa=require(_0x2d93('0xe'));var Redis=require(_0x2d93('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2d93('0x10'));var as=require(_0x2d93('0x11'));var hardwareService=require(_0x2d93('0x12'));var logger=require(_0x2d93('0x13'))(_0x2d93('0x14'));var utils=require(_0x2d93('0x15'));var config=require(_0x2d93('0x16'));var licenseUtil=require(_0x2d93('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f4018,_0xb498b5){_0xb498b5=_0xb498b5||0xcc;return function(_0x477d95){if(_0x477d95){return _0x1f4018[_0x2d93('0x18')](_0xb498b5);}return _0x1f4018['status'](_0xb498b5)[_0x2d93('0x19')]();};}function respondWithResult(_0x21e901,_0x29cba8){_0x29cba8=_0x29cba8||0xc8;return function(_0x27278e){if(_0x27278e){return _0x21e901[_0x2d93('0x1a')](_0x29cba8)['json'](_0x27278e);}};}function respondWithFilteredResult(_0x519e0a,_0x27268e){return function(_0x2a80ad){if(_0x2a80ad){var _0x5c005b=_0x2a80ad[_0x2d93('0x1b')],_0x3eeb87=_0x27268e['offset'],_0xd1e0b1=_0x27268e['offset']+_0x27268e[_0x2d93('0x1c')],_0x500c24;if(_0xd1e0b1>=_0x5c005b){_0xd1e0b1=_0x5c005b;_0x500c24=0xc8;}else{_0x500c24=0xce;}_0x519e0a[_0x2d93('0x1a')](_0x500c24);return _0x519e0a[_0x2d93('0x1d')](_0x2d93('0x1e'),_0x3eeb87+'-'+_0xd1e0b1+'/'+_0x5c005b)[_0x2d93('0x1f')](_0x2a80ad);}return null;};}function patchUpdates(_0xba7210){return function(_0x5a52f2){try{jsonpatch[_0x2d93('0x20')](_0x5a52f2,_0xba7210,!![]);}catch(_0x1c9ca3){return BPromise[_0x2d93('0x21')](_0x1c9ca3);}return _0x5a52f2['save']();};}function saveUpdates(_0x5d0071,_0x2ed0e3){return function(_0x47ea01){if(_0x47ea01){return _0x47ea01['update'](_0x5d0071)[_0x2d93('0x22')](function(_0x253f07){return _0x253f07;});}return null;};}function removeEntity(_0xcef073,_0x4a0aed){return function(_0x41590b){if(_0x41590b){return _0x41590b['destroy']()[_0x2d93('0x22')](function(){_0xcef073[_0x2d93('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4897f9,_0x1d3be7){return function(_0x51cde3){if(!_0x51cde3){_0x4897f9[_0x2d93('0x18')](0x194);}return _0x51cde3;};}function handleError(_0x420fbf,_0x3a0a25){_0x3a0a25=_0x3a0a25||0x1f4;return function(_0x3d5066){logger[_0x2d93('0x23')](_0x3d5066[_0x2d93('0x24')]);if(_0x3d5066[_0x2d93('0x25')]){delete _0x3d5066[_0x2d93('0x25')];}_0x420fbf[_0x2d93('0x1a')](_0x3a0a25)['send'](_0x3d5066);};}exports[_0x2d93('0x26')]=function(_0xb8db8e,_0x14a04f){var _0x9d71ee={},_0x35a499={},_0x21de06={'count':0x0,'rows':[]};var _0x207f2f=_[_0x2d93('0x27')](db[_0x2d93('0x28')][_0x2d93('0x29')],function(_0x5cc02f){return{'name':_0x5cc02f['fieldName'],'type':_0x5cc02f['type'][_0x2d93('0x2a')]};});_0x35a499[_0x2d93('0x2b')]=_[_0x2d93('0x2c')](_[_0x2d93('0x27')](_0x207f2f,_0x2d93('0x25')),['name']);_0x35a499[_0x2d93('0x2d')]=_[_0x2d93('0x2e')](_0xb8db8e[_0x2d93('0x2d')]);_0x35a499[_0x2d93('0x2f')]=_[_0x2d93('0x30')](_0x35a499[_0x2d93('0x2b')],_0x35a499[_0x2d93('0x2d')]);_0x9d71ee['attributes']=_['intersection'](_0x35a499[_0x2d93('0x2b')],qs[_0x2d93('0x31')](_0xb8db8e[_0x2d93('0x2d')]['fields']));_0x9d71ee[_0x2d93('0x32')]=_0x9d71ee[_0x2d93('0x32')]['length']?_0x9d71ee[_0x2d93('0x32')]:_0x35a499[_0x2d93('0x2b')];if(!_0xb8db8e[_0x2d93('0x2d')][_0x2d93('0x33')](_0x2d93('0x34'))){_0x9d71ee[_0x2d93('0x1c')]=qs[_0x2d93('0x1c')](_0xb8db8e['query'][_0x2d93('0x1c')]);_0x9d71ee[_0x2d93('0x35')]=qs[_0x2d93('0x35')](_0xb8db8e[_0x2d93('0x2d')][_0x2d93('0x35')]);}_0x9d71ee[_0x2d93('0x36')]=qs['sort'](_0xb8db8e[_0x2d93('0x2d')]['sort']);_0x9d71ee[_0x2d93('0x37')]=qs['filters'](_[_0x2d93('0x38')](_0xb8db8e['query'],_0x35a499[_0x2d93('0x2f')]),_0x207f2f);if(_0xb8db8e[_0x2d93('0x2d')]['filter']){_0x9d71ee[_0x2d93('0x37')]=_['merge'](_0x9d71ee[_0x2d93('0x37')],{'$or':_[_0x2d93('0x27')](_0x207f2f,function(_0x19a111){if(_0x19a111[_0x2d93('0x39')]!=='VIRTUAL'){var _0x31d7d1={};_0x31d7d1[_0x19a111[_0x2d93('0x25')]]={'$like':'%'+_0xb8db8e['query'][_0x2d93('0x3a')]+'%'};return _0x31d7d1;}})});}_0x9d71ee=_[_0x2d93('0x3b')]({},_0x9d71ee,_0xb8db8e[_0x2d93('0x3c')]);var _0x114fb7={'where':_0x9d71ee[_0x2d93('0x37')]};return db[_0x2d93('0x28')][_0x2d93('0x1b')](_0x114fb7)[_0x2d93('0x22')](function(_0xad2539){_0x21de06[_0x2d93('0x1b')]=_0xad2539;if(_0xb8db8e[_0x2d93('0x2d')]['includeAll']){_0x9d71ee[_0x2d93('0x3d')]=[{'all':!![]}];}return db[_0x2d93('0x28')]['findAll'](_0x9d71ee);})[_0x2d93('0x22')](function(_0x56fc8c){_0x21de06[_0x2d93('0x3e')]=_0x56fc8c;return _0x21de06;})[_0x2d93('0x22')](respondWithFilteredResult(_0x14a04f,_0x9d71ee))[_0x2d93('0x3f')](handleError(_0x14a04f,null));};exports['show']=function(_0x144769,_0x3b9e0a){var _0x5cd0f5={'raw':!![],'where':{'id':_0x144769[_0x2d93('0x40')]['id']}},_0x990a0b={};_0x990a0b[_0x2d93('0x2b')]=_[_0x2d93('0x2e')](db[_0x2d93('0x28')][_0x2d93('0x29')]);_0x990a0b[_0x2d93('0x2d')]=_['keys'](_0x144769[_0x2d93('0x2d')]);_0x990a0b['filters']=_['intersection'](_0x990a0b['model'],_0x990a0b[_0x2d93('0x2d')]);_0x5cd0f5[_0x2d93('0x32')]=_[_0x2d93('0x30')](_0x990a0b[_0x2d93('0x2b')],qs[_0x2d93('0x31')](_0x144769[_0x2d93('0x2d')][_0x2d93('0x31')]));_0x5cd0f5['attributes']=_0x5cd0f5['attributes'][_0x2d93('0x41')]?_0x5cd0f5[_0x2d93('0x32')]:_0x990a0b[_0x2d93('0x2b')];if(_0x144769[_0x2d93('0x2d')]['includeAll']){_0x5cd0f5['include']=[{'all':!![]}];}_0x5cd0f5=_[_0x2d93('0x3b')]({},_0x5cd0f5,_0x144769['options']);return db[_0x2d93('0x28')][_0x2d93('0x42')](_0x5cd0f5)[_0x2d93('0x22')](handleEntityNotFound(_0x3b9e0a,null))[_0x2d93('0x22')](respondWithResult(_0x3b9e0a,null))[_0x2d93('0x3f')](handleError(_0x3b9e0a,null));};exports[_0x2d93('0x43')]=function(_0x5a3779,_0x447cca){return db[_0x2d93('0x28')][_0x2d93('0x43')](_0x5a3779[_0x2d93('0x44')],{})[_0x2d93('0x22')](respondWithResult(_0x447cca,0xc9))[_0x2d93('0x3f')](handleError(_0x447cca,null));};exports['update']=function(_0x2731ac,_0x1387fe){if(_0x2731ac[_0x2d93('0x44')]['id']){delete _0x2731ac[_0x2d93('0x44')]['id'];}return db[_0x2d93('0x28')]['find']({'where':{'id':_0x2731ac[_0x2d93('0x40')]['id']}})[_0x2d93('0x22')](handleEntityNotFound(_0x1387fe,null))[_0x2d93('0x22')](saveUpdates(_0x2731ac[_0x2d93('0x44')],null))['then'](respondWithResult(_0x1387fe,null))['catch'](handleError(_0x1387fe,null));};exports['destroy']=function(_0x1c28d1,_0x3d3106){return db[_0x2d93('0x28')][_0x2d93('0x42')]({'where':{'id':_0x1c28d1[_0x2d93('0x40')]['id']}})['then'](handleEntityNotFound(_0x3d3106,null))[_0x2d93('0x22')](removeEntity(_0x3d3106,null))[_0x2d93('0x3f')](handleError(_0x3d3106,null));};exports[_0x2d93('0x45')]=function(_0x1803a5,_0x2c2567,_0x468629){return db[_0x2d93('0x28')][_0x2d93('0x42')]({'where':{'id':_0x1803a5[_0x2d93('0x40')]['id']},'attributes':['id',_0x2d93('0x46'),_0x2d93('0x47')]})['then'](handleEntityNotFound(_0x2c2567,null))[_0x2d93('0x22')](function(_0x1ce439){if(_0x1ce439){if(!_0x1ce439[_0x2d93('0x46')]){throw new db[(_0x2d93('0x48'))][(_0x2d93('0x49'))]('VoiceMailMessage\x20not\x20found');}var _0x3a1b27={'Content-Type':_0x2d93('0x4a'),'Content-Disposition':_0x2d93('0x4b')};if(_0x1ce439[_0x2d93('0x47')]){_0x3a1b27[_0x2d93('0x4c')]=_0x2d93('0x4d')+_0x1ce439['msg_id']+_0x2d93('0x4e');}_0x2c2567[_0x2d93('0x1d')](_0x3a1b27);return _0x2c2567[_0x2d93('0x4f')](new Buffer(_0x1ce439[_0x2d93('0x46')]));}})[_0x2d93('0x3f')](handleError(_0x2c2567,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 3c41ff9..c27c5b6 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 _0xa3c4=['voice_voicemail_messages','dir','util','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define'];(function(_0x64c4e,_0x493d08){var _0x5df5d3=function(_0x523897){while(--_0x523897){_0x64c4e['push'](_0x64c4e['shift']());}};_0x5df5d3(++_0x493d08);}(_0xa3c4,0x1a6));var _0x4a3c=function(_0x587937,_0x1ba3e6){_0x587937=_0x587937-0x0;var _0x2edd99=_0xa3c4[_0x587937];return _0x2edd99;};'use strict';var _=require('lodash');var util=require(_0x4a3c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4a3c('0x1'));var rp=require(_0x4a3c('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4a3c('0x3'));var config=require(_0x4a3c('0x4'));var attributes=require(_0x4a3c('0x5'));module[_0x4a3c('0x6')]=function(_0x5bab6e,_0x42cf69){return _0x5bab6e[_0x4a3c('0x7')]('VoiceMailMessage',attributes,{'tableName':_0x4a3c('0x8'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x4a3c('0x9')]}],'timestamps':![]});}; \ No newline at end of file +var _0x55cf=['define','VoiceMailMessage','dir','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports'];(function(_0x2e32c1,_0x2f2986){var _0x459980=function(_0x3e6f9d){while(--_0x3e6f9d){_0x2e32c1['push'](_0x2e32c1['shift']());}};_0x459980(++_0x2f2986);}(_0x55cf,0x148));var _0xf55c=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x55cf[_0x15bc81];return _0x59440e;};'use strict';var _=require('lodash');var util=require(_0xf55c('0x0'));var logger=require('../../config/logger')(_0xf55c('0x1'));var moment=require(_0xf55c('0x2'));var BPromise=require(_0xf55c('0x3'));var rp=require(_0xf55c('0x4'));var fs=require('fs');var path=require(_0xf55c('0x5'));var rimraf=require(_0xf55c('0x6'));var config=require(_0xf55c('0x7'));var attributes=require(_0xf55c('0x8'));module[_0xf55c('0x9')]=function(_0x5723dd,_0x3ef089){return _0x5723dd[_0xf55c('0xa')](_0xf55c('0xb'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xf55c('0xc'),'fields':[_0xf55c('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 04c11f6..49aa10e 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 _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x228800,_0x1a89fe){var _0x5383f9=function(_0x20e98b){while(--_0x20e98b){_0x228800['push'](_0x228800['shift']());}};_0x5383f9(++_0x1a89fe);}(_0xda2d,0x102));var _0xdda2=function(_0x5e5900,_0x7d2d44){_0x5e5900=_0x5e5900-0x0;var _0x3e4ad7=_0xda2d[_0x5e5900];return _0x3e4ad7;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file +var _0x0295=['client','http','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5d9fca,_0x4271d2){var _0x1d5f0e=function(_0x35a1d7){while(--_0x35a1d7){_0x5d9fca['push'](_0x5d9fca['shift']());}};_0x1d5f0e(++_0x4271d2);}(_0x0295,0x1f0));var _0x5029=function(_0x2f7892,_0x1c26c5){_0x2f7892=_0x2f7892-0x0;var _0x2f9e9c=_0x0295[_0x2f7892];return _0x2f9e9c;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 5a8a714..3fd78b0 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 _0xc4fb=['/:id','show','getSounds','post','create','addSound','put','update','delete','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated'];(function(_0x3f4fb6,_0x45dc02){var _0x441b16=function(_0x4e9108){while(--_0x4e9108){_0x3f4fb6['push'](_0x3f4fb6['shift']());}};_0x441b16(++_0x45dc02);}(_0xc4fb,0x12a));var _0xbc4f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc4fb[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xbc4f('0x0'));var util=require(_0xbc4f('0x1'));var path=require(_0xbc4f('0x2'));var timeout=require('connect-timeout');var express=require(_0xbc4f('0x3'));var router=express[_0xbc4f('0x4')]();var auth=require(_0xbc4f('0x5'));var interaction=require(_0xbc4f('0x6'));var config=require('../../config/environment');var controller=require(_0xbc4f('0x7'));router[_0xbc4f('0x8')]('/',auth[_0xbc4f('0x9')](),controller['index']);router['get'](_0xbc4f('0xa'),auth[_0xbc4f('0x9')](),controller[_0xbc4f('0xb')]);router[_0xbc4f('0x8')]('/:id/sounds',auth[_0xbc4f('0x9')](),controller[_0xbc4f('0xc')]);router[_0xbc4f('0xd')]('/',auth[_0xbc4f('0x9')](),controller[_0xbc4f('0xe')]);router[_0xbc4f('0xd')]('/:id/sounds',auth[_0xbc4f('0x9')](),controller[_0xbc4f('0xf')]);router[_0xbc4f('0x10')]('/:id',auth[_0xbc4f('0x9')](),controller[_0xbc4f('0x11')]);router[_0xbc4f('0x12')](_0xbc4f('0xa'),auth[_0xbc4f('0x9')](),controller['destroy']);router[_0xbc4f('0x12')](_0xbc4f('0x13'),auth['isAuthenticated'](),controller[_0xbc4f('0x14')]);module[_0xbc4f('0x15')]=router; \ No newline at end of file +var _0xdd5d=['delete','removeSound','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','getSounds','create','post','/:id/sounds','addSound'];(function(_0x475aa9,_0x439aab){var _0x360bbc=function(_0x331a22){while(--_0x331a22){_0x475aa9['push'](_0x475aa9['shift']());}};_0x360bbc(++_0x439aab);}(_0xdd5d,0x87));var _0xddd5=function(_0x3fd5b6,_0x30af7e){_0x3fd5b6=_0x3fd5b6-0x0;var _0xcf614f=_0xdd5d[_0x3fd5b6];return _0xcf614f;};'use strict';var multer=require(_0xddd5('0x0'));var util=require(_0xddd5('0x1'));var path=require(_0xddd5('0x2'));var timeout=require(_0xddd5('0x3'));var express=require(_0xddd5('0x4'));var router=express['Router']();var auth=require(_0xddd5('0x5'));var interaction=require(_0xddd5('0x6'));var config=require('../../config/environment');var controller=require(_0xddd5('0x7'));router[_0xddd5('0x8')]('/',auth[_0xddd5('0x9')](),controller['index']);router[_0xddd5('0x8')](_0xddd5('0xa'),auth[_0xddd5('0x9')](),controller[_0xddd5('0xb')]);router[_0xddd5('0x8')]('/:id/sounds',auth[_0xddd5('0x9')](),controller[_0xddd5('0xc')]);router['post']('/',auth[_0xddd5('0x9')](),controller[_0xddd5('0xd')]);router[_0xddd5('0xe')](_0xddd5('0xf'),auth[_0xddd5('0x9')](),controller[_0xddd5('0x10')]);router['put'](_0xddd5('0xa'),auth[_0xddd5('0x9')](),controller['update']);router[_0xddd5('0x11')]('/:id',auth[_0xddd5('0x9')](),controller['destroy']);router[_0xddd5('0x11')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0xddd5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 4d82212..db5607d 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 _0xeb7c=['sequelize','exports','STRING','name','ENUM','custom','quietmp3nb','files','alpha','BOOLEAN'];(function(_0x266f9f,_0x5f2c2d){var _0x16593c=function(_0x1e2b4c){while(--_0x1e2b4c){_0x266f9f['push'](_0x266f9f['shift']());}};_0x16593c(++_0x5f2c2d);}(_0xeb7c,0x6e));var _0xceb7=function(_0xbc7499,_0x18863e){_0xbc7499=_0xbc7499-0x0;var _0x3d7d02=_0xeb7c[_0xbc7499];return _0x3d7d02;};'use strict';var Sequelize=require(_0xceb7('0x0'));module[_0xceb7('0x1')]={'name':{'type':Sequelize[_0xceb7('0x2')],'allowNull':![],'unique':_0xceb7('0x3')},'mode':{'type':Sequelize[_0xceb7('0x4')](_0xceb7('0x5'),'files','mp3nb',_0xceb7('0x6'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':_0xceb7('0x7')},'directory':{'type':Sequelize[_0xceb7('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xceb7('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xceb7('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xceb7('0x2')],'allowNull':!![],'defaultValue':_0xceb7('0x8')},'format':{'type':Sequelize[_0xceb7('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xceb7('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd3e3=['TIMESTAMP','sequelize','exports','name','ENUM','custom','files','quietmp3nb','quietmp3','STRING'];(function(_0x2cf0ed,_0x3535e3){var _0x2483c7=function(_0x3f3751){while(--_0x3f3751){_0x2cf0ed['push'](_0x2cf0ed['shift']());}};_0x2483c7(++_0x3535e3);}(_0xd3e3,0x8d));var _0x3d3e=function(_0x22a8c4,_0x51c09a){_0x22a8c4=_0x22a8c4-0x0;var _0x104c6d=_0xd3e3[_0x22a8c4];return _0x104c6d;};'use strict';var Sequelize=require(_0x3d3e('0x0'));module[_0x3d3e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3d3e('0x2')},'mode':{'type':Sequelize[_0x3d3e('0x3')](_0x3d3e('0x4'),_0x3d3e('0x5'),'mp3nb',_0x3d3e('0x6'),_0x3d3e('0x7'),'mp3'),'allowNull':!![],'defaultValue':_0x3d3e('0x5')},'directory':{'type':Sequelize[_0x3d3e('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0x3d3e('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0x3d3e('0x8')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x3d3e('0x8')],'allowNull':!![]},'stamp':{'type':_0x3d3e('0x9')},'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 d52a4f7..089ff7c 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 _0x6f0d=['unlinkSync','getSounds','pick','nolimit','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','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/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','error','stack','name','map','fieldName','type','key','model','query','intersection','attributes','fields','length','order','sort','filters','filter','where','merge','VIRTUAL','options','VoiceMusicOnHold','include','findAll','catch','show','params','keys','rawAttributes','find','body','create','sequelize','transaction','mode','files','directory','root','server/files/moh','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','join','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','symlinkSync','removeSound'];(function(_0x3e4359,_0x5aa25c){var _0x20df31=function(_0x6f3b7a){while(--_0x6f3b7a){_0x3e4359['push'](_0x3e4359['shift']());}};_0x20df31(++_0x5aa25c);}(_0x6f0d,0xe0));var _0xd6f0=function(_0x3712e0,_0x46fd12){_0x3712e0=_0x3712e0-0x0;var _0x1c4529=_0x6f0d[_0x3712e0];return _0x1c4529;};'use strict';var pdf=require(_0xd6f0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd6f0('0x1'));var zipdir=require(_0xd6f0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd6f0('0x3'));var BPromise=require(_0xd6f0('0x4'));var Mustache=require(_0xd6f0('0x5'));var util=require(_0xd6f0('0x6'));var path=require('path');var sox=require(_0xd6f0('0x7'));var csv=require(_0xd6f0('0x8'));var ejs=require(_0xd6f0('0x9'));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(_0xd6f0('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd6f0('0xf'));var Papa=require(_0xd6f0('0x10'));var Redis=require(_0xd6f0('0x11'));var authService=require(_0xd6f0('0x12'));var qs=require(_0xd6f0('0x13'));var as=require(_0xd6f0('0x14'));var hardwareService=require(_0xd6f0('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xd6f0('0x16'));var config=require(_0xd6f0('0x17'));var licenseUtil=require(_0xd6f0('0x18'));var db=require(_0xd6f0('0x19'))['db'];function respondWithStatusCode(_0x30fcca,_0x2a7486){_0x2a7486=_0x2a7486||0xcc;return function(_0x7d0d34){if(_0x7d0d34){return _0x30fcca['sendStatus'](_0x2a7486);}return _0x30fcca[_0xd6f0('0x1a')](_0x2a7486)[_0xd6f0('0x1b')]();};}function respondWithResult(_0x49ff2d,_0x54708c){_0x54708c=_0x54708c||0xc8;return function(_0x514db9){if(_0x514db9){return _0x49ff2d[_0xd6f0('0x1a')](_0x54708c)[_0xd6f0('0x1c')](_0x514db9);}};}function respondWithFilteredResult(_0x443e4a,_0x1c778a){return function(_0x521b66){if(_0x521b66){var _0x408030=_0x521b66[_0xd6f0('0x1d')],_0x4ded02=_0x1c778a['offset'],_0x218339=_0x1c778a[_0xd6f0('0x1e')]+_0x1c778a[_0xd6f0('0x1f')],_0x2f5032;if(_0x218339>=_0x408030){_0x218339=_0x408030;_0x2f5032=0xc8;}else{_0x2f5032=0xce;}_0x443e4a['status'](_0x2f5032);return _0x443e4a['set'](_0xd6f0('0x20'),_0x4ded02+'-'+_0x218339+'/'+_0x408030)[_0xd6f0('0x1c')](_0x521b66);}return null;};}function patchUpdates(_0x17f408){return function(_0x2b508c){try{jsonpatch[_0xd6f0('0x21')](_0x2b508c,_0x17f408,!![]);}catch(_0x1fd3c6){return BPromise[_0xd6f0('0x22')](_0x1fd3c6);}return _0x2b508c['save']();};}function saveUpdates(_0x5ab380,_0x18f688){return function(_0x1d6624){if(_0x1d6624){return _0x1d6624[_0xd6f0('0x23')](_0x5ab380)[_0xd6f0('0x24')](function(_0x38702c){return _0x38702c;});}return null;};}function removeEntity(_0x501e92,_0x4a5a86){return function(_0x11f817){if(_0x11f817){return _0x11f817[_0xd6f0('0x25')]()[_0xd6f0('0x24')](function(){var _0x45448a=_0x11f817[_0xd6f0('0x26')]({'plain':!![]});var _0x4323f3=_0xd6f0('0x27');return db[_0xd6f0('0x28')]['destroy']({'where':{'type':_0x4323f3,'resourceId':_0x45448a['id']}})[_0xd6f0('0x24')](function(){return _0x11f817;});})[_0xd6f0('0x24')](function(){_0x501e92[_0xd6f0('0x1a')](0xcc)[_0xd6f0('0x1b')]();});}};}function handleEntityNotFound(_0x2bf5f0,_0x10787b){return function(_0xa834f7){if(!_0xa834f7){_0x2bf5f0[_0xd6f0('0x29')](0x194);}return _0xa834f7;};}function handleError(_0x1fa89b,_0x4159a7){_0x4159a7=_0x4159a7||0x1f4;return function(_0x4b9f37){logger[_0xd6f0('0x2a')](_0x4b9f37[_0xd6f0('0x2b')]);if(_0x4b9f37[_0xd6f0('0x2c')]){delete _0x4b9f37[_0xd6f0('0x2c')];}_0x1fa89b[_0xd6f0('0x1a')](_0x4159a7)['send'](_0x4b9f37);};}exports['index']=function(_0xe9732e,_0x127665){var _0xadb364={},_0x45f904={},_0x3f8bcc={'count':0x0,'rows':[]};var _0x1df917=_[_0xd6f0('0x2d')](db['VoiceMusicOnHold']['rawAttributes'],function(_0x4477c2){return{'name':_0x4477c2[_0xd6f0('0x2e')],'type':_0x4477c2[_0xd6f0('0x2f')][_0xd6f0('0x30')]};});_0x45f904[_0xd6f0('0x31')]=_[_0xd6f0('0x2d')](_0x1df917,_0xd6f0('0x2c'));_0x45f904[_0xd6f0('0x32')]=_['keys'](_0xe9732e[_0xd6f0('0x32')]);_0x45f904['filters']=_[_0xd6f0('0x33')](_0x45f904['model'],_0x45f904['query']);_0xadb364[_0xd6f0('0x34')]=_[_0xd6f0('0x33')](_0x45f904['model'],qs[_0xd6f0('0x35')](_0xe9732e[_0xd6f0('0x32')][_0xd6f0('0x35')]));_0xadb364['attributes']=_0xadb364[_0xd6f0('0x34')][_0xd6f0('0x36')]?_0xadb364[_0xd6f0('0x34')]:_0x45f904[_0xd6f0('0x31')];if(!_0xe9732e['query']['hasOwnProperty']('nolimit')){_0xadb364[_0xd6f0('0x1f')]=qs[_0xd6f0('0x1f')](_0xe9732e[_0xd6f0('0x32')][_0xd6f0('0x1f')]);_0xadb364[_0xd6f0('0x1e')]=qs[_0xd6f0('0x1e')](_0xe9732e[_0xd6f0('0x32')][_0xd6f0('0x1e')]);}_0xadb364[_0xd6f0('0x37')]=qs[_0xd6f0('0x38')](_0xe9732e[_0xd6f0('0x32')][_0xd6f0('0x38')]);_0xadb364['where']=qs['filters'](_['pick'](_0xe9732e[_0xd6f0('0x32')],_0x45f904[_0xd6f0('0x39')]),_0x1df917);if(_0xe9732e[_0xd6f0('0x32')][_0xd6f0('0x3a')]){_0xadb364[_0xd6f0('0x3b')]=_[_0xd6f0('0x3c')](_0xadb364[_0xd6f0('0x3b')],{'$or':_[_0xd6f0('0x2d')](_0x1df917,function(_0x1b3250){if(_0x1b3250['type']!==_0xd6f0('0x3d')){var _0x5545ab={};_0x5545ab[_0x1b3250[_0xd6f0('0x2c')]]={'$like':'%'+_0xe9732e['query']['filter']+'%'};return _0x5545ab;}})});}_0xadb364=_[_0xd6f0('0x3c')]({},_0xadb364,_0xe9732e[_0xd6f0('0x3e')]);var _0x423d84={'where':_0xadb364['where']};return db[_0xd6f0('0x3f')]['count'](_0x423d84)[_0xd6f0('0x24')](function(_0x4aa82a){_0x3f8bcc[_0xd6f0('0x1d')]=_0x4aa82a;if(_0xe9732e['query']['includeAll']){_0xadb364[_0xd6f0('0x40')]=[{'all':!![]}];}return db[_0xd6f0('0x3f')][_0xd6f0('0x41')](_0xadb364);})[_0xd6f0('0x24')](function(_0x3510bc){_0x3f8bcc['rows']=_0x3510bc;return _0x3f8bcc;})[_0xd6f0('0x24')](respondWithFilteredResult(_0x127665,_0xadb364))[_0xd6f0('0x42')](handleError(_0x127665,null));};exports[_0xd6f0('0x43')]=function(_0x48d47a,_0x3e7310){var _0x20051f={'raw':![],'where':{'id':_0x48d47a[_0xd6f0('0x44')]['id']}},_0x5e5893={};_0x5e5893[_0xd6f0('0x31')]=_[_0xd6f0('0x45')](db[_0xd6f0('0x3f')][_0xd6f0('0x46')]);_0x5e5893['query']=_[_0xd6f0('0x45')](_0x48d47a[_0xd6f0('0x32')]);_0x5e5893[_0xd6f0('0x39')]=_[_0xd6f0('0x33')](_0x5e5893[_0xd6f0('0x31')],_0x5e5893[_0xd6f0('0x32')]);_0x20051f['attributes']=_[_0xd6f0('0x33')](_0x5e5893['model'],qs[_0xd6f0('0x35')](_0x48d47a[_0xd6f0('0x32')][_0xd6f0('0x35')]));_0x20051f['attributes']=_0x20051f['attributes']['length']?_0x20051f[_0xd6f0('0x34')]:_0x5e5893[_0xd6f0('0x31')];if(_0x48d47a[_0xd6f0('0x32')]['includeAll']){_0x20051f[_0xd6f0('0x40')]=[{'all':!![]}];}_0x20051f=_['merge']({},_0x20051f,_0x48d47a[_0xd6f0('0x3e')]);return db[_0xd6f0('0x3f')][_0xd6f0('0x47')](_0x20051f)[_0xd6f0('0x24')](handleEntityNotFound(_0x3e7310,null))[_0xd6f0('0x24')](respondWithResult(_0x3e7310,null))[_0xd6f0('0x42')](handleError(_0x3e7310,null));};exports[_0xd6f0('0x23')]=function(_0x50b42d,_0x5cf29e){if(_0x50b42d[_0xd6f0('0x48')]['id']){delete _0x50b42d[_0xd6f0('0x48')]['id'];}return db['VoiceMusicOnHold'][_0xd6f0('0x47')]({'where':{'id':_0x50b42d[_0xd6f0('0x44')]['id']}})['then'](handleEntityNotFound(_0x5cf29e,null))['then'](saveUpdates(_0x50b42d[_0xd6f0('0x48')],null))[_0xd6f0('0x24')](respondWithResult(_0x5cf29e,null))[_0xd6f0('0x42')](handleError(_0x5cf29e,null));};exports[_0xd6f0('0x49')]=function(_0x3101cd,_0xee1eb7,_0x224b54){return db[_0xd6f0('0x4a')][_0xd6f0('0x4b')](function(_0x55bd8d){if(_0x3101cd[_0xd6f0('0x48')][_0xd6f0('0x4c')]===_0xd6f0('0x4d')){_0x3101cd[_0xd6f0('0x48')][_0xd6f0('0x4e')]=path['join'](config[_0xd6f0('0x4f')],_0xd6f0('0x50'),_0x3101cd['body'][_0xd6f0('0x2c')]);}return db[_0xd6f0('0x3f')]['create'](_0x3101cd[_0xd6f0('0x48')],{'transaction':_0x55bd8d})[_0xd6f0('0x24')](function(_0x22fc7f){if(_0x3101cd[_0xd6f0('0x48')][_0xd6f0('0x4c')]===_0xd6f0('0x4d')){fs['mkdirSync'](_0x22fc7f[_0xd6f0('0x4e')],parseInt('0777',0x8));}var _0x378605=_0x3101cd['user'][_0xd6f0('0x26')]({'plain':!![]});if(!_0x378605)throw new Error(_0xd6f0('0x51'));if(_0x378605[_0xd6f0('0x52')]===_0xd6f0('0x53')){var _0x124149=_0x22fc7f[_0xd6f0('0x26')]({'plain':!![]});return db[_0xd6f0('0x54')]['find']({'where':{'name':_0xd6f0('0x27'),'userProfileId':_0x378605[_0xd6f0('0x55')]},'raw':!![]})[_0xd6f0('0x24')](function(_0xddb2a1){if(_0xddb2a1&&_0xddb2a1[_0xd6f0('0x56')]===0x0){return db[_0xd6f0('0x28')][_0xd6f0('0x49')]({'name':_0x124149[_0xd6f0('0x2c')],'resourceId':_0x124149['id'],'type':_0xddb2a1['name'],'sectionId':_0xddb2a1['id']},{})[_0xd6f0('0x24')](function(){return _0x22fc7f;});}else{return _0x22fc7f;}})[_0xd6f0('0x42')](function(_0x548c80){logger[_0xd6f0('0x2a')](_0xd6f0('0x57'),_0x548c80);});}return _0x22fc7f;});})[_0xd6f0('0x24')](respondWithResult(_0xee1eb7,0xc9))[_0xd6f0('0x42')](handleError(_0xee1eb7,null));};exports[_0xd6f0('0x25')]=function(_0x2ad3a,_0x47d486,_0x5f19f9){var _0x1a6206;return db[_0xd6f0('0x3f')][_0xd6f0('0x47')]({'where':{'id':_0x2ad3a['params']['id']}})[_0xd6f0('0x24')](function(_0x4b10e3){if(_0x4b10e3){return db[_0xd6f0('0x4a')][_0xd6f0('0x4b')](function(_0xb77f29){return _0x4b10e3['destroy']({'transaction':_0xb77f29,'raw':!![]})['then'](function(_0x30031d){if(_0x30031d['directory']){fs[_0xd6f0('0x58')](_0x30031d[_0xd6f0('0x4e')])['forEach'](function(_0x7a3e6e){fs['unlinkSync'](path[_0xd6f0('0x59')](_0x30031d[_0xd6f0('0x4e')],_0x7a3e6e));});fs[_0xd6f0('0x5a')](_0x30031d[_0xd6f0('0x4e')]);}return _0x30031d;});})['catch'](function(_0x1f9f29){throw new db[(_0xd6f0('0x5b'))][(_0xd6f0('0x5c'))](_0x1f9f29[_0xd6f0('0x5d')]);});}})['then'](handleEntityNotFound(_0x47d486,null))[_0xd6f0('0x24')](removeEntity(_0x47d486,null))[_0xd6f0('0x42')](handleError(_0x47d486,null));};exports[_0xd6f0('0x5e')]=function(_0x112ba6,_0x32858a,_0x2b4feb){return db[_0xd6f0('0x4a')]['transaction'](function(_0x50dc40){var _0x31910b;return db[_0xd6f0('0x3f')]['find']({'where':{'id':_0x112ba6[_0xd6f0('0x44')]['id']}})[_0xd6f0('0x24')](function(_0x4a0230){if(_0x4a0230){_0x31910b=_0x4a0230;return _0x4a0230[_0xd6f0('0x5e')](_0x112ba6[_0xd6f0('0x48')]['id'],{'transaction':_0x50dc40});}})[_0xd6f0('0x24')](function(_0x67894d){if(_0x67894d){return db[_0xd6f0('0x5f')][_0xd6f0('0x60')]({'where':{'id':_0x112ba6['body']['id']},'attributes':['id',_0xd6f0('0x2c'),_0xd6f0('0x61'),_0xd6f0('0x62'),_0xd6f0('0x63')],'raw':!![]});}})[_0xd6f0('0x24')](function(_0x11d6f0){if(_0x11d6f0){var _0x30e548=path[_0xd6f0('0x59')](config[_0xd6f0('0x4f')],_0xd6f0('0x64'),util[_0xd6f0('0x65')](_0xd6f0('0x66'),path[_0xd6f0('0x67')](_0x11d6f0['save_name'],path['extname'](_0x11d6f0[_0xd6f0('0x61')])),_0x11d6f0[_0xd6f0('0x62')]));var _0x5a1097=path['join'](config[_0xd6f0('0x4f')],_0xd6f0('0x50'),_0x31910b[_0xd6f0('0x2c')],util[_0xd6f0('0x65')](_0xd6f0('0x66'),_0x11d6f0['name'],_0x11d6f0['converted_format']));fs[_0xd6f0('0x68')](_0x30e548,_0x5a1097);return _0x11d6f0;}})[_0xd6f0('0x42')](function(_0x2b8fda){throw new db['Sequelize'][(_0xd6f0('0x5c'))](_0x2b8fda[_0xd6f0('0x5d')]);});})['then'](handleEntityNotFound(_0x32858a,null))[_0xd6f0('0x24')](respondWithResult(_0x32858a,0xc9))[_0xd6f0('0x42')](handleError(_0x32858a,null));};exports[_0xd6f0('0x69')]=function(_0x5f1324,_0x27fe5b,_0x275cd9){return db[_0xd6f0('0x4a')][_0xd6f0('0x4b')](function(_0x167a7f){var _0x208593;return db['VoiceMusicOnHold'][_0xd6f0('0x60')]({'where':{'id':_0x5f1324[_0xd6f0('0x44')]['id']}})[_0xd6f0('0x24')](handleEntityNotFound(_0x27fe5b,null))[_0xd6f0('0x24')](function(_0x18eeca){if(_0x18eeca){_0x208593=_0x18eeca;return _0x18eeca[_0xd6f0('0x69')](_0x5f1324[_0xd6f0('0x44')]['id2']);}})[_0xd6f0('0x24')](function(_0x5a8621){if(_0x5a8621){return db[_0xd6f0('0x5f')][_0xd6f0('0x60')]({'where':{'id':_0x5f1324[_0xd6f0('0x44')]['id2']},'attributes':['id',_0xd6f0('0x2c'),'save_name','converted_format','createdAt'],'raw':!![]});}})[_0xd6f0('0x24')](function(_0x2192ec){if(_0x2192ec){fs[_0xd6f0('0x6a')](path[_0xd6f0('0x59')](_0x208593[_0xd6f0('0x4e')],util[_0xd6f0('0x65')](_0xd6f0('0x66'),_0x2192ec[_0xd6f0('0x2c')],_0x2192ec[_0xd6f0('0x62')])));return _0x2192ec;}})[_0xd6f0('0x42')](function(_0x3f42f2){throw new db[(_0xd6f0('0x5b'))]['ValidationError'](_0x3f42f2[_0xd6f0('0x5d')]);});})[_0xd6f0('0x24')](handleEntityNotFound(_0x27fe5b,null))[_0xd6f0('0x24')](respondWithStatusCode(_0x27fe5b,0xcc))[_0xd6f0('0x42')](handleError(_0x27fe5b,null));};exports[_0xd6f0('0x6b')]=function(_0x3fbb96,_0x505808,_0x423acc){var _0x5513b0={};var _0x3db7b7={};var _0x318712;var _0x20e9f2;return db[_0xd6f0('0x3f')][_0xd6f0('0x60')]({'where':{'id':_0x3fbb96['params']['id']}})[_0xd6f0('0x24')](handleEntityNotFound(_0x505808,null))[_0xd6f0('0x24')](function(_0x31c555){if(_0x31c555){_0x318712=_0x31c555;_0x3db7b7[_0xd6f0('0x31')]=_[_0xd6f0('0x45')](db['Sound'][_0xd6f0('0x46')]);_0x3db7b7[_0xd6f0('0x32')]=_[_0xd6f0('0x45')](_0x3fbb96[_0xd6f0('0x32')]);_0x3db7b7[_0xd6f0('0x39')]=_[_0xd6f0('0x33')](_0x3db7b7['model'],_0x3db7b7[_0xd6f0('0x32')]);_0x5513b0['attributes']=_[_0xd6f0('0x33')](_0x3db7b7[_0xd6f0('0x31')],qs[_0xd6f0('0x35')](_0x3fbb96[_0xd6f0('0x32')][_0xd6f0('0x35')]));_0x5513b0[_0xd6f0('0x34')]=_0x5513b0['attributes']['length']?_0x5513b0[_0xd6f0('0x34')]:_0x3db7b7[_0xd6f0('0x31')];_0x5513b0['order']=qs[_0xd6f0('0x38')](_0x3fbb96[_0xd6f0('0x32')][_0xd6f0('0x38')]);_0x5513b0[_0xd6f0('0x3b')]=qs['filters'](_[_0xd6f0('0x6c')](_0x3fbb96[_0xd6f0('0x32')],_0x3db7b7[_0xd6f0('0x39')]));if(_0x3fbb96[_0xd6f0('0x32')][_0xd6f0('0x3a')]){_0x5513b0[_0xd6f0('0x3b')]=_[_0xd6f0('0x3c')](_0x5513b0[_0xd6f0('0x3b')],{'$or':_[_0xd6f0('0x2d')](_0x5513b0[_0xd6f0('0x34')],function(_0x5c641f){var _0x3358e7={};_0x3358e7[_0x5c641f]={'$like':'%'+_0x3fbb96['query']['filter']+'%'};return _0x3358e7;})});}_0x5513b0=_[_0xd6f0('0x3c')]({},_0x5513b0,_0x3fbb96[_0xd6f0('0x3e')]);return _0x318712[_0xd6f0('0x6b')](_0x5513b0);}})[_0xd6f0('0x24')](function(_0x201697){if(_0x201697){_0x20e9f2=_0x201697[_0xd6f0('0x36')];if(!_0x3fbb96[_0xd6f0('0x32')]['hasOwnProperty'](_0xd6f0('0x6d'))){_0x5513b0['limit']=qs[_0xd6f0('0x1f')](_0x3fbb96[_0xd6f0('0x32')][_0xd6f0('0x1f')]);_0x5513b0[_0xd6f0('0x1e')]=qs[_0xd6f0('0x1e')](_0x3fbb96[_0xd6f0('0x32')][_0xd6f0('0x1e')]);}return _0x318712[_0xd6f0('0x6b')](_0x5513b0);}})[_0xd6f0('0x24')](function(_0x2df816){if(_0x2df816){return _0x2df816?{'count':_0x20e9f2,'rows':_0x2df816}:null;}})[_0xd6f0('0x24')](respondWithResult(_0x505808,null))[_0xd6f0('0x42')](handleError(_0x505808,null));}; \ No newline at end of file +var _0x4e79=['pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','find','update','body','params','transaction','mode','files','directory','root','server/files/moh','create','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','unlinkSync','rmdirSync','addSound','sequelize','Sound','save_name','format','%s.%s','extname','join','converted_format','symlinkSync','Sequelize','ValidationError','message','removeSound','findOne','id2','createdAt','filters','getSounds','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','reject','then','destroy','get','sendStatus','error','stack','name','index','map','VoiceMusicOnHold','fieldName','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where'];(function(_0x540d7c,_0x346903){var _0x5ca48e=function(_0x537854){while(--_0x537854){_0x540d7c['push'](_0x540d7c['shift']());}};_0x5ca48e(++_0x346903);}(_0x4e79,0x10c));var _0x94e7=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4e79[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x94e7('0x0'));var zipdir=require(_0x94e7('0x1'));var jsonpatch=require(_0x94e7('0x2'));var rp=require(_0x94e7('0x3'));var moment=require(_0x94e7('0x4'));var BPromise=require(_0x94e7('0x5'));var Mustache=require('mustache');var util=require(_0x94e7('0x6'));var path=require(_0x94e7('0x7'));var sox=require(_0x94e7('0x8'));var csv=require(_0x94e7('0x9'));var ejs=require(_0x94e7('0xa'));var fs=require('fs');var _=require(_0x94e7('0xb'));var squel=require(_0x94e7('0xc'));var crypto=require(_0x94e7('0xd'));var jsforce=require(_0x94e7('0xe'));var deskjs=require(_0x94e7('0xf'));var toCsv=require(_0x94e7('0x9'));var querystring=require(_0x94e7('0x10'));var Papa=require(_0x94e7('0x11'));var Redis=require('ioredis');var authService=require(_0x94e7('0x12'));var qs=require(_0x94e7('0x13'));var as=require(_0x94e7('0x14'));var hardwareService=require(_0x94e7('0x15'));var logger=require(_0x94e7('0x16'))(_0x94e7('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x94e7('0x18'));var db=require(_0x94e7('0x19'))['db'];function respondWithStatusCode(_0x32c4d4,_0x13312a){_0x13312a=_0x13312a||0xcc;return function(_0xb78a5a){if(_0xb78a5a){return _0x32c4d4['sendStatus'](_0x13312a);}return _0x32c4d4['status'](_0x13312a)[_0x94e7('0x1a')]();};}function respondWithResult(_0x132ff5,_0x20a757){_0x20a757=_0x20a757||0xc8;return function(_0x17baa5){if(_0x17baa5){return _0x132ff5[_0x94e7('0x1b')](_0x20a757)[_0x94e7('0x1c')](_0x17baa5);}};}function respondWithFilteredResult(_0x35e908,_0x5c88e5){return function(_0x2568b4){if(_0x2568b4){var _0x9a3387=_0x2568b4[_0x94e7('0x1d')],_0x4a48a8=_0x5c88e5[_0x94e7('0x1e')],_0x52ef76=_0x5c88e5[_0x94e7('0x1e')]+_0x5c88e5[_0x94e7('0x1f')],_0x45dfd4;if(_0x52ef76>=_0x9a3387){_0x52ef76=_0x9a3387;_0x45dfd4=0xc8;}else{_0x45dfd4=0xce;}_0x35e908[_0x94e7('0x1b')](_0x45dfd4);return _0x35e908[_0x94e7('0x20')]('Content-Range',_0x4a48a8+'-'+_0x52ef76+'/'+_0x9a3387)[_0x94e7('0x1c')](_0x2568b4);}return null;};}function patchUpdates(_0x1f20a5){return function(_0x5db2d5){try{jsonpatch['apply'](_0x5db2d5,_0x1f20a5,!![]);}catch(_0x809eff){return BPromise[_0x94e7('0x21')](_0x809eff);}return _0x5db2d5['save']();};}function saveUpdates(_0x237244,_0x5e3dcc){return function(_0x150f6c){if(_0x150f6c){return _0x150f6c['update'](_0x237244)[_0x94e7('0x22')](function(_0x31bd45){return _0x31bd45;});}return null;};}function removeEntity(_0x112ab9,_0x4b943b){return function(_0x40f501){if(_0x40f501){return _0x40f501[_0x94e7('0x23')]()['then'](function(){var _0x55f8e0=_0x40f501[_0x94e7('0x24')]({'plain':!![]});var _0x296a26='MusicOnHolds';return db['UserProfileResource'][_0x94e7('0x23')]({'where':{'type':_0x296a26,'resourceId':_0x55f8e0['id']}})[_0x94e7('0x22')](function(){return _0x40f501;});})[_0x94e7('0x22')](function(){_0x112ab9[_0x94e7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a2a28,_0x49c44f){return function(_0x3b2ed9){if(!_0x3b2ed9){_0x3a2a28[_0x94e7('0x25')](0x194);}return _0x3b2ed9;};}function handleError(_0x2a880f,_0x96d876){_0x96d876=_0x96d876||0x1f4;return function(_0x1206c5){logger[_0x94e7('0x26')](_0x1206c5[_0x94e7('0x27')]);if(_0x1206c5[_0x94e7('0x28')]){delete _0x1206c5[_0x94e7('0x28')];}_0x2a880f['status'](_0x96d876)['send'](_0x1206c5);};}exports[_0x94e7('0x29')]=function(_0x29438e,_0x21011b){var _0x226bbb={},_0x47ba8f={},_0x45e90d={'count':0x0,'rows':[]};var _0x489c2b=_[_0x94e7('0x2a')](db[_0x94e7('0x2b')]['rawAttributes'],function(_0xeb1e13){return{'name':_0xeb1e13[_0x94e7('0x2c')],'type':_0xeb1e13['type']['key']};});_0x47ba8f[_0x94e7('0x2d')]=_[_0x94e7('0x2a')](_0x489c2b,_0x94e7('0x28'));_0x47ba8f[_0x94e7('0x2e')]=_[_0x94e7('0x2f')](_0x29438e[_0x94e7('0x2e')]);_0x47ba8f['filters']=_[_0x94e7('0x30')](_0x47ba8f[_0x94e7('0x2d')],_0x47ba8f[_0x94e7('0x2e')]);_0x226bbb['attributes']=_[_0x94e7('0x30')](_0x47ba8f['model'],qs[_0x94e7('0x31')](_0x29438e[_0x94e7('0x2e')][_0x94e7('0x31')]));_0x226bbb[_0x94e7('0x32')]=_0x226bbb[_0x94e7('0x32')][_0x94e7('0x33')]?_0x226bbb[_0x94e7('0x32')]:_0x47ba8f[_0x94e7('0x2d')];if(!_0x29438e['query']['hasOwnProperty'](_0x94e7('0x34'))){_0x226bbb[_0x94e7('0x1f')]=qs[_0x94e7('0x1f')](_0x29438e[_0x94e7('0x2e')][_0x94e7('0x1f')]);_0x226bbb[_0x94e7('0x1e')]=qs[_0x94e7('0x1e')](_0x29438e[_0x94e7('0x2e')][_0x94e7('0x1e')]);}_0x226bbb[_0x94e7('0x35')]=qs[_0x94e7('0x36')](_0x29438e['query']['sort']);_0x226bbb[_0x94e7('0x37')]=qs['filters'](_[_0x94e7('0x38')](_0x29438e[_0x94e7('0x2e')],_0x47ba8f['filters']),_0x489c2b);if(_0x29438e[_0x94e7('0x2e')][_0x94e7('0x39')]){_0x226bbb[_0x94e7('0x37')]=_[_0x94e7('0x3a')](_0x226bbb['where'],{'$or':_[_0x94e7('0x2a')](_0x489c2b,function(_0x118315){if(_0x118315[_0x94e7('0x3b')]!==_0x94e7('0x3c')){var _0x4730b9={};_0x4730b9[_0x118315[_0x94e7('0x28')]]={'$like':'%'+_0x29438e['query'][_0x94e7('0x39')]+'%'};return _0x4730b9;}})});}_0x226bbb=_[_0x94e7('0x3a')]({},_0x226bbb,_0x29438e[_0x94e7('0x3d')]);var _0x528040={'where':_0x226bbb['where']};return db[_0x94e7('0x2b')]['count'](_0x528040)[_0x94e7('0x22')](function(_0xafc786){_0x45e90d['count']=_0xafc786;if(_0x29438e[_0x94e7('0x2e')][_0x94e7('0x3e')]){_0x226bbb[_0x94e7('0x3f')]=[{'all':!![]}];}return db[_0x94e7('0x2b')][_0x94e7('0x40')](_0x226bbb);})['then'](function(_0x1a6db1){_0x45e90d['rows']=_0x1a6db1;return _0x45e90d;})[_0x94e7('0x22')](respondWithFilteredResult(_0x21011b,_0x226bbb))[_0x94e7('0x41')](handleError(_0x21011b,null));};exports[_0x94e7('0x42')]=function(_0x413325,_0x17a655){var _0x247132={'raw':![],'where':{'id':_0x413325['params']['id']}},_0x263cf2={};_0x263cf2[_0x94e7('0x2d')]=_[_0x94e7('0x2f')](db[_0x94e7('0x2b')][_0x94e7('0x43')]);_0x263cf2[_0x94e7('0x2e')]=_[_0x94e7('0x2f')](_0x413325[_0x94e7('0x2e')]);_0x263cf2['filters']=_[_0x94e7('0x30')](_0x263cf2['model'],_0x263cf2['query']);_0x247132[_0x94e7('0x32')]=_[_0x94e7('0x30')](_0x263cf2[_0x94e7('0x2d')],qs[_0x94e7('0x31')](_0x413325[_0x94e7('0x2e')][_0x94e7('0x31')]));_0x247132[_0x94e7('0x32')]=_0x247132[_0x94e7('0x32')][_0x94e7('0x33')]?_0x247132['attributes']:_0x263cf2[_0x94e7('0x2d')];if(_0x413325[_0x94e7('0x2e')][_0x94e7('0x3e')]){_0x247132[_0x94e7('0x3f')]=[{'all':!![]}];}_0x247132=_['merge']({},_0x247132,_0x413325[_0x94e7('0x3d')]);return db[_0x94e7('0x2b')][_0x94e7('0x44')](_0x247132)[_0x94e7('0x22')](handleEntityNotFound(_0x17a655,null))[_0x94e7('0x22')](respondWithResult(_0x17a655,null))[_0x94e7('0x41')](handleError(_0x17a655,null));};exports[_0x94e7('0x45')]=function(_0x84a86c,_0x2d2cc1){if(_0x84a86c[_0x94e7('0x46')]['id']){delete _0x84a86c[_0x94e7('0x46')]['id'];}return db['VoiceMusicOnHold'][_0x94e7('0x44')]({'where':{'id':_0x84a86c[_0x94e7('0x47')]['id']}})[_0x94e7('0x22')](handleEntityNotFound(_0x2d2cc1,null))[_0x94e7('0x22')](saveUpdates(_0x84a86c[_0x94e7('0x46')],null))[_0x94e7('0x22')](respondWithResult(_0x2d2cc1,null))[_0x94e7('0x41')](handleError(_0x2d2cc1,null));};exports['create']=function(_0x2ed448,_0x12368e,_0x355622){return db['sequelize'][_0x94e7('0x48')](function(_0x57bf67){if(_0x2ed448[_0x94e7('0x46')][_0x94e7('0x49')]===_0x94e7('0x4a')){_0x2ed448[_0x94e7('0x46')][_0x94e7('0x4b')]=path['join'](config[_0x94e7('0x4c')],_0x94e7('0x4d'),_0x2ed448[_0x94e7('0x46')]['name']);}return db[_0x94e7('0x2b')][_0x94e7('0x4e')](_0x2ed448[_0x94e7('0x46')],{'transaction':_0x57bf67})[_0x94e7('0x22')](function(_0x1443e4){if(_0x2ed448[_0x94e7('0x46')][_0x94e7('0x49')]===_0x94e7('0x4a')){fs[_0x94e7('0x4f')](_0x1443e4['directory'],parseInt('0777',0x8));}var _0xb2f56d=_0x2ed448[_0x94e7('0x50')]['get']({'plain':!![]});if(!_0xb2f56d)throw new Error(_0x94e7('0x51'));if(_0xb2f56d[_0x94e7('0x52')]==='user'){var _0x1459f5=_0x1443e4[_0x94e7('0x24')]({'plain':!![]});return db[_0x94e7('0x53')][_0x94e7('0x44')]({'where':{'name':'MusicOnHolds','userProfileId':_0xb2f56d['userProfileId']},'raw':!![]})[_0x94e7('0x22')](function(_0x4fdbbf){if(_0x4fdbbf&&_0x4fdbbf[_0x94e7('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x1459f5['name'],'resourceId':_0x1459f5['id'],'type':_0x4fdbbf[_0x94e7('0x28')],'sectionId':_0x4fdbbf['id']},{})[_0x94e7('0x22')](function(){return _0x1443e4;});}else{return _0x1443e4;}})[_0x94e7('0x41')](function(_0x1d9075){logger[_0x94e7('0x26')](_0x94e7('0x55'),_0x1d9075);});}return _0x1443e4;});})[_0x94e7('0x22')](respondWithResult(_0x12368e,0xc9))['catch'](handleError(_0x12368e,null));};exports[_0x94e7('0x23')]=function(_0x573d6c,_0x53feea,_0x83fc5c){var _0xefb565;return db[_0x94e7('0x2b')]['find']({'where':{'id':_0x573d6c[_0x94e7('0x47')]['id']}})[_0x94e7('0x22')](function(_0x3825ba){if(_0x3825ba){return db['sequelize']['transaction'](function(_0x213fe9){return _0x3825ba[_0x94e7('0x23')]({'transaction':_0x213fe9,'raw':!![]})[_0x94e7('0x22')](function(_0x29d5eb){if(_0x29d5eb[_0x94e7('0x4b')]){fs['readdirSync'](_0x29d5eb[_0x94e7('0x4b')])[_0x94e7('0x56')](function(_0x4b07d9){fs[_0x94e7('0x57')](path['join'](_0x29d5eb[_0x94e7('0x4b')],_0x4b07d9));});fs[_0x94e7('0x58')](_0x29d5eb['directory']);}return _0x29d5eb;});})[_0x94e7('0x41')](function(_0x34f405){throw new db['Sequelize']['ValidationError'](_0x34f405['message']);});}})[_0x94e7('0x22')](handleEntityNotFound(_0x53feea,null))[_0x94e7('0x22')](removeEntity(_0x53feea,null))['catch'](handleError(_0x53feea,null));};exports[_0x94e7('0x59')]=function(_0xda19c7,_0x2a3a2c,_0x25b425){return db[_0x94e7('0x5a')][_0x94e7('0x48')](function(_0x5a435d){var _0x3b7c5e;return db[_0x94e7('0x2b')][_0x94e7('0x44')]({'where':{'id':_0xda19c7[_0x94e7('0x47')]['id']}})[_0x94e7('0x22')](function(_0x167f0b){if(_0x167f0b){_0x3b7c5e=_0x167f0b;return _0x167f0b[_0x94e7('0x59')](_0xda19c7[_0x94e7('0x46')]['id'],{'transaction':_0x5a435d});}})[_0x94e7('0x22')](function(_0x530254){if(_0x530254){return db[_0x94e7('0x5b')]['findOne']({'where':{'id':_0xda19c7[_0x94e7('0x46')]['id']},'attributes':['id',_0x94e7('0x28'),_0x94e7('0x5c'),'converted_format','createdAt'],'raw':!![]});}})[_0x94e7('0x22')](function(_0x14f375){if(_0x14f375){var _0x52316d=path['join'](config[_0x94e7('0x4c')],'server/files/sounds/converted',util[_0x94e7('0x5d')](_0x94e7('0x5e'),path['basename'](_0x14f375[_0x94e7('0x5c')],path[_0x94e7('0x5f')](_0x14f375[_0x94e7('0x5c')])),_0x14f375['converted_format']));var _0x2468ab=path[_0x94e7('0x60')](config[_0x94e7('0x4c')],_0x94e7('0x4d'),_0x3b7c5e[_0x94e7('0x28')],util[_0x94e7('0x5d')]('%s.%s',_0x14f375[_0x94e7('0x28')],_0x14f375[_0x94e7('0x61')]));fs[_0x94e7('0x62')](_0x52316d,_0x2468ab);return _0x14f375;}})[_0x94e7('0x41')](function(_0x92b369){throw new db[(_0x94e7('0x63'))][(_0x94e7('0x64'))](_0x92b369[_0x94e7('0x65')]);});})[_0x94e7('0x22')](handleEntityNotFound(_0x2a3a2c,null))[_0x94e7('0x22')](respondWithResult(_0x2a3a2c,0xc9))[_0x94e7('0x41')](handleError(_0x2a3a2c,null));};exports[_0x94e7('0x66')]=function(_0x78b76a,_0xdbd219,_0x8b1466){return db['sequelize'][_0x94e7('0x48')](function(_0x3ab8cf){var _0x2c5784;return db[_0x94e7('0x2b')][_0x94e7('0x67')]({'where':{'id':_0x78b76a[_0x94e7('0x47')]['id']}})['then'](handleEntityNotFound(_0xdbd219,null))[_0x94e7('0x22')](function(_0x3e2bd1){if(_0x3e2bd1){_0x2c5784=_0x3e2bd1;return _0x3e2bd1[_0x94e7('0x66')](_0x78b76a['params']['id2']);}})['then'](function(_0x2cce4e){if(_0x2cce4e){return db[_0x94e7('0x5b')][_0x94e7('0x67')]({'where':{'id':_0x78b76a[_0x94e7('0x47')][_0x94e7('0x68')]},'attributes':['id',_0x94e7('0x28'),'save_name','converted_format',_0x94e7('0x69')],'raw':!![]});}})[_0x94e7('0x22')](function(_0x5c3884){if(_0x5c3884){fs[_0x94e7('0x57')](path[_0x94e7('0x60')](_0x2c5784[_0x94e7('0x4b')],util[_0x94e7('0x5d')](_0x94e7('0x5e'),_0x5c3884['name'],_0x5c3884['converted_format'])));return _0x5c3884;}})[_0x94e7('0x41')](function(_0x31142d){throw new db['Sequelize']['ValidationError'](_0x31142d[_0x94e7('0x65')]);});})[_0x94e7('0x22')](handleEntityNotFound(_0xdbd219,null))[_0x94e7('0x22')](respondWithStatusCode(_0xdbd219,0xcc))[_0x94e7('0x41')](handleError(_0xdbd219,null));};exports['getSounds']=function(_0x463026,_0xa9d371,_0x470d70){var _0x2ec710={};var _0x517a0e={};var _0x7324b7;var _0x85486d;return db['VoiceMusicOnHold'][_0x94e7('0x67')]({'where':{'id':_0x463026['params']['id']}})['then'](handleEntityNotFound(_0xa9d371,null))[_0x94e7('0x22')](function(_0x3a1abc){if(_0x3a1abc){_0x7324b7=_0x3a1abc;_0x517a0e[_0x94e7('0x2d')]=_['keys'](db['Sound'][_0x94e7('0x43')]);_0x517a0e[_0x94e7('0x2e')]=_[_0x94e7('0x2f')](_0x463026[_0x94e7('0x2e')]);_0x517a0e['filters']=_[_0x94e7('0x30')](_0x517a0e[_0x94e7('0x2d')],_0x517a0e[_0x94e7('0x2e')]);_0x2ec710[_0x94e7('0x32')]=_[_0x94e7('0x30')](_0x517a0e['model'],qs[_0x94e7('0x31')](_0x463026[_0x94e7('0x2e')][_0x94e7('0x31')]));_0x2ec710[_0x94e7('0x32')]=_0x2ec710[_0x94e7('0x32')][_0x94e7('0x33')]?_0x2ec710[_0x94e7('0x32')]:_0x517a0e[_0x94e7('0x2d')];_0x2ec710[_0x94e7('0x35')]=qs[_0x94e7('0x36')](_0x463026['query'][_0x94e7('0x36')]);_0x2ec710[_0x94e7('0x37')]=qs['filters'](_[_0x94e7('0x38')](_0x463026[_0x94e7('0x2e')],_0x517a0e[_0x94e7('0x6a')]));if(_0x463026[_0x94e7('0x2e')][_0x94e7('0x39')]){_0x2ec710['where']=_['merge'](_0x2ec710['where'],{'$or':_[_0x94e7('0x2a')](_0x2ec710[_0x94e7('0x32')],function(_0x384bba){var _0x3e3709={};_0x3e3709[_0x384bba]={'$like':'%'+_0x463026['query'][_0x94e7('0x39')]+'%'};return _0x3e3709;})});}_0x2ec710=_[_0x94e7('0x3a')]({},_0x2ec710,_0x463026[_0x94e7('0x3d')]);return _0x7324b7['getSounds'](_0x2ec710);}})[_0x94e7('0x22')](function(_0x53ed19){if(_0x53ed19){_0x85486d=_0x53ed19[_0x94e7('0x33')];if(!_0x463026['query']['hasOwnProperty'](_0x94e7('0x34'))){_0x2ec710['limit']=qs['limit'](_0x463026[_0x94e7('0x2e')][_0x94e7('0x1f')]);_0x2ec710[_0x94e7('0x1e')]=qs[_0x94e7('0x1e')](_0x463026['query'][_0x94e7('0x1e')]);}return _0x7324b7[_0x94e7('0x6b')](_0x2ec710);}})[_0x94e7('0x22')](function(_0x360382){if(_0x360382){return _0x360382?{'count':_0x85486d,'rows':_0x360382}:null;}})[_0x94e7('0x22')](respondWithResult(_0xa9d371,null))[_0x94e7('0x41')](handleError(_0xa9d371,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 5fc175f..a74a4bf 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 _0xa681=['moment','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','util'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xa681,0xdb));var _0x1a68=function(_0x45350d,_0x459202){_0x45350d=_0x45350d-0x0;var _0x197fe7=_0xa681[_0x45350d];return _0x197fe7;};'use strict';var _=require('lodash');var util=require(_0x1a68('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x1a68('0x1'));var BPromise=require('bluebird');var rp=require(_0x1a68('0x2'));var fs=require('fs');var path=require(_0x1a68('0x3'));var rimraf=require(_0x1a68('0x4'));var config=require(_0x1a68('0x5'));var attributes=require(_0x1a68('0x6'));module['exports']=function(_0x1a7b2f,_0x347eef){return _0x1a7b2f[_0x1a68('0x7')](_0x1a68('0x8'),attributes,{'tableName':_0x1a68('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85c3=['VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define'];(function(_0xe003f,_0xa7f888){var _0x1ca5b4=function(_0x1522b3){while(--_0x1522b3){_0xe003f['push'](_0xe003f['shift']());}};_0x1ca5b4(++_0xa7f888);}(_0x85c3,0xc6));var _0x385c=function(_0x1594fd,_0x1fd894){_0x1594fd=_0x1594fd-0x0;var _0x3911ea=_0x85c3[_0x1594fd];return _0x3911ea;};'use strict';var _=require(_0x385c('0x0'));var util=require('util');var logger=require(_0x385c('0x1'))(_0x385c('0x2'));var moment=require(_0x385c('0x3'));var BPromise=require(_0x385c('0x4'));var rp=require(_0x385c('0x5'));var fs=require('fs');var path=require(_0x385c('0x6'));var rimraf=require(_0x385c('0x7'));var config=require(_0x385c('0x8'));var attributes=require(_0x385c('0x9'));module[_0x385c('0xa')]=function(_0x138470,_0x10975a){return _0x138470[_0x385c('0xb')](_0x385c('0xc'),attributes,{'tableName':_0x385c('0xd'),'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 fe2c5ec..7210c71 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 _0xb2d7=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x46c058,_0x4d6fa0){var _0x4605ca=function(_0x2c6a3b){while(--_0x2c6a3b){_0x46c058['push'](_0x46c058['shift']());}};_0x4605ca(++_0x4d6fa0);}(_0xb2d7,0x182));var _0x7b2d=function(_0x197185,_0x251145){_0x197185=_0x197185-0x0;var _0x2c8af1=_0xb2d7[_0x197185];return _0x2c8af1;};'use strict';var _=require(_0x7b2d('0x0'));var util=require(_0x7b2d('0x1'));var moment=require(_0x7b2d('0x2'));var BPromise=require(_0x7b2d('0x3'));var rs=require(_0x7b2d('0x4'));var fs=require('fs');var Redis=require(_0x7b2d('0x5'));var db=require(_0x7b2d('0x6'))['db'];var utils=require(_0x7b2d('0x7'));var logger=require(_0x7b2d('0x8'))(_0x7b2d('0x9'));var config=require('../../config/environment');var jayson=require(_0x7b2d('0xa'));var client=jayson[_0x7b2d('0xb')][_0x7b2d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1254d2,_0x2dffff,_0x20a205){return new BPromise(function(_0x38b09c,_0x30527c){return client[_0x7b2d('0xd')](_0x1254d2,_0x20a205)['then'](function(_0x21645d){logger[_0x7b2d('0xe')](_0x7b2d('0xf'),_0x2dffff,_0x7b2d('0x10'));logger[_0x7b2d('0x11')](_0x7b2d('0x12'),_0x2dffff,_0x7b2d('0x10'),JSON[_0x7b2d('0x13')](_0x21645d));if(_0x21645d[_0x7b2d('0x14')]){if(_0x21645d['error']['code']===0x1f4){logger[_0x7b2d('0x14')](_0x7b2d('0xf'),_0x2dffff,_0x21645d['error'][_0x7b2d('0x15')]);return _0x30527c(_0x21645d[_0x7b2d('0x14')]['message']);}logger[_0x7b2d('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2dffff,_0x21645d[_0x7b2d('0x14')][_0x7b2d('0x15')]);return _0x38b09c(_0x21645d[_0x7b2d('0x14')]['message']);}else{logger[_0x7b2d('0xe')](_0x7b2d('0xf'),_0x2dffff,_0x7b2d('0x10'));_0x38b09c(_0x21645d[_0x7b2d('0x16')]['message']);}})[_0x7b2d('0x17')](function(_0x35cbd2){logger[_0x7b2d('0x14')](_0x7b2d('0xf'),_0x2dffff,_0x35cbd2);_0x30527c(_0x35cbd2);});});} \ No newline at end of file +var _0x67d8=['../../config/utils','../../config/logger','../../config/environment','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x67d8,0x14e));var _0x867d=function(_0x78a7c1,_0x9b1261){_0x78a7c1=_0x78a7c1-0x0;var _0x3590b0=_0x67d8[_0x78a7c1];return _0x3590b0;};'use strict';var _=require(_0x867d('0x0'));var util=require(_0x867d('0x1'));var moment=require('moment');var BPromise=require(_0x867d('0x2'));var rs=require(_0x867d('0x3'));var fs=require('fs');var Redis=require(_0x867d('0x4'));var db=require(_0x867d('0x5'))['db'];var utils=require(_0x867d('0x6'));var logger=require(_0x867d('0x7'))('rpc');var config=require(_0x867d('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3906c4,_0x1d1a58,_0x261741){return new BPromise(function(_0x1d0330,_0x237cf6){return client[_0x867d('0x9')](_0x3906c4,_0x261741)['then'](function(_0x37b430){logger[_0x867d('0xa')](_0x867d('0xb'),_0x1d1a58,_0x867d('0xc'));logger[_0x867d('0xd')](_0x867d('0xe'),_0x1d1a58,_0x867d('0xc'),JSON[_0x867d('0xf')](_0x37b430));if(_0x37b430[_0x867d('0x10')]){if(_0x37b430[_0x867d('0x10')]['code']===0x1f4){logger[_0x867d('0x10')](_0x867d('0xb'),_0x1d1a58,_0x37b430['error'][_0x867d('0x11')]);return _0x237cf6(_0x37b430[_0x867d('0x10')][_0x867d('0x11')]);}logger[_0x867d('0x10')](_0x867d('0xb'),_0x1d1a58,_0x37b430[_0x867d('0x10')][_0x867d('0x11')]);return _0x1d0330(_0x37b430[_0x867d('0x10')][_0x867d('0x11')]);}else{logger[_0x867d('0xa')](_0x867d('0xb'),_0x1d1a58,_0x867d('0xc'));_0x1d0330(_0x37b430[_0x867d('0x12')][_0x867d('0x11')]);}})[_0x867d('0x13')](function(_0x434880){logger['error'](_0x867d('0xb'),_0x1d1a58,_0x434880);_0x237cf6(_0x434880);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 05adc7f..bf39bbe 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 _0x14ff=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','/:id/users','post','create','put','update','delete','removeAgents','exports'];(function(_0x170bf3,_0x3ea887){var _0x1b0d20=function(_0x1d0235){while(--_0x1d0235){_0x170bf3['push'](_0x170bf3['shift']());}};_0x1b0d20(++_0x3ea887);}(_0x14ff,0xb0));var _0xf14f=function(_0x1ba00f,_0x3cdf7a){_0x1ba00f=_0x1ba00f-0x0;var _0x26556b=_0x14ff[_0x1ba00f];return _0x26556b;};'use strict';var multer=require(_0xf14f('0x0'));var util=require(_0xf14f('0x1'));var path=require('path');var timeout=require(_0xf14f('0x2'));var express=require(_0xf14f('0x3'));var router=express[_0xf14f('0x4')]();var auth=require(_0xf14f('0x5'));var interaction=require(_0xf14f('0x6'));var config=require(_0xf14f('0x7'));var controller=require(_0xf14f('0x8'));router[_0xf14f('0x9')]('/',auth[_0xf14f('0xa')](),controller[_0xf14f('0xb')]);router[_0xf14f('0x9')]('/describe',auth[_0xf14f('0xa')](),controller[_0xf14f('0xc')]);router[_0xf14f('0x9')](_0xf14f('0xd'),auth[_0xf14f('0xa')](),controller['show']);router[_0xf14f('0x9')](_0xf14f('0xe'),auth['isAuthenticated'](),controller['getAgents']);router[_0xf14f('0xf')]('/',auth['isAuthenticated'](),controller[_0xf14f('0x10')]);router['post'](_0xf14f('0xe'),auth[_0xf14f('0xa')](),controller['addAgents']);router[_0xf14f('0x11')](_0xf14f('0xd'),auth['isAuthenticated'](),controller[_0xf14f('0x12')]);router[_0xf14f('0x13')]('/:id',auth[_0xf14f('0xa')](),controller['destroy']);router[_0xf14f('0x13')](_0xf14f('0xe'),auth[_0xf14f('0xa')](),controller[_0xf14f('0x14')]);module[_0xf14f('0x15')]=router; \ No newline at end of file +var _0x96fe=['getAgents','post','/:id/users','addAgents','put','/:id','update','delete','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x572637,_0x216d95){var _0xb6748=function(_0x3eeb8c){while(--_0x3eeb8c){_0x572637['push'](_0x572637['shift']());}};_0xb6748(++_0x216d95);}(_0x96fe,0x8c));var _0xe96f=function(_0x21915c,_0x247e22){_0x21915c=_0x21915c-0x0;var _0x1efd3c=_0x96fe[_0x21915c];return _0x1efd3c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe96f('0x0'));var timeout=require(_0xe96f('0x1'));var express=require(_0xe96f('0x2'));var router=express[_0xe96f('0x3')]();var auth=require(_0xe96f('0x4'));var interaction=require(_0xe96f('0x5'));var config=require(_0xe96f('0x6'));var controller=require(_0xe96f('0x7'));router[_0xe96f('0x8')]('/',auth[_0xe96f('0x9')](),controller[_0xe96f('0xa')]);router[_0xe96f('0x8')](_0xe96f('0xb'),auth[_0xe96f('0x9')](),controller[_0xe96f('0xc')]);router[_0xe96f('0x8')]('/:id',auth[_0xe96f('0x9')](),controller[_0xe96f('0xd')]);router[_0xe96f('0x8')]('/:id/users',auth[_0xe96f('0x9')](),controller[_0xe96f('0xe')]);router[_0xe96f('0xf')]('/',auth[_0xe96f('0x9')](),controller['create']);router[_0xe96f('0xf')](_0xe96f('0x10'),auth['isAuthenticated'](),controller[_0xe96f('0x11')]);router[_0xe96f('0x12')](_0xe96f('0x13'),auth[_0xe96f('0x9')](),controller[_0xe96f('0x14')]);router[_0xe96f('0x15')]('/:id',auth[_0xe96f('0x9')](),controller['destroy']);router['delete'](_0xe96f('0x10'),auth[_0xe96f('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 64621f0..6626f77 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 _0xdb20=['VIRTUAL','system-','getDataValue','STRING','INTEGER','sequelize','name'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xdb20,0x1ef));var _0x0db2=function(_0x1ef329,_0x281174){_0x1ef329=_0x1ef329-0x0;var _0x455ea5=_0xdb20[_0x1ef329];return _0x455ea5;};'use strict';var Sequelize=require(_0x0db2('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0db2('0x1')},'prefix':{'type':Sequelize[_0x0db2('0x2')],'get':function(_0x422297){return _0x0db2('0x3')+this[_0x0db2('0x4')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x0db2('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x0db2('0x6')]}}; \ No newline at end of file +var _0xe85b=['system-','getDataValue','name','INTEGER','STRING','VIRTUAL'];(function(_0x2e3e01,_0x540a33){var _0x4ec762=function(_0x442941){while(--_0x442941){_0x2e3e01['push'](_0x2e3e01['shift']());}};_0x4ec762(++_0x540a33);}(_0xe85b,0x18a));var _0xbe85=function(_0x27a0a9,_0x1e7dd1){_0x27a0a9=_0x27a0a9-0x0;var _0x11cb3b=_0xe85b[_0x27a0a9];return _0x11cb3b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbe85('0x0')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xbe85('0x1')],'get':function(_0x169e2e){return _0xbe85('0x2')+this[_0xbe85('0x3')](_0xbe85('0x4'))+'-';}},'description':{'type':Sequelize[_0xbe85('0x0')]},'callerIdAll':{'type':Sequelize[_0xbe85('0x0')]},'VoiceExtensionId':{'type':Sequelize[_0xbe85('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index c1cd738..9d5a156 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 _0x13c5=['removeAgents','userVoicePrefix:remove','getAgents','User','order','nolimit','html-pdf','bluebird','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','status','count','offset','set','Content-Range','json','apply','reject','save','destroy','get','VoicePrefixes','UserProfileResource','then','end','error','stack','name','send','map','VoicePrefix','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','describe','create','sequelize','VoiceExtension','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','system','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','update','system-','transaction','findById','addAgents','body','ids','omit','emit'];(function(_0x3eca48,_0x2ddcb6){var _0x429edc=function(_0x58d101){while(--_0x58d101){_0x3eca48['push'](_0x3eca48['shift']());}};_0x429edc(++_0x2ddcb6);}(_0x13c5,0x7a));var _0x513c=function(_0x1a71f5,_0x424376){_0x1a71f5=_0x1a71f5-0x0;var _0x53ac40=_0x13c5[_0x1a71f5];return _0x53ac40;};'use strict';var pdf=require(_0x513c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x513c('0x1'));var Mustache=require('mustache');var util=require('util');var path=require(_0x513c('0x2'));var sox=require(_0x513c('0x3'));var csv=require(_0x513c('0x4'));var ejs=require(_0x513c('0x5'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x513c('0x6'));var jsforce=require(_0x513c('0x7'));var deskjs=require(_0x513c('0x8'));var toCsv=require(_0x513c('0x4'));var querystring=require(_0x513c('0x9'));var Papa=require(_0x513c('0xa'));var Redis=require(_0x513c('0xb'));var authService=require(_0x513c('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x513c('0xd'));var hardwareService=require(_0x513c('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x513c('0xf'));var config=require(_0x513c('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x513c('0x11')](config['redis'],{'host':_0x513c('0x12'),'port':0x18eb});var socket=require(_0x513c('0x13'))(new Redis(config['redis']));require(_0x513c('0x14'))[_0x513c('0x15')](socket);function respondWithStatusCode(_0x29fa69,_0x402067){_0x402067=_0x402067||0xcc;return function(_0x31e044){if(_0x31e044){return _0x29fa69['sendStatus'](_0x402067);}return _0x29fa69[_0x513c('0x16')](_0x402067)['end']();};}function respondWithResult(_0x242311,_0x380a0a){_0x380a0a=_0x380a0a||0xc8;return function(_0x3d0a3f){if(_0x3d0a3f){return _0x242311[_0x513c('0x16')](_0x380a0a)['json'](_0x3d0a3f);}};}function respondWithFilteredResult(_0x48abf0,_0x4c2247){return function(_0x100bc7){if(_0x100bc7){var _0x341b20=_0x100bc7[_0x513c('0x17')],_0x51196d=_0x4c2247[_0x513c('0x18')],_0x58b89f=_0x4c2247[_0x513c('0x18')]+_0x4c2247['limit'],_0x217e7a;if(_0x58b89f>=_0x341b20){_0x58b89f=_0x341b20;_0x217e7a=0xc8;}else{_0x217e7a=0xce;}_0x48abf0[_0x513c('0x16')](_0x217e7a);return _0x48abf0[_0x513c('0x19')](_0x513c('0x1a'),_0x51196d+'-'+_0x58b89f+'/'+_0x341b20)[_0x513c('0x1b')](_0x100bc7);}return null;};}function patchUpdates(_0x132af7){return function(_0x52287b){try{jsonpatch[_0x513c('0x1c')](_0x52287b,_0x132af7,!![]);}catch(_0x47a67c){return BPromise[_0x513c('0x1d')](_0x47a67c);}return _0x52287b[_0x513c('0x1e')]();};}function saveUpdates(_0x9dc7ba,_0xcd8a3b){return function(_0x3661c7){if(_0x3661c7){return _0x3661c7['update'](_0x9dc7ba)['then'](function(_0x23ef79){return _0x23ef79;});}return null;};}function removeEntity(_0x390f1e,_0x58dea0){return function(_0x435b57){if(_0x435b57){return _0x435b57[_0x513c('0x1f')]()['then'](function(){var _0x206e5b=_0x435b57[_0x513c('0x20')]({'plain':!![]});var _0x437ed8=_0x513c('0x21');return db[_0x513c('0x22')][_0x513c('0x1f')]({'where':{'type':_0x437ed8,'resourceId':_0x206e5b['id']}})[_0x513c('0x23')](function(){return _0x435b57;});})['then'](function(){_0x390f1e[_0x513c('0x16')](0xcc)[_0x513c('0x24')]();});}};}function handleEntityNotFound(_0x2c7eec,_0x18dec2){return function(_0xf324ee){if(!_0xf324ee){_0x2c7eec['sendStatus'](0x194);}return _0xf324ee;};}function handleError(_0xe8acaa,_0x28de12){_0x28de12=_0x28de12||0x1f4;return function(_0x3cbe93){logger[_0x513c('0x25')](_0x3cbe93[_0x513c('0x26')]);if(_0x3cbe93[_0x513c('0x27')]){delete _0x3cbe93['name'];}_0xe8acaa['status'](_0x28de12)[_0x513c('0x28')](_0x3cbe93);};}exports['index']=function(_0x2ee6aa,_0x2bd36b){var _0xb087c2={},_0x5c906a={},_0x1546a7={'count':0x0,'rows':[]};var _0x24d971=_[_0x513c('0x29')](db[_0x513c('0x2a')]['rawAttributes'],function(_0x183b47){return{'name':_0x183b47[_0x513c('0x2b')],'type':_0x183b47['type'][_0x513c('0x2c')]};});_0x5c906a[_0x513c('0x2d')]=_['map'](_0x24d971,_0x513c('0x27'));_0x5c906a[_0x513c('0x2e')]=_[_0x513c('0x2f')](_0x2ee6aa[_0x513c('0x2e')]);_0x5c906a[_0x513c('0x30')]=_['intersection'](_0x5c906a['model'],_0x5c906a[_0x513c('0x2e')]);_0xb087c2['attributes']=_[_0x513c('0x31')](_0x5c906a[_0x513c('0x2d')],qs[_0x513c('0x32')](_0x2ee6aa[_0x513c('0x2e')][_0x513c('0x32')]));_0xb087c2[_0x513c('0x33')]=_0xb087c2[_0x513c('0x33')]['length']?_0xb087c2[_0x513c('0x33')]:_0x5c906a[_0x513c('0x2d')];if(!_0x2ee6aa[_0x513c('0x2e')][_0x513c('0x34')]('nolimit')){_0xb087c2[_0x513c('0x35')]=qs['limit'](_0x2ee6aa[_0x513c('0x2e')][_0x513c('0x35')]);_0xb087c2['offset']=qs['offset'](_0x2ee6aa[_0x513c('0x2e')]['offset']);}_0xb087c2['order']=qs[_0x513c('0x36')](_0x2ee6aa['query'][_0x513c('0x36')]);_0xb087c2['where']=qs['filters'](_[_0x513c('0x37')](_0x2ee6aa[_0x513c('0x2e')],_0x5c906a[_0x513c('0x30')]),_0x24d971);if(_0x2ee6aa['query'][_0x513c('0x38')]){_0xb087c2['where']=_['merge'](_0xb087c2[_0x513c('0x39')],{'$or':_[_0x513c('0x29')](_0x24d971,function(_0x4e73a5){if(_0x4e73a5[_0x513c('0x3a')]!==_0x513c('0x3b')){var _0x4693f6={};_0x4693f6[_0x4e73a5['name']]={'$like':'%'+_0x2ee6aa[_0x513c('0x2e')][_0x513c('0x38')]+'%'};return _0x4693f6;}})});}_0xb087c2=_[_0x513c('0x3c')]({},_0xb087c2,_0x2ee6aa[_0x513c('0x3d')]);var _0x2f2c56={'where':_0xb087c2[_0x513c('0x39')]};return db['VoicePrefix'][_0x513c('0x17')](_0x2f2c56)[_0x513c('0x23')](function(_0x426465){_0x1546a7['count']=_0x426465;if(_0x2ee6aa[_0x513c('0x2e')][_0x513c('0x3e')]){_0xb087c2[_0x513c('0x3f')]=[{'all':!![]}];}return db[_0x513c('0x2a')][_0x513c('0x40')](_0xb087c2);})[_0x513c('0x23')](function(_0x4f5eb0){_0x1546a7[_0x513c('0x41')]=_0x4f5eb0;return _0x1546a7;})[_0x513c('0x23')](respondWithFilteredResult(_0x2bd36b,_0xb087c2))[_0x513c('0x42')](handleError(_0x2bd36b,null));};exports['show']=function(_0x1653d3,_0x21acfc){var _0x18841c={'raw':![],'where':{'id':_0x1653d3[_0x513c('0x43')]['id']}},_0x12b073={};_0x12b073[_0x513c('0x2d')]=_['keys'](db[_0x513c('0x2a')][_0x513c('0x44')]);_0x12b073[_0x513c('0x2e')]=_[_0x513c('0x2f')](_0x1653d3[_0x513c('0x2e')]);_0x12b073[_0x513c('0x30')]=_[_0x513c('0x31')](_0x12b073[_0x513c('0x2d')],_0x12b073[_0x513c('0x2e')]);_0x18841c['attributes']=_['intersection'](_0x12b073['model'],qs[_0x513c('0x32')](_0x1653d3[_0x513c('0x2e')][_0x513c('0x32')]));_0x18841c['attributes']=_0x18841c[_0x513c('0x33')][_0x513c('0x45')]?_0x18841c[_0x513c('0x33')]:_0x12b073[_0x513c('0x2d')];if(_0x1653d3[_0x513c('0x2e')][_0x513c('0x3e')]){_0x18841c[_0x513c('0x3f')]=[{'all':!![]}];}_0x18841c=_[_0x513c('0x3c')]({},_0x18841c,_0x1653d3['options']);return db[_0x513c('0x2a')][_0x513c('0x46')](_0x18841c)[_0x513c('0x23')](handleEntityNotFound(_0x21acfc,null))[_0x513c('0x23')](respondWithResult(_0x21acfc,null))[_0x513c('0x42')](handleError(_0x21acfc,null));};exports[_0x513c('0x1f')]=function(_0x3e9e8d,_0x5f320c){return db[_0x513c('0x2a')][_0x513c('0x46')]({'where':{'id':_0x3e9e8d['params']['id']}})['then'](handleEntityNotFound(_0x5f320c,null))[_0x513c('0x23')](removeEntity(_0x5f320c,null))[_0x513c('0x42')](handleError(_0x5f320c,null));};exports[_0x513c('0x47')]=function(_0xaa592d,_0x38d706){return db[_0x513c('0x2a')][_0x513c('0x47')]()[_0x513c('0x23')](respondWithResult(_0x38d706,null))[_0x513c('0x42')](handleError(_0x38d706,null));};exports[_0x513c('0x48')]=function(_0x486bed,_0x168ad6){var _0x25900d;return db[_0x513c('0x49')]['transaction'](function(_0x493f70){return db[_0x513c('0x2a')][_0x513c('0x48')](_0x486bed['body'],{'transaction':_0x493f70})[_0x513c('0x23')](function(_0x59bb96){_0x25900d=_0x59bb96[_0x513c('0x20')]({'plain':!![]});return db[_0x513c('0x4a')][_0x513c('0x46')]({'where':{'id':_0x25900d['VoiceExtensionId']},'raw':!![]})[_0x513c('0x23')](function(_0x363f56){return createVoicePrefixExtensions(_0x25900d,_0x363f56,_0x493f70);});});})[_0x513c('0x23')](function(){var _0x38f3eb=_0x486bed['user'][_0x513c('0x20')]({'plain':!![]});if(!_0x38f3eb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38f3eb[_0x513c('0x4b')]===_0x513c('0x4c')){var _0x4cb016=_0x25900d;return db[_0x513c('0x4d')][_0x513c('0x46')]({'where':{'name':_0x513c('0x21'),'userProfileId':_0x38f3eb[_0x513c('0x4e')]},'raw':!![]})[_0x513c('0x23')](function(_0x38aa3a){if(_0x38aa3a&&_0x38aa3a[_0x513c('0x4f')]===0x0){return db[_0x513c('0x22')][_0x513c('0x48')]({'name':_0x4cb016[_0x513c('0x27')],'resourceId':_0x4cb016['id'],'type':_0x38aa3a[_0x513c('0x27')],'sectionId':_0x38aa3a['id']},{})[_0x513c('0x23')](function(){return _0x25900d;});}else{return _0x25900d;}})['catch'](function(_0x269b60){logger[_0x513c('0x25')](_0x513c('0x50'),_0x269b60);throw _0x269b60;});}return _0x25900d;})[_0x513c('0x23')](respondWithResult(_0x168ad6,null))[_0x513c('0x42')](handleError(_0x168ad6,null));};function Extension(_0x23c595,_0x1afff5,_0x2823f0,_0x546c17){this[_0x513c('0x51')]='from-sip';this[_0x513c('0x52')]=_0x23c595;this[_0x513c('0x53')]=_0x2823f0;this['type']=_0x513c('0x54');this['description']=_0x513c('0x55');this[_0x513c('0x56')]=_0x1afff5;this[_0x513c('0x57')]=_0x546c17;}function createVoicePrefixExtensions(_0x5ce4c0,_0xb457df,_0x4199d0){return new BPromise(function(_0x4f1371,_0x3fa25b){var _0x2e54dd=new Extension(formatPrefixName(_0x5ce4c0[_0x513c('0x58')]),0x1,_0x513c('0x59'),'Voice\x20Prefix');_0x2e54dd[_0x513c('0x5a')]=_0x5ce4c0['id'];return db[_0x513c('0x4a')][_0x513c('0x48')](_0x2e54dd,{'transaction':_0x4199d0})['then'](function(_0x570fb4){var _0x300eb0=_0x570fb4[_0x513c('0x20')]({'plain':!![]});var _0x4cb82b=_[_0x513c('0x29')](addVoicePrefixExtensions(_0x5ce4c0,_0xb457df),function(_0xc390a9){_0xc390a9[_0x513c('0x5b')]=_0x300eb0['id'];_0xc390a9['VoicePrefixId']=_0x5ce4c0['id'];return _0xc390a9;});return db[_0x513c('0x4a')][_0x513c('0x5c')](_0x4cb82b,{'transaction':_0x4199d0})[_0x513c('0x23')](function(_0xcd245b){if(!_0xcd245b){return _0x3fa25b(_0x513c('0x5d'));}else{return _0x4f1371(_0xcd245b);}})[_0x513c('0x42')](function(_0x550066){return _0x3fa25b(_0x550066);});});;});};function addVoicePrefixExtensions(_0x386ecb,_0x3e4910){var _0x4b3af2=[];var _0x575175=formatPrefixName(_0x386ecb[_0x513c('0x58')]);_0x4b3af2[_0x513c('0x5e')](new Extension(_0x575175,0x2,_0x513c('0x5f'),_0x513c('0x60')+_0x386ecb['name']));if(_0x386ecb['callerIdAll']){_0x4b3af2[_0x513c('0x5e')](new Extension(_0x575175,0x3,_0x513c('0x5f'),_0x513c('0x61')+_0x386ecb['callerIdAll']));}else{_0x4b3af2[_0x513c('0x5e')](new Extension(_0x575175,0x3,_0x513c('0x59'),_0x513c('0x62')));}_0x4b3af2[_0x513c('0x5e')](new Extension(_0x575175,0x4,'goto',_0x3e4910[_0x513c('0x51')]+','+_0x513c('0x63')+(0x8+_0x386ecb[_0x513c('0x27')][_0x513c('0x45')])+'}'+','+0x1));return _0x4b3af2;}function formatPrefixName(_0x2287f5){var _0x58f44d='_';for(var _0x36544e=0x0;_0x36544e<_0x2287f5[_0x513c('0x45')];_0x36544e++){if(_0x2287f5[_0x513c('0x64')](_0x36544e)=='-'){_0x58f44d+=_0x2287f5[_0x513c('0x64')](_0x36544e);}else{_0x58f44d+='['+_0x2287f5[_0x513c('0x64')](_0x36544e)+']';}}_0x58f44d+='.';return _0x58f44d;}exports[_0x513c('0x65')]=function(_0x39b4a7,_0x39192c,_0x5d20fe){var _0x31c63f=_0x39b4a7['body'];_0x31c63f['prefix']=_0x513c('0x66')+_0x31c63f[_0x513c('0x27')]+'-';return db[_0x513c('0x49')][_0x513c('0x67')](function(_0x5d8fbc){return db[_0x513c('0x2a')][_0x513c('0x65')](_0x31c63f,{'where':{'id':_0x31c63f['id']},'transaction':_0x5d8fbc})['then'](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x31c63f['id']},'transaction':_0x5d8fbc})[_0x513c('0x23')](function(){return db[_0x513c('0x4a')][_0x513c('0x46')]({'where':{'id':_0x31c63f['VoiceExtensionId']},'raw':!![]})[_0x513c('0x23')](function(_0x3a7487){return createVoicePrefixExtensions(_0x31c63f,_0x3a7487,_0x5d8fbc);});});});})[_0x513c('0x23')](function(){return db['VoicePrefix'][_0x513c('0x68')](_0x31c63f['id']);})[_0x513c('0x23')](respondWithResult(_0x39192c,null))[_0x513c('0x42')](handleError(_0x39192c,null));};exports[_0x513c('0x69')]=function(_0x31b95c,_0x355703,_0x3aeddf){return db[_0x513c('0x2a')]['find']({'where':{'id':_0x31b95c[_0x513c('0x43')]['id']}})[_0x513c('0x23')](handleEntityNotFound(_0x355703,null))[_0x513c('0x23')](function(_0x5d227e){if(_0x5d227e){return _0x5d227e['addAgents'](_0x31b95c[_0x513c('0x6a')][_0x513c('0x6b')],_[_0x513c('0x6c')](_0x31b95c[_0x513c('0x6a')],[_0x513c('0x6b'),'id'])||{})['spread'](function(_0x7b5766){for(var _0x5143bc=0x0;_0x5143bc<_0x31b95c[_0x513c('0x6a')][_0x513c('0x6b')][_0x513c('0x45')];_0x5143bc+=0x1){socket[_0x513c('0x6d')]('userVoicePrefix:save',{'UserId':_0x31b95c['body'][_0x513c('0x6b')][_0x5143bc],'VoicePrefixId':_0x31b95c[_0x513c('0x43')]['id']});}return _0x7b5766;});}})[_0x513c('0x23')](respondWithResult(_0x355703,null))['catch'](handleError(_0x355703,null));};exports['removeAgents']=function(_0x296a5b,_0x2b2072,_0x583355){return db['VoicePrefix'][_0x513c('0x46')]({'where':{'id':_0x296a5b['params']['id']}})[_0x513c('0x23')](handleEntityNotFound(_0x2b2072,null))[_0x513c('0x23')](function(_0x1d665f){if(_0x1d665f){return _0x1d665f[_0x513c('0x6e')](_0x296a5b['query'][_0x513c('0x6b')])[_0x513c('0x23')](function(){if(_['isArray'](_0x296a5b[_0x513c('0x2e')][_0x513c('0x6b')])){for(var _0x488bcd=0x0;_0x488bcd<_0x296a5b[_0x513c('0x2e')][_0x513c('0x6b')][_0x513c('0x45')];_0x488bcd+=0x1){socket[_0x513c('0x6d')](_0x513c('0x6f'),{'UserId':Number(_0x296a5b['query'][_0x513c('0x6b')][_0x488bcd]),'VoicePrefixId':Number(_0x296a5b[_0x513c('0x43')]['id'])});}}else{socket['emit'](_0x513c('0x6f'),{'UserId':Number(_0x296a5b[_0x513c('0x2e')][_0x513c('0x6b')]),'VoicePrefixId':Number(_0x296a5b['params']['id'])});}});}})[_0x513c('0x23')](respondWithStatusCode(_0x2b2072,null))['catch'](handleError(_0x2b2072,null));};exports[_0x513c('0x70')]=function(_0x3961eb,_0x10bfeb,_0xc8705c){var _0x4ffff0={};var _0x343cad={};var _0x58f050;var _0x3ca1db;return db[_0x513c('0x2a')]['findOne']({'where':{'id':_0x3961eb[_0x513c('0x43')]['id']}})[_0x513c('0x23')](handleEntityNotFound(_0x10bfeb,null))[_0x513c('0x23')](function(_0x3f0928){if(_0x3f0928){_0x58f050=_0x3f0928;_0x343cad[_0x513c('0x2d')]=_[_0x513c('0x2f')](db[_0x513c('0x71')]['rawAttributes']);_0x343cad[_0x513c('0x2e')]=_[_0x513c('0x2f')](_0x3961eb[_0x513c('0x2e')]);_0x343cad['filters']=_[_0x513c('0x31')](_0x343cad[_0x513c('0x2d')],_0x343cad[_0x513c('0x2e')]);_0x4ffff0['attributes']=_[_0x513c('0x31')](_0x343cad['model'],qs[_0x513c('0x32')](_0x3961eb[_0x513c('0x2e')]['fields']));_0x4ffff0[_0x513c('0x33')]=_0x4ffff0['attributes'][_0x513c('0x45')]?_0x4ffff0[_0x513c('0x33')]:_0x343cad[_0x513c('0x2d')];_0x4ffff0[_0x513c('0x72')]=qs[_0x513c('0x36')](_0x3961eb[_0x513c('0x2e')][_0x513c('0x36')]);_0x4ffff0[_0x513c('0x39')]=qs[_0x513c('0x30')](_[_0x513c('0x37')](_0x3961eb[_0x513c('0x2e')],_0x343cad[_0x513c('0x30')]));if(_0x3961eb[_0x513c('0x2e')]['filter']){_0x4ffff0[_0x513c('0x39')]=_['merge'](_0x4ffff0[_0x513c('0x39')],{'$or':_['map'](_0x4ffff0['attributes'],function(_0x59cc92){var _0x125fbb={};_0x125fbb[_0x59cc92]={'$like':'%'+_0x3961eb[_0x513c('0x2e')][_0x513c('0x38')]+'%'};return _0x125fbb;})});}_0x4ffff0=_[_0x513c('0x3c')]({},_0x4ffff0,_0x3961eb[_0x513c('0x3d')]);return _0x58f050['getAgents'](_0x4ffff0);}})[_0x513c('0x23')](function(_0x19a7fa){if(_0x19a7fa){_0x3ca1db=_0x19a7fa[_0x513c('0x45')];if(!_0x3961eb[_0x513c('0x2e')][_0x513c('0x34')](_0x513c('0x73'))){_0x4ffff0[_0x513c('0x35')]=qs[_0x513c('0x35')](_0x3961eb[_0x513c('0x2e')][_0x513c('0x35')]);_0x4ffff0['offset']=qs['offset'](_0x3961eb['query'][_0x513c('0x18')]);}return _0x58f050['getAgents'](_0x4ffff0);}})[_0x513c('0x23')](function(_0x445eec){if(_0x445eec){return _0x445eec?{'count':_0x3ca1db,'rows':_0x445eec}:null;}})[_0x513c('0x23')](respondWithResult(_0x10bfeb,null))[_0x513c('0x42')](handleError(_0x10bfeb,null));}; \ No newline at end of file +var _0xed1f=['NoOp','No\x20callerid\x20available','goto','charAt','update','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','hasOwnProperty','html-pdf','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','VoicePrefixes','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','order','sort','pick','merge','where','VIRTUAL','filter','options','include','VoicePrefix','findAll','rows','show','params','length','includeAll','find','catch','describe','sequelize','transaction','create','body','get','VoiceExtension','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','Voice\x20Prefix\x20Extension','appdata','prefix','Voice\x20Prefix','VoiceExtensionId','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','push','PREFIX-CALLERIDALL='];(function(_0x493da1,_0x3c6113){var _0x7a01d5=function(_0x4c674b){while(--_0x4c674b){_0x493da1['push'](_0x493da1['shift']());}};_0x7a01d5(++_0x3c6113);}(_0xed1f,0x170));var _0xfed1=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xed1f[_0x87b0ff];return _0x3bc0b2;};'use strict';var pdf=require(_0xfed1('0x0'));var emlformat=require(_0xfed1('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfed1('0x2'));var rp=require('request-promise');var moment=require(_0xfed1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfed1('0x4'));var util=require(_0xfed1('0x5'));var path=require(_0xfed1('0x6'));var sox=require(_0xfed1('0x7'));var csv=require(_0xfed1('0x8'));var ejs=require(_0xfed1('0x9'));var fs=require('fs');var _=require(_0xfed1('0xa'));var squel=require(_0xfed1('0xb'));var crypto=require(_0xfed1('0xc'));var jsforce=require(_0xfed1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfed1('0x8'));var querystring=require(_0xfed1('0xe'));var Papa=require(_0xfed1('0xf'));var Redis=require('ioredis');var authService=require(_0xfed1('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfed1('0x11'));var logger=require(_0xfed1('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xfed1('0x13'));var licenseUtil=require(_0xfed1('0x14'));var db=require('../../mysqldb')['db'];config[_0xfed1('0x15')]=_['defaults'](config[_0xfed1('0x15')],{'host':_0xfed1('0x16'),'port':0x18eb});var socket=require(_0xfed1('0x17'))(new Redis(config[_0xfed1('0x15')]));require('./voicePrefix.socket')[_0xfed1('0x18')](socket);function respondWithStatusCode(_0x3754c2,_0x4a0f51){_0x4a0f51=_0x4a0f51||0xcc;return function(_0x51631c){if(_0x51631c){return _0x3754c2[_0xfed1('0x19')](_0x4a0f51);}return _0x3754c2[_0xfed1('0x1a')](_0x4a0f51)[_0xfed1('0x1b')]();};}function respondWithResult(_0x5ed220,_0x223f42){_0x223f42=_0x223f42||0xc8;return function(_0x2218d5){if(_0x2218d5){return _0x5ed220[_0xfed1('0x1a')](_0x223f42)[_0xfed1('0x1c')](_0x2218d5);}};}function respondWithFilteredResult(_0x5ab809,_0x31ff97){return function(_0x4c492e){if(_0x4c492e){var _0x34512d=_0x4c492e[_0xfed1('0x1d')],_0x2b4cd7=_0x31ff97[_0xfed1('0x1e')],_0x376474=_0x31ff97[_0xfed1('0x1e')]+_0x31ff97[_0xfed1('0x1f')],_0x20765b;if(_0x376474>=_0x34512d){_0x376474=_0x34512d;_0x20765b=0xc8;}else{_0x20765b=0xce;}_0x5ab809[_0xfed1('0x1a')](_0x20765b);return _0x5ab809['set'](_0xfed1('0x20'),_0x2b4cd7+'-'+_0x376474+'/'+_0x34512d)['json'](_0x4c492e);}return null;};}function patchUpdates(_0x2f9398){return function(_0x3e5ada){try{jsonpatch[_0xfed1('0x21')](_0x3e5ada,_0x2f9398,!![]);}catch(_0x3a159e){return BPromise[_0xfed1('0x22')](_0x3a159e);}return _0x3e5ada[_0xfed1('0x23')]();};}function saveUpdates(_0x1748f5,_0x15965d){return function(_0x484f8a){if(_0x484f8a){return _0x484f8a['update'](_0x1748f5)[_0xfed1('0x24')](function(_0x5c9385){return _0x5c9385;});}return null;};}function removeEntity(_0x36a818,_0x4388f3){return function(_0x4cd3b8){if(_0x4cd3b8){return _0x4cd3b8[_0xfed1('0x25')]()[_0xfed1('0x24')](function(){var _0x472dbc=_0x4cd3b8['get']({'plain':!![]});var _0x1e8c3e=_0xfed1('0x26');return db['UserProfileResource'][_0xfed1('0x25')]({'where':{'type':_0x1e8c3e,'resourceId':_0x472dbc['id']}})[_0xfed1('0x24')](function(){return _0x4cd3b8;});})[_0xfed1('0x24')](function(){_0x36a818['status'](0xcc)[_0xfed1('0x1b')]();});}};}function handleEntityNotFound(_0x425a47,_0x45ee5c){return function(_0x5ab942){if(!_0x5ab942){_0x425a47[_0xfed1('0x19')](0x194);}return _0x5ab942;};}function handleError(_0x46cf02,_0x411182){_0x411182=_0x411182||0x1f4;return function(_0x1867f6){logger[_0xfed1('0x27')](_0x1867f6[_0xfed1('0x28')]);if(_0x1867f6['name']){delete _0x1867f6[_0xfed1('0x29')];}_0x46cf02[_0xfed1('0x1a')](_0x411182)['send'](_0x1867f6);};}exports[_0xfed1('0x2a')]=function(_0x3c971d,_0x2d3e62){var _0x50e421={},_0x22fe16={},_0x41aadf={'count':0x0,'rows':[]};var _0x419472=_[_0xfed1('0x2b')](db['VoicePrefix'][_0xfed1('0x2c')],function(_0x3bf815){return{'name':_0x3bf815[_0xfed1('0x2d')],'type':_0x3bf815[_0xfed1('0x2e')][_0xfed1('0x2f')]};});_0x22fe16['model']=_[_0xfed1('0x2b')](_0x419472,_0xfed1('0x29'));_0x22fe16[_0xfed1('0x30')]=_[_0xfed1('0x31')](_0x3c971d[_0xfed1('0x30')]);_0x22fe16[_0xfed1('0x32')]=_[_0xfed1('0x33')](_0x22fe16[_0xfed1('0x34')],_0x22fe16['query']);_0x50e421['attributes']=_['intersection'](_0x22fe16[_0xfed1('0x34')],qs[_0xfed1('0x35')](_0x3c971d['query'][_0xfed1('0x35')]));_0x50e421['attributes']=_0x50e421['attributes']['length']?_0x50e421[_0xfed1('0x36')]:_0x22fe16[_0xfed1('0x34')];if(!_0x3c971d[_0xfed1('0x30')]['hasOwnProperty']('nolimit')){_0x50e421[_0xfed1('0x1f')]=qs[_0xfed1('0x1f')](_0x3c971d[_0xfed1('0x30')][_0xfed1('0x1f')]);_0x50e421[_0xfed1('0x1e')]=qs[_0xfed1('0x1e')](_0x3c971d[_0xfed1('0x30')]['offset']);}_0x50e421[_0xfed1('0x37')]=qs['sort'](_0x3c971d[_0xfed1('0x30')][_0xfed1('0x38')]);_0x50e421['where']=qs[_0xfed1('0x32')](_[_0xfed1('0x39')](_0x3c971d['query'],_0x22fe16[_0xfed1('0x32')]),_0x419472);if(_0x3c971d[_0xfed1('0x30')]['filter']){_0x50e421['where']=_[_0xfed1('0x3a')](_0x50e421[_0xfed1('0x3b')],{'$or':_[_0xfed1('0x2b')](_0x419472,function(_0x3e4730){if(_0x3e4730['type']!==_0xfed1('0x3c')){var _0x483f9d={};_0x483f9d[_0x3e4730[_0xfed1('0x29')]]={'$like':'%'+_0x3c971d['query'][_0xfed1('0x3d')]+'%'};return _0x483f9d;}})});}_0x50e421=_[_0xfed1('0x3a')]({},_0x50e421,_0x3c971d[_0xfed1('0x3e')]);var _0x2f5c64={'where':_0x50e421[_0xfed1('0x3b')]};return db['VoicePrefix'][_0xfed1('0x1d')](_0x2f5c64)[_0xfed1('0x24')](function(_0x3903ab){_0x41aadf[_0xfed1('0x1d')]=_0x3903ab;if(_0x3c971d[_0xfed1('0x30')]['includeAll']){_0x50e421[_0xfed1('0x3f')]=[{'all':!![]}];}return db[_0xfed1('0x40')][_0xfed1('0x41')](_0x50e421);})[_0xfed1('0x24')](function(_0x40f7b3){_0x41aadf[_0xfed1('0x42')]=_0x40f7b3;return _0x41aadf;})[_0xfed1('0x24')](respondWithFilteredResult(_0x2d3e62,_0x50e421))['catch'](handleError(_0x2d3e62,null));};exports[_0xfed1('0x43')]=function(_0x4c39e0,_0x3c9948){var _0x19fffc={'raw':![],'where':{'id':_0x4c39e0[_0xfed1('0x44')]['id']}},_0x233fa4={};_0x233fa4[_0xfed1('0x34')]=_[_0xfed1('0x31')](db[_0xfed1('0x40')]['rawAttributes']);_0x233fa4[_0xfed1('0x30')]=_[_0xfed1('0x31')](_0x4c39e0['query']);_0x233fa4[_0xfed1('0x32')]=_[_0xfed1('0x33')](_0x233fa4[_0xfed1('0x34')],_0x233fa4[_0xfed1('0x30')]);_0x19fffc['attributes']=_[_0xfed1('0x33')](_0x233fa4[_0xfed1('0x34')],qs[_0xfed1('0x35')](_0x4c39e0['query']['fields']));_0x19fffc['attributes']=_0x19fffc['attributes'][_0xfed1('0x45')]?_0x19fffc[_0xfed1('0x36')]:_0x233fa4[_0xfed1('0x34')];if(_0x4c39e0[_0xfed1('0x30')][_0xfed1('0x46')]){_0x19fffc['include']=[{'all':!![]}];}_0x19fffc=_['merge']({},_0x19fffc,_0x4c39e0[_0xfed1('0x3e')]);return db[_0xfed1('0x40')][_0xfed1('0x47')](_0x19fffc)['then'](handleEntityNotFound(_0x3c9948,null))['then'](respondWithResult(_0x3c9948,null))[_0xfed1('0x48')](handleError(_0x3c9948,null));};exports[_0xfed1('0x25')]=function(_0x429aa7,_0x2280f6){return db[_0xfed1('0x40')][_0xfed1('0x47')]({'where':{'id':_0x429aa7['params']['id']}})[_0xfed1('0x24')](handleEntityNotFound(_0x2280f6,null))['then'](removeEntity(_0x2280f6,null))[_0xfed1('0x48')](handleError(_0x2280f6,null));};exports[_0xfed1('0x49')]=function(_0x4e84ac,_0x4a11af){return db[_0xfed1('0x40')][_0xfed1('0x49')]()[_0xfed1('0x24')](respondWithResult(_0x4a11af,null))[_0xfed1('0x48')](handleError(_0x4a11af,null));};exports['create']=function(_0x30127f,_0x3df3a7){var _0x4e17cc;return db[_0xfed1('0x4a')][_0xfed1('0x4b')](function(_0x5120cd){return db['VoicePrefix'][_0xfed1('0x4c')](_0x30127f[_0xfed1('0x4d')],{'transaction':_0x5120cd})[_0xfed1('0x24')](function(_0x35f91d){_0x4e17cc=_0x35f91d[_0xfed1('0x4e')]({'plain':!![]});return db[_0xfed1('0x4f')][_0xfed1('0x47')]({'where':{'id':_0x4e17cc['VoiceExtensionId']},'raw':!![]})[_0xfed1('0x24')](function(_0x3d340c){return createVoicePrefixExtensions(_0x4e17cc,_0x3d340c,_0x5120cd);});});})['then'](function(){var _0x29cd62=_0x30127f['user'][_0xfed1('0x4e')]({'plain':!![]});if(!_0x29cd62)throw new Error(_0xfed1('0x50'));if(_0x29cd62['role']===_0xfed1('0x51')){var _0x2bacc8=_0x4e17cc;return db[_0xfed1('0x52')][_0xfed1('0x47')]({'where':{'name':_0xfed1('0x26'),'userProfileId':_0x29cd62[_0xfed1('0x53')]},'raw':!![]})[_0xfed1('0x24')](function(_0x471ab0){if(_0x471ab0&&_0x471ab0['autoAssociation']===0x0){return db['UserProfileResource'][_0xfed1('0x4c')]({'name':_0x2bacc8[_0xfed1('0x29')],'resourceId':_0x2bacc8['id'],'type':_0x471ab0['name'],'sectionId':_0x471ab0['id']},{})[_0xfed1('0x24')](function(){return _0x4e17cc;});}else{return _0x4e17cc;}})[_0xfed1('0x48')](function(_0x450882){logger['error'](_0xfed1('0x54'),_0x450882);throw _0x450882;});}return _0x4e17cc;})[_0xfed1('0x24')](respondWithResult(_0x3df3a7,null))[_0xfed1('0x48')](handleError(_0x3df3a7,null));};function Extension(_0x4c80b3,_0x33b861,_0x4769c4,_0x534a67){this[_0xfed1('0x55')]=_0xfed1('0x56');this[_0xfed1('0x57')]=_0x4c80b3;this[_0xfed1('0x58')]=_0x4769c4;this[_0xfed1('0x2e')]='system';this['description']=_0xfed1('0x59');this['priority']=_0x33b861;this[_0xfed1('0x5a')]=_0x534a67;}function createVoicePrefixExtensions(_0x118ad0,_0x528470,_0x4e435b){return new BPromise(function(_0xba73b5,_0x5b3842){var _0x488f7e=new Extension(formatPrefixName(_0x118ad0[_0xfed1('0x5b')]),0x1,'NoOp',_0xfed1('0x5c'));_0x488f7e['VoicePrefixId']=_0x118ad0['id'];return db[_0xfed1('0x4f')][_0xfed1('0x4c')](_0x488f7e,{'transaction':_0x4e435b})[_0xfed1('0x24')](function(_0x65a784){var _0x5f1718=_0x65a784[_0xfed1('0x4e')]({'plain':!![]});var _0x2186c5=_[_0xfed1('0x2b')](addVoicePrefixExtensions(_0x118ad0,_0x528470),function(_0x5dfe3f){_0x5dfe3f[_0xfed1('0x5d')]=_0x5f1718['id'];_0x5dfe3f[_0xfed1('0x5e')]=_0x118ad0['id'];return _0x5dfe3f;});return db['VoiceExtension'][_0xfed1('0x5f')](_0x2186c5,{'transaction':_0x4e435b})[_0xfed1('0x24')](function(_0x1011b8){if(!_0x1011b8){return _0x5b3842(_0xfed1('0x60'));}else{return _0xba73b5(_0x1011b8);}})[_0xfed1('0x48')](function(_0x488d50){return _0x5b3842(_0x488d50);});});;});};function addVoicePrefixExtensions(_0x216b59,_0x43484f){var _0x4b543f=[];var _0x31094d=formatPrefixName(_0x216b59[_0xfed1('0x5b')]);_0x4b543f['push'](new Extension(_0x31094d,0x2,_0xfed1('0x61'),'CDR(prefix)='+_0x216b59[_0xfed1('0x29')]));if(_0x216b59['callerIdAll']){_0x4b543f[_0xfed1('0x62')](new Extension(_0x31094d,0x3,_0xfed1('0x61'),_0xfed1('0x63')+_0x216b59['callerIdAll']));}else{_0x4b543f['push'](new Extension(_0x31094d,0x3,_0xfed1('0x64'),_0xfed1('0x65')));}_0x4b543f[_0xfed1('0x62')](new Extension(_0x31094d,0x4,_0xfed1('0x66'),_0x43484f[_0xfed1('0x55')]+','+'${EXTEN:'+(0x8+_0x216b59[_0xfed1('0x29')][_0xfed1('0x45')])+'}'+','+0x1));return _0x4b543f;}function formatPrefixName(_0x5f201c){var _0x515b23='_';for(var _0x3387fc=0x0;_0x3387fc<_0x5f201c[_0xfed1('0x45')];_0x3387fc++){if(_0x5f201c[_0xfed1('0x67')](_0x3387fc)=='-'){_0x515b23+=_0x5f201c[_0xfed1('0x67')](_0x3387fc);}else{_0x515b23+='['+_0x5f201c[_0xfed1('0x67')](_0x3387fc)+']';}}_0x515b23+='.';return _0x515b23;}exports[_0xfed1('0x68')]=function(_0x45b5f0,_0x1f3828,_0x927755){var _0x5b0b96=_0x45b5f0[_0xfed1('0x4d')];_0x5b0b96[_0xfed1('0x5b')]='system-'+_0x5b0b96['name']+'-';return db[_0xfed1('0x4a')]['transaction'](function(_0x13d89b){return db[_0xfed1('0x40')][_0xfed1('0x68')](_0x5b0b96,{'where':{'id':_0x5b0b96['id']},'transaction':_0x13d89b})[_0xfed1('0x24')](function(){return db[_0xfed1('0x4f')][_0xfed1('0x25')]({'where':{'VoicePrefixId':_0x5b0b96['id']},'transaction':_0x13d89b})['then'](function(){return db['VoiceExtension']['find']({'where':{'id':_0x5b0b96[_0xfed1('0x5d')]},'raw':!![]})[_0xfed1('0x24')](function(_0x1352ac){return createVoicePrefixExtensions(_0x5b0b96,_0x1352ac,_0x13d89b);});});});})['then'](function(){return db['VoicePrefix'][_0xfed1('0x69')](_0x5b0b96['id']);})[_0xfed1('0x24')](respondWithResult(_0x1f3828,null))[_0xfed1('0x48')](handleError(_0x1f3828,null));};exports['addAgents']=function(_0x285014,_0x2ee4b1,_0x105ba2){return db['VoicePrefix'][_0xfed1('0x47')]({'where':{'id':_0x285014[_0xfed1('0x44')]['id']}})[_0xfed1('0x24')](handleEntityNotFound(_0x2ee4b1,null))[_0xfed1('0x24')](function(_0x341c16){if(_0x341c16){return _0x341c16[_0xfed1('0x6a')](_0x285014[_0xfed1('0x4d')][_0xfed1('0x6b')],_[_0xfed1('0x6c')](_0x285014[_0xfed1('0x4d')],['ids','id'])||{})[_0xfed1('0x6d')](function(_0x280ae2){for(var _0x59bdd4=0x0;_0x59bdd4<_0x285014['body'][_0xfed1('0x6b')][_0xfed1('0x45')];_0x59bdd4+=0x1){socket[_0xfed1('0x6e')](_0xfed1('0x6f'),{'UserId':_0x285014[_0xfed1('0x4d')][_0xfed1('0x6b')][_0x59bdd4],'VoicePrefixId':_0x285014['params']['id']});}return _0x280ae2;});}})[_0xfed1('0x24')](respondWithResult(_0x2ee4b1,null))[_0xfed1('0x48')](handleError(_0x2ee4b1,null));};exports[_0xfed1('0x70')]=function(_0x31ac85,_0x1420fc,_0x2db26c){return db[_0xfed1('0x40')][_0xfed1('0x47')]({'where':{'id':_0x31ac85[_0xfed1('0x44')]['id']}})['then'](handleEntityNotFound(_0x1420fc,null))[_0xfed1('0x24')](function(_0x75f30d){if(_0x75f30d){return _0x75f30d[_0xfed1('0x70')](_0x31ac85[_0xfed1('0x30')]['ids'])[_0xfed1('0x24')](function(){if(_['isArray'](_0x31ac85[_0xfed1('0x30')][_0xfed1('0x6b')])){for(var _0x1c88f5=0x0;_0x1c88f5<_0x31ac85['query'][_0xfed1('0x6b')]['length'];_0x1c88f5+=0x1){socket['emit'](_0xfed1('0x71'),{'UserId':Number(_0x31ac85['query'][_0xfed1('0x6b')][_0x1c88f5]),'VoicePrefixId':Number(_0x31ac85['params']['id'])});}}else{socket['emit'](_0xfed1('0x71'),{'UserId':Number(_0x31ac85['query']['ids']),'VoicePrefixId':Number(_0x31ac85[_0xfed1('0x44')]['id'])});}});}})[_0xfed1('0x24')](respondWithStatusCode(_0x1420fc,null))['catch'](handleError(_0x1420fc,null));};exports[_0xfed1('0x72')]=function(_0x12dfd7,_0x21f310,_0x206ea8){var _0x2a6c24={};var _0x5df6ac={};var _0x42bd87;var _0xf547af;return db[_0xfed1('0x40')][_0xfed1('0x73')]({'where':{'id':_0x12dfd7['params']['id']}})[_0xfed1('0x24')](handleEntityNotFound(_0x21f310,null))['then'](function(_0x37bc3b){if(_0x37bc3b){_0x42bd87=_0x37bc3b;_0x5df6ac[_0xfed1('0x34')]=_[_0xfed1('0x31')](db['User'][_0xfed1('0x2c')]);_0x5df6ac[_0xfed1('0x30')]=_[_0xfed1('0x31')](_0x12dfd7['query']);_0x5df6ac[_0xfed1('0x32')]=_['intersection'](_0x5df6ac[_0xfed1('0x34')],_0x5df6ac['query']);_0x2a6c24[_0xfed1('0x36')]=_[_0xfed1('0x33')](_0x5df6ac['model'],qs[_0xfed1('0x35')](_0x12dfd7[_0xfed1('0x30')][_0xfed1('0x35')]));_0x2a6c24['attributes']=_0x2a6c24[_0xfed1('0x36')]['length']?_0x2a6c24[_0xfed1('0x36')]:_0x5df6ac['model'];_0x2a6c24[_0xfed1('0x37')]=qs[_0xfed1('0x38')](_0x12dfd7[_0xfed1('0x30')][_0xfed1('0x38')]);_0x2a6c24[_0xfed1('0x3b')]=qs['filters'](_[_0xfed1('0x39')](_0x12dfd7[_0xfed1('0x30')],_0x5df6ac[_0xfed1('0x32')]));if(_0x12dfd7[_0xfed1('0x30')][_0xfed1('0x3d')]){_0x2a6c24[_0xfed1('0x3b')]=_[_0xfed1('0x3a')](_0x2a6c24[_0xfed1('0x3b')],{'$or':_['map'](_0x2a6c24[_0xfed1('0x36')],function(_0x16e56f){var _0x225fa5={};_0x225fa5[_0x16e56f]={'$like':'%'+_0x12dfd7[_0xfed1('0x30')][_0xfed1('0x3d')]+'%'};return _0x225fa5;})});}_0x2a6c24=_[_0xfed1('0x3a')]({},_0x2a6c24,_0x12dfd7['options']);return _0x42bd87['getAgents'](_0x2a6c24);}})[_0xfed1('0x24')](function(_0x462dc5){if(_0x462dc5){_0xf547af=_0x462dc5['length'];if(!_0x12dfd7[_0xfed1('0x30')][_0xfed1('0x74')]('nolimit')){_0x2a6c24[_0xfed1('0x1f')]=qs[_0xfed1('0x1f')](_0x12dfd7[_0xfed1('0x30')][_0xfed1('0x1f')]);_0x2a6c24[_0xfed1('0x1e')]=qs['offset'](_0x12dfd7[_0xfed1('0x30')][_0xfed1('0x1e')]);}return _0x42bd87[_0xfed1('0x72')](_0x2a6c24);}})[_0xfed1('0x24')](function(_0x3ffde4){if(_0x3ffde4){return _0x3ffde4?{'count':_0xf547af,'rows':_0x3ffde4}:null;}})['then'](respondWithResult(_0x21f310,null))['catch'](handleError(_0x21f310,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index ed873b6..f494151 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 _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x34e8,0x12c));var _0x834e=function(_0x662c37,_0x970ee8){_0x662c37=_0x662c37-0x0;var _0x5b7716=_0x34e8[_0x662c37];return _0x5b7716;};'use strict';var EventEmitter=require(_0x834e('0x0'));var VoicePrefix=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){VoicePrefixEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);VoicePrefixEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','VoicePrefix','setMaxListeners','save','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3e74,0x175));var _0x43e7=function(_0x44be67,_0x183aa3){_0x44be67=_0x44be67-0x0;var _0x1b4ea6=_0x3e74[_0x44be67];return _0x1b4ea6;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x43e7('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){VoicePrefixEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);VoicePrefixEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index deeb180..e7e4494 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 _0x0e5d=['define','voice_prefixes','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x47fd93,_0x3c384b){var _0x1e1e14=function(_0x155bd0){while(--_0x155bd0){_0x47fd93['push'](_0x47fd93['shift']());}};_0x1e1e14(++_0x3c384b);}(_0x0e5d,0x1af));var _0xd0e5=function(_0x58cb12,_0x3f32db){_0x58cb12=_0x58cb12-0x0;var _0xd27ea3=_0x0e5d[_0x58cb12];return _0xd27ea3;};'use strict';var _=require(_0xd0e5('0x0'));var util=require(_0xd0e5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd0e5('0x2'));var BPromise=require(_0xd0e5('0x3'));var rp=require(_0xd0e5('0x4'));var fs=require('fs');var path=require(_0xd0e5('0x5'));var rimraf=require(_0xd0e5('0x6'));var config=require(_0xd0e5('0x7'));var attributes=require('./voicePrefix.attributes');module[_0xd0e5('0x8')]=function(_0x5573d9,_0xd14f14){return _0x5573d9[_0xd0e5('0x9')]('VoicePrefix',attributes,{'tableName':_0xd0e5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4e4=['moment','bluebird','path','rimraf','exports','define','VoicePrefix','voice_prefixes','util','../../config/logger','api'];(function(_0x28cd70,_0x2ae5d0){var _0x111142=function(_0x5f2dad){while(--_0x5f2dad){_0x28cd70['push'](_0x28cd70['shift']());}};_0x111142(++_0x2ae5d0);}(_0xe4e4,0x1cb));var _0x4e4e=function(_0x4f504b,_0x8e7ff9){_0x4f504b=_0x4f504b-0x0;var _0x50c204=_0xe4e4[_0x4f504b];return _0x50c204;};'use strict';var _=require('lodash');var util=require(_0x4e4e('0x0'));var logger=require(_0x4e4e('0x1'))(_0x4e4e('0x2'));var moment=require(_0x4e4e('0x3'));var BPromise=require(_0x4e4e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e4e('0x5'));var rimraf=require(_0x4e4e('0x6'));var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module[_0x4e4e('0x7')]=function(_0x2da1d0,_0xb159fa){return _0x2da1d0[_0x4e4e('0x8')](_0x4e4e('0x9'),attributes,{'tableName':_0x4e4e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index ca925ff..b94fe14 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 _0x1b9b=['register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','defaults','redis','localhost','./voicePrefix.socket'];(function(_0x42bc5f,_0x184b40){var _0x56766b=function(_0x287b32){while(--_0x287b32){_0x42bc5f['push'](_0x42bc5f['shift']());}};_0x56766b(++_0x184b40);}(_0x1b9b,0x89));var _0xb1b9=function(_0x162bc4,_0x4e9729){_0x162bc4=_0x162bc4-0x0;var _0x4cd50f=_0x1b9b[_0x162bc4];return _0x4cd50f;};'use strict';var _=require(_0xb1b9('0x0'));var util=require('util');var moment=require(_0xb1b9('0x1'));var BPromise=require(_0xb1b9('0x2'));var rs=require(_0xb1b9('0x3'));var fs=require('fs');var Redis=require(_0xb1b9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb1b9('0x5'));var logger=require(_0xb1b9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb1b9('0x7')][_0xb1b9('0x8')]({'port':0x232a});config['redis']=_[_0xb1b9('0x9')](config[_0xb1b9('0xa')],{'host':_0xb1b9('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb1b9('0xa')]));require(_0xb1b9('0xc'))[_0xb1b9('0xd')](socket);function respondWithRpcPromise(_0x509e87,_0x178bb4,_0x535387){return new BPromise(function(_0x31b546,_0x5a6c8c){return client[_0xb1b9('0xe')](_0x509e87,_0x535387)[_0xb1b9('0xf')](function(_0x1595a6){logger[_0xb1b9('0x10')](_0xb1b9('0x11'),_0x178bb4,_0xb1b9('0x12'));logger[_0xb1b9('0x13')](_0xb1b9('0x14'),_0x178bb4,'request\x20sent',JSON[_0xb1b9('0x15')](_0x1595a6));if(_0x1595a6[_0xb1b9('0x16')]){if(_0x1595a6[_0xb1b9('0x16')]['code']===0x1f4){logger[_0xb1b9('0x16')](_0xb1b9('0x11'),_0x178bb4,_0x1595a6[_0xb1b9('0x16')][_0xb1b9('0x17')]);return _0x5a6c8c(_0x1595a6[_0xb1b9('0x16')][_0xb1b9('0x17')]);}logger['error'](_0xb1b9('0x11'),_0x178bb4,_0x1595a6['error'][_0xb1b9('0x17')]);return _0x31b546(_0x1595a6[_0xb1b9('0x16')][_0xb1b9('0x17')]);}else{logger[_0xb1b9('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x178bb4,_0xb1b9('0x12'));_0x31b546(_0x1595a6[_0xb1b9('0x18')][_0xb1b9('0x17')]);}})['catch'](function(_0x26d012){logger[_0xb1b9('0x16')](_0xb1b9('0x11'),_0x178bb4,_0x26d012);_0x5a6c8c(_0x26d012);});});} \ No newline at end of file +var _0x1d54=['stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1b6a0a,_0x29cffb){var _0x5a411d=function(_0x101a1b){while(--_0x101a1b){_0x1b6a0a['push'](_0x1b6a0a['shift']());}};_0x5a411d(++_0x29cffb);}(_0x1d54,0x100));var _0x41d5=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0x1d54[_0xd2d54];return _0x78b113;};'use strict';var _=require(_0x41d5('0x0'));var util=require('util');var moment=require(_0x41d5('0x1'));var BPromise=require(_0x41d5('0x2'));var rs=require(_0x41d5('0x3'));var fs=require('fs');var Redis=require(_0x41d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x41d5('0x5'));var logger=require(_0x41d5('0x6'))('rpc');var config=require(_0x41d5('0x7'));var jayson=require(_0x41d5('0x8'));var client=jayson[_0x41d5('0x9')][_0x41d5('0xa')]({'port':0x232a});config['redis']=_[_0x41d5('0xb')](config[_0x41d5('0xc')],{'host':_0x41d5('0xd'),'port':0x18eb});var socket=require(_0x41d5('0xe'))(new Redis(config[_0x41d5('0xc')]));require(_0x41d5('0xf'))[_0x41d5('0x10')](socket);function respondWithRpcPromise(_0x1d51c3,_0x5de62e,_0x2be778){return new BPromise(function(_0x35c748,_0x184742){return client[_0x41d5('0x11')](_0x1d51c3,_0x2be778)[_0x41d5('0x12')](function(_0x17ab34){logger[_0x41d5('0x13')](_0x41d5('0x14'),_0x5de62e,'request\x20sent');logger[_0x41d5('0x15')](_0x41d5('0x16'),_0x5de62e,_0x41d5('0x17'),JSON[_0x41d5('0x18')](_0x17ab34));if(_0x17ab34[_0x41d5('0x19')]){if(_0x17ab34[_0x41d5('0x19')]['code']===0x1f4){logger[_0x41d5('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x5de62e,_0x17ab34[_0x41d5('0x19')][_0x41d5('0x1a')]);return _0x184742(_0x17ab34[_0x41d5('0x19')][_0x41d5('0x1a')]);}logger[_0x41d5('0x19')](_0x41d5('0x14'),_0x5de62e,_0x17ab34['error'][_0x41d5('0x1a')]);return _0x35c748(_0x17ab34[_0x41d5('0x19')][_0x41d5('0x1a')]);}else{logger[_0x41d5('0x13')](_0x41d5('0x14'),_0x5de62e,_0x41d5('0x17'));_0x35c748(_0x17ab34[_0x41d5('0x1b')][_0x41d5('0x1a')]);}})['catch'](function(_0x14300c){logger[_0x41d5('0x19')](_0x41d5('0x14'),_0x5de62e,_0x14300c);_0x184742(_0x14300c);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 29e5725..29bdaaf 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 _0xdfb1=['remove','update','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events','save'];(function(_0x4d1d93,_0x2450a7){var _0x20d058=function(_0x459f6f){while(--_0x459f6f){_0x4d1d93['push'](_0x4d1d93['shift']());}};_0x20d058(++_0x2450a7);}(_0xdfb1,0x1ed));var _0x1dfb=function(_0xf4ba00,_0x41e073){_0xf4ba00=_0xf4ba00-0x0;var _0x2ae7c3=_0xdfb1[_0xf4ba00];return _0x2ae7c3;};'use strict';var VoicePrefixEvents=require(_0x1dfb('0x0'));var events=[_0x1dfb('0x1'),_0x1dfb('0x2'),_0x1dfb('0x3')];function createListener(_0x27487a,_0x203bd0){return function(_0x11d7a1){_0x203bd0[_0x1dfb('0x4')](_0x27487a,_0x11d7a1);};}function removeListener(_0x26defd,_0xc5bb65){return function(){VoicePrefixEvents[_0x1dfb('0x5')](_0x26defd,_0xc5bb65);};}exports[_0x1dfb('0x6')]=function(_0x757787){for(var _0x3cc152=0x0,_0x25be5f=events[_0x1dfb('0x7')];_0x3cc152<_0x25be5f;_0x3cc152++){var _0x4a1e2c=events[_0x3cc152];var _0x53ce7a=createListener(_0x1dfb('0x8')+_0x4a1e2c,_0x757787);VoicePrefixEvents['on'](_0x4a1e2c,_0x53ce7a);}}; \ No newline at end of file +var _0x5252=['length','voicePrefix:','save','remove','update','removeListener'];(function(_0x128978,_0x5cdb7d){var _0x32c9f7=function(_0x153066){while(--_0x153066){_0x128978['push'](_0x128978['shift']());}};_0x32c9f7(++_0x5cdb7d);}(_0x5252,0x1ca));var _0x2525=function(_0x562aa3,_0x44390e){_0x562aa3=_0x562aa3-0x0;var _0x54260f=_0x5252[_0x562aa3];return _0x54260f;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x2525('0x0'),_0x2525('0x1'),_0x2525('0x2')];function createListener(_0x4a23bf,_0xf55c19){return function(_0x282268){_0xf55c19['emit'](_0x4a23bf,_0x282268);};}function removeListener(_0x3210e3,_0x3d1dd9){return function(){VoicePrefixEvents[_0x2525('0x3')](_0x3210e3,_0x3d1dd9);};}exports['register']=function(_0x280803){for(var _0x2d21b5=0x0,_0x16b078=events[_0x2525('0x4')];_0x2d21b5<_0x16b078;_0x2d21b5++){var _0x208009=events[_0x2d21b5];var _0x18d057=createListener(_0x2525('0x5')+_0x208009,_0x280803);VoicePrefixEvents['on'](_0x208009,_0x18d057);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 6744207..fa88833 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 _0x366c=['/:id/members','getMembers','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/teams','addTeams','addAgents','/:id/lists','addLists','addBlackLists','put','destroy','delete','removeTeams','removeAgents','removeBlackLists','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getTeams','/:id/users','getAgents'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x366c,0x117));var _0xc366=function(_0x47c019,_0x23fa70){_0x47c019=_0x47c019-0x0;var _0x3031bd=_0x366c[_0x47c019];return _0x3031bd;};'use strict';var multer=require('multer');var util=require(_0xc366('0x0'));var path=require(_0xc366('0x1'));var timeout=require(_0xc366('0x2'));var express=require(_0xc366('0x3'));var router=express[_0xc366('0x4')]();var auth=require(_0xc366('0x5'));var interaction=require(_0xc366('0x6'));var config=require('../../config/environment');var controller=require(_0xc366('0x7'));router[_0xc366('0x8')]('/',auth[_0xc366('0x9')](),controller['index']);router[_0xc366('0x8')](_0xc366('0xa'),auth[_0xc366('0x9')](),controller[_0xc366('0xb')]);router[_0xc366('0x8')](_0xc366('0xc'),auth[_0xc366('0x9')](),controller[_0xc366('0xd')]);router[_0xc366('0x8')](_0xc366('0xe'),auth[_0xc366('0x9')](),controller[_0xc366('0xf')]);router[_0xc366('0x8')](_0xc366('0x10'),auth['isAuthenticated'](),controller[_0xc366('0x11')]);router[_0xc366('0x8')](_0xc366('0x12'),auth[_0xc366('0x9')](),controller['getHopperBlacks']);router[_0xc366('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0xc366('0x13')]);router[_0xc366('0x8')](_0xc366('0x14'),auth[_0xc366('0x9')](),controller[_0xc366('0x15')]);router['get'](_0xc366('0x16'),auth[_0xc366('0x9')](),controller[_0xc366('0x17')]);router[_0xc366('0x8')]('/:id/lists',auth[_0xc366('0x9')](),controller[_0xc366('0x18')]);router[_0xc366('0x8')](_0xc366('0x19'),auth[_0xc366('0x9')](),controller[_0xc366('0x1a')]);router[_0xc366('0x1b')]('/',auth[_0xc366('0x9')](),controller[_0xc366('0x1c')]);router[_0xc366('0x1b')](_0xc366('0x1d'),auth[_0xc366('0x9')](),controller[_0xc366('0x1e')]);router[_0xc366('0x1b')](_0xc366('0x1f'),auth[_0xc366('0x9')](),controller[_0xc366('0x20')]);router[_0xc366('0x1b')](_0xc366('0x14'),auth['isAuthenticated'](),controller[_0xc366('0x21')]);router[_0xc366('0x1b')](_0xc366('0x22'),auth[_0xc366('0x9')](),controller[_0xc366('0x23')]);router[_0xc366('0x1b')](_0xc366('0x19'),auth[_0xc366('0x9')](),controller[_0xc366('0x24')]);router[_0xc366('0x25')](_0xc366('0xa'),auth[_0xc366('0x9')](),controller['update']);router['delete'](_0xc366('0xa'),auth[_0xc366('0x9')](),controller[_0xc366('0x26')]);router[_0xc366('0x27')](_0xc366('0x1f'),auth[_0xc366('0x9')](),controller[_0xc366('0x28')]);router[_0xc366('0x27')](_0xc366('0x14'),auth['isAuthenticated'](),controller[_0xc366('0x29')]);router[_0xc366('0x27')]('/:id/lists',auth[_0xc366('0x9')](),controller['removeLists']);router[_0xc366('0x27')](_0xc366('0x19'),auth[_0xc366('0x9')](),controller[_0xc366('0x2a')]);module['exports']=router; \ No newline at end of file +var _0x8070=['get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone','addAgents','addLists','update','destroy','delete','removeTeams','removeAgents','removeLists','removeBlackLists','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x8560d3,_0x26a504){var _0x33b1b5=function(_0x3a2cad){while(--_0x3a2cad){_0x8560d3['push'](_0x8560d3['shift']());}};_0x33b1b5(++_0x26a504);}(_0x8070,0x1a6));var _0x0807=function(_0x2c7e33,_0x13d8d6){_0x2c7e33=_0x2c7e33-0x0;var _0xb29ca9=_0x8070[_0x2c7e33];return _0xb29ca9;};'use strict';var multer=require(_0x0807('0x0'));var util=require('util');var path=require(_0x0807('0x1'));var timeout=require(_0x0807('0x2'));var express=require(_0x0807('0x3'));var router=express[_0x0807('0x4')]();var auth=require(_0x0807('0x5'));var interaction=require(_0x0807('0x6'));var config=require('../../config/environment');var controller=require('./voiceQueue.controller');router[_0x0807('0x7')]('/',auth[_0x0807('0x8')](),controller[_0x0807('0x9')]);router[_0x0807('0x7')](_0x0807('0xa'),auth[_0x0807('0x8')](),controller['show']);router['get'](_0x0807('0xb'),auth['isAuthenticated'](),controller[_0x0807('0xc')]);router[_0x0807('0x7')](_0x0807('0xd'),auth[_0x0807('0x8')](),controller[_0x0807('0xe')]);router[_0x0807('0x7')](_0x0807('0xf'),auth[_0x0807('0x8')](),controller['getHopperFinals']);router[_0x0807('0x7')](_0x0807('0x10'),auth[_0x0807('0x8')](),controller[_0x0807('0x11')]);router['get'](_0x0807('0x12'),auth[_0x0807('0x8')](),controller[_0x0807('0x13')]);router[_0x0807('0x7')](_0x0807('0x14'),auth[_0x0807('0x8')](),controller['getAgents']);router[_0x0807('0x7')](_0x0807('0x15'),auth[_0x0807('0x8')](),controller[_0x0807('0x16')]);router['get'](_0x0807('0x17'),auth[_0x0807('0x8')](),controller[_0x0807('0x18')]);router['get'](_0x0807('0x19'),auth[_0x0807('0x8')](),controller['getBlackLists']);router[_0x0807('0x1a')]('/',auth[_0x0807('0x8')](),controller[_0x0807('0x1b')]);router[_0x0807('0x1a')](_0x0807('0x1c'),auth['isAuthenticated'](),controller[_0x0807('0x1d')]);router[_0x0807('0x1a')](_0x0807('0x12'),auth[_0x0807('0x8')](),controller['addTeams']);router[_0x0807('0x1a')](_0x0807('0x14'),auth['isAuthenticated'](),controller[_0x0807('0x1e')]);router[_0x0807('0x1a')](_0x0807('0x17'),auth[_0x0807('0x8')](),controller[_0x0807('0x1f')]);router[_0x0807('0x1a')]('/:id/blacklists',auth[_0x0807('0x8')](),controller['addBlackLists']);router['put']('/:id',auth[_0x0807('0x8')](),controller[_0x0807('0x20')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0807('0x21')]);router[_0x0807('0x22')]('/:id/teams',auth['isAuthenticated'](),controller[_0x0807('0x23')]);router[_0x0807('0x22')](_0x0807('0x14'),auth[_0x0807('0x8')](),controller[_0x0807('0x24')]);router[_0x0807('0x22')](_0x0807('0x17'),auth[_0x0807('0x8')](),controller[_0x0807('0x25')]);router[_0x0807('0x22')](_0x0807('0x19'),auth[_0x0807('0x8')](),controller[_0x0807('0x26')]);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 cab0dc5..cc57511 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(_0x4e2fe3,_0x15fb77){var _0x4f9d24=function(_0xc32b26){while(--_0xc32b26){_0x4e2fe3['push'](_0x4e2fe3['shift']());}};_0x4f9d24(++_0x15fb77);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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(_0x97877,_0x422052){var _0x5d9569=function(_0x60e479){while(--_0x60e479){_0x97877['push'](_0x97877['shift']());}};_0x5d9569(++_0x422052);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 d79a1a2..234ef03 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 _0x84d9=['ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','cm_hopper','insert','fromQuery','scheduledAt','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','addBlackLists','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','then','VoiceQueues','QueueCampaigns','filter','ignore','value','includes','type','find','stack','name','index','map','VoiceQueue','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','includeAll','include','catch','show','params','keys','rawAttributes','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','outbound','UserProfileSection','autoAssociation','error','options','omit','createdAt','updatedAt','body','inbound','userProfileId','UserProfileResource','getHoppers','CmHopper','nolimit','VoiceQueueId','findAll','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','rows','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','User','Agents','online','flatMap','transaction','each','TeamVoiceQueue','penalty','UserVoiceQueue','findOrCreate','upsert','isNil','format','interface','emit','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','sequelize','isEmpty','removeAgents','forEach','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','voicePause','SIP/%s','isArray','UserVoiceQueueRt','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','phone','ContactId','ListId','select','CmListId','NOW()','cm_contacts'];(function(_0xc9df8b,_0x21744d){var _0x35ca5d=function(_0x120ce3){while(--_0x120ce3){_0xc9df8b['push'](_0xc9df8b['shift']());}};_0x35ca5d(++_0x21744d);}(_0x84d9,0x183));var _0x984d=function(_0x38174e,_0x4145e4){_0x38174e=_0x38174e-0x0;var _0x324bac=_0x84d9[_0x38174e];return _0x324bac;};'use strict';var pdf=require(_0x984d('0x0'));var emlformat=require(_0x984d('0x1'));var rimraf=require(_0x984d('0x2'));var zipdir=require(_0x984d('0x3'));var jsonpatch=require(_0x984d('0x4'));var rp=require(_0x984d('0x5'));var moment=require(_0x984d('0x6'));var BPromise=require(_0x984d('0x7'));var Mustache=require('mustache');var util=require(_0x984d('0x8'));var path=require(_0x984d('0x9'));var sox=require(_0x984d('0xa'));var csv=require('to-csv');var ejs=require(_0x984d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x984d('0xc'));var crypto=require(_0x984d('0xd'));var jsforce=require(_0x984d('0xe'));var deskjs=require(_0x984d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x984d('0x10'));var Papa=require(_0x984d('0x11'));var Redis=require(_0x984d('0x12'));var authService=require(_0x984d('0x13'));var qs=require(_0x984d('0x14'));var as=require(_0x984d('0x15'));var hardwareService=require(_0x984d('0x16'));var logger=require(_0x984d('0x17'))(_0x984d('0x18'));var utils=require(_0x984d('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x984d('0x1a'));var db=require(_0x984d('0x1b'))['db'];config[_0x984d('0x1c')]=_['defaults'](config['redis'],{'host':_0x984d('0x1d'),'port':0x18eb});var socket=require(_0x984d('0x1e'))(new Redis(config[_0x984d('0x1c')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0xf6648f,_0x463d14){_0x463d14=_0x463d14||0xcc;return function(_0xd2c38d){if(_0xd2c38d){return _0xf6648f['sendStatus'](_0x463d14);}return _0xf6648f[_0x984d('0x1f')](_0x463d14)[_0x984d('0x20')]();};}function respondWithResult(_0x163df1,_0x361922){_0x361922=_0x361922||0xc8;return function(_0x4f421a){if(_0x4f421a){return _0x163df1[_0x984d('0x1f')](_0x361922)['json'](_0x4f421a);}};}function respondWithFilteredResult(_0x2f301b,_0x43d590){return function(_0x37360f){if(_0x37360f){var _0x4ac463=_0x37360f[_0x984d('0x21')],_0x4f8bbc=_0x43d590[_0x984d('0x22')],_0x5d1656=_0x43d590[_0x984d('0x22')]+_0x43d590[_0x984d('0x23')],_0x3f0047;if(_0x5d1656>=_0x4ac463){_0x5d1656=_0x4ac463;_0x3f0047=0xc8;}else{_0x3f0047=0xce;}_0x2f301b['status'](_0x3f0047);return _0x2f301b[_0x984d('0x24')](_0x984d('0x25'),_0x4f8bbc+'-'+_0x5d1656+'/'+_0x4ac463)[_0x984d('0x26')](_0x37360f);}return null;};}function patchUpdates(_0x44a65d){return function(_0x937ccb){try{jsonpatch['apply'](_0x937ccb,_0x44a65d,!![]);}catch(_0x43ce4c){return BPromise[_0x984d('0x27')](_0x43ce4c);}return _0x937ccb[_0x984d('0x28')]();};}function saveUpdates(_0x51f8e7,_0x4cffdc){return function(_0x14cdac){if(_0x14cdac){return _0x14cdac[_0x984d('0x29')](_0x51f8e7)['then'](function(_0x12f858){return _0x12f858;});}return null;};}function removeEntity(_0x40828c,_0x201463){return function(_0x341a6d){if(_0x341a6d){return _0x341a6d[_0x984d('0x2a')]()[_0x984d('0x2b')](function(){var _0x3aabf9=_0x341a6d['get']({'plain':!![]});var _0x25829d=[{'name':_0x984d('0x2c'),'value':'inbound','ignore':![]},{'name':_0x984d('0x2d'),'value':'outbound','ignore':![]}];var _0x586d02=_(_0x25829d)[_0x984d('0x2e')](_0x984d('0x2f'))['map'](_0x984d('0x30'))[_0x984d('0x30')]();if(_[_0x984d('0x31')](_0x586d02,_0x3aabf9[_0x984d('0x32')])){return;}var _0x4d72cc=_[_0x984d('0x33')](_0x25829d,[_0x984d('0x30'),_0x3aabf9[_0x984d('0x32')]])['name'];return db['UserProfileResource'][_0x984d('0x2a')]({'where':{'type':_0x4d72cc,'resourceId':_0x3aabf9['id']}})[_0x984d('0x2b')](function(){return _0x341a6d;});})[_0x984d('0x2b')](function(){_0x40828c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x211844,_0x2d8763){return function(_0x1385ee){if(!_0x1385ee){_0x211844['sendStatus'](0x194);}return _0x1385ee;};}function handleError(_0x53b6c4,_0x34a987){_0x34a987=_0x34a987||0x1f4;return function(_0xfe2568){logger['error'](_0xfe2568[_0x984d('0x34')]);if(_0xfe2568[_0x984d('0x35')]){delete _0xfe2568[_0x984d('0x35')];}_0x53b6c4[_0x984d('0x1f')](_0x34a987)['send'](_0xfe2568);};}exports[_0x984d('0x36')]=function(_0xbd7432,_0xc83298){var _0x35c995={},_0x6f31bb={},_0x2a5740={'count':0x0,'rows':[]};var _0x2d4570=_[_0x984d('0x37')](db[_0x984d('0x38')]['rawAttributes'],function(_0x4fc8c0){return{'name':_0x4fc8c0['fieldName'],'type':_0x4fc8c0['type'][_0x984d('0x39')]};});_0x6f31bb[_0x984d('0x3a')]=_[_0x984d('0x37')](_0x2d4570,'name');_0x6f31bb['query']=_['keys'](_0xbd7432[_0x984d('0x3b')]);_0x6f31bb[_0x984d('0x3c')]=_[_0x984d('0x3d')](_0x6f31bb[_0x984d('0x3a')],_0x6f31bb['query']);_0x35c995[_0x984d('0x3e')]=_[_0x984d('0x3d')](_0x6f31bb[_0x984d('0x3a')],qs[_0x984d('0x3f')](_0xbd7432[_0x984d('0x3b')][_0x984d('0x3f')]));_0x35c995[_0x984d('0x3e')]=_0x35c995['attributes'][_0x984d('0x40')]?_0x35c995[_0x984d('0x3e')]:_0x6f31bb['model'];if(!_0xbd7432[_0x984d('0x3b')][_0x984d('0x41')]('nolimit')){_0x35c995[_0x984d('0x23')]=qs[_0x984d('0x23')](_0xbd7432[_0x984d('0x3b')][_0x984d('0x23')]);_0x35c995['offset']=qs[_0x984d('0x22')](_0xbd7432[_0x984d('0x3b')][_0x984d('0x22')]);}_0x35c995[_0x984d('0x42')]=qs['sort'](_0xbd7432[_0x984d('0x3b')][_0x984d('0x43')]);_0x35c995[_0x984d('0x44')]=qs[_0x984d('0x3c')](_[_0x984d('0x45')](_0xbd7432[_0x984d('0x3b')],_0x6f31bb[_0x984d('0x3c')]),_0x2d4570);if(_0xbd7432['query']['filter']){_0x35c995[_0x984d('0x44')]=_[_0x984d('0x46')](_0x35c995[_0x984d('0x44')],{'$or':_[_0x984d('0x37')](_0x2d4570,function(_0x3b71c5){if(_0x3b71c5[_0x984d('0x32')]!==_0x984d('0x47')){var _0x4b332a={};_0x4b332a[_0x3b71c5[_0x984d('0x35')]]={'$like':'%'+_0xbd7432['query'][_0x984d('0x2e')]+'%'};return _0x4b332a;}})});}_0x35c995=_['merge']({},_0x35c995,_0xbd7432['options']);var _0x5d2981={'where':_0x35c995['where']};return db['VoiceQueue'][_0x984d('0x21')](_0x5d2981)['then'](function(_0x2772db){_0x2a5740[_0x984d('0x21')]=_0x2772db;if(_0xbd7432['query'][_0x984d('0x48')]){_0x35c995[_0x984d('0x49')]=[{'all':!![]}];}return db[_0x984d('0x38')]['findAll'](_0x35c995);})[_0x984d('0x2b')](function(_0x2ea669){_0x2a5740['rows']=_0x2ea669;return _0x2a5740;})[_0x984d('0x2b')](respondWithFilteredResult(_0xc83298,_0x35c995))[_0x984d('0x4a')](handleError(_0xc83298,null));};exports[_0x984d('0x4b')]=function(_0x414ef8,_0x90db75){var _0x471f12={'raw':![],'where':{'id':_0x414ef8[_0x984d('0x4c')]['id']}},_0x4d895b={};_0x4d895b[_0x984d('0x3a')]=_[_0x984d('0x4d')](db[_0x984d('0x38')][_0x984d('0x4e')]);_0x4d895b[_0x984d('0x3b')]=_[_0x984d('0x4d')](_0x414ef8[_0x984d('0x3b')]);_0x4d895b['filters']=_['intersection'](_0x4d895b[_0x984d('0x3a')],_0x4d895b[_0x984d('0x3b')]);_0x471f12[_0x984d('0x3e')]=_[_0x984d('0x3d')](_0x4d895b['model'],qs[_0x984d('0x3f')](_0x414ef8[_0x984d('0x3b')][_0x984d('0x3f')]));_0x471f12[_0x984d('0x3e')]=_0x471f12[_0x984d('0x3e')][_0x984d('0x40')]?_0x471f12[_0x984d('0x3e')]:_0x4d895b[_0x984d('0x3a')];if(_0x414ef8[_0x984d('0x3b')][_0x984d('0x48')]){_0x471f12['include']=[{'all':!![]}];}_0x471f12=_[_0x984d('0x46')]({},_0x471f12,_0x414ef8['options']);return db[_0x984d('0x38')][_0x984d('0x33')](_0x471f12)[_0x984d('0x2b')](handleEntityNotFound(_0x90db75,null))[_0x984d('0x2b')](respondWithResult(_0x90db75,null))['catch'](handleError(_0x90db75,null));};exports[_0x984d('0x4f')]=function(_0x38ae7c,_0x26be68){return db[_0x984d('0x38')]['create'](_0x38ae7c['body'],{})[_0x984d('0x2b')](function(_0x233849){var _0x5da4fd=_0x38ae7c[_0x984d('0x50')][_0x984d('0x51')]({'plain':!![]});if(!_0x5da4fd)throw new Error(_0x984d('0x52'));if(_0x5da4fd[_0x984d('0x53')]==='user'){var _0x587248=_0x233849[_0x984d('0x51')]({'plain':!![]});var _0x31ecc6=[{'name':_0x984d('0x2c'),'value':'inbound'},{'name':_0x984d('0x2d'),'value':_0x984d('0x54')}];var _0x305354=_[_0x984d('0x33')](_0x31ecc6,[_0x984d('0x30'),_0x587248[_0x984d('0x32')]])[_0x984d('0x35')];return db[_0x984d('0x55')][_0x984d('0x33')]({'where':{'name':_0x305354,'userProfileId':_0x5da4fd['userProfileId']},'raw':!![]})[_0x984d('0x2b')](function(_0x1bf9c2){if(_0x1bf9c2&&_0x1bf9c2[_0x984d('0x56')]===0x0){return db['UserProfileResource'][_0x984d('0x4f')]({'name':_0x587248[_0x984d('0x35')],'resourceId':_0x587248['id'],'type':_0x1bf9c2['name'],'sectionId':_0x1bf9c2['id']},{})[_0x984d('0x2b')](function(){return _0x233849;});}else{return _0x233849;}})['catch'](function(_0xc096fd){logger[_0x984d('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc096fd);throw _0xc096fd;});}return _0x233849;})[_0x984d('0x2b')](respondWithResult(_0x26be68,0xc9))[_0x984d('0x4a')](handleError(_0x26be68,null));};exports['clone']=function(_0x387fb5,_0x421f17){var _0x47dc6b={'where':{'id':_0x387fb5[_0x984d('0x4c')]['id']}},_0x2094b1={};_0x2094b1[_0x984d('0x3a')]=_[_0x984d('0x4d')](db[_0x984d('0x38')][_0x984d('0x4e')]);_0x47dc6b[_0x984d('0x3e')]=_[_0x984d('0x3d')](_0x2094b1[_0x984d('0x3a')],qs[_0x984d('0x3f')](_0x387fb5[_0x984d('0x3b')][_0x984d('0x3f')]));_0x47dc6b[_0x984d('0x3e')]=_0x47dc6b['attributes'][_0x984d('0x40')]?_0x47dc6b[_0x984d('0x3e')]:_0x2094b1[_0x984d('0x3a')];if(_0x387fb5[_0x984d('0x3b')][_0x984d('0x48')]){_0x47dc6b[_0x984d('0x49')]=[{'all':!![]}];}_0x47dc6b=_[_0x984d('0x46')]({},_0x47dc6b,_0x387fb5[_0x984d('0x58')]);return db[_0x984d('0x38')]['find'](_0x47dc6b)[_0x984d('0x2b')](handleEntityNotFound(_0x421f17,null))['then'](function(_0x4d31e4){if(_0x4d31e4){var _0x390023=_0x4d31e4[_0x984d('0x51')]({'plain':!![]});_0x390023=qs[_0x984d('0x59')](_0x390023,['id',_0x984d('0x5a'),_0x984d('0x5b')]);_0x387fb5['body']=_[_0x984d('0x59')](_0x387fb5[_0x984d('0x5c')],['id',_0x984d('0x5a'),_0x984d('0x5b')]);return db[_0x984d('0x38')]['create'](_[_0x984d('0x46')](_0x390023,_0x387fb5[_0x984d('0x5c')]),{'include':_0x387fb5[_0x984d('0x3b')][_0x984d('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x4e22ff){var _0x433786=_0x387fb5[_0x984d('0x50')]['get']({'plain':!![]});if(!_0x433786)throw new Error(_0x984d('0x52'));if(_0x433786[_0x984d('0x53')]==='user'){var _0x282e7a=_0x4e22ff[_0x984d('0x51')]({'plain':!![]});var _0x162f45=[{'name':_0x984d('0x2c'),'value':_0x984d('0x5d')},{'name':'QueueCampaigns','value':_0x984d('0x54')}];var _0xf4bca1=_[_0x984d('0x33')](_0x162f45,['value',_0x282e7a[_0x984d('0x32')]])[_0x984d('0x35')];return db[_0x984d('0x55')][_0x984d('0x33')]({'where':{'name':_0xf4bca1,'userProfileId':_0x433786[_0x984d('0x5e')]},'raw':!![]})[_0x984d('0x2b')](function(_0x4af21a){if(_0x4af21a&&_0x4af21a['autoAssociation']===0x0){return db[_0x984d('0x5f')][_0x984d('0x4f')]({'name':_0x282e7a['name'],'resourceId':_0x282e7a['id'],'type':_0x4af21a[_0x984d('0x35')],'sectionId':_0x4af21a['id']},{})['then'](function(){return _0x4e22ff;});}else{return _0x4e22ff;}})[_0x984d('0x4a')](function(_0xdfb03b){logger[_0x984d('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdfb03b);throw _0xdfb03b;});}return _0x4e22ff;});}})[_0x984d('0x2b')](respondWithResult(_0x421f17,0xc9))[_0x984d('0x4a')](handleError(_0x421f17,null));};exports[_0x984d('0x29')]=function(_0x5997f5,_0x217fa7){if(_0x5997f5['body']['id']){delete _0x5997f5['body']['id'];}return db[_0x984d('0x38')][_0x984d('0x33')]({'where':{'id':_0x5997f5[_0x984d('0x4c')]['id']}})[_0x984d('0x2b')](handleEntityNotFound(_0x217fa7,null))['then'](saveUpdates(_0x5997f5[_0x984d('0x5c')],null))[_0x984d('0x2b')](respondWithResult(_0x217fa7,null))[_0x984d('0x4a')](handleError(_0x217fa7,null));};exports[_0x984d('0x2a')]=function(_0x5f4196,_0x41aff4){return db[_0x984d('0x38')]['find']({'where':{'id':_0x5f4196[_0x984d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x41aff4,null))['then'](removeEntity(_0x41aff4,null))[_0x984d('0x4a')](handleError(_0x41aff4,null));};exports[_0x984d('0x60')]=function(_0xd1853b,_0xae0815,_0x3713c1){var _0x3a2f74={'raw':![],'where':{}};var _0x5f11e9={};var _0x180dc0={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0xd1853b[_0x984d('0x4c')]['id']}})['then'](handleEntityNotFound(_0xae0815,null))[_0x984d('0x2b')](function(_0x4943f3){if(_0x4943f3){_0x5f11e9[_0x984d('0x3a')]=_[_0x984d('0x4d')](db[_0x984d('0x61')][_0x984d('0x4e')]);_0x5f11e9[_0x984d('0x3b')]=_[_0x984d('0x4d')](_0xd1853b[_0x984d('0x3b')]);_0x5f11e9['filters']=_['intersection'](_0x5f11e9[_0x984d('0x3a')],_0x5f11e9['query']);_0x3a2f74[_0x984d('0x3e')]=_[_0x984d('0x3d')](_0x5f11e9[_0x984d('0x3a')],qs[_0x984d('0x3f')](_0xd1853b[_0x984d('0x3b')][_0x984d('0x3f')]));_0x3a2f74[_0x984d('0x3e')]=_0x3a2f74[_0x984d('0x3e')][_0x984d('0x40')]?_0x3a2f74[_0x984d('0x3e')]:_0x5f11e9[_0x984d('0x3a')];if(!_0xd1853b[_0x984d('0x3b')][_0x984d('0x41')](_0x984d('0x62'))){_0x3a2f74[_0x984d('0x23')]=qs[_0x984d('0x23')](_0xd1853b[_0x984d('0x3b')][_0x984d('0x23')]);_0x3a2f74[_0x984d('0x22')]=qs[_0x984d('0x22')](_0xd1853b[_0x984d('0x3b')]['offset']);}_0x3a2f74[_0x984d('0x42')]=qs[_0x984d('0x43')](_0xd1853b[_0x984d('0x3b')][_0x984d('0x43')]);_0x3a2f74['where']=qs[_0x984d('0x3c')](_[_0x984d('0x45')](_0xd1853b[_0x984d('0x3b')],_0x5f11e9[_0x984d('0x3c')]));_0x3a2f74[_0x984d('0x44')][_0x984d('0x63')]=_0x4943f3['id'];if(_0xd1853b['query']['filter']){_0x3a2f74[_0x984d('0x44')]=_[_0x984d('0x46')](_0x3a2f74['where'],{'$or':_[_0x984d('0x37')](_0x3a2f74['attributes'],function(_0x57a515){var _0x535eb8={};_0x535eb8[_0x57a515]={'$like':'%'+_0xd1853b[_0x984d('0x3b')][_0x984d('0x2e')]+'%'};return _0x535eb8;})});}_0x3a2f74=_[_0x984d('0x46')]({},_0x3a2f74,_0xd1853b[_0x984d('0x58')]);return db[_0x984d('0x61')][_0x984d('0x21')]({'where':_0x3a2f74[_0x984d('0x44')]})[_0x984d('0x2b')](function(_0x3f0ce7){_0x180dc0[_0x984d('0x21')]=_0x3f0ce7;if(_0xd1853b['query'][_0x984d('0x48')]){_0x3a2f74[_0x984d('0x49')]=[{'all':!![]}];}return db['CmHopper'][_0x984d('0x64')](_0x3a2f74);})[_0x984d('0x2b')](function(_0x176ad2){_0x180dc0['rows']=_0x176ad2;return _0x180dc0;});}})[_0x984d('0x2b')](respondWithFilteredResult(_0xae0815,_0x3a2f74))[_0x984d('0x4a')](handleError(_0xae0815,null));};exports['getHopperHistories']=function(_0x35c670,_0x2ca3ee,_0x5dd0fa){var _0x36430a={'raw':!![],'where':{}};var _0x49ae33={};var _0x253cbc={'count':0x0,'rows':[]};return db[_0x984d('0x38')][_0x984d('0x65')]({'where':{'id':_0x35c670[_0x984d('0x4c')]['id']}})[_0x984d('0x2b')](handleEntityNotFound(_0x2ca3ee,null))['then'](function(_0x2d9f45){if(_0x2d9f45){_0x49ae33['model']=_[_0x984d('0x4d')](db[_0x984d('0x66')][_0x984d('0x4e')]);_0x49ae33[_0x984d('0x3b')]=_['keys'](_0x35c670['query']);_0x49ae33[_0x984d('0x3c')]=_[_0x984d('0x3d')](_0x49ae33['model'],_0x49ae33[_0x984d('0x3b')]);_0x36430a['attributes']=_['intersection'](_0x49ae33[_0x984d('0x3a')],qs[_0x984d('0x3f')](_0x35c670[_0x984d('0x3b')][_0x984d('0x3f')]));_0x36430a['attributes']=_0x36430a['attributes']['length']?_0x36430a[_0x984d('0x3e')]:_0x49ae33[_0x984d('0x3a')];if(!_0x35c670[_0x984d('0x3b')][_0x984d('0x41')](_0x984d('0x62'))){_0x36430a[_0x984d('0x23')]=qs[_0x984d('0x23')](_0x35c670['query'][_0x984d('0x23')]);_0x36430a['offset']=qs[_0x984d('0x22')](_0x35c670[_0x984d('0x3b')]['offset']);}_0x36430a[_0x984d('0x42')]=qs[_0x984d('0x43')](_0x35c670[_0x984d('0x3b')][_0x984d('0x43')]);_0x36430a['where']=qs[_0x984d('0x3c')](_[_0x984d('0x45')](_0x35c670[_0x984d('0x3b')],_0x49ae33[_0x984d('0x3c')]));_0x36430a['where'][_0x984d('0x63')]=_0x2d9f45['id'];if(_0x35c670[_0x984d('0x3b')]['filter']){_0x36430a[_0x984d('0x44')]=_[_0x984d('0x46')](_0x36430a[_0x984d('0x44')],{'$or':_['map'](_0x36430a['attributes'],function(_0xb42c03){var _0x4da5ff={};_0x4da5ff[_0xb42c03]={'$like':'%'+_0x35c670[_0x984d('0x3b')][_0x984d('0x2e')]+'%'};return _0x4da5ff;})});}_0x36430a=_[_0x984d('0x46')]({},_0x36430a,_0x35c670['options']);return db['CmHopperHistory'][_0x984d('0x21')]({'where':_0x36430a[_0x984d('0x44')]})[_0x984d('0x2b')](function(_0x1f8bb2){_0x253cbc[_0x984d('0x21')]=_0x1f8bb2;if(_0x35c670[_0x984d('0x3b')][_0x984d('0x48')]){_0x36430a[_0x984d('0x49')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x36430a);})[_0x984d('0x2b')](function(_0x4550c9){_0x253cbc['rows']=_0x4550c9;return _0x253cbc;});}})['then'](respondWithFilteredResult(_0x2ca3ee,_0x36430a))[_0x984d('0x4a')](handleError(_0x2ca3ee,null));};exports[_0x984d('0x67')]=function(_0x10939b,_0x4c0618,_0x4e09c9){var _0x2d6edb={'raw':!![],'where':{}};var _0x22ea46={};var _0x1734ad={'count':0x0,'rows':[]};return db[_0x984d('0x38')][_0x984d('0x65')]({'where':{'id':_0x10939b[_0x984d('0x4c')]['id']}})[_0x984d('0x2b')](handleEntityNotFound(_0x4c0618,null))[_0x984d('0x2b')](function(_0x3449e1){if(_0x3449e1){_0x22ea46['model']=_[_0x984d('0x4d')](db[_0x984d('0x68')][_0x984d('0x4e')]);_0x22ea46[_0x984d('0x3b')]=_[_0x984d('0x4d')](_0x10939b['query']);_0x22ea46[_0x984d('0x3c')]=_[_0x984d('0x3d')](_0x22ea46[_0x984d('0x3a')],_0x22ea46[_0x984d('0x3b')]);_0x2d6edb[_0x984d('0x3e')]=_[_0x984d('0x3d')](_0x22ea46[_0x984d('0x3a')],qs['fields'](_0x10939b[_0x984d('0x3b')][_0x984d('0x3f')]));_0x2d6edb[_0x984d('0x3e')]=_0x2d6edb[_0x984d('0x3e')][_0x984d('0x40')]?_0x2d6edb[_0x984d('0x3e')]:_0x22ea46[_0x984d('0x3a')];if(!_0x10939b[_0x984d('0x3b')][_0x984d('0x41')](_0x984d('0x62'))){_0x2d6edb[_0x984d('0x23')]=qs['limit'](_0x10939b[_0x984d('0x3b')]['limit']);_0x2d6edb[_0x984d('0x22')]=qs['offset'](_0x10939b[_0x984d('0x3b')][_0x984d('0x22')]);}_0x2d6edb[_0x984d('0x42')]=qs[_0x984d('0x43')](_0x10939b[_0x984d('0x3b')]['sort']);_0x2d6edb[_0x984d('0x44')]=qs['filters'](_[_0x984d('0x45')](_0x10939b[_0x984d('0x3b')],_0x22ea46[_0x984d('0x3c')]));_0x2d6edb[_0x984d('0x44')]['VoiceQueueId']=_0x3449e1['id'];if(_0x10939b['query'][_0x984d('0x2e')]){_0x2d6edb[_0x984d('0x44')]=_['merge'](_0x2d6edb[_0x984d('0x44')],{'$or':_[_0x984d('0x37')](_0x2d6edb[_0x984d('0x3e')],function(_0x489e08){var _0x58abd8={};_0x58abd8[_0x489e08]={'$like':'%'+_0x10939b[_0x984d('0x3b')][_0x984d('0x2e')]+'%'};return _0x58abd8;})});}_0x2d6edb=_[_0x984d('0x46')]({},_0x2d6edb,_0x10939b['options']);return db[_0x984d('0x68')][_0x984d('0x21')]({'where':_0x2d6edb[_0x984d('0x44')]})[_0x984d('0x2b')](function(_0x2dc30c){_0x1734ad['count']=_0x2dc30c;if(_0x10939b['query'][_0x984d('0x48')]){_0x2d6edb[_0x984d('0x49')]=[{'all':!![]}];}return db[_0x984d('0x68')][_0x984d('0x64')](_0x2d6edb);})[_0x984d('0x2b')](function(_0xb7c54e){_0x1734ad[_0x984d('0x69')]=_0xb7c54e;return _0x1734ad;});}})[_0x984d('0x2b')](respondWithFilteredResult(_0x4c0618,_0x2d6edb))[_0x984d('0x4a')](handleError(_0x4c0618,null));};exports[_0x984d('0x6a')]=function(_0x7ff2fa,_0x5bc4f9,_0x2b2b){var _0x3fd26b={'raw':!![],'where':{}};var _0x4f5afd={};var _0x142fdc={'count':0x0,'rows':[]};return db[_0x984d('0x38')][_0x984d('0x65')]({'where':{'id':_0x7ff2fa[_0x984d('0x4c')]['id']}})[_0x984d('0x2b')](handleEntityNotFound(_0x5bc4f9,null))['then'](function(_0x346699){if(_0x346699){_0x4f5afd[_0x984d('0x3a')]=_['keys'](db[_0x984d('0x6b')][_0x984d('0x4e')]);_0x4f5afd[_0x984d('0x3b')]=_[_0x984d('0x4d')](_0x7ff2fa[_0x984d('0x3b')]);_0x4f5afd[_0x984d('0x3c')]=_[_0x984d('0x3d')](_0x4f5afd[_0x984d('0x3a')],_0x4f5afd[_0x984d('0x3b')]);_0x3fd26b[_0x984d('0x3e')]=_[_0x984d('0x3d')](_0x4f5afd[_0x984d('0x3a')],qs[_0x984d('0x3f')](_0x7ff2fa[_0x984d('0x3b')][_0x984d('0x3f')]));_0x3fd26b['attributes']=_0x3fd26b[_0x984d('0x3e')][_0x984d('0x40')]?_0x3fd26b[_0x984d('0x3e')]:_0x4f5afd[_0x984d('0x3a')];if(!_0x7ff2fa[_0x984d('0x3b')][_0x984d('0x41')](_0x984d('0x62'))){_0x3fd26b['limit']=qs[_0x984d('0x23')](_0x7ff2fa[_0x984d('0x3b')][_0x984d('0x23')]);_0x3fd26b['offset']=qs[_0x984d('0x22')](_0x7ff2fa[_0x984d('0x3b')][_0x984d('0x22')]);}_0x3fd26b[_0x984d('0x42')]=qs[_0x984d('0x43')](_0x7ff2fa[_0x984d('0x3b')][_0x984d('0x43')]);_0x3fd26b[_0x984d('0x44')]=qs[_0x984d('0x3c')](_[_0x984d('0x45')](_0x7ff2fa[_0x984d('0x3b')],_0x4f5afd[_0x984d('0x3c')]));_0x3fd26b[_0x984d('0x44')][_0x984d('0x63')]=_0x346699['id'];if(_0x7ff2fa[_0x984d('0x3b')][_0x984d('0x2e')]){_0x3fd26b[_0x984d('0x44')]=_[_0x984d('0x46')](_0x3fd26b[_0x984d('0x44')],{'$or':_[_0x984d('0x37')](_0x3fd26b[_0x984d('0x3e')],function(_0x4954cb){var _0x25c091={};_0x25c091[_0x4954cb]={'$like':'%'+_0x7ff2fa[_0x984d('0x3b')]['filter']+'%'};return _0x25c091;})});}_0x3fd26b=_[_0x984d('0x46')]({},_0x3fd26b,_0x7ff2fa['options']);return db['CmHopperBlack'][_0x984d('0x21')]({'where':_0x3fd26b[_0x984d('0x44')]})[_0x984d('0x2b')](function(_0x34ea5f){_0x142fdc[_0x984d('0x21')]=_0x34ea5f;if(_0x7ff2fa['query'][_0x984d('0x48')]){_0x3fd26b[_0x984d('0x49')]=[{'all':!![]}];}return db[_0x984d('0x6b')][_0x984d('0x64')](_0x3fd26b);})['then'](function(_0x1c6ecf){_0x142fdc[_0x984d('0x69')]=_0x1c6ecf;return _0x142fdc;});}})['then'](respondWithFilteredResult(_0x5bc4f9,_0x3fd26b))[_0x984d('0x4a')](handleError(_0x5bc4f9,null));};exports[_0x984d('0x6c')]=function(_0x48f962,_0x1f908e,_0x37829e){var _0x30f36f={};var _0x264cc4={};var _0x2ffa9c;var _0x2ddf77;return db['VoiceQueue']['findOne']({'where':{'id':_0x48f962[_0x984d('0x4c')]['id']}})[_0x984d('0x2b')](handleEntityNotFound(_0x1f908e,null))[_0x984d('0x2b')](function(_0x42ce3f){if(_0x42ce3f){_0x2ffa9c=_0x42ce3f;_0x264cc4[_0x984d('0x3a')]=_[_0x984d('0x4d')](db[_0x984d('0x6d')]['rawAttributes']);_0x264cc4[_0x984d('0x3b')]=_['keys'](_0x48f962['query']);_0x264cc4[_0x984d('0x3c')]=_[_0x984d('0x3d')](_0x264cc4[_0x984d('0x3a')],_0x264cc4['query']);_0x30f36f[_0x984d('0x3e')]=_['intersection'](_0x264cc4[_0x984d('0x3a')],qs[_0x984d('0x3f')](_0x48f962[_0x984d('0x3b')][_0x984d('0x3f')]));_0x30f36f[_0x984d('0x3e')]=_0x30f36f[_0x984d('0x3e')]['length']?_0x30f36f['attributes']:_0x264cc4['model'];_0x30f36f[_0x984d('0x42')]=qs['sort'](_0x48f962[_0x984d('0x3b')][_0x984d('0x43')]);_0x30f36f[_0x984d('0x44')]=qs[_0x984d('0x3c')](_[_0x984d('0x45')](_0x48f962[_0x984d('0x3b')],_0x264cc4['filters']));if(_0x48f962[_0x984d('0x3b')]['filter']){_0x30f36f[_0x984d('0x44')]=_[_0x984d('0x46')](_0x30f36f[_0x984d('0x44')],{'$or':_['map'](_0x30f36f[_0x984d('0x3e')],function(_0xd9e92d){var _0x50cf51={};_0x50cf51[_0xd9e92d]={'$like':'%'+_0x48f962['query'][_0x984d('0x2e')]+'%'};return _0x50cf51;})});}_0x30f36f=_[_0x984d('0x46')]({},_0x30f36f,_0x48f962[_0x984d('0x58')]);return _0x2ffa9c['getTeams'](_0x30f36f);}})['then'](function(_0x16fe38){if(_0x16fe38){_0x2ddf77=_0x16fe38[_0x984d('0x40')];if(!_0x48f962[_0x984d('0x3b')][_0x984d('0x41')](_0x984d('0x62'))){_0x30f36f[_0x984d('0x23')]=qs[_0x984d('0x23')](_0x48f962['query']['limit']);_0x30f36f[_0x984d('0x22')]=qs[_0x984d('0x22')](_0x48f962[_0x984d('0x3b')][_0x984d('0x22')]);}return _0x2ffa9c[_0x984d('0x6c')](_0x30f36f);}})[_0x984d('0x2b')](function(_0x32bb1a){if(_0x32bb1a){return _0x32bb1a?{'count':_0x2ddf77,'rows':_0x32bb1a}:null;}})[_0x984d('0x2b')](respondWithResult(_0x1f908e,null))[_0x984d('0x4a')](handleError(_0x1f908e,null));};exports['addTeams']=function(_0xc5b22c,_0x2d3b27,_0x22251a){var _0x5783e4=_0xc5b22c['body'][_0x984d('0x6e')];var _0x5d319c=_[_0x984d('0x37')](_0x5783e4,'id');return db['Team']['findAll']({'where':{'id':_0x5d319c},'attributes':['id'],'include':[{'model':db[_0x984d('0x6f')],'as':_0x984d('0x70'),'attributes':['id',_0x984d('0x35'),_0x984d('0x71'),'voicePause','interface'],'raw':!![]}]})[_0x984d('0x2b')](function(_0x510f09){if(_0x510f09){var _0x395e4d=_[_0x984d('0x72')](_0x510f09,function(_0x51f559){var _0x2b9707=_0x51f559[_0x984d('0x51')]({'plain':!![]});_0x2b9707[_0x984d('0x70')]['forEach'](function(_0x1c0321){_0x1c0321['penalty']=_[_0x984d('0x33')](_0x5783e4,{'id':_0x2b9707['id']})['penalty'];});return _0x2b9707['Agents'];});return db[_0x984d('0x38')][_0x984d('0x33')]({'where':{'id':_0xc5b22c[_0x984d('0x4c')]['id']}})[_0x984d('0x2b')](function(_0x4f7a48){return db['sequelize'][_0x984d('0x73')](function(_0x39de9a){return _0x4f7a48['addTeams'](_0x5d319c,{'transaction':_0x39de9a})['then'](function(){return BPromise[_0x984d('0x74')](_0x5783e4,function(_0x3de4a9){return db[_0x984d('0x75')]['upsert']({'TeamId':_0x3de4a9['id'],'VoiceQueueId':_0xc5b22c[_0x984d('0x4c')]['id'],'penalty':_0x3de4a9[_0x984d('0x76')]},{'transaction':_0x39de9a});});})[_0x984d('0x2b')](function(){return BPromise[_0x984d('0x74')](_0x395e4d,function(_0x4c4a04){return db[_0x984d('0x77')][_0x984d('0x78')]({'where':{'UserId':_0x4c4a04['id'],'VoiceQueueId':_0xc5b22c[_0x984d('0x4c')]['id']},'defaults':{'penalty':_0x4c4a04[_0x984d('0x76')]},'transaction':_0x39de9a});});})[_0x984d('0x2b')](function(){return BPromise[_0x984d('0x74')](_[_0x984d('0x2e')](_0x395e4d,{'online':!![]}),function(_0xa503e4){return db['UserVoiceQueueRt'][_0x984d('0x79')]({'membername':_0xa503e4[_0x984d('0x35')],'UserId':_0xa503e4['id'],'queue_name':_0x4f7a48[_0x984d('0x35')],'VoiceQueueId':_0x4f7a48['id'],'interface':_[_0x984d('0x7a')](_0xa503e4['interface'])?util[_0x984d('0x7b')]('SIP/%s',_0xa503e4['name']):_0xa503e4[_0x984d('0x7c')],'paused':_0xa503e4['voicePause']||![],'penalty':_0xa503e4[_0x984d('0x76')]},{'transaction':_0x39de9a});});})[_0x984d('0x2b')](function(){_0x395e4d['forEach'](function(_0x10798a){socket[_0x984d('0x7d')]('userVoiceQueue:save',{'UserId':_0x10798a['id'],'VoiceQueueId':_0x4f7a48['id']});});});});});}})[_0x984d('0x2b')](respondWithStatusCode(_0x2d3b27,null))[_0x984d('0x4a')](handleError(_0x2d3b27,null));};exports[_0x984d('0x7e')]=function(_0x2235f1,_0x159297,_0x41855c){return db[_0x984d('0x6d')][_0x984d('0x64')]({'where':{'id':_0x2235f1[_0x984d('0x3b')][_0x984d('0x7f')]},'attributes':['id'],'include':[{'model':db[_0x984d('0x6f')],'as':_0x984d('0x70'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x159297,null))['then'](function(_0x4dc6dc){var _0x42ff11=_[_0x984d('0x37')](_0x4dc6dc,'id');var _0x497095=[];var _0x22c34a=[];var _0x20dda3=squel['select']();_0x20dda3[_0x984d('0x80')](_0x984d('0x81'))[_0x984d('0x82')](_0x984d('0x83'),'tq')['join'](_0x984d('0x84'),'ut',_0x984d('0x85'))[_0x984d('0x44')]('VoiceQueueId\x20=\x20?',_0x2235f1[_0x984d('0x4c')]['id']);for(var _0x5970a4=0x0;_0x5970a4<_0x4dc6dc[_0x984d('0x40')];_0x5970a4+=0x1){let _0x38d882=_0x4dc6dc[_0x5970a4];for(var _0xfe8720=0x0;_0xfe8720<_0x38d882[_0x984d('0x70')][_0x984d('0x40')];_0xfe8720+=0x1){let _0x1a86a2=_0x38d882[_0x984d('0x70')][_0xfe8720];var _0x51bf27=_0x20dda3['clone']();_0x51bf27[_0x984d('0x44')](_0x984d('0x86'),_0x1a86a2['id']);_0x22c34a[_0x984d('0x87')](db['sequelize'][_0x984d('0x3b')](_0x51bf27[_0x984d('0x88')](),{'type':db['sequelize'][_0x984d('0x89')][_0x984d('0x8a')]})[_0x984d('0x2b')](function(_0x24202a){if(_0x24202a[_0x984d('0x40')]===0x1){return _0x1a86a2['id'];}else{var _0x3a6644=_[_0x984d('0x8b')](_[_0x984d('0x37')](_0x24202a,_0x984d('0x8c')),function(_0x4ef4ce){return _[_0x984d('0x31')](_0x42ff11,_0x4ef4ce);});if(_0x3a6644){return _0x1a86a2['id'];}}}));}}return BPromise[_0x984d('0x8d')](_0x22c34a)['then'](function(_0x45d7a1){_0x497095=_(_0x497095)[_0x984d('0x8e')](_0x45d7a1)[_0x984d('0x8f')]()[_0x984d('0x30')]();return db[_0x984d('0x38')][_0x984d('0x33')]({'where':{'id':_0x2235f1[_0x984d('0x4c')]['id']}})['then'](function(_0xdffad7){return db[_0x984d('0x90')]['transaction'](function(_0x43925d){return _0xdffad7[_0x984d('0x7e')](_0x2235f1['query'][_0x984d('0x7f')],{'transaction':_0x43925d})['then'](function(){if(!_[_0x984d('0x91')](_0x497095)){return _0xdffad7[_0x984d('0x92')](_0x497095,{'transaction':_0x43925d})[_0x984d('0x2b')](function(){return db['UserVoiceQueueRt'][_0x984d('0x2a')]({'where':{'VoiceQueueId':_0x2235f1[_0x984d('0x4c')]['id'],'UserId':_0x497095},'transaction':_0x43925d});});}})['then'](function(){_0x497095[_0x984d('0x93')](function(_0x467dc8){socket[_0x984d('0x7d')](_0x984d('0x94'),{'UserId':_0x467dc8,'VoiceQueueId':_0xdffad7['id']});});});});});});})[_0x984d('0x2b')](respondWithStatusCode(_0x159297,null))[_0x984d('0x4a')](handleError(_0x159297,null));};exports['addAgents']=function(_0x4fedf3,_0x384bb0,_0x1db9a0){var _0x4cbc8f,_0x54aa73;return db[_0x984d('0x38')][_0x984d('0x33')]({'where':{'id':_0x4fedf3['params']['id']}})[_0x984d('0x2b')](handleEntityNotFound(_0x384bb0,null))['then'](function(_0x3b422f){if(_0x3b422f){_0x54aa73=_0x3b422f;return _0x3b422f[_0x984d('0x95')](_0x4fedf3[_0x984d('0x5c')]['ids'],_[_0x984d('0x59')](_0x4fedf3[_0x984d('0x5c')],[_0x984d('0x7f'),'id'])||{})[_0x984d('0x96')](function(_0xb4c9fe){for(var _0x1ed803=0x0;_0x1ed803<_0x4fedf3[_0x984d('0x5c')][_0x984d('0x7f')][_0x984d('0x40')];_0x1ed803+=0x1){socket['emit'](_0x984d('0x97'),{'UserId':_0x4fedf3[_0x984d('0x5c')]['ids'][_0x1ed803],'VoiceQueueId':_0x4fedf3['params']['id']});}return _0xb4c9fe;});}})[_0x984d('0x2b')](function(_0x5e2e5b){_0x4cbc8f=_0x5e2e5b||[];if(_0x54aa73){return db[_0x984d('0x6f')]['findAll']({'where':{'id':_0x4fedf3[_0x984d('0x5c')][_0x984d('0x7f')]},'attributes':['id',_0x984d('0x35'),_0x984d('0x71'),_0x984d('0x98'),_0x984d('0x7c')],'raw':!![]});}})[_0x984d('0x2b')](function(_0x2044e8){if(!_[_0x984d('0x91')](_0x2044e8)){var _0xc7208e=[];for(var _0x163e03=0x0;_0x163e03<_0x2044e8[_0x984d('0x40')];_0x163e03++){if(_0x2044e8[_0x163e03][_0x984d('0x71')]){_0xc7208e['push'](db['UserVoiceQueueRt'][_0x984d('0x79')]({'membername':_0x2044e8[_0x163e03][_0x984d('0x35')],'UserId':_0x2044e8[_0x163e03]['id'],'queue_name':_0x54aa73[_0x984d('0x35')],'VoiceQueueId':_0x54aa73['id'],'interface':_[_0x984d('0x7a')](_0x2044e8[_0x163e03][_0x984d('0x7c')])?util['format'](_0x984d('0x99'),_0x2044e8[_0x163e03][_0x984d('0x35')]):_0x2044e8[_0x163e03][_0x984d('0x7c')],'paused':_0x2044e8[_0x163e03][_0x984d('0x98')]||![],'penalty':_0x4fedf3['body']['penalty']||0x0}));}}return BPromise[_0x984d('0x8d')](_0xc7208e);}})[_0x984d('0x2b')](function(){return _0x4cbc8f;})[_0x984d('0x2b')](respondWithResult(_0x384bb0,null))[_0x984d('0x4a')](handleError(_0x384bb0,null));};exports[_0x984d('0x92')]=function(_0x889dd2,_0x4ba248,_0x6544c3){return db['VoiceQueue']['find']({'where':{'id':_0x889dd2[_0x984d('0x4c')]['id']}})[_0x984d('0x2b')](handleEntityNotFound(_0x4ba248,null))['then'](function(_0x2ce147){if(_0x2ce147){return _0x2ce147[_0x984d('0x92')](_0x889dd2[_0x984d('0x3b')][_0x984d('0x7f')])[_0x984d('0x2b')](function(){if(_[_0x984d('0x9a')](_0x889dd2['query'][_0x984d('0x7f')])){for(var _0x2cbcc7=0x0;_0x2cbcc7<_0x889dd2[_0x984d('0x3b')][_0x984d('0x7f')]['length'];_0x2cbcc7+=0x1){socket[_0x984d('0x7d')](_0x984d('0x94'),{'UserId':Number(_0x889dd2[_0x984d('0x3b')][_0x984d('0x7f')][_0x2cbcc7]),'VoiceQueueId':Number(_0x889dd2['params']['id'])});}}else{socket[_0x984d('0x7d')]('userVoiceQueue:remove',{'UserId':Number(_0x889dd2[_0x984d('0x3b')][_0x984d('0x7f')]),'VoiceQueueId':Number(_0x889dd2[_0x984d('0x4c')]['id'])});}});}})[_0x984d('0x2b')](function(_0xe54ede){return db[_0x984d('0x9b')][_0x984d('0x2a')]({'where':{'VoiceQueueId':_0x889dd2[_0x984d('0x4c')]['id'],'UserId':_0x889dd2[_0x984d('0x3b')][_0x984d('0x7f')]}})[_0x984d('0x2b')](function(){return _0xe54ede;});})[_0x984d('0x2b')](respondWithStatusCode(_0x4ba248,null))[_0x984d('0x4a')](handleError(_0x4ba248,null));};exports[_0x984d('0x9c')]=function(_0x5211d1,_0x75709a,_0x4a5aae){var _0x22b5d6={};var _0x17811f={};var _0x32bd2e;var _0x563a33;return db[_0x984d('0x38')][_0x984d('0x65')]({'where':{'id':_0x5211d1[_0x984d('0x4c')]['id']}})[_0x984d('0x2b')](handleEntityNotFound(_0x75709a,null))[_0x984d('0x2b')](function(_0x3ffe42){if(_0x3ffe42){_0x32bd2e=_0x3ffe42;_0x17811f[_0x984d('0x3a')]=_[_0x984d('0x4d')](db[_0x984d('0x6f')][_0x984d('0x4e')]);_0x17811f[_0x984d('0x3b')]=_[_0x984d('0x4d')](_0x5211d1['query']);_0x17811f[_0x984d('0x3c')]=_[_0x984d('0x3d')](_0x17811f['model'],_0x17811f[_0x984d('0x3b')]);_0x22b5d6[_0x984d('0x3e')]=_[_0x984d('0x3d')](_0x17811f['model'],qs[_0x984d('0x3f')](_0x5211d1[_0x984d('0x3b')][_0x984d('0x3f')]));_0x22b5d6['attributes']=_0x22b5d6['attributes']['length']?_0x22b5d6['attributes']:_0x17811f[_0x984d('0x3a')];_0x22b5d6['order']=qs[_0x984d('0x43')](_0x5211d1[_0x984d('0x3b')][_0x984d('0x43')]);_0x22b5d6[_0x984d('0x44')]=qs['filters'](_[_0x984d('0x45')](_0x5211d1[_0x984d('0x3b')],_0x17811f[_0x984d('0x3c')]));if(_0x5211d1['query'][_0x984d('0x2e')]){_0x22b5d6[_0x984d('0x44')]=_[_0x984d('0x46')](_0x22b5d6['where'],{'$or':_['map'](_0x22b5d6['attributes'],function(_0x1df1a7){var _0x3abf63={};_0x3abf63[_0x1df1a7]={'$like':'%'+_0x5211d1['query'][_0x984d('0x2e')]+'%'};return _0x3abf63;})});}_0x22b5d6=_[_0x984d('0x46')]({},_0x22b5d6,_0x5211d1[_0x984d('0x58')]);return _0x32bd2e[_0x984d('0x9c')](_0x22b5d6);}})[_0x984d('0x2b')](function(_0x43eb41){if(_0x43eb41){_0x563a33=_0x43eb41['length'];if(!_0x5211d1['query'][_0x984d('0x41')](_0x984d('0x62'))){_0x22b5d6[_0x984d('0x23')]=qs[_0x984d('0x23')](_0x5211d1[_0x984d('0x3b')][_0x984d('0x23')]);_0x22b5d6[_0x984d('0x22')]=qs[_0x984d('0x22')](_0x5211d1['query'][_0x984d('0x22')]);}return _0x32bd2e[_0x984d('0x9c')](_0x22b5d6);}})[_0x984d('0x2b')](function(_0x22d036){if(_0x22d036){return _0x22d036?{'count':_0x563a33,'rows':_0x22d036}:null;}})[_0x984d('0x2b')](respondWithResult(_0x75709a,null))[_0x984d('0x4a')](handleError(_0x75709a,null));};exports[_0x984d('0x9d')]=function(_0x1deac4,_0x57c232,_0x3813dd){var _0xe3ca5e={};var _0x1425e1={};var _0x505bd7;var _0x26abac;return db[_0x984d('0x38')][_0x984d('0x65')]({'where':{'id':_0x1deac4['params']['id']}})[_0x984d('0x2b')](handleEntityNotFound(_0x57c232,null))['then'](function(_0x376596){if(_0x376596){_0x505bd7=_0x376596;_0x1425e1[_0x984d('0x3a')]=_['keys'](db[_0x984d('0x9b')][_0x984d('0x4e')]);_0x1425e1[_0x984d('0x3b')]=_[_0x984d('0x4d')](_0x1deac4[_0x984d('0x3b')]);_0x1425e1[_0x984d('0x3c')]=_[_0x984d('0x3d')](_0x1425e1[_0x984d('0x3a')],_0x1425e1[_0x984d('0x3b')]);_0xe3ca5e['attributes']=_[_0x984d('0x3d')](_0x1425e1['model'],qs['fields'](_0x1deac4[_0x984d('0x3b')][_0x984d('0x3f')]));_0xe3ca5e['attributes']=_0xe3ca5e[_0x984d('0x3e')][_0x984d('0x40')]?_0xe3ca5e[_0x984d('0x3e')]:_0x1425e1[_0x984d('0x3a')];_0xe3ca5e[_0x984d('0x42')]=qs[_0x984d('0x43')](_0x1deac4[_0x984d('0x3b')]['sort']);_0xe3ca5e['where']=qs[_0x984d('0x3c')](_[_0x984d('0x45')](_0x1deac4['query'],_0x1425e1[_0x984d('0x3c')]));if(_0x1deac4['query']['filter']){_0xe3ca5e[_0x984d('0x44')]=_['merge'](_0xe3ca5e[_0x984d('0x44')],{'$or':_[_0x984d('0x37')](_0xe3ca5e[_0x984d('0x3e')],function(_0x56f9c5){var _0x5ae369={};_0x5ae369[_0x56f9c5]={'$like':'%'+_0x1deac4[_0x984d('0x3b')][_0x984d('0x2e')]+'%'};return _0x5ae369;})});}_0xe3ca5e=_[_0x984d('0x46')]({},_0xe3ca5e,_0x1deac4[_0x984d('0x58')]);return _0x505bd7[_0x984d('0x9d')](_0xe3ca5e);}})[_0x984d('0x2b')](function(_0x2e43b6){if(_0x2e43b6){_0x26abac=_0x2e43b6[_0x984d('0x40')];if(!_0x1deac4[_0x984d('0x3b')][_0x984d('0x41')](_0x984d('0x62'))){_0xe3ca5e[_0x984d('0x23')]=qs['limit'](_0x1deac4[_0x984d('0x3b')][_0x984d('0x23')]);_0xe3ca5e[_0x984d('0x22')]=qs[_0x984d('0x22')](_0x1deac4[_0x984d('0x3b')][_0x984d('0x22')]);}return _0x505bd7[_0x984d('0x9d')](_0xe3ca5e);}})[_0x984d('0x2b')](function(_0xb7fd66){return _0xb7fd66?{'count':_0x26abac,'rows':_0xb7fd66}:null;})[_0x984d('0x2b')](respondWithResult(_0x57c232,null))[_0x984d('0x4a')](handleError(_0x57c232,null));};exports[_0x984d('0x9e')]=function(_0x437751,_0x4f669a,_0x42c1c0){var _0x36a276={};var _0x543a49={};var _0x5f23c5;var _0x4c31a1;return db[_0x984d('0x38')][_0x984d('0x65')]({'where':{'id':_0x437751[_0x984d('0x4c')]['id']}})[_0x984d('0x2b')](handleEntityNotFound(_0x4f669a,null))[_0x984d('0x2b')](function(_0x5c6295){if(_0x5c6295){_0x5f23c5=_0x5c6295;_0x543a49[_0x984d('0x3a')]=_[_0x984d('0x4d')](db[_0x984d('0x9f')][_0x984d('0x4e')]);_0x543a49[_0x984d('0x3b')]=_[_0x984d('0x4d')](_0x437751[_0x984d('0x3b')]);_0x543a49[_0x984d('0x3c')]=_[_0x984d('0x3d')](_0x543a49['model'],_0x543a49[_0x984d('0x3b')]);_0x36a276[_0x984d('0x3e')]=_[_0x984d('0x3d')](_0x543a49[_0x984d('0x3a')],qs[_0x984d('0x3f')](_0x437751['query'][_0x984d('0x3f')]));_0x36a276[_0x984d('0x3e')]=_0x36a276[_0x984d('0x3e')]['length']?_0x36a276[_0x984d('0x3e')]:_0x543a49['model'];_0x36a276[_0x984d('0x42')]=qs[_0x984d('0x43')](_0x437751[_0x984d('0x3b')]['sort']);_0x36a276[_0x984d('0x44')]=qs[_0x984d('0x3c')](_['pick'](_0x437751[_0x984d('0x3b')],_0x543a49[_0x984d('0x3c')]));if(_0x437751[_0x984d('0x3b')][_0x984d('0x2e')]){_0x36a276['where']=_[_0x984d('0x46')](_0x36a276[_0x984d('0x44')],{'$or':_['map'](_0x36a276[_0x984d('0x3e')],function(_0x188aaf){var _0x550fff={};_0x550fff[_0x188aaf]={'$like':'%'+_0x437751['query']['filter']+'%'};return _0x550fff;})});}_0x36a276=_[_0x984d('0x46')]({},_0x36a276,_0x437751['options']);return _0x5f23c5[_0x984d('0x9e')](_0x36a276);}})[_0x984d('0x2b')](function(_0x34ace1){if(_0x34ace1){_0x4c31a1=_0x34ace1[_0x984d('0x40')];if(!_0x437751[_0x984d('0x3b')][_0x984d('0x41')]('nolimit')){_0x36a276[_0x984d('0x23')]=qs[_0x984d('0x23')](_0x437751[_0x984d('0x3b')][_0x984d('0x23')]);_0x36a276[_0x984d('0x22')]=qs['offset'](_0x437751[_0x984d('0x3b')][_0x984d('0x22')]);}return _0x5f23c5[_0x984d('0x9e')](_0x36a276);}})[_0x984d('0x2b')](function(_0x16ea62){if(_0x16ea62){return _0x16ea62?{'count':_0x4c31a1,'rows':_0x16ea62}:null;}})[_0x984d('0x2b')](respondWithResult(_0x4f669a,null))[_0x984d('0x4a')](handleError(_0x4f669a,null));};exports[_0x984d('0xa0')]=function(_0x28ca56,_0x4901b7,_0x2cab10){var _0x1f0ce1,_0x343692;return db['VoiceQueue']['find']({'where':{'id':_0x28ca56['params']['id']}})[_0x984d('0x2b')](handleEntityNotFound(_0x4901b7,null))[_0x984d('0x2b')](function(_0x1facac){if(_0x1facac){_0x343692=_0x1facac;return _0x1facac[_0x984d('0xa0')](_0x28ca56[_0x984d('0x5c')][_0x984d('0x7f')],_[_0x984d('0x59')](_0x28ca56['body'],[_0x984d('0x7f'),'id'])||{});}return null;})['spread'](function(_0x5be45e){var _0x523be4;_0x1f0ce1=_0x5be45e||[];var _0x15f0e6=[];if(_0x5be45e){for(var _0x35e6b0=0x0;_0x35e6b0<_0x5be45e[_0x984d('0x40')];_0x35e6b0+=0x1){var _0x3b9c27=_0x5be45e[_0x35e6b0]['get']({'plain':!![]});_0x343692[_0x984d('0xa1')]=_0x28ca56[_0x984d('0x5c')]['dialCheckDuplicateType']?_0x28ca56[_0x984d('0x5c')][_0x984d('0xa1')]:_0x343692[_0x984d('0xa1')];switch(_0x343692[_0x984d('0xa1')]){case _0x984d('0xa2'):_0x523be4=squel['insert']()[_0x984d('0xa3')]('cm_hopper')['fromQuery']([_0x984d('0xa4'),'scheduledAt',_0x984d('0xa5'),_0x984d('0xa6'),_0x984d('0x63'),_0x984d('0x5a'),_0x984d('0x5b')],squel[_0x984d('0xa7')]()[_0x984d('0x80')](_0x984d('0xa4'),_0x984d('0xa4'))['field']('NOW()','scheduledAt')[_0x984d('0x80')]('id',_0x984d('0xa5'))[_0x984d('0x80')](_0x3b9c27[_0x984d('0xa8')][_0x984d('0x88')](),'ListId')[_0x984d('0x80')](_0x28ca56[_0x984d('0x4c')]['id']['toString'](),_0x984d('0x63'))[_0x984d('0x80')](_0x984d('0xa9'),'createdAt')['field'](_0x984d('0xa9'),_0x984d('0x5b'))[_0x984d('0x82')](_0x984d('0xaa'))[_0x984d('0x44')]('deletedAt\x20IS\x20NULL')[_0x984d('0x44')](_0x984d('0xab'),_0x3b9c27[_0x984d('0xa8')][_0x984d('0x88')]())[_0x984d('0x44')](_0x984d('0xac'))[_0x984d('0x44')](_0x984d('0xad'),squel[_0x984d('0xa7')]()[_0x984d('0x80')](_0x984d('0xae'))[_0x984d('0x82')](_0x984d('0xaf'))[_0x984d('0x44')](_0x984d('0xb0'),_0x28ca56[_0x984d('0x4c')]['id'][_0x984d('0x88')]()))['where'](_0x984d('0xad'),squel[_0x984d('0xa7')]()[_0x984d('0x80')]('COALESCE(phone,\x27\x27)')[_0x984d('0x82')](_0x984d('0xb1'))[_0x984d('0x44')]('VoiceQueueId\x20=\x20?',_0x28ca56[_0x984d('0x4c')]['id'][_0x984d('0x88')]())))[_0x984d('0x88')]();break;case'onlyIfOpen':_0x523be4=squel[_0x984d('0xb2')]()[_0x984d('0xa3')](_0x984d('0xb1'))[_0x984d('0xb3')]([_0x984d('0xa4'),'scheduledAt',_0x984d('0xa5'),_0x984d('0xa6'),_0x984d('0x63'),_0x984d('0x5a'),'updatedAt'],squel['select']()['field']('phone',_0x984d('0xa4'))[_0x984d('0x80')]('NOW()',_0x984d('0xb4'))[_0x984d('0x80')]('id',_0x984d('0xa5'))['field'](_0x3b9c27['CmListId'][_0x984d('0x88')](),_0x984d('0xa6'))[_0x984d('0x80')](_0x28ca56['params']['id'][_0x984d('0x88')](),_0x984d('0x63'))[_0x984d('0x80')](_0x984d('0xa9'),_0x984d('0x5a'))['field'](_0x984d('0xa9'),_0x984d('0x5b'))[_0x984d('0x82')](_0x984d('0xaa'))[_0x984d('0x44')](_0x984d('0xb5'))[_0x984d('0x44')](_0x984d('0xab'),_0x3b9c27['CmListId']['toString']())[_0x984d('0x44')]('phone\x20IS\x20NOT\x20NULL')[_0x984d('0x44')](_0x984d('0xad'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0x984d('0x82')](_0x984d('0xb1'))[_0x984d('0x44')](_0x984d('0xb0'),_0x28ca56[_0x984d('0x4c')]['id']['toString']())))[_0x984d('0x88')]();break;default:_0x523be4=squel[_0x984d('0xb2')]()[_0x984d('0xa3')](_0x984d('0xb1'))[_0x984d('0xb3')]([_0x984d('0xa4'),'scheduledAt','ContactId',_0x984d('0xa6'),_0x984d('0x63'),'createdAt',_0x984d('0x5b')],squel['select']()['field'](_0x984d('0xa4'),_0x984d('0xa4'))[_0x984d('0x80')]('NOW()',_0x984d('0xb4'))[_0x984d('0x80')]('id',_0x984d('0xa5'))[_0x984d('0x80')](_0x3b9c27[_0x984d('0xa8')][_0x984d('0x88')](),_0x984d('0xa6'))[_0x984d('0x80')](_0x28ca56[_0x984d('0x4c')]['id'][_0x984d('0x88')](),_0x984d('0x63'))['field'](_0x984d('0xa9'),'createdAt')['field']('NOW()',_0x984d('0x5b'))[_0x984d('0x82')]('cm_contacts')[_0x984d('0x44')](_0x984d('0xb5'))['where'](_0x984d('0xab'),_0x3b9c27[_0x984d('0xa8')][_0x984d('0x88')]())['where'](_0x984d('0xac')))[_0x984d('0x88')]();}_0x15f0e6[_0x984d('0x87')](db[_0x984d('0x90')][_0x984d('0x3b')](_0x523be4));}return BPromise[_0x984d('0x8d')](_0x15f0e6);}})[_0x984d('0x2b')](function(){return _0x1f0ce1;})['then'](respondWithResult(_0x4901b7,null))['catch'](handleError(_0x4901b7,null));};exports[_0x984d('0xb6')]=function(_0x1f5dc5,_0x2d6c23,_0xf20b79){return db[_0x984d('0x38')][_0x984d('0x33')]({'where':{'id':_0x1f5dc5['params']['id']}})[_0x984d('0x2b')](handleEntityNotFound(_0x2d6c23,null))[_0x984d('0x2b')](function(_0x462faa){if(_0x462faa){return _0x462faa[_0x984d('0xb6')](_0x1f5dc5['query']['ids']);}})[_0x984d('0x2b')](function(_0x40209f){if(_0x40209f){return db[_0x984d('0x61')]['destroy']({'where':{'ListId':_0x1f5dc5[_0x984d('0x3b')][_0x984d('0x7f')],'VoiceQueueId':_0x1f5dc5[_0x984d('0x4c')]['id']}})[_0x984d('0x2b')](function(){return _0x40209f;});}})[_0x984d('0x2b')](respondWithStatusCode(_0x2d6c23,null))['catch'](handleError(_0x2d6c23,null));};exports[_0x984d('0xb7')]=function(_0x34e9f1,_0x188bad,_0x466bf0){var _0x2741ed={};var _0x98136a={};var _0x5d2928;var _0x5343fc;return db[_0x984d('0x38')][_0x984d('0x65')]({'where':{'id':_0x34e9f1[_0x984d('0x4c')]['id']}})[_0x984d('0x2b')](handleEntityNotFound(_0x188bad,null))['then'](function(_0x482bd9){if(_0x482bd9){_0x5d2928=_0x482bd9;_0x98136a[_0x984d('0x3a')]=_[_0x984d('0x4d')](db['CmList'][_0x984d('0x4e')]);_0x98136a[_0x984d('0x3b')]=_[_0x984d('0x4d')](_0x34e9f1['query']);_0x98136a[_0x984d('0x3c')]=_[_0x984d('0x3d')](_0x98136a[_0x984d('0x3a')],_0x98136a[_0x984d('0x3b')]);_0x2741ed[_0x984d('0x3e')]=_[_0x984d('0x3d')](_0x98136a[_0x984d('0x3a')],qs[_0x984d('0x3f')](_0x34e9f1[_0x984d('0x3b')][_0x984d('0x3f')]));_0x2741ed[_0x984d('0x3e')]=_0x2741ed[_0x984d('0x3e')]['length']?_0x2741ed[_0x984d('0x3e')]:_0x98136a[_0x984d('0x3a')];_0x2741ed[_0x984d('0x42')]=qs[_0x984d('0x43')](_0x34e9f1[_0x984d('0x3b')][_0x984d('0x43')]);_0x2741ed[_0x984d('0x44')]=qs['filters'](_['pick'](_0x34e9f1[_0x984d('0x3b')],_0x98136a['filters']));if(_0x34e9f1[_0x984d('0x3b')]['filter']){_0x2741ed[_0x984d('0x44')]=_['merge'](_0x2741ed[_0x984d('0x44')],{'$or':_[_0x984d('0x37')](_0x2741ed['attributes'],function(_0x56f2b3){var _0x1ed912={};_0x1ed912[_0x56f2b3]={'$like':'%'+_0x34e9f1[_0x984d('0x3b')][_0x984d('0x2e')]+'%'};return _0x1ed912;})});}_0x2741ed=_[_0x984d('0x46')]({},_0x2741ed,_0x34e9f1[_0x984d('0x58')]);return _0x5d2928[_0x984d('0xb7')](_0x2741ed);}})[_0x984d('0x2b')](function(_0x378847){if(_0x378847){_0x5343fc=_0x378847[_0x984d('0x40')];if(!_0x34e9f1[_0x984d('0x3b')][_0x984d('0x41')](_0x984d('0x62'))){_0x2741ed[_0x984d('0x23')]=qs[_0x984d('0x23')](_0x34e9f1[_0x984d('0x3b')][_0x984d('0x23')]);_0x2741ed[_0x984d('0x22')]=qs[_0x984d('0x22')](_0x34e9f1[_0x984d('0x3b')][_0x984d('0x22')]);}return _0x5d2928['getBlackLists'](_0x2741ed);}})[_0x984d('0x2b')](function(_0x2eb5c3){if(_0x2eb5c3){return _0x2eb5c3?{'count':_0x5343fc,'rows':_0x2eb5c3}:null;}})[_0x984d('0x2b')](respondWithResult(_0x188bad,null))['catch'](handleError(_0x188bad,null));};exports[_0x984d('0xb8')]=function(_0x5d8211,_0x5956de,_0xe685dd){var _0x3b7dd5,_0x1c4dba;return db[_0x984d('0x38')][_0x984d('0x33')]({'where':{'id':_0x5d8211[_0x984d('0x4c')]['id']}})[_0x984d('0x2b')](handleEntityNotFound(_0x5956de,null))[_0x984d('0x2b')](function(_0x3dc94a){if(_0x3dc94a){_0x1c4dba=_0x3dc94a;return _0x3dc94a[_0x984d('0xb8')](_0x5d8211[_0x984d('0x5c')][_0x984d('0x7f')],_[_0x984d('0x59')](_0x5d8211['body'],['ids','id'])||{});}return null;})[_0x984d('0x96')](function(_0x483cf1){var _0x5d4c80;_0x3b7dd5=_0x483cf1||[];var _0x5b0459=[];if(_0x483cf1){for(var _0x1c2de9=0x0;_0x1c2de9<_0x483cf1[_0x984d('0x40')];_0x1c2de9+=0x1){var _0x25b0e1=_0x483cf1[_0x1c2de9][_0x984d('0x51')]({'plain':!![]});_0x5d4c80=squel[_0x984d('0xb2')]()['into']('cm_hopper_black')[_0x984d('0xb3')]([_0x984d('0xa4'),_0x984d('0xa5'),'ListId',_0x984d('0x63'),_0x984d('0x5a'),_0x984d('0x5b')],squel[_0x984d('0xa7')]()[_0x984d('0x80')](_0x984d('0xa4'),_0x984d('0xa4'))[_0x984d('0x80')]('id',_0x984d('0xa5'))['field'](_0x25b0e1[_0x984d('0xa8')][_0x984d('0x88')](),_0x984d('0xa6'))[_0x984d('0x80')](_0x5d8211[_0x984d('0x4c')]['id'][_0x984d('0x88')](),_0x984d('0x63'))['field'](_0x984d('0xa9'),_0x984d('0x5a'))[_0x984d('0x80')](_0x984d('0xa9'),_0x984d('0x5b'))[_0x984d('0x82')](_0x984d('0xaa'))[_0x984d('0x44')](_0x984d('0xb5'))[_0x984d('0x44')](_0x984d('0xab'),_0x25b0e1['CmListId'][_0x984d('0x88')]())[_0x984d('0x44')](_0x984d('0xac')))[_0x984d('0x88')]();_0x5b0459[_0x984d('0x87')](db[_0x984d('0x90')][_0x984d('0x3b')](_0x5d4c80));}return BPromise[_0x984d('0x8d')](_0x5b0459);}})[_0x984d('0x2b')](function(){return _0x3b7dd5;})[_0x984d('0x2b')](respondWithResult(_0x5956de,null))[_0x984d('0x4a')](handleError(_0x5956de,null));};exports[_0x984d('0xb9')]=function(_0x1d1c12,_0x1af750,_0x270642){return db[_0x984d('0x38')][_0x984d('0x33')]({'where':{'id':_0x1d1c12[_0x984d('0x4c')]['id']}})[_0x984d('0x2b')](handleEntityNotFound(_0x1af750,null))[_0x984d('0x2b')](function(_0x290f4e){if(_0x290f4e){return _0x290f4e[_0x984d('0xb9')](_0x1d1c12[_0x984d('0x3b')][_0x984d('0x7f')]);}})['then'](function(_0x115f13){if(_0x115f13){return db[_0x984d('0x6b')][_0x984d('0x2a')]({'where':{'ListId':_0x1d1c12[_0x984d('0x3b')][_0x984d('0x7f')],'VoiceQueueId':_0x1d1c12[_0x984d('0x4c')]['id']}})[_0x984d('0x2b')](function(){return _0x115f13;});}})['then'](respondWithStatusCode(_0x1af750,null))[_0x984d('0x4a')](handleError(_0x1af750,null));}; \ No newline at end of file +var _0xacfe=['path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','sendStatus','status','end','count','offset','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','ignore','value','type','find','name','UserProfileResource','error','stack','send','index','map','VoiceQueue','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','filter','where','merge','VIRTUAL','options','findAll','rows','show','params','attributes','includeAll','catch','create','body','user','outbound','UserProfileSection','clone','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','pick','VoiceQueueId','getHopperHistories','order','CmHopperHistory','include','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','Agents','online','voicePause','interface','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','SIP/%s','emit','userVoiceQueue:save','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','QueryTypes','SELECT','TeamId','includes','all','compact','removeTeams','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','push','isNil','format','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','phone','ContactId','ListId','select','scheduledAt','CmListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper','onlyIfOpen','fromQuery','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x304ff4,_0x5c4769){var _0x1a898a=function(_0x2fbc59){while(--_0x2fbc59){_0x304ff4['push'](_0x304ff4['shift']());}};_0x1a898a(++_0x5c4769);}(_0xacfe,0xad));var _0xeacf=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xacfe[_0x543084];return _0x306a57;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeacf('0x0'));var rimraf=require(_0xeacf('0x1'));var zipdir=require(_0xeacf('0x2'));var jsonpatch=require(_0xeacf('0x3'));var rp=require('request-promise');var moment=require(_0xeacf('0x4'));var BPromise=require(_0xeacf('0x5'));var Mustache=require(_0xeacf('0x6'));var util=require('util');var path=require(_0xeacf('0x7'));var sox=require(_0xeacf('0x8'));var csv=require(_0xeacf('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeacf('0xa'));var squel=require(_0xeacf('0xb'));var crypto=require('crypto');var jsforce=require(_0xeacf('0xc'));var deskjs=require(_0xeacf('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xeacf('0xe'));var Redis=require(_0xeacf('0xf'));var authService=require(_0xeacf('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xeacf('0x11'));var hardwareService=require(_0xeacf('0x12'));var logger=require(_0xeacf('0x13'))('api');var utils=require(_0xeacf('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xeacf('0x15'))['db'];config[_0xeacf('0x16')]=_[_0xeacf('0x17')](config[_0xeacf('0x16')],{'host':_0xeacf('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeacf('0x16')]));require(_0xeacf('0x19'))['register'](socket);function respondWithStatusCode(_0x4b795e,_0x408c79){_0x408c79=_0x408c79||0xcc;return function(_0x59fbee){if(_0x59fbee){return _0x4b795e[_0xeacf('0x1a')](_0x408c79);}return _0x4b795e[_0xeacf('0x1b')](_0x408c79)[_0xeacf('0x1c')]();};}function respondWithResult(_0x445451,_0xad16f3){_0xad16f3=_0xad16f3||0xc8;return function(_0x248593){if(_0x248593){return _0x445451[_0xeacf('0x1b')](_0xad16f3)['json'](_0x248593);}};}function respondWithFilteredResult(_0xe4e9b9,_0x550cb2){return function(_0xfe40a2){if(_0xfe40a2){var _0xabd55=_0xfe40a2[_0xeacf('0x1d')],_0x4ff201=_0x550cb2[_0xeacf('0x1e')],_0x596c08=_0x550cb2[_0xeacf('0x1e')]+_0x550cb2['limit'],_0x47666f;if(_0x596c08>=_0xabd55){_0x596c08=_0xabd55;_0x47666f=0xc8;}else{_0x47666f=0xce;}_0xe4e9b9[_0xeacf('0x1b')](_0x47666f);return _0xe4e9b9['set']('Content-Range',_0x4ff201+'-'+_0x596c08+'/'+_0xabd55)['json'](_0xfe40a2);}return null;};}function patchUpdates(_0x5786df){return function(_0x33a86a){try{jsonpatch[_0xeacf('0x1f')](_0x33a86a,_0x5786df,!![]);}catch(_0x569b5a){return BPromise[_0xeacf('0x20')](_0x569b5a);}return _0x33a86a[_0xeacf('0x21')]();};}function saveUpdates(_0x5c5722,_0x3ad952){return function(_0x58d5b1){if(_0x58d5b1){return _0x58d5b1[_0xeacf('0x22')](_0x5c5722)[_0xeacf('0x23')](function(_0x24b5ee){return _0x24b5ee;});}return null;};}function removeEntity(_0x34791f,_0x285dcb){return function(_0x46658b){if(_0x46658b){return _0x46658b[_0xeacf('0x24')]()['then'](function(){var _0xa9859c=_0x46658b[_0xeacf('0x25')]({'plain':!![]});var _0xca75bb=[{'name':_0xeacf('0x26'),'value':_0xeacf('0x27'),'ignore':![]},{'name':_0xeacf('0x28'),'value':'outbound','ignore':![]}];var _0x359a0b=_(_0xca75bb)['filter'](_0xeacf('0x29'))['map'](_0xeacf('0x2a'))[_0xeacf('0x2a')]();if(_['includes'](_0x359a0b,_0xa9859c[_0xeacf('0x2b')])){return;}var _0x1a7398=_[_0xeacf('0x2c')](_0xca75bb,[_0xeacf('0x2a'),_0xa9859c[_0xeacf('0x2b')]])[_0xeacf('0x2d')];return db[_0xeacf('0x2e')][_0xeacf('0x24')]({'where':{'type':_0x1a7398,'resourceId':_0xa9859c['id']}})[_0xeacf('0x23')](function(){return _0x46658b;});})[_0xeacf('0x23')](function(){_0x34791f[_0xeacf('0x1b')](0xcc)[_0xeacf('0x1c')]();});}};}function handleEntityNotFound(_0x2d8b9f,_0x919418){return function(_0x1ce288){if(!_0x1ce288){_0x2d8b9f['sendStatus'](0x194);}return _0x1ce288;};}function handleError(_0x59e51b,_0x5ee325){_0x5ee325=_0x5ee325||0x1f4;return function(_0x134d44){logger[_0xeacf('0x2f')](_0x134d44[_0xeacf('0x30')]);if(_0x134d44['name']){delete _0x134d44[_0xeacf('0x2d')];}_0x59e51b[_0xeacf('0x1b')](_0x5ee325)[_0xeacf('0x31')](_0x134d44);};}exports[_0xeacf('0x32')]=function(_0x691279,_0x5350e1){var _0x5aa200={},_0x5858cf={},_0x11feff={'count':0x0,'rows':[]};var _0x37c692=_[_0xeacf('0x33')](db[_0xeacf('0x34')][_0xeacf('0x35')],function(_0x37b003){return{'name':_0x37b003[_0xeacf('0x36')],'type':_0x37b003[_0xeacf('0x2b')]['key']};});_0x5858cf[_0xeacf('0x37')]=_[_0xeacf('0x33')](_0x37c692,_0xeacf('0x2d'));_0x5858cf[_0xeacf('0x38')]=_[_0xeacf('0x39')](_0x691279[_0xeacf('0x38')]);_0x5858cf[_0xeacf('0x3a')]=_[_0xeacf('0x3b')](_0x5858cf[_0xeacf('0x37')],_0x5858cf[_0xeacf('0x38')]);_0x5aa200['attributes']=_[_0xeacf('0x3b')](_0x5858cf[_0xeacf('0x37')],qs[_0xeacf('0x3c')](_0x691279[_0xeacf('0x38')][_0xeacf('0x3c')]));_0x5aa200['attributes']=_0x5aa200['attributes'][_0xeacf('0x3d')]?_0x5aa200['attributes']:_0x5858cf['model'];if(!_0x691279[_0xeacf('0x38')][_0xeacf('0x3e')](_0xeacf('0x3f'))){_0x5aa200[_0xeacf('0x40')]=qs[_0xeacf('0x40')](_0x691279[_0xeacf('0x38')]['limit']);_0x5aa200[_0xeacf('0x1e')]=qs[_0xeacf('0x1e')](_0x691279[_0xeacf('0x38')][_0xeacf('0x1e')]);}_0x5aa200['order']=qs[_0xeacf('0x41')](_0x691279[_0xeacf('0x38')][_0xeacf('0x41')]);_0x5aa200['where']=qs['filters'](_['pick'](_0x691279[_0xeacf('0x38')],_0x5858cf[_0xeacf('0x3a')]),_0x37c692);if(_0x691279['query'][_0xeacf('0x42')]){_0x5aa200[_0xeacf('0x43')]=_[_0xeacf('0x44')](_0x5aa200[_0xeacf('0x43')],{'$or':_['map'](_0x37c692,function(_0x5305c1){if(_0x5305c1[_0xeacf('0x2b')]!==_0xeacf('0x45')){var _0x13517d={};_0x13517d[_0x5305c1[_0xeacf('0x2d')]]={'$like':'%'+_0x691279['query'][_0xeacf('0x42')]+'%'};return _0x13517d;}})});}_0x5aa200=_[_0xeacf('0x44')]({},_0x5aa200,_0x691279[_0xeacf('0x46')]);var _0x16ab15={'where':_0x5aa200[_0xeacf('0x43')]};return db['VoiceQueue'][_0xeacf('0x1d')](_0x16ab15)[_0xeacf('0x23')](function(_0x4939bb){_0x11feff[_0xeacf('0x1d')]=_0x4939bb;if(_0x691279['query']['includeAll']){_0x5aa200['include']=[{'all':!![]}];}return db[_0xeacf('0x34')][_0xeacf('0x47')](_0x5aa200);})[_0xeacf('0x23')](function(_0x3d7437){_0x11feff[_0xeacf('0x48')]=_0x3d7437;return _0x11feff;})[_0xeacf('0x23')](respondWithFilteredResult(_0x5350e1,_0x5aa200))['catch'](handleError(_0x5350e1,null));};exports[_0xeacf('0x49')]=function(_0x559e3f,_0x2deddc){var _0x2e2a30={'raw':![],'where':{'id':_0x559e3f[_0xeacf('0x4a')]['id']}},_0x1b420f={};_0x1b420f[_0xeacf('0x37')]=_[_0xeacf('0x39')](db[_0xeacf('0x34')][_0xeacf('0x35')]);_0x1b420f['query']=_[_0xeacf('0x39')](_0x559e3f[_0xeacf('0x38')]);_0x1b420f[_0xeacf('0x3a')]=_[_0xeacf('0x3b')](_0x1b420f[_0xeacf('0x37')],_0x1b420f[_0xeacf('0x38')]);_0x2e2a30[_0xeacf('0x4b')]=_[_0xeacf('0x3b')](_0x1b420f[_0xeacf('0x37')],qs['fields'](_0x559e3f[_0xeacf('0x38')][_0xeacf('0x3c')]));_0x2e2a30[_0xeacf('0x4b')]=_0x2e2a30[_0xeacf('0x4b')][_0xeacf('0x3d')]?_0x2e2a30[_0xeacf('0x4b')]:_0x1b420f['model'];if(_0x559e3f[_0xeacf('0x38')][_0xeacf('0x4c')]){_0x2e2a30['include']=[{'all':!![]}];}_0x2e2a30=_[_0xeacf('0x44')]({},_0x2e2a30,_0x559e3f[_0xeacf('0x46')]);return db[_0xeacf('0x34')][_0xeacf('0x2c')](_0x2e2a30)['then'](handleEntityNotFound(_0x2deddc,null))[_0xeacf('0x23')](respondWithResult(_0x2deddc,null))[_0xeacf('0x4d')](handleError(_0x2deddc,null));};exports[_0xeacf('0x4e')]=function(_0x59e0d0,_0x1eef0b){return db[_0xeacf('0x34')][_0xeacf('0x4e')](_0x59e0d0[_0xeacf('0x4f')],{})['then'](function(_0x4c182d){var _0x45a1b0=_0x59e0d0[_0xeacf('0x50')][_0xeacf('0x25')]({'plain':!![]});if(!_0x45a1b0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45a1b0['role']===_0xeacf('0x50')){var _0x2003c7=_0x4c182d[_0xeacf('0x25')]({'plain':!![]});var _0x27df9d=[{'name':'VoiceQueues','value':_0xeacf('0x27')},{'name':'QueueCampaigns','value':_0xeacf('0x51')}];var _0x577a5c=_[_0xeacf('0x2c')](_0x27df9d,[_0xeacf('0x2a'),_0x2003c7[_0xeacf('0x2b')]])['name'];return db[_0xeacf('0x52')][_0xeacf('0x2c')]({'where':{'name':_0x577a5c,'userProfileId':_0x45a1b0['userProfileId']},'raw':!![]})[_0xeacf('0x23')](function(_0x681f49){if(_0x681f49&&_0x681f49['autoAssociation']===0x0){return db[_0xeacf('0x2e')]['create']({'name':_0x2003c7[_0xeacf('0x2d')],'resourceId':_0x2003c7['id'],'type':_0x681f49[_0xeacf('0x2d')],'sectionId':_0x681f49['id']},{})['then'](function(){return _0x4c182d;});}else{return _0x4c182d;}})['catch'](function(_0x50682e){logger[_0xeacf('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50682e);throw _0x50682e;});}return _0x4c182d;})['then'](respondWithResult(_0x1eef0b,0xc9))['catch'](handleError(_0x1eef0b,null));};exports[_0xeacf('0x53')]=function(_0x1f4fd9,_0x5b5b40){var _0x352159={'where':{'id':_0x1f4fd9[_0xeacf('0x4a')]['id']}},_0x2373e5={};_0x2373e5[_0xeacf('0x37')]=_[_0xeacf('0x39')](db['VoiceQueue']['rawAttributes']);_0x352159[_0xeacf('0x4b')]=_[_0xeacf('0x3b')](_0x2373e5[_0xeacf('0x37')],qs[_0xeacf('0x3c')](_0x1f4fd9[_0xeacf('0x38')][_0xeacf('0x3c')]));_0x352159['attributes']=_0x352159[_0xeacf('0x4b')][_0xeacf('0x3d')]?_0x352159[_0xeacf('0x4b')]:_0x2373e5[_0xeacf('0x37')];if(_0x1f4fd9[_0xeacf('0x38')][_0xeacf('0x4c')]){_0x352159['include']=[{'all':!![]}];}_0x352159=_[_0xeacf('0x44')]({},_0x352159,_0x1f4fd9[_0xeacf('0x46')]);return db['VoiceQueue'][_0xeacf('0x2c')](_0x352159)[_0xeacf('0x23')](handleEntityNotFound(_0x5b5b40,null))[_0xeacf('0x23')](function(_0x2d1584){if(_0x2d1584){var _0x3da8f5=_0x2d1584[_0xeacf('0x25')]({'plain':!![]});_0x3da8f5=qs[_0xeacf('0x54')](_0x3da8f5,['id',_0xeacf('0x55'),_0xeacf('0x56')]);_0x1f4fd9['body']=_['omit'](_0x1f4fd9[_0xeacf('0x4f')],['id',_0xeacf('0x55'),_0xeacf('0x56')]);return db['VoiceQueue'][_0xeacf('0x4e')](_['merge'](_0x3da8f5,_0x1f4fd9[_0xeacf('0x4f')]),{'include':_0x1f4fd9[_0xeacf('0x38')][_0xeacf('0x4c')]?[{'all':!![]}]:undefined})['then'](function(_0x29741b){var _0x540131=_0x1f4fd9[_0xeacf('0x50')][_0xeacf('0x25')]({'plain':!![]});if(!_0x540131)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x540131['role']==='user'){var _0x1319b0=_0x29741b['get']({'plain':!![]});var _0x1d9965=[{'name':_0xeacf('0x26'),'value':_0xeacf('0x27')},{'name':_0xeacf('0x28'),'value':_0xeacf('0x51')}];var _0x5c38e1=_[_0xeacf('0x2c')](_0x1d9965,[_0xeacf('0x2a'),_0x1319b0['type']])[_0xeacf('0x2d')];return db[_0xeacf('0x52')]['find']({'where':{'name':_0x5c38e1,'userProfileId':_0x540131[_0xeacf('0x57')]},'raw':!![]})[_0xeacf('0x23')](function(_0xc9ea69){if(_0xc9ea69&&_0xc9ea69['autoAssociation']===0x0){return db[_0xeacf('0x2e')][_0xeacf('0x4e')]({'name':_0x1319b0[_0xeacf('0x2d')],'resourceId':_0x1319b0['id'],'type':_0xc9ea69[_0xeacf('0x2d')],'sectionId':_0xc9ea69['id']},{})[_0xeacf('0x23')](function(){return _0x29741b;});}else{return _0x29741b;}})[_0xeacf('0x4d')](function(_0xe3eca){logger[_0xeacf('0x2f')](_0xeacf('0x58'),_0xe3eca);throw _0xe3eca;});}return _0x29741b;});}})[_0xeacf('0x23')](respondWithResult(_0x5b5b40,0xc9))[_0xeacf('0x4d')](handleError(_0x5b5b40,null));};exports['update']=function(_0x2b873d,_0x4f1c12){if(_0x2b873d[_0xeacf('0x4f')]['id']){delete _0x2b873d['body']['id'];}return db[_0xeacf('0x34')][_0xeacf('0x2c')]({'where':{'id':_0x2b873d[_0xeacf('0x4a')]['id']}})[_0xeacf('0x23')](handleEntityNotFound(_0x4f1c12,null))[_0xeacf('0x23')](saveUpdates(_0x2b873d[_0xeacf('0x4f')],null))[_0xeacf('0x23')](respondWithResult(_0x4f1c12,null))[_0xeacf('0x4d')](handleError(_0x4f1c12,null));};exports[_0xeacf('0x24')]=function(_0x1ad800,_0x460425){return db[_0xeacf('0x34')][_0xeacf('0x2c')]({'where':{'id':_0x1ad800[_0xeacf('0x4a')]['id']}})[_0xeacf('0x23')](handleEntityNotFound(_0x460425,null))[_0xeacf('0x23')](removeEntity(_0x460425,null))[_0xeacf('0x4d')](handleError(_0x460425,null));};exports[_0xeacf('0x59')]=function(_0x55b51c,_0x550b7,_0x45bf1){var _0x3a1b42={'raw':![],'where':{}};var _0xc26971={};var _0x17f999={'count':0x0,'rows':[]};return db[_0xeacf('0x34')]['findOne']({'where':{'id':_0x55b51c['params']['id']}})[_0xeacf('0x23')](handleEntityNotFound(_0x550b7,null))[_0xeacf('0x23')](function(_0x1116b4){if(_0x1116b4){_0xc26971[_0xeacf('0x37')]=_[_0xeacf('0x39')](db[_0xeacf('0x5a')][_0xeacf('0x35')]);_0xc26971['query']=_[_0xeacf('0x39')](_0x55b51c[_0xeacf('0x38')]);_0xc26971[_0xeacf('0x3a')]=_[_0xeacf('0x3b')](_0xc26971[_0xeacf('0x37')],_0xc26971[_0xeacf('0x38')]);_0x3a1b42[_0xeacf('0x4b')]=_[_0xeacf('0x3b')](_0xc26971[_0xeacf('0x37')],qs[_0xeacf('0x3c')](_0x55b51c[_0xeacf('0x38')]['fields']));_0x3a1b42[_0xeacf('0x4b')]=_0x3a1b42[_0xeacf('0x4b')][_0xeacf('0x3d')]?_0x3a1b42[_0xeacf('0x4b')]:_0xc26971['model'];if(!_0x55b51c[_0xeacf('0x38')][_0xeacf('0x3e')](_0xeacf('0x3f'))){_0x3a1b42[_0xeacf('0x40')]=qs[_0xeacf('0x40')](_0x55b51c[_0xeacf('0x38')][_0xeacf('0x40')]);_0x3a1b42['offset']=qs[_0xeacf('0x1e')](_0x55b51c['query'][_0xeacf('0x1e')]);}_0x3a1b42['order']=qs[_0xeacf('0x41')](_0x55b51c[_0xeacf('0x38')][_0xeacf('0x41')]);_0x3a1b42[_0xeacf('0x43')]=qs['filters'](_[_0xeacf('0x5b')](_0x55b51c[_0xeacf('0x38')],_0xc26971['filters']));_0x3a1b42['where'][_0xeacf('0x5c')]=_0x1116b4['id'];if(_0x55b51c[_0xeacf('0x38')][_0xeacf('0x42')]){_0x3a1b42[_0xeacf('0x43')]=_[_0xeacf('0x44')](_0x3a1b42['where'],{'$or':_[_0xeacf('0x33')](_0x3a1b42[_0xeacf('0x4b')],function(_0xfedde3){var _0x3e5bf0={};_0x3e5bf0[_0xfedde3]={'$like':'%'+_0x55b51c[_0xeacf('0x38')][_0xeacf('0x42')]+'%'};return _0x3e5bf0;})});}_0x3a1b42=_['merge']({},_0x3a1b42,_0x55b51c[_0xeacf('0x46')]);return db[_0xeacf('0x5a')]['count']({'where':_0x3a1b42[_0xeacf('0x43')]})[_0xeacf('0x23')](function(_0x120d09){_0x17f999[_0xeacf('0x1d')]=_0x120d09;if(_0x55b51c[_0xeacf('0x38')][_0xeacf('0x4c')]){_0x3a1b42['include']=[{'all':!![]}];}return db[_0xeacf('0x5a')][_0xeacf('0x47')](_0x3a1b42);})[_0xeacf('0x23')](function(_0xa58116){_0x17f999[_0xeacf('0x48')]=_0xa58116;return _0x17f999;});}})[_0xeacf('0x23')](respondWithFilteredResult(_0x550b7,_0x3a1b42))[_0xeacf('0x4d')](handleError(_0x550b7,null));};exports[_0xeacf('0x5d')]=function(_0x57c4f2,_0xb9772f,_0x14907e){var _0x28bc0f={'raw':!![],'where':{}};var _0x398bed={};var _0x2c2b8d={'count':0x0,'rows':[]};return db[_0xeacf('0x34')]['findOne']({'where':{'id':_0x57c4f2[_0xeacf('0x4a')]['id']}})[_0xeacf('0x23')](handleEntityNotFound(_0xb9772f,null))[_0xeacf('0x23')](function(_0x3b97ba){if(_0x3b97ba){_0x398bed[_0xeacf('0x37')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x398bed['query']=_[_0xeacf('0x39')](_0x57c4f2[_0xeacf('0x38')]);_0x398bed[_0xeacf('0x3a')]=_[_0xeacf('0x3b')](_0x398bed[_0xeacf('0x37')],_0x398bed[_0xeacf('0x38')]);_0x28bc0f['attributes']=_[_0xeacf('0x3b')](_0x398bed[_0xeacf('0x37')],qs['fields'](_0x57c4f2[_0xeacf('0x38')][_0xeacf('0x3c')]));_0x28bc0f[_0xeacf('0x4b')]=_0x28bc0f[_0xeacf('0x4b')][_0xeacf('0x3d')]?_0x28bc0f[_0xeacf('0x4b')]:_0x398bed[_0xeacf('0x37')];if(!_0x57c4f2['query'][_0xeacf('0x3e')](_0xeacf('0x3f'))){_0x28bc0f[_0xeacf('0x40')]=qs[_0xeacf('0x40')](_0x57c4f2['query'][_0xeacf('0x40')]);_0x28bc0f['offset']=qs[_0xeacf('0x1e')](_0x57c4f2['query'][_0xeacf('0x1e')]);}_0x28bc0f[_0xeacf('0x5e')]=qs[_0xeacf('0x41')](_0x57c4f2['query'][_0xeacf('0x41')]);_0x28bc0f[_0xeacf('0x43')]=qs['filters'](_[_0xeacf('0x5b')](_0x57c4f2['query'],_0x398bed[_0xeacf('0x3a')]));_0x28bc0f[_0xeacf('0x43')]['VoiceQueueId']=_0x3b97ba['id'];if(_0x57c4f2[_0xeacf('0x38')]['filter']){_0x28bc0f[_0xeacf('0x43')]=_[_0xeacf('0x44')](_0x28bc0f[_0xeacf('0x43')],{'$or':_[_0xeacf('0x33')](_0x28bc0f[_0xeacf('0x4b')],function(_0x3d1ef7){var _0x20dbde={};_0x20dbde[_0x3d1ef7]={'$like':'%'+_0x57c4f2[_0xeacf('0x38')][_0xeacf('0x42')]+'%'};return _0x20dbde;})});}_0x28bc0f=_['merge']({},_0x28bc0f,_0x57c4f2[_0xeacf('0x46')]);return db[_0xeacf('0x5f')]['count']({'where':_0x28bc0f[_0xeacf('0x43')]})[_0xeacf('0x23')](function(_0x1ea91b){_0x2c2b8d[_0xeacf('0x1d')]=_0x1ea91b;if(_0x57c4f2[_0xeacf('0x38')][_0xeacf('0x4c')]){_0x28bc0f[_0xeacf('0x60')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xeacf('0x47')](_0x28bc0f);})['then'](function(_0x578057){_0x2c2b8d['rows']=_0x578057;return _0x2c2b8d;});}})[_0xeacf('0x23')](respondWithFilteredResult(_0xb9772f,_0x28bc0f))['catch'](handleError(_0xb9772f,null));};exports[_0xeacf('0x61')]=function(_0x117fd1,_0x455425,_0x41703a){var _0x4d5089={'raw':!![],'where':{}};var _0x201609={};var _0x5aca67={'count':0x0,'rows':[]};return db[_0xeacf('0x34')][_0xeacf('0x62')]({'where':{'id':_0x117fd1['params']['id']}})[_0xeacf('0x23')](handleEntityNotFound(_0x455425,null))[_0xeacf('0x23')](function(_0x22b2c0){if(_0x22b2c0){_0x201609[_0xeacf('0x37')]=_[_0xeacf('0x39')](db[_0xeacf('0x63')][_0xeacf('0x35')]);_0x201609[_0xeacf('0x38')]=_['keys'](_0x117fd1[_0xeacf('0x38')]);_0x201609[_0xeacf('0x3a')]=_[_0xeacf('0x3b')](_0x201609[_0xeacf('0x37')],_0x201609['query']);_0x4d5089[_0xeacf('0x4b')]=_[_0xeacf('0x3b')](_0x201609[_0xeacf('0x37')],qs[_0xeacf('0x3c')](_0x117fd1['query'][_0xeacf('0x3c')]));_0x4d5089['attributes']=_0x4d5089[_0xeacf('0x4b')]['length']?_0x4d5089[_0xeacf('0x4b')]:_0x201609[_0xeacf('0x37')];if(!_0x117fd1['query'][_0xeacf('0x3e')](_0xeacf('0x3f'))){_0x4d5089[_0xeacf('0x40')]=qs[_0xeacf('0x40')](_0x117fd1[_0xeacf('0x38')]['limit']);_0x4d5089[_0xeacf('0x1e')]=qs[_0xeacf('0x1e')](_0x117fd1[_0xeacf('0x38')][_0xeacf('0x1e')]);}_0x4d5089[_0xeacf('0x5e')]=qs[_0xeacf('0x41')](_0x117fd1[_0xeacf('0x38')][_0xeacf('0x41')]);_0x4d5089[_0xeacf('0x43')]=qs[_0xeacf('0x3a')](_[_0xeacf('0x5b')](_0x117fd1[_0xeacf('0x38')],_0x201609[_0xeacf('0x3a')]));_0x4d5089[_0xeacf('0x43')]['VoiceQueueId']=_0x22b2c0['id'];if(_0x117fd1[_0xeacf('0x38')]['filter']){_0x4d5089[_0xeacf('0x43')]=_[_0xeacf('0x44')](_0x4d5089[_0xeacf('0x43')],{'$or':_[_0xeacf('0x33')](_0x4d5089[_0xeacf('0x4b')],function(_0x4be2dd){var _0x4993f3={};_0x4993f3[_0x4be2dd]={'$like':'%'+_0x117fd1[_0xeacf('0x38')]['filter']+'%'};return _0x4993f3;})});}_0x4d5089=_[_0xeacf('0x44')]({},_0x4d5089,_0x117fd1[_0xeacf('0x46')]);return db['CmHopperFinal'][_0xeacf('0x1d')]({'where':_0x4d5089[_0xeacf('0x43')]})[_0xeacf('0x23')](function(_0x317b7e){_0x5aca67[_0xeacf('0x1d')]=_0x317b7e;if(_0x117fd1['query'][_0xeacf('0x4c')]){_0x4d5089[_0xeacf('0x60')]=[{'all':!![]}];}return db[_0xeacf('0x63')][_0xeacf('0x47')](_0x4d5089);})[_0xeacf('0x23')](function(_0x256dda){_0x5aca67[_0xeacf('0x48')]=_0x256dda;return _0x5aca67;});}})[_0xeacf('0x23')](respondWithFilteredResult(_0x455425,_0x4d5089))[_0xeacf('0x4d')](handleError(_0x455425,null));};exports[_0xeacf('0x64')]=function(_0x4f215d,_0x37f7ff,_0x395ea1){var _0x71d4d4={'raw':!![],'where':{}};var _0x393b95={};var _0x41d79d={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xeacf('0x62')]({'where':{'id':_0x4f215d[_0xeacf('0x4a')]['id']}})[_0xeacf('0x23')](handleEntityNotFound(_0x37f7ff,null))[_0xeacf('0x23')](function(_0x26edc8){if(_0x26edc8){_0x393b95[_0xeacf('0x37')]=_[_0xeacf('0x39')](db['CmHopperBlack']['rawAttributes']);_0x393b95['query']=_['keys'](_0x4f215d[_0xeacf('0x38')]);_0x393b95[_0xeacf('0x3a')]=_[_0xeacf('0x3b')](_0x393b95[_0xeacf('0x37')],_0x393b95[_0xeacf('0x38')]);_0x71d4d4['attributes']=_[_0xeacf('0x3b')](_0x393b95[_0xeacf('0x37')],qs[_0xeacf('0x3c')](_0x4f215d[_0xeacf('0x38')][_0xeacf('0x3c')]));_0x71d4d4[_0xeacf('0x4b')]=_0x71d4d4[_0xeacf('0x4b')][_0xeacf('0x3d')]?_0x71d4d4[_0xeacf('0x4b')]:_0x393b95[_0xeacf('0x37')];if(!_0x4f215d[_0xeacf('0x38')][_0xeacf('0x3e')]('nolimit')){_0x71d4d4[_0xeacf('0x40')]=qs[_0xeacf('0x40')](_0x4f215d['query'][_0xeacf('0x40')]);_0x71d4d4[_0xeacf('0x1e')]=qs[_0xeacf('0x1e')](_0x4f215d[_0xeacf('0x38')][_0xeacf('0x1e')]);}_0x71d4d4[_0xeacf('0x5e')]=qs[_0xeacf('0x41')](_0x4f215d['query']['sort']);_0x71d4d4[_0xeacf('0x43')]=qs['filters'](_[_0xeacf('0x5b')](_0x4f215d[_0xeacf('0x38')],_0x393b95[_0xeacf('0x3a')]));_0x71d4d4['where']['VoiceQueueId']=_0x26edc8['id'];if(_0x4f215d[_0xeacf('0x38')][_0xeacf('0x42')]){_0x71d4d4[_0xeacf('0x43')]=_[_0xeacf('0x44')](_0x71d4d4[_0xeacf('0x43')],{'$or':_[_0xeacf('0x33')](_0x71d4d4[_0xeacf('0x4b')],function(_0x435f40){var _0x28a527={};_0x28a527[_0x435f40]={'$like':'%'+_0x4f215d[_0xeacf('0x38')][_0xeacf('0x42')]+'%'};return _0x28a527;})});}_0x71d4d4=_['merge']({},_0x71d4d4,_0x4f215d['options']);return db[_0xeacf('0x65')][_0xeacf('0x1d')]({'where':_0x71d4d4[_0xeacf('0x43')]})[_0xeacf('0x23')](function(_0x281360){_0x41d79d[_0xeacf('0x1d')]=_0x281360;if(_0x4f215d[_0xeacf('0x38')]['includeAll']){_0x71d4d4[_0xeacf('0x60')]=[{'all':!![]}];}return db[_0xeacf('0x65')][_0xeacf('0x47')](_0x71d4d4);})[_0xeacf('0x23')](function(_0x445262){_0x41d79d['rows']=_0x445262;return _0x41d79d;});}})[_0xeacf('0x23')](respondWithFilteredResult(_0x37f7ff,_0x71d4d4))[_0xeacf('0x4d')](handleError(_0x37f7ff,null));};exports['getTeams']=function(_0x4d89b0,_0x42cf5b,_0x24948b){var _0x5696ca={};var _0x1f3cf5={};var _0x6c85b1;var _0x5abe84;return db[_0xeacf('0x34')]['findOne']({'where':{'id':_0x4d89b0[_0xeacf('0x4a')]['id']}})['then'](handleEntityNotFound(_0x42cf5b,null))[_0xeacf('0x23')](function(_0x5a80c0){if(_0x5a80c0){_0x6c85b1=_0x5a80c0;_0x1f3cf5[_0xeacf('0x37')]=_[_0xeacf('0x39')](db[_0xeacf('0x66')]['rawAttributes']);_0x1f3cf5['query']=_[_0xeacf('0x39')](_0x4d89b0[_0xeacf('0x38')]);_0x1f3cf5[_0xeacf('0x3a')]=_['intersection'](_0x1f3cf5[_0xeacf('0x37')],_0x1f3cf5['query']);_0x5696ca[_0xeacf('0x4b')]=_['intersection'](_0x1f3cf5['model'],qs[_0xeacf('0x3c')](_0x4d89b0[_0xeacf('0x38')][_0xeacf('0x3c')]));_0x5696ca[_0xeacf('0x4b')]=_0x5696ca[_0xeacf('0x4b')][_0xeacf('0x3d')]?_0x5696ca['attributes']:_0x1f3cf5['model'];_0x5696ca['order']=qs[_0xeacf('0x41')](_0x4d89b0[_0xeacf('0x38')][_0xeacf('0x41')]);_0x5696ca[_0xeacf('0x43')]=qs['filters'](_[_0xeacf('0x5b')](_0x4d89b0[_0xeacf('0x38')],_0x1f3cf5[_0xeacf('0x3a')]));if(_0x4d89b0[_0xeacf('0x38')][_0xeacf('0x42')]){_0x5696ca['where']=_[_0xeacf('0x44')](_0x5696ca[_0xeacf('0x43')],{'$or':_[_0xeacf('0x33')](_0x5696ca['attributes'],function(_0x4e8e68){var _0x313780={};_0x313780[_0x4e8e68]={'$like':'%'+_0x4d89b0['query'][_0xeacf('0x42')]+'%'};return _0x313780;})});}_0x5696ca=_['merge']({},_0x5696ca,_0x4d89b0[_0xeacf('0x46')]);return _0x6c85b1[_0xeacf('0x67')](_0x5696ca);}})[_0xeacf('0x23')](function(_0x1cf7b3){if(_0x1cf7b3){_0x5abe84=_0x1cf7b3[_0xeacf('0x3d')];if(!_0x4d89b0[_0xeacf('0x38')][_0xeacf('0x3e')](_0xeacf('0x3f'))){_0x5696ca['limit']=qs['limit'](_0x4d89b0[_0xeacf('0x38')][_0xeacf('0x40')]);_0x5696ca[_0xeacf('0x1e')]=qs[_0xeacf('0x1e')](_0x4d89b0[_0xeacf('0x38')][_0xeacf('0x1e')]);}return _0x6c85b1[_0xeacf('0x67')](_0x5696ca);}})[_0xeacf('0x23')](function(_0x4c63c4){if(_0x4c63c4){return _0x4c63c4?{'count':_0x5abe84,'rows':_0x4c63c4}:null;}})[_0xeacf('0x23')](respondWithResult(_0x42cf5b,null))['catch'](handleError(_0x42cf5b,null));};exports['addTeams']=function(_0x3d7b7e,_0x12448e,_0xe687a9){var _0x393c54=_0x3d7b7e[_0xeacf('0x4f')][_0xeacf('0x68')];var _0x4d47a8=_[_0xeacf('0x33')](_0x393c54,'id');return db[_0xeacf('0x66')][_0xeacf('0x47')]({'where':{'id':_0x4d47a8},'attributes':['id'],'include':[{'model':db[_0xeacf('0x69')],'as':_0xeacf('0x6a'),'attributes':['id',_0xeacf('0x2d'),_0xeacf('0x6b'),_0xeacf('0x6c'),_0xeacf('0x6d')],'raw':!![]}]})['then'](function(_0x45e9ed){if(_0x45e9ed){var _0x4e71cd=_['flatMap'](_0x45e9ed,function(_0x3ca90e){var _0x3be348=_0x3ca90e['get']({'plain':!![]});_0x3be348[_0xeacf('0x6a')][_0xeacf('0x6e')](function(_0x587ecf){_0x587ecf[_0xeacf('0x6f')]=_[_0xeacf('0x2c')](_0x393c54,{'id':_0x3be348['id']})[_0xeacf('0x6f')];});return _0x3be348[_0xeacf('0x6a')];});return db[_0xeacf('0x34')][_0xeacf('0x2c')]({'where':{'id':_0x3d7b7e[_0xeacf('0x4a')]['id']}})[_0xeacf('0x23')](function(_0x390c60){return db[_0xeacf('0x70')][_0xeacf('0x71')](function(_0x307a0c){return _0x390c60[_0xeacf('0x72')](_0x4d47a8,{'transaction':_0x307a0c})[_0xeacf('0x23')](function(){return BPromise[_0xeacf('0x73')](_0x393c54,function(_0x2c4ea0){return db[_0xeacf('0x74')][_0xeacf('0x75')]({'TeamId':_0x2c4ea0['id'],'VoiceQueueId':_0x3d7b7e[_0xeacf('0x4a')]['id'],'penalty':_0x2c4ea0['penalty']},{'transaction':_0x307a0c});});})[_0xeacf('0x23')](function(){return BPromise['each'](_0x4e71cd,function(_0x43c61e){return db[_0xeacf('0x76')][_0xeacf('0x77')]({'where':{'UserId':_0x43c61e['id'],'VoiceQueueId':_0x3d7b7e['params']['id']},'defaults':{'penalty':_0x43c61e[_0xeacf('0x6f')]},'transaction':_0x307a0c});});})['then'](function(){return BPromise['each'](_[_0xeacf('0x42')](_0x4e71cd,{'online':!![]}),function(_0x2e0ba6){return db['UserVoiceQueueRt'][_0xeacf('0x75')]({'membername':_0x2e0ba6[_0xeacf('0x2d')],'UserId':_0x2e0ba6['id'],'queue_name':_0x390c60[_0xeacf('0x2d')],'VoiceQueueId':_0x390c60['id'],'interface':_['isNil'](_0x2e0ba6[_0xeacf('0x6d')])?util['format'](_0xeacf('0x78'),_0x2e0ba6[_0xeacf('0x2d')]):_0x2e0ba6['interface'],'paused':_0x2e0ba6['voicePause']||![],'penalty':_0x2e0ba6[_0xeacf('0x6f')]},{'transaction':_0x307a0c});});})[_0xeacf('0x23')](function(){_0x4e71cd[_0xeacf('0x6e')](function(_0x323de1){socket[_0xeacf('0x79')](_0xeacf('0x7a'),{'UserId':_0x323de1['id'],'VoiceQueueId':_0x390c60['id']});});});});});}})[_0xeacf('0x23')](respondWithStatusCode(_0x12448e,null))[_0xeacf('0x4d')](handleError(_0x12448e,null));};exports['removeTeams']=function(_0x54c374,_0xc98141,_0x158842){return db[_0xeacf('0x66')][_0xeacf('0x47')]({'where':{'id':_0x54c374[_0xeacf('0x38')][_0xeacf('0x7b')]},'attributes':['id'],'include':[{'model':db[_0xeacf('0x69')],'as':_0xeacf('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xeacf('0x23')](handleEntityNotFound(_0xc98141,null))[_0xeacf('0x23')](function(_0x2a5b05){var _0x2d0e20=_[_0xeacf('0x33')](_0x2a5b05,'id');var _0x14832e=[];var _0x57899f=[];var _0x3bfcf6=squel['select']();_0x3bfcf6[_0xeacf('0x7c')](_0xeacf('0x7d'))[_0xeacf('0x7e')](_0xeacf('0x7f'),'tq')[_0xeacf('0x80')](_0xeacf('0x81'),'ut',_0xeacf('0x82'))[_0xeacf('0x43')](_0xeacf('0x83'),_0x54c374[_0xeacf('0x4a')]['id']);for(var _0x498e27=0x0;_0x498e27<_0x2a5b05[_0xeacf('0x3d')];_0x498e27+=0x1){let _0x206b69=_0x2a5b05[_0x498e27];for(var _0xe46ef6=0x0;_0xe46ef6<_0x206b69[_0xeacf('0x6a')][_0xeacf('0x3d')];_0xe46ef6+=0x1){let _0x1195d2=_0x206b69['Agents'][_0xe46ef6];var _0x20384c=_0x3bfcf6[_0xeacf('0x53')]();_0x20384c[_0xeacf('0x43')](_0xeacf('0x84'),_0x1195d2['id']);_0x57899f['push'](db[_0xeacf('0x70')]['query'](_0x20384c['toString'](),{'type':db['sequelize'][_0xeacf('0x85')][_0xeacf('0x86')]})[_0xeacf('0x23')](function(_0x2e84f9){if(_0x2e84f9['length']===0x1){return _0x1195d2['id'];}else{var _0x1ef467=_['every'](_[_0xeacf('0x33')](_0x2e84f9,_0xeacf('0x87')),function(_0x3713af){return _[_0xeacf('0x88')](_0x2d0e20,_0x3713af);});if(_0x1ef467){return _0x1195d2['id'];}}}));}}return BPromise[_0xeacf('0x89')](_0x57899f)[_0xeacf('0x23')](function(_0x151576){_0x14832e=_(_0x14832e)['union'](_0x151576)[_0xeacf('0x8a')]()[_0xeacf('0x2a')]();return db['VoiceQueue']['find']({'where':{'id':_0x54c374[_0xeacf('0x4a')]['id']}})[_0xeacf('0x23')](function(_0x20b1de){return db[_0xeacf('0x70')][_0xeacf('0x71')](function(_0x245f0b){return _0x20b1de[_0xeacf('0x8b')](_0x54c374[_0xeacf('0x38')][_0xeacf('0x7b')],{'transaction':_0x245f0b})[_0xeacf('0x23')](function(){if(!_[_0xeacf('0x8c')](_0x14832e)){return _0x20b1de[_0xeacf('0x8d')](_0x14832e,{'transaction':_0x245f0b})['then'](function(){return db[_0xeacf('0x8e')][_0xeacf('0x24')]({'where':{'VoiceQueueId':_0x54c374[_0xeacf('0x4a')]['id'],'UserId':_0x14832e},'transaction':_0x245f0b});});}})[_0xeacf('0x23')](function(){_0x14832e['forEach'](function(_0x36f81a){socket[_0xeacf('0x79')](_0xeacf('0x8f'),{'UserId':_0x36f81a,'VoiceQueueId':_0x20b1de['id']});});});});});});})[_0xeacf('0x23')](respondWithStatusCode(_0xc98141,null))[_0xeacf('0x4d')](handleError(_0xc98141,null));};exports['addAgents']=function(_0x7a56ac,_0x2740b2,_0x25e72a){var _0x210191,_0x4f67f6;return db[_0xeacf('0x34')][_0xeacf('0x2c')]({'where':{'id':_0x7a56ac[_0xeacf('0x4a')]['id']}})[_0xeacf('0x23')](handleEntityNotFound(_0x2740b2,null))[_0xeacf('0x23')](function(_0x2892b5){if(_0x2892b5){_0x4f67f6=_0x2892b5;return _0x2892b5[_0xeacf('0x90')](_0x7a56ac[_0xeacf('0x4f')][_0xeacf('0x7b')],_[_0xeacf('0x54')](_0x7a56ac[_0xeacf('0x4f')],[_0xeacf('0x7b'),'id'])||{})[_0xeacf('0x91')](function(_0x267d34){for(var _0x57fd9e=0x0;_0x57fd9e<_0x7a56ac['body'][_0xeacf('0x7b')][_0xeacf('0x3d')];_0x57fd9e+=0x1){socket[_0xeacf('0x79')]('userVoiceQueue:save',{'UserId':_0x7a56ac[_0xeacf('0x4f')][_0xeacf('0x7b')][_0x57fd9e],'VoiceQueueId':_0x7a56ac[_0xeacf('0x4a')]['id']});}return _0x267d34;});}})['then'](function(_0x2be8fb){_0x210191=_0x2be8fb||[];if(_0x4f67f6){return db['User'][_0xeacf('0x47')]({'where':{'id':_0x7a56ac[_0xeacf('0x4f')]['ids']},'attributes':['id',_0xeacf('0x2d'),'online',_0xeacf('0x6c'),_0xeacf('0x6d')],'raw':!![]});}})[_0xeacf('0x23')](function(_0x16ceca){if(!_[_0xeacf('0x8c')](_0x16ceca)){var _0x518903=[];for(var _0x540e51=0x0;_0x540e51<_0x16ceca[_0xeacf('0x3d')];_0x540e51++){if(_0x16ceca[_0x540e51]['online']){_0x518903[_0xeacf('0x92')](db[_0xeacf('0x8e')][_0xeacf('0x75')]({'membername':_0x16ceca[_0x540e51][_0xeacf('0x2d')],'UserId':_0x16ceca[_0x540e51]['id'],'queue_name':_0x4f67f6[_0xeacf('0x2d')],'VoiceQueueId':_0x4f67f6['id'],'interface':_[_0xeacf('0x93')](_0x16ceca[_0x540e51][_0xeacf('0x6d')])?util[_0xeacf('0x94')](_0xeacf('0x78'),_0x16ceca[_0x540e51][_0xeacf('0x2d')]):_0x16ceca[_0x540e51][_0xeacf('0x6d')],'paused':_0x16ceca[_0x540e51]['voicePause']||![],'penalty':_0x7a56ac[_0xeacf('0x4f')]['penalty']||0x0}));}}return BPromise[_0xeacf('0x89')](_0x518903);}})[_0xeacf('0x23')](function(){return _0x210191;})[_0xeacf('0x23')](respondWithResult(_0x2740b2,null))[_0xeacf('0x4d')](handleError(_0x2740b2,null));};exports[_0xeacf('0x8d')]=function(_0x2d9517,_0x5d8aca,_0x1cbca5){return db[_0xeacf('0x34')]['find']({'where':{'id':_0x2d9517['params']['id']}})['then'](handleEntityNotFound(_0x5d8aca,null))[_0xeacf('0x23')](function(_0x2e3e73){if(_0x2e3e73){return _0x2e3e73['removeAgents'](_0x2d9517[_0xeacf('0x38')]['ids'])[_0xeacf('0x23')](function(){if(_['isArray'](_0x2d9517[_0xeacf('0x38')][_0xeacf('0x7b')])){for(var _0x21c419=0x0;_0x21c419<_0x2d9517[_0xeacf('0x38')][_0xeacf('0x7b')][_0xeacf('0x3d')];_0x21c419+=0x1){socket[_0xeacf('0x79')](_0xeacf('0x8f'),{'UserId':Number(_0x2d9517[_0xeacf('0x38')]['ids'][_0x21c419]),'VoiceQueueId':Number(_0x2d9517[_0xeacf('0x4a')]['id'])});}}else{socket[_0xeacf('0x79')](_0xeacf('0x8f'),{'UserId':Number(_0x2d9517[_0xeacf('0x38')][_0xeacf('0x7b')]),'VoiceQueueId':Number(_0x2d9517['params']['id'])});}});}})['then'](function(_0x2be07e){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x2d9517[_0xeacf('0x4a')]['id'],'UserId':_0x2d9517[_0xeacf('0x38')][_0xeacf('0x7b')]}})[_0xeacf('0x23')](function(){return _0x2be07e;});})['then'](respondWithStatusCode(_0x5d8aca,null))[_0xeacf('0x4d')](handleError(_0x5d8aca,null));};exports[_0xeacf('0x95')]=function(_0x2e8d78,_0x5cdd84,_0x395e21){var _0xc619ef={};var _0x3e3031={};var _0x52d7d2;var _0x4e5dab;return db['VoiceQueue'][_0xeacf('0x62')]({'where':{'id':_0x2e8d78[_0xeacf('0x4a')]['id']}})[_0xeacf('0x23')](handleEntityNotFound(_0x5cdd84,null))[_0xeacf('0x23')](function(_0x1e4cbc){if(_0x1e4cbc){_0x52d7d2=_0x1e4cbc;_0x3e3031[_0xeacf('0x37')]=_[_0xeacf('0x39')](db[_0xeacf('0x69')][_0xeacf('0x35')]);_0x3e3031[_0xeacf('0x38')]=_[_0xeacf('0x39')](_0x2e8d78[_0xeacf('0x38')]);_0x3e3031[_0xeacf('0x3a')]=_[_0xeacf('0x3b')](_0x3e3031[_0xeacf('0x37')],_0x3e3031['query']);_0xc619ef[_0xeacf('0x4b')]=_[_0xeacf('0x3b')](_0x3e3031[_0xeacf('0x37')],qs[_0xeacf('0x3c')](_0x2e8d78[_0xeacf('0x38')][_0xeacf('0x3c')]));_0xc619ef[_0xeacf('0x4b')]=_0xc619ef[_0xeacf('0x4b')]['length']?_0xc619ef['attributes']:_0x3e3031[_0xeacf('0x37')];_0xc619ef['order']=qs['sort'](_0x2e8d78[_0xeacf('0x38')][_0xeacf('0x41')]);_0xc619ef[_0xeacf('0x43')]=qs[_0xeacf('0x3a')](_[_0xeacf('0x5b')](_0x2e8d78[_0xeacf('0x38')],_0x3e3031[_0xeacf('0x3a')]));if(_0x2e8d78[_0xeacf('0x38')][_0xeacf('0x42')]){_0xc619ef[_0xeacf('0x43')]=_[_0xeacf('0x44')](_0xc619ef[_0xeacf('0x43')],{'$or':_[_0xeacf('0x33')](_0xc619ef['attributes'],function(_0x45627e){var _0x330ccd={};_0x330ccd[_0x45627e]={'$like':'%'+_0x2e8d78[_0xeacf('0x38')][_0xeacf('0x42')]+'%'};return _0x330ccd;})});}_0xc619ef=_['merge']({},_0xc619ef,_0x2e8d78['options']);return _0x52d7d2[_0xeacf('0x95')](_0xc619ef);}})[_0xeacf('0x23')](function(_0x2b6660){if(_0x2b6660){_0x4e5dab=_0x2b6660[_0xeacf('0x3d')];if(!_0x2e8d78[_0xeacf('0x38')][_0xeacf('0x3e')](_0xeacf('0x3f'))){_0xc619ef[_0xeacf('0x40')]=qs[_0xeacf('0x40')](_0x2e8d78['query'][_0xeacf('0x40')]);_0xc619ef[_0xeacf('0x1e')]=qs[_0xeacf('0x1e')](_0x2e8d78[_0xeacf('0x38')][_0xeacf('0x1e')]);}return _0x52d7d2[_0xeacf('0x95')](_0xc619ef);}})['then'](function(_0x348e26){if(_0x348e26){return _0x348e26?{'count':_0x4e5dab,'rows':_0x348e26}:null;}})[_0xeacf('0x23')](respondWithResult(_0x5cdd84,null))[_0xeacf('0x4d')](handleError(_0x5cdd84,null));};exports['getMembers']=function(_0x352290,_0x16aa08,_0x49c403){var _0x529624={};var _0x532388={};var _0x4962f0;var _0x344fc2;return db[_0xeacf('0x34')]['findOne']({'where':{'id':_0x352290[_0xeacf('0x4a')]['id']}})[_0xeacf('0x23')](handleEntityNotFound(_0x16aa08,null))[_0xeacf('0x23')](function(_0x2bab18){if(_0x2bab18){_0x4962f0=_0x2bab18;_0x532388[_0xeacf('0x37')]=_[_0xeacf('0x39')](db[_0xeacf('0x8e')][_0xeacf('0x35')]);_0x532388[_0xeacf('0x38')]=_['keys'](_0x352290['query']);_0x532388[_0xeacf('0x3a')]=_[_0xeacf('0x3b')](_0x532388[_0xeacf('0x37')],_0x532388['query']);_0x529624[_0xeacf('0x4b')]=_['intersection'](_0x532388[_0xeacf('0x37')],qs['fields'](_0x352290[_0xeacf('0x38')][_0xeacf('0x3c')]));_0x529624['attributes']=_0x529624[_0xeacf('0x4b')][_0xeacf('0x3d')]?_0x529624[_0xeacf('0x4b')]:_0x532388[_0xeacf('0x37')];_0x529624[_0xeacf('0x5e')]=qs[_0xeacf('0x41')](_0x352290[_0xeacf('0x38')]['sort']);_0x529624['where']=qs[_0xeacf('0x3a')](_[_0xeacf('0x5b')](_0x352290[_0xeacf('0x38')],_0x532388[_0xeacf('0x3a')]));if(_0x352290['query'][_0xeacf('0x42')]){_0x529624['where']=_[_0xeacf('0x44')](_0x529624[_0xeacf('0x43')],{'$or':_[_0xeacf('0x33')](_0x529624[_0xeacf('0x4b')],function(_0x1c3048){var _0x36ddcf={};_0x36ddcf[_0x1c3048]={'$like':'%'+_0x352290[_0xeacf('0x38')]['filter']+'%'};return _0x36ddcf;})});}_0x529624=_[_0xeacf('0x44')]({},_0x529624,_0x352290[_0xeacf('0x46')]);return _0x4962f0['getMembers'](_0x529624);}})['then'](function(_0xfa20f8){if(_0xfa20f8){_0x344fc2=_0xfa20f8[_0xeacf('0x3d')];if(!_0x352290[_0xeacf('0x38')]['hasOwnProperty'](_0xeacf('0x3f'))){_0x529624['limit']=qs['limit'](_0x352290[_0xeacf('0x38')][_0xeacf('0x40')]);_0x529624[_0xeacf('0x1e')]=qs[_0xeacf('0x1e')](_0x352290[_0xeacf('0x38')]['offset']);}return _0x4962f0[_0xeacf('0x96')](_0x529624);}})['then'](function(_0x56f81f){return _0x56f81f?{'count':_0x344fc2,'rows':_0x56f81f}:null;})['then'](respondWithResult(_0x16aa08,null))['catch'](handleError(_0x16aa08,null));};exports[_0xeacf('0x97')]=function(_0x3c0e1c,_0x1d0978,_0xd38051){var _0xd2a327={};var _0x158de4={};var _0x1238b2;var _0x4f7754;return db[_0xeacf('0x34')]['findOne']({'where':{'id':_0x3c0e1c['params']['id']}})[_0xeacf('0x23')](handleEntityNotFound(_0x1d0978,null))['then'](function(_0x1100a6){if(_0x1100a6){_0x1238b2=_0x1100a6;_0x158de4['model']=_['keys'](db[_0xeacf('0x98')][_0xeacf('0x35')]);_0x158de4[_0xeacf('0x38')]=_[_0xeacf('0x39')](_0x3c0e1c['query']);_0x158de4[_0xeacf('0x3a')]=_['intersection'](_0x158de4[_0xeacf('0x37')],_0x158de4[_0xeacf('0x38')]);_0xd2a327['attributes']=_[_0xeacf('0x3b')](_0x158de4[_0xeacf('0x37')],qs[_0xeacf('0x3c')](_0x3c0e1c['query']['fields']));_0xd2a327['attributes']=_0xd2a327[_0xeacf('0x4b')]['length']?_0xd2a327[_0xeacf('0x4b')]:_0x158de4['model'];_0xd2a327[_0xeacf('0x5e')]=qs[_0xeacf('0x41')](_0x3c0e1c[_0xeacf('0x38')]['sort']);_0xd2a327[_0xeacf('0x43')]=qs[_0xeacf('0x3a')](_[_0xeacf('0x5b')](_0x3c0e1c['query'],_0x158de4[_0xeacf('0x3a')]));if(_0x3c0e1c[_0xeacf('0x38')][_0xeacf('0x42')]){_0xd2a327[_0xeacf('0x43')]=_[_0xeacf('0x44')](_0xd2a327[_0xeacf('0x43')],{'$or':_['map'](_0xd2a327[_0xeacf('0x4b')],function(_0x1f8211){var _0x22cc13={};_0x22cc13[_0x1f8211]={'$like':'%'+_0x3c0e1c[_0xeacf('0x38')][_0xeacf('0x42')]+'%'};return _0x22cc13;})});}_0xd2a327=_[_0xeacf('0x44')]({},_0xd2a327,_0x3c0e1c[_0xeacf('0x46')]);return _0x1238b2['getLists'](_0xd2a327);}})[_0xeacf('0x23')](function(_0x4e1b34){if(_0x4e1b34){_0x4f7754=_0x4e1b34['length'];if(!_0x3c0e1c[_0xeacf('0x38')][_0xeacf('0x3e')](_0xeacf('0x3f'))){_0xd2a327[_0xeacf('0x40')]=qs['limit'](_0x3c0e1c[_0xeacf('0x38')][_0xeacf('0x40')]);_0xd2a327[_0xeacf('0x1e')]=qs[_0xeacf('0x1e')](_0x3c0e1c[_0xeacf('0x38')][_0xeacf('0x1e')]);}return _0x1238b2[_0xeacf('0x97')](_0xd2a327);}})[_0xeacf('0x23')](function(_0x43da0a){if(_0x43da0a){return _0x43da0a?{'count':_0x4f7754,'rows':_0x43da0a}:null;}})[_0xeacf('0x23')](respondWithResult(_0x1d0978,null))[_0xeacf('0x4d')](handleError(_0x1d0978,null));};exports[_0xeacf('0x99')]=function(_0x85f18e,_0x26bb36,_0x13d9c4){var _0x351bde,_0x435a37;return db[_0xeacf('0x34')][_0xeacf('0x2c')]({'where':{'id':_0x85f18e['params']['id']}})[_0xeacf('0x23')](handleEntityNotFound(_0x26bb36,null))[_0xeacf('0x23')](function(_0x4b8127){if(_0x4b8127){_0x435a37=_0x4b8127;return _0x4b8127[_0xeacf('0x99')](_0x85f18e[_0xeacf('0x4f')][_0xeacf('0x7b')],_[_0xeacf('0x54')](_0x85f18e[_0xeacf('0x4f')],[_0xeacf('0x7b'),'id'])||{});}return null;})[_0xeacf('0x91')](function(_0x3d87cd){var _0x3b71b9;_0x351bde=_0x3d87cd||[];var _0x37fe5b=[];if(_0x3d87cd){for(var _0x5c9f9d=0x0;_0x5c9f9d<_0x3d87cd[_0xeacf('0x3d')];_0x5c9f9d+=0x1){var _0xc28c61=_0x3d87cd[_0x5c9f9d][_0xeacf('0x25')]({'plain':!![]});_0x435a37[_0xeacf('0x9a')]=_0x85f18e[_0xeacf('0x4f')]['dialCheckDuplicateType']?_0x85f18e['body'][_0xeacf('0x9a')]:_0x435a37[_0xeacf('0x9a')];switch(_0x435a37['dialCheckDuplicateType']){case'always':_0x3b71b9=squel[_0xeacf('0x9b')]()[_0xeacf('0x9c')]('cm_hopper')['fromQuery']([_0xeacf('0x9d'),'scheduledAt',_0xeacf('0x9e'),_0xeacf('0x9f'),_0xeacf('0x5c'),_0xeacf('0x55'),_0xeacf('0x56')],squel[_0xeacf('0xa0')]()[_0xeacf('0x7c')]('phone',_0xeacf('0x9d'))[_0xeacf('0x7c')]('NOW()',_0xeacf('0xa1'))[_0xeacf('0x7c')]('id','ContactId')['field'](_0xc28c61[_0xeacf('0xa2')]['toString'](),_0xeacf('0x9f'))[_0xeacf('0x7c')](_0x85f18e[_0xeacf('0x4a')]['id']['toString'](),_0xeacf('0x5c'))[_0xeacf('0x7c')](_0xeacf('0xa3'),'createdAt')['field'](_0xeacf('0xa3'),_0xeacf('0x56'))['from'](_0xeacf('0xa4'))['where'](_0xeacf('0xa5'))[_0xeacf('0x43')](_0xeacf('0xa6'),_0xc28c61[_0xeacf('0xa2')][_0xeacf('0xa7')]())[_0xeacf('0x43')](_0xeacf('0xa8'))[_0xeacf('0x43')]('phone\x20NOT\x20IN\x20(?)',squel[_0xeacf('0xa0')]()[_0xeacf('0x7c')](_0xeacf('0xa9'))[_0xeacf('0x7e')]('cm_hopper_final')[_0xeacf('0x43')](_0xeacf('0x83'),_0x85f18e['params']['id'][_0xeacf('0xa7')]()))[_0xeacf('0x43')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xeacf('0x7c')]('COALESCE(phone,\x27\x27)')['from'](_0xeacf('0xaa'))[_0xeacf('0x43')](_0xeacf('0x83'),_0x85f18e['params']['id'][_0xeacf('0xa7')]())))['toString']();break;case _0xeacf('0xab'):_0x3b71b9=squel[_0xeacf('0x9b')]()[_0xeacf('0x9c')](_0xeacf('0xaa'))[_0xeacf('0xac')](['phone',_0xeacf('0xa1'),_0xeacf('0x9e'),_0xeacf('0x9f'),'VoiceQueueId',_0xeacf('0x55'),'updatedAt'],squel[_0xeacf('0xa0')]()[_0xeacf('0x7c')](_0xeacf('0x9d'),_0xeacf('0x9d'))[_0xeacf('0x7c')](_0xeacf('0xa3'),'scheduledAt')[_0xeacf('0x7c')]('id',_0xeacf('0x9e'))['field'](_0xc28c61[_0xeacf('0xa2')]['toString'](),_0xeacf('0x9f'))[_0xeacf('0x7c')](_0x85f18e[_0xeacf('0x4a')]['id']['toString'](),_0xeacf('0x5c'))[_0xeacf('0x7c')]('NOW()',_0xeacf('0x55'))[_0xeacf('0x7c')](_0xeacf('0xa3'),_0xeacf('0x56'))[_0xeacf('0x7e')](_0xeacf('0xa4'))[_0xeacf('0x43')]('deletedAt\x20IS\x20NULL')[_0xeacf('0x43')](_0xeacf('0xa6'),_0xc28c61['CmListId']['toString']())[_0xeacf('0x43')]('phone\x20IS\x20NOT\x20NULL')[_0xeacf('0x43')](_0xeacf('0xad'),squel[_0xeacf('0xa0')]()['field'](_0xeacf('0xae'))[_0xeacf('0x7e')](_0xeacf('0xaa'))['where'](_0xeacf('0x83'),_0x85f18e['params']['id']['toString']())))['toString']();break;default:_0x3b71b9=squel[_0xeacf('0x9b')]()['into']('cm_hopper')[_0xeacf('0xac')]([_0xeacf('0x9d'),_0xeacf('0xa1'),'ContactId','ListId',_0xeacf('0x5c'),_0xeacf('0x55'),_0xeacf('0x56')],squel[_0xeacf('0xa0')]()['field']('phone','phone')['field'](_0xeacf('0xa3'),'scheduledAt')['field']('id',_0xeacf('0x9e'))[_0xeacf('0x7c')](_0xc28c61[_0xeacf('0xa2')][_0xeacf('0xa7')](),_0xeacf('0x9f'))[_0xeacf('0x7c')](_0x85f18e[_0xeacf('0x4a')]['id']['toString'](),_0xeacf('0x5c'))['field']('NOW()',_0xeacf('0x55'))['field']('NOW()',_0xeacf('0x56'))[_0xeacf('0x7e')](_0xeacf('0xa4'))[_0xeacf('0x43')]('deletedAt\x20IS\x20NULL')[_0xeacf('0x43')]('ListId\x20=\x20?',_0xc28c61[_0xeacf('0xa2')][_0xeacf('0xa7')]())[_0xeacf('0x43')](_0xeacf('0xa8')))[_0xeacf('0xa7')]();}_0x37fe5b[_0xeacf('0x92')](db[_0xeacf('0x70')][_0xeacf('0x38')](_0x3b71b9));}return BPromise['all'](_0x37fe5b);}})[_0xeacf('0x23')](function(){return _0x351bde;})[_0xeacf('0x23')](respondWithResult(_0x26bb36,null))[_0xeacf('0x4d')](handleError(_0x26bb36,null));};exports[_0xeacf('0xaf')]=function(_0x49deb5,_0x6c3dd8,_0x55bd8c){return db[_0xeacf('0x34')]['find']({'where':{'id':_0x49deb5['params']['id']}})[_0xeacf('0x23')](handleEntityNotFound(_0x6c3dd8,null))[_0xeacf('0x23')](function(_0x1a27c1){if(_0x1a27c1){return _0x1a27c1['removeLists'](_0x49deb5['query']['ids']);}})['then'](function(_0x138b4b){if(_0x138b4b){return db[_0xeacf('0x5a')][_0xeacf('0x24')]({'where':{'ListId':_0x49deb5[_0xeacf('0x38')][_0xeacf('0x7b')],'VoiceQueueId':_0x49deb5[_0xeacf('0x4a')]['id']}})[_0xeacf('0x23')](function(){return _0x138b4b;});}})[_0xeacf('0x23')](respondWithStatusCode(_0x6c3dd8,null))[_0xeacf('0x4d')](handleError(_0x6c3dd8,null));};exports[_0xeacf('0xb0')]=function(_0x15c1ec,_0xc02fdf,_0x25f470){var _0x3a424d={};var _0x18c880={};var _0x3c55de;var _0x5a2157;return db[_0xeacf('0x34')][_0xeacf('0x62')]({'where':{'id':_0x15c1ec[_0xeacf('0x4a')]['id']}})['then'](handleEntityNotFound(_0xc02fdf,null))[_0xeacf('0x23')](function(_0x3e3d6f){if(_0x3e3d6f){_0x3c55de=_0x3e3d6f;_0x18c880[_0xeacf('0x37')]=_['keys'](db[_0xeacf('0x98')][_0xeacf('0x35')]);_0x18c880[_0xeacf('0x38')]=_[_0xeacf('0x39')](_0x15c1ec[_0xeacf('0x38')]);_0x18c880[_0xeacf('0x3a')]=_['intersection'](_0x18c880[_0xeacf('0x37')],_0x18c880[_0xeacf('0x38')]);_0x3a424d[_0xeacf('0x4b')]=_['intersection'](_0x18c880[_0xeacf('0x37')],qs[_0xeacf('0x3c')](_0x15c1ec[_0xeacf('0x38')]['fields']));_0x3a424d[_0xeacf('0x4b')]=_0x3a424d[_0xeacf('0x4b')][_0xeacf('0x3d')]?_0x3a424d[_0xeacf('0x4b')]:_0x18c880[_0xeacf('0x37')];_0x3a424d[_0xeacf('0x5e')]=qs[_0xeacf('0x41')](_0x15c1ec[_0xeacf('0x38')][_0xeacf('0x41')]);_0x3a424d[_0xeacf('0x43')]=qs[_0xeacf('0x3a')](_[_0xeacf('0x5b')](_0x15c1ec['query'],_0x18c880['filters']));if(_0x15c1ec['query']['filter']){_0x3a424d[_0xeacf('0x43')]=_[_0xeacf('0x44')](_0x3a424d[_0xeacf('0x43')],{'$or':_[_0xeacf('0x33')](_0x3a424d['attributes'],function(_0x1a2b25){var _0x5237c2={};_0x5237c2[_0x1a2b25]={'$like':'%'+_0x15c1ec[_0xeacf('0x38')][_0xeacf('0x42')]+'%'};return _0x5237c2;})});}_0x3a424d=_[_0xeacf('0x44')]({},_0x3a424d,_0x15c1ec[_0xeacf('0x46')]);return _0x3c55de[_0xeacf('0xb0')](_0x3a424d);}})['then'](function(_0xcfcfb1){if(_0xcfcfb1){_0x5a2157=_0xcfcfb1[_0xeacf('0x3d')];if(!_0x15c1ec[_0xeacf('0x38')][_0xeacf('0x3e')]('nolimit')){_0x3a424d['limit']=qs[_0xeacf('0x40')](_0x15c1ec[_0xeacf('0x38')][_0xeacf('0x40')]);_0x3a424d['offset']=qs[_0xeacf('0x1e')](_0x15c1ec[_0xeacf('0x38')][_0xeacf('0x1e')]);}return _0x3c55de[_0xeacf('0xb0')](_0x3a424d);}})['then'](function(_0x423fd5){if(_0x423fd5){return _0x423fd5?{'count':_0x5a2157,'rows':_0x423fd5}:null;}})['then'](respondWithResult(_0xc02fdf,null))[_0xeacf('0x4d')](handleError(_0xc02fdf,null));};exports[_0xeacf('0xb1')]=function(_0x59f195,_0x4bddda,_0x36b9de){var _0x2e98dc,_0x19e0bb;return db[_0xeacf('0x34')][_0xeacf('0x2c')]({'where':{'id':_0x59f195['params']['id']}})[_0xeacf('0x23')](handleEntityNotFound(_0x4bddda,null))[_0xeacf('0x23')](function(_0x586c4c){if(_0x586c4c){_0x19e0bb=_0x586c4c;return _0x586c4c[_0xeacf('0xb1')](_0x59f195[_0xeacf('0x4f')]['ids'],_[_0xeacf('0x54')](_0x59f195[_0xeacf('0x4f')],[_0xeacf('0x7b'),'id'])||{});}return null;})[_0xeacf('0x91')](function(_0x55c999){var _0xb9c2a6;_0x2e98dc=_0x55c999||[];var _0x3f4622=[];if(_0x55c999){for(var _0x57c7e5=0x0;_0x57c7e5<_0x55c999['length'];_0x57c7e5+=0x1){var _0x4d4d93=_0x55c999[_0x57c7e5][_0xeacf('0x25')]({'plain':!![]});_0xb9c2a6=squel['insert']()[_0xeacf('0x9c')](_0xeacf('0xb2'))[_0xeacf('0xac')]([_0xeacf('0x9d'),_0xeacf('0x9e'),_0xeacf('0x9f'),'VoiceQueueId',_0xeacf('0x55'),'updatedAt'],squel[_0xeacf('0xa0')]()[_0xeacf('0x7c')](_0xeacf('0x9d'),_0xeacf('0x9d'))[_0xeacf('0x7c')]('id',_0xeacf('0x9e'))['field'](_0x4d4d93[_0xeacf('0xa2')][_0xeacf('0xa7')](),_0xeacf('0x9f'))['field'](_0x59f195[_0xeacf('0x4a')]['id']['toString'](),_0xeacf('0x5c'))['field'](_0xeacf('0xa3'),_0xeacf('0x55'))[_0xeacf('0x7c')](_0xeacf('0xa3'),'updatedAt')[_0xeacf('0x7e')](_0xeacf('0xa4'))['where'](_0xeacf('0xa5'))[_0xeacf('0x43')](_0xeacf('0xa6'),_0x4d4d93[_0xeacf('0xa2')][_0xeacf('0xa7')]())[_0xeacf('0x43')](_0xeacf('0xa8')))[_0xeacf('0xa7')]();_0x3f4622['push'](db[_0xeacf('0x70')][_0xeacf('0x38')](_0xb9c2a6));}return BPromise['all'](_0x3f4622);}})['then'](function(){return _0x2e98dc;})[_0xeacf('0x23')](respondWithResult(_0x4bddda,null))[_0xeacf('0x4d')](handleError(_0x4bddda,null));};exports[_0xeacf('0xb3')]=function(_0x3c7aa7,_0x4cad17,_0x2e7655){return db[_0xeacf('0x34')]['find']({'where':{'id':_0x3c7aa7[_0xeacf('0x4a')]['id']}})[_0xeacf('0x23')](handleEntityNotFound(_0x4cad17,null))['then'](function(_0x56e09a){if(_0x56e09a){return _0x56e09a[_0xeacf('0xb3')](_0x3c7aa7[_0xeacf('0x38')][_0xeacf('0x7b')]);}})[_0xeacf('0x23')](function(_0x2f669b){if(_0x2f669b){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x3c7aa7[_0xeacf('0x38')][_0xeacf('0x7b')],'VoiceQueueId':_0x3c7aa7['params']['id']}})[_0xeacf('0x23')](function(){return _0x2f669b;});}})[_0xeacf('0x23')](respondWithStatusCode(_0x4cad17,null))['catch'](handleError(_0x4cad17,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 05e7480..8d8dcd2 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 _0xa5dc=['hook','exports','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x14ec54,_0x2d5098){var _0x2f8c0e=function(_0x3e621e){while(--_0x3e621e){_0x14ec54['push'](_0x14ec54['shift']());}};_0x2f8c0e(++_0x2d5098);}(_0xa5dc,0x14b));var _0xca5d=function(_0x822939,_0x34bc67){_0x822939=_0x822939-0x0;var _0x476773=_0xa5dc[_0x822939];return _0x476773;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xca5d('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xca5d('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xca5d('0x2'),'afterDestroy':'remove'};function emitEvent(_0x5015c5){return function(_0x5cc62f,_0x595b4a,_0x1d64a3){VoiceQueueEvents['emit'](_0x5015c5+':'+_0x5cc62f['id'],_0x5cc62f);VoiceQueueEvents[_0xca5d('0x3')](_0x5015c5,_0x5cc62f);_0x1d64a3(null);};}for(var e in events){if(events[_0xca5d('0x4')](e)){var event=events[e];VoiceQueue[_0xca5d('0x5')](e,emitEvent(event));}}module[_0xca5d('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0x3cc3=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x252b62,_0x4cd5c0){var _0x19700a=function(_0x516b0d){while(--_0x516b0d){_0x252b62['push'](_0x252b62['shift']());}};_0x19700a(++_0x4cd5c0);}(_0x3cc3,0x1d5));var _0x33cc=function(_0x34e1b8,_0x1d018a){_0x34e1b8=_0x34e1b8-0x0;var _0x40166c=_0x3cc3[_0x34e1b8];return _0x40166c;};'use strict';var EventEmitter=require(_0x33cc('0x0'));var VoiceQueue=require(_0x33cc('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x33cc('0x2'),'afterUpdate':_0x33cc('0x3'),'afterDestroy':_0x33cc('0x4')};function emitEvent(_0x527717){return function(_0x574a30,_0x3e1b4f,_0x4b5b2f){VoiceQueueEvents[_0x33cc('0x5')](_0x527717+':'+_0x574a30['id'],_0x574a30);VoiceQueueEvents[_0x33cc('0x5')](_0x527717,_0x574a30);_0x4b5b2f(null);};}for(var e in events){if(events[_0x33cc('0x6')](e)){var event=events[e];VoiceQueue[_0x33cc('0x7')](e,emitEvent(event));}}module[_0x33cc('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 eef1be5..8970d8d 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 _0x641b=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','exports','define','VoiceQueue','voice_queues','lodash'];(function(_0x41546b,_0x4df970){var _0x46ab2b=function(_0x4e0b81){while(--_0x4e0b81){_0x41546b['push'](_0x41546b['shift']());}};_0x46ab2b(++_0x4df970);}(_0x641b,0x8e));var _0xb641=function(_0x39641a,_0x40a95d){_0x39641a=_0x39641a-0x0;var _0x5b1ed5=_0x641b[_0x39641a];return _0x5b1ed5;};'use strict';var _=require(_0xb641('0x0'));var util=require(_0xb641('0x1'));var logger=require(_0xb641('0x2'))(_0xb641('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb641('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb641('0x5'));var config=require(_0xb641('0x6'));var attributes=require('./voiceQueue.attributes');module[_0xb641('0x7')]=function(_0xab7739,_0x32e407){return _0xab7739[_0xb641('0x8')](_0xb641('0x9'),attributes,{'tableName':_0xb641('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x998a=['exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1ddae5,_0x3f04cd){var _0x2b1e09=function(_0x466615){while(--_0x466615){_0x1ddae5['push'](_0x1ddae5['shift']());}};_0x2b1e09(++_0x3f04cd);}(_0x998a,0xa2));var _0xa998=function(_0x5c883a,_0x1ded80){_0x5c883a=_0x5c883a-0x0;var _0x4fe584=_0x998a[_0x5c883a];return _0x4fe584;};'use strict';var _=require(_0xa998('0x0'));var util=require('util');var logger=require(_0xa998('0x1'))(_0xa998('0x2'));var moment=require(_0xa998('0x3'));var BPromise=require(_0xa998('0x4'));var rp=require(_0xa998('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa998('0x6'));var config=require(_0xa998('0x7'));var attributes=require('./voiceQueue.attributes');module[_0xa998('0x8')]=function(_0x307abc,_0x574d66){return _0x307abc[_0xa998('0x9')]('VoiceQueue',attributes,{'tableName':'voice_queues','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 f1704cf..087a7f4 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 _0xa41d=['attributes','include','map','model','catch','ShowVoiceQueue','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','GetVoiceQueue','VoiceQueue','findAll','options','raw','where'];(function(_0x31155a,_0x476cdb){var _0x25cb7a=function(_0x48048e){while(--_0x48048e){_0x31155a['push'](_0x31155a['shift']());}};_0x25cb7a(++_0x476cdb);}(_0xa41d,0x16f));var _0xda41=function(_0x50b9b9,_0x5847b6){_0x50b9b9=_0x50b9b9-0x0;var _0x198f30=_0xa41d[_0x50b9b9];return _0x198f30;};'use strict';var _=require(_0xda41('0x0'));var util=require(_0xda41('0x1'));var moment=require('moment');var BPromise=require(_0xda41('0x2'));var rs=require(_0xda41('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda41('0x4'))['db'];var utils=require(_0xda41('0x5'));var logger=require(_0xda41('0x6'))('rpc');var config=require(_0xda41('0x7'));var jayson=require(_0xda41('0x8'));var client=jayson['client'][_0xda41('0x9')]({'port':0x232a});config[_0xda41('0xa')]=_['defaults'](config[_0xda41('0xa')],{'host':_0xda41('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xda41('0xc'))['register'](socket);function respondWithRpcPromise(_0x2ba69d,_0x2565e9,_0x4d7757){return new BPromise(function(_0x292256,_0x40d6cc){return client[_0xda41('0xd')](_0x2ba69d,_0x4d7757)[_0xda41('0xe')](function(_0x16db7b){logger[_0xda41('0xf')](_0xda41('0x10'),_0x2565e9,'request\x20sent');logger[_0xda41('0x11')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x2565e9,_0xda41('0x12'),JSON[_0xda41('0x13')](_0x16db7b));if(_0x16db7b[_0xda41('0x14')]){if(_0x16db7b[_0xda41('0x14')][_0xda41('0x15')]===0x1f4){logger[_0xda41('0x14')](_0xda41('0x10'),_0x2565e9,_0x16db7b[_0xda41('0x14')][_0xda41('0x16')]);return _0x40d6cc(_0x16db7b[_0xda41('0x14')][_0xda41('0x16')]);}logger[_0xda41('0x14')](_0xda41('0x10'),_0x2565e9,_0x16db7b[_0xda41('0x14')][_0xda41('0x16')]);return _0x292256(_0x16db7b[_0xda41('0x14')][_0xda41('0x16')]);}else{logger[_0xda41('0xf')](_0xda41('0x10'),_0x2565e9,_0xda41('0x12'));_0x292256(_0x16db7b['result'][_0xda41('0x16')]);}})['catch'](function(_0x508383){logger[_0xda41('0x14')](_0xda41('0x10'),_0x2565e9,_0x508383);_0x40d6cc(_0x508383);});});}exports[_0xda41('0x17')]=function(_0x49703a){var _0x4ca665=this;return new Promise(function(_0x1b24c2,_0x4d0360){return db[_0xda41('0x18')][_0xda41('0x19')]({'raw':_0x49703a[_0xda41('0x1a')]?_0x49703a['options'][_0xda41('0x1b')]===undefined?!![]:![]:!![],'where':_0x49703a[_0xda41('0x1a')]?_0x49703a['options'][_0xda41('0x1c')]||null:null,'attributes':_0x49703a['options']?_0x49703a[_0xda41('0x1a')][_0xda41('0x1d')]||null:null,'limit':_0x49703a[_0xda41('0x1a')]?_0x49703a['options']['limit']||null:null,'include':_0x49703a[_0xda41('0x1a')]?_0x49703a[_0xda41('0x1a')][_0xda41('0x1e')]?_['map'](_0x49703a[_0xda41('0x1a')][_0xda41('0x1e')],function(_0x488ef8){return{'model':db[_0x488ef8['model']],'as':_0x488ef8['as'],'attributes':_0x488ef8[_0xda41('0x1d')],'include':_0x488ef8[_0xda41('0x1e')]?_[_0xda41('0x1f')](_0x488ef8[_0xda41('0x1e')],function(_0x3e77de){return{'model':db[_0x3e77de[_0xda41('0x20')]],'as':_0x3e77de['as'],'attributes':_0x3e77de[_0xda41('0x1d')],'include':_0x3e77de[_0xda41('0x1e')]?_[_0xda41('0x1f')](_0x3e77de['include'],function(_0x2bd44e){return{'model':db[_0x2bd44e[_0xda41('0x20')]],'as':_0x2bd44e['as'],'attributes':_0x2bd44e['attributes']};}):[]};}):[]};}):[]:[]})[_0xda41('0xe')](function(_0x1320ff){logger[_0xda41('0xf')](_0xda41('0x17'),_0x49703a);logger[_0xda41('0x11')](_0xda41('0x17'),_0x49703a,JSON['stringify'](_0x1320ff));_0x1b24c2(_0x1320ff);})[_0xda41('0x21')](function(_0x5034c0){logger[_0xda41('0x14')]('GetVoiceQueue',_0x5034c0[_0xda41('0x16')],_0x49703a);_0x4d0360(_0x4ca665[_0xda41('0x14')](0x1f4,_0x5034c0['message']));});});};exports[_0xda41('0x22')]=function(_0x5f3ff7){var _0x410d8c=this;return new Promise(function(_0x326241,_0x26c235){return db['VoiceQueue'][_0xda41('0x23')]({'raw':_0x5f3ff7['options']?_0x5f3ff7[_0xda41('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5f3ff7[_0xda41('0x1a')]?_0x5f3ff7[_0xda41('0x1a')][_0xda41('0x1c')]||null:null,'attributes':_0x5f3ff7['options']?_0x5f3ff7[_0xda41('0x1a')]['attributes']||null:null,'include':_0x5f3ff7[_0xda41('0x1a')]?_0x5f3ff7[_0xda41('0x1a')][_0xda41('0x1e')]?_[_0xda41('0x1f')](_0x5f3ff7[_0xda41('0x1a')][_0xda41('0x1e')],function(_0x596e88){return{'model':db[_0x596e88[_0xda41('0x20')]],'as':_0x596e88['as'],'attributes':_0x596e88['attributes'],'include':_0x596e88[_0xda41('0x1e')]?_[_0xda41('0x1f')](_0x596e88[_0xda41('0x1e')],function(_0x422385){return{'model':db[_0x422385[_0xda41('0x20')]],'as':_0x422385['as'],'attributes':_0x422385[_0xda41('0x1d')],'include':_0x422385[_0xda41('0x1e')]?_[_0xda41('0x1f')](_0x422385[_0xda41('0x1e')],function(_0x2218e5){return{'model':db[_0x2218e5[_0xda41('0x20')]],'as':_0x2218e5['as'],'attributes':_0x2218e5[_0xda41('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xda41('0xe')](function(_0x167f3f){logger[_0xda41('0xf')](_0xda41('0x22'),_0x5f3ff7);logger['debug'](_0xda41('0x22'),_0x5f3ff7,JSON[_0xda41('0x13')](_0x167f3f));_0x326241(_0x167f3f);})['catch'](function(_0x27f232){logger[_0xda41('0x14')](_0xda41('0x22'),_0x27f232['message'],_0x5f3ff7);_0x26c235(_0x410d8c[_0xda41('0x14')](0x1f4,_0x27f232['message']));});});}; \ No newline at end of file +var _0xa8ed=['http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','include','map','model','ShowVoiceQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x5c6c02,_0x3f01c4){var _0x492dc1=function(_0x2edfa9){while(--_0x2edfa9){_0x5c6c02['push'](_0x5c6c02['shift']());}};_0x492dc1(++_0x3f01c4);}(_0xa8ed,0x11c));var _0xda8e=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xa8ed[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0xda8e('0x0'));var util=require('util');var moment=require(_0xda8e('0x1'));var BPromise=require(_0xda8e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda8e('0x3'));var db=require(_0xda8e('0x4'))['db'];var utils=require(_0xda8e('0x5'));var logger=require(_0xda8e('0x6'))('rpc');var config=require(_0xda8e('0x7'));var jayson=require(_0xda8e('0x8'));var client=jayson[_0xda8e('0x9')][_0xda8e('0xa')]({'port':0x232a});config[_0xda8e('0xb')]=_[_0xda8e('0xc')](config[_0xda8e('0xb')],{'host':_0xda8e('0xd'),'port':0x18eb});var socket=require(_0xda8e('0xe'))(new Redis(config[_0xda8e('0xb')]));require(_0xda8e('0xf'))[_0xda8e('0x10')](socket);function respondWithRpcPromise(_0x20b538,_0x5b06f6,_0x1953ac){return new BPromise(function(_0x4bb9e9,_0x36c12c){return client[_0xda8e('0x11')](_0x20b538,_0x1953ac)[_0xda8e('0x12')](function(_0x5e315d){logger[_0xda8e('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x5b06f6,_0xda8e('0x14'));logger[_0xda8e('0x15')](_0xda8e('0x16'),_0x5b06f6,_0xda8e('0x14'),JSON[_0xda8e('0x17')](_0x5e315d));if(_0x5e315d[_0xda8e('0x18')]){if(_0x5e315d[_0xda8e('0x18')][_0xda8e('0x19')]===0x1f4){logger[_0xda8e('0x18')](_0xda8e('0x1a'),_0x5b06f6,_0x5e315d[_0xda8e('0x18')][_0xda8e('0x1b')]);return _0x36c12c(_0x5e315d[_0xda8e('0x18')][_0xda8e('0x1b')]);}logger['error'](_0xda8e('0x1a'),_0x5b06f6,_0x5e315d['error'][_0xda8e('0x1b')]);return _0x4bb9e9(_0x5e315d[_0xda8e('0x18')][_0xda8e('0x1b')]);}else{logger[_0xda8e('0x13')](_0xda8e('0x1a'),_0x5b06f6,_0xda8e('0x14'));_0x4bb9e9(_0x5e315d[_0xda8e('0x1c')][_0xda8e('0x1b')]);}})[_0xda8e('0x1d')](function(_0x58b752){logger[_0xda8e('0x18')](_0xda8e('0x1a'),_0x5b06f6,_0x58b752);_0x36c12c(_0x58b752);});});}exports[_0xda8e('0x1e')]=function(_0x5fa07a){var _0x38bd19=this;return new Promise(function(_0x584803,_0x26a3f7){return db[_0xda8e('0x1f')][_0xda8e('0x20')]({'raw':_0x5fa07a['options']?_0x5fa07a[_0xda8e('0x21')][_0xda8e('0x22')]===undefined?!![]:![]:!![],'where':_0x5fa07a[_0xda8e('0x21')]?_0x5fa07a[_0xda8e('0x21')][_0xda8e('0x23')]||null:null,'attributes':_0x5fa07a['options']?_0x5fa07a[_0xda8e('0x21')][_0xda8e('0x24')]||null:null,'limit':_0x5fa07a[_0xda8e('0x21')]?_0x5fa07a[_0xda8e('0x21')]['limit']||null:null,'include':_0x5fa07a[_0xda8e('0x21')]?_0x5fa07a['options'][_0xda8e('0x25')]?_[_0xda8e('0x26')](_0x5fa07a[_0xda8e('0x21')]['include'],function(_0x4f7533){return{'model':db[_0x4f7533[_0xda8e('0x27')]],'as':_0x4f7533['as'],'attributes':_0x4f7533[_0xda8e('0x24')],'include':_0x4f7533[_0xda8e('0x25')]?_[_0xda8e('0x26')](_0x4f7533[_0xda8e('0x25')],function(_0x4786a9){return{'model':db[_0x4786a9[_0xda8e('0x27')]],'as':_0x4786a9['as'],'attributes':_0x4786a9[_0xda8e('0x24')],'include':_0x4786a9[_0xda8e('0x25')]?_[_0xda8e('0x26')](_0x4786a9[_0xda8e('0x25')],function(_0x257c9c){return{'model':db[_0x257c9c['model']],'as':_0x257c9c['as'],'attributes':_0x257c9c[_0xda8e('0x24')]};}):[]};}):[]};}):[]:[]})[_0xda8e('0x12')](function(_0x53ae0f){logger[_0xda8e('0x13')]('GetVoiceQueue',_0x5fa07a);logger['debug']('GetVoiceQueue',_0x5fa07a,JSON[_0xda8e('0x17')](_0x53ae0f));_0x584803(_0x53ae0f);})[_0xda8e('0x1d')](function(_0x18955f){logger[_0xda8e('0x18')](_0xda8e('0x1e'),_0x18955f[_0xda8e('0x1b')],_0x5fa07a);_0x26a3f7(_0x38bd19[_0xda8e('0x18')](0x1f4,_0x18955f['message']));});});};exports[_0xda8e('0x28')]=function(_0x488bf5){var _0x349ee0=this;return new Promise(function(_0x32ae71,_0x1b2bad){return db[_0xda8e('0x1f')][_0xda8e('0x29')]({'raw':_0x488bf5[_0xda8e('0x21')]?_0x488bf5[_0xda8e('0x21')][_0xda8e('0x22')]===undefined?!![]:![]:!![],'where':_0x488bf5[_0xda8e('0x21')]?_0x488bf5['options'][_0xda8e('0x23')]||null:null,'attributes':_0x488bf5[_0xda8e('0x21')]?_0x488bf5[_0xda8e('0x21')]['attributes']||null:null,'include':_0x488bf5[_0xda8e('0x21')]?_0x488bf5[_0xda8e('0x21')][_0xda8e('0x25')]?_[_0xda8e('0x26')](_0x488bf5[_0xda8e('0x21')][_0xda8e('0x25')],function(_0x14db68){return{'model':db[_0x14db68[_0xda8e('0x27')]],'as':_0x14db68['as'],'attributes':_0x14db68[_0xda8e('0x24')],'include':_0x14db68['include']?_[_0xda8e('0x26')](_0x14db68[_0xda8e('0x25')],function(_0x2fb49b){return{'model':db[_0x2fb49b[_0xda8e('0x27')]],'as':_0x2fb49b['as'],'attributes':_0x2fb49b[_0xda8e('0x24')],'include':_0x2fb49b['include']?_[_0xda8e('0x26')](_0x2fb49b[_0xda8e('0x25')],function(_0x36db9e){return{'model':db[_0x36db9e[_0xda8e('0x27')]],'as':_0x36db9e['as'],'attributes':_0x36db9e[_0xda8e('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23eead){logger['info'](_0xda8e('0x28'),_0x488bf5);logger[_0xda8e('0x15')]('ShowVoiceQueue',_0x488bf5,JSON[_0xda8e('0x17')](_0x23eead));_0x32ae71(_0x23eead);})[_0xda8e('0x1d')](function(_0x2e5cdb){logger[_0xda8e('0x18')](_0xda8e('0x28'),_0x2e5cdb[_0xda8e('0x1b')],_0x488bf5);_0x1b2bad(_0x349ee0['error'](0x1f4,_0x2e5cdb[_0xda8e('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 3b369f4..fc5a765 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 _0x9789=['removeListener','register','voiceQueue:','./voiceQueue.events','save','remove','emit'];(function(_0x1a7738,_0xe44167){var _0x4b6828=function(_0x5325eb){while(--_0x5325eb){_0x1a7738['push'](_0x1a7738['shift']());}};_0x4b6828(++_0xe44167);}(_0x9789,0xc7));var _0x9978=function(_0x5e2bda,_0x1efd3a){_0x5e2bda=_0x5e2bda-0x0;var _0x354e45=_0x9789[_0x5e2bda];return _0x354e45;};'use strict';var VoiceQueueEvents=require(_0x9978('0x0'));var events=[_0x9978('0x1'),_0x9978('0x2'),'update'];function createListener(_0x1b266a,_0x3c563c){return function(_0x2b3830){_0x3c563c[_0x9978('0x3')](_0x1b266a,_0x2b3830);};}function removeListener(_0x3b5797,_0x369605){return function(){VoiceQueueEvents[_0x9978('0x4')](_0x3b5797,_0x369605);};}exports[_0x9978('0x5')]=function(_0x556690){for(var _0x2bb8ff=0x0,_0x1f3ad0=events['length'];_0x2bb8ff<_0x1f3ad0;_0x2bb8ff++){var _0x2895cf=events[_0x2bb8ff];var _0x5b5d2b=createListener(_0x9978('0x6')+_0x2895cf,_0x556690);VoiceQueueEvents['on'](_0x2895cf,_0x5b5d2b);}}; \ No newline at end of file +var _0x6a40=['update','removeListener','register','./voiceQueue.events','remove'];(function(_0x2d50f2,_0x12f989){var _0x55ba5d=function(_0x5e156e){while(--_0x5e156e){_0x2d50f2['push'](_0x2d50f2['shift']());}};_0x55ba5d(++_0x12f989);}(_0x6a40,0x1a7));var _0x06a4=function(_0xb98587,_0x8dad07){_0xb98587=_0xb98587-0x0;var _0x53120d=_0x6a40[_0xb98587];return _0x53120d;};'use strict';var VoiceQueueEvents=require(_0x06a4('0x0'));var events=['save',_0x06a4('0x1'),_0x06a4('0x2')];function createListener(_0x1c5e87,_0x537e86){return function(_0x10d987){_0x537e86['emit'](_0x1c5e87,_0x10d987);};}function removeListener(_0x16ee4b,_0xe9037e){return function(){VoiceQueueEvents[_0x06a4('0x3')](_0x16ee4b,_0xe9037e);};}exports[_0x06a4('0x4')]=function(_0x368276){for(var _0x1c4f85=0x0,_0x49f0c2=events['length'];_0x1c4f85<_0x49f0c2;_0x1c4f85++){var _0x3fda6b=events[_0x1c4f85];var _0x461a6b=createListener('voiceQueue:'+_0x3fda6b,_0x368276);VoiceQueueEvents['on'](_0x3fda6b,_0x461a6b);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 96fbbe7..620db1a 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 _0xe944=['../../components/auth/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x3000a5,_0x2d3fd7){var _0x17efdd=function(_0x20b68c){while(--_0x20b68c){_0x3000a5['push'](_0x3000a5['shift']());}};_0x17efdd(++_0x2d3fd7);}(_0xe944,0x174));var _0x4e94=function(_0xd783e9,_0x3ac8ce){_0xd783e9=_0xd783e9-0x0;var _0x300891=_0xe944[_0xd783e9];return _0x300891;};'use strict';var multer=require(_0x4e94('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4e94('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x4e94('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4e94('0x3'));router[_0x4e94('0x4')]('/',auth[_0x4e94('0x5')](),controller[_0x4e94('0x6')]);router['get'](_0x4e94('0x7'),auth[_0x4e94('0x5')](),controller[_0x4e94('0x8')]);router[_0x4e94('0x4')]('/index',auth[_0x4e94('0x5')](),controller['getVoiceQueuesReport']);router[_0x4e94('0x4')](_0x4e94('0x9'),auth[_0x4e94('0x5')](),controller[_0x4e94('0xa')]);router['post']('/',auth[_0x4e94('0x5')](),controller[_0x4e94('0xb')]);router[_0x4e94('0xc')](_0x4e94('0x9'),auth[_0x4e94('0x5')](),controller[_0x4e94('0xd')]);router[_0x4e94('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x4e94('0xf')]);module[_0x4e94('0x10')]=router; \ No newline at end of file +var _0xee2c=['path','connect-timeout','express','Router','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','/describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','multer'];(function(_0x41f805,_0x224af8){var _0x461362=function(_0x5714c4){while(--_0x5714c4){_0x41f805['push'](_0x41f805['shift']());}};_0x461362(++_0x224af8);}(_0xee2c,0x1c7));var _0xcee2=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xee2c[_0x42bdad];return _0x122626;};'use strict';var multer=require(_0xcee2('0x0'));var util=require('util');var path=require(_0xcee2('0x1'));var timeout=require(_0xcee2('0x2'));var express=require(_0xcee2('0x3'));var router=express[_0xcee2('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcee2('0x5'));var controller=require(_0xcee2('0x6'));router['get']('/',auth[_0xcee2('0x7')](),controller[_0xcee2('0x8')]);router[_0xcee2('0x9')](_0xcee2('0xa'),auth[_0xcee2('0x7')](),controller['describe']);router['get'](_0xcee2('0xb'),auth[_0xcee2('0x7')](),controller[_0xcee2('0xc')]);router[_0xcee2('0x9')](_0xcee2('0xd'),auth[_0xcee2('0x7')](),controller[_0xcee2('0xe')]);router[_0xcee2('0xf')]('/',auth['isAuthenticated'](),controller[_0xcee2('0x10')]);router[_0xcee2('0x11')](_0xcee2('0xd'),auth[_0xcee2('0x7')](),controller[_0xcee2('0x12')]);router['delete'](_0xcee2('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index d6b5cda..91ba811 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 _0x0713=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format'];(function(_0xb5a041,_0x394f01){var _0x187974=function(_0x404261){while(--_0x404261){_0xb5a041['push'](_0xb5a041['shift']());}};_0x187974(++_0x394f01);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3071('0x0')]={'type':{'type':Sequelize[_0x3071('0x1')]},'uniqueid':{'type':Sequelize[_0x3071('0x1')]},'calleridnum':{'type':Sequelize[_0x3071('0x1')]},'calleridname':{'type':Sequelize[_0x3071('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x3071('0x2')],'set':function(_0x33a70c){var _0x3137c8=moment(_0x33a70c);var _0xabd7b6=moment(this[_0x3071('0x3')](_0x3071('0x4')))[_0x3071('0x5')](_0x3071('0x6'));var _0x22274c=_0x3137c8[_0x3071('0x7')](_0xabd7b6,_0x3071('0x8'));this[_0x3071('0x9')]('queuecallerleaveAt',_0x33a70c);this[_0x3071('0x9')](_0x3071('0xa'),_0x22274c||null);}},'position':{'type':Sequelize[_0x3071('0xb')]},'count':{'type':Sequelize[_0x3071('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexit':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x3071('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x3071('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x3071('0x1')]},'accountcode':{'type':Sequelize[_0x3071('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3071('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x3071('0xb')]},'mohtime':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3071('0x1')]},'transfer':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3071('0x1')],'comment':_0x3071('0xd')},'transferexten':{'type':Sequelize[_0x3071('0x1')]},'transferuniqueid':{'type':Sequelize[_0x3071('0x1')]},'disposition':{'type':Sequelize[_0x3071('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3071('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x70e0=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x594655,_0x38b64a){var _0x407f5d=function(_0x5c0575){while(--_0x5c0575){_0x594655['push'](_0x594655['shift']());}};_0x407f5d(++_0x38b64a);}(_0x70e0,0x17b));var _0x070e=function(_0x40a2a2,_0x47c542){_0x40a2a2=_0x40a2a2-0x0;var _0x3cde83=_0x70e0[_0x40a2a2];return _0x3cde83;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));module[_0x070e('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x070e('0x3')]},'calleridname':{'type':Sequelize[_0x070e('0x3')]},'queue':{'type':Sequelize[_0x070e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x7bce9b){var _0x579a6b=moment(_0x7bce9b);var _0x46fe68=moment(this['getDataValue']('queuecallerjoinAt'))['format'](_0x070e('0x5'));var _0x1e11f0=_0x579a6b[_0x070e('0x6')](_0x46fe68,_0x070e('0x7'));this[_0x070e('0x8')](_0x070e('0x9'),_0x7bce9b);this[_0x070e('0x8')]('holdtime',_0x1e11f0||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x070e('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerexit':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x070e('0x3')],'comment':_0x070e('0xc')},'originalposition':{'type':Sequelize[_0x070e('0xa')]},'channel':{'type':Sequelize[_0x070e('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x070e('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x070e('0xa')]},'mohtime':{'type':Sequelize[_0x070e('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x070e('0x3')],'comment':_0x070e('0xd')},'transferexten':{'type':Sequelize[_0x070e('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x070e('0x3')]},'thirdDisposition':{'type':Sequelize[_0x070e('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x070e('0xa')],'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 e2f11f1..8663065 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(_0x1dbc01,_0x3ca8b7){var _0x150eca=function(_0x4ae732){while(--_0x4ae732){_0x1dbc01['push'](_0x1dbc01['shift']());}};_0x150eca(++_0x3ca8b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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(_0x447cd5,_0x21e59a){var _0x162444=function(_0x286fe7){while(--_0x286fe7){_0x447cd5['push'](_0x447cd5['shift']());}};_0x162444(++_0x21e59a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 c23ee6a..9a01910 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 _0x10c0=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x3889c8,_0x512e28){var _0x54d1a5=function(_0x9c64dd){while(--_0x9c64dd){_0x3889c8['push'](_0x3889c8['shift']());}};_0x54d1a5(++_0x512e28);}(_0x10c0,0x12a));var _0x010c=function(_0x3bc298,_0x583d14){_0x3bc298=_0x3bc298-0x0;var _0x31bf58=_0x10c0[_0x3bc298];return _0x31bf58;};'use strict';var EventEmitter=require(_0x010c('0x0'));var VoiceQueueReport=require(_0x010c('0x1'))['db'][_0x010c('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x010c('0x3')](0x0);var events={'afterCreate':_0x010c('0x4'),'afterUpdate':_0x010c('0x5'),'afterDestroy':_0x010c('0x6')};function emitEvent(_0x390e55){return function(_0x262b63,_0x43f9be,_0x3e35e7){VoiceQueueReportEvents[_0x010c('0x7')](_0x390e55+':'+_0x262b63['id'],_0x262b63);VoiceQueueReportEvents[_0x010c('0x7')](_0x390e55,_0x262b63);_0x3e35e7(null);};}for(var e in events){if(events[_0x010c('0x8')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x010c('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xbdaa=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','update','remove','emit','hook'];(function(_0xdbbb55,_0x7f274b){var _0x120929=function(_0x134f53){while(--_0x134f53){_0xdbbb55['push'](_0xdbbb55['shift']());}};_0x120929(++_0x7f274b);}(_0xbdaa,0xd0));var _0xabda=function(_0x32c4b0,_0x5954b3){_0x32c4b0=_0x32c4b0-0x0;var _0x1a0338=_0xbdaa[_0x32c4b0];return _0x1a0338;};'use strict';var EventEmitter=require(_0xabda('0x0'));var VoiceQueueReport=require(_0xabda('0x1'))['db'][_0xabda('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xabda('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xabda('0x4'),'afterDestroy':_0xabda('0x5')};function emitEvent(_0x3ba455){return function(_0x767e97,_0x32d8a2,_0x421c74){VoiceQueueReportEvents['emit'](_0x3ba455+':'+_0x767e97['id'],_0x767e97);VoiceQueueReportEvents[_0xabda('0x6')](_0x3ba455,_0x767e97);_0x421c74(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xabda('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 8513ab9..cc85ad5 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 _0x757a=['./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x34abad,_0x1f7494){var _0x28c67c=function(_0x1af3db){while(--_0x1af3db){_0x34abad['push'](_0x34abad['shift']());}};_0x28c67c(++_0x1f7494);}(_0x757a,0xde));var _0xa757=function(_0x254c19,_0x5df728){_0x254c19=_0x254c19-0x0;var _0x2874fc=_0x757a[_0x254c19];return _0x2874fc;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('VoiceQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'fields':[_0xa757('0xa')]},{'fields':[_0xa757('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['define','report_queue','uniqueid','calleridnum','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x1e7345,_0x18bcce){var _0x33017c=function(_0x2b274f){while(--_0x2b274f){_0x1e7345['push'](_0x1e7345['shift']());}};_0x33017c(++_0x18bcce);}(_0xb10b,0x12a));var _0xbb10=function(_0x533528,_0x409d05){_0x533528=_0x533528-0x0;var _0x3189f1=_0xb10b[_0x533528];return _0x3189f1;};'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 diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 3c83d5d..bd1f2f5 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 _0xde46=['debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','stringify','CreateVoiceQueueReport','VoiceQueueReport','body','update','UpdateVoiceQueueReport','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s'];(function(_0x12a76c,_0x252f75){var _0x485ea0=function(_0x4cd296){while(--_0x4cd296){_0x12a76c['push'](_0x12a76c['shift']());}};_0x485ea0(++_0x252f75);}(_0xde46,0xc9));var _0x6de4=function(_0x15d750,_0x5c3292){_0x15d750=_0x15d750-0x0;var _0x30e99f=_0xde46[_0x15d750];return _0x30e99f;};'use strict';var _=require(_0x6de4('0x0'));var util=require(_0x6de4('0x1'));var moment=require(_0x6de4('0x2'));var BPromise=require('bluebird');var rs=require(_0x6de4('0x3'));var fs=require('fs');var Redis=require(_0x6de4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6de4('0x5'));var logger=require(_0x6de4('0x6'))(_0x6de4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6de4('0x8')][_0x6de4('0x9')]({'port':0x232a});config[_0x6de4('0xa')]=_[_0x6de4('0xb')](config[_0x6de4('0xa')],{'host':_0x6de4('0xc'),'port':0x18eb});var socket=require(_0x6de4('0xd'))(new Redis(config[_0x6de4('0xa')]));require(_0x6de4('0xe'))[_0x6de4('0xf')](socket);function respondWithRpcPromise(_0x2af09a,_0x4023cf,_0x34cb8b){return new BPromise(function(_0x109a77,_0xf16152){return client[_0x6de4('0x10')](_0x2af09a,_0x34cb8b)[_0x6de4('0x11')](function(_0x4a6ad8){logger['info'](_0x6de4('0x12'),_0x4023cf,'request\x20sent');logger[_0x6de4('0x13')](_0x6de4('0x14'),_0x4023cf,'request\x20sent',JSON['stringify'](_0x4a6ad8));if(_0x4a6ad8[_0x6de4('0x15')]){if(_0x4a6ad8[_0x6de4('0x15')][_0x6de4('0x16')]===0x1f4){logger['error'](_0x6de4('0x12'),_0x4023cf,_0x4a6ad8[_0x6de4('0x15')][_0x6de4('0x17')]);return _0xf16152(_0x4a6ad8[_0x6de4('0x15')][_0x6de4('0x17')]);}logger[_0x6de4('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x4023cf,_0x4a6ad8[_0x6de4('0x15')][_0x6de4('0x17')]);return _0x109a77(_0x4a6ad8[_0x6de4('0x15')]['message']);}else{logger[_0x6de4('0x18')](_0x6de4('0x12'),_0x4023cf,_0x6de4('0x19'));_0x109a77(_0x4a6ad8[_0x6de4('0x1a')]['message']);}})[_0x6de4('0x1b')](function(_0x2dabc5){logger[_0x6de4('0x15')](_0x6de4('0x12'),_0x4023cf,_0x2dabc5);_0xf16152(_0x2dabc5);});});}exports[_0x6de4('0x1c')]=function(_0x3ee72f){var _0xbe87bd=this;return new Promise(function(_0x5a01b1,_0x31d795){return db['VoiceQueueReport'][_0x6de4('0x1d')]({'raw':_0x3ee72f[_0x6de4('0x1e')]?_0x3ee72f[_0x6de4('0x1e')][_0x6de4('0x1f')]===undefined?!![]:![]:!![],'where':_0x3ee72f[_0x6de4('0x1e')]?_0x3ee72f[_0x6de4('0x1e')][_0x6de4('0x20')]||null:null,'attributes':_0x3ee72f[_0x6de4('0x1e')]?_0x3ee72f['options'][_0x6de4('0x21')]||null:null,'limit':_0x3ee72f['options']?_0x3ee72f[_0x6de4('0x1e')][_0x6de4('0x22')]||null:null,'include':_0x3ee72f[_0x6de4('0x1e')]?_0x3ee72f[_0x6de4('0x1e')][_0x6de4('0x23')]?_[_0x6de4('0x24')](_0x3ee72f[_0x6de4('0x1e')][_0x6de4('0x23')],function(_0x1a8c5b){return{'model':db[_0x1a8c5b[_0x6de4('0x25')]],'as':_0x1a8c5b['as'],'attributes':_0x1a8c5b[_0x6de4('0x21')],'include':_0x1a8c5b[_0x6de4('0x23')]?_['map'](_0x1a8c5b[_0x6de4('0x23')],function(_0x5dad92){return{'model':db[_0x5dad92['model']],'as':_0x5dad92['as'],'attributes':_0x5dad92['attributes'],'include':_0x5dad92[_0x6de4('0x23')]?_[_0x6de4('0x24')](_0x5dad92[_0x6de4('0x23')],function(_0x333e50){return{'model':db[_0x333e50[_0x6de4('0x25')]],'as':_0x333e50['as'],'attributes':_0x333e50[_0x6de4('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6de4('0x11')](function(_0x5e5ec4){logger[_0x6de4('0x18')](_0x6de4('0x1c'),_0x3ee72f);logger['debug'](_0x6de4('0x1c'),_0x3ee72f,JSON[_0x6de4('0x26')](_0x5e5ec4));_0x5a01b1(_0x5e5ec4);})[_0x6de4('0x1b')](function(_0x341397){logger[_0x6de4('0x15')]('GetVoiceQueueReport',_0x341397[_0x6de4('0x17')],_0x3ee72f);_0x31d795(_0xbe87bd[_0x6de4('0x15')](0x1f4,_0x341397[_0x6de4('0x17')]));});});};exports[_0x6de4('0x27')]=function(_0x53ee8f){var _0x515f0c=this;return new Promise(function(_0x471163,_0x3c9a2e){return db[_0x6de4('0x28')]['create'](_0x53ee8f[_0x6de4('0x29')],{'raw':_0x53ee8f[_0x6de4('0x1e')]?_0x53ee8f['options'][_0x6de4('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x430c4d){logger['info'](_0x6de4('0x27'),_0x53ee8f);logger[_0x6de4('0x13')]('CreateVoiceQueueReport',_0x53ee8f,JSON[_0x6de4('0x26')](_0x430c4d));_0x471163(_0x430c4d);})[_0x6de4('0x1b')](function(_0x3a0f71){logger[_0x6de4('0x15')](_0x6de4('0x27'),_0x3a0f71[_0x6de4('0x17')],_0x53ee8f);_0x3c9a2e(_0x515f0c[_0x6de4('0x15')](0x1f4,_0x3a0f71[_0x6de4('0x17')]));});});};exports['UpdateVoiceQueueReport']=function(_0x272588){var _0x3cc4c8=this;return new Promise(function(_0x35f720,_0x376a23){return db[_0x6de4('0x28')][_0x6de4('0x2a')](_0x272588[_0x6de4('0x29')],{'raw':_0x272588[_0x6de4('0x1e')]?_0x272588['options'][_0x6de4('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x272588['options']?_0x272588['options']['where']||null:null,'attributes':_0x272588[_0x6de4('0x1e')]?_0x272588['options'][_0x6de4('0x21')]||null:null,'limit':_0x272588[_0x6de4('0x1e')]?_0x272588[_0x6de4('0x1e')][_0x6de4('0x22')]||null:null})[_0x6de4('0x11')](function(_0x1f4d80){logger['info'](_0x6de4('0x2b'),_0x272588);logger[_0x6de4('0x13')](_0x6de4('0x2b'),_0x272588,JSON['stringify'](_0x1f4d80));_0x35f720(_0x1f4d80);})['catch'](function(_0x22f6ac){logger[_0x6de4('0x15')](_0x6de4('0x2b'),_0x22f6ac[_0x6de4('0x17')],_0x272588);_0x376a23(_0x3cc4c8[_0x6de4('0x15')](0x1f4,_0x22f6ac[_0x6de4('0x17')]));});});}; \ No newline at end of file +var _0xbbf1=['where','attributes','limit','include','model','map','then','create','raw','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','body','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueueReport,\x20%s,\x20%s','result','catch','GetVoiceQueueReport','VoiceQueueReport','options'];(function(_0x288124,_0x4ce401){var _0x5f0829=function(_0x378479){while(--_0x378479){_0x288124['push'](_0x288124['shift']());}};_0x5f0829(++_0x4ce401);}(_0xbbf1,0x17d));var _0x1bbf=function(_0x3a07c1,_0x34d57f){_0x3a07c1=_0x3a07c1-0x0;var _0x2bbe15=_0xbbf1[_0x3a07c1];return _0x2bbe15;};'use strict';var _=require(_0x1bbf('0x0'));var util=require(_0x1bbf('0x1'));var moment=require('moment');var BPromise=require(_0x1bbf('0x2'));var rs=require(_0x1bbf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1bbf('0x4'))['db'];var utils=require(_0x1bbf('0x5'));var logger=require(_0x1bbf('0x6'))(_0x1bbf('0x7'));var config=require(_0x1bbf('0x8'));var jayson=require(_0x1bbf('0x9'));var client=jayson[_0x1bbf('0xa')][_0x1bbf('0xb')]({'port':0x232a});config[_0x1bbf('0xc')]=_[_0x1bbf('0xd')](config[_0x1bbf('0xc')],{'host':_0x1bbf('0xe'),'port':0x18eb});var socket=require(_0x1bbf('0xf'))(new Redis(config[_0x1bbf('0xc')]));require(_0x1bbf('0x10'))[_0x1bbf('0x11')](socket);function respondWithRpcPromise(_0x403e15,_0x4a4a20,_0x1617c4){return new BPromise(function(_0x18a2a9,_0x193d85){return client[_0x1bbf('0x12')](_0x403e15,_0x1617c4)['then'](function(_0x4b6526){logger[_0x1bbf('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x4a4a20,_0x1bbf('0x14'));logger[_0x1bbf('0x15')](_0x1bbf('0x16'),_0x4a4a20,_0x1bbf('0x14'),JSON[_0x1bbf('0x17')](_0x4b6526));if(_0x4b6526['error']){if(_0x4b6526[_0x1bbf('0x18')][_0x1bbf('0x19')]===0x1f4){logger[_0x1bbf('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x4a4a20,_0x4b6526[_0x1bbf('0x18')][_0x1bbf('0x1a')]);return _0x193d85(_0x4b6526[_0x1bbf('0x18')]['message']);}logger[_0x1bbf('0x18')](_0x1bbf('0x1b'),_0x4a4a20,_0x4b6526['error'][_0x1bbf('0x1a')]);return _0x18a2a9(_0x4b6526[_0x1bbf('0x18')][_0x1bbf('0x1a')]);}else{logger[_0x1bbf('0x13')](_0x1bbf('0x1b'),_0x4a4a20,'request\x20sent');_0x18a2a9(_0x4b6526[_0x1bbf('0x1c')]['message']);}})[_0x1bbf('0x1d')](function(_0x30f4ca){logger[_0x1bbf('0x18')](_0x1bbf('0x1b'),_0x4a4a20,_0x30f4ca);_0x193d85(_0x30f4ca);});});}exports[_0x1bbf('0x1e')]=function(_0x30e39e){var _0x1aa7ff=this;return new Promise(function(_0x515106,_0x35649a){return db[_0x1bbf('0x1f')]['findAll']({'raw':_0x30e39e['options']?_0x30e39e[_0x1bbf('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x30e39e[_0x1bbf('0x20')]?_0x30e39e['options'][_0x1bbf('0x21')]||null:null,'attributes':_0x30e39e[_0x1bbf('0x20')]?_0x30e39e[_0x1bbf('0x20')][_0x1bbf('0x22')]||null:null,'limit':_0x30e39e['options']?_0x30e39e[_0x1bbf('0x20')][_0x1bbf('0x23')]||null:null,'include':_0x30e39e['options']?_0x30e39e[_0x1bbf('0x20')][_0x1bbf('0x24')]?_['map'](_0x30e39e[_0x1bbf('0x20')][_0x1bbf('0x24')],function(_0x30eaeb){return{'model':db[_0x30eaeb[_0x1bbf('0x25')]],'as':_0x30eaeb['as'],'attributes':_0x30eaeb['attributes'],'include':_0x30eaeb[_0x1bbf('0x24')]?_[_0x1bbf('0x26')](_0x30eaeb['include'],function(_0x73b1ff){return{'model':db[_0x73b1ff[_0x1bbf('0x25')]],'as':_0x73b1ff['as'],'attributes':_0x73b1ff[_0x1bbf('0x22')],'include':_0x73b1ff['include']?_[_0x1bbf('0x26')](_0x73b1ff[_0x1bbf('0x24')],function(_0x1255b6){return{'model':db[_0x1255b6[_0x1bbf('0x25')]],'as':_0x1255b6['as'],'attributes':_0x1255b6[_0x1bbf('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1bbf('0x27')](function(_0x4d89ba){logger[_0x1bbf('0x13')](_0x1bbf('0x1e'),_0x30e39e);logger[_0x1bbf('0x15')](_0x1bbf('0x1e'),_0x30e39e,JSON[_0x1bbf('0x17')](_0x4d89ba));_0x515106(_0x4d89ba);})[_0x1bbf('0x1d')](function(_0x2740a6){logger[_0x1bbf('0x18')](_0x1bbf('0x1e'),_0x2740a6['message'],_0x30e39e);_0x35649a(_0x1aa7ff[_0x1bbf('0x18')](0x1f4,_0x2740a6[_0x1bbf('0x1a')]));});});};exports['CreateVoiceQueueReport']=function(_0x39b1ef){var _0x5d9842=this;return new Promise(function(_0xb6f90b,_0x43fdd4){return db['VoiceQueueReport'][_0x1bbf('0x28')](_0x39b1ef['body'],{'raw':_0x39b1ef[_0x1bbf('0x20')]?_0x39b1ef[_0x1bbf('0x20')][_0x1bbf('0x29')]===undefined?!![]:![]:!![]})[_0x1bbf('0x27')](function(_0x567dba){logger['info'](_0x1bbf('0x2a'),_0x39b1ef);logger[_0x1bbf('0x15')](_0x1bbf('0x2a'),_0x39b1ef,JSON[_0x1bbf('0x17')](_0x567dba));_0xb6f90b(_0x567dba);})['catch'](function(_0x52adbc){logger[_0x1bbf('0x18')](_0x1bbf('0x2a'),_0x52adbc['message'],_0x39b1ef);_0x43fdd4(_0x5d9842['error'](0x1f4,_0x52adbc[_0x1bbf('0x1a')]));});});};exports[_0x1bbf('0x2b')]=function(_0x3e9cf3){var _0x1388c9=this;return new Promise(function(_0xbd2164,_0x59ff89){return db[_0x1bbf('0x1f')][_0x1bbf('0x2c')](_0x3e9cf3[_0x1bbf('0x2d')],{'raw':_0x3e9cf3[_0x1bbf('0x20')]?_0x3e9cf3[_0x1bbf('0x20')][_0x1bbf('0x29')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e9cf3[_0x1bbf('0x20')]?_0x3e9cf3[_0x1bbf('0x20')][_0x1bbf('0x21')]||null:null,'attributes':_0x3e9cf3[_0x1bbf('0x20')]?_0x3e9cf3['options'][_0x1bbf('0x22')]||null:null,'limit':_0x3e9cf3['options']?_0x3e9cf3[_0x1bbf('0x20')]['limit']||null:null})['then'](function(_0x23fd93){logger[_0x1bbf('0x13')](_0x1bbf('0x2b'),_0x3e9cf3);logger[_0x1bbf('0x15')]('UpdateVoiceQueueReport',_0x3e9cf3,JSON['stringify'](_0x23fd93));_0xbd2164(_0x23fd93);})[_0x1bbf('0x1d')](function(_0x5ec18b){logger['error']('UpdateVoiceQueueReport',_0x5ec18b[_0x1bbf('0x1a')],_0x3e9cf3);_0x59ff89(_0x1388c9[_0x1bbf('0x18')](0x1f4,_0x5ec18b['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index b32158a..dc73ee8 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 _0x841e=['update','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x383037,_0x45ef15){var _0x4139e7=function(_0x44ff70){while(--_0x44ff70){_0x383037['push'](_0x383037['shift']());}};_0x4139e7(++_0x45ef15);}(_0x841e,0x1e3));var _0xe841=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x841e[_0x432682];return _0x463d05;};'use strict';var VoiceQueueReportEvents=require(_0xe841('0x0'));var events=[_0xe841('0x1'),_0xe841('0x2'),_0xe841('0x3')];function createListener(_0x16315f,_0x184e9b){return function(_0x42d948){_0x184e9b[_0xe841('0x4')](_0x16315f,_0x42d948);};}function removeListener(_0x1f4e85,_0x517a83){return function(){VoiceQueueReportEvents[_0xe841('0x5')](_0x1f4e85,_0x517a83);};}exports[_0xe841('0x6')]=function(_0x3b4f3a){for(var _0x518031=0x0,_0x528423=events[_0xe841('0x7')];_0x518031<_0x528423;_0x518031++){var _0x1e9ced=events[_0x518031];var _0x3ffa21=createListener(_0xe841('0x8')+_0x1e9ced,_0x3b4f3a);VoiceQueueReportEvents['on'](_0x1e9ced,_0x3ffa21);}}; \ No newline at end of file +var _0xe2ee=['save','update','emit','removeListener','register','length','voiceQueueReport:'];(function(_0x149a9b,_0x5bb275){var _0x2c2bf6=function(_0xfe0c14){while(--_0xfe0c14){_0x149a9b['push'](_0x149a9b['shift']());}};_0x2c2bf6(++_0x5bb275);}(_0xe2ee,0x126));var _0xee2e=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0xe2ee[_0x53abe5];return _0xc1c37e;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xee2e('0x0'),'remove',_0xee2e('0x1')];function createListener(_0x1e6427,_0x2231ce){return function(_0x45e341){_0x2231ce[_0xee2e('0x2')](_0x1e6427,_0x45e341);};}function removeListener(_0xfc4edc,_0x4638b1){return function(){VoiceQueueReportEvents[_0xee2e('0x3')](_0xfc4edc,_0x4638b1);};}exports[_0xee2e('0x4')]=function(_0xfa5d9){for(var _0x5e311d=0x0,_0x5ba678=events[_0xee2e('0x5')];_0x5e311d<_0x5ba678;_0x5e311d++){var _0x693c1d=events[_0x5e311d];var _0x363973=createListener(_0xee2e('0x6')+_0x693c1d,_0xfa5d9);VoiceQueueReportEvents['on'](_0x693c1d,_0x363973);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index d6a4b46..70469b0 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 _0x0f96=['path','express','Router','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x0f96,0xb3));var _0x60f9=function(_0x4601aa,_0xb7c18d){_0x4601aa=_0x4601aa-0x0;var _0x426544=_0x0f96[_0x4601aa];return _0x426544;};'use strict';var multer=require('multer');var util=require(_0x60f9('0x0'));var path=require(_0x60f9('0x1'));var timeout=require('connect-timeout');var express=require(_0x60f9('0x2'));var router=express[_0x60f9('0x3')]();var auth=require(_0x60f9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x60f9('0x5'));var controller=require('./voiceQueuesLog.controller');router[_0x60f9('0x6')]('/',auth['isAuthenticated'](),controller[_0x60f9('0x7')]);router[_0x60f9('0x6')](_0x60f9('0x8'),auth[_0x60f9('0x9')](),controller[_0x60f9('0xa')]);router[_0x60f9('0xb')]('/',auth[_0x60f9('0x9')](),controller[_0x60f9('0xc')]);router[_0x60f9('0xd')](_0x60f9('0x8'),auth[_0x60f9('0x9')](),controller[_0x60f9('0xe')]);router[_0x60f9('0xf')](_0x60f9('0x8'),auth[_0x60f9('0x9')](),controller[_0x60f9('0x10')]);module[_0x60f9('0x11')]=router; \ No newline at end of file +var _0x4233=['/:id','update','delete','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','create','put'];(function(_0x201b7f,_0x28e1b0){var _0xefc260=function(_0x182c6f){while(--_0x182c6f){_0x201b7f['push'](_0x201b7f['shift']());}};_0xefc260(++_0x28e1b0);}(_0x4233,0x199));var _0x3423=function(_0x33658f,_0x2c0e95){_0x33658f=_0x33658f-0x0;var _0x271eb7=_0x4233[_0x33658f];return _0x271eb7;};'use strict';var multer=require('multer');var util=require(_0x3423('0x0'));var path=require(_0x3423('0x1'));var timeout=require(_0x3423('0x2'));var express=require('express');var router=express[_0x3423('0x3')]();var auth=require(_0x3423('0x4'));var interaction=require(_0x3423('0x5'));var config=require(_0x3423('0x6'));var controller=require('./voiceQueuesLog.controller');router['get']('/',auth[_0x3423('0x7')](),controller[_0x3423('0x8')]);router['get']('/:id',auth[_0x3423('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3423('0x9')]);router[_0x3423('0xa')](_0x3423('0xb'),auth[_0x3423('0x7')](),controller[_0x3423('0xc')]);router[_0x3423('0xd')](_0x3423('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index d64bea1..7cc415e 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 _0xdd34=['sequelize','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x351477,_0x415e7d){var _0x50f8c8=function(_0x4bc4ff){while(--_0x4bc4ff){_0x351477['push'](_0x351477['shift']());}};_0x50f8c8(++_0x415e7d);}(_0xdd34,0x1db));var _0x4dd3=function(_0x328290,_0x4320d7){_0x328290=_0x328290-0x0;var _0x2af434=_0xdd34[_0x328290];return _0x2af434;};'use strict';var Sequelize=require(_0x4dd3('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0x4dd3('0x1')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x4dd3('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x4dd3('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x4dd3('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x4dd3('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x4dd3('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x4dd3('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x4dd3('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x4dd3('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x4dd3('0x2')],'allowNull':![],'defaultValue':moment()[_0x4dd3('0x3')](_0x4dd3('0x4'))}}; \ No newline at end of file +var _0x293c=['moment','STRING','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x2c5b35,_0x3eb944){var _0x4e884f=function(_0x552e1a){while(--_0x552e1a){_0x2c5b35['push'](_0x2c5b35['shift']());}};_0x4e884f(++_0x3eb944);}(_0x293c,0x16b));var _0xc293=function(_0x1219da,_0x3fad73){_0x1219da=_0x1219da-0x0;var _0x550810=_0x293c[_0x1219da];return _0x550810;};'use strict';var Sequelize=require(_0xc293('0x0'));var moment=require(_0xc293('0x1'));module['exports']={'time':{'type':Sequelize[_0xc293('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xc293('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xc293('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xc293('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xc293('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xc293('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xc293('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()['format'](_0xc293('0x3'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index c412ce9..592af8c 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 _0xa432=['name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','count','includeAll','include','findAll','catch','show','params','length','options','create','body','update','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error'];(function(_0x415f65,_0x32e8f6){var _0x197c18=function(_0x545e8c){while(--_0x545e8c){_0x415f65['push'](_0x415f65['shift']());}};_0x197c18(++_0x32e8f6);}(_0xa432,0x1a5));var _0x2a43=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xa432[_0x1035c1];return _0x308d67;};'use strict';var pdf=require(_0x2a43('0x0'));var emlformat=require(_0x2a43('0x1'));var rimraf=require(_0x2a43('0x2'));var zipdir=require(_0x2a43('0x3'));var jsonpatch=require(_0x2a43('0x4'));var rp=require(_0x2a43('0x5'));var moment=require(_0x2a43('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x2a43('0x7'));var util=require(_0x2a43('0x8'));var path=require(_0x2a43('0x9'));var sox=require(_0x2a43('0xa'));var csv=require(_0x2a43('0xb'));var ejs=require(_0x2a43('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2a43('0xd'));var jsforce=require(_0x2a43('0xe'));var deskjs=require(_0x2a43('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2a43('0x10'));var Papa=require(_0x2a43('0x11'));var Redis=require(_0x2a43('0x12'));var authService=require(_0x2a43('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a43('0x14'));var logger=require(_0x2a43('0x15'))(_0x2a43('0x16'));var utils=require(_0x2a43('0x17'));var config=require(_0x2a43('0x18'));var licenseUtil=require(_0x2a43('0x19'));var db=require(_0x2a43('0x1a'))['db'];function respondWithStatusCode(_0x52d409,_0x414cda){_0x414cda=_0x414cda||0xcc;return function(_0xfbb84c){if(_0xfbb84c){return _0x52d409[_0x2a43('0x1b')](_0x414cda);}return _0x52d409['status'](_0x414cda)[_0x2a43('0x1c')]();};}function respondWithResult(_0x3b7593,_0x1920ca){_0x1920ca=_0x1920ca||0xc8;return function(_0x130a51){if(_0x130a51){return _0x3b7593[_0x2a43('0x1d')](_0x1920ca)[_0x2a43('0x1e')](_0x130a51);}};}function respondWithFilteredResult(_0x4d7490,_0x33848a){return function(_0x477dfa){if(_0x477dfa){var _0xc080c6=_0x477dfa['count'],_0x597d98=_0x33848a[_0x2a43('0x1f')],_0x18469b=_0x33848a[_0x2a43('0x1f')]+_0x33848a[_0x2a43('0x20')],_0x585f64;if(_0x18469b>=_0xc080c6){_0x18469b=_0xc080c6;_0x585f64=0xc8;}else{_0x585f64=0xce;}_0x4d7490['status'](_0x585f64);return _0x4d7490[_0x2a43('0x21')](_0x2a43('0x22'),_0x597d98+'-'+_0x18469b+'/'+_0xc080c6)['json'](_0x477dfa);}return null;};}function patchUpdates(_0x2f73ed){return function(_0x3935f8){try{jsonpatch[_0x2a43('0x23')](_0x3935f8,_0x2f73ed,!![]);}catch(_0x167e62){return BPromise[_0x2a43('0x24')](_0x167e62);}return _0x3935f8[_0x2a43('0x25')]();};}function saveUpdates(_0x1fd6d9,_0x2e79c0){return function(_0x2dc690){if(_0x2dc690){return _0x2dc690['update'](_0x1fd6d9)[_0x2a43('0x26')](function(_0x10424f){return _0x10424f;});}return null;};}function removeEntity(_0x44f3c2,_0x39045a){return function(_0x17cf34){if(_0x17cf34){return _0x17cf34[_0x2a43('0x27')]()['then'](function(){_0x44f3c2[_0x2a43('0x1d')](0xcc)[_0x2a43('0x1c')]();});}};}function handleEntityNotFound(_0x513ba6,_0x3a9e6b){return function(_0x5b67fa){if(!_0x5b67fa){_0x513ba6[_0x2a43('0x1b')](0x194);}return _0x5b67fa;};}function handleError(_0x586b7a,_0x2c93f0){_0x2c93f0=_0x2c93f0||0x1f4;return function(_0x4e6b2b){logger[_0x2a43('0x28')](_0x4e6b2b['stack']);if(_0x4e6b2b[_0x2a43('0x29')]){delete _0x4e6b2b[_0x2a43('0x29')];}_0x586b7a[_0x2a43('0x1d')](_0x2c93f0)[_0x2a43('0x2a')](_0x4e6b2b);};}exports[_0x2a43('0x2b')]=function(_0x29c4df,_0x3f9ecd){var _0xa9eea0={},_0x13bf4f={},_0xf8954={'count':0x0,'rows':[]};var _0x3f296a=_[_0x2a43('0x2c')](db[_0x2a43('0x2d')][_0x2a43('0x2e')],function(_0x272436){return{'name':_0x272436[_0x2a43('0x2f')],'type':_0x272436[_0x2a43('0x30')][_0x2a43('0x31')]};});_0x13bf4f[_0x2a43('0x32')]=_[_0x2a43('0x2c')](_0x3f296a,_0x2a43('0x29'));_0x13bf4f[_0x2a43('0x33')]=_[_0x2a43('0x34')](_0x29c4df[_0x2a43('0x33')]);_0x13bf4f['filters']=_[_0x2a43('0x35')](_0x13bf4f[_0x2a43('0x32')],_0x13bf4f[_0x2a43('0x33')]);_0xa9eea0[_0x2a43('0x36')]=_[_0x2a43('0x35')](_0x13bf4f[_0x2a43('0x32')],qs[_0x2a43('0x37')](_0x29c4df[_0x2a43('0x33')][_0x2a43('0x37')]));_0xa9eea0[_0x2a43('0x36')]=_0xa9eea0[_0x2a43('0x36')]['length']?_0xa9eea0[_0x2a43('0x36')]:_0x13bf4f['model'];if(!_0x29c4df[_0x2a43('0x33')][_0x2a43('0x38')](_0x2a43('0x39'))){_0xa9eea0[_0x2a43('0x20')]=qs[_0x2a43('0x20')](_0x29c4df[_0x2a43('0x33')][_0x2a43('0x20')]);_0xa9eea0[_0x2a43('0x1f')]=qs['offset'](_0x29c4df[_0x2a43('0x33')][_0x2a43('0x1f')]);}_0xa9eea0['order']=qs[_0x2a43('0x3a')](_0x29c4df[_0x2a43('0x33')][_0x2a43('0x3a')]);_0xa9eea0[_0x2a43('0x3b')]=qs[_0x2a43('0x3c')](_[_0x2a43('0x3d')](_0x29c4df[_0x2a43('0x33')],_0x13bf4f[_0x2a43('0x3c')]),_0x3f296a);if(_0x29c4df[_0x2a43('0x33')]['filter']){_0xa9eea0['where']=_[_0x2a43('0x3e')](_0xa9eea0[_0x2a43('0x3b')],{'$or':_[_0x2a43('0x2c')](_0x3f296a,function(_0x18634a){if(_0x18634a[_0x2a43('0x30')]!==_0x2a43('0x3f')){var _0x244e50={};_0x244e50[_0x18634a[_0x2a43('0x29')]]={'$like':'%'+_0x29c4df[_0x2a43('0x33')]['filter']+'%'};return _0x244e50;}})});}_0xa9eea0=_[_0x2a43('0x3e')]({},_0xa9eea0,_0x29c4df['options']);var _0x1fc2ba={'where':_0xa9eea0['where']};return db[_0x2a43('0x2d')][_0x2a43('0x40')](_0x1fc2ba)[_0x2a43('0x26')](function(_0x8fd6dc){_0xf8954[_0x2a43('0x40')]=_0x8fd6dc;if(_0x29c4df[_0x2a43('0x33')][_0x2a43('0x41')]){_0xa9eea0[_0x2a43('0x42')]=[{'all':!![]}];}return db[_0x2a43('0x2d')][_0x2a43('0x43')](_0xa9eea0);})[_0x2a43('0x26')](function(_0x427100){_0xf8954['rows']=_0x427100;return _0xf8954;})[_0x2a43('0x26')](respondWithFilteredResult(_0x3f9ecd,_0xa9eea0))[_0x2a43('0x44')](handleError(_0x3f9ecd,null));};exports[_0x2a43('0x45')]=function(_0x1fbd8b,_0x1c89e3){var _0x3d36e={'raw':!![],'where':{'id':_0x1fbd8b[_0x2a43('0x46')]['id']}},_0x4b2dab={};_0x4b2dab[_0x2a43('0x32')]=_[_0x2a43('0x34')](db['VoiceQueuesLog'][_0x2a43('0x2e')]);_0x4b2dab[_0x2a43('0x33')]=_[_0x2a43('0x34')](_0x1fbd8b[_0x2a43('0x33')]);_0x4b2dab[_0x2a43('0x3c')]=_[_0x2a43('0x35')](_0x4b2dab[_0x2a43('0x32')],_0x4b2dab[_0x2a43('0x33')]);_0x3d36e[_0x2a43('0x36')]=_[_0x2a43('0x35')](_0x4b2dab[_0x2a43('0x32')],qs['fields'](_0x1fbd8b['query'][_0x2a43('0x37')]));_0x3d36e[_0x2a43('0x36')]=_0x3d36e['attributes'][_0x2a43('0x47')]?_0x3d36e[_0x2a43('0x36')]:_0x4b2dab[_0x2a43('0x32')];if(_0x1fbd8b[_0x2a43('0x33')]['includeAll']){_0x3d36e[_0x2a43('0x42')]=[{'all':!![]}];}_0x3d36e=_[_0x2a43('0x3e')]({},_0x3d36e,_0x1fbd8b[_0x2a43('0x48')]);return db[_0x2a43('0x2d')]['find'](_0x3d36e)[_0x2a43('0x26')](handleEntityNotFound(_0x1c89e3,null))[_0x2a43('0x26')](respondWithResult(_0x1c89e3,null))['catch'](handleError(_0x1c89e3,null));};exports[_0x2a43('0x49')]=function(_0x2fa316,_0x461cf4){return db[_0x2a43('0x2d')]['create'](_0x2fa316[_0x2a43('0x4a')],{})['then'](respondWithResult(_0x461cf4,0xc9))[_0x2a43('0x44')](handleError(_0x461cf4,null));};exports[_0x2a43('0x4b')]=function(_0x96d81d,_0x308070){if(_0x96d81d['body']['id']){delete _0x96d81d[_0x2a43('0x4a')]['id'];}return db[_0x2a43('0x2d')][_0x2a43('0x4c')]({'where':{'id':_0x96d81d[_0x2a43('0x46')]['id']}})[_0x2a43('0x26')](handleEntityNotFound(_0x308070,null))[_0x2a43('0x26')](saveUpdates(_0x96d81d[_0x2a43('0x4a')],null))[_0x2a43('0x26')](respondWithResult(_0x308070,null))[_0x2a43('0x44')](handleError(_0x308070,null));};exports[_0x2a43('0x27')]=function(_0x550f86,_0xdd49bb){return db[_0x2a43('0x2d')]['find']({'where':{'id':_0x550f86[_0x2a43('0x46')]['id']}})[_0x2a43('0x26')](handleEntityNotFound(_0xdd49bb,null))[_0x2a43('0x26')](removeEntity(_0xdd49bb,null))['catch'](handleError(_0xdd49bb,null));}; \ No newline at end of file +var _0xadda=['create','body','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','end','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','model','query','keys','attributes','fields','length','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find'];(function(_0x4812e0,_0x2ccf3c){var _0x252e0f=function(_0x14cdb8){while(--_0x14cdb8){_0x4812e0['push'](_0x4812e0['shift']());}};_0x252e0f(++_0x2ccf3c);}(_0xadda,0x92));var _0xaadd=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xadda[_0xa1e3e3];return _0xc980e9;};'use strict';var pdf=require(_0xaadd('0x0'));var emlformat=require(_0xaadd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xaadd('0x2'));var jsonpatch=require(_0xaadd('0x3'));var rp=require('request-promise');var moment=require(_0xaadd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaadd('0x5'));var util=require(_0xaadd('0x6'));var path=require(_0xaadd('0x7'));var sox=require(_0xaadd('0x8'));var csv=require('to-csv');var ejs=require(_0xaadd('0x9'));var fs=require('fs');var _=require(_0xaadd('0xa'));var squel=require(_0xaadd('0xb'));var crypto=require('crypto');var jsforce=require(_0xaadd('0xc'));var deskjs=require(_0xaadd('0xd'));var toCsv=require(_0xaadd('0xe'));var querystring=require(_0xaadd('0xf'));var Papa=require(_0xaadd('0x10'));var Redis=require(_0xaadd('0x11'));var authService=require(_0xaadd('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaadd('0x13'))(_0xaadd('0x14'));var utils=require('../../config/utils');var config=require(_0xaadd('0x15'));var licenseUtil=require(_0xaadd('0x16'));var db=require(_0xaadd('0x17'))['db'];function respondWithStatusCode(_0x59f969,_0x577913){_0x577913=_0x577913||0xcc;return function(_0x4d68f5){if(_0x4d68f5){return _0x59f969[_0xaadd('0x18')](_0x577913);}return _0x59f969[_0xaadd('0x19')](_0x577913)['end']();};}function respondWithResult(_0xd364ff,_0xe1560e){_0xe1560e=_0xe1560e||0xc8;return function(_0x250178){if(_0x250178){return _0xd364ff[_0xaadd('0x19')](_0xe1560e)[_0xaadd('0x1a')](_0x250178);}};}function respondWithFilteredResult(_0x45efa2,_0x41331e){return function(_0x4e730c){if(_0x4e730c){var _0x2ea8f5=_0x4e730c[_0xaadd('0x1b')],_0x34b4b6=_0x41331e[_0xaadd('0x1c')],_0x331b35=_0x41331e[_0xaadd('0x1c')]+_0x41331e[_0xaadd('0x1d')],_0x56dbb0;if(_0x331b35>=_0x2ea8f5){_0x331b35=_0x2ea8f5;_0x56dbb0=0xc8;}else{_0x56dbb0=0xce;}_0x45efa2[_0xaadd('0x19')](_0x56dbb0);return _0x45efa2['set'](_0xaadd('0x1e'),_0x34b4b6+'-'+_0x331b35+'/'+_0x2ea8f5)['json'](_0x4e730c);}return null;};}function patchUpdates(_0x4370ce){return function(_0x265de7){try{jsonpatch['apply'](_0x265de7,_0x4370ce,!![]);}catch(_0x598912){return BPromise[_0xaadd('0x1f')](_0x598912);}return _0x265de7[_0xaadd('0x20')]();};}function saveUpdates(_0x2b79ba,_0x4baba0){return function(_0x2c8b7f){if(_0x2c8b7f){return _0x2c8b7f[_0xaadd('0x21')](_0x2b79ba)[_0xaadd('0x22')](function(_0x7f7c90){return _0x7f7c90;});}return null;};}function removeEntity(_0x445b63,_0x284034){return function(_0xc26434){if(_0xc26434){return _0xc26434[_0xaadd('0x23')]()['then'](function(){_0x445b63[_0xaadd('0x19')](0xcc)[_0xaadd('0x24')]();});}};}function handleEntityNotFound(_0x130ffe,_0x4a49d4){return function(_0x6c458c){if(!_0x6c458c){_0x130ffe[_0xaadd('0x18')](0x194);}return _0x6c458c;};}function handleError(_0x38828c,_0x55a9f9){_0x55a9f9=_0x55a9f9||0x1f4;return function(_0x590ffa){logger['error'](_0x590ffa[_0xaadd('0x25')]);if(_0x590ffa['name']){delete _0x590ffa[_0xaadd('0x26')];}_0x38828c[_0xaadd('0x19')](_0x55a9f9)[_0xaadd('0x27')](_0x590ffa);};}exports[_0xaadd('0x28')]=function(_0x2e543c,_0x552bfb){var _0x333320={},_0x5717e1={},_0x34cbf0={'count':0x0,'rows':[]};var _0x4e5e6f=_[_0xaadd('0x29')](db[_0xaadd('0x2a')][_0xaadd('0x2b')],function(_0x1f958a){return{'name':_0x1f958a[_0xaadd('0x2c')],'type':_0x1f958a[_0xaadd('0x2d')]['key']};});_0x5717e1[_0xaadd('0x2e')]=_[_0xaadd('0x29')](_0x4e5e6f,_0xaadd('0x26'));_0x5717e1[_0xaadd('0x2f')]=_[_0xaadd('0x30')](_0x2e543c[_0xaadd('0x2f')]);_0x5717e1['filters']=_['intersection'](_0x5717e1['model'],_0x5717e1['query']);_0x333320[_0xaadd('0x31')]=_['intersection'](_0x5717e1[_0xaadd('0x2e')],qs[_0xaadd('0x32')](_0x2e543c['query']['fields']));_0x333320[_0xaadd('0x31')]=_0x333320['attributes'][_0xaadd('0x33')]?_0x333320[_0xaadd('0x31')]:_0x5717e1[_0xaadd('0x2e')];if(!_0x2e543c[_0xaadd('0x2f')]['hasOwnProperty'](_0xaadd('0x34'))){_0x333320[_0xaadd('0x1d')]=qs[_0xaadd('0x1d')](_0x2e543c[_0xaadd('0x2f')][_0xaadd('0x1d')]);_0x333320[_0xaadd('0x1c')]=qs[_0xaadd('0x1c')](_0x2e543c[_0xaadd('0x2f')][_0xaadd('0x1c')]);}_0x333320['order']=qs[_0xaadd('0x35')](_0x2e543c[_0xaadd('0x2f')][_0xaadd('0x35')]);_0x333320[_0xaadd('0x36')]=qs['filters'](_[_0xaadd('0x37')](_0x2e543c[_0xaadd('0x2f')],_0x5717e1[_0xaadd('0x38')]),_0x4e5e6f);if(_0x2e543c[_0xaadd('0x2f')][_0xaadd('0x39')]){_0x333320[_0xaadd('0x36')]=_['merge'](_0x333320[_0xaadd('0x36')],{'$or':_['map'](_0x4e5e6f,function(_0x19fd2f){if(_0x19fd2f['type']!==_0xaadd('0x3a')){var _0x53224c={};_0x53224c[_0x19fd2f[_0xaadd('0x26')]]={'$like':'%'+_0x2e543c[_0xaadd('0x2f')][_0xaadd('0x39')]+'%'};return _0x53224c;}})});}_0x333320=_[_0xaadd('0x3b')]({},_0x333320,_0x2e543c[_0xaadd('0x3c')]);var _0xcc2540={'where':_0x333320[_0xaadd('0x36')]};return db['VoiceQueuesLog'][_0xaadd('0x1b')](_0xcc2540)['then'](function(_0x69eb28){_0x34cbf0[_0xaadd('0x1b')]=_0x69eb28;if(_0x2e543c[_0xaadd('0x2f')][_0xaadd('0x3d')]){_0x333320[_0xaadd('0x3e')]=[{'all':!![]}];}return db[_0xaadd('0x2a')][_0xaadd('0x3f')](_0x333320);})[_0xaadd('0x22')](function(_0x10681a){_0x34cbf0[_0xaadd('0x40')]=_0x10681a;return _0x34cbf0;})[_0xaadd('0x22')](respondWithFilteredResult(_0x552bfb,_0x333320))[_0xaadd('0x41')](handleError(_0x552bfb,null));};exports[_0xaadd('0x42')]=function(_0x17287c,_0x20cea2){var _0x56082a={'raw':!![],'where':{'id':_0x17287c[_0xaadd('0x43')]['id']}},_0x1712dc={};_0x1712dc[_0xaadd('0x2e')]=_['keys'](db['VoiceQueuesLog'][_0xaadd('0x2b')]);_0x1712dc['query']=_[_0xaadd('0x30')](_0x17287c[_0xaadd('0x2f')]);_0x1712dc[_0xaadd('0x38')]=_[_0xaadd('0x44')](_0x1712dc[_0xaadd('0x2e')],_0x1712dc[_0xaadd('0x2f')]);_0x56082a[_0xaadd('0x31')]=_['intersection'](_0x1712dc[_0xaadd('0x2e')],qs['fields'](_0x17287c[_0xaadd('0x2f')][_0xaadd('0x32')]));_0x56082a['attributes']=_0x56082a[_0xaadd('0x31')][_0xaadd('0x33')]?_0x56082a['attributes']:_0x1712dc[_0xaadd('0x2e')];if(_0x17287c[_0xaadd('0x2f')][_0xaadd('0x3d')]){_0x56082a[_0xaadd('0x3e')]=[{'all':!![]}];}_0x56082a=_[_0xaadd('0x3b')]({},_0x56082a,_0x17287c[_0xaadd('0x3c')]);return db['VoiceQueuesLog'][_0xaadd('0x45')](_0x56082a)['then'](handleEntityNotFound(_0x20cea2,null))['then'](respondWithResult(_0x20cea2,null))[_0xaadd('0x41')](handleError(_0x20cea2,null));};exports[_0xaadd('0x46')]=function(_0x3b15e0,_0x15d02f){return db['VoiceQueuesLog'][_0xaadd('0x46')](_0x3b15e0[_0xaadd('0x47')],{})[_0xaadd('0x22')](respondWithResult(_0x15d02f,0xc9))[_0xaadd('0x41')](handleError(_0x15d02f,null));};exports[_0xaadd('0x21')]=function(_0x19a2c8,_0x482be2){if(_0x19a2c8[_0xaadd('0x47')]['id']){delete _0x19a2c8[_0xaadd('0x47')]['id'];}return db[_0xaadd('0x2a')]['find']({'where':{'id':_0x19a2c8[_0xaadd('0x43')]['id']}})[_0xaadd('0x22')](handleEntityNotFound(_0x482be2,null))[_0xaadd('0x22')](saveUpdates(_0x19a2c8[_0xaadd('0x47')],null))[_0xaadd('0x22')](respondWithResult(_0x482be2,null))[_0xaadd('0x41')](handleError(_0x482be2,null));};exports[_0xaadd('0x23')]=function(_0x52ab9f,_0x423c1b){return db[_0xaadd('0x2a')][_0xaadd('0x45')]({'where':{'id':_0x52ab9f[_0xaadd('0x43')]['id']}})[_0xaadd('0x22')](handleEntityNotFound(_0x423c1b,null))[_0xaadd('0x22')](removeEntity(_0x423c1b,null))[_0xaadd('0x41')](handleError(_0x423c1b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index a163b55..34d2a2c 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 _0x8897=['../../config/logger','moment','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','lodash','util'];(function(_0x434d23,_0x408045){var _0x178618=function(_0x27be53){while(--_0x27be53){_0x434d23['push'](_0x434d23['shift']());}};_0x178618(++_0x408045);}(_0x8897,0xc1));var _0x7889=function(_0x1b480b,_0x307559){_0x1b480b=_0x1b480b-0x0;var _0x2e9c22=_0x8897[_0x1b480b];return _0x2e9c22;};'use strict';var _=require(_0x7889('0x0'));var util=require(_0x7889('0x1'));var logger=require(_0x7889('0x2'))('api');var moment=require(_0x7889('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7889('0x4'));var rimraf=require(_0x7889('0x5'));var config=require('../../config/environment');var attributes=require(_0x7889('0x6'));module[_0x7889('0x7')]=function(_0xbf69c1,_0x244cce){return _0xbf69c1[_0x7889('0x8')](_0x7889('0x9'),attributes,{'tableName':_0x7889('0xa'),'paranoid':![],'indexes':[{'name':_0x7889('0xb'),'fields':['event',_0x7889('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x602b=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x602b,0x76));var _0xb602=function(_0x5b2cfa,_0x2123b5){_0x5b2cfa=_0x5b2cfa-0x0;var _0x13abc5=_0x602b[_0x5b2cfa];return _0x13abc5;};'use strict';var _=require(_0xb602('0x0'));var util=require(_0xb602('0x1'));var logger=require(_0xb602('0x2'))(_0xb602('0x3'));var moment=require('moment');var BPromise=require(_0xb602('0x4'));var rp=require(_0xb602('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb602('0x6'));var config=require(_0xb602('0x7'));var attributes=require(_0xb602('0x8'));module[_0xb602('0x9')]=function(_0x3e225d,_0x49f25b){return _0x3e225d[_0xb602('0xa')](_0xb602('0xb'),attributes,{'tableName':_0xb602('0xc'),'paranoid':![],'indexes':[{'name':_0xb602('0xd'),'fields':[_0xb602('0xe'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index e80d9a4..16688a5 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 _0x4483=['stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x3aebcb,_0x6d7023){var _0x127d1d=function(_0x52e087){while(--_0x52e087){_0x3aebcb['push'](_0x3aebcb['shift']());}};_0x127d1d(++_0x6d7023);}(_0x4483,0x1a3));var _0x3448=function(_0x4db303,_0x2244d1){_0x4db303=_0x4db303-0x0;var _0x4a2755=_0x4483[_0x4db303];return _0x4a2755;};'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')]('VoiceQueuesLog,\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 +var _0xdac7=['error','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xa0be1c,_0x152d5d){var _0x546eec=function(_0x371eae){while(--_0x371eae){_0xa0be1c['push'](_0xa0be1c['shift']());}};_0x546eec(++_0x152d5d);}(_0xdac7,0x180));var _0x7dac=function(_0x5c12ac,_0x4137ba){_0x5c12ac=_0x5c12ac-0x0;var _0x3ab5f5=_0xdac7[_0x5c12ac];return _0x3ab5f5;};'use strict';var _=require(_0x7dac('0x0'));var util=require(_0x7dac('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7dac('0x2'));var db=require(_0x7dac('0x3'))['db'];var utils=require(_0x7dac('0x4'));var logger=require(_0x7dac('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7dac('0x6')][_0x7dac('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x505705,_0x28cc84,_0x53c460){return new BPromise(function(_0x3b319f,_0x5ccf75){return client[_0x7dac('0x8')](_0x505705,_0x53c460)[_0x7dac('0x9')](function(_0x45fbdc){logger[_0x7dac('0xa')](_0x7dac('0xb'),_0x28cc84,_0x7dac('0xc'));logger[_0x7dac('0xd')](_0x7dac('0xe'),_0x28cc84,_0x7dac('0xc'),JSON[_0x7dac('0xf')](_0x45fbdc));if(_0x45fbdc['error']){if(_0x45fbdc['error']['code']===0x1f4){logger[_0x7dac('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x28cc84,_0x45fbdc[_0x7dac('0x10')]['message']);return _0x5ccf75(_0x45fbdc[_0x7dac('0x10')][_0x7dac('0x11')]);}logger[_0x7dac('0x10')](_0x7dac('0xb'),_0x28cc84,_0x45fbdc[_0x7dac('0x10')][_0x7dac('0x11')]);return _0x3b319f(_0x45fbdc[_0x7dac('0x10')]['message']);}else{logger[_0x7dac('0xa')]('VoiceQueuesLog,\x20%s,\x20%s',_0x28cc84,'request\x20sent');_0x3b319f(_0x45fbdc[_0x7dac('0x12')][_0x7dac('0x11')]);}})[_0x7dac('0x13')](function(_0x2de4ea){logger[_0x7dac('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x28cc84,_0x2de4ea);_0x5ccf75(_0x2de4ea);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 1e244a2..0d211ee 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 _0x3339=['multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','/:id','show','download','downloads','downloadTranscribe','post','create','runTranscribe','put','delete','exports'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x3339,0x114));var _0x9333=function(_0x2e80cd,_0x5eac05){_0x2e80cd=_0x2e80cd-0x0;var _0x42f240=_0x3339[_0x2e80cd];return _0x42f240;};'use strict';var multer=require(_0x9333('0x0'));var util=require('util');var path=require(_0x9333('0x1'));var timeout=require(_0x9333('0x2'));var express=require(_0x9333('0x3'));var router=express[_0x9333('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9333('0x5'));var config=require(_0x9333('0x6'));var controller=require(_0x9333('0x7'));router[_0x9333('0x8')]('/',auth[_0x9333('0x9')](),controller[_0x9333('0xa')]);router['get'](_0x9333('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x9333('0x8')](_0x9333('0xc'),auth[_0x9333('0x9')](),controller[_0x9333('0xd')]);router[_0x9333('0x8')]('/:id/download',auth[_0x9333('0x9')](),controller[_0x9333('0xe')]);router['get']('/:id/downloads',controller[_0x9333('0xf')]);router[_0x9333('0x8')]('/:id/transcribe',auth[_0x9333('0x9')](),controller[_0x9333('0x10')]);router[_0x9333('0x11')]('/',auth[_0x9333('0x9')](),controller[_0x9333('0x12')]);router['post']('/:id/transcribe',auth[_0x9333('0x9')](),controller[_0x9333('0x13')]);router[_0x9333('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9333('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x9333('0x16')]=router; \ No newline at end of file +var _0xb1e4=['delete','multer','path','express','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','downloads','downloadTranscribe','post','create','/:id/transcribe','put','/:id','update'];(function(_0x13e76c,_0x219b18){var _0x58c337=function(_0xbe3a1e){while(--_0xbe3a1e){_0x13e76c['push'](_0x13e76c['shift']());}};_0x58c337(++_0x219b18);}(_0xb1e4,0x1c9));var _0x4b1e=function(_0x5996cc,_0x36e1c7){_0x5996cc=_0x5996cc-0x0;var _0x1cf8f9=_0xb1e4[_0x5996cc];return _0x1cf8f9;};'use strict';var multer=require(_0x4b1e('0x0'));var util=require('util');var path=require(_0x4b1e('0x1'));var timeout=require('connect-timeout');var express=require(_0x4b1e('0x2'));var router=express[_0x4b1e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4b1e('0x4'));var config=require(_0x4b1e('0x5'));var controller=require(_0x4b1e('0x6'));router[_0x4b1e('0x7')]('/',auth[_0x4b1e('0x8')](),controller[_0x4b1e('0x9')]);router['get'](_0x4b1e('0xa'),auth[_0x4b1e('0x8')](),controller[_0x4b1e('0xb')]);router[_0x4b1e('0x7')]('/:id',auth[_0x4b1e('0x8')](),controller[_0x4b1e('0xc')]);router[_0x4b1e('0x7')](_0x4b1e('0xd'),auth[_0x4b1e('0x8')](),controller[_0x4b1e('0xe')]);router[_0x4b1e('0x7')]('/:id/downloads',controller[_0x4b1e('0xf')]);router[_0x4b1e('0x7')]('/:id/transcribe',auth[_0x4b1e('0x8')](),controller[_0x4b1e('0x10')]);router[_0x4b1e('0x11')]('/',auth[_0x4b1e('0x8')](),controller[_0x4b1e('0x12')]);router['post'](_0x4b1e('0x13'),auth[_0x4b1e('0x8')](),controller['runTranscribe']);router[_0x4b1e('0x14')](_0x4b1e('0x15'),auth[_0x4b1e('0x8')](),controller[_0x4b1e('0x16')]);router[_0x4b1e('0x17')](_0x4b1e('0x15'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 2a5f8af..60ae6f5 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 _0x2342=['extname','STRING','setDataValue','channel','membername','split','INTEGER','TEXT','NEW','FLOAT','DATE','createdAt','MM-DD-YYYY\x20HH:mm','format','toString','path','VIRTUAL','getDataValue','value'];(function(_0x46352f,_0xdf0ce1){var _0x3721eb=function(_0xe08c29){while(--_0xe08c29){_0x46352f['push'](_0x46352f['shift']());}};_0x3721eb(++_0xdf0ce1);}(_0x2342,0x178));var _0x2234=function(_0x13b0d8,_0x223f34){_0x13b0d8=_0x13b0d8-0x0;var _0x90fa76=_0x2342[_0x13b0d8];return _0x90fa76;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0x2234('0x0'));module['exports']={'format':{'type':Sequelize[_0x2234('0x1')],'get':function(){return this[_0x2234('0x2')](_0x2234('0x3'))?path[_0x2234('0x4')](this['getDataValue'](_0x2234('0x3'))):undefined;}},'uniqueid':{'type':Sequelize[_0x2234('0x5')]},'channel':{'type':Sequelize[_0x2234('0x5')],'set':function(_0x2b1ca0){if(_0x2b1ca0){this[_0x2234('0x6')](_0x2234('0x7'),_0x2b1ca0);this['setDataValue'](_0x2234('0x8'),_0x2b1ca0[_0x2234('0x9')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x2234('0x5')]},'calleridnum':{'type':Sequelize[_0x2234('0x5')]},'calleridname':{'type':Sequelize[_0x2234('0x5')]},'connectedlinenum':{'type':Sequelize[_0x2234('0x5')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2234('0x5')]},'context':{'type':Sequelize[_0x2234('0x5')]},'exten':{'type':Sequelize[_0x2234('0x5')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2234('0x5')]},'rating':{'type':Sequelize[_0x2234('0xa')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x2234('0x5')]},'userSecondDisposition':{'type':Sequelize[_0x2234('0x5')]},'userThirdDisposition':{'type':Sequelize[_0x2234('0x5')]},'location':{'type':Sequelize[_0x2234('0xb')]},'transcribeName':{'type':Sequelize[_0x2234('0x5')]},'transcribeStatus':{'type':Sequelize[_0x2234('0x5')],'defaultValue':_0x2234('0xc')},'fileUri':{'type':Sequelize[_0x2234('0xb')]},'fileText':{'type':Sequelize[_0x2234('0xb')]},'failureReason':{'type':Sequelize[_0x2234('0xb')]},'sentiment':{'type':Sequelize['STRING']},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0x2234('0xd')]},'sNeutral':{'type':Sequelize[_0x2234('0xd')]},'sMixed':{'type':Sequelize[_0x2234('0xd')]},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x2234('0xe')],'get':function(){return moment(this['getDataValue'](_0x2234('0xf')))['format'](_0x2234('0x10'))['toString']();}},'updatedAt':{'type':Sequelize[_0x2234('0xe')],'get':function(){return moment(this[_0x2234('0x2')]('updatedAt'))[_0x2234('0x11')](_0x2234('0x10'))[_0x2234('0x12')]();}}}; \ No newline at end of file +var _0x32f0=['exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','channel','membername','split','INTEGER','TEXT','NEW','FLOAT','DATE','createdAt','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','path'];(function(_0x59dbf3,_0x13adc6){var _0x1a8147=function(_0x171ad5){while(--_0x171ad5){_0x59dbf3['push'](_0x59dbf3['shift']());}};_0x1a8147(++_0x13adc6);}(_0x32f0,0x178));var _0x032f=function(_0x5f0501,_0x19196e){_0x5f0501=_0x5f0501-0x0;var _0x3c2c45=_0x32f0[_0x5f0501];return _0x3c2c45;};'use strict';var Sequelize=require(_0x032f('0x0'));var moment=require('moment');var path=require(_0x032f('0x1'));module[_0x032f('0x2')]={'format':{'type':Sequelize[_0x032f('0x3')],'get':function(){return this[_0x032f('0x4')](_0x032f('0x5'))?path[_0x032f('0x6')](this[_0x032f('0x4')](_0x032f('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x032f('0x7')]},'channel':{'type':Sequelize[_0x032f('0x7')],'set':function(_0x2f1fb3){if(_0x2f1fb3){this[_0x032f('0x8')](_0x032f('0x9'),_0x2f1fb3);this[_0x032f('0x8')](_0x032f('0xa'),_0x2f1fb3[_0x032f('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x032f('0x7')]},'calleridname':{'type':Sequelize[_0x032f('0x7')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x032f('0x7')]},'accountcode':{'type':Sequelize[_0x032f('0x7')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x032f('0x7')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x032f('0x7')]},'rating':{'type':Sequelize[_0x032f('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x032f('0x7')]},'userDisposition':{'type':Sequelize[_0x032f('0x7')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x032f('0x7')]},'location':{'type':Sequelize[_0x032f('0xd')]},'transcribeName':{'type':Sequelize[_0x032f('0x7')]},'transcribeStatus':{'type':Sequelize[_0x032f('0x7')],'defaultValue':_0x032f('0xe')},'fileUri':{'type':Sequelize[_0x032f('0xd')]},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0x032f('0x7')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0x032f('0xf')]},'sNeutral':{'type':Sequelize[_0x032f('0xf')]},'sMixed':{'type':Sequelize[_0x032f('0xf')]},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x032f('0x10')],'get':function(){return moment(this['getDataValue'](_0x032f('0x11')))['format'](_0x032f('0x12'))[_0x032f('0x13')]();}},'updatedAt':{'type':Sequelize[_0x032f('0x10')],'get':function(){return moment(this[_0x032f('0x4')](_0x032f('0x14')))['format'](_0x032f('0x12'))[_0x032f('0x13')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index f76e480..d67fc7a 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 _0x10ae=['limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','VoiceRecording','rawAttributes','fieldName','model','differenceBy','format','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','map','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','fields','merge','find','create','body','describe','download','../../components/encryptor','uniqueid','params','value','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','sequelize','MD5','col','token','$and','push','recording','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','[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','transcribeName','TranscriptionJobName','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeRegion','runSentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','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','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset'];(function(_0x767fe7,_0x1db449){var _0x47771d=function(_0x1c176b){while(--_0x1c176b){_0x767fe7['push'](_0x767fe7['shift']());}};_0x47771d(++_0x1db449);}(_0x10ae,0x10f));var _0xe10a=function(_0x49b917,_0x4823ed){_0x49b917=_0x49b917-0x0;var _0x462bcf=_0x10ae[_0x49b917];return _0x462bcf;};'use strict';var pdf=require(_0xe10a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe10a('0x1'));var zipdir=require(_0xe10a('0x2'));var jsonpatch=require(_0xe10a('0x3'));var rp=require(_0xe10a('0x4'));var moment=require('moment');var BPromise=require(_0xe10a('0x5'));var Mustache=require(_0xe10a('0x6'));var util=require(_0xe10a('0x7'));var path=require(_0xe10a('0x8'));var sox=require(_0xe10a('0x9'));var csv=require(_0xe10a('0xa'));var ejs=require(_0xe10a('0xb'));var fs=require('fs');var _=require(_0xe10a('0xc'));var squel=require(_0xe10a('0xd'));var crypto=require(_0xe10a('0xe'));var jsforce=require(_0xe10a('0xf'));var deskjs=require(_0xe10a('0x10'));var toCsv=require(_0xe10a('0xa'));var querystring=require(_0xe10a('0x11'));var Papa=require(_0xe10a('0x12'));var AWS=require(_0xe10a('0x13'));var uuidv4=require('uuid/v4');var Redis=require(_0xe10a('0x14'));var authService=require(_0xe10a('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xe10a('0x16'));var hardwareService=require(_0xe10a('0x17'));var logger=require('../../config/logger')(_0xe10a('0x18'));var utils=require(_0xe10a('0x19'));var config=require(_0xe10a('0x1a'));var licenseUtil=require(_0xe10a('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12e01c,_0x3aa00f){_0x3aa00f=_0x3aa00f||0xcc;return function(_0x483e1d){if(_0x483e1d){return _0x12e01c[_0xe10a('0x1c')](_0x3aa00f);}return _0x12e01c[_0xe10a('0x1d')](_0x3aa00f)[_0xe10a('0x1e')]();};}function respondWithResult(_0x276a27,_0x12db39){_0x12db39=_0x12db39||0xc8;return function(_0x44cf91){if(_0x44cf91){return _0x276a27[_0xe10a('0x1d')](_0x12db39)[_0xe10a('0x1f')](_0x44cf91);}};}function respondWithFilteredResult(_0x3b4f1b,_0x464195){return function(_0xdb50db){if(_0xdb50db){var _0x202534=_0xdb50db['count'],_0x3b6117=_0x464195[_0xe10a('0x20')],_0x41ae62=_0x464195[_0xe10a('0x20')]+_0x464195[_0xe10a('0x21')],_0x2b0b1e;if(_0x41ae62>=_0x202534){_0x41ae62=_0x202534;_0x2b0b1e=0xc8;}else{_0x2b0b1e=0xce;}_0x3b4f1b[_0xe10a('0x1d')](_0x2b0b1e);return _0x3b4f1b['set'](_0xe10a('0x22'),_0x3b6117+'-'+_0x41ae62+'/'+_0x202534)[_0xe10a('0x1f')](_0xdb50db);}return null;};}function patchUpdates(_0x43b81a){return function(_0x50157b){try{jsonpatch[_0xe10a('0x23')](_0x50157b,_0x43b81a,!![]);}catch(_0x13e87c){return BPromise[_0xe10a('0x24')](_0x13e87c);}return _0x50157b[_0xe10a('0x25')]();};}function saveUpdates(_0x14b231,_0x509f71){return function(_0x2aea6c){if(_0x2aea6c){return _0x2aea6c[_0xe10a('0x26')](_0x14b231)[_0xe10a('0x27')](function(_0x9f8330){return _0x9f8330;});}return null;};}function removeEntity(_0x237c81,_0x263af6){return function(_0x3b920e){if(_0x3b920e){return _0x3b920e[_0xe10a('0x28')]()[_0xe10a('0x27')](function(){_0x237c81[_0xe10a('0x1d')](0xcc)[_0xe10a('0x1e')]();});}};}function handleEntityNotFound(_0x3f9912,_0x343666){return function(_0x426f26){if(!_0x426f26){_0x3f9912[_0xe10a('0x1c')](0x194);}return _0x426f26;};}function handleError(_0x34fcf9,_0x311232){_0x311232=_0x311232||0x1f4;return function(_0x20c765){logger[_0xe10a('0x29')](_0x20c765[_0xe10a('0x2a')]);if(_0x20c765['name']){delete _0x20c765[_0xe10a('0x2b')];}_0x34fcf9[_0xe10a('0x1d')](_0x311232)[_0xe10a('0x2c')](_0x20c765);};}exports[_0xe10a('0x2d')]=function(_0x43d94d,_0x246736){var _0x582f3e={},_0x2343d6={},_0x45a4bf={'count':0x0,'rows':[]};var _0x5cf258=_['map'](db[_0xe10a('0x2e')][_0xe10a('0x2f')],function(_0x1ac436){return{'name':_0x1ac436[_0xe10a('0x30')],'type':_0x1ac436['type']['key']};});_0x2343d6[_0xe10a('0x31')]=_[_0xe10a('0x32')](_['map'](_0x5cf258,'name'),[_0xe10a('0x33')]);_0x2343d6[_0xe10a('0x34')]=_[_0xe10a('0x35')](_0x43d94d[_0xe10a('0x34')]);_0x2343d6[_0xe10a('0x36')]=_[_0xe10a('0x37')](_0x2343d6['model'],_0x2343d6['query']);_0x582f3e[_0xe10a('0x38')]=_[_0xe10a('0x37')](_0x2343d6['model'],qs['fields'](_0x43d94d[_0xe10a('0x34')]['fields']));_0x582f3e[_0xe10a('0x38')]=_0x582f3e[_0xe10a('0x38')][_0xe10a('0x39')]?_0x582f3e[_0xe10a('0x38')]:_0x2343d6[_0xe10a('0x31')];if(!_0x43d94d['query'][_0xe10a('0x3a')](_0xe10a('0x3b'))){_0x582f3e[_0xe10a('0x21')]=qs[_0xe10a('0x21')](_0x43d94d['query'][_0xe10a('0x21')]);_0x582f3e[_0xe10a('0x20')]=qs[_0xe10a('0x20')](_0x43d94d[_0xe10a('0x34')][_0xe10a('0x20')]);}_0x582f3e[_0xe10a('0x3c')]=qs[_0xe10a('0x3d')](_0x43d94d['query']['sort']);_0x582f3e[_0xe10a('0x3e')]=qs['filters'](_['pick'](_0x43d94d[_0xe10a('0x34')],_0x2343d6['filters']),_0x5cf258);if(_0x43d94d[_0xe10a('0x34')]['filter']){_0x582f3e['where']=_['merge'](_0x582f3e[_0xe10a('0x3e')],{'$or':_[_0xe10a('0x3f')](_0x5cf258,function(_0x53a5bb){if(_0x53a5bb[_0xe10a('0x40')]!==_0xe10a('0x41')){var _0x47e3cb={};_0x47e3cb[_0x53a5bb[_0xe10a('0x2b')]]={'$like':'%'+_0x43d94d[_0xe10a('0x34')][_0xe10a('0x42')]+'%'};return _0x47e3cb;}})});}_0x582f3e=_['merge']({},_0x582f3e,_0x43d94d[_0xe10a('0x43')]);var _0x412aa7={'where':_0x582f3e[_0xe10a('0x3e')]};return db[_0xe10a('0x2e')]['count'](_0x412aa7)['then'](function(_0x5e76a2){_0x45a4bf['count']=_0x5e76a2;if(_0x43d94d[_0xe10a('0x34')][_0xe10a('0x44')]){_0x582f3e[_0xe10a('0x45')]=[{'all':!![]}];}return db[_0xe10a('0x2e')][_0xe10a('0x46')](_0x582f3e);})[_0xe10a('0x27')](function(_0x19f2f5){_0x45a4bf[_0xe10a('0x47')]=_0x19f2f5;return _0x45a4bf;})[_0xe10a('0x27')](respondWithFilteredResult(_0x246736,_0x582f3e))[_0xe10a('0x48')](handleError(_0x246736,null));};exports[_0xe10a('0x49')]=function(_0x2e8418,_0x3fefbf){var _0x23a1e5={'raw':![],'where':{'id':_0x2e8418['params']['id']}},_0x1de9ed={};_0x1de9ed[_0xe10a('0x31')]=_[_0xe10a('0x35')](db[_0xe10a('0x2e')][_0xe10a('0x2f')]);_0x1de9ed[_0xe10a('0x34')]=_['keys'](_0x2e8418[_0xe10a('0x34')]);_0x1de9ed[_0xe10a('0x36')]=_[_0xe10a('0x37')](_0x1de9ed['model'],_0x1de9ed[_0xe10a('0x34')]);_0x23a1e5['attributes']=_[_0xe10a('0x37')](_0x1de9ed[_0xe10a('0x31')],qs[_0xe10a('0x4a')](_0x2e8418[_0xe10a('0x34')][_0xe10a('0x4a')]));_0x23a1e5[_0xe10a('0x38')]=_0x23a1e5[_0xe10a('0x38')][_0xe10a('0x39')]?_0x23a1e5[_0xe10a('0x38')]:_0x1de9ed[_0xe10a('0x31')];if(_0x2e8418[_0xe10a('0x34')][_0xe10a('0x44')]){_0x23a1e5[_0xe10a('0x45')]=[{'all':!![]}];}_0x23a1e5=_[_0xe10a('0x4b')]({},_0x23a1e5,_0x2e8418[_0xe10a('0x43')]);return db[_0xe10a('0x2e')][_0xe10a('0x4c')](_0x23a1e5)[_0xe10a('0x27')](handleEntityNotFound(_0x3fefbf,null))[_0xe10a('0x27')](respondWithResult(_0x3fefbf,null))['catch'](handleError(_0x3fefbf,null));};exports['create']=function(_0x19a947,_0x4230d9){return db['VoiceRecording'][_0xe10a('0x4d')](_0x19a947[_0xe10a('0x4e')],{})[_0xe10a('0x27')](respondWithResult(_0x4230d9,0xc9))['catch'](handleError(_0x4230d9,null));};exports[_0xe10a('0x26')]=function(_0x3fb864,_0x41ca39){if(_0x3fb864[_0xe10a('0x4e')]['id']){delete _0x3fb864[_0xe10a('0x4e')]['id'];}return db[_0xe10a('0x2e')][_0xe10a('0x4c')]({'where':{'id':_0x3fb864['params']['id']}})[_0xe10a('0x27')](handleEntityNotFound(_0x41ca39,null))[_0xe10a('0x27')](saveUpdates(_0x3fb864[_0xe10a('0x4e')],null))[_0xe10a('0x27')](respondWithResult(_0x41ca39,null))[_0xe10a('0x48')](handleError(_0x41ca39,null));};exports['describe']=function(_0x4d1142,_0x3bbba8){return db[_0xe10a('0x2e')][_0xe10a('0x4f')]()[_0xe10a('0x27')](respondWithResult(_0x3bbba8,null))['catch'](handleError(_0x3bbba8,null));};exports[_0xe10a('0x50')]=function(_0x3ab175,_0x3eeff5,_0x26a0ef){var _0x42cbb1=require(_0xe10a('0x51'));var _0x238b83=![];var _0xa829e2={};if(_0x3ab175[_0xe10a('0x34')][_0xe10a('0x40')]&&_0x3ab175[_0xe10a('0x34')][_0xe10a('0x40')]===_0xe10a('0x52')){_0xa829e2[_0xe10a('0x52')]=_0x3ab175['params']['id'];}else{_0xa829e2['id']=_0x3ab175[_0xe10a('0x53')]['id'];}return db[_0xe10a('0x2e')][_0xe10a('0x4c')]({'where':_0xa829e2,'attributes':['id',_0xe10a('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x3eeff5,null))[_0xe10a('0x27')](function(_0x37ed1){if(_0x37ed1){var _0x455111=_0x37ed1[_0xe10a('0x54')];var _0x3cca5d=util['format'](_0xe10a('0x55'),_0x455111);if(fs[_0xe10a('0x56')](_0x3cca5d)){_0x238b83=!![];return _0x42cbb1[_0xe10a('0x57')](_0x3cca5d,_0x455111,config[_0xe10a('0x58')]['recording'])[_0xe10a('0x27')](function(){return _0x37ed1;});}return _0x37ed1;}})[_0xe10a('0x27')](function(_0x50648b){if(_0x50648b){var _0x166e49=_0x50648b[_0xe10a('0x54')];if(!fs[_0xe10a('0x56')](_0x166e49)){throw new db[(_0xe10a('0x59'))][(_0xe10a('0x5a'))](_0xe10a('0x5b'));}if(_0x50648b[_0xe10a('0x5c')]){return _0x3eeff5[_0xe10a('0x50')](_0x166e49,_0x50648b['filename']+path[_0xe10a('0x5d')](_0x166e49),function(){if(_0x238b83){fs['unlink'](_0x166e49);}});}else{return _0x3eeff5[_0xe10a('0x50')](_0x166e49,function(_0x577e83){if(_0x238b83){fs[_0xe10a('0x5e')](_0x166e49);}});}}})['catch'](function(_0x57b8e7){if(_0x57b8e7['message']===_0xe10a('0x5b')){_0x3eeff5[_0xe10a('0x1d')](0x194)['send'](_0xe10a('0x5f'));}else{return handleError(_0x3eeff5,null);}});};exports['downloads']=function(_0x3917c3,_0x503c8f,_0x147f31){var _0x27bd98=require(_0xe10a('0x51'));var _0x4af335=![];var _0x3816d8={'$and':[db[_0xe10a('0x60')][_0xe10a('0x3e')](db[_0xe10a('0x60')]['fn'](_0xe10a('0x61'),db[_0xe10a('0x60')][_0xe10a('0x62')](_0xe10a('0x52'))),_0x3917c3['query'][_0xe10a('0x63')])]};if(_0x3917c3[_0xe10a('0x34')][_0xe10a('0x40')]&&_0x3917c3['query'][_0xe10a('0x40')]==='uniqueid'){_0x3816d8[_0xe10a('0x64')][_0xe10a('0x65')]({'uniqueid':_0x3917c3[_0xe10a('0x53')]['id']});}else{_0x3816d8[_0xe10a('0x64')][_0xe10a('0x65')]({'id':_0x3917c3['params']['id']});}return db['VoiceRecording'][_0xe10a('0x4c')]({'where':_0x3816d8,'attributes':['id',_0xe10a('0x54')],'raw':!![]})[_0xe10a('0x27')](handleEntityNotFound(_0x503c8f,null))[_0xe10a('0x27')](function(_0x3f7886){if(_0x3f7886){var _0x410773=util['format']('%s.cypher',_0x3f7886[_0xe10a('0x54')]);if(fs[_0xe10a('0x56')](_0x410773)){_0x4af335=!![];return _0x27bd98['decryptFile'](_0x410773,_0x3f7886[_0xe10a('0x54')],config[_0xe10a('0x58')][_0xe10a('0x66')])[_0xe10a('0x27')](function(){return _0x3f7886;});}return _0x3f7886;}})[_0xe10a('0x27')](function(_0x3a72d5){if(_0x3a72d5){if(!fs['existsSync'](_0x3a72d5[_0xe10a('0x54')])){throw new db['Sequelize'][(_0xe10a('0x5a'))](_0xe10a('0x5b'));}if(_0x3a72d5[_0xe10a('0x5c')]){return _0x503c8f[_0xe10a('0x50')](_0x3a72d5['value'],_0x3a72d5[_0xe10a('0x5c')]+path[_0xe10a('0x5d')](_0x3a72d5['value']),function(){if(_0x4af335){fs[_0xe10a('0x5e')](_0x3a72d5[_0xe10a('0x54')]);}});}else{return _0x503c8f[_0xe10a('0x50')](_0x3a72d5['value'],function(_0x57805e){if(_0x4af335){fs[_0xe10a('0x5e')](_0x3a72d5[_0xe10a('0x54')]);}});}}})[_0xe10a('0x48')](handleError(_0x503c8f,null));};exports['destroy']=function(_0x4f06b0,_0x3a46b1){return db[_0xe10a('0x2e')][_0xe10a('0x4c')]({'where':{'id':_0x4f06b0[_0xe10a('0x53')]['id']}})[_0xe10a('0x27')](function(_0x2446f6){if(!_0x2446f6)throw new ReferenceError(_0xe10a('0x67'));return _0x2446f6;})[_0xe10a('0x27')](function(_0xac9f9a){var _0x1013c1=_0xac9f9a[_0xe10a('0x54')];logger[_0xe10a('0x68')](_0xe10a('0x69'),_0x1013c1);if(!_[_0xe10a('0x6a')](_0xac9f9a['value'])&&fs[_0xe10a('0x56')](_0x1013c1)){logger['info'](_0xe10a('0x6b')+_0x1013c1+_0xe10a('0x6c'));fs[_0xe10a('0x6d')](_0x1013c1);}_0x1013c1=_0x1013c1+_0xe10a('0x6e');if(!_[_0xe10a('0x6a')](_0xac9f9a['value'])&&fs[_0xe10a('0x56')](_0x1013c1)){logger[_0xe10a('0x68')](_0xe10a('0x6b')+_0x1013c1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x1013c1);}return _0xac9f9a;})[_0xe10a('0x27')](function(_0x59c2d8){if(!_0x59c2d8)throw new InternalError();return _0x59c2d8['destroy']();})[_0xe10a('0x27')](function(){_0x3a46b1[_0xe10a('0x1d')](0xcc)[_0xe10a('0x1e')]();})[_0xe10a('0x48')](handleError(_0x3a46b1,null));};function getBucketslist(_0x52b61e,_0x168187,_0x54da50){return new Promise(function(_0x5e046e,_0x2d75c8){var _0x146da9=new AWS['S3']({'accessKeyId':_0x168187,'secretAccessKey':_0x52b61e,'region':_0x54da50});_0x146da9[_0xe10a('0x6f')]({},function(_0x124dbd,_0xaeae15){if(_0x124dbd){return _0x2d75c8(_0x124dbd);}else{return _0x5e046e(_0xaeae15);}});});}function createBucket(_0x2138e2,_0x5cb191,_0x2a23a8,_0x10e64f){return new Promise(function(_0xa66f53,_0x101fbb){var _0x3e00a2=new AWS['S3']({'accessKeyId':_0x5cb191,'secretAccessKey':_0x2138e2,'region':_0x2a23a8});_0x3e00a2['createBucket']({'Bucket':_0x10e64f},function(_0x4a24d0,_0x24fb80){if(_0x4a24d0){return _0x101fbb(_0x4a24d0);}else{return _0xa66f53(_0x24fb80);}});});}function uploadFile(_0x345ee9,_0x4efaea,_0x4eedc4,_0x1df326,_0x32b153,_0x55b4c4){return new Promise(function(_0x1b2770,_0x1ed356){var _0x17fe85=new AWS['S3']({'accessKeyId':_0x4efaea,'secretAccessKey':_0x345ee9,'region':_0x4eedc4});_0x17fe85[_0xe10a('0x70')]({'Bucket':_0x1df326,'Key':_0x32b153,'Body':_0x55b4c4},function(_0x44fd20,_0x311094){if(_0x44fd20){return _0x1ed356(_0x44fd20);}else{return _0x1b2770(_0x311094);}});});}function startTranscribe(_0x4dc3f2,_0x5b09a1,_0x4d6e77,_0x11a8fe,_0xe61b5b,_0x4121a3){return new Promise(function(_0x3e5335,_0x1228da){var _0x5d4a09=new AWS[(_0xe10a('0x71'))]({'accessKeyId':_0x5b09a1,'secretAccessKey':_0x4dc3f2,'region':_0x4d6e77});_0x5d4a09[_0xe10a('0x72')]({'TranscriptionJobName':_0x11a8fe,'LanguageCode':_0xe61b5b,'Media':{'MediaFileUri':_0x4121a3}},function(_0xf38826,_0x34cd46){if(_0xf38826){return _0x1228da(_0xf38826);}else{return _0x3e5335(_0x34cd46);}});});}function transcribe(_0x338027,_0x635ec5,_0x4a7e94,_0x39ef30,_0x427730,_0x4be0c7,_0x286e73){return new Promise(function(_0x3498cc,_0x394669){var _0x34428f={};logger[_0xe10a('0x68')](util[_0xe10a('0x33')](_0xe10a('0x73'),_0x338027,_0x427730));return uploadFile(_0x635ec5,_0x4a7e94,_0x39ef30,_0x427730,path['basename'](_0x4be0c7),fs['readFileSync'](_0x4be0c7))[_0xe10a('0x27')](function(_0x2c2586){logger['info'](util[_0xe10a('0x33')](_0xe10a('0x74'),_0x338027,_0x427730,_0x2c2586[_0xe10a('0x75')]));_0x34428f[_0xe10a('0x76')]=_0x2c2586[_0xe10a('0x77')];_0x34428f['location']=_0x2c2586['Location'];logger['info'](util[_0xe10a('0x33')](_0xe10a('0x78'),_0x338027));return startTranscribe(_0x635ec5,_0x4a7e94,_0x39ef30,uuidv4(),_0x286e73,_0x2c2586[_0xe10a('0x75')]);})[_0xe10a('0x27')](function(_0x2643a1){logger[_0xe10a('0x68')](util['format'](_0xe10a('0x79'),_0x338027,_0x2643a1[_0xe10a('0x7a')]['TranscriptionJobName']));_0x34428f[_0xe10a('0x7b')]=_0x2643a1[_0xe10a('0x7a')][_0xe10a('0x7c')];_0x34428f['transcribeStatus']=_0x2643a1[_0xe10a('0x7a')][_0xe10a('0x7d')];return _0x3498cc(_0x34428f);})['catch'](function(_0x36c01f){return _0x394669(_0x36c01f);});});}exports['runTranscribe']=function(_0x4c5c82,_0x2f6718,_0x40c613){var _0x55e1ac;var _0x180d48;var _0x77df5;var _0x2a8e8b=require(_0xe10a('0x51'));return db[_0xe10a('0x2e')][_0xe10a('0x7e')]({'where':{'id':_0x4c5c82[_0xe10a('0x53')]['id']}})[_0xe10a('0x27')](function(_0x5e6a83){if(_0x5e6a83){var _0x57c985=util[_0xe10a('0x33')](_0xe10a('0x55'),_0x5e6a83['value']);if(fs[_0xe10a('0x56')](_0x57c985)){cypher=!![];return _0x2a8e8b[_0xe10a('0x57')](_0x57c985,_0x5e6a83[_0xe10a('0x54')],config[_0xe10a('0x58')][_0xe10a('0x66')])[_0xe10a('0x27')](function(){return _0x5e6a83;});}return _0x5e6a83;}})['then'](function(_0x43fd46){if(!_0x43fd46){throw new db[(_0xe10a('0x59'))][(_0xe10a('0x5a'))](_0xe10a('0x7f'));}_0x180d48=_0x43fd46;return db[_0xe10a('0x80')][_0xe10a('0x7e')]({'where':{'id':0x1}});})[_0xe10a('0x27')](handleEntityNotFound(_0x2f6718,null))[_0xe10a('0x27')](function(_0xe475f7){if(_0xe475f7){_0x55e1ac=_0xe475f7;if(!_0x55e1ac[_0xe10a('0x81')]||!_0x55e1ac['transcribeAccountId']||!_0x55e1ac[_0xe10a('0x82')]||!_0x55e1ac['language']||!_0x55e1ac[_0xe10a('0x76')]){throw new db[(_0xe10a('0x59'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x4c5c82['body'][_0xe10a('0x83')]&&(!_0x55e1ac['sentiment']||!_0x55e1ac['sentimentAccountId']||!_0x55e1ac[_0xe10a('0x84')]||!_0x55e1ac[_0xe10a('0x85')]||!_0x55e1ac[_0xe10a('0x76')])){throw new db['Sequelize'][(_0xe10a('0x5a'))](_0xe10a('0x86'));}return db['CloudProvider'][_0xe10a('0x7e')]({'where':{'id':_0x55e1ac[_0xe10a('0x87')]}});}})[_0xe10a('0x27')](function(_0xd51880){if(!_0xd51880){throw new db[(_0xe10a('0x59'))]['ValidationError'](_0xe10a('0x88'));}if(!_0xd51880[_0xe10a('0x89')]||!_0xd51880['data2']){throw new db[(_0xe10a('0x59'))]['ValidationError'](_0xe10a('0x8a'));}_0x77df5=_0xd51880;return getBucketslist(_0x77df5[_0xe10a('0x89')],_0x77df5[_0xe10a('0x8b')],_0x55e1ac[_0xe10a('0x82')]);})['then'](function(_0x3d7121){if(_0x3d7121&&_0x3d7121[_0xe10a('0x8c')]){var _0x54879e=_[_0xe10a('0x4c')](_0x3d7121['Buckets'],function(_0x27dbfa){return _0x27dbfa[_0xe10a('0x8d')]===_0x55e1ac[_0xe10a('0x76')];});if(!_0x54879e){logger[_0xe10a('0x68')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x4c5c82[_0xe10a('0x53')]['id'],_0x55e1ac[_0xe10a('0x76')]));return createBucket(_0x77df5[_0xe10a('0x89')],_0x77df5['data2'],_0x55e1ac['transcribeRegion'],_0x55e1ac[_0xe10a('0x76')]);}logger[_0xe10a('0x68')](util['format'](_0xe10a('0x8e'),_0x4c5c82[_0xe10a('0x53')]['id'],_0x55e1ac['bucket']));return;}})[_0xe10a('0x27')](function(_0x2ab178){if(_0x180d48['transcribeStatus']===_0xe10a('0x8f')){return transcribe(_0x4c5c82['params']['id'],_0x77df5[_0xe10a('0x89')],_0x77df5['data2'],_0x55e1ac[_0xe10a('0x82')],_0x55e1ac[_0xe10a('0x76')],_0x180d48[_0xe10a('0x54')],_0x55e1ac[_0xe10a('0x85')]);}else{logger[_0xe10a('0x68')](util[_0xe10a('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x4c5c82['params']['id']));return{'transcribeStatus':_0xe10a('0x90')};}})[_0xe10a('0x27')](function(_0xd2760b){if(_0xd2760b){_0xd2760b[_0xe10a('0x91')]=_0x4c5c82[_0xe10a('0x4e')]['runSentiment'];return _0x180d48['updateAttributes'](_0xd2760b);}})['then'](respondWithResult(_0x2f6718,null))['catch'](handleError(_0x2f6718,null));};function writeFile(_0x5e19d4,_0x3a6717){return new Promise(function(_0x3c826c,_0x146651){fs[_0xe10a('0x92')](_0x3a6717,_0x5e19d4,function(_0x906718,_0x4e1f8b){if(_0x906718){return _0x146651(_0x906718);}else{return _0x3c826c(_0x4e1f8b);}});});}exports[_0xe10a('0x93')]=function(_0x191534,_0x119445,_0x48f1aa){return db[_0xe10a('0x2e')]['findOne']({'where':{'id':_0x191534[_0xe10a('0x53')]['id']}})[_0xe10a('0x27')](handleEntityNotFound(_0x119445))[_0xe10a('0x27')](function(_0x30e178){if(_0x30e178&&_0x30e178[_0xe10a('0x94')]){var _0x3280a5=_0x30e178[_0xe10a('0x94')];var _0x206949=config[_0xe10a('0x95')]+_0xe10a('0x96')+_0x30e178['id']+_0xe10a('0x97');if(fs[_0xe10a('0x56')](_0x206949)){return _0x206949;}return writeFile(_0x3280a5,_0x206949)['then'](function(){return _0x206949;});}else{throw new db[(_0xe10a('0x59'))][(_0xe10a('0x5a'))]('Transcript\x20not\x20available');}})[_0xe10a('0x27')](function(_0x2db748){return _0x119445[_0xe10a('0x50')](_0x2db748);})[_0xe10a('0x48')](handleError(_0x119445));}; \ No newline at end of file +var _0xcc04=['uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','VoiceRecording','rawAttributes','type','model','differenceBy','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','catch','show','params','merge','find','create','body','describe','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','download','filename','extname','unlink','message','VoiceRecording\x20not\x20found','sequelize','MD5','col','$and','push','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJob','findOne','Setting','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','aws-sdk'];(function(_0x6f29a7,_0x1995a3){var _0x464388=function(_0x1320e5){while(--_0x1320e5){_0x6f29a7['push'](_0x6f29a7['shift']());}};_0x464388(++_0x1995a3);}(_0xcc04,0x1ab));var _0x4cc0=function(_0x124420,_0x32b9ea){_0x124420=_0x124420-0x0;var _0x497804=_0xcc04[_0x124420];return _0x497804;};'use strict';var pdf=require(_0x4cc0('0x0'));var emlformat=require(_0x4cc0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4cc0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4cc0('0x3'));var BPromise=require(_0x4cc0('0x4'));var Mustache=require(_0x4cc0('0x5'));var util=require(_0x4cc0('0x6'));var path=require(_0x4cc0('0x7'));var sox=require(_0x4cc0('0x8'));var csv=require(_0x4cc0('0x9'));var ejs=require(_0x4cc0('0xa'));var fs=require('fs');var _=require(_0x4cc0('0xb'));var squel=require('squel');var crypto=require(_0x4cc0('0xc'));var jsforce=require(_0x4cc0('0xd'));var deskjs=require(_0x4cc0('0xe'));var toCsv=require(_0x4cc0('0x9'));var querystring=require('querystring');var Papa=require(_0x4cc0('0xf'));var AWS=require(_0x4cc0('0x10'));var uuidv4=require(_0x4cc0('0x11'));var Redis=require(_0x4cc0('0x12'));var authService=require(_0x4cc0('0x13'));var qs=require(_0x4cc0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4cc0('0x15'))(_0x4cc0('0x16'));var utils=require(_0x4cc0('0x17'));var config=require(_0x4cc0('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54f70a,_0x290d3b){_0x290d3b=_0x290d3b||0xcc;return function(_0x17d942){if(_0x17d942){return _0x54f70a[_0x4cc0('0x19')](_0x290d3b);}return _0x54f70a[_0x4cc0('0x1a')](_0x290d3b)[_0x4cc0('0x1b')]();};}function respondWithResult(_0x488128,_0x37ec00){_0x37ec00=_0x37ec00||0xc8;return function(_0x570a3c){if(_0x570a3c){return _0x488128['status'](_0x37ec00)['json'](_0x570a3c);}};}function respondWithFilteredResult(_0xdc83e,_0xc1739f){return function(_0x35e9f0){if(_0x35e9f0){var _0x2f0f4d=_0x35e9f0[_0x4cc0('0x1c')],_0x53116b=_0xc1739f[_0x4cc0('0x1d')],_0x1166f0=_0xc1739f['offset']+_0xc1739f[_0x4cc0('0x1e')],_0x16587a;if(_0x1166f0>=_0x2f0f4d){_0x1166f0=_0x2f0f4d;_0x16587a=0xc8;}else{_0x16587a=0xce;}_0xdc83e[_0x4cc0('0x1a')](_0x16587a);return _0xdc83e['set'](_0x4cc0('0x1f'),_0x53116b+'-'+_0x1166f0+'/'+_0x2f0f4d)['json'](_0x35e9f0);}return null;};}function patchUpdates(_0xbdab87){return function(_0x3e239e){try{jsonpatch[_0x4cc0('0x20')](_0x3e239e,_0xbdab87,!![]);}catch(_0x2948e0){return BPromise[_0x4cc0('0x21')](_0x2948e0);}return _0x3e239e[_0x4cc0('0x22')]();};}function saveUpdates(_0x621a48,_0x13aa72){return function(_0x3f5d1a){if(_0x3f5d1a){return _0x3f5d1a[_0x4cc0('0x23')](_0x621a48)['then'](function(_0x832146){return _0x832146;});}return null;};}function removeEntity(_0x4e08c2,_0x3db9af){return function(_0x194c0a){if(_0x194c0a){return _0x194c0a[_0x4cc0('0x24')]()[_0x4cc0('0x25')](function(){_0x4e08c2[_0x4cc0('0x1a')](0xcc)[_0x4cc0('0x1b')]();});}};}function handleEntityNotFound(_0x5dc7f2,_0x215291){return function(_0x209303){if(!_0x209303){_0x5dc7f2['sendStatus'](0x194);}return _0x209303;};}function handleError(_0x4adc6f,_0x1446e1){_0x1446e1=_0x1446e1||0x1f4;return function(_0x1dfe83){logger[_0x4cc0('0x26')](_0x1dfe83[_0x4cc0('0x27')]);if(_0x1dfe83[_0x4cc0('0x28')]){delete _0x1dfe83[_0x4cc0('0x28')];}_0x4adc6f[_0x4cc0('0x1a')](_0x1446e1)[_0x4cc0('0x29')](_0x1dfe83);};}exports[_0x4cc0('0x2a')]=function(_0xdd8f01,_0x447f76){var _0x2a2ab1={},_0x109243={},_0x597590={'count':0x0,'rows':[]};var _0x4c7a21=_['map'](db[_0x4cc0('0x2b')][_0x4cc0('0x2c')],function(_0xb2399f){return{'name':_0xb2399f['fieldName'],'type':_0xb2399f[_0x4cc0('0x2d')]['key']};});_0x109243[_0x4cc0('0x2e')]=_[_0x4cc0('0x2f')](_[_0x4cc0('0x30')](_0x4c7a21,_0x4cc0('0x28')),['format']);_0x109243['query']=_[_0x4cc0('0x31')](_0xdd8f01[_0x4cc0('0x32')]);_0x109243[_0x4cc0('0x33')]=_[_0x4cc0('0x34')](_0x109243[_0x4cc0('0x2e')],_0x109243[_0x4cc0('0x32')]);_0x2a2ab1[_0x4cc0('0x35')]=_[_0x4cc0('0x34')](_0x109243['model'],qs[_0x4cc0('0x36')](_0xdd8f01[_0x4cc0('0x32')][_0x4cc0('0x36')]));_0x2a2ab1[_0x4cc0('0x35')]=_0x2a2ab1['attributes'][_0x4cc0('0x37')]?_0x2a2ab1[_0x4cc0('0x35')]:_0x109243[_0x4cc0('0x2e')];if(!_0xdd8f01[_0x4cc0('0x32')]['hasOwnProperty'](_0x4cc0('0x38'))){_0x2a2ab1['limit']=qs['limit'](_0xdd8f01[_0x4cc0('0x32')][_0x4cc0('0x1e')]);_0x2a2ab1['offset']=qs[_0x4cc0('0x1d')](_0xdd8f01[_0x4cc0('0x32')]['offset']);}_0x2a2ab1[_0x4cc0('0x39')]=qs[_0x4cc0('0x3a')](_0xdd8f01[_0x4cc0('0x32')][_0x4cc0('0x3a')]);_0x2a2ab1[_0x4cc0('0x3b')]=qs[_0x4cc0('0x33')](_[_0x4cc0('0x3c')](_0xdd8f01[_0x4cc0('0x32')],_0x109243[_0x4cc0('0x33')]),_0x4c7a21);if(_0xdd8f01[_0x4cc0('0x32')][_0x4cc0('0x3d')]){_0x2a2ab1['where']=_['merge'](_0x2a2ab1[_0x4cc0('0x3b')],{'$or':_[_0x4cc0('0x30')](_0x4c7a21,function(_0x455d1d){if(_0x455d1d[_0x4cc0('0x2d')]!==_0x4cc0('0x3e')){var _0x2ade3b={};_0x2ade3b[_0x455d1d[_0x4cc0('0x28')]]={'$like':'%'+_0xdd8f01['query'][_0x4cc0('0x3d')]+'%'};return _0x2ade3b;}})});}_0x2a2ab1=_['merge']({},_0x2a2ab1,_0xdd8f01[_0x4cc0('0x3f')]);var _0xc499bf={'where':_0x2a2ab1[_0x4cc0('0x3b')]};return db[_0x4cc0('0x2b')]['count'](_0xc499bf)[_0x4cc0('0x25')](function(_0x17fe70){_0x597590['count']=_0x17fe70;if(_0xdd8f01[_0x4cc0('0x32')]['includeAll']){_0x2a2ab1['include']=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x2a2ab1);})[_0x4cc0('0x25')](function(_0x1cdaa9){_0x597590['rows']=_0x1cdaa9;return _0x597590;})[_0x4cc0('0x25')](respondWithFilteredResult(_0x447f76,_0x2a2ab1))[_0x4cc0('0x40')](handleError(_0x447f76,null));};exports[_0x4cc0('0x41')]=function(_0x5f436e,_0xd2c340){var _0x3b2cfa={'raw':![],'where':{'id':_0x5f436e[_0x4cc0('0x42')]['id']}},_0x2c5e46={};_0x2c5e46[_0x4cc0('0x2e')]=_[_0x4cc0('0x31')](db[_0x4cc0('0x2b')][_0x4cc0('0x2c')]);_0x2c5e46[_0x4cc0('0x32')]=_[_0x4cc0('0x31')](_0x5f436e['query']);_0x2c5e46[_0x4cc0('0x33')]=_[_0x4cc0('0x34')](_0x2c5e46[_0x4cc0('0x2e')],_0x2c5e46[_0x4cc0('0x32')]);_0x3b2cfa[_0x4cc0('0x35')]=_[_0x4cc0('0x34')](_0x2c5e46['model'],qs[_0x4cc0('0x36')](_0x5f436e[_0x4cc0('0x32')][_0x4cc0('0x36')]));_0x3b2cfa[_0x4cc0('0x35')]=_0x3b2cfa[_0x4cc0('0x35')][_0x4cc0('0x37')]?_0x3b2cfa['attributes']:_0x2c5e46[_0x4cc0('0x2e')];if(_0x5f436e[_0x4cc0('0x32')]['includeAll']){_0x3b2cfa['include']=[{'all':!![]}];}_0x3b2cfa=_[_0x4cc0('0x43')]({},_0x3b2cfa,_0x5f436e[_0x4cc0('0x3f')]);return db[_0x4cc0('0x2b')][_0x4cc0('0x44')](_0x3b2cfa)[_0x4cc0('0x25')](handleEntityNotFound(_0xd2c340,null))[_0x4cc0('0x25')](respondWithResult(_0xd2c340,null))[_0x4cc0('0x40')](handleError(_0xd2c340,null));};exports[_0x4cc0('0x45')]=function(_0x593cb8,_0x393c19){return db['VoiceRecording'][_0x4cc0('0x45')](_0x593cb8[_0x4cc0('0x46')],{})[_0x4cc0('0x25')](respondWithResult(_0x393c19,0xc9))[_0x4cc0('0x40')](handleError(_0x393c19,null));};exports[_0x4cc0('0x23')]=function(_0x2900e2,_0x48e921){if(_0x2900e2['body']['id']){delete _0x2900e2[_0x4cc0('0x46')]['id'];}return db[_0x4cc0('0x2b')]['find']({'where':{'id':_0x2900e2[_0x4cc0('0x42')]['id']}})[_0x4cc0('0x25')](handleEntityNotFound(_0x48e921,null))[_0x4cc0('0x25')](saveUpdates(_0x2900e2[_0x4cc0('0x46')],null))[_0x4cc0('0x25')](respondWithResult(_0x48e921,null))[_0x4cc0('0x40')](handleError(_0x48e921,null));};exports[_0x4cc0('0x47')]=function(_0x37d004,_0x1e4ce2){return db[_0x4cc0('0x2b')][_0x4cc0('0x47')]()[_0x4cc0('0x25')](respondWithResult(_0x1e4ce2,null))['catch'](handleError(_0x1e4ce2,null));};exports['download']=function(_0x52ba4d,_0x497c07,_0xe1cb92){var _0x100835=require(_0x4cc0('0x48'));var _0x26e9b9=![];var _0x45ac9e={};if(_0x52ba4d[_0x4cc0('0x32')][_0x4cc0('0x2d')]&&_0x52ba4d['query'][_0x4cc0('0x2d')]===_0x4cc0('0x49')){_0x45ac9e[_0x4cc0('0x49')]=_0x52ba4d['params']['id'];}else{_0x45ac9e['id']=_0x52ba4d[_0x4cc0('0x42')]['id'];}return db[_0x4cc0('0x2b')][_0x4cc0('0x44')]({'where':_0x45ac9e,'attributes':['id',_0x4cc0('0x4a')],'raw':!![]})[_0x4cc0('0x25')](handleEntityNotFound(_0x497c07,null))[_0x4cc0('0x25')](function(_0x5430cb){if(_0x5430cb){var _0x4debe2=_0x5430cb[_0x4cc0('0x4a')];var _0x922be0=util[_0x4cc0('0x4b')](_0x4cc0('0x4c'),_0x4debe2);if(fs[_0x4cc0('0x4d')](_0x922be0)){_0x26e9b9=!![];return _0x100835[_0x4cc0('0x4e')](_0x922be0,_0x4debe2,config[_0x4cc0('0x4f')][_0x4cc0('0x50')])['then'](function(){return _0x5430cb;});}return _0x5430cb;}})[_0x4cc0('0x25')](function(_0x45698c){if(_0x45698c){var _0x27ddbf=_0x45698c['value'];if(!fs[_0x4cc0('0x4d')](_0x27ddbf)){throw new db[(_0x4cc0('0x51'))][(_0x4cc0('0x52'))]('VoiceRecording\x20not\x20found');}if(_0x45698c['filename']){return _0x497c07[_0x4cc0('0x53')](_0x27ddbf,_0x45698c[_0x4cc0('0x54')]+path[_0x4cc0('0x55')](_0x27ddbf),function(){if(_0x26e9b9){fs[_0x4cc0('0x56')](_0x27ddbf);}});}else{return _0x497c07[_0x4cc0('0x53')](_0x27ddbf,function(_0x2730f3){if(_0x26e9b9){fs[_0x4cc0('0x56')](_0x27ddbf);}});}}})[_0x4cc0('0x40')](function(_0xd48e29){if(_0xd48e29[_0x4cc0('0x57')]===_0x4cc0('0x58')){_0x497c07[_0x4cc0('0x1a')](0x194)[_0x4cc0('0x29')]('Not\x20found');}else{return handleError(_0x497c07,null);}});};exports['downloads']=function(_0x41616f,_0x30bc21,_0x24e691){var _0x3921af=require('../../components/encryptor');var _0x62e7b5=![];var _0x4911ef={'$and':[db[_0x4cc0('0x59')][_0x4cc0('0x3b')](db['sequelize']['fn'](_0x4cc0('0x5a'),db[_0x4cc0('0x59')][_0x4cc0('0x5b')](_0x4cc0('0x49'))),_0x41616f[_0x4cc0('0x32')]['token'])]};if(_0x41616f[_0x4cc0('0x32')][_0x4cc0('0x2d')]&&_0x41616f[_0x4cc0('0x32')][_0x4cc0('0x2d')]===_0x4cc0('0x49')){_0x4911ef[_0x4cc0('0x5c')][_0x4cc0('0x5d')]({'uniqueid':_0x41616f[_0x4cc0('0x42')]['id']});}else{_0x4911ef[_0x4cc0('0x5c')][_0x4cc0('0x5d')]({'id':_0x41616f[_0x4cc0('0x42')]['id']});}return db[_0x4cc0('0x2b')]['find']({'where':_0x4911ef,'attributes':['id','value'],'raw':!![]})[_0x4cc0('0x25')](handleEntityNotFound(_0x30bc21,null))[_0x4cc0('0x25')](function(_0x24df95){if(_0x24df95){var _0x4040ee=util[_0x4cc0('0x4b')](_0x4cc0('0x4c'),_0x24df95[_0x4cc0('0x4a')]);if(fs[_0x4cc0('0x4d')](_0x4040ee)){_0x62e7b5=!![];return _0x3921af[_0x4cc0('0x4e')](_0x4040ee,_0x24df95[_0x4cc0('0x4a')],config[_0x4cc0('0x4f')][_0x4cc0('0x50')])[_0x4cc0('0x25')](function(){return _0x24df95;});}return _0x24df95;}})[_0x4cc0('0x25')](function(_0x3108b6){if(_0x3108b6){if(!fs['existsSync'](_0x3108b6[_0x4cc0('0x4a')])){throw new db['Sequelize'][(_0x4cc0('0x52'))](_0x4cc0('0x58'));}if(_0x3108b6['filename']){return _0x30bc21['download'](_0x3108b6[_0x4cc0('0x4a')],_0x3108b6[_0x4cc0('0x54')]+path['extname'](_0x3108b6[_0x4cc0('0x4a')]),function(){if(_0x62e7b5){fs[_0x4cc0('0x56')](_0x3108b6[_0x4cc0('0x4a')]);}});}else{return _0x30bc21[_0x4cc0('0x53')](_0x3108b6[_0x4cc0('0x4a')],function(_0x2363f4){if(_0x62e7b5){fs['unlink'](_0x3108b6[_0x4cc0('0x4a')]);}});}}})['catch'](handleError(_0x30bc21,null));};exports['destroy']=function(_0x2a9ead,_0x4eff03){return db[_0x4cc0('0x2b')][_0x4cc0('0x44')]({'where':{'id':_0x2a9ead[_0x4cc0('0x42')]['id']}})[_0x4cc0('0x25')](function(_0x4bea4c){if(!_0x4bea4c)throw new ReferenceError(_0x4cc0('0x5e'));return _0x4bea4c;})[_0x4cc0('0x25')](function(_0x115762){var _0x56e387=_0x115762['value'];logger[_0x4cc0('0x5f')](_0x4cc0('0x60'),_0x56e387);if(!_[_0x4cc0('0x61')](_0x115762[_0x4cc0('0x4a')])&&fs[_0x4cc0('0x4d')](_0x56e387)){logger[_0x4cc0('0x5f')](_0x4cc0('0x62')+_0x56e387+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x56e387);}_0x56e387=_0x56e387+_0x4cc0('0x63');if(!_['isNil'](_0x115762[_0x4cc0('0x4a')])&&fs['existsSync'](_0x56e387)){logger['info']('File:\x20\x22'+_0x56e387+_0x4cc0('0x64'));fs[_0x4cc0('0x65')](_0x56e387);}return _0x115762;})[_0x4cc0('0x25')](function(_0x596f8b){if(!_0x596f8b)throw new InternalError();return _0x596f8b['destroy']();})['then'](function(){_0x4eff03[_0x4cc0('0x1a')](0xcc)[_0x4cc0('0x1b')]();})[_0x4cc0('0x40')](handleError(_0x4eff03,null));};function getBucketslist(_0x16d2da,_0x4d8980,_0x24710f){return new Promise(function(_0x28facc,_0x2a301b){var _0xaebb8f=new AWS['S3']({'accessKeyId':_0x4d8980,'secretAccessKey':_0x16d2da,'region':_0x24710f});_0xaebb8f[_0x4cc0('0x66')]({},function(_0x18f01b,_0x14ea8c){if(_0x18f01b){return _0x2a301b(_0x18f01b);}else{return _0x28facc(_0x14ea8c);}});});}function createBucket(_0x2af248,_0x39dea9,_0x5eb399,_0x51bafc){return new Promise(function(_0x3a544c,_0xbb1456){var _0x5ca151=new AWS['S3']({'accessKeyId':_0x39dea9,'secretAccessKey':_0x2af248,'region':_0x5eb399});_0x5ca151[_0x4cc0('0x67')]({'Bucket':_0x51bafc},function(_0x52a7d9,_0x512cd2){if(_0x52a7d9){return _0xbb1456(_0x52a7d9);}else{return _0x3a544c(_0x512cd2);}});});}function uploadFile(_0x4aa40b,_0x16ba4e,_0x3a76b2,_0x2d536b,_0x104bc6,_0x4e7a6f){return new Promise(function(_0x27c676,_0x2d7c93){var _0x11d83c=new AWS['S3']({'accessKeyId':_0x16ba4e,'secretAccessKey':_0x4aa40b,'region':_0x3a76b2});_0x11d83c[_0x4cc0('0x68')]({'Bucket':_0x2d536b,'Key':_0x104bc6,'Body':_0x4e7a6f},function(_0x4c153f,_0x6987be){if(_0x4c153f){return _0x2d7c93(_0x4c153f);}else{return _0x27c676(_0x6987be);}});});}function startTranscribe(_0x222c08,_0x377ced,_0x5d02d7,_0x4ad004,_0x3e50ff,_0x30d23b){return new Promise(function(_0x42b84c,_0x44c32e){var _0x159920=new AWS[(_0x4cc0('0x69'))]({'accessKeyId':_0x377ced,'secretAccessKey':_0x222c08,'region':_0x5d02d7});_0x159920[_0x4cc0('0x6a')]({'TranscriptionJobName':_0x4ad004,'LanguageCode':_0x3e50ff,'Media':{'MediaFileUri':_0x30d23b}},function(_0xeb1a8f,_0x4fe9f9){if(_0xeb1a8f){return _0x44c32e(_0xeb1a8f);}else{return _0x42b84c(_0x4fe9f9);}});});}function transcribe(_0x42d70b,_0x2948ec,_0x31a02e,_0x3710c0,_0x2b3693,_0x3a5b31,_0x175ac3){return new Promise(function(_0x76ab02,_0x98cad2){var _0x1341f9={};logger[_0x4cc0('0x5f')](util[_0x4cc0('0x4b')](_0x4cc0('0x6b'),_0x42d70b,_0x2b3693));return uploadFile(_0x2948ec,_0x31a02e,_0x3710c0,_0x2b3693,path[_0x4cc0('0x6c')](_0x3a5b31),fs[_0x4cc0('0x6d')](_0x3a5b31))['then'](function(_0x12c268){logger[_0x4cc0('0x5f')](util[_0x4cc0('0x4b')](_0x4cc0('0x6e'),_0x42d70b,_0x2b3693,_0x12c268['Location']));_0x1341f9[_0x4cc0('0x6f')]=_0x12c268[_0x4cc0('0x70')];_0x1341f9[_0x4cc0('0x71')]=_0x12c268[_0x4cc0('0x72')];logger['info'](util[_0x4cc0('0x4b')](_0x4cc0('0x73'),_0x42d70b));return startTranscribe(_0x2948ec,_0x31a02e,_0x3710c0,uuidv4(),_0x175ac3,_0x12c268[_0x4cc0('0x72')]);})[_0x4cc0('0x25')](function(_0xdbe958){logger[_0x4cc0('0x5f')](util[_0x4cc0('0x4b')](_0x4cc0('0x74'),_0x42d70b,_0xdbe958['TranscriptionJob']['TranscriptionJobName']));_0x1341f9[_0x4cc0('0x75')]=_0xdbe958['TranscriptionJob'][_0x4cc0('0x76')];_0x1341f9[_0x4cc0('0x77')]=_0xdbe958[_0x4cc0('0x78')]['TranscriptionJobStatus'];return _0x76ab02(_0x1341f9);})[_0x4cc0('0x40')](function(_0x33f92a){return _0x98cad2(_0x33f92a);});});}exports['runTranscribe']=function(_0x561b70,_0x2312fc,_0x4cbfce){var _0xa3cc3d;var _0x563fae;var _0x570188;var _0x576ddf=require(_0x4cc0('0x48'));return db[_0x4cc0('0x2b')][_0x4cc0('0x79')]({'where':{'id':_0x561b70['params']['id']}})['then'](function(_0x1c2858){if(_0x1c2858){var _0x4517d3=util['format'](_0x4cc0('0x4c'),_0x1c2858['value']);if(fs[_0x4cc0('0x4d')](_0x4517d3)){cypher=!![];return _0x576ddf[_0x4cc0('0x4e')](_0x4517d3,_0x1c2858[_0x4cc0('0x4a')],config['secrets'][_0x4cc0('0x50')])[_0x4cc0('0x25')](function(){return _0x1c2858;});}return _0x1c2858;}})[_0x4cc0('0x25')](function(_0x286b04){if(!_0x286b04){throw new db[(_0x4cc0('0x51'))][(_0x4cc0('0x52'))]('Voice\x20Recording\x20not\x20found');}_0x563fae=_0x286b04;return db[_0x4cc0('0x7a')][_0x4cc0('0x79')]({'where':{'id':0x1}});})[_0x4cc0('0x25')](handleEntityNotFound(_0x2312fc,null))['then'](function(_0x497871){if(_0x497871){_0xa3cc3d=_0x497871;if(!_0xa3cc3d[_0x4cc0('0x7b')]||!_0xa3cc3d[_0x4cc0('0x7c')]||!_0xa3cc3d['transcribeRegion']||!_0xa3cc3d[_0x4cc0('0x7d')]||!_0xa3cc3d['bucket']){throw new db[(_0x4cc0('0x51'))][(_0x4cc0('0x52'))](_0x4cc0('0x7e'));}if(_0x561b70[_0x4cc0('0x46')]['runSentiment']&&(!_0xa3cc3d['sentiment']||!_0xa3cc3d['sentimentAccountId']||!_0xa3cc3d[_0x4cc0('0x7f')]||!_0xa3cc3d['language']||!_0xa3cc3d[_0x4cc0('0x6f')])){throw new db['Sequelize'][(_0x4cc0('0x52'))](_0x4cc0('0x80'));}return db[_0x4cc0('0x81')][_0x4cc0('0x79')]({'where':{'id':_0xa3cc3d[_0x4cc0('0x7c')]}});}})[_0x4cc0('0x25')](function(_0x7f88a3){if(!_0x7f88a3){throw new db[(_0x4cc0('0x51'))][(_0x4cc0('0x52'))](_0x4cc0('0x82'));}if(!_0x7f88a3[_0x4cc0('0x83')]||!_0x7f88a3[_0x4cc0('0x84')]){throw new db['Sequelize'][(_0x4cc0('0x52'))](_0x4cc0('0x85'));}_0x570188=_0x7f88a3;return getBucketslist(_0x570188['data1'],_0x570188['data2'],_0xa3cc3d[_0x4cc0('0x86')]);})[_0x4cc0('0x25')](function(_0x12a896){if(_0x12a896&&_0x12a896['Buckets']){var _0x14e8a4=_['find'](_0x12a896[_0x4cc0('0x87')],function(_0x3edfa7){return _0x3edfa7['Name']===_0xa3cc3d[_0x4cc0('0x6f')];});if(!_0x14e8a4){logger[_0x4cc0('0x5f')](util[_0x4cc0('0x4b')](_0x4cc0('0x88'),_0x561b70[_0x4cc0('0x42')]['id'],_0xa3cc3d[_0x4cc0('0x6f')]));return createBucket(_0x570188['data1'],_0x570188[_0x4cc0('0x84')],_0xa3cc3d['transcribeRegion'],_0xa3cc3d[_0x4cc0('0x6f')]);}logger[_0x4cc0('0x5f')](util[_0x4cc0('0x4b')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x561b70['params']['id'],_0xa3cc3d['bucket']));return;}})[_0x4cc0('0x25')](function(_0x2fc111){if(_0x563fae['transcribeStatus']===_0x4cc0('0x89')){return transcribe(_0x561b70['params']['id'],_0x570188[_0x4cc0('0x83')],_0x570188[_0x4cc0('0x84')],_0xa3cc3d['transcribeRegion'],_0xa3cc3d[_0x4cc0('0x6f')],_0x563fae[_0x4cc0('0x4a')],_0xa3cc3d[_0x4cc0('0x7d')]);}else{logger[_0x4cc0('0x5f')](util[_0x4cc0('0x4b')](_0x4cc0('0x8a'),_0x561b70[_0x4cc0('0x42')]['id']));return{'transcribeStatus':_0x4cc0('0x8b')};}})[_0x4cc0('0x25')](function(_0x3b633d){if(_0x3b633d){_0x3b633d[_0x4cc0('0x8c')]=_0x561b70[_0x4cc0('0x46')][_0x4cc0('0x8d')];return _0x563fae[_0x4cc0('0x8e')](_0x3b633d);}})[_0x4cc0('0x25')](respondWithResult(_0x2312fc,null))[_0x4cc0('0x40')](handleError(_0x2312fc,null));};function writeFile(_0xfa79e2,_0x43da57){return new Promise(function(_0x3d9192,_0x20d439){fs[_0x4cc0('0x8f')](_0x43da57,_0xfa79e2,function(_0x353b3b,_0xc38d5e){if(_0x353b3b){return _0x20d439(_0x353b3b);}else{return _0x3d9192(_0xc38d5e);}});});}exports[_0x4cc0('0x90')]=function(_0x31bea9,_0x24a5b0,_0x3c4c83){return db[_0x4cc0('0x2b')]['findOne']({'where':{'id':_0x31bea9[_0x4cc0('0x42')]['id']}})[_0x4cc0('0x25')](handleEntityNotFound(_0x24a5b0))['then'](function(_0x5b6fc7){if(_0x5b6fc7&&_0x5b6fc7[_0x4cc0('0x91')]){var _0x3cc35d=_0x5b6fc7[_0x4cc0('0x91')];var _0x1a22be=config['root']+_0x4cc0('0x92')+_0x5b6fc7['id']+_0x4cc0('0x93');if(fs[_0x4cc0('0x4d')](_0x1a22be)){return _0x1a22be;}return writeFile(_0x3cc35d,_0x1a22be)[_0x4cc0('0x25')](function(){return _0x1a22be;});}else{throw new db[(_0x4cc0('0x51'))][(_0x4cc0('0x52'))]('Transcript\x20not\x20available');}})[_0x4cc0('0x25')](function(_0x2e3fa3){return _0x24a5b0['download'](_0x2e3fa3);})['catch'](handleError(_0x24a5b0));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index c44532e..e52b9dd 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 _0xc041=['exports','define','VoiceRecording','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceRecording.attributes'];(function(_0x3b3210,_0x25e8ed){var _0x5b5484=function(_0x417858){while(--_0x417858){_0x3b3210['push'](_0x3b3210['shift']());}};_0x5b5484(++_0x25e8ed);}(_0xc041,0xe8));var _0x1c04=function(_0x223461,_0x2bca70){_0x223461=_0x223461-0x0;var _0x4dbe0a=_0xc041[_0x223461];return _0x4dbe0a;};'use strict';var _=require('lodash');var util=require(_0x1c04('0x0'));var logger=require(_0x1c04('0x1'))(_0x1c04('0x2'));var moment=require('moment');var BPromise=require(_0x1c04('0x3'));var rp=require(_0x1c04('0x4'));var fs=require('fs');var path=require(_0x1c04('0x5'));var rimraf=require(_0x1c04('0x6'));var config=require('../../config/environment');var attributes=require(_0x1c04('0x7'));module[_0x1c04('0x8')]=function(_0x5c7587,_0x50cc5a){return _0x5c7587[_0x1c04('0x9')](_0x1c04('0xa'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x1c04('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d65=['rimraf','../../config/environment','exports','VoiceRecording','uniqueid','lodash','util','api','bluebird','request-promise','path'];(function(_0x31e687,_0x14b3fe){var _0x665f22=function(_0x2e6411){while(--_0x2e6411){_0x31e687['push'](_0x31e687['shift']());}};_0x665f22(++_0x14b3fe);}(_0x1d65,0x14f));var _0x51d6=function(_0x595cb8,_0x1a4b56){_0x595cb8=_0x595cb8-0x0;var _0x35225b=_0x1d65[_0x595cb8];return _0x35225b;};'use strict';var _=require(_0x51d6('0x0'));var util=require(_0x51d6('0x1'));var logger=require('../../config/logger')(_0x51d6('0x2'));var moment=require('moment');var BPromise=require(_0x51d6('0x3'));var rp=require(_0x51d6('0x4'));var fs=require('fs');var path=require(_0x51d6('0x5'));var rimraf=require(_0x51d6('0x6'));var config=require(_0x51d6('0x7'));var attributes=require('./voiceRecording.attributes');module[_0x51d6('0x8')]=function(_0xca708c,_0x2c6e24){return _0xca708c['define'](_0x51d6('0x9'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x51d6('0xa'),'fields':[_0x51d6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 0bab213..959cd65 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(_0x2d6334,_0x442f22){var _0x2ff29d=function(_0x3ea4f7){while(--_0x3ea4f7){_0x2d6334['push'](_0x2d6334['shift']());}};_0x2ff29d(++_0x442f22);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x283952,_0x442596){var _0x57bb99=function(_0x5cd9b6){while(--_0x5cd9b6){_0x283952['push'](_0x283952['shift']());}};_0x57bb99(++_0x442596);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 db95600..1875f5c 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 _0xe945=['show','create','put','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3ff93d,_0x2bc930){var _0x1f6214=function(_0x43d15f){while(--_0x43d15f){_0x3ff93d['push'](_0x3ff93d['shift']());}};_0x1f6214(++_0x2bc930);}(_0xe945,0x1d9));var _0x5e94=function(_0x3b8a42,_0x4003df){_0x3b8a42=_0x3b8a42-0x0;var _0x513913=_0xe945[_0x3b8a42];return _0x513913;};'use strict';var multer=require(_0x5e94('0x0'));var util=require(_0x5e94('0x1'));var path=require('path');var timeout=require(_0x5e94('0x2'));var express=require('express');var router=express[_0x5e94('0x3')]();var auth=require(_0x5e94('0x4'));var interaction=require(_0x5e94('0x5'));var config=require('../../config/environment');var controller=require(_0x5e94('0x6'));router[_0x5e94('0x7')]('/',auth[_0x5e94('0x8')](),controller[_0x5e94('0x9')]);router[_0x5e94('0x7')](_0x5e94('0xa'),auth[_0x5e94('0x8')](),controller[_0x5e94('0xb')]);router['get'](_0x5e94('0xc'),auth[_0x5e94('0x8')](),controller[_0x5e94('0xd')]);router['post']('/',auth[_0x5e94('0x8')](),controller[_0x5e94('0xe')]);router[_0x5e94('0xf')](_0x5e94('0xc'),auth[_0x5e94('0x8')](),controller['update']);router[_0x5e94('0x10')]('/:id',auth[_0x5e94('0x8')](),controller[_0x5e94('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc3ee=['index','get','/describe','isAuthenticated','describe','/:id','put','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x435d49,_0xe63b56){var _0x40a43d=function(_0x427d95){while(--_0x427d95){_0x435d49['push'](_0x435d49['shift']());}};_0x40a43d(++_0xe63b56);}(_0xc3ee,0x19d));var _0xec3e=function(_0x33e519,_0x33b299){_0x33e519=_0x33e519-0x0;var _0x3ae2a1=_0xc3ee[_0x33e519];return _0x3ae2a1;};'use strict';var multer=require(_0xec3e('0x0'));var util=require(_0xec3e('0x1'));var path=require(_0xec3e('0x2'));var timeout=require(_0xec3e('0x3'));var express=require(_0xec3e('0x4'));var router=express[_0xec3e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xec3e('0x6'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xec3e('0x7')]);router[_0xec3e('0x8')](_0xec3e('0x9'),auth[_0xec3e('0xa')](),controller[_0xec3e('0xb')]);router['get'](_0xec3e('0xc'),auth[_0xec3e('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xec3e('0xd')](_0xec3e('0xc'),auth[_0xec3e('0xa')](),controller['update']);router['delete'](_0xec3e('0xc'),auth[_0xec3e('0xa')](),controller['destroy']);module[_0xec3e('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 198bd5d..bdbde9e 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 _0xabbc=['ENUM','blind','attended','STRING','Yes','moment','exports'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xabbc,0x163));var _0xcabb=function(_0x3cadbd,_0x12bc43){_0x3cadbd=_0x3cadbd-0x0;var _0x296da9=_0xabbc[_0x3cadbd];return _0x296da9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcabb('0x0'));module[_0xcabb('0x1')]={'type':{'type':Sequelize[_0xcabb('0x2')](_0xcabb('0x3'),_0xcabb('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xcabb('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xcabb('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xcabb('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xcabb('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xcabb('0x5')]},'transfereechannel':{'type':Sequelize[_0xcabb('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xcabb('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xcabb('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xcabb('0x5')]},'transfereecontext':{'type':Sequelize[_0xcabb('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xcabb('0x5')]},'isexternal':{'type':Sequelize[_0xcabb('0x2')](_0xcabb('0x6'),'No')},'context':{'type':Sequelize[_0xcabb('0x5')]},'extension':{'type':Sequelize[_0xcabb('0x5')]}}; \ No newline at end of file +var _0xcac4=['blind','attended','STRING','Yes','moment','ENUM'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xcac4,0x1ba));var _0x4cac=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xcac4[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4cac('0x0'));module['exports']={'type':{'type':Sequelize[_0x4cac('0x1')](_0x4cac('0x2'),_0x4cac('0x3'))},'result':{'type':Sequelize[_0x4cac('0x4')]},'transfererchannel':{'type':Sequelize[_0x4cac('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x4cac('0x4')]},'transferercalleridname':{'type':Sequelize[_0x4cac('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x4cac('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x4cac('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x4cac('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x4cac('0x4')]},'transfereechannel':{'type':Sequelize[_0x4cac('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x4cac('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x4cac('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x4cac('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x4cac('0x4')]},'transfereecontext':{'type':Sequelize[_0x4cac('0x4')]},'transfereeexten':{'type':Sequelize[_0x4cac('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x4cac('0x4')]},'isexternal':{'type':Sequelize[_0x4cac('0x1')](_0x4cac('0x5'),'No')},'context':{'type':Sequelize[_0x4cac('0x4')]},'extension':{'type':Sequelize[_0x4cac('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index f1d4299..eba9c03 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 _0xee15=['findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','VoiceTransferReport','includeAll','include'];(function(_0x386ee7,_0x22c4cb){var _0x5798c1=function(_0x47b87a){while(--_0x47b87a){_0x386ee7['push'](_0x386ee7['shift']());}};_0x5798c1(++_0x22c4cb);}(_0xee15,0x1c0));var _0x5ee1=function(_0x1fdb40,_0x51351c){_0x1fdb40=_0x1fdb40-0x0;var _0x281f93=_0xee15[_0x1fdb40];return _0x281f93;};'use strict';var pdf=require(_0x5ee1('0x0'));var emlformat=require(_0x5ee1('0x1'));var rimraf=require(_0x5ee1('0x2'));var zipdir=require(_0x5ee1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5ee1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5ee1('0x5'));var util=require('util');var path=require('path');var sox=require(_0x5ee1('0x6'));var csv=require(_0x5ee1('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5ee1('0x8'));var squel=require(_0x5ee1('0x9'));var crypto=require(_0x5ee1('0xa'));var jsforce=require(_0x5ee1('0xb'));var deskjs=require(_0x5ee1('0xc'));var toCsv=require(_0x5ee1('0x7'));var querystring=require(_0x5ee1('0xd'));var Papa=require(_0x5ee1('0xe'));var Redis=require(_0x5ee1('0xf'));var authService=require(_0x5ee1('0x10'));var qs=require(_0x5ee1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ee1('0x12'));var logger=require(_0x5ee1('0x13'))(_0x5ee1('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5ee1('0x15'))['db'];function respondWithStatusCode(_0x5a99cc,_0x37fc2e){_0x37fc2e=_0x37fc2e||0xcc;return function(_0xfb9d30){if(_0xfb9d30){return _0x5a99cc[_0x5ee1('0x16')](_0x37fc2e);}return _0x5a99cc[_0x5ee1('0x17')](_0x37fc2e)[_0x5ee1('0x18')]();};}function respondWithResult(_0x45c068,_0x5a0f6c){_0x5a0f6c=_0x5a0f6c||0xc8;return function(_0x33685d){if(_0x33685d){return _0x45c068[_0x5ee1('0x17')](_0x5a0f6c)[_0x5ee1('0x19')](_0x33685d);}};}function respondWithFilteredResult(_0x82cd8f,_0x1d32ae){return function(_0x5b629d){if(_0x5b629d){var _0x5be8bf=_0x5b629d[_0x5ee1('0x1a')],_0x4373d4=_0x1d32ae[_0x5ee1('0x1b')],_0xeff4a6=_0x1d32ae[_0x5ee1('0x1b')]+_0x1d32ae[_0x5ee1('0x1c')],_0x4d7d80;if(_0xeff4a6>=_0x5be8bf){_0xeff4a6=_0x5be8bf;_0x4d7d80=0xc8;}else{_0x4d7d80=0xce;}_0x82cd8f[_0x5ee1('0x17')](_0x4d7d80);return _0x82cd8f[_0x5ee1('0x1d')]('Content-Range',_0x4373d4+'-'+_0xeff4a6+'/'+_0x5be8bf)['json'](_0x5b629d);}return null;};}function patchUpdates(_0x18ce98){return function(_0x4c4f14){try{jsonpatch[_0x5ee1('0x1e')](_0x4c4f14,_0x18ce98,!![]);}catch(_0x3fc82c){return BPromise['reject'](_0x3fc82c);}return _0x4c4f14[_0x5ee1('0x1f')]();};}function saveUpdates(_0x15f83e,_0xb2745f){return function(_0x1d352f){if(_0x1d352f){return _0x1d352f[_0x5ee1('0x20')](_0x15f83e)[_0x5ee1('0x21')](function(_0xab32c6){return _0xab32c6;});}return null;};}function removeEntity(_0x1ece6d,_0x1c9589){return function(_0x4e29e3){if(_0x4e29e3){return _0x4e29e3[_0x5ee1('0x22')]()[_0x5ee1('0x21')](function(){_0x1ece6d[_0x5ee1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x73446f,_0x2a7865){return function(_0x34a733){if(!_0x34a733){_0x73446f[_0x5ee1('0x16')](0x194);}return _0x34a733;};}function handleError(_0x4af699,_0x1127f4){_0x1127f4=_0x1127f4||0x1f4;return function(_0x15c7d4){logger[_0x5ee1('0x23')](_0x15c7d4[_0x5ee1('0x24')]);if(_0x15c7d4['name']){delete _0x15c7d4[_0x5ee1('0x25')];}_0x4af699[_0x5ee1('0x17')](_0x1127f4)['send'](_0x15c7d4);};}exports[_0x5ee1('0x26')]=function(_0x4cb0f7,_0x13b366){var _0x2cc9d7={},_0x386976={},_0x905e8a={'count':0x0,'rows':[]};var _0x19c933=_[_0x5ee1('0x27')](db['VoiceTransferReport']['rawAttributes'],function(_0x55233d){return{'name':_0x55233d[_0x5ee1('0x28')],'type':_0x55233d['type'][_0x5ee1('0x29')]};});_0x386976[_0x5ee1('0x2a')]=_[_0x5ee1('0x27')](_0x19c933,_0x5ee1('0x25'));_0x386976[_0x5ee1('0x2b')]=_[_0x5ee1('0x2c')](_0x4cb0f7[_0x5ee1('0x2b')]);_0x386976[_0x5ee1('0x2d')]=_[_0x5ee1('0x2e')](_0x386976['model'],_0x386976[_0x5ee1('0x2b')]);_0x2cc9d7[_0x5ee1('0x2f')]=_[_0x5ee1('0x2e')](_0x386976[_0x5ee1('0x2a')],qs[_0x5ee1('0x30')](_0x4cb0f7[_0x5ee1('0x2b')][_0x5ee1('0x30')]));_0x2cc9d7[_0x5ee1('0x2f')]=_0x2cc9d7[_0x5ee1('0x2f')][_0x5ee1('0x31')]?_0x2cc9d7[_0x5ee1('0x2f')]:_0x386976[_0x5ee1('0x2a')];if(!_0x4cb0f7['query'][_0x5ee1('0x32')](_0x5ee1('0x33'))){_0x2cc9d7[_0x5ee1('0x1c')]=qs[_0x5ee1('0x1c')](_0x4cb0f7[_0x5ee1('0x2b')][_0x5ee1('0x1c')]);_0x2cc9d7['offset']=qs['offset'](_0x4cb0f7[_0x5ee1('0x2b')][_0x5ee1('0x1b')]);}_0x2cc9d7[_0x5ee1('0x34')]=qs[_0x5ee1('0x35')](_0x4cb0f7['query']['sort']);_0x2cc9d7[_0x5ee1('0x36')]=qs[_0x5ee1('0x2d')](_['pick'](_0x4cb0f7[_0x5ee1('0x2b')],_0x386976['filters']),_0x19c933);if(_0x4cb0f7[_0x5ee1('0x2b')][_0x5ee1('0x37')]){_0x2cc9d7['where']=_[_0x5ee1('0x38')](_0x2cc9d7[_0x5ee1('0x36')],{'$or':_[_0x5ee1('0x27')](_0x19c933,function(_0x4de1b4){if(_0x4de1b4[_0x5ee1('0x39')]!==_0x5ee1('0x3a')){var _0xa594f1={};_0xa594f1[_0x4de1b4[_0x5ee1('0x25')]]={'$like':'%'+_0x4cb0f7[_0x5ee1('0x2b')][_0x5ee1('0x37')]+'%'};return _0xa594f1;}})});}_0x2cc9d7=_[_0x5ee1('0x38')]({},_0x2cc9d7,_0x4cb0f7[_0x5ee1('0x3b')]);var _0x537176={'where':_0x2cc9d7[_0x5ee1('0x36')]};return db[_0x5ee1('0x3c')][_0x5ee1('0x1a')](_0x537176)[_0x5ee1('0x21')](function(_0x41b1de){_0x905e8a[_0x5ee1('0x1a')]=_0x41b1de;if(_0x4cb0f7['query'][_0x5ee1('0x3d')]){_0x2cc9d7[_0x5ee1('0x3e')]=[{'all':!![]}];}return db[_0x5ee1('0x3c')][_0x5ee1('0x3f')](_0x2cc9d7);})[_0x5ee1('0x21')](function(_0x1f0e65){_0x905e8a[_0x5ee1('0x40')]=_0x1f0e65;return _0x905e8a;})['then'](respondWithFilteredResult(_0x13b366,_0x2cc9d7))[_0x5ee1('0x41')](handleError(_0x13b366,null));};exports[_0x5ee1('0x42')]=function(_0x25703a,_0x2dd659){var _0x428923={'raw':!![],'where':{'id':_0x25703a[_0x5ee1('0x43')]['id']}},_0xc80701={};_0xc80701[_0x5ee1('0x2a')]=_['keys'](db[_0x5ee1('0x3c')][_0x5ee1('0x44')]);_0xc80701[_0x5ee1('0x2b')]=_[_0x5ee1('0x2c')](_0x25703a[_0x5ee1('0x2b')]);_0xc80701[_0x5ee1('0x2d')]=_['intersection'](_0xc80701[_0x5ee1('0x2a')],_0xc80701[_0x5ee1('0x2b')]);_0x428923[_0x5ee1('0x2f')]=_[_0x5ee1('0x2e')](_0xc80701[_0x5ee1('0x2a')],qs[_0x5ee1('0x30')](_0x25703a[_0x5ee1('0x2b')][_0x5ee1('0x30')]));_0x428923[_0x5ee1('0x2f')]=_0x428923['attributes']['length']?_0x428923[_0x5ee1('0x2f')]:_0xc80701['model'];if(_0x25703a[_0x5ee1('0x2b')]['includeAll']){_0x428923['include']=[{'all':!![]}];}_0x428923=_[_0x5ee1('0x38')]({},_0x428923,_0x25703a[_0x5ee1('0x3b')]);return db[_0x5ee1('0x3c')][_0x5ee1('0x45')](_0x428923)[_0x5ee1('0x21')](handleEntityNotFound(_0x2dd659,null))['then'](respondWithResult(_0x2dd659,null))[_0x5ee1('0x41')](handleError(_0x2dd659,null));};exports[_0x5ee1('0x46')]=function(_0x3bc932,_0xcce01){return db[_0x5ee1('0x3c')][_0x5ee1('0x46')](_0x3bc932[_0x5ee1('0x47')],{})['then'](respondWithResult(_0xcce01,0xc9))[_0x5ee1('0x41')](handleError(_0xcce01,null));};exports['update']=function(_0x5e51b4,_0x3e7f79){if(_0x5e51b4[_0x5ee1('0x47')]['id']){delete _0x5e51b4['body']['id'];}return db[_0x5ee1('0x3c')]['find']({'where':{'id':_0x5e51b4[_0x5ee1('0x43')]['id']}})[_0x5ee1('0x21')](handleEntityNotFound(_0x3e7f79,null))['then'](saveUpdates(_0x5e51b4[_0x5ee1('0x47')],null))['then'](respondWithResult(_0x3e7f79,null))[_0x5ee1('0x41')](handleError(_0x3e7f79,null));};exports['destroy']=function(_0x19967b,_0x51a04f){return db[_0x5ee1('0x3c')][_0x5ee1('0x45')]({'where':{'id':_0x19967b[_0x5ee1('0x43')]['id']}})[_0x5ee1('0x21')](handleEntityNotFound(_0x51a04f,null))[_0x5ee1('0x21')](removeEntity(_0x51a04f,null))[_0x5ee1('0x41')](handleError(_0x51a04f,null));};exports[_0x5ee1('0x48')]=function(_0x4fc741,_0x2c23df){return db['VoiceTransferReport'][_0x5ee1('0x48')]()[_0x5ee1('0x21')](respondWithResult(_0x2c23df,null))[_0x5ee1('0x41')](handleError(_0x2c23df,null));}; \ No newline at end of file +var _0x408f=['eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','sort','where','filters','filter','merge','count','includeAll','include','rows','catch','show','length','options','create','body','params','describe','html-pdf'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x408f,0x1c1));var _0xf408=function(_0x4f2922,_0x5b5423){_0x4f2922=_0x4f2922-0x0;var _0x29c0e6=_0x408f[_0x4f2922];return _0x29c0e6;};'use strict';var pdf=require(_0xf408('0x0'));var emlformat=require(_0xf408('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf408('0x2'));var jsonpatch=require(_0xf408('0x3'));var rp=require(_0xf408('0x4'));var moment=require('moment');var BPromise=require(_0xf408('0x5'));var Mustache=require(_0xf408('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf408('0x7'));var csv=require(_0xf408('0x8'));var ejs=require(_0xf408('0x9'));var fs=require('fs');var _=require(_0xf408('0xa'));var squel=require(_0xf408('0xb'));var crypto=require(_0xf408('0xc'));var jsforce=require(_0xf408('0xd'));var deskjs=require(_0xf408('0xe'));var toCsv=require(_0xf408('0x8'));var querystring=require(_0xf408('0xf'));var Papa=require(_0xf408('0x10'));var Redis=require(_0xf408('0x11'));var authService=require(_0xf408('0x12'));var qs=require(_0xf408('0x13'));var as=require(_0xf408('0x14'));var hardwareService=require(_0xf408('0x15'));var logger=require(_0xf408('0x16'))(_0xf408('0x17'));var utils=require(_0xf408('0x18'));var config=require(_0xf408('0x19'));var licenseUtil=require(_0xf408('0x1a'));var db=require(_0xf408('0x1b'))['db'];function respondWithStatusCode(_0x407270,_0x1dfb37){_0x1dfb37=_0x1dfb37||0xcc;return function(_0x19f928){if(_0x19f928){return _0x407270['sendStatus'](_0x1dfb37);}return _0x407270[_0xf408('0x1c')](_0x1dfb37)[_0xf408('0x1d')]();};}function respondWithResult(_0x1b5cff,_0x2e4b3b){_0x2e4b3b=_0x2e4b3b||0xc8;return function(_0x4b1661){if(_0x4b1661){return _0x1b5cff[_0xf408('0x1c')](_0x2e4b3b)[_0xf408('0x1e')](_0x4b1661);}};}function respondWithFilteredResult(_0x4fa660,_0x3ebae2){return function(_0x5cbd1d){if(_0x5cbd1d){var _0x3bf552=_0x5cbd1d['count'],_0x4c2d68=_0x3ebae2[_0xf408('0x1f')],_0x1d0ab0=_0x3ebae2[_0xf408('0x1f')]+_0x3ebae2[_0xf408('0x20')],_0xe499e0;if(_0x1d0ab0>=_0x3bf552){_0x1d0ab0=_0x3bf552;_0xe499e0=0xc8;}else{_0xe499e0=0xce;}_0x4fa660[_0xf408('0x1c')](_0xe499e0);return _0x4fa660['set'](_0xf408('0x21'),_0x4c2d68+'-'+_0x1d0ab0+'/'+_0x3bf552)['json'](_0x5cbd1d);}return null;};}function patchUpdates(_0x2ddeb4){return function(_0x2aaccb){try{jsonpatch[_0xf408('0x22')](_0x2aaccb,_0x2ddeb4,!![]);}catch(_0x14b90b){return BPromise[_0xf408('0x23')](_0x14b90b);}return _0x2aaccb[_0xf408('0x24')]();};}function saveUpdates(_0x6bd9cb,_0x45ce72){return function(_0x10c2ea){if(_0x10c2ea){return _0x10c2ea[_0xf408('0x25')](_0x6bd9cb)['then'](function(_0x37a6c1){return _0x37a6c1;});}return null;};}function removeEntity(_0x27d2c0,_0x2bb5bd){return function(_0x5711f8){if(_0x5711f8){return _0x5711f8[_0xf408('0x26')]()[_0xf408('0x27')](function(){_0x27d2c0[_0xf408('0x1c')](0xcc)[_0xf408('0x1d')]();});}};}function handleEntityNotFound(_0x5042,_0x2a074f){return function(_0x330c30){if(!_0x330c30){_0x5042[_0xf408('0x28')](0x194);}return _0x330c30;};}function handleError(_0x35e531,_0x5b3bbd){_0x5b3bbd=_0x5b3bbd||0x1f4;return function(_0x3c9b19){logger[_0xf408('0x29')](_0x3c9b19[_0xf408('0x2a')]);if(_0x3c9b19['name']){delete _0x3c9b19[_0xf408('0x2b')];}_0x35e531[_0xf408('0x1c')](_0x5b3bbd)['send'](_0x3c9b19);};}exports[_0xf408('0x2c')]=function(_0x19bc20,_0x30ced2){var _0x3b2133={},_0xdc3818={},_0x52d94d={'count':0x0,'rows':[]};var _0x2c0d43=_[_0xf408('0x2d')](db[_0xf408('0x2e')][_0xf408('0x2f')],function(_0x3a039f){return{'name':_0x3a039f[_0xf408('0x30')],'type':_0x3a039f[_0xf408('0x31')][_0xf408('0x32')]};});_0xdc3818[_0xf408('0x33')]=_['map'](_0x2c0d43,_0xf408('0x2b'));_0xdc3818[_0xf408('0x34')]=_[_0xf408('0x35')](_0x19bc20[_0xf408('0x34')]);_0xdc3818['filters']=_['intersection'](_0xdc3818[_0xf408('0x33')],_0xdc3818[_0xf408('0x34')]);_0x3b2133['attributes']=_[_0xf408('0x36')](_0xdc3818[_0xf408('0x33')],qs[_0xf408('0x37')](_0x19bc20[_0xf408('0x34')][_0xf408('0x37')]));_0x3b2133[_0xf408('0x38')]=_0x3b2133[_0xf408('0x38')]['length']?_0x3b2133[_0xf408('0x38')]:_0xdc3818[_0xf408('0x33')];if(!_0x19bc20[_0xf408('0x34')][_0xf408('0x39')]('nolimit')){_0x3b2133[_0xf408('0x20')]=qs[_0xf408('0x20')](_0x19bc20[_0xf408('0x34')][_0xf408('0x20')]);_0x3b2133[_0xf408('0x1f')]=qs[_0xf408('0x1f')](_0x19bc20[_0xf408('0x34')][_0xf408('0x1f')]);}_0x3b2133['order']=qs[_0xf408('0x3a')](_0x19bc20[_0xf408('0x34')]['sort']);_0x3b2133[_0xf408('0x3b')]=qs[_0xf408('0x3c')](_['pick'](_0x19bc20[_0xf408('0x34')],_0xdc3818[_0xf408('0x3c')]),_0x2c0d43);if(_0x19bc20[_0xf408('0x34')][_0xf408('0x3d')]){_0x3b2133['where']=_['merge'](_0x3b2133['where'],{'$or':_[_0xf408('0x2d')](_0x2c0d43,function(_0x378719){if(_0x378719[_0xf408('0x31')]!=='VIRTUAL'){var _0x207c2c={};_0x207c2c[_0x378719[_0xf408('0x2b')]]={'$like':'%'+_0x19bc20['query'][_0xf408('0x3d')]+'%'};return _0x207c2c;}})});}_0x3b2133=_[_0xf408('0x3e')]({},_0x3b2133,_0x19bc20['options']);var _0x2d6601={'where':_0x3b2133['where']};return db['VoiceTransferReport'][_0xf408('0x3f')](_0x2d6601)[_0xf408('0x27')](function(_0x3890e0){_0x52d94d[_0xf408('0x3f')]=_0x3890e0;if(_0x19bc20['query'][_0xf408('0x40')]){_0x3b2133[_0xf408('0x41')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x3b2133);})[_0xf408('0x27')](function(_0x1dcbbf){_0x52d94d[_0xf408('0x42')]=_0x1dcbbf;return _0x52d94d;})[_0xf408('0x27')](respondWithFilteredResult(_0x30ced2,_0x3b2133))[_0xf408('0x43')](handleError(_0x30ced2,null));};exports[_0xf408('0x44')]=function(_0x1479ca,_0x2357b5){var _0x5f4c72={'raw':!![],'where':{'id':_0x1479ca['params']['id']}},_0x1ae5c9={};_0x1ae5c9[_0xf408('0x33')]=_[_0xf408('0x35')](db[_0xf408('0x2e')][_0xf408('0x2f')]);_0x1ae5c9['query']=_[_0xf408('0x35')](_0x1479ca[_0xf408('0x34')]);_0x1ae5c9[_0xf408('0x3c')]=_[_0xf408('0x36')](_0x1ae5c9['model'],_0x1ae5c9[_0xf408('0x34')]);_0x5f4c72[_0xf408('0x38')]=_[_0xf408('0x36')](_0x1ae5c9[_0xf408('0x33')],qs[_0xf408('0x37')](_0x1479ca[_0xf408('0x34')][_0xf408('0x37')]));_0x5f4c72[_0xf408('0x38')]=_0x5f4c72[_0xf408('0x38')][_0xf408('0x45')]?_0x5f4c72['attributes']:_0x1ae5c9[_0xf408('0x33')];if(_0x1479ca['query'][_0xf408('0x40')]){_0x5f4c72['include']=[{'all':!![]}];}_0x5f4c72=_[_0xf408('0x3e')]({},_0x5f4c72,_0x1479ca[_0xf408('0x46')]);return db[_0xf408('0x2e')]['find'](_0x5f4c72)['then'](handleEntityNotFound(_0x2357b5,null))['then'](respondWithResult(_0x2357b5,null))[_0xf408('0x43')](handleError(_0x2357b5,null));};exports[_0xf408('0x47')]=function(_0x5285a9,_0xf07bfa){return db[_0xf408('0x2e')][_0xf408('0x47')](_0x5285a9['body'],{})[_0xf408('0x27')](respondWithResult(_0xf07bfa,0xc9))['catch'](handleError(_0xf07bfa,null));};exports[_0xf408('0x25')]=function(_0x2673c3,_0x1070cc){if(_0x2673c3['body']['id']){delete _0x2673c3[_0xf408('0x48')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x2673c3[_0xf408('0x49')]['id']}})[_0xf408('0x27')](handleEntityNotFound(_0x1070cc,null))[_0xf408('0x27')](saveUpdates(_0x2673c3[_0xf408('0x48')],null))[_0xf408('0x27')](respondWithResult(_0x1070cc,null))['catch'](handleError(_0x1070cc,null));};exports['destroy']=function(_0x10b66e,_0x571b86){return db[_0xf408('0x2e')]['find']({'where':{'id':_0x10b66e[_0xf408('0x49')]['id']}})['then'](handleEntityNotFound(_0x571b86,null))[_0xf408('0x27')](removeEntity(_0x571b86,null))[_0xf408('0x43')](handleError(_0x571b86,null));};exports[_0xf408('0x4a')]=function(_0x700b2b,_0x4a2569){return db[_0xf408('0x2e')]['describe']()['then'](respondWithResult(_0x4a2569,null))[_0xf408('0x43')](handleError(_0x4a2569,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 1198567..d49a913 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 _0x58fa=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','VoiceTransferReport','report_call_transfer','lodash','util'];(function(_0x5a38bc,_0x1e81de){var _0x1e7dbc=function(_0x55c765){while(--_0x55c765){_0x5a38bc['push'](_0x5a38bc['shift']());}};_0x1e7dbc(++_0x1e81de);}(_0x58fa,0x129));var _0xa58f=function(_0x2a5684,_0x24e5ee){_0x2a5684=_0x2a5684-0x0;var _0x4bd433=_0x58fa[_0x2a5684];return _0x4bd433;};'use strict';var _=require(_0xa58f('0x0'));var util=require(_0xa58f('0x1'));var logger=require(_0xa58f('0x2'))(_0xa58f('0x3'));var moment=require(_0xa58f('0x4'));var BPromise=require(_0xa58f('0x5'));var rp=require(_0xa58f('0x6'));var fs=require('fs');var path=require(_0xa58f('0x7'));var rimraf=require(_0xa58f('0x8'));var config=require(_0xa58f('0x9'));var attributes=require(_0xa58f('0xa'));module['exports']=function(_0xf4fcc6,_0x193513){return _0xf4fcc6['define'](_0xa58f('0xb'),attributes,{'tableName':_0xa58f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1918=['bluebird','request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes','VoiceTransferReport','report_call_transfer','util','../../config/logger','moment'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x1918,0x1dd));var _0x8191=function(_0xc96580,_0x2dbfdf){_0xc96580=_0xc96580-0x0;var _0x7cda84=_0x1918[_0xc96580];return _0x7cda84;};'use strict';var _=require('lodash');var util=require(_0x8191('0x0'));var logger=require(_0x8191('0x1'))('api');var moment=require(_0x8191('0x2'));var BPromise=require(_0x8191('0x3'));var rp=require(_0x8191('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8191('0x5'));var config=require(_0x8191('0x6'));var attributes=require(_0x8191('0x7'));module['exports']=function(_0xc7ee28,_0x25df2b){return _0xc7ee28['define'](_0x8191('0x8'),attributes,{'tableName':_0x8191('0x9'),'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 64255d5..0808f06 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 _0xb620=['debug','stringify','error','code','message','result','catch','CreateVoiceTransferReport','create','body','options','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb620,0x1a0));var _0x0b62=function(_0x57b659,_0x2befef){_0x57b659=_0x57b659-0x0;var _0x3444c9=_0xb620[_0x57b659];return _0x3444c9;};'use strict';var _=require(_0x0b62('0x0'));var util=require('util');var moment=require(_0x0b62('0x1'));var BPromise=require(_0x0b62('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b62('0x3'));var db=require(_0x0b62('0x4'))['db'];var utils=require(_0x0b62('0x5'));var logger=require(_0x0b62('0x6'))(_0x0b62('0x7'));var config=require(_0x0b62('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0b62('0x9')][_0x0b62('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x481fef,_0x4a616a,_0x167a2b){return new BPromise(function(_0x10b6b2,_0x218793){return client[_0x0b62('0xb')](_0x481fef,_0x167a2b)[_0x0b62('0xc')](function(_0x56a8ac){logger[_0x0b62('0xd')](_0x0b62('0xe'),_0x4a616a,_0x0b62('0xf'));logger[_0x0b62('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x4a616a,_0x0b62('0xf'),JSON[_0x0b62('0x11')](_0x56a8ac));if(_0x56a8ac[_0x0b62('0x12')]){if(_0x56a8ac[_0x0b62('0x12')][_0x0b62('0x13')]===0x1f4){logger[_0x0b62('0x12')](_0x0b62('0xe'),_0x4a616a,_0x56a8ac[_0x0b62('0x12')][_0x0b62('0x14')]);return _0x218793(_0x56a8ac[_0x0b62('0x12')]['message']);}logger[_0x0b62('0x12')](_0x0b62('0xe'),_0x4a616a,_0x56a8ac['error'][_0x0b62('0x14')]);return _0x10b6b2(_0x56a8ac[_0x0b62('0x12')]['message']);}else{logger['info'](_0x0b62('0xe'),_0x4a616a,_0x0b62('0xf'));_0x10b6b2(_0x56a8ac[_0x0b62('0x15')]['message']);}})[_0x0b62('0x16')](function(_0x58c82a){logger['error'](_0x0b62('0xe'),_0x4a616a,_0x58c82a);_0x218793(_0x58c82a);});});}exports[_0x0b62('0x17')]=function(_0x5d71f5){var _0x3032be=this;return new Promise(function(_0x1cba53,_0x4cb621){return db['VoiceTransferReport'][_0x0b62('0x18')](_0x5d71f5[_0x0b62('0x19')],{'raw':_0x5d71f5['options']?_0x5d71f5[_0x0b62('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x0b62('0xc')](function(_0x26e72d){logger[_0x0b62('0xd')](_0x0b62('0x17'),_0x5d71f5);logger['debug'](_0x0b62('0x17'),_0x5d71f5,JSON[_0x0b62('0x11')](_0x26e72d));_0x1cba53(_0x26e72d);})['catch'](function(_0x2a675b){logger['error']('CreateVoiceTransferReport',_0x2a675b[_0x0b62('0x14')],_0x5d71f5);_0x4cb621(_0x3032be[_0x0b62('0x12')](0x1f4,_0x2a675b[_0x0b62('0x14')]));});});}; \ No newline at end of file +var _0x9d5b=['catch','CreateVoiceTransferReport','create','options','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x9a3b68,_0x40e0ae){var _0x4d3ac7=function(_0x1ab297){while(--_0x1ab297){_0x9a3b68['push'](_0x9a3b68['shift']());}};_0x4d3ac7(++_0x40e0ae);}(_0x9d5b,0x71));var _0xb9d5=function(_0x21ac07,_0x2f2eff){_0x21ac07=_0x21ac07-0x0;var _0x4e4800=_0x9d5b[_0x21ac07];return _0x4e4800;};'use strict';var _=require(_0xb9d5('0x0'));var util=require('util');var moment=require(_0xb9d5('0x1'));var BPromise=require(_0xb9d5('0x2'));var rs=require(_0xb9d5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9d5('0x4'))['db'];var utils=require(_0xb9d5('0x5'));var logger=require('../../config/logger')(_0xb9d5('0x6'));var config=require(_0xb9d5('0x7'));var jayson=require(_0xb9d5('0x8'));var client=jayson[_0xb9d5('0x9')][_0xb9d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30cd32,_0x34ddd9,_0x46304c){return new BPromise(function(_0x57b230,_0x3b4fb8){return client[_0xb9d5('0xb')](_0x30cd32,_0x46304c)[_0xb9d5('0xc')](function(_0x2b9bab){logger[_0xb9d5('0xd')](_0xb9d5('0xe'),_0x34ddd9,_0xb9d5('0xf'));logger[_0xb9d5('0x10')](_0xb9d5('0x11'),_0x34ddd9,_0xb9d5('0xf'),JSON['stringify'](_0x2b9bab));if(_0x2b9bab[_0xb9d5('0x12')]){if(_0x2b9bab[_0xb9d5('0x12')][_0xb9d5('0x13')]===0x1f4){logger[_0xb9d5('0x12')](_0xb9d5('0xe'),_0x34ddd9,_0x2b9bab[_0xb9d5('0x12')][_0xb9d5('0x14')]);return _0x3b4fb8(_0x2b9bab[_0xb9d5('0x12')][_0xb9d5('0x14')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x34ddd9,_0x2b9bab[_0xb9d5('0x12')][_0xb9d5('0x14')]);return _0x57b230(_0x2b9bab[_0xb9d5('0x12')][_0xb9d5('0x14')]);}else{logger[_0xb9d5('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x34ddd9,_0xb9d5('0xf'));_0x57b230(_0x2b9bab[_0xb9d5('0x15')]['message']);}})[_0xb9d5('0x16')](function(_0x58b32c){logger[_0xb9d5('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x34ddd9,_0x58b32c);_0x3b4fb8(_0x58b32c);});});}exports[_0xb9d5('0x17')]=function(_0x388a99){var _0x35a555=this;return new Promise(function(_0x42f886,_0x2df9cd){return db['VoiceTransferReport'][_0xb9d5('0x18')](_0x388a99['body'],{'raw':_0x388a99[_0xb9d5('0x19')]?_0x388a99[_0xb9d5('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xb9d5('0xc')](function(_0x4b0cce){logger[_0xb9d5('0xd')](_0xb9d5('0x17'),_0x388a99);logger['debug'](_0xb9d5('0x17'),_0x388a99,JSON[_0xb9d5('0x1a')](_0x4b0cce));_0x42f886(_0x4b0cce);})[_0xb9d5('0x16')](function(_0x3880d4){logger[_0xb9d5('0x12')](_0xb9d5('0x17'),_0x3880d4[_0xb9d5('0x14')],_0x388a99);_0x2df9cd(_0x35a555[_0xb9d5('0x12')](0x1f4,_0x3880d4[_0xb9d5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 32f8612..338d808 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 _0x87ae=['unhold','calls','/transfer','transfer','exports','../../components/auth/service','/originate','isAuthenticated','canUpdate','post','/hangup','/answer','answer','/hold','hold','/unhold'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x87ae,0xf5));var _0xe87a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x87ae[_0x17b6e3];return _0x3906f3;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xe87a('0x0'));var controller=require('./webbar.controller');router['post'](_0xe87a('0x1'),auth[_0xe87a('0x2')](),auth[_0xe87a('0x3')](),controller['originate']);router[_0xe87a('0x4')](_0xe87a('0x5'),auth[_0xe87a('0x2')](),auth['canUpdate'](),controller['hangup']);router[_0xe87a('0x4')](_0xe87a('0x6'),auth['isAuthenticated'](),auth[_0xe87a('0x3')](),controller[_0xe87a('0x7')]);router['post'](_0xe87a('0x8'),auth[_0xe87a('0x2')](),auth['canUpdate'](),controller[_0xe87a('0x9')]);router[_0xe87a('0x4')](_0xe87a('0xa'),auth[_0xe87a('0x2')](),auth[_0xe87a('0x3')](),controller[_0xe87a('0xb')]);router['post']('/calls',auth[_0xe87a('0x2')](),auth[_0xe87a('0x3')](),controller[_0xe87a('0xc')]);router['post'](_0xe87a('0xd'),auth[_0xe87a('0x2')](),auth['canUpdate'](),controller[_0xe87a('0xe')]);module[_0xe87a('0xf')]=router; \ No newline at end of file +var _0xb205=['/transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','canUpdate','/hangup','hangup','isAuthenticated','/hold','hold','/unhold','unhold','/calls','calls'];(function(_0x4ef734,_0x5826d){var _0x33a7cb=function(_0x127a2b){while(--_0x127a2b){_0x4ef734['push'](_0x4ef734['shift']());}};_0x33a7cb(++_0x5826d);}(_0xb205,0xf0));var _0x5b20=function(_0x1ba3d0,_0x5eb1d7){_0x1ba3d0=_0x1ba3d0-0x0;var _0x256351=_0xb205[_0x1ba3d0];return _0x256351;};'use strict';var express=require(_0x5b20('0x0'));var router=express[_0x5b20('0x1')]();var auth=require(_0x5b20('0x2'));var controller=require(_0x5b20('0x3'));router[_0x5b20('0x4')]('/originate',auth['isAuthenticated'](),auth[_0x5b20('0x5')](),controller['originate']);router[_0x5b20('0x4')](_0x5b20('0x6'),auth['isAuthenticated'](),auth[_0x5b20('0x5')](),controller[_0x5b20('0x7')]);router[_0x5b20('0x4')]('/answer',auth[_0x5b20('0x8')](),auth[_0x5b20('0x5')](),controller['answer']);router['post'](_0x5b20('0x9'),auth[_0x5b20('0x8')](),auth[_0x5b20('0x5')](),controller[_0x5b20('0xa')]);router[_0x5b20('0x4')](_0x5b20('0xb'),auth[_0x5b20('0x8')](),auth['canUpdate'](),controller[_0x5b20('0xc')]);router[_0x5b20('0x4')](_0x5b20('0xd'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x5b20('0xe')]);router[_0x5b20('0x4')](_0x5b20('0xf'),auth[_0x5b20('0x8')](),auth[_0x5b20('0x5')](),controller['transfer']);module[_0x5b20('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 9748096..9f96010 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 _0x9f94=['webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','bluebird','jayson/promise','client','http','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','validate','string','number','userId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','message','result','catch','User','findOne','agent','then','VoiceChannels','all','rows','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','hangup\x20fired:','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','filter','conference','conference\x20fired:'];(function(_0x15ea09,_0x2f30ab){var _0x3e9c78=function(_0x15f8ba){while(--_0x15f8ba){_0x15ea09['push'](_0x15ea09['shift']());}};_0x3e9c78(++_0x2f30ab);}(_0x9f94,0x1e7));var _0x49f9=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9f94[_0x59ee6f];return _0x4c0979;};'use strict';var path=require(_0x49f9('0x0'));var fs=require('fs');var _=require(_0x49f9('0x1'));var db=require(_0x49f9('0x2'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x49f9('0x3'));var jayson=require(_0x49f9('0x4'));var amiClient=jayson[_0x49f9('0x5')][_0x49f9('0x6')]({'port':0x232a});var logger=require(_0x49f9('0x7'))('webbarapi');var Redis=require(_0x49f9('0x8'));config[_0x49f9('0x9')]=_[_0x49f9('0xa')](config[_0x49f9('0x9')],{'host':_0x49f9('0xb'),'port':0x18eb});var io=require(_0x49f9('0xc'))(new Redis(config[_0x49f9('0x9')]));var Schema=require(_0x49f9('0xd'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x49f9('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x49f9('0xe')},'callbackUrl':{'type':_0x49f9('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x49f9('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x49f9('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x49f9('0x10')]},'sessionId':{'type':_0x49f9('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x49f9('0xf'),'required':[!![],_0x49f9('0x10')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x49f9('0xe'),'required':[!![],_0x49f9('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x49f9('0xf'),'required':[!![],_0x49f9('0x10')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x49f9('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x49f9('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x49f9('0x10')]}});function emit(_0x760ac,_0x482aa5,_0x45a376){logger[_0x49f9('0x12')](_0x760ac,_0x482aa5,JSON[_0x49f9('0x13')](_0x45a376));io['to'](_0x760ac)[_0x49f9('0x14')](_0x482aa5,_0x45a376);}function handleError(_0x62b3bf){return function(_0x509610){console[_0x49f9('0x15')](_0x49f9('0x16'),_0x509610,_0x509610 instanceof RangeError);logger[_0x49f9('0x17')](_0x509610[_0x49f9('0x18')]);if(_0x509610 instanceof RangeError){if(_0x509610[_0x49f9('0x19')]){delete _0x509610[_0x49f9('0x19')];}_0x62b3bf[_0x49f9('0x1a')](0x194)[_0x49f9('0x1b')](_0x509610);}else{if(_0x509610[_0x49f9('0x19')]){delete _0x509610['name'];}_0x62b3bf['status'](0x1f4)[_0x49f9('0x1b')](_0x509610);}};}function checkError(){return function(_0x4884ef){if(!_0x4884ef){throw new RangeError(_0x49f9('0x1c'));}return _0x4884ef;};}function respondWithRpcPromise(_0x5b49d5,_0x4d9735){return new BPromise(function(_0x42c0aa,_0xde1383){var _0x4e92e5=amiClient;return _0x4e92e5[_0x49f9('0x1d')](_0x5b49d5,_0x4d9735)['then'](function(_0x4a01a8){if(_0x4a01a8[_0x49f9('0x17')]){if(_0x4a01a8[_0x49f9('0x17')]['code']===0x1f4){return _0xde1383(_0x4a01a8[_0x49f9('0x17')][_0x49f9('0x1e')]);}return _0x42c0aa(_0x4a01a8['error'][_0x49f9('0x1e')]);}else{_0x42c0aa(_0x4a01a8[_0x49f9('0x1f')]);}})[_0x49f9('0x20')](function(_0x2272d3){_0xde1383(_0x2272d3);});});}function getAgent(_0x4e6a90){return db[_0x49f9('0x21')][_0x49f9('0x22')]({'where':{'id':_0x4e6a90,'role':_0x49f9('0x23')}})[_0x49f9('0x24')](checkError());}function getAgentCheckSession(_0x28e56f,_0x45e077){return new BPromise(function(_0x271ad2,_0x57c938){var _0x4c065f=respondWithRpcPromise(_0x49f9('0x25'));var _0xc64e23=getAgent(_0x28e56f);Promise[_0x49f9('0x26')]([_0x4c065f,_0xc64e23])[_0x49f9('0x24')](function(_0x51adc3){var _0x2d1e7d=_0x51adc3[0x0];var _0x76e1c6=_0x51adc3[0x1];var _0x1deb22=_['filter'](_0x2d1e7d[_0x49f9('0x27')],function(_0x51aff6){return _0x51aff6[_0x49f9('0x28')]==_0x76e1c6['id']&&_0x51aff6[_0x49f9('0x29')]==_0x45e077;});if(_0x1deb22[_0x49f9('0x2a')]==0x1){_0x271ad2(_0x76e1c6);}else{_0x57c938(new RangeError('sessionId\x20'+_0x45e077+_0x49f9('0x2b')));}});});}exports[_0x49f9('0x2c')]=function(_0x2394c0,_0x5b95e0){logger[_0x49f9('0x12')](_0x49f9('0x2d'),_0x2394c0[_0x49f9('0x2e')]);var _0x26f269=originateValidation[_0x49f9('0xd')](_0x2394c0[_0x49f9('0x2e')]);if(_0x26f269[_0x49f9('0x2a')]>0x0){return _0x5b95e0[_0x49f9('0x1a')](0x190)[_0x49f9('0x2f')](_0x26f269);}var _0x103ebb=_0x2394c0[_0x49f9('0x2e')][_0x49f9('0x30')];var _0x23ef8e=_0x2394c0['body'][_0x49f9('0x31')];var _0x26a79e=_0x2394c0[_0x49f9('0x2e')][_0x49f9('0x32')];var _0x54e90a=_0x2394c0['body'][_0x49f9('0x33')];return getAgent(_0x103ebb)['then'](function(_0x2eb003){logger[_0x49f9('0x12')](_0x49f9('0x34'),_0x2eb003[_0x49f9('0x19')]);emit(util[_0x49f9('0x35')](_0x49f9('0x36'),_0x2eb003[_0x49f9('0x19')]),'webbar:originate',{'callNumber':_0x23ef8e,'callerId':_0x26a79e,'callbackUrl':_0x54e90a});return _0x5b95e0[_0x49f9('0x1a')](0xc8)[_0x49f9('0x2f')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x5b95e0));};exports['hangup']=function(_0x3287aa,_0x570f59){logger['info'](_0x49f9('0x37'),_0x3287aa[_0x49f9('0x2e')]);var _0x161994=hangupValidation[_0x49f9('0xd')](_0x3287aa['body']);if(_0x161994[_0x49f9('0x2a')]>0x0){return _0x570f59['status'](0x190)[_0x49f9('0x2f')](_0x161994);}var _0x22cb85=_0x3287aa[_0x49f9('0x2e')][_0x49f9('0x30')];var _0x2559a5=_0x3287aa[_0x49f9('0x2e')]['sessionId'];return getAgent(_0x22cb85)['then'](function(_0x46bded){logger[_0x49f9('0x12')](_0x49f9('0x34'),_0x46bded['name']);emit(util[_0x49f9('0x35')](_0x49f9('0x36'),_0x46bded['name']),'webbar:hangup',{'sessionId':_0x2559a5});return _0x570f59[_0x49f9('0x1a')](0xc8)[_0x49f9('0x2f')]({'error':![],'message':_0x49f9('0x38')});})[_0x49f9('0x20')](handleError(_0x570f59));};exports['answer']=function(_0x29ad8f,_0x4b760e){logger[_0x49f9('0x12')](_0x49f9('0x39'),_0x29ad8f[_0x49f9('0x2e')]);var _0x81d2b6=answerValidation[_0x49f9('0xd')](_0x29ad8f[_0x49f9('0x2e')]);if(_0x81d2b6[_0x49f9('0x2a')]>0x0){return _0x4b760e[_0x49f9('0x1a')](0x190)['json'](_0x81d2b6);}var _0x36dfcb=_0x29ad8f[_0x49f9('0x2e')][_0x49f9('0x30')];var _0x46b286=_0x29ad8f[_0x49f9('0x2e')][_0x49f9('0x29')];return getAgent(_0x36dfcb)[_0x49f9('0x24')](function(_0x48c7cf){logger[_0x49f9('0x12')]('entityFound:',_0x48c7cf[_0x49f9('0x19')]);emit(util[_0x49f9('0x35')]('user:%s',_0x48c7cf[_0x49f9('0x19')]),_0x49f9('0x3a'),{'sessionId':_0x46b286});return _0x4b760e['status'](0xc8)[_0x49f9('0x2f')]({'error':![],'message':_0x49f9('0x3b')});})['catch'](handleError(_0x4b760e));};exports[_0x49f9('0x3c')]=function(_0x200234,_0x22afe0){logger[_0x49f9('0x12')](_0x49f9('0x3d'),_0x200234[_0x49f9('0x2e')]);var _0x544e1c=holdValidation[_0x49f9('0xd')](_0x200234['body']);if(_0x544e1c[_0x49f9('0x2a')]>0x0){return _0x22afe0[_0x49f9('0x1a')](0x190)['json'](_0x544e1c);}var _0x4147c0=_0x200234[_0x49f9('0x2e')][_0x49f9('0x30')];var _0x10b535=_0x200234[_0x49f9('0x2e')][_0x49f9('0x29')];return getAgent(_0x4147c0)[_0x49f9('0x24')](function(_0x19041e){logger[_0x49f9('0x12')](_0x49f9('0x34'),_0x19041e[_0x49f9('0x19')]);emit(util['format']('user:%s',_0x19041e[_0x49f9('0x19')]),_0x49f9('0x3e'),{'sessionId':_0x10b535});return _0x22afe0[_0x49f9('0x1a')](0xc8)[_0x49f9('0x2f')]({'error':![],'message':_0x49f9('0x3f')});})[_0x49f9('0x20')](handleError(_0x22afe0));};exports[_0x49f9('0x40')]=function(_0x523fce,_0x2bc922){logger[_0x49f9('0x12')](_0x49f9('0x41'),_0x523fce[_0x49f9('0x2e')]);var _0x1f570b=unholdValidation['validate'](_0x523fce['body']);if(_0x1f570b['length']>0x0){return _0x2bc922[_0x49f9('0x1a')](0x190)[_0x49f9('0x2f')](_0x1f570b);}var _0x186db7=_0x523fce[_0x49f9('0x2e')][_0x49f9('0x30')];var _0x45d9e9=_0x523fce['body'][_0x49f9('0x29')];return getAgent(_0x186db7)['then'](function(_0x2fa14c){logger['info']('entityFound:',_0x2fa14c[_0x49f9('0x19')]);emit(util['format'](_0x49f9('0x36'),_0x2fa14c[_0x49f9('0x19')]),_0x49f9('0x42'),{'sessionId':_0x45d9e9});return _0x2bc922[_0x49f9('0x1a')](0xc8)[_0x49f9('0x2f')]({'error':![],'message':_0x49f9('0x43')});})['catch'](handleError(_0x2bc922));};exports[_0x49f9('0x44')]=function(_0x2463ea,_0x3fdd00){logger[_0x49f9('0x12')](_0x49f9('0x45'),_0x3fdd00[_0x49f9('0x2e')]);var _0x23b2b9=callsValidation[_0x49f9('0xd')](_0x2463ea['body']);if(_0x23b2b9[_0x49f9('0x2a')]>0x0){return _0x3fdd00['status'](0x190)[_0x49f9('0x2f')](_0x23b2b9);}var _0x249cfa=_0x2463ea[_0x49f9('0x2e')][_0x49f9('0x30')];var _0x96062e=respondWithRpcPromise('VoiceChannels');var _0xbd2b8f=getAgent(_0x249cfa);return Promise[_0x49f9('0x26')]([_0x96062e,_0xbd2b8f])[_0x49f9('0x24')](function(_0x5b1e71){var _0x359c55=_0x5b1e71[0x0];var _0x501828=_0x5b1e71[0x1];var _0x3106f1=_[_0x49f9('0x46')](_0x359c55[_0x49f9('0x27')],function(_0x1f9f3b){return _0x1f9f3b['UserId']==_0x501828['id'];});return _0x3fdd00[_0x49f9('0x1a')](0xc8)['json']({'count':_0x3106f1['length'],'rows':_0x3106f1});})[_0x49f9('0x20')](handleError(_0x3fdd00));};exports[_0x49f9('0x47')]=function(_0x55b708,_0x104174){logger[_0x49f9('0x12')](_0x49f9('0x48'),_0x55b708[_0x49f9('0x2e')]);var _0x3e9a2c=conferenceValidation[_0x49f9('0xd')](_0x55b708[_0x49f9('0x2e')]);if(_0x3e9a2c['length']>0x0){return _0x104174[_0x49f9('0x1a')](0x190)[_0x49f9('0x2f')](_0x3e9a2c);}var _0x579800=_0x55b708[_0x49f9('0x2e')][_0x49f9('0x30')];return getAgent(_0x579800)[_0x49f9('0x24')](function(_0x36e40d){logger[_0x49f9('0x12')](_0x49f9('0x34'),_0x36e40d['name']);emit(util[_0x49f9('0x35')](_0x49f9('0x36'),_0x36e40d[_0x49f9('0x19')]),_0x49f9('0x49'));return _0x104174[_0x49f9('0x1a')](0xc8)[_0x49f9('0x2f')]({'error':![],'message':_0x49f9('0x4a')});})[_0x49f9('0x20')](handleError(_0x104174));};exports[_0x49f9('0x4b')]=function(_0x34098e,_0x253edf){logger[_0x49f9('0x12')](_0x49f9('0x4c'),_0x34098e[_0x49f9('0x2e')]);var _0x18e165=transferValidation[_0x49f9('0xd')](_0x34098e[_0x49f9('0x2e')]);if(_0x18e165['length']>0x0){return _0x253edf[_0x49f9('0x1a')](0x190)['json'](_0x18e165);}var _0x4b47ae=_0x34098e[_0x49f9('0x2e')][_0x49f9('0x30')];var _0x466480=_0x34098e['body']['sessionId'];var _0x3e1eab=_0x34098e[_0x49f9('0x2e')][_0x49f9('0x4d')];return getAgent(_0x4b47ae)['then'](function(_0x2c7184){logger[_0x49f9('0x12')](_0x49f9('0x34'),_0x2c7184[_0x49f9('0x19')]);emit(util['format'](_0x49f9('0x36'),_0x2c7184['name']),_0x49f9('0x4e'),{'sessionId':_0x466480,'transferNumber':_0x3e1eab});return _0x253edf[_0x49f9('0x1a')](0xc8)[_0x49f9('0x2f')]({'error':![],'message':_0x49f9('0x4f')});})[_0x49f9('0x20')](handleError(_0x253edf));}; \ No newline at end of file +var _0xcc19=['send','NotFound','then','error','code','message','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','entityFound:','user:%s','webbar:originate','catch','hangup\x20fired:','format','webbar:hangup','answer\x20fired:','webbar:answer','hold','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','conference','webbar:conference','conference\x20executed!','transferNumber','webbar:transfer','path','lodash','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','log','handleError:','stack','name','status'];(function(_0x3b7f40,_0x36056c){var _0x24d907=function(_0x17aa3d){while(--_0x17aa3d){_0x3b7f40['push'](_0x3b7f40['shift']());}};_0x24d907(++_0x36056c);}(_0xcc19,0xbd));var _0x9cc1=function(_0x46ad9e,_0x203184){_0x46ad9e=_0x46ad9e-0x0;var _0x5727cb=_0xcc19[_0x46ad9e];return _0x5727cb;};'use strict';var path=require(_0x9cc1('0x0'));var fs=require('fs');var _=require(_0x9cc1('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x9cc1('0x2'));var util=require(_0x9cc1('0x3'));var BPromise=require(_0x9cc1('0x4'));var jayson=require(_0x9cc1('0x5'));var amiClient=jayson[_0x9cc1('0x6')][_0x9cc1('0x7')]({'port':0x232a});var logger=require(_0x9cc1('0x8'))(_0x9cc1('0x9'));var Redis=require(_0x9cc1('0xa'));config['redis']=_['defaults'](config[_0x9cc1('0xb')],{'host':_0x9cc1('0xc'),'port':0x18eb});var io=require(_0x9cc1('0xd'))(new Redis(config[_0x9cc1('0xb')]));var Schema=require(_0x9cc1('0xe'));var originateValidation=new Schema({'userId':{'type':_0x9cc1('0xf'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x9cc1('0x10'),'required':[!![],_0x9cc1('0x11')]},'callerId':{'type':_0x9cc1('0x10')},'callbackUrl':{'type':_0x9cc1('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x9cc1('0x12')]},'sessionId':{'type':_0x9cc1('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x9cc1('0xf'),'required':[!![],_0x9cc1('0x12')]},'sessionId':{'type':_0x9cc1('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x9cc1('0xf'),'required':[!![],_0x9cc1('0x12')]},'sessionId':{'type':'string','required':[!![],_0x9cc1('0x13')]},'transferNumber':{'type':_0x9cc1('0x10'),'required':[!![],_0x9cc1('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0x9cc1('0xf'),'required':[!![],_0x9cc1('0x12')]},'sessionId':{'type':_0x9cc1('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x9cc1('0xf'),'required':[!![],_0x9cc1('0x12')]},'sessionId':{'type':_0x9cc1('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x13fd29,_0x2f6dd0,_0x3fce42){logger[_0x9cc1('0x15')](_0x13fd29,_0x2f6dd0,JSON['stringify'](_0x3fce42));io['to'](_0x13fd29)['emit'](_0x2f6dd0,_0x3fce42);}function handleError(_0x42c397){return function(_0x3ca08d){console[_0x9cc1('0x16')](_0x9cc1('0x17'),_0x3ca08d,_0x3ca08d instanceof RangeError);logger['error'](_0x3ca08d[_0x9cc1('0x18')]);if(_0x3ca08d instanceof RangeError){if(_0x3ca08d[_0x9cc1('0x19')]){delete _0x3ca08d[_0x9cc1('0x19')];}_0x42c397[_0x9cc1('0x1a')](0x194)['send'](_0x3ca08d);}else{if(_0x3ca08d[_0x9cc1('0x19')]){delete _0x3ca08d[_0x9cc1('0x19')];}_0x42c397[_0x9cc1('0x1a')](0x1f4)[_0x9cc1('0x1b')](_0x3ca08d);}};}function checkError(){return function(_0x44a043){if(!_0x44a043){throw new RangeError(_0x9cc1('0x1c'));}return _0x44a043;};}function respondWithRpcPromise(_0x72e586,_0x4b70c6){return new BPromise(function(_0x12aa67,_0x7dec83){var _0x544221=amiClient;return _0x544221['request'](_0x72e586,_0x4b70c6)[_0x9cc1('0x1d')](function(_0x2fb463){if(_0x2fb463['error']){if(_0x2fb463[_0x9cc1('0x1e')][_0x9cc1('0x1f')]===0x1f4){return _0x7dec83(_0x2fb463['error'][_0x9cc1('0x20')]);}return _0x12aa67(_0x2fb463['error'][_0x9cc1('0x20')]);}else{_0x12aa67(_0x2fb463['result']);}})['catch'](function(_0x2f6998){_0x7dec83(_0x2f6998);});});}function getAgent(_0x5beeef){return db['User'][_0x9cc1('0x21')]({'where':{'id':_0x5beeef,'role':_0x9cc1('0x22')}})[_0x9cc1('0x1d')](checkError());}function getAgentCheckSession(_0x4ae224,_0x2ce28e){return new BPromise(function(_0x77b81e,_0x19b61f){var _0xf78f1=respondWithRpcPromise(_0x9cc1('0x23'));var _0x55e154=getAgent(_0x4ae224);Promise[_0x9cc1('0x24')]([_0xf78f1,_0x55e154])[_0x9cc1('0x1d')](function(_0x5a8b19){var _0x3c9e04=_0x5a8b19[0x0];var _0x45683e=_0x5a8b19[0x1];var _0x34837a=_[_0x9cc1('0x25')](_0x3c9e04[_0x9cc1('0x26')],function(_0x2af637){return _0x2af637[_0x9cc1('0x27')]==_0x45683e['id']&&_0x2af637[_0x9cc1('0x28')]==_0x2ce28e;});if(_0x34837a[_0x9cc1('0x29')]==0x1){_0x77b81e(_0x45683e);}else{_0x19b61f(new RangeError('sessionId\x20'+_0x2ce28e+_0x9cc1('0x2a')));}});});}exports[_0x9cc1('0x2b')]=function(_0x18c228,_0x40ec07){logger[_0x9cc1('0x15')](_0x9cc1('0x2c'),_0x18c228[_0x9cc1('0x2d')]);var _0x37c20a=originateValidation[_0x9cc1('0xe')](_0x18c228[_0x9cc1('0x2d')]);if(_0x37c20a['length']>0x0){return _0x40ec07[_0x9cc1('0x1a')](0x190)[_0x9cc1('0x2e')](_0x37c20a);}var _0x2009d0=_0x18c228[_0x9cc1('0x2d')][_0x9cc1('0x2f')];var _0x263849=_0x18c228[_0x9cc1('0x2d')][_0x9cc1('0x30')];var _0x48ada1=_0x18c228[_0x9cc1('0x2d')][_0x9cc1('0x31')];var _0x5dd598=_0x18c228[_0x9cc1('0x2d')]['callbackUrl'];return getAgent(_0x2009d0)[_0x9cc1('0x1d')](function(_0x478dc1){logger['info'](_0x9cc1('0x32'),_0x478dc1[_0x9cc1('0x19')]);emit(util['format'](_0x9cc1('0x33'),_0x478dc1['name']),_0x9cc1('0x34'),{'callNumber':_0x263849,'callerId':_0x48ada1,'callbackUrl':_0x5dd598});return _0x40ec07['status'](0xc8)[_0x9cc1('0x2e')]({'error':![],'message':'originate\x20executed!'});})[_0x9cc1('0x35')](handleError(_0x40ec07));};exports['hangup']=function(_0x7f2a71,_0x30772f){logger[_0x9cc1('0x15')](_0x9cc1('0x36'),_0x7f2a71['body']);var _0x17902c=hangupValidation['validate'](_0x7f2a71[_0x9cc1('0x2d')]);if(_0x17902c[_0x9cc1('0x29')]>0x0){return _0x30772f[_0x9cc1('0x1a')](0x190)[_0x9cc1('0x2e')](_0x17902c);}var _0x1605b9=_0x7f2a71['body']['userId'];var _0x27cdd8=_0x7f2a71[_0x9cc1('0x2d')][_0x9cc1('0x28')];return getAgent(_0x1605b9)[_0x9cc1('0x1d')](function(_0x40ddcb){logger[_0x9cc1('0x15')](_0x9cc1('0x32'),_0x40ddcb[_0x9cc1('0x19')]);emit(util[_0x9cc1('0x37')]('user:%s',_0x40ddcb['name']),_0x9cc1('0x38'),{'sessionId':_0x27cdd8});return _0x30772f[_0x9cc1('0x1a')](0xc8)[_0x9cc1('0x2e')]({'error':![],'message':'hangup\x20executed!'});})[_0x9cc1('0x35')](handleError(_0x30772f));};exports['answer']=function(_0x7770d1,_0x11f727){logger[_0x9cc1('0x15')](_0x9cc1('0x39'),_0x7770d1[_0x9cc1('0x2d')]);var _0x51650d=answerValidation[_0x9cc1('0xe')](_0x7770d1[_0x9cc1('0x2d')]);if(_0x51650d[_0x9cc1('0x29')]>0x0){return _0x11f727[_0x9cc1('0x1a')](0x190)[_0x9cc1('0x2e')](_0x51650d);}var _0x46945b=_0x7770d1[_0x9cc1('0x2d')][_0x9cc1('0x2f')];var _0x11373b=_0x7770d1[_0x9cc1('0x2d')][_0x9cc1('0x28')];return getAgent(_0x46945b)[_0x9cc1('0x1d')](function(_0x40765c){logger[_0x9cc1('0x15')]('entityFound:',_0x40765c[_0x9cc1('0x19')]);emit(util[_0x9cc1('0x37')](_0x9cc1('0x33'),_0x40765c[_0x9cc1('0x19')]),_0x9cc1('0x3a'),{'sessionId':_0x11373b});return _0x11f727[_0x9cc1('0x1a')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x9cc1('0x35')](handleError(_0x11f727));};exports[_0x9cc1('0x3b')]=function(_0x4ceab5,_0x472abd){logger['info']('hold\x20fired:',_0x4ceab5['body']);var _0x4bee20=holdValidation['validate'](_0x4ceab5['body']);if(_0x4bee20[_0x9cc1('0x29')]>0x0){return _0x472abd[_0x9cc1('0x1a')](0x190)[_0x9cc1('0x2e')](_0x4bee20);}var _0xec2ae=_0x4ceab5[_0x9cc1('0x2d')][_0x9cc1('0x2f')];var _0x35cfb1=_0x4ceab5[_0x9cc1('0x2d')]['sessionId'];return getAgent(_0xec2ae)[_0x9cc1('0x1d')](function(_0x22759f){logger['info'](_0x9cc1('0x32'),_0x22759f[_0x9cc1('0x19')]);emit(util[_0x9cc1('0x37')](_0x9cc1('0x33'),_0x22759f[_0x9cc1('0x19')]),_0x9cc1('0x3c'),{'sessionId':_0x35cfb1});return _0x472abd['status'](0xc8)['json']({'error':![],'message':_0x9cc1('0x3d')});})['catch'](handleError(_0x472abd));};exports[_0x9cc1('0x3e')]=function(_0x1b471c,_0x264614){logger[_0x9cc1('0x15')](_0x9cc1('0x3f'),_0x1b471c[_0x9cc1('0x2d')]);var _0x466646=unholdValidation['validate'](_0x1b471c['body']);if(_0x466646[_0x9cc1('0x29')]>0x0){return _0x264614[_0x9cc1('0x1a')](0x190)['json'](_0x466646);}var _0x2dd69b=_0x1b471c['body'][_0x9cc1('0x2f')];var _0x5a6d1a=_0x1b471c['body']['sessionId'];return getAgent(_0x2dd69b)[_0x9cc1('0x1d')](function(_0x163a5b){logger[_0x9cc1('0x15')](_0x9cc1('0x32'),_0x163a5b['name']);emit(util[_0x9cc1('0x37')](_0x9cc1('0x33'),_0x163a5b[_0x9cc1('0x19')]),'webbar:unhold',{'sessionId':_0x5a6d1a});return _0x264614[_0x9cc1('0x1a')](0xc8)[_0x9cc1('0x2e')]({'error':![],'message':_0x9cc1('0x40')});})[_0x9cc1('0x35')](handleError(_0x264614));};exports[_0x9cc1('0x41')]=function(_0x1fed55,_0x38b125){logger[_0x9cc1('0x15')](_0x9cc1('0x42'),_0x38b125[_0x9cc1('0x2d')]);var _0x5bfa55=callsValidation[_0x9cc1('0xe')](_0x1fed55[_0x9cc1('0x2d')]);if(_0x5bfa55[_0x9cc1('0x29')]>0x0){return _0x38b125[_0x9cc1('0x1a')](0x190)[_0x9cc1('0x2e')](_0x5bfa55);}var _0x549dd1=_0x1fed55['body'][_0x9cc1('0x2f')];var _0x4e7eea=respondWithRpcPromise('VoiceChannels');var _0x45eca3=getAgent(_0x549dd1);return Promise['all']([_0x4e7eea,_0x45eca3])[_0x9cc1('0x1d')](function(_0x4ba5e6){var _0x46d547=_0x4ba5e6[0x0];var _0x591ea1=_0x4ba5e6[0x1];var _0x487b78=_['filter'](_0x46d547[_0x9cc1('0x26')],function(_0x5e2a4a){return _0x5e2a4a[_0x9cc1('0x27')]==_0x591ea1['id'];});return _0x38b125[_0x9cc1('0x1a')](0xc8)[_0x9cc1('0x2e')]({'count':_0x487b78[_0x9cc1('0x29')],'rows':_0x487b78});})[_0x9cc1('0x35')](handleError(_0x38b125));};exports[_0x9cc1('0x43')]=function(_0x299c6a,_0x283dde){logger[_0x9cc1('0x15')]('conference\x20fired:',_0x299c6a[_0x9cc1('0x2d')]);var _0x2cb9eb=conferenceValidation[_0x9cc1('0xe')](_0x299c6a[_0x9cc1('0x2d')]);if(_0x2cb9eb[_0x9cc1('0x29')]>0x0){return _0x283dde[_0x9cc1('0x1a')](0x190)[_0x9cc1('0x2e')](_0x2cb9eb);}var _0x350ba8=_0x299c6a[_0x9cc1('0x2d')][_0x9cc1('0x2f')];return getAgent(_0x350ba8)['then'](function(_0x3b14a8){logger[_0x9cc1('0x15')](_0x9cc1('0x32'),_0x3b14a8[_0x9cc1('0x19')]);emit(util[_0x9cc1('0x37')](_0x9cc1('0x33'),_0x3b14a8[_0x9cc1('0x19')]),_0x9cc1('0x44'));return _0x283dde['status'](0xc8)['json']({'error':![],'message':_0x9cc1('0x45')});})[_0x9cc1('0x35')](handleError(_0x283dde));};exports['transfer']=function(_0xe90420,_0x47465a){logger[_0x9cc1('0x15')]('transfer\x20fired:',_0xe90420[_0x9cc1('0x2d')]);var _0x43de8e=transferValidation['validate'](_0xe90420['body']);if(_0x43de8e[_0x9cc1('0x29')]>0x0){return _0x47465a[_0x9cc1('0x1a')](0x190)['json'](_0x43de8e);}var _0x4708f1=_0xe90420[_0x9cc1('0x2d')]['userId'];var _0x4cae91=_0xe90420['body'][_0x9cc1('0x28')];var _0x31e37f=_0xe90420[_0x9cc1('0x2d')][_0x9cc1('0x46')];return getAgent(_0x4708f1)[_0x9cc1('0x1d')](function(_0x2290c5){logger[_0x9cc1('0x15')]('entityFound:',_0x2290c5[_0x9cc1('0x19')]);emit(util[_0x9cc1('0x37')](_0x9cc1('0x33'),_0x2290c5[_0x9cc1('0x19')]),_0x9cc1('0x47'),{'sessionId':_0x4cae91,'transferNumber':_0x31e37f});return _0x47465a[_0x9cc1('0x1a')](0xc8)[_0x9cc1('0x2e')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x47465a));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 11d7261..c934a25 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 _0x4325=['connect-timeout','express','Router','../../config/environment','./whatsappAccount.controller','get','index','isAuthenticated','/:id','show','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','removeDispositions','removeAgents','exports','multer','util'];(function(_0x4be8ba,_0x5d10ba){var _0x1af822=function(_0x40ed8a){while(--_0x40ed8a){_0x4be8ba['push'](_0x4be8ba['shift']());}};_0x1af822(++_0x5d10ba);}(_0x4325,0x1da));var _0x5432=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4325[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var path=require('path');var timeout=require(_0x5432('0x2'));var express=require(_0x5432('0x3'));var router=express[_0x5432('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5432('0x5'));var controller=require(_0x5432('0x6'));router[_0x5432('0x7')]('/',auth['isAuthenticated'](),controller[_0x5432('0x8')]);router[_0x5432('0x7')]('/describe',auth[_0x5432('0x9')](),controller['describe']);router[_0x5432('0x7')](_0x5432('0xa'),auth[_0x5432('0x9')](),controller[_0x5432('0xb')]);router[_0x5432('0x7')]('/:id/dispositions',auth[_0x5432('0x9')](),controller['getDispositions']);router[_0x5432('0x7')](_0x5432('0xc'),auth[_0x5432('0x9')](),controller[_0x5432('0xd')]);router['get']('/:id/users',auth[_0x5432('0x9')](),controller[_0x5432('0xe')]);router['get'](_0x5432('0xf'),auth[_0x5432('0x9')](),controller[_0x5432('0x10')]);router[_0x5432('0x11')]('/',auth[_0x5432('0x9')](),controller[_0x5432('0x12')]);router['post']('/:id/dispositions',auth[_0x5432('0x9')](),controller[_0x5432('0x13')]);router[_0x5432('0x11')](_0x5432('0xc'),auth[_0x5432('0x9')](),controller[_0x5432('0x14')]);router['post'](_0x5432('0x15'),auth['isAuthenticated'](),controller[_0x5432('0x16')]);router[_0x5432('0x11')](_0x5432('0xf'),auth[_0x5432('0x9')](),controller[_0x5432('0x17')]);router['post'](_0x5432('0x18'),controller[_0x5432('0x19')]);router[_0x5432('0x11')](_0x5432('0x1a'),auth[_0x5432('0x9')](),controller[_0x5432('0x1b')]);router[_0x5432('0x1c')]('/:id',auth[_0x5432('0x9')](),controller[_0x5432('0x1d')]);router[_0x5432('0x1e')](_0x5432('0xa'),auth[_0x5432('0x9')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0x5432('0x9')](),controller[_0x5432('0x1f')]);router[_0x5432('0x1e')](_0x5432('0xc'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x5432('0x1e')](_0x5432('0x15'),auth['isAuthenticated'](),controller[_0x5432('0x20')]);module[_0x5432('0x21')]=router; \ No newline at end of file +var _0x6d11=['../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','addDisposition','notify','/:id','update','delete','removeAnswers','removeAgents','exports','multer','util','path','express','../../components/auth/service'];(function(_0x2c77f4,_0x23774e){var _0x3c85c5=function(_0x31f707){while(--_0x31f707){_0x2c77f4['push'](_0x2c77f4['shift']());}};_0x3c85c5(++_0x23774e);}(_0x6d11,0xbf));var _0x16d1=function(_0x403b8a,_0x199f27){_0x403b8a=_0x403b8a-0x0;var _0x3b5a18=_0x6d11[_0x403b8a];return _0x3b5a18;};'use strict';var multer=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var path=require(_0x16d1('0x2'));var timeout=require('connect-timeout');var express=require(_0x16d1('0x3'));var router=express['Router']();var auth=require(_0x16d1('0x4'));var interaction=require(_0x16d1('0x5'));var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0x16d1('0x6')]('/',auth[_0x16d1('0x7')](),controller[_0x16d1('0x8')]);router[_0x16d1('0x6')](_0x16d1('0x9'),auth[_0x16d1('0x7')](),controller[_0x16d1('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x16d1('0xb')]);router[_0x16d1('0x6')](_0x16d1('0xc'),auth[_0x16d1('0x7')](),controller['getDispositions']);router[_0x16d1('0x6')](_0x16d1('0xd'),auth[_0x16d1('0x7')](),controller[_0x16d1('0xe')]);router[_0x16d1('0x6')](_0x16d1('0xf'),auth[_0x16d1('0x7')](),controller[_0x16d1('0x10')]);router['get'](_0x16d1('0x11'),auth[_0x16d1('0x7')](),controller[_0x16d1('0x12')]);router[_0x16d1('0x13')]('/',auth[_0x16d1('0x7')](),controller['create']);router[_0x16d1('0x13')](_0x16d1('0xc'),auth[_0x16d1('0x7')](),controller[_0x16d1('0x14')]);router[_0x16d1('0x13')](_0x16d1('0xd'),auth[_0x16d1('0x7')](),controller['addAnswer']);router[_0x16d1('0x13')](_0x16d1('0xf'),auth['isAuthenticated'](),controller['addAgents']);router[_0x16d1('0x13')]('/:id/applications',auth[_0x16d1('0x7')](),controller['addApplications']);router[_0x16d1('0x13')]('/:id/notify',controller[_0x16d1('0x15')]);router[_0x16d1('0x13')]('/:id/send',auth['isAuthenticated'](),controller['send']);router['put'](_0x16d1('0x16'),auth['isAuthenticated'](),controller[_0x16d1('0x17')]);router[_0x16d1('0x18')](_0x16d1('0x16'),auth[_0x16d1('0x7')](),controller['destroy']);router[_0x16d1('0x18')](_0x16d1('0xc'),auth[_0x16d1('0x7')](),controller['removeDispositions']);router[_0x16d1('0x18')](_0x16d1('0xd'),auth[_0x16d1('0x7')](),controller[_0x16d1('0x19')]);router[_0x16d1('0x18')](_0x16d1('0xf'),auth[_0x16d1('0x7')](),controller[_0x16d1('0x1a')]);module[_0x16d1('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 98f31ec..a6404dc 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 _0xb214=['BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','ENUM','twilio','TEXT'];(function(_0x5ad3f7,_0x17569d){var _0x5316b9=function(_0x48ab27){while(--_0x48ab27){_0x5ad3f7['push'](_0x5ad3f7['shift']());}};_0x5316b9(++_0x17569d);}(_0xb214,0x14a));var _0x4b21=function(_0x2e450e,_0x2f2a90){_0x2e450e=_0x2e450e-0x0;var _0x1db5d0=_0xb214[_0x2e450e];return _0x1db5d0;};'use strict';var Sequelize=require(_0x4b21('0x0'));var rs=require(_0x4b21('0x1'));module['exports']={'name':{'type':Sequelize[_0x4b21('0x2')],'unique':_0x4b21('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x4b21('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x4b21('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x4b21('0x2')],'defaultValue':function(){return rs[_0x4b21('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4b21('0x5')](_0x4b21('0x6'))},'accountSid':{'type':Sequelize[_0x4b21('0x2')]},'authToken':{'type':Sequelize[_0x4b21('0x2')]},'notificationTemplate':{'type':Sequelize[_0x4b21('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x4b21('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x4b21('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4b21('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4b21('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4b21('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4b21('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4b21('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4b21('0x8')],'defaultValue':![],'comment':_0x4b21('0xa'),'set':function(_0x14d428){if(!_0x14d428){this['setDataValue']('mandatoryDispositionPauseId',null);}this[_0x4b21('0xb')](_0x4b21('0xc'),_0x14d428);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x218b=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x50f5bc,_0x10bf6b){var _0x2c1b5d=function(_0x21f12b){while(--_0x21f12b){_0x50f5bc['push'](_0x50f5bc['shift']());}};_0x2c1b5d(++_0x10bf6b);}(_0x218b,0xaa));var _0xb218=function(_0x43b051,_0x311b21){_0x43b051=_0x43b051-0x0;var _0xf24ed7=_0x218b[_0x43b051];return _0xf24ed7;};'use strict';var Sequelize=require(_0xb218('0x0'));var rs=require(_0xb218('0x1'));module[_0xb218('0x2')]={'name':{'type':Sequelize[_0xb218('0x3')],'unique':_0xb218('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xb218('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xb218('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xb218('0x3')],'defaultValue':function(){return rs[_0xb218('0x5')]();}},'phone':{'type':Sequelize[_0xb218('0x3')]},'type':{'type':Sequelize['ENUM']('twilio')},'accountSid':{'type':Sequelize[_0xb218('0x3')]},'authToken':{'type':Sequelize[_0xb218('0x3')]},'notificationTemplate':{'type':Sequelize[_0xb218('0x6')],'defaultValue':function(){return _0xb218('0x7');}},'notificationSound':{'type':Sequelize[_0xb218('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb218('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb218('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb218('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb218('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb218('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb218('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb218('0x9')],'comment':_0xb218('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xb218('0x8')],'defaultValue':![],'comment':_0xb218('0xb'),'set':function(_0x5322b3){if(!_0x5322b3){this[_0xb218('0xc')](_0xb218('0xd'),null);}this[_0xb218('0xc')](_0xb218('0xe'),_0x5322b3);}},'description':{'type':Sequelize[_0xb218('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 3aa5a28..37b8cce 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 _0x66b1=['UserId','User','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','send','to\x20is\x20mandatory','List','out','dataValues','Messages','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','register','jayson/promise','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','WhatsappAccounts','stack','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','get','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','getApplications','whatsapp','Applications','priority','asc','account','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','DESC','list','Contacts','WhatsappInteraction','interaction','created','autoclose','applications','push','close','*,*,*,*','WhatsappMessage','ContactId','AttachmentId'];(function(_0x12fca3,_0x1dd5e4){var _0x1aa91f=function(_0x4db804){while(--_0x4db804){_0x12fca3['push'](_0x12fca3['shift']());}};_0x1aa91f(++_0x1dd5e4);}(_0x66b1,0xce));var _0x166b=function(_0x577e06,_0x505275){_0x577e06=_0x577e06-0x0;var _0x52159b=_0x66b1[_0x577e06];return _0x52159b;};'use strict';var pdf=require(_0x166b('0x0'));var emlformat=require(_0x166b('0x1'));var rimraf=require(_0x166b('0x2'));var zipdir=require(_0x166b('0x3'));var jsonpatch=require(_0x166b('0x4'));var rp=require(_0x166b('0x5'));var moment=require(_0x166b('0x6'));var BPromise=require(_0x166b('0x7'));var Mustache=require(_0x166b('0x8'));var util=require(_0x166b('0x9'));var path=require(_0x166b('0xa'));var sox=require(_0x166b('0xb'));var csv=require('to-csv');var ejs=require(_0x166b('0xc'));var fs=require('fs');var _=require(_0x166b('0xd'));var squel=require(_0x166b('0xe'));var crypto=require(_0x166b('0xf'));var jsforce=require(_0x166b('0x10'));var deskjs=require(_0x166b('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x166b('0x12'));var Redis=require(_0x166b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x166b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x166b('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x166b('0x16'));var licenseUtil=require(_0x166b('0x17'));var db=require(_0x166b('0x18'))['db'];config[_0x166b('0x19')]=_[_0x166b('0x1a')](config[_0x166b('0x19')],{'host':_0x166b('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x166b('0x19')]));require(_0x166b('0x1c'))[_0x166b('0x1d')](socket);var jayson=require(_0x166b('0x1e'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x40281e,_0x205ac9,_0x4b2e8e,_0x3a1537){return new BPromise(function(_0x1981c2,_0x5bcfc5){var _0x14a6ad=_0x3a1537||client;return _0x14a6ad[_0x166b('0x1f')](_0x40281e,_0x4b2e8e)[_0x166b('0x20')](function(_0x1dd0cb){logger['info'](_0x166b('0x21'),_0x205ac9,_0x166b('0x22'));logger['debug'](_0x166b('0x23'),_0x205ac9,_0x166b('0x22'),JSON[_0x166b('0x24')](_0x1dd0cb));if(_0x1dd0cb[_0x166b('0x25')]){if(_0x1dd0cb[_0x166b('0x25')]['code']===0x1f4){logger[_0x166b('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x205ac9,_0x1dd0cb[_0x166b('0x25')][_0x166b('0x26')]);return _0x5bcfc5(_0x1dd0cb[_0x166b('0x25')][_0x166b('0x26')]);}logger[_0x166b('0x25')](_0x166b('0x21'),_0x205ac9,_0x1dd0cb['error'][_0x166b('0x26')]);return _0x1981c2(_0x1dd0cb[_0x166b('0x25')][_0x166b('0x26')]);}else{logger[_0x166b('0x27')](_0x166b('0x21'),_0x205ac9,'request\x20sent');_0x1981c2(_0x1dd0cb[_0x166b('0x28')][_0x166b('0x26')]);}})[_0x166b('0x29')](function(_0x3dd45f){logger[_0x166b('0x25')](_0x166b('0x21'),_0x205ac9,_0x3dd45f);_0x5bcfc5(_0x3dd45f);});});}function respondWithStatusCode(_0x3005fd,_0x5e08a9){_0x5e08a9=_0x5e08a9||0xcc;return function(_0x53e1c3){if(_0x53e1c3){return _0x3005fd[_0x166b('0x2a')](_0x5e08a9);}return _0x3005fd[_0x166b('0x2b')](_0x5e08a9)[_0x166b('0x2c')]();};}function respondWithResult(_0x21e79c,_0x2ba3c4){_0x2ba3c4=_0x2ba3c4||0xc8;return function(_0x459995){if(_0x459995){return _0x21e79c[_0x166b('0x2b')](_0x2ba3c4)[_0x166b('0x2d')](_0x459995);}};}function respondWithFilteredResult(_0x268476,_0x56a875){return function(_0xebf10d){if(_0xebf10d){var _0x12089f=_0xebf10d[_0x166b('0x2e')],_0x183fcd=_0x56a875[_0x166b('0x2f')],_0x185061=_0x56a875['offset']+_0x56a875['limit'],_0x4e002f;if(_0x185061>=_0x12089f){_0x185061=_0x12089f;_0x4e002f=0xc8;}else{_0x4e002f=0xce;}_0x268476[_0x166b('0x2b')](_0x4e002f);return _0x268476[_0x166b('0x30')](_0x166b('0x31'),_0x183fcd+'-'+_0x185061+'/'+_0x12089f)[_0x166b('0x2d')](_0xebf10d);}return null;};}function patchUpdates(_0x3ebcf8){return function(_0x15d29f){try{jsonpatch[_0x166b('0x32')](_0x15d29f,_0x3ebcf8,!![]);}catch(_0x3016ea){return BPromise[_0x166b('0x33')](_0x3016ea);}return _0x15d29f[_0x166b('0x34')]();};}function saveUpdates(_0x5c6a6f,_0x48371b){return function(_0x204753){if(_0x204753){return _0x204753['update'](_0x5c6a6f)['then'](function(_0x7909fd){return _0x7909fd;});}return null;};}function removeEntity(_0x2d63ea,_0x577776){return function(_0x3c6a9e){if(_0x3c6a9e){return _0x3c6a9e[_0x166b('0x35')]()[_0x166b('0x20')](function(){var _0x1de2a9=_0x3c6a9e['get']({'plain':!![]});var _0xd0ae9a=_0x166b('0x36');return db['UserProfileResource'][_0x166b('0x35')]({'where':{'type':_0xd0ae9a,'resourceId':_0x1de2a9['id']}})[_0x166b('0x20')](function(){return _0x3c6a9e;});})[_0x166b('0x20')](function(){_0x2d63ea['status'](0xcc)[_0x166b('0x2c')]();});}};}function handleEntityNotFound(_0x5720e6,_0x177e43){return function(_0x1db166){if(!_0x1db166){_0x5720e6[_0x166b('0x2a')](0x194);}return _0x1db166;};}function handleError(_0x29a6d8,_0x378256){_0x378256=_0x378256||0x1f4;return function(_0xb98749){logger[_0x166b('0x25')](_0xb98749[_0x166b('0x37')]);if(_0xb98749[_0x166b('0x38')]){delete _0xb98749['name'];}_0x29a6d8[_0x166b('0x2b')](_0x378256)['send'](_0xb98749);};}exports[_0x166b('0x39')]=function(_0x4bce7e,_0x130b04){var _0x255be7={'include':[{'model':db[_0x166b('0x3a')],'as':_0x166b('0x3b')}]},_0x2ea8a6={},_0x24e90a={'count':0x0,'rows':[]};var _0x3f7c68=_[_0x166b('0x3c')](db[_0x166b('0x3d')][_0x166b('0x3e')],function(_0x17110c){return{'name':_0x17110c[_0x166b('0x3f')],'type':_0x17110c[_0x166b('0x40')][_0x166b('0x41')]};});_0x2ea8a6[_0x166b('0x42')]=_['map'](_0x3f7c68,'name');_0x2ea8a6['query']=_['keys'](_0x4bce7e['query']);_0x2ea8a6[_0x166b('0x43')]=_[_0x166b('0x44')](_0x2ea8a6[_0x166b('0x42')],_0x2ea8a6[_0x166b('0x45')]);_0x255be7['attributes']=_[_0x166b('0x44')](_0x2ea8a6[_0x166b('0x42')],qs[_0x166b('0x46')](_0x4bce7e['query']['fields']));_0x255be7[_0x166b('0x47')]=_0x255be7[_0x166b('0x47')][_0x166b('0x48')]?_0x255be7[_0x166b('0x47')]:_0x2ea8a6[_0x166b('0x42')];if(!_0x4bce7e[_0x166b('0x45')][_0x166b('0x49')]('nolimit')){_0x255be7['limit']=qs[_0x166b('0x4a')](_0x4bce7e['query'][_0x166b('0x4a')]);_0x255be7[_0x166b('0x2f')]=qs[_0x166b('0x2f')](_0x4bce7e[_0x166b('0x45')]['offset']);}_0x255be7[_0x166b('0x4b')]=qs[_0x166b('0x4c')](_0x4bce7e[_0x166b('0x45')][_0x166b('0x4c')]);_0x255be7[_0x166b('0x4d')]=qs[_0x166b('0x43')](_[_0x166b('0x4e')](_0x4bce7e[_0x166b('0x45')],_0x2ea8a6[_0x166b('0x43')]),_0x3f7c68);if(_0x4bce7e[_0x166b('0x45')][_0x166b('0x4f')]){_0x255be7[_0x166b('0x4d')]=_['merge'](_0x255be7[_0x166b('0x4d')],{'$or':_[_0x166b('0x3c')](_0x3f7c68,function(_0x1904ff){if(_0x1904ff[_0x166b('0x40')]!==_0x166b('0x50')){var _0x46a73a={};_0x46a73a[_0x1904ff[_0x166b('0x38')]]={'$like':'%'+_0x4bce7e[_0x166b('0x45')][_0x166b('0x4f')]+'%'};return _0x46a73a;}})});}_0x255be7=_[_0x166b('0x51')]({},_0x255be7,_0x4bce7e['options']);var _0x473224={'where':_0x255be7[_0x166b('0x4d')]};return db[_0x166b('0x3d')][_0x166b('0x2e')](_0x473224)['then'](function(_0x18d63b){_0x24e90a[_0x166b('0x2e')]=_0x18d63b;if(_0x4bce7e['query'][_0x166b('0x52')]){_0x255be7[_0x166b('0x53')]=[{'all':!![]}];}return db[_0x166b('0x3d')][_0x166b('0x54')](_0x255be7);})['then'](function(_0x363a63){_0x24e90a[_0x166b('0x55')]=_0x363a63;return _0x24e90a;})['then'](respondWithFilteredResult(_0x130b04,_0x255be7))[_0x166b('0x29')](handleError(_0x130b04,null));};exports[_0x166b('0x56')]=function(_0x1661df,_0x4899c7){var _0x495b8b={'raw':![],'where':{'id':_0x1661df[_0x166b('0x57')]['id']},'include':[{'model':db[_0x166b('0x3a')],'as':_0x166b('0x3b')}]},_0xe923a1={};_0xe923a1[_0x166b('0x42')]=_['keys'](db['WhatsappAccount'][_0x166b('0x3e')]);_0xe923a1[_0x166b('0x45')]=_[_0x166b('0x58')](_0x1661df[_0x166b('0x45')]);_0xe923a1[_0x166b('0x43')]=_[_0x166b('0x44')](_0xe923a1[_0x166b('0x42')],_0xe923a1[_0x166b('0x45')]);_0x495b8b[_0x166b('0x47')]=_[_0x166b('0x44')](_0xe923a1[_0x166b('0x42')],qs[_0x166b('0x46')](_0x1661df[_0x166b('0x45')][_0x166b('0x46')]));_0x495b8b[_0x166b('0x47')]=_0x495b8b[_0x166b('0x47')][_0x166b('0x48')]?_0x495b8b[_0x166b('0x47')]:_0xe923a1[_0x166b('0x42')];if(_0x1661df[_0x166b('0x45')]['includeAll']){_0x495b8b[_0x166b('0x53')]=[{'all':!![]}];}_0x495b8b=_['merge']({},_0x495b8b,_0x1661df[_0x166b('0x59')]);return db[_0x166b('0x3d')][_0x166b('0x5a')](_0x495b8b)['then'](handleEntityNotFound(_0x4899c7,null))[_0x166b('0x20')](respondWithResult(_0x4899c7,null))['catch'](handleError(_0x4899c7,null));};exports[_0x166b('0x5b')]=function(_0x83139c,_0x43965e){return db[_0x166b('0x3d')][_0x166b('0x5b')](_0x83139c[_0x166b('0x5c')],{})[_0x166b('0x20')](function(_0x4d2df3){var _0x4938e1=_0x83139c['user'][_0x166b('0x5d')]({'plain':!![]});if(!_0x4938e1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4938e1[_0x166b('0x5e')]===_0x166b('0x5f')){var _0x1d6642=_0x4d2df3['get']({'plain':!![]});var _0x3bb9ca=_0x166b('0x36');return db[_0x166b('0x60')][_0x166b('0x5a')]({'where':{'name':_0x3bb9ca,'userProfileId':_0x4938e1[_0x166b('0x61')]},'raw':!![]})[_0x166b('0x20')](function(_0x246df8){if(_0x246df8&&_0x246df8['autoAssociation']===0x0){return db[_0x166b('0x62')][_0x166b('0x5b')]({'name':_0x1d6642[_0x166b('0x38')],'resourceId':_0x1d6642['id'],'type':_0x246df8[_0x166b('0x38')],'sectionId':_0x246df8['id']},{})['then'](function(){return _0x4d2df3;});}else{return _0x4d2df3;}})['catch'](function(_0x197f8d){logger['error'](_0x166b('0x63'),_0x197f8d);throw _0x197f8d;});}return _0x4d2df3;})['then'](respondWithResult(_0x43965e,0xc9))['catch'](handleError(_0x43965e,null));};exports[_0x166b('0x64')]=function(_0x5a9941,_0x1e71f2){if(_0x5a9941[_0x166b('0x5c')]['id']){delete _0x5a9941['body']['id'];}return db[_0x166b('0x3d')]['find']({'where':{'id':_0x5a9941[_0x166b('0x57')]['id']},'include':[{'model':db[_0x166b('0x3a')],'as':_0x166b('0x3b')}]})[_0x166b('0x20')](handleEntityNotFound(_0x1e71f2,null))['then'](saveUpdates(_0x5a9941[_0x166b('0x5c')],null))[_0x166b('0x20')](respondWithResult(_0x1e71f2,null))[_0x166b('0x29')](handleError(_0x1e71f2,null));};exports['destroy']=function(_0x3d3aed,_0x53df37){return db[_0x166b('0x3d')][_0x166b('0x5a')]({'where':{'id':_0x3d3aed[_0x166b('0x57')]['id']}})[_0x166b('0x20')](handleEntityNotFound(_0x53df37,null))[_0x166b('0x20')](removeEntity(_0x53df37,null))[_0x166b('0x29')](handleError(_0x53df37,null));};exports[_0x166b('0x65')]=function(_0x35fbb4,_0x18b4db){return db[_0x166b('0x3d')][_0x166b('0x65')]()[_0x166b('0x20')](respondWithResult(_0x18b4db,null))['catch'](handleError(_0x18b4db,null));};exports[_0x166b('0x66')]=function(_0x468ed8,_0x536d7f,_0x183e09){if(_0x468ed8['body']['id']){delete _0x468ed8[_0x166b('0x5c')]['id'];}return db[_0x166b('0x3d')][_0x166b('0x5a')]({'where':{'id':_0x468ed8[_0x166b('0x57')]['id']}})[_0x166b('0x20')](handleEntityNotFound(_0x536d7f,null))[_0x166b('0x20')](function(_0x5f2138){if(_0x5f2138){_0x468ed8[_0x166b('0x5c')][_0x166b('0x67')]=_0x5f2138['id'];return db[_0x166b('0x68')]['create'](_0x468ed8[_0x166b('0x5c')]);}})[_0x166b('0x20')](respondWithResult(_0x536d7f,null))[_0x166b('0x29')](handleError(_0x536d7f,null));};exports[_0x166b('0x69')]=function(_0x3b1a15,_0x2176ae,_0x269235){var _0x22344e={'raw':![],'where':{}};var _0x5451fd={};var _0x3ba622={'count':0x0,'rows':[]};return db[_0x166b('0x3d')][_0x166b('0x6a')]({'where':{'id':_0x3b1a15[_0x166b('0x57')]['id']}})['then'](handleEntityNotFound(_0x2176ae,null))[_0x166b('0x20')](function(_0xb6d6d9){if(_0xb6d6d9){_0x5451fd[_0x166b('0x42')]=_[_0x166b('0x58')](db['Disposition']['rawAttributes']);_0x5451fd['query']=_[_0x166b('0x58')](_0x3b1a15[_0x166b('0x45')]);_0x5451fd[_0x166b('0x43')]=_[_0x166b('0x44')](_0x5451fd[_0x166b('0x42')],_0x5451fd[_0x166b('0x45')]);_0x22344e[_0x166b('0x47')]=_[_0x166b('0x44')](_0x5451fd[_0x166b('0x42')],qs['fields'](_0x3b1a15['query']['fields']));_0x22344e['attributes']=_0x22344e[_0x166b('0x47')][_0x166b('0x48')]?_0x22344e[_0x166b('0x47')]:_0x5451fd[_0x166b('0x42')];if(!_0x3b1a15[_0x166b('0x45')][_0x166b('0x49')](_0x166b('0x6b'))){_0x22344e[_0x166b('0x4a')]=qs[_0x166b('0x4a')](_0x3b1a15[_0x166b('0x45')]['limit']);_0x22344e[_0x166b('0x2f')]=qs[_0x166b('0x2f')](_0x3b1a15['query']['offset']);}_0x22344e[_0x166b('0x4b')]=qs['sort'](_0x3b1a15[_0x166b('0x45')]['sort']);_0x22344e['where']=qs[_0x166b('0x43')](_['pick'](_0x3b1a15[_0x166b('0x45')],_0x5451fd['filters']));_0x22344e['where']['WhatsappAccountId']=_0xb6d6d9['id'];if(_0x3b1a15[_0x166b('0x45')]['filter']){_0x22344e[_0x166b('0x4d')]=_['merge'](_0x22344e[_0x166b('0x4d')],{'$or':_[_0x166b('0x3c')](_0x22344e[_0x166b('0x47')],function(_0x186fc0){var _0x4af40d={};_0x4af40d[_0x186fc0]={'$like':'%'+_0x3b1a15[_0x166b('0x45')][_0x166b('0x4f')]+'%'};return _0x4af40d;})});}_0x22344e=_[_0x166b('0x51')]({},_0x22344e,_0x3b1a15[_0x166b('0x59')]);return db[_0x166b('0x68')]['count']({'where':_0x22344e[_0x166b('0x4d')]})[_0x166b('0x20')](function(_0xb74f90){_0x3ba622[_0x166b('0x2e')]=_0xb74f90;if(_0x3b1a15[_0x166b('0x45')][_0x166b('0x52')]){_0x22344e[_0x166b('0x53')]=[{'all':!![]}];}return db[_0x166b('0x68')]['findAll'](_0x22344e);})[_0x166b('0x20')](function(_0x587b0a){_0x3ba622[_0x166b('0x55')]=_0x587b0a;return _0x3ba622;});}})[_0x166b('0x20')](respondWithFilteredResult(_0x2176ae,_0x22344e))[_0x166b('0x29')](handleError(_0x2176ae,null));};exports[_0x166b('0x6c')]=function(_0x22db2b,_0x3685f1,_0x3b0d19){return db['WhatsappAccount'][_0x166b('0x5a')]({'where':{'id':_0x22db2b['params']['id']}})[_0x166b('0x20')](handleEntityNotFound(_0x3685f1,null))['then'](function(_0x5867e7){if(_0x5867e7){return _0x5867e7[_0x166b('0x6c')](_0x22db2b[_0x166b('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x3685f1,null))[_0x166b('0x29')](handleError(_0x3685f1,null));};exports[_0x166b('0x6d')]=function(_0x490934,_0x461bab,_0x31f569){if(_0x490934['body']['id']){delete _0x490934['body']['id'];}return db[_0x166b('0x3d')]['find']({'where':{'id':_0x490934['params']['id']}})[_0x166b('0x20')](handleEntityNotFound(_0x461bab,null))[_0x166b('0x20')](function(_0x2bcd51){if(_0x2bcd51){_0x490934[_0x166b('0x5c')][_0x166b('0x67')]=_0x2bcd51['id'];return db[_0x166b('0x6e')][_0x166b('0x5b')](_0x490934['body']);}})['then'](respondWithResult(_0x461bab,null))[_0x166b('0x29')](handleError(_0x461bab,null));};exports[_0x166b('0x6f')]=function(_0xe38538,_0x539791,_0x16ec4c){var _0x4791e0={'raw':![],'where':{}};var _0x287f03={};var _0x200997={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x166b('0x6a')]({'where':{'id':_0xe38538[_0x166b('0x57')]['id']}})['then'](handleEntityNotFound(_0x539791,null))[_0x166b('0x20')](function(_0x14fe52){if(_0x14fe52){_0x287f03[_0x166b('0x42')]=_[_0x166b('0x58')](db[_0x166b('0x6e')][_0x166b('0x3e')]);_0x287f03[_0x166b('0x45')]=_['keys'](_0xe38538[_0x166b('0x45')]);_0x287f03[_0x166b('0x43')]=_['intersection'](_0x287f03[_0x166b('0x42')],_0x287f03['query']);_0x4791e0[_0x166b('0x47')]=_[_0x166b('0x44')](_0x287f03[_0x166b('0x42')],qs['fields'](_0xe38538[_0x166b('0x45')]['fields']));_0x4791e0[_0x166b('0x47')]=_0x4791e0[_0x166b('0x47')]['length']?_0x4791e0[_0x166b('0x47')]:_0x287f03[_0x166b('0x42')];if(!_0xe38538[_0x166b('0x45')][_0x166b('0x49')](_0x166b('0x6b'))){_0x4791e0[_0x166b('0x4a')]=qs['limit'](_0xe38538['query'][_0x166b('0x4a')]);_0x4791e0[_0x166b('0x2f')]=qs['offset'](_0xe38538[_0x166b('0x45')]['offset']);}_0x4791e0[_0x166b('0x4b')]=qs['sort'](_0xe38538[_0x166b('0x45')][_0x166b('0x4c')]);_0x4791e0[_0x166b('0x4d')]=qs['filters'](_[_0x166b('0x4e')](_0xe38538['query'],_0x287f03[_0x166b('0x43')]));_0x4791e0[_0x166b('0x4d')]['WhatsappAccountId']=_0x14fe52['id'];if(_0xe38538[_0x166b('0x45')]['filter']){_0x4791e0[_0x166b('0x4d')]=_['merge'](_0x4791e0[_0x166b('0x4d')],{'$or':_['map'](_0x4791e0[_0x166b('0x47')],function(_0x142546){var _0x5ddba3={};_0x5ddba3[_0x142546]={'$like':'%'+_0xe38538['query'][_0x166b('0x4f')]+'%'};return _0x5ddba3;})});}_0x4791e0=_['merge']({},_0x4791e0,_0xe38538['options']);return db['CannedAnswer'][_0x166b('0x2e')]({'where':_0x4791e0[_0x166b('0x4d')]})[_0x166b('0x20')](function(_0x5b79cd){_0x200997[_0x166b('0x2e')]=_0x5b79cd;if(_0xe38538[_0x166b('0x45')][_0x166b('0x52')]){_0x4791e0[_0x166b('0x53')]=[{'all':!![]}];}return db[_0x166b('0x6e')][_0x166b('0x54')](_0x4791e0);})[_0x166b('0x20')](function(_0x1df662){_0x200997['rows']=_0x1df662;return _0x200997;});}})[_0x166b('0x20')](respondWithFilteredResult(_0x539791,_0x4791e0))['catch'](handleError(_0x539791,null));};exports['removeAnswers']=function(_0x3e1e05,_0x5dd03d,_0x11f693){return db[_0x166b('0x3d')][_0x166b('0x5a')]({'where':{'id':_0x3e1e05[_0x166b('0x57')]['id']}})[_0x166b('0x20')](handleEntityNotFound(_0x5dd03d,null))[_0x166b('0x20')](function(_0x2f9d13){if(_0x2f9d13){return _0x2f9d13[_0x166b('0x70')](_0x3e1e05[_0x166b('0x45')][_0x166b('0x71')]);}})[_0x166b('0x20')](respondWithStatusCode(_0x5dd03d,null))['catch'](handleError(_0x5dd03d,null));};exports[_0x166b('0x72')]=function(_0x29eb63,_0x40f95a,_0x2e5d96){return db[_0x166b('0x3d')][_0x166b('0x5a')]({'where':{'id':_0x29eb63[_0x166b('0x57')]['id']}})[_0x166b('0x20')](handleEntityNotFound(_0x40f95a,null))[_0x166b('0x20')](function(_0x25aa14){if(_0x25aa14){return _0x25aa14['addAgents'](_0x29eb63[_0x166b('0x5c')]['ids'],_[_0x166b('0x73')](_0x29eb63[_0x166b('0x5c')],['ids','id'])||{})[_0x166b('0x74')](function(_0x2d26ff){for(var _0x740ac=0x0;_0x740ac<_0x29eb63[_0x166b('0x5c')]['ids'][_0x166b('0x48')];_0x740ac+=0x1){socket['emit'](_0x166b('0x75'),{'UserId':_0x29eb63[_0x166b('0x5c')]['ids'][_0x740ac],'WhatsappAccountId':_0x29eb63['params']['id']});}return _0x2d26ff;});}})[_0x166b('0x20')](respondWithResult(_0x40f95a,null))[_0x166b('0x29')](handleError(_0x40f95a,null));};exports[_0x166b('0x76')]=function(_0x182721,_0xc4c5c,_0x1392ee){return db[_0x166b('0x3d')][_0x166b('0x5a')]({'where':{'id':_0x182721['params']['id']}})[_0x166b('0x20')](handleEntityNotFound(_0xc4c5c,null))['then'](function(_0x46ee30){if(_0x46ee30){return _0x46ee30[_0x166b('0x76')](_0x182721['query'][_0x166b('0x71')])[_0x166b('0x20')](function(){if(_[_0x166b('0x77')](_0x182721['query'][_0x166b('0x71')])){for(var _0x471612=0x0;_0x471612<_0x182721[_0x166b('0x45')][_0x166b('0x71')][_0x166b('0x48')];_0x471612+=0x1){socket[_0x166b('0x78')](_0x166b('0x79'),{'UserId':Number(_0x182721[_0x166b('0x45')]['ids'][_0x471612]),'WhatsappAccountId':Number(_0x182721[_0x166b('0x57')]['id'])});}}else{socket['emit'](_0x166b('0x79'),{'UserId':Number(_0x182721[_0x166b('0x45')][_0x166b('0x71')]),'WhatsappAccountId':Number(_0x182721[_0x166b('0x57')]['id'])});}});}})[_0x166b('0x20')](respondWithStatusCode(_0xc4c5c,null))[_0x166b('0x29')](handleError(_0xc4c5c,null));};exports[_0x166b('0x7a')]=function(_0x42a53e,_0x25bde5,_0x445bb5){var _0x1812b0={};var _0x1967fb={};var _0x15e2b2;var _0x4daf0e;return db[_0x166b('0x3d')][_0x166b('0x6a')]({'where':{'id':_0x42a53e[_0x166b('0x57')]['id']}})[_0x166b('0x20')](handleEntityNotFound(_0x25bde5,null))[_0x166b('0x20')](function(_0xf00122){if(_0xf00122){_0x15e2b2=_0xf00122;_0x1967fb[_0x166b('0x42')]=_[_0x166b('0x58')](db['User']['rawAttributes']);_0x1967fb['query']=_[_0x166b('0x58')](_0x42a53e[_0x166b('0x45')]);_0x1967fb[_0x166b('0x43')]=_[_0x166b('0x44')](_0x1967fb[_0x166b('0x42')],_0x1967fb[_0x166b('0x45')]);_0x1812b0['attributes']=_[_0x166b('0x44')](_0x1967fb[_0x166b('0x42')],qs['fields'](_0x42a53e[_0x166b('0x45')][_0x166b('0x46')]));_0x1812b0[_0x166b('0x47')]=_0x1812b0[_0x166b('0x47')][_0x166b('0x48')]?_0x1812b0['attributes']:_0x1967fb[_0x166b('0x42')];_0x1812b0[_0x166b('0x4b')]=qs[_0x166b('0x4c')](_0x42a53e[_0x166b('0x45')]['sort']);_0x1812b0[_0x166b('0x4d')]=qs[_0x166b('0x43')](_['pick'](_0x42a53e[_0x166b('0x45')],_0x1967fb[_0x166b('0x43')]));if(_0x42a53e[_0x166b('0x45')][_0x166b('0x4f')]){_0x1812b0[_0x166b('0x4d')]=_[_0x166b('0x51')](_0x1812b0['where'],{'$or':_['map'](_0x1812b0['attributes'],function(_0x476c93){var _0x52d348={};_0x52d348[_0x476c93]={'$like':'%'+_0x42a53e[_0x166b('0x45')]['filter']+'%'};return _0x52d348;})});}_0x1812b0=_[_0x166b('0x51')]({},_0x1812b0,_0x42a53e[_0x166b('0x59')]);return _0x15e2b2[_0x166b('0x7a')](_0x1812b0);}})['then'](function(_0x4e1da3){if(_0x4e1da3){_0x4daf0e=_0x4e1da3[_0x166b('0x48')];if(!_0x42a53e[_0x166b('0x45')][_0x166b('0x49')](_0x166b('0x6b'))){_0x1812b0['limit']=qs['limit'](_0x42a53e[_0x166b('0x45')][_0x166b('0x4a')]);_0x1812b0[_0x166b('0x2f')]=qs['offset'](_0x42a53e[_0x166b('0x45')][_0x166b('0x2f')]);}return _0x15e2b2[_0x166b('0x7a')](_0x1812b0);}})[_0x166b('0x20')](function(_0x45fcc0){if(_0x45fcc0){return _0x45fcc0?{'count':_0x4daf0e,'rows':_0x45fcc0}:null;}})[_0x166b('0x20')](respondWithResult(_0x25bde5,null))[_0x166b('0x29')](handleError(_0x25bde5,null));};exports[_0x166b('0x7b')]=function(_0x3bc9c0,_0x2da8e,_0x4f3381){return db[_0x166b('0x3d')][_0x166b('0x6a')]({'where':{'id':_0x3bc9c0[_0x166b('0x57')]['id']}})['then'](handleEntityNotFound(_0x2da8e,null))[_0x166b('0x20')](function(_0x366b88){if(_0x366b88){return db[_0x166b('0x7c')][_0x166b('0x7d')](function(_0x4bbd46){return db['WhatsappApplication'][_0x166b('0x35')]({'where':{'WhatsappAccountId':_0x3bc9c0[_0x166b('0x57')]['id']},'transaction':_0x4bbd46})[_0x166b('0x20')](function(_0xaba05a){var _0x4d7268=_[_0x166b('0x3c')](_0x3bc9c0['body'],function(_0x1ab263){_0x1ab263[_0x166b('0x67')]=_0x3bc9c0['params']['id'];return _0x1ab263;});return db[_0x166b('0x7e')][_0x166b('0x7f')](_0x4d7268,{'transaction':_0x4bbd46});});})[_0x166b('0x20')](function(){return db[_0x166b('0x7e')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x3bc9c0[_0x166b('0x57')]['id']},'order':'priority'});});}})[_0x166b('0x20')](respondWithResult(_0x2da8e,null))[_0x166b('0x29')](handleError(_0x2da8e,null));};exports[_0x166b('0x80')]=function(_0x24bdfd,_0x590f9d,_0x4d6231){var _0x24a844={};var _0x1129d5={};var _0x306f3a;var _0x21c59b;return db[_0x166b('0x3d')][_0x166b('0x6a')]({'where':{'id':_0x24bdfd['params']['id']}})[_0x166b('0x20')](handleEntityNotFound(_0x590f9d,null))[_0x166b('0x20')](function(_0x16c279){if(_0x16c279){_0x306f3a=_0x16c279;_0x1129d5[_0x166b('0x42')]=_['keys'](db[_0x166b('0x7e')][_0x166b('0x3e')]);_0x1129d5[_0x166b('0x45')]=_[_0x166b('0x58')](_0x24bdfd[_0x166b('0x45')]);_0x1129d5['filters']=_[_0x166b('0x44')](_0x1129d5[_0x166b('0x42')],_0x1129d5[_0x166b('0x45')]);_0x24a844[_0x166b('0x47')]=_[_0x166b('0x44')](_0x1129d5[_0x166b('0x42')],qs[_0x166b('0x46')](_0x24bdfd[_0x166b('0x45')]['fields']));_0x24a844[_0x166b('0x47')]=_0x24a844[_0x166b('0x47')]['length']?_0x24a844[_0x166b('0x47')]:_0x1129d5['model'];_0x24a844[_0x166b('0x4b')]=qs[_0x166b('0x4c')](_0x24bdfd[_0x166b('0x45')][_0x166b('0x4c')]);_0x24a844[_0x166b('0x4d')]=qs[_0x166b('0x43')](_[_0x166b('0x4e')](_0x24bdfd[_0x166b('0x45')],_0x1129d5['filters']));if(_0x24bdfd[_0x166b('0x45')][_0x166b('0x4f')]){_0x24a844[_0x166b('0x4d')]=_[_0x166b('0x51')](_0x24a844['where'],{'$or':_['map'](_0x24a844['attributes'],function(_0x2513a0){var _0xac7b68={};_0xac7b68[_0x2513a0]={'$like':'%'+_0x24bdfd[_0x166b('0x45')]['filter']+'%'};return _0xac7b68;})});}_0x24a844=_['merge']({},_0x24a844,_0x24bdfd[_0x166b('0x59')]);return _0x306f3a[_0x166b('0x80')](_0x24a844);}})[_0x166b('0x20')](function(_0x8a7e3b){if(_0x8a7e3b){_0x21c59b=_0x8a7e3b[_0x166b('0x48')];if(!_0x24bdfd['query'][_0x166b('0x49')](_0x166b('0x6b'))){_0x24a844[_0x166b('0x4a')]=qs['limit'](_0x24bdfd['query'][_0x166b('0x4a')]);_0x24a844['offset']=qs[_0x166b('0x2f')](_0x24bdfd['query'][_0x166b('0x2f')]);}return _0x306f3a[_0x166b('0x80')](_0x24a844);}})[_0x166b('0x20')](function(_0x24118d){if(_0x24118d){return _0x24118d?{'count':_0x21c59b,'rows':_0x24118d}:null;}})[_0x166b('0x20')](respondWithResult(_0x590f9d,null))[_0x166b('0x29')](handleError(_0x590f9d,null));};exports['notify']=function(_0x364aec,_0x346bd5,_0x2724d6){var _0x230043={'channel':_0x166b('0x81')};var _0x31af7f=[];var _0x1503ec=[];var _0x18fa3f={};return db[_0x166b('0x3d')][_0x166b('0x5a')]({'where':{'id':_0x364aec['params']['id']},'include':[{'model':db[_0x166b('0x7e')],'as':_0x166b('0x82')}]})[_0x166b('0x20')](handleEntityNotFound(_0x346bd5,null))['then'](function(_0x4517c9){_0x230043['account']=_0x4517c9;_0x230043['applications']=_['orderBy'](_0x4517c9[_0x166b('0x82')],[_0x166b('0x83')],[_0x166b('0x84')]);if(_0x230043[_0x166b('0x85')][_0x166b('0x82')]){delete _0x230043[_0x166b('0x85')]['Applications'];}return db[_0x166b('0x86')]['describe']();})[_0x166b('0x20')](function(_0x5a8744){if(!_0x5a8744){throw new db[(_0x166b('0x87'))]['ValidationError']('no\x20available\x20attributes');}_0x31af7f=_[_0x166b('0x88')](_[_0x166b('0x58')](_0x5a8744),[_0x166b('0x89'),_0x166b('0x8a')]);_0x1503ec=_[_0x166b('0x88')](_[_0x166b('0x58')](_0x5a8744),[_0x166b('0x89'),_0x166b('0x8a'),_0x166b('0x8b'),'ListId']);_0x230043['body']={'mapKey':'mobile'};if(_0x230043[_0x166b('0x85')]['type']&&_0x230043[_0x166b('0x85')][_0x166b('0x40')]===_0x166b('0x8c')){_0x230043[_0x166b('0x5c')][_0x166b('0x8d')]=_0x364aec['body'][_0x166b('0x8e')][_0x166b('0x8f')](_0x166b('0x90'),'');_0x230043['body']['body']=_0x364aec[_0x166b('0x5c')][_0x166b('0x91')];_0x230043['body'][_0x166b('0x92')]=_0x364aec[_0x166b('0x5c')][_0x166b('0x93')];}if(_0x230043[_0x166b('0x5c')]['id']){delete _0x230043[_0x166b('0x5c')]['id'];}if(_[_0x166b('0x94')](_0x230043[_0x166b('0x5c')]['from'])){throw new db[(_0x166b('0x87'))][(_0x166b('0x95'))](_0x166b('0x96'));}if(_[_0x166b('0x94')](_0x230043['body'][_0x166b('0x5c')])||_0x230043[_0x166b('0x5c')][_0x166b('0x5c')]===''){throw new db['Sequelize'][(_0x166b('0x95'))](_0x166b('0x97'));}if(_[_0x166b('0x94')](_0x230043[_0x166b('0x5c')][_0x166b('0x98')])){throw new db[(_0x166b('0x87'))][(_0x166b('0x95'))](_0x166b('0x99')+_0x1503ec);}if(!_[_0x166b('0x9a')](_0x1503ec,_0x230043[_0x166b('0x5c')]['mapKey'])){throw new db[(_0x166b('0x87'))]['ValidationError'](_0x166b('0x9b')+_0x1503ec);}_0x18fa3f[_0x230043[_0x166b('0x5c')][_0x166b('0x98')]]=_0x230043['body'][_0x166b('0x8d')];return db[_0x166b('0x9c')][_0x166b('0x5a')]({'where':{'id':_0x230043[_0x166b('0x85')][_0x166b('0x9d')]},'include':[{'model':db[_0x166b('0x86')],'as':'Contacts','where':_0x18fa3f,'limit':0x1,'order':[[_0x166b('0x8a'),_0x166b('0x9e')]]}]});})['then'](handleEntityNotFound(_0x346bd5,null))['then'](function(_0x17bbcf){if(_0x17bbcf){_0x230043[_0x166b('0x9f')]=_[_0x166b('0x73')](_0x17bbcf,[_0x166b('0xa0')]);if(_0x17bbcf['Contacts'][_0x166b('0x48')]){return _0x17bbcf[_0x166b('0xa0')][0x0];}var _0x84ce6f=_[_0x166b('0x1a')](_0x230043[_0x166b('0x5c')],{'firstName':_0x230043['body'][_0x166b('0x8d')],'ListId':_0x17bbcf['id']});_0x84ce6f[_0x230043['body']['mapKey']]=_0x230043['body'][_0x166b('0x8d')];return db[_0x166b('0x86')][_0x166b('0x5b')](_0x84ce6f,{'fields':_0x31af7f,'raw':!![]});}})[_0x166b('0x20')](handleEntityNotFound(_0x346bd5,null))['then'](function(_0x1d6298){if(_0x1d6298){_0x230043['contact']=_0x1d6298;var _0x17b8fd={'ContactId':_0x1d6298['id'],'phone':_0x230043['body'][_0x166b('0x8d')],'WhatsappAccountId':_0x364aec[_0x166b('0x57')]['id']};var _0x59c84d={'ContactId':_0x1d6298['id'],'WhatsappAccountId':_0x364aec[_0x166b('0x57')]['id'],'closed':![]};return db[_0x166b('0xa1')]['find']({'where':_0x59c84d})[_0x166b('0x20')](function(_0x25d754){if(_0x25d754){return[_0x25d754,![]];}return db['WhatsappInteraction'][_0x166b('0x5b')](_0x17b8fd)[_0x166b('0x20')](function(_0x4c9cfd){return[_0x4c9cfd,!![]];});});}})[_0x166b('0x74')](function(_0x174e1f,_0x50511f){_0x230043[_0x166b('0xa2')]=_0x174e1f[_0x166b('0x5d')]({'plain':!![]});_0x230043['interaction'][_0x166b('0xa3')]=![];if(_0x50511f){if(_0x230043[_0x166b('0x85')][_0x166b('0xa4')]){_0x230043[_0x166b('0xa5')][_0x166b('0xa6')]({'id':0x0,'priority':_0x230043['applications'][_0x166b('0x48')]+0x1,'app':_0x166b('0xa7'),'appdata':'unmanaged','interval':_0x166b('0xa8')});}_0x230043[_0x166b('0xa2')]['created']=!![];}return db[_0x166b('0xa9')][_0x166b('0x5b')]({'phone':_0x230043['body'][_0x166b('0x8d')],'messageId':_0x230043[_0x166b('0x5c')]['messageId'],'body':_0x230043[_0x166b('0x5c')]['body'],'WhatsappAccountId':_0x364aec[_0x166b('0x57')]['id'],'WhatsappInteractionId':_0x174e1f['id'],'direction':'in','ContactId':_0x174e1f[_0x166b('0xaa')],'AttachmentId':_0x230043[_0x166b('0x5c')][_0x166b('0xab')]});})[_0x166b('0x20')](function(_0x3c75b9){_0x230043['message']=_0x3c75b9;if(_0x230043['interaction'][_0x166b('0xac')]){return db[_0x166b('0xad')]['find']({'attributes':['id',_0x166b('0x38')],'where':{'id':_0x230043[_0x166b('0xa2')][_0x166b('0xac')]}})['then'](function(_0xbd577a){if(_0xbd577a){_0x230043[_0x166b('0xa5')][_0x166b('0xae')]({'id':0x0,'priority':0x0,'app':_0x166b('0xaf'),'appdata':_0xbd577a[_0x166b('0x38')]+','+(_0x230043['account']['waitForTheAssignedAgent']||0xa),'interval':_0x166b('0xa8')});}return respondWithRpcPromise('Start','startRouting',_0x230043);});}return respondWithRpcPromise(_0x166b('0xb0'),_0x166b('0xb1'),_0x230043);})[_0x166b('0x20')](function(_0x4a8a63){if(_0x4a8a63){var _0x4d593a=0xc8;var _0x5d1e39=_0x166b('0xb2');logger[_0x166b('0x27')](_0x166b('0x23'),_0x5d1e39,_0x4d593a,_0x166b('0xb3'));logger[_0x166b('0xb4')](_0x166b('0xb5'),_0x5d1e39,_0x4d593a,_0x166b('0xb3'),JSON['stringify'](_0x4a8a63));if(_0x230043['account'][_0x166b('0x40')]===_0x166b('0x8c')){return _0x346bd5[_0x166b('0x2b')](_0x4d593a)[_0x166b('0x30')](_0x166b('0xb6'),'text/xml')[_0x166b('0xb7')]('\x0a');}else{return _0x346bd5[_0x166b('0x2b')](_0x4d593a)[_0x166b('0x2d')](_0x4a8a63);}}})[_0x166b('0x29')](handleError(_0x346bd5,null));};exports[_0x166b('0xb7')]=function(_0x35a399,_0x3edf20,_0x3032a6){var _0xec384d,_0x4471a2,_0x48e704;if(_[_0x166b('0x94')](_0x35a399[_0x166b('0x5c')][_0x166b('0x5c')])||_0x35a399[_0x166b('0x5c')][_0x166b('0x5c')]===''){throw new db[(_0x166b('0x87'))][(_0x166b('0x95'))](_0x166b('0x97'));}if(_[_0x166b('0x94')](_0x35a399[_0x166b('0x5c')]['to'])){throw new db['Sequelize'][(_0x166b('0x95'))](_0x166b('0xb8'));}_0xec384d=_0x35a399[_0x166b('0x5c')]['to'];return db['WhatsappAccount'][_0x166b('0x5a')]({'where':{'id':_0x35a399[_0x166b('0x57')]['id']},'include':[{'model':db[_0x166b('0x9c')],'as':_0x166b('0xb9'),'include':[{'model':db[_0x166b('0x86')],'as':_0x166b('0xa0'),'where':{'mobile':_0xec384d},'limit':0x1,'order':[[_0x166b('0x8a'),_0x166b('0x9e')]]}]}]})['then'](handleEntityNotFound(_0x3edf20,null))[_0x166b('0x20')](function(_0x8f603){if(_0x8f603&&_0x8f603['List']){_0x4471a2=_0x8f603[_0x166b('0x5d')]({'plain':!![]});if(_0x4471a2[_0x166b('0xb9')]&&_0x4471a2[_0x166b('0xb9')][_0x166b('0xa0')][_0x166b('0x48')]){return _0x4471a2[_0x166b('0xb9')]['Contacts'][0x0];}return db['CmContact'][_0x166b('0x5b')](_['defaults'](_0x35a399[_0x166b('0x5c')],{'firstName':_0xec384d,'mobile':_0xec384d,'phone':_0xec384d,'ListId':_0x4471a2[_0x166b('0x9d')]}));}})[_0x166b('0x20')](handleEntityNotFound(_0x3edf20,null))['then'](function(_0x8505c){if(_0x8505c){_0x48e704=_0x8505c;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0x48e704['id'],'closed':![],'WhatsappAccountId':_0x4471a2['id']}})[_0x166b('0x20')](function(_0x280889){if(_0x280889){return[_0x280889,![]];}return db[_0x166b('0xa1')][_0x166b('0x5b')]({'UserId':_0x35a399[_0x166b('0x5f')]['id'],'ContactId':_0x48e704['id'],'WhatsappAccountId':_0x4471a2['id'],'phone':_0xec384d,'firstMsgDirection':_0x166b('0xba'),'Messages':[_[_0x166b('0x51')](_0x35a399['body'],{'read':![],'body':_0x35a399[_0x166b('0x5c')][_0x166b('0x5c')],'phone':_0xec384d,'WhatsappAccountId':_0x4471a2['id'],'UserId':_0x35a399[_0x166b('0x5f')]['id'],'ContactId':_0x48e704['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0x166b('0x20')](function(_0x165fa9){return[_0x165fa9,!![]];});});}})[_0x166b('0x74')](function(_0x354976,_0x4490b5){if(_0x4490b5){return _0x354976;}return db[_0x166b('0xa9')][_0x166b('0x5b')](_['merge'](_0x35a399[_0x166b('0x5c')],{'read':![],'body':_0x35a399[_0x166b('0x5c')][_0x166b('0x5c')],'phone':_0xec384d,'WhatsappAccountId':_0x4471a2['id'],'WhatsappInteractionId':_0x354976['id'],'UserId':_0x35a399[_0x166b('0x5f')]['id'],'ContactId':_0x48e704['id']}))[_0x166b('0x20')](function(_0x1e25c1){_0x354976[_0x166b('0xbb')][_0x166b('0xbc')]=[];_0x354976['dataValues'][_0x166b('0xbc')][_0x166b('0xa6')](_0x1e25c1[_0x166b('0xbb')]);return _0x354976;});})['then'](respondWithResult(_0x3edf20,null))[_0x166b('0x29')](handleError(_0x3edf20,null));}; \ No newline at end of file +var _0x33d4=['offset','limit','Content-Range','reject','save','destroy','get','WhatsappAccounts','UserProfileResource','name','index','Pause','map','fieldName','type','key','keys','query','intersection','model','fields','attributes','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','WhatsappAccount','include','findAll','catch','mandatoryDispositionPause','rawAttributes','length','includeAll','find','create','body','role','user','userProfileId','update','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','hasOwnProperty','rows','removeDispositions','ids','CannedAnswer','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','findOne','User','getAgents','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','whatsapp','Applications','account','applications','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','MessageSid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','contact','WhatsappInteraction','spread','interaction','autoclose','push','close','AttachmentId','UserId','unshift','agent','Start','info','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','send','\x0a','to\x20is\x20mandatory','CmList','List','out','WhatsappMessage','dataValues','Messages','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','count'];(function(_0x48c723,_0x4dbf8e){var _0x1ac11b=function(_0x37c0f1){while(--_0x37c0f1){_0x48c723['push'](_0x48c723['shift']());}};_0x1ac11b(++_0x4dbf8e);}(_0x33d4,0x85));var _0x433d=function(_0xae99c1,_0x474cb9){_0xae99c1=_0xae99c1-0x0;var _0x4df7c6=_0x33d4[_0xae99c1];return _0x4df7c6;};'use strict';var pdf=require(_0x433d('0x0'));var emlformat=require(_0x433d('0x1'));var rimraf=require(_0x433d('0x2'));var zipdir=require(_0x433d('0x3'));var jsonpatch=require(_0x433d('0x4'));var rp=require('request-promise');var moment=require(_0x433d('0x5'));var BPromise=require(_0x433d('0x6'));var Mustache=require('mustache');var util=require(_0x433d('0x7'));var path=require(_0x433d('0x8'));var sox=require('sox');var csv=require(_0x433d('0x9'));var ejs=require(_0x433d('0xa'));var fs=require('fs');var _=require(_0x433d('0xb'));var squel=require('squel');var crypto=require(_0x433d('0xc'));var jsforce=require(_0x433d('0xd'));var deskjs=require(_0x433d('0xe'));var toCsv=require(_0x433d('0x9'));var querystring=require(_0x433d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x433d('0x10'));var qs=require(_0x433d('0x11'));var as=require(_0x433d('0x12'));var hardwareService=require(_0x433d('0x13'));var logger=require(_0x433d('0x14'))('api');var utils=require(_0x433d('0x15'));var config=require(_0x433d('0x16'));var licenseUtil=require(_0x433d('0x17'));var db=require(_0x433d('0x18'))['db'];config[_0x433d('0x19')]=_[_0x433d('0x1a')](config[_0x433d('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x433d('0x1b'))(new Redis(config['redis']));require(_0x433d('0x1c'))[_0x433d('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x433d('0x1e')][_0x433d('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x3824f8,_0xeeb7ce,_0x54b211,_0x158122){return new BPromise(function(_0x445a3d,_0x13c391){var _0x3b6b0c=_0x158122||client;return _0x3b6b0c[_0x433d('0x20')](_0x3824f8,_0x54b211)[_0x433d('0x21')](function(_0x521f0f){logger['info'](_0x433d('0x22'),_0xeeb7ce,'request\x20sent');logger[_0x433d('0x23')](_0x433d('0x24'),_0xeeb7ce,_0x433d('0x25'),JSON[_0x433d('0x26')](_0x521f0f));if(_0x521f0f[_0x433d('0x27')]){if(_0x521f0f[_0x433d('0x27')]['code']===0x1f4){logger[_0x433d('0x27')](_0x433d('0x22'),_0xeeb7ce,_0x521f0f[_0x433d('0x27')]['message']);return _0x13c391(_0x521f0f[_0x433d('0x27')][_0x433d('0x28')]);}logger[_0x433d('0x27')](_0x433d('0x22'),_0xeeb7ce,_0x521f0f['error'][_0x433d('0x28')]);return _0x445a3d(_0x521f0f['error'][_0x433d('0x28')]);}else{logger['info'](_0x433d('0x22'),_0xeeb7ce,_0x433d('0x25'));_0x445a3d(_0x521f0f[_0x433d('0x29')]['message']);}})['catch'](function(_0x5f13cb){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0xeeb7ce,_0x5f13cb);_0x13c391(_0x5f13cb);});});}function respondWithStatusCode(_0x35205b,_0x3bcf37){_0x3bcf37=_0x3bcf37||0xcc;return function(_0x3b58a8){if(_0x3b58a8){return _0x35205b[_0x433d('0x2a')](_0x3bcf37);}return _0x35205b[_0x433d('0x2b')](_0x3bcf37)[_0x433d('0x2c')]();};}function respondWithResult(_0x1dee1d,_0x5280ae){_0x5280ae=_0x5280ae||0xc8;return function(_0x147d03){if(_0x147d03){return _0x1dee1d['status'](_0x5280ae)[_0x433d('0x2d')](_0x147d03);}};}function respondWithFilteredResult(_0x4e4afe,_0x38ec46){return function(_0x1bd961){if(_0x1bd961){var _0x1505b8=_0x1bd961[_0x433d('0x2e')],_0xa60309=_0x38ec46[_0x433d('0x2f')],_0x58c7a5=_0x38ec46[_0x433d('0x2f')]+_0x38ec46[_0x433d('0x30')],_0x20bd98;if(_0x58c7a5>=_0x1505b8){_0x58c7a5=_0x1505b8;_0x20bd98=0xc8;}else{_0x20bd98=0xce;}_0x4e4afe['status'](_0x20bd98);return _0x4e4afe['set'](_0x433d('0x31'),_0xa60309+'-'+_0x58c7a5+'/'+_0x1505b8)['json'](_0x1bd961);}return null;};}function patchUpdates(_0x255e36){return function(_0x527121){try{jsonpatch['apply'](_0x527121,_0x255e36,!![]);}catch(_0x5de39e){return BPromise[_0x433d('0x32')](_0x5de39e);}return _0x527121[_0x433d('0x33')]();};}function saveUpdates(_0x241072,_0x56dc8b){return function(_0x5414b7){if(_0x5414b7){return _0x5414b7['update'](_0x241072)['then'](function(_0x11cacf){return _0x11cacf;});}return null;};}function removeEntity(_0x32f29d,_0x155221){return function(_0x5d06e7){if(_0x5d06e7){return _0x5d06e7[_0x433d('0x34')]()[_0x433d('0x21')](function(){var _0x1f188c=_0x5d06e7[_0x433d('0x35')]({'plain':!![]});var _0x59ada7=_0x433d('0x36');return db[_0x433d('0x37')]['destroy']({'where':{'type':_0x59ada7,'resourceId':_0x1f188c['id']}})[_0x433d('0x21')](function(){return _0x5d06e7;});})[_0x433d('0x21')](function(){_0x32f29d[_0x433d('0x2b')](0xcc)[_0x433d('0x2c')]();});}};}function handleEntityNotFound(_0x4967f2,_0x1a81a0){return function(_0x399d2b){if(!_0x399d2b){_0x4967f2[_0x433d('0x2a')](0x194);}return _0x399d2b;};}function handleError(_0x4b8302,_0x10aa5f){_0x10aa5f=_0x10aa5f||0x1f4;return function(_0xcea0f4){logger[_0x433d('0x27')](_0xcea0f4['stack']);if(_0xcea0f4['name']){delete _0xcea0f4[_0x433d('0x38')];}_0x4b8302['status'](_0x10aa5f)['send'](_0xcea0f4);};}exports[_0x433d('0x39')]=function(_0x37af9e,_0x4ec599){var _0x30b781={'include':[{'model':db[_0x433d('0x3a')],'as':'mandatoryDispositionPause'}]},_0x2fa5c1={},_0x4136e4={'count':0x0,'rows':[]};var _0x424a3d=_[_0x433d('0x3b')](db['WhatsappAccount']['rawAttributes'],function(_0x364e6d){return{'name':_0x364e6d[_0x433d('0x3c')],'type':_0x364e6d[_0x433d('0x3d')][_0x433d('0x3e')]};});_0x2fa5c1['model']=_[_0x433d('0x3b')](_0x424a3d,_0x433d('0x38'));_0x2fa5c1['query']=_[_0x433d('0x3f')](_0x37af9e[_0x433d('0x40')]);_0x2fa5c1['filters']=_[_0x433d('0x41')](_0x2fa5c1[_0x433d('0x42')],_0x2fa5c1[_0x433d('0x40')]);_0x30b781['attributes']=_['intersection'](_0x2fa5c1[_0x433d('0x42')],qs[_0x433d('0x43')](_0x37af9e['query'][_0x433d('0x43')]));_0x30b781[_0x433d('0x44')]=_0x30b781['attributes']['length']?_0x30b781['attributes']:_0x2fa5c1[_0x433d('0x42')];if(!_0x37af9e[_0x433d('0x40')]['hasOwnProperty'](_0x433d('0x45'))){_0x30b781[_0x433d('0x30')]=qs['limit'](_0x37af9e['query'][_0x433d('0x30')]);_0x30b781[_0x433d('0x2f')]=qs[_0x433d('0x2f')](_0x37af9e['query'][_0x433d('0x2f')]);}_0x30b781[_0x433d('0x46')]=qs[_0x433d('0x47')](_0x37af9e['query'][_0x433d('0x47')]);_0x30b781[_0x433d('0x48')]=qs[_0x433d('0x49')](_[_0x433d('0x4a')](_0x37af9e[_0x433d('0x40')],_0x2fa5c1['filters']),_0x424a3d);if(_0x37af9e['query'][_0x433d('0x4b')]){_0x30b781['where']=_[_0x433d('0x4c')](_0x30b781[_0x433d('0x48')],{'$or':_[_0x433d('0x3b')](_0x424a3d,function(_0x4ee8d4){if(_0x4ee8d4[_0x433d('0x3d')]!==_0x433d('0x4d')){var _0x37c9c6={};_0x37c9c6[_0x4ee8d4[_0x433d('0x38')]]={'$like':'%'+_0x37af9e[_0x433d('0x40')][_0x433d('0x4b')]+'%'};return _0x37c9c6;}})});}_0x30b781=_[_0x433d('0x4c')]({},_0x30b781,_0x37af9e[_0x433d('0x4e')]);var _0x4d9213={'where':_0x30b781['where']};return db[_0x433d('0x4f')][_0x433d('0x2e')](_0x4d9213)[_0x433d('0x21')](function(_0x2de23c){_0x4136e4[_0x433d('0x2e')]=_0x2de23c;if(_0x37af9e['query']['includeAll']){_0x30b781[_0x433d('0x50')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x433d('0x51')](_0x30b781);})[_0x433d('0x21')](function(_0x2ab796){_0x4136e4['rows']=_0x2ab796;return _0x4136e4;})[_0x433d('0x21')](respondWithFilteredResult(_0x4ec599,_0x30b781))[_0x433d('0x52')](handleError(_0x4ec599,null));};exports['show']=function(_0x3ec09c,_0x2e62d9){var _0x259d6d={'raw':![],'where':{'id':_0x3ec09c['params']['id']},'include':[{'model':db[_0x433d('0x3a')],'as':_0x433d('0x53')}]},_0x46e3c1={};_0x46e3c1[_0x433d('0x42')]=_['keys'](db[_0x433d('0x4f')][_0x433d('0x54')]);_0x46e3c1['query']=_['keys'](_0x3ec09c[_0x433d('0x40')]);_0x46e3c1[_0x433d('0x49')]=_[_0x433d('0x41')](_0x46e3c1[_0x433d('0x42')],_0x46e3c1[_0x433d('0x40')]);_0x259d6d[_0x433d('0x44')]=_[_0x433d('0x41')](_0x46e3c1[_0x433d('0x42')],qs[_0x433d('0x43')](_0x3ec09c[_0x433d('0x40')][_0x433d('0x43')]));_0x259d6d[_0x433d('0x44')]=_0x259d6d['attributes'][_0x433d('0x55')]?_0x259d6d[_0x433d('0x44')]:_0x46e3c1[_0x433d('0x42')];if(_0x3ec09c[_0x433d('0x40')][_0x433d('0x56')]){_0x259d6d['include']=[{'all':!![]}];}_0x259d6d=_[_0x433d('0x4c')]({},_0x259d6d,_0x3ec09c[_0x433d('0x4e')]);return db[_0x433d('0x4f')][_0x433d('0x57')](_0x259d6d)['then'](handleEntityNotFound(_0x2e62d9,null))[_0x433d('0x21')](respondWithResult(_0x2e62d9,null))[_0x433d('0x52')](handleError(_0x2e62d9,null));};exports['create']=function(_0x575bb3,_0x2e9430){return db[_0x433d('0x4f')][_0x433d('0x58')](_0x575bb3[_0x433d('0x59')],{})[_0x433d('0x21')](function(_0x8b94eb){var _0x170e12=_0x575bb3['user'][_0x433d('0x35')]({'plain':!![]});if(!_0x170e12)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x170e12[_0x433d('0x5a')]===_0x433d('0x5b')){var _0x4b282d=_0x8b94eb[_0x433d('0x35')]({'plain':!![]});var _0x2f250a=_0x433d('0x36');return db['UserProfileSection']['find']({'where':{'name':_0x2f250a,'userProfileId':_0x170e12[_0x433d('0x5c')]},'raw':!![]})[_0x433d('0x21')](function(_0x490d27){if(_0x490d27&&_0x490d27['autoAssociation']===0x0){return db[_0x433d('0x37')]['create']({'name':_0x4b282d[_0x433d('0x38')],'resourceId':_0x4b282d['id'],'type':_0x490d27[_0x433d('0x38')],'sectionId':_0x490d27['id']},{})[_0x433d('0x21')](function(){return _0x8b94eb;});}else{return _0x8b94eb;}})['catch'](function(_0x1bb23c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bb23c);throw _0x1bb23c;});}return _0x8b94eb;})['then'](respondWithResult(_0x2e9430,0xc9))[_0x433d('0x52')](handleError(_0x2e9430,null));};exports[_0x433d('0x5d')]=function(_0x31016d,_0x1354a8){if(_0x31016d['body']['id']){delete _0x31016d[_0x433d('0x59')]['id'];}return db['WhatsappAccount'][_0x433d('0x57')]({'where':{'id':_0x31016d[_0x433d('0x5e')]['id']},'include':[{'model':db[_0x433d('0x3a')],'as':_0x433d('0x53')}]})[_0x433d('0x21')](handleEntityNotFound(_0x1354a8,null))[_0x433d('0x21')](saveUpdates(_0x31016d[_0x433d('0x59')],null))[_0x433d('0x21')](respondWithResult(_0x1354a8,null))[_0x433d('0x52')](handleError(_0x1354a8,null));};exports[_0x433d('0x34')]=function(_0x3a87fa,_0x20640e){return db[_0x433d('0x4f')][_0x433d('0x57')]({'where':{'id':_0x3a87fa[_0x433d('0x5e')]['id']}})['then'](handleEntityNotFound(_0x20640e,null))['then'](removeEntity(_0x20640e,null))[_0x433d('0x52')](handleError(_0x20640e,null));};exports[_0x433d('0x5f')]=function(_0x5c2f56,_0x15fb72){return db['WhatsappAccount'][_0x433d('0x5f')]()[_0x433d('0x21')](respondWithResult(_0x15fb72,null))['catch'](handleError(_0x15fb72,null));};exports[_0x433d('0x60')]=function(_0x388947,_0x1efa07,_0x33009a){if(_0x388947['body']['id']){delete _0x388947['body']['id'];}return db[_0x433d('0x4f')][_0x433d('0x57')]({'where':{'id':_0x388947['params']['id']}})[_0x433d('0x21')](handleEntityNotFound(_0x1efa07,null))[_0x433d('0x21')](function(_0xfa5e5f){if(_0xfa5e5f){_0x388947[_0x433d('0x59')][_0x433d('0x61')]=_0xfa5e5f['id'];return db[_0x433d('0x62')]['create'](_0x388947[_0x433d('0x59')]);}})[_0x433d('0x21')](respondWithResult(_0x1efa07,null))[_0x433d('0x52')](handleError(_0x1efa07,null));};exports[_0x433d('0x63')]=function(_0x35603b,_0x491c79,_0x5c47df){var _0x3c8d2a={'raw':![],'where':{}};var _0x5497cf={};var _0x5a953c={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x35603b['params']['id']}})[_0x433d('0x21')](handleEntityNotFound(_0x491c79,null))['then'](function(_0x4188cd){if(_0x4188cd){_0x5497cf[_0x433d('0x42')]=_[_0x433d('0x3f')](db['Disposition'][_0x433d('0x54')]);_0x5497cf[_0x433d('0x40')]=_[_0x433d('0x3f')](_0x35603b[_0x433d('0x40')]);_0x5497cf['filters']=_[_0x433d('0x41')](_0x5497cf[_0x433d('0x42')],_0x5497cf['query']);_0x3c8d2a[_0x433d('0x44')]=_['intersection'](_0x5497cf[_0x433d('0x42')],qs[_0x433d('0x43')](_0x35603b['query']['fields']));_0x3c8d2a['attributes']=_0x3c8d2a[_0x433d('0x44')][_0x433d('0x55')]?_0x3c8d2a['attributes']:_0x5497cf[_0x433d('0x42')];if(!_0x35603b[_0x433d('0x40')][_0x433d('0x64')](_0x433d('0x45'))){_0x3c8d2a['limit']=qs[_0x433d('0x30')](_0x35603b[_0x433d('0x40')][_0x433d('0x30')]);_0x3c8d2a[_0x433d('0x2f')]=qs[_0x433d('0x2f')](_0x35603b['query'][_0x433d('0x2f')]);}_0x3c8d2a[_0x433d('0x46')]=qs[_0x433d('0x47')](_0x35603b[_0x433d('0x40')][_0x433d('0x47')]);_0x3c8d2a[_0x433d('0x48')]=qs[_0x433d('0x49')](_[_0x433d('0x4a')](_0x35603b[_0x433d('0x40')],_0x5497cf[_0x433d('0x49')]));_0x3c8d2a['where']['WhatsappAccountId']=_0x4188cd['id'];if(_0x35603b[_0x433d('0x40')][_0x433d('0x4b')]){_0x3c8d2a[_0x433d('0x48')]=_[_0x433d('0x4c')](_0x3c8d2a[_0x433d('0x48')],{'$or':_[_0x433d('0x3b')](_0x3c8d2a[_0x433d('0x44')],function(_0x3861a9){var _0x166676={};_0x166676[_0x3861a9]={'$like':'%'+_0x35603b[_0x433d('0x40')][_0x433d('0x4b')]+'%'};return _0x166676;})});}_0x3c8d2a=_[_0x433d('0x4c')]({},_0x3c8d2a,_0x35603b[_0x433d('0x4e')]);return db[_0x433d('0x62')]['count']({'where':_0x3c8d2a[_0x433d('0x48')]})[_0x433d('0x21')](function(_0x514126){_0x5a953c['count']=_0x514126;if(_0x35603b[_0x433d('0x40')][_0x433d('0x56')]){_0x3c8d2a[_0x433d('0x50')]=[{'all':!![]}];}return db[_0x433d('0x62')]['findAll'](_0x3c8d2a);})['then'](function(_0x151c32){_0x5a953c[_0x433d('0x65')]=_0x151c32;return _0x5a953c;});}})['then'](respondWithFilteredResult(_0x491c79,_0x3c8d2a))[_0x433d('0x52')](handleError(_0x491c79,null));};exports[_0x433d('0x66')]=function(_0x358e25,_0x133cf5,_0x10a44e){return db[_0x433d('0x4f')]['find']({'where':{'id':_0x358e25[_0x433d('0x5e')]['id']}})[_0x433d('0x21')](handleEntityNotFound(_0x133cf5,null))[_0x433d('0x21')](function(_0x58a11b){if(_0x58a11b){return _0x58a11b[_0x433d('0x66')](_0x358e25[_0x433d('0x40')][_0x433d('0x67')]);}})[_0x433d('0x21')](respondWithStatusCode(_0x133cf5,null))[_0x433d('0x52')](handleError(_0x133cf5,null));};exports['addAnswer']=function(_0x2a1653,_0x3e95a8,_0x11beff){if(_0x2a1653['body']['id']){delete _0x2a1653['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x2a1653[_0x433d('0x5e')]['id']}})[_0x433d('0x21')](handleEntityNotFound(_0x3e95a8,null))[_0x433d('0x21')](function(_0x543542){if(_0x543542){_0x2a1653[_0x433d('0x59')][_0x433d('0x61')]=_0x543542['id'];return db[_0x433d('0x68')][_0x433d('0x58')](_0x2a1653[_0x433d('0x59')]);}})[_0x433d('0x21')](respondWithResult(_0x3e95a8,null))[_0x433d('0x52')](handleError(_0x3e95a8,null));};exports['getAnswers']=function(_0x3658a0,_0x209bc7,_0x22a647){var _0x30de41={'raw':![],'where':{}};var _0x240a7f={};var _0x2df678={'count':0x0,'rows':[]};return db[_0x433d('0x4f')]['findOne']({'where':{'id':_0x3658a0[_0x433d('0x5e')]['id']}})[_0x433d('0x21')](handleEntityNotFound(_0x209bc7,null))[_0x433d('0x21')](function(_0x47c4b7){if(_0x47c4b7){_0x240a7f[_0x433d('0x42')]=_['keys'](db[_0x433d('0x68')][_0x433d('0x54')]);_0x240a7f[_0x433d('0x40')]=_[_0x433d('0x3f')](_0x3658a0[_0x433d('0x40')]);_0x240a7f['filters']=_[_0x433d('0x41')](_0x240a7f[_0x433d('0x42')],_0x240a7f[_0x433d('0x40')]);_0x30de41[_0x433d('0x44')]=_[_0x433d('0x41')](_0x240a7f['model'],qs['fields'](_0x3658a0[_0x433d('0x40')][_0x433d('0x43')]));_0x30de41['attributes']=_0x30de41[_0x433d('0x44')][_0x433d('0x55')]?_0x30de41[_0x433d('0x44')]:_0x240a7f[_0x433d('0x42')];if(!_0x3658a0[_0x433d('0x40')]['hasOwnProperty']('nolimit')){_0x30de41[_0x433d('0x30')]=qs[_0x433d('0x30')](_0x3658a0['query'][_0x433d('0x30')]);_0x30de41[_0x433d('0x2f')]=qs[_0x433d('0x2f')](_0x3658a0['query']['offset']);}_0x30de41[_0x433d('0x46')]=qs[_0x433d('0x47')](_0x3658a0[_0x433d('0x40')][_0x433d('0x47')]);_0x30de41[_0x433d('0x48')]=qs[_0x433d('0x49')](_[_0x433d('0x4a')](_0x3658a0[_0x433d('0x40')],_0x240a7f[_0x433d('0x49')]));_0x30de41[_0x433d('0x48')][_0x433d('0x61')]=_0x47c4b7['id'];if(_0x3658a0['query'][_0x433d('0x4b')]){_0x30de41[_0x433d('0x48')]=_['merge'](_0x30de41[_0x433d('0x48')],{'$or':_[_0x433d('0x3b')](_0x30de41['attributes'],function(_0x341098){var _0xe2c0b7={};_0xe2c0b7[_0x341098]={'$like':'%'+_0x3658a0[_0x433d('0x40')][_0x433d('0x4b')]+'%'};return _0xe2c0b7;})});}_0x30de41=_[_0x433d('0x4c')]({},_0x30de41,_0x3658a0[_0x433d('0x4e')]);return db[_0x433d('0x68')]['count']({'where':_0x30de41[_0x433d('0x48')]})[_0x433d('0x21')](function(_0x446971){_0x2df678[_0x433d('0x2e')]=_0x446971;if(_0x3658a0[_0x433d('0x40')][_0x433d('0x56')]){_0x30de41[_0x433d('0x50')]=[{'all':!![]}];}return db[_0x433d('0x68')][_0x433d('0x51')](_0x30de41);})[_0x433d('0x21')](function(_0x2fce09){_0x2df678['rows']=_0x2fce09;return _0x2df678;});}})[_0x433d('0x21')](respondWithFilteredResult(_0x209bc7,_0x30de41))[_0x433d('0x52')](handleError(_0x209bc7,null));};exports[_0x433d('0x69')]=function(_0x262a25,_0x449cab,_0x54f5d7){return db[_0x433d('0x4f')][_0x433d('0x57')]({'where':{'id':_0x262a25['params']['id']}})['then'](handleEntityNotFound(_0x449cab,null))[_0x433d('0x21')](function(_0xc7856f){if(_0xc7856f){return _0xc7856f['removeAnswers'](_0x262a25[_0x433d('0x40')][_0x433d('0x67')]);}})[_0x433d('0x21')](respondWithStatusCode(_0x449cab,null))[_0x433d('0x52')](handleError(_0x449cab,null));};exports[_0x433d('0x6a')]=function(_0x55fc0a,_0x2c23d3,_0x37a1fa){return db[_0x433d('0x4f')][_0x433d('0x57')]({'where':{'id':_0x55fc0a[_0x433d('0x5e')]['id']}})[_0x433d('0x21')](handleEntityNotFound(_0x2c23d3,null))[_0x433d('0x21')](function(_0x5c4e4a){if(_0x5c4e4a){return _0x5c4e4a[_0x433d('0x6a')](_0x55fc0a['body'][_0x433d('0x67')],_[_0x433d('0x6b')](_0x55fc0a[_0x433d('0x59')],[_0x433d('0x67'),'id'])||{})['spread'](function(_0x29ae12){for(var _0x31a18c=0x0;_0x31a18c<_0x55fc0a[_0x433d('0x59')][_0x433d('0x67')][_0x433d('0x55')];_0x31a18c+=0x1){socket[_0x433d('0x6c')](_0x433d('0x6d'),{'UserId':_0x55fc0a['body']['ids'][_0x31a18c],'WhatsappAccountId':_0x55fc0a[_0x433d('0x5e')]['id']});}return _0x29ae12;});}})[_0x433d('0x21')](respondWithResult(_0x2c23d3,null))[_0x433d('0x52')](handleError(_0x2c23d3,null));};exports['removeAgents']=function(_0x2017d1,_0x421bb2,_0xc1fe86){return db[_0x433d('0x4f')]['find']({'where':{'id':_0x2017d1['params']['id']}})[_0x433d('0x21')](handleEntityNotFound(_0x421bb2,null))['then'](function(_0x4e2870){if(_0x4e2870){return _0x4e2870[_0x433d('0x6e')](_0x2017d1[_0x433d('0x40')]['ids'])[_0x433d('0x21')](function(){if(_[_0x433d('0x6f')](_0x2017d1[_0x433d('0x40')][_0x433d('0x67')])){for(var _0x2730bb=0x0;_0x2730bb<_0x2017d1[_0x433d('0x40')][_0x433d('0x67')][_0x433d('0x55')];_0x2730bb+=0x1){socket[_0x433d('0x6c')](_0x433d('0x70'),{'UserId':Number(_0x2017d1['query']['ids'][_0x2730bb]),'WhatsappAccountId':Number(_0x2017d1[_0x433d('0x5e')]['id'])});}}else{socket['emit'](_0x433d('0x70'),{'UserId':Number(_0x2017d1[_0x433d('0x40')]['ids']),'WhatsappAccountId':Number(_0x2017d1[_0x433d('0x5e')]['id'])});}});}})['then'](respondWithStatusCode(_0x421bb2,null))['catch'](handleError(_0x421bb2,null));};exports['getAgents']=function(_0x2487df,_0x5293a6,_0x4b867d){var _0xe6fca={};var _0x1dfd75={};var _0x149dec;var _0x3a62d2;return db[_0x433d('0x4f')][_0x433d('0x71')]({'where':{'id':_0x2487df[_0x433d('0x5e')]['id']}})[_0x433d('0x21')](handleEntityNotFound(_0x5293a6,null))[_0x433d('0x21')](function(_0x5a3bdf){if(_0x5a3bdf){_0x149dec=_0x5a3bdf;_0x1dfd75[_0x433d('0x42')]=_[_0x433d('0x3f')](db[_0x433d('0x72')][_0x433d('0x54')]);_0x1dfd75[_0x433d('0x40')]=_[_0x433d('0x3f')](_0x2487df[_0x433d('0x40')]);_0x1dfd75[_0x433d('0x49')]=_[_0x433d('0x41')](_0x1dfd75[_0x433d('0x42')],_0x1dfd75[_0x433d('0x40')]);_0xe6fca[_0x433d('0x44')]=_[_0x433d('0x41')](_0x1dfd75['model'],qs[_0x433d('0x43')](_0x2487df['query'][_0x433d('0x43')]));_0xe6fca[_0x433d('0x44')]=_0xe6fca[_0x433d('0x44')][_0x433d('0x55')]?_0xe6fca[_0x433d('0x44')]:_0x1dfd75['model'];_0xe6fca['order']=qs[_0x433d('0x47')](_0x2487df[_0x433d('0x40')][_0x433d('0x47')]);_0xe6fca[_0x433d('0x48')]=qs['filters'](_[_0x433d('0x4a')](_0x2487df['query'],_0x1dfd75['filters']));if(_0x2487df[_0x433d('0x40')][_0x433d('0x4b')]){_0xe6fca['where']=_['merge'](_0xe6fca['where'],{'$or':_['map'](_0xe6fca[_0x433d('0x44')],function(_0x238ea7){var _0x2405cd={};_0x2405cd[_0x238ea7]={'$like':'%'+_0x2487df[_0x433d('0x40')][_0x433d('0x4b')]+'%'};return _0x2405cd;})});}_0xe6fca=_['merge']({},_0xe6fca,_0x2487df['options']);return _0x149dec[_0x433d('0x73')](_0xe6fca);}})[_0x433d('0x21')](function(_0x558d94){if(_0x558d94){_0x3a62d2=_0x558d94[_0x433d('0x55')];if(!_0x2487df[_0x433d('0x40')][_0x433d('0x64')](_0x433d('0x45'))){_0xe6fca['limit']=qs[_0x433d('0x30')](_0x2487df['query']['limit']);_0xe6fca['offset']=qs[_0x433d('0x2f')](_0x2487df['query']['offset']);}return _0x149dec[_0x433d('0x73')](_0xe6fca);}})[_0x433d('0x21')](function(_0x43f8b5){if(_0x43f8b5){return _0x43f8b5?{'count':_0x3a62d2,'rows':_0x43f8b5}:null;}})[_0x433d('0x21')](respondWithResult(_0x5293a6,null))[_0x433d('0x52')](handleError(_0x5293a6,null));};exports['addApplications']=function(_0x13d3c3,_0x72d442,_0x460fb4){return db['WhatsappAccount'][_0x433d('0x71')]({'where':{'id':_0x13d3c3[_0x433d('0x5e')]['id']}})[_0x433d('0x21')](handleEntityNotFound(_0x72d442,null))[_0x433d('0x21')](function(_0x4043e7){if(_0x4043e7){return db[_0x433d('0x74')][_0x433d('0x75')](function(_0xfe19b6){return db[_0x433d('0x76')][_0x433d('0x34')]({'where':{'WhatsappAccountId':_0x13d3c3[_0x433d('0x5e')]['id']},'transaction':_0xfe19b6})[_0x433d('0x21')](function(_0x515be9){var _0x50d19a=_['map'](_0x13d3c3[_0x433d('0x59')],function(_0x3906b6){_0x3906b6[_0x433d('0x61')]=_0x13d3c3[_0x433d('0x5e')]['id'];return _0x3906b6;});return db[_0x433d('0x76')][_0x433d('0x77')](_0x50d19a,{'transaction':_0xfe19b6});});})[_0x433d('0x21')](function(){return db[_0x433d('0x76')][_0x433d('0x78')]({'where':{'WhatsappAccountId':_0x13d3c3[_0x433d('0x5e')]['id']},'order':'priority'});});}})[_0x433d('0x21')](respondWithResult(_0x72d442,null))[_0x433d('0x52')](handleError(_0x72d442,null));};exports[_0x433d('0x79')]=function(_0x1b7dfc,_0x1b863,_0x17cd63){var _0x9dfd5={};var _0x467a70={};var _0xaa51f8;var _0x1aa53d;return db[_0x433d('0x4f')][_0x433d('0x71')]({'where':{'id':_0x1b7dfc['params']['id']}})['then'](handleEntityNotFound(_0x1b863,null))[_0x433d('0x21')](function(_0x3e8045){if(_0x3e8045){_0xaa51f8=_0x3e8045;_0x467a70['model']=_[_0x433d('0x3f')](db[_0x433d('0x76')][_0x433d('0x54')]);_0x467a70[_0x433d('0x40')]=_['keys'](_0x1b7dfc['query']);_0x467a70['filters']=_['intersection'](_0x467a70[_0x433d('0x42')],_0x467a70[_0x433d('0x40')]);_0x9dfd5[_0x433d('0x44')]=_['intersection'](_0x467a70[_0x433d('0x42')],qs[_0x433d('0x43')](_0x1b7dfc[_0x433d('0x40')][_0x433d('0x43')]));_0x9dfd5[_0x433d('0x44')]=_0x9dfd5[_0x433d('0x44')][_0x433d('0x55')]?_0x9dfd5[_0x433d('0x44')]:_0x467a70[_0x433d('0x42')];_0x9dfd5['order']=qs[_0x433d('0x47')](_0x1b7dfc['query']['sort']);_0x9dfd5[_0x433d('0x48')]=qs[_0x433d('0x49')](_[_0x433d('0x4a')](_0x1b7dfc[_0x433d('0x40')],_0x467a70['filters']));if(_0x1b7dfc[_0x433d('0x40')][_0x433d('0x4b')]){_0x9dfd5['where']=_[_0x433d('0x4c')](_0x9dfd5[_0x433d('0x48')],{'$or':_['map'](_0x9dfd5['attributes'],function(_0x2609ae){var _0x5165fe={};_0x5165fe[_0x2609ae]={'$like':'%'+_0x1b7dfc[_0x433d('0x40')]['filter']+'%'};return _0x5165fe;})});}_0x9dfd5=_[_0x433d('0x4c')]({},_0x9dfd5,_0x1b7dfc['options']);return _0xaa51f8[_0x433d('0x79')](_0x9dfd5);}})[_0x433d('0x21')](function(_0x147bb1){if(_0x147bb1){_0x1aa53d=_0x147bb1[_0x433d('0x55')];if(!_0x1b7dfc['query'][_0x433d('0x64')](_0x433d('0x45'))){_0x9dfd5[_0x433d('0x30')]=qs['limit'](_0x1b7dfc[_0x433d('0x40')][_0x433d('0x30')]);_0x9dfd5[_0x433d('0x2f')]=qs[_0x433d('0x2f')](_0x1b7dfc[_0x433d('0x40')][_0x433d('0x2f')]);}return _0xaa51f8['getApplications'](_0x9dfd5);}})['then'](function(_0x487c9e){if(_0x487c9e){return _0x487c9e?{'count':_0x1aa53d,'rows':_0x487c9e}:null;}})[_0x433d('0x21')](respondWithResult(_0x1b863,null))[_0x433d('0x52')](handleError(_0x1b863,null));};exports[_0x433d('0x7a')]=function(_0x37f5a1,_0x2d6d90,_0x58c71c){var _0x51149f={'channel':_0x433d('0x7b')};var _0x12153f=[];var _0x455060=[];var _0x5ea915={};return db[_0x433d('0x4f')][_0x433d('0x57')]({'where':{'id':_0x37f5a1[_0x433d('0x5e')]['id']},'include':[{'model':db[_0x433d('0x76')],'as':_0x433d('0x7c')}]})['then'](handleEntityNotFound(_0x2d6d90,null))['then'](function(_0x1b2d8b){_0x51149f[_0x433d('0x7d')]=_0x1b2d8b;_0x51149f[_0x433d('0x7e')]=_['orderBy'](_0x1b2d8b[_0x433d('0x7c')],['priority'],['asc']);if(_0x51149f[_0x433d('0x7d')][_0x433d('0x7c')]){delete _0x51149f[_0x433d('0x7d')][_0x433d('0x7c')];}return db[_0x433d('0x7f')][_0x433d('0x5f')]();})['then'](function(_0x2930cc){if(!_0x2930cc){throw new db[(_0x433d('0x80'))]['ValidationError'](_0x433d('0x81'));}_0x12153f=_[_0x433d('0x82')](_[_0x433d('0x3f')](_0x2930cc),[_0x433d('0x83'),'updatedAt']);_0x455060=_[_0x433d('0x82')](_[_0x433d('0x3f')](_0x2930cc),[_0x433d('0x83'),_0x433d('0x84'),_0x433d('0x85'),_0x433d('0x86')]);_0x51149f[_0x433d('0x59')]={'mapKey':_0x433d('0x87')};if(_0x51149f[_0x433d('0x7d')][_0x433d('0x3d')]&&_0x51149f['account'][_0x433d('0x3d')]===_0x433d('0x88')){_0x51149f[_0x433d('0x59')][_0x433d('0x89')]=_0x37f5a1[_0x433d('0x59')]['From'][_0x433d('0x8a')](_0x433d('0x8b'),'');_0x51149f[_0x433d('0x59')][_0x433d('0x59')]=_0x37f5a1[_0x433d('0x59')][_0x433d('0x8c')];_0x51149f[_0x433d('0x59')][_0x433d('0x8d')]=_0x37f5a1['body'][_0x433d('0x8e')];}if(_0x51149f['body']['id']){delete _0x51149f[_0x433d('0x59')]['id'];}if(_[_0x433d('0x8f')](_0x51149f[_0x433d('0x59')][_0x433d('0x89')])){throw new db[(_0x433d('0x80'))][(_0x433d('0x90'))](_0x433d('0x91'));}if(_[_0x433d('0x8f')](_0x51149f[_0x433d('0x59')][_0x433d('0x59')])||_0x51149f['body'][_0x433d('0x59')]===''){throw new db[(_0x433d('0x80'))][(_0x433d('0x90'))](_0x433d('0x92'));}if(_['isNil'](_0x51149f['body'][_0x433d('0x93')])){throw new db['Sequelize'][(_0x433d('0x90'))](_0x433d('0x94')+_0x455060);}if(!_[_0x433d('0x95')](_0x455060,_0x51149f[_0x433d('0x59')][_0x433d('0x93')])){throw new db[(_0x433d('0x80'))][(_0x433d('0x90'))](_0x433d('0x96')+_0x455060);}_0x5ea915[_0x51149f[_0x433d('0x59')]['mapKey']]=_0x51149f[_0x433d('0x59')][_0x433d('0x89')];return db['CmList'][_0x433d('0x57')]({'where':{'id':_0x51149f[_0x433d('0x7d')][_0x433d('0x86')]},'include':[{'model':db[_0x433d('0x7f')],'as':_0x433d('0x97'),'where':_0x5ea915,'limit':0x1,'order':[[_0x433d('0x84'),_0x433d('0x98')]]}]});})[_0x433d('0x21')](handleEntityNotFound(_0x2d6d90,null))['then'](function(_0x4dc257){if(_0x4dc257){_0x51149f[_0x433d('0x99')]=_[_0x433d('0x6b')](_0x4dc257,[_0x433d('0x97')]);if(_0x4dc257['Contacts'][_0x433d('0x55')]){return _0x4dc257['Contacts'][0x0];}var _0x18172e=_[_0x433d('0x1a')](_0x51149f['body'],{'firstName':_0x51149f[_0x433d('0x59')][_0x433d('0x89')],'ListId':_0x4dc257['id']});_0x18172e[_0x51149f['body'][_0x433d('0x93')]]=_0x51149f[_0x433d('0x59')]['from'];return db[_0x433d('0x7f')]['create'](_0x18172e,{'fields':_0x12153f,'raw':!![]});}})[_0x433d('0x21')](handleEntityNotFound(_0x2d6d90,null))[_0x433d('0x21')](function(_0x145de5){if(_0x145de5){_0x51149f[_0x433d('0x9a')]=_0x145de5;var _0x446854={'ContactId':_0x145de5['id'],'phone':_0x51149f[_0x433d('0x59')]['from'],'WhatsappAccountId':_0x37f5a1[_0x433d('0x5e')]['id']};var _0x1044e8={'ContactId':_0x145de5['id'],'WhatsappAccountId':_0x37f5a1[_0x433d('0x5e')]['id'],'closed':![]};return db[_0x433d('0x9b')]['find']({'where':_0x1044e8})['then'](function(_0x183d4f){if(_0x183d4f){return[_0x183d4f,![]];}return db[_0x433d('0x9b')][_0x433d('0x58')](_0x446854)[_0x433d('0x21')](function(_0x9db685){return[_0x9db685,!![]];});});}})[_0x433d('0x9c')](function(_0x2a1075,_0x1d8b8e){_0x51149f[_0x433d('0x9d')]=_0x2a1075['get']({'plain':!![]});_0x51149f[_0x433d('0x9d')]['created']=![];if(_0x1d8b8e){if(_0x51149f[_0x433d('0x7d')][_0x433d('0x9e')]){_0x51149f['applications'][_0x433d('0x9f')]({'id':0x0,'priority':_0x51149f[_0x433d('0x7e')][_0x433d('0x55')]+0x1,'app':_0x433d('0xa0'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x51149f[_0x433d('0x9d')]['created']=!![];}return db['WhatsappMessage'][_0x433d('0x58')]({'phone':_0x51149f[_0x433d('0x59')][_0x433d('0x89')],'messageId':_0x51149f[_0x433d('0x59')][_0x433d('0x8d')],'body':_0x51149f['body'][_0x433d('0x59')],'WhatsappAccountId':_0x37f5a1[_0x433d('0x5e')]['id'],'WhatsappInteractionId':_0x2a1075['id'],'direction':'in','ContactId':_0x2a1075['ContactId'],'AttachmentId':_0x51149f[_0x433d('0x59')][_0x433d('0xa1')]});})[_0x433d('0x21')](function(_0x348ec3){_0x51149f[_0x433d('0x28')]=_0x348ec3;if(_0x51149f['interaction']['UserId']){return db[_0x433d('0x72')][_0x433d('0x57')]({'attributes':['id',_0x433d('0x38')],'where':{'id':_0x51149f[_0x433d('0x9d')][_0x433d('0xa2')]}})[_0x433d('0x21')](function(_0x52c4be){if(_0x52c4be){_0x51149f[_0x433d('0x7e')][_0x433d('0xa3')]({'id':0x0,'priority':0x0,'app':_0x433d('0xa4'),'appdata':_0x52c4be['name']+','+(_0x51149f[_0x433d('0x7d')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x51149f);});}return respondWithRpcPromise(_0x433d('0xa5'),'startRouting',_0x51149f);})[_0x433d('0x21')](function(_0x158e8b){if(_0x158e8b){var _0x5cab1e=0xc8;var _0x29744b='receiveMessage';logger[_0x433d('0xa6')](_0x433d('0x24'),_0x29744b,_0x5cab1e,_0x433d('0xa7'));logger[_0x433d('0x23')](_0x433d('0xa8'),_0x29744b,_0x5cab1e,_0x433d('0xa7'),JSON[_0x433d('0x26')](_0x158e8b));if(_0x51149f['account'][_0x433d('0x3d')]===_0x433d('0x88')){return _0x2d6d90[_0x433d('0x2b')](_0x5cab1e)[_0x433d('0xa9')](_0x433d('0xaa'),'text/xml')[_0x433d('0xab')](_0x433d('0xac'));}else{return _0x2d6d90[_0x433d('0x2b')](_0x5cab1e)[_0x433d('0x2d')](_0x158e8b);}}})[_0x433d('0x52')](handleError(_0x2d6d90,null));};exports[_0x433d('0xab')]=function(_0x29a4f1,_0x37cdef,_0x1f75b2){var _0x10ddf1,_0x413c2f,_0x4992b7;if(_[_0x433d('0x8f')](_0x29a4f1[_0x433d('0x59')][_0x433d('0x59')])||_0x29a4f1[_0x433d('0x59')][_0x433d('0x59')]===''){throw new db[(_0x433d('0x80'))][(_0x433d('0x90'))](_0x433d('0x92'));}if(_[_0x433d('0x8f')](_0x29a4f1['body']['to'])){throw new db[(_0x433d('0x80'))]['ValidationError'](_0x433d('0xad'));}_0x10ddf1=_0x29a4f1[_0x433d('0x59')]['to'];return db['WhatsappAccount'][_0x433d('0x57')]({'where':{'id':_0x29a4f1['params']['id']},'include':[{'model':db[_0x433d('0xae')],'as':'List','include':[{'model':db[_0x433d('0x7f')],'as':_0x433d('0x97'),'where':{'mobile':_0x10ddf1},'limit':0x1,'order':[[_0x433d('0x84'),'DESC']]}]}]})[_0x433d('0x21')](handleEntityNotFound(_0x37cdef,null))[_0x433d('0x21')](function(_0x6c39c){if(_0x6c39c&&_0x6c39c[_0x433d('0xaf')]){_0x413c2f=_0x6c39c[_0x433d('0x35')]({'plain':!![]});if(_0x413c2f['List']&&_0x413c2f[_0x433d('0xaf')][_0x433d('0x97')][_0x433d('0x55')]){return _0x413c2f['List'][_0x433d('0x97')][0x0];}return db[_0x433d('0x7f')]['create'](_['defaults'](_0x29a4f1['body'],{'firstName':_0x10ddf1,'mobile':_0x10ddf1,'phone':_0x10ddf1,'ListId':_0x413c2f['ListId']}));}})[_0x433d('0x21')](handleEntityNotFound(_0x37cdef,null))[_0x433d('0x21')](function(_0x5b6611){if(_0x5b6611){_0x4992b7=_0x5b6611;return db[_0x433d('0x9b')]['find']({'where':{'ContactId':_0x4992b7['id'],'closed':![],'WhatsappAccountId':_0x413c2f['id']}})[_0x433d('0x21')](function(_0x502c23){if(_0x502c23){return[_0x502c23,![]];}return db['WhatsappInteraction'][_0x433d('0x58')]({'UserId':_0x29a4f1[_0x433d('0x5b')]['id'],'ContactId':_0x4992b7['id'],'WhatsappAccountId':_0x413c2f['id'],'phone':_0x10ddf1,'firstMsgDirection':_0x433d('0xb0'),'Messages':[_[_0x433d('0x4c')](_0x29a4f1['body'],{'read':![],'body':_0x29a4f1['body']['body'],'phone':_0x10ddf1,'WhatsappAccountId':_0x413c2f['id'],'UserId':_0x29a4f1[_0x433d('0x5b')]['id'],'ContactId':_0x4992b7['id']})]},{'include':[{'model':db[_0x433d('0xb1')],'as':'Messages'}]})['then'](function(_0x3ea7e0){return[_0x3ea7e0,!![]];});});}})['spread'](function(_0x1fe0cb,_0x1c4b69){if(_0x1c4b69){return _0x1fe0cb;}return db['WhatsappMessage'][_0x433d('0x58')](_['merge'](_0x29a4f1['body'],{'read':![],'body':_0x29a4f1[_0x433d('0x59')][_0x433d('0x59')],'phone':_0x10ddf1,'WhatsappAccountId':_0x413c2f['id'],'WhatsappInteractionId':_0x1fe0cb['id'],'UserId':_0x29a4f1['user']['id'],'ContactId':_0x4992b7['id']}))['then'](function(_0x206b42){_0x1fe0cb[_0x433d('0xb2')][_0x433d('0xb3')]=[];_0x1fe0cb[_0x433d('0xb2')][_0x433d('0xb3')][_0x433d('0x9f')](_0x206b42[_0x433d('0xb2')]);return _0x1fe0cb;});})[_0x433d('0x21')](respondWithResult(_0x37cdef,null))[_0x433d('0x52')](handleError(_0x37cdef,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index b25c17c..85227d3 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 _0xd481=['remove','emit','hook','exports','events','WhatsappAccount','setMaxListeners','update'];(function(_0x2ffc46,_0x35ce3c){var _0x1eda8f=function(_0x285344){while(--_0x285344){_0x2ffc46['push'](_0x2ffc46['shift']());}};_0x1eda8f(++_0x35ce3c);}(_0xd481,0x1e4));var _0x1d48=function(_0x51c2d8,_0x782543){_0x51c2d8=_0x51c2d8-0x0;var _0xca448a=_0xd481[_0x51c2d8];return _0xca448a;};'use strict';var EventEmitter=require(_0x1d48('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x1d48('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x1d48('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1d48('0x3'),'afterDestroy':_0x1d48('0x4')};function emitEvent(_0x1bce72){return function(_0x59c90f,_0x35864e,_0x5aa42e){WhatsappAccountEvents[_0x1d48('0x5')](_0x1bce72+':'+_0x59c90f['id'],_0x59c90f);WhatsappAccountEvents[_0x1d48('0x5')](_0x1bce72,_0x59c90f);_0x5aa42e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x1d48('0x6')](e,emitEvent(event));}}module[_0x1d48('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x8af6=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8af6,0x76));var _0x68af=function(_0x32aeda,_0x2c2a0d){_0x32aeda=_0x32aeda-0x0;var _0x5a66de=_0x8af6[_0x32aeda];return _0x5a66de;};'use strict';var EventEmitter=require(_0x68af('0x0'));var WhatsappAccount=require(_0x68af('0x1'))['db'][_0x68af('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x68af('0x3')](0x0);var events={'afterCreate':_0x68af('0x4'),'afterUpdate':_0x68af('0x5'),'afterDestroy':_0x68af('0x6')};function emitEvent(_0xe2ba54){return function(_0x1f8b3a,_0x3d1c16,_0x52bd87){WhatsappAccountEvents[_0x68af('0x7')](_0xe2ba54+':'+_0x1f8b3a['id'],_0x1f8b3a);WhatsappAccountEvents['emit'](_0xe2ba54,_0x1f8b3a);_0x52bd87(null);};}for(var e in events){if(events[_0x68af('0x8')](e)){var event=events[e];WhatsappAccount[_0x68af('0x9')](e,emitEvent(event));}}module[_0x68af('0xa')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 463c76b..551571e 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 _0x197c=['rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x37e4ec,_0x45901b){var _0x5f2f6a=function(_0x3adf24){while(--_0x3adf24){_0x37e4ec['push'](_0x37e4ec['shift']());}};_0x5f2f6a(++_0x45901b);}(_0x197c,0x180));var _0xc197=function(_0x34c26b,_0x5e279b){_0x34c26b=_0x34c26b-0x0;var _0x2f9f58=_0x197c[_0x34c26b];return _0x2f9f58;};'use strict';var _=require('lodash');var util=require(_0xc197('0x0'));var logger=require(_0xc197('0x1'))('api');var moment=require(_0xc197('0x2'));var BPromise=require(_0xc197('0x3'));var rp=require(_0xc197('0x4'));var fs=require('fs');var path=require(_0xc197('0x5'));var rimraf=require(_0xc197('0x6'));var config=require(_0xc197('0x7'));var attributes=require(_0xc197('0x8'));module[_0xc197('0x9')]=function(_0x48b4d8,_0x53fb7c){return _0x48b4d8[_0xc197('0xa')](_0xc197('0xb'),attributes,{'tableName':_0xc197('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9980=['bluebird','request-promise','path','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','api','moment'];(function(_0x57f91f,_0x21cf17){var _0x4deca6=function(_0x5c97bb){while(--_0x5c97bb){_0x57f91f['push'](_0x57f91f['shift']());}};_0x4deca6(++_0x21cf17);}(_0x9980,0x8c));var _0x0998=function(_0x333160,_0x4c1df7){_0x333160=_0x333160-0x0;var _0x256d5a=_0x9980[_0x333160];return _0x256d5a;};'use strict';var _=require(_0x0998('0x0'));var util=require(_0x0998('0x1'));var logger=require('../../config/logger')(_0x0998('0x2'));var moment=require(_0x0998('0x3'));var BPromise=require(_0x0998('0x4'));var rp=require(_0x0998('0x5'));var fs=require('fs');var path=require(_0x0998('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0998('0x7'));module[_0x0998('0x8')]=function(_0x17db8e,_0x54cbb4){return _0x17db8e[_0x0998('0x9')](_0x0998('0xa'),attributes,{'tableName':_0x0998('0xb'),'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 4e33193..e3ed5d0 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 _0xd892=['./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','model','map','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x101a0e,_0xcb18fd){var _0x53d102=function(_0x29d7b7){while(--_0x29d7b7){_0x101a0e['push'](_0x101a0e['shift']());}};_0x53d102(++_0xcb18fd);}(_0xd892,0x193));var _0x2d89=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xd892[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require(_0x2d89('0x0'));var moment=require(_0x2d89('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d89('0x2'));var db=require(_0x2d89('0x3'))['db'];var utils=require(_0x2d89('0x4'));var logger=require(_0x2d89('0x5'))(_0x2d89('0x6'));var config=require(_0x2d89('0x7'));var jayson=require(_0x2d89('0x8'));var client=jayson[_0x2d89('0x9')][_0x2d89('0xa')]({'port':0x232a});config['redis']=_[_0x2d89('0xb')](config[_0x2d89('0xc')],{'host':_0x2d89('0xd'),'port':0x18eb});var socket=require(_0x2d89('0xe'))(new Redis(config[_0x2d89('0xc')]));require(_0x2d89('0xf'))[_0x2d89('0x10')](socket);function respondWithRpcPromise(_0x307257,_0x542fff,_0x31ae33){return new BPromise(function(_0x447a03,_0x4f7838){return client[_0x2d89('0x11')](_0x307257,_0x31ae33)[_0x2d89('0x12')](function(_0x240d7b){logger[_0x2d89('0x13')](_0x2d89('0x14'),_0x542fff,'request\x20sent');logger[_0x2d89('0x15')](_0x2d89('0x16'),_0x542fff,_0x2d89('0x17'),JSON[_0x2d89('0x18')](_0x240d7b));if(_0x240d7b['error']){if(_0x240d7b['error']['code']===0x1f4){logger['error'](_0x2d89('0x14'),_0x542fff,_0x240d7b[_0x2d89('0x19')][_0x2d89('0x1a')]);return _0x4f7838(_0x240d7b['error'][_0x2d89('0x1a')]);}logger[_0x2d89('0x19')](_0x2d89('0x14'),_0x542fff,_0x240d7b[_0x2d89('0x19')][_0x2d89('0x1a')]);return _0x447a03(_0x240d7b[_0x2d89('0x19')][_0x2d89('0x1a')]);}else{logger[_0x2d89('0x13')](_0x2d89('0x14'),_0x542fff,'request\x20sent');_0x447a03(_0x240d7b['result'][_0x2d89('0x1a')]);}})['catch'](function(_0xb45156){logger[_0x2d89('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x542fff,_0xb45156);_0x4f7838(_0xb45156);});});}exports[_0x2d89('0x1b')]=function(_0x2ee50c){var _0x1b776c=this;return new Promise(function(_0x266eda,_0x5d1dbc){return db[_0x2d89('0x1c')][_0x2d89('0x1d')]({'raw':_0x2ee50c[_0x2d89('0x1e')]?_0x2ee50c[_0x2d89('0x1e')][_0x2d89('0x1f')]===undefined?!![]:![]:!![],'where':_0x2ee50c['options']?_0x2ee50c['options'][_0x2d89('0x20')]||null:null,'attributes':_0x2ee50c[_0x2d89('0x1e')]?_0x2ee50c[_0x2d89('0x1e')][_0x2d89('0x21')]||null:null,'include':_0x2ee50c[_0x2d89('0x1e')]?_0x2ee50c[_0x2d89('0x1e')][_0x2d89('0x22')]?_['map'](_0x2ee50c['options']['include'],function(_0x3bc333){return{'model':db[_0x3bc333[_0x2d89('0x23')]],'as':_0x3bc333['as'],'attributes':_0x3bc333[_0x2d89('0x21')],'include':_0x3bc333[_0x2d89('0x22')]?_['map'](_0x3bc333[_0x2d89('0x22')],function(_0x515cf7){return{'model':db[_0x515cf7['model']],'as':_0x515cf7['as'],'attributes':_0x515cf7['attributes'],'include':_0x515cf7['include']?_[_0x2d89('0x24')](_0x515cf7[_0x2d89('0x22')],function(_0x40e369){return{'model':db[_0x40e369[_0x2d89('0x23')]],'as':_0x40e369['as'],'attributes':_0x40e369[_0x2d89('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2d89('0x12')](function(_0x4df6fa){logger['info']('ShowWhatsappAccount',_0x2ee50c);logger['debug'](_0x2d89('0x1b'),_0x2ee50c,JSON[_0x2d89('0x18')](_0x4df6fa));_0x266eda(_0x4df6fa);})[_0x2d89('0x25')](function(_0x195265){logger[_0x2d89('0x19')]('ShowWhatsappAccount',_0x195265[_0x2d89('0x1a')],_0x2ee50c);_0x5d1dbc(_0x1b776c[_0x2d89('0x19')](0x1f4,_0x195265[_0x2d89('0x1a')]));});});}; \ No newline at end of file +var _0xce5b=['WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','WhatsappAccount','find','options','where','attributes','include','map','model','ShowWhatsappAccount','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xb1e286,_0x3fe794){var _0x3ffac3=function(_0x1f2490){while(--_0x1f2490){_0xb1e286['push'](_0xb1e286['shift']());}};_0x3ffac3(++_0x3fe794);}(_0xce5b,0x76));var _0xbce5=function(_0x2532e2,_0x555fb3){_0x2532e2=_0x2532e2-0x0;var _0x76b71a=_0xce5b[_0x2532e2];return _0x76b71a;};'use strict';var _=require(_0xbce5('0x0'));var util=require(_0xbce5('0x1'));var moment=require(_0xbce5('0x2'));var BPromise=require(_0xbce5('0x3'));var rs=require(_0xbce5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbce5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbce5('0x6'))(_0xbce5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbce5('0x8')][_0xbce5('0x9')]({'port':0x232a});config[_0xbce5('0xa')]=_[_0xbce5('0xb')](config[_0xbce5('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappAccount.socket')[_0xbce5('0xc')](socket);function respondWithRpcPromise(_0x1bc3ef,_0x88194a,_0x52a5ac){return new BPromise(function(_0x783345,_0x566b76){return client[_0xbce5('0xd')](_0x1bc3ef,_0x52a5ac)['then'](function(_0x9d0b1f){logger[_0xbce5('0xe')](_0xbce5('0xf'),_0x88194a,_0xbce5('0x10'));logger[_0xbce5('0x11')](_0xbce5('0x12'),_0x88194a,_0xbce5('0x10'),JSON['stringify'](_0x9d0b1f));if(_0x9d0b1f['error']){if(_0x9d0b1f[_0xbce5('0x13')][_0xbce5('0x14')]===0x1f4){logger[_0xbce5('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x88194a,_0x9d0b1f[_0xbce5('0x13')][_0xbce5('0x15')]);return _0x566b76(_0x9d0b1f[_0xbce5('0x13')]['message']);}logger[_0xbce5('0x13')](_0xbce5('0xf'),_0x88194a,_0x9d0b1f[_0xbce5('0x13')]['message']);return _0x783345(_0x9d0b1f['error']['message']);}else{logger[_0xbce5('0xe')](_0xbce5('0xf'),_0x88194a,_0xbce5('0x10'));_0x783345(_0x9d0b1f[_0xbce5('0x16')]['message']);}})[_0xbce5('0x17')](function(_0x792ca2){logger[_0xbce5('0x13')](_0xbce5('0xf'),_0x88194a,_0x792ca2);_0x566b76(_0x792ca2);});});}exports['ShowWhatsappAccount']=function(_0x4f1d19){var _0x162c5c=this;return new Promise(function(_0x4568ef,_0x3caa29){return db[_0xbce5('0x18')][_0xbce5('0x19')]({'raw':_0x4f1d19['options']?_0x4f1d19[_0xbce5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4f1d19['options']?_0x4f1d19[_0xbce5('0x1a')][_0xbce5('0x1b')]||null:null,'attributes':_0x4f1d19[_0xbce5('0x1a')]?_0x4f1d19[_0xbce5('0x1a')][_0xbce5('0x1c')]||null:null,'include':_0x4f1d19[_0xbce5('0x1a')]?_0x4f1d19[_0xbce5('0x1a')][_0xbce5('0x1d')]?_[_0xbce5('0x1e')](_0x4f1d19[_0xbce5('0x1a')][_0xbce5('0x1d')],function(_0x21255b){return{'model':db[_0x21255b[_0xbce5('0x1f')]],'as':_0x21255b['as'],'attributes':_0x21255b[_0xbce5('0x1c')],'include':_0x21255b['include']?_[_0xbce5('0x1e')](_0x21255b[_0xbce5('0x1d')],function(_0x4e3a9e){return{'model':db[_0x4e3a9e[_0xbce5('0x1f')]],'as':_0x4e3a9e['as'],'attributes':_0x4e3a9e[_0xbce5('0x1c')],'include':_0x4e3a9e[_0xbce5('0x1d')]?_[_0xbce5('0x1e')](_0x4e3a9e[_0xbce5('0x1d')],function(_0x3c9d0e){return{'model':db[_0x3c9d0e['model']],'as':_0x3c9d0e['as'],'attributes':_0x3c9d0e[_0xbce5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d8747){logger[_0xbce5('0xe')](_0xbce5('0x20'),_0x4f1d19);logger[_0xbce5('0x11')](_0xbce5('0x20'),_0x4f1d19,JSON[_0xbce5('0x21')](_0x2d8747));_0x4568ef(_0x2d8747);})[_0xbce5('0x17')](function(_0x3a21fb){logger[_0xbce5('0x13')](_0xbce5('0x20'),_0x3a21fb[_0xbce5('0x15')],_0x4f1d19);_0x3caa29(_0x162c5c['error'](0x1f4,_0x3a21fb['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index bf305fd..71e7a8e 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 _0x4301=['length','./whatsappAccount.events','remove','update','emit','removeListener','register'];(function(_0xabd7f6,_0x4a37f2){var _0x43aa7a=function(_0x40c4dc){while(--_0x40c4dc){_0xabd7f6['push'](_0xabd7f6['shift']());}};_0x43aa7a(++_0x4a37f2);}(_0x4301,0x78));var _0x1430=function(_0xf2b5ba,_0x4ad3ad){_0xf2b5ba=_0xf2b5ba-0x0;var _0x387064=_0x4301[_0xf2b5ba];return _0x387064;};'use strict';var WhatsappAccountEvents=require(_0x1430('0x0'));var events=['save',_0x1430('0x1'),_0x1430('0x2')];function createListener(_0x3e7a7f,_0x40cb5e){return function(_0x29523f){_0x40cb5e[_0x1430('0x3')](_0x3e7a7f,_0x29523f);};}function removeListener(_0x1c405a,_0x5316d7){return function(){WhatsappAccountEvents[_0x1430('0x4')](_0x1c405a,_0x5316d7);};}exports[_0x1430('0x5')]=function(_0x2caf48){for(var _0x367547=0x0,_0xa04900=events[_0x1430('0x6')];_0x367547<_0xa04900;_0x367547++){var _0x56c618=events[_0x367547];var _0x411084=createListener('whatsappAccount:'+_0x56c618,_0x2caf48);WhatsappAccountEvents['on'](_0x56c618,_0x411084);}}; \ No newline at end of file +var _0x943f=['remove','update','register','length','./whatsappAccount.events','save'];(function(_0x578de1,_0x105fc8){var _0x361b57=function(_0x4e8cf5){while(--_0x4e8cf5){_0x578de1['push'](_0x578de1['shift']());}};_0x361b57(++_0x105fc8);}(_0x943f,0xee));var _0xf943=function(_0x1b282b,_0x808419){_0x1b282b=_0x1b282b-0x0;var _0x439e72=_0x943f[_0x1b282b];return _0x439e72;};'use strict';var WhatsappAccountEvents=require(_0xf943('0x0'));var events=[_0xf943('0x1'),_0xf943('0x2'),_0xf943('0x3')];function createListener(_0x2e3cc6,_0x4f77db){return function(_0x1c6898){_0x4f77db['emit'](_0x2e3cc6,_0x1c6898);};}function removeListener(_0xfd3e94,_0x2b912){return function(){WhatsappAccountEvents['removeListener'](_0xfd3e94,_0x2b912);};}exports[_0xf943('0x4')]=function(_0x42bab7){for(var _0x4cb953=0x0,_0x38d994=events[_0xf943('0x5')];_0x4cb953<_0x38d994;_0x4cb953++){var _0x18cd37=events[_0x4cb953];var _0x51a8ce=createListener('whatsappAccount:'+_0x18cd37,_0x42bab7);WhatsappAccountEvents['on'](_0x18cd37,_0x51a8ce);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index e5be0bc..cf594a9 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 _0x42de=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x38576d,_0x527dc7){var _0x32534a=function(_0x2fd590){while(--_0x2fd590){_0x38576d['push'](_0x38576d['shift']());}};_0x32534a(++_0x527dc7);}(_0x42de,0x14a));var _0xe42d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x42de[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xe42d('0x0'));var util=require('util');var path=require(_0xe42d('0x1'));var timeout=require(_0xe42d('0x2'));var express=require(_0xe42d('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe42d('0x4'));router[_0xe42d('0x5')]('/',auth[_0xe42d('0x6')](),controller[_0xe42d('0x7')]);router['get'](_0xe42d('0x8'),auth[_0xe42d('0x6')](),controller[_0xe42d('0x9')]);router[_0xe42d('0xa')]('/',auth[_0xe42d('0x6')](),controller[_0xe42d('0xb')]);router[_0xe42d('0xc')](_0xe42d('0x8'),auth[_0xe42d('0x6')](),controller[_0xe42d('0xd')]);router[_0xe42d('0xe')]('/:id',auth[_0xe42d('0x6')](),controller[_0xe42d('0xf')]);module[_0xe42d('0x10')]=router; \ No newline at end of file +var _0x827b=['delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','post','isAuthenticated','create','put','update'];(function(_0x50210b,_0x5bc5e1){var _0x1534f2=function(_0x72e92c){while(--_0x72e92c){_0x50210b['push'](_0x50210b['shift']());}};_0x1534f2(++_0x5bc5e1);}(_0x827b,0x123));var _0xb827=function(_0x4e0a11,_0x13b168){_0x4e0a11=_0x4e0a11-0x0;var _0x534c86=_0x827b[_0x4e0a11];return _0x534c86;};'use strict';var multer=require('multer');var util=require(_0xb827('0x0'));var path=require('path');var timeout=require(_0xb827('0x1'));var express=require('express');var router=express[_0xb827('0x2')]();var auth=require(_0xb827('0x3'));var interaction=require(_0xb827('0x4'));var config=require(_0xb827('0x5'));var controller=require('./whatsappApplication.controller');router[_0xb827('0x6')]('/',auth['isAuthenticated'](),controller[_0xb827('0x7')]);router['get'](_0xb827('0x8'),auth['isAuthenticated'](),controller[_0xb827('0x9')]);router[_0xb827('0xa')]('/',auth[_0xb827('0xb')](),controller[_0xb827('0xc')]);router[_0xb827('0xd')]('/:id',auth[_0xb827('0xb')](),controller[_0xb827('0xe')]);router[_0xb827('0xf')](_0xb827('0x8'),auth[_0xb827('0xb')](),controller[_0xb827('0x10')]);module[_0xb827('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index a5e031a..aa79b46 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 _0x0faf=['exports','INTEGER','STRING','TEXT'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0x0faf,0x148));var _0xf0fa=function(_0x12a020,_0x85b476){_0x12a020=_0x12a020-0x0;var _0x63cddd=_0x0faf[_0x12a020];return _0x63cddd;};'use strict';var Sequelize=require('sequelize');module[_0xf0fa('0x0')]={'priority':{'type':Sequelize[_0xf0fa('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf0fa('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf0fa('0x3')]()},'description':{'type':Sequelize[_0xf0fa('0x2')]},'interval':{'type':Sequelize[_0xf0fa('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x6e42=['sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x1ed2cc,_0x1eb871){var _0x3c0e08=function(_0x410479){while(--_0x410479){_0x1ed2cc['push'](_0x1ed2cc['shift']());}};_0x3c0e08(++_0x1eb871);}(_0x6e42,0xf5));var _0x26e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e42[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x26e4('0x0'));module[_0x26e4('0x1')]={'priority':{'type':Sequelize[_0x26e4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x26e4('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x26e4('0x4')]()},'description':{'type':Sequelize[_0x26e4('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index c8a9cf0..dbc406b 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 _0xaf6b=['body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','querystring','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','WhatsappApplication','findAll','rows','catch','show','params','find','create'];(function(_0x48ee18,_0x3136a2){var _0xa726b0=function(_0x492e50){while(--_0x492e50){_0x48ee18['push'](_0x48ee18['shift']());}};_0xa726b0(++_0x3136a2);}(_0xaf6b,0xdf));var _0xbaf6=function(_0x597a45,_0x3520cd){_0x597a45=_0x597a45-0x0;var _0x534cdc=_0xaf6b[_0x597a45];return _0x534cdc;};'use strict';var pdf=require(_0xbaf6('0x0'));var emlformat=require(_0xbaf6('0x1'));var rimraf=require(_0xbaf6('0x2'));var zipdir=require(_0xbaf6('0x3'));var jsonpatch=require(_0xbaf6('0x4'));var rp=require(_0xbaf6('0x5'));var moment=require(_0xbaf6('0x6'));var BPromise=require(_0xbaf6('0x7'));var Mustache=require(_0xbaf6('0x8'));var util=require(_0xbaf6('0x9'));var path=require(_0xbaf6('0xa'));var sox=require(_0xbaf6('0xb'));var csv=require('to-csv');var ejs=require(_0xbaf6('0xc'));var fs=require('fs');var _=require(_0xbaf6('0xd'));var squel=require(_0xbaf6('0xe'));var crypto=require(_0xbaf6('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbaf6('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbaf6('0x11'));var logger=require(_0xbaf6('0x12'))(_0xbaf6('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbaf6('0x14'));var db=require(_0xbaf6('0x15'))['db'];function respondWithStatusCode(_0x47d8b2,_0x3b88bb){_0x3b88bb=_0x3b88bb||0xcc;return function(_0x1537b7){if(_0x1537b7){return _0x47d8b2[_0xbaf6('0x16')](_0x3b88bb);}return _0x47d8b2[_0xbaf6('0x17')](_0x3b88bb)['end']();};}function respondWithResult(_0x4dd955,_0x23df1c){_0x23df1c=_0x23df1c||0xc8;return function(_0x1ed3ad){if(_0x1ed3ad){return _0x4dd955[_0xbaf6('0x17')](_0x23df1c)[_0xbaf6('0x18')](_0x1ed3ad);}};}function respondWithFilteredResult(_0x524334,_0xf2395f){return function(_0x1607f6){if(_0x1607f6){var _0x40e39f=_0x1607f6[_0xbaf6('0x19')],_0x13a77c=_0xf2395f['offset'],_0x4223f1=_0xf2395f[_0xbaf6('0x1a')]+_0xf2395f[_0xbaf6('0x1b')],_0x349ccf;if(_0x4223f1>=_0x40e39f){_0x4223f1=_0x40e39f;_0x349ccf=0xc8;}else{_0x349ccf=0xce;}_0x524334[_0xbaf6('0x17')](_0x349ccf);return _0x524334[_0xbaf6('0x1c')](_0xbaf6('0x1d'),_0x13a77c+'-'+_0x4223f1+'/'+_0x40e39f)['json'](_0x1607f6);}return null;};}function patchUpdates(_0x4f47e0){return function(_0x3dc875){try{jsonpatch[_0xbaf6('0x1e')](_0x3dc875,_0x4f47e0,!![]);}catch(_0x5c355e){return BPromise['reject'](_0x5c355e);}return _0x3dc875[_0xbaf6('0x1f')]();};}function saveUpdates(_0x57c71f,_0x1067ba){return function(_0x2e4790){if(_0x2e4790){return _0x2e4790[_0xbaf6('0x20')](_0x57c71f)['then'](function(_0x46383e){return _0x46383e;});}return null;};}function removeEntity(_0x439a24,_0x2950dd){return function(_0xed8385){if(_0xed8385){return _0xed8385[_0xbaf6('0x21')]()[_0xbaf6('0x22')](function(){_0x439a24[_0xbaf6('0x17')](0xcc)[_0xbaf6('0x23')]();});}};}function handleEntityNotFound(_0x500b31,_0x40a01f){return function(_0x2171eb){if(!_0x2171eb){_0x500b31[_0xbaf6('0x16')](0x194);}return _0x2171eb;};}function handleError(_0x2d19c0,_0xfb7e54){_0xfb7e54=_0xfb7e54||0x1f4;return function(_0x11f42d){logger[_0xbaf6('0x24')](_0x11f42d[_0xbaf6('0x25')]);if(_0x11f42d[_0xbaf6('0x26')]){delete _0x11f42d['name'];}_0x2d19c0[_0xbaf6('0x17')](_0xfb7e54)[_0xbaf6('0x27')](_0x11f42d);};}exports[_0xbaf6('0x28')]=function(_0x3d4852,_0x49d7ac){var _0x373a58={},_0x503973={},_0xef7870={'count':0x0,'rows':[]};var _0x359bc0=_[_0xbaf6('0x29')](db['WhatsappApplication'][_0xbaf6('0x2a')],function(_0x3ad00f){return{'name':_0x3ad00f[_0xbaf6('0x2b')],'type':_0x3ad00f[_0xbaf6('0x2c')][_0xbaf6('0x2d')]};});_0x503973[_0xbaf6('0x2e')]=_[_0xbaf6('0x29')](_0x359bc0,_0xbaf6('0x26'));_0x503973[_0xbaf6('0x2f')]=_[_0xbaf6('0x30')](_0x3d4852[_0xbaf6('0x2f')]);_0x503973[_0xbaf6('0x31')]=_[_0xbaf6('0x32')](_0x503973[_0xbaf6('0x2e')],_0x503973['query']);_0x373a58['attributes']=_[_0xbaf6('0x32')](_0x503973[_0xbaf6('0x2e')],qs['fields'](_0x3d4852['query'][_0xbaf6('0x33')]));_0x373a58[_0xbaf6('0x34')]=_0x373a58[_0xbaf6('0x34')][_0xbaf6('0x35')]?_0x373a58[_0xbaf6('0x34')]:_0x503973[_0xbaf6('0x2e')];if(!_0x3d4852['query'][_0xbaf6('0x36')]('nolimit')){_0x373a58[_0xbaf6('0x1b')]=qs[_0xbaf6('0x1b')](_0x3d4852[_0xbaf6('0x2f')][_0xbaf6('0x1b')]);_0x373a58[_0xbaf6('0x1a')]=qs[_0xbaf6('0x1a')](_0x3d4852[_0xbaf6('0x2f')][_0xbaf6('0x1a')]);}_0x373a58[_0xbaf6('0x37')]=qs[_0xbaf6('0x38')](_0x3d4852[_0xbaf6('0x2f')][_0xbaf6('0x38')]);_0x373a58['where']=qs['filters'](_[_0xbaf6('0x39')](_0x3d4852[_0xbaf6('0x2f')],_0x503973[_0xbaf6('0x31')]),_0x359bc0);if(_0x3d4852[_0xbaf6('0x2f')]['filter']){_0x373a58[_0xbaf6('0x3a')]=_[_0xbaf6('0x3b')](_0x373a58[_0xbaf6('0x3a')],{'$or':_[_0xbaf6('0x29')](_0x359bc0,function(_0x109866){if(_0x109866[_0xbaf6('0x2c')]!==_0xbaf6('0x3c')){var _0x2fc5ba={};_0x2fc5ba[_0x109866[_0xbaf6('0x26')]]={'$like':'%'+_0x3d4852[_0xbaf6('0x2f')][_0xbaf6('0x3d')]+'%'};return _0x2fc5ba;}})});}_0x373a58=_[_0xbaf6('0x3b')]({},_0x373a58,_0x3d4852[_0xbaf6('0x3e')]);var _0x12d8db={'where':_0x373a58[_0xbaf6('0x3a')]};return db['WhatsappApplication'][_0xbaf6('0x19')](_0x12d8db)[_0xbaf6('0x22')](function(_0x4bf429){_0xef7870[_0xbaf6('0x19')]=_0x4bf429;if(_0x3d4852[_0xbaf6('0x2f')][_0xbaf6('0x3f')]){_0x373a58[_0xbaf6('0x40')]=[{'all':!![]}];}return db[_0xbaf6('0x41')][_0xbaf6('0x42')](_0x373a58);})[_0xbaf6('0x22')](function(_0x29ce26){_0xef7870[_0xbaf6('0x43')]=_0x29ce26;return _0xef7870;})[_0xbaf6('0x22')](respondWithFilteredResult(_0x49d7ac,_0x373a58))[_0xbaf6('0x44')](handleError(_0x49d7ac,null));};exports[_0xbaf6('0x45')]=function(_0xcc0da1,_0x5d9e0e){var _0x53ea0b={'raw':!![],'where':{'id':_0xcc0da1[_0xbaf6('0x46')]['id']}},_0x38b992={};_0x38b992[_0xbaf6('0x2e')]=_[_0xbaf6('0x30')](db[_0xbaf6('0x41')][_0xbaf6('0x2a')]);_0x38b992[_0xbaf6('0x2f')]=_[_0xbaf6('0x30')](_0xcc0da1[_0xbaf6('0x2f')]);_0x38b992[_0xbaf6('0x31')]=_['intersection'](_0x38b992[_0xbaf6('0x2e')],_0x38b992['query']);_0x53ea0b[_0xbaf6('0x34')]=_[_0xbaf6('0x32')](_0x38b992[_0xbaf6('0x2e')],qs[_0xbaf6('0x33')](_0xcc0da1['query'][_0xbaf6('0x33')]));_0x53ea0b[_0xbaf6('0x34')]=_0x53ea0b[_0xbaf6('0x34')][_0xbaf6('0x35')]?_0x53ea0b['attributes']:_0x38b992[_0xbaf6('0x2e')];if(_0xcc0da1['query'][_0xbaf6('0x3f')]){_0x53ea0b[_0xbaf6('0x40')]=[{'all':!![]}];}_0x53ea0b=_[_0xbaf6('0x3b')]({},_0x53ea0b,_0xcc0da1[_0xbaf6('0x3e')]);return db[_0xbaf6('0x41')][_0xbaf6('0x47')](_0x53ea0b)[_0xbaf6('0x22')](handleEntityNotFound(_0x5d9e0e,null))['then'](respondWithResult(_0x5d9e0e,null))['catch'](handleError(_0x5d9e0e,null));};exports[_0xbaf6('0x48')]=function(_0xa54ea,_0x46bd30){return db[_0xbaf6('0x41')]['create'](_0xa54ea[_0xbaf6('0x49')],{})[_0xbaf6('0x22')](respondWithResult(_0x46bd30,0xc9))[_0xbaf6('0x44')](handleError(_0x46bd30,null));};exports[_0xbaf6('0x20')]=function(_0xc20161,_0x4d458e){if(_0xc20161[_0xbaf6('0x49')]['id']){delete _0xc20161[_0xbaf6('0x49')]['id'];}return db[_0xbaf6('0x41')][_0xbaf6('0x47')]({'where':{'id':_0xc20161['params']['id']}})[_0xbaf6('0x22')](handleEntityNotFound(_0x4d458e,null))[_0xbaf6('0x22')](saveUpdates(_0xc20161[_0xbaf6('0x49')],null))['then'](respondWithResult(_0x4d458e,null))['catch'](handleError(_0x4d458e,null));};exports[_0xbaf6('0x21')]=function(_0x3a3a98,_0x24fa0a){return db['WhatsappApplication'][_0xbaf6('0x47')]({'where':{'id':_0x3a3a98[_0xbaf6('0x46')]['id']}})[_0xbaf6('0x22')](handleEntityNotFound(_0x24fa0a,null))[_0xbaf6('0x22')](removeEntity(_0x24fa0a,null))[_0xbaf6('0x44')](handleError(_0x24fa0a,null));}; \ No newline at end of file +var _0xde43=['length','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','name','map','WhatsappApplication','fieldName','type','model','query','keys','filters','intersection','fields','attributes'];(function(_0x3c999e,_0x4aa1b9){var _0x2e9226=function(_0x2d36ff){while(--_0x2d36ff){_0x3c999e['push'](_0x3c999e['shift']());}};_0x2e9226(++_0x4aa1b9);}(_0xde43,0x173));var _0x3de4=function(_0x293274,_0x1f9041){_0x293274=_0x293274-0x0;var _0x21730e=_0xde43[_0x293274];return _0x21730e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3de4('0x0'));var rimraf=require(_0x3de4('0x1'));var zipdir=require(_0x3de4('0x2'));var jsonpatch=require(_0x3de4('0x3'));var rp=require(_0x3de4('0x4'));var moment=require(_0x3de4('0x5'));var BPromise=require(_0x3de4('0x6'));var Mustache=require('mustache');var util=require(_0x3de4('0x7'));var path=require('path');var sox=require(_0x3de4('0x8'));var csv=require(_0x3de4('0x9'));var ejs=require(_0x3de4('0xa'));var fs=require('fs');var _=require(_0x3de4('0xb'));var squel=require('squel');var crypto=require(_0x3de4('0xc'));var jsforce=require(_0x3de4('0xd'));var deskjs=require(_0x3de4('0xe'));var toCsv=require(_0x3de4('0x9'));var querystring=require(_0x3de4('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3de4('0x10'));var as=require(_0x3de4('0x11'));var hardwareService=require(_0x3de4('0x12'));var logger=require(_0x3de4('0x13'))(_0x3de4('0x14'));var utils=require('../../config/utils');var config=require(_0x3de4('0x15'));var licenseUtil=require(_0x3de4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41d03b,_0x336bb0){_0x336bb0=_0x336bb0||0xcc;return function(_0x47440f){if(_0x47440f){return _0x41d03b['sendStatus'](_0x336bb0);}return _0x41d03b[_0x3de4('0x17')](_0x336bb0)[_0x3de4('0x18')]();};}function respondWithResult(_0x22246f,_0x194e76){_0x194e76=_0x194e76||0xc8;return function(_0x2ea5e5){if(_0x2ea5e5){return _0x22246f[_0x3de4('0x17')](_0x194e76)[_0x3de4('0x19')](_0x2ea5e5);}};}function respondWithFilteredResult(_0x56868a,_0x4707fc){return function(_0xa60850){if(_0xa60850){var _0x480ae5=_0xa60850[_0x3de4('0x1a')],_0x1efe9=_0x4707fc[_0x3de4('0x1b')],_0x496c78=_0x4707fc[_0x3de4('0x1b')]+_0x4707fc['limit'],_0x5a3354;if(_0x496c78>=_0x480ae5){_0x496c78=_0x480ae5;_0x5a3354=0xc8;}else{_0x5a3354=0xce;}_0x56868a[_0x3de4('0x17')](_0x5a3354);return _0x56868a[_0x3de4('0x1c')]('Content-Range',_0x1efe9+'-'+_0x496c78+'/'+_0x480ae5)[_0x3de4('0x19')](_0xa60850);}return null;};}function patchUpdates(_0x502774){return function(_0x404713){try{jsonpatch[_0x3de4('0x1d')](_0x404713,_0x502774,!![]);}catch(_0x484f77){return BPromise[_0x3de4('0x1e')](_0x484f77);}return _0x404713[_0x3de4('0x1f')]();};}function saveUpdates(_0x9f1044,_0x1a96e9){return function(_0x1e66d5){if(_0x1e66d5){return _0x1e66d5[_0x3de4('0x20')](_0x9f1044)[_0x3de4('0x21')](function(_0x433588){return _0x433588;});}return null;};}function removeEntity(_0x456b3f,_0x3b4fa3){return function(_0x4560c8){if(_0x4560c8){return _0x4560c8[_0x3de4('0x22')]()[_0x3de4('0x21')](function(){_0x456b3f[_0x3de4('0x17')](0xcc)[_0x3de4('0x18')]();});}};}function handleEntityNotFound(_0x50bc4a,_0x1378f4){return function(_0x17937b){if(!_0x17937b){_0x50bc4a[_0x3de4('0x23')](0x194);}return _0x17937b;};}function handleError(_0x293b7f,_0x21ffe0){_0x21ffe0=_0x21ffe0||0x1f4;return function(_0x47da8d){logger[_0x3de4('0x24')](_0x47da8d['stack']);if(_0x47da8d[_0x3de4('0x25')]){delete _0x47da8d['name'];}_0x293b7f['status'](_0x21ffe0)['send'](_0x47da8d);};}exports['index']=function(_0x41b498,_0x217244){var _0x5a3f50={},_0x35fdbf={},_0x5e19fd={'count':0x0,'rows':[]};var _0x21dade=_[_0x3de4('0x26')](db[_0x3de4('0x27')]['rawAttributes'],function(_0x228660){return{'name':_0x228660[_0x3de4('0x28')],'type':_0x228660[_0x3de4('0x29')]['key']};});_0x35fdbf[_0x3de4('0x2a')]=_[_0x3de4('0x26')](_0x21dade,_0x3de4('0x25'));_0x35fdbf[_0x3de4('0x2b')]=_[_0x3de4('0x2c')](_0x41b498['query']);_0x35fdbf[_0x3de4('0x2d')]=_[_0x3de4('0x2e')](_0x35fdbf['model'],_0x35fdbf[_0x3de4('0x2b')]);_0x5a3f50['attributes']=_[_0x3de4('0x2e')](_0x35fdbf[_0x3de4('0x2a')],qs[_0x3de4('0x2f')](_0x41b498[_0x3de4('0x2b')][_0x3de4('0x2f')]));_0x5a3f50[_0x3de4('0x30')]=_0x5a3f50[_0x3de4('0x30')][_0x3de4('0x31')]?_0x5a3f50[_0x3de4('0x30')]:_0x35fdbf[_0x3de4('0x2a')];if(!_0x41b498[_0x3de4('0x2b')]['hasOwnProperty'](_0x3de4('0x32'))){_0x5a3f50['limit']=qs[_0x3de4('0x33')](_0x41b498[_0x3de4('0x2b')][_0x3de4('0x33')]);_0x5a3f50[_0x3de4('0x1b')]=qs[_0x3de4('0x1b')](_0x41b498[_0x3de4('0x2b')][_0x3de4('0x1b')]);}_0x5a3f50[_0x3de4('0x34')]=qs[_0x3de4('0x35')](_0x41b498[_0x3de4('0x2b')][_0x3de4('0x35')]);_0x5a3f50['where']=qs[_0x3de4('0x2d')](_[_0x3de4('0x36')](_0x41b498[_0x3de4('0x2b')],_0x35fdbf[_0x3de4('0x2d')]),_0x21dade);if(_0x41b498[_0x3de4('0x2b')][_0x3de4('0x37')]){_0x5a3f50[_0x3de4('0x38')]=_['merge'](_0x5a3f50[_0x3de4('0x38')],{'$or':_['map'](_0x21dade,function(_0x4145ab){if(_0x4145ab[_0x3de4('0x29')]!==_0x3de4('0x39')){var _0x175203={};_0x175203[_0x4145ab[_0x3de4('0x25')]]={'$like':'%'+_0x41b498['query'][_0x3de4('0x37')]+'%'};return _0x175203;}})});}_0x5a3f50=_[_0x3de4('0x3a')]({},_0x5a3f50,_0x41b498[_0x3de4('0x3b')]);var _0x13e040={'where':_0x5a3f50[_0x3de4('0x38')]};return db[_0x3de4('0x27')][_0x3de4('0x1a')](_0x13e040)['then'](function(_0x9b2e14){_0x5e19fd[_0x3de4('0x1a')]=_0x9b2e14;if(_0x41b498[_0x3de4('0x2b')][_0x3de4('0x3c')]){_0x5a3f50[_0x3de4('0x3d')]=[{'all':!![]}];}return db[_0x3de4('0x27')][_0x3de4('0x3e')](_0x5a3f50);})[_0x3de4('0x21')](function(_0x32309a){_0x5e19fd[_0x3de4('0x3f')]=_0x32309a;return _0x5e19fd;})[_0x3de4('0x21')](respondWithFilteredResult(_0x217244,_0x5a3f50))[_0x3de4('0x40')](handleError(_0x217244,null));};exports['show']=function(_0x599e32,_0x55a771){var _0x52538b={'raw':!![],'where':{'id':_0x599e32[_0x3de4('0x41')]['id']}},_0x47ae70={};_0x47ae70['model']=_['keys'](db[_0x3de4('0x27')][_0x3de4('0x42')]);_0x47ae70[_0x3de4('0x2b')]=_[_0x3de4('0x2c')](_0x599e32['query']);_0x47ae70['filters']=_[_0x3de4('0x2e')](_0x47ae70[_0x3de4('0x2a')],_0x47ae70[_0x3de4('0x2b')]);_0x52538b['attributes']=_[_0x3de4('0x2e')](_0x47ae70[_0x3de4('0x2a')],qs[_0x3de4('0x2f')](_0x599e32[_0x3de4('0x2b')][_0x3de4('0x2f')]));_0x52538b[_0x3de4('0x30')]=_0x52538b['attributes']['length']?_0x52538b['attributes']:_0x47ae70[_0x3de4('0x2a')];if(_0x599e32['query'][_0x3de4('0x3c')]){_0x52538b[_0x3de4('0x3d')]=[{'all':!![]}];}_0x52538b=_[_0x3de4('0x3a')]({},_0x52538b,_0x599e32[_0x3de4('0x3b')]);return db[_0x3de4('0x27')][_0x3de4('0x43')](_0x52538b)[_0x3de4('0x21')](handleEntityNotFound(_0x55a771,null))[_0x3de4('0x21')](respondWithResult(_0x55a771,null))[_0x3de4('0x40')](handleError(_0x55a771,null));};exports[_0x3de4('0x44')]=function(_0x3c2e53,_0x5eee69){return db[_0x3de4('0x27')][_0x3de4('0x44')](_0x3c2e53[_0x3de4('0x45')],{})[_0x3de4('0x21')](respondWithResult(_0x5eee69,0xc9))[_0x3de4('0x40')](handleError(_0x5eee69,null));};exports[_0x3de4('0x20')]=function(_0x3aac8f,_0x2e3ec8){if(_0x3aac8f[_0x3de4('0x45')]['id']){delete _0x3aac8f[_0x3de4('0x45')]['id'];}return db[_0x3de4('0x27')][_0x3de4('0x43')]({'where':{'id':_0x3aac8f[_0x3de4('0x41')]['id']}})[_0x3de4('0x21')](handleEntityNotFound(_0x2e3ec8,null))[_0x3de4('0x21')](saveUpdates(_0x3aac8f[_0x3de4('0x45')],null))[_0x3de4('0x21')](respondWithResult(_0x2e3ec8,null))['catch'](handleError(_0x2e3ec8,null));};exports[_0x3de4('0x22')]=function(_0x2a4453,_0x425408){return db['WhatsappApplication'][_0x3de4('0x43')]({'where':{'id':_0x2a4453['params']['id']}})[_0x3de4('0x21')](handleEntityNotFound(_0x425408,null))[_0x3de4('0x21')](removeEntity(_0x425408,null))[_0x3de4('0x40')](handleError(_0x425408,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 1ea6c6b..be847f5 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 _0xed68=['WhatsappApplication','whatsapp_applications','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x4e220c,_0x13756b){var _0x4166bf=function(_0xeba85f){while(--_0xeba85f){_0x4e220c['push'](_0x4e220c['shift']());}};_0x4166bf(++_0x13756b);}(_0xed68,0x154));var _0x8ed6=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0xed68[_0x37e845];return _0x59e55b;};'use strict';var _=require(_0x8ed6('0x0'));var util=require(_0x8ed6('0x1'));var logger=require(_0x8ed6('0x2'))('api');var moment=require(_0x8ed6('0x3'));var BPromise=require(_0x8ed6('0x4'));var rp=require(_0x8ed6('0x5'));var fs=require('fs');var path=require(_0x8ed6('0x6'));var rimraf=require(_0x8ed6('0x7'));var config=require(_0x8ed6('0x8'));var attributes=require('./whatsappApplication.attributes');module[_0x8ed6('0x9')]=function(_0x22b3d8,_0x5ba1ad){return _0x22b3d8[_0x8ed6('0xa')](_0x8ed6('0xb'),attributes,{'tableName':_0x8ed6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe8bf=['rimraf','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','api','moment','request-promise','path'];(function(_0x218b0f,_0x2e7c96){var _0x3b4198=function(_0x50c435){while(--_0x50c435){_0x218b0f['push'](_0x218b0f['shift']());}};_0x3b4198(++_0x2e7c96);}(_0xe8bf,0xa3));var _0xfe8b=function(_0x850541,_0x37ce50){_0x850541=_0x850541-0x0;var _0x385d5e=_0xe8bf[_0x850541];return _0x385d5e;};'use strict';var _=require('lodash');var util=require(_0xfe8b('0x0'));var logger=require('../../config/logger')(_0xfe8b('0x1'));var moment=require(_0xfe8b('0x2'));var BPromise=require('bluebird');var rp=require(_0xfe8b('0x3'));var fs=require('fs');var path=require(_0xfe8b('0x4'));var rimraf=require(_0xfe8b('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module[_0xfe8b('0x6')]=function(_0x28ff2e,_0x14afc5){return _0x28ff2e[_0xfe8b('0x7')](_0xfe8b('0x8'),attributes,{'tableName':_0xfe8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfe8b('0xa'),'collate':_0xfe8b('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index b4da3cc..d4730e3 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 _0x82c4=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3ff0f0,_0x5523bf){var _0x5dc82a=function(_0x14d26d){while(--_0x14d26d){_0x3ff0f0['push'](_0x3ff0f0['shift']());}};_0x5dc82a(++_0x5523bf);}(_0x82c4,0x1ca));var _0x482c=function(_0x391bf7,_0x5b92f7){_0x391bf7=_0x391bf7-0x0;var _0x41c384=_0x82c4[_0x391bf7];return _0x41c384;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var moment=require(_0x482c('0x2'));var BPromise=require(_0x482c('0x3'));var rs=require(_0x482c('0x4'));var fs=require('fs');var Redis=require(_0x482c('0x5'));var db=require(_0x482c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x482c('0x7'))('rpc');var config=require(_0x482c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x482c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfdb92,_0x32a503,_0x35cdab){return new BPromise(function(_0x1c10f2,_0x3846d8){return client['request'](_0xfdb92,_0x35cdab)[_0x482c('0xa')](function(_0x135cc1){logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));logger[_0x482c('0xe')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x32a503,_0x482c('0xd'),JSON[_0x482c('0xf')](_0x135cc1));if(_0x135cc1[_0x482c('0x10')]){if(_0x135cc1['error'][_0x482c('0x11')]===0x1f4){logger[_0x482c('0x10')](_0x482c('0xc'),_0x32a503,_0x135cc1['error']['message']);return _0x3846d8(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x32a503,_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);return _0x1c10f2(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}else{logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));_0x1c10f2(_0x135cc1[_0x482c('0x13')][_0x482c('0x12')]);}})[_0x482c('0x14')](function(_0x363403){logger[_0x482c('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x32a503,_0x363403);_0x3846d8(_0x363403);});});} \ No newline at end of file +var _0x5a5a=['code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x42e07c,_0x45a744){var _0x18802c=function(_0x5d648b){while(--_0x5d648b){_0x42e07c['push'](_0x42e07c['shift']());}};_0x18802c(++_0x45a744);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x425d5e,_0x3b9040){_0x425d5e=_0x425d5e-0x0;var _0x3cc67b=_0x5a5a[_0x425d5e];return _0x3cc67b;};'use strict';var _=require('lodash');var util=require(_0xa5a5('0x0'));var moment=require(_0xa5a5('0x1'));var BPromise=require(_0xa5a5('0x2'));var rs=require(_0xa5a5('0x3'));var fs=require('fs');var Redis=require(_0xa5a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa5a5('0x5'));var logger=require(_0xa5a5('0x6'))(_0xa5a5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa5a5('0x8')][_0xa5a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5691f1,_0x3ea00f,_0xf2ea20){return new BPromise(function(_0x1234c2,_0x3a23f4){return client[_0xa5a5('0xa')](_0x5691f1,_0xf2ea20)['then'](function(_0x158a80){logger[_0xa5a5('0xb')](_0xa5a5('0xc'),_0x3ea00f,_0xa5a5('0xd'));logger[_0xa5a5('0xe')](_0xa5a5('0xf'),_0x3ea00f,_0xa5a5('0xd'),JSON[_0xa5a5('0x10')](_0x158a80));if(_0x158a80[_0xa5a5('0x11')]){if(_0x158a80[_0xa5a5('0x11')][_0xa5a5('0x12')]===0x1f4){logger[_0xa5a5('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x3ea00f,_0x158a80[_0xa5a5('0x11')][_0xa5a5('0x13')]);return _0x3a23f4(_0x158a80[_0xa5a5('0x11')][_0xa5a5('0x13')]);}logger[_0xa5a5('0x11')](_0xa5a5('0xc'),_0x3ea00f,_0x158a80['error'][_0xa5a5('0x13')]);return _0x1234c2(_0x158a80[_0xa5a5('0x11')][_0xa5a5('0x13')]);}else{logger[_0xa5a5('0xb')](_0xa5a5('0xc'),_0x3ea00f,_0xa5a5('0xd'));_0x1234c2(_0x158a80[_0xa5a5('0x14')][_0xa5a5('0x13')]);}})['catch'](function(_0x3ef56e){logger[_0xa5a5('0x11')](_0xa5a5('0xc'),_0x3ea00f,_0x3ef56e);_0x3a23f4(_0x3ef56e);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 3c89194..0c33952 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 _0x9291=['update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','addTags','/:id','whatsapp'];(function(_0x1a8e67,_0x470f28){var _0x1db32d=function(_0x2de00c){while(--_0x2de00c){_0x1a8e67['push'](_0x1a8e67['shift']());}};_0x1db32d(++_0x470f28);}(_0x9291,0x1e6));var _0x1929=function(_0x5c02c2,_0xf81e6c){_0x5c02c2=_0x5c02c2-0x0;var _0x109c27=_0x9291[_0x5c02c2];return _0x109c27;};'use strict';var multer=require(_0x1929('0x0'));var util=require('util');var path=require(_0x1929('0x1'));var timeout=require(_0x1929('0x2'));var express=require(_0x1929('0x3'));var router=express[_0x1929('0x4')]();var auth=require(_0x1929('0x5'));var interaction=require(_0x1929('0x6'));var config=require(_0x1929('0x7'));var controller=require('./whatsappInteraction.controller');router[_0x1929('0x8')]('/',auth[_0x1929('0x9')](),controller[_0x1929('0xa')]);router['get'](_0x1929('0xb'),auth[_0x1929('0x9')](),controller[_0x1929('0xc')]);router[_0x1929('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1929('0xd')]);router[_0x1929('0x8')]('/:id/messages',auth['isAuthenticated'](),controller[_0x1929('0xe')]);router[_0x1929('0x8')](_0x1929('0xf'),auth[_0x1929('0x9')](),controller[_0x1929('0x10')]);router[_0x1929('0x11')]('/',auth['isAuthenticated'](),controller[_0x1929('0x12')]);router['post'](_0x1929('0x13'),auth[_0x1929('0x9')](),controller[_0x1929('0x14')]);router[_0x1929('0x11')](_0x1929('0x15'),auth[_0x1929('0x9')](),interaction[_0x1929('0x16')]('whatsapp','whatsappinteraction:addtags'),controller[_0x1929('0x17')]);router['put'](_0x1929('0x18'),auth[_0x1929('0x9')](),interaction['tracked'](_0x1929('0x19'),'whatsappinteraction:update'),controller[_0x1929('0x1a')]);router[_0x1929('0x1b')](_0x1929('0x18'),auth[_0x1929('0x9')](),interaction[_0x1929('0x16')](_0x1929('0x19'),_0x1929('0x1c')),controller[_0x1929('0x1d')]);router[_0x1929('0x1b')](_0x1929('0x15'),auth['isAuthenticated'](),controller[_0x1929('0x1e')]);module[_0x1929('0x1f')]=router; \ No newline at end of file +var _0xd43e=['whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','whatsapp'];(function(_0x90d794,_0xf3931b){var _0x1b05a5=function(_0x169299){while(--_0x169299){_0x90d794['push'](_0x90d794['shift']());}};_0x1b05a5(++_0xf3931b);}(_0xd43e,0x1d8));var _0xed43=function(_0x4b3e6a,_0x346b66){_0x4b3e6a=_0x4b3e6a-0x0;var _0x4deb36=_0xd43e[_0x4b3e6a];return _0x4deb36;};'use strict';var multer=require(_0xed43('0x0'));var util=require(_0xed43('0x1'));var path=require(_0xed43('0x2'));var timeout=require(_0xed43('0x3'));var express=require(_0xed43('0x4'));var router=express[_0xed43('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xed43('0x6'));var config=require(_0xed43('0x7'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xed43('0x8')]);router[_0xed43('0x9')](_0xed43('0xa'),auth[_0xed43('0xb')](),controller[_0xed43('0xc')]);router[_0xed43('0x9')](_0xed43('0xd'),auth[_0xed43('0xb')](),controller[_0xed43('0xe')]);router[_0xed43('0x9')](_0xed43('0xf'),auth[_0xed43('0xb')](),controller[_0xed43('0x10')]);router['get']('/:id/download',auth[_0xed43('0xb')](),controller['download']);router[_0xed43('0x11')]('/',auth[_0xed43('0xb')](),controller[_0xed43('0x12')]);router['post']('/:id/messages',auth[_0xed43('0xb')](),controller[_0xed43('0x13')]);router['post'](_0xed43('0x14'),auth[_0xed43('0xb')](),interaction[_0xed43('0x15')](_0xed43('0x16'),_0xed43('0x17')),controller[_0xed43('0x18')]);router[_0xed43('0x19')](_0xed43('0xd'),auth[_0xed43('0xb')](),interaction[_0xed43('0x15')](_0xed43('0x16'),_0xed43('0x1a')),controller[_0xed43('0x1b')]);router['delete'](_0xed43('0xd'),auth['isAuthenticated'](),interaction[_0xed43('0x15')]('whatsapp',_0xed43('0x1c')),controller[_0xed43('0x1d')]);router[_0xed43('0x1e')](_0xed43('0x14'),auth['isAuthenticated'](),controller[_0xed43('0x1f')]);module[_0xed43('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index faeef85..8757196 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 _0x57e6=['moment','exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x30ffaa,_0x22f64d){var _0x500678=function(_0x3780dd){while(--_0x3780dd){_0x30ffaa['push'](_0x30ffaa['shift']());}};_0x500678(++_0x22f64d);}(_0x57e6,0x177));var _0x657e=function(_0x4191af,_0x5783da){_0x4191af=_0x4191af-0x0;var _0x27bebf=_0x57e6[_0x4191af];return _0x27bebf;};'use strict';var Sequelize=require(_0x657e('0x0'));var moment=require(_0x657e('0x1'));module[_0x657e('0x2')]={'closed':{'type':Sequelize[_0x657e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x657e('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x657e('0x4')]},'note':{'type':Sequelize[_0x657e('0x4')]},'phone':{'type':Sequelize[_0x657e('0x4')]},'read1stAt':{'type':Sequelize[_0x657e('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x657e('0x6')]('in',_0x657e('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x657e('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x657e('0x6')]('in',_0x657e('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x45d5=['STRING','ENUM','out','moment','exports','BOOLEAN','DATE'];(function(_0x3d152b,_0x29feec){var _0x28c1ef=function(_0x20bcf5){while(--_0x20bcf5){_0x3d152b['push'](_0x3d152b['shift']());}};_0x28c1ef(++_0x29feec);}(_0x45d5,0x1d1));var _0x545d=function(_0xe907a1,_0x3cb1ca){_0xe907a1=_0xe907a1-0x0;var _0x148391=_0x45d5[_0xe907a1];return _0x148391;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x545d('0x0'));module[_0x545d('0x1')]={'closed':{'type':Sequelize[_0x545d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x545d('0x3')]},'disposition':{'type':Sequelize[_0x545d('0x4')]},'secondDisposition':{'type':Sequelize[_0x545d('0x4')]},'thirdDisposition':{'type':Sequelize[_0x545d('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x545d('0x4')]},'read1stAt':{'type':Sequelize[_0x545d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x545d('0x5')]('in',_0x545d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x545d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x545d('0x5')]('in',_0x545d('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index b593c91..0042d4e 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 _0x66fa=['emit','whatsappInteractionTags:save','removeTags','download','join','root','files','attachments','transcript-%d-%s.zip','User','CmContact','Contact','lastName','Attachment','direction','secret','WhatsappAccount','Owner','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\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','Whatsapp','Account','N.A.','closed','closedAt','disposition','Messages','basename','createReadStream','pipe','createWriteStream','System','firstName','out','renderFile','server','downloadInteraction.html','toFile','transcript-','.pdf','log','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','error','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','then','catch','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','length','conditions','having','`\x20=\x200','`\x20>\x200','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\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)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','SELECT','contactName','DESC','t.id\x20IN\x20?','resolve','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','push','all','show','params','include','merge','create','body','destroy','describe','WhatsappMessage','ids','findOne','WhatsappInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','rows','addTags','omit'];(function(_0x59400c,_0x364897){var _0x51508d=function(_0x1f7682){while(--_0x1f7682){_0x59400c['push'](_0x59400c['shift']());}};_0x51508d(++_0x364897);}(_0x66fa,0x117));var _0xa66f=function(_0xaf4d23,_0x2e5770){_0xaf4d23=_0xaf4d23-0x0;var _0x27a9b4=_0x66fa[_0xaf4d23];return _0x27a9b4;};'use strict';var pdf=require(_0xa66f('0x0'));var emlformat=require(_0xa66f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa66f('0x2'));var jsonpatch=require(_0xa66f('0x3'));var rp=require(_0xa66f('0x4'));var moment=require(_0xa66f('0x5'));var BPromise=require(_0xa66f('0x6'));var Mustache=require(_0xa66f('0x7'));var util=require(_0xa66f('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xa66f('0x9'));var ejs=require(_0xa66f('0xa'));var fs=require('fs');var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa66f('0x14'));var db=require('../../mysqldb')['db'];config[_0xa66f('0x15')]=_[_0xa66f('0x16')](config[_0xa66f('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa66f('0x15')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x5a7b16,_0x3ac0ac){_0x3ac0ac=_0x3ac0ac||0xcc;return function(_0x452c37){if(_0x452c37){return _0x5a7b16[_0xa66f('0x17')](_0x3ac0ac);}return _0x5a7b16[_0xa66f('0x18')](_0x3ac0ac)[_0xa66f('0x19')]();};}function respondWithResult(_0x567d4f,_0x5510dc){_0x5510dc=_0x5510dc||0xc8;return function(_0x19b5ac){if(_0x19b5ac){return _0x567d4f[_0xa66f('0x18')](_0x5510dc)[_0xa66f('0x1a')](_0x19b5ac);}};}function respondWithFilteredResult(_0x403f4d,_0x5c67f5){return function(_0x1cbe64){if(_0x1cbe64){var _0x55b59d=_0x1cbe64[_0xa66f('0x1b')],_0x4a28d4=_0x5c67f5[_0xa66f('0x1c')],_0x2f9da2=_0x5c67f5[_0xa66f('0x1c')]+_0x5c67f5[_0xa66f('0x1d')],_0x413e80;if(_0x2f9da2>=_0x55b59d){_0x2f9da2=_0x55b59d;_0x413e80=0xc8;}else{_0x413e80=0xce;}_0x403f4d[_0xa66f('0x18')](_0x413e80);return _0x403f4d[_0xa66f('0x1e')](_0xa66f('0x1f'),_0x4a28d4+'-'+_0x2f9da2+'/'+_0x55b59d)[_0xa66f('0x1a')](_0x1cbe64);}return null;};}function patchUpdates(_0x235b61){return function(_0xbba376){try{jsonpatch[_0xa66f('0x20')](_0xbba376,_0x235b61,!![]);}catch(_0x2e75ab){return BPromise[_0xa66f('0x21')](_0x2e75ab);}return _0xbba376['save']();};}function saveUpdates(_0x27f570,_0xc5c82e){return function(_0x40ee00){if(_0x40ee00){return _0x40ee00[_0xa66f('0x22')](_0x27f570)['then'](function(_0x337602){return _0x337602;});}return null;};}function removeEntity(_0x473822,_0x209f4d){return function(_0x16f1fa){if(_0x16f1fa){return _0x16f1fa['destroy']()['then'](function(){_0x473822[_0xa66f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a3e4f,_0xc661f2){return function(_0x384164){if(!_0x384164){_0x3a3e4f['sendStatus'](0x194);}return _0x384164;};}function handleError(_0x4683c7,_0x1c2903){_0x1c2903=_0x1c2903||0x1f4;return function(_0x13495f){logger[_0xa66f('0x23')](_0x13495f[_0xa66f('0x24')]);if(_0x13495f[_0xa66f('0x25')]){delete _0x13495f[_0xa66f('0x25')];}_0x4683c7[_0xa66f('0x18')](_0x1c2903)[_0xa66f('0x26')](_0x13495f);};}function getInteractionUsers(_0x117d03,_0x45f71c){return new BPromise(function(_0x63650b,_0x42b966){try{if(_0x45f71c[_0x117d03['id']]){_0x117d03[_0xa66f('0x27')]=_['map'](_0x45f71c[_0x117d03['id']],function(_0x4c0695){return{'id':_0x4c0695['id'],'fullname':_0x4c0695[_0xa66f('0x28')]};});}}catch(_0x27ceae){_0x42b966(_0x27ceae);}_0x63650b(_0x117d03);});}function getInteractionTags(_0x55f309,_0x44c79a){return new BPromise(function(_0x2de5f3,_0x4cd7f2){try{if(_0x55f309[_0xa66f('0x29')]){_0x55f309[_0xa66f('0x2a')]=[];_0x55f309[_0xa66f('0x29')][_0xa66f('0x2b')](',')[_0xa66f('0x2c')](function(_0x548add){_0x55f309[_0xa66f('0x2a')]['push'](_0x44c79a[_0x548add]);});}delete _0x55f309[_0xa66f('0x29')];}catch(_0x35a0a7){_0x4cd7f2(_0x35a0a7);}_0x2de5f3(_0x55f309);});}function updateWhatsappInteraction(_0x2e4dc8,_0x486e4e,_0x2b1a90){return new BPromise(function(_0xadc17d,_0x4f1668){return getInteractionUsers(_0x2e4dc8,_0x2b1a90)[_0xa66f('0x2d')](function(_0x35a847){return getInteractionTags(_0x35a847,_0x486e4e);})[_0xa66f('0x2d')](function(_0x3e7ac5){_0xadc17d(_0x3e7ac5);})[_0xa66f('0x2e')](function(_0x2452d2){_0x4f1668(_0x2452d2);});});}exports[_0xa66f('0x2f')]=function(_0x41303c,_0x35ef27){var _0xad7968={},_0x5b5043={},_0x17984d={'count':0x0,'rows':[]};var _0x5bf736=_[_0xa66f('0x30')](db[_0xa66f('0x31')][_0xa66f('0x32')],function(_0x3b9261){return{'name':_0x3b9261[_0xa66f('0x33')],'type':_0x3b9261[_0xa66f('0x34')][_0xa66f('0x35')]};});_0x5b5043[_0xa66f('0x36')]=_['map'](_0x5bf736,_0xa66f('0x25'));_0x5b5043['query']=_[_0xa66f('0x37')](_0x41303c[_0xa66f('0x38')]);_0x5b5043[_0xa66f('0x39')]=_['intersection'](_0x5b5043['model'],_0x5b5043[_0xa66f('0x38')]);_0xad7968[_0xa66f('0x3a')]=_[_0xa66f('0x3b')](_0x5b5043[_0xa66f('0x36')],qs[_0xa66f('0x3c')](_0x41303c['query']['fields']));_0xad7968['attributes']=_0xad7968[_0xa66f('0x3a')]['length']?_0xad7968['attributes']:_0x5b5043['model'];if(!_0x41303c[_0xa66f('0x38')]['hasOwnProperty'](_0xa66f('0x3d'))){_0xad7968[_0xa66f('0x1d')]=qs[_0xa66f('0x1d')](_0x41303c[_0xa66f('0x38')][_0xa66f('0x1d')]);_0xad7968[_0xa66f('0x1c')]=qs[_0xa66f('0x1c')](_0x41303c[_0xa66f('0x38')][_0xa66f('0x1c')]);}_0xad7968[_0xa66f('0x3e')]=qs[_0xa66f('0x3f')](_0x41303c[_0xa66f('0x38')][_0xa66f('0x3f')]);_0xad7968[_0xa66f('0x40')]=qs['filters'](_[_0xa66f('0x41')](_0x41303c[_0xa66f('0x38')],_0x5b5043['filters']),_0x5bf736);var _0x248587=[];var _0x4b6e6b=squel[_0xa66f('0x42')]()[_0xa66f('0x43')]('id')['field'](_0xa66f('0x25'))[_0xa66f('0x43')](_0xa66f('0x44'))['from'](_0xa66f('0x45'));var _0x5cdfe2=squel[_0xa66f('0x42')]()[_0xa66f('0x43')](_0xa66f('0x46'))[_0xa66f('0x43')](_0xa66f('0x47'))[_0xa66f('0x43')](_0xa66f('0x48'))['from'](_0xa66f('0x49'),'ui')[_0xa66f('0x4a')](_0xa66f('0x4b'),'u',_0xa66f('0x4c'));var _0x374e53=squel['select']()['from'](_0xa66f('0x4d'),'i')[_0xa66f('0x4a')](_0xa66f('0x4e'),'c',_0xa66f('0x4f'))[_0xa66f('0x4a')](_0xa66f('0x4b'),'o','o.id\x20=\x20i.UserId')[_0xa66f('0x4a')](_0xa66f('0x50'),'a',_0xa66f('0x51'))['left_join']('whatsapp_messages','me',_0xa66f('0x52'))[_0xa66f('0x4a')](_0xa66f('0x53'),'it','it.WhatsappInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0xa66f('0x54'));var _0x35e477=squel[_0xa66f('0x55')]();var _0x1f0e58=[];var _0x40611f=squel[_0xa66f('0x55')]();var _0x164242;if(_0x41303c[_0xa66f('0x38')]['search']){_0x164242=as[_0xa66f('0x56')](_0x41303c[_0xa66f('0x38')][_0xa66f('0x57')]);var _0x393755=_0x164242[_0xa66f('0x58')];for(var _0x33cdc7=0x0;_0x33cdc7<_0x164242['conditions'][_0xa66f('0x59')];_0x33cdc7++){var _0xf6984b=_0x164242[_0xa66f('0x5a')][_0x33cdc7];var _0x13848d='i';var _0x20d6be=_['find'](_0x5bf736,[_0xa66f('0x25'),_0xf6984b['field']]);if(!_0x20d6be){switch(_0xf6984b[_0xa66f('0x43')]){case'unreadMessages':if(_0xf6984b['value']==0x1){_0x374e53[_0xa66f('0x5b')]('`'+_0xf6984b[_0xa66f('0x43')]+_0xa66f('0x5c'));}else{_0x374e53[_0xa66f('0x5b')]('`'+_0xf6984b[_0xa66f('0x43')]+_0xa66f('0x5d'));}break;case'Contact':if(_0xf6984b[_0xa66f('0x5e')]===_0xa66f('0x5f')){if(_0xf6984b[_0xa66f('0x60')][_0xa66f('0x2b')]('\x20')['length']>0x1){_0x35e477[_0x393755](_0xa66f('0x61'),qs['getFullTextValue'](_0xf6984b[_0xa66f('0x60')]),null);}else{var _0x10fc75='%'+_0xf6984b[_0xa66f('0x60')]+'%';_0x35e477[_0x393755](_0xa66f('0x62'),_0x10fc75,_0x10fc75,_0x10fc75);}}else{_0x20d6be=_[_0xa66f('0x63')](_0x5bf736,[_0xa66f('0x25'),_0xa66f('0x64')]);_0xf6984b['field']=_0xa66f('0x64');_0x11a6de=as[_0xa66f('0x65')](_0x13848d,_0x20d6be[_0xa66f('0x34')],_0xf6984b);_0x35e477[_0x393755](_0x11a6de[_0xa66f('0x66')],_0x11a6de[_0xa66f('0x60')][_0xa66f('0x67')],_0x11a6de[_0xa66f('0x60')][_0xa66f('0x19')]);}break;case _0xa66f('0x68'):var _0x4dfede=_0xf6984b['value'][_0xa66f('0x2b')](',')[_0xa66f('0x30')](function(_0x31ffea){return Number(_0x31ffea);});_0x4dfede[_0xa66f('0x2c')](function(_0x2f1f1e){_0x40611f['or'](_0xa66f('0x69'),'%,'+_0x2f1f1e+',%');});_0x1f0e58=_[_0xa66f('0x6a')](_0x1f0e58,_0x4dfede);break;case'User':if(_0xf6984b[_0xa66f('0x5e')]===_0xa66f('0x5f')){_0x35e477[_0x393755](_0xa66f('0x6b'),'%'+_0xf6984b[_0xa66f('0x60')]+'%',null);}else{_0x20d6be=_['find'](_0x5bf736,[_0xa66f('0x25'),_0xa66f('0x6c')]);_0xf6984b[_0xa66f('0x43')]=_0xa66f('0x6c');_0x11a6de=as[_0xa66f('0x65')](_0x13848d,_0x20d6be[_0xa66f('0x34')],_0xf6984b);_0x35e477[_0x393755](_0x11a6de['text'],_0x11a6de['value'][_0xa66f('0x67')],_0x11a6de[_0xa66f('0x60')][_0xa66f('0x19')]);}break;case'body':_0x11a6de=as[_0xa66f('0x65')]('me',null,_0xf6984b);_0x35e477[_0x393755](_0x11a6de[_0xa66f('0x66')],_0x11a6de[_0xa66f('0x60')][_0xa66f('0x67')],_0x11a6de[_0xa66f('0x60')][_0xa66f('0x19')]);break;}}else{var _0x11a6de=as[_0xa66f('0x65')](_0x13848d,_0x20d6be[_0xa66f('0x34')],_0xf6984b);_0x35e477[_0x393755](_0x11a6de['text'],_0x11a6de[_0xa66f('0x60')][_0xa66f('0x67')],_0x11a6de[_0xa66f('0x60')][_0xa66f('0x19')]);}}}else{var _0x4565f5=_(_0x41303c[_0xa66f('0x38')])[_0xa66f('0x37')]()[_0xa66f('0x30')](function(_0x588060){return _['some'](_0x5bf736,[_0xa66f('0x25'),_0x588060])?_0x588060:undefined;})[_0xa66f('0x6d')]()[_0xa66f('0x60')]();if(!_[_0xa66f('0x6e')](_0x4565f5)){_0x4565f5[_0xa66f('0x2c')](function(_0x508e73){if(_0x508e73===_0xa66f('0x6f')){_0x374e53['where'](_0xa66f('0x70'),[][_0xa66f('0x71')](_0x41303c[_0xa66f('0x38')][_0x508e73]));}else if(_0x508e73===_0xa66f('0x72')){var _0x556fbe=JSON[_0xa66f('0x73')](_0x41303c[_0xa66f('0x38')][_0x508e73])[_0xa66f('0x74')];var _0x46ea11=JSON[_0xa66f('0x73')](_0x41303c[_0xa66f('0x38')][_0x508e73])[_0xa66f('0x75')];_0x374e53[_0xa66f('0x40')](_0xa66f('0x76'),_0x556fbe,_0x46ea11);}else{if(_0x41303c[_0xa66f('0x38')][_0x508e73]===_0xa66f('0x77')){_0x374e53[_0xa66f('0x40')]('i.'+_0x508e73+'\x20IS\x20NULL');}else{_0x374e53[_0xa66f('0x40')]('i.'+_0x508e73+_0xa66f('0x78'),_0x41303c[_0xa66f('0x38')][_0x508e73]);}}});}if(_0x41303c[_0xa66f('0x38')][_0xa66f('0x79')]){if(_0x41303c[_0xa66f('0x38')][_0xa66f('0x79')]==0x1){_0x374e53[_0xa66f('0x5b')]('`unreadMessages`\x20=\x200');}else{_0x374e53[_0xa66f('0x5b')](_0xa66f('0x7a'));}}if(_0x41303c[_0xa66f('0x38')][_0xa66f('0x7b')]){_0x1f0e58=_[_0xa66f('0x7c')](_0x41303c[_0xa66f('0x38')][_0xa66f('0x7b')])?_0x41303c[_0xa66f('0x38')]['tag']:new Array(_0x41303c['query'][_0xa66f('0x7b')]);_0x1f0e58[_0xa66f('0x2c')](function(_0x34a590){_0x40611f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x34a590+',%');});}if(_0x41303c['query'][_0xa66f('0x7d')]){var _0x421290=_0x41303c[_0xa66f('0x38')][_0xa66f('0x7d')]['replace']('\x5c','\x5c\x5c')[_0xa66f('0x7e')](/'/g,'\x27\x27');if(qs[_0xa66f('0x7f')](_0x421290)){_0x35e477['or'](_0xa66f('0x80'),_0x421290+'%')['or'](_0xa66f('0x81'),_0x421290+'%');}else{_0x35e477['or'](_0xa66f('0x82'),qs[_0xa66f('0x83')](_0x421290))['or'](_0xa66f('0x84'),_0x421290+'%');}}}_0x374e53[_0xa66f('0x40')](_0x35e477);_0x374e53['group'](_0xa66f('0x85'));var _0xbf4084={'type':db['Sequelize']['QueryTypes'][_0xa66f('0x86')],'raw':!![]};var _0x1d64a8=_0x374e53['clone']();_0x1d64a8[_0xa66f('0x43')]('i.id');_0x1d64a8[_0xa66f('0x43')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0xad7968['order']){_0xad7968[_0xa66f('0x3e')][_0xa66f('0x2c')](function(_0x1f05bb){var _0x1409ca=_0x1f05bb[0x0]===_0xa66f('0x87')?_0x1f05bb[0x0]:'i.'+_0x1f05bb[0x0];_0x374e53[_0xa66f('0x3e')](_0x1409ca,_0x1f05bb[0x1]===_0xa66f('0x88')?![]:!![]);});}if(!_[_0xa66f('0x6e')](_0x1f0e58)){_0x374e53[_0xa66f('0x5b')](_0x40611f);_0x1d64a8[_0xa66f('0x40')](_0xa66f('0x89'),_0x1f0e58);}BPromise[_0xa66f('0x8a')]()[_0xa66f('0x2d')](function(){if(!_0x164242){if(_0x41303c[_0xa66f('0x38')][_0xa66f('0x6f')])return;_0x1d64a8[_0xa66f('0x40')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x374e53[_0xa66f('0x40')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x41303c[_0xa66f('0x8b')]['role']!==_0xa66f('0x8c'))return;return _0x41303c[_0xa66f('0x8b')][_0xa66f('0x8d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4ea501){if(_[_0xa66f('0x6e')](_0x4ea501)){_0x1d64a8[_0xa66f('0x40')](_0xa66f('0x8e'));_0x374e53[_0xa66f('0x40')](_0xa66f('0x8e'));}else{_0x1d64a8[_0xa66f('0x40')](_0xa66f('0x70'),_['map'](_0x4ea501,'id'));_0x374e53[_0xa66f('0x40')](_0xa66f('0x70'),_[_0xa66f('0x30')](_0x4ea501,'id'));}});})[_0xa66f('0x2d')](function(){if(_0x41303c[_0xa66f('0x8b')][_0xa66f('0x8f')]===_0xa66f('0x8c')&&!_0x164242&&!_0x41303c[_0xa66f('0x38')][_0xa66f('0x6f')])return[];return db[_0xa66f('0x90')][_0xa66f('0x38')](_0x1d64a8[_0xa66f('0x91')](),_0xbf4084);})[_0xa66f('0x2d')](function(_0x53f0fd){_0x17984d[_0xa66f('0x1b')]=_0x53f0fd[_0xa66f('0x59')];if(_0x17984d[_0xa66f('0x1b')]===0x0)return[];return db[_0xa66f('0x90')][_0xa66f('0x38')](_0x4b6e6b[_0xa66f('0x91')](),_0xbf4084)[_0xa66f('0x2d')](function(_0xffd447){_0x248587=_[_0xa66f('0x92')](_0xffd447,'id');_0xbf4084=_['merge'](_0xbf4084,{'model':db[_0xa66f('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x41303c['query'][_0xa66f('0x3c')]){_0xad7968['attributes'][_0xa66f('0x2c')](function(_0x5dbe8a){_0x374e53[_0xa66f('0x43')]('i.'+_0x5dbe8a);});}else{_0x374e53['field'](_0xa66f('0x93'),_0xa66f('0x94'));_0x374e53[_0xa66f('0x43')](_0xa66f('0x95'),_0xa66f('0x96'));_0x374e53[_0xa66f('0x43')]('a.mandatoryDisposition',_0xa66f('0x97'));_0x374e53[_0xa66f('0x43')](_0xa66f('0x98'),'contactName');_0x374e53[_0xa66f('0x43')](_0xa66f('0x99'));_0x374e53['field'](_0xa66f('0x9a'),_0xa66f('0x9b'));_0x374e53['field']('c.lastName',_0xa66f('0x9c'));_0x374e53[_0xa66f('0x43')](_0xa66f('0x9d'),_0xa66f('0x9e'));_0x374e53[_0xa66f('0x43')]('c.phone',_0xa66f('0x9f'));_0x374e53[_0xa66f('0x43')]('c.mobile',_0xa66f('0xa0'));_0x374e53[_0xa66f('0x43')]('c.fax',_0xa66f('0xa1'));_0x374e53[_0xa66f('0x43')](_0xa66f('0xa2'),_0xa66f('0xa3'));_0x374e53[_0xa66f('0x43')]('o.internal',_0xa66f('0xa4'));_0x374e53[_0xa66f('0x43')](_0xa66f('0xa5'),_0xa66f('0x29'));}if(_0xad7968[_0xa66f('0x1d')])_0x374e53[_0xa66f('0x1d')](_0xad7968['limit']);if(_0xad7968[_0xa66f('0x1c')])_0x374e53[_0xa66f('0x1c')](_0xad7968[_0xa66f('0x1c')]);return db[_0xa66f('0x90')][_0xa66f('0x38')](_0x374e53[_0xa66f('0x91')](),_0xbf4084);})[_0xa66f('0x2d')](function(_0x4b4c02){_0x5cdfe2['where'](_0xa66f('0xa6'),_['map'](_0x4b4c02,'id'));return db[_0xa66f('0x90')][_0xa66f('0x38')](_0x5cdfe2['toString'](),_0xbf4084)[_0xa66f('0x2d')](function(_0x3bd880){var _0x3f84f9=_['groupBy'](_0x3bd880,'WhatsappInteractionId');var _0xfe65cc=[];_0x4b4c02['forEach'](function(_0x16e897){_0xfe65cc[_0xa66f('0xa7')](updateWhatsappInteraction(_0x16e897,_0x248587,_0x3f84f9));});return BPromise[_0xa66f('0xa8')](_0xfe65cc);});});})['then'](function(_0x283ca2){_0x17984d['rows']=_0x283ca2;return _0x17984d;})[_0xa66f('0x2d')](respondWithFilteredResult(_0x35ef27,_0xad7968))[_0xa66f('0x2e')](handleError(_0x35ef27,null));};exports[_0xa66f('0xa9')]=function(_0x29bb9c,_0x5a1838){var _0x20a5bc={'raw':![],'where':{'id':_0x29bb9c[_0xa66f('0xaa')]['id']}},_0x3ac90f={};_0x3ac90f[_0xa66f('0x36')]=_[_0xa66f('0x37')](db[_0xa66f('0x31')]['rawAttributes']);_0x3ac90f[_0xa66f('0x38')]=_[_0xa66f('0x37')](_0x29bb9c[_0xa66f('0x38')]);_0x3ac90f[_0xa66f('0x39')]=_[_0xa66f('0x3b')](_0x3ac90f['model'],_0x3ac90f['query']);_0x20a5bc[_0xa66f('0x3a')]=_[_0xa66f('0x3b')](_0x3ac90f[_0xa66f('0x36')],qs[_0xa66f('0x3c')](_0x29bb9c[_0xa66f('0x38')][_0xa66f('0x3c')]));_0x20a5bc[_0xa66f('0x3a')]=_0x20a5bc[_0xa66f('0x3a')][_0xa66f('0x59')]?_0x20a5bc[_0xa66f('0x3a')]:_0x3ac90f[_0xa66f('0x36')];if(_0x29bb9c[_0xa66f('0x38')]['includeAll']){_0x20a5bc[_0xa66f('0xab')]=[{'all':!![]}];}_0x20a5bc=_[_0xa66f('0xac')]({},_0x20a5bc,_0x29bb9c['options']);return db[_0xa66f('0x31')][_0xa66f('0x63')](_0x20a5bc)[_0xa66f('0x2d')](handleEntityNotFound(_0x5a1838,null))['then'](respondWithResult(_0x5a1838,null))['catch'](handleError(_0x5a1838,null));};exports[_0xa66f('0xad')]=function(_0x5f4e48,_0x3520e1){return db[_0xa66f('0x31')]['create'](_0x5f4e48[_0xa66f('0xae')],{})[_0xa66f('0x2d')](respondWithResult(_0x3520e1,0xc9))['catch'](handleError(_0x3520e1,null));};exports[_0xa66f('0x22')]=function(_0xfde3e,_0x2419c5){if(_0xfde3e[_0xa66f('0xae')]['id']){delete _0xfde3e['body']['id'];}return db['WhatsappInteraction'][_0xa66f('0x63')]({'where':{'id':_0xfde3e[_0xa66f('0xaa')]['id']}})[_0xa66f('0x2d')](handleEntityNotFound(_0x2419c5,null))[_0xa66f('0x2d')](saveUpdates(_0xfde3e[_0xa66f('0xae')],null))[_0xa66f('0x2d')](respondWithResult(_0x2419c5,null))[_0xa66f('0x2e')](handleError(_0x2419c5,null));};exports[_0xa66f('0xaf')]=function(_0x51f11a,_0x149e11){return db['WhatsappInteraction']['find']({'where':{'id':_0x51f11a[_0xa66f('0xaa')]['id']}})[_0xa66f('0x2d')](handleEntityNotFound(_0x149e11,null))[_0xa66f('0x2d')](removeEntity(_0x149e11,null))[_0xa66f('0x2e')](handleError(_0x149e11,null));};exports[_0xa66f('0xb0')]=function(_0x59d4a5,_0x15c4c9){return db[_0xa66f('0x31')][_0xa66f('0xb0')]()['then'](respondWithResult(_0x15c4c9,null))['catch'](handleError(_0x15c4c9,null));};exports['addMessage']=function(_0x22443e,_0x5d9a55,_0x3eba09){return db[_0xa66f('0xb1')][_0xa66f('0x63')]({'where':{'id':_0x22443e[_0xa66f('0xaa')]['id']}})['then'](handleEntityNotFound(_0x5d9a55,null))[_0xa66f('0x2d')](function(_0x25b0f8){if(_0x25b0f8){return _0x25b0f8['addMessage'](_0x22443e[_0xa66f('0xae')][_0xa66f('0xb2')],_['omit'](_0x22443e['body'],[_0xa66f('0xb2'),'id'])||{});}})[_0xa66f('0x2d')](respondWithResult(_0x5d9a55,null))[_0xa66f('0x2e')](handleError(_0x5d9a55,null));};exports['getMessages']=function(_0x568c6c,_0x4c139a,_0x5d4202){var _0xb6b51b={'raw':![],'where':{}};var _0x11a0c4={};var _0x290e78={'count':0x0,'rows':[]};return db[_0xa66f('0x31')][_0xa66f('0xb3')]({'where':{'id':_0x568c6c[_0xa66f('0xaa')]['id']}})['then'](handleEntityNotFound(_0x4c139a,null))[_0xa66f('0x2d')](function(_0x41e8ee){if(_0x41e8ee){_0x11a0c4[_0xa66f('0x36')]=_[_0xa66f('0x37')](db['WhatsappMessage']['rawAttributes']);_0x11a0c4[_0xa66f('0x38')]=_[_0xa66f('0x37')](_0x568c6c[_0xa66f('0x38')]);_0x11a0c4[_0xa66f('0x39')]=_[_0xa66f('0x3b')](_0x11a0c4[_0xa66f('0x36')],_0x11a0c4[_0xa66f('0x38')]);_0xb6b51b[_0xa66f('0x3a')]=_[_0xa66f('0x3b')](_0x11a0c4[_0xa66f('0x36')],qs[_0xa66f('0x3c')](_0x568c6c['query'][_0xa66f('0x3c')]));_0xb6b51b['attributes']=_0xb6b51b[_0xa66f('0x3a')][_0xa66f('0x59')]?_0xb6b51b[_0xa66f('0x3a')]:_0x11a0c4[_0xa66f('0x36')];if(!_0x568c6c[_0xa66f('0x38')]['hasOwnProperty']('nolimit')){_0xb6b51b['limit']=qs['limit'](_0x568c6c[_0xa66f('0x38')][_0xa66f('0x1d')]);_0xb6b51b[_0xa66f('0x1c')]=qs[_0xa66f('0x1c')](_0x568c6c['query'][_0xa66f('0x1c')]);}_0xb6b51b[_0xa66f('0x3e')]=qs['sort'](_0x568c6c[_0xa66f('0x38')][_0xa66f('0x3f')]);_0xb6b51b['where']=qs[_0xa66f('0x39')](_[_0xa66f('0x41')](_0x568c6c['query'],_0x11a0c4[_0xa66f('0x39')]));_0xb6b51b[_0xa66f('0x40')][_0xa66f('0xb4')]=_0x41e8ee['id'];if(_0x568c6c[_0xa66f('0x38')][_0xa66f('0x7d')]){_0xb6b51b[_0xa66f('0x40')]=_[_0xa66f('0xac')](_0xb6b51b[_0xa66f('0x40')],{'$or':_[_0xa66f('0x30')](_0xb6b51b[_0xa66f('0x3a')],function(_0x34fb25){var _0x4a29d7={};_0x4a29d7[_0x34fb25]={'$like':'%'+_0x568c6c['query'][_0xa66f('0x7d')]+'%'};return _0x4a29d7;})});}if(_0x568c6c[_0xa66f('0x38')][_0xa66f('0x74')]){var _0x4e211b=_0x568c6c['query'][_0xa66f('0x74')][_0xa66f('0x2b')](',');var _0x9617dc={};_0x9617dc[_0x4e211b[0x0]]={'$gte':moment(_0x4e211b[0x1])[_0xa66f('0xb5')](_0xa66f('0xb6'))};_0xb6b51b['where']=_[_0xa66f('0xac')](_0xb6b51b[_0xa66f('0x40')],_0x9617dc);}_0xb6b51b=_[_0xa66f('0xac')]({},_0xb6b51b,_0x568c6c[_0xa66f('0xb7')]);return db['WhatsappMessage'][_0xa66f('0x1b')]({'where':_0xb6b51b[_0xa66f('0x40')]})['then'](function(_0xb3457b){_0x290e78[_0xa66f('0x1b')]=_0xb3457b;if(_0x568c6c['query'][_0xa66f('0xb8')]){_0xb6b51b[_0xa66f('0xab')]=[{'all':!![]}];}return db[_0xa66f('0xb1')][_0xa66f('0xb9')](_0xb6b51b);})[_0xa66f('0x2d')](function(_0x3c73cc){_0x290e78[_0xa66f('0xba')]=_0x3c73cc;return _0x290e78;});}})['then'](respondWithFilteredResult(_0x4c139a,_0xb6b51b))['catch'](handleError(_0x4c139a,null));};exports[_0xa66f('0xbb')]=function(_0x32c472,_0x2e7c26,_0x3eea20){return db[_0xa66f('0x31')]['find']({'where':{'id':_0x32c472[_0xa66f('0xaa')]['id']}})[_0xa66f('0x2d')](handleEntityNotFound(_0x2e7c26,null))['then'](function(_0x1739dd){if(_0x1739dd){return _0x1739dd['setTags'](_0x32c472[_0xa66f('0xae')][_0xa66f('0xb2')],_[_0xa66f('0xbc')](_0x32c472[_0xa66f('0xae')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0xa66f('0xb9')]({'attributes':['id','name',_0xa66f('0x44')],'where':{'id':_0x32c472['body'][_0xa66f('0xb2')]}});})[_0xa66f('0x2d')](function(_0x5628b4){socket[_0xa66f('0xbd')](_0xa66f('0xbe'),{'id':Number(_0x32c472[_0xa66f('0xaa')]['id']),'tags':_0x5628b4||[]});return{'id':Number(_0x32c472[_0xa66f('0xaa')]['id']),'tags':_0x5628b4||[]};});}})[_0xa66f('0x2d')](respondWithResult(_0x2e7c26,null))[_0xa66f('0x2e')](handleError(_0x2e7c26,null));};exports[_0xa66f('0xbf')]=function(_0x4e6a80,_0x28070d,_0x160a2b){return db[_0xa66f('0x31')][_0xa66f('0x63')]({'where':{'id':_0x4e6a80[_0xa66f('0xaa')]['id']}})[_0xa66f('0x2d')](handleEntityNotFound(_0x28070d,null))[_0xa66f('0x2d')](function(_0x3a2c2c){if(_0x3a2c2c){return _0x3a2c2c[_0xa66f('0xbf')](_0x4e6a80['query'][_0xa66f('0xb2')]);}})['then'](respondWithStatusCode(_0x28070d,null))[_0xa66f('0x2e')](handleError(_0x28070d,null));};exports[_0xa66f('0xc0')]=function(_0xc1ab0e,_0x46147c){var _0x1f4bc4=moment()['unix']()[_0xa66f('0x91')]();var _0x29a1ee=path[_0xa66f('0xc1')](config[_0xa66f('0xc2')],'server','files','tmp');var _0x2c2671=path[_0xa66f('0xc1')](config['root'],'server',_0xa66f('0xc3'),_0xa66f('0xc4'));var _0x4fe740=path[_0xa66f('0xc1')](_0x29a1ee,_0x1f4bc4);var _0x20a52e=util[_0xa66f('0xb5')](_0xa66f('0xc5'),_0xc1ab0e['params']['id'],_0x1f4bc4);var _0x4c2bf9=path['join'](_0x29a1ee,_0x20a52e);var _0x109e8f=[];_0x109e8f[_0xa66f('0xa7')]({'model':db[_0xa66f('0xc6')],'as':_0xa66f('0xc6'),'attributes':['id',_0xa66f('0x28')],'raw':!![]});_0x109e8f[_0xa66f('0xa7')]({'model':db[_0xa66f('0xc7')],'as':_0xa66f('0xc8'),'attributes':['id','firstName',_0xa66f('0xc9')],'raw':!![]});if(_0xc1ab0e[_0xa66f('0x38')][_0xa66f('0xc4')]){_0x109e8f['push']({'model':db[_0xa66f('0xca')],'as':_0xa66f('0xca'),'raw':!![]});}var _0x186740=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0xa66f('0xae'),_0xa66f('0x72'),_0xa66f('0xcb'),_0xa66f('0xcc'),_0xa66f('0x79')],'include':_0x109e8f}];_0x186740[_0xa66f('0xa7')]({'model':db[_0xa66f('0xcd')],'as':'Account','attributes':['id',_0xa66f('0x25')]});_0x186740['push']({'model':db[_0xa66f('0xc6')],'as':_0xa66f('0xce'),'attributes':['id',_0xa66f('0x28')]});return db[_0xa66f('0x31')][_0xa66f('0x63')]({'where':{'id':_0xc1ab0e[_0xa66f('0xaa')]['id']},'include':_0x186740})[_0xa66f('0x2d')](handleEntityNotFound(_0x46147c,null))[_0xa66f('0x2d')](function(_0x1deff4){if(_0x1deff4){var _0xb9e891=_0x1deff4[_0xa66f('0xcf')]({'plain':!![]});fs[_0xa66f('0xd0')](_0x4fe740);var _0x5b4be5={'format':'A4','border':'10px','header':{'height':_0xa66f('0xd1'),'contents':{'first':_0xa66f('0xd2')}},'footer':{'height':_0xa66f('0xd3'),'contents':{'default':util[_0xa66f('0xb5')](_0xa66f('0xd4'),util[_0xa66f('0xb5')]('%s\x20#%d',_0xa66f('0xd5'),_0xb9e891['id']),moment()['format']('YYYY-MM-DD')[_0xa66f('0x91')]())}}};var _0x1ce936={'channel':_0xa66f('0xd5'),'account':_0xb9e891[_0xa66f('0xd6')]['name'],'agent':_0xb9e891[_0xa66f('0xce')]?_0xb9e891[_0xa66f('0xce')][_0xa66f('0x28')]:_0xa66f('0xd7'),'createdAt':moment(_0xb9e891[_0xa66f('0x72')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xa66f('0x91')](),'closedAt':_0xb9e891[_0xa66f('0xd8')]?moment(_0xb9e891[_0xa66f('0xd9')])[_0xa66f('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa66f('0x91')]():'','disposition':_0xb9e891[_0xa66f('0xda')],'messages':_(_0xb9e891[_0xa66f('0xdb')])[_0xa66f('0x7d')]({'secret':![]})[_0xa66f('0x30')](function(_0x21e3ae){if(_0x21e3ae[_0xa66f('0xca')]){var _0x131e6f=path['join'](_0x2c2671,_0x21e3ae[_0xa66f('0xca')][_0xa66f('0xdc')]);if(fs['existsSync'](_0x131e6f)){fs[_0xa66f('0xdd')](_0x131e6f)[_0xa66f('0xde')](fs[_0xa66f('0xdf')](path[_0xa66f('0xc1')](_0x4fe740,_0x21e3ae[_0xa66f('0xca')]['basename'])));}}return{'date':moment(_0x21e3ae[_0xa66f('0x72')])[_0xa66f('0xb5')](_0xa66f('0xb6'))[_0xa66f('0x91')](),'sender':_0x21e3ae[_0xa66f('0xcb')]==='out'?_0x21e3ae[_0xa66f('0xc6')]?_0x21e3ae[_0xa66f('0xc6')]['fullname']:_0xa66f('0xe0'):_0x21e3ae[_0xa66f('0xc8')][_0xa66f('0xe1')]+(_0x21e3ae[_0xa66f('0xc8')][_0xa66f('0xc9')]?'\x20'+_0x21e3ae['Contact'][_0xa66f('0xc9')]:''),'body':_0x21e3ae[_0xa66f('0xca')]?_0x21e3ae[_0xa66f('0xca')][_0xa66f('0xdc')]:_0x21e3ae['body'],'direction':_0x21e3ae[_0xa66f('0xcb')]===_0xa66f('0xe2')?'A':'C','secret':_0x21e3ae['secret'],'read':_0x21e3ae[_0xa66f('0x79')],'attachment':_0x21e3ae[_0xa66f('0xca')]};})[_0xa66f('0x60')]()};return ejs[_0xa66f('0xe3')](path['join'](config[_0xa66f('0xc2')],_0xa66f('0xe4'),'views',_0xa66f('0xe5')),{'interaction':_0x1ce936})[_0xa66f('0x2d')](function(_0x2cfdf5){return new BPromise(function(_0x49c8f8,_0x2747fa){pdf[_0xa66f('0xad')](_0x2cfdf5,_0x5b4be5)[_0xa66f('0xe6')](path['join'](_0x4fe740,_0xa66f('0xe7')+_0xb9e891['id']+'-'+_0x1f4bc4+_0xa66f('0xe8')),function(_0x4d7929,_0x5de9c7){if(_0x4d7929)return _0x2747fa(_0x4d7929);_0x49c8f8(_0x5de9c7);});});})[_0xa66f('0x2d')](function(){return new BPromise(function(_0x2299af,_0x5be1d2){zipdir(_0x4fe740,{'saveTo':_0x4c2bf9},function(_0x3e72d6,_0x125edd){if(_0x3e72d6)return _0x5be1d2(_0x3e72d6);return _0x2299af(_0x125edd);});})[_0xa66f('0x2d')](function(){return new BPromise(function(_0x22ef12,_0x2aa5f8){rimraf(_0x4fe740,function(_0x57dbd2){if(_0x57dbd2)_0x2aa5f8(_0x57dbd2);return _0x22ef12();});});})[_0xa66f('0x2d')](function(){return _0x46147c[_0xa66f('0xc0')](_0x4c2bf9,_0x20a52e,function(_0x5c1ef6){if(_0x5c1ef6){console[_0xa66f('0xe9')]('err',_0x5c1ef6);}else{fs['unlinkSync'](_0x4c2bf9);}});});});}else{return _0x46147c[_0xa66f('0x17')](0xc8);}})[_0xa66f('0x2e')](handleError(_0x46147c,null));}; \ No newline at end of file +var _0x896e=['disposition','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','toFile','transcript-','.pdf','log','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','destroy','end','error','stack','name','send','fullname','TagIds','Tags','forEach','push','catch','index','map','WhatsappInteraction','rawAttributes','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','select','field','color','u.id','u.fullname','from','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','tools_tags','expr','search','parseSearch','sqlOperator','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)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','QueryTypes','SELECT','clone','contactName','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','filters','includeAll','include','create','update','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','addTags','setTags','spread','Tag','whatsappInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','createdAt','secret','read','Account','Owner','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','Whatsapp','YYYY-MM-DD','closed','closedAt'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x896e,0x1e9));var _0xe896=function(_0x3db709,_0x536942){_0x3db709=_0x3db709-0x0;var _0x273538=_0x896e[_0x3db709];return _0x273538;};'use strict';var pdf=require(_0xe896('0x0'));var emlformat=require(_0xe896('0x1'));var rimraf=require(_0xe896('0x2'));var zipdir=require(_0xe896('0x3'));var jsonpatch=require(_0xe896('0x4'));var rp=require(_0xe896('0x5'));var moment=require(_0xe896('0x6'));var BPromise=require(_0xe896('0x7'));var Mustache=require(_0xe896('0x8'));var util=require(_0xe896('0x9'));var path=require(_0xe896('0xa'));var sox=require(_0xe896('0xb'));var csv=require('to-csv');var ejs=require(_0xe896('0xc'));var fs=require('fs');var _=require(_0xe896('0xd'));var squel=require(_0xe896('0xe'));var crypto=require(_0xe896('0xf'));var jsforce=require(_0xe896('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe896('0x11'));var querystring=require(_0xe896('0x12'));var Papa=require(_0xe896('0x13'));var Redis=require('ioredis');var authService=require(_0xe896('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe896('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe896('0x16'))(_0xe896('0x17'));var utils=require(_0xe896('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe896('0x19'));var db=require(_0xe896('0x1a'))['db'];config[_0xe896('0x1b')]=_['defaults'](config[_0xe896('0x1b')],{'host':_0xe896('0x1c'),'port':0x18eb});var socket=require(_0xe896('0x1d'))(new Redis(config['redis']));require(_0xe896('0x1e'))[_0xe896('0x1f')](socket);function respondWithStatusCode(_0x1e7ef8,_0x564758){_0x564758=_0x564758||0xcc;return function(_0x5a7957){if(_0x5a7957){return _0x1e7ef8[_0xe896('0x20')](_0x564758);}return _0x1e7ef8[_0xe896('0x21')](_0x564758)['end']();};}function respondWithResult(_0x5e78d6,_0x11f41c){_0x11f41c=_0x11f41c||0xc8;return function(_0x16e272){if(_0x16e272){return _0x5e78d6['status'](_0x11f41c)[_0xe896('0x22')](_0x16e272);}};}function respondWithFilteredResult(_0x4e062a,_0x41cbd7){return function(_0x32f86d){if(_0x32f86d){var _0x2d4cf0=_0x32f86d[_0xe896('0x23')],_0x5dc89d=_0x41cbd7[_0xe896('0x24')],_0x782813=_0x41cbd7[_0xe896('0x24')]+_0x41cbd7[_0xe896('0x25')],_0x9714f1;if(_0x782813>=_0x2d4cf0){_0x782813=_0x2d4cf0;_0x9714f1=0xc8;}else{_0x9714f1=0xce;}_0x4e062a[_0xe896('0x21')](_0x9714f1);return _0x4e062a[_0xe896('0x26')]('Content-Range',_0x5dc89d+'-'+_0x782813+'/'+_0x2d4cf0)[_0xe896('0x22')](_0x32f86d);}return null;};}function patchUpdates(_0x5e1f29){return function(_0x5d2c8d){try{jsonpatch[_0xe896('0x27')](_0x5d2c8d,_0x5e1f29,!![]);}catch(_0x346463){return BPromise[_0xe896('0x28')](_0x346463);}return _0x5d2c8d[_0xe896('0x29')]();};}function saveUpdates(_0x498469,_0x468479){return function(_0x4ad156){if(_0x4ad156){return _0x4ad156['update'](_0x498469)[_0xe896('0x2a')](function(_0x41e689){return _0x41e689;});}return null;};}function removeEntity(_0x1e952a,_0x2e2c10){return function(_0x20e295){if(_0x20e295){return _0x20e295[_0xe896('0x2b')]()[_0xe896('0x2a')](function(){_0x1e952a['status'](0xcc)[_0xe896('0x2c')]();});}};}function handleEntityNotFound(_0x163a75,_0xc3cd05){return function(_0x569d5f){if(!_0x569d5f){_0x163a75[_0xe896('0x20')](0x194);}return _0x569d5f;};}function handleError(_0xd50fe2,_0x2bc11d){_0x2bc11d=_0x2bc11d||0x1f4;return function(_0xe93aa0){logger[_0xe896('0x2d')](_0xe93aa0[_0xe896('0x2e')]);if(_0xe93aa0['name']){delete _0xe93aa0[_0xe896('0x2f')];}_0xd50fe2[_0xe896('0x21')](_0x2bc11d)[_0xe896('0x30')](_0xe93aa0);};}function getInteractionUsers(_0xbfb15b,_0xace03f){return new BPromise(function(_0x5e0d9b,_0x47c268){try{if(_0xace03f[_0xbfb15b['id']]){_0xbfb15b['Users']=_['map'](_0xace03f[_0xbfb15b['id']],function(_0x562ddd){return{'id':_0x562ddd['id'],'fullname':_0x562ddd[_0xe896('0x31')]};});}}catch(_0x29a18e){_0x47c268(_0x29a18e);}_0x5e0d9b(_0xbfb15b);});}function getInteractionTags(_0x10fd26,_0x76c781){return new BPromise(function(_0x3cd88e,_0x1a6090){try{if(_0x10fd26[_0xe896('0x32')]){_0x10fd26[_0xe896('0x33')]=[];_0x10fd26['TagIds']['split'](',')[_0xe896('0x34')](function(_0x255dd1){_0x10fd26[_0xe896('0x33')][_0xe896('0x35')](_0x76c781[_0x255dd1]);});}delete _0x10fd26['TagIds'];}catch(_0x14ad7a){_0x1a6090(_0x14ad7a);}_0x3cd88e(_0x10fd26);});}function updateWhatsappInteraction(_0x571e4d,_0x57c6e8,_0x166b86){return new BPromise(function(_0x363fd8,_0x266c0e){return getInteractionUsers(_0x571e4d,_0x166b86)['then'](function(_0x4d8092){return getInteractionTags(_0x4d8092,_0x57c6e8);})['then'](function(_0x46c8ae){_0x363fd8(_0x46c8ae);})[_0xe896('0x36')](function(_0x10fa64){_0x266c0e(_0x10fa64);});});}exports[_0xe896('0x37')]=function(_0x36d2d7,_0x486eb5){var _0x19a712={},_0x394257={},_0x39cbe6={'count':0x0,'rows':[]};var _0x28e09c=_[_0xe896('0x38')](db[_0xe896('0x39')][_0xe896('0x3a')],function(_0x3e28f0){return{'name':_0x3e28f0['fieldName'],'type':_0x3e28f0[_0xe896('0x3b')][_0xe896('0x3c')]};});_0x394257['model']=_[_0xe896('0x38')](_0x28e09c,'name');_0x394257[_0xe896('0x3d')]=_['keys'](_0x36d2d7[_0xe896('0x3d')]);_0x394257['filters']=_[_0xe896('0x3e')](_0x394257[_0xe896('0x3f')],_0x394257[_0xe896('0x3d')]);_0x19a712[_0xe896('0x40')]=_[_0xe896('0x3e')](_0x394257['model'],qs['fields'](_0x36d2d7[_0xe896('0x3d')][_0xe896('0x41')]));_0x19a712[_0xe896('0x40')]=_0x19a712[_0xe896('0x40')][_0xe896('0x42')]?_0x19a712['attributes']:_0x394257['model'];if(!_0x36d2d7[_0xe896('0x3d')][_0xe896('0x43')]('nolimit')){_0x19a712['limit']=qs[_0xe896('0x25')](_0x36d2d7[_0xe896('0x3d')][_0xe896('0x25')]);_0x19a712[_0xe896('0x24')]=qs[_0xe896('0x24')](_0x36d2d7[_0xe896('0x3d')][_0xe896('0x24')]);}_0x19a712[_0xe896('0x44')]=qs[_0xe896('0x45')](_0x36d2d7[_0xe896('0x3d')][_0xe896('0x45')]);_0x19a712[_0xe896('0x46')]=qs['filters'](_[_0xe896('0x47')](_0x36d2d7[_0xe896('0x3d')],_0x394257['filters']),_0x28e09c);var _0x57366b=[];var _0x5cd5a3=squel[_0xe896('0x48')]()[_0xe896('0x49')]('id')[_0xe896('0x49')]('name')[_0xe896('0x49')](_0xe896('0x4a'))['from']('tools_tags');var _0x489254=squel[_0xe896('0x48')]()[_0xe896('0x49')](_0xe896('0x4b'))[_0xe896('0x49')](_0xe896('0x4c'))[_0xe896('0x49')]('ui.WhatsappInteractionId')[_0xe896('0x4d')](_0xe896('0x4e'),'ui')['left_join'](_0xe896('0x4f'),'u',_0xe896('0x50'));var _0x179fc2=squel[_0xe896('0x48')]()['from'](_0xe896('0x51'),'i')[_0xe896('0x52')](_0xe896('0x53'),'c',_0xe896('0x54'))[_0xe896('0x52')](_0xe896('0x4f'),'o','o.id\x20=\x20i.UserId')[_0xe896('0x52')]('whatsapp_accounts','a',_0xe896('0x55'))[_0xe896('0x52')](_0xe896('0x56'),'me',_0xe896('0x57'))[_0xe896('0x52')](_0xe896('0x58'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0xe896('0x52')](_0xe896('0x59'),'t','t.id\x20=\x20it.TagId');var _0x3373dc=squel[_0xe896('0x5a')]();var _0x4d0047=[];var _0x3ef032=squel['expr']();var _0x404967;if(_0x36d2d7[_0xe896('0x3d')][_0xe896('0x5b')]){_0x404967=as[_0xe896('0x5c')](_0x36d2d7[_0xe896('0x3d')]['search']);var _0x1fa3fd=_0x404967[_0xe896('0x5d')];for(var _0x379bf2=0x0;_0x379bf2<_0x404967['conditions'][_0xe896('0x42')];_0x379bf2++){var _0x5d205b=_0x404967['conditions'][_0x379bf2];var _0x388375='i';var _0x20fe4f=_['find'](_0x28e09c,[_0xe896('0x2f'),_0x5d205b[_0xe896('0x49')]]);if(!_0x20fe4f){switch(_0x5d205b['field']){case'unreadMessages':if(_0x5d205b[_0xe896('0x5e')]==0x1){_0x179fc2[_0xe896('0x5f')]('`'+_0x5d205b['field']+_0xe896('0x60'));}else{_0x179fc2[_0xe896('0x5f')]('`'+_0x5d205b[_0xe896('0x49')]+_0xe896('0x61'));}break;case _0xe896('0x62'):if(_0x5d205b[_0xe896('0x63')]===_0xe896('0x64')){if(_0x5d205b[_0xe896('0x5e')][_0xe896('0x65')]('\x20')[_0xe896('0x42')]>0x1){_0x3373dc[_0x1fa3fd](_0xe896('0x66'),qs['getFullTextValue'](_0x5d205b[_0xe896('0x5e')]),null);}else{var _0x2a23a2='%'+_0x5d205b[_0xe896('0x5e')]+'%';_0x3373dc[_0x1fa3fd](_0xe896('0x67'),_0x2a23a2,_0x2a23a2,_0x2a23a2);}}else{_0x20fe4f=_[_0xe896('0x68')](_0x28e09c,[_0xe896('0x2f'),_0xe896('0x69')]);_0x5d205b[_0xe896('0x49')]=_0xe896('0x69');_0x4b4903=as[_0xe896('0x6a')](_0x388375,_0x20fe4f[_0xe896('0x3b')],_0x5d205b);_0x3373dc[_0x1fa3fd](_0x4b4903[_0xe896('0x6b')],_0x4b4903['value'][_0xe896('0x6c')],_0x4b4903[_0xe896('0x5e')][_0xe896('0x2c')]);}break;case'Tag':var _0x4f2025=_0x5d205b['value'][_0xe896('0x65')](',')[_0xe896('0x38')](function(_0x20cadc){return Number(_0x20cadc);});_0x4f2025[_0xe896('0x34')](function(_0x50c910){_0x3ef032['or'](_0xe896('0x6d'),'%,'+_0x50c910+',%');});_0x4d0047=_[_0xe896('0x6e')](_0x4d0047,_0x4f2025);break;case _0xe896('0x6f'):if(_0x5d205b[_0xe896('0x63')]==='$substring'){_0x3373dc[_0x1fa3fd](_0xe896('0x70'),'%'+_0x5d205b[_0xe896('0x5e')]+'%',null);}else{_0x20fe4f=_['find'](_0x28e09c,[_0xe896('0x2f'),_0xe896('0x71')]);_0x5d205b['field']='UserId';_0x4b4903=as[_0xe896('0x6a')](_0x388375,_0x20fe4f[_0xe896('0x3b')],_0x5d205b);_0x3373dc[_0x1fa3fd](_0x4b4903[_0xe896('0x6b')],_0x4b4903[_0xe896('0x5e')][_0xe896('0x6c')],_0x4b4903['value'][_0xe896('0x2c')]);}break;case _0xe896('0x72'):_0x4b4903=as[_0xe896('0x6a')]('me',null,_0x5d205b);_0x3373dc[_0x1fa3fd](_0x4b4903[_0xe896('0x6b')],_0x4b4903['value']['start'],_0x4b4903[_0xe896('0x5e')][_0xe896('0x2c')]);break;}}else{var _0x4b4903=as[_0xe896('0x6a')](_0x388375,_0x20fe4f['type'],_0x5d205b);_0x3373dc[_0x1fa3fd](_0x4b4903[_0xe896('0x6b')],_0x4b4903[_0xe896('0x5e')][_0xe896('0x6c')],_0x4b4903[_0xe896('0x5e')][_0xe896('0x2c')]);}}}else{var _0xa0a63e=_(_0x36d2d7[_0xe896('0x3d')])[_0xe896('0x73')]()[_0xe896('0x38')](function(_0x14b2b9){return _[_0xe896('0x74')](_0x28e09c,[_0xe896('0x2f'),_0x14b2b9])?_0x14b2b9:undefined;})[_0xe896('0x75')]()[_0xe896('0x5e')]();if(!_[_0xe896('0x76')](_0xa0a63e)){_0xa0a63e[_0xe896('0x34')](function(_0x404b42){if(_0x404b42===_0xe896('0x77')){_0x179fc2[_0xe896('0x46')](_0xe896('0x78'),[][_0xe896('0x79')](_0x36d2d7[_0xe896('0x3d')][_0x404b42]));}else if(_0x404b42==='createdAt'){var _0x5eb805=JSON[_0xe896('0x7a')](_0x36d2d7[_0xe896('0x3d')][_0x404b42])['$gte'];var _0x1165ad=JSON[_0xe896('0x7a')](_0x36d2d7[_0xe896('0x3d')][_0x404b42])[_0xe896('0x7b')];_0x179fc2[_0xe896('0x46')](_0xe896('0x7c'),_0x5eb805,_0x1165ad);}else{if(_0x36d2d7[_0xe896('0x3d')][_0x404b42]===_0xe896('0x7d')){_0x179fc2[_0xe896('0x46')]('i.'+_0x404b42+_0xe896('0x7e'));}else{_0x179fc2[_0xe896('0x46')]('i.'+_0x404b42+'\x20=\x20?',_0x36d2d7[_0xe896('0x3d')][_0x404b42]);}}});}if(_0x36d2d7[_0xe896('0x3d')]['read']){if(_0x36d2d7[_0xe896('0x3d')]['read']==0x1){_0x179fc2['having'](_0xe896('0x7f'));}else{_0x179fc2[_0xe896('0x5f')]('`unreadMessages`\x20>\x200');}}if(_0x36d2d7['query'][_0xe896('0x80')]){_0x4d0047=_['isArray'](_0x36d2d7['query'][_0xe896('0x80')])?_0x36d2d7[_0xe896('0x3d')][_0xe896('0x80')]:new Array(_0x36d2d7['query'][_0xe896('0x80')]);_0x4d0047[_0xe896('0x34')](function(_0x43229b){_0x3ef032['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x43229b+',%');});}if(_0x36d2d7[_0xe896('0x3d')][_0xe896('0x81')]){var _0x362bd1=_0x36d2d7[_0xe896('0x3d')]['filter'][_0xe896('0x82')]('\x5c','\x5c\x5c')[_0xe896('0x82')](/'/g,'\x27\x27');if(qs[_0xe896('0x83')](_0x362bd1)){_0x3373dc['or'](_0xe896('0x84'),_0x362bd1+'%')['or']('i.phone\x20LIKE\x20?',_0x362bd1+'%');}else{_0x3373dc['or'](_0xe896('0x85'),qs[_0xe896('0x86')](_0x362bd1))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x362bd1+'%');}}}_0x179fc2[_0xe896('0x46')](_0x3373dc);_0x179fc2[_0xe896('0x87')](_0xe896('0x88'));var _0x46b9af={'type':db['Sequelize'][_0xe896('0x89')][_0xe896('0x8a')],'raw':!![]};var _0x113027=_0x179fc2[_0xe896('0x8b')]();_0x113027[_0xe896('0x49')](_0xe896('0x88'));_0x113027['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x19a712[_0xe896('0x44')]){_0x19a712[_0xe896('0x44')][_0xe896('0x34')](function(_0x270121){var _0x1805ff=_0x270121[0x0]===_0xe896('0x8c')?_0x270121[0x0]:'i.'+_0x270121[0x0];_0x179fc2[_0xe896('0x44')](_0x1805ff,_0x270121[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x4d0047)){_0x179fc2[_0xe896('0x5f')](_0x3ef032);_0x113027['where'](_0xe896('0x8d'),_0x4d0047);}BPromise['resolve']()[_0xe896('0x2a')](function(){if(!_0x404967){if(_0x36d2d7['query'][_0xe896('0x77')])return;_0x113027[_0xe896('0x46')](_0xe896('0x8e'));_0x179fc2[_0xe896('0x46')](_0xe896('0x8e'));return;}if(_0x36d2d7['user'][_0xe896('0x8f')]!==_0xe896('0x90'))return;return _0x36d2d7[_0xe896('0x91')][_0xe896('0x92')]({'attributes':['id'],'raw':!![]})[_0xe896('0x2a')](function(_0x27a9a7){if(_[_0xe896('0x76')](_0x27a9a7)){_0x113027['where'](_0xe896('0x93'));_0x179fc2['where'](_0xe896('0x93'));}else{_0x113027[_0xe896('0x46')](_0xe896('0x78'),_['map'](_0x27a9a7,'id'));_0x179fc2[_0xe896('0x46')](_0xe896('0x78'),_[_0xe896('0x38')](_0x27a9a7,'id'));}});})[_0xe896('0x2a')](function(){if(_0x36d2d7[_0xe896('0x91')][_0xe896('0x8f')]===_0xe896('0x90')&&!_0x404967&&!_0x36d2d7[_0xe896('0x3d')][_0xe896('0x77')])return[];return db[_0xe896('0x94')][_0xe896('0x3d')](_0x113027['toString'](),_0x46b9af);})[_0xe896('0x2a')](function(_0x317880){_0x39cbe6[_0xe896('0x23')]=_0x317880[_0xe896('0x42')];if(_0x39cbe6['count']===0x0)return[];return db[_0xe896('0x94')][_0xe896('0x3d')](_0x5cd5a3[_0xe896('0x95')](),_0x46b9af)[_0xe896('0x2a')](function(_0x306ac1){_0x57366b=_[_0xe896('0x96')](_0x306ac1,'id');_0x46b9af=_[_0xe896('0x97')](_0x46b9af,{'model':db[_0xe896('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x36d2d7[_0xe896('0x3d')][_0xe896('0x41')]){_0x19a712[_0xe896('0x40')][_0xe896('0x34')](function(_0x5bb552){_0x179fc2[_0xe896('0x49')]('i.'+_0x5bb552);});}else{_0x179fc2[_0xe896('0x49')](_0xe896('0x98'),'unreadMessages');_0x179fc2[_0xe896('0x49')]('a.key','Account.key');_0x179fc2[_0xe896('0x49')](_0xe896('0x99'),_0xe896('0x9a'));_0x179fc2['field'](_0xe896('0x9b'),_0xe896('0x8c'));_0x179fc2['field']('i.*');_0x179fc2[_0xe896('0x49')](_0xe896('0x9c'),_0xe896('0x9d'));_0x179fc2[_0xe896('0x49')](_0xe896('0x9e'),_0xe896('0x9f'));_0x179fc2[_0xe896('0x49')]('c.email','Contact.email');_0x179fc2[_0xe896('0x49')]('c.phone','Contact.phone');_0x179fc2[_0xe896('0x49')](_0xe896('0xa0'),_0xe896('0xa1'));_0x179fc2[_0xe896('0x49')]('c.fax',_0xe896('0xa2'));_0x179fc2[_0xe896('0x49')]('o.fullname',_0xe896('0xa3'));_0x179fc2[_0xe896('0x49')](_0xe896('0xa4'),_0xe896('0xa5'));_0x179fc2[_0xe896('0x49')](_0xe896('0xa6'),_0xe896('0x32'));}if(_0x19a712[_0xe896('0x25')])_0x179fc2[_0xe896('0x25')](_0x19a712[_0xe896('0x25')]);if(_0x19a712[_0xe896('0x24')])_0x179fc2[_0xe896('0x24')](_0x19a712[_0xe896('0x24')]);return db['sequelize'][_0xe896('0x3d')](_0x179fc2[_0xe896('0x95')](),_0x46b9af);})[_0xe896('0x2a')](function(_0x1cbc1f){_0x489254[_0xe896('0x46')](_0xe896('0xa7'),_[_0xe896('0x38')](_0x1cbc1f,'id'));return db[_0xe896('0x94')][_0xe896('0x3d')](_0x489254[_0xe896('0x95')](),_0x46b9af)['then'](function(_0x5d5468){var _0x41e6c4=_[_0xe896('0xa8')](_0x5d5468,_0xe896('0xa9'));var _0x56ee2d=[];_0x1cbc1f[_0xe896('0x34')](function(_0x13b335){_0x56ee2d['push'](updateWhatsappInteraction(_0x13b335,_0x57366b,_0x41e6c4));});return BPromise[_0xe896('0xaa')](_0x56ee2d);});});})[_0xe896('0x2a')](function(_0x5d4e65){_0x39cbe6[_0xe896('0xab')]=_0x5d4e65;return _0x39cbe6;})[_0xe896('0x2a')](respondWithFilteredResult(_0x486eb5,_0x19a712))[_0xe896('0x36')](handleError(_0x486eb5,null));};exports[_0xe896('0xac')]=function(_0x1a40ee,_0x2c1f65){var _0x31d556={'raw':![],'where':{'id':_0x1a40ee['params']['id']}},_0x1682ff={};_0x1682ff[_0xe896('0x3f')]=_[_0xe896('0x73')](db[_0xe896('0x39')][_0xe896('0x3a')]);_0x1682ff[_0xe896('0x3d')]=_['keys'](_0x1a40ee[_0xe896('0x3d')]);_0x1682ff[_0xe896('0xad')]=_[_0xe896('0x3e')](_0x1682ff['model'],_0x1682ff[_0xe896('0x3d')]);_0x31d556[_0xe896('0x40')]=_[_0xe896('0x3e')](_0x1682ff[_0xe896('0x3f')],qs[_0xe896('0x41')](_0x1a40ee[_0xe896('0x3d')][_0xe896('0x41')]));_0x31d556[_0xe896('0x40')]=_0x31d556[_0xe896('0x40')]['length']?_0x31d556[_0xe896('0x40')]:_0x1682ff['model'];if(_0x1a40ee[_0xe896('0x3d')][_0xe896('0xae')]){_0x31d556[_0xe896('0xaf')]=[{'all':!![]}];}_0x31d556=_[_0xe896('0x97')]({},_0x31d556,_0x1a40ee['options']);return db[_0xe896('0x39')][_0xe896('0x68')](_0x31d556)['then'](handleEntityNotFound(_0x2c1f65,null))[_0xe896('0x2a')](respondWithResult(_0x2c1f65,null))[_0xe896('0x36')](handleError(_0x2c1f65,null));};exports[_0xe896('0xb0')]=function(_0x498987,_0xadc81f){return db['WhatsappInteraction']['create'](_0x498987[_0xe896('0x72')],{})[_0xe896('0x2a')](respondWithResult(_0xadc81f,0xc9))['catch'](handleError(_0xadc81f,null));};exports[_0xe896('0xb1')]=function(_0xd0e5ca,_0x50e5e7){if(_0xd0e5ca['body']['id']){delete _0xd0e5ca['body']['id'];}return db['WhatsappInteraction'][_0xe896('0x68')]({'where':{'id':_0xd0e5ca[_0xe896('0xb2')]['id']}})[_0xe896('0x2a')](handleEntityNotFound(_0x50e5e7,null))[_0xe896('0x2a')](saveUpdates(_0xd0e5ca[_0xe896('0x72')],null))[_0xe896('0x2a')](respondWithResult(_0x50e5e7,null))[_0xe896('0x36')](handleError(_0x50e5e7,null));};exports[_0xe896('0x2b')]=function(_0x4ccf3a,_0xd345d8){return db[_0xe896('0x39')][_0xe896('0x68')]({'where':{'id':_0x4ccf3a[_0xe896('0xb2')]['id']}})['then'](handleEntityNotFound(_0xd345d8,null))['then'](removeEntity(_0xd345d8,null))[_0xe896('0x36')](handleError(_0xd345d8,null));};exports[_0xe896('0xb3')]=function(_0x58116f,_0x5340df){return db[_0xe896('0x39')][_0xe896('0xb3')]()[_0xe896('0x2a')](respondWithResult(_0x5340df,null))[_0xe896('0x36')](handleError(_0x5340df,null));};exports[_0xe896('0xb4')]=function(_0x561197,_0x3b92aa,_0x3a730f){return db[_0xe896('0xb5')]['find']({'where':{'id':_0x561197[_0xe896('0xb2')]['id']}})[_0xe896('0x2a')](handleEntityNotFound(_0x3b92aa,null))[_0xe896('0x2a')](function(_0xdeaa37){if(_0xdeaa37){return _0xdeaa37[_0xe896('0xb4')](_0x561197['body'][_0xe896('0xb6')],_[_0xe896('0xb7')](_0x561197[_0xe896('0x72')],['ids','id'])||{});}})[_0xe896('0x2a')](respondWithResult(_0x3b92aa,null))['catch'](handleError(_0x3b92aa,null));};exports[_0xe896('0xb8')]=function(_0x326d9d,_0x1e1820,_0x39fb2c){var _0x2de1da={'raw':![],'where':{}};var _0x33970c={};var _0x4870d7={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xe896('0xb9')]({'where':{'id':_0x326d9d['params']['id']}})[_0xe896('0x2a')](handleEntityNotFound(_0x1e1820,null))[_0xe896('0x2a')](function(_0x5ac4ad){if(_0x5ac4ad){_0x33970c[_0xe896('0x3f')]=_[_0xe896('0x73')](db['WhatsappMessage'][_0xe896('0x3a')]);_0x33970c['query']=_[_0xe896('0x73')](_0x326d9d[_0xe896('0x3d')]);_0x33970c[_0xe896('0xad')]=_[_0xe896('0x3e')](_0x33970c['model'],_0x33970c[_0xe896('0x3d')]);_0x2de1da[_0xe896('0x40')]=_[_0xe896('0x3e')](_0x33970c[_0xe896('0x3f')],qs[_0xe896('0x41')](_0x326d9d[_0xe896('0x3d')][_0xe896('0x41')]));_0x2de1da[_0xe896('0x40')]=_0x2de1da[_0xe896('0x40')][_0xe896('0x42')]?_0x2de1da[_0xe896('0x40')]:_0x33970c[_0xe896('0x3f')];if(!_0x326d9d[_0xe896('0x3d')][_0xe896('0x43')](_0xe896('0xba'))){_0x2de1da[_0xe896('0x25')]=qs[_0xe896('0x25')](_0x326d9d['query'][_0xe896('0x25')]);_0x2de1da[_0xe896('0x24')]=qs['offset'](_0x326d9d['query'][_0xe896('0x24')]);}_0x2de1da[_0xe896('0x44')]=qs[_0xe896('0x45')](_0x326d9d[_0xe896('0x3d')][_0xe896('0x45')]);_0x2de1da[_0xe896('0x46')]=qs[_0xe896('0xad')](_[_0xe896('0x47')](_0x326d9d['query'],_0x33970c[_0xe896('0xad')]));_0x2de1da[_0xe896('0x46')][_0xe896('0xa9')]=_0x5ac4ad['id'];if(_0x326d9d[_0xe896('0x3d')]['filter']){_0x2de1da[_0xe896('0x46')]=_['merge'](_0x2de1da['where'],{'$or':_[_0xe896('0x38')](_0x2de1da[_0xe896('0x40')],function(_0x120699){var _0x30236c={};_0x30236c[_0x120699]={'$like':'%'+_0x326d9d[_0xe896('0x3d')][_0xe896('0x81')]+'%'};return _0x30236c;})});}if(_0x326d9d[_0xe896('0x3d')]['$gte']){var _0x2d3ada=_0x326d9d[_0xe896('0x3d')][_0xe896('0xbb')][_0xe896('0x65')](',');var _0xe78476={};_0xe78476[_0x2d3ada[0x0]]={'$gte':moment(_0x2d3ada[0x1])[_0xe896('0xbc')](_0xe896('0xbd'))};_0x2de1da[_0xe896('0x46')]=_[_0xe896('0x97')](_0x2de1da['where'],_0xe78476);}_0x2de1da=_[_0xe896('0x97')]({},_0x2de1da,_0x326d9d[_0xe896('0xbe')]);return db['WhatsappMessage'][_0xe896('0x23')]({'where':_0x2de1da['where']})['then'](function(_0xa01553){_0x4870d7['count']=_0xa01553;if(_0x326d9d['query'][_0xe896('0xae')]){_0x2de1da[_0xe896('0xaf')]=[{'all':!![]}];}return db[_0xe896('0xb5')]['findAll'](_0x2de1da);})[_0xe896('0x2a')](function(_0x55be9b){_0x4870d7[_0xe896('0xab')]=_0x55be9b;return _0x4870d7;});}})[_0xe896('0x2a')](respondWithFilteredResult(_0x1e1820,_0x2de1da))['catch'](handleError(_0x1e1820,null));};exports[_0xe896('0xbf')]=function(_0x186118,_0x53cebb,_0x69aa61){return db['WhatsappInteraction']['find']({'where':{'id':_0x186118['params']['id']}})[_0xe896('0x2a')](handleEntityNotFound(_0x53cebb,null))['then'](function(_0x268b4a){if(_0x268b4a){return _0x268b4a[_0xe896('0xc0')](_0x186118[_0xe896('0x72')][_0xe896('0xb6')],_['omit'](_0x186118[_0xe896('0x72')],[_0xe896('0xb6'),'id'])||{})[_0xe896('0xc1')](function(){return db[_0xe896('0xc2')]['findAll']({'attributes':['id',_0xe896('0x2f'),'color'],'where':{'id':_0x186118[_0xe896('0x72')][_0xe896('0xb6')]}});})[_0xe896('0x2a')](function(_0x67a330){socket['emit'](_0xe896('0xc3'),{'id':Number(_0x186118['params']['id']),'tags':_0x67a330||[]});return{'id':Number(_0x186118[_0xe896('0xb2')]['id']),'tags':_0x67a330||[]};});}})['then'](respondWithResult(_0x53cebb,null))[_0xe896('0x36')](handleError(_0x53cebb,null));};exports[_0xe896('0xc4')]=function(_0x34591f,_0x58f7f3,_0x22c54c){return db['WhatsappInteraction'][_0xe896('0x68')]({'where':{'id':_0x34591f[_0xe896('0xb2')]['id']}})['then'](handleEntityNotFound(_0x58f7f3,null))[_0xe896('0x2a')](function(_0x384116){if(_0x384116){return _0x384116['removeTags'](_0x34591f[_0xe896('0x3d')][_0xe896('0xb6')]);}})[_0xe896('0x2a')](respondWithStatusCode(_0x58f7f3,null))[_0xe896('0x36')](handleError(_0x58f7f3,null));};exports[_0xe896('0xc5')]=function(_0x1c6ce4,_0x321799){var _0x5da1fa=moment()[_0xe896('0xc6')]()['toString']();var _0x5b61d8=path[_0xe896('0xc7')](config[_0xe896('0xc8')],'server',_0xe896('0xc9'),_0xe896('0xca'));var _0x4b5af4=path['join'](config[_0xe896('0xc8')],_0xe896('0xcb'),'files',_0xe896('0xcc'));var _0x286d1c=path['join'](_0x5b61d8,_0x5da1fa);var _0x2fd238=util[_0xe896('0xbc')](_0xe896('0xcd'),_0x1c6ce4['params']['id'],_0x5da1fa);var _0x3c9e8e=path[_0xe896('0xc7')](_0x5b61d8,_0x2fd238);var _0x569a12=[];_0x569a12[_0xe896('0x35')]({'model':db[_0xe896('0x6f')],'as':_0xe896('0x6f'),'attributes':['id',_0xe896('0x31')],'raw':!![]});_0x569a12[_0xe896('0x35')]({'model':db[_0xe896('0xce')],'as':_0xe896('0x62'),'attributes':['id',_0xe896('0xcf'),_0xe896('0xd0')],'raw':!![]});if(_0x1c6ce4[_0xe896('0x3d')][_0xe896('0xcc')]){_0x569a12[_0xe896('0x35')]({'model':db[_0xe896('0xd1')],'as':_0xe896('0xd1'),'raw':!![]});}var _0x4a8b8c=[{'model':db[_0xe896('0xb5')],'as':'Messages','attributes':['id',_0xe896('0x72'),_0xe896('0xd2'),'direction',_0xe896('0xd3'),_0xe896('0xd4')],'include':_0x569a12}];_0x4a8b8c[_0xe896('0x35')]({'model':db['WhatsappAccount'],'as':_0xe896('0xd5'),'attributes':['id',_0xe896('0x2f')]});_0x4a8b8c[_0xe896('0x35')]({'model':db[_0xe896('0x6f')],'as':_0xe896('0xd6'),'attributes':['id',_0xe896('0x31')]});return db[_0xe896('0x39')][_0xe896('0x68')]({'where':{'id':_0x1c6ce4[_0xe896('0xb2')]['id']},'include':_0x4a8b8c})['then'](handleEntityNotFound(_0x321799,null))['then'](function(_0x54a89d){if(_0x54a89d){var _0x4260ca=_0x54a89d['get']({'plain':!![]});fs['mkdirSync'](_0x286d1c);var _0x2a65e7={'format':'A4','border':'10px','header':{'height':'40px','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':_0xe896('0xd7'),'contents':{'default':util['format'](_0xe896('0xd8'),util[_0xe896('0xbc')](_0xe896('0xd9'),_0xe896('0xda'),_0x4260ca['id']),moment()['format'](_0xe896('0xdb'))[_0xe896('0x95')]())}}};var _0x36c394={'channel':_0xe896('0xda'),'account':_0x4260ca[_0xe896('0xd5')]['name'],'agent':_0x4260ca['Owner']?_0x4260ca[_0xe896('0xd6')][_0xe896('0x31')]:'N.A.','createdAt':moment(_0x4260ca[_0xe896('0xd2')])[_0xe896('0xbc')](_0xe896('0xbd'))[_0xe896('0x95')](),'closedAt':_0x4260ca[_0xe896('0xdc')]?moment(_0x4260ca[_0xe896('0xdd')])[_0xe896('0xbc')](_0xe896('0xbd'))[_0xe896('0x95')]():'','disposition':_0x4260ca[_0xe896('0xde')],'messages':_(_0x4260ca[_0xe896('0xdf')])[_0xe896('0x81')]({'secret':![]})[_0xe896('0x38')](function(_0x521027){if(_0x521027[_0xe896('0xd1')]){var _0x28c0c5=path['join'](_0x4b5af4,_0x521027[_0xe896('0xd1')][_0xe896('0xe0')]);if(fs[_0xe896('0xe1')](_0x28c0c5)){fs[_0xe896('0xe2')](_0x28c0c5)[_0xe896('0xe3')](fs[_0xe896('0xe4')](path[_0xe896('0xc7')](_0x286d1c,_0x521027[_0xe896('0xd1')][_0xe896('0xe0')])));}}return{'date':moment(_0x521027[_0xe896('0xd2')])['format'](_0xe896('0xbd'))['toString'](),'sender':_0x521027[_0xe896('0xe5')]===_0xe896('0xe6')?_0x521027[_0xe896('0x6f')]?_0x521027[_0xe896('0x6f')][_0xe896('0x31')]:_0xe896('0xe7'):_0x521027[_0xe896('0x62')][_0xe896('0xcf')]+(_0x521027['Contact'][_0xe896('0xd0')]?'\x20'+_0x521027[_0xe896('0x62')][_0xe896('0xd0')]:''),'body':_0x521027[_0xe896('0xd1')]?_0x521027[_0xe896('0xd1')][_0xe896('0xe0')]:_0x521027[_0xe896('0x72')],'direction':_0x521027[_0xe896('0xe5')]==='out'?'A':'C','secret':_0x521027[_0xe896('0xd3')],'read':_0x521027[_0xe896('0xd4')],'attachment':_0x521027[_0xe896('0xd1')]};})['value']()};return ejs['renderFile'](path[_0xe896('0xc7')](config[_0xe896('0xc8')],_0xe896('0xcb'),'views','downloadInteraction.html'),{'interaction':_0x36c394})[_0xe896('0x2a')](function(_0x173d87){return new BPromise(function(_0x55c03d,_0x6a7638){pdf[_0xe896('0xb0')](_0x173d87,_0x2a65e7)[_0xe896('0xe8')](path[_0xe896('0xc7')](_0x286d1c,_0xe896('0xe9')+_0x4260ca['id']+'-'+_0x5da1fa+_0xe896('0xea')),function(_0x4d31dc,_0x272bc8){if(_0x4d31dc)return _0x6a7638(_0x4d31dc);_0x55c03d(_0x272bc8);});});})[_0xe896('0x2a')](function(){return new BPromise(function(_0x49b7a9,_0x256cb6){zipdir(_0x286d1c,{'saveTo':_0x3c9e8e},function(_0x46d036,_0x4ff87e){if(_0x46d036)return _0x256cb6(_0x46d036);return _0x49b7a9(_0x4ff87e);});})['then'](function(){return new BPromise(function(_0x4bc513,_0x4d3ca3){rimraf(_0x286d1c,function(_0x2973b8){if(_0x2973b8)_0x4d3ca3(_0x2973b8);return _0x4bc513();});});})[_0xe896('0x2a')](function(){return _0x321799[_0xe896('0xc5')](_0x3c9e8e,_0x2fd238,function(_0x27fd0e){if(_0x27fd0e){console[_0xe896('0xeb')](_0xe896('0xec'),_0x27fd0e);}else{fs['unlinkSync'](_0x3c9e8e);}});});});}else{return _0x321799[_0xe896('0x20')](0xc8);}})['catch'](handleError(_0x321799,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index d5362b2..d3baccf 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 _0x455d=['map','findAll','length','emit','catch','hasOwnProperty','exports','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','getUsers','then','setDataValue'];(function(_0x18ae8f,_0x25f684){var _0x43e219=function(_0x1cb733){while(--_0x1cb733){_0x18ae8f['push'](_0x18ae8f['shift']());}};_0x43e219(++_0x25f684);}(_0x455d,0x124));var _0xd455=function(_0x4f4ce6,_0x4791da){_0x4f4ce6=_0x4f4ce6-0x0;var _0x4a8d85=_0x455d[_0x4f4ce6];return _0x4a8d85;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xd455('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db'][_0xd455('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xd455('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd455('0x3'),'afterDestroy':_0xd455('0x4')};function emitEvent(_0x4beb6d){return function(_0x3fa23e,_0x500d20,_0x1d1b7d){_0x3fa23e[_0xd455('0x5')]({'attributes':['id'],'raw':!![]})[_0xd455('0x6')](function(_0x4fa989){_0x3fa23e[_0xd455('0x7')]('Users',_0x4fa989[_0xd455('0x8')](function(_0x1783a8){return{'id':_0x1783a8['id']};}));return WhatsappMessage[_0xd455('0x9')]({'where':{'WhatsappInteractionId':_0x3fa23e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2d2a86){_0x3fa23e[_0xd455('0x7')]('unreadMessages',_0x2d2a86[_0xd455('0xa')]);WhatsappInteractionEvents[_0xd455('0xb')](_0x4beb6d+':'+_0x3fa23e['id'],_0x3fa23e);WhatsappInteractionEvents['emit'](_0x4beb6d,_0x3fa23e);_0x1d1b7d(null);})[_0xd455('0xc')](_0x1d1b7d(null));};}for(var e in events){if(events[_0xd455('0xd')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xd455('0xe')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x5053=['length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','getUsers','then','Users','map','findAll','setDataValue','unreadMessages'];(function(_0x21518c,_0x17e2c4){var _0x27526e=function(_0x4016f7){while(--_0x4016f7){_0x21518c['push'](_0x21518c['shift']());}};_0x27526e(++_0x17e2c4);}(_0x5053,0x1ba));var _0x3505=function(_0x481af3,_0x483fac){_0x481af3=_0x481af3-0x0;var _0x3354ea=_0x5053[_0x481af3];return _0x3354ea;};'use strict';var EventEmitter=require(_0x3505('0x0'));var WhatsappInteraction=require(_0x3505('0x1'))['db'][_0x3505('0x2')];var WhatsappMessage=require(_0x3505('0x1'))['db'][_0x3505('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x3505('0x4')](0x0);var events={'afterCreate':_0x3505('0x5'),'afterUpdate':_0x3505('0x6'),'afterDestroy':'remove'};function emitEvent(_0x42595d){return function(_0x48cc02,_0x8eb899,_0x32efb9){_0x48cc02[_0x3505('0x7')]({'attributes':['id'],'raw':!![]})[_0x3505('0x8')](function(_0x343639){_0x48cc02['setDataValue'](_0x3505('0x9'),_0x343639[_0x3505('0xa')](function(_0x213d8a){return{'id':_0x213d8a['id']};}));return WhatsappMessage[_0x3505('0xb')]({'where':{'WhatsappInteractionId':_0x48cc02['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3505('0x8')](function(_0x486aec){_0x48cc02[_0x3505('0xc')](_0x3505('0xd'),_0x486aec[_0x3505('0xe')]);WhatsappInteractionEvents[_0x3505('0xf')](_0x42595d+':'+_0x48cc02['id'],_0x48cc02);WhatsappInteractionEvents['emit'](_0x42595d,_0x48cc02);_0x32efb9(null);})['catch'](_0x32efb9(null));};}for(var e in events){if(events[_0x3505('0x10')](e)){var event=events[e];WhatsappInteraction[_0x3505('0x11')](e,emitEvent(event));}}module[_0x3505('0x12')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index fc05b3e..0798252 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 _0xdd77=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt'];(function(_0x1c2d8b,_0x5d091b){var _0xb90fca=function(_0x3a6250){while(--_0x3a6250){_0x1c2d8b['push'](_0x1c2d8b['shift']());}};_0xb90fca(++_0x5d091b);}(_0xdd77,0xce));var _0x7dd7=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xdd77[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0x7dd7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7dd7('0x1'));var moment=require(_0x7dd7('0x2'));var BPromise=require(_0x7dd7('0x3'));var rp=require(_0x7dd7('0x4'));var fs=require('fs');var path=require(_0x7dd7('0x5'));var rimraf=require('rimraf');var config=require(_0x7dd7('0x6'));var attributes=require(_0x7dd7('0x7'));module[_0x7dd7('0x8')]=function(_0x1a42f8,_0x33084b){return _0x1a42f8[_0x7dd7('0x9')](_0x7dd7('0xa'),attributes,{'tableName':_0x7dd7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x40e734,_0x4a03d9,_0x52f209){if(_0x40e734[_0x7dd7('0xc')](_0x7dd7('0xd'))){_0x40e734[_0x7dd7('0xe')]=moment()[_0x7dd7('0xf')](_0x7dd7('0x10'));}_0x52f209(null,_0x40e734);}}});}; \ No newline at end of file +var _0x5015=['../../config/environment','exports','WhatsappInteraction','changed','closed','closedAt','format','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x263cc0,_0x182e9c){var _0x298414=function(_0x9aba88){while(--_0x9aba88){_0x263cc0['push'](_0x263cc0['shift']());}};_0x298414(++_0x182e9c);}(_0x5015,0x7c));var _0x5501=function(_0x34cbdb,_0x40b6c8){_0x34cbdb=_0x34cbdb-0x0;var _0x5105f8=_0x5015[_0x34cbdb];return _0x5105f8;};'use strict';var _=require(_0x5501('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5501('0x1'));var BPromise=require(_0x5501('0x2'));var rp=require(_0x5501('0x3'));var fs=require('fs');var path=require(_0x5501('0x4'));var rimraf=require(_0x5501('0x5'));var config=require(_0x5501('0x6'));var attributes=require('./whatsappInteraction.attributes');module[_0x5501('0x7')]=function(_0x181b3c,_0x1b845c){return _0x181b3c['define'](_0x5501('0x8'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x79acb8,_0x331e40,_0xed177e){if(_0x79acb8[_0x5501('0x9')](_0x5501('0xa'))){_0x79acb8[_0x5501('0xb')]=moment()[_0x5501('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0xed177e(null,_0x79acb8);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 43b1e37..f18a6d4 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 _0x3ec2=['./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','find','addTags','ids','omit','spread','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x3ec2,0x197));var _0x23ec=function(_0x13b097,_0x19c284){_0x13b097=_0x13b097-0x0;var _0x22aa74=_0x3ec2[_0x13b097];return _0x22aa74;};'use strict';var _=require('lodash');var util=require(_0x23ec('0x0'));var moment=require(_0x23ec('0x1'));var BPromise=require('bluebird');var rs=require(_0x23ec('0x2'));var fs=require('fs');var Redis=require(_0x23ec('0x3'));var db=require(_0x23ec('0x4'))['db'];var utils=require(_0x23ec('0x5'));var logger=require(_0x23ec('0x6'))(_0x23ec('0x7'));var config=require('../../config/environment');var jayson=require(_0x23ec('0x8'));var client=jayson[_0x23ec('0x9')]['http']({'port':0x232a});config[_0x23ec('0xa')]=_[_0x23ec('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x23ec('0xc'))(new Redis(config[_0x23ec('0xa')]));require(_0x23ec('0xd'))[_0x23ec('0xe')](socket);function respondWithRpcPromise(_0x4b8802,_0x343656,_0x4f5621){return new BPromise(function(_0x37f2e5,_0x2bc33d){return client['request'](_0x4b8802,_0x4f5621)[_0x23ec('0xf')](function(_0x3a48ec){logger[_0x23ec('0x10')](_0x23ec('0x11'),_0x343656,_0x23ec('0x12'));logger[_0x23ec('0x13')](_0x23ec('0x14'),_0x343656,_0x23ec('0x12'),JSON[_0x23ec('0x15')](_0x3a48ec));if(_0x3a48ec[_0x23ec('0x16')]){if(_0x3a48ec[_0x23ec('0x16')][_0x23ec('0x17')]===0x1f4){logger[_0x23ec('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x343656,_0x3a48ec[_0x23ec('0x16')][_0x23ec('0x18')]);return _0x2bc33d(_0x3a48ec[_0x23ec('0x16')]['message']);}logger[_0x23ec('0x16')](_0x23ec('0x11'),_0x343656,_0x3a48ec[_0x23ec('0x16')][_0x23ec('0x18')]);return _0x37f2e5(_0x3a48ec[_0x23ec('0x16')][_0x23ec('0x18')]);}else{logger[_0x23ec('0x10')](_0x23ec('0x11'),_0x343656,_0x23ec('0x12'));_0x37f2e5(_0x3a48ec[_0x23ec('0x19')][_0x23ec('0x18')]);}})[_0x23ec('0x1a')](function(_0x2eb6a2){logger[_0x23ec('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x343656,_0x2eb6a2);_0x2bc33d(_0x2eb6a2);});});}exports[_0x23ec('0x1b')]=function(_0xb5078a){var _0x12f4d4=this;return new Promise(function(_0x3382ad,_0xe9ea80){return db[_0x23ec('0x1c')][_0x23ec('0x1d')](_0xb5078a[_0x23ec('0x1e')],{'raw':_0xb5078a[_0x23ec('0x1f')]?_0xb5078a[_0x23ec('0x1f')][_0x23ec('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb5078a[_0x23ec('0x1f')]?_0xb5078a[_0x23ec('0x1f')][_0x23ec('0x21')]||null:null,'attributes':_0xb5078a[_0x23ec('0x1f')]?_0xb5078a[_0x23ec('0x1f')][_0x23ec('0x22')]||null:null,'limit':_0xb5078a[_0x23ec('0x1f')]?_0xb5078a[_0x23ec('0x1f')][_0x23ec('0x23')]||null:null})['then'](function(_0x515846){logger['info'](_0x23ec('0x1b'),_0xb5078a);logger[_0x23ec('0x13')]('UpdateWhatsappInteraction',_0xb5078a,JSON[_0x23ec('0x15')](_0x515846));_0x3382ad(_0x515846);})[_0x23ec('0x1a')](function(_0x303b4e){logger[_0x23ec('0x16')](_0x23ec('0x1b'),_0x303b4e[_0x23ec('0x18')],_0xb5078a);_0xe9ea80(_0x12f4d4['error'](0x1f4,_0x303b4e[_0x23ec('0x18')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x368cfa){return new Promise(function(_0x3f851f,_0x51e19a){return db[_0x23ec('0x1c')][_0x23ec('0x24')]({'where':_0x368cfa[_0x23ec('0x1f')]?_0x368cfa[_0x23ec('0x1f')]['where']||null:null})[_0x23ec('0xf')](function(_0xe9f19f){if(_0xe9f19f){return _0xe9f19f[_0x23ec('0x25')](_0x368cfa[_0x23ec('0x1e')][_0x23ec('0x26')],_[_0x23ec('0x27')](_0x368cfa['body'],[_0x23ec('0x26'),'id'])||{});}})[_0x23ec('0x28')](function(_0x37938d){logger[_0x23ec('0x10')](_0x23ec('0x29'),_0x368cfa);logger[_0x23ec('0x13')]('AddTags',_0x368cfa,JSON[_0x23ec('0x15')](_0x37938d));_0x3f851f(_0x37938d);})['catch'](function(_0xecef38){logger[_0x23ec('0x16')](_0x23ec('0x29'),_0xecef38[_0x23ec('0x18')],_0x368cfa);_0x51e19a(_this[_0x23ec('0x16')](0x1f4,_0xecef38[_0x23ec('0x18')]));});});}; \ No newline at end of file +var _0x7cf8=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','message','catch','UpdateWhatsappInteraction','update','body','options','raw','attributes','limit','then','stringify','AddTagsToWhatsappInteraction','WhatsappInteraction','where','addTags','ids','omit','spread','AddTags','lodash','util','randomstring'];(function(_0x33b2c2,_0x4571b3){var _0xd4078b=function(_0x239113){while(--_0x239113){_0x33b2c2['push'](_0x33b2c2['shift']());}};_0xd4078b(++_0x4571b3);}(_0x7cf8,0x183));var _0x87cf=function(_0x3f2736,_0x47803f){_0x3f2736=_0x3f2736-0x0;var _0xebe130=_0x7cf8[_0x3f2736];return _0xebe130;};'use strict';var _=require(_0x87cf('0x0'));var util=require(_0x87cf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x87cf('0x2'));var fs=require('fs');var Redis=require(_0x87cf('0x3'));var db=require(_0x87cf('0x4'))['db'];var utils=require(_0x87cf('0x5'));var logger=require('../../config/logger')(_0x87cf('0x6'));var config=require(_0x87cf('0x7'));var jayson=require(_0x87cf('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x87cf('0x9')]=_[_0x87cf('0xa')](config[_0x87cf('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x87cf('0xb'))(new Redis(config['redis']));require(_0x87cf('0xc'))['register'](socket);function respondWithRpcPromise(_0x5c1330,_0x9a7961,_0x58d45d){return new BPromise(function(_0x182225,_0x5f5d18){return client[_0x87cf('0xd')](_0x5c1330,_0x58d45d)['then'](function(_0x3e8bf4){logger[_0x87cf('0xe')](_0x87cf('0xf'),_0x9a7961,_0x87cf('0x10'));logger[_0x87cf('0x11')](_0x87cf('0x12'),_0x9a7961,_0x87cf('0x10'),JSON['stringify'](_0x3e8bf4));if(_0x3e8bf4[_0x87cf('0x13')]){if(_0x3e8bf4['error']['code']===0x1f4){logger[_0x87cf('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x9a7961,_0x3e8bf4[_0x87cf('0x13')][_0x87cf('0x14')]);return _0x5f5d18(_0x3e8bf4[_0x87cf('0x13')][_0x87cf('0x14')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x9a7961,_0x3e8bf4['error'][_0x87cf('0x14')]);return _0x182225(_0x3e8bf4[_0x87cf('0x13')]['message']);}else{logger['info'](_0x87cf('0xf'),_0x9a7961,'request\x20sent');_0x182225(_0x3e8bf4['result'][_0x87cf('0x14')]);}})[_0x87cf('0x15')](function(_0x38613e){logger['error'](_0x87cf('0xf'),_0x9a7961,_0x38613e);_0x5f5d18(_0x38613e);});});}exports[_0x87cf('0x16')]=function(_0x52d71d){var _0x498ddb=this;return new Promise(function(_0x51739f,_0x6db448){return db['WhatsappInteraction'][_0x87cf('0x17')](_0x52d71d[_0x87cf('0x18')],{'raw':_0x52d71d[_0x87cf('0x19')]?_0x52d71d[_0x87cf('0x19')][_0x87cf('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52d71d[_0x87cf('0x19')]?_0x52d71d['options']['where']||null:null,'attributes':_0x52d71d['options']?_0x52d71d[_0x87cf('0x19')][_0x87cf('0x1b')]||null:null,'limit':_0x52d71d[_0x87cf('0x19')]?_0x52d71d[_0x87cf('0x19')][_0x87cf('0x1c')]||null:null})[_0x87cf('0x1d')](function(_0x1847d7){logger['info']('UpdateWhatsappInteraction',_0x52d71d);logger['debug'](_0x87cf('0x16'),_0x52d71d,JSON[_0x87cf('0x1e')](_0x1847d7));_0x51739f(_0x1847d7);})[_0x87cf('0x15')](function(_0x428324){logger[_0x87cf('0x13')](_0x87cf('0x16'),_0x428324['message'],_0x52d71d);_0x6db448(_0x498ddb['error'](0x1f4,_0x428324['message']));});});};exports[_0x87cf('0x1f')]=function(_0x412cc0){return new Promise(function(_0x2e479d,_0x2385b4){return db[_0x87cf('0x20')]['find']({'where':_0x412cc0[_0x87cf('0x19')]?_0x412cc0['options'][_0x87cf('0x21')]||null:null})['then'](function(_0x1d40e8){if(_0x1d40e8){return _0x1d40e8[_0x87cf('0x22')](_0x412cc0[_0x87cf('0x18')][_0x87cf('0x23')],_[_0x87cf('0x24')](_0x412cc0['body'],[_0x87cf('0x23'),'id'])||{});}})[_0x87cf('0x25')](function(_0x562fea){logger[_0x87cf('0xe')](_0x87cf('0x26'),_0x412cc0);logger[_0x87cf('0x11')](_0x87cf('0x26'),_0x412cc0,JSON[_0x87cf('0x1e')](_0x562fea));_0x2e479d(_0x562fea);})['catch'](function(_0x2abc18){logger['error']('AddTags',_0x2abc18[_0x87cf('0x14')],_0x412cc0);_0x2385b4(_this[_0x87cf('0x13')](0x1f4,_0x2abc18[_0x87cf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 12efd2d..c9ce49f 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 _0x6aaa=['register','save','remove','emit','removeListener'];(function(_0x56f736,_0x521360){var _0x47b49e=function(_0x5707d4){while(--_0x5707d4){_0x56f736['push'](_0x56f736['shift']());}};_0x47b49e(++_0x521360);}(_0x6aaa,0xba));var _0xa6aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6aaa[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xa6aa('0x0'),_0xa6aa('0x1'),'update'];function createListener(_0x12fd1c,_0xe62eef){return function(_0x58b2f8){_0xe62eef[_0xa6aa('0x2')](_0x12fd1c,_0x58b2f8);};}function removeListener(_0x173f7a,_0x956db8){return function(){WhatsappInteractionEvents[_0xa6aa('0x3')](_0x173f7a,_0x956db8);};}exports[_0xa6aa('0x4')]=function(_0x5e407c){for(var _0x47fa35=0x0,_0x5cacdb=events['length'];_0x47fa35<_0x5cacdb;_0x47fa35++){var _0x39fe34=events[_0x47fa35];var _0x44a260=createListener('whatsappInteraction:'+_0x39fe34,_0x5e407c);WhatsappInteractionEvents['on'](_0x39fe34,_0x44a260);}}; \ No newline at end of file +var _0xb318=['whatsappInteraction:','save','update','emit','register','length'];(function(_0x5b44fe,_0x3bb2b5){var _0x5f2617=function(_0x40ca8b){while(--_0x40ca8b){_0x5b44fe['push'](_0x5b44fe['shift']());}};_0x5f2617(++_0x3bb2b5);}(_0xb318,0x67));var _0x8b31=function(_0x4635fa,_0x29a9da){_0x4635fa=_0x4635fa-0x0;var _0x289ff3=_0xb318[_0x4635fa];return _0x289ff3;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x8b31('0x0'),'remove',_0x8b31('0x1')];function createListener(_0x53f3bf,_0x2ecfff){return function(_0x18b817){_0x2ecfff[_0x8b31('0x2')](_0x53f3bf,_0x18b817);};}function removeListener(_0x450024,_0x488918){return function(){WhatsappInteractionEvents['removeListener'](_0x450024,_0x488918);};}exports[_0x8b31('0x3')]=function(_0x197cd9){for(var _0x323aca=0x0,_0x2a15fe=events[_0x8b31('0x4')];_0x323aca<_0x2a15fe;_0x323aca++){var _0x554fb9=events[_0x323aca];var _0x5cc633=createListener(_0x8b31('0x5')+_0x554fb9,_0x197cd9);WhatsappInteractionEvents['on'](_0x554fb9,_0x5cc633);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index b932a7e..b8e1ec5 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 _0xafc0=['../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','show','post','tracked','create','/:id/status','status','put','/:id','update','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x55db0d,_0x35285c){var _0x4a9e63=function(_0x32eaba){while(--_0x32eaba){_0x55db0d['push'](_0x55db0d['shift']());}};_0x4a9e63(++_0x35285c);}(_0xafc0,0x90));var _0x0afc=function(_0x3b4978,_0x2d3c9d){_0x3b4978=_0x3b4978-0x0;var _0x3f68d5=_0xafc0[_0x3b4978];return _0x3f68d5;};'use strict';var multer=require(_0x0afc('0x0'));var util=require(_0x0afc('0x1'));var path=require(_0x0afc('0x2'));var timeout=require(_0x0afc('0x3'));var express=require('express');var router=express[_0x0afc('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0afc('0x5'));var config=require(_0x0afc('0x6'));var controller=require(_0x0afc('0x7'));router[_0x0afc('0x8')]('/',auth[_0x0afc('0x9')](),controller[_0x0afc('0xa')]);router['get'](_0x0afc('0xb'),auth[_0x0afc('0x9')](),controller['describe']);router[_0x0afc('0x8')]('/:id',auth[_0x0afc('0x9')](),controller[_0x0afc('0xc')]);router[_0x0afc('0xd')]('/',auth[_0x0afc('0x9')](),interaction[_0x0afc('0xe')]('whatsapp','whatsappmessage:create'),controller[_0x0afc('0xf')]);router['post'](_0x0afc('0x10'),controller[_0x0afc('0x11')]);router[_0x0afc('0x12')](_0x0afc('0x13'),auth[_0x0afc('0x9')](),controller[_0x0afc('0x14')]);router[_0x0afc('0x12')]('/:id/accept',auth[_0x0afc('0x9')](),controller['accept']);router[_0x0afc('0x12')](_0x0afc('0x15'),auth[_0x0afc('0x9')](),controller[_0x0afc('0x16')]);router[_0x0afc('0x17')](_0x0afc('0x13'),auth[_0x0afc('0x9')](),controller[_0x0afc('0x18')]);module['exports']=router; \ No newline at end of file +var _0x42f2=['post','tracked','whatsapp','whatsappmessage:create','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x1a83f8,_0x2ffc87){var _0x571ccc=function(_0x481bb1){while(--_0x481bb1){_0x1a83f8['push'](_0x1a83f8['shift']());}};_0x571ccc(++_0x2ffc87);}(_0x42f2,0x1f4));var _0x242f=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0x42f2[_0x4914e2];return _0x2dcd07;};'use strict';var multer=require('multer');var util=require(_0x242f('0x0'));var path=require(_0x242f('0x1'));var timeout=require(_0x242f('0x2'));var express=require(_0x242f('0x3'));var router=express['Router']();var auth=require(_0x242f('0x4'));var interaction=require(_0x242f('0x5'));var config=require(_0x242f('0x6'));var controller=require(_0x242f('0x7'));router[_0x242f('0x8')]('/',auth[_0x242f('0x9')](),controller['index']);router[_0x242f('0x8')](_0x242f('0xa'),auth[_0x242f('0x9')](),controller[_0x242f('0xb')]);router[_0x242f('0x8')](_0x242f('0xc'),auth[_0x242f('0x9')](),controller['show']);router[_0x242f('0xd')]('/',auth[_0x242f('0x9')](),interaction[_0x242f('0xe')](_0x242f('0xf'),_0x242f('0x10')),controller['create']);router[_0x242f('0xd')](_0x242f('0x11'),controller[_0x242f('0x12')]);router['put']('/:id',auth[_0x242f('0x9')](),controller[_0x242f('0x13')]);router[_0x242f('0x14')](_0x242f('0x15'),auth[_0x242f('0x9')](),controller[_0x242f('0x16')]);router[_0x242f('0x14')](_0x242f('0x17'),auth[_0x242f('0x9')](),controller[_0x242f('0x18')]);router[_0x242f('0x19')](_0x242f('0xc'),auth[_0x242f('0x9')](),controller['destroy']);module[_0x242f('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index e0dc370..47188cb 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 _0xc4fd=['TEXT','medium','ENUM','out','STRING','DATE','BOOLEAN','sequelize'];(function(_0x220460,_0x3ba852){var _0x42847b=function(_0x455868){while(--_0x455868){_0x220460['push'](_0x220460['shift']());}};_0x42847b(++_0x3ba852);}(_0xc4fd,0x1bf));var _0xdc4f=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0xc4fd[_0x2c3255];return _0x282aba;};'use strict';var Sequelize=require(_0xdc4f('0x0'));module['exports']={'body':{'type':Sequelize[_0xdc4f('0x1')](_0xdc4f('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xdc4f('0x3')]('in',_0xdc4f('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xdc4f('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xdc4f('0x6')]},'secret':{'type':Sequelize[_0xdc4f('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xdc4f('0x5')]},'providerResponse':{'type':Sequelize[_0xdc4f('0x1')]}}; \ No newline at end of file +var _0x029c=['ENUM','out','STRING','TEXT','exports','medium','BOOLEAN'];(function(_0x1d9ca6,_0x10c458){var _0xdf4402=function(_0x1001fe){while(--_0x1001fe){_0x1d9ca6['push'](_0x1d9ca6['shift']());}};_0xdf4402(++_0x10c458);}(_0x029c,0x1bd));var _0xc029=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x029c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xc029('0x0')]={'body':{'type':Sequelize['TEXT'](_0xc029('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xc029('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc029('0x3')]('in',_0xc029('0x4')),'defaultValue':_0xc029('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc029('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xc029('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc029('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 2ca5482..85c68ef 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 _0xf846=['MessageStatus','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','jayson/promise','http','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','stack','name','send','index','map','WhatsappMessage','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','show','params','keys','rawAttributes','find','create','body','destroy','describe','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','CmContact','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','role','null','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId'];(function(_0x5c2a2b,_0x22c94e){var _0x19921f=function(_0x3fb937){while(--_0x3fb937){_0x5c2a2b['push'](_0x5c2a2b['shift']());}};_0x19921f(++_0x22c94e);}(_0xf846,0x85));var _0x6f84=function(_0x399179,_0x2c60f7){_0x399179=_0x399179-0x0;var _0x54cd03=_0xf846[_0x399179];return _0x54cd03;};'use strict';var pdf=require(_0x6f84('0x0'));var emlformat=require(_0x6f84('0x1'));var rimraf=require(_0x6f84('0x2'));var zipdir=require(_0x6f84('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f84('0x4'));var moment=require(_0x6f84('0x5'));var BPromise=require(_0x6f84('0x6'));var Mustache=require(_0x6f84('0x7'));var util=require('util');var path=require(_0x6f84('0x8'));var sox=require(_0x6f84('0x9'));var csv=require(_0x6f84('0xa'));var ejs=require(_0x6f84('0xb'));var fs=require('fs');var _=require(_0x6f84('0xc'));var squel=require(_0x6f84('0xd'));var crypto=require('crypto');var jsforce=require(_0x6f84('0xe'));var deskjs=require(_0x6f84('0xf'));var toCsv=require(_0x6f84('0xa'));var querystring=require('querystring');var Papa=require(_0x6f84('0x10'));var Redis=require(_0x6f84('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6f84('0x12'));var as=require(_0x6f84('0x13'));var hardwareService=require(_0x6f84('0x14'));var logger=require(_0x6f84('0x15'))(_0x6f84('0x16'));var utils=require(_0x6f84('0x17'));var config=require(_0x6f84('0x18'));var licenseUtil=require(_0x6f84('0x19'));var db=require(_0x6f84('0x1a'))['db'];config[_0x6f84('0x1b')]=_[_0x6f84('0x1c')](config['redis'],{'host':_0x6f84('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f84('0x1b')]));require(_0x6f84('0x1e'))['register'](socket);var jayson=require(_0x6f84('0x1f'));var client=jayson['client'][_0x6f84('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x6f84('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x4e77a0,_0x9c62fc,_0x5707a1,_0x394608){return new BPromise(function(_0x27bc7d,_0x31e9b3){var _0x4290c5=_0x394608||client;return _0x4290c5[_0x6f84('0x21')](_0x4e77a0,_0x5707a1)[_0x6f84('0x22')](function(_0x5474ad){logger[_0x6f84('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x9c62fc,_0x6f84('0x24'));logger[_0x6f84('0x25')](_0x6f84('0x26'),_0x9c62fc,_0x6f84('0x24'),JSON[_0x6f84('0x27')](_0x5474ad));if(_0x5474ad[_0x6f84('0x28')]){if(_0x5474ad[_0x6f84('0x28')]['code']===0x1f4){logger['error'](_0x6f84('0x29'),_0x9c62fc,_0x5474ad['error'][_0x6f84('0x2a')]);return _0x31e9b3(_0x5474ad[_0x6f84('0x28')][_0x6f84('0x2a')]);}logger[_0x6f84('0x28')](_0x6f84('0x29'),_0x9c62fc,_0x5474ad[_0x6f84('0x28')][_0x6f84('0x2a')]);return _0x27bc7d(_0x5474ad[_0x6f84('0x28')][_0x6f84('0x2a')]);}else{logger['info'](_0x6f84('0x29'),_0x9c62fc,'request\x20sent');_0x27bc7d(_0x5474ad[_0x6f84('0x2b')][_0x6f84('0x2a')]);}})[_0x6f84('0x2c')](function(_0x430fb7){logger[_0x6f84('0x28')](_0x6f84('0x29'),_0x9c62fc,_0x430fb7);_0x31e9b3(_0x430fb7);});});}function respondWithStatusCode(_0x3f2fb4,_0x9bd17d){_0x9bd17d=_0x9bd17d||0xcc;return function(_0x3a1327){if(_0x3a1327){return _0x3f2fb4[_0x6f84('0x2d')](_0x9bd17d);}return _0x3f2fb4[_0x6f84('0x2e')](_0x9bd17d)[_0x6f84('0x2f')]();};}function respondWithResult(_0x347481,_0x2650e7){_0x2650e7=_0x2650e7||0xc8;return function(_0xf05eed){if(_0xf05eed){return _0x347481[_0x6f84('0x2e')](_0x2650e7)[_0x6f84('0x30')](_0xf05eed);}};}function respondWithFilteredResult(_0x4fa5da,_0x16cab0){return function(_0x425d16){if(_0x425d16){var _0x13d6f1=_0x425d16[_0x6f84('0x31')],_0x4a4a4f=_0x16cab0['offset'],_0x4d3469=_0x16cab0[_0x6f84('0x32')]+_0x16cab0[_0x6f84('0x33')],_0x1bdbf3;if(_0x4d3469>=_0x13d6f1){_0x4d3469=_0x13d6f1;_0x1bdbf3=0xc8;}else{_0x1bdbf3=0xce;}_0x4fa5da[_0x6f84('0x2e')](_0x1bdbf3);return _0x4fa5da[_0x6f84('0x34')]('Content-Range',_0x4a4a4f+'-'+_0x4d3469+'/'+_0x13d6f1)[_0x6f84('0x30')](_0x425d16);}return null;};}function patchUpdates(_0xfd05f5){return function(_0x3471d2){try{jsonpatch[_0x6f84('0x35')](_0x3471d2,_0xfd05f5,!![]);}catch(_0x4a85c5){return BPromise[_0x6f84('0x36')](_0x4a85c5);}return _0x3471d2[_0x6f84('0x37')]();};}function saveUpdates(_0x45f959,_0x282cfa){return function(_0x473aec){if(_0x473aec){return _0x473aec[_0x6f84('0x38')](_0x45f959)[_0x6f84('0x22')](function(_0x471c67){return _0x471c67;});}return null;};}function removeEntity(_0x921889,_0x1c486b){return function(_0x477652){if(_0x477652){return _0x477652['destroy']()[_0x6f84('0x22')](function(){_0x921889[_0x6f84('0x2e')](0xcc)[_0x6f84('0x2f')]();});}};}function handleEntityNotFound(_0x11828b,_0x2e693f){return function(_0x4a344d){if(!_0x4a344d){_0x11828b[_0x6f84('0x2d')](0x194);}return _0x4a344d;};}function handleError(_0x5e631c,_0x42ea0c){_0x42ea0c=_0x42ea0c||0x1f4;return function(_0x14a342){logger[_0x6f84('0x28')](_0x14a342[_0x6f84('0x39')]);if(_0x14a342[_0x6f84('0x3a')]){delete _0x14a342[_0x6f84('0x3a')];}_0x5e631c[_0x6f84('0x2e')](_0x42ea0c)[_0x6f84('0x3b')](_0x14a342);};}exports[_0x6f84('0x3c')]=function(_0x840248,_0x17626b){var _0x408b13={},_0x36a4ad={},_0x307079={'count':0x0,'rows':[]};var _0x34b59b=_[_0x6f84('0x3d')](db[_0x6f84('0x3e')]['rawAttributes'],function(_0x409161){return{'name':_0x409161[_0x6f84('0x3f')],'type':_0x409161['type'][_0x6f84('0x40')]};});_0x36a4ad[_0x6f84('0x41')]=_['map'](_0x34b59b,_0x6f84('0x3a'));_0x36a4ad[_0x6f84('0x42')]=_['keys'](_0x840248['query']);_0x36a4ad[_0x6f84('0x43')]=_[_0x6f84('0x44')](_0x36a4ad['model'],_0x36a4ad['query']);_0x408b13[_0x6f84('0x45')]=_[_0x6f84('0x44')](_0x36a4ad[_0x6f84('0x41')],qs[_0x6f84('0x46')](_0x840248[_0x6f84('0x42')]['fields']));_0x408b13[_0x6f84('0x45')]=_0x408b13[_0x6f84('0x45')][_0x6f84('0x47')]?_0x408b13[_0x6f84('0x45')]:_0x36a4ad[_0x6f84('0x41')];if(!_0x840248[_0x6f84('0x42')][_0x6f84('0x48')](_0x6f84('0x49'))){_0x408b13['limit']=qs[_0x6f84('0x33')](_0x840248['query'][_0x6f84('0x33')]);_0x408b13[_0x6f84('0x32')]=qs[_0x6f84('0x32')](_0x840248[_0x6f84('0x42')]['offset']);}_0x408b13[_0x6f84('0x4a')]=qs[_0x6f84('0x4b')](_0x840248[_0x6f84('0x42')]['sort']);_0x408b13[_0x6f84('0x4c')]=qs[_0x6f84('0x43')](_[_0x6f84('0x4d')](_0x840248['query'],_0x36a4ad[_0x6f84('0x43')]),_0x34b59b);if(_0x840248[_0x6f84('0x42')][_0x6f84('0x4e')]){_0x408b13['where']=_['merge'](_0x408b13['where'],{'$or':_['map'](_0x34b59b,function(_0x47b47a){if(_0x47b47a[_0x6f84('0x4f')]!==_0x6f84('0x50')){var _0x1645f0={};_0x1645f0[_0x47b47a[_0x6f84('0x3a')]]={'$like':'%'+_0x840248[_0x6f84('0x42')][_0x6f84('0x4e')]+'%'};return _0x1645f0;}})});}_0x408b13=_[_0x6f84('0x51')]({},_0x408b13,_0x840248[_0x6f84('0x52')]);var _0x5d0f76={'where':_0x408b13[_0x6f84('0x4c')]};return db[_0x6f84('0x3e')][_0x6f84('0x31')](_0x5d0f76)[_0x6f84('0x22')](function(_0x263d3b){_0x307079[_0x6f84('0x31')]=_0x263d3b;if(_0x840248[_0x6f84('0x42')][_0x6f84('0x53')]){_0x408b13[_0x6f84('0x54')]=[{'all':!![]}];}return db[_0x6f84('0x3e')]['findAll'](_0x408b13);})[_0x6f84('0x22')](function(_0x2f8ed0){_0x307079[_0x6f84('0x55')]=_0x2f8ed0;return _0x307079;})[_0x6f84('0x22')](respondWithFilteredResult(_0x17626b,_0x408b13))[_0x6f84('0x2c')](handleError(_0x17626b,null));};exports[_0x6f84('0x56')]=function(_0x4b4ac1,_0xcbec8a){var _0x285740={'raw':!![],'where':{'id':_0x4b4ac1[_0x6f84('0x57')]['id']}},_0x3c0568={};_0x3c0568[_0x6f84('0x41')]=_[_0x6f84('0x58')](db[_0x6f84('0x3e')][_0x6f84('0x59')]);_0x3c0568[_0x6f84('0x42')]=_[_0x6f84('0x58')](_0x4b4ac1[_0x6f84('0x42')]);_0x3c0568[_0x6f84('0x43')]=_['intersection'](_0x3c0568[_0x6f84('0x41')],_0x3c0568[_0x6f84('0x42')]);_0x285740[_0x6f84('0x45')]=_[_0x6f84('0x44')](_0x3c0568[_0x6f84('0x41')],qs[_0x6f84('0x46')](_0x4b4ac1['query']['fields']));_0x285740[_0x6f84('0x45')]=_0x285740[_0x6f84('0x45')]['length']?_0x285740[_0x6f84('0x45')]:_0x3c0568['model'];if(_0x4b4ac1[_0x6f84('0x42')][_0x6f84('0x53')]){_0x285740[_0x6f84('0x54')]=[{'all':!![]}];}_0x285740=_[_0x6f84('0x51')]({},_0x285740,_0x4b4ac1[_0x6f84('0x52')]);return db['WhatsappMessage'][_0x6f84('0x5a')](_0x285740)[_0x6f84('0x22')](handleEntityNotFound(_0xcbec8a,null))[_0x6f84('0x22')](respondWithResult(_0xcbec8a,null))[_0x6f84('0x2c')](handleError(_0xcbec8a,null));};exports[_0x6f84('0x5b')]=function(_0x3cf76c,_0x5525b0){return db[_0x6f84('0x3e')][_0x6f84('0x5b')](_0x3cf76c[_0x6f84('0x5c')],{})['then'](respondWithResult(_0x5525b0,0xc9))['catch'](handleError(_0x5525b0,null));};exports[_0x6f84('0x38')]=function(_0x47ddaa,_0x3e8603){if(_0x47ddaa[_0x6f84('0x5c')]['id']){delete _0x47ddaa[_0x6f84('0x5c')]['id'];}return db[_0x6f84('0x3e')]['find']({'where':{'id':_0x47ddaa[_0x6f84('0x57')]['id']}})[_0x6f84('0x22')](handleEntityNotFound(_0x3e8603,null))[_0x6f84('0x22')](saveUpdates(_0x47ddaa[_0x6f84('0x5c')],null))[_0x6f84('0x22')](respondWithResult(_0x3e8603,null))['catch'](handleError(_0x3e8603,null));};exports[_0x6f84('0x5d')]=function(_0x3c86b5,_0xd8614d){return db['WhatsappMessage']['find']({'where':{'id':_0x3c86b5[_0x6f84('0x57')]['id']}})[_0x6f84('0x22')](handleEntityNotFound(_0xd8614d,null))[_0x6f84('0x22')](removeEntity(_0xd8614d,null))['catch'](handleError(_0xd8614d,null));};exports[_0x6f84('0x5e')]=function(_0x1bb148,_0x3096fa){return db[_0x6f84('0x3e')][_0x6f84('0x5e')]()['then'](respondWithResult(_0x3096fa,null))[_0x6f84('0x2c')](handleError(_0x3096fa,null));};var interaction_log=require(_0x6f84('0x15'))(_0x6f84('0x5f'));exports[_0x6f84('0x60')]=function(_0x1fc87d,_0x2ba629,_0x451112){var _0x5d83d8={'agent':{},'channel':_0x6f84('0x61')};if(_0x1fc87d[_0x6f84('0x5c')]['id']){delete _0x1fc87d['body']['id'];}_0x1fc87d[_0x6f84('0x5c')][_0x6f84('0x62')]=!![];_0x1fc87d[_0x6f84('0x5c')][_0x6f84('0x63')]=moment()['format'](_0x6f84('0x64'));_0x1fc87d[_0x6f84('0x5c')][_0x6f84('0x65')]=_0x1fc87d['body']['UserId']||_0x1fc87d['user']['id'];_0x5d83d8[_0x6f84('0x66')]['id']=_0x1fc87d[_0x6f84('0x5c')]['UserId'];return db[_0x6f84('0x3e')]['find']({'where':{'id':_0x1fc87d[_0x6f84('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x6f84('0x67')],'as':'Contact'}]})[_0x6f84('0x22')](handleEntityNotFound(_0x2ba629,null))['then'](saveUpdates(_0x1fc87d['body'],null))[_0x6f84('0x22')](function(_0x4ebadc){if(_0x4ebadc){_0x5d83d8[_0x6f84('0x2a')]=_0x4ebadc['get']({'plain':!![]});return db[_0x6f84('0x68')][_0x6f84('0x5a')]({'where':{'id':_0x4ebadc[_0x6f84('0x69')]}});}return null;})[_0x6f84('0x22')](handleEntityNotFound(_0x2ba629,null))[_0x6f84('0x22')](function(_0x434c00){if(_0x434c00){return _0x434c00['update']({'UserId':_0x1fc87d['body'][_0x6f84('0x65')],'read1stAt':_[_0x6f84('0x6a')](_0x434c00[_0x6f84('0x6b')])?moment()[_0x6f84('0x6c')](_0x6f84('0x64')):undefined});}return null;})['then'](function(_0xe4adb7){if(_0xe4adb7){_0x5d83d8[_0x6f84('0x6d')]=_0xe4adb7[_0x6f84('0x6e')]({'plain':!![]});interaction_log[_0x6f84('0x23')](_0x6f84('0x6f'),_0x1fc87d[_0x6f84('0x70')]['id'],_0x1fc87d[_0x6f84('0x70')]['name'],_0x1fc87d[_0x6f84('0x70')]['role'],_0x5d83d8[_0x6f84('0x6d')]['id'],_0x1fc87d[_0x6f84('0x5c')]?JSON['stringify'](_0x1fc87d[_0x6f84('0x5c')]):'null');return respondWithRpcPromise(_0x6f84('0x71'),'acceptMessage',_0x5d83d8);}return null;})[_0x6f84('0x22')](function(_0x39aa14){if(_0x39aa14){if(_0x1fc87d[_0x6f84('0x5c')][_0x6f84('0x72')]){_0x5d83d8[_0x6f84('0x2a')][_0x6f84('0x73')]=util[_0x6f84('0x6c')](_0x6f84('0x74'),_0x1fc87d[_0x6f84('0x70')]['name']);_0x5d83d8[_0x6f84('0x2a')][_0x6f84('0x75')]=_0x5d83d8[_0x6f84('0x75')];_0x5d83d8[_0x6f84('0x2a')][_0x6f84('0x76')]=_0x6f84('0x60');return respondWithRpcPromise(_0x6f84('0x77'),'EventManager',{'event':_0x6f84('0x78'),'message':_0x5d83d8[_0x6f84('0x2a')]},client9002)[_0x6f84('0x22')](function(){return _0x5d83d8;});}return _0x5d83d8;}return null;})[_0x6f84('0x22')](respondWithResult(_0x2ba629,null))[_0x6f84('0x2c')](handleError(_0x2ba629,null));};var interaction_log=require('../../config/logger')(_0x6f84('0x5f'));exports[_0x6f84('0x36')]=function(_0x54291e,_0x272774,_0x35416b){var _0x34d712={'agent':{},'channel':'whatsapp'};if(_0x54291e[_0x6f84('0x5c')]['id']){delete _0x54291e[_0x6f84('0x5c')]['id'];}_0x54291e['body'][_0x6f84('0x65')]=_0x54291e['body']['UserId']||_0x54291e[_0x6f84('0x70')]['id'];_0x34d712['agent']['id']=_0x54291e[_0x6f84('0x5c')][_0x6f84('0x65')];return db['WhatsappMessage']['find']({'where':{'id':_0x54291e['params']['id'],'UserId':null}})[_0x6f84('0x22')](handleEntityNotFound(_0x272774,null))['then'](function(_0x504780){if(_0x504780){_0x34d712[_0x6f84('0x2a')]=_0x504780['get']({'plain':!![]});return db[_0x6f84('0x68')]['find']({'where':{'id':_0x504780[_0x6f84('0x69')]}});}return null;})[_0x6f84('0x22')](handleEntityNotFound(_0x272774,null))[_0x6f84('0x22')](function(_0x829ec5){if(_0x829ec5){_0x34d712['interaction']=_0x829ec5[_0x6f84('0x6e')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x54291e['user']['id'],_0x54291e['user'][_0x6f84('0x3a')],_0x54291e[_0x6f84('0x70')][_0x6f84('0x79')],_0x34d712[_0x6f84('0x6d')]['id'],_0x54291e[_0x6f84('0x5c')]?JSON[_0x6f84('0x27')](_0x54291e[_0x6f84('0x5c')]):_0x6f84('0x7a'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x34d712);}return null;})[_0x6f84('0x22')](function(_0x539c33){if(_0x539c33){_0x539c33[_0x6f84('0x2a')][_0x6f84('0x73')]=util[_0x6f84('0x6c')](_0x6f84('0x74'),_0x54291e[_0x6f84('0x70')][_0x6f84('0x3a')]);_0x539c33[_0x6f84('0x2a')][_0x6f84('0x75')]=_0x34d712['channel'];_0x539c33[_0x6f84('0x2a')][_0x6f84('0x76')]='reject';respondWithRpcPromise(_0x6f84('0x77'),_0x6f84('0x77'),{'event':_0x6f84('0x7b'),'message':_0x539c33[_0x6f84('0x2a')]},client9002);return _0x34d712;}return null;})[_0x6f84('0x22')](respondWithResult(_0x272774,null))[_0x6f84('0x2c')](handleError(_0x272774,null));};exports[_0x6f84('0x2e')]=function(_0xce4cd0,_0x4d2e55,_0x12e590){if(_0xce4cd0[_0x6f84('0x5c')]['id']){delete _0xce4cd0[_0x6f84('0x5c')]['id'];}var _0x27c9f7;return db[_0x6f84('0x3e')][_0x6f84('0x5a')]({'where':{'id':_0xce4cd0[_0x6f84('0x57')]['id']}})['then'](handleEntityNotFound(_0x4d2e55,null))[_0x6f84('0x22')](function(_0x5729cd){if(_0x5729cd){_0x27c9f7=_0x5729cd;return db['WhatsappAccount'][_0x6f84('0x5a')]({'where':{'id':_0x5729cd[_0x6f84('0x7c')]}});}})[_0x6f84('0x22')](handleEntityNotFound(_0x4d2e55,null))[_0x6f84('0x22')](function(_0x2ed727){if(_0x2ed727){logger[_0x6f84('0x25')](_0x6f84('0x7d'),_0x6f84('0x2e'),_0x6f84('0x7e'),_0x2ed727[_0x6f84('0x4f')],util[_0x6f84('0x7f')](_0xce4cd0[_0x6f84('0x5c')],{'showHidden':![],'depth':null}));switch(_0x2ed727['type']){case _0x6f84('0x80'):if(_0xce4cd0['body']['MessageSid']&&_0xce4cd0[_0x6f84('0x5c')][_0x6f84('0x81')]===_0x27c9f7[_0x6f84('0x82')]&&_0xce4cd0['body'][_0x6f84('0x83')]&&_0xce4cd0[_0x6f84('0x5c')][_0x6f84('0x83')]==='read'){return _0x27c9f7[_0x6f84('0x38')]({'read':!![]});}else{logger[_0x6f84('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status','twilio',util[_0x6f84('0x7f')](_0xce4cd0[_0x6f84('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x27c9f7;}})['then'](respondWithResult(_0x4d2e55,null))[_0x6f84('0x2c')](handleError(_0x4d2e55,null));}; \ No newline at end of file +var _0xbca0=['stringify','RejectMessage','event','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','html-pdf','eml-format','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','destroy','stack','name','index','WhatsappMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','filter','where','merge','options','includeAll','include','rows','show','params','length','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','format','UserId','user','CmContact','Contact','WhatsappInteraction','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x269b97,_0x10d133){var _0x120efa=function(_0xef252d){while(--_0xef252d){_0x269b97['push'](_0x269b97['shift']());}};_0x120efa(++_0x10d133);}(_0xbca0,0x8b));var _0x0bca=function(_0xc51f98,_0x2c9884){_0xc51f98=_0xc51f98-0x0;var _0x217926=_0xbca0[_0xc51f98];return _0x217926;};'use strict';var pdf=require(_0x0bca('0x0'));var emlformat=require(_0x0bca('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0bca('0x2'));var moment=require(_0x0bca('0x3'));var BPromise=require(_0x0bca('0x4'));var Mustache=require(_0x0bca('0x5'));var util=require('util');var path=require('path');var sox=require(_0x0bca('0x6'));var csv=require(_0x0bca('0x7'));var ejs=require(_0x0bca('0x8'));var fs=require('fs');var _=require(_0x0bca('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0bca('0xa'));var toCsv=require(_0x0bca('0x7'));var querystring=require(_0x0bca('0xb'));var Papa=require(_0x0bca('0xc'));var Redis=require(_0x0bca('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0bca('0xe'));var hardwareService=require(_0x0bca('0xf'));var logger=require(_0x0bca('0x10'))(_0x0bca('0x11'));var utils=require(_0x0bca('0x12'));var config=require(_0x0bca('0x13'));var licenseUtil=require(_0x0bca('0x14'));var db=require(_0x0bca('0x15'))['db'];config[_0x0bca('0x16')]=_[_0x0bca('0x17')](config[_0x0bca('0x16')],{'host':_0x0bca('0x18'),'port':0x18eb});var socket=require(_0x0bca('0x19'))(new Redis(config[_0x0bca('0x16')]));require(_0x0bca('0x1a'))[_0x0bca('0x1b')](socket);var jayson=require(_0x0bca('0x1c'));var client=jayson[_0x0bca('0x1d')][_0x0bca('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x0bca('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x464fbf,_0x13c80a,_0x2e1c82,_0x466b72){return new BPromise(function(_0x2ed970,_0x44f6d1){var _0x512830=_0x466b72||client;return _0x512830[_0x0bca('0x1f')](_0x464fbf,_0x2e1c82)[_0x0bca('0x20')](function(_0x821736){logger[_0x0bca('0x21')](_0x0bca('0x22'),_0x13c80a,_0x0bca('0x23'));logger[_0x0bca('0x24')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x13c80a,_0x0bca('0x23'),JSON['stringify'](_0x821736));if(_0x821736['error']){if(_0x821736[_0x0bca('0x25')][_0x0bca('0x26')]===0x1f4){logger[_0x0bca('0x25')](_0x0bca('0x22'),_0x13c80a,_0x821736[_0x0bca('0x25')][_0x0bca('0x27')]);return _0x44f6d1(_0x821736['error'][_0x0bca('0x27')]);}logger[_0x0bca('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x13c80a,_0x821736[_0x0bca('0x25')][_0x0bca('0x27')]);return _0x2ed970(_0x821736[_0x0bca('0x25')][_0x0bca('0x27')]);}else{logger[_0x0bca('0x21')](_0x0bca('0x22'),_0x13c80a,_0x0bca('0x23'));_0x2ed970(_0x821736['result'][_0x0bca('0x27')]);}})[_0x0bca('0x28')](function(_0x2cece9){logger[_0x0bca('0x25')](_0x0bca('0x22'),_0x13c80a,_0x2cece9);_0x44f6d1(_0x2cece9);});});}function respondWithStatusCode(_0x1d7f87,_0x1fafc9){_0x1fafc9=_0x1fafc9||0xcc;return function(_0xabafd1){if(_0xabafd1){return _0x1d7f87[_0x0bca('0x29')](_0x1fafc9);}return _0x1d7f87[_0x0bca('0x2a')](_0x1fafc9)[_0x0bca('0x2b')]();};}function respondWithResult(_0x3fc816,_0x45f4da){_0x45f4da=_0x45f4da||0xc8;return function(_0x268df5){if(_0x268df5){return _0x3fc816[_0x0bca('0x2a')](_0x45f4da)[_0x0bca('0x2c')](_0x268df5);}};}function respondWithFilteredResult(_0x3d687c,_0x1b7e2b){return function(_0x1be2b7){if(_0x1be2b7){var _0x3810ed=_0x1be2b7[_0x0bca('0x2d')],_0x262959=_0x1b7e2b[_0x0bca('0x2e')],_0x1e7566=_0x1b7e2b[_0x0bca('0x2e')]+_0x1b7e2b[_0x0bca('0x2f')],_0x552022;if(_0x1e7566>=_0x3810ed){_0x1e7566=_0x3810ed;_0x552022=0xc8;}else{_0x552022=0xce;}_0x3d687c[_0x0bca('0x2a')](_0x552022);return _0x3d687c['set']('Content-Range',_0x262959+'-'+_0x1e7566+'/'+_0x3810ed)[_0x0bca('0x2c')](_0x1be2b7);}return null;};}function patchUpdates(_0x37899a){return function(_0x23ab74){try{jsonpatch[_0x0bca('0x30')](_0x23ab74,_0x37899a,!![]);}catch(_0x37808f){return BPromise[_0x0bca('0x31')](_0x37808f);}return _0x23ab74[_0x0bca('0x32')]();};}function saveUpdates(_0x3fa3c3,_0x3baa39){return function(_0x300cd7){if(_0x300cd7){return _0x300cd7[_0x0bca('0x33')](_0x3fa3c3)[_0x0bca('0x20')](function(_0x177a90){return _0x177a90;});}return null;};}function removeEntity(_0x40b08a,_0x3e1d36){return function(_0x1832b3){if(_0x1832b3){return _0x1832b3[_0x0bca('0x34')]()[_0x0bca('0x20')](function(){_0x40b08a[_0x0bca('0x2a')](0xcc)[_0x0bca('0x2b')]();});}};}function handleEntityNotFound(_0x184773,_0x519e5e){return function(_0x209d3d){if(!_0x209d3d){_0x184773[_0x0bca('0x29')](0x194);}return _0x209d3d;};}function handleError(_0x4512ee,_0x1a9f16){_0x1a9f16=_0x1a9f16||0x1f4;return function(_0x8aea9e){logger[_0x0bca('0x25')](_0x8aea9e[_0x0bca('0x35')]);if(_0x8aea9e[_0x0bca('0x36')]){delete _0x8aea9e[_0x0bca('0x36')];}_0x4512ee[_0x0bca('0x2a')](_0x1a9f16)['send'](_0x8aea9e);};}exports[_0x0bca('0x37')]=function(_0xc6a3e3,_0x199592){var _0x14e9d4={},_0x8b3431={},_0x4b649b={'count':0x0,'rows':[]};var _0xc1e63d=_['map'](db[_0x0bca('0x38')][_0x0bca('0x39')],function(_0x2051eb){return{'name':_0x2051eb[_0x0bca('0x3a')],'type':_0x2051eb[_0x0bca('0x3b')][_0x0bca('0x3c')]};});_0x8b3431[_0x0bca('0x3d')]=_[_0x0bca('0x3e')](_0xc1e63d,_0x0bca('0x36'));_0x8b3431[_0x0bca('0x3f')]=_[_0x0bca('0x40')](_0xc6a3e3['query']);_0x8b3431[_0x0bca('0x41')]=_[_0x0bca('0x42')](_0x8b3431[_0x0bca('0x3d')],_0x8b3431[_0x0bca('0x3f')]);_0x14e9d4['attributes']=_[_0x0bca('0x42')](_0x8b3431[_0x0bca('0x3d')],qs['fields'](_0xc6a3e3['query'][_0x0bca('0x43')]));_0x14e9d4[_0x0bca('0x44')]=_0x14e9d4[_0x0bca('0x44')]['length']?_0x14e9d4['attributes']:_0x8b3431['model'];if(!_0xc6a3e3[_0x0bca('0x3f')][_0x0bca('0x45')]('nolimit')){_0x14e9d4['limit']=qs[_0x0bca('0x2f')](_0xc6a3e3['query'][_0x0bca('0x2f')]);_0x14e9d4[_0x0bca('0x2e')]=qs[_0x0bca('0x2e')](_0xc6a3e3[_0x0bca('0x3f')][_0x0bca('0x2e')]);}_0x14e9d4['order']=qs[_0x0bca('0x46')](_0xc6a3e3[_0x0bca('0x3f')]['sort']);_0x14e9d4['where']=qs[_0x0bca('0x41')](_['pick'](_0xc6a3e3[_0x0bca('0x3f')],_0x8b3431[_0x0bca('0x41')]),_0xc1e63d);if(_0xc6a3e3[_0x0bca('0x3f')][_0x0bca('0x47')]){_0x14e9d4[_0x0bca('0x48')]=_[_0x0bca('0x49')](_0x14e9d4[_0x0bca('0x48')],{'$or':_[_0x0bca('0x3e')](_0xc1e63d,function(_0x30f01c){if(_0x30f01c['type']!=='VIRTUAL'){var _0x2b022a={};_0x2b022a[_0x30f01c[_0x0bca('0x36')]]={'$like':'%'+_0xc6a3e3[_0x0bca('0x3f')][_0x0bca('0x47')]+'%'};return _0x2b022a;}})});}_0x14e9d4=_['merge']({},_0x14e9d4,_0xc6a3e3[_0x0bca('0x4a')]);var _0x4840ce={'where':_0x14e9d4['where']};return db[_0x0bca('0x38')]['count'](_0x4840ce)[_0x0bca('0x20')](function(_0x4c39e6){_0x4b649b['count']=_0x4c39e6;if(_0xc6a3e3[_0x0bca('0x3f')][_0x0bca('0x4b')]){_0x14e9d4[_0x0bca('0x4c')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x14e9d4);})[_0x0bca('0x20')](function(_0x4259be){_0x4b649b[_0x0bca('0x4d')]=_0x4259be;return _0x4b649b;})[_0x0bca('0x20')](respondWithFilteredResult(_0x199592,_0x14e9d4))[_0x0bca('0x28')](handleError(_0x199592,null));};exports[_0x0bca('0x4e')]=function(_0x5a04b8,_0x3f80be){var _0x5a1f7c={'raw':!![],'where':{'id':_0x5a04b8[_0x0bca('0x4f')]['id']}},_0x3a8ccb={};_0x3a8ccb[_0x0bca('0x3d')]=_[_0x0bca('0x40')](db[_0x0bca('0x38')]['rawAttributes']);_0x3a8ccb['query']=_[_0x0bca('0x40')](_0x5a04b8[_0x0bca('0x3f')]);_0x3a8ccb['filters']=_[_0x0bca('0x42')](_0x3a8ccb[_0x0bca('0x3d')],_0x3a8ccb[_0x0bca('0x3f')]);_0x5a1f7c[_0x0bca('0x44')]=_['intersection'](_0x3a8ccb[_0x0bca('0x3d')],qs[_0x0bca('0x43')](_0x5a04b8[_0x0bca('0x3f')]['fields']));_0x5a1f7c[_0x0bca('0x44')]=_0x5a1f7c[_0x0bca('0x44')][_0x0bca('0x50')]?_0x5a1f7c[_0x0bca('0x44')]:_0x3a8ccb[_0x0bca('0x3d')];if(_0x5a04b8[_0x0bca('0x3f')][_0x0bca('0x4b')]){_0x5a1f7c[_0x0bca('0x4c')]=[{'all':!![]}];}_0x5a1f7c=_[_0x0bca('0x49')]({},_0x5a1f7c,_0x5a04b8[_0x0bca('0x4a')]);return db[_0x0bca('0x38')][_0x0bca('0x51')](_0x5a1f7c)[_0x0bca('0x20')](handleEntityNotFound(_0x3f80be,null))[_0x0bca('0x20')](respondWithResult(_0x3f80be,null))['catch'](handleError(_0x3f80be,null));};exports[_0x0bca('0x52')]=function(_0x22d293,_0x154dfc){return db[_0x0bca('0x38')]['create'](_0x22d293['body'],{})['then'](respondWithResult(_0x154dfc,0xc9))['catch'](handleError(_0x154dfc,null));};exports[_0x0bca('0x33')]=function(_0x545568,_0x4fd99f){if(_0x545568[_0x0bca('0x53')]['id']){delete _0x545568['body']['id'];}return db[_0x0bca('0x38')][_0x0bca('0x51')]({'where':{'id':_0x545568[_0x0bca('0x4f')]['id']}})[_0x0bca('0x20')](handleEntityNotFound(_0x4fd99f,null))[_0x0bca('0x20')](saveUpdates(_0x545568[_0x0bca('0x53')],null))['then'](respondWithResult(_0x4fd99f,null))[_0x0bca('0x28')](handleError(_0x4fd99f,null));};exports[_0x0bca('0x34')]=function(_0x1dd9c6,_0x1956de){return db[_0x0bca('0x38')][_0x0bca('0x51')]({'where':{'id':_0x1dd9c6[_0x0bca('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1956de,null))[_0x0bca('0x20')](removeEntity(_0x1956de,null))['catch'](handleError(_0x1956de,null));};exports[_0x0bca('0x54')]=function(_0x1d34f0,_0x5a4b2a){return db[_0x0bca('0x38')]['describe']()[_0x0bca('0x20')](respondWithResult(_0x5a4b2a,null))['catch'](handleError(_0x5a4b2a,null));};var interaction_log=require('../../config/logger')(_0x0bca('0x55'));exports[_0x0bca('0x56')]=function(_0x387dc2,_0x4b495a,_0x342abb){var _0x5051e1={'agent':{},'channel':_0x0bca('0x57')};if(_0x387dc2[_0x0bca('0x53')]['id']){delete _0x387dc2[_0x0bca('0x53')]['id'];}_0x387dc2[_0x0bca('0x53')][_0x0bca('0x58')]=!![];_0x387dc2['body']['readAt']=moment()[_0x0bca('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x387dc2['body']['UserId']=_0x387dc2[_0x0bca('0x53')][_0x0bca('0x5a')]||_0x387dc2[_0x0bca('0x5b')]['id'];_0x5051e1['agent']['id']=_0x387dc2[_0x0bca('0x53')][_0x0bca('0x5a')];return db[_0x0bca('0x38')][_0x0bca('0x51')]({'where':{'id':_0x387dc2['params']['id'],'UserId':null},'include':[{'model':db[_0x0bca('0x5c')],'as':_0x0bca('0x5d')}]})[_0x0bca('0x20')](handleEntityNotFound(_0x4b495a,null))[_0x0bca('0x20')](saveUpdates(_0x387dc2[_0x0bca('0x53')],null))[_0x0bca('0x20')](function(_0x2d4286){if(_0x2d4286){_0x5051e1['message']=_0x2d4286['get']({'plain':!![]});return db[_0x0bca('0x5e')][_0x0bca('0x51')]({'where':{'id':_0x2d4286['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4b495a,null))[_0x0bca('0x20')](function(_0x4572d7){if(_0x4572d7){return _0x4572d7[_0x0bca('0x33')]({'UserId':_0x387dc2['body'][_0x0bca('0x5a')],'read1stAt':_[_0x0bca('0x5f')](_0x4572d7['read1stAt'])?moment()[_0x0bca('0x59')](_0x0bca('0x60')):undefined});}return null;})[_0x0bca('0x20')](function(_0xac6135){if(_0xac6135){_0x5051e1[_0x0bca('0x61')]=_0xac6135[_0x0bca('0x62')]({'plain':!![]});interaction_log[_0x0bca('0x21')](_0x0bca('0x63'),_0x387dc2['user']['id'],_0x387dc2[_0x0bca('0x5b')][_0x0bca('0x36')],_0x387dc2['user'][_0x0bca('0x64')],_0x5051e1[_0x0bca('0x61')]['id'],_0x387dc2[_0x0bca('0x53')]?JSON['stringify'](_0x387dc2[_0x0bca('0x53')]):_0x0bca('0x65'));return respondWithRpcPromise('AcceptMessage',_0x0bca('0x66'),_0x5051e1);}return null;})['then'](function(_0x17923f){if(_0x17923f){if(_0x387dc2[_0x0bca('0x53')][_0x0bca('0x67')]){_0x5051e1['message'][_0x0bca('0x68')]=util[_0x0bca('0x59')](_0x0bca('0x69'),_0x387dc2['user'][_0x0bca('0x36')]);_0x5051e1[_0x0bca('0x27')][_0x0bca('0x6a')]=_0x5051e1[_0x0bca('0x6a')];_0x5051e1['message']['event']=_0x0bca('0x56');return respondWithRpcPromise(_0x0bca('0x6b'),_0x0bca('0x6b'),{'event':_0x0bca('0x6c'),'message':_0x5051e1[_0x0bca('0x27')]},client9002)[_0x0bca('0x20')](function(){return _0x5051e1;});}return _0x5051e1;}return null;})[_0x0bca('0x20')](respondWithResult(_0x4b495a,null))[_0x0bca('0x28')](handleError(_0x4b495a,null));};var interaction_log=require(_0x0bca('0x10'))('whatsapp-interactions');exports[_0x0bca('0x31')]=function(_0x504ff7,_0x5af147,_0x1b8abd){var _0x5bbbec={'agent':{},'channel':_0x0bca('0x57')};if(_0x504ff7['body']['id']){delete _0x504ff7[_0x0bca('0x53')]['id'];}_0x504ff7['body']['UserId']=_0x504ff7['body'][_0x0bca('0x5a')]||_0x504ff7['user']['id'];_0x5bbbec['agent']['id']=_0x504ff7[_0x0bca('0x53')][_0x0bca('0x5a')];return db[_0x0bca('0x38')][_0x0bca('0x51')]({'where':{'id':_0x504ff7[_0x0bca('0x4f')]['id'],'UserId':null}})[_0x0bca('0x20')](handleEntityNotFound(_0x5af147,null))[_0x0bca('0x20')](function(_0x46e94d){if(_0x46e94d){_0x5bbbec['message']=_0x46e94d[_0x0bca('0x62')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x46e94d[_0x0bca('0x6d')]}});}return null;})[_0x0bca('0x20')](handleEntityNotFound(_0x5af147,null))[_0x0bca('0x20')](function(_0x50359a){if(_0x50359a){_0x5bbbec[_0x0bca('0x61')]=_0x50359a[_0x0bca('0x62')]({'plain':!![]});interaction_log[_0x0bca('0x21')](_0x0bca('0x6e'),_0x504ff7[_0x0bca('0x5b')]['id'],_0x504ff7['user'][_0x0bca('0x36')],_0x504ff7[_0x0bca('0x5b')][_0x0bca('0x64')],_0x5bbbec[_0x0bca('0x61')]['id'],_0x504ff7['body']?JSON[_0x0bca('0x6f')](_0x504ff7['body']):'null');return respondWithRpcPromise(_0x0bca('0x70'),'rejectMessage',_0x5bbbec);}return null;})[_0x0bca('0x20')](function(_0x1b8fc2){if(_0x1b8fc2){_0x1b8fc2[_0x0bca('0x27')]['interface']=util['format']('SIP/%s',_0x504ff7[_0x0bca('0x5b')][_0x0bca('0x36')]);_0x1b8fc2[_0x0bca('0x27')]['channel']=_0x5bbbec['channel'];_0x1b8fc2[_0x0bca('0x27')][_0x0bca('0x71')]='reject';respondWithRpcPromise(_0x0bca('0x6b'),'EventManager',{'event':_0x0bca('0x72'),'message':_0x1b8fc2[_0x0bca('0x27')]},client9002);return _0x5bbbec;}return null;})[_0x0bca('0x20')](respondWithResult(_0x5af147,null))[_0x0bca('0x28')](handleError(_0x5af147,null));};exports['status']=function(_0x5a5d76,_0xcf2296,_0x34b918){if(_0x5a5d76[_0x0bca('0x53')]['id']){delete _0x5a5d76['body']['id'];}var _0x2722d3;return db[_0x0bca('0x38')]['find']({'where':{'id':_0x5a5d76['params']['id']}})['then'](handleEntityNotFound(_0xcf2296,null))[_0x0bca('0x20')](function(_0x534295){if(_0x534295){_0x2722d3=_0x534295;return db[_0x0bca('0x73')][_0x0bca('0x51')]({'where':{'id':_0x534295[_0x0bca('0x74')]}});}})[_0x0bca('0x20')](handleEntityNotFound(_0xcf2296,null))[_0x0bca('0x20')](function(_0x297d55){if(_0x297d55){logger['debug'](_0x0bca('0x75'),'status',_0x0bca('0x76'),_0x297d55['type'],util['inspect'](_0x5a5d76[_0x0bca('0x53')],{'showHidden':![],'depth':null}));switch(_0x297d55[_0x0bca('0x3b')]){case _0x0bca('0x77'):if(_0x5a5d76['body'][_0x0bca('0x78')]&&_0x5a5d76['body'][_0x0bca('0x78')]===_0x2722d3[_0x0bca('0x79')]&&_0x5a5d76[_0x0bca('0x53')][_0x0bca('0x7a')]&&_0x5a5d76[_0x0bca('0x53')][_0x0bca('0x7a')]===_0x0bca('0x58')){return _0x2722d3[_0x0bca('0x33')]({'read':!![]});}else{logger[_0x0bca('0x25')](_0x0bca('0x7b'),_0x0bca('0x2a'),'twilio',util[_0x0bca('0x7c')](_0x5a5d76[_0x0bca('0x53')],{'showHidden':![],'depth':null}));}break;}return _0x2722d3;}})[_0x0bca('0x20')](respondWithResult(_0xcf2296,null))[_0x0bca('0x28')](handleError(_0xcf2296,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 2f31732..c2a4ba0 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x40ed5a,_0x1773fa){var _0x33db26=function(_0x4526bb){while(--_0x4526bb){_0x40ed5a['push'](_0x40ed5a['shift']());}};_0x33db26(++_0x1773fa);}(_0xb10b,0x12a));var _0xbb10=function(_0x4f229e,_0x1b1e6c){_0x4f229e=_0x4f229e-0x0;var _0x407c5e=_0xb10b[_0x4f229e];return _0x407c5e;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x7a54=['WhatsappMessage','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x31e5cf,_0x4db5bd){var _0x111477=function(_0x2c726f){while(--_0x2c726f){_0x31e5cf['push'](_0x31e5cf['shift']());}};_0x111477(++_0x4db5bd);}(_0x7a54,0x106));var _0x47a5=function(_0x190bfa,_0x1a4c5a){_0x190bfa=_0x190bfa-0x0;var _0x264a88=_0x7a54[_0x190bfa];return _0x264a88;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var WhatsappMessage=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){WhatsappMessageEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);WhatsappMessageEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 835abfd..5f8b151 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 _0x6662=['finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./whatsappMessage.attributes','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','toLowerCase','direction','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','catch','error','secret','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','/api/whatsapp/messages/','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken'];(function(_0x1d8119,_0xc98f17){var _0x3e30f6=function(_0x2c7f3e){while(--_0x2c7f3e){_0x1d8119['push'](_0x1d8119['shift']());}};_0x3e30f6(++_0xc98f17);}(_0x6662,0x1aa));var _0x2666=function(_0xb0fe92,_0x147e42){_0xb0fe92=_0xb0fe92-0x0;var _0x41787f=_0x6662[_0xb0fe92];return _0x41787f;};'use strict';var _=require('lodash');var util=require(_0x2666('0x0'));var logger=require(_0x2666('0x1'))(_0x2666('0x2'));var moment=require(_0x2666('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2666('0x4'));var rimraf=require(_0x2666('0x5'));var config=require(_0x2666('0x6'));var attributes=require(_0x2666('0x7'));module['exports']=function(_0x3d3e39,_0x45919d){return _0x3d3e39['define'](_0x2666('0x8'),attributes,{'tableName':_0x2666('0x9'),'paranoid':![],'indexes':[{'name':_0x2666('0xa'),'fields':[_0x2666('0xa')]},{'name':_0x2666('0xb'),'fields':['body'],'type':_0x2666('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3efef5,_0x2b3047,_0x5705df){var _0x285808=_0x3d3e39[_0x2666('0xd')];var _0x48fc5b=_0x3efef5['get']({'plain':!![]});if(_0x48fc5b['direction'][_0x2666('0xe')]()==='in'||_0x48fc5b[_0x2666('0xf')][_0x2666('0xe')]()==='out'&&!_0x48fc5b['secret']&&!_[_0x2666('0x10')](_0x48fc5b[_0x2666('0x11')])){_0x285808[_0x2666('0x12')][_0x2666('0x13')]({'where':{'id':_0x48fc5b[_0x2666('0x14')]}})[_0x2666('0x15')](function(_0x13144d){if(_0x13144d){_0x13144d['update']({'lastMsgAt':_0x48fc5b[_0x2666('0x16')],'lastMsgDirection':_0x48fc5b[_0x2666('0xf')][_0x2666('0xe')]()});}})[_0x2666('0x17')](function(_0x27b5eb){console[_0x2666('0x18')](_0x27b5eb);});}if(_0x48fc5b[_0x2666('0xf')]==='out'&&!_0x48fc5b[_0x2666('0x19')]){var _0x54b0a2;_0x285808[_0x2666('0x1a')]['find']({'where':{'id':_0x48fc5b[_0x2666('0x1b')]},'raw':!![]})['then'](function(_0x5c4eed){_0x54b0a2=_0x5c4eed;if(_0x54b0a2&&_0x54b0a2[_0x2666('0x1c')]){switch(_0x54b0a2[_0x2666('0x1c')]){case _0x2666('0x1d'):var _0x467c88=require(_0x2666('0x1d'));if(_0x54b0a2[_0x2666('0x1e')]&&_0x54b0a2['authToken']&&_0x54b0a2[_0x2666('0x1f')]){var _0x2e1144=new _0x467c88(_0x54b0a2['accountSid'],_0x54b0a2[_0x2666('0x20')]);_0x2e1144[_0x2666('0x21')][_0x2666('0x22')]({'body':_0x48fc5b['body'],'to':_0x2666('0x23')+_0x48fc5b[_0x2666('0x1f')],'from':'whatsapp:'+_0x54b0a2[_0x2666('0x1f')],'statusCallback':_0x54b0a2['remote']+_0x2666('0x24')+_0x48fc5b['id']+'/status?token='+_0x54b0a2[_0x2666('0x25')]})['then'](function(_0x3f2007){if(_0x3f2007[_0x2666('0x26')]){return _0x3efef5[_0x2666('0x27')]({'messageId':_0x3f2007[_0x2666('0x26')]});}})[_0x2666('0x17')](function(_0x4b3d77){logger[_0x2666('0x18')](_0x2666('0x28'),_0x2666('0x29'),_0x2666('0x1d'),util[_0x2666('0x2a')](_0x4b3d77,{'showHidden':![],'depth':null}));});}else{logger[_0x2666('0x18')](_0x2666('0x28'),'afterCreate',_0x2666('0x1d'),_0x2666('0x2b'));}break;}}})[_0x2666('0x2c')](function(){_0x5705df();});}else{_0x5705df();}}},'charset':_0x2666('0x2d'),'collate':_0x2666('0x2e')});}; \ No newline at end of file +var _0xb419=['moment','bluebird','request-promise','path','rimraf','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','out','secret','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x4291a1,_0x45b56a){var _0x504d5b=function(_0xe1b4ca){while(--_0xe1b4ca){_0x4291a1['push'](_0x4291a1['shift']());}};_0x504d5b(++_0x45b56a);}(_0xb419,0xbe));var _0x9b41=function(_0x1da1c3,_0x19d334){_0x1da1c3=_0x1da1c3-0x0;var _0x418329=_0xb419[_0x1da1c3];return _0x418329;};'use strict';var _=require(_0x9b41('0x0'));var util=require('util');var logger=require(_0x9b41('0x1'))('api');var moment=require(_0x9b41('0x2'));var BPromise=require(_0x9b41('0x3'));var rp=require(_0x9b41('0x4'));var fs=require('fs');var path=require(_0x9b41('0x5'));var rimraf=require(_0x9b41('0x6'));var config=require('../../config/environment');var attributes=require(_0x9b41('0x7'));module[_0x9b41('0x8')]=function(_0xd28289,_0x1f7267){return _0xd28289['define'](_0x9b41('0x9'),attributes,{'tableName':_0x9b41('0xa'),'paranoid':![],'indexes':[{'name':_0x9b41('0xb'),'fields':[_0x9b41('0xb')]},{'name':'fti_whatsapp_messages','fields':[_0x9b41('0xc')],'type':_0x9b41('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x218a55,_0x5569af,_0x40458c){var _0x12ae0c=_0xd28289[_0x9b41('0xe')];var _0x49413b=_0x218a55[_0x9b41('0xf')]({'plain':!![]});if(_0x49413b[_0x9b41('0x10')][_0x9b41('0x11')]()==='in'||_0x49413b[_0x9b41('0x10')][_0x9b41('0x11')]()==='out'&&!_0x49413b['secret']&&!_['isNil'](_0x49413b[_0x9b41('0x12')])){_0x12ae0c[_0x9b41('0x13')][_0x9b41('0x14')]({'where':{'id':_0x49413b[_0x9b41('0x15')]}})[_0x9b41('0x16')](function(_0x59b53e){if(_0x59b53e){_0x59b53e[_0x9b41('0x17')]({'lastMsgAt':_0x49413b[_0x9b41('0x18')],'lastMsgDirection':_0x49413b['direction'][_0x9b41('0x11')]()});}})[_0x9b41('0x19')](function(_0x885583){console[_0x9b41('0x1a')](_0x885583);});}if(_0x49413b['direction']===_0x9b41('0x1b')&&!_0x49413b[_0x9b41('0x1c')]){var _0x564ef9;_0x12ae0c['WhatsappAccount'][_0x9b41('0x1d')]({'where':{'id':_0x49413b[_0x9b41('0x1e')]},'raw':!![]})['then'](function(_0x36cdd1){_0x564ef9=_0x36cdd1;if(_0x564ef9&&_0x564ef9[_0x9b41('0x1f')]){switch(_0x564ef9[_0x9b41('0x1f')]){case _0x9b41('0x20'):var _0x15f562=require('twilio');if(_0x564ef9[_0x9b41('0x21')]&&_0x564ef9[_0x9b41('0x22')]&&_0x564ef9[_0x9b41('0x23')]){var _0x2d6e77=new _0x15f562(_0x564ef9[_0x9b41('0x21')],_0x564ef9[_0x9b41('0x22')]);_0x2d6e77['messages'][_0x9b41('0x24')]({'body':_0x49413b[_0x9b41('0xc')],'to':_0x9b41('0x25')+_0x49413b[_0x9b41('0x23')],'from':_0x9b41('0x25')+_0x564ef9[_0x9b41('0x23')],'statusCallback':_0x564ef9[_0x9b41('0x26')]+_0x9b41('0x27')+_0x49413b['id']+_0x9b41('0x28')+_0x564ef9['token']})[_0x9b41('0x16')](function(_0x46af0b){if(_0x46af0b[_0x9b41('0x29')]){return _0x218a55['update']({'messageId':_0x46af0b[_0x9b41('0x29')]});}})[_0x9b41('0x19')](function(_0x5d5150){logger['error'](_0x9b41('0x2a'),_0x9b41('0x2b'),_0x9b41('0x20'),util[_0x9b41('0x2c')](_0x5d5150,{'showHidden':![],'depth':null}));});}else{logger[_0x9b41('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9b41('0x20'),_0x9b41('0x2d'));}break;}}})['finally'](function(){_0x40458c();});}else{_0x40458c();}}},'charset':_0x9b41('0x2e'),'collate':_0x9b41('0x2f')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index c8e02df..8b9260a 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 _0x8f98=['error','code','message','result','catch','WhatsappMessage','create','body','options','raw','CreateWhatsappMessage','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x8f98,0x1a3));var _0x88f9=function(_0x3f73d7,_0x4e7032){_0x3f73d7=_0x3f73d7-0x0;var _0x500471=_0x8f98[_0x3f73d7];return _0x500471;};'use strict';var _=require(_0x88f9('0x0'));var util=require(_0x88f9('0x1'));var moment=require(_0x88f9('0x2'));var BPromise=require(_0x88f9('0x3'));var rs=require(_0x88f9('0x4'));var fs=require('fs');var Redis=require(_0x88f9('0x5'));var db=require(_0x88f9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x88f9('0x7'))(_0x88f9('0x8'));var config=require(_0x88f9('0x9'));var jayson=require(_0x88f9('0xa'));var client=jayson[_0x88f9('0xb')][_0x88f9('0xc')]({'port':0x232a});config[_0x88f9('0xd')]=_[_0x88f9('0xe')](config[_0x88f9('0xd')],{'host':_0x88f9('0xf'),'port':0x18eb});var socket=require(_0x88f9('0x10'))(new Redis(config['redis']));require(_0x88f9('0x11'))[_0x88f9('0x12')](socket);function respondWithRpcPromise(_0x4fae01,_0x483422,_0x33512a){return new BPromise(function(_0x4a40fd,_0xcb02e7){return client[_0x88f9('0x13')](_0x4fae01,_0x33512a)[_0x88f9('0x14')](function(_0x4390f7){logger[_0x88f9('0x15')](_0x88f9('0x16'),_0x483422,_0x88f9('0x17'));logger[_0x88f9('0x18')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x483422,_0x88f9('0x17'),JSON['stringify'](_0x4390f7));if(_0x4390f7[_0x88f9('0x19')]){if(_0x4390f7[_0x88f9('0x19')][_0x88f9('0x1a')]===0x1f4){logger['error'](_0x88f9('0x16'),_0x483422,_0x4390f7[_0x88f9('0x19')][_0x88f9('0x1b')]);return _0xcb02e7(_0x4390f7[_0x88f9('0x19')][_0x88f9('0x1b')]);}logger[_0x88f9('0x19')](_0x88f9('0x16'),_0x483422,_0x4390f7[_0x88f9('0x19')]['message']);return _0x4a40fd(_0x4390f7[_0x88f9('0x19')][_0x88f9('0x1b')]);}else{logger[_0x88f9('0x15')](_0x88f9('0x16'),_0x483422,_0x88f9('0x17'));_0x4a40fd(_0x4390f7[_0x88f9('0x1c')][_0x88f9('0x1b')]);}})[_0x88f9('0x1d')](function(_0x25a04b){logger[_0x88f9('0x19')](_0x88f9('0x16'),_0x483422,_0x25a04b);_0xcb02e7(_0x25a04b);});});}exports['CreateWhatsappMessage']=function(_0xb1a2b2){var _0x396e93=this;return new Promise(function(_0x426eec,_0x5adcdb){return db[_0x88f9('0x1e')][_0x88f9('0x1f')](_0xb1a2b2[_0x88f9('0x20')],{'raw':_0xb1a2b2[_0x88f9('0x21')]?_0xb1a2b2[_0x88f9('0x21')][_0x88f9('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x3d6c86){logger[_0x88f9('0x15')]('CreateWhatsappMessage',_0xb1a2b2);logger[_0x88f9('0x18')](_0x88f9('0x23'),_0xb1a2b2,JSON[_0x88f9('0x24')](_0x3d6c86));_0x426eec(_0x3d6c86);})[_0x88f9('0x1d')](function(_0x48a7b5){logger[_0x88f9('0x19')](_0x88f9('0x23'),_0x48a7b5[_0x88f9('0x1b')],_0xb1a2b2);_0x5adcdb(_0x396e93[_0x88f9('0x19')](0x1f4,_0x48a7b5[_0x88f9('0x1b')]));});});}; \ No newline at end of file +var _0x9eb0=['create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage'];(function(_0x367e4e,_0x299b26){var _0x2a0738=function(_0x16cc74){while(--_0x16cc74){_0x367e4e['push'](_0x367e4e['shift']());}};_0x2a0738(++_0x299b26);}(_0x9eb0,0xd0));var _0x09eb=function(_0x22317b,_0x3c7309){_0x22317b=_0x22317b-0x0;var _0x56d628=_0x9eb0[_0x22317b];return _0x56d628;};'use strict';var _=require('lodash');var util=require(_0x09eb('0x0'));var moment=require(_0x09eb('0x1'));var BPromise=require(_0x09eb('0x2'));var rs=require(_0x09eb('0x3'));var fs=require('fs');var Redis=require(_0x09eb('0x4'));var db=require(_0x09eb('0x5'))['db'];var utils=require(_0x09eb('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x09eb('0x7'));var jayson=require(_0x09eb('0x8'));var client=jayson[_0x09eb('0x9')][_0x09eb('0xa')]({'port':0x232a});config[_0x09eb('0xb')]=_[_0x09eb('0xc')](config[_0x09eb('0xb')],{'host':_0x09eb('0xd'),'port':0x18eb});var socket=require(_0x09eb('0xe'))(new Redis(config[_0x09eb('0xb')]));require(_0x09eb('0xf'))[_0x09eb('0x10')](socket);function respondWithRpcPromise(_0x3a9427,_0x38fbe3,_0x3c4aac){return new BPromise(function(_0x4369f8,_0xf579d2){return client['request'](_0x3a9427,_0x3c4aac)[_0x09eb('0x11')](function(_0x48f7bd){logger[_0x09eb('0x12')](_0x09eb('0x13'),_0x38fbe3,_0x09eb('0x14'));logger[_0x09eb('0x15')](_0x09eb('0x16'),_0x38fbe3,'request\x20sent',JSON[_0x09eb('0x17')](_0x48f7bd));if(_0x48f7bd['error']){if(_0x48f7bd[_0x09eb('0x18')][_0x09eb('0x19')]===0x1f4){logger[_0x09eb('0x18')](_0x09eb('0x13'),_0x38fbe3,_0x48f7bd[_0x09eb('0x18')][_0x09eb('0x1a')]);return _0xf579d2(_0x48f7bd['error'][_0x09eb('0x1a')]);}logger[_0x09eb('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x38fbe3,_0x48f7bd[_0x09eb('0x18')][_0x09eb('0x1a')]);return _0x4369f8(_0x48f7bd['error'][_0x09eb('0x1a')]);}else{logger[_0x09eb('0x12')](_0x09eb('0x13'),_0x38fbe3,'request\x20sent');_0x4369f8(_0x48f7bd[_0x09eb('0x1b')][_0x09eb('0x1a')]);}})[_0x09eb('0x1c')](function(_0x5ea0b4){logger[_0x09eb('0x18')](_0x09eb('0x13'),_0x38fbe3,_0x5ea0b4);_0xf579d2(_0x5ea0b4);});});}exports[_0x09eb('0x1d')]=function(_0x4099f6){var _0x3077ef=this;return new Promise(function(_0x429d28,_0x26c338){return db['WhatsappMessage'][_0x09eb('0x1e')](_0x4099f6[_0x09eb('0x1f')],{'raw':_0x4099f6[_0x09eb('0x20')]?_0x4099f6['options'][_0x09eb('0x21')]===undefined?!![]:![]:!![]})[_0x09eb('0x11')](function(_0x3d0dfb){logger[_0x09eb('0x12')]('CreateWhatsappMessage',_0x4099f6);logger[_0x09eb('0x15')]('CreateWhatsappMessage',_0x4099f6,JSON['stringify'](_0x3d0dfb));_0x429d28(_0x3d0dfb);})[_0x09eb('0x1c')](function(_0x38b6c2){logger[_0x09eb('0x18')](_0x09eb('0x1d'),_0x38b6c2[_0x09eb('0x1a')],_0x4099f6);_0x26c338(_0x3077ef[_0x09eb('0x18')](0x1f4,_0x38b6c2[_0x09eb('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index cca7277..e12f422 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 _0x50d6=['remove','emit','removeListener','length','whatsappMessage:','./whatsappMessage.events'];(function(_0x5b2c01,_0x447929){var _0x14409d=function(_0x3a580a){while(--_0x3a580a){_0x5b2c01['push'](_0x5b2c01['shift']());}};_0x14409d(++_0x447929);}(_0x50d6,0xc5));var _0x650d=function(_0x213969,_0x303344){_0x213969=_0x213969-0x0;var _0x5f4fca=_0x50d6[_0x213969];return _0x5f4fca;};'use strict';var WhatsappMessageEvents=require(_0x650d('0x0'));var events=['save',_0x650d('0x1'),'update'];function createListener(_0x538035,_0x41a3fe){return function(_0x24440f){_0x41a3fe[_0x650d('0x2')](_0x538035,_0x24440f);};}function removeListener(_0x347e93,_0x5f1d44){return function(){WhatsappMessageEvents[_0x650d('0x3')](_0x347e93,_0x5f1d44);};}exports['register']=function(_0x243127){for(var _0x3751e6=0x0,_0x48b578=events[_0x650d('0x4')];_0x3751e6<_0x48b578;_0x3751e6++){var _0x36cf6c=events[_0x3751e6];var _0x5cdcde=createListener(_0x650d('0x5')+_0x36cf6c,_0x243127);WhatsappMessageEvents['on'](_0x36cf6c,_0x5cdcde);}}; \ No newline at end of file +var _0xe50b=['length','./whatsappMessage.events','save','remove','emit','register'];(function(_0x29cce5,_0x3966e8){var _0x50a8da=function(_0x52f326){while(--_0x52f326){_0x29cce5['push'](_0x29cce5['shift']());}};_0x50a8da(++_0x3966e8);}(_0xe50b,0x18d));var _0xbe50=function(_0x152e1b,_0x4fd221){_0x152e1b=_0x152e1b-0x0;var _0x33583b=_0xe50b[_0x152e1b];return _0x33583b;};'use strict';var WhatsappMessageEvents=require(_0xbe50('0x0'));var events=[_0xbe50('0x1'),_0xbe50('0x2'),'update'];function createListener(_0x41f7de,_0x20d502){return function(_0x1f87ef){_0x20d502[_0xbe50('0x3')](_0x41f7de,_0x1f87ef);};}function removeListener(_0x24040b,_0x193262){return function(){WhatsappMessageEvents['removeListener'](_0x24040b,_0x193262);};}exports[_0xbe50('0x4')]=function(_0xd09bf3){for(var _0x52739e=0x0,_0x3cc2de=events[_0xbe50('0x5')];_0x52739e<_0x3cc2de;_0x52739e++){var _0x2eecc8=events[_0x52739e];var _0x43d15e=createListener('whatsappMessage:'+_0x2eecc8,_0xd09bf3);WhatsappMessageEvents['on'](_0x2eecc8,_0x43d15e);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 7a4cbe7..97dc4d3 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 _0x74bb=['/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x74bb,0x1c4));var _0xb74b=function(_0x20ad55,_0x6235e){_0x20ad55=_0x20ad55-0x0;var _0x480b26=_0x74bb[_0x20ad55];return _0x480b26;};'use strict';var multer=require(_0xb74b('0x0'));var util=require(_0xb74b('0x1'));var path=require('path');var timeout=require(_0xb74b('0x2'));var express=require(_0xb74b('0x3'));var router=express[_0xb74b('0x4')]();var auth=require(_0xb74b('0x5'));var interaction=require(_0xb74b('0x6'));var config=require(_0xb74b('0x7'));var controller=require('./whatsappQueue.controller');router[_0xb74b('0x8')]('/',auth[_0xb74b('0x9')](),controller[_0xb74b('0xa')]);router[_0xb74b('0x8')](_0xb74b('0xb'),auth[_0xb74b('0x9')](),controller[_0xb74b('0xc')]);router[_0xb74b('0x8')](_0xb74b('0xd'),auth[_0xb74b('0x9')](),controller[_0xb74b('0xe')]);router[_0xb74b('0x8')](_0xb74b('0xf'),auth[_0xb74b('0x9')](),controller['getMembers']);router[_0xb74b('0x8')](_0xb74b('0x10'),auth[_0xb74b('0x9')](),controller[_0xb74b('0x11')]);router[_0xb74b('0x8')](_0xb74b('0x12'),auth[_0xb74b('0x9')](),controller['getAgents']);router['post']('/',auth[_0xb74b('0x9')](),controller['create']);router[_0xb74b('0x13')](_0xb74b('0x10'),auth['isAuthenticated'](),controller[_0xb74b('0x14')]);router['post'](_0xb74b('0x12'),auth[_0xb74b('0x9')](),controller['addAgents']);router['put'](_0xb74b('0xd'),auth[_0xb74b('0x9')](),controller[_0xb74b('0x15')]);router[_0xb74b('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xb74b('0x17')]);router[_0xb74b('0x16')]('/:id/teams',auth[_0xb74b('0x9')](),controller[_0xb74b('0x18')]);router[_0xb74b('0x16')](_0xb74b('0x12'),auth[_0xb74b('0x9')](),controller['removeAgents']);module[_0xb74b('0x19')]=router; \ No newline at end of file +var _0xb21f=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete'];(function(_0xb1b991,_0x4fa923){var _0x3f680a=function(_0x1d1f36){while(--_0x1d1f36){_0xb1b991['push'](_0xb1b991['shift']());}};_0x3f680a(++_0x4fa923);}(_0xb21f,0x1a5));var _0xfb21=function(_0x33080e,_0x1c600a){_0x33080e=_0x33080e-0x0;var _0x407395=_0xb21f[_0x33080e];return _0x407395;};'use strict';var multer=require(_0xfb21('0x0'));var util=require(_0xfb21('0x1'));var path=require(_0xfb21('0x2'));var timeout=require(_0xfb21('0x3'));var express=require(_0xfb21('0x4'));var router=express[_0xfb21('0x5')]();var auth=require(_0xfb21('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfb21('0x7'));var controller=require(_0xfb21('0x8'));router[_0xfb21('0x9')]('/',auth['isAuthenticated'](),controller[_0xfb21('0xa')]);router[_0xfb21('0x9')](_0xfb21('0xb'),auth[_0xfb21('0xc')](),controller[_0xfb21('0xd')]);router[_0xfb21('0x9')](_0xfb21('0xe'),auth['isAuthenticated'](),controller['show']);router['get'](_0xfb21('0xf'),auth[_0xfb21('0xc')](),controller[_0xfb21('0x10')]);router[_0xfb21('0x9')](_0xfb21('0x11'),auth['isAuthenticated'](),controller['getTeams']);router[_0xfb21('0x9')](_0xfb21('0x12'),auth[_0xfb21('0xc')](),controller[_0xfb21('0x13')]);router[_0xfb21('0x14')]('/',auth[_0xfb21('0xc')](),controller[_0xfb21('0x15')]);router['post']('/:id/teams',auth[_0xfb21('0xc')](),controller[_0xfb21('0x16')]);router['post'](_0xfb21('0x12'),auth[_0xfb21('0xc')](),controller[_0xfb21('0x17')]);router[_0xfb21('0x18')]('/:id',auth[_0xfb21('0xc')](),controller[_0xfb21('0x19')]);router[_0xfb21('0x1a')]('/:id',auth[_0xfb21('0xc')](),controller['destroy']);router[_0xfb21('0x1a')]('/:id/teams',auth[_0xfb21('0xc')](),controller['removeTeams']);router[_0xfb21('0x1a')](_0xfb21('0x12'),auth[_0xfb21('0xc')](),controller['removeAgents']);module[_0xfb21('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 189b4bb..7ed005f 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 _0x4596=['exports','STRING','name','INTEGER','rrmemory','beepall','sequelize'];(function(_0x275390,_0x118289){var _0x3f234a=function(_0x271984){while(--_0x271984){_0x275390['push'](_0x275390['shift']());}};_0x3f234a(++_0x118289);}(_0x4596,0xfb));var _0x6459=function(_0x2de128,_0x3fe3b9){_0x2de128=_0x2de128-0x0;var _0x562edf=_0x4596[_0x2de128];return _0x562edf;};'use strict';var Sequelize=require(_0x6459('0x0'));module[_0x6459('0x1')]={'name':{'type':Sequelize[_0x6459('0x2')],'unique':_0x6459('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x6459('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6459('0x5'),_0x6459('0x6'),'roundrobin')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5902=['name','INTEGER','ENUM','roundrobin','sequelize','exports','STRING'];(function(_0x1f0174,_0x17ab90){var _0x3d5dc1=function(_0x21fe99){while(--_0x21fe99){_0x1f0174['push'](_0x1f0174['shift']());}};_0x3d5dc1(++_0x17ab90);}(_0x5902,0xc1));var _0x2590=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5902[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x2590('0x0'));module[_0x2590('0x1')]={'name':{'type':Sequelize[_0x2590('0x2')],'unique':_0x2590('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x2590('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2590('0x5')]('rrmemory','beepall',_0x2590('0x6'))},'description':{'type':Sequelize[_0x2590('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index f9dfe54..5e1924f 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 _0xdb23=['ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','union','compact','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','getAgents','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','get','WhatsappQueues','error','stack','name','send','map','WhatsappQueue','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','catch','params','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','findAll','User','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xdb23,0x9e));var _0x3db2=function(_0x1c7adb,_0x9e5f0d){_0x1c7adb=_0x1c7adb-0x0;var _0x842b58=_0xdb23[_0x1c7adb];return _0x842b58;};'use strict';var pdf=require(_0x3db2('0x0'));var emlformat=require(_0x3db2('0x1'));var rimraf=require(_0x3db2('0x2'));var zipdir=require(_0x3db2('0x3'));var jsonpatch=require(_0x3db2('0x4'));var rp=require(_0x3db2('0x5'));var moment=require(_0x3db2('0x6'));var BPromise=require(_0x3db2('0x7'));var Mustache=require(_0x3db2('0x8'));var util=require(_0x3db2('0x9'));var path=require(_0x3db2('0xa'));var sox=require(_0x3db2('0xb'));var csv=require(_0x3db2('0xc'));var ejs=require(_0x3db2('0xd'));var fs=require('fs');var _=require(_0x3db2('0xe'));var squel=require(_0x3db2('0xf'));var crypto=require(_0x3db2('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3db2('0x11'));var toCsv=require(_0x3db2('0xc'));var querystring=require('querystring');var Papa=require(_0x3db2('0x12'));var Redis=require(_0x3db2('0x13'));var authService=require(_0x3db2('0x14'));var qs=require(_0x3db2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3db2('0x16'));var db=require(_0x3db2('0x17'))['db'];config[_0x3db2('0x18')]=_['defaults'](config['redis'],{'host':_0x3db2('0x19'),'port':0x18eb});var socket=require(_0x3db2('0x1a'))(new Redis(config[_0x3db2('0x18')]));require(_0x3db2('0x1b'))[_0x3db2('0x1c')](socket);function respondWithStatusCode(_0x114558,_0x4a93dd){_0x4a93dd=_0x4a93dd||0xcc;return function(_0x5a685e){if(_0x5a685e){return _0x114558[_0x3db2('0x1d')](_0x4a93dd);}return _0x114558[_0x3db2('0x1e')](_0x4a93dd)[_0x3db2('0x1f')]();};}function respondWithResult(_0x4c6dd2,_0x512ea3){_0x512ea3=_0x512ea3||0xc8;return function(_0x68b5f1){if(_0x68b5f1){return _0x4c6dd2[_0x3db2('0x1e')](_0x512ea3)[_0x3db2('0x20')](_0x68b5f1);}};}function respondWithFilteredResult(_0x19bcfd,_0x566671){return function(_0x3e01b5){if(_0x3e01b5){var _0x5c1534=_0x3e01b5[_0x3db2('0x21')],_0x1683d5=_0x566671['offset'],_0xc29c61=_0x566671[_0x3db2('0x22')]+_0x566671['limit'],_0x44e048;if(_0xc29c61>=_0x5c1534){_0xc29c61=_0x5c1534;_0x44e048=0xc8;}else{_0x44e048=0xce;}_0x19bcfd[_0x3db2('0x1e')](_0x44e048);return _0x19bcfd[_0x3db2('0x23')]('Content-Range',_0x1683d5+'-'+_0xc29c61+'/'+_0x5c1534)[_0x3db2('0x20')](_0x3e01b5);}return null;};}function patchUpdates(_0x57b9f9){return function(_0x3fbe92){try{jsonpatch[_0x3db2('0x24')](_0x3fbe92,_0x57b9f9,!![]);}catch(_0x3200d5){return BPromise[_0x3db2('0x25')](_0x3200d5);}return _0x3fbe92[_0x3db2('0x26')]();};}function saveUpdates(_0x426457,_0x206033){return function(_0x440da0){if(_0x440da0){return _0x440da0[_0x3db2('0x27')](_0x426457)[_0x3db2('0x28')](function(_0x20d943){return _0x20d943;});}return null;};}function removeEntity(_0x55be94,_0x4a4db0){return function(_0x2a06eb){if(_0x2a06eb){return _0x2a06eb[_0x3db2('0x29')]()[_0x3db2('0x28')](function(){var _0xa26488=_0x2a06eb[_0x3db2('0x2a')]({'plain':!![]});var _0x219d5a=_0x3db2('0x2b');return db['UserProfileResource'][_0x3db2('0x29')]({'where':{'type':_0x219d5a,'resourceId':_0xa26488['id']}})[_0x3db2('0x28')](function(){return _0x2a06eb;});})[_0x3db2('0x28')](function(){_0x55be94[_0x3db2('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a8153,_0x2bca0f){return function(_0x19e5e2){if(!_0x19e5e2){_0x3a8153[_0x3db2('0x1d')](0x194);}return _0x19e5e2;};}function handleError(_0x521be3,_0x5e4d7c){_0x5e4d7c=_0x5e4d7c||0x1f4;return function(_0x101341){logger[_0x3db2('0x2c')](_0x101341[_0x3db2('0x2d')]);if(_0x101341[_0x3db2('0x2e')]){delete _0x101341[_0x3db2('0x2e')];}_0x521be3['status'](_0x5e4d7c)[_0x3db2('0x2f')](_0x101341);};}exports['index']=function(_0xb01c5,_0x5721d5){var _0x4fa363={},_0x38a928={},_0x580847={'count':0x0,'rows':[]};var _0x1f1207=_[_0x3db2('0x30')](db[_0x3db2('0x31')][_0x3db2('0x32')],function(_0xbc03bd){return{'name':_0xbc03bd[_0x3db2('0x33')],'type':_0xbc03bd['type'][_0x3db2('0x34')]};});_0x38a928['model']=_[_0x3db2('0x30')](_0x1f1207,_0x3db2('0x2e'));_0x38a928[_0x3db2('0x35')]=_['keys'](_0xb01c5[_0x3db2('0x35')]);_0x38a928[_0x3db2('0x36')]=_[_0x3db2('0x37')](_0x38a928[_0x3db2('0x38')],_0x38a928['query']);_0x4fa363[_0x3db2('0x39')]=_['intersection'](_0x38a928[_0x3db2('0x38')],qs['fields'](_0xb01c5[_0x3db2('0x35')][_0x3db2('0x3a')]));_0x4fa363[_0x3db2('0x39')]=_0x4fa363[_0x3db2('0x39')][_0x3db2('0x3b')]?_0x4fa363['attributes']:_0x38a928[_0x3db2('0x38')];if(!_0xb01c5[_0x3db2('0x35')]['hasOwnProperty'](_0x3db2('0x3c'))){_0x4fa363['limit']=qs[_0x3db2('0x3d')](_0xb01c5['query'][_0x3db2('0x3d')]);_0x4fa363['offset']=qs[_0x3db2('0x22')](_0xb01c5[_0x3db2('0x35')][_0x3db2('0x22')]);}_0x4fa363[_0x3db2('0x3e')]=qs[_0x3db2('0x3f')](_0xb01c5[_0x3db2('0x35')][_0x3db2('0x3f')]);_0x4fa363[_0x3db2('0x40')]=qs[_0x3db2('0x36')](_[_0x3db2('0x41')](_0xb01c5[_0x3db2('0x35')],_0x38a928[_0x3db2('0x36')]),_0x1f1207);if(_0xb01c5['query'][_0x3db2('0x42')]){_0x4fa363[_0x3db2('0x40')]=_[_0x3db2('0x43')](_0x4fa363[_0x3db2('0x40')],{'$or':_[_0x3db2('0x30')](_0x1f1207,function(_0x55b3bb){if(_0x55b3bb[_0x3db2('0x44')]!==_0x3db2('0x45')){var _0x14a543={};_0x14a543[_0x55b3bb[_0x3db2('0x2e')]]={'$like':'%'+_0xb01c5[_0x3db2('0x35')][_0x3db2('0x42')]+'%'};return _0x14a543;}})});}_0x4fa363=_[_0x3db2('0x43')]({},_0x4fa363,_0xb01c5[_0x3db2('0x46')]);var _0x4e1ee5={'where':_0x4fa363[_0x3db2('0x40')]};return db[_0x3db2('0x31')]['count'](_0x4e1ee5)['then'](function(_0x8f52a9){_0x580847[_0x3db2('0x21')]=_0x8f52a9;if(_0xb01c5[_0x3db2('0x35')]['includeAll']){_0x4fa363[_0x3db2('0x47')]=[{'all':!![]}];}return db[_0x3db2('0x31')]['findAll'](_0x4fa363);})[_0x3db2('0x28')](function(_0x28e775){_0x580847[_0x3db2('0x48')]=_0x28e775;return _0x580847;})[_0x3db2('0x28')](respondWithFilteredResult(_0x5721d5,_0x4fa363))[_0x3db2('0x49')](handleError(_0x5721d5,null));};exports['show']=function(_0x478f21,_0x26f09f){var _0x57225b={'raw':!![],'where':{'id':_0x478f21[_0x3db2('0x4a')]['id']}},_0x3b6263={};_0x3b6263[_0x3db2('0x38')]=_['keys'](db['WhatsappQueue']['rawAttributes']);_0x3b6263['query']=_[_0x3db2('0x4b')](_0x478f21[_0x3db2('0x35')]);_0x3b6263[_0x3db2('0x36')]=_['intersection'](_0x3b6263[_0x3db2('0x38')],_0x3b6263['query']);_0x57225b[_0x3db2('0x39')]=_[_0x3db2('0x37')](_0x3b6263[_0x3db2('0x38')],qs[_0x3db2('0x3a')](_0x478f21[_0x3db2('0x35')][_0x3db2('0x3a')]));_0x57225b[_0x3db2('0x39')]=_0x57225b['attributes'][_0x3db2('0x3b')]?_0x57225b['attributes']:_0x3b6263[_0x3db2('0x38')];if(_0x478f21[_0x3db2('0x35')][_0x3db2('0x4c')]){_0x57225b['include']=[{'all':!![]}];}_0x57225b=_['merge']({},_0x57225b,_0x478f21[_0x3db2('0x46')]);return db[_0x3db2('0x31')]['find'](_0x57225b)['then'](handleEntityNotFound(_0x26f09f,null))[_0x3db2('0x28')](respondWithResult(_0x26f09f,null))[_0x3db2('0x49')](handleError(_0x26f09f,null));};exports[_0x3db2('0x4d')]=function(_0x1376aa,_0x531cb7){return db[_0x3db2('0x31')][_0x3db2('0x4d')](_0x1376aa[_0x3db2('0x4e')],{})[_0x3db2('0x28')](function(_0x4ee1d0){var _0x13aefe=_0x1376aa[_0x3db2('0x4f')][_0x3db2('0x2a')]({'plain':!![]});if(!_0x13aefe)throw new Error(_0x3db2('0x50'));if(_0x13aefe[_0x3db2('0x51')]==='user'){var _0x54e92c=_0x4ee1d0[_0x3db2('0x2a')]({'plain':!![]});var _0x5e52b1=_0x3db2('0x2b');return db['UserProfileSection'][_0x3db2('0x52')]({'where':{'name':_0x5e52b1,'userProfileId':_0x13aefe[_0x3db2('0x53')]},'raw':!![]})['then'](function(_0x25d13f){if(_0x25d13f&&_0x25d13f[_0x3db2('0x54')]===0x0){return db[_0x3db2('0x55')][_0x3db2('0x4d')]({'name':_0x54e92c[_0x3db2('0x2e')],'resourceId':_0x54e92c['id'],'type':_0x25d13f['name'],'sectionId':_0x25d13f['id']},{})[_0x3db2('0x28')](function(){return _0x4ee1d0;});}else{return _0x4ee1d0;}})[_0x3db2('0x49')](function(_0x2df8c4){logger[_0x3db2('0x2c')](_0x3db2('0x56'),_0x2df8c4);throw _0x2df8c4;});}return _0x4ee1d0;})['then'](respondWithResult(_0x531cb7,0xc9))[_0x3db2('0x49')](handleError(_0x531cb7,null));};exports[_0x3db2('0x27')]=function(_0x49bfb8,_0x37309d){if(_0x49bfb8[_0x3db2('0x4e')]['id']){delete _0x49bfb8['body']['id'];}return db[_0x3db2('0x31')][_0x3db2('0x52')]({'where':{'id':_0x49bfb8[_0x3db2('0x4a')]['id']}})[_0x3db2('0x28')](handleEntityNotFound(_0x37309d,null))[_0x3db2('0x28')](saveUpdates(_0x49bfb8[_0x3db2('0x4e')],null))[_0x3db2('0x28')](respondWithResult(_0x37309d,null))[_0x3db2('0x49')](handleError(_0x37309d,null));};exports[_0x3db2('0x29')]=function(_0x581795,_0x4ab748){return db[_0x3db2('0x31')][_0x3db2('0x52')]({'where':{'id':_0x581795['params']['id']}})['then'](handleEntityNotFound(_0x4ab748,null))[_0x3db2('0x28')](removeEntity(_0x4ab748,null))[_0x3db2('0x49')](handleError(_0x4ab748,null));};exports[_0x3db2('0x57')]=function(_0x584a95,_0x1aa3a6){return db[_0x3db2('0x31')][_0x3db2('0x57')]()[_0x3db2('0x28')](respondWithResult(_0x1aa3a6,null))[_0x3db2('0x49')](handleError(_0x1aa3a6,null));};exports[_0x3db2('0x58')]=function(_0x1bb09b,_0xbf0f59,_0x17c72a){var _0x50ed99={'raw':!![],'where':{}},_0x539de8={},_0x788ce6;return db[_0x3db2('0x31')][_0x3db2('0x59')]({'where':{'id':_0x1bb09b[_0x3db2('0x4a')]['id']}})[_0x3db2('0x28')](handleEntityNotFound(_0xbf0f59,null))['then'](function(_0x4e24b3){if(_0x4e24b3){_0x788ce6=_0x4e24b3[_0x3db2('0x2a')]({'plain':!![]});_0x539de8['model']=_[_0x3db2('0x4b')](db[_0x3db2('0x5a')][_0x3db2('0x32')]);_0x539de8[_0x3db2('0x35')]=_['keys'](_0x1bb09b[_0x3db2('0x35')]);_0x539de8[_0x3db2('0x36')]=_[_0x3db2('0x37')](_0x539de8[_0x3db2('0x38')],_0x539de8[_0x3db2('0x35')]);_0x50ed99[_0x3db2('0x39')]=_[_0x3db2('0x37')](_0x539de8['model'],qs['fields'](_0x1bb09b[_0x3db2('0x35')]['fields']));_0x50ed99[_0x3db2('0x39')]=_0x50ed99[_0x3db2('0x39')][_0x3db2('0x3b')]?_0x50ed99[_0x3db2('0x39')]:_0x539de8[_0x3db2('0x38')];if(!_0x1bb09b[_0x3db2('0x35')]['hasOwnProperty'](_0x3db2('0x3c'))){_0x50ed99[_0x3db2('0x3d')]=qs['limit'](_0x1bb09b['query'][_0x3db2('0x3d')]);_0x50ed99[_0x3db2('0x22')]=qs[_0x3db2('0x22')](_0x1bb09b[_0x3db2('0x35')]['offset']);}_0x50ed99[_0x3db2('0x3e')]=qs[_0x3db2('0x3f')](_0x1bb09b[_0x3db2('0x35')][_0x3db2('0x3f')]);_0x50ed99[_0x3db2('0x40')]=qs[_0x3db2('0x36')](_['pick'](_0x1bb09b[_0x3db2('0x35')],_0x539de8[_0x3db2('0x36')]));_0x50ed99['where'][_0x3db2('0x5b')]=_0x4e24b3['id'];if(_0x1bb09b[_0x3db2('0x35')]['filter']){_0x50ed99[_0x3db2('0x40')]=_[_0x3db2('0x43')](_0x50ed99[_0x3db2('0x40')],{'$or':_[_0x3db2('0x30')](_0x50ed99['attributes'],function(_0x1c0aee){var _0x49ce90={};_0x49ce90[_0x1c0aee]={'$like':'%'+_0x1bb09b[_0x3db2('0x35')][_0x3db2('0x42')]+'%'};return _0x49ce90;})});}_0x50ed99=_[_0x3db2('0x43')]({},_0x50ed99,_0x1bb09b[_0x3db2('0x46')]);return db['UserWhatsappQueue'][_0x3db2('0x5c')](_0x50ed99);}})[_0x3db2('0x28')](function(_0x3d1319){if(_0x3d1319){return db[_0x3db2('0x5d')]['findAndCountAll']({'where':{'id':_[_0x3db2('0x30')](_0x3d1319,_0x3db2('0x5e')),'role':_0x3db2('0x5f')},'attributes':['id',_0x3db2('0x2e'),_0x3db2('0x60'),_0x3db2('0x61'),_0x3db2('0x62')]});}})[_0x3db2('0x28')](function(_0x5b2ece){if(_0x5b2ece){return{'count':_0x5b2ece[_0x3db2('0x21')],'rows':_[_0x3db2('0x30')](_0x5b2ece[_0x3db2('0x48')],function(_0x25394e){return{'membername':_0x25394e['name'],'UserId':_0x25394e['id'],'queue_name':_0x788ce6[_0x3db2('0x2e')],'WhatsappQueueId':_0x788ce6['id'],'interface':util[_0x3db2('0x63')](_0x3db2('0x64'),_0x3db2('0x65'),_0x25394e[_0x3db2('0x2e')]),'penalty':0x0,'paused':_0x25394e[_0x3db2('0x60')],'createdAt':_0x25394e[_0x3db2('0x62')],'updatedAt':_0x25394e[_0x3db2('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xbf0f59,_0x50ed99))[_0x3db2('0x49')](handleError(_0xbf0f59,null));};exports[_0x3db2('0x66')]=function(_0xc9b64f,_0x4419c1,_0xa1d07f){var _0xf7772a={};var _0x595277={};var _0x48d787;var _0x4e0b1a;return db['WhatsappQueue']['findOne']({'where':{'id':_0xc9b64f[_0x3db2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4419c1,null))['then'](function(_0x5a39ef){if(_0x5a39ef){_0x48d787=_0x5a39ef;_0x595277['model']=_[_0x3db2('0x4b')](db[_0x3db2('0x67')]['rawAttributes']);_0x595277[_0x3db2('0x35')]=_['keys'](_0xc9b64f['query']);_0x595277[_0x3db2('0x36')]=_[_0x3db2('0x37')](_0x595277[_0x3db2('0x38')],_0x595277['query']);_0xf7772a[_0x3db2('0x39')]=_[_0x3db2('0x37')](_0x595277[_0x3db2('0x38')],qs[_0x3db2('0x3a')](_0xc9b64f['query'][_0x3db2('0x3a')]));_0xf7772a['attributes']=_0xf7772a[_0x3db2('0x39')][_0x3db2('0x3b')]?_0xf7772a[_0x3db2('0x39')]:_0x595277[_0x3db2('0x38')];_0xf7772a['order']=qs['sort'](_0xc9b64f[_0x3db2('0x35')][_0x3db2('0x3f')]);_0xf7772a[_0x3db2('0x40')]=qs[_0x3db2('0x36')](_[_0x3db2('0x41')](_0xc9b64f['query'],_0x595277[_0x3db2('0x36')]));if(_0xc9b64f['query'][_0x3db2('0x42')]){_0xf7772a[_0x3db2('0x40')]=_['merge'](_0xf7772a[_0x3db2('0x40')],{'$or':_[_0x3db2('0x30')](_0xf7772a[_0x3db2('0x39')],function(_0x3fc619){var _0x33b41b={};_0x33b41b[_0x3fc619]={'$like':'%'+_0xc9b64f[_0x3db2('0x35')][_0x3db2('0x42')]+'%'};return _0x33b41b;})});}_0xf7772a=_['merge']({},_0xf7772a,_0xc9b64f[_0x3db2('0x46')]);return _0x48d787[_0x3db2('0x66')](_0xf7772a);}})[_0x3db2('0x28')](function(_0x220995){if(_0x220995){_0x4e0b1a=_0x220995[_0x3db2('0x3b')];if(!_0xc9b64f[_0x3db2('0x35')][_0x3db2('0x68')](_0x3db2('0x3c'))){_0xf7772a[_0x3db2('0x3d')]=qs[_0x3db2('0x3d')](_0xc9b64f[_0x3db2('0x35')][_0x3db2('0x3d')]);_0xf7772a[_0x3db2('0x22')]=qs[_0x3db2('0x22')](_0xc9b64f['query']['offset']);}return _0x48d787[_0x3db2('0x66')](_0xf7772a);}})[_0x3db2('0x28')](function(_0x5c5b43){if(_0x5c5b43){return _0x5c5b43?{'count':_0x4e0b1a,'rows':_0x5c5b43}:null;}})['then'](respondWithResult(_0x4419c1,null))['catch'](handleError(_0x4419c1,null));};exports[_0x3db2('0x69')]=function(_0x9d3826,_0x1f5b5d,_0x5124c0){var _0x3da12c=_0x9d3826[_0x3db2('0x4e')][_0x3db2('0x6a')];return db[_0x3db2('0x67')][_0x3db2('0x5c')]({'where':{'id':_0x3da12c},'attributes':['id'],'include':[{'model':db[_0x3db2('0x5d')],'as':_0x3db2('0x6b'),'attributes':['id',_0x3db2('0x2e'),'online','voicePause',_0x3db2('0x6c')],'raw':!![]}]})[_0x3db2('0x28')](function(_0x128cf3){if(_0x128cf3){var _0x55cdf4=_[_0x3db2('0x6d')](_0x128cf3,function(_0x13bf0a){var _0x59663e=_0x13bf0a['get']({'plain':!![]});return _0x59663e[_0x3db2('0x6b')];});return db[_0x3db2('0x31')][_0x3db2('0x52')]({'where':{'id':_0x9d3826['params']['id']}})['then'](function(_0x498be8){return db[_0x3db2('0x6e')][_0x3db2('0x6f')](function(_0x33da43){return _0x498be8['addTeams'](_0x3da12c,{'transaction':_0x33da43})[_0x3db2('0x28')](function(){return BPromise[_0x3db2('0x70')](_0x55cdf4,function(_0x3a7ce8){return db[_0x3db2('0x5a')][_0x3db2('0x71')]({'where':{'UserId':_0x3a7ce8['id'],'WhatsappQueueId':_0x9d3826[_0x3db2('0x4a')]['id']},'transaction':_0x33da43});});})[_0x3db2('0x28')](function(){_0x55cdf4[_0x3db2('0x72')](function(_0x458dbf){socket[_0x3db2('0x73')](_0x3db2('0x74'),{'UserId':_0x458dbf['id'],'WhatsappQueueId':_0x498be8['id']});});});});});}})[_0x3db2('0x28')](respondWithStatusCode(_0x1f5b5d,null))[_0x3db2('0x49')](handleError(_0x1f5b5d,null));};exports[_0x3db2('0x75')]=function(_0x58bfb8,_0x54b6c5,_0x2a347d){return db[_0x3db2('0x67')][_0x3db2('0x5c')]({'where':{'id':_0x58bfb8[_0x3db2('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3db2('0x5d')],'as':_0x3db2('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x3db2('0x28')](handleEntityNotFound(_0x54b6c5,null))['then'](function(_0x47ff8f){var _0x280c1f=_[_0x3db2('0x30')](_0x47ff8f,'id');var _0x2ac253=[];var _0x1f38a5=[];var _0x55b86b=squel[_0x3db2('0x76')]();_0x55b86b[_0x3db2('0x77')](_0x3db2('0x78'))[_0x3db2('0x79')](_0x3db2('0x7a'),'tq')[_0x3db2('0x7b')]('user_has_teams','ut',_0x3db2('0x7c'))['where'](_0x3db2('0x7d'),_0x58bfb8[_0x3db2('0x4a')]['id']);for(var _0x363bb0=0x0;_0x363bb0<_0x47ff8f[_0x3db2('0x3b')];_0x363bb0+=0x1){let _0x44b772=_0x47ff8f[_0x363bb0];for(var _0x19c7e8=0x0;_0x19c7e8<_0x44b772['Agents']['length'];_0x19c7e8+=0x1){let _0x234e3b=_0x44b772[_0x3db2('0x6b')][_0x19c7e8];var _0x4512a9=_0x55b86b[_0x3db2('0x7e')]();_0x4512a9['where']('ut.UserId\x20=\x20?',_0x234e3b['id']);_0x1f38a5[_0x3db2('0x7f')](db['sequelize'][_0x3db2('0x35')](_0x4512a9[_0x3db2('0x80')](),{'type':db[_0x3db2('0x6e')][_0x3db2('0x81')][_0x3db2('0x82')]})[_0x3db2('0x28')](function(_0x592f08){if(_0x592f08[_0x3db2('0x3b')]===0x1){return _0x234e3b['id'];}else{var _0x345277=_[_0x3db2('0x83')](_['map'](_0x592f08,'TeamId'),function(_0x18c79f){return _['includes'](_0x280c1f,_0x18c79f);});if(_0x345277){return _0x234e3b['id'];}}}));}}return BPromise['all'](_0x1f38a5)[_0x3db2('0x28')](function(_0x1685e6){_0x2ac253=_(_0x2ac253)[_0x3db2('0x84')](_0x1685e6)[_0x3db2('0x85')]()['value']();return db[_0x3db2('0x31')][_0x3db2('0x52')]({'where':{'id':_0x58bfb8[_0x3db2('0x4a')]['id']}})[_0x3db2('0x28')](function(_0x116e87){return db['sequelize'][_0x3db2('0x6f')](function(_0x5bffbd){return _0x116e87['removeTeams'](_0x58bfb8[_0x3db2('0x35')]['ids'],{'transaction':_0x5bffbd})['then'](function(){if(!_[_0x3db2('0x86')](_0x2ac253)){return _0x116e87['removeAgents'](_0x2ac253,{'transaction':_0x5bffbd});}})[_0x3db2('0x28')](function(){_0x2ac253[_0x3db2('0x72')](function(_0x14d99f){socket[_0x3db2('0x73')](_0x3db2('0x87'),{'UserId':_0x14d99f,'WhatsappQueueId':_0x116e87['id']});});});});});});})[_0x3db2('0x28')](respondWithStatusCode(_0x54b6c5,null))[_0x3db2('0x49')](handleError(_0x54b6c5,null));};exports[_0x3db2('0x88')]=function(_0x357aba,_0x1ee9a1,_0x10a4bd){return db['WhatsappQueue'][_0x3db2('0x52')]({'where':{'id':_0x357aba[_0x3db2('0x4a')]['id']}})[_0x3db2('0x28')](handleEntityNotFound(_0x1ee9a1,null))[_0x3db2('0x28')](function(_0x109603){if(_0x109603){return _0x109603[_0x3db2('0x88')](_0x357aba[_0x3db2('0x4e')][_0x3db2('0x6a')],_[_0x3db2('0x89')](_0x357aba[_0x3db2('0x4e')],[_0x3db2('0x6a'),'id'])||{})[_0x3db2('0x8a')](function(_0x2c7886){for(var _0x5a637f=0x0;_0x5a637f<_0x357aba[_0x3db2('0x4e')]['ids']['length'];_0x5a637f+=0x1){socket[_0x3db2('0x73')](_0x3db2('0x74'),{'UserId':_0x357aba[_0x3db2('0x4e')]['ids'][_0x5a637f],'WhatsappQueueId':_0x357aba[_0x3db2('0x4a')]['id']});}return _0x2c7886;});}})[_0x3db2('0x28')](respondWithResult(_0x1ee9a1,null))[_0x3db2('0x49')](handleError(_0x1ee9a1,null));};exports[_0x3db2('0x8b')]=function(_0x4ebf03,_0x3b6518,_0x3ed539){return db['WhatsappQueue'][_0x3db2('0x52')]({'where':{'id':_0x4ebf03[_0x3db2('0x4a')]['id']}})[_0x3db2('0x28')](handleEntityNotFound(_0x3b6518,null))['then'](function(_0x4a7757){if(_0x4a7757){return _0x4a7757[_0x3db2('0x8b')](_0x4ebf03[_0x3db2('0x35')][_0x3db2('0x6a')])['then'](function(){if(_['isArray'](_0x4ebf03[_0x3db2('0x35')][_0x3db2('0x6a')])){for(var _0x14a4f8=0x0;_0x14a4f8<_0x4ebf03['query']['ids'][_0x3db2('0x3b')];_0x14a4f8+=0x1){socket[_0x3db2('0x73')](_0x3db2('0x87'),{'UserId':Number(_0x4ebf03['query'][_0x3db2('0x6a')][_0x14a4f8]),'WhatsappQueueId':Number(_0x4ebf03[_0x3db2('0x4a')]['id'])});}}else{socket[_0x3db2('0x73')](_0x3db2('0x87'),{'UserId':Number(_0x4ebf03[_0x3db2('0x35')][_0x3db2('0x6a')]),'WhatsappQueueId':Number(_0x4ebf03['params']['id'])});}});}})[_0x3db2('0x28')](respondWithStatusCode(_0x3b6518,null))[_0x3db2('0x49')](handleError(_0x3b6518,null));};exports[_0x3db2('0x8c')]=function(_0x150142,_0x47a19c,_0x150268){var _0x54de78={};var _0x27c00e={};var _0x1fd61e;var _0x351f95;return db['WhatsappQueue']['findOne']({'where':{'id':_0x150142[_0x3db2('0x4a')]['id']}})[_0x3db2('0x28')](handleEntityNotFound(_0x47a19c,null))[_0x3db2('0x28')](function(_0x20ed9e){if(_0x20ed9e){_0x1fd61e=_0x20ed9e;_0x27c00e[_0x3db2('0x38')]=_['keys'](db['User'][_0x3db2('0x32')]);_0x27c00e[_0x3db2('0x35')]=_[_0x3db2('0x4b')](_0x150142[_0x3db2('0x35')]);_0x27c00e[_0x3db2('0x36')]=_[_0x3db2('0x37')](_0x27c00e[_0x3db2('0x38')],_0x27c00e['query']);_0x54de78[_0x3db2('0x39')]=_[_0x3db2('0x37')](_0x27c00e['model'],qs[_0x3db2('0x3a')](_0x150142[_0x3db2('0x35')]['fields']));_0x54de78[_0x3db2('0x39')]=_0x54de78[_0x3db2('0x39')][_0x3db2('0x3b')]?_0x54de78[_0x3db2('0x39')]:_0x27c00e[_0x3db2('0x38')];_0x54de78['order']=qs[_0x3db2('0x3f')](_0x150142[_0x3db2('0x35')][_0x3db2('0x3f')]);_0x54de78['where']=qs[_0x3db2('0x36')](_[_0x3db2('0x41')](_0x150142['query'],_0x27c00e[_0x3db2('0x36')]));if(_0x150142[_0x3db2('0x35')][_0x3db2('0x42')]){_0x54de78[_0x3db2('0x40')]=_[_0x3db2('0x43')](_0x54de78[_0x3db2('0x40')],{'$or':_[_0x3db2('0x30')](_0x54de78['attributes'],function(_0x4e605e){var _0x403ba9={};_0x403ba9[_0x4e605e]={'$like':'%'+_0x150142[_0x3db2('0x35')][_0x3db2('0x42')]+'%'};return _0x403ba9;})});}_0x54de78=_[_0x3db2('0x43')]({},_0x54de78,_0x150142[_0x3db2('0x46')]);return _0x1fd61e[_0x3db2('0x8c')](_0x54de78);}})[_0x3db2('0x28')](function(_0x1733ac){if(_0x1733ac){_0x351f95=_0x1733ac[_0x3db2('0x3b')];if(!_0x150142[_0x3db2('0x35')][_0x3db2('0x68')](_0x3db2('0x3c'))){_0x54de78[_0x3db2('0x3d')]=qs['limit'](_0x150142[_0x3db2('0x35')]['limit']);_0x54de78['offset']=qs[_0x3db2('0x22')](_0x150142[_0x3db2('0x35')]['offset']);}return _0x1fd61e[_0x3db2('0x8c')](_0x54de78);}})[_0x3db2('0x28')](function(_0x14e3d8){if(_0x14e3d8){return _0x14e3d8?{'count':_0x351f95,'rows':_0x14e3d8}:null;}})[_0x3db2('0x28')](respondWithResult(_0x47a19c,null))['catch'](handleError(_0x47a19c,null));}; \ No newline at end of file +var _0x5f92=['save','update','then','destroy','get','WhatsappQueues','UserProfileResource','stack','name','send','index','map','WhatsappQueue','rawAttributes','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','show','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','params','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','UserId','updatedAt','createdAt','rows','format','SIP','whatsappPause','getTeams','Team','pick','addTeams','ids','User','Agents','online','voicePause','flatMap','sequelize','transaction','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','count','offset','set','Content-Range','json','apply'];(function(_0x5b68d0,_0x33bad5){var _0x1bf72a=function(_0x1a02d1){while(--_0x1a02d1){_0x5b68d0['push'](_0x5b68d0['shift']());}};_0x1bf72a(++_0x33bad5);}(_0x5f92,0xf2));var _0x25f9=function(_0x30b0d8,_0x57470c){_0x30b0d8=_0x30b0d8-0x0;var _0x459c09=_0x5f92[_0x30b0d8];return _0x459c09;};'use strict';var pdf=require(_0x25f9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x25f9('0x1'));var zipdir=require(_0x25f9('0x2'));var jsonpatch=require(_0x25f9('0x3'));var rp=require(_0x25f9('0x4'));var moment=require(_0x25f9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x25f9('0x6'));var util=require('util');var path=require(_0x25f9('0x7'));var sox=require(_0x25f9('0x8'));var csv=require(_0x25f9('0x9'));var ejs=require(_0x25f9('0xa'));var fs=require('fs');var _=require(_0x25f9('0xb'));var squel=require(_0x25f9('0xc'));var crypto=require(_0x25f9('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x25f9('0x9'));var querystring=require(_0x25f9('0xe'));var Papa=require(_0x25f9('0xf'));var Redis=require(_0x25f9('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x25f9('0x11'));var hardwareService=require(_0x25f9('0x12'));var logger=require(_0x25f9('0x13'))('api');var utils=require(_0x25f9('0x14'));var config=require(_0x25f9('0x15'));var licenseUtil=require(_0x25f9('0x16'));var db=require('../../mysqldb')['db'];config[_0x25f9('0x17')]=_[_0x25f9('0x18')](config[_0x25f9('0x17')],{'host':_0x25f9('0x19'),'port':0x18eb});var socket=require(_0x25f9('0x1a'))(new Redis(config['redis']));require(_0x25f9('0x1b'))[_0x25f9('0x1c')](socket);function respondWithStatusCode(_0x505a2e,_0x2004ce){_0x2004ce=_0x2004ce||0xcc;return function(_0x19f8b2){if(_0x19f8b2){return _0x505a2e[_0x25f9('0x1d')](_0x2004ce);}return _0x505a2e[_0x25f9('0x1e')](_0x2004ce)[_0x25f9('0x1f')]();};}function respondWithResult(_0x1d1bb7,_0x384205){_0x384205=_0x384205||0xc8;return function(_0x401c46){if(_0x401c46){return _0x1d1bb7[_0x25f9('0x1e')](_0x384205)['json'](_0x401c46);}};}function respondWithFilteredResult(_0x1762c9,_0x357fd2){return function(_0x69a446){if(_0x69a446){var _0x4845df=_0x69a446[_0x25f9('0x20')],_0x5c5cf0=_0x357fd2[_0x25f9('0x21')],_0x3bf517=_0x357fd2[_0x25f9('0x21')]+_0x357fd2['limit'],_0x1f947c;if(_0x3bf517>=_0x4845df){_0x3bf517=_0x4845df;_0x1f947c=0xc8;}else{_0x1f947c=0xce;}_0x1762c9['status'](_0x1f947c);return _0x1762c9[_0x25f9('0x22')](_0x25f9('0x23'),_0x5c5cf0+'-'+_0x3bf517+'/'+_0x4845df)[_0x25f9('0x24')](_0x69a446);}return null;};}function patchUpdates(_0x41d1b5){return function(_0xc676e8){try{jsonpatch[_0x25f9('0x25')](_0xc676e8,_0x41d1b5,!![]);}catch(_0x40149b){return BPromise['reject'](_0x40149b);}return _0xc676e8[_0x25f9('0x26')]();};}function saveUpdates(_0x1800a3,_0x4147d1){return function(_0x35bda7){if(_0x35bda7){return _0x35bda7[_0x25f9('0x27')](_0x1800a3)[_0x25f9('0x28')](function(_0x310206){return _0x310206;});}return null;};}function removeEntity(_0x1efd80,_0x436e79){return function(_0xdaaf02){if(_0xdaaf02){return _0xdaaf02[_0x25f9('0x29')]()[_0x25f9('0x28')](function(){var _0x26085c=_0xdaaf02[_0x25f9('0x2a')]({'plain':!![]});var _0x17ce19=_0x25f9('0x2b');return db[_0x25f9('0x2c')]['destroy']({'where':{'type':_0x17ce19,'resourceId':_0x26085c['id']}})[_0x25f9('0x28')](function(){return _0xdaaf02;});})[_0x25f9('0x28')](function(){_0x1efd80['status'](0xcc)[_0x25f9('0x1f')]();});}};}function handleEntityNotFound(_0x2028a1,_0xd76630){return function(_0x2c5c2b){if(!_0x2c5c2b){_0x2028a1[_0x25f9('0x1d')](0x194);}return _0x2c5c2b;};}function handleError(_0x51f1d7,_0x48ee01){_0x48ee01=_0x48ee01||0x1f4;return function(_0x8cabde){logger['error'](_0x8cabde[_0x25f9('0x2d')]);if(_0x8cabde[_0x25f9('0x2e')]){delete _0x8cabde[_0x25f9('0x2e')];}_0x51f1d7[_0x25f9('0x1e')](_0x48ee01)[_0x25f9('0x2f')](_0x8cabde);};}exports[_0x25f9('0x30')]=function(_0x59cd3f,_0x16f92c){var _0xc265b9={},_0x5d8c56={},_0x5d3b2b={'count':0x0,'rows':[]};var _0x2b3732=_[_0x25f9('0x31')](db[_0x25f9('0x32')][_0x25f9('0x33')],function(_0x30f6f6){return{'name':_0x30f6f6['fieldName'],'type':_0x30f6f6[_0x25f9('0x34')][_0x25f9('0x35')]};});_0x5d8c56['model']=_[_0x25f9('0x31')](_0x2b3732,_0x25f9('0x2e'));_0x5d8c56[_0x25f9('0x36')]=_[_0x25f9('0x37')](_0x59cd3f['query']);_0x5d8c56['filters']=_[_0x25f9('0x38')](_0x5d8c56['model'],_0x5d8c56[_0x25f9('0x36')]);_0xc265b9[_0x25f9('0x39')]=_[_0x25f9('0x38')](_0x5d8c56[_0x25f9('0x3a')],qs[_0x25f9('0x3b')](_0x59cd3f[_0x25f9('0x36')][_0x25f9('0x3b')]));_0xc265b9[_0x25f9('0x39')]=_0xc265b9[_0x25f9('0x39')][_0x25f9('0x3c')]?_0xc265b9[_0x25f9('0x39')]:_0x5d8c56['model'];if(!_0x59cd3f[_0x25f9('0x36')][_0x25f9('0x3d')](_0x25f9('0x3e'))){_0xc265b9[_0x25f9('0x3f')]=qs[_0x25f9('0x3f')](_0x59cd3f[_0x25f9('0x36')][_0x25f9('0x3f')]);_0xc265b9['offset']=qs[_0x25f9('0x21')](_0x59cd3f['query'][_0x25f9('0x21')]);}_0xc265b9[_0x25f9('0x40')]=qs[_0x25f9('0x41')](_0x59cd3f[_0x25f9('0x36')][_0x25f9('0x41')]);_0xc265b9['where']=qs[_0x25f9('0x42')](_['pick'](_0x59cd3f[_0x25f9('0x36')],_0x5d8c56['filters']),_0x2b3732);if(_0x59cd3f['query'][_0x25f9('0x43')]){_0xc265b9[_0x25f9('0x44')]=_['merge'](_0xc265b9[_0x25f9('0x44')],{'$or':_[_0x25f9('0x31')](_0x2b3732,function(_0x4008fa){if(_0x4008fa[_0x25f9('0x34')]!==_0x25f9('0x45')){var _0x471cd2={};_0x471cd2[_0x4008fa[_0x25f9('0x2e')]]={'$like':'%'+_0x59cd3f[_0x25f9('0x36')][_0x25f9('0x43')]+'%'};return _0x471cd2;}})});}_0xc265b9=_[_0x25f9('0x46')]({},_0xc265b9,_0x59cd3f[_0x25f9('0x47')]);var _0x335acf={'where':_0xc265b9['where']};return db[_0x25f9('0x32')][_0x25f9('0x20')](_0x335acf)[_0x25f9('0x28')](function(_0x153e3f){_0x5d3b2b[_0x25f9('0x20')]=_0x153e3f;if(_0x59cd3f[_0x25f9('0x36')][_0x25f9('0x48')]){_0xc265b9['include']=[{'all':!![]}];}return db['WhatsappQueue'][_0x25f9('0x49')](_0xc265b9);})[_0x25f9('0x28')](function(_0x46a364){_0x5d3b2b['rows']=_0x46a364;return _0x5d3b2b;})[_0x25f9('0x28')](respondWithFilteredResult(_0x16f92c,_0xc265b9))['catch'](handleError(_0x16f92c,null));};exports[_0x25f9('0x4a')]=function(_0x106582,_0x41c4d6){var _0x4d5f24={'raw':!![],'where':{'id':_0x106582['params']['id']}},_0x3e94fc={};_0x3e94fc[_0x25f9('0x3a')]=_[_0x25f9('0x37')](db[_0x25f9('0x32')][_0x25f9('0x33')]);_0x3e94fc['query']=_[_0x25f9('0x37')](_0x106582[_0x25f9('0x36')]);_0x3e94fc[_0x25f9('0x42')]=_[_0x25f9('0x38')](_0x3e94fc['model'],_0x3e94fc[_0x25f9('0x36')]);_0x4d5f24[_0x25f9('0x39')]=_[_0x25f9('0x38')](_0x3e94fc[_0x25f9('0x3a')],qs[_0x25f9('0x3b')](_0x106582[_0x25f9('0x36')]['fields']));_0x4d5f24['attributes']=_0x4d5f24[_0x25f9('0x39')][_0x25f9('0x3c')]?_0x4d5f24['attributes']:_0x3e94fc['model'];if(_0x106582[_0x25f9('0x36')][_0x25f9('0x48')]){_0x4d5f24[_0x25f9('0x4b')]=[{'all':!![]}];}_0x4d5f24=_['merge']({},_0x4d5f24,_0x106582[_0x25f9('0x47')]);return db[_0x25f9('0x32')][_0x25f9('0x4c')](_0x4d5f24)[_0x25f9('0x28')](handleEntityNotFound(_0x41c4d6,null))[_0x25f9('0x28')](respondWithResult(_0x41c4d6,null))[_0x25f9('0x4d')](handleError(_0x41c4d6,null));};exports[_0x25f9('0x4e')]=function(_0x498b9e,_0x55ab77){return db[_0x25f9('0x32')]['create'](_0x498b9e[_0x25f9('0x4f')],{})[_0x25f9('0x28')](function(_0x4504f4){var _0x5eeb0b=_0x498b9e[_0x25f9('0x50')][_0x25f9('0x2a')]({'plain':!![]});if(!_0x5eeb0b)throw new Error(_0x25f9('0x51'));if(_0x5eeb0b[_0x25f9('0x52')]===_0x25f9('0x50')){var _0x45b137=_0x4504f4[_0x25f9('0x2a')]({'plain':!![]});var _0x557fb0=_0x25f9('0x2b');return db[_0x25f9('0x53')][_0x25f9('0x4c')]({'where':{'name':_0x557fb0,'userProfileId':_0x5eeb0b['userProfileId']},'raw':!![]})[_0x25f9('0x28')](function(_0xb864b8){if(_0xb864b8&&_0xb864b8[_0x25f9('0x54')]===0x0){return db[_0x25f9('0x2c')][_0x25f9('0x4e')]({'name':_0x45b137[_0x25f9('0x2e')],'resourceId':_0x45b137['id'],'type':_0xb864b8['name'],'sectionId':_0xb864b8['id']},{})[_0x25f9('0x28')](function(){return _0x4504f4;});}else{return _0x4504f4;}})['catch'](function(_0x5c89c1){logger[_0x25f9('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c89c1);throw _0x5c89c1;});}return _0x4504f4;})['then'](respondWithResult(_0x55ab77,0xc9))[_0x25f9('0x4d')](handleError(_0x55ab77,null));};exports[_0x25f9('0x27')]=function(_0x39acb8,_0x4eceab){if(_0x39acb8[_0x25f9('0x4f')]['id']){delete _0x39acb8['body']['id'];}return db[_0x25f9('0x32')]['find']({'where':{'id':_0x39acb8[_0x25f9('0x56')]['id']}})['then'](handleEntityNotFound(_0x4eceab,null))[_0x25f9('0x28')](saveUpdates(_0x39acb8[_0x25f9('0x4f')],null))[_0x25f9('0x28')](respondWithResult(_0x4eceab,null))[_0x25f9('0x4d')](handleError(_0x4eceab,null));};exports[_0x25f9('0x29')]=function(_0x2583d2,_0x54fe8f){return db[_0x25f9('0x32')][_0x25f9('0x4c')]({'where':{'id':_0x2583d2[_0x25f9('0x56')]['id']}})[_0x25f9('0x28')](handleEntityNotFound(_0x54fe8f,null))['then'](removeEntity(_0x54fe8f,null))[_0x25f9('0x4d')](handleError(_0x54fe8f,null));};exports[_0x25f9('0x57')]=function(_0x4ad354,_0x3a5bc6){return db[_0x25f9('0x32')][_0x25f9('0x57')]()['then'](respondWithResult(_0x3a5bc6,null))[_0x25f9('0x4d')](handleError(_0x3a5bc6,null));};exports[_0x25f9('0x58')]=function(_0x4e265c,_0x88a91c,_0x22d259){var _0x12ff03={'raw':!![],'where':{}},_0x1455f2={},_0x1d1a7e;return db['WhatsappQueue'][_0x25f9('0x59')]({'where':{'id':_0x4e265c[_0x25f9('0x56')]['id']}})[_0x25f9('0x28')](handleEntityNotFound(_0x88a91c,null))[_0x25f9('0x28')](function(_0x43771d){if(_0x43771d){_0x1d1a7e=_0x43771d[_0x25f9('0x2a')]({'plain':!![]});_0x1455f2['model']=_[_0x25f9('0x37')](db[_0x25f9('0x5a')][_0x25f9('0x33')]);_0x1455f2[_0x25f9('0x36')]=_[_0x25f9('0x37')](_0x4e265c[_0x25f9('0x36')]);_0x1455f2[_0x25f9('0x42')]=_[_0x25f9('0x38')](_0x1455f2[_0x25f9('0x3a')],_0x1455f2['query']);_0x12ff03[_0x25f9('0x39')]=_[_0x25f9('0x38')](_0x1455f2[_0x25f9('0x3a')],qs[_0x25f9('0x3b')](_0x4e265c[_0x25f9('0x36')][_0x25f9('0x3b')]));_0x12ff03['attributes']=_0x12ff03[_0x25f9('0x39')][_0x25f9('0x3c')]?_0x12ff03['attributes']:_0x1455f2[_0x25f9('0x3a')];if(!_0x4e265c[_0x25f9('0x36')][_0x25f9('0x3d')]('nolimit')){_0x12ff03[_0x25f9('0x3f')]=qs[_0x25f9('0x3f')](_0x4e265c[_0x25f9('0x36')][_0x25f9('0x3f')]);_0x12ff03['offset']=qs[_0x25f9('0x21')](_0x4e265c[_0x25f9('0x36')]['offset']);}_0x12ff03[_0x25f9('0x40')]=qs[_0x25f9('0x41')](_0x4e265c['query'][_0x25f9('0x41')]);_0x12ff03['where']=qs[_0x25f9('0x42')](_['pick'](_0x4e265c[_0x25f9('0x36')],_0x1455f2[_0x25f9('0x42')]));_0x12ff03[_0x25f9('0x44')][_0x25f9('0x5b')]=_0x43771d['id'];if(_0x4e265c[_0x25f9('0x36')][_0x25f9('0x43')]){_0x12ff03[_0x25f9('0x44')]=_[_0x25f9('0x46')](_0x12ff03['where'],{'$or':_[_0x25f9('0x31')](_0x12ff03['attributes'],function(_0x786a9d){var _0x2da85f={};_0x2da85f[_0x786a9d]={'$like':'%'+_0x4e265c[_0x25f9('0x36')][_0x25f9('0x43')]+'%'};return _0x2da85f;})});}_0x12ff03=_[_0x25f9('0x46')]({},_0x12ff03,_0x4e265c[_0x25f9('0x47')]);return db['UserWhatsappQueue'][_0x25f9('0x49')](_0x12ff03);}})[_0x25f9('0x28')](function(_0x30f82c){if(_0x30f82c){return db['User']['findAndCountAll']({'where':{'id':_[_0x25f9('0x31')](_0x30f82c,_0x25f9('0x5c')),'role':'agent'},'attributes':['id','name','whatsappPause',_0x25f9('0x5d'),_0x25f9('0x5e')]});}})[_0x25f9('0x28')](function(_0x457691){if(_0x457691){return{'count':_0x457691[_0x25f9('0x20')],'rows':_[_0x25f9('0x31')](_0x457691[_0x25f9('0x5f')],function(_0xee0a59){return{'membername':_0xee0a59[_0x25f9('0x2e')],'UserId':_0xee0a59['id'],'queue_name':_0x1d1a7e['name'],'WhatsappQueueId':_0x1d1a7e['id'],'interface':util[_0x25f9('0x60')]('%s/%s',_0x25f9('0x61'),_0xee0a59['name']),'penalty':0x0,'paused':_0xee0a59[_0x25f9('0x62')],'createdAt':_0xee0a59[_0x25f9('0x5e')],'updatedAt':_0xee0a59[_0x25f9('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x88a91c,_0x12ff03))[_0x25f9('0x4d')](handleError(_0x88a91c,null));};exports[_0x25f9('0x63')]=function(_0x5cee78,_0x373b54,_0x53eca8){var _0x5615a2={};var _0x514c3d={};var _0x47e9d7;var _0x2a0f96;return db[_0x25f9('0x32')]['findOne']({'where':{'id':_0x5cee78[_0x25f9('0x56')]['id']}})[_0x25f9('0x28')](handleEntityNotFound(_0x373b54,null))[_0x25f9('0x28')](function(_0x3b9bc5){if(_0x3b9bc5){_0x47e9d7=_0x3b9bc5;_0x514c3d[_0x25f9('0x3a')]=_['keys'](db[_0x25f9('0x64')][_0x25f9('0x33')]);_0x514c3d['query']=_[_0x25f9('0x37')](_0x5cee78[_0x25f9('0x36')]);_0x514c3d['filters']=_['intersection'](_0x514c3d[_0x25f9('0x3a')],_0x514c3d['query']);_0x5615a2[_0x25f9('0x39')]=_[_0x25f9('0x38')](_0x514c3d[_0x25f9('0x3a')],qs[_0x25f9('0x3b')](_0x5cee78['query'][_0x25f9('0x3b')]));_0x5615a2[_0x25f9('0x39')]=_0x5615a2[_0x25f9('0x39')][_0x25f9('0x3c')]?_0x5615a2[_0x25f9('0x39')]:_0x514c3d[_0x25f9('0x3a')];_0x5615a2[_0x25f9('0x40')]=qs[_0x25f9('0x41')](_0x5cee78['query']['sort']);_0x5615a2[_0x25f9('0x44')]=qs[_0x25f9('0x42')](_[_0x25f9('0x65')](_0x5cee78[_0x25f9('0x36')],_0x514c3d[_0x25f9('0x42')]));if(_0x5cee78['query'][_0x25f9('0x43')]){_0x5615a2['where']=_[_0x25f9('0x46')](_0x5615a2[_0x25f9('0x44')],{'$or':_['map'](_0x5615a2[_0x25f9('0x39')],function(_0x47483d){var _0x294ca2={};_0x294ca2[_0x47483d]={'$like':'%'+_0x5cee78['query'][_0x25f9('0x43')]+'%'};return _0x294ca2;})});}_0x5615a2=_[_0x25f9('0x46')]({},_0x5615a2,_0x5cee78[_0x25f9('0x47')]);return _0x47e9d7[_0x25f9('0x63')](_0x5615a2);}})['then'](function(_0x1c9055){if(_0x1c9055){_0x2a0f96=_0x1c9055[_0x25f9('0x3c')];if(!_0x5cee78[_0x25f9('0x36')][_0x25f9('0x3d')](_0x25f9('0x3e'))){_0x5615a2[_0x25f9('0x3f')]=qs[_0x25f9('0x3f')](_0x5cee78[_0x25f9('0x36')][_0x25f9('0x3f')]);_0x5615a2[_0x25f9('0x21')]=qs[_0x25f9('0x21')](_0x5cee78[_0x25f9('0x36')]['offset']);}return _0x47e9d7[_0x25f9('0x63')](_0x5615a2);}})['then'](function(_0x29e61f){if(_0x29e61f){return _0x29e61f?{'count':_0x2a0f96,'rows':_0x29e61f}:null;}})[_0x25f9('0x28')](respondWithResult(_0x373b54,null))['catch'](handleError(_0x373b54,null));};exports[_0x25f9('0x66')]=function(_0xe0d9c1,_0x5de68d,_0x2c482b){var _0x5c4438=_0xe0d9c1[_0x25f9('0x4f')][_0x25f9('0x67')];return db[_0x25f9('0x64')][_0x25f9('0x49')]({'where':{'id':_0x5c4438},'attributes':['id'],'include':[{'model':db[_0x25f9('0x68')],'as':_0x25f9('0x69'),'attributes':['id',_0x25f9('0x2e'),_0x25f9('0x6a'),_0x25f9('0x6b'),'interface'],'raw':!![]}]})[_0x25f9('0x28')](function(_0x4ca5df){if(_0x4ca5df){var _0x121a63=_[_0x25f9('0x6c')](_0x4ca5df,function(_0x4be913){var _0x20203a=_0x4be913['get']({'plain':!![]});return _0x20203a['Agents'];});return db[_0x25f9('0x32')]['find']({'where':{'id':_0xe0d9c1[_0x25f9('0x56')]['id']}})[_0x25f9('0x28')](function(_0x463fac){return db[_0x25f9('0x6d')][_0x25f9('0x6e')](function(_0x1b5cb8){return _0x463fac['addTeams'](_0x5c4438,{'transaction':_0x1b5cb8})['then'](function(){return BPromise['each'](_0x121a63,function(_0x29686f){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x29686f['id'],'WhatsappQueueId':_0xe0d9c1[_0x25f9('0x56')]['id']},'transaction':_0x1b5cb8});});})[_0x25f9('0x28')](function(){_0x121a63[_0x25f9('0x6f')](function(_0x3f33bd){socket[_0x25f9('0x70')](_0x25f9('0x71'),{'UserId':_0x3f33bd['id'],'WhatsappQueueId':_0x463fac['id']});});});});});}})[_0x25f9('0x28')](respondWithStatusCode(_0x5de68d,null))[_0x25f9('0x4d')](handleError(_0x5de68d,null));};exports[_0x25f9('0x72')]=function(_0x37a90e,_0x3a46d3,_0x9f36c0){return db[_0x25f9('0x64')]['findAll']({'where':{'id':_0x37a90e[_0x25f9('0x36')][_0x25f9('0x67')]},'attributes':['id'],'include':[{'model':db[_0x25f9('0x68')],'as':_0x25f9('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3a46d3,null))[_0x25f9('0x28')](function(_0xc011b7){var _0x35f2ba=_[_0x25f9('0x31')](_0xc011b7,'id');var _0x157524=[];var _0x5be925=[];var _0x216591=squel[_0x25f9('0x73')]();_0x216591[_0x25f9('0x74')](_0x25f9('0x75'))[_0x25f9('0x76')]('team_has_whatsapp_queues','tq')['join']('user_has_teams','ut',_0x25f9('0x77'))[_0x25f9('0x44')](_0x25f9('0x78'),_0x37a90e['params']['id']);for(var _0x3298c8=0x0;_0x3298c8<_0xc011b7[_0x25f9('0x3c')];_0x3298c8+=0x1){let _0x57d075=_0xc011b7[_0x3298c8];for(var _0x2e6fb1=0x0;_0x2e6fb1<_0x57d075[_0x25f9('0x69')]['length'];_0x2e6fb1+=0x1){let _0x429100=_0x57d075[_0x25f9('0x69')][_0x2e6fb1];var _0xcd9a9d=_0x216591[_0x25f9('0x79')]();_0xcd9a9d[_0x25f9('0x44')](_0x25f9('0x7a'),_0x429100['id']);_0x5be925[_0x25f9('0x7b')](db[_0x25f9('0x6d')][_0x25f9('0x36')](_0xcd9a9d[_0x25f9('0x7c')](),{'type':db[_0x25f9('0x6d')][_0x25f9('0x7d')][_0x25f9('0x7e')]})[_0x25f9('0x28')](function(_0xbba2af){if(_0xbba2af[_0x25f9('0x3c')]===0x1){return _0x429100['id'];}else{var _0x16edd2=_['every'](_[_0x25f9('0x31')](_0xbba2af,_0x25f9('0x7f')),function(_0x3fcecb){return _[_0x25f9('0x80')](_0x35f2ba,_0x3fcecb);});if(_0x16edd2){return _0x429100['id'];}}}));}}return BPromise[_0x25f9('0x81')](_0x5be925)[_0x25f9('0x28')](function(_0x40451f){_0x157524=_(_0x157524)[_0x25f9('0x82')](_0x40451f)[_0x25f9('0x83')]()['value']();return db[_0x25f9('0x32')][_0x25f9('0x4c')]({'where':{'id':_0x37a90e[_0x25f9('0x56')]['id']}})['then'](function(_0x4e6361){return db[_0x25f9('0x6d')]['transaction'](function(_0x14e53e){return _0x4e6361['removeTeams'](_0x37a90e[_0x25f9('0x36')][_0x25f9('0x67')],{'transaction':_0x14e53e})[_0x25f9('0x28')](function(){if(!_[_0x25f9('0x84')](_0x157524)){return _0x4e6361[_0x25f9('0x85')](_0x157524,{'transaction':_0x14e53e});}})['then'](function(){_0x157524['forEach'](function(_0x2840ae){socket['emit'](_0x25f9('0x86'),{'UserId':_0x2840ae,'WhatsappQueueId':_0x4e6361['id']});});});});});});})[_0x25f9('0x28')](respondWithStatusCode(_0x3a46d3,null))[_0x25f9('0x4d')](handleError(_0x3a46d3,null));};exports[_0x25f9('0x87')]=function(_0x52da46,_0x4974f4,_0x161ebd){return db[_0x25f9('0x32')]['find']({'where':{'id':_0x52da46[_0x25f9('0x56')]['id']}})[_0x25f9('0x28')](handleEntityNotFound(_0x4974f4,null))[_0x25f9('0x28')](function(_0x3f4cbd){if(_0x3f4cbd){return _0x3f4cbd[_0x25f9('0x87')](_0x52da46[_0x25f9('0x4f')][_0x25f9('0x67')],_[_0x25f9('0x88')](_0x52da46[_0x25f9('0x4f')],[_0x25f9('0x67'),'id'])||{})[_0x25f9('0x89')](function(_0x5bc59b){for(var _0x38472f=0x0;_0x38472f<_0x52da46[_0x25f9('0x4f')][_0x25f9('0x67')][_0x25f9('0x3c')];_0x38472f+=0x1){socket[_0x25f9('0x70')]('userWhatsappQueue:save',{'UserId':_0x52da46[_0x25f9('0x4f')][_0x25f9('0x67')][_0x38472f],'WhatsappQueueId':_0x52da46['params']['id']});}return _0x5bc59b;});}})[_0x25f9('0x28')](respondWithResult(_0x4974f4,null))[_0x25f9('0x4d')](handleError(_0x4974f4,null));};exports[_0x25f9('0x85')]=function(_0x32ea7f,_0x1dbde8,_0x2c1705){return db[_0x25f9('0x32')][_0x25f9('0x4c')]({'where':{'id':_0x32ea7f[_0x25f9('0x56')]['id']}})[_0x25f9('0x28')](handleEntityNotFound(_0x1dbde8,null))[_0x25f9('0x28')](function(_0x20a08c){if(_0x20a08c){return _0x20a08c[_0x25f9('0x85')](_0x32ea7f['query'][_0x25f9('0x67')])[_0x25f9('0x28')](function(){if(_[_0x25f9('0x8a')](_0x32ea7f['query'][_0x25f9('0x67')])){for(var _0x53f17b=0x0;_0x53f17b<_0x32ea7f[_0x25f9('0x36')][_0x25f9('0x67')][_0x25f9('0x3c')];_0x53f17b+=0x1){socket['emit'](_0x25f9('0x86'),{'UserId':Number(_0x32ea7f['query']['ids'][_0x53f17b]),'WhatsappQueueId':Number(_0x32ea7f[_0x25f9('0x56')]['id'])});}}else{socket['emit'](_0x25f9('0x86'),{'UserId':Number(_0x32ea7f[_0x25f9('0x36')]['ids']),'WhatsappQueueId':Number(_0x32ea7f['params']['id'])});}});}})[_0x25f9('0x28')](respondWithStatusCode(_0x1dbde8,null))[_0x25f9('0x4d')](handleError(_0x1dbde8,null));};exports[_0x25f9('0x8b')]=function(_0x2599db,_0x1d1aab,_0x28e2bd){var _0x4df45a={};var _0x11947f={};var _0x64014c;var _0x486d7b;return db[_0x25f9('0x32')][_0x25f9('0x59')]({'where':{'id':_0x2599db['params']['id']}})[_0x25f9('0x28')](handleEntityNotFound(_0x1d1aab,null))[_0x25f9('0x28')](function(_0xe003dd){if(_0xe003dd){_0x64014c=_0xe003dd;_0x11947f[_0x25f9('0x3a')]=_[_0x25f9('0x37')](db[_0x25f9('0x68')][_0x25f9('0x33')]);_0x11947f['query']=_[_0x25f9('0x37')](_0x2599db[_0x25f9('0x36')]);_0x11947f['filters']=_[_0x25f9('0x38')](_0x11947f[_0x25f9('0x3a')],_0x11947f[_0x25f9('0x36')]);_0x4df45a['attributes']=_[_0x25f9('0x38')](_0x11947f[_0x25f9('0x3a')],qs[_0x25f9('0x3b')](_0x2599db['query'][_0x25f9('0x3b')]));_0x4df45a[_0x25f9('0x39')]=_0x4df45a[_0x25f9('0x39')]['length']?_0x4df45a['attributes']:_0x11947f[_0x25f9('0x3a')];_0x4df45a[_0x25f9('0x40')]=qs[_0x25f9('0x41')](_0x2599db[_0x25f9('0x36')]['sort']);_0x4df45a['where']=qs[_0x25f9('0x42')](_[_0x25f9('0x65')](_0x2599db['query'],_0x11947f[_0x25f9('0x42')]));if(_0x2599db['query'][_0x25f9('0x43')]){_0x4df45a[_0x25f9('0x44')]=_['merge'](_0x4df45a['where'],{'$or':_['map'](_0x4df45a[_0x25f9('0x39')],function(_0x1b5081){var _0x2930a2={};_0x2930a2[_0x1b5081]={'$like':'%'+_0x2599db['query'][_0x25f9('0x43')]+'%'};return _0x2930a2;})});}_0x4df45a=_['merge']({},_0x4df45a,_0x2599db[_0x25f9('0x47')]);return _0x64014c[_0x25f9('0x8b')](_0x4df45a);}})[_0x25f9('0x28')](function(_0x2c8246){if(_0x2c8246){_0x486d7b=_0x2c8246[_0x25f9('0x3c')];if(!_0x2599db[_0x25f9('0x36')][_0x25f9('0x3d')](_0x25f9('0x3e'))){_0x4df45a[_0x25f9('0x3f')]=qs[_0x25f9('0x3f')](_0x2599db[_0x25f9('0x36')][_0x25f9('0x3f')]);_0x4df45a[_0x25f9('0x21')]=qs[_0x25f9('0x21')](_0x2599db[_0x25f9('0x36')][_0x25f9('0x21')]);}return _0x64014c[_0x25f9('0x8b')](_0x4df45a);}})[_0x25f9('0x28')](function(_0x27e0fe){if(_0x27e0fe){return _0x27e0fe?{'count':_0x486d7b,'rows':_0x27e0fe}:null;}})[_0x25f9('0x28')](respondWithResult(_0x1d1aab,null))[_0x25f9('0x4d')](handleError(_0x1d1aab,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index cea3688..bc3d54d 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 _0xb7ea=['update','remove','emit','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb7ea,0xc1));var _0xab7e=function(_0x133f81,_0x550e62){_0x133f81=_0x133f81-0x0;var _0x2eef30=_0xb7ea[_0x133f81];return _0x2eef30;};'use strict';var EventEmitter=require(_0xab7e('0x0'));var WhatsappQueue=require(_0xab7e('0x1'))['db'][_0xab7e('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xab7e('0x3')](0x0);var events={'afterCreate':_0xab7e('0x4'),'afterUpdate':_0xab7e('0x5'),'afterDestroy':_0xab7e('0x6')};function emitEvent(_0x3089f8){return function(_0x36ddca,_0xb971fe,_0x3e9ce5){WhatsappQueueEvents[_0xab7e('0x7')](_0x3089f8+':'+_0x36ddca['id'],_0x36ddca);WhatsappQueueEvents['emit'](_0x3089f8,_0x36ddca);_0x3e9ce5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xab7e('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x92bd=['exports','events','save','remove','emit','hasOwnProperty','hook'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x92bd,0x13c));var _0xd92b=function(_0x170ba6,_0x4b36cc){_0x170ba6=_0x170ba6-0x0;var _0x402422=_0x92bd[_0x170ba6];return _0x402422;};'use strict';var EventEmitter=require(_0xd92b('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd92b('0x1'),'afterUpdate':'update','afterDestroy':_0xd92b('0x2')};function emitEvent(_0x3c10b){return function(_0x193676,_0x27e37b,_0x4b61b0){WhatsappQueueEvents[_0xd92b('0x3')](_0x3c10b+':'+_0x193676['id'],_0x193676);WhatsappQueueEvents[_0xd92b('0x3')](_0x3c10b,_0x193676);_0x4b61b0(null);};}for(var e in events){if(events[_0xd92b('0x4')](e)){var event=events[e];WhatsappQueue[_0xd92b('0x5')](e,emitEvent(event));}}module[_0xd92b('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 6555769..3a4213d 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 _0xf9ed=['api','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','WhatsappQueue','whatsapp_queues','util'];(function(_0x4cfc1d,_0x2c0927){var _0x1c01a0=function(_0x264a74){while(--_0x264a74){_0x4cfc1d['push'](_0x4cfc1d['shift']());}};_0x1c01a0(++_0x2c0927);}(_0xf9ed,0xcf));var _0xdf9e=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xf9ed[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require('lodash');var util=require(_0xdf9e('0x0'));var logger=require('../../config/logger')(_0xdf9e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdf9e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdf9e('0x3'));var config=require(_0xdf9e('0x4'));var attributes=require(_0xdf9e('0x5'));module['exports']=function(_0x2eebb3,_0x38bbd3){return _0x2eebb3['define'](_0xdf9e('0x6'),attributes,{'tableName':_0xdf9e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a39=['util','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x3cc411,_0x53a261){var _0x27bd2e=function(_0x2fd260){while(--_0x2fd260){_0x3cc411['push'](_0x3cc411['shift']());}};_0x27bd2e(++_0x53a261);}(_0x0a39,0x1ed));var _0x90a3=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0a39[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x90a3('0x0'));var util=require(_0x90a3('0x1'));var logger=require(_0x90a3('0x2'))(_0x90a3('0x3'));var moment=require(_0x90a3('0x4'));var BPromise=require(_0x90a3('0x5'));var rp=require(_0x90a3('0x6'));var fs=require('fs');var path=require(_0x90a3('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x90a3('0x8'));module[_0x90a3('0x9')]=function(_0x534468,_0x3d965d){return _0x534468[_0x90a3('0xa')](_0x90a3('0xb'),attributes,{'tableName':_0x90a3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 819713b..61a89e3 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 _0x7c89=['request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','WhatsappQueue','findAll','options','where','attributes','limit','include','map','model','GetWhatsappQueue','ShowWhatsappQueue','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappQueue.socket','register'];(function(_0x270eeb,_0xce1df7){var _0x513e97=function(_0x1bb09f){while(--_0x1bb09f){_0x270eeb['push'](_0x270eeb['shift']());}};_0x513e97(++_0xce1df7);}(_0x7c89,0xc1));var _0x97c8=function(_0x5857a7,_0x3f8601){_0x5857a7=_0x5857a7-0x0;var _0x2c35e4=_0x7c89[_0x5857a7];return _0x2c35e4;};'use strict';var _=require(_0x97c8('0x0'));var util=require(_0x97c8('0x1'));var moment=require(_0x97c8('0x2'));var BPromise=require('bluebird');var rs=require(_0x97c8('0x3'));var fs=require('fs');var Redis=require(_0x97c8('0x4'));var db=require(_0x97c8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x97c8('0x6'))(_0x97c8('0x7'));var config=require(_0x97c8('0x8'));var jayson=require(_0x97c8('0x9'));var client=jayson[_0x97c8('0xa')][_0x97c8('0xb')]({'port':0x232a});config['redis']=_[_0x97c8('0xc')](config[_0x97c8('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x97c8('0xe'))(new Redis(config['redis']));require(_0x97c8('0xf'))[_0x97c8('0x10')](socket);function respondWithRpcPromise(_0xfa1fd8,_0x11b738,_0x322606){return new BPromise(function(_0x3fb71c,_0x565a1c){return client[_0x97c8('0x11')](_0xfa1fd8,_0x322606)[_0x97c8('0x12')](function(_0xd6434b){logger[_0x97c8('0x13')](_0x97c8('0x14'),_0x11b738,'request\x20sent');logger[_0x97c8('0x15')](_0x97c8('0x16'),_0x11b738,'request\x20sent',JSON[_0x97c8('0x17')](_0xd6434b));if(_0xd6434b[_0x97c8('0x18')]){if(_0xd6434b[_0x97c8('0x18')][_0x97c8('0x19')]===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x11b738,_0xd6434b[_0x97c8('0x18')]['message']);return _0x565a1c(_0xd6434b[_0x97c8('0x18')]['message']);}logger[_0x97c8('0x18')](_0x97c8('0x14'),_0x11b738,_0xd6434b['error']['message']);return _0x3fb71c(_0xd6434b[_0x97c8('0x18')][_0x97c8('0x1a')]);}else{logger['info'](_0x97c8('0x14'),_0x11b738,_0x97c8('0x1b'));_0x3fb71c(_0xd6434b['result'][_0x97c8('0x1a')]);}})[_0x97c8('0x1c')](function(_0x3eb46c){logger[_0x97c8('0x18')](_0x97c8('0x14'),_0x11b738,_0x3eb46c);_0x565a1c(_0x3eb46c);});});}exports['GetWhatsappQueue']=function(_0x2eddc3){var _0xe9969b=this;return new Promise(function(_0x31c697,_0x1fb614){return db[_0x97c8('0x1d')][_0x97c8('0x1e')]({'raw':_0x2eddc3[_0x97c8('0x1f')]?_0x2eddc3[_0x97c8('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2eddc3[_0x97c8('0x1f')]?_0x2eddc3[_0x97c8('0x1f')][_0x97c8('0x20')]||null:null,'attributes':_0x2eddc3['options']?_0x2eddc3[_0x97c8('0x1f')][_0x97c8('0x21')]||null:null,'limit':_0x2eddc3[_0x97c8('0x1f')]?_0x2eddc3['options'][_0x97c8('0x22')]||null:null,'include':_0x2eddc3[_0x97c8('0x1f')]?_0x2eddc3[_0x97c8('0x1f')][_0x97c8('0x23')]?_[_0x97c8('0x24')](_0x2eddc3[_0x97c8('0x1f')][_0x97c8('0x23')],function(_0x3f69e4){return{'model':db[_0x3f69e4[_0x97c8('0x25')]],'as':_0x3f69e4['as'],'attributes':_0x3f69e4['attributes'],'include':_0x3f69e4[_0x97c8('0x23')]?_[_0x97c8('0x24')](_0x3f69e4[_0x97c8('0x23')],function(_0x38558e){return{'model':db[_0x38558e[_0x97c8('0x25')]],'as':_0x38558e['as'],'attributes':_0x38558e[_0x97c8('0x21')],'include':_0x38558e[_0x97c8('0x23')]?_['map'](_0x38558e[_0x97c8('0x23')],function(_0x5581e1){return{'model':db[_0x5581e1[_0x97c8('0x25')]],'as':_0x5581e1['as'],'attributes':_0x5581e1[_0x97c8('0x21')]};}):[]};}):[]};}):[]:[]})[_0x97c8('0x12')](function(_0x2eb18d){logger[_0x97c8('0x13')](_0x97c8('0x26'),_0x2eddc3);logger[_0x97c8('0x15')](_0x97c8('0x26'),_0x2eddc3,JSON[_0x97c8('0x17')](_0x2eb18d));_0x31c697(_0x2eb18d);})[_0x97c8('0x1c')](function(_0x4983be){logger[_0x97c8('0x18')]('GetWhatsappQueue',_0x4983be['message'],_0x2eddc3);_0x1fb614(_0xe9969b[_0x97c8('0x18')](0x1f4,_0x4983be[_0x97c8('0x1a')]));});});};exports[_0x97c8('0x27')]=function(_0x1b0969){var _0x4ffaf0=this;return new Promise(function(_0x6ec9cf,_0x1d5aa2){return db[_0x97c8('0x1d')][_0x97c8('0x28')]({'raw':_0x1b0969[_0x97c8('0x1f')]?_0x1b0969[_0x97c8('0x1f')][_0x97c8('0x29')]===undefined?!![]:![]:!![],'where':_0x1b0969[_0x97c8('0x1f')]?_0x1b0969['options'][_0x97c8('0x20')]||null:null,'attributes':_0x1b0969['options']?_0x1b0969[_0x97c8('0x1f')]['attributes']||null:null,'include':_0x1b0969[_0x97c8('0x1f')]?_0x1b0969[_0x97c8('0x1f')]['include']?_['map'](_0x1b0969[_0x97c8('0x1f')][_0x97c8('0x23')],function(_0x592b11){return{'model':db[_0x592b11[_0x97c8('0x25')]],'as':_0x592b11['as'],'attributes':_0x592b11['attributes'],'include':_0x592b11[_0x97c8('0x23')]?_[_0x97c8('0x24')](_0x592b11[_0x97c8('0x23')],function(_0x42feba){return{'model':db[_0x42feba[_0x97c8('0x25')]],'as':_0x42feba['as'],'attributes':_0x42feba[_0x97c8('0x21')],'include':_0x42feba[_0x97c8('0x23')]?_[_0x97c8('0x24')](_0x42feba[_0x97c8('0x23')],function(_0x1fc9b9){return{'model':db[_0x1fc9b9[_0x97c8('0x25')]],'as':_0x1fc9b9['as'],'attributes':_0x1fc9b9[_0x97c8('0x21')]};}):[]};}):[]};}):[]:[]})[_0x97c8('0x12')](function(_0xeae308){logger[_0x97c8('0x13')](_0x97c8('0x27'),_0x1b0969);logger['debug'](_0x97c8('0x27'),_0x1b0969,JSON[_0x97c8('0x17')](_0xeae308));_0x6ec9cf(_0xeae308);})[_0x97c8('0x1c')](function(_0x7e10){logger[_0x97c8('0x18')](_0x97c8('0x27'),_0x7e10[_0x97c8('0x1a')],_0x1b0969);_0x1d5aa2(_0x4ffaf0[_0x97c8('0x18')](0x1f4,_0x7e10[_0x97c8('0x1a')]));});});}; \ No newline at end of file +var _0x543d=['stringify','error','code','message','result','catch','findAll','options','raw','attributes','limit','include','map','model','GetWhatsappQueue','ShowWhatsappQueue','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1fcf1b,_0x214549){var _0x5d2952=function(_0x3331b7){while(--_0x3331b7){_0x1fcf1b['push'](_0x1fcf1b['shift']());}};_0x5d2952(++_0x214549);}(_0x543d,0x101));var _0xd543=function(_0x4ee799,_0x22e2c2){_0x4ee799=_0x4ee799-0x0;var _0x26fe5b=_0x543d[_0x4ee799];return _0x26fe5b;};'use strict';var _=require(_0xd543('0x0'));var util=require('util');var moment=require(_0xd543('0x1'));var BPromise=require(_0xd543('0x2'));var rs=require(_0xd543('0x3'));var fs=require('fs');var Redis=require(_0xd543('0x4'));var db=require(_0xd543('0x5'))['db'];var utils=require(_0xd543('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd543('0x7'));var jayson=require(_0xd543('0x8'));var client=jayson[_0xd543('0x9')][_0xd543('0xa')]({'port':0x232a});config[_0xd543('0xb')]=_['defaults'](config[_0xd543('0xb')],{'host':_0xd543('0xc'),'port':0x18eb});var socket=require(_0xd543('0xd'))(new Redis(config[_0xd543('0xb')]));require(_0xd543('0xe'))[_0xd543('0xf')](socket);function respondWithRpcPromise(_0x4effe7,_0x5ee1fd,_0x4a720b){return new BPromise(function(_0x1cd21f,_0x4f62bf){return client[_0xd543('0x10')](_0x4effe7,_0x4a720b)[_0xd543('0x11')](function(_0x529576){logger[_0xd543('0x12')](_0xd543('0x13'),_0x5ee1fd,_0xd543('0x14'));logger[_0xd543('0x15')](_0xd543('0x16'),_0x5ee1fd,_0xd543('0x14'),JSON[_0xd543('0x17')](_0x529576));if(_0x529576[_0xd543('0x18')]){if(_0x529576[_0xd543('0x18')][_0xd543('0x19')]===0x1f4){logger[_0xd543('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x5ee1fd,_0x529576[_0xd543('0x18')][_0xd543('0x1a')]);return _0x4f62bf(_0x529576[_0xd543('0x18')][_0xd543('0x1a')]);}logger[_0xd543('0x18')](_0xd543('0x13'),_0x5ee1fd,_0x529576['error'][_0xd543('0x1a')]);return _0x1cd21f(_0x529576['error'][_0xd543('0x1a')]);}else{logger['info'](_0xd543('0x13'),_0x5ee1fd,_0xd543('0x14'));_0x1cd21f(_0x529576[_0xd543('0x1b')]['message']);}})[_0xd543('0x1c')](function(_0xdb1c1b){logger[_0xd543('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x5ee1fd,_0xdb1c1b);_0x4f62bf(_0xdb1c1b);});});}exports['GetWhatsappQueue']=function(_0x490e60){var _0x58797e=this;return new Promise(function(_0x38a78a,_0x53c750){return db['WhatsappQueue'][_0xd543('0x1d')]({'raw':_0x490e60[_0xd543('0x1e')]?_0x490e60[_0xd543('0x1e')][_0xd543('0x1f')]===undefined?!![]:![]:!![],'where':_0x490e60['options']?_0x490e60[_0xd543('0x1e')]['where']||null:null,'attributes':_0x490e60[_0xd543('0x1e')]?_0x490e60[_0xd543('0x1e')][_0xd543('0x20')]||null:null,'limit':_0x490e60[_0xd543('0x1e')]?_0x490e60[_0xd543('0x1e')][_0xd543('0x21')]||null:null,'include':_0x490e60[_0xd543('0x1e')]?_0x490e60[_0xd543('0x1e')][_0xd543('0x22')]?_[_0xd543('0x23')](_0x490e60[_0xd543('0x1e')][_0xd543('0x22')],function(_0x587f32){return{'model':db[_0x587f32['model']],'as':_0x587f32['as'],'attributes':_0x587f32[_0xd543('0x20')],'include':_0x587f32[_0xd543('0x22')]?_[_0xd543('0x23')](_0x587f32['include'],function(_0x29dac2){return{'model':db[_0x29dac2[_0xd543('0x24')]],'as':_0x29dac2['as'],'attributes':_0x29dac2['attributes'],'include':_0x29dac2[_0xd543('0x22')]?_['map'](_0x29dac2[_0xd543('0x22')],function(_0x3b9abd){return{'model':db[_0x3b9abd['model']],'as':_0x3b9abd['as'],'attributes':_0x3b9abd[_0xd543('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd543('0x11')](function(_0x5a76e2){logger[_0xd543('0x12')](_0xd543('0x25'),_0x490e60);logger[_0xd543('0x15')](_0xd543('0x25'),_0x490e60,JSON[_0xd543('0x17')](_0x5a76e2));_0x38a78a(_0x5a76e2);})['catch'](function(_0xd1f724){logger[_0xd543('0x18')]('GetWhatsappQueue',_0xd1f724[_0xd543('0x1a')],_0x490e60);_0x53c750(_0x58797e['error'](0x1f4,_0xd1f724['message']));});});};exports[_0xd543('0x26')]=function(_0x166d1b){var _0xedd168=this;return new Promise(function(_0x24116d,_0x39f166){return db['WhatsappQueue']['find']({'raw':_0x166d1b[_0xd543('0x1e')]?_0x166d1b[_0xd543('0x1e')][_0xd543('0x1f')]===undefined?!![]:![]:!![],'where':_0x166d1b[_0xd543('0x1e')]?_0x166d1b[_0xd543('0x1e')][_0xd543('0x27')]||null:null,'attributes':_0x166d1b[_0xd543('0x1e')]?_0x166d1b[_0xd543('0x1e')][_0xd543('0x20')]||null:null,'include':_0x166d1b[_0xd543('0x1e')]?_0x166d1b[_0xd543('0x1e')][_0xd543('0x22')]?_[_0xd543('0x23')](_0x166d1b['options'][_0xd543('0x22')],function(_0x17bd4d){return{'model':db[_0x17bd4d[_0xd543('0x24')]],'as':_0x17bd4d['as'],'attributes':_0x17bd4d[_0xd543('0x20')],'include':_0x17bd4d['include']?_[_0xd543('0x23')](_0x17bd4d[_0xd543('0x22')],function(_0xbf7ef7){return{'model':db[_0xbf7ef7['model']],'as':_0xbf7ef7['as'],'attributes':_0xbf7ef7[_0xd543('0x20')],'include':_0xbf7ef7[_0xd543('0x22')]?_['map'](_0xbf7ef7['include'],function(_0x320ba9){return{'model':db[_0x320ba9['model']],'as':_0x320ba9['as'],'attributes':_0x320ba9['attributes']};}):[]};}):[]};}):[]:[]})[_0xd543('0x11')](function(_0xa65a2c){logger[_0xd543('0x12')](_0xd543('0x26'),_0x166d1b);logger[_0xd543('0x15')](_0xd543('0x26'),_0x166d1b,JSON['stringify'](_0xa65a2c));_0x24116d(_0xa65a2c);})[_0xd543('0x1c')](function(_0xd2eea4){logger[_0xd543('0x18')]('ShowWhatsappQueue',_0xd2eea4[_0xd543('0x1a')],_0x166d1b);_0x39f166(_0xedd168[_0xd543('0x18')](0x1f4,_0xd2eea4['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index da13637..129f7f3 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 _0x3b8c=['register','length','whatsappQueue:','./whatsappQueue.events','save','remove','update','emit','removeListener'];(function(_0x1e3538,_0x4335fa){var _0x1eae23=function(_0xd7eb01){while(--_0xd7eb01){_0x1e3538['push'](_0x1e3538['shift']());}};_0x1eae23(++_0x4335fa);}(_0x3b8c,0x1b3));var _0xc3b8=function(_0x3cb2f3,_0x3ec0d5){_0x3cb2f3=_0x3cb2f3-0x0;var _0x499b5c=_0x3b8c[_0x3cb2f3];return _0x499b5c;};'use strict';var WhatsappQueueEvents=require(_0xc3b8('0x0'));var events=[_0xc3b8('0x1'),_0xc3b8('0x2'),_0xc3b8('0x3')];function createListener(_0x313b12,_0x4f91a0){return function(_0x412cd7){_0x4f91a0[_0xc3b8('0x4')](_0x313b12,_0x412cd7);};}function removeListener(_0x4a5c41,_0xb63694){return function(){WhatsappQueueEvents[_0xc3b8('0x5')](_0x4a5c41,_0xb63694);};}exports[_0xc3b8('0x6')]=function(_0x5ece8f){for(var _0x5848a9=0x0,_0x1d3805=events[_0xc3b8('0x7')];_0x5848a9<_0x1d3805;_0x5848a9++){var _0x55604e=events[_0x5848a9];var _0x25e9f1=createListener(_0xc3b8('0x8')+_0x55604e,_0x5ece8f);WhatsappQueueEvents['on'](_0x55604e,_0x25e9f1);}}; \ No newline at end of file +var _0x767a=['removeListener','whatsappQueue:','save','remove','update','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x767a,0x1b8));var _0xa767=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x767a[_0x502c7d];return _0x30b7ed;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xa767('0x0'),_0xa767('0x1'),_0xa767('0x2')];function createListener(_0x610d99,_0x43186f){return function(_0xdc6af6){_0x43186f[_0xa767('0x3')](_0x610d99,_0xdc6af6);};}function removeListener(_0xd65c46,_0x22fa2d){return function(){WhatsappQueueEvents[_0xa767('0x4')](_0xd65c46,_0x22fa2d);};}exports['register']=function(_0x28a68e){for(var _0x1f5dd1=0x0,_0x4ecbbe=events['length'];_0x1f5dd1<_0x4ecbbe;_0x1f5dd1++){var _0x19c05c=events[_0x1f5dd1];var _0x309ea0=createListener(_0xa767('0x5')+_0x19c05c,_0x28a68e);WhatsappQueueEvents['on'](_0x19c05c,_0x309ea0);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index a6f53b1..4e98751 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 _0xe64b=['util','path','express','Router','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0x296754,_0x5befe9){var _0x1d9f1d=function(_0x3f033e){while(--_0x3f033e){_0x296754['push'](_0x296754['shift']());}};_0x1d9f1d(++_0x5befe9);}(_0xe64b,0x1a3));var _0xbe64=function(_0x15d240,_0x386c45){_0x15d240=_0x15d240-0x0;var _0x587186=_0xe64b[_0x15d240];return _0x587186;};'use strict';var multer=require(_0xbe64('0x0'));var util=require(_0xbe64('0x1'));var path=require(_0xbe64('0x2'));var timeout=require('connect-timeout');var express=require(_0xbe64('0x3'));var router=express[_0xbe64('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe64('0x5'));var config=require(_0xbe64('0x6'));var controller=require(_0xbe64('0x7'));router['get']('/',auth[_0xbe64('0x8')](),controller[_0xbe64('0x9')]);router[_0xbe64('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xbe64('0xb')]);router[_0xbe64('0xa')](_0xbe64('0xc'),auth[_0xbe64('0x8')](),controller[_0xbe64('0xd')]);router[_0xbe64('0xe')]('/',auth[_0xbe64('0x8')](),controller[_0xbe64('0xf')]);router[_0xbe64('0x10')](_0xbe64('0xc'),auth[_0xbe64('0x8')](),controller[_0xbe64('0x11')]);router[_0xbe64('0x12')](_0xbe64('0xc'),auth[_0xbe64('0x8')](),controller['destroy']);module[_0xbe64('0x13')]=router; \ No newline at end of file +var _0x3c36=['../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','put','update','delete','/:id','destroy','exports','path','connect-timeout','express','../../components/auth/service'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x3c36,0x10c));var _0x63c3=function(_0x539d2f,_0x1ef8e1){_0x539d2f=_0x539d2f-0x0;var _0x3a7dc1=_0x3c36[_0x539d2f];return _0x3a7dc1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x63c3('0x0'));var timeout=require(_0x63c3('0x1'));var express=require(_0x63c3('0x2'));var router=express['Router']();var auth=require(_0x63c3('0x3'));var interaction=require(_0x63c3('0x4'));var config=require(_0x63c3('0x5'));var controller=require('./whatsappQueueReport.controller');router[_0x63c3('0x6')]('/',auth[_0x63c3('0x7')](),controller['index']);router['get']('/describe',auth[_0x63c3('0x7')](),controller['describe']);router[_0x63c3('0x6')]('/:id',auth[_0x63c3('0x7')](),controller[_0x63c3('0x8')]);router[_0x63c3('0x9')]('/',auth[_0x63c3('0x7')](),controller['create']);router[_0x63c3('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x63c3('0xb')]);router[_0x63c3('0xc')](_0x63c3('0xd'),auth[_0x63c3('0x7')](),controller[_0x63c3('0xe')]);module[_0x63c3('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index a799381..7188dd9 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x1c062c,_0xb40f7d){var _0x334082=function(_0x231202){while(--_0x231202){_0x1c062c['push'](_0x1c062c['shift']());}};_0x334082(++_0xb40f7d);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0xa41a=['exports','STRING','DATE','sequelize'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xa41a,0x6b));var _0xaa41=function(_0x28c20f,_0x59455e){_0x28c20f=_0x28c20f-0x0;var _0x5e1cf0=_0xa41a[_0x28c20f];return _0x5e1cf0;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xaa41('0x2')]},'joinAt':{'type':Sequelize[_0xaa41('0x3')]},'leaveAt':{'type':Sequelize[_0xaa41('0x3')]},'acceptAt':{'type':Sequelize[_0xaa41('0x3')]},'exitAt':{'type':Sequelize[_0xaa41('0x3')]},'reason':{'type':Sequelize[_0xaa41('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 40c4b45..162bfc9 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 _0xf590=['VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','WhatsappQueueReport','find','create','body','update','destroy','describe','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','then','sendStatus','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type'];(function(_0x28dfb1,_0x3f9a61){var _0x6a38fa=function(_0x133e0c){while(--_0x133e0c){_0x28dfb1['push'](_0x28dfb1['shift']());}};_0x6a38fa(++_0x3f9a61);}(_0xf590,0x145));var _0x0f59=function(_0x3cb027,_0x1063a1){_0x3cb027=_0x3cb027-0x0;var _0x5004b7=_0xf590[_0x3cb027];return _0x5004b7;};'use strict';var pdf=require(_0x0f59('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0f59('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0f59('0x2'));var rp=require('request-promise');var moment=require(_0x0f59('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0f59('0x4'));var util=require(_0x0f59('0x5'));var path=require(_0x0f59('0x6'));var sox=require('sox');var csv=require(_0x0f59('0x7'));var ejs=require(_0x0f59('0x8'));var fs=require('fs');var _=require(_0x0f59('0x9'));var squel=require(_0x0f59('0xa'));var crypto=require(_0x0f59('0xb'));var jsforce=require(_0x0f59('0xc'));var deskjs=require(_0x0f59('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0f59('0xe'));var Papa=require(_0x0f59('0xf'));var Redis=require(_0x0f59('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0f59('0x11'));var as=require(_0x0f59('0x12'));var hardwareService=require(_0x0f59('0x13'));var logger=require(_0x0f59('0x14'))(_0x0f59('0x15'));var utils=require('../../config/utils');var config=require(_0x0f59('0x16'));var licenseUtil=require(_0x0f59('0x17'));var db=require(_0x0f59('0x18'))['db'];function respondWithStatusCode(_0x4c0b3c,_0x343991){_0x343991=_0x343991||0xcc;return function(_0x25fe14){if(_0x25fe14){return _0x4c0b3c['sendStatus'](_0x343991);}return _0x4c0b3c[_0x0f59('0x19')](_0x343991)[_0x0f59('0x1a')]();};}function respondWithResult(_0x2cf1ff,_0x50c1d3){_0x50c1d3=_0x50c1d3||0xc8;return function(_0x3081db){if(_0x3081db){return _0x2cf1ff['status'](_0x50c1d3)['json'](_0x3081db);}};}function respondWithFilteredResult(_0x158b0e,_0x1d3cd0){return function(_0x18902c){if(_0x18902c){var _0x392d7b=_0x18902c[_0x0f59('0x1b')],_0x40d734=_0x1d3cd0['offset'],_0x2124b5=_0x1d3cd0[_0x0f59('0x1c')]+_0x1d3cd0[_0x0f59('0x1d')],_0x18a5e7;if(_0x2124b5>=_0x392d7b){_0x2124b5=_0x392d7b;_0x18a5e7=0xc8;}else{_0x18a5e7=0xce;}_0x158b0e['status'](_0x18a5e7);return _0x158b0e[_0x0f59('0x1e')](_0x0f59('0x1f'),_0x40d734+'-'+_0x2124b5+'/'+_0x392d7b)[_0x0f59('0x20')](_0x18902c);}return null;};}function patchUpdates(_0x127515){return function(_0x4f1a4e){try{jsonpatch[_0x0f59('0x21')](_0x4f1a4e,_0x127515,!![]);}catch(_0xd6fd97){return BPromise[_0x0f59('0x22')](_0xd6fd97);}return _0x4f1a4e['save']();};}function saveUpdates(_0x72a440,_0x963dbe){return function(_0x371123){if(_0x371123){return _0x371123['update'](_0x72a440)[_0x0f59('0x23')](function(_0x2c27c7){return _0x2c27c7;});}return null;};}function removeEntity(_0x5a40fe,_0x243ee0){return function(_0x37c78b){if(_0x37c78b){return _0x37c78b['destroy']()['then'](function(){_0x5a40fe[_0x0f59('0x19')](0xcc)[_0x0f59('0x1a')]();});}};}function handleEntityNotFound(_0x27e82f,_0x127387){return function(_0x39ad19){if(!_0x39ad19){_0x27e82f[_0x0f59('0x24')](0x194);}return _0x39ad19;};}function handleError(_0x5986d8,_0x3e600b){_0x3e600b=_0x3e600b||0x1f4;return function(_0x32c475){logger['error'](_0x32c475[_0x0f59('0x25')]);if(_0x32c475['name']){delete _0x32c475[_0x0f59('0x26')];}_0x5986d8[_0x0f59('0x19')](_0x3e600b)[_0x0f59('0x27')](_0x32c475);};}exports[_0x0f59('0x28')]=function(_0x408079,_0x3ce954){var _0x456ece={},_0x261b8c={},_0x4e25b1={'count':0x0,'rows':[]};var _0x2a804c=_['map'](db['WhatsappQueueReport'][_0x0f59('0x29')],function(_0x52f2e0){return{'name':_0x52f2e0[_0x0f59('0x2a')],'type':_0x52f2e0['type'][_0x0f59('0x2b')]};});_0x261b8c[_0x0f59('0x2c')]=_['map'](_0x2a804c,'name');_0x261b8c[_0x0f59('0x2d')]=_['keys'](_0x408079['query']);_0x261b8c[_0x0f59('0x2e')]=_[_0x0f59('0x2f')](_0x261b8c['model'],_0x261b8c[_0x0f59('0x2d')]);_0x456ece['attributes']=_[_0x0f59('0x2f')](_0x261b8c[_0x0f59('0x2c')],qs['fields'](_0x408079[_0x0f59('0x2d')][_0x0f59('0x30')]));_0x456ece[_0x0f59('0x31')]=_0x456ece[_0x0f59('0x31')][_0x0f59('0x32')]?_0x456ece[_0x0f59('0x31')]:_0x261b8c[_0x0f59('0x2c')];if(!_0x408079[_0x0f59('0x2d')][_0x0f59('0x33')](_0x0f59('0x34'))){_0x456ece[_0x0f59('0x1d')]=qs[_0x0f59('0x1d')](_0x408079[_0x0f59('0x2d')][_0x0f59('0x1d')]);_0x456ece[_0x0f59('0x1c')]=qs['offset'](_0x408079['query'][_0x0f59('0x1c')]);}_0x456ece[_0x0f59('0x35')]=qs['sort'](_0x408079['query'][_0x0f59('0x36')]);_0x456ece[_0x0f59('0x37')]=qs[_0x0f59('0x2e')](_['pick'](_0x408079[_0x0f59('0x2d')],_0x261b8c[_0x0f59('0x2e')]),_0x2a804c);if(_0x408079[_0x0f59('0x2d')][_0x0f59('0x38')]){_0x456ece[_0x0f59('0x37')]=_[_0x0f59('0x39')](_0x456ece[_0x0f59('0x37')],{'$or':_[_0x0f59('0x3a')](_0x2a804c,function(_0x552be6){if(_0x552be6[_0x0f59('0x3b')]!==_0x0f59('0x3c')){var _0x53e1d4={};_0x53e1d4[_0x552be6[_0x0f59('0x26')]]={'$like':'%'+_0x408079[_0x0f59('0x2d')][_0x0f59('0x38')]+'%'};return _0x53e1d4;}})});}_0x456ece=_[_0x0f59('0x39')]({},_0x456ece,_0x408079[_0x0f59('0x3d')]);var _0x4cce4f={'where':_0x456ece['where']};return db['WhatsappQueueReport']['count'](_0x4cce4f)[_0x0f59('0x23')](function(_0x346269){_0x4e25b1[_0x0f59('0x1b')]=_0x346269;if(_0x408079[_0x0f59('0x2d')][_0x0f59('0x3e')]){_0x456ece[_0x0f59('0x3f')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x0f59('0x40')](_0x456ece);})[_0x0f59('0x23')](function(_0xda17de){_0x4e25b1[_0x0f59('0x41')]=_0xda17de;return _0x4e25b1;})['then'](respondWithFilteredResult(_0x3ce954,_0x456ece))[_0x0f59('0x42')](handleError(_0x3ce954,null));};exports[_0x0f59('0x43')]=function(_0x2c534a,_0x1399b){var _0x52fdc4={'raw':!![],'where':{'id':_0x2c534a[_0x0f59('0x44')]['id']}},_0x467aa0={};_0x467aa0[_0x0f59('0x2c')]=_[_0x0f59('0x45')](db['WhatsappQueueReport'][_0x0f59('0x29')]);_0x467aa0[_0x0f59('0x2d')]=_[_0x0f59('0x45')](_0x2c534a[_0x0f59('0x2d')]);_0x467aa0[_0x0f59('0x2e')]=_['intersection'](_0x467aa0[_0x0f59('0x2c')],_0x467aa0['query']);_0x52fdc4['attributes']=_[_0x0f59('0x2f')](_0x467aa0[_0x0f59('0x2c')],qs[_0x0f59('0x30')](_0x2c534a[_0x0f59('0x2d')][_0x0f59('0x30')]));_0x52fdc4[_0x0f59('0x31')]=_0x52fdc4[_0x0f59('0x31')][_0x0f59('0x32')]?_0x52fdc4[_0x0f59('0x31')]:_0x467aa0['model'];if(_0x2c534a[_0x0f59('0x2d')][_0x0f59('0x3e')]){_0x52fdc4[_0x0f59('0x3f')]=[{'all':!![]}];}_0x52fdc4=_[_0x0f59('0x39')]({},_0x52fdc4,_0x2c534a[_0x0f59('0x3d')]);return db[_0x0f59('0x46')][_0x0f59('0x47')](_0x52fdc4)[_0x0f59('0x23')](handleEntityNotFound(_0x1399b,null))[_0x0f59('0x23')](respondWithResult(_0x1399b,null))[_0x0f59('0x42')](handleError(_0x1399b,null));};exports[_0x0f59('0x48')]=function(_0x3d94d7,_0x54e345){return db[_0x0f59('0x46')][_0x0f59('0x48')](_0x3d94d7[_0x0f59('0x49')],{})[_0x0f59('0x23')](respondWithResult(_0x54e345,0xc9))[_0x0f59('0x42')](handleError(_0x54e345,null));};exports[_0x0f59('0x4a')]=function(_0x4cbd10,_0x5efd86){if(_0x4cbd10[_0x0f59('0x49')]['id']){delete _0x4cbd10[_0x0f59('0x49')]['id'];}return db['WhatsappQueueReport'][_0x0f59('0x47')]({'where':{'id':_0x4cbd10['params']['id']}})[_0x0f59('0x23')](handleEntityNotFound(_0x5efd86,null))[_0x0f59('0x23')](saveUpdates(_0x4cbd10['body'],null))[_0x0f59('0x23')](respondWithResult(_0x5efd86,null))[_0x0f59('0x42')](handleError(_0x5efd86,null));};exports[_0x0f59('0x4b')]=function(_0xafa0ef,_0x3a12d7){return db[_0x0f59('0x46')][_0x0f59('0x47')]({'where':{'id':_0xafa0ef['params']['id']}})[_0x0f59('0x23')](handleEntityNotFound(_0x3a12d7,null))[_0x0f59('0x23')](removeEntity(_0x3a12d7,null))['catch'](handleError(_0x3a12d7,null));};exports[_0x0f59('0x4c')]=function(_0x5c18ef,_0x3fe3ad){return db[_0x0f59('0x46')][_0x0f59('0x4c')]()[_0x0f59('0x23')](respondWithResult(_0x3fe3ad,null))['catch'](handleError(_0x3fe3ad,null));}; \ No newline at end of file +var _0xdc8c=['apply','reject','save','update','destroy','then','end','error','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xdc8c,0x1f4));var _0xcdc8=function(_0x11a796,_0x6cfa4b){_0x11a796=_0x11a796-0x0;var _0x581636=_0xdc8c[_0x11a796];return _0x581636;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcdc8('0x0'));var rimraf=require(_0xcdc8('0x1'));var zipdir=require(_0xcdc8('0x2'));var jsonpatch=require(_0xcdc8('0x3'));var rp=require(_0xcdc8('0x4'));var moment=require(_0xcdc8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcdc8('0x6'));var util=require('util');var path=require(_0xcdc8('0x7'));var sox=require(_0xcdc8('0x8'));var csv=require(_0xcdc8('0x9'));var ejs=require(_0xcdc8('0xa'));var fs=require('fs');var _=require(_0xcdc8('0xb'));var squel=require(_0xcdc8('0xc'));var crypto=require('crypto');var jsforce=require(_0xcdc8('0xd'));var deskjs=require(_0xcdc8('0xe'));var toCsv=require(_0xcdc8('0x9'));var querystring=require(_0xcdc8('0xf'));var Papa=require(_0xcdc8('0x10'));var Redis=require(_0xcdc8('0x11'));var authService=require(_0xcdc8('0x12'));var qs=require(_0xcdc8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcdc8('0x14'))('api');var utils=require(_0xcdc8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xcdc8('0x16'));var db=require(_0xcdc8('0x17'))['db'];function respondWithStatusCode(_0x543f92,_0x15dd00){_0x15dd00=_0x15dd00||0xcc;return function(_0x112d4a){if(_0x112d4a){return _0x543f92[_0xcdc8('0x18')](_0x15dd00);}return _0x543f92['status'](_0x15dd00)['end']();};}function respondWithResult(_0xc255f9,_0x59d858){_0x59d858=_0x59d858||0xc8;return function(_0x4dbb01){if(_0x4dbb01){return _0xc255f9[_0xcdc8('0x19')](_0x59d858)[_0xcdc8('0x1a')](_0x4dbb01);}};}function respondWithFilteredResult(_0x5f2d75,_0x40d30f){return function(_0x40cb15){if(_0x40cb15){var _0x1c30aa=_0x40cb15[_0xcdc8('0x1b')],_0x13440e=_0x40d30f[_0xcdc8('0x1c')],_0x326fa5=_0x40d30f[_0xcdc8('0x1c')]+_0x40d30f[_0xcdc8('0x1d')],_0x6de46d;if(_0x326fa5>=_0x1c30aa){_0x326fa5=_0x1c30aa;_0x6de46d=0xc8;}else{_0x6de46d=0xce;}_0x5f2d75['status'](_0x6de46d);return _0x5f2d75[_0xcdc8('0x1e')](_0xcdc8('0x1f'),_0x13440e+'-'+_0x326fa5+'/'+_0x1c30aa)[_0xcdc8('0x1a')](_0x40cb15);}return null;};}function patchUpdates(_0x1c657f){return function(_0x4244f1){try{jsonpatch[_0xcdc8('0x20')](_0x4244f1,_0x1c657f,!![]);}catch(_0x29b2b8){return BPromise[_0xcdc8('0x21')](_0x29b2b8);}return _0x4244f1[_0xcdc8('0x22')]();};}function saveUpdates(_0x27b203,_0x25f133){return function(_0x47003f){if(_0x47003f){return _0x47003f[_0xcdc8('0x23')](_0x27b203)['then'](function(_0x25441c){return _0x25441c;});}return null;};}function removeEntity(_0x416bf0,_0x5af47b){return function(_0x1974bd){if(_0x1974bd){return _0x1974bd[_0xcdc8('0x24')]()[_0xcdc8('0x25')](function(){_0x416bf0['status'](0xcc)[_0xcdc8('0x26')]();});}};}function handleEntityNotFound(_0x36f016,_0x5b5c48){return function(_0x5f250f){if(!_0x5f250f){_0x36f016['sendStatus'](0x194);}return _0x5f250f;};}function handleError(_0x53f3cc,_0xf0c67b){_0xf0c67b=_0xf0c67b||0x1f4;return function(_0x3587d7){logger[_0xcdc8('0x27')](_0x3587d7['stack']);if(_0x3587d7[_0xcdc8('0x28')]){delete _0x3587d7[_0xcdc8('0x28')];}_0x53f3cc[_0xcdc8('0x19')](_0xf0c67b)[_0xcdc8('0x29')](_0x3587d7);};}exports[_0xcdc8('0x2a')]=function(_0x38892e,_0x34fdc2){var _0x559ef0={},_0x5ab325={},_0x250bc5={'count':0x0,'rows':[]};var _0x227631=_['map'](db[_0xcdc8('0x2b')][_0xcdc8('0x2c')],function(_0x5c2926){return{'name':_0x5c2926[_0xcdc8('0x2d')],'type':_0x5c2926[_0xcdc8('0x2e')]['key']};});_0x5ab325[_0xcdc8('0x2f')]=_[_0xcdc8('0x30')](_0x227631,_0xcdc8('0x28'));_0x5ab325[_0xcdc8('0x31')]=_['keys'](_0x38892e[_0xcdc8('0x31')]);_0x5ab325[_0xcdc8('0x32')]=_[_0xcdc8('0x33')](_0x5ab325[_0xcdc8('0x2f')],_0x5ab325[_0xcdc8('0x31')]);_0x559ef0[_0xcdc8('0x34')]=_[_0xcdc8('0x33')](_0x5ab325['model'],qs['fields'](_0x38892e[_0xcdc8('0x31')][_0xcdc8('0x35')]));_0x559ef0['attributes']=_0x559ef0[_0xcdc8('0x34')]['length']?_0x559ef0[_0xcdc8('0x34')]:_0x5ab325[_0xcdc8('0x2f')];if(!_0x38892e[_0xcdc8('0x31')][_0xcdc8('0x36')](_0xcdc8('0x37'))){_0x559ef0[_0xcdc8('0x1d')]=qs[_0xcdc8('0x1d')](_0x38892e[_0xcdc8('0x31')][_0xcdc8('0x1d')]);_0x559ef0[_0xcdc8('0x1c')]=qs[_0xcdc8('0x1c')](_0x38892e[_0xcdc8('0x31')][_0xcdc8('0x1c')]);}_0x559ef0[_0xcdc8('0x38')]=qs[_0xcdc8('0x39')](_0x38892e['query'][_0xcdc8('0x39')]);_0x559ef0['where']=qs[_0xcdc8('0x32')](_[_0xcdc8('0x3a')](_0x38892e[_0xcdc8('0x31')],_0x5ab325[_0xcdc8('0x32')]),_0x227631);if(_0x38892e[_0xcdc8('0x31')][_0xcdc8('0x3b')]){_0x559ef0[_0xcdc8('0x3c')]=_[_0xcdc8('0x3d')](_0x559ef0['where'],{'$or':_[_0xcdc8('0x30')](_0x227631,function(_0x2f1af6){if(_0x2f1af6[_0xcdc8('0x2e')]!==_0xcdc8('0x3e')){var _0x5bf6cf={};_0x5bf6cf[_0x2f1af6[_0xcdc8('0x28')]]={'$like':'%'+_0x38892e[_0xcdc8('0x31')]['filter']+'%'};return _0x5bf6cf;}})});}_0x559ef0=_[_0xcdc8('0x3d')]({},_0x559ef0,_0x38892e[_0xcdc8('0x3f')]);var _0x4f4400={'where':_0x559ef0['where']};return db['WhatsappQueueReport']['count'](_0x4f4400)['then'](function(_0x308831){_0x250bc5[_0xcdc8('0x1b')]=_0x308831;if(_0x38892e[_0xcdc8('0x31')][_0xcdc8('0x40')]){_0x559ef0[_0xcdc8('0x41')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xcdc8('0x42')](_0x559ef0);})['then'](function(_0x298ce0){_0x250bc5[_0xcdc8('0x43')]=_0x298ce0;return _0x250bc5;})[_0xcdc8('0x25')](respondWithFilteredResult(_0x34fdc2,_0x559ef0))[_0xcdc8('0x44')](handleError(_0x34fdc2,null));};exports['show']=function(_0x1a9ae0,_0x3d155c){var _0x1e0b42={'raw':!![],'where':{'id':_0x1a9ae0[_0xcdc8('0x45')]['id']}},_0x2590c1={};_0x2590c1[_0xcdc8('0x2f')]=_[_0xcdc8('0x46')](db[_0xcdc8('0x2b')][_0xcdc8('0x2c')]);_0x2590c1[_0xcdc8('0x31')]=_[_0xcdc8('0x46')](_0x1a9ae0[_0xcdc8('0x31')]);_0x2590c1[_0xcdc8('0x32')]=_[_0xcdc8('0x33')](_0x2590c1[_0xcdc8('0x2f')],_0x2590c1[_0xcdc8('0x31')]);_0x1e0b42[_0xcdc8('0x34')]=_[_0xcdc8('0x33')](_0x2590c1['model'],qs[_0xcdc8('0x35')](_0x1a9ae0['query'][_0xcdc8('0x35')]));_0x1e0b42['attributes']=_0x1e0b42[_0xcdc8('0x34')][_0xcdc8('0x47')]?_0x1e0b42[_0xcdc8('0x34')]:_0x2590c1['model'];if(_0x1a9ae0[_0xcdc8('0x31')][_0xcdc8('0x40')]){_0x1e0b42[_0xcdc8('0x41')]=[{'all':!![]}];}_0x1e0b42=_[_0xcdc8('0x3d')]({},_0x1e0b42,_0x1a9ae0[_0xcdc8('0x3f')]);return db[_0xcdc8('0x2b')][_0xcdc8('0x48')](_0x1e0b42)[_0xcdc8('0x25')](handleEntityNotFound(_0x3d155c,null))[_0xcdc8('0x25')](respondWithResult(_0x3d155c,null))[_0xcdc8('0x44')](handleError(_0x3d155c,null));};exports[_0xcdc8('0x49')]=function(_0x408757,_0x5b9971){return db['WhatsappQueueReport'][_0xcdc8('0x49')](_0x408757[_0xcdc8('0x4a')],{})[_0xcdc8('0x25')](respondWithResult(_0x5b9971,0xc9))[_0xcdc8('0x44')](handleError(_0x5b9971,null));};exports[_0xcdc8('0x23')]=function(_0x66ef56,_0x48e8f8){if(_0x66ef56[_0xcdc8('0x4a')]['id']){delete _0x66ef56['body']['id'];}return db[_0xcdc8('0x2b')][_0xcdc8('0x48')]({'where':{'id':_0x66ef56[_0xcdc8('0x45')]['id']}})['then'](handleEntityNotFound(_0x48e8f8,null))[_0xcdc8('0x25')](saveUpdates(_0x66ef56['body'],null))[_0xcdc8('0x25')](respondWithResult(_0x48e8f8,null))[_0xcdc8('0x44')](handleError(_0x48e8f8,null));};exports[_0xcdc8('0x24')]=function(_0x5bff72,_0x5246f1){return db['WhatsappQueueReport'][_0xcdc8('0x48')]({'where':{'id':_0x5bff72[_0xcdc8('0x45')]['id']}})[_0xcdc8('0x25')](handleEntityNotFound(_0x5246f1,null))[_0xcdc8('0x25')](removeEntity(_0x5246f1,null))[_0xcdc8('0x44')](handleError(_0x5246f1,null));};exports[_0xcdc8('0x4b')]=function(_0x32a9fd,_0x54d52b){return db['WhatsappQueueReport'][_0xcdc8('0x4b')]()[_0xcdc8('0x25')](respondWithResult(_0x54d52b,null))['catch'](handleError(_0x54d52b,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index ed3799c..955f7fc 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 _0x0498=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util'];(function(_0x1c5245,_0x1265e0){var _0x557d40=function(_0x57381f){while(--_0x57381f){_0x1c5245['push'](_0x1c5245['shift']());}};_0x557d40(++_0x1265e0);}(_0x0498,0x1a2));var _0x8049=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x0498[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x8049('0x0'));var util=require(_0x8049('0x1'));var logger=require(_0x8049('0x2'))(_0x8049('0x3'));var moment=require(_0x8049('0x4'));var BPromise=require('bluebird');var rp=require(_0x8049('0x5'));var fs=require('fs');var path=require(_0x8049('0x6'));var rimraf=require(_0x8049('0x7'));var config=require(_0x8049('0x8'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x450340,_0x4b9c17){return _0x450340['define'](_0x8049('0x9'),attributes,{'tableName':_0x8049('0xa'),'paranoid':![],'indexes':[{'name':_0x8049('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x202c=['define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','moment','bluebird','request-promise','../../config/environment','./whatsappQueueReport.attributes','exports'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0x202c,0x124));var _0xc202=function(_0x1dae83,_0x789485){_0x1dae83=_0x1dae83-0x0;var _0x53ab1c=_0x202c[_0x1dae83];return _0x53ab1c;};'use strict';var _=require(_0xc202('0x0'));var util=require(_0xc202('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc202('0x2'));var BPromise=require(_0xc202('0x3'));var rp=require(_0xc202('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc202('0x5'));var attributes=require(_0xc202('0x6'));module[_0xc202('0x7')]=function(_0x34320b,_0x2860d6){return _0x34320b[_0xc202('0x8')](_0xc202('0x9'),attributes,{'tableName':_0xc202('0xa'),'paranoid':![],'indexes':[{'name':_0xc202('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 08a6f58..34f757a 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 _0x3990=['attributes','then','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','message','WhatsappQueueReport,\x20%s,\x20%s','info','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','where'];(function(_0x3f47d3,_0x5b4a64){var _0x2f64cc=function(_0x4f0883){while(--_0x4f0883){_0x3f47d3['push'](_0x3f47d3['shift']());}};_0x2f64cc(++_0x5b4a64);}(_0x3990,0xdb));var _0x0399=function(_0x4ec527,_0x4cc420){_0x4ec527=_0x4ec527-0x0;var _0x38101a=_0x3990[_0x4ec527];return _0x38101a;};'use strict';var _=require(_0x0399('0x0'));var util=require(_0x0399('0x1'));var moment=require('moment');var BPromise=require(_0x0399('0x2'));var rs=require(_0x0399('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0399('0x4'))['db'];var utils=require(_0x0399('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0399('0x6'));var jayson=require(_0x0399('0x7'));var client=jayson[_0x0399('0x8')][_0x0399('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49f6cc,_0x294988,_0x14758d){return new BPromise(function(_0x131ff,_0x404f7e){return client[_0x0399('0xa')](_0x49f6cc,_0x14758d)['then'](function(_0x4189ad){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x294988,_0x0399('0xb'));logger[_0x0399('0xc')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x294988,_0x0399('0xb'),JSON[_0x0399('0xd')](_0x4189ad));if(_0x4189ad[_0x0399('0xe')]){if(_0x4189ad['error'][_0x0399('0xf')]===0x1f4){logger[_0x0399('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x294988,_0x4189ad[_0x0399('0xe')][_0x0399('0x10')]);return _0x404f7e(_0x4189ad[_0x0399('0xe')][_0x0399('0x10')]);}logger['error'](_0x0399('0x11'),_0x294988,_0x4189ad[_0x0399('0xe')]['message']);return _0x131ff(_0x4189ad[_0x0399('0xe')][_0x0399('0x10')]);}else{logger[_0x0399('0x12')](_0x0399('0x11'),_0x294988,_0x0399('0xb'));_0x131ff(_0x4189ad['result'][_0x0399('0x10')]);}})[_0x0399('0x13')](function(_0x47c320){logger[_0x0399('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x294988,_0x47c320);_0x404f7e(_0x47c320);});});}exports[_0x0399('0x14')]=function(_0x371e38){var _0x3cbf98=this;return new Promise(function(_0x22c90a,_0x11fe5c){return db[_0x0399('0x15')][_0x0399('0x16')](_0x371e38[_0x0399('0x17')],{'raw':_0x371e38[_0x0399('0x18')]?_0x371e38['options'][_0x0399('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xa0f6df){logger[_0x0399('0x12')](_0x0399('0x14'),_0x371e38);logger[_0x0399('0xc')](_0x0399('0x14'),_0x371e38,JSON[_0x0399('0xd')](_0xa0f6df));_0x22c90a(_0xa0f6df);})[_0x0399('0x13')](function(_0x1fe496){logger[_0x0399('0xe')]('CreateWhatsappQueueReport',_0x1fe496[_0x0399('0x10')],_0x371e38);_0x11fe5c(_0x3cbf98['error'](0x1f4,_0x1fe496[_0x0399('0x10')]));});});};exports[_0x0399('0x1a')]=function(_0xd750b3){var _0x38c885=this;return new Promise(function(_0x4a99b4,_0x1adb55){return db[_0x0399('0x15')][_0x0399('0x1b')](_0xd750b3['body'],{'raw':_0xd750b3[_0x0399('0x18')]?_0xd750b3['options'][_0x0399('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd750b3[_0x0399('0x18')]?_0xd750b3[_0x0399('0x18')][_0x0399('0x1c')]||null:null,'attributes':_0xd750b3[_0x0399('0x18')]?_0xd750b3[_0x0399('0x18')][_0x0399('0x1d')]||null:null,'limit':_0xd750b3[_0x0399('0x18')]?_0xd750b3[_0x0399('0x18')]['limit']||null:null})[_0x0399('0x1e')](function(_0x455095){logger['info'](_0x0399('0x1a'),_0xd750b3);logger[_0x0399('0xc')](_0x0399('0x1a'),_0xd750b3,JSON[_0x0399('0xd')](_0x455095));_0x4a99b4(_0x455095);})['catch'](function(_0x2664a8){logger['error']('UpdateWhatsappQueueReport',_0x2664a8[_0x0399('0x10')],_0xd750b3);_0x1adb55(_0x38c885['error'](0x1f4,_0x2664a8[_0x0399('0x10')]));});});}; \ No newline at end of file +var _0xbbe2=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','info','debug','UpdateWhatsappQueueReport','update','body','raw','where','attributes','limit','lodash','util','bluebird','randomstring'];(function(_0x5a3f27,_0x34323d){var _0x553bec=function(_0x3c6522){while(--_0x3c6522){_0x5a3f27['push'](_0x5a3f27['shift']());}};_0x553bec(++_0x34323d);}(_0xbbe2,0x140));var _0x2bbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbe2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2bbe('0x0'));var util=require(_0x2bbe('0x1'));var moment=require('moment');var BPromise=require(_0x2bbe('0x2'));var rs=require(_0x2bbe('0x3'));var fs=require('fs');var Redis=require(_0x2bbe('0x4'));var db=require(_0x2bbe('0x5'))['db'];var utils=require(_0x2bbe('0x6'));var logger=require(_0x2bbe('0x7'))(_0x2bbe('0x8'));var config=require(_0x2bbe('0x9'));var jayson=require(_0x2bbe('0xa'));var client=jayson[_0x2bbe('0xb')][_0x2bbe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53f121,_0x41680b,_0x15ca23){return new BPromise(function(_0x359979,_0x56ad99){return client[_0x2bbe('0xd')](_0x53f121,_0x15ca23)[_0x2bbe('0xe')](function(_0x320320){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x41680b,_0x2bbe('0xf'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x41680b,_0x2bbe('0xf'),JSON[_0x2bbe('0x10')](_0x320320));if(_0x320320[_0x2bbe('0x11')]){if(_0x320320['error'][_0x2bbe('0x12')]===0x1f4){logger['error'](_0x2bbe('0x13'),_0x41680b,_0x320320[_0x2bbe('0x11')][_0x2bbe('0x14')]);return _0x56ad99(_0x320320['error'][_0x2bbe('0x14')]);}logger['error'](_0x2bbe('0x13'),_0x41680b,_0x320320[_0x2bbe('0x11')][_0x2bbe('0x14')]);return _0x359979(_0x320320[_0x2bbe('0x11')][_0x2bbe('0x14')]);}else{logger['info'](_0x2bbe('0x13'),_0x41680b,_0x2bbe('0xf'));_0x359979(_0x320320[_0x2bbe('0x15')][_0x2bbe('0x14')]);}})[_0x2bbe('0x16')](function(_0x4ad72c){logger[_0x2bbe('0x11')](_0x2bbe('0x13'),_0x41680b,_0x4ad72c);_0x56ad99(_0x4ad72c);});});}exports[_0x2bbe('0x17')]=function(_0x306910){var _0x542bc0=this;return new Promise(function(_0x136943,_0x3c9426){return db[_0x2bbe('0x18')][_0x2bbe('0x19')](_0x306910['body'],{'raw':_0x306910['options']?_0x306910[_0x2bbe('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x2bbe('0xe')](function(_0x57612d){logger[_0x2bbe('0x1b')](_0x2bbe('0x17'),_0x306910);logger[_0x2bbe('0x1c')](_0x2bbe('0x17'),_0x306910,JSON[_0x2bbe('0x10')](_0x57612d));_0x136943(_0x57612d);})['catch'](function(_0x120a6e){logger[_0x2bbe('0x11')](_0x2bbe('0x17'),_0x120a6e[_0x2bbe('0x14')],_0x306910);_0x3c9426(_0x542bc0[_0x2bbe('0x11')](0x1f4,_0x120a6e[_0x2bbe('0x14')]));});});};exports[_0x2bbe('0x1d')]=function(_0xa12879){var _0x39a8e2=this;return new Promise(function(_0x260bbf,_0x252543){return db['WhatsappQueueReport'][_0x2bbe('0x1e')](_0xa12879[_0x2bbe('0x1f')],{'raw':_0xa12879[_0x2bbe('0x1a')]?_0xa12879[_0x2bbe('0x1a')][_0x2bbe('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa12879[_0x2bbe('0x1a')]?_0xa12879[_0x2bbe('0x1a')][_0x2bbe('0x21')]||null:null,'attributes':_0xa12879[_0x2bbe('0x1a')]?_0xa12879['options'][_0x2bbe('0x22')]||null:null,'limit':_0xa12879[_0x2bbe('0x1a')]?_0xa12879[_0x2bbe('0x1a')][_0x2bbe('0x23')]||null:null})[_0x2bbe('0xe')](function(_0x1b7ba0){logger[_0x2bbe('0x1b')](_0x2bbe('0x1d'),_0xa12879);logger[_0x2bbe('0x1c')](_0x2bbe('0x1d'),_0xa12879,JSON['stringify'](_0x1b7ba0));_0x260bbf(_0x1b7ba0);})[_0x2bbe('0x16')](function(_0x3de955){logger[_0x2bbe('0x11')](_0x2bbe('0x1d'),_0x3de955['message'],_0xa12879);_0x252543(_0x39a8e2['error'](0x1f4,_0x3de955[_0x2bbe('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 8cb9fc4..3b070fa 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 _0x4e93=['../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','index','/describe','isAuthenticated','describe','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service'];(function(_0x437b02,_0x34b630){var _0xf8c681=function(_0x28f83e){while(--_0x28f83e){_0x437b02['push'](_0x437b02['shift']());}};_0xf8c681(++_0x34b630);}(_0x4e93,0x171));var _0x34e9=function(_0x4343f1,_0x325dce){_0x4343f1=_0x4343f1-0x0;var _0x5d84a0=_0x4e93[_0x4343f1];return _0x5d84a0;};'use strict';var multer=require(_0x34e9('0x0'));var util=require(_0x34e9('0x1'));var path=require(_0x34e9('0x2'));var timeout=require('connect-timeout');var express=require(_0x34e9('0x3'));var router=express['Router']();var auth=require(_0x34e9('0x4'));var interaction=require(_0x34e9('0x5'));var config=require(_0x34e9('0x6'));var controller=require(_0x34e9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x34e9('0x8')]);router['get'](_0x34e9('0x9'),auth[_0x34e9('0xa')](),controller[_0x34e9('0xb')]);router[_0x34e9('0xc')](_0x34e9('0xd'),auth[_0x34e9('0xa')](),controller[_0x34e9('0xe')]);router[_0x34e9('0xf')]('/',auth[_0x34e9('0xa')](),controller[_0x34e9('0x10')]);router[_0x34e9('0x11')](_0x34e9('0xd'),auth['isAuthenticated'](),controller[_0x34e9('0x12')]);router[_0x34e9('0x13')](_0x34e9('0xd'),auth['isAuthenticated'](),controller[_0x34e9('0x14')]);module[_0x34e9('0x15')]=router; \ No newline at end of file +var _0x25de=['multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x25de,0xc6));var _0xe25d=function(_0x33c1b1,_0x2355fb){_0x33c1b1=_0x33c1b1-0x0;var _0x2c2037=_0x25de[_0x33c1b1];return _0x2c2037;};'use strict';var multer=require(_0xe25d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe25d('0x1'));var express=require(_0xe25d('0x2'));var router=express[_0xe25d('0x3')]();var auth=require(_0xe25d('0x4'));var interaction=require(_0xe25d('0x5'));var config=require(_0xe25d('0x6'));var controller=require(_0xe25d('0x7'));router[_0xe25d('0x8')]('/',auth[_0xe25d('0x9')](),controller[_0xe25d('0xa')]);router[_0xe25d('0x8')](_0xe25d('0xb'),auth[_0xe25d('0x9')](),controller[_0xe25d('0xc')]);router[_0xe25d('0x8')](_0xe25d('0xd'),auth[_0xe25d('0x9')](),controller[_0xe25d('0xe')]);router[_0xe25d('0xf')]('/',auth['isAuthenticated'](),controller[_0xe25d('0x10')]);router[_0xe25d('0x11')]('/:id',auth[_0xe25d('0x9')](),controller[_0xe25d('0x12')]);router[_0xe25d('0x13')](_0xe25d('0xd'),auth[_0xe25d('0x9')](),controller[_0xe25d('0x14')]);module[_0xe25d('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 890054b..86ac6c2 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 _0xb10b=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xb10b,0x12a));var _0xbb10=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0xb10b[_0x5c5c52];return _0x4229ff;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbb10('0x2')](_0xbb10('0x3'),'agent',_0xbb10('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xbb10('0x5')]}}; \ No newline at end of file +var _0xb10b=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xb10b,0x12a));var _0xbb10=function(_0x3fa479,_0x222259){_0x3fa479=_0x3fa479-0x0;var _0x23feb5=_0xb10b[_0x3fa479];return _0x23feb5;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbb10('0x2')](_0xbb10('0x3'),'agent',_0xbb10('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xbb10('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index b73fd2f..f6a41c1 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 _0xd985=['json','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','fieldName','type','model','keys','filters','query','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status'];(function(_0x368bba,_0x1f625b){var _0x409f8f=function(_0x463373){while(--_0x463373){_0x368bba['push'](_0x368bba['shift']());}};_0x409f8f(++_0x1f625b);}(_0xd985,0x1a7));var _0x5d98=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0xd985[_0xc55d64];return _0x4194f6;};'use strict';var pdf=require(_0x5d98('0x0'));var emlformat=require(_0x5d98('0x1'));var rimraf=require(_0x5d98('0x2'));var zipdir=require(_0x5d98('0x3'));var jsonpatch=require(_0x5d98('0x4'));var rp=require(_0x5d98('0x5'));var moment=require(_0x5d98('0x6'));var BPromise=require(_0x5d98('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5d98('0x8'));var sox=require(_0x5d98('0x9'));var csv=require(_0x5d98('0xa'));var ejs=require(_0x5d98('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5d98('0xc'));var crypto=require('crypto');var jsforce=require(_0x5d98('0xd'));var deskjs=require(_0x5d98('0xe'));var toCsv=require(_0x5d98('0xa'));var querystring=require(_0x5d98('0xf'));var Papa=require(_0x5d98('0x10'));var Redis=require('ioredis');var authService=require(_0x5d98('0x11'));var qs=require(_0x5d98('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5d98('0x13'));var logger=require(_0x5d98('0x14'))(_0x5d98('0x15'));var utils=require('../../config/utils');var config=require(_0x5d98('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5d98('0x17'))['db'];function respondWithStatusCode(_0x297cc5,_0x5dd989){_0x5dd989=_0x5dd989||0xcc;return function(_0x1f54d8){if(_0x1f54d8){return _0x297cc5[_0x5d98('0x18')](_0x5dd989);}return _0x297cc5['status'](_0x5dd989)[_0x5d98('0x19')]();};}function respondWithResult(_0x28ff40,_0x48f104){_0x48f104=_0x48f104||0xc8;return function(_0x59a8df){if(_0x59a8df){return _0x28ff40[_0x5d98('0x1a')](_0x48f104)[_0x5d98('0x1b')](_0x59a8df);}};}function respondWithFilteredResult(_0x28a1a,_0x3a64c1){return function(_0xdda418){if(_0xdda418){var _0x546cf7=_0xdda418[_0x5d98('0x1c')],_0x4242f6=_0x3a64c1[_0x5d98('0x1d')],_0x4deaac=_0x3a64c1['offset']+_0x3a64c1['limit'],_0x2bda0b;if(_0x4deaac>=_0x546cf7){_0x4deaac=_0x546cf7;_0x2bda0b=0xc8;}else{_0x2bda0b=0xce;}_0x28a1a[_0x5d98('0x1a')](_0x2bda0b);return _0x28a1a[_0x5d98('0x1e')]('Content-Range',_0x4242f6+'-'+_0x4deaac+'/'+_0x546cf7)[_0x5d98('0x1b')](_0xdda418);}return null;};}function patchUpdates(_0x19bb34){return function(_0x4092b4){try{jsonpatch[_0x5d98('0x1f')](_0x4092b4,_0x19bb34,!![]);}catch(_0xca6204){return BPromise[_0x5d98('0x20')](_0xca6204);}return _0x4092b4[_0x5d98('0x21')]();};}function saveUpdates(_0x5e8132,_0x39185e){return function(_0x240d85){if(_0x240d85){return _0x240d85[_0x5d98('0x22')](_0x5e8132)[_0x5d98('0x23')](function(_0x195ab5){return _0x195ab5;});}return null;};}function removeEntity(_0x1dd7f7,_0x6bb575){return function(_0x37c500){if(_0x37c500){return _0x37c500[_0x5d98('0x24')]()[_0x5d98('0x23')](function(){_0x1dd7f7[_0x5d98('0x1a')](0xcc)[_0x5d98('0x19')]();});}};}function handleEntityNotFound(_0x4ca566,_0xfe9f64){return function(_0x3af6e1){if(!_0x3af6e1){_0x4ca566[_0x5d98('0x18')](0x194);}return _0x3af6e1;};}function handleError(_0x7122a7,_0x417b5c){_0x417b5c=_0x417b5c||0x1f4;return function(_0x302d1b){logger[_0x5d98('0x25')](_0x302d1b[_0x5d98('0x26')]);if(_0x302d1b[_0x5d98('0x27')]){delete _0x302d1b['name'];}_0x7122a7[_0x5d98('0x1a')](_0x417b5c)[_0x5d98('0x28')](_0x302d1b);};}exports[_0x5d98('0x29')]=function(_0x30391b,_0x4a69bd){var _0x4fb129={},_0x530eb0={},_0x203c2c={'count':0x0,'rows':[]};var _0x662ec0=_[_0x5d98('0x2a')](db[_0x5d98('0x2b')]['rawAttributes'],function(_0x5aa950){return{'name':_0x5aa950[_0x5d98('0x2c')],'type':_0x5aa950[_0x5d98('0x2d')]['key']};});_0x530eb0[_0x5d98('0x2e')]=_[_0x5d98('0x2a')](_0x662ec0,'name');_0x530eb0['query']=_[_0x5d98('0x2f')](_0x30391b['query']);_0x530eb0[_0x5d98('0x30')]=_['intersection'](_0x530eb0[_0x5d98('0x2e')],_0x530eb0[_0x5d98('0x31')]);_0x4fb129[_0x5d98('0x32')]=_[_0x5d98('0x33')](_0x530eb0[_0x5d98('0x2e')],qs[_0x5d98('0x34')](_0x30391b[_0x5d98('0x31')][_0x5d98('0x34')]));_0x4fb129[_0x5d98('0x32')]=_0x4fb129['attributes'][_0x5d98('0x35')]?_0x4fb129['attributes']:_0x530eb0[_0x5d98('0x2e')];if(!_0x30391b[_0x5d98('0x31')]['hasOwnProperty'](_0x5d98('0x36'))){_0x4fb129[_0x5d98('0x37')]=qs[_0x5d98('0x37')](_0x30391b[_0x5d98('0x31')][_0x5d98('0x37')]);_0x4fb129['offset']=qs[_0x5d98('0x1d')](_0x30391b[_0x5d98('0x31')][_0x5d98('0x1d')]);}_0x4fb129[_0x5d98('0x38')]=qs[_0x5d98('0x39')](_0x30391b[_0x5d98('0x31')][_0x5d98('0x39')]);_0x4fb129[_0x5d98('0x3a')]=qs[_0x5d98('0x30')](_[_0x5d98('0x3b')](_0x30391b['query'],_0x530eb0['filters']),_0x662ec0);if(_0x30391b[_0x5d98('0x31')][_0x5d98('0x3c')]){_0x4fb129[_0x5d98('0x3a')]=_[_0x5d98('0x3d')](_0x4fb129[_0x5d98('0x3a')],{'$or':_['map'](_0x662ec0,function(_0xe6b437){if(_0xe6b437[_0x5d98('0x2d')]!=='VIRTUAL'){var _0x2d5e78={};_0x2d5e78[_0xe6b437[_0x5d98('0x27')]]={'$like':'%'+_0x30391b[_0x5d98('0x31')][_0x5d98('0x3c')]+'%'};return _0x2d5e78;}})});}_0x4fb129=_[_0x5d98('0x3d')]({},_0x4fb129,_0x30391b[_0x5d98('0x3e')]);var _0x89e53b={'where':_0x4fb129[_0x5d98('0x3a')]};return db[_0x5d98('0x2b')][_0x5d98('0x1c')](_0x89e53b)[_0x5d98('0x23')](function(_0x3046af){_0x203c2c[_0x5d98('0x1c')]=_0x3046af;if(_0x30391b[_0x5d98('0x31')]['includeAll']){_0x4fb129[_0x5d98('0x3f')]=[{'all':!![]}];}return db[_0x5d98('0x2b')][_0x5d98('0x40')](_0x4fb129);})['then'](function(_0x11de35){_0x203c2c[_0x5d98('0x41')]=_0x11de35;return _0x203c2c;})[_0x5d98('0x23')](respondWithFilteredResult(_0x4a69bd,_0x4fb129))[_0x5d98('0x42')](handleError(_0x4a69bd,null));};exports[_0x5d98('0x43')]=function(_0x2711f5,_0xf33198){var _0x11de54={'raw':!![],'where':{'id':_0x2711f5[_0x5d98('0x44')]['id']}},_0x322341={};_0x322341[_0x5d98('0x2e')]=_[_0x5d98('0x2f')](db[_0x5d98('0x2b')][_0x5d98('0x45')]);_0x322341[_0x5d98('0x31')]=_[_0x5d98('0x2f')](_0x2711f5[_0x5d98('0x31')]);_0x322341[_0x5d98('0x30')]=_[_0x5d98('0x33')](_0x322341[_0x5d98('0x2e')],_0x322341['query']);_0x11de54[_0x5d98('0x32')]=_[_0x5d98('0x33')](_0x322341[_0x5d98('0x2e')],qs[_0x5d98('0x34')](_0x2711f5['query'][_0x5d98('0x34')]));_0x11de54[_0x5d98('0x32')]=_0x11de54[_0x5d98('0x32')][_0x5d98('0x35')]?_0x11de54['attributes']:_0x322341[_0x5d98('0x2e')];if(_0x2711f5[_0x5d98('0x31')][_0x5d98('0x46')]){_0x11de54[_0x5d98('0x3f')]=[{'all':!![]}];}_0x11de54=_[_0x5d98('0x3d')]({},_0x11de54,_0x2711f5[_0x5d98('0x3e')]);return db[_0x5d98('0x2b')][_0x5d98('0x47')](_0x11de54)[_0x5d98('0x23')](handleEntityNotFound(_0xf33198,null))[_0x5d98('0x23')](respondWithResult(_0xf33198,null))[_0x5d98('0x42')](handleError(_0xf33198,null));};exports[_0x5d98('0x48')]=function(_0x4a5a13,_0x2b0bfd){return db[_0x5d98('0x2b')]['create'](_0x4a5a13[_0x5d98('0x49')],{})['then'](respondWithResult(_0x2b0bfd,0xc9))[_0x5d98('0x42')](handleError(_0x2b0bfd,null));};exports[_0x5d98('0x22')]=function(_0x59d330,_0x40b449){if(_0x59d330[_0x5d98('0x49')]['id']){delete _0x59d330[_0x5d98('0x49')]['id'];}return db[_0x5d98('0x2b')][_0x5d98('0x47')]({'where':{'id':_0x59d330[_0x5d98('0x44')]['id']}})[_0x5d98('0x23')](handleEntityNotFound(_0x40b449,null))[_0x5d98('0x23')](saveUpdates(_0x59d330[_0x5d98('0x49')],null))[_0x5d98('0x23')](respondWithResult(_0x40b449,null))['catch'](handleError(_0x40b449,null));};exports[_0x5d98('0x24')]=function(_0xabd267,_0x282a57){return db[_0x5d98('0x2b')]['find']({'where':{'id':_0xabd267[_0x5d98('0x44')]['id']}})[_0x5d98('0x23')](handleEntityNotFound(_0x282a57,null))[_0x5d98('0x23')](removeEntity(_0x282a57,null))['catch'](handleError(_0x282a57,null));};exports['describe']=function(_0xe9bb39,_0x2e9a05){return db[_0x5d98('0x2b')][_0x5d98('0x4a')]()['then'](respondWithResult(_0x2e9a05,null))[_0x5d98('0x42')](handleError(_0x2e9a05,null));}; \ No newline at end of file +var _0x0f0e=['sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','keys','options','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','crypto','jsforce','desk.js','querystring','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','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','order'];(function(_0x4cec1e,_0x4b9d3f){var _0x45bd5f=function(_0x2e02a0){while(--_0x2e02a0){_0x4cec1e['push'](_0x4cec1e['shift']());}};_0x45bd5f(++_0x4b9d3f);}(_0x0f0e,0x17e));var _0xe0f0=function(_0x142054,_0x381a29){_0x142054=_0x142054-0x0;var _0xf28377=_0x0f0e[_0x142054];return _0xf28377;};'use strict';var pdf=require(_0xe0f0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe0f0('0x1'));var zipdir=require(_0xe0f0('0x2'));var jsonpatch=require(_0xe0f0('0x3'));var rp=require(_0xe0f0('0x4'));var moment=require(_0xe0f0('0x5'));var BPromise=require(_0xe0f0('0x6'));var Mustache=require(_0xe0f0('0x7'));var util=require(_0xe0f0('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xe0f0('0x9'));var ejs=require(_0xe0f0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe0f0('0xb'));var jsforce=require(_0xe0f0('0xc'));var deskjs=require(_0xe0f0('0xd'));var toCsv=require(_0xe0f0('0x9'));var querystring=require(_0xe0f0('0xe'));var Papa=require('papaparse');var Redis=require(_0xe0f0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe0f0('0x10'));var as=require(_0xe0f0('0x11'));var hardwareService=require(_0xe0f0('0x12'));var logger=require(_0xe0f0('0x13'))(_0xe0f0('0x14'));var utils=require(_0xe0f0('0x15'));var config=require(_0xe0f0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0f0('0x17'))['db'];function respondWithStatusCode(_0xd93c35,_0x2d6deb){_0x2d6deb=_0x2d6deb||0xcc;return function(_0x5923cb){if(_0x5923cb){return _0xd93c35[_0xe0f0('0x18')](_0x2d6deb);}return _0xd93c35[_0xe0f0('0x19')](_0x2d6deb)[_0xe0f0('0x1a')]();};}function respondWithResult(_0xbf4f8c,_0x2e75f2){_0x2e75f2=_0x2e75f2||0xc8;return function(_0x47029c){if(_0x47029c){return _0xbf4f8c[_0xe0f0('0x19')](_0x2e75f2)[_0xe0f0('0x1b')](_0x47029c);}};}function respondWithFilteredResult(_0x4a02a8,_0x1cb9df){return function(_0x32904c){if(_0x32904c){var _0x22ef4f=_0x32904c[_0xe0f0('0x1c')],_0x5660ea=_0x1cb9df['offset'],_0x5da684=_0x1cb9df[_0xe0f0('0x1d')]+_0x1cb9df[_0xe0f0('0x1e')],_0x293aa9;if(_0x5da684>=_0x22ef4f){_0x5da684=_0x22ef4f;_0x293aa9=0xc8;}else{_0x293aa9=0xce;}_0x4a02a8[_0xe0f0('0x19')](_0x293aa9);return _0x4a02a8[_0xe0f0('0x1f')](_0xe0f0('0x20'),_0x5660ea+'-'+_0x5da684+'/'+_0x22ef4f)['json'](_0x32904c);}return null;};}function patchUpdates(_0x4fb942){return function(_0x3bd80a){try{jsonpatch[_0xe0f0('0x21')](_0x3bd80a,_0x4fb942,!![]);}catch(_0x25761c){return BPromise[_0xe0f0('0x22')](_0x25761c);}return _0x3bd80a['save']();};}function saveUpdates(_0x2d76f0,_0x19c52b){return function(_0x2b35a7){if(_0x2b35a7){return _0x2b35a7[_0xe0f0('0x23')](_0x2d76f0)[_0xe0f0('0x24')](function(_0x40c623){return _0x40c623;});}return null;};}function removeEntity(_0x5304e3,_0xc04ce3){return function(_0x29d132){if(_0x29d132){return _0x29d132[_0xe0f0('0x25')]()['then'](function(){_0x5304e3[_0xe0f0('0x19')](0xcc)[_0xe0f0('0x1a')]();});}};}function handleEntityNotFound(_0x460335,_0xb33a8f){return function(_0x29d04b){if(!_0x29d04b){_0x460335[_0xe0f0('0x18')](0x194);}return _0x29d04b;};}function handleError(_0x15caff,_0x50528e){_0x50528e=_0x50528e||0x1f4;return function(_0xcade0d){logger[_0xe0f0('0x26')](_0xcade0d[_0xe0f0('0x27')]);if(_0xcade0d[_0xe0f0('0x28')]){delete _0xcade0d[_0xe0f0('0x28')];}_0x15caff[_0xe0f0('0x19')](_0x50528e)[_0xe0f0('0x29')](_0xcade0d);};}exports[_0xe0f0('0x2a')]=function(_0x493c31,_0x2d6dbf){var _0x1bb9e9={},_0x3bbbd0={},_0x530ea8={'count':0x0,'rows':[]};var _0x3b4d3a=_[_0xe0f0('0x2b')](db[_0xe0f0('0x2c')][_0xe0f0('0x2d')],function(_0x27acde){return{'name':_0x27acde['fieldName'],'type':_0x27acde[_0xe0f0('0x2e')][_0xe0f0('0x2f')]};});_0x3bbbd0[_0xe0f0('0x30')]=_[_0xe0f0('0x2b')](_0x3b4d3a,_0xe0f0('0x28'));_0x3bbbd0[_0xe0f0('0x31')]=_['keys'](_0x493c31[_0xe0f0('0x31')]);_0x3bbbd0[_0xe0f0('0x32')]=_[_0xe0f0('0x33')](_0x3bbbd0[_0xe0f0('0x30')],_0x3bbbd0['query']);_0x1bb9e9[_0xe0f0('0x34')]=_[_0xe0f0('0x33')](_0x3bbbd0[_0xe0f0('0x30')],qs[_0xe0f0('0x35')](_0x493c31['query'][_0xe0f0('0x35')]));_0x1bb9e9[_0xe0f0('0x34')]=_0x1bb9e9[_0xe0f0('0x34')][_0xe0f0('0x36')]?_0x1bb9e9[_0xe0f0('0x34')]:_0x3bbbd0[_0xe0f0('0x30')];if(!_0x493c31[_0xe0f0('0x31')]['hasOwnProperty']('nolimit')){_0x1bb9e9['limit']=qs[_0xe0f0('0x1e')](_0x493c31[_0xe0f0('0x31')][_0xe0f0('0x1e')]);_0x1bb9e9[_0xe0f0('0x1d')]=qs['offset'](_0x493c31[_0xe0f0('0x31')][_0xe0f0('0x1d')]);}_0x1bb9e9[_0xe0f0('0x37')]=qs[_0xe0f0('0x38')](_0x493c31[_0xe0f0('0x31')][_0xe0f0('0x38')]);_0x1bb9e9[_0xe0f0('0x39')]=qs[_0xe0f0('0x32')](_[_0xe0f0('0x3a')](_0x493c31['query'],_0x3bbbd0[_0xe0f0('0x32')]),_0x3b4d3a);if(_0x493c31['query'][_0xe0f0('0x3b')]){_0x1bb9e9[_0xe0f0('0x39')]=_[_0xe0f0('0x3c')](_0x1bb9e9['where'],{'$or':_['map'](_0x3b4d3a,function(_0x24bd0c){if(_0x24bd0c['type']!=='VIRTUAL'){var _0x26baf9={};_0x26baf9[_0x24bd0c['name']]={'$like':'%'+_0x493c31[_0xe0f0('0x31')][_0xe0f0('0x3b')]+'%'};return _0x26baf9;}})});}_0x1bb9e9=_['merge']({},_0x1bb9e9,_0x493c31['options']);var _0x445781={'where':_0x1bb9e9[_0xe0f0('0x39')]};return db['WhatsappTransferReport'][_0xe0f0('0x1c')](_0x445781)['then'](function(_0x1af087){_0x530ea8[_0xe0f0('0x1c')]=_0x1af087;if(_0x493c31[_0xe0f0('0x31')][_0xe0f0('0x3d')]){_0x1bb9e9[_0xe0f0('0x3e')]=[{'all':!![]}];}return db[_0xe0f0('0x2c')][_0xe0f0('0x3f')](_0x1bb9e9);})[_0xe0f0('0x24')](function(_0x38aad0){_0x530ea8[_0xe0f0('0x40')]=_0x38aad0;return _0x530ea8;})[_0xe0f0('0x24')](respondWithFilteredResult(_0x2d6dbf,_0x1bb9e9))[_0xe0f0('0x41')](handleError(_0x2d6dbf,null));};exports['show']=function(_0x22d906,_0x2c61ce){var _0x422f97={'raw':!![],'where':{'id':_0x22d906[_0xe0f0('0x42')]['id']}},_0x4e7fc2={};_0x4e7fc2[_0xe0f0('0x30')]=_[_0xe0f0('0x43')](db[_0xe0f0('0x2c')]['rawAttributes']);_0x4e7fc2[_0xe0f0('0x31')]=_['keys'](_0x22d906['query']);_0x4e7fc2[_0xe0f0('0x32')]=_[_0xe0f0('0x33')](_0x4e7fc2[_0xe0f0('0x30')],_0x4e7fc2[_0xe0f0('0x31')]);_0x422f97['attributes']=_['intersection'](_0x4e7fc2[_0xe0f0('0x30')],qs['fields'](_0x22d906[_0xe0f0('0x31')][_0xe0f0('0x35')]));_0x422f97[_0xe0f0('0x34')]=_0x422f97[_0xe0f0('0x34')]['length']?_0x422f97[_0xe0f0('0x34')]:_0x4e7fc2[_0xe0f0('0x30')];if(_0x22d906['query'][_0xe0f0('0x3d')]){_0x422f97[_0xe0f0('0x3e')]=[{'all':!![]}];}_0x422f97=_[_0xe0f0('0x3c')]({},_0x422f97,_0x22d906[_0xe0f0('0x44')]);return db['WhatsappTransferReport']['find'](_0x422f97)[_0xe0f0('0x24')](handleEntityNotFound(_0x2c61ce,null))[_0xe0f0('0x24')](respondWithResult(_0x2c61ce,null))[_0xe0f0('0x41')](handleError(_0x2c61ce,null));};exports[_0xe0f0('0x45')]=function(_0x4d8ded,_0x3b6cc7){return db['WhatsappTransferReport']['create'](_0x4d8ded['body'],{})['then'](respondWithResult(_0x3b6cc7,0xc9))['catch'](handleError(_0x3b6cc7,null));};exports[_0xe0f0('0x23')]=function(_0x47a5a6,_0x3f1123){if(_0x47a5a6[_0xe0f0('0x46')]['id']){delete _0x47a5a6[_0xe0f0('0x46')]['id'];}return db[_0xe0f0('0x2c')]['find']({'where':{'id':_0x47a5a6[_0xe0f0('0x42')]['id']}})[_0xe0f0('0x24')](handleEntityNotFound(_0x3f1123,null))[_0xe0f0('0x24')](saveUpdates(_0x47a5a6[_0xe0f0('0x46')],null))[_0xe0f0('0x24')](respondWithResult(_0x3f1123,null))['catch'](handleError(_0x3f1123,null));};exports['destroy']=function(_0x52e4ea,_0x2c161b){return db[_0xe0f0('0x2c')][_0xe0f0('0x47')]({'where':{'id':_0x52e4ea[_0xe0f0('0x42')]['id']}})[_0xe0f0('0x24')](handleEntityNotFound(_0x2c161b,null))['then'](removeEntity(_0x2c161b,null))['catch'](handleError(_0x2c161b,null));};exports[_0xe0f0('0x48')]=function(_0x29c4f8,_0x47c96a){return db['WhatsappTransferReport'][_0xe0f0('0x48')]()[_0xe0f0('0x24')](respondWithResult(_0x47c96a,null))[_0xe0f0('0x41')](handleError(_0x47c96a,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index dddf87a..73495d4 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 _0x9ae9=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x4baef0,_0x1939a4){var _0x43ca95=function(_0x458aa8){while(--_0x458aa8){_0x4baef0['push'](_0x4baef0['shift']());}};_0x43ca95(++_0x1939a4);}(_0x9ae9,0x1ca));var _0x99ae=function(_0x52f247,_0x329e5f){_0x52f247=_0x52f247-0x0;var _0x48c78d=_0x9ae9[_0x52f247];return _0x48c78d;};'use strict';var _=require(_0x99ae('0x0'));var util=require('util');var logger=require(_0x99ae('0x1'))(_0x99ae('0x2'));var moment=require(_0x99ae('0x3'));var BPromise=require(_0x99ae('0x4'));var rp=require(_0x99ae('0x5'));var fs=require('fs');var path=require(_0x99ae('0x6'));var rimraf=require(_0x99ae('0x7'));var config=require(_0x99ae('0x8'));var attributes=require(_0x99ae('0x9'));module['exports']=function(_0xe492c,_0x2a5c41){return _0xe492c[_0x99ae('0xa')](_0x99ae('0xb'),attributes,{'tableName':_0x99ae('0xc'),'paranoid':![],'indexes':[{'name':_0x99ae('0xd'),'fields':[_0x99ae('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ed8=['bluebird','request-promise','rimraf','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x3cbdab,_0x4b69af){var _0x3fd7d6=function(_0xc71fef){while(--_0xc71fef){_0x3cbdab['push'](_0x3cbdab['shift']());}};_0x3fd7d6(++_0x4b69af);}(_0x7ed8,0x7d));var _0x87ed=function(_0xb9a686,_0x16aad1){_0xb9a686=_0xb9a686-0x0;var _0x50ec2c=_0x7ed8[_0xb9a686];return _0x50ec2c;};'use strict';var _=require(_0x87ed('0x0'));var util=require(_0x87ed('0x1'));var logger=require(_0x87ed('0x2'))(_0x87ed('0x3'));var moment=require(_0x87ed('0x4'));var BPromise=require(_0x87ed('0x5'));var rp=require(_0x87ed('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x87ed('0x7'));var config=require('../../config/environment');var attributes=require(_0x87ed('0x8'));module[_0x87ed('0x9')]=function(_0x226c86,_0x4c303c){return _0x226c86['define'](_0x87ed('0xa'),attributes,{'tableName':_0x87ed('0xb'),'paranoid':![],'indexes':[{'name':_0x87ed('0xc'),'fields':[_0x87ed('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 7c983fb..2acda05 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(_0x52df33,_0x4998b9){var _0x4c0496=function(_0x558bb6){while(--_0x558bb6){_0x52df33['push'](_0x52df33['shift']());}};_0x4c0496(++_0x4998b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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(_0x19a683,_0x309f26){var _0x367587=function(_0x70bbda){while(--_0x70bbda){_0x19a683['push'](_0x19a683['shift']());}};_0x367587(++_0x309f26);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 f2733eb..baf33eb 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x753c=['sequelize','sync','then','listen','info','start','Online\x20apps:','map','filter','name','status','online','join','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe'];(function(_0x557f5f,_0x31d8e7){var _0x196eba=function(_0x433d89){while(--_0x433d89){_0x557f5f['push'](_0x557f5f['shift']());}};_0x196eba(++_0x31d8e7);}(_0x753c,0x96));var _0xc753=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x753c[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var mysqldb=require(_0xc753('0x0'));var rpc=require('./rpc');var config=require(_0xc753('0x1'));var logger=require(_0xc753('0x2'))(_0xc753('0x3'));var pm2=require(_0xc753('0x4'));var pm2Config=require(_0xc753('0x5'));var schedule=require(_0xc753('0x6'));var chat=require(_0xc753('0x7'));var whatsapp=require(_0xc753('0x8'));var transcribe=require(_0xc753('0x9'));function main(){return mysqldb['db'][_0xc753('0xa')][_0xc753('0xb')]()[_0xc753('0xc')](function(){return rpc[_0xc753('0xd')]();})[_0xc753('0xc')](function(_0xb80bea){logger[_0xc753('0xe')](_0xb80bea);return chat[_0xc753('0xf')]();})[_0xc753('0xc')](function(){return whatsapp[_0xc753('0xf')]();})[_0xc753('0xc')](function(){return schedule[_0xc753('0xf')]();})[_0xc753('0xc')](function(){return transcribe[_0xc753('0xf')]();})[_0xc753('0xc')](function(_0x5402c6){logger[_0xc753('0xe')](_0x5402c6);return pm2[_0xc753('0xf')](pm2Config);})['then'](function(_0x415431){logger['info'](_0xc753('0x10'),_[_0xc753('0x11')](_[_0xc753('0x12')](_0x415431,{'status':'online'}),_0xc753('0x13'))['join']());logger[_0xc753('0xe')]('Offline\x20apps:',_[_0xc753('0x11')](_[_0xc753('0x12')](_0x415431,function(_0x288a69){return _0x288a69[_0xc753('0x14')]!==_0xc753('0x15');}),'name')[_0xc753('0x16')]()||_0xc753('0x17'));config[_0xc753('0x18')]&&require(_0xc753('0x19'))[_0xc753('0x1a')]();require(_0xc753('0x1b'))[_0xc753('0x1a')]();})[_0xc753('0x1c')](function(_0x5a3ea7){logger[_0xc753('0x1d')](_0xc753('0x1e'),_0x5a3ea7);process[_0xc753('0x1f')](0x1);});}main(); \ No newline at end of file +var _0xb96d=['listen','then','info','start','Online\x20apps:','filter','online','name','join','Offline\x20apps:','map','status','seedDB','./config/seedDB','default','./config/license','catch','error','./mysqldb','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync'];(function(_0x5113b8,_0x1dd42e){var _0x1174bb=function(_0x46ae3c){while(--_0x46ae3c){_0x5113b8['push'](_0x5113b8['shift']());}};_0x1174bb(++_0x1dd42e);}(_0xb96d,0x9e));var _0xdb96=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0xb96d[_0x52f1e6];return _0x21f104;};'use strict';var _=require('lodash');var mysqldb=require(_0xdb96('0x0'));var rpc=require(_0xdb96('0x1'));var config=require(_0xdb96('0x2'));var logger=require('./config/logger')(_0xdb96('0x3'));var pm2=require(_0xdb96('0x4'));var pm2Config=require(_0xdb96('0x5'));var schedule=require('./config/schedule');var chat=require('./config/schedule/chat');var whatsapp=require(_0xdb96('0x6'));var transcribe=require(_0xdb96('0x7'));function main(){return mysqldb['db'][_0xdb96('0x8')][_0xdb96('0x9')]()['then'](function(){return rpc[_0xdb96('0xa')]();})[_0xdb96('0xb')](function(_0x5e2e95){logger[_0xdb96('0xc')](_0x5e2e95);return chat['start']();})[_0xdb96('0xb')](function(){return whatsapp[_0xdb96('0xd')]();})['then'](function(){return schedule[_0xdb96('0xd')]();})[_0xdb96('0xb')](function(){return transcribe['start']();})[_0xdb96('0xb')](function(_0xa9010e){logger[_0xdb96('0xc')](_0xa9010e);return pm2[_0xdb96('0xd')](pm2Config);})['then'](function(_0xa18db8){logger[_0xdb96('0xc')](_0xdb96('0xe'),_['map'](_[_0xdb96('0xf')](_0xa18db8,{'status':_0xdb96('0x10')}),_0xdb96('0x11'))[_0xdb96('0x12')]());logger[_0xdb96('0xc')](_0xdb96('0x13'),_[_0xdb96('0x14')](_[_0xdb96('0xf')](_0xa18db8,function(_0x12630d){return _0x12630d[_0xdb96('0x15')]!==_0xdb96('0x10');}),_0xdb96('0x11'))[_0xdb96('0x12')]()||'None');config[_0xdb96('0x16')]&&require(_0xdb96('0x17'))[_0xdb96('0x18')]();require(_0xdb96('0x19'))['default']();})[_0xdb96('0x1a')](function(_0x33ec8f){logger[_0xdb96('0x1b')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x33ec8f);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 1184038..73cbbfa 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 _0xc765=['user','findOne','params','closed','disposition','then','json','unmanaged','Unmanaged.','headers','authorization','startsWith','Basic','User','find','authenticate','pass','status','Wrong\x20credentials.','catch','Bearer','query','getUuid','sub','Setting','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockDuration','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','use','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','apiKeyNonce','regenerateApiKey','apikey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','unshift','join','promisify','sign','payload','options','verify','randomBytes','toString','floor','now','HS512','../../mysqldb','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','crypto','bluebird','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','voicePause','chatPause','faxPause','openchannelPause','pauseType','lastPauseAt','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','settingsEnabled','isChatInteractionAuthorized','isAuthenticated'];(function(_0x1b3a90,_0x1cc2cd){var _0x76b5c=function(_0x63bdfe){while(--_0x63bdfe){_0x1b3a90['push'](_0x1b3a90['shift']());}};_0x76b5c(++_0x1cc2cd);}(_0xc765,0x13c));var _0x5c76=function(_0x422500,_0x573212){_0x422500=_0x422500-0x0;var _0x5aa179=_0xc765[_0x422500];return _0x5aa179;};'use strict';var db=require(_0x5c76('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x5c76('0x1'));var encryptor=require('../encryptor');var _=require(_0x5c76('0x2'));var jwt=require(_0x5c76('0x3'));var expressJwt=require(_0x5c76('0x4'));var compose=require(_0x5c76('0x5'));var basicAuth=require('basic-auth');var crypto=require(_0x5c76('0x6'));var BPromise=require(_0x5c76('0x7'));var util=require('util');var moment=require(_0x5c76('0x8'));var validateJwt=expressJwt({'secret':config[_0x5c76('0x9')][_0x5c76('0xa')]});var userAttributes=['id',_0x5c76('0xb'),_0x5c76('0xc'),_0x5c76('0xd'),_0x5c76('0xe'),_0x5c76('0xf'),_0x5c76('0x10'),_0x5c76('0x11'),'md5secret',_0x5c76('0x12'),_0x5c76('0x13'),'mailPause',_0x5c76('0x14'),'smsPause',_0x5c76('0x15'),_0x5c76('0x16'),'showWebBar','lastLoginAt',_0x5c76('0x17'),'crudPermissions','allowmessenger',_0x5c76('0x18'),_0x5c76('0x19'),_0x5c76('0x1a'),_0x5c76('0x1b'),'phoneBarDnd',_0x5c76('0x1c'),_0x5c76('0x1d'),_0x5c76('0x1e'),'phoneBarExpires','phoneBarPrefixRequired',_0x5c76('0x1f'),_0x5c76('0x20'),_0x5c76('0x21'),'interface',_0x5c76('0x22'),_0x5c76('0x23')];exports[_0x5c76('0x24')]=function(){return this[_0x5c76('0x25')](!![])['use'](function(_0x5e48b9,_0x3195f1,_0x589d9f){if(_0x5e48b9[_0x5c76('0x26')]){_0x589d9f();}else{return db['ChatInteraction'][_0x5c76('0x27')]({'where':{'id':_0x5e48b9[_0x5c76('0x28')]['id']},'attributes':['id',_0x5c76('0x29'),_0x5c76('0x2a')],'raw':!![]})[_0x5c76('0x2b')](function(_0x39774e){if(_0x39774e&&_0x39774e[_0x5c76('0x29')]){return _0x3195f1['status'](_0x39774e['disposition']==='unmanaged'?0x195:0x193)[_0x5c76('0x2c')]({'message':_0x39774e['disposition']===_0x5c76('0x2d')?_0x5c76('0x2e'):'Forbidden.'});}else{_0x589d9f();}})['catch'](function(_0x1cc664){_0x589d9f(_0x1cc664);});}});};exports[_0x5c76('0x25')]=function isAuthenticated(_0x508f27){return compose()['use'](function(_0x346282,_0x2b790b,_0x293e7b){var _0x3800c1;if(_0x346282[_0x5c76('0x2f')][_0x5c76('0x30')]){if(_[_0x5c76('0x31')](_0x346282['headers'][_0x5c76('0x30')],_0x5c76('0x32'))){var _0x1fa393=basicAuth(_0x346282);db[_0x5c76('0x33')][_0x5c76('0x34')]({'where':{'name':_0x1fa393[_0x5c76('0xd')]}})[_0x5c76('0x2b')](function(_0x4dbe6c){if(!_0x4dbe6c||!_0x4dbe6c[_0x5c76('0x35')](_0x1fa393[_0x5c76('0x36')])){return _0x2b790b[_0x5c76('0x37')](0x191)[_0x5c76('0x2c')]({'message':_0x5c76('0x38')});}_0x346282[_0x5c76('0x26')]={'id':_0x4dbe6c['id']};_0x293e7b();})[_0x5c76('0x39')](function(_0x2bd028){_0x293e7b(_0x2bd028);});}else if(_[_0x5c76('0x31')](_0x346282[_0x5c76('0x2f')][_0x5c76('0x30')],_0x5c76('0x3a'))){validateJwt(_0x346282,_0x2b790b,_0x293e7b);}else{if(_0x508f27){_0x293e7b();}else{return _0x2b790b[_0x5c76('0x37')](0x193)[_0x5c76('0x2c')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x346282[_0x5c76('0x3b')]['apikey']){try{var _0x55952c={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x5c76('0x3c')]()};verifyJwt(_0x346282[_0x5c76('0x3b')]['apikey'],_0x55952c)[_0x5c76('0x2b')](function(_0x522f1a){return db[_0x5c76('0x33')][_0x5c76('0x34')]({'where':{'id':_0x522f1a[_0x5c76('0x3d')]}})[_0x5c76('0x2b')](function(_0x137fb){_0x3800c1=_0x137fb;return db[_0x5c76('0x3e')][_0x5c76('0x27')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})[_0x5c76('0x2b')](function(_0x184c62){if(!_0x3800c1||!_['isEqual'](_0x3800c1['apiKeyNonce'],_0x522f1a[_0x5c76('0x3f')])){return _0x2b790b[_0x5c76('0x37')](0x191)[_0x5c76('0x2c')]({'message':_0x5c76('0x40')});}if(_0x3800c1[_0x5c76('0x41')]){return _0x2b790b['status'](0x191)[_0x5c76('0x2c')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x3800c1[_0x5c76('0x42')]){if(_0x184c62[_0x5c76('0x43')]>0x0){if(moment(_0x3800c1[_0x5c76('0x44')])[_0x5c76('0x45')](_0x184c62['blockDuration'],_0x5c76('0x46'))>moment()){return _0x2b790b[_0x5c76('0x37')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x2b790b[_0x5c76('0x37')](0x191)[_0x5c76('0x2c')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x346282[_0x5c76('0x26')]={'id':_0x3800c1['id']};_0x293e7b();});})[_0x5c76('0x39')](function(){return _0x2b790b[_0x5c76('0x37')](0x191)[_0x5c76('0x2c')]({'message':_0x5c76('0x47')});});}catch(_0x2348d6){_0x293e7b(_0x2348d6);}}else if(_0x508f27){_0x293e7b();}else{return _0x2b790b[_0x5c76('0x37')](0x193)['json']({'message':_0x5c76('0x48')});}})[_0x5c76('0x49')](function(_0x52cf26,_0x9ff118,_0x334691){if(_0x52cf26['user']){db[_0x5c76('0x33')]['find']({'where':{'id':_0x52cf26[_0x5c76('0x26')]['id']},'attributes':userAttributes})[_0x5c76('0x2b')](function(_0x3e171a){if(!_0x3e171a){return _0x9ff118[_0x5c76('0x37')](0x194)['json']({'message':_0x5c76('0x4a')});}_0x52cf26[_0x5c76('0x26')]=_0x3e171a;_0x334691();})['catch'](function(_0x279009){_0x334691(_0x279009);});}else if(_0x508f27){_0x334691();}else{return _0x9ff118[_0x5c76('0x37')](0x194)[_0x5c76('0x2c')]({'message':_0x5c76('0x4b')});}});};exports[_0x5c76('0x4c')]=function canUpdate(){return compose()[_0x5c76('0x49')](function(_0x411e94,_0x569093,_0x48b2c6){return licenseUtil['getLicense']()['then'](function(_0xed716){if(_0xed716['update']){_0x48b2c6();}else{return _0x569093[_0x5c76('0x37')](0x193)[_0x5c76('0x2c')]({'message':_0x5c76('0x4d')});}})[_0x5c76('0x39')](function(_0x869523){_0x48b2c6(_0x869523);});});};exports[_0x5c76('0x4e')]=function(_0xe4d8ec,_0x469d25,_0x16773e){_0xe4d8ec[_0x5c76('0x4e')]=!![];return _0x16773e();};exports[_0x5c76('0x4f')]=function signToken(_0x3e7e6a){return signJwt(_0x3e7e6a);};exports[_0x5c76('0x50')]=function(_0x5113cd,_0x45c3f9){if(!_0x5113cd[_0x5c76('0x26')]){return _0x45c3f9[_0x5c76('0x37')](0x194)[_0x5c76('0x2c')]({'message':_0x5c76('0x51')});}var _0x475e40={'payload':{'id':_0x5113cd[_0x5c76('0x26')]['id'],'role':_0x5113cd['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x475e40)['then'](function(_0x4c63ff){_0x45c3f9[_0x5c76('0x52')](_0x5c76('0x53'),_0x4c63ff);_0x45c3f9[_0x5c76('0x54')](_0x5c76('0x55'));})[_0x5c76('0x39')](function(_0x345024){return _0x45c3f9['status'](0x1f4)[_0x5c76('0x56')](_0x345024);});};exports[_0x5c76('0x57')]=function(_0x23e07a){if(_['isNil'](_0x23e07a['apiKeyNonce'])||_[_0x5c76('0x58')](_0x23e07a[_0x5c76('0x59')])){return null;}else{return createJwt(_0x23e07a);}};exports[_0x5c76('0x5a')]=function(_0x5e8457){_0x5e8457[_0x5c76('0x5b')]=generateNonce();_0x5e8457[_0x5c76('0x59')]=generateIssuedAt();return createJwt(_0x5e8457);};exports[_0x5c76('0x5c')]=function(_0x4b8446,_0x382e65){var _0x464f53=_0x4b8446[_0x5c76('0x3b')][_0x5c76('0x5d')];if(_0x464f53){var _0x58c9a={'nonce':_0x382e65[_0x5c76('0x5b')],'iat':_0x382e65[_0x5c76('0x59')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x5c76('0x3c')]()};return verifyJwt(_0x464f53,_0x58c9a)[_0x5c76('0x2b')](function(){return generateApiKey(_0x382e65);});}else{throw{'message':_0x5c76('0x5e')};}};exports['validatePasswordPattern']=function(_0x11c622){var _0x2b251b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2b251b['test'](_0x11c622))throw new db[(_0x5c76('0x5f'))][(_0x5c76('0x60'))](_0x5c76('0x61'));return;};exports[_0x5c76('0x62')]=function(_0x210b81,_0x354d49,_0x494a95){var _0xc0322c=encryptor[_0x5c76('0x63')](_0x354d49)[_0x5c76('0x64')](',');for(var _0x5a52e7=0x0;_0x5a52e7<_0x494a95;_0x5a52e7++){if(!_0xc0322c[_0x5a52e7])break;if(_0x210b81[_0x5c76('0x65')]()===_0xc0322c[_0x5a52e7][_0x5c76('0x65')]()){var _0x320a4c=util[_0x5c76('0x66')](_0x5c76('0x67'),_0x494a95);if(_0x494a95===0x1){_0x320a4c=_0x5c76('0x68');}throw new db[(_0x5c76('0x5f'))][(_0x5c76('0x60'))](_0x320a4c);}}return;};exports['updatePasswordsHistory']=function(_0x5397b5,_0x439543){var _0x18cc5b=_0x439543?encryptor[_0x5c76('0x63')](_0x439543)['split'](','):[];if(_0x18cc5b[_0x5c76('0x69')]===0x5){_0x18cc5b['splice'](-0x1,0x1);}_0x18cc5b[_0x5c76('0x6a')](_0x5397b5);return encryptor['encryptString'](_0x18cc5b[_0x5c76('0x6b')](','));};function signJwt(_0x3f9b22){var _0x1639e3=BPromise[_0x5c76('0x6c')](jwt[_0x5c76('0x6d')],{'context':jwt});var _0x579500=_0x3f9b22['secret']||config[_0x5c76('0x9')][_0x5c76('0xa')];return new BPromise(function(_0x11b62f,_0x62f85e){_0x1639e3(_0x3f9b22[_0x5c76('0x6e')],_0x579500,_0x3f9b22[_0x5c76('0x6f')])[_0x5c76('0x2b')](function(_0x3657ae){_0x11b62f(_0x3657ae);})[_0x5c76('0x39')](function(_0xf3bd1d){_0x62f85e(_0xf3bd1d);});});}function verifyJwt(_0x340e13,_0x570b17,_0x1cd34c){var _0x22ceb6=BPromise[_0x5c76('0x6c')](jwt[_0x5c76('0x70')],{'context':jwt});var _0x23270f=_0x1cd34c||config[_0x5c76('0x9')][_0x5c76('0xa')];return new BPromise(function(_0x3f2a4a,_0x533abf){_0x22ceb6(_0x340e13,_0x23270f,_0x570b17)[_0x5c76('0x2b')](function(_0x31b983){_0x3f2a4a(_0x31b983);})[_0x5c76('0x39')](function(_0x23016a){_0x533abf(_0x23016a);});});}function generateNonce(){return crypto[_0x5c76('0x71')](0x10)[_0x5c76('0x72')]('hex');}function generateIssuedAt(){return Math[_0x5c76('0x73')](Date[_0x5c76('0x74')]()/0x3e8)['toString']();}function createJwt(_0xe72a70){var _0x5d4565={'payload':{'iat':_0xe72a70[_0x5c76('0x59')],'nonce':_0xe72a70[_0x5c76('0x5b')]},'options':{'algorithm':_0x5c76('0x75'),'subject':_0xe72a70['id'][_0x5c76('0x72')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x5d4565)['then'](function(_0x1c2410){return{'iat':_0xe72a70[_0x5c76('0x59')],'nonce':_0xe72a70[_0x5c76('0x5b')],'token':_0x1c2410};});} \ No newline at end of file +var _0xdbc8=['alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','ChatInteraction','findOne','params','closed','then','status','disposition','json','catch','headers','authorization','Basic','pass','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','find','sub','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','minutes','use','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','splice','encryptString','join','promisify','secret','payload','randomBytes','hex','floor','HS512','toString','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','crypto','util','moment','secrets','session','fullname','internal','userpic','permissions','md5secret','voicePause','chatPause','mailPause','smsPause','openchannelPause','pauseType','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt'];(function(_0x363868,_0x1a04f2){var _0x1ee65c=function(_0x4a2b43){while(--_0x4a2b43){_0x363868['push'](_0x363868['shift']());}};_0x1ee65c(++_0x1a04f2);}(_0xdbc8,0x1c5));var _0x8dbc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xdbc8[_0x397e5f];return _0x5302b8;};'use strict';var db=require(_0x8dbc('0x0'))['db'];var config=require(_0x8dbc('0x1'));var hardwareConf=require(_0x8dbc('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x8dbc('0x3'));var _=require(_0x8dbc('0x4'));var jwt=require(_0x8dbc('0x5'));var expressJwt=require(_0x8dbc('0x6'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require(_0x8dbc('0x7'));var BPromise=require('bluebird');var util=require(_0x8dbc('0x8'));var moment=require(_0x8dbc('0x9'));var validateJwt=expressJwt({'secret':config[_0x8dbc('0xa')][_0x8dbc('0xb')]});var userAttributes=['id','role',_0x8dbc('0xc'),'name',_0x8dbc('0xd'),'email',_0x8dbc('0xe'),_0x8dbc('0xf'),_0x8dbc('0x10'),_0x8dbc('0x11'),_0x8dbc('0x12'),_0x8dbc('0x13'),'faxPause',_0x8dbc('0x14'),_0x8dbc('0x15'),_0x8dbc('0x16'),'showWebBar',_0x8dbc('0x17'),'lastPauseAt',_0x8dbc('0x18'),_0x8dbc('0x19'),_0x8dbc('0x1a'),_0x8dbc('0x1b'),_0x8dbc('0x1c'),_0x8dbc('0x1d'),_0x8dbc('0x1e'),_0x8dbc('0x1f'),_0x8dbc('0x20'),_0x8dbc('0x21'),'phoneBarExpires',_0x8dbc('0x22'),_0x8dbc('0x23'),_0x8dbc('0x24'),_0x8dbc('0x25'),_0x8dbc('0x26'),_0x8dbc('0x27'),'settingsEnabled'];exports[_0x8dbc('0x28')]=function(){return this[_0x8dbc('0x29')](!![])['use'](function(_0x2afdc9,_0x27229e,_0x37e3e4){if(_0x2afdc9['user']){_0x37e3e4();}else{return db[_0x8dbc('0x2a')][_0x8dbc('0x2b')]({'where':{'id':_0x2afdc9[_0x8dbc('0x2c')]['id']},'attributes':['id',_0x8dbc('0x2d'),'disposition'],'raw':!![]})[_0x8dbc('0x2e')](function(_0xe25534){if(_0xe25534&&_0xe25534[_0x8dbc('0x2d')]){return _0x27229e[_0x8dbc('0x2f')](_0xe25534[_0x8dbc('0x30')]==='unmanaged'?0x195:0x193)[_0x8dbc('0x31')]({'message':_0xe25534[_0x8dbc('0x30')]==='unmanaged'?'Unmanaged.':'Forbidden.'});}else{_0x37e3e4();}})[_0x8dbc('0x32')](function(_0x494c8f){_0x37e3e4(_0x494c8f);});}});};exports[_0x8dbc('0x29')]=function isAuthenticated(_0x542928){return compose()['use'](function(_0x31ca4c,_0x339d3c,_0x3cac99){var _0x57577b;if(_0x31ca4c[_0x8dbc('0x33')][_0x8dbc('0x34')]){if(_['startsWith'](_0x31ca4c[_0x8dbc('0x33')]['authorization'],_0x8dbc('0x35'))){var _0x5b3d2a=basicAuth(_0x31ca4c);db['User']['find']({'where':{'name':_0x5b3d2a['name']}})[_0x8dbc('0x2e')](function(_0x1d6c0e){if(!_0x1d6c0e||!_0x1d6c0e['authenticate'](_0x5b3d2a[_0x8dbc('0x36')])){return _0x339d3c[_0x8dbc('0x2f')](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x31ca4c[_0x8dbc('0x37')]={'id':_0x1d6c0e['id']};_0x3cac99();})['catch'](function(_0x51adcc){_0x3cac99(_0x51adcc);});}else if(_['startsWith'](_0x31ca4c['headers']['authorization'],_0x8dbc('0x38'))){validateJwt(_0x31ca4c,_0x339d3c,_0x3cac99);}else{if(_0x542928){_0x3cac99();}else{return _0x339d3c[_0x8dbc('0x2f')](0x193)['json']({'message':_0x8dbc('0x39')});}}}else if(_0x31ca4c[_0x8dbc('0x3a')][_0x8dbc('0x3b')]){try{var _0x1b93ff={'audience':hardwareConf[_0x8dbc('0x3c')](),'issuer':hardwareConf[_0x8dbc('0x3c')]()};verifyJwt(_0x31ca4c['query']['apikey'],_0x1b93ff)['then'](function(_0x45459e){return db[_0x8dbc('0x3d')][_0x8dbc('0x3e')]({'where':{'id':_0x45459e[_0x8dbc('0x3f')]}})[_0x8dbc('0x2e')](function(_0x52aa9b){_0x57577b=_0x52aa9b;return db['Setting'][_0x8dbc('0x2b')]({'where':{'id':0x1},'attributes':[_0x8dbc('0x40'),_0x8dbc('0x41')],'raw':!![]});})[_0x8dbc('0x2e')](function(_0x37d889){if(!_0x57577b||!_[_0x8dbc('0x42')](_0x57577b[_0x8dbc('0x43')],_0x45459e[_0x8dbc('0x44')])){return _0x339d3c[_0x8dbc('0x2f')](0x191)[_0x8dbc('0x31')]({'message':_0x8dbc('0x45')});}if(_0x57577b[_0x8dbc('0x46')]){return _0x339d3c[_0x8dbc('0x2f')](0x191)[_0x8dbc('0x31')]({'message':_0x8dbc('0x47')});}if(_0x57577b[_0x8dbc('0x48')]){if(_0x37d889['blockDuration']>0x0){if(moment(_0x57577b['blockedAt'])[_0x8dbc('0x49')](_0x37d889['blockDuration'],_0x8dbc('0x4a'))>moment()){return _0x339d3c[_0x8dbc('0x2f')](0x191)[_0x8dbc('0x31')]({'message':_0x8dbc('0x47')});}}else{return _0x339d3c[_0x8dbc('0x2f')](0x191)[_0x8dbc('0x31')]({'message':_0x8dbc('0x47')});}}_0x31ca4c[_0x8dbc('0x37')]={'id':_0x57577b['id']};_0x3cac99();});})[_0x8dbc('0x32')](function(){return _0x339d3c[_0x8dbc('0x2f')](0x191)['json']({'message':_0x8dbc('0x47')});});}catch(_0xd9eb00){_0x3cac99(_0xd9eb00);}}else if(_0x542928){_0x3cac99();}else{return _0x339d3c[_0x8dbc('0x2f')](0x193)[_0x8dbc('0x31')]({'message':_0x8dbc('0x39')});}})[_0x8dbc('0x4b')](function(_0xbe7dfd,_0x39ca75,_0x5ca15a){if(_0xbe7dfd['user']){db[_0x8dbc('0x3d')][_0x8dbc('0x3e')]({'where':{'id':_0xbe7dfd[_0x8dbc('0x37')]['id']},'attributes':userAttributes})['then'](function(_0x19e509){if(!_0x19e509){return _0x39ca75[_0x8dbc('0x2f')](0x194)[_0x8dbc('0x31')]({'message':_0x8dbc('0x4c')});}_0xbe7dfd[_0x8dbc('0x37')]=_0x19e509;_0x5ca15a();})['catch'](function(_0x53509c){_0x5ca15a(_0x53509c);});}else if(_0x542928){_0x5ca15a();}else{return _0x39ca75[_0x8dbc('0x2f')](0x194)[_0x8dbc('0x31')]({'message':_0x8dbc('0x4d')});}});};exports[_0x8dbc('0x4e')]=function canUpdate(){return compose()[_0x8dbc('0x4b')](function(_0x418ae7,_0x496cc4,_0x171c4d){return licenseUtil[_0x8dbc('0x4f')]()[_0x8dbc('0x2e')](function(_0x3bb0e0){if(_0x3bb0e0[_0x8dbc('0x50')]){_0x171c4d();}else{return _0x496cc4['status'](0x193)[_0x8dbc('0x31')]({'message':_0x8dbc('0x51')});}})[_0x8dbc('0x32')](function(_0x47ea02){_0x171c4d(_0x47ea02);});});};exports[_0x8dbc('0x52')]=function(_0x4a8398,_0x49968f,_0x39ce9a){_0x4a8398[_0x8dbc('0x52')]=!![];return _0x39ce9a();};exports[_0x8dbc('0x53')]=function signToken(_0x33c788){return signJwt(_0x33c788);};exports[_0x8dbc('0x54')]=function(_0x50988f,_0x574e68){if(!_0x50988f[_0x8dbc('0x37')]){return _0x574e68[_0x8dbc('0x2f')](0x194)[_0x8dbc('0x31')]({'message':_0x8dbc('0x55')});}var _0x1b6715={'payload':{'id':_0x50988f[_0x8dbc('0x37')]['id'],'role':_0x50988f[_0x8dbc('0x37')][_0x8dbc('0x56')]},'options':{'expiresIn':0x15180}};return signJwt(_0x1b6715)[_0x8dbc('0x2e')](function(_0x4374df){_0x574e68[_0x8dbc('0x57')](_0x8dbc('0x58'),_0x4374df);_0x574e68[_0x8dbc('0x59')](_0x8dbc('0x5a'));})['catch'](function(_0x4db66e){return _0x574e68[_0x8dbc('0x2f')](0x1f4)[_0x8dbc('0x5b')](_0x4db66e);});};exports[_0x8dbc('0x5c')]=function(_0x4dd03b){if(_[_0x8dbc('0x5d')](_0x4dd03b[_0x8dbc('0x43')])||_[_0x8dbc('0x5d')](_0x4dd03b[_0x8dbc('0x5e')])){return null;}else{return createJwt(_0x4dd03b);}};exports['generateApiKey']=function(_0x5b03cd){_0x5b03cd[_0x8dbc('0x43')]=generateNonce();_0x5b03cd[_0x8dbc('0x5e')]=generateIssuedAt();return createJwt(_0x5b03cd);};exports[_0x8dbc('0x5f')]=function(_0x55699a,_0x5697e6){var _0x3e56ac=_0x55699a['query']['apikey'];if(_0x3e56ac){var _0x529f86={'nonce':_0x5697e6[_0x8dbc('0x43')],'iat':_0x5697e6[_0x8dbc('0x5e')],'audience':hardwareConf[_0x8dbc('0x3c')](),'issuer':hardwareConf[_0x8dbc('0x3c')]()};return verifyJwt(_0x3e56ac,_0x529f86)[_0x8dbc('0x2e')](function(){return generateApiKey(_0x5697e6);});}else{throw{'message':_0x8dbc('0x60')};}};exports[_0x8dbc('0x61')]=function(_0x3f2b35){var _0x4d697a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4d697a[_0x8dbc('0x62')](_0x3f2b35))throw new db[(_0x8dbc('0x63'))][(_0x8dbc('0x64'))]('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[_0x8dbc('0x65')]=function(_0x459ca4,_0x45e548,_0x3d7d6c){var _0x3aacc7=encryptor[_0x8dbc('0x66')](_0x45e548)[_0x8dbc('0x67')](',');for(var _0xfa1c05=0x0;_0xfa1c05<_0x3d7d6c;_0xfa1c05++){if(!_0x3aacc7[_0xfa1c05])break;if(_0x459ca4[_0x8dbc('0x68')]()===_0x3aacc7[_0xfa1c05]['toLowerCase']()){var _0x3bfcaa=util[_0x8dbc('0x69')](_0x8dbc('0x6a'),_0x3d7d6c);if(_0x3d7d6c===0x1){_0x3bfcaa=_0x8dbc('0x6b');}throw new db[(_0x8dbc('0x63'))]['ValidationError'](_0x3bfcaa);}}return;};exports[_0x8dbc('0x6c')]=function(_0x1da57f,_0x232816){var _0x3866ba=_0x232816?encryptor[_0x8dbc('0x66')](_0x232816)[_0x8dbc('0x67')](','):[];if(_0x3866ba['length']===0x5){_0x3866ba[_0x8dbc('0x6d')](-0x1,0x1);}_0x3866ba['unshift'](_0x1da57f);return encryptor[_0x8dbc('0x6e')](_0x3866ba[_0x8dbc('0x6f')](','));};function signJwt(_0x29a693){var _0x14b163=BPromise[_0x8dbc('0x70')](jwt['sign'],{'context':jwt});var _0x38f6af=_0x29a693[_0x8dbc('0x71')]||config['secrets'][_0x8dbc('0xb')];return new BPromise(function(_0x68c79,_0x6e67b0){_0x14b163(_0x29a693[_0x8dbc('0x72')],_0x38f6af,_0x29a693['options'])['then'](function(_0x441653){_0x68c79(_0x441653);})[_0x8dbc('0x32')](function(_0x1d5771){_0x6e67b0(_0x1d5771);});});}function verifyJwt(_0x38d29a,_0xd4dfde,_0x3a9ba9){var _0x52e996=BPromise[_0x8dbc('0x70')](jwt['verify'],{'context':jwt});var _0x371176=_0x3a9ba9||config[_0x8dbc('0xa')][_0x8dbc('0xb')];return new BPromise(function(_0x57e7be,_0x23150e){_0x52e996(_0x38d29a,_0x371176,_0xd4dfde)[_0x8dbc('0x2e')](function(_0x1d117e){_0x57e7be(_0x1d117e);})[_0x8dbc('0x32')](function(_0x314e70){_0x23150e(_0x314e70);});});}function generateNonce(){return crypto[_0x8dbc('0x73')](0x10)['toString'](_0x8dbc('0x74'));}function generateIssuedAt(){return Math[_0x8dbc('0x75')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x271ab9){var _0x1de473={'payload':{'iat':_0x271ab9['apiKeyIat'],'nonce':_0x271ab9['apiKeyNonce']},'options':{'algorithm':_0x8dbc('0x76'),'subject':_0x271ab9['id'][_0x8dbc('0x77')](),'issuer':hardwareConf[_0x8dbc('0x3c')](),'audience':hardwareConf[_0x8dbc('0x3c')]()}};return signJwt(_0x1de473)[_0x8dbc('0x2e')](function(_0x1d7e4a){return{'iat':_0x271ab9['apiKeyIat'],'nonce':_0x271ab9[_0x8dbc('0x43')],'token':_0x1d7e4a};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index f083a25..3b98db8 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 _0x81c6=['createWriteStream','final','encryptString','secret','base64','createDecipher','utf8','bluebird','aes-256-ctr','aes192','hasOwnProperty','createCipher','algorithm','data','update','binary','write','end','close','unlink','decryptFile','createReadStream'];(function(_0xc70ff5,_0x1f8a90){var _0x3f84b4=function(_0x5d55d5){while(--_0x5d55d5){_0xc70ff5['push'](_0xc70ff5['shift']());}};_0x3f84b4(++_0x1f8a90);}(_0x81c6,0x1d5));var _0x681c=function(_0x40dc7e,_0x322488){_0x40dc7e=_0x40dc7e-0x0;var _0x31f6d4=_0x81c6[_0x40dc7e];return _0x31f6d4;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x681c('0x0'));var config=require('../../config/environment');const stringOptions={'secret':config['secrets']['session'],'algorithm':_0x681c('0x1')};const fileOptions={'algorithm':_0x681c('0x2')};function combineOptions(_0x7a556b){var _0x5566e5={};for(var _0x44c18e in fileOptions){if(fileOptions[_0x681c('0x3')](_0x44c18e)){_0x5566e5[_0x44c18e]=fileOptions[_0x44c18e];}}if(_0x7a556b){for(var _0x1f2032 in _0x7a556b){if(_0x7a556b[_0x681c('0x3')](_0x1f2032)){_0x5566e5[_0x1f2032]=_0x7a556b[_0x1f2032];}}}return _0x5566e5;}exports['encryptFile']=function(_0x45331,_0xdc57a5,_0x5624d7,_0x5b5f22){return new BPromise(function(_0x1750e2,_0x3fac39){_0x5b5f22=combineOptions(_0x5b5f22);var _0x7f090a=new Buffer(_0x5624d7);var _0x5de78e=fs['createReadStream'](_0x45331);var _0x3e3770=fs['createWriteStream'](_0xdc57a5);var _0x82b6ad=crypto[_0x681c('0x4')](_0x5b5f22[_0x681c('0x5')],_0x7f090a);_0x5de78e['on'](_0x681c('0x6'),function(_0x48dc05){var _0x49729c=new Buffer(_0x82b6ad[_0x681c('0x7')](_0x48dc05),_0x681c('0x8'));_0x3e3770[_0x681c('0x9')](_0x49729c);});_0x5de78e['on']('end',function(){try{var _0x2e4651=new Buffer(_0x82b6ad['final'](_0x681c('0x8')),'binary');_0x3e3770[_0x681c('0x9')](_0x2e4651);_0x3e3770[_0x681c('0xa')]();_0x3e3770['on'](_0x681c('0xb'),function(){return _0x1750e2(_0xdc57a5);});}catch(_0x416723){fs[_0x681c('0xc')](_0xdc57a5);return _0x3fac39(_0x416723);}});});};exports[_0x681c('0xd')]=function(_0x50a4ec,_0x2b0939,_0x1135c9,_0x435a4c){return new BPromise(function(_0x5eb8,_0x2fce11){_0x435a4c=combineOptions(_0x435a4c);var _0x1619df=new Buffer(_0x1135c9);var _0x4e7df2=fs[_0x681c('0xe')](_0x50a4ec);var _0x42f506=fs[_0x681c('0xf')](_0x2b0939);var _0x42304f=crypto['createDecipher'](_0x435a4c[_0x681c('0x5')],_0x1619df);_0x4e7df2['on'](_0x681c('0x6'),function(_0x54d27f){var _0x161948=new Buffer(_0x42304f['update'](_0x54d27f),_0x681c('0x8'));_0x42f506[_0x681c('0x9')](_0x161948);});_0x4e7df2['on'](_0x681c('0xa'),function(){try{var _0x33c495=new Buffer(_0x42304f[_0x681c('0x10')]('binary'),'binary');_0x42f506['write'](_0x33c495);_0x42f506[_0x681c('0xa')]();_0x42f506['on'](_0x681c('0xb'),function(){return _0x5eb8(_0x2b0939);});}catch(_0x3adfe3){fs[_0x681c('0xc')](_0x2b0939);return _0x2fce11(_0x3adfe3);}});});};exports[_0x681c('0x11')]=function(_0x29f3fa,_0x415a0a,_0x3d0297){var _0x1b3d2b=_0x3d0297||stringOptions[_0x681c('0x5')];var _0x2be552=_0x415a0a||stringOptions[_0x681c('0x12')];var _0x13de03=crypto[_0x681c('0x4')](_0x1b3d2b,_0x2be552);var _0x3237ed=_0x13de03[_0x681c('0x7')](_0x29f3fa,'utf8',_0x681c('0x13'));_0x3237ed+=_0x13de03['final'](_0x681c('0x13'));return _0x3237ed;};exports['decryptString']=function(_0x583499,_0x30c977,_0x17ea7c){var _0x17e8f3=_0x17ea7c||stringOptions[_0x681c('0x5')];var _0x4c9fd0=_0x30c977||stringOptions[_0x681c('0x12')];var _0x39fca3=crypto[_0x681c('0x14')](_0x17e8f3,_0x4c9fd0);var _0x936fce=_0x39fca3[_0x681c('0x7')](_0x583499,_0x681c('0x13'),_0x681c('0x15'));_0x936fce+=_0x39fca3['final'](_0x681c('0x15'));return _0x936fce;}; \ No newline at end of file +var _0xc949=['end','final','close','unlink','decryptFile','createDecipher','encryptString','utf8','base64','secret','crypto','../../config/environment','secrets','session','aes-256-ctr','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','update','binary','write'];(function(_0x253afb,_0x346474){var _0x2dc688=function(_0x8e4c1b){while(--_0x8e4c1b){_0x253afb['push'](_0x253afb['shift']());}};_0x2dc688(++_0x346474);}(_0xc949,0x181));var _0x9c94=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xc949[_0x4baae2];return _0x1a2285;};'use strict';var crypto=require(_0x9c94('0x0'));var fs=require('fs');var BPromise=require('bluebird');var config=require(_0x9c94('0x1'));const stringOptions={'secret':config[_0x9c94('0x2')][_0x9c94('0x3')],'algorithm':_0x9c94('0x4')};const fileOptions={'algorithm':'aes192'};function combineOptions(_0x11a56c){var _0x231762={};for(var _0x528a17 in fileOptions){if(fileOptions[_0x9c94('0x5')](_0x528a17)){_0x231762[_0x528a17]=fileOptions[_0x528a17];}}if(_0x11a56c){for(var _0x1b60a1 in _0x11a56c){if(_0x11a56c[_0x9c94('0x5')](_0x1b60a1)){_0x231762[_0x1b60a1]=_0x11a56c[_0x1b60a1];}}}return _0x231762;}exports[_0x9c94('0x6')]=function(_0x57fcd7,_0xf373e,_0x360e7b,_0x25ecd0){return new BPromise(function(_0x43aa51,_0xa874c7){_0x25ecd0=combineOptions(_0x25ecd0);var _0x423e62=new Buffer(_0x360e7b);var _0x174a53=fs[_0x9c94('0x7')](_0x57fcd7);var _0x417063=fs[_0x9c94('0x8')](_0xf373e);var _0x5775c9=crypto[_0x9c94('0x9')](_0x25ecd0[_0x9c94('0xa')],_0x423e62);_0x174a53['on'](_0x9c94('0xb'),function(_0x20fc5a){var _0x2ce750=new Buffer(_0x5775c9[_0x9c94('0xc')](_0x20fc5a),_0x9c94('0xd'));_0x417063[_0x9c94('0xe')](_0x2ce750);});_0x174a53['on'](_0x9c94('0xf'),function(){try{var _0x1e326f=new Buffer(_0x5775c9[_0x9c94('0x10')](_0x9c94('0xd')),_0x9c94('0xd'));_0x417063[_0x9c94('0xe')](_0x1e326f);_0x417063['end']();_0x417063['on'](_0x9c94('0x11'),function(){return _0x43aa51(_0xf373e);});}catch(_0x496f83){fs[_0x9c94('0x12')](_0xf373e);return _0xa874c7(_0x496f83);}});});};exports[_0x9c94('0x13')]=function(_0x4f0013,_0xe52641,_0x4d6308,_0x56e4e1){return new BPromise(function(_0xf4054e,_0x48d121){_0x56e4e1=combineOptions(_0x56e4e1);var _0x60e4e2=new Buffer(_0x4d6308);var _0x33bd19=fs['createReadStream'](_0x4f0013);var _0x201e04=fs[_0x9c94('0x8')](_0xe52641);var _0x412804=crypto[_0x9c94('0x14')](_0x56e4e1[_0x9c94('0xa')],_0x60e4e2);_0x33bd19['on'](_0x9c94('0xb'),function(_0x3e361c){var _0x5cb39c=new Buffer(_0x412804[_0x9c94('0xc')](_0x3e361c),_0x9c94('0xd'));_0x201e04['write'](_0x5cb39c);});_0x33bd19['on'](_0x9c94('0xf'),function(){try{var _0x845304=new Buffer(_0x412804[_0x9c94('0x10')](_0x9c94('0xd')),_0x9c94('0xd'));_0x201e04[_0x9c94('0xe')](_0x845304);_0x201e04[_0x9c94('0xf')]();_0x201e04['on'](_0x9c94('0x11'),function(){return _0xf4054e(_0xe52641);});}catch(_0x8fe4fb){fs[_0x9c94('0x12')](_0xe52641);return _0x48d121(_0x8fe4fb);}});});};exports[_0x9c94('0x15')]=function(_0xe9280a,_0x44d732,_0x8c0b7f){var _0x5b1020=_0x8c0b7f||stringOptions[_0x9c94('0xa')];var _0x2cdbf1=_0x44d732||stringOptions['secret'];var _0x102130=crypto[_0x9c94('0x9')](_0x5b1020,_0x2cdbf1);var _0x4795bb=_0x102130[_0x9c94('0xc')](_0xe9280a,_0x9c94('0x16'),'base64');_0x4795bb+=_0x102130[_0x9c94('0x10')](_0x9c94('0x17'));return _0x4795bb;};exports['decryptString']=function(_0x248280,_0x4cfb9c,_0xa5df6f){var _0x14d41b=_0xa5df6f||stringOptions[_0x9c94('0xa')];var _0x4008e8=_0x4cfb9c||stringOptions[_0x9c94('0x18')];var _0x3f2622=crypto[_0x9c94('0x14')](_0x14d41b,_0x4008e8);var _0x561fdc=_0x3f2622['update'](_0x248280,_0x9c94('0x17'),_0x9c94('0x16'));_0x561fdc+=_0x3f2622[_0x9c94('0x10')]('utf8');return _0x561fdc;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 75be737..1fed4dd 100644 --- a/server/components/export/csv.js +++ b/server/components/export/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4e6=['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(_0x19a93b,_0x2c5be3){var _0x44292e=function(_0x1c6ca9){while(--_0x1c6ca9){_0x19a93b['push'](_0x19a93b['shift']());}};_0x44292e(++_0x2c5be3);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xb4e6[_0x257642];return _0x3d813b;};'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 +var _0x2750=['.csv','split','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','inspect','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT'];(function(_0x15185f,_0x2003a5){var _0x3c9c47=function(_0x2862f7){while(--_0x2862f7){_0x15185f['push'](_0x15185f['shift']());}};_0x3c9c47(++_0x2003a5);}(_0x2750,0x13b));var _0x0275=function(_0x31155f,_0x3ffc53){_0x31155f=_0x31155f-0x0;var _0x55e37a=_0x2750[_0x31155f];return _0x55e37a;};'use strict';var util=require(_0x0275('0x0'));var path=require('path');var _=require(_0x0275('0x1'));var csv=require(_0x0275('0x2'));var fs=require('fs');var BPromise=require(_0x0275('0x3'));var zipdir=require(_0x0275('0x4'));var rimraf=require(_0x0275('0x5'));var db=require(_0x0275('0x6'))['db'];var dbH=require(_0x0275('0x6'))[_0x0275('0x7')];var logger=require(_0x0275('0x8'))(_0x0275('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0275('0xa')][0x3];var PATH=process[_0x0275('0xa')][0x4];function analyticExtractedReport(_0x2fa0eb,_0x2e4b5c){var _0x4dffd1={'status':_0x2fa0eb};var _0x1f7c4a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2e4b5c){_0x4dffd1[_0x0275('0xb')]=_0x2e4b5c;}return db[_0x0275('0xc')]['update'](_0x4dffd1,_0x1f7c4a);}function main(){var _0x5ae225=0x1388;var _0x224e0f;logger['info'](util[_0x0275('0xd')](_0x0275('0xe'),EXTRACTED_REPORT_ID,_0x0275('0xf')));return db[_0x0275('0x10')][_0x0275('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0275('0x12')]})[_0x0275('0x13')](function(_0x1f128d){if(_0x1f128d){_0x224e0f=_0x1f128d;_0x5ae225=_0x224e0f['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x0275('0x14')][_0x0275('0x15')](util[_0x0275('0xd')](_0x0275('0x16'),QUERY),{'type':dbH[_0x0275('0x14')][_0x0275('0x17')]['SELECT']});})[_0x0275('0x13')](function(_0x3030c0){if(!_0x3030c0[0x0]['num']){return analyticExtractedReport(_0x0275('0x18'));}var _0xaae367=[];var _0x4a40da=0x0;var _0x10dd2c=!![];if(_0x3030c0&&_0x3030c0[_0x0275('0x19')]){var _0x4a5578=_0x3030c0[0x0]['num']%(_0x4a40da+_0x5ae225);if(_0x224e0f['split']){for(;_0x10dd2c;_0x4a40da+=_0x5ae225,_0x4a5578=_0x3030c0[0x0]['num']%(_0x4a40da+_0x5ae225)){if(_0x4a5578==0x0||_0x4a5578==_0x3030c0[0x0]['num']){_0x10dd2c=![];}_0xaae367[_0x0275('0x1a')](dbH[_0x0275('0x14')][_0x0275('0x15')](util['format'](_0x0275('0x1b'),QUERY,_0x5ae225,_0x4a40da),{'type':dbH[_0x0275('0x14')][_0x0275('0x17')]['SELECT']}));}}else{_0xaae367[_0x0275('0x1a')](dbH[_0x0275('0x14')]['query'](QUERY,{'type':dbH['sequelize'][_0x0275('0x17')][_0x0275('0x1c')]}));}}var _0x562c82=path['dirname'](PATH);var _0xf3b68e=path['basename'](PATH,_0x0275('0x1d'));var _0x5c75f1=_0x224e0f[_0x0275('0x1e')]&&_0xaae367[_0x0275('0x19')]>0x1;var _0x594321=[];if(!fs[_0x0275('0x1f')](path[_0x0275('0x20')](_0x562c82,_0xf3b68e))&&_0x5c75f1){fs[_0x0275('0x21')](path['join'](_0x562c82,_0xf3b68e));}return BPromise[_0x0275('0x22')](_0xaae367,function(_0x44bbf8){_0x594321[_0x0275('0x1a')](_0x44bbf8);})[_0x0275('0x13')](function(){for(var _0x1a2024=0x0;_0x1a2024<_0x594321[_0x0275('0x19')];_0x1a2024+=0x1){var _0x56f26c;var _0x35343c=_0x594321[_0x1a2024];if(_0x5c75f1){_0x56f26c=path[_0x0275('0x20')](_0x562c82,_0xf3b68e,util[_0x0275('0xd')](_0x0275('0x23'),_0xf3b68e,_0x1a2024,_0x0275('0x24')));}else{_0x56f26c=path['join'](_0x562c82,util[_0x0275('0xd')](_0x0275('0x25'),_0xf3b68e,_0x0275('0x24')));}fs[_0x0275('0x26')](_0x56f26c,csv(_0x35343c));}})[_0x0275('0x13')](function(){if(_0x5c75f1){zipdir(path['join'](_0x562c82,_0xf3b68e),{'saveTo':path[_0x0275('0x20')](_0x562c82,util[_0x0275('0xd')](_0x0275('0x25'),_0xf3b68e,'zip'))},function(_0x5e2e22,_0x3cb2d7){});rimraf(path[_0x0275('0x20')](_0x562c82,_0xf3b68e),function(){});}})['then'](function(){logger[_0x0275('0x27')](util[_0x0275('0xd')](_0x0275('0x28'),EXTRACTED_REPORT_ID,_0x0275('0xf')));return analyticExtractedReport('Completed',_0x5c75f1?util[_0x0275('0xd')](_0x0275('0x25'),_0xf3b68e,_0x5c75f1?_0x0275('0x29'):_0x0275('0x24')):null);});})['catch'](function(_0x134f12){logger['info'](util[_0x0275('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x0275('0xf')),util[_0x0275('0x2a')](_0x134f12,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index bee6610..0f406d5 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(_0x3ba1e8,_0x571a4d){var _0x184f0c=function(_0x42a38b){while(--_0x42a38b){_0x3ba1e8['push'](_0x3ba1e8['shift']());}};_0x184f0c(++_0x571a4d);}(_0xb10b,0x12a));var _0xbb10=function(_0x56e0e8,_0x16ef91){_0x56e0e8=_0x56e0e8-0x0;var _0x2dab50=_0xb10b[_0x56e0e8];return _0x2dab50;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _0x5f2f=['hasOwnProperty','push','num','Empty','dirname','basename','Setting','find','split','splitSizePdf','then','length','query','format','QueryTypes','SELECT','sequelize','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','landscape','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','%s.%s','createWriteStream','finish','err','end','info','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','lodash','bluebird','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport'];(function(_0x4daf3b,_0x1dbadb){var _0x3cf0db=function(_0x372da7){while(--_0x372da7){_0x4daf3b['push'](_0x4daf3b['shift']());}};_0x3cf0db(++_0x1dbadb);}(_0x5f2f,0x73));var _0xf5f2=function(_0x114220,_0x53f81e){_0x114220=_0x114220-0x0;var _0x2fe9d4=_0x5f2f[_0x114220];return _0x2fe9d4;};'use strict';var _=require(_0xf5f2('0x0'));var fs=require('fs');var BPromise=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var path=require(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var PdfPrinter=require(_0xf5f2('0x5'));var zipdir=require(_0xf5f2('0x6'));var rimraf=require(_0xf5f2('0x7'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf5f2('0x8')];var logger=require(_0xf5f2('0x9'))(_0xf5f2('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xf5f2('0xb')][0x2]);var QUERY=process[_0xf5f2('0xb')][0x3];var PATH=process[_0xf5f2('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xf5f2('0xc');var _extractedReport;function analyticExtractedReport(_0x46cd9c,_0x2ec345){var _0x56a69f={'status':_0x46cd9c};var _0x375da4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ec345){_0x56a69f[_0xf5f2('0xd')]=_0x2ec345;}return db[_0xf5f2('0xe')]['update'](_0x56a69f,_0x375da4);}function getHeader(_0x977a59){var _0x4ebbbe=[];for(var _0x53fb33 in _0x977a59){if(_0x977a59[_0xf5f2('0xf')](_0x53fb33)){_0x4ebbbe[_0xf5f2('0x10')]({'text':_0x53fb33,'style':'tableHeader'});}}return _0x4ebbbe;}function extractReport(_0x336f6b){var _0x14b51f=0x1388;var _0x331482;if(!_0x336f6b[0x0][_0xf5f2('0x11')]){return analyticExtractedReport(_0xf5f2('0x12'));}var _0x3e5956=[];var _0x5c01b8=0x0;var _0x5850f4=!![];var _0xea612c=path[_0xf5f2('0x13')](PATH);var _0x1c1a5c=path[_0xf5f2('0x14')](PATH,'.pdf');var _0xafe430=![];var _0x286197=[];return db[_0xf5f2('0x15')][_0xf5f2('0x16')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf5f2('0x17'),_0xf5f2('0x18')]})[_0xf5f2('0x19')](function(_0x395a5a){if(_0x395a5a){_0x331482=_0x395a5a;_0x14b51f=_0x331482[_0xf5f2('0x18')]||0x3e8;}})[_0xf5f2('0x19')](function(){if(_0x336f6b&&_0x336f6b[_0xf5f2('0x1a')]){var _0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f);if(_0x331482[_0xf5f2('0x17')]){for(;_0x5850f4;_0x5c01b8+=_0x14b51f,_0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f)){if(_0x28e097==0x0||_0x28e097==_0x336f6b[0x0][_0xf5f2('0x11')]){_0x5850f4=![];}_0x3e5956[_0xf5f2('0x10')](dbH['sequelize'][_0xf5f2('0x1b')](util[_0xf5f2('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x14b51f,_0x5c01b8),{'type':dbH['sequelize'][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}else{_0x3e5956['push'](dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](QUERY,{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}_0xafe430=_0x331482['split']&&_0x3e5956[_0xf5f2('0x1a')]>0x1;if(!fs[_0xf5f2('0x20')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c))&&_0xafe430){fs[_0xf5f2('0x22')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c));}return BPromise['each'](_0x3e5956,function(_0x529f07){_0x286197[_0xf5f2('0x10')](_0x529f07);});})[_0xf5f2('0x19')](function(){return BPromise[_0xf5f2('0x23')](_0x3e5956,function(_0x1a5bb3,_0xf6c58d){var _0x788a8d;var _0x13a3be=util[_0xf5f2('0x1c')](_0xf5f2('0x24'),NAME,_extractedReport['name'],moment(_extractedReport[_0xf5f2('0x25')])[_0xf5f2('0x1c')](FORMAT),moment(_extractedReport[_0xf5f2('0x26')])[_0xf5f2('0x1c')](FORMAT));var _0x198c73={'pageSize':'A4','pageOrientation':_0xf5f2('0x27'),'content':[{'text':_0x13a3be,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x22c826={'headerRows':0x1,'body':[]};_0x22c826[_0xf5f2('0x28')][_0xf5f2('0x10')](getHeader(_0x1a5bb3[0x0]));var _0x5027ab;for(var _0x5a2c7e=0x0;_0x5a2c7e<_0x1a5bb3[_0xf5f2('0x1a')];_0x5a2c7e+=0x1){_0x5027ab=[];for(var _0x50b8a2 in _0x1a5bb3[_0x5a2c7e]){if(_0x1a5bb3[_0x5a2c7e][_0xf5f2('0xf')](_0x50b8a2)){_0x5027ab[_0xf5f2('0x10')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]?_[_0xf5f2('0x29')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]):'');}}_0x22c826['body']['push'](_0x5027ab);}_0x198c73[_0xf5f2('0x2a')]['push']({'table':_0x22c826});return new BPromise(function(_0xb744b9,_0x58a4df){var _0x45b643=new PdfPrinter({'Roboto':{'normal':__dirname+_0xf5f2('0x2b'),'bold':__dirname+_0xf5f2('0x2c'),'italics':__dirname+_0xf5f2('0x2d'),'bolditalics':__dirname+_0xf5f2('0x2e')}});var _0x277eee=_0x45b643[_0xf5f2('0x2f')](_0x198c73);if(_0xafe430){_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c,util['format'](_0xf5f2('0x30'),_0x1c1a5c,_0xf6c58d,_0xf5f2('0x31')));}else{_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xf5f2('0x31')));}var _0x297c0c=_0x277eee['pipe'](fs[_0xf5f2('0x33')](_0x788a8d));_0x297c0c['on'](_0xf5f2('0x34'),function(){_0xb744b9();});_0x297c0c['on']('error',function(_0x3fc168){console['log'](_0xf5f2('0x35'),_0x3fc168);_0x58a4df(_0x3fc168);});_0x277eee[_0xf5f2('0x36')]();});});})[_0xf5f2('0x19')](function(){if(_0xafe430){return new BPromise(function(_0x2e3cca,_0x59a6dd){zipdir(path['join'](_0xea612c,_0x1c1a5c),{'saveTo':path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,'zip'))},function(_0x41447f){if(_0x41447f){_0x59a6dd(_0x41447f);}else{_0x2e3cca();}});});}})['then'](function(){if(_0xafe430){rimraf(path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c),function(){});}})['then'](function(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf5f2('0x38')));return analyticExtractedReport(_0xf5f2('0x39'),_0xafe430?util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xafe430?'zip':'pdf'):null);});}function main(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')](_0xf5f2('0x3a'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')));return db[_0xf5f2('0xe')][_0xf5f2('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf5f2('0x19')](function(_0x4c0ac7){_extractedReport=_0x4c0ac7;return dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](util['format'](_0xf5f2('0x3d'),QUERY),{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]});})[_0xf5f2('0x19')](extractReport)[_0xf5f2('0x3e')](function(_0x462ea3){logger[_0xf5f2('0x37')](util['format'](_0xf5f2('0x3f'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')),util[_0xf5f2('0x40')](_0x462ea3,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 865d1bd..2794dae 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 _0xd54b=['path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Empty','length','num','push','query','SELECT','dirname','basename','join','mkdirSync','each','then','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','util'];(function(_0x42b7e2,_0x2a3a0e){var _0x551be4=function(_0x1f86d9){while(--_0x1f86d9){_0x42b7e2['push'](_0x42b7e2['shift']());}};_0x551be4(++_0x2a3a0e);}(_0xd54b,0x1e3));var _0xbd54=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd54b[_0x4b369d];return _0x571a98;};'use strict';var util=require(_0xbd54('0x0'));var path=require(_0xbd54('0x1'));var _=require(_0xbd54('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xbd54('0x3'));var zipdir=require(_0xbd54('0x4'));var rimraf=require(_0xbd54('0x5'));var db=require(_0xbd54('0x6'))['db'];var dbH=require(_0xbd54('0x6'))[_0xbd54('0x7')];var logger=require(_0xbd54('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xbd54('0x9')][0x3];var PATH=process[_0xbd54('0x9')][0x4];function analyticExtractedReport(_0xbccff0,_0x43da89){var _0x3e5d31={'status':_0xbccff0};var _0x58d9d1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x43da89){_0x3e5d31[_0xbd54('0xa')]=_0x43da89;}return db[_0xbd54('0xb')]['update'](_0x3e5d31,_0x58d9d1);}function main(){var _0x3c89fc=0x1388;var _0x37bce9;logger[_0xbd54('0xc')](util[_0xbd54('0xd')](_0xbd54('0xe'),EXTRACTED_REPORT_ID,_0xbd54('0xf')));return db[_0xbd54('0x10')][_0xbd54('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbd54('0x12'),_0xbd54('0x13')]})['then'](function(_0x3a779b){if(_0x3a779b){_0x37bce9=_0x3a779b;_0x3c89fc=_0x37bce9[_0xbd54('0x13')]||0x1388;}})['then'](function(){return dbH[_0xbd54('0x14')]['query'](util[_0xbd54('0xd')](_0xbd54('0x15'),QUERY),{'type':dbH['sequelize'][_0xbd54('0x16')]['SELECT']});})['then'](function(_0x545ab1){if(!_0x545ab1[0x0]['num']){return analyticExtractedReport(_0xbd54('0x17'));}var _0x3101e2=[];var _0x481f3a=0x0;var _0x574215=!![];if(_0x37bce9['split']){if(_0x545ab1&&_0x545ab1[_0xbd54('0x18')]){var _0x48b297=_0x545ab1[0x0]['num']%(_0x481f3a+_0x3c89fc);for(;_0x574215;_0x481f3a+=_0x3c89fc,_0x48b297=_0x545ab1[0x0][_0xbd54('0x19')]%(_0x481f3a+_0x3c89fc)){if(_0x48b297==0x0||_0x48b297==_0x545ab1[0x0]['num']){_0x574215=![];}_0x3101e2[_0xbd54('0x1a')](dbH[_0xbd54('0x14')][_0xbd54('0x1b')](util[_0xbd54('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3c89fc,_0x481f3a),{'type':dbH[_0xbd54('0x14')][_0xbd54('0x16')][_0xbd54('0x1c')]}));}}}else{_0x3101e2[_0xbd54('0x1a')](dbH[_0xbd54('0x14')][_0xbd54('0x1b')](QUERY,{'type':dbH[_0xbd54('0x14')][_0xbd54('0x16')][_0xbd54('0x1c')]}));}var _0x2cb5e5=path[_0xbd54('0x1d')](PATH);var _0x1d97a9=path[_0xbd54('0x1e')](PATH,'.xlsx');var _0x477ee7=_0x37bce9[_0xbd54('0x12')]&&_0x3101e2['length']>0x1;var _0x25c090=[];if(!fs['existsSync'](path[_0xbd54('0x1f')](_0x2cb5e5,_0x1d97a9))&&_0x477ee7){fs[_0xbd54('0x20')](path[_0xbd54('0x1f')](_0x2cb5e5,_0x1d97a9));}return BPromise[_0xbd54('0x21')](_0x3101e2,function(_0x1b4a29){_0x25c090[_0xbd54('0x1a')](_0x1b4a29);})[_0xbd54('0x22')](function(){for(var _0x568a3b=0x0;_0x568a3b<_0x25c090[_0xbd54('0x18')];_0x568a3b+=0x1){var _0x1fd190;var _0x18e85c=_0x25c090[_0x568a3b];if(_0x477ee7){_0x1fd190=path[_0xbd54('0x1f')](_0x2cb5e5,_0x1d97a9,util['format'](_0xbd54('0x23'),_0x1d97a9,_0x568a3b,_0xbd54('0x24')));}else{_0x1fd190=path[_0xbd54('0x1f')](_0x2cb5e5,util[_0xbd54('0xd')](_0xbd54('0x25'),_0x1d97a9,'xlsx'));}fs[_0xbd54('0x26')](_0x1fd190,json2xls(_0x18e85c),_0xbd54('0x27'));}})[_0xbd54('0x22')](function(){if(_0x477ee7){zipdir(path['join'](_0x2cb5e5,_0x1d97a9),{'saveTo':path['join'](_0x2cb5e5,util[_0xbd54('0xd')](_0xbd54('0x25'),_0x1d97a9,_0xbd54('0x28')))},function(_0x33ad37,_0x3f564e){});rimraf(path['join'](_0x2cb5e5,_0x1d97a9),function(){});}})[_0xbd54('0x22')](function(){logger[_0xbd54('0xc')](util[_0xbd54('0xd')](_0xbd54('0x29'),EXTRACTED_REPORT_ID,_0xbd54('0xf')));return analyticExtractedReport('Completed',_0x477ee7?util[_0xbd54('0xd')](_0xbd54('0x25'),_0x1d97a9,_0x477ee7?_0xbd54('0x28'):'xlsx'):null);});})['catch'](function(_0x5b5b16){logger['info'](util[_0xbd54('0xd')](_0xbd54('0x2a'),EXTRACTED_REPORT_ID,_0xbd54('0xf')),util[_0xbd54('0x2b')](_0x5b5b16,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0xaac6=['length','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','json2xls','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty'];(function(_0x2fa92f,_0x24eff3){var _0xeb007d=function(_0x1648ec){while(--_0x1648ec){_0x2fa92f['push'](_0x2fa92f['shift']());}};_0xeb007d(++_0x24eff3);}(_0xaac6,0x11b));var _0x6aac=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xaac6[_0xea8947];return _0x2455e9;};'use strict';var util=require(_0x6aac('0x0'));var path=require(_0x6aac('0x1'));var _=require(_0x6aac('0x2'));var fs=require('fs');var json2xls=require(_0x6aac('0x3'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x6aac('0x4'));var db=require(_0x6aac('0x5'))['db'];var dbH=require(_0x6aac('0x5'))['dbH'];var logger=require(_0x6aac('0x6'))(_0x6aac('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x6aac('0x8')][0x2]);var QUERY=process[_0x6aac('0x8')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x445360,_0x166034){var _0x52080c={'status':_0x445360};var _0x2188a3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x166034){_0x52080c[_0x6aac('0x9')]=_0x166034;}return db[_0x6aac('0xa')][_0x6aac('0xb')](_0x52080c,_0x2188a3);}function main(){var _0x1a4969=0x1388;var _0x266e8a;logger[_0x6aac('0xc')](util[_0x6aac('0xd')](_0x6aac('0xe'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x6aac('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6aac('0x10'),_0x6aac('0x11')]})[_0x6aac('0x12')](function(_0x42757d){if(_0x42757d){_0x266e8a=_0x42757d;_0x1a4969=_0x266e8a[_0x6aac('0x11')]||0x1388;}})['then'](function(){return dbH[_0x6aac('0x13')][_0x6aac('0x14')](util['format'](_0x6aac('0x15'),QUERY),{'type':dbH[_0x6aac('0x13')][_0x6aac('0x16')][_0x6aac('0x17')]});})['then'](function(_0x17eb23){if(!_0x17eb23[0x0]['num']){return analyticExtractedReport(_0x6aac('0x18'));}var _0x1c84b8=[];var _0x1e3363=0x0;var _0x45dfb3=!![];if(_0x266e8a[_0x6aac('0x10')]){if(_0x17eb23&&_0x17eb23[_0x6aac('0x19')]){var _0x4ac44e=_0x17eb23[0x0][_0x6aac('0x1a')]%(_0x1e3363+_0x1a4969);for(;_0x45dfb3;_0x1e3363+=_0x1a4969,_0x4ac44e=_0x17eb23[0x0][_0x6aac('0x1a')]%(_0x1e3363+_0x1a4969)){if(_0x4ac44e==0x0||_0x4ac44e==_0x17eb23[0x0][_0x6aac('0x1a')]){_0x45dfb3=![];}_0x1c84b8[_0x6aac('0x1b')](dbH[_0x6aac('0x13')][_0x6aac('0x14')](util[_0x6aac('0xd')](_0x6aac('0x1c'),QUERY,_0x1a4969,_0x1e3363),{'type':dbH[_0x6aac('0x13')][_0x6aac('0x16')][_0x6aac('0x17')]}));}}}else{_0x1c84b8[_0x6aac('0x1b')](dbH[_0x6aac('0x13')][_0x6aac('0x14')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x6aac('0x17')]}));}var _0x3d6694=path[_0x6aac('0x1d')](PATH);var _0x249a77=path['basename'](PATH,'.xlsx');var _0x3e5780=_0x266e8a['split']&&_0x1c84b8[_0x6aac('0x19')]>0x1;var _0x2b3615=[];if(!fs[_0x6aac('0x1e')](path[_0x6aac('0x1f')](_0x3d6694,_0x249a77))&&_0x3e5780){fs[_0x6aac('0x20')](path[_0x6aac('0x1f')](_0x3d6694,_0x249a77));}return BPromise[_0x6aac('0x21')](_0x1c84b8,function(_0x5450c6){_0x2b3615[_0x6aac('0x1b')](_0x5450c6);})[_0x6aac('0x12')](function(){for(var _0x1a7025=0x0;_0x1a7025<_0x2b3615[_0x6aac('0x19')];_0x1a7025+=0x1){var _0x250470;var _0x2ae916=_0x2b3615[_0x1a7025];if(_0x3e5780){_0x250470=path[_0x6aac('0x1f')](_0x3d6694,_0x249a77,util[_0x6aac('0xd')](_0x6aac('0x22'),_0x249a77,_0x1a7025,_0x6aac('0x23')));}else{_0x250470=path[_0x6aac('0x1f')](_0x3d6694,util[_0x6aac('0xd')]('%s.%s',_0x249a77,_0x6aac('0x23')));}fs[_0x6aac('0x24')](_0x250470,json2xls(_0x2ae916),'binary');}})[_0x6aac('0x12')](function(){if(_0x3e5780){zipdir(path[_0x6aac('0x1f')](_0x3d6694,_0x249a77),{'saveTo':path[_0x6aac('0x1f')](_0x3d6694,util[_0x6aac('0xd')](_0x6aac('0x25'),_0x249a77,'zip'))},function(_0x23f915,_0x4251bc){});rimraf(path[_0x6aac('0x1f')](_0x3d6694,_0x249a77),function(){});}})[_0x6aac('0x12')](function(){logger[_0x6aac('0xc')](util[_0x6aac('0xd')](_0x6aac('0x26'),EXTRACTED_REPORT_ID,_0x6aac('0x27')));return analyticExtractedReport(_0x6aac('0x28'),_0x3e5780?util[_0x6aac('0xd')](_0x6aac('0x25'),_0x249a77,_0x3e5780?'zip':_0x6aac('0x23')):null);});})['catch'](function(_0x5e98b0){logger[_0x6aac('0xc')](util[_0x6aac('0xd')](_0x6aac('0x29'),EXTRACTED_REPORT_ID,_0x6aac('0x27')),util[_0x6aac('0x2a')](_0x5e98b0,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x6aac('0x2b'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 7e31c1c..3654fe2 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 _0x97c1=['createdAt','updatedAt','interval','*,*,*,*','tag','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','transaction','models','VoiceExtension','destroy','catch','error','rewrite','lodash','util','Interval','findAll','then','intervals','IntervalId','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','hasOwnProperty','priority','extensions','extension','push','type','Set','format','CDR(type)=%s','context','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','VoiceExtensionId','CDR(routeid)=','):Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase'];(function(_0xfe3459,_0x39a977){var _0x218eb4=function(_0x5d584e){while(--_0x5d584e){_0xfe3459['push'](_0xfe3459['shift']());}};_0x218eb4(++_0x39a977);}(_0x97c1,0xdf));var _0x197c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x97c1[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));function rewrite(_0x55b95a,_0x5e2e81){var _0x498f9c=this;return _0x55b95a['models'][_0x197c('0x2')][_0x197c('0x3')]({'raw':!![]})[_0x197c('0x4')](function(_0x37ac05){_0x498f9c[_0x197c('0x5')]=_0x37ac05;return _0x55b95a['models']['VoiceExtension'][_0x197c('0x3')]({'where':{'IntervalId':_0x5e2e81[_0x197c('0x6')]},'raw':!![]});})[_0x197c('0x4')](function(_0xfcee35){return _0x55b95a['models']['VoiceExtension'][_0x197c('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0x197c('0x7')](_0xfcee35,_0x197c('0x8')))}},'order':[{'raw':_0x197c('0x9')}],'raw':!![]});})[_0x197c('0x4')](function(_0x49cd61){var _0x46fb80=_[_0x197c('0xa')](_0x49cd61,{'priority':'1'});var _0x1e9300=_[_0x197c('0xa')](_0x49cd61,{'isApp':0x1});var _0x455f34=_['groupBy'](_0x1e9300,_0x197c('0x8'));var _0x668f8=[_0x197c('0xb'),_0x197c('0xc')];var _0x567658=[];var _0x10c4db=[];for(var _0x1cccd6 in _0x455f34){if(_0x455f34[_0x197c('0xd')](_0x1cccd6)){_0x498f9c[_0x197c('0xe')]=0x2;_0x498f9c[_0x197c('0xf')]=[];_0x498f9c[_0x197c('0x10')]=_['find'](_0x46fb80,{'exten':_0x455f34[_0x1cccd6][0x0]['exten']});_0x498f9c[_0x197c('0xf')][_0x197c('0x11')]({'type':_0x455f34[_0x1cccd6][0x0][_0x197c('0x12')],'app':_0x197c('0x13'),'appdata':util[_0x197c('0x14')](_0x197c('0x15'),_0x455f34[_0x1cccd6][0x0][_0x197c('0x12')]),'context':_0x455f34[_0x1cccd6][0x0][_0x197c('0x16')],'exten':_0x455f34[_0x1cccd6][0x0]['exten'],'priority':_0x498f9c[_0x197c('0xe')]++,'VoiceExtensionId':_0x455f34[_0x1cccd6][0x0]['VoiceExtensionId']});if(_0x455f34[_0x1cccd6][0x0]['type']===_0x197c('0x17')){if(_0x498f9c[_0x197c('0x10')]){_0x498f9c[_0x197c('0xf')][_0x197c('0x11')]({'type':_0x455f34[_0x1cccd6][0x0]['type'],'app':_0x197c('0x13'),'appdata':_0x197c('0x18')+(_0x498f9c[_0x197c('0x10')]['cutdigits']?_0x197c('0x19')+_0x498f9c[_0x197c('0x10')][_0x197c('0x1a')]+'}':_0x197c('0x1b')),'context':_0x455f34[_0x1cccd6][0x0][_0x197c('0x16')],'exten':_0x455f34[_0x1cccd6][0x0][_0x197c('0x8')],'priority':_0x498f9c[_0x197c('0xe')]++,'VoiceExtensionId':_0x455f34[_0x1cccd6][0x0][_0x197c('0x1c')]});}_0x498f9c[_0x197c('0xf')][_0x197c('0x11')]({'type':_0x455f34[_0x1cccd6][0x0][_0x197c('0x12')],'app':_0x197c('0x13'),'appdata':_0x197c('0x1d')+_0x455f34[_0x1cccd6][0x0][_0x197c('0x1c')],'context':_0x455f34[_0x1cccd6][0x0][_0x197c('0x16')],'exten':_0x455f34[_0x1cccd6][0x0][_0x197c('0x8')],'priority':_0x498f9c['priority']++,'VoiceExtensionId':_0x455f34[_0x1cccd6][0x0][_0x197c('0x1c')]});var _0x2911dd=_0x498f9c[_0x197c('0xe')]++;_0x498f9c['extensions'][_0x197c('0x11')]({'type':_0x455f34[_0x1cccd6][0x0][_0x197c('0x12')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x2911dd+0x2)+_0x197c('0x1e')+(_0x2911dd+0x1)+')','context':_0x455f34[_0x1cccd6][0x0]['context'],'exten':_0x455f34[_0x1cccd6][0x0][_0x197c('0x8')],'priority':_0x2911dd,'VoiceExtensionId':_0x455f34[_0x1cccd6][0x0][_0x197c('0x1c')]});if(_0x498f9c[_0x197c('0x10')]){_0x498f9c[_0x197c('0xf')][_0x197c('0x11')]({'type':_0x455f34[_0x1cccd6][0x0][_0x197c('0x12')],'app':_0x197c('0x13'),'appdata':_0x498f9c[_0x197c('0x10')][_0x197c('0x1a')]?'CDR(prefix)=${EXTEN:0:'+_0x498f9c['extension']['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x455f34[_0x1cccd6][0x0][_0x197c('0x16')],'exten':_0x455f34[_0x1cccd6][0x0]['exten'],'priority':_0x498f9c[_0x197c('0xe')]++,'VoiceExtensionId':_0x455f34[_0x1cccd6][0x0][_0x197c('0x1c')]});}_0x498f9c['extensions'][_0x197c('0x11')]({'type':_0x455f34[_0x1cccd6][0x0]['type'],'app':_0x197c('0x13'),'appdata':_0x197c('0x1f')+_0x455f34[_0x1cccd6][0x0][_0x197c('0x1c')],'context':_0x455f34[_0x1cccd6][0x0][_0x197c('0x16')],'exten':_0x455f34[_0x1cccd6][0x0][_0x197c('0x8')],'priority':_0x498f9c[_0x197c('0xe')]++,'VoiceExtensionId':_0x455f34[_0x1cccd6][0x0][_0x197c('0x1c')]});if(_0x498f9c[_0x197c('0x10')]&&_0x498f9c[_0x197c('0x10')]['hasOwnProperty']('recordingFormat')&&_0x498f9c[_0x197c('0x10')][_0x197c('0x20')]!==_0x197c('0x21')){_0x498f9c[_0x197c('0xf')][_0x197c('0x11')]({'type':_0x455f34[_0x1cccd6][0x0][_0x197c('0x12')],'app':_0x197c('0x13'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x455f34[_0x1cccd6][0x0]['context'],'exten':_0x455f34[_0x1cccd6][0x0][_0x197c('0x8')],'priority':_0x498f9c[_0x197c('0xe')]++,'VoiceExtensionId':_0x455f34[_0x1cccd6][0x0]['VoiceExtensionId']});_0x498f9c['extensions'][_0x197c('0x11')]({'type':_0x455f34[_0x1cccd6][0x0][_0x197c('0x12')],'app':_0x197c('0x13'),'appdata':_0x197c('0x22')+_0x498f9c[_0x197c('0x10')][_0x197c('0x20')]||_0x197c('0x23'),'context':_0x455f34[_0x1cccd6][0x0][_0x197c('0x16')],'exten':_0x455f34[_0x1cccd6][0x0][_0x197c('0x8')],'priority':_0x498f9c['priority']++,'VoiceExtensionId':_0x455f34[_0x1cccd6][0x0][_0x197c('0x1c')]});}}_0x498f9c[_0x197c('0xf')][_0x197c('0x11')]({'type':_0x455f34[_0x1cccd6][0x0][_0x197c('0x12')],'app':_0x197c('0x13'),'appdata':_0x197c('0x24'),'context':_0x455f34[_0x1cccd6][0x0]['context'],'exten':_0x455f34[_0x1cccd6][0x0][_0x197c('0x8')],'priority':_0x498f9c[_0x197c('0xe')]++,'VoiceExtensionId':_0x455f34[_0x1cccd6][0x0][_0x197c('0x1c')]});_0x498f9c['extensions'][_0x197c('0x11')]({'type':_0x455f34[_0x1cccd6][0x0][_0x197c('0x12')],'app':_0x197c('0x13'),'appdata':_0x197c('0x25'),'context':_0x455f34[_0x1cccd6][0x0][_0x197c('0x16')],'exten':_0x455f34[_0x1cccd6][0x0][_0x197c('0x8')],'priority':_0x498f9c[_0x197c('0xe')]++,'VoiceExtensionId':_0x455f34[_0x1cccd6][0x0][_0x197c('0x1c')]});_0x498f9c[_0x197c('0xf')][_0x197c('0x11')]({'type':_0x455f34[_0x1cccd6][0x0]['type'],'app':_0x197c('0x13'),'appdata':_0x197c('0x26'),'context':_0x455f34[_0x1cccd6][0x0]['context'],'exten':_0x455f34[_0x1cccd6][0x0]['exten'],'priority':_0x498f9c[_0x197c('0xe')]++,'VoiceExtensionId':_0x455f34[_0x1cccd6][0x0][_0x197c('0x1c')]});for(var _0x3517a6=0x0,_0x28f172=0x0;_0x3517a6<_0x455f34[_0x1cccd6][_0x197c('0x27')];_0x3517a6+=0x1,_0x28f172=0x0){var _0x5eb80c=_0x455f34[_0x1cccd6][_0x3517a6];if(_0x5eb80c[_0x197c('0x12')]){_0x5eb80c[_0x197c('0x12')]=_0x5eb80c[_0x197c('0x12')][_0x197c('0x28')]();}var _0x12277c=[];var _0x4b6901=[];delete _0x5eb80c['id'];delete _0x5eb80c[_0x197c('0x29')];delete _0x5eb80c[_0x197c('0x2a')];var _0x6d7bda=_0x5eb80c[_0x197c('0x2b')]!==_0x197c('0x2c')?[_0x5eb80c['interval']]:_0x5eb80c[_0x197c('0x6')]?_[_0x197c('0x7')](_[_0x197c('0xa')](_0x498f9c[_0x197c('0x5')],{'IntervalId':_0x5eb80c[_0x197c('0x6')]}),_0x197c('0x2b')):[];if(_0x5eb80c[_0x197c('0xd')](_0x197c('0x2d'))){if(_0x5eb80c[_0x197c('0x2d')]&&_0x5eb80c[_0x197c('0x2d')]!=='--'){_0x12277c[_0x197c('0x11')]({'type':_0x5eb80c['type'],'app':'Set','appdata':'CDR(tag)='+_0x5eb80c['tag'],'context':_0x5eb80c[_0x197c('0x16')],'exten':_0x5eb80c[_0x197c('0x8')],'priority':_0x6d7bda['length']+_0x498f9c[_0x197c('0xe')]+_0x28f172++,'VoiceExtensionId':_0x5eb80c[_0x197c('0x1c')]});}}if(_0x5eb80c['type']===_0x197c('0x17')&&_0x5eb80c[_0x197c('0xd')]('callerID')){if(_0x5eb80c[_0x197c('0x2e')]){_0x12277c[_0x197c('0x11')]({'type':_0x5eb80c['type'],'app':_0x197c('0x2f'),'appdata':_0x197c('0x30')+_0x5eb80c[_0x197c('0x2e')]+')','context':_0x5eb80c['context'],'exten':_0x5eb80c[_0x197c('0x8')],'priority':_0x6d7bda[_0x197c('0x27')]+_0x498f9c[_0x197c('0xe')]+_0x28f172++,'VoiceExtensionId':_0x5eb80c[_0x197c('0x1c')]});}else{_0x12277c['push']({'type':_0x5eb80c[_0x197c('0x12')],'app':_0x197c('0x2f'),'appdata':_0x197c('0x31'),'context':_0x5eb80c['context'],'exten':_0x5eb80c['exten'],'priority':_0x6d7bda[_0x197c('0x27')]+_0x498f9c[_0x197c('0xe')]+_0x28f172++,'VoiceExtensionId':_0x5eb80c[_0x197c('0x1c')]});}}if(_0x5eb80c[_0x197c('0xd')](_0x197c('0x32'))){if(_0x668f8[_0x197c('0x33')](_0x5eb80c['app'][_0x197c('0x28')]())>=0x0&&_0x5eb80c['appType']!==_0x197c('0x34')){if(_0x5eb80c[_0x197c('0x32')]){_0x12277c[_0x197c('0x11')]({'type':_0x5eb80c[_0x197c('0x12')],'app':_0x197c('0x2f'),'appdata':_0x197c('0x35'),'context':_0x5eb80c[_0x197c('0x16')],'exten':_0x5eb80c[_0x197c('0x8')],'priority':_0x6d7bda['length']+_0x498f9c[_0x197c('0xe')]+_0x28f172++,'VoiceExtensionId':_0x5eb80c[_0x197c('0x1c')]});_0x12277c[_0x197c('0x11')]({'type':_0x5eb80c['type'],'app':_0x197c('0x13'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x5eb80c[_0x197c('0x16')],'exten':_0x5eb80c[_0x197c('0x8')],'priority':_0x6d7bda[_0x197c('0x27')]+_0x498f9c[_0x197c('0xe')]+_0x28f172++,'VoiceExtensionId':_0x5eb80c[_0x197c('0x1c')]});}else{_0x12277c[_0x197c('0x11')]({'type':_0x5eb80c[_0x197c('0x12')],'app':_0x197c('0x2f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x5eb80c[_0x197c('0x16')],'exten':_0x5eb80c[_0x197c('0x8')],'priority':_0x6d7bda[_0x197c('0x27')]+_0x498f9c['priority']+_0x28f172++,'VoiceExtensionId':_0x5eb80c[_0x197c('0x1c')]});_0x12277c[_0x197c('0x11')]({'type':_0x5eb80c[_0x197c('0x12')],'app':_0x197c('0x13'),'appdata':_0x197c('0x36'),'context':_0x5eb80c['context'],'exten':_0x5eb80c['exten'],'priority':_0x6d7bda[_0x197c('0x27')]+_0x498f9c[_0x197c('0xe')]+_0x28f172++,'VoiceExtensionId':_0x5eb80c[_0x197c('0x1c')]});}}}for(var _0x42a13f=0x0;_0x42a13f<_0x6d7bda[_0x197c('0x27')];_0x42a13f+=0x1){var _0x501ab3=_0x498f9c['priority']+_0x6d7bda[_0x197c('0x27')];var _0x2974a5=_0x42a13f===_0x6d7bda['length']-0x1?_0x498f9c[_0x197c('0xe')]+_0x12277c[_0x197c('0x27')]+_0x4b6901[_0x197c('0x27')]+0x2:_0x498f9c[_0x197c('0xe')]+_0x42a13f+0x1;_0x12277c[_0x197c('0x37')](_0x42a13f,0x0,{'type':_0x5eb80c[_0x197c('0x12')],'app':'GotoIfTime','appdata':_0x6d7bda[_0x42a13f]+'?'+_0x5eb80c[_0x197c('0x16')]+_0x197c('0x38')+_0x501ab3+':'+_0x5eb80c['context']+',${EXTEN},'+_0x2974a5,'exten':_0x5eb80c[_0x197c('0x8')],'context':_0x5eb80c['context'],'priority':_0x498f9c[_0x197c('0xe')]+_0x42a13f,'VoiceExtensionId':_0x455f34[_0x1cccd6][0x0][_0x197c('0x1c')]});}_0x5eb80c[_0x197c('0xe')]=_0x12277c['length']?_[_0x197c('0x39')](_0x12277c)[_0x197c('0xe')]+0x1:_0x498f9c['priority'];_0x498f9c[_0x197c('0xe')]=(_0x4b6901[_0x197c('0x27')]?_[_0x197c('0x39')](_0x4b6901)['priority']:_0x5eb80c[_0x197c('0xe')])+0x1;_0x498f9c[_0x197c('0xf')]=_['concat'](_0x498f9c['extensions'],_0x12277c,[_0x5eb80c],_0x4b6901);}_0x498f9c[_0x197c('0xf')][_0x197c('0x11')]({'type':_0x455f34[_0x1cccd6][0x0][_0x197c('0x12')],'app':'Hangup','exten':_0x455f34[_0x1cccd6][0x0][_0x197c('0x8')],'context':_0x455f34[_0x1cccd6][0x0][_0x197c('0x16')],'priority':_0x498f9c[_0x197c('0xe')],'VoiceExtensionId':_0x455f34[_0x1cccd6][0x0]['VoiceExtensionId']});_0x567658[_0x197c('0x11')](_0x455f34[_0x1cccd6][0x0][_0x197c('0x1c')]);_0x10c4db=_[_0x197c('0x3a')](_0x10c4db,_0x498f9c[_0x197c('0xf')]);}}return _0x55b95a[_0x197c('0x3b')](function(_0x27a734){return _0x55b95a[_0x197c('0x3c')][_0x197c('0x3d')][_0x197c('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x567658}},'transaction':_0x27a734})[_0x197c('0x4')](function(_0x5ef485){return _0x55b95a[_0x197c('0x3c')]['VoiceExtension']['bulkCreate'](_['sortBy'](_0x10c4db,'priority'),{'transaction':_0x27a734});});});})[_0x197c('0x3f')](function(_0x30bb6d){console[_0x197c('0x40')](_0x30bb6d);});}exports[_0x197c('0x41')]=rewrite; \ No newline at end of file +var _0xeb32=['type','CDR(type)=%s','context','VoiceExtensionId','outbound','extension','Set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','toLowerCase','createdAt','interval','*,*,*,*','IntervalId','tag','length','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)','indexOf','appType','custom','answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','catch','lodash','util','findAll','then','intervals','VoiceExtension','models','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','hasOwnProperty','priority','extensions','find','push'];(function(_0x1afa22,_0x45ca05){var _0x15e935=function(_0x345332){while(--_0x345332){_0x1afa22['push'](_0x1afa22['shift']());}};_0x15e935(++_0x45ca05);}(_0xeb32,0x169));var _0x2eb3=function(_0x1e19f6,_0x319b58){_0x1e19f6=_0x1e19f6-0x0;var _0x59b933=_0xeb32[_0x1e19f6];return _0x59b933;};'use strict';var _=require(_0x2eb3('0x0'));var util=require(_0x2eb3('0x1'));function rewrite(_0x11452c,_0x5d0eb8){var _0x25ba9d=this;return _0x11452c['models']['Interval'][_0x2eb3('0x2')]({'raw':!![]})[_0x2eb3('0x3')](function(_0x5857c3){_0x25ba9d[_0x2eb3('0x4')]=_0x5857c3;return _0x11452c['models'][_0x2eb3('0x5')][_0x2eb3('0x2')]({'where':{'IntervalId':_0x5d0eb8['IntervalId']},'raw':!![]});})[_0x2eb3('0x3')](function(_0x4371cf){return _0x11452c[_0x2eb3('0x6')][_0x2eb3('0x5')]['findAll']({'where':{'exten':{'$in':_[_0x2eb3('0x7')](_['map'](_0x4371cf,_0x2eb3('0x8')))}},'order':[{'raw':_0x2eb3('0x9')}],'raw':!![]});})[_0x2eb3('0x3')](function(_0x3add74){var _0x2f35d2=_[_0x2eb3('0xa')](_0x3add74,{'priority':'1'});var _0x14d2c3=_[_0x2eb3('0xa')](_0x3add74,{'isApp':0x1});var _0x46875b=_[_0x2eb3('0xb')](_0x14d2c3,'exten');var _0x396eae=['queue','playback'];var _0x592748=[];var _0x46b1ba=[];for(var _0x41bc1a in _0x46875b){if(_0x46875b[_0x2eb3('0xc')](_0x41bc1a)){_0x25ba9d[_0x2eb3('0xd')]=0x2;_0x25ba9d[_0x2eb3('0xe')]=[];_0x25ba9d['extension']=_[_0x2eb3('0xf')](_0x2f35d2,{'exten':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x8')]});_0x25ba9d[_0x2eb3('0xe')][_0x2eb3('0x10')]({'type':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x11')],'app':'Set','appdata':util['format'](_0x2eb3('0x12'),_0x46875b[_0x41bc1a][0x0]['type']),'context':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x13')],'exten':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x8')],'priority':_0x25ba9d[_0x2eb3('0xd')]++,'VoiceExtensionId':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x14')]});if(_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x11')]===_0x2eb3('0x15')){if(_0x25ba9d[_0x2eb3('0x16')]){_0x25ba9d['extensions'][_0x2eb3('0x10')]({'type':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x11')],'app':_0x2eb3('0x17'),'appdata':_0x2eb3('0x18')+(_0x25ba9d[_0x2eb3('0x16')][_0x2eb3('0x19')]?_0x2eb3('0x1a')+_0x25ba9d[_0x2eb3('0x16')]['cutdigits']+'}':_0x2eb3('0x1b')),'context':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x13')],'exten':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x8')],'priority':_0x25ba9d[_0x2eb3('0xd')]++,'VoiceExtensionId':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x14')]});}_0x25ba9d['extensions'][_0x2eb3('0x10')]({'type':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x11')],'app':'Set','appdata':_0x2eb3('0x1c')+_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x14')],'context':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x13')],'exten':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x8')],'priority':_0x25ba9d[_0x2eb3('0xd')]++,'VoiceExtensionId':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x14')]});var _0x45f1b4=_0x25ba9d[_0x2eb3('0xd')]++;_0x25ba9d[_0x2eb3('0xe')][_0x2eb3('0x10')]({'type':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x11')],'app':_0x2eb3('0x1d'),'appdata':_0x2eb3('0x1e')+(_0x45f1b4+0x2)+_0x2eb3('0x1f')+(_0x45f1b4+0x1)+')','context':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x13')],'exten':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x8')],'priority':_0x45f1b4,'VoiceExtensionId':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x14')]});if(_0x25ba9d[_0x2eb3('0x16')]){_0x25ba9d['extensions'][_0x2eb3('0x10')]({'type':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x11')],'app':'Set','appdata':_0x25ba9d['extension']['cutdigits']?_0x2eb3('0x20')+_0x25ba9d[_0x2eb3('0x16')][_0x2eb3('0x19')]+'}':_0x2eb3('0x21'),'context':_0x46875b[_0x41bc1a][0x0]['context'],'exten':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x8')],'priority':_0x25ba9d[_0x2eb3('0xd')]++,'VoiceExtensionId':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x14')]});}_0x25ba9d['extensions']['push']({'type':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x11')],'app':_0x2eb3('0x17'),'appdata':_0x2eb3('0x22')+_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x14')],'context':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x13')],'exten':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x8')],'priority':_0x25ba9d[_0x2eb3('0xd')]++,'VoiceExtensionId':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x14')]});if(_0x25ba9d[_0x2eb3('0x16')]&&_0x25ba9d[_0x2eb3('0x16')][_0x2eb3('0xc')](_0x2eb3('0x23'))&&_0x25ba9d[_0x2eb3('0x16')]['recordingFormat']!=='none'){_0x25ba9d[_0x2eb3('0xe')][_0x2eb3('0x10')]({'type':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x11')],'app':_0x2eb3('0x17'),'appdata':_0x2eb3('0x24'),'context':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x13')],'exten':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x8')],'priority':_0x25ba9d[_0x2eb3('0xd')]++,'VoiceExtensionId':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x14')]});_0x25ba9d[_0x2eb3('0xe')][_0x2eb3('0x10')]({'type':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x11')],'app':_0x2eb3('0x17'),'appdata':_0x2eb3('0x25')+_0x25ba9d[_0x2eb3('0x16')][_0x2eb3('0x23')]||'wav','context':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x13')],'exten':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x8')],'priority':_0x25ba9d[_0x2eb3('0xd')]++,'VoiceExtensionId':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x14')]});}}_0x25ba9d['extensions'][_0x2eb3('0x10')]({'type':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x11')],'app':_0x2eb3('0x17'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x46875b[_0x41bc1a][0x0]['context'],'exten':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x8')],'priority':_0x25ba9d[_0x2eb3('0xd')]++,'VoiceExtensionId':_0x46875b[_0x41bc1a][0x0]['VoiceExtensionId']});_0x25ba9d[_0x2eb3('0xe')][_0x2eb3('0x10')]({'type':_0x46875b[_0x41bc1a][0x0]['type'],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x46875b[_0x41bc1a][0x0]['context'],'exten':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x8')],'priority':_0x25ba9d[_0x2eb3('0xd')]++,'VoiceExtensionId':_0x46875b[_0x41bc1a][0x0]['VoiceExtensionId']});_0x25ba9d[_0x2eb3('0xe')][_0x2eb3('0x10')]({'type':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x11')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x13')],'exten':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x8')],'priority':_0x25ba9d[_0x2eb3('0xd')]++,'VoiceExtensionId':_0x46875b[_0x41bc1a][0x0]['VoiceExtensionId']});for(var _0x47bc9=0x0,_0x5efd83=0x0;_0x47bc9<_0x46875b[_0x41bc1a]['length'];_0x47bc9+=0x1,_0x5efd83=0x0){var _0x194e72=_0x46875b[_0x41bc1a][_0x47bc9];if(_0x194e72[_0x2eb3('0x11')]){_0x194e72[_0x2eb3('0x11')]=_0x194e72[_0x2eb3('0x11')][_0x2eb3('0x26')]();}var _0x3188dd=[];var _0x5e479c=[];delete _0x194e72['id'];delete _0x194e72[_0x2eb3('0x27')];delete _0x194e72['updatedAt'];var _0xe83983=_0x194e72[_0x2eb3('0x28')]!==_0x2eb3('0x29')?[_0x194e72[_0x2eb3('0x28')]]:_0x194e72[_0x2eb3('0x2a')]?_['map'](_[_0x2eb3('0xa')](_0x25ba9d[_0x2eb3('0x4')],{'IntervalId':_0x194e72[_0x2eb3('0x2a')]}),'interval'):[];if(_0x194e72[_0x2eb3('0xc')]('tag')){if(_0x194e72[_0x2eb3('0x2b')]&&_0x194e72['tag']!=='--'){_0x3188dd[_0x2eb3('0x10')]({'type':_0x194e72['type'],'app':'Set','appdata':'CDR(tag)='+_0x194e72[_0x2eb3('0x2b')],'context':_0x194e72['context'],'exten':_0x194e72[_0x2eb3('0x8')],'priority':_0xe83983[_0x2eb3('0x2c')]+_0x25ba9d['priority']+_0x5efd83++,'VoiceExtensionId':_0x194e72['VoiceExtensionId']});}}if(_0x194e72[_0x2eb3('0x11')]===_0x2eb3('0x15')&&_0x194e72[_0x2eb3('0xc')]('callerID')){if(_0x194e72[_0x2eb3('0x2d')]){_0x3188dd[_0x2eb3('0x10')]({'type':_0x194e72[_0x2eb3('0x11')],'app':'ExecIf','appdata':_0x2eb3('0x2e')+_0x194e72['callerID']+')','context':_0x194e72[_0x2eb3('0x13')],'exten':_0x194e72[_0x2eb3('0x8')],'priority':_0xe83983[_0x2eb3('0x2c')]+_0x25ba9d[_0x2eb3('0xd')]+_0x5efd83++,'VoiceExtensionId':_0x194e72[_0x2eb3('0x14')]});}else{_0x3188dd[_0x2eb3('0x10')]({'type':_0x194e72[_0x2eb3('0x11')],'app':'ExecIf','appdata':_0x2eb3('0x2f'),'context':_0x194e72['context'],'exten':_0x194e72['exten'],'priority':_0xe83983[_0x2eb3('0x2c')]+_0x25ba9d[_0x2eb3('0xd')]+_0x5efd83++,'VoiceExtensionId':_0x194e72['VoiceExtensionId']});}}if(_0x194e72[_0x2eb3('0xc')]('answer')){if(_0x396eae[_0x2eb3('0x30')](_0x194e72['app'][_0x2eb3('0x26')]())>=0x0&&_0x194e72[_0x2eb3('0x31')]!==_0x2eb3('0x32')){if(_0x194e72[_0x2eb3('0x33')]){_0x3188dd[_0x2eb3('0x10')]({'type':_0x194e72[_0x2eb3('0x11')],'app':_0x2eb3('0x1d'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x194e72[_0x2eb3('0x13')],'exten':_0x194e72['exten'],'priority':_0xe83983['length']+_0x25ba9d['priority']+_0x5efd83++,'VoiceExtensionId':_0x194e72['VoiceExtensionId']});_0x3188dd[_0x2eb3('0x10')]({'type':_0x194e72[_0x2eb3('0x11')],'app':_0x2eb3('0x17'),'appdata':_0x2eb3('0x34'),'context':_0x194e72[_0x2eb3('0x13')],'exten':_0x194e72['exten'],'priority':_0xe83983[_0x2eb3('0x2c')]+_0x25ba9d[_0x2eb3('0xd')]+_0x5efd83++,'VoiceExtensionId':_0x194e72[_0x2eb3('0x14')]});}else{_0x3188dd[_0x2eb3('0x10')]({'type':_0x194e72[_0x2eb3('0x11')],'app':_0x2eb3('0x1d'),'appdata':_0x2eb3('0x35'),'context':_0x194e72['context'],'exten':_0x194e72[_0x2eb3('0x8')],'priority':_0xe83983[_0x2eb3('0x2c')]+_0x25ba9d[_0x2eb3('0xd')]+_0x5efd83++,'VoiceExtensionId':_0x194e72[_0x2eb3('0x14')]});_0x3188dd['push']({'type':_0x194e72['type'],'app':_0x2eb3('0x17'),'appdata':_0x2eb3('0x36'),'context':_0x194e72[_0x2eb3('0x13')],'exten':_0x194e72[_0x2eb3('0x8')],'priority':_0xe83983[_0x2eb3('0x2c')]+_0x25ba9d[_0x2eb3('0xd')]+_0x5efd83++,'VoiceExtensionId':_0x194e72[_0x2eb3('0x14')]});}}}for(var _0x22d24e=0x0;_0x22d24e<_0xe83983[_0x2eb3('0x2c')];_0x22d24e+=0x1){var _0x9cae5f=_0x25ba9d[_0x2eb3('0xd')]+_0xe83983[_0x2eb3('0x2c')];var _0x54a4b9=_0x22d24e===_0xe83983['length']-0x1?_0x25ba9d[_0x2eb3('0xd')]+_0x3188dd[_0x2eb3('0x2c')]+_0x5e479c[_0x2eb3('0x2c')]+0x2:_0x25ba9d[_0x2eb3('0xd')]+_0x22d24e+0x1;_0x3188dd[_0x2eb3('0x37')](_0x22d24e,0x0,{'type':_0x194e72['type'],'app':'GotoIfTime','appdata':_0xe83983[_0x22d24e]+'?'+_0x194e72['context']+',${EXTEN},'+_0x9cae5f+':'+_0x194e72[_0x2eb3('0x13')]+_0x2eb3('0x38')+_0x54a4b9,'exten':_0x194e72[_0x2eb3('0x8')],'context':_0x194e72[_0x2eb3('0x13')],'priority':_0x25ba9d[_0x2eb3('0xd')]+_0x22d24e,'VoiceExtensionId':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x14')]});}_0x194e72['priority']=_0x3188dd[_0x2eb3('0x2c')]?_['last'](_0x3188dd)[_0x2eb3('0xd')]+0x1:_0x25ba9d[_0x2eb3('0xd')];_0x25ba9d[_0x2eb3('0xd')]=(_0x5e479c[_0x2eb3('0x2c')]?_[_0x2eb3('0x39')](_0x5e479c)[_0x2eb3('0xd')]:_0x194e72[_0x2eb3('0xd')])+0x1;_0x25ba9d[_0x2eb3('0xe')]=_[_0x2eb3('0x3a')](_0x25ba9d[_0x2eb3('0xe')],_0x3188dd,[_0x194e72],_0x5e479c);}_0x25ba9d['extensions'][_0x2eb3('0x10')]({'type':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x11')],'app':_0x2eb3('0x3b'),'exten':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x8')],'context':_0x46875b[_0x41bc1a][0x0][_0x2eb3('0x13')],'priority':_0x25ba9d['priority'],'VoiceExtensionId':_0x46875b[_0x41bc1a][0x0]['VoiceExtensionId']});_0x592748['push'](_0x46875b[_0x41bc1a][0x0]['VoiceExtensionId']);_0x46b1ba=_['concat'](_0x46b1ba,_0x25ba9d[_0x2eb3('0xe')]);}}return _0x11452c[_0x2eb3('0x3c')](function(_0x5e8594){return _0x11452c['models'][_0x2eb3('0x5')][_0x2eb3('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x592748}},'transaction':_0x5e8594})[_0x2eb3('0x3')](function(_0x2107f2){return _0x11452c['models'][_0x2eb3('0x5')]['bulkCreate'](_['sortBy'](_0x46b1ba,_0x2eb3('0xd')),{'transaction':_0x5e8594});});});})[_0x2eb3('0x3e')](function(_0x2e41e1){console['error'](_0x2e41e1);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 981fbed..12705d8 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 _0xcb91=['generalCheckHopper','Error\x20processing\x20rows\x20block:','resolve','emit','contact:csv_','unlinkSync','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','email','ListId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','phone','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','\x20=\x20?','into','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','all','VoiceQueue','BlackLists','get','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s'];(function(_0x5ba602,_0x4c8c05){var _0x2e319c=function(_0x5e8edb){while(--_0x5e8edb){_0x5ba602['push'](_0x5ba602['shift']());}};_0x2e319c(++_0x4c8c05);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x46a3e8,_0x2e1b35){_0x46a3e8=_0x46a3e8-0x0;var _0xf1442e=_0xcb91[_0x46a3e8];return _0xf1442e;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x1cb9('0x0'));var fs=require('fs');var squel=require(_0x1cb9('0x1'));var Papa=require(_0x1cb9('0x2'));var Redis=require(_0x1cb9('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('api');config[_0x1cb9('0x6')]=_[_0x1cb9('0x7')](config['redis'],{'host':_0x1cb9('0x8'),'port':0x18eb});var socket=require(_0x1cb9('0x9'))(new Redis(config['redis']));require(_0x1cb9('0xa'))[_0x1cb9('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x1cb9('0xc')][0x2]==='undefined'||process['argv'][0x2]===_0x1cb9('0xd')){throw new Error(_0x1cb9('0xe'));}var FILEPATH=process[_0x1cb9('0xc')][0x2];if(!process[_0x1cb9('0xc')][0x3]||process[_0x1cb9('0xc')][0x3]==='undefined'||process[_0x1cb9('0xc')][0x3]===_0x1cb9('0xd')||!process[_0x1cb9('0xc')][0x4]||process[_0x1cb9('0xc')][0x4]===_0x1cb9('0xf')||process['argv'][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x1cb9('0x10')](process[_0x1cb9('0xc')][0x3][_0x1cb9('0x11')](','),process[_0x1cb9('0xc')][0x4]['split'](','));if(!process[_0x1cb9('0xc')][0x5]||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x1cb9('0xc')][0x6]&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xf')&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x6]:null;var DUPLICATES=process[_0x1cb9('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x1cb9('0xc')][0x7]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x7]:null;if(!process[_0x1cb9('0xc')][0x8]||process[_0x1cb9('0xc')][0x8]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x1cb9('0xc')][0x8];}catch(_0x5dbfae){logger[_0x1cb9('0x12')](_0x5dbfae);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(_0x2265ea,_0x523b26,_0x599275,_0x2e3854){var _0x325637={'message':_0x523b26};_0x325637[_0x2265ea]=!![];if(_0x599275){_0x325637[_0x1cb9('0x13')]=_0x599275;}if(_0x2e3854){_0x325637[_0x1cb9('0x14')]=_0x2e3854;}return _0x325637;}function isEmail(_0x45b8d3){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))*$/[_0x1cb9('0x15')](_0x45b8d3);}function checkRow(_0x59ebea,_0x55b232,_0x6c6f61){return new BPromise(function(_0x557199,_0x10a419){if(_[_0x1cb9('0x16')](_0x59ebea)){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x1cb9('0x17'),null,_0x6c6f61));}if(_0x59ebea[_0x1cb9('0x18')]&&_0x59ebea['errors'][_0x1cb9('0x19')]){var _0x9df250=_['map'](_0x59ebea[_0x1cb9('0x18')],_0x1cb9('0x1a'))[_0x1cb9('0x1b')](';');return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x9df250,null,_0x6c6f61));}var _0x406821={};for(var _0x21d6f5 in FIELDS){if(FIELDS[_0x1cb9('0x1c')](_0x21d6f5)&&FIELDS[_0x21d6f5]){_0x406821[_0x21d6f5]=_0x59ebea[_0x1cb9('0x1d')][0x0][FIELDS[_0x21d6f5]]||_0x59ebea[_0x1cb9('0x1d')][0x0]['\ufeff'+FIELDS[_0x21d6f5]];}}if(!_0x406821[_0x1cb9('0x1e')]){return _0x10a419(handleCheckRowError('error',_0x1cb9('0x1f'),null,_0x6c6f61));}if(!_0x406821['phone']){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'phone\x20not\x20specified!',null,_0x6c6f61));}if(_0x406821[_0x1cb9('0x20')]){var _0x41011c=moment(_0x406821[_0x1cb9('0x20')],_0x1cb9('0x21'));if(!_0x41011c['isValid']()){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x6c6f61));}}if(_0x406821[_0x1cb9('0x22')]){if(!isEmail(_0x406821[_0x1cb9('0x22')])){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x6c6f61));}}_0x406821[_0x1cb9('0x23')]=LISTID;_0x406821['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){var _0x58f4f5={};for(var _0x2164e3=0x0,_0x42a688=DUPLICATES[_0x1cb9('0x19')];_0x2164e3<_0x42a688;_0x2164e3+=0x1){_0x58f4f5[DUPLICATES[_0x2164e3]]=_0x406821[DUPLICATES[_0x2164e3]];}var _0xae910=_['find'](_0x55b232,_0x58f4f5);if(_0xae910){return _0x10a419(handleCheckRowError(_0x1cb9('0x24'),_0x1cb9('0x25'),_0xae910,_0x6c6f61));}}return db[_0x1cb9('0x26')][_0x1cb9('0x27')](_0x406821,{'raw':!![],'hooks':![],'fields':_[_0x1cb9('0x28')](_0x406821)})[_0x1cb9('0x29')](function(_0xc6d5fd){if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){_0x55b232[_0x1cb9('0x2a')](_[_0x1cb9('0x2b')](_0x406821,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xc6d5fd['id'];return _0x557199();})[_0x1cb9('0x2c')](function(_0x26b950){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x26b950['message']||JSON[_0x1cb9('0x2d')](_0x26b950)),null,_0x6c6f61));});});}function checkHopper(){function _0x30f7e4(){return function(_0x91c937){logger[_0x1cb9('0x12')](_0x1cb9('0x2e'),_0x1cb9('0x2f'),util[_0x1cb9('0x30')](_0x91c937,{'showHidden':![],'depth':null}));};}var _0x3f5637=function(_0x4d3e39,_0x2aa59b){var _0x1482c4=squel[_0x1cb9('0x31')]()['into'](_0x1cb9('0x32'))['fromQuery']([_0x1cb9('0x33'),'scheduledAt',_0x1cb9('0x34'),_0x1cb9('0x23'),_0x2aa59b,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),'phone')['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x4d3e39['id'][_0x1cb9('0x3b')](),_0x2aa59b)['field']('NOW()','createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))['where'](_0x1cb9('0x3e'))['where'](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x1cb9('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone')['from'](_0x1cb9('0x32'))[_0x1cb9('0x40')](_0x2aa59b+_0x1cb9('0x41'),_0x4d3e39['id'][_0x1cb9('0x3b')]())))[_0x1cb9('0x3b')]();return _0x1482c4;};var _0x58832e=function(_0x11d877,_0x5594fc){var _0x4c59e7=squel['insert']()[_0x1cb9('0x42')](_0x1cb9('0x32'))[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x5594fc,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone',_0x1cb9('0x33'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'scheduledAt')[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x11d877['id'][_0x1cb9('0x3b')](),_0x5594fc)['field'](_0x1cb9('0x39'),'createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')]('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x47'))[_0x1cb9('0x3c')](_0x1cb9('0x48'))[_0x1cb9('0x40')](_0x5594fc+_0x1cb9('0x41'),_0x11d877['id'][_0x1cb9('0x3b')]()))[_0x1cb9('0x40')](_0x1cb9('0x49'),squel['select']()[_0x1cb9('0x38')]('phone')[_0x1cb9('0x3c')]('cm_hopper')[_0x1cb9('0x40')](_0x5594fc+'\x20=\x20?',_0x11d877['id']['toString']())))[_0x1cb9('0x3b')]();return _0x4c59e7;};function _0x3b0c2e(_0x303da3,_0x4bce54){var _0x3c157f=squel[_0x1cb9('0x31')]()['into']('cm_hopper')[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x4bce54,_0x1cb9('0x35'),_0x1cb9('0x36')],squel['select']()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),'ListId')[_0x1cb9('0x38')](_0x303da3['id'][_0x1cb9('0x3b')](),_0x4bce54)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))[_0x1cb9('0x40')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46')))[_0x1cb9('0x3b')]();return _0x3c157f;}function _0x173db5(_0x3c2f9c,_0x75c734){var _0xc515a6=squel[_0x1cb9('0x31')]()['into']('cm_hopper_black')[_0x1cb9('0x43')](['phone','ContactId','ListId',_0x75c734,'createdAt','updatedAt'],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))['field'](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x3c2f9c['id']['toString'](),_0x75c734)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'updatedAt')['from']('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())['where'](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1cb9('0x3b')]();return _0xc515a6;}return db['VoiceQueue'][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x4aeeff){var _0xde0d93=[];if(_0x4aeeff){var _0x15fc04;for(var _0x330fc1=0x0,_0x17c361;_0x330fc1<_0x4aeeff['length'];_0x330fc1+=0x1){_0x17c361=_0x4aeeff[_0x330fc1]['get']({'plain':!![]});switch(_0x17c361[_0x1cb9('0x4c')]){case _0x1cb9('0x4f'):_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x17c361,_0x1cb9('0x52')))['then'](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;case'onlyIfOpen':_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')]['query'](_0x3f5637(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0xde0d93['push'](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}}return _0xde0d93;})[_0x1cb9('0x53')]()['then'](function(){return db[_0x1cb9('0x54')][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x128a41){var _0x37bcd9=[];if(_0x128a41){var _0x4cd544;for(var _0x28bac2=0x0,_0x78e9c;_0x28bac2<_0x128a41['length'];_0x28bac2+=0x1){_0x78e9c=_0x128a41[_0x28bac2][_0x1cb9('0x56')]({'plain':!![]});_0x37bcd9['push'](db[_0x1cb9('0x50')]['query'](_0x173db5(_0x78e9c,'VoiceQueueId'))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x37bcd9;})['all']();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x45ca54){var _0x3d25a3=[];if(_0x45ca54){for(var _0x2a157d=0x0,_0x27cc3c;_0x2a157d<_0x45ca54[_0x1cb9('0x19')];_0x2a157d+=0x1){_0x27cc3c=_0x45ca54[_0x2a157d][_0x1cb9('0x56')]({'plain':!![]});switch(_0x27cc3c['dialCheckDuplicateType']){case _0x1cb9('0x4f'):_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));break;case _0x1cb9('0x58'):_0x3d25a3[_0x1cb9('0x2a')](db['sequelize'][_0x1cb9('0x51')](_0x3f5637(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x27cc3c,'CampaignId'))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));}}}return _0x3d25a3;})[_0x1cb9('0x53')]();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x56f23d){var _0x113367=[];if(_0x56f23d){for(var _0x39b0cb=0x0,_0x429371;_0x39b0cb<_0x56f23d['length'];_0x39b0cb+=0x1){_0x429371=_0x56f23d[_0x39b0cb][_0x1cb9('0x56')]({'plain':!![]});_0x113367[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x173db5(_0x429371,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x113367;})['all']();})[_0x1cb9('0x2c')](function(_0x4b15a4){logger[_0x1cb9('0x12')](_0x1cb9('0x59'),_0x1cb9('0x5a'),_0x4b15a4[_0x1cb9('0x1a')]);});}var processPromises=function(_0x4bdbd2){return BPromise[_0x1cb9('0x53')](promises)[_0x1cb9('0x29')](function(_0x5e68a1){})[_0x1cb9('0x2c')](function(_0x416508){logger[_0x1cb9('0x12')](_0x1cb9('0x5b'),JSON[_0x1cb9('0x2d')](_0x416508));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4bdbd2){return _0x4bdbd2['resume']();}});};var endCsv=function(){return BPromise[_0x1cb9('0x5c')]()[_0x1cb9('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0x1cb9('0x29')](function(){socket[_0x1cb9('0x5d')](_0x1cb9('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1cb9('0x5f')](FILEPATH);}catch(_0x1e6402){logger[_0x1cb9('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x1cb9('0x2d')](_0x1e6402));}finally{process[_0x1cb9('0x60')](0x0);}});};process['on'](_0x1cb9('0x61'),function(){logger['info'](_0x1cb9('0x62'));endCsv();});function main(){return BPromise[_0x1cb9('0x5c')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1cb9('0x11')](',');return db[_0x1cb9('0x26')][_0x1cb9('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1cb9('0x29')](function(_0x5cb5e5){var _0x2c0416=fs[_0x1cb9('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2c0416,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5bd78d,_0x1f2d69){total+=0x1;var _0x3ba0a5=total;promises['push'](checkRow(_0x5bd78d,_0x5cb5e5,_0x3ba0a5)['then'](function(){success+=0x1;})[_0x1cb9('0x2c')](function(_0x3486e5){if(_0x3486e5['error']){errors+=0x1;delete _0x3486e5['error'];}else if(_0x3486e5[_0x1cb9('0x24')]){duplicates+=0x1;delete _0x3486e5['duplicate'];}rows['push'](_0x3486e5);}));if(total%0xc8===0x0){_0x1f2d69['pause']();return processPromises(_0x1f2d69);}},'complete':function(){return processPromises()[_0x1cb9('0x29')](function(){logger['info'](_0x1cb9('0x64'));endCsv();});},'error':function(_0x3c717b,_0x33ec43){logger['info'](_0x1cb9('0x65'),JSON[_0x1cb9('0x2d')](_0x3c717b));endCsv();}});})[_0x1cb9('0x2c')](function(_0x4c54b5){logger[_0x1cb9('0x12')](_0x1cb9('0x66'),JSON[_0x1cb9('0x2d')](_0x4c54b5));});}main(); \ No newline at end of file +var _0xa9e0=['CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','emit','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','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!','ListId','CompanyId','find','duplicate'];(function(_0x125dda,_0x43cb2e){var _0x222aba=function(_0xaa2e3e){while(--_0xaa2e3e){_0x125dda['push'](_0x125dda['shift']());}};_0x222aba(++_0x43cb2e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0a9e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var socket=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x0a9e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0a9e('0xb')][0x2]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xd'));}var FILEPATH=process[_0x0a9e('0xb')][0x2];if(!process[_0x0a9e('0xb')][0x3]||process[_0x0a9e('0xb')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xf'));}var FIELDS=_[_0x0a9e('0x10')](process['argv'][0x3][_0x0a9e('0x11')](','),process[_0x0a9e('0xb')][0x4][_0x0a9e('0x11')](','));if(!process[_0x0a9e('0xb')][0x5]||process[_0x0a9e('0xb')][0x5]===_0x0a9e('0xe')||process['argv'][0x5]===_0x0a9e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0a9e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x0a9e('0xb')][0x6]!==_0x0a9e('0xe')&&process['argv'][0x6]!==_0x0a9e('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x0a9e('0xb')][0x7]&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xe')&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xc')?process[_0x0a9e('0xb')][0x7]:null;if(!process[_0x0a9e('0xb')][0x8]||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2c3407){logger[_0x0a9e('0x13')](_0x2c3407);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(_0x53682f,_0x20f109,_0x5a09ef,_0x588269){var _0x3a02e1={'message':_0x20f109};_0x3a02e1[_0x53682f]=!![];if(_0x5a09ef){_0x3a02e1[_0x0a9e('0x14')]=_0x5a09ef;}if(_0x588269){_0x3a02e1[_0x0a9e('0x15')]=_0x588269;}return _0x3a02e1;}function isEmail(_0x30bae6){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'](_0x30bae6);}function checkRow(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return new BPromise(function(_0x4d00e6,_0x370d86){if(_[_0x0a9e('0x16')](_0xfb6e48)){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b45bc));}if(_0xfb6e48['errors']&&_0xfb6e48[_0x0a9e('0x17')][_0x0a9e('0x18')]){var _0x40c424=_[_0x0a9e('0x19')](_0xfb6e48['errors'],_0x0a9e('0x1a'))['join'](';');return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x40c424,null,_0x3b45bc));}var _0x5bfb33={};for(var _0x1dc186 in FIELDS){if(FIELDS[_0x0a9e('0x1b')](_0x1dc186)&&FIELDS[_0x1dc186]){_0x5bfb33[_0x1dc186]=_0xfb6e48[_0x0a9e('0x1c')][0x0][FIELDS[_0x1dc186]]||_0xfb6e48[_0x0a9e('0x1c')][0x0]['\ufeff'+FIELDS[_0x1dc186]];}}if(!_0x5bfb33[_0x0a9e('0x1d')]){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x1e'),null,_0x3b45bc));}if(!_0x5bfb33[_0x0a9e('0x1f')]){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x20'),null,_0x3b45bc));}if(_0x5bfb33[_0x0a9e('0x21')]){var _0x2b1f27=moment(_0x5bfb33[_0x0a9e('0x21')],'YYYY-MM-DD');if(!_0x2b1f27[_0x0a9e('0x22')]()){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x23'),null,_0x3b45bc));}}if(_0x5bfb33[_0x0a9e('0x24')]){if(!isEmail(_0x5bfb33[_0x0a9e('0x24')])){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x25'),null,_0x3b45bc));}}_0x5bfb33[_0x0a9e('0x26')]=LISTID;_0x5bfb33[_0x0a9e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2fb0e4){var _0x426950={};for(var _0x5d1e0e=0x0,_0x2407f9=DUPLICATES[_0x0a9e('0x18')];_0x5d1e0e<_0x2407f9;_0x5d1e0e+=0x1){_0x426950[DUPLICATES[_0x5d1e0e]]=_0x5bfb33[DUPLICATES[_0x5d1e0e]];}var _0x1122db=_[_0x0a9e('0x28')](_0x2fb0e4,_0x426950);if(_0x1122db){return _0x370d86(handleCheckRowError(_0x0a9e('0x29'),'Duplicate\x20Contact',_0x1122db,_0x3b45bc));}}return db[_0x0a9e('0x2a')][_0x0a9e('0x2b')](_0x5bfb33,{'raw':!![],'hooks':![],'fields':_[_0x0a9e('0x2c')](_0x5bfb33)})[_0x0a9e('0x2d')](function(_0x2b45ea){if(DUPLICATES&&DUPLICATES[_0x0a9e('0x18')]&&_0x2fb0e4){_0x2fb0e4[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x5bfb33,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b45ea['id'];return _0x4d00e6();})['catch'](function(_0x44295a){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x30')+(_0x44295a[_0x0a9e('0x1a')]||JSON[_0x0a9e('0x31')](_0x44295a)),null,_0x3b45bc));});});}function checkHopper(){function _0x3f3d41(){return function(_0x567193){logger[_0x0a9e('0x13')](_0x0a9e('0x32'),_0x0a9e('0x33'),util[_0x0a9e('0x34')](_0x567193,{'showHidden':![],'depth':null}));};}var _0x4853b1=function(_0x54135e,_0x1e8694){var _0x5640eb=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')](['phone',_0x0a9e('0x39'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x1e8694,'createdAt',_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')]('phone','phone')[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),'ListId')['field'](_0x54135e['id'][_0x0a9e('0x3f')](),_0x1e8694)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')](_0x0a9e('0x46'))[_0x0a9e('0x43')](_0x0a9e('0x47'),squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')['where'](_0x1e8694+_0x0a9e('0x48'),_0x54135e['id'][_0x0a9e('0x3f')]())))[_0x0a9e('0x3f')]();return _0x5640eb;};var _0x315881=function(_0x1a69dd,_0xc9a702){var _0x10b040=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),'scheduledAt',_0x0a9e('0x3a'),_0x0a9e('0x26'),_0xc9a702,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x1a69dd['id'][_0x0a9e('0x3f')](),_0xc9a702)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x3b'))[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')]('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x4a'))[_0x0a9e('0x41')](_0x0a9e('0x4b'))[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id'][_0x0a9e('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id']['toString']())))['toString']();return _0x10b040;};function _0x2ef381(_0x59c6ff,_0x443e72){var _0x4c3845=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))['fromQuery']([_0x0a9e('0x1f'),_0x0a9e('0x39'),'ContactId','ListId',_0x443e72,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')]('phone',_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')['field']('id','ContactId')[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x59c6ff['id'][_0x0a9e('0x3f')](),_0x443e72)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID['toString']())[_0x0a9e('0x43')](_0x0a9e('0x4c'),squel['str'](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x3f')]();return _0x4c3845;}function _0x5ba1f9(_0x4b3c1a,_0x5674ee){var _0x273cb5=squel['insert']()[_0x0a9e('0x36')](_0x0a9e('0x4d'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x5674ee,'createdAt',_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field']('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),_0x0a9e('0x26'))['field'](_0x4b3c1a['id'][_0x0a9e('0x3f')](),_0x5674ee)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x3b'))[_0x0a9e('0x41')]('cm_contacts')[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')]('ListId\x20=\x20?',LISTID[_0x0a9e('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')](_0x0a9e('0x46')))[_0x0a9e('0x3f')]();return _0x273cb5;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'where':{'type':_0x0a9e('0x50')},'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x53'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x19012b){var _0x2bbb86=[];if(_0x19012b){var _0x2b8192;for(var _0x320898=0x0,_0x412a72;_0x320898<_0x19012b[_0x0a9e('0x18')];_0x320898+=0x1){_0x412a72=_0x19012b[_0x320898][_0x0a9e('0x54')]({'plain':!![]});switch(_0x412a72['dialCheckDuplicateType']){case _0x0a9e('0x55'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x315881(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x4853b1(_0x412a72,_0x0a9e('0x57')))['then'](function(){})['catch'](_0x3f3d41()));break;default:_0x2bbb86['push'](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x2ef381(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}}return _0x2bbb86;})[_0x0a9e('0x5b')]()[_0x0a9e('0x2d')](function(){return db[_0x0a9e('0x4e')]['findAll']({'where':{'type':_0x0a9e('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2bdc44){var _0x583b2e=[];if(_0x2bdc44){var _0x4437ff;for(var _0x44351d=0x0,_0x4c46c1;_0x44351d<_0x2bdc44[_0x0a9e('0x18')];_0x44351d+=0x1){_0x4c46c1=_0x2bdc44[_0x44351d][_0x0a9e('0x54')]({'plain':!![]});_0x583b2e[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x5ba1f9(_0x4c46c1,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x583b2e;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x3511c9){var _0x30a4c7=[];if(_0x3511c9){for(var _0xf410e5=0x0,_0x332367;_0xf410e5<_0x3511c9[_0x0a9e('0x18')];_0xf410e5+=0x1){_0x332367=_0x3511c9[_0xf410e5][_0x0a9e('0x54')]({'plain':!![]});switch(_0x332367[_0x0a9e('0x51')]){case _0x0a9e('0x55'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x315881(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x4853b1(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));break;default:_0x30a4c7[_0x0a9e('0x2e')](db['sequelize']['query'](_0x2ef381(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));}}}return _0x30a4c7;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x2d2286){var _0x42b959=[];if(_0x2d2286){for(var _0x3755fe=0x0,_0x1f42a0;_0x3755fe<_0x2d2286[_0x0a9e('0x18')];_0x3755fe+=0x1){_0x1f42a0=_0x2d2286[_0x3755fe]['get']({'plain':!![]});_0x42b959[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x5ba1f9(_0x1f42a0,_0x0a9e('0x5e')))['then'](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x42b959;})[_0x0a9e('0x5b')]();})['catch'](function(_0x1d6834){logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x1d6834[_0x0a9e('0x1a')]);});}var processPromises=function(_0x385d52){return BPromise['all'](promises)['then'](function(_0x353384){})[_0x0a9e('0x5a')](function(_0x94dcf5){logger['error'](_0x0a9e('0x61'),JSON[_0x0a9e('0x31')](_0x94dcf5));})['finally'](function(){socket['emit'](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385d52){return _0x385d52['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0a9e('0x2d')](function(){socket[_0x0a9e('0x63')](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a9e('0x64')](FILEPATH);}catch(_0x3c6dd6){logger[_0x0a9e('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0a9e('0x31')](_0x3c6dd6));}finally{process['exit'](0x0);}});};process['on'](_0x0a9e('0x65'),function(){logger[_0x0a9e('0x66')](_0x0a9e('0x67'));endCsv();});function main(){return BPromise[_0x0a9e('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a9e('0x11')](',');return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb6e411){var _0x21e592=fs[_0x0a9e('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a9e('0x6a')](_0x21e592,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255e49,_0x1910bf){total+=0x1;var _0x32b9bd=total;promises[_0x0a9e('0x2e')](checkRow(_0x255e49,_0xb6e411,_0x32b9bd)['then'](function(){success+=0x1;})[_0x0a9e('0x5a')](function(_0x3325c5){if(_0x3325c5['error']){errors+=0x1;delete _0x3325c5[_0x0a9e('0x13')];}else if(_0x3325c5[_0x0a9e('0x29')]){duplicates+=0x1;delete _0x3325c5[_0x0a9e('0x29')];}rows['push'](_0x3325c5);}));if(total%0xc8===0x0){_0x1910bf[_0x0a9e('0x6b')]();return processPromises(_0x1910bf);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0a9e('0x66')](_0x0a9e('0x6c'));endCsv();});},'error':function(_0x558a87,_0x1f29bd){logger[_0x0a9e('0x66')](_0x0a9e('0x6d'),JSON[_0x0a9e('0x31')](_0x558a87));endCsv();}});})[_0x0a9e('0x5a')](function(_0x501050){logger[_0x0a9e('0x13')](_0x0a9e('0x6e'),JSON[_0x0a9e('0x31')](_0x501050));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 34f6aaf..e6c3000 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 _0xf013=['ContactId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','where','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.id','cm_contacts.ListId','ListId','.id\x20=\x20','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','toString','concat','keys','CompanyId','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','errors','push','code','sequelize','spread','main','stringify','send','start','socket_timestamp','root','server/files/tmp','header','writeFileSync','createReadStream','length','rows','data','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','agent\x20not\x20exists','email','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','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',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','each','then','finish','affectedRows','unlink','exit','catch','complete','argv','file\x20doesn\x27t\x20exists','parse','binding','body\x20id\x20mandatory','No\x20agent\x20available','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0xf013,0xe1));var _0x3f01=function(_0x14be37,_0x5bc316){_0x14be37=_0x14be37-0x0;var _0x1696d1=_0xf013[_0x14be37];return _0x1696d1;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x3f01('0x0'));var Papa=require(_0x3f01('0x1'));var util=require(_0x3f01('0x2'));var BPromise=require(_0x3f01('0x3'));var moment=require(_0x3f01('0x4'));var squel=require(_0x3f01('0x5'));var Redis=require(_0x3f01('0x6'));var db=require(_0x3f01('0x7'))['db'];var config=require(_0x3f01('0x8'));var logger=require(_0x3f01('0x9'))(_0x3f01('0xa'));config[_0x3f01('0xb')]=_['defaults'](config[_0x3f01('0xb')],{'host':_0x3f01('0xc'),'port':0x18eb});var socket=require(_0x3f01('0xd'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x3f01('0xe')](_0x3f01('0xf'));function isEmail(_0x8ff706){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'](_0x8ff706);}function selectNotIn(_0x613664,_0x301e4d,_0x47050e,_0x4b8c06,_0x2c82ef){return squel[_0x3f01('0x10')]()[_0x3f01('0x11')](_0x3f01('0x12'))[_0x3f01('0x13')](_0x4b8c06)['join'](_0x301e4d,null,_0x301e4d+'.id\x20=\x20'+_0x4b8c06+'.'+_0x47050e)['where'](_0x4b8c06+'.'+_0x47050e+'\x20=\x20'+_0x613664+'.'+_0x47050e)['where'](_0x301e4d+'.dialCheckDuplicateType\x20IN\x20('+_0x2c82ef[_0x3f01('0x14')]()+')');}function insertCmHopper(_0x28ee14,_0x2a2667,_0x76793,_0x507870,_0x356c40){var _0x40cd31=[_0x3f01('0x15'),_0x3f01('0x16'),'cm_contacts.id','cm_contacts.ListId',_0x2a2667+'.'+_0x507870,_0x3f01('0x17'),_0x3f01('0x18'),'cm_contacts.priority',_0x3f01('0x19'),'\x22'+_0x356c40+'\x22'];return squel[_0x3f01('0x1a')]()[_0x3f01('0x1b')](_0x3f01('0x1c'))[_0x3f01('0x1d')]([_0x3f01('0x12'),_0x3f01('0x1e'),_0x3f01('0x1f'),'ListId',_0x507870,_0x3f01('0x20'),_0x3f01('0x21'),_0x3f01('0x22'),_0x3f01('0x23'),_0x3f01('0x24')],squel[_0x3f01('0x10')]()[_0x3f01('0x25')](_0x40cd31)[_0x3f01('0x13')](_0x2a2667)['join'](_0x3f01('0x26'),null,_0x3f01('0x27')+_0x2a2667+_0x3f01('0x28'))['join'](_0x76793,null,_0x76793+'.id\x20=\x20'+_0x2a2667+'.'+_0x507870)['where'](_0x2a2667+'.CmListId\x20=\x20?',_0x28ee14)[_0x3f01('0x29')](_0x3f01('0x2a'),NOW)['where'](_0x3f01('0x2b'),selectNotIn(_0x2a2667,_0x76793,_0x507870,_0x3f01('0x1c'),[_0x3f01('0x2c'),_0x3f01('0x2d')]))[_0x3f01('0x29')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2a2667,_0x76793,_0x507870,_0x3f01('0x1c'),[_0x3f01('0x2c')])))['toString']();}function insertCmHopperBlack(_0x4cc98e,_0xc326eb,_0x532b6f,_0x3d4ef5){var _0x730fa2=[_0x3f01('0x15'),_0x3f01('0x2e'),_0x3f01('0x2f'),_0xc326eb+'.'+_0x3d4ef5,'cm_contacts.createdAt',_0x3f01('0x18')];return squel[_0x3f01('0x1a')]()[_0x3f01('0x1b')]('cm_hopper_black')[_0x3f01('0x1d')]([_0x3f01('0x12'),'ContactId',_0x3f01('0x30'),_0x3d4ef5,_0x3f01('0x20'),_0x3f01('0x21')],squel['select']()[_0x3f01('0x25')](_0x730fa2)[_0x3f01('0x13')](_0xc326eb)[_0x3f01('0x14')](_0x3f01('0x26'),null,_0x3f01('0x27')+_0xc326eb+_0x3f01('0x28'))['join'](_0x532b6f,null,_0x532b6f+_0x3f01('0x31')+_0xc326eb+'.'+_0x3d4ef5)[_0x3f01('0x29')](_0xc326eb+'.CmListId\x20=\x20?',_0x4cc98e)[_0x3f01('0x29')](_0x3f01('0x2a'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x3f01('0x10')]()[_0x3f01('0x11')](_0x3f01('0x12'))['from'](_0x3f01('0x32'))['where'](_0x3f01('0x33'),_0x4cc98e)[_0x3f01('0x29')](_0x3d4ef5+_0x3f01('0x34'),_0xc326eb+'.'+_0x3d4ef5)))[_0x3f01('0x35')]();}function insertCmContact(_0x886f2a,_0x4492e0,_0x79366f,_0x5e80b7){var _0x12c2e3=_[_0x3f01('0x36')](_[_0x3f01('0x37')](_0x5e80b7),['ListId',_0x3f01('0x38'),_0x3f01('0x20'),_0x3f01('0x21')]);return squel[_0x3f01('0x1a')]()[_0x3f01('0x1b')](_0x3f01('0x26'))[_0x3f01('0x1d')](_0x12c2e3,squel[_0x3f01('0x10')]()[_0x3f01('0x25')](_0x12c2e3)[_0x3f01('0x13')](_0x4492e0)[_0x3f01('0x29')]('('+_0x79366f['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x3f01('0x10')]()['fields'](_0x79366f)[_0x3f01('0x13')]('cm_contacts')[_0x3f01('0x29')]('ListId\x20=\x20?',_0x886f2a)[_0x3f01('0x29')]('deletedAt\x20IS\x20NULL'))[_0x3f01('0x29')](_0x3f01('0x39'),squel[_0x3f01('0x10')]()[_0x3f01('0x11')](_0x3f01('0x3a'),_0x3f01('0x3b'))['from'](_0x4492e0)[_0x3f01('0x3c')](_0x79366f[_0x3f01('0x14')](','))))[_0x3f01('0x35')]();}function handleStop(){logger[_0x3f01('0x3d')](_0x3f01('0x3e'));stopped=!![];}function handleUncaughtException(_0x2160d7){logger[_0x3f01('0x3f')](_0x2160d7[_0x3f01('0x40')]);process['exit'](0x1);}function handleError(_0x1d705f,_0x535ed5){stats[_0x3f01('0x41')][_0x3f01('0x42')]({'name':_0x535ed5[_0x3f01('0x43')],'message':_0x535ed5[_0x3f01('0x40')],'row':_0x1d705f});}function handleQuery(_0x52372d){logger[_0x3f01('0x3d')](_0x52372d);return db[_0x3f01('0x44')]['query'](_0x52372d)[_0x3f01('0x45')](function(_0x301c9e){results[_0x3f01('0x42')](_0x301c9e);})['catch'](function(_0x2b580a){logger[_0x3f01('0x3f')](_0x2b580a[_0x3f01('0x40')]);});}function main(_0x154f6b,_0x391fd6,_0x55d438,_0x5c98b0){logger[_0x3f01('0x3d')](_0x3f01('0x46'),_0x154f6b,JSON[_0x3f01('0x47')](_0x391fd6));process[_0x3f01('0x48')](_0x3f01('0x49'));var _0x55f23f=_0x391fd6['binding'];var _0x570e8d=_0x391fd6[_0x3f01('0x4a')];var _0x14dd65=path[_0x3f01('0x14')](config[_0x3f01('0x4b')],_0x3f01('0x4c'),_0x570e8d+'.csv');var _0x4f1414=_['keys'](_0x55f23f)[_0x3f01('0x14')]();logger[_0x3f01('0x3d')](_0x3f01('0x4d'),_0x4f1414);fs[_0x3f01('0x4e')](_0x14dd65,_0x4f1414+'\x0a');Papa['parse'](fs[_0x3f01('0x4f')](_0x154f6b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3b0e75,_0x5b464e){try{for(var _0x242679=0x0,_0x2a3ec2=[];_0x242679<_0x3b0e75['data'][_0x3f01('0x50')];_0x242679++){stats[_0x3f01('0x51')]+=0x1;if(_0x3b0e75[_0x3f01('0x41')][_0x242679]){handleError(_0x3b0e75[_0x3f01('0x52')][_0x242679],_0x3b0e75['errors'][_0x242679]);}else{var _0x81307e=[];for(var _0xd3abbf in _0x55f23f){if(_0x55f23f['hasOwnProperty'](_0xd3abbf)){if(_0x3b0e75[_0x3f01('0x52')][_0x242679][_0x55f23f[_0xd3abbf]]){var _0x5ac4a5=_[_0x3f01('0x53')](_0x3b0e75[_0x3f01('0x52')][_0x242679][_0x55f23f[_0xd3abbf]]['replace'](/"/g,'\x27'));switch(_0xd3abbf){case _0x3f01('0x1e'):var _0x18267e=moment(_0x5ac4a5,_0x3f01('0xf'),!![]);if(_0x18267e[_0x3f01('0x54')]()){_0x2a3ec2['push']('\x22'+_0x5ac4a5+'\x22');}else{_0x81307e[_0x3f01('0x42')](_0x3f01('0x55'));}break;case _0x3f01('0x22'):var _0x14d512=parseInt(_0x5ac4a5);_0x5ac4a5=_['isNaN'](_0x14d512)||_0x14d512<0x0||_0x14d512>0x4?_0x5c98b0?0x3:0x2:_0x14d512;_0x2a3ec2['push']('\x22'+_0x5ac4a5+'\x22');break;case _0x3f01('0x23'):var _0x2b70df=parseInt(_0x5ac4a5);if(_[_0x3f01('0x56')](_0x2b70df)&&_[_0x3f01('0x57')](_0x55d438,_0x2b70df)){_0x2a3ec2[_0x3f01('0x42')]('\x22'+_0x2b70df+'\x22');}else{_0x81307e[_0x3f01('0x42')](_0x3f01('0x58'));}break;case _0x3f01('0x59'):if(isEmail(_0x5ac4a5)){_0x2a3ec2[_0x3f01('0x42')]('\x22'+_0x5ac4a5+'\x22');}else{_0x81307e['push']('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x2f5708=moment(_0x5ac4a5,_0x3f01('0x5a'),!![]);if(_0x2f5708[_0x3f01('0x54')]()){_0x2a3ec2[_0x3f01('0x42')]('\x22'+_0x5ac4a5+'\x22');}else{_0x81307e[_0x3f01('0x42')](_0x3f01('0x5b'));}break;default:_0x2a3ec2[_0x3f01('0x42')]('\x22'+_0x5ac4a5+'\x22');}}else{switch(_0xd3abbf){case _0x3f01('0x5c'):case _0x3f01('0x12'):_0x81307e[_0x3f01('0x42')](_0xd3abbf+_0x3f01('0x5d'));break;default:_0x2a3ec2[_0x3f01('0x42')]('\x22\x22');}}}}if(_0x81307e[_0x3f01('0x50')]){handleError(_0x3b0e75[_0x3f01('0x52')][_0x242679],{'code':_0x3f01('0x5e'),'message':_0x81307e['join']()});}else{fs[_0x3f01('0x5f')](_0x14dd65,_0x2a3ec2['join']()+'\x0a');}_0x2a3ec2=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0x3f01('0x60')+_0x570e8d,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x3f01('0x61'));_0x5b464e[_0x3f01('0x62')]();}}catch(_0x48ad04){handleError(_0x3b0e75['data'][_0x242679],{'code':_0x3f01('0x63'),'message':_0x48ad04[_0x3f01('0x40')]});logger[_0x3f01('0x3f')](_0x3f01('0x64'),_0x48ad04[_0x3f01('0x40')]);}},'complete':function(){try{var _0x56d0dc=[];var _0x1bb882=_0x3f01('0x26');if(_0x391fd6[_0x3f01('0x65')]&&_0x391fd6[_0x3f01('0x65')]['length']){_0x1bb882=_0x3f01('0x66')+_0x570e8d;_0x56d0dc[_0x3f01('0x42')](_0x3f01('0x67')+_0x1bb882+'\x20LIKE\x20cm_contacts;');}var _0x451187=util['format'](_0x3f01('0x68'),_0x14dd65,_0x1bb882,_0x4f1414,_0x391fd6[_0x3f01('0x30')],_0x391fd6[_0x3f01('0x38')]||null,NOW,NOW);if(_[_0x3f01('0x69')](_0x55f23f[_0x3f01('0x1e')])){_0x451187+=_0x3f01('0x6a');}_0x56d0dc[_0x3f01('0x42')](_0x451187);if(_0x391fd6[_0x3f01('0x65')]&&_0x391fd6[_0x3f01('0x65')][_0x3f01('0x50')]){_0x56d0dc[_0x3f01('0x42')](insertCmContact(_0x391fd6['ListId'],_0x1bb882,_0x391fd6[_0x3f01('0x65')],_0x55f23f));_0x56d0dc[_0x3f01('0x42')](_0x3f01('0x6b')+_0x1bb882+';');}_0x56d0dc['push'](insertCmHopper(_0x391fd6['ListId'],_0x3f01('0x6c'),'voice_queues',_0x3f01('0x6d'),_0x5c98b0));_0x56d0dc[_0x3f01('0x42')](insertCmHopperBlack(_0x391fd6['ListId'],_0x3f01('0x6e'),'voice_queues',_0x3f01('0x6d')));_0x56d0dc[_0x3f01('0x42')](insertCmHopper(_0x391fd6[_0x3f01('0x30')],_0x3f01('0x6f'),_0x3f01('0x70'),_0x3f01('0x71'),_0x5c98b0));_0x56d0dc[_0x3f01('0x42')](insertCmHopperBlack(_0x391fd6[_0x3f01('0x30')],'campaigns_has_cm_blacklists',_0x3f01('0x70'),_0x3f01('0x71')));BPromise[_0x3f01('0x72')](_0x56d0dc,handleQuery)[_0x3f01('0x73')](function(_0x4abdda){stats[_0x3f01('0x74')]=!![];stats[_0x3f01('0x75')]=_0x391fd6[_0x3f01('0x65')]&&_0x391fd6['duplicates'][_0x3f01('0x50')]?results[0x2][_0x3f01('0x75')]:results[0x0][_0x3f01('0x75')];socket['emit'](_0x3f01('0x60')+_0x570e8d,stats);fs[_0x3f01('0x76')](_0x154f6b);fs[_0x3f01('0x76')](_0x14dd65);process[_0x3f01('0x77')](0x0);})[_0x3f01('0x78')](function(_0x582e87){logger['error'](_0x582e87['message']);process[_0x3f01('0x77')](0x1);});}catch(_0x14795b){logger[_0x3f01('0x3f')](_0x3f01('0x79'),_0x14795b['message']);process[_0x3f01('0x77')](0x1);}},'error':function(_0x56627a,_0xbcbc48,_0x1ce8e6,_0x54b8bd){throw new Error(_0x54b8bd);}});}function validate(){if(process[_0x3f01('0x7a')]&&process[_0x3f01('0x7a')][_0x3f01('0x50')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x133f43=path[_0x3f01('0x14')](config[_0x3f01('0x4b')],'server/files/tmp',process[_0x3f01('0x7a')][0x2]);if(!fs['existsSync'](_0x133f43)){throw new Error(_0x3f01('0x7b'));}var _0x46cc72={};try{_0x46cc72=JSON[_0x3f01('0x7c')](process[_0x3f01('0x7a')][0x3]);if(!_0x46cc72[_0x3f01('0x7d')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x46cc72[_0x3f01('0x7d')][_0x3f01('0x12')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x46cc72['binding'][_0x3f01('0x5c')]){throw new Error('firstName\x20is\x20mandatory');}var _0x27a9ec=0x0;if(_0x46cc72[_0x3f01('0x7d')]['UserId']){_0x27a9ec=0x1;}if(!_0x46cc72['ListId']){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x14dab9){throw new Error(_0x3f01('0x7e'));}var _0x5447f4=[];try{_0x5447f4=_['map'](JSON['parse'](process['argv'][0x4]),'id');}catch(_0x11917f){logger['info'](_0x3f01('0x7f'));}main(_0x133f43,_0x46cc72,_0x5447f4,_0x27a9ec);}validate();process['on']('SIGINT',handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0xbd40=[',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','each','then','affectedRows','emit','unlink','complete','file\x20doesn\x27t\x20exists','argv','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','import','redis','defaults','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','where','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_hopper','ContactId','ListId','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.createdAt','insert','into','cm_hopper_black','fromQuery','createdAt','updatedAt','select','cm_contacts','.CmListId\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','concat','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','Received\x20SIGINT','error','exit','errors','push','code','info','sequelize','query','spread','catch','message','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','keys','header','writeFileSync','createReadStream','data','length','rows','hasOwnProperty','scheduledat','isValid','isNaN','isNumber','agent\x20not\x20exists','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId'];(function(_0x4d0dd0,_0x101942){var _0x5093df=function(_0x23cfb1){while(--_0x23cfb1){_0x4d0dd0['push'](_0x4d0dd0['shift']());}};_0x5093df(++_0x101942);}(_0xbd40,0x98));var _0x0bd4=function(_0x2e24f1,_0x56f594){_0x2e24f1=_0x2e24f1-0x0;var _0x5c754c=_0xbd40[_0x2e24f1];return _0x5c754c;};'use strict';var fs=require('fs');var path=require(_0x0bd4('0x0'));var _=require(_0x0bd4('0x1'));var Papa=require(_0x0bd4('0x2'));var util=require(_0x0bd4('0x3'));var BPromise=require(_0x0bd4('0x4'));var moment=require(_0x0bd4('0x5'));var squel=require('squel');var Redis=require(_0x0bd4('0x6'));var db=require(_0x0bd4('0x7'))['db'];var config=require(_0x0bd4('0x8'));var logger=require('../../../config/logger')(_0x0bd4('0x9'));config[_0x0bd4('0xa')]=_[_0x0bd4('0xb')](config[_0x0bd4('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x0bd4('0xc')](_0x0bd4('0xd'));function isEmail(_0x4faf13){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))*$/[_0x0bd4('0xe')](_0x4faf13);}function selectNotIn(_0x1769cd,_0x37edb6,_0x19d9a8,_0x3154b4,_0x489207){return squel['select']()[_0x0bd4('0xf')](_0x0bd4('0x10'))[_0x0bd4('0x11')](_0x3154b4)[_0x0bd4('0x12')](_0x37edb6,null,_0x37edb6+'.id\x20=\x20'+_0x3154b4+'.'+_0x19d9a8)[_0x0bd4('0x13')](_0x3154b4+'.'+_0x19d9a8+'\x20=\x20'+_0x1769cd+'.'+_0x19d9a8)[_0x0bd4('0x13')](_0x37edb6+'.dialCheckDuplicateType\x20IN\x20('+_0x489207[_0x0bd4('0x12')]()+')');}function insertCmHopper(_0x192817,_0x9f1e95,_0x2fc9d2,_0x435274,_0x573c66){var _0x383876=[_0x0bd4('0x14'),_0x0bd4('0x15'),_0x0bd4('0x16'),_0x0bd4('0x17'),_0x9f1e95+'.'+_0x435274,'cm_contacts.createdAt',_0x0bd4('0x18'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x573c66+'\x22'];return squel['insert']()['into'](_0x0bd4('0x19'))['fromQuery']([_0x0bd4('0x10'),'scheduledat',_0x0bd4('0x1a'),_0x0bd4('0x1b'),_0x435274,'createdAt','updatedAt',_0x0bd4('0x1c'),_0x0bd4('0x1d'),_0x0bd4('0x1e')],squel['select']()[_0x0bd4('0x1f')](_0x383876)[_0x0bd4('0x11')](_0x9f1e95)[_0x0bd4('0x12')]('cm_contacts',null,_0x0bd4('0x20')+_0x9f1e95+_0x0bd4('0x21'))['join'](_0x2fc9d2,null,_0x2fc9d2+_0x0bd4('0x22')+_0x9f1e95+'.'+_0x435274)[_0x0bd4('0x13')](_0x9f1e95+'.CmListId\x20=\x20?',_0x192817)[_0x0bd4('0x13')](_0x0bd4('0x23'),NOW)[_0x0bd4('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x9f1e95,_0x2fc9d2,_0x435274,_0x0bd4('0x19'),[_0x0bd4('0x24'),_0x0bd4('0x25')]))[_0x0bd4('0x13')](_0x0bd4('0x26'),selectNotIn(_0x9f1e95,_0x2fc9d2,_0x435274,'cm_hopper',['\x22always\x22'])))[_0x0bd4('0x27')]();}function insertCmHopperBlack(_0x1b3ea1,_0xfdb314,_0x112a9e,_0x4fbd80){var _0x3c4d0c=[_0x0bd4('0x14'),_0x0bd4('0x16'),_0x0bd4('0x17'),_0xfdb314+'.'+_0x4fbd80,_0x0bd4('0x28'),_0x0bd4('0x18')];return squel[_0x0bd4('0x29')]()[_0x0bd4('0x2a')](_0x0bd4('0x2b'))[_0x0bd4('0x2c')](['phone',_0x0bd4('0x1a'),_0x0bd4('0x1b'),_0x4fbd80,_0x0bd4('0x2d'),_0x0bd4('0x2e')],squel[_0x0bd4('0x2f')]()[_0x0bd4('0x1f')](_0x3c4d0c)['from'](_0xfdb314)[_0x0bd4('0x12')](_0x0bd4('0x30'),null,_0x0bd4('0x20')+_0xfdb314+_0x0bd4('0x21'))['join'](_0x112a9e,null,_0x112a9e+_0x0bd4('0x22')+_0xfdb314+'.'+_0x4fbd80)[_0x0bd4('0x13')](_0xfdb314+_0x0bd4('0x31'),_0x1b3ea1)[_0x0bd4('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x0bd4('0x13')](_0x0bd4('0x26'),squel[_0x0bd4('0x2f')]()[_0x0bd4('0xf')](_0x0bd4('0x10'))['from'](_0x0bd4('0x2b'))['where'](_0x0bd4('0x32'),_0x1b3ea1)['where'](_0x4fbd80+_0x0bd4('0x33'),_0xfdb314+'.'+_0x4fbd80)))[_0x0bd4('0x27')]();}function insertCmContact(_0x441ca7,_0x4075e5,_0x3456a5,_0x588703){var _0x5074cf=_[_0x0bd4('0x34')](_['keys'](_0x588703),[_0x0bd4('0x1b'),'CompanyId',_0x0bd4('0x2d'),_0x0bd4('0x2e')]);return squel[_0x0bd4('0x29')]()['into'](_0x0bd4('0x30'))[_0x0bd4('0x2c')](_0x5074cf,squel[_0x0bd4('0x2f')]()[_0x0bd4('0x1f')](_0x5074cf)[_0x0bd4('0x11')](_0x4075e5)['where']('('+_0x3456a5[_0x0bd4('0x12')](',')+')\x20NOT\x20IN\x20?',squel[_0x0bd4('0x2f')]()[_0x0bd4('0x1f')](_0x3456a5)[_0x0bd4('0x11')]('cm_contacts')[_0x0bd4('0x13')](_0x0bd4('0x32'),_0x441ca7)[_0x0bd4('0x13')](_0x0bd4('0x35')))[_0x0bd4('0x13')]('id\x20IN\x20?',squel[_0x0bd4('0x2f')]()[_0x0bd4('0xf')](_0x0bd4('0x36'),_0x0bd4('0x37'))[_0x0bd4('0x11')](_0x4075e5)[_0x0bd4('0x38')](_0x3456a5[_0x0bd4('0x12')](','))))[_0x0bd4('0x27')]();}function handleStop(){logger['info'](_0x0bd4('0x39'));stopped=!![];}function handleUncaughtException(_0x5b85f4){logger[_0x0bd4('0x3a')](_0x5b85f4['message']);process[_0x0bd4('0x3b')](0x1);}function handleError(_0x336a0b,_0x36fda3){stats[_0x0bd4('0x3c')][_0x0bd4('0x3d')]({'name':_0x36fda3[_0x0bd4('0x3e')],'message':_0x36fda3['message'],'row':_0x336a0b});}function handleQuery(_0x20a58c){logger[_0x0bd4('0x3f')](_0x20a58c);return db[_0x0bd4('0x40')][_0x0bd4('0x41')](_0x20a58c)[_0x0bd4('0x42')](function(_0x3bde7e){results[_0x0bd4('0x3d')](_0x3bde7e);})[_0x0bd4('0x43')](function(_0x53deb9){logger['error'](_0x53deb9[_0x0bd4('0x44')]);});}function main(_0x350520,_0x476e22,_0x451e17,_0x3a6daa){logger[_0x0bd4('0x3f')](_0x0bd4('0x45'),_0x350520,JSON[_0x0bd4('0x46')](_0x476e22));process[_0x0bd4('0x47')](_0x0bd4('0x48'));var _0x4fe1a4=_0x476e22[_0x0bd4('0x49')];var _0x3df626=_0x476e22[_0x0bd4('0x4a')];var _0x3de870=path[_0x0bd4('0x12')](config[_0x0bd4('0x4b')],_0x0bd4('0x4c'),_0x3df626+'.csv');var _0x2a37a6=_[_0x0bd4('0x4d')](_0x4fe1a4)[_0x0bd4('0x12')]();logger['info'](_0x0bd4('0x4e'),_0x2a37a6);fs[_0x0bd4('0x4f')](_0x3de870,_0x2a37a6+'\x0a');Papa['parse'](fs[_0x0bd4('0x50')](_0x350520),{'header':!![],'skipEmptyLines':!![],'step':function(_0x56882d,_0x1e18af){try{for(var _0x3d2a3b=0x0,_0xcbd462=[];_0x3d2a3b<_0x56882d[_0x0bd4('0x51')][_0x0bd4('0x52')];_0x3d2a3b++){stats[_0x0bd4('0x53')]+=0x1;if(_0x56882d[_0x0bd4('0x3c')][_0x3d2a3b]){handleError(_0x56882d['data'][_0x3d2a3b],_0x56882d[_0x0bd4('0x3c')][_0x3d2a3b]);}else{var _0x169637=[];for(var _0x20b4c1 in _0x4fe1a4){if(_0x4fe1a4[_0x0bd4('0x54')](_0x20b4c1)){if(_0x56882d[_0x0bd4('0x51')][_0x3d2a3b][_0x4fe1a4[_0x20b4c1]]){var _0x548447=_['trim'](_0x56882d[_0x0bd4('0x51')][_0x3d2a3b][_0x4fe1a4[_0x20b4c1]]['replace'](/"/g,'\x27'));switch(_0x20b4c1){case _0x0bd4('0x55'):var _0x4c212b=moment(_0x548447,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x4c212b[_0x0bd4('0x56')]()){_0xcbd462[_0x0bd4('0x3d')]('\x22'+_0x548447+'\x22');}else{_0x169637[_0x0bd4('0x3d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x4f7ebd=parseInt(_0x548447);_0x548447=_[_0x0bd4('0x57')](_0x4f7ebd)||_0x4f7ebd<0x0||_0x4f7ebd>0x4?_0x3a6daa?0x3:0x2:_0x4f7ebd;_0xcbd462[_0x0bd4('0x3d')]('\x22'+_0x548447+'\x22');break;case _0x0bd4('0x1d'):var _0x4a2993=parseInt(_0x548447);if(_[_0x0bd4('0x58')](_0x4a2993)&&_['includes'](_0x451e17,_0x4a2993)){_0xcbd462[_0x0bd4('0x3d')]('\x22'+_0x4a2993+'\x22');}else{_0x169637[_0x0bd4('0x3d')](_0x0bd4('0x59'));}break;case'email':if(isEmail(_0x548447)){_0xcbd462[_0x0bd4('0x3d')]('\x22'+_0x548447+'\x22');}else{_0x169637['push']('email\x20wrong\x20format');}break;case _0x0bd4('0x5a'):var _0x1f4c5e=moment(_0x548447,'YYYY-MM-DD',!![]);if(_0x1f4c5e[_0x0bd4('0x56')]()){_0xcbd462[_0x0bd4('0x3d')]('\x22'+_0x548447+'\x22');}else{_0x169637[_0x0bd4('0x3d')](_0x0bd4('0x5b'));}break;default:_0xcbd462[_0x0bd4('0x3d')]('\x22'+_0x548447+'\x22');}}else{switch(_0x20b4c1){case _0x0bd4('0x5c'):case'phone':_0x169637['push'](_0x20b4c1+_0x0bd4('0x5d'));break;default:_0xcbd462[_0x0bd4('0x3d')]('\x22\x22');}}}}if(_0x169637[_0x0bd4('0x52')]){handleError(_0x56882d[_0x0bd4('0x51')][_0x3d2a3b],{'code':_0x0bd4('0x5e'),'message':_0x169637[_0x0bd4('0x12')]()});}else{fs[_0x0bd4('0x5f')](_0x3de870,_0xcbd462[_0x0bd4('0x12')]()+'\x0a');}_0xcbd462=[];}if(!(stats[_0x0bd4('0x53')]%0xc8)){socket['emit'](_0x0bd4('0x60')+_0x3df626,stats);stats[_0x0bd4('0x3c')]=[];}}if(stopped){logger[_0x0bd4('0x3f')](_0x0bd4('0x61'));_0x1e18af[_0x0bd4('0x62')]();}}catch(_0x48b416){handleError(_0x56882d['data'][_0x3d2a3b],{'code':_0x0bd4('0x63'),'message':_0x48b416[_0x0bd4('0x44')]});logger[_0x0bd4('0x3a')](_0x0bd4('0x64'),_0x48b416['message']);}},'complete':function(){try{var _0x2697db=[];var _0x43f76e='cm_contacts';if(_0x476e22[_0x0bd4('0x65')]&&_0x476e22[_0x0bd4('0x65')][_0x0bd4('0x52')]){_0x43f76e='cm_contacts_'+_0x3df626;_0x2697db['push'](_0x0bd4('0x66')+_0x43f76e+_0x0bd4('0x67'));}var _0x114eb0=util[_0x0bd4('0xc')](_0x0bd4('0x68'),_0x3de870,_0x43f76e,_0x2a37a6,_0x476e22['ListId'],_0x476e22[_0x0bd4('0x69')]||null,NOW,NOW);if(_['isNil'](_0x4fe1a4['scheduledat'])){_0x114eb0+=_0x0bd4('0x6a');}_0x2697db[_0x0bd4('0x3d')](_0x114eb0);if(_0x476e22[_0x0bd4('0x65')]&&_0x476e22[_0x0bd4('0x65')]['length']){_0x2697db['push'](insertCmContact(_0x476e22[_0x0bd4('0x1b')],_0x43f76e,_0x476e22[_0x0bd4('0x65')],_0x4fe1a4));_0x2697db[_0x0bd4('0x3d')](_0x0bd4('0x6b')+_0x43f76e+';');}_0x2697db[_0x0bd4('0x3d')](insertCmHopper(_0x476e22[_0x0bd4('0x1b')],'voice_queues_has_cm_lists',_0x0bd4('0x6c'),_0x0bd4('0x6d'),_0x3a6daa));_0x2697db[_0x0bd4('0x3d')](insertCmHopperBlack(_0x476e22[_0x0bd4('0x1b')],_0x0bd4('0x6e'),_0x0bd4('0x6c'),_0x0bd4('0x6d')));_0x2697db[_0x0bd4('0x3d')](insertCmHopper(_0x476e22[_0x0bd4('0x1b')],_0x0bd4('0x6f'),'campaigns',_0x0bd4('0x70'),_0x3a6daa));_0x2697db[_0x0bd4('0x3d')](insertCmHopperBlack(_0x476e22['ListId'],_0x0bd4('0x71'),'campaigns',_0x0bd4('0x70')));BPromise[_0x0bd4('0x72')](_0x2697db,handleQuery)[_0x0bd4('0x73')](function(_0xea6600){stats['finish']=!![];stats[_0x0bd4('0x74')]=_0x476e22[_0x0bd4('0x65')]&&_0x476e22[_0x0bd4('0x65')][_0x0bd4('0x52')]?results[0x2][_0x0bd4('0x74')]:results[0x0][_0x0bd4('0x74')];socket[_0x0bd4('0x75')](_0x0bd4('0x60')+_0x3df626,stats);fs[_0x0bd4('0x76')](_0x350520);fs['unlink'](_0x3de870);process[_0x0bd4('0x3b')](0x0);})[_0x0bd4('0x43')](function(_0x465cb1){logger[_0x0bd4('0x3a')](_0x465cb1['message']);process['exit'](0x1);});}catch(_0x4001ee){logger[_0x0bd4('0x3a')](_0x0bd4('0x77'),_0x4001ee[_0x0bd4('0x44')]);process['exit'](0x1);}},'error':function(_0x3475fd,_0x397b4f,_0x1511c3,_0x3112e0){throw new Error(_0x3112e0);}});}function validate(){if(process['argv']&&process['argv']['length']<0x4){throw new Error('arguments\x20\x20\x20');}var _0x20e5cf=path['join'](config[_0x0bd4('0x4b')],'server/files/tmp',process['argv'][0x2]);if(!fs['existsSync'](_0x20e5cf)){throw new Error(_0x0bd4('0x78'));}var _0x74335c={};try{_0x74335c=JSON['parse'](process[_0x0bd4('0x79')][0x3]);if(!_0x74335c[_0x0bd4('0x49')]){throw new Error(_0x0bd4('0x7a'));}if(!_0x74335c[_0x0bd4('0x49')][_0x0bd4('0x10')]){throw new Error(_0x0bd4('0x7b'));}if(!_0x74335c[_0x0bd4('0x49')]['firstName']){throw new Error(_0x0bd4('0x7c'));}var _0x38e153=0x0;if(_0x74335c['binding']['UserId']){_0x38e153=0x1;}if(!_0x74335c['ListId']){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x3e4588){throw new Error(_0x0bd4('0x7d'));}var _0x917062=[];try{_0x917062=_['map'](JSON['parse'](process[_0x0bd4('0x79')][0x4]),'id');}catch(_0x2e4022){logger[_0x0bd4('0x3f')](_0x0bd4('0x7e'));}main(_0x20e5cf,_0x74335c,_0x917062,_0x38e153);}validate();process['on'](_0x0bd4('0x7f'),handleStop);process['on'](_0x0bd4('0x80'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 7cecf46..de19d84 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 _0x3070=['Caller\x20Name','calleridname','Call\x20To','destexten','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Complete','agentcompleteAt','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','UniqueId','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','string','[xCALLY\x20Ticket]','toLowerCase','voice','variable','queue','push','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum'];(function(_0x3395a6,_0x4237cd){var _0x1a5b52=function(_0x299d77){while(--_0x299d77){_0x3395a6['push'](_0x3395a6['shift']());}};_0x1a5b52(++_0x4237cd);}(_0x3070,0x75));var _0x0307=function(_0x537772,_0x2cc9c3){_0x537772=_0x537772-0x0;var _0x525f37=_0x3070[_0x537772];return _0x525f37;};'use strict';exports['getSubjects']=function(_0x34c337,_0x50afb5){var _0x449d64=[{'type':_0x0307('0x0'),'content':_0x0307('0x1'),'variableName':null}];switch(_0x34c337[_0x0307('0x2')]()){case _0x0307('0x3'):switch(_0x50afb5[_0x0307('0x2')]()){case'inbound':_0x449d64['push']({'type':_0x0307('0x4'),'content':'','variableName':_0x0307('0x5')});_0x449d64[_0x0307('0x6')]({'type':_0x0307('0x4'),'content':'','variableName':'calleridnum'});break;case _0x0307('0x7'):_0x449d64[_0x0307('0x6')]({'type':'string','content':_0x0307('0x8'),'variableName':null});_0x449d64[_0x0307('0x6')]({'type':_0x0307('0x4'),'content':'','variableName':_0x0307('0x9')});break;}}return _0x449d64;};exports[_0x0307('0xa')]=function(_0x33c001,_0x10513a){var _0x461212=[];switch(_0x33c001[_0x0307('0x2')]()){case'voice':switch(_0x10513a[_0x0307('0x2')]()){case'inbound':_0x461212=[{'type':_0x0307('0x0'),'content':_0x0307('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0x0307('0xc'),'content':'','key':_0x0307('0xd'),'keyType':_0x0307('0x4'),'variableName':_0x0307('0xe')},{'type':_0x0307('0xc'),'content':'','key':_0x0307('0xf'),'keyType':_0x0307('0x4'),'variableName':_0x0307('0x10')},{'type':_0x0307('0xc'),'content':'','key':_0x0307('0x11'),'keyType':_0x0307('0x4'),'variableName':_0x0307('0x12')},{'type':_0x0307('0xc'),'content':'','key':'Queue','keyType':_0x0307('0x4'),'variableName':_0x0307('0x5')},{'type':_0x0307('0xc'),'content':'','key':'UniqueId','keyType':'variable','variableName':_0x0307('0x13')},{'type':_0x0307('0xc'),'content':'','key':_0x0307('0x14'),'keyType':_0x0307('0x4'),'variableName':_0x0307('0x15')},{'type':_0x0307('0x0'),'content':_0x0307('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x0307('0x17'),'keyType':'variable','variableName':_0x0307('0x18')},{'type':_0x0307('0xc'),'content':'','key':_0x0307('0x19'),'keyType':_0x0307('0x4'),'variableName':'destcalleridnum'},{'type':_0x0307('0x0'),'content':_0x0307('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':_0x0307('0xc'),'content':'','key':'Agent\x20Ring','keyType':'variable','variableName':_0x0307('0x15')},{'type':_0x0307('0xc'),'content':'','key':'Agent\x20Connect','keyType':_0x0307('0x4'),'variableName':'agentconnectAt'},{'type':_0x0307('0xc'),'content':'','key':_0x0307('0x1b'),'keyType':_0x0307('0x4'),'variableName':_0x0307('0x1c')},{'type':'keyValue','content':'','key':'Hold\x20Time','keyType':_0x0307('0x4'),'variableName':_0x0307('0x1d')},{'type':_0x0307('0xc'),'content':'','key':_0x0307('0x1e'),'keyType':_0x0307('0x4'),'variableName':_0x0307('0x1f')}];break;case'outbound':_0x461212=[{'type':_0x0307('0x0'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x0307('0xc'),'content':'','key':_0x0307('0x20'),'keyType':_0x0307('0x4'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x0307('0xc'),'content':'','key':_0x0307('0x21'),'keyType':_0x0307('0x4'),'keyContent':'','variableName':_0x0307('0x22')},{'type':'keyValue','content':'','key':_0x0307('0x23'),'keyType':'variable','keyContent':'','variableName':_0x0307('0x13')},{'type':_0x0307('0xc'),'content':'','key':_0x0307('0x14'),'keyType':'variable','keyContent':'','variableName':'starttime'},{'type':_0x0307('0x0'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x0307('0xc'),'content':'','key':_0x0307('0x24'),'keyType':'variable','keyContent':'','variableName':_0x0307('0x25')},{'type':'keyValue','content':'','key':_0x0307('0x26'),'keyType':'variable','keyContent':'','variableName':_0x0307('0x27')},{'type':_0x0307('0xc'),'content':'','key':_0x0307('0x28'),'keyType':_0x0307('0x4'),'keyContent':'','variableName':_0x0307('0x29')},{'type':_0x0307('0xc'),'content':'','key':_0x0307('0x2a'),'keyType':'variable','keyContent':'','variableName':_0x0307('0x2b')}];break;}}return _0x461212;}; \ No newline at end of file +var _0x94d2=['[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','queue','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','keyValue','Caller\x20Number','calleridnum','Caller\x20Name','Call\x20To','destexten','Queue','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','membername','UniqueId','starttime','answertime','Complete\x20Time','endtime','Duration','Billable\x20Time','string'];(function(_0x5930f7,_0x262c03){var _0x421960=function(_0x5ebf16){while(--_0x5ebf16){_0x5930f7['push'](_0x5930f7['shift']());}};_0x421960(++_0x262c03);}(_0x94d2,0x1cd));var _0x294d=function(_0x50f0a9,_0x2b0c57){_0x50f0a9=_0x50f0a9-0x0;var _0x5a33d9=_0x94d2[_0x50f0a9];return _0x5a33d9;};'use strict';exports['getSubjects']=function(_0x4dff5d,_0x30eae3){var _0x47eb33=[{'type':_0x294d('0x0'),'content':_0x294d('0x1'),'variableName':null}];switch(_0x4dff5d[_0x294d('0x2')]()){case'voice':switch(_0x30eae3['toLowerCase']()){case _0x294d('0x3'):_0x47eb33[_0x294d('0x4')]({'type':_0x294d('0x5'),'content':'','variableName':_0x294d('0x6')});_0x47eb33[_0x294d('0x4')]({'type':'variable','content':'','variableName':'calleridnum'});break;case _0x294d('0x7'):_0x47eb33[_0x294d('0x4')]({'type':_0x294d('0x0'),'content':_0x294d('0x8'),'variableName':null});_0x47eb33[_0x294d('0x4')]({'type':'variable','content':'','variableName':_0x294d('0x9')});break;}}return _0x47eb33;};exports[_0x294d('0xa')]=function(_0x53d5f5,_0x20af48){var _0x18fde9=[];switch(_0x53d5f5['toLowerCase']()){case'voice':switch(_0x20af48[_0x294d('0x2')]()){case _0x294d('0x3'):_0x18fde9=[{'type':_0x294d('0x0'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0xc'),'keyType':_0x294d('0x5'),'variableName':_0x294d('0xd')},{'type':'keyValue','content':'','key':_0x294d('0xe'),'keyType':'variable','variableName':'calleridname'},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0xf'),'keyType':_0x294d('0x5'),'variableName':_0x294d('0x10')},{'type':'keyValue','content':'','key':_0x294d('0x11'),'keyType':'variable','variableName':'queue'},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0x294d('0x5'),'variableName':_0x294d('0x12')},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0x13'),'keyType':_0x294d('0x5'),'variableName':_0x294d('0x14')},{'type':_0x294d('0x0'),'content':_0x294d('0x15'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x294d('0x16'),'keyType':_0x294d('0x5'),'variableName':'destcalleridname'},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0x17'),'keyType':_0x294d('0x5'),'variableName':_0x294d('0x9')},{'type':_0x294d('0x0'),'content':_0x294d('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0x19'),'keyType':_0x294d('0x5'),'variableName':_0x294d('0x14')},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0x1a'),'keyType':_0x294d('0x5'),'variableName':_0x294d('0x1b')},{'type':_0x294d('0xb'),'content':'','key':'Agent\x20Complete','keyType':'variable','variableName':_0x294d('0x1c')},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0x1d'),'keyType':_0x294d('0x5'),'variableName':_0x294d('0x1e')},{'type':_0x294d('0xb'),'content':'','key':'Talk\x20Time','keyType':_0x294d('0x5'),'variableName':'talktime'}];break;case _0x294d('0x7'):_0x18fde9=[{'type':_0x294d('0x0'),'content':_0x294d('0x1f'),'variableName':null},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0x20'),'keyType':_0x294d('0x5'),'keyContent':'','variableName':_0x294d('0x9')},{'type':'keyValue','content':'','key':_0x294d('0x21'),'keyType':_0x294d('0x5'),'keyContent':'','variableName':_0x294d('0x22')},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0x23'),'keyType':_0x294d('0x5'),'keyContent':'','variableName':_0x294d('0x12')},{'type':_0x294d('0xb'),'content':'','key':'Date','keyType':_0x294d('0x5'),'keyContent':'','variableName':_0x294d('0x24')},{'type':_0x294d('0x0'),'content':_0x294d('0x18')},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':_0x294d('0x5'),'keyContent':'','variableName':_0x294d('0x25')},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0x26'),'keyType':_0x294d('0x5'),'keyContent':'','variableName':_0x294d('0x27')},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0x28'),'keyType':_0x294d('0x5'),'keyContent':'','variableName':'duration'},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0x29'),'keyType':_0x294d('0x5'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x18fde9;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index dfd88eb..29f26b9 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 _0x202c=['../../config/logger','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','then','info','catch','error','tracked','user','query','clone','body','omit','fax','lodash','openchannel-interactions'];(function(_0x4309d9,_0x5b0b57){var _0x1af166=function(_0x20d871){while(--_0x20d871){_0x4309d9['push'](_0x4309d9['shift']());}};_0x1af166(++_0x5b0b57);}(_0x202c,0x178));var _0xc202=function(_0x1f448a,_0x477d9d){_0x1f448a=_0x1f448a-0x0;var _0x24c6ac=_0x202c[_0x1f448a];return _0x24c6ac;};'use strict';var _=require(_0xc202('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0xc202('0x1')),'mail':require(_0xc202('0x2'))(_0xc202('0x3')),'fax':require('../../config/logger')(_0xc202('0x4')),'sms':require(_0xc202('0x2'))(_0xc202('0x5')),'chat':require(_0xc202('0x2'))('chat-interactions'),'whatsapp':require(_0xc202('0x2'))(_0xc202('0x6'))};function getInteractionId(_0x59563a,_0xc2b3eb,_0x574549){if(_0x59563a&&_0x59563a[_[_0xc202('0x7')](_0x574549)+_0xc202('0x8')]){return _0x59563a[_[_0xc202('0x7')](_0x574549)+_0xc202('0x8')];}else if(_0x59563a&&_0x59563a['id']){return _0x59563a['id'];}else if(_0xc2b3eb&&_0xc2b3eb['id']){return _0xc2b3eb['id'];}else{return _0xc202('0x9');}}function log(_0x3ea754,_0x409c93,_0xdfe8bf,_0x3bd895,_0x1991a3,_0x630e57){loggers[_0x1991a3[_0xc202('0xa')]()][_0x3ea754](_0xc202('0xb'),_0x630e57['toUpperCase'](),_0x409c93?_0x409c93['id']:null,_0x409c93?_0x409c93[_0xc202('0xc')]:null,_0x409c93?_0x409c93[_0xc202('0xd')]:null,getInteractionId(_0xdfe8bf,_0x3bd895,_0x1991a3),_0xdfe8bf?JSON[_0xc202('0xe')](_0xdfe8bf):_0xc202('0xf'));}function updateUser(_0x269dc0,_0x3a3eab,_0x2c8128,_0x53600c,_0xbd4353){db[_[_0xc202('0x7')](_0x53600c)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x3a3eab,_0x2c8128,_0x53600c)}})['then'](function(_0x2dafa5){if(_0x2dafa5){return _0x2dafa5['update']({'UserId':_0x269dc0?_0x269dc0['id']:null});}})[_0xc202('0x10')](function(_0x5971a6){if(_0x5971a6){log(_0xc202('0x11'),_0x269dc0,_0x3a3eab,_0x2c8128,_0x53600c,_0xbd4353);}})[_0xc202('0x12')](function(){log(_0xc202('0x13'),_0x269dc0,_0x3a3eab,_0x2c8128,_0x53600c,_0xbd4353);});}exports[_0xc202('0x14')]=function(_0x705253,_0x2419c5){return function(_0x9620a0,_0x591ecc,_0x16ec7c){var _0x2c5557=_0x9620a0[_0xc202('0x15')];var _0x5b2487={};var _0x504d94=_0x9620a0[_0xc202('0x16')];if(_0x5b2487){_0x5b2487=_[_0xc202('0x17')](_0x9620a0[_0xc202('0x18')]);_0x5b2487=_[_0xc202('0x19')](_0x5b2487,[_0xc202('0x18'),'html','phone',_0xc202('0x1a'),'mobile']);}updateUser(_0x2c5557,_0x5b2487,_0x504d94,_0x705253,_0x2419c5);_0x16ec7c(null);};}; \ No newline at end of file +var _0xfbf0=['catch','error','tracked','user','clone','omit','html','phone','mobile','../../mysqldb','../../config/logger','mail-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','Interaction','findOne','then','update','info'];(function(_0x454589,_0x3e852e){var _0x468c5c=function(_0xa5b1f5){while(--_0xa5b1f5){_0x454589['push'](_0x454589['shift']());}};_0x468c5c(++_0x3e852e);}(_0xfbf0,0x141));var _0x0fbf=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xfbf0[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var db=require(_0x0fbf('0x0'))['db'];var loggers={'openchannel':require(_0x0fbf('0x1'))('openchannel-interactions'),'mail':require('../../config/logger')(_0x0fbf('0x2')),'fax':require(_0x0fbf('0x1'))('fax-interactions'),'sms':require(_0x0fbf('0x1'))('sms-interactions'),'chat':require(_0x0fbf('0x1'))('chat-interactions'),'whatsapp':require(_0x0fbf('0x1'))(_0x0fbf('0x3'))};function getInteractionId(_0x5210d3,_0x31427a,_0x32f4e0){if(_0x5210d3&&_0x5210d3[_[_0x0fbf('0x4')](_0x32f4e0)+_0x0fbf('0x5')]){return _0x5210d3[_[_0x0fbf('0x4')](_0x32f4e0)+_0x0fbf('0x5')];}else if(_0x5210d3&&_0x5210d3['id']){return _0x5210d3['id'];}else if(_0x31427a&&_0x31427a['id']){return _0x31427a['id'];}else{return _0x0fbf('0x6');}}function log(_0x409b04,_0x165eec,_0x174e66,_0x4d1f16,_0x3b2a6a,_0x5e6a63){loggers[_0x3b2a6a['toLowerCase']()][_0x409b04](_0x0fbf('0x7'),_0x5e6a63[_0x0fbf('0x8')](),_0x165eec?_0x165eec['id']:null,_0x165eec?_0x165eec[_0x0fbf('0x9')]:null,_0x165eec?_0x165eec[_0x0fbf('0xa')]:null,getInteractionId(_0x174e66,_0x4d1f16,_0x3b2a6a),_0x174e66?JSON['stringify'](_0x174e66):_0x0fbf('0xb'));}function updateUser(_0x4536a4,_0x336875,_0x316e23,_0x291d9d,_0x3e4e9b){db[_[_0x0fbf('0x4')](_0x291d9d)+_0x0fbf('0xc')][_0x0fbf('0xd')]({'where':{'id':getInteractionId(_0x336875,_0x316e23,_0x291d9d)}})[_0x0fbf('0xe')](function(_0x1519e6){if(_0x1519e6){return _0x1519e6[_0x0fbf('0xf')]({'UserId':_0x4536a4?_0x4536a4['id']:null});}})[_0x0fbf('0xe')](function(_0x1f18c9){if(_0x1f18c9){log(_0x0fbf('0x10'),_0x4536a4,_0x336875,_0x316e23,_0x291d9d,_0x3e4e9b);}})[_0x0fbf('0x11')](function(){log(_0x0fbf('0x12'),_0x4536a4,_0x336875,_0x316e23,_0x291d9d,_0x3e4e9b);});}exports[_0x0fbf('0x13')]=function(_0x490e7a,_0x5347c0){return function(_0x4c83ec,_0x35478d,_0x393bab){var _0x2fc298=_0x4c83ec[_0x0fbf('0x14')];var _0x3c6c5f={};var _0x26c9da=_0x4c83ec['query'];if(_0x3c6c5f){_0x3c6c5f=_[_0x0fbf('0x15')](_0x4c83ec['body']);_0x3c6c5f=_[_0x0fbf('0x16')](_0x3c6c5f,['body',_0x0fbf('0x17'),_0x0fbf('0x18'),'fax',_0x0fbf('0x19')]);}updateUser(_0x2fc298,_0x3c6c5f,_0x26c9da,_0x490e7a,_0x5347c0);_0x393bab(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 4b26f52..2252fa9 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 _0xb7ae=['Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','update','utf8','final','hasOwnProperty','use','License','findOne','then','status','json'];(function(_0x8bf15e,_0xcf5c38){var _0x5b9ccc=function(_0xb4492){while(--_0xb4492){_0x8bf15e['push'](_0x8bf15e['shift']());}};_0x5b9ccc(++_0xcf5c38);}(_0xb7ae,0x14a));var _0xeb7a=function(_0x31a29d,_0x165563){_0x31a29d=_0x31a29d-0x0;var _0x13ec7f=_0xb7ae[_0x31a29d];return _0x13ec7f;};'use strict';var crypto=require(_0xeb7a('0x0'));var util=require(_0xeb7a('0x1'));var compose=require(_0xeb7a('0x2'));var db=require(_0xeb7a('0x3'))['db'];var config=require(_0xeb7a('0x4'));function getValueFromLicense(_0x45d2a9,_0x57c97c){if(_0x45d2a9&&_0x57c97c){if(_0x57c97c[_0xeb7a('0x5')]&&_0x57c97c[_0xeb7a('0x6')]){var _0x136789=_0x57c97c[_0xeb7a('0x5')];var _0x2eb214=_0x57c97c[_0xeb7a('0x6')];var _0x1e5c1d=_0x136789[_0xeb7a('0x7')]('-')[0x4];var _0x43ed63=_0x136789['split']('-')[0x0];var _0x239a8d=crypto[_0xeb7a('0x8')](_0xeb7a('0x9'),util['format']('%s:%s:%s',_0x1e5c1d,_0x136789,_0x43ed63));var _0x2249d4=_0x239a8d[_0xeb7a('0xa')](_0x2eb214,'base64',_0xeb7a('0xb'));_0x2249d4+=_0x239a8d[_0xeb7a('0xc')](_0xeb7a('0xb'));var _0x244328=JSON['parse'](_0x2249d4);return _0x244328[_0xeb7a('0xd')](_0x45d2a9)?_0x244328[_0x45d2a9]:null;}}return null;}function isLimit(_0x3df3d4,_0x3ae8b1,_0x322ce4,_0x46e2df){var _0x13d752=_0x3ae8b1;return compose()[_0xeb7a('0xe')](function(_0x4a3f93,_0x3ade44,_0x185b80){return db[_0xeb7a('0xf')][_0xeb7a('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x2db754){var _0x193fa2=getValueFromLicense(_0x3df3d4,_0x2db754);return _0x193fa2?_0x193fa2:_0x13d752;})['then'](function(_0x466293){_0x13d752=_0x466293;return _0x322ce4['count'](_0x46e2df);})[_0xeb7a('0x11')](function(_0x1ec6e1){if(_0x1ec6e1>=_0x13d752){return _0x3ade44[_0xeb7a('0x12')](0x193)[_0xeb7a('0x13')]({'message':util['format'](_0xeb7a('0x14'),_0x3df3d4)});}_0x185b80();})[_0xeb7a('0x15')](function(_0x1f011e){_0x185b80(_0x1f011e);});});}function isUserLimit(){return isLimit(_0xeb7a('0x16'),0x1,db['User'],{'where':{'$or':[{'role':_0xeb7a('0x17')},{'role':_0xeb7a('0x18')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x17ee=['data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','License','findOne','then','count','status','json','users','User','admin','isUserLimit','crypto','util','../../mysqldb','../../config/environment'];(function(_0x21f766,_0x238fdd){var _0xe5778=function(_0x2932f0){while(--_0x2932f0){_0x21f766['push'](_0x21f766['shift']());}};_0xe5778(++_0x238fdd);}(_0x17ee,0x1b6));var _0xe17e=function(_0x2cab12,_0x58f8a3){_0x2cab12=_0x2cab12-0x0;var _0x220f47=_0x17ee[_0x2cab12];return _0x220f47;};'use strict';var crypto=require(_0xe17e('0x0'));var util=require(_0xe17e('0x1'));var compose=require('composable-middleware');var db=require(_0xe17e('0x2'))['db'];var config=require(_0xe17e('0x3'));function getValueFromLicense(_0x2ab869,_0x2032db){if(_0x2ab869&&_0x2032db){if(_0x2032db[_0xe17e('0x4')]&&_0x2032db[_0xe17e('0x5')]){var _0x5d12f5=_0x2032db[_0xe17e('0x4')];var _0x12afc2=_0x2032db['license'];var _0x189557=_0x5d12f5[_0xe17e('0x6')]('-')[0x4];var _0x310033=_0x5d12f5[_0xe17e('0x6')]('-')[0x0];var _0x438139=crypto[_0xe17e('0x7')](_0xe17e('0x8'),util[_0xe17e('0x9')](_0xe17e('0xa'),_0x189557,_0x5d12f5,_0x310033));var _0x464210=_0x438139[_0xe17e('0xb')](_0x12afc2,_0xe17e('0xc'),_0xe17e('0xd'));_0x464210+=_0x438139[_0xe17e('0xe')](_0xe17e('0xd'));var _0x204fb7=JSON[_0xe17e('0xf')](_0x464210);return _0x204fb7['hasOwnProperty'](_0x2ab869)?_0x204fb7[_0x2ab869]:null;}}return null;}function isLimit(_0x73d645,_0x623399,_0x493794,_0x34bd02){var _0x50ea8b=_0x623399;return compose()['use'](function(_0x39908b,_0x13eb65,_0x38133d){return db[_0xe17e('0x10')][_0xe17e('0x11')]({'where':{'id':0x1},'raw':!![]})[_0xe17e('0x12')](function(_0x325480){var _0x52afaa=getValueFromLicense(_0x73d645,_0x325480);return _0x52afaa?_0x52afaa:_0x50ea8b;})[_0xe17e('0x12')](function(_0x27443d){_0x50ea8b=_0x27443d;return _0x493794[_0xe17e('0x13')](_0x34bd02);})[_0xe17e('0x12')](function(_0x25aa3c){if(_0x25aa3c>=_0x50ea8b){return _0x13eb65[_0xe17e('0x14')](0x193)[_0xe17e('0x15')]({'message':util[_0xe17e('0x9')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x73d645)});}_0x38133d();})['catch'](function(_0x191fdc){_0x38133d(_0x191fdc);});});}function isUserLimit(){return isLimit(_0xe17e('0x16'),0x1,db[_0xe17e('0x17')],{'where':{'$or':[{'role':_0xe17e('0x18')},{'role':'user'}]}});}exports[_0xe17e('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index e760690..bab29ef 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 _0x6798=['$between','value','includes','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','shift','utcOffset','minutes','seconds','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','forEach','indexOf','map','conditions','push','buildExpression','operator','$eq'];(function(_0x5cd1e8,_0x1404c7){var _0x7fe273=function(_0x639cf6){while(--_0x639cf6){_0x5cd1e8['push'](_0x5cd1e8['shift']());}};_0x7fe273(++_0x1404c7);}(_0x6798,0xce));var _0x8679=function(_0x3194a1,_0x2a456e){_0x3194a1=_0x3194a1-0x0;var _0xf09476=_0x6798[_0x3194a1];return _0xf09476;};'use strict';var _=require(_0x8679('0x0'));var moment=require(_0x8679('0x1'));exports['parseSearch']=function(_0x342654){var _0x204f62={'conditions':[]};_0x204f62[_0x8679('0x2')]=_[_0x8679('0x3')](_0x342654,_0x8679('0x4'))?'or':_0x8679('0x5');var _0x576304=_0x342654[_0x8679('0x6')](_0x8679('0x7'),'')[_0x8679('0x6')](_0x8679('0x4'),'')[_0x8679('0x8')]('||');for(var _0x31f1e0=0x0;_0x31f1e0<_0x576304[_0x8679('0x9')];_0x31f1e0++){var _0x42eb7f=_0x576304[_0x31f1e0]['split'](':=');var _0x31cc76=_0x42eb7f[0x0];var _0x12d164=_0x42eb7f['slice'](0x1);_0x12d164['forEach'](function(_0x3131a9){var _0x2dd3b0=_0x3131a9[_0x8679('0x8')]('[')['shift']();var _0x336e7b=_0x3131a9['match'](/\[(.*?)\]/g);_0x336e7b[_0x8679('0xa')](function(_0x5e65f7){var _0x2a4857=_0x5e65f7[_0x8679('0x8')]('[')['filter'](function(_0x14c1f8){return _0x14c1f8[_0x8679('0xb')](']')>-0x1;})[_0x8679('0xc')](function(_0x2c2cec){return _0x2c2cec[_0x8679('0x8')](']')[0x0];})[0x0];_0x204f62[_0x8679('0xd')][_0x8679('0xe')]({'field':_0x31cc76,'operator':_0x2dd3b0,'value':_0x2a4857});});});}return _0x204f62;};exports[_0x8679('0xf')]=function(_0x411e26,_0x265596,_0x1b54a3){var _0x48e967={};if(_0x265596==='DATE'){if(_0x1b54a3[_0x8679('0x10')]===_0x8679('0x11')){_0x1b54a3['operator']=_0x8679('0x12');_0x1b54a3['value']+=','+_0x1b54a3[_0x8679('0x13')];}else if(_[_0x8679('0x14')](['$gt',_0x8679('0x15')],_0x1b54a3[_0x8679('0x10')])){_0x1b54a3[_0x8679('0x13')]=moment(_0x1b54a3[_0x8679('0x13')])[_0x8679('0x16')](0x1,_0x8679('0x17'))[_0x8679('0x18')](_0x8679('0x19'));}}if(_0x1b54a3[_0x8679('0x1a')]){_0x265596=_0x1b54a3[_0x8679('0x1a')];_0x48e967[_0x8679('0x1b')]=_0x8679('0x1c')+_0x411e26+'.'+_0x1b54a3[_0x8679('0x1d')]+_0x8679('0x1e')+_0x1b54a3[_0x8679('0x1a')]+')\x20'+parseOperator(_0x1b54a3[_0x8679('0x10')]);}else{_0x48e967[_0x8679('0x1b')]=_0x411e26+'.'+_0x1b54a3['field']+'\x20'+parseOperator(_0x1b54a3['operator']);}if(_[_0x8679('0x14')]([_0x8679('0x1f'),_0x8679('0x20')],_0x1b54a3[_0x8679('0x10')]))_0x48e967['text']='('+_0x48e967['text']+_0x8679('0x21')+_0x411e26+'.'+_0x1b54a3[_0x8679('0x1d')]+_0x8679('0x22');_0x48e967[_0x8679('0x13')]=parseValue(_0x265596,_0x1b54a3[_0x8679('0x10')],_0x1b54a3[_0x8679('0x13')]);return _0x48e967;};function parseOperator(_0x41fc60){var _0x184d54;switch(_0x41fc60){case _0x8679('0x23'):_0x184d54=_0x8679('0x24');break;case _0x8679('0x20'):_0x184d54=_0x8679('0x25');break;case _0x8679('0x11'):_0x184d54=_0x8679('0x26');break;case _0x8679('0x1f'):_0x184d54='<>\x20?';break;case'$substring':case _0x8679('0x27'):case _0x8679('0x28'):_0x184d54=_0x8679('0x29');break;case _0x8679('0x2a'):_0x184d54=_0x8679('0x2b');break;case _0x8679('0x2c'):_0x184d54=_0x8679('0x2d');break;case _0x8679('0x15'):_0x184d54=_0x8679('0x2e');break;case _0x8679('0x2f'):_0x184d54=_0x8679('0x30');break;case _0x8679('0x12'):_0x184d54=_0x8679('0x31');break;}return _0x184d54;}function parseValue(_0x5b4e5d,_0x36c215,_0x3e75e1){var _0x2c1e80={'start':undefined,'end':undefined};switch(_0x36c215){case'$in':case'$notIn':_0x2c1e80[_0x8679('0x32')]=_0x3e75e1[_0x8679('0x8')](',');break;case _0x8679('0x33'):_0x2c1e80[_0x8679('0x32')]='%'+_0x3e75e1+'%';break;case _0x8679('0x27'):_0x2c1e80[_0x8679('0x32')]=_0x3e75e1+'%';break;case _0x8679('0x28'):_0x2c1e80[_0x8679('0x32')]='%'+_0x3e75e1;break;case _0x8679('0x12'):var _0x4ec08f=_0x3e75e1[_0x8679('0x8')](',');var _0x3e75e1=_0x4ec08f[_0x8679('0x34')]();var _0x53488b=_0x4ec08f['pop']();if(_0x5b4e5d==='DATE'){_0x3e75e1=moment(_0x3e75e1)['utcOffset'](0x0,!![])['format']();_0x53488b=moment(_0x53488b)[_0x8679('0x35')](0x0,!![])[_0x8679('0x16')](0x17,'hours')[_0x8679('0x16')](0x3b,_0x8679('0x36'))['add'](0x3b,_0x8679('0x37'))[_0x8679('0x18')]();}_0x2c1e80={'start':_0x3e75e1,'end':_0x53488b};break;default:_0x2c1e80[_0x8679('0x32')]=_0x3e75e1;break;}return _0x2c1e80;} \ No newline at end of file +var _0x46e5=['YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','field','includes','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','minutes','seconds','lodash','moment','sqlOperator','startsWith','[$or]','replace','[$and]','split','forEach','shift','match','map','conditions','DATE','operator','$between','value','$gt','add','format'];(function(_0x398b3e,_0x4dbf13){var _0x203a1b=function(_0x536b37){while(--_0x536b37){_0x398b3e['push'](_0x398b3e['shift']());}};_0x203a1b(++_0x4dbf13);}(_0x46e5,0x118));var _0x546e=function(_0x471844,_0x43d9ef){_0x471844=_0x471844-0x0;var _0x1a4d64=_0x46e5[_0x471844];return _0x1a4d64;};'use strict';var _=require(_0x546e('0x0'));var moment=require(_0x546e('0x1'));exports['parseSearch']=function(_0x21e08c){var _0x15ea1e={'conditions':[]};_0x15ea1e[_0x546e('0x2')]=_[_0x546e('0x3')](_0x21e08c,_0x546e('0x4'))?'or':'and';var _0x1a59be=_0x21e08c[_0x546e('0x5')](_0x546e('0x6'),'')[_0x546e('0x5')](_0x546e('0x4'),'')['split']('||');for(var _0x3d9402=0x0;_0x3d9402<_0x1a59be['length'];_0x3d9402++){var _0x29c978=_0x1a59be[_0x3d9402][_0x546e('0x7')](':=');var _0x194075=_0x29c978[0x0];var _0x140400=_0x29c978['slice'](0x1);_0x140400[_0x546e('0x8')](function(_0x31918b){var _0x3b9d48=_0x31918b['split']('[')[_0x546e('0x9')]();var _0x170138=_0x31918b[_0x546e('0xa')](/\[(.*?)\]/g);_0x170138['forEach'](function(_0xfaa38){var _0x3b6adf=_0xfaa38[_0x546e('0x7')]('[')['filter'](function(_0x2de548){return _0x2de548['indexOf'](']')>-0x1;})[_0x546e('0xb')](function(_0x9e0050){return _0x9e0050[_0x546e('0x7')](']')[0x0];})[0x0];_0x15ea1e[_0x546e('0xc')]['push']({'field':_0x194075,'operator':_0x3b9d48,'value':_0x3b6adf});});});}return _0x15ea1e;};exports['buildExpression']=function(_0x3d9080,_0x13ff9d,_0x3fe6b0){var _0x561f37={};if(_0x13ff9d===_0x546e('0xd')){if(_0x3fe6b0['operator']==='$eq'){_0x3fe6b0[_0x546e('0xe')]=_0x546e('0xf');_0x3fe6b0[_0x546e('0x10')]+=','+_0x3fe6b0[_0x546e('0x10')];}else if(_['includes']([_0x546e('0x11'),'$lte'],_0x3fe6b0[_0x546e('0xe')])){_0x3fe6b0[_0x546e('0x10')]=moment(_0x3fe6b0[_0x546e('0x10')])[_0x546e('0x12')](0x1,'days')[_0x546e('0x13')](_0x546e('0x14'));}}if(_0x3fe6b0[_0x546e('0x15')]){_0x13ff9d=_0x3fe6b0['castTo'];_0x561f37[_0x546e('0x16')]=_0x546e('0x17')+_0x3d9080+'.'+_0x3fe6b0['field']+_0x546e('0x18')+_0x3fe6b0[_0x546e('0x15')]+')\x20'+parseOperator(_0x3fe6b0[_0x546e('0xe')]);}else{_0x561f37[_0x546e('0x16')]=_0x3d9080+'.'+_0x3fe6b0[_0x546e('0x19')]+'\x20'+parseOperator(_0x3fe6b0['operator']);}if(_[_0x546e('0x1a')]([_0x546e('0x1b'),_0x546e('0x1c')],_0x3fe6b0[_0x546e('0xe')]))_0x561f37[_0x546e('0x16')]='('+_0x561f37[_0x546e('0x16')]+'\x20OR\x20'+_0x3d9080+'.'+_0x3fe6b0[_0x546e('0x19')]+_0x546e('0x1d');_0x561f37[_0x546e('0x10')]=parseValue(_0x13ff9d,_0x3fe6b0[_0x546e('0xe')],_0x3fe6b0[_0x546e('0x10')]);return _0x561f37;};function parseOperator(_0x8b7dc0){var _0x4c7e48;switch(_0x8b7dc0){case _0x546e('0x1e'):_0x4c7e48=_0x546e('0x1f');break;case'$notIn':_0x4c7e48='NOT\x20IN\x20?';break;case'$eq':_0x4c7e48=_0x546e('0x20');break;case _0x546e('0x1b'):_0x4c7e48=_0x546e('0x21');break;case _0x546e('0x22'):case _0x546e('0x23'):case _0x546e('0x24'):_0x4c7e48=_0x546e('0x25');break;case _0x546e('0x26'):_0x4c7e48=_0x546e('0x27');break;case _0x546e('0x11'):_0x4c7e48='>\x20?';break;case'$lte':_0x4c7e48=_0x546e('0x28');break;case _0x546e('0x29'):_0x4c7e48=_0x546e('0x2a');break;case'$between':_0x4c7e48=_0x546e('0x2b');break;}return _0x4c7e48;}function parseValue(_0x3e57e9,_0x58179f,_0x4c6ea3){var _0x42d59d={'start':undefined,'end':undefined};switch(_0x58179f){case _0x546e('0x1e'):case _0x546e('0x1c'):_0x42d59d[_0x546e('0x2c')]=_0x4c6ea3[_0x546e('0x7')](',');break;case'$substring':_0x42d59d['start']='%'+_0x4c6ea3+'%';break;case'$startsWith':_0x42d59d['start']=_0x4c6ea3+'%';break;case'$endsWith':_0x42d59d[_0x546e('0x2c')]='%'+_0x4c6ea3;break;case _0x546e('0xf'):var _0x490314=_0x4c6ea3[_0x546e('0x7')](',');var _0x4c6ea3=_0x490314[_0x546e('0x9')]();var _0x5f26a9=_0x490314[_0x546e('0x2d')]();if(_0x3e57e9===_0x546e('0xd')){_0x4c6ea3=moment(_0x4c6ea3)[_0x546e('0x2e')](0x0,!![])[_0x546e('0x13')]();_0x5f26a9=moment(_0x5f26a9)[_0x546e('0x2e')](0x0,!![])['add'](0x17,_0x546e('0x2f'))[_0x546e('0x12')](0x3b,_0x546e('0x30'))[_0x546e('0x12')](0x3b,_0x546e('0x31'))[_0x546e('0x13')]();}_0x42d59d={'start':_0x4c6ea3,'end':_0x5f26a9};break;default:_0x42d59d['start']=_0x4c6ea3;break;}return _0x42d59d;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index ac9e521..a39222a 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 _0x9f7f=['unsigned','substr','DESC','ASC','isEmpty','length','omit','isObject','isString','unset','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','push','join','lodash','moment','fields','split','filters','forOwn','find','type','DATE','isPlainObject','parse','$gte','YYYY-MM-DD','utc','format','subtract','name','isArray','limit','sort','map','indexOf','priority','cast','col'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f7f,0x114));var _0xf9f7=function(_0x1469a5,_0x212533){_0x1469a5=_0x1469a5-0x0;var _0x2745a9=_0x9f7f[_0x1469a5];return _0x2745a9;};'use strict';var _=require(_0xf9f7('0x0'));var sequelize=require('sequelize');var moment=require(_0xf9f7('0x1'));var LIMIT_VALUE=0xfa;exports[_0xf9f7('0x2')]=function(_0x4377a3){var _0x628922=null;if(_0x4377a3){_0x628922=_0x4377a3[_0xf9f7('0x3')](',');}return _0x628922;};exports[_0xf9f7('0x4')]=function(_0x5c961b,_0x102038){var _0x3940f9={};if(!_['isEmpty'](_0x5c961b)){_[_0xf9f7('0x5')](_0x5c961b,function(_0x26acca,_0x4ce051){try{if(_0x102038){var _0x103467=_[_0xf9f7('0x6')](_0x102038,{'name':_0x4ce051})||{};if(_0x103467[_0xf9f7('0x7')]===_0xf9f7('0x8')&&_[_0xf9f7('0x9')](_0x26acca)){var _0x4da372=JSON[_0xf9f7('0xa')](_0x26acca);var _0x4a4aae={'$gte':moment(moment(_0x4da372[_0xf9f7('0xb')])['format'](_0xf9f7('0xc')))[_0xf9f7('0xd')]()[_0xf9f7('0xe')](),'$lte':moment(moment(_0x4da372['$lte'])[_0xf9f7('0xe')]('YYYY-MM-DD'))['utc']()[_0xf9f7('0xf')](0x1,'s')['format']()};_0x3940f9[_0x4ce051]=_0x4a4aae;}else if(_0x103467[_0xf9f7('0x10')]==='uniqueid'){_0x3940f9[_0x4ce051]=_0x26acca;}else{_0x3940f9[_0x4ce051]=_[_0xf9f7('0x11')](_0x26acca)?_0x26acca:JSON[_0xf9f7('0xa')](_0x26acca);}}else{_0x3940f9[_0x4ce051]=_[_0xf9f7('0x11')](_0x26acca)?_0x26acca:JSON[_0xf9f7('0xa')](_0x26acca);}}catch(_0x996b6c){_0x3940f9[_0x4ce051]=_0x26acca[_0xf9f7('0x3')](',');}});}return _0x3940f9;};exports[_0xf9f7('0x12')]=function(_0x4d2b1e){_0x4d2b1e=parseInt(_0x4d2b1e,0xa);if(!_0x4d2b1e||_0x4d2b1e<0x0){_0x4d2b1e=LIMIT_VALUE;}return _0x4d2b1e;};exports['offset']=function(_0x460a2b){_0x460a2b=parseInt(_0x460a2b,0xa);if(!_0x460a2b||_0x460a2b<0x0){_0x460a2b=0x0;}return _0x460a2b;};exports[_0xf9f7('0x13')]=function(_0x4dde42){var _0x1c0747,_0x97c327=null;if(_0x4dde42){_0x1c0747=_0x4dde42[_0xf9f7('0x3')](',');_0x97c327=_[_0xf9f7('0x14')](_0x1c0747,function(_0xead088){if(_0xead088[_0xf9f7('0x15')]('-')===0x0){return[_0xead088===_0xf9f7('0x16')?sequelize[_0xf9f7('0x17')](sequelize[_0xf9f7('0x18')](_0xf9f7('0x16')),_0xf9f7('0x19')):_0xead088[_0xf9f7('0x1a')](0x1),_0xf9f7('0x1b')];}else{return[_0xead088===_0xf9f7('0x16')?sequelize[_0xf9f7('0x17')](sequelize['col'](_0xf9f7('0x16')),_0xf9f7('0x19')):_0xead088,_0xf9f7('0x1c')];}});}return _0x97c327;};exports['omit']=function(_0x1dd923,_0xec54b1){if(_[_0xf9f7('0x1d')](_0x1dd923)){return _0x1dd923;}if(_[_0xf9f7('0x11')](_0x1dd923)){for(var _0xa5fd06=0x0;_0xa5fd06<_0x1dd923[_0xf9f7('0x1e')];_0xa5fd06+=0x1){_0x1dd923[_0xa5fd06]=this[_0xf9f7('0x1f')](_0x1dd923[_0xa5fd06],_0xec54b1);}return _0x1dd923;}if(!_[_0xf9f7('0x20')](_0x1dd923)){return _0x1dd923;}if(_[_0xf9f7('0x21')](_0xec54b1)){_0xec54b1=[_0xec54b1];}if(!_[_0xf9f7('0x11')](_0xec54b1)){return _0x1dd923;}for(var _0x3bd6ed=0x0;_0x3bd6ed<_0xec54b1[_0xf9f7('0x1e')];_0x3bd6ed+=0x1){_[_0xf9f7('0x22')](_0x1dd923,_0xec54b1[_0x3bd6ed]);}for(var _0x414634 in _0x1dd923){if(_0x1dd923[_0xf9f7('0x23')](_0x414634)){_0x1dd923[_0x414634]=this[_0xf9f7('0x1f')](_0x1dd923[_0x414634],_0xec54b1);}}return _0x1dd923;};exports['isNumeric']=function(_0x3d0a70){return _0x3d0a70[_0xf9f7('0x24')](RegExp(_0xf9f7('0x25')))?!![]:![];};exports[_0xf9f7('0x26')]=function(_0x3d17df){return _0x3d17df[_0xf9f7('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0xf9f7('0x27')]=function(_0x3395a3){var _0x1689fe=[];_0x3395a3[_0xf9f7('0x3')](/[ ,]+/)[_0xf9f7('0x28')](function(_0x53aaa0){_0x53aaa0=_0x53aaa0['replace'](/([^:]")"+/g,'$1');_0x53aaa0='+'+_0x53aaa0+'*';if(_0x53aaa0['includes']('@'))_0x53aaa0='\x22'+_0x53aaa0+'\x22';_0x1689fe[_0xf9f7('0x29')](_0x53aaa0);});return _0x1689fe[_0xf9f7('0x2a')]('\x20');}; \ No newline at end of file +var _0xa2c0=['cast','col','priority','unsigned','substr','DESC','ASC','omit','length','isObject','isString','unset','hasOwnProperty','match','isEmail','forEach','includes','join','sequelize','moment','fields','split','find','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','$lte','format','subtract','name','uniqueid','isArray','parse','limit','sort','map','indexOf'];(function(_0x2a94cf,_0x2b970d){var _0x22147f=function(_0xfc71ab){while(--_0xfc71ab){_0x2a94cf['push'](_0x2a94cf['shift']());}};_0x22147f(++_0x2b970d);}(_0xa2c0,0x198));var _0x0a2c=function(_0xb9dece,_0x4ec0d3){_0xb9dece=_0xb9dece-0x0;var _0x235f0c=_0xa2c0[_0xb9dece];return _0x235f0c;};'use strict';var _=require('lodash');var sequelize=require(_0x0a2c('0x0'));var moment=require(_0x0a2c('0x1'));var LIMIT_VALUE=0xfa;exports[_0x0a2c('0x2')]=function(_0x47d137){var _0x34d879=null;if(_0x47d137){_0x34d879=_0x47d137[_0x0a2c('0x3')](',');}return _0x34d879;};exports['filters']=function(_0x24f130,_0x3d84d4){var _0x376b3f={};if(!_['isEmpty'](_0x24f130)){_['forOwn'](_0x24f130,function(_0x38291d,_0x4a54d4){try{if(_0x3d84d4){var _0x1db085=_[_0x0a2c('0x4')](_0x3d84d4,{'name':_0x4a54d4})||{};if(_0x1db085['type']===_0x0a2c('0x5')&&_[_0x0a2c('0x6')](_0x38291d)){var _0x33ed6a=JSON['parse'](_0x38291d);var _0x3e1a31={'$gte':moment(moment(_0x33ed6a[_0x0a2c('0x7')])['format'](_0x0a2c('0x8')))[_0x0a2c('0x9')]()['format'](),'$lte':moment(moment(_0x33ed6a[_0x0a2c('0xa')])[_0x0a2c('0xb')](_0x0a2c('0x8')))[_0x0a2c('0x9')]()[_0x0a2c('0xc')](0x1,'s')[_0x0a2c('0xb')]()};_0x376b3f[_0x4a54d4]=_0x3e1a31;}else if(_0x1db085[_0x0a2c('0xd')]===_0x0a2c('0xe')){_0x376b3f[_0x4a54d4]=_0x38291d;}else{_0x376b3f[_0x4a54d4]=_[_0x0a2c('0xf')](_0x38291d)?_0x38291d:JSON[_0x0a2c('0x10')](_0x38291d);}}else{_0x376b3f[_0x4a54d4]=_[_0x0a2c('0xf')](_0x38291d)?_0x38291d:JSON[_0x0a2c('0x10')](_0x38291d);}}catch(_0x53ccb5){_0x376b3f[_0x4a54d4]=_0x38291d[_0x0a2c('0x3')](',');}});}return _0x376b3f;};exports[_0x0a2c('0x11')]=function(_0x5b477d){_0x5b477d=parseInt(_0x5b477d,0xa);if(!_0x5b477d||_0x5b477d<0x0){_0x5b477d=LIMIT_VALUE;}return _0x5b477d;};exports['offset']=function(_0x58d12c){_0x58d12c=parseInt(_0x58d12c,0xa);if(!_0x58d12c||_0x58d12c<0x0){_0x58d12c=0x0;}return _0x58d12c;};exports[_0x0a2c('0x12')]=function(_0x158789){var _0x416c38,_0x1dce77=null;if(_0x158789){_0x416c38=_0x158789[_0x0a2c('0x3')](',');_0x1dce77=_[_0x0a2c('0x13')](_0x416c38,function(_0x1e09d2){if(_0x1e09d2[_0x0a2c('0x14')]('-')===0x0){return[_0x1e09d2==='priority'?sequelize[_0x0a2c('0x15')](sequelize[_0x0a2c('0x16')](_0x0a2c('0x17')),_0x0a2c('0x18')):_0x1e09d2[_0x0a2c('0x19')](0x1),_0x0a2c('0x1a')];}else{return[_0x1e09d2==='priority'?sequelize['cast'](sequelize[_0x0a2c('0x16')](_0x0a2c('0x17')),'unsigned'):_0x1e09d2,_0x0a2c('0x1b')];}});}return _0x1dce77;};exports[_0x0a2c('0x1c')]=function(_0x404ae6,_0x204441){if(_['isEmpty'](_0x404ae6)){return _0x404ae6;}if(_[_0x0a2c('0xf')](_0x404ae6)){for(var _0x5b6660=0x0;_0x5b6660<_0x404ae6[_0x0a2c('0x1d')];_0x5b6660+=0x1){_0x404ae6[_0x5b6660]=this[_0x0a2c('0x1c')](_0x404ae6[_0x5b6660],_0x204441);}return _0x404ae6;}if(!_[_0x0a2c('0x1e')](_0x404ae6)){return _0x404ae6;}if(_[_0x0a2c('0x1f')](_0x204441)){_0x204441=[_0x204441];}if(!_['isArray'](_0x204441)){return _0x404ae6;}for(var _0x5be6bd=0x0;_0x5be6bd<_0x204441[_0x0a2c('0x1d')];_0x5be6bd+=0x1){_[_0x0a2c('0x20')](_0x404ae6,_0x204441[_0x5be6bd]);}for(var _0x5c7aa5 in _0x404ae6){if(_0x404ae6[_0x0a2c('0x21')](_0x5c7aa5)){_0x404ae6[_0x5c7aa5]=this['omit'](_0x404ae6[_0x5c7aa5],_0x204441);}}return _0x404ae6;};exports['isNumeric']=function(_0x2359ee){return _0x2359ee[_0x0a2c('0x22')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x0a2c('0x23')]=function(_0x5a4a89){return _0x5a4a89['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0xc5d623){var _0x10d5bc=[];_0xc5d623[_0x0a2c('0x3')](/[ ,]+/)[_0x0a2c('0x24')](function(_0x5b62ea){_0x5b62ea=_0x5b62ea['replace'](/([^:]")"+/g,'$1');_0x5b62ea='+'+_0x5b62ea+'*';if(_0x5b62ea[_0x0a2c('0x25')]('@'))_0x5b62ea='\x22'+_0x5b62ea+'\x22';_0x10d5bc['push'](_0x5b62ea);});return _0x10d5bc[_0x0a2c('0x26')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 2b4bfc1..7a2127d 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ea1=['json','50mb','express','serve-favicon','body-parser','cookie-parser','errorhandler','path','cors','./environment','default','get','production','appPath','root','development','test','join','set','toISOString','use','static','views','/server/views','engine','html','renderFile','urlencoded'];(function(_0x242587,_0x2fb7e8){var _0x163c4b=function(_0x5e536b){while(--_0x5e536b){_0x242587['push'](_0x242587['shift']());}};_0x163c4b(++_0x2fb7e8);}(_0x1ea1,0x11a));var _0x11ea=function(_0x2aee0b,_0x3baf9a){_0x2aee0b=_0x2aee0b-0x0;var _0x3b8a8b=_0x1ea1[_0x2aee0b];return _0x3b8a8b;};'use strict';var express=require(_0x11ea('0x0'));var favicon=require(_0x11ea('0x1'));var bodyParser=require(_0x11ea('0x2'));var methodOverride=require('method-override');var cookieParser=require(_0x11ea('0x3'));var errorHandler=require(_0x11ea('0x4'));var path=require(_0x11ea('0x5'));var passport=require('passport');var cors=require(_0x11ea('0x6'));var moment=require('moment');var config=require(_0x11ea('0x7'));var db=require('../mysqldb')['db'];exports[_0x11ea('0x8')]=function(_0x100122){var _0x18c176=_0x100122[_0x11ea('0x9')]('env');if(_0x18c176===_0x11ea('0xa')){_0x100122['set'](_0x11ea('0xb'),path['join'](config[_0x11ea('0xc')],'public'));}if(_0x18c176===_0x11ea('0xd')||_0x18c176===_0x11ea('0xe')){_0x100122['set'](_0x11ea('0xb'),path[_0x11ea('0xf')](config[_0x11ea('0xc')],'client'));_0x100122['use'](errorHandler());}_0x100122[_0x11ea('0x10')]('json\x20replacer',function(_0x453fa7,_0x1521bf){if(this[_0x453fa7]instanceof Date){_0x1521bf=this[_0x453fa7][_0x11ea('0x11')]()['split']('.')[0x0]+'Z';}return _0x1521bf;});_0x100122[_0x11ea('0x12')](express[_0x11ea('0x13')](_0x100122[_0x11ea('0x9')](_0x11ea('0xb'))));_0x100122[_0x11ea('0x10')](_0x11ea('0x14'),config[_0x11ea('0xc')]+_0x11ea('0x15'));_0x100122[_0x11ea('0x16')](_0x11ea('0x17'),require('ejs')[_0x11ea('0x18')]);_0x100122[_0x11ea('0x10')]('view\x20engine','html');_0x100122['use'](bodyParser[_0x11ea('0x19')]({'limit':'50mb','extended':!![]}));_0x100122[_0x11ea('0x12')](bodyParser[_0x11ea('0x1a')]({'limit':_0x11ea('0x1b')}));_0x100122[_0x11ea('0x12')](cors());_0x100122[_0x11ea('0x12')](methodOverride());_0x100122[_0x11ea('0x12')](cookieParser());_0x100122[_0x11ea('0x12')](passport['initialize']());}; \ No newline at end of file +var _0x6453=['public','test','set','toISOString','split','use','static','/server/views','engine','ejs','renderFile','view\x20engine','html','urlencoded','50mb','json','initialize','express','cookie-parser','errorhandler','path','passport','cors','moment','../mysqldb','default','get','env','production','appPath','root'];(function(_0x265e31,_0x3ea28b){var _0x4812b7=function(_0x2b7e2d){while(--_0x2b7e2d){_0x265e31['push'](_0x265e31['shift']());}};_0x4812b7(++_0x3ea28b);}(_0x6453,0x1a4));var _0x3645=function(_0x3815c2,_0x1f54e3){_0x3815c2=_0x3815c2-0x0;var _0x271f88=_0x6453[_0x3815c2];return _0x271f88;};'use strict';var express=require(_0x3645('0x0'));var favicon=require('serve-favicon');var bodyParser=require('body-parser');var methodOverride=require('method-override');var cookieParser=require(_0x3645('0x1'));var errorHandler=require(_0x3645('0x2'));var path=require(_0x3645('0x3'));var passport=require(_0x3645('0x4'));var cors=require(_0x3645('0x5'));var moment=require(_0x3645('0x6'));var config=require('./environment');var db=require(_0x3645('0x7'))['db'];exports[_0x3645('0x8')]=function(_0x54f431){var _0x1e2da7=_0x54f431[_0x3645('0x9')](_0x3645('0xa'));if(_0x1e2da7===_0x3645('0xb')){_0x54f431['set'](_0x3645('0xc'),path['join'](config[_0x3645('0xd')],_0x3645('0xe')));}if(_0x1e2da7==='development'||_0x1e2da7===_0x3645('0xf')){_0x54f431[_0x3645('0x10')](_0x3645('0xc'),path['join'](config[_0x3645('0xd')],'client'));_0x54f431['use'](errorHandler());}_0x54f431[_0x3645('0x10')]('json\x20replacer',function(_0x514478,_0x322de8){if(this[_0x514478]instanceof Date){_0x322de8=this[_0x514478][_0x3645('0x11')]()[_0x3645('0x12')]('.')[0x0]+'Z';}return _0x322de8;});_0x54f431[_0x3645('0x13')](express[_0x3645('0x14')](_0x54f431[_0x3645('0x9')](_0x3645('0xc'))));_0x54f431[_0x3645('0x10')]('views',config[_0x3645('0xd')]+_0x3645('0x15'));_0x54f431[_0x3645('0x16')]('html',require(_0x3645('0x17'))[_0x3645('0x18')]);_0x54f431[_0x3645('0x10')](_0x3645('0x19'),_0x3645('0x1a'));_0x54f431['use'](bodyParser[_0x3645('0x1b')]({'limit':_0x3645('0x1c'),'extended':!![]}));_0x54f431[_0x3645('0x13')](bodyParser[_0x3645('0x1d')]({'limit':_0x3645('0x1c')}));_0x54f431[_0x3645('0x13')](cors());_0x54f431[_0x3645('0x13')](methodOverride());_0x54f431['use'](cookieParser());_0x54f431['use'](passport[_0x3645('0x1e')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 089a6b0..b2f9bc6 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 _0x6108=['bimedia-machine-uuid','child_process','execSync','networkInterfaces','length','filter','family','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','orderBy','cpus','join','createHash','md5','update','digest','platform','win32','dmidecode\x20--string\x20system-uuid','hostname','macAddress','substring','lodash'];(function(_0xe8fa34,_0x401d83){var _0x28251b=function(_0x23843d){while(--_0x23843d){_0xe8fa34['push'](_0xe8fa34['shift']());}};_0x28251b(++_0x401d83);}(_0x6108,0xbc));var _0x8610=function(_0x2610c2,_0x2b75cf){_0x2610c2=_0x2610c2-0x0;var _0x30c764=_0x6108[_0x2610c2];return _0x30c764;};'use strict';var _=require(_0x8610('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x8610('0x1'));var exec=require(_0x8610('0x2'))[_0x8610('0x3')];function getInterfaces(){var _0x49e7c9=[];var _0x4a9c20=os[_0x8610('0x4')]();var _0x42741d=_['orderBy'](_['keys'](_0x4a9c20));for(var _0xad3a5f=0x0;_0xad3a5f<_0x42741d[_0x8610('0x5')];_0xad3a5f++){var _0x28a680=_0x4a9c20[_0x42741d[_0xad3a5f]][_0x8610('0x6')](function(_0x4e0fe4){return _0x4e0fe4[_0x8610('0x7')]==='IPv4'&&_0x4e0fe4[_0x8610('0x8')]===![];});_0x49e7c9=_0x49e7c9[_0x8610('0x9')](_0x28a680);}return _0x49e7c9;}function getFirstInterface(){var _0x21774e=_['head'](getInterfaces());return{'macAddress':_0x21774e&&_0x21774e[_0x8610('0xa')]?_0x21774e[_0x8610('0xa')]:_0x8610('0xb'),'ipAddress':_0x21774e&&_0x21774e[_0x8610('0xc')]?_0x21774e[_0x8610('0xc')]:_0x8610('0xd')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x1b6c16=_[_0x8610('0xe')](os[_0x8610('0xf')]()['map'](function(_0xc18be9){return _0xc18be9['model'];}))[_0x8610('0x10')](':');return crypto[_0x8610('0x11')](_0x8610('0x12'))[_0x8610('0x13')](_0x1b6c16)[_0x8610('0x14')]('hex');}exports['getUuid']=function(){switch(os[_0x8610('0x15')]()){case _0x8610('0x16'):return exec(_0x8610('0x17'),{'encoding':'utf8'})['replace']('\x0d\x0a','');default:var _0x57e567=getFirstInterface();var _0x3d94c2=getCPUhash();var _0x21c500=_0x3d94c2+'|'+os[_0x8610('0x18')]()+'|'+_0x57e567[_0x8610('0x19')]+'|'+_0x57e567['ipAddress'];var _0x52ac1f=crypto[_0x8610('0x11')]('md5')['update'](_0x21c500)[_0x8610('0x14')]('hex');return _0x52ac1f['substring'](0x0,0x8)+'-'+_0x52ac1f[_0x8610('0x1a')](0x8,0xc)+'-'+_0x52ac1f[_0x8610('0x1a')](0xc,0x10)+'-'+_0x52ac1f['substring'](0x10,0x14)+'-'+_0x52ac1f[_0x8610('0x1a')](0x14);}}; \ No newline at end of file +var _0xf52f=['orderBy','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','model','join','createHash','md5','getUuid','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','update','digest','substring','lodash','crypto','bimedia-machine-uuid','execSync'];(function(_0x294437,_0x53b662){var _0x1e3cf1=function(_0x1d8442){while(--_0x1d8442){_0x294437['push'](_0x294437['shift']());}};_0x1e3cf1(++_0x53b662);}(_0xf52f,0x113));var _0xff52=function(_0x2daf7b,_0x310791){_0x2daf7b=_0x2daf7b-0x0;var _0x4a1f8c=_0xf52f[_0x2daf7b];return _0x4a1f8c;};'use strict';var _=require(_0xff52('0x0'));var os=require('os');var crypto=require(_0xff52('0x1'));var machine=require(_0xff52('0x2'));var exec=require('child_process')[_0xff52('0x3')];function getInterfaces(){var _0x42c1e4=[];var _0x31f278=os['networkInterfaces']();var _0x23d018=_[_0xff52('0x4')](_['keys'](_0x31f278));for(var _0x8aa64e=0x0;_0x8aa64e<_0x23d018[_0xff52('0x5')];_0x8aa64e++){var _0x2f8c21=_0x31f278[_0x23d018[_0x8aa64e]][_0xff52('0x6')](function(_0x64f10b){return _0x64f10b[_0xff52('0x7')]===_0xff52('0x8')&&_0x64f10b[_0xff52('0x9')]===![];});_0x42c1e4=_0x42c1e4[_0xff52('0xa')](_0x2f8c21);}return _0x42c1e4;}function getFirstInterface(){var _0x12c89d=_[_0xff52('0xb')](getInterfaces());return{'macAddress':_0x12c89d&&_0x12c89d[_0xff52('0xc')]?_0x12c89d[_0xff52('0xc')]:_0xff52('0xd'),'ipAddress':_0x12c89d&&_0x12c89d[_0xff52('0xe')]?_0x12c89d[_0xff52('0xe')]:_0xff52('0xf')};}exports[_0xff52('0x10')]=getFirstInterface;function getCPUhash(){var _0x3a4856=_['orderBy'](os['cpus']()[_0xff52('0x11')](function(_0x53f40b){return _0x53f40b[_0xff52('0x12')];}))[_0xff52('0x13')](':');return crypto[_0xff52('0x14')](_0xff52('0x15'))['update'](_0x3a4856)['digest']('hex');}exports[_0xff52('0x16')]=function(){switch(os['platform']()){case'win32':return exec(_0xff52('0x17'),{'encoding':_0xff52('0x18')})[_0xff52('0x19')]('\x0d\x0a','');default:var _0x440701=getFirstInterface();var _0x1dff86=getCPUhash();var _0x52735f=_0x1dff86+'|'+os[_0xff52('0x1a')]()+'|'+_0x440701['macAddress']+'|'+_0x440701[_0xff52('0x1b')];var _0x4794a8=crypto['createHash'](_0xff52('0x15'))[_0xff52('0x1c')](_0x52735f)[_0xff52('0x1d')]('hex');return _0x4794a8['substring'](0x0,0x8)+'-'+_0x4794a8[_0xff52('0x1e')](0x8,0xc)+'-'+_0x4794a8[_0xff52('0x1e')](0xc,0x10)+'-'+_0x4794a8[_0xff52('0x1e')](0x10,0x14)+'-'+_0x4794a8[_0xff52('0x1e')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index b380f4c..e705b47 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 _0xd4cd=['util','moment','request-promise','bluebird','pkginfo','version','./hardware','../logger','license','../../api/jira/jira.controller','process','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','||FIELD||VALUE||\x0a','findOne','admin','email','|reason|','|uuid|','|machineUuid|','|name|','fullname','|email|','getFirstInterface','ipAddress','openIssue','Motion\x20License\x20Alert','Alert','get','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd4cd,0x127));var _0xdd4c=function(_0x1e175d,_0x41ff45){_0x1e175d=_0x1e175d-0x0;var _0x3a3ce5=_0xd4cd[_0x1e175d];return _0x3a3ce5;};'use strict';var util=require(_0xdd4c('0x0'));var moment=require(_0xdd4c('0x1'));var rp=require(_0xdd4c('0x2'));var BPromise=require(_0xdd4c('0x3'));var pkginfo=require(_0xdd4c('0x4'))(module,_0xdd4c('0x5'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xdd4c('0x6'));var logger=require(_0xdd4c('0x7'))(_0xdd4c('0x8'));var jira=require(_0xdd4c('0x9'));const {config}=require(_0xdd4c('0xa'));var HOST=_0xdd4c('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x5dbc7b){return new BPromise(function(_0x21f3a0,_0x1f9d48){var _0x507fa8=util['format'](_0xdd4c('0xc'),HOST,_0x5dbc7b,module[_0xdd4c('0xd')][_0xdd4c('0x5')]);if(oldToken){_0x507fa8=util[_0xdd4c('0xe')](_0xdd4c('0xf'),HOST,_0x5dbc7b,module['exports'][_0xdd4c('0x5')],oldToken);}var _0x1096ac={'uri':_0x507fa8,'method':_0xdd4c('0x10'),'timeout':0xea60,'json':!![]};return rp(_0x1096ac)[_0xdd4c('0x11')](function(_0x578db3){_0x21f3a0(_0x578db3);})[_0xdd4c('0x12')](function(_0x5b464a){_0x1f9d48(_0x5b464a);});});}function sendJiraAlert(_0x1ca7a3,_0x371a1f,_0xfcbd98){var _0x5deeac=_0xdd4c('0x13');return db['User'][_0xdd4c('0x14')]({'where':{'role':_0xdd4c('0x15')},'attributes':['fullname',_0xdd4c('0x16')],'raw':!![]})[_0xdd4c('0x11')](function(_0x43f00a){ADMIN=_0x43f00a;_0x5deeac+=_0xdd4c('0x17')+_0xfcbd98+'|\x0a';_0x5deeac+=_0xdd4c('0x18')+_0x1ca7a3+'|\x0a';_0x5deeac+=_0xdd4c('0x19')+_0x371a1f+'|\x0a';_0x5deeac+=_0xdd4c('0x1a')+ADMIN[_0xdd4c('0x1b')]+'|\x0a';_0x5deeac+=_0xdd4c('0x1c')+ADMIN[_0xdd4c('0x16')]+'|\x0a';return _0x5deeac;})['then'](function(_0x4ff4b1){var _0x4c7340=hardware[_0xdd4c('0x1d')]()[_0xdd4c('0x1e')];return jira[_0xdd4c('0x1f')]({'key':'MOTLICENSE','summary':_0xdd4c('0x20'),'description':_0x4ff4b1,'issuetype':_0xdd4c('0x21'),'oldToken':_0x1ca7a3,'newToken':_0x371a1f,'email':ADMIN[_0xdd4c('0x16')],'name':ADMIN[_0xdd4c('0x1b')],'reason':GRAY_PERIOD_REASON,'ip':_0x4c7340});});}function manageLicense(_0xd47bca,_0x436d79){var _0x2b11a7=_0x436d79[_0xdd4c('0x22')]({'plain':!![]});httpRequest(_0xd47bca)[_0xdd4c('0x11')](function(_0x3c7214){if(oldToken){oldToken=undefined;}if(_0x3c7214['active']){if(!_0x2b11a7[_0xdd4c('0x8')]&&_0x2b11a7[_0xdd4c('0x8')]!=_0x3c7214[_0xdd4c('0x8')]||_0x2b11a7[_0xdd4c('0x8')]&&_0x2b11a7[_0xdd4c('0x23')]){logger[_0xdd4c('0x24')](_0xdd4c('0x25'));}if(_0x2b11a7[_0xdd4c('0x8')]&&!_0x2b11a7[_0xdd4c('0x23')]&&_0x2b11a7[_0xdd4c('0x8')]!=_0x3c7214['license']){logger[_0xdd4c('0x24')](_0xdd4c('0x26'));}if(_0x2b11a7[_0xdd4c('0x8')]&&!_0x2b11a7[_0xdd4c('0x23')]&&_0x2b11a7[_0xdd4c('0x8')]==_0x3c7214['license']){return _0x436d79;}return _0x436d79[_0xdd4c('0x27')]({'data1':_0xd47bca,'data2':null,'license':_0x3c7214[_0xdd4c('0x8')]});}else{if(_0x3c7214[_0xdd4c('0x8')]||_0x2b11a7['license']){if(!_0x2b11a7[_0xdd4c('0x23')]){if(_0x2b11a7[_0xdd4c('0x28')]==_0xd47bca){GRAY_PERIOD_REASON=_0xdd4c('0x29');logger[_0xdd4c('0x24')](_0xdd4c('0x2a'));}else{GRAY_PERIOD_REASON=_0xdd4c('0x2b');oldToken=_0x2b11a7[_0xdd4c('0x28')];logger[_0xdd4c('0x24')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2b11a7['data1'],_0xd47bca);}sendJiraAlert(_0x2b11a7[_0xdd4c('0x28')],_0x3c7214['uuid'],GRAY_PERIOD_REASON);logger[_0xdd4c('0x24')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xdd4c('0x2c')](),moment()[_0xdd4c('0xe')](_0xdd4c('0x2d')));return _0x436d79[_0xdd4c('0x27')]({'data2':encryptor[_0xdd4c('0x2e')](moment()[_0xdd4c('0xe')](_0xdd4c('0x2d')))});}else{if(moment()[_0xdd4c('0x2f')](encryptor[_0xdd4c('0x30')](_0x2b11a7[_0xdd4c('0x23')]),_0xdd4c('0x31'))>DAYS){logger[_0xdd4c('0x24')](_0xdd4c('0x32'),moment()['format'](_0xdd4c('0x2d')));return _0x436d79[_0xdd4c('0x27')]({'data1':_0xd47bca,'data2':null,'license':null});}}}else{if(_0x2b11a7[_0xdd4c('0x28')]!=_0xd47bca){logger[_0xdd4c('0x24')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2b11a7[_0xdd4c('0x28')],_0xd47bca);return _0x436d79[_0xdd4c('0x27')]({'data1':_0xd47bca,'data2':null,'license':null});}}}return _0x436d79;})[_0xdd4c('0x11')](function(_0x3b5152){_0x436d79=_0x3b5152;})[_0xdd4c('0x12')](function(_0x599b07){logger[_0xdd4c('0x33')](_0x599b07[_0xdd4c('0x34')]);})[_0xdd4c('0x35')](function(){setTimeout(function(){manageLicense(hardware[_0xdd4c('0x36')](),_0x436d79);},TIME);});}function defaultLicense(){var _0x3b41ab=hardware['getUuid']();if(_0x3b41ab){return db[_0xdd4c('0x37')][_0xdd4c('0x38')]({'where':{'id':0x1},'defaults':{'data1':_0x3b41ab}})[_0xdd4c('0x39')](function(_0x16a984,_0x538d0d){logger['info'](_0xdd4c('0x3a'),_0x3b41ab);manageLicense(_0x3b41ab,_0x16a984);})[_0xdd4c('0x12')](function(_0x55e95b){logger[_0xdd4c('0x33')](_0x55e95b[_0xdd4c('0x34')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x5e32=['GET','then','catch','||FIELD||VALUE||\x0a','User','findOne','admin','email','|reason|','|uuid|','|machineUuid|','|name|','|email|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','active','data2','info','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','data1','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','../../api/jira/jira.controller','process','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports'];(function(_0xe01d77,_0xfa89f5){var _0x5f3692=function(_0x4c00b7){while(--_0x4c00b7){_0xe01d77['push'](_0xe01d77['shift']());}};_0x5f3692(++_0xfa89f5);}(_0x5e32,0x13a));var _0x25e3=function(_0xaadc70,_0x2c050d){_0xaadc70=_0xaadc70-0x0;var _0x3ac647=_0x5e32[_0xaadc70];return _0x3ac647;};'use strict';var util=require('util');var moment=require(_0x25e3('0x0'));var rp=require(_0x25e3('0x1'));var BPromise=require(_0x25e3('0x2'));var pkginfo=require(_0x25e3('0x3'))(module,_0x25e3('0x4'));var db=require(_0x25e3('0x5'))['db'];var encryptor=require(_0x25e3('0x6'));var hardware=require(_0x25e3('0x7'));var logger=require(_0x25e3('0x8'))(_0x25e3('0x9'));var jira=require(_0x25e3('0xa'));const {config}=require(_0x25e3('0xb'));var HOST=_0x25e3('0xc');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x50151c){return new BPromise(function(_0x5049a4,_0x29794c){var _0x31c3a4=util[_0x25e3('0xd')](_0x25e3('0xe'),HOST,_0x50151c,module[_0x25e3('0xf')][_0x25e3('0x4')]);if(oldToken){_0x31c3a4=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x50151c,module[_0x25e3('0xf')][_0x25e3('0x4')],oldToken);}var _0x4e19a5={'uri':_0x31c3a4,'method':_0x25e3('0x10'),'timeout':0xea60,'json':!![]};return rp(_0x4e19a5)[_0x25e3('0x11')](function(_0x49a8ae){_0x5049a4(_0x49a8ae);})[_0x25e3('0x12')](function(_0x4292bc){_0x29794c(_0x4292bc);});});}function sendJiraAlert(_0x57d15c,_0x43ee85,_0x4c3695){var _0x26f1b4=_0x25e3('0x13');return db[_0x25e3('0x14')][_0x25e3('0x15')]({'where':{'role':_0x25e3('0x16')},'attributes':['fullname',_0x25e3('0x17')],'raw':!![]})[_0x25e3('0x11')](function(_0x161f97){ADMIN=_0x161f97;_0x26f1b4+=_0x25e3('0x18')+_0x4c3695+'|\x0a';_0x26f1b4+=_0x25e3('0x19')+_0x57d15c+'|\x0a';_0x26f1b4+=_0x25e3('0x1a')+_0x43ee85+'|\x0a';_0x26f1b4+=_0x25e3('0x1b')+ADMIN['fullname']+'|\x0a';_0x26f1b4+=_0x25e3('0x1c')+ADMIN['email']+'|\x0a';return _0x26f1b4;})[_0x25e3('0x11')](function(_0x4f3b33){var _0x2befd6=hardware[_0x25e3('0x1d')]()[_0x25e3('0x1e')];return jira[_0x25e3('0x1f')]({'key':_0x25e3('0x20'),'summary':'Motion\x20License\x20Alert','description':_0x4f3b33,'issuetype':'Alert','oldToken':_0x57d15c,'newToken':_0x43ee85,'email':ADMIN[_0x25e3('0x17')],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x2befd6});});}function manageLicense(_0x4f5253,_0x1ea015){var _0x4de5e4=_0x1ea015['get']({'plain':!![]});httpRequest(_0x4f5253)[_0x25e3('0x11')](function(_0x5c43d5){if(oldToken){oldToken=undefined;}if(_0x5c43d5[_0x25e3('0x21')]){if(!_0x4de5e4[_0x25e3('0x9')]&&_0x4de5e4[_0x25e3('0x9')]!=_0x5c43d5['license']||_0x4de5e4['license']&&_0x4de5e4[_0x25e3('0x22')]){logger[_0x25e3('0x23')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x4de5e4[_0x25e3('0x9')]&&!_0x4de5e4['data2']&&_0x4de5e4['license']!=_0x5c43d5[_0x25e3('0x9')]){logger[_0x25e3('0x23')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x4de5e4['license']&&!_0x4de5e4[_0x25e3('0x22')]&&_0x4de5e4['license']==_0x5c43d5['license']){return _0x1ea015;}return _0x1ea015[_0x25e3('0x24')]({'data1':_0x4f5253,'data2':null,'license':_0x5c43d5[_0x25e3('0x9')]});}else{if(_0x5c43d5[_0x25e3('0x9')]||_0x4de5e4['license']){if(!_0x4de5e4[_0x25e3('0x22')]){if(_0x4de5e4['data1']==_0x4f5253){GRAY_PERIOD_REASON='Disabled';logger[_0x25e3('0x23')](_0x25e3('0x25'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x4de5e4['data1'];logger['info'](_0x25e3('0x26'),_0x4de5e4[_0x25e3('0x27')],_0x4f5253);}sendJiraAlert(_0x4de5e4[_0x25e3('0x27')],_0x5c43d5['uuid'],GRAY_PERIOD_REASON);logger[_0x25e3('0x23')](_0x25e3('0x28'),GRAY_PERIOD_REASON[_0x25e3('0x29')](),moment()['format'](_0x25e3('0x2a')));return _0x1ea015['update']({'data2':encryptor[_0x25e3('0x2b')](moment()[_0x25e3('0xd')](_0x25e3('0x2a')))});}else{if(moment()[_0x25e3('0x2c')](encryptor[_0x25e3('0x2d')](_0x4de5e4[_0x25e3('0x22')]),_0x25e3('0x2e'))>DAYS){logger[_0x25e3('0x23')]('DEMO\x20START\x20AT\x20%s',moment()[_0x25e3('0xd')](_0x25e3('0x2a')));return _0x1ea015[_0x25e3('0x24')]({'data1':_0x4f5253,'data2':null,'license':null});}}}else{if(_0x4de5e4['data1']!=_0x4f5253){logger[_0x25e3('0x23')](_0x25e3('0x26'),_0x4de5e4[_0x25e3('0x27')],_0x4f5253);return _0x1ea015[_0x25e3('0x24')]({'data1':_0x4f5253,'data2':null,'license':null});}}}return _0x1ea015;})[_0x25e3('0x11')](function(_0x5e4836){_0x1ea015=_0x5e4836;})['catch'](function(_0x40b23d){logger[_0x25e3('0x2f')](_0x40b23d[_0x25e3('0x30')]);})[_0x25e3('0x31')](function(){setTimeout(function(){manageLicense(hardware[_0x25e3('0x32')](),_0x1ea015);},TIME);});}function defaultLicense(){var _0x341d7c=hardware[_0x25e3('0x32')]();if(_0x341d7c){return db['License'][_0x25e3('0x33')]({'where':{'id':0x1},'defaults':{'data1':_0x341d7c}})[_0x25e3('0x34')](function(_0x13f4d6,_0x3205f3){logger[_0x25e3('0x23')](_0x25e3('0x35'),_0x341d7c);manageLicense(_0x341d7c,_0x13f4d6);})['catch'](function(_0xded6ba){logger[_0x25e3('0x2f')](_0xded6ba['message']);});}}exports[_0x25e3('0x36')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index d5e82c1..21b5b84 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 _0xb89c=['defaults','then','catch','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','split','decryptString','format','parse','demo','machineUuid','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','col','count','users','telephones','admin','user','countBy','telephone','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','bluebird','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find'];(function(_0x17e087,_0x32e6dc){var _0x5e3969=function(_0x562725){while(--_0x562725){_0x17e087['push'](_0x17e087['shift']());}};_0x5e3969(++_0x32e6dc);}(_0xb89c,0x1a4));var _0xcb89=function(_0x74ca35,_0x3c4575){_0x74ca35=_0x74ca35-0x0;var _0x2bb48a=_0xb89c[_0x74ca35];return _0x2bb48a;};'use strict';var util=require(_0xcb89('0x0'));var _=require(_0xcb89('0x1'));var moment=require('moment');var BPromise=require(_0xcb89('0x2'));var hardware=require(_0xcb89('0x3'));var encryptor=require(_0xcb89('0x4'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcb89('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xcb89('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcb89('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xcb89('0x7'),'machineUuid':hardware[_0xcb89('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2753c9){return new BPromise(function(_0x35283a,_0xe41dd8){return db[_0xcb89('0x8')][_0xcb89('0x9')](_[_0xcb89('0xa')](_0x2753c9,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x239904){return checkLicense(_0x239904,null);})[_0xcb89('0xb')](function(_0x1e1611){_0x35283a(_0x1e1611);return;})[_0xcb89('0xc')](function(_0x1fb3ce){_0xe41dd8(_0x1fb3ce);});});}function checkLicense(_0xecbb37,_0x4b3eaa){if(!_0xecbb37){demoLicense[_0xcb89('0xd')]=_0xecbb37['data1'];return demoLicense;}try{var _0x4991b5=_0x4b3eaa||_0xecbb37[_0xcb89('0xe')];if(_[_0xcb89('0xf')](_0x4991b5)){throw new Error(_0xcb89('0x10'));}var _0x3f7663=_0xecbb37[_0xcb89('0x11')];var _0xe18608=_0xecbb37['data2'];var _0x171486=_0x3f7663['split']('-')[0x4];var _0x1ecb23=_0x3f7663[_0xcb89('0x12')]('-')[0x0];var _0x21eb8a=encryptor[_0xcb89('0x13')](_0x4991b5,util[_0xcb89('0x14')]('%s:%s:%s',_0x171486,_0x3f7663,_0x1ecb23));var _0x1f804c=JSON[_0xcb89('0x15')](_0x21eb8a);_0x1f804c[_0xcb89('0x16')]=![];_0x1f804c[_0xcb89('0xd')]=_0x3f7663;_0x1f804c[_0xcb89('0x17')]=hardware[_0xcb89('0x6')]();if(_0xe18608){var _0x1ff249=encryptor[_0xcb89('0x13')](_0xe18608);_0x1f804c['gray']=_0x1ff249;_0x1f804c['deadline']=moment(_0x1ff249)['add'](0x7,_0xcb89('0x18'))['format']();_0x1f804c[_0xcb89('0x19')]=_0x1f804c[_0xcb89('0xd')]!=_0x1f804c['machineUuid']?_0xcb89('0x1a'):_0xcb89('0x1b');}return _0x1f804c;}catch(_0x5f0e65){breakingLicense[_0xcb89('0xd')]=_0xecbb37[_0xcb89('0x11')];breakingLicense[_0xcb89('0x1c')]=_0x5f0e65[_0xcb89('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x6d4e4f,_0x1cdce1){getLicense()[_0xcb89('0xb')](function(_0x494315){return db[_0xcb89('0x1d')][_0xcb89('0x1e')]({'attributes':[_0xcb89('0x1f'),[db[_0xcb89('0x20')]['fn']('COUNT',db[_0xcb89('0x20')][_0xcb89('0x21')]('role')),_0xcb89('0x22')]],'group':_0xcb89('0x1f'),'where':{'role':{'$or':['admin','user','telephone']}},'raw':!![]})[_0xcb89('0xb')](function(_0x44a6e9){var _0xd3c9fb={'user':_0x494315[_0xcb89('0x23')]||0x0,'telephone':_0x494315[_0xcb89('0x24')]||0x0};_0x44a6e9['forEach'](function(_0xc307a){var _0x4bb7a1=_0xc307a[_0xcb89('0x1f')]===_0xcb89('0x25')?_0xcb89('0x26'):_0xc307a['role'];_0xd3c9fb[_0x4bb7a1]-=_0xc307a[_0xcb89('0x22')];if(_0xd3c9fb[_0x4bb7a1]<0x0)_0xd3c9fb[_0x4bb7a1]=0x0;});_0x6d4e4f(_0xd3c9fb);return;});})[_0xcb89('0xc')](function(_0x2c6946){_0x1cdce1(_0x2c6946);});});}function checkUserLimits(_0x45d0b7){return new BPromise(function(_0x18423f,_0x56e7bc){getLimits()[_0xcb89('0xb')](function(_0x3f7688){var _0x35d6d8=_['pick'](_[_0xcb89('0x27')](_0x45d0b7,'role'),[_0xcb89('0x25'),'user',_0xcb89('0x28')]);var _0x67d955=(_0x35d6d8['admin']||0x0)+(_0x35d6d8[_0xcb89('0x26')]||0x0);var _0x4f2a02=_0x35d6d8[_0xcb89('0x28')]||0x0;if(_0x67d955>_0x3f7688[_0xcb89('0x26')])return _0x56e7bc(_0xcb89('0x29'));if(_0x4f2a02>_0x3f7688[_0xcb89('0x28')])return _0x56e7bc('License\x20limit\x20reached\x20for\x20telephones');return _0x18423f();})['catch'](function(_0xd57e1b){_0x56e7bc(_0xd57e1b);});});}module[_0xcb89('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x878c=['parse','machineUuid','getUuid','gray','deadline','add','days','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','%s:%s:%s'];(function(_0x4ae459,_0x3bf329){var _0x51d0c9=function(_0x1ce66b){while(--_0x1ce66b){_0x4ae459['push'](_0x4ae459['shift']());}};_0x51d0c9(++_0x3bf329);}(_0x878c,0xd4));var _0xc878=function(_0x5acebe,_0x1f2c20){_0x5acebe=_0x5acebe-0x0;var _0x4a5136=_0x878c[_0x5acebe];return _0x4a5136;};'use strict';var util=require(_0xc878('0x0'));var _=require(_0xc878('0x1'));var moment=require(_0xc878('0x2'));var BPromise=require(_0xc878('0x3'));var hardware=require(_0xc878('0x4'));var encryptor=require(_0xc878('0x5'));var db=require(_0xc878('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc878('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xc878('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc878('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3bc181){return new BPromise(function(_0x113add,_0x271498){return db[_0xc878('0x9')][_0xc878('0xa')](_[_0xc878('0xb')](_0x3bc181,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0xaa313c){return checkLicense(_0xaa313c,null);})[_0xc878('0xc')](function(_0x3eec82){_0x113add(_0x3eec82);return;})[_0xc878('0xd')](function(_0x45e0f4){_0x271498(_0x45e0f4);});});}function checkLicense(_0x8fa070,_0xf02a6a){if(!_0x8fa070){demoLicense[_0xc878('0xe')]=_0x8fa070[_0xc878('0xf')];return demoLicense;}try{var _0xe29970=_0xf02a6a||_0x8fa070[_0xc878('0x10')];if(_[_0xc878('0x11')](_0xe29970)){throw new Error(_0xc878('0x12'));}var _0x459b61=_0x8fa070[_0xc878('0xf')];var _0x39ea0f=_0x8fa070[_0xc878('0x13')];var _0x3d91ee=_0x459b61[_0xc878('0x14')]('-')[0x4];var _0x18e2f7=_0x459b61[_0xc878('0x14')]('-')[0x0];var _0x1b8ec6=encryptor['decryptString'](_0xe29970,util[_0xc878('0x15')](_0xc878('0x16'),_0x3d91ee,_0x459b61,_0x18e2f7));var _0x367a86=JSON[_0xc878('0x17')](_0x1b8ec6);_0x367a86['demo']=![];_0x367a86[_0xc878('0xe')]=_0x459b61;_0x367a86[_0xc878('0x18')]=hardware[_0xc878('0x19')]();if(_0x39ea0f){var _0x458833=encryptor['decryptString'](_0x39ea0f);_0x367a86[_0xc878('0x1a')]=_0x458833;_0x367a86[_0xc878('0x1b')]=moment(_0x458833)[_0xc878('0x1c')](0x7,_0xc878('0x1d'))['format']();_0x367a86['grayReason']=_0x367a86[_0xc878('0xe')]!=_0x367a86[_0xc878('0x18')]?_0xc878('0x1e'):_0xc878('0x1f');}return _0x367a86;}catch(_0x3c193b){breakingLicense[_0xc878('0xe')]=_0x8fa070[_0xc878('0xf')];breakingLicense[_0xc878('0x20')]=_0x3c193b['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5752c3,_0x54fa4c){getLicense()[_0xc878('0xc')](function(_0x4f2db6){return db[_0xc878('0x21')][_0xc878('0x22')]({'attributes':[_0xc878('0x23'),[db[_0xc878('0x24')]['fn'](_0xc878('0x25'),db[_0xc878('0x24')][_0xc878('0x26')](_0xc878('0x23'))),_0xc878('0x27')]],'group':_0xc878('0x23'),'where':{'role':{'$or':[_0xc878('0x28'),_0xc878('0x29'),_0xc878('0x2a')]}},'raw':!![]})['then'](function(_0x4f59a2){var _0x32bcf2={'user':_0x4f2db6['users']||0x0,'telephone':_0x4f2db6['telephones']||0x0};_0x4f59a2['forEach'](function(_0x3c7fd8){var _0x1e6e91=_0x3c7fd8[_0xc878('0x23')]==='admin'?_0xc878('0x29'):_0x3c7fd8['role'];_0x32bcf2[_0x1e6e91]-=_0x3c7fd8['count'];if(_0x32bcf2[_0x1e6e91]<0x0)_0x32bcf2[_0x1e6e91]=0x0;});_0x5752c3(_0x32bcf2);return;});})[_0xc878('0xd')](function(_0x4088dd){_0x54fa4c(_0x4088dd);});});}function checkUserLimits(_0x2bfcb7){return new BPromise(function(_0x5d351c,_0x28641b){getLimits()[_0xc878('0xc')](function(_0x326362){var _0x1c15d4=_[_0xc878('0x2b')](_['countBy'](_0x2bfcb7,_0xc878('0x23')),[_0xc878('0x28'),_0xc878('0x29'),_0xc878('0x2a')]);var _0x5b9830=(_0x1c15d4[_0xc878('0x28')]||0x0)+(_0x1c15d4[_0xc878('0x29')]||0x0);var _0x4cb572=_0x1c15d4[_0xc878('0x2a')]||0x0;if(_0x5b9830>_0x326362[_0xc878('0x29')])return _0x28641b(_0xc878('0x2c'));if(_0x4cb572>_0x326362[_0xc878('0x2a')])return _0x28641b(_0xc878('0x2d'));return _0x5d351c();})[_0xc878('0xd')](function(_0x38e6f2){_0x28641b(_0x38e6f2);});});}module[_0xc878('0x2e')]={'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 2b9e8cf..5e4e696 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 _0x6b75=['app-id','secret','http://localhost:9000'];(function(_0x31b91c,_0x3edfbd){var _0x3fd16d=function(_0x2a24ec){while(--_0x2a24ec){_0x31b91c['push'](_0x31b91c['shift']());}};_0x3fd16d(++_0x3edfbd);}(_0x6b75,0xe6));var _0x56b7=function(_0x4b2251,_0x393f10){_0x4b2251=_0x4b2251-0x0;var _0x5d22fb=_0x6b75[_0x4b2251];return _0x5d22fb;};'use strict';module['exports']={'DOMAIN':_0x56b7('0x0'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x56b7('0x1'),'GOOGLE_SECRET':_0x56b7('0x2'),'DEBUG':''}; \ No newline at end of file +var _0xcbbb=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x546832,_0x277499){var _0x1777da=function(_0x30a010){while(--_0x30a010){_0x546832['push'](_0x546832['shift']());}};_0x1777da(++_0x277499);}(_0xcbbb,0x1ee));var _0xbcbb=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0xcbbb[_0x3ec1da];return _0x472358;};'use strict';module[_0xbcbb('0x0')]={'DOMAIN':_0xbcbb('0x1'),'SESSION_SECRET':_0xbcbb('0x2'),'GOOGLE_ID':_0xbcbb('0x3'),'GOOGLE_SECRET':_0xbcbb('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index dbcc96d..09cf52c 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b75=['%s-%s','error','transports','File','info','Console','env','winston','util','path','join','log','xcally','format','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','exports'];(function(_0xc28ecc,_0x5949b1){var _0x4d2e38=function(_0x76a3c7){while(--_0x76a3c7){_0xc28ecc['push'](_0xc28ecc['shift']());}};_0x4d2e38(++_0x5949b1);}(_0x4b75,0x1ab));var _0x54b7=function(_0x98eecf,_0x5dd3be){_0x98eecf=_0x98eecf-0x0;var _0x2d8d4e=_0x4b75[_0x98eecf];return _0x2d8d4e;};'use strict';var moment=require('moment');var winston=require(_0x54b7('0x0'));var util=require(_0x54b7('0x1'));var path=require(_0x54b7('0x2'));var debugLevel='INFO';function filename(_0x5ebb53,_0xcd7a79){return path[_0x54b7('0x3')]('/var',_0x54b7('0x4'),_0x54b7('0x5'),util[_0x54b7('0x6')]('%s-%s.log',_0x5ebb53,_0xcd7a79));}function formatter(_0x4c9170,_0xd32f28){_0xd32f28[_0x54b7('0x7')]=_0xd32f28['message'][_0x54b7('0x8')](/@@{/g,'{{{')[_0x54b7('0x8')](/}@@/g,_0x54b7('0x9'))[_0x54b7('0x8')](/@{/g,'{{')[_0x54b7('0x8')](/}@/g,'}}');return util[_0x54b7('0x6')](_0x54b7('0xa'),moment()[_0x54b7('0x6')](_0x54b7('0xb')),_0xd32f28['level']['toUpperCase'](),_0x4c9170,_0xd32f28['message']);}module[_0x54b7('0xc')]=function(_0x2fe491){return new winston['Logger']({'transports':[new winston['transports']['File']({'name':util[_0x54b7('0x6')](_0x54b7('0xd'),_0x2fe491,_0x54b7('0xe')),'filename':filename(_0x2fe491,_0x54b7('0xe')),'level':_0x54b7('0xe'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2556a9){return formatter(_0x2fe491,_0x2556a9);}}),new winston[(_0x54b7('0xf'))][(_0x54b7('0x10'))]({'name':util[_0x54b7('0x6')](_0x54b7('0xd'),_0x2fe491,_0x54b7('0x11')),'filename':filename(_0x2fe491,'info'),'level':_0x54b7('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x25606e){return formatter(_0x2fe491,_0x25606e);}}),new winston[(_0x54b7('0xf'))][(_0x54b7('0x12'))]({'level':process[_0x54b7('0x13')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x357b39){return formatter(_0x2fe491,_0x357b39);}})]});}; \ No newline at end of file +var _0x1393=['[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','File','%s-%s','error','transports','info','env','debugLevel','moment','winston','util','join','/var','xcally','format','message','{{{','replace','}}}'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x1393,0x9d));var _0x3139=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1393[_0x59ee6f];return _0x4c0979;};'use strict';var moment=require(_0x3139('0x0'));var winston=require(_0x3139('0x1'));var util=require(_0x3139('0x2'));var path=require('path');var debugLevel='INFO';function filename(_0x322466,_0x162912){return path[_0x3139('0x3')](_0x3139('0x4'),'log',_0x3139('0x5'),util[_0x3139('0x6')]('%s-%s.log',_0x322466,_0x162912));}function formatter(_0x5031e3,_0x5743cb){_0x5743cb[_0x3139('0x7')]=_0x5743cb[_0x3139('0x7')]['replace'](/@@{/g,_0x3139('0x8'))[_0x3139('0x9')](/}@@/g,_0x3139('0xa'))['replace'](/@{/g,'{{')[_0x3139('0x9')](/}@/g,'}}');return util[_0x3139('0x6')](_0x3139('0xb'),moment()['format'](_0x3139('0xc')),_0x5743cb[_0x3139('0xd')][_0x3139('0xe')](),_0x5031e3,_0x5743cb[_0x3139('0x7')]);}module[_0x3139('0xf')]=function(_0xc8258a){return new winston[(_0x3139('0x10'))]({'transports':[new winston['transports'][(_0x3139('0x11'))]({'name':util[_0x3139('0x6')](_0x3139('0x12'),_0xc8258a,_0x3139('0x13')),'filename':filename(_0xc8258a,_0x3139('0x13')),'level':_0x3139('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4ead80){return formatter(_0xc8258a,_0x4ead80);}}),new winston[(_0x3139('0x14'))][(_0x3139('0x11'))]({'name':util[_0x3139('0x6')](_0x3139('0x12'),_0xc8258a,_0x3139('0x15')),'filename':filename(_0xc8258a,'info'),'level':_0x3139('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x134a32){return formatter(_0xc8258a,_0x134a32);}}),new winston['transports']['Console']({'level':process[_0x3139('0x16')][_0x3139('0x17')]||debugLevel,'json':![],'formatter':function(_0x227c69){return formatter(_0xc8258a,_0x227c69);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index e5830f2..6bc9db1 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 _0x2551=['exports','path','express','../../services/express/index.js','join','agi','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js'];(function(_0x2ffd7a,_0x13a6e8){var _0x7fb12d=function(_0x57f71e){while(--_0x57f71e){_0x2ffd7a['push'](_0x2ffd7a['shift']());}};_0x7fb12d(++_0x13a6e8);}(_0x2551,0x9d));var _0x1255=function(_0x3cbe1c,_0x4bcabd){_0x3cbe1c=_0x3cbe1c-0x0;var _0x5ee08b=_0x2551[_0x3cbe1c];return _0x5ee08b;};'use strict';var path=require(_0x1255('0x0'));var os=require('os');var config={'apps':[{'name':_0x1255('0x1'),'script':path['join'](__dirname,_0x1255('0x2'))},{'name':'ami','script':path[_0x1255('0x3')](__dirname,'../../services/ami/index.js')},{'name':_0x1255('0x4'),'script':path[_0x1255('0x3')](__dirname,'../../services/agi/index.js')},{'name':_0x1255('0x5'),'script':path[_0x1255('0x3')](__dirname,_0x1255('0x6'))},{'name':_0x1255('0x7'),'script':path['join'](__dirname,_0x1255('0x8'))},{'name':_0x1255('0x9'),'script':path[_0x1255('0x3')](__dirname,_0x1255('0xa'))}]};module[_0x1255('0xb')]=config; \ No newline at end of file +var _0xc5b5=['../../services/routing/index.js','../../services/xdr/index.js','join','../../services/express/index.js','../../services/ami/index.js','agi','email','../../services/email/index.js','routing'];(function(_0x1cc8a2,_0x5dce88){var _0xadb7a6=function(_0x385f03){while(--_0x385f03){_0x1cc8a2['push'](_0x1cc8a2['shift']());}};_0xadb7a6(++_0x5dce88);}(_0xc5b5,0x1b2));var _0x5c5b=function(_0x1c7ad0,_0x448315){_0x1c7ad0=_0x1c7ad0-0x0;var _0x27314b=_0xc5b5[_0x1c7ad0];return _0x27314b;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path[_0x5c5b('0x0')](__dirname,_0x5c5b('0x1'))},{'name':'ami','script':path[_0x5c5b('0x0')](__dirname,_0x5c5b('0x2'))},{'name':_0x5c5b('0x3'),'script':path[_0x5c5b('0x0')](__dirname,'../../services/agi/index.js')},{'name':_0x5c5b('0x4'),'script':path[_0x5c5b('0x0')](__dirname,_0x5c5b('0x5'))},{'name':_0x5c5b('0x6'),'script':path[_0x5c5b('0x0')](__dirname,_0x5c5b('0x7'))},{'name':'xdr','script':path[_0x5c5b('0x0')](__dirname,_0x5c5b('0x8'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index fbb8ca9..e34a4f9 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 _0x9fc5=['bluebird','./config','connect','connected','start','then','stop','disconnect','restart','list','describe','delete','dump','saved'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9fc5,0xb6));var _0x59fc=function(_0x38fb8b,_0x70dd0a){_0x38fb8b=_0x38fb8b-0x0;var _0x1ec681=_0x9fc5[_0x38fb8b];return _0x1ec681;};'use strict';var pm2=require('pm2');var BPromise=require(_0x59fc('0x0'));var config=require(_0x59fc('0x1'));function connect(){return new BPromise(function(_0x4a0dd0,_0x4647c5){return pm2[_0x59fc('0x2')](function(_0x46c819){if(_0x46c819){return _0x4647c5(_0x46c819);}return _0x4a0dd0(_0x59fc('0x3'));});});};exports[_0x59fc('0x4')]=function(_0x1b0778){return connect()[_0x59fc('0x5')](function(){return new BPromise(function(_0x323be6,_0x4cb94d){return pm2[_0x59fc('0x4')](_0x1b0778,function(_0x13897f,_0x2c47fb){if(_0x13897f){return _0x4cb94d(_0x13897f);}pm2['disconnect']();return _0x323be6(_0x2c47fb);});});});};exports[_0x59fc('0x6')]=function(_0x313063){return connect()[_0x59fc('0x5')](function(){return new BPromise(function(_0x34ff96,_0x39bc72){return pm2[_0x59fc('0x6')](_0x313063,function(_0x2556f8,_0x4afc93){if(_0x2556f8){return _0x39bc72(_0x2556f8);}pm2[_0x59fc('0x7')]();return _0x34ff96(_0x4afc93);});});});};exports[_0x59fc('0x8')]=function(_0x37140a){return connect()[_0x59fc('0x5')](function(){return new BPromise(function(_0x29e599,_0x21a8a4){return pm2[_0x59fc('0x8')](_0x37140a,function(_0x5da55d,_0x29ffcc){if(_0x5da55d){return _0x21a8a4(_0x5da55d);}pm2[_0x59fc('0x7')]();return _0x29e599(_0x29ffcc);});});});};exports[_0x59fc('0x9')]=function(){return connect()[_0x59fc('0x5')](function(){return new BPromise(function(_0x141769,_0x4fdce7){return pm2[_0x59fc('0x9')](function(_0x19cb0c,_0x462fe9){if(_0x19cb0c){return _0x4fdce7(_0x19cb0c);}pm2[_0x59fc('0x7')]();return _0x141769(_0x462fe9);});});});};exports[_0x59fc('0xa')]=function(_0x50365f){return connect()[_0x59fc('0x5')](function(){return new BPromise(function(_0x362c6b,_0x4e01f6){return pm2[_0x59fc('0xa')](_0x50365f,function(_0x44ef1d,_0x4162c4){if(_0x44ef1d){return _0x4e01f6(_0x44ef1d);}pm2[_0x59fc('0x7')]();return _0x362c6b(_0x4162c4);});});});};exports[_0x59fc('0xb')]=function(_0x584481){return connect()[_0x59fc('0x5')](function(){return new BPromise(function(_0x40fe8d,_0x1ab367){return pm2[_0x59fc('0xb')](_0x584481,function(_0x395ede,_0x3a1e33){if(_0x395ede){return _0x1ab367(_0x395ede);}pm2[_0x59fc('0x7')]();return _0x40fe8d(_0x3a1e33);});});});};exports[_0x59fc('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x153c58,_0x530c11){return pm2[_0x59fc('0xc')](function(_0x57a964){if(_0x57a964){return _0x530c11(_0x57a964);}return _0x153c58(_0x59fc('0xd'));});});});}; \ No newline at end of file +var _0x5c91=['bluebird','./config','connect','connected','start','stop','then','restart','disconnect','list','describe','delete','dump','pm2'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x5c91,0x1e9));var _0x15c9=function(_0x325640,_0x4c05c4){_0x325640=_0x325640-0x0;var _0x385bfb=_0x5c91[_0x325640];return _0x385bfb;};'use strict';var pm2=require(_0x15c9('0x0'));var BPromise=require(_0x15c9('0x1'));var config=require(_0x15c9('0x2'));function connect(){return new BPromise(function(_0x50914e,_0x169444){return pm2[_0x15c9('0x3')](function(_0x17453e){if(_0x17453e){return _0x169444(_0x17453e);}return _0x50914e(_0x15c9('0x4'));});});};exports[_0x15c9('0x5')]=function(_0x3c7189){return connect()['then'](function(){return new BPromise(function(_0x41a4a9,_0x216469){return pm2[_0x15c9('0x5')](_0x3c7189,function(_0x42bcb6,_0x2c213e){if(_0x42bcb6){return _0x216469(_0x42bcb6);}pm2['disconnect']();return _0x41a4a9(_0x2c213e);});});});};exports[_0x15c9('0x6')]=function(_0x114775){return connect()[_0x15c9('0x7')](function(){return new BPromise(function(_0x5c29fc,_0x23adaf){return pm2[_0x15c9('0x6')](_0x114775,function(_0x1aba8a,_0x5b56c4){if(_0x1aba8a){return _0x23adaf(_0x1aba8a);}pm2['disconnect']();return _0x5c29fc(_0x5b56c4);});});});};exports[_0x15c9('0x8')]=function(_0x118d1d){return connect()['then'](function(){return new BPromise(function(_0x5c1eb7,_0x538952){return pm2[_0x15c9('0x8')](_0x118d1d,function(_0x4573aa,_0x5d205d){if(_0x4573aa){return _0x538952(_0x4573aa);}pm2[_0x15c9('0x9')]();return _0x5c1eb7(_0x5d205d);});});});};exports[_0x15c9('0xa')]=function(){return connect()[_0x15c9('0x7')](function(){return new BPromise(function(_0x56fbbd,_0x4e221e){return pm2[_0x15c9('0xa')](function(_0xd71ac0,_0x51812c){if(_0xd71ac0){return _0x4e221e(_0xd71ac0);}pm2[_0x15c9('0x9')]();return _0x56fbbd(_0x51812c);});});});};exports['describe']=function(_0x3b768e){return connect()[_0x15c9('0x7')](function(){return new BPromise(function(_0x1705a8,_0x20c60b){return pm2[_0x15c9('0xb')](_0x3b768e,function(_0x2cac07,_0x5eb50e){if(_0x2cac07){return _0x20c60b(_0x2cac07);}pm2[_0x15c9('0x9')]();return _0x1705a8(_0x5eb50e);});});});};exports[_0x15c9('0xc')]=function(_0x1c35fa){return connect()[_0x15c9('0x7')](function(){return new BPromise(function(_0x2390a4,_0x2d36e5){return pm2[_0x15c9('0xc')](_0x1c35fa,function(_0x1382ee,_0x5e5f91){if(_0x1382ee){return _0x2d36e5(_0x1382ee);}pm2[_0x15c9('0x9')]();return _0x2390a4(_0x5e5f91);});});});};exports[_0x15c9('0xd')]=function(){return connect()[_0x15c9('0x7')](function(){return new BPromise(function(_0x5683ca,_0x29471d){return pm2[_0x15c9('0xd')](function(_0x4a48fb){if(_0x4a48fb){return _0x29471d(_0x4a48fb);}return _0x5683ca('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 459e594..cc925ac 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 _0xf4b7=['find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','Setting'];(function(_0x33bfce,_0x98e226){var _0x4911c3=function(_0xd309d9){while(--_0xd309d9){_0x33bfce['push'](_0x33bfce['shift']());}};_0x4911c3(++_0x98e226);}(_0xf4b7,0x1bc));var _0x7f4b=function(_0x5089a7,_0x2e8527){_0x5089a7=_0x5089a7-0x0;var _0x3d8a9d=_0xf4b7[_0x5089a7];return _0x3d8a9d;};'use strict';var _=require(_0x7f4b('0x0'));var moment=require(_0x7f4b('0x1'));var Redis=require(_0x7f4b('0x2'));var util=require(_0x7f4b('0x3'));var config=require(_0x7f4b('0x4'));var db=require(_0x7f4b('0x5'))['db'];var logger=require(_0x7f4b('0x6'))('schedule');config[_0x7f4b('0x7')]=_[_0x7f4b('0x8')](config[_0x7f4b('0x7')],{'host':_0x7f4b('0x9'),'port':0x18eb});var io=require(_0x7f4b('0xa'))(new Redis(config[_0x7f4b('0x7')]));function closeInteractions(){var _0x196f08=0x0;var _0x2f2c9d=[];return db[_0x7f4b('0xb')][_0x7f4b('0xc')]({'raw':!![],'attributes':['id',_0x7f4b('0xd')],'where':{'id':0x1}})[_0x7f4b('0xe')](function(_0x89c15d){_0x196f08=_0x89c15d[_0x7f4b('0xd')];if(_0x196f08){return db[_0x7f4b('0xf')][_0x7f4b('0x10')]({'raw':!![],'attributes':['id',_0x7f4b('0x11')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x7f4b('0x12')](_0x89c15d[_0x7f4b('0xd')],_0x7f4b('0x13'))}}});}else{return[];}})[_0x7f4b('0xe')](function(_0x57ed1d){if(_0x57ed1d&&_0x57ed1d[_0x7f4b('0x14')]){_0x2f2c9d=_[_0x7f4b('0x15')](_0x57ed1d||[],'id');logger[_0x7f4b('0x16')](_0x7f4b('0x17'),_0x2f2c9d[_0x7f4b('0x18')]());return db['ChatInteraction'][_0x7f4b('0x19')]({'closeReason':_0x7f4b('0x1a'),'disposition':_0x7f4b('0x1b'),'closed':!![],'closedAt':moment()[_0x7f4b('0x1c')](_0x7f4b('0x1d'))},{'where':{'id':_0x2f2c9d}});}})[_0x7f4b('0xe')](function(){if(_0x2f2c9d&&_0x2f2c9d[_0x7f4b('0x14')]){logger['info'](_0x7f4b('0x1e'),_0x2f2c9d[_0x7f4b('0x18')]());for(var _0x24334c=0x0;_0x24334c<_0x2f2c9d[_0x7f4b('0x14')];_0x24334c++){io[_0x7f4b('0x1f')](_0x7f4b('0x20'),{'id':_0x2f2c9d[_0x24334c],'closed':!![]});}}})[_0x7f4b('0x21')](function(_0x5f1699){logger[_0x7f4b('0x22')](_0x7f4b('0x23'),_0x5f1699?util[_0x7f4b('0x24')](_0x5f1699,{'showHidden':![],'depth':null}):'');});}exports[_0x7f4b('0x25')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xbe6a=['YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','join','update','timeout','format'];(function(_0x59c600,_0x367104){var _0x16f636=function(_0x5b9795){while(--_0x5b9795){_0x59c600['push'](_0x59c600['shift']());}};_0x16f636(++_0x367104);}(_0xbe6a,0x15d));var _0xabe6=function(_0x40aaa4,_0x3b22f4){_0x40aaa4=_0x40aaa4-0x0;var _0x4e21e5=_0xbe6a[_0x40aaa4];return _0x4e21e5;};'use strict';var _=require(_0xabe6('0x0'));var moment=require(_0xabe6('0x1'));var Redis=require(_0xabe6('0x2'));var util=require(_0xabe6('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0xabe6('0x4'))(_0xabe6('0x5'));config[_0xabe6('0x6')]=_[_0xabe6('0x7')](config['redis'],{'host':_0xabe6('0x8'),'port':0x18eb});var io=require(_0xabe6('0x9'))(new Redis(config[_0xabe6('0x6')]));function closeInteractions(){var _0x3d5256=0x0;var _0x4ab27d=[];return db[_0xabe6('0xa')][_0xabe6('0xb')]({'raw':!![],'attributes':['id',_0xabe6('0xc')],'where':{'id':0x1}})[_0xabe6('0xd')](function(_0x889a7){_0x3d5256=_0x889a7[_0xabe6('0xc')];if(_0x3d5256){return db[_0xabe6('0xe')][_0xabe6('0xf')]({'raw':!![],'attributes':['id',_0xabe6('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xabe6('0x11')](_0x889a7[_0xabe6('0xc')],_0xabe6('0x12'))}}});}else{return[];}})[_0xabe6('0xd')](function(_0x219f0d){if(_0x219f0d&&_0x219f0d['length']){_0x4ab27d=_['map'](_0x219f0d||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x4ab27d[_0xabe6('0x13')]());return db[_0xabe6('0xe')][_0xabe6('0x14')]({'closeReason':'system','disposition':_0xabe6('0x15'),'closed':!![],'closedAt':moment()[_0xabe6('0x16')](_0xabe6('0x17'))},{'where':{'id':_0x4ab27d}});}})[_0xabe6('0xd')](function(){if(_0x4ab27d&&_0x4ab27d[_0xabe6('0x18')]){logger['info'](_0xabe6('0x19'),_0x4ab27d[_0xabe6('0x13')]());for(var _0x3f65f0=0x0;_0x3f65f0<_0x4ab27d[_0xabe6('0x18')];_0x3f65f0++){io[_0xabe6('0x1a')]('chatInteraction:update',{'id':_0x4ab27d[_0x3f65f0],'closed':!![]});}}})[_0xabe6('0x1b')](function(_0x2fe837){logger[_0xabe6('0x1c')](_0xabe6('0x1d'),_0x2fe837?util[_0xabe6('0x1e')](_0x2fe837,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 0dc7227..acfac4c 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 _0xb9d5=['Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','\x22%s\x22\x20<%s>','name','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','extname','zip','existsSync','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','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','error\x20mail','email\x20sent','error','stringify','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','then','catch','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','map','toString','keyBy','intersection','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','run\x20job','cron','active','isBetween','startAt','endAt','add','add\x20cron','stop\x20cron','update','update\x20cron','run','start','util','path','lodash','moment','cron-job-manager','jayson/promise','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info'];(function(_0x1ab178,_0x2fdb60){var _0x339a4d=function(_0x57d9f3){while(--_0x57d9f3){_0x1ab178['push'](_0x1ab178['shift']());}};_0x339a4d(++_0x2fdb60);}(_0xb9d5,0x16f));var _0x5b9d=function(_0x5e9350,_0x2f9899){_0x5e9350=_0x5e9350-0x0;var _0x35604b=_0xb9d5[_0x5e9350];return _0x35604b;};'use strict';var fs=require('fs');var util=require(_0x5b9d('0x0'));var path=require(_0x5b9d('0x1'));var _=require(_0x5b9d('0x2'));var moment=require(_0x5b9d('0x3'));var CronJobManager=require(_0x5b9d('0x4'));var jayson=require(_0x5b9d('0x5'));var BPromise=require('bluebird');var logger=require('../logger')(_0x5b9d('0x6'));var db=require(_0x5b9d('0x7'))['db'];var analyticCustomReportController=require(_0x5b9d('0x8'));var analyticDefaultReportController=require(_0x5b9d('0x9'));var client=jayson[_0x5b9d('0xa')][_0x5b9d('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2708e5,_0x4aef0b){return function(){logger[_0x5b9d('0xc')](_0x5b9d('0xd'),_0x2708e5[_0x5b9d('0xe')]);var _0xb9830a=!![];var _0x3e1557={'tls':{'rejectUnauthorized':![]}};if(_0x2708e5[_0x5b9d('0xf')][_0x5b9d('0x10')][_0x5b9d('0x11')]){_0x3e1557[_0x5b9d('0x11')]=_0x2708e5[_0x5b9d('0xf')]['Smtp'][_0x5b9d('0x11')];}else{_0x3e1557['host']=_0x2708e5[_0x5b9d('0xf')][_0x5b9d('0x10')][_0x5b9d('0x12')];_0x3e1557[_0x5b9d('0x13')]=_0x2708e5[_0x5b9d('0xf')][_0x5b9d('0x10')][_0x5b9d('0x13')];_0x3e1557[_0x5b9d('0x14')]=_0x2708e5[_0x5b9d('0xf')][_0x5b9d('0x10')][_0x5b9d('0x14')];}if(_0x2708e5[_0x5b9d('0xf')][_0x5b9d('0x10')][_0x5b9d('0x15')]){_0x3e1557[_0x5b9d('0x16')]={'user':_0x2708e5[_0x5b9d('0xf')]['Smtp'][_0x5b9d('0x17')],'pass':_0x2708e5[_0x5b9d('0xf')]['Smtp']['pass']};}var _0x2dae02={'account':_0x3e1557,'message':{'from':util['format'](_0x5b9d('0x18'),_0x2708e5[_0x5b9d('0xf')][_0x5b9d('0x19')],_0x2708e5[_0x5b9d('0xf')]['email']||_0x2708e5['MailAccount'][_0x5b9d('0x10')][_0x5b9d('0x17')]),'to':_0x2708e5[_0x5b9d('0xe')],'cc':_0x2708e5['cc'],'bcc':_0x2708e5[_0x5b9d('0x1a')],'subject':util[_0x5b9d('0x1b')](_0x5b9d('0x1c'),_0x4aef0b[_0x5b9d('0x19')],_0x2708e5['subtractNumber'],_0x2708e5[_0x5b9d('0x1d')])}};var _0x421adf=path[_0x5b9d('0x1e')](__dirname,_0x5b9d('0x1f'));var _0xde682f=_0x4aef0b['savename'];var _0x2e6b45=util[_0x5b9d('0x1b')]('%s.%s',path['basename'](_0x4aef0b[_0x5b9d('0x20')],path[_0x5b9d('0x21')](_0x4aef0b[_0x5b9d('0x20')])),_0x5b9d('0x22'));var _0x10071c=path[_0x5b9d('0x1e')](_0x421adf,_0xde682f);var _0x50877b=path[_0x5b9d('0x1e')](_0x421adf,_0x2e6b45);if(fs[_0x5b9d('0x23')](_0x10071c)){_0x4aef0b['status']=_0x5b9d('0x24');_0x2dae02['message'][_0x5b9d('0x25')]=[{'filename':_0xde682f,'path':_0x10071c}];_0x2dae02[_0x5b9d('0x26')][_0x5b9d('0x27')]=util['format'](_0x5b9d('0x28'),JSON['stringify'](_0x4aef0b,null,0x2));}else if(fs[_0x5b9d('0x23')](_0x50877b)){_0x4aef0b[_0x5b9d('0x29')]=_0x5b9d('0x24');_0x2dae02[_0x5b9d('0x26')][_0x5b9d('0x25')]=[{'filename':_0x2e6b45,'path':_0x50877b}];}else{_0x2dae02[_0x5b9d('0x26')][_0x5b9d('0x27')]=_0x5b9d('0x2a');if(!_0x2708e5[_0x5b9d('0x2b')]){_0xb9830a=![];logger[_0x5b9d('0xc')](_0x5b9d('0x2c'));}}if(_0xb9830a){return client['request']('SendMail',_0x2dae02)['then'](function(_0x265428){if(_0x265428['error']){return logger['error'](_0x5b9d('0x2d'),JSON['stringify'](_0x265428));}return logger[_0x5b9d('0xc')](_0x5b9d('0x2e'));})['catch'](function(_0x39cec3){return logger['error'](_0x5b9d('0x2d'),JSON['stringify'](_0x39cec3));});}};}function handleError(){return function(_0x5713d8){return logger[_0x5b9d('0x2f')](JSON[_0x5b9d('0x30')](_0x5713d8));};}function handleResult(_0x20033f){return function(_0x2c7034){logger[_0x5b9d('0xc')](_0x5b9d('0x31'),JSON[_0x5b9d('0x30')](_0x2c7034));if(_0x20033f[_0x5b9d('0xf')]&&_0x20033f['MailAccount'][_0x5b9d('0x10')]&&!_[_0x5b9d('0x32')](_0x20033f[_0x5b9d('0xe')])){setTimeout(handleSendEmail(_0x20033f,_0x2c7034),0x3c*0x3e8);}};}function handleJob(_0x475560){return function(){try{if(_[_0x5b9d('0x32')](_0x475560[_0x5b9d('0x33')])){return logger[_0x5b9d('0xc')](_0x5b9d('0x34'));}if(_[_0x5b9d('0x32')](_0x475560[_0x5b9d('0x1d')])){return logger[_0x5b9d('0xc')](_0x5b9d('0x35'));}var _0x23bf01={'startDate':moment()[_0x5b9d('0x36')](_0x475560[_0x5b9d('0x33')],_0x475560[_0x5b9d('0x1d')])['format'](_0x5b9d('0x37')),'endDate':moment()['format'](_0x5b9d('0x37')),'type':_0x5b9d('0x38'),'output':_0x475560[_0x5b9d('0x39')],'name':_0x475560[_0x5b9d('0x19')]};if(!_[_0x5b9d('0x32')](_0x475560[_0x5b9d('0x3a')])){logger[_0x5b9d('0xc')](_0x5b9d('0x3b'),_0x475560[_0x5b9d('0x3a')]);return analyticDefaultReportController['runReport']({'id':_0x475560[_0x5b9d('0x3a')]},_0x23bf01)[_0x5b9d('0x3c')](handleResult(_0x475560))[_0x5b9d('0x3d')](handleError());}if(!_[_0x5b9d('0x32')](_0x475560[_0x5b9d('0x3e')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x475560[_0x5b9d('0x3e')]);return analyticCustomReportController[_0x5b9d('0x3f')]({'id':_0x475560['CustomReportId']},_0x23bf01)[_0x5b9d('0x3c')](handleResult(_0x475560))['catch'](handleError());}}catch(_0x572461){logger[_0x5b9d('0x2f')](JSON[_0x5b9d('0x30')](_0x572461));}return logger['info'](_0x5b9d('0x40'));};}function getJobs(_0x41f7d8){var _0x316efc={};if(_0x41f7d8){_0x316efc['id']=_0x41f7d8;}return db[_0x5b9d('0x41')][_0x5b9d('0x42')]({'where':_0x316efc,'include':[{'model':db[_0x5b9d('0xf')],'attributes':['id',_0x5b9d('0x19'),_0x5b9d('0xe')],'include':[{'model':db[_0x5b9d('0x43')],'as':_0x5b9d('0x10')}]}]})[_0x5b9d('0x3c')](function(_0x23f2a9){var _0x2e2f4b=_[_0x5b9d('0x44')](manager['jobs']);var _0x336de3=_[_0x5b9d('0x45')](_0x23f2a9,function(_0x4e0489){return _0x4e0489['id'][_0x5b9d('0x46')]();});var _0x4fb686=_[_0x5b9d('0x47')](_0x23f2a9,function(_0x755131){return _0x755131['id'][_0x5b9d('0x46')]();});var _0x1459c2=_0x41f7d8?_0x336de3:_['difference'](_0x336de3,_0x2e2f4b);var _0x3ce14a=_[_0x5b9d('0x48')](_0x336de3,_0x2e2f4b);var _0x32a28=_[_0x5b9d('0x49')](_0x2e2f4b,_0x336de3);var _0x28a7f7;var _0x572d2c;for(_0x28a7f7=0x0;_0x28a7f7<_0x32a28[_0x5b9d('0x4a')]&&!_0x41f7d8;_0x28a7f7+=0x1){_0x572d2c=_0x32a28[_0x28a7f7][_0x5b9d('0x46')]();if(manager[_0x5b9d('0x4b')](_0x572d2c)){manager[_0x5b9d('0x4c')](_0x572d2c);manager[_0x5b9d('0x4d')](_0x572d2c);logger['info'](_0x5b9d('0x4e'),_0x572d2c);}}logger[_0x5b9d('0xc')](_0x5b9d('0x4f'),JSON[_0x5b9d('0x30')](_0x1459c2));for(_0x28a7f7=0x0;_0x28a7f7<_0x1459c2[_0x5b9d('0x4a')];_0x28a7f7+=0x1){_0x572d2c=_0x1459c2[_0x28a7f7][_0x5b9d('0x46')]();logger[_0x5b9d('0xc')](_0x5b9d('0x50'),_0x572d2c);if(_0x41f7d8){logger[_0x5b9d('0xc')](_0x5b9d('0x51'),_0x41f7d8);logger[_0x5b9d('0xc')](JSON[_0x5b9d('0x30')](_0x4fb686[_0x572d2c]));BPromise['resolve']()['then'](handleJob(_0x4fb686[_0x572d2c]));logger[_0x5b9d('0xc')](_0x5b9d('0x52'),_0x4fb686[_0x572d2c]['name'],_0x4fb686[_0x572d2c][_0x5b9d('0x53')]);}else if(_0x4fb686[_0x572d2c][_0x5b9d('0x53')]&&_0x4fb686[_0x572d2c][_0x5b9d('0x54')]&&moment()[_0x5b9d('0x55')](_0x4fb686[_0x572d2c][_0x5b9d('0x56')],_0x4fb686[_0x572d2c][_0x5b9d('0x57')])){manager[_0x5b9d('0x58')](_0x572d2c,_0x4fb686[_0x572d2c][_0x5b9d('0x53')],handleJob(_0x4fb686[_0x572d2c]));manager['start'](_0x572d2c);logger[_0x5b9d('0xc')](_0x5b9d('0x59'),_0x4fb686[_0x572d2c][_0x5b9d('0x19')],_0x4fb686[_0x572d2c]['cron']);}else if(manager[_0x5b9d('0x4b')](_0x572d2c)){manager[_0x5b9d('0x4c')](_0x572d2c);manager[_0x5b9d('0x4d')](_0x572d2c);logger[_0x5b9d('0xc')](_0x5b9d('0x5a'),_0x4fb686[_0x572d2c][_0x5b9d('0x19')],_0x4fb686[_0x572d2c][_0x5b9d('0x53')]);}}for(_0x28a7f7=0x0,_0x572d2c;_0x28a7f7<_0x3ce14a['length']&&!_0x41f7d8;_0x28a7f7+=0x1){_0x572d2c=_0x3ce14a[_0x28a7f7][_0x5b9d('0x46')]();if(manager[_0x5b9d('0x4b')](_0x572d2c)){if(_0x4fb686[_0x572d2c][_0x5b9d('0x53')]&&_0x4fb686[_0x572d2c]['active']&&moment()[_0x5b9d('0x55')](_0x4fb686[_0x572d2c]['startAt'],_0x4fb686[_0x572d2c]['endAt'])){manager[_0x5b9d('0x5b')](_0x572d2c,_0x4fb686[_0x572d2c][_0x5b9d('0x53')],handleJob(_0x4fb686[_0x572d2c]));logger['info'](_0x5b9d('0x5c'),_0x4fb686[_0x572d2c][_0x5b9d('0x19')],_0x4fb686[_0x572d2c][_0x5b9d('0x53')]);}else{manager['stop'](_0x572d2c);manager[_0x5b9d('0x4d')](_0x572d2c);logger[_0x5b9d('0xc')](_0x5b9d('0x5a'),_0x4fb686[_0x572d2c]['name'],_0x4fb686[_0x572d2c][_0x5b9d('0x53')]);}}}})[_0x5b9d('0x3d')](function(_0x4ae543){logger['error'](JSON[_0x5b9d('0x30')](_0x4ae543));});}exports[_0x5b9d('0x5d')]=function(_0x256e60){return getJobs(_0x256e60);};exports[_0x5b9d('0x5e')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xc049=['YYYY-MM-DD\x20HH:mm:ss','exec\x20defaul\x20report\x20id:%s','runReport','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','startAt','endAt','add','start','add\x20cron','stop\x20cron','isBetween','update','update\x20cron','run','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','port','secure','authentication','auth','\x22%s\x22\x20<%s>','name','email','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','savename','format','%s.%s','basename','zip','existsSync','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract'];(function(_0x242e47,_0xec8257){var _0x56a23d=function(_0x599067){while(--_0x599067){_0x242e47['push'](_0x242e47['shift']());}};_0x56a23d(++_0xec8257);}(_0xc049,0x85));var _0x9c04=function(_0x47f187,_0x41c658){_0x47f187=_0x47f187-0x0;var _0x28f4d9=_0xc049[_0x47f187];return _0x28f4d9;};'use strict';var fs=require('fs');var util=require(_0x9c04('0x0'));var path=require(_0x9c04('0x1'));var _=require(_0x9c04('0x2'));var moment=require('moment');var CronJobManager=require(_0x9c04('0x3'));var jayson=require(_0x9c04('0x4'));var BPromise=require(_0x9c04('0x5'));var logger=require(_0x9c04('0x6'))(_0x9c04('0x7'));var db=require(_0x9c04('0x8'))['db'];var analyticCustomReportController=require(_0x9c04('0x9'));var analyticDefaultReportController=require(_0x9c04('0xa'));var client=jayson['client'][_0x9c04('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x429682,_0x58343a){return function(){logger[_0x9c04('0xc')](_0x9c04('0xd'),_0x429682['email']);var _0x1df14d=!![];var _0x2e79c6={'tls':{'rejectUnauthorized':![]}};if(_0x429682[_0x9c04('0xe')][_0x9c04('0xf')][_0x9c04('0x10')]){_0x2e79c6['service']=_0x429682[_0x9c04('0xe')]['Smtp'][_0x9c04('0x10')];}else{_0x2e79c6['host']=_0x429682[_0x9c04('0xe')][_0x9c04('0xf')]['host'];_0x2e79c6['port']=_0x429682['MailAccount'][_0x9c04('0xf')][_0x9c04('0x11')];_0x2e79c6[_0x9c04('0x12')]=_0x429682['MailAccount'][_0x9c04('0xf')][_0x9c04('0x12')];}if(_0x429682[_0x9c04('0xe')][_0x9c04('0xf')][_0x9c04('0x13')]){_0x2e79c6[_0x9c04('0x14')]={'user':_0x429682[_0x9c04('0xe')][_0x9c04('0xf')]['user'],'pass':_0x429682[_0x9c04('0xe')][_0x9c04('0xf')]['pass']};}var _0x865965={'account':_0x2e79c6,'message':{'from':util['format'](_0x9c04('0x15'),_0x429682[_0x9c04('0xe')][_0x9c04('0x16')],_0x429682[_0x9c04('0xe')][_0x9c04('0x17')]||_0x429682[_0x9c04('0xe')]['Smtp'][_0x9c04('0x18')]),'to':_0x429682['email'],'cc':_0x429682['cc'],'bcc':_0x429682[_0x9c04('0x19')],'subject':util['format'](_0x9c04('0x1a'),_0x58343a['name'],_0x429682[_0x9c04('0x1b')],_0x429682[_0x9c04('0x1c')])}};var _0x1551e3=path[_0x9c04('0x1d')](__dirname,'../../files/reports');var _0x2a436a=_0x58343a[_0x9c04('0x1e')];var _0x2d3af1=util[_0x9c04('0x1f')](_0x9c04('0x20'),path[_0x9c04('0x21')](_0x58343a[_0x9c04('0x1e')],path['extname'](_0x58343a[_0x9c04('0x1e')])),_0x9c04('0x22'));var _0x191dbf=path[_0x9c04('0x1d')](_0x1551e3,_0x2a436a);var _0x58ba14=path[_0x9c04('0x1d')](_0x1551e3,_0x2d3af1);if(fs[_0x9c04('0x23')](_0x191dbf)){_0x58343a['status']=_0x9c04('0x24');_0x865965[_0x9c04('0x25')][_0x9c04('0x26')]=[{'filename':_0x2a436a,'path':_0x191dbf}];_0x865965[_0x9c04('0x25')][_0x9c04('0x27')]=util[_0x9c04('0x1f')](_0x9c04('0x28'),JSON[_0x9c04('0x29')](_0x58343a,null,0x2));}else if(fs[_0x9c04('0x23')](_0x58ba14)){_0x58343a['status']=_0x9c04('0x24');_0x865965['message'][_0x9c04('0x26')]=[{'filename':_0x2d3af1,'path':_0x58ba14}];}else{_0x865965['message']['text']=_0x9c04('0x2a');if(!_0x429682[_0x9c04('0x2b')]){_0x1df14d=![];logger[_0x9c04('0xc')](_0x9c04('0x2c'));}}if(_0x1df14d){return client[_0x9c04('0x2d')](_0x9c04('0x2e'),_0x865965)[_0x9c04('0x2f')](function(_0xd8f59f){if(_0xd8f59f['error']){return logger[_0x9c04('0x30')](_0x9c04('0x31'),JSON['stringify'](_0xd8f59f));}return logger[_0x9c04('0xc')](_0x9c04('0x32'));})[_0x9c04('0x33')](function(_0x1e84ef){return logger[_0x9c04('0x30')]('error\x20mail',JSON[_0x9c04('0x29')](_0x1e84ef));});}};}function handleError(){return function(_0x3d0094){return logger[_0x9c04('0x30')](JSON[_0x9c04('0x29')](_0x3d0094));};}function handleResult(_0x380b4f){return function(_0x1736bc){logger[_0x9c04('0xc')](_0x9c04('0x34'),JSON[_0x9c04('0x29')](_0x1736bc));if(_0x380b4f[_0x9c04('0xe')]&&_0x380b4f[_0x9c04('0xe')][_0x9c04('0xf')]&&!_['isNil'](_0x380b4f[_0x9c04('0x17')])){setTimeout(handleSendEmail(_0x380b4f,_0x1736bc),0x3c*0x3e8);}};}function handleJob(_0x45e73c){return function(){try{if(_[_0x9c04('0x35')](_0x45e73c[_0x9c04('0x1b')])){return logger[_0x9c04('0xc')](_0x9c04('0x36'));}if(_[_0x9c04('0x35')](_0x45e73c[_0x9c04('0x1c')])){return logger[_0x9c04('0xc')](_0x9c04('0x37'));}var _0x30d739={'startDate':moment()[_0x9c04('0x38')](_0x45e73c[_0x9c04('0x1b')],_0x45e73c[_0x9c04('0x1c')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x9c04('0x1f')](_0x9c04('0x39')),'type':'scheduled','output':_0x45e73c['output'],'name':_0x45e73c[_0x9c04('0x16')]};if(!_[_0x9c04('0x35')](_0x45e73c['DefaultReportId'])){logger[_0x9c04('0xc')](_0x9c04('0x3a'),_0x45e73c['DefaultReportId']);return analyticDefaultReportController[_0x9c04('0x3b')]({'id':_0x45e73c[_0x9c04('0x3c')]},_0x30d739)[_0x9c04('0x2f')](handleResult(_0x45e73c))[_0x9c04('0x33')](handleError());}if(!_[_0x9c04('0x35')](_0x45e73c[_0x9c04('0x3d')])){logger[_0x9c04('0xc')](_0x9c04('0x3e'),_0x45e73c[_0x9c04('0x3d')]);return analyticCustomReportController[_0x9c04('0x3b')]({'id':_0x45e73c[_0x9c04('0x3d')]},_0x30d739)[_0x9c04('0x2f')](handleResult(_0x45e73c))[_0x9c04('0x33')](handleError());}}catch(_0x5acddf){logger[_0x9c04('0x30')](JSON[_0x9c04('0x29')](_0x5acddf));}return logger[_0x9c04('0xc')](_0x9c04('0x3f'));};}function getJobs(_0x24915e){var _0x53007a={};if(_0x24915e){_0x53007a['id']=_0x24915e;}return db[_0x9c04('0x40')][_0x9c04('0x41')]({'where':_0x53007a,'include':[{'model':db[_0x9c04('0xe')],'attributes':['id','name',_0x9c04('0x17')],'include':[{'model':db[_0x9c04('0x42')],'as':'Smtp'}]}]})['then'](function(_0x15e320){var _0x35bb78=_[_0x9c04('0x43')](manager[_0x9c04('0x44')]);var _0x38291d=_[_0x9c04('0x45')](_0x15e320,function(_0x516562){return _0x516562['id'][_0x9c04('0x46')]();});var _0x2a2053=_[_0x9c04('0x47')](_0x15e320,function(_0x3af6ff){return _0x3af6ff['id']['toString']();});var _0x3dcb1c=_0x24915e?_0x38291d:_[_0x9c04('0x48')](_0x38291d,_0x35bb78);var _0x25c2d9=_['intersection'](_0x38291d,_0x35bb78);var _0x347179=_[_0x9c04('0x48')](_0x35bb78,_0x38291d);var _0x204460;var _0x390df8;for(_0x204460=0x0;_0x204460<_0x347179[_0x9c04('0x49')]&&!_0x24915e;_0x204460+=0x1){_0x390df8=_0x347179[_0x204460]['toString']();if(manager[_0x9c04('0x4a')](_0x390df8)){manager[_0x9c04('0x4b')](_0x390df8);manager[_0x9c04('0x4c')](_0x390df8);logger['info'](_0x9c04('0x4d'),_0x390df8);}}logger[_0x9c04('0xc')](_0x9c04('0x4e'),JSON['stringify'](_0x3dcb1c));for(_0x204460=0x0;_0x204460<_0x3dcb1c['length'];_0x204460+=0x1){_0x390df8=_0x3dcb1c[_0x204460][_0x9c04('0x46')]();logger[_0x9c04('0xc')](_0x9c04('0x4f'),_0x390df8);if(_0x24915e){logger[_0x9c04('0xc')](_0x9c04('0x50'),_0x24915e);logger[_0x9c04('0xc')](JSON['stringify'](_0x2a2053[_0x390df8]));BPromise[_0x9c04('0x51')]()[_0x9c04('0x2f')](handleJob(_0x2a2053[_0x390df8]));logger[_0x9c04('0xc')](_0x9c04('0x52'),_0x2a2053[_0x390df8]['name'],_0x2a2053[_0x390df8]['cron']);}else if(_0x2a2053[_0x390df8][_0x9c04('0x53')]&&_0x2a2053[_0x390df8][_0x9c04('0x54')]&&moment()['isBetween'](_0x2a2053[_0x390df8][_0x9c04('0x55')],_0x2a2053[_0x390df8][_0x9c04('0x56')])){manager[_0x9c04('0x57')](_0x390df8,_0x2a2053[_0x390df8]['cron'],handleJob(_0x2a2053[_0x390df8]));manager[_0x9c04('0x58')](_0x390df8);logger['info'](_0x9c04('0x59'),_0x2a2053[_0x390df8][_0x9c04('0x16')],_0x2a2053[_0x390df8]['cron']);}else if(manager[_0x9c04('0x4a')](_0x390df8)){manager['stop'](_0x390df8);manager[_0x9c04('0x4c')](_0x390df8);logger[_0x9c04('0xc')](_0x9c04('0x5a'),_0x2a2053[_0x390df8]['name'],_0x2a2053[_0x390df8][_0x9c04('0x53')]);}}for(_0x204460=0x0,_0x390df8;_0x204460<_0x25c2d9[_0x9c04('0x49')]&&!_0x24915e;_0x204460+=0x1){_0x390df8=_0x25c2d9[_0x204460]['toString']();if(manager[_0x9c04('0x4a')](_0x390df8)){if(_0x2a2053[_0x390df8]['cron']&&_0x2a2053[_0x390df8][_0x9c04('0x54')]&&moment()[_0x9c04('0x5b')](_0x2a2053[_0x390df8]['startAt'],_0x2a2053[_0x390df8]['endAt'])){manager[_0x9c04('0x5c')](_0x390df8,_0x2a2053[_0x390df8][_0x9c04('0x53')],handleJob(_0x2a2053[_0x390df8]));logger['info'](_0x9c04('0x5d'),_0x2a2053[_0x390df8][_0x9c04('0x16')],_0x2a2053[_0x390df8]['cron']);}else{manager['stop'](_0x390df8);manager['deleteJob'](_0x390df8);logger[_0x9c04('0xc')](_0x9c04('0x5a'),_0x2a2053[_0x390df8][_0x9c04('0x16')],_0x2a2053[_0x390df8][_0x9c04('0x53')]);}}}})['catch'](function(_0x1586ef){logger[_0x9c04('0x30')](JSON[_0x9c04('0x29')](_0x1586ef));});}exports[_0x9c04('0x5e')]=function(_0x68eb84){return getJobs(_0x68eb84);};exports[_0x9c04('0x58')]=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 b641b18..6ebb222 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 _0x3797=['name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','SequelizeValidationError','start','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','transcribeName','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','format','then','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Mixed','COMPLETED','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3797,0x12f));var _0x7379=function(_0x455e9d,_0x3eb4b4){_0x455e9d=_0x455e9d-0x0;var _0x5abebd=_0x3797[_0x455e9d];return _0x5abebd;};var _=require(_0x7379('0x0'));var AWS=require(_0x7379('0x1'));var rp=require(_0x7379('0x2'));var util=require('util');var BPromise=require(_0x7379('0x3'));var db=require(_0x7379('0x4'))['db'];var logger=require('../../config/logger')(_0x7379('0x5'));function getTranscriptionJob(_0x39e3c1,_0x26ec69,_0x54107f,_0x3b190d){return new Promise(function(_0x5de6e4,_0xbdbbda){var _0x2bba00=new AWS[(_0x7379('0x6'))]({'accessKeyId':_0x26ec69,'secretAccessKey':_0x39e3c1,'region':_0x54107f});_0x2bba00[_0x7379('0x7')]({'TranscriptionJobName':_0x3b190d},function(_0x275a33,_0x57276b){if(_0x275a33){return _0xbdbbda(_0x275a33);}else{return _0x5de6e4(_0x57276b);}});});}function sentiment(_0x4f49ba,_0x3f6f7f,_0x2b5e9e,_0x3dd188,_0x3d6399){return new Promise(function(_0x27879a,_0x51ffd5){var _0x21737b=new AWS['Comprehend']({'accessKeyId':_0x3f6f7f,'secretAccessKey':_0x4f49ba,'region':_0x2b5e9e});_0x21737b[_0x7379('0x8')]({'Text':_0x3dd188,'LanguageCode':_0x3d6399[_0x7379('0x9')](0x0,0x2)},function(_0x205a51,_0x20781d){if(_0x205a51){return _0x51ffd5(_0x205a51);}else{return _0x27879a(_0x20781d);}});});}function checkTranscribeJob(_0x36ac36,_0x5d0532,_0x3cda61){var _0x523b9e;return new BPromise(function(_0x47683c,_0x5edfd5){logger[_0x7379('0xa')](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x36ac36['id'],_0x36ac36[_0x7379('0xb')]));return getTranscriptionJob(_0x3cda61[_0x7379('0xc')],_0x3cda61[_0x7379('0xd')],_0x5d0532[_0x7379('0xe')],_0x36ac36[_0x7379('0xb')])['then'](function(_0x55dd77){logger[_0x7379('0xa')](util['format'](_0x7379('0xf'),_0x36ac36['id'],_0x36ac36['transcribeName'],_0x55dd77[_0x7379('0x10')][_0x7379('0x11')]));if(!_0x36ac36[_0x7379('0x12')]){switch(_0x55dd77['TranscriptionJob'][_0x7379('0x11')]){case'COMPLETED':var _0x160632={'transcribeStatus':_0x55dd77[_0x7379('0x10')][_0x7379('0x11')],'fileUri':_0x55dd77[_0x7379('0x10')][_0x7379('0x13')][_0x7379('0x14')]};logger['info'](util[_0x7379('0x15')]('[RECORDING:%d]\x20Get\x20transcript',_0x36ac36['id']));return rp({'uri':_0x55dd77[_0x7379('0x10')][_0x7379('0x13')][_0x7379('0x14')],'json':!![]})[_0x7379('0x16')](function(_0x20d882){logger[_0x7379('0xa')](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x36ac36['id']));if(_0x20d882&&_0x20d882[_0x7379('0x17')]&&_0x20d882['results']['transcripts']&&_0x20d882[_0x7379('0x17')][_0x7379('0x18')][_0x7379('0x19')]){_0x160632['fileText']='';for(var _0x2b8ad0=0x0;_0x2b8ad0<_0x20d882[_0x7379('0x17')][_0x7379('0x18')]['length'];_0x2b8ad0++){_0x160632['fileText']+=_0x20d882['results'][_0x7379('0x18')][_0x2b8ad0][_0x7379('0x1a')]+'';}}return _0x36ac36[_0x7379('0x1b')](_0x160632);})['then'](function(){logger[_0x7379('0xa')](util[_0x7379('0x15')](_0x7379('0x1c'),_0x36ac36['id']));if(!_0x36ac36[_0x7379('0x1d')]){throw new db[(_0x7379('0x1e'))]['ValidationError'](_0x7379('0x1f'));}if(!_0x5d0532[_0x7379('0x20')]||!_0x5d0532[_0x7379('0x21')]||!_0x5d0532[_0x7379('0x22')]||!_0x5d0532[_0x7379('0x23')]||!_0x5d0532[_0x7379('0x24')]){throw new db['Sequelize'][(_0x7379('0x25'))](_0x7379('0x26'));}if(!_0x160632[_0x7379('0x12')]){throw new Error(_0x7379('0x27'));}if(_0x5d0532[_0x7379('0x21')]===_0x3cda61['id']){return _0x3cda61;}else{return db[_0x7379('0x28')][_0x7379('0x29')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x3b4835){if(!_0x3b4835){throw new db['Sequelize'][(_0x7379('0x25'))](_0x7379('0x2a'));}if(!_0x3b4835[_0x7379('0xc')]||!_0x3b4835['data2']){throw new db[(_0x7379('0x1e'))][(_0x7379('0x25'))](_0x7379('0x2b'));}_0x523b9e=_0x3b4835;logger[_0x7379('0xa')](util[_0x7379('0x15')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x36ac36['id']));return sentiment(_0x523b9e[_0x7379('0xc')],_0x523b9e[_0x7379('0xd')],_0x5d0532[_0x7379('0x22')],_0x160632[_0x7379('0x12')],_0x5d0532[_0x7379('0x23')]);})[_0x7379('0x16')](function(_0x219052){logger[_0x7379('0xa')](util['format'](_0x7379('0x2c'),_0x36ac36['id']));return _0x36ac36[_0x7379('0x1b')]({'sentiment':_0x219052[_0x7379('0x2d')],'sPositive':_0x219052[_0x7379('0x2e')][_0x7379('0x2f')],'sNegative':_0x219052[_0x7379('0x2e')]['Negative'],'sMixed':_0x219052[_0x7379('0x2e')]['Mixed'],'sNeutral':_0x219052[_0x7379('0x2e')][_0x7379('0x30')]});})['then'](function(){logger[_0x7379('0xa')](util['format'](_0x7379('0x1c'),_0x36ac36['id']));_0x47683c();});case'FAILED':return _0x36ac36[_0x7379('0x1b')]({'transcribeStatus':_0x7379('0x31'),'failureReason':_0x55dd77['TranscriptionJob'][_0x7379('0x32')]})[_0x7379('0x16')](function(){logger[_0x7379('0xa')](util['format'](_0x7379('0x1c'),_0x36ac36['id']));_0x47683c();});default:logger[_0x7379('0xa')](util['format'](_0x7379('0x33'),_0x36ac36['id']));break;}}else{return BPromise[_0x7379('0x34')]()[_0x7379('0x16')](function(){if(!_0x36ac36[_0x7379('0x1d')]){throw new db[(_0x7379('0x1e'))][(_0x7379('0x25'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5d0532[_0x7379('0x20')]||!_0x5d0532[_0x7379('0x21')]||!_0x5d0532[_0x7379('0x22')]||!_0x5d0532[_0x7379('0x23')]||!_0x5d0532[_0x7379('0x24')]){throw new db[(_0x7379('0x1e'))][(_0x7379('0x25'))](_0x7379('0x26'));}if(!_0x36ac36['fileText']){throw new Error(_0x7379('0x27'));}if(_0x5d0532[_0x7379('0x21')]===_0x3cda61['id']){return _0x3cda61;}else{return db[_0x7379('0x28')][_0x7379('0x29')]({'where':{'id':_settings[_0x7379('0x21')]}});}})[_0x7379('0x16')](function(_0xf1e22){if(!_0xf1e22){throw new db[(_0x7379('0x1e'))][(_0x7379('0x25'))](_0x7379('0x2a'));}if(!_0xf1e22['data1']||!_0xf1e22['data2']){throw new db[(_0x7379('0x1e'))][(_0x7379('0x25'))](_0x7379('0x2b'));}_0x523b9e=_0xf1e22;logger[_0x7379('0xa')](util[_0x7379('0x15')](_0x7379('0x35'),_0x36ac36['id']));return sentiment(_0x523b9e[_0x7379('0xc')],_0x523b9e['data2'],_0x5d0532[_0x7379('0x22')],_0x36ac36['fileText'],_0x5d0532[_0x7379('0x23')]);})[_0x7379('0x16')](function(_0xef5dde){logger[_0x7379('0xa')](util[_0x7379('0x15')](_0x7379('0x2c'),_0x36ac36['id']));return _0x36ac36[_0x7379('0x1b')]({'sentiment':_0xef5dde['Sentiment'],'sPositive':_0xef5dde[_0x7379('0x2e')][_0x7379('0x2f')],'sNegative':_0xef5dde[_0x7379('0x2e')]['Negative'],'sMixed':_0xef5dde['SentimentScore'][_0x7379('0x36')],'sNeutral':_0xef5dde['SentimentScore'][_0x7379('0x30')],'transcribeStatus':_0x7379('0x37')});})[_0x7379('0x16')](function(){logger[_0x7379('0xa')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x36ac36['id']));_0x47683c();});}})[_0x7379('0x38')](function(_0x4a987c){if(_0x4a987c){if(!_0x4a987c[_0x7379('0x39')]||_0x4a987c[_0x7379('0x39')]!=='SequelizeValidationError'){logger[_0x7379('0x3a')](util[_0x7379('0x15')](_0x7379('0x3b'),_0x36ac36['id']),util[_0x7379('0x3c')](_0x4a987c,{'showHidden':![],'depth':null}));}}_0x47683c();});});}function checkTranscribe(){var _0x36afe6;var _0x36b819;var _0x19de56;return db[_0x7379('0x3d')][_0x7379('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x7379('0x16')](function(_0x1a8551){if(!_0x1a8551||!_0x1a8551[_0x7379('0x19')]){throw new db['Sequelize'][(_0x7379('0x25'))](_0x7379('0x3f'));}_0x36afe6=_0x1a8551;return db[_0x7379('0x40')]['findOne']({'where':{'id':0x1}});})[_0x7379('0x16')](function(_0x1b56f6){if(!_0x1b56f6){throw new db[(_0x7379('0x1e'))]['ValidationError'](_0x7379('0x41'));}_0x36b819=_0x1b56f6;if(!_0x36b819[_0x7379('0x5')]||!_0x36b819[_0x7379('0x42')]||!_0x36b819['transcribeRegion']||!_0x36b819['language']||!_0x36b819[_0x7379('0x24')]){throw new db[(_0x7379('0x1e'))][(_0x7379('0x25'))]('Transcribe\x20not\x20configured');}return db[_0x7379('0x28')][_0x7379('0x29')]({'where':{'id':_0x36b819[_0x7379('0x42')]}});})['then'](function(_0x3d50b7){if(!_0x3d50b7){throw new db['Sequelize'][(_0x7379('0x25'))](_0x7379('0x2a'));}if(!_0x3d50b7[_0x7379('0xc')]||!_0x3d50b7[_0x7379('0xd')]){throw new db[(_0x7379('0x1e'))][(_0x7379('0x25'))](_0x7379('0x2b'));}_0x19de56=_0x3d50b7;var _0x558d4e=[];_0x36afe6[_0x7379('0x43')](function(_0x10dd6c){_0x558d4e[_0x7379('0x44')](checkTranscribeJob(_0x10dd6c,_0x36b819,_0x19de56));});return BPromise[_0x7379('0x45')](_0x558d4e);})['catch'](function(_0x33492){if(_0x33492){if(!_0x33492[_0x7379('0x39')]||_0x33492[_0x7379('0x39')]!==_0x7379('0x46')){logger[_0x7379('0x3a')](util[_0x7379('0x3c')](_0x33492,{'showHidden':![],'depth':null}));}}});}exports[_0x7379('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x06bb=['Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Negative','Mixed','FAILED','FailureReason','resolve','Positive','Neutral','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','IN_PROGRESS','Settings\x20not\x20available','transcribeAccountId','push','all','start','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','transcribeRegion','then','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured'];(function(_0x1ed545,_0x13d867){var _0xabef56=function(_0x5c0959){while(--_0x5c0959){_0x1ed545['push'](_0x1ed545['shift']());}};_0xabef56(++_0x13d867);}(_0x06bb,0x17f));var _0xb06b=function(_0x2980b1,_0x19aa6d){_0x2980b1=_0x2980b1-0x0;var _0x29b6c0=_0x06bb[_0x2980b1];return _0x29b6c0;};var _=require(_0xb06b('0x0'));var AWS=require(_0xb06b('0x1'));var rp=require(_0xb06b('0x2'));var util=require(_0xb06b('0x3'));var BPromise=require('bluebird');var db=require(_0xb06b('0x4'))['db'];var logger=require(_0xb06b('0x5'))(_0xb06b('0x6'));function getTranscriptionJob(_0x12eeca,_0x58d763,_0xce0faf,_0x34006b){return new Promise(function(_0x305e5a,_0x12c135){var _0x5bc1c1=new AWS['TranscribeService']({'accessKeyId':_0x58d763,'secretAccessKey':_0x12eeca,'region':_0xce0faf});_0x5bc1c1[_0xb06b('0x7')]({'TranscriptionJobName':_0x34006b},function(_0x139f7e,_0x3ee6df){if(_0x139f7e){return _0x12c135(_0x139f7e);}else{return _0x305e5a(_0x3ee6df);}});});}function sentiment(_0x238a17,_0x5aa1f8,_0xb205ed,_0x1f84a2,_0x366ac8){return new Promise(function(_0x7050c5,_0x446bcc){var _0x342bd6=new AWS[(_0xb06b('0x8'))]({'accessKeyId':_0x5aa1f8,'secretAccessKey':_0x238a17,'region':_0xb205ed});_0x342bd6[_0xb06b('0x9')]({'Text':_0x1f84a2,'LanguageCode':_0x366ac8['substring'](0x0,0x2)},function(_0x1126ed,_0x11bf76){if(_0x1126ed){return _0x446bcc(_0x1126ed);}else{return _0x7050c5(_0x11bf76);}});});}function checkTranscribeJob(_0x4eda9d,_0x306ebd,_0x12bd5b){var _0x5f005d;return new BPromise(function(_0xb72275,_0x4e06c5){logger[_0xb06b('0xa')](util[_0xb06b('0xb')](_0xb06b('0xc'),_0x4eda9d['id'],_0x4eda9d[_0xb06b('0xd')]));return getTranscriptionJob(_0x12bd5b['data1'],_0x12bd5b['data2'],_0x306ebd[_0xb06b('0xe')],_0x4eda9d[_0xb06b('0xd')])[_0xb06b('0xf')](function(_0x51015e){logger[_0xb06b('0xa')](util[_0xb06b('0xb')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x4eda9d['id'],_0x4eda9d[_0xb06b('0xd')],_0x51015e['TranscriptionJob'][_0xb06b('0x10')]));if(!_0x4eda9d[_0xb06b('0x11')]){switch(_0x51015e[_0xb06b('0x12')][_0xb06b('0x10')]){case _0xb06b('0x13'):var _0x316be6={'transcribeStatus':_0x51015e[_0xb06b('0x12')][_0xb06b('0x10')],'fileUri':_0x51015e['TranscriptionJob'][_0xb06b('0x14')][_0xb06b('0x15')]};logger['info'](util['format'](_0xb06b('0x16'),_0x4eda9d['id']));return rp({'uri':_0x51015e[_0xb06b('0x12')][_0xb06b('0x14')][_0xb06b('0x15')],'json':!![]})['then'](function(_0x345bcd){logger[_0xb06b('0xa')](util[_0xb06b('0xb')](_0xb06b('0x17'),_0x4eda9d['id']));if(_0x345bcd&&_0x345bcd[_0xb06b('0x18')]&&_0x345bcd[_0xb06b('0x18')]['transcripts']&&_0x345bcd[_0xb06b('0x18')][_0xb06b('0x19')][_0xb06b('0x1a')]){_0x316be6['fileText']='';for(var _0x42a16d=0x0;_0x42a16d<_0x345bcd[_0xb06b('0x18')][_0xb06b('0x19')][_0xb06b('0x1a')];_0x42a16d++){_0x316be6[_0xb06b('0x11')]+=_0x345bcd[_0xb06b('0x18')]['transcripts'][_0x42a16d]['transcript']+'';}}return _0x4eda9d['update'](_0x316be6);})['then'](function(){logger[_0xb06b('0xa')](util[_0xb06b('0xb')](_0xb06b('0x1b'),_0x4eda9d['id']));if(!_0x4eda9d[_0xb06b('0x1c')]){throw new db[(_0xb06b('0x1d'))][(_0xb06b('0x1e'))](_0xb06b('0x1f'));}if(!_0x306ebd[_0xb06b('0x20')]||!_0x306ebd[_0xb06b('0x21')]||!_0x306ebd['sentimentRegion']||!_0x306ebd[_0xb06b('0x22')]||!_0x306ebd[_0xb06b('0x23')]){throw new db[(_0xb06b('0x1d'))][(_0xb06b('0x1e'))](_0xb06b('0x24'));}if(!_0x316be6[_0xb06b('0x11')]){throw new Error(_0xb06b('0x25'));}if(_0x306ebd[_0xb06b('0x21')]===_0x12bd5b['id']){return _0x12bd5b;}else{return db[_0xb06b('0x26')][_0xb06b('0x27')]({'where':{'id':_settings[_0xb06b('0x21')]}});}})[_0xb06b('0xf')](function(_0xdebae1){if(!_0xdebae1){throw new db[(_0xb06b('0x1d'))][(_0xb06b('0x1e'))](_0xb06b('0x28'));}if(!_0xdebae1[_0xb06b('0x29')]||!_0xdebae1[_0xb06b('0x2a')]){throw new db[(_0xb06b('0x1d'))][(_0xb06b('0x1e'))](_0xb06b('0x2b'));}_0x5f005d=_0xdebae1;logger['info'](util[_0xb06b('0xb')](_0xb06b('0x2c'),_0x4eda9d['id']));return sentiment(_0x5f005d[_0xb06b('0x29')],_0x5f005d[_0xb06b('0x2a')],_0x306ebd[_0xb06b('0x2d')],_0x316be6[_0xb06b('0x11')],_0x306ebd[_0xb06b('0x22')]);})[_0xb06b('0xf')](function(_0x42da64){logger[_0xb06b('0xa')](util[_0xb06b('0xb')](_0xb06b('0x2e'),_0x4eda9d['id']));return _0x4eda9d[_0xb06b('0x2f')]({'sentiment':_0x42da64[_0xb06b('0x30')],'sPositive':_0x42da64[_0xb06b('0x31')]['Positive'],'sNegative':_0x42da64[_0xb06b('0x31')][_0xb06b('0x32')],'sMixed':_0x42da64[_0xb06b('0x31')][_0xb06b('0x33')],'sNeutral':_0x42da64[_0xb06b('0x31')]['Neutral']});})[_0xb06b('0xf')](function(){logger[_0xb06b('0xa')](util['format'](_0xb06b('0x1b'),_0x4eda9d['id']));_0xb72275();});case _0xb06b('0x34'):return _0x4eda9d[_0xb06b('0x2f')]({'transcribeStatus':_0xb06b('0x34'),'failureReason':_0x51015e[_0xb06b('0x12')][_0xb06b('0x35')]})[_0xb06b('0xf')](function(){logger[_0xb06b('0xa')](util[_0xb06b('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4eda9d['id']));_0xb72275();});default:logger['info'](util[_0xb06b('0xb')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x4eda9d['id']));break;}}else{return BPromise[_0xb06b('0x36')]()['then'](function(){if(!_0x4eda9d['tempSentiment']){throw new db[(_0xb06b('0x1d'))][(_0xb06b('0x1e'))](_0xb06b('0x1f'));}if(!_0x306ebd[_0xb06b('0x20')]||!_0x306ebd[_0xb06b('0x21')]||!_0x306ebd['sentimentRegion']||!_0x306ebd[_0xb06b('0x22')]||!_0x306ebd[_0xb06b('0x23')]){throw new db[(_0xb06b('0x1d'))]['ValidationError'](_0xb06b('0x24'));}if(!_0x4eda9d['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x306ebd[_0xb06b('0x21')]===_0x12bd5b['id']){return _0x12bd5b;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0xb06b('0x21')]}});}})[_0xb06b('0xf')](function(_0x3b6085){if(!_0x3b6085){throw new db[(_0xb06b('0x1d'))]['ValidationError'](_0xb06b('0x28'));}if(!_0x3b6085[_0xb06b('0x29')]||!_0x3b6085[_0xb06b('0x2a')]){throw new db[(_0xb06b('0x1d'))][(_0xb06b('0x1e'))](_0xb06b('0x2b'));}_0x5f005d=_0x3b6085;logger[_0xb06b('0xa')](util[_0xb06b('0xb')](_0xb06b('0x2c'),_0x4eda9d['id']));return sentiment(_0x5f005d['data1'],_0x5f005d[_0xb06b('0x2a')],_0x306ebd[_0xb06b('0x2d')],_0x4eda9d['fileText'],_0x306ebd[_0xb06b('0x22')]);})[_0xb06b('0xf')](function(_0x2943fb){logger[_0xb06b('0xa')](util[_0xb06b('0xb')](_0xb06b('0x2e'),_0x4eda9d['id']));return _0x4eda9d['update']({'sentiment':_0x2943fb[_0xb06b('0x30')],'sPositive':_0x2943fb['SentimentScore'][_0xb06b('0x37')],'sNegative':_0x2943fb[_0xb06b('0x31')]['Negative'],'sMixed':_0x2943fb['SentimentScore'][_0xb06b('0x33')],'sNeutral':_0x2943fb[_0xb06b('0x31')][_0xb06b('0x38')],'transcribeStatus':_0xb06b('0x13')});})[_0xb06b('0xf')](function(){logger[_0xb06b('0xa')](util[_0xb06b('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4eda9d['id']));_0xb72275();});}})[_0xb06b('0x39')](function(_0x37e9a1){if(_0x37e9a1){if(!_0x37e9a1[_0xb06b('0x3a')]||_0x37e9a1[_0xb06b('0x3a')]!==_0xb06b('0x3b')){logger[_0xb06b('0x3c')](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x4eda9d['id']),util[_0xb06b('0x3d')](_0x37e9a1,{'showHidden':![],'depth':null}));}}_0xb72275();});});}function checkTranscribe(){var _0x17a5d2;var _0x1fe66a;var _0x296d19;return db[_0xb06b('0x3e')][_0xb06b('0x3f')]({'where':{'transcribeStatus':_0xb06b('0x40')}})[_0xb06b('0xf')](function(_0x5335d8){if(!_0x5335d8||!_0x5335d8[_0xb06b('0x1a')]){throw new db[(_0xb06b('0x1d'))][(_0xb06b('0x1e'))]('No\x20transcribe\x20job\x20to\x20check');}_0x17a5d2=_0x5335d8;return db['Setting'][_0xb06b('0x27')]({'where':{'id':0x1}});})[_0xb06b('0xf')](function(_0x4b292d){if(!_0x4b292d){throw new db[(_0xb06b('0x1d'))][(_0xb06b('0x1e'))](_0xb06b('0x41'));}_0x1fe66a=_0x4b292d;if(!_0x1fe66a[_0xb06b('0x6')]||!_0x1fe66a[_0xb06b('0x42')]||!_0x1fe66a['transcribeRegion']||!_0x1fe66a['language']||!_0x1fe66a[_0xb06b('0x23')]){throw new db['Sequelize']['ValidationError']('Transcribe\x20not\x20configured');}return db[_0xb06b('0x26')][_0xb06b('0x27')]({'where':{'id':_0x1fe66a[_0xb06b('0x42')]}});})[_0xb06b('0xf')](function(_0x32fe66){if(!_0x32fe66){throw new db[(_0xb06b('0x1d'))][(_0xb06b('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x32fe66['data1']||!_0x32fe66['data2']){throw new db[(_0xb06b('0x1d'))][(_0xb06b('0x1e'))](_0xb06b('0x2b'));}_0x296d19=_0x32fe66;var _0x168a07=[];_0x17a5d2['forEach'](function(_0x2e472e){_0x168a07[_0xb06b('0x43')](checkTranscribeJob(_0x2e472e,_0x1fe66a,_0x296d19));});return BPromise[_0xb06b('0x44')](_0x168a07);})['catch'](function(_0xcda897){if(_0xcda897){if(!_0xcda897[_0xb06b('0x3a')]||_0xcda897['name']!==_0xb06b('0x3b')){logger[_0xb06b('0x3c')](util['inspect'](_0xcda897,{'showHidden':![],'depth':null}));}}});}exports[_0xb06b('0x45')]=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 60df867..c33797e 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 _0xc898=['[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','ioredis','../../mysqldb','../logger','redis','defaults','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','length'];(function(_0x22a1d1,_0x2ff7fc){var _0x5ceff6=function(_0x2b24a6){while(--_0x2b24a6){_0x22a1d1['push'](_0x22a1d1['shift']());}};_0x5ceff6(++_0x2ff7fc);}(_0xc898,0x103));var _0x8c89=function(_0x189aa8,_0x4998fa){_0x189aa8=_0x189aa8-0x0;var _0x277064=_0xc898[_0x189aa8];return _0x277064;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x8c89('0x0'));var util=require('util');var config=require('../../config/environment');var db=require(_0x8c89('0x1'))['db'];var logger=require(_0x8c89('0x2'))('schedule');config[_0x8c89('0x3')]=_[_0x8c89('0x4')](config[_0x8c89('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x8c89('0x5'))(new Redis(config[_0x8c89('0x3')]));function closeInteractions(){var _0x4af000=[];return db[_0x8c89('0x6')][_0x8c89('0x7')]({'raw':!![],'attributes':['id',_0x8c89('0x8')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x8c89('0x9')](0x18,_0x8c89('0xa'))}}})[_0x8c89('0xb')](function(_0x39630a){if(_0x39630a&&_0x39630a['length']){_0x4af000=_[_0x8c89('0xc')](_0x39630a||[],'id');logger[_0x8c89('0xd')](_0x8c89('0xe'),_0x4af000[_0x8c89('0xf')]());return db[_0x8c89('0x6')][_0x8c89('0x10')]({'closeReason':_0x8c89('0x11'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x8c89('0x12')](_0x8c89('0x13'))},{'where':{'id':_0x4af000}});}})[_0x8c89('0xb')](function(){if(_0x4af000&&_0x4af000[_0x8c89('0x14')]){logger['info'](_0x8c89('0x15'),_0x4af000[_0x8c89('0xf')]());for(var _0x26dd94=0x0;_0x26dd94<_0x4af000[_0x8c89('0x14')];_0x26dd94++){io[_0x8c89('0x16')]('whatsappInteraction:update',{'id':_0x4af000[_0x26dd94],'closed':!![]});}}})[_0x8c89('0x17')](function(_0x1a49a8){logger[_0x8c89('0x18')](_0x8c89('0x19'),_0x1a49a8?util[_0x8c89('0x1a')](_0x1a49a8,{'showHidden':![],'depth':null}):'');});}exports[_0x8c89('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x381c=['then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','moment','ioredis','../../config/environment','../logger','redis','defaults','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','hours'];(function(_0x4cf8a9,_0x21e6c3){var _0x486b48=function(_0x53e093){while(--_0x53e093){_0x4cf8a9['push'](_0x4cf8a9['shift']());}};_0x486b48(++_0x21e6c3);}(_0x381c,0x1c8));var _0xc381=function(_0x5e31b7,_0x4a1893){_0x5e31b7=_0x5e31b7-0x0;var _0x3d905d=_0x381c[_0x5e31b7];return _0x3d905d;};'use strict';var _=require('lodash');var moment=require(_0xc381('0x0'));var Redis=require(_0xc381('0x1'));var util=require('util');var config=require(_0xc381('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xc381('0x3'))('schedule');config[_0xc381('0x4')]=_[_0xc381('0x5')](config[_0xc381('0x4')],{'host':_0xc381('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x8e427f=[];return db[_0xc381('0x7')][_0xc381('0x8')]({'raw':!![],'attributes':['id',_0xc381('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xc381('0xa')](0x18,_0xc381('0xb'))}}})[_0xc381('0xc')](function(_0x43af7a){if(_0x43af7a&&_0x43af7a[_0xc381('0xd')]){_0x8e427f=_[_0xc381('0xe')](_0x43af7a||[],'id');logger[_0xc381('0xf')](_0xc381('0x10'),_0x8e427f['join']());return db[_0xc381('0x7')][_0xc381('0x11')]({'closeReason':_0xc381('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xc381('0x13')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x8e427f}});}})['then'](function(){if(_0x8e427f&&_0x8e427f[_0xc381('0xd')]){logger[_0xc381('0xf')](_0xc381('0x14'),_0x8e427f[_0xc381('0x15')]());for(var _0x53040e=0x0;_0x53040e<_0x8e427f[_0xc381('0xd')];_0x53040e++){io['emit']('whatsappInteraction:update',{'id':_0x8e427f[_0x53040e],'closed':!![]});}}})[_0xc381('0x16')](function(_0x5e5172){logger[_0xc381('0x17')](_0xc381('0x18'),_0x5e5172?util['inspect'](_0x5e5172,{'showHidden':![],'depth':null}):'');});}exports[_0xc381('0x19')]=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 23210e3..fd1ebfc 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2283=['destroy','contacts2','catch','util','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','now','Biondo','CmContact','then','bulkCreate','log','finished\x20populating','CmHopper'];(function(_0x3f1c91,_0x2185e1){var _0x1e6899=function(_0x6b1293){while(--_0x6b1293){_0x3f1c91['push'](_0x3f1c91['shift']());}};_0x1e6899(++_0x2185e1);}(_0x2283,0x157));var _0x3228=function(_0x355c9b,_0x53dffe){_0x355c9b=_0x355c9b-0x0;var _0x1b904e=_0x2283[_0x355c9b];return _0x1b904e;};'use strict';var util=require(_0x3228('0x0'));var db=require(_0x3228('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x3228('0x2')]({'id':i,'firstName':_0x3228('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x3228('0x4')+i+_0x3228('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x3228('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x3228('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3228('0x6')](),'updatedAt':Date[_0x3228('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x3228('0x3')+i,'lastName':_0x3228('0x7')+i,'phone':0xf879fb460+i,'email':_0x3228('0x4')+i+_0x3228('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x3228('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x3228('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x3228('0x6')]()});}db[_0x3228('0x8')]['destroy']({'where':{}})[_0x3228('0x9')](function(){return db[_0x3228('0x8')][_0x3228('0xa')](contacts);})[_0x3228('0x9')](function(){console[_0x3228('0xb')](_0x3228('0xc'),'contacts1');return db[_0x3228('0xd')][_0x3228('0xe')]({'where':{}});})[_0x3228('0x9')](function(){return db[_0x3228('0xd')][_0x3228('0xa')](hopper);})[_0x3228('0x9')](function(){console[_0x3228('0xb')](_0x3228('0xc'),'hopper1');return db[_0x3228('0x8')]['bulkCreate'](contacts2);})['then'](function(){console['log'](_0x3228('0xc'),_0x3228('0xf'));return db['CmHopper'][_0x3228('0xa')](hopper2);})[_0x3228('0x9')](function(){console[_0x3228('0xb')](_0x3228('0xc'),'hopper2');})[_0x3228('0x10')](function(_0x5db1ba){console['log'](_0x5db1ba);}); \ No newline at end of file +var _0xffba=['CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','now','push'];(function(_0x27beea,_0x3bc9f4){var _0x122645=function(_0x2c848){while(--_0x2c848){_0x27beea['push'](_0x27beea['shift']());}};_0x122645(++_0x3bc9f4);}(_0xffba,0x1b4));var _0xaffb=function(_0x5c0f13,_0x5de84a){_0x5c0f13=_0x5c0f13-0x0;var _0x1ecf48=_0xffba[_0x5c0f13];return _0x1ecf48;};'use strict';var util=require('util');var db=require(_0xaffb('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xaffb('0x1')+i,'lastName':_0xaffb('0x2')+i,'phone':0xf879fb460+i,'email':_0xaffb('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xaffb('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xaffb('0x4')](),'updatedAt':Date[_0xaffb('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xaffb('0x5')]({'id':i,'firstName':_0xaffb('0x1')+i,'lastName':_0xaffb('0x2')+i,'phone':0xf879fb460+i,'email':_0xaffb('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xaffb('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xaffb('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xaffb('0x4')](),'updatedAt':Date['now']()});}db[_0xaffb('0x6')][_0xaffb('0x7')]({'where':{}})[_0xaffb('0x8')](function(){return db['CmContact'][_0xaffb('0x9')](contacts);})[_0xaffb('0x8')](function(){console[_0xaffb('0xa')](_0xaffb('0xb'),_0xaffb('0xc'));return db['CmHopper']['destroy']({'where':{}});})[_0xaffb('0x8')](function(){return db[_0xaffb('0xd')][_0xaffb('0x9')](hopper);})[_0xaffb('0x8')](function(){console[_0xaffb('0xa')](_0xaffb('0xb'),_0xaffb('0xe'));return db['CmContact'][_0xaffb('0x9')](contacts2);})[_0xaffb('0x8')](function(){console['log'](_0xaffb('0xb'),_0xaffb('0xf'));return db[_0xaffb('0xd')][_0xaffb('0x9')](hopper2);})[_0xaffb('0x8')](function(){console['log'](_0xaffb('0xb'),_0xaffb('0x10'));})['catch'](function(_0x1c330f){console['log'](_0x1c330f);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index efd7190..f88640f 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2390=['%s%s@xcally.com','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','bulkCreate','then','log','add\x20user','catch','../mysqldb','push','format','%s%s','agent'];(function(_0x259449,_0x32f882){var _0x321ae4=function(_0xb63a7e){while(--_0xb63a7e){_0x259449['push'](_0x259449['shift']());}};_0x321ae4(++_0x32f882);}(_0x2390,0x105));var _0x0239=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x2390[_0x9df060];return _0x338dfe;};'use strict';var util=require('util');var db=require(_0x0239('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x0239('0x1')]({'name':util[_0x0239('0x2')](_0x0239('0x3'),_0x0239('0x4'),i),'fullname':util[_0x0239('0x2')](_0x0239('0x3'),_0x0239('0x4'),i),'email':util[_0x0239('0x2')](_0x0239('0x5'),_0x0239('0x4'),i),'role':_0x0239('0x4'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x0239('0x6'),'ws',_0x0239('0x7')],'disallow':[_0x0239('0x8')],'allow':[_0x0239('0x9')],'defaultuser':util['format'](_0x0239('0x3'),_0x0239('0x4'),i),'encryption':_0x0239('0xa'),'avpf':'yes','force_avp':_0x0239('0xa'),'icesupport':'yes','dtlsenable':_0x0239('0xa'),'dtlsverify':'no','dtlscertfile':_0x0239('0xb'),'dtlsprivatekey':_0x0239('0xc'),'dtlssetup':_0x0239('0xd'),'callerid':util[_0x0239('0x2')]('\x22%s\x22\x20<%s>',util[_0x0239('0x2')](_0x0239('0x3'),_0x0239('0x4'),i),0xfa0+i)});}db['User'][_0x0239('0xe')](users)[_0x0239('0xf')](function(){console[_0x0239('0x10')](_0x0239('0x11'));})[_0x0239('0x12')](function(_0x1fdfaa){console[_0x0239('0x10')](_0x1fdfaa);}); \ No newline at end of file +var _0x08af=['then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate'];(function(_0x2bf5bd,_0x120787){var _0xc810c0=function(_0xba9dd3){while(--_0xba9dd3){_0x2bf5bd['push'](_0x2bf5bd['shift']());}};_0xc810c0(++_0x120787);}(_0x08af,0x97));var _0xf08a=function(_0x2382b7,_0x271ef2){_0x2382b7=_0x2382b7-0x0;var _0x4ea157=_0x08af[_0x2382b7];return _0x4ea157;};'use strict';var util=require(_0xf08a('0x0'));var db=require(_0xf08a('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xf08a('0x2')]({'name':util[_0xf08a('0x3')](_0xf08a('0x4'),_0xf08a('0x5'),i),'fullname':util['format']('%s%s',_0xf08a('0x5'),i),'email':util[_0xf08a('0x3')]('%s%s@xcally.com',_0xf08a('0x5'),i),'role':_0xf08a('0x5'),'password':'password','internal':0xfa0+i,'type':_0xf08a('0x6'),'transport':[_0xf08a('0x7'),'ws',_0xf08a('0x8')],'disallow':[_0xf08a('0x9')],'allow':[_0xf08a('0xa')],'defaultuser':util[_0xf08a('0x3')]('%s%s',_0xf08a('0x5'),i),'encryption':_0xf08a('0xb'),'avpf':'yes','force_avp':_0xf08a('0xb'),'icesupport':_0xf08a('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xf08a('0xc'),'dtlsprivatekey':_0xf08a('0xd'),'dtlssetup':_0xf08a('0xe'),'callerid':util[_0xf08a('0x3')]('\x22%s\x22\x20<%s>',util[_0xf08a('0x3')](_0xf08a('0x4'),_0xf08a('0x5'),i),0xfa0+i)});}db[_0xf08a('0xf')][_0xf08a('0x10')](users)[_0xf08a('0x11')](function(){console[_0xf08a('0x12')](_0xf08a('0x13'));})[_0xf08a('0x14')](function(_0x3d4660){console[_0xf08a('0x12')](_0x3d4660);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index c9f7111..cfaaedc 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb199=['all','voice','chat','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','leave','removeChatInteractions','map','removeMailInteractions','emit','removeFaxInteractions','removeSmsInteractions','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','nsp','disconnect','DISCONNECTED','util','bluebird','../mysqldb','./environment','Agents','User','name','role','agent','telephone','type','ivr','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','IvrCampaigns','UserProfileResource','Campaign','where','format','%s:queue:%s','length','user:%s','find','userProfileId','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','WhatsappInteraction','admin','voice:inbound','voice:outbound','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','user','ChatQueue','MailQueues','Telephones','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getWhatsappQueues'];(function(_0x327745,_0x4423fb){var _0x5eb85d=function(_0x4ea199){while(--_0x4ea199){_0x327745['push'](_0x327745['shift']());}};_0x5eb85d(++_0x4423fb);}(_0xb199,0xdc));var _0x9b19=function(_0x13e2f9,_0x183fa6){_0x13e2f9=_0x13e2f9-0x0;var _0x5d0c70=_0xb199[_0x13e2f9];return _0x5d0c70;};'use strict';var _=require('lodash');var util=require(_0x9b19('0x0'));var BPromise=require(_0x9b19('0x1'));var db=require(_0x9b19('0x2'))['db'];var config=require(_0x9b19('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x9b19('0x4'),'model':db[_0x9b19('0x5')],'attributes':['id',_0x9b19('0x6'),_0x9b19('0x7')],'raw':!![],'where':{'role':_0x9b19('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x9b19('0x6')],'where':{'role':_0x9b19('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x9b19('0x6')],'where':{'role':_0x9b19('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x9b19('0x6'),_0x9b19('0xa')],'where':{'type':_0x9b19('0xb')}};function getAssociatedResources(_0x36e712,_0x46db02,_0x4e26d7){return db['UserProfileSection']['findOne']({'where':{'name':_0x36e712,'userProfileId':_0x46db02},'raw':!![]})[_0x9b19('0xc')](function(_0x55406a){if(_0x55406a){if(_0x55406a['autoAssociation']){switch(_0x36e712){case _0x9b19('0xd'):case _0x9b19('0xe'):case _0x9b19('0xf'):case _0x9b19('0x10'):case'MailQueues':case _0x9b19('0x11'):case _0x9b19('0x12'):return db[_0x4e26d7]['findAll'](queryQueues);case'Telephones':return db[_0x4e26d7][_0x9b19('0x13')](queryTelephones);case'Trunks':return db[_0x4e26d7][_0x9b19('0x13')](queryTrunks);case _0x9b19('0x14'):return db[_0x4e26d7][_0x9b19('0x13')](queryCampaigns);}}else{return db[_0x9b19('0x15')][_0x9b19('0x13')]({'attributes':['resourceId'],'where':{'sectionId':_0x55406a['id']},'raw':!![]})['then'](function(_0x1a1e6a){if(_0x1a1e6a){var _0x1b0913={'where':{'id':_['map'](_0x1a1e6a,'resourceId')},'raw':!![]};switch(_0x4e26d7){case _0x9b19('0x5'):_0x1b0913['where'][_0x9b19('0x7')]='telephone';break;case _0x9b19('0x16'):_0x1b0913[_0x9b19('0x17')][_0x9b19('0xa')]=_0x9b19('0xb');break;}return db[_0x4e26d7][_0x9b19('0x13')](_0x1b0913);}else{return[];}});}}else{return[];}})[_0x9b19('0xc')](function(_0x438153){return _0x438153;});}function joinOrLeaveQueues(_0x46c210,_0x1898d8,_0x217a26,_0x7c1723){_0x46c210[_0x1898d8](util[_0x9b19('0x18')](_0x9b19('0x19'),_0x217a26,_0x7c1723[_0x9b19('0x6')]));if(_0x7c1723[_0x9b19('0x4')]){for(var _0x38e571=0x0;_0x38e571<_0x7c1723[_0x9b19('0x4')][_0x9b19('0x1a')];_0x38e571+=0x1){_0x46c210[_0x1898d8](util[_0x9b19('0x18')](_0x9b19('0x1b'),_0x7c1723[_0x9b19('0x4')][_0x38e571][_0x9b19('0x6')]));}}}function joinOrLeave(_0x569e9d,_0x489867,_0x50f4ba){var _0xdfbf5a;if(_0x569e9d['handshake']['query']['id']){db['User'][_0x9b19('0x1c')]({'attributes':['id','name',_0x9b19('0x7'),_0x9b19('0x1d')],'where':{'id':_0x569e9d['handshake'][_0x9b19('0x1e')]['id']},'include':[{'model':db[_0x9b19('0x1f')],'as':_0x9b19('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x9b19('0x21')],'as':_0x9b19('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x9b19('0x23')],'as':_0x9b19('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x9b19('0x25')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9b19('0x26')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9b19('0x27')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x9b19('0xc')](function(_0x346375){if(_0x346375){_0xdfbf5a=_0x346375;_0x569e9d[_0x489867](util[_0x9b19('0x18')](_0x9b19('0x1b'),_0x346375[_0x9b19('0x6')]));var _0x155c26=[];switch(_0x346375[_0x9b19('0x7')]){case _0x9b19('0x28'):_0x569e9d[_0x489867](_0x9b19('0x29'));_0x569e9d[_0x489867](_0x9b19('0x2a'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues['include'];}_0x155c26[_0x9b19('0x2b')](db[_0x9b19('0x2c')]['findAll'](queryQueues));_0x155c26['push'](db['ChatQueue'][_0x9b19('0x13')](queryQueues));_0x155c26[_0x9b19('0x2b')](db[_0x9b19('0x2d')][_0x9b19('0x13')](queryQueues));_0x155c26[_0x9b19('0x2b')](db[_0x9b19('0x2e')][_0x9b19('0x13')](queryQueues));_0x155c26['push'](db[_0x9b19('0x2f')]['findAll'](queryQueues));_0x155c26[_0x9b19('0x2b')](db['OpenchannelQueue'][_0x9b19('0x13')](queryQueues));_0x155c26['push'](db[_0x9b19('0x30')][_0x9b19('0x13')](queryQueues));_0x155c26['push'](db[_0x9b19('0x5')][_0x9b19('0x13')](queryTelephones));_0x155c26[_0x9b19('0x2b')](db[_0x9b19('0x31')]['findAll'](queryTrunks));_0x155c26[_0x9b19('0x2b')](db[_0x9b19('0x16')][_0x9b19('0x13')](queryCampaigns));_0x155c26['push'](db[_0x9b19('0x5')][_0x9b19('0x13')](queryAgents));break;case _0x9b19('0x32'):_0x569e9d[_0x489867](_0x9b19('0x29'));_0x569e9d[_0x489867](_0x9b19('0x2a'));_0x155c26['push'](getAssociatedResources('VoiceQueues',_0x346375[_0x9b19('0x1d')],'VoiceQueue'));_0x155c26[_0x9b19('0x2b')](getAssociatedResources(_0x9b19('0xe'),_0x346375[_0x9b19('0x1d')],_0x9b19('0x33')));_0x155c26[_0x9b19('0x2b')](getAssociatedResources(_0x9b19('0xf'),_0x346375['userProfileId'],_0x9b19('0x2d')));_0x155c26['push'](getAssociatedResources(_0x9b19('0x10'),_0x346375['userProfileId'],_0x9b19('0x2e')));_0x155c26[_0x9b19('0x2b')](getAssociatedResources(_0x9b19('0x34'),_0x346375[_0x9b19('0x1d')],_0x9b19('0x2f')));_0x155c26[_0x9b19('0x2b')](getAssociatedResources(_0x9b19('0x11'),_0x346375[_0x9b19('0x1d')],'OpenchannelQueue'));_0x155c26[_0x9b19('0x2b')](getAssociatedResources('WhatsappQueues',_0x346375[_0x9b19('0x1d')],'WhatsappQueue'));_0x155c26['push'](getAssociatedResources(_0x9b19('0x35'),_0x346375[_0x9b19('0x1d')],_0x9b19('0x5')));_0x155c26[_0x9b19('0x2b')](getAssociatedResources('Trunks',_0x346375[_0x9b19('0x1d')],_0x9b19('0x31')));_0x155c26[_0x9b19('0x2b')](getAssociatedResources(_0x9b19('0x14'),_0x346375[_0x9b19('0x1d')],_0x9b19('0x16')));_0x155c26[_0x9b19('0x2b')](db[_0x9b19('0x5')][_0x9b19('0x13')](queryAgents));break;case _0x9b19('0x8'):_0x569e9d[_0x489867]('voice:inbound');_0x569e9d[_0x489867]('voice:outbound');_0x155c26[_0x9b19('0x2b')](_0x346375[_0x9b19('0x36')]({'attributes':['id','name']}));_0x155c26[_0x9b19('0x2b')](_0x346375[_0x9b19('0x37')]({'attributes':['id',_0x9b19('0x6')]}));_0x155c26[_0x9b19('0x2b')](_0x346375[_0x9b19('0x38')]({'attributes':['id',_0x9b19('0x6')]}));_0x155c26[_0x9b19('0x2b')](_0x346375['getSmsQueues']({'attributes':['id',_0x9b19('0x6')]}));_0x155c26[_0x9b19('0x2b')](_0x346375[_0x9b19('0x39')]({'attributes':['id',_0x9b19('0x6')]}));_0x155c26[_0x9b19('0x2b')](_0x346375['getOpenchannelQueues']({'attributes':['id','name']}));_0x155c26['push'](_0x346375[_0x9b19('0x3a')]({'attributes':['id','name']}));break;}return BPromise[_0x9b19('0x3b')](_0x155c26);}})['then'](function(_0x46b0c0){if(_0x46b0c0&&_0x46b0c0['length']){for(var _0xe1f949=0x0;_0xe1f949<_0x46b0c0[_0x9b19('0x1a')];_0xe1f949+=0x1){for(var _0x3a7e49=0x0;_0x3a7e49<_0x46b0c0[_0xe1f949]['length'];_0x3a7e49+=0x1){switch(_0xe1f949){case 0x0:joinOrLeaveQueues(_0x569e9d,_0x489867,_0x9b19('0x3c'),_0x46b0c0[_0xe1f949][_0x3a7e49]);break;case 0x1:joinOrLeaveQueues(_0x569e9d,_0x489867,_0x9b19('0x3d'),_0x46b0c0[_0xe1f949][_0x3a7e49]);break;case 0x2:joinOrLeaveQueues(_0x569e9d,_0x489867,'fax',_0x46b0c0[_0xe1f949][_0x3a7e49]);break;case 0x3:joinOrLeaveQueues(_0x569e9d,_0x489867,_0x9b19('0x3e'),_0x46b0c0[_0xe1f949][_0x3a7e49]);break;case 0x4:joinOrLeaveQueues(_0x569e9d,_0x489867,_0x9b19('0x3f'),_0x46b0c0[_0xe1f949][_0x3a7e49]);break;case 0x5:joinOrLeaveQueues(_0x569e9d,_0x489867,_0x9b19('0x40'),_0x46b0c0[_0xe1f949][_0x3a7e49]);break;case 0x6:joinOrLeaveQueues(_0x569e9d,_0x489867,_0x9b19('0x41'),_0x46b0c0[_0xe1f949][_0x3a7e49]);break;case 0x7:if(_0xdfbf5a[_0x9b19('0x7')]!=='agent')_0x569e9d[_0x489867](util['format'](_0x9b19('0x42'),_0x46b0c0[_0xe1f949][_0x3a7e49]['name']));break;case 0x8:if(_0xdfbf5a[_0x9b19('0x7')]!=='agent')_0x569e9d[_0x489867](util['format'](_0x9b19('0x43'),_0x46b0c0[_0xe1f949][_0x3a7e49][_0x9b19('0x6')]));break;case 0x9:if(_0xdfbf5a['role']!==_0x9b19('0x8'))_0x569e9d[_0x489867](util[_0x9b19('0x18')]('campaign:%s:%s',_0x46b0c0[_0xe1f949][_0x3a7e49][_0x9b19('0xa')],_0x46b0c0[_0xe1f949][_0x3a7e49]['name']));break;case 0xa:_0x569e9d[_0x489867](util[_0x9b19('0x18')](_0x9b19('0x1b'),_0x46b0c0[_0xe1f949][_0x3a7e49][_0x9b19('0x6')]));break;}}}}})['then'](function(){if(_0x489867===_0x9b19('0x44')){var _0x6fe833=_['map'](_0xdfbf5a[_0x9b19('0x20')],'id');return _0xdfbf5a[_0x9b19('0x45')](_0x6fe833)['then'](function(){for(var _0xee3f15=0x0;_0xee3f15<_0x6fe833[_0x9b19('0x1a')];_0xee3f15+=0x1){_0x50f4ba['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x6fe833[_0xee3f15]),'UserId':Number(_0xdfbf5a['id'])});}});}})[_0x9b19('0xc')](function(){if(_0x489867==='leave'){var _0x16a9fd=_[_0x9b19('0x46')](_0xdfbf5a['MailInteractions'],'id');return _0xdfbf5a[_0x9b19('0x47')](_0x16a9fd)[_0x9b19('0xc')](function(){for(var _0x51fa41=0x0;_0x51fa41<_0x16a9fd[_0x9b19('0x1a')];_0x51fa41+=0x1){_0x50f4ba[_0x9b19('0x48')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x16a9fd[_0x51fa41]),'UserId':Number(_0xdfbf5a['id'])});}});}})[_0x9b19('0xc')](function(){if(_0x489867===_0x9b19('0x44')){var _0xa78fea=_[_0x9b19('0x46')](_0xdfbf5a[_0x9b19('0x24')],'id');return _0xdfbf5a[_0x9b19('0x49')](_0xa78fea)[_0x9b19('0xc')](function(){for(var _0x427087=0x0;_0x427087<_0xa78fea[_0x9b19('0x1a')];_0x427087+=0x1){_0x50f4ba[_0x9b19('0x48')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0xa78fea[_0x427087]),'UserId':Number(_0xdfbf5a['id'])});}});}})['then'](function(){if(_0x489867===_0x9b19('0x44')){var _0x3f7c1d=_[_0x9b19('0x46')](_0xdfbf5a['SmsInteractions'],'id');return _0xdfbf5a[_0x9b19('0x4a')](_0x3f7c1d)[_0x9b19('0xc')](function(){for(var _0x24293c=0x0;_0x24293c<_0x3f7c1d[_0x9b19('0x1a')];_0x24293c+=0x1){_0x50f4ba[_0x9b19('0x48')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x3f7c1d[_0x24293c]),'UserId':Number(_0xdfbf5a['id'])});}});}})[_0x9b19('0xc')](function(){if(_0x489867===_0x9b19('0x44')){var _0x426f6f=_[_0x9b19('0x46')](_0xdfbf5a[_0x9b19('0x4b')],'id');return _0xdfbf5a[_0x9b19('0x4c')](_0x426f6f)['then'](function(){for(var _0x586b2f=0x0;_0x586b2f<_0x426f6f[_0x9b19('0x1a')];_0x586b2f+=0x1){_0x50f4ba[_0x9b19('0x48')](_0x9b19('0x4d'),{'OpenchannelInteractionId':Number(_0x426f6f[_0x586b2f]),'UserId':Number(_0xdfbf5a['id'])});}});}})['then'](function(){if(_0x489867===_0x9b19('0x44')){var _0x32e01b=_[_0x9b19('0x46')](_0xdfbf5a[_0x9b19('0x4e')],'id');return _0xdfbf5a[_0x9b19('0x4f')](_0x32e01b)['then'](function(){for(var _0x219aeb=0x0;_0x219aeb<_0x32e01b[_0x9b19('0x1a')];_0x219aeb+=0x1){_0x50f4ba['emit'](_0x9b19('0x50'),{'WhatsappInteractionId':Number(_0x32e01b[_0x219aeb]),'UserId':Number(_0xdfbf5a['id'])});}});}})['catch'](function(_0x2e5a74){_0x569e9d[_0x9b19('0x51')](_0x2e5a74);});}}function onDisconnect(_0x28ade5,_0x15de0e){joinOrLeave(_0x28ade5,_0x9b19('0x44'),_0x15de0e);}function onConnect(_0x5006b7){joinOrLeave(_0x5006b7,_0x9b19('0x52'));}exports['default']=function(_0x59ece3){_0x59ece3['on'](_0x9b19('0x53'),function(_0x5a932e){_0x5a932e[_0x9b19('0x54')](0x0);_0x5a932e[_0x9b19('0x55')]=_0x5a932e[_0x9b19('0x56')][_0x9b19('0x53')][_0x9b19('0x57')]+':'+_0x5a932e['request'][_0x9b19('0x53')][_0x9b19('0x58')];_0x5a932e[_0x9b19('0x59')]=new Date();_0x5a932e[_0x9b19('0x51')]=function(_0x56556d){console[_0x9b19('0x51')]('SocketIO\x20'+_0x5a932e[_0x9b19('0x5a')][_0x9b19('0x6')]+'['+_0x5a932e['address']+']',_0x56556d);};_0x5a932e['on'](_0x9b19('0x5b'),function(){onDisconnect(_0x5a932e,_0x59ece3);_0x5a932e[_0x9b19('0x51')](_0x9b19('0x5c'));});onConnect(_0x5a932e);_0x5a932e[_0x9b19('0x51')]('CONNECTED');});}; \ No newline at end of file +var _0x76d0=['trunk:%s','campaign:%s:%s','leave','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','catch','join','setMaxListeners','address','request','connection','remotePort','connectedAt','log','SocketIO\x20','nsp','disconnect','CONNECTED','lodash','util','bluebird','name','Agents','User','role','telephone','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','format','%s:queue:%s','length','query','find','handshake','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','Trunk','user','userProfileId','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','fax','mail','whatsapp'];(function(_0x7cfa71,_0x18fd53){var _0x4def48=function(_0x4b8cd8){while(--_0x4b8cd8){_0x7cfa71['push'](_0x7cfa71['shift']());}};_0x4def48(++_0x18fd53);}(_0x76d0,0x132));var _0x076d=function(_0x470e67,_0x7ac18b){_0x470e67=_0x470e67-0x0;var _0x5ddece=_0x76d0[_0x470e67];return _0x5ddece;};'use strict';var _=require(_0x076d('0x0'));var util=require(_0x076d('0x1'));var BPromise=require(_0x076d('0x2'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x076d('0x3')],'include':[{'as':_0x076d('0x4'),'model':db[_0x076d('0x5')],'attributes':['id',_0x076d('0x3'),_0x076d('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x076d('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x076d('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x076d('0x3')],'where':{'role':_0x076d('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x076d('0x3'),_0x076d('0x9')],'where':{'type':_0x076d('0xa')}};function getAssociatedResources(_0x34c281,_0x48362d,_0x1a2a7d){return db[_0x076d('0xb')][_0x076d('0xc')]({'where':{'name':_0x34c281,'userProfileId':_0x48362d},'raw':!![]})[_0x076d('0xd')](function(_0x47baeb){if(_0x47baeb){if(_0x47baeb[_0x076d('0xe')]){switch(_0x34c281){case _0x076d('0xf'):case _0x076d('0x10'):case _0x076d('0x11'):case'SmsQueues':case _0x076d('0x12'):case _0x076d('0x13'):case _0x076d('0x14'):return db[_0x1a2a7d][_0x076d('0x15')](queryQueues);case'Telephones':return db[_0x1a2a7d]['findAll'](queryTelephones);case _0x076d('0x16'):return db[_0x1a2a7d][_0x076d('0x15')](queryTrunks);case _0x076d('0x17'):return db[_0x1a2a7d][_0x076d('0x15')](queryCampaigns);}}else{return db[_0x076d('0x18')][_0x076d('0x15')]({'attributes':[_0x076d('0x19')],'where':{'sectionId':_0x47baeb['id']},'raw':!![]})['then'](function(_0x535b8c){if(_0x535b8c){var _0x182fd5={'where':{'id':_[_0x076d('0x1a')](_0x535b8c,_0x076d('0x19'))},'raw':!![]};switch(_0x1a2a7d){case _0x076d('0x5'):_0x182fd5[_0x076d('0x1b')][_0x076d('0x6')]=_0x076d('0x7');break;case _0x076d('0x1c'):_0x182fd5[_0x076d('0x1b')][_0x076d('0x9')]='ivr';break;}return db[_0x1a2a7d][_0x076d('0x15')](_0x182fd5);}else{return[];}});}}else{return[];}})[_0x076d('0xd')](function(_0x1efb6d){return _0x1efb6d;});}function joinOrLeaveQueues(_0x17e83a,_0x358640,_0x59b0f3,_0x5f334f){_0x17e83a[_0x358640](util[_0x076d('0x1d')](_0x076d('0x1e'),_0x59b0f3,_0x5f334f[_0x076d('0x3')]));if(_0x5f334f['Agents']){for(var _0x4fdba1=0x0;_0x4fdba1<_0x5f334f[_0x076d('0x4')][_0x076d('0x1f')];_0x4fdba1+=0x1){_0x17e83a[_0x358640](util[_0x076d('0x1d')]('user:%s',_0x5f334f[_0x076d('0x4')][_0x4fdba1][_0x076d('0x3')]));}}}function joinOrLeave(_0x1917ec,_0xe8d738,_0x43f5ca){var _0x49f63f;if(_0x1917ec['handshake'][_0x076d('0x20')]['id']){db[_0x076d('0x5')][_0x076d('0x21')]({'attributes':['id',_0x076d('0x3'),_0x076d('0x6'),'userProfileId'],'where':{'id':_0x1917ec[_0x076d('0x22')][_0x076d('0x20')]['id']},'include':[{'model':db[_0x076d('0x23')],'as':_0x076d('0x24'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x076d('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x076d('0x26')],'as':_0x076d('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x076d('0x28')],'as':_0x076d('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x076d('0x2a')],'as':_0x076d('0x2b'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x076d('0x2c'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x62190f){if(_0x62190f){_0x49f63f=_0x62190f;_0x1917ec[_0xe8d738](util[_0x076d('0x1d')](_0x076d('0x2d'),_0x62190f['name']));var _0x469dce=[];switch(_0x62190f['role']){case _0x076d('0x2e'):_0x1917ec[_0xe8d738](_0x076d('0x2f'));_0x1917ec[_0xe8d738](_0x076d('0x30'));if(queryQueues[_0x076d('0x31')]('include')){delete queryQueues['include'];}_0x469dce[_0x076d('0x32')](db[_0x076d('0x33')][_0x076d('0x15')](queryQueues));_0x469dce['push'](db[_0x076d('0x34')]['findAll'](queryQueues));_0x469dce['push'](db[_0x076d('0x35')][_0x076d('0x15')](queryQueues));_0x469dce['push'](db[_0x076d('0x36')][_0x076d('0x15')](queryQueues));_0x469dce[_0x076d('0x32')](db[_0x076d('0x37')][_0x076d('0x15')](queryQueues));_0x469dce['push'](db['OpenchannelQueue'][_0x076d('0x15')](queryQueues));_0x469dce[_0x076d('0x32')](db['WhatsappQueue'][_0x076d('0x15')](queryQueues));_0x469dce[_0x076d('0x32')](db[_0x076d('0x5')][_0x076d('0x15')](queryTelephones));_0x469dce['push'](db[_0x076d('0x38')]['findAll'](queryTrunks));_0x469dce[_0x076d('0x32')](db[_0x076d('0x1c')][_0x076d('0x15')](queryCampaigns));_0x469dce[_0x076d('0x32')](db[_0x076d('0x5')][_0x076d('0x15')](queryAgents));break;case _0x076d('0x39'):_0x1917ec[_0xe8d738](_0x076d('0x2f'));_0x1917ec[_0xe8d738](_0x076d('0x30'));_0x469dce[_0x076d('0x32')](getAssociatedResources('VoiceQueues',_0x62190f['userProfileId'],_0x076d('0x33')));_0x469dce[_0x076d('0x32')](getAssociatedResources(_0x076d('0x10'),_0x62190f[_0x076d('0x3a')],_0x076d('0x34')));_0x469dce[_0x076d('0x32')](getAssociatedResources(_0x076d('0x11'),_0x62190f[_0x076d('0x3a')],'FaxQueue'));_0x469dce[_0x076d('0x32')](getAssociatedResources('SmsQueues',_0x62190f[_0x076d('0x3a')],_0x076d('0x36')));_0x469dce[_0x076d('0x32')](getAssociatedResources('MailQueues',_0x62190f[_0x076d('0x3a')],_0x076d('0x37')));_0x469dce[_0x076d('0x32')](getAssociatedResources('OpenchannelQueues',_0x62190f[_0x076d('0x3a')],'OpenchannelQueue'));_0x469dce[_0x076d('0x32')](getAssociatedResources('WhatsappQueues',_0x62190f[_0x076d('0x3a')],'WhatsappQueue'));_0x469dce[_0x076d('0x32')](getAssociatedResources('Telephones',_0x62190f[_0x076d('0x3a')],_0x076d('0x5')));_0x469dce['push'](getAssociatedResources('Trunks',_0x62190f[_0x076d('0x3a')],_0x076d('0x38')));_0x469dce[_0x076d('0x32')](getAssociatedResources('IvrCampaigns',_0x62190f[_0x076d('0x3a')],_0x076d('0x1c')));_0x469dce[_0x076d('0x32')](db[_0x076d('0x5')]['findAll'](queryAgents));break;case _0x076d('0x8'):_0x1917ec[_0xe8d738]('voice:inbound');_0x1917ec[_0xe8d738](_0x076d('0x30'));_0x469dce[_0x076d('0x32')](_0x62190f[_0x076d('0x3b')]({'attributes':['id','name']}));_0x469dce['push'](_0x62190f[_0x076d('0x3c')]({'attributes':['id',_0x076d('0x3')]}));_0x469dce['push'](_0x62190f[_0x076d('0x3d')]({'attributes':['id','name']}));_0x469dce[_0x076d('0x32')](_0x62190f[_0x076d('0x3e')]({'attributes':['id',_0x076d('0x3')]}));_0x469dce[_0x076d('0x32')](_0x62190f['getMailQueues']({'attributes':['id',_0x076d('0x3')]}));_0x469dce['push'](_0x62190f[_0x076d('0x3f')]({'attributes':['id',_0x076d('0x3')]}));_0x469dce[_0x076d('0x32')](_0x62190f[_0x076d('0x40')]({'attributes':['id',_0x076d('0x3')]}));break;}return BPromise['all'](_0x469dce);}})['then'](function(_0x58f955){if(_0x58f955&&_0x58f955['length']){for(var _0x350554=0x0;_0x350554<_0x58f955[_0x076d('0x1f')];_0x350554+=0x1){for(var _0x3d7fd9=0x0;_0x3d7fd9<_0x58f955[_0x350554]['length'];_0x3d7fd9+=0x1){switch(_0x350554){case 0x0:joinOrLeaveQueues(_0x1917ec,_0xe8d738,_0x076d('0x41'),_0x58f955[_0x350554][_0x3d7fd9]);break;case 0x1:joinOrLeaveQueues(_0x1917ec,_0xe8d738,_0x076d('0x42'),_0x58f955[_0x350554][_0x3d7fd9]);break;case 0x2:joinOrLeaveQueues(_0x1917ec,_0xe8d738,_0x076d('0x43'),_0x58f955[_0x350554][_0x3d7fd9]);break;case 0x3:joinOrLeaveQueues(_0x1917ec,_0xe8d738,'sms',_0x58f955[_0x350554][_0x3d7fd9]);break;case 0x4:joinOrLeaveQueues(_0x1917ec,_0xe8d738,_0x076d('0x44'),_0x58f955[_0x350554][_0x3d7fd9]);break;case 0x5:joinOrLeaveQueues(_0x1917ec,_0xe8d738,'openchannel',_0x58f955[_0x350554][_0x3d7fd9]);break;case 0x6:joinOrLeaveQueues(_0x1917ec,_0xe8d738,_0x076d('0x45'),_0x58f955[_0x350554][_0x3d7fd9]);break;case 0x7:if(_0x49f63f[_0x076d('0x6')]!==_0x076d('0x8'))_0x1917ec[_0xe8d738](util[_0x076d('0x1d')]('telephone:%s',_0x58f955[_0x350554][_0x3d7fd9][_0x076d('0x3')]));break;case 0x8:if(_0x49f63f[_0x076d('0x6')]!==_0x076d('0x8'))_0x1917ec[_0xe8d738](util['format'](_0x076d('0x46'),_0x58f955[_0x350554][_0x3d7fd9][_0x076d('0x3')]));break;case 0x9:if(_0x49f63f[_0x076d('0x6')]!==_0x076d('0x8'))_0x1917ec[_0xe8d738](util['format'](_0x076d('0x47'),_0x58f955[_0x350554][_0x3d7fd9][_0x076d('0x9')],_0x58f955[_0x350554][_0x3d7fd9][_0x076d('0x3')]));break;case 0xa:_0x1917ec[_0xe8d738](util['format'](_0x076d('0x2d'),_0x58f955[_0x350554][_0x3d7fd9][_0x076d('0x3')]));break;}}}}})[_0x076d('0xd')](function(){if(_0xe8d738===_0x076d('0x48')){var _0x76541c=_[_0x076d('0x1a')](_0x49f63f[_0x076d('0x24')],'id');return _0x49f63f['removeChatInteractions'](_0x76541c)['then'](function(){for(var _0x363fcc=0x0;_0x363fcc<_0x76541c[_0x076d('0x1f')];_0x363fcc+=0x1){_0x43f5ca[_0x076d('0x49')](_0x076d('0x4a'),{'ChatInteractionId':Number(_0x76541c[_0x363fcc]),'UserId':Number(_0x49f63f['id'])});}});}})[_0x076d('0xd')](function(){if(_0xe8d738===_0x076d('0x48')){var _0x33ecd3=_[_0x076d('0x1a')](_0x49f63f[_0x076d('0x25')],'id');return _0x49f63f[_0x076d('0x4b')](_0x33ecd3)[_0x076d('0xd')](function(){for(var _0x4f6e1a=0x0;_0x4f6e1a<_0x33ecd3[_0x076d('0x1f')];_0x4f6e1a+=0x1){_0x43f5ca[_0x076d('0x49')](_0x076d('0x4c'),{'MailInteractionId':Number(_0x33ecd3[_0x4f6e1a]),'UserId':Number(_0x49f63f['id'])});}});}})[_0x076d('0xd')](function(){if(_0xe8d738==='leave'){var _0x2af429=_[_0x076d('0x1a')](_0x49f63f['FaxInteractions'],'id');return _0x49f63f[_0x076d('0x4d')](_0x2af429)[_0x076d('0xd')](function(){for(var _0x3cb01b=0x0;_0x3cb01b<_0x2af429[_0x076d('0x1f')];_0x3cb01b+=0x1){_0x43f5ca[_0x076d('0x49')](_0x076d('0x4e'),{'FaxInteractionId':Number(_0x2af429[_0x3cb01b]),'UserId':Number(_0x49f63f['id'])});}});}})['then'](function(){if(_0xe8d738===_0x076d('0x48')){var _0x5e3eac=_[_0x076d('0x1a')](_0x49f63f[_0x076d('0x29')],'id');return _0x49f63f['removeSmsInteractions'](_0x5e3eac)[_0x076d('0xd')](function(){for(var _0x4abe1f=0x0;_0x4abe1f<_0x5e3eac['length'];_0x4abe1f+=0x1){_0x43f5ca[_0x076d('0x49')](_0x076d('0x4f'),{'SmsInteractionId':Number(_0x5e3eac[_0x4abe1f]),'UserId':Number(_0x49f63f['id'])});}});}})[_0x076d('0xd')](function(){if(_0xe8d738===_0x076d('0x48')){var _0xd0e765=_[_0x076d('0x1a')](_0x49f63f[_0x076d('0x2b')],'id');return _0x49f63f['removeOpenchannelInteractions'](_0xd0e765)[_0x076d('0xd')](function(){for(var _0x10e55d=0x0;_0x10e55d<_0xd0e765[_0x076d('0x1f')];_0x10e55d+=0x1){_0x43f5ca[_0x076d('0x49')](_0x076d('0x50'),{'OpenchannelInteractionId':Number(_0xd0e765[_0x10e55d]),'UserId':Number(_0x49f63f['id'])});}});}})[_0x076d('0xd')](function(){if(_0xe8d738===_0x076d('0x48')){var _0x4318f0=_[_0x076d('0x1a')](_0x49f63f[_0x076d('0x2c')],'id');return _0x49f63f['removeWhatsappInteractions'](_0x4318f0)[_0x076d('0xd')](function(){for(var _0x1fca57=0x0;_0x1fca57<_0x4318f0[_0x076d('0x1f')];_0x1fca57+=0x1){_0x43f5ca[_0x076d('0x49')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x4318f0[_0x1fca57]),'UserId':Number(_0x49f63f['id'])});}});}})[_0x076d('0x51')](function(_0x5ec1c6){_0x1917ec['log'](_0x5ec1c6);});}}function onDisconnect(_0x4e5734,_0x3f8fd8){joinOrLeave(_0x4e5734,_0x076d('0x48'),_0x3f8fd8);}function onConnect(_0x393a1b){joinOrLeave(_0x393a1b,_0x076d('0x52'));}exports['default']=function(_0x20b91a){_0x20b91a['on']('connection',function(_0x12bd6a){_0x12bd6a[_0x076d('0x53')](0x0);_0x12bd6a[_0x076d('0x54')]=_0x12bd6a[_0x076d('0x55')][_0x076d('0x56')]['remoteAddress']+':'+_0x12bd6a[_0x076d('0x55')][_0x076d('0x56')][_0x076d('0x57')];_0x12bd6a[_0x076d('0x58')]=new Date();_0x12bd6a[_0x076d('0x59')]=function(_0x4e7ef5){console[_0x076d('0x59')](_0x076d('0x5a')+_0x12bd6a[_0x076d('0x5b')]['name']+'['+_0x12bd6a['address']+']',_0x4e7ef5);};_0x12bd6a['on'](_0x076d('0x5c'),function(){onDisconnect(_0x12bd6a,_0x20b91a);_0x12bd6a[_0x076d('0x59')]('DISCONNECTED');});onConnect(_0x12bd6a);_0x12bd6a[_0x076d('0x59')](_0x076d('0x5d'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 951c103..62e3757 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 _0x0210=['opened','changed','closed','find','length','hasOwnProperty','model','hook','callback','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','ChatInteraction','newinteraction','closedinteraction','ChatMessage','newmessage','SmsInteraction','afterCreate','Sms','afterUpdate','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','event','direction','UserId','User','interface','format','SIP/%s','name','incomingmessage','outgoingmessage'];(function(_0x1116bf,_0x3045c6){var _0x21b4d3=function(_0x464d04){while(--_0x464d04){_0x1116bf['push'](_0x1116bf['shift']());}};_0x21b4d3(++_0x3045c6);}(_0x0210,0xb5));var _0x0021=function(_0xd00395,_0x2f090e){_0xd00395=_0xd00395-0x0;var _0x248adf=_0x0210[_0xd00395];return _0x248adf;};'use strict';var util=require(_0x0021('0x0'));var db=require(_0x0021('0x1'))['db'];var jayson=require(_0x0021('0x2'));var logger=require(_0x0021('0x3'))(_0x0021('0x4'));var client=jayson[_0x0021('0x5')][_0x0021('0x6')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x0021('0x7'),'event':'afterCreate','condition':_0x0021('0x8'),'callback':afterCreate},{'channel':'Chat','model':'ChatInteraction','event':'afterUpdate','condition':_0x0021('0x9'),'callback':afterUpdate},{'channel':'Chat','model':_0x0021('0xa'),'event':'afterCreate','condition':_0x0021('0xb'),'callback':afterCreateMessage},{'channel':'Sms','model':_0x0021('0xc'),'event':_0x0021('0xd'),'condition':_0x0021('0x8'),'callback':afterCreate},{'channel':_0x0021('0xe'),'model':_0x0021('0xc'),'event':_0x0021('0xf'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x0021('0xe'),'model':_0x0021('0x10'),'event':'afterCreate','condition':_0x0021('0xb'),'callback':afterCreateMessage},{'channel':_0x0021('0x11'),'model':_0x0021('0x12'),'event':_0x0021('0xd'),'condition':_0x0021('0x8'),'callback':afterCreate},{'channel':'Whatsapp','model':_0x0021('0x12'),'event':_0x0021('0xf'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x0021('0x11'),'model':_0x0021('0x13'),'event':'afterCreate','condition':_0x0021('0xb'),'callback':afterCreateMessage},{'channel':_0x0021('0x14'),'model':_0x0021('0x15'),'event':_0x0021('0xd'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x0021('0x14'),'model':_0x0021('0x15'),'event':_0x0021('0xf'),'condition':_0x0021('0x9'),'callback':afterUpdate},{'channel':_0x0021('0x14'),'model':'FaxMessage','event':_0x0021('0xd'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x0021('0x16'),'model':_0x0021('0x17'),'event':_0x0021('0xd'),'condition':_0x0021('0x8'),'callback':afterCreate},{'channel':_0x0021('0x16'),'model':_0x0021('0x17'),'event':_0x0021('0xf'),'condition':_0x0021('0x9'),'callback':afterUpdate},{'channel':_0x0021('0x16'),'model':'MailMessage','event':_0x0021('0xd'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Openchannel','model':_0x0021('0x18'),'event':_0x0021('0xd'),'condition':_0x0021('0x8'),'callback':afterCreate},{'channel':_0x0021('0x19'),'model':_0x0021('0x18'),'event':_0x0021('0xf'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x0021('0x19'),'model':_0x0021('0x1a'),'event':_0x0021('0xd'),'condition':_0x0021('0xb'),'callback':afterCreateMessage}];function request(_0x32a75a){return client[_0x0021('0x1b')](_0x0021('0x1c'),_0x32a75a)[_0x0021('0x1d')](function(_0x3627fc){logger[_0x0021('0x1e')](_0x0021('0x1f'),_0x0021('0x1c'),_0x3627fc);if(_0x3627fc[_0x0021('0x20')]){if(_0x3627fc['error'][_0x0021('0x21')]===0x1f4){logger['error'](_0x0021('0x1f'),_0x0021('0x1c'),_0x3627fc[_0x0021('0x20')]);}}})[_0x0021('0x22')](function(_0x4648a9){logger[_0x0021('0x20')](_0x0021('0x1f'),_0x0021('0x1c'),_0x4648a9);});}function afterCreateMessage(_0x5f249a,_0x3a30fe){return function(_0x5ae063,_0x269138){_0x5ae063=_0x5ae063[_0x0021('0x23')]({'plain':!![]});_0x5ae063[_0x0021('0x24')]=_0x5f249a;_0x5ae063[_0x0021('0x25')]=_0x5ae063[_0x0021('0x26')];if(_0x5ae063[_0x0021('0x27')]){return db[_0x0021('0x28')]['find']({'where':{'id':_0x5ae063['UserId']},'attributes':['id','name'],'raw':!![]})[_0x0021('0x1d')](function(_0x515cae){_0x5ae063[_0x0021('0x29')]=util[_0x0021('0x2a')](_0x0021('0x2b'),_0x515cae[_0x0021('0x2c')]);_0x5ae063['channel']=_0x5f249a;return request({'event':_0x0021('0x2d'),'message':_0x5ae063});})[_0x0021('0x22')](function(_0x343ad8){console[_0x0021('0x20')](_0x343ad8);});}else{return request({'event':_0x0021('0x2e'),'message':_0x5ae063});}};}function afterCreate(_0x285b7c,_0x362049){return function(_0x237ce4,_0x470398){_0x237ce4=_0x237ce4[_0x0021('0x23')]({'plain':!![]});_0x237ce4['channel']=_0x285b7c;_0x237ce4['event']=_0x0021('0x2f');return request({'event':_0x362049,'message':_0x237ce4});};}function afterUpdate(_0x393700,_0x49e5aa){return function(_0x2185f7,_0x2ec938){if(_0x2185f7[_0x0021('0x30')]('closed')&&_0x2185f7[_0x0021('0x31')]){_0x2185f7=_0x2185f7['get']({'plain':!![]});_0x2185f7['channel']=_0x393700;_0x2185f7['event']='closed';if(_0x2185f7['UserId']){return db[_0x0021('0x28')][_0x0021('0x32')]({'where':{'id':_0x2185f7[_0x0021('0x27')]},'attributes':['id',_0x0021('0x2c')],'raw':!![]})[_0x0021('0x1d')](function(_0x186f9c){_0x2185f7[_0x0021('0x29')]=util['format'](_0x0021('0x2b'),_0x186f9c[_0x0021('0x2c')]);return request({'event':_0x49e5aa,'message':_0x2185f7});})[_0x0021('0x22')](function(_0x17ed30){console['error'](_0x17ed30);});}else{return request({'event':_0x49e5aa,'message':_0x2185f7});}}};}exports['default']=function(){for(var _0x5ef71b=0x0;_0x5ef71b=_0x4855dc['agents']){throw Error(_0xf923('0x14'));}_0x4ef99c(_0x2518fc);})['catch'](function(_0x4c8109){_0x55f50c(_0x4c8109);});});}; \ No newline at end of file +var _0x6513=['blockedAt','updateAttributes','getLicense','role','agent','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','chat','fax','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser'];(function(_0x1cbecb,_0x505e33){var _0x4112c4=function(_0x1d1d36){while(--_0x1d1d36){_0x1cbecb['push'](_0x1cbecb['shift']());}};_0x4112c4(++_0x505e33);}(_0x6513,0x82));var _0x3651=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x6513[_0x45b034];return _0x509cb0;};'use strict';var _=require(_0x3651('0x0'));var BPromise=require(_0x3651('0x1'));var db=require(_0x3651('0x2'))['db'];var util=require(_0x3651('0x3'));var channels=[_0x3651('0x4'),'mail',_0x3651('0x5'),_0x3651('0x6'),'sms',_0x3651('0x7'),_0x3651('0x8')];exports[_0x3651('0x9')]=function(){return channels;};exports[_0x3651('0xa')]=function(_0x37d4cf){_0x37d4cf=_0x37d4cf[_0x3651('0xb')]();return _[_0x3651('0xc')](channels,_0x37d4cf);};exports[_0x3651('0xd')]=function(_0x4e7723,_0x5bd8f3,_0x12de93,_0x16f36d){var _0x2df775={'loginAttempts':_0x5bd8f3,'blocked':_0x12de93};if(!_['isUndefined'](_0x16f36d)){_0x2df775[_0x3651('0xe')]=_0x16f36d;}return _0x4e7723[_0x3651('0xf')](_0x2df775);};exports[_0x3651('0x10')]=function(_0x112ce5){return new BPromise(function(_0x5ce99e,_0x3ac9de){var _0x2e2030=0x0;if(_0x112ce5[_0x3651('0x11')]!==_0x3651('0x12')){_0x5ce99e(_0x112ce5);}db['User'][_0x3651('0x13')]({'where':{'role':_0x3651('0x12'),'online':!![],'id':{'$ne':_0x112ce5['id']}}})[_0x3651('0x14')](function(_0x409db2){_0x2e2030=_0x409db2;return util[_0x3651('0x10')]();})[_0x3651('0x14')](function(_0x36b868){if(_0x36b868&&_0x36b868[_0x3651('0x15')]&&_0x2e2030>=_0x36b868[_0x3651('0x15')]){throw Error(_0x3651('0x16'));}_0x5ce99e(_0x112ce5);})[_0x3651('0x17')](function(_0x15f13a){_0x3ac9de(_0x15f13a);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 4b7d019..bdaaa87 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a72=['render','json','exports','404','status'];(function(_0x320b8e,_0x1da3fe){var _0x55a10a=function(_0x148a56){while(--_0x148a56){_0x320b8e['push'](_0x320b8e['shift']());}};_0x55a10a(++_0x1da3fe);}(_0x1a72,0xf2));var _0x21a7=function(_0x2dc577,_0x152729){_0x2dc577=_0x2dc577-0x0;var _0x238e50=_0x1a72[_0x2dc577];return _0x238e50;};'use strict';module[_0x21a7('0x0')][0x194]=function pageNotFound(_0x24ce86,_0x1f09a4){var _0x45e93c=_0x21a7('0x1');var _0x58faeb=0x194;var _0x37ad1b={'status':_0x58faeb};_0x1f09a4[_0x21a7('0x2')](_0x37ad1b[_0x21a7('0x2')]);_0x1f09a4[_0x21a7('0x3')](_0x45e93c,{},function(_0x236509,_0x520b3e){if(_0x236509){return _0x1f09a4[_0x21a7('0x2')](_0x37ad1b['status'])[_0x21a7('0x4')](_0x37ad1b);}_0x1f09a4['send'](_0x520b3e);});}; \ No newline at end of file +var _0x9969=['json','send','exports','404','status','render'];(function(_0xad08b3,_0x2a3003){var _0xb6c9b6=function(_0x57e379){while(--_0x57e379){_0xad08b3['push'](_0xad08b3['shift']());}};_0xb6c9b6(++_0x2a3003);}(_0x9969,0x92));var _0x9996=function(_0x205d75,_0x1a99af){_0x205d75=_0x205d75-0x0;var _0x49f88d=_0x9969[_0x205d75];return _0x49f88d;};'use strict';module[_0x9996('0x0')][0x194]=function pageNotFound(_0xa689f4,_0x36765){var _0x2c4731=_0x9996('0x1');var _0x4b485b=0x194;var _0x1182c2={'status':_0x4b485b};_0x36765[_0x9996('0x2')](_0x1182c2[_0x9996('0x2')]);_0x36765[_0x9996('0x3')](_0x2c4731,{},function(_0x5e3241,_0x33c0ba){if(_0x5e3241){return _0x36765['status'](_0x1182c2[_0x9996('0x2')])[_0x9996('0x4')](_0x1182c2);}_0x36765[_0x9996('0x5')](_0x33c0ba);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 7822b2d..dbb914d 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1258=['MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/reportAgentPreview/reportAgentPreview.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','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','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','FaxTransferReport','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/userNotification/userNotification.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','cascade','UserId','Recordings','Extensions','hasMany','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteraction','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','SenderId','UserNotification','UserNotifications','belongsTo','userProfileId','Groups','chat_group_has_users','belongsToMany','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_sms_interactions','OpenchannelInteractions','VoiceQueue','MailQueues','UserMailQueue','ChatQueues','FaxQueue','UserFaxQueue','OpenchannelQueue','OpenchannelQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','uniqueid','AgentReports','Contact','ContactId','MailAccountId','Smtp','Disposition','Dispositions','Answers','Interactions','List','ListId','user_has_mail_accounts','team_has_mail_queues','Messages','MailInteractionId','Owner','mail_interaction_has_tags','Users','Attachments','Interaction','restrict','TagId','FaxAccountId','Exntensions','FaxApplication','FaxInteractionId','Account','fax_interaction_has_tags','Tags','ThroughTags','FaxMessage','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','OpenchannelQueueReport','Agent','ChatQueueId','Website','ChatInteractionId','UserChatQueue','team_has_chat_queues','ChatGroupId','CompanyId','cm_contact_has_tags','Queue','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationId','ChatApplications','FaxApplications','Schedule','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','AnyConditions','AnyCondition','Actions','TriggerId','Fields','MetricId','SalesforceAccount','Configurations','AccountId','SalesforceField','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','SugarcrmField','int_desk_configuration_has_tags','Subjects','ZohoField','int_zendesk_configuration_has_tags','ServicenowField','Dynamics365Account','FreshsalesConfiguration','FromId','ToId','SessionId','ProjectId','VoiceQueues','SmsQueues','team_has_whatsapp_queues','WhatsappQueues','TrunkBackupId','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','ToChatQueueId','FromFaxAccountId','ToQueue','FromOpenchannelAccountId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','Queues','Resources','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','path','sequelize','lodash','jstz','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','password','options','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','VoiceQueueReport'];(function(_0x267384,_0x5d02a2){var _0x1387e6=function(_0x15487e){while(--_0x15487e){_0x267384['push'](_0x267384['shift']());}};_0x1387e6(++_0x5d02a2);}(_0x1258,0x1ca));var _0x8125=function(_0x4400bb,_0x3e7cf0){_0x4400bb=_0x4400bb-0x0;var _0x1a2876=_0x1258[_0x4400bb];return _0x1a2876;};'use strict';var path=require(_0x8125('0x0'));var config=require('../config/environment');var Sequelize=require(_0x8125('0x1'));var _=require(_0x8125('0x2'));var jstz=require(_0x8125('0x3'));var timezone=jstz['determine']();config[_0x8125('0x1')]=_[_0x8125('0x4')](config['sequelize'],{'database':_0x8125('0x5'),'username':_0x8125('0x6'),'password':_0x8125('0x7'),'options':{'host':_0x8125('0x8'),'port':0xcea,'dialect':_0x8125('0x9'),'dialectOptions':{'charset':_0x8125('0xa')},'logging':![],'timezone':timezone[_0x8125('0xb')](),'define':{'charset':_0x8125('0xc'),'collate':_0x8125('0xd')}}});config[_0x8125('0xe')]=_[_0x8125('0x4')](config['sequelizeHistory'],{'database':'motion2','username':_0x8125('0x6'),'password':_0x8125('0x7'),'options':{'host':_0x8125('0x8'),'port':0xcea,'dialect':_0x8125('0x9'),'dialectOptions':{'charset':_0x8125('0xa')},'logging':![],'timezone':timezone[_0x8125('0xb')](),'define':{'charset':_0x8125('0xc'),'collate':_0x8125('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x8125('0xf')],config[_0x8125('0x1')]['username'],config['sequelize'][_0x8125('0x10')],config[_0x8125('0x1')][_0x8125('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8125('0xe')]['database'],config['sequelizeHistory']['username'],config['sequelizeHistory'][_0x8125('0x10')],config[_0x8125('0xe')]['options'])};db[_0x8125('0x12')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x14'));db[_0x8125('0x15')]=db[_0x8125('0x1')][_0x8125('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x8125('0x16')]=db['sequelize'][_0x8125('0x13')](_0x8125('0x17'));db[_0x8125('0x18')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x19'));db['VoiceMusicOnHold']=db['sequelize'][_0x8125('0x13')](_0x8125('0x1a'));db['VoiceQueue']=db['sequelize'][_0x8125('0x13')]('../api/voiceQueue/voiceQueue.model');db[_0x8125('0x1b')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x1c'));db[_0x8125('0x1d')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x1e'));db[_0x8125('0x1f')]=db[_0x8125('0x1')]['import']('../api/voiceMail/voiceMail.model');db[_0x8125('0x20')]=db[_0x8125('0x1')][_0x8125('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x8125('0x21')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x22'));db[_0x8125('0x23')]=db[_0x8125('0x1')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0x8125('0x24')]=db[_0x8125('0x1')][_0x8125('0x13')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x8125('0x25')]=db['sequelize'][_0x8125('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x8125('0x26')]=db[_0x8125('0x1')]['import'](_0x8125('0x27'));db[_0x8125('0x28')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x29'));db['VoiceTransferReport']=db[_0x8125('0x1')]['import'](_0x8125('0x2a'));db[_0x8125('0x2b')]=db['sequelize'][_0x8125('0x13')](_0x8125('0x2c'));db[_0x8125('0x2d')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x2e'));db['UserChatQueue']=db['sequelize'][_0x8125('0x13')]('../api/userChatQueue/userChatQueue.model');db['UserMailQueue']=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x2f'));db['UserFaxQueue']=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x30'));db[_0x8125('0x31')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x32'));db[_0x8125('0x33')]=db[_0x8125('0x1')][_0x8125('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x8125('0x34')]=db[_0x8125('0x1')]['import'](_0x8125('0x35'));db[_0x8125('0x36')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x37'));db[_0x8125('0x38')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x39'));db[_0x8125('0x3a')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x3b'));db[_0x8125('0x3c')]=db[_0x8125('0x1')][_0x8125('0x13')]('../api/mailQueue/mailQueue.model');db[_0x8125('0x3d')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x3e'));db['MailInteraction']=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x3f'));db[_0x8125('0x40')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x41'));db[_0x8125('0x42')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x43'));db[_0x8125('0x44')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x45'));db[_0x8125('0x46')]=db[_0x8125('0x1')]['import'](_0x8125('0x47'));db[_0x8125('0x48')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x49'));db[_0x8125('0x4a')]=db['sequelize'][_0x8125('0x13')](_0x8125('0x4b'));db['FaxApplication']=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x4c'));db['FaxInteraction']=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x4d'));db['FaxMessage']=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x4e'));db['FaxQueue']=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x4f'));db[_0x8125('0x50')]=db['sequelize'][_0x8125('0x13')](_0x8125('0x51'));db[_0x8125('0x52')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x53'));db[_0x8125('0x54')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x55'));db[_0x8125('0x56')]=db['sequelize'][_0x8125('0x13')](_0x8125('0x57'));db[_0x8125('0x58')]=db['sequelize'][_0x8125('0x13')](_0x8125('0x59'));db[_0x8125('0x5a')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x5b'));db[_0x8125('0x5c')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x5d'));db['OpenchannelApplication']=db[_0x8125('0x1')]['import'](_0x8125('0x5e'));db['OpenchannelInteraction']=db[_0x8125('0x1')]['import'](_0x8125('0x5f'));db[_0x8125('0x60')]=db[_0x8125('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db['sequelize'][_0x8125('0x13')](_0x8125('0x61'));db[_0x8125('0x62')]=db['sequelize'][_0x8125('0x13')]('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x63'));db[_0x8125('0x64')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x65'));db[_0x8125('0x66')]=db[_0x8125('0x1')][_0x8125('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0x8125('0x67')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x68'));db[_0x8125('0x69')]=db['sequelize'][_0x8125('0x13')](_0x8125('0x6a'));db[_0x8125('0x6b')]=db['sequelize'][_0x8125('0x13')](_0x8125('0x6c'));db[_0x8125('0x6d')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x6e'));db[_0x8125('0x6f')]=db[_0x8125('0x1')]['import'](_0x8125('0x70'));db[_0x8125('0x71')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x72'));db['CmContact']=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x73'));db[_0x8125('0x74')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x75'));db[_0x8125('0x76')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x77'));db[_0x8125('0x78')]=db['sequelize'][_0x8125('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x8125('0x79')]=db['sequelize'][_0x8125('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x7a'));db['CmCustomField']=db[_0x8125('0x1')][_0x8125('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0x8125('0x7b')]=db['sequelize'][_0x8125('0x13')]('../api/action/action.model');db[_0x8125('0x7c')]=db[_0x8125('0x1')]['import'](_0x8125('0x7d'));db[_0x8125('0x7e')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x7f'));db['Disposition']=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x80'));db[_0x8125('0x81')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x82'));db[_0x8125('0x83')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x84'));db[_0x8125('0x85')]=db['sequelize'][_0x8125('0x13')](_0x8125('0x86'));db['Cdr']=db['sequelize'][_0x8125('0x13')](_0x8125('0x87'));db[_0x8125('0x88')]=db['sequelize'][_0x8125('0x13')]('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db['sequelize'][_0x8125('0x13')](_0x8125('0x89'));db[_0x8125('0x8a')]=db[_0x8125('0x1')]['import'](_0x8125('0x8b'));db[_0x8125('0x8c')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x8d'));db[_0x8125('0x8e')]=db[_0x8125('0x1')]['import'](_0x8125('0x8f'));db[_0x8125('0x90')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x91'));db[_0x8125('0x92')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x93'));db['Integration']=db[_0x8125('0x1')][_0x8125('0x13')]('../api/integration/integration.model');db[_0x8125('0x94')]=db[_0x8125('0x1')]['import'](_0x8125('0x95'));db[_0x8125('0x96')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x97'));db[_0x8125('0x98')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x99'));db[_0x8125('0x9a')]=db['sequelize'][_0x8125('0x13')](_0x8125('0x9b'));db[_0x8125('0x9c')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x9d'));db[_0x8125('0x9e')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x9f'));db[_0x8125('0xa0')]=db['sequelize']['import'](_0x8125('0xa1'));db['SalesforceAccount']=db[_0x8125('0x1')][_0x8125('0x13')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x8125('0xa2')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xa3'));db['SalesforceField']=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xa4'));db[_0x8125('0xa5')]=db['sequelize'][_0x8125('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x8125('0xa6')]=db[_0x8125('0x1')]['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db['SugarcrmField']=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xa7'));db[_0x8125('0xa8')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xa9'));db[_0x8125('0xaa')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xab'));db[_0x8125('0xac')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xad'));db[_0x8125('0xae')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xaf'));db[_0x8125('0xb0')]=db[_0x8125('0x1')]['import'](_0x8125('0xb1'));db['ZohoField']=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xb2'));db[_0x8125('0xb3')]=db['sequelize'][_0x8125('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x8125('0xb4')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xb5'));db[_0x8125('0xb6')]=db['sequelize'][_0x8125('0x13')](_0x8125('0xb7'));db[_0x8125('0xb8')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xb9'));db[_0x8125('0xba')]=db['sequelize'][_0x8125('0x13')](_0x8125('0xbb'));db[_0x8125('0xbc')]=db[_0x8125('0x1')]['import']('../api/intFreshdeskField/intFreshdeskField.model');db[_0x8125('0xbd')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xbe'));db[_0x8125('0xbf')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xc0'));db[_0x8125('0xc1')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xc2'));db[_0x8125('0xc3')]=db[_0x8125('0x1')]['import'](_0x8125('0xc4'));db[_0x8125('0xc5')]=db['sequelize']['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db['sequelize'][_0x8125('0x13')](_0x8125('0xc6'));db['Dynamics365Account']=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xc7'));db[_0x8125('0xc8')]=db[_0x8125('0x1')][_0x8125('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x8125('0xc9')]=db[_0x8125('0x1')][_0x8125('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x8125('0xca')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xcb'));db['FreshsalesConfiguration']=db['sequelize'][_0x8125('0x13')](_0x8125('0xcc'));db[_0x8125('0xcd')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xce'));db[_0x8125('0xcf')]=db[_0x8125('0x1')]['import'](_0x8125('0xd0'));db[_0x8125('0xd1')]=db['sequelize'][_0x8125('0x13')](_0x8125('0xd2'));db[_0x8125('0xd3')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xd4'));db[_0x8125('0xd5')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xd6'));db[_0x8125('0xd7')]=db[_0x8125('0x1')]['import'](_0x8125('0xd8'));db[_0x8125('0xd9')]=db[_0x8125('0x1')][_0x8125('0x13')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x8125('0xda')]=db[_0x8125('0x1')]['import'](_0x8125('0xdb'));db[_0x8125('0xdc')]=db[_0x8125('0x1')]['import'](_0x8125('0xdd'));db[_0x8125('0xde')]=db[_0x8125('0x1')]['import'](_0x8125('0xdf'));db[_0x8125('0xe0')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xe1'));db[_0x8125('0xe2')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xe3'));db[_0x8125('0xe4')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xe5'));db['SquareOdbc']=db['sequelize'][_0x8125('0x13')](_0x8125('0xe6'));db[_0x8125('0xe7')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xe8'));db[_0x8125('0xe9')]=db['sequelize'][_0x8125('0x13')](_0x8125('0xea'));db['SquareMessage']=db['sequelize']['import']('../api/squareMessage/squareMessage.model');db[_0x8125('0xeb')]=db['sequelize'][_0x8125('0x13')](_0x8125('0xec'));db[_0x8125('0xed')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xee'));db[_0x8125('0xef')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xf0'));db[_0x8125('0xf1')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xf2'));db[_0x8125('0xf3')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xf4'));db[_0x8125('0xf5')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xf6'));db[_0x8125('0xf7')]=db['sequelize'][_0x8125('0x13')]('../api/mailTransferReport/mailTransferReport.model');db[_0x8125('0xf8')]=db['sequelize']['import']('../api/chatTransferReport/chatTransferReport.model');db[_0x8125('0xf9')]=db[_0x8125('0x1')][_0x8125('0x13')]('../api/faxTransferReport/faxTransferReport.model');db[_0x8125('0xfa')]=db[_0x8125('0x1')][_0x8125('0x13')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x8125('0xfb')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0xfc'));db[_0x8125('0xfd')]=db[_0x8125('0x1')][_0x8125('0x13')]('../api/cmList/cmList.model');db[_0x8125('0xfe')]=db[_0x8125('0x1')]['import'](_0x8125('0xff'));db[_0x8125('0x100')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x101'));db[_0x8125('0x102')]=db[_0x8125('0x1')]['import']('../api/userProfileSection/userProfileSection.model');db[_0x8125('0x103')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x104'));db[_0x8125('0x105')]=db[_0x8125('0x1')][_0x8125('0x13')]('../api/notification/notification.model');db['UserNotification']=db[_0x8125('0x1')]['import'](_0x8125('0x106'));db['WhatsappAccount']=db[_0x8125('0x1')][_0x8125('0x13')]('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db['sequelize'][_0x8125('0x13')](_0x8125('0x107'));db[_0x8125('0x108')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x109'));db[_0x8125('0x10a')]=db[_0x8125('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x8125('0x10b')]=db['sequelize']['import'](_0x8125('0x10c'));db[_0x8125('0x10d')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x10e'));db[_0x8125('0x10f')]=db[_0x8125('0x1')]['import'](_0x8125('0x110'));db[_0x8125('0x111')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x112'));db[_0x8125('0x113')]=db[_0x8125('0x1')][_0x8125('0x13')](_0x8125('0x114'));db[_0x8125('0x12')][_0x8125('0x115')](db[_0x8125('0x1f')],{'as':_0x8125('0x1f'),'onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x117')});db[_0x8125('0x12')]['hasMany'](db[_0x8125('0x1b')],{'as':_0x8125('0x118'),'foreignKey':'UserId'});db[_0x8125('0x12')]['hasMany'](db[_0x8125('0x2b')],{'as':'VoiceQueuesRt','foreignKey':_0x8125('0x117')});db[_0x8125('0x12')]['hasMany'](db[_0x8125('0x18')],{'as':_0x8125('0x119'),'onDelete':_0x8125('0x116'),'hooks':!![]});db[_0x8125('0x12')][_0x8125('0x11a')](db[_0x8125('0x78')],{'as':_0x8125('0x11b'),'foreignKey':_0x8125('0x117')});db[_0x8125('0x12')][_0x8125('0x11a')](db[_0x8125('0x79')],{'as':_0x8125('0x11c'),'foreignKey':_0x8125('0x117')});db[_0x8125('0x12')][_0x8125('0x11a')](db[_0x8125('0x11d')],{'as':_0x8125('0x11d'),'foreignKey':_0x8125('0x117')});db['User'][_0x8125('0x11a')](db[_0x8125('0x11e')],{'as':'OpenchannelInteractions','foreignKey':_0x8125('0x117')});db[_0x8125('0x12')][_0x8125('0x11a')](db[_0x8125('0x66')],{'as':_0x8125('0x11f'),'foreignKey':_0x8125('0x117')});db[_0x8125('0x12')][_0x8125('0x11a')](db['SmsInteraction'],{'as':_0x8125('0x120'),'foreignKey':_0x8125('0x117')});db[_0x8125('0x12')][_0x8125('0x11a')](db[_0x8125('0x121')],{'as':_0x8125('0x122'),'foreignKey':_0x8125('0x117')});db[_0x8125('0x12')][_0x8125('0x11a')](db[_0x8125('0x123')],{'as':_0x8125('0x124'),'foreignKey':'UserId'});db[_0x8125('0x12')]['hasMany'](db[_0x8125('0x108')],{'as':_0x8125('0x125'),'foreignKey':_0x8125('0x117')});db[_0x8125('0x12')][_0x8125('0x11a')](db[_0x8125('0x105')],{'as':'Notifications','foreignKey':_0x8125('0x126')});db[_0x8125('0x12')][_0x8125('0x11a')](db[_0x8125('0x127')],{'as':_0x8125('0x128'),'foreignKey':'SenderId'});db[_0x8125('0x12')][_0x8125('0x129')](db[_0x8125('0x100')],{'as':'UserProfile','foreignKey':_0x8125('0x12a')});db[_0x8125('0x12')]['belongsToMany'](db[_0x8125('0x6d')],{'as':_0x8125('0x12b'),'through':_0x8125('0x12c')});db[_0x8125('0x12')][_0x8125('0x12d')](db[_0x8125('0x12e')],{'as':_0x8125('0x12f'),'through':_0x8125('0x130')});db[_0x8125('0x12')][_0x8125('0x12d')](db[_0x8125('0xfd')],{'as':_0x8125('0x131'),'through':_0x8125('0x132')});db[_0x8125('0x12')][_0x8125('0x12d')](db[_0x8125('0xeb')],{'through':_0x8125('0x133')});db[_0x8125('0x12')][_0x8125('0x12d')](db['MailInteraction'],{'as':_0x8125('0x124'),'through':_0x8125('0x134')});db[_0x8125('0x12')]['belongsToMany'](db[_0x8125('0x66')],{'as':_0x8125('0x11f'),'through':'user_has_chat_interactions'});db['User'][_0x8125('0x12d')](db[_0x8125('0x121')],{'as':_0x8125('0x122'),'through':'user_has_fax_interactions'});db[_0x8125('0x12')][_0x8125('0x12d')](db[_0x8125('0x56')],{'as':_0x8125('0x120'),'through':_0x8125('0x135')});db['User'][_0x8125('0x12d')](db[_0x8125('0x11e')],{'as':_0x8125('0x136'),'through':'user_has_openchannel_interactions'});db[_0x8125('0x12')]['belongsToMany'](db['WhatsappInteraction'],{'as':_0x8125('0x125'),'through':'user_has_whatsapp_interactions'});db[_0x8125('0x12')][_0x8125('0x12d')](db[_0x8125('0x137')],{'as':'VoiceQueues','through':_0x8125('0x2d'),'required':![]});db[_0x8125('0x12')][_0x8125('0x12d')](db[_0x8125('0x3c')],{'as':_0x8125('0x138'),'through':_0x8125('0x139'),'required':![]});db[_0x8125('0x12')][_0x8125('0x12d')](db['ChatQueue'],{'as':_0x8125('0x13a'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x8125('0x12')][_0x8125('0x12d')](db[_0x8125('0x13b')],{'as':'FaxQueues','through':_0x8125('0x13c'),'required':![]});db['User']['belongsToMany'](db[_0x8125('0x5a')],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0x8125('0x12')][_0x8125('0x12d')](db[_0x8125('0x13d')],{'as':_0x8125('0x13e'),'through':_0x8125('0x33'),'required':![]});db[_0x8125('0x12')][_0x8125('0x12d')](db['WhatsappQueue'],{'as':'WhatsappQueues','through':_0x8125('0x34'),'required':![]});db['User'][_0x8125('0x12d')](db[_0x8125('0xfd')],{'through':'cm_user_has_lists'});db[_0x8125('0x12')][_0x8125('0x12d')](db[_0x8125('0xfe')],{'as':_0x8125('0x13f'),'through':_0x8125('0x140'),'required':![]});db['User'][_0x8125('0x12d')](db[_0x8125('0x62')],{'as':_0x8125('0x141'),'through':_0x8125('0x142')});db[_0x8125('0x12')][_0x8125('0x12d')](db[_0x8125('0x4a')],{'as':'FaxAccounts','through':_0x8125('0x143')});db[_0x8125('0x12')]['belongsToMany'](db[_0x8125('0x3a')],{'as':_0x8125('0x144'),'through':'user_has_mail_accounts'});db[_0x8125('0x12')][_0x8125('0x12d')](db[_0x8125('0x5c')],{'as':_0x8125('0x145'),'through':_0x8125('0x146')});db[_0x8125('0x12')][_0x8125('0x12d')](db[_0x8125('0x52')],{'as':_0x8125('0x147'),'through':_0x8125('0x148')});db[_0x8125('0x12')]['belongsToMany'](db[_0x8125('0x149')],{'as':'WhatsappAccounts','through':_0x8125('0x14a')});db[_0x8125('0x12')]['belongsToMany'](db[_0x8125('0xe7')],{'as':_0x8125('0x14b'),'through':_0x8125('0x14c')});db[_0x8125('0x15')][_0x8125('0x11a')](db[_0x8125('0x18')],{'as':_0x8125('0x14d'),'onDelete':_0x8125('0x116'),'foreignKey':'ChanSpyId'});db[_0x8125('0x16')][_0x8125('0x11a')](db[_0x8125('0x18')],{'onDelete':_0x8125('0x116')});db[_0x8125('0x18')][_0x8125('0x11a')](db[_0x8125('0x18')],{'as':_0x8125('0x14e'),'onDelete':_0x8125('0x116')});db[_0x8125('0x14f')][_0x8125('0x12d')](db[_0x8125('0x8a')],{'as':_0x8125('0x150'),'through':_0x8125('0x151')});db[_0x8125('0x137')][_0x8125('0x11a')](db['UserVoiceQueueRt'],{'as':_0x8125('0x152'),'foreignKey':'VoiceQueueId'});db[_0x8125('0x137')][_0x8125('0x11a')](db[_0x8125('0x74')],{'as':_0x8125('0x153'),'foreignKey':'VoiceQueueId'});db[_0x8125('0x137')][_0x8125('0x11a')](db[_0x8125('0x78')],{'as':'HopperFinals','foreignKey':_0x8125('0x154')});db[_0x8125('0x137')][_0x8125('0x11a')](db[_0x8125('0x79')],{'as':_0x8125('0x155'),'foreignKey':_0x8125('0x154')});db['VoiceQueue']['hasMany'](db[_0x8125('0x11d')],{'as':_0x8125('0x11d'),'foreignKey':_0x8125('0x154')});db['VoiceQueue'][_0x8125('0x11a')](db[_0x8125('0x76')],{'as':_0x8125('0x156'),'foreignKey':_0x8125('0x154')});db[_0x8125('0x137')][_0x8125('0x11a')](db['JscriptySessionReport'],{'as':_0x8125('0x157'),'foreignKey':'VoiceQueueId'});db[_0x8125('0x137')][_0x8125('0x129')](db['Trunk'],{'as':_0x8125('0x28'),'foreignKey':_0x8125('0x158')});db[_0x8125('0x137')]['belongsTo'](db[_0x8125('0x28')],{'as':_0x8125('0x159'),'foreignKey':'TrunkBackupId'});db[_0x8125('0x137')][_0x8125('0x129')](db[_0x8125('0x83')],{'as':_0x8125('0x83'),'foreignKey':_0x8125('0x15a')});db[_0x8125('0x137')][_0x8125('0x129')](db[_0x8125('0x85')],{'as':_0x8125('0x15b'),'foreignKey':_0x8125('0x15c')});db[_0x8125('0x137')][_0x8125('0x12d')](db['CmList'],{'as':_0x8125('0x131'),'through':_0x8125('0x15d')});db[_0x8125('0x137')][_0x8125('0x12d')](db[_0x8125('0x12')],{'as':_0x8125('0x15e'),'through':_0x8125('0x2d')});db[_0x8125('0x137')][_0x8125('0x12d')](db[_0x8125('0xeb')],{'as':_0x8125('0x15f'),'through':_0x8125('0x113')});db['VoiceQueue'][_0x8125('0x12d')](db[_0x8125('0xfd')],{'as':_0x8125('0x160'),'through':_0x8125('0x161')});db['VoiceRecording'][_0x8125('0x129')](db[_0x8125('0x12')],{'as':'User','foreignKey':_0x8125('0x117')});db[_0x8125('0x1d')][_0x8125('0x129')](db[_0x8125('0x12')],{'as':_0x8125('0x12'),'foreignKey':_0x8125('0x117')});db[_0x8125('0x1f')][_0x8125('0x11a')](db[_0x8125('0x20')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x8125('0x162'),'sourceKey':_0x8125('0x163')});db['VoiceMailMessage'][_0x8125('0x129')](db[_0x8125('0x1f')],{'foreignKey':_0x8125('0x162'),'targetKey':'mailbox'});db[_0x8125('0x21')]['hasMany'](db[_0x8125('0x25')],{'as':'QueueCalls','foreignKey':_0x8125('0x164'),'constraints':![]});db[_0x8125('0x21')][_0x8125('0x11a')](db['VoiceAgentReport'],{'as':_0x8125('0x165'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x8125('0x129')](db['User'],{'as':_0x8125('0x12'),'foreignKey':_0x8125('0x117')});db[_0x8125('0x21')]['belongsTo'](db[_0x8125('0x12e')],{'as':_0x8125('0x166'),'foreignKey':_0x8125('0x167')});db[_0x8125('0x36')][_0x8125('0x129')](db[_0x8125('0x3a')],{'as':'MailAccount','foreignKey':_0x8125('0x168')});db[_0x8125('0x38')][_0x8125('0x129')](db[_0x8125('0x3a')],{'as':_0x8125('0x3a'),'foreignKey':_0x8125('0x168')});db[_0x8125('0x3a')]['hasOne'](db[_0x8125('0x36')],{'as':'Imap','onDelete':_0x8125('0x116')});db[_0x8125('0x3a')][_0x8125('0x115')](db[_0x8125('0x38')],{'as':_0x8125('0x169'),'onDelete':'cascade'});db[_0x8125('0x3a')][_0x8125('0x11a')](db[_0x8125('0x16a')],{'as':_0x8125('0x16b'),'foreignKey':_0x8125('0x168')});db['MailAccount']['hasMany'](db['CannedAnswer'],{'as':_0x8125('0x16c'),'foreignKey':_0x8125('0x168')});db['MailAccount'][_0x8125('0x11a')](db[_0x8125('0x40')],{'as':'Messages','foreignKey':'MailAccountId'});db[_0x8125('0x3a')][_0x8125('0x11a')](db[_0x8125('0x123')],{'as':_0x8125('0x16d')});db[_0x8125('0x3a')][_0x8125('0x11a')](db['MailApplication'],{'as':'Applications'});db['MailAccount'][_0x8125('0x129')](db['CmList'],{'as':_0x8125('0x16e'),'foreignKey':_0x8125('0x16f')});db[_0x8125('0x3a')]['belongsTo'](db[_0x8125('0x8e')],{'as':_0x8125('0x8e'),'foreignKey':'TemplateId'});db[_0x8125('0x3a')][_0x8125('0x129')](db[_0x8125('0x85')],{'as':_0x8125('0x15b'),'foreignKey':_0x8125('0x15c')});db[_0x8125('0x3a')][_0x8125('0x12d')](db[_0x8125('0x12')],{'as':_0x8125('0x15e'),'through':_0x8125('0x170')});db[_0x8125('0x3c')]['belongsToMany'](db[_0x8125('0x12')],{'as':_0x8125('0x15e'),'through':_0x8125('0x139')});db[_0x8125('0x3c')]['belongsToMany'](db['Team'],{'through':_0x8125('0x171'),'as':_0x8125('0x15f')});db[_0x8125('0x123')]['hasMany'](db[_0x8125('0x40')],{'as':_0x8125('0x172'),'onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x173')});db['MailInteraction'][_0x8125('0x129')](db['MailAccount'],{'as':'Account','foreignKey':_0x8125('0x168')});db[_0x8125('0x123')][_0x8125('0x129')](db['CmContact'],{'as':_0x8125('0x166'),'foreignKey':_0x8125('0x167')});db[_0x8125('0x123')][_0x8125('0x129')](db[_0x8125('0x12')],{'as':_0x8125('0x174'),'foreignKey':_0x8125('0x117')});db[_0x8125('0x123')][_0x8125('0x12d')](db[_0x8125('0x8c')],{'through':'mail_interaction_has_tags','as':'Tags'});db[_0x8125('0x123')][_0x8125('0x12d')](db[_0x8125('0x8c')],{'through':_0x8125('0x175'),'as':'ThroughTags'});db['MailInteraction'][_0x8125('0x12d')](db['User'],{'as':_0x8125('0x176'),'through':_0x8125('0x134'),'foreignKey':_0x8125('0x173')});db[_0x8125('0x40')]['hasMany'](db[_0x8125('0xf3')],{'as':_0x8125('0x177'),'onDelete':'cascade'});db[_0x8125('0x40')][_0x8125('0x129')](db['User'],{'as':'User'});db[_0x8125('0x40')][_0x8125('0x129')](db[_0x8125('0x12e')],{'onDelete':_0x8125('0x116'),'as':'Contact'});db[_0x8125('0x40')][_0x8125('0x129')](db[_0x8125('0x123')],{'as':_0x8125('0x178'),'foreignKey':_0x8125('0x173')});db[_0x8125('0x40')][_0x8125('0x129')](db['MailAccount'],{'as':'Account','foreignKey':_0x8125('0x168')});db[_0x8125('0x42')][_0x8125('0x129')](db[_0x8125('0x12')],{'onDelete':_0x8125('0x179')});db[_0x8125('0x42')][_0x8125('0x129')](db[_0x8125('0x3c')],{'onDelete':_0x8125('0x179')});db['MailApplication'][_0x8125('0x129')](db[_0x8125('0x3a')],{'onDelete':_0x8125('0x179')});db[_0x8125('0x42')]['belongsTo'](db['Interval'],{'onDelete':_0x8125('0x179'),'foreignKey':_0x8125('0x15a')});db[_0x8125('0x42')][_0x8125('0x129')](db[_0x8125('0x8c')],{'onDelete':'restrict','foreignKey':_0x8125('0x17a')});db[_0x8125('0x44')][_0x8125('0x129')](db[_0x8125('0x3a')],{});db[_0x8125('0x44')][_0x8125('0x129')](db[_0x8125('0xfd')],{'as':_0x8125('0x16e'),'foreignKey':_0x8125('0x16f')});db['MailQueueReport']['belongsTo'](db[_0x8125('0x12e')],{'as':_0x8125('0x166'),'foreignKey':_0x8125('0x167')});db[_0x8125('0x44')]['belongsTo'](db['MailInteraction'],{});db[_0x8125('0x44')][_0x8125('0x129')](db[_0x8125('0x40')],{});db[_0x8125('0x44')]['belongsTo'](db[_0x8125('0x12')],{});db[_0x8125('0x44')][_0x8125('0x129')](db['MailQueue'],{});db[_0x8125('0x46')][_0x8125('0x11a')](db[_0x8125('0x48')],{'as':'Items','onDelete':_0x8125('0x116')});db['FaxAccount'][_0x8125('0x11a')](db['Disposition'],{'as':_0x8125('0x16b'),'foreignKey':_0x8125('0x17b')});db[_0x8125('0x4a')][_0x8125('0x11a')](db[_0x8125('0x7e')],{'as':'Answers','foreignKey':_0x8125('0x17b')});db[_0x8125('0x4a')]['hasMany'](db[_0x8125('0x121')],{'as':'Interactions'});db['FaxAccount']['hasMany'](db['FaxApplication'],{'as':'Applications'});db[_0x8125('0x4a')][_0x8125('0x11a')](db[_0x8125('0x18')],{'as':_0x8125('0x17c'),'onDelete':'cascade'});db[_0x8125('0x4a')][_0x8125('0x11a')](db['FaxMessage'],{'as':_0x8125('0x172')});db[_0x8125('0x4a')]['belongsTo'](db[_0x8125('0x28')],{'as':'Trunk'});db[_0x8125('0x4a')]['belongsTo'](db[_0x8125('0xfd')],{'as':'List','foreignKey':_0x8125('0x16f')});db['FaxAccount'][_0x8125('0x129')](db[_0x8125('0x85')],{'as':'mandatoryDispositionPause','foreignKey':_0x8125('0x15c')});db[_0x8125('0x4a')][_0x8125('0x12d')](db[_0x8125('0x12')],{'as':_0x8125('0x15e'),'through':'user_has_fax_accounts'});db[_0x8125('0x17d')][_0x8125('0x129')](db[_0x8125('0x12')],{'onDelete':_0x8125('0x179')});db[_0x8125('0x17d')][_0x8125('0x129')](db['FaxQueue'],{'onDelete':_0x8125('0x179')});db['FaxApplication'][_0x8125('0x129')](db[_0x8125('0x4a')],{'onDelete':_0x8125('0x179')});db[_0x8125('0x17d')][_0x8125('0x129')](db['Tag'],{'onDelete':_0x8125('0x179'),'foreignKey':_0x8125('0x17a')});db[_0x8125('0x121')][_0x8125('0x11a')](db['FaxMessage'],{'as':_0x8125('0x172'),'onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x17e')});db[_0x8125('0x121')]['belongsTo'](db[_0x8125('0x4a')],{'as':_0x8125('0x17f'),'foreignKey':_0x8125('0x17b')});db[_0x8125('0x121')][_0x8125('0x129')](db[_0x8125('0x12e')],{'as':_0x8125('0x166'),'foreignKey':_0x8125('0x167')});db[_0x8125('0x121')][_0x8125('0x129')](db['User'],{'as':_0x8125('0x174'),'foreignKey':_0x8125('0x117')});db[_0x8125('0x121')][_0x8125('0x12d')](db[_0x8125('0x8c')],{'through':_0x8125('0x180'),'as':_0x8125('0x181')});db[_0x8125('0x121')][_0x8125('0x12d')](db[_0x8125('0x8c')],{'through':_0x8125('0x180'),'as':_0x8125('0x182')});db[_0x8125('0x121')][_0x8125('0x12d')](db[_0x8125('0x12')],{'as':_0x8125('0x176'),'through':'user_has_fax_interactions','foreignKey':_0x8125('0x17e')});db[_0x8125('0x183')][_0x8125('0x129')](db[_0x8125('0x12')],{'onDelete':'cascade','as':_0x8125('0x12')});db['FaxMessage'][_0x8125('0x129')](db[_0x8125('0x121')],{'as':_0x8125('0x178'),'foreignKey':_0x8125('0x17e')});db['FaxMessage'][_0x8125('0x129')](db['CmContact'],{'onDelete':'cascade','as':_0x8125('0x166')});db['FaxMessage'][_0x8125('0x129')](db[_0x8125('0xf3')],{'as':'Attachment','foreignKey':_0x8125('0x184')});db[_0x8125('0x183')][_0x8125('0x129')](db[_0x8125('0x4a')],{'as':_0x8125('0x17f'),'foreignKey':_0x8125('0x17b')});db['FaxQueue'][_0x8125('0x12d')](db[_0x8125('0x12')],{'as':'Agents','through':'UserFaxQueue'});db['FaxQueue'][_0x8125('0x12d')](db[_0x8125('0xeb')],{'through':_0x8125('0x185'),'as':_0x8125('0x15f')});db['FaxQueueReport'][_0x8125('0x129')](db[_0x8125('0x4a')],{});db[_0x8125('0x50')][_0x8125('0x129')](db[_0x8125('0xfd')],{'as':_0x8125('0x16e'),'foreignKey':'ListId'});db[_0x8125('0x50')][_0x8125('0x129')](db['CmContact'],{'as':_0x8125('0x166'),'foreignKey':_0x8125('0x167')});db[_0x8125('0x50')][_0x8125('0x129')](db[_0x8125('0x121')],{});db[_0x8125('0x50')][_0x8125('0x129')](db[_0x8125('0x183')],{});db[_0x8125('0x50')][_0x8125('0x129')](db['User'],{});db[_0x8125('0x50')][_0x8125('0x129')](db[_0x8125('0x13b')],{});db['SmsAccount'][_0x8125('0x11a')](db[_0x8125('0x16a')],{'as':_0x8125('0x16b'),'foreignKey':_0x8125('0x186')});db[_0x8125('0x52')][_0x8125('0x11a')](db[_0x8125('0x7e')],{'as':_0x8125('0x16c'),'foreignKey':_0x8125('0x186')});db['SmsAccount']['hasMany'](db[_0x8125('0x58')],{'as':_0x8125('0x172'),'foreignKey':_0x8125('0x186')});db[_0x8125('0x52')][_0x8125('0x11a')](db['SmsInteraction'],{'as':_0x8125('0x16d')});db[_0x8125('0x52')][_0x8125('0x11a')](db[_0x8125('0x54')],{'as':_0x8125('0x14e')});db['SmsAccount']['belongsTo'](db['CmList'],{'as':_0x8125('0x16e'),'foreignKey':'ListId'});db[_0x8125('0x52')][_0x8125('0x129')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x8125('0x52')][_0x8125('0x12d')](db['User'],{'as':'Agents','through':_0x8125('0x148')});db[_0x8125('0x54')][_0x8125('0x129')](db[_0x8125('0x12')],{'onDelete':_0x8125('0x179')});db['SmsApplication'][_0x8125('0x129')](db['SmsQueue'],{'onDelete':_0x8125('0x179')});db[_0x8125('0x54')]['belongsTo'](db[_0x8125('0x52')],{'onDelete':_0x8125('0x179')});db['SmsApplication'][_0x8125('0x129')](db[_0x8125('0x83')],{'onDelete':_0x8125('0x179'),'foreignKey':'IntervalId'});db[_0x8125('0x54')]['belongsTo'](db['Tag'],{'onDelete':_0x8125('0x179'),'foreignKey':'TagId'});db[_0x8125('0x56')]['hasMany'](db['SmsMessage'],{'as':_0x8125('0x172'),'onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x187')});db[_0x8125('0x56')]['belongsTo'](db[_0x8125('0x52')],{'as':'Account','foreignKey':_0x8125('0x186')});db['SmsInteraction'][_0x8125('0x129')](db[_0x8125('0x12e')],{'as':_0x8125('0x166'),'foreignKey':_0x8125('0x167')});db['SmsInteraction'][_0x8125('0x129')](db[_0x8125('0x12')],{'as':'Owner','foreignKey':_0x8125('0x117')});db[_0x8125('0x56')]['belongsToMany'](db[_0x8125('0x8c')],{'through':_0x8125('0x188'),'as':_0x8125('0x181')});db[_0x8125('0x56')][_0x8125('0x12d')](db[_0x8125('0x8c')],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db[_0x8125('0x56')][_0x8125('0x12d')](db[_0x8125('0x12')],{'as':_0x8125('0x176'),'through':_0x8125('0x135'),'foreignKey':_0x8125('0x187')});db[_0x8125('0x58')]['belongsTo'](db[_0x8125('0x12')],{'as':_0x8125('0x12')});db[_0x8125('0x58')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0x8125('0x166')});db[_0x8125('0x58')]['belongsTo'](db[_0x8125('0x56')],{'onDelete':_0x8125('0x116'),'as':_0x8125('0x178'),'foreignKey':_0x8125('0x187')});db[_0x8125('0x58')][_0x8125('0x129')](db['SmsAccount'],{'as':_0x8125('0x17f'),'foreignKey':_0x8125('0x186')});db[_0x8125('0x5a')][_0x8125('0x12d')](db[_0x8125('0x12')],{'as':'Agents','through':_0x8125('0x31'),'foreignKey':_0x8125('0x189')});db['SmsQueue'][_0x8125('0x12d')](db['Team'],{'through':_0x8125('0x18a'),'as':_0x8125('0x15f')});db[_0x8125('0x5c')][_0x8125('0x11a')](db[_0x8125('0x16a')],{'as':_0x8125('0x16b'),'foreignKey':_0x8125('0x18b')});db[_0x8125('0x5c')][_0x8125('0x11a')](db[_0x8125('0x7e')],{'as':_0x8125('0x16c'),'foreignKey':_0x8125('0x18b')});db[_0x8125('0x5c')][_0x8125('0x11a')](db[_0x8125('0x11e')],{'as':'Interactions','foreignKey':_0x8125('0x18b')});db[_0x8125('0x5c')][_0x8125('0x11a')](db[_0x8125('0x60')],{'as':'Messages','foreignKey':_0x8125('0x18b')});db[_0x8125('0x5c')][_0x8125('0x11a')](db[_0x8125('0x18c')],{'as':_0x8125('0x14e'),'foreignKey':_0x8125('0x18b')});db[_0x8125('0x5c')][_0x8125('0x129')](db[_0x8125('0xfd')],{'as':_0x8125('0x16e'),'foreignKey':_0x8125('0x16f')});db['OpenchannelAccount'][_0x8125('0x129')](db[_0x8125('0x85')],{'as':'mandatoryDispositionPause','foreignKey':_0x8125('0x15c')});db[_0x8125('0x5c')][_0x8125('0x12d')](db[_0x8125('0x12')],{'as':_0x8125('0x15e'),'through':_0x8125('0x146')});db[_0x8125('0x18c')]['belongsTo'](db[_0x8125('0x12')],{'onDelete':'restrict'});db['OpenchannelApplication']['belongsTo'](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x8125('0x18d')});db['OpenchannelApplication'][_0x8125('0x129')](db[_0x8125('0x5c')],{'onDelete':_0x8125('0x179'),'foreignKey':_0x8125('0x18b')});db[_0x8125('0x18c')][_0x8125('0x129')](db[_0x8125('0x83')],{'onDelete':_0x8125('0x179'),'foreignKey':_0x8125('0x15a')});db['OpenchannelApplication'][_0x8125('0x129')](db[_0x8125('0x8c')],{'onDelete':'restrict','foreignKey':_0x8125('0x17a')});db[_0x8125('0x11e')][_0x8125('0x11a')](db[_0x8125('0x60')],{'as':_0x8125('0x172'),'onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x18e')});db[_0x8125('0x11e')]['belongsTo'](db[_0x8125('0x5c')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x8125('0x11e')]['belongsTo'](db[_0x8125('0x12e')],{'as':_0x8125('0x166'),'foreignKey':'ContactId'});db[_0x8125('0x11e')][_0x8125('0x129')](db[_0x8125('0x12')],{'as':_0x8125('0x174'),'foreignKey':_0x8125('0x117')});db['OpenchannelInteraction']['belongsToMany'](db['Tag'],{'through':_0x8125('0x18f'),'as':_0x8125('0x181')});db[_0x8125('0x11e')][_0x8125('0x12d')](db[_0x8125('0x8c')],{'through':_0x8125('0x18f'),'as':_0x8125('0x182')});db[_0x8125('0x11e')][_0x8125('0x12d')](db['User'],{'as':_0x8125('0x176'),'through':_0x8125('0x190'),'foreignKey':_0x8125('0x18e')});db[_0x8125('0x60')][_0x8125('0x129')](db['User'],{'onDelete':_0x8125('0x116'),'as':_0x8125('0x12')});db[_0x8125('0x60')][_0x8125('0x129')](db[_0x8125('0x12e')],{'onDelete':_0x8125('0x116'),'as':_0x8125('0x166')});db[_0x8125('0x60')][_0x8125('0x129')](db['OpenchannelInteraction'],{'onDelete':_0x8125('0x116'),'as':'Interaction','foreignKey':_0x8125('0x18e')});db[_0x8125('0x60')][_0x8125('0x129')](db[_0x8125('0xf3')],{'as':_0x8125('0xf3'),'foreignKey':_0x8125('0x184')});db[_0x8125('0x60')][_0x8125('0x129')](db[_0x8125('0x5c')],{'as':_0x8125('0x17f'),'foreignKey':_0x8125('0x18b')});db['OpenchannelQueue'][_0x8125('0x12d')](db[_0x8125('0x12')],{'as':_0x8125('0x15e'),'through':_0x8125('0x33'),'foreignKey':'OpenchannelQueueId'});db[_0x8125('0x13d')]['belongsToMany'](db[_0x8125('0xeb')],{'through':_0x8125('0x191'),'as':_0x8125('0x15f')});db[_0x8125('0x62')][_0x8125('0x11a')](db[_0x8125('0x16a')],{'as':_0x8125('0x16b'),'foreignKey':_0x8125('0x192')});db['ChatWebsite'][_0x8125('0x11a')](db['CannedAnswer'],{'as':_0x8125('0x16c'),'foreignKey':_0x8125('0x192')});db[_0x8125('0x62')][_0x8125('0x11a')](db[_0x8125('0x6f')],{'as':_0x8125('0x193')});db[_0x8125('0x62')][_0x8125('0x11a')](db[_0x8125('0x66')],{'as':'Interactions'});db[_0x8125('0x62')][_0x8125('0x11a')](db[_0x8125('0x64')],{'as':_0x8125('0x14e')});db[_0x8125('0x62')][_0x8125('0x11a')](db[_0x8125('0x67')],{'as':_0x8125('0x172')});db[_0x8125('0x62')][_0x8125('0x129')](db['CmList'],{'as':_0x8125('0x16e'),'foreignKey':'ListId'});db[_0x8125('0x62')][_0x8125('0x129')](db[_0x8125('0x83')],{'as':_0x8125('0x83'),'foreignKey':'IntervalId'});db[_0x8125('0x62')][_0x8125('0x129')](db[_0x8125('0x85')],{'as':_0x8125('0x15b'),'foreignKey':_0x8125('0x15c')});db[_0x8125('0x62')][_0x8125('0x12d')](db[_0x8125('0x12')],{'as':_0x8125('0x15e'),'through':_0x8125('0x142')});db[_0x8125('0x194')][_0x8125('0x129')](db[_0x8125('0x5c')],{});db[_0x8125('0x194')][_0x8125('0x129')](db[_0x8125('0xfd')],{'as':_0x8125('0x16e'),'foreignKey':'ListId'});db[_0x8125('0x194')][_0x8125('0x129')](db[_0x8125('0x12e')],{'as':'Contact','foreignKey':_0x8125('0x167')});db[_0x8125('0x194')][_0x8125('0x129')](db[_0x8125('0x11e')],{});db[_0x8125('0x194')][_0x8125('0x129')](db[_0x8125('0x60')],{});db[_0x8125('0x194')]['belongsTo'](db[_0x8125('0x12')],{});db[_0x8125('0x194')][_0x8125('0x129')](db[_0x8125('0x13d')],{});db[_0x8125('0x64')]['belongsTo'](db[_0x8125('0x12')],{'as':_0x8125('0x195'),'foreignKey':_0x8125('0x117'),'onDelete':_0x8125('0x179')});db[_0x8125('0x64')][_0x8125('0x129')](db[_0x8125('0x6b')],{'as':'Queue','foreignKey':_0x8125('0x196'),'onDelete':_0x8125('0x179')});db[_0x8125('0x64')]['belongsTo'](db[_0x8125('0x62')],{'as':_0x8125('0x197'),'foreignKey':'ChatWebsiteId','onDelete':_0x8125('0x179')});db['ChatApplication'][_0x8125('0x129')](db[_0x8125('0x8c')],{'onDelete':'restrict','foreignKey':_0x8125('0x17a')});db['ChatInteraction'][_0x8125('0x11a')](db[_0x8125('0x67')],{'as':_0x8125('0x172'),'onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x198')});db['ChatInteraction'][_0x8125('0x129')](db[_0x8125('0x62')],{'as':'Account','foreignKey':_0x8125('0x192')});db['ChatInteraction'][_0x8125('0x129')](db[_0x8125('0x12e')],{'as':_0x8125('0x166'),'foreignKey':_0x8125('0x167')});db['ChatInteraction'][_0x8125('0x129')](db[_0x8125('0x12')],{'as':_0x8125('0x174'),'foreignKey':'UserId'});db[_0x8125('0x66')][_0x8125('0x12d')](db[_0x8125('0x8c')],{'through':'chat_interaction_has_tags','as':_0x8125('0x181')});db['ChatInteraction'][_0x8125('0x12d')](db[_0x8125('0x8c')],{'through':'chat_interaction_has_tags','as':_0x8125('0x182')});db[_0x8125('0x66')][_0x8125('0x12d')](db['User'],{'as':_0x8125('0x176'),'through':'user_has_chat_interactions','foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x8125('0x129')](db[_0x8125('0x12')],{'onDelete':_0x8125('0x116'),'as':_0x8125('0x12')});db[_0x8125('0x67')][_0x8125('0x129')](db['CmContact'],{'onDelete':_0x8125('0x116'),'as':'Contact','foreignKey':_0x8125('0x167')});db[_0x8125('0x67')][_0x8125('0x129')](db[_0x8125('0x66')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x8125('0x198')});db[_0x8125('0x67')][_0x8125('0x129')](db[_0x8125('0xf3')],{'as':_0x8125('0xf3'),'foreignKey':_0x8125('0x184')});db[_0x8125('0x67')][_0x8125('0x129')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x8125('0x192')});db['ChatOfflineMessage'][_0x8125('0x129')](db['CmContact'],{'onDelete':_0x8125('0x116'),'as':_0x8125('0x166'),'foreignKey':_0x8125('0x167')});db[_0x8125('0x69')]['belongsTo'](db[_0x8125('0x62')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x8125('0x6b')][_0x8125('0x12d')](db[_0x8125('0x12')],{'as':'Agents','through':_0x8125('0x199'),'hooks':!![]});db['ChatQueue'][_0x8125('0x12d')](db[_0x8125('0xeb')],{'through':_0x8125('0x19a'),'as':_0x8125('0x15f')});db['ChatGroup'][_0x8125('0x11a')](db['ChatInternalMessage'],{'as':_0x8125('0x172'),'foreignKey':_0x8125('0x19b'),'onDelete':_0x8125('0x116')});db[_0x8125('0x6d')][_0x8125('0x12d')](db[_0x8125('0x12')],{'as':_0x8125('0x152'),'through':_0x8125('0x12c')});db[_0x8125('0x6f')]['belongsTo'](db['ChatWebsite'],{'as':_0x8125('0x197'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x8125('0x11a')](db[_0x8125('0x12e')],{'as':_0x8125('0x12f'),'foreignKey':_0x8125('0x19c')});db[_0x8125('0x12e')]['hasMany'](db['CmHopper'],{'as':_0x8125('0x153'),'foreignKey':'ContactId'});db[_0x8125('0x12e')][_0x8125('0x11a')](db[_0x8125('0x78')],{'as':_0x8125('0x11b'),'foreignKey':'ContactId'});db[_0x8125('0x12e')][_0x8125('0x11a')](db['CmHopperHistory'],{'as':_0x8125('0x155'),'foreignKey':_0x8125('0x167')});db[_0x8125('0x12e')][_0x8125('0x11a')](db['ReportAgentPreview'],{'as':_0x8125('0x11d'),'foreignKey':'ContactId'});db[_0x8125('0x12e')][_0x8125('0x11a')](db[_0x8125('0xda')],{'as':_0x8125('0x157'),'foreignKey':_0x8125('0x167')});db[_0x8125('0x12e')][_0x8125('0x11a')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0x8125('0x167'),'onDelete':_0x8125('0x179')});db[_0x8125('0x12e')][_0x8125('0x11a')](db['ChatInteraction'],{'as':_0x8125('0x11f'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x8125('0x12e')]['hasMany'](db[_0x8125('0x56')],{'as':_0x8125('0x120'),'foreignKey':'ContactId','onDelete':_0x8125('0x179')});db[_0x8125('0x12e')]['hasMany'](db[_0x8125('0x121')],{'as':_0x8125('0x122'),'foreignKey':_0x8125('0x167'),'onDelete':_0x8125('0x179')});db[_0x8125('0x12e')][_0x8125('0x11a')](db['MailInteraction'],{'as':_0x8125('0x124'),'foreignKey':_0x8125('0x167'),'onDelete':'restrict'});db[_0x8125('0x12e')][_0x8125('0x129')](db[_0x8125('0x71')],{'as':'Company','foreignKey':'CompanyId'});db[_0x8125('0x12e')][_0x8125('0x129')](db[_0x8125('0xfd')],{'as':_0x8125('0x16e'),'foreignKey':'ListId','onDelete':_0x8125('0x116')});db['CmContact'][_0x8125('0x12d')](db[_0x8125('0x12')],{'as':_0x8125('0x176'),'through':'cm_user_has_contacts'});db[_0x8125('0x12e')][_0x8125('0x12d')](db[_0x8125('0x8c')],{'as':_0x8125('0x181'),'through':'cm_contact_has_tags'});db['CmContact']['belongsToMany'](db['Tag'],{'through':_0x8125('0x19d'),'as':_0x8125('0x182')});db[_0x8125('0x74')][_0x8125('0x129')](db[_0x8125('0x12e')],{'as':_0x8125('0x166'),'foreignKey':_0x8125('0x167'),'onDelete':_0x8125('0x116')});db['CmHopper'][_0x8125('0x129')](db[_0x8125('0xfd')],{'as':_0x8125('0x16e'),'foreignKey':_0x8125('0x16f'),'onDelete':_0x8125('0x116')});db[_0x8125('0x74')][_0x8125('0x129')](db[_0x8125('0x12')],{'as':_0x8125('0x195'),'foreignKey':'UserId'});db[_0x8125('0x74')][_0x8125('0x129')](db[_0x8125('0x137')],{'as':_0x8125('0x19e'),'foreignKey':_0x8125('0x154'),'onDelete':_0x8125('0x116')});db['CmHopper']['belongsTo'](db[_0x8125('0xef')],{'as':'Campaign','foreignKey':_0x8125('0x19f'),'onDelete':_0x8125('0x116')});db['CmHopper']['belongsTo'](db[_0x8125('0x12')],{'as':_0x8125('0x174'),'foreignKey':_0x8125('0x1a0')});db['CmHopperBlack'][_0x8125('0x129')](db[_0x8125('0x12e')],{'as':_0x8125('0x166'),'foreignKey':'ContactId','onDelete':'cascade'});db['CmHopperBlack']['belongsTo'](db[_0x8125('0xfd')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopperBlack'][_0x8125('0x129')](db[_0x8125('0x137')],{'as':_0x8125('0x19e'),'foreignKey':'VoiceQueueId','onDelete':_0x8125('0x116')});db[_0x8125('0x76')]['belongsTo'](db['Campaign'],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x8125('0x116')});db['Automation'][_0x8125('0x11a')](db[_0x8125('0x81')],{'as':{'plural':_0x8125('0x1a1'),'singular':_0x8125('0x1a2')},'foreignKey':_0x8125('0x1a3'),'onDelete':_0x8125('0x116'),'hooks':!![]});db[_0x8125('0x7c')]['hasMany'](db[_0x8125('0x81')],{'as':{'plural':_0x8125('0x1a4'),'singular':_0x8125('0x1a5')},'foreignKey':'AutomationAnyId','onDelete':_0x8125('0x116'),'hooks':!![]});db['Automation'][_0x8125('0x11a')](db[_0x8125('0x7b')],{'as':'Actions','foreignKey':_0x8125('0x1a6'),'onDelete':_0x8125('0x116'),'hooks':!![]});db[_0x8125('0x16a')][_0x8125('0x11a')](db['Disposition'],{'as':_0x8125('0x16b'),'foreignKey':'ParentId','onDelete':_0x8125('0x116')});db[_0x8125('0x83')][_0x8125('0x11a')](db[_0x8125('0x83')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db['Interval'][_0x8125('0x11a')](db[_0x8125('0x18')],{'as':_0x8125('0x119'),'foreignKey':'IntervalId','onDelete':_0x8125('0x179')});db[_0x8125('0x83')][_0x8125('0x11a')](db[_0x8125('0x42')],{'as':'MailApplications','foreignKey':_0x8125('0x15a')});db[_0x8125('0x83')]['hasMany'](db['ChatApplication'],{'as':_0x8125('0x1a7'),'foreignKey':_0x8125('0x15a')});db[_0x8125('0x83')][_0x8125('0x11a')](db[_0x8125('0x17d')],{'as':_0x8125('0x1a8'),'foreignKey':_0x8125('0x15a')});db[_0x8125('0x83')]['hasMany'](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x8125('0x15a')});db[_0x8125('0x1a9')][_0x8125('0x129')](db[_0x8125('0x3a')],{});db[_0x8125('0x1a9')][_0x8125('0x129')](db[_0x8125('0x98')],{'foreignKey':'DefaultReportId'});db[_0x8125('0x1a9')][_0x8125('0x129')](db['AnalyticCustomReport'],{'foreignKey':_0x8125('0x1aa')});db[_0x8125('0x8a')][_0x8125('0x12d')](db[_0x8125('0x14f')],{'as':_0x8125('0x1ab'),'through':_0x8125('0x151'),'onDelete':_0x8125('0x179')});db[_0x8125('0x8c')][_0x8125('0x12d')](db[_0x8125('0x12e')],{'through':_0x8125('0x19d')});db[_0x8125('0x8c')][_0x8125('0x12d')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0x8125('0x8c')][_0x8125('0x12d')](db[_0x8125('0x123')],{'through':'mail_interaction_has_tags'});db['Tag'][_0x8125('0x12d')](db[_0x8125('0x56')],{'through':_0x8125('0x188')});db[_0x8125('0x8c')]['belongsToMany'](db[_0x8125('0x121')],{'through':'fax_interaction_has_tags'});db[_0x8125('0x8c')][_0x8125('0x12d')](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0x8125('0x8c')][_0x8125('0x12d')](db[_0x8125('0x108')],{'through':_0x8125('0x1ac')});db[_0x8125('0x90')][_0x8125('0x11a')](db['Condition'],{'as':{'plural':_0x8125('0x1ad'),'singular':_0x8125('0x1ae')},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db[_0x8125('0x90')][_0x8125('0x11a')](db['Condition'],{'as':{'plural':_0x8125('0x1af'),'singular':_0x8125('0x1b0')},'foreignKey':'TriggerAnyId','onDelete':_0x8125('0x116'),'hooks':!![]});db[_0x8125('0x90')][_0x8125('0x11a')](db[_0x8125('0x7b')],{'as':_0x8125('0x1b1'),'foreignKey':_0x8125('0x1b2'),'onDelete':_0x8125('0x116'),'hooks':!![]});db[_0x8125('0x96')][_0x8125('0x11a')](db[_0x8125('0x9e')],{'as':_0x8125('0x1b3'),'onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x1aa'),'hooks':!![]});db[_0x8125('0x98')][_0x8125('0x11a')](db[_0x8125('0x9e')],{'as':_0x8125('0x1b3'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x8125('0x9c')]['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x1b4')});db['AnalyticFieldReport'][_0x8125('0x129')](db[_0x8125('0x9c')],{'foreignKey':_0x8125('0x1b4')});db[_0x8125('0x1b5')]['hasMany'](db[_0x8125('0xa2')],{'as':_0x8125('0x1b6'),'onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x1b7')});db[_0x8125('0xa2')][_0x8125('0x11a')](db[_0x8125('0x1b8')],{'as':'Subjects','onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x1b9')});db[_0x8125('0xa2')][_0x8125('0x11a')](db['SalesforceField'],{'as':_0x8125('0x1ba'),'onDelete':'cascade','foreignKey':_0x8125('0x1bb')});db[_0x8125('0xa2')][_0x8125('0x11a')](db[_0x8125('0x1b8')],{'as':_0x8125('0x1b3'),'onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x1bc')});db[_0x8125('0xa2')][_0x8125('0x129')](db[_0x8125('0x1b5')],{'as':_0x8125('0x17f'),'foreignKey':_0x8125('0x1b7')});db[_0x8125('0x1b8')][_0x8125('0x11a')](db['SalesforceField'],{'as':_0x8125('0x1bd'),'foreignKey':_0x8125('0x1b9')});db['SalesforceField']['hasMany'](db[_0x8125('0x1b8')],{'as':_0x8125('0x1be'),'foreignKey':'DescriptionId'});db[_0x8125('0x1b8')][_0x8125('0x11a')](db[_0x8125('0x1b8')],{'as':_0x8125('0x1bf'),'foreignKey':_0x8125('0x1bc')});db[_0x8125('0x1b8')][_0x8125('0x129')](db[_0x8125('0x92')],{'as':_0x8125('0x92'),'foreignKey':_0x8125('0x1c0')});db['SugarcrmAccount'][_0x8125('0x11a')](db[_0x8125('0xa6')],{'as':_0x8125('0x1b6'),'onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x1b7')});db[_0x8125('0xa6')][_0x8125('0x11a')](db[_0x8125('0x1c1')],{'as':'Subjects','onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x1b9')});db[_0x8125('0xa6')][_0x8125('0x11a')](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x1bb')});db['SugarcrmConfiguration'][_0x8125('0x11a')](db[_0x8125('0x1c1')],{'as':'Fields','onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x1bc')});db[_0x8125('0xa6')][_0x8125('0x129')](db['SugarcrmAccount'],{'as':_0x8125('0x17f'),'foreignKey':_0x8125('0x1b7')});db['SugarcrmField']['hasMany'](db[_0x8125('0x1c1')],{'as':'Subject','foreignKey':'SubjectId'});db['SugarcrmField'][_0x8125('0x11a')](db[_0x8125('0x1c1')],{'as':_0x8125('0x1be'),'foreignKey':_0x8125('0x1bb')});db['SugarcrmField'][_0x8125('0x11a')](db[_0x8125('0x1c1')],{'as':_0x8125('0x1bf'),'foreignKey':_0x8125('0x1bc')});db[_0x8125('0x1c1')][_0x8125('0x129')](db[_0x8125('0x92')],{'as':_0x8125('0x92'),'foreignKey':_0x8125('0x1c0')});db[_0x8125('0xa8')]['hasMany'](db[_0x8125('0xaa')],{'as':_0x8125('0x1b6'),'onDelete':'cascade','foreignKey':_0x8125('0x1b7')});db[_0x8125('0xaa')][_0x8125('0x11a')](db['DeskField'],{'as':'Subjects','onDelete':_0x8125('0x116'),'foreignKey':'SubjectId'});db[_0x8125('0xaa')][_0x8125('0x11a')](db[_0x8125('0xac')],{'as':_0x8125('0x1ba'),'onDelete':'cascade','foreignKey':_0x8125('0x1bb')});db[_0x8125('0xaa')][_0x8125('0x11a')](db[_0x8125('0xac')],{'as':_0x8125('0x1b3'),'onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x1bc')});db[_0x8125('0xaa')]['belongsTo'](db[_0x8125('0xa8')],{'as':_0x8125('0x17f'),'foreignKey':'AccountId'});db[_0x8125('0xaa')][_0x8125('0x12d')](db['Tag'],{'through':_0x8125('0x1c2')});db[_0x8125('0xac')][_0x8125('0x11a')](db[_0x8125('0xac')],{'as':_0x8125('0x1bd'),'foreignKey':_0x8125('0x1b9')});db[_0x8125('0xac')][_0x8125('0x11a')](db[_0x8125('0xac')],{'as':_0x8125('0x1be'),'foreignKey':_0x8125('0x1bb')});db[_0x8125('0xac')][_0x8125('0x11a')](db[_0x8125('0xac')],{'as':_0x8125('0x1bf'),'foreignKey':_0x8125('0x1bc')});db[_0x8125('0xac')][_0x8125('0x129')](db['Variable'],{'as':_0x8125('0x92'),'foreignKey':_0x8125('0x1c0')});db[_0x8125('0xae')][_0x8125('0x11a')](db[_0x8125('0xb0')],{'as':'Configurations','onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x1b7')});db[_0x8125('0xb0')]['hasMany'](db['ZohoField'],{'as':_0x8125('0x1c3'),'onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x1b9')});db[_0x8125('0xb0')]['hasMany'](db[_0x8125('0x1c4')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x8125('0x1bb')});db[_0x8125('0xb0')][_0x8125('0x11a')](db['ZohoField'],{'as':_0x8125('0x1b3'),'onDelete':_0x8125('0x116'),'foreignKey':'FieldId'});db[_0x8125('0xb0')][_0x8125('0x129')](db[_0x8125('0xae')],{'as':_0x8125('0x17f'),'foreignKey':_0x8125('0x1b7')});db[_0x8125('0x1c4')][_0x8125('0x11a')](db['ZohoField'],{'as':_0x8125('0x1bd'),'foreignKey':_0x8125('0x1b9')});db[_0x8125('0x1c4')][_0x8125('0x11a')](db['ZohoField'],{'as':_0x8125('0x1be'),'foreignKey':'DescriptionId'});db[_0x8125('0x1c4')]['hasMany'](db['ZohoField'],{'as':_0x8125('0x1bf'),'foreignKey':_0x8125('0x1bc')});db['ZohoField'][_0x8125('0x129')](db[_0x8125('0x92')],{'as':_0x8125('0x92'),'foreignKey':_0x8125('0x1c0')});db[_0x8125('0xb3')]['hasMany'](db['ZendeskConfiguration'],{'as':_0x8125('0x1b6'),'onDelete':_0x8125('0x116'),'foreignKey':'AccountId'});db[_0x8125('0xb4')][_0x8125('0x11a')](db[_0x8125('0xb6')],{'as':_0x8125('0x1c3'),'foreignKey':_0x8125('0x1b9')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0x8125('0x1ba'),'foreignKey':'DescriptionId'});db[_0x8125('0xb4')][_0x8125('0x11a')](db[_0x8125('0xb6')],{'as':_0x8125('0x1b3'),'foreignKey':_0x8125('0x1bc')});db[_0x8125('0xb4')]['belongsTo'](db[_0x8125('0xb3')],{'as':_0x8125('0x17f'),'foreignKey':_0x8125('0x1b7')});db[_0x8125('0xb4')][_0x8125('0x12d')](db[_0x8125('0x8c')],{'through':_0x8125('0x1c5')});db[_0x8125('0xb6')][_0x8125('0x11a')](db[_0x8125('0xb6')],{'as':_0x8125('0x1bd'),'foreignKey':_0x8125('0x1b9')});db[_0x8125('0xb6')][_0x8125('0x11a')](db[_0x8125('0xb6')],{'as':_0x8125('0x1be'),'foreignKey':_0x8125('0x1bb')});db[_0x8125('0xb6')][_0x8125('0x11a')](db[_0x8125('0xb6')],{'as':'Field','foreignKey':_0x8125('0x1bc')});db['ZendeskField'][_0x8125('0x129')](db[_0x8125('0x92')],{'as':_0x8125('0x92'),'foreignKey':'VariableId'});db['FreshdeskAccount'][_0x8125('0x11a')](db[_0x8125('0xba')],{'as':_0x8125('0x1b6'),'onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x1b7')});db[_0x8125('0xba')][_0x8125('0x11a')](db[_0x8125('0xbc')],{'as':_0x8125('0x1c3'),'onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x1b9')});db[_0x8125('0xba')][_0x8125('0x11a')](db[_0x8125('0xbc')],{'as':'Descriptions','onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x1bb')});db[_0x8125('0xba')][_0x8125('0x11a')](db[_0x8125('0xbc')],{'as':_0x8125('0x1b3'),'onDelete':_0x8125('0x116'),'foreignKey':'FieldId'});db[_0x8125('0xba')][_0x8125('0x129')](db[_0x8125('0xb8')],{'as':_0x8125('0x17f'),'foreignKey':'AccountId'});db[_0x8125('0xba')][_0x8125('0x12d')](db[_0x8125('0x8c')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x8125('0xbc')]['hasMany'](db['FreshdeskField'],{'as':_0x8125('0x1bd'),'foreignKey':_0x8125('0x1b9')});db['FreshdeskField'][_0x8125('0x11a')](db['FreshdeskField'],{'as':'Description','foreignKey':_0x8125('0x1bb')});db['FreshdeskField'][_0x8125('0x11a')](db[_0x8125('0xbc')],{'as':_0x8125('0x1bf'),'foreignKey':'FieldId'});db[_0x8125('0xbc')][_0x8125('0x129')](db[_0x8125('0x92')],{'as':_0x8125('0x92'),'foreignKey':_0x8125('0x1c0')});db['VtigerAccount'][_0x8125('0x11a')](db['VtigerConfiguration'],{'as':_0x8125('0x1b6'),'onDelete':_0x8125('0x116'),'foreignKey':'AccountId'});db[_0x8125('0xbf')][_0x8125('0x11a')](db[_0x8125('0xc1')],{'as':_0x8125('0x1c3'),'foreignKey':_0x8125('0x1b9')});db[_0x8125('0xbf')]['hasMany'](db[_0x8125('0xc1')],{'as':_0x8125('0x1ba'),'foreignKey':'DescriptionId'});db[_0x8125('0xbf')]['hasMany'](db[_0x8125('0xc1')],{'as':_0x8125('0x1b3'),'foreignKey':'FieldId'});db[_0x8125('0xbf')]['belongsTo'](db['VtigerAccount'],{'as':_0x8125('0x17f'),'foreignKey':_0x8125('0x1b7')});db[_0x8125('0xc1')][_0x8125('0x11a')](db[_0x8125('0xc1')],{'as':'Subject','foreignKey':_0x8125('0x1b9')});db[_0x8125('0xc1')]['hasMany'](db[_0x8125('0xc1')],{'as':_0x8125('0x1be'),'foreignKey':_0x8125('0x1bb')});db[_0x8125('0xc1')][_0x8125('0x11a')](db['VtigerField'],{'as':'Field','foreignKey':'FieldId'});db[_0x8125('0xc1')][_0x8125('0x129')](db[_0x8125('0x92')],{'as':_0x8125('0x92'),'foreignKey':_0x8125('0x1c0')});db[_0x8125('0xc3')][_0x8125('0x11a')](db[_0x8125('0xc5')],{'as':_0x8125('0x1b6'),'onDelete':'cascade','foreignKey':_0x8125('0x1b7')});db[_0x8125('0xc5')][_0x8125('0x11a')](db[_0x8125('0x1c6')],{'as':_0x8125('0x1c3'),'foreignKey':_0x8125('0x1b9')});db[_0x8125('0xc5')][_0x8125('0x11a')](db[_0x8125('0x1c6')],{'as':_0x8125('0x1ba'),'foreignKey':_0x8125('0x1bb')});db['ServicenowConfiguration'][_0x8125('0x11a')](db[_0x8125('0x1c6')],{'as':_0x8125('0x1b3'),'foreignKey':'FieldId'});db[_0x8125('0xc5')]['belongsTo'](db[_0x8125('0xc3')],{'as':_0x8125('0x17f'),'foreignKey':_0x8125('0x1b7')});db[_0x8125('0x1c6')][_0x8125('0x11a')](db[_0x8125('0x1c6')],{'as':_0x8125('0x1bd'),'foreignKey':_0x8125('0x1b9')});db[_0x8125('0x1c6')][_0x8125('0x11a')](db[_0x8125('0x1c6')],{'as':_0x8125('0x1be'),'foreignKey':_0x8125('0x1bb')});db[_0x8125('0x1c6')][_0x8125('0x11a')](db[_0x8125('0x1c6')],{'as':_0x8125('0x1bf'),'foreignKey':_0x8125('0x1bc')});db[_0x8125('0x1c6')][_0x8125('0x129')](db[_0x8125('0x92')],{'as':_0x8125('0x92'),'foreignKey':_0x8125('0x1c0')});db[_0x8125('0x1c7')][_0x8125('0x11a')](db[_0x8125('0xc8')],{'as':_0x8125('0x1b6'),'onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x1b7')});db[_0x8125('0xc8')][_0x8125('0x11a')](db[_0x8125('0xc9')],{'as':_0x8125('0x1c3'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x8125('0xc8')][_0x8125('0x11a')](db[_0x8125('0xc9')],{'as':_0x8125('0x1ba'),'onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x1bb')});db[_0x8125('0xc8')][_0x8125('0x11a')](db[_0x8125('0xc9')],{'as':_0x8125('0x1b3'),'onDelete':_0x8125('0x116'),'foreignKey':'FieldId'});db[_0x8125('0xc8')][_0x8125('0x129')](db[_0x8125('0x1c7')],{'as':'Account','foreignKey':_0x8125('0x1b7')});db[_0x8125('0xc9')][_0x8125('0x11a')](db[_0x8125('0xc9')],{'as':_0x8125('0x1bd'),'foreignKey':_0x8125('0x1b9')});db[_0x8125('0xc9')][_0x8125('0x11a')](db[_0x8125('0xc9')],{'as':'Description','foreignKey':_0x8125('0x1bb')});db[_0x8125('0xc9')][_0x8125('0x11a')](db[_0x8125('0xc9')],{'as':_0x8125('0x1bf'),'foreignKey':_0x8125('0x1bc')});db[_0x8125('0xc9')]['belongsTo'](db[_0x8125('0x92')],{'as':_0x8125('0x92'),'foreignKey':_0x8125('0x1c0')});db[_0x8125('0xca')]['hasMany'](db[_0x8125('0x1c8')],{'as':_0x8125('0x1b6'),'onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x1b7')});db[_0x8125('0x1c8')][_0x8125('0x11a')](db[_0x8125('0xcd')],{'as':'Subjects','foreignKey':_0x8125('0x1b9')});db[_0x8125('0x1c8')]['hasMany'](db[_0x8125('0xcd')],{'as':'Descriptions','foreignKey':_0x8125('0x1bb')});db['FreshsalesConfiguration'][_0x8125('0x11a')](db[_0x8125('0xcd')],{'as':_0x8125('0x1b3'),'foreignKey':'FieldId'});db[_0x8125('0x1c8')][_0x8125('0x129')](db[_0x8125('0xca')],{'as':_0x8125('0x17f'),'foreignKey':_0x8125('0x1b7')});db[_0x8125('0xcd')][_0x8125('0x11a')](db[_0x8125('0xcd')],{'as':_0x8125('0x1bd'),'foreignKey':'SubjectId'});db[_0x8125('0xcd')][_0x8125('0x11a')](db[_0x8125('0xcd')],{'as':'Description','foreignKey':_0x8125('0x1bb')});db['FreshsalesField'][_0x8125('0x11a')](db['FreshsalesField'],{'as':_0x8125('0x1bf'),'foreignKey':_0x8125('0x1bc')});db[_0x8125('0xcd')]['belongsTo'](db['Variable'],{'as':_0x8125('0x92'),'foreignKey':_0x8125('0x1c0')});db['ChatQueueReport'][_0x8125('0x129')](db[_0x8125('0x62')],{});db[_0x8125('0xd3')][_0x8125('0x129')](db['CmList'],{'as':'List','foreignKey':_0x8125('0x16f')});db[_0x8125('0xd3')][_0x8125('0x129')](db[_0x8125('0x12e')],{'as':'Contact','foreignKey':_0x8125('0x167')});db[_0x8125('0xd3')][_0x8125('0x129')](db['ChatInteraction'],{});db['ChatQueueReport'][_0x8125('0x129')](db[_0x8125('0x67')],{});db[_0x8125('0xd3')][_0x8125('0x129')](db[_0x8125('0x12')],{});db[_0x8125('0xd3')][_0x8125('0x129')](db[_0x8125('0x6b')],{});db[_0x8125('0xd5')][_0x8125('0x129')](db['User'],{'onDelete':'cascade','foreignKey':_0x8125('0x1c9')});db[_0x8125('0xd5')][_0x8125('0x129')](db[_0x8125('0x12')],{'onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x1ca')});db[_0x8125('0xda')][_0x8125('0x11a')](db['JscriptyQuestionReport'],{'foreignKey':_0x8125('0x1cb'),'onDelete':_0x8125('0x116')});db[_0x8125('0xda')][_0x8125('0x11a')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0x8125('0x116')});db['SmsQueueReport'][_0x8125('0x129')](db[_0x8125('0x52')],{});db['SmsQueueReport']['belongsTo'](db[_0x8125('0xfd')],{'as':_0x8125('0x16e'),'foreignKey':_0x8125('0x16f')});db[_0x8125('0xdc')][_0x8125('0x129')](db[_0x8125('0x12e')],{'as':_0x8125('0x166'),'foreignKey':'ContactId'});db[_0x8125('0xdc')][_0x8125('0x129')](db[_0x8125('0x56')],{});db[_0x8125('0xdc')][_0x8125('0x129')](db[_0x8125('0x58')],{});db['SmsQueueReport'][_0x8125('0x129')](db['User'],{});db[_0x8125('0xdc')]['belongsTo'](db[_0x8125('0x5a')],{});db[_0x8125('0xe2')][_0x8125('0x11a')](db[_0x8125('0xda')],{'foreignKey':_0x8125('0x1cc')});db[_0x8125('0xe2')][_0x8125('0x11a')](db[_0x8125('0xd9')],{'foreignKey':_0x8125('0x1cc')});db[_0x8125('0xe2')][_0x8125('0x11a')](db[_0x8125('0xd7')],{'foreignKey':_0x8125('0x1cc')});db[_0x8125('0xe7')]['belongsToMany'](db[_0x8125('0x12')],{'as':_0x8125('0x176'),'through':'user_has_square_projects'});db[_0x8125('0xeb')]['belongsToMany'](db[_0x8125('0x12')],{'as':_0x8125('0x15e'),'through':_0x8125('0x133')});db[_0x8125('0xeb')][_0x8125('0x12d')](db[_0x8125('0x137')],{'through':_0x8125('0x113'),'as':_0x8125('0x1cd')});db['Team'][_0x8125('0x12d')](db[_0x8125('0x3c')],{'through':_0x8125('0x171'),'as':_0x8125('0x138')});db['Team']['belongsToMany'](db[_0x8125('0x6b')],{'through':_0x8125('0x19a'),'as':'ChatQueues'});db['Team'][_0x8125('0x12d')](db[_0x8125('0x13b')],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0x8125('0xeb')][_0x8125('0x12d')](db[_0x8125('0x5a')],{'through':_0x8125('0x18a'),'as':_0x8125('0x1ce')});db[_0x8125('0xeb')][_0x8125('0x12d')](db[_0x8125('0x13d')],{'through':_0x8125('0x191'),'as':'OpenchannelQueues'});db['Team'][_0x8125('0x12d')](db[_0x8125('0x10f')],{'through':_0x8125('0x1cf'),'as':_0x8125('0x1d0')});db[_0x8125('0xef')][_0x8125('0x11a')](db['CmHopper'],{'as':_0x8125('0x153'),'foreignKey':_0x8125('0x19f')});db['Campaign'][_0x8125('0x11a')](db[_0x8125('0x78')],{'as':'HopperFinals','foreignKey':_0x8125('0x19f')});db[_0x8125('0xef')][_0x8125('0x11a')](db[_0x8125('0x79')],{'as':'HopperHistories','foreignKey':'CampaignId'});db['Campaign'][_0x8125('0x11a')](db[_0x8125('0x76')],{'as':_0x8125('0x156'),'foreignKey':'CampaignId'});db[_0x8125('0xef')]['belongsTo'](db['Trunk'],{'as':_0x8125('0x28'),'foreignKey':'TrunkId'});db['Campaign'][_0x8125('0x129')](db['Trunk'],{'as':_0x8125('0x159'),'foreignKey':_0x8125('0x1d1')});db[_0x8125('0xef')][_0x8125('0x129')](db[_0x8125('0x83')],{'as':'Interval','foreignKey':_0x8125('0x15a')});db[_0x8125('0xef')][_0x8125('0x129')](db['SquareProject'],{'as':_0x8125('0xe7'),'foreignKey':_0x8125('0x1d2')});db[_0x8125('0xef')][_0x8125('0x12d')](db['CmList'],{'as':_0x8125('0x131'),'through':'campaigns_has_cm_lists'});db[_0x8125('0xef')]['belongsToMany'](db[_0x8125('0xfd')],{'as':_0x8125('0x160'),'through':_0x8125('0x1d3')});db['MailTransferReport']['belongsTo'](db['MailMessage'],{});db['MailTransferReport'][_0x8125('0x129')](db[_0x8125('0x123')],{});db[_0x8125('0xf7')][_0x8125('0x129')](db[_0x8125('0x3a')],{'foreignKey':_0x8125('0x1d4'),'as':_0x8125('0x1d5')});db['MailTransferReport'][_0x8125('0x129')](db[_0x8125('0x12')],{'foreignKey':_0x8125('0x1d6'),'as':_0x8125('0x1d7')});db[_0x8125('0xf7')]['belongsTo'](db[_0x8125('0x12')],{'foreignKey':_0x8125('0x1d8'),'as':_0x8125('0x1d9')});db['MailTransferReport'][_0x8125('0x129')](db[_0x8125('0x3c')],{'foreignKey':_0x8125('0x1da'),'as':'ToQueue'});db[_0x8125('0xf7')][_0x8125('0x129')](db[_0x8125('0x3a')],{'foreignKey':_0x8125('0x1db'),'as':_0x8125('0x1dc')});db[_0x8125('0xf8')][_0x8125('0x129')](db[_0x8125('0x67')],{});db[_0x8125('0xf8')][_0x8125('0x129')](db[_0x8125('0x66')],{});db['ChatTransferReport'][_0x8125('0x129')](db[_0x8125('0x62')],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0x8125('0xf8')]['belongsTo'](db[_0x8125('0x12')],{'foreignKey':_0x8125('0x1d6'),'as':'FromAgent'});db[_0x8125('0xf8')]['belongsTo'](db['User'],{'foreignKey':_0x8125('0x1d8'),'as':_0x8125('0x1d9')});db[_0x8125('0xf8')]['belongsTo'](db[_0x8125('0x6b')],{'foreignKey':_0x8125('0x1dd'),'as':'ToQueue'});db[_0x8125('0xf8')][_0x8125('0x129')](db[_0x8125('0x62')],{'foreignKey':'ToChatWebsiteId','as':_0x8125('0x1dc')});db['FaxTransferReport'][_0x8125('0x129')](db[_0x8125('0x183')],{});db[_0x8125('0xf9')][_0x8125('0x129')](db[_0x8125('0x121')],{});db[_0x8125('0xf9')][_0x8125('0x129')](db['FaxAccount'],{'foreignKey':_0x8125('0x1de'),'as':'FromAccount'});db[_0x8125('0xf9')]['belongsTo'](db[_0x8125('0x12')],{'foreignKey':'FromUserId','as':_0x8125('0x1d7')});db[_0x8125('0xf9')][_0x8125('0x129')](db[_0x8125('0x12')],{'foreignKey':_0x8125('0x1d8'),'as':_0x8125('0x1d9')});db[_0x8125('0xf9')][_0x8125('0x129')](db[_0x8125('0x13b')],{'foreignKey':'ToFaxQueueId','as':_0x8125('0x1df')});db[_0x8125('0xf9')]['belongsTo'](db[_0x8125('0x4a')],{'foreignKey':'ToFaxAccountId','as':_0x8125('0x1dc')});db[_0x8125('0xfa')][_0x8125('0x129')](db[_0x8125('0x60')],{});db[_0x8125('0xfa')][_0x8125('0x129')](db[_0x8125('0x11e')],{});db['OpenchannelTransferReport'][_0x8125('0x129')](db['OpenchannelAccount'],{'foreignKey':_0x8125('0x1e0'),'as':_0x8125('0x1d5')});db[_0x8125('0xfa')]['belongsTo'](db[_0x8125('0x12')],{'foreignKey':'FromUserId','as':_0x8125('0x1d7')});db[_0x8125('0xfa')]['belongsTo'](db[_0x8125('0x12')],{'foreignKey':'ToUserId','as':_0x8125('0x1d9')});db[_0x8125('0xfa')][_0x8125('0x129')](db[_0x8125('0x13d')],{'foreignKey':'ToOpenchannelQueueId','as':_0x8125('0x1df')});db[_0x8125('0xfa')][_0x8125('0x129')](db['OpenchannelAccount'],{'foreignKey':_0x8125('0x1e1'),'as':_0x8125('0x1dc')});db[_0x8125('0xfb')][_0x8125('0x129')](db[_0x8125('0x58')],{});db[_0x8125('0xfb')][_0x8125('0x129')](db['SmsInteraction'],{});db[_0x8125('0xfb')][_0x8125('0x129')](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':_0x8125('0x1d5')});db[_0x8125('0xfb')][_0x8125('0x129')](db['User'],{'foreignKey':_0x8125('0x1d6'),'as':_0x8125('0x1d7')});db[_0x8125('0xfb')][_0x8125('0x129')](db[_0x8125('0x12')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x8125('0xfb')]['belongsTo'](db['SmsQueue'],{'foreignKey':_0x8125('0x1e2'),'as':_0x8125('0x1df')});db['SmsTransferReport'][_0x8125('0x129')](db[_0x8125('0x52')],{'foreignKey':_0x8125('0x1e3'),'as':_0x8125('0x1dc')});db[_0x8125('0xfd')][_0x8125('0x11a')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x8125('0x16f')});db[_0x8125('0xfd')][_0x8125('0x11a')](db[_0x8125('0x1e4')],{'as':_0x8125('0x1e5'),'foreignKey':_0x8125('0x16f')});db[_0x8125('0xfd')][_0x8125('0x11a')](db[_0x8125('0x12e')],{'as':_0x8125('0x12f'),'onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x16f')});db[_0x8125('0xfd')][_0x8125('0x11a')](db['CmHopperFinal'],{'as':_0x8125('0x11b'),'foreignKey':'ListId'});db[_0x8125('0xfd')]['hasMany'](db[_0x8125('0x79')],{'as':'HopperHistory','foreignKey':_0x8125('0x16f')});db[_0x8125('0xfd')][_0x8125('0x11a')](db[_0x8125('0x11d')],{'as':_0x8125('0x11d'),'foreignKey':'ListId'});db[_0x8125('0xfd')][_0x8125('0x12d')](db['VoiceQueue'],{'as':_0x8125('0x1e6'),'through':_0x8125('0x15d')});db['CmList'][_0x8125('0x12d')](db[_0x8125('0x12')],{'as':'Agents','through':_0x8125('0x132')});db[_0x8125('0xfe')][_0x8125('0x11a')](db[_0x8125('0x18')],{'as':'Extensions','onDelete':'cascade'});db[_0x8125('0xfe')][_0x8125('0x12d')](db[_0x8125('0x12')],{'as':_0x8125('0x15e'),'through':_0x8125('0x140')});db[_0x8125('0x100')][_0x8125('0x11a')](db[_0x8125('0x12')],{'as':_0x8125('0x176'),'foreignKey':'userProfileId'});db[_0x8125('0x100')]['hasMany'](db[_0x8125('0x102')],{'as':'UserProfileSections','foreignKey':_0x8125('0x12a'),'onDelete':_0x8125('0x116')});db['UserProfileSection'][_0x8125('0x11a')](db['UserProfileResource'],{'as':_0x8125('0x1e7'),'foreignKey':'sectionId','onDelete':_0x8125('0x116')});db[_0x8125('0x149')][_0x8125('0x11a')](db[_0x8125('0x16a')],{'as':_0x8125('0x16b'),'foreignKey':_0x8125('0x1e8')});db[_0x8125('0x149')][_0x8125('0x11a')](db[_0x8125('0x7e')],{'as':'Answers','foreignKey':_0x8125('0x1e8')});db[_0x8125('0x149')][_0x8125('0x11a')](db[_0x8125('0x10a')],{'as':_0x8125('0x172'),'foreignKey':_0x8125('0x1e8')});db['WhatsappAccount'][_0x8125('0x11a')](db[_0x8125('0x108')],{'as':'Interactions'});db[_0x8125('0x149')][_0x8125('0x11a')](db[_0x8125('0x1e9')],{'as':_0x8125('0x14e')});db[_0x8125('0x149')]['belongsTo'](db[_0x8125('0xfd')],{'as':'List','foreignKey':_0x8125('0x16f')});db['WhatsappAccount'][_0x8125('0x129')](db['Pause'],{'as':_0x8125('0x15b'),'foreignKey':_0x8125('0x15c')});db[_0x8125('0x149')]['belongsToMany'](db[_0x8125('0x12')],{'as':_0x8125('0x15e'),'through':_0x8125('0x14a')});db[_0x8125('0x1e9')][_0x8125('0x129')](db[_0x8125('0x12')],{'onDelete':'restrict'});db[_0x8125('0x1e9')][_0x8125('0x129')](db[_0x8125('0x10f')],{'onDelete':_0x8125('0x179')});db[_0x8125('0x1e9')]['belongsTo'](db[_0x8125('0x149')],{'onDelete':_0x8125('0x179')});db[_0x8125('0x1e9')][_0x8125('0x129')](db[_0x8125('0x83')],{'onDelete':_0x8125('0x179'),'foreignKey':'IntervalId'});db[_0x8125('0x1e9')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0x8125('0x17a')});db[_0x8125('0x108')][_0x8125('0x11a')](db[_0x8125('0x10a')],{'as':_0x8125('0x172'),'onDelete':_0x8125('0x116'),'foreignKey':_0x8125('0x1ea')});db[_0x8125('0x108')]['belongsTo'](db[_0x8125('0x149')],{'as':_0x8125('0x17f'),'foreignKey':_0x8125('0x1e8')});db[_0x8125('0x108')][_0x8125('0x129')](db['CmContact'],{'as':'Contact','foreignKey':_0x8125('0x167')});db[_0x8125('0x108')][_0x8125('0x129')](db[_0x8125('0x12')],{'as':_0x8125('0x174'),'foreignKey':_0x8125('0x117')});db[_0x8125('0x108')][_0x8125('0x12d')](db[_0x8125('0x8c')],{'through':_0x8125('0x1ac'),'as':_0x8125('0x181')});db[_0x8125('0x108')][_0x8125('0x12d')](db[_0x8125('0x8c')],{'through':_0x8125('0x1ac'),'as':_0x8125('0x182')});db[_0x8125('0x108')][_0x8125('0x12d')](db['User'],{'as':_0x8125('0x176'),'through':_0x8125('0x1eb'),'foreignKey':_0x8125('0x1ea')});db[_0x8125('0x10a')][_0x8125('0x129')](db[_0x8125('0x12')],{'as':_0x8125('0x12')});db[_0x8125('0x10a')]['belongsTo'](db['CmContact'],{'onDelete':_0x8125('0x116'),'as':_0x8125('0x166')});db[_0x8125('0x10a')][_0x8125('0x129')](db[_0x8125('0x108')],{'onDelete':_0x8125('0x116'),'as':'Interaction','foreignKey':_0x8125('0x1ea')});db[_0x8125('0x10a')][_0x8125('0x129')](db[_0x8125('0x149')],{'as':_0x8125('0x17f'),'foreignKey':_0x8125('0x1e8')});db[_0x8125('0x10b')][_0x8125('0x129')](db['WhatsappAccount'],{});db[_0x8125('0x10b')][_0x8125('0x129')](db[_0x8125('0xfd')],{'as':'List','foreignKey':'ListId'});db[_0x8125('0x10b')]['belongsTo'](db[_0x8125('0x12e')],{'as':_0x8125('0x166'),'foreignKey':_0x8125('0x167')});db[_0x8125('0x10b')][_0x8125('0x129')](db[_0x8125('0x108')],{});db['WhatsappQueueReport'][_0x8125('0x129')](db[_0x8125('0x10f')],{});db[_0x8125('0x10b')][_0x8125('0x129')](db['WhatsappMessage'],{});db[_0x8125('0x10b')][_0x8125('0x129')](db[_0x8125('0x12')],{});db[_0x8125('0x10d')][_0x8125('0x129')](db['WhatsappMessage'],{});db[_0x8125('0x10d')][_0x8125('0x129')](db[_0x8125('0x108')],{});db[_0x8125('0x10d')][_0x8125('0x129')](db[_0x8125('0x149')],{'foreignKey':_0x8125('0x1ec'),'as':'FromAccount'});db[_0x8125('0x10d')][_0x8125('0x129')](db['WhatsappAccount'],{'foreignKey':_0x8125('0x1ed'),'as':_0x8125('0x1dc')});db['WhatsappTransferReport'][_0x8125('0x129')](db[_0x8125('0x10f')],{'foreignKey':_0x8125('0x1ee'),'as':_0x8125('0x1df')});db[_0x8125('0x10d')][_0x8125('0x129')](db[_0x8125('0x12')],{'foreignKey':'FromUserId','as':_0x8125('0x1d7')});db[_0x8125('0x10d')][_0x8125('0x129')](db[_0x8125('0x12')],{'foreignKey':_0x8125('0x1d8'),'as':_0x8125('0x1d9')});db['WhatsappQueue']['belongsToMany'](db[_0x8125('0x12')],{'as':_0x8125('0x15e'),'through':'UserWhatsappQueue','foreignKey':_0x8125('0x1ef')});db[_0x8125('0x10f')][_0x8125('0x12d')](db[_0x8125('0xeb')],{'through':'team_has_whatsapp_queues','as':'Teams'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x13bb=['../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/notification/notification.model','UserNotification','../api/userNotification/userNotification.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','User','hasOne','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','WhatsappInteractions','Notification','Notifications','SenderId','UserNotifications','belongsTo','userProfileId','belongsToMany','Groups','Contacts','CmList','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','MailQueues','UserMailQueue','ChatQueues','UserChatQueue','FaxQueue','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','VoicePrefixes','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','BlackLists','ScreenRecording','Messages','mailboxuser','mailbox','VoiceCallReport','QueueCalls','AgentReports','uniqueid','MailAccount','MailAccountId','Imap','Answers','Applications','List','ListId','TemplateId','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','Account','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','restrict','TagId','MailQueueReport','ContactId','Items','Disposition','Dispositions','FaxAccountId','Interactions','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','Interaction','AttachmentId','team_has_fax_queues','SmsAccountId','SmsMessage','SmsApplication','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccount','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','ChatWebsiteId','ProactiveActions','ChatMessage','Queue','ChatQueueId','Website','ChatInteractionId','team_has_chat_queues','ChatGroupId','chat_group_has_users','CompanyId','JscriptySessionReport','FaxInteractions','Company','cm_user_has_contacts','cm_contact_has_tags','Agent','CampaignId','OwnerId','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','Extensions','MailApplications','SmsApplications','DefaultReportId','CustomReportId','chat_interaction_has_tags','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','AnalyticMetric','MetricId','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','SalesforceAccount','Subject','Description','Field','VariableId','DeskConfiguration','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskConfiguration','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowConfiguration','ServicenowField','Dynamics365Field','FreshsalesAccount','FreshsalesField','ChatQueueReport','FromId','ToId','SessionId','ProjectId','team_has_openchannel_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','user_has_voice_prefixes','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','xC@LL1234','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','database','username','password','options','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxQueueReport','SmsAccount','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction'];(function(_0x1e24b1,_0x14ab30){var _0x212baf=function(_0x2bd3e9){while(--_0x2bd3e9){_0x1e24b1['push'](_0x1e24b1['shift']());}};_0x212baf(++_0x14ab30);}(_0x13bb,0x19b));var _0xb13b=function(_0x1e0adb,_0x29db10){_0x1e0adb=_0x1e0adb-0x0;var _0x332b3e=_0x13bb[_0x1e0adb];return _0x332b3e;};'use strict';var path=require('path');var config=require(_0xb13b('0x0'));var Sequelize=require(_0xb13b('0x1'));var _=require(_0xb13b('0x2'));var jstz=require(_0xb13b('0x3'));var timezone=jstz[_0xb13b('0x4')]();config[_0xb13b('0x1')]=_[_0xb13b('0x5')](config['sequelize'],{'database':'motion2','username':'xcall','password':_0xb13b('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xb13b('0x7'),'dialectOptions':{'charset':_0xb13b('0x8')},'logging':![],'timezone':timezone[_0xb13b('0x9')](),'define':{'charset':_0xb13b('0xa'),'collate':_0xb13b('0xb')}}});config[_0xb13b('0xc')]=_[_0xb13b('0x5')](config['sequelizeHistory'],{'database':_0xb13b('0xd'),'username':'xcall','password':_0xb13b('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xb13b('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xb13b('0xa'),'collate':_0xb13b('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xb13b('0x1')][_0xb13b('0xe')],config[_0xb13b('0x1')]['username'],config[_0xb13b('0x1')]['password'],config[_0xb13b('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config['sequelizeHistory'][_0xb13b('0xf')],config['sequelizeHistory'][_0xb13b('0x10')],config[_0xb13b('0xc')][_0xb13b('0x11')])};db['User']=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x13'));db[_0xb13b('0x14')]=db['sequelize'][_0xb13b('0x12')](_0xb13b('0x15'));db['VoiceContext']=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x16'));db[_0xb13b('0x17')]=db[_0xb13b('0x1')][_0xb13b('0x12')]('../api/voiceExtension/voiceExtension.model');db[_0xb13b('0x18')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x19'));db['VoiceQueue']=db[_0xb13b('0x1')]['import'](_0xb13b('0x1a'));db[_0xb13b('0x1b')]=db['sequelize'][_0xb13b('0x12')](_0xb13b('0x1c'));db['ScreenRecording']=db[_0xb13b('0x1')][_0xb13b('0x12')]('../api/screenRecording/screenRecording.model');db[_0xb13b('0x1d')]=db[_0xb13b('0x1')]['import'](_0xb13b('0x1e'));db[_0xb13b('0x1f')]=db['sequelize'][_0xb13b('0x12')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x20'));db[_0xb13b('0x21')]=db['sequelize']['import'](_0xb13b('0x22'));db[_0xb13b('0x23')]=db['sequelize'][_0xb13b('0x12')](_0xb13b('0x24'));db[_0xb13b('0x25')]=db['sequelize']['import'](_0xb13b('0x26'));db['MemberReport']=db['sequelize'][_0xb13b('0x12')](_0xb13b('0x27'));db[_0xb13b('0x28')]=db[_0xb13b('0x1')]['import']('../api/trunk/trunk.model');db[_0xb13b('0x29')]=db[_0xb13b('0x1')]['import'](_0xb13b('0x2a'));db[_0xb13b('0x2b')]=db[_0xb13b('0x1')][_0xb13b('0x12')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xb13b('0x2c')]=db['sequelize'][_0xb13b('0x12')](_0xb13b('0x2d'));db['UserChatQueue']=db['sequelize'][_0xb13b('0x12')](_0xb13b('0x2e'));db['UserMailQueue']=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x2f'));db[_0xb13b('0x30')]=db[_0xb13b('0x1')][_0xb13b('0x12')]('../api/userFaxQueue/userFaxQueue.model');db[_0xb13b('0x31')]=db[_0xb13b('0x1')][_0xb13b('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0xb13b('0x32')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x33'));db[_0xb13b('0x34')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x35'));db[_0xb13b('0x36')]=db['sequelize']['import']('../api/mailServerIn/mailServerIn.model');db[_0xb13b('0x37')]=db['sequelize'][_0xb13b('0x12')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db[_0xb13b('0x1')][_0xb13b('0x12')]('../api/mailAccount/mailAccount.model');db[_0xb13b('0x38')]=db[_0xb13b('0x1')][_0xb13b('0x12')]('../api/mailQueue/mailQueue.model');db[_0xb13b('0x39')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x3a'));db[_0xb13b('0x3b')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x3c'));db[_0xb13b('0x3d')]=db[_0xb13b('0x1')]['import'](_0xb13b('0x3e'));db[_0xb13b('0x3f')]=db[_0xb13b('0x1')][_0xb13b('0x12')]('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db['sequelize'][_0xb13b('0x12')](_0xb13b('0x40'));db['Dashboard']=db[_0xb13b('0x1')]['import'](_0xb13b('0x41'));db[_0xb13b('0x42')]=db['sequelize'][_0xb13b('0x12')](_0xb13b('0x43'));db[_0xb13b('0x44')]=db[_0xb13b('0x1')][_0xb13b('0x12')]('../api/faxAccount/faxAccount.model');db[_0xb13b('0x45')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x46'));db[_0xb13b('0x47')]=db[_0xb13b('0x1')]['import'](_0xb13b('0x48'));db['FaxMessage']=db[_0xb13b('0x1')][_0xb13b('0x12')]('../api/faxMessage/faxMessage.model');db['FaxQueue']=db[_0xb13b('0x1')][_0xb13b('0x12')]('../api/faxQueue/faxQueue.model');db[_0xb13b('0x49')]=db['sequelize']['import']('../api/faxQueueReport/faxQueueReport.model');db[_0xb13b('0x4a')]=db['sequelize'][_0xb13b('0x12')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x4b'));db[_0xb13b('0x4c')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x4d'));db['SmsMessage']=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x4e'));db[_0xb13b('0x4f')]=db['sequelize']['import']('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x50'));db[_0xb13b('0x51')]=db['sequelize'][_0xb13b('0x12')](_0xb13b('0x52'));db['OpenchannelInteraction']=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x53'));db[_0xb13b('0x54')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x55'));db[_0xb13b('0x56')]=db['sequelize'][_0xb13b('0x12')](_0xb13b('0x57'));db['ChatWebsite']=db[_0xb13b('0x1')][_0xb13b('0x12')]('../api/chatWebsite/chatWebsite.model');db[_0xb13b('0x58')]=db[_0xb13b('0x1')]['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xb13b('0x59')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x5a'));db[_0xb13b('0x5b')]=db['sequelize']['import']('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db['sequelize'][_0xb13b('0x12')](_0xb13b('0x5c'));db[_0xb13b('0x5d')]=db[_0xb13b('0x1')]['import'](_0xb13b('0x5e'));db[_0xb13b('0x5f')]=db[_0xb13b('0x1')][_0xb13b('0x12')]('../api/chatQueue/chatQueue.model');db[_0xb13b('0x60')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x61'));db[_0xb13b('0x62')]=db[_0xb13b('0x1')]['import'](_0xb13b('0x63'));db[_0xb13b('0x64')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x65'));db[_0xb13b('0x66')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x67'));db[_0xb13b('0x68')]=db['sequelize']['import'](_0xb13b('0x69'));db['CmHopperBlack']=db['sequelize'][_0xb13b('0x12')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0xb13b('0x6a')]=db[_0xb13b('0x1')]['import'](_0xb13b('0x6b'));db[_0xb13b('0x6c')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x6d'));db['ReportAgentPreview']=db['sequelize']['import'](_0xb13b('0x6e'));db[_0xb13b('0x6f')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x70'));db[_0xb13b('0x71')]=db['sequelize'][_0xb13b('0x12')](_0xb13b('0x72'));db[_0xb13b('0x73')]=db[_0xb13b('0x1')]['import'](_0xb13b('0x74'));db[_0xb13b('0x75')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x76'));db['Disposition']=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x77'));db[_0xb13b('0x78')]=db['sequelize'][_0xb13b('0x12')](_0xb13b('0x79'));db['Interval']=db['sequelize'][_0xb13b('0x12')](_0xb13b('0x7a'));db[_0xb13b('0x7b')]=db['sequelize'][_0xb13b('0x12')](_0xb13b('0x7c'));db[_0xb13b('0x7d')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x7e'));db[_0xb13b('0x7f')]=db['sequelize'][_0xb13b('0x12')](_0xb13b('0x80'));db[_0xb13b('0x81')]=db[_0xb13b('0x1')]['import']('../api/schedule/schedule.model');db[_0xb13b('0x82')]=db[_0xb13b('0x1')]['import'](_0xb13b('0x83'));db[_0xb13b('0x84')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x85'));db[_0xb13b('0x86')]=db['sequelize'][_0xb13b('0x12')](_0xb13b('0x87'));db[_0xb13b('0x88')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x89'));db[_0xb13b('0x8a')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x8b'));db[_0xb13b('0x8c')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x8d'));db[_0xb13b('0x8e')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x8f'));db[_0xb13b('0x90')]=db['sequelize'][_0xb13b('0x12')](_0xb13b('0x91'));db[_0xb13b('0x92')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x93'));db['AnalyticExtractedReport']=db['sequelize'][_0xb13b('0x12')](_0xb13b('0x94'));db['AnalyticMetric']=db[_0xb13b('0x1')]['import'](_0xb13b('0x95'));db[_0xb13b('0x96')]=db[_0xb13b('0x1')]['import'](_0xb13b('0x97'));db[_0xb13b('0x98')]=db[_0xb13b('0x1')]['import'](_0xb13b('0x99'));db['SalesforceAccount']=db[_0xb13b('0x1')]['import'](_0xb13b('0x9a'));db[_0xb13b('0x9b')]=db[_0xb13b('0x1')][_0xb13b('0x12')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0xb13b('0x1')][_0xb13b('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0xb13b('0x9c')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x9d'));db[_0xb13b('0x9e')]=db['sequelize']['import'](_0xb13b('0x9f'));db[_0xb13b('0xa0')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0xa1'));db[_0xb13b('0xa2')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0xa3'));db['DeskConfiguration']=db[_0xb13b('0x1')]['import'](_0xb13b('0xa4'));db[_0xb13b('0xa5')]=db[_0xb13b('0x1')]['import'](_0xb13b('0xa6'));db[_0xb13b('0xa7')]=db['sequelize'][_0xb13b('0x12')](_0xb13b('0xa8'));db['ZohoConfiguration']=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0xa9'));db[_0xb13b('0xaa')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0xab'));db['ZendeskAccount']=db['sequelize'][_0xb13b('0x12')](_0xb13b('0xac'));db[_0xb13b('0xad')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0xae'));db[_0xb13b('0xaf')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0xb0'));db[_0xb13b('0xb1')]=db['sequelize'][_0xb13b('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0xb2'));db['FreshdeskField']=db[_0xb13b('0x1')]['import'](_0xb13b('0xb3'));db[_0xb13b('0xb4')]=db['sequelize'][_0xb13b('0x12')]('../api/intVtigerAccount/intVtigerAccount.model');db['VtigerConfiguration']=db['sequelize']['import'](_0xb13b('0xb5'));db[_0xb13b('0xb6')]=db['sequelize'][_0xb13b('0x12')](_0xb13b('0xb7'));db[_0xb13b('0xb8')]=db[_0xb13b('0x1')]['import'](_0xb13b('0xb9'));db['ServicenowConfiguration']=db['sequelize']['import'](_0xb13b('0xba'));db['ServicenowField']=db[_0xb13b('0x1')][_0xb13b('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0xb13b('0xbb')]=db[_0xb13b('0x1')]['import'](_0xb13b('0xbc'));db[_0xb13b('0xbd')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0xbe'));db['Dynamics365Field']=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0xbf'));db['FreshsalesAccount']=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0xc0'));db[_0xb13b('0xc1')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0xc2'));db['FreshsalesField']=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0xc3'));db[_0xb13b('0x8c')]=db[_0xb13b('0x1')]['import'](_0xb13b('0x8d'));db[_0xb13b('0xc4')]=db['sequelize']['import'](_0xb13b('0xc5'));db['ChatQueueReport']=db['sequelize'][_0xb13b('0x12')](_0xb13b('0xc6'));db[_0xb13b('0xc7')]=db[_0xb13b('0x1')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db[_0xb13b('0xc8')]=db['sequelize'][_0xb13b('0x12')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xb13b('0xc9')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0xca'));db['JscriptySessionReport']=db['sequelize'][_0xb13b('0x12')](_0xb13b('0xcb'));db[_0xb13b('0xcc')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0xcd'));db[_0xb13b('0xce')]=db[_0xb13b('0x1')]['import']('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0xb13b('0x1')]['import'](_0xb13b('0xcf'));db[_0xb13b('0xd0')]=db['sequelize']['import'](_0xb13b('0xd1'));db[_0xb13b('0xd2')]=db['sequelize'][_0xb13b('0x12')](_0xb13b('0xd3'));db[_0xb13b('0xd4')]=db[_0xb13b('0x1')]['import']('../api/squareOdbc/squareOdbc.model');db[_0xb13b('0xd5')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0xd6'));db[_0xb13b('0xd7')]=db[_0xb13b('0x1')]['import']('../api/squareRecording/squareRecording.model');db[_0xb13b('0xd8')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0xd9'));db[_0xb13b('0xda')]=db[_0xb13b('0x1')]['import'](_0xb13b('0xdb'));db[_0xb13b('0xdc')]=db[_0xb13b('0x1')][_0xb13b('0x12')]('../api/license/license.model');db[_0xb13b('0xdd')]=db[_0xb13b('0x1')]['import'](_0xb13b('0xde'));db[_0xb13b('0xdf')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0xe0'));db[_0xb13b('0xe1')]=db['sequelize'][_0xb13b('0x12')](_0xb13b('0xe2'));db[_0xb13b('0xe3')]=db['sequelize']['import'](_0xb13b('0xe4'));db[_0xb13b('0xe5')]=db[_0xb13b('0x1')][_0xb13b('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0xb13b('0xe6')]=db['sequelize'][_0xb13b('0x12')](_0xb13b('0xe7'));db[_0xb13b('0xe8')]=db['sequelize']['import'](_0xb13b('0xe9'));db[_0xb13b('0xea')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0xeb'));db[_0xb13b('0xec')]=db[_0xb13b('0x1')]['import'](_0xb13b('0xed'));db['CmList']=db[_0xb13b('0x1')][_0xb13b('0x12')]('../api/cmList/cmList.model');db[_0xb13b('0xee')]=db['sequelize']['import'](_0xb13b('0xef'));db[_0xb13b('0xf0')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0xf1'));db[_0xb13b('0xf2')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0xf3'));db[_0xb13b('0xf4')]=db[_0xb13b('0x1')][_0xb13b('0x12')]('../api/userProfileResource/userProfileResource.model');db['Notification']=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0xf5'));db[_0xb13b('0xf6')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0xf7'));db['WhatsappAccount']=db[_0xb13b('0x1')][_0xb13b('0x12')]('../api/whatsappAccount/whatsappAccount.model');db[_0xb13b('0xf8')]=db['sequelize'][_0xb13b('0x12')](_0xb13b('0xf9'));db[_0xb13b('0xfa')]=db['sequelize'][_0xb13b('0x12')](_0xb13b('0xfb'));db[_0xb13b('0xfc')]=db[_0xb13b('0x1')][_0xb13b('0x12')]('../api/whatsappMessage/whatsappMessage.model');db[_0xb13b('0xfd')]=db['sequelize'][_0xb13b('0x12')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xb13b('0xfe')]=db['sequelize']['import'](_0xb13b('0xff'));db[_0xb13b('0x100')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x101'));db[_0xb13b('0x102')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x103'));db[_0xb13b('0x104')]=db[_0xb13b('0x1')][_0xb13b('0x12')](_0xb13b('0x105'));db[_0xb13b('0x106')][_0xb13b('0x107')](db[_0xb13b('0x1d')],{'as':_0xb13b('0x1d'),'onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x109')});db[_0xb13b('0x106')][_0xb13b('0x10a')](db[_0xb13b('0x1b')],{'as':_0xb13b('0x10b'),'foreignKey':_0xb13b('0x109')});db[_0xb13b('0x106')][_0xb13b('0x10a')](db[_0xb13b('0x2b')],{'as':_0xb13b('0x10c'),'foreignKey':_0xb13b('0x109')});db[_0xb13b('0x106')][_0xb13b('0x10a')](db['VoiceExtension'],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db[_0xb13b('0x106')][_0xb13b('0x10a')](db[_0xb13b('0x6a')],{'as':_0xb13b('0x10d'),'foreignKey':'UserId'});db[_0xb13b('0x106')][_0xb13b('0x10a')](db[_0xb13b('0x6c')],{'as':_0xb13b('0x10e'),'foreignKey':_0xb13b('0x109')});db[_0xb13b('0x106')]['hasMany'](db[_0xb13b('0x10f')],{'as':_0xb13b('0x10f'),'foreignKey':_0xb13b('0x109')});db[_0xb13b('0x106')][_0xb13b('0x10a')](db[_0xb13b('0x110')],{'as':_0xb13b('0x111'),'foreignKey':_0xb13b('0x109')});db[_0xb13b('0x106')]['hasMany'](db[_0xb13b('0x5b')],{'as':_0xb13b('0x112'),'foreignKey':_0xb13b('0x109')});db[_0xb13b('0x106')]['hasMany'](db[_0xb13b('0x4c')],{'as':_0xb13b('0x113'),'foreignKey':_0xb13b('0x109')});db[_0xb13b('0x106')]['hasMany'](db[_0xb13b('0x47')],{'as':'FaxInteractions','foreignKey':_0xb13b('0x109')});db[_0xb13b('0x106')]['hasMany'](db['MailInteraction'],{'as':'MailInteractions','foreignKey':'UserId'});db[_0xb13b('0x106')][_0xb13b('0x10a')](db[_0xb13b('0xfa')],{'as':_0xb13b('0x114'),'foreignKey':_0xb13b('0x109')});db[_0xb13b('0x106')][_0xb13b('0x10a')](db[_0xb13b('0x115')],{'as':_0xb13b('0x116'),'foreignKey':_0xb13b('0x117')});db[_0xb13b('0x106')][_0xb13b('0x10a')](db['UserNotification'],{'as':_0xb13b('0x118'),'foreignKey':'SenderId'});db['User'][_0xb13b('0x119')](db[_0xb13b('0xf0')],{'as':_0xb13b('0xf0'),'foreignKey':_0xb13b('0x11a')});db[_0xb13b('0x106')][_0xb13b('0x11b')](db[_0xb13b('0x60')],{'as':_0xb13b('0x11c'),'through':'chat_group_has_users'});db[_0xb13b('0x106')][_0xb13b('0x11b')](db['CmContact'],{'as':_0xb13b('0x11d'),'through':'cm_user_has_contacts'});db[_0xb13b('0x106')]['belongsToMany'](db[_0xb13b('0x11e')],{'as':_0xb13b('0x11f'),'through':_0xb13b('0x120')});db[_0xb13b('0x106')][_0xb13b('0x11b')](db[_0xb13b('0xda')],{'through':_0xb13b('0x121')});db[_0xb13b('0x106')][_0xb13b('0x11b')](db[_0xb13b('0x3b')],{'as':_0xb13b('0x122'),'through':_0xb13b('0x123')});db['User'][_0xb13b('0x11b')](db[_0xb13b('0x5b')],{'as':_0xb13b('0x112'),'through':_0xb13b('0x124')});db[_0xb13b('0x106')][_0xb13b('0x11b')](db[_0xb13b('0x47')],{'as':'FaxInteractions','through':_0xb13b('0x125')});db['User'][_0xb13b('0x11b')](db[_0xb13b('0x4c')],{'as':_0xb13b('0x113'),'through':_0xb13b('0x126')});db[_0xb13b('0x106')]['belongsToMany'](db[_0xb13b('0x110')],{'as':_0xb13b('0x111'),'through':_0xb13b('0x127')});db[_0xb13b('0x106')]['belongsToMany'](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':_0xb13b('0x128')});db[_0xb13b('0x106')][_0xb13b('0x11b')](db[_0xb13b('0x129')],{'as':_0xb13b('0x12a'),'through':_0xb13b('0x2c'),'required':![]});db[_0xb13b('0x106')]['belongsToMany'](db['MailQueue'],{'as':_0xb13b('0x12b'),'through':_0xb13b('0x12c'),'required':![]});db[_0xb13b('0x106')][_0xb13b('0x11b')](db[_0xb13b('0x5f')],{'as':_0xb13b('0x12d'),'through':_0xb13b('0x12e'),'required':![],'hooks':!![]});db[_0xb13b('0x106')][_0xb13b('0x11b')](db[_0xb13b('0x12f')],{'as':_0xb13b('0x130'),'through':_0xb13b('0x30'),'required':![]});db[_0xb13b('0x106')][_0xb13b('0x11b')](db[_0xb13b('0x4f')],{'as':_0xb13b('0x131'),'through':'UserSmsQueue','required':![]});db[_0xb13b('0x106')][_0xb13b('0x11b')](db['OpenchannelQueue'],{'as':_0xb13b('0x132'),'through':_0xb13b('0x32'),'required':![]});db[_0xb13b('0x106')][_0xb13b('0x11b')](db[_0xb13b('0x100')],{'as':_0xb13b('0x133'),'through':_0xb13b('0x34'),'required':![]});db[_0xb13b('0x106')][_0xb13b('0x11b')](db[_0xb13b('0x11e')],{'through':_0xb13b('0x120')});db['User']['belongsToMany'](db[_0xb13b('0xee')],{'as':_0xb13b('0x134'),'through':'user_has_voice_prefixes','required':![]});db[_0xb13b('0x106')][_0xb13b('0x11b')](db[_0xb13b('0x135')],{'as':_0xb13b('0x136'),'through':_0xb13b('0x137')});db[_0xb13b('0x106')][_0xb13b('0x11b')](db[_0xb13b('0x44')],{'as':_0xb13b('0x138'),'through':_0xb13b('0x139')});db['User'][_0xb13b('0x11b')](db['MailAccount'],{'as':_0xb13b('0x13a'),'through':_0xb13b('0x13b')});db[_0xb13b('0x106')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0xb13b('0x13c'),'through':_0xb13b('0x13d')});db[_0xb13b('0x106')][_0xb13b('0x11b')](db[_0xb13b('0x4a')],{'as':_0xb13b('0x13e'),'through':_0xb13b('0x13f')});db[_0xb13b('0x106')]['belongsToMany'](db[_0xb13b('0x140')],{'as':'WhatsappAccounts','through':_0xb13b('0x141')});db[_0xb13b('0x106')][_0xb13b('0x11b')](db[_0xb13b('0xd5')],{'as':_0xb13b('0x142'),'through':_0xb13b('0x143')});db[_0xb13b('0x14')]['hasMany'](db[_0xb13b('0x17')],{'as':_0xb13b('0x144'),'onDelete':'cascade','foreignKey':_0xb13b('0x145')});db['VoiceContext'][_0xb13b('0x10a')](db[_0xb13b('0x17')],{'onDelete':_0xb13b('0x108')});db[_0xb13b('0x17')]['hasMany'](db['VoiceExtension'],{'as':'Applications','onDelete':_0xb13b('0x108')});db[_0xb13b('0x18')][_0xb13b('0x11b')](db[_0xb13b('0x82')],{'as':_0xb13b('0x146'),'through':_0xb13b('0x147')});db[_0xb13b('0x129')][_0xb13b('0x10a')](db['UserVoiceQueueRt'],{'as':_0xb13b('0x148'),'foreignKey':_0xb13b('0x149')});db[_0xb13b('0x129')][_0xb13b('0x10a')](db[_0xb13b('0x68')],{'as':_0xb13b('0x14a'),'foreignKey':_0xb13b('0x149')});db[_0xb13b('0x129')][_0xb13b('0x10a')](db[_0xb13b('0x6a')],{'as':_0xb13b('0x10d'),'foreignKey':_0xb13b('0x149')});db[_0xb13b('0x129')][_0xb13b('0x10a')](db[_0xb13b('0x6c')],{'as':_0xb13b('0x14b'),'foreignKey':_0xb13b('0x149')});db[_0xb13b('0x129')][_0xb13b('0x10a')](db[_0xb13b('0x10f')],{'as':'ReportAgentPreview','foreignKey':_0xb13b('0x149')});db[_0xb13b('0x129')][_0xb13b('0x10a')](db[_0xb13b('0x14c')],{'as':_0xb13b('0x14d'),'foreignKey':_0xb13b('0x149')});db[_0xb13b('0x129')]['hasMany'](db['JscriptySessionReport'],{'as':_0xb13b('0x14e'),'foreignKey':_0xb13b('0x149')});db[_0xb13b('0x129')][_0xb13b('0x119')](db[_0xb13b('0x28')],{'as':_0xb13b('0x28'),'foreignKey':_0xb13b('0x14f')});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':_0xb13b('0x150'),'foreignKey':_0xb13b('0x151')});db[_0xb13b('0x129')]['belongsTo'](db[_0xb13b('0x152')],{'as':_0xb13b('0x152'),'foreignKey':_0xb13b('0x153')});db['VoiceQueue'][_0xb13b('0x119')](db[_0xb13b('0x7b')],{'as':_0xb13b('0x154'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xb13b('0x129')][_0xb13b('0x11b')](db[_0xb13b('0x11e')],{'as':_0xb13b('0x11f'),'through':_0xb13b('0x155')});db[_0xb13b('0x129')]['belongsToMany'](db[_0xb13b('0x106')],{'as':_0xb13b('0x156'),'through':_0xb13b('0x2c')});db[_0xb13b('0x129')][_0xb13b('0x11b')](db['Team'],{'as':_0xb13b('0x157'),'through':_0xb13b('0x104')});db[_0xb13b('0x129')][_0xb13b('0x11b')](db[_0xb13b('0x11e')],{'as':_0xb13b('0x158'),'through':'voice_queues_has_cm_blacklists'});db[_0xb13b('0x1b')][_0xb13b('0x119')](db[_0xb13b('0x106')],{'as':_0xb13b('0x106'),'foreignKey':_0xb13b('0x109')});db[_0xb13b('0x159')]['belongsTo'](db[_0xb13b('0x106')],{'as':'User','foreignKey':_0xb13b('0x109')});db[_0xb13b('0x1d')][_0xb13b('0x10a')](db[_0xb13b('0x1f')],{'as':_0xb13b('0x15a'),'onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x15b'),'sourceKey':_0xb13b('0x15c')});db[_0xb13b('0x1f')][_0xb13b('0x119')](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0xb13b('0x15c')});db[_0xb13b('0x15d')]['hasMany'](db[_0xb13b('0x25')],{'as':_0xb13b('0x15e'),'foreignKey':'uniqueid','constraints':![]});db[_0xb13b('0x15d')][_0xb13b('0x10a')](db[_0xb13b('0x23')],{'as':_0xb13b('0x15f'),'foreignKey':_0xb13b('0x160'),'constraints':![]});db['VoiceCallReport']['belongsTo'](db[_0xb13b('0x106')],{'as':_0xb13b('0x106'),'foreignKey':_0xb13b('0x109')});db[_0xb13b('0x15d')][_0xb13b('0x119')](db[_0xb13b('0x66')],{'as':'Contact','foreignKey':'ContactId'});db[_0xb13b('0x36')]['belongsTo'](db[_0xb13b('0x161')],{'as':_0xb13b('0x161'),'foreignKey':'MailAccountId'});db[_0xb13b('0x37')]['belongsTo'](db[_0xb13b('0x161')],{'as':_0xb13b('0x161'),'foreignKey':_0xb13b('0x162')});db[_0xb13b('0x161')]['hasOne'](db[_0xb13b('0x36')],{'as':_0xb13b('0x163'),'onDelete':_0xb13b('0x108')});db['MailAccount'][_0xb13b('0x107')](db['MailServerOut'],{'as':'Smtp','onDelete':_0xb13b('0x108')});db[_0xb13b('0x161')][_0xb13b('0x10a')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xb13b('0x162')});db[_0xb13b('0x161')]['hasMany'](db[_0xb13b('0x75')],{'as':_0xb13b('0x164'),'foreignKey':_0xb13b('0x162')});db[_0xb13b('0x161')]['hasMany'](db[_0xb13b('0x3d')],{'as':_0xb13b('0x15a'),'foreignKey':_0xb13b('0x162')});db[_0xb13b('0x161')][_0xb13b('0x10a')](db[_0xb13b('0x3b')],{'as':'Interactions'});db[_0xb13b('0x161')][_0xb13b('0x10a')](db[_0xb13b('0x3f')],{'as':_0xb13b('0x165')});db[_0xb13b('0x161')][_0xb13b('0x119')](db['CmList'],{'as':_0xb13b('0x166'),'foreignKey':_0xb13b('0x167')});db[_0xb13b('0x161')][_0xb13b('0x119')](db['Template'],{'as':_0xb13b('0x86'),'foreignKey':_0xb13b('0x168')});db[_0xb13b('0x161')][_0xb13b('0x119')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xb13b('0x169')});db[_0xb13b('0x161')][_0xb13b('0x11b')](db['User'],{'as':_0xb13b('0x156'),'through':_0xb13b('0x13b')});db[_0xb13b('0x38')]['belongsToMany'](db[_0xb13b('0x106')],{'as':_0xb13b('0x156'),'through':_0xb13b('0x12c')});db['MailQueue']['belongsToMany'](db[_0xb13b('0xda')],{'through':_0xb13b('0x16a'),'as':_0xb13b('0x157')});db[_0xb13b('0x3b')][_0xb13b('0x10a')](db['MailMessage'],{'as':_0xb13b('0x15a'),'onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x16b')});db[_0xb13b('0x3b')]['belongsTo'](db['MailAccount'],{'as':_0xb13b('0x16c'),'foreignKey':_0xb13b('0x162')});db[_0xb13b('0x3b')][_0xb13b('0x119')](db['CmContact'],{'as':_0xb13b('0x16d'),'foreignKey':'ContactId'});db[_0xb13b('0x3b')][_0xb13b('0x119')](db['User'],{'as':_0xb13b('0x16e'),'foreignKey':_0xb13b('0x109')});db[_0xb13b('0x3b')][_0xb13b('0x11b')](db['Tag'],{'through':_0xb13b('0x16f'),'as':_0xb13b('0x170')});db['MailInteraction']['belongsToMany'](db['Tag'],{'through':'mail_interaction_has_tags','as':_0xb13b('0x171')});db[_0xb13b('0x3b')][_0xb13b('0x11b')](db[_0xb13b('0x106')],{'as':_0xb13b('0x172'),'through':'user_has_mail_interactions','foreignKey':_0xb13b('0x16b')});db[_0xb13b('0x3d')][_0xb13b('0x10a')](db[_0xb13b('0xe1')],{'as':'Attachments','onDelete':_0xb13b('0x108')});db[_0xb13b('0x3d')][_0xb13b('0x119')](db[_0xb13b('0x106')],{'as':_0xb13b('0x106')});db[_0xb13b('0x3d')][_0xb13b('0x119')](db[_0xb13b('0x66')],{'onDelete':_0xb13b('0x108'),'as':_0xb13b('0x16d')});db['MailMessage'][_0xb13b('0x119')](db[_0xb13b('0x3b')],{'as':'Interaction','foreignKey':_0xb13b('0x16b')});db[_0xb13b('0x3d')]['belongsTo'](db[_0xb13b('0x161')],{'as':'Account','foreignKey':_0xb13b('0x162')});db['MailApplication']['belongsTo'](db[_0xb13b('0x106')],{'onDelete':_0xb13b('0x173')});db[_0xb13b('0x3f')][_0xb13b('0x119')](db['MailQueue'],{'onDelete':_0xb13b('0x173')});db[_0xb13b('0x3f')][_0xb13b('0x119')](db[_0xb13b('0x161')],{'onDelete':'restrict'});db[_0xb13b('0x3f')]['belongsTo'](db[_0xb13b('0x152')],{'onDelete':_0xb13b('0x173'),'foreignKey':_0xb13b('0x153')});db[_0xb13b('0x3f')][_0xb13b('0x119')](db[_0xb13b('0x84')],{'onDelete':_0xb13b('0x173'),'foreignKey':_0xb13b('0x174')});db[_0xb13b('0x175')][_0xb13b('0x119')](db['MailAccount'],{});db[_0xb13b('0x175')]['belongsTo'](db[_0xb13b('0x11e')],{'as':_0xb13b('0x166'),'foreignKey':_0xb13b('0x167')});db[_0xb13b('0x175')][_0xb13b('0x119')](db['CmContact'],{'as':'Contact','foreignKey':_0xb13b('0x176')});db[_0xb13b('0x175')][_0xb13b('0x119')](db[_0xb13b('0x3b')],{});db[_0xb13b('0x175')][_0xb13b('0x119')](db[_0xb13b('0x3d')],{});db['MailQueueReport'][_0xb13b('0x119')](db['User'],{});db[_0xb13b('0x175')][_0xb13b('0x119')](db['MailQueue'],{});db['Dashboard'][_0xb13b('0x10a')](db[_0xb13b('0x42')],{'as':_0xb13b('0x177'),'onDelete':_0xb13b('0x108')});db['FaxAccount'][_0xb13b('0x10a')](db[_0xb13b('0x178')],{'as':_0xb13b('0x179'),'foreignKey':_0xb13b('0x17a')});db[_0xb13b('0x44')][_0xb13b('0x10a')](db[_0xb13b('0x75')],{'as':'Answers','foreignKey':_0xb13b('0x17a')});db[_0xb13b('0x44')][_0xb13b('0x10a')](db[_0xb13b('0x47')],{'as':_0xb13b('0x17b')});db[_0xb13b('0x44')][_0xb13b('0x10a')](db[_0xb13b('0x45')],{'as':_0xb13b('0x165')});db[_0xb13b('0x44')][_0xb13b('0x10a')](db[_0xb13b('0x17')],{'as':_0xb13b('0x17c'),'onDelete':'cascade'});db[_0xb13b('0x44')][_0xb13b('0x10a')](db[_0xb13b('0x17d')],{'as':_0xb13b('0x15a')});db[_0xb13b('0x44')][_0xb13b('0x119')](db['Trunk'],{'as':_0xb13b('0x28')});db[_0xb13b('0x44')][_0xb13b('0x119')](db[_0xb13b('0x11e')],{'as':'List','foreignKey':_0xb13b('0x167')});db[_0xb13b('0x44')][_0xb13b('0x119')](db['Pause'],{'as':_0xb13b('0x154'),'foreignKey':_0xb13b('0x169')});db['FaxAccount'][_0xb13b('0x11b')](db[_0xb13b('0x106')],{'as':'Agents','through':_0xb13b('0x139')});db[_0xb13b('0x45')][_0xb13b('0x119')](db[_0xb13b('0x106')],{'onDelete':_0xb13b('0x173')});db[_0xb13b('0x45')][_0xb13b('0x119')](db['FaxQueue'],{'onDelete':_0xb13b('0x173')});db[_0xb13b('0x45')]['belongsTo'](db[_0xb13b('0x44')],{'onDelete':_0xb13b('0x173')});db['FaxApplication'][_0xb13b('0x119')](db[_0xb13b('0x84')],{'onDelete':_0xb13b('0x173'),'foreignKey':'TagId'});db[_0xb13b('0x47')]['hasMany'](db['FaxMessage'],{'as':_0xb13b('0x15a'),'onDelete':'cascade','foreignKey':_0xb13b('0x17e')});db[_0xb13b('0x47')][_0xb13b('0x119')](db['FaxAccount'],{'as':_0xb13b('0x16c'),'foreignKey':'FaxAccountId'});db['FaxInteraction'][_0xb13b('0x119')](db['CmContact'],{'as':'Contact','foreignKey':_0xb13b('0x176')});db['FaxInteraction'][_0xb13b('0x119')](db['User'],{'as':_0xb13b('0x16e'),'foreignKey':_0xb13b('0x109')});db[_0xb13b('0x47')][_0xb13b('0x11b')](db[_0xb13b('0x84')],{'through':_0xb13b('0x17f'),'as':'Tags'});db[_0xb13b('0x47')]['belongsToMany'](db[_0xb13b('0x84')],{'through':_0xb13b('0x17f'),'as':_0xb13b('0x171')});db[_0xb13b('0x47')][_0xb13b('0x11b')](db['User'],{'as':_0xb13b('0x172'),'through':_0xb13b('0x125'),'foreignKey':'FaxInteractionId'});db[_0xb13b('0x17d')]['belongsTo'](db[_0xb13b('0x106')],{'onDelete':_0xb13b('0x108'),'as':_0xb13b('0x106')});db[_0xb13b('0x17d')][_0xb13b('0x119')](db[_0xb13b('0x47')],{'as':_0xb13b('0x180'),'foreignKey':'FaxInteractionId'});db[_0xb13b('0x17d')]['belongsTo'](db[_0xb13b('0x66')],{'onDelete':_0xb13b('0x108'),'as':_0xb13b('0x16d')});db['FaxMessage'][_0xb13b('0x119')](db['Attachment'],{'as':_0xb13b('0xe1'),'foreignKey':_0xb13b('0x181')});db[_0xb13b('0x17d')][_0xb13b('0x119')](db[_0xb13b('0x44')],{'as':_0xb13b('0x16c'),'foreignKey':_0xb13b('0x17a')});db['FaxQueue'][_0xb13b('0x11b')](db[_0xb13b('0x106')],{'as':_0xb13b('0x156'),'through':_0xb13b('0x30')});db[_0xb13b('0x12f')][_0xb13b('0x11b')](db[_0xb13b('0xda')],{'through':_0xb13b('0x182'),'as':_0xb13b('0x157')});db[_0xb13b('0x49')][_0xb13b('0x119')](db[_0xb13b('0x44')],{});db[_0xb13b('0x49')]['belongsTo'](db['CmList'],{'as':_0xb13b('0x166'),'foreignKey':_0xb13b('0x167')});db[_0xb13b('0x49')][_0xb13b('0x119')](db['CmContact'],{'as':_0xb13b('0x16d'),'foreignKey':_0xb13b('0x176')});db['FaxQueueReport'][_0xb13b('0x119')](db[_0xb13b('0x47')],{});db[_0xb13b('0x49')]['belongsTo'](db['FaxMessage'],{});db[_0xb13b('0x49')][_0xb13b('0x119')](db[_0xb13b('0x106')],{});db['FaxQueueReport'][_0xb13b('0x119')](db[_0xb13b('0x12f')],{});db[_0xb13b('0x4a')]['hasMany'](db[_0xb13b('0x178')],{'as':_0xb13b('0x179'),'foreignKey':_0xb13b('0x183')});db['SmsAccount'][_0xb13b('0x10a')](db[_0xb13b('0x75')],{'as':_0xb13b('0x164'),'foreignKey':_0xb13b('0x183')});db[_0xb13b('0x4a')][_0xb13b('0x10a')](db[_0xb13b('0x184')],{'as':_0xb13b('0x15a'),'foreignKey':_0xb13b('0x183')});db[_0xb13b('0x4a')][_0xb13b('0x10a')](db[_0xb13b('0x4c')],{'as':_0xb13b('0x17b')});db[_0xb13b('0x4a')][_0xb13b('0x10a')](db['SmsApplication'],{'as':_0xb13b('0x165')});db['SmsAccount']['belongsTo'](db[_0xb13b('0x11e')],{'as':_0xb13b('0x166'),'foreignKey':'ListId'});db['SmsAccount'][_0xb13b('0x119')](db[_0xb13b('0x7b')],{'as':_0xb13b('0x154'),'foreignKey':_0xb13b('0x169')});db[_0xb13b('0x4a')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xb13b('0x13f')});db['SmsApplication'][_0xb13b('0x119')](db[_0xb13b('0x106')],{'onDelete':_0xb13b('0x173')});db[_0xb13b('0x185')][_0xb13b('0x119')](db[_0xb13b('0x4f')],{'onDelete':_0xb13b('0x173')});db[_0xb13b('0x185')][_0xb13b('0x119')](db[_0xb13b('0x4a')],{'onDelete':_0xb13b('0x173')});db[_0xb13b('0x185')][_0xb13b('0x119')](db[_0xb13b('0x152')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['SmsApplication'][_0xb13b('0x119')](db[_0xb13b('0x84')],{'onDelete':_0xb13b('0x173'),'foreignKey':_0xb13b('0x174')});db[_0xb13b('0x4c')][_0xb13b('0x10a')](db[_0xb13b('0x184')],{'as':'Messages','onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x186')});db[_0xb13b('0x4c')]['belongsTo'](db['SmsAccount'],{'as':_0xb13b('0x16c'),'foreignKey':_0xb13b('0x183')});db[_0xb13b('0x4c')][_0xb13b('0x119')](db[_0xb13b('0x66')],{'as':_0xb13b('0x16d'),'foreignKey':'ContactId'});db['SmsInteraction'][_0xb13b('0x119')](db[_0xb13b('0x106')],{'as':_0xb13b('0x16e'),'foreignKey':_0xb13b('0x109')});db[_0xb13b('0x4c')][_0xb13b('0x11b')](db[_0xb13b('0x84')],{'through':_0xb13b('0x187'),'as':_0xb13b('0x170')});db[_0xb13b('0x4c')][_0xb13b('0x11b')](db['Tag'],{'through':_0xb13b('0x187'),'as':_0xb13b('0x171')});db['SmsInteraction'][_0xb13b('0x11b')](db[_0xb13b('0x106')],{'as':_0xb13b('0x172'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db[_0xb13b('0x184')][_0xb13b('0x119')](db['User'],{'as':_0xb13b('0x106')});db[_0xb13b('0x184')][_0xb13b('0x119')](db[_0xb13b('0x66')],{'onDelete':_0xb13b('0x108'),'as':_0xb13b('0x16d')});db[_0xb13b('0x184')][_0xb13b('0x119')](db['SmsInteraction'],{'onDelete':_0xb13b('0x108'),'as':'Interaction','foreignKey':_0xb13b('0x186')});db[_0xb13b('0x184')][_0xb13b('0x119')](db[_0xb13b('0x4a')],{'as':_0xb13b('0x16c'),'foreignKey':_0xb13b('0x183')});db[_0xb13b('0x4f')][_0xb13b('0x11b')](db[_0xb13b('0x106')],{'as':_0xb13b('0x156'),'through':_0xb13b('0x31'),'foreignKey':_0xb13b('0x188')});db[_0xb13b('0x4f')][_0xb13b('0x11b')](db['Team'],{'through':_0xb13b('0x189'),'as':_0xb13b('0x157')});db[_0xb13b('0x18a')][_0xb13b('0x10a')](db['Disposition'],{'as':_0xb13b('0x179'),'foreignKey':_0xb13b('0x18b')});db[_0xb13b('0x18a')][_0xb13b('0x10a')](db[_0xb13b('0x75')],{'as':_0xb13b('0x164'),'foreignKey':_0xb13b('0x18b')});db[_0xb13b('0x18a')][_0xb13b('0x10a')](db[_0xb13b('0x110')],{'as':_0xb13b('0x17b'),'foreignKey':_0xb13b('0x18b')});db[_0xb13b('0x18a')][_0xb13b('0x10a')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0xb13b('0x18b')});db[_0xb13b('0x18a')][_0xb13b('0x10a')](db[_0xb13b('0x51')],{'as':_0xb13b('0x165'),'foreignKey':_0xb13b('0x18b')});db[_0xb13b('0x18a')][_0xb13b('0x119')](db[_0xb13b('0x11e')],{'as':_0xb13b('0x166'),'foreignKey':_0xb13b('0x167')});db[_0xb13b('0x18a')][_0xb13b('0x119')](db[_0xb13b('0x7b')],{'as':_0xb13b('0x154'),'foreignKey':_0xb13b('0x169')});db[_0xb13b('0x18a')][_0xb13b('0x11b')](db['User'],{'as':_0xb13b('0x156'),'through':_0xb13b('0x13d')});db[_0xb13b('0x51')][_0xb13b('0x119')](db[_0xb13b('0x106')],{'onDelete':_0xb13b('0x173')});db[_0xb13b('0x51')][_0xb13b('0x119')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0xb13b('0x18c')});db[_0xb13b('0x51')][_0xb13b('0x119')](db[_0xb13b('0x18a')],{'onDelete':_0xb13b('0x173'),'foreignKey':_0xb13b('0x18b')});db['OpenchannelApplication'][_0xb13b('0x119')](db[_0xb13b('0x152')],{'onDelete':_0xb13b('0x173'),'foreignKey':_0xb13b('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0xb13b('0x84')],{'onDelete':_0xb13b('0x173'),'foreignKey':_0xb13b('0x174')});db[_0xb13b('0x110')][_0xb13b('0x10a')](db[_0xb13b('0x54')],{'as':'Messages','onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x18d')});db['OpenchannelInteraction'][_0xb13b('0x119')](db[_0xb13b('0x18a')],{'as':'Account','foreignKey':_0xb13b('0x18b')});db[_0xb13b('0x110')][_0xb13b('0x119')](db['CmContact'],{'as':_0xb13b('0x16d'),'foreignKey':_0xb13b('0x176')});db['OpenchannelInteraction']['belongsTo'](db[_0xb13b('0x106')],{'as':_0xb13b('0x16e'),'foreignKey':_0xb13b('0x109')});db['OpenchannelInteraction'][_0xb13b('0x11b')](db[_0xb13b('0x84')],{'through':'openchannel_interaction_has_tags','as':_0xb13b('0x170')});db['OpenchannelInteraction']['belongsToMany'](db['Tag'],{'through':_0xb13b('0x18e'),'as':_0xb13b('0x171')});db[_0xb13b('0x110')]['belongsToMany'](db[_0xb13b('0x106')],{'as':'Users','through':_0xb13b('0x127'),'foreignKey':_0xb13b('0x18d')});db[_0xb13b('0x54')][_0xb13b('0x119')](db[_0xb13b('0x106')],{'onDelete':_0xb13b('0x108'),'as':'User'});db[_0xb13b('0x54')][_0xb13b('0x119')](db[_0xb13b('0x66')],{'onDelete':_0xb13b('0x108'),'as':'Contact'});db[_0xb13b('0x54')][_0xb13b('0x119')](db[_0xb13b('0x110')],{'onDelete':'cascade','as':_0xb13b('0x180'),'foreignKey':_0xb13b('0x18d')});db[_0xb13b('0x54')][_0xb13b('0x119')](db[_0xb13b('0xe1')],{'as':_0xb13b('0xe1'),'foreignKey':'AttachmentId'});db[_0xb13b('0x54')][_0xb13b('0x119')](db[_0xb13b('0x18a')],{'as':'Account','foreignKey':_0xb13b('0x18b')});db[_0xb13b('0x56')][_0xb13b('0x11b')](db[_0xb13b('0x106')],{'as':_0xb13b('0x156'),'through':_0xb13b('0x32'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue']['belongsToMany'](db[_0xb13b('0xda')],{'through':'team_has_openchannel_queues','as':_0xb13b('0x157')});db[_0xb13b('0x135')]['hasMany'](db[_0xb13b('0x178')],{'as':_0xb13b('0x179'),'foreignKey':_0xb13b('0x18f')});db[_0xb13b('0x135')][_0xb13b('0x10a')](db[_0xb13b('0x75')],{'as':'Answers','foreignKey':_0xb13b('0x18f')});db[_0xb13b('0x135')][_0xb13b('0x10a')](db[_0xb13b('0x62')],{'as':_0xb13b('0x190')});db[_0xb13b('0x135')][_0xb13b('0x10a')](db[_0xb13b('0x5b')],{'as':_0xb13b('0x17b')});db['ChatWebsite']['hasMany'](db[_0xb13b('0x59')],{'as':'Applications'});db['ChatWebsite'][_0xb13b('0x10a')](db[_0xb13b('0x191')],{'as':_0xb13b('0x15a')});db[_0xb13b('0x135')][_0xb13b('0x119')](db[_0xb13b('0x11e')],{'as':_0xb13b('0x166'),'foreignKey':_0xb13b('0x167')});db[_0xb13b('0x135')][_0xb13b('0x119')](db['Interval'],{'as':_0xb13b('0x152'),'foreignKey':_0xb13b('0x153')});db[_0xb13b('0x135')][_0xb13b('0x119')](db[_0xb13b('0x7b')],{'as':_0xb13b('0x154'),'foreignKey':_0xb13b('0x169')});db[_0xb13b('0x135')][_0xb13b('0x11b')](db['User'],{'as':_0xb13b('0x156'),'through':_0xb13b('0x137')});db[_0xb13b('0x58')][_0xb13b('0x119')](db[_0xb13b('0x18a')],{});db[_0xb13b('0x58')][_0xb13b('0x119')](db[_0xb13b('0x11e')],{'as':_0xb13b('0x166'),'foreignKey':_0xb13b('0x167')});db['OpenchannelQueueReport'][_0xb13b('0x119')](db[_0xb13b('0x66')],{'as':_0xb13b('0x16d'),'foreignKey':_0xb13b('0x176')});db[_0xb13b('0x58')][_0xb13b('0x119')](db[_0xb13b('0x110')],{});db['OpenchannelQueueReport'][_0xb13b('0x119')](db[_0xb13b('0x54')],{});db[_0xb13b('0x58')][_0xb13b('0x119')](db[_0xb13b('0x106')],{});db[_0xb13b('0x58')][_0xb13b('0x119')](db[_0xb13b('0x56')],{});db[_0xb13b('0x59')][_0xb13b('0x119')](db['User'],{'as':'Agent','foreignKey':_0xb13b('0x109'),'onDelete':_0xb13b('0x173')});db[_0xb13b('0x59')][_0xb13b('0x119')](db[_0xb13b('0x5f')],{'as':_0xb13b('0x192'),'foreignKey':_0xb13b('0x193'),'onDelete':_0xb13b('0x173')});db[_0xb13b('0x59')]['belongsTo'](db[_0xb13b('0x135')],{'as':_0xb13b('0x194'),'foreignKey':_0xb13b('0x18f'),'onDelete':_0xb13b('0x173')});db['ChatApplication'][_0xb13b('0x119')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xb13b('0x174')});db[_0xb13b('0x5b')][_0xb13b('0x10a')](db[_0xb13b('0x191')],{'as':_0xb13b('0x15a'),'onDelete':'cascade','foreignKey':_0xb13b('0x195')});db[_0xb13b('0x5b')][_0xb13b('0x119')](db[_0xb13b('0x135')],{'as':'Account','foreignKey':_0xb13b('0x18f')});db[_0xb13b('0x5b')][_0xb13b('0x119')](db[_0xb13b('0x66')],{'as':_0xb13b('0x16d'),'foreignKey':_0xb13b('0x176')});db['ChatInteraction'][_0xb13b('0x119')](db[_0xb13b('0x106')],{'as':_0xb13b('0x16e'),'foreignKey':_0xb13b('0x109')});db[_0xb13b('0x5b')][_0xb13b('0x11b')](db[_0xb13b('0x84')],{'through':'chat_interaction_has_tags','as':'Tags'});db[_0xb13b('0x5b')][_0xb13b('0x11b')](db[_0xb13b('0x84')],{'through':'chat_interaction_has_tags','as':_0xb13b('0x171')});db[_0xb13b('0x5b')][_0xb13b('0x11b')](db[_0xb13b('0x106')],{'as':_0xb13b('0x172'),'through':_0xb13b('0x124'),'foreignKey':_0xb13b('0x195')});db['ChatMessage']['belongsTo'](db[_0xb13b('0x106')],{'onDelete':_0xb13b('0x108'),'as':_0xb13b('0x106')});db[_0xb13b('0x191')][_0xb13b('0x119')](db[_0xb13b('0x66')],{'onDelete':_0xb13b('0x108'),'as':_0xb13b('0x16d'),'foreignKey':'ContactId'});db['ChatMessage']['belongsTo'](db['ChatInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xb13b('0x195')});db[_0xb13b('0x191')][_0xb13b('0x119')](db[_0xb13b('0xe1')],{'as':_0xb13b('0xe1'),'foreignKey':_0xb13b('0x181')});db[_0xb13b('0x191')][_0xb13b('0x119')](db[_0xb13b('0x135')],{'as':_0xb13b('0x16c'),'foreignKey':_0xb13b('0x18f')});db[_0xb13b('0x5d')][_0xb13b('0x119')](db[_0xb13b('0x66')],{'onDelete':_0xb13b('0x108'),'as':_0xb13b('0x16d'),'foreignKey':_0xb13b('0x176')});db[_0xb13b('0x5d')][_0xb13b('0x119')](db[_0xb13b('0x135')],{'as':'Account','foreignKey':_0xb13b('0x18f')});db[_0xb13b('0x5f')][_0xb13b('0x11b')](db[_0xb13b('0x106')],{'as':'Agents','through':_0xb13b('0x12e'),'hooks':!![]});db[_0xb13b('0x5f')][_0xb13b('0x11b')](db[_0xb13b('0xda')],{'through':_0xb13b('0x196'),'as':'Teams'});db[_0xb13b('0x60')][_0xb13b('0x10a')](db['ChatInternalMessage'],{'as':'Messages','foreignKey':_0xb13b('0x197'),'onDelete':_0xb13b('0x108')});db[_0xb13b('0x60')]['belongsToMany'](db[_0xb13b('0x106')],{'as':_0xb13b('0x148'),'through':_0xb13b('0x198')});db[_0xb13b('0x62')][_0xb13b('0x119')](db['ChatWebsite'],{'as':_0xb13b('0x194'),'foreignKey':_0xb13b('0x18f')});db[_0xb13b('0x64')][_0xb13b('0x10a')](db[_0xb13b('0x66')],{'as':'Contacts','foreignKey':_0xb13b('0x199')});db[_0xb13b('0x66')][_0xb13b('0x10a')](db[_0xb13b('0x68')],{'as':_0xb13b('0x14a'),'foreignKey':_0xb13b('0x176')});db[_0xb13b('0x66')][_0xb13b('0x10a')](db[_0xb13b('0x6a')],{'as':_0xb13b('0x10d'),'foreignKey':_0xb13b('0x176')});db[_0xb13b('0x66')][_0xb13b('0x10a')](db[_0xb13b('0x6c')],{'as':'HopperHistories','foreignKey':_0xb13b('0x176')});db[_0xb13b('0x66')][_0xb13b('0x10a')](db['ReportAgentPreview'],{'as':_0xb13b('0x10f'),'foreignKey':'ContactId'});db[_0xb13b('0x66')][_0xb13b('0x10a')](db[_0xb13b('0x19a')],{'as':_0xb13b('0x14e'),'foreignKey':'ContactId'});db['CmContact'][_0xb13b('0x10a')](db[_0xb13b('0x110')],{'as':_0xb13b('0x111'),'foreignKey':_0xb13b('0x176'),'onDelete':_0xb13b('0x173')});db[_0xb13b('0x66')][_0xb13b('0x10a')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0xb13b('0x176'),'onDelete':'restrict'});db[_0xb13b('0x66')]['hasMany'](db['SmsInteraction'],{'as':_0xb13b('0x113'),'foreignKey':_0xb13b('0x176'),'onDelete':'restrict'});db[_0xb13b('0x66')][_0xb13b('0x10a')](db['FaxInteraction'],{'as':_0xb13b('0x19b'),'foreignKey':_0xb13b('0x176'),'onDelete':'restrict'});db[_0xb13b('0x66')]['hasMany'](db['MailInteraction'],{'as':_0xb13b('0x122'),'foreignKey':_0xb13b('0x176'),'onDelete':_0xb13b('0x173')});db[_0xb13b('0x66')][_0xb13b('0x119')](db[_0xb13b('0x64')],{'as':_0xb13b('0x19c'),'foreignKey':'CompanyId'});db[_0xb13b('0x66')][_0xb13b('0x119')](db['CmList'],{'as':_0xb13b('0x166'),'foreignKey':_0xb13b('0x167'),'onDelete':_0xb13b('0x108')});db[_0xb13b('0x66')]['belongsToMany'](db[_0xb13b('0x106')],{'as':'Users','through':_0xb13b('0x19d')});db[_0xb13b('0x66')][_0xb13b('0x11b')](db[_0xb13b('0x84')],{'as':_0xb13b('0x170'),'through':_0xb13b('0x19e')});db[_0xb13b('0x66')][_0xb13b('0x11b')](db[_0xb13b('0x84')],{'through':_0xb13b('0x19e'),'as':_0xb13b('0x171')});db['CmHopper'][_0xb13b('0x119')](db[_0xb13b('0x66')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0xb13b('0x108')});db[_0xb13b('0x68')][_0xb13b('0x119')](db[_0xb13b('0x11e')],{'as':_0xb13b('0x166'),'foreignKey':'ListId','onDelete':_0xb13b('0x108')});db['CmHopper']['belongsTo'](db[_0xb13b('0x106')],{'as':_0xb13b('0x19f'),'foreignKey':'UserId'});db[_0xb13b('0x68')][_0xb13b('0x119')](db[_0xb13b('0x129')],{'as':_0xb13b('0x192'),'foreignKey':'VoiceQueueId','onDelete':_0xb13b('0x108')});db[_0xb13b('0x68')][_0xb13b('0x119')](db[_0xb13b('0xdd')],{'as':'Campaign','foreignKey':_0xb13b('0x1a0'),'onDelete':_0xb13b('0x108')});db[_0xb13b('0x68')][_0xb13b('0x119')](db[_0xb13b('0x106')],{'as':_0xb13b('0x16e'),'foreignKey':_0xb13b('0x1a1')});db['CmHopperBlack'][_0xb13b('0x119')](db[_0xb13b('0x66')],{'as':_0xb13b('0x16d'),'foreignKey':'ContactId','onDelete':'cascade'});db[_0xb13b('0x14c')]['belongsTo'](db['CmList'],{'as':_0xb13b('0x166'),'foreignKey':_0xb13b('0x167'),'onDelete':'cascade'});db['CmHopperBlack'][_0xb13b('0x119')](db[_0xb13b('0x129')],{'as':_0xb13b('0x192'),'foreignKey':_0xb13b('0x149'),'onDelete':'cascade'});db[_0xb13b('0x14c')][_0xb13b('0x119')](db[_0xb13b('0xdd')],{'as':_0xb13b('0xdd'),'foreignKey':_0xb13b('0x1a0'),'onDelete':_0xb13b('0x108')});db[_0xb13b('0x73')]['hasMany'](db[_0xb13b('0x78')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0xb13b('0x1a2'),'onDelete':_0xb13b('0x108'),'hooks':!![]});db[_0xb13b('0x73')]['hasMany'](db[_0xb13b('0x78')],{'as':{'plural':_0xb13b('0x1a3'),'singular':_0xb13b('0x1a4')},'foreignKey':_0xb13b('0x1a5'),'onDelete':_0xb13b('0x108'),'hooks':!![]});db[_0xb13b('0x73')][_0xb13b('0x10a')](db[_0xb13b('0x71')],{'as':_0xb13b('0x1a6'),'foreignKey':_0xb13b('0x1a7'),'onDelete':_0xb13b('0x108'),'hooks':!![]});db['Disposition']['hasMany'](db[_0xb13b('0x178')],{'as':'Dispositions','foreignKey':_0xb13b('0x1a8'),'onDelete':_0xb13b('0x108')});db[_0xb13b('0x152')][_0xb13b('0x10a')](db[_0xb13b('0x152')],{'as':_0xb13b('0x1a9'),'foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db[_0xb13b('0x152')][_0xb13b('0x10a')](db[_0xb13b('0x17')],{'as':_0xb13b('0x1aa'),'foreignKey':_0xb13b('0x153'),'onDelete':'restrict'});db[_0xb13b('0x152')]['hasMany'](db[_0xb13b('0x3f')],{'as':_0xb13b('0x1ab'),'foreignKey':_0xb13b('0x153')});db['Interval'][_0xb13b('0x10a')](db['ChatApplication'],{'as':'ChatApplications','foreignKey':_0xb13b('0x153')});db[_0xb13b('0x152')][_0xb13b('0x10a')](db['FaxApplication'],{'as':'FaxApplications','foreignKey':'IntervalId'});db['Interval'][_0xb13b('0x10a')](db[_0xb13b('0x185')],{'as':_0xb13b('0x1ac'),'foreignKey':_0xb13b('0x153')});db['Schedule'][_0xb13b('0x119')](db[_0xb13b('0x161')],{});db['Schedule'][_0xb13b('0x119')](db[_0xb13b('0x92')],{'foreignKey':_0xb13b('0x1ad')});db['Schedule']['belongsTo'](db[_0xb13b('0x90')],{'foreignKey':_0xb13b('0x1ae')});db[_0xb13b('0x82')][_0xb13b('0x11b')](db[_0xb13b('0x18')],{'as':'Mohs','through':'moh_has_sounds','onDelete':_0xb13b('0x173')});db[_0xb13b('0x84')][_0xb13b('0x11b')](db[_0xb13b('0x66')],{'through':_0xb13b('0x19e')});db[_0xb13b('0x84')][_0xb13b('0x11b')](db['ChatInteraction'],{'through':_0xb13b('0x1af')});db[_0xb13b('0x84')][_0xb13b('0x11b')](db['MailInteraction'],{'through':_0xb13b('0x16f')});db[_0xb13b('0x84')][_0xb13b('0x11b')](db['SmsInteraction'],{'through':_0xb13b('0x187')});db['Tag'][_0xb13b('0x11b')](db[_0xb13b('0x47')],{'through':_0xb13b('0x17f')});db[_0xb13b('0x84')][_0xb13b('0x11b')](db['OpenchannelInteraction'],{'through':_0xb13b('0x18e')});db[_0xb13b('0x84')][_0xb13b('0x11b')](db[_0xb13b('0xfa')],{'through':_0xb13b('0x1b0')});db[_0xb13b('0x88')]['hasMany'](db[_0xb13b('0x78')],{'as':{'plural':'AllConditions','singular':_0xb13b('0x1b1')},'foreignKey':_0xb13b('0x1b2'),'onDelete':_0xb13b('0x108'),'hooks':!![]});db[_0xb13b('0x88')][_0xb13b('0x10a')](db[_0xb13b('0x78')],{'as':{'plural':_0xb13b('0x1b3'),'singular':_0xb13b('0x1b4')},'foreignKey':_0xb13b('0x1b5'),'onDelete':'cascade','hooks':!![]});db[_0xb13b('0x88')]['hasMany'](db['Action'],{'as':_0xb13b('0x1a6'),'foreignKey':_0xb13b('0x1b6'),'onDelete':_0xb13b('0x108'),'hooks':!![]});db['AnalyticCustomReport'][_0xb13b('0x10a')](db['AnalyticFieldReport'],{'as':_0xb13b('0x1b7'),'onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x1ae'),'hooks':!![]});db[_0xb13b('0x92')][_0xb13b('0x10a')](db[_0xb13b('0x96')],{'as':_0xb13b('0x1b7'),'onDelete':'cascade','foreignKey':_0xb13b('0x1ad')});db[_0xb13b('0x1b8')][_0xb13b('0x10a')](db[_0xb13b('0x96')],{'as':_0xb13b('0x1b7'),'onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x1b9')});db['AnalyticFieldReport'][_0xb13b('0x119')](db[_0xb13b('0x1b8')],{'foreignKey':_0xb13b('0x1b9')});db['SalesforceAccount']['hasMany'](db[_0xb13b('0x9b')],{'as':_0xb13b('0x1ba'),'onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x1bb')});db[_0xb13b('0x9b')][_0xb13b('0x10a')](db[_0xb13b('0x1bc')],{'as':_0xb13b('0x1bd'),'onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x1be')});db[_0xb13b('0x9b')][_0xb13b('0x10a')](db[_0xb13b('0x1bc')],{'as':_0xb13b('0x1bf'),'onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x1c0')});db[_0xb13b('0x9b')][_0xb13b('0x10a')](db[_0xb13b('0x1bc')],{'as':_0xb13b('0x1b7'),'onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x1c1')});db[_0xb13b('0x9b')][_0xb13b('0x119')](db[_0xb13b('0x1c2')],{'as':_0xb13b('0x16c'),'foreignKey':_0xb13b('0x1bb')});db['SalesforceField'][_0xb13b('0x10a')](db['SalesforceField'],{'as':_0xb13b('0x1c3'),'foreignKey':_0xb13b('0x1be')});db[_0xb13b('0x1bc')][_0xb13b('0x10a')](db[_0xb13b('0x1bc')],{'as':_0xb13b('0x1c4'),'foreignKey':_0xb13b('0x1c0')});db[_0xb13b('0x1bc')]['hasMany'](db['SalesforceField'],{'as':_0xb13b('0x1c5'),'foreignKey':'FieldId'});db[_0xb13b('0x1bc')][_0xb13b('0x119')](db[_0xb13b('0x8a')],{'as':_0xb13b('0x8a'),'foreignKey':'VariableId'});db[_0xb13b('0x9c')][_0xb13b('0x10a')](db[_0xb13b('0x9e')],{'as':_0xb13b('0x1ba'),'onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x1bb')});db[_0xb13b('0x9e')]['hasMany'](db[_0xb13b('0xa0')],{'as':_0xb13b('0x1bd'),'onDelete':'cascade','foreignKey':_0xb13b('0x1be')});db[_0xb13b('0x9e')][_0xb13b('0x10a')](db[_0xb13b('0xa0')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xb13b('0x1c0')});db[_0xb13b('0x9e')][_0xb13b('0x10a')](db['SugarcrmField'],{'as':_0xb13b('0x1b7'),'onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x1c1')});db[_0xb13b('0x9e')][_0xb13b('0x119')](db[_0xb13b('0x9c')],{'as':_0xb13b('0x16c'),'foreignKey':_0xb13b('0x1bb')});db['SugarcrmField'][_0xb13b('0x10a')](db[_0xb13b('0xa0')],{'as':_0xb13b('0x1c3'),'foreignKey':'SubjectId'});db[_0xb13b('0xa0')][_0xb13b('0x10a')](db[_0xb13b('0xa0')],{'as':_0xb13b('0x1c4'),'foreignKey':_0xb13b('0x1c0')});db[_0xb13b('0xa0')][_0xb13b('0x10a')](db[_0xb13b('0xa0')],{'as':_0xb13b('0x1c5'),'foreignKey':_0xb13b('0x1c1')});db[_0xb13b('0xa0')][_0xb13b('0x119')](db['Variable'],{'as':_0xb13b('0x8a'),'foreignKey':_0xb13b('0x1c6')});db[_0xb13b('0xa2')]['hasMany'](db[_0xb13b('0x1c7')],{'as':_0xb13b('0x1ba'),'onDelete':'cascade','foreignKey':_0xb13b('0x1bb')});db[_0xb13b('0x1c7')][_0xb13b('0x10a')](db['DeskField'],{'as':_0xb13b('0x1bd'),'onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x1be')});db[_0xb13b('0x1c7')]['hasMany'](db[_0xb13b('0xa5')],{'as':_0xb13b('0x1bf'),'onDelete':'cascade','foreignKey':_0xb13b('0x1c0')});db['DeskConfiguration'][_0xb13b('0x10a')](db[_0xb13b('0xa5')],{'as':'Fields','onDelete':_0xb13b('0x108'),'foreignKey':'FieldId'});db[_0xb13b('0x1c7')]['belongsTo'](db[_0xb13b('0xa2')],{'as':_0xb13b('0x16c'),'foreignKey':_0xb13b('0x1bb')});db[_0xb13b('0x1c7')]['belongsToMany'](db[_0xb13b('0x84')],{'through':_0xb13b('0x1c8')});db[_0xb13b('0xa5')][_0xb13b('0x10a')](db[_0xb13b('0xa5')],{'as':_0xb13b('0x1c3'),'foreignKey':_0xb13b('0x1be')});db['DeskField']['hasMany'](db[_0xb13b('0xa5')],{'as':'Description','foreignKey':_0xb13b('0x1c0')});db[_0xb13b('0xa5')][_0xb13b('0x10a')](db['DeskField'],{'as':_0xb13b('0x1c5'),'foreignKey':_0xb13b('0x1c1')});db[_0xb13b('0xa5')][_0xb13b('0x119')](db[_0xb13b('0x8a')],{'as':_0xb13b('0x8a'),'foreignKey':_0xb13b('0x1c6')});db[_0xb13b('0xa7')]['hasMany'](db['ZohoConfiguration'],{'as':_0xb13b('0x1ba'),'onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x1bb')});db[_0xb13b('0x1c9')]['hasMany'](db[_0xb13b('0xaa')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xb13b('0x1be')});db[_0xb13b('0x1c9')][_0xb13b('0x10a')](db[_0xb13b('0xaa')],{'as':'Descriptions','onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x1c0')});db[_0xb13b('0x1c9')][_0xb13b('0x10a')](db[_0xb13b('0xaa')],{'as':_0xb13b('0x1b7'),'onDelete':'cascade','foreignKey':_0xb13b('0x1c1')});db[_0xb13b('0x1c9')][_0xb13b('0x119')](db[_0xb13b('0xa7')],{'as':_0xb13b('0x16c'),'foreignKey':_0xb13b('0x1bb')});db['ZohoField'][_0xb13b('0x10a')](db[_0xb13b('0xaa')],{'as':_0xb13b('0x1c3'),'foreignKey':_0xb13b('0x1be')});db[_0xb13b('0xaa')]['hasMany'](db[_0xb13b('0xaa')],{'as':_0xb13b('0x1c4'),'foreignKey':_0xb13b('0x1c0')});db[_0xb13b('0xaa')][_0xb13b('0x10a')](db[_0xb13b('0xaa')],{'as':_0xb13b('0x1c5'),'foreignKey':_0xb13b('0x1c1')});db[_0xb13b('0xaa')][_0xb13b('0x119')](db[_0xb13b('0x8a')],{'as':_0xb13b('0x8a'),'foreignKey':'VariableId'});db[_0xb13b('0x1ca')]['hasMany'](db[_0xb13b('0xad')],{'as':'Configurations','onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x1bb')});db[_0xb13b('0xad')]['hasMany'](db['ZendeskField'],{'as':'Subjects','foreignKey':_0xb13b('0x1be')});db['ZendeskConfiguration'][_0xb13b('0x10a')](db[_0xb13b('0xaf')],{'as':_0xb13b('0x1bf'),'foreignKey':'DescriptionId'});db[_0xb13b('0xad')][_0xb13b('0x10a')](db[_0xb13b('0xaf')],{'as':_0xb13b('0x1b7'),'foreignKey':_0xb13b('0x1c1')});db[_0xb13b('0xad')][_0xb13b('0x119')](db['ZendeskAccount'],{'as':_0xb13b('0x16c'),'foreignKey':_0xb13b('0x1bb')});db[_0xb13b('0xad')][_0xb13b('0x11b')](db['Tag'],{'through':_0xb13b('0x1cb')});db[_0xb13b('0xaf')][_0xb13b('0x10a')](db[_0xb13b('0xaf')],{'as':'Subject','foreignKey':'SubjectId'});db['ZendeskField']['hasMany'](db[_0xb13b('0xaf')],{'as':_0xb13b('0x1c4'),'foreignKey':_0xb13b('0x1c0')});db['ZendeskField'][_0xb13b('0x10a')](db[_0xb13b('0xaf')],{'as':_0xb13b('0x1c5'),'foreignKey':'FieldId'});db[_0xb13b('0xaf')]['belongsTo'](db[_0xb13b('0x8a')],{'as':_0xb13b('0x8a'),'foreignKey':_0xb13b('0x1c6')});db[_0xb13b('0xb1')][_0xb13b('0x10a')](db[_0xb13b('0x1cc')],{'as':'Configurations','onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x1bb')});db[_0xb13b('0x1cc')][_0xb13b('0x10a')](db[_0xb13b('0x1cd')],{'as':_0xb13b('0x1bd'),'onDelete':_0xb13b('0x108'),'foreignKey':'SubjectId'});db[_0xb13b('0x1cc')][_0xb13b('0x10a')](db['FreshdeskField'],{'as':_0xb13b('0x1bf'),'onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x1c0')});db[_0xb13b('0x1cc')][_0xb13b('0x10a')](db[_0xb13b('0x1cd')],{'as':_0xb13b('0x1b7'),'onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x1c1')});db[_0xb13b('0x1cc')][_0xb13b('0x119')](db[_0xb13b('0xb1')],{'as':_0xb13b('0x16c'),'foreignKey':_0xb13b('0x1bb')});db['FreshdeskConfiguration']['belongsToMany'](db[_0xb13b('0x84')],{'through':_0xb13b('0x1ce')});db[_0xb13b('0x1cd')][_0xb13b('0x10a')](db['FreshdeskField'],{'as':_0xb13b('0x1c3'),'foreignKey':'SubjectId'});db[_0xb13b('0x1cd')][_0xb13b('0x10a')](db['FreshdeskField'],{'as':_0xb13b('0x1c4'),'foreignKey':'DescriptionId'});db['FreshdeskField'][_0xb13b('0x10a')](db[_0xb13b('0x1cd')],{'as':'Field','foreignKey':'FieldId'});db[_0xb13b('0x1cd')][_0xb13b('0x119')](db[_0xb13b('0x8a')],{'as':_0xb13b('0x8a'),'foreignKey':_0xb13b('0x1c6')});db[_0xb13b('0xb4')][_0xb13b('0x10a')](db[_0xb13b('0x1cf')],{'as':_0xb13b('0x1ba'),'onDelete':'cascade','foreignKey':_0xb13b('0x1bb')});db[_0xb13b('0x1cf')][_0xb13b('0x10a')](db[_0xb13b('0xb6')],{'as':_0xb13b('0x1bd'),'foreignKey':_0xb13b('0x1be')});db[_0xb13b('0x1cf')]['hasMany'](db[_0xb13b('0xb6')],{'as':_0xb13b('0x1bf'),'foreignKey':'DescriptionId'});db[_0xb13b('0x1cf')]['hasMany'](db['VtigerField'],{'as':_0xb13b('0x1b7'),'foreignKey':'FieldId'});db[_0xb13b('0x1cf')][_0xb13b('0x119')](db['VtigerAccount'],{'as':_0xb13b('0x16c'),'foreignKey':_0xb13b('0x1bb')});db[_0xb13b('0xb6')]['hasMany'](db[_0xb13b('0xb6')],{'as':_0xb13b('0x1c3'),'foreignKey':'SubjectId'});db[_0xb13b('0xb6')][_0xb13b('0x10a')](db[_0xb13b('0xb6')],{'as':_0xb13b('0x1c4'),'foreignKey':_0xb13b('0x1c0')});db[_0xb13b('0xb6')]['hasMany'](db['VtigerField'],{'as':_0xb13b('0x1c5'),'foreignKey':_0xb13b('0x1c1')});db[_0xb13b('0xb6')][_0xb13b('0x119')](db['Variable'],{'as':_0xb13b('0x8a'),'foreignKey':_0xb13b('0x1c6')});db['ServicenowAccount'][_0xb13b('0x10a')](db[_0xb13b('0x1d0')],{'as':_0xb13b('0x1ba'),'onDelete':_0xb13b('0x108'),'foreignKey':'AccountId'});db[_0xb13b('0x1d0')]['hasMany'](db[_0xb13b('0x1d1')],{'as':_0xb13b('0x1bd'),'foreignKey':_0xb13b('0x1be')});db['ServicenowConfiguration'][_0xb13b('0x10a')](db[_0xb13b('0x1d1')],{'as':_0xb13b('0x1bf'),'foreignKey':_0xb13b('0x1c0')});db[_0xb13b('0x1d0')][_0xb13b('0x10a')](db[_0xb13b('0x1d1')],{'as':_0xb13b('0x1b7'),'foreignKey':_0xb13b('0x1c1')});db[_0xb13b('0x1d0')][_0xb13b('0x119')](db[_0xb13b('0xb8')],{'as':_0xb13b('0x16c'),'foreignKey':'AccountId'});db[_0xb13b('0x1d1')][_0xb13b('0x10a')](db[_0xb13b('0x1d1')],{'as':_0xb13b('0x1c3'),'foreignKey':_0xb13b('0x1be')});db[_0xb13b('0x1d1')]['hasMany'](db[_0xb13b('0x1d1')],{'as':_0xb13b('0x1c4'),'foreignKey':_0xb13b('0x1c0')});db[_0xb13b('0x1d1')]['hasMany'](db[_0xb13b('0x1d1')],{'as':_0xb13b('0x1c5'),'foreignKey':_0xb13b('0x1c1')});db[_0xb13b('0x1d1')][_0xb13b('0x119')](db[_0xb13b('0x8a')],{'as':_0xb13b('0x8a'),'foreignKey':_0xb13b('0x1c6')});db[_0xb13b('0xbb')]['hasMany'](db[_0xb13b('0xbd')],{'as':_0xb13b('0x1ba'),'onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x1bb')});db[_0xb13b('0xbd')][_0xb13b('0x10a')](db[_0xb13b('0x1d2')],{'as':_0xb13b('0x1bd'),'onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x1be')});db['Dynamics365Configuration'][_0xb13b('0x10a')](db[_0xb13b('0x1d2')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xb13b('0x1c0')});db['Dynamics365Configuration'][_0xb13b('0x10a')](db[_0xb13b('0x1d2')],{'as':_0xb13b('0x1b7'),'onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x1c1')});db[_0xb13b('0xbd')]['belongsTo'](db['Dynamics365Account'],{'as':_0xb13b('0x16c'),'foreignKey':_0xb13b('0x1bb')});db[_0xb13b('0x1d2')]['hasMany'](db[_0xb13b('0x1d2')],{'as':_0xb13b('0x1c3'),'foreignKey':_0xb13b('0x1be')});db[_0xb13b('0x1d2')][_0xb13b('0x10a')](db['Dynamics365Field'],{'as':_0xb13b('0x1c4'),'foreignKey':_0xb13b('0x1c0')});db[_0xb13b('0x1d2')][_0xb13b('0x10a')](db[_0xb13b('0x1d2')],{'as':_0xb13b('0x1c5'),'foreignKey':_0xb13b('0x1c1')});db['Dynamics365Field'][_0xb13b('0x119')](db['Variable'],{'as':_0xb13b('0x8a'),'foreignKey':'VariableId'});db[_0xb13b('0x1d3')][_0xb13b('0x10a')](db[_0xb13b('0xc1')],{'as':_0xb13b('0x1ba'),'onDelete':_0xb13b('0x108'),'foreignKey':'AccountId'});db['FreshsalesConfiguration']['hasMany'](db[_0xb13b('0x1d4')],{'as':_0xb13b('0x1bd'),'foreignKey':_0xb13b('0x1be')});db['FreshsalesConfiguration'][_0xb13b('0x10a')](db[_0xb13b('0x1d4')],{'as':_0xb13b('0x1bf'),'foreignKey':'DescriptionId'});db[_0xb13b('0xc1')][_0xb13b('0x10a')](db[_0xb13b('0x1d4')],{'as':_0xb13b('0x1b7'),'foreignKey':_0xb13b('0x1c1')});db[_0xb13b('0xc1')][_0xb13b('0x119')](db[_0xb13b('0x1d3')],{'as':_0xb13b('0x16c'),'foreignKey':'AccountId'});db[_0xb13b('0x1d4')][_0xb13b('0x10a')](db['FreshsalesField'],{'as':_0xb13b('0x1c3'),'foreignKey':_0xb13b('0x1be')});db[_0xb13b('0x1d4')][_0xb13b('0x10a')](db['FreshsalesField'],{'as':'Description','foreignKey':_0xb13b('0x1c0')});db['FreshsalesField'][_0xb13b('0x10a')](db[_0xb13b('0x1d4')],{'as':'Field','foreignKey':'FieldId'});db['FreshsalesField'][_0xb13b('0x119')](db[_0xb13b('0x8a')],{'as':_0xb13b('0x8a'),'foreignKey':_0xb13b('0x1c6')});db[_0xb13b('0x1d5')]['belongsTo'](db[_0xb13b('0x135')],{});db[_0xb13b('0x1d5')][_0xb13b('0x119')](db['CmList'],{'as':_0xb13b('0x166'),'foreignKey':_0xb13b('0x167')});db['ChatQueueReport']['belongsTo'](db['CmContact'],{'as':_0xb13b('0x16d'),'foreignKey':'ContactId'});db[_0xb13b('0x1d5')][_0xb13b('0x119')](db['ChatInteraction'],{});db[_0xb13b('0x1d5')]['belongsTo'](db[_0xb13b('0x191')],{});db['ChatQueueReport'][_0xb13b('0x119')](db[_0xb13b('0x106')],{});db[_0xb13b('0x1d5')][_0xb13b('0x119')](db[_0xb13b('0x5f')],{});db[_0xb13b('0xc7')]['belongsTo'](db['User'],{'onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x1d6')});db['ChatInternalMessage'][_0xb13b('0x119')](db[_0xb13b('0x106')],{'onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x1d7')});db[_0xb13b('0x19a')][_0xb13b('0x10a')](db[_0xb13b('0xc9')],{'foreignKey':_0xb13b('0x1d8'),'onDelete':_0xb13b('0x108')});db['JscriptySessionReport'][_0xb13b('0x10a')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0xb13b('0x108')});db[_0xb13b('0xcc')]['belongsTo'](db[_0xb13b('0x4a')],{});db[_0xb13b('0xcc')][_0xb13b('0x119')](db[_0xb13b('0x11e')],{'as':_0xb13b('0x166'),'foreignKey':_0xb13b('0x167')});db[_0xb13b('0xcc')][_0xb13b('0x119')](db[_0xb13b('0x66')],{'as':_0xb13b('0x16d'),'foreignKey':'ContactId'});db[_0xb13b('0xcc')][_0xb13b('0x119')](db[_0xb13b('0x4c')],{});db[_0xb13b('0xcc')][_0xb13b('0x119')](db[_0xb13b('0x184')],{});db['SmsQueueReport'][_0xb13b('0x119')](db[_0xb13b('0x106')],{});db[_0xb13b('0xcc')][_0xb13b('0x119')](db[_0xb13b('0x4f')],{});db[_0xb13b('0xd0')][_0xb13b('0x10a')](db['JscriptySessionReport'],{'foreignKey':_0xb13b('0x1d9')});db[_0xb13b('0xd0')][_0xb13b('0x10a')](db[_0xb13b('0xc9')],{'foreignKey':_0xb13b('0x1d9')});db[_0xb13b('0xd0')][_0xb13b('0x10a')](db[_0xb13b('0xc8')],{'foreignKey':_0xb13b('0x1d9')});db[_0xb13b('0xd5')][_0xb13b('0x11b')](db[_0xb13b('0x106')],{'as':_0xb13b('0x172'),'through':_0xb13b('0x143')});db[_0xb13b('0xda')][_0xb13b('0x11b')](db[_0xb13b('0x106')],{'as':_0xb13b('0x156'),'through':'user_has_teams'});db['Team'][_0xb13b('0x11b')](db['VoiceQueue'],{'through':'TeamVoiceQueue','as':_0xb13b('0x12a')});db[_0xb13b('0xda')][_0xb13b('0x11b')](db[_0xb13b('0x38')],{'through':'team_has_mail_queues','as':_0xb13b('0x12b')});db['Team'][_0xb13b('0x11b')](db[_0xb13b('0x5f')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0xb13b('0xda')][_0xb13b('0x11b')](db['FaxQueue'],{'through':_0xb13b('0x182'),'as':'FaxQueues'});db[_0xb13b('0xda')]['belongsToMany'](db[_0xb13b('0x4f')],{'through':'team_has_sms_queues','as':_0xb13b('0x131')});db[_0xb13b('0xda')][_0xb13b('0x11b')](db[_0xb13b('0x56')],{'through':_0xb13b('0x1da'),'as':_0xb13b('0x132')});db['Team']['belongsToMany'](db[_0xb13b('0x100')],{'through':_0xb13b('0x1db'),'as':_0xb13b('0x133')});db[_0xb13b('0xdd')][_0xb13b('0x10a')](db[_0xb13b('0x68')],{'as':_0xb13b('0x14a'),'foreignKey':'CampaignId'});db['Campaign'][_0xb13b('0x10a')](db[_0xb13b('0x6a')],{'as':_0xb13b('0x10d'),'foreignKey':_0xb13b('0x1a0')});db['Campaign'][_0xb13b('0x10a')](db[_0xb13b('0x6c')],{'as':_0xb13b('0x14b'),'foreignKey':_0xb13b('0x1a0')});db[_0xb13b('0xdd')]['hasMany'](db[_0xb13b('0x14c')],{'as':_0xb13b('0x14d'),'foreignKey':_0xb13b('0x1a0')});db['Campaign']['belongsTo'](db[_0xb13b('0x28')],{'as':_0xb13b('0x28'),'foreignKey':_0xb13b('0x14f')});db['Campaign']['belongsTo'](db[_0xb13b('0x28')],{'as':_0xb13b('0x150'),'foreignKey':'TrunkBackupId'});db[_0xb13b('0xdd')]['belongsTo'](db[_0xb13b('0x152')],{'as':_0xb13b('0x152'),'foreignKey':_0xb13b('0x153')});db[_0xb13b('0xdd')][_0xb13b('0x119')](db[_0xb13b('0xd5')],{'as':_0xb13b('0xd5'),'foreignKey':_0xb13b('0x1dc')});db[_0xb13b('0xdd')][_0xb13b('0x11b')](db[_0xb13b('0x11e')],{'as':_0xb13b('0x11f'),'through':_0xb13b('0x1dd')});db['Campaign']['belongsToMany'](db[_0xb13b('0x11e')],{'as':'BlackLists','through':_0xb13b('0x1de')});db['MailTransferReport']['belongsTo'](db[_0xb13b('0x3d')],{});db[_0xb13b('0xe5')][_0xb13b('0x119')](db[_0xb13b('0x3b')],{});db[_0xb13b('0xe5')][_0xb13b('0x119')](db[_0xb13b('0x161')],{'foreignKey':'FromMailAccountId','as':_0xb13b('0x1df')});db[_0xb13b('0xe5')][_0xb13b('0x119')](db[_0xb13b('0x106')],{'foreignKey':_0xb13b('0x1e0'),'as':_0xb13b('0x1e1')});db[_0xb13b('0xe5')][_0xb13b('0x119')](db[_0xb13b('0x106')],{'foreignKey':_0xb13b('0x1e2'),'as':_0xb13b('0x1e3')});db[_0xb13b('0xe5')][_0xb13b('0x119')](db[_0xb13b('0x38')],{'foreignKey':_0xb13b('0x1e4'),'as':'ToQueue'});db['MailTransferReport'][_0xb13b('0x119')](db[_0xb13b('0x161')],{'foreignKey':_0xb13b('0x1e5'),'as':_0xb13b('0x1e6')});db[_0xb13b('0xe6')][_0xb13b('0x119')](db['ChatMessage'],{});db[_0xb13b('0xe6')][_0xb13b('0x119')](db[_0xb13b('0x5b')],{});db[_0xb13b('0xe6')]['belongsTo'](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':_0xb13b('0x1df')});db[_0xb13b('0xe6')][_0xb13b('0x119')](db[_0xb13b('0x106')],{'foreignKey':_0xb13b('0x1e0'),'as':_0xb13b('0x1e1')});db[_0xb13b('0xe6')]['belongsTo'](db[_0xb13b('0x106')],{'foreignKey':_0xb13b('0x1e2'),'as':_0xb13b('0x1e3')});db[_0xb13b('0xe6')][_0xb13b('0x119')](db[_0xb13b('0x5f')],{'foreignKey':_0xb13b('0x1e7'),'as':_0xb13b('0x1e8')});db['ChatTransferReport'][_0xb13b('0x119')](db['ChatWebsite'],{'foreignKey':_0xb13b('0x1e9'),'as':_0xb13b('0x1e6')});db[_0xb13b('0xe8')]['belongsTo'](db[_0xb13b('0x17d')],{});db[_0xb13b('0xe8')][_0xb13b('0x119')](db[_0xb13b('0x47')],{});db['FaxTransferReport'][_0xb13b('0x119')](db[_0xb13b('0x44')],{'foreignKey':_0xb13b('0x1ea'),'as':_0xb13b('0x1df')});db['FaxTransferReport'][_0xb13b('0x119')](db[_0xb13b('0x106')],{'foreignKey':_0xb13b('0x1e0'),'as':_0xb13b('0x1e1')});db['FaxTransferReport'][_0xb13b('0x119')](db[_0xb13b('0x106')],{'foreignKey':_0xb13b('0x1e2'),'as':_0xb13b('0x1e3')});db[_0xb13b('0xe8')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0xb13b('0x1eb'),'as':_0xb13b('0x1e8')});db['FaxTransferReport']['belongsTo'](db[_0xb13b('0x44')],{'foreignKey':'ToFaxAccountId','as':_0xb13b('0x1e6')});db[_0xb13b('0xea')][_0xb13b('0x119')](db[_0xb13b('0x54')],{});db[_0xb13b('0xea')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0xb13b('0xea')][_0xb13b('0x119')](db[_0xb13b('0x18a')],{'foreignKey':_0xb13b('0x1ec'),'as':_0xb13b('0x1df')});db[_0xb13b('0xea')][_0xb13b('0x119')](db['User'],{'foreignKey':'FromUserId','as':_0xb13b('0x1e1')});db[_0xb13b('0xea')][_0xb13b('0x119')](db[_0xb13b('0x106')],{'foreignKey':_0xb13b('0x1e2'),'as':_0xb13b('0x1e3')});db[_0xb13b('0xea')][_0xb13b('0x119')](db['OpenchannelQueue'],{'foreignKey':_0xb13b('0x1ed'),'as':_0xb13b('0x1e8')});db[_0xb13b('0xea')][_0xb13b('0x119')](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':_0xb13b('0x1e6')});db[_0xb13b('0xec')][_0xb13b('0x119')](db[_0xb13b('0x184')],{});db[_0xb13b('0xec')][_0xb13b('0x119')](db[_0xb13b('0x4c')],{});db[_0xb13b('0xec')][_0xb13b('0x119')](db[_0xb13b('0x4a')],{'foreignKey':_0xb13b('0x1ee'),'as':_0xb13b('0x1df')});db[_0xb13b('0xec')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0xb13b('0x1e1')});db[_0xb13b('0xec')][_0xb13b('0x119')](db['User'],{'foreignKey':_0xb13b('0x1e2'),'as':_0xb13b('0x1e3')});db[_0xb13b('0xec')]['belongsTo'](db['SmsQueue'],{'foreignKey':_0xb13b('0x1ef'),'as':_0xb13b('0x1e8')});db[_0xb13b('0xec')][_0xb13b('0x119')](db[_0xb13b('0x4a')],{'foreignKey':_0xb13b('0x1f0'),'as':_0xb13b('0x1e6')});db[_0xb13b('0x11e')]['hasMany'](db[_0xb13b('0x178')],{'as':'Dispositions','foreignKey':_0xb13b('0x167')});db['CmList']['hasMany'](db[_0xb13b('0x6f')],{'as':_0xb13b('0x1f1'),'foreignKey':_0xb13b('0x167')});db[_0xb13b('0x11e')][_0xb13b('0x10a')](db[_0xb13b('0x66')],{'as':_0xb13b('0x11d'),'onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x167')});db[_0xb13b('0x11e')][_0xb13b('0x10a')](db[_0xb13b('0x6a')],{'as':_0xb13b('0x10d'),'foreignKey':_0xb13b('0x167')});db['CmList'][_0xb13b('0x10a')](db[_0xb13b('0x6c')],{'as':_0xb13b('0x10e'),'foreignKey':_0xb13b('0x167')});db[_0xb13b('0x11e')][_0xb13b('0x10a')](db[_0xb13b('0x10f')],{'as':_0xb13b('0x10f'),'foreignKey':'ListId'});db[_0xb13b('0x11e')][_0xb13b('0x11b')](db[_0xb13b('0x129')],{'as':_0xb13b('0x1f2'),'through':_0xb13b('0x155')});db[_0xb13b('0x11e')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xb13b('0x120')});db[_0xb13b('0xee')][_0xb13b('0x10a')](db['VoiceExtension'],{'as':'Extensions','onDelete':'cascade'});db[_0xb13b('0xee')]['belongsToMany'](db[_0xb13b('0x106')],{'as':_0xb13b('0x156'),'through':_0xb13b('0x1f3')});db['UserProfile'][_0xb13b('0x10a')](db['User'],{'as':_0xb13b('0x172'),'foreignKey':'userProfileId'});db['UserProfile'][_0xb13b('0x10a')](db[_0xb13b('0xf2')],{'as':_0xb13b('0x1f4'),'foreignKey':'userProfileId','onDelete':_0xb13b('0x108')});db['UserProfileSection'][_0xb13b('0x10a')](db[_0xb13b('0xf4')],{'as':_0xb13b('0x1f5'),'foreignKey':_0xb13b('0x1f6'),'onDelete':_0xb13b('0x108')});db[_0xb13b('0x140')][_0xb13b('0x10a')](db[_0xb13b('0x178')],{'as':_0xb13b('0x179'),'foreignKey':_0xb13b('0x1f7')});db['WhatsappAccount'][_0xb13b('0x10a')](db['CannedAnswer'],{'as':_0xb13b('0x164'),'foreignKey':_0xb13b('0x1f7')});db[_0xb13b('0x140')][_0xb13b('0x10a')](db['WhatsappMessage'],{'as':_0xb13b('0x15a'),'foreignKey':_0xb13b('0x1f7')});db[_0xb13b('0x140')]['hasMany'](db[_0xb13b('0xfa')],{'as':_0xb13b('0x17b')});db[_0xb13b('0x140')][_0xb13b('0x10a')](db[_0xb13b('0xf8')],{'as':_0xb13b('0x165')});db[_0xb13b('0x140')][_0xb13b('0x119')](db[_0xb13b('0x11e')],{'as':_0xb13b('0x166'),'foreignKey':_0xb13b('0x167')});db[_0xb13b('0x140')][_0xb13b('0x119')](db[_0xb13b('0x7b')],{'as':'mandatoryDispositionPause','foreignKey':_0xb13b('0x169')});db[_0xb13b('0x140')][_0xb13b('0x11b')](db[_0xb13b('0x106')],{'as':_0xb13b('0x156'),'through':'user_has_whatsapp_accounts'});db[_0xb13b('0xf8')][_0xb13b('0x119')](db[_0xb13b('0x106')],{'onDelete':_0xb13b('0x173')});db['WhatsappApplication'][_0xb13b('0x119')](db['WhatsappQueue'],{'onDelete':_0xb13b('0x173')});db['WhatsappApplication'][_0xb13b('0x119')](db[_0xb13b('0x140')],{'onDelete':_0xb13b('0x173')});db[_0xb13b('0xf8')]['belongsTo'](db[_0xb13b('0x152')],{'onDelete':_0xb13b('0x173'),'foreignKey':'IntervalId'});db[_0xb13b('0xf8')][_0xb13b('0x119')](db[_0xb13b('0x84')],{'onDelete':_0xb13b('0x173'),'foreignKey':'TagId'});db[_0xb13b('0xfa')]['hasMany'](db[_0xb13b('0xfc')],{'as':'Messages','onDelete':_0xb13b('0x108'),'foreignKey':_0xb13b('0x1f8')});db['WhatsappInteraction'][_0xb13b('0x119')](db[_0xb13b('0x140')],{'as':_0xb13b('0x16c'),'foreignKey':_0xb13b('0x1f7')});db[_0xb13b('0xfa')][_0xb13b('0x119')](db[_0xb13b('0x66')],{'as':'Contact','foreignKey':_0xb13b('0x176')});db['WhatsappInteraction'][_0xb13b('0x119')](db['User'],{'as':'Owner','foreignKey':_0xb13b('0x109')});db[_0xb13b('0xfa')][_0xb13b('0x11b')](db[_0xb13b('0x84')],{'through':_0xb13b('0x1b0'),'as':_0xb13b('0x170')});db[_0xb13b('0xfa')][_0xb13b('0x11b')](db[_0xb13b('0x84')],{'through':_0xb13b('0x1b0'),'as':'ThroughTags'});db['WhatsappInteraction']['belongsToMany'](db['User'],{'as':_0xb13b('0x172'),'through':'user_has_whatsapp_interactions','foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0xb13b('0x119')](db[_0xb13b('0x106')],{'as':_0xb13b('0x106')});db[_0xb13b('0xfc')][_0xb13b('0x119')](db[_0xb13b('0x66')],{'onDelete':_0xb13b('0x108'),'as':_0xb13b('0x16d')});db[_0xb13b('0xfc')][_0xb13b('0x119')](db[_0xb13b('0xfa')],{'onDelete':_0xb13b('0x108'),'as':_0xb13b('0x180'),'foreignKey':_0xb13b('0x1f8')});db[_0xb13b('0xfc')]['belongsTo'](db[_0xb13b('0x140')],{'as':_0xb13b('0x16c'),'foreignKey':_0xb13b('0x1f7')});db[_0xb13b('0xfd')]['belongsTo'](db[_0xb13b('0x140')],{});db['WhatsappQueueReport'][_0xb13b('0x119')](db[_0xb13b('0x11e')],{'as':_0xb13b('0x166'),'foreignKey':_0xb13b('0x167')});db[_0xb13b('0xfd')][_0xb13b('0x119')](db[_0xb13b('0x66')],{'as':_0xb13b('0x16d'),'foreignKey':_0xb13b('0x176')});db['WhatsappQueueReport'][_0xb13b('0x119')](db[_0xb13b('0xfa')],{});db[_0xb13b('0xfd')][_0xb13b('0x119')](db[_0xb13b('0x100')],{});db[_0xb13b('0xfd')][_0xb13b('0x119')](db[_0xb13b('0xfc')],{});db[_0xb13b('0xfd')][_0xb13b('0x119')](db[_0xb13b('0x106')],{});db['WhatsappTransferReport'][_0xb13b('0x119')](db[_0xb13b('0xfc')],{});db[_0xb13b('0xfe')][_0xb13b('0x119')](db[_0xb13b('0xfa')],{});db[_0xb13b('0xfe')][_0xb13b('0x119')](db[_0xb13b('0x140')],{'foreignKey':_0xb13b('0x1f9'),'as':_0xb13b('0x1df')});db[_0xb13b('0xfe')][_0xb13b('0x119')](db['WhatsappAccount'],{'foreignKey':_0xb13b('0x1fa'),'as':'ToAccount'});db['WhatsappTransferReport']['belongsTo'](db[_0xb13b('0x100')],{'foreignKey':_0xb13b('0x1fb'),'as':_0xb13b('0x1e8')});db[_0xb13b('0xfe')]['belongsTo'](db[_0xb13b('0x106')],{'foreignKey':_0xb13b('0x1e0'),'as':_0xb13b('0x1e1')});db[_0xb13b('0xfe')][_0xb13b('0x119')](db[_0xb13b('0x106')],{'foreignKey':'ToUserId','as':_0xb13b('0x1e3')});db[_0xb13b('0x100')][_0xb13b('0x11b')](db[_0xb13b('0x106')],{'as':_0xb13b('0x156'),'through':'UserWhatsappQueue','foreignKey':_0xb13b('0x1fc')});db[_0xb13b('0x100')][_0xb13b('0x11b')](db[_0xb13b('0xda')],{'through':_0xb13b('0x1db'),'as':_0xb13b('0x157')});module[_0xb13b('0x1fd')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 49acc54..81f9d65 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a55=['/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/auth/google','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','root','/www','join','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','newPassword','apiKey','firstName','lastName','street','phone','mobile','email','securityToken','code','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','accesskeyid','pass','accountSid','registry','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','includes','lodash','path','express','express-winston','util','./errors','./config/environment','./config/logger','auth','default','use','logger','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','user','role','inspect','agent_id','statusCode','name','device','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','./api/voiceCallReport','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperHistory','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoField','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','./api/chatQueueReport','./api/chatInternalMessage','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','/api/license','./api/license','/api/campaigns','/api/migrations','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport'];(function(_0x5f00a9,_0x935036){var _0x2325c5=function(_0x5825f3){while(--_0x5825f3){_0x5f00a9['push'](_0x5f00a9['shift']());}};_0x2325c5(++_0x935036);}(_0x8a55,0x185));var _0x58a5=function(_0x9ffffc,_0x56f544){_0x9ffffc=_0x9ffffc-0x0;var _0x201ffd=_0x8a55[_0x9ffffc];return _0x201ffd;};'use strict';var _=require(_0x58a5('0x0'));var path=require(_0x58a5('0x1'));var express=require(_0x58a5('0x2'));var ewinston=require(_0x58a5('0x3'));var util=require(_0x58a5('0x4'));var errors=require(_0x58a5('0x5'));var config=require(_0x58a5('0x6'));var logger=require(_0x58a5('0x7'))('api');var authLogger=require(_0x58a5('0x7'))(_0x58a5('0x8'));exports[_0x58a5('0x9')]=function(_0x3edf85){_0x3edf85[_0x58a5('0xa')](ewinston[_0x58a5('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1f135e,_0xd63fc7){var _0x36d8a4='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x58a5('0xc')](_0x1f135e[_0x58a5('0xd')])){_0x36d8a4+=_0x58a5('0xe');var _0x2eec28=_0x1f135e[_0x58a5('0xd')];maskSensitiveData(_0x2eec28);}return util[_0x58a5('0xf')](_0x36d8a4,_0x1f135e[_0x58a5('0x10')],_0x1f135e[_0x58a5('0x11')][_0x58a5('0x12')]?_0x1f135e[_0x58a5('0x11')][_0x58a5('0x12')]:_0x1f135e[_0x58a5('0x13')][_0x58a5('0x14')]||_0x1f135e['ip'],_0x1f135e[_0x58a5('0x15')],_0xd63fc7['statusCode'],_0xd63fc7[_0x58a5('0x16')],_0x1f135e[_0x58a5('0x17')]?_0x1f135e[_0x58a5('0x17')]['id']:null,_0x1f135e[_0x58a5('0x17')]?_0x1f135e[_0x58a5('0x17')]['name']:null,_0x1f135e['user']?_0x1f135e[_0x58a5('0x17')][_0x58a5('0x18')]:null,_0x2eec28?util[_0x58a5('0x19')](_0x2eec28,![],null):'');}}));_0x3edf85[_0x58a5('0xa')](ewinston[_0x58a5('0xb')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x598b0f,_0x9577d5){var _0x42ea0c='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x598b0f[_0x58a5('0xd')]&&_0x598b0f[_0x58a5('0xd')]['device']&&_0x598b0f[_0x58a5('0xd')][_0x58a5('0x1a')]){_0x42ea0c='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x42ea0c,_0x598b0f[_0x58a5('0x10')],_0x598b0f['headers']['x-forwarded-for']?_0x598b0f['headers'][_0x58a5('0x12')]:_0x598b0f[_0x58a5('0x13')]['remoteAddress']||_0x598b0f['ip'],_0x598b0f[_0x58a5('0x15')],_0x9577d5[_0x58a5('0x1b')],_0x9577d5[_0x58a5('0x16')],_0x598b0f['user']?_0x598b0f[_0x58a5('0x17')]['id']:null,_0x598b0f[_0x58a5('0x17')]?_0x598b0f[_0x58a5('0x17')][_0x58a5('0x1c')]:null,_0x598b0f['user']?_0x598b0f['user'][_0x58a5('0x18')]:null,_0x598b0f[_0x58a5('0xd')]&&_0x598b0f[_0x58a5('0xd')]['device']?_0x598b0f['body'][_0x58a5('0x1d')]:_0x58a5('0x1e'),_0x598b0f[_0x58a5('0xd')]&&_0x598b0f[_0x58a5('0xd')][_0x58a5('0x1a')]?_0x598b0f[_0x58a5('0xd')][_0x58a5('0x1a')]:'',_0x598b0f['body']&&_0x598b0f[_0x58a5('0xd')]['agent_name']?_0x598b0f[_0x58a5('0xd')][_0x58a5('0x1f')]:'');},'ignoreRoute':function(_0x59823d){var _0x431788=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x431788[_0x58a5('0x20')](_0x59823d['url']);}}));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x21'),require(_0x58a5('0x22')));_0x3edf85['use'](_0x58a5('0x23'),require(_0x58a5('0x24')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x25'),require(_0x58a5('0x26')));_0x3edf85['use'](_0x58a5('0x27'),require(_0x58a5('0x28')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x29'),require(_0x58a5('0x2a')));_0x3edf85[_0x58a5('0xa')]('/api/voice/queues',require(_0x58a5('0x2b')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x2c'),require(_0x58a5('0x2d')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x2e'),require(_0x58a5('0x2f')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x30'),require(_0x58a5('0x31')));_0x3edf85[_0x58a5('0xa')]('/api/voice/mails/messages',require(_0x58a5('0x32')));_0x3edf85[_0x58a5('0xa')]('/api/voice/calls/reports',require(_0x58a5('0x33')));_0x3edf85[_0x58a5('0xa')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x3edf85['use']('/api/voice/agents/reports',require(_0x58a5('0x34')));_0x3edf85[_0x58a5('0xa')]('/api/voice/queues/reports',require(_0x58a5('0x35')));_0x3edf85['use'](_0x58a5('0x36'),require('./api/memberReport'));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x37'),require(_0x58a5('0x38')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x39'),require('./api/voiceTransferReport'));_0x3edf85[_0x58a5('0xa')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x3a'),require(_0x58a5('0x3b')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x3c'),require(_0x58a5('0x3d')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x3e'),require(_0x58a5('0x3f')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x40'),require('./api/mailInteraction'));_0x3edf85[_0x58a5('0xa')]('/api/mail/messages',require(_0x58a5('0x41')));_0x3edf85['use'](_0x58a5('0x42'),require(_0x58a5('0x43')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x44'),require(_0x58a5('0x45')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x46'),require('./api/dashboard'));_0x3edf85[_0x58a5('0xa')]('/api/dashboards/items',require(_0x58a5('0x47')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x48'),require(_0x58a5('0x49')));_0x3edf85['use']('/api/fax/applications',require(_0x58a5('0x4a')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x4b'),require('./api/faxInteraction'));_0x3edf85['use']('/api/fax/messages',require(_0x58a5('0x4c')));_0x3edf85[_0x58a5('0xa')]('/api/fax/queues',require(_0x58a5('0x4d')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x4e'),require(_0x58a5('0x4f')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x50'),require(_0x58a5('0x51')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x52'),require('./api/smsApplication'));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x53'),require(_0x58a5('0x54')));_0x3edf85['use'](_0x58a5('0x55'),require(_0x58a5('0x56')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x57'),require(_0x58a5('0x58')));_0x3edf85[_0x58a5('0xa')]('/api/openchannel/accounts',require(_0x58a5('0x59')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x5a'),require(_0x58a5('0x5b')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x5c'),require(_0x58a5('0x5d')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x5e'),require(_0x58a5('0x5f')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x60'),require(_0x58a5('0x61')));_0x3edf85['use'](_0x58a5('0x62'),require(_0x58a5('0x63')));_0x3edf85[_0x58a5('0xa')]('/api/openchannel/reports/queue',require(_0x58a5('0x64')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x65'),require(_0x58a5('0x66')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x67'),require('./api/chatInteraction'));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x68'),require(_0x58a5('0x69')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x6a'),require(_0x58a5('0x6b')));_0x3edf85[_0x58a5('0xa')]('/api/chat/queues',require(_0x58a5('0x6c')));_0x3edf85['use'](_0x58a5('0x6d'),require(_0x58a5('0x6e')));_0x3edf85[_0x58a5('0xa')]('/api/chat/proactive_actions',require(_0x58a5('0x6f')));_0x3edf85['use'](_0x58a5('0x70'),require(_0x58a5('0x71')));_0x3edf85['use']('/api/cm/contacts',require(_0x58a5('0x72')));_0x3edf85[_0x58a5('0xa')]('/api/cm/hopper',require(_0x58a5('0x73')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x74'),require(_0x58a5('0x75')));_0x3edf85[_0x58a5('0xa')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x3edf85['use']('/api/cm/hopper_history',require(_0x58a5('0x76')));_0x3edf85[_0x58a5('0xa')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x77'),require(_0x58a5('0x78')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x79'),require(_0x58a5('0x7a')));_0x3edf85['use']('/api/canned_answers',require(_0x58a5('0x7b')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x7c'),require(_0x58a5('0x7d')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x7e'),require(_0x58a5('0x7f')));_0x3edf85['use'](_0x58a5('0x80'),require(_0x58a5('0x81')));_0x3edf85['use'](_0x58a5('0x82'),require(_0x58a5('0x83')));_0x3edf85['use'](_0x58a5('0x84'),require(_0x58a5('0x85')));_0x3edf85[_0x58a5('0xa')]('/api/voiceQueuesLog',require(_0x58a5('0x86')));_0x3edf85[_0x58a5('0xa')]('/api/schedules',require('./api/schedule'));_0x3edf85[_0x58a5('0xa')]('/api/sounds',require(_0x58a5('0x87')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x88'),require(_0x58a5('0x89')));_0x3edf85['use'](_0x58a5('0x8a'),require(_0x58a5('0x8b')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x8c'),require(_0x58a5('0x8d')));_0x3edf85[_0x58a5('0xa')]('/api/variables',require('./api/variable'));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x8e'),require(_0x58a5('0x8f')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x90'),require('./api/integrationReport'));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x91'),require('./api/analyticCustomReport'));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x92'),require(_0x58a5('0x93')));_0x3edf85['use'](_0x58a5('0x94'),require(_0x58a5('0x95')));_0x3edf85['use']('/api/analytics/metrics',require(_0x58a5('0x96')));_0x3edf85[_0x58a5('0xa')]('/api/analytics/field_reports',require(_0x58a5('0x97')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x98'),require(_0x58a5('0x99')));_0x3edf85['use'](_0x58a5('0x9a'),require(_0x58a5('0x9b')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x9c'),require(_0x58a5('0x9d')));_0x3edf85[_0x58a5('0xa')]('/api/integrations/salesforce/fields',require(_0x58a5('0x9e')));_0x3edf85['use'](_0x58a5('0x9f'),require(_0x58a5('0xa0')));_0x3edf85['use'](_0x58a5('0xa1'),require('./api/intSugarcrmConfiguration'));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xa2'),require(_0x58a5('0xa3')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xa4'),require(_0x58a5('0xa5')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xa6'),require(_0x58a5('0xa7')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xa8'),require(_0x58a5('0xa9')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xaa'),require(_0x58a5('0xab')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xac'),require('./api/intZohoConfiguration'));_0x3edf85[_0x58a5('0xa')]('/api/integrations/zoho/fields',require(_0x58a5('0xad')));_0x3edf85[_0x58a5('0xa')]('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xae'),require('./api/intZendeskConfiguration'));_0x3edf85['use'](_0x58a5('0xaf'),require(_0x58a5('0xb0')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xb1'),require('./api/intFreshdeskAccount'));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xb2'),require(_0x58a5('0xb3')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xb4'),require(_0x58a5('0xb5')));_0x3edf85[_0x58a5('0xa')]('/api/integrations/vtiger/accounts',require(_0x58a5('0xb6')));_0x3edf85['use'](_0x58a5('0xb7'),require(_0x58a5('0xb8')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xb9'),require(_0x58a5('0xba')));_0x3edf85['use']('/api/integrations/servicenow/accounts',require(_0x58a5('0xbb')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xbc'),require(_0x58a5('0xbd')));_0x3edf85['use'](_0x58a5('0xbe'),require(_0x58a5('0xbf')));_0x3edf85['use'](_0x58a5('0xc0'),require(_0x58a5('0xc1')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xc2'),require(_0x58a5('0xc3')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xc4'),require(_0x58a5('0xc5')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xc6'),require(_0x58a5('0xc7')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xc8'),require(_0x58a5('0xc9')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xca'),require('./api/intFreshsalesField'));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xcb'),require(_0x58a5('0xcc')));_0x3edf85[_0x58a5('0xa')]('/api/chat/reports/queue',require(_0x58a5('0xcd')));_0x3edf85[_0x58a5('0xa')]('/api/chat/internal/messages',require(_0x58a5('0xce')));_0x3edf85[_0x58a5('0xa')]('/api/jscripty/answers/reports',require(_0x58a5('0xcf')));_0x3edf85[_0x58a5('0xa')]('/api/jscripty/questions/reports',require(_0x58a5('0xd0')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xd1'),require('./api/jscriptySessionReport'));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xd2'),require(_0x58a5('0xd3')));_0x3edf85['use'](_0x58a5('0xd4'),require('./api/squareReport'));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xd5'),require('./api/squareReportDetail'));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xd6'),require(_0x58a5('0xd7')));_0x3edf85['use'](_0x58a5('0xd8'),require(_0x58a5('0xd9')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xda'),require(_0x58a5('0xdb')));_0x3edf85['use']('/api/square/projects',require(_0x58a5('0xdc')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xdd'),require(_0x58a5('0xde')));_0x3edf85[_0x58a5('0xa')]('/api/square/messages',require(_0x58a5('0xdf')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xe0'),require('./api/team'));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xe1'),require(_0x58a5('0xe2')));_0x3edf85['use'](_0x58a5('0xe3'),require('./api/campaign'));_0x3edf85['use'](_0x58a5('0xe4'),require('./api/migration'));_0x3edf85[_0x58a5('0xa')]('/api/attachments',require(_0x58a5('0xe5')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xe6'),require(_0x58a5('0xe7')));_0x3edf85['use'](_0x58a5('0xe8'),require(_0x58a5('0xe9')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xea'),require('./api/chatTransferReport'));_0x3edf85['use'](_0x58a5('0xeb'),require(_0x58a5('0xec')));_0x3edf85['use'](_0x58a5('0xed'),require(_0x58a5('0xee')));_0x3edf85[_0x58a5('0xa')]('/api/sms/reports/transfer',require(_0x58a5('0xef')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xf0'),require('./api/cmList'));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xf1'),require(_0x58a5('0xf2')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xf3'),require(_0x58a5('0xf4')));_0x3edf85['use'](_0x58a5('0xf5'),require('./api/userProfileSection'));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xf6'),require(_0x58a5('0xf7')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xf8'),require(_0x58a5('0xf9')));_0x3edf85[_0x58a5('0xa')]('/api/userNotifications',require('./api/userNotification'));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xfa'),require('./api/whatsappAccount'));_0x3edf85['use'](_0x58a5('0xfb'),require(_0x58a5('0xfc')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xfd'),require(_0x58a5('0xfe')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0xff'),require(_0x58a5('0x100')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x101'),require(_0x58a5('0x102')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x103'),require(_0x58a5('0x104')));_0x3edf85['use']('/api/whatsapp/queues',require(_0x58a5('0x105')));_0x3edf85[_0x58a5('0xa')]('/api/cloudProviders',require('./api/cloudProvider'));_0x3edf85['use']('/api/auth/local',require('./api/authLocal'));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x106'),require('./api/authGoogle'));_0x3edf85[_0x58a5('0xa')]('/api/jira',require(_0x58a5('0x107')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x108'),require(_0x58a5('0x109')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x10a'),require(_0x58a5('0x10b')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x10c'),require('./api/system'));_0x3edf85[_0x58a5('0xa')]('/api/pm2',require(_0x58a5('0x10d')));_0x3edf85['use'](_0x58a5('0x10e'),require(_0x58a5('0x10f')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x110'),express[_0x58a5('0x111')](path['join'](config[_0x58a5('0x112')],'/apidoc')));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x113'),express[_0x58a5('0x111')](path[_0x58a5('0x114')](config[_0x58a5('0x112')],_0x58a5('0x113'))));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x115'),express[_0x58a5('0x111')](path['join'](config[_0x58a5('0x112')],_0x58a5('0x115'))));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x116'),express[_0x58a5('0x111')](path[_0x58a5('0x114')](config[_0x58a5('0x112')],_0x58a5('0x117'),_0x58a5('0x118'))));_0x3edf85[_0x58a5('0xa')](_0x58a5('0x119'),express[_0x58a5('0x111')](path[_0x58a5('0x114')](config['root'],_0x58a5('0x11a'))));_0x3edf85[_0x58a5('0x11b')](_0x58a5('0x11c'))[_0x58a5('0x11d')](errors[0x194]);_0x3edf85[_0x58a5('0x11b')]('/*')[_0x58a5('0x11d')](function(_0x2c3557,_0x445433){_0x445433['sendFile'](path[_0x58a5('0x11e')](_0x3edf85['get'](_0x58a5('0x11f'))+_0x58a5('0x120')));});};var sensitiveFields=['username','password',_0x58a5('0x121'),_0x58a5('0x122'),_0x58a5('0x123'),_0x58a5('0x124'),_0x58a5('0x125'),_0x58a5('0x126'),_0x58a5('0x127'),'fax',_0x58a5('0x128'),'clientId','clientSecret',_0x58a5('0x129'),_0x58a5('0x12a'),'accessKey',_0x58a5('0x12b'),_0x58a5('0x12c'),_0x58a5('0x12d'),_0x58a5('0x12e'),_0x58a5('0x12f'),_0x58a5('0x130'),_0x58a5('0x131'),_0x58a5('0x132'),'membername',_0x58a5('0x133'),_0x58a5('0x134'),_0x58a5('0x135'),_0x58a5('0x136'),_0x58a5('0x137'),'privateKey',_0x58a5('0x138'),'secretaccesskey','key',_0x58a5('0x17'),_0x58a5('0x139'),_0x58a5('0x13a'),'localstationid','dsn','secret',_0x58a5('0x13b'),_0x58a5('0x13c')];function maskSensitiveData(_0x8506da){var _0x2864d3=/(?!^)[\s\S](?!$)/g;if(!_[_0x58a5('0x13d')](_0x8506da))return;for(var _0x4392b6 in _0x8506da){if(_[_0x58a5('0x13e')](_0x8506da[_0x4392b6])){for(var _0x4ac7b8=0x0;_0x4ac7b8<_0x8506da[_0x4392b6][_0x58a5('0x13f')];_0x4ac7b8++){maskSensitiveData(_0x8506da[_0x4392b6][_0x4ac7b8]);}}else if(_['isPlainObject'](_0x8506da[_0x4392b6])){maskSensitiveData(_0x8506da[_0x4392b6]);}else if(_[_0x58a5('0x140')](_0x8506da[_0x4392b6])){_0x8506da[_0x4392b6]=_0x8506da[_0x4392b6][_0x58a5('0x141')](/{{{/g,_0x58a5('0x142'))[_0x58a5('0x141')](/}}}/g,'}@@')[_0x58a5('0x141')](/{{/g,'@{')[_0x58a5('0x141')](/}}/g,'}@');if(_[_0x58a5('0x143')](sensitiveFields,_0x4392b6)){_0x8506da[_0x4392b6]=_0x8506da[_0x4392b6][_0x58a5('0x141')](_0x2864d3,'*');}}}} \ No newline at end of file +var _0x8cfd=['./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/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','/api/tags','./api/tag','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./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/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/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/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','./api/migration','/api/attachments','./api/attachment','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','./api/notification','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','./api/pm2','/api/webbar','/apidoc','static','join','root','/www','/demo','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','/index.html','apiKey','firstName','lastName','phone','mobile','fax','email','clientId','clientSecret','code','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerSecret','calleridnum','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','dsn','secret','oldPassword','isPlainObject','isArray','replace','lodash','path','express','express-winston','util','./errors','./config/logger','api','auth','default','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','role','inspect','logger','%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)','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/applications','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages'];(function(_0x281e5e,_0xf320e2){var _0x5a22d2=function(_0x405ff9){while(--_0x405ff9){_0x281e5e['push'](_0x281e5e['shift']());}};_0x5a22d2(++_0xf320e2);}(_0x8cfd,0xe4));var _0xd8cf=function(_0x430459,_0x58519c){_0x430459=_0x430459-0x0;var _0x3a2439=_0x8cfd[_0x430459];return _0x3a2439;};'use strict';var _=require(_0xd8cf('0x0'));var path=require(_0xd8cf('0x1'));var express=require(_0xd8cf('0x2'));var ewinston=require(_0xd8cf('0x3'));var util=require(_0xd8cf('0x4'));var errors=require(_0xd8cf('0x5'));var config=require('./config/environment');var logger=require(_0xd8cf('0x6'))(_0xd8cf('0x7'));var authLogger=require(_0xd8cf('0x6'))(_0xd8cf('0x8'));exports[_0xd8cf('0x9')]=function(_0x318a72){_0x318a72[_0xd8cf('0xa')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x5cfd20,_0x3fe2d2){var _0xa5b446=_0xd8cf('0xb');if(!_[_0xd8cf('0xc')](_0x5cfd20[_0xd8cf('0xd')])){_0xa5b446+=_0xd8cf('0xe');var _0x526b59=_0x5cfd20[_0xd8cf('0xd')];maskSensitiveData(_0x526b59);}return util[_0xd8cf('0xf')](_0xa5b446,_0x5cfd20[_0xd8cf('0x10')],_0x5cfd20[_0xd8cf('0x11')][_0xd8cf('0x12')]?_0x5cfd20[_0xd8cf('0x11')][_0xd8cf('0x12')]:_0x5cfd20[_0xd8cf('0x13')][_0xd8cf('0x14')]||_0x5cfd20['ip'],_0x5cfd20[_0xd8cf('0x15')],_0x3fe2d2[_0xd8cf('0x16')],_0x3fe2d2[_0xd8cf('0x17')],_0x5cfd20['user']?_0x5cfd20[_0xd8cf('0x18')]['id']:null,_0x5cfd20['user']?_0x5cfd20[_0xd8cf('0x18')][_0xd8cf('0x19')]:null,_0x5cfd20['user']?_0x5cfd20[_0xd8cf('0x18')][_0xd8cf('0x1a')]:null,_0x526b59?util[_0xd8cf('0x1b')](_0x526b59,![],null):'');}}));_0x318a72['use'](ewinston[_0xd8cf('0x1c')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x5b9fb4,_0xc39a9a){var _0x24c78c=_0xd8cf('0x1d');if(_0x5b9fb4[_0xd8cf('0xd')]&&_0x5b9fb4[_0xd8cf('0xd')][_0xd8cf('0x1e')]&&_0x5b9fb4['body'][_0xd8cf('0x1f')]){_0x24c78c=_0xd8cf('0x20');}return util[_0xd8cf('0xf')](_0x24c78c,_0x5b9fb4[_0xd8cf('0x10')],_0x5b9fb4[_0xd8cf('0x11')][_0xd8cf('0x12')]?_0x5b9fb4[_0xd8cf('0x11')][_0xd8cf('0x12')]:_0x5b9fb4[_0xd8cf('0x13')][_0xd8cf('0x14')]||_0x5b9fb4['ip'],_0x5b9fb4[_0xd8cf('0x15')],_0xc39a9a[_0xd8cf('0x16')],_0xc39a9a[_0xd8cf('0x17')],_0x5b9fb4[_0xd8cf('0x18')]?_0x5b9fb4['user']['id']:null,_0x5b9fb4[_0xd8cf('0x18')]?_0x5b9fb4[_0xd8cf('0x18')][_0xd8cf('0x19')]:null,_0x5b9fb4[_0xd8cf('0x18')]?_0x5b9fb4[_0xd8cf('0x18')]['role']:null,_0x5b9fb4[_0xd8cf('0xd')]&&_0x5b9fb4['body']['device']?_0x5b9fb4['body'][_0xd8cf('0x1e')]:'other',_0x5b9fb4[_0xd8cf('0xd')]&&_0x5b9fb4[_0xd8cf('0xd')][_0xd8cf('0x1f')]?_0x5b9fb4[_0xd8cf('0xd')]['agent_id']:'',_0x5b9fb4[_0xd8cf('0xd')]&&_0x5b9fb4[_0xd8cf('0xd')][_0xd8cf('0x21')]?_0x5b9fb4[_0xd8cf('0xd')][_0xd8cf('0x21')]:'');},'ignoreRoute':function(_0x45a5b6){var _0x533808=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x533808[_0xd8cf('0x22')](_0x45a5b6[_0xd8cf('0x15')]);}}));_0x318a72['use'](_0xd8cf('0x23'),require(_0xd8cf('0x24')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x25'),require(_0xd8cf('0x26')));_0x318a72['use'](_0xd8cf('0x27'),require(_0xd8cf('0x28')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x29'),require(_0xd8cf('0x2a')));_0x318a72['use'](_0xd8cf('0x2b'),require(_0xd8cf('0x2c')));_0x318a72['use'](_0xd8cf('0x2d'),require(_0xd8cf('0x2e')));_0x318a72['use'](_0xd8cf('0x2f'),require(_0xd8cf('0x30')));_0x318a72[_0xd8cf('0xa')]('/api/screen/recordings',require(_0xd8cf('0x31')));_0x318a72['use'](_0xd8cf('0x32'),require(_0xd8cf('0x33')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x34'),require(_0xd8cf('0x35')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x36'),require(_0xd8cf('0x37')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x38'),require(_0xd8cf('0x39')));_0x318a72['use'](_0xd8cf('0x3a'),require(_0xd8cf('0x3b')));_0x318a72['use'](_0xd8cf('0x3c'),require(_0xd8cf('0x3d')));_0x318a72['use'](_0xd8cf('0x3e'),require(_0xd8cf('0x3f')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x40'),require(_0xd8cf('0x41')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x42'),require(_0xd8cf('0x43')));_0x318a72['use'](_0xd8cf('0x44'),require(_0xd8cf('0x45')));_0x318a72[_0xd8cf('0xa')]('/api/mail/accounts',require(_0xd8cf('0x46')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x47'),require(_0xd8cf('0x48')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x49'),require(_0xd8cf('0x4a')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x4b'),require(_0xd8cf('0x4c')));_0x318a72[_0xd8cf('0xa')]('/api/mail/messages',require('./api/mailMessage'));_0x318a72['use'](_0xd8cf('0x4d'),require('./api/mailApplication'));_0x318a72['use']('/api/mail/reports/queue',require(_0xd8cf('0x4e')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x4f'),require(_0xd8cf('0x50')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x51'),require('./api/dashboardItem'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x52'),require(_0xd8cf('0x53')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x54'),require(_0xd8cf('0x55')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x56'),require('./api/faxInteraction'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x57'),require(_0xd8cf('0x58')));_0x318a72['use'](_0xd8cf('0x59'),require('./api/faxQueue'));_0x318a72[_0xd8cf('0xa')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x318a72['use']('/api/sms/accounts',require(_0xd8cf('0x5a')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x5b'),require('./api/smsApplication'));_0x318a72['use'](_0xd8cf('0x5c'),require(_0xd8cf('0x5d')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x5e'),require('./api/smsMessage'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x5f'),require(_0xd8cf('0x60')));_0x318a72['use'](_0xd8cf('0x61'),require(_0xd8cf('0x62')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x63'),require(_0xd8cf('0x64')));_0x318a72[_0xd8cf('0xa')]('/api/openchannel/interactions',require(_0xd8cf('0x65')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x66'),require(_0xd8cf('0x67')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x68'),require('./api/openchannelQueue'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x69'),require(_0xd8cf('0x6a')));_0x318a72['use'](_0xd8cf('0x6b'),require(_0xd8cf('0x6c')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x6d'),require(_0xd8cf('0x6e')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x6f'),require(_0xd8cf('0x70')));_0x318a72['use'](_0xd8cf('0x71'),require(_0xd8cf('0x72')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x73'),require(_0xd8cf('0x74')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x75'),require(_0xd8cf('0x76')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x77'),require(_0xd8cf('0x78')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x79'),require(_0xd8cf('0x7a')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x7b'),require(_0xd8cf('0x7c')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x7d'),require(_0xd8cf('0x7e')));_0x318a72['use'](_0xd8cf('0x7f'),require(_0xd8cf('0x80')));_0x318a72[_0xd8cf('0xa')]('/api/cm/hopper_black',require(_0xd8cf('0x81')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x82'),require(_0xd8cf('0x83')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x84'),require('./api/cmHopperHistory'));_0x318a72['use'](_0xd8cf('0x85'),require('./api/cmCustomField'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x86'),require(_0xd8cf('0x87')));_0x318a72['use'](_0xd8cf('0x88'),require(_0xd8cf('0x89')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x8a'),require(_0xd8cf('0x8b')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x8c'),require('./api/disposition'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x8d'),require(_0xd8cf('0x8e')));_0x318a72['use'](_0xd8cf('0x8f'),require(_0xd8cf('0x90')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x91'),require(_0xd8cf('0x92')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x93'),require('./api/cdr'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x94'),require(_0xd8cf('0x95')));_0x318a72['use'](_0xd8cf('0x96'),require('./api/schedule'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x97'),require('./api/sound'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x98'),require(_0xd8cf('0x99')));_0x318a72['use'](_0xd8cf('0x9a'),require('./api/template'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x9b'),require(_0xd8cf('0x9c')));_0x318a72['use'](_0xd8cf('0x9d'),require(_0xd8cf('0x9e')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x9f'),require(_0xd8cf('0xa0')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xa1'),require(_0xd8cf('0xa2')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xa3'),require(_0xd8cf('0xa4')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xa5'),require(_0xd8cf('0xa6')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xa7'),require('./api/analyticExtractedReport'));_0x318a72[_0xd8cf('0xa')]('/api/analytics/metrics',require(_0xd8cf('0xa8')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xa9'),require(_0xd8cf('0xaa')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xab'),require(_0xd8cf('0xac')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xad'),require(_0xd8cf('0xae')));_0x318a72['use'](_0xd8cf('0xaf'),require(_0xd8cf('0xb0')));_0x318a72['use']('/api/integrations/salesforce/fields',require(_0xd8cf('0xb1')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xb2'),require(_0xd8cf('0xb3')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xb4'),require(_0xd8cf('0xb5')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xb6'),require(_0xd8cf('0xb7')));_0x318a72[_0xd8cf('0xa')]('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xb8'),require(_0xd8cf('0xb9')));_0x318a72['use'](_0xd8cf('0xba'),require('./api/intDeskField'));_0x318a72['use'](_0xd8cf('0xbb'),require('./api/intZohoAccount'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xbc'),require(_0xd8cf('0xbd')));_0x318a72[_0xd8cf('0xa')]('/api/integrations/zoho/fields',require(_0xd8cf('0xbe')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xbf'),require(_0xd8cf('0xc0')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xc1'),require(_0xd8cf('0xc2')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xc3'),require('./api/intZendeskField'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xc4'),require(_0xd8cf('0xc5')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xc6'),require('./api/intFreshdeskConfiguration'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xc7'),require(_0xd8cf('0xc8')));_0x318a72['use'](_0xd8cf('0xc9'),require('./api/intVtigerAccount'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xca'),require(_0xd8cf('0xcb')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xcc'),require(_0xd8cf('0xcd')));_0x318a72[_0xd8cf('0xa')]('/api/integrations/servicenow/accounts',require(_0xd8cf('0xce')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xcf'),require(_0xd8cf('0xd0')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xd1'),require(_0xd8cf('0xd2')));_0x318a72[_0xd8cf('0xa')]('/api/integrations/dynamics365/accounts',require(_0xd8cf('0xd3')));_0x318a72[_0xd8cf('0xa')]('/api/integrations/dynamics365/configurations',require(_0xd8cf('0xd4')));_0x318a72['use']('/api/integrations/dynamics365/fields',require(_0xd8cf('0xd5')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xd6'),require(_0xd8cf('0xd7')));_0x318a72[_0xd8cf('0xa')]('/api/integrations/freshsales/configurations',require(_0xd8cf('0xd8')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xd9'),require(_0xd8cf('0xda')));_0x318a72['use'](_0xd8cf('0xdb'),require(_0xd8cf('0xdc')));_0x318a72[_0xd8cf('0xa')]('/api/chat/reports/queue',require(_0xd8cf('0xdd')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xde'),require(_0xd8cf('0xdf')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xe0'),require(_0xd8cf('0xe1')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xe2'),require(_0xd8cf('0xe3')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xe4'),require(_0xd8cf('0xe5')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xe6'),require(_0xd8cf('0xe7')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xe8'),require(_0xd8cf('0xe9')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xea'),require(_0xd8cf('0xeb')));_0x318a72['use'](_0xd8cf('0xec'),require('./api/jscriptyProject'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xed'),require(_0xd8cf('0xee')));_0x318a72['use'](_0xd8cf('0xef'),require(_0xd8cf('0xf0')));_0x318a72[_0xd8cf('0xa')]('/api/square/projects',require(_0xd8cf('0xf1')));_0x318a72['use'](_0xd8cf('0xf2'),require(_0xd8cf('0xf3')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xf4'),require(_0xd8cf('0xf5')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xf6'),require(_0xd8cf('0xf7')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xf8'),require(_0xd8cf('0xf9')));_0x318a72[_0xd8cf('0xa')]('/api/campaigns',require(_0xd8cf('0xfa')));_0x318a72[_0xd8cf('0xa')]('/api/migrations',require(_0xd8cf('0xfb')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xfc'),require(_0xd8cf('0xfd')));_0x318a72[_0xd8cf('0xa')]('/api/plugins',require(_0xd8cf('0xfe')));_0x318a72['use']('/api/mail/reports/transfer',require(_0xd8cf('0xff')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x100'),require(_0xd8cf('0x101')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x102'),require('./api/faxTransferReport'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x103'),require(_0xd8cf('0x104')));_0x318a72[_0xd8cf('0xa')]('/api/sms/reports/transfer',require(_0xd8cf('0x105')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x106'),require(_0xd8cf('0x107')));_0x318a72[_0xd8cf('0xa')]('/api/voice/prefixes',require(_0xd8cf('0x108')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x109'),require(_0xd8cf('0x10a')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x10b'),require(_0xd8cf('0x10c')));_0x318a72[_0xd8cf('0xa')]('/api/userProfile/resources',require(_0xd8cf('0x10d')));_0x318a72[_0xd8cf('0xa')]('/api/notifications',require(_0xd8cf('0x10e')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x10f'),require(_0xd8cf('0x110')));_0x318a72['use'](_0xd8cf('0x111'),require(_0xd8cf('0x112')));_0x318a72['use'](_0xd8cf('0x113'),require('./api/whatsappApplication'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x114'),require(_0xd8cf('0x115')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x116'),require(_0xd8cf('0x117')));_0x318a72[_0xd8cf('0xa')]('/api/whatsapp/reports/queue',require(_0xd8cf('0x118')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x119'),require('./api/whatsappTransferReport'));_0x318a72['use'](_0xd8cf('0x11a'),require('./api/whatsappQueue'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x11b'),require(_0xd8cf('0x11c')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x11d'),require(_0xd8cf('0x11e')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x11f'),require(_0xd8cf('0x120')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x121'),require('./api/jira'));_0x318a72['use'](_0xd8cf('0x122'),require(_0xd8cf('0x123')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x124'),require('./api/version'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x125'),require(_0xd8cf('0x126')));_0x318a72['use']('/api/pm2',require(_0xd8cf('0x127')));_0x318a72['use'](_0xd8cf('0x128'),require('./api/webbar'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x129'),express[_0xd8cf('0x12a')](path[_0xd8cf('0x12b')](config[_0xd8cf('0x12c')],_0xd8cf('0x129'))));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x12d'),express[_0xd8cf('0x12a')](path[_0xd8cf('0x12b')](config[_0xd8cf('0x12c')],_0xd8cf('0x12d'))));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x12e'),express[_0xd8cf('0x12a')](path[_0xd8cf('0x12b')](config['root'],_0xd8cf('0x12e'))));_0x318a72[_0xd8cf('0xa')]('/snippet',express['static'](path[_0xd8cf('0x12b')](config['root'],_0xd8cf('0x12f'),_0xd8cf('0x130'))));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x131'),express[_0xd8cf('0x12a')](path['join'](config[_0xd8cf('0x12c')],_0xd8cf('0x132'))));_0x318a72[_0xd8cf('0x133')](_0xd8cf('0x134'))[_0xd8cf('0x135')](errors[0x194]);_0x318a72[_0xd8cf('0x133')]('/*')[_0xd8cf('0x135')](function(_0x243ea0,_0x868121){_0x868121[_0xd8cf('0x136')](path['resolve'](_0x318a72[_0xd8cf('0x135')]('appPath')+_0xd8cf('0x137')));});};var sensitiveFields=['username','password','newPassword',_0xd8cf('0x138'),_0xd8cf('0x139'),_0xd8cf('0x13a'),'street',_0xd8cf('0x13b'),_0xd8cf('0x13c'),_0xd8cf('0x13d'),_0xd8cf('0x13e'),_0xd8cf('0x13f'),_0xd8cf('0x140'),'securityToken',_0xd8cf('0x141'),'accessKey',_0xd8cf('0x142'),'token',_0xd8cf('0x143'),_0xd8cf('0x144'),_0xd8cf('0x145'),_0xd8cf('0x146'),'consumerKey',_0xd8cf('0x147'),'membername','calleridname',_0xd8cf('0x148'),'exten',_0xd8cf('0x149'),_0xd8cf('0x14a'),_0xd8cf('0x14b'),_0xd8cf('0x14c'),_0xd8cf('0x14d'),_0xd8cf('0x14e'),'user',_0xd8cf('0x14f'),'accountSid','localstationid',_0xd8cf('0x150'),_0xd8cf('0x151'),'registry',_0xd8cf('0x152')];function maskSensitiveData(_0x214e15){var _0x18d8c9=/(?!^)[\s\S](?!$)/g;if(!_[_0xd8cf('0x153')](_0x214e15))return;for(var _0x379824 in _0x214e15){if(_[_0xd8cf('0x154')](_0x214e15[_0x379824])){for(var _0x39654b=0x0;_0x39654b<_0x214e15[_0x379824]['length'];_0x39654b++){maskSensitiveData(_0x214e15[_0x379824][_0x39654b]);}}else if(_[_0xd8cf('0x153')](_0x214e15[_0x379824])){maskSensitiveData(_0x214e15[_0x379824]);}else if(_['isString'](_0x214e15[_0x379824])){_0x214e15[_0x379824]=_0x214e15[_0x379824][_0xd8cf('0x155')](/{{{/g,'@@{')['replace'](/}}}/g,'}@@')[_0xd8cf('0x155')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x379824)){_0x214e15[_0x379824]=_0x214e15[_0x379824][_0xd8cf('0x155')](_0x18d8c9,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index aac12a6..1d9bcd1 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1288=['../api/voiceRecording/voiceRecording.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.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/cmHopperFinal/cmHopperFinal.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.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/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','bluebird','lodash','../config/environment','../api/user/user.rpc','merge','../api/voiceQueue/voiceQueue.rpc'];(function(_0x1091eb,_0x438b24){var _0xbd8158=function(_0x1b58a9){while(--_0x1b58a9){_0x1091eb['push'](_0x1091eb['shift']());}};_0xbd8158(++_0x438b24);}(_0x1288,0x86));var _0x8128=function(_0x44cfab,_0xf35628){_0x44cfab=_0x44cfab-0x0;var _0x2fd092=_0x1288[_0x44cfab];return _0x2fd092;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x8128('0x0'));var _=require(_0x8128('0x1'));var config=require(_0x8128('0x2'));exports['listen']=function(){return new BPromise(function(_0x47b30e,_0x10b22a){var _0xdd8626={};_0xdd8626=_['merge'](_0xdd8626,require(_0x8128('0x3')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require('../api/voiceExtension/voiceExtension.rpc'));_0xdd8626=_['merge'](_0xdd8626,require(_0x8128('0x5')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x6')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require('../api/voiceCallReport/voiceCallReport.rpc'));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require('../api/voiceDialReport/voiceDialReport.rpc'));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x7')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x8')));_0xdd8626=_['merge'](_0xdd8626,require('../api/memberReport/memberReport.rpc'));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require('../api/trunk/trunk.rpc'));_0xdd8626=_['merge'](_0xdd8626,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0xdd8626=_['merge'](_0xdd8626,require('../api/mailServerIn/mailServerIn.rpc'));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x9')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require('../api/mailQueue/mailQueue.rpc'));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0xa')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0xb')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0xc')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0xd')));_0xdd8626=_['merge'](_0xdd8626,require(_0x8128('0xe')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0xf')));_0xdd8626=_['merge'](_0xdd8626,require(_0x8128('0x10')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x11')));_0xdd8626=_['merge'](_0xdd8626,require(_0x8128('0x12')));_0xdd8626=_['merge'](_0xdd8626,require(_0x8128('0x13')));_0xdd8626=_['merge'](_0xdd8626,require(_0x8128('0x14')));_0xdd8626=_['merge'](_0xdd8626,require(_0x8128('0x15')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x16')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x17')));_0xdd8626=_['merge'](_0xdd8626,require(_0x8128('0x18')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x19')));_0xdd8626=_['merge'](_0xdd8626,require(_0x8128('0x1a')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x1b')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0xdd8626=_['merge'](_0xdd8626,require(_0x8128('0x1c')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x1d')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x1e')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x1f')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x20')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x21')));_0xdd8626=_['merge'](_0xdd8626,require(_0x8128('0x22')));_0xdd8626=_['merge'](_0xdd8626,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x23')));_0xdd8626=_['merge'](_0xdd8626,require(_0x8128('0x24')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x25')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require('../api/template/template.rpc'));_0xdd8626=_['merge'](_0xdd8626,require(_0x8128('0x26')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x27')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x28')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x29')));_0xdd8626=_['merge'](_0xdd8626,require(_0x8128('0x2a')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x2b')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x2c')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x2d')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x2e')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x2f')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x30')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require('../api/chatQueueReport/chatQueueReport.rpc'));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x31')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x32')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x33')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x34')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x35')));_0xdd8626=_['merge'](_0xdd8626,require('../api/squareRecording/squareRecording.rpc'));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x36')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x37')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require('../api/attachment/attachment.rpc'));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x38')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x39')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x3a')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x3b')));_0xdd8626=_[_0x8128('0x4')](_0xdd8626,require(_0x8128('0x3c')));_0xdd8626=_['merge'](_0xdd8626,require(_0x8128('0x3d')));var _0x36a3f8=jayson[_0x8128('0x3e')](_0xdd8626)['http']();var _0x116699=config[_0x8128('0x3f')]['port']||config[_0x8128('0x40')]+0x1;var _0x14c4bc=config[_0x8128('0x3f')]['ip']||_0x8128('0x41');_0x36a3f8['on'](_0x8128('0x42'),function(_0x14246b){return _0x10b22a(_0x14246b);});_0x36a3f8[_0x8128('0x43')](_0x116699,_0x14c4bc,function(){console['log'](_0x8128('0x44'),_0x14c4bc,_0x116699);require('../config/triggers')[_0x8128('0x45')]();return _0x47b30e('RPC\x20listening\x20on\x20'+_0x14c4bc+':'+_0x116699);});});}; \ No newline at end of file +var _0x91ae=['../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','listen','../api/voiceExtension/voiceExtension.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc'];(function(_0x118069,_0x388329){var _0x16ae9e=function(_0x351922){while(--_0x351922){_0x118069['push'](_0x118069['shift']());}};_0x16ae9e(++_0x388329);}(_0x91ae,0x1a9));var _0xe91a=function(_0x75d679,_0x5b992b){_0x75d679=_0x75d679-0x0;var _0x214720=_0x91ae[_0x75d679];return _0x214720;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe91a('0x0'));var _=require(_0xe91a('0x1'));var config=require(_0xe91a('0x2'));exports[_0xe91a('0x3')]=function(){return new BPromise(function(_0x44cc8e,_0x13abeb){var _0x6bf2ae={};_0x6bf2ae=_['merge'](_0x6bf2ae,require('../api/user/user.rpc'));_0x6bf2ae=_['merge'](_0x6bf2ae,require(_0xe91a('0x4')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x6')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require('../api/voiceRecording/voiceRecording.rpc'));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x7')));_0x6bf2ae=_['merge'](_0x6bf2ae,require(_0xe91a('0x8')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x9')));_0x6bf2ae=_['merge'](_0x6bf2ae,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x6bf2ae=_['merge'](_0x6bf2ae,require('../api/memberReport/memberReport.rpc'));_0x6bf2ae=_['merge'](_0x6bf2ae,require(_0xe91a('0xa')));_0x6bf2ae=_['merge'](_0x6bf2ae,require(_0xe91a('0xb')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0xc')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0xd')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0xe')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0xf')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x10')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require('../api/mailMessage/mailMessage.rpc'));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require('../api/mailApplication/mailApplication.rpc'));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x11')));_0x6bf2ae=_['merge'](_0x6bf2ae,require(_0xe91a('0x12')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x13')));_0x6bf2ae=_['merge'](_0x6bf2ae,require(_0xe91a('0x14')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x15')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require('../api/faxQueue/faxQueue.rpc'));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x16')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x17')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x18')));_0x6bf2ae=_['merge'](_0x6bf2ae,require(_0xe91a('0x19')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require('../api/smsQueue/smsQueue.rpc'));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x1a')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x1b')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x1c')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x1d')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x1e')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require('../api/chatMessage/chatMessage.rpc'));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x1f')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x20')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require('../api/cmHopper/cmHopper.rpc'));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x21')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x22')));_0x6bf2ae=_['merge'](_0x6bf2ae,require(_0xe91a('0x23')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x24')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x25')));_0x6bf2ae=_['merge'](_0x6bf2ae,require(_0xe91a('0x26')));_0x6bf2ae=_['merge'](_0x6bf2ae,require('../api/sound/sound.rpc'));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x27')));_0x6bf2ae=_['merge'](_0x6bf2ae,require(_0xe91a('0x28')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require('../api/variable/variable.rpc'));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x29')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x2a')));_0x6bf2ae=_['merge'](_0x6bf2ae,require(_0xe91a('0x2b')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x2c')));_0x6bf2ae=_['merge'](_0x6bf2ae,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x2d')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x2e')));_0x6bf2ae=_['merge'](_0x6bf2ae,require(_0xe91a('0x2f')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x30')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require('../api/squareReport/squareReport.rpc'));_0x6bf2ae=_['merge'](_0x6bf2ae,require(_0xe91a('0x31')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x32')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x33')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require('../api/squareRecording/squareRecording.rpc'));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x34')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x35')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x36')));_0x6bf2ae=_['merge'](_0x6bf2ae,require(_0xe91a('0x37')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x38')));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x39')));_0x6bf2ae=_['merge'](_0x6bf2ae,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x6bf2ae=_[_0xe91a('0x5')](_0x6bf2ae,require(_0xe91a('0x3a')));var _0x20f11a=jayson[_0xe91a('0x3b')](_0x6bf2ae)[_0xe91a('0x3c')]();var _0x11ac7c=config['rpc']['port']||config['port']+0x1;var _0x476ced=config[_0xe91a('0x3d')]['ip']||_0xe91a('0x3e');_0x20f11a['on'](_0xe91a('0x3f'),function(_0x52f9af){return _0x13abeb(_0x52f9af);});_0x20f11a['listen'](_0x11ac7c,_0x476ced,function(){console[_0xe91a('0x40')](_0xe91a('0x41'),_0x476ced,_0x11ac7c);require(_0xe91a('0x42'))[_0xe91a('0x43')]();return _0x44cc8e(_0xe91a('0x44')+_0x476ced+':'+_0x11ac7c);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index c9e7c30..572fe14 100644 --- a/server/services/agi/channel.js +++ b/server/services/agi/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','replace','indexOf','substr','startsWith','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','function','write','inherits','sendRequest','prototype','answer','beep','format','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./error','call','utf8','setEncoding','headers','emit','ready','line'];(function(_0x3b3fdc,_0x2a8193){var _0xd680b5=function(_0x251627){while(--_0x251627){_0x3b3fdc['push'](_0x3b3fdc['shift']());}};_0xd680b5(++_0x2a8193);}(_0x34e8,0x12c));var _0x834e=function(_0x5f4213,_0x156f42){_0x5f4213=_0x5f4213-0x0;var _0x4ee289=_0x34e8[_0x5f4213];return _0x4ee289;};'use strict';var util=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x834e('0x4'));function AGIChannel(_0x21e2e0){var _0x472111=this,_0x31bf20=new AGIReply(),_0x289ef2=![],_0x19a3e0={};EventEmitter[_0x834e('0x5')](_0x472111);_0x21e2e0['setEncoding'](_0x834e('0x6'));_0x21e2e0['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x31bf20[_0x834e('0x7')](_0x834e('0x6'));_0x31bf20['on'](_0x834e('0x8'),function(_0x2e69e2){for(var _0x33ea05 in _0x2e69e2){_0x472111[_0x33ea05]=_0x2e69e2[_0x33ea05];}_0x472111[_0x834e('0x9')](_0x834e('0xa'));});_0x31bf20['on'](_0x834e('0xb'),function(_0x3bdda9){if(_0x3bdda9[_0x834e('0xc')]()==_0x834e('0xd')){_0x472111[_0x834e('0x9')](_0x834e('0xd'));return;}if(_0x3bdda9[_0x834e('0xe')](0x0,0xb)==_0x834e('0xf')){_0x289ef2=!![];}if(_0x289ef2){_0x19a3e0['rx']+=_0x3bdda9+'\x0a';if(_0x3bdda9[_0x834e('0x10')](_0x834e('0x11'))!=-0x1){_0x289ef2=![];}}else{_0x19a3e0['rx']=_0x3bdda9;}if(_0x289ef2){return;}if(typeof _0x19a3e0['cb']=='function'){var _0x5e5b6d=_0x19a3e0['rx'][_0x834e('0xe')](0x0,0x3),_0x6cd9b9=null,_0x58a27e=null;_0x5e5b6d=parseInt(_0x5e5b6d);if(isNaN(_0x5e5b6d)){_0x19a3e0['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x834e('0x12')});return;}if(_0x5e5b6d!=0xc8){_0x19a3e0['cb'](null,{'code':_0x5e5b6d,'result':-0x1,'extra':'KO'});return;}_0x6cd9b9=_0x19a3e0['rx'][_0x834e('0xe')](0x4)[_0x834e('0x13')]('result=','');if(_0x6cd9b9[_0x834e('0x14')]('\x20')!=-0x1){_0x6cd9b9=_0x6cd9b9[_0x834e('0x15')](0x0,_0x6cd9b9['indexOf']('\x20'));}if(_[_0x834e('0x16')](_0x6cd9b9,'-1')){_0x6cd9b9=parseInt(_0x6cd9b9);}_0x58a27e=_0x19a3e0['rx']['split']('\x20');if(_0x58a27e[_0x834e('0x17')]==0x3){_0x58a27e=_0x58a27e[0x2][_0x834e('0xe')](0x1,_0x58a27e[0x2]['length']-0x1);}else if(_0x58a27e[_0x834e('0x17')]>0x3){var _0x22106e=/\((.+)\)/;var _0x370fb5=_0x19a3e0['rx']['match'](_0x22106e);if(_0x370fb5){_0x58a27e=_0x370fb5[0x1];}else{_0x58a27e=null;}}else{_0x58a27e=null;}_0x19a3e0['cb'](null,{'code':_0x5e5b6d,'result':_0x6cd9b9,'extra':_0x58a27e});}});_0x21e2e0['on'](_0x834e('0x18'),function(_0x211e9a){_0x472111[_0x834e('0x9')](_0x834e('0x18'),new AGIError(_0x834e('0x19'),_0x211e9a[_0x834e('0x1a')]));});_0x21e2e0['on'](_0x834e('0x1b'),function(){_0x472111['emit'](_0x834e('0x1b'),new AGIError(_0x834e('0x1c')));});_0x21e2e0['on'](_0x834e('0x1d'),function(){_0x472111[_0x834e('0x9')]('timeout',new AGIError(_0x834e('0x1e')));_0x21e2e0[_0x834e('0x1f')]();});_0x21e2e0['pipe'](_0x31bf20);this[_0x834e('0x20')]=function(_0x28d687,_0x8d406e){var _0x28d687=_0x28d687||'',_0x8d406e=typeof _0x8d406e==_0x834e('0x21')?_0x8d406e:new Function();_0x19a3e0={'tx':_0x28d687,'rx':'','cb':_0x8d406e};_0x21e2e0[_0x834e('0x22')](_0x28d687+'\x0a');},this['close']=function(){_0x21e2e0[_0x834e('0x1f')]();};}util[_0x834e('0x23')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x834e('0x24')]=function(_0x2e1983){return this[_0x834e('0x20')]['sync'](this,_0x2e1983);};AGIChannel[_0x834e('0x25')][_0x834e('0x26')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x834e('0x25')]['getData']=function(_0x2826ec,_0x3f1b0b,_0x3db026){_0x2826ec=_0x2826ec===undefined?_0x834e('0x27'):_0x2826ec;_0x3f1b0b=_0x3f1b0b===undefined?'5':_0x3f1b0b;_0x3db026=_0x3db026===undefined?'1':_0x3db026;return this[_0x834e('0x24')](util[_0x834e('0x28')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x2826ec,_0x3f1b0b*0x3e8,_0x3db026));};AGIChannel['prototype']['noop']=function(_0x58c1d7){_0x58c1d7=_0x58c1d7||_0x834e('0x29');return this[_0x834e('0x24')](util[_0x834e('0x28')]('VERBOSE\x20\x22%s\x22',_0x58c1d7));};AGIChannel[_0x834e('0x25')][_0x834e('0x2a')]=function(_0x1f3671,_0x1e026a){if(_[_0x834e('0x2b')](_0x1e026a)){return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x2c'),_0x1f3671,_0x1e026a[_0x834e('0x2d')](',')));}return this['sendRequest'](util[_0x834e('0x28')]('EXEC\x20%s\x20%s',_0x1f3671,_0x1e026a));};AGIChannel[_0x834e('0x25')][_0x834e('0x2e')]=function(_0x9ab921){return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x2f'),_0x9ab921));};AGIChannel[_0x834e('0x25')][_0x834e('0x30')]=function(_0x358c31){return this[_0x834e('0x24')](util['format'](_0x834e('0x31'),_0x358c31));};AGIChannel[_0x834e('0x25')][_0x834e('0x32')]=function(_0xaf01f4){return this['sendRequest'](util[_0x834e('0x28')](_0x834e('0x33'),_0xaf01f4));};AGIChannel['prototype']['hangup']=function(){return this['sendRequest'](_0x834e('0x34'));};AGIChannel[_0x834e('0x25')][_0x834e('0x35')]=function(_0x34fefb,_0x339e28){var _0x1b76dd=_['isBoolean'](_0x339e28)||_[_0x834e('0x36')](_0x339e28)?_0x339e28['toString']():_0x339e28;return this[_0x834e('0x24')](util[_0x834e('0x28')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x34fefb,_0x1b76dd?_0x1b76dd[_0x834e('0x37')]()[_0x834e('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x388711,_0xd0d43a){return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x38'),_0x388711,_0xd0d43a));};AGIChannel['prototype'][_0x834e('0x39')]=function(_0x548d1d,_0x50c243){return this[_0x834e('0x24')](util['format'](_0x834e('0x3a'),_0x548d1d,_0x50c243));};AGIChannel[_0x834e('0x25')][_0x834e('0x3b')]=function(_0x3c59af,_0x2b7933){return this['sendRequest'](util[_0x834e('0x28')](_0x834e('0x3c'),_0x3c59af,_0x2b7933));};AGIChannel[_0x834e('0x25')]['continueAt']=function(_0x35380e,_0x16ac45,_0x57b89a){_0x16ac45=_0x16ac45||this[_0x834e('0x3d')];_0x57b89a=_0x57b89a||0x1;this['setContext'](_0x35380e);this[_0x834e('0x30')](_0x16ac45);this[_0x834e('0x32')](_0x57b89a);return this['noop'](util['format'](_0x834e('0x3e'),_0x35380e,_0x16ac45,_0x57b89a));};AGIChannel[_0x834e('0x25')][_0x834e('0x3f')]=function(_0xbc1571){return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x40'),_0xbc1571));};AGIChannel['prototype'][_0x834e('0x41')]=function(_0x5abb7a,_0x321efa,_0x540685,_0x1df5b0,_0x5a5807,_0x361f60){_0x321efa=_0x321efa||_0x834e('0x42');_0x540685=_0x540685||'';_0x1df5b0=_0x1df5b0===undefined?-0x1:_0x1df5b0==='-1'?-0x1:_0x1df5b0*0x3e8;_0x5a5807=_0x5a5807===undefined?'':'s='+_0x5a5807;_0x361f60=_0x361f60?'BEEP':'';return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x43'),_0x5abb7a,_0x321efa,_0x540685,_0x1df5b0,_0x361f60,_0x5a5807));};AGIChannel[_0x834e('0x25')][_0x834e('0x44')]=function(_0x1a7149,_0xfa28da){_0xfa28da=_0xfa28da||'';return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x45'),_0x1a7149,_0xfa28da));};AGIChannel['prototype'][_0x834e('0x46')]=function(_0x6fff27){return this['exec'](_0x834e('0x47'),_0x6fff27);};AGIChannel[_0x834e('0x25')][_0x834e('0x48')]=function(_0x2112d5){return this[_0x834e('0x2a')](_0x834e('0x49'),_0x2112d5);};AGIChannel['prototype']['error']=function(_0x954d4b,_0x1a5444){this[_0x834e('0x4a')](util[_0x834e('0x28')](_0x834e('0x4b'),_0x954d4b['id'],_0x954d4b[_0x834e('0x4c')],_0x1a5444));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x834e('0x4d')]=AGIChannel; \ No newline at end of file +var _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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xedd9,0xfc));var _0x9edd=function(_0x4a0ae6,_0x41898d){_0x4a0ae6=_0x4a0ae6-0x0;var _0x59f94e=_0xedd9[_0x4a0ae6];return _0x59f94e;};'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 d256735..edac147 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 _0xa0aa=['apply','message','name','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push'];(function(_0x17157e,_0x44587a){var _0x84d77a=function(_0x3819d8){while(--_0x3819d8){_0x17157e['push'](_0x17157e['shift']());}};_0x84d77a(++_0x44587a);}(_0xa0aa,0x19b));var _0xaa0a=function(_0x53f5a0,_0x3a3f1f){_0x53f5a0=_0x53f5a0-0x0;var _0x434703=_0xa0aa[_0x53f5a0];return _0x434703;};'use strict';var util=require(_0xaa0a('0x0'));var error={'E_AGI_UNDEFINED':_0xaa0a('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xaa0a('0x2'),'E_AGI_SERVER_CLOSE':_0xaa0a('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xaa0a('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xaa0a('0x5'),'E_AGI_SOCKET_ERROR':_0xaa0a('0x6'),'E_AGI_SOCKET_CLOSE':_0xaa0a('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xaa0a('0x8'),'E_AGI_COMMAND_EMPTY':_0xaa0a('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xaa0a('0xa'),'E_AGI_IVR_ENTRY':_0xaa0a('0xb')};function AGIError(_0x1ff9b4){var _0x1ff9b4=_0x1ff9b4||null,_0x1cc2da=_0x1cc2da||[],_0x5431c8=0x1,_0x18a450='';if(!error[_0x1ff9b4]){_0x1ff9b4=_0xaa0a('0xc');}_0x1cc2da[_0xaa0a('0xd')](error[_0x1ff9b4]);while(arguments[_0x5431c8]){_0x1cc2da[_0xaa0a('0xd')](arguments[_0x5431c8]);_0x5431c8++;}_0x18a450=util['format'][_0xaa0a('0xe')](util,_0x1cc2da);this[_0xaa0a('0xf')]=_0x18a450;this[_0xaa0a('0x10')]=_0x1ff9b4;}module['exports']=AGIError; \ No newline at end of file +var _0x971d=['push','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0x26fc0a,_0x116d56){var _0x55804e=function(_0x490ddd){while(--_0x490ddd){_0x26fc0a['push'](_0x26fc0a['shift']());}};_0x55804e(++_0x116d56);}(_0x971d,0xc5));var _0xd971=function(_0x18cf56,_0x23cca2){_0x18cf56=_0x18cf56-0x0;var _0x167516=_0x971d[_0x18cf56];return _0x167516;};'use strict';var util=require(_0xd971('0x0'));var error={'E_AGI_UNDEFINED':_0xd971('0x1'),'E_AGI_ARGUMENT_PORT':_0xd971('0x2'),'E_AGI_SERVER_ERROR':_0xd971('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xd971('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xd971('0x5'),'E_AGI_SOCKET_CLOSE':_0xd971('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xd971('0x7'),'E_AGI_COMMAND_EMPTY':_0xd971('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xd971('0x9'),'E_AGI_IVR_ENTRY':_0xd971('0xa')};function AGIError(_0x1c82ee){var _0x1c82ee=_0x1c82ee||null,_0xa7f2e4=_0xa7f2e4||[],_0x456076=0x1,_0x28344f='';if(!error[_0x1c82ee]){_0x1c82ee='E_AGI_UNDEFINED';}_0xa7f2e4[_0xd971('0xb')](error[_0x1c82ee]);while(arguments[_0x456076]){_0xa7f2e4[_0xd971('0xb')](arguments[_0x456076]);_0x456076++;}_0x28344f=util['format'][_0xd971('0xc')](util,_0xa7f2e4);this[_0xd971('0xd')]=_0x28344f;this[_0xd971('0xe')]=_0x1c82ee;}module[_0xd971('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 6918e85..091e2fd 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 _0x9434=['relations','getVertex','prototype','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','condition','vswitch','target','default','invalid','agicommand','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','edges','numberOfEdges','addVertex','push','size','vertices'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9434,0x168));var _0x4943=function(_0x2b1b0e,_0xaa15b8){_0x2b1b0e=_0x2b1b0e-0x0;var _0x1322dd=_0x9434[_0x2b1b0e];return _0x1322dd;};'use strict';var _=require(_0x4943('0x0'));var logger=require(_0x4943('0x1'))(_0x4943('0x2'));var verticesWithRetry=[_0x4943('0x3'),_0x4943('0x4'),_0x4943('0x5')];var Graph=function(){this['vertices']={};this[_0x4943('0x6')]={};this[_0x4943('0x7')]=0x0;};Graph['prototype'][_0x4943('0x8')]=function(_0x43b5b0){this['vertices'][_0x43b5b0['id']]=_0x43b5b0;this[_0x4943('0x6')][_0x43b5b0['id']]=[];};Graph['prototype']['addEdge']=function(_0x3ae08d,_0x2f4119,_0x1876eb){this[_0x4943('0x6')][_0x3ae08d][_0x4943('0x9')]({'target':_0x2f4119,'condition':_0x1876eb});this['numberOfEdges']+=0x1;};Graph['prototype'][_0x4943('0xa')]=function(){return _[_0x4943('0xa')](this[_0x4943('0xb')]);};Graph['prototype'][_0x4943('0xc')]=function(){return this[_0x4943('0x7')];};Graph['prototype'][_0x4943('0xd')]=function(_0x4a6943){return this['vertices'][_0x4a6943];};Graph[_0x4943('0xe')][_0x4943('0xf')]=function(_0x33fd73,_0x37a0f2){if(!this[_0x4943('0xb')][_0x33fd73]){return logger[_0x4943('0x10')](_0x4943('0x11'));}var _0x524c8a=_0x37a0f2(this[_0x4943('0xb')][_0x33fd73]);if(!_0x524c8a){return logger[_0x4943('0x10')](_0x4943('0x12'));}if(this[_0x4943('0x6')][_0x33fd73][_0x4943('0x13')]===0x0){return logger[_0x4943('0x10')]('no\x20edge/s\x20available');}for(var _0x26b707=0x0,_0x407485=[],_0xb08628=![];_0x26b707\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','stringify','joinAt','clear','vertex','gotoc','context','extension','priority','response','result','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','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]','./server','listening','connection','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./vertices','defaults','127.0.0.1','nextTick','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','error','[ERROR]\x20%s','[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','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','omit','mxCell','length','source','target','then','catch','createSquareReport','indexOf','agi_'];(function(_0x1c2478,_0x466bf3){var _0x36c4af=function(_0x3b3541){while(--_0x3b3541){_0x1c2478['push'](_0x1c2478['shift']());}};_0x36c4af(++_0x466bf3);}(_0x723e,0x179));var _0xe723=function(_0x3158d2,_0x277d23){_0x3158d2=_0x3158d2-0x0;var _0x57c15a=_0x723e[_0x3158d2];return _0x57c15a;};'use strict';var parser=require('xml2json');var _=require(_0xe723('0x0'));var syncho=require(_0xe723('0x1'));var util=require(_0xe723('0x2'));var moment=require(_0xe723('0x3'));var config=require(_0xe723('0x4'));var logger=require(_0xe723('0x5'))(_0xe723('0x6'));var utilLicense=require(_0xe723('0x7'));var rpc=require(_0xe723('0x8'));var mailRpc=require(_0xe723('0x9'));var Graph=require('./graph');var Vertices=require(_0xe723('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xe723('0x6')]=_[_0xe723('0xb')](config[_0xe723('0x6')],{'ip':_0xe723('0xc'),'port':0x11dd});function connectionHandler(_0xe50f7){process[_0xe723('0xd')](function(){syncho(function(){try{setChannelVariables(_0xe50f7);agiHandler(_0xe50f7);}catch(_0x1f07f3){logger['error'](_0x1f07f3[_0xe723('0xe')]);}});});}function listeningHandler(){console[_0xe723('0xf')](_0xe723('0x10'),config['agi'][_0xe723('0x11')]);logger[_0xe723('0x12')](util[_0xe723('0x13')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xe723('0x6')]['ip'],config[_0xe723('0x6')][_0xe723('0x11')]));}function errorHandler(_0x293f66){if(_0x293f66&&_0x293f66[_0xe723('0x14')]&&_0x293f66['message']){logger[_0xe723('0x15')](util['format']('[%s]\x20%s',_0x293f66['name'],_0x293f66['message']));}else{logger[_0xe723('0x15')](util[_0xe723('0x13')](_0xe723('0x16'),_0x293f66[_0xe723('0xe')]));}}function closeHandler(){logger[_0xe723('0x12')](util['format'](_0xe723('0x17'),this[_0xe723('0x18')],this[_0xe723('0x19')],this[_0xe723('0x1a')],this[_0xe723('0x1b')],this[_0xe723('0x1c')]));try{createSquareReport(this);}catch(_0x2cd7ca){logger[_0xe723('0x15')](_0x2cd7ca[_0xe723('0xe')]);}}function timeoutHandler(){logger[_0xe723('0x12')](util[_0xe723('0x13')](_0xe723('0x1d'),this[_0xe723('0x18')],this[_0xe723('0x19')],this['callerid'],this['dnid'],this[_0xe723('0x1c')]));}function hangupHandler(){logger[_0xe723('0x12')](util['format'](_0xe723('0x1e'),this[_0xe723('0x18')],this['calleridname'],this[_0xe723('0x1a')],this['dnid'],this[_0xe723('0x1c')]));this[_0xe723('0x1f')]=!![];}function getRoot(_0x3b82b2){return parser[_0xe723('0x20')](_0x3b82b2,{'object':!![]})[_0xe723('0x21')][_0xe723('0x22')];}function addVertex(_0x25f7d2,_0x15196c,_0x1228f2){_0x15196c[_0xe723('0x23')]=_0x1228f2;if(_0x15196c[_0xe723('0x24')](_0xe723('0x25'))){_0x15196c['maxRetry']=parseInt(_0x15196c[_0xe723('0x25')],0xa);}_0x25f7d2['addVertex'](_[_0xe723('0x26')](_0x15196c,_0xe723('0x27')));}function initGraph(_0x10de43,_0xe7e271){var _0x1f81ec=new Graph();for(var _0x598f15 in _0x10de43){if(_0x10de43[_0xe723('0x24')](_0x598f15)){if(_['isArray'](_0x10de43[_0x598f15])){for(var _0x52f919=0x0;_0x52f919<_0x10de43[_0x598f15][_0xe723('0x28')];_0x52f919+=0x1){addVertex(_0x1f81ec,_0x10de43[_0x598f15][_0x52f919],_0x598f15);}}else{addVertex(_0x1f81ec,_0x10de43[_0x598f15],_0x598f15);}}}for(var _0x511c74=0x0;_0x511c74<_0xe7e271[_0xe723('0x28')];_0x511c74+=0x1){if(_0xe7e271[_0x511c74][_0xe723('0x29')]&&_0xe7e271[_0x511c74][_0xe723('0x2a')]){_0x1f81ec['addEdge'](_0xe7e271[_0x511c74][_0xe723('0x29')],_0xe7e271[_0x511c74][_0xe723('0x2a')],_0xe7e271[_0x511c74]['value']);}}return _0x1f81ec;}function getSquareProject(_0x3c8c56,_0x5594f7){rpc['getSquareProject'](_0x3c8c56)[_0xe723('0x2b')](function(_0x2c2240){_0x5594f7(null,_0x2c2240);})[_0xe723('0x2c')](function(_0x2b0882){_0x5594f7(null,_0x2b0882);});}function createSquareReport(_0x49788a,_0x57efec){rpc[_0xe723('0x2d')](_0x49788a)['then'](function(_0x3855c7){if(_0x57efec){_0x57efec(null,_0x3855c7);}})[_0xe723('0x2c')](function(_0x398054){if(_0x57efec){_0x57efec(null,_0x398054);}});}function setChannelVariables(_0xb91a9c){for(var _0x8ced18 in _0xb91a9c){if(_0xb91a9c[_0xe723('0x24')](_0x8ced18)){if(_0x8ced18[_0xe723('0x2e')](_0xe723('0x2f'))===0x0){_0xb91a9c[_0x8ced18[_0xe723('0x30')](0x4)]=_0xb91a9c[_0x8ced18];delete _0xb91a9c[_0x8ced18];}}}}function getLogFromObject(_0x31841c){return util[_0xe723('0x31')](_0x31841c,{'showHidden':![],'depth':null});}function agiHandler(_0x208925){var _0x27e078,_0x71de02,_0x5685d1,_0x3153d2,_0x4bc1a1;logger[_0xe723('0x32')](_0xe723('0x33'),JSON['stringify'](_0x208925,null,0x2));logger['info'](util[_0xe723('0x13')](_0xe723('0x34'),_0x208925[_0xe723('0x18')],_0x208925[_0xe723('0x19')],_0x208925[_0xe723('0x1a')],_0x208925[_0xe723('0x1b')],_0x208925['uniqueid']));_0x208925['on'](_0xe723('0x15'),errorHandler);_0x208925['on'](_0xe723('0x35'),closeHandler);_0x208925['on'](_0xe723('0x36'),timeoutHandler);_0x208925[_0xe723('0x1f')]=![];_0x208925['on'](_0xe723('0x37'),hangupHandler);var _0x37bb5d=getSquareProject[_0xe723('0x38')](null,_0x208925[_0xe723('0x18')]);if(_0x37bb5d){if(_0x37bb5d[_0xe723('0x39')]){_0x27e078=getRoot(_0x37bb5d[_0xe723('0x39')]);if(_0x27e078&&_0x27e078[_0xe723('0x3a')]){logger[_0xe723('0x32')](_0xe723('0x22'),JSON[_0xe723('0x3b')](_0x27e078,null,0x2));_0x208925[_0xe723('0x3c')]=moment()[_0xe723('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x71de02=initGraph(_[_0xe723('0x26')](_0x27e078,_0xe723('0x27')),_0x27e078[_0xe723('0x27')]);_0x5685d1=new Vertices(_0x208925,rpc,mailRpc);logger[_0xe723('0x12')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x208925[_0xe723('0x18')],_0x208925[_0xe723('0x19')],_0x208925[_0xe723('0x1a')],_0x208925[_0xe723('0x1b')],_0x208925['uniqueid']));_0x71de02['traverseBFS'](_0x27e078[_0xe723('0x3a')]['id'],function(_0x2f1618){try{_0x2f1618=_0x5685d1[_0xe723('0x3d')](_0x2f1618);logger[_0xe723('0x32')](_0xe723('0x3e'),JSON[_0xe723('0x3b')](_0x2f1618,null,0x2));if(_0x2f1618[_0xe723('0x23')]===_0xe723('0x3f')){logger[_0xe723('0x12')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x208925['context']=_0x2f1618[_0xe723('0x40')]||_0x208925['context'];_0x208925['extension']=_0x2f1618[_0xe723('0x41')];_0x208925['priority']=_0x2f1618[_0xe723('0x42')]?_0x2f1618[_0xe723('0x42')]-0x1:0x1;return null;}else if(_0x2f1618&&_0x5685d1[_0x2f1618[_0xe723('0x23')]]){_0x4bc1a1=_0x5685d1[_0x2f1618[_0xe723('0x23')]](_0x2f1618);logger[_0xe723('0x12')](_0xe723('0x43'),JSON[_0xe723('0x3b')](_0x4bc1a1,null,0x2));if(_0x4bc1a1&&_0x4bc1a1['code']===AGI_CODE_SUCCESS&&_0x4bc1a1['result']!==AGI_RESULT_ERROR&&!_0x208925[_0xe723('0x1f')]){logger['debug'](_0xe723('0x43'),getLogFromObject(_0x4bc1a1));return _['isUndefined'](_0x4bc1a1[_0xe723('0x44')])?null:_0x4bc1a1[_0xe723('0x44')][_0xe723('0x45')]();}else{logger[_0xe723('0x15')](_0xe723('0x43'),getLogFromObject(_0x4bc1a1));return null;}}else{logger[_0xe723('0x15')](_0xe723('0x46'));return null;}}catch(_0xbeaa53){logger[_0xe723('0x15')](_0xbeaa53['stack']);return null;}});if(_0x27e078['finally']){logger[_0xe723('0x12')](util[_0xe723('0x13')](_0xe723('0x47'),_0x208925['arg_1'],_0x208925['calleridname'],_0x208925['callerid'],_0x208925[_0xe723('0x1b')],_0x208925[_0xe723('0x1c')]));_0x71de02[_0xe723('0x48')](_0x27e078['finally']['id'],function(_0x284c96){try{_0x284c96=_0x5685d1[_0xe723('0x3d')](_0x284c96);logger[_0xe723('0x32')](_0xe723('0x3e'),JSON[_0xe723('0x3b')](_0x284c96,null,0x2));if(_0x284c96&&_0x5685d1[_0x284c96['agicommand']]){_0x4bc1a1=_0x5685d1[_0x284c96[_0xe723('0x23')]](_0x284c96);if(_0x4bc1a1){logger['debug'](_0xe723('0x43'),getLogFromObject(_0x4bc1a1));return _['isUndefined'](_0x4bc1a1['result'])?null:_0x4bc1a1[_0xe723('0x44')][_0xe723('0x45')]();}else{logger[_0xe723('0x15')]('response',getLogFromObject(_0x4bc1a1));return null;}}else{logger[_0xe723('0x15')]('agicommand\x20not\x20found');return null;}}catch(_0x467cbd){logger[_0xe723('0x15')](_0x467cbd[_0xe723('0xe')]);return null;}});}logger[_0xe723('0x12')](util[_0xe723('0x13')](_0xe723('0x49'),_0x208925[_0xe723('0x18')],_0x208925[_0xe723('0x19')],_0x208925[_0xe723('0x1a')],_0x208925['dnid'],_0x208925[_0xe723('0x1c')]));logger[_0xe723('0x12')](util['format'](_0xe723('0x4a'),_0x208925[_0xe723('0x40')],_0x208925['extension'],parseInt(_0x208925[_0xe723('0x42')],0xa)+0x1));_0x208925['continueAt'](_0x208925['context'],_0x208925[_0xe723('0x41')],parseInt(_0x208925[_0xe723('0x42')],0xa)+0x1);_0x208925[_0xe723('0x35')]();}}else{logger[_0xe723('0x15')](util[_0xe723('0x13')]('Project\x20%s\x20not\x20published',_0x208925[_0xe723('0x18')]));_0x208925[_0xe723('0x4b')](_0x208925[_0xe723('0x40')],_0x208925[_0xe723('0x41')],parseInt(_0x208925[_0xe723('0x42')],0xa)+0x1);_0x208925[_0xe723('0x35')]();}}else{logger[_0xe723('0x15')](util[_0xe723('0x13')](_0xe723('0x4c'),_0x208925[_0xe723('0x18')]));_0x208925['continueAt'](_0x208925[_0xe723('0x40')],_0x208925[_0xe723('0x41')],parseInt(_0x208925[_0xe723('0x42')],0xa)+0x1);_0x208925[_0xe723('0x35')]();}}function main(){var _0x4d0394;return utilLicense[_0xe723('0x4d')]()[_0xe723('0x2b')](function(_0x4a1337){if(_0x4a1337){if(_0x4a1337[_0xe723('0x4e')]){if(_0x4a1337[_0xe723('0x4f')]&&_0x4a1337[_0xe723('0x4f')]>0x0){logger[_0xe723('0x12')](util[_0xe723('0x13')](_0xe723('0x50'),_0x4a1337['callysquare']));_0x4d0394=_0x4a1337[_0xe723('0x4f')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xe723('0x12')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x4d0394=-0x1;}}})[_0xe723('0x2c')](function(_0x2ef56d){logger[_0xe723('0x15')](_0xe723('0x51'),_0x2ef56d[_0xe723('0xe')]);})['finally'](function(){var _0x1d8090=require(_0xe723('0x52'))(config[_0xe723('0x6')]['port'],config['agi']['ip'],_0x4d0394);_0x1d8090['on'](_0xe723('0x15'),errorHandler);_0x1d8090['on'](_0xe723('0x53'),listeningHandler);_0x1d8090['on'](_0xe723('0x54'),connectionHandler);_0x1d8090['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x98a8=['context','extension','priority','code','result','response','isUndefined','toString','finally','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','close','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','agi','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','format','[ERROR]\x20%s','arg_1','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','source','target','value','getSquareProject','then','catch','createSquareReport','substring','inspect','debug','variables','stringify','timeout','evtHangup','hangup','production','joinAt','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS'];(function(_0x5146e9,_0x539fea){var _0x36be24=function(_0x4dc2d8){while(--_0x4dc2d8){_0x5146e9['push'](_0x5146e9['shift']());}};_0x36be24(++_0x539fea);}(_0x98a8,0x12c));var _0x898a=function(_0x50f300,_0x501d61){_0x50f300=_0x50f300-0x0;var _0x2c05b5=_0x98a8[_0x50f300];return _0x2c05b5;};'use strict';var parser=require(_0x898a('0x0'));var _=require(_0x898a('0x1'));var syncho=require(_0x898a('0x2'));var util=require(_0x898a('0x3'));var moment=require(_0x898a('0x4'));var config=require(_0x898a('0x5'));var logger=require(_0x898a('0x6'))('agi');var utilLicense=require(_0x898a('0x7'));var rpc=require(_0x898a('0x8'));var mailRpc=require(_0x898a('0x9'));var Graph=require(_0x898a('0xa'));var Vertices=require(_0x898a('0xb'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x898a('0xc')](config['agi'],{'ip':_0x898a('0xd'),'port':0x11dd});function connectionHandler(_0x4fbce5){process[_0x898a('0xe')](function(){syncho(function(){try{setChannelVariables(_0x4fbce5);agiHandler(_0x4fbce5);}catch(_0x283c5){logger[_0x898a('0xf')](_0x283c5[_0x898a('0x10')]);}});});}function listeningHandler(){console[_0x898a('0x11')](_0x898a('0x12'),config[_0x898a('0x13')][_0x898a('0x14')]);logger[_0x898a('0x15')](util['format'](_0x898a('0x16'),config['agi']['ip'],config[_0x898a('0x13')]['port']));}function errorHandler(_0x25d7f2){if(_0x25d7f2&&_0x25d7f2[_0x898a('0x17')]&&_0x25d7f2[_0x898a('0x18')]){logger['error'](util['format']('[%s]\x20%s',_0x25d7f2[_0x898a('0x17')],_0x25d7f2[_0x898a('0x18')]));}else{logger[_0x898a('0xf')](util[_0x898a('0x19')](_0x898a('0x1a'),_0x25d7f2[_0x898a('0x10')]));}}function closeHandler(){logger['info'](util[_0x898a('0x19')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x898a('0x1b')],this['calleridname'],this[_0x898a('0x1c')],this['dnid'],this[_0x898a('0x1d')]));try{createSquareReport(this);}catch(_0x56f8f9){logger[_0x898a('0xf')](_0x56f8f9[_0x898a('0x10')]);}}function timeoutHandler(){logger[_0x898a('0x15')](util['format'](_0x898a('0x1e'),this['arg_1'],this['calleridname'],this[_0x898a('0x1c')],this[_0x898a('0x1f')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0x898a('0x19')](_0x898a('0x20'),this[_0x898a('0x1b')],this[_0x898a('0x21')],this[_0x898a('0x1c')],this[_0x898a('0x1f')],this[_0x898a('0x1d')]));this['evtHangup']=!![];}function getRoot(_0x247cfc){return parser[_0x898a('0x22')](_0x247cfc,{'object':!![]})[_0x898a('0x23')][_0x898a('0x24')];}function addVertex(_0x30495a,_0x310bfa,_0x4e254d){_0x310bfa[_0x898a('0x25')]=_0x4e254d;if(_0x310bfa[_0x898a('0x26')](_0x898a('0x27'))){_0x310bfa[_0x898a('0x28')]=parseInt(_0x310bfa[_0x898a('0x27')],0xa);}_0x30495a[_0x898a('0x29')](_['omit'](_0x310bfa,_0x898a('0x2a')));}function initGraph(_0x51d501,_0x513c6b){var _0x53ddb2=new Graph();for(var _0x3678be in _0x51d501){if(_0x51d501[_0x898a('0x26')](_0x3678be)){if(_[_0x898a('0x2b')](_0x51d501[_0x3678be])){for(var _0x40b3db=0x0;_0x40b3db<_0x51d501[_0x3678be][_0x898a('0x2c')];_0x40b3db+=0x1){addVertex(_0x53ddb2,_0x51d501[_0x3678be][_0x40b3db],_0x3678be);}}else{addVertex(_0x53ddb2,_0x51d501[_0x3678be],_0x3678be);}}}for(var _0x2efde2=0x0;_0x2efde2<_0x513c6b[_0x898a('0x2c')];_0x2efde2+=0x1){if(_0x513c6b[_0x2efde2][_0x898a('0x2d')]&&_0x513c6b[_0x2efde2][_0x898a('0x2e')]){_0x53ddb2['addEdge'](_0x513c6b[_0x2efde2]['source'],_0x513c6b[_0x2efde2]['target'],_0x513c6b[_0x2efde2][_0x898a('0x2f')]);}}return _0x53ddb2;}function getSquareProject(_0x62fe93,_0x3b7704){rpc[_0x898a('0x30')](_0x62fe93)[_0x898a('0x31')](function(_0x560000){_0x3b7704(null,_0x560000);})[_0x898a('0x32')](function(_0xf74645){_0x3b7704(null,_0xf74645);});}function createSquareReport(_0x18773a,_0x4287da){rpc[_0x898a('0x33')](_0x18773a)[_0x898a('0x31')](function(_0x494127){if(_0x4287da){_0x4287da(null,_0x494127);}})[_0x898a('0x32')](function(_0x17a5f3){if(_0x4287da){_0x4287da(null,_0x17a5f3);}});}function setChannelVariables(_0x26eead){for(var _0x17a980 in _0x26eead){if(_0x26eead[_0x898a('0x26')](_0x17a980)){if(_0x17a980['indexOf']('agi_')===0x0){_0x26eead[_0x17a980[_0x898a('0x34')](0x4)]=_0x26eead[_0x17a980];delete _0x26eead[_0x17a980];}}}}function getLogFromObject(_0x1e2fd4){return util[_0x898a('0x35')](_0x1e2fd4,{'showHidden':![],'depth':null});}function agiHandler(_0x4de9bf){var _0x105477,_0x339eb4,_0x5eafc7,_0x2d3b3a,_0x41cd46;logger[_0x898a('0x36')](_0x898a('0x37'),JSON[_0x898a('0x38')](_0x4de9bf,null,0x2));logger['info'](util[_0x898a('0x19')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4de9bf['arg_1'],_0x4de9bf[_0x898a('0x21')],_0x4de9bf['callerid'],_0x4de9bf[_0x898a('0x1f')],_0x4de9bf['uniqueid']));_0x4de9bf['on'](_0x898a('0xf'),errorHandler);_0x4de9bf['on']('close',closeHandler);_0x4de9bf['on'](_0x898a('0x39'),timeoutHandler);_0x4de9bf[_0x898a('0x3a')]=![];_0x4de9bf['on'](_0x898a('0x3b'),hangupHandler);var _0x50c0e4=getSquareProject['sync'](null,_0x4de9bf['arg_1']);if(_0x50c0e4){if(_0x50c0e4[_0x898a('0x3c')]){_0x105477=getRoot(_0x50c0e4[_0x898a('0x3c')]);if(_0x105477&&_0x105477['start']){logger[_0x898a('0x36')](_0x898a('0x24'),JSON[_0x898a('0x38')](_0x105477,null,0x2));_0x4de9bf[_0x898a('0x3d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x339eb4=initGraph(_[_0x898a('0x3e')](_0x105477,_0x898a('0x2a')),_0x105477['mxCell']);_0x5eafc7=new Vertices(_0x4de9bf,rpc,mailRpc);logger['info'](util[_0x898a('0x19')](_0x898a('0x3f'),_0x4de9bf[_0x898a('0x1b')],_0x4de9bf[_0x898a('0x21')],_0x4de9bf['callerid'],_0x4de9bf[_0x898a('0x1f')],_0x4de9bf[_0x898a('0x1d')]));_0x339eb4['traverseBFS'](_0x105477['start']['id'],function(_0x48cc85){try{_0x48cc85=_0x5eafc7[_0x898a('0x40')](_0x48cc85);logger[_0x898a('0x36')](_0x898a('0x41'),JSON[_0x898a('0x38')](_0x48cc85,null,0x2));if(_0x48cc85[_0x898a('0x25')]===_0x898a('0x42')){logger[_0x898a('0x15')](_0x898a('0x43'));_0x4de9bf[_0x898a('0x44')]=_0x48cc85[_0x898a('0x44')]||_0x4de9bf[_0x898a('0x44')];_0x4de9bf[_0x898a('0x45')]=_0x48cc85[_0x898a('0x45')];_0x4de9bf[_0x898a('0x46')]=_0x48cc85[_0x898a('0x46')]?_0x48cc85['priority']-0x1:0x1;return null;}else if(_0x48cc85&&_0x5eafc7[_0x48cc85[_0x898a('0x25')]]){_0x41cd46=_0x5eafc7[_0x48cc85[_0x898a('0x25')]](_0x48cc85);logger[_0x898a('0x15')]('response',JSON[_0x898a('0x38')](_0x41cd46,null,0x2));if(_0x41cd46&&_0x41cd46[_0x898a('0x47')]===AGI_CODE_SUCCESS&&_0x41cd46[_0x898a('0x48')]!==AGI_RESULT_ERROR&&!_0x4de9bf[_0x898a('0x3a')]){logger[_0x898a('0x36')](_0x898a('0x49'),getLogFromObject(_0x41cd46));return _[_0x898a('0x4a')](_0x41cd46[_0x898a('0x48')])?null:_0x41cd46['result'][_0x898a('0x4b')]();}else{logger[_0x898a('0xf')](_0x898a('0x49'),getLogFromObject(_0x41cd46));return null;}}else{logger[_0x898a('0xf')]('agicommand\x20not\x20found');return null;}}catch(_0x3d5fba){logger[_0x898a('0xf')](_0x3d5fba['stack']);return null;}});if(_0x105477[_0x898a('0x4c')]){logger['info'](util[_0x898a('0x19')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4de9bf['arg_1'],_0x4de9bf[_0x898a('0x21')],_0x4de9bf['callerid'],_0x4de9bf[_0x898a('0x1f')],_0x4de9bf[_0x898a('0x1d')]));_0x339eb4['traverseBFS'](_0x105477[_0x898a('0x4c')]['id'],function(_0x304bd8){try{_0x304bd8=_0x5eafc7['clear'](_0x304bd8);logger[_0x898a('0x36')](_0x898a('0x41'),JSON[_0x898a('0x38')](_0x304bd8,null,0x2));if(_0x304bd8&&_0x5eafc7[_0x304bd8[_0x898a('0x25')]]){_0x41cd46=_0x5eafc7[_0x304bd8['agicommand']](_0x304bd8);if(_0x41cd46){logger[_0x898a('0x36')](_0x898a('0x49'),getLogFromObject(_0x41cd46));return _['isUndefined'](_0x41cd46[_0x898a('0x48')])?null:_0x41cd46[_0x898a('0x48')]['toString']();}else{logger[_0x898a('0xf')]('response',getLogFromObject(_0x41cd46));return null;}}else{logger[_0x898a('0xf')](_0x898a('0x4d'));return null;}}catch(_0x32ccb9){logger['error'](_0x32ccb9[_0x898a('0x10')]);return null;}});}logger[_0x898a('0x15')](util[_0x898a('0x19')](_0x898a('0x4e'),_0x4de9bf['arg_1'],_0x4de9bf[_0x898a('0x21')],_0x4de9bf['callerid'],_0x4de9bf[_0x898a('0x1f')],_0x4de9bf[_0x898a('0x1d')]));logger[_0x898a('0x15')](util['format'](_0x898a('0x4f'),_0x4de9bf[_0x898a('0x44')],_0x4de9bf[_0x898a('0x45')],parseInt(_0x4de9bf['priority'],0xa)+0x1));_0x4de9bf['continueAt'](_0x4de9bf[_0x898a('0x44')],_0x4de9bf[_0x898a('0x45')],parseInt(_0x4de9bf[_0x898a('0x46')],0xa)+0x1);_0x4de9bf[_0x898a('0x50')]();}}else{logger[_0x898a('0xf')](util[_0x898a('0x19')](_0x898a('0x51'),_0x4de9bf[_0x898a('0x1b')]));_0x4de9bf[_0x898a('0x52')](_0x4de9bf[_0x898a('0x44')],_0x4de9bf[_0x898a('0x45')],parseInt(_0x4de9bf['priority'],0xa)+0x1);_0x4de9bf[_0x898a('0x50')]();}}else{logger[_0x898a('0xf')](util['format'](_0x898a('0x53'),_0x4de9bf['arg_1']));_0x4de9bf['continueAt'](_0x4de9bf[_0x898a('0x44')],_0x4de9bf[_0x898a('0x45')],parseInt(_0x4de9bf[_0x898a('0x46')],0xa)+0x1);_0x4de9bf['close']();}}function main(){var _0x556fd8;return utilLicense[_0x898a('0x54')]()[_0x898a('0x31')](function(_0x515725){if(_0x515725){if(_0x515725[_0x898a('0x55')]){if(_0x515725[_0x898a('0x56')]&&_0x515725['callysquare']>0x0){logger[_0x898a('0x15')](util[_0x898a('0x19')](_0x898a('0x57'),_0x515725['callysquare']));_0x556fd8=_0x515725[_0x898a('0x56')];}else{logger[_0x898a('0x15')](_0x898a('0x58'));}}else{logger[_0x898a('0x15')](_0x898a('0x59'));_0x556fd8=-0x1;}}})[_0x898a('0x32')](function(_0x4cd6fa){logger[_0x898a('0xf')]('[LICENSE]',_0x4cd6fa[_0x898a('0x10')]);})[_0x898a('0x4c')](function(){var _0x15b203=require(_0x898a('0x5a'))(config[_0x898a('0x13')][_0x898a('0x14')],config[_0x898a('0x13')]['ip'],_0x556fd8);_0x15b203['on'](_0x898a('0xf'),errorHandler);_0x15b203['on'](_0x898a('0x5b'),listeningHandler);_0x15b203['on']('connection',connectionHandler);_0x15b203['on'](_0x898a('0x50'),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 b88ba5f..0ab30c3 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 _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x168134,_0x3493ec){var _0x557016=function(_0x3cdb92){while(--_0x3cdb92){_0x168134['push'](_0x168134['shift']());}};_0x557016(++_0x3493ec);}(_0x814b,0x1a2));var _0xb814=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0x814b[_0x4d8666];return _0x37175b;};'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 +var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x8e069c,_0x29042b){var _0x1c76f6=function(_0x2acbe6){while(--_0x2acbe6){_0x8e069c['push'](_0x8e069c['shift']());}};_0x1c76f6(++_0x29042b);}(_0x814b,0x1a2));var _0xb814=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x814b[_0x29d915];return _0x160f86;};'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 1d0da79..0f8f06b 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x3cf89d,_0x5c6c79){var _0x237ccf=function(_0x511e62){while(--_0x511e62){_0x3cf89d['push'](_0x3cf89d['shift']());}};_0x237ccf(++_0x5c6c79);}(_0x7a54,0x106));var _0x47a5=function(_0x2944ff,_0x2bcb92){_0x2944ff=_0x2944ff-0x0;var _0x446923=_0x7a54[_0x2944ff];return _0x446923;};'use strict';var util=require(_0x47a5('0x0'));var Transform=require(_0x47a5('0x1'))[_0x47a5('0x2')];function AGIReply(_0x58157c){Transform[_0x47a5('0x3')](this,_0x58157c);this[_0x47a5('0x4')]='';this['_inBody']=![];}util[_0x47a5('0x5')](AGIReply,Transform);AGIReply[_0x47a5('0x6')][_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){var _0x3d5629='\x0a',_0x59199c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x343372=-0x1,_0x30e405=-0x1,_0x506eda='',_0x194fb0=0x0,_0x5077f3='',_0x5d90b3='';this[_0x47a5('0x4')]+=_0x3717e1[_0x47a5('0x8')]();_0x5077f3=this['_localBuffer'];if(!this[_0x47a5('0x9')]){_0x194fb0=0x0;while(_0x59199c[_0x194fb0]){while((_0x30e405=_0x5077f3['indexOf'](_0x59199c[_0x194fb0]))!=-0x1){_0x506eda=_0x59199c[_0x194fb0];_0x5d90b3=_0x5077f3['substring'](0x0,_0x30e405);_0x5077f3=_0x5077f3[_0x47a5('0xa')](_0x30e405+_0x506eda[_0x47a5('0xb')]);var _0x2f399b=_0x5d90b3[_0x47a5('0xc')](_0x3d5629),_0x250fad=0x0,_0xd612dd={},_0xd308b8='',_0x1eae59='',_0x5beb89=-0x1;while(_0x2f399b[_0x250fad]){_0x5beb89=_0x2f399b[_0x250fad][_0x47a5('0xd')](':');if(_0x5beb89!=-0x1){_0xd308b8=_0x2f399b[_0x250fad][_0x47a5('0xe')](0x0,_0x5beb89)[_0x47a5('0xf')]();_0x1eae59=_0x2f399b[_0x250fad][_0x47a5('0xe')](_0x5beb89+0x1)[_0x47a5('0xf')]();if(_0xd308b8[_0x47a5('0xb')]>0x0){_0xd612dd[_0xd308b8]=_0x1eae59;}}else{}_0x250fad++;}this[_0x47a5('0x10')]('headers',_0xd612dd);this[_0x47a5('0x9')]=!![];}_0x194fb0++;}this[_0x47a5('0x4')]=_0x5077f3;}else{while((_0x343372=_0x5077f3[_0x47a5('0xd')](_0x3d5629))!=-0x1){_0x5d90b3=_0x5077f3[_0x47a5('0xa')](0x0,_0x343372);this[_0x47a5('0x10')]('line',_0x5d90b3);_0x5077f3=_0x5077f3['substring'](_0x343372+_0x3d5629[_0x47a5('0xb')]);}this['_localBuffer']=_0x5077f3;}_0x545a97();};module['exports']=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x5a17d6,_0x514820){var _0x409d71=function(_0x583acd){while(--_0x583acd){_0x5a17d6['push'](_0x5a17d6['shift']());}};_0x409d71(++_0x514820);}(_0x5f2f,0x73));var _0xf5f2=function(_0x16d5f4,_0x1ab868){_0x16d5f4=_0x16d5f4-0x0;var _0x1c1235=_0x5f2f[_0x16d5f4];return _0x1c1235;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 69bf0f5..4351aed 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 _0x1658=['createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','bluebird','util','client','http','request','then','error','message','result','getSquareProject','ShowSquareProject','production','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getTrunkById','ShowTrunk','ShowSound','getIntervalById','ShowInterval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','CreateSquareMessage'];(function(_0x583bf0,_0x4b59aa){var _0x210ec6=function(_0x3a7abb){while(--_0x3a7abb){_0x583bf0['push'](_0x583bf0['shift']());}};_0x210ec6(++_0x4b59aa);}(_0x1658,0x163));var _0x8165=function(_0x1c9e47,_0x854f95){_0x1c9e47=_0x1c9e47-0x0;var _0x2a8c79=_0x1658[_0x1c9e47];return _0x2a8c79;};'use strict';var BPromise=require(_0x8165('0x0'));var moment=require('moment');var _=require('lodash');var util=require(_0x8165('0x1'));var jayson=require('jayson/promise');var client=jayson[_0x8165('0x2')][_0x8165('0x3')]({'port':0x2329});function request(_0x278173,_0x355570){return new BPromise(function(_0x4bf4c4,_0x4cc442){return client[_0x8165('0x4')](_0x278173,_0x355570)[_0x8165('0x5')](function(_0x31bc86){if(_0x31bc86[_0x8165('0x6')]){return _0x4cc442(_0x31bc86[_0x8165('0x6')][_0x8165('0x7')]);}else{return _0x4bf4c4(_0x31bc86[_0x8165('0x8')]);}})['catch'](function(_0x408f49){return _0x4cc442(_0x408f49);});});}exports[_0x8165('0x9')]=function(_0x122621){return request(_0x8165('0xa'),{'options':{'raw':![],'where':{'name':_0x122621},'attributes':[_0x8165('0xb')]}});};exports['getMailAccountById']=function(_0x3fbd1c){return request(_0x8165('0xc'),{'options':{'raw':![],'where':{'id':_0x3fbd1c},'include':[{'model':_0x8165('0xd'),'as':_0x8165('0xe')}],'attributes':['id',_0x8165('0xf'),_0x8165('0x10')]}});};exports[_0x8165('0x11')]=function(_0x530b87){return request(_0x8165('0xa'),{'options':{'where':{'id':_0x530b87},'attributes':[_0x8165('0xf')]}});};exports[_0x8165('0x12')]=function(_0x1a87c7){return request(_0x8165('0x13'),{'options':{'where':{'id':_0x1a87c7},'attributes':[_0x8165('0xf')]}});};exports[_0x8165('0x14')]=function(_0x4a0360){return request(_0x8165('0x15'),{'options':{'where':{'id':_0x4a0360},'attributes':[_0x8165('0xf')]}});};exports[_0x8165('0x16')]=function(_0x32dca1){return request(_0x8165('0x17'),{'options':{'where':{'id':_0x32dca1},'attributes':[_0x8165('0x18')]}});};exports[_0x8165('0x19')]=function(_0x4f1726){return request('ShowUser',{'options':{'where':{'id':_0x4f1726},'attributes':['name']}});};exports[_0x8165('0x1a')]=function(_0x2ad382){return request(_0x8165('0x1b'),{'options':{'where':{'id':_0x2ad382},'attributes':['name']}});};exports['getSoundById']=function(_0x7af06){return request(_0x8165('0x1c'),{'options':{'where':{'id':_0x7af06},'attributes':['save_name']}});};exports[_0x8165('0x1d')]=function(_0x15caf4){return request(_0x8165('0x1e'),{'options':{'raw':![],'where':{'id':_0x15caf4},'include':[{'model':'Interval','as':_0x8165('0x1f')}]}});};exports['getSmsAccountById']=function(_0x3161e4){return request(_0x8165('0x20'),{'options':{'where':{'id':_0x3161e4},'attributes':['id','name']}});};exports[_0x8165('0x21')]=function(_0x2a67f7){return request(_0x8165('0x22'),{'body':_0x2a67f7});};exports[_0x8165('0x23')]=function(_0x3ae036){return request(_0x8165('0x24'),{'body':_0x3ae036});};exports['createSquareReport']=function(_0xb1dfaa){return request('CreateSquareReport',{'body':_[_0x8165('0x25')](_0xb1dfaa,{'project_name':_0xb1dfaa[_0x8165('0x26')],'prev_project_name':_0xb1dfaa[_0x8165('0x27')]||'','is_subproject':_0xb1dfaa[_0x8165('0x27')]?!![]:![],'leaveAt':moment()[_0x8165('0x28')](_0x8165('0x29'))})});};exports['createSquareRecording']=function(_0x47fe99){return request(_0x8165('0x2a'),{'body':_0x47fe99});};exports['createSquareMessage']=function(_0x5e1be9){return request(_0x8165('0x2b'),{'body':_0x5e1be9});};exports[_0x8165('0x2c')]=function(_0x155ed0){return request(_0x8165('0x2d'),{'options':{'raw':![],'where':{'phone':_0x155ed0[_0x8165('0x2e')],'ListId':_0x155ed0[_0x8165('0x2f')]}}})[_0x8165('0x5')](function(_0x7c1b01){if(_0x7c1b01){return _0x7c1b01;}return request(_0x8165('0x30'),{'body':_0x155ed0});});};exports[_0x8165('0x31')]=function(_0xceb710){return request(_0x8165('0x32'),{'options':{'where':{'id':_0xceb710},'attributes':[_0x8165('0xf')]}});};exports['agentLogin']=function(_0x517cb6,_0x44f2cb){return request(_0x8165('0x33'),{'body':{'interface':_0x44f2cb},'options':{'where':_0x517cb6}});};exports[_0x8165('0x34')]=function(_0x49ef66,_0x311a0f,_0x4bd29f){return request(_0x8165('0x35'),{'body':{'type':_0x311a0f,'uniqueid':_0x4bd29f},'options':{'where':_0x49ef66}});};exports[_0x8165('0x36')]=function(_0x453c35){return request(_0x8165('0x37'),{'body':{},'options':{'where':_0x453c35}});};exports[_0x8165('0x38')]=function(_0x2d017b){return request('LogoutUser',{'body':{},'options':{'where':_0x2d017b}});}; \ No newline at end of file +var _0xcade=['agentUnpause','UnpauseUser','LogoutUser','moment','util','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','MailServerOut','Smtp','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getUserById','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','PauseUser'];(function(_0x367cc7,_0x27f6f7){var _0x4a2c56=function(_0x5168d5){while(--_0x5168d5){_0x367cc7['push'](_0x367cc7['shift']());}};_0x4a2c56(++_0x27f6f7);}(_0xcade,0xab));var _0xecad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcade[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var moment=require(_0xecad('0x0'));var _=require('lodash');var util=require(_0xecad('0x1'));var jayson=require('jayson/promise');var client=jayson['client'][_0xecad('0x2')]({'port':0x2329});function request(_0x2f38de,_0x5994a1){return new BPromise(function(_0xedf3ba,_0x39274c){return client[_0xecad('0x3')](_0x2f38de,_0x5994a1)[_0xecad('0x4')](function(_0x11fc85){if(_0x11fc85['error']){return _0x39274c(_0x11fc85[_0xecad('0x5')][_0xecad('0x6')]);}else{return _0xedf3ba(_0x11fc85[_0xecad('0x7')]);}})[_0xecad('0x8')](function(_0x335e0c){return _0x39274c(_0x335e0c);});});}exports[_0xecad('0x9')]=function(_0x1018c1){return request(_0xecad('0xa'),{'options':{'raw':![],'where':{'name':_0x1018c1},'attributes':[_0xecad('0xb')]}});};exports[_0xecad('0xc')]=function(_0x3b79e1){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x3b79e1},'include':[{'model':_0xecad('0xd'),'as':_0xecad('0xe')}],'attributes':['id',_0xecad('0xf'),'email']}});};exports[_0xecad('0x10')]=function(_0x330dea){return request('ShowSquareProject',{'options':{'where':{'id':_0x330dea},'attributes':[_0xecad('0xf')]}});};exports[_0xecad('0x11')]=function(_0x3af0ac){return request(_0xecad('0x12'),{'options':{'where':{'id':_0x3af0ac},'attributes':[_0xecad('0xf')]}});};exports[_0xecad('0x13')]=function(_0x5efc20){return request(_0xecad('0x14'),{'options':{'where':{'id':_0x5efc20},'attributes':[_0xecad('0xf')]}});};exports['getSquareOdbcById']=function(_0xf53301){return request('ShowSquareOdbc',{'options':{'where':{'id':_0xf53301},'attributes':['dsn']}});};exports[_0xecad('0x15')]=function(_0x629ff2){return request('ShowUser',{'options':{'where':{'id':_0x629ff2},'attributes':['name']}});};exports[_0xecad('0x16')]=function(_0x2b2d31){return request(_0xecad('0x17'),{'options':{'where':{'id':_0x2b2d31},'attributes':['name']}});};exports[_0xecad('0x18')]=function(_0x2794e0){return request(_0xecad('0x19'),{'options':{'where':{'id':_0x2794e0},'attributes':['save_name']}});};exports[_0xecad('0x1a')]=function(_0x5e6e11){return request(_0xecad('0x1b'),{'options':{'raw':![],'where':{'id':_0x5e6e11},'include':[{'model':_0xecad('0x1c'),'as':_0xecad('0x1d')}]}});};exports[_0xecad('0x1e')]=function(_0x499f30){return request(_0xecad('0x1f'),{'options':{'where':{'id':_0x499f30},'attributes':['id',_0xecad('0xf')]}});};exports[_0xecad('0x20')]=function(_0x5953b0){return request(_0xecad('0x21'),{'body':_0x5953b0});};exports[_0xecad('0x22')]=function(_0x70b890){return request(_0xecad('0x23'),{'body':_0x70b890});};exports[_0xecad('0x24')]=function(_0x517465){return request(_0xecad('0x25'),{'body':_[_0xecad('0x26')](_0x517465,{'project_name':_0x517465[_0xecad('0x27')],'prev_project_name':_0x517465[_0xecad('0x28')]||'','is_subproject':_0x517465[_0xecad('0x28')]?!![]:![],'leaveAt':moment()[_0xecad('0x29')](_0xecad('0x2a'))})});};exports[_0xecad('0x2b')]=function(_0x45d306){return request('CreateSquareRecording',{'body':_0x45d306});};exports[_0xecad('0x2c')]=function(_0x5b1ff8){return request(_0xecad('0x2d'),{'body':_0x5b1ff8});};exports[_0xecad('0x2e')]=function(_0x5e1e93){return request(_0xecad('0x2f'),{'options':{'raw':![],'where':{'phone':_0x5e1e93['phone'],'ListId':_0x5e1e93[_0xecad('0x30')]}}})[_0xecad('0x4')](function(_0x31c206){if(_0x31c206){return _0x31c206;}return request(_0xecad('0x31'),{'body':_0x5e1e93});});};exports[_0xecad('0x32')]=function(_0x3acc26){return request(_0xecad('0x33'),{'options':{'where':{'id':_0x3acc26},'attributes':[_0xecad('0xf')]}});};exports['agentLogin']=function(_0x347bc5,_0x52a60b){return request('LoginUser',{'body':{'interface':_0x52a60b},'options':{'where':_0x347bc5}});};exports['agentPause']=function(_0x37a017,_0x244992,_0x35dbf2){return request(_0xecad('0x34'),{'body':{'type':_0x244992,'uniqueid':_0x35dbf2},'options':{'where':_0x37a017}});};exports[_0xecad('0x35')]=function(_0x51f0ba){return request(_0xecad('0x36'),{'body':{},'options':{'where':_0x51f0ba}});};exports['agentLogout']=function(_0x4ec02){return request(_0xecad('0x37'),{'body':{},'options':{'where':_0x4ec02}});}; \ 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 0cece12..4c0a084 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 _0x5636=['./polly','./lex'];(function(_0x22391d,_0xafde49){var _0x9292d4=function(_0x53ea36){while(--_0x53ea36){_0x22391d['push'](_0x22391d['shift']());}};_0x9292d4(++_0xafde49);}(_0x5636,0x102));var _0x6563=function(_0x1d13ce,_0x304fc0){_0x1d13ce=_0x1d13ce-0x0;var _0x291721=_0x5636[_0x1d13ce];return _0x291721;};var polly=require(_0x6563('0x0'));var lex=require(_0x6563('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x00bb=['exports','./polly','./lex'];(function(_0x351d04,_0x4208f0){var _0x34529f=function(_0x3fb784){while(--_0x3fb784){_0x351d04['push'](_0x351d04['shift']());}};_0x34529f(++_0x4208f0);}(_0x00bb,0x1d8));var _0xb00b=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x00bb[_0x37bd26];return _0xe83dc4;};var polly=require(_0xb00b('0x0'));var lex=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 6d4c912..c302702 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 _0xe43c=['./lib/api','exports'];(function(_0x1802ee,_0x58aa31){var _0x4fea03=function(_0x2332fd){while(--_0x2332fd){_0x1802ee['push'](_0x1802ee['shift']());}};_0x4fea03(++_0x58aa31);}(_0xe43c,0x180));var _0xce43=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xe43c[_0x599f41];return _0x2e4d58;};'use strict';var lex=require(_0xce43('0x0'));module[_0xce43('0x1')]=function(_0x159823,_0x207c20,_0x6f053b,_0x357837,_0x5baedd,_0x415941){return lex(_0x159823,_0x207c20,_0x6f053b,_0x357837,_0x5baedd,_0x415941);}; \ No newline at end of file +var _0x195e=['exports','./lib/api'];(function(_0x268509,_0x196d93){var _0x5de441=function(_0x5ef235){while(--_0x5ef235){_0x268509['push'](_0x268509['shift']());}};_0x5de441(++_0x196d93);}(_0x195e,0xfb));var _0xe195=function(_0x3a1d7a,_0x529d9a){_0x3a1d7a=_0x3a1d7a-0x0;var _0x80e92b=_0x195e[_0x3a1d7a];return _0x80e92b;};'use strict';var lex=require(_0xe195('0x0'));module[_0xe195('0x1')]=function(_0xb89de1,_0x1cf8e2,_0x40fe4d,_0x3975a9,_0x31ca3b,_0x4064fd){return lex(_0xb89de1,_0x1cf8e2,_0x40fe4d,_0x3975a9,_0x31ca3b,_0x4064fd);}; \ 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 b5cf743..a4431f0 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 _0x3c92=['bluebird','postText','slots','hasOwnProperty','slot_','exports'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x3c92,0x13e));var _0x23c9=function(_0x434499,_0x5f4ab0){_0x434499=_0x434499-0x0;var _0x2b09f7=_0x3c92[_0x434499];return _0x2b09f7;};'use strict';var BPromise=require(_0x23c9('0x0'));var AWS=require('aws-sdk');function lexResult(_0x58a46a,_0x54e90f){return new BPromise(function(_0x56cdc6,_0x341919){_0x58a46a[_0x23c9('0x1')](_0x54e90f,function(_0x5bc1c4,_0xd8fbf){if(_0x5bc1c4){_0x341919(_0x5bc1c4);}if(_0xd8fbf[_0x23c9('0x2')]){for(const _0x46ebab in _0xd8fbf[_0x23c9('0x2')]){if(_0xd8fbf[_0x23c9('0x2')][_0x23c9('0x3')](_0x46ebab)){var _0x2629fc=_0xd8fbf['slots'][_0x46ebab];_0xd8fbf[_0x23c9('0x4')+_0x46ebab]=_0x2629fc;}}}_0x56cdc6(_0xd8fbf);});});}module[_0x23c9('0x5')]=function(_0x4b8086,_0x21ac13,_0x2505fb,_0x2f6def,_0x170a4b,_0x573db7){var _0x1ca93c=new AWS['LexRuntime']({'accessKeyId':_0x21ac13,'secretAccessKey':_0x2505fb,'region':_0x2f6def});var _0x7b8fb4={'botAlias':'$LATEST','botName':_0x573db7,'inputText':_0x170a4b,'userId':_0x4b8086};return lexResult(_0x1ca93c,_0x7b8fb4);}; \ No newline at end of file +var _0x2b30=['exports','LexRuntime','$LATEST','bluebird','aws-sdk','slots','hasOwnProperty','slot_'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b30,0x10b));var _0x02b3=function(_0x905d5f,_0x547a43){_0x905d5f=_0x905d5f-0x0;var _0xffaa14=_0x2b30[_0x905d5f];return _0xffaa14;};'use strict';var BPromise=require(_0x02b3('0x0'));var AWS=require(_0x02b3('0x1'));function lexResult(_0x3a60df,_0x18d2b5){return new BPromise(function(_0x949135,_0x1d6ce5){_0x3a60df['postText'](_0x18d2b5,function(_0x13db9e,_0x30656e){if(_0x13db9e){_0x1d6ce5(_0x13db9e);}if(_0x30656e['slots']){for(const _0x23bfd8 in _0x30656e[_0x02b3('0x2')]){if(_0x30656e[_0x02b3('0x2')][_0x02b3('0x3')](_0x23bfd8)){var _0x40bcb7=_0x30656e['slots'][_0x23bfd8];_0x30656e[_0x02b3('0x4')+_0x23bfd8]=_0x40bcb7;}}}_0x949135(_0x30656e);});});}module[_0x02b3('0x5')]=function(_0x32c462,_0x340944,_0x11ba6a,_0x47abf3,_0x1c3dc4,_0x2db9c5){var _0x480e6c=new AWS[(_0x02b3('0x6'))]({'accessKeyId':_0x340944,'secretAccessKey':_0x11ba6a,'region':_0x47abf3});var _0x12bff9={'botAlias':_0x02b3('0x7'),'botName':_0x2db9c5,'inputText':_0x1c3dc4,'userId':_0x32c462};return lexResult(_0x480e6c,_0x12bff9);}; \ 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 d948082..ecebd44 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 _0x438e=['exports','./lib/api'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x438e,0x16d));var _0xe438=function(_0x13cab0,_0x14d825){_0x13cab0=_0x13cab0-0x0;var _0x38804f=_0x438e[_0x13cab0];return _0x38804f;};'use strict';var polly=require(_0xe438('0x0'));module[_0xe438('0x1')]=function(_0x3173de,_0x459e24,_0x384315,_0x132583,_0x4af3b3,_0x2ba9a4,_0x1bd228){return polly(_0x3173de,_0x459e24,_0x384315,_0x132583,_0x4af3b3,_0x2ba9a4,_0x1bd228);}; \ No newline at end of file +var _0xc1e8=['exports','./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc1e8,0x6d));var _0x8c1e=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0xc1e8[_0x55fa03];return _0x2cd7cd;};'use strict';var polly=require(_0x8c1e('0x0'));module[_0x8c1e('0x1')]=function(_0x296b80,_0x4547f7,_0x1962c5,_0x5c8bfc,_0x37ae87,_0x25344c,_0xd2a9){return polly(_0x296b80,_0x4547f7,_0x1962c5,_0x5c8bfc,_0x37ae87,_0x25344c,_0xd2a9);}; \ 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 ddc3946..c6bd94a 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 _0x0e19=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','randomstring','synthesizeSpeech','writeFile','AudioStream'];(function(_0x3b3c12,_0x5e6713){var _0x1cbecb=function(_0x561094){while(--_0x561094){_0x3b3c12['push'](_0x3b3c12['shift']());}};_0x1cbecb(++_0x5e6713);}(_0x0e19,0x1e2));var _0x90e1=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0e19[_0x3bf83f];return _0x22c4a9;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0x90e1('0x0'));var AWS=require('aws-sdk');function pollyResult(_0x4119d9,_0x41c841,_0x28d4fa){return new BPromise(function(_0x322e57,_0xf09c53){_0x4119d9[_0x90e1('0x1')](_0x41c841,function(_0x3d02d0,_0x32c6a3){if(_0x3d02d0){_0xf09c53(_0x3d02d0);}else if(_0x32c6a3){if(_0x32c6a3['AudioStream']instanceof Buffer){fs[_0x90e1('0x2')](_0x28d4fa,_0x32c6a3[_0x90e1('0x3')],function(_0x423744){if(_0x423744){_0xf09c53(_0x423744);}else{_0x322e57();}});}else{_0xf09c53(new Error(_0x90e1('0x4')));}}else{_0xf09c53(new Error(_0x90e1('0x5')));}});});}module[_0x90e1('0x6')]=function(_0x48544c,_0x2b0aba,_0x3c1759,_0x40f488,_0x5d7cc8,_0x59f118,_0x3115f3){var _0x5132e9=new AWS[(_0x90e1('0x7'))]({'accessKeyId':_0x48544c,'secretAccessKey':_0x2b0aba,'region':_0x3c1759});var _0x5990b0={'Text':_0x5d7cc8,'TextType':_0x59f118||'text','OutputFormat':_0x90e1('0x8'),'VoiceId':_0x40f488};return pollyResult(_0x5132e9,_0x5990b0,_0x3115f3);}; \ No newline at end of file +var _0xbc5e=['text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0x340608,_0x3da196){var _0x3834be=function(_0x3b705d){while(--_0x3b705d){_0x340608['push'](_0x340608['shift']());}};_0x3834be(++_0x3da196);}(_0xbc5e,0x1a6));var _0xebc5=function(_0x4a05a2,_0x46f343){_0x4a05a2=_0x4a05a2-0x0;var _0x557e0b=_0xbc5e[_0x4a05a2];return _0x557e0b;};'use strict';var fs=require('fs');var path=require(_0xebc5('0x0'));var BPromise=require(_0xebc5('0x1'));var rs=require(_0xebc5('0x2'));var AWS=require(_0xebc5('0x3'));function pollyResult(_0x48caba,_0x4e985e,_0x5ea6aa){return new BPromise(function(_0x2ae195,_0x551885){_0x48caba[_0xebc5('0x4')](_0x4e985e,function(_0x26b787,_0x44b099){if(_0x26b787){_0x551885(_0x26b787);}else if(_0x44b099){if(_0x44b099[_0xebc5('0x5')]instanceof Buffer){fs[_0xebc5('0x6')](_0x5ea6aa,_0x44b099[_0xebc5('0x5')],function(_0x17cad0){if(_0x17cad0){_0x551885(_0x17cad0);}else{_0x2ae195();}});}else{_0x551885(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x551885(new Error(_0xebc5('0x7')));}});});}module[_0xebc5('0x8')]=function(_0x131bed,_0x191c80,_0xb24e92,_0x42789c,_0x5befa7,_0x14e5c4,_0x17773e){var _0x51cb41=new AWS[(_0xebc5('0x9'))]({'accessKeyId':_0x131bed,'secretAccessKey':_0x191c80,'region':_0xb24e92});var _0x3714b2={'Text':_0x5befa7,'TextType':_0x14e5c4||_0xebc5('0xa'),'OutputFormat':_0xebc5('0xb'),'VoiceId':_0x42789c};return pollyResult(_0x51cb41,_0x3714b2,_0x17773e);}; \ 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 7f65d37..cffecad 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 _0x2f5a=['exports','./lib/api'];(function(_0x162f86,_0x1cd66c){var _0x818436=function(_0x3f1acf){while(--_0x3f1acf){_0x162f86['push'](_0x162f86['shift']());}};_0x818436(++_0x1cd66c);}(_0x2f5a,0x65));var _0xa2f5=function(_0x152ea8,_0x3fb53f){_0x152ea8=_0x152ea8-0x0;var _0x4c0ebe=_0x2f5a[_0x152ea8];return _0x4c0ebe;};'use strict';var asr=require(_0xa2f5('0x0'));module[_0xa2f5('0x1')]=function(_0x298cd8,_0x14e9ff,_0x43e346,_0xb3e38c){return asr(_0x298cd8,_0x14e9ff,_0x43e346);}; \ No newline at end of file +var _0x256b=['exports','./lib/api'];(function(_0x1f9d2f,_0x2cfeb8){var _0x5e6393=function(_0x41948f){while(--_0x41948f){_0x1f9d2f['push'](_0x1f9d2f['shift']());}};_0x5e6393(++_0x2cfeb8);}(_0x256b,0xe9));var _0xb256=function(_0x2bcd32,_0x225451){_0x2bcd32=_0x2bcd32-0x0;var _0x26b77d=_0x256b[_0x2bcd32];return _0x26b77d;};'use strict';var asr=require(_0xb256('0x0'));module[_0xb256('0x1')]=function(_0x4c0bac,_0x2fd850,_0x330400,_0x5d143d){return asr(_0x4c0bac,_0x2fd850,_0x330400);}; \ 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 1e97a68..9d52c47 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 _0x7e45=['string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','https://speech.googleapis.com'];(function(_0xd0aa7b,_0x30cf34){var _0x53a1b3=function(_0x11b8ed){while(--_0x11b8ed){_0xd0aa7b['push'](_0xd0aa7b['shift']());}};_0x53a1b3(++_0x30cf34);}(_0x7e45,0x16a));var _0x57e4=function(_0x544099,_0x372b30){_0x544099=_0x544099-0x0;var _0x20ab09=_0x7e45[_0x544099];return _0x20ab09;};'use strict';var url=require(_0x57e4('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x57e4('0x1');module['exports']=function(_0xc508ec,_0x473e21,_0x2a51c9){return new BPromise(function(_0x2fde56,_0x2c42d0){var _0x414031;if(typeof _0xc508ec!==_0x57e4('0x2')||_0xc508ec['length']===0x0){return _0x2c42d0(_0x57e4('0x3'));}if(typeof _0x473e21!==_0x57e4('0x2')||_0x473e21[_0x57e4('0x4')]===0x0){return _0x2c42d0(_0x57e4('0x5'));}if(typeof _0x2a51c9!==_0x57e4('0x6')&&(typeof _0x2a51c9!=='string'||_0x2a51c9[_0x57e4('0x4')]===0x0)){return _0x2c42d0(_0x57e4('0x7'));}try{_0x414031=fs[_0x57e4('0x8')](_0xc508ec)[_0x57e4('0x9')]('base64');}catch(_0x3c8466){return _0x2c42d0(_0x3c8466);}return _0x2fde56({'method':_0x57e4('0xa'),'uri':host+_0x57e4('0xb')+_0x473e21,'body':{'config':{'encoding':_0x57e4('0xc'),'sampleRateHertz':_0x57e4('0xd'),'languageCode':_0x2a51c9},'audio':{'content':_0x414031}},'json':!![]});});}; \ No newline at end of file +var _0x6647=['url','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000'];(function(_0x4c456f,_0x14e199){var _0x38e27b=function(_0x1bf6b8){while(--_0x1bf6b8){_0x4c456f['push'](_0x4c456f['shift']());}};_0x38e27b(++_0x14e199);}(_0x6647,0x193));var _0x7664=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6647[_0x321bb2];return _0x9c12ed;};'use strict';var url=require(_0x7664('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x7664('0x1');module[_0x7664('0x2')]=function(_0x4eeb3c,_0xd9e1c5,_0x1dfe87){return new BPromise(function(_0x151707,_0x2e394d){var _0x1bcd82;if(typeof _0x4eeb3c!==_0x7664('0x3')||_0x4eeb3c[_0x7664('0x4')]===0x0){return _0x2e394d(_0x7664('0x5'));}if(typeof _0xd9e1c5!=='string'||_0xd9e1c5[_0x7664('0x4')]===0x0){return _0x2e394d('key\x20should\x20be\x20a\x20string');}if(typeof _0x1dfe87!==_0x7664('0x6')&&(typeof _0x1dfe87!==_0x7664('0x3')||_0x1dfe87[_0x7664('0x4')]===0x0)){return _0x2e394d(_0x7664('0x7'));}try{_0x1bcd82=fs['readFileSync'](_0x4eeb3c)[_0x7664('0x8')](_0x7664('0x9'));}catch(_0x3d2c7b){return _0x2e394d(_0x3d2c7b);}return _0x151707({'method':'POST','uri':host+_0x7664('0xa')+_0xd9e1c5,'body':{'config':{'encoding':_0x7664('0xb'),'sampleRateHertz':_0x7664('0xc'),'languageCode':_0x1dfe87},'audio':{'content':_0x1bcd82}},'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 ef14c86..fbba18d 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 _0x2980=['./asr','exports'];(function(_0x5d983c,_0x57b322){var _0x45d2f8=function(_0x4fb48d){while(--_0x4fb48d){_0x5d983c['push'](_0x5d983c['shift']());}};_0x45d2f8(++_0x57b322);}(_0x2980,0x192));var _0x0298=function(_0x353313,_0x168763){_0x353313=_0x353313-0x0;var _0x47459d=_0x2980[_0x353313];return _0x47459d;};var asr=require(_0x0298('0x0'));module[_0x0298('0x1')]={'asr':asr}; \ No newline at end of file +var _0x7031=['./asr','exports'];(function(_0x5f6171,_0x308104){var _0x3e5257=function(_0x42d8ce){while(--_0x42d8ce){_0x5f6171['push'](_0x5f6171['shift']());}};_0x3e5257(++_0x308104);}(_0x7031,0x19a));var _0x1703=function(_0x4031e5,_0x5d9cd0){_0x4031e5=_0x4031e5-0x0;var _0x25b248=_0x7031[_0x4031e5];return _0x25b248;};var asr=require(_0x1703('0x0'));module[_0x1703('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 6ff3bfb..b763853 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 _0x589f=['base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','voice','audioConfig','MP3','text:synthesize','from','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','POST','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','slice','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','generate','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','speech','score','status','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','queryText','responseId','intentDetectionConfidence','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','.mp3','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','randomstring','sox','google-tts-api','url','parse','util','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','createWriteStream','finish','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','\x20failed,\x20status\x20code\x20=\x20','transcode','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','then','777','split','readFileSync','toString'];(function(_0x43df87,_0x59bac7){var _0x49caaf=function(_0x3d356c){while(--_0x3d356c){_0x43df87['push'](_0x43df87['shift']());}};_0x49caaf(++_0x59bac7);}(_0x589f,0xe6));var _0xf589=function(_0x1fa007,_0x5d3503){_0x1fa007=_0x1fa007-0x0;var _0x24a0c2=_0x589f[_0x1fa007];return _0x24a0c2;};'use strict';var apiai=require(_0xf589('0x0'));var BPromise=require(_0xf589('0x1'));var dialogflow=require(_0xf589('0x2'));var fs=require('fs');var http=require(_0xf589('0x3'));var https=require(_0xf589('0x4'));var md5=require(_0xf589('0x5'));var path=require(_0xf589('0x6'));var querystring=require(_0xf589('0x7'));var rp=require('request-promise');var rs=require(_0xf589('0x8'));var sox=require(_0xf589('0x9'));var tts=require(_0xf589('0xa'));var urlParse=require(_0xf589('0xb'))[_0xf589('0xc')];var util=require(_0xf589('0xd'));var aws=require('./aws');var google=require('./google');var sestek=require(_0xf589('0xe'));var tilde=require('./tilde');var logger=require(_0xf589('0xf'))(_0xf589('0x10'));var ISPEECH_API=_0xf589('0x11');function downloadFile(_0x2eca95,_0x2e9dc7){return new BPromise(function(_0x400851,_0x42c6c9){var _0x41897b=urlParse(_0x2eca95);var _0x45888e=_0x41897b[_0xf589('0x12')]===_0xf589('0x13')?https:http;var _0x149c44={'host':_0x41897b[_0xf589('0x14')],'path':_0x41897b[_0xf589('0x6')],'headers':{'user-agent':_0xf589('0x15')}};_0x45888e[_0xf589('0x16')](_0x149c44,function(_0x40367b){if(_0x40367b[_0xf589('0x17')]!==0xc8){logger[_0xf589('0x18')](_0xf589('0x19')+_0x2eca95+'\x20failed,\x20status\x20code\x20=\x20'+_0x40367b[_0xf589('0x17')]+'\x20('+_0x40367b[_0xf589('0x1a')]+')');_0x42c6c9(new Error(_0xf589('0x19')+_0x2eca95+'\x20failed,\x20status\x20code\x20=\x20'+_0x40367b[_0xf589('0x17')]+'\x20('+_0x40367b[_0xf589('0x1a')]+')'));return;}var _0x5f10fe=fs[_0xf589('0x1b')](_0x2e9dc7);_0x5f10fe['on'](_0xf589('0x1c'),function(){logger['info'](_0xf589('0x1d'));_0x5f10fe[_0xf589('0x1e')](_0x400851);});_0x5f10fe['on'](_0xf589('0x18'),function(_0x2faa1d){fs[_0xf589('0x1f')](_0x2e9dc7);logger[_0xf589('0x18')](_0xf589('0x20'),_0x2faa1d);_0x42c6c9(_0x2faa1d);});_0x40367b[_0xf589('0x21')](_0x5f10fe);})['on']('error',function(_0x346f9d){logger[_0xf589('0x18')](_0x346f9d);_0x42c6c9(_0x346f9d);})[_0xf589('0x22')]();});}function uploadFile(_0x4a7164){return new BPromise(function(_0x485b77,_0x26aef0){var _0x30df9a=urlParse(_0x4a7164);var _0x3e237f=_0x30df9a[_0xf589('0x12')]===_0xf589('0x13')?https:http;var _0x1ed980={'host':_0x30df9a['host'],'path':_0x30df9a[_0xf589('0x6')],'headers':{'user-agent':_0xf589('0x15')}};_0x3e237f[_0xf589('0x16')](_0x1ed980,function(_0x3cce4b){if(_0x3cce4b['statusCode']!==0xc8){_0x26aef0(new Error(_0xf589('0x19')+_0x4a7164+_0xf589('0x23')+_0x3cce4b['statusCode']+'\x20('+_0x3cce4b[_0xf589('0x1a')]+')'));return;}var _0x9cc97c='';_0x3cce4b['on']('data',function(_0x5956d0){_0x9cc97c+=_0x5956d0;});_0x3cce4b['on']('end',function(){_0x485b77(_0x9cc97c);});})['on'](_0xf589('0x18'),function(_0x5c67d3){_0x26aef0(_0x5c67d3);})['end']();});}function convertFile(_0x465faf,_0x42d62c){return new BPromise(function(_0x3fcdb3,_0x418045){var _0x4d22f5=sox[_0xf589('0x24')](_0x465faf,_0x42d62c,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4d22f5['on']('error',function(_0xa5e622){logger[_0xf589('0x18')](_0xf589('0x25'),_0xa5e622);_0x418045(_0xa5e622);});_0x4d22f5['on']('end',function(){logger[_0xf589('0x26')](_0xf589('0x27'));_0x3fcdb3();});_0x4d22f5[_0xf589('0x28')]();});}function base64Decode(_0x2f91bb,_0x1968e0){var _0x5ca346=path[_0xf589('0x29')](__dirname,_0xf589('0x2a'),rs['generate'](0x4)+_0xf589('0x2b'));fs[_0xf589('0x2c')](_0x5ca346,_0x2f91bb,'base64');return convertFile(_0x5ca346,_0x1968e0)[_0xf589('0x2d')](function(){try{fs[_0xf589('0x1f')](_0x5ca346);fs['chmodSync'](_0x1968e0,_0xf589('0x2e'));}catch(_0x2fd5f6){logger[_0xf589('0x18')](_0x2fd5f6);}return _0x1968e0[_0xf589('0x2f')]('.')[0x0];});}function base64Encode(_0x2860b1){var _0x3b41e8=fs[_0xf589('0x30')](_0x2860b1);return new Buffer(_0x3b41e8)[_0xf589('0x31')](_0xf589('0x32'));}exports[_0xf589('0x33')]=function(_0x1f4805,_0x57fe07,_0x504ab9,_0x759d0f,_0x5ae264,_0x362841){var _0x5180c4,_0x1bd48c;var _0x5b2d58=_0xf589('0x34');var _0x598bbe=_0xf589('0x35')+_0x1f4805;var _0x304a7b={};if(_0x57fe07===_0xf589('0x36')){_0x304a7b['input']={'ssml':_0x504ab9};}else{_0x304a7b['input']={'text':_0x504ab9};};_0x304a7b[_0xf589('0x37')]={'languageCode':_0x759d0f,'ssmlGender':_0x5ae264};_0x304a7b[_0xf589('0x38')]={'audioEncoding':_0xf589('0x39'),'sampleRateHertz':0x1f40};var _0x2ac1fd={'url':_0x5b2d58+_0xf589('0x3a')+_0x598bbe,'method':'POST','json':!![],'body':_0x304a7b};return rp(_0x2ac1fd)[_0xf589('0x2d')](function(_0x1c49e7){return new BPromise(function(_0x5b32e,_0x267a5d){_0x5180c4=path[_0xf589('0x29')](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0x46b424=Buffer[_0xf589('0x3b')](_0x1c49e7[_0xf589('0x3c')],'base64');return fs[_0xf589('0x3d')](_0x5180c4,_0x46b424,function(_0x353eec){_0x267a5d(_0x353eec);},function(_0x256d9b){fs[_0xf589('0x3e')](_0x5180c4,_0xf589('0x2e'));_0x5b32e(_0x256d9b);});});})[_0xf589('0x2d')](function(_0x2c20d6){_0x1bd48c=path[_0xf589('0x29')](__dirname,_0xf589('0x2a'),rs['generate'](0x4)+_0xf589('0x2b'));return convertFile(_0x5180c4,_0x1bd48c);})[_0xf589('0x2d')](function(){try{fs[_0xf589('0x1f')](_0x5180c4);fs[_0xf589('0x3e')](_0x1bd48c,'777');}catch(_0x58bf7a){logger[_0xf589('0x18')](_0x58bf7a);}logger[_0xf589('0x26')](_0xf589('0x3f'),_0x1bd48c[_0xf589('0x2f')]('.')[0x0]);return _0x1bd48c[_0xf589('0x2f')]('.')[0x0];});};exports[_0xf589('0x40')]=function(_0x54d977,_0x2ec92c){var _0x17e873=_0xf589('0x41');var _0x25324c,_0x2b0336;var _0x2e81b6;var _0x3446de={'encoding':'utf8','method':_0xf589('0x42'),'timeout':0x2710,'url':_0x17e873,'headers':{'Content-Type':_0xf589('0x43')},'body':_0xf589('0x44')+encodeURIComponent(JSON[_0xf589('0x45')]([[[_0xf589('0x46'),JSON['stringify']([_0x54d977,_0x2ec92c||'en',![],_0xf589('0x47')]),null,'generic']]]))};return rp(_0x3446de)[_0xf589('0x2d')](function(_0x2ced82){try{_0x2e81b6=eval(_0x2ced82[_0xf589('0x48')](0x5))[0x0][0x2];}catch(_0x45d95f){throw new Error('parse\x20response\x20failed:\x0a'+_0x2ced82[_0xf589('0x49')]);}if(!_0x2e81b6){if(_0x54d977[_0xf589('0x4a')]>0xc8){throw new Error(_0xf589('0x4b'));}else{throw new Error(_0xf589('0x4c')+_0x2ec92c+_0xf589('0x4d'));}}try{_0x2e81b6=eval(_0x2e81b6)[0x0];}catch(_0xb76cda){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xf589('0x49')]);}const _0x214f16=_0x2e81b6;_0x25324c=path['resolve'](__dirname,_0xf589('0x2a'),rs[_0xf589('0x4e')](0x4)+'.mp3');fs[_0xf589('0x2c')](_0x25324c,_0x2e81b6,{'encoding':_0xf589('0x32')});_0x2b0336=path[_0xf589('0x29')](__dirname,_0xf589('0x2a'),rs[_0xf589('0x4e')](0x4)+_0xf589('0x2b'));return convertFile(_0x25324c,_0x2b0336);})['then'](function(){try{fs['unlink'](_0x25324c);fs[_0xf589('0x3e')](_0x2b0336,'777');}catch(_0x58d4c4){logger[_0xf589('0x18')](_0x58d4c4);}logger[_0xf589('0x26')](_0xf589('0x4f'),_0x2b0336[_0xf589('0x2f')]('.')[0x0]);return _0x2b0336[_0xf589('0x2f')]('.')[0x0];});};exports[_0xf589('0x50')]=function(_0x1ced94,_0x57c7ea,_0xe7bc5d){return google['asr'](_0x1ced94,_0x57c7ea,_0xe7bc5d)[_0xf589('0x2d')](function(_0x33b8ee){logger[_0xf589('0x26')](_0x33b8ee[_0xf589('0x51')]);return rp(_0x33b8ee);})[_0xf589('0x2d')](function(_0x2530f3){var _0x4d1f52='';var _0x40698b=0x0;try{fs['unlink'](_0x1ced94);}catch(_0x4c27aa){logger[_0xf589('0x18')](_0x4c27aa);}if(_0x2530f3&&_0x2530f3[_0xf589('0x52')]){_0x4d1f52=_0x2530f3[_0xf589('0x52')][_0xf589('0x53')](function(_0x54177d){return _0x54177d&&_0x54177d[_0xf589('0x54')][0x0]&&_0x54177d['alternatives'][0x0][_0xf589('0x55')]?_0x54177d[_0xf589('0x54')][0x0][_0xf589('0x55')]:'';})[_0xf589('0x56')]('\x0a');_0x40698b=_0x2530f3[_0xf589('0x52')][_0xf589('0x53')](function(_0x23e40e){return _0x23e40e&&_0x23e40e[_0xf589('0x54')][0x0]&&_0x23e40e['alternatives'][0x0]['confidence']?_0x23e40e['alternatives'][0x0][_0xf589('0x57')]:0x0;})[_0xf589('0x56')]('\x0a');}logger[_0xf589('0x26')](_0xf589('0x58'),_0x4d1f52);logger[_0xf589('0x26')](_0xf589('0x59'),_0x40698b);return{'transcript':_0x4d1f52,'confidence':_0x40698b};})[_0xf589('0x5a')](function(_0x454027){logger['error']('[%s]\x20%s:%s',_0x454027[_0xf589('0x17')],_0x454027[_0xf589('0x5b')],_0x454027['message']);});};exports[_0xf589('0x5c')]=function(_0x1696cc,_0x1a3704,_0x5b03df,_0x1a07f9){var _0xd2d85f=apiai(_0x1a3704,{'language':_0x1a07f9||'en'});return _0xd2d85f[_0xf589('0x5d')](_0x5b03df,{'sessionId':md5(_0x1696cc)})[_0xf589('0x2d')](function(_0x3117e7){logger[_0xf589('0x26')](JSON[_0xf589('0x45')](_0x3117e7));return{'source':_0x3117e7[_0xf589('0x5e')]['source'],'resolvedQuery':_0x3117e7[_0xf589('0x5e')][_0xf589('0x5f')],'action':_0x3117e7[_0xf589('0x5e')][_0xf589('0x60')],'actionIncomplete':_0x3117e7[_0xf589('0x5e')][_0xf589('0x61')],'speech':_0x3117e7[_0xf589('0x5e')]['fulfillment'][_0xf589('0x62')],'score':_0x3117e7[_0xf589('0x5e')][_0xf589('0x63')],'statusCode':_0x3117e7[_0xf589('0x64')]['code'],'endConversation':_0x3117e7['result']['metadata'][_0xf589('0x65')]||![],'isFallbackIntent':_0x3117e7[_0xf589('0x5e')][_0xf589('0x66')][_0xf589('0x67')]};});};exports[_0xf589('0x68')]=function(_0x4d875d,_0x5f0f86,_0x437de3,_0xe7ef1c,_0x402738,_0x4fdab1){var _0x1bf344=_0xe7ef1c[_0xf589('0x69')](/\\n/g,'\x0a');var _0x281854={'credentials':{'private_key':_0x1bf344,'client_email':_0x437de3}};var _0x2d7652=new dialogflow[(_0xf589('0x6a'))](_0x281854);var _0x5f14ac=_0x2d7652[_0xf589('0x6b')](_0x5f0f86,md5(_0x4d875d));var _0x1835d0={'session':_0x5f14ac,'queryInput':{'text':{'text':_0x402738,'languageCode':_0x4fdab1}}};return _0x2d7652[_0xf589('0x6c')](_0x1835d0)[_0xf589('0x2d')](function(_0x2c91b7){if(_0x2c91b7&&_0x2c91b7['length']){logger[_0xf589('0x26')](_0xf589('0x6d'),JSON[_0xf589('0x45')](_0x2c91b7));var _0x2705dd=_0x2c91b7[0x0];if(_0x2705dd){var _0x432803={'action':_0x2705dd[_0xf589('0x6e')][_0xf589('0x60')],'allRequiredParamsPresent':_0x2705dd[_0xf589('0x6e')][_0xf589('0x6f')],'endConversation':_0x2705dd[_0xf589('0x6e')]['diagnosticInfo']&&_0x2705dd[_0xf589('0x6e')][_0xf589('0x70')][_0xf589('0x71')]?_0x2705dd[_0xf589('0x6e')][_0xf589('0x70')]['fields']['end_conversation'][_0xf589('0x72')]:![],'fulfillmentText':_0x2705dd['queryResult'][_0xf589('0x73')],'intentName':_0x2705dd[_0xf589('0x6e')][_0xf589('0x74')][_0xf589('0x5b')],'intentDisplayName':_0x2705dd['queryResult'][_0xf589('0x74')][_0xf589('0x75')],'isFallbackIntent':_0x2705dd[_0xf589('0x6e')][_0xf589('0x74')][_0xf589('0x76')],'languageCode':_0x2705dd[_0xf589('0x6e')]['languageCode'],'queryText':_0x2705dd[_0xf589('0x6e')][_0xf589('0x77')],'responseId':_0x2705dd[_0xf589('0x78')],'score':_0x2705dd[_0xf589('0x6e')][_0xf589('0x79')],'speech':_0x2705dd[_0xf589('0x6e')][_0xf589('0x73')],'providerResponse':JSON['stringify'](_0x2c91b7)};return _0x432803;}}});};exports['tildeASR']=function(_0x575246,_0x5d91ec,_0x3c1a10,_0x42f1ff){return tilde[_0xf589('0x7a')](_0x575246,_0x5d91ec,_0x3c1a10,_0x42f1ff)['then'](function(_0x2c4dd3){try{fs['unlink'](_0x575246);}catch(_0x27b756){logger[_0xf589('0x18')](_0x27b756);}logger[_0xf589('0x26')](_0xf589('0x7b'),_0x2c4dd3[_0xf589('0x55')]);logger[_0xf589('0x26')](_0xf589('0x7c'),_0x2c4dd3[_0xf589('0x57')]);return _0x2c4dd3;});};exports[_0xf589('0x7d')]=function(_0x6d4f3c,_0x4227a9,_0x4c49cc,_0x389042,_0x5ab2a3,_0x163334){var _0xbf0b3d=path[_0xf589('0x29')](__dirname,'tmp',rs[_0xf589('0x4e')](0x4)+_0xf589('0x7e'));var _0x472ff9;return aws['polly'](_0x6d4f3c,_0x4227a9,_0x4c49cc,_0x389042,_0x5ab2a3,_0x163334,_0xbf0b3d)[_0xf589('0x2d')](function(){_0x472ff9=path['resolve'](__dirname,'tmp',rs[_0xf589('0x4e')](0x4)+'.wav');return convertFile(_0xbf0b3d,_0x472ff9);})[_0xf589('0x2d')](function(){try{fs[_0xf589('0x1f')](_0xbf0b3d);fs[_0xf589('0x3e')](_0x472ff9,_0xf589('0x2e'));}catch(_0x26a2fd){logger[_0xf589('0x18')](_0x26a2fd);}return _0x472ff9[_0xf589('0x2f')]('.')[0x0];});};exports['awsLex']=function(_0x366d45,_0x393db7,_0x37eb2e,_0x56cd16,_0x5adb4b,_0x4a0f33){return aws[_0xf589('0x7f')](_0x366d45,_0x393db7,_0x37eb2e,_0x56cd16,_0x5adb4b,_0x4a0f33)[_0xf589('0x2d')](function(_0x597926){logger[_0xf589('0x26')](JSON[_0xf589('0x45')](_0x597926));return _0x597926;});};exports[_0xf589('0x80')]=function(_0x16e899,_0x1736e4,_0xb908fb,_0x2307eb){var _0x903fbb=util['format'](_0xf589('0x81'),ISPEECH_API,_0x16e899,encodeURIComponent(_0x1736e4),_0xb908fb,_0x2307eb);var _0x47afb4=path['resolve'](__dirname,_0xf589('0x2a'),rs['generate'](0x4)+_0xf589('0x7e'));var _0x4c2716;return downloadFile(_0x903fbb,_0x47afb4)['then'](function(){_0x4c2716=path[_0xf589('0x29')](__dirname,'tmp',rs[_0xf589('0x4e')](0x4)+'.wav');return convertFile(_0x47afb4,_0x4c2716);})[_0xf589('0x2d')](function(){try{fs[_0xf589('0x1f')](_0x47afb4);fs[_0xf589('0x3e')](_0x4c2716,_0xf589('0x2e'));}catch(_0x37b2ad){logger['error'](_0x37b2ad);}return _0x4c2716[_0xf589('0x2f')]('.')[0x0];});};exports[_0xf589('0x82')]=function(_0x15389a,_0x7491c7,_0x3091ed,_0x382ba8){var _0x50d95d=util[_0xf589('0x83')](_0xf589('0x84'),ISPEECH_API,_0x7491c7,_0x3091ed,base64Encode(_0x15389a),_0x382ba8?util[_0xf589('0x83')]('model=%s',encodeURIComponent(_0x382ba8)):_0xf589('0x85'));return uploadFile(_0x50d95d)[_0xf589('0x2d')](function(_0x47da4e){return querystring[_0xf589('0xc')](_0x47da4e);});};exports['sestekNDA']=function(_0x15a7dc,_0x1267b7){return sestek[_0xf589('0x86')](_0x15a7dc,_0x1267b7)[_0xf589('0x2d')](function(_0x193ab4){logger['info'](JSON[_0xf589('0x45')](_0x193ab4));var _0x4d02f2={'speech':_0x193ab4[_0xf589('0x87')],'action':_0x193ab4[_0xf589('0x88')]?_0x193ab4[_0xf589('0x88')][_0xf589('0x89')]:undefined,'actiondata':_0x193ab4[_0xf589('0x88')]?_0x193ab4[_0xf589('0x88')][_0xf589('0x8a')]:undefined};if(_0x193ab4[_0xf589('0x88')]&&_0x193ab4['channelData'][_0xf589('0x8b')]){return base64Decode(_0x193ab4['channelData']['AudioFromTts']['Data'],path[_0xf589('0x29')](__dirname,_0xf589('0x2a'),rs[_0xf589('0x4e')](0x4)+'.wav'))[_0xf589('0x2d')](function(_0x3691ad){_0x4d02f2['audiofile']=_0x3691ad;return _0x4d02f2;});}return _0x4d02f2;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x2aa9=['request-promise','randomstring','sox','google-tts-api','url','parse','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https:','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','finish','finish\x20download\x20file','close','download\x20error','pipe','end','protocol','data','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','writeFileSync','base64','then','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','text:synthesize','POST','generate','.mp3','from','audioContent','writeFile','chmodSync','.wav','unlink','777','googleCloudTTS\x20path','split','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','fulfillment','status','endConversation','metadata','googleDialogflowV2','replace','Dialogflow\x20V2\x20response:','action','allRequiredParamsPresent','queryResult','diagnosticInfo','fields','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','freeform=3','sestekNDA','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','http','https','md5','path','querystring'];(function(_0x2a1c0e,_0x43684f){var _0x5960af=function(_0x26a2ed){while(--_0x26a2ed){_0x2a1c0e['push'](_0x2a1c0e['shift']());}};_0x5960af(++_0x43684f);}(_0x2aa9,0x180));var _0x92aa=function(_0x1db419,_0x4c6348){_0x1db419=_0x1db419-0x0;var _0x3651a3=_0x2aa9[_0x1db419];return _0x3651a3;};'use strict';var apiai=require(_0x92aa('0x0'));var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x92aa('0x1'));var https=require(_0x92aa('0x2'));var md5=require(_0x92aa('0x3'));var path=require(_0x92aa('0x4'));var querystring=require(_0x92aa('0x5'));var rp=require(_0x92aa('0x6'));var rs=require(_0x92aa('0x7'));var sox=require(_0x92aa('0x8'));var tts=require(_0x92aa('0x9'));var urlParse=require(_0x92aa('0xa'))[_0x92aa('0xb')];var util=require('util');var aws=require(_0x92aa('0xc'));var google=require(_0x92aa('0xd'));var sestek=require(_0x92aa('0xe'));var tilde=require(_0x92aa('0xf'));var logger=require(_0x92aa('0x10'))(_0x92aa('0x11'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x109261,_0x3f475b){return new BPromise(function(_0x23aa64,_0x511739){var _0xb79dea=urlParse(_0x109261);var _0x4e6ab0=_0xb79dea['protocol']===_0x92aa('0x12')?https:http;var _0x3fc49d={'host':_0xb79dea['host'],'path':_0xb79dea[_0x92aa('0x4')],'headers':{'user-agent':_0x92aa('0x13')}};_0x4e6ab0[_0x92aa('0x14')](_0x3fc49d,function(_0x34e718){if(_0x34e718[_0x92aa('0x15')]!==0xc8){logger[_0x92aa('0x16')]('request\x20to\x20'+_0x109261+_0x92aa('0x17')+_0x34e718[_0x92aa('0x15')]+'\x20('+_0x34e718[_0x92aa('0x18')]+')');_0x511739(new Error(_0x92aa('0x19')+_0x109261+'\x20failed,\x20status\x20code\x20=\x20'+_0x34e718[_0x92aa('0x15')]+'\x20('+_0x34e718[_0x92aa('0x18')]+')'));return;}var _0x3017ca=fs[_0x92aa('0x1a')](_0x3f475b);_0x3017ca['on'](_0x92aa('0x1b'),function(){logger['info'](_0x92aa('0x1c'));_0x3017ca[_0x92aa('0x1d')](_0x23aa64);});_0x3017ca['on'](_0x92aa('0x16'),function(_0x20acb8){fs['unlink'](_0x3f475b);logger[_0x92aa('0x16')](_0x92aa('0x1e'),_0x20acb8);_0x511739(_0x20acb8);});_0x34e718[_0x92aa('0x1f')](_0x3017ca);})['on']('error',function(_0x4999b8){logger[_0x92aa('0x16')](_0x4999b8);_0x511739(_0x4999b8);})[_0x92aa('0x20')]();});}function uploadFile(_0x355ed7){return new BPromise(function(_0x8405d3,_0x43d087){var _0x3301d8=urlParse(_0x355ed7);var _0x2dfe2a=_0x3301d8[_0x92aa('0x21')]===_0x92aa('0x12')?https:http;var _0x16c8f2={'host':_0x3301d8['host'],'path':_0x3301d8[_0x92aa('0x4')],'headers':{'user-agent':_0x92aa('0x13')}};_0x2dfe2a[_0x92aa('0x14')](_0x16c8f2,function(_0x735fdd){if(_0x735fdd[_0x92aa('0x15')]!==0xc8){_0x43d087(new Error(_0x92aa('0x19')+_0x355ed7+_0x92aa('0x17')+_0x735fdd[_0x92aa('0x15')]+'\x20('+_0x735fdd[_0x92aa('0x18')]+')'));return;}var _0x18efb0='';_0x735fdd['on'](_0x92aa('0x22'),function(_0x21814e){_0x18efb0+=_0x21814e;});_0x735fdd['on'](_0x92aa('0x20'),function(){_0x8405d3(_0x18efb0);});})['on'](_0x92aa('0x16'),function(_0x3863ed){_0x43d087(_0x3863ed);})[_0x92aa('0x20')]();});}function convertFile(_0x4ab147,_0x5bc58c){return new BPromise(function(_0x143de7,_0x57bf2a){var _0x13f497=sox[_0x92aa('0x23')](_0x4ab147,_0x5bc58c,{'sampleRate':0x1f40,'format':_0x92aa('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x13f497['on'](_0x92aa('0x16'),function(_0x431a61){logger[_0x92aa('0x16')](_0x92aa('0x25'),_0x431a61);_0x57bf2a(_0x431a61);});_0x13f497['on'](_0x92aa('0x20'),function(){logger[_0x92aa('0x26')](_0x92aa('0x27'));_0x143de7();});_0x13f497[_0x92aa('0x28')]();});}function base64Decode(_0x3d1137,_0x199173){var _0x584fa9=path[_0x92aa('0x29')](__dirname,_0x92aa('0x2a'),rs['generate'](0x4)+'.wav');fs[_0x92aa('0x2b')](_0x584fa9,_0x3d1137,_0x92aa('0x2c'));return convertFile(_0x584fa9,_0x199173)[_0x92aa('0x2d')](function(){try{fs['unlink'](_0x584fa9);fs['chmodSync'](_0x199173,'777');}catch(_0x16c6c){logger[_0x92aa('0x16')](_0x16c6c);}return _0x199173['split']('.')[0x0];});}function base64Encode(_0x12656a){var _0x4f9159=fs['readFileSync'](_0x12656a);return new Buffer(_0x4f9159)[_0x92aa('0x2e')](_0x92aa('0x2c'));}exports[_0x92aa('0x2f')]=function(_0xdea6b8,_0x4e92f9,_0x2fd0b3,_0x2158a3,_0x48a1e2,_0x450bf){var _0x216022,_0x936d1;var _0x1c66b7='https://texttospeech.googleapis.com/v1/';var _0x3d687c=_0x92aa('0x30')+_0xdea6b8;var _0x2327d0={};if(_0x4e92f9===_0x92aa('0x31')){_0x2327d0['input']={'ssml':_0x2fd0b3};}else{_0x2327d0[_0x92aa('0x32')]={'text':_0x2fd0b3};};_0x2327d0[_0x92aa('0x33')]={'languageCode':_0x2158a3,'ssmlGender':_0x48a1e2};_0x2327d0[_0x92aa('0x34')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x2146ec={'url':_0x1c66b7+_0x92aa('0x35')+_0x3d687c,'method':_0x92aa('0x36'),'json':!![],'body':_0x2327d0};return rp(_0x2146ec)['then'](function(_0x5553b0){return new BPromise(function(_0x2e9d02,_0x17d428){_0x216022=path[_0x92aa('0x29')](__dirname,_0x92aa('0x2a'),rs[_0x92aa('0x37')](0x4)+_0x92aa('0x38'));var _0x146023=Buffer[_0x92aa('0x39')](_0x5553b0[_0x92aa('0x3a')],_0x92aa('0x2c'));return fs[_0x92aa('0x3b')](_0x216022,_0x146023,function(_0x3ecf12){_0x17d428(_0x3ecf12);},function(_0x22019c){fs[_0x92aa('0x3c')](_0x216022,'777');_0x2e9d02(_0x22019c);});});})[_0x92aa('0x2d')](function(_0x572890){_0x936d1=path[_0x92aa('0x29')](__dirname,'tmp',rs[_0x92aa('0x37')](0x4)+_0x92aa('0x3d'));return convertFile(_0x216022,_0x936d1);})[_0x92aa('0x2d')](function(){try{fs[_0x92aa('0x3e')](_0x216022);fs[_0x92aa('0x3c')](_0x936d1,_0x92aa('0x3f'));}catch(_0x4c8453){logger['error'](_0x4c8453);}logger[_0x92aa('0x26')](_0x92aa('0x40'),_0x936d1[_0x92aa('0x41')]('.')[0x0]);return _0x936d1[_0x92aa('0x41')]('.')[0x0];});};exports['googleTTS']=function(_0xba81a3,_0x36a792){var _0x47ad7d=_0x92aa('0x42');var _0x4eb0f0,_0x3a1e20;var _0x31a7be;var _0x777d87={'encoding':_0x92aa('0x43'),'method':'POST','timeout':0x2710,'url':_0x47ad7d,'headers':{'Content-Type':_0x92aa('0x44')},'body':_0x92aa('0x45')+encodeURIComponent(JSON[_0x92aa('0x46')]([[[_0x92aa('0x47'),JSON[_0x92aa('0x46')]([_0xba81a3,_0x36a792||'en',![],'null']),null,_0x92aa('0x48')]]]))};return rp(_0x777d87)[_0x92aa('0x2d')](function(_0x278069){try{_0x31a7be=eval(_0x278069[_0x92aa('0x49')](0x5))[0x0][0x2];}catch(_0x4a88ff){throw new Error(_0x92aa('0x4a')+_0x278069[_0x92aa('0x22')]);}if(!_0x31a7be){if(_0xba81a3['length']>0xc8){throw new Error(_0x92aa('0x4b'));}else{throw new Error(_0x92aa('0x4c')+_0x36a792+_0x92aa('0x4d'));}}try{_0x31a7be=eval(_0x31a7be)[0x0];}catch(_0x33c217){throw new Error(_0x92aa('0x4a')+res['data']);}const _0x38de08=_0x31a7be;_0x4eb0f0=path[_0x92aa('0x29')](__dirname,_0x92aa('0x2a'),rs['generate'](0x4)+_0x92aa('0x38'));fs[_0x92aa('0x2b')](_0x4eb0f0,_0x31a7be,{'encoding':_0x92aa('0x2c')});_0x3a1e20=path[_0x92aa('0x29')](__dirname,_0x92aa('0x2a'),rs[_0x92aa('0x37')](0x4)+'.wav');return convertFile(_0x4eb0f0,_0x3a1e20);})[_0x92aa('0x2d')](function(){try{fs[_0x92aa('0x3e')](_0x4eb0f0);fs[_0x92aa('0x3c')](_0x3a1e20,'777');}catch(_0x102dd1){logger['error'](_0x102dd1);}logger[_0x92aa('0x26')](_0x92aa('0x4e'),_0x3a1e20[_0x92aa('0x41')]('.')[0x0]);return _0x3a1e20[_0x92aa('0x41')]('.')[0x0];});};exports[_0x92aa('0x4f')]=function(_0x48dff6,_0x226a74,_0x23afc9){return google[_0x92aa('0x50')](_0x48dff6,_0x226a74,_0x23afc9)[_0x92aa('0x2d')](function(_0x22bef2){logger[_0x92aa('0x26')](_0x22bef2[_0x92aa('0x51')]);return rp(_0x22bef2);})['then'](function(_0x5a9a37){var _0x5106f1='';var _0x52284d=0x0;try{fs[_0x92aa('0x3e')](_0x48dff6);}catch(_0xbd9daa){logger['error'](_0xbd9daa);}if(_0x5a9a37&&_0x5a9a37[_0x92aa('0x52')]){_0x5106f1=_0x5a9a37[_0x92aa('0x52')][_0x92aa('0x53')](function(_0x231de2){return _0x231de2&&_0x231de2[_0x92aa('0x54')][0x0]&&_0x231de2[_0x92aa('0x54')][0x0][_0x92aa('0x55')]?_0x231de2[_0x92aa('0x54')][0x0][_0x92aa('0x55')]:'';})[_0x92aa('0x56')]('\x0a');_0x52284d=_0x5a9a37[_0x92aa('0x52')][_0x92aa('0x53')](function(_0x1890b3){return _0x1890b3&&_0x1890b3[_0x92aa('0x54')][0x0]&&_0x1890b3['alternatives'][0x0][_0x92aa('0x57')]?_0x1890b3[_0x92aa('0x54')][0x0][_0x92aa('0x57')]:0x0;})[_0x92aa('0x56')]('\x0a');}logger[_0x92aa('0x26')](_0x92aa('0x58'),_0x5106f1);logger[_0x92aa('0x26')](_0x92aa('0x59'),_0x52284d);return{'transcript':_0x5106f1,'confidence':_0x52284d};})['catch'](function(_0x513f1b){logger['error'](_0x92aa('0x5a'),_0x513f1b['statusCode'],_0x513f1b[_0x92aa('0x5b')],_0x513f1b[_0x92aa('0x5c')]);});};exports[_0x92aa('0x5d')]=function(_0x34577c,_0x4bfbc4,_0x2a86cc,_0x467b4a){var _0x3eb10d=apiai(_0x4bfbc4,{'language':_0x467b4a||'en'});return _0x3eb10d[_0x92aa('0x5e')](_0x2a86cc,{'sessionId':md5(_0x34577c)})['then'](function(_0x450842){logger[_0x92aa('0x26')](JSON[_0x92aa('0x46')](_0x450842));return{'source':_0x450842[_0x92aa('0x5f')]['source'],'resolvedQuery':_0x450842[_0x92aa('0x5f')]['resolvedQuery'],'action':_0x450842[_0x92aa('0x5f')]['action'],'actionIncomplete':_0x450842['result']['actionIncomplete'],'speech':_0x450842['result'][_0x92aa('0x60')]['speech'],'score':_0x450842[_0x92aa('0x5f')]['score'],'statusCode':_0x450842[_0x92aa('0x61')]['code'],'endConversation':_0x450842[_0x92aa('0x5f')]['metadata'][_0x92aa('0x62')]||![],'isFallbackIntent':_0x450842[_0x92aa('0x5f')][_0x92aa('0x63')]['isFallbackIntent']};});};exports[_0x92aa('0x64')]=function(_0x3351ac,_0x1b7198,_0x3d834b,_0x202931,_0x2fdf02,_0x5b99d1){var _0x243790=_0x202931[_0x92aa('0x65')](/\\n/g,'\x0a');var _0x1fd280={'credentials':{'private_key':_0x243790,'client_email':_0x3d834b}};var _0x557dc1=new dialogflow['SessionsClient'](_0x1fd280);var _0xd1c6e9=_0x557dc1['sessionPath'](_0x1b7198,md5(_0x3351ac));var _0x11f1d0={'session':_0xd1c6e9,'queryInput':{'text':{'text':_0x2fdf02,'languageCode':_0x5b99d1}}};return _0x557dc1['detectIntent'](_0x11f1d0)[_0x92aa('0x2d')](function(_0xe7124a){if(_0xe7124a&&_0xe7124a['length']){logger[_0x92aa('0x26')](_0x92aa('0x66'),JSON['stringify'](_0xe7124a));var _0x5b12f2=_0xe7124a[0x0];if(_0x5b12f2){var _0x490ed8={'action':_0x5b12f2['queryResult'][_0x92aa('0x67')],'allRequiredParamsPresent':_0x5b12f2['queryResult'][_0x92aa('0x68')],'endConversation':_0x5b12f2[_0x92aa('0x69')][_0x92aa('0x6a')]&&_0x5b12f2[_0x92aa('0x69')]['diagnosticInfo'][_0x92aa('0x6b')]?_0x5b12f2[_0x92aa('0x69')][_0x92aa('0x6a')][_0x92aa('0x6b')]['end_conversation']['boolValue']:![],'fulfillmentText':_0x5b12f2[_0x92aa('0x69')][_0x92aa('0x6c')],'intentName':_0x5b12f2[_0x92aa('0x69')][_0x92aa('0x6d')]['name'],'intentDisplayName':_0x5b12f2[_0x92aa('0x69')][_0x92aa('0x6d')][_0x92aa('0x6e')],'isFallbackIntent':_0x5b12f2['queryResult'][_0x92aa('0x6d')][_0x92aa('0x6f')],'languageCode':_0x5b12f2[_0x92aa('0x69')][_0x92aa('0x70')],'queryText':_0x5b12f2[_0x92aa('0x69')][_0x92aa('0x71')],'responseId':_0x5b12f2[_0x92aa('0x72')],'score':_0x5b12f2[_0x92aa('0x69')]['intentDetectionConfidence'],'speech':_0x5b12f2[_0x92aa('0x69')][_0x92aa('0x6c')],'providerResponse':JSON['stringify'](_0xe7124a)};return _0x490ed8;}}});};exports['tildeASR']=function(_0x157576,_0x3dd736,_0x19333c,_0x342fed){return tilde[_0x92aa('0x50')](_0x157576,_0x3dd736,_0x19333c,_0x342fed)[_0x92aa('0x2d')](function(_0x110054){try{fs[_0x92aa('0x3e')](_0x157576);}catch(_0xffe976){logger['error'](_0xffe976);}logger[_0x92aa('0x26')]('Tilde\x20ASR\x20transcription',_0x110054[_0x92aa('0x55')]);logger['info'](_0x92aa('0x73'),_0x110054[_0x92aa('0x57')]);return _0x110054;});};exports['awsPolly']=function(_0x5ebe59,_0x13e5dd,_0x53104c,_0x5b7f29,_0x49b05d,_0x1b6f1a){var _0x38d7d5=path[_0x92aa('0x29')](__dirname,_0x92aa('0x2a'),rs[_0x92aa('0x37')](0x4)+_0x92aa('0x38'));var _0x281cbe;return aws[_0x92aa('0x74')](_0x5ebe59,_0x13e5dd,_0x53104c,_0x5b7f29,_0x49b05d,_0x1b6f1a,_0x38d7d5)[_0x92aa('0x2d')](function(){_0x281cbe=path[_0x92aa('0x29')](__dirname,_0x92aa('0x2a'),rs[_0x92aa('0x37')](0x4)+_0x92aa('0x3d'));return convertFile(_0x38d7d5,_0x281cbe);})[_0x92aa('0x2d')](function(){try{fs['unlink'](_0x38d7d5);fs[_0x92aa('0x3c')](_0x281cbe,'777');}catch(_0xf9238b){logger[_0x92aa('0x16')](_0xf9238b);}return _0x281cbe['split']('.')[0x0];});};exports[_0x92aa('0x75')]=function(_0x3f105b,_0x37fd5c,_0x4c39c8,_0x4557fc,_0x5cfd4e,_0x3df231){return aws[_0x92aa('0x76')](_0x3f105b,_0x37fd5c,_0x4c39c8,_0x4557fc,_0x5cfd4e,_0x3df231)[_0x92aa('0x2d')](function(_0x4043b2){logger[_0x92aa('0x26')](JSON[_0x92aa('0x46')](_0x4043b2));return _0x4043b2;});};exports[_0x92aa('0x77')]=function(_0x4249d7,_0x4479c9,_0x406c66,_0x6b926a){var _0x2422b0=util['format'](_0x92aa('0x78'),ISPEECH_API,_0x4249d7,encodeURIComponent(_0x4479c9),_0x406c66,_0x6b926a);var _0x5ef12c=path[_0x92aa('0x29')](__dirname,'tmp',rs[_0x92aa('0x37')](0x4)+_0x92aa('0x38'));var _0x138bed;return downloadFile(_0x2422b0,_0x5ef12c)[_0x92aa('0x2d')](function(){_0x138bed=path[_0x92aa('0x29')](__dirname,'tmp',rs[_0x92aa('0x37')](0x4)+_0x92aa('0x3d'));return convertFile(_0x5ef12c,_0x138bed);})[_0x92aa('0x2d')](function(){try{fs[_0x92aa('0x3e')](_0x5ef12c);fs['chmodSync'](_0x138bed,_0x92aa('0x3f'));}catch(_0x41dc80){logger[_0x92aa('0x16')](_0x41dc80);}return _0x138bed[_0x92aa('0x41')]('.')[0x0];});};exports['ispeechASR']=function(_0x3ef2d7,_0x583c6a,_0x97c2fd,_0x1d3462){var _0x195882=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x583c6a,_0x97c2fd,base64Encode(_0x3ef2d7),_0x1d3462?util['format']('model=%s',encodeURIComponent(_0x1d3462)):_0x92aa('0x79'));return uploadFile(_0x195882)[_0x92aa('0x2d')](function(_0x702065){return querystring[_0x92aa('0xb')](_0x702065);});};exports[_0x92aa('0x7a')]=function(_0x2bb10e,_0x2f9601){return sestek['nda'](_0x2bb10e,_0x2f9601)[_0x92aa('0x2d')](function(_0x5792cd){logger[_0x92aa('0x26')](JSON['stringify'](_0x5792cd));var _0x1c54e7={'speech':_0x5792cd['text'],'action':_0x5792cd[_0x92aa('0x7b')]?_0x5792cd[_0x92aa('0x7b')][_0x92aa('0x7c')]:undefined,'actiondata':_0x5792cd[_0x92aa('0x7b')]?_0x5792cd[_0x92aa('0x7b')][_0x92aa('0x7d')]:undefined};if(_0x5792cd['channelData']&&_0x5792cd[_0x92aa('0x7b')]['AudioFromTts']){return base64Decode(_0x5792cd[_0x92aa('0x7b')][_0x92aa('0x7e')][_0x92aa('0x7f')],path[_0x92aa('0x29')](__dirname,_0x92aa('0x2a'),rs[_0x92aa('0x37')](0x4)+_0x92aa('0x3d')))[_0x92aa('0x2d')](function(_0x210856){_0x1c54e7[_0x92aa('0x80')]=_0x210856;return _0x1c54e7;});}return _0x1c54e7;});};exports[_0x92aa('0x81')]=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 dbbb448..2b64048 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 _0xef64=['./nda','exports'];(function(_0x29a7a4,_0x2b73aa){var _0x5b937a=function(_0x328d06){while(--_0x328d06){_0x29a7a4['push'](_0x29a7a4['shift']());}};_0x5b937a(++_0x2b73aa);}(_0xef64,0xec));var _0x4ef6=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xef64[_0xfa634c];return _0x73e478;};var nda=require(_0x4ef6('0x0'));module[_0x4ef6('0x1')]={'nda':nda}; \ No newline at end of file +var _0xe382=['exports','./nda'];(function(_0x4ed37d,_0x1a84c9){var _0x4fb2c5=function(_0x5c9013){while(--_0x5c9013){_0x4ed37d['push'](_0x4ed37d['shift']());}};_0x4fb2c5(++_0x1a84c9);}(_0xe382,0x9d));var _0x2e38=function(_0x277fa3,_0x3b2dde){_0x277fa3=_0x277fa3-0x0;var _0x2e4520=_0xe382[_0x277fa3];return _0x2e4520;};var nda=require(_0x2e38('0x0'));module[_0x2e38('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 2d632c5..51d55eb 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 _0xc4a8=['url','agi','exports','POST','ndauth_url','/token','password','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise'];(function(_0x5d3f4c,_0x2e1411){var _0x2f1440=function(_0x589e72){while(--_0x589e72){_0x5d3f4c['push'](_0x5d3f4c['shift']());}};_0x2f1440(++_0x2e1411);}(_0xc4a8,0xa4));var _0x8c4a=function(_0x5c1c56,_0x1e1f4c){_0x5c1c56=_0x5c1c56-0x0;var _0x4c3207=_0xc4a8[_0x5c1c56];return _0x4c3207;};'use strict';var rp=require(_0x8c4a('0x0'));var url=require(_0x8c4a('0x1'));var logger=require('../../../../../config/logger')(_0x8c4a('0x2'));module[_0x8c4a('0x3')]=function(_0x31afe5,_0x3d9c42){var _0x56ec38={'method':_0x8c4a('0x4'),'uri':url['resolve'](_0x3d9c42[_0x8c4a('0x5')],_0x8c4a('0x6')),'form':{'grant_type':'password','username':_0x3d9c42['username'],'password':_0x3d9c42[_0x8c4a('0x7')]},'json':!![]};return rp(_0x56ec38)[_0x8c4a('0x8')](function(_0x382704){var _0x34b74d={'method':_0x8c4a('0x4'),'uri':url[_0x8c4a('0x9')](_0x3d9c42[_0x8c4a('0xa')],_0x8c4a('0xb')),'body':{'type':_0x3d9c42[_0x8c4a('0xc')]||_0x8c4a('0xd'),'channelId':_0x8c4a('0xe'),'conversation':{'id':_0x31afe5[_0x8c4a('0xf')]},'from':{'id':_0x31afe5[_0x8c4a('0x10')],'name':_0x31afe5['calleridname']},'recipient':{'id':_0x31afe5['dnid'],'name':_0x31afe5[_0x8c4a('0x11')]},'text':_0x3d9c42[_0x8c4a('0x12')],'channelData':{}},'headers':{'Authorization':_0x8c4a('0x13')+_0x382704[_0x8c4a('0x14')]},'json':!![]};if(_0x3d9c42[_0x8c4a('0x15')]){_0x34b74d[_0x8c4a('0x16')][_0x8c4a('0x17')][_0x8c4a('0x18')]=_0x3d9c42[_0x8c4a('0x15')];}if(_0x3d9c42['ndagenerate_audio']=='1'){_0x34b74d[_0x8c4a('0x16')][_0x8c4a('0x17')][_0x8c4a('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x8c4a('0x1a')};}if(_0x3d9c42[_0x8c4a('0x1b')]){_0x34b74d[_0x8c4a('0x16')][_0x8c4a('0x17')][_0x8c4a('0x1c')]=_0x3d9c42[_0x8c4a('0x1b')];if(_0x3d9c42[_0x8c4a('0x1d')]){_0x34b74d[_0x8c4a('0x16')]['channelData'][_0x8c4a('0x1e')]=_0x3d9c42[_0x8c4a('0x1d')];}}logger[_0x8c4a('0x1f')](JSON[_0x8c4a('0x20')](_0x34b74d));return rp(_0x34b74d);});}; \ No newline at end of file +var _0x1d6b=['text','access_token','project','channelData','ProjectName','body','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','request-promise','url','agi','exports','POST','resolve','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','extension'];(function(_0x179cce,_0x239422){var _0x54ac6d=function(_0x21a7f0){while(--_0x21a7f0){_0x179cce['push'](_0x179cce['shift']());}};_0x54ac6d(++_0x239422);}(_0x1d6b,0x18d));var _0xb1d6=function(_0x2ef644,_0x2ab0ff){_0x2ef644=_0x2ef644-0x0;var _0x11f00e=_0x1d6b[_0x2ef644];return _0x11f00e;};'use strict';var rp=require(_0xb1d6('0x0'));var url=require(_0xb1d6('0x1'));var logger=require('../../../../../config/logger')(_0xb1d6('0x2'));module[_0xb1d6('0x3')]=function(_0x351e64,_0xdf2f8b){var _0x5be695={'method':_0xb1d6('0x4'),'uri':url[_0xb1d6('0x5')](_0xdf2f8b['ndauth_url'],_0xb1d6('0x6')),'form':{'grant_type':_0xb1d6('0x7'),'username':_0xdf2f8b[_0xb1d6('0x8')],'password':_0xdf2f8b[_0xb1d6('0x7')]},'json':!![]};return rp(_0x5be695)[_0xb1d6('0x9')](function(_0x5b8622){var _0x1547d5={'method':_0xb1d6('0x4'),'uri':url[_0xb1d6('0x5')](_0xdf2f8b[_0xb1d6('0xa')],_0xb1d6('0xb')),'body':{'type':_0xdf2f8b[_0xb1d6('0xc')]||_0xb1d6('0xd'),'channelId':_0xb1d6('0xe'),'conversation':{'id':_0x351e64[_0xb1d6('0xf')]},'from':{'id':_0x351e64['callerid'],'name':_0x351e64[_0xb1d6('0x10')]},'recipient':{'id':_0x351e64[_0xb1d6('0x11')],'name':_0x351e64[_0xb1d6('0x12')]},'text':_0xdf2f8b[_0xb1d6('0x13')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x5b8622[_0xb1d6('0x14')]},'json':!![]};if(_0xdf2f8b[_0xb1d6('0x15')]){_0x1547d5['body'][_0xb1d6('0x16')][_0xb1d6('0x17')]=_0xdf2f8b[_0xb1d6('0x15')];}if(_0xdf2f8b['ndagenerate_audio']=='1'){_0x1547d5[_0xb1d6('0x18')][_0xb1d6('0x16')][_0xb1d6('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xb1d6('0x1a')};}if(_0xdf2f8b['custom_action']){_0x1547d5[_0xb1d6('0x18')][_0xb1d6('0x16')][_0xb1d6('0x1b')]=_0xdf2f8b[_0xb1d6('0x1c')];if(_0xdf2f8b[_0xb1d6('0x1d')]){_0x1547d5[_0xb1d6('0x18')][_0xb1d6('0x16')][_0xb1d6('0x1e')]=_0xdf2f8b['custom_action_data'];}}logger[_0xb1d6('0x1f')](JSON['stringify'](_0x1547d5));return rp(_0x1547d5);});}; \ 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 a2a009e..15cfec3 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 _0xf862=['./lib/api','exports'];(function(_0x48bc1b,_0x593ab1){var _0x4ed9e6=function(_0x586b02){while(--_0x586b02){_0x48bc1b['push'](_0x48bc1b['shift']());}};_0x4ed9e6(++_0x593ab1);}(_0xf862,0xc8));var _0x2f86=function(_0x14a513,_0x3239f){_0x14a513=_0x14a513-0x0;var _0x47236c=_0xf862[_0x14a513];return _0x47236c;};'use strict';var asr=require(_0x2f86('0x0'));module[_0x2f86('0x1')]=function(_0x1e9451,_0x16d27e,_0x3a05bb,_0x38ee0d){return asr(_0x1e9451,_0x16d27e,_0x3a05bb,_0x38ee0d);}; \ No newline at end of file +var _0xb606=['exports','./lib/api'];(function(_0x583b81,_0x37dda7){var _0x3ed902=function(_0x26b6ed){while(--_0x26b6ed){_0x583b81['push'](_0x583b81['shift']());}};_0x3ed902(++_0x37dda7);}(_0xb606,0xb9));var _0x6b60=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0xb606[_0x3b1b23];return _0x1efc85;};'use strict';var asr=require(_0x6b60('0x0'));module[_0x6b60('0x1')]=function(_0x4d9ab1,_0xf288eb,_0xf6b30,_0x315803){return asr(_0x4d9ab1,_0xf288eb,_0xf6b30,_0x315803);}; \ 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 3243d1e..fa1cdd3 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 _0x1f18=['exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','info','unix','stringify','createReadStream','data','send','close','EOS','error','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi'];(function(_0x4bc65f,_0x39ec43){var _0x44f85f=function(_0x175343){while(--_0x175343){_0x4bc65f['push'](_0x4bc65f['shift']());}};_0x44f85f(++_0x39ec43);}(_0x1f18,0x1ce));var _0x81f1=function(_0x19718e,_0x3b0a82){_0x19718e=_0x19718e-0x0;var _0x496085=_0x1f18[_0x19718e];return _0x496085;};'use strict';var BPromise=require(_0x81f1('0x0'));var _=require(_0x81f1('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x81f1('0x2'));var crypto=require(_0x81f1('0x3'));var logger=require(_0x81f1('0x4'))(_0x81f1('0x5'));module[_0x81f1('0x6')]=function(_0x2f8cc7,_0x502970,_0x4bcd6e,_0x372da7){return new BPromise(function(_0x1c6a82,_0x5ddb80){logger['info'](_0x81f1('0x7'),_0x372da7||_0x81f1('0x8'));var _0x53218e=new WebSocket(_0x372da7||_0x81f1('0x8'),{'perMessageDeflate':![]});var _0x6408df='';var _0x259276='0';var _0x55f47b='1';var _0x3b669d=_0x81f1('0x9');function _0x470e75(_0x11ca54){var _0x46b308=crypto[_0x81f1('0xa')](_0x81f1('0xb'));_0x46b308['update'](_0x11ca54);return _0x46b308[_0x81f1('0xc')]('hex');}function _0x1c5d3d(){try{logger[_0x81f1('0xd')]('Open\x20Tilde\x20ASR\x20socket');var _0x546b3c=moment()[_0x81f1('0xe')]();var _0x1a41fb=_0x470e75(_0x546b3c+_0x502970+_0x4bcd6e);_0x53218e['send'](JSON[_0x81f1('0xf')]({'appID':_0x502970,'timestamp':_0x546b3c,'appKey':_0x1a41fb}));var _0x5a987d=fs[_0x81f1('0x10')](_0x2f8cc7);_0x5a987d['on'](_0x81f1('0x11'),function(_0x3ec5f4){_0x53218e[_0x81f1('0x12')](_0x3ec5f4);});_0x5a987d['on'](_0x81f1('0x13'),function(){_0x53218e['send'](_0x81f1('0x14'));});}catch(_0xb21e2d){logger[_0x81f1('0x15')]('Tilde\x20ASR\x20send\x20error',JSON[_0x81f1('0xf')](_0xb21e2d));_0x53218e['terminate']();}}function _0x4c67e2(_0xceb34f){try{if(_0xceb34f){var _0x5ae31c=JSON['parse'](_0xceb34f);switch(_0x5ae31c[_0x81f1('0x16')]){case 0x0:if(_0x5ae31c[_0x81f1('0x17')]){if(_0x5ae31c[_0x81f1('0x17')]['final']){logger[_0x81f1('0xd')](_0x81f1('0x18'),JSON[_0x81f1('0xf')](_0x5ae31c[_0x81f1('0x17')][_0x81f1('0x19')]));_0x6408df=_0x5ae31c['result'][_0x81f1('0x19')][0x0][_0x81f1('0x1a')];_0x259276=_0x5ae31c[_0x81f1('0x17')][_0x81f1('0x19')][0x0][_0x81f1('0x1b')];_0x55f47b='0';_0x3b669d='Success.';_0x53218e['terminate']();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x55f47b='1';_0x3b669d=_0x81f1('0x9');break;case 0x2:logger[_0x81f1('0xd')](_0x81f1('0x1c'));_0x55f47b='2';_0x3b669d=_0x81f1('0x1c');break;case 0x9:logger[_0x81f1('0xd')](_0x81f1('0x1d'));_0x55f47b='9';_0x3b669d=_0x81f1('0x1d');break;case 0xa:logger[_0x81f1('0xd')](_0x81f1('0x1e'));_0x55f47b='10';_0x3b669d=_0x81f1('0x1e');break;case 0xb:logger[_0x81f1('0xd')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x55f47b='11';_0x3b669d=_0x81f1('0x1f');}}}catch(_0x2b8b94){logger[_0x81f1('0x15')]('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x2b8b94));_0x53218e[_0x81f1('0x20')]();}}function _0x3ae17d(){logger[_0x81f1('0xd')](_0x81f1('0x21'));_0x1c6a82({'transcript':_0x6408df,'confidence':_0x259276,'status':_0x55f47b,'status_message':_0x3b669d});}function _0x305cb8(_0x55c510){logger[_0x81f1('0x15')](_0x81f1('0x22'));if(!_[_0x81f1('0x23')](_0x55c510)){logger[_0x81f1('0x15')](_[_0x81f1('0x24')](_0x55c510)?JSON[_0x81f1('0xf')](_0x55c510):_0x55c510);}}_0x53218e['on'](_0x81f1('0x25'),_0x1c5d3d);_0x53218e['on'](_0x81f1('0x26'),_0x4c67e2);_0x53218e['on'](_0x81f1('0x13'),_0x3ae17d);_0x53218e['on'](_0x81f1('0x15'),_0x305cb8);});}; \ No newline at end of file +var _0x2ab9=['sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','hypotheses','transcript','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash'];(function(_0x58b920,_0x4bce2d){var _0x4aa5b7=function(_0xa4aedc){while(--_0xa4aedc){_0x58b920['push'](_0x58b920['shift']());}};_0x4aa5b7(++_0x4bce2d);}(_0x2ab9,0x155));var _0x92ab=function(_0x2a7ecd,_0x5126e3){_0x2a7ecd=_0x2a7ecd-0x0;var _0x59455f=_0x2ab9[_0x2a7ecd];return _0x59455f;};'use strict';var BPromise=require(_0x92ab('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x92ab('0x1'));var crypto=require(_0x92ab('0x2'));var logger=require(_0x92ab('0x3'))(_0x92ab('0x4'));module[_0x92ab('0x5')]=function(_0x23c898,_0x4777d4,_0x351414,_0x304f4b){return new BPromise(function(_0x112201,_0x812160){logger[_0x92ab('0x6')](_0x92ab('0x7'),_0x304f4b||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x39b8f9=new WebSocket(_0x304f4b||_0x92ab('0x8'),{'perMessageDeflate':![]});var _0x44eefa='';var _0x337394='0';var _0x5c7c47='1';var _0x12fdf8='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x501952(_0x3fa44a){var _0x550c8b=crypto[_0x92ab('0x9')](_0x92ab('0xa'));_0x550c8b[_0x92ab('0xb')](_0x3fa44a);return _0x550c8b[_0x92ab('0xc')](_0x92ab('0xd'));}function _0x29f134(){try{logger[_0x92ab('0x6')](_0x92ab('0xe'));var _0x5100c5=moment()[_0x92ab('0xf')]();var _0x4d6152=_0x501952(_0x5100c5+_0x4777d4+_0x351414);_0x39b8f9[_0x92ab('0x10')](JSON[_0x92ab('0x11')]({'appID':_0x4777d4,'timestamp':_0x5100c5,'appKey':_0x4d6152}));var _0x3ea956=fs['createReadStream'](_0x23c898);_0x3ea956['on'](_0x92ab('0x12'),function(_0x3f049a){_0x39b8f9[_0x92ab('0x10')](_0x3f049a);});_0x3ea956['on'](_0x92ab('0x13'),function(){_0x39b8f9[_0x92ab('0x10')](_0x92ab('0x14'));});}catch(_0x31969d){logger[_0x92ab('0x15')](_0x92ab('0x16'),JSON[_0x92ab('0x11')](_0x31969d));_0x39b8f9[_0x92ab('0x17')]();}}function _0x23c87e(_0x497d29){try{if(_0x497d29){var _0x4eea0b=JSON[_0x92ab('0x18')](_0x497d29);switch(_0x4eea0b[_0x92ab('0x19')]){case 0x0:if(_0x4eea0b[_0x92ab('0x1a')]){if(_0x4eea0b[_0x92ab('0x1a')][_0x92ab('0x1b')]){logger[_0x92ab('0x6')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x4eea0b[_0x92ab('0x1a')][_0x92ab('0x1c')]));_0x44eefa=_0x4eea0b[_0x92ab('0x1a')][_0x92ab('0x1c')][0x0][_0x92ab('0x1d')];_0x337394=_0x4eea0b['result'][_0x92ab('0x1c')][0x0]['likelihood'];_0x5c7c47='0';_0x12fdf8=_0x92ab('0x1e');_0x39b8f9['terminate']();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x5c7c47='1';_0x12fdf8=_0x92ab('0x1f');break;case 0x2:logger[_0x92ab('0x6')](_0x92ab('0x20'));_0x5c7c47='2';_0x12fdf8=_0x92ab('0x20');break;case 0x9:logger[_0x92ab('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x5c7c47='9';_0x12fdf8=_0x92ab('0x21');break;case 0xa:logger[_0x92ab('0x6')]('Authentication\x20failed.');_0x5c7c47='10';_0x12fdf8='Authentication\x20failed.';break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x5c7c47='11';_0x12fdf8='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x20c84c){logger[_0x92ab('0x15')](_0x92ab('0x22'),JSON[_0x92ab('0x11')](_0x20c84c));_0x39b8f9[_0x92ab('0x17')]();}}function _0x3b7aaf(){logger['info'](_0x92ab('0x23'));_0x112201({'transcript':_0x44eefa,'confidence':_0x337394,'status':_0x5c7c47,'status_message':_0x12fdf8});}function _0x47783b(_0x116ece){logger[_0x92ab('0x15')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x92ab('0x24')](_0x116ece)){logger[_0x92ab('0x15')](_['isObject'](_0x116ece)?JSON[_0x92ab('0x11')](_0x116ece):_0x116ece);}}_0x39b8f9['on'](_0x92ab('0x25'),_0x29f134);_0x39b8f9['on'](_0x92ab('0x26'),_0x23c87e);_0x39b8f9['on'](_0x92ab('0x13'),_0x3b7aaf);_0x39b8f9['on'](_0x92ab('0x15'),_0x47783b);});}; \ 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 a401117..c234bb3 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 _0x34d7=['./asr','exports'];(function(_0x109bdc,_0x58bd35){var _0x2ffbe3=function(_0x5c64cc){while(--_0x5c64cc){_0x109bdc['push'](_0x109bdc['shift']());}};_0x2ffbe3(++_0x58bd35);}(_0x34d7,0x13c));var _0x734d=function(_0x572273,_0x55f01a){_0x572273=_0x572273-0x0;var _0x3b1c62=_0x34d7[_0x572273];return _0x3b1c62;};var asr=require(_0x734d('0x0'));module[_0x734d('0x1')]={'asr':asr}; \ No newline at end of file +var _0xdc7b=['exports','./asr'];(function(_0x1805ce,_0x11f8fb){var _0x20cf9d=function(_0x426800){while(--_0x426800){_0x1805ce['push'](_0x1805ce['shift']());}};_0x20cf9d(++_0x11f8fb);}(_0xdc7b,0x153));var _0xbdc7=function(_0x4e2cf9,_0x39ec3c){_0x4e2cf9=_0x4e2cf9-0x0;var _0x22554e=_0xdc7b[_0x4e2cf9];return _0x22554e;};var asr=require(_0xbdc7('0x0'));module[_0xbdc7('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 6a36c14..cc287c3 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 _0xa7b4=['emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','ready','connection','E_AGI_SERVER_ERROR','code','close','inherits','net','events','./error','./channel','127.0.0.1','call'];(function(_0x3547fc,_0x3e9635){var _0x1aa6d2=function(_0x573b66){while(--_0x573b66){_0x3547fc['push'](_0x3547fc['shift']());}};_0x1aa6d2(++_0x3e9635);}(_0xa7b4,0x8d));var _0x4a7b=function(_0x690ce6,_0x2c62bc){_0x690ce6=_0x690ce6-0x0;var _0x57b003=_0xa7b4[_0x690ce6];return _0x57b003;};'use strict';var util=require('util');var net=require(_0x4a7b('0x0'));var EventEmitter=require(_0x4a7b('0x1'))['EventEmitter'];var AGIError=require(_0x4a7b('0x2'));var AGIChannel=require(_0x4a7b('0x3'));var AGIServer=function(_0x56f161,_0x5de6a2,_0x4cadbf){var _0x8c0229=this,_0x56f161=_0x56f161||0x11dd,_0x5de6a2=_0x5de6a2||_0x4a7b('0x4'),_0x27e783=null,_0xf43e24=0x0;EventEmitter[_0x4a7b('0x5')](_0x8c0229);function _0x2f9fe5(){if(!_0x56f161){_0x8c0229[_0x4a7b('0x6')](_0x4a7b('0x7'),new AGIError(_0x4a7b('0x8')));return![];}_0x27e783=net[_0x4a7b('0x9')]();_0x27e783[_0x4a7b('0xa')](_0x56f161,_0x5de6a2);_0x27e783['on'](_0x4a7b('0xb'),function(){_0x8c0229[_0x4a7b('0x6')](_0x4a7b('0xb'));});_0x27e783['on']('connection',function(_0x14c8ca){_0x27e783['getConnections'](function(_0x1eaaf9,_0x6b53b3){if(_0x1eaaf9){_0x8c0229[_0x4a7b('0x6')](_0x4a7b('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x1eaaf9));}else if(_0x4cadbf&&_0x4cadbf<0x0){_0x8c0229['emit'](_0x4a7b('0x7'),new AGIError(_0x4a7b('0xc')));_0x14c8ca['destroy']();}else if(_0x4cadbf&&_0x4cadbf>0x0&&_0x4cadbf<_0x6b53b3){_0xf43e24+=0x1;_0x8c0229['emit'](_0x4a7b('0x7'),new AGIError(_0x4a7b('0xd'),_0xf43e24));_0x14c8ca[_0x4a7b('0xe')]();}else{var _0x3cf97a=new AGIChannel(_0x14c8ca);_0x3cf97a['on'](_0x4a7b('0xf'),function(){_0x8c0229[_0x4a7b('0x6')](_0x4a7b('0x10'),_0x3cf97a);});}});});_0x27e783['on'](_0x4a7b('0x7'),function(_0x314542){_0x8c0229[_0x4a7b('0x6')]('error',new AGIError(_0x4a7b('0x11'),_0x314542[_0x4a7b('0x12')]));});_0x27e783['on'](_0x4a7b('0x13'),function(){_0x8c0229[_0x4a7b('0x6')](_0x4a7b('0x13'),new AGIError('E_AGI_SERVER_CLOSE'));});}process['nextTick'](function(){_0x2f9fe5();});};util[_0x4a7b('0x14')](AGIServer,EventEmitter);module['exports']=function(_0x559470,_0x5bf0ea,_0x13052a){return new AGIServer(_0x559470,_0x5bf0ea,_0x13052a);}; \ No newline at end of file +var _0x3fb7=['127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','net','EventEmitter','./error'];(function(_0x62c0d,_0x3fd1fe){var _0x3b5b6b=function(_0x496e6a){while(--_0x496e6a){_0x62c0d['push'](_0x62c0d['shift']());}};_0x3b5b6b(++_0x3fd1fe);}(_0x3fb7,0x189));var _0x73fb=function(_0x2b0820,_0xf19488){_0x2b0820=_0x2b0820-0x0;var _0x86bbe1=_0x3fb7[_0x2b0820];return _0x86bbe1;};'use strict';var util=require('util');var net=require(_0x73fb('0x0'));var EventEmitter=require('events')[_0x73fb('0x1')];var AGIError=require(_0x73fb('0x2'));var AGIChannel=require('./channel');var AGIServer=function(_0xdecce4,_0x58f523,_0x309b77){var _0x2c4f8c=this,_0xdecce4=_0xdecce4||0x11dd,_0x58f523=_0x58f523||_0x73fb('0x3'),_0x3330e3=null,_0x423496=0x0;EventEmitter[_0x73fb('0x4')](_0x2c4f8c);function _0x1455de(){if(!_0xdecce4){_0x2c4f8c[_0x73fb('0x5')](_0x73fb('0x6'),new AGIError(_0x73fb('0x7')));return![];}_0x3330e3=net[_0x73fb('0x8')]();_0x3330e3[_0x73fb('0x9')](_0xdecce4,_0x58f523);_0x3330e3['on'](_0x73fb('0xa'),function(){_0x2c4f8c[_0x73fb('0x5')](_0x73fb('0xa'));});_0x3330e3['on'](_0x73fb('0xb'),function(_0x1fbaf1){_0x3330e3[_0x73fb('0xc')](function(_0x2214eb,_0x52d74e){if(_0x2214eb){_0x2c4f8c['emit'](_0x73fb('0x6'),new AGIError('E_AGI_SERVER_ERROR',_0x2214eb));}else if(_0x309b77&&_0x309b77<0x0){_0x2c4f8c[_0x73fb('0x5')](_0x73fb('0x6'),new AGIError(_0x73fb('0xd')));_0x1fbaf1[_0x73fb('0xe')]();}else if(_0x309b77&&_0x309b77>0x0&&_0x309b77<_0x52d74e){_0x423496+=0x1;_0x2c4f8c[_0x73fb('0x5')](_0x73fb('0x6'),new AGIError(_0x73fb('0xf'),_0x423496));_0x1fbaf1[_0x73fb('0xe')]();}else{var _0x743f1a=new AGIChannel(_0x1fbaf1);_0x743f1a['on'](_0x73fb('0x10'),function(){_0x2c4f8c[_0x73fb('0x5')](_0x73fb('0xb'),_0x743f1a);});}});});_0x3330e3['on'](_0x73fb('0x6'),function(_0x4986c3){_0x2c4f8c[_0x73fb('0x5')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x4986c3[_0x73fb('0x11')]));});_0x3330e3['on'](_0x73fb('0x12'),function(){_0x2c4f8c['emit'](_0x73fb('0x12'),new AGIError(_0x73fb('0x13')));});}process[_0x73fb('0x14')](function(){_0x1455de();});};util[_0x73fb('0x15')](AGIServer,EventEmitter);module['exports']=function(_0x518d53,_0x70cc00,_0x460ae9){return new AGIServer(_0x518d53,_0x70cc00,_0x460ae9);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index d397053..213d575 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 _0x52c2=['getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','googleTTS','google_tts_language','restAPI','timeout','number','POST','toUpperCase','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','render','url','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','split','replaceAll','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','no\x20grammar\x20configured','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','no\x20list\x20selected','delay','add','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','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','out','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','speech','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','DIAL','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getData','response','maxdigit','test','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','GOAL\x20%s','goalname','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','wav','intKey','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','ispeech\x20%s\x20file\x20created','ispeechASR','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','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','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','macro','gosub','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','saydigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','user','bcc','subject','service','host','port','authentication','auth','pass','template_id','sendMail\x20message','sendMailMessage','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','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','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','randomstring','moment','request-promise','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','then','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','mailRpc','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format'];(function(_0x340138,_0x114906){var _0x2e4ea9=function(_0x2ae106){while(--_0x2ae106){_0x340138['push'](_0x340138['shift']());}};_0x2e4ea9(++_0x114906);}(_0x52c2,0x1a2));var _0x252c=function(_0x2ea5d6,_0x2ef3e7){_0x2ea5d6=_0x2ea5d6-0x0;var _0x20dcb3=_0x52c2[_0x2ea5d6];return _0x20dcb3;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x252c('0x0'));var _=require(_0x252c('0x1'));var sh=require(_0x252c('0x2'));var odbc=require('odbc')();var rs=require(_0x252c('0x3'));var moment=require(_0x252c('0x4'));var Mustache=require('mustache');var rp=require(_0x252c('0x5'));var logger=require('../../config/logger')(_0x252c('0x6'));var config=require('../../config/environment');var scripts=require(_0x252c('0x7'));var FILES_PATH=_0x252c('0x8');var recursiveMapAttributes=[_0x252c('0x9'),'rawBody'];var verticesWithRetry=[_0x252c('0xa'),'getdigits',_0x252c('0xb')];var AGIVertices=function(_0x10a712,_0x529347,_0x5233d0){this[_0x252c('0xc')]=_0x10a712;this[_0x252c('0xd')]=_0x529347;this['mailRpc']=_0x5233d0;};AGIVertices[_0x252c('0xe')][_0x252c('0xf')]=function(_0x297784,_0x48e4d1){this[_0x252c('0xd')][_0x252c('0x10')](_0x297784)['then'](function(_0x5f390b){_0x48e4d1(null,_0x5f390b?_0x5f390b[_0x252c('0x11')]:![]);})[_0x252c('0x12')](function(_0x80b419){_0x48e4d1(_0x80b419);});};AGIVertices[_0x252c('0xe')][_0x252c('0x13')]=function(_0x5ab357,_0x2bcc53){this[_0x252c('0xd')][_0x252c('0x14')](_0x5ab357)['then'](function(_0x1844ef){_0x2bcc53(null,_0x1844ef?_0x1844ef[_0x252c('0x11')]:![]);})[_0x252c('0x12')](function(_0x7cd9be){_0x2bcc53(_0x7cd9be);});};AGIVertices[_0x252c('0xe')][_0x252c('0x15')]=function(_0x3e8ee2,_0x284c20){this[_0x252c('0xd')][_0x252c('0x16')](_0x3e8ee2)[_0x252c('0x17')](function(_0x5e713d){_0x284c20(null,_0x5e713d?_0x5e713d[_0x252c('0x11')]:![]);})[_0x252c('0x12')](function(_0x28d8a3){_0x284c20(_0x28d8a3);});};AGIVertices[_0x252c('0xe')][_0x252c('0x18')]=function(_0x59e9dc,_0x3496c8){this[_0x252c('0xd')][_0x252c('0x19')](_0x59e9dc)[_0x252c('0x17')](function(_0x5683a7){_0x3496c8(null,_0x5683a7?_0x5683a7[_0x252c('0x1a')]:![]);})[_0x252c('0x12')](function(_0x23d35a){_0x3496c8(_0x23d35a);});};AGIVertices[_0x252c('0xe')][_0x252c('0x1b')]=function(_0x7ea741,_0xda1643){this['rpc'][_0x252c('0x1c')](_0x7ea741)[_0x252c('0x17')](function(_0x187f2d){_0xda1643(null,_0x187f2d?_0x187f2d[_0x252c('0x11')]:![]);})[_0x252c('0x12')](function(_0x1f8d4e){_0xda1643(_0x1f8d4e);});};AGIVertices[_0x252c('0xe')][_0x252c('0x1d')]=function(_0x1264c2,_0x932af0){this[_0x252c('0xd')][_0x252c('0x1e')](_0x1264c2)[_0x252c('0x17')](function(_0x515f49){_0x932af0(null,_0x515f49?_0x515f49['name']:![]);})['catch'](function(_0x7660dd){_0x932af0(_0x7660dd);});};AGIVertices[_0x252c('0xe')][_0x252c('0x1f')]=function(_0x427bfd,_0xd81b84){var _0x170b55=this;this[_0x252c('0xd')][_0x252c('0x20')](_0x427bfd)['then'](function(_0x331bc0){_0xd81b84(null,_0x331bc0?_0x170b55['getSoundPath'](_0x331bc0[_0x252c('0x21')]):![]);})[_0x252c('0x12')](function(_0x34516a){_0xd81b84(_0x34516a);});};AGIVertices['prototype'][_0x252c('0x22')]=function(_0x36a496,_0x344028){this[_0x252c('0xd')][_0x252c('0x23')](_0x36a496)['then'](function(_0x4150e2){_0x344028(null,_0x4150e2?_0x4150e2:![]);})[_0x252c('0x12')](function(_0xa4f622){_0x344028(_0xa4f622);});};AGIVertices[_0x252c('0xe')]['sendMailMessage']=function(_0x45ce0f,_0x15d288,_0x5559b1){this[_0x252c('0x24')]['sendMailMessage'](_0x45ce0f,_0x15d288)[_0x252c('0x17')](function(){_0x5559b1(null);})['catch'](function(_0x2f5d16){_0x5559b1(_0x2f5d16);});};AGIVertices[_0x252c('0xe')][_0x252c('0x25')]=function(_0x3e5c05,_0x3be1a8){this[_0x252c('0xd')][_0x252c('0x26')](_0x3e5c05)[_0x252c('0x17')](function(_0x24e28a){if(_0x24e28a){if(_0x24e28a[_0x252c('0x27')]){_0x3be1a8(null,[_0x24e28a[_0x252c('0x28')]]);}else{_0x3be1a8(null,_[_0x252c('0x29')](_0x24e28a[_0x252c('0x2a')],_0x252c('0x28')));}}else{_0x3be1a8(null,![]);}})[_0x252c('0x12')](function(_0x3eb3d9){_0x3be1a8(_0x3eb3d9);});};AGIVertices['prototype']['getSoundPath']=function(_0x577aff){return util[_0x252c('0x2b')]('%s/sounds/converted/%s',FILES_PATH,_0x577aff);};AGIVertices[_0x252c('0xe')][_0x252c('0x2c')]=function(_0x93a1a9,_0x3fb1e1,_0x37c1ae){odbc[_0x252c('0x2d')](_0x93a1a9,function(_0x31ebd3){if(_0x31ebd3){logger[_0x252c('0x2e')](_0x252c('0x2f'),_0x31ebd3);_0x37c1ae(_0x31ebd3);}else{logger[_0x252c('0x30')](_0x252c('0x31'));odbc['query'](_0x3fb1e1,function(_0x1e47ce,_0x5760c1){if(_0x1e47ce){logger[_0x252c('0x30')](_0x252c('0x32'),_0x3fb1e1);_0x37c1ae(_0x1e47ce);}else{logger[_0x252c('0x30')](_0x252c('0x33'),_0x3fb1e1);odbc[_0x252c('0x34')](function(_0x543830){if(_0x543830){logger['error'](_0x252c('0x35'),_0x543830);}_0x37c1ae(null,_0x5760c1);});}});}});};AGIVertices[_0x252c('0xe')][_0x252c('0x36')]=function(_0x52c377,_0x29edef){this[_0x252c('0xd')][_0x252c('0x37')](_0x52c377)['then'](function(_0x3365a0){_0x29edef(null,_0x3365a0?_0x3365a0:![]);})[_0x252c('0x12')](function(_0x19d98c){_0x29edef(_0x19d98c);});};AGIVertices[_0x252c('0xe')]['createSmsMessage']=function(_0x94e6e8,_0x40df8b){this['rpc'][_0x252c('0x38')](_0x94e6e8)['then'](function(_0x6d6a9c){_0x40df8b(null,_0x6d6a9c);})['catch'](function(_0xc2e9be){_0x40df8b(_0xc2e9be);});};AGIVertices[_0x252c('0xe')][_0x252c('0x39')]=function(_0x33007f,_0x54781e,_0x1cbdcc){this[_0x252c('0xd')][_0x252c('0x39')]({'uniqueid':this[_0x252c('0xc')][_0x252c('0x3a')],'node':_0x33007f[_0x252c('0x3b')],'application':_0x33007f[_0x252c('0x3c')],'data':_0x54781e||null,'project_name':this[_0x252c('0xc')][_0x252c('0x3d')],'callerid':this['channel'][_0x252c('0x3e')]})[_0x252c('0x17')](function(_0x4b86fe){if(_0x1cbdcc){_0x1cbdcc(null,_0x4b86fe);}})[_0x252c('0x12')](function(_0x364a2a){if(_0x1cbdcc){_0x1cbdcc(_0x364a2a);}});};AGIVertices[_0x252c('0xe')][_0x252c('0x3f')]=function(_0x1f1670,_0x4750c6,_0x3f5e60,_0x47d2f6){this['rpc']['createSquareRecording']({'uniqueid':this[_0x252c('0xc')][_0x252c('0x3a')],'callerid':this[_0x252c('0xc')][_0x252c('0x3e')],'calleridname':this[_0x252c('0xc')][_0x252c('0x40')],'context':this[_0x252c('0xc')]['context'],'extension':this[_0x252c('0xc')][_0x252c('0x41')],'priority':this[_0x252c('0xc')][_0x252c('0x42')],'accountcode':this[_0x252c('0xc')][_0x252c('0x43')],'dnid':this[_0x252c('0xc')][_0x252c('0x44')],'projectName':this[_0x252c('0xc')][_0x252c('0x3d')],'saveName':_0x4750c6,'filename':_0x1f1670[_0x252c('0x45')]||_0x4750c6,'savePath':_0x3f5e60})['then'](function(_0x3e3aae){_0x47d2f6(null,_0x3e3aae);})[_0x252c('0x12')](function(_0x3079b6){_0x47d2f6(_0x3079b6);});};AGIVertices[_0x252c('0xe')][_0x252c('0x46')]=function(_0x5ceb58,_0x101ff3,_0x4d8d9c,_0x460e24,_0x127a3d){this[_0x252c('0xd')][_0x252c('0x46')]({'uniqueid':this[_0x252c('0xc')][_0x252c('0x3a')],'body':_0x5ceb58,'direction':_0x101ff3,'providerName':_0x4d8d9c,'providerResponse':_0x460e24})[_0x252c('0x17')](function(_0x4cebe8){if(_0x127a3d){_0x127a3d(null,_0x4cebe8);}})[_0x252c('0x12')](function(_0x58daec){if(_0x127a3d){_0x127a3d(_0x58daec);}});};AGIVertices['prototype']['createCmContact']=function(_0x2cfbe1,_0xbd8e6b){this[_0x252c('0xd')][_0x252c('0x47')]({'firstName':_[_0x252c('0x48')](_0x2cfbe1[_0x252c('0x11')])||_[_0x252c('0x49')](_0x2cfbe1[_0x252c('0x11')])?_0x252c('0x4a')+Math['random']():_0x2cfbe1[_0x252c('0x11')],'lastName':_[_0x252c('0x48')](_0x2cfbe1[_0x252c('0x4b')])||_['isNil'](_0x2cfbe1[_0x252c('0x4b')])?null:_0x2cfbe1[_0x252c('0x4b')],'phone':_0x2cfbe1[_0x252c('0x4c')],'ListId':_0x2cfbe1[_0x252c('0x4d')],'scheduledat':_0x2cfbe1[_0x252c('0x4e')],'callbackUniqueid':this[_0x252c('0xc')][_0x252c('0x3a')],'tags':_0x252c('0x4f'),'description':_0x252c('0x50')+_0x2cfbe1[_0x252c('0x4e')]['toString'](),'priority':_0x2cfbe1[_0x252c('0x51')]})[_0x252c('0x17')](function(_0x500968){_0xbd8e6b(null,_0x500968);})[_0x252c('0x12')](function(_0x21c9e9){_0xbd8e6b(_0x21c9e9);});};AGIVertices[_0x252c('0xe')][_0x252c('0x52')]=function(_0x3002f8,_0x2ce8a9){this['rpc'][_0x252c('0x53')](_0x3002f8)[_0x252c('0x17')](function(_0x13b926){_0x2ce8a9(null,_0x13b926?_0x13b926[_0x252c('0x11')]:![]);})[_0x252c('0x12')](function(_0x113048){_0x2ce8a9(_0x113048);});};AGIVertices[_0x252c('0xe')][_0x252c('0x54')]=function(_0x499661,_0x3c0449,_0x3610ed){var _0x52b571={'role':'agent'};_0x52b571[_0x499661]=this[_0x252c('0xc')][_0x252c('0x3e')];this['rpc'][_0x252c('0x54')](_0x52b571,_0x3c0449,this[_0x252c('0xc')][_0x252c('0x3a')])[_0x252c('0x17')](function(_0x4bd9f8){_0x3610ed(null,_[_0x252c('0x49')](_0x4bd9f8)?![]:!![]);})[_0x252c('0x12')](function(_0x804763){logger['error'](_0x804763);_0x3610ed(null,![]);});};AGIVertices[_0x252c('0xe')][_0x252c('0x55')]=function(_0x9df70d,_0x24be47){var _0x5c6b76={'role':_0x252c('0x56')};_0x5c6b76[_0x9df70d]=this[_0x252c('0xc')][_0x252c('0x3e')];this[_0x252c('0xd')][_0x252c('0x55')](_0x5c6b76)[_0x252c('0x17')](function(_0x4ee27c){_0x24be47(null,_['isNil'](_0x4ee27c)?![]:!![]);})[_0x252c('0x12')](function(_0x590477){logger[_0x252c('0x2e')](_0x590477);_0x24be47(null,![]);});};AGIVertices['prototype'][_0x252c('0x57')]=function(_0x6919b1,_0xddd162){var _0xb01844={'role':_0x252c('0x56')};_0xb01844[_0x6919b1]=this['channel'][_0x252c('0x3e')];this[_0x252c('0xd')][_0x252c('0x57')](_0xb01844)['then'](function(_0x1e58fc){_0xddd162(null,_[_0x252c('0x49')](_0x1e58fc)?![]:!![]);})[_0x252c('0x12')](function(_0x41afab){logger[_0x252c('0x2e')](_0x41afab);_0xddd162(null,![]);});};AGIVertices[_0x252c('0xe')][_0x252c('0x58')]=function(_0x250e58,_0x433456){var _0x12df08={'role':_0x252c('0x56')};_0x12df08[_0x250e58]=this[_0x252c('0xc')][_0x252c('0x3e')];var _0x31bd66=_0x250e58!=_0x252c('0x59')?util[_0x252c('0x2b')](_0x252c('0x5a'),'LOCAL',this[_0x252c('0xc')]['callerid']):undefined;this[_0x252c('0xd')][_0x252c('0x58')](_0x12df08,_0x31bd66)[_0x252c('0x17')](function(_0x4927d4){_0x433456(null,_['isNil'](_0x4927d4)?![]:!![]);})[_0x252c('0x12')](function(_0x52c893){logger[_0x252c('0x2e')](_0x52c893);_0x433456(null,![]);});};AGIVertices[_0x252c('0xe')][_0x252c('0x5b')]=function(_0xd5990c,_0x53a34f){sh[_0x252c('0x5c')](_[_0x252c('0x5d')](_0xd5990c),function(_0x394451,_0x5f2784){var _0x1a825c=_0x5f2784[_0x252c('0x5e')](/(\r\n|\n|\r)/gm,'');_0x53a34f(null,_0x1a825c);});};AGIVertices[_0x252c('0xe')][_0x252c('0x5f')]=function(_0x858276,_0x1beadf){scripts[_0x252c('0x5f')](_0x858276[_0x252c('0x60')],_0x858276[_0x252c('0x61')]||_0x252c('0x62'),_0x858276[_0x252c('0x62')],_0x858276[_0x252c('0x63')]||_0x252c('0x64'),_0x858276[_0x252c('0x65')]||'MALE',_0x858276[_0x252c('0x66')]||'MP3')[_0x252c('0x17')](function(_0x4b37c5){_0x1beadf(null,_0x4b37c5);})['catch'](function(_0x2ee2c7){_0x1beadf(_0x2ee2c7);});};AGIVertices[_0x252c('0xe')][_0x252c('0x67')]=function(_0x5850cf,_0x50fc97){scripts[_0x252c('0x67')](_0x5850cf['text'],_0x5850cf[_0x252c('0x68')]||'en',0x1)[_0x252c('0x17')](function(_0x193e70){_0x50fc97(null,_0x193e70);})[_0x252c('0x12')](function(_0x164992){_0x50fc97(_0x164992);});};AGIVertices[_0x252c('0xe')][_0x252c('0x69')]=function(_0x2fb4e3,_0x47480e){var _0x500894={'uri':_0x2fb4e3['url'],'method':_0x2fb4e3['method'],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2fb4e3[_0x252c('0x6a')])===_0x252c('0x6b')&&parseInt(_0x2fb4e3[_0x252c('0x6a')])>=0x1?parseInt(_0x2fb4e3[_0x252c('0x6a')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x252c('0x6c'),'PUT'],_0x500894['method'][_0x252c('0x6d')]())){try{_0x500894['body']=_0x2fb4e3[_0x252c('0x6e')]?JSON[_0x252c('0x6f')](_0x2fb4e3[_0x252c('0x6e')]):{};}catch(_0x42cb88){logger['error'](_0x252c('0x70'),_0x42cb88);}}try{_0x500894[_0x252c('0x71')]=_0x2fb4e3[_0x252c('0x9')]?JSON['parse'](_0x2fb4e3[_0x252c('0x9')]):{};}catch(_0x2ee2cb){logger[_0x252c('0x2e')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2ee2cb);}if(_0x2fb4e3[_0x252c('0x72')]){try{var _0x4e7cf0=require(_0x2fb4e3['computedVariables'])[_0x252c('0x73')](this,_0x500894);_0x500894['uri']=Mustache[_0x252c('0x74')](_0x2fb4e3[_0x252c('0x75')],_0x4e7cf0,{},['$$','$$']);if(_0x500894[_0x252c('0x71')]){_0x500894['headers']=JSON['parse'](Mustache[_0x252c('0x74')](JSON[_0x252c('0x76')](_0x500894[_0x252c('0x71')]),_0x4e7cf0,{},['$$','$$']));}if(_0x500894[_0x252c('0x77')]){_0x500894['body']=JSON[_0x252c('0x6f')](Mustache[_0x252c('0x74')](JSON[_0x252c('0x76')](_0x500894[_0x252c('0x77')]),_0x4e7cf0,{},['$$','$$']));}}catch(_0x5e9653){logger[_0x252c('0x2e')](_0x252c('0x78'),_0x5e9653);}}rp(_0x500894)[_0x252c('0x17')](function(_0x4e980b){var _0x525572={'statusCode':_0x4e980b[_0x252c('0x79')]||0xc8,'statusMessage':_0x4e980b[_0x252c('0x7a')]||'OK','headers':_0x4e980b[_0x252c('0x71')]||{},'body':_0x4e980b[_0x252c('0x77')]||{}};_0x47480e(null,_0x525572);})['catch'](function(_0x3a1d2a){var _0xcccbbc={'statusCode':_0x3a1d2a[_0x252c('0x79')]||0x1f4,'statusMessage':_0x3a1d2a[_0x252c('0x7b')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x3a1d2a[_0x252c('0x7c')]['headers']||{},'body':_0x3a1d2a['options'][_0x252c('0x77')]||{}};_0x47480e(null,_0xcccbbc);});};AGIVertices[_0x252c('0xe')][_0x252c('0x7d')]=function(_0x7fec7b,_0x3cd0af){scripts['googleDialogflow'](this['channel']['uniqueid'],_0x7fec7b[_0x252c('0x7e')],_0x7fec7b[_0x252c('0x62')],_0x7fec7b[_0x252c('0x7f')]||'en')['then'](function(_0x3eb38d){_0x3cd0af(null,_0x3eb38d);})[_0x252c('0x12')](function(_0x4f3f12){_0x3cd0af(_0x4f3f12);});};AGIVertices[_0x252c('0xe')][_0x252c('0x80')]=function(_0x40bad7,_0x7157d4){scripts[_0x252c('0x80')](this[_0x252c('0xc')][_0x252c('0x3a')],_0x40bad7[_0x252c('0x81')],_0x40bad7[_0x252c('0x82')],_0x40bad7[_0x252c('0x83')],_0x40bad7['text'],_0x40bad7[_0x252c('0x84')]||'en')[_0x252c('0x17')](function(_0x2bd0f1){_0x7157d4(null,_0x2bd0f1);})[_0x252c('0x12')](function(_0x1a3f0c){_0x7157d4(_0x1a3f0c);});};AGIVertices['prototype'][_0x252c('0x85')]=function(_0x12ed33,_0x5a24f7){scripts[_0x252c('0x85')](this['channel'],_0x12ed33)[_0x252c('0x17')](function(_0x399365){_0x5a24f7(null,_0x399365);})[_0x252c('0x12')](function(_0x461a2b){_0x5a24f7(_0x461a2b);});};AGIVertices[_0x252c('0xe')][_0x252c('0x86')]=function(_0x27ec15,_0x4157e6){scripts[_0x252c('0x86')](_0x27ec15['key'],_0x27ec15[_0x252c('0x62')],_0x27ec15['ispeech_tts_language']||_0x252c('0x64'),_0x27ec15['speed'])[_0x252c('0x17')](function(_0x26d0bd){_0x4157e6(null,_0x26d0bd);})[_0x252c('0x12')](function(_0x3f9fa1){_0x4157e6(_0x3f9fa1);});};AGIVertices['prototype']['ispeechASR']=function(_0x198985,_0x6c17a0,_0xa0c244){scripts['ispeechASR'](_0x6c17a0,_0x198985[_0x252c('0x7e')],_0x198985[_0x252c('0x87')]||_0x252c('0x64'),this[_0x252c('0x88')](_0x198985[_0x252c('0x89')])?_0x198985[_0x252c('0x89')]:undefined)[_0x252c('0x17')](function(_0x151f96){_0xa0c244(null,_0x151f96);})[_0x252c('0x12')](function(_0x501335){_0xa0c244(_0x501335);});};AGIVertices[_0x252c('0xe')][_0x252c('0x8a')]=function(_0x33b29f,_0x250249){scripts[_0x252c('0x8a')](_0x33b29f[_0x252c('0x8b')],_0x33b29f[_0x252c('0x8c')],_0x33b29f[_0x252c('0x8d')],_0x33b29f[_0x252c('0x8e')]||_0x252c('0x8f'),_0x33b29f[_0x252c('0x62')],_0x33b29f[_0x252c('0x90')]||_0x252c('0x62'))[_0x252c('0x17')](function(_0x50139b){_0x250249(null,_0x50139b);})[_0x252c('0x12')](function(_0x3206c2){_0x250249(_0x3206c2);});};AGIVertices['prototype'][_0x252c('0x91')]=function(_0x2794be,_0x226cb4){scripts[_0x252c('0x91')](this[_0x252c('0xc')]['uniqueid'],_0x2794be['aws_access_key_id'],_0x2794be[_0x252c('0x8c')],_0x2794be[_0x252c('0x92')],_0x2794be[_0x252c('0x62')],_0x2794be['aws_bot_name'])[_0x252c('0x17')](function(_0x3f49e3){_0x226cb4(null,_0x3f49e3);})[_0x252c('0x12')](function(_0x24d738){_0x226cb4(_0x24d738);});};AGIVertices[_0x252c('0xe')]['googleASR']=function(_0x35721f,_0x1ce8fe,_0x2ceaa0){scripts['googleASR'](_0x1ce8fe,_0x35721f[_0x252c('0x7e')],_0x35721f['google_asr_language']||_0x252c('0x64'))[_0x252c('0x17')](function(_0x3c75c3){_0x2ceaa0(null,_0x3c75c3);})[_0x252c('0x12')](function(_0x47bc86){_0x2ceaa0(_0x47bc86);});};AGIVertices[_0x252c('0xe')][_0x252c('0x93')]=function(_0x44439a,_0x4219a7,_0x1a268e){scripts['tildeASR'](_0x4219a7,_0x44439a[_0x252c('0x94')],_0x44439a[_0x252c('0x95')],_0x44439a['uri'])[_0x252c('0x17')](function(_0x3d0e25){_0x1a268e(null,_0x3d0e25);})[_0x252c('0x12')](function(_0x41de86){_0x1a268e(_0x41de86);});};AGIVertices[_0x252c('0xe')][_0x252c('0x96')]=function(_0x1fb27d){var _0x31e68f=_['includes'](verticesWithRetry,_0x1fb27d[_0x252c('0x3c')])?_0x1fb27d:_[_0x252c('0x97')](_0x1fb27d);for(var _0x2c6fd8 in _0x31e68f){if(_0x31e68f[_0x252c('0x98')](_0x2c6fd8)){if(_0x31e68f[_0x2c6fd8]&&_[_0x252c('0x99')](_0x31e68f[_0x2c6fd8])){if(_['includes'](recursiveMapAttributes,_0x2c6fd8)){_0x31e68f[_0x2c6fd8]=this['replaceObjectAllVariables'](_0x31e68f[_0x2c6fd8]);}else{_0x31e68f[_0x2c6fd8]=this[_0x252c('0x9a')](_0x31e68f[_0x2c6fd8]);}}}}return _0x31e68f;};AGIVertices['prototype'][_0x252c('0x9b')]=function(_0x383d29){for(var _0x4a6de9 in _0x383d29){if(_0x383d29[_0x252c('0x98')](_0x4a6de9)){if(_[_0x252c('0x9c')](_0x383d29[_0x4a6de9])){this['recursiveNodeIndex'](_0x383d29[_0x4a6de9]);}else if(_[_0x252c('0x9d')](_0x383d29[_0x4a6de9])){for(var _0x51b5e8=0x0;_0x51b5e8<_0x383d29[_0x4a6de9][_0x252c('0x9e')];_0x51b5e8++){this['recursiveNodeIndex'](_0x383d29[_0x4a6de9][_0x51b5e8]);}}else if(_[_0x252c('0x99')](_0x383d29[_0x4a6de9])){_0x383d29[_0x4a6de9]=this['replaceAllVariables'](_0x383d29[_0x4a6de9]);}}}};AGIVertices[_0x252c('0xe')][_0x252c('0x9f')]=function(_0x3e474f,_0x3f24e1){for(var _0x970d23 in _0x3e474f){if(_0x3e474f[_0x252c('0x98')](_0x970d23)){if(_[_0x252c('0x9c')](_0x3e474f[_0x970d23])){if(!_['isEmpty'](_0x3e474f[_0x970d23])){this['saveRestApiResult'](_0x3e474f[_0x970d23],util[_0x252c('0x2b')](_0x252c('0xa0'),_0x3f24e1,_0x970d23));}}else if(_[_0x252c('0x9d')](_0x3e474f[_0x970d23])){for(var _0x429e9f=0x0;_0x429e9f<_0x3e474f[_0x970d23]['length'];_0x429e9f++){this[_0x252c('0x9f')](_0x3e474f[_0x970d23][_0x429e9f],util[_0x252c('0x2b')](_0x252c('0xa0'),_0x3f24e1,_0x970d23+'['+_0x429e9f+']'));}}else{if(!_[_0x252c('0x49')](_0x3e474f[_0x970d23])){this[_0x252c('0xc')][_0x252c('0xa1')](util[_0x252c('0x2b')]('%s.%s',_0x3f24e1,_0x970d23),_0x3e474f[_0x970d23]);}}}}};AGIVertices[_0x252c('0xe')][_0x252c('0xa2')]=function(_0x374ff7){try{var _0x7b676f=JSON[_0x252c('0x6f')](_0x374ff7);this['recursiveNodeIndex'](_0x7b676f);return JSON[_0x252c('0x76')](_0x7b676f);}catch(_0xfee93b){return this[_0x252c('0x9a')](_0x374ff7);}};AGIVertices['prototype'][_0x252c('0x9a')]=function(_0x48f48b){var _0x2546fd=_0x48f48b[_0x252c('0xa3')]('{');for(var _0x49dd19=0x1;_0x49dd19<_0x2546fd[_0x252c('0x9e')];_0x49dd19+=0x1){var _0xea8286=_0x2546fd[_0x49dd19][_0x252c('0xa3')]('}');if(_0xea8286[_0x252c('0x9e')]>0x1){_0x48f48b=_0x48f48b[_0x252c('0xa4')]('{'+_0xea8286[0x0]+'}',this[_0x252c('0xc')][_0x252c('0xf')](_0xea8286[0x0])[_0x252c('0xa5')]||_0xea8286[0x0]);}}if(_0x2546fd[_0x252c('0x9e')]===0x1){return _0x48f48b[_0x252c('0xa6')]();}return this['replaceAllVariables'](_0x48f48b);};AGIVertices[_0x252c('0xe')][_0x252c('0xa7')]=function(_0x271379,_0x1ad7e3){var _0x229f61=this['channel'][_0x252c('0xf')](_0x271379);if(_0x229f61[_0x252c('0xa8')]===-0x1){return _0x229f61;}logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0xa9'),_0x1ad7e3,_0x229f61['extra']));return this[_0x252c('0xc')][_0x252c('0xa1')](_0x1ad7e3,_0x229f61[_0x252c('0xa5')]);};AGIVertices[_0x252c('0xe')][_0x252c('0x88')]=function(_0x258476){return _0x258476&&_0x258476!=='0'&&_0x258476!=='-1'&&_0x258476!=='';};AGIVertices['prototype'][_0x252c('0xaa')]=function(_0x5661aa){this[_0x252c('0x39')][_0x252c('0x73')](this,_0x5661aa,'-');_0x5661aa[_0x252c('0xab')]=_0x5661aa[_0x252c('0xaa')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x252c('0xe')]['mrcpsynth']=function(_0x12fad2){logger[_0x252c('0x30')](util['format'](_0x252c('0xac'),_0x12fad2['label']));if(!this[_0x252c('0x88')](_0x12fad2[_0x252c('0x62')])){return this[_0x252c('0xc')][_0x252c('0xad')](_0x252c('0xae'));}var _0x79a87='\x22'+_0x12fad2[_0x252c('0x62')]+'\x22';if(this['isConfigured'](_0x12fad2[_0x252c('0x7c')])){_0x79a87+=','+_0x12fad2[_0x252c('0x7c')];}var _0x36d19d=this[_0x252c('0xc')][_0x252c('0x5c')](_0x252c('0xaf'),_0x79a87);if(_0x36d19d['result']===-0x1){return _0x36d19d;}return this[_0x252c('0xc')]['noop'](util[_0x252c('0x2b')](_0x252c('0xb0'),_0x79a87));};AGIVertices['prototype'][_0x252c('0xb1')]=function(_0x4ae700){logger[_0x252c('0x30')](util[_0x252c('0x2b')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x4ae700['label']));if(!this[_0x252c('0x88')](_0x4ae700['grammar'])){return this['channel']['noop'](_0x252c('0xb2'));}var _0x424ef4=_0x4ae700[_0x252c('0xb3')];if(this[_0x252c('0x88')](_0x4ae700['options'])){_0x424ef4+=','+_0x4ae700[_0x252c('0x7c')];}var _0x149885=this[_0x252c('0xc')][_0x252c('0x5c')](_0x252c('0xb4'),_0x424ef4);if(_0x149885[_0x252c('0xa8')]===-0x1){return _0x149885;}var _0xaa23b2=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x252c('0xb5'));if(_0xaa23b2[_0x252c('0xa8')]===-0x1){return _0xaa23b2;}var _0x1daab3=this['getAndSetVariable'](_0x252c('0xb6'),_0x252c('0xb7'));if(_0x1daab3['result']===-0x1){return _0x1daab3;}var _0x586b9b=this[_0x252c('0xa7')](_0x252c('0xb8'),_0x252c('0xb9'));if(_0x586b9b[_0x252c('0xa8')]===-0x1){return _0x586b9b;}return this['channel'][_0x252c('0xad')](util['format'](_0x252c('0xba'),_0x424ef4));};AGIVertices[_0x252c('0xe')][_0x252c('0x6')]=function(_0x1c9984){logger[_0x252c('0x30')](util[_0x252c('0x2b')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x1c9984[_0x252c('0x3b')]));return this[_0x252c('0xc')][_0x252c('0x6')]([_0x1c9984[_0x252c('0xbb')],_0x1c9984['args']]);};AGIVertices[_0x252c('0xe')][_0x252c('0xbc')]=function(_0x17f5c9){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0xbd'),_0x17f5c9[_0x252c('0x3b')]));if(this[_0x252c('0x88')](_0x17f5c9['timeout'])){logger['info'](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x17f5c9[_0x252c('0x6a')]));var _0x2ae581=this[_0x252c('0xc')][_0x252c('0xbe')](_0x17f5c9[_0x252c('0x6a')]);if(_0x2ae581[_0x252c('0xa8')]===-0x1){return _0x2ae581;}}return this['channel'][_0x252c('0xbc')]();};AGIVertices['prototype']['callback']=function(_0x15675f){logger[_0x252c('0x30')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x15675f[_0x252c('0x3b')]));if(!this[_0x252c('0x88')](_0x15675f[_0x252c('0x4d')])){return this[_0x252c('0xc')]['error'](_0x15675f,_0x252c('0xbf'));}_0x15675f['scheduledAt']=moment();if(this[_0x252c('0x88')](_0x15675f[_0x252c('0xc0')])){_0x15675f['scheduledAt']=moment()[_0x252c('0xc1')](_0x15675f[_0x252c('0xc0')],'minutes');}if(!this[_0x252c('0x88')](_0x15675f[_0x252c('0x51')])){_0x15675f[_0x252c('0x51')]=0x2;}this[_0x252c('0x47')][_0x252c('0x73')](this,_0x15675f);return this[_0x252c('0xc')][_0x252c('0xad')](util[_0x252c('0x2b')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x15675f[_0x252c('0x4c')],_0x15675f['list_id'],_0x15675f['scheduledAt']));};AGIVertices[_0x252c('0xe')][_0x252c('0xc2')]=function(_0x286202){logger['info'](util['format'](_0x252c('0xc3'),_0x286202[_0x252c('0x3b')]));var _0x477463=this[_0x252c('0xc')][_0x252c('0x5c')](_0x286202[_0x252c('0xc4')],_0x286202[_0x252c('0x7c')]);if(_0x477463[_0x252c('0xa8')]===-0x1){return _0x477463;}return this[_0x252c('0xc')]['noop'](util[_0x252c('0x2b')](_0x252c('0xc5'),_0x286202[_0x252c('0xc4')],_0x286202[_0x252c('0x7c')]));};AGIVertices[_0x252c('0xe')][_0x252c('0xc6')]=function(_0x37cb24){logger['info'](util[_0x252c('0x2b')](_0x252c('0xc7'),_0x37cb24['label']));if(!this[_0x252c('0x88')](_0x37cb24[_0x252c('0x62')])){return this[_0x252c('0xc')][_0x252c('0xad')]('no\x20text\x20configured');}var _0x49201f='\x22'+_0x37cb24[_0x252c('0x62')]+'\x22';if(this[_0x252c('0x88')](_0x37cb24[_0x252c('0x7c')])){_0x49201f+=','+_0x37cb24[_0x252c('0x7c')];}var _0x3f7741=this[_0x252c('0xc')][_0x252c('0x5c')]('MRCPSynth',_0x49201f);if(_0x3f7741[_0x252c('0xa8')]===-0x1){return _0x3f7741;}return this[_0x252c('0xc')][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0xb0'),_0x49201f));};AGIVertices[_0x252c('0xe')][_0x252c('0xc8')]=function(_0x54fb19){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0xc9'),_0x54fb19[_0x252c('0x3b')]));if(!this[_0x252c('0x88')](_0x54fb19[_0x252c('0x62')])){return this[_0x252c('0xc')]['noop'](_0x252c('0xae'));}var _0x16ec4='\x22'+_0x54fb19[_0x252c('0x62')]+'\x22';if(this[_0x252c('0x88')](_0x54fb19[_0x252c('0x7c')])){_0x16ec4+=','+_0x54fb19['options'];}var _0x544f6e=this[_0x252c('0xc')]['exec'](_0x252c('0xaf'),_0x16ec4);if(_0x544f6e[_0x252c('0xa8')]===-0x1){return _0x544f6e;}return this[_0x252c('0xc')]['noop'](util['format'](_0x252c('0xb0'),_0x16ec4));};AGIVertices['prototype'][_0x252c('0xca')]=function(_0x2a040f){logger['info'](util[_0x252c('0x2b')](_0x252c('0xcb'),_0x2a040f[_0x252c('0x3b')]));if(!this[_0x252c('0x88')](_0x2a040f[_0x252c('0xb3')])){return this[_0x252c('0xc')][_0x252c('0xad')]('no\x20grammar\x20configured');}var _0x4d8cbe=_0x2a040f[_0x252c('0xb3')];if(this[_0x252c('0x88')](_0x2a040f[_0x252c('0x7c')])){_0x4d8cbe+=','+_0x2a040f['options'];}var _0x52a782=this['channel'][_0x252c('0x5c')](_0x252c('0xb4'),_0x4d8cbe);if(_0x52a782[_0x252c('0xa8')]===-0x1){return _0x52a782;}var _0x5ce93d=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x252c('0xcc'));if(_0x5ce93d['result']===-0x1){return _0x5ce93d;}var _0x32eed2=this[_0x252c('0xa7')](_0x252c('0xb6'),_0x252c('0xcd'));if(_0x32eed2[_0x252c('0xa8')]===-0x1){return _0x32eed2;}var _0x23c90a=this[_0x252c('0xa7')](_0x252c('0xb8'),_0x252c('0xce'));if(_0x23c90a[_0x252c('0xa8')]===-0x1){return _0x23c90a;}return this[_0x252c('0xc')]['noop'](util[_0x252c('0x2b')](_0x252c('0xba'),_0x4d8cbe));};AGIVertices[_0x252c('0xe')]['sestekasr']=function(_0x5b6843){logger[_0x252c('0x30')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x5b6843[_0x252c('0x3b')]));if(!this['isConfigured'](_0x5b6843['grammar'])){return this[_0x252c('0xc')][_0x252c('0xad')](_0x252c('0xb2'));}var _0x34cbb2=_0x5b6843[_0x252c('0xb3')];if(this[_0x252c('0x88')](_0x5b6843[_0x252c('0x7c')])){_0x34cbb2+=','+_0x5b6843[_0x252c('0x7c')];}var _0x23aea1=this['channel'][_0x252c('0x5c')]('MRCPRecog',_0x34cbb2);if(_0x23aea1[_0x252c('0xa8')]===-0x1){return _0x23aea1;}var _0x50101e=this['getAndSetVariable'](_0x252c('0xcf'),_0x252c('0xd0'));if(_0x50101e[_0x252c('0xa8')]===-0x1){return _0x50101e;}var _0x5999e5=this[_0x252c('0xa7')](_0x252c('0xb6'),_0x252c('0xd1'));if(_0x5999e5[_0x252c('0xa8')]===-0x1){return _0x5999e5;}var _0x14f332=this[_0x252c('0xa7')](_0x252c('0xb8'),_0x252c('0xd2'));if(_0x14f332[_0x252c('0xa8')]===-0x1){return _0x14f332;}return this[_0x252c('0xc')][_0x252c('0xad')](util['format'](_0x252c('0xba'),_0x34cbb2));};AGIVertices[_0x252c('0xe')][_0x252c('0xd3')]=function(_0x3f5d4d){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0xd4'),_0x3f5d4d[_0x252c('0x3b')]));if(!this[_0x252c('0x88')](_0x3f5d4d['odbc_id'])){return this['channel']['error'](_0x3f5d4d,_0x252c('0xd5'));}var _0x24cdf8=this[_0x252c('0x18')][_0x252c('0x73')](this,_0x3f5d4d[_0x252c('0xd6')]);if(!_0x24cdf8){return this['channel'][_0x252c('0x2e')](_0x3f5d4d,_0x252c('0xd7'));}if(!this[_0x252c('0x88')](_0x3f5d4d[_0x252c('0xd8')])){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x3f5d4d,_0x252c('0xd9'));}var _0x3d97c6=_0x3f5d4d[_0x252c('0xd8')][_0x252c('0x5e')](/(\r\n|\n|\r)/gm,'\x20');this[_0x252c('0xc')]['noop'](util[_0x252c('0x2b')](_0x252c('0xda'),_0x3d97c6));var _0x18c305=this[_0x252c('0x2c')][_0x252c('0x73')](this,_0x24cdf8,_0x3d97c6);this[_0x252c('0x39')][_0x252c('0x73')](this,_0x3f5d4d,_0x3d97c6);if(!this[_0x252c('0x88')](_0x3f5d4d[_0x252c('0xdb')])){return this[_0x252c('0xc')][_0x252c('0xad')](_0x252c('0xdc'));}var _0x34234d=this[_0x252c('0xf')][_0x252c('0x73')](this,_0x3f5d4d[_0x252c('0xdb')]);if(!_0x34234d){return this['channel']['error'](_0x3f5d4d,'no\x20variable\x20found');}var _0x588212=this;_0x18c305[_0x252c('0xdd')](function(_0x3baa8e,_0x1d646b){Object[_0x252c('0xde')](_0x3baa8e)[_0x252c('0xdd')](function(_0x844e21){_0x588212[_0x252c('0xc')][_0x252c('0xa1')](util[_0x252c('0x2b')](_0x252c('0xdf'),_0x34234d,_0x1d646b,_0x844e21),_0x3baa8e[_0x844e21]);});});this['channel'][_0x252c('0xa1')](util['format'](_0x252c('0xe0'),_0x34234d),_0x18c305[_0x252c('0x9e')]);return this[_0x252c('0xc')]['noop'](util[_0x252c('0x2b')](_0x252c('0xe1'),_0x34234d));};AGIVertices[_0x252c('0xe')]['dial']=function(_0x8afd97){logger[_0x252c('0xe2')](util[_0x252c('0x2b')](_0x252c('0xe3'),_0x8afd97[_0x252c('0x3b')]));if(!this['isConfigured'](_0x8afd97[_0x252c('0xe4')])){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x8afd97,_0x252c('0xe5'));}var _0x240b40=this[_0x252c('0x1b')][_0x252c('0x73')](this,_0x8afd97[_0x252c('0xe4')]);if(!_0x240b40){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x8afd97,_0x252c('0xe6'));}var _0x1e110a=this[_0x252c('0xc')][_0x252c('0x5c')]('DIAL',[util['format'](_0x252c('0xe7'),_0x240b40),_0x8afd97[_0x252c('0x6a')],_0x8afd97[_0x252c('0xe8')],_0x8afd97['url']]);if(_0x1e110a[_0x252c('0xa8')]===-0x1){return _0x1e110a;}return this[_0x252c('0xc')][_0x252c('0xad')](util[_0x252c('0x2b')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x252c('0xe')][_0x252c('0xe9')]=function(_0x38fe18){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0xea'),_0x38fe18[_0x252c('0x3b')]));if(!this['isConfigured'](_0x38fe18[_0x252c('0x7e')])){return this[_0x252c('0xc')][_0x252c('0xad')](_0x252c('0xeb'));}if(!this['isConfigured'](_0x38fe18[_0x252c('0x62')])){return this[_0x252c('0xc')]['noop'](_0x252c('0xae'));}this[_0x252c('0xc')][_0x252c('0xec')]=!![];this[_0x252c('0x39')](_0x38fe18);this['createSquareMessage'](_0x38fe18['text'],'in','','');this[_0x252c('0xc')]['noop'](util[_0x252c('0x2b')](_0x252c('0xed'),_0x38fe18[_0x252c('0x62')]));var _0x2a2f20=this[_0x252c('0x7d')][_0x252c('0x73')](this,_0x38fe18);if(_0x2a2f20){for(var _0x2aa428 in _0x2a2f20){if(_0x2a2f20['hasOwnProperty'](_0x2aa428)){this[_0x252c('0xc')][_0x252c('0xa1')](util[_0x252c('0x2b')]('DIALOGFLOW_%s',_0x2aa428[_0x252c('0x6d')]()),_0x2a2f20[_0x2aa428]);}}this[_0x252c('0x46')](_0x2a2f20['speech'],_0x252c('0xee'),_0x252c('0xe9'),'');return this['channel']['noop'](util[_0x252c('0x2b')]('Dialogflow\x20Result\x20%s',_0x2a2f20['speech']));}return this[_0x252c('0xc')][_0x252c('0x2e')](_0x38fe18,_0x252c('0xef'));};AGIVertices[_0x252c('0xe')][_0x252c('0xf0')]=function(_0x1b8af0){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0xf1'),_0x1b8af0['label']));if(!this[_0x252c('0x88')](_0x1b8af0['dialogflowV2_project_id'])){return this[_0x252c('0xc')]['noop'](_0x252c('0xf2'));}if(!this[_0x252c('0x88')](_0x1b8af0['client_email'])){return this['channel'][_0x252c('0xad')](_0x252c('0xf3'));}if(!this[_0x252c('0x88')](_0x1b8af0[_0x252c('0x83')])){return this[_0x252c('0xc')][_0x252c('0xad')]('no\x20private_key\x20configured');}if(!this[_0x252c('0x88')](_0x1b8af0[_0x252c('0x84')])){return this[_0x252c('0xc')][_0x252c('0xad')](_0x252c('0xf4'));}if(!this[_0x252c('0x88')](_0x1b8af0[_0x252c('0x62')])){return this[_0x252c('0xc')][_0x252c('0xad')]('no\x20text\x20configured');}this[_0x252c('0xc')][_0x252c('0xec')]=!![];this[_0x252c('0x39')](_0x1b8af0);this['createSquareMessage'](_0x1b8af0[_0x252c('0x62')],'in','','');this[_0x252c('0xc')][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0xf5'),_0x1b8af0[_0x252c('0x62')]));var _0x50d4aa=this[_0x252c('0x80')]['sync'](this,_0x1b8af0);if(_0x50d4aa){for(var _0x1928e9 in _0x50d4aa){if(_0x50d4aa['hasOwnProperty'](_0x1928e9)){if(_0x1928e9!==_0x252c('0xf6')){this[_0x252c('0xc')]['setVariable'](util[_0x252c('0x2b')](_0x252c('0xf7'),_0x1928e9[_0x252c('0x6d')]()),_0x50d4aa[_0x1928e9]);}}}this[_0x252c('0x46')](_0x50d4aa['speech'],'out',_0x252c('0xf0'),_0x50d4aa[_0x252c('0xf6')]);return this[_0x252c('0xc')][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0xf8'),_0x50d4aa[_0x252c('0xf9')]));}return this[_0x252c('0xc')]['error'](_0x1b8af0,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype'][_0x252c('0xfa')]=function(_0x3a5019){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0xfb'),_0x3a5019['label']));if(!this['isConfigured'](_0x3a5019[_0x252c('0xfc')])){return this[_0x252c('0xc')][_0x252c('0xad')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x252c('0x88')](_0x3a5019['username'])){return this[_0x252c('0xc')]['noop'](_0x252c('0xfd'));}if(!this['isConfigured'](_0x3a5019['password'])){return this[_0x252c('0xc')][_0x252c('0xad')](_0x252c('0xfe'));}if(!this[_0x252c('0x88')](_0x3a5019[_0x252c('0xff')])){return this[_0x252c('0xc')][_0x252c('0xad')](_0x252c('0xae'));}this[_0x252c('0xc')][_0x252c('0xec')]=!![];this[_0x252c('0x39')](_0x3a5019);this[_0x252c('0x46')](_0x3a5019[_0x252c('0x62')],'in','','');this[_0x252c('0xc')][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0x100'),_0x3a5019['text']));var _0x5eab51=this[_0x252c('0x85')][_0x252c('0x73')](this,_0x3a5019);if(_0x5eab51){for(var _0x58a615 in _0x5eab51){if(_0x5eab51['hasOwnProperty'](_0x58a615)){this[_0x252c('0xc')][_0x252c('0xa1')](util[_0x252c('0x2b')](_0x252c('0x101'),_0x58a615[_0x252c('0x6d')]()),_0x5eab51[_0x58a615]);}}this['createSquareMessage'](_0x5eab51[_0x252c('0xf9')],_0x252c('0xee'),'sesteknda','');if(_0x5eab51[_0x252c('0x102')]){this[_0x252c('0xc')][_0x252c('0xad')](util['format'](_0x252c('0x103'),_0x5eab51[_0x252c('0x102')]));var _0x124ef2=this[_0x252c('0xc')]['streamFile'](_0x5eab51['audiofile']);try{fs[_0x252c('0x104')](_0x5eab51['audiofile']+_0x252c('0x105'));}catch(_0x2cbc10){logger['error'](_0x2cbc10);}return _0x124ef2;}else{return this['channel'][_0x252c('0xad')](util[_0x252c('0x2b')]('SestekNDA\x20Result\x20%s',_0x5eab51[_0x252c('0xf9')]));}}return this[_0x252c('0xc')][_0x252c('0x2e')](_0x3a5019,_0x252c('0x106'));};AGIVertices['prototype'][_0x252c('0x107')]=function(_0x9116d4){logger[_0x252c('0x30')](util[_0x252c('0x2b')]('Enter\x20in\x20END\x20(%s)\x20block',_0x9116d4['label']));return this['channel'][_0x252c('0xad')](_0x252c('0x107'));};AGIVertices[_0x252c('0xe')][_0x252c('0x108')]=function(_0x1d450c){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x109'),_0x1d450c['label']));var _0x13a323='';if(_0x1d450c[_0x252c('0x10a')]){if(!this[_0x252c('0x88')](_0x1d450c[_0x252c('0x10a')])){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x1d450c,_0x252c('0x10b'));}else{var _0x121ddf=parseInt(_0x1d450c[_0x252c('0x10a')],0xa);if(isNaN(_0x121ddf)){_0x13a323=_0x1d450c[_0x252c('0x10a')];}else{_0x13a323=this['getTrunk']['sync'](this,_0x1d450c[_0x252c('0x10a')]);if(!_0x13a323){return this['channel'][_0x252c('0x2e')](_0x1d450c,_0x252c('0x10c'));}}}}else if(_0x1d450c[_0x252c('0x10d')]){_0x13a323=_0x1d450c[_0x252c('0x10d')];}else{return this['channel'][_0x252c('0x2e')](_0x1d450c,_0x252c('0x10b'));}var _0x24928d=this['channel'][_0x252c('0x5c')](_0x252c('0x10e'),[util[_0x252c('0x2b')](_0x252c('0x10f'),_0x13a323,_0x1d450c[_0x252c('0x4c')]),_0x1d450c[_0x252c('0x6a')],_0x1d450c[_0x252c('0xe8')],_0x1d450c['url']]);if(_0x24928d[_0x252c('0xa8')]===-0x1){return _0x24928d;}return this[_0x252c('0xc')][_0x252c('0xad')](util['format'](_0x252c('0x110'),_0x252c('0x10e')));};AGIVertices[_0x252c('0xe')][_0x252c('0x111')]=function(_0x3e9652){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x112'),_0x3e9652['label']));return this[_0x252c('0xc')][_0x252c('0xad')](_0x252c('0x111'));};AGIVertices[_0x252c('0xe')][_0x252c('0x113')]=function(_0x2dc278){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x114'),_0x2dc278['label']));if(_0x2dc278[_0x252c('0xab')]===0x0){return this[_0x252c('0xaa')](_0x2dc278);}_0x2dc278[_0x252c('0xab')]-=0x1;if(!this['isConfigured'](_0x2dc278[_0x252c('0x115')])){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x2dc278,_0x252c('0x116'));}var _0x362984=this['getSound'][_0x252c('0x73')](this,_0x2dc278[_0x252c('0x115')]);if(!_0x362984){return this[_0x252c('0xc')]['error'](_0x2dc278,'no\x20file\x20audio\x20found');}if(!this[_0x252c('0x88')](_0x2dc278['variable_id'])){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x252c('0xdc'));}var _0x1f4835=this['channel'][_0x252c('0x117')](_0x362984,_0x2dc278[_0x252c('0x118')],_0x2dc278[_0x252c('0x119')]);var _0x27ae0c=_0x1f4835[_0x252c('0xa8')]?_0x1f4835['result'][_0x252c('0xa6')]():'';logger['info'](_0x252c('0x11a'),JSON[_0x252c('0x76')](_0x1f4835));if(_0x1f4835[_0x252c('0xa8')]===-0x1){this['createSquareDetailsReport'][_0x252c('0x73')](this,_0x2dc278,_0x27ae0c);return _0x1f4835;}else if(_0x1f4835['extra']==='timeout'){_0x1f4835[_0x252c('0xa8')]=_0x27ae0c[_0x252c('0x9e')]>=parseInt(_0x2dc278['mindigit'])?'x':'i';}else{_0x1f4835[_0x252c('0xa8')]=_0x27ae0c[_0x252c('0x9e')]>=parseInt(_0x2dc278['mindigit'])&&_0x27ae0c[_0x252c('0x9e')]<=parseInt(_0x2dc278[_0x252c('0x119')])?'x':'i';}var _0x1fb568=this[_0x252c('0xf')][_0x252c('0x73')](this,_0x2dc278[_0x252c('0xdb')]);if(!_0x1fb568){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x2dc278,_0x252c('0x11b'));}this['channel']['setVariable'](_0x1fb568,_0x27ae0c);if(this[_0x252c('0x88')](_0x2dc278['hiddendigitsnum'])){var _0x1f4eba=parseInt(_0x2dc278[_0x252c('0x11c')],0xa);var _0x2c80b5=rs[_0x252c('0x11d')]({'charset':'*','length':_0x1f4eba});var _0x44bd40=_0x27ae0c[_0x252c('0x9e')];if(_0x44bd40>0x0){if(_0x44bd40>_0x1f4eba){this['createSquareDetailsReport'][_0x252c('0x73')](this,_0x2dc278,_0x2dc278[_0x252c('0x11e')]===_0x252c('0x11f')?_0x2c80b5+_0x27ae0c[_0x252c('0x120')](_0x1f4eba):_0x27ae0c[_0x252c('0x120')](0x0,_0x44bd40-_0x1f4eba)+_0x2c80b5);}else{this['createSquareDetailsReport'][_0x252c('0x73')](this,_0x2dc278,rs[_0x252c('0x11d')]({'charset':'*','length':_0x44bd40}));}}else{this[_0x252c('0x39')][_0x252c('0x73')](this,_0x2dc278,'');}}else{this[_0x252c('0x39')][_0x252c('0x73')](this,_0x2dc278,_0x27ae0c);}return _0x1f4835;};AGIVertices[_0x252c('0xe')][_0x252c('0xb')]=function(_0x31b548){logger[_0x252c('0x30')](util[_0x252c('0x2b')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x31b548['label']));return this[_0x252c('0x113')](_0x31b548);};AGIVertices[_0x252c('0xe')][_0x252c('0x121')]=function(_0xee8369){logger[_0x252c('0x30')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0xee8369[_0x252c('0x3b')]));this[_0x252c('0x39')][_0x252c('0x73')](this,_0xee8369,_0xee8369['goalname']);return this[_0x252c('0xc')][_0x252c('0xad')](util['format'](_0x252c('0x122'),_0xee8369[_0x252c('0x123')]));};AGIVertices['prototype'][_0x252c('0x124')]=function(_0x307582){logger[_0x252c('0x30')](util[_0x252c('0x2b')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x307582['label']));if(!this[_0x252c('0x88')](_0x307582[_0x252c('0x8b')])||!this[_0x252c('0x88')](_0x307582['aws_secret_access_key'])){return this[_0x252c('0xc')][_0x252c('0xad')](_0x252c('0x125'));}if(!this[_0x252c('0x88')](_0x307582[_0x252c('0x62')])){return this[_0x252c('0xc')][_0x252c('0xad')](_0x252c('0xae'));}this['channel'][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0x126'),_0x307582[_0x252c('0x62')]));var _0xb44392=this[_0x252c('0x8a')][_0x252c('0x73')](this,_0x307582);if(_0xb44392){this[_0x252c('0xc')][_0x252c('0xad')](util['format'](_0x252c('0x127'),_0xb44392));var _0x3bb844=this[_0x252c('0xc')][_0x252c('0x128')](_0xb44392);try{fs['unlink'](_0xb44392+'.wav');}catch(_0x23fb7d){logger[_0x252c('0x2e')](_0x23fb7d);}return _0x3bb844;}return this[_0x252c('0xc')][_0x252c('0x2e')](_0x307582,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x252c('0xe')][_0x252c('0x129')]=function(_0x1ea9c0){logger['info'](util[_0x252c('0x2b')](_0x252c('0x12a'),_0x1ea9c0[_0x252c('0x3b')]));if(!this['isConfigured'](_0x1ea9c0[_0x252c('0x8b')])||!this[_0x252c('0x88')](_0x1ea9c0[_0x252c('0x8c')])){return this[_0x252c('0xc')]['noop'](_0x252c('0x125'));}if(!this['isConfigured'](_0x1ea9c0[_0x252c('0x12b')])){return this[_0x252c('0xc')]['noop'](_0x252c('0x12c'));}if(!this['isConfigured'](_0x1ea9c0['text'])){return this[_0x252c('0xc')][_0x252c('0xad')]('no\x20text\x20configured');}this[_0x252c('0xc')]['bot']=!![];this[_0x252c('0x39')](_0x1ea9c0);this[_0x252c('0x46')](_0x1ea9c0[_0x252c('0x62')],'in','','');this['channel'][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0x12d'),_0x1ea9c0['text']));var _0x495b7f=this['awsLex'][_0x252c('0x73')](this,_0x1ea9c0);if(_0x495b7f){for(var _0xe4847d in _0x495b7f){if(_0x495b7f[_0x252c('0x98')](_0xe4847d)&&_[_0x252c('0x99')](_0x495b7f[_0xe4847d])){this[_0x252c('0xc')]['setVariable'](util['format'](_0x252c('0x12e'),_0xe4847d[_0x252c('0x6d')]()),_0x495b7f[_0xe4847d]);}}if(_['isNil'](_0x495b7f[_0x252c('0x7b')])){return this[_0x252c('0xc')][_0x252c('0xad')](_0x252c('0x12f'));}else{this[_0x252c('0x46')](_0x495b7f[_0x252c('0x7b')],_0x252c('0xee'),_0x252c('0x130'),'');return this[_0x252c('0xc')][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0x131'),_0x495b7f[_0x252c('0x7b')]));}}return this[_0x252c('0xc')][_0x252c('0x2e')](_0x1ea9c0,_0x252c('0x132'));};AGIVertices[_0x252c('0xe')]['googleasr']=function(_0x5485df){logger['info'](util[_0x252c('0x2b')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x5485df[_0x252c('0x3b')],_0x5485df['timeout']));if(!this['isConfigured'](_0x5485df[_0x252c('0x7e')])){return this[_0x252c('0xc')][_0x252c('0xad')]('no\x20key\x20configured');}var _0x3a1cbb='wav';var _0x2dcee5=util[_0x252c('0x2b')]('%s/recordings/%s',FILES_PATH,rs[_0x252c('0x11d')](0x4));var _0x147940=util[_0x252c('0x2b')](_0x252c('0xa0'),_0x2dcee5,_0x3a1cbb);var _0x4abdeb=!![];if(_0x5485df[_0x252c('0x133')]===_0x252c('0x134')){_0x4abdeb=![];}var _0x1fd44b=this['channel'][_0x252c('0x135')](_0x2dcee5,_0x3a1cbb,_0x5485df['intKey'],_0x5485df[_0x252c('0x6a')],undefined,_0x4abdeb);if(_0x1fd44b[_0x252c('0xa8')]!==-0x1){this['channel'][_0x252c('0xad')](util['format'](_0x252c('0x136'),_0x147940));var _0x50e06e=this['googleASR']['sync'](this,_0x5485df,_0x147940);if(_0x50e06e){for(var _0x226653 in _0x50e06e){if(_0x50e06e[_0x252c('0x98')](_0x226653)){this[_0x252c('0xc')]['setVariable'](util[_0x252c('0x2b')](_0x252c('0x137'),_0x226653[_0x252c('0x6d')]()),_0x50e06e[_0x226653]);}}return this[_0x252c('0xc')][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0x138'),JSON[_0x252c('0x76')](_0x50e06e)));}}return _0x1fd44b;};AGIVertices[_0x252c('0xe')][_0x252c('0x139')]=function(_0x1a1cd1){logger[_0x252c('0x30')](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x1a1cd1[_0x252c('0x3b')]));if(!this['isConfigured'](_0x1a1cd1['appid'])){return this[_0x252c('0xc')][_0x252c('0xad')](_0x252c('0x13a'));}if(!this[_0x252c('0x88')](_0x1a1cd1[_0x252c('0x95')])){return this[_0x252c('0xc')][_0x252c('0xad')]('no\x20appsecret\x20configured');}var _0x330392=_0x252c('0x13b');var _0x5af416=util[_0x252c('0x2b')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x3ce48e=util[_0x252c('0x2b')]('%s.%s',_0x5af416,_0x330392);var _0x1ead7e=!![];if(_0x1a1cd1[_0x252c('0x133')]===_0x252c('0x134')){_0x1ead7e=![];}var _0x50bcc4=this[_0x252c('0xc')][_0x252c('0x135')](_0x5af416,_0x330392,_0x1a1cd1[_0x252c('0x13c')],_0x1a1cd1[_0x252c('0x6a')],undefined,_0x1ead7e);if(_0x50bcc4[_0x252c('0xa8')]!==-0x1){this[_0x252c('0xc')]['noop'](util[_0x252c('0x2b')]('tilde\x20%s\x20file\x20created',_0x3ce48e));var _0x3eecb8=this[_0x252c('0x93')]['sync'](this,_0x1a1cd1,_0x3ce48e);if(_0x3eecb8){for(var _0x582aa1 in _0x3eecb8){if(_0x3eecb8[_0x252c('0x98')](_0x582aa1)){this['channel'][_0x252c('0xa1')](util['format']('TILDE_ASR_%s',_0x582aa1['toUpperCase']()),_0x3eecb8[_0x582aa1]);}}return this['channel'][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0x13d'),JSON[_0x252c('0x76')](_0x3eecb8)));}}return _0x50bcc4;};AGIVertices[_0x252c('0xe')][_0x252c('0x13e')]=function(_0x453863){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x13f'),_0x453863['label']));return this[_0x252c('0xc')][_0x252c('0x140')](_0x453863['context'],_0x453863[_0x252c('0x41')],_0x453863[_0x252c('0x42')]);};AGIVertices[_0x252c('0xe')]['gotoif']=function(_0x22ccbf){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x141'),_0x22ccbf[_0x252c('0x3b')]));if(!this['isConfigured'](_0x22ccbf['condition'])){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x22ccbf,_0x252c('0x142'));}try{var _0x4bb235=eval(_0x22ccbf[_0x252c('0x143')])?'true':_0x252c('0x144');this[_0x252c('0xc')][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0x145'),_0x22ccbf[_0x252c('0x143')],_0x4bb235));return{'code':0xc8,'result':_0x4bb235};}catch(_0x35554b){return{'code':0xc8,'result':_0x252c('0x144')};}};AGIVertices[_0x252c('0xe')][_0x252c('0x146')]=function(_0x2c9fff){logger[_0x252c('0x30')](util['format'](_0x252c('0x147'),_0x2c9fff[_0x252c('0x3b')]));if(!this[_0x252c('0x88')](_0x2c9fff[_0x252c('0x148')])){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x2c9fff,'no\x20interval\x20configured');}var _0x492319=this[_0x252c('0x25')][_0x252c('0x73')](this,_0x2c9fff[_0x252c('0x148')]);if(!_0x492319){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x2c9fff,'no\x20intervals\x20found');}for(var _0x173381=0x0;_0x173381<_0x492319['length'];_0x173381+=0x1){var _0x50e711=this['channel'][_0x252c('0xf')](util['format']('IFTIME(%s?true:false)',_0x492319[_0x173381]));if(_0x50e711['result']===-0x1){return _0x50e711;}logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x149'),_0x492319[_0x173381],_0x50e711[_0x252c('0xa5')]));if(_0x50e711[_0x252c('0xa5')]===_0x252c('0x14a')){logger[_0x252c('0x30')](util['format'](_0x252c('0x149'),_0x492319[_0x173381],_0x252c('0x14a')));this[_0x252c('0xc')][_0x252c('0xad')](util[_0x252c('0x2b')]('IFTIME\x20%s\x20%s',_0x492319[_0x173381],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x149'),_0x492319[_0x173381],_0x252c('0x144')));this[_0x252c('0xc')][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0x149'),_0x492319[_0x173381],_0x252c('0x144')));}}return{'code':0xc8,'result':_0x252c('0x144')};};AGIVertices['prototype'][_0x252c('0x14b')]=function(_0x44670e){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x14c'),_0x44670e[_0x252c('0x3b')]));return this[_0x252c('0xc')]['hangup']();};AGIVertices[_0x252c('0xe')][_0x252c('0x14d')]=function(_0x247638){logger['info'](util[_0x252c('0x2b')](_0x252c('0x14e'),_0x247638[_0x252c('0x3b')]));if(!this[_0x252c('0x88')](_0x247638[_0x252c('0x7e')])){return this[_0x252c('0xc')][_0x252c('0xad')](_0x252c('0xeb'));}var _0xe84bde='wav';var _0x3a66a2=util[_0x252c('0x2b')](_0x252c('0x14f'),FILES_PATH,rs[_0x252c('0x11d')](0x4));var _0x43b8f7=util[_0x252c('0x2b')]('%s.%s',_0x3a66a2,_0xe84bde);var _0x53ae8b=!![];if(_0x247638['beep']===_0x252c('0x134')){_0x53ae8b=![];}var _0x1596b2=this['channel']['recordFile'](_0x3a66a2,_0xe84bde,_0x247638[_0x252c('0x13c')],_0x247638['timeout'],undefined,_0x53ae8b);if(_0x1596b2[_0x252c('0xa8')]!==-0x1){this[_0x252c('0xc')]['noop'](util[_0x252c('0x2b')](_0x252c('0x150'),_0x43b8f7));var _0x4cc75a=this[_0x252c('0x151')]['sync'](this,_0x247638,_0x43b8f7);if(_0x4cc75a){for(var _0x54a75b in _0x4cc75a){if(_0x4cc75a[_0x252c('0x98')](_0x54a75b)){this['channel'][_0x252c('0xa1')](util[_0x252c('0x2b')](_0x252c('0x152'),_0x54a75b[_0x252c('0x6d')]()),_0x4cc75a[_0x54a75b]);}}return this[_0x252c('0xc')][_0x252c('0xad')](util['format'](_0x252c('0x153'),JSON['stringify'](_0x4cc75a)));}}return _0x1596b2;};AGIVertices['prototype'][_0x252c('0x154')]=function(_0x422b84){logger[_0x252c('0x30')](util['format'](_0x252c('0x155'),_0x422b84[_0x252c('0x3b')]));if(!this[_0x252c('0x88')](_0x422b84['key'])){return this[_0x252c('0xc')][_0x252c('0xad')](_0x252c('0xeb'));}if(!this['isConfigured'](_0x422b84[_0x252c('0x62')])){return this[_0x252c('0xc')]['noop'](_0x252c('0xae'));}this[_0x252c('0xc')]['noop'](util[_0x252c('0x2b')](_0x252c('0x156'),_0x422b84['text']));var _0x4269dc=this['ispeechTTS'][_0x252c('0x73')](this,_0x422b84);if(_0x4269dc){this[_0x252c('0xc')][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0x150'),_0x4269dc));var _0x529e91=this[_0x252c('0xc')][_0x252c('0x128')](_0x4269dc,_0x422b84[_0x252c('0x13c')]);try{fs[_0x252c('0x104')](_0x4269dc+'.wav');}catch(_0x167184){logger['error'](_0x167184);}return _0x529e91;}return this[_0x252c('0xc')][_0x252c('0x2e')](_0x422b84,_0x252c('0x157'));};AGIVertices[_0x252c('0xe')]['login']=function(_0x2d36c5){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x158'),_0x2d36c5[_0x252c('0x3b')]));if(!this['isConfigured'](_0x2d36c5[_0x252c('0x159')])){return this[_0x252c('0xc')]['error'](_0x2d36c5,_0x252c('0x15a'));}logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x15b'),this[_0x252c('0xc')][_0x252c('0x3e')],_0x2d36c5[_0x252c('0x159')]));var _0x247241=this['agentLogin'][_0x252c('0x73')](this,_0x2d36c5[_0x252c('0x159')]);if(_0x247241){logger['info'](util[_0x252c('0x2b')](_0x252c('0x15c'),this[_0x252c('0xc')][_0x252c('0x3e')],_0x2d36c5[_0x252c('0x159')]));this[_0x252c('0xc')][_0x252c('0xad')](util['format'](_0x252c('0x15c'),this[_0x252c('0xc')]['callerid'],_0x2d36c5[_0x252c('0x159')]));return{'code':0xc8,'result':'success'};}else{logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x15d'),this[_0x252c('0xc')][_0x252c('0x3e')],_0x2d36c5['findBy']));this['channel'][_0x252c('0xad')](util[_0x252c('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x252c('0x3e')],_0x2d36c5[_0x252c('0x159')]));return{'code':0xc8,'result':_0x252c('0x15e')};}};AGIVertices[_0x252c('0xe')]['logout']=function(_0x2c3fc2){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x15f'),_0x2c3fc2['label']));if(!this['isConfigured'](_0x2c3fc2[_0x252c('0x159')])){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x2c3fc2,'no\x20find\x20by\x20configured');}logger['info'](util['format'](_0x252c('0x15b'),this[_0x252c('0xc')][_0x252c('0x3e')],_0x2c3fc2['findBy']));var _0x310369=this[_0x252c('0x57')][_0x252c('0x73')](this,_0x2c3fc2[_0x252c('0x159')]);if(_0x310369){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x15c'),this[_0x252c('0xc')]['callerid'],_0x2c3fc2[_0x252c('0x159')]));this[_0x252c('0xc')][_0x252c('0xad')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x252c('0xc')][_0x252c('0x3e')],_0x2c3fc2[_0x252c('0x159')]));return{'code':0xc8,'result':_0x252c('0x160')};}else{logger['info'](util[_0x252c('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x252c('0xc')]['callerid'],_0x2c3fc2[_0x252c('0x159')]));this[_0x252c('0xc')][_0x252c('0xad')](util[_0x252c('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x252c('0x3e')],_0x2c3fc2[_0x252c('0x159')]));return{'code':0xc8,'result':_0x252c('0x15e')};}};AGIVertices[_0x252c('0xe')][_0x252c('0x161')]=function(_0x5a39ac){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x162'),_0x5a39ac[_0x252c('0x3b')]));if(!this[_0x252c('0x88')](_0x5a39ac[_0x252c('0x163')])){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x5a39ac,_0x252c('0x164'));}this[_0x252c('0xc')]['noop'](util[_0x252c('0x2b')](_0x252c('0x165'),_0x5a39ac['operation']));var _0x5d2898=eval(_0x5a39ac[_0x252c('0x163')]);if(!this[_0x252c('0x88')](_0x5a39ac[_0x252c('0xdb')])){return this['channel'][_0x252c('0xad')](_0x252c('0xdc'));}var _0x4592bb=this[_0x252c('0xf')][_0x252c('0x73')](this,_0x5a39ac['variable_id']);if(!_0x4592bb){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x5a39ac,_0x252c('0x11b'));}if(_['isArray'](_0x5d2898)){var _0x2fd410=this;_0x5d2898[_0x252c('0xdd')](function(_0xb12a9f,_0xb5d13a){_0x2fd410[_0x252c('0xc')][_0x252c('0xa1')](util[_0x252c('0x2b')](_0x252c('0x166'),_0x4592bb,_0xb5d13a),_0xb12a9f);});return this[_0x252c('0xc')][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0x167'),_0x4592bb));}else{return this[_0x252c('0xc')][_0x252c('0xa1')](_0x4592bb,_0x5d2898);}};AGIVertices[_0x252c('0xe')][_0x252c('0xa')]=function(_0x152e7b){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x168'),_0x152e7b['label']));if(_0x152e7b[_0x252c('0xab')]===0x0){return this[_0x252c('0xaa')](_0x152e7b);}_0x152e7b['retry']-=0x1;if(!this[_0x252c('0x88')](_0x152e7b['file_id'])){return this[_0x252c('0xc')]['error'](_0x152e7b,'no\x20file\x20audio\x20selected');}var _0x3bf8e2=this[_0x252c('0x1f')][_0x252c('0x73')](this,_0x152e7b[_0x252c('0x115')]);if(!_0x3bf8e2){return this['channel']['error'](_0x152e7b,_0x252c('0x169'));}var _0x2c3c5=this[_0x252c('0xc')]['getData'](_0x3bf8e2,_0x152e7b['response'],_0x152e7b[_0x252c('0x16a')]);var _0x5a623f=_0x2c3c5[_0x252c('0xa8')];if(_0x2c3c5[_0x252c('0xa8')]===-0x1){this['createSquareDetailsReport'][_0x252c('0x73')](this,_0x152e7b,'-1');return _0x2c3c5;}else if(_0x2c3c5[_0x252c('0xa5')]===_0x252c('0x6a')){_0x2c3c5['result']=_0x2c3c5[_0x252c('0xa8')][_0x252c('0x9e')]>0x0?_0x2c3c5[_0x252c('0xa8')]:'t';}else if(_['isEmpty'](_0x2c3c5['result'])){_0x2c3c5['result']='#';_0x5a623f='#';}if(!this[_0x252c('0x88')](_0x152e7b[_0x252c('0xdb')])){this[_0x252c('0xc')][_0x252c('0xad')](_0x252c('0xdc'));}else{var _0x357550=this['getVariable']['sync'](this,_0x152e7b[_0x252c('0xdb')]);if(!_0x357550){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x152e7b,_0x252c('0x11b'));}this[_0x252c('0xc')][_0x252c('0xa1')](_0x357550,_0x5a623f);}this['createSquareDetailsReport'][_0x252c('0x73')](this,_0x152e7b,_0x5a623f);return _0x2c3c5;};AGIVertices[_0x252c('0xe')][_0x252c('0xad')]=function(_0x351513){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x16b'),_0x351513[_0x252c('0x3b')]));return this[_0x252c('0xc')][_0x252c('0xad')](_0x351513['output']||_0x351513[_0x252c('0x3b')]);};AGIVertices[_0x252c('0xe')][_0x252c('0x16c')]=function(_0x480688){logger['info'](util[_0x252c('0x2b')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x480688[_0x252c('0x3b')]));if(!this[_0x252c('0x88')](_0x480688['findBy'])){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x480688,_0x252c('0x15a'));}logger['info'](util[_0x252c('0x2b')](_0x252c('0x15b'),this[_0x252c('0xc')]['callerid'],_0x480688[_0x252c('0x159')]));var _0x18e6be=this['getPause'][_0x252c('0x73')](this,_0x480688['pause_id']);var _0x5da7c1=this[_0x252c('0x54')][_0x252c('0x73')](this,_0x480688[_0x252c('0x159')],_0x18e6be);if(_0x5da7c1){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x15c'),this[_0x252c('0xc')][_0x252c('0x3e')],_0x480688[_0x252c('0x159')]));this[_0x252c('0xc')]['noop'](util[_0x252c('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x252c('0xc')]['callerid'],_0x480688[_0x252c('0x159')]));return{'code':0xc8,'result':_0x252c('0x160')};}else{logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x15d'),this[_0x252c('0xc')][_0x252c('0x3e')],_0x480688['findBy']));this[_0x252c('0xc')][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0x15c'),this[_0x252c('0xc')][_0x252c('0x3e')],_0x480688[_0x252c('0x159')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x252c('0xe')]['playback']=function(_0x4109be){logger['info'](util[_0x252c('0x2b')](_0x252c('0x16d'),_0x4109be[_0x252c('0x3b')]));if(!this['isConfigured'](_0x4109be['file_id'])){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x4109be,'no\x20file\x20audio\x20selected');}var _0x221e41=this[_0x252c('0x1f')][_0x252c('0x73')](this,_0x4109be['file_id']);if(!_0x221e41){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x4109be,_0x252c('0x169'));}var _0xf8298f=this[_0x252c('0xc')][_0x252c('0x5c')]('PLAYBACK',[_0x221e41,_0x4109be[_0x252c('0xe8')]]);if(_0xf8298f[_0x252c('0xa8')]===-0x1){return _0xf8298f;}return this[_0x252c('0xc')][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0xc5'),_0x252c('0x16e'),_0x221e41));};AGIVertices[_0x252c('0xe')][_0x252c('0x16f')]=function(_0x13c5bf){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x170'),_0x13c5bf[_0x252c('0x3b')]));if(!this[_0x252c('0x88')](_0x13c5bf[_0x252c('0x171')])){return this['channel'][_0x252c('0x2e')](_0x13c5bf,_0x252c('0x172'));}var _0x22b89b='';var _0x5efa0e=parseInt(_0x13c5bf[_0x252c('0x171')],0xa);if(isNaN(_0x5efa0e)){_0x22b89b=_0x13c5bf['queue_id'];}else{_0x22b89b=this[_0x252c('0x13')][_0x252c('0x73')](this,_0x13c5bf[_0x252c('0x171')]);if(!_0x22b89b){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x13c5bf,_0x252c('0x173'));}}var _0x5620e5='';if(this[_0x252c('0x88')](_0x13c5bf[_0x252c('0x115')])){var _0x2922de=this[_0x252c('0x1f')][_0x252c('0x73')](this,_0x13c5bf[_0x252c('0x115')]);if(_0x2922de){_0x5620e5=_0x2922de;}}this[_0x252c('0x39')][_0x252c('0x73')](this,_0x13c5bf,_0x22b89b);if(_0x13c5bf[_0x252c('0xe8')][_0x252c('0x174')]('x')<0x0){_0x13c5bf[_0x252c('0xe8')]+='x';}if(_0x13c5bf[_0x252c('0xe8')]['indexOf']('X')<0x0){_0x13c5bf['opts']+='X';}this[_0x252c('0xc')][_0x252c('0xa1')]('XMCS-QUEUE',_0x22b89b?_0x22b89b[_0x252c('0x175')]():'');var _0x176040=this['channel'][_0x252c('0x5c')]('QUEUE',[_0x22b89b,_0x13c5bf[_0x252c('0xe8')],_0x13c5bf[_0x252c('0x75')],_0x5620e5,_0x13c5bf['timeout'],_0x13c5bf[_0x252c('0x6')],_0x13c5bf[_0x252c('0x176')],_0x13c5bf[_0x252c('0x177')],'',_0x13c5bf[_0x252c('0x178')]]);if(_0x176040['result']===-0x1){return _0x176040;}return this[_0x252c('0xc')][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0xc5'),_0x252c('0x179'),_0x22b89b));};AGIVertices[_0x252c('0xe')][_0x252c('0x17a')]=function(_0x17a4d8){logger['info'](util[_0x252c('0x2b')](_0x252c('0x17b'),_0x17a4d8[_0x252c('0x3b')]));var _0x173c2f=_0x17a4d8['recordingFormat']||_0x252c('0x13b');var _0x3843ee=util[_0x252c('0x2b')](_0x252c('0x17c'),this[_0x252c('0xc')]['uniqueid'],rs[_0x252c('0x11d')](0x5));var _0x1ac7df=util[_0x252c('0x2b')]('%s/recordings/%s.%s',FILES_PATH,_0x3843ee,_0x173c2f);var _0xc4f3ea=util['format']('%s/recordings/%s',FILES_PATH,_0x3843ee);this['createSquareRecording'][_0x252c('0x73')](this,_0x17a4d8,_0x3843ee,_0x1ac7df);this[_0x252c('0xc')]['setVariable'](_0x252c('0x17d'),_0x3843ee);logger['info'](_0x252c('0x17e'),_0xc4f3ea,_0x173c2f,_0x17a4d8[_0x252c('0x17f')],_0x17a4d8[_0x252c('0x6a')]);return this[_0x252c('0xc')][_0x252c('0x135')](_0xc4f3ea,_0x173c2f,_0x17a4d8['escape_digits'],_0x17a4d8['timeout'],undefined,!![]);};AGIVertices[_0x252c('0xe')][_0x252c('0x180')]=function(_0x43bac2){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x181'),_0x43bac2[_0x252c('0x3b')]));if(!this['isConfigured'](_0x43bac2[_0x252c('0x75')])){return this[_0x252c('0xc')][_0x252c('0xad')](_0x252c('0x182'));}var _0x35e2c8=this['restAPI'][_0x252c('0x73')](this,_0x43bac2);logger['info'](util['format']('Response:',util[_0x252c('0x183')](_0x35e2c8,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x43bac2[_0x252c('0xdb')])){return this[_0x252c('0xc')][_0x252c('0xad')](_0x252c('0x184'));}var _0x31d053=this[_0x252c('0xf')][_0x252c('0x73')](this,_0x43bac2[_0x252c('0xdb')]);if(!_0x31d053){return this[_0x252c('0xc')]['error'](_0x43bac2,_0x252c('0x11b'));}this[_0x252c('0xc')][_0x252c('0xa1')](util[_0x252c('0x2b')](_0x252c('0x185'),_0x31d053),_0x35e2c8['statusCode']?_0x35e2c8['statusCode']:_0x252c('0x186'));this[_0x252c('0xc')][_0x252c('0xa1')](util[_0x252c('0x2b')]('%s_STATUS_MESSAGE',_0x31d053),_0x35e2c8[_0x252c('0x7a')]?_0x35e2c8['statusMessage']:'OK');if(_0x35e2c8['body']){try{this[_0x252c('0x9f')](_0x35e2c8['body'],_0x31d053);}catch(_0xb9e8bf){logger[_0x252c('0x2e')](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x31d053));}}return this['channel'][_0x252c('0xad')](util[_0x252c('0x2b')]('variable\x20%s\x20set',_0x31d053));};AGIVertices[_0x252c('0xe')][_0x252c('0x187')]=function(_0x21606a){logger[_0x252c('0x30')](util[_0x252c('0x2b')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x21606a[_0x252c('0x3b')]));return this['channel']['sayDigits'](_0x21606a[_0x252c('0x188')][_0x252c('0x5e')](/\s+/g,''),_0x21606a['escape_digits']);};AGIVertices[_0x252c('0xe')][_0x252c('0x189')]=function(_0x179372){logger[_0x252c('0x30')](util['format'](_0x252c('0x18a'),_0x179372[_0x252c('0x3b')]));return this['channel']['sayNumber'](_0x179372['number'][_0x252c('0x5e')](/\s+/g,''),_0x179372['escape_digits']);};AGIVertices['prototype'][_0x252c('0x18b')]=function(_0x153e38){logger[_0x252c('0x30')](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x153e38[_0x252c('0x3b')]));return this[_0x252c('0xc')][_0x252c('0x18c')](_0x153e38[_0x252c('0x62')],_0x153e38['escape_digits']);};AGIVertices[_0x252c('0xe')][_0x252c('0x18d')]=function(_0x3f68e9){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x18e'),_0x3f68e9[_0x252c('0x3b')]));if(!this['isConfigured'](_0x3f68e9[_0x252c('0x18f')])){return this[_0x252c('0xc')]['noop'](_0x252c('0x190'));}var _0x475475=this[_0x252c('0x22')][_0x252c('0x73')](this,_0x3f68e9[_0x252c('0x18f')]);if(!_0x475475||!_0x475475[_0x252c('0x191')]){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x3f68e9,'no\x20mail\x20account\x20found');}var _0x5166a5={'from':util[_0x252c('0x2b')](_0x252c('0x192'),_0x475475['name'],_0x475475['email']||_0x475475[_0x252c('0x191')][_0x252c('0x193')]),'to':_0x3f68e9['to']||'','cc':_0x3f68e9['cc']||'','bcc':_0x3f68e9[_0x252c('0x194')]||'','subject':_0x3f68e9[_0x252c('0x195')],'html':_0x3f68e9[_0x252c('0x62')],'text':_0x3f68e9[_0x252c('0x62')]};var _0x21fb19={'tls':{'rejectUnauthorized':![]}};if(_0x475475[_0x252c('0x191')]['service']){_0x21fb19[_0x252c('0x196')]=_0x475475[_0x252c('0x191')][_0x252c('0x196')];}else{_0x21fb19[_0x252c('0x197')]=_0x475475[_0x252c('0x191')][_0x252c('0x197')];_0x21fb19[_0x252c('0x198')]=_0x475475[_0x252c('0x191')][_0x252c('0x198')];_0x21fb19['secure']=_0x475475[_0x252c('0x191')]['secure'];}if(_0x475475[_0x252c('0x191')][_0x252c('0x199')]){_0x21fb19[_0x252c('0x19a')]={'user':_0x475475[_0x252c('0x191')][_0x252c('0x193')],'pass':_0x475475[_0x252c('0x191')][_0x252c('0x19b')]};}if(this[_0x252c('0x88')](_0x3f68e9[_0x252c('0x19c')])){}logger['debug'](_0x252c('0x19d'),JSON[_0x252c('0x76')](_0x5166a5));this[_0x252c('0x39')][_0x252c('0x73')](this,_0x3f68e9,_0x3f68e9['account_id']);this['channel'][_0x252c('0xad')](util[_0x252c('0x2b')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x475475[_0x252c('0x11')]));this[_0x252c('0x19e')]['sync'](this,_0x21fb19,_0x5166a5);return this[_0x252c('0xc')][_0x252c('0xad')](_0x252c('0x19f'));};AGIVertices['prototype'][_0x252c('0x1a0')]=function(_0x1455f7){logger['info'](util[_0x252c('0x2b')](_0x252c('0x1a1'),_0x1455f7['label']));return this['channel'][_0x252c('0xad')](_0x252c('0x1a2'));};AGIVertices[_0x252c('0xe')][_0x252c('0x1a3')]=function(_0x2a3328){logger[_0x252c('0x30')](util['format'](_0x252c('0x1a4'),_0x2a3328[_0x252c('0x3b')]));if(!this[_0x252c('0x88')](_0x2a3328[_0x252c('0x1a5')])){return this[_0x252c('0xc')][_0x252c('0xad')](_0x252c('0x1a6'));}var _0x3a3aed=this[_0x252c('0x36')][_0x252c('0x73')](this,_0x2a3328['sms_account_id']);if(!_0x3a3aed){return this['channel']['error'](_0x2a3328,_0x252c('0x1a7'));}var _0x1d7a38={'body':_0x2a3328[_0x252c('0x1a8')],'phone':_0x2a3328['to']||'','SmsAccountId':_0x3a3aed['id']};logger[_0x252c('0xe2')](_0x252c('0x1a9'),JSON[_0x252c('0x76')](_0x1d7a38));this[_0x252c('0x39')][_0x252c('0x73')](this,_0x2a3328,_0x2a3328['sms_account_id']);this['channel'][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0x1aa'),_0x3a3aed[_0x252c('0x11')]));this[_0x252c('0x38')]['sync'](this,_0x1d7a38);return this['channel']['noop'](_0x252c('0x1ab'));};AGIVertices[_0x252c('0xe')]['set']=function(_0x575b22){logger[_0x252c('0x30')](util[_0x252c('0x2b')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x575b22[_0x252c('0x3b')]));if(!this[_0x252c('0x88')](_0x575b22[_0x252c('0xdb')])){return this[_0x252c('0xc')]['error'](_0x575b22,_0x252c('0x1ac'));}var _0x421a09=this[_0x252c('0xf')]['sync'](this,_0x575b22['variable_id']);if(!_0x421a09){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x575b22,_0x252c('0x11b'));}return this[_0x252c('0xc')][_0x252c('0xa1')](_0x421a09,_0x575b22[_0x252c('0x1ad')]);};AGIVertices['prototype'][_0x252c('0x1ae')]=function(_0x5cb750){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x1af'),_0x5cb750[_0x252c('0x3b')]));this[_0x252c('0xc')]['noop'](_0x252c('0x1b0'));if(_0x5cb750[_0x252c('0xbc')]===_0x252c('0x1b1')){this[_0x252c('0xc')][_0x252c('0xad')](_0x252c('0x1b2'));return this['channel'][_0x252c('0xbc')]();}return this['channel'][_0x252c('0xad')](_0x252c('0x1b3'));};AGIVertices[_0x252c('0xe')][_0x252c('0x1b4')]=function(_0x729278){logger[_0x252c('0x30')](util[_0x252c('0x2b')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x729278[_0x252c('0x3b')]));if(!this[_0x252c('0x88')](_0x729278[_0x252c('0x1b5')])){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x729278,_0x252c('0x1b6'));}var _0x2def6c=this[_0x252c('0x15')]['sync'](this,_0x729278[_0x252c('0x1b5')]);if(!this['isConfigured'](_0x2def6c)){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x729278,util[_0x252c('0x2b')](_0x252c('0x1b7'),_0x729278[_0x252c('0x1b5')]));}if(_0x2def6c===this['channel']['arg_1']){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x729278,_0x252c('0x1b8'));}this[_0x252c('0x39')][_0x252c('0x73')](this,_0x729278,_0x2def6c);var _0x30c5ba=this[_0x252c('0xc')][_0x252c('0x5c')](_0x252c('0x1b9'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x252c('0x6')][_0x252c('0x197')]||_0x252c('0x1ba'),_0x2def6c,this[_0x252c('0xc')][_0x252c('0x3d')]));if(_0x30c5ba[_0x252c('0xa8')]===-0x1){return _0x30c5ba;}return this['channel'][_0x252c('0xad')](util['format'](_0x252c('0xc5'),_0x252c('0x1b9'),_0x2def6c));};AGIVertices['prototype']['system']=function(_0x4f98d3){logger['info'](util[_0x252c('0x2b')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x4f98d3[_0x252c('0x3b')]));var _0x293d04=this['shellCommand'][_0x252c('0x73')](this,_0x4f98d3['command']);this[_0x252c('0x39')]['sync'](this,_0x4f98d3,_0x4f98d3['command']);if(this[_0x252c('0x88')](_0x4f98d3[_0x252c('0xdb')])){var _0x1a184c=this[_0x252c('0xf')][_0x252c('0x73')](this,_0x4f98d3[_0x252c('0xdb')]);if(_0x1a184c){this['channel'][_0x252c('0xa1')](_0x1a184c,_0x293d04);return this[_0x252c('0xc')][_0x252c('0xad')](util['format'](_0x252c('0x1bb'),_0x4f98d3[_0x252c('0xbb')],_0x1a184c));}}return this[_0x252c('0xc')]['noop'](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x4f98d3[_0x252c('0xbb')]));};AGIVertices[_0x252c('0xe')][_0x252c('0x1bc')]=function(_0x3adb34){logger[_0x252c('0x30')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x3adb34[_0x252c('0x3b')]));_0x3adb34[_0x252c('0x62')]=_0x3adb34[_0x252c('0x62')][_0x252c('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x252c('0x88')](_0x3adb34['apiKey'])){return this['channel'][_0x252c('0xad')](_0x252c('0x1bd'));}if(!this[_0x252c('0x88')](_0x3adb34[_0x252c('0x62')])){return this[_0x252c('0xc')][_0x252c('0xad')](_0x252c('0xae'));}this[_0x252c('0xc')][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0x1be'),_0x3adb34[_0x252c('0x62')]));var _0x839bdd=this[_0x252c('0x5f')]['sync'](this,_0x3adb34);if(_0x839bdd){this[_0x252c('0xc')][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0x1bf'),_0x839bdd));var _0xc1cea1=this[_0x252c('0xc')]['streamFile'](_0x839bdd);try{fs[_0x252c('0x104')](_0x839bdd+_0x252c('0x105'));}catch(_0x457a05){logger[_0x252c('0x2e')](_0x457a05);}return _0xc1cea1;}return this['channel']['error'](_0x3adb34,_0x252c('0x1c0'));};AGIVertices[_0x252c('0xe')][_0x252c('0x1c1')]=function(_0x18fe4c){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x1c2'),_0x18fe4c[_0x252c('0x3b')]));_0x18fe4c['text']=_0x18fe4c['text'][_0x252c('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x252c('0x88')](_0x18fe4c['text'])){return this[_0x252c('0xc')][_0x252c('0xad')](_0x252c('0xae'));}this[_0x252c('0xc')][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0x1c3'),_0x18fe4c[_0x252c('0x62')]));var _0x3ee1ce=this[_0x252c('0x67')][_0x252c('0x73')](this,_0x18fe4c);if(_0x3ee1ce){this[_0x252c('0xc')][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0x1c4'),_0x3ee1ce));var _0x4b1e61=this[_0x252c('0xc')][_0x252c('0x128')](_0x3ee1ce);try{fs[_0x252c('0x104')](_0x3ee1ce+_0x252c('0x105'));}catch(_0x30beff){logger['error'](_0x30beff);}return _0x4b1e61;}return this[_0x252c('0xc')][_0x252c('0x2e')](_0x18fe4c,_0x252c('0x1c5'));};AGIVertices[_0x252c('0xe')][_0x252c('0x1c6')]=function(_0x1e9f1b){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x1c7'),_0x1e9f1b[_0x252c('0x3b')]));if(!this['isConfigured'](_0x1e9f1b['findBy'])){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x1e9f1b,_0x252c('0x15a'));}logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x15b'),this['channel'][_0x252c('0x3e')],_0x1e9f1b[_0x252c('0x159')]));var _0x43d498=this[_0x252c('0x55')][_0x252c('0x73')](this,_0x1e9f1b['findBy']);if(_0x43d498){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x15c'),this[_0x252c('0xc')][_0x252c('0x3e')],_0x1e9f1b[_0x252c('0x159')]));this[_0x252c('0xc')][_0x252c('0xad')](util['format'](_0x252c('0x15c'),this['channel'][_0x252c('0x3e')],_0x1e9f1b[_0x252c('0x159')]));return{'code':0xc8,'result':_0x252c('0x160')};}else{logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x15d'),this['channel'][_0x252c('0x3e')],_0x1e9f1b['findBy']));this[_0x252c('0xc')][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0x15d'),this[_0x252c('0xc')][_0x252c('0x3e')],_0x1e9f1b[_0x252c('0x159')]));return{'code':0xc8,'result':_0x252c('0x15e')};}};AGIVertices['prototype']['voicemail']=function(_0x1b8ebb){logger[_0x252c('0x30')](util[_0x252c('0x2b')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x1b8ebb[_0x252c('0x3b')]));var _0x38c926=this[_0x252c('0xc')][_0x252c('0x5c')]('VOICEMAIL',[_0x1b8ebb['mailbox'],_0x1b8ebb[_0x252c('0x7c')]]);if(_0x38c926['result']===-0x1){return _0x38c926;}return this['channel'][_0x252c('0xad')](util[_0x252c('0x2b')](_0x252c('0xc5'),_0x252c('0x1c8'),_0x1b8ebb[_0x252c('0x1c9')]));};AGIVertices['prototype'][_0x252c('0x1ca')]=function(_0x21ca2b){logger[_0x252c('0x30')](util[_0x252c('0x2b')](_0x252c('0x1cb'),_0x21ca2b[_0x252c('0x3b')]));if(!this['isConfigured'](_0x21ca2b['variable_id'])){return this[_0x252c('0xc')]['error'](_0x21ca2b,_0x252c('0x1ac'));}var _0x434c4b=this[_0x252c('0xf')][_0x252c('0x73')](this,_0x21ca2b[_0x252c('0xdb')]);if(!_0x434c4b){return this[_0x252c('0xc')][_0x252c('0x2e')](_0x21ca2b,'no\x20variable\x20found');}var _0x3cdcff=this[_0x252c('0xc')][_0x252c('0xf')](_0x434c4b);return{'code':0xc8,'result':_0x3cdcff[_0x252c('0xa5')]?_0x3cdcff[_0x252c('0xa5')]:'-'};};String[_0x252c('0xe')]['replaceAll']=function(_0x2e9669,_0x160e1d){return this[_0x252c('0xa3')](_0x2e9669)[_0x252c('0x1cc')](_0x160e1d);};module[_0x252c('0x1cd')]=AGIVertices; \ No newline at end of file +var _0x06bc=['trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','toString','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws_bot_name','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','%s/recordings/%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME\x20%s\x20%s','true','hangup','ispeechasr','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','AGENT\x20%s\x20FOUND\x20BY','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','digit','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','getMailAccount','\x22%s\x22\x20<%s>','email','Smtp','user','service','host','port','secure','authentication','Trying\x20SendMail\x20with\x20account\x20%s','sendMailMessage','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','no\x20subproject\x20selected','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','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','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','join','exports','path','util','odbc','randomstring','mustache','request-promise','../../config/environment','./scripts','rawHeaders','rawBody','menu','getsecretdigits','prototype','rpc','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundById','save_name','getMailAccountById','getIntervalById','IntervalId','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','includes','POST','PUT','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_lex_region','googleASR','tildeASR','appid','uri','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getVariable','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','sync','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','options','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','agi','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','scheduledAt','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','list_id','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','SESTEK_ASR_INSTANCE','database','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','Executed\x20command\x20%s','no\x20key\x20configured','bot','DIALOGFLOW_%s','toUpperCase','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','dialogflowV2_language','providerResponse','DialogflowV2\x20Result\x20%s','speech','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x06bc,0xc6));var _0xc06b=function(_0x3f4363,_0xc679a6){_0x3f4363=_0x3f4363-0x0;var _0x180df3=_0x06bc[_0x3f4363];return _0x180df3;};'use strict';var fs=require('fs');var path=require(_0xc06b('0x0'));var util=require(_0xc06b('0x1'));var _=require('lodash');var sh=require('shelljs');var odbc=require(_0xc06b('0x2'))();var rs=require(_0xc06b('0x3'));var moment=require('moment');var Mustache=require(_0xc06b('0x4'));var rp=require(_0xc06b('0x5'));var logger=require('../../config/logger')('agi');var config=require(_0xc06b('0x6'));var scripts=require(_0xc06b('0x7'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xc06b('0x8'),_0xc06b('0x9')];var verticesWithRetry=[_0xc06b('0xa'),'getdigits',_0xc06b('0xb')];var AGIVertices=function(_0xcba09e,_0xcb9586,_0x43d93d){this['channel']=_0xcba09e;this['rpc']=_0xcb9586;this['mailRpc']=_0x43d93d;};AGIVertices[_0xc06b('0xc')]['getVariable']=function(_0x3ebede,_0x219ac2){this[_0xc06b('0xd')][_0xc06b('0xe')](_0x3ebede)[_0xc06b('0xf')](function(_0x25acb9){_0x219ac2(null,_0x25acb9?_0x25acb9[_0xc06b('0x10')]:![]);})[_0xc06b('0x11')](function(_0x10cb22){_0x219ac2(_0x10cb22);});};AGIVertices[_0xc06b('0xc')][_0xc06b('0x12')]=function(_0x3f72ef,_0x42fceb){this[_0xc06b('0xd')][_0xc06b('0x13')](_0x3f72ef)[_0xc06b('0xf')](function(_0x50c31e){_0x42fceb(null,_0x50c31e?_0x50c31e[_0xc06b('0x10')]:![]);})['catch'](function(_0x15d580){_0x42fceb(_0x15d580);});};AGIVertices[_0xc06b('0xc')][_0xc06b('0x14')]=function(_0x203bac,_0x34b180){this['rpc'][_0xc06b('0x15')](_0x203bac)[_0xc06b('0xf')](function(_0x1839ba){_0x34b180(null,_0x1839ba?_0x1839ba[_0xc06b('0x10')]:![]);})['catch'](function(_0x61ea72){_0x34b180(_0x61ea72);});};AGIVertices[_0xc06b('0xc')][_0xc06b('0x16')]=function(_0x9fc620,_0x225921){this[_0xc06b('0xd')][_0xc06b('0x17')](_0x9fc620)[_0xc06b('0xf')](function(_0x85d351){_0x225921(null,_0x85d351?_0x85d351[_0xc06b('0x18')]:![]);})['catch'](function(_0x2c46f4){_0x225921(_0x2c46f4);});};AGIVertices[_0xc06b('0xc')][_0xc06b('0x19')]=function(_0x33c3ce,_0xde8396){this['rpc'][_0xc06b('0x1a')](_0x33c3ce)[_0xc06b('0xf')](function(_0x2fcd98){_0xde8396(null,_0x2fcd98?_0x2fcd98[_0xc06b('0x10')]:![]);})[_0xc06b('0x11')](function(_0x3adba8){_0xde8396(_0x3adba8);});};AGIVertices['prototype'][_0xc06b('0x1b')]=function(_0x3904f1,_0x5b1a84){this[_0xc06b('0xd')][_0xc06b('0x1c')](_0x3904f1)[_0xc06b('0xf')](function(_0x5a2280){_0x5b1a84(null,_0x5a2280?_0x5a2280[_0xc06b('0x10')]:![]);})['catch'](function(_0x21f526){_0x5b1a84(_0x21f526);});};AGIVertices[_0xc06b('0xc')]['getSound']=function(_0x4deedb,_0xf38d29){var _0x49246e=this;this[_0xc06b('0xd')][_0xc06b('0x1d')](_0x4deedb)[_0xc06b('0xf')](function(_0x4e2ef2){_0xf38d29(null,_0x4e2ef2?_0x49246e['getSoundPath'](_0x4e2ef2[_0xc06b('0x1e')]):![]);})[_0xc06b('0x11')](function(_0x566c27){_0xf38d29(_0x566c27);});};AGIVertices[_0xc06b('0xc')]['getMailAccount']=function(_0x30f671,_0xda7e9f){this[_0xc06b('0xd')][_0xc06b('0x1f')](_0x30f671)[_0xc06b('0xf')](function(_0x1bf452){_0xda7e9f(null,_0x1bf452?_0x1bf452:![]);})['catch'](function(_0x1594a8){_0xda7e9f(_0x1594a8);});};AGIVertices[_0xc06b('0xc')]['sendMailMessage']=function(_0x1d1b14,_0x1ff541,_0x35eea9){this['mailRpc']['sendMailMessage'](_0x1d1b14,_0x1ff541)['then'](function(){_0x35eea9(null);})[_0xc06b('0x11')](function(_0x253d20){_0x35eea9(_0x253d20);});};AGIVertices['prototype']['getIntervals']=function(_0x2716a2,_0x10a922){this[_0xc06b('0xd')][_0xc06b('0x20')](_0x2716a2)[_0xc06b('0xf')](function(_0x524a10){if(_0x524a10){if(_0x524a10[_0xc06b('0x21')]){_0x10a922(null,[_0x524a10['interval']]);}else{_0x10a922(null,_[_0xc06b('0x22')](_0x524a10[_0xc06b('0x23')],'interval'));}}else{_0x10a922(null,![]);}})[_0xc06b('0x11')](function(_0x5171dc){_0x10a922(_0x5171dc);});};AGIVertices[_0xc06b('0xc')][_0xc06b('0x24')]=function(_0xeda53){return util[_0xc06b('0x25')](_0xc06b('0x26'),FILES_PATH,_0xeda53);};AGIVertices['prototype'][_0xc06b('0x27')]=function(_0x3e140c,_0x3f33fa,_0x5a5ab0){odbc['open'](_0x3e140c,function(_0x42d204){if(_0x42d204){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x42d204);_0x5a5ab0(_0x42d204);}else{logger[_0xc06b('0x28')](_0xc06b('0x29'));odbc[_0xc06b('0x2a')](_0x3f33fa,function(_0x27a638,_0x280a9d){if(_0x27a638){logger[_0xc06b('0x28')]('Error\x20executing\x20query\x20%s',_0x3f33fa);_0x5a5ab0(_0x27a638);}else{logger[_0xc06b('0x28')](_0xc06b('0x2b'),_0x3f33fa);odbc['close'](function(_0x58c16a){if(_0x58c16a){logger[_0xc06b('0x2c')](_0xc06b('0x2d'),_0x58c16a);}_0x5a5ab0(null,_0x280a9d);});}});}});};AGIVertices['prototype'][_0xc06b('0x2e')]=function(_0x5ae4be,_0x41ef6c){this[_0xc06b('0xd')][_0xc06b('0x2f')](_0x5ae4be)['then'](function(_0x434c09){_0x41ef6c(null,_0x434c09?_0x434c09:![]);})['catch'](function(_0x15d29c){_0x41ef6c(_0x15d29c);});};AGIVertices[_0xc06b('0xc')]['createSmsMessage']=function(_0x53d05b,_0x2731ae){this[_0xc06b('0xd')][_0xc06b('0x30')](_0x53d05b)['then'](function(_0x3adac5){_0x2731ae(null,_0x3adac5);})[_0xc06b('0x11')](function(_0x4d4c2b){_0x2731ae(_0x4d4c2b);});};AGIVertices[_0xc06b('0xc')][_0xc06b('0x31')]=function(_0x10c997,_0x31cc25,_0x501844){this[_0xc06b('0xd')][_0xc06b('0x31')]({'uniqueid':this[_0xc06b('0x32')][_0xc06b('0x33')],'node':_0x10c997[_0xc06b('0x34')],'application':_0x10c997[_0xc06b('0x35')],'data':_0x31cc25||null,'project_name':this[_0xc06b('0x32')][_0xc06b('0x36')],'callerid':this[_0xc06b('0x32')][_0xc06b('0x37')]})['then'](function(_0x15e544){if(_0x501844){_0x501844(null,_0x15e544);}})[_0xc06b('0x11')](function(_0xe00e80){if(_0x501844){_0x501844(_0xe00e80);}});};AGIVertices[_0xc06b('0xc')][_0xc06b('0x38')]=function(_0x4976ed,_0x20ad09,_0xd33586,_0x3df70d){this[_0xc06b('0xd')][_0xc06b('0x38')]({'uniqueid':this[_0xc06b('0x32')][_0xc06b('0x33')],'callerid':this[_0xc06b('0x32')][_0xc06b('0x37')],'calleridname':this[_0xc06b('0x32')][_0xc06b('0x39')],'context':this[_0xc06b('0x32')][_0xc06b('0x3a')],'extension':this[_0xc06b('0x32')][_0xc06b('0x3b')],'priority':this[_0xc06b('0x32')][_0xc06b('0x3c')],'accountcode':this['channel']['accountcode'],'dnid':this['channel']['dnid'],'projectName':this[_0xc06b('0x32')]['arg_1'],'saveName':_0x20ad09,'filename':_0x4976ed[_0xc06b('0x3d')]||_0x20ad09,'savePath':_0xd33586})[_0xc06b('0xf')](function(_0x1ffd28){_0x3df70d(null,_0x1ffd28);})['catch'](function(_0x2dd1d0){_0x3df70d(_0x2dd1d0);});};AGIVertices[_0xc06b('0xc')][_0xc06b('0x3e')]=function(_0x430230,_0x141a8e,_0x49eb2d,_0x4ea1d0,_0x671d4b){this[_0xc06b('0xd')][_0xc06b('0x3e')]({'uniqueid':this[_0xc06b('0x32')]['uniqueid'],'body':_0x430230,'direction':_0x141a8e,'providerName':_0x49eb2d,'providerResponse':_0x4ea1d0})[_0xc06b('0xf')](function(_0xe6a989){if(_0x671d4b){_0x671d4b(null,_0xe6a989);}})[_0xc06b('0x11')](function(_0xc2fbce){if(_0x671d4b){_0x671d4b(_0xc2fbce);}});};AGIVertices[_0xc06b('0xc')][_0xc06b('0x3f')]=function(_0x2234e9,_0x307091){this[_0xc06b('0xd')][_0xc06b('0x3f')]({'firstName':_[_0xc06b('0x40')](_0x2234e9[_0xc06b('0x10')])||_[_0xc06b('0x41')](_0x2234e9[_0xc06b('0x10')])?'callback_'+Math[_0xc06b('0x42')]():_0x2234e9[_0xc06b('0x10')],'lastName':_[_0xc06b('0x40')](_0x2234e9[_0xc06b('0x43')])||_[_0xc06b('0x41')](_0x2234e9[_0xc06b('0x43')])?null:_0x2234e9[_0xc06b('0x43')],'phone':_0x2234e9[_0xc06b('0x44')],'ListId':_0x2234e9['list_id'],'scheduledat':_0x2234e9['scheduledAt'],'callbackUniqueid':this[_0xc06b('0x32')][_0xc06b('0x33')],'tags':_0xc06b('0x45'),'description':_0xc06b('0x46')+_0x2234e9['scheduledAt']['toString'](),'priority':_0x2234e9[_0xc06b('0x47')]})[_0xc06b('0xf')](function(_0x48a1cd){_0x307091(null,_0x48a1cd);})['catch'](function(_0x2fa1c1){_0x307091(_0x2fa1c1);});};AGIVertices[_0xc06b('0xc')][_0xc06b('0x48')]=function(_0x3c93dd,_0x1735c1){this['rpc'][_0xc06b('0x49')](_0x3c93dd)[_0xc06b('0xf')](function(_0x4f6282){_0x1735c1(null,_0x4f6282?_0x4f6282[_0xc06b('0x10')]:![]);})[_0xc06b('0x11')](function(_0x2d9fb7){_0x1735c1(_0x2d9fb7);});};AGIVertices[_0xc06b('0xc')][_0xc06b('0x4a')]=function(_0x35bfcd,_0x5c3c7e,_0x1f8a07){var _0x2a15ca={'role':_0xc06b('0x4b')};_0x2a15ca[_0x35bfcd]=this[_0xc06b('0x32')]['callerid'];this[_0xc06b('0xd')]['agentPause'](_0x2a15ca,_0x5c3c7e,this[_0xc06b('0x32')][_0xc06b('0x33')])[_0xc06b('0xf')](function(_0x508a60){_0x1f8a07(null,_[_0xc06b('0x41')](_0x508a60)?![]:!![]);})[_0xc06b('0x11')](function(_0x5428c7){logger[_0xc06b('0x2c')](_0x5428c7);_0x1f8a07(null,![]);});};AGIVertices[_0xc06b('0xc')][_0xc06b('0x4c')]=function(_0x595051,_0x115c79){var _0x5c0ccf={'role':'agent'};_0x5c0ccf[_0x595051]=this[_0xc06b('0x32')]['callerid'];this['rpc'][_0xc06b('0x4c')](_0x5c0ccf)[_0xc06b('0xf')](function(_0x6e7763){_0x115c79(null,_[_0xc06b('0x41')](_0x6e7763)?![]:!![]);})[_0xc06b('0x11')](function(_0x3442f5){logger[_0xc06b('0x2c')](_0x3442f5);_0x115c79(null,![]);});};AGIVertices[_0xc06b('0xc')][_0xc06b('0x4d')]=function(_0xccafe4,_0x1360f0){var _0x3b63ae={'role':_0xc06b('0x4b')};_0x3b63ae[_0xccafe4]=this['channel']['callerid'];this[_0xc06b('0xd')][_0xc06b('0x4d')](_0x3b63ae)[_0xc06b('0xf')](function(_0xec0ba){_0x1360f0(null,_['isNil'](_0xec0ba)?![]:!![]);})[_0xc06b('0x11')](function(_0x58a4a2){logger[_0xc06b('0x2c')](_0x58a4a2);_0x1360f0(null,![]);});};AGIVertices['prototype'][_0xc06b('0x4e')]=function(_0x2dff96,_0x350817){var _0x310480={'role':_0xc06b('0x4b')};_0x310480[_0x2dff96]=this[_0xc06b('0x32')][_0xc06b('0x37')];var _0x4d797b=_0x2dff96!='internal'?util['format'](_0xc06b('0x4f'),_0xc06b('0x50'),this['channel'][_0xc06b('0x37')]):undefined;this[_0xc06b('0xd')]['agentLogin'](_0x310480,_0x4d797b)[_0xc06b('0xf')](function(_0x170dc7){_0x350817(null,_[_0xc06b('0x41')](_0x170dc7)?![]:!![]);})['catch'](function(_0x2c7bfb){logger[_0xc06b('0x2c')](_0x2c7bfb);_0x350817(null,![]);});};AGIVertices[_0xc06b('0xc')][_0xc06b('0x51')]=function(_0x4db293,_0x1c89ed){sh[_0xc06b('0x52')](_[_0xc06b('0x53')](_0x4db293),function(_0x32184a,_0x12b16a){var _0xa57681=_0x12b16a[_0xc06b('0x54')](/(\r\n|\n|\r)/gm,'');_0x1c89ed(null,_0xa57681);});};AGIVertices['prototype'][_0xc06b('0x55')]=function(_0x3c1aaf,_0x1cd4b7){scripts[_0xc06b('0x55')](_0x3c1aaf[_0xc06b('0x56')],_0x3c1aaf[_0xc06b('0x57')]||_0xc06b('0x58'),_0x3c1aaf[_0xc06b('0x58')],_0x3c1aaf[_0xc06b('0x59')]||_0xc06b('0x5a'),_0x3c1aaf[_0xc06b('0x5b')]||'MALE',_0x3c1aaf['audioEncoding']||_0xc06b('0x5c'))[_0xc06b('0xf')](function(_0x5f4f96){_0x1cd4b7(null,_0x5f4f96);})[_0xc06b('0x11')](function(_0x53560c){_0x1cd4b7(_0x53560c);});};AGIVertices[_0xc06b('0xc')]['googleTTS']=function(_0x3442db,_0x205b47){scripts[_0xc06b('0x5d')](_0x3442db[_0xc06b('0x58')],_0x3442db[_0xc06b('0x5e')]||'en',0x1)[_0xc06b('0xf')](function(_0x1a79de){_0x205b47(null,_0x1a79de);})['catch'](function(_0x1f9165){_0x205b47(_0x1f9165);});};AGIVertices[_0xc06b('0xc')][_0xc06b('0x5f')]=function(_0xc34107,_0x1305b6){var _0x1fe863={'uri':_0xc34107[_0xc06b('0x60')],'method':_0xc34107[_0xc06b('0x61')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xc34107['timeout'])===_0xc06b('0x62')&&parseInt(_0xc34107[_0xc06b('0x63')])>=0x1?parseInt(_0xc34107[_0xc06b('0x63')])*0x3e8:0x5*0x3e8};if(_[_0xc06b('0x64')]([_0xc06b('0x65'),_0xc06b('0x66')],_0x1fe863[_0xc06b('0x61')]['toUpperCase']())){try{_0x1fe863['body']=_0xc34107['rawBody']?JSON[_0xc06b('0x67')](_0xc34107[_0xc06b('0x9')]):{};}catch(_0x4ee24d){logger[_0xc06b('0x2c')](_0xc06b('0x68'),_0x4ee24d);}}try{_0x1fe863[_0xc06b('0x69')]=_0xc34107[_0xc06b('0x8')]?JSON['parse'](_0xc34107['rawHeaders']):{};}catch(_0x1c4308){logger[_0xc06b('0x2c')](_0xc06b('0x6a'),_0x1c4308);}if(_0xc34107[_0xc06b('0x6b')]){try{var _0x38c6be=require(_0xc34107['computedVariables'])['sync'](this,_0x1fe863);_0x1fe863['uri']=Mustache[_0xc06b('0x6c')](_0xc34107[_0xc06b('0x60')],_0x38c6be,{},['$$','$$']);if(_0x1fe863['headers']){_0x1fe863[_0xc06b('0x69')]=JSON[_0xc06b('0x67')](Mustache[_0xc06b('0x6c')](JSON[_0xc06b('0x6d')](_0x1fe863['headers']),_0x38c6be,{},['$$','$$']));}if(_0x1fe863[_0xc06b('0x6e')]){_0x1fe863[_0xc06b('0x6e')]=JSON[_0xc06b('0x67')](Mustache['render'](JSON[_0xc06b('0x6d')](_0x1fe863[_0xc06b('0x6e')]),_0x38c6be,{},['$$','$$']));}}catch(_0x5194cb){logger['error'](_0xc06b('0x6f'),_0x5194cb);}}rp(_0x1fe863)[_0xc06b('0xf')](function(_0x1b0245){var _0x60922d={'statusCode':_0x1b0245[_0xc06b('0x70')]||0xc8,'statusMessage':_0x1b0245[_0xc06b('0x71')]||'OK','headers':_0x1b0245[_0xc06b('0x69')]||{},'body':_0x1b0245[_0xc06b('0x6e')]||{}};_0x1305b6(null,_0x60922d);})['catch'](function(_0xa0786e){var _0x54f3f8={'statusCode':_0xa0786e[_0xc06b('0x70')]||0x1f4,'statusMessage':_0xa0786e[_0xc06b('0x72')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0xa0786e['options']['headers']||{},'body':_0xa0786e['options'][_0xc06b('0x6e')]||{}};_0x1305b6(null,_0x54f3f8);});};AGIVertices[_0xc06b('0xc')][_0xc06b('0x73')]=function(_0x401e3b,_0x237ee7){scripts['googleDialogflow'](this['channel']['uniqueid'],_0x401e3b[_0xc06b('0x74')],_0x401e3b[_0xc06b('0x58')],_0x401e3b[_0xc06b('0x75')]||'en')['then'](function(_0x85eaee){_0x237ee7(null,_0x85eaee);})['catch'](function(_0x1d0357){_0x237ee7(_0x1d0357);});};AGIVertices[_0xc06b('0xc')][_0xc06b('0x76')]=function(_0x1b097b,_0x145fd9){scripts[_0xc06b('0x76')](this[_0xc06b('0x32')][_0xc06b('0x33')],_0x1b097b[_0xc06b('0x77')],_0x1b097b[_0xc06b('0x78')],_0x1b097b[_0xc06b('0x79')],_0x1b097b[_0xc06b('0x58')],_0x1b097b['dialogflowV2_language']||'en')[_0xc06b('0xf')](function(_0x536dd4){_0x145fd9(null,_0x536dd4);})['catch'](function(_0x56155b){_0x145fd9(_0x56155b);});};AGIVertices['prototype'][_0xc06b('0x7a')]=function(_0x58c515,_0x3fbb10){scripts['sestekNDA'](this[_0xc06b('0x32')],_0x58c515)[_0xc06b('0xf')](function(_0x149d66){_0x3fbb10(null,_0x149d66);})[_0xc06b('0x11')](function(_0x491afe){_0x3fbb10(_0x491afe);});};AGIVertices[_0xc06b('0xc')][_0xc06b('0x7b')]=function(_0x5a47a7,_0xa0c626){scripts[_0xc06b('0x7b')](_0x5a47a7[_0xc06b('0x74')],_0x5a47a7[_0xc06b('0x58')],_0x5a47a7[_0xc06b('0x7c')]||_0xc06b('0x5a'),_0x5a47a7[_0xc06b('0x7d')])[_0xc06b('0xf')](function(_0x2ccb8d){_0xa0c626(null,_0x2ccb8d);})[_0xc06b('0x11')](function(_0x32cef8){_0xa0c626(_0x32cef8);});};AGIVertices[_0xc06b('0xc')][_0xc06b('0x7e')]=function(_0x3ad2ef,_0x493c57,_0x4eccd3){scripts[_0xc06b('0x7e')](_0x493c57,_0x3ad2ef[_0xc06b('0x74')],_0x3ad2ef[_0xc06b('0x7f')]||_0xc06b('0x5a'),this[_0xc06b('0x80')](_0x3ad2ef[_0xc06b('0x81')])?_0x3ad2ef[_0xc06b('0x81')]:undefined)[_0xc06b('0xf')](function(_0x173f02){_0x4eccd3(null,_0x173f02);})[_0xc06b('0x11')](function(_0x451c3f){_0x4eccd3(_0x451c3f);});};AGIVertices['prototype'][_0xc06b('0x82')]=function(_0x21cff3,_0x281d32){scripts['awsPolly'](_0x21cff3[_0xc06b('0x83')],_0x21cff3[_0xc06b('0x84')],_0x21cff3[_0xc06b('0x85')],_0x21cff3[_0xc06b('0x86')]||_0xc06b('0x87'),_0x21cff3[_0xc06b('0x58')],_0x21cff3['aws_text_type']||_0xc06b('0x58'))[_0xc06b('0xf')](function(_0x4aaa8c){_0x281d32(null,_0x4aaa8c);})[_0xc06b('0x11')](function(_0x1d9c35){_0x281d32(_0x1d9c35);});};AGIVertices[_0xc06b('0xc')]['awsLex']=function(_0x23783e,_0x2a012f){scripts['awsLex'](this[_0xc06b('0x32')][_0xc06b('0x33')],_0x23783e[_0xc06b('0x83')],_0x23783e[_0xc06b('0x84')],_0x23783e[_0xc06b('0x88')],_0x23783e[_0xc06b('0x58')],_0x23783e['aws_bot_name'])[_0xc06b('0xf')](function(_0x559c62){_0x2a012f(null,_0x559c62);})['catch'](function(_0x17f639){_0x2a012f(_0x17f639);});};AGIVertices[_0xc06b('0xc')][_0xc06b('0x89')]=function(_0x210eb8,_0x104354,_0x2f04a2){scripts[_0xc06b('0x89')](_0x104354,_0x210eb8[_0xc06b('0x74')],_0x210eb8['google_asr_language']||_0xc06b('0x5a'))[_0xc06b('0xf')](function(_0x196da7){_0x2f04a2(null,_0x196da7);})['catch'](function(_0x273a32){_0x2f04a2(_0x273a32);});};AGIVertices[_0xc06b('0xc')][_0xc06b('0x8a')]=function(_0x16efab,_0x4d36de,_0x2d51d3){scripts[_0xc06b('0x8a')](_0x4d36de,_0x16efab[_0xc06b('0x8b')],_0x16efab['appsecret'],_0x16efab[_0xc06b('0x8c')])['then'](function(_0x29e84e){_0x2d51d3(null,_0x29e84e);})[_0xc06b('0x11')](function(_0x1267a9){_0x2d51d3(_0x1267a9);});};AGIVertices[_0xc06b('0xc')][_0xc06b('0x8d')]=function(_0x428eee){var _0x225c91=_[_0xc06b('0x64')](verticesWithRetry,_0x428eee[_0xc06b('0x35')])?_0x428eee:_[_0xc06b('0x8e')](_0x428eee);for(var _0x2985f8 in _0x225c91){if(_0x225c91[_0xc06b('0x8f')](_0x2985f8)){if(_0x225c91[_0x2985f8]&&_[_0xc06b('0x90')](_0x225c91[_0x2985f8])){if(_[_0xc06b('0x64')](recursiveMapAttributes,_0x2985f8)){_0x225c91[_0x2985f8]=this[_0xc06b('0x91')](_0x225c91[_0x2985f8]);}else{_0x225c91[_0x2985f8]=this['replaceAllVariables'](_0x225c91[_0x2985f8]);}}}}return _0x225c91;};AGIVertices[_0xc06b('0xc')][_0xc06b('0x92')]=function(_0x2f3871){for(var _0x1ade12 in _0x2f3871){if(_0x2f3871['hasOwnProperty'](_0x1ade12)){if(_[_0xc06b('0x93')](_0x2f3871[_0x1ade12])){this['recursiveNodeIndex'](_0x2f3871[_0x1ade12]);}else if(_[_0xc06b('0x94')](_0x2f3871[_0x1ade12])){for(var _0x5d4f61=0x0;_0x5d4f61<_0x2f3871[_0x1ade12][_0xc06b('0x95')];_0x5d4f61++){this[_0xc06b('0x92')](_0x2f3871[_0x1ade12][_0x5d4f61]);}}else if(_['isString'](_0x2f3871[_0x1ade12])){_0x2f3871[_0x1ade12]=this[_0xc06b('0x96')](_0x2f3871[_0x1ade12]);}}}};AGIVertices['prototype'][_0xc06b('0x97')]=function(_0xd1d147,_0x2eeb67){for(var _0x741e07 in _0xd1d147){if(_0xd1d147['hasOwnProperty'](_0x741e07)){if(_[_0xc06b('0x93')](_0xd1d147[_0x741e07])){if(!_['isEmpty'](_0xd1d147[_0x741e07])){this['saveRestApiResult'](_0xd1d147[_0x741e07],util[_0xc06b('0x25')](_0xc06b('0x98'),_0x2eeb67,_0x741e07));}}else if(_['isArray'](_0xd1d147[_0x741e07])){for(var _0x5f2641=0x0;_0x5f2641<_0xd1d147[_0x741e07][_0xc06b('0x95')];_0x5f2641++){this['saveRestApiResult'](_0xd1d147[_0x741e07][_0x5f2641],util[_0xc06b('0x25')](_0xc06b('0x98'),_0x2eeb67,_0x741e07+'['+_0x5f2641+']'));}}else{if(!_['isNil'](_0xd1d147[_0x741e07])){this[_0xc06b('0x32')][_0xc06b('0x99')](util[_0xc06b('0x25')](_0xc06b('0x98'),_0x2eeb67,_0x741e07),_0xd1d147[_0x741e07]);}}}}};AGIVertices[_0xc06b('0xc')]['replaceObjectAllVariables']=function(_0x3f6806){try{var _0x5a20a7=JSON[_0xc06b('0x67')](_0x3f6806);this[_0xc06b('0x92')](_0x5a20a7);return JSON[_0xc06b('0x6d')](_0x5a20a7);}catch(_0x26b34b){return this[_0xc06b('0x96')](_0x3f6806);}};AGIVertices['prototype'][_0xc06b('0x96')]=function(_0x46e247){var _0x42e63c=_0x46e247[_0xc06b('0x9a')]('{');for(var _0x2b6122=0x1;_0x2b6122<_0x42e63c[_0xc06b('0x95')];_0x2b6122+=0x1){var _0x1a236f=_0x42e63c[_0x2b6122][_0xc06b('0x9a')]('}');if(_0x1a236f[_0xc06b('0x95')]>0x1){_0x46e247=_0x46e247[_0xc06b('0x9b')]('{'+_0x1a236f[0x0]+'}',this[_0xc06b('0x32')][_0xc06b('0x9c')](_0x1a236f[0x0])['extra']||_0x1a236f[0x0]);}}if(_0x42e63c[_0xc06b('0x95')]===0x1){return _0x46e247['toString']();}return this[_0xc06b('0x96')](_0x46e247);};AGIVertices[_0xc06b('0xc')][_0xc06b('0x9d')]=function(_0x8bd801,_0x31973f){var _0x1c8648=this['channel'][_0xc06b('0x9c')](_0x8bd801);if(_0x1c8648['result']===-0x1){return _0x1c8648;}logger[_0xc06b('0x28')](util['format'](_0xc06b('0x9e'),_0x31973f,_0x1c8648[_0xc06b('0x9f')]));return this[_0xc06b('0x32')][_0xc06b('0x99')](_0x31973f,_0x1c8648[_0xc06b('0x9f')]);};AGIVertices['prototype'][_0xc06b('0x80')]=function(_0x474db4){return _0x474db4&&_0x474db4!=='0'&&_0x474db4!=='-1'&&_0x474db4!=='';};AGIVertices[_0xc06b('0xc')]['maxRetry']=function(_0x32ac69){this[_0xc06b('0x31')][_0xc06b('0xa0')](this,_0x32ac69,'-');_0x32ac69[_0xc06b('0xa1')]=_0x32ac69[_0xc06b('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xc06b('0xc')][_0xc06b('0xa3')]=function(_0x550c0b){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0xa4'),_0x550c0b[_0xc06b('0x34')]));if(!this[_0xc06b('0x80')](_0x550c0b[_0xc06b('0x58')])){return this[_0xc06b('0x32')][_0xc06b('0xa5')]('no\x20text\x20configured');}var _0x4eb2ed='\x22'+_0x550c0b['text']+'\x22';if(this['isConfigured'](_0x550c0b['options'])){_0x4eb2ed+=','+_0x550c0b[_0xc06b('0xa6')];}var _0x818a5e=this[_0xc06b('0x32')][_0xc06b('0x52')](_0xc06b('0xa7'),_0x4eb2ed);if(_0x818a5e[_0xc06b('0xa8')]===-0x1){return _0x818a5e;}return this['channel'][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0xa9'),_0x4eb2ed));};AGIVertices[_0xc06b('0xc')][_0xc06b('0xaa')]=function(_0x666de8){logger['info'](util[_0xc06b('0x25')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x666de8[_0xc06b('0x34')]));if(!this[_0xc06b('0x80')](_0x666de8[_0xc06b('0xab')])){return this[_0xc06b('0x32')]['noop'](_0xc06b('0xac'));}var _0x5252cd=_0x666de8[_0xc06b('0xab')];if(this[_0xc06b('0x80')](_0x666de8[_0xc06b('0xa6')])){_0x5252cd+=','+_0x666de8[_0xc06b('0xa6')];}var _0x393005=this[_0xc06b('0x32')][_0xc06b('0x52')](_0xc06b('0xad'),_0x5252cd);if(_0x393005[_0xc06b('0xa8')]===-0x1){return _0x393005;}var _0x1d6493=this[_0xc06b('0x9d')](_0xc06b('0xae'),_0xc06b('0xaf'));if(_0x1d6493[_0xc06b('0xa8')]===-0x1){return _0x1d6493;}var _0x52e027=this[_0xc06b('0x9d')](_0xc06b('0xb0'),_0xc06b('0xb1'));if(_0x52e027['result']===-0x1){return _0x52e027;}var _0x41ce3f=this['getAndSetVariable']('RECOG_INSTANCE()',_0xc06b('0xb2'));if(_0x41ce3f[_0xc06b('0xa8')]===-0x1){return _0x41ce3f;}return this['channel']['noop'](util[_0xc06b('0x25')](_0xc06b('0xb3'),_0x5252cd));};AGIVertices['prototype']['agi']=function(_0x3b3601){logger['info'](util[_0xc06b('0x25')](_0xc06b('0xb4'),_0x3b3601[_0xc06b('0x34')]));return this[_0xc06b('0x32')][_0xc06b('0xb5')]([_0x3b3601[_0xc06b('0xb6')],_0x3b3601[_0xc06b('0xb7')]]);};AGIVertices['prototype']['answer']=function(_0x950e5d){logger[_0xc06b('0x28')](util['format'](_0xc06b('0xb8'),_0x950e5d['label']));if(this[_0xc06b('0x80')](_0x950e5d[_0xc06b('0x63')])){logger[_0xc06b('0x28')](util[_0xc06b('0x25')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x950e5d[_0xc06b('0x63')]));var _0x1108eb=this['channel'][_0xc06b('0xb9')](_0x950e5d[_0xc06b('0x63')]);if(_0x1108eb[_0xc06b('0xa8')]===-0x1){return _0x1108eb;}}return this[_0xc06b('0x32')][_0xc06b('0xba')]();};AGIVertices[_0xc06b('0xc')][_0xc06b('0x45')]=function(_0x1eda03){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0xbb'),_0x1eda03['label']));if(!this[_0xc06b('0x80')](_0x1eda03['list_id'])){return this['channel'][_0xc06b('0x2c')](_0x1eda03,_0xc06b('0xbc'));}_0x1eda03[_0xc06b('0xbd')]=moment();if(this[_0xc06b('0x80')](_0x1eda03[_0xc06b('0xbe')])){_0x1eda03['scheduledAt']=moment()[_0xc06b('0xbf')](_0x1eda03[_0xc06b('0xbe')],_0xc06b('0xc0'));}if(!this[_0xc06b('0x80')](_0x1eda03[_0xc06b('0x47')])){_0x1eda03[_0xc06b('0x47')]=0x2;}this[_0xc06b('0x3f')][_0xc06b('0xa0')](this,_0x1eda03);return this['channel'][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0xc1'),_0x1eda03[_0xc06b('0x44')],_0x1eda03[_0xc06b('0xc2')],_0x1eda03[_0xc06b('0xbd')]));};AGIVertices[_0xc06b('0xc')]['custom_app']=function(_0x4057aa){logger[_0xc06b('0x28')](util[_0xc06b('0x25')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x4057aa['label']));var _0x2f2028=this[_0xc06b('0x32')]['exec'](_0x4057aa[_0xc06b('0xc3')],_0x4057aa[_0xc06b('0xa6')]);if(_0x2f2028['result']===-0x1){return _0x2f2028;}return this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0xc4'),_0x4057aa[_0xc06b('0xc3')],_0x4057aa['options']));};AGIVertices[_0xc06b('0xc')][_0xc06b('0xc5')]=function(_0x50a561){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0xc6'),_0x50a561[_0xc06b('0x34')]));if(!this[_0xc06b('0x80')](_0x50a561[_0xc06b('0x58')])){return this['channel'][_0xc06b('0xa5')](_0xc06b('0xc7'));}var _0x380a76='\x22'+_0x50a561[_0xc06b('0x58')]+'\x22';if(this[_0xc06b('0x80')](_0x50a561[_0xc06b('0xa6')])){_0x380a76+=','+_0x50a561['options'];}var _0x165b44=this[_0xc06b('0x32')][_0xc06b('0x52')](_0xc06b('0xa7'),_0x380a76);if(_0x165b44[_0xc06b('0xa8')]===-0x1){return _0x165b44;}return this[_0xc06b('0x32')]['noop'](util[_0xc06b('0x25')](_0xc06b('0xa9'),_0x380a76));};AGIVertices[_0xc06b('0xc')][_0xc06b('0xc8')]=function(_0x53e09a){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0xc9'),_0x53e09a[_0xc06b('0x34')]));if(!this['isConfigured'](_0x53e09a[_0xc06b('0x58')])){return this[_0xc06b('0x32')][_0xc06b('0xa5')]('no\x20text\x20configured');}var _0x328dd3='\x22'+_0x53e09a[_0xc06b('0x58')]+'\x22';if(this[_0xc06b('0x80')](_0x53e09a[_0xc06b('0xa6')])){_0x328dd3+=','+_0x53e09a['options'];}var _0x33f693=this[_0xc06b('0x32')][_0xc06b('0x52')](_0xc06b('0xa7'),_0x328dd3);if(_0x33f693[_0xc06b('0xa8')]===-0x1){return _0x33f693;}return this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')]('Executed\x20command\x20MRCPSynth\x20%s',_0x328dd3));};AGIVertices[_0xc06b('0xc')][_0xc06b('0xca')]=function(_0x205537){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0xcb'),_0x205537[_0xc06b('0x34')]));if(!this[_0xc06b('0x80')](_0x205537[_0xc06b('0xab')])){return this[_0xc06b('0x32')][_0xc06b('0xa5')](_0xc06b('0xac'));}var _0x56629d=_0x205537[_0xc06b('0xab')];if(this[_0xc06b('0x80')](_0x205537[_0xc06b('0xa6')])){_0x56629d+=','+_0x205537[_0xc06b('0xa6')];}var _0x26bccd=this[_0xc06b('0x32')][_0xc06b('0x52')](_0xc06b('0xad'),_0x56629d);if(_0x26bccd[_0xc06b('0xa8')]===-0x1){return _0x26bccd;}var _0x44eeb4=this['getAndSetVariable'](_0xc06b('0xae'),_0xc06b('0xcc'));if(_0x44eeb4['result']===-0x1){return _0x44eeb4;}var _0x54232e=this['getAndSetVariable'](_0xc06b('0xb0'),_0xc06b('0xcd'));if(_0x54232e[_0xc06b('0xa8')]===-0x1){return _0x54232e;}var _0x10bd65=this[_0xc06b('0x9d')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x10bd65[_0xc06b('0xa8')]===-0x1){return _0x10bd65;}return this[_0xc06b('0x32')]['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x56629d));};AGIVertices[_0xc06b('0xc')][_0xc06b('0xce')]=function(_0x3c1524){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0xcf'),_0x3c1524['label']));if(!this['isConfigured'](_0x3c1524[_0xc06b('0xab')])){return this[_0xc06b('0x32')]['noop'](_0xc06b('0xac'));}var _0x276d51=_0x3c1524[_0xc06b('0xab')];if(this[_0xc06b('0x80')](_0x3c1524[_0xc06b('0xa6')])){_0x276d51+=','+_0x3c1524[_0xc06b('0xa6')];}var _0x173c6e=this[_0xc06b('0x32')][_0xc06b('0x52')](_0xc06b('0xad'),_0x276d51);if(_0x173c6e[_0xc06b('0xa8')]===-0x1){return _0x173c6e;}var _0x3de54d=this['getAndSetVariable'](_0xc06b('0xae'),_0xc06b('0xd0'));if(_0x3de54d[_0xc06b('0xa8')]===-0x1){return _0x3de54d;}var _0x2b75e7=this[_0xc06b('0x9d')](_0xc06b('0xb0'),_0xc06b('0xd1'));if(_0x2b75e7['result']===-0x1){return _0x2b75e7;}var _0x170657=this[_0xc06b('0x9d')](_0xc06b('0xd2'),_0xc06b('0xd3'));if(_0x170657[_0xc06b('0xa8')]===-0x1){return _0x170657;}return this['channel'][_0xc06b('0xa5')](util[_0xc06b('0x25')]('Executed\x20command\x20MRCPRecog\x20%s',_0x276d51));};AGIVertices[_0xc06b('0xc')][_0xc06b('0xd4')]=function(_0x32de14){logger[_0xc06b('0x28')](util[_0xc06b('0x25')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x32de14[_0xc06b('0x34')]));if(!this[_0xc06b('0x80')](_0x32de14['odbc_id'])){return this[_0xc06b('0x32')]['error'](_0x32de14,_0xc06b('0xd5'));}var _0x4eeda2=this[_0xc06b('0x16')][_0xc06b('0xa0')](this,_0x32de14[_0xc06b('0xd6')]);if(!_0x4eeda2){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x32de14,_0xc06b('0xd7'));}if(!this[_0xc06b('0x80')](_0x32de14['query'])){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x32de14,_0xc06b('0xd8'));}var _0x4bc547=_0x32de14[_0xc06b('0x2a')][_0xc06b('0x54')](/(\r\n|\n|\r)/gm,'\x20');this[_0xc06b('0x32')]['noop'](util[_0xc06b('0x25')]('query:\x20%s',_0x4bc547));var _0x4b4b98=this[_0xc06b('0x27')][_0xc06b('0xa0')](this,_0x4eeda2,_0x4bc547);this['createSquareDetailsReport']['sync'](this,_0x32de14,_0x4bc547);if(!this[_0xc06b('0x80')](_0x32de14[_0xc06b('0xd9')])){return this[_0xc06b('0x32')][_0xc06b('0xa5')](_0xc06b('0xda'));}var _0x8946e1=this[_0xc06b('0x9c')][_0xc06b('0xa0')](this,_0x32de14[_0xc06b('0xd9')]);if(!_0x8946e1){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x32de14,'no\x20variable\x20found');}var _0x36f9a6=this;_0x4b4b98[_0xc06b('0xdb')](function(_0x1b1889,_0x1881fe){Object[_0xc06b('0xdc')](_0x1b1889)[_0xc06b('0xdb')](function(_0x5b2739){_0x36f9a6[_0xc06b('0x32')][_0xc06b('0x99')](util[_0xc06b('0x25')](_0xc06b('0xdd'),_0x8946e1,_0x1881fe,_0x5b2739),_0x1b1889[_0x5b2739]);});});this[_0xc06b('0x32')]['setVariable'](util[_0xc06b('0x25')](_0xc06b('0xde'),_0x8946e1),_0x4b4b98[_0xc06b('0x95')]);return this['channel'][_0xc06b('0xa5')](util['format'](_0xc06b('0xdf'),_0x8946e1));};AGIVertices[_0xc06b('0xc')]['dial']=function(_0x3e8922){logger[_0xc06b('0xe0')](util[_0xc06b('0x25')](_0xc06b('0xe1'),_0x3e8922[_0xc06b('0x34')]));if(!this['isConfigured'](_0x3e8922[_0xc06b('0xe2')])){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x3e8922,_0xc06b('0xe3'));}var _0xbef362=this[_0xc06b('0x19')][_0xc06b('0xa0')](this,_0x3e8922[_0xc06b('0xe2')]);if(!_0xbef362){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x3e8922,'no\x20user\x20found');}var _0x46e81b=this[_0xc06b('0x32')]['exec'](_0xc06b('0xe4'),[util[_0xc06b('0x25')](_0xc06b('0xe5'),_0xbef362),_0x3e8922[_0xc06b('0x63')],_0x3e8922[_0xc06b('0xe6')],_0x3e8922[_0xc06b('0x60')]]);if(_0x46e81b[_0xc06b('0xa8')]===-0x1){return _0x46e81b;}return this['channel'][_0xc06b('0xa5')](util['format'](_0xc06b('0xe7'),'DIAL'));};AGIVertices[_0xc06b('0xc')]['dialogflow']=function(_0x402951){logger[_0xc06b('0x28')](util[_0xc06b('0x25')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x402951[_0xc06b('0x34')]));if(!this[_0xc06b('0x80')](_0x402951['key'])){return this['channel']['noop'](_0xc06b('0xe8'));}if(!this[_0xc06b('0x80')](_0x402951[_0xc06b('0x58')])){return this[_0xc06b('0x32')][_0xc06b('0xa5')]('no\x20text\x20configured');}this[_0xc06b('0x32')][_0xc06b('0xe9')]=!![];this[_0xc06b('0x31')](_0x402951);this['createSquareMessage'](_0x402951[_0xc06b('0x58')],'in','','');this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')]('Trying\x20Dialogflow:\x20%s',_0x402951[_0xc06b('0x58')]));var _0x288564=this['googleDialogflow'][_0xc06b('0xa0')](this,_0x402951);if(_0x288564){for(var _0x1665df in _0x288564){if(_0x288564[_0xc06b('0x8f')](_0x1665df)){this[_0xc06b('0x32')][_0xc06b('0x99')](util[_0xc06b('0x25')](_0xc06b('0xea'),_0x1665df[_0xc06b('0xeb')]()),_0x288564[_0x1665df]);}}this[_0xc06b('0x3e')](_0x288564['speech'],_0xc06b('0xec'),'dialogflow','');return this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0xed'),_0x288564['speech']));}return this['channel']['error'](_0x402951,_0xc06b('0xee'));};AGIVertices[_0xc06b('0xc')]['dialogflowV2']=function(_0x1f7465){logger['info'](util[_0xc06b('0x25')](_0xc06b('0xef'),_0x1f7465[_0xc06b('0x34')]));if(!this[_0xc06b('0x80')](_0x1f7465[_0xc06b('0x77')])){return this[_0xc06b('0x32')][_0xc06b('0xa5')](_0xc06b('0xf0'));}if(!this[_0xc06b('0x80')](_0x1f7465['client_email'])){return this[_0xc06b('0x32')][_0xc06b('0xa5')]('no\x20client_email\x20configured');}if(!this[_0xc06b('0x80')](_0x1f7465['private_key'])){return this[_0xc06b('0x32')][_0xc06b('0xa5')](_0xc06b('0xf1'));}if(!this[_0xc06b('0x80')](_0x1f7465[_0xc06b('0xf2')])){return this[_0xc06b('0x32')][_0xc06b('0xa5')]('no\x20anguage\x20configured');}if(!this[_0xc06b('0x80')](_0x1f7465[_0xc06b('0x58')])){return this['channel'][_0xc06b('0xa5')]('no\x20text\x20configured');}this['channel'][_0xc06b('0xe9')]=!![];this[_0xc06b('0x31')](_0x1f7465);this[_0xc06b('0x3e')](_0x1f7465[_0xc06b('0x58')],'in','','');this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')]('Trying\x20DialogflowV2:\x20%s',_0x1f7465['text']));var _0x2452d9=this[_0xc06b('0x76')][_0xc06b('0xa0')](this,_0x1f7465);if(_0x2452d9){for(var _0x2ccf1e in _0x2452d9){if(_0x2452d9[_0xc06b('0x8f')](_0x2ccf1e)){if(_0x2ccf1e!=='providerResponse'){this[_0xc06b('0x32')][_0xc06b('0x99')](util[_0xc06b('0x25')]('DIALOGFLOW_%s',_0x2ccf1e[_0xc06b('0xeb')]()),_0x2452d9[_0x2ccf1e]);}}}this[_0xc06b('0x3e')](_0x2452d9['speech'],_0xc06b('0xec'),'dialogflowV2',_0x2452d9[_0xc06b('0xf3')]);return this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0xf4'),_0x2452d9[_0xc06b('0xf5')]));}return this[_0xc06b('0x32')]['error'](_0x1f7465,_0xc06b('0xf6'));};AGIVertices[_0xc06b('0xc')][_0xc06b('0xf7')]=function(_0x91da9a){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0xf8'),_0x91da9a[_0xc06b('0x34')]));if(!this[_0xc06b('0x80')](_0x91da9a[_0xc06b('0xf9')])){return this[_0xc06b('0x32')]['noop'](_0xc06b('0xfa'));}if(!this[_0xc06b('0x80')](_0x91da9a['username'])){return this[_0xc06b('0x32')][_0xc06b('0xa5')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x91da9a[_0xc06b('0xfb')])){return this['channel'][_0xc06b('0xa5')](_0xc06b('0xfc'));}if(!this[_0xc06b('0x80')](_0x91da9a[_0xc06b('0xfd')])){return this[_0xc06b('0x32')][_0xc06b('0xa5')](_0xc06b('0xc7'));}this[_0xc06b('0x32')][_0xc06b('0xe9')]=!![];this[_0xc06b('0x31')](_0x91da9a);this['createSquareMessage'](_0x91da9a[_0xc06b('0x58')],'in','','');this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')]('Trying\x20SestekNDA:\x20%s',_0x91da9a[_0xc06b('0x58')]));var _0xe16ca6=this[_0xc06b('0x7a')][_0xc06b('0xa0')](this,_0x91da9a);if(_0xe16ca6){for(var _0x1780dd in _0xe16ca6){if(_0xe16ca6[_0xc06b('0x8f')](_0x1780dd)){this['channel'][_0xc06b('0x99')](util[_0xc06b('0x25')](_0xc06b('0xfe'),_0x1780dd[_0xc06b('0xeb')]()),_0xe16ca6[_0x1780dd]);}}this[_0xc06b('0x3e')](_0xe16ca6['speech'],_0xc06b('0xec'),_0xc06b('0xf7'),'');if(_0xe16ca6[_0xc06b('0xff')]){this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0x100'),_0xe16ca6[_0xc06b('0xff')]));var _0x55b4f4=this[_0xc06b('0x32')][_0xc06b('0x101')](_0xe16ca6[_0xc06b('0xff')]);try{fs[_0xc06b('0x102')](_0xe16ca6['audiofile']+_0xc06b('0x103'));}catch(_0x4009b1){logger[_0xc06b('0x2c')](_0x4009b1);}return _0x55b4f4;}else{return this[_0xc06b('0x32')]['noop'](util[_0xc06b('0x25')](_0xc06b('0x104'),_0xe16ca6[_0xc06b('0xf5')]));}}return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x91da9a,_0xc06b('0x105'));};AGIVertices[_0xc06b('0xc')][_0xc06b('0x106')]=function(_0x1b7341){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x107'),_0x1b7341[_0xc06b('0x34')]));return this['channel']['noop']('end');};AGIVertices[_0xc06b('0xc')]['ext_dial']=function(_0x357869){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x108'),_0x357869[_0xc06b('0x34')]));var _0x56c76f='';if(_0x357869[_0xc06b('0x109')]){if(!this[_0xc06b('0x80')](_0x357869[_0xc06b('0x109')])){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x357869,_0xc06b('0x10a'));}else{var _0x1e9258=parseInt(_0x357869['trunk_id'],0xa);if(isNaN(_0x1e9258)){_0x56c76f=_0x357869[_0xc06b('0x109')];}else{_0x56c76f=this['getTrunk']['sync'](this,_0x357869['trunk_id']);if(!_0x56c76f){return this['channel']['error'](_0x357869,'no\x20trunk\x20found');}}}}else if(_0x357869[_0xc06b('0x10b')]){_0x56c76f=_0x357869['trunk_name'];}else{return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x357869,_0xc06b('0x10a'));}var _0xd10dfe=this[_0xc06b('0x32')]['exec']('DIAL',[util[_0xc06b('0x25')](_0xc06b('0x10c'),_0x56c76f,_0x357869[_0xc06b('0x44')]),_0x357869[_0xc06b('0x63')],_0x357869[_0xc06b('0xe6')],_0x357869[_0xc06b('0x60')]]);if(_0xd10dfe[_0xc06b('0xa8')]===-0x1){return _0xd10dfe;}return this['channel'][_0xc06b('0xa5')](util['format'](_0xc06b('0xe7'),_0xc06b('0xe4')));};AGIVertices['prototype'][_0xc06b('0x10d')]=function(_0x3f6dfb){logger[_0xc06b('0x28')](util[_0xc06b('0x25')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x3f6dfb[_0xc06b('0x34')]));return this['channel'][_0xc06b('0xa5')](_0xc06b('0x10d'));};AGIVertices['prototype'][_0xc06b('0x10e')]=function(_0x225d01){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x10f'),_0x225d01[_0xc06b('0x34')]));if(_0x225d01[_0xc06b('0xa1')]===0x0){return this['maxRetry'](_0x225d01);}_0x225d01[_0xc06b('0xa1')]-=0x1;if(!this[_0xc06b('0x80')](_0x225d01['file_id'])){return this['channel'][_0xc06b('0x2c')](_0x225d01,_0xc06b('0x110'));}var _0x19a9f0=this[_0xc06b('0x111')]['sync'](this,_0x225d01[_0xc06b('0x112')]);if(!_0x19a9f0){return this[_0xc06b('0x32')]['error'](_0x225d01,_0xc06b('0x113'));}if(!this['isConfigured'](_0x225d01['variable_id'])){return this[_0xc06b('0x32')][_0xc06b('0x2c')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x43caf6=this['channel'][_0xc06b('0x114')](_0x19a9f0,_0x225d01[_0xc06b('0x115')],_0x225d01[_0xc06b('0x116')]);var _0x102478=_0x43caf6[_0xc06b('0xa8')]?_0x43caf6[_0xc06b('0xa8')][_0xc06b('0x117')]():'';logger[_0xc06b('0x28')](_0xc06b('0x118'),JSON['stringify'](_0x43caf6));if(_0x43caf6[_0xc06b('0xa8')]===-0x1){this[_0xc06b('0x31')][_0xc06b('0xa0')](this,_0x225d01,_0x102478);return _0x43caf6;}else if(_0x43caf6[_0xc06b('0x9f')]===_0xc06b('0x63')){_0x43caf6['result']=_0x102478[_0xc06b('0x95')]>=parseInt(_0x225d01[_0xc06b('0x119')])?'x':'i';}else{_0x43caf6[_0xc06b('0xa8')]=_0x102478[_0xc06b('0x95')]>=parseInt(_0x225d01[_0xc06b('0x119')])&&_0x102478[_0xc06b('0x95')]<=parseInt(_0x225d01[_0xc06b('0x116')])?'x':'i';}var _0x64b4bb=this['getVariable'][_0xc06b('0xa0')](this,_0x225d01[_0xc06b('0xd9')]);if(!_0x64b4bb){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x225d01,_0xc06b('0x11a'));}this['channel'][_0xc06b('0x99')](_0x64b4bb,_0x102478);if(this[_0xc06b('0x80')](_0x225d01['hiddendigitsnum'])){var _0x561ae4=parseInt(_0x225d01[_0xc06b('0x11b')],0xa);var _0x1c63ac=rs[_0xc06b('0x11c')]({'charset':'*','length':_0x561ae4});var _0x58961f=_0x102478[_0xc06b('0x95')];if(_0x58961f>0x0){if(_0x58961f>_0x561ae4){this['createSquareDetailsReport'][_0xc06b('0xa0')](this,_0x225d01,_0x225d01[_0xc06b('0x11d')]===_0xc06b('0x11e')?_0x1c63ac+_0x102478['substr'](_0x561ae4):_0x102478[_0xc06b('0x11f')](0x0,_0x58961f-_0x561ae4)+_0x1c63ac);}else{this[_0xc06b('0x31')][_0xc06b('0xa0')](this,_0x225d01,rs['generate']({'charset':'*','length':_0x58961f}));}}else{this['createSquareDetailsReport'][_0xc06b('0xa0')](this,_0x225d01,'');}}else{this['createSquareDetailsReport'][_0xc06b('0xa0')](this,_0x225d01,_0x102478);}return _0x43caf6;};AGIVertices[_0xc06b('0xc')]['getsecretdigits']=function(_0x105870){logger['info'](util[_0xc06b('0x25')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x105870[_0xc06b('0x34')]));return this[_0xc06b('0x10e')](_0x105870);};AGIVertices['prototype'][_0xc06b('0x120')]=function(_0x1056eb){logger['info'](util[_0xc06b('0x25')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x1056eb['label']));this[_0xc06b('0x31')][_0xc06b('0xa0')](this,_0x1056eb,_0x1056eb['goalname']);return this[_0xc06b('0x32')]['noop'](util[_0xc06b('0x25')](_0xc06b('0x121'),_0x1056eb['goalname']));};AGIVertices['prototype'][_0xc06b('0x122')]=function(_0xcd9608){logger[_0xc06b('0x28')](util['format'](_0xc06b('0x123'),_0xcd9608[_0xc06b('0x34')]));if(!this[_0xc06b('0x80')](_0xcd9608[_0xc06b('0x83')])||!this['isConfigured'](_0xcd9608['aws_secret_access_key'])){return this['channel']['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0xc06b('0x80')](_0xcd9608[_0xc06b('0x58')])){return this[_0xc06b('0x32')][_0xc06b('0xa5')](_0xc06b('0xc7'));}this['channel'][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0x124'),_0xcd9608[_0xc06b('0x58')]));var _0x31954d=this[_0xc06b('0x82')]['sync'](this,_0xcd9608);if(_0x31954d){this['channel'][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0x125'),_0x31954d));var _0x1990e9=this[_0xc06b('0x32')][_0xc06b('0x101')](_0x31954d);try{fs['unlink'](_0x31954d+_0xc06b('0x103'));}catch(_0x128302){logger[_0xc06b('0x2c')](_0x128302);}return _0x1990e9;}return this[_0xc06b('0x32')]['error'](_0xcd9608,_0xc06b('0x126'));};AGIVertices[_0xc06b('0xc')][_0xc06b('0x127')]=function(_0x34dff1){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x128'),_0x34dff1[_0xc06b('0x34')]));if(!this['isConfigured'](_0x34dff1[_0xc06b('0x83')])||!this['isConfigured'](_0x34dff1[_0xc06b('0x84')])){return this[_0xc06b('0x32')][_0xc06b('0xa5')](_0xc06b('0x129'));}if(!this[_0xc06b('0x80')](_0x34dff1[_0xc06b('0x12a')])){return this['channel']['noop']('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x34dff1[_0xc06b('0x58')])){return this[_0xc06b('0x32')][_0xc06b('0xa5')](_0xc06b('0xc7'));}this['channel'][_0xc06b('0xe9')]=!![];this['createSquareDetailsReport'](_0x34dff1);this['createSquareMessage'](_0x34dff1['text'],'in','','');this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0x12b'),_0x34dff1['text']));var _0x26226d=this['awsLex'][_0xc06b('0xa0')](this,_0x34dff1);if(_0x26226d){for(var _0x1698a0 in _0x26226d){if(_0x26226d[_0xc06b('0x8f')](_0x1698a0)&&_['isString'](_0x26226d[_0x1698a0])){this['channel'][_0xc06b('0x99')](util['format'](_0xc06b('0x12c'),_0x1698a0[_0xc06b('0xeb')]()),_0x26226d[_0x1698a0]);}}if(_['isNil'](_0x26226d[_0xc06b('0x72')])){return this[_0xc06b('0x32')][_0xc06b('0xa5')](_0xc06b('0x12d'));}else{this[_0xc06b('0x3e')](_0x26226d[_0xc06b('0x72')],'out',_0xc06b('0x12e'),'');return this[_0xc06b('0x32')][_0xc06b('0xa5')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x26226d[_0xc06b('0x72')]));}}return this['channel'][_0xc06b('0x2c')](_0x34dff1,_0xc06b('0x12f'));};AGIVertices['prototype'][_0xc06b('0x130')]=function(_0x273a04){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x131'),_0x273a04[_0xc06b('0x34')],_0x273a04['timeout']));if(!this[_0xc06b('0x80')](_0x273a04[_0xc06b('0x74')])){return this[_0xc06b('0x32')][_0xc06b('0xa5')](_0xc06b('0xe8'));}var _0x3b5272=_0xc06b('0x132');var _0x3aa9d9=util[_0xc06b('0x25')]('%s/recordings/%s',FILES_PATH,rs[_0xc06b('0x11c')](0x4));var _0x40668f=util['format'](_0xc06b('0x98'),_0x3aa9d9,_0x3b5272);var _0x571477=!![];if(_0x273a04[_0xc06b('0x133')]===_0xc06b('0x134')){_0x571477=![];}var _0xba6bc9=this[_0xc06b('0x32')][_0xc06b('0x135')](_0x3aa9d9,_0x3b5272,_0x273a04[_0xc06b('0x136')],_0x273a04[_0xc06b('0x63')],undefined,_0x571477);if(_0xba6bc9[_0xc06b('0xa8')]!==-0x1){this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0x137'),_0x40668f));var _0x5eb5e4=this['googleASR'][_0xc06b('0xa0')](this,_0x273a04,_0x40668f);if(_0x5eb5e4){for(var _0x1ed2b9 in _0x5eb5e4){if(_0x5eb5e4[_0xc06b('0x8f')](_0x1ed2b9)){this['channel'][_0xc06b('0x99')](util[_0xc06b('0x25')](_0xc06b('0x138'),_0x1ed2b9[_0xc06b('0xeb')]()),_0x5eb5e4[_0x1ed2b9]);}}return this[_0xc06b('0x32')]['noop'](util[_0xc06b('0x25')](_0xc06b('0x139'),JSON['stringify'](_0x5eb5e4)));}}return _0xba6bc9;};AGIVertices[_0xc06b('0xc')][_0xc06b('0x13a')]=function(_0x3f8658){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x13b'),_0x3f8658['label']));if(!this['isConfigured'](_0x3f8658['appid'])){return this['channel'][_0xc06b('0xa5')](_0xc06b('0x13c'));}if(!this[_0xc06b('0x80')](_0x3f8658[_0xc06b('0x13d')])){return this[_0xc06b('0x32')][_0xc06b('0xa5')](_0xc06b('0x13e'));}var _0x364b65=_0xc06b('0x132');var _0x3823de=util[_0xc06b('0x25')](_0xc06b('0x13f'),FILES_PATH,rs[_0xc06b('0x11c')](0x4));var _0x4b8f43=util[_0xc06b('0x25')](_0xc06b('0x98'),_0x3823de,_0x364b65);var _0x2fa3ae=!![];if(_0x3f8658['beep']===_0xc06b('0x134')){_0x2fa3ae=![];}var _0x378f2d=this['channel']['recordFile'](_0x3823de,_0x364b65,_0x3f8658['intKey'],_0x3f8658[_0xc06b('0x63')],undefined,_0x2fa3ae);if(_0x378f2d[_0xc06b('0xa8')]!==-0x1){this[_0xc06b('0x32')][_0xc06b('0xa5')](util['format'](_0xc06b('0x140'),_0x4b8f43));var _0x1bd831=this[_0xc06b('0x8a')][_0xc06b('0xa0')](this,_0x3f8658,_0x4b8f43);if(_0x1bd831){for(var _0x47a80f in _0x1bd831){if(_0x1bd831[_0xc06b('0x8f')](_0x47a80f)){this['channel'][_0xc06b('0x99')](util[_0xc06b('0x25')](_0xc06b('0x141'),_0x47a80f[_0xc06b('0xeb')]()),_0x1bd831[_0x47a80f]);}}return this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0x142'),JSON[_0xc06b('0x6d')](_0x1bd831)));}}return _0x378f2d;};AGIVertices[_0xc06b('0xc')]['gotoc']=function(_0x1ca88f){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x143'),_0x1ca88f['label']));return this[_0xc06b('0x32')]['continueAt'](_0x1ca88f[_0xc06b('0x3a')],_0x1ca88f[_0xc06b('0x3b')],_0x1ca88f[_0xc06b('0x3c')]);};AGIVertices[_0xc06b('0xc')][_0xc06b('0x144')]=function(_0x523e49){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x145'),_0x523e49[_0xc06b('0x34')]));if(!this[_0xc06b('0x80')](_0x523e49[_0xc06b('0x146')])){return this['channel']['error'](_0x523e49,_0xc06b('0x147'));}try{var _0x2fb6d1=eval(_0x523e49['condition'])?'true':'false';this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0x148'),_0x523e49[_0xc06b('0x146')],_0x2fb6d1));return{'code':0xc8,'result':_0x2fb6d1};}catch(_0x2160be){return{'code':0xc8,'result':_0xc06b('0x149')};}};AGIVertices['prototype'][_0xc06b('0x14a')]=function(_0x18774c){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x14b'),_0x18774c[_0xc06b('0x34')]));if(!this[_0xc06b('0x80')](_0x18774c[_0xc06b('0x14c')])){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x18774c,_0xc06b('0x14d'));}var _0x1a7327=this[_0xc06b('0x14e')][_0xc06b('0xa0')](this,_0x18774c['interval_id']);if(!_0x1a7327){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x18774c,_0xc06b('0x14f'));}for(var _0x2af334=0x0;_0x2af334<_0x1a7327['length'];_0x2af334+=0x1){var _0x544359=this[_0xc06b('0x32')][_0xc06b('0x9c')](util[_0xc06b('0x25')]('IFTIME(%s?true:false)',_0x1a7327[_0x2af334]));if(_0x544359[_0xc06b('0xa8')]===-0x1){return _0x544359;}logger['info'](util[_0xc06b('0x25')](_0xc06b('0x150'),_0x1a7327[_0x2af334],_0x544359[_0xc06b('0x9f')]));if(_0x544359['extra']===_0xc06b('0x151')){logger[_0xc06b('0x28')](util[_0xc06b('0x25')]('IFTIME\x20%s\x20%s',_0x1a7327[_0x2af334],_0xc06b('0x151')));this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0x150'),_0x1a7327[_0x2af334],_0xc06b('0x151')));return{'code':0xc8,'result':'true'};}else{logger[_0xc06b('0x28')](util['format'](_0xc06b('0x150'),_0x1a7327[_0x2af334],'false'));this[_0xc06b('0x32')][_0xc06b('0xa5')](util['format'](_0xc06b('0x150'),_0x1a7327[_0x2af334],_0xc06b('0x149')));}}return{'code':0xc8,'result':_0xc06b('0x149')};};AGIVertices[_0xc06b('0xc')][_0xc06b('0x152')]=function(_0x956a0e){logger[_0xc06b('0x28')](util[_0xc06b('0x25')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x956a0e[_0xc06b('0x34')]));return this['channel'][_0xc06b('0x152')]();};AGIVertices[_0xc06b('0xc')][_0xc06b('0x153')]=function(_0x1102aa){logger[_0xc06b('0x28')](util[_0xc06b('0x25')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x1102aa[_0xc06b('0x34')]));if(!this[_0xc06b('0x80')](_0x1102aa[_0xc06b('0x74')])){return this[_0xc06b('0x32')]['noop'](_0xc06b('0xe8'));}var _0x101046=_0xc06b('0x132');var _0x377a74=util[_0xc06b('0x25')](_0xc06b('0x13f'),FILES_PATH,rs['generate'](0x4));var _0x1cf1fb=util[_0xc06b('0x25')](_0xc06b('0x98'),_0x377a74,_0x101046);var _0x4bd413=!![];if(_0x1102aa[_0xc06b('0x133')]==='NOBEEP'){_0x4bd413=![];}var _0x26167c=this[_0xc06b('0x32')][_0xc06b('0x135')](_0x377a74,_0x101046,_0x1102aa[_0xc06b('0x136')],_0x1102aa[_0xc06b('0x63')],undefined,_0x4bd413);if(_0x26167c['result']!==-0x1){this['channel']['noop'](util[_0xc06b('0x25')]('ispeech\x20%s\x20file\x20created',_0x1cf1fb));var _0x371199=this[_0xc06b('0x7e')][_0xc06b('0xa0')](this,_0x1102aa,_0x1cf1fb);if(_0x371199){for(var _0x53dfb4 in _0x371199){if(_0x371199['hasOwnProperty'](_0x53dfb4)){this['channel'][_0xc06b('0x99')](util[_0xc06b('0x25')](_0xc06b('0x154'),_0x53dfb4['toUpperCase']()),_0x371199[_0x53dfb4]);}}return this[_0xc06b('0x32')][_0xc06b('0xa5')](util['format'](_0xc06b('0x155'),JSON[_0xc06b('0x6d')](_0x371199)));}}return _0x26167c;};AGIVertices[_0xc06b('0xc')]['ispeechtts']=function(_0x9b8e7f){logger['info'](util[_0xc06b('0x25')](_0xc06b('0x156'),_0x9b8e7f['label']));if(!this[_0xc06b('0x80')](_0x9b8e7f[_0xc06b('0x74')])){return this[_0xc06b('0x32')][_0xc06b('0xa5')](_0xc06b('0xe8'));}if(!this[_0xc06b('0x80')](_0x9b8e7f['text'])){return this[_0xc06b('0x32')]['noop'](_0xc06b('0xc7'));}this[_0xc06b('0x32')]['noop'](util[_0xc06b('0x25')](_0xc06b('0x157'),_0x9b8e7f['text']));var _0x2a1287=this[_0xc06b('0x7b')][_0xc06b('0xa0')](this,_0x9b8e7f);if(_0x2a1287){this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')]('ispeech\x20%s\x20file\x20created',_0x2a1287));var _0x52a537=this[_0xc06b('0x32')][_0xc06b('0x101')](_0x2a1287,_0x9b8e7f[_0xc06b('0x136')]);try{fs[_0xc06b('0x102')](_0x2a1287+_0xc06b('0x103'));}catch(_0x4f055d){logger['error'](_0x4f055d);}return _0x52a537;}return this[_0xc06b('0x32')]['error'](_0x9b8e7f,_0xc06b('0x158'));};AGIVertices[_0xc06b('0xc')][_0xc06b('0x159')]=function(_0x1163ae){logger[_0xc06b('0x28')](util[_0xc06b('0x25')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x1163ae['label']));if(!this[_0xc06b('0x80')](_0x1163ae[_0xc06b('0x15a')])){return this['channel'][_0xc06b('0x2c')](_0x1163ae,_0xc06b('0x15b'));}logger[_0xc06b('0x28')](util['format'](_0xc06b('0x15c'),this['channel'][_0xc06b('0x37')],_0x1163ae[_0xc06b('0x15a')]));var _0x2b40b1=this[_0xc06b('0x4e')][_0xc06b('0xa0')](this,_0x1163ae['findBy']);if(_0x2b40b1){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x1163ae[_0xc06b('0x15a')]));this[_0xc06b('0x32')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xc06b('0x37')],_0x1163ae['findBy']));return{'code':0xc8,'result':_0xc06b('0x15d')};}else{logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x15e'),this[_0xc06b('0x32')]['callerid'],_0x1163ae['findBy']));this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0x15e'),this[_0xc06b('0x32')][_0xc06b('0x37')],_0x1163ae[_0xc06b('0x15a')]));return{'code':0xc8,'result':_0xc06b('0x15f')};}};AGIVertices[_0xc06b('0xc')]['logout']=function(_0x53aa20){logger['info'](util[_0xc06b('0x25')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x53aa20['label']));if(!this[_0xc06b('0x80')](_0x53aa20[_0xc06b('0x15a')])){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x53aa20,_0xc06b('0x15b'));}logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x15c'),this['channel'][_0xc06b('0x37')],_0x53aa20['findBy']));var _0x2b2f33=this['agentLogout'][_0xc06b('0xa0')](this,_0x53aa20['findBy']);if(_0x2b2f33){logger[_0xc06b('0x28')](util[_0xc06b('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc06b('0x32')][_0xc06b('0x37')],_0x53aa20[_0xc06b('0x15a')]));this[_0xc06b('0x32')]['noop'](util[_0xc06b('0x25')](_0xc06b('0x160'),this[_0xc06b('0x32')][_0xc06b('0x37')],_0x53aa20['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xc06b('0x25')](_0xc06b('0x15e'),this[_0xc06b('0x32')]['callerid'],_0x53aa20[_0xc06b('0x15a')]));this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xc06b('0x37')],_0x53aa20[_0xc06b('0x15a')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['math']=function(_0x5d0e3a){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x161'),_0x5d0e3a[_0xc06b('0x34')]));if(!this[_0xc06b('0x80')](_0x5d0e3a[_0xc06b('0x162')])){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x5d0e3a,_0xc06b('0x163'));}this['channel'][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0x164'),_0x5d0e3a['operation']));var _0x1d8922=eval(_0x5d0e3a[_0xc06b('0x162')]);if(!this[_0xc06b('0x80')](_0x5d0e3a[_0xc06b('0xd9')])){return this[_0xc06b('0x32')][_0xc06b('0xa5')](_0xc06b('0xda'));}var _0x480942=this[_0xc06b('0x9c')][_0xc06b('0xa0')](this,_0x5d0e3a[_0xc06b('0xd9')]);if(!_0x480942){return this['channel'][_0xc06b('0x2c')](_0x5d0e3a,_0xc06b('0x11a'));}if(_[_0xc06b('0x94')](_0x1d8922)){var _0x57c36a=this;_0x1d8922['forEach'](function(_0x1e7e27,_0x3a5e5c){_0x57c36a['channel'][_0xc06b('0x99')](util['format']('%s[%s]',_0x480942,_0x3a5e5c),_0x1e7e27);});return this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')]('variable\x20%s[key]\x20set',_0x480942));}else{return this['channel'][_0xc06b('0x99')](_0x480942,_0x1d8922);}};AGIVertices[_0xc06b('0xc')][_0xc06b('0xa')]=function(_0x2a65ff){logger[_0xc06b('0x28')](util[_0xc06b('0x25')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x2a65ff[_0xc06b('0x34')]));if(_0x2a65ff[_0xc06b('0xa1')]===0x0){return this[_0xc06b('0xa2')](_0x2a65ff);}_0x2a65ff[_0xc06b('0xa1')]-=0x1;if(!this[_0xc06b('0x80')](_0x2a65ff['file_id'])){return this['channel'][_0xc06b('0x2c')](_0x2a65ff,_0xc06b('0x110'));}var _0x1336a0=this[_0xc06b('0x111')]['sync'](this,_0x2a65ff['file_id']);if(!_0x1336a0){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x2a65ff,_0xc06b('0x113'));}var _0x3e6c39=this['channel'][_0xc06b('0x114')](_0x1336a0,_0x2a65ff['response'],_0x2a65ff[_0xc06b('0x165')]);var _0x1a1417=_0x3e6c39[_0xc06b('0xa8')];if(_0x3e6c39[_0xc06b('0xa8')]===-0x1){this[_0xc06b('0x31')][_0xc06b('0xa0')](this,_0x2a65ff,'-1');return _0x3e6c39;}else if(_0x3e6c39['extra']===_0xc06b('0x63')){_0x3e6c39[_0xc06b('0xa8')]=_0x3e6c39[_0xc06b('0xa8')][_0xc06b('0x95')]>0x0?_0x3e6c39[_0xc06b('0xa8')]:'t';}else if(_[_0xc06b('0x40')](_0x3e6c39[_0xc06b('0xa8')])){_0x3e6c39[_0xc06b('0xa8')]='#';_0x1a1417='#';}if(!this['isConfigured'](_0x2a65ff[_0xc06b('0xd9')])){this[_0xc06b('0x32')][_0xc06b('0xa5')](_0xc06b('0xda'));}else{var _0x30599c=this[_0xc06b('0x9c')][_0xc06b('0xa0')](this,_0x2a65ff['variable_id']);if(!_0x30599c){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x2a65ff,_0xc06b('0x11a'));}this[_0xc06b('0x32')][_0xc06b('0x99')](_0x30599c,_0x1a1417);}this['createSquareDetailsReport']['sync'](this,_0x2a65ff,_0x1a1417);return _0x3e6c39;};AGIVertices[_0xc06b('0xc')][_0xc06b('0xa5')]=function(_0x5cae30){logger['info'](util[_0xc06b('0x25')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x5cae30[_0xc06b('0x34')]));return this['channel'][_0xc06b('0xa5')](_0x5cae30['output']||_0x5cae30[_0xc06b('0x34')]);};AGIVertices[_0xc06b('0xc')][_0xc06b('0x166')]=function(_0x20de65){logger['info'](util[_0xc06b('0x25')](_0xc06b('0x167'),_0x20de65[_0xc06b('0x34')]));if(!this[_0xc06b('0x80')](_0x20de65[_0xc06b('0x15a')])){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x20de65,_0xc06b('0x15b'));}logger['info'](util[_0xc06b('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xc06b('0x37')],_0x20de65[_0xc06b('0x15a')]));var _0x18f6ba=this[_0xc06b('0x48')]['sync'](this,_0x20de65[_0xc06b('0x168')]);var _0x115ccd=this[_0xc06b('0x4a')]['sync'](this,_0x20de65['findBy'],_0x18f6ba);if(_0x115ccd){logger[_0xc06b('0x28')](util['format'](_0xc06b('0x160'),this['channel']['callerid'],_0x20de65[_0xc06b('0x15a')]));this['channel'][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0x160'),this[_0xc06b('0x32')][_0xc06b('0x37')],_0x20de65[_0xc06b('0x15a')]));return{'code':0xc8,'result':_0xc06b('0x15d')};}else{logger['info'](util[_0xc06b('0x25')](_0xc06b('0x15e'),this[_0xc06b('0x32')]['callerid'],_0x20de65[_0xc06b('0x15a')]));this['channel'][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0x160'),this[_0xc06b('0x32')][_0xc06b('0x37')],_0x20de65[_0xc06b('0x15a')]));return{'code':0xc8,'result':_0xc06b('0x15f')};}};AGIVertices[_0xc06b('0xc')][_0xc06b('0x169')]=function(_0x5c5ddc){logger[_0xc06b('0x28')](util['format'](_0xc06b('0x16a'),_0x5c5ddc['label']));if(!this[_0xc06b('0x80')](_0x5c5ddc[_0xc06b('0x112')])){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x5c5ddc,'no\x20file\x20audio\x20selected');}var _0x313f8d=this['getSound'][_0xc06b('0xa0')](this,_0x5c5ddc[_0xc06b('0x112')]);if(!_0x313f8d){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x5c5ddc,_0xc06b('0x113'));}var _0x2025a7=this[_0xc06b('0x32')][_0xc06b('0x52')](_0xc06b('0x16b'),[_0x313f8d,_0x5c5ddc[_0xc06b('0xe6')]]);if(_0x2025a7['result']===-0x1){return _0x2025a7;}return this[_0xc06b('0x32')][_0xc06b('0xa5')](util['format']('Executed\x20command\x20%s\x20%s',_0xc06b('0x16b'),_0x313f8d));};AGIVertices[_0xc06b('0xc')][_0xc06b('0x16c')]=function(_0x213fd7){logger[_0xc06b('0x28')](util[_0xc06b('0x25')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x213fd7[_0xc06b('0x34')]));if(!this[_0xc06b('0x80')](_0x213fd7[_0xc06b('0x16d')])){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x213fd7,_0xc06b('0x16e'));}var _0x382d0d='';var _0x4f15ed=parseInt(_0x213fd7[_0xc06b('0x16d')],0xa);if(isNaN(_0x4f15ed)){_0x382d0d=_0x213fd7[_0xc06b('0x16d')];}else{_0x382d0d=this['getVoiceQueue'][_0xc06b('0xa0')](this,_0x213fd7[_0xc06b('0x16d')]);if(!_0x382d0d){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x213fd7,_0xc06b('0x16f'));}}var _0x54d2bf='';if(this['isConfigured'](_0x213fd7['file_id'])){var _0x2ad93b=this[_0xc06b('0x111')]['sync'](this,_0x213fd7[_0xc06b('0x112')]);if(_0x2ad93b){_0x54d2bf=_0x2ad93b;}}this[_0xc06b('0x31')]['sync'](this,_0x213fd7,_0x382d0d);if(_0x213fd7['opts'][_0xc06b('0x170')]('x')<0x0){_0x213fd7[_0xc06b('0xe6')]+='x';}if(_0x213fd7[_0xc06b('0xe6')][_0xc06b('0x170')]('X')<0x0){_0x213fd7[_0xc06b('0xe6')]+='X';}this[_0xc06b('0x32')]['setVariable'](_0xc06b('0x171'),_0x382d0d?_0x382d0d[_0xc06b('0x172')]():'');var _0x37ba5b=this[_0xc06b('0x32')]['exec'](_0xc06b('0x173'),[_0x382d0d,_0x213fd7['opts'],_0x213fd7[_0xc06b('0x60')],_0x54d2bf,_0x213fd7['timeout'],_0x213fd7[_0xc06b('0xb5')],_0x213fd7[_0xc06b('0x174')],_0x213fd7[_0xc06b('0x175')],'',_0x213fd7[_0xc06b('0x176')]]);if(_0x37ba5b[_0xc06b('0xa8')]===-0x1){return _0x37ba5b;}return this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0xc4'),_0xc06b('0x173'),_0x382d0d));};AGIVertices[_0xc06b('0xc')][_0xc06b('0x177')]=function(_0x22f935){logger[_0xc06b('0x28')](util['format'](_0xc06b('0x178'),_0x22f935[_0xc06b('0x34')]));var _0x2f7a9d=_0x22f935['recordingFormat']||_0xc06b('0x132');var _0x7ed4d5=util[_0xc06b('0x25')](_0xc06b('0x179'),this[_0xc06b('0x32')][_0xc06b('0x33')],rs[_0xc06b('0x11c')](0x5));var _0x523247=util[_0xc06b('0x25')](_0xc06b('0x17a'),FILES_PATH,_0x7ed4d5,_0x2f7a9d);var _0x2875ef=util[_0xc06b('0x25')](_0xc06b('0x13f'),FILES_PATH,_0x7ed4d5);this[_0xc06b('0x38')][_0xc06b('0xa0')](this,_0x22f935,_0x7ed4d5,_0x523247);this[_0xc06b('0x32')][_0xc06b('0x99')](_0xc06b('0x17b'),_0x7ed4d5);logger[_0xc06b('0x28')](_0xc06b('0x17c'),_0x2875ef,_0x2f7a9d,_0x22f935[_0xc06b('0x17d')],_0x22f935[_0xc06b('0x63')]);return this[_0xc06b('0x32')][_0xc06b('0x135')](_0x2875ef,_0x2f7a9d,_0x22f935[_0xc06b('0x17d')],_0x22f935[_0xc06b('0x63')],undefined,!![]);};AGIVertices[_0xc06b('0xc')][_0xc06b('0x17e')]=function(_0x3b7a0b){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x17f'),_0x3b7a0b[_0xc06b('0x34')]));if(!this['isConfigured'](_0x3b7a0b[_0xc06b('0x60')])){return this['channel']['noop'](_0xc06b('0x180'));}var _0x29f49d=this[_0xc06b('0x5f')]['sync'](this,_0x3b7a0b);logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x181'),util['inspect'](_0x29f49d,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x3b7a0b['variable_id'])){return this['channel'][_0xc06b('0xa5')](_0xc06b('0x182'));}var _0x4bce96=this[_0xc06b('0x9c')][_0xc06b('0xa0')](this,_0x3b7a0b[_0xc06b('0xd9')]);if(!_0x4bce96){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x3b7a0b,_0xc06b('0x11a'));}this[_0xc06b('0x32')]['setVariable'](util[_0xc06b('0x25')](_0xc06b('0x183'),_0x4bce96),_0x29f49d[_0xc06b('0x70')]?_0x29f49d[_0xc06b('0x70')]:_0xc06b('0x184'));this[_0xc06b('0x32')]['setVariable'](util[_0xc06b('0x25')](_0xc06b('0x185'),_0x4bce96),_0x29f49d['statusMessage']?_0x29f49d[_0xc06b('0x71')]:'OK');if(_0x29f49d[_0xc06b('0x6e')]){try{this[_0xc06b('0x97')](_0x29f49d[_0xc06b('0x6e')],_0x4bce96);}catch(_0x1696bc){logger[_0xc06b('0x2c')](util[_0xc06b('0x25')](_0xc06b('0x186'),_0x4bce96));}}return this['channel'][_0xc06b('0xa5')](util['format'](_0xc06b('0xdf'),_0x4bce96));};AGIVertices[_0xc06b('0xc')][_0xc06b('0x187')]=function(_0x5edda4){logger['info'](util['format'](_0xc06b('0x188'),_0x5edda4['label']));return this[_0xc06b('0x32')][_0xc06b('0x189')](_0x5edda4[_0xc06b('0x18a')][_0xc06b('0x54')](/\s+/g,''),_0x5edda4[_0xc06b('0x17d')]);};AGIVertices[_0xc06b('0xc')][_0xc06b('0x18b')]=function(_0x9bd66c){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x18c'),_0x9bd66c[_0xc06b('0x34')]));return this['channel'][_0xc06b('0x18d')](_0x9bd66c[_0xc06b('0x62')][_0xc06b('0x54')](/\s+/g,''),_0x9bd66c[_0xc06b('0x17d')]);};AGIVertices[_0xc06b('0xc')][_0xc06b('0x18e')]=function(_0x20c4a5){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x18f'),_0x20c4a5['label']));return this[_0xc06b('0x32')][_0xc06b('0x190')](_0x20c4a5[_0xc06b('0x58')],_0x20c4a5['escape_digits']);};AGIVertices[_0xc06b('0xc')][_0xc06b('0x191')]=function(_0x396dc7){logger[_0xc06b('0x28')](util[_0xc06b('0x25')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x396dc7[_0xc06b('0x34')]));if(!this[_0xc06b('0x80')](_0x396dc7[_0xc06b('0x192')])){return this[_0xc06b('0x32')][_0xc06b('0xa5')](_0xc06b('0x193'));}var _0x288724=this[_0xc06b('0x194')][_0xc06b('0xa0')](this,_0x396dc7[_0xc06b('0x192')]);if(!_0x288724||!_0x288724['Smtp']){return this['channel'][_0xc06b('0x2c')](_0x396dc7,'no\x20mail\x20account\x20found');}var _0x5e7802={'from':util['format'](_0xc06b('0x195'),_0x288724['name'],_0x288724[_0xc06b('0x196')]||_0x288724[_0xc06b('0x197')][_0xc06b('0x198')]),'to':_0x396dc7['to']||'','cc':_0x396dc7['cc']||'','bcc':_0x396dc7['bcc']||'','subject':_0x396dc7['subject'],'html':_0x396dc7[_0xc06b('0x58')],'text':_0x396dc7[_0xc06b('0x58')]};var _0x2846ec={'tls':{'rejectUnauthorized':![]}};if(_0x288724['Smtp'][_0xc06b('0x199')]){_0x2846ec[_0xc06b('0x199')]=_0x288724[_0xc06b('0x197')]['service'];}else{_0x2846ec['host']=_0x288724[_0xc06b('0x197')][_0xc06b('0x19a')];_0x2846ec['port']=_0x288724[_0xc06b('0x197')][_0xc06b('0x19b')];_0x2846ec[_0xc06b('0x19c')]=_0x288724[_0xc06b('0x197')][_0xc06b('0x19c')];}if(_0x288724[_0xc06b('0x197')][_0xc06b('0x19d')]){_0x2846ec['auth']={'user':_0x288724[_0xc06b('0x197')]['user'],'pass':_0x288724[_0xc06b('0x197')]['pass']};}if(this[_0xc06b('0x80')](_0x396dc7['template_id'])){}logger['debug']('sendMail\x20message',JSON[_0xc06b('0x6d')](_0x5e7802));this[_0xc06b('0x31')][_0xc06b('0xa0')](this,_0x396dc7,_0x396dc7[_0xc06b('0x192')]);this['channel'][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0x19e'),_0x288724[_0xc06b('0x10')]));this[_0xc06b('0x19f')][_0xc06b('0xa0')](this,_0x2846ec,_0x5e7802);return this[_0xc06b('0x32')]['noop'](_0xc06b('0x1a0'));};AGIVertices[_0xc06b('0xc')][_0xc06b('0x1a1')]=function(_0x585a1d){logger[_0xc06b('0x28')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x585a1d[_0xc06b('0x34')]));return this[_0xc06b('0x32')][_0xc06b('0xa5')](_0xc06b('0x1a2'));};AGIVertices['prototype'][_0xc06b('0x1a3')]=function(_0x286bf6){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x1a4'),_0x286bf6[_0xc06b('0x34')]));if(!this[_0xc06b('0x80')](_0x286bf6[_0xc06b('0x1a5')])){return this[_0xc06b('0x32')][_0xc06b('0xa5')](_0xc06b('0x1a6'));}var _0x32d42f=this[_0xc06b('0x2e')][_0xc06b('0xa0')](this,_0x286bf6[_0xc06b('0x1a5')]);if(!_0x32d42f){return this['channel'][_0xc06b('0x2c')](_0x286bf6,_0xc06b('0x1a7'));}var _0x2911f6={'body':_0x286bf6[_0xc06b('0x1a8')],'phone':_0x286bf6['to']||'','SmsAccountId':_0x32d42f['id']};logger[_0xc06b('0xe0')](_0xc06b('0x1a9'),JSON[_0xc06b('0x6d')](_0x2911f6));this['createSquareDetailsReport'][_0xc06b('0xa0')](this,_0x286bf6,_0x286bf6[_0xc06b('0x1a5')]);this[_0xc06b('0x32')]['noop'](util[_0xc06b('0x25')](_0xc06b('0x1aa'),_0x32d42f[_0xc06b('0x10')]));this[_0xc06b('0x30')][_0xc06b('0xa0')](this,_0x2911f6);return this[_0xc06b('0x32')][_0xc06b('0xa5')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xc06b('0xc')][_0xc06b('0x1ab')]=function(_0x44e5ce){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x1ac'),_0x44e5ce[_0xc06b('0x34')]));if(!this['isConfigured'](_0x44e5ce[_0xc06b('0xd9')])){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x44e5ce,_0xc06b('0x1ad'));}var _0x3465b0=this[_0xc06b('0x9c')][_0xc06b('0xa0')](this,_0x44e5ce[_0xc06b('0xd9')]);if(!_0x3465b0){return this[_0xc06b('0x32')]['error'](_0x44e5ce,_0xc06b('0x11a'));}return this[_0xc06b('0x32')][_0xc06b('0x99')](_0x3465b0,_0x44e5ce['variable_value']);};AGIVertices['prototype'][_0xc06b('0x1ae')]=function(_0x2a81df){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x1af'),_0x2a81df[_0xc06b('0x34')]));this['channel'][_0xc06b('0xa5')](_0xc06b('0x1b0'));if(_0x2a81df[_0xc06b('0xba')]===_0xc06b('0x1b1')){this[_0xc06b('0x32')][_0xc06b('0xa5')](_0xc06b('0x1b2'));return this[_0xc06b('0x32')]['answer']();}return this[_0xc06b('0x32')]['noop'](_0xc06b('0x1b3'));};AGIVertices['prototype']['subproject']=function(_0x428e8e){logger['info'](util[_0xc06b('0x25')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x428e8e[_0xc06b('0x34')]));if(!this[_0xc06b('0x80')](_0x428e8e['project_id'])){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x428e8e,_0xc06b('0x1b4'));}var _0x4a2238=this[_0xc06b('0x14')][_0xc06b('0xa0')](this,_0x428e8e[_0xc06b('0x1b5')]);if(!this['isConfigured'](_0x4a2238)){return this['channel']['error'](_0x428e8e,util[_0xc06b('0x25')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x428e8e[_0xc06b('0x1b5')]));}if(_0x4a2238===this[_0xc06b('0x32')][_0xc06b('0x36')]){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x428e8e,_0xc06b('0x1b6'));}this[_0xc06b('0x31')][_0xc06b('0xa0')](this,_0x428e8e,_0x4a2238);var _0x56d711=this['channel'][_0xc06b('0x52')](_0xc06b('0x1b7'),util['format'](_0xc06b('0x1b8'),config[_0xc06b('0xb5')][_0xc06b('0x19a')]||_0xc06b('0x1b9'),_0x4a2238,this['channel'][_0xc06b('0x36')]));if(_0x56d711[_0xc06b('0xa8')]===-0x1){return _0x56d711;}return this[_0xc06b('0x32')]['noop'](util[_0xc06b('0x25')](_0xc06b('0xc4'),_0xc06b('0x1b7'),_0x4a2238));};AGIVertices[_0xc06b('0xc')][_0xc06b('0x1ba')]=function(_0x26462d){logger['info'](util[_0xc06b('0x25')](_0xc06b('0x1bb'),_0x26462d[_0xc06b('0x34')]));var _0x437ab6=this[_0xc06b('0x51')][_0xc06b('0xa0')](this,_0x26462d[_0xc06b('0xb6')]);this[_0xc06b('0x31')][_0xc06b('0xa0')](this,_0x26462d,_0x26462d[_0xc06b('0xb6')]);if(this['isConfigured'](_0x26462d[_0xc06b('0xd9')])){var _0x3cb776=this[_0xc06b('0x9c')][_0xc06b('0xa0')](this,_0x26462d[_0xc06b('0xd9')]);if(_0x3cb776){this[_0xc06b('0x32')]['setVariable'](_0x3cb776,_0x437ab6);return this[_0xc06b('0x32')]['noop'](util[_0xc06b('0x25')](_0xc06b('0x1bc'),_0x26462d[_0xc06b('0xb6')],_0x3cb776));}}return this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0x1bd'),_0x26462d[_0xc06b('0xb6')]));};AGIVertices['prototype'][_0xc06b('0x1be')]=function(_0x50c408){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x1bf'),_0x50c408[_0xc06b('0x34')]));_0x50c408['text']=_0x50c408[_0xc06b('0x58')][_0xc06b('0x54')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc06b('0x80')](_0x50c408[_0xc06b('0x56')])){return this[_0xc06b('0x32')][_0xc06b('0xa5')](_0xc06b('0x1c0'));}if(!this[_0xc06b('0x80')](_0x50c408[_0xc06b('0x58')])){return this[_0xc06b('0x32')][_0xc06b('0xa5')](_0xc06b('0xc7'));}this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0x1c1'),_0x50c408[_0xc06b('0x58')]));var _0x416eb6=this[_0xc06b('0x55')][_0xc06b('0xa0')](this,_0x50c408);if(_0x416eb6){this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0x1c2'),_0x416eb6));var _0x53eba2=this[_0xc06b('0x32')][_0xc06b('0x101')](_0x416eb6);try{fs[_0xc06b('0x102')](_0x416eb6+_0xc06b('0x103'));}catch(_0x4c6e46){logger[_0xc06b('0x2c')](_0x4c6e46);}return _0x53eba2;}return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x50c408,_0xc06b('0x1c3'));};AGIVertices['prototype'][_0xc06b('0x1c4')]=function(_0x289439){logger['info'](util['format'](_0xc06b('0x1c5'),_0x289439[_0xc06b('0x34')]));_0x289439[_0xc06b('0x58')]=_0x289439[_0xc06b('0x58')][_0xc06b('0x54')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc06b('0x80')](_0x289439['text'])){return this['channel']['noop'](_0xc06b('0xc7'));}this['channel']['noop'](util['format'](_0xc06b('0x1c6'),_0x289439['text']));var _0x833a13=this[_0xc06b('0x5d')][_0xc06b('0xa0')](this,_0x289439);if(_0x833a13){this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0x1c7'),_0x833a13));var _0x40d7de=this['channel'][_0xc06b('0x101')](_0x833a13);try{fs[_0xc06b('0x102')](_0x833a13+_0xc06b('0x103'));}catch(_0x4d7b43){logger['error'](_0x4d7b43);}return _0x40d7de;}return this['channel'][_0xc06b('0x2c')](_0x289439,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xc06b('0xc')][_0xc06b('0x1c8')]=function(_0x264a56){logger[_0xc06b('0x28')](util[_0xc06b('0x25')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x264a56[_0xc06b('0x34')]));if(!this[_0xc06b('0x80')](_0x264a56[_0xc06b('0x15a')])){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x264a56,'no\x20find\x20by\x20configured');}logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x15c'),this['channel'][_0xc06b('0x37')],_0x264a56[_0xc06b('0x15a')]));var _0x135ecf=this[_0xc06b('0x4c')][_0xc06b('0xa0')](this,_0x264a56[_0xc06b('0x15a')]);if(_0x135ecf){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x160'),this[_0xc06b('0x32')][_0xc06b('0x37')],_0x264a56[_0xc06b('0x15a')]));this['channel'][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0x160'),this['channel'][_0xc06b('0x37')],_0x264a56[_0xc06b('0x15a')]));return{'code':0xc8,'result':_0xc06b('0x15d')};}else{logger['info'](util[_0xc06b('0x25')](_0xc06b('0x15e'),this[_0xc06b('0x32')][_0xc06b('0x37')],_0x264a56[_0xc06b('0x15a')]));this[_0xc06b('0x32')][_0xc06b('0xa5')](util[_0xc06b('0x25')](_0xc06b('0x15e'),this[_0xc06b('0x32')][_0xc06b('0x37')],_0x264a56[_0xc06b('0x15a')]));return{'code':0xc8,'result':_0xc06b('0x15f')};}};AGIVertices[_0xc06b('0xc')][_0xc06b('0x1c9')]=function(_0x4712c7){logger[_0xc06b('0x28')](util[_0xc06b('0x25')](_0xc06b('0x1ca'),_0x4712c7[_0xc06b('0x34')]));var _0x53b9e9=this[_0xc06b('0x32')][_0xc06b('0x52')](_0xc06b('0x1cb'),[_0x4712c7['mailbox'],_0x4712c7[_0xc06b('0xa6')]]);if(_0x53b9e9['result']===-0x1){return _0x53b9e9;}return this['channel']['noop'](util['format'](_0xc06b('0xc4'),_0xc06b('0x1cb'),_0x4712c7[_0xc06b('0x1cc')]));};AGIVertices[_0xc06b('0xc')]['vswitch']=function(_0x37982a){logger[_0xc06b('0x28')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x37982a[_0xc06b('0x34')]));if(!this['isConfigured'](_0x37982a['variable_id'])){return this['channel'][_0xc06b('0x2c')](_0x37982a,_0xc06b('0x1ad'));}var _0x152f28=this['getVariable'][_0xc06b('0xa0')](this,_0x37982a[_0xc06b('0xd9')]);if(!_0x152f28){return this[_0xc06b('0x32')][_0xc06b('0x2c')](_0x37982a,_0xc06b('0x11a'));}var _0x8dc8f2=this['channel'][_0xc06b('0x9c')](_0x152f28);return{'code':0xc8,'result':_0x8dc8f2[_0xc06b('0x9f')]?_0x8dc8f2[_0xc06b('0x9f')]:'-'};};String['prototype'][_0xc06b('0x9b')]=function(_0x4a4047,_0x237c3c){return this['split'](_0x4a4047)[_0xc06b('0x1cd')](_0x237c3c);};module[_0xc06b('0x1ce')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index c025d08..cb5b501 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 _0xb821=['[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','acw','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','diff','seconds','startAcw','interface','ACW','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','getAgent','then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[ACW][START]\x20%s','prototype','[TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid'];(function(_0x23a79e,_0x235f89){var _0x3dab57=function(_0x346cf4){while(--_0x346cf4){_0x23a79e['push'](_0x23a79e['shift']());}};_0x3dab57(++_0x235f89);}(_0xb821,0xa7));var _0x1b82=function(_0x3e9a68,_0x10df95){_0x3e9a68=_0x3e9a68-0x0;var _0x464f8a=_0xb821[_0x3e9a68];return _0x464f8a;};'use strict';var util=require('util');var _=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var ami=require('../ami');var logger=require('../../../config/logger')(_0x1b82('0x2'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x3b1d14){this[_0x1b82('0x3')]=_0x3b1d14[_0x1b82('0x3')];this[_0x1b82('0x4')]=_0x3b1d14['agents'];this[_0x1b82('0x5')]=_0x3b1d14[_0x1b82('0x5')];this[_0x1b82('0x6')]={};ami['on'](_0x1b82('0x7'),this[_0x1b82('0x8')][_0x1b82('0x9')](this));ami['on'](_0x1b82('0xa'),this[_0x1b82('0xb')][_0x1b82('0x9')](this));ami['on']('hangup',this[_0x1b82('0xc')][_0x1b82('0x9')](this));ami['on'](_0x1b82('0xd'),this[_0x1b82('0xe')][_0x1b82('0x9')](this));ami['on'](_0x1b82('0xf'),this[_0x1b82('0x10')][_0x1b82('0x9')](this));ami['on']('blindtransfer',this[_0x1b82('0x11')][_0x1b82('0x9')](this));ami['on'](_0x1b82('0x12'),this[_0x1b82('0x13')]['bind'](this));}function getDiff(_0x1a6285){var _0x5767aa=moment()['milliseconds'](0x0);var _0x1e553a=moment(_0x1a6285)['milliseconds'](0x0);return _0x5767aa[_0x1b82('0x14')](_0x1e553a,_0x1b82('0x15'));}Acw['prototype'][_0x1b82('0x16')]=function(_0x5dab7d){try{var _0x563261=this;var _0x1b115b=this['channels'][_0x5dab7d][_0x1b82('0x17')];var _0x25228b=this[_0x1b82('0x6')][_0x5dab7d]['queue'];var _0x514082=this[_0x1b82('0x3')][_0x25228b];var _0x5d66c3=![];var _0x3def2d=_0x1b82('0x18');if(_0x514082[_0x1b82('0x19')]){if(_0x514082['mandatoryDispositionPause'][_0x1b82('0x1a')]){_0x5d66c3=!![];_0x3def2d=_0x514082[_0x1b82('0x1b')][_0x1b82('0x1a')];}}ami[_0x1b82('0x1c')]({'action':_0x1b82('0x1d'),'interface':_0x1b115b,'paused':!![],'reason':_0x3def2d})['then'](function(_0x35a2c8){if(_0x563261[_0x1b82('0x4')][_0x1b115b]){return RpcUser[_0x1b82('0x1e')](_0x563261[_0x1b82('0x4')][_0x1b115b]['id'])[_0x1b82('0x1f')](function(_0x31fd64){if(_0x31fd64&&!_0x31fd64[_0x1b82('0x20')]){logger['info'](_0x1b82('0x21'),_0x5dab7d,_0x1b115b,_0x25228b);var _0x233740=_0x563261['channels'][_0x5dab7d][_0x1b82('0x22')]&&_0x563261[_0x1b82('0x6')][_0x5dab7d][_0x1b82('0x23')]?_0x563261['channels'][_0x5dab7d][_0x1b82('0x23')]:_0x5dab7d;return RpcUser['savePause'](_0x563261['agents'][_0x1b115b],_0x3def2d,_0x233740)['then'](function(_0xf2e556){if(!_0x5d66c3){_0x563261[_0x1b82('0x5')][_0x1b115b]={};logger[_0x1b82('0x24')](_0x1b82('0x25'),_0x5dab7d,_0x563261['voiceQueues'][_0x25228b][_0x1b82('0x26')],_0x1b115b,_0x25228b);_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x27')]=setTimeout(_0x563261[_0x1b82('0x28')][_0x1b82('0x9')](_0x563261,_0x1b115b),_0x563261[_0x1b82('0x3')][_0x25228b][_0x1b82('0x26')]*0x3e8);_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x29')]=moment()[_0x1b82('0x2a')](_0x1b82('0x2b'));_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x2c')]=_0x5dab7d;_0x563261['timers'][_0x1b115b][_0x1b82('0x2d')]=_0x25228b;_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x2e')]=function(){var _0x457dbb=getDiff(_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x29')]);clearTimeout(_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x27')]);_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x27')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x457dbb},_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x2c')],_0x1b115b)[_0x1b82('0x1f')](function(_0xc98ee2){logger['info'](_0x1b82('0x2f'),_0x5dab7d,_0x457dbb,_0xc98ee2);})[_0x1b82('0x30')](function(_0x544bd5){logger[_0x1b82('0x31')](_0x1b82('0x32'),_0x5dab7d,_0x544bd5);});delete _0x563261[_0x1b82('0x5')][_0x1b115b];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x5dab7d,_0x1b115b,_0x25228b);}});}})[_0x1b82('0x30')](function(_0x4c98e0){logger['error'](_0x1b82('0x25'),_0x5dab7d,_0x563261[_0x1b82('0x3')][_0x25228b][_0x1b82('0x26')],_0x1b115b,_0x25228b);})['finally'](function(){delete _0x563261[_0x1b82('0x6')][_0x5dab7d];});}catch(_0x366db3){logger[_0x1b82('0x31')](_0x1b82('0x33'),_0x366db3['message']);}};Acw[_0x1b82('0x34')][_0x1b82('0x28')]=function(_0x2ee9ac){try{var _0x5ebf6c=this;if(_0x5ebf6c['timers'][_0x2ee9ac]){_0x5ebf6c[_0x1b82('0x5')][_0x2ee9ac]['timer']=![];var _0x1d3e68=_0x5ebf6c[_0x1b82('0x5')][_0x2ee9ac][_0x1b82('0x2c')];var _0x348880=_0x5ebf6c[_0x1b82('0x5')][_0x2ee9ac][_0x1b82('0x2d')];var _0x39fe4a=_0x5ebf6c[_0x1b82('0x3')][_0x348880]['acwTimeout'];logger['info'](_0x1b82('0x35'),_0x2ee9ac);RpcUser['saveUnpause'](this[_0x1b82('0x4')][_0x2ee9ac]);RpcVoiceAgentReport['update']({'acwtime':_0x39fe4a,'agentacw':!![]},_0x1d3e68,_0x2ee9ac)[_0x1b82('0x1f')](function(_0x331379){logger[_0x1b82('0x24')](_0x1b82('0x2f'),_0x1d3e68,_0x39fe4a,_0x331379);})[_0x1b82('0x30')](function(_0x202bb4){logger['error'](_0x1b82('0x32'),_0x1d3e68,_0x202bb4);});}else{logger['error'](_0x1b82('0x36'),_0x2ee9ac);if(_0x5ebf6c['timers']){logger[_0x1b82('0x24')]('[ACW][TIMERS]',JSON['stringify'](_0x5ebf6c[_0x1b82('0x5')]));}}}catch(_0x388d14){logger[_0x1b82('0x31')](_0x1b82('0x37'),_0x388d14[_0x1b82('0x38')]);}};Acw['prototype'][_0x1b82('0x8')]=function(_0x4ffa9e){try{if(this[_0x1b82('0x3')][_0x4ffa9e[_0x1b82('0x2d')]]&&(this[_0x1b82('0x3')][_0x4ffa9e[_0x1b82('0x2d')]][_0x1b82('0x2')]||this['voiceQueues'][_0x4ffa9e[_0x1b82('0x2d')]]['mandatoryDisposition'])){if(this[_0x1b82('0x4')][_0x4ffa9e[_0x1b82('0x17')]]){this['channels'][_0x4ffa9e[_0x1b82('0x2c')]]={'queue':_0x4ffa9e[_0x1b82('0x2d')],'interface':_0x4ffa9e[_0x1b82('0x17')],'destlinkedid':_0x4ffa9e[_0x1b82('0x23')]};}}}catch(_0x39f6ef){logger[_0x1b82('0x31')](_0x1b82('0x39'),_0x39f6ef['message']);}};Acw[_0x1b82('0x34')]['syncAgentConnectPreview']=function(_0xb02ec3){try{if(this[_0x1b82('0x3')][_0xb02ec3[_0x1b82('0x2d')]]&&(this[_0x1b82('0x3')][_0xb02ec3[_0x1b82('0x2d')]][_0x1b82('0x2')]||this[_0x1b82('0x3')][_0xb02ec3[_0x1b82('0x2d')]][_0x1b82('0x19')])){if(this[_0x1b82('0x4')][_0xb02ec3[_0x1b82('0x17')]]){this[_0x1b82('0x6')][_0xb02ec3[_0x1b82('0x2c')]]={'queue':_0xb02ec3[_0x1b82('0x2d')],'interface':_0xb02ec3['interface']};}}}catch(_0x59afed){logger[_0x1b82('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x59afed[_0x1b82('0x38')]);}};Acw[_0x1b82('0x34')][_0x1b82('0xb')]=function(_0x5710f4){try{if(this[_0x1b82('0x6')][_0x5710f4['uniqueid']]&&_['isUndefined'](this[_0x1b82('0x6')][_0x5710f4[_0x1b82('0x2c')]][_0x1b82('0x22')])){logger['info'](_0x1b82('0x3a'),_0x5710f4[_0x1b82('0x2c')]);this['startAcw'](_0x5710f4['uniqueid']);}else if(this[_0x1b82('0x6')][_0x5710f4[_0x1b82('0x3b')]]&&_[_0x1b82('0x3c')](this['channels'][_0x5710f4[_0x1b82('0x3b')]][_0x1b82('0x22')])){logger[_0x1b82('0x24')](_0x1b82('0x3d'),_0x5710f4[_0x1b82('0x3b')]);this[_0x1b82('0x16')](_0x5710f4['linkedid']);}}catch(_0x3914aa){logger['error'](_0x1b82('0x3e'),_0x3914aa[_0x1b82('0x38')]);}};Acw['prototype'][_0x1b82('0xc')]=function(_0x5de11b){try{if(this[_0x1b82('0x6')][_0x5de11b[_0x1b82('0x2c')]]&&this[_0x1b82('0x6')][_0x5de11b[_0x1b82('0x2c')]][_0x1b82('0x22')]){logger[_0x1b82('0x24')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5de11b['uniqueid']);this[_0x1b82('0x16')](_0x5de11b[_0x1b82('0x2c')]);}else if(this[_0x1b82('0x6')][_0x5de11b[_0x1b82('0x3b')]]&&this[_0x1b82('0x6')][_0x5de11b[_0x1b82('0x3b')]][_0x1b82('0x22')]){logger[_0x1b82('0x24')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x5de11b['linkedid']);this['startAcw'](_0x5de11b[_0x1b82('0x3b')]);}}catch(_0x2a95d2){logger[_0x1b82('0x31')](_0x1b82('0x3f'),_0x2a95d2[_0x1b82('0x38')]);}};Acw[_0x1b82('0x34')][_0x1b82('0x10')]=function(_0x53f7a4){try{if(!_[_0x1b82('0x40')](this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x41')]])){this[_0x1b82('0x16')](_0x53f7a4[_0x1b82('0x41')]);if(this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x42')]]){this[_0x1b82('0x6')][_0x53f7a4['secondtransfereruniqueid']][_0x1b82('0x22')]=!![];this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x43')]]=this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x42')]];delete this['channels'][_0x53f7a4['secondtransfereruniqueid']];}}else if(!_[_0x1b82('0x40')](this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x43')]])){this[_0x1b82('0x16')](_0x53f7a4['transfertargetuniqueid']);if(this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x44')]]){this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x44')]][_0x1b82('0x22')]=!![];this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x41')]]=this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x44')]];delete this[_0x1b82('0x6')][_0x53f7a4['origtransfereruniqueid']];}}}catch(_0xde1d73){logger[_0x1b82('0x31')]('[ACW][syncAttendedTransfer]\x20%s',_0xde1d73[_0x1b82('0x38')]);}};Acw[_0x1b82('0x34')][_0x1b82('0x11')]=function(_0x2a5435){try{if(this['channels'][_0x2a5435[_0x1b82('0x45')]]){logger[_0x1b82('0x24')](_0x1b82('0x46'),JSON[_0x1b82('0x47')](_0x2a5435[_0x1b82('0x45')]));this[_0x1b82('0x16')](_0x2a5435['transfereruniqueid']);}else if(this[_0x1b82('0x6')][_0x2a5435['transfererlinkedid']]){logger[_0x1b82('0x24')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x1b82('0x47')](_0x2a5435[_0x1b82('0x48')]));this[_0x1b82('0x16')](_0x2a5435[_0x1b82('0x48')]);}}catch(_0x412073){logger[_0x1b82('0x31')](_0x1b82('0x49'),_0x412073['message']);}};Acw[_0x1b82('0x34')][_0x1b82('0xe')]=function(_0x1435a2){try{if(this[_0x1b82('0x3')][_0x1435a2[_0x1b82('0x2d')]]&&this[_0x1b82('0x3')][_0x1435a2[_0x1b82('0x2d')]][_0x1b82('0x4a')]===_0x1b82('0x4b')){if(this[_0x1b82('0x4')][_0x1435a2[_0x1b82('0x17')]]){logger[_0x1b82('0x24')](_0x1b82('0x4c'),_0x1435a2['uniqueid'],_0x1435a2[_0x1b82('0x17')],_0x1435a2[_0x1b82('0x2d')]);return RpcUser[_0x1b82('0x4d')](this['agents'][_0x1435a2[_0x1b82('0x17')]],_0x1b82('0x4e'),_0x1435a2['uniqueid']);}}}catch(_0x3bf106){logger[_0x1b82('0x31')](_0x1b82('0x4f'),_0x3bf106['message']);}};module['exports']=Acw; \ No newline at end of file +var _0x2d17=['catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','queue','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','util','lodash','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','channels','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','then','info','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','uniqueid'];(function(_0x854478,_0x3f20e2){var _0x5e774b=function(_0x406d48){while(--_0x406d48){_0x854478['push'](_0x854478['shift']());}};_0x5e774b(++_0x3f20e2);}(_0x2d17,0x17e));var _0x72d1=function(_0x3411c8,_0x294ad5){_0x3411c8=_0x3411c8-0x0;var _0x3865e5=_0x2d17[_0x3411c8];return _0x3865e5;};'use strict';var util=require(_0x72d1('0x0'));var _=require(_0x72d1('0x1'));var moment=require('moment');var ami=require(_0x72d1('0x2'));var logger=require(_0x72d1('0x3'))('acw');var RpcUser=require(_0x72d1('0x4'));var RpcVoiceAgentReport=require(_0x72d1('0x5'));function Acw(_0x55b722){this[_0x72d1('0x6')]=_0x55b722['voiceQueues'];this[_0x72d1('0x7')]=_0x55b722['agents'];this[_0x72d1('0x8')]=_0x55b722[_0x72d1('0x8')];this['channels']={};ami['on'](_0x72d1('0x9'),this[_0x72d1('0xa')][_0x72d1('0xb')](this));ami['on']('hanguprequest',this[_0x72d1('0xc')][_0x72d1('0xb')](this));ami['on'](_0x72d1('0xd'),this['syncHangup'][_0x72d1('0xb')](this));ami['on'](_0x72d1('0xe'),this[_0x72d1('0xf')][_0x72d1('0xb')](this));ami['on'](_0x72d1('0x10'),this[_0x72d1('0x11')][_0x72d1('0xb')](this));ami['on'](_0x72d1('0x12'),this[_0x72d1('0x13')][_0x72d1('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0x72d1('0x14')][_0x72d1('0xb')](this));}function getDiff(_0x4c1038){var _0x115cd7=moment()[_0x72d1('0x15')](0x0);var _0x685a27=moment(_0x4c1038)[_0x72d1('0x15')](0x0);return _0x115cd7[_0x72d1('0x16')](_0x685a27,_0x72d1('0x17'));}Acw[_0x72d1('0x18')][_0x72d1('0x19')]=function(_0x23a238){try{var _0x8d458=this;var _0x491af4=this[_0x72d1('0x1a')][_0x23a238]['interface'];var _0x3885b2=this[_0x72d1('0x1a')][_0x23a238]['queue'];var _0x1061b7=this[_0x72d1('0x6')][_0x3885b2];var _0x1ca18d=![];var _0x49caf4='ACW';if(_0x1061b7[_0x72d1('0x1b')]){if(_0x1061b7[_0x72d1('0x1c')][_0x72d1('0x1d')]){_0x1ca18d=!![];_0x49caf4=_0x1061b7[_0x72d1('0x1c')][_0x72d1('0x1d')];}}ami[_0x72d1('0x1e')]({'action':_0x72d1('0x1f'),'interface':_0x491af4,'paused':!![],'reason':_0x49caf4})['then'](function(_0x1c695c){if(_0x8d458['agents'][_0x491af4]){return RpcUser['getAgent'](_0x8d458['agents'][_0x491af4]['id'])['then'](function(_0x445985){if(_0x445985&&!_0x445985[_0x72d1('0x20')]){logger['info'](_0x72d1('0x21'),_0x23a238,_0x491af4,_0x3885b2);var _0x256dc1=_0x8d458[_0x72d1('0x1a')][_0x23a238][_0x72d1('0x22')]&&_0x8d458[_0x72d1('0x1a')][_0x23a238]['destlinkedid']?_0x8d458['channels'][_0x23a238][_0x72d1('0x23')]:_0x23a238;return RpcUser[_0x72d1('0x24')](_0x8d458[_0x72d1('0x7')][_0x491af4],_0x49caf4,_0x256dc1)[_0x72d1('0x25')](function(_0xdf6a69){if(!_0x1ca18d){_0x8d458[_0x72d1('0x8')][_0x491af4]={};logger[_0x72d1('0x26')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x23a238,_0x8d458['voiceQueues'][_0x3885b2][_0x72d1('0x27')],_0x491af4,_0x3885b2);_0x8d458['timers'][_0x491af4][_0x72d1('0x28')]=setTimeout(_0x8d458[_0x72d1('0x29')][_0x72d1('0xb')](_0x8d458,_0x491af4),_0x8d458['voiceQueues'][_0x3885b2][_0x72d1('0x27')]*0x3e8);_0x8d458['timers'][_0x491af4][_0x72d1('0x2a')]=moment()[_0x72d1('0x2b')](_0x72d1('0x2c'));_0x8d458[_0x72d1('0x8')][_0x491af4]['uniqueid']=_0x23a238;_0x8d458[_0x72d1('0x8')][_0x491af4]['queue']=_0x3885b2;_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x2d')]=function(){var _0x5cec3f=getDiff(_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x2a')]);clearTimeout(_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x28')]);_0x8d458[_0x72d1('0x8')][_0x491af4]['timer']=![];RpcVoiceAgentReport[_0x72d1('0x2e')]({'acwtime':_0x5cec3f},_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x2f')],_0x491af4)['then'](function(_0x244f4a){logger[_0x72d1('0x26')]('[%s][UPDATE][ACWTIME:%s]',_0x23a238,_0x5cec3f,_0x244f4a);})[_0x72d1('0x30')](function(_0x750de6){logger[_0x72d1('0x31')]('[%s][UPDATE][ERRORS:%s]',_0x23a238,_0x750de6);});delete _0x8d458[_0x72d1('0x8')][_0x491af4];};}});}else{logger['info'](_0x72d1('0x32'),_0x23a238,_0x491af4,_0x3885b2);}});}})[_0x72d1('0x30')](function(_0x23418d){logger[_0x72d1('0x31')](_0x72d1('0x33'),_0x23a238,_0x8d458[_0x72d1('0x6')][_0x3885b2][_0x72d1('0x27')],_0x491af4,_0x3885b2);})[_0x72d1('0x34')](function(){delete _0x8d458[_0x72d1('0x1a')][_0x23a238];});}catch(_0x24be04){logger[_0x72d1('0x31')]('[ACW][START]\x20%s',_0x24be04[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0x29')]=function(_0x325209){try{var _0x49e074=this;if(_0x49e074[_0x72d1('0x8')][_0x325209]){_0x49e074[_0x72d1('0x8')][_0x325209][_0x72d1('0x28')]=![];var _0x4fb07b=_0x49e074[_0x72d1('0x8')][_0x325209][_0x72d1('0x2f')];var _0x163538=_0x49e074['timers'][_0x325209][_0x72d1('0x36')];var _0x117440=_0x49e074[_0x72d1('0x6')][_0x163538]['acwTimeout'];logger[_0x72d1('0x26')](_0x72d1('0x37'),_0x325209);RpcUser[_0x72d1('0x38')](this[_0x72d1('0x7')][_0x325209]);RpcVoiceAgentReport[_0x72d1('0x2e')]({'acwtime':_0x117440,'agentacw':!![]},_0x4fb07b,_0x325209)[_0x72d1('0x25')](function(_0xd7ec0f){logger['info'](_0x72d1('0x39'),_0x4fb07b,_0x117440,_0xd7ec0f);})[_0x72d1('0x30')](function(_0x440ac5){logger[_0x72d1('0x31')](_0x72d1('0x3a'),_0x4fb07b,_0x440ac5);});}else{logger[_0x72d1('0x31')](_0x72d1('0x3b'),_0x325209);if(_0x49e074[_0x72d1('0x8')]){logger['info'](_0x72d1('0x3c'),JSON[_0x72d1('0x3d')](_0x49e074[_0x72d1('0x8')]));}}}catch(_0x1d6704){logger[_0x72d1('0x31')](_0x72d1('0x3e'),_0x1d6704[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')]['syncAgentConnect']=function(_0x563c5a){try{if(this[_0x72d1('0x6')][_0x563c5a[_0x72d1('0x36')]]&&(this[_0x72d1('0x6')][_0x563c5a[_0x72d1('0x36')]]['acw']||this[_0x72d1('0x6')][_0x563c5a[_0x72d1('0x36')]]['mandatoryDisposition'])){if(this[_0x72d1('0x7')][_0x563c5a['interface']]){this[_0x72d1('0x1a')][_0x563c5a[_0x72d1('0x2f')]]={'queue':_0x563c5a['queue'],'interface':_0x563c5a[_0x72d1('0x3f')],'destlinkedid':_0x563c5a['destlinkedid']};}}}catch(_0x527223){logger['error'](_0x72d1('0x40'),_0x527223['message']);}};Acw[_0x72d1('0x18')][_0x72d1('0x14')]=function(_0x28332b){try{if(this['voiceQueues'][_0x28332b['queue']]&&(this[_0x72d1('0x6')][_0x28332b['queue']]['acw']||this[_0x72d1('0x6')][_0x28332b[_0x72d1('0x36')]][_0x72d1('0x1b')])){if(this['agents'][_0x28332b['interface']]){this['channels'][_0x28332b['uniqueid']]={'queue':_0x28332b[_0x72d1('0x36')],'interface':_0x28332b[_0x72d1('0x3f')]};}}}catch(_0x197483){logger[_0x72d1('0x31')](_0x72d1('0x41'),_0x197483[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0xc')]=function(_0x1e2c11){try{if(this['channels'][_0x1e2c11[_0x72d1('0x2f')]]&&_[_0x72d1('0x42')](this[_0x72d1('0x1a')][_0x1e2c11['uniqueid']][_0x72d1('0x22')])){logger[_0x72d1('0x26')](_0x72d1('0x43'),_0x1e2c11['uniqueid']);this[_0x72d1('0x19')](_0x1e2c11[_0x72d1('0x2f')]);}else if(this[_0x72d1('0x1a')][_0x1e2c11[_0x72d1('0x44')]]&&_['isUndefined'](this['channels'][_0x1e2c11[_0x72d1('0x44')]][_0x72d1('0x22')])){logger[_0x72d1('0x26')]('[%s][HANGUP:LINKEDID]',_0x1e2c11[_0x72d1('0x44')]);this[_0x72d1('0x19')](_0x1e2c11[_0x72d1('0x44')]);}}catch(_0x463670){logger[_0x72d1('0x31')](_0x72d1('0x45'),_0x463670[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0x46')]=function(_0x18f986){try{if(this[_0x72d1('0x1a')][_0x18f986['uniqueid']]&&this[_0x72d1('0x1a')][_0x18f986['uniqueid']]['attended']){logger[_0x72d1('0x26')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x18f986[_0x72d1('0x2f')]);this[_0x72d1('0x19')](_0x18f986[_0x72d1('0x2f')]);}else if(this[_0x72d1('0x1a')][_0x18f986[_0x72d1('0x44')]]&&this[_0x72d1('0x1a')][_0x18f986[_0x72d1('0x44')]][_0x72d1('0x22')]){logger[_0x72d1('0x26')](_0x72d1('0x47'),_0x18f986[_0x72d1('0x44')]);this['startAcw'](_0x18f986[_0x72d1('0x44')]);}}catch(_0x3da39a){logger[_0x72d1('0x31')]('[ACW][syncHangup]\x20%s',_0x3da39a['message']);}};Acw[_0x72d1('0x18')][_0x72d1('0x11')]=function(_0x16e9e7){try{if(!_[_0x72d1('0x48')](this[_0x72d1('0x1a')][_0x16e9e7['transfereeuniqueid']])){this[_0x72d1('0x19')](_0x16e9e7['transfereeuniqueid']);if(this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]]){this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]][_0x72d1('0x22')]=!![];this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4a')]]=this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]];delete this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]];}}else if(!_[_0x72d1('0x48')](this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4a')]])){this[_0x72d1('0x19')](_0x16e9e7[_0x72d1('0x4a')]);if(this[_0x72d1('0x1a')][_0x16e9e7['origtransfereruniqueid']]){this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4b')]][_0x72d1('0x22')]=!![];this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4c')]]=this[_0x72d1('0x1a')][_0x16e9e7['origtransfereruniqueid']];delete this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4b')]];}}}catch(_0xb05cd9){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0xb05cd9[_0x72d1('0x35')]);}};Acw['prototype'][_0x72d1('0x13')]=function(_0x359176){try{if(this[_0x72d1('0x1a')][_0x359176[_0x72d1('0x4d')]]){logger[_0x72d1('0x26')](_0x72d1('0x4e'),JSON[_0x72d1('0x3d')](_0x359176[_0x72d1('0x4d')]));this[_0x72d1('0x19')](_0x359176['transfereruniqueid']);}else if(this['channels'][_0x359176[_0x72d1('0x4f')]]){logger[_0x72d1('0x26')](_0x72d1('0x50'),JSON['stringify'](_0x359176[_0x72d1('0x4f')]));this[_0x72d1('0x19')](_0x359176['transfererlinkedid']);}}catch(_0x39d7f9){logger[_0x72d1('0x31')](_0x72d1('0x51'),_0x39d7f9[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0xf')]=function(_0x102574){try{if(this[_0x72d1('0x6')][_0x102574[_0x72d1('0x36')]]&&this[_0x72d1('0x6')][_0x102574[_0x72d1('0x36')]][_0x72d1('0x52')]==='all'){if(this['agents'][_0x102574[_0x72d1('0x3f')]]){logger[_0x72d1('0x26')](_0x72d1('0x53'),_0x102574[_0x72d1('0x2f')],_0x102574[_0x72d1('0x3f')],_0x102574[_0x72d1('0x36')]);return RpcUser[_0x72d1('0x24')](this[_0x72d1('0x7')][_0x102574['interface']],_0x72d1('0x54'),_0x102574['uniqueid']);}}}catch(_0x475016){logger[_0x72d1('0x31')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x475016['message']);}};module[_0x72d1('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 3a881f8..92ab396 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 _0x4200=['password','keepConnected','Action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','resolve','actionSipShowRegistry','then','catch','log','bluebird','moment','util','lodash','../../config/logger','../../config/environment','asterisk','port','username'];(function(_0xe68b5c,_0x333ace){var _0x4cbfd3=function(_0x28cd19){while(--_0x28cd19){_0xe68b5c['push'](_0xe68b5c['shift']());}};_0x4cbfd3(++_0x333ace);}(_0x4200,0x87));var _0x0420=function(_0x59cf26,_0x1e62ea){_0x59cf26=_0x59cf26-0x0;var _0x11965f=_0x4200[_0x59cf26];return _0x11965f;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x0420('0x0'));var moment=require(_0x0420('0x1'));var util=require(_0x0420('0x2'));var _=require(_0x0420('0x3'));var logger=require(_0x0420('0x4'))('ami');var config=require(_0x0420('0x5'));var ami=new Manager(config[_0x0420('0x6')][_0x0420('0x7')],config['asterisk']['ip'],config[_0x0420('0x6')][_0x0420('0x8')],config[_0x0420('0x6')][_0x0420('0x9')],!![]);ami[_0x0420('0xa')]();ami[_0x0420('0xb')]=BPromise['promisify'](ami['action']);function error(_0x5b2bea){logger['error'](util[_0x0420('0xc')](_0x0420('0xd'),config[_0x0420('0x6')]['username'],config[_0x0420('0x6')]['ip'],config[_0x0420('0x6')][_0x0420('0x7')],util[_0x0420('0xe')](_0x5b2bea,![],null)));}function close(){logger[_0x0420('0xf')](util[_0x0420('0xc')](_0x0420('0x10'),config['asterisk'][_0x0420('0x8')],config[_0x0420('0x6')]['ip'],config[_0x0420('0x6')]['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami['Action']({'action':_0x0420('0x11')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x0420('0xb')]({'action':_0x0420('0x12')});};};ami[_0x0420('0x13')]=function(){return function(){return ami[_0x0420('0xb')]({'action':_0x0420('0x14')});};};ami[_0x0420('0x15')]=function(){return function(){return ami[_0x0420('0xb')]({'action':'queuesummary'});};};ami[_0x0420('0x16')]=function(){return function(){return ami['Action']({'action':_0x0420('0x17')});};};function connect(_0x3b4358){logger[_0x0420('0x18')](util[_0x0420('0xc')](_0x0420('0x19'),config[_0x0420('0x6')][_0x0420('0x8')],config['asterisk']['ip'],config[_0x0420('0x6')][_0x0420('0x7')]));ami[_0x0420('0x1a')]('error',error);ami[_0x0420('0x1a')](_0x0420('0x1b'),close);}ami['on'](_0x0420('0x1c'),connect);ami['on'](_0x0420('0x1d'),function(_0x12f174){logger[_0x0420('0x18')](util[_0x0420('0xc')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x0420('0x6')][_0x0420('0x8')],config['asterisk']['ip'],config['asterisk']['port'],util[_0x0420('0xe')](_0x12f174,![],null)));});ami['on'](_0x0420('0x1e'),function(_0x61564c){logger[_0x0420('0x18')](util[_0x0420('0xc')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x0420('0x6')][_0x0420('0x8')],config[_0x0420('0x6')]['ip'],config['asterisk'][_0x0420('0x7')]));return BPromise[_0x0420('0x1f')]()['then'](ami[_0x0420('0x20')]())[_0x0420('0x21')](ami['actionDeviceStateList']())['then'](ami[_0x0420('0x13')]())[_0x0420('0x21')](ami['actionQueueSummary']())[_0x0420('0x21')](ami[_0x0420('0x16')]())[_0x0420('0x22')](function(_0x5891ac){console[_0x0420('0x23')](_0x5891ac);});});ami[_0x0420('0x1a')]('error',error);ami[_0x0420('0x1a')](_0x0420('0x1b'),close);module['exports']=ami; \ No newline at end of file +var _0x9fa3=['util','lodash','../../config/logger','../../config/environment','asterisk','password','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','username','once','error','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','actionDeviceStateList','catch','log','close','bluebird','moment'];(function(_0x5ace6c,_0x234b30){var _0x5c6bab=function(_0x3c11dd){while(--_0x3c11dd){_0x5ace6c['push'](_0x5ace6c['shift']());}};_0x5c6bab(++_0x234b30);}(_0x9fa3,0x76));var _0x39fa=function(_0x1f77bd,_0x272c28){_0x1f77bd=_0x1f77bd-0x0;var _0x357b75=_0x9fa3[_0x1f77bd];return _0x357b75;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x39fa('0x0'));var moment=require(_0x39fa('0x1'));var util=require(_0x39fa('0x2'));var _=require(_0x39fa('0x3'));var logger=require(_0x39fa('0x4'))('ami');var config=require(_0x39fa('0x5'));var ami=new Manager(config['asterisk']['port'],config[_0x39fa('0x6')]['ip'],config['asterisk']['username'],config['asterisk'][_0x39fa('0x7')],!![]);ami[_0x39fa('0x8')]();ami[_0x39fa('0x9')]=BPromise[_0x39fa('0xa')](ami[_0x39fa('0xb')]);function error(_0x43441f){logger['error'](util[_0x39fa('0xc')](_0x39fa('0xd'),config[_0x39fa('0x6')]['username'],config[_0x39fa('0x6')]['ip'],config[_0x39fa('0x6')][_0x39fa('0xe')],util[_0x39fa('0xf')](_0x43441f,![],null)));}function close(){logger['error'](util[_0x39fa('0xc')](_0x39fa('0x10'),config['asterisk']['username'],config[_0x39fa('0x6')]['ip'],config[_0x39fa('0x6')][_0x39fa('0xe')]));}ami[_0x39fa('0x11')]=function(){return function(){return ami[_0x39fa('0x9')]({'action':_0x39fa('0x12')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x39fa('0x9')]({'action':_0x39fa('0x13')});};};ami[_0x39fa('0x14')]=function(){return function(){return ami[_0x39fa('0x9')]({'action':_0x39fa('0x15')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x39fa('0x9')]({'action':_0x39fa('0x16')});};};ami[_0x39fa('0x17')]=function(){return function(){return ami[_0x39fa('0x9')]({'action':_0x39fa('0x18')});};};function connect(_0x3da4e5){logger[_0x39fa('0x19')](util[_0x39fa('0xc')](_0x39fa('0x1a'),config[_0x39fa('0x6')][_0x39fa('0x1b')],config[_0x39fa('0x6')]['ip'],config['asterisk'][_0x39fa('0xe')]));ami[_0x39fa('0x1c')](_0x39fa('0x1d'),error);ami[_0x39fa('0x1c')]('close',close);}ami['on'](_0x39fa('0x1e'),connect);ami['on'](_0x39fa('0x1f'),function(_0x1a93d1){logger[_0x39fa('0x19')](util[_0x39fa('0xc')](_0x39fa('0x20'),config[_0x39fa('0x6')][_0x39fa('0x1b')],config[_0x39fa('0x6')]['ip'],config[_0x39fa('0x6')]['port'],util[_0x39fa('0xf')](_0x1a93d1,![],null)));});ami['on'](_0x39fa('0x21'),function(_0x23b1ca){logger[_0x39fa('0x19')](util[_0x39fa('0xc')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x39fa('0x6')]['username'],config[_0x39fa('0x6')]['ip'],config['asterisk'][_0x39fa('0xe')]));return BPromise[_0x39fa('0x22')]()[_0x39fa('0x23')](ami[_0x39fa('0x11')]())[_0x39fa('0x23')](ami[_0x39fa('0x24')]())[_0x39fa('0x23')](ami['actionSipPeerStatus']())[_0x39fa('0x23')](ami['actionQueueSummary']())['then'](ami[_0x39fa('0x17')]())[_0x39fa('0x25')](function(_0x17720d){console[_0x39fa('0x26')](_0x17720d);});});ami[_0x39fa('0x1c')](_0x39fa('0x1d'),error);ami[_0x39fa('0x1c')](_0x39fa('0x27'),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 1e747db..3d970bf 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 _0x7497=['bluebird','ami','client','http','Request','request','then','debug','error','rpc','memberReport','message','result','exports','jayson/promise'];(function(_0x374ea8,_0x444720){var _0x5bdf9f=function(_0x4f81b7){while(--_0x4f81b7){_0x374ea8['push'](_0x374ea8['shift']());}};_0x5bdf9f(++_0x444720);}(_0x7497,0x167));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x7749('0x0'));var BPromise=require(_0x7749('0x1'));var logger=require('../../config/logger')(_0x7749('0x2'));var client=jayson[_0x7749('0x3')][_0x7749('0x4')]({'port':0x2329});client[_0x7749('0x5')]=function(_0x36fe9f,_0x296ddb){return new BPromise(function(_0x551f63,_0x51d5a7){return client[_0x7749('0x6')](_0x36fe9f,_0x296ddb)[_0x7749('0x7')](function(_0x3b2e3c){logger[_0x7749('0x8')]('rpc','memberReport',_0x36fe9f,_0x296ddb,_0x3b2e3c);if(_0x3b2e3c[_0x7749('0x9')]){logger[_0x7749('0x9')](_0x7749('0xa'),_0x7749('0xb'),_0x36fe9f,_0x3b2e3c['error'][_0x7749('0xc')],_0x296ddb);return _0x51d5a7(_0x3b2e3c['error'][_0x7749('0xc')]);}else{return _0x551f63(_0x3b2e3c[_0x7749('0xd')]);}})['catch'](function(_0x4918e1){logger[_0x7749('0x9')]('rpc',_0x7749('0xb'),_0x36fe9f,_0x4918e1,_0x296ddb);return _0x51d5a7(_0x4918e1);});});};module[_0x7749('0xe')]=client; \ No newline at end of file +var _0x5778=['debug','rpc','memberReport','error','result','catch','exports','jayson/promise','bluebird','ami','client','request','then'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x5778,0xf1));var _0x8577=function(_0x3e1ed0,_0x4e2a92){_0x3e1ed0=_0x3e1ed0-0x0;var _0x35acc1=_0x5778[_0x3e1ed0];return _0x35acc1;};'use strict';var jayson=require(_0x8577('0x0'));var BPromise=require(_0x8577('0x1'));var logger=require('../../config/logger')(_0x8577('0x2'));var client=jayson[_0x8577('0x3')]['http']({'port':0x2329});client['Request']=function(_0x465872,_0x20fdac){return new BPromise(function(_0x209000,_0xcc68fc){return client[_0x8577('0x4')](_0x465872,_0x20fdac)[_0x8577('0x5')](function(_0x1710a1){logger[_0x8577('0x6')](_0x8577('0x7'),_0x8577('0x8'),_0x465872,_0x20fdac,_0x1710a1);if(_0x1710a1[_0x8577('0x9')]){logger['error']('rpc',_0x8577('0x8'),_0x465872,_0x1710a1['error']['message'],_0x20fdac);return _0xcc68fc(_0x1710a1[_0x8577('0x9')]['message']);}else{return _0x209000(_0x1710a1[_0x8577('0xa')]);}})[_0x8577('0xb')](function(_0x2ec393){logger[_0x8577('0x9')](_0x8577('0x7'),_0x8577('0x8'),_0x465872,_0x2ec393,_0x20fdac);return _0xcc68fc(_0x2ec393);});});};module[_0x8577('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 809a812..8339637 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 _0xf1a7=['YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','voiceQueue','substring','dialCutDigit','prototype','getQueue','exports','lodash','isNil','string','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format'];(function(_0xb0c67d,_0x40b838){var _0x4aca14=function(_0x184913){while(--_0x184913){_0xb0c67d['push'](_0xb0c67d['shift']());}};_0x4aca14(++_0x40b838);}(_0xf1a7,0x8f));var _0x7f1a=function(_0x2b4e9a,_0x31ac58){_0x2b4e9a=_0x2b4e9a-0x0;var _0x51307a=_0xf1a7[_0x2b4e9a];return _0x51307a;};'use strict';var util=require('util');var _=require(_0x7f1a('0x0'));var moment=require('moment');function checkNameSurname(_0x213772,_0x593731,_0x37848f){var _0xb11aca='';if(!_[_0x7f1a('0x1')](_0x593731)&&_0x7f1a('0x2')===typeof _0x593731){_0xb11aca+=_0x593731;}if(!_[_0x7f1a('0x1')](_0x37848f)&&_0x7f1a('0x2')===typeof _0x37848f){_0xb11aca+='\x20'+_0x37848f;}if(_0xb11aca!==''){return _0xb11aca;}return _0x213772;}function Action(_0x26548b,_0x41446f,_0x1c3c87){this['voiceQueue']=_0x26548b;this[_0x7f1a('0x3')]=_0x1c3c87||undefined;this[_0x7f1a('0x4')]=checkNameSurname(_0x41446f[_0x7f1a('0x5')][_0x7f1a('0x6')],_0x41446f[_0x7f1a('0x5')][_0x7f1a('0x7')],_0x41446f[_0x7f1a('0x5')][_0x7f1a('0x8')]);this[_0x7f1a('0x9')]=_0x41446f[_0x7f1a('0x5')][_0x7f1a('0x6')];this[_0x7f1a('0xa')]=_0x26548b[_0x7f1a('0x4')];this[_0x7f1a('0xb')]=_0x41446f['active']||![];this[_0x7f1a('0xc')]=_0x26548b[_0x7f1a('0xc')];this[_0x7f1a('0xd')]=_0x26548b[_0x7f1a('0xd')]||0x3;this[_0x7f1a('0xe')]=_0x41446f['scheduledat'];this['countbusyretry']=_0x41446f['countbusyretry'];this[_0x7f1a('0xf')]=_0x41446f['countcongestionretry'];this[_0x7f1a('0x10')]=_0x41446f[_0x7f1a('0x10')];this['countnosuchnumberretry']=_0x41446f[_0x7f1a('0x11')];this[_0x7f1a('0x12')]=_0x41446f[_0x7f1a('0x12')];this[_0x7f1a('0x13')]=_0x41446f[_0x7f1a('0x13')];this[_0x7f1a('0x14')]=_0x41446f[_0x7f1a('0x14')];this[_0x7f1a('0x15')]=_0x41446f[_0x7f1a('0x15')];this[_0x7f1a('0x16')]=_0x41446f[_0x7f1a('0x16')];this['ListId']=_0x41446f['ListId'];this[_0x7f1a('0x17')]=_0x41446f[_0x7f1a('0x17')];this[_0x7f1a('0x18')]=_0x41446f[_0x7f1a('0x18')];this['CampaignId']=_0x41446f[_0x7f1a('0x19')];this['idHopper']=_0x41446f['id'];this[_0x7f1a('0x1a')]=_0x41446f[_0x7f1a('0x5')][_0x7f1a('0x7')]||'';this[_0x7f1a('0x1b')]=moment()[_0x7f1a('0x1c')](_0x7f1a('0x1d'));this[_0x7f1a('0x1e')]=_0x41446f['callback'];this[_0x7f1a('0x1f')]=_0x41446f[_0x7f1a('0x1f')];this[_0x7f1a('0x20')]=_0x41446f[_0x7f1a('0x20')];this[_0x7f1a('0x21')]=_0x41446f['recallme'];this[_0x7f1a('0x22')]='';this['originatecalleridname']='';}Action['prototype'][_0x7f1a('0x23')]=function(){return util[_0x7f1a('0x1c')](_0x7f1a('0x24'),this[_0x7f1a('0x4')],this[_0x7f1a('0x25')]['dialCutDigit']>0x0?this[_0x7f1a('0x9')][_0x7f1a('0x26')](this[_0x7f1a('0x25')][_0x7f1a('0x27')]):this['number']);};Action[_0x7f1a('0x28')][_0x7f1a('0x29')]=function(){return this[_0x7f1a('0xa')];};module[_0x7f1a('0x2a')]=Action; \ No newline at end of file +var _0xfd96=['CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','recallme','originatecalleridname','getCaller','dialCutDigit','substring','prototype','getQueue','queue','util','moment','isNil','string','voiceQueue','name','phone','Contact','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0xfd96,0xe7));var _0x6fd9=function(_0x2172e0,_0x335532){_0x2172e0=_0x2172e0-0x0;var _0x423c1d=_0xfd96[_0x2172e0];return _0x423c1d;};'use strict';var util=require(_0x6fd9('0x0'));var _=require('lodash');var moment=require(_0x6fd9('0x1'));function checkNameSurname(_0x206e6f,_0x459600,_0xc3cc4){var _0x57c7bc='';if(!_[_0x6fd9('0x2')](_0x459600)&&_0x6fd9('0x3')===typeof _0x459600){_0x57c7bc+=_0x459600;}if(!_[_0x6fd9('0x2')](_0xc3cc4)&&_0x6fd9('0x3')===typeof _0xc3cc4){_0x57c7bc+='\x20'+_0xc3cc4;}if(_0x57c7bc!==''){return _0x57c7bc;}return _0x206e6f;}function Action(_0x12f175,_0x2e831a,_0x26beda){this[_0x6fd9('0x4')]=_0x12f175;this['uniqueid']=_0x26beda||undefined;this[_0x6fd9('0x5')]=checkNameSurname(_0x2e831a['Contact'][_0x6fd9('0x6')],_0x2e831a[_0x6fd9('0x7')][_0x6fd9('0x8')],_0x2e831a[_0x6fd9('0x7')][_0x6fd9('0x9')]);this[_0x6fd9('0xa')]=_0x2e831a[_0x6fd9('0x7')][_0x6fd9('0x6')];this['queue']=_0x12f175[_0x6fd9('0x5')];this[_0x6fd9('0xb')]=_0x2e831a[_0x6fd9('0xb')]||![];this['type']=_0x12f175[_0x6fd9('0xc')];this['dialQueueTimeout']=_0x12f175[_0x6fd9('0xd')]||0x3;this[_0x6fd9('0xe')]=_0x2e831a[_0x6fd9('0xe')];this[_0x6fd9('0xf')]=_0x2e831a[_0x6fd9('0xf')];this[_0x6fd9('0x10')]=_0x2e831a[_0x6fd9('0x10')];this[_0x6fd9('0x11')]=_0x2e831a[_0x6fd9('0x11')];this[_0x6fd9('0x12')]=_0x2e831a[_0x6fd9('0x12')];this['countdropretry']=_0x2e831a[_0x6fd9('0x13')];this[_0x6fd9('0x14')]=_0x2e831a[_0x6fd9('0x14')];this['countmachineretry']=_0x2e831a[_0x6fd9('0x15')];this[_0x6fd9('0x16')]=_0x2e831a[_0x6fd9('0x16')];this[_0x6fd9('0x17')]=_0x2e831a[_0x6fd9('0x17')];this[_0x6fd9('0x18')]=_0x2e831a[_0x6fd9('0x18')];this[_0x6fd9('0x19')]=_0x2e831a[_0x6fd9('0x19')];this[_0x6fd9('0x1a')]=_0x2e831a[_0x6fd9('0x1a')];this[_0x6fd9('0x1b')]=_0x2e831a[_0x6fd9('0x1b')];this[_0x6fd9('0x1c')]=_0x2e831a['id'];this[_0x6fd9('0x1d')]=_0x2e831a[_0x6fd9('0x7')][_0x6fd9('0x8')]||'';this[_0x6fd9('0x1e')]=moment()[_0x6fd9('0x1f')](_0x6fd9('0x20'));this[_0x6fd9('0x21')]=_0x2e831a[_0x6fd9('0x21')];this[_0x6fd9('0x22')]=_0x2e831a[_0x6fd9('0x22')];this['callbackat']=_0x2e831a['callbackat'];this[_0x6fd9('0x23')]=_0x2e831a[_0x6fd9('0x23')];this['originatecalleridnum']='';this[_0x6fd9('0x24')]='';}Action['prototype'][_0x6fd9('0x25')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x6fd9('0x5')],this[_0x6fd9('0x4')][_0x6fd9('0x26')]>0x0?this['number'][_0x6fd9('0x27')](this['voiceQueue'][_0x6fd9('0x26')]):this[_0x6fd9('0xa')]);};Action[_0x6fd9('0x28')][_0x6fd9('0x29')]=function(){return this[_0x6fd9('0x2a')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index ea48563..b941f80 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 _0xd952=['Answer','scheduledat','type','campaigntype','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','answertime','queue','membername','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state'];(function(_0xd13a88,_0x3c5269){var _0x1c993c=function(_0x245af5){while(--_0x245af5){_0xd13a88['push'](_0xd13a88['shift']());}};_0x1c993c(++_0x3c5269);}(_0xd952,0x197));var _0x2d95=function(_0x2358e3,_0x3c0f39){_0x2358e3=_0x2358e3-0x0;var _0x1ffccc=_0xd952[_0x2358e3];return _0x1ffccc;};'use strict';var util=require(_0x2d95('0x0'));var _=require(_0x2d95('0x1'));var moment=require(_0x2d95('0x2'));function getSeconds(_0x1dcbb5,_0x1e4148){var _0x305000=moment(_0x1dcbb5)['milliseconds'](0x0);var _0x273d6f=moment(_0x1e4148)[_0x2d95('0x3')](0x0);return _0x305000[_0x2d95('0x4')](_0x273d6f,_0x2d95('0x5'));}function AgentComplete(_0xadeb25,_0x5556c8){this[_0x2d95('0x6')]=0x4;this['statedesc']=_0x2d95('0x7');this[_0x2d95('0x8')]=_0xadeb25[_0x2d95('0x8')];this[_0x2d95('0x9')]=_0xadeb25['type'];this[_0x2d95('0xa')]=_0xadeb25[_0x2d95('0x9')]==='outbound'?'queue':_0xadeb25[_0x2d95('0x9')];this['countbusyretry']=_0xadeb25['countbusyretry'];this[_0x2d95('0xb')]=_0xadeb25[_0x2d95('0xb')];this[_0x2d95('0xc')]=_0xadeb25[_0x2d95('0xc')];this[_0x2d95('0xd')]=_0xadeb25[_0x2d95('0xe')]+_0xadeb25[_0x2d95('0xb')]+_0xadeb25[_0x2d95('0xc')]+_0xadeb25[_0x2d95('0xf')]+_0xadeb25[_0x2d95('0x10')]+_0xadeb25[_0x2d95('0x11')]+_0xadeb25[_0x2d95('0x12')]+_0xadeb25[_0x2d95('0x13')];this['countnosuchnumberretry']=_0xadeb25['countnosuchnumberretry'];this[_0x2d95('0x10')]=_0xadeb25[_0x2d95('0x10')];this[_0x2d95('0x11')]=_0xadeb25[_0x2d95('0x11')];this[_0x2d95('0x12')]=_0xadeb25[_0x2d95('0x12')];this[_0x2d95('0x13')]=_0xadeb25[_0x2d95('0x13')];this[_0x2d95('0x14')]=_0x5556c8['uniqueid'];this[_0x2d95('0x15')]=_0xadeb25[_0x2d95('0x16')];this[_0x2d95('0x17')]=_0xadeb25[_0x2d95('0x18')];this['starttime']=_0xadeb25[_0x2d95('0x19')];this[_0x2d95('0x1a')]=_0xadeb25['responsetime'];this['answertime']=_0xadeb25['answertime'];this[_0x2d95('0x1b')]=moment()[_0x2d95('0x1c')](_0x2d95('0x1d'));this[_0x2d95('0x1e')]=getSeconds(_0xadeb25[_0x2d95('0x1a')],_0xadeb25[_0x2d95('0x19')]);this[_0x2d95('0x1f')]=getSeconds(_0xadeb25[_0x2d95('0x20')],_0xadeb25['responsetime']);this['talktime']=getSeconds(this[_0x2d95('0x1b')],_0xadeb25[_0x2d95('0x20')]);this[_0x2d95('0x21')]=_0x5556c8['queue'];this[_0x2d95('0x22')]=_0x5556c8[_0x2d95('0x22')];this[_0x2d95('0x23')]=_0x5556c8[_0x2d95('0x23')];this[_0x2d95('0x24')]=_0xadeb25['callback'];this['callbackuniqueid']=_0xadeb25['callbackuniqueid'];this[_0x2d95('0x25')]=_0xadeb25[_0x2d95('0x25')];this[_0x2d95('0x26')]=_0xadeb25[_0x2d95('0x26')];this[_0x2d95('0x27')]=_0xadeb25[_0x2d95('0x27')];this[_0x2d95('0x28')]=_0xadeb25['ListId'];this[_0x2d95('0x29')]=_0xadeb25[_0x2d95('0x29')];this[_0x2d95('0x2a')]=_0xadeb25[_0x2d95('0x2a')];this['CampaignId']=_0xadeb25['CampaignId'];this[_0x2d95('0x2b')]=_0xadeb25['originatecalleridnum']||'';this[_0x2d95('0x2c')]=_0xadeb25[_0x2d95('0x2c')]||'';}module[_0x2d95('0x2d')]=AgentComplete; \ No newline at end of file +var _0x2e1c=['originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','number','starttime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','responsetime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x2f8484,_0x4279a2){var _0x4b619f=function(_0x31e4c5){while(--_0x31e4c5){_0x2f8484['push'](_0x2f8484['shift']());}};_0x4b619f(++_0x4279a2);}(_0x2e1c,0x91));var _0xc2e1=function(_0x5912d3,_0xdbab67){_0x5912d3=_0x5912d3-0x0;var _0x14f834=_0x2e1c[_0x5912d3];return _0x14f834;};'use strict';var util=require(_0xc2e1('0x0'));var _=require(_0xc2e1('0x1'));var moment=require(_0xc2e1('0x2'));function getSeconds(_0x5ea74a,_0x55ced8){var _0x1447a1=moment(_0x5ea74a)['milliseconds'](0x0);var _0x1f61ae=moment(_0x55ced8)[_0xc2e1('0x3')](0x0);return _0x1447a1[_0xc2e1('0x4')](_0x1f61ae,_0xc2e1('0x5'));}function AgentComplete(_0x407e68,_0x3068ad){this[_0xc2e1('0x6')]=0x4;this[_0xc2e1('0x7')]=_0xc2e1('0x8');this[_0xc2e1('0x9')]=_0x407e68[_0xc2e1('0x9')];this[_0xc2e1('0xa')]=_0x407e68['type'];this[_0xc2e1('0xb')]=_0x407e68[_0xc2e1('0xa')]===_0xc2e1('0xc')?_0xc2e1('0xd'):_0x407e68['type'];this[_0xc2e1('0xe')]=_0x407e68[_0xc2e1('0xe')];this[_0xc2e1('0xf')]=_0x407e68[_0xc2e1('0xf')];this[_0xc2e1('0x10')]=_0x407e68['countnoanswerretry'];this[_0xc2e1('0x11')]=_0x407e68[_0xc2e1('0xe')]+_0x407e68[_0xc2e1('0xf')]+_0x407e68[_0xc2e1('0x10')]+_0x407e68['countnosuchnumberretry']+_0x407e68[_0xc2e1('0x12')]+_0x407e68[_0xc2e1('0x13')]+_0x407e68[_0xc2e1('0x14')]+_0x407e68[_0xc2e1('0x15')];this[_0xc2e1('0x16')]=_0x407e68[_0xc2e1('0x16')];this[_0xc2e1('0x12')]=_0x407e68[_0xc2e1('0x12')];this[_0xc2e1('0x13')]=_0x407e68[_0xc2e1('0x13')];this[_0xc2e1('0x14')]=_0x407e68[_0xc2e1('0x14')];this[_0xc2e1('0x15')]=_0x407e68[_0xc2e1('0x15')];this[_0xc2e1('0x17')]=_0x3068ad[_0xc2e1('0x17')];this[_0xc2e1('0x18')]=_0x407e68['name'];this['calleridnum']=_0x407e68[_0xc2e1('0x19')];this[_0xc2e1('0x1a')]=_0x407e68[_0xc2e1('0x1a')];this['responsetime']=_0x407e68['responsetime'];this[_0xc2e1('0x1b')]=_0x407e68[_0xc2e1('0x1b')];this['endtime']=moment()[_0xc2e1('0x1c')](_0xc2e1('0x1d'));this[_0xc2e1('0x1e')]=getSeconds(_0x407e68['responsetime'],_0x407e68[_0xc2e1('0x1a')]);this[_0xc2e1('0x1f')]=getSeconds(_0x407e68[_0xc2e1('0x1b')],_0x407e68[_0xc2e1('0x20')]);this[_0xc2e1('0x21')]=getSeconds(this[_0xc2e1('0x22')],_0x407e68[_0xc2e1('0x1b')]);this[_0xc2e1('0xd')]=_0x3068ad[_0xc2e1('0xd')];this[_0xc2e1('0x23')]=_0x3068ad[_0xc2e1('0x23')];this[_0xc2e1('0x24')]=_0x3068ad[_0xc2e1('0x24')];this[_0xc2e1('0x25')]=_0x407e68[_0xc2e1('0x25')];this[_0xc2e1('0x26')]=_0x407e68[_0xc2e1('0x26')];this[_0xc2e1('0x27')]=_0x407e68[_0xc2e1('0x27')];this['recallme']=_0x407e68[_0xc2e1('0x28')];this[_0xc2e1('0x29')]=_0x407e68[_0xc2e1('0x29')];this['ListId']=_0x407e68[_0xc2e1('0x2a')];this[_0xc2e1('0x2b')]=_0x407e68[_0xc2e1('0x2b')];this[_0xc2e1('0x2c')]=_0x407e68[_0xc2e1('0x2c')];this[_0xc2e1('0x2d')]=_0x407e68[_0xc2e1('0x2d')];this[_0xc2e1('0x2e')]=_0x407e68[_0xc2e1('0x2e')]||'';this['originatecalleridname']=_0x407e68[_0xc2e1('0x2f')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index afdacf1..9430097 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 _0x7cbe=['UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId'];(function(_0x171ba0,_0x2c71d8){var _0x20178c=function(_0x22c699){while(--_0x22c699){_0x171ba0['push'](_0x171ba0['shift']());}};_0x20178c(++_0x2c71d8);}(_0x7cbe,0x1a9));var _0xe7cb=function(_0x1728d1,_0x1994e3){_0x1728d1=_0x1728d1-0x0;var _0x3ca811=_0x7cbe[_0x1728d1];return _0x3ca811;};'use strict';var util=require(_0xe7cb('0x0'));var _=require(_0xe7cb('0x1'));var moment=require(_0xe7cb('0x2'));function getSeconds(_0x123d50,_0x50b76b){var _0x13ea22=moment(_0x123d50)[_0xe7cb('0x3')](0x0);var _0x197300=moment(_0x50b76b)['milliseconds'](0x0);return _0x13ea22['diff'](_0x197300,'seconds');}function Final(_0x10aaa8){this[_0xe7cb('0x4')]=_0x10aaa8['uniqueid'];this[_0xe7cb('0x5')]=_0x10aaa8[_0xe7cb('0x5')];this[_0xe7cb('0x6')]=_0x10aaa8[_0xe7cb('0x6')];this[_0xe7cb('0x7')]=_0x10aaa8['type']==='outbound'?'queue':_0x10aaa8[_0xe7cb('0x6')];this[_0xe7cb('0x8')]=_0x10aaa8['countbusyretry'];this['countcongestionretry']=_0x10aaa8['countcongestionretry'];this['countnoanswerretry']=_0x10aaa8[_0xe7cb('0x9')];this[_0xe7cb('0xa')]=_0x10aaa8[_0xe7cb('0x8')]+_0x10aaa8['countcongestionretry']+_0x10aaa8[_0xe7cb('0x9')]+_0x10aaa8[_0xe7cb('0xb')]+_0x10aaa8[_0xe7cb('0xc')]+_0x10aaa8[_0xe7cb('0xd')]+_0x10aaa8[_0xe7cb('0xe')]+_0x10aaa8[_0xe7cb('0xf')];this['countnosuchnumberretry']=_0x10aaa8[_0xe7cb('0xb')];this[_0xe7cb('0xc')]=_0x10aaa8[_0xe7cb('0xc')];this[_0xe7cb('0xd')]=_0x10aaa8[_0xe7cb('0xd')];this[_0xe7cb('0xe')]=_0x10aaa8[_0xe7cb('0xe')];this['countagentrejectretry']=_0x10aaa8[_0xe7cb('0xf')];this['queue']=_0x10aaa8[_0xe7cb('0x10')];this[_0xe7cb('0x11')]=_0x10aaa8[_0xe7cb('0x11')];this[_0xe7cb('0x12')]=_0x10aaa8['calleridnum'];this[_0xe7cb('0x13')]=_0x10aaa8[_0xe7cb('0x13')];this[_0xe7cb('0x14')]=_0x10aaa8[_0xe7cb('0x14')];this[_0xe7cb('0x15')]=_0x10aaa8[_0xe7cb('0x14')];this['ringtime']=_0x10aaa8[_0xe7cb('0x16')]||0x0;this['holdtime']=_0x10aaa8[_0xe7cb('0x17')]||0x0;this[_0xe7cb('0x18')]=_0x10aaa8[_0xe7cb('0x18')]||0x0;this[_0xe7cb('0x19')]=_0x10aaa8[_0xe7cb('0x19')];this['callbackuniqueid']=_0x10aaa8['callbackuniqueid'];this[_0xe7cb('0x1a')]=_0x10aaa8[_0xe7cb('0x1a')];this[_0xe7cb('0x1b')]=_0x10aaa8[_0xe7cb('0x1b')];this[_0xe7cb('0x1c')]=_0x10aaa8[_0xe7cb('0x1c')];this[_0xe7cb('0x1d')]=_0x10aaa8[_0xe7cb('0x1d')];this[_0xe7cb('0x1e')]=_0x10aaa8[_0xe7cb('0x1e')];this[_0xe7cb('0x1f')]=_0x10aaa8['VoiceQueueId'];this['CampaignId']=_0x10aaa8['CampaignId'];this[_0xe7cb('0x20')]=_0x10aaa8[_0xe7cb('0x20')]||'';this['originatecalleridname']=_0x10aaa8[_0xe7cb('0x21')]||'';}module[_0xe7cb('0x22')]=Final; \ No newline at end of file +var _0x8b56=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x56b891,_0x2f117e){var _0x41d994=function(_0x4f641a){while(--_0x4f641a){_0x56b891['push'](_0x56b891['shift']());}};_0x41d994(++_0x2f117e);}(_0x8b56,0x14b));var _0x68b5=function(_0x37705c,_0xe5bb4a){_0x37705c=_0x37705c-0x0;var _0x1512a8=_0x8b56[_0x37705c];return _0x1512a8;};'use strict';var util=require(_0x68b5('0x0'));var _=require(_0x68b5('0x1'));var moment=require(_0x68b5('0x2'));function getSeconds(_0x45b40a,_0xdbe2e4){var _0x3d58c1=moment(_0x45b40a)[_0x68b5('0x3')](0x0);var _0x407951=moment(_0xdbe2e4)[_0x68b5('0x3')](0x0);return _0x3d58c1[_0x68b5('0x4')](_0x407951,_0x68b5('0x5'));}function Final(_0x1a8191){this[_0x68b5('0x6')]=_0x1a8191[_0x68b5('0x6')];this[_0x68b5('0x7')]=_0x1a8191[_0x68b5('0x7')];this[_0x68b5('0x8')]=_0x1a8191[_0x68b5('0x8')];this['campaigntype']=_0x1a8191[_0x68b5('0x8')]===_0x68b5('0x9')?_0x68b5('0xa'):_0x1a8191[_0x68b5('0x8')];this[_0x68b5('0xb')]=_0x1a8191[_0x68b5('0xb')];this[_0x68b5('0xc')]=_0x1a8191[_0x68b5('0xc')];this['countnoanswerretry']=_0x1a8191[_0x68b5('0xd')];this['countglobal']=_0x1a8191[_0x68b5('0xb')]+_0x1a8191['countcongestionretry']+_0x1a8191[_0x68b5('0xd')]+_0x1a8191['countnosuchnumberretry']+_0x1a8191[_0x68b5('0xe')]+_0x1a8191[_0x68b5('0xf')]+_0x1a8191[_0x68b5('0x10')]+_0x1a8191[_0x68b5('0x11')];this[_0x68b5('0x12')]=_0x1a8191[_0x68b5('0x12')];this[_0x68b5('0xe')]=_0x1a8191[_0x68b5('0xe')];this['countabandonedretry']=_0x1a8191[_0x68b5('0xf')];this['countmachineretry']=_0x1a8191['countmachineretry'];this[_0x68b5('0x11')]=_0x1a8191[_0x68b5('0x11')];this[_0x68b5('0xa')]=_0x1a8191['queue'];this['calleridname']=_0x1a8191[_0x68b5('0x13')];this['calleridnum']=_0x1a8191['calleridnum'];this['starttime']=_0x1a8191['starttime'];this[_0x68b5('0x14')]=_0x1a8191[_0x68b5('0x14')];this[_0x68b5('0x15')]=_0x1a8191['responsetime'];this[_0x68b5('0x16')]=_0x1a8191['ringtime']||0x0;this[_0x68b5('0x17')]=_0x1a8191['holdtime']||0x0;this[_0x68b5('0x18')]=_0x1a8191[_0x68b5('0x18')]||0x0;this[_0x68b5('0x19')]=_0x1a8191['callback'];this[_0x68b5('0x1a')]=_0x1a8191[_0x68b5('0x1a')];this[_0x68b5('0x1b')]=_0x1a8191[_0x68b5('0x1b')];this['recallme']=_0x1a8191[_0x68b5('0x1c')];this[_0x68b5('0x1d')]=_0x1a8191[_0x68b5('0x1d')];this[_0x68b5('0x1e')]=_0x1a8191[_0x68b5('0x1e')];this[_0x68b5('0x1f')]=_0x1a8191[_0x68b5('0x1f')];this[_0x68b5('0x20')]=_0x1a8191[_0x68b5('0x20')];this[_0x68b5('0x21')]=_0x1a8191['CampaignId'];this['originatecalleridnum']=_0x1a8191['originatecalleridnum']||'';this[_0x68b5('0x22')]=_0x1a8191[_0x68b5('0x22')]||'';}module[_0x68b5('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index c5dd774..d5d0c05 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 _0xdbc6=['countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','number','starttime','responsetime','format','ringtime','holdtime','endtime','queue','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x46e81b,_0x3d49aa){var _0x591c0f=function(_0x20318f){while(--_0x20318f){_0x46e81b['push'](_0x46e81b['shift']());}};_0x591c0f(++_0x3d49aa);}(_0xdbc6,0x1de));var _0x6dbc=function(_0x1d6419,_0x222566){_0x1d6419=_0x1d6419-0x0;var _0x4af41a=_0xdbc6[_0x1d6419];return _0x4af41a;};'use strict';var util=require(_0x6dbc('0x0'));var _=require(_0x6dbc('0x1'));var moment=require(_0x6dbc('0x2'));function getSeconds(_0x367e84,_0x5879da){var _0x4d6aea=moment(_0x367e84)[_0x6dbc('0x3')](0x0);var _0x3ea827=moment(_0x5879da)['milliseconds'](0x0);return _0x4d6aea[_0x6dbc('0x4')](_0x3ea827,_0x6dbc('0x5'));}function Hangup(_0x289bd9,_0x3eb551){this['state']=0x4;this[_0x6dbc('0x6')]=_0x6dbc('0x7');this[_0x6dbc('0x8')]=_0x289bd9['scheduledat'];this[_0x6dbc('0x9')]=_0x289bd9['type'];this[_0x6dbc('0xa')]=_0x289bd9['type']===_0x6dbc('0xb')?'queue':_0x289bd9['type'];this[_0x6dbc('0xc')]=_0x289bd9[_0x6dbc('0xc')];this[_0x6dbc('0xd')]=_0x289bd9[_0x6dbc('0xd')];this[_0x6dbc('0xe')]=_0x289bd9['countnoanswerretry'];this[_0x6dbc('0xf')]=_0x289bd9['countbusyretry']+_0x289bd9['countcongestionretry']+_0x289bd9[_0x6dbc('0xe')]+_0x289bd9[_0x6dbc('0x10')]+_0x289bd9['countdropretry']+_0x289bd9[_0x6dbc('0x11')]+_0x289bd9[_0x6dbc('0x12')]+_0x289bd9[_0x6dbc('0x13')];this[_0x6dbc('0x10')]=_0x289bd9['countnosuchnumberretry'];this[_0x6dbc('0x14')]=_0x289bd9[_0x6dbc('0x14')];this[_0x6dbc('0x11')]=_0x289bd9[_0x6dbc('0x11')];this[_0x6dbc('0x12')]=_0x289bd9['countmachineretry'];this[_0x6dbc('0x13')]=_0x289bd9[_0x6dbc('0x13')];this[_0x6dbc('0x15')]=_0x3eb551[_0x6dbc('0x15')];this[_0x6dbc('0x16')]=_0x289bd9['name'];this['calleridnum']=_0x289bd9[_0x6dbc('0x17')];this['starttime']=_0x289bd9[_0x6dbc('0x18')];this['responsetime']=_0x289bd9[_0x6dbc('0x19')];this['endtime']=moment()[_0x6dbc('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6dbc('0x1b')]=getSeconds(_0x289bd9['responsetime'],_0x289bd9['starttime']);this[_0x6dbc('0x1c')]=0x0;this['talktime']=getSeconds(this[_0x6dbc('0x1d')],_0x289bd9[_0x6dbc('0x19')]);this[_0x6dbc('0x1e')]=_0x289bd9[_0x6dbc('0x1e')];this[_0x6dbc('0x1f')]=_0x6dbc('0x20');this[_0x6dbc('0x21')]=_0x3eb551[_0x6dbc('0x22')];this[_0x6dbc('0x23')]=_0x289bd9['callback'];this['callbackuniqueid']=_0x289bd9[_0x6dbc('0x24')];this['callbackat']=_0x289bd9[_0x6dbc('0x25')];this[_0x6dbc('0x26')]=_0x289bd9[_0x6dbc('0x26')];this[_0x6dbc('0x27')]=_0x289bd9['ContactId'];this[_0x6dbc('0x28')]=_0x289bd9[_0x6dbc('0x28')];this[_0x6dbc('0x29')]=_0x289bd9[_0x6dbc('0x29')];this[_0x6dbc('0x2a')]=_0x289bd9['VoiceQueueId'];this[_0x6dbc('0x2b')]=_0x289bd9[_0x6dbc('0x2b')];}module[_0x6dbc('0x2c')]=Hangup; \ No newline at end of file +var _0x8ba1=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','membername','IVR','reason','callback','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','diff','seconds','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x4711ee,_0x1e22f9){var _0x1d4992=function(_0x50ca35){while(--_0x50ca35){_0x4711ee['push'](_0x4711ee['shift']());}};_0x1d4992(++_0x1e22f9);}(_0x8ba1,0x164));var _0x18ba=function(_0x5301bb,_0x12f178){_0x5301bb=_0x5301bb-0x0;var _0x9ee1e5=_0x8ba1[_0x5301bb];return _0x9ee1e5;};'use strict';var util=require('util');var _=require(_0x18ba('0x0'));var moment=require(_0x18ba('0x1'));function getSeconds(_0x13ce70,_0x355a04){var _0x24ffcd=moment(_0x13ce70)['milliseconds'](0x0);var _0x33fdf3=moment(_0x355a04)['milliseconds'](0x0);return _0x24ffcd[_0x18ba('0x2')](_0x33fdf3,_0x18ba('0x3'));}function Hangup(_0x19c3f3,_0x495a0c){this[_0x18ba('0x4')]=0x4;this[_0x18ba('0x5')]=_0x18ba('0x6');this['scheduledat']=_0x19c3f3[_0x18ba('0x7')];this['type']=_0x19c3f3[_0x18ba('0x8')];this['campaigntype']=_0x19c3f3['type']===_0x18ba('0x9')?_0x18ba('0xa'):_0x19c3f3[_0x18ba('0x8')];this['countbusyretry']=_0x19c3f3[_0x18ba('0xb')];this['countcongestionretry']=_0x19c3f3[_0x18ba('0xc')];this[_0x18ba('0xd')]=_0x19c3f3[_0x18ba('0xd')];this[_0x18ba('0xe')]=_0x19c3f3[_0x18ba('0xb')]+_0x19c3f3[_0x18ba('0xc')]+_0x19c3f3['countnoanswerretry']+_0x19c3f3[_0x18ba('0xf')]+_0x19c3f3[_0x18ba('0x10')]+_0x19c3f3['countabandonedretry']+_0x19c3f3[_0x18ba('0x11')]+_0x19c3f3[_0x18ba('0x12')];this[_0x18ba('0xf')]=_0x19c3f3[_0x18ba('0xf')];this['countdropretry']=_0x19c3f3['countdropretry'];this[_0x18ba('0x13')]=_0x19c3f3['countabandonedretry'];this[_0x18ba('0x11')]=_0x19c3f3['countmachineretry'];this['countagentrejectretry']=_0x19c3f3[_0x18ba('0x12')];this[_0x18ba('0x14')]=_0x495a0c['uniqueid'];this[_0x18ba('0x15')]=_0x19c3f3[_0x18ba('0x16')];this[_0x18ba('0x17')]=_0x19c3f3[_0x18ba('0x18')];this['starttime']=_0x19c3f3['starttime'];this['responsetime']=_0x19c3f3[_0x18ba('0x19')];this[_0x18ba('0x1a')]=moment()['format'](_0x18ba('0x1b'));this[_0x18ba('0x1c')]=getSeconds(_0x19c3f3[_0x18ba('0x19')],_0x19c3f3[_0x18ba('0x1d')]);this['holdtime']=0x0;this['talktime']=getSeconds(this['endtime'],_0x19c3f3[_0x18ba('0x19')]);this['queue']=_0x19c3f3[_0x18ba('0xa')];this[_0x18ba('0x1e')]=_0x18ba('0x1f');this[_0x18ba('0x20')]=_0x495a0c['cause-txt'];this[_0x18ba('0x21')]=_0x19c3f3[_0x18ba('0x21')];this['callbackuniqueid']=_0x19c3f3['callbackuniqueid'];this[_0x18ba('0x22')]=_0x19c3f3['callbackat'];this[_0x18ba('0x23')]=_0x19c3f3[_0x18ba('0x23')];this['ContactId']=_0x19c3f3['ContactId'];this[_0x18ba('0x24')]=_0x19c3f3[_0x18ba('0x24')];this[_0x18ba('0x25')]=_0x19c3f3[_0x18ba('0x25')];this[_0x18ba('0x26')]=_0x19c3f3[_0x18ba('0x26')];this[_0x18ba('0x27')]=_0x19c3f3[_0x18ba('0x27')];}module[_0x18ba('0x28')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index c84300f..46aceed 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 _0x177d=['calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','diff','seconds','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x177d,0xcd));var _0xd177=function(_0x13b258,_0x3f748b){_0x13b258=_0x13b258-0x0;var _0x26eced=_0x177d[_0x13b258];return _0x26eced;};'use strict';var util=require(_0xd177('0x0'));var _=require(_0xd177('0x1'));var moment=require('moment');function getSeconds(_0x1c4c3f,_0x159c84){var _0x2cbc72=moment(_0x1c4c3f)['milliseconds'](0x0);var _0x23013c=moment(_0x159c84)['milliseconds'](0x0);return _0x2cbc72[_0xd177('0x2')](_0x23013c,_0xd177('0x3'));}function History(_0x1ec1d7){this['uniqueid']=_0x1ec1d7[_0xd177('0x4')];this['scheduledat']=_0x1ec1d7[_0xd177('0x5')]||undefined;this[_0xd177('0x6')]=_0x1ec1d7[_0xd177('0x6')];this['campaigntype']=_0x1ec1d7['type']==='outbound'?_0xd177('0x7'):_0x1ec1d7[_0xd177('0x6')];this[_0xd177('0x8')]=_0x1ec1d7[_0xd177('0x8')];this[_0xd177('0x9')]=_0x1ec1d7[_0xd177('0x9')];this[_0xd177('0xa')]=_0x1ec1d7[_0xd177('0xa')];this[_0xd177('0xb')]=_0x1ec1d7['countbusyretry']+_0x1ec1d7[_0xd177('0x9')]+_0x1ec1d7['countnoanswerretry']+_0x1ec1d7['countnosuchnumberretry']+_0x1ec1d7['countdropretry']+_0x1ec1d7[_0xd177('0xc')]+_0x1ec1d7[_0xd177('0xd')]+_0x1ec1d7[_0xd177('0xe')];this[_0xd177('0xf')]=_0x1ec1d7['countnosuchnumberretry'];this[_0xd177('0x10')]=_0x1ec1d7[_0xd177('0x10')];this['countabandonedretry']=_0x1ec1d7[_0xd177('0xc')];this[_0xd177('0xd')]=_0x1ec1d7[_0xd177('0xd')];this['countagentrejectretry']=_0x1ec1d7['countagentrejectretry'];this[_0xd177('0x7')]=_0x1ec1d7[_0xd177('0x7')];this[_0xd177('0x11')]=_0x1ec1d7[_0xd177('0x12')];this[_0xd177('0x13')]=_0x1ec1d7[_0xd177('0x14')];this[_0xd177('0x15')]=_0x1ec1d7[_0xd177('0x15')];this[_0xd177('0x16')]=_0x1ec1d7[_0xd177('0x16')];this[_0xd177('0x17')]=_0x1ec1d7[_0xd177('0x16')];this[_0xd177('0x18')]=getSeconds(_0x1ec1d7[_0xd177('0x16')],_0x1ec1d7['starttime']);this[_0xd177('0x19')]=0x0;this[_0xd177('0x1a')]=0x0;this[_0xd177('0x1b')]=_0x1ec1d7[_0xd177('0x1b')];this[_0xd177('0x1c')]=_0x1ec1d7[_0xd177('0x1c')];this['callbackat']=_0x1ec1d7['callbackat'];this[_0xd177('0x1d')]=_0x1ec1d7['recallme'];this[_0xd177('0x1e')]=_0x1ec1d7['ContactId'];this['ListId']=_0x1ec1d7['ListId'];this[_0xd177('0x1f')]=_0x1ec1d7['UserId'];this[_0xd177('0x20')]=_0x1ec1d7['VoiceQueueId'];this[_0xd177('0x21')]=_0x1ec1d7[_0xd177('0x21')];this['originatecalleridnum']=_0x1ec1d7[_0xd177('0x22')]||'';this['originatecalleridname']=_0x1ec1d7[_0xd177('0x23')]||'';}module[_0xd177('0x24')]=History; \ No newline at end of file +var _0x3c85=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','callback'];(function(_0x17371c,_0x1a1e9c){var _0x422265=function(_0x7b77ad){while(--_0x7b77ad){_0x17371c['push'](_0x17371c['shift']());}};_0x422265(++_0x1a1e9c);}(_0x3c85,0x113));var _0x53c8=function(_0xb46ab8,_0x13e831){_0xb46ab8=_0xb46ab8-0x0;var _0x48a733=_0x3c85[_0xb46ab8];return _0x48a733;};'use strict';var util=require(_0x53c8('0x0'));var _=require(_0x53c8('0x1'));var moment=require(_0x53c8('0x2'));function getSeconds(_0xbe3bfe,_0x165894){var _0x479db5=moment(_0xbe3bfe)[_0x53c8('0x3')](0x0);var _0x534941=moment(_0x165894)[_0x53c8('0x3')](0x0);return _0x479db5[_0x53c8('0x4')](_0x534941,_0x53c8('0x5'));}function History(_0x5f8bed){this[_0x53c8('0x6')]=_0x5f8bed['uniqueid'];this[_0x53c8('0x7')]=_0x5f8bed['scheduledat']||undefined;this[_0x53c8('0x8')]=_0x5f8bed[_0x53c8('0x8')];this[_0x53c8('0x9')]=_0x5f8bed[_0x53c8('0x8')]===_0x53c8('0xa')?_0x53c8('0xb'):_0x5f8bed['type'];this['countbusyretry']=_0x5f8bed[_0x53c8('0xc')];this[_0x53c8('0xd')]=_0x5f8bed[_0x53c8('0xd')];this[_0x53c8('0xe')]=_0x5f8bed[_0x53c8('0xe')];this[_0x53c8('0xf')]=_0x5f8bed[_0x53c8('0xc')]+_0x5f8bed[_0x53c8('0xd')]+_0x5f8bed['countnoanswerretry']+_0x5f8bed[_0x53c8('0x10')]+_0x5f8bed[_0x53c8('0x11')]+_0x5f8bed[_0x53c8('0x12')]+_0x5f8bed[_0x53c8('0x13')]+_0x5f8bed[_0x53c8('0x14')];this[_0x53c8('0x10')]=_0x5f8bed[_0x53c8('0x10')];this[_0x53c8('0x11')]=_0x5f8bed[_0x53c8('0x11')];this['countabandonedretry']=_0x5f8bed[_0x53c8('0x12')];this['countmachineretry']=_0x5f8bed[_0x53c8('0x13')];this[_0x53c8('0x14')]=_0x5f8bed['countagentrejectretry'];this[_0x53c8('0xb')]=_0x5f8bed[_0x53c8('0xb')];this[_0x53c8('0x15')]=_0x5f8bed[_0x53c8('0x16')];this[_0x53c8('0x17')]=_0x5f8bed[_0x53c8('0x18')];this['starttime']=_0x5f8bed[_0x53c8('0x19')];this[_0x53c8('0x1a')]=_0x5f8bed[_0x53c8('0x1a')];this['endtime']=_0x5f8bed[_0x53c8('0x1a')];this[_0x53c8('0x1b')]=getSeconds(_0x5f8bed[_0x53c8('0x1a')],_0x5f8bed[_0x53c8('0x19')]);this['holdtime']=0x0;this['talktime']=0x0;this['callback']=_0x5f8bed[_0x53c8('0x1c')];this['callbackuniqueid']=_0x5f8bed['callbackuniqueid'];this[_0x53c8('0x1d')]=_0x5f8bed[_0x53c8('0x1d')];this[_0x53c8('0x1e')]=_0x5f8bed[_0x53c8('0x1e')];this[_0x53c8('0x1f')]=_0x5f8bed[_0x53c8('0x1f')];this[_0x53c8('0x20')]=_0x5f8bed[_0x53c8('0x20')];this[_0x53c8('0x21')]=_0x5f8bed['UserId'];this[_0x53c8('0x22')]=_0x5f8bed['VoiceQueueId'];this[_0x53c8('0x23')]=_0x5f8bed['CampaignId'];this[_0x53c8('0x24')]=_0x5f8bed['originatecalleridnum']||'';this[_0x53c8('0x25')]=_0x5f8bed[_0x53c8('0x25')]||'';}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 774788a..ed4a17d 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 _0x0441=['outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','getQueue','callProgressDetecting','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','dropRate','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','emptyContact','Contact.phone','dialLimitQueue','getContactDialer','ACTIVE','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','not_inuse','[countReScheduled]\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]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\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','[busyFactor]','interval\x20=\x20','exports','util','lodash','bluebird','uuid','md5','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncOriginateResponse','syncAgentComplete','custom:queuesummary','syncHangup','newexten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','type','outbound','strategy','answered','pTalking','talking','total','unmanaged','abandoned','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','erlangAbandonmentRate','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','inspect','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','waiting','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','statedesc','endtime','starttime','prototype','[uniqueid]','clearZombieChannels','sequence','isNil','Action','catch','No\x20such\x20channel','updateOriginated','queue','countReScheduled','resolve','checkIsBlackList','then','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','saveInDb','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','status','reachable','SIP/%s','unmonitored','uniqueid','variable','xcally-motion-dialer','dialAMDActive','HANGUP','state','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','createStateFinal','add','YYYY-MM-DD\x20HH:mm:ss','ContactId','[syncHangupInAMDIvr][createHistory]','countglobal','amd','stateGlobal','dialMachineRetryFrequency','minutes','CampaignId','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','moveContactManagedDialer','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','Drop','dropreason','TIMEOUT','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','paused','stateinterface','locked','push','pick','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','interval','content','indexOf','true','iftime\x20%s,%s','all','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','power','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','loggedIn','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','pow','replace','random','match','actionOriginate','originate','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueTimeout','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','dialPrefix','substring','from-sip'];(function(_0x4e9bc3,_0x20b642){var _0x2d8f93=function(_0x4ce92a){while(--_0x4ce92a){_0x4e9bc3['push'](_0x4e9bc3['shift']());}};_0x2d8f93(++_0x20b642);}(_0x0441,0x8c));var _0x1044=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x0441[_0x3a2a3c];return _0x50ac9a;};'use strict';var util=require(_0x1044('0x0'));var _=require(_0x1044('0x1'));var BPromise=require(_0x1044('0x2'));var uuid=require(_0x1044('0x3'));var moment=require('moment');var rr=require('rr');var md5=require(_0x1044('0x4'));var Redis=require('ioredis');var ut=require(_0x1044('0x5'));var config=require(_0x1044('0x6'));var logger=require(_0x1044('0x7'))(_0x1044('0x8'));var loggerBooked=require(_0x1044('0x7'))(_0x1044('0x9'));var loggerPredictive=require(_0x1044('0x7'))(_0x1044('0xa'));var loggerPredictiveCalls=require(_0x1044('0x7'))(_0x1044('0xb'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x1044('0xc'));var ami=require(_0x1044('0xd'));config[_0x1044('0xe')]=_[_0x1044('0xf')](config[_0x1044('0xe')],{'host':_0x1044('0x10'),'port':0x18eb});var io=require(_0x1044('0x11'))(new Redis(config[_0x1044('0xe')]));var cmHopper=require(_0x1044('0x12'));var cmHopperHistory=require(_0x1044('0x13'));var cmHopperBlack=require(_0x1044('0x14'));var voiceQueueRt=require(_0x1044('0x15'));var Action=require(_0x1044('0x16'));var History=require(_0x1044('0x17'));var Final=require('./final');var AgentComplete=require(_0x1044('0x18'));var QueueCallerAbandon=require(_0x1044('0x19'));var Hangup=require(_0x1044('0x1a'));var ipAgi=process[_0x1044('0x1b')][_0x1044('0x1c')]||_0x1044('0x1d');var strategy={'rrmemory':_0x1044('0x1e'),'roundrobin':_0x1044('0x1f')};var Sequence=function(){};Sequence['prototype'][_0x1044('0x20')]=function(_0x166405){this[_0x1044('0x21')]=this[_0x1044('0x21')]?this[_0x1044('0x21')][_0x1044('0x22')](_0x166405):_0x166405();};function Dialer(_0x49e9ec,_0x1303f6){this['sequence']=new Sequence();this[_0x1044('0x23')]=_0x1303f6;this[_0x1044('0x24')]=_0x49e9ec[_0x1044('0x24')];this[_0x1044('0x25')]=_0x49e9ec[_0x1044('0x25')];this[_0x1044('0x26')]=_0x49e9ec[_0x1044('0x26')];this[_0x1044('0x27')]=_0x49e9ec[_0x1044('0x27')];this[_0x1044('0x28')]=config[_0x1044('0x28')]||0x2;this[_0x1044('0x29')]={};this[_0x1044('0x2a')]={};this[_0x1044('0x2b')]={};this[_0x1044('0x2c')]={};this[_0x1044('0x2d')]={};this[_0x1044('0x2e')]={};this[_0x1044('0x2f')]={};this[_0x1044('0x30')]={};this[_0x1044('0x31')]={};this[_0x1044('0x32')]={};ami['on'](_0x1044('0x33'),this[_0x1044('0x34')][_0x1044('0x35')](this));ami['on'](_0x1044('0x36'),this['syncQueueCallerAbandon'][_0x1044('0x35')](this));ami['on']('originateresponse',this[_0x1044('0x37')][_0x1044('0x35')](this));ami['on']('agentcomplete',this[_0x1044('0x38')]['bind'](this));ami['on'](_0x1044('0x39'),this['syncQueueSummary'][_0x1044('0x35')](this));ami['on']('hangup',this[_0x1044('0x3a')][_0x1044('0x35')](this));ami['on'](_0x1044('0x3b'),this['syncNewExten'][_0x1044('0x35')](this));ami['on']('varset',this[_0x1044('0x3c')][_0x1044('0x35')](this));ami['on'](_0x1044('0x3d'),this[_0x1044('0x3e')]['bind'](this));ami['on'](_0x1044('0x3f'),this[_0x1044('0x40')][_0x1044('0x35')](this));this[_0x1044('0x41')]();this[_0x1044('0x42')]();}function isNotNull(_0x5c4823){return _0x5c4823!==null&&!_[_0x1044('0x43')](_0x5c4823);}function checkIsLoggedIn(_0x1f59ee,_0x368487){return function(){if(_0x368487<=0x0){_0x1f59ee[_0x1044('0x44')]='AGENTS_NOT_LOGGED';throw _0x1f59ee['name']+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x1001ae){return _0x1001ae;}function checkIsActive(_0x13619a,_0x6ca50){return function(){if(!isActive(_0x6ca50)){_0x13619a[_0x1044('0x44')]=_0x1044('0x45');throw _0x13619a[_0x1044('0x46')]+_0x1044('0x47');}};}function checkInterval(_0x389404){return function(){if(!isNotNull(_0x389404[_0x1044('0x48')])){_0x389404[_0x1044('0x44')]=_0x1044('0x49');throw _0x389404['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x389404[_0x1044('0x48')][_0x1044('0x4a')])){_0x389404[_0x1044('0x44')]=_0x1044('0x49');throw _0x389404[_0x1044('0x46')]+_0x1044('0x4b');}if(!isNotNull(_['isEmpty'](_0x389404[_0x1044('0x48')]['Intervals']))){_0x389404[_0x1044('0x44')]=_0x1044('0x49');throw _0x389404[_0x1044('0x46')]+_0x1044('0x4b');}};}function msgResponse(_0x34f870,_0x18f343,_0x59929e){return{'action':_0x34f870,'response':_0x18f343,'message':_0x59929e,'stack':_0x59929e};}function myreject(_0x485cf8){return function(_0x2843c2){return _0x485cf8(msgResponse(_0x1044('0x4c'),_0x1044('0x4d'),JSON[_0x1044('0x4e')](_0x2843c2)));};}function getSeconds(_0x4357e8,_0x3bf48e){var _0x4cbc3b=moment(_0x4357e8)['milliseconds'](0x0);var _0x54461d=moment(_0x3bf48e)[_0x1044('0x4f')](0x0);return _0x4cbc3b[_0x1044('0x50')](_0x54461d,_0x1044('0x51'));}function emit(_0x3538d0,_0x49f370,_0x2d84a9){io['to'](_0x3538d0)['emit'](_0x49f370,_0x2d84a9);}function emitVoiceQueueSummary(_0x4be5f1){if(_0x4be5f1[_0x1044('0x52')]===_0x1044('0x53')){var _0xcca54b={'id':_0x4be5f1['id'],'name':_0x4be5f1[_0x1044('0x46')],'strategy':_0x4be5f1[_0x1044('0x54')],'answered':_0x4be5f1[_0x1044('0x55')],'available':_0x4be5f1['available'],'loggedIn':_0x4be5f1['loggedIn'],'pTalking':_0x4be5f1[_0x1044('0x56')],'sumBillable':_0x4be5f1['sumBillable'],'sumDuration':_0x4be5f1['sumDuration'],'sumHoldTime':_0x4be5f1['sumHoldTime']||0x0,'talking':_0x4be5f1[_0x1044('0x57')],'total':_0x4be5f1[_0x1044('0x58')],'type':_0x4be5f1[_0x1044('0x52')],'unmanaged':_0x4be5f1[_0x1044('0x59')],'abandoned':_0x4be5f1[_0x1044('0x5a')],'waiting':_0x4be5f1['waiting'],'loggedInDb':_0x4be5f1['loggedInDb'],'dialActive':_0x4be5f1[_0x1044('0x5b')],'dialMethod':_0x4be5f1[_0x1044('0x5c')],'dialOriginateCallerIdName':_0x4be5f1[_0x1044('0x5d')],'dialOriginateCallerIdNumber':_0x4be5f1[_0x1044('0x5e')],'dialOriginateTimeout':_0x4be5f1[_0x1044('0x5f')],'dialPrefix':_0x4be5f1['dialPrefix'],'outboundAnswerAgiCallsDay':_0x4be5f1[_0x1044('0x60')],'outboundAnswerCallsDay':_0x4be5f1[_0x1044('0x61')],'outboundBlacklistCallsDay':_0x4be5f1[_0x1044('0x62')],'outboundBusyCallsDay':_0x4be5f1[_0x1044('0x63')],'outboundCongestionCallsDay':_0x4be5f1[_0x1044('0x64')],'outboundDropCallsDayACS':_0x4be5f1[_0x1044('0x65')],'outboundDropCallsDayCallersExit':_0x4be5f1[_0x1044('0x66')],'outboundDropCallsDayTimeout':_0x4be5f1[_0x1044('0x67')],'outboundNoAnswerCallsDay':_0x4be5f1[_0x1044('0x68')],'outboundNoSuchCallsDay':_0x4be5f1[_0x1044('0x69')],'outboundOriginateFailureCallsDay':_0x4be5f1['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x4be5f1[_0x1044('0x6a')],'outboundRejectCallsDay':_0x4be5f1['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x4be5f1[_0x1044('0x6b')],'predictiveIntervalAnsweredCalls':_0x4be5f1[_0x1044('0x6c')],'predictiveIntervalAvgHoldtime':_0x4be5f1['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x4be5f1[_0x1044('0x6d')],'predictiveIntervalDroppedCallsCallersExit':_0x4be5f1[_0x1044('0x6e')],'predictiveIntervalDroppedCallsTimeout':_0x4be5f1[_0x1044('0x6f')],'predictiveIntervalErlangCalls':_0x4be5f1['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x4be5f1['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x4be5f1[_0x1044('0x70')],'predictiveIntervalMultiplicativeFactor':_0x4be5f1[_0x1044('0x71')],'predictiveIntervalPauses':_0x4be5f1['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x4be5f1[_0x1044('0x72')],'predictiveIntervalTotalCalls':_0x4be5f1['predictiveIntervalTotalCalls'],'message':_0x4be5f1[_0x1044('0x44')],'originated':_0x4be5f1[_0x1044('0x73')],'erlangCalls':_0x4be5f1[_0x1044('0x74')],'erlangCallToSecond':_0x4be5f1[_0x1044('0x75')],'erlangAbandonmentRate':_0x4be5f1['erlangAbandonmentRate'],'erlangBusyFactor':_0x4be5f1['erlangBusyFactor'],'startPredictive':_0x4be5f1[_0x1044('0x2e')],'startProgressive':_0x4be5f1[_0x1044('0x2f')]};if(_0x4be5f1[_0x1044('0x76')]){_0xcca54b[_0x1044('0x76')]={'id':_0x4be5f1[_0x1044('0x76')]['id'],'name':_0x4be5f1['Trunk']['name'],'active':_0x4be5f1['Trunk'][_0x1044('0x77')],'callerid':_0x4be5f1['Trunk'][_0x1044('0x78')]};}if(_0x4be5f1[_0x1044('0x48')]){_0xcca54b['Interval']={'id':_0x4be5f1[_0x1044('0x48')]['id'],'name':_0x4be5f1['Interval'][_0x1044('0x46')]};}var _0x34672c=md5(JSON[_0x1044('0x4e')](_0xcca54b));if(_0x4be5f1[_0x1044('0x4')]!==_0x34672c){_0x4be5f1[_0x1044('0x4')]=_0x34672c;emit(util[_0x1044('0x79')](_0x1044('0x7a'),_0xcca54b[_0x1044('0x46')]),_0x1044('0x7b'),_0xcca54b);}}}function emitCampaignSummary(_0x449de6){if(_0x449de6['type']==='ivr'){emit(util[_0x1044('0x79')](_0x1044('0x7c'),_0x449de6[_0x1044('0x46')]),'campaign:save',_0x449de6);}}function checkGetDataPredictive(_0x58d64e){if(isNotNull(_0x58d64e)&&!_[_0x1044('0x7d')](_0x58d64e)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x1044('0x7e')](_0x1044('0x7f'),_0x58d64e[_0x1044('0x80')]);loggerPredictive['info'](_0x1044('0x81'),_0x58d64e[_0x1044('0x6c')]);loggerPredictive[_0x1044('0x7e')](_0x1044('0x82'),_0x58d64e[_0x1044('0x6f')]);loggerPredictive[_0x1044('0x7e')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58d64e[_0x1044('0x6e')]);loggerPredictive[_0x1044('0x7e')](_0x1044('0x83'),_0x58d64e[_0x1044('0x84')]);loggerPredictive['info'](_0x1044('0x85'),_0x58d64e[_0x1044('0x6d')]);loggerPredictive[_0x1044('0x7e')](_0x1044('0x86'));if(_0x58d64e[_0x1044('0x80')]>0x0){if(!_['isUndefined'](_0x58d64e['predictiveIntervalAvgTalktime'])&&_0x58d64e['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x1044('0x7e')](_0x1044('0x87'));if(!_['isUndefined'](_0x58d64e[_0x1044('0x84')])&&_0x58d64e[_0x1044('0x84')]>0x0){return!![];}loggerPredictive[_0x1044('0x7e')](_0x1044('0x88'));}else{loggerPredictive['info'](_0x1044('0x89'));}}else{loggerPredictive['info'](_0x1044('0x8a'));}return![];}function mergeDataErlangB(_0x720094){return function(_0x437f1c){loggerPredictive['info'](_0x1044('0x8b'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x437f1c[_0x1044('0x74')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x437f1c[_0x1044('0x75')]);loggerPredictive[_0x1044('0x7e')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x437f1c['erlangAbandonmentRate']);loggerPredictive[_0x1044('0x7e')](_0x1044('0x8c'),_0x437f1c[_0x1044('0x8d')]);loggerPredictive[_0x1044('0x7e')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x437f1c[_0x1044('0x8e')]);loggerPredictive['info'](_0x1044('0x86'));_[_0x1044('0x8f')](_0x720094,_0x437f1c);};}function getDiff(_0x1f3005){var _0xf180a2=moment()[_0x1044('0x4f')](0x0);var _0x232665=moment(_0x1f3005)[_0x1044('0x4f')](0x0);return _0xf180a2[_0x1044('0x50')](_0x232665,_0x1044('0x51'));}function ifInterval(_0x49048e,_0x34977b){if(_[_0x1044('0x43')](_0x34977b)){return![];}return getDiff(_0x34977b)<_0x49048e*0x3c;}function freeVariablesPredictive(_0x26b4a9){if(isNotNull(_0x26b4a9)){if(!_[_0x1044('0x43')](_0x26b4a9[_0x1044('0x2f')])){_0x26b4a9[_0x1044('0x2f')]=undefined;loggerPredictive['info'](_0x26b4a9[_0x1044('0x46')],_0x1044('0x90'));}if(!_['isUndefined'](_0x26b4a9['startPredictive'])){_0x26b4a9[_0x1044('0x2e')]=undefined;loggerPredictive[_0x1044('0x7e')](_0x26b4a9[_0x1044('0x46')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x1044('0x43')](_0x26b4a9[_0x1044('0x91')])){clearInterval(_0x26b4a9[_0x1044('0x91')]);_0x26b4a9['handlePredictive']=undefined;loggerPredictive[_0x1044('0x7e')](_0x26b4a9[_0x1044('0x46')],_0x1044('0x92'));}}}function erlangb(_0x131489,_0xab2e47){if(_0xab2e47===0x0){return 0x0;}var _0x3ff23e=0x1;for(var _0x174501=0x1;_0x174501<=_0xab2e47;_0x174501+=0x1){_0x3ff23e=0x1+_0x3ff23e*_0x174501/_0x131489;}return 0x1/_0x3ff23e;}function isVoiceQueueOutbound(_0x5d9bd0){return _0x5d9bd0==='outbound';}function isNotPreview(_0x51921e){return _0x51921e!==_0x1044('0x23');}function isCampaignIvr(_0x3e6423){return _0x3e6423===_0x1044('0x93');}function getCallerId(_0x417f09,_0x2b152b,_0x295316){if(!_[_0x1044('0x43')](_0x295316)&&typeof _0x295316===_0x1044('0x94')&&!_[_0x1044('0x7d')](_0x295316)){if(!_[_0x1044('0x43')](_0x2b152b)&&typeof _0x2b152b===_0x1044('0x94')&&!_[_0x1044('0x7d')](_0x2b152b)){return util[_0x1044('0x79')](_0x1044('0x95'),_0x2b152b,_0x295316);}return util[_0x1044('0x79')](_0x1044('0x95'),_0x295316,_0x295316);}if(!_[_0x1044('0x43')](_0x417f09)&&typeof _0x417f09===_0x1044('0x94')&&!_[_0x1044('0x7d')](_0x417f09)){return _0x417f09;}return _0x1044('0x96');}function loggerCatchQueueSummary(_0x382231,_0x2c7c01){return function(_0x2cf1ea){freeVariablesPredictive(_0x2c7c01);emitVoiceQueueSummary(_0x2c7c01);emitCampaignSummary(_0x2c7c01);loggerSyncQueueSummary[_0x1044('0x97')](_0x382231,util['inspect'](_0x2cf1ea,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x31655a,_0x1dd696){return function(_0x3d7519){loggerPredictive[_0x1044('0x97')](_0x1dd696[_0x1044('0x46')],_0x31655a);loggerPredictive[_0x1044('0x97')](_0x3d7519[_0x1044('0x98')]);freeVariablesPredictive(_0x1dd696);};}function loggerCatch(_0x5c4709){return function(_0x3497e1){logger['error'](_0x5c4709,util['inspect'](_0x3497e1,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1f854a){return _0x1f854a&&!_[_0x1044('0x43')](_0x1f854a)&&_0x1f854a[_0x1044('0x99')]>0x0;}function decremetOriginate(_0x4618f3){if(!_[_0x1044('0x43')](_0x4618f3)&&_0x4618f3!==null){if(typeof _0x4618f3[_0x1044('0x73')]!==_0x1044('0x9a')){if(_0x4618f3[_0x1044('0x73')]>0x0){_0x4618f3['originated']-=0x1;}else{logger[_0x1044('0x97')](_0x1044('0x9b'));}}}else{logger[_0x1044('0x97')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x351663,_0x2d31ea,_0x45c814){if(_0x2d31ea>_0x45c814){for(var _0x15df52=0x0;_0x15df52<_0x2d31ea-_0x45c814;_0x15df52+=0x1){decremetOriginate(_0x351663);}}}function loggerGetContactDialer(_0x4eaa77,_0x58813a,_0x5eced8){return function(_0x30c937){checkContactLowerLimitOriginate(_0x58813a,_0x5eced8,0x0);logger[_0x1044('0x97')](_0x4eaa77,util[_0x1044('0x9c')](_0x30c937,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x39a18d){return function(_0x2dfa61){if(isNotNull(_0x2dfa61)&&isNotNull(_0x2dfa61[0x0])){if(_0x2dfa61[0x0]['contactsRescheduled']>0x0){_0x39a18d[_0x1044('0x44')]='RESCHEDULED_CONTACTS';logger['info']('[getContactDialer2][ReScheduled]'+_0x39a18d[_0x1044('0x46')],_0x2dfa61[0x0]['contactsRescheduled'],_0x1044('0x9d'));}else{_0x39a18d[_0x1044('0x44')]=_0x1044('0x9e');logger[_0x1044('0x7e')](_0x1044('0x9f')+_0x39a18d[_0x1044('0x46')]);}}};}function notSendMessagesQueue(_0x50260f){if(_0x50260f[_0x1044('0xa0')]){freeVariablesPredictive(_0x50260f);if(_0x50260f['originated']===0x0&&_0x50260f['talking']===0x0&&_0x50260f[_0x1044('0xa1')]===0x0&&(_0x50260f[_0x1044('0x56')]||0x0)===0x0){_0x50260f[_0x1044('0xa0')]=![];_0x50260f[_0x1044('0xa2')]=0x0;_0x50260f[_0x1044('0x44')]=_0x1044('0x45');loggerSyncQueueSummary['error'](_0x1044('0xa3'),_0x50260f[_0x1044('0x46')],_0x1044('0xa4'));}else{_0x50260f[_0x1044('0x44')]='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0x1044('0xa3'),_0x50260f[_0x1044('0x46')],_0x1044('0xa5'));}emitVoiceQueueSummary(_0x50260f);}}function notSendMessagesCampaign(_0x5c91b0){if(_0x5c91b0[_0x1044('0xa0')]){if(_0x5c91b0[_0x1044('0x73')]===0x0){_0x5c91b0[_0x1044('0xa0')]=![];_0x5c91b0[_0x1044('0x44')]=_0x1044('0x45');loggerSyncQueueSummary[_0x1044('0x97')](_0x1044('0xa6'),_0x5c91b0[_0x1044('0x46')],_0x1044('0xa4'));}else{_0x5c91b0[_0x1044('0x44')]=_0x1044('0xa7');loggerSyncQueueSummary['error'](_0x1044('0xa6'),_0x5c91b0[_0x1044('0x46')],'is\x20disactive');}emitCampaignSummary(_0x5c91b0);}}function createObjHistory(_0x498c58,_0x58cf17,_0x3c173f,_0x25415e,_0x548cf9){_0x498c58[_0x1044('0x44')]=_0x3c173f;var _0x5d7223=new Action(_0x498c58,_0x58cf17);var _0x5e5de2=new History(_0x5d7223);_0x5e5de2['state']=_0x25415e;_0x5e5de2[_0x1044('0xa8')]=_0x548cf9;_0x5e5de2[_0x1044('0xa9')]=_0x5d7223[_0x1044('0xaa')];return _0x5e5de2;}Dialer[_0x1044('0xab')][_0x1044('0x42')]=function(){var _0x297199=this;setInterval(function(){_0x297199['clearZombieChannels'](_0x297199[_0x1044('0x2c')],_0x1044('0xac'));_0x297199[_0x1044('0xad')](_0x297199[_0x1044('0x2a')],'[actions]');},0x32c8);};Dialer[_0x1044('0xab')]['clearZombieChannels']=function(_0x5dfb27,_0x2e7f59){var _0x31a176=this;for(var _0x2351e4 in _0x5dfb27){if(typeof _0x5dfb27[_0x2351e4]!==_0x1044('0x9a')){this[_0x1044('0xae')][_0x1044('0x20')](function(){if(!_[_0x1044('0xaf')](_0x5dfb27[_0x2351e4])){return ami[_0x1044('0xb0')]({'action':'status','channel':_0x5dfb27[_0x2351e4]['channel']})[_0x1044('0xb1')](function(_0x21b0f5){if(_0x21b0f5['message']===_0x1044('0xb2')){setTimeout(function(){if(_0x5dfb27[_0x2351e4]&&_0x5dfb27[_0x2351e4][_0x1044('0x52')]!==_0x1044('0x93')){_0x31a176[_0x1044('0xb3')](_0x31a176[_0x1044('0x24')][_0x5dfb27[_0x2351e4][_0x1044('0xb4')]]);logger[_0x1044('0x97')]('[Dialer][checkChannel]',_0x2e7f59,_0x2351e4,_0x5dfb27[_0x2351e4][_0x1044('0xb4')]);delete _0x5dfb27[_0x2351e4];}if(_0x5dfb27[_0x2351e4]&&_0x5dfb27[_0x2351e4]['type']===_0x1044('0x93')){_0x31a176[_0x1044('0xb3')](_0x31a176[_0x1044('0x25')][_0x5dfb27[_0x2351e4][_0x1044('0xb4')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x2e7f59,_0x2351e4,_0x5dfb27[_0x2351e4][_0x1044('0xb4')]);delete _0x5dfb27[_0x2351e4];}},0x2328);}});}});}}};Dialer[_0x1044('0xab')][_0x1044('0xb5')]=function(_0x4836bf){return BPromise[_0x1044('0xb6')]()['then'](cmHopper['countReScheduled'](_0x4836bf))[_0x1044('0xb1')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x1044('0xab')][_0x1044('0xb7')]=function(_0x51871){return BPromise['resolve']()[_0x1044('0xb8')](cmHopperBlack[_0x1044('0xb7')](_0x51871))[_0x1044('0xb1')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x1044('0xab')][_0x1044('0xb9')]=function(_0x38066d){return BPromise[_0x1044('0xb6')]()['then'](cmHopperBlack[_0x1044('0xb9')](_0x38066d))['catch'](loggerCatch(_0x1044('0xba')));};Dialer[_0x1044('0xab')][_0x1044('0xbb')]=function(_0x119854){return BPromise[_0x1044('0xb6')]()[_0x1044('0xb8')](cmHopperHistory['avgHandleTime'](_0x119854))[_0x1044('0xb1')](loggerCatch(_0x1044('0xbc')));};Dialer['prototype'][_0x1044('0xbd')]=function(_0x5ee192){return BPromise[_0x1044('0xb6')]()['then'](cmHopper[_0x1044('0xbd')](_0x5ee192))['catch'](loggerCatch(_0x1044('0xbe')));};Dialer[_0x1044('0xab')][_0x1044('0xbf')]=function(_0x3f88fb,_0x34bc31,_0x4aa916){return BPromise[_0x1044('0xb6')]()['then'](cmHopper['unlockContact'](_0x3f88fb,_0x34bc31,_0x4aa916))['catch'](loggerCatch('[unlockContact]\x20'));};Dialer[_0x1044('0xab')]['getContactDialer']=function(_0x1ab525,_0x9a6c7e,_0x368705,_0xb300bc){return BPromise[_0x1044('0xb6')]()[_0x1044('0xb8')](cmHopper['getContactDialer'](_0x1ab525,_0x9a6c7e,_0x368705,_0xb300bc))['catch'](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x1044('0xab')][_0x1044('0xc0')]=function(_0x43fa50,_0x45213f,_0x29b88f){return BPromise[_0x1044('0xb6')]()[_0x1044('0xb8')](cmHopper[_0x1044('0xc0')](_0x43fa50,_0x45213f,_0x29b88f))['catch'](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x1044('0xab')][_0x1044('0xc1')]=function(_0x191f15){return BPromise[_0x1044('0xb6')]()[_0x1044('0xb8')](voiceQueueRt[_0x1044('0xc1')](_0x191f15))[_0x1044('0xb1')](loggerCatch(_0x1044('0xc2')));};Dialer['prototype']['moveContactManagedDialer']=function(_0x44ea24){return BPromise[_0x1044('0xb6')]()['then'](cmHopper['moveContactManagedDialer'](_0x44ea24))['catch'](loggerCatch(_0x1044('0xc3')));};Dialer['prototype'][_0x1044('0xc4')]=function(_0x50b368){return BPromise[_0x1044('0xb6')]()['then'](cmHopperHistory['createHistory'](_0x50b368))['catch'](loggerCatch(_0x1044('0xc5')));};Dialer[_0x1044('0xab')][_0x1044('0xb3')]=function(_0x46b2c8){if(!_[_0x1044('0x43')](_0x46b2c8)&&_0x46b2c8!==null){if(typeof _0x46b2c8[_0x1044('0x73')]!==_0x1044('0x9a')){if(_0x46b2c8[_0x1044('0x73')]>0x0){_0x46b2c8[_0x1044('0x73')]-=0x1;}else{logger[_0x1044('0x97')](_0x1044('0xc6'));}}}else{logger[_0x1044('0x97')](_0x1044('0xc7'));}};Dialer[_0x1044('0xab')][_0x1044('0xc8')]=function(_0x4331f7,_0x1baa0a){var _0x48313b=this;return function(_0x5afabe){_0x48313b[_0x1044('0xb3')](_0x1baa0a);logger[_0x1044('0x97')](_0x4331f7,util['inspect'](_0x5afabe,{'showHidden':![],'depth':null}));};};Dialer[_0x1044('0xab')]['emptyContact']=function(_0x13f677,_0x5a2452,_0xd5ea70){var _0x10f384={'state':0x19,'statedesc':'notFound'};this[_0x1044('0xb3')](_0x5a2452);this[_0x1044('0xc9')](_[_0x1044('0x8f')](_0x10f384,_['pick'](_0xd5ea70,['ContactId',_0x1044('0xca'),_0x1044('0xcb'),_0x1044('0xcc'),'CampaignId'])),_0x1044('0xcd'),_0x1044('0xce'));logger[_0x1044('0x97')](_0x13f677);};Dialer[_0x1044('0xab')][_0x1044('0xcf')]=function(_0x2189e4){return _0x2189e4==='Success';};Dialer[_0x1044('0xab')][_0x1044('0xd0')]=function(_0x58c201){return!_[_0x1044('0x43')](_0x58c201)&&_0x58c201&&!_[_0x1044('0x43')](_0x58c201[_0x1044('0x46')])&&!_[_0x1044('0x43')](_0x58c201[_0x1044('0x77')])&&_0x58c201[_0x1044('0x77')]&&(this[_0x1044('0x27')][util[_0x1044('0x79')]('SIP/%s',_0x58c201[_0x1044('0x46')])][_0x1044('0xd1')]===_0x1044('0xd2')||this[_0x1044('0x27')][util['format'](_0x1044('0xd3'),_0x58c201[_0x1044('0x46')])]['status']===_0x1044('0xd4'));};Dialer[_0x1044('0xab')]['saveInDb']=function(_0x571590,_0x29693c,_0x2a8b93){this['createHistory'](_0x571590)['catch'](loggerCatch(_0x29693c));this['moveContactManagedDialer'](_0x571590)['catch'](loggerCatch(_0x2a8b93));};Dialer['prototype'][_0x1044('0x3c')]=function(_0x4fa82b){var _0x497bc0=this[_0x1044('0x2c')][_0x4fa82b[_0x1044('0xd5')]];var _0xa17eaf;if(!_[_0x1044('0xaf')](_0x4fa82b)&&!_[_0x1044('0xaf')](_0x4fa82b[_0x1044('0xd6')])&&!_[_0x1044('0xaf')](_0x4fa82b[_0x1044('0xd6')]['amdstatus'])&&_0x4fa82b['exten']===_0x1044('0xd7')&&_0x497bc0){if(_0x497bc0[_0x1044('0x52')]!==_0x1044('0x93')&&this[_0x1044('0x24')][_0x497bc0[_0x1044('0xb4')]][_0x1044('0xd8')]&&_0x4fa82b['value']===_0x1044('0xd9')){delete this['uniqueId'][_0x4fa82b[_0x1044('0xd5')]];this['updateOriginated'](this['voiceQueues'][_0x497bc0[_0x1044('0xb4')]]);this[_0x1044('0x24')][_0x497bc0[_0x1044('0xb4')]][_0x1044('0x61')]+=0x1;this[_0x1044('0x24')][_0x497bc0[_0x1044('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;_0xa17eaf=new Hangup(_0x497bc0,_0x4fa82b);_0xa17eaf[_0x1044('0xda')]=0x12;_0xa17eaf['statedesc']=_0x1044('0xdb');_0xa17eaf[_0x1044('0xdc')]=_0x1044('0xdd');this[_0x1044('0xc9')](_0xa17eaf,_0x1044('0xde'),_0x1044('0xdf'));}if(_0x497bc0[_0x1044('0x52')]!==_0x1044('0x93')&&this['voiceQueues'][_0x497bc0['queue']][_0x1044('0xd8')]&&_0x4fa82b[_0x1044('0xe0')]===_0x1044('0xe1')){var _0x5a25a3=this;return new BPromise(function(_0x4fab63,_0x2814c0){delete _0x5a25a3[_0x1044('0x2c')][_0x4fa82b[_0x1044('0xd5')]];_0x5a25a3[_0x1044('0xb3')](_0x5a25a3['voiceQueues'][_0x497bc0[_0x1044('0xb4')]]);_0x5a25a3[_0x1044('0x24')][_0x497bc0[_0x1044('0xb4')]][_0x1044('0x61')]+=0x1;_0x5a25a3['voiceQueues'][_0x497bc0[_0x1044('0xb4')]][_0x1044('0x60')]+=0x1;var _0x83f453=_0x5a25a3['voiceQueues'][_0x497bc0[_0x1044('0xb4')]];var _0x1bc52d=new Hangup(_0x497bc0,_0x4fa82b);_0x1bc52d[_0x1044('0xda')]=0x13;_0x1bc52d['statedesc']=_0x1044('0xe2');_0x1bc52d[_0x1044('0xdc')]='AMD';_0x1bc52d['countmachineretry']+=0x1;_0x1bc52d['countglobal']+=0x1;_0x1bc52d['amd']=!![];_0x5a25a3['createHistory'](_0x1bc52d)[_0x1044('0xb1')](loggerCatch(_0x1044('0xe3')));if(_0x1bc52d[_0x1044('0xe4')]+_0x1bc52d[_0x1044('0xe5')]+_0x1bc52d[_0x1044('0xe6')]+_0x1bc52d[_0x1044('0xe7')]+_0x1bc52d[_0x1044('0xe8')]+_0x1bc52d[_0x1044('0xe9')]+_0x1bc52d[_0x1044('0xea')]+_0x1bc52d[_0x1044('0xeb')]>=_0x83f453[_0x1044('0xec')]){_0x5a25a3['stateGlobal'](_0x1bc52d,_0x4fab63,_0x2814c0,_0x1044('0xed'));}else{if(_0x1bc52d[_0x1044('0xea')]>=_0x83f453['dialMachineMaxRetry']){_0x5a25a3[_0x1044('0xee')](_0x1bc52d,_0x4fab63,_0x2814c0,'reason\x2019\x20machine....');}else{_0x5a25a3[_0x1044('0xbd')]({'active':![],'countmachineretry':_0x1bc52d[_0x1044('0xea')],'scheduledat':moment()[_0x1044('0xef')](_0x83f453['dialMachineRetryFrequency'],'minutes')[_0x1044('0x79')](_0x1044('0xf0')),'ContactId':_0x1bc52d[_0x1044('0xf1')],'ListId':_0x1bc52d[_0x1044('0xca')],'VoiceQueueId':_0x1bc52d[_0x1044('0xcc')]||undefined,'CampaignId':_0x1bc52d['CampaignId']||undefined})[_0x1044('0xb1')](loggerCatch('[rescheduleContact][Machine]'));_0x4fab63({'reschedule':0x1});}}});}if(_0x497bc0[_0x1044('0x52')]===_0x1044('0x93')&&this['campaigns'][_0x497bc0[_0x1044('0xb4')]][_0x1044('0xd8')]&&_0x4fa82b[_0x1044('0xe0')]===_0x1044('0xd9')){delete this[_0x1044('0x2c')][_0x4fa82b[_0x1044('0xd5')]];this[_0x1044('0xb3')](this[_0x1044('0x25')][_0x497bc0[_0x1044('0xb4')]]);_0xa17eaf=new Hangup(_0x497bc0,_0x4fa82b);_0xa17eaf[_0x1044('0xda')]=0x12;_0xa17eaf['statedesc']='HangupInAMD';_0xa17eaf[_0x1044('0xdc')]=_0x1044('0xdd');this[_0x1044('0xc9')](_0xa17eaf,_0x1044('0xf2'),'[syncHangupInAMDIvr]');}if(_0x497bc0[_0x1044('0x52')]===_0x1044('0x93')&&this[_0x1044('0x25')][_0x497bc0[_0x1044('0xb4')]][_0x1044('0xd8')]&&_0x4fa82b[_0x1044('0xe0')]===_0x1044('0xe1')){var _0x5a25a3=this;return new BPromise(function(_0xc42593,_0x4f56de){delete _0x5a25a3[_0x1044('0x2c')][_0x4fa82b[_0x1044('0xd5')]];_0x5a25a3[_0x1044('0xb3')](_0x5a25a3['campaigns'][_0x497bc0['queue']]);_0x5a25a3[_0x1044('0x25')][_0x497bc0[_0x1044('0xb4')]][_0x1044('0x61')]+=0x1;_0x5a25a3['campaigns'][_0x497bc0[_0x1044('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x1dae4b=_0x5a25a3[_0x1044('0x25')][_0x497bc0[_0x1044('0xb4')]];var _0x4f5c1e=new Hangup(_0x497bc0,_0x4fa82b);_0x4f5c1e['state']=0x13;_0x4f5c1e['statedesc']=_0x1044('0xe2');_0x4f5c1e[_0x1044('0xdc')]=_0x1044('0xdd');_0x4f5c1e[_0x1044('0xea')]+=0x1;_0x4f5c1e[_0x1044('0xf3')]+=0x1;_0x4f5c1e[_0x1044('0xf4')]=!![];_0x5a25a3['createHistory'](_0x4f5c1e)[_0x1044('0xb1')](loggerCatch(_0x1044('0xe3')));if(_0x4f5c1e[_0x1044('0xe4')]+_0x4f5c1e[_0x1044('0xe5')]+_0x4f5c1e[_0x1044('0xe6')]+_0x4f5c1e[_0x1044('0xe7')]+_0x4f5c1e[_0x1044('0xe8')]+_0x4f5c1e['countabandonedretry']+_0x4f5c1e[_0x1044('0xea')]+_0x4f5c1e[_0x1044('0xeb')]>=_0x1dae4b[_0x1044('0xec')]){_0x5a25a3[_0x1044('0xf5')](_0x4f5c1e,_0xc42593,_0x4f56de,_0x1044('0xed'));}else{if(_0x4f5c1e[_0x1044('0xea')]>=_0x1dae4b['dialMachineMaxRetry']){_0x5a25a3['createStateFinal'](_0x4f5c1e,_0xc42593,_0x4f56de,'reason\x2019\x20machine....');}else{_0x5a25a3['rescheduleContact']({'active':![],'countmachineretry':_0x4f5c1e[_0x1044('0xea')],'scheduledat':moment()[_0x1044('0xef')](_0x1dae4b[_0x1044('0xf6')],_0x1044('0xf7'))[_0x1044('0x79')](_0x1044('0xf0')),'ContactId':_0x4f5c1e[_0x1044('0xf1')],'ListId':_0x4f5c1e[_0x1044('0xca')],'VoiceQueueId':_0x4f5c1e[_0x1044('0xcc')]||undefined,'CampaignId':_0x4f5c1e[_0x1044('0xf8')]||undefined})[_0x1044('0xb1')](loggerCatch(_0x1044('0xf9')));_0xc42593({'reschedule':0x1});}}});}}};Dialer[_0x1044('0xab')][_0x1044('0x3a')]=function(_0x1855e5){var _0x4b4dae=this[_0x1044('0x2c')][_0x1855e5[_0x1044('0xd5')]];var _0xfe80c=this;var _0x2534ad;if(_0x4b4dae&&_0x4b4dae[_0x1044('0x52')]==='ivr'){delete this[_0x1044('0x2c')][_0x1855e5[_0x1044('0xd5')]];this[_0x1044('0xb3')](this[_0x1044('0x25')][_0x4b4dae['queue']]);this[_0x1044('0x25')][_0x4b4dae[_0x1044('0xb4')]][_0x1044('0xfa')]+=0x1;_0x2534ad=new Hangup(_0x4b4dae,_0x1855e5);this[_0x1044('0xc4')](_0x2534ad)[_0x1044('0xb1')](loggerCatch(_0x1044('0xfb')));this['moveContactManagedDialer'](_0x2534ad)[_0x1044('0xb1')](loggerCatch(_0x1044('0xfc')));}if(_0x4b4dae&&_0x4b4dae['type']!==_0x1044('0x93')&&isNotNull(this[_0x1044('0x24')][_0x4b4dae[_0x1044('0xb4')]][_0x1044('0xfd')])){delete this['uniqueId'][_0x1855e5['uniqueid']];this[_0x1044('0xb3')](this[_0x1044('0x24')][_0x4b4dae['queue']]);this[_0x1044('0x24')][_0x4b4dae[_0x1044('0xb4')]][_0x1044('0x61')]+=0x1;this['voiceQueues'][_0x4b4dae['queue']][_0x1044('0x60')]+=0x1;_0x2534ad=new Hangup(_0x4b4dae,_0x1855e5);_0x2534ad['state']=0x10;_0x2534ad[_0x1044('0xa8')]=_0x1044('0xfe');_0x2534ad[_0x1044('0xdc')]='AGI';this['createHistory'](_0x2534ad)[_0x1044('0xb1')](loggerCatch(_0x1044('0xfb')));this[_0x1044('0xff')](_0x2534ad)[_0x1044('0xb1')](loggerCatch(_0x1044('0xfc')));}if(_0x4b4dae&&_0x4b4dae['type']!==_0x1044('0x93')&&!isNotNull(this['voiceQueues'][_0x4b4dae[_0x1044('0xb4')]]['dialQueueProject'])){delete this[_0x1044('0x2c')][_0x1855e5[_0x1044('0xd5')]];this[_0x1044('0xb3')](this[_0x1044('0x24')][_0x4b4dae[_0x1044('0xb4')]]);this[_0x1044('0x24')][_0x4b4dae['queue']]['outboundUnknownCallsDay']+=0x1;_0x2534ad=new Hangup(_0x4b4dae,_0x1855e5);_0x2534ad[_0x1044('0xda')]=0xc;_0x2534ad[_0x1044('0xa8')]=_0x1855e5[_0x1044('0x100')];_0x2534ad['membername']=_0x1044('0x101');this[_0x1044('0xc4')](_0x2534ad)[_0x1044('0xb1')](loggerCatch(_0x1044('0xfb')));this[_0x1044('0xff')](_0x2534ad)[_0x1044('0xb1')](loggerCatch(_0x1044('0xfc')));}};Dialer[_0x1044('0xab')][_0x1044('0x38')]=function(_0x224742){var _0x7db02e=this[_0x1044('0x2c')][_0x224742[_0x1044('0xd5')]];var _0x256670=this;if(this[_0x1044('0x24')][_0x224742[_0x1044('0xb4')]]){if(_0x7db02e&&_0x7db02e[_0x1044('0x52')]!==_0x1044('0x93')){delete this[_0x1044('0x2c')][_0x224742['uniqueid']];this['voiceQueues'][_0x224742[_0x1044('0xb4')]][_0x1044('0x61')]+=0x1;var _0x140efb=new AgentComplete(_0x7db02e,_0x224742);if(_0x224742[_0x1044('0x102')]===_0x1044('0x103')){_0x140efb[_0x1044('0x104')]=this[_0x1044('0x24')][_0x224742[_0x1044('0xb4')]][_0x1044('0x105')]&&this['voiceQueues'][_0x224742[_0x1044('0xb4')]][_0x1044('0x106')]?moment()[_0x1044('0x79')](_0x1044('0xf0')):undefined;}this[_0x1044('0xc4')](_0x140efb)['catch'](loggerCatch(_0x1044('0x107')));this[_0x1044('0xff')](_0x140efb)[_0x1044('0xb1')](loggerCatch(_0x1044('0x108')));}}};Dialer[_0x1044('0xab')]['syncAgentConnect']=function(_0x2f838a){if(this['voiceQueues'][_0x2f838a[_0x1044('0xb4')]]){if(this[_0x1044('0x2c')][_0x2f838a[_0x1044('0xd5')]]&&this['uniqueId'][_0x2f838a[_0x1044('0xd5')]]['type']!==_0x1044('0x93')){this[_0x1044('0xb3')](this[_0x1044('0x24')][_0x2f838a['queue']]);this[_0x1044('0x2c')][_0x2f838a[_0x1044('0xd5')]][_0x1044('0x109')]=moment()['format'](_0x1044('0xf0'));}}};Dialer[_0x1044('0xab')][_0x1044('0x10a')]=function(_0x3ee4a8){this[_0x1044('0xc4')](_0x3ee4a8)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x1044('0xff')](_0x3ee4a8)[_0x1044('0xb1')](loggerCatch(_0x1044('0x10b')));};Dialer['prototype'][_0x1044('0x10c')]=function(_0x3a265c){var _0x271b12=this[_0x1044('0x2c')][_0x3a265c[_0x1044('0xd5')]];var _0x506d74=this;if(this['voiceQueues'][_0x3a265c['queue']]){if(_0x271b12&&_0x271b12[_0x1044('0x52')]!==_0x1044('0x93')){delete this[_0x1044('0x2c')][_0x3a265c[_0x1044('0xd5')]];this[_0x1044('0xb3')](this[_0x1044('0x24')][_0x3a265c['queue']]);_0x271b12['droptime']=moment()[_0x1044('0x79')](_0x1044('0xf0'));var _0x556c43=new QueueCallerAbandon(_0x271b12,_0x3a265c);if(getSeconds(_0x271b12[_0x1044('0x10d')],_0x271b12[_0x1044('0x10e')])>=_0x271b12['dialQueueTimeout']){this[_0x1044('0x24')][_0x3a265c['queue']][_0x1044('0x6f')]+=0x1;this[_0x1044('0x24')][_0x3a265c[_0x1044('0xb4')]][_0x1044('0x67')]+=0x1;this[_0x1044('0x24')][_0x3a265c['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x556c43[_0x1044('0xda')]=0xa;_0x556c43['statedesc']=_0x1044('0x10f');_0x556c43[_0x1044('0x110')]=_0x1044('0x111');_0x556c43['agiafterat']=this[_0x1044('0x24')][_0x3a265c['queue']][_0x1044('0x105')]?moment()[_0x1044('0x79')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x556c43[_0x1044('0xe8')]+=0x1;_0x556c43['countglobal']+=0x1;if(_0x556c43[_0x1044('0xe8')]>=this[_0x1044('0x24')][_0x3a265c['queue']]['dialDropMaxRetry']){this[_0x1044('0x10a')](_0x556c43);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x556c43[_0x1044('0xe8')],'scheduledat':moment()['add'](this[_0x1044('0x24')][_0x3a265c[_0x1044('0xb4')]][_0x1044('0x112')],_0x1044('0xf7'))[_0x1044('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x271b12['ContactId'],'ListId':_0x271b12['ListId'],'VoiceQueueId':_0x271b12[_0x1044('0xcc')]||undefined,'CampaignId':_0x271b12['CampaignId']||undefined})[_0x1044('0xb1')](loggerCatch(_0x1044('0x113')));var _0xd85f8d=new History(_0x556c43);_0xd85f8d[_0x1044('0xda')]=0xa;_0xd85f8d[_0x1044('0xa8')]=_0x1044('0x10f');_0xd85f8d[_0x1044('0xaa')]=moment()[_0x1044('0x79')](_0x1044('0xf0'));_0xd85f8d[_0x1044('0xa9')]=_0xd85f8d[_0x1044('0xaa')];_0xd85f8d[_0x1044('0x114')]=_0x556c43[_0x1044('0x114')];_0xd85f8d[_0x1044('0x115')]=_0x556c43[_0x1044('0x115')];this[_0x1044('0xc4')](_0xd85f8d)[_0x1044('0xb1')](loggerCatch(_0x1044('0x116')));}}else{this[_0x1044('0x24')][_0x3a265c['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x3a265c[_0x1044('0xb4')]][_0x1044('0x66')]+=0x1;_0x556c43['state']=0xb;_0x556c43[_0x1044('0xa8')]=_0x1044('0x117');_0x556c43[_0x1044('0x110')]=_0x1044('0x118');_0x556c43[_0x1044('0xe9')]+=0x1;_0x556c43[_0x1044('0xf3')]+=0x1;if(_0x556c43['countabandonedretry']>=this[_0x1044('0x24')][_0x3a265c[_0x1044('0xb4')]][_0x1044('0x119')]){this[_0x1044('0x10a')](_0x556c43);}else{this[_0x1044('0xbd')]({'active':![],'countabandonedretry':_0x556c43[_0x1044('0xe9')],'scheduledat':moment()[_0x1044('0xef')](this['voiceQueues'][_0x3a265c[_0x1044('0xb4')]]['dialAbandonedRetryFrequency'],'minutes')['format'](_0x1044('0xf0')),'ContactId':_0x271b12['ContactId'],'ListId':_0x271b12['ListId'],'VoiceQueueId':_0x271b12[_0x1044('0xcc')]||undefined,'CampaignId':_0x271b12[_0x1044('0xf8')]||undefined})[_0x1044('0xb1')](loggerCatch(_0x1044('0x11a')));var _0xd85f8d=new History(_0x556c43);_0xd85f8d[_0x1044('0xda')]=0xb;_0xd85f8d[_0x1044('0xa8')]=_0x1044('0x117');_0xd85f8d['starttime']=moment()[_0x1044('0x79')](_0x1044('0xf0'));_0xd85f8d[_0x1044('0xa9')]=_0xd85f8d[_0x1044('0xaa')];_0xd85f8d[_0x1044('0x114')]=_0x556c43[_0x1044('0x114')];_0xd85f8d[_0x1044('0x115')]=_0x556c43[_0x1044('0x115')];this[_0x1044('0xc4')](_0xd85f8d)['catch'](loggerCatch(_0x1044('0x11b')));}}}}};Dialer['prototype'][_0x1044('0x11c')]=function(_0x1fab51){if(this[_0x1044('0x2a')][_0x1fab51['uniqueid']]){this[_0x1044('0x2a')][_0x1fab51['uniqueid']][_0x1044('0x11d')]=_0x1fab51['channel'];}if(this[_0x1044('0x2c')][_0x1fab51[_0x1044('0xd5')]]){this['uniqueId'][_0x1fab51[_0x1044('0xd5')]][_0x1044('0x11d')]=_0x1fab51['channel'];}};Dialer['prototype'][_0x1044('0x3e')]=function(_0x22f775){if(strategy[this[_0x1044('0x24')][this['actions'][_0x22f775[_0x1044('0x11e')]][_0x1044('0xb4')]][_0x1044('0x54')]]==='roundrobin'){if(this[_0x1044('0x2a')][_0x22f775[_0x1044('0x11e')]]&&_[_0x1044('0xaf')](this[_0x1044('0x2a')][_0x22f775[_0x1044('0x11e')]]['locked'])&&_0x22f775['status']==='1'&&_0x22f775[_0x1044('0x11f')]==='0'){if(this['agents'][_0x22f775[_0x1044('0x120')]]){if(!this[_0x1044('0x26')][_0x22f775['stateinterface']][_0x1044('0x121')]){this[_0x1044('0x26')][_0x22f775[_0x1044('0x120')]][_0x1044('0x121')]=!![];this[_0x1044('0x2a')][_0x22f775['actionid']][_0x1044('0x121')]=!![];this['actions'][_0x22f775[_0x1044('0x11e')]][_0x1044('0x120')]=_0x22f775['stateinterface'];}}}}else if((strategy[this[_0x1044('0x24')][this['actions'][_0x22f775['actionid']][_0x1044('0xb4')]][_0x1044('0x54')]]||_0x1044('0x1e'))==='rrmemory'){if(this[_0x1044('0x2a')][_0x22f775[_0x1044('0x11e')]]){if(this[_0x1044('0x26')][_0x22f775[_0x1044('0x120')]]){this['actions'][_0x22f775[_0x1044('0x11e')]]['stateinterface']=_0x22f775[_0x1044('0x120')];if(_['isNil'](this[_0x1044('0x31')][this['actions'][_0x22f775[_0x1044('0x11e')]][_0x1044('0xb4')]])){this[_0x1044('0x31')][this[_0x1044('0x2a')][_0x22f775[_0x1044('0x11e')]][_0x1044('0xb4')]]=[];}this[_0x1044('0x31')][this[_0x1044('0x2a')][_0x22f775[_0x1044('0x11e')]]['queue']][_0x1044('0x122')](_['merge'](_[_0x1044('0x123')](this[_0x1044('0x2a')][_0x22f775['actionid']],['idHopper',_0x1044('0x120')]),{'status':_0x22f775[_0x1044('0xd1')],'paused':_0x22f775[_0x1044('0x11f')]}));}}}};function unlockQueueStatus(_0x21a70f,_0x14bb6c){setTimeout(function(){if(_[_0x1044('0x43')](_0x21a70f[_0x1044('0x124')])){loggerBooked[_0x1044('0x97')](_0x1044('0x125'),_0x14bb6c);}_0x21a70f['queueStatusComplete']=!![];loggerBooked[_0x1044('0x7e')](_0x1044('0x126'),_0x14bb6c,JSON[_0x1044('0x4e')](_['pick'](_0x21a70f,[_0x1044('0x46'),_0x1044('0x124')])));},0x1f3);}Dialer[_0x1044('0xab')][_0x1044('0x40')]=function(_0x3daeb8){var _0x15eaf2=this;var _0x1df6f0=_0x15eaf2[_0x1044('0x24')][_0x15eaf2[_0x1044('0x2a')][_0x3daeb8[_0x1044('0x11e')]][_0x1044('0xb4')]];if(strategy[this[_0x1044('0x24')][this[_0x1044('0x2a')][_0x3daeb8[_0x1044('0x11e')]]['queue']][_0x1044('0x54')]]===_0x1044('0x1f')){if(this[_0x1044('0x2a')][_0x3daeb8[_0x1044('0x11e')]]&&this[_0x1044('0x2a')][_0x3daeb8[_0x1044('0x11e')]][_0x1044('0x120')]){this[_0x1044('0x23')][_0x1044('0x127')](this['actions'][_0x3daeb8[_0x1044('0x11e')]][_0x1044('0x128')],this['actions'][_0x3daeb8[_0x1044('0x11e')]]['stateinterface'])[_0x1044('0xb1')](function(_0xb42727){logger[_0x1044('0x97')](_0x1044('0x129'),util[_0x1044('0x9c')](_0xb42727,{'showHidden':![],'depth':null}));})[_0x1044('0x22')](function(){_0x15eaf2[_0x1044('0xb3')](_0x15eaf2['voiceQueues'][_0x15eaf2[_0x1044('0x2a')][_0x3daeb8[_0x1044('0x11e')]]['queue']]);_0x15eaf2['agents'][_0x15eaf2[_0x1044('0x2a')][_0x3daeb8[_0x1044('0x11e')]][_0x1044('0x120')]][_0x1044('0x121')]=![];delete _0x15eaf2[_0x1044('0x2a')][_0x3daeb8[_0x1044('0x11e')]];unlockQueueStatus(_0x1df6f0);});}else{this[_0x1044('0xb3')](this[_0x1044('0x24')][this['actions'][_0x3daeb8[_0x1044('0x11e')]]['queue']]);this[_0x1044('0xbd')]({'active':![],'ContactId':this[_0x1044('0x2a')][_0x3daeb8[_0x1044('0x11e')]][_0x1044('0xf1')],'ListId':this['actions'][_0x3daeb8[_0x1044('0x11e')]][_0x1044('0xca')],'VoiceQueueId':this[_0x1044('0x2a')][_0x3daeb8[_0x1044('0x11e')]][_0x1044('0xcc')]||undefined,'CampaignId':this[_0x1044('0x2a')][_0x3daeb8['actionid']][_0x1044('0xf8')]||undefined})[_0x1044('0xb1')](loggerCatch(_0x1044('0x12a')));delete this[_0x1044('0x2a')][_0x3daeb8[_0x1044('0x11e')]];unlockQueueStatus(_0x1df6f0);}}else if((strategy[this[_0x1044('0x24')][this['actions'][_0x3daeb8[_0x1044('0x11e')]]['queue']]['strategy']]||_0x1044('0x1e'))==='rrmemory'){var _0x443c4c;if(this[_0x1044('0x2a')][_0x3daeb8[_0x1044('0x11e')]]&&!_[_0x1044('0x7d')](this['queueBooked'][this[_0x1044('0x2a')][_0x3daeb8['actionid']][_0x1044('0xb4')]])){if(this[_0x1044('0x32')][_0x15eaf2[_0x1044('0x2a')][_0x3daeb8[_0x1044('0x11e')]][_0x1044('0xb4')]]){this[_0x1044('0x32')][_0x15eaf2[_0x1044('0x2a')][_0x3daeb8['actionid']][_0x1044('0xb4')]]=this[_0x1044('0x32')][this['actions'][_0x3daeb8[_0x1044('0x11e')]][_0x1044('0xb4')]]?this[_0x1044('0x32')][this['actions'][_0x3daeb8[_0x1044('0x11e')]]['queue']]:this[_0x1044('0x31')][this[_0x1044('0x2a')][_0x3daeb8['actionid']][_0x1044('0xb4')]]?this[_0x1044('0x31')][this[_0x1044('0x2a')][_0x3daeb8[_0x1044('0x11e')]]['queue']][_0x1044('0x12b')]||0x0:0x0;}this['queueBooked'][this[_0x1044('0x2a')][_0x3daeb8[_0x1044('0x11e')]]['queue']][_0x1044('0x12b')]=this[_0x1044('0x32')][this[_0x1044('0x2a')][_0x3daeb8[_0x1044('0x11e')]]['queue']];for(var _0x113d99=0x0;_0x113d99=0x0;})[_0x1044('0xb1')](myreject(_0x4420c3)));}}else{_0x3826ef[_0x1044('0x122')](ami['Action']({'action':'command','command':util[_0x1044('0x79')](_0x1044('0x148'),_0xadb1f0,!_['isUndefined'](config['timezones'][_0x553613])?_0x553613:'')})[_0x1044('0xb8')](function(_0x1fbfb7){return _0x1fbfb7['content'][_0x1044('0x146')](_0x1044('0x147'))>=0x0;})['catch'](myreject(_0x4420c3)));}BPromise[_0x1044('0x149')](_0x3826ef)['then'](function(_0x2fb70e){var _0x1fd786=_['some'](_0x2fb70e);if(_0x1fd786){return _0x350354(_0x1fd786);}else{_0x289d49['message']=_0x7d10b8?_0x1044('0x14a'):'INTERVAL_IS_OVERTIME';return _0x4420c3(msgResponse(_0x1044('0x14b'),_0x1044('0x13b'),_0x1044('0x14c')+_0x7d10b8+'\x20'+_0x5fefec+_0x1044('0x14d')+util[_0x1044('0x9c')](_0xadb1f0,{'showHidden':![],'depth':null})+_0x1044('0x14e')+_0x553613));}})[_0x1044('0xb1')](function(_0x1655b1){return _0x4420c3(msgResponse(_0x1044('0x13a'),'Failure',JSON[_0x1044('0x4e')](_0x1655b1)));});});};Dialer[_0x1044('0xab')][_0x1044('0x14f')]=function(_0x4fcaa9){var _0x17bf12=this;return function(){switch(_0x4fcaa9[_0x1044('0x5c')]){case'progressive':freeVariablesPredictive(_0x4fcaa9);_0x17bf12[_0x1044('0x150')](_0x4fcaa9,0x1);break;case _0x1044('0x151'):freeVariablesPredictive(_0x4fcaa9);_0x17bf12[_0x1044('0x150')](_0x4fcaa9,_0x4fcaa9['dialPowerLevel']);break;case _0x1044('0xa'):_0x17bf12[_0x1044('0xa')](_0x4fcaa9);break;case _0x1044('0x9'):freeVariablesPredictive(_0x4fcaa9);_0x17bf12['handlePower'](_0x4fcaa9,0x1);break;default:freeVariablesPredictive(_0x4fcaa9);logger['error'](_0x1044('0x152'),_0x4fcaa9['name'],_0x1044('0x153'));}};};Dialer[_0x1044('0xab')][_0x1044('0x154')]=function(_0x23f222){var _0xf63ec5=this;return function(){_0xf63ec5[_0x1044('0x155')](_0x23f222);};};Dialer['prototype'][_0x1044('0xc')]=function(_0x4cddb8){var _0x2f99c7=this;if(isNotPreview(_0x4cddb8[_0x1044('0x5c')])){if(isVoiceQueueOutbound(_0x4cddb8[_0x1044('0x52')])&&isActive(_0x4cddb8[_0x1044('0x5b')])){_0x4cddb8[_0x1044('0xa0')]=!![];BPromise[_0x1044('0xb6')]()['then'](checkIsLoggedIn(_0x4cddb8,_0x4cddb8[_0x1044('0x156')]))[_0x1044('0xb8')](checkIsActive(_0x4cddb8,_0x4cddb8[_0x1044('0x5b')]))[_0x1044('0xb8')](checkInterval(_0x4cddb8))[_0x1044('0xb8')](_0x2f99c7[_0x1044('0x135')](_0x4cddb8))['then'](_0x2f99c7['checkIfTime'](_0x4cddb8[_0x1044('0x157')],_0x4cddb8[_0x1044('0x158')],_0x4cddb8[_0x1044('0x46')],_0x4cddb8))['then'](_0x2f99c7[_0x1044('0x139')](_0x4cddb8['Interval'],_0x4cddb8[_0x1044('0x158')],_0x4cddb8['name'],_0x4cddb8))[_0x1044('0xb8')](_0x2f99c7[_0x1044('0x14f')](_0x4cddb8))[_0x1044('0xb1')](loggerCatchQueueSummary(_0x1044('0x159'),_0x4cddb8));}else{notSendMessagesQueue(_0x4cddb8);}}else{freeVariablesPredictive(_0x4cddb8);}};Dialer['prototype'][_0x1044('0x134')]=function(){var _0x2c5e34=this;var _0x4f11ba;for(var _0x532315 in this[_0x1044('0x25')]){if(typeof this[_0x1044('0x25')][_0x532315]!==_0x1044('0x9a')){_0x4f11ba=this['campaigns'][_0x532315];if(isCampaignIvr(_0x4f11ba[_0x1044('0x52')])&&isActive(_0x4f11ba[_0x1044('0x77')])){_0x4f11ba[_0x1044('0xa0')]=!![];BPromise['resolve']()['then'](checkIsActive(_0x4f11ba,_0x4f11ba[_0x1044('0x77')]))['then'](checkInterval(_0x4f11ba))[_0x1044('0xb8')](_0x2c5e34[_0x1044('0x135')](_0x4f11ba))[_0x1044('0xb8')](_0x2c5e34[_0x1044('0x138')](_0x4f11ba[_0x1044('0x157')],_0x4f11ba[_0x1044('0x158')],_0x4f11ba['name'],_0x4f11ba))[_0x1044('0xb8')](_0x2c5e34[_0x1044('0x139')](_0x4f11ba[_0x1044('0x48')],_0x4f11ba[_0x1044('0x158')],_0x4f11ba[_0x1044('0x46')],_0x4f11ba))[_0x1044('0xb8')](_0x2c5e34[_0x1044('0x154')](_0x4f11ba))[_0x1044('0xb1')](loggerCatchQueueSummary(_0x1044('0x15a'),_0x4f11ba));}else{notSendMessagesCampaign(_0x4f11ba);}}}};function getCallerIdRandom(_0x133d33,_0x3fed2e){var _0x2bb570;var _0x3b8287;var _0x3798c1;if(_0x3fed2e<=0x0){_0x3fed2e=0x1;}_0x2bb570=new RegExp('\x5cw{0,'+_0x3fed2e+'}$');_0x3b8287=Math[_0x1044('0x15b')](0xa,_0x3fed2e-0x1);_0x3798c1=Math[_0x1044('0x15b')](0xa,_0x3fed2e)-0x1;return util[_0x1044('0x79')]('%s',_[_0x1044('0x15c')](_0x133d33,_0x2bb570,_[_0x1044('0x15d')](_0x3b8287,_0x3798c1)));}function extractCalleridName(_0x3675d2){var _0x1d4a23=_0x3675d2[_0x1044('0x15e')](/"(.*?)"/);return _0x1d4a23?_0x1d4a23[0x1]:_0x3675d2;}function extractCalleridNumber(_0x49fcb8){var _0x325e2a=_0x49fcb8[_0x1044('0x15e')](/<(.*?)>/);return _0x325e2a?_0x325e2a[0x1]:_0x49fcb8;}Dialer[_0x1044('0xab')][_0x1044('0x15f')]=function(_0x1bb55c,_0x1a188c){var _0x1dacc2=this;var _0xd1edb7=uuid['v4']();this['actions'][_0xd1edb7]=new Action(_0x1bb55c,_0x1a188c,_0xd1edb7);return new BPromise(function(_0xdaa391,_0x3b0ae3){if(_['isUndefined'](_0x1bb55c)&&typeof _0x1bb55c!=='object'){return _0x3b0ae3(msgResponse(_0x1044('0x160'),_0x1044('0x13b'),'voiceQueue\x20is\x20undefine'));}if(_[_0x1044('0x43')](_0x1a188c[_0x1044('0x161')][_0x1044('0x162')])||_0x1a188c[_0x1044('0x161')][_0x1044('0x162')]===null){return _0x3b0ae3(msgResponse(_0x1044('0x160'),_0x1044('0x13b'),'contact\x20is\x20undefine'));}var _0x328e67={'XMD-CALLERID':_0x1dacc2[_0x1044('0x2a')][_0xd1edb7][_0x1044('0x163')](),'XMD-AGI':_0x1bb55c[_0x1044('0xfd')]?util[_0x1044('0x79')](_0x1044('0x164'),ipAgi,_0x1bb55c[_0x1044('0xfd')]):_0x1044('0x165'),'XMD-AGIAFTER':_0x1bb55c[_0x1044('0x105')]?util[_0x1044('0x79')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1bb55c[_0x1044('0x105')]):'NONE','XMD-QUEUE':_0x1bb55c[_0x1044('0x52')]===_0x1044('0x53')?util['format'](_0x1044('0x166'),_0x1bb55c[_0x1044('0x46')],_0x1bb55c['dialQueueOptions']||'',_0x1bb55c['dialAgiAfterHangupAgent']?'c':'',_0x1bb55c[_0x1044('0x167')]||0x3):_0x1044('0x165'),'XMD-CONTACTID':_0x1a188c[_0x1044('0xf1')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1dacc2[_0x1044('0x2a')][_0xd1edb7][_0x1044('0x163')](),'XMD-AMD':_0x1bb55c[_0x1044('0xd8')]?'ACTIVE':'NONE','XMD-DESTINATION':_0x1044('0xd7')};if(_0x1bb55c[_0x1044('0xd8')]){_0x328e67['XMD-AMDINITIALSILENCE']=_0x1bb55c[_0x1044('0x168')]||0x9c4;_0x328e67[_0x1044('0x169')]=_0x1bb55c[_0x1044('0x16a')]||0x5dc;_0x328e67['XMD-AMDAFTERGREETINGSILENCE']=_0x1bb55c[_0x1044('0x16b')]||0x320;_0x328e67[_0x1044('0x16c')]=_0x1bb55c[_0x1044('0x16d')]||0x1388;_0x328e67[_0x1044('0x16e')]=_0x1bb55c[_0x1044('0x16f')]||0x64;_0x328e67['XMD-AMDBETWEENWORDSSILENCE']=_0x1bb55c[_0x1044('0x170')]||0x32;_0x328e67[_0x1044('0x171')]=_0x1bb55c[_0x1044('0x172')]||0x3;_0x328e67['XMD-AMDSILENCETHRESHOLD']=_0x1bb55c[_0x1044('0x173')]||0x100;_0x328e67[_0x1044('0x174')]=_0x1bb55c[_0x1044('0x175')]||0x1388;}if(_0x1bb55c[_0x1044('0x52')]===_0x1044('0x53')){_0x328e67[_0x1044('0x176')]=_0x1a188c[_0x1044('0xcc')];}else{_0x328e67[_0x1044('0x177')]=_0x1a188c['CampaignId'];}for(var _0x4c772c in _0x1a188c[_0x1044('0x161')]){if(typeof _0x1a188c[_0x1044('0x161')][_0x4c772c]!==_0x1044('0x9a')){if(isNotNull(_0x1a188c[_0x1044('0x161')][_0x4c772c])&&_0x4c772c!=='id'&&_0x4c772c!==_0x1044('0x178')&&_0x4c772c!=='createdAt'&&_0x4c772c!==_0x1044('0x179')){_0x328e67[util[_0x1044('0x79')](_0x1044('0x17a'),'XMD-',_[_0x1044('0x17b')](_0x4c772c))]=_0x1a188c[_0x1044('0x161')][_0x4c772c];}}}var _0x2191f2=_0x1dacc2[_0x1044('0xd0')](_0x1bb55c['Trunk'])?getCallerId(_0x1bb55c['Trunk'][_0x1044('0x78')],_0x1bb55c[_0x1044('0x5d')],_0x1bb55c[_0x1044('0x17c')]>0x0?getCallerIdRandom(_0x1bb55c['dialOriginateCallerIdNumber'],_0x1bb55c[_0x1044('0x17c')]):_0x1bb55c[_0x1044('0x5e')]):getCallerId(_['isNil'](_0x1bb55c[_0x1044('0x136')])?_0x1bb55c[_0x1044('0x76')][_0x1044('0x78')]:_0x1bb55c[_0x1044('0x136')][_0x1044('0x78')],_0x1bb55c[_0x1044('0x5d')],_0x1bb55c[_0x1044('0x17c')]>0x0?getCallerIdRandom(_0x1bb55c[_0x1044('0x5e')],_0x1bb55c['dialRandomLastDigitCallerIdNumber']):_0x1bb55c[_0x1044('0x5e')]);if(_0x2191f2){_0x328e67[_0x1044('0x17d')]=_0x1dacc2[_0x1044('0x2a')][_0xd1edb7][_0x1044('0x17e')]=extractCalleridName(_0x2191f2);_0x328e67[_0x1044('0x17f')]=_0x1dacc2['actions'][_0xd1edb7]['originatecalleridnum']=extractCalleridNumber(_0x2191f2);}return ami[_0x1044('0xb0')]({'actionid':_0xd1edb7,'action':_0x1044('0x160'),'channel':_0x1dacc2[_0x1044('0xd0')](_0x1bb55c[_0x1044('0x76')])?util[_0x1044('0x79')](_0x1044('0x180'),_0x1bb55c[_0x1044('0x76')][_0x1044('0x46')],isNotNull(_0x1bb55c['dialPrefix'])?_0x1bb55c['dialPrefix'][_0x1044('0x181')]()||'':'',_0x1bb55c[_0x1044('0x182')]>0x0?_0x1a188c[_0x1044('0x161')][_0x1044('0x162')]['substring'](_0x1bb55c[_0x1044('0x182')]):_0x1a188c[_0x1044('0x161')]['phone']):util[_0x1044('0x79')]('SIP/%s/%s%s',_['isNil'](_0x1bb55c['TrunkBackup'])?_0x1bb55c['Trunk'][_0x1044('0x46')]:_0x1bb55c[_0x1044('0x136')]['name'],isNotNull(_0x1bb55c[_0x1044('0x183')])?_0x1bb55c['dialPrefix']['trim']()||'':'',_0x1bb55c[_0x1044('0x182')]>0x0?_0x1a188c['Contact'][_0x1044('0x162')][_0x1044('0x184')](_0x1bb55c[_0x1044('0x182')]):_0x1a188c[_0x1044('0x161')][_0x1044('0x162')]),'callerid':_0x2191f2,'Exten':_0x1044('0xd7'),'Context':_0x1044('0x185'),'Priority':'1','variable':_0x328e67,'timeout':(_0x1bb55c[_0x1044('0x5f')]||0x1e)*0x3e8,'async':!![],'channelid':_0xd1edb7})[_0x1044('0xb8')](function(_0x757da){return _0xdaa391(_0x757da);})[_0x1044('0xb1')](function(_0x377b2e){_0x1bb55c[_0x1044('0x186')]+=0x1;var _0x58f82b=new History(_0x1dacc2[_0x1044('0x2a')][_0xd1edb7]);logger[_0x1044('0x97')](util[_0x1044('0x79')](_0x1044('0x187'),JSON['stringify'](_0x377b2e)));_0x58f82b[_0x1044('0xda')]=0xe;_0x58f82b['statedesc']='OriginateError';_0x58f82b[_0x1044('0xaa')]=moment()[_0x1044('0x79')](_0x1044('0xf0'));_0x58f82b[_0x1044('0xa9')]=_0x58f82b['starttime'];_0x1dacc2[_0x1044('0xc4')](_0x58f82b)[_0x1044('0xb1')](loggerCatch(_0x1044('0x188')));_0x1dacc2['moveContactManagedDialer'](_0x58f82b)[_0x1044('0xb1')](loggerCatch('[originate][error]'))[_0x1044('0x22')](function(){delete _0x1dacc2[_0x1044('0x2a')][_0xd1edb7];return _0x3b0ae3(msgResponse(_0x1044('0x160'),'Error',_0x1044('0x189')));});});});};Dialer[_0x1044('0xab')][_0x1044('0x37')]=function(_0x9e96b9){var _0x51456a=this[_0x1044('0x2a')][_0x9e96b9[_0x1044('0x11e')]];if(_0x51456a){delete this['actions'][_0x9e96b9[_0x1044('0x11e')]];_0x51456a[_0x1044('0x10e')]=moment()[_0x1044('0x79')](_0x1044('0xf0'));var _0xf61b82=_0x51456a[_0x1044('0x52')]===_0x1044('0x93')?this['campaigns'][_0x51456a[_0x1044('0xb4')]]:this[_0x1044('0x24')][_0x51456a[_0x1044('0x18a')]()];if(!this[_0x1044('0xcf')](_0x9e96b9['response'])){this['updateOriginated'](_0xf61b82);return this[_0x1044('0x18b')](_0x51456a,_0xf61b82,_0x9e96b9)['catch'](loggerCatch('[callProgressDetecting]\x20'));}this[_0x1044('0x2c')][_0x9e96b9[_0x1044('0xd5')]]=_0x51456a;}};Dialer[_0x1044('0xab')]['checkRetriveMax']=function(_0x1e42a6,_0x57618e,_0x5b89ed){var _0x245e37=new History(_0x57618e);if(_0x245e37[_0x1044('0xe4')]+_0x245e37[_0x1044('0xe5')]+_0x245e37[_0x1044('0xe6')]+_0x245e37[_0x1044('0xe7')]+_0x245e37[_0x1044('0xe8')]+_0x245e37['countabandonedretry']+_0x245e37['countmachineretry']+_0x245e37[_0x1044('0xeb')]>=_0x5b89ed['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x1e42a6){case 0x3:if(_0x245e37[_0x1044('0xe6')]>=_0x5b89ed[_0x1044('0x18c')]-0x1){return!![];}this[_0x1044('0xbd')]({'active':![],'countnoanswerretry':_0x245e37[_0x1044('0xe6')]+=0x1,'scheduledat':moment()[_0x1044('0xef')](_0x5b89ed[_0x1044('0x18d')],_0x1044('0xf7'))['format'](_0x1044('0xf0')),'ContactId':_0x245e37[_0x1044('0xf1')],'ListId':_0x245e37[_0x1044('0xca')],'VoiceQueueId':_0x245e37[_0x1044('0xcc')]||undefined,'CampaignId':_0x245e37[_0x1044('0xf8')]||undefined})[_0x1044('0xb1')](loggerCatch(_0x1044('0x18e')));break;case 0x5:if(_0x245e37[_0x1044('0xe4')]>=_0x5b89ed[_0x1044('0x18f')]-0x1){return!![];}this[_0x1044('0xbd')]({'active':![],'countbusyretry':_0x245e37[_0x1044('0xe4')]+=0x1,'scheduledat':moment()[_0x1044('0xef')](_0x5b89ed['dialBusyRetryFrequency'],_0x1044('0xf7'))[_0x1044('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x245e37[_0x1044('0xf1')],'ListId':_0x245e37[_0x1044('0xca')],'VoiceQueueId':_0x245e37[_0x1044('0xcc')]||undefined,'CampaignId':_0x245e37[_0x1044('0xf8')]||undefined})[_0x1044('0xb1')](loggerCatch(_0x1044('0x190')));break;case 0x8:if(_0x245e37[_0x1044('0xe5')]>=_0x5b89ed[_0x1044('0x191')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x245e37['countcongestionretry']+=0x1,'scheduledat':moment()[_0x1044('0xef')](_0x5b89ed[_0x1044('0x192')],_0x1044('0xf7'))[_0x1044('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x245e37[_0x1044('0xf1')],'ListId':_0x245e37[_0x1044('0xca')],'VoiceQueueId':_0x245e37[_0x1044('0xcc')]||undefined,'CampaignId':_0x245e37[_0x1044('0xf8')]||undefined})[_0x1044('0xb1')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x245e37[_0x1044('0xe7')]>=_0x5b89ed[_0x1044('0x193')]-0x1){return!![];}else{this[_0x1044('0xbd')]({'active':![],'countnosuchnumberretry':_0x245e37[_0x1044('0xe7')]+=0x1,'scheduledat':moment()[_0x1044('0xef')](_0x5b89ed[_0x1044('0x194')],_0x1044('0xf7'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x245e37[_0x1044('0xf1')],'ListId':_0x245e37[_0x1044('0xca')],'VoiceQueueId':_0x245e37[_0x1044('0xcc')]||undefined,'CampaignId':_0x245e37[_0x1044('0xf8')]||undefined})[_0x1044('0xb1')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x245e37[_0x1044('0xe8')]>=_0x5b89ed['dialDropMaxRetry']-0x1){return!![];}this[_0x1044('0xbd')]({'active':![],'countdropretry':_0x245e37[_0x1044('0xe8')]+=0x1,'scheduledat':moment()[_0x1044('0xef')](_0x5b89ed[_0x1044('0x112')],_0x1044('0xf7'))['format'](_0x1044('0xf0')),'ContactId':_0x245e37[_0x1044('0xf1')],'ListId':_0x245e37[_0x1044('0xca')],'VoiceQueueId':_0x245e37[_0x1044('0xcc')]||undefined,'CampaignId':_0x245e37['CampaignId']||undefined})[_0x1044('0xb1')](loggerCatch(_0x1044('0x113')));break;case 0xb:if(_0x245e37[_0x1044('0xe9')]>=_0x5b89ed[_0x1044('0x119')]-0x1){return!![];}this[_0x1044('0xbd')]({'active':![],'countabandonedretry':_0x245e37[_0x1044('0xe9')]+=0x1,'scheduledat':moment()['add'](_0x5b89ed[_0x1044('0x195')],_0x1044('0xf7'))[_0x1044('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x245e37[_0x1044('0xf1')],'ListId':_0x245e37[_0x1044('0xca')],'VoiceQueueId':_0x245e37[_0x1044('0xcc')]||undefined,'CampaignId':_0x245e37[_0x1044('0xf8')]||undefined})[_0x1044('0xb1')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x245e37[_0x1044('0xea')]>=_0x5b89ed[_0x1044('0x196')]-0x1){return!![];}this[_0x1044('0xbd')]({'active':![],'countmachineretry':_0x245e37[_0x1044('0xea')]+=0x1,'scheduledat':moment()[_0x1044('0xef')](_0x5b89ed[_0x1044('0xf6')],_0x1044('0xf7'))[_0x1044('0x79')](_0x1044('0xf0')),'ContactId':_0x245e37[_0x1044('0xf1')],'ListId':_0x245e37[_0x1044('0xca')],'VoiceQueueId':_0x245e37[_0x1044('0xcc')]||undefined,'CampaignId':_0x245e37[_0x1044('0xf8')]||undefined})[_0x1044('0xb1')](loggerCatch(_0x1044('0xf9')));break;case 0x14:if(_0x245e37[_0x1044('0xeb')]>=_0x5b89ed[_0x1044('0x197')]-0x1){return!![];}this[_0x1044('0xbd')]({'active':![],'countagentrejectretry':_0x245e37[_0x1044('0xeb')]+=0x1,'scheduledat':moment()['add'](_0x5b89ed['dialAgentRejectRetryFrequency'],_0x1044('0xf7'))[_0x1044('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x245e37[_0x1044('0xf1')],'ListId':_0x245e37[_0x1044('0xca')],'VoiceQueueId':_0x245e37[_0x1044('0xcc')]||undefined,'CampaignId':_0x245e37['CampaignId']||undefined})[_0x1044('0xb1')](loggerCatch(_0x1044('0x198')));break;default:return!![];}};Dialer['prototype'][_0x1044('0x18b')]=function(_0x5d3f0b,_0x57bceb,_0x4fa176){var _0x14cbcb=this;var _0x449ece=new History(_0x5d3f0b);return new BPromise(function(_0x39e58f,_0x3bbf11){if(_[_0x1044('0x43')](_0x57bceb)&&typeof _0x57bceb!==_0x1044('0x199')){return _0x3bbf11(msgResponse(_0x1044('0x19a'),_0x1044('0x13b'),_0x1044('0x19b')));}if(_[_0x1044('0x43')](_0x4fa176)&&typeof _0x4fa176!==_0x1044('0x199')){return _0x3bbf11(msgResponse(_0x1044('0x19a'),_0x1044('0x13b'),'evt\x20is\x20undefine'));}switch(_0x4fa176['reason']){case'0':_0x57bceb['outboundNoSuchCallsDay']+=0x1;_0x449ece[_0x1044('0xda')]=0x0;_0x449ece[_0x1044('0xa8')]=_0x1044('0x19c');_0x449ece[_0x1044('0xe7')]+=0x1;_0x449ece['countglobal']+=0x1;ami[_0x1044('0x19d')](_0x1044('0x19e'),ut[_0x1044('0x19f')](_0x5d3f0b,_0x1044('0x1a0')));_0x14cbcb[_0x1044('0xc4')](_0x449ece)[_0x1044('0xb1')](loggerCatch(_0x1044('0xe3')));if(_0x14cbcb[_0x1044('0x1a1')](0x0,_0x5d3f0b,_0x57bceb)){if(_0x449ece[_0x1044('0xe7')]>=_0x57bceb[_0x1044('0x193')]){_0x14cbcb[_0x1044('0xee')](_0x449ece,_0x39e58f,_0x3bbf11,'reason\x200\x20no\x20such\x20number....');}else{_0x14cbcb['stateGlobal'](_0x449ece,_0x39e58f,_0x3bbf11,_0x1044('0x1a2'));}}break;case'3':_0x57bceb[_0x1044('0x68')]+=0x1;_0x449ece[_0x1044('0xda')]=0x3;_0x449ece['statedesc']=_0x1044('0x1a3');_0x449ece[_0x1044('0xe6')]+=0x1;_0x449ece['countglobal']+=0x1;ami[_0x1044('0x19d')](_0x1044('0x1a4'),ut[_0x1044('0x19f')](_0x5d3f0b,_0x1044('0x1a5')));_0x14cbcb['createHistory'](_0x449ece)['catch'](loggerCatch(_0x1044('0x1a6')));if(_0x14cbcb[_0x1044('0x1a1')](0x3,_0x5d3f0b,_0x57bceb)){if(_0x449ece['countnoanswerretry']>=_0x57bceb[_0x1044('0x18c')]){_0x14cbcb[_0x1044('0xee')](_0x449ece,_0x39e58f,_0x3bbf11,_0x1044('0x1a7'));}else{_0x14cbcb['stateGlobal'](_0x449ece,_0x39e58f,_0x3bbf11,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x57bceb[_0x1044('0x63')]+=0x1;_0x449ece[_0x1044('0xda')]=0x5;_0x449ece[_0x1044('0xa8')]=_0x1044('0x1a8');_0x449ece[_0x1044('0xe4')]+=0x1;_0x449ece['countglobal']+=0x1;ami['emit'](_0x1044('0x1a9'),ut[_0x1044('0x19f')](_0x5d3f0b,_0x1044('0x1aa')));_0x14cbcb['createHistory'](_0x449ece)['catch'](loggerCatch(_0x1044('0x1ab')));if(_0x14cbcb['checkRetriveMax'](0x5,_0x5d3f0b,_0x57bceb)){if(_0x449ece[_0x1044('0xe4')]>=_0x57bceb[_0x1044('0x18f')]){_0x14cbcb[_0x1044('0xee')](_0x449ece,_0x39e58f,_0x3bbf11,'reason\x205\x20busy');}else{_0x14cbcb[_0x1044('0xf5')](_0x449ece,_0x39e58f,_0x3bbf11,_0x1044('0x1ac'));}}break;case'8':_0x57bceb[_0x1044('0x64')]+=0x1;_0x449ece['state']=0x8;_0x449ece[_0x1044('0xa8')]=_0x1044('0x1ad');_0x449ece[_0x1044('0xe5')]+=0x1;_0x449ece[_0x1044('0xf3')]+=0x1;ami[_0x1044('0x19d')](_0x1044('0x1ae'),ut[_0x1044('0x19f')](_0x5d3f0b,'congestion'));_0x14cbcb[_0x1044('0xc4')](_0x449ece)[_0x1044('0xb1')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x14cbcb[_0x1044('0x1a1')](0x8,_0x5d3f0b,_0x57bceb)){if(_0x449ece[_0x1044('0xe5')]>=_0x57bceb[_0x1044('0x191')]){_0x14cbcb[_0x1044('0xee')](_0x449ece,_0x39e58f,_0x3bbf11,_0x1044('0x1af'));}else{_0x14cbcb[_0x1044('0xf5')](_0x449ece,_0x39e58f,_0x3bbf11,_0x1044('0x1af'));}}break;case'11':_0x57bceb[_0x1044('0x1b0')]+=0x1;_0x449ece[_0x1044('0xda')]=0xb;_0x449ece[_0x1044('0xa8')]=_0x1044('0x117');_0x449ece['countabandonedretry']+=0x1;_0x449ece[_0x1044('0xf3')]+=0x1;_0x14cbcb[_0x1044('0xc4')](_0x449ece)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x14cbcb[_0x1044('0x1a1')](0xb,_0x5d3f0b,_0x57bceb)){if(_0x449ece[_0x1044('0xe9')]>=_0x57bceb[_0x1044('0x119')]){_0x14cbcb[_0x1044('0xee')](_0x449ece,_0x39e58f,_0x3bbf11,_0x1044('0x1b1'));}else{_0x14cbcb[_0x1044('0xf5')](_0x449ece,_0x39e58f,_0x3bbf11,'reason\x2011\x20abandoned');}}break;case'20':_0x57bceb[_0x1044('0x1b2')]+=0x1;_0x449ece[_0x1044('0xda')]=0x14;_0x449ece[_0x1044('0xa8')]=_0x1044('0x1b3');_0x449ece['countagentrejectretry']+=0x1;_0x449ece['countglobal']+=0x1;ami[_0x1044('0x19d')](_0x1044('0x1b4'),ut[_0x1044('0x19f')](_0x5d3f0b,_0x1044('0x1b5')));_0x14cbcb[_0x1044('0xc4')](_0x449ece)[_0x1044('0xb1')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x14cbcb['checkRetriveMax'](0x14,_0x5d3f0b,_0x57bceb)){if(_0x449ece[_0x1044('0xeb')]>=_0x57bceb[_0x1044('0x197')]){_0x14cbcb[_0x1044('0xee')](_0x449ece,_0x39e58f,_0x3bbf11,_0x1044('0x1b6'));}else{_0x14cbcb['stateGlobal'](_0x449ece,_0x39e58f,_0x3bbf11,'reason\x2020\x20agentreject');}}break;default:_0x57bceb[_0x1044('0x6b')]+=0x1;_0x449ece[_0x1044('0xda')]=0xc;_0x449ece[_0x1044('0xa8')]=_0x4fa176['reason'];_0x14cbcb[_0x1044('0xc4')](_0x449ece)[_0x1044('0xb1')](loggerCatch(_0x1044('0x1b7')));if(_0x14cbcb['checkRetriveMax'](_0x4fa176['reason'],_0x5d3f0b,_0x57bceb)){if(_0x449ece[_0x1044('0xe4')]+_0x449ece[_0x1044('0xe5')]+_0x449ece[_0x1044('0xe6')]+_0x449ece[_0x1044('0xe7')]+_0x449ece[_0x1044('0xe8')]+_0x449ece[_0x1044('0xe9')]+_0x449ece[_0x1044('0xea')]+_0x449ece[_0x1044('0xeb')]>=_0x57bceb[_0x1044('0xec')]){_0x14cbcb[_0x1044('0xf5')](_0x449ece,_0x39e58f,_0x3bbf11,_0x4fa176[_0x1044('0x102')]);}else{_0x14cbcb['createStateFinal'](_0x449ece,_0x39e58f,_0x3bbf11,_0x4fa176['reason']);}}}});};Dialer[_0x1044('0xab')][_0x1044('0xf5')]=function(_0x4074ea,_0x106a3d,_0x7606d,_0x4e5db7){var _0x2848fa=new Final(_0x4074ea);_0x2848fa[_0x1044('0xda')]=0xf;_0x2848fa['statedesc']=_0x1044('0x1b8');this['createStateFinal'](_0x2848fa,_0x106a3d,_0x7606d,_0x4e5db7);};Dialer[_0x1044('0xab')][_0x1044('0xee')]=function(_0x3fa451,_0x14d618,_0x2f1cfb,_0x223fe8){this['moveContactManagedDialer'](_0x3fa451)[_0x1044('0xb8')](function(){return _0x14d618(msgResponse(_0x1044('0x19a'),_0x1044('0x1b9'),_0x223fe8));})[_0x1044('0xb1')](function(){return _0x2f1cfb(msgResponse('[moveContactManagedDialer][0]',_0x1044('0x13b'),'contact\x20not\x20moved'));});};Dialer[_0x1044('0xab')][_0x1044('0xa')]=function(_0xc1d6bf){var _0xdd2225=_0xc1d6bf[_0x1044('0x1ba')]/0x64;var _0x37f50b=_0xc1d6bf['outboundDropCallsDayTimeout']/(_0xc1d6bf[_0x1044('0x67')]+_0xc1d6bf['outboundAnswerCallsDay']);var _0x32cc17=Math[_0x1044('0x1bb')](_0xc1d6bf[_0x1044('0x72')]*(_0xc1d6bf[_0x1044('0x1bc')]/0x64));var _0x65b6a7=Math[_0x1044('0x1bb')](_0xc1d6bf[_0x1044('0x72')]*(_0xc1d6bf[_0x1044('0x1bd')]/0x64));var _0x3885ee=_0xc1d6bf[_0x1044('0xa2')]+_0xc1d6bf['talking'];var _0x5a5e65=Math[_0x1044('0x1be')](_0xc1d6bf[_0x1044('0x74')]*_0xc1d6bf[_0x1044('0x8e')]*_0xc1d6bf['predictiveIntervalHitRate']*_0xc1d6bf[_0x1044('0x71')]);if(_[_0x1044('0x43')](_0xc1d6bf[_0x1044('0x2f')])){if(!_['isUndefined'](_0xc1d6bf[_0x1044('0x2e')])){_0xc1d6bf[_0x1044('0x2e')]=undefined;loggerPredictive[_0x1044('0x97')](_0x1044('0x1bf'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0xc1d6bf[_0x1044('0x91')])){loggerPredictive[_0x1044('0x97')](_0x1044('0x1bf'),_0x1044('0x1c0'));clearInterval(_0xc1d6bf[_0x1044('0x91')]);_0xc1d6bf[_0x1044('0x91')]=undefined;}_0xc1d6bf['startProgressive']=moment()[_0x1044('0x79')](_0x1044('0xf0'));loggerPredictive[_0x1044('0x7e')](_0xc1d6bf[_0x1044('0x46')],'collection\x20data\x20in\x20progressive\x20at',_0xc1d6bf[_0x1044('0x2f')]);this[_0x1044('0x150')](_0xc1d6bf,0x1);}else if(ifInterval(_0xc1d6bf[_0x1044('0x1c1')],_0xc1d6bf['startProgressive'])){this[_0x1044('0x150')](_0xc1d6bf,0x1);loggerPredictiveCalls[_0x1044('0x7e')]('[startMethodPredictive][StartProgressive][Loop]',_0xc1d6bf[_0x1044('0x2f')],_0xc1d6bf[_0x1044('0x46')]);_0xc1d6bf[_0x1044('0x74')]=0x0;_0xc1d6bf[_0x1044('0x1c2')]=0x0;}else if(_0xdd2225<_0x37f50b&&_0xc1d6bf[_0x1044('0x1c3')]==='dropRate'){freeVariablesPredictive(_0xc1d6bf);loggerPredictive[_0x1044('0x7e')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x1044('0x1c4'),_0x37f50b,_0x1044('0x2f'),_0xc1d6bf[_0x1044('0x46')]);}else if(_0x5a5e65<_0xc1d6bf[_0x1044('0x1c2')]&&_0xc1d6bf[_0x1044('0x1c3')]==='dropRate'){freeVariablesPredictive(_0xc1d6bf);loggerPredictive[_0x1044('0x7e')](_0x1044('0x1c5'),_0x1044('0x1c6'),_0x5a5e65,_0x1044('0x1c7'),_0xc1d6bf['predictiveIntervalErlangCallsDroppedCalls'],_0x1044('0x2f'),_0xc1d6bf[_0x1044('0x46')]);}else if(!ifInterval(_0xc1d6bf[_0x1044('0x1c1')],_0xc1d6bf[_0x1044('0x2f')])&&_[_0x1044('0x43')](_0xc1d6bf[_0x1044('0x2e')])&&!_[_0x1044('0x43')](_0xc1d6bf[_0x1044('0x2f')])){_0xc1d6bf[_0x1044('0x2e')]=moment()['format'](_0x1044('0xf0'));loggerPredictive[_0x1044('0x7e')](_0xc1d6bf[_0x1044('0x46')],_0x1044('0x1c8'),_0xc1d6bf['startPredictive']);this[_0x1044('0xbb')](_0xc1d6bf['dialPredictiveInterval'])[_0x1044('0xb8')](this[_0x1044('0x1c9')](_0xc1d6bf))[_0x1044('0xb8')](mergeDataErlangB(_0xc1d6bf))['then'](this[_0x1044('0x1ca')](_0xc1d6bf))[_0x1044('0xb1')](loggerCatchPredictive(_0x1044('0x1cb'),_0xc1d6bf));}else if(!ifInterval(_0xc1d6bf[_0x1044('0x1c1')],_0xc1d6bf[_0x1044('0x2e')])){_0xc1d6bf[_0x1044('0x1c2')]=0x0;_0xc1d6bf['startPredictive']=moment()[_0x1044('0x79')](_0x1044('0xf0'));loggerPredictive['info'](_0xc1d6bf[_0x1044('0x46')],_0x1044('0x1cc'),_0xc1d6bf[_0x1044('0x2e')]);clearInterval(_0xc1d6bf[_0x1044('0x91')]);_0xc1d6bf[_0x1044('0x91')]=undefined;this[_0x1044('0xbb')](_0xc1d6bf[_0x1044('0x1c1')])[_0x1044('0xb8')](this[_0x1044('0x1c9')](_0xc1d6bf))[_0x1044('0xb8')](mergeDataErlangB(_0xc1d6bf))[_0x1044('0xb8')](this[_0x1044('0x1ca')](_0xc1d6bf))[_0x1044('0xb1')](loggerCatchPredictive(_0x1044('0x1cd'),_0xc1d6bf));}else if(_0xc1d6bf[_0x1044('0x72')]&&_0x3885ee<_0xc1d6bf[_0x1044('0x72')]-_0x65b6a7){freeVariablesPredictive(_0xc1d6bf);loggerPredictive[_0x1044('0x7e')](_0xc1d6bf['name'],_0x1044('0x1ce'),_0x3885ee,_0x1044('0x1cf'),_0xc1d6bf[_0x1044('0x72')],'-',_0x65b6a7,'=',_0xc1d6bf['predictiveIntervalAvailable']-_0x65b6a7,')');}else if(_0xc1d6bf[_0x1044('0x72')]&&_0x3885ee>_0xc1d6bf[_0x1044('0x72')]+_0x32cc17){freeVariablesPredictive(_0xc1d6bf);loggerPredictive[_0x1044('0x7e')](_0xc1d6bf[_0x1044('0x46')],_0x1044('0x1ce'),_0x3885ee,')\x20are\x20more\x20than\x20threshold\x20(',_0xc1d6bf[_0x1044('0x72')],'+',_0x32cc17,'=',_0xc1d6bf[_0x1044('0x72')]+_0x32cc17,')');}};Dialer['prototype'][_0x1044('0x1c9')]=function(_0x102578){var _0x16e795=this;return function(_0x52341a){return new BPromise(function(_0x447c2d,_0x392512){_[_0x1044('0x8f')](_0x102578,_0x52341a[0x0]);if(checkGetDataPredictive(_0x52341a[0x0])){var _0x2b2985=_0x102578[_0x1044('0x72')]=_0x102578[_0x1044('0x57')]+_0x102578[_0x1044('0xa2')];var _0x5f56c3=_0x102578['dialPredictiveInterval']*0x3c;var _0x57d443=_0x52341a[0x0][_0x1044('0x6d')]+_0x52341a[0x0][_0x1044('0x84')];var _0xf9c17e=(_0x52341a[0x0]['predictiveIntervalAnsweredCalls']+_0x52341a[0x0][_0x1044('0x6f')]+_0x52341a[0x0][_0x1044('0x6e')])/_0x52341a[0x0]['predictiveIntervalTotalCalls'];_0x102578[_0x1044('0x70')]=_0xf9c17e>0x0?_0xf9c17e:0x1;switch(_0x102578[_0x1044('0x1c3')]){case _0x1044('0x1d0'):var _0x3cb90e=_0x102578[_0x1044('0x1ba')]/0x64;return _0x16e795[_0x1044('0x1d1')](_0x2b2985,_0x5f56c3,_0x57d443,_0xf9c17e,_0x3cb90e)[_0x1044('0xb8')](function(_0x54f4fd){return _0x447c2d(_0x54f4fd);});case _0x1044('0x1d2'):var _0x284b5b=_0x102578[_0x1044('0x1ba')]/0x64;return _0x16e795[_0x1044('0x1d3')](_0x2b2985,_0x5f56c3,_0x57d443,_0xf9c17e,_0x284b5b)[_0x1044('0xb8')](function(_0x5714cf){return _0x447c2d(_0x5714cf);});default:return _0x392512(msgResponse('[getDataPredictive]','Failure',_0x1044('0x1d4')));}}else{return _0x392512(msgResponse(_0x1044('0x1d5'),_0x1044('0x13b'),_0x1044('0x1d6')));}});};};Dialer[_0x1044('0xab')][_0x1044('0x1d7')]=function(_0x1114c4){var _0x53702b=this;return function(_0x2013a6){return new BPromise(function(_0x50f787,_0x31dd24){_[_0x1044('0x8f')](_0x1114c4,_0x2013a6[0x0]);if(checkGetDataPredictive(_0x2013a6[0x0])){loggerPredictive[_0x1044('0x7e')](JSON['stringify'](_0x2013a6[0x0]));if(_0x1114c4[_0x1044('0x1c3')]===_0x1044('0x1d0')){return _0x53702b['getVoiceQueueRtPauses'](_0x1114c4['id'])['then'](function(_0x4766b9){var _0x20b8a9=_0x1114c4[_0x1044('0x156')]-_0x4766b9[0x0]['outboundQueuePauses'];var _0xf2f7d9=_0x1114c4['dialPredictiveInterval']*0x3c;var _0x16bb23=_0x2013a6[0x0]['predictiveIntervalAvgTalktime']+_0x2013a6[0x0][_0x1044('0x84')];var _0xba1bb2=(_0x2013a6[0x0]['predictiveIntervalAnsweredCalls']+_0x2013a6[0x0][_0x1044('0x6f')]+_0x2013a6[0x0][_0x1044('0x6e')])/_0x2013a6[0x0]['predictiveIntervalTotalCalls'];var _0x4e3e96=_0x1114c4[_0x1044('0x1ba')]/0x64;_0x1114c4[_0x1044('0x1d8')]=_0x4766b9[0x0][_0x1044('0x1d9')]||0x0;_0x1114c4['predictiveIntervalHitRate']=_0xba1bb2>0x0?_0xba1bb2:0x1;return _0x53702b['abandonmentRate'](_0x20b8a9,_0xf2f7d9,_0x16bb23,_0xba1bb2,_0x4e3e96);})[_0x1044('0xb8')](function(_0x5e4dbf){return _0x50f787(_0x5e4dbf);})[_0x1044('0xb1')](function(_0xced43a){return _0x31dd24(msgResponse('[CatchErlangB]',_0x1044('0x13b'),JSON[_0x1044('0x4e')](_0xced43a)));});}if(_0x1114c4[_0x1044('0x1c3')]===_0x1044('0x1d2')){return _0x53702b['getVoiceQueueRtPauses'](_0x1114c4['id'])[_0x1044('0xb8')](function(_0x4ee0cc){var _0x1d5560=_0x1114c4[_0x1044('0x156')]-_0x4ee0cc[0x0]['outboundQueuePauses'];var _0x2a4110=_0x1114c4[_0x1044('0x1c1')]*0x3c;var _0x2c8e90=_0x2013a6[0x0][_0x1044('0x6d')]+_0x2013a6[0x0][_0x1044('0x84')];var _0x3f2b25=(_0x2013a6[0x0][_0x1044('0x6c')]+_0x2013a6[0x0][_0x1044('0x6f')]+_0x2013a6[0x0][_0x1044('0x6e')])/_0x2013a6[0x0][_0x1044('0x80')];var _0x50f611=_0x1114c4[_0x1044('0x1ba')]/0x64;_0x1114c4[_0x1044('0x1d8')]=_0x4ee0cc[0x0][_0x1044('0x1d9')]||0x0;_0x1114c4[_0x1044('0x70')]=_0x3f2b25>0x0?_0x3f2b25:0x1;return _0x53702b[_0x1044('0x1d3')](_0x1d5560,_0x2a4110,_0x2c8e90,_0x3f2b25,_0x50f611);})[_0x1044('0xb8')](function(_0x1da459){return _0x50f787(_0x1da459);})['catch'](function(_0x579603){return _0x31dd24(msgResponse(_0x1044('0x1da'),'Failure',JSON[_0x1044('0x4e')](_0x579603)));});}}else{return _0x31dd24(msgResponse(_0x1044('0x1d5'),_0x1044('0x13b'),'check\x20failure'));}});};};Dialer[_0x1044('0xab')]['startMethodPredictive']=function(_0x1b6ea4){var _0x26b069=this;return function(){var _0x3b5396=0x0;var _0xd2d4d4=Math[_0x1044('0x1be')](_0x1b6ea4[_0x1044('0x75')]*0x3e8);if(_0xd2d4d4>0x0){_0xd2d4d4=_0xd2d4d4<0x64?0x64:_0xd2d4d4;loggerPredictive[_0x1044('0x7e')](_0x1b6ea4['name'],_0x1044('0x1db'),_0xd2d4d4,_0x1044('0x4f'));_0x1b6ea4[_0x1044('0x91')]=setInterval(function(){_0x26b069['handlePredictive'](_0x1b6ea4);loggerPredictiveCalls[_0x1044('0x7e')](_0x1044('0x1dc'),_0x3b5396+=0x1);},_0xd2d4d4);}else{loggerPredictive[_0x1044('0x7e')](_0x1b6ea4[_0x1044('0x46')],_0x1044('0x1dd'));}};};Dialer[_0x1044('0xab')][_0x1044('0x1de')]=function(_0x4c8c32,_0x416dc9){var _0x463554=this;return function(_0xf2c26e){if(_['isEmpty'](_0xf2c26e)){if(_[_0x1044('0xaf')](_0x416dc9[_0x1044('0xcb')])||!_0x416dc9[_0x1044('0x1df')]){if(_0x4c8c32[_0x1044('0x5c')]===_0x1044('0x9')){_0x4c8c32[_0x1044('0x124')]=_[_0x1044('0x43')](_0x4c8c32[_0x1044('0x124')])?!![]:_0x4c8c32['queueStatusComplete'];var _0x22c2a1=uuid['v4']();_0x463554[_0x1044('0x2a')][_0x22c2a1]=new Action(_0x4c8c32,_0x416dc9,_0x22c2a1);loggerBooked[_0x1044('0x7e')]('[booked][checkContactBlack]',_0x22c2a1,_0x1044('0x1e0'),JSON[_0x1044('0x4e')](_0x4c8c32['queueStatusComplete']),_0x1044('0x1e1'),_0x4c8c32[_0x1044('0x46')]);if(_0x4c8c32[_0x1044('0x124')]){_0x4c8c32['queueStatusComplete']=![];_0x463554[_0x1044('0x31')][_0x463554[_0x1044('0x2a')][_0x22c2a1][_0x1044('0xb4')]]=[];ami[_0x1044('0xb0')]({'actionid':_0x22c2a1,'action':_0x1044('0x1e2'),'queue':_0x4c8c32[_0x1044('0x46')]})[_0x1044('0xb1')](function(){_0x463554['updateOriginated'](_0x4c8c32);_0x463554[_0x1044('0xbd')]({'active':![],'ContactId':_0x463554[_0x1044('0x2a')][_0x22c2a1]['ContactId'],'ListId':_0x463554[_0x1044('0x2a')][_0x22c2a1][_0x1044('0xca')],'VoiceQueueId':_0x463554[_0x1044('0x2a')][_0x22c2a1]['VoiceQueueId']||undefined,'CampaignId':_0x463554['actions'][_0x22c2a1][_0x1044('0xf8')]||undefined})['catch'](loggerCatch(_0x1044('0x1e3')));delete _0x463554[_0x1044('0x2a')][_0x22c2a1];});}else{loggerBooked[_0x1044('0x7e')](_0x1044('0x1e4'),JSON[_0x1044('0x4e')](_0x4c8c32[_0x1044('0x124')]),_0x1044('0x1e1'),_0x4c8c32[_0x1044('0x46')]);_0x463554[_0x1044('0xb3')](_0x4c8c32);_0x463554[_0x1044('0xbd')]({'active':![],'ContactId':_0x463554['actions'][_0x22c2a1][_0x1044('0xf1')],'ListId':_0x463554['actions'][_0x22c2a1][_0x1044('0xca')],'VoiceQueueId':_0x463554[_0x1044('0x2a')][_0x22c2a1]['VoiceQueueId']||undefined,'CampaignId':_0x463554[_0x1044('0x2a')][_0x22c2a1][_0x1044('0xf8')]||undefined})[_0x1044('0xb1')](loggerCatch(_0x1044('0x1e3')));delete _0x463554[_0x1044('0x2a')][_0x22c2a1];}}else{return _0x463554[_0x1044('0x15f')](_0x4c8c32,_0x416dc9);}}else{if(getDiff(_0x416dc9[_0x1044('0x1e5')])<_0x4c8c32[_0x1044('0x1e6')]*0x3c){if(_0x416dc9[_0x1044('0x1e7')]&&!_0x416dc9[_0x1044('0x1e7')]['voicePause']){_0x463554[_0x1044('0x23')][_0x1044('0x127')](_0x416dc9['id'])[_0x1044('0x22')](function(){_0x463554['updateOriginated'](_0x4c8c32);});}else{_0x463554[_0x1044('0xbf')]({'active':![]},_0x416dc9['id'],0x1)[_0x1044('0x22')](function(){_0x463554[_0x1044('0xb3')](_0x4c8c32);});}}else{_0x4c8c32[_0x1044('0x6a')]+=0x1;_0x463554[_0x1044('0xb3')](_0x4c8c32);if(_0x4c8c32['dialRecallInQueue']){_0x463554[_0x1044('0xbd')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x416dc9[_0x1044('0xf1')],'ListId':_0x416dc9[_0x1044('0xca')],'VoiceQueueId':_0x416dc9[_0x1044('0xcc')]||undefined,'CampaignId':_0x416dc9[_0x1044('0xf8')]||undefined})[_0x1044('0xb1')](loggerCatch(_0x1044('0x1e8')));_0x463554['createHistory'](createObjHistory(_0x4c8c32,_0x416dc9,_0x1044('0x1e9'),0x17,'RecallInQueue'))['catch'](loggerCatch(_0x1044('0x1ea')));}else{_0x463554[_0x1044('0xc9')](createObjHistory(_0x4c8c32,_0x416dc9,_0x1044('0x1eb'),0x16,'RecallFailedTimeout'),_0x1044('0x1ec'),_0x1044('0x1ed'));}}}}else{_0x4c8c32['outboundBlacklistCallsDay']+=0x1;_0x463554[_0x1044('0xc9')](createObjHistory(_0x4c8c32,_0x416dc9,_0x1044('0x1ee'),0xd,_0x1044('0x1ef')),_0x1044('0x1f0'),_0x1044('0x1f1'));throw _0x1044('0x1f2');}};};Dialer[_0x1044('0xab')][_0x1044('0x155')]=function(_0x3c9e40){var _0x3e9789=this;var _0x12f9d3=_0x3c9e40[_0x1044('0x1f3')]-_0x3c9e40[_0x1044('0x73')]-_0x3c9e40[_0x1044('0x1f4')];emitCampaignSummary(_0x3c9e40);if(_0x12f9d3>0x0){if(_0x12f9d3>this['maxNumberOriginate']){_0x12f9d3=this[_0x1044('0x28')];}_0x3c9e40[_0x1044('0x1f4')]+=_0x12f9d3;this[_0x1044('0xc0')](_0x3c9e40['id'],_0x12f9d3,_0x3c9e40[_0x1044('0x1f5')])[_0x1044('0xb8')](function(_0x9c9b4){_0x3c9e40[_0x1044('0x1f4')]-=_0x12f9d3;_0x3c9e40[_0x1044('0x1f4')]=_0x3c9e40[_0x1044('0x1f4')]>0x0?_0x3c9e40[_0x1044('0x1f4')]:0x0;if(!checkContactEmpty(_0x9c9b4)){_0x3c9e40['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0x1044('0x7e')](_0x1044('0x1f6')+_0x3c9e40[_0x1044('0x46')]);}else{_0x3c9e40[_0x1044('0x73')]+=_0x9c9b4[_0x1044('0x99')];_0x3c9e40[_0x1044('0x44')]='RUNNING';for(var _0x2cb187=0x0;_0x2cb187<_0x9c9b4[_0x1044('0x99')];_0x2cb187+=0x1){_0x3c9e40[_0x1044('0x1f7')]+=0x1;if(_[_0x1044('0xaf')](_0x9c9b4[_0x2cb187])||_['isNil'](_0x9c9b4[_0x2cb187]['Contact'])||_[_0x1044('0xaf')](_0x9c9b4[_0x2cb187][_0x1044('0x161')][_0x1044('0x162')])){_0x3e9789[_0x1044('0x1f8')]('[actionOriginate]\x20',_0x3c9e40,_0x9c9b4[_0x2cb187]);}else{_0x3e9789[_0x1044('0xb9')](_[_0x1044('0x123')](_0x9c9b4[_0x2cb187],['CampaignId',_0x1044('0x1f9')]))[_0x1044('0xb8')](_0x3e9789[_0x1044('0x1de')](_0x3c9e40,_0x9c9b4[_0x2cb187]))['catch'](_0x3e9789[_0x1044('0xc8')]('[actionOriginateIvr]\x20',_0x3c9e40));}}}})[_0x1044('0xb1')](loggerGetContactDialer('[getContactCampaign2]',_0x3c9e40,_0x12f9d3));}};Dialer[_0x1044('0xab')]['handlePower']=function(_0x5a405b,_0x19a5a2){var _0x352fd9=this;var _0x7cd2cf=[];var _0x429904=_0x19a5a2>=0x1?_0x19a5a2:0x1;if(_0x5a405b[_0x1044('0x5c')]===_0x1044('0x9')){_0x429904=0x1;}var _0x87d923=Math[_0x1044('0x1be')](_0x5a405b['available']*_0x429904)-_0x5a405b['originated']-_0x5a405b[_0x1044('0x1f4')];emitVoiceQueueSummary(_0x5a405b);if(_0x5a405b[_0x1044('0x1fa')]>0x0){var _0x586ba9=_0x5a405b[_0x1044('0x1fa')]-_0x5a405b['originated']-_0x5a405b[_0x1044('0x57')]-_0x5a405b[_0x1044('0x1f4')]-_0x5a405b[_0x1044('0x56')];if(_0x87d923>_0x586ba9){_0x87d923=_0x586ba9;}}if(_0x87d923>0x0){if(_0x5a405b[_0x1044('0x5c')]==='booked'){_0x87d923=0x1;}if(_0x87d923>this['maxNumberOriginate']){_0x87d923=this['maxNumberOriginate'];}_0x5a405b[_0x1044('0x1f4')]+=_0x87d923;for(var _0x384650 in this['agents']){if(typeof this[_0x1044('0x26')][_0x384650]!==_0x1044('0x9a')){if(this[_0x1044('0x26')][_0x384650][_0x1044('0xda')]==='not_inuse'&&this['agents'][_0x384650]['status']===_0x1044('0xd2')){_0x7cd2cf[_0x1044('0x122')](this[_0x1044('0x26')][_0x384650]['id']);}}}this[_0x1044('0x1fb')](_0x5a405b['id'],_0x7cd2cf,_0x87d923,_0x5a405b['dialOrderByScheduledAt'])[_0x1044('0xb8')](function(_0x423414){_0x5a405b[_0x1044('0x1f4')]-=_0x87d923;_0x5a405b[_0x1044('0x1f4')]=_0x5a405b[_0x1044('0x1f4')]>0x0?_0x5a405b[_0x1044('0x1f4')]:0x0;if(!checkContactEmpty(_0x423414)){_0x352fd9[_0x1044('0xb5')](_0x5a405b)[_0x1044('0xb8')](sendMessageReschedule(_0x5a405b))[_0x1044('0xb1')](loggerCatch('[countReScheduled]\x20'));}else{_0x5a405b[_0x1044('0x73')]+=_0x423414[_0x1044('0x99')];_0x5a405b[_0x1044('0x44')]=_0x5a405b[_0x1044('0x5c')]===_0x1044('0x9')?_0x1044('0x1fc'):'RUNNING';for(var _0x4b25af=0x0;_0x4b25af<_0x423414[_0x1044('0x99')];_0x4b25af+=0x1){if(_['isNil'](_0x423414[_0x4b25af])||_[_0x1044('0xaf')](_0x423414[_0x4b25af][_0x1044('0x161')])||_[_0x1044('0xaf')](_0x423414[_0x4b25af][_0x1044('0x161')][_0x1044('0x162')])){_0x352fd9['emptyContact'](_0x1044('0x1fd'),_0x5a405b,_0x423414[_0x4b25af]);}else{_0x352fd9[_0x1044('0xb7')](_[_0x1044('0x123')](_0x423414[_0x4b25af],[_0x1044('0xcc'),_0x1044('0x1f9')]))['then'](_0x352fd9[_0x1044('0x1de')](_0x5a405b,_0x423414[_0x4b25af]))[_0x1044('0xb1')](_0x352fd9['loggerHandler'](_0x1044('0x1fd'),_0x5a405b));}}}})[_0x1044('0xb1')](loggerGetContactDialer(_0x1044('0x1fe'),_0x5a405b,_0x87d923));}};Dialer[_0x1044('0xab')][_0x1044('0x91')]=function(_0x52fb42){if(_0x52fb42[_0x1044('0x1fa')]>0x0){var _0x52bdc7=_0x52fb42[_0x1044('0x1fa')]-_0x52fb42['originated']-_0x52fb42[_0x1044('0x57')];if(_0x52bdc7>0x0){this[_0x1044('0x1ff')](_0x52fb42);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0x1044('0x1ff')](_0x52fb42);}};Dialer[_0x1044('0xab')][_0x1044('0x1ff')]=function(_0x2629af){var _0x2c947d=this;var _0xcc09fe=[];_0x2629af['originated']+=0x1;for(var _0x20bff3 in this[_0x1044('0x26')]){if(typeof this[_0x1044('0x26')][_0x20bff3]!==_0x1044('0x9a')){if(this[_0x1044('0x26')][_0x20bff3][_0x1044('0xda')]===_0x1044('0x200')&&this[_0x1044('0x26')][_0x20bff3][_0x1044('0xd1')]==='reachable'){_0xcc09fe[_0x1044('0x122')](this[_0x1044('0x26')][_0x20bff3]['id']);}}}this[_0x1044('0x1fb')](_0x2629af['id'],_0xcc09fe,0x1,_0x2629af[_0x1044('0x1f5')])[_0x1044('0xb8')](function(_0x232544){if(!checkContactEmpty(_0x232544)){checkContactLowerLimitOriginate(_0x2629af,0x1,0x0);_0x2c947d['countReScheduled'](_0x2629af)[_0x1044('0xb8')](sendMessageReschedule(_0x2629af))['catch'](loggerCatch(_0x1044('0x201')));}else{_0x2629af['message']='RUNNING';if(_['isNil'](_0x232544[0x0])||_[_0x1044('0xaf')](_0x232544[0x0][_0x1044('0x161')])||_[_0x1044('0xaf')](_0x232544[0x0]['Contact']['phone'])){_0x2c947d[_0x1044('0x1f8')](_0x1044('0x1fd'),_0x2629af,_0x232544[0x0]);}else{_0x2c947d[_0x1044('0xb7')](_[_0x1044('0x123')](_0x232544[0x0],[_0x1044('0xcc'),'Contact.phone']))[_0x1044('0xb8')](_0x2c947d[_0x1044('0x1de')](_0x2629af,_0x232544[0x0]))[_0x1044('0xb1')](_0x2c947d[_0x1044('0xc8')]('[actionOriginatePredictive]\x20',_0x2629af));}}})[_0x1044('0xb1')](loggerGetContactDialer(_0x1044('0x202'),_0x2629af,0x1));emitVoiceQueueSummary(_0x2629af);};Dialer['prototype'][_0x1044('0x1d1')]=function(_0x1360ac,_0x270706,_0x2b08ca,_0x1b4cb9,_0x190951,_0xcbb829){loggerPredictive[_0x1044('0x7e')](_0x1044('0x203'));loggerPredictive[_0x1044('0x7e')](_0x1044('0x204'),_0x1360ac);loggerPredictive[_0x1044('0x7e')](_0x1044('0x205'),_0x270706);loggerPredictive[_0x1044('0x7e')](_0x1044('0x206'),_0x2b08ca);loggerPredictive[_0x1044('0x7e')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1b4cb9);loggerPredictive[_0x1044('0x7e')](_0x1044('0x207'),_0x190951);loggerPredictive[_0x1044('0x7e')](_0x1044('0x86'));return new BPromise(function(_0x5d0d84,_0x984331){if(_0x1360ac<=0x0||isNaN(_0x1360ac)){return _0x984331(msgResponse(_0x1044('0x208'),'Error',_0x1044('0x209')+_0x1360ac));}if(_0x2b08ca<=0x0||isNaN(_0x2b08ca)){return _0x984331(msgResponse(_0x1044('0x208'),_0x1044('0x4d'),_0x1044('0x20a')+_0x2b08ca));}if(_0x1b4cb9<=0x0||isNaN(_0x1b4cb9)){return _0x984331(msgResponse(_0x1044('0x208'),'Error',_0x1044('0x20b')+_0x1b4cb9));}if(_0x270706<=0x0||isNaN(_0x270706)){return _0x984331(msgResponse(_0x1044('0x208'),_0x1044('0x4d'),'interval\x20=\x20'+_0x270706));}if(_0x190951<=0x0||isNaN(_0x190951)){return _0x984331(msgResponse('[abandonmentRate]',_0x1044('0x4d'),_0x1044('0x20c')+_0x190951));}_0xcbb829=_0xcbb829||0x0;var _0x2028b0=0x1/_0x2b08ca;var _0xec03d8=0x0;var _0x2a917f=0x0;var _0x43c53=0x0;var _0x5bfc4e=0x0;for(var _0xde4051=0x0;_0x43c53<_0x190951;_0xde4051+=0x1){_0x2a917f=_0xde4051/_0x270706;_0xec03d8=(_0x1b4cb9*_0x2a917f+_0xcbb829)/_0x2028b0;_0x43c53=erlangb(_0xec03d8,_0x1360ac);_0x5bfc4e=_0xec03d8/_0x1360ac*(0x1-erlangb(_0xec03d8,_0x1360ac));}return _0x5d0d84({'erlangCalls':_0xde4051,'erlangCallToSecond':_0x270706/_0xde4051,'erlangAbandonmentRate':_0x43c53,'erlangBusyFactor':_0x5bfc4e});});};Dialer[_0x1044('0xab')][_0x1044('0x1d3')]=function(_0x5c66cb,_0x29706a,_0x367a2c,_0x4f56d3,_0x44fa50,_0x269d15){loggerPredictive[_0x1044('0x7e')](_0x1044('0x20d'));loggerPredictive[_0x1044('0x7e')](_0x1044('0x204'),_0x5c66cb);loggerPredictive['info'](_0x1044('0x205'),_0x29706a);loggerPredictive[_0x1044('0x7e')](_0x1044('0x206'),_0x367a2c);loggerPredictive[_0x1044('0x7e')](_0x1044('0x20e'),_0x4f56d3);loggerPredictive[_0x1044('0x7e')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x44fa50);loggerPredictive[_0x1044('0x7e')](_0x1044('0x86'));return new BPromise(function(_0x3f590f,_0x135b9d){if(_0x5c66cb<=0x0||isNaN(_0x5c66cb)){return _0x135b9d(msgResponse(_0x1044('0x20f'),_0x1044('0x4d'),_0x1044('0x209')+_0x5c66cb));}if(_0x367a2c<=0x0||isNaN(_0x367a2c)){return _0x135b9d(msgResponse(_0x1044('0x20f'),_0x1044('0x4d'),_0x1044('0x20a')+_0x367a2c));}if(_0x4f56d3<=0x0||isNaN(_0x4f56d3)){return _0x135b9d(msgResponse(_0x1044('0x20f'),_0x1044('0x4d'),'p\x20=\x20'+_0x4f56d3));}if(_0x29706a<=0x0||isNaN(_0x29706a)){return _0x135b9d(msgResponse(_0x1044('0x20f'),_0x1044('0x4d'),_0x1044('0x210')+_0x29706a));}if(_0x44fa50<=0x0||isNaN(_0x44fa50)){return _0x135b9d(msgResponse(_0x1044('0x20f'),_0x1044('0x4d'),'Umin\x20=\x20'+_0x44fa50));}_0x269d15=_0x269d15||0x0;var _0x57d397=0x1/_0x367a2c;var _0x16d56a=0x0;var _0x1fe458=0x0;var _0x511206=0x0;var _0xcaaaa4=0x0;for(var _0x170b55=0x0;_0xcaaaa4<_0x44fa50;_0x170b55+=0x1){_0x1fe458=_0x170b55/_0x29706a;_0x16d56a=(_0x4f56d3*_0x1fe458+_0x269d15)/_0x57d397;_0x511206=erlangb(_0x16d56a,_0x5c66cb);_0xcaaaa4=_0x16d56a/_0x5c66cb*(0x1-erlangb(_0x16d56a,_0x5c66cb));}return _0x3f590f({'erlangCalls':_0x170b55,'erlangCallToSecond':_0x29706a/_0x170b55,'erlangAbandonmentRate':_0x511206,'erlangBusyFactor':_0xcaaaa4});});};module[_0x1044('0x211')]=Dialer; \ No newline at end of file +var _0x380a=['checkIsBlackList','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','ContactId','ListId','UserId','CampaignId','isSuccess','Success','isTrunkReachable','SIP/%s','uniqueid','isNil','variable','value','HANGUP','outboundAnswerCallsDay','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','amd','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','cause-txt','Unknow','syncAgentComplete','reason','agent','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','TIMEOUT','agiafterat','dialQueueProject2','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','CALLEREXIT','dialAbandonedMaxRetry','[syncAgentComplete][createHistory][11]','strategy','roundrobin','actionid','locked','stateinterface','push','pick','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','[booked][RR][finaly]','Agent:\x20','contactAgent-idHopper:\x20','[unlock][syncQueueStatusComplete]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','interval','indexOf','true','iftime\x20%s,%s','content','all','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','handlePower','power','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','syncCampaigns','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','dialCutDigit','trim','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','countcongestionretry','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','dialNoSuchNumberMaxRetry','createStateFinal','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','available','floor','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','predictiveIntervalDroppedCallsTimeout','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','[CatchErlangB]','outboundQueuePauses','predictiveIntervalPauses','check\x20failure','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','run','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginateIvr]\x20','dialLimitQueue','[countReScheduled]\x20','[actionOriginate]\x20','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','moment','../preview/util/util','dialer','../../../config/logger','booked','predictiveCalls','../ami','redis','defaults','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','syncQueueSummary','hangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','Error','stringify','milliseconds','diff','seconds','emit','type','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','md5','voice:queue:%s','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalTotalCalls','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','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','outbound','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','talking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','prototype','clearZombieChannels','uniqueId','actions','[actions]','sequence','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','then','countReScheduled'];(function(_0xe40436,_0x5c51a1){var _0x5896cf=function(_0x4b6a83){while(--_0x4b6a83){_0xe40436['push'](_0xe40436['shift']());}};_0x5896cf(++_0x5c51a1);}(_0x380a,0x16c));var _0xa380=function(_0x556e75,_0x244403){_0x556e75=_0x556e75-0x0;var _0xd46094=_0x380a[_0x556e75];return _0xd46094;};'use strict';var util=require(_0xa380('0x0'));var _=require(_0xa380('0x1'));var BPromise=require(_0xa380('0x2'));var uuid=require('uuid');var moment=require(_0xa380('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require(_0xa380('0x4'));var config=require('../../../config/environment/');var logger=require('../../../config/logger')(_0xa380('0x5'));var loggerBooked=require(_0xa380('0x6'))(_0xa380('0x7'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require('../../../config/logger')(_0xa380('0x8'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0xa380('0x9'));config[_0xa380('0xa')]=_[_0xa380('0xb')](config[_0xa380('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require(_0xa380('0xc'));var cmHopperHistory=require(_0xa380('0xd'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xa380('0xe'));var Action=require(_0xa380('0xf'));var History=require(_0xa380('0x10'));var Final=require(_0xa380('0x11'));var AgentComplete=require(_0xa380('0x12'));var QueueCallerAbandon=require(_0xa380('0x13'));var Hangup=require(_0xa380('0x14'));var ipAgi=process['env'][_0xa380('0x15')]||_0xa380('0x16');var strategy={'rrmemory':_0xa380('0x17'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence['prototype'][_0xa380('0x18')]=function(_0x3a0eb4){this[_0xa380('0x19')]=this[_0xa380('0x19')]?this[_0xa380('0x19')][_0xa380('0x1a')](_0x3a0eb4):_0x3a0eb4();};function Dialer(_0x4c0021,_0x34dfa1){this['sequence']=new Sequence();this[_0xa380('0x1b')]=_0x34dfa1;this[_0xa380('0x1c')]=_0x4c0021['voiceQueues'];this[_0xa380('0x1d')]=_0x4c0021[_0xa380('0x1d')];this[_0xa380('0x1e')]=_0x4c0021[_0xa380('0x1e')];this['trunks']=_0x4c0021[_0xa380('0x1f')];this[_0xa380('0x20')]=config[_0xa380('0x20')]||0x2;this[_0xa380('0x21')]={};this['actions']={};this['contactsId']={};this['uniqueId']={};this[_0xa380('0x22')]={};this[_0xa380('0x23')]={};this['startProgressive']={};this[_0xa380('0x24')]={};this[_0xa380('0x25')]={};this[_0xa380('0x26')]={};ami['on'](_0xa380('0x27'),this[_0xa380('0x28')][_0xa380('0x29')](this));ami['on'](_0xa380('0x2a'),this[_0xa380('0x2b')][_0xa380('0x29')](this));ami['on'](_0xa380('0x2c'),this[_0xa380('0x2d')][_0xa380('0x29')](this));ami['on'](_0xa380('0x2e'),this['syncAgentComplete'][_0xa380('0x29')](this));ami['on'](_0xa380('0x2f'),this[_0xa380('0x30')][_0xa380('0x29')](this));ami['on'](_0xa380('0x31'),this['syncHangup']['bind'](this));ami['on'](_0xa380('0x32'),this[_0xa380('0x33')][_0xa380('0x29')](this));ami['on'](_0xa380('0x34'),this[_0xa380('0x35')][_0xa380('0x29')](this));ami['on']('queuemember',this[_0xa380('0x36')][_0xa380('0x29')](this));ami['on']('queuestatuscomplete',this[_0xa380('0x37')][_0xa380('0x29')](this));this[_0xa380('0x38')]();this[_0xa380('0x39')]();}function isNotNull(_0x215ac0){return _0x215ac0!==null&&!_[_0xa380('0x3a')](_0x215ac0);}function checkIsLoggedIn(_0x1fce2b,_0x3618f7){return function(){if(_0x3618f7<=0x0){_0x1fce2b[_0xa380('0x3b')]=_0xa380('0x3c');throw _0x1fce2b[_0xa380('0x3d')]+_0xa380('0x3e');}};}function isActive(_0x569225){return _0x569225;}function checkIsActive(_0x20d8de,_0x306680){return function(){if(!isActive(_0x306680)){_0x20d8de[_0xa380('0x3b')]=_0xa380('0x3f');throw _0x20d8de[_0xa380('0x3d')]+_0xa380('0x40');}};}function checkInterval(_0x27e275){return function(){if(!isNotNull(_0x27e275[_0xa380('0x41')])){_0x27e275[_0xa380('0x3b')]=_0xa380('0x42');throw _0x27e275[_0xa380('0x3d')]+_0xa380('0x43');}if(!isNotNull(_0x27e275['Interval'][_0xa380('0x44')])){_0x27e275[_0xa380('0x3b')]=_0xa380('0x42');throw _0x27e275[_0xa380('0x3d')]+_0xa380('0x43');}if(!isNotNull(_[_0xa380('0x45')](_0x27e275[_0xa380('0x41')][_0xa380('0x44')]))){_0x27e275['message']=_0xa380('0x42');throw _0x27e275[_0xa380('0x3d')]+_0xa380('0x43');}};}function msgResponse(_0x91eac8,_0x799f22,_0x2ed7d5){return{'action':_0x91eac8,'response':_0x799f22,'message':_0x2ed7d5,'stack':_0x2ed7d5};}function myreject(_0x44c553){return function(_0x2076e9){return _0x44c553(msgResponse('[ifTime][Action]',_0xa380('0x46'),JSON[_0xa380('0x47')](_0x2076e9)));};}function getSeconds(_0x402c92,_0x718a57){var _0x1c8a82=moment(_0x402c92)[_0xa380('0x48')](0x0);var _0x2d743d=moment(_0x718a57)[_0xa380('0x48')](0x0);return _0x1c8a82[_0xa380('0x49')](_0x2d743d,_0xa380('0x4a'));}function emit(_0x226319,_0x4f3c79,_0x198e81){io['to'](_0x226319)[_0xa380('0x4b')](_0x4f3c79,_0x198e81);}function emitVoiceQueueSummary(_0x140536){if(_0x140536[_0xa380('0x4c')]==='outbound'){var _0x11de42={'id':_0x140536['id'],'name':_0x140536[_0xa380('0x3d')],'strategy':_0x140536['strategy'],'answered':_0x140536['answered'],'available':_0x140536['available'],'loggedIn':_0x140536[_0xa380('0x4d')],'pTalking':_0x140536[_0xa380('0x4e')],'sumBillable':_0x140536[_0xa380('0x4f')],'sumDuration':_0x140536[_0xa380('0x50')],'sumHoldTime':_0x140536[_0xa380('0x51')]||0x0,'talking':_0x140536['talking'],'total':_0x140536['total'],'type':_0x140536[_0xa380('0x4c')],'unmanaged':_0x140536[_0xa380('0x52')],'abandoned':_0x140536[_0xa380('0x53')],'waiting':_0x140536[_0xa380('0x54')],'loggedInDb':_0x140536[_0xa380('0x55')],'dialActive':_0x140536[_0xa380('0x56')],'dialMethod':_0x140536[_0xa380('0x57')],'dialOriginateCallerIdName':_0x140536[_0xa380('0x58')],'dialOriginateCallerIdNumber':_0x140536[_0xa380('0x59')],'dialOriginateTimeout':_0x140536[_0xa380('0x5a')],'dialPrefix':_0x140536[_0xa380('0x5b')],'outboundAnswerAgiCallsDay':_0x140536[_0xa380('0x5c')],'outboundAnswerCallsDay':_0x140536['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x140536['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x140536[_0xa380('0x5d')],'outboundCongestionCallsDay':_0x140536[_0xa380('0x5e')],'outboundDropCallsDayACS':_0x140536[_0xa380('0x5f')],'outboundDropCallsDayCallersExit':_0x140536[_0xa380('0x60')],'outboundDropCallsDayTimeout':_0x140536[_0xa380('0x61')],'outboundNoAnswerCallsDay':_0x140536[_0xa380('0x62')],'outboundNoSuchCallsDay':_0x140536[_0xa380('0x63')],'outboundOriginateFailureCallsDay':_0x140536[_0xa380('0x64')],'outboundReCallsDay':_0x140536[_0xa380('0x65')],'outboundRejectCallsDay':_0x140536[_0xa380('0x66')],'outboundUnknownCallsDay':_0x140536['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x140536[_0xa380('0x67')],'predictiveIntervalAvgHoldtime':_0x140536[_0xa380('0x68')],'predictiveIntervalAvgTalktime':_0x140536['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x140536[_0xa380('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x140536['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x140536[_0xa380('0x6a')],'predictiveIntervalErlangCallsDroppedCalls':_0x140536[_0xa380('0x6b')],'predictiveIntervalHitRate':_0x140536[_0xa380('0x6c')],'predictiveIntervalMultiplicativeFactor':_0x140536[_0xa380('0x6d')],'predictiveIntervalPauses':_0x140536['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x140536[_0xa380('0x6e')],'predictiveIntervalTotalCalls':_0x140536['predictiveIntervalTotalCalls'],'message':_0x140536[_0xa380('0x3b')],'originated':_0x140536[_0xa380('0x6f')],'erlangCalls':_0x140536[_0xa380('0x70')],'erlangCallToSecond':_0x140536[_0xa380('0x71')],'erlangAbandonmentRate':_0x140536[_0xa380('0x72')],'erlangBusyFactor':_0x140536[_0xa380('0x73')],'startPredictive':_0x140536[_0xa380('0x23')],'startProgressive':_0x140536[_0xa380('0x74')]};if(_0x140536[_0xa380('0x75')]){_0x11de42[_0xa380('0x75')]={'id':_0x140536[_0xa380('0x75')]['id'],'name':_0x140536['Trunk']['name'],'active':_0x140536[_0xa380('0x75')][_0xa380('0x76')],'callerid':_0x140536[_0xa380('0x75')]['callerid']};}if(_0x140536['Interval']){_0x11de42[_0xa380('0x41')]={'id':_0x140536[_0xa380('0x41')]['id'],'name':_0x140536[_0xa380('0x41')][_0xa380('0x3d')]};}var _0x1f5820=md5(JSON[_0xa380('0x47')](_0x11de42));if(_0x140536[_0xa380('0x77')]!==_0x1f5820){_0x140536[_0xa380('0x77')]=_0x1f5820;emit(util['format'](_0xa380('0x78'),_0x11de42[_0xa380('0x3d')]),'voice_queue:save',_0x11de42);}}}function emitCampaignSummary(_0x40ef0a){if(_0x40ef0a[_0xa380('0x4c')]===_0xa380('0x79')){emit(util['format'](_0xa380('0x7a'),_0x40ef0a['name']),_0xa380('0x7b'),_0x40ef0a);}}function checkGetDataPredictive(_0x42cf68){if(isNotNull(_0x42cf68)&&!_[_0xa380('0x45')](_0x42cf68)){loggerPredictive[_0xa380('0x7c')](_0xa380('0x7d'));loggerPredictive[_0xa380('0x7c')](_0xa380('0x7e'),_0x42cf68['predictiveIntervalTotalCalls']);loggerPredictive[_0xa380('0x7c')](_0xa380('0x7f'),_0x42cf68['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0xa380('0x80'),_0x42cf68['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xa380('0x7c')](_0xa380('0x81'),_0x42cf68[_0xa380('0x69')]);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x42cf68['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0xa380('0x82'),_0x42cf68[_0xa380('0x83')]);loggerPredictive[_0xa380('0x7c')](_0xa380('0x84'));if(_0x42cf68[_0xa380('0x85')]>0x0){if(!_['isUndefined'](_0x42cf68[_0xa380('0x83')])&&_0x42cf68['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xa380('0x7c')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xa380('0x3a')](_0x42cf68[_0xa380('0x68')])&&_0x42cf68[_0xa380('0x68')]>0x0){return!![];}loggerPredictive[_0xa380('0x7c')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xa380('0x7c')](_0xa380('0x86'));}}else{loggerPredictive[_0xa380('0x7c')](_0xa380('0x87'));}return![];}function mergeDataErlangB(_0x5cd496){return function(_0x3a8d0){loggerPredictive['info'](_0xa380('0x88'));loggerPredictive[_0xa380('0x7c')](_0xa380('0x89'),_0x3a8d0[_0xa380('0x70')]);loggerPredictive[_0xa380('0x7c')](_0xa380('0x8a'),_0x3a8d0['erlangCallToSecond']);loggerPredictive[_0xa380('0x7c')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a8d0[_0xa380('0x72')]);loggerPredictive[_0xa380('0x7c')](_0xa380('0x8b'),_0x3a8d0[_0xa380('0x73')]);loggerPredictive[_0xa380('0x7c')](_0xa380('0x8c'),_0x3a8d0[_0xa380('0x72')]);loggerPredictive[_0xa380('0x7c')](_0xa380('0x84'));_[_0xa380('0x8d')](_0x5cd496,_0x3a8d0);};}function getDiff(_0x4fc1ae){var _0x35b2e2=moment()[_0xa380('0x48')](0x0);var _0x2cff8a=moment(_0x4fc1ae)[_0xa380('0x48')](0x0);return _0x35b2e2['diff'](_0x2cff8a,'seconds');}function ifInterval(_0x2f91b1,_0x386a1c){if(_['isUndefined'](_0x386a1c)){return![];}return getDiff(_0x386a1c)<_0x2f91b1*0x3c;}function freeVariablesPredictive(_0x50d121){if(isNotNull(_0x50d121)){if(!_['isUndefined'](_0x50d121[_0xa380('0x74')])){_0x50d121[_0xa380('0x74')]=undefined;loggerPredictive[_0xa380('0x7c')](_0x50d121['name'],_0xa380('0x8e'));}if(!_['isUndefined'](_0x50d121['startPredictive'])){_0x50d121[_0xa380('0x23')]=undefined;loggerPredictive['info'](_0x50d121[_0xa380('0x3d')],_0xa380('0x8f'));}if(!_[_0xa380('0x3a')](_0x50d121[_0xa380('0x90')])){clearInterval(_0x50d121[_0xa380('0x90')]);_0x50d121[_0xa380('0x90')]=undefined;loggerPredictive[_0xa380('0x7c')](_0x50d121[_0xa380('0x3d')],_0xa380('0x91'));}}}function erlangb(_0x29aacb,_0x821831){if(_0x821831===0x0){return 0x0;}var _0x1482b1=0x1;for(var _0x4ee9ab=0x1;_0x4ee9ab<=_0x821831;_0x4ee9ab+=0x1){_0x1482b1=0x1+_0x1482b1*_0x4ee9ab/_0x29aacb;}return 0x1/_0x1482b1;}function isVoiceQueueOutbound(_0x5f4df6){return _0x5f4df6===_0xa380('0x92');}function isNotPreview(_0x2a2314){return _0x2a2314!==_0xa380('0x1b');}function isCampaignIvr(_0x2ef89d){return _0x2ef89d===_0xa380('0x79');}function getCallerId(_0x12a212,_0x552238,_0x1f2f0a){if(!_[_0xa380('0x3a')](_0x1f2f0a)&&typeof _0x1f2f0a===_0xa380('0x93')&&!_[_0xa380('0x45')](_0x1f2f0a)){if(!_[_0xa380('0x3a')](_0x552238)&&typeof _0x552238===_0xa380('0x93')&&!_['isEmpty'](_0x552238)){return util[_0xa380('0x94')]('\x22%s\x22\x20<%s>',_0x552238,_0x1f2f0a);}return util[_0xa380('0x94')](_0xa380('0x95'),_0x1f2f0a,_0x1f2f0a);}if(!_['isUndefined'](_0x12a212)&&typeof _0x12a212===_0xa380('0x93')&&!_[_0xa380('0x45')](_0x12a212)){return _0x12a212;}return _0xa380('0x96');}function loggerCatchQueueSummary(_0x2366cf,_0x5173a1){return function(_0x5eb552){freeVariablesPredictive(_0x5173a1);emitVoiceQueueSummary(_0x5173a1);emitCampaignSummary(_0x5173a1);loggerSyncQueueSummary[_0xa380('0x97')](_0x2366cf,util[_0xa380('0x98')](_0x5eb552,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1e1ab6,_0xc55723){return function(_0xa982a7){loggerPredictive['error'](_0xc55723[_0xa380('0x3d')],_0x1e1ab6);loggerPredictive[_0xa380('0x97')](_0xa982a7['stack']);freeVariablesPredictive(_0xc55723);};}function loggerCatch(_0x390681){return function(_0x2994f8){logger[_0xa380('0x97')](_0x390681,util['inspect'](_0x2994f8,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x302fe3){return _0x302fe3&&!_['isUndefined'](_0x302fe3)&&_0x302fe3[_0xa380('0x99')]>0x0;}function decremetOriginate(_0x110178){if(!_[_0xa380('0x3a')](_0x110178)&&_0x110178!==null){if(typeof _0x110178['originated']!==_0xa380('0x9a')){if(_0x110178[_0xa380('0x6f')]>0x0){_0x110178[_0xa380('0x6f')]-=0x1;}else{logger['error'](_0xa380('0x9b'));}}}else{logger[_0xa380('0x97')](_0xa380('0x9c'));}}function checkContactLowerLimitOriginate(_0x25f1d1,_0x443b66,_0x4fdd71){if(_0x443b66>_0x4fdd71){for(var _0x58f656=0x0;_0x58f656<_0x443b66-_0x4fdd71;_0x58f656+=0x1){decremetOriginate(_0x25f1d1);}}}function loggerGetContactDialer(_0x1e8037,_0x268c0e,_0x53aa16){return function(_0xd16678){checkContactLowerLimitOriginate(_0x268c0e,_0x53aa16,0x0);logger[_0xa380('0x97')](_0x1e8037,util['inspect'](_0xd16678,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3bc846){return function(_0x2aa349){if(isNotNull(_0x2aa349)&&isNotNull(_0x2aa349[0x0])){if(_0x2aa349[0x0][_0xa380('0x9d')]>0x0){_0x3bc846[_0xa380('0x3b')]=_0xa380('0x9e');logger[_0xa380('0x7c')](_0xa380('0x9f')+_0x3bc846[_0xa380('0x3d')],_0x2aa349[0x0]['contactsRescheduled'],_0xa380('0xa0'));}else{_0x3bc846[_0xa380('0x3b')]=_0xa380('0xa1');logger['info']('[getContactDialer2][Empty]'+_0x3bc846[_0xa380('0x3d')]);}}};}function notSendMessagesQueue(_0x2559c3){if(_0x2559c3[_0xa380('0xa2')]){freeVariablesPredictive(_0x2559c3);if(_0x2559c3[_0xa380('0x6f')]===0x0&&_0x2559c3[_0xa380('0xa3')]===0x0&&_0x2559c3['waiting']===0x0&&(_0x2559c3['pTalking']||0x0)===0x0){_0x2559c3[_0xa380('0xa2')]=![];_0x2559c3['available']=0x0;_0x2559c3['message']=_0xa380('0x3f');loggerSyncQueueSummary[_0xa380('0x97')](_0xa380('0xa4'),_0x2559c3[_0xa380('0x3d')],_0xa380('0xa5'));}else{_0x2559c3[_0xa380('0x3b')]=_0xa380('0xa6');loggerSyncQueueSummary[_0xa380('0x97')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x2559c3[_0xa380('0x3d')],_0xa380('0xa7'));}emitVoiceQueueSummary(_0x2559c3);}}function notSendMessagesCampaign(_0x86b540){if(_0x86b540[_0xa380('0xa2')]){if(_0x86b540['originated']===0x0){_0x86b540[_0xa380('0xa2')]=![];_0x86b540[_0xa380('0x3b')]=_0xa380('0x3f');loggerSyncQueueSummary[_0xa380('0x97')](_0xa380('0xa8'),_0x86b540[_0xa380('0x3d')],_0xa380('0xa5'));}else{_0x86b540['message']=_0xa380('0xa6');loggerSyncQueueSummary['error'](_0xa380('0xa8'),_0x86b540[_0xa380('0x3d')],'is\x20disactive');}emitCampaignSummary(_0x86b540);}}function createObjHistory(_0x43872e,_0x18a13c,_0x275690,_0x3d87d0,_0x574204){_0x43872e[_0xa380('0x3b')]=_0x275690;var _0x3b0b1b=new Action(_0x43872e,_0x18a13c);var _0x1b2926=new History(_0x3b0b1b);_0x1b2926[_0xa380('0xa9')]=_0x3d87d0;_0x1b2926[_0xa380('0xaa')]=_0x574204;_0x1b2926[_0xa380('0xab')]=_0x3b0b1b['starttime'];return _0x1b2926;}Dialer[_0xa380('0xac')][_0xa380('0x39')]=function(){var _0x25b268=this;setInterval(function(){_0x25b268[_0xa380('0xad')](_0x25b268[_0xa380('0xae')],'[uniqueid]');_0x25b268['clearZombieChannels'](_0x25b268[_0xa380('0xaf')],_0xa380('0xb0'));},0x32c8);};Dialer[_0xa380('0xac')][_0xa380('0xad')]=function(_0x407fa3,_0x2f0fc1){var _0x254047=this;for(var _0x3db5fb in _0x407fa3){if(typeof _0x407fa3[_0x3db5fb]!==_0xa380('0x9a')){this[_0xa380('0xb1')][_0xa380('0x18')](function(){if(!_['isNil'](_0x407fa3[_0x3db5fb])){return ami[_0xa380('0xb2')]({'action':_0xa380('0xb3'),'channel':_0x407fa3[_0x3db5fb][_0xa380('0xb4')]})[_0xa380('0xb5')](function(_0x40bf29){if(_0x40bf29['message']===_0xa380('0xb6')){setTimeout(function(){if(_0x407fa3[_0x3db5fb]&&_0x407fa3[_0x3db5fb]['type']!==_0xa380('0x79')){_0x254047[_0xa380('0xb7')](_0x254047[_0xa380('0x1c')][_0x407fa3[_0x3db5fb][_0xa380('0xb8')]]);logger['error'](_0xa380('0xb9'),_0x2f0fc1,_0x3db5fb,_0x407fa3[_0x3db5fb]['queue']);delete _0x407fa3[_0x3db5fb];}if(_0x407fa3[_0x3db5fb]&&_0x407fa3[_0x3db5fb][_0xa380('0x4c')]===_0xa380('0x79')){_0x254047[_0xa380('0xb7')](_0x254047[_0xa380('0x1d')][_0x407fa3[_0x3db5fb]['queue']]);logger[_0xa380('0x97')](_0xa380('0xba'),_0x2f0fc1,_0x3db5fb,_0x407fa3[_0x3db5fb]['queue']);delete _0x407fa3[_0x3db5fb];}},0x2328);}});}});}}};Dialer['prototype']['countReScheduled']=function(_0x594280){return BPromise['resolve']()[_0xa380('0xbb')](cmHopper[_0xa380('0xbc')](_0x594280))[_0xa380('0xb5')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xa380('0xac')][_0xa380('0xbd')]=function(_0x2dcf5c){return BPromise[_0xa380('0xbe')]()[_0xa380('0xbb')](cmHopperBlack[_0xa380('0xbd')](_0x2dcf5c))[_0xa380('0xb5')](loggerCatch(_0xa380('0xbf')));};Dialer['prototype'][_0xa380('0xc0')]=function(_0x27ed7f){return BPromise[_0xa380('0xbe')]()[_0xa380('0xbb')](cmHopperBlack[_0xa380('0xc0')](_0x27ed7f))[_0xa380('0xb5')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer['prototype'][_0xa380('0xc1')]=function(_0x41dd54){return BPromise['resolve']()[_0xa380('0xbb')](cmHopperHistory[_0xa380('0xc2')](_0x41dd54))[_0xa380('0xb5')](loggerCatch(_0xa380('0xc3')));};Dialer[_0xa380('0xac')][_0xa380('0xc4')]=function(_0xe5cfd2){return BPromise['resolve']()[_0xa380('0xbb')](cmHopper[_0xa380('0xc4')](_0xe5cfd2))['catch'](loggerCatch(_0xa380('0xc5')));};Dialer[_0xa380('0xac')][_0xa380('0xc6')]=function(_0x1b6037,_0x3b7450,_0x27e851){return BPromise['resolve']()['then'](cmHopper['unlockContact'](_0x1b6037,_0x3b7450,_0x27e851))[_0xa380('0xb5')](loggerCatch(_0xa380('0xc7')));};Dialer[_0xa380('0xac')][_0xa380('0xc8')]=function(_0x86bafe,_0xf3b188,_0x1a3772,_0x4469b5){return BPromise[_0xa380('0xbe')]()[_0xa380('0xbb')](cmHopper['getContactDialer'](_0x86bafe,_0xf3b188,_0x1a3772,_0x4469b5))[_0xa380('0xb5')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xa380('0xac')][_0xa380('0xc9')]=function(_0x1885d2,_0x2579b6,_0x16921f){return BPromise['resolve']()['then'](cmHopper[_0xa380('0xc9')](_0x1885d2,_0x2579b6,_0x16921f))[_0xa380('0xb5')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xa380('0xac')][_0xa380('0xca')]=function(_0x1b0cb3){return BPromise[_0xa380('0xbe')]()[_0xa380('0xbb')](voiceQueueRt[_0xa380('0xca')](_0x1b0cb3))[_0xa380('0xb5')](loggerCatch(_0xa380('0xcb')));};Dialer['prototype'][_0xa380('0xcc')]=function(_0x21a389){return BPromise[_0xa380('0xbe')]()[_0xa380('0xbb')](cmHopper[_0xa380('0xcc')](_0x21a389))['catch'](loggerCatch(_0xa380('0xcd')));};Dialer[_0xa380('0xac')][_0xa380('0xce')]=function(_0x31f4ad){return BPromise[_0xa380('0xbe')]()['then'](cmHopperHistory[_0xa380('0xce')](_0x31f4ad))[_0xa380('0xb5')](loggerCatch(_0xa380('0xcf')));};Dialer[_0xa380('0xac')][_0xa380('0xb7')]=function(_0x1b1b6c){if(!_[_0xa380('0x3a')](_0x1b1b6c)&&_0x1b1b6c!==null){if(typeof _0x1b1b6c[_0xa380('0x6f')]!==_0xa380('0x9a')){if(_0x1b1b6c[_0xa380('0x6f')]>0x0){_0x1b1b6c['originated']-=0x1;}else{logger['error'](_0xa380('0xd0'));}}}else{logger[_0xa380('0x97')](_0xa380('0xd1'));}};Dialer[_0xa380('0xac')][_0xa380('0xd2')]=function(_0x198a83,_0x400f15){var _0x4150ed=this;return function(_0x213120){_0x4150ed[_0xa380('0xb7')](_0x400f15);logger[_0xa380('0x97')](_0x198a83,util[_0xa380('0x98')](_0x213120,{'showHidden':![],'depth':null}));};};Dialer[_0xa380('0xac')][_0xa380('0xd3')]=function(_0x5c0439,_0x5a2891,_0x53d002){var _0x22c0e3={'state':0x19,'statedesc':_0xa380('0xd4')};this[_0xa380('0xb7')](_0x5a2891);this[_0xa380('0xd5')](_[_0xa380('0x8d')](_0x22c0e3,_['pick'](_0x53d002,[_0xa380('0xd6'),_0xa380('0xd7'),_0xa380('0xd8'),'VoiceQueueId',_0xa380('0xd9')])),'[emptyContact][createHistory]','[emptyContact]');logger[_0xa380('0x97')](_0x5c0439);};Dialer['prototype'][_0xa380('0xda')]=function(_0x5b3baa){return _0x5b3baa===_0xa380('0xdb');};Dialer['prototype'][_0xa380('0xdc')]=function(_0x3076f1){return!_[_0xa380('0x3a')](_0x3076f1)&&_0x3076f1&&!_['isUndefined'](_0x3076f1['name'])&&!_[_0xa380('0x3a')](_0x3076f1[_0xa380('0x76')])&&_0x3076f1[_0xa380('0x76')]&&(this[_0xa380('0x1f')][util['format'](_0xa380('0xdd'),_0x3076f1[_0xa380('0x3d')])][_0xa380('0xb3')]==='reachable'||this[_0xa380('0x1f')][util[_0xa380('0x94')](_0xa380('0xdd'),_0x3076f1[_0xa380('0x3d')])][_0xa380('0xb3')]==='unmonitored');};Dialer[_0xa380('0xac')][_0xa380('0xd5')]=function(_0x1f1c1b,_0x22e52e,_0x2ff3e8){this[_0xa380('0xce')](_0x1f1c1b)[_0xa380('0xb5')](loggerCatch(_0x22e52e));this[_0xa380('0xcc')](_0x1f1c1b)['catch'](loggerCatch(_0x2ff3e8));};Dialer[_0xa380('0xac')][_0xa380('0x35')]=function(_0x57e2c2){var _0x4441dd=this['uniqueId'][_0x57e2c2[_0xa380('0xde')]];var _0x34c480;if(!_['isNil'](_0x57e2c2)&&!_[_0xa380('0xdf')](_0x57e2c2[_0xa380('0xe0')])&&!_[_0xa380('0xdf')](_0x57e2c2['variable']['amdstatus'])&&_0x57e2c2['exten']==='xcally-motion-dialer'&&_0x4441dd){if(_0x4441dd[_0xa380('0x4c')]!==_0xa380('0x79')&&this[_0xa380('0x1c')][_0x4441dd['queue']]['dialAMDActive']&&_0x57e2c2[_0xa380('0xe1')]===_0xa380('0xe2')){delete this['uniqueId'][_0x57e2c2['uniqueid']];this['updateOriginated'](this[_0xa380('0x1c')][_0x4441dd['queue']]);this[_0xa380('0x1c')][_0x4441dd[_0xa380('0xb8')]][_0xa380('0xe3')]+=0x1;this[_0xa380('0x1c')][_0x4441dd[_0xa380('0xb8')]][_0xa380('0x5c')]+=0x1;_0x34c480=new Hangup(_0x4441dd,_0x57e2c2);_0x34c480[_0xa380('0xa9')]=0x12;_0x34c480[_0xa380('0xaa')]=_0xa380('0xe4');_0x34c480[_0xa380('0xe5')]=_0xa380('0xe6');this['saveInDb'](_0x34c480,_0xa380('0xe7'),_0xa380('0xe8'));}if(_0x4441dd[_0xa380('0x4c')]!==_0xa380('0x79')&&this['voiceQueues'][_0x4441dd[_0xa380('0xb8')]][_0xa380('0xe9')]&&_0x57e2c2['value']===_0xa380('0xea')){var _0x3a85d4=this;return new BPromise(function(_0xedf941,_0x4684b3){delete _0x3a85d4[_0xa380('0xae')][_0x57e2c2[_0xa380('0xde')]];_0x3a85d4[_0xa380('0xb7')](_0x3a85d4[_0xa380('0x1c')][_0x4441dd['queue']]);_0x3a85d4['voiceQueues'][_0x4441dd[_0xa380('0xb8')]][_0xa380('0xe3')]+=0x1;_0x3a85d4['voiceQueues'][_0x4441dd['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x44fa28=_0x3a85d4['voiceQueues'][_0x4441dd[_0xa380('0xb8')]];var _0x27ccd0=new Hangup(_0x4441dd,_0x57e2c2);_0x27ccd0[_0xa380('0xa9')]=0x13;_0x27ccd0['statedesc']=_0xa380('0xeb');_0x27ccd0[_0xa380('0xe5')]=_0xa380('0xe6');_0x27ccd0[_0xa380('0xec')]+=0x1;_0x27ccd0[_0xa380('0xed')]+=0x1;_0x27ccd0['amd']=!![];_0x3a85d4['createHistory'](_0x27ccd0)[_0xa380('0xb5')](loggerCatch(_0xa380('0xee')));if(_0x27ccd0[_0xa380('0xef')]+_0x27ccd0['countcongestionretry']+_0x27ccd0[_0xa380('0xf0')]+_0x27ccd0[_0xa380('0xf1')]+_0x27ccd0[_0xa380('0xf2')]+_0x27ccd0[_0xa380('0xf3')]+_0x27ccd0[_0xa380('0xec')]+_0x27ccd0[_0xa380('0xf4')]>=_0x44fa28[_0xa380('0xf5')]){_0x3a85d4[_0xa380('0xf6')](_0x27ccd0,_0xedf941,_0x4684b3,_0xa380('0xf7'));}else{if(_0x27ccd0[_0xa380('0xec')]>=_0x44fa28[_0xa380('0xf8')]){_0x3a85d4['createStateFinal'](_0x27ccd0,_0xedf941,_0x4684b3,_0xa380('0xf9'));}else{_0x3a85d4[_0xa380('0xc4')]({'active':![],'countmachineretry':_0x27ccd0[_0xa380('0xec')],'scheduledat':moment()[_0xa380('0xfa')](_0x44fa28[_0xa380('0xfb')],_0xa380('0xfc'))['format'](_0xa380('0xfd')),'ContactId':_0x27ccd0['ContactId'],'ListId':_0x27ccd0[_0xa380('0xd7')],'VoiceQueueId':_0x27ccd0[_0xa380('0xfe')]||undefined,'CampaignId':_0x27ccd0[_0xa380('0xd9')]||undefined})['catch'](loggerCatch(_0xa380('0xff')));_0xedf941({'reschedule':0x1});}}});}if(_0x4441dd[_0xa380('0x4c')]==='ivr'&&this['campaigns'][_0x4441dd[_0xa380('0xb8')]][_0xa380('0xe9')]&&_0x57e2c2[_0xa380('0xe1')]===_0xa380('0xe2')){delete this[_0xa380('0xae')][_0x57e2c2['uniqueid']];this[_0xa380('0xb7')](this[_0xa380('0x1d')][_0x4441dd['queue']]);_0x34c480=new Hangup(_0x4441dd,_0x57e2c2);_0x34c480[_0xa380('0xa9')]=0x12;_0x34c480[_0xa380('0xaa')]=_0xa380('0xe4');_0x34c480[_0xa380('0xe5')]=_0xa380('0xe6');this[_0xa380('0xd5')](_0x34c480,'[syncHangupInAMDIvr][createHistory]',_0xa380('0x100'));}if(_0x4441dd[_0xa380('0x4c')]===_0xa380('0x79')&&this[_0xa380('0x1d')][_0x4441dd[_0xa380('0xb8')]]['dialAMDActive']&&_0x57e2c2[_0xa380('0xe1')]===_0xa380('0xea')){var _0x3a85d4=this;return new BPromise(function(_0x1aaca6,_0x2cfdb8){delete _0x3a85d4[_0xa380('0xae')][_0x57e2c2[_0xa380('0xde')]];_0x3a85d4[_0xa380('0xb7')](_0x3a85d4[_0xa380('0x1d')][_0x4441dd[_0xa380('0xb8')]]);_0x3a85d4[_0xa380('0x1d')][_0x4441dd[_0xa380('0xb8')]][_0xa380('0xe3')]+=0x1;_0x3a85d4[_0xa380('0x1d')][_0x4441dd[_0xa380('0xb8')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x234a3c=_0x3a85d4['campaigns'][_0x4441dd['queue']];var _0x54d7bf=new Hangup(_0x4441dd,_0x57e2c2);_0x54d7bf['state']=0x13;_0x54d7bf[_0xa380('0xaa')]=_0xa380('0xeb');_0x54d7bf[_0xa380('0xe5')]=_0xa380('0xe6');_0x54d7bf[_0xa380('0xec')]+=0x1;_0x54d7bf['countglobal']+=0x1;_0x54d7bf[_0xa380('0x101')]=!![];_0x3a85d4[_0xa380('0xce')](_0x54d7bf)[_0xa380('0xb5')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x54d7bf[_0xa380('0xef')]+_0x54d7bf['countcongestionretry']+_0x54d7bf[_0xa380('0xf0')]+_0x54d7bf['countnosuchnumberretry']+_0x54d7bf[_0xa380('0xf2')]+_0x54d7bf[_0xa380('0xf3')]+_0x54d7bf[_0xa380('0xec')]+_0x54d7bf[_0xa380('0xf4')]>=_0x234a3c[_0xa380('0xf5')]){_0x3a85d4[_0xa380('0xf6')](_0x54d7bf,_0x1aaca6,_0x2cfdb8,'reason19\x20machine....');}else{if(_0x54d7bf[_0xa380('0xec')]>=_0x234a3c[_0xa380('0xf8')]){_0x3a85d4['createStateFinal'](_0x54d7bf,_0x1aaca6,_0x2cfdb8,_0xa380('0xf9'));}else{_0x3a85d4[_0xa380('0xc4')]({'active':![],'countmachineretry':_0x54d7bf[_0xa380('0xec')],'scheduledat':moment()['add'](_0x234a3c[_0xa380('0xfb')],_0xa380('0xfc'))['format'](_0xa380('0xfd')),'ContactId':_0x54d7bf[_0xa380('0xd6')],'ListId':_0x54d7bf[_0xa380('0xd7')],'VoiceQueueId':_0x54d7bf[_0xa380('0xfe')]||undefined,'CampaignId':_0x54d7bf[_0xa380('0xd9')]||undefined})[_0xa380('0xb5')](loggerCatch(_0xa380('0xff')));_0x1aaca6({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xa380('0x102')]=function(_0x5abe4a){var _0x2b877d=this['uniqueId'][_0x5abe4a[_0xa380('0xde')]];var _0x49768a=this;var _0x1f3f87;if(_0x2b877d&&_0x2b877d[_0xa380('0x4c')]===_0xa380('0x79')){delete this[_0xa380('0xae')][_0x5abe4a[_0xa380('0xde')]];this['updateOriginated'](this['campaigns'][_0x2b877d['queue']]);this[_0xa380('0x1d')][_0x2b877d[_0xa380('0xb8')]][_0xa380('0x103')]+=0x1;_0x1f3f87=new Hangup(_0x2b877d,_0x5abe4a);this[_0xa380('0xce')](_0x1f3f87)[_0xa380('0xb5')](loggerCatch(_0xa380('0x104')));this[_0xa380('0xcc')](_0x1f3f87)[_0xa380('0xb5')](loggerCatch(_0xa380('0x105')));}if(_0x2b877d&&_0x2b877d[_0xa380('0x4c')]!==_0xa380('0x79')&&isNotNull(this[_0xa380('0x1c')][_0x2b877d['queue']]['dialQueueProject'])){delete this['uniqueId'][_0x5abe4a[_0xa380('0xde')]];this[_0xa380('0xb7')](this[_0xa380('0x1c')][_0x2b877d[_0xa380('0xb8')]]);this[_0xa380('0x1c')][_0x2b877d[_0xa380('0xb8')]][_0xa380('0xe3')]+=0x1;this[_0xa380('0x1c')][_0x2b877d[_0xa380('0xb8')]][_0xa380('0x5c')]+=0x1;_0x1f3f87=new Hangup(_0x2b877d,_0x5abe4a);_0x1f3f87[_0xa380('0xa9')]=0x10;_0x1f3f87[_0xa380('0xaa')]=_0xa380('0x106');_0x1f3f87[_0xa380('0xe5')]=_0xa380('0x107');this['createHistory'](_0x1f3f87)[_0xa380('0xb5')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xa380('0xcc')](_0x1f3f87)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x2b877d&&_0x2b877d[_0xa380('0x4c')]!=='ivr'&&!isNotNull(this[_0xa380('0x1c')][_0x2b877d[_0xa380('0xb8')]][_0xa380('0x108')])){delete this[_0xa380('0xae')][_0x5abe4a[_0xa380('0xde')]];this[_0xa380('0xb7')](this[_0xa380('0x1c')][_0x2b877d[_0xa380('0xb8')]]);this[_0xa380('0x1c')][_0x2b877d[_0xa380('0xb8')]]['outboundUnknownCallsDay']+=0x1;_0x1f3f87=new Hangup(_0x2b877d,_0x5abe4a);_0x1f3f87[_0xa380('0xa9')]=0xc;_0x1f3f87[_0xa380('0xaa')]=_0x5abe4a[_0xa380('0x109')];_0x1f3f87[_0xa380('0xe5')]=_0xa380('0x10a');this['createHistory'](_0x1f3f87)[_0xa380('0xb5')](loggerCatch(_0xa380('0x104')));this['moveContactManagedDialer'](_0x1f3f87)[_0xa380('0xb5')](loggerCatch(_0xa380('0x105')));}};Dialer[_0xa380('0xac')][_0xa380('0x10b')]=function(_0x44b42f){var _0x867a26=this[_0xa380('0xae')][_0x44b42f['uniqueid']];var _0x256038=this;if(this[_0xa380('0x1c')][_0x44b42f[_0xa380('0xb8')]]){if(_0x867a26&&_0x867a26[_0xa380('0x4c')]!==_0xa380('0x79')){delete this[_0xa380('0xae')][_0x44b42f['uniqueid']];this['voiceQueues'][_0x44b42f[_0xa380('0xb8')]][_0xa380('0xe3')]+=0x1;var _0x2d15ed=new AgentComplete(_0x867a26,_0x44b42f);if(_0x44b42f[_0xa380('0x10c')]===_0xa380('0x10d')){_0x2d15ed['agiafterat']=this[_0xa380('0x1c')][_0x44b42f[_0xa380('0xb8')]]['dialQueueProject2']&&this[_0xa380('0x1c')][_0x44b42f[_0xa380('0xb8')]][_0xa380('0x10e')]?moment()[_0xa380('0x94')](_0xa380('0xfd')):undefined;}this[_0xa380('0xce')](_0x2d15ed)[_0xa380('0xb5')](loggerCatch(_0xa380('0x10f')));this[_0xa380('0xcc')](_0x2d15ed)[_0xa380('0xb5')](loggerCatch(_0xa380('0x110')));}}};Dialer[_0xa380('0xac')][_0xa380('0x28')]=function(_0x12d200){if(this[_0xa380('0x1c')][_0x12d200[_0xa380('0xb8')]]){if(this[_0xa380('0xae')][_0x12d200[_0xa380('0xde')]]&&this[_0xa380('0xae')][_0x12d200['uniqueid']]['type']!==_0xa380('0x79')){this[_0xa380('0xb7')](this[_0xa380('0x1c')][_0x12d200[_0xa380('0xb8')]]);this[_0xa380('0xae')][_0x12d200[_0xa380('0xde')]][_0xa380('0x111')]=moment()['format'](_0xa380('0xfd'));}}};Dialer[_0xa380('0xac')][_0xa380('0x112')]=function(_0x432712){this['createHistory'](_0x432712)['catch'](loggerCatch(_0xa380('0x10f')));this['moveContactManagedDialer'](_0x432712)[_0xa380('0xb5')](loggerCatch(_0xa380('0x113')));};Dialer[_0xa380('0xac')][_0xa380('0x2b')]=function(_0x20e4ea){var _0x4dd4c1=this[_0xa380('0xae')][_0x20e4ea[_0xa380('0xde')]];var _0x1e6e9e=this;if(this[_0xa380('0x1c')][_0x20e4ea[_0xa380('0xb8')]]){if(_0x4dd4c1&&_0x4dd4c1[_0xa380('0x4c')]!==_0xa380('0x79')){delete this[_0xa380('0xae')][_0x20e4ea[_0xa380('0xde')]];this['updateOriginated'](this['voiceQueues'][_0x20e4ea[_0xa380('0xb8')]]);_0x4dd4c1[_0xa380('0x114')]=moment()['format'](_0xa380('0xfd'));var _0x2dd24f=new QueueCallerAbandon(_0x4dd4c1,_0x20e4ea);if(getSeconds(_0x4dd4c1[_0xa380('0x114')],_0x4dd4c1[_0xa380('0x115')])>=_0x4dd4c1[_0xa380('0x116')]){this[_0xa380('0x1c')][_0x20e4ea[_0xa380('0xb8')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xa380('0x1c')][_0x20e4ea[_0xa380('0xb8')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xa380('0x1c')][_0x20e4ea[_0xa380('0xb8')]][_0xa380('0x6b')]+=0x1;_0x2dd24f[_0xa380('0xa9')]=0xa;_0x2dd24f[_0xa380('0xaa')]=_0xa380('0x117');_0x2dd24f['dropreason']=_0xa380('0x118');_0x2dd24f[_0xa380('0x119')]=this[_0xa380('0x1c')][_0x20e4ea[_0xa380('0xb8')]][_0xa380('0x11a')]?moment()[_0xa380('0x94')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x2dd24f[_0xa380('0xf2')]+=0x1;_0x2dd24f[_0xa380('0xed')]+=0x1;if(_0x2dd24f[_0xa380('0xf2')]>=this[_0xa380('0x1c')][_0x20e4ea['queue']][_0xa380('0x11b')]){this[_0xa380('0x112')](_0x2dd24f);}else{this[_0xa380('0xc4')]({'active':![],'countdropretry':_0x2dd24f[_0xa380('0xf2')],'scheduledat':moment()[_0xa380('0xfa')](this['voiceQueues'][_0x20e4ea[_0xa380('0xb8')]][_0xa380('0x11c')],_0xa380('0xfc'))[_0xa380('0x94')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4dd4c1['ContactId'],'ListId':_0x4dd4c1[_0xa380('0xd7')],'VoiceQueueId':_0x4dd4c1['VoiceQueueId']||undefined,'CampaignId':_0x4dd4c1[_0xa380('0xd9')]||undefined})[_0xa380('0xb5')](loggerCatch(_0xa380('0x11d')));var _0x561806=new History(_0x2dd24f);_0x561806[_0xa380('0xa9')]=0xa;_0x561806[_0xa380('0xaa')]=_0xa380('0x117');_0x561806[_0xa380('0x11e')]=moment()[_0xa380('0x94')]('YYYY-MM-DD\x20HH:mm:ss');_0x561806[_0xa380('0xab')]=_0x561806[_0xa380('0x11e')];_0x561806[_0xa380('0x11f')]=_0x2dd24f[_0xa380('0x11f')];_0x561806[_0xa380('0x120')]=_0x2dd24f['calleridnum'];this[_0xa380('0xce')](_0x561806)[_0xa380('0xb5')](loggerCatch(_0xa380('0x121')));}}else{this[_0xa380('0x1c')][_0x20e4ea['queue']][_0xa380('0x69')]+=0x1;this[_0xa380('0x1c')][_0x20e4ea[_0xa380('0xb8')]][_0xa380('0x60')]+=0x1;_0x2dd24f[_0xa380('0xa9')]=0xb;_0x2dd24f[_0xa380('0xaa')]=_0xa380('0x122');_0x2dd24f[_0xa380('0x123')]=_0xa380('0x124');_0x2dd24f[_0xa380('0xf3')]+=0x1;_0x2dd24f[_0xa380('0xed')]+=0x1;if(_0x2dd24f[_0xa380('0xf3')]>=this[_0xa380('0x1c')][_0x20e4ea[_0xa380('0xb8')]][_0xa380('0x125')]){this[_0xa380('0x112')](_0x2dd24f);}else{this[_0xa380('0xc4')]({'active':![],'countabandonedretry':_0x2dd24f[_0xa380('0xf3')],'scheduledat':moment()[_0xa380('0xfa')](this[_0xa380('0x1c')][_0x20e4ea[_0xa380('0xb8')]]['dialAbandonedRetryFrequency'],'minutes')[_0xa380('0x94')](_0xa380('0xfd')),'ContactId':_0x4dd4c1[_0xa380('0xd6')],'ListId':_0x4dd4c1[_0xa380('0xd7')],'VoiceQueueId':_0x4dd4c1['VoiceQueueId']||undefined,'CampaignId':_0x4dd4c1[_0xa380('0xd9')]||undefined})[_0xa380('0xb5')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x561806=new History(_0x2dd24f);_0x561806['state']=0xb;_0x561806[_0xa380('0xaa')]=_0xa380('0x122');_0x561806[_0xa380('0x11e')]=moment()[_0xa380('0x94')]('YYYY-MM-DD\x20HH:mm:ss');_0x561806[_0xa380('0xab')]=_0x561806[_0xa380('0x11e')];_0x561806[_0xa380('0x11f')]=_0x2dd24f[_0xa380('0x11f')];_0x561806[_0xa380('0x120')]=_0x2dd24f[_0xa380('0x120')];this[_0xa380('0xce')](_0x561806)['catch'](loggerCatch(_0xa380('0x126')));}}}}};Dialer[_0xa380('0xac')][_0xa380('0x33')]=function(_0xcfe6d8){if(this[_0xa380('0xaf')][_0xcfe6d8['uniqueid']]){this[_0xa380('0xaf')][_0xcfe6d8[_0xa380('0xde')]][_0xa380('0xb4')]=_0xcfe6d8[_0xa380('0xb4')];}if(this[_0xa380('0xae')][_0xcfe6d8['uniqueid']]){this['uniqueId'][_0xcfe6d8[_0xa380('0xde')]]['channel']=_0xcfe6d8[_0xa380('0xb4')];}};Dialer[_0xa380('0xac')]['syncQueueMember']=function(_0x3c26b9){if(strategy[this[_0xa380('0x1c')][this['actions'][_0x3c26b9['actionid']][_0xa380('0xb8')]][_0xa380('0x127')]]===_0xa380('0x128')){if(this[_0xa380('0xaf')][_0x3c26b9[_0xa380('0x129')]]&&_['isNil'](this['actions'][_0x3c26b9['actionid']][_0xa380('0x12a')])&&_0x3c26b9[_0xa380('0xb3')]==='1'&&_0x3c26b9['paused']==='0'){if(this[_0xa380('0x1e')][_0x3c26b9[_0xa380('0x12b')]]){if(!this['agents'][_0x3c26b9[_0xa380('0x12b')]][_0xa380('0x12a')]){this[_0xa380('0x1e')][_0x3c26b9[_0xa380('0x12b')]][_0xa380('0x12a')]=!![];this[_0xa380('0xaf')][_0x3c26b9['actionid']]['locked']=!![];this[_0xa380('0xaf')][_0x3c26b9[_0xa380('0x129')]][_0xa380('0x12b')]=_0x3c26b9[_0xa380('0x12b')];}}}}else if((strategy[this[_0xa380('0x1c')][this['actions'][_0x3c26b9[_0xa380('0x129')]][_0xa380('0xb8')]][_0xa380('0x127')]]||_0xa380('0x17'))===_0xa380('0x17')){if(this['actions'][_0x3c26b9['actionid']]){if(this[_0xa380('0x1e')][_0x3c26b9[_0xa380('0x12b')]]){this['actions'][_0x3c26b9[_0xa380('0x129')]][_0xa380('0x12b')]=_0x3c26b9[_0xa380('0x12b')];if(_[_0xa380('0xdf')](this[_0xa380('0x25')][this['actions'][_0x3c26b9[_0xa380('0x129')]][_0xa380('0xb8')]])){this[_0xa380('0x25')][this[_0xa380('0xaf')][_0x3c26b9[_0xa380('0x129')]][_0xa380('0xb8')]]=[];}this[_0xa380('0x25')][this[_0xa380('0xaf')][_0x3c26b9[_0xa380('0x129')]][_0xa380('0xb8')]][_0xa380('0x12c')](_[_0xa380('0x8d')](_[_0xa380('0x12d')](this[_0xa380('0xaf')][_0x3c26b9['actionid']],[_0xa380('0x12e'),_0xa380('0x12b')]),{'status':_0x3c26b9[_0xa380('0xb3')],'paused':_0x3c26b9[_0xa380('0x12f')]}));}}}};function unlockQueueStatus(_0x5e7efe,_0x2dfb88){setTimeout(function(){if(_[_0xa380('0x3a')](_0x5e7efe[_0xa380('0x130')])){loggerBooked['error'](_0xa380('0x131'),_0x2dfb88);}_0x5e7efe[_0xa380('0x130')]=!![];loggerBooked[_0xa380('0x7c')](_0xa380('0x132'),_0x2dfb88,JSON[_0xa380('0x47')](_[_0xa380('0x12d')](_0x5e7efe,['name',_0xa380('0x130')])));},0x1f3);}Dialer[_0xa380('0xac')][_0xa380('0x37')]=function(_0x16a148){var _0x5a1557=this;var _0x59f023=_0x5a1557['voiceQueues'][_0x5a1557['actions'][_0x16a148[_0xa380('0x129')]]['queue']];if(strategy[this['voiceQueues'][this['actions'][_0x16a148[_0xa380('0x129')]][_0xa380('0xb8')]][_0xa380('0x127')]]==='roundrobin'){if(this[_0xa380('0xaf')][_0x16a148[_0xa380('0x129')]]&&this[_0xa380('0xaf')][_0x16a148['actionid']][_0xa380('0x12b')]){this['preview']['run'](this[_0xa380('0xaf')][_0x16a148[_0xa380('0x129')]][_0xa380('0x12e')],this[_0xa380('0xaf')][_0x16a148[_0xa380('0x129')]][_0xa380('0x12b')])[_0xa380('0xb5')](function(_0x2861a1){logger[_0xa380('0x97')](_0xa380('0x133'),util['inspect'](_0x2861a1,{'showHidden':![],'depth':null}));})[_0xa380('0x1a')](function(){_0x5a1557[_0xa380('0xb7')](_0x5a1557[_0xa380('0x1c')][_0x5a1557[_0xa380('0xaf')][_0x16a148[_0xa380('0x129')]][_0xa380('0xb8')]]);_0x5a1557['agents'][_0x5a1557[_0xa380('0xaf')][_0x16a148[_0xa380('0x129')]][_0xa380('0x12b')]][_0xa380('0x12a')]=![];delete _0x5a1557['actions'][_0x16a148['actionid']];unlockQueueStatus(_0x59f023);});}else{this[_0xa380('0xb7')](this[_0xa380('0x1c')][this[_0xa380('0xaf')][_0x16a148[_0xa380('0x129')]][_0xa380('0xb8')]]);this[_0xa380('0xc4')]({'active':![],'ContactId':this[_0xa380('0xaf')][_0x16a148[_0xa380('0x129')]][_0xa380('0xd6')],'ListId':this[_0xa380('0xaf')][_0x16a148['actionid']][_0xa380('0xd7')],'VoiceQueueId':this[_0xa380('0xaf')][_0x16a148['actionid']][_0xa380('0xfe')]||undefined,'CampaignId':this[_0xa380('0xaf')][_0x16a148[_0xa380('0x129')]][_0xa380('0xd9')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x16a148[_0xa380('0x129')]];unlockQueueStatus(_0x59f023);}}else if((strategy[this[_0xa380('0x1c')][this[_0xa380('0xaf')][_0x16a148[_0xa380('0x129')]][_0xa380('0xb8')]][_0xa380('0x127')]]||'rrmemory')===_0xa380('0x17')){var _0x114950;if(this['actions'][_0x16a148[_0xa380('0x129')]]&&!_['isEmpty'](this[_0xa380('0x25')][this[_0xa380('0xaf')][_0x16a148[_0xa380('0x129')]][_0xa380('0xb8')]])){if(this[_0xa380('0x26')][_0x5a1557[_0xa380('0xaf')][_0x16a148['actionid']]['queue']]){this['queueBookedRR'][_0x5a1557[_0xa380('0xaf')][_0x16a148['actionid']][_0xa380('0xb8')]]=this[_0xa380('0x26')][this[_0xa380('0xaf')][_0x16a148[_0xa380('0x129')]][_0xa380('0xb8')]]?this[_0xa380('0x26')][this[_0xa380('0xaf')][_0x16a148[_0xa380('0x129')]][_0xa380('0xb8')]]:this[_0xa380('0x25')][this[_0xa380('0xaf')][_0x16a148[_0xa380('0x129')]][_0xa380('0xb8')]]?this[_0xa380('0x25')][this[_0xa380('0xaf')][_0x16a148[_0xa380('0x129')]][_0xa380('0xb8')]][_0xa380('0x134')]||0x0:0x0;}this['queueBooked'][this[_0xa380('0xaf')][_0x16a148[_0xa380('0x129')]][_0xa380('0xb8')]][_0xa380('0x134')]=this[_0xa380('0x26')][this['actions'][_0x16a148[_0xa380('0x129')]][_0xa380('0xb8')]];for(var _0x2c2f4c=0x0;_0x2c2f4c=0x0;})['catch'](myreject(_0x581dc0)));}}else{_0x53e15b[_0xa380('0x12c')](ami[_0xa380('0xb2')]({'action':_0xa380('0x14b'),'command':util['format'](_0xa380('0x14f'),_0x382c3c,!_['isUndefined'](config[_0xa380('0x147')][_0x39e62a])?_0x39e62a:'')})[_0xa380('0xbb')](function(_0x5ad006){return _0x5ad006[_0xa380('0x150')][_0xa380('0x14d')](_0xa380('0x14e'))>=0x0;})[_0xa380('0xb5')](myreject(_0x581dc0)));}BPromise[_0xa380('0x151')](_0x53e15b)[_0xa380('0xbb')](function(_0x717cbe){var _0x36ee60=_['some'](_0x717cbe);if(_0x36ee60){return _0x1374a7(_0x36ee60);}else{_0x5a8f2e['message']=_0x50dda6?_0xa380('0x152'):'INTERVAL_IS_OVERTIME';return _0x581dc0(msgResponse(_0xa380('0x153'),'Failure',_0xa380('0x154')+_0x50dda6+'\x20'+_0x25f74b+_0xa380('0x155')+util[_0xa380('0x98')](_0x382c3c,{'showHidden':![],'depth':null})+_0xa380('0x156')+_0x39e62a));}})[_0xa380('0xb5')](function(_0x128274){return _0x581dc0(msgResponse(_0xa380('0x142'),_0xa380('0x144'),JSON[_0xa380('0x47')](_0x128274)));});});};Dialer[_0xa380('0xac')]['checkDialMethod']=function(_0x379c65){var _0x28f050=this;return function(){switch(_0x379c65[_0xa380('0x57')]){case'progressive':freeVariablesPredictive(_0x379c65);_0x28f050[_0xa380('0x157')](_0x379c65,0x1);break;case _0xa380('0x158'):freeVariablesPredictive(_0x379c65);_0x28f050[_0xa380('0x157')](_0x379c65,_0x379c65[_0xa380('0x159')]);break;case'predictive':_0x28f050[_0xa380('0x15a')](_0x379c65);break;case'booked':freeVariablesPredictive(_0x379c65);_0x28f050[_0xa380('0x157')](_0x379c65,0x1);break;default:freeVariablesPredictive(_0x379c65);logger[_0xa380('0x97')](_0xa380('0x15b'),_0x379c65[_0xa380('0x3d')],_0xa380('0x15c'));}};};Dialer['prototype'][_0xa380('0x15d')]=function(_0x1e3f54){var _0x4d8725=this;return function(){_0x4d8725[_0xa380('0x15e')](_0x1e3f54);};};Dialer['prototype'][_0xa380('0x30')]=function(_0x47a43d){var _0x22e2b9=this;if(isNotPreview(_0x47a43d[_0xa380('0x57')])){if(isVoiceQueueOutbound(_0x47a43d[_0xa380('0x4c')])&&isActive(_0x47a43d[_0xa380('0x56')])){_0x47a43d[_0xa380('0xa2')]=!![];BPromise['resolve']()[_0xa380('0xbb')](checkIsLoggedIn(_0x47a43d,_0x47a43d[_0xa380('0x4d')]))[_0xa380('0xbb')](checkIsActive(_0x47a43d,_0x47a43d['dialActive']))[_0xa380('0xbb')](checkInterval(_0x47a43d))[_0xa380('0xbb')](_0x22e2b9['checkIsTrunkReachable'](_0x47a43d))[_0xa380('0xbb')](_0x22e2b9[_0xa380('0x141')](_0x47a43d[_0xa380('0x15f')],_0x47a43d[_0xa380('0x160')],_0x47a43d[_0xa380('0x3d')],_0x47a43d))[_0xa380('0xbb')](_0x22e2b9[_0xa380('0x143')](_0x47a43d['Interval'],_0x47a43d[_0xa380('0x160')],_0x47a43d[_0xa380('0x3d')],_0x47a43d))[_0xa380('0xbb')](_0x22e2b9[_0xa380('0x161')](_0x47a43d))[_0xa380('0xb5')](loggerCatchQueueSummary(_0xa380('0x162'),_0x47a43d));}else{notSendMessagesQueue(_0x47a43d);}}else{freeVariablesPredictive(_0x47a43d);}};Dialer[_0xa380('0xac')][_0xa380('0x163')]=function(){var _0x5fe295=this;var _0x34ce93;for(var _0x49bc6e in this[_0xa380('0x1d')]){if(typeof this[_0xa380('0x1d')][_0x49bc6e]!=='undefined'){_0x34ce93=this['campaigns'][_0x49bc6e];if(isCampaignIvr(_0x34ce93[_0xa380('0x4c')])&&isActive(_0x34ce93[_0xa380('0x76')])){_0x34ce93['sendMessageOneNotActive']=!![];BPromise[_0xa380('0xbe')]()[_0xa380('0xbb')](checkIsActive(_0x34ce93,_0x34ce93[_0xa380('0x76')]))[_0xa380('0xbb')](checkInterval(_0x34ce93))[_0xa380('0xbb')](_0x5fe295[_0xa380('0x13e')](_0x34ce93))['then'](_0x5fe295['checkIfTime'](_0x34ce93[_0xa380('0x15f')],_0x34ce93[_0xa380('0x160')],_0x34ce93[_0xa380('0x3d')],_0x34ce93))[_0xa380('0xbb')](_0x5fe295['checkIfTimeIntervals'](_0x34ce93[_0xa380('0x41')],_0x34ce93[_0xa380('0x160')],_0x34ce93[_0xa380('0x3d')],_0x34ce93))[_0xa380('0xbb')](_0x5fe295[_0xa380('0x15d')](_0x34ce93))[_0xa380('0xb5')](loggerCatchQueueSummary(_0xa380('0x164'),_0x34ce93));}else{notSendMessagesCampaign(_0x34ce93);}}}};function getCallerIdRandom(_0x30d52d,_0x25ce84){var _0x2d4870;var _0x5e7ca5;var _0x35060e;if(_0x25ce84<=0x0){_0x25ce84=0x1;}_0x2d4870=new RegExp(_0xa380('0x165')+_0x25ce84+'}$');_0x5e7ca5=Math[_0xa380('0x166')](0xa,_0x25ce84-0x1);_0x35060e=Math[_0xa380('0x166')](0xa,_0x25ce84)-0x1;return util['format']('%s',_[_0xa380('0x167')](_0x30d52d,_0x2d4870,_[_0xa380('0x168')](_0x5e7ca5,_0x35060e)));}function extractCalleridName(_0x36f116){var _0x2ecc42=_0x36f116[_0xa380('0x169')](/"(.*?)"/);return _0x2ecc42?_0x2ecc42[0x1]:_0x36f116;}function extractCalleridNumber(_0x15bc75){var _0x1bcbd5=_0x15bc75[_0xa380('0x169')](/<(.*?)>/);return _0x1bcbd5?_0x1bcbd5[0x1]:_0x15bc75;}Dialer[_0xa380('0xac')][_0xa380('0x16a')]=function(_0x3cd60b,_0x59d36f){var _0x417368=this;var _0x32e8b5=uuid['v4']();this[_0xa380('0xaf')][_0x32e8b5]=new Action(_0x3cd60b,_0x59d36f,_0x32e8b5);return new BPromise(function(_0x3a91a5,_0x3280a1){if(_[_0xa380('0x3a')](_0x3cd60b)&&typeof _0x3cd60b!==_0xa380('0x16b')){return _0x3280a1(msgResponse(_0xa380('0x16c'),_0xa380('0x144'),_0xa380('0x16d')));}if(_[_0xa380('0x3a')](_0x59d36f[_0xa380('0x16e')][_0xa380('0x16f')])||_0x59d36f[_0xa380('0x16e')][_0xa380('0x16f')]===null){return _0x3280a1(msgResponse('originate','Failure',_0xa380('0x170')));}var _0x518bd8={'XMD-CALLERID':_0x417368[_0xa380('0xaf')][_0x32e8b5][_0xa380('0x171')](),'XMD-AGI':_0x3cd60b[_0xa380('0x108')]?util[_0xa380('0x94')](_0xa380('0x172'),ipAgi,_0x3cd60b[_0xa380('0x108')]):'NONE','XMD-AGIAFTER':_0x3cd60b[_0xa380('0x11a')]?util[_0xa380('0x94')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3cd60b['dialQueueProject2']):_0xa380('0x173'),'XMD-QUEUE':_0x3cd60b[_0xa380('0x4c')]===_0xa380('0x92')?util[_0xa380('0x94')](_0xa380('0x174'),_0x3cd60b['name'],_0x3cd60b[_0xa380('0x175')]||'',_0x3cd60b['dialAgiAfterHangupAgent']?'c':'',_0x3cd60b[_0xa380('0x116')]||0x3):_0xa380('0x173'),'XMD-CONTACTID':_0x59d36f[_0xa380('0xd6')],'XMD-CDRTYPE':_0xa380('0x5'),'CALLERID(all)':_0x417368[_0xa380('0xaf')][_0x32e8b5][_0xa380('0x171')](),'XMD-AMD':_0x3cd60b[_0xa380('0xe9')]?_0xa380('0x176'):_0xa380('0x173'),'XMD-DESTINATION':_0xa380('0x177')};if(_0x3cd60b[_0xa380('0xe9')]){_0x518bd8[_0xa380('0x178')]=_0x3cd60b[_0xa380('0x179')]||0x9c4;_0x518bd8[_0xa380('0x17a')]=_0x3cd60b['dialAMDGreeting']||0x5dc;_0x518bd8[_0xa380('0x17b')]=_0x3cd60b['dialAMDAfterGreetingSilence']||0x320;_0x518bd8['XMD-AMDTOTALANALYSISTIME']=_0x3cd60b[_0xa380('0x17c')]||0x1388;_0x518bd8[_0xa380('0x17d')]=_0x3cd60b[_0xa380('0x17e')]||0x64;_0x518bd8[_0xa380('0x17f')]=_0x3cd60b[_0xa380('0x180')]||0x32;_0x518bd8[_0xa380('0x181')]=_0x3cd60b[_0xa380('0x182')]||0x3;_0x518bd8[_0xa380('0x183')]=_0x3cd60b[_0xa380('0x184')]||0x100;_0x518bd8[_0xa380('0x185')]=_0x3cd60b[_0xa380('0x186')]||0x1388;}if(_0x3cd60b['type']==='outbound'){_0x518bd8[_0xa380('0x187')]=_0x59d36f[_0xa380('0xfe')];}else{_0x518bd8[_0xa380('0x188')]=_0x59d36f[_0xa380('0xd9')];}for(var _0x5ece3b in _0x59d36f[_0xa380('0x16e')]){if(typeof _0x59d36f[_0xa380('0x16e')][_0x5ece3b]!==_0xa380('0x9a')){if(isNotNull(_0x59d36f[_0xa380('0x16e')][_0x5ece3b])&&_0x5ece3b!=='id'&&_0x5ece3b!==_0xa380('0x189')&&_0x5ece3b!==_0xa380('0x18a')&&_0x5ece3b!==_0xa380('0x18b')){_0x518bd8[util[_0xa380('0x94')](_0xa380('0x18c'),_0xa380('0x18d'),_[_0xa380('0x18e')](_0x5ece3b))]=_0x59d36f[_0xa380('0x16e')][_0x5ece3b];}}}var _0x5981a1=_0x417368['isTrunkReachable'](_0x3cd60b[_0xa380('0x75')])?getCallerId(_0x3cd60b['Trunk'][_0xa380('0x18f')],_0x3cd60b[_0xa380('0x58')],_0x3cd60b[_0xa380('0x190')]>0x0?getCallerIdRandom(_0x3cd60b[_0xa380('0x59')],_0x3cd60b[_0xa380('0x190')]):_0x3cd60b[_0xa380('0x59')]):getCallerId(_[_0xa380('0xdf')](_0x3cd60b['TrunkBackup'])?_0x3cd60b[_0xa380('0x75')][_0xa380('0x18f')]:_0x3cd60b[_0xa380('0x13f')][_0xa380('0x18f')],_0x3cd60b[_0xa380('0x58')],_0x3cd60b['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3cd60b[_0xa380('0x59')],_0x3cd60b[_0xa380('0x190')]):_0x3cd60b['dialOriginateCallerIdNumber']);if(_0x5981a1){_0x518bd8[_0xa380('0x191')]=_0x417368[_0xa380('0xaf')][_0x32e8b5][_0xa380('0x192')]=extractCalleridName(_0x5981a1);_0x518bd8[_0xa380('0x193')]=_0x417368[_0xa380('0xaf')][_0x32e8b5][_0xa380('0x194')]=extractCalleridNumber(_0x5981a1);}return ami[_0xa380('0xb2')]({'actionid':_0x32e8b5,'action':_0xa380('0x16c'),'channel':_0x417368['isTrunkReachable'](_0x3cd60b['Trunk'])?util[_0xa380('0x94')]('SIP/%s/%s%s',_0x3cd60b[_0xa380('0x75')]['name'],isNotNull(_0x3cd60b[_0xa380('0x5b')])?_0x3cd60b[_0xa380('0x5b')]['trim']()||'':'',_0x3cd60b[_0xa380('0x195')]>0x0?_0x59d36f['Contact'][_0xa380('0x16f')]['substring'](_0x3cd60b[_0xa380('0x195')]):_0x59d36f[_0xa380('0x16e')]['phone']):util['format']('SIP/%s/%s%s',_[_0xa380('0xdf')](_0x3cd60b['TrunkBackup'])?_0x3cd60b[_0xa380('0x75')]['name']:_0x3cd60b[_0xa380('0x13f')][_0xa380('0x3d')],isNotNull(_0x3cd60b[_0xa380('0x5b')])?_0x3cd60b[_0xa380('0x5b')][_0xa380('0x196')]()||'':'',_0x3cd60b[_0xa380('0x195')]>0x0?_0x59d36f[_0xa380('0x16e')][_0xa380('0x16f')][_0xa380('0x197')](_0x3cd60b[_0xa380('0x195')]):_0x59d36f[_0xa380('0x16e')][_0xa380('0x16f')]),'callerid':_0x5981a1,'Exten':'xcally-motion-dialer','Context':_0xa380('0x198'),'Priority':'1','variable':_0x518bd8,'timeout':(_0x3cd60b[_0xa380('0x5a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x32e8b5})[_0xa380('0xbb')](function(_0xab5439){return _0x3a91a5(_0xab5439);})[_0xa380('0xb5')](function(_0x181225){_0x3cd60b[_0xa380('0x64')]+=0x1;var _0xe70672=new History(_0x417368['actions'][_0x32e8b5]);logger['error'](util[_0xa380('0x94')](_0xa380('0x199'),JSON[_0xa380('0x47')](_0x181225)));_0xe70672[_0xa380('0xa9')]=0xe;_0xe70672[_0xa380('0xaa')]=_0xa380('0x19a');_0xe70672[_0xa380('0x11e')]=moment()['format'](_0xa380('0xfd'));_0xe70672[_0xa380('0xab')]=_0xe70672[_0xa380('0x11e')];_0x417368[_0xa380('0xce')](_0xe70672)[_0xa380('0xb5')](loggerCatch(_0xa380('0x19b')));_0x417368[_0xa380('0xcc')](_0xe70672)[_0xa380('0xb5')](loggerCatch(_0xa380('0x19b')))[_0xa380('0x1a')](function(){delete _0x417368[_0xa380('0xaf')][_0x32e8b5];return _0x3280a1(msgResponse(_0xa380('0x16c'),'Error',_0xa380('0x19c')));});});});};Dialer[_0xa380('0xac')][_0xa380('0x2d')]=function(_0x45ff72){var _0x1b5954=this[_0xa380('0xaf')][_0x45ff72[_0xa380('0x129')]];if(_0x1b5954){delete this[_0xa380('0xaf')][_0x45ff72[_0xa380('0x129')]];_0x1b5954[_0xa380('0x115')]=moment()[_0xa380('0x94')](_0xa380('0xfd'));var _0x4b9c3f=_0x1b5954['type']===_0xa380('0x79')?this[_0xa380('0x1d')][_0x1b5954[_0xa380('0xb8')]]:this[_0xa380('0x1c')][_0x1b5954[_0xa380('0x19d')]()];if(!this['isSuccess'](_0x45ff72[_0xa380('0x19e')])){this[_0xa380('0xb7')](_0x4b9c3f);return this[_0xa380('0x19f')](_0x1b5954,_0x4b9c3f,_0x45ff72)[_0xa380('0xb5')](loggerCatch(_0xa380('0x1a0')));}this['uniqueId'][_0x45ff72[_0xa380('0xde')]]=_0x1b5954;}};Dialer[_0xa380('0xac')][_0xa380('0x1a1')]=function(_0x29a87f,_0x16093b,_0x22cdd1){var _0x3b0292=new History(_0x16093b);if(_0x3b0292[_0xa380('0xef')]+_0x3b0292['countcongestionretry']+_0x3b0292['countnoanswerretry']+_0x3b0292[_0xa380('0xf1')]+_0x3b0292['countdropretry']+_0x3b0292[_0xa380('0xf3')]+_0x3b0292['countmachineretry']+_0x3b0292[_0xa380('0xf4')]>=_0x22cdd1[_0xa380('0xf5')]-0x1){return!![];}switch(_0x29a87f){case 0x3:if(_0x3b0292['countnoanswerretry']>=_0x22cdd1[_0xa380('0x1a2')]-0x1){return!![];}this[_0xa380('0xc4')]({'active':![],'countnoanswerretry':_0x3b0292['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xa380('0xfa')](_0x22cdd1['dialNoAnswerRetryFrequency'],_0xa380('0xfc'))[_0xa380('0x94')](_0xa380('0xfd')),'ContactId':_0x3b0292[_0xa380('0xd6')],'ListId':_0x3b0292[_0xa380('0xd7')],'VoiceQueueId':_0x3b0292[_0xa380('0xfe')]||undefined,'CampaignId':_0x3b0292[_0xa380('0xd9')]||undefined})[_0xa380('0xb5')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x3b0292[_0xa380('0xef')]>=_0x22cdd1[_0xa380('0x1a3')]-0x1){return!![];}this[_0xa380('0xc4')]({'active':![],'countbusyretry':_0x3b0292[_0xa380('0xef')]+=0x1,'scheduledat':moment()[_0xa380('0xfa')](_0x22cdd1[_0xa380('0x1a4')],'minutes')[_0xa380('0x94')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b0292[_0xa380('0xd6')],'ListId':_0x3b0292[_0xa380('0xd7')],'VoiceQueueId':_0x3b0292['VoiceQueueId']||undefined,'CampaignId':_0x3b0292[_0xa380('0xd9')]||undefined})[_0xa380('0xb5')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x3b0292[_0xa380('0x1a5')]>=_0x22cdd1[_0xa380('0x1a6')]-0x1){return!![];}this[_0xa380('0xc4')]({'active':![],'countcongestionretry':_0x3b0292[_0xa380('0x1a5')]+=0x1,'scheduledat':moment()['add'](_0x22cdd1[_0xa380('0x1a7')],_0xa380('0xfc'))[_0xa380('0x94')](_0xa380('0xfd')),'ContactId':_0x3b0292[_0xa380('0xd6')],'ListId':_0x3b0292[_0xa380('0xd7')],'VoiceQueueId':_0x3b0292[_0xa380('0xfe')]||undefined,'CampaignId':_0x3b0292[_0xa380('0xd9')]||undefined})[_0xa380('0xb5')](loggerCatch(_0xa380('0x1a8')));break;case 0x0:if(_0x3b0292[_0xa380('0xf1')]>=_0x22cdd1['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xa380('0xc4')]({'active':![],'countnosuchnumberretry':_0x3b0292[_0xa380('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x22cdd1[_0xa380('0x1a9')],_0xa380('0xfc'))[_0xa380('0x94')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b0292['ContactId'],'ListId':_0x3b0292['ListId'],'VoiceQueueId':_0x3b0292[_0xa380('0xfe')]||undefined,'CampaignId':_0x3b0292[_0xa380('0xd9')]||undefined})[_0xa380('0xb5')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x3b0292[_0xa380('0xf2')]>=_0x22cdd1['dialDropMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x3b0292[_0xa380('0xf2')]+=0x1,'scheduledat':moment()[_0xa380('0xfa')](_0x22cdd1['dialDropRetryFrequency'],_0xa380('0xfc'))['format'](_0xa380('0xfd')),'ContactId':_0x3b0292['ContactId'],'ListId':_0x3b0292[_0xa380('0xd7')],'VoiceQueueId':_0x3b0292[_0xa380('0xfe')]||undefined,'CampaignId':_0x3b0292[_0xa380('0xd9')]||undefined})['catch'](loggerCatch(_0xa380('0x11d')));break;case 0xb:if(_0x3b0292[_0xa380('0xf3')]>=_0x22cdd1[_0xa380('0x125')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x3b0292['countabandonedretry']+=0x1,'scheduledat':moment()[_0xa380('0xfa')](_0x22cdd1[_0xa380('0x1aa')],_0xa380('0xfc'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b0292[_0xa380('0xd6')],'ListId':_0x3b0292[_0xa380('0xd7')],'VoiceQueueId':_0x3b0292[_0xa380('0xfe')]||undefined,'CampaignId':_0x3b0292[_0xa380('0xd9')]||undefined})[_0xa380('0xb5')](loggerCatch(_0xa380('0x1ab')));break;case 0x13:if(_0x3b0292[_0xa380('0xec')]>=_0x22cdd1[_0xa380('0xf8')]-0x1){return!![];}this[_0xa380('0xc4')]({'active':![],'countmachineretry':_0x3b0292[_0xa380('0xec')]+=0x1,'scheduledat':moment()['add'](_0x22cdd1['dialMachineRetryFrequency'],_0xa380('0xfc'))[_0xa380('0x94')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b0292[_0xa380('0xd6')],'ListId':_0x3b0292[_0xa380('0xd7')],'VoiceQueueId':_0x3b0292[_0xa380('0xfe')]||undefined,'CampaignId':_0x3b0292[_0xa380('0xd9')]||undefined})[_0xa380('0xb5')](loggerCatch(_0xa380('0xff')));break;case 0x14:if(_0x3b0292[_0xa380('0xf4')]>=_0x22cdd1[_0xa380('0x1ac')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x3b0292[_0xa380('0xf4')]+=0x1,'scheduledat':moment()[_0xa380('0xfa')](_0x22cdd1[_0xa380('0x1ad')],_0xa380('0xfc'))[_0xa380('0x94')](_0xa380('0xfd')),'ContactId':_0x3b0292[_0xa380('0xd6')],'ListId':_0x3b0292[_0xa380('0xd7')],'VoiceQueueId':_0x3b0292[_0xa380('0xfe')]||undefined,'CampaignId':_0x3b0292[_0xa380('0xd9')]||undefined})[_0xa380('0xb5')](loggerCatch(_0xa380('0x1ae')));break;default:return!![];}};Dialer[_0xa380('0xac')][_0xa380('0x19f')]=function(_0xc06ea8,_0x48b72d,_0x2fee90){var _0x140457=this;var _0x37c113=new History(_0xc06ea8);return new BPromise(function(_0x5f4c7c,_0x299e73){if(_['isUndefined'](_0x48b72d)&&typeof _0x48b72d!==_0xa380('0x16b')){return _0x299e73(msgResponse(_0xa380('0x1af'),'Failure',_0xa380('0x1b0')));}if(_[_0xa380('0x3a')](_0x2fee90)&&typeof _0x2fee90!==_0xa380('0x16b')){return _0x299e73(msgResponse(_0xa380('0x1af'),_0xa380('0x144'),_0xa380('0x1b1')));}switch(_0x2fee90[_0xa380('0x10c')]){case'0':_0x48b72d[_0xa380('0x63')]+=0x1;_0x37c113[_0xa380('0xa9')]=0x0;_0x37c113[_0xa380('0xaa')]=_0xa380('0x1b2');_0x37c113[_0xa380('0xf1')]+=0x1;_0x37c113['countglobal']+=0x1;ami[_0xa380('0x4b')](_0xa380('0x1b3'),ut[_0xa380('0x1b4')](_0xc06ea8,_0xa380('0x1b5')));_0x140457[_0xa380('0xce')](_0x37c113)[_0xa380('0xb5')](loggerCatch(_0xa380('0xee')));if(_0x140457[_0xa380('0x1a1')](0x0,_0xc06ea8,_0x48b72d)){if(_0x37c113['countnosuchnumberretry']>=_0x48b72d[_0xa380('0x1b6')]){_0x140457[_0xa380('0x1b7')](_0x37c113,_0x5f4c7c,_0x299e73,_0xa380('0x1b8'));}else{_0x140457[_0xa380('0xf6')](_0x37c113,_0x5f4c7c,_0x299e73,_0xa380('0x1b8'));}}break;case'3':_0x48b72d['outboundNoAnswerCallsDay']+=0x1;_0x37c113[_0xa380('0xa9')]=0x3;_0x37c113[_0xa380('0xaa')]=_0xa380('0x1b9');_0x37c113['countnoanswerretry']+=0x1;_0x37c113[_0xa380('0xed')]+=0x1;ami[_0xa380('0x4b')](_0xa380('0x1ba'),ut[_0xa380('0x1b4')](_0xc06ea8,_0xa380('0x1bb')));_0x140457[_0xa380('0xce')](_0x37c113)[_0xa380('0xb5')](loggerCatch(_0xa380('0x1bc')));if(_0x140457[_0xa380('0x1a1')](0x3,_0xc06ea8,_0x48b72d)){if(_0x37c113[_0xa380('0xf0')]>=_0x48b72d[_0xa380('0x1a2')]){_0x140457[_0xa380('0x1b7')](_0x37c113,_0x5f4c7c,_0x299e73,_0xa380('0x1bd'));}else{_0x140457[_0xa380('0xf6')](_0x37c113,_0x5f4c7c,_0x299e73,_0xa380('0x1bd'));}}break;case'5':_0x48b72d[_0xa380('0x5d')]+=0x1;_0x37c113[_0xa380('0xa9')]=0x5;_0x37c113['statedesc']=_0xa380('0x1be');_0x37c113[_0xa380('0xef')]+=0x1;_0x37c113['countglobal']+=0x1;ami[_0xa380('0x4b')](_0xa380('0x1bf'),ut[_0xa380('0x1b4')](_0xc06ea8,_0xa380('0x1c0')));_0x140457[_0xa380('0xce')](_0x37c113)[_0xa380('0xb5')](loggerCatch(_0xa380('0x1c1')));if(_0x140457[_0xa380('0x1a1')](0x5,_0xc06ea8,_0x48b72d)){if(_0x37c113[_0xa380('0xef')]>=_0x48b72d[_0xa380('0x1a3')]){_0x140457[_0xa380('0x1b7')](_0x37c113,_0x5f4c7c,_0x299e73,_0xa380('0x1c2'));}else{_0x140457[_0xa380('0xf6')](_0x37c113,_0x5f4c7c,_0x299e73,'reason\x205\x20busy');}}break;case'8':_0x48b72d['outboundCongestionCallsDay']+=0x1;_0x37c113['state']=0x8;_0x37c113[_0xa380('0xaa')]='Congestion';_0x37c113[_0xa380('0x1a5')]+=0x1;_0x37c113['countglobal']+=0x1;ami[_0xa380('0x4b')]('custom:agentcongestion',ut[_0xa380('0x1b4')](_0xc06ea8,'congestion'));_0x140457[_0xa380('0xce')](_0x37c113)['catch'](loggerCatch(_0xa380('0x1c3')));if(_0x140457[_0xa380('0x1a1')](0x8,_0xc06ea8,_0x48b72d)){if(_0x37c113['countcongestionretry']>=_0x48b72d[_0xa380('0x1a6')]){_0x140457[_0xa380('0x1b7')](_0x37c113,_0x5f4c7c,_0x299e73,_0xa380('0x1c4'));}else{_0x140457[_0xa380('0xf6')](_0x37c113,_0x5f4c7c,_0x299e73,'reason\x208\x20congestion');}}break;case'11':_0x48b72d[_0xa380('0x1c5')]+=0x1;_0x37c113[_0xa380('0xa9')]=0xb;_0x37c113[_0xa380('0xaa')]=_0xa380('0x122');_0x37c113[_0xa380('0xf3')]+=0x1;_0x37c113[_0xa380('0xed')]+=0x1;_0x140457[_0xa380('0xce')](_0x37c113)[_0xa380('0xb5')](loggerCatch(_0xa380('0x126')));if(_0x140457[_0xa380('0x1a1')](0xb,_0xc06ea8,_0x48b72d)){if(_0x37c113[_0xa380('0xf3')]>=_0x48b72d['dialAbandonedMaxRetry']){_0x140457['createStateFinal'](_0x37c113,_0x5f4c7c,_0x299e73,_0xa380('0x1c6'));}else{_0x140457[_0xa380('0xf6')](_0x37c113,_0x5f4c7c,_0x299e73,_0xa380('0x1c6'));}}break;case'20':_0x48b72d['outboundRejectCallsDay']+=0x1;_0x37c113['state']=0x14;_0x37c113['statedesc']=_0xa380('0x1c7');_0x37c113[_0xa380('0xf4')]+=0x1;_0x37c113[_0xa380('0xed')]+=0x1;ami['emit']('custom:agentreject',ut[_0xa380('0x1b4')](_0xc06ea8,_0xa380('0x1c8')));_0x140457[_0xa380('0xce')](_0x37c113)['catch'](loggerCatch(_0xa380('0x1c9')));if(_0x140457[_0xa380('0x1a1')](0x14,_0xc06ea8,_0x48b72d)){if(_0x37c113['countagentrejectretry']>=_0x48b72d[_0xa380('0x1ac')]){_0x140457[_0xa380('0x1b7')](_0x37c113,_0x5f4c7c,_0x299e73,_0xa380('0x1ca'));}else{_0x140457[_0xa380('0xf6')](_0x37c113,_0x5f4c7c,_0x299e73,_0xa380('0x1ca'));}}break;default:_0x48b72d[_0xa380('0x1cb')]+=0x1;_0x37c113['state']=0xc;_0x37c113[_0xa380('0xaa')]=_0x2fee90[_0xa380('0x10c')];_0x140457[_0xa380('0xce')](_0x37c113)[_0xa380('0xb5')](loggerCatch(_0xa380('0x1cc')));if(_0x140457['checkRetriveMax'](_0x2fee90['reason'],_0xc06ea8,_0x48b72d)){if(_0x37c113['countbusyretry']+_0x37c113['countcongestionretry']+_0x37c113[_0xa380('0xf0')]+_0x37c113[_0xa380('0xf1')]+_0x37c113[_0xa380('0xf2')]+_0x37c113[_0xa380('0xf3')]+_0x37c113[_0xa380('0xec')]+_0x37c113[_0xa380('0xf4')]>=_0x48b72d[_0xa380('0xf5')]){_0x140457[_0xa380('0xf6')](_0x37c113,_0x5f4c7c,_0x299e73,_0x2fee90['reason']);}else{_0x140457[_0xa380('0x1b7')](_0x37c113,_0x5f4c7c,_0x299e73,_0x2fee90[_0xa380('0x10c')]);}}}});};Dialer[_0xa380('0xac')][_0xa380('0xf6')]=function(_0x374c13,_0x3518c5,_0x147a75,_0x1825b5){var _0xbe0666=new Final(_0x374c13);_0xbe0666[_0xa380('0xa9')]=0xf;_0xbe0666[_0xa380('0xaa')]='Global';this[_0xa380('0x1b7')](_0xbe0666,_0x3518c5,_0x147a75,_0x1825b5);};Dialer['prototype'][_0xa380('0x1b7')]=function(_0x5cc0d3,_0x20534d,_0xd720f8,_0x1600e9){this[_0xa380('0xcc')](_0x5cc0d3)[_0xa380('0xbb')](function(){return _0x20534d(msgResponse(_0xa380('0x1af'),_0xa380('0xdb'),_0x1600e9));})[_0xa380('0xb5')](function(){return _0xd720f8(msgResponse('[moveContactManagedDialer][0]',_0xa380('0x144'),_0xa380('0x1cd')));});};Dialer[_0xa380('0xac')][_0xa380('0x15a')]=function(_0xd59c28){var _0x8d4e7a=_0xd59c28[_0xa380('0x1ce')]/0x64;var _0x40ba70=_0xd59c28[_0xa380('0x61')]/(_0xd59c28[_0xa380('0x61')]+_0xd59c28[_0xa380('0xe3')]);var _0x1e5eb5=Math[_0xa380('0x1cf')](_0xd59c28['predictiveIntervalAvailable']*(_0xd59c28[_0xa380('0x1d0')]/0x64));var _0x5f42af=Math[_0xa380('0x1cf')](_0xd59c28[_0xa380('0x6e')]*(_0xd59c28[_0xa380('0x1d1')]/0x64));var _0x469f85=_0xd59c28[_0xa380('0x1d2')]+_0xd59c28[_0xa380('0xa3')];var _0x41e836=Math[_0xa380('0x1d3')](_0xd59c28[_0xa380('0x70')]*_0xd59c28[_0xa380('0x72')]*_0xd59c28[_0xa380('0x6c')]*_0xd59c28[_0xa380('0x6d')]);if(_[_0xa380('0x3a')](_0xd59c28[_0xa380('0x74')])){if(!_['isUndefined'](_0xd59c28[_0xa380('0x23')])){_0xd59c28[_0xa380('0x23')]=undefined;loggerPredictive[_0xa380('0x97')](_0xa380('0x1d4'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xa380('0x3a')](_0xd59c28[_0xa380('0x90')])){loggerPredictive[_0xa380('0x97')](_0xa380('0x1d4'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0xd59c28[_0xa380('0x90')]);_0xd59c28[_0xa380('0x90')]=undefined;}_0xd59c28[_0xa380('0x74')]=moment()[_0xa380('0x94')](_0xa380('0xfd'));loggerPredictive[_0xa380('0x7c')](_0xd59c28['name'],_0xa380('0x1d5'),_0xd59c28[_0xa380('0x74')]);this[_0xa380('0x157')](_0xd59c28,0x1);}else if(ifInterval(_0xd59c28['dialPredictiveInterval'],_0xd59c28[_0xa380('0x74')])){this[_0xa380('0x157')](_0xd59c28,0x1);loggerPredictiveCalls[_0xa380('0x7c')](_0xa380('0x1d6'),_0xd59c28[_0xa380('0x74')],_0xd59c28['name']);_0xd59c28[_0xa380('0x70')]=0x0;_0xd59c28[_0xa380('0x6b')]=0x0;}else if(_0x8d4e7a<_0x40ba70&&_0xd59c28[_0xa380('0x1d7')]===_0xa380('0x1d8')){freeVariablesPredictive(_0xd59c28);loggerPredictive[_0xa380('0x7c')](_0xa380('0x1d9'),_0xa380('0x1da'),_0x40ba70,_0xa380('0x74'),_0xd59c28[_0xa380('0x3d')]);}else if(_0x41e836<_0xd59c28['predictiveIntervalErlangCallsDroppedCalls']&&_0xd59c28[_0xa380('0x1d7')]==='dropRate'){freeVariablesPredictive(_0xd59c28);loggerPredictive['info'](_0xa380('0x1db'),_0xa380('0x1dc'),_0x41e836,_0xa380('0x1dd'),_0xd59c28[_0xa380('0x6b')],_0xa380('0x74'),_0xd59c28[_0xa380('0x3d')]);}else if(!ifInterval(_0xd59c28[_0xa380('0x1de')],_0xd59c28[_0xa380('0x74')])&&_[_0xa380('0x3a')](_0xd59c28[_0xa380('0x23')])&&!_['isUndefined'](_0xd59c28[_0xa380('0x74')])){_0xd59c28[_0xa380('0x23')]=moment()[_0xa380('0x94')](_0xa380('0xfd'));loggerPredictive[_0xa380('0x7c')](_0xd59c28['name'],_0xa380('0x1df'),_0xd59c28[_0xa380('0x23')]);this[_0xa380('0xc1')](_0xd59c28[_0xa380('0x1de')])[_0xa380('0xbb')](this[_0xa380('0x1e0')](_0xd59c28))['then'](mergeDataErlangB(_0xd59c28))['then'](this[_0xa380('0x1e1')](_0xd59c28))['catch'](loggerCatchPredictive(_0xa380('0x1e2'),_0xd59c28));}else if(!ifInterval(_0xd59c28[_0xa380('0x1de')],_0xd59c28['startPredictive'])){_0xd59c28[_0xa380('0x6b')]=0x0;_0xd59c28[_0xa380('0x23')]=moment()[_0xa380('0x94')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0xd59c28['name'],_0xa380('0x1e3'),_0xd59c28[_0xa380('0x23')]);clearInterval(_0xd59c28[_0xa380('0x90')]);_0xd59c28[_0xa380('0x90')]=undefined;this[_0xa380('0xc1')](_0xd59c28[_0xa380('0x1de')])['then'](this[_0xa380('0x1e0')](_0xd59c28))[_0xa380('0xbb')](mergeDataErlangB(_0xd59c28))['then'](this[_0xa380('0x1e1')](_0xd59c28))[_0xa380('0xb5')](loggerCatchPredictive(_0xa380('0x1e4'),_0xd59c28));}else if(_0xd59c28['predictiveIntervalAvailable']&&_0x469f85<_0xd59c28['predictiveIntervalAvailable']-_0x5f42af){freeVariablesPredictive(_0xd59c28);loggerPredictive['info'](_0xd59c28[_0xa380('0x3d')],_0xa380('0x1e5'),_0x469f85,_0xa380('0x1e6'),_0xd59c28[_0xa380('0x6e')],'-',_0x5f42af,'=',_0xd59c28['predictiveIntervalAvailable']-_0x5f42af,')');}else if(_0xd59c28['predictiveIntervalAvailable']&&_0x469f85>_0xd59c28[_0xa380('0x6e')]+_0x1e5eb5){freeVariablesPredictive(_0xd59c28);loggerPredictive['info'](_0xd59c28[_0xa380('0x3d')],_0xa380('0x1e5'),_0x469f85,')\x20are\x20more\x20than\x20threshold\x20(',_0xd59c28[_0xa380('0x6e')],'+',_0x1e5eb5,'=',_0xd59c28[_0xa380('0x6e')]+_0x1e5eb5,')');}};Dialer[_0xa380('0xac')]['getDataPredictive']=function(_0x569566){var _0xd3c20f=this;return function(_0x2e3dd){return new BPromise(function(_0x49187c,_0x3a3733){_[_0xa380('0x8d')](_0x569566,_0x2e3dd[0x0]);if(checkGetDataPredictive(_0x2e3dd[0x0])){var _0x32257e=_0x569566[_0xa380('0x6e')]=_0x569566[_0xa380('0xa3')]+_0x569566['available'];var _0x2923fa=_0x569566[_0xa380('0x1de')]*0x3c;var _0x214efa=_0x2e3dd[0x0]['predictiveIntervalAvgTalktime']+_0x2e3dd[0x0][_0xa380('0x68')];var _0x460d36=(_0x2e3dd[0x0]['predictiveIntervalAnsweredCalls']+_0x2e3dd[0x0][_0xa380('0x1e7')]+_0x2e3dd[0x0][_0xa380('0x69')])/_0x2e3dd[0x0][_0xa380('0x85')];_0x569566[_0xa380('0x6c')]=_0x460d36>0x0?_0x460d36:0x1;switch(_0x569566[_0xa380('0x1d7')]){case _0xa380('0x1d8'):var _0x2b4f97=_0x569566[_0xa380('0x1ce')]/0x64;return _0xd3c20f[_0xa380('0x1e8')](_0x32257e,_0x2923fa,_0x214efa,_0x460d36,_0x2b4f97)[_0xa380('0xbb')](function(_0x209828){return _0x49187c(_0x209828);});case _0xa380('0x1e9'):var _0x1e05d0=_0x569566[_0xa380('0x1ce')]/0x64;return _0xd3c20f[_0xa380('0x1ea')](_0x32257e,_0x2923fa,_0x214efa,_0x460d36,_0x1e05d0)[_0xa380('0xbb')](function(_0x527bc5){return _0x49187c(_0x527bc5);});default:return _0x3a3733(msgResponse(_0xa380('0x1eb'),_0xa380('0x144'),_0xa380('0x1ec')));}}else{return _0x3a3733(msgResponse('[getDataPredictive]',_0xa380('0x144'),'check\x20failure'));}});};};Dialer[_0xa380('0xac')][_0xa380('0x1ed')]=function(_0x548421){var _0x1977bb=this;return function(_0x45b42c){return new BPromise(function(_0x1fd383,_0x2f6318){_[_0xa380('0x8d')](_0x548421,_0x45b42c[0x0]);if(checkGetDataPredictive(_0x45b42c[0x0])){loggerPredictive[_0xa380('0x7c')](JSON[_0xa380('0x47')](_0x45b42c[0x0]));if(_0x548421[_0xa380('0x1d7')]===_0xa380('0x1d8')){return _0x1977bb[_0xa380('0xca')](_0x548421['id'])['then'](function(_0x4c507d){var _0x516b3c=_0x548421[_0xa380('0x4d')]-_0x4c507d[0x0]['outboundQueuePauses'];var _0x400dfd=_0x548421['dialPredictiveInterval']*0x3c;var _0x94df8c=_0x45b42c[0x0][_0xa380('0x83')]+_0x45b42c[0x0][_0xa380('0x68')];var _0x4ecd18=(_0x45b42c[0x0][_0xa380('0x67')]+_0x45b42c[0x0][_0xa380('0x1e7')]+_0x45b42c[0x0][_0xa380('0x69')])/_0x45b42c[0x0]['predictiveIntervalTotalCalls'];var _0x2fe184=_0x548421[_0xa380('0x1ce')]/0x64;_0x548421['predictiveIntervalPauses']=_0x4c507d[0x0]['outboundQueuePauses']||0x0;_0x548421[_0xa380('0x6c')]=_0x4ecd18>0x0?_0x4ecd18:0x1;return _0x1977bb[_0xa380('0x1e8')](_0x516b3c,_0x400dfd,_0x94df8c,_0x4ecd18,_0x2fe184);})['then'](function(_0xc3a815){return _0x1fd383(_0xc3a815);})[_0xa380('0xb5')](function(_0x34cb45){return _0x2f6318(msgResponse(_0xa380('0x1ee'),_0xa380('0x144'),JSON[_0xa380('0x47')](_0x34cb45)));});}if(_0x548421['dialPredictiveOptimization']===_0xa380('0x1e9')){return _0x1977bb['getVoiceQueueRtPauses'](_0x548421['id'])[_0xa380('0xbb')](function(_0x1709c7){var _0x9f9348=_0x548421['loggedIn']-_0x1709c7[0x0][_0xa380('0x1ef')];var _0x4fa218=_0x548421[_0xa380('0x1de')]*0x3c;var _0x2cac1a=_0x45b42c[0x0][_0xa380('0x83')]+_0x45b42c[0x0][_0xa380('0x68')];var _0x32a6a3=(_0x45b42c[0x0][_0xa380('0x67')]+_0x45b42c[0x0][_0xa380('0x1e7')]+_0x45b42c[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x45b42c[0x0][_0xa380('0x85')];var _0x23988f=_0x548421[_0xa380('0x1ce')]/0x64;_0x548421[_0xa380('0x1f0')]=_0x1709c7[0x0]['outboundQueuePauses']||0x0;_0x548421[_0xa380('0x6c')]=_0x32a6a3>0x0?_0x32a6a3:0x1;return _0x1977bb[_0xa380('0x1ea')](_0x9f9348,_0x4fa218,_0x2cac1a,_0x32a6a3,_0x23988f);})['then'](function(_0x3df4ea){return _0x1fd383(_0x3df4ea);})['catch'](function(_0x59184a){return _0x2f6318(msgResponse(_0xa380('0x1ee'),_0xa380('0x144'),JSON[_0xa380('0x47')](_0x59184a)));});}}else{return _0x2f6318(msgResponse(_0xa380('0x1eb'),_0xa380('0x144'),_0xa380('0x1f1')));}});};};Dialer[_0xa380('0xac')]['startMethodPredictive']=function(_0xdfe72d){var _0x4c746c=this;return function(){var _0x5c8611=0x0;var _0x1b25a8=Math[_0xa380('0x1d3')](_0xdfe72d[_0xa380('0x71')]*0x3e8);if(_0x1b25a8>0x0){_0x1b25a8=_0x1b25a8<0x64?0x64:_0x1b25a8;loggerPredictive[_0xa380('0x7c')](_0xdfe72d['name'],'one\x20call\x20every:',_0x1b25a8,_0xa380('0x48'));_0xdfe72d[_0xa380('0x90')]=setInterval(function(){_0x4c746c[_0xa380('0x90')](_0xdfe72d);loggerPredictiveCalls['info'](_0xa380('0x1f2'),_0x5c8611+=0x1);},_0x1b25a8);}else{loggerPredictive[_0xa380('0x7c')](_0xdfe72d[_0xa380('0x3d')],_0xa380('0x1f3'));}};};Dialer[_0xa380('0xac')][_0xa380('0x1f4')]=function(_0x19c709,_0x2b7366){var _0x396c0c=this;return function(_0x40735d){if(_[_0xa380('0x45')](_0x40735d)){if(_['isNil'](_0x2b7366[_0xa380('0xd8')])||!_0x2b7366[_0xa380('0x1f5')]){if(_0x19c709['dialMethod']===_0xa380('0x7')){_0x19c709['queueStatusComplete']=_[_0xa380('0x3a')](_0x19c709[_0xa380('0x130')])?!![]:_0x19c709['queueStatusComplete'];var _0x324c62=uuid['v4']();_0x396c0c[_0xa380('0xaf')][_0x324c62]=new Action(_0x19c709,_0x2b7366,_0x324c62);loggerBooked[_0xa380('0x7c')](_0xa380('0x1f6'),_0x324c62,'queueStatusComplete:\x20',JSON[_0xa380('0x47')](_0x19c709[_0xa380('0x130')]),_0xa380('0x1f7'),_0x19c709[_0xa380('0x3d')]);if(_0x19c709['queueStatusComplete']){_0x19c709[_0xa380('0x130')]=![];_0x396c0c[_0xa380('0x25')][_0x396c0c['actions'][_0x324c62][_0xa380('0xb8')]]=[];ami[_0xa380('0xb2')]({'actionid':_0x324c62,'action':_0xa380('0x1f8'),'queue':_0x19c709[_0xa380('0x3d')]})[_0xa380('0xb5')](function(){_0x396c0c[_0xa380('0xb7')](_0x19c709);_0x396c0c['rescheduleContact']({'active':![],'ContactId':_0x396c0c[_0xa380('0xaf')][_0x324c62]['ContactId'],'ListId':_0x396c0c[_0xa380('0xaf')][_0x324c62][_0xa380('0xd7')],'VoiceQueueId':_0x396c0c[_0xa380('0xaf')][_0x324c62][_0xa380('0xfe')]||undefined,'CampaignId':_0x396c0c['actions'][_0x324c62]['CampaignId']||undefined})[_0xa380('0xb5')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x396c0c[_0xa380('0xaf')][_0x324c62];});}else{loggerBooked[_0xa380('0x7c')](_0xa380('0x1f9'),JSON[_0xa380('0x47')](_0x19c709[_0xa380('0x130')]),_0xa380('0x1f7'),_0x19c709[_0xa380('0x3d')]);_0x396c0c[_0xa380('0xb7')](_0x19c709);_0x396c0c[_0xa380('0xc4')]({'active':![],'ContactId':_0x396c0c[_0xa380('0xaf')][_0x324c62]['ContactId'],'ListId':_0x396c0c[_0xa380('0xaf')][_0x324c62]['ListId'],'VoiceQueueId':_0x396c0c['actions'][_0x324c62][_0xa380('0xfe')]||undefined,'CampaignId':_0x396c0c[_0xa380('0xaf')][_0x324c62][_0xa380('0xd9')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x396c0c[_0xa380('0xaf')][_0x324c62];}}else{return _0x396c0c[_0xa380('0x16a')](_0x19c709,_0x2b7366);}}else{if(getDiff(_0x2b7366[_0xa380('0x1fa')])<_0x19c709[_0xa380('0x1fb')]*0x3c){if(_0x2b7366['Agent']&&!_0x2b7366[_0xa380('0x1fc')]['voicePause']){_0x396c0c[_0xa380('0x1b')][_0xa380('0x1fd')](_0x2b7366['id'])[_0xa380('0x1a')](function(){_0x396c0c[_0xa380('0xb7')](_0x19c709);});}else{_0x396c0c['unlockContact']({'active':![]},_0x2b7366['id'],0x1)[_0xa380('0x1a')](function(){_0x396c0c['updateOriginated'](_0x19c709);});}}else{_0x19c709[_0xa380('0x65')]+=0x1;_0x396c0c['updateOriginated'](_0x19c709);if(_0x19c709[_0xa380('0x1fe')]){_0x396c0c[_0xa380('0xc4')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2b7366[_0xa380('0xd6')],'ListId':_0x2b7366[_0xa380('0xd7')],'VoiceQueueId':_0x2b7366['VoiceQueueId']||undefined,'CampaignId':_0x2b7366[_0xa380('0xd9')]||undefined})[_0xa380('0xb5')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x396c0c[_0xa380('0xce')](createObjHistory(_0x19c709,_0x2b7366,_0xa380('0x1ff'),0x17,_0xa380('0x200')))[_0xa380('0xb5')](loggerCatch(_0xa380('0x201')));}else{_0x396c0c[_0xa380('0xd5')](createObjHistory(_0x19c709,_0x2b7366,_0xa380('0x202'),0x16,_0xa380('0x203')),'[Originate][HistoryRecallClose][historyCatch]',_0xa380('0x204'));}}}}else{_0x19c709[_0xa380('0x205')]+=0x1;_0x396c0c[_0xa380('0xd5')](createObjHistory(_0x19c709,_0x2b7366,_0xa380('0x206'),0xd,'Blacklist'),_0xa380('0x207'),_0xa380('0x208'));throw _0xa380('0x209');}};};Dialer[_0xa380('0xac')][_0xa380('0x15e')]=function(_0x990de3){var _0x3202b0=this;var _0x4d26e4=_0x990de3[_0xa380('0x20a')]-_0x990de3[_0xa380('0x6f')]-_0x990de3['temp'];emitCampaignSummary(_0x990de3);if(_0x4d26e4>0x0){if(_0x4d26e4>this[_0xa380('0x20')]){_0x4d26e4=this[_0xa380('0x20')];}_0x990de3[_0xa380('0x20b')]+=_0x4d26e4;this[_0xa380('0xc9')](_0x990de3['id'],_0x4d26e4,_0x990de3[_0xa380('0x20c')])[_0xa380('0xbb')](function(_0x556360){_0x990de3[_0xa380('0x20b')]-=_0x4d26e4;_0x990de3[_0xa380('0x20b')]=_0x990de3[_0xa380('0x20b')]>0x0?_0x990de3[_0xa380('0x20b')]:0x0;if(!checkContactEmpty(_0x556360)){_0x990de3[_0xa380('0x3b')]=_0xa380('0xa1');logger[_0xa380('0x7c')](_0xa380('0x20d')+_0x990de3[_0xa380('0x3d')]);}else{_0x990de3[_0xa380('0x6f')]+=_0x556360[_0xa380('0x99')];_0x990de3[_0xa380('0x3b')]=_0xa380('0x20e');for(var _0x11c893=0x0;_0x11c893<_0x556360[_0xa380('0x99')];_0x11c893+=0x1){_0x990de3[_0xa380('0x20f')]+=0x1;if(_[_0xa380('0xdf')](_0x556360[_0x11c893])||_[_0xa380('0xdf')](_0x556360[_0x11c893]['Contact'])||_['isNil'](_0x556360[_0x11c893]['Contact'][_0xa380('0x16f')])){_0x3202b0[_0xa380('0xd3')]('[actionOriginate]\x20',_0x990de3,_0x556360[_0x11c893]);}else{_0x3202b0['checkIsBlackListIvr'](_[_0xa380('0x12d')](_0x556360[_0x11c893],[_0xa380('0xd9'),'Contact.phone']))[_0xa380('0xbb')](_0x3202b0[_0xa380('0x1f4')](_0x990de3,_0x556360[_0x11c893]))['catch'](_0x3202b0[_0xa380('0xd2')](_0xa380('0x210'),_0x990de3));}}}})[_0xa380('0xb5')](loggerGetContactDialer('[getContactCampaign2]',_0x990de3,_0x4d26e4));}};Dialer[_0xa380('0xac')]['handlePower']=function(_0x538426,_0x2411fd){var _0x183fd2=this;var _0x213b90=[];var _0x17e66c=_0x2411fd>=0x1?_0x2411fd:0x1;if(_0x538426[_0xa380('0x57')]===_0xa380('0x7')){_0x17e66c=0x1;}var _0x1d503a=Math[_0xa380('0x1d3')](_0x538426['available']*_0x17e66c)-_0x538426['originated']-_0x538426[_0xa380('0x20b')];emitVoiceQueueSummary(_0x538426);if(_0x538426[_0xa380('0x211')]>0x0){var _0x4c1795=_0x538426[_0xa380('0x211')]-_0x538426[_0xa380('0x6f')]-_0x538426[_0xa380('0xa3')]-_0x538426['temp']-_0x538426[_0xa380('0x4e')];if(_0x1d503a>_0x4c1795){_0x1d503a=_0x4c1795;}}if(_0x1d503a>0x0){if(_0x538426[_0xa380('0x57')]===_0xa380('0x7')){_0x1d503a=0x1;}if(_0x1d503a>this[_0xa380('0x20')]){_0x1d503a=this[_0xa380('0x20')];}_0x538426[_0xa380('0x20b')]+=_0x1d503a;for(var _0x4a7e4 in this[_0xa380('0x1e')]){if(typeof this[_0xa380('0x1e')][_0x4a7e4]!==_0xa380('0x9a')){if(this['agents'][_0x4a7e4][_0xa380('0xa9')]==='not_inuse'&&this[_0xa380('0x1e')][_0x4a7e4][_0xa380('0xb3')]==='reachable'){_0x213b90[_0xa380('0x12c')](this['agents'][_0x4a7e4]['id']);}}}this[_0xa380('0xc8')](_0x538426['id'],_0x213b90,_0x1d503a,_0x538426[_0xa380('0x20c')])[_0xa380('0xbb')](function(_0x363bcb){_0x538426[_0xa380('0x20b')]-=_0x1d503a;_0x538426[_0xa380('0x20b')]=_0x538426['temp']>0x0?_0x538426[_0xa380('0x20b')]:0x0;if(!checkContactEmpty(_0x363bcb)){_0x183fd2[_0xa380('0xbc')](_0x538426)[_0xa380('0xbb')](sendMessageReschedule(_0x538426))[_0xa380('0xb5')](loggerCatch(_0xa380('0x212')));}else{_0x538426[_0xa380('0x6f')]+=_0x363bcb[_0xa380('0x99')];_0x538426['message']=_0x538426['dialMethod']==='booked'?'ACTIVE':_0xa380('0x20e');for(var _0x5429c7=0x0;_0x5429c7<_0x363bcb[_0xa380('0x99')];_0x5429c7+=0x1){if(_[_0xa380('0xdf')](_0x363bcb[_0x5429c7])||_[_0xa380('0xdf')](_0x363bcb[_0x5429c7][_0xa380('0x16e')])||_[_0xa380('0xdf')](_0x363bcb[_0x5429c7]['Contact']['phone'])){_0x183fd2[_0xa380('0xd3')](_0xa380('0x213'),_0x538426,_0x363bcb[_0x5429c7]);}else{_0x183fd2[_0xa380('0xbd')](_[_0xa380('0x12d')](_0x363bcb[_0x5429c7],[_0xa380('0xfe'),_0xa380('0x214')]))[_0xa380('0xbb')](_0x183fd2[_0xa380('0x1f4')](_0x538426,_0x363bcb[_0x5429c7]))[_0xa380('0xb5')](_0x183fd2[_0xa380('0xd2')](_0xa380('0x213'),_0x538426));}}}})['catch'](loggerGetContactDialer(_0xa380('0x215'),_0x538426,_0x1d503a));}};Dialer[_0xa380('0xac')][_0xa380('0x90')]=function(_0x22d100){if(_0x22d100[_0xa380('0x211')]>0x0){var _0x3f45fd=_0x22d100[_0xa380('0x211')]-_0x22d100[_0xa380('0x6f')]-_0x22d100[_0xa380('0xa3')];if(_0x3f45fd>0x0){this[_0xa380('0x216')](_0x22d100);}else{loggerPredictiveCalls[_0xa380('0x7c')](_0xa380('0x217'));}}else{this['tryOriginatePredictive'](_0x22d100);}};Dialer[_0xa380('0xac')][_0xa380('0x216')]=function(_0x49340f){var _0x417a23=this;var _0x2a3ab8=[];_0x49340f['originated']+=0x1;for(var _0x599957 in this[_0xa380('0x1e')]){if(typeof this[_0xa380('0x1e')][_0x599957]!==_0xa380('0x9a')){if(this['agents'][_0x599957]['state']==='not_inuse'&&this[_0xa380('0x1e')][_0x599957][_0xa380('0xb3')]==='reachable'){_0x2a3ab8[_0xa380('0x12c')](this[_0xa380('0x1e')][_0x599957]['id']);}}}this[_0xa380('0xc8')](_0x49340f['id'],_0x2a3ab8,0x1,_0x49340f[_0xa380('0x20c')])[_0xa380('0xbb')](function(_0x157488){if(!checkContactEmpty(_0x157488)){checkContactLowerLimitOriginate(_0x49340f,0x1,0x0);_0x417a23['countReScheduled'](_0x49340f)[_0xa380('0xbb')](sendMessageReschedule(_0x49340f))[_0xa380('0xb5')](loggerCatch(_0xa380('0x212')));}else{_0x49340f['message']=_0xa380('0x20e');if(_[_0xa380('0xdf')](_0x157488[0x0])||_['isNil'](_0x157488[0x0][_0xa380('0x16e')])||_[_0xa380('0xdf')](_0x157488[0x0][_0xa380('0x16e')][_0xa380('0x16f')])){_0x417a23['emptyContact'](_0xa380('0x213'),_0x49340f,_0x157488[0x0]);}else{_0x417a23['checkIsBlackList'](_[_0xa380('0x12d')](_0x157488[0x0],[_0xa380('0xfe'),'Contact.phone']))['then'](_0x417a23[_0xa380('0x1f4')](_0x49340f,_0x157488[0x0]))[_0xa380('0xb5')](_0x417a23[_0xa380('0xd2')](_0xa380('0x218'),_0x49340f));}}})[_0xa380('0xb5')](loggerGetContactDialer(_0xa380('0x219'),_0x49340f,0x1));emitVoiceQueueSummary(_0x49340f);};Dialer[_0xa380('0xac')][_0xa380('0x1e8')]=function(_0x2fbde8,_0x25ef6d,_0x1ce280,_0x3cc130,_0x3f4fb5,_0x284d94){loggerPredictive[_0xa380('0x7c')](_0xa380('0x21a'));loggerPredictive['info'](_0xa380('0x21b'),_0x2fbde8);loggerPredictive[_0xa380('0x7c')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x25ef6d);loggerPredictive[_0xa380('0x7c')](_0xa380('0x21c'),_0x1ce280);loggerPredictive['info'](_0xa380('0x21d'),_0x3cc130);loggerPredictive[_0xa380('0x7c')](_0xa380('0x21e'),_0x3f4fb5);loggerPredictive[_0xa380('0x7c')]('---------------------------');return new BPromise(function(_0x5ad541,_0x51b054){if(_0x2fbde8<=0x0||isNaN(_0x2fbde8)){return _0x51b054(msgResponse(_0xa380('0x21f'),'Error',_0xa380('0x220')+_0x2fbde8));}if(_0x1ce280<=0x0||isNaN(_0x1ce280)){return _0x51b054(msgResponse(_0xa380('0x21f'),_0xa380('0x46'),_0xa380('0x221')+_0x1ce280));}if(_0x3cc130<=0x0||isNaN(_0x3cc130)){return _0x51b054(msgResponse(_0xa380('0x21f'),_0xa380('0x46'),_0xa380('0x222')+_0x3cc130));}if(_0x25ef6d<=0x0||isNaN(_0x25ef6d)){return _0x51b054(msgResponse(_0xa380('0x21f'),'Error','interval\x20=\x20'+_0x25ef6d));}if(_0x3f4fb5<=0x0||isNaN(_0x3f4fb5)){return _0x51b054(msgResponse('[abandonmentRate]',_0xa380('0x46'),'Amax\x20=\x20'+_0x3f4fb5));}_0x284d94=_0x284d94||0x0;var _0x3d7878=0x1/_0x1ce280;var _0x4eac1b=0x0;var _0x595d1b=0x0;var _0x5162a6=0x0;var _0x428707=0x0;for(var _0x1c7d5a=0x0;_0x5162a6<_0x3f4fb5;_0x1c7d5a+=0x1){_0x595d1b=_0x1c7d5a/_0x25ef6d;_0x4eac1b=(_0x3cc130*_0x595d1b+_0x284d94)/_0x3d7878;_0x5162a6=erlangb(_0x4eac1b,_0x2fbde8);_0x428707=_0x4eac1b/_0x2fbde8*(0x1-erlangb(_0x4eac1b,_0x2fbde8));}return _0x5ad541({'erlangCalls':_0x1c7d5a,'erlangCallToSecond':_0x25ef6d/_0x1c7d5a,'erlangAbandonmentRate':_0x5162a6,'erlangBusyFactor':_0x428707});});};Dialer[_0xa380('0xac')]['busyFactor']=function(_0x557d79,_0x2e543f,_0x5a690e,_0x172e74,_0x27cad2,_0x1446fb){loggerPredictive[_0xa380('0x7c')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xa380('0x7c')](_0xa380('0x21b'),_0x557d79);loggerPredictive['info'](_0xa380('0x223'),_0x2e543f);loggerPredictive['info'](_0xa380('0x21c'),_0x5a690e);loggerPredictive['info'](_0xa380('0x21d'),_0x172e74);loggerPredictive['info'](_0xa380('0x224'),_0x27cad2);loggerPredictive[_0xa380('0x7c')](_0xa380('0x84'));return new BPromise(function(_0x278848,_0x32dd93){if(_0x557d79<=0x0||isNaN(_0x557d79)){return _0x32dd93(msgResponse(_0xa380('0x225'),_0xa380('0x46'),_0xa380('0x220')+_0x557d79));}if(_0x5a690e<=0x0||isNaN(_0x5a690e)){return _0x32dd93(msgResponse('[busyFactor]',_0xa380('0x46'),'Ts\x20=\x20'+_0x5a690e));}if(_0x172e74<=0x0||isNaN(_0x172e74)){return _0x32dd93(msgResponse('[busyFactor]','Error',_0xa380('0x222')+_0x172e74));}if(_0x2e543f<=0x0||isNaN(_0x2e543f)){return _0x32dd93(msgResponse(_0xa380('0x225'),_0xa380('0x46'),_0xa380('0x226')+_0x2e543f));}if(_0x27cad2<=0x0||isNaN(_0x27cad2)){return _0x32dd93(msgResponse(_0xa380('0x225'),_0xa380('0x46'),_0xa380('0x227')+_0x27cad2));}_0x1446fb=_0x1446fb||0x0;var _0x2c5a69=0x1/_0x5a690e;var _0x5aa92f=0x0;var _0x37fbd1=0x0;var _0x5c4f92=0x0;var _0x3e7c2a=0x0;for(var _0x5eea96=0x0;_0x3e7c2a<_0x27cad2;_0x5eea96+=0x1){_0x37fbd1=_0x5eea96/_0x2e543f;_0x5aa92f=(_0x172e74*_0x37fbd1+_0x1446fb)/_0x2c5a69;_0x5c4f92=erlangb(_0x5aa92f,_0x557d79);_0x3e7c2a=_0x5aa92f/_0x557d79*(0x1-erlangb(_0x5aa92f,_0x557d79));}return _0x278848({'erlangCalls':_0x5eea96,'erlangCallToSecond':_0x2e543f/_0x5eea96,'erlangAbandonmentRate':_0x5c4f92,'erlangBusyFactor':_0x3e7c2a});});};module[_0xa380('0x228')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 1bae220..9dfc2ad 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 _0xd407=['callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','queue','membername','reason'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xd407,0x1c3));var _0x7d40=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd407[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x7d40('0x0'));var _=require(_0x7d40('0x1'));var moment=require(_0x7d40('0x2'));function getSeconds(_0x5e8e1f,_0x1857ad){var _0x313ff7=moment(_0x5e8e1f)[_0x7d40('0x3')](0x0);var _0x39b074=moment(_0x1857ad)[_0x7d40('0x3')](0x0);return _0x313ff7[_0x7d40('0x4')](_0x39b074,_0x7d40('0x5'));}function QueueCallerAbandon(_0x260db8,_0x223980){this[_0x7d40('0x6')]=_0x260db8[_0x7d40('0x6')];this['type']=_0x260db8[_0x7d40('0x7')];this['campaigntype']=_0x260db8[_0x7d40('0x7')]===_0x7d40('0x8')?'queue':_0x260db8[_0x7d40('0x7')];this[_0x7d40('0x9')]=_0x260db8[_0x7d40('0x9')];this[_0x7d40('0xa')]=_0x260db8['countcongestionretry'];this[_0x7d40('0xb')]=_0x260db8[_0x7d40('0xb')];this['countglobal']=_0x260db8[_0x7d40('0x9')]+_0x260db8[_0x7d40('0xa')]+_0x260db8[_0x7d40('0xb')]+_0x260db8[_0x7d40('0xc')]+_0x260db8[_0x7d40('0xd')]+_0x260db8[_0x7d40('0xe')]+_0x260db8[_0x7d40('0xf')]+_0x260db8[_0x7d40('0x10')];this['countnosuchnumberretry']=_0x260db8[_0x7d40('0xc')];this[_0x7d40('0xd')]=_0x260db8[_0x7d40('0xd')];this[_0x7d40('0xe')]=_0x260db8['countabandonedretry'];this[_0x7d40('0xf')]=_0x260db8['countmachineretry'];this['countagentrejectretry']=_0x260db8['countagentrejectretry'];this[_0x7d40('0x11')]=_0x223980['uniqueid'];this[_0x7d40('0x12')]=_0x260db8['name'];this['calleridnum']=_0x260db8[_0x7d40('0x13')];this[_0x7d40('0x14')]=_0x260db8[_0x7d40('0x14')];this[_0x7d40('0x15')]=_0x260db8[_0x7d40('0x15')];this[_0x7d40('0x16')]=_0x260db8[_0x7d40('0x16')];this[_0x7d40('0x17')]=this[_0x7d40('0x16')];this[_0x7d40('0x18')]=getSeconds(_0x260db8[_0x7d40('0x15')],_0x260db8['starttime']);this[_0x7d40('0x19')]=getSeconds(this[_0x7d40('0x16')],_0x260db8[_0x7d40('0x15')]);this['talktime']=0x0;this[_0x7d40('0x1a')]=_0x223980[_0x7d40('0x1a')];this[_0x7d40('0x1b')]=_0x223980['connectedlinename'];this[_0x7d40('0x1c')]=_0x223980[_0x7d40('0x1c')];this[_0x7d40('0x1d')]=_0x260db8[_0x7d40('0x1d')];this[_0x7d40('0x1e')]=_0x260db8[_0x7d40('0x1e')];this[_0x7d40('0x1f')]=_0x260db8['callbackat'];this[_0x7d40('0x20')]=_0x260db8[_0x7d40('0x20')];this['ContactId']=_0x260db8['ContactId'];this[_0x7d40('0x21')]=_0x260db8['ListId'];this[_0x7d40('0x22')]=_0x260db8[_0x7d40('0x22')];this['VoiceQueueId']=_0x260db8[_0x7d40('0x23')];this[_0x7d40('0x24')]=_0x260db8[_0x7d40('0x24')];this[_0x7d40('0x25')]=_0x260db8[_0x7d40('0x25')]||'';this[_0x7d40('0x26')]=_0x260db8[_0x7d40('0x26')]||'';}module[_0x7d40('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0xb5da=['talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','ringtime'];(function(_0x14539f,_0x255083){var _0x31fd36=function(_0x263d9c){while(--_0x263d9c){_0x14539f['push'](_0x14539f['shift']());}};_0x31fd36(++_0x255083);}(_0xb5da,0x16d));var _0xab5d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb5da[_0x20a584];return _0x4b41a8;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xab5d('0x0'));function getSeconds(_0x4415,_0x5aa7ab){var _0x53388c=moment(_0x4415)['milliseconds'](0x0);var _0x35a2c9=moment(_0x5aa7ab)[_0xab5d('0x1')](0x0);return _0x53388c[_0xab5d('0x2')](_0x35a2c9,'seconds');}function QueueCallerAbandon(_0x3ce416,_0x3150fd){this[_0xab5d('0x3')]=_0x3ce416['scheduledat'];this[_0xab5d('0x4')]=_0x3ce416['type'];this[_0xab5d('0x5')]=_0x3ce416[_0xab5d('0x4')]===_0xab5d('0x6')?_0xab5d('0x7'):_0x3ce416['type'];this['countbusyretry']=_0x3ce416[_0xab5d('0x8')];this[_0xab5d('0x9')]=_0x3ce416['countcongestionretry'];this[_0xab5d('0xa')]=_0x3ce416[_0xab5d('0xa')];this['countglobal']=_0x3ce416[_0xab5d('0x8')]+_0x3ce416[_0xab5d('0x9')]+_0x3ce416['countnoanswerretry']+_0x3ce416[_0xab5d('0xb')]+_0x3ce416[_0xab5d('0xc')]+_0x3ce416['countabandonedretry']+_0x3ce416[_0xab5d('0xd')]+_0x3ce416[_0xab5d('0xe')];this[_0xab5d('0xb')]=_0x3ce416[_0xab5d('0xb')];this[_0xab5d('0xc')]=_0x3ce416[_0xab5d('0xc')];this[_0xab5d('0xf')]=_0x3ce416[_0xab5d('0xf')];this[_0xab5d('0xd')]=_0x3ce416[_0xab5d('0xd')];this[_0xab5d('0xe')]=_0x3ce416[_0xab5d('0xe')];this[_0xab5d('0x10')]=_0x3150fd[_0xab5d('0x10')];this[_0xab5d('0x11')]=_0x3ce416[_0xab5d('0x12')];this[_0xab5d('0x13')]=_0x3ce416[_0xab5d('0x14')];this['starttime']=_0x3ce416[_0xab5d('0x15')];this[_0xab5d('0x16')]=_0x3ce416[_0xab5d('0x16')];this['droptime']=_0x3ce416[_0xab5d('0x17')];this['endtime']=this[_0xab5d('0x17')];this[_0xab5d('0x18')]=getSeconds(_0x3ce416[_0xab5d('0x16')],_0x3ce416[_0xab5d('0x15')]);this['holdtime']=getSeconds(this[_0xab5d('0x17')],_0x3ce416['responsetime']);this[_0xab5d('0x19')]=0x0;this[_0xab5d('0x7')]=_0x3150fd[_0xab5d('0x7')];this[_0xab5d('0x1a')]=_0x3150fd[_0xab5d('0x1b')];this[_0xab5d('0x1c')]=_0x3150fd[_0xab5d('0x1c')];this['callback']=_0x3ce416[_0xab5d('0x1d')];this[_0xab5d('0x1e')]=_0x3ce416[_0xab5d('0x1e')];this[_0xab5d('0x1f')]=_0x3ce416[_0xab5d('0x1f')];this[_0xab5d('0x20')]=_0x3ce416['recallme'];this[_0xab5d('0x21')]=_0x3ce416[_0xab5d('0x21')];this[_0xab5d('0x22')]=_0x3ce416['ListId'];this[_0xab5d('0x23')]=_0x3ce416[_0xab5d('0x23')];this[_0xab5d('0x24')]=_0x3ce416[_0xab5d('0x24')];this[_0xab5d('0x25')]=_0x3ce416[_0xab5d('0x25')];this['originatecalleridnum']=_0x3ce416['originatecalleridnum']||'';this[_0xab5d('0x26')]=_0x3ce416['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 3e3e1a3..1321fff 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 _0x5f14=['localstationid','headerinfo','AttachmentId','exports','lodash','moment','uniqueid','format','%s/%s/%s','tech','Trunk','fax'];(function(_0x3ec45d,_0x25cae3){var _0x50f4e9=function(_0x11c49b){while(--_0x11c49b){_0x3ec45d['push'](_0x3ec45d['shift']());}};_0x50f4e9(++_0x25cae3);}(_0x5f14,0x184));var _0x45f1=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0x5f14[_0x3b5ad9];return _0x611ae9;};'use strict';var util=require('util');var _=require(_0x45f1('0x0'));var moment=require(_0x45f1('0x1'));function Action(_0x1edfcb,_0x2cdf92,_0x5aaf8c){this[_0x45f1('0x2')]=_0x1edfcb||undefined;this['channel']=util[_0x45f1('0x3')](_0x45f1('0x4'),_0x2cdf92[_0x45f1('0x5')],_0x2cdf92[_0x45f1('0x6')]['name'],_0x5aaf8c[_0x45f1('0x7')]);this[_0x45f1('0x8')]=_0x2cdf92['localstationid'];this[_0x45f1('0x9')]=_0x2cdf92[_0x45f1('0x9')];this['path']=_0x5aaf8c['path'];this[_0x45f1('0xa')]=_0x5aaf8c['AttachmentId'];}module[_0x45f1('0xb')]=Action; \ No newline at end of file +var _0xa4c9=['channel','format','%s/%s/%s','Trunk','name','fax','localstationid','headerinfo','AttachmentId','exports','util','lodash','moment','uniqueid'];(function(_0x395bfe,_0x4db521){var _0x35c81c=function(_0x484a1b){while(--_0x484a1b){_0x395bfe['push'](_0x395bfe['shift']());}};_0x35c81c(++_0x4db521);}(_0xa4c9,0x1a0));var _0x9a4c=function(_0x173fd1,_0x28db53){_0x173fd1=_0x173fd1-0x0;var _0x36a3d1=_0xa4c9[_0x173fd1];return _0x36a3d1;};'use strict';var util=require(_0x9a4c('0x0'));var _=require(_0x9a4c('0x1'));var moment=require(_0x9a4c('0x2'));function Action(_0x60c30a,_0x43c7c2,_0xc079a9){this[_0x9a4c('0x3')]=_0x60c30a||undefined;this[_0x9a4c('0x4')]=util[_0x9a4c('0x5')](_0x9a4c('0x6'),_0x43c7c2['tech'],_0x43c7c2[_0x9a4c('0x7')][_0x9a4c('0x8')],_0xc079a9[_0x9a4c('0x9')]);this[_0x9a4c('0xa')]=_0x43c7c2[_0x9a4c('0xa')];this[_0x9a4c('0xb')]=_0x43c7c2['headerinfo'];this['path']=_0xc079a9['path'];this[_0x9a4c('0xc')]=_0xc079a9[_0x9a4c('0xc')];}module[_0x9a4c('0xd')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 44c1278..2c5a799 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 _0x07aa=['then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','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','path','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','tiff2pdf','../../../config/logger','fax','../ami','./channel','./util/util','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','newexten','faxstatus','syncFaxStatus','receivefax','syncHangup','syncOriginateResponse','prototype','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf'];(function(_0xbabe06,_0x1e7434){var _0x7fb471=function(_0x192f97){while(--_0x192f97){_0xbabe06['push'](_0xbabe06['shift']());}};_0x7fb471(++_0x1e7434);}(_0x07aa,0xb7));var _0xa07a=function(_0x139ad9,_0x34359d){_0x139ad9=_0x139ad9-0x0;var _0x136fff=_0x07aa[_0x139ad9];return _0x136fff;};'use strict';var util=require(_0xa07a('0x0'));var _=require(_0xa07a('0x1'));var BPromise=require(_0xa07a('0x2'));var uuid=require(_0xa07a('0x3'));var moment=require(_0xa07a('0x4'));var path=require('path');var tiff2pdf=require(_0xa07a('0x5'));var gs=require('./util/gs');var logger=require(_0xa07a('0x6'))(_0xa07a('0x7'));var ami=require(_0xa07a('0x8'));var rpcDb=require('./rpcDb');var Channel=require(_0xa07a('0x9'));var ut=require(_0xa07a('0xa'));var Action=require('./action');var faxAccount=require(_0xa07a('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xa07a('0xc'));function Fax(_0x14d4bd){this[_0xa07a('0xd')]={};this['faxAccounts']=_0x14d4bd[_0xa07a('0xe')];this[_0xa07a('0xf')]=_0x14d4bd['trunks'];this[_0xa07a('0x10')]={};ami['on'](_0xa07a('0x11'),this[_0xa07a('0x12')][_0xa07a('0x13')](this));ami['on'](_0xa07a('0x14'),this[_0xa07a('0x15')][_0xa07a('0x13')](this));ami['on'](_0xa07a('0x16'),this['syncNewState']['bind'](this));ami['on'](_0xa07a('0x17'),this['syncNewExten'][_0xa07a('0x13')](this));ami['on'](_0xa07a('0x18'),this[_0xa07a('0x19')][_0xa07a('0x13')](this));ami['on'](_0xa07a('0x1a'),this['syncReceiveFax'][_0xa07a('0x13')](this));ami['on']('hangup',this[_0xa07a('0x1b')]['bind'](this));ami['on']('originateresponse',this[_0xa07a('0x1c')]['bind'](this));}Fax[_0xa07a('0x1d')][_0xa07a('0x12')]=function(_0xad69e2){if(_0xad69e2['context']===_0xa07a('0x1e')){for(var _0x5046bb in this['faxAccounts']){if(this['faxAccounts'][_0xa07a('0x1f')](_0x5046bb)){if(_0xad69e2['exten']===this[_0xa07a('0xe')][_0x5046bb][_0xa07a('0x20')]){this[_0xa07a('0xd')][_0xad69e2[_0xa07a('0x21')]]={};this['channels'][_0xad69e2['uniqueid']][_0xa07a('0x22')]=_0xad69e2['channel'];this[_0xa07a('0xd')][_0xad69e2[_0xa07a('0x21')]]['id']=this[_0xa07a('0xe')][_0x5046bb]['id'];this['channels'][_0xad69e2['uniqueid']][_0xa07a('0x23')]=this[_0xa07a('0xe')][_0x5046bb][_0xa07a('0x23')];logger[_0xa07a('0x24')](_0xad69e2[_0xa07a('0x21')],_0xa07a('0x25'));}}}}if(this['actions'][_0xad69e2[_0xa07a('0x21')]]){this[_0xa07a('0xd')][_0xad69e2[_0xa07a('0x21')]]={};this['channels'][_0xad69e2[_0xa07a('0x21')]][_0xa07a('0x22')]=_0xad69e2['channel'];logger[_0xa07a('0x24')](_0xad69e2[_0xa07a('0x21')],_0xa07a('0x25'));}};Fax[_0xa07a('0x1d')][_0xa07a('0x15')]=function(_0x30bc04){if(this[_0xa07a('0xd')][_0x30bc04[_0xa07a('0x21')]]){for(var _0x275c69 in _0x30bc04[_0xa07a('0x26')]){if(_0x30bc04[_0xa07a('0x26')][_0xa07a('0x1f')](_0x275c69)){this[_0xa07a('0xd')][_0x30bc04[_0xa07a('0x21')]][_0x275c69]=_0x30bc04[_0xa07a('0x27')];}}}};Fax[_0xa07a('0x1d')]['syncNewState']=function(_0x3f7f38){if(this[_0xa07a('0xd')][_0x3f7f38['uniqueid']]){this[_0xa07a('0xd')][_0x3f7f38['uniqueid']][_0xa07a('0x28')]=_0x3f7f38['channelstate'];this[_0xa07a('0xd')][_0x3f7f38['uniqueid']][_0xa07a('0x29')]=_0x3f7f38[_0xa07a('0x29')];}};Fax[_0xa07a('0x1d')][_0xa07a('0x2a')]=function(_0x4319f5){if(this[_0xa07a('0xd')][_0x4319f5[_0xa07a('0x21')]]){for(var _0xfd47af in _0x4319f5[_0xa07a('0x26')]){if(_0x4319f5[_0xa07a('0x26')]['hasOwnProperty'](_0xfd47af)){this[_0xa07a('0xd')][_0x4319f5[_0xa07a('0x21')]][_0xfd47af]=_0x4319f5[_0xa07a('0x27')];}}}};Fax[_0xa07a('0x1d')][_0xa07a('0x19')]=function(_0x438ed2){if(this[_0xa07a('0xd')][_0x438ed2[_0xa07a('0x21')]]){this[_0xa07a('0xd')][_0x438ed2[_0xa07a('0x21')]][_0xa07a('0x2b')]=_0x438ed2['operation'];this[_0xa07a('0xd')][_0x438ed2[_0xa07a('0x21')]][_0xa07a('0x2c')]=_0x438ed2[_0xa07a('0x2c')];this['channels'][_0x438ed2[_0xa07a('0x21')]][_0xa07a('0x20')]=_0x438ed2['localstationid'];this[_0xa07a('0xd')][_0x438ed2[_0xa07a('0x21')]][_0xa07a('0x2d')]=_0x438ed2[_0xa07a('0x2d')];logger[_0xa07a('0x24')](_0x438ed2['uniqueid'],_0xa07a('0x2e'));}};Fax[_0xa07a('0x1d')][_0xa07a('0x2f')]=function(_0x3216ed){var _0x4c61ed=this;if(this[_0xa07a('0xd')][_0x3216ed[_0xa07a('0x21')]]){var _0xe2adfc=this['channels'][_0x3216ed['uniqueid']]['id'];this[_0xa07a('0xd')][_0x3216ed[_0xa07a('0x21')]][_0xa07a('0x30')]=_0x3216ed['remotestationid'];this[_0xa07a('0xd')][_0x3216ed['uniqueid']][_0xa07a('0x31')]=_0x3216ed['pagestransferred'];this['channels'][_0x3216ed[_0xa07a('0x21')]][_0xa07a('0x20')]=_0x3216ed['localstationid'];this[_0xa07a('0xd')][_0x3216ed[_0xa07a('0x21')]][_0xa07a('0x32')]=_0x3216ed[_0xa07a('0x32')];this[_0xa07a('0xd')][_0x3216ed[_0xa07a('0x21')]][_0xa07a('0x33')]=_0x3216ed[_0xa07a('0x33')];this[_0xa07a('0xd')][_0x3216ed[_0xa07a('0x21')]][_0xa07a('0x2d')]=_0x3216ed['filename'];this['channels'][_0x3216ed[_0xa07a('0x21')]][_0xa07a('0x34')]=_0x3216ed[_0xa07a('0x34')];if(this['channels'][_0x3216ed['uniqueid']][_0xa07a('0x31')]>0x0){tiff2pdf(_0x3216ed[_0xa07a('0x2d')],_0xa07a('0x35'),function(_0x62fe36){logger[_0xa07a('0x24')](_0x3216ed['uniqueid'],_0xa07a('0x36'),_0x62fe36[_0xa07a('0x37')]);attachment[_0xa07a('0x38')]({'name':path[_0xa07a('0x39')](_0x3216ed['filename'])['name'],'basename':path[_0xa07a('0x39')](_0x3216ed[_0xa07a('0x2d')])[_0xa07a('0x23')]+'.pdf','type':_0xa07a('0x3a')})[_0xa07a('0x3b')](function(_0x30a898){faxAccount[_0xa07a('0x3c')](_0xe2adfc,{'from':_0x3216ed[_0xa07a('0x34')],'mapKey':_0xa07a('0x7'),'body':path[_0xa07a('0x39')](_0x3216ed[_0xa07a('0x2d')])[_0xa07a('0x23')]+'.pdf','AttachmentId':_0x30a898['id']})[_0xa07a('0x3d')](function(_0xb5fa3d){logger[_0xa07a('0x3e')](_0x3216ed[_0xa07a('0x21')],_0xa07a('0x3f'),JSON[_0xa07a('0x40')](_0xb5fa3d));});})[_0xa07a('0x3d')](function(_0x1887d8){logger['error'](_0x3216ed[_0xa07a('0x21')],_0xa07a('0x41'),JSON['stringify'](_0x1887d8));});});}logger[_0xa07a('0x24')](_0x3216ed[_0xa07a('0x21')],_0xa07a('0x41'));}};Fax['prototype'][_0xa07a('0x1c')]=function(_0x5372a0){if(this[_0xa07a('0x10')][_0x5372a0[_0xa07a('0x21')]]){_['merge'](this['channels'][_0x5372a0[_0xa07a('0x21')]],_[_0xa07a('0x42')](_0x5372a0,[_0xa07a('0x43'),'reason']));}};function updateStatus(_0x2fc12e){if(_0x2fc12e[_0xa07a('0x44')]){faxMessage['update'](_0x2fc12e[_0xa07a('0x44')],{'failMessage':_0xa07a('0x45')})['then'](function(_0x55010b){ut['logger'](_0xa07a('0x46'),_0x55010b);})[_0xa07a('0x3d')](function(_0xa8592f){ut[_0xa07a('0x47')](_0xa07a('0x48'),_0xa8592f);});}else{ut['logger'](_0xa07a('0x49'));}}Fax[_0xa07a('0x1d')]['updateStatus']=function(_0x60467c,_0x2078fb,_0xee75ee){var _0x3a5026=this;var _0x4d9f37={};if(_0x2078fb){_0x4d9f37={'read':_0x2078fb};}else{_0x4d9f37={'failMessage':_0xee75ee};}if(this[_0xa07a('0x10')][_0x60467c][_0xa07a('0x44')]){faxMessage['update'](this[_0xa07a('0x10')][_0x60467c][_0xa07a('0x44')],_0x4d9f37)['then'](function(_0x58327c){ut[_0xa07a('0x47')]('[Fax][Message][Updated]',_0x58327c);})[_0xa07a('0x3d')](function(_0x2244b5){ut[_0xa07a('0x47')](_0xa07a('0x4a'),_0x2244b5);})[_0xa07a('0x4b')](function(){delete _0x3a5026['channels'][_0x60467c];delete _0x3a5026['actions'][_0x60467c];});}else{ut[_0xa07a('0x47')]('[Fax][Message][NoUpdate2]');delete this[_0xa07a('0xd')][_0x60467c];delete this['actions'][_0x60467c];}};Fax[_0xa07a('0x1d')]['syncHangup']=function(_0x53ed19){var _0x107447=this;if(this[_0xa07a('0xd')][_0x53ed19[_0xa07a('0x21')]]){if(this[_0xa07a('0x10')][_0x53ed19['uniqueid']]){this['channels'][_0x53ed19[_0xa07a('0x21')]]['id']=this['actions'][_0x53ed19[_0xa07a('0x21')]]['id'];this[_0xa07a('0xd')][_0x53ed19['uniqueid']][_0xa07a('0x23')]=this[_0xa07a('0x10')][_0x53ed19['uniqueid']][_0xa07a('0x23')];}logger[_0xa07a('0x24')](_0x53ed19['uniqueid'],this['actions'][_0x53ed19[_0xa07a('0x21')]]?_0xa07a('0x4c'):_0xa07a('0x4d'),JSON['stringify'](this[_0xa07a('0xd')][_0x53ed19[_0xa07a('0x21')]]));if(this[_0xa07a('0x10')][_0x53ed19['uniqueid']]){if(this['channels'][_0x53ed19['uniqueid']]['faxpages']>0x0&&this[_0xa07a('0xd')][_0x53ed19[_0xa07a('0x21')]][_0xa07a('0x18')]===_0xa07a('0x4e')){this[_0xa07a('0x4f')](_0x53ed19[_0xa07a('0x21')],!![]);}else{this[_0xa07a('0x4f')](_0x53ed19[_0xa07a('0x21')],![],this[_0xa07a('0xd')][_0x53ed19[_0xa07a('0x21')]][_0xa07a('0x50')]?_0xa07a('0x51')+this['channels'][_0x53ed19[_0xa07a('0x21')]][_0xa07a('0x50')]:_0xa07a('0x52'));}}}};Fax['prototype'][_0xa07a('0x53')]=function(_0x2fe3bf){var _0x1956d0=this;return new BPromise(function(_0xb0c314,_0x2c7044){_0x1956d0['execOriginate'](_0x2fe3bf,_0x1956d0['faxAccounts'][_0x2fe3bf[_0xa07a('0x54')]])[_0xa07a('0x3b')](function(_0x3b0a52){ut['logger'](_0xa07a('0x55'),_0x3b0a52);_0xb0c314(ut[_0xa07a('0x37')](_0xa07a('0x56')));})[_0xa07a('0x3d')](function(_0x20acaf){ut[_0xa07a('0x47')](_0xa07a('0x57'),_0x20acaf);updateStatus(_0x2fe3bf);_0x2c7044(ut['message'](_0xa07a('0x58')));});});};Fax[_0xa07a('0x1d')][_0xa07a('0x59')]=function(_0x394944){var _0x1a4d3d=this;return new BPromise(function(_0x4b2b0f,_0x287a74){var _0x5c7ec6=_0x1a4d3d[_0xa07a('0x5a')](_0x1a4d3d[_0xa07a('0xe')][_0x394944[_0xa07a('0x54')]][_0xa07a('0x5b')],_0x394944);if(_0x5c7ec6[_0xa07a('0x5c')]){_0x4b2b0f(ut[_0xa07a('0x37')](_0xa07a('0x5d')));}else{_0x287a74(ut[_0xa07a('0x37')](_0x5c7ec6[_0xa07a('0x37')]));}});};function originate(_0x57eb09,_0x3cd3c6,_0x393aa6){return new BPromise(function(_0x425965,_0x3fc2c3){if(_0x393aa6){var _0x1c87bb=util[_0xa07a('0x5e')](_0xa07a('0x5f'),path['parse'](_0x57eb09[_0xa07a('0x60')])[_0xa07a('0x23')],_0x57eb09[_0xa07a('0x60')]);gs[_0xa07a('0x61')](_0x1c87bb)['then'](function(){_0x57eb09[_0xa07a('0x60')]=util[_0xa07a('0x5e')](_0xa07a('0x62'),path[_0xa07a('0x39')](_0x57eb09[_0xa07a('0x60')])[_0xa07a('0x63')],path[_0xa07a('0x39')](_0x57eb09['path'])[_0xa07a('0x23')]);_0x3cd3c6[_0xa07a('0x64')]=_0x57eb09['path'];ut[_0xa07a('0x47')](_0xa07a('0x65'),'');ami[_0xa07a('0x66')](ut[_0xa07a('0x67')](_0x57eb09,_0x3cd3c6))[_0xa07a('0x3b')](function(_0x4c82f3){_0x425965(_0x4c82f3);})[_0xa07a('0x3d')](function(_0x2c2b1d){_0x3fc2c3(_0x2c2b1d);});})['catch'](function(_0x2e8764){_0x3fc2c3(_0x2e8764);});}else{ami[_0xa07a('0x66')](ut[_0xa07a('0x67')](_0x57eb09,_0x3cd3c6))[_0xa07a('0x3b')](function(_0xb019a){_0x425965(_0xb019a);})['catch'](function(_0x1be54a){_0x3fc2c3(_0x1be54a);});}});}Fax['prototype'][_0xa07a('0x68')]=function(_0x2e20e9,_0x397288){var _0x29bd42=this;return new BPromise(function(_0x39a4ed,_0x4a3886){var _0x3be9e2=uuid['v4']();var _0xff9aa8=ut[_0xa07a('0x69')](_0x2e20e9,_0x397288);_0x29bd42[_0xa07a('0x10')][_0x3be9e2]=new Action(_0x3be9e2,_0x397288,_0x2e20e9);var _0xf6a082=_0x29bd42['actions'][_0x3be9e2];if(path[_0xa07a('0x39')](_0x2e20e9[_0xa07a('0x60')])[_0xa07a('0x6a')]==='.pdf'){originate(_0xf6a082,_0xff9aa8,!![])['then'](function(_0x2f0978){_0x39a4ed(_0x2f0978);})[_0xa07a('0x3d')](function(_0x3d15dc){_0x4a3886(_0x3d15dc);});}else{originate(_0xf6a082,_0xff9aa8,![])['then'](function(_0x2868b3){_0x39a4ed(_0x2868b3);})[_0xa07a('0x3d')](function(_0x536c67){_0x4a3886(_0x536c67);});}});};Fax[_0xa07a('0x1d')][_0xa07a('0x6b')]=function(_0x577cb5){return!_['isNil'](_0x577cb5)&&!_[_0xa07a('0x6c')](_0x577cb5[_0xa07a('0x23')])&&!_[_0xa07a('0x6c')](_0x577cb5[_0xa07a('0x6d')])&&_0x577cb5[_0xa07a('0x6d')]&&!_[_0xa07a('0x6c')](this[_0xa07a('0xf')][util[_0xa07a('0x5e')](_0xa07a('0x6e'),_0x577cb5['name'])])&&!_[_0xa07a('0x6c')](this[_0xa07a('0xf')][util[_0xa07a('0x5e')]('SIP/%s',_0x577cb5[_0xa07a('0x23')])]['status'])&&(this[_0xa07a('0xf')][util[_0xa07a('0x5e')](_0xa07a('0x6e'),_0x577cb5[_0xa07a('0x23')])]['status']===_0xa07a('0x6f')||this[_0xa07a('0xf')][util[_0xa07a('0x5e')](_0xa07a('0x6e'),_0x577cb5[_0xa07a('0x23')])][_0xa07a('0x2c')]===_0xa07a('0x70'));};Fax[_0xa07a('0x1d')]['checkTrunk']=function(_0x4cd7c1,_0x3a5233){if(!this[_0xa07a('0x6b')](_0x4cd7c1)){ut['logger'](_0xa07a('0x71'),_[_0xa07a('0x6c')](_0x4cd7c1)?'':_0x4cd7c1['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xa07a('0x72')};}if(_[_0xa07a('0x6c')](_0x3a5233[_0xa07a('0x7')])){ut['logger'](_0xa07a('0x73'),JSON['stringify'](_0x3a5233));return{'isValid':![],'message':_0xa07a('0x74')};}if(_[_0xa07a('0x6c')](_0x3a5233[_0xa07a('0x60')])){ut['logger'](_0xa07a('0x75'),JSON[_0xa07a('0x40')](_0x3a5233));return{'isValid':![],'message':_0xa07a('0x76')};}return{'isValid':!![],'message':_0xa07a('0x77')};};module[_0xa07a('0x78')]=Fax; \ No newline at end of file +var _0xbfa5=['format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Is\x20Valid','lodash','bluebird','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','bind','newstate','newexten','syncNewExten','faxstatus','syncReceiveFax','syncHangup','syncOriginateResponse','syncNewchannel','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','syncVarSet','variable','value','syncNewState','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','catch','\x20notify\x20','error','\x20receiveFax\x20','stringify','pick','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable'];(function(_0x9b86,_0x4b95c1){var _0x6c4a09=function(_0x4d60d4){while(--_0x4d60d4){_0x9b86['push'](_0x9b86['shift']());}};_0x6c4a09(++_0x4b95c1);}(_0xbfa5,0x16a));var _0x5bfa=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xbfa5[_0x525c7b];return _0x27b33e;};'use strict';var util=require('util');var _=require(_0x5bfa('0x0'));var BPromise=require(_0x5bfa('0x1'));var uuid=require(_0x5bfa('0x2'));var moment=require(_0x5bfa('0x3'));var path=require('path');var tiff2pdf=require(_0x5bfa('0x4'));var gs=require(_0x5bfa('0x5'));var logger=require(_0x5bfa('0x6'))(_0x5bfa('0x7'));var ami=require(_0x5bfa('0x8'));var rpcDb=require(_0x5bfa('0x9'));var Channel=require(_0x5bfa('0xa'));var ut=require(_0x5bfa('0xb'));var Action=require('./action');var faxAccount=require(_0x5bfa('0xc'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x5bfa('0xd'));function Fax(_0x299df8){this[_0x5bfa('0xe')]={};this[_0x5bfa('0xf')]=_0x299df8[_0x5bfa('0xf')];this[_0x5bfa('0x10')]=_0x299df8[_0x5bfa('0x10')];this[_0x5bfa('0x11')]={};ami['on'](_0x5bfa('0x12'),this['syncNewchannel'][_0x5bfa('0x13')](this));ami['on']('varset',this['syncVarSet'][_0x5bfa('0x13')](this));ami['on'](_0x5bfa('0x14'),this['syncNewState'][_0x5bfa('0x13')](this));ami['on'](_0x5bfa('0x15'),this[_0x5bfa('0x16')][_0x5bfa('0x13')](this));ami['on'](_0x5bfa('0x17'),this['syncFaxStatus']['bind'](this));ami['on']('receivefax',this[_0x5bfa('0x18')][_0x5bfa('0x13')](this));ami['on']('hangup',this[_0x5bfa('0x19')][_0x5bfa('0x13')](this));ami['on']('originateresponse',this[_0x5bfa('0x1a')][_0x5bfa('0x13')](this));}Fax['prototype'][_0x5bfa('0x1b')]=function(_0x517a76){if(_0x517a76[_0x5bfa('0x1c')]===_0x5bfa('0x1d')){for(var _0x574e23 in this[_0x5bfa('0xf')]){if(this[_0x5bfa('0xf')][_0x5bfa('0x1e')](_0x574e23)){if(_0x517a76['exten']===this[_0x5bfa('0xf')][_0x574e23][_0x5bfa('0x1f')]){this[_0x5bfa('0xe')][_0x517a76[_0x5bfa('0x20')]]={};this['channels'][_0x517a76[_0x5bfa('0x20')]][_0x5bfa('0x21')]=_0x517a76[_0x5bfa('0x21')];this[_0x5bfa('0xe')][_0x517a76[_0x5bfa('0x20')]]['id']=this[_0x5bfa('0xf')][_0x574e23]['id'];this['channels'][_0x517a76[_0x5bfa('0x20')]][_0x5bfa('0x22')]=this[_0x5bfa('0xf')][_0x574e23]['name'];logger[_0x5bfa('0x23')](_0x517a76[_0x5bfa('0x20')],_0x5bfa('0x24'));}}}}if(this[_0x5bfa('0x11')][_0x517a76[_0x5bfa('0x20')]]){this[_0x5bfa('0xe')][_0x517a76[_0x5bfa('0x20')]]={};this[_0x5bfa('0xe')][_0x517a76['uniqueid']][_0x5bfa('0x21')]=_0x517a76[_0x5bfa('0x21')];logger['info'](_0x517a76[_0x5bfa('0x20')],'\x20syncNewchannel\x20');}};Fax[_0x5bfa('0x25')][_0x5bfa('0x26')]=function(_0x15af63){if(this[_0x5bfa('0xe')][_0x15af63['uniqueid']]){for(var _0xcd53b9 in _0x15af63['variable']){if(_0x15af63[_0x5bfa('0x27')][_0x5bfa('0x1e')](_0xcd53b9)){this[_0x5bfa('0xe')][_0x15af63[_0x5bfa('0x20')]][_0xcd53b9]=_0x15af63[_0x5bfa('0x28')];}}}};Fax[_0x5bfa('0x25')][_0x5bfa('0x29')]=function(_0x497af2){if(this['channels'][_0x497af2[_0x5bfa('0x20')]]){this['channels'][_0x497af2['uniqueid']][_0x5bfa('0x2a')]=_0x497af2[_0x5bfa('0x2a')];this[_0x5bfa('0xe')][_0x497af2['uniqueid']][_0x5bfa('0x2b')]=_0x497af2[_0x5bfa('0x2b')];}};Fax[_0x5bfa('0x25')][_0x5bfa('0x16')]=function(_0x1e5310){if(this[_0x5bfa('0xe')][_0x1e5310[_0x5bfa('0x20')]]){for(var _0x5457a6 in _0x1e5310[_0x5bfa('0x27')]){if(_0x1e5310[_0x5bfa('0x27')][_0x5bfa('0x1e')](_0x5457a6)){this['channels'][_0x1e5310['uniqueid']][_0x5457a6]=_0x1e5310[_0x5bfa('0x28')];}}}};Fax['prototype'][_0x5bfa('0x2c')]=function(_0xf7911c){if(this[_0x5bfa('0xe')][_0xf7911c[_0x5bfa('0x20')]]){this[_0x5bfa('0xe')][_0xf7911c['uniqueid']][_0x5bfa('0x2d')]=_0xf7911c[_0x5bfa('0x2d')];this['channels'][_0xf7911c[_0x5bfa('0x20')]][_0x5bfa('0x2e')]=_0xf7911c[_0x5bfa('0x2e')];this[_0x5bfa('0xe')][_0xf7911c[_0x5bfa('0x20')]]['localstationid']=_0xf7911c[_0x5bfa('0x1f')];this[_0x5bfa('0xe')][_0xf7911c[_0x5bfa('0x20')]][_0x5bfa('0x2f')]=_0xf7911c['filename'];logger[_0x5bfa('0x23')](_0xf7911c[_0x5bfa('0x20')],'\x20syncFaxStatus\x20');}};Fax[_0x5bfa('0x25')][_0x5bfa('0x18')]=function(_0x10bfbc){var _0x5a5bfa=this;if(this[_0x5bfa('0xe')][_0x10bfbc[_0x5bfa('0x20')]]){var _0x233cfa=this[_0x5bfa('0xe')][_0x10bfbc[_0x5bfa('0x20')]]['id'];this[_0x5bfa('0xe')][_0x10bfbc[_0x5bfa('0x20')]][_0x5bfa('0x30')]=_0x10bfbc[_0x5bfa('0x30')];this[_0x5bfa('0xe')][_0x10bfbc[_0x5bfa('0x20')]][_0x5bfa('0x31')]=_0x10bfbc[_0x5bfa('0x31')];this[_0x5bfa('0xe')][_0x10bfbc[_0x5bfa('0x20')]][_0x5bfa('0x1f')]=_0x10bfbc['localstationid'];this[_0x5bfa('0xe')][_0x10bfbc[_0x5bfa('0x20')]][_0x5bfa('0x32')]=_0x10bfbc['resolution'];this['channels'][_0x10bfbc[_0x5bfa('0x20')]][_0x5bfa('0x33')]=_0x10bfbc[_0x5bfa('0x33')];this[_0x5bfa('0xe')][_0x10bfbc[_0x5bfa('0x20')]][_0x5bfa('0x2f')]=_0x10bfbc[_0x5bfa('0x2f')];this[_0x5bfa('0xe')][_0x10bfbc[_0x5bfa('0x20')]][_0x5bfa('0x34')]=_0x10bfbc[_0x5bfa('0x34')];if(this[_0x5bfa('0xe')][_0x10bfbc[_0x5bfa('0x20')]]['pagestransferred']>0x0){tiff2pdf(_0x10bfbc[_0x5bfa('0x2f')],_0x5bfa('0x35'),function(_0x2a6d0a){logger[_0x5bfa('0x23')](_0x10bfbc[_0x5bfa('0x20')],'\x20result\x20conversion\x20file\x20',_0x2a6d0a[_0x5bfa('0x36')]);attachment[_0x5bfa('0x37')]({'name':path['parse'](_0x10bfbc[_0x5bfa('0x2f')])[_0x5bfa('0x22')],'basename':path[_0x5bfa('0x38')](_0x10bfbc[_0x5bfa('0x2f')])[_0x5bfa('0x22')]+_0x5bfa('0x39'),'type':_0x5bfa('0x3a')})[_0x5bfa('0x3b')](function(_0x2772d5){faxAccount[_0x5bfa('0x3c')](_0x233cfa,{'from':_0x10bfbc[_0x5bfa('0x34')],'mapKey':_0x5bfa('0x7'),'body':path[_0x5bfa('0x38')](_0x10bfbc[_0x5bfa('0x2f')])['name']+_0x5bfa('0x39'),'AttachmentId':_0x2772d5['id']})[_0x5bfa('0x3d')](function(_0x5b1d74){logger['error'](_0x10bfbc[_0x5bfa('0x20')],_0x5bfa('0x3e'),JSON['stringify'](_0x5b1d74));});})[_0x5bfa('0x3d')](function(_0x5ad78a){logger[_0x5bfa('0x3f')](_0x10bfbc['uniqueid'],_0x5bfa('0x40'),JSON[_0x5bfa('0x41')](_0x5ad78a));});});}logger[_0x5bfa('0x23')](_0x10bfbc[_0x5bfa('0x20')],_0x5bfa('0x40'));}};Fax[_0x5bfa('0x25')]['syncOriginateResponse']=function(_0x93ca1f){if(this[_0x5bfa('0x11')][_0x93ca1f[_0x5bfa('0x20')]]){_['merge'](this[_0x5bfa('0xe')][_0x93ca1f[_0x5bfa('0x20')]],_[_0x5bfa('0x42')](_0x93ca1f,['response','reason']));}};function updateStatus(_0x19de62){if(_0x19de62[_0x5bfa('0x43')]){faxMessage[_0x5bfa('0x44')](_0x19de62['AttachmentId'],{'failMessage':_0x5bfa('0x45')})[_0x5bfa('0x3b')](function(_0x592ec7){ut['logger'](_0x5bfa('0x46'),_0x592ec7);})[_0x5bfa('0x3d')](function(_0x308514){ut[_0x5bfa('0x47')](_0x5bfa('0x48'),_0x308514);});}else{ut[_0x5bfa('0x47')](_0x5bfa('0x49'));}}Fax[_0x5bfa('0x25')][_0x5bfa('0x4a')]=function(_0x149679,_0x6c1121,_0x16c7cc){var _0x3492a1=this;var _0x407466={};if(_0x6c1121){_0x407466={'read':_0x6c1121};}else{_0x407466={'failMessage':_0x16c7cc};}if(this[_0x5bfa('0x11')][_0x149679]['AttachmentId']){faxMessage[_0x5bfa('0x44')](this[_0x5bfa('0x11')][_0x149679][_0x5bfa('0x43')],_0x407466)['then'](function(_0x1fb54d){ut[_0x5bfa('0x47')](_0x5bfa('0x4b'),_0x1fb54d);})['catch'](function(_0x380300){ut['logger'](_0x5bfa('0x4c'),_0x380300);})[_0x5bfa('0x4d')](function(){delete _0x3492a1[_0x5bfa('0xe')][_0x149679];delete _0x3492a1[_0x5bfa('0x11')][_0x149679];});}else{ut[_0x5bfa('0x47')]('[Fax][Message][NoUpdate2]');delete this['channels'][_0x149679];delete this[_0x5bfa('0x11')][_0x149679];}};Fax[_0x5bfa('0x25')][_0x5bfa('0x19')]=function(_0x5ee9f1){var _0x477268=this;if(this[_0x5bfa('0xe')][_0x5ee9f1[_0x5bfa('0x20')]]){if(this[_0x5bfa('0x11')][_0x5ee9f1[_0x5bfa('0x20')]]){this[_0x5bfa('0xe')][_0x5ee9f1[_0x5bfa('0x20')]]['id']=this[_0x5bfa('0x11')][_0x5ee9f1[_0x5bfa('0x20')]]['id'];this[_0x5bfa('0xe')][_0x5ee9f1[_0x5bfa('0x20')]][_0x5bfa('0x22')]=this[_0x5bfa('0x11')][_0x5ee9f1[_0x5bfa('0x20')]]['name'];}logger['info'](_0x5ee9f1[_0x5bfa('0x20')],this[_0x5bfa('0x11')][_0x5ee9f1[_0x5bfa('0x20')]]?_0x5bfa('0x4e'):'\x20hangup\x20faxRiceive\x20',JSON[_0x5bfa('0x41')](this[_0x5bfa('0xe')][_0x5ee9f1[_0x5bfa('0x20')]]));if(this[_0x5bfa('0x11')][_0x5ee9f1[_0x5bfa('0x20')]]){if(this[_0x5bfa('0xe')][_0x5ee9f1[_0x5bfa('0x20')]][_0x5bfa('0x4f')]>0x0&&this['channels'][_0x5ee9f1[_0x5bfa('0x20')]][_0x5bfa('0x17')]===_0x5bfa('0x50')){this[_0x5bfa('0x4a')](_0x5ee9f1[_0x5bfa('0x20')],!![]);}else{this[_0x5bfa('0x4a')](_0x5ee9f1[_0x5bfa('0x20')],![],this['channels'][_0x5ee9f1[_0x5bfa('0x20')]][_0x5bfa('0x51')]?'SENDING\x20FAILED:\x20'+this[_0x5bfa('0xe')][_0x5ee9f1[_0x5bfa('0x20')]][_0x5bfa('0x51')]:'SENDING\x20FAILED');}}}};Fax[_0x5bfa('0x25')][_0x5bfa('0x52')]=function(_0x29915f){var _0x182fdb=this;return new BPromise(function(_0x5e05c6,_0x44942b){_0x182fdb[_0x5bfa('0x53')](_0x29915f,_0x182fdb[_0x5bfa('0xf')][_0x29915f[_0x5bfa('0x54')]])[_0x5bfa('0x3b')](function(_0x2879e3){ut['logger'](_0x5bfa('0x55'),_0x2879e3);_0x5e05c6(ut[_0x5bfa('0x36')](_0x5bfa('0x56')));})[_0x5bfa('0x3d')](function(_0x595ba8){ut[_0x5bfa('0x47')](_0x5bfa('0x57'),_0x595ba8);updateStatus(_0x29915f);_0x44942b(ut['message'](_0x5bfa('0x58')));});});};Fax['prototype'][_0x5bfa('0x59')]=function(_0x5ec1b0){var _0x343f3e=this;return new BPromise(function(_0x2a5488,_0x233944){var _0x54e274=_0x343f3e[_0x5bfa('0x5a')](_0x343f3e['faxAccounts'][_0x5ec1b0[_0x5bfa('0x54')]][_0x5bfa('0x5b')],_0x5ec1b0);if(_0x54e274[_0x5bfa('0x5c')]){_0x2a5488(ut['message'](_0x5bfa('0x5d')));}else{_0x233944(ut[_0x5bfa('0x36')](_0x54e274[_0x5bfa('0x36')]));}});};function originate(_0x4b4cf1,_0x4bf82b,_0x3b4849){return new BPromise(function(_0x212648,_0x34726b){if(_0x3b4849){var _0x445bce=util[_0x5bfa('0x5e')](_0x5bfa('0x5f'),path[_0x5bfa('0x38')](_0x4b4cf1[_0x5bfa('0x60')])[_0x5bfa('0x22')],_0x4b4cf1[_0x5bfa('0x60')]);gs['execute'](_0x445bce)['then'](function(){_0x4b4cf1[_0x5bfa('0x60')]=util['format'](_0x5bfa('0x61'),path[_0x5bfa('0x38')](_0x4b4cf1[_0x5bfa('0x60')])['dir'],path['parse'](_0x4b4cf1[_0x5bfa('0x60')])[_0x5bfa('0x22')]);_0x4bf82b[_0x5bfa('0x62')]=_0x4b4cf1[_0x5bfa('0x60')];ut['logger'](_0x5bfa('0x63'),'');ami[_0x5bfa('0x64')](ut[_0x5bfa('0x65')](_0x4b4cf1,_0x4bf82b))[_0x5bfa('0x3b')](function(_0x6b680d){_0x212648(_0x6b680d);})['catch'](function(_0x471506){_0x34726b(_0x471506);});})['catch'](function(_0x39fe80){_0x34726b(_0x39fe80);});}else{ami['Action'](ut[_0x5bfa('0x65')](_0x4b4cf1,_0x4bf82b))[_0x5bfa('0x3b')](function(_0x36494e){_0x212648(_0x36494e);})[_0x5bfa('0x3d')](function(_0x15aff4){_0x34726b(_0x15aff4);});}});}Fax[_0x5bfa('0x25')][_0x5bfa('0x53')]=function(_0x5e9cbb,_0x21d907){var _0x238622=this;return new BPromise(function(_0x735bc1,_0x442dd2){var _0x2bc4f2=uuid['v4']();var _0x4e2dc1=ut[_0x5bfa('0x66')](_0x5e9cbb,_0x21d907);_0x238622[_0x5bfa('0x11')][_0x2bc4f2]=new Action(_0x2bc4f2,_0x21d907,_0x5e9cbb);var _0x24ef8d=_0x238622[_0x5bfa('0x11')][_0x2bc4f2];if(path[_0x5bfa('0x38')](_0x5e9cbb[_0x5bfa('0x60')])['ext']==='.pdf'){originate(_0x24ef8d,_0x4e2dc1,!![])[_0x5bfa('0x3b')](function(_0x19bb30){_0x735bc1(_0x19bb30);})[_0x5bfa('0x3d')](function(_0x23223a){_0x442dd2(_0x23223a);});}else{originate(_0x24ef8d,_0x4e2dc1,![])[_0x5bfa('0x3b')](function(_0x4b0dc8){_0x735bc1(_0x4b0dc8);})[_0x5bfa('0x3d')](function(_0xbce4a0){_0x442dd2(_0xbce4a0);});}});};Fax['prototype'][_0x5bfa('0x67')]=function(_0x2301a7){return!_[_0x5bfa('0x68')](_0x2301a7)&&!_['isNil'](_0x2301a7[_0x5bfa('0x22')])&&!_['isNil'](_0x2301a7[_0x5bfa('0x69')])&&_0x2301a7[_0x5bfa('0x69')]&&!_[_0x5bfa('0x68')](this[_0x5bfa('0x10')][util[_0x5bfa('0x5e')]('SIP/%s',_0x2301a7[_0x5bfa('0x22')])])&&!_['isNil'](this['trunks'][util[_0x5bfa('0x5e')](_0x5bfa('0x6a'),_0x2301a7[_0x5bfa('0x22')])]['status'])&&(this[_0x5bfa('0x10')][util['format'](_0x5bfa('0x6a'),_0x2301a7[_0x5bfa('0x22')])][_0x5bfa('0x2e')]==='reachable'||this[_0x5bfa('0x10')][util[_0x5bfa('0x5e')](_0x5bfa('0x6a'),_0x2301a7[_0x5bfa('0x22')])]['status']===_0x5bfa('0x6b'));};Fax['prototype'][_0x5bfa('0x5a')]=function(_0x7b363e,_0x26b7b){if(!this['isTrunkReachable'](_0x7b363e)){ut['logger'](_0x5bfa('0x6c'),_['isNil'](_0x7b363e)?'':_0x7b363e[_0x5bfa('0x22')]+_0x5bfa('0x6d'));return{'isValid':![],'message':_0x5bfa('0x6e')};}if(_[_0x5bfa('0x68')](_0x26b7b[_0x5bfa('0x7')])){ut[_0x5bfa('0x47')](_0x5bfa('0x6f'),JSON[_0x5bfa('0x41')](_0x26b7b));return{'isValid':![],'message':_0x5bfa('0x70')};}if(_[_0x5bfa('0x68')](_0x26b7b[_0x5bfa('0x60')])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON[_0x5bfa('0x41')](_0x26b7b));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x5bfa('0x71')};};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 a55aab2..b805346 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 _0x2e1f=['resolve','catch','[Notify]\x20','util','bluebird','../../../config/logger','lodash','inspect','notify'];(function(_0x398319,_0x3dd7aa){var _0xbd2195=function(_0x3066e2){while(--_0x3066e2){_0x398319['push'](_0x398319['shift']());}};_0xbd2195(++_0x3dd7aa);}(_0x2e1f,0x147));var _0xf2e1=function(_0x474d97,_0x5909ce){_0x474d97=_0x474d97-0x0;var _0x1edf25=_0x2e1f[_0x474d97];return _0x1edf25;};'use strict';var util=require(_0xf2e1('0x0'));var BPromise=require(_0xf2e1('0x1'));var logger=require(_0xf2e1('0x2'))('preview');var _=require(_0xf2e1('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x36a2de){return function(_0x20d4b1){logger['error'](_0x36a2de,util[_0xf2e1('0x4')](_0x20d4b1,{'showHidden':![],'depth':null}));};}exports[_0xf2e1('0x5')]=function(_0x479c8a,_0x85fdae){return BPromise[_0xf2e1('0x6')]()['then'](faxAccount[_0xf2e1('0x5')](_0x479c8a,_0x85fdae))[_0xf2e1('0x7')](loggerCatch(_0xf2e1('0x8')));}; \ No newline at end of file +var _0x18b4=['../../../config/logger','lodash','../rpc/faxAccount','error','inspect','notify','resolve','util','bluebird'];(function(_0x535f07,_0x27dd7a){var _0x4fcf7a=function(_0x21bb42){while(--_0x21bb42){_0x535f07['push'](_0x535f07['shift']());}};_0x4fcf7a(++_0x27dd7a);}(_0x18b4,0x139));var _0x418b=function(_0x38930a,_0x54ca30){_0x38930a=_0x38930a-0x0;var _0x5470e2=_0x18b4[_0x38930a];return _0x5470e2;};'use strict';var util=require(_0x418b('0x0'));var BPromise=require(_0x418b('0x1'));var logger=require(_0x418b('0x2'))('preview');var _=require(_0x418b('0x3'));var faxAccount=require(_0x418b('0x4'));function loggerCatch(_0x18d54c){return function(_0xd91880){logger[_0x418b('0x5')](_0x18d54c,util[_0x418b('0x6')](_0xd91880,{'showHidden':![],'depth':null}));};}exports[_0x418b('0x7')]=function(_0x3a6bab,_0x45a4f7){return BPromise[_0x418b('0x8')]()['then'](faxAccount[_0x418b('0x7')](_0x3a6bab,_0x45a4f7))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 9d22cb6..a157be7 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 _0x67e0=['info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','child_process','exec'];(function(_0x5497fb,_0x2b2e80){var _0x53e6c1=function(_0x1d52b3){while(--_0x1d52b3){_0x5497fb['push'](_0x5497fb['shift']());}};_0x53e6c1(++_0x2b2e80);}(_0x67e0,0xac));var _0x067e=function(_0x528442,_0x3f7aed){_0x528442=_0x528442-0x0;var _0x4c42cd=_0x67e0[_0x528442];return _0x4c42cd;};'use strict';var util=require('util');var logger=require(_0x067e('0x0'))('fax');var BPromise=require('bluebird');var exec=require(_0x067e('0x1'))[_0x067e('0x2')];exports['execute']=function(_0x2d4cb3){return new BPromise(function(_0x479223,_0x49ae6e){exec(_0x2d4cb3,function(_0x29112b,_0x2c2a01,_0x39ff85){logger[_0x067e('0x3')]('Exec\x20gs',_0x2c2a01);if(_0x29112b){logger['info'](_0x067e('0x4'),_0x067e('0x5'),util[_0x067e('0x6')](_0x29112b,{'showHidden':![],'depth':null}),_0x2c2a01,_0x39ff85);_0x49ae6e(_0x29112b);}_0x479223(_0x2c2a01);});});}; \ No newline at end of file +var _0x58b4=['Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','exec','execute','info'];(function(_0x38782c,_0x5c9fef){var _0x3708bf=function(_0x595e13){while(--_0x595e13){_0x38782c['push'](_0x38782c['shift']());}};_0x3708bf(++_0x5c9fef);}(_0x58b4,0x17f));var _0x458b=function(_0x50bb54,_0x51e899){_0x50bb54=_0x50bb54-0x0;var _0x135cb8=_0x58b4[_0x50bb54];return _0x135cb8;};'use strict';var util=require(_0x458b('0x0'));var logger=require(_0x458b('0x1'))(_0x458b('0x2'));var BPromise=require(_0x458b('0x3'));var exec=require('child_process')[_0x458b('0x4')];exports[_0x458b('0x5')]=function(_0x3e6420){return new BPromise(function(_0x2e9f43,_0x211e18){exec(_0x3e6420,function(_0xb4c178,_0x13e998,_0x37fd18){logger[_0x458b('0x6')](_0x458b('0x7'),_0x13e998);if(_0xb4c178){logger[_0x458b('0x6')](_0x458b('0x7'),_0x458b('0x8'),util[_0x458b('0x9')](_0xb4c178,{'showHidden':![],'depth':null}),_0x13e998,_0x37fd18);_0x211e18(_0xb4c178);}_0x2e9f43(_0x13e998);});});}; \ 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 a3e3378..b7a2857 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 _0x91a7=['lodash','moment','../../../../config/logger','message','logger','info','inspect','ecm','minrate','maxrate','format','\x22%s\x22','modem','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','from-sip','headerinfo'];(function(_0x220a24,_0x5a449f){var _0x379e0d=function(_0x5a9903){while(--_0x5a9903){_0x220a24['push'](_0x220a24['shift']());}};_0x379e0d(++_0x5a449f);}(_0x91a7,0xe7));var _0x791a=function(_0x2f3cf5,_0x46328c){_0x2f3cf5=_0x2f3cf5-0x0;var _0x5049d7=_0x91a7[_0x2f3cf5];return _0x5049d7;};'use strict';var util=require('util');var _=require(_0x791a('0x0'));var moment=require(_0x791a('0x1'));var logger=require(_0x791a('0x2'))('fax');exports[_0x791a('0x3')]=function(_0x5b6f78){return{'message':_0x5b6f78};};exports[_0x791a('0x4')]=function(_0x535640,_0x50ab29){logger[_0x791a('0x5')](_0x535640,util[_0x791a('0x6')](_0x50ab29,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x361f53,_0x5db6db){var _0x33baac={'XMF-ECM':_0x5db6db[_0x791a('0x7')],'XMF-HEADERINFO':_0x5db6db['headerinfo'],'XMF-MINRATE':_0x5db6db[_0x791a('0x8')],'XMF-MAXRATE':_0x5db6db[_0x791a('0x9')],'XMF-MODEM':util[_0x791a('0xa')](_0x791a('0xb'),_0x5db6db[_0x791a('0xc')]),'XMF-GATEWAY':_0x5db6db['gateway'],'XMF-FAXDETECT':_0x5db6db[_0x791a('0xd')],'XMF-T38TIMEOUT':_0x5db6db[_0x791a('0xe')],'XMF-LOCALSTATIONID':_0x5db6db['localstationid'],'XMF-PATH':_0x361f53[_0x791a('0xf')]};return _0x33baac;};exports[_0x791a('0x10')]=function(_0x167bc4,_0x17cf33){return{'actionid':_0x167bc4[_0x791a('0x11')],'action':_0x791a('0x12'),'channel':_0x167bc4['channel'],'Exten':'xcally-motion-fax','Context':_0x791a('0x13'),'Priority':'1','callerid':util[_0x791a('0xa')]('\x22%s\x22\x20<%s>',_0x167bc4[_0x791a('0x14')]?_0x167bc4[_0x791a('0x14')]:'',_0x167bc4['localstationid']),'variable':_0x17cf33,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x167bc4[_0x791a('0x11')]};}; \ No newline at end of file +var _0xec56=['xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel'];(function(_0x438685,_0x4ec0c0){var _0x41cca2=function(_0x532003){while(--_0x532003){_0x438685['push'](_0x438685['shift']());}};_0x41cca2(++_0x4ec0c0);}(_0xec56,0x1bd));var _0x6ec5=function(_0x56de76,_0x4882c9){_0x56de76=_0x56de76-0x0;var _0x16a2da=_0xec56[_0x56de76];return _0x16a2da;};'use strict';var util=require(_0x6ec5('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x6ec5('0x1'))(_0x6ec5('0x2'));exports[_0x6ec5('0x3')]=function(_0x240ccf){return{'message':_0x240ccf};};exports[_0x6ec5('0x4')]=function(_0x399441,_0x469679){logger[_0x6ec5('0x5')](_0x399441,util[_0x6ec5('0x6')](_0x469679,{'showHidden':![],'depth':null}));};exports[_0x6ec5('0x7')]=function(_0x2d0a93,_0x3bb683){var _0x35be4e={'XMF-ECM':_0x3bb683[_0x6ec5('0x8')],'XMF-HEADERINFO':_0x3bb683[_0x6ec5('0x9')],'XMF-MINRATE':_0x3bb683[_0x6ec5('0xa')],'XMF-MAXRATE':_0x3bb683[_0x6ec5('0xb')],'XMF-MODEM':util[_0x6ec5('0xc')](_0x6ec5('0xd'),_0x3bb683['modem']),'XMF-GATEWAY':_0x3bb683[_0x6ec5('0xe')],'XMF-FAXDETECT':_0x3bb683[_0x6ec5('0xf')],'XMF-T38TIMEOUT':_0x3bb683[_0x6ec5('0x10')],'XMF-LOCALSTATIONID':_0x3bb683[_0x6ec5('0x11')],'XMF-PATH':_0x2d0a93[_0x6ec5('0x12')]};return _0x35be4e;};exports[_0x6ec5('0x13')]=function(_0x1d5b76,_0x50eb2d){return{'actionid':_0x1d5b76[_0x6ec5('0x14')],'action':_0x6ec5('0x15'),'channel':_0x1d5b76[_0x6ec5('0x16')],'Exten':_0x6ec5('0x17'),'Context':_0x6ec5('0x18'),'Priority':'1','callerid':util[_0x6ec5('0xc')](_0x6ec5('0x19'),_0x1d5b76[_0x6ec5('0x9')]?_0x1d5b76['headerinfo']:'',_0x1d5b76[_0x6ec5('0x11')]),'variable':_0x50eb2d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1d5b76['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index a3733b4..ea80621 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 _0xff89=['getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','log','sync','bluebird','util','moment','./report','./trigger','./dialer','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','get','hour','resolve','then','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers'];(function(_0x3a8299,_0x7c3aab){var _0x4a98ce=function(_0xba7cc1){while(--_0xba7cc1){_0x3a8299['push'](_0x3a8299['shift']());}};_0x4a98ce(++_0x7c3aab);}(_0xff89,0x18c));var _0x9ff8=function(_0x27a566,_0x4f368a){_0x27a566=_0x27a566-0x0;var _0x193dc0=_0xff89[_0x27a566];return _0x193dc0;};'use strict';var BPromise=require(_0x9ff8('0x0'));var util=require(_0x9ff8('0x1'));var moment=require(_0x9ff8('0x2'));var server=require('./server');var Realtime=require('./realtime');var Report=require(_0x9ff8('0x3'));var Acw=require('./acw');var Trigger=require(_0x9ff8('0x4'));var Dialer=require(_0x9ff8('0x5'));var Preview=require('./preview');var Fax=require(_0x9ff8('0x6'));var user=require('./rpc/user');var voiceQueue=require(_0x9ff8('0x7'));var voiceQueueReport=require(_0x9ff8('0x8'));var voiceCallReport=require(_0x9ff8('0x9'));var trunk=require(_0x9ff8('0xa'));var trigger=require(_0x9ff8('0xb'));var template=require(_0x9ff8('0xc'));var cmHopperHistory=require(_0x9ff8('0xd'));var campaign=require(_0x9ff8('0xe'));var voiceExtension=require(_0x9ff8('0xf'));var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x9ff8('0x10'));var sugarcrm=require(_0x9ff8('0x11'));var freshdesk=require(_0x9ff8('0x12'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x9ff8('0x13'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x9ff8('0x14'));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()[_0x9ff8('0x15')](_0x9ff8('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x9ff8('0x15')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x9ff8('0x17')]()[_0x9ff8('0x18')](user['getAgents']())[_0x9ff8('0x18')](realtime['initAgents']())[_0x9ff8('0x18')](user[_0x9ff8('0x19')]())[_0x9ff8('0x18')](realtime[_0x9ff8('0x1a')]())[_0x9ff8('0x18')](trunk[_0x9ff8('0x1b')]())[_0x9ff8('0x18')](realtime['initTrunks']())[_0x9ff8('0x18')](voiceQueue[_0x9ff8('0x1c')]())[_0x9ff8('0x18')](realtime[_0x9ff8('0x1d')]())[_0x9ff8('0x18')](trigger[_0x9ff8('0x1e')]())['then'](realtime['initTriggers']())[_0x9ff8('0x18')](template[_0x9ff8('0x1f')]())['then'](realtime[_0x9ff8('0x20')]())[_0x9ff8('0x18')](zendesk[_0x9ff8('0x21')]())[_0x9ff8('0x18')](realtime[_0x9ff8('0x22')]())['then'](salesforce[_0x9ff8('0x23')]())[_0x9ff8('0x18')](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0x9ff8('0x24')]())['then'](realtime['initSugarcrmAccounts']())[_0x9ff8('0x18')](freshdesk[_0x9ff8('0x25')]())[_0x9ff8('0x18')](realtime[_0x9ff8('0x26')]())[_0x9ff8('0x18')](desk[_0x9ff8('0x27')]())[_0x9ff8('0x18')](realtime[_0x9ff8('0x28')]())[_0x9ff8('0x18')](zoho[_0x9ff8('0x29')]())[_0x9ff8('0x18')](realtime['initZohoAccounts']())['then'](vtiger['getVtigerAccounts']())[_0x9ff8('0x18')](realtime[_0x9ff8('0x2a')]())[_0x9ff8('0x18')](freshsales[_0x9ff8('0x2b')]())['then'](realtime[_0x9ff8('0x2c')]())[_0x9ff8('0x18')](servicenow[_0x9ff8('0x2d')]())[_0x9ff8('0x18')](realtime[_0x9ff8('0x2e')]())[_0x9ff8('0x18')](dynamics365[_0x9ff8('0x2f')]())[_0x9ff8('0x18')](realtime['initDynamics365Accounts']())[_0x9ff8('0x18')](campaign[_0x9ff8('0x30')]())['then'](realtime[_0x9ff8('0x31')]())[_0x9ff8('0x18')](voiceExtension[_0x9ff8('0x32')]())['then'](realtime[_0x9ff8('0x33')]())['then'](faxAccount[_0x9ff8('0x34')]())[_0x9ff8('0x18')](realtime[_0x9ff8('0x35')]())['then'](function(){return realtime;});}function initParams(){return BPromise['resolve']()['then'](voiceQueueReport[_0x9ff8('0x36')]())['then'](realtime[_0x9ff8('0x37')]())[_0x9ff8('0x18')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x9ff8('0x18')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0x9ff8('0x38')]())[_0x9ff8('0x18')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0x9ff8('0x39')]())[_0x9ff8('0x18')](realtime[_0x9ff8('0x3a')]())[_0x9ff8('0x18')](function(_0x14c0a1){})['catch'](function(_0x45a54c){console[_0x9ff8('0x3b')](_0x45a54c);});}function main(){return server['listen'](realtime,preview,fax)[_0x9ff8('0x18')](function(_0x3785f8){return initRealtime();})[_0x9ff8('0x18')](function(){return initParams();})[_0x9ff8('0x18')](function(){report[_0x9ff8('0x3c')]();setInterval(initRealtime,0x1388);})['catch'](function(_0xebb53c){console[_0x9ff8('0x3b')](_0xebb53c);});}main(); \ No newline at end of file +var _0x0b33=['initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','catch','log','listen','sync','bluebird','util','./realtime','./report','./trigger','./preview','./fax','./rpc/voiceQueue','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/faxAccount','./rpc/integrations/sugarcrm','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','initVoiceQueues','getTriggers','initTriggers','getTemplates'];(function(_0xc7be88,_0x302888){var _0x53789d=function(_0x3ea6b9){while(--_0x3ea6b9){_0xc7be88['push'](_0xc7be88['shift']());}};_0x53789d(++_0x302888);}(_0x0b33,0x1c2));var _0x30b3=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0x0b33[_0x2d4421];return _0x2d3b01;};'use strict';var BPromise=require(_0x30b3('0x0'));var util=require(_0x30b3('0x1'));var moment=require('moment');var server=require('./server');var Realtime=require(_0x30b3('0x2'));var Report=require(_0x30b3('0x3'));var Acw=require('./acw');var Trigger=require(_0x30b3('0x4'));var Dialer=require('./dialer');var Preview=require(_0x30b3('0x5'));var Fax=require(_0x30b3('0x6'));var user=require('./rpc/user');var voiceQueue=require(_0x30b3('0x7'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x30b3('0x8'));var trigger=require('./rpc/trigger');var template=require(_0x30b3('0x9'));var cmHopperHistory=require(_0x30b3('0xa'));var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x30b3('0xb'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x30b3('0xc'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require(_0x30b3('0xd'));var vtiger=require(_0x30b3('0xe'));var freshsales=require(_0x30b3('0xf'));var servicenow=require(_0x30b3('0x10'));var dynamics365=require(_0x30b3('0x11'));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()[_0x30b3('0x12')](_0x30b3('0x13'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x30b3('0x12')](_0x30b3('0x13'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x30b3('0x14')]()[_0x30b3('0x15')](user[_0x30b3('0x16')]())[_0x30b3('0x15')](realtime[_0x30b3('0x17')]())[_0x30b3('0x15')](user[_0x30b3('0x18')]())['then'](realtime[_0x30b3('0x19')]())['then'](trunk['getTrunks']())[_0x30b3('0x15')](realtime['initTrunks']())[_0x30b3('0x15')](voiceQueue['getVoiceQueues']())[_0x30b3('0x15')](realtime[_0x30b3('0x1a')]())[_0x30b3('0x15')](trigger[_0x30b3('0x1b')]())[_0x30b3('0x15')](realtime[_0x30b3('0x1c')]())['then'](template[_0x30b3('0x1d')]())['then'](realtime[_0x30b3('0x1e')]())[_0x30b3('0x15')](zendesk[_0x30b3('0x1f')]())['then'](realtime['initZendeskAccounts']())[_0x30b3('0x15')](salesforce[_0x30b3('0x20')]())[_0x30b3('0x15')](realtime[_0x30b3('0x21')]())[_0x30b3('0x15')](sugarcrm[_0x30b3('0x22')]())[_0x30b3('0x15')](realtime[_0x30b3('0x23')]())[_0x30b3('0x15')](freshdesk[_0x30b3('0x24')]())[_0x30b3('0x15')](realtime[_0x30b3('0x25')]())['then'](desk[_0x30b3('0x26')]())[_0x30b3('0x15')](realtime[_0x30b3('0x27')]())[_0x30b3('0x15')](zoho[_0x30b3('0x28')]())[_0x30b3('0x15')](realtime[_0x30b3('0x29')]())[_0x30b3('0x15')](vtiger[_0x30b3('0x2a')]())[_0x30b3('0x15')](realtime[_0x30b3('0x2b')]())[_0x30b3('0x15')](freshsales[_0x30b3('0x2c')]())[_0x30b3('0x15')](realtime['initFreshsalesAccounts']())['then'](servicenow[_0x30b3('0x2d')]())[_0x30b3('0x15')](realtime['initServicenowAccounts']())[_0x30b3('0x15')](dynamics365[_0x30b3('0x2e')]())[_0x30b3('0x15')](realtime[_0x30b3('0x2f')]())[_0x30b3('0x15')](campaign[_0x30b3('0x30')]())['then'](realtime[_0x30b3('0x31')]())[_0x30b3('0x15')](voiceExtension['getVoiceExtensions']())[_0x30b3('0x15')](realtime[_0x30b3('0x32')]())[_0x30b3('0x15')](faxAccount['getFaxAccounts']())[_0x30b3('0x15')](realtime['initFaxAccounts']())[_0x30b3('0x15')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x30b3('0x15')](voiceQueueReport[_0x30b3('0x33')]())[_0x30b3('0x15')](realtime[_0x30b3('0x34')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x30b3('0x15')](realtime[_0x30b3('0x35')]())[_0x30b3('0x15')](cmHopperHistory[_0x30b3('0x36')]())[_0x30b3('0x15')](realtime['initCampaignHopperHistory']())[_0x30b3('0x15')](voiceCallReport[_0x30b3('0x37')]())['then'](realtime['initVoiceCallReports']())[_0x30b3('0x15')](function(_0x5a20f5){})[_0x30b3('0x38')](function(_0x2d31ad){console[_0x30b3('0x39')](_0x2d31ad);});}function main(){return server[_0x30b3('0x3a')](realtime,preview,fax)[_0x30b3('0x15')](function(_0x1415c2){return initRealtime();})[_0x30b3('0x15')](function(){return initParams();})[_0x30b3('0x15')](function(){report[_0x30b3('0x3b')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x457a55){console[_0x30b3('0x39')](_0x457a55);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index a30117d..ba1ea0d 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 _0xd2cc=['toNumber','address','voiceStatusCallerIdNumber','interface','format','user:%s','user:presence','exports','lodash','util','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','phone','online','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','talking','voiceStatus','statePause','voiceStatusTime'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd2cc,0x119));var _0xcd2c=function(_0x2cfa83,_0x3658bd){_0x2cfa83=_0x2cfa83-0x0;var _0x4ea660=_0xd2cc[_0x2cfa83];return _0x4ea660;};'use strict';var _=require(_0xcd2c('0x0'));var util=require(_0xcd2c('0x1'));var moment=require('moment');var md5=require(_0xcd2c('0x2'));var Redis=require(_0xcd2c('0x3'));var config=require(_0xcd2c('0x4'));config['redis']=_[_0xcd2c('0x5')](config[_0xcd2c('0x6')],{'host':_0xcd2c('0x7'),'port':0x18eb});var io=require(_0xcd2c('0x8'))(new Redis(config['redis']));function Agent(_0x5dbdb0){this['id']=_0x5dbdb0['id']||0x0;this['name']=_0x5dbdb0[_0xcd2c('0x9')]||'';this[_0xcd2c('0xa')]=_0x5dbdb0[_0xcd2c('0xa')]||'';this[_0xcd2c('0xb')]=_0x5dbdb0['accountcode']||'';this[_0xcd2c('0xc')]=_0x5dbdb0[_0xcd2c('0xc')]||'';this['state']=_0xcd2c('0xd');this[_0xcd2c('0xe')]=0x0;this[_0xcd2c('0xf')]=_0xcd2c('0xd');this['address']='';this[_0xcd2c('0x10')]='';this['mobile']='';this['interface']='';this[_0xcd2c('0x11')]=_0x5dbdb0[_0xcd2c('0x11')]||![];this['voiceStatus']='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0xcd2c('0x12')]='';this[_0xcd2c('0x13')]=![];this['local']=![];this[_0xcd2c('0x2')]='';}Agent[_0xcd2c('0x14')][_0xcd2c('0x15')]=function(_0x14ab98){var _0x1d1526;if(_0x14ab98&&_0x14ab98['state']){_0x1d1526=_0x14ab98[_0xcd2c('0x16')][_0xcd2c('0x17')]();switch(_0x1d1526){case _0xcd2c('0x18'):_0x1d1526=_0xcd2c('0x19');break;case _0xcd2c('0x1a'):_0x1d1526=_0xcd2c('0x1b');break;}}if(_0x1d1526&&this[_0xcd2c('0x1c')]!==_0x1d1526||_0x14ab98[_0xcd2c('0x1d')]){this[_0xcd2c('0x1e')]=_[_0xcd2c('0x1f')](moment()['format']('x'));}if(_0x1d1526){this[_0xcd2c('0x1c')]=_0x1d1526;}var _0x4066d2={'id':this['id'],'name':this[_0xcd2c('0x9')],'email':this[_0xcd2c('0xa')],'accountcode':this['accountcode'],'fullname':this[_0xcd2c('0xc')],'state':this[_0xcd2c('0x16')],'stateTime':this[_0xcd2c('0xe')],'status':this[_0xcd2c('0xf')],'address':this[_0xcd2c('0x20')],'online':this[_0xcd2c('0x11')],'voiceStatus':this[_0xcd2c('0x1c')],'voiceStatusTime':this[_0xcd2c('0x1e')],'voiceStatusCallerIdNumber':this[_0xcd2c('0x21')],'voiceStatusQueue':this[_0xcd2c('0x12')],'interface':this[_0xcd2c('0x22')],'onhold':this[_0xcd2c('0x13')]};var _0x72355a=md5(JSON['stringify'](_0x4066d2));if(this['md5']!==_0x72355a){this['md5']=_0x72355a;io['to'](util[_0xcd2c('0x23')](_0xcd2c('0x24'),_0x4066d2[_0xcd2c('0x9')]))['emit']('user:save',_0x4066d2);io['emit'](_0xcd2c('0x25'),_0x4066d2);}};module[_0xcd2c('0x26')]=Agent; \ No newline at end of file +var _0x5650=['redis','name','email','accountcode','fullname','unknown','status','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','prototype','toLowerCase','not_inuse','idle','inuse','talking','voiceStatus','statePause','state','stateTime','address','onhold','stringify','format','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','defaults','localhost'];(function(_0x49a57c,_0x2eb02c){var _0x4e0316=function(_0x37e2e5){while(--_0x37e2e5){_0x49a57c['push'](_0x49a57c['shift']());}};_0x4e0316(++_0x2eb02c);}(_0x5650,0x6d));var _0x0565=function(_0x1a8414,_0x4f735e){_0x1a8414=_0x1a8414-0x0;var _0x430a62=_0x5650[_0x1a8414];return _0x430a62;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0565('0x0'));var md5=require(_0x0565('0x1'));var Redis=require(_0x0565('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x0565('0x3')](config['redis'],{'host':_0x0565('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0565('0x5')]));function Agent(_0x40b031){this['id']=_0x40b031['id']||0x0;this[_0x0565('0x6')]=_0x40b031[_0x0565('0x6')]||'';this[_0x0565('0x7')]=_0x40b031['email']||'';this[_0x0565('0x8')]=_0x40b031[_0x0565('0x8')]||'';this[_0x0565('0x9')]=_0x40b031['fullname']||'';this['state']=_0x0565('0xa');this['stateTime']=0x0;this[_0x0565('0xb')]=_0x0565('0xa');this['address']='';this[_0x0565('0xc')]='';this[_0x0565('0xd')]='';this[_0x0565('0xe')]='';this['online']=_0x40b031[_0x0565('0xf')]||![];this['voiceStatus']='unknown';this[_0x0565('0x10')]=0x0;this[_0x0565('0x11')]='';this[_0x0565('0x12')]='';this['onhold']=![];this['local']=![];this[_0x0565('0x1')]='';}Agent[_0x0565('0x13')]['updateStatusRealtime']=function(_0xd3a85e){var _0x2be1a4;if(_0xd3a85e&&_0xd3a85e['state']){_0x2be1a4=_0xd3a85e['state'][_0x0565('0x14')]();switch(_0x2be1a4){case _0x0565('0x15'):_0x2be1a4=_0x0565('0x16');break;case _0x0565('0x17'):_0x2be1a4=_0x0565('0x18');break;}}if(_0x2be1a4&&this[_0x0565('0x19')]!==_0x2be1a4||_0xd3a85e[_0x0565('0x1a')]){this[_0x0565('0x10')]=_['toNumber'](moment()['format']('x'));}if(_0x2be1a4){this[_0x0565('0x19')]=_0x2be1a4;}var _0x321366={'id':this['id'],'name':this[_0x0565('0x6')],'email':this[_0x0565('0x7')],'accountcode':this[_0x0565('0x8')],'fullname':this[_0x0565('0x9')],'state':this[_0x0565('0x1b')],'stateTime':this[_0x0565('0x1c')],'status':this['status'],'address':this[_0x0565('0x1d')],'online':this['online'],'voiceStatus':this[_0x0565('0x19')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x0565('0x11')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x0565('0x1e')]};var _0xa496c0=md5(JSON[_0x0565('0x1f')](_0x321366));if(this[_0x0565('0x1')]!==_0xa496c0){this['md5']=_0xa496c0;io['to'](util[_0x0565('0x20')](_0x0565('0x21'),_0x321366[_0x0565('0x6')]))[_0x0565('0x22')](_0x0565('0x23'),_0x321366);io['emit'](_0x0565('0x24'),_0x321366);}};module[_0x0565('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 87dc0f6..786177e 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 _0x392d=['type','campaign','temp','ivrAnswerCallsDay','sendMessageOneNotActive','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name'];(function(_0x3db6c9,_0x24b6d3){var _0x211e79=function(_0x1bd4ff){while(--_0x1bd4ff){_0x3db6c9['push'](_0x3db6c9['shift']());}};_0x211e79(++_0x24b6d3);}(_0x392d,0xef));var _0xd392=function(_0xd7f601,_0x57c8f3){_0xd7f601=_0xd7f601-0x0;var _0x15e6df=_0x392d[_0xd7f601];return _0x15e6df;};'use strict';function Campaign(_0x1a1ee2){this['id']=_0x1a1ee2['id']||0x0;this[_0xd392('0x0')]=_0x1a1ee2[_0xd392('0x0')]||'';this[_0xd392('0x1')]=_0x1a1ee2[_0xd392('0x1')]||_0xd392('0x2');this['originated']=0x0;this[_0xd392('0x3')]=0x0;this[_0xd392('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0xd392('0x5')]=!![];this['active']=_0x1a1ee2[_0xd392('0x6')];this[_0xd392('0x7')]=_0x1a1ee2[_0xd392('0x7')];this['dialTimezone']=_0x1a1ee2['dialTimezone']||null;this['dialGlobalInterval']=_0x1a1ee2[_0xd392('0x8')]?_0x1a1ee2[_0xd392('0x8')]:null;this[_0xd392('0x9')]=_0x1a1ee2['dialOriginateCallerIdName'];this[_0xd392('0xa')]=_0x1a1ee2[_0xd392('0xa')];this[_0xd392('0xb')]=_0x1a1ee2['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x1a1ee2[_0xd392('0xc')];this[_0xd392('0xd')]=_0x1a1ee2['dialCongestionRetryFrequency'];this[_0xd392('0xe')]=_0x1a1ee2[_0xd392('0xe')];this[_0xd392('0xf')]=_0x1a1ee2[_0xd392('0xf')];this['dialNoAnswerMaxRetry']=_0x1a1ee2['dialNoAnswerMaxRetry'];this[_0xd392('0x10')]=_0x1a1ee2[_0xd392('0x10')];this['dialGlobalMaxRetry']=_0x1a1ee2[_0xd392('0x11')];this[_0xd392('0x12')]=_0x1a1ee2[_0xd392('0x12')]||0x3;this[_0xd392('0x13')]=_0x1a1ee2[_0xd392('0x13')]||0x96;this[_0xd392('0x14')]=_0x1a1ee2['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x1a1ee2[_0xd392('0x15')]||0x96;this[_0xd392('0x16')]=_0x1a1ee2[_0xd392('0x16')]||0x3;this[_0xd392('0x17')]=_0x1a1ee2['dialAbandonedRetryFrequency']||0x96;this[_0xd392('0x18')]=_0x1a1ee2[_0xd392('0x18')]||0x3;this[_0xd392('0x19')]=_0x1a1ee2[_0xd392('0x19')]||0x96;this[_0xd392('0x1a')]=_0x1a1ee2[_0xd392('0x1a')]||0x3;this[_0xd392('0x1b')]=_0x1a1ee2[_0xd392('0x1b')]||0x96;this[_0xd392('0x1c')]=_0x1a1ee2['dialOrderByScheduledAt']||'DESC';this[_0xd392('0x1d')]=_0x1a1ee2[_0xd392('0x1d')]||undefined;this[_0xd392('0x1e')]=_0x1a1ee2[_0xd392('0x1e')]||undefined;this[_0xd392('0x1f')]=_0x1a1ee2['dialCutDigit']||undefined;this['TrunkBackup']=_0x1a1ee2[_0xd392('0x20')]?_0x1a1ee2[_0xd392('0x20')]:undefined;this['Trunk']=_0x1a1ee2[_0xd392('0x21')]?_0x1a1ee2['Trunk']:undefined;this[_0xd392('0x22')]=_0x1a1ee2[_0xd392('0x22')]?_0x1a1ee2[_0xd392('0x22')]:undefined;this[_0xd392('0x23')]=_0x1a1ee2[_0xd392('0x23')]?_0x1a1ee2[_0xd392('0x23')]:undefined;this[_0xd392('0x24')]=_0x1a1ee2[_0xd392('0x23')]?_0x1a1ee2['SquareProject'][_0xd392('0x0')]:undefined;this['dialAMDActive']=_0x1a1ee2[_0xd392('0x25')]||![];this['dialAMDInitialSilence']=_0x1a1ee2[_0xd392('0x26')];this[_0xd392('0x27')]=_0x1a1ee2['dialAMDGreeting'];this[_0xd392('0x28')]=_0x1a1ee2[_0xd392('0x28')];this[_0xd392('0x29')]=_0x1a1ee2[_0xd392('0x29')];this[_0xd392('0x2a')]=_0x1a1ee2[_0xd392('0x2a')];this['dialAMDBetweenWordsSilence']=_0x1a1ee2[_0xd392('0x2b')];this[_0xd392('0x2c')]=_0x1a1ee2[_0xd392('0x2c')];this[_0xd392('0x2d')]=_0x1a1ee2[_0xd392('0x2d')];this['dialAMDMaximumWordLength']=_0x1a1ee2[_0xd392('0x2e')];}module[_0xd392('0x2f')]=Campaign; \ No newline at end of file +var _0x24a4=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x25d4bc,_0x1e8a86){var _0x418bc0=function(_0x1fe1f5){while(--_0x1fe1f5){_0x25d4bc['push'](_0x25d4bc['shift']());}};_0x418bc0(++_0x1e8a86);}(_0x24a4,0x7e));var _0x424a=function(_0x2f1b28,_0x42e66b){_0x2f1b28=_0x2f1b28-0x0;var _0x279c83=_0x24a4[_0x2f1b28];return _0x279c83;};'use strict';function Campaign(_0x51a8c5){this['id']=_0x51a8c5['id']||0x0;this[_0x424a('0x0')]=_0x51a8c5[_0x424a('0x0')]||'';this[_0x424a('0x1')]=_0x51a8c5[_0x424a('0x1')]||_0x424a('0x2');this[_0x424a('0x3')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x424a('0x4')]=0x0;this[_0x424a('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0x424a('0x6')]=_0x51a8c5[_0x424a('0x6')];this[_0x424a('0x7')]=_0x51a8c5[_0x424a('0x7')];this[_0x424a('0x8')]=_0x51a8c5[_0x424a('0x8')]||null;this[_0x424a('0x9')]=_0x51a8c5[_0x424a('0x9')]?_0x51a8c5[_0x424a('0x9')]:null;this[_0x424a('0xa')]=_0x51a8c5[_0x424a('0xa')];this[_0x424a('0xb')]=_0x51a8c5['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x51a8c5[_0x424a('0xc')]||0x1e;this[_0x424a('0xd')]=_0x51a8c5[_0x424a('0xd')];this[_0x424a('0xe')]=_0x51a8c5[_0x424a('0xe')];this[_0x424a('0xf')]=_0x51a8c5[_0x424a('0xf')];this['dialBusyRetryFrequency']=_0x51a8c5['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x51a8c5['dialNoAnswerMaxRetry'];this[_0x424a('0x10')]=_0x51a8c5['dialNoAnswerRetryFrequency'];this[_0x424a('0x11')]=_0x51a8c5[_0x424a('0x11')];this[_0x424a('0x12')]=_0x51a8c5[_0x424a('0x12')]||0x3;this[_0x424a('0x13')]=_0x51a8c5[_0x424a('0x13')]||0x96;this['dialDropMaxRetry']=_0x51a8c5[_0x424a('0x14')]||0x3;this['dialDropRetryFrequency']=_0x51a8c5[_0x424a('0x15')]||0x96;this['dialAbandonedMaxRetry']=_0x51a8c5[_0x424a('0x16')]||0x3;this[_0x424a('0x17')]=_0x51a8c5[_0x424a('0x17')]||0x96;this['dialMachineMaxRetry']=_0x51a8c5[_0x424a('0x18')]||0x3;this[_0x424a('0x19')]=_0x51a8c5[_0x424a('0x19')]||0x96;this[_0x424a('0x1a')]=_0x51a8c5[_0x424a('0x1a')]||0x3;this[_0x424a('0x1b')]=_0x51a8c5['dialAgentRejectRetryFrequency']||0x96;this[_0x424a('0x1c')]=_0x51a8c5['dialOrderByScheduledAt']||'DESC';this[_0x424a('0x1d')]=_0x51a8c5[_0x424a('0x1d')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x51a8c5[_0x424a('0x1e')]||undefined;this[_0x424a('0x1f')]=_0x51a8c5[_0x424a('0x1f')]||undefined;this[_0x424a('0x20')]=_0x51a8c5[_0x424a('0x20')]?_0x51a8c5[_0x424a('0x20')]:undefined;this['Trunk']=_0x51a8c5[_0x424a('0x21')]?_0x51a8c5[_0x424a('0x21')]:undefined;this[_0x424a('0x22')]=_0x51a8c5[_0x424a('0x22')]?_0x51a8c5[_0x424a('0x22')]:undefined;this['SquareProject']=_0x51a8c5[_0x424a('0x23')]?_0x51a8c5[_0x424a('0x23')]:undefined;this[_0x424a('0x24')]=_0x51a8c5[_0x424a('0x23')]?_0x51a8c5[_0x424a('0x23')][_0x424a('0x0')]:undefined;this[_0x424a('0x25')]=_0x51a8c5[_0x424a('0x25')]||![];this['dialAMDInitialSilence']=_0x51a8c5[_0x424a('0x26')];this[_0x424a('0x27')]=_0x51a8c5['dialAMDGreeting'];this[_0x424a('0x28')]=_0x51a8c5[_0x424a('0x28')];this[_0x424a('0x29')]=_0x51a8c5[_0x424a('0x29')];this[_0x424a('0x2a')]=_0x51a8c5[_0x424a('0x2a')];this[_0x424a('0x2b')]=_0x51a8c5[_0x424a('0x2b')];this[_0x424a('0x2c')]=_0x51a8c5['dialAMDMaximumNumberOfWords'];this[_0x424a('0x2d')]=_0x51a8c5['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x51a8c5[_0x424a('0x2e')];}module[_0x424a('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 1f84a90..90c984e 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 _0x3a15=['disposition','monitor','monitorFilename','queue','mohtime','exports','starttime','destinationchannel','calleridname','connectedlinenum','connectedlinename','uniqueid','answertime','unmanaged','abandoned','lastapplication','duration','billableseconds'];(function(_0x1f042d,_0x244608){var _0x40f8e7=function(_0x1fb32e){while(--_0x1fb32e){_0x1f042d['push'](_0x1f042d['shift']());}};_0x40f8e7(++_0x244608);}(_0x3a15,0xde));var _0x53a1=function(_0x2d323f,_0x231fe6){_0x2d323f=_0x2d323f-0x0;var _0x11e018=_0x3a15[_0x2d323f];return _0x11e018;};'use strict';function Channel(){this[_0x53a1('0x0')]=null;this['channel']='';this[_0x53a1('0x1')]='';this['calleridnum']=0x0;this[_0x53a1('0x2')]='';this[_0x53a1('0x3')]=undefined;this[_0x53a1('0x4')]=undefined;this['accountcode']=0x0;this['context']='';this[_0x53a1('0x5')]=0x0;this['linkedid']=0x0;this['exten']=0x0;this['answered']=![];this[_0x53a1('0x6')]=null;this['endtime']=null;this[_0x53a1('0x7')]=![];this[_0x53a1('0x8')]=![];this[_0x53a1('0x9')]='';this['lastdata']='';this[_0x53a1('0xa')]=0x0;this[_0x53a1('0xb')]=0x0;this['holdtime']=0x0;this['type']=null;this['tag']=null;this[_0x53a1('0xc')]=null;this[_0x53a1('0xd')]=![];this[_0x53a1('0xe')]=null;this[_0x53a1('0xf')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0x53a1('0x10')]=0x0;}module[_0x53a1('0x11')]=Channel; \ No newline at end of file +var _0xc953=['transfercalleridnum','mohtime','starttime','channel','destinationchannel','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','tag','disposition','monitor','monitorFilename','queue','monitors'];(function(_0x26ddda,_0xe2833f){var _0x305dc1=function(_0x59b1a5){while(--_0x59b1a5){_0x26ddda['push'](_0x26ddda['shift']());}};_0x305dc1(++_0xe2833f);}(_0xc953,0x84));var _0x3c95=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0xc953[_0x4d45c1];return _0x244478;};'use strict';function Channel(){this[_0x3c95('0x0')]=null;this[_0x3c95('0x1')]='';this[_0x3c95('0x2')]='';this['calleridnum']=0x0;this['calleridname']='';this[_0x3c95('0x3')]=undefined;this[_0x3c95('0x4')]=undefined;this[_0x3c95('0x5')]=0x0;this[_0x3c95('0x6')]='';this[_0x3c95('0x7')]=0x0;this[_0x3c95('0x8')]=0x0;this[_0x3c95('0x9')]=0x0;this[_0x3c95('0xa')]=![];this['answertime']=null;this['endtime']=null;this[_0x3c95('0xb')]=![];this[_0x3c95('0xc')]=![];this[_0x3c95('0xd')]='';this[_0x3c95('0xe')]='';this[_0x3c95('0xf')]=0x0;this[_0x3c95('0x10')]=0x0;this[_0x3c95('0x11')]=0x0;this['type']=null;this[_0x3c95('0x12')]=null;this[_0x3c95('0x13')]=null;this[_0x3c95('0x14')]=![];this[_0x3c95('0x15')]=null;this[_0x3c95('0x16')]=null;this[_0x3c95('0x17')]=[];this[_0x3c95('0x18')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x3c95('0x19')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index c754b08..cf14dde 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 _0xea31=['serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x13ffc7,_0x5dd1cd){var _0x3186a9=function(_0x4d03aa){while(--_0x4d03aa){_0x13ffc7['push'](_0x13ffc7['shift']());}};_0x3186a9(++_0x5dd1cd);}(_0xea31,0x6b));var _0x1ea3=function(_0x35a53c,_0x4d83c3){_0x35a53c=_0x35a53c-0x0;var _0x432738=_0xea31[_0x35a53c];return _0x432738;};'use strict';function DeskAccount(_0x496bb7){this['id']=_0x496bb7['id']||0x0;this['name']=_0x496bb7[_0x1ea3('0x0')]||'';this[_0x1ea3('0x1')]=_0x496bb7[_0x1ea3('0x1')]||'';this[_0x1ea3('0x2')]=_0x496bb7[_0x1ea3('0x2')]||'';this[_0x1ea3('0x3')]=_0x496bb7[_0x1ea3('0x3')]||'';this['password']=_0x496bb7[_0x1ea3('0x4')]||'';this[_0x1ea3('0x5')]=_0x496bb7[_0x1ea3('0x5')]||'';this[_0x1ea3('0x6')]=_0x496bb7[_0x1ea3('0x6')]||'';this['token']=_0x496bb7[_0x1ea3('0x7')]||'';this[_0x1ea3('0x8')]=_0x496bb7[_0x1ea3('0x8')]||'';this[_0x1ea3('0x9')]=_0x496bb7[_0x1ea3('0x9')]||'';this[_0x1ea3('0xa')]=_0x496bb7['serverUrl']||'';this[_0x1ea3('0xb')]=_0x496bb7[_0x1ea3('0xb')]||{};}module[_0x1ea3('0xc')]=DeskAccount; \ No newline at end of file +var _0x5636=['token','tokenSecret','type','serverUrl','Configurations','exports','name','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x58d6f3,_0x5716d6){var _0x1f939f=function(_0x515ca2){while(--_0x515ca2){_0x58d6f3['push'](_0x58d6f3['shift']());}};_0x1f939f(++_0x5716d6);}(_0x5636,0x102));var _0x6563=function(_0x43ec0a,_0x301287){_0x43ec0a=_0x43ec0a-0x0;var _0x4cc889=_0x5636[_0x43ec0a];return _0x4cc889;};'use strict';function DeskAccount(_0x4f6f35){this['id']=_0x4f6f35['id']||0x0;this[_0x6563('0x0')]=_0x4f6f35['name']||'';this['username']=_0x4f6f35['username']||'';this[_0x6563('0x1')]=_0x4f6f35[_0x6563('0x1')]||'';this[_0x6563('0x2')]=_0x4f6f35['authType']||'';this[_0x6563('0x3')]=_0x4f6f35[_0x6563('0x3')]||'';this[_0x6563('0x4')]=_0x4f6f35[_0x6563('0x4')]||'';this[_0x6563('0x5')]=_0x4f6f35[_0x6563('0x5')]||'';this[_0x6563('0x6')]=_0x4f6f35[_0x6563('0x6')]||'';this[_0x6563('0x7')]=_0x4f6f35[_0x6563('0x7')]||'';this[_0x6563('0x8')]=_0x4f6f35[_0x6563('0x8')]||'';this[_0x6563('0x9')]=_0x4f6f35['serverUrl']||'';this['Configurations']=_0x4f6f35[_0x6563('0xa')]||{};}module[_0x6563('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 4412a00..95030e9 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 _0x1f41=['username','password','remoteUri','clientId','clientSecret','serverUrl','Configurations','name'];(function(_0x59326b,_0x3e2275){var _0x853e93=function(_0xdffd33){while(--_0xdffd33){_0x59326b['push'](_0x59326b['shift']());}};_0x853e93(++_0x3e2275);}(_0x1f41,0xcf));var _0x11f4=function(_0x38268e,_0x3ce233){_0x38268e=_0x38268e-0x0;var _0x58470f=_0x1f41[_0x38268e];return _0x58470f;};'use strict';function Dynamics365Account(_0x27eecf){this['id']=_0x27eecf['id']||0x0;this[_0x11f4('0x0')]=_0x27eecf[_0x11f4('0x0')]||'';this[_0x11f4('0x1')]=_0x27eecf[_0x11f4('0x1')]||'';this[_0x11f4('0x2')]=_0x27eecf[_0x11f4('0x2')]||'';this[_0x11f4('0x3')]=_0x27eecf['remoteUri']||'';this['tenantId']=_0x27eecf['tenantId']||'';this[_0x11f4('0x4')]=_0x27eecf['clientId']||'';this['clientSecret']=_0x27eecf[_0x11f4('0x5')]||{};this[_0x11f4('0x6')]=_0x27eecf[_0x11f4('0x6')]||'';this[_0x11f4('0x7')]=_0x27eecf['Configurations']||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x63be=['clientId','clientSecret','serverUrl','exports','name','username','remoteUri','tenantId'];(function(_0xdb81f,_0x30917a){var _0x528e3d=function(_0x552bcf){while(--_0x552bcf){_0xdb81f['push'](_0xdb81f['shift']());}};_0x528e3d(++_0x30917a);}(_0x63be,0x1ac));var _0xe63b=function(_0x3af00f,_0x26d979){_0x3af00f=_0x3af00f-0x0;var _0x29c540=_0x63be[_0x3af00f];return _0x29c540;};'use strict';function Dynamics365Account(_0x1dbf5e){this['id']=_0x1dbf5e['id']||0x0;this[_0xe63b('0x0')]=_0x1dbf5e['name']||'';this[_0xe63b('0x1')]=_0x1dbf5e[_0xe63b('0x1')]||'';this['password']=_0x1dbf5e['password']||'';this[_0xe63b('0x2')]=_0x1dbf5e[_0xe63b('0x2')]||'';this[_0xe63b('0x3')]=_0x1dbf5e[_0xe63b('0x3')]||'';this[_0xe63b('0x4')]=_0x1dbf5e[_0xe63b('0x4')]||'';this[_0xe63b('0x5')]=_0x1dbf5e['clientSecret']||{};this['serverUrl']=_0x1dbf5e[_0xe63b('0x6')]||'';this['Configurations']=_0x1dbf5e['Configurations']||{};}module[_0xe63b('0x7')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index f917758..ee615ae 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 _0x031e=['ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description'];(function(_0x55fdf1,_0x5b7b70){var _0x56b866=function(_0x124968){while(--_0x124968){_0x55fdf1['push'](_0x55fdf1['shift']());}};_0x56b866(++_0x5b7b70);}(_0x031e,0x75));var _0xe031=function(_0x2e41e2,_0x4e7250){_0x2e41e2=_0x2e41e2-0x0;var _0x2844d6=_0x031e[_0x2e41e2];return _0x2844d6;};'use strict';function FaxAccount(_0x581b65){this['id']=_0x581b65['id']||0x0;this[_0xe031('0x0')]=_0x581b65[_0xe031('0x0')]||'';this[_0xe031('0x1')]=_0x581b65[_0xe031('0x1')];this['ecm']=_0x581b65[_0xe031('0x2')];this[_0xe031('0x3')]=_0x581b65[_0xe031('0x3')];this[_0xe031('0x4')]=_0x581b65[_0xe031('0x4')];this[_0xe031('0x5')]=_0x581b65['minrate']||0x960;this['maxrate']=_0x581b65[_0xe031('0x6')]||0x3840;this['modem']=_0x581b65[_0xe031('0x7')]||_0xe031('0x8');this[_0xe031('0x9')]=_0x581b65['gateway']||'no';this[_0xe031('0xa')]=_0x581b65[_0xe031('0xa')]||'no';this[_0xe031('0xb')]=_0x581b65[_0xe031('0xb')]||0x1388;this[_0xe031('0xc')]=_0x581b65[_0xe031('0xc')]||'SIP';this[_0xe031('0xd')]=_0x581b65[_0xe031('0xd')]?_0x581b65[_0xe031('0xd')]:undefined;this['ListId']=_0x581b65[_0xe031('0xe')];this[_0xe031('0xf')]=_0x581b65[_0xe031('0xf')];}module[_0xe031('0x10')]=FaxAccount; \ No newline at end of file +var _0xdf93=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','v17,v27,v29'];(function(_0x37624c,_0x163888){var _0x316961=function(_0x1a878b){while(--_0x1a878b){_0x37624c['push'](_0x37624c['shift']());}};_0x316961(++_0x163888);}(_0xdf93,0x13b));var _0x3df9=function(_0x484f18,_0x48741e){_0x484f18=_0x484f18-0x0;var _0x4e0329=_0xdf93[_0x484f18];return _0x4e0329;};'use strict';function FaxAccount(_0x2a56c7){this['id']=_0x2a56c7['id']||0x0;this[_0x3df9('0x0')]=_0x2a56c7[_0x3df9('0x0')]||'';this['description']=_0x2a56c7[_0x3df9('0x1')];this[_0x3df9('0x2')]=_0x2a56c7['ecm'];this[_0x3df9('0x3')]=_0x2a56c7[_0x3df9('0x3')];this[_0x3df9('0x4')]=_0x2a56c7[_0x3df9('0x4')];this[_0x3df9('0x5')]=_0x2a56c7[_0x3df9('0x5')]||0x960;this['maxrate']=_0x2a56c7[_0x3df9('0x6')]||0x3840;this['modem']=_0x2a56c7['modem']||_0x3df9('0x7');this[_0x3df9('0x8')]=_0x2a56c7[_0x3df9('0x8')]||'no';this['faxdetect']=_0x2a56c7[_0x3df9('0x9')]||'no';this[_0x3df9('0xa')]=_0x2a56c7[_0x3df9('0xa')]||0x1388;this[_0x3df9('0xb')]=_0x2a56c7[_0x3df9('0xb')]||_0x3df9('0xc');this['Trunk']=_0x2a56c7['Trunk']?_0x2a56c7[_0x3df9('0xd')]:undefined;this[_0x3df9('0xe')]=_0x2a56c7[_0x3df9('0xe')];this[_0x3df9('0xf')]=_0x2a56c7['key'];}module[_0x3df9('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index fff4543..2bf08ca 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 _0x8652=['remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x8652,0x1f0));var _0x2865=function(_0x434903,_0x2bae84){_0x434903=_0x434903-0x0;var _0x31021e=_0x8652[_0x434903];return _0x31021e;};'use strict';function FreshdeskAccount(_0x194b7a){this['id']=_0x194b7a['id']||0x0;this['name']=_0x194b7a[_0x2865('0x0')]||'';this[_0x2865('0x1')]=_0x194b7a['username']||'';this['apiKey']=_0x194b7a['token']||'';this[_0x2865('0x2')]=_0x194b7a[_0x2865('0x2')]||'';this['serverUrl']=_0x194b7a[_0x2865('0x3')]||'';this[_0x2865('0x4')]=_0x194b7a[_0x2865('0x4')]||{};}module[_0x2865('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0xe7fa=['remoteUri','serverUrl','Configurations','name','username','token'];(function(_0x587450,_0x18c8e4){var _0x4d2731=function(_0x5e28d0){while(--_0x5e28d0){_0x587450['push'](_0x587450['shift']());}};_0x4d2731(++_0x18c8e4);}(_0xe7fa,0x1ef));var _0xae7f=function(_0x4cddc7,_0x529842){_0x4cddc7=_0x4cddc7-0x0;var _0x3a7ace=_0xe7fa[_0x4cddc7];return _0x3a7ace;};'use strict';function FreshdeskAccount(_0x410e56){this['id']=_0x410e56['id']||0x0;this[_0xae7f('0x0')]=_0x410e56['name']||'';this[_0xae7f('0x1')]=_0x410e56[_0xae7f('0x1')]||'';this['apiKey']=_0x410e56[_0xae7f('0x2')]||'';this[_0xae7f('0x3')]=_0x410e56[_0xae7f('0x3')]||'';this[_0xae7f('0x4')]=_0x410e56['serverUrl']||'';this[_0xae7f('0x5')]=_0x410e56[_0xae7f('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 8e5d2b6..addd845 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 _0xec1b=['remoteUri','serverUrl','Configurations','exports','name','username','token'];(function(_0x571d41,_0x43cd91){var _0x175b40=function(_0x3d9cbd){while(--_0x3d9cbd){_0x571d41['push'](_0x571d41['shift']());}};_0x175b40(++_0x43cd91);}(_0xec1b,0xe4));var _0xbec1=function(_0x5ec3e2,_0x5294df){_0x5ec3e2=_0x5ec3e2-0x0;var _0x152654=_0xec1b[_0x5ec3e2];return _0x152654;};'use strict';function FreshsalesAccount(_0x3c6aa3){this['id']=_0x3c6aa3['id']||0x0;this[_0xbec1('0x0')]=_0x3c6aa3[_0xbec1('0x0')]||'';this[_0xbec1('0x1')]=_0x3c6aa3[_0xbec1('0x1')]||'';this['apiKey']=_0x3c6aa3[_0xbec1('0x2')]||'';this['remoteUri']=_0x3c6aa3[_0xbec1('0x3')]||'';this[_0xbec1('0x4')]=_0x3c6aa3[_0xbec1('0x4')]||'';this[_0xbec1('0x5')]=_0x3c6aa3['Configurations']||{};}module[_0xbec1('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x59a8=['Configurations','exports','name','username','remoteUri','serverUrl'];(function(_0x43de1b,_0x12c194){var _0x183c90=function(_0x1fc8e7){while(--_0x1fc8e7){_0x43de1b['push'](_0x43de1b['shift']());}};_0x183c90(++_0x12c194);}(_0x59a8,0x98));var _0x859a=function(_0x1464a4,_0x5c0f8f){_0x1464a4=_0x1464a4-0x0;var _0x3660f8=_0x59a8[_0x1464a4];return _0x3660f8;};'use strict';function FreshsalesAccount(_0x4ca203){this['id']=_0x4ca203['id']||0x0;this[_0x859a('0x0')]=_0x4ca203[_0x859a('0x0')]||'';this[_0x859a('0x1')]=_0x4ca203[_0x859a('0x1')]||'';this['apiKey']=_0x4ca203['token']||'';this[_0x859a('0x2')]=_0x4ca203[_0x859a('0x2')]||'';this[_0x859a('0x3')]=_0x4ca203['serverUrl']||'';this[_0x859a('0x4')]=_0x4ca203[_0x859a('0x4')]||{};}module[_0x859a('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index f0ea7db..2457921 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 _0xe28d=['accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinenum'];(function(_0x260e07,_0x2dd0e4){var _0x28ba4e=function(_0x237146){while(--_0x237146){_0x260e07['push'](_0x260e07['shift']());}};_0x28ba4e(++_0x2dd0e4);}(_0xe28d,0x189));var _0xde28=function(_0x33ceeb,_0x58b863){_0x33ceeb=_0x33ceeb-0x0;var _0x5b6556=_0xe28d[_0x33ceeb];return _0x5b6556;};'use strict';function QueueReport(){this[_0xde28('0x0')]=_0xde28('0x1');this[_0xde28('0x2')]='';this[_0xde28('0x3')]='';this[_0xde28('0x4')]='';this['queue']='';this[_0xde28('0x5')]=null;this[_0xde28('0x6')]=null;this['position']=0x1;this[_0xde28('0x7')]=0x1;this[_0xde28('0x8')]=![];this['queuecallerabandonAt']=null;this[_0xde28('0x9')]=![];this[_0xde28('0xa')]=null;this[_0xde28('0xb')]=![];this['queuecallerexitAt']=null;this[_0xde28('0xc')]=0x1;this[_0xde28('0xd')]='';this[_0xde28('0xe')]='';this['connectedlinename']='';this[_0xde28('0xf')]='';this[_0xde28('0x10')]='';this[_0xde28('0x11')]='';this[_0xde28('0x12')]='';this[_0xde28('0x13')]=0x0;this[_0xde28('0x14')]=![];this[_0xde28('0x15')]='';this[_0xde28('0x16')]=0x0;this['variables']={};}module[_0xde28('0x17')]=QueueReport; \ No newline at end of file +var _0x2de0=['holdtime','assigned','lastAssignedTo','mohtime','type','inbound','uniqueid','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','exten'];(function(_0x45dd4a,_0x5541ac){var _0x5c8d80=function(_0x521e21){while(--_0x521e21){_0x45dd4a['push'](_0x45dd4a['shift']());}};_0x5c8d80(++_0x5541ac);}(_0x2de0,0x9e));var _0x02de=function(_0x464f13,_0x5c1558){_0x464f13=_0x464f13-0x0;var _0x4535ca=_0x2de0[_0x464f13];return _0x4535ca;};'use strict';function QueueReport(){this[_0x02de('0x0')]=_0x02de('0x1');this[_0x02de('0x2')]='';this[_0x02de('0x3')]='';this[_0x02de('0x4')]='';this['queue']='';this[_0x02de('0x5')]=null;this[_0x02de('0x6')]=null;this[_0x02de('0x7')]=0x1;this[_0x02de('0x8')]=0x1;this[_0x02de('0x9')]=![];this[_0x02de('0xa')]=null;this['queuecallercomplete']=![];this[_0x02de('0xb')]=null;this['queuecallerexit']=![];this[_0x02de('0xc')]=null;this[_0x02de('0xd')]=0x1;this[_0x02de('0xe')]='';this[_0x02de('0xf')]='';this[_0x02de('0x10')]='';this['accountcode']='';this['context']='';this[_0x02de('0x11')]='';this['priority']='';this[_0x02de('0x12')]=0x0;this[_0x02de('0x13')]=![];this[_0x02de('0x14')]='';this[_0x02de('0x15')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 9444b16..90e5399 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 _0xf119=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x10b45d,_0x50669c){var _0x7c41b0=function(_0x20135a){while(--_0x20135a){_0x10b45d['push'](_0x10b45d['shift']());}};_0x7c41b0(++_0x50669c);}(_0xf119,0x7f));var _0x9f11=function(_0x1aa16a,_0x326951){_0x1aa16a=_0x1aa16a-0x0;var _0x99bb87=_0xf119[_0x1aa16a];return _0x99bb87;};'use strict';function SalesforceAccount(_0x224405){this['id']=_0x224405['id']||0x0;this[_0x9f11('0x0')]=_0x224405[_0x9f11('0x0')]||'';this[_0x9f11('0x1')]=_0x224405[_0x9f11('0x1')]||'';this[_0x9f11('0x2')]=_0x224405[_0x9f11('0x2')]||'';this['password']=_0x224405[_0x9f11('0x3')]||'';this['clientId']=_0x224405[_0x9f11('0x4')]||'';this[_0x9f11('0x5')]=_0x224405[_0x9f11('0x5')]||'';this[_0x9f11('0x6')]=_0x224405['securityToken']||'';this[_0x9f11('0x7')]=_0x224405[_0x9f11('0x7')]||_0x9f11('0x8');this['serverUrl']=_0x224405[_0x9f11('0x9')]||'';this[_0x9f11('0xa')]=_0x224405['Configurations']||{};}module[_0x9f11('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x2093=['type','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x49a5d6,_0x52c2d2){var _0x18d885=function(_0x55f1e3){while(--_0x55f1e3){_0x49a5d6['push'](_0x49a5d6['shift']());}};_0x18d885(++_0x52c2d2);}(_0x2093,0x157));var _0x3209=function(_0x12012d,_0x46e1f6){_0x12012d=_0x12012d-0x0;var _0x2ccaf1=_0x2093[_0x12012d];return _0x2ccaf1;};'use strict';function SalesforceAccount(_0x50e113){this['id']=_0x50e113['id']||0x0;this['name']=_0x50e113[_0x3209('0x0')]||'';this[_0x3209('0x1')]=_0x50e113[_0x3209('0x1')]||'';this[_0x3209('0x2')]=_0x50e113[_0x3209('0x2')]||'';this[_0x3209('0x3')]=_0x50e113[_0x3209('0x3')]||'';this[_0x3209('0x4')]=_0x50e113[_0x3209('0x4')]||'';this[_0x3209('0x5')]=_0x50e113['clientSecret']||'';this[_0x3209('0x6')]=_0x50e113['securityToken']||'';this[_0x3209('0x7')]=_0x50e113['type']||'integrationTab';this[_0x3209('0x8')]=_0x50e113[_0x3209('0x8')]||'';this[_0x3209('0x9')]=_0x50e113['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index db33b16..483e0fb 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 _0x67db=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x548961,_0x5a13d0){var _0x31593d=function(_0x267497){while(--_0x267497){_0x548961['push'](_0x548961['shift']());}};_0x31593d(++_0x5a13d0);}(_0x67db,0x7c));var _0xb67d=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x67db[_0x36eaaa];return _0x461349;};'use strict';function ServicenowAccount(_0xb2a0d8){this['id']=_0xb2a0d8['id']||0x0;this[_0xb67d('0x0')]=_0xb2a0d8[_0xb67d('0x0')]||'';this[_0xb67d('0x1')]=_0xb2a0d8['username']||'';this[_0xb67d('0x2')]=_0xb2a0d8['password']||'';this[_0xb67d('0x3')]=_0xb2a0d8['remoteUri']||'';this[_0xb67d('0x4')]=_0xb2a0d8['serverUrl']||'';this[_0xb67d('0x5')]=_0xb2a0d8['Configurations']||{};}module[_0xb67d('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x525d=['Configurations','username','password','serverUrl'];(function(_0x32310d,_0xceb19d){var _0x88e822=function(_0x195d4e){while(--_0x195d4e){_0x32310d['push'](_0x32310d['shift']());}};_0x88e822(++_0xceb19d);}(_0x525d,0x1dd));var _0xd525=function(_0xc8478d,_0xd8f0ee){_0xc8478d=_0xc8478d-0x0;var _0x1c64a9=_0x525d[_0xc8478d];return _0x1c64a9;};'use strict';function ServicenowAccount(_0x41fc15){this['id']=_0x41fc15['id']||0x0;this['name']=_0x41fc15['name']||'';this[_0xd525('0x0')]=_0x41fc15['username']||'';this[_0xd525('0x1')]=_0x41fc15['password']||'';this['remoteUri']=_0x41fc15['remoteUri']||'';this[_0xd525('0x2')]=_0x41fc15['serverUrl']||'';this['Configurations']=_0x41fc15[_0xd525('0x3')]||{};}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 72492ea..bd0b91e 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 _0x2430=['username','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x3c769d,_0x215272){var _0x1c19e2=function(_0x3ddc0d){while(--_0x3ddc0d){_0x3c769d['push'](_0x3c769d['shift']());}};_0x1c19e2(++_0x215272);}(_0x2430,0x107));var _0x0243=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x2430[_0x4e6ae6];return _0x23c108;};'use strict';function SugarcrmAccount(_0x51c470){this['id']=_0x51c470['id']||0x0;this[_0x0243('0x0')]=_0x51c470[_0x0243('0x0')]||'';this['username']=_0x51c470[_0x0243('0x1')]||'';this['password']=_0x51c470['password']||'';this['remoteUri']=_0x51c470[_0x0243('0x2')]||'';this[_0x0243('0x3')]=_0x51c470[_0x0243('0x3')]||'';this['Configurations']=_0x51c470[_0x0243('0x4')]||{};}module[_0x0243('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x882a=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x322d88,_0x55f9f3){var _0x1ed9ab=function(_0x334304){while(--_0x334304){_0x322d88['push'](_0x322d88['shift']());}};_0x1ed9ab(++_0x55f9f3);}(_0x882a,0xda));var _0xa882=function(_0x1d166e,_0x421703){_0x1d166e=_0x1d166e-0x0;var _0x5b10b6=_0x882a[_0x1d166e];return _0x5b10b6;};'use strict';function SugarcrmAccount(_0x5d52dc){this['id']=_0x5d52dc['id']||0x0;this[_0xa882('0x0')]=_0x5d52dc[_0xa882('0x0')]||'';this['username']=_0x5d52dc[_0xa882('0x1')]||'';this[_0xa882('0x2')]=_0x5d52dc[_0xa882('0x2')]||'';this[_0xa882('0x3')]=_0x5d52dc[_0xa882('0x3')]||'';this[_0xa882('0x4')]=_0x5d52dc[_0xa882('0x4')]||'';this[_0xa882('0x5')]=_0x5d52dc[_0xa882('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 a74f12c..354f316 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 _0x49f1=['unknown','stateTime','status','address','exports','name','accountcode','state'];(function(_0x201e94,_0x551135){var _0xe50afd=function(_0x1e9a2e){while(--_0x1e9a2e){_0x201e94['push'](_0x201e94['shift']());}};_0xe50afd(++_0x551135);}(_0x49f1,0x7d));var _0x149f=function(_0x46460e,_0x4a6c5e){_0x46460e=_0x46460e-0x0;var _0x4c36a3=_0x49f1[_0x46460e];return _0x4c36a3;};'use strict';function Telephone(_0x46ad4b){this['id']=_0x46ad4b['id']||0x0;this[_0x149f('0x0')]=_0x46ad4b[_0x149f('0x0')]||'';this[_0x149f('0x1')]=_0x46ad4b[_0x149f('0x1')]||'';this[_0x149f('0x2')]=_0x149f('0x3');this[_0x149f('0x4')]=0x0;this[_0x149f('0x5')]=_0x149f('0x3');this[_0x149f('0x6')]='';}module[_0x149f('0x7')]=Telephone; \ No newline at end of file +var _0xafbc=['state','unknown','stateTime','address','exports','name','accountcode'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xafbc,0x98));var _0xcafb=function(_0x24c387,_0x21ab0a){_0x24c387=_0x24c387-0x0;var _0x40fd0c=_0xafbc[_0x24c387];return _0x40fd0c;};'use strict';function Telephone(_0x47e53d){this['id']=_0x47e53d['id']||0x0;this[_0xcafb('0x0')]=_0x47e53d['name']||'';this[_0xcafb('0x1')]=_0x47e53d[_0xcafb('0x1')]||'';this[_0xcafb('0x2')]=_0xcafb('0x3');this[_0xcafb('0x4')]=0x0;this['status']=_0xcafb('0x3');this[_0xcafb('0x5')]='';}module[_0xcafb('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 3cad6d6..0d2c723 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 _0x83b1=['html','exports','name'];(function(_0x3f3fba,_0x2fbaf9){var _0x1defc0=function(_0x21539d){while(--_0x21539d){_0x3f3fba['push'](_0x3f3fba['shift']());}};_0x1defc0(++_0x2fbaf9);}(_0x83b1,0x128));var _0x183b=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x83b1[_0x56482c];return _0x5aae7a;};'use strict';function template(_0x51e1c2){this['id']=_0x51e1c2['id']||0x0;this[_0x183b('0x0')]=_0x51e1c2[_0x183b('0x0')]||'';this[_0x183b('0x1')]=_0x51e1c2[_0x183b('0x1')]||'';}module[_0x183b('0x2')]=template; \ No newline at end of file +var _0xba82=['html','exports','name'];(function(_0x4df6cd,_0x1fbbb4){var _0x24816a=function(_0x547ee1){while(--_0x547ee1){_0x4df6cd['push'](_0x4df6cd['shift']());}};_0x24816a(++_0x1fbbb4);}(_0xba82,0x101));var _0x2ba8=function(_0x3a44e5,_0x3b7ff4){_0x3a44e5=_0x3a44e5-0x0;var _0x58654f=_0xba82[_0x3a44e5];return _0x58654f;};'use strict';function template(_0x515827){this['id']=_0x515827['id']||0x0;this[_0x2ba8('0x0')]=_0x515827[_0x2ba8('0x0')]||'';this[_0x2ba8('0x1')]=_0x515827[_0x2ba8('0x1')]||'';}module[_0x2ba8('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 fcee8eb..2fb75d1 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 _0x9957=['AnyConditions','Actions','exports','name','channel','voice','status','AllConditions'];(function(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';function Trigger(_0x202794){this['id']=_0x202794['id']||0x0;this[_0x7995('0x0')]=_0x202794[_0x7995('0x0')]||'';this[_0x7995('0x1')]=_0x202794['channel']||_0x7995('0x2');this[_0x7995('0x3')]=_0x202794[_0x7995('0x3')]||![];this[_0x7995('0x4')]=_0x202794['AllConditions']||[];this[_0x7995('0x5')]=_0x202794[_0x7995('0x5')]||[];this[_0x7995('0x6')]=_0x202794[_0x7995('0x6')]||[];}module[_0x7995('0x7')]=Trigger; \ No newline at end of file +var _0x9957=['AnyConditions','Actions','exports','name','channel','voice','status','AllConditions'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';function Trigger(_0x202794){this['id']=_0x202794['id']||0x0;this[_0x7995('0x0')]=_0x202794[_0x7995('0x0')]||'';this[_0x7995('0x1')]=_0x202794['channel']||_0x7995('0x2');this[_0x7995('0x3')]=_0x202794[_0x7995('0x3')]||![];this[_0x7995('0x4')]=_0x202794['AllConditions']||[];this[_0x7995('0x5')]=_0x202794[_0x7995('0x5')]||[];this[_0x7995('0x6')]=_0x202794[_0x7995('0x6')]||[];}module[_0x7995('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index fbabf77..467f97d 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 _0x81af=['domain','domainport','refresh','stateRegistry','registrationtime','address','exports','name','stateTime','status','unknown','registry','indexOf','split','port'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x81af,0x106));var _0xf81a=function(_0x3bb115,_0x395382){_0x3bb115=_0x3bb115-0x0;var _0x5bb883=_0x81af[_0x3bb115];return _0x5bb883;};'use strict';function Trunk(_0x5408ff){this['id']=_0x5408ff['id']||0x0;this['active']=_0x5408ff['active']||![];this[_0xf81a('0x0')]=_0x5408ff[_0xf81a('0x0')]||'';this['state']='unknown';this[_0xf81a('0x1')]=0x0;this[_0xf81a('0x2')]=_0xf81a('0x3');this[_0xf81a('0x4')]=_0x5408ff[_0xf81a('0x4')]&&_0x5408ff[_0xf81a('0x4')][_0xf81a('0x5')](':')?_0x5408ff[_0xf81a('0x4')][_0xf81a('0x6')](':')[0x0]:'';this['host']='';this[_0xf81a('0x7')]='';this[_0xf81a('0x8')]='';this[_0xf81a('0x9')]='';this[_0xf81a('0xa')]='';this[_0xf81a('0xb')]=_0xf81a('0x3');this[_0xf81a('0xc')]='';this[_0xf81a('0xd')]='';}module[_0xf81a('0xe')]=Trunk; \ No newline at end of file +var _0xd71d=['exports','active','name','unknown','stateTime','status','registry','split','host','port','domainport','refresh','stateRegistry','registrationtime'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xd71d,0x1a5));var _0xdd71=function(_0x81e39d,_0x4c3934){_0x81e39d=_0x81e39d-0x0;var _0x548fbb=_0xd71d[_0x81e39d];return _0x548fbb;};'use strict';function Trunk(_0xaf57db){this['id']=_0xaf57db['id']||0x0;this[_0xdd71('0x0')]=_0xaf57db[_0xdd71('0x0')]||![];this[_0xdd71('0x1')]=_0xaf57db[_0xdd71('0x1')]||'';this['state']=_0xdd71('0x2');this[_0xdd71('0x3')]=0x0;this[_0xdd71('0x4')]='unknown';this[_0xdd71('0x5')]=_0xaf57db[_0xdd71('0x5')]&&_0xaf57db[_0xdd71('0x5')]['indexOf'](':')?_0xaf57db[_0xdd71('0x5')][_0xdd71('0x6')](':')[0x0]:'';this[_0xdd71('0x7')]='';this[_0xdd71('0x8')]='';this['domain']='';this[_0xdd71('0x9')]='';this[_0xdd71('0xa')]='';this[_0xdd71('0xb')]=_0xdd71('0x2');this[_0xdd71('0xc')]='';this['address']='';}module[_0xdd71('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 4a39e89..3428567 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 _0xab3f=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x27e793,_0x5de383){var _0x1e30cd=function(_0x4709cc){while(--_0x4709cc){_0x27e793['push'](_0x27e793['shift']());}};_0x1e30cd(++_0x5de383);}(_0xab3f,0x17e));var _0xfab3=function(_0xb6f28c,_0x57529c){_0xb6f28c=_0xb6f28c-0x0;var _0x2f03ab=_0xab3f[_0xb6f28c];return _0x2f03ab;};'use strict';function voiceExtension(_0x1e5ad2){this['id']=_0x1e5ad2['id']||0x0;this[_0xfab3('0x0')]=_0x1e5ad2[_0xfab3('0x0')]||'';this[_0xfab3('0x1')]=_0x1e5ad2['recordingFormat']||_0xfab3('0x2');this['mandatoryDisposition']=_0x1e5ad2[_0xfab3('0x3')]||![];}module[_0xfab3('0x4')]=voiceExtension; \ No newline at end of file +var _0x41af=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x294fb8,_0x1c23cc){var _0x46bef4=function(_0x42e818){while(--_0x42e818){_0x294fb8['push'](_0x294fb8['shift']());}};_0x46bef4(++_0x1c23cc);}(_0x41af,0x104));var _0xf41a=function(_0x271f37,_0xd52fa4){_0x271f37=_0x271f37-0x0;var _0x5c50c3=_0x41af[_0x271f37];return _0x5c50c3;};'use strict';function voiceExtension(_0x78661c){this['id']=_0x78661c['id']||0x0;this[_0xf41a('0x0')]=_0x78661c['exten']||'';this[_0xf41a('0x1')]=_0x78661c[_0xf41a('0x1')]||_0xf41a('0x2');this['mandatoryDisposition']=_0x78661c[_0xf41a('0x3')]||![];}module[_0xf41a('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 49b702e..9f9e68f 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 _0x27e2=['predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','monitor_format','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','wav49','gsm','rrmemory','roundrobin','name','type','inbound','waiting','total','answered','sumDuration','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x27e2,0x17a));var _0x227e=function(_0x501f84,_0x291f25){_0x501f84=_0x501f84-0x0;var _0x2c6649=_0x27e2[_0x501f84];return _0x2c6649;};'use strict';var statusDesc=[_0x227e('0x0'),_0x227e('0x1'),_0x227e('0x2'),_0x227e('0x3'),_0x227e('0x4'),_0x227e('0x5'),_0x227e('0x6'),'ringinuse','onhold'];var monitorFormat={'wav':'wav','wav49':_0x227e('0x7'),'gsm':_0x227e('0x8')};var strategy={'rrmemory':_0x227e('0x9'),'roundrobin':_0x227e('0xa')};function VoiceQueue(_0x2374b6){this['id']=_0x2374b6['id']||0x0;this[_0x227e('0xb')]=_0x2374b6[_0x227e('0xb')]||'';this['monitor_format']=_0x2374b6['monitor_format']||'';this[_0x227e('0xc')]=_0x2374b6[_0x227e('0xc')]||_0x227e('0xd');this[_0x227e('0xe')]=0x0;this['talking']=0x0;this[_0x227e('0xf')]=0x0;this[_0x227e('0x10')]=0x0;this[_0x227e('0x11')]=0x0;this['sumHoldTime']=0x0;this[_0x227e('0x12')]=0x0;this['unmanaged']=0x0;this[_0x227e('0x13')]=0x0;this[_0x227e('0x14')]=0x0;this[_0x227e('0x15')]=0x0;this[_0x227e('0x16')]=_0x2374b6[_0x227e('0x16')]||![];this[_0x227e('0x17')]=_0x2374b6[_0x227e('0x17')]||0xa;this[_0x227e('0x18')]=_0x2374b6[_0x227e('0x18')]||'no';this[_0x227e('0x19')]=!![];this[_0x227e('0x1a')]='';this[_0x227e('0x1b')]=0x0;this[_0x227e('0x1c')]=0x0;this[_0x227e('0x1d')]=_0x2374b6[_0x227e('0x1d')]||null;this['dialGlobalInterval']=_0x2374b6[_0x227e('0x1e')]?_0x2374b6[_0x227e('0x1e')]:null;this[_0x227e('0x1f')]=_0x2374b6[_0x227e('0x1f')];this[_0x227e('0x20')]=_0x2374b6['dialMethod']||_0x227e('0x21');this[_0x227e('0x22')]=_0x2374b6[_0x227e('0x22')]||0x0;this['dialLimitQueue']=_0x2374b6[_0x227e('0x23')]||0x0;this[_0x227e('0x24')]=_0x2374b6[_0x227e('0x24')]||0x1;this[_0x227e('0x25')]=_0x2374b6['dialPredictiveOptimization']||_0x227e('0x26');this[_0x227e('0x27')]=_0x2374b6[_0x227e('0x27')]||0.03;this[_0x227e('0x28')]=_0x2374b6['dialPredictiveInterval']||0x258;this[_0x227e('0x29')]=_0x2374b6['dialOriginateCallerIdName']||_0x227e('0x2a');this[_0x227e('0x2b')]=_0x2374b6[_0x227e('0x2b')]||_0x227e('0x2a');this[_0x227e('0x2c')]=_0x2374b6[_0x227e('0x2c')]||0x1e;this[_0x227e('0x2d')]=_0x2374b6[_0x227e('0x2d')]||'tTxX';this['dialQueueTimeout']=_0x2374b6[_0x227e('0x2e')]||0x3;this[_0x227e('0x2f')]=_0x2374b6[_0x227e('0x2f')]||undefined;this['dialCongestionMaxRetry']=_0x2374b6[_0x227e('0x30')]||0x3;this[_0x227e('0x31')]=_0x2374b6['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0x2374b6['dialBusyMaxRetry']||0x3;this[_0x227e('0x32')]=_0x2374b6[_0x227e('0x32')]||0x96;this['dialNoAnswerMaxRetry']=_0x2374b6['dialNoAnswerMaxRetry']||0x3;this[_0x227e('0x33')]=_0x2374b6['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x2374b6[_0x227e('0x34')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x2374b6[_0x227e('0x35')]||0x96;this['dialDropMaxRetry']=_0x2374b6[_0x227e('0x36')]||0x3;this[_0x227e('0x37')]=_0x2374b6[_0x227e('0x37')]||0x96;this[_0x227e('0x38')]=_0x2374b6[_0x227e('0x38')]||0x3;this[_0x227e('0x39')]=_0x2374b6['dialAbandonedRetryFrequency']||0x96;this[_0x227e('0x3a')]=_0x2374b6[_0x227e('0x3a')]||0x3;this[_0x227e('0x3b')]=_0x2374b6['dialMachineRetryFrequency']||0x96;this[_0x227e('0x3c')]=_0x2374b6[_0x227e('0x3c')]||0x3;this[_0x227e('0x3d')]=_0x2374b6['dialAgentRejectRetryFrequency']||0x96;this[_0x227e('0x3e')]=_0x2374b6['dialGlobalMaxRetry']||0x4;this[_0x227e('0x3f')]=_0x2374b6[_0x227e('0x3f')]?_0x2374b6[_0x227e('0x3f')]:undefined;this['TrunkBackup']=_0x2374b6[_0x227e('0x40')]?_0x2374b6['TrunkBackup']:undefined;this['dialPrefix']=_0x2374b6[_0x227e('0x41')]||undefined;this[_0x227e('0x42')]=_0x2374b6[_0x227e('0x42')]?_0x2374b6[_0x227e('0x42')]:undefined;this['dialOrderByScheduledAt']=_0x2374b6['dialOrderByScheduledAt']||_0x227e('0x43');this[_0x227e('0x44')]=_0x2374b6[_0x227e('0x44')]||undefined;this[_0x227e('0x45')]=_0x2374b6[_0x227e('0x45')]||undefined;this[_0x227e('0x46')]=strategy[_0x2374b6[_0x227e('0x46')]]||_0x227e('0x9');this['queueStatusComplete']=!![];this[_0x227e('0x47')]=_0x2374b6['dialAMDActive']||![];this[_0x227e('0x48')]=_0x2374b6['dialAMDInitialSilence'];this[_0x227e('0x49')]=_0x2374b6[_0x227e('0x49')];this['dialAMDAfterGreetingSilence']=_0x2374b6['dialAMDAfterGreetingSilence'];this[_0x227e('0x4a')]=_0x2374b6[_0x227e('0x4a')];this[_0x227e('0x4b')]=_0x2374b6[_0x227e('0x4b')];this[_0x227e('0x4c')]=_0x2374b6[_0x227e('0x4c')];this[_0x227e('0x4d')]=_0x2374b6[_0x227e('0x4d')];this['dialAMDSilenceThreshold']=_0x2374b6[_0x227e('0x4e')];this[_0x227e('0x4f')]=_0x2374b6[_0x227e('0x4f')];this[_0x227e('0x50')]=0x0;this[_0x227e('0x51')]=0x0;this[_0x227e('0x52')]=_0x2374b6[_0x227e('0x52')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x227e('0x53')]=0x0;this[_0x227e('0x54')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x227e('0x55')]=0x0;this[_0x227e('0x56')]=0x0;this[_0x227e('0x57')]=0x0;this[_0x227e('0x58')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x227e('0x59')]=0x0;this[_0x227e('0x5a')]=0x0;this[_0x227e('0x5b')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x227e('0x5c')]=undefined;this['startPredictive']=undefined;this[_0x227e('0x5d')]=undefined;this[_0x227e('0x5e')]=1.05;this[_0x227e('0x5f')]=0x0;this[_0x227e('0x60')]=0x0;this[_0x227e('0x61')]=0x0;this[_0x227e('0x62')]=0x0;this[_0x227e('0x63')]=0x0;this[_0x227e('0x64')]=0x0;this[_0x227e('0x65')]=0x0;this[_0x227e('0x66')]=0x0;this[_0x227e('0x67')]=_0x2374b6[_0x227e('0x68')]||0x14;this[_0x227e('0x69')]=_0x2374b6[_0x227e('0x68')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x227e('0x6a')]=0x0;this[_0x227e('0x6b')]=0x1;this[_0x227e('0x6c')]=0x0;this[_0x227e('0x6d')]=0x0;this[_0x227e('0x6e')]=0x0;this[_0x227e('0x6f')]=0x0;this[_0x227e('0x70')]=_0x2374b6[_0x227e('0x70')]||0x1e;this[_0x227e('0x71')]=_0x2374b6[_0x227e('0x71')]||![];this[_0x227e('0x72')]=_0x2374b6[_0x227e('0x72')]||undefined;this[_0x227e('0x73')]=_0x2374b6[_0x227e('0x73')]||![];this[_0x227e('0x74')]=_0x2374b6['dialAgiAfterHangupAgent']||![];this[_0x227e('0x75')]=monitorFormat[_0x2374b6['monitor_format']]?monitorFormat[_0x2374b6[_0x227e('0x75')]]:undefined;this[_0x227e('0x76')]=_0x2374b6['mandatoryDisposition']||![];this[_0x227e('0x77')]=_0x2374b6['mandatoryDispositionPause']?_0x2374b6[_0x227e('0x77')]:undefined;}module[_0x227e('0x78')]=VoiceQueue; \ No newline at end of file +var _0xc7bc=['startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','not_inuse','inuse','ringing','wav','wav49','gsm','rrmemory','name','monitor_format','type','waiting','talking','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay'];(function(_0x29a956,_0x98ea8a){var _0x4d29ef=function(_0xa9722b){while(--_0xa9722b){_0x29a956['push'](_0x29a956['shift']());}};_0x4d29ef(++_0x98ea8a);}(_0xc7bc,0xfc));var _0xcc7b=function(_0x317c38,_0x9d154d){_0x317c38=_0x317c38-0x0;var _0x304c05=_0xc7bc[_0x317c38];return _0x304c05;};'use strict';var statusDesc=['unknown',_0xcc7b('0x0'),_0xcc7b('0x1'),'busy','invalid','unavailable',_0xcc7b('0x2'),'ringinuse','onhold'];var monitorFormat={'wav':_0xcc7b('0x3'),'wav49':_0xcc7b('0x4'),'gsm':_0xcc7b('0x5')};var strategy={'rrmemory':_0xcc7b('0x6'),'roundrobin':'roundrobin'};function VoiceQueue(_0x29b518){this['id']=_0x29b518['id']||0x0;this['name']=_0x29b518[_0xcc7b('0x7')]||'';this[_0xcc7b('0x8')]=_0x29b518[_0xcc7b('0x8')]||'';this[_0xcc7b('0x9')]=_0x29b518[_0xcc7b('0x9')]||'inbound';this[_0xcc7b('0xa')]=0x0;this[_0xcc7b('0xb')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0xcc7b('0xc')]=0x0;this[_0xcc7b('0xd')]=0x0;this[_0xcc7b('0xe')]=0x0;this[_0xcc7b('0xf')]=0x0;this[_0xcc7b('0x10')]=0x0;this[_0xcc7b('0x11')]=0x0;this[_0xcc7b('0x12')]=0x0;this[_0xcc7b('0x13')]=_0x29b518[_0xcc7b('0x13')]||![];this['acwTimeout']=_0x29b518['acwTimeout']||0xa;this[_0xcc7b('0x14')]=_0x29b518[_0xcc7b('0x14')]||'no';this[_0xcc7b('0x15')]=!![];this[_0xcc7b('0x16')]='';this[_0xcc7b('0x17')]=0x0;this[_0xcc7b('0x18')]=0x0;this[_0xcc7b('0x19')]=_0x29b518[_0xcc7b('0x19')]||null;this[_0xcc7b('0x1a')]=_0x29b518[_0xcc7b('0x1a')]?_0x29b518[_0xcc7b('0x1a')]:null;this[_0xcc7b('0x1b')]=_0x29b518[_0xcc7b('0x1b')];this[_0xcc7b('0x1c')]=_0x29b518[_0xcc7b('0x1c')]||_0xcc7b('0x1d');this[_0xcc7b('0x1e')]=_0x29b518['dialLimitChannel']||0x0;this[_0xcc7b('0x1f')]=_0x29b518[_0xcc7b('0x1f')]||0x0;this[_0xcc7b('0x20')]=_0x29b518[_0xcc7b('0x20')]||0x1;this[_0xcc7b('0x21')]=_0x29b518[_0xcc7b('0x21')]||'dropRate';this[_0xcc7b('0x22')]=_0x29b518[_0xcc7b('0x22')]||0.03;this[_0xcc7b('0x23')]=_0x29b518[_0xcc7b('0x23')]||0x258;this[_0xcc7b('0x24')]=_0x29b518['dialOriginateCallerIdName']||_0xcc7b('0x25');this[_0xcc7b('0x26')]=_0x29b518[_0xcc7b('0x26')]||_0xcc7b('0x25');this[_0xcc7b('0x27')]=_0x29b518['dialOriginateTimeout']||0x1e;this[_0xcc7b('0x28')]=_0x29b518[_0xcc7b('0x28')]||_0xcc7b('0x29');this[_0xcc7b('0x2a')]=_0x29b518[_0xcc7b('0x2a')]||0x3;this[_0xcc7b('0x2b')]=_0x29b518[_0xcc7b('0x2b')]||undefined;this['dialCongestionMaxRetry']=_0x29b518[_0xcc7b('0x2c')]||0x3;this[_0xcc7b('0x2d')]=_0x29b518[_0xcc7b('0x2d')]||0x96;this['dialBusyMaxRetry']=_0x29b518[_0xcc7b('0x2e')]||0x3;this['dialBusyRetryFrequency']=_0x29b518[_0xcc7b('0x2f')]||0x96;this['dialNoAnswerMaxRetry']=_0x29b518['dialNoAnswerMaxRetry']||0x3;this[_0xcc7b('0x30')]=_0x29b518['dialNoAnswerRetryFrequency']||0x96;this[_0xcc7b('0x31')]=_0x29b518[_0xcc7b('0x31')]||0x3;this[_0xcc7b('0x32')]=_0x29b518['dialNoSuchNumberRetryFrequency']||0x96;this[_0xcc7b('0x33')]=_0x29b518[_0xcc7b('0x33')]||0x3;this[_0xcc7b('0x34')]=_0x29b518[_0xcc7b('0x34')]||0x96;this['dialAbandonedMaxRetry']=_0x29b518[_0xcc7b('0x35')]||0x3;this[_0xcc7b('0x36')]=_0x29b518[_0xcc7b('0x36')]||0x96;this[_0xcc7b('0x37')]=_0x29b518[_0xcc7b('0x37')]||0x3;this[_0xcc7b('0x38')]=_0x29b518[_0xcc7b('0x38')]||0x96;this['dialAgentRejectMaxRetry']=_0x29b518[_0xcc7b('0x39')]||0x3;this[_0xcc7b('0x3a')]=_0x29b518['dialAgentRejectRetryFrequency']||0x96;this[_0xcc7b('0x3b')]=_0x29b518[_0xcc7b('0x3b')]||0x4;this[_0xcc7b('0x3c')]=_0x29b518[_0xcc7b('0x3c')]?_0x29b518[_0xcc7b('0x3c')]:undefined;this[_0xcc7b('0x3d')]=_0x29b518[_0xcc7b('0x3d')]?_0x29b518[_0xcc7b('0x3d')]:undefined;this[_0xcc7b('0x3e')]=_0x29b518[_0xcc7b('0x3e')]||undefined;this[_0xcc7b('0x3f')]=_0x29b518['Interval']?_0x29b518[_0xcc7b('0x3f')]:undefined;this['dialOrderByScheduledAt']=_0x29b518[_0xcc7b('0x40')]||_0xcc7b('0x41');this[_0xcc7b('0x42')]=_0x29b518[_0xcc7b('0x42')]||undefined;this[_0xcc7b('0x43')]=_0x29b518[_0xcc7b('0x43')]||undefined;this['strategy']=strategy[_0x29b518['strategy']]||_0xcc7b('0x6');this[_0xcc7b('0x44')]=!![];this['dialAMDActive']=_0x29b518[_0xcc7b('0x45')]||![];this[_0xcc7b('0x46')]=_0x29b518[_0xcc7b('0x46')];this[_0xcc7b('0x47')]=_0x29b518[_0xcc7b('0x47')];this[_0xcc7b('0x48')]=_0x29b518[_0xcc7b('0x48')];this['dialAMDTotalAnalysisTime']=_0x29b518[_0xcc7b('0x49')];this[_0xcc7b('0x4a')]=_0x29b518[_0xcc7b('0x4a')];this[_0xcc7b('0x4b')]=_0x29b518[_0xcc7b('0x4b')];this['dialAMDMaximumNumberOfWords']=_0x29b518['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x29b518[_0xcc7b('0x4c')];this[_0xcc7b('0x4d')]=_0x29b518['dialAMDMaximumWordLength'];this[_0xcc7b('0x4e')]=0x0;this[_0xcc7b('0x4f')]=0x0;this[_0xcc7b('0x50')]=_0x29b518['timeout'];this[_0xcc7b('0x51')]=0x0;this[_0xcc7b('0x52')]=0x0;this[_0xcc7b('0x53')]=0x0;this[_0xcc7b('0x54')]=0x0;this[_0xcc7b('0x55')]=0x0;this[_0xcc7b('0x56')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xcc7b('0x57')]=0x0;this[_0xcc7b('0x58')]=0x0;this[_0xcc7b('0x59')]=0x0;this[_0xcc7b('0x5a')]=0x0;this[_0xcc7b('0x5b')]=0x0;this[_0xcc7b('0x5c')]=0x0;this['outboundAbandonedDay']=0x0;this[_0xcc7b('0x5d')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0xcc7b('0x5e')]=1.05;this[_0xcc7b('0x5f')]=0x0;this[_0xcc7b('0x60')]=0x0;this[_0xcc7b('0x61')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xcc7b('0x62')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xcc7b('0x63')]=0x0;this[_0xcc7b('0x64')]=0x0;this[_0xcc7b('0x65')]=_0x29b518['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xcc7b('0x66')]=_0x29b518[_0xcc7b('0x67')]||0xa;this[_0xcc7b('0x68')]=0x0;this[_0xcc7b('0x69')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xcc7b('0x6a')]=0x0;this['erlangCallToSecond']=0x0;this[_0xcc7b('0x6b')]=0x0;this[_0xcc7b('0x6c')]=0x0;this[_0xcc7b('0x6d')]=_0x29b518[_0xcc7b('0x6d')]||0x1e;this['dialRecallInQueue']=_0x29b518[_0xcc7b('0x6e')]||![];this[_0xcc7b('0x6f')]=_0x29b518[_0xcc7b('0x6f')]||undefined;this[_0xcc7b('0x70')]=_0x29b518[_0xcc7b('0x70')]||![];this['dialAgiAfterHangupAgent']=_0x29b518['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x29b518[_0xcc7b('0x8')]]?monitorFormat[_0x29b518['monitor_format']]:undefined;this[_0xcc7b('0x71')]=_0x29b518[_0xcc7b('0x71')]||![];this[_0xcc7b('0x72')]=_0x29b518[_0xcc7b('0x72')]?_0x29b518[_0xcc7b('0x72')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index dbda894..e0509a8 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 _0xbc53=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x5369f1,_0x1cc11f){var _0x22945f=function(_0xa8cbf7){while(--_0xa8cbf7){_0x5369f1['push'](_0x5369f1['shift']());}};_0x22945f(++_0x1cc11f);}(_0xbc53,0x128));var _0x3bc5=function(_0x467dcf,_0xadbbde){_0x467dcf=_0x467dcf-0x0;var _0x142091=_0xbc53[_0x467dcf];return _0x142091;};'use strict';function VtigerAccount(_0x26d6a2){this['id']=_0x26d6a2['id']||0x0;this['name']=_0x26d6a2[_0x3bc5('0x0')]||'';this[_0x3bc5('0x1')]=_0x26d6a2[_0x3bc5('0x1')]||'';this[_0x3bc5('0x2')]=_0x26d6a2[_0x3bc5('0x2')]||'';this['remoteUri']=_0x26d6a2[_0x3bc5('0x3')]||'';this[_0x3bc5('0x4')]=_0x26d6a2[_0x3bc5('0x4')]||'';this[_0x3bc5('0x5')]=_0x26d6a2[_0x3bc5('0x5')]||{};}module[_0x3bc5('0x6')]=VtigerAccount; \ No newline at end of file +var _0x69b9=['username','accessKey','remoteUri','serverUrl','exports','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x69b9,0xdd));var _0x969b=function(_0x3bac6b,_0x473f0f){_0x3bac6b=_0x3bac6b-0x0;var _0x417ba6=_0x69b9[_0x3bac6b];return _0x417ba6;};'use strict';function VtigerAccount(_0x24ba2d){this['id']=_0x24ba2d['id']||0x0;this[_0x969b('0x0')]=_0x24ba2d['name']||'';this['username']=_0x24ba2d[_0x969b('0x1')]||'';this[_0x969b('0x2')]=_0x24ba2d[_0x969b('0x2')]||'';this['remoteUri']=_0x24ba2d[_0x969b('0x3')]||'';this[_0x969b('0x4')]=_0x24ba2d[_0x969b('0x4')]||'';this['Configurations']=_0x24ba2d['Configurations']||{};}module[_0x969b('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index fee03a4..b486c38 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 _0xdb28=['Configurations','exports','name','username','password','token','remoteUri','authType','integrationTab','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x1e8d8b,_0x4fe3d5){_0x1e8d8b=_0x1e8d8b-0x0;var _0x22dafd=_0xdb28[_0x1e8d8b];return _0x22dafd;};'use strict';function ZendeskAccount(_0x2f1285){this['id']=_0x2f1285['id']||0x0;this[_0x8db2('0x0')]=_0x2f1285[_0x8db2('0x0')]||'';this[_0x8db2('0x1')]=_0x2f1285['username']||'';this[_0x8db2('0x2')]=_0x2f1285[_0x8db2('0x2')]||'';this[_0x8db2('0x3')]=_0x2f1285[_0x8db2('0x3')]||'';this[_0x8db2('0x4')]=_0x2f1285['remoteUri']||'';this[_0x8db2('0x5')]=_0x2f1285[_0x8db2('0x5')]||'';this['type']=_0x2f1285['type']||_0x8db2('0x6');this[_0x8db2('0x7')]=_0x2f1285[_0x8db2('0x7')]||'';this[_0x8db2('0x8')]=_0x2f1285[_0x8db2('0x8')]||{};}module[_0x8db2('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x5f2f=['authType','type','integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri'];(function(_0x15d9de,_0x4b1d67){var _0xdc12f9=function(_0x309322){while(--_0x309322){_0x15d9de['push'](_0x15d9de['shift']());}};_0xdc12f9(++_0x4b1d67);}(_0x5f2f,0x73));var _0xf5f2=function(_0x375e6,_0x2648f7){_0x375e6=_0x375e6-0x0;var _0xa290d8=_0x5f2f[_0x375e6];return _0xa290d8;};'use strict';function ZendeskAccount(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||'';this[_0xf5f2('0x2')]=_0x7c86d8[_0xf5f2('0x2')]||'';this[_0xf5f2('0x3')]=_0x7c86d8['token']||'';this['remoteUri']=_0x7c86d8[_0xf5f2('0x4')]||'';this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||'';this[_0xf5f2('0x6')]=_0x7c86d8[_0xf5f2('0x6')]||_0xf5f2('0x7');this['serverUrl']=_0x7c86d8[_0xf5f2('0x8')]||'';this[_0xf5f2('0x9')]=_0x7c86d8[_0xf5f2('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index b5300f1..0bdd77f 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 _0x0b63=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','description','host','zone'];(function(_0x173b63,_0x59d766){var _0x2544e1=function(_0x16811d){while(--_0x16811d){_0x173b63['push'](_0x173b63['shift']());}};_0x2544e1(++_0x59d766);}(_0x0b63,0xe7));var _0x30b6=function(_0x431ba5,_0x10bec1){_0x431ba5=_0x431ba5-0x0;var _0x5abede=_0x0b63[_0x431ba5];return _0x5abede;};'use strict';function ZohoAccount(_0x97b314){this['id']=_0x97b314['id']||0x0;this['name']=_0x97b314['name']||'';this[_0x30b6('0x0')]=_0x97b314[_0x30b6('0x0')]||'';this[_0x30b6('0x1')]=_0x97b314[_0x30b6('0x1')]||'';this['zone']=_0x97b314[_0x30b6('0x2')]||'';this[_0x30b6('0x3')]=_0x97b314[_0x30b6('0x3')]||'';this[_0x30b6('0x4')]=_0x97b314[_0x30b6('0x4')]||'';this[_0x30b6('0x5')]=_0x97b314['serverUrl']||'';this[_0x30b6('0x6')]=_0x97b314['code']||'';this[_0x30b6('0x7')]=_0x97b314['refreshToken']||'';this[_0x30b6('0x8')]=_0x97b314[_0x30b6('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x180d=['description','host','zone','clientId','clientSecret','code','refreshToken','Configurations','exports','name'];(function(_0x34f078,_0x38a82f){var _0x48443f=function(_0x3d5e80){while(--_0x3d5e80){_0x34f078['push'](_0x34f078['shift']());}};_0x48443f(++_0x38a82f);}(_0x180d,0xf9));var _0xd180=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x180d[_0x487b0c];return _0x1adbdc;};'use strict';function ZohoAccount(_0x3c1f50){this['id']=_0x3c1f50['id']||0x0;this[_0xd180('0x0')]=_0x3c1f50[_0xd180('0x0')]||'';this[_0xd180('0x1')]=_0x3c1f50[_0xd180('0x1')]||'';this[_0xd180('0x2')]=_0x3c1f50['host']||'';this[_0xd180('0x3')]=_0x3c1f50[_0xd180('0x3')]||'';this[_0xd180('0x4')]=_0x3c1f50[_0xd180('0x4')]||'';this[_0xd180('0x5')]=_0x3c1f50[_0xd180('0x5')]||'';this['serverUrl']=_0x3c1f50['serverUrl']||'';this[_0xd180('0x6')]=_0x3c1f50[_0xd180('0x6')]||'';this[_0xd180('0x7')]=_0x3c1f50[_0xd180('0x7')]||'';this[_0xd180('0x8')]=_0x3c1f50[_0xd180('0x8')]||{};}module[_0xd180('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index bb1f733..11f7b81 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 _0x922c=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x435d9b,_0xea3b92){var _0x309a25=function(_0x505b03){while(--_0x505b03){_0x435d9b['push'](_0x435d9b['shift']());}};_0x309a25(++_0xea3b92);}(_0x922c,0x92));var _0xc922=function(_0x566bdf,_0x1f4861){_0x566bdf=_0x566bdf-0x0;var _0x331215=_0x922c[_0x566bdf];return _0x331215;};'use strict';var util=require(_0xc922('0x0'));var _=require(_0xc922('0x1'));var moment=require(_0xc922('0x2'));function checkNameSurname(_0x498577,_0x2644b5,_0x257319){var _0x3e1ee6='';if(!_[_0xc922('0x3')](_0x2644b5)&&'string'===typeof _0x2644b5){_0x3e1ee6+=_0x2644b5;}if(!_[_0xc922('0x3')](_0x257319)&&'string'===typeof _0x257319){_0x3e1ee6+='\x20'+_0x257319;}if(_0x3e1ee6!==''){return _0x3e1ee6;}return _0x498577;}function Action(_0x1701a0,_0x28057f,_0x1a2c12,_0x407c3d,_0x50259f){this['uniqueid']=_0x1a2c12||undefined;this[_0xc922('0x4')]=_0x1701a0['id'];this[_0xc922('0x5')]=_0x28057f[_0xc922('0x6')];this['type']=_0x28057f[_0xc922('0x7')];this[_0xc922('0x8')]=_0xc922('0x5');this[_0xc922('0x9')]=![];this[_0xc922('0xa')]=_[_0xc922('0x3')](_0x1701a0[_0xc922('0xb')])?undefined:_0x1701a0[_0xc922('0xb')]['name'];this[_0xc922('0xc')]=this[_0xc922('0xa')]?util[_0xc922('0xd')](_0xc922('0xe'),this[_0xc922('0xa')]):_0x407c3d||undefined;this[_0xc922('0xf')]=checkNameSurname(_0x1701a0[_0xc922('0x10')]['phone'],_0x1701a0[_0xc922('0x10')]['firstName'],_0x1701a0['Contact']['lastName']);this[_0xc922('0x11')]=_0x1701a0[_0xc922('0x11')]||![];this[_0xc922('0x12')]=_0x1701a0[_0xc922('0x10')][_0xc922('0x13')];this[_0xc922('0x14')]=_0x1701a0[_0xc922('0x14')];this[_0xc922('0x15')]=_0x1701a0[_0xc922('0x15')]||0x0;this[_0xc922('0x16')]=_0x1701a0[_0xc922('0x16')]||0x0;this[_0xc922('0x17')]=_0x1701a0[_0xc922('0x17')]||0x0;this[_0xc922('0x18')]=(_0x1701a0[_0xc922('0x15')]||0x0)+(_0x1701a0['countcongestionretry']||0x0)+(_0x1701a0[_0xc922('0x17')]||0x0)+(_0x1701a0[_0xc922('0x19')]||0x0)+(_0x1701a0[_0xc922('0x1a')]||0x0)+(_0x1701a0[_0xc922('0x1b')]||0x0)+(_0x1701a0[_0xc922('0x1c')]||0x0)+(_0x1701a0[_0xc922('0x1d')]||0x0);this[_0xc922('0x19')]=_0x1701a0[_0xc922('0x19')]||0x0;this[_0xc922('0x1a')]=_0x1701a0[_0xc922('0x1a')]||0x0;this['countabandonedretry']=_0x1701a0[_0xc922('0x1b')]||0x0;this[_0xc922('0x1c')]=_0x1701a0[_0xc922('0x1c')]||0x0;this['countagentrejectretry']=_0x1701a0[_0xc922('0x1d')]||0x0;this[_0xc922('0x1e')]=_0x1701a0[_0xc922('0x1e')];this[_0xc922('0x1f')]=_0x1701a0['callbackuniqueid'];this[_0xc922('0x20')]=_0x1701a0[_0xc922('0x20')];this['recallme']=_0x1701a0[_0xc922('0x21')];this['ContactId']=_0x1701a0[_0xc922('0x22')];this[_0xc922('0x23')]=_0x1701a0[_0xc922('0x23')];this[_0xc922('0x24')]=_[_0xc922('0x3')](_0x1701a0[_0xc922('0xb')])?_0x1701a0[_0xc922('0x24')]:_0x1701a0[_0xc922('0xb')]['id'];this[_0xc922('0x25')]=_0x1701a0[_0xc922('0x25')];this[_0xc922('0x26')]='';this['originatecalleridname']='';}Action['prototype'][_0xc922('0x27')]=function(){return util[_0xc922('0xd')](_0xc922('0x28'),this[_0xc922('0xf')],this[_0xc922('0x29')]);};module[_0xc922('0x2a')]=Action; \ No newline at end of file +var _0x7d58=['VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','Contact','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x499f57,_0x40dbc5){var _0x181199=function(_0x46d155){while(--_0x46d155){_0x499f57['push'](_0x499f57['shift']());}};_0x181199(++_0x40dbc5);}(_0x7d58,0xca));var _0x87d5=function(_0x41f56a,_0x49a25b){_0x41f56a=_0x41f56a-0x0;var _0x25d410=_0x7d58[_0x41f56a];return _0x25d410;};'use strict';var util=require(_0x87d5('0x0'));var _=require(_0x87d5('0x1'));var moment=require(_0x87d5('0x2'));function checkNameSurname(_0x44e600,_0x5e007e,_0x49464b){var _0x645b4c='';if(!_[_0x87d5('0x3')](_0x5e007e)&&_0x87d5('0x4')===typeof _0x5e007e){_0x645b4c+=_0x5e007e;}if(!_[_0x87d5('0x3')](_0x49464b)&&_0x87d5('0x4')===typeof _0x49464b){_0x645b4c+='\x20'+_0x49464b;}if(_0x645b4c!==''){return _0x645b4c;}return _0x44e600;}function Action(_0x209bf9,_0x46446a,_0x140f6b,_0x24151e,_0x51b931){this[_0x87d5('0x5')]=_0x140f6b||undefined;this[_0x87d5('0x6')]=_0x209bf9['id'];this[_0x87d5('0x7')]=_0x46446a[_0x87d5('0x8')];this[_0x87d5('0x9')]=_0x46446a[_0x87d5('0x9')];this[_0x87d5('0xa')]=_0x87d5('0x7');this[_0x87d5('0xb')]=![];this[_0x87d5('0xc')]=_['isNil'](_0x209bf9['Agent'])?undefined:_0x209bf9[_0x87d5('0xd')][_0x87d5('0x8')];this['channelAgent']=this[_0x87d5('0xc')]?util['format']('SIP/%s',this[_0x87d5('0xc')]):_0x24151e||undefined;this['calleridname']=checkNameSurname(_0x209bf9[_0x87d5('0xe')]['phone'],_0x209bf9[_0x87d5('0xe')]['firstName'],_0x209bf9[_0x87d5('0xe')]['lastName']);this['active']=_0x209bf9[_0x87d5('0xf')]||![];this[_0x87d5('0x10')]=_0x209bf9['Contact']['phone'];this[_0x87d5('0x11')]=_0x209bf9[_0x87d5('0x11')];this[_0x87d5('0x12')]=_0x209bf9[_0x87d5('0x12')]||0x0;this[_0x87d5('0x13')]=_0x209bf9[_0x87d5('0x13')]||0x0;this['countnoanswerretry']=_0x209bf9[_0x87d5('0x14')]||0x0;this['countglobal']=(_0x209bf9[_0x87d5('0x12')]||0x0)+(_0x209bf9['countcongestionretry']||0x0)+(_0x209bf9[_0x87d5('0x14')]||0x0)+(_0x209bf9[_0x87d5('0x15')]||0x0)+(_0x209bf9['countdropretry']||0x0)+(_0x209bf9['countabandonedretry']||0x0)+(_0x209bf9[_0x87d5('0x16')]||0x0)+(_0x209bf9[_0x87d5('0x17')]||0x0);this[_0x87d5('0x15')]=_0x209bf9[_0x87d5('0x15')]||0x0;this[_0x87d5('0x18')]=_0x209bf9[_0x87d5('0x18')]||0x0;this[_0x87d5('0x19')]=_0x209bf9[_0x87d5('0x19')]||0x0;this[_0x87d5('0x16')]=_0x209bf9[_0x87d5('0x16')]||0x0;this['countagentrejectretry']=_0x209bf9[_0x87d5('0x17')]||0x0;this['callback']=_0x209bf9['callback'];this[_0x87d5('0x1a')]=_0x209bf9[_0x87d5('0x1a')];this[_0x87d5('0x1b')]=_0x209bf9['callbackat'];this[_0x87d5('0x1c')]=_0x209bf9[_0x87d5('0x1c')];this[_0x87d5('0x1d')]=_0x209bf9[_0x87d5('0x1d')];this[_0x87d5('0x1e')]=_0x209bf9[_0x87d5('0x1e')];this['UserId']=_[_0x87d5('0x3')](_0x209bf9[_0x87d5('0xd')])?_0x209bf9[_0x87d5('0x1f')]:_0x209bf9[_0x87d5('0xd')]['id'];this[_0x87d5('0x20')]=_0x209bf9[_0x87d5('0x20')];this[_0x87d5('0x21')]='';this['originatecalleridname']='';}Action[_0x87d5('0x22')][_0x87d5('0x23')]=function(){return util['format'](_0x87d5('0x24'),this[_0x87d5('0x25')],this['number']);};module[_0x87d5('0x26')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 2a43547..e946a55 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 _0x1228=['syncNewExten','varset','blindtransfer','syncBlindTransfer','campaignsPreview','emit','type','outbound','name','strategy','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','callerid','Interval','stringify','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','available','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','\x20is\x20disactive','prototype','loopCampaigns','syncCampaigns','hasOwnProperty','clearZombieChannels','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','originated:\x20','queue','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','disableContact','starttime','format','logCustomer','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','nosuchnumber','totalGlobal','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','activeContact','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','complete','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','linkedid','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialBusyMaxRetry','scheduledAt','unlockAgent','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','dialBusyRetryFrequency','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','countabandonedretry','dialAbandonedRetryFrequency','[default]','cause-txt','[callProgressDetectingCustomer][logUnknownGlobal]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','checkInBlack','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','trim','dialCutDigit','substring','Contact','getCallerId','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','YYYY-MM-DD\x20HH:mm:ss','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','isFailure','response','rejected','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','dialstatus','addVariable','variables','syncVarSet','filterKey','variable','keys','value','error','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','util','bluebird','moment','md5','ioredis','../../../config/logger','preview','actionPreview','../ami','./action','./util/util','defaults','redis','socket.io-emitter','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','newexten'];(function(_0x241cff,_0x1b6f45){var _0x4c8045=function(_0x4bbe9a){while(--_0x4bbe9a){_0x241cff['push'](_0x241cff['shift']());}};_0x4c8045(++_0x1b6f45);}(_0x1228,0x12f));var _0x8122=function(_0xb00542,_0x1e07ad){_0xb00542=_0xb00542-0x0;var _0x3458fd=_0x1228[_0xb00542];return _0x3458fd;};'use strict';var util=require(_0x8122('0x0'));var _=require('lodash');var BPromise=require(_0x8122('0x1'));var uuid=require('uuid');var moment=require(_0x8122('0x2'));var md5=require(_0x8122('0x3'));var Redis=require(_0x8122('0x4'));var config=require('../../../config/environment');var logger=require(_0x8122('0x5'))(_0x8122('0x6'));var loggerAction=require('../../../config/logger')(_0x8122('0x7'));var ami=require(_0x8122('0x8'));var rpcDb=require('./rpcDb');var Action=require(_0x8122('0x9'));var ut=require(_0x8122('0xa'));config['redis']=_[_0x8122('0xb')](config[_0x8122('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x8122('0xd'))(new Redis(config[_0x8122('0xc')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x4fa7b3){this['tail']=this[_0x8122('0xe')]?this['tail'][_0x8122('0xf')](_0x4fa7b3):_0x4fa7b3();};function Preview(_0x23a9e4){this[_0x8122('0x10')]=new Sequence();this['campaignsPreview']=_0x23a9e4[_0x8122('0x11')];this['trunks']=_0x23a9e4[_0x8122('0x12')];this[_0x8122('0x13')]={};this[_0x8122('0x14')]=_0x23a9e4[_0x8122('0x14')];this[_0x8122('0x15')]=0x0;ami['on'](_0x8122('0x16'),this[_0x8122('0x17')][_0x8122('0x18')](this));ami['on'](_0x8122('0x19'),this[_0x8122('0x1a')][_0x8122('0x18')](this));ami['on'](_0x8122('0x1b'),this['syncHangupRequest'][_0x8122('0x18')](this));ami['on']('dialend',this[_0x8122('0x1c')]['bind'](this));ami['on'](_0x8122('0x1d'),this[_0x8122('0x1e')][_0x8122('0x18')](this));ami['on'](_0x8122('0x1f'),this['syncVarSet']['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x8122('0x18')](this));ami['on'](_0x8122('0x20'),this[_0x8122('0x21')]['bind'](this));this['loopCampaigns'](this[_0x8122('0x22')]);}function emit(_0x174321,_0x68761a,_0x4a9d96){io['to'](_0x174321)[_0x8122('0x23')](_0x68761a,_0x4a9d96);}function emitCampaignPreview(_0x1c0189){if(_0x1c0189[_0x8122('0x24')]===_0x8122('0x25')){var _0x3c6226={'id':_0x1c0189['id'],'name':_0x1c0189[_0x8122('0x26')],'strategy':_0x1c0189[_0x8122('0x27')],'answered':_0x1c0189[_0x8122('0x28')],'available':_0x1c0189['available'],'loggedIn':_0x1c0189[_0x8122('0x29')],'pTalking':_0x1c0189['pTalking'],'sumBillable':_0x1c0189[_0x8122('0x2a')],'sumDuration':_0x1c0189[_0x8122('0x2b')],'sumHoldTime':_0x1c0189[_0x8122('0x2c')]||0x0,'talking':_0x1c0189[_0x8122('0x2d')],'total':_0x1c0189[_0x8122('0x2e')],'type':_0x1c0189[_0x8122('0x24')],'unmanaged':_0x1c0189[_0x8122('0x2f')],'abandoned':_0x1c0189[_0x8122('0x30')],'waiting':_0x1c0189[_0x8122('0x31')],'loggedInDb':_0x1c0189['loggedInDb'],'dialActive':_0x1c0189[_0x8122('0x32')],'dialMethod':_0x1c0189[_0x8122('0x33')],'dialOriginateCallerIdName':_0x1c0189[_0x8122('0x34')],'dialOriginateCallerIdNumber':_0x1c0189[_0x8122('0x35')],'dialOriginateTimeout':_0x1c0189[_0x8122('0x36')],'dialPrefix':_0x1c0189[_0x8122('0x37')],'outboundAnswerAgiCallsDay':_0x1c0189[_0x8122('0x38')],'outboundAnswerCallsDay':_0x1c0189[_0x8122('0x39')],'outboundBlacklistCallsDay':_0x1c0189[_0x8122('0x3a')],'outboundBusyCallsDay':_0x1c0189[_0x8122('0x3b')],'outboundCongestionCallsDay':_0x1c0189['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x1c0189['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x1c0189[_0x8122('0x3c')],'outboundDropCallsDayTimeout':_0x1c0189[_0x8122('0x3d')],'outboundNoAnswerCallsDay':_0x1c0189['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x1c0189['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x1c0189[_0x8122('0x3e')],'outboundReCallsDay':_0x1c0189[_0x8122('0x3f')],'outboundRejectCallsDay':_0x1c0189[_0x8122('0x40')],'outboundUnknownCallsDay':_0x1c0189['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x1c0189['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x1c0189[_0x8122('0x41')],'predictiveIntervalAvgHoldtime':_0x1c0189[_0x8122('0x42')],'predictiveIntervalAvgTalktime':_0x1c0189[_0x8122('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x1c0189[_0x8122('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x1c0189[_0x8122('0x45')],'predictiveIntervalErlangCalls':_0x1c0189[_0x8122('0x46')],'predictiveIntervalErlangCallsDroppedCalls':_0x1c0189[_0x8122('0x47')],'predictiveIntervalHitRate':_0x1c0189[_0x8122('0x48')],'predictiveIntervalMultiplicativeFactor':_0x1c0189[_0x8122('0x49')],'predictiveIntervalPauses':_0x1c0189[_0x8122('0x4a')],'predictiveIntervalAvailable':_0x1c0189['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x1c0189[_0x8122('0x4b')],'message':_0x1c0189[_0x8122('0x4c')],'originated':_0x1c0189[_0x8122('0x4d')],'erlangCalls':_0x1c0189[_0x8122('0x4e')],'erlangCallToSecond':_0x1c0189[_0x8122('0x4f')],'erlangAbandonmentRate':_0x1c0189[_0x8122('0x50')],'erlangBusyFactor':_0x1c0189[_0x8122('0x51')],'startPredictive':_0x1c0189[_0x8122('0x52')],'startProgressive':_0x1c0189['startProgressive']};if(_0x1c0189['Trunk']){_0x3c6226[_0x8122('0x53')]={'id':_0x1c0189['Trunk']['id'],'name':_0x1c0189['Trunk'][_0x8122('0x26')],'active':_0x1c0189['Trunk']['active'],'callerid':_0x1c0189[_0x8122('0x53')][_0x8122('0x54')]};}if(_0x1c0189['Interval']){_0x3c6226[_0x8122('0x55')]={'id':_0x1c0189['Interval']['id'],'name':_0x1c0189[_0x8122('0x55')]['name']};}var _0x1fe9de=md5(JSON[_0x8122('0x56')](_0x3c6226));if(_0x1c0189['md5']!==_0x1fe9de){_0x1c0189['md5']=_0x1fe9de;emit(util['format'](_0x8122('0x57'),_0x3c6226[_0x8122('0x26')]),'voice_queue:save',_0x3c6226);}}}function emitVoiceQueueChannelRemove(_0x2e89f0){logger[_0x8122('0x58')](_0x8122('0x59'),JSON[_0x8122('0x56')](_0x2e89f0));emit(util['format'](_0x8122('0x57'),_0x2e89f0[_0x8122('0x26')]),_0x8122('0x5a'),_0x2e89f0);this['emit'](_0x8122('0x5b'),_0x2e89f0);}function notSendMessagesQueue(_0x4f795a){if(_0x4f795a[_0x8122('0x5c')]){if(_0x4f795a['originated']===0x0&&_0x4f795a[_0x8122('0x5d')]===0x0){_0x4f795a[_0x8122('0x5c')]=![];_0x4f795a[_0x8122('0x5e')]=0x0;_0x4f795a[_0x8122('0x5f')]=0x0;_0x4f795a['message']=_0x8122('0x60');ut[_0x8122('0x61')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x4f795a[_0x8122('0x26')]+_0x8122('0x62'));}else{_0x4f795a[_0x8122('0x4c')]='IS_DISACTIVED';ut[_0x8122('0x61')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x4f795a[_0x8122('0x26')]+_0x8122('0x63'));}emitCampaignPreview(_0x4f795a);}}Preview[_0x8122('0x64')][_0x8122('0x65')]=function(){var _0xb1d336=this;setInterval(function(){_0xb1d336['syncCampaigns']();},0x7cf);};Preview[_0x8122('0x64')][_0x8122('0x66')]=function(){var _0x5bceb1=this[_0x8122('0x22')];this[_0x8122('0x15')]+=0x1;for(var _0x37ec06 in _0x5bceb1){if(_0x5bceb1[_0x8122('0x67')](_0x37ec06)&&(_0x5bceb1[_0x37ec06][_0x8122('0x33')]===_0x8122('0x6')||_0x5bceb1[_0x37ec06][_0x8122('0x33')]==='booked')&&_0x5bceb1[_0x37ec06][_0x8122('0x24')]===_0x8122('0x25')){if(this[_0x8122('0x15')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x8122('0x68')]();}}if(_0x5bceb1[_0x8122('0x67')](_0x37ec06)&&_0x5bceb1[_0x37ec06][_0x8122('0x33')]==='preview'&&_0x5bceb1[_0x37ec06]['type']===_0x8122('0x25')){if(_0x5bceb1[_0x37ec06]['dialActive']){this['setMessage'](_0x5bceb1[_0x37ec06]);this[_0x8122('0x69')](_0x5bceb1[_0x37ec06]);}else{notSendMessagesQueue(_0x5bceb1[_0x37ec06]);}}}};Preview[_0x8122('0x64')][_0x8122('0x6a')]=function(_0x497e30){var _0x28fc53=this;this[_0x8122('0x10')]['enqueue'](function(){if(!_[_0x8122('0x6b')](_0x28fc53[_0x8122('0x13')][_0x497e30])){loggerAction[_0x8122('0x58')](_0x8122('0x6c'),_0x497e30,'Queue',_0x28fc53[_0x8122('0x13')][_0x497e30]['queue'],_0x8122('0x6d'),JSON[_0x8122('0x56')](_0x28fc53['campaignsPreview'][_0x28fc53[_0x8122('0x13')][_0x497e30][_0x8122('0x6e')]]['originated']),_0x8122('0x6f'),JSON[_0x8122('0x56')](_0x28fc53[_0x8122('0x22')][_0x28fc53[_0x8122('0x13')][_0x497e30][_0x8122('0x6e')]][_0x8122('0x5d')]),JSON[_0x8122('0x56')](_0x28fc53['actions'][_0x497e30][_0x8122('0x70')]),JSON[_0x8122('0x56')](_[_0x8122('0x71')](_0x28fc53[_0x8122('0x13')][_0x497e30],['contactId',_0x8122('0x72'),_0x8122('0x73'),_0x8122('0x74')])));return ami['Action']({'action':_0x8122('0x75'),'channel':_0x28fc53[_0x8122('0x13')][_0x497e30][_0x8122('0x76')]})[_0x8122('0x77')](function(_0x13f7b6){if(_0x13f7b6['message']===_0x8122('0x78')){setTimeout(function(){if(_0x28fc53[_0x8122('0x13')][_0x497e30]){ut[_0x8122('0x79')](_0x28fc53[_0x8122('0x22')][_0x28fc53[_0x8122('0x13')][_0x497e30][_0x8122('0x6e')]],_0x8122('0x7a'));if(_0x28fc53[_0x8122('0x13')][_0x497e30]['dialAnswer']===!![]){ut[_0x8122('0x7b')](_0x28fc53['campaignsPreview'][_0x28fc53[_0x8122('0x13')][_0x497e30][_0x8122('0x6e')]],_0x8122('0x7a'));ut[_0x8122('0x7c')](_0x8122('0x7d')+_0x497e30,_0x28fc53[_0x8122('0x13')][_0x497e30][_0x8122('0x6e')]);}ut[_0x8122('0x7c')](_0x8122('0x7e')+_0x497e30,_0x28fc53[_0x8122('0x13')][_0x497e30][_0x8122('0x6e')]);delete _0x28fc53['actions'][_0x497e30];}},0x2328);}});}});};Preview[_0x8122('0x64')][_0x8122('0x68')]=function(){var _0x5cecb6=this;loggerAction[_0x8122('0x58')](_0x8122('0x7f'),_[_0x8122('0x80')](this['actions']));for(var _0xb7c56 in this[_0x8122('0x13')]){if(_0x5cecb6['actions'][_0x8122('0x67')](_0xb7c56)){_0x5cecb6[_0x8122('0x6a')](_0xb7c56);}}};Preview[_0x8122('0x64')]['recallMe']=function(_0x364b0b){var _0x7817b8=this;rpcDb[_0x8122('0x81')](_0x364b0b['id'],ut[_0x8122('0x82')](this[_0x8122('0x14')]))[_0x8122('0x83')](function(_0x5878a7){if(!_[_0x8122('0x6b')](_0x5878a7)){for(var _0x261ff5=0x0;_0x261ff5<_0x5878a7[_0x8122('0x84')];_0x261ff5+=0x1){if(ut['getDiff'](_0x5878a7[_0x261ff5][_0x8122('0x85')])<_0x364b0b[_0x8122('0x86')]*0x3c){if(_0x5878a7[_0x261ff5][_0x8122('0x87')]&&!_0x5878a7[_0x261ff5][_0x8122('0x87')]['voicePause']){_0x7817b8[_0x8122('0x88')](_0x5878a7[_0x261ff5]['id'])[_0x8122('0x83')](ut[_0x8122('0x89')](_0x8122('0x8a')))['catch'](ut[_0x8122('0x89')](_0x8122('0x8a')));}else{rpcDb[_0x8122('0x8b')](_0x5878a7[_0x261ff5]['id']);}}else{var _0x1446cc=new Action(_0x5878a7[_0x261ff5],_0x364b0b);_0x1446cc[_0x8122('0x8c')]=moment()[_0x8122('0x8d')]('YYYY-MM-DD\x20HH:mm:ss');_0x364b0b[_0x8122('0x3f')]+=0x1;ut[_0x8122('0x8e')](_0x1446cc,0x17,'RecallInQueue');if(_0x364b0b['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0x8122('0x8f')](_0x5878a7[_0x261ff5]));rpcDb[_0x8122('0x90')](_0x1446cc,_0x8122('0x91'));}else{ut[_0x8122('0x8e')](_0x1446cc,0x16,_0x8122('0x92'));rpcDb[_0x8122('0x90')](_0x1446cc,_0x8122('0x93'));rpcDb[_0x8122('0x94')](_0x1446cc,_0x8122('0x93'));}}}}})['catch'](ut[_0x8122('0x89')](_0x8122('0x95')));};Preview[_0x8122('0x64')][_0x8122('0x96')]=function(_0x473b14){_0x473b14[_0x8122('0x5c')]=!![];if(ut['IsNotLoggedIn'](_0x473b14[_0x8122('0x29')])){_0x473b14[_0x8122('0x4c')]=_0x8122('0x97');}else if(!ut['isActive'](_0x473b14[_0x8122('0x32')])){_0x473b14[_0x8122('0x4c')]=_0x8122('0x60');}else if(!this[_0x8122('0x98')](_0x473b14['Trunk'])){if(!this[_0x8122('0x98')](_0x473b14[_0x8122('0x99')])){_0x473b14['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x473b14[_0x8122('0x4c')]=_0x8122('0x9a');}}else{_0x473b14['message']=_0x8122('0x9a');}emitCampaignPreview(_0x473b14);};Preview[_0x8122('0x64')][_0x8122('0x9b')]=function(_0x3b7f67,_0x5541d7,_0x40057b){var _0x4c4df1=this;var _0x5bed01=this['actions'][_0x5541d7];var _0x2fa9d9=this[_0x8122('0x22')][_0x5bed01[_0x8122('0x6e')]];var _0x4ab1f0;if(_0x2fa9d9){switch(_0x40057b){case'1':_0x2fa9d9[_0x8122('0x9c')]+=0x1;_0x5bed01[_0x8122('0x9d')]+=0x1;_0x5bed01[_0x8122('0x9e')]=ut['totalGlobal'](_0x5bed01);ut['logCustomer'](_0x5bed01,0x0,_0x8122('0x9f'));ami[_0x8122('0x23')]('custom:agentnosuchnumber',ut['buildObj'](_0x5bed01,_0x8122('0xa0')));rpcDb[_0x8122('0x90')](_0x5bed01,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0x8122('0xa1')](_0x5bed01)>=_0x2fa9d9['dialGlobalMaxRetry']){_0x4ab1f0=ut[_0x8122('0xa2')](_0x5bed01,0xf,_0x8122('0xa3'));rpcDb['createCustomerFinal'](_0x4ab1f0,_0x8122('0xa4'));}else{if(_0x5bed01[_0x8122('0x9d')]>=_0x2fa9d9[_0x8122('0xa5')]){rpcDb[_0x8122('0x94')](_0x5bed01,_0x8122('0xa4'));}else{rpcDb[_0x8122('0xa6')](ut['scheduledAt'](_0x5bed01,'countnosuchnumberretry',_0x2fa9d9[_0x8122('0xa7')]),_0x5bed01['unlockAgent'],_0x5bed01[_0x8122('0xa8')]);}}delete this[_0x8122('0x13')][_0x3b7f67['linkedid']];break;case _0x8122('0xa9'):var _0x305ff8=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5bed01[_0x8122('0xaa')]=_0x305ff8;_0x5bed01[_0x8122('0xab')]=_0x305ff8;_0x5bed01[_0x8122('0x70')]=!![];_0x2fa9d9[_0x8122('0x5d')]+=0x1;logger['info'](_0x8122('0xac'),_0x5bed01[_0x8122('0xad')],_0x8122('0xae'),_0x2fa9d9[_0x8122('0x26')],_0x8122('0x6f'),_0x2fa9d9[_0x8122('0x5d')]);ami['emit'](_0x8122('0xaf'),ut[_0x8122('0xb0')](_0x5bed01,_0x8122('0xb1'),this[_0x8122('0x22')][_0x5bed01[_0x8122('0x6e')]]));if(_0x2fa9d9[_0x8122('0xb2')]){ami['emit'](_0x8122('0xb3'),ut[_0x8122('0xb4')](_0x5bed01));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x8122('0xb0')](_0x5bed01,_0x8122('0xb5'),this[_0x8122('0x22')][_0x5bed01[_0x8122('0x6e')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x5bed01,_0x8122('0xb5')));_0x2fa9d9[_0x8122('0x39')]+=0x1;_0x2fa9d9['total']+=0x1;_0x2fa9d9[_0x8122('0x28')]+=0x1;ut[_0x8122('0x7b')](_0x2fa9d9,'[16]');_0x5bed01[_0x8122('0x9e')]=ut[_0x8122('0xa1')](_0x5bed01);ut['logCustomer'](_0x5bed01,0x4,_0x8122('0xb6'));rpcDb[_0x8122('0x90')](_0x5bed01,_0x8122('0xb7'));rpcDb['createCustomerFinal'](_0x5bed01,_0x8122('0xb8'));rpcDb[_0x8122('0xb9')](_0x5bed01);_0x2fa9d9[_0x8122('0x2b')]+=_0x5bed01['talktime'];_0x2fa9d9['sumBillable']+=_0x5bed01[_0x8122('0xba')];logger['info'](_0x8122('0xbb'),_0x5bed01[_0x8122('0xad')],'\x20Queue',_0x2fa9d9[_0x8122('0x26')],_0x8122('0x6f'),_0x2fa9d9['pTalking']);delete this[_0x8122('0x13')][_0x3b7f67[_0x8122('0xbc')]];break;case _0x8122('0xbd'):_0x2fa9d9[_0x8122('0x3b')]+=0x1;_0x5bed01[_0x8122('0xbe')]+=0x1;_0x5bed01[_0x8122('0x9e')]=ut['totalGlobal'](_0x5bed01);ut[_0x8122('0x8e')](_0x5bed01,0x5,_0x8122('0xbf'));ami[_0x8122('0x23')](_0x8122('0xc0'),ut[_0x8122('0xb0')](_0x5bed01,_0x8122('0xc1')));rpcDb[_0x8122('0x90')](_0x5bed01,_0x8122('0xc2'));if(ut[_0x8122('0xa1')](_0x5bed01)>=_0x2fa9d9['dialGlobalMaxRetry']){_0x4ab1f0=ut[_0x8122('0xa2')](_0x5bed01,0xf,_0x8122('0xa3'));rpcDb[_0x8122('0x94')](_0x4ab1f0,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x5bed01['countbusyretry']>=_0x2fa9d9[_0x8122('0xc3')]){rpcDb[_0x8122('0x94')](_0x5bed01,_0x8122('0xc2'));}else{rpcDb['rescheduleContact'](ut[_0x8122('0xc4')](_0x5bed01,_0x8122('0xbe'),_0x2fa9d9['dialBusyRetryFrequency']),_0x5bed01[_0x8122('0xc5')],_0x5bed01[_0x8122('0xa8')]);}}break;case'NOANSWER':_0x2fa9d9[_0x8122('0xc6')]+=0x1;_0x5bed01[_0x8122('0xc7')]+=0x1;_0x5bed01['countglobal']=ut['totalGlobal'](_0x5bed01);ut[_0x8122('0x8e')](_0x5bed01,0x3,_0x8122('0xc8'));ami[_0x8122('0x23')](_0x8122('0xc9'),ut[_0x8122('0xb0')](_0x5bed01,'noanswer'));rpcDb['createCustomerHistory'](_0x5bed01,_0x8122('0xca'));if(ut[_0x8122('0xa1')](_0x5bed01)>=_0x2fa9d9[_0x8122('0xcb')]){_0x4ab1f0=ut[_0x8122('0xa2')](_0x5bed01,0xf,'Global');rpcDb['createCustomerFinal'](_0x4ab1f0,_0x8122('0xcc'));}else{if(_0x5bed01[_0x8122('0xc7')]>=_0x2fa9d9[_0x8122('0xcd')]){rpcDb[_0x8122('0x94')](_0x5bed01,_0x8122('0xca'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x5bed01,_0x8122('0xc7'),_0x2fa9d9['dialNoAnswerRetryFrequency']),_0x5bed01[_0x8122('0xc5')],_0x5bed01[_0x8122('0xa8')]);}}break;case _0x8122('0xce'):_0x2fa9d9[_0x8122('0xcf')]+=0x1;_0x5bed01[_0x8122('0xd0')]+=0x1;_0x5bed01[_0x8122('0x9e')]=ut['totalGlobal'](_0x5bed01);ut[_0x8122('0x8e')](_0x5bed01,0x8,'Congestion');ami[_0x8122('0x23')](_0x8122('0xd1'),ut[_0x8122('0xb0')](_0x5bed01,'congestion'));rpcDb[_0x8122('0x90')](_0x5bed01,_0x8122('0xd2'));if(ut[_0x8122('0xa1')](_0x5bed01)>=_0x2fa9d9[_0x8122('0xcb')]){_0x4ab1f0=ut[_0x8122('0xa2')](_0x5bed01,0xf,_0x8122('0xa3'));rpcDb['createCustomerFinal'](_0x4ab1f0,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x5bed01['countcongestionretry']>=_0x2fa9d9['dialCongestionMaxRetry']){rpcDb[_0x8122('0x94')](_0x5bed01,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x8122('0xa6')](ut[_0x8122('0xc4')](_0x5bed01,_0x8122('0xd0'),_0x2fa9d9[_0x8122('0xd3')]),_0x5bed01[_0x8122('0xc5')],_0x5bed01['activeContact']);}}break;case'CANCEL':_0x2fa9d9[_0x8122('0x40')]+=0x1;_0x5bed01[_0x8122('0xd4')]+=0x1;_0x5bed01[_0x8122('0x9e')]=ut['totalGlobal'](_0x5bed01);ut[_0x8122('0x8e')](_0x5bed01,0x14,_0x8122('0xd5'));ami[_0x8122('0x23')](_0x8122('0xd6'),ut[_0x8122('0xb0')](_0x5bed01,_0x8122('0xd7')));rpcDb['createCustomerHistory'](_0x5bed01,_0x8122('0xd8'));if(ut[_0x8122('0xa1')](_0x5bed01)>=_0x2fa9d9[_0x8122('0xcb')]){_0x4ab1f0=ut[_0x8122('0xa2')](_0x5bed01,0x14,_0x8122('0xd5'));rpcDb[_0x8122('0x94')](_0x4ab1f0,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x5bed01[_0x8122('0xd4')]>=_0x2fa9d9[_0x8122('0xd9')]){rpcDb[_0x8122('0x94')](_0x5bed01,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x8122('0xa6')](ut['scheduledAt'](_0x5bed01,_0x8122('0xd4'),_0x2fa9d9[_0x8122('0xda')]),_0x5bed01['unlockAgent'],_0x5bed01[_0x8122('0xa8')]);}}break;case _0x8122('0xdb'):_0x2fa9d9['outboundAbandonedCallsDay']+=0x1;_0x5bed01['countabandonedretry']+=0x1;_0x5bed01[_0x8122('0x9e')]=ut['totalGlobal'](_0x5bed01);ut[_0x8122('0x8e')](_0x5bed01,0xb,'Abandoned');rpcDb[_0x8122('0x90')](_0x5bed01,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x8122('0xa1')](_0x5bed01)>=_0x2fa9d9['dialGlobalMaxRetry']){_0x4ab1f0=ut['cloneAction'](_0x5bed01,0xf,'Global');rpcDb['createCustomerFinal'](_0x4ab1f0,_0x8122('0xdc'));}else{if(_0x5bed01[_0x8122('0xdd')]>=_0x2fa9d9['dialAbandonedMaxRety']){rpcDb[_0x8122('0x94')](_0x5bed01,_0x8122('0xdc'));}else{rpcDb[_0x8122('0xa6')](ut[_0x8122('0xc4')](_0x5bed01,_0x8122('0xde'),_0x2fa9d9[_0x8122('0xdf')]),_0x5bed01[_0x8122('0xc5')],_0x5bed01[_0x8122('0xa8')]);}}break;default:if(_0x5bed01[_0x8122('0x70')]){ut[_0x8122('0x7b')](_0x2fa9d9,_0x8122('0xe0'));ut[_0x8122('0x7c')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x2fa9d9[_0x8122('0x26')],_0x3b7f67);}_0x2fa9d9['outboundUnknownCallsDay']+=0x1;_0x5bed01[_0x8122('0x9e')]=ut[_0x8122('0xa1')](_0x5bed01);ut[_0x8122('0x8e')](_0x5bed01,0xc,_0x3b7f67[_0x8122('0xe1')]||_0x3b7f67['dialstatus']);rpcDb['createCustomerHistory'](_0x5bed01,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x8122('0xa1')](_0x5bed01)>=_0x2fa9d9[_0x8122('0xcb')]){_0x4ab1f0=ut[_0x8122('0xa2')](_0x5bed01,0xf,'Global');rpcDb[_0x8122('0x94')](_0x4ab1f0,_0x8122('0xe2'));}else{rpcDb[_0x8122('0x94')](_0x5bed01,_0x8122('0xe2'));}delete this[_0x8122('0x13')][_0x3b7f67[_0x8122('0xbc')]];}if(!(_0x5bed01[_0x8122('0x70')]&&_0x40057b==='16')){ut[_0x8122('0x79')](_0x2fa9d9,'[callProgressDetectingCustomer]');logger[_0x8122('0x58')]('[originated][decrement][callProgressDetectingCustomer]',_0x5bed01['uniqueid'],_0x8122('0xae'),_0x2fa9d9['name'],_0x8122('0x6d'),_0x2fa9d9['originated']);}if(_0x40057b!==_0x8122('0xa9')){delete this[_0x8122('0x13')][_0x3b7f67['linkedid']];delete this['actions'][_0x3b7f67[_0x8122('0xe3')]];}}};Preview[_0x8122('0x64')][_0x8122('0xe4')]=function(_0x144985,_0x237711,_0x1feab9){if(_[_0x8122('0xe5')](_0x237711)&&_0x8122('0xe6')!==typeof _0x237711){return;}if(_[_0x8122('0xe5')](_0x1feab9)&&_0x8122('0xe6')!==typeof _0x1feab9){return;}switch(_0x1feab9[_0x8122('0xe7')]){case'0':ut['logAgent'](_0x144985,0x0,_0x8122('0x9f'));rpcDb[_0x8122('0xe8')](_0x144985,_0x8122('0xe9'));break;case'3':ut[_0x8122('0xea')](_0x144985,0x3,_0x8122('0xc8'));rpcDb[_0x8122('0xe8')](_0x144985,_0x8122('0xeb'));break;case'5':ut[_0x8122('0xea')](_0x144985,0x5,_0x8122('0xbf'));rpcDb[_0x8122('0xe8')](_0x144985,_0x8122('0xec'));break;case'8':ut[_0x8122('0xea')](_0x144985,0x8,_0x8122('0xed'));rpcDb[_0x8122('0xe8')](_0x144985,_0x8122('0xee'));break;case'22':ut['logAgent'](_0x144985,0x16,_0x8122('0xef'));rpcDb[_0x8122('0xe8')](_0x144985,_0x8122('0xf0'));break;default:ut['logAgent'](_0x144985,0xc,_0x1feab9['reason']);rpcDb[_0x8122('0xe8')](_0x144985,_0x8122('0xee'));}ut[_0x8122('0x79')](_0x237711,_0x8122('0xf1'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x144985[_0x8122('0xad')],_0x8122('0xae'),_0x237711['name'],_0x8122('0x6d'),_0x237711[_0x8122('0x4d')]);delete this['actions'][_0x144985[_0x8122('0xad')]];};Preview[_0x8122('0x64')][_0x8122('0xf2')]=function(_0x343adf,_0x389ba3,_0x4b8ecb,_0x136f64,_0x79b1a6){var _0x4cc0b4=this;return new BPromise(function(_0x55e141,_0x562689){if(_[_0x8122('0x6b')](_0x389ba3)||_[_0x8122('0x6b')](_0x389ba3['Contact'])||_[_0x8122('0x6b')](_0x389ba3['Contact'][_0x8122('0xf3')])||_['isNil'](_0x389ba3[_0x8122('0x73')])){_0x562689(ut['message'](_0x8122('0xf4'),_0x136f64,_0x79b1a6));return;}var _0x130292=uuid['v4']();var _0x2ada37=_0x4cc0b4[_0x8122('0x22')][_0x389ba3['Queue'][_0x8122('0x26')]];var _0x2f42ff=_0x4b8ecb?_0x4cc0b4[_0x8122('0x14')][_0x4b8ecb]['id']:undefined;_0x4cc0b4[_0x8122('0x13')][_0x130292]=new Action(_0x389ba3,_0x2ada37,_0x130292,_0x4b8ecb,_0x2f42ff);var _0x347ed2=_0x4cc0b4[_0x8122('0x13')][_0x130292];_0x347ed2['unlockAgent']=_0x136f64;_0x347ed2['activeContact']=_0x79b1a6;_0x347ed2[_0x8122('0xf5')]=_0x4b8ecb;if(_[_0x8122('0xf6')](_0x343adf)){_0x4cc0b4['execCall'](_0x347ed2,_0x2ada37,_0x389ba3,_0x4b8ecb)[_0x8122('0x83')](function(_0x55d2de){logger[_0x8122('0x58')](_0x8122('0xf7'),_0x8122('0xf8')+_0x347ed2[_0x8122('0x6e')]+_0x8122('0xf9')+_0x347ed2[_0x8122('0xfa')],JSON[_0x8122('0x56')](_0x55d2de));ami['emit'](_0x8122('0xfb'),ut[_0x8122('0xb0')](_0x347ed2,_0x8122('0xfc'),_0x4cc0b4['campaignsPreview'][_0x347ed2[_0x8122('0x6e')]]));_0x55e141(ut['message'](_0x8122('0xfd')));})['catch'](function(_0x4fae73){ut[_0x8122('0x61')](_0x8122('0xfe'),_0x4fae73);_0x562689(ut[_0x8122('0x4c')](_0x8122('0xff'),_0x136f64,_0x79b1a6));});}else{_0x2ada37['outboundBlacklistCallsDay']+=0x1;ut[_0x8122('0x100')](_0x347ed2);rpcDb[_0x8122('0x101')](_0x347ed2,_0x8122('0x102'));delete _0x4cc0b4[_0x8122('0x13')][_0x130292];_0x562689(ut[_0x8122('0x4c')](_0x8122('0x103'),_0x136f64,_0x79b1a6));}});};Preview['prototype'][_0x8122('0x98')]=function(_0x2a2382){return!_[_0x8122('0x6b')](_0x2a2382)&&!_['isNil'](_0x2a2382['name'])&&!_[_0x8122('0x6b')](_0x2a2382[_0x8122('0x104')])&&_0x2a2382[_0x8122('0x104')]&&!_[_0x8122('0x6b')](this[_0x8122('0x12')][util[_0x8122('0x8d')]('SIP/%s',_0x2a2382[_0x8122('0x26')])])&&!_['isNil'](this['trunks'][util['format'](_0x8122('0x105'),_0x2a2382[_0x8122('0x26')])][_0x8122('0x75')])&&(this[_0x8122('0x12')][util['format']('SIP/%s',_0x2a2382[_0x8122('0x26')])][_0x8122('0x75')]===_0x8122('0x106')||this[_0x8122('0x12')][util['format']('SIP/%s',_0x2a2382['name'])][_0x8122('0x75')]===_0x8122('0x107'));};Preview[_0x8122('0x64')][_0x8122('0x88')]=function(_0x17be2d,_0x1cf56b){var _0x43209d=this;return new BPromise(function(_0x1b8c20,_0x4b93a0){_0x43209d[_0x8122('0x108')](_0x17be2d,_0x1cf56b)[_0x8122('0x83')](function(_0x35bcdf){_0x1b8c20(_[_0x8122('0x71')](_0x35bcdf,['message']));})[_0x8122('0x77')](function(_0x19e5ef){if(_0x19e5ef[_0x8122('0x109')]){rpcDb[_0x8122('0x10a')](_0x17be2d);}if(_0x19e5ef[_0x8122('0x104')]){rpcDb[_0x8122('0x8b')](_0x17be2d);}_0x4b93a0(_[_0x8122('0x71')](_0x19e5ef,['message']));});});};Preview[_0x8122('0x64')][_0x8122('0x108')]=function(_0x401e6c,_0x573cd9){var _0x1a39fe=this;return new BPromise(function(_0x47e37c,_0x2b33c5){var _0x2ca894,_0x1869f6;rpcDb[_0x8122('0x10b')](_0x401e6c)[_0x8122('0x83')](function(_0x2fc6c0){if(!_['isNil'](_0x2fc6c0[0x0])){_0x1869f6=_0x2fc6c0[0x0]['recallme']?![]:!![];_0x2ca894=_0x2fc6c0[0x0][_0x8122('0x10c')]?!![]:![];_0x2ca894=_0x573cd9?!![]:_0x2ca894;}var _0x4699f6=_0x1a39fe[_0x8122('0x10d')](_0x2fc6c0);if(_0x4699f6[_0x8122('0x10e')]){rpcDb[_0x8122('0x10f')](_[_0x8122('0x71')](_0x2fc6c0[0x0],[_0x8122('0x73'),_0x8122('0x110')]))[_0x8122('0x83')](function(_0x2bcff2){_0x1a39fe['checkInBlack'](_0x2bcff2,_0x2fc6c0[0x0],_0x573cd9,_0x1869f6,_0x2ca894)['then'](function(_0x40c8eb){_0x47e37c(_0x40c8eb);})[_0x8122('0x77')](function(_0x58fbe8){_0x2b33c5(_0x58fbe8);});})[_0x8122('0x77')](function(_0x1261fa){ut[_0x8122('0x61')](_0x8122('0x111'),_0x1261fa);_0x2b33c5(ut[_0x8122('0x4c')](_0x8122('0x112'),_0x1869f6,_0x2ca894));});}else{_0x2b33c5(ut[_0x8122('0x4c')](_0x4699f6[_0x8122('0x4c')],_0x1869f6,_0x2ca894));}})[_0x8122('0x77')](function(_0x4400b8){ut[_0x8122('0x61')](_0x8122('0x113'),_0x4400b8);_0x2b33c5(ut[_0x8122('0x4c')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x8122('0x64')][_0x8122('0x10d')]=function(_0x20fe70){if(_['isNil'](_0x20fe70)||_[_0x8122('0xf6')](_0x20fe70)||!_['isNil'](_0x20fe70[0x0][_0x8122('0x87')])&&_['isNil'](_0x20fe70[0x0][_0x8122('0x87')][_0x8122('0x26')])){ut['logger'](_0x8122('0x114'),_0x20fe70);return{'isValid':![],'message':_0x8122('0x115')};}var _0xafc636=this[_0x8122('0x22')][_0x20fe70[0x0]['Queue'][_0x8122('0x26')]];_0xafc636['message']=_0x8122('0x9a');if(_['isNil'](_0xafc636)){ut['logger'](_0x8122('0x116'),_0xafc636);return{'isValid':![],'message':_0x8122('0x117')};}if(!this[_0x8122('0x98')](_0xafc636[_0x8122('0x53')])){ut[_0x8122('0x61')](_0x8122('0x118'),_0x8122('0x119')+_0xafc636[_0x8122('0x26')]+_0x8122('0x11a'));if(!this['isTrunkReachable'](_0xafc636[_0x8122('0x99')])){ut[_0x8122('0x61')]('[Preview][validateContact][Trunk\x20not\x20work]',_0xafc636[_0x8122('0x26')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x8122('0x11b')};}}if(!ut[_0x8122('0x11c')](_0xafc636[_0x8122('0x32')])){ut[_0x8122('0x61')](_0x8122('0x11d'),_0xafc636['name']+_0x8122('0x11e'));return{'isValid':![],'message':_0x8122('0x119')+_0xafc636[_0x8122('0x26')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x8122('0x11f')};};Preview[_0x8122('0x64')][_0x8122('0x120')]=function(_0x3fb63e,_0x3492c7,_0x90d7b5,_0x7545db){var _0x8805=this;return new BPromise(function(_0x4db59a,_0x2ee0d9){var _0x57a25e=_0x3fb63e['uniqueid'];var _0x4400cc=_0x8805[_0x8122('0x98')](_0x3492c7['Trunk'])?util[_0x8122('0x8d')](_0x8122('0x121'),_0x3492c7[_0x8122('0x53')][_0x8122('0x26')],_[_0x8122('0x6b')](_0x3492c7[_0x8122('0x37')])?'':_0x3492c7[_0x8122('0x37')][_0x8122('0x122')]()||'',_0x3492c7[_0x8122('0x123')]>0x0?_0x90d7b5['Contact'][_0x8122('0xf3')][_0x8122('0x124')](_0x3492c7[_0x8122('0x123')]):_0x90d7b5[_0x8122('0x125')][_0x8122('0xf3')]):util[_0x8122('0x8d')](_0x8122('0x121'),_[_0x8122('0x6b')](_0x3492c7['TrunkBackup'])?_0x3492c7[_0x8122('0x53')][_0x8122('0x26')]:_0x3492c7[_0x8122('0x99')][_0x8122('0x26')],_['isNil'](_0x3492c7['dialPrefix'])?'':_0x3492c7[_0x8122('0x37')][_0x8122('0x122')]()||'',_0x3492c7[_0x8122('0x123')]>0x0?_0x90d7b5[_0x8122('0x125')]['phone'][_0x8122('0x124')](_0x3492c7[_0x8122('0x123')]):_0x90d7b5['Contact'][_0x8122('0xf3')]);var _0x3ba61c=_0x8805['isTrunkReachable'](_0x3492c7['Trunk'])?ut[_0x8122('0x126')](_0x3492c7[_0x8122('0x53')][_0x8122('0x54')],_0x3492c7[_0x8122('0x34')],_0x3492c7['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x8122('0x127')](_0x3492c7[_0x8122('0x35')],_0x3492c7[_0x8122('0x128')]):_0x3492c7[_0x8122('0x35')]):ut[_0x8122('0x126')](_[_0x8122('0x6b')](_0x3492c7['TrunkBackup'])?_0x3492c7[_0x8122('0x53')]['callerid']:_0x3492c7[_0x8122('0x99')]['callerid'],_0x3492c7[_0x8122('0x34')],_0x3492c7['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x8122('0x127')](_0x3492c7[_0x8122('0x35')],_0x3492c7[_0x8122('0x128')]):_0x3492c7[_0x8122('0x35')]);if(_0x3ba61c){_0x3fb63e[_0x8122('0x129')]=ut[_0x8122('0x12a')](_0x3ba61c);_0x3fb63e[_0x8122('0x12b')]=ut[_0x8122('0x12c')](_0x3ba61c);}var _0x4fdb9e=ut[_0x8122('0x12d')](_0x3492c7,_0x90d7b5,_0x4400cc,_0x3ba61c,_0x57a25e,_0x3fb63e);_[_0x8122('0x12e')](_0x3fb63e,ut[_0x8122('0x12f')](_0x4fdb9e));_0x3fb63e['starttime']=moment()['format'](_0x8122('0x130'));ami['Action'](ut['variablesAction'](_0x3fb63e,_0x3492c7,_0x4fdb9e,_0x3fb63e[_0x8122('0xa8')],_0x7545db))[_0x8122('0x83')](function(_0x3341fd){_0x3492c7[_0x8122('0x4d')]+=0x1;logger[_0x8122('0x58')](_0x8122('0x131'),_0x57a25e,'\x20Queue',_0x3492c7[_0x8122('0x26')],_0x8122('0x6d'),_0x3492c7[_0x8122('0x4d')]);_0x4db59a(_0x3341fd);})[_0x8122('0x77')](function(_0x10b85d){ut[_0x8122('0xea')](_0x3fb63e,0xe,_0x8122('0x132'));rpcDb['createAgentHistory'](_0x3fb63e,_0x8122('0x133'));_0x2ee0d9(_0x10b85d);});});};Preview[_0x8122('0x64')]['syncNewExten']=function(_0x3dc612){if(this[_0x8122('0x13')][_0x3dc612[_0x8122('0xbc')]]){this['actions'][_0x3dc612['linkedid']][_0x8122('0x76')]=_0x3dc612[_0x8122('0x76')];}};Preview['prototype']['syncOriginateResponse']=function(_0x12be8e){var _0x1b8709=this;var _0x44745d=this[_0x8122('0x13')][_0x12be8e[_0x8122('0x134')]];if(_0x44745d){if(_0x44745d[_0x8122('0xf5')]&&this[_0x8122('0x14')][_0x44745d[_0x8122('0xf5')]]){ut[_0x8122('0x135')](_0x44745d,this[_0x8122('0x14')][_0x44745d['lookAgent']][_0x8122('0x26')],this[_0x8122('0x14')][_0x44745d[_0x8122('0xf5')]]['id']);}var _0x14a847=_['clone'](_0x44745d);_0x14a847['responsetime']=moment()[_0x8122('0x8d')](_0x8122('0x130'));var _0x430138=_0x1b8709[_0x8122('0x22')][_0x44745d[_0x8122('0x6e')]];if(ut[_0x8122('0x136')](_0x12be8e[_0x8122('0x137')])){if(_0x44745d['unlockAgent']){rpcDb[_0x8122('0x10a')](_0x44745d[_0x8122('0xfa')]);}if(_0x44745d[_0x8122('0xa8')]){rpcDb[_0x8122('0x8b')](_0x44745d[_0x8122('0xfa')]);}ami['emit']('custom:agentringnoanswer',ut[_0x8122('0xb0')](_0x44745d,_0x8122('0x138'),this[_0x8122('0x22')][_0x44745d[_0x8122('0x6e')]]));this[_0x8122('0xe4')](_0x14a847,_0x430138,_0x12be8e);}else{_0x44745d['starttime']=moment()[_0x8122('0x8d')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x14a847,0x4,_0x8122('0xb6'));rpcDb['createAgentHistory'](_0x14a847,_0x8122('0x139'));}}};Preview[_0x8122('0x64')]['syncHangup']=function(_0x390f33){var _0x3619ef=this;var _0x52aa2f=this[_0x8122('0x13')][_0x390f33[_0x8122('0xbc')]];var _0x4f3ff3;if(_0x52aa2f){_0x4f3ff3=this[_0x8122('0x22')][_0x52aa2f[_0x8122('0x6e')]];logger['info']('[syncHangup][talking]',_0x390f33[_0x8122('0xbc')],_0x8122('0xae'),_0x4f3ff3[_0x8122('0x26')],_0x8122('0x6f'),_0x4f3ff3[_0x8122('0x5d')]);}if(this[_0x8122('0x13')][_0x390f33[_0x8122('0xbc')]]&&_0x390f33['linkedid']!==_0x390f33[_0x8122('0xad')]){if(_0x390f33[_0x8122('0x13a')]==='16'&&this[_0x8122('0x13')][_0x390f33[_0x8122('0xbc')]][_0x8122('0x70')]){this[_0x8122('0x9b')](_0x390f33,_0x390f33[_0x8122('0xbc')],_0x390f33[_0x8122('0x13a')]);}else if(this[_0x8122('0x13')][_0x390f33[_0x8122('0xbc')]][_0x8122('0x70')]){logger[_0x8122('0x58')](_0x8122('0x13b'),_0x390f33[_0x8122('0xbc')],_0x390f33[_0x8122('0x13a')],_0x8122('0xae'),_0x4f3ff3['name'],_0x8122('0x6f'),_0x4f3ff3[_0x8122('0x5d')]);this[_0x8122('0x9b')](_0x390f33,_0x390f33['linkedid'],_0x390f33[_0x8122('0x13a')]);}}else if(_0x52aa2f&&_[_0x8122('0x6b')](_0x52aa2f[_0x8122('0x13c')])&&_0x4f3ff3[_0x8122('0x13d')]&&_0x390f33['linkedid']===_0x390f33['uniqueid']&&_[_0x8122('0x6b')](_0x390f33[_0x8122('0xe7')])&&_0x390f33[_0x8122('0x13a')]==='16'&&_0x390f33[_0x8122('0x13e')]==='6'&&_[_0x8122('0xe5')](_0x52aa2f[_0x8122('0x13f')])){if(_0x52aa2f[_0x8122('0xc5')]){rpcDb['unlockContact'](_0x52aa2f[_0x8122('0xfa')]);}if(_0x52aa2f[_0x8122('0xa8')]){rpcDb[_0x8122('0x8b')](_0x52aa2f[_0x8122('0xfa')]);}_0x390f33[_0x8122('0xe7')]='22';this[_0x8122('0xe4')](_0x52aa2f,_0x4f3ff3,_0x390f33);}else if(_0x52aa2f&&_0x52aa2f['transfer']){if(_0x390f33[_0x8122('0x13a')]==='16'&&this['actions'][_0x390f33[_0x8122('0xbc')]]['dialAnswer']){logger[_0x8122('0x58')]('[syncHangup][talking][transfer]',_0x390f33[_0x8122('0xbc')],_0x390f33[_0x8122('0x13a')],'\x20Queue',_0x4f3ff3[_0x8122('0x26')],_0x8122('0x6f'),_0x4f3ff3['pTalking']);this[_0x8122('0x9b')](_0x390f33,_0x390f33[_0x8122('0xbc')],_0x390f33[_0x8122('0x13a')]);}else if(this[_0x8122('0x13')][_0x390f33[_0x8122('0xbc')]]['dialAnswer']){logger[_0x8122('0x58')](_0x8122('0x13b'),_0x390f33[_0x8122('0xbc')],_0x390f33[_0x8122('0x13a')],_0x8122('0xae'),_0x4f3ff3[_0x8122('0x26')],'pTalking:\x20',_0x4f3ff3[_0x8122('0x5d')]);this[_0x8122('0x9b')](_0x390f33,_0x390f33['linkedid'],_0x390f33[_0x8122('0x13a')]);}}};Preview['prototype'][_0x8122('0x1c')]=function(_0x57b924){if(this['actions'][_0x57b924[_0x8122('0xe3')]]&&_0x57b924[_0x8122('0xe3')]!==_0x57b924['destuniqueid']){this[_0x8122('0x9b')](_0x57b924,_0x57b924[_0x8122('0xe3')],_0x57b924[_0x8122('0x140')]);}};Preview[_0x8122('0x64')]['syncHangupRequest']=function(_0x18b7cc){if(this[_0x8122('0x13')][_0x18b7cc[_0x8122('0xbc')]]&&_0x18b7cc[_0x8122('0xbc')]!==_0x18b7cc[_0x8122('0xad')]&&!this[_0x8122('0x13')][_0x18b7cc[_0x8122('0xbc')]][_0x8122('0x70')]){if(_0x18b7cc[_0x8122('0x13a')]==='1'){this['callProgressDetectingCustomer'](_0x18b7cc,_0x18b7cc[_0x8122('0xbc')],_0x18b7cc['cause']);}}};Preview['prototype'][_0x8122('0x141')]=function(_0xb5c337,_0x229e24,_0x366ca3){if(this[_0x8122('0x13')][_0xb5c337]){if(_[_0x8122('0x6b')](this['actions'][_0xb5c337]['variables'])){this[_0x8122('0x13')][_0xb5c337][_0x8122('0x142')]={};}this['actions'][_0xb5c337]['variables'][_0x229e24]=_0x366ca3;}};Preview['prototype'][_0x8122('0x143')]=function(_0x28f66f){try{if(!_[_0x8122('0x6b')](_0x28f66f)){if(ut[_0x8122('0x144')](_['keys'](_0x28f66f[_0x8122('0x145')])[0x0])){this[_0x8122('0x141')](_0x28f66f['uniqueid'],_[_0x8122('0x146')](_0x28f66f['variable'])[0x0],_0x28f66f[_0x8122('0x147')]);}}}catch(_0x5e1b52){logger[_0x8122('0x148')]('[syncVarSet][Preview]',util[_0x8122('0x149')](_0x5e1b52,{'showHidden':![],'depth':null}));}};Preview[_0x8122('0x64')][_0x8122('0x14a')]=function(_0x339c9a){if(_0x339c9a){if(this[_0x8122('0x13')][_0x339c9a['transfertargetlinkedid']]){this[_0x8122('0x13')][_0x339c9a[_0x8122('0x14b')]][_0x8122('0x13f')]=!![];}}};Preview['prototype'][_0x8122('0x21')]=function(_0x1732a1){if(_0x1732a1){if(this[_0x8122('0x13')][_0x1732a1[_0x8122('0x14c')]]){this[_0x8122('0x13')][_0x1732a1['transfererlinkedid']][_0x8122('0x13f')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x9f0e=['outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','emit','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','clockClearZombieChannels','clearZombieChannels','recallMe','clearZombieChannel','[clearZombieChannels][talking]','originated:\x20','queue','originated','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','Action','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','isNil','length','scheduledat','dialRecallMeTimeout','Agent','then','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','[HistoryDialRecallInQueue][historyCatch]','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialGlobalMaxRetry','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','buildObj','connect','acw','buildAcw','complete','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','dialBusyMaxRetry','rescheduleContact','countbusyretry','NOANSWER','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','activeContact','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialBusyRetryFrequency','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','checkInBlack','Contact','phone','lookAgent','isEmpty','Queue:\x20','\x20IdHopper:\x20','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','run','execRun','pick','unlock','unlockContact','getContactPreview','recallme','isValid','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Queue','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','execCall','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','[originated][increment]','OriginateError','syncOriginateResponse','actionid','logLookAgent','isFailure','response','idContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','dialstatus','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','../../../config/environment','../../../config/logger','preview','actionPreview','./action','./util/util','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','voiceQueues','trunks','actions','agents','originateresponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','outbound','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay'];(function(_0x56ebdb,_0x2cd97d){var _0x4f9579=function(_0x37e5e0){while(--_0x37e5e0){_0x56ebdb['push'](_0x56ebdb['shift']());}};_0x4f9579(++_0x2cd97d);}(_0x9f0e,0x116));var _0xe9f0=function(_0x27c820,_0x5707c1){_0x27c820=_0x27c820-0x0;var _0x4da263=_0x9f0e[_0x27c820];return _0x4da263;};'use strict';var util=require(_0xe9f0('0x0'));var _=require(_0xe9f0('0x1'));var BPromise=require(_0xe9f0('0x2'));var uuid=require(_0xe9f0('0x3'));var moment=require(_0xe9f0('0x4'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xe9f0('0x5'));var logger=require(_0xe9f0('0x6'))(_0xe9f0('0x7'));var loggerAction=require(_0xe9f0('0x6'))(_0xe9f0('0x8'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require(_0xe9f0('0x9'));var ut=require(_0xe9f0('0xa'));config[_0xe9f0('0xb')]=_['defaults'](config[_0xe9f0('0xb')],{'host':_0xe9f0('0xc'),'port':0x18eb});var io=require(_0xe9f0('0xd'))(new Redis(config[_0xe9f0('0xb')]));var Sequence=function(){};Sequence[_0xe9f0('0xe')][_0xe9f0('0xf')]=function(_0x807322){this[_0xe9f0('0x10')]=this[_0xe9f0('0x10')]?this['tail'][_0xe9f0('0x11')](_0x807322):_0x807322();};function Preview(_0x329ecd){this[_0xe9f0('0x12')]=new Sequence();this['campaignsPreview']=_0x329ecd[_0xe9f0('0x13')];this['trunks']=_0x329ecd[_0xe9f0('0x14')];this[_0xe9f0('0x15')]={};this[_0xe9f0('0x16')]=_0x329ecd[_0xe9f0('0x16')];this['clockClearZombieChannels']=0x0;ami['on'](_0xe9f0('0x17'),this['syncOriginateResponse'][_0xe9f0('0x18')](this));ami['on'](_0xe9f0('0x19'),this[_0xe9f0('0x1a')]['bind'](this));ami['on'](_0xe9f0('0x1b'),this[_0xe9f0('0x1c')][_0xe9f0('0x18')](this));ami['on']('dialend',this[_0xe9f0('0x1d')][_0xe9f0('0x18')](this));ami['on'](_0xe9f0('0x1e'),this[_0xe9f0('0x1f')][_0xe9f0('0x18')](this));ami['on'](_0xe9f0('0x20'),this[_0xe9f0('0x21')]['bind'](this));ami['on'](_0xe9f0('0x22'),this[_0xe9f0('0x23')][_0xe9f0('0x18')](this));ami['on']('blindtransfer',this[_0xe9f0('0x24')][_0xe9f0('0x18')](this));this[_0xe9f0('0x25')](this[_0xe9f0('0x26')]);}function emit(_0x5ba788,_0x33f143,_0xfaa312){io['to'](_0x5ba788)['emit'](_0x33f143,_0xfaa312);}function emitCampaignPreview(_0x51e03f){if(_0x51e03f['type']===_0xe9f0('0x27')){var _0xa1ddc={'id':_0x51e03f['id'],'name':_0x51e03f[_0xe9f0('0x28')],'strategy':_0x51e03f[_0xe9f0('0x29')],'answered':_0x51e03f[_0xe9f0('0x2a')],'available':_0x51e03f['available'],'loggedIn':_0x51e03f[_0xe9f0('0x2b')],'pTalking':_0x51e03f[_0xe9f0('0x2c')],'sumBillable':_0x51e03f[_0xe9f0('0x2d')],'sumDuration':_0x51e03f[_0xe9f0('0x2e')],'sumHoldTime':_0x51e03f[_0xe9f0('0x2f')]||0x0,'talking':_0x51e03f[_0xe9f0('0x30')],'total':_0x51e03f[_0xe9f0('0x31')],'type':_0x51e03f[_0xe9f0('0x32')],'unmanaged':_0x51e03f[_0xe9f0('0x33')],'abandoned':_0x51e03f[_0xe9f0('0x34')],'waiting':_0x51e03f['waiting'],'loggedInDb':_0x51e03f[_0xe9f0('0x35')],'dialActive':_0x51e03f[_0xe9f0('0x36')],'dialMethod':_0x51e03f[_0xe9f0('0x37')],'dialOriginateCallerIdName':_0x51e03f[_0xe9f0('0x38')],'dialOriginateCallerIdNumber':_0x51e03f['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x51e03f[_0xe9f0('0x39')],'dialPrefix':_0x51e03f[_0xe9f0('0x3a')],'outboundAnswerAgiCallsDay':_0x51e03f[_0xe9f0('0x3b')],'outboundAnswerCallsDay':_0x51e03f[_0xe9f0('0x3c')],'outboundBlacklistCallsDay':_0x51e03f[_0xe9f0('0x3d')],'outboundBusyCallsDay':_0x51e03f['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x51e03f[_0xe9f0('0x3e')],'outboundDropCallsDayACS':_0x51e03f[_0xe9f0('0x3f')],'outboundDropCallsDayCallersExit':_0x51e03f[_0xe9f0('0x40')],'outboundDropCallsDayTimeout':_0x51e03f[_0xe9f0('0x41')],'outboundNoAnswerCallsDay':_0x51e03f[_0xe9f0('0x42')],'outboundNoSuchCallsDay':_0x51e03f[_0xe9f0('0x43')],'outboundOriginateFailureCallsDay':_0x51e03f[_0xe9f0('0x44')],'outboundReCallsDay':_0x51e03f[_0xe9f0('0x45')],'outboundRejectCallsDay':_0x51e03f[_0xe9f0('0x46')],'outboundUnknownCallsDay':_0x51e03f[_0xe9f0('0x47')],'outboundAbandonedCallsDay':_0x51e03f[_0xe9f0('0x48')],'predictiveIntervalAnsweredCalls':_0x51e03f[_0xe9f0('0x49')],'predictiveIntervalAvgHoldtime':_0x51e03f[_0xe9f0('0x4a')],'predictiveIntervalAvgTalktime':_0x51e03f[_0xe9f0('0x4b')],'predictiveIntervalDroppedCallsCallersExit':_0x51e03f[_0xe9f0('0x4c')],'predictiveIntervalDroppedCallsTimeout':_0x51e03f[_0xe9f0('0x4d')],'predictiveIntervalErlangCalls':_0x51e03f[_0xe9f0('0x4e')],'predictiveIntervalErlangCallsDroppedCalls':_0x51e03f[_0xe9f0('0x4f')],'predictiveIntervalHitRate':_0x51e03f[_0xe9f0('0x50')],'predictiveIntervalMultiplicativeFactor':_0x51e03f[_0xe9f0('0x51')],'predictiveIntervalPauses':_0x51e03f[_0xe9f0('0x52')],'predictiveIntervalAvailable':_0x51e03f[_0xe9f0('0x53')],'predictiveIntervalTotalCalls':_0x51e03f[_0xe9f0('0x54')],'message':_0x51e03f[_0xe9f0('0x55')],'originated':_0x51e03f['originated'],'erlangCalls':_0x51e03f['erlangCalls'],'erlangCallToSecond':_0x51e03f['erlangCallToSecond'],'erlangAbandonmentRate':_0x51e03f[_0xe9f0('0x56')],'erlangBusyFactor':_0x51e03f['erlangBusyFactor'],'startPredictive':_0x51e03f[_0xe9f0('0x57')],'startProgressive':_0x51e03f[_0xe9f0('0x58')]};if(_0x51e03f['Trunk']){_0xa1ddc[_0xe9f0('0x59')]={'id':_0x51e03f['Trunk']['id'],'name':_0x51e03f['Trunk']['name'],'active':_0x51e03f[_0xe9f0('0x59')][_0xe9f0('0x5a')],'callerid':_0x51e03f['Trunk'][_0xe9f0('0x5b')]};}if(_0x51e03f[_0xe9f0('0x5c')]){_0xa1ddc[_0xe9f0('0x5c')]={'id':_0x51e03f['Interval']['id'],'name':_0x51e03f['Interval'][_0xe9f0('0x28')]};}var _0x3ff42d=md5(JSON[_0xe9f0('0x5d')](_0xa1ddc));if(_0x51e03f['md5']!==_0x3ff42d){_0x51e03f[_0xe9f0('0x5e')]=_0x3ff42d;emit(util[_0xe9f0('0x5f')](_0xe9f0('0x60'),_0xa1ddc[_0xe9f0('0x28')]),_0xe9f0('0x61'),_0xa1ddc);}}}function emitVoiceQueueChannelRemove(_0x552ec2){logger[_0xe9f0('0x62')](_0xe9f0('0x63'),JSON[_0xe9f0('0x5d')](_0x552ec2));emit(util['format'](_0xe9f0('0x60'),_0x552ec2[_0xe9f0('0x28')]),'voice_queue_channel:remove',_0x552ec2);this[_0xe9f0('0x64')]('voice_queue_presence:remove',_0x552ec2);}function notSendMessagesQueue(_0x56c03e){if(_0x56c03e['sendMessageOneNotActive']){if(_0x56c03e['originated']===0x0&&_0x56c03e['pTalking']===0x0){_0x56c03e['sendMessageOneNotActive']=![];_0x56c03e['available']=0x0;_0x56c03e[_0xe9f0('0x65')]=0x0;_0x56c03e[_0xe9f0('0x55')]=_0xe9f0('0x66');ut[_0xe9f0('0x67')](_0xe9f0('0x68'),_0x56c03e[_0xe9f0('0x28')]+_0xe9f0('0x69'));}else{_0x56c03e[_0xe9f0('0x55')]=_0xe9f0('0x6a');ut['logger'](_0xe9f0('0x68'),_0x56c03e[_0xe9f0('0x28')]+_0xe9f0('0x6b'));}emitCampaignPreview(_0x56c03e);}}Preview['prototype']['loopCampaigns']=function(){var _0x3cbf49=this;setInterval(function(){_0x3cbf49['syncCampaigns']();},0x7cf);};Preview[_0xe9f0('0xe')][_0xe9f0('0x6c')]=function(){var _0x314f0e=this[_0xe9f0('0x26')];this['clockClearZombieChannels']+=0x1;for(var _0x123739 in _0x314f0e){if(_0x314f0e[_0xe9f0('0x6d')](_0x123739)&&(_0x314f0e[_0x123739][_0xe9f0('0x37')]===_0xe9f0('0x7')||_0x314f0e[_0x123739][_0xe9f0('0x37')]==='booked')&&_0x314f0e[_0x123739][_0xe9f0('0x32')]===_0xe9f0('0x27')){if(this[_0xe9f0('0x6e')]>0x7){this[_0xe9f0('0x6e')]=0x0;this[_0xe9f0('0x6f')]();}}if(_0x314f0e['hasOwnProperty'](_0x123739)&&_0x314f0e[_0x123739][_0xe9f0('0x37')]==='preview'&&_0x314f0e[_0x123739]['type']===_0xe9f0('0x27')){if(_0x314f0e[_0x123739][_0xe9f0('0x36')]){this['setMessage'](_0x314f0e[_0x123739]);this[_0xe9f0('0x70')](_0x314f0e[_0x123739]);}else{notSendMessagesQueue(_0x314f0e[_0x123739]);}}}};Preview[_0xe9f0('0xe')][_0xe9f0('0x71')]=function(_0x7b167b){var _0xdf4173=this;this[_0xe9f0('0x12')][_0xe9f0('0xf')](function(){if(!_['isNil'](_0xdf4173[_0xe9f0('0x15')][_0x7b167b])){loggerAction['info'](_0xe9f0('0x72'),_0x7b167b,'Queue',_0xdf4173[_0xe9f0('0x15')][_0x7b167b]['queue'],_0xe9f0('0x73'),JSON[_0xe9f0('0x5d')](_0xdf4173[_0xe9f0('0x26')][_0xdf4173['actions'][_0x7b167b][_0xe9f0('0x74')]][_0xe9f0('0x75')]),_0xe9f0('0x76'),JSON[_0xe9f0('0x5d')](_0xdf4173[_0xe9f0('0x26')][_0xdf4173[_0xe9f0('0x15')][_0x7b167b][_0xe9f0('0x74')]][_0xe9f0('0x2c')]),JSON[_0xe9f0('0x5d')](_0xdf4173[_0xe9f0('0x15')][_0x7b167b][_0xe9f0('0x77')]),JSON[_0xe9f0('0x5d')](_['pick'](_0xdf4173['actions'][_0x7b167b],[_0xe9f0('0x78'),_0xe9f0('0x79'),_0xe9f0('0x7a'),'ListId'])));return ami[_0xe9f0('0x7b')]({'action':'status','channel':_0xdf4173[_0xe9f0('0x15')][_0x7b167b][_0xe9f0('0x7c')]})[_0xe9f0('0x7d')](function(_0x4e8416){if(_0x4e8416['message']===_0xe9f0('0x7e')){setTimeout(function(){if(_0xdf4173[_0xe9f0('0x15')][_0x7b167b]){ut['updateOriginated'](_0xdf4173[_0xe9f0('0x26')][_0xdf4173[_0xe9f0('0x15')][_0x7b167b][_0xe9f0('0x74')]],_0xe9f0('0x7f'));if(_0xdf4173['actions'][_0x7b167b][_0xe9f0('0x77')]===!![]){ut[_0xe9f0('0x80')](_0xdf4173[_0xe9f0('0x26')][_0xdf4173[_0xe9f0('0x15')][_0x7b167b][_0xe9f0('0x74')]],_0xe9f0('0x7f'));ut[_0xe9f0('0x81')](_0xe9f0('0x82')+_0x7b167b,_0xdf4173['actions'][_0x7b167b][_0xe9f0('0x74')]);}ut[_0xe9f0('0x81')](_0xe9f0('0x83')+_0x7b167b,_0xdf4173[_0xe9f0('0x15')][_0x7b167b][_0xe9f0('0x74')]);delete _0xdf4173[_0xe9f0('0x15')][_0x7b167b];}},0x2328);}});}});};Preview[_0xe9f0('0xe')][_0xe9f0('0x6f')]=function(){var _0xd780f5=this;loggerAction[_0xe9f0('0x62')](_0xe9f0('0x84'),_[_0xe9f0('0x85')](this[_0xe9f0('0x15')]));for(var _0x421891 in this['actions']){if(_0xd780f5[_0xe9f0('0x15')][_0xe9f0('0x6d')](_0x421891)){_0xd780f5[_0xe9f0('0x71')](_0x421891);}}};Preview['prototype']['recallMe']=function(_0x416308){var _0x57b904=this;rpcDb[_0xe9f0('0x86')](_0x416308['id'],ut[_0xe9f0('0x87')](this[_0xe9f0('0x16')]))['then'](function(_0x41a030){if(!_[_0xe9f0('0x88')](_0x41a030)){for(var _0x954616=0x0;_0x954616<_0x41a030[_0xe9f0('0x89')];_0x954616+=0x1){if(ut['getDiff'](_0x41a030[_0x954616][_0xe9f0('0x8a')])<_0x416308[_0xe9f0('0x8b')]*0x3c){if(_0x41a030[_0x954616][_0xe9f0('0x8c')]&&!_0x41a030[_0x954616][_0xe9f0('0x8c')]['voicePause']){_0x57b904['run'](_0x41a030[_0x954616]['id'])[_0xe9f0('0x8d')](ut[_0xe9f0('0x8e')](_0xe9f0('0x8f')))[_0xe9f0('0x7d')](ut[_0xe9f0('0x8e')]('[RecallMe]'));}else{rpcDb[_0xe9f0('0x90')](_0x41a030[_0x954616]['id']);}}else{var _0x55ce2d=new Action(_0x41a030[_0x954616],_0x416308);_0x55ce2d[_0xe9f0('0x91')]=moment()['format'](_0xe9f0('0x92'));_0x416308[_0xe9f0('0x45')]+=0x1;ut[_0xe9f0('0x93')](_0x55ce2d,0x17,_0xe9f0('0x94'));if(_0x416308[_0xe9f0('0x95')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x41a030[_0x954616]));rpcDb['createCustomerHistory'](_0x55ce2d,_0xe9f0('0x96'));}else{ut[_0xe9f0('0x93')](_0x55ce2d,0x16,'RecallFailedTimeout');rpcDb[_0xe9f0('0x97')](_0x55ce2d,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x55ce2d,_0xe9f0('0x98'));}}}}})[_0xe9f0('0x7d')](ut[_0xe9f0('0x8e')](_0xe9f0('0x99')));};Preview[_0xe9f0('0xe')][_0xe9f0('0x9a')]=function(_0x494efc){_0x494efc['sendMessageOneNotActive']=!![];if(ut[_0xe9f0('0x9b')](_0x494efc[_0xe9f0('0x2b')])){_0x494efc[_0xe9f0('0x55')]=_0xe9f0('0x9c');}else if(!ut['isActive'](_0x494efc[_0xe9f0('0x36')])){_0x494efc[_0xe9f0('0x55')]=_0xe9f0('0x66');}else if(!this[_0xe9f0('0x9d')](_0x494efc[_0xe9f0('0x59')])){if(!this[_0xe9f0('0x9d')](_0x494efc['TrunkBackup'])){_0x494efc[_0xe9f0('0x55')]=_0xe9f0('0x9e');}else{_0x494efc[_0xe9f0('0x55')]=_0xe9f0('0x9f');}}else{_0x494efc[_0xe9f0('0x55')]='ACTIVE';}emitCampaignPreview(_0x494efc);};Preview[_0xe9f0('0xe')][_0xe9f0('0xa0')]=function(_0x388091,_0x2e2ac7,_0x214ac0){var _0x42aab8=this;var _0x454797=this[_0xe9f0('0x15')][_0x2e2ac7];var _0x2eaead=this[_0xe9f0('0x26')][_0x454797[_0xe9f0('0x74')]];var _0x3bb16d;if(_0x2eaead){switch(_0x214ac0){case'1':_0x2eaead['outboundNoSuchCallsDay']+=0x1;_0x454797[_0xe9f0('0xa1')]+=0x1;_0x454797[_0xe9f0('0xa2')]=ut[_0xe9f0('0xa3')](_0x454797);ut[_0xe9f0('0x93')](_0x454797,0x0,_0xe9f0('0xa4'));ami[_0xe9f0('0x64')](_0xe9f0('0xa5'),ut['buildObj'](_0x454797,_0xe9f0('0xa6')));rpcDb[_0xe9f0('0x97')](_0x454797,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0xe9f0('0xa3')](_0x454797)>=_0x2eaead[_0xe9f0('0xa7')]){_0x3bb16d=ut[_0xe9f0('0xa8')](_0x454797,0xf,'Global');rpcDb[_0xe9f0('0xa9')](_0x3bb16d,_0xe9f0('0xaa'));}else{if(_0x454797['countnosuchnumberretry']>=_0x2eaead[_0xe9f0('0xab')]){rpcDb[_0xe9f0('0xa9')](_0x454797,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut[_0xe9f0('0xac')](_0x454797,'countnosuchnumberretry',_0x2eaead[_0xe9f0('0xad')]),_0x454797[_0xe9f0('0xae')],_0x454797['activeContact']);}}delete this[_0xe9f0('0x15')][_0x388091[_0xe9f0('0xaf')]];break;case _0xe9f0('0xb0'):var _0x300fae=moment()[_0xe9f0('0x5f')](_0xe9f0('0x92'));_0x454797[_0xe9f0('0xb1')]=_0x300fae;_0x454797[_0xe9f0('0xb2')]=_0x300fae;_0x454797[_0xe9f0('0x77')]=!![];_0x2eaead['pTalking']+=0x1;logger[_0xe9f0('0x62')](_0xe9f0('0xb3'),_0x454797[_0xe9f0('0xb4')],_0xe9f0('0xb5'),_0x2eaead[_0xe9f0('0x28')],_0xe9f0('0x76'),_0x2eaead[_0xe9f0('0x2c')]);ami[_0xe9f0('0x64')]('custom:agentconnect',ut[_0xe9f0('0xb6')](_0x454797,_0xe9f0('0xb7'),this[_0xe9f0('0x26')][_0x454797[_0xe9f0('0x74')]]));if(_0x2eaead[_0xe9f0('0xb8')]){ami[_0xe9f0('0x64')]('custom:agentConnectPreview',ut[_0xe9f0('0xb9')](_0x454797));}break;case'16':ami['emit']('custom:agentcomplete',ut['buildObj'](_0x454797,_0xe9f0('0xba'),this[_0xe9f0('0x26')][_0x454797[_0xe9f0('0x74')]]));emitVoiceQueueChannelRemove(ut[_0xe9f0('0xb6')](_0x454797,_0xe9f0('0xba')));_0x2eaead[_0xe9f0('0x3c')]+=0x1;_0x2eaead[_0xe9f0('0x31')]+=0x1;_0x2eaead[_0xe9f0('0x2a')]+=0x1;ut[_0xe9f0('0x80')](_0x2eaead,'[16]');_0x454797[_0xe9f0('0xa2')]=ut[_0xe9f0('0xa3')](_0x454797);ut[_0xe9f0('0x93')](_0x454797,0x4,_0xe9f0('0xbb'));rpcDb[_0xe9f0('0x97')](_0x454797,_0xe9f0('0xbc'));rpcDb[_0xe9f0('0xa9')](_0x454797,_0xe9f0('0xbd'));rpcDb[_0xe9f0('0xbe')](_0x454797);_0x2eaead[_0xe9f0('0x2e')]+=_0x454797['talktime'];_0x2eaead['sumBillable']+=_0x454797[_0xe9f0('0xbf')];logger[_0xe9f0('0x62')](_0xe9f0('0xc0'),_0x454797[_0xe9f0('0xb4')],_0xe9f0('0xb5'),_0x2eaead[_0xe9f0('0x28')],_0xe9f0('0x76'),_0x2eaead[_0xe9f0('0x2c')]);delete this['actions'][_0x388091['linkedid']];break;case _0xe9f0('0xc1'):_0x2eaead[_0xe9f0('0xc2')]+=0x1;_0x454797['countbusyretry']+=0x1;_0x454797['countglobal']=ut[_0xe9f0('0xa3')](_0x454797);ut[_0xe9f0('0x93')](_0x454797,0x5,_0xe9f0('0xc3'));ami[_0xe9f0('0x64')](_0xe9f0('0xc4'),ut['buildObj'](_0x454797,_0xe9f0('0xc5')));rpcDb[_0xe9f0('0x97')](_0x454797,_0xe9f0('0xc6'));if(ut[_0xe9f0('0xa3')](_0x454797)>=_0x2eaead[_0xe9f0('0xa7')]){_0x3bb16d=ut[_0xe9f0('0xa8')](_0x454797,0xf,_0xe9f0('0xc7'));rpcDb['createCustomerFinal'](_0x3bb16d,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x454797['countbusyretry']>=_0x2eaead[_0xe9f0('0xc8')]){rpcDb[_0xe9f0('0xa9')](_0x454797,_0xe9f0('0xc6'));}else{rpcDb[_0xe9f0('0xc9')](ut['scheduledAt'](_0x454797,_0xe9f0('0xca'),_0x2eaead['dialBusyRetryFrequency']),_0x454797[_0xe9f0('0xae')],_0x454797['activeContact']);}}break;case _0xe9f0('0xcb'):_0x2eaead[_0xe9f0('0x42')]+=0x1;_0x454797[_0xe9f0('0xcc')]+=0x1;_0x454797[_0xe9f0('0xa2')]=ut[_0xe9f0('0xa3')](_0x454797);ut[_0xe9f0('0x93')](_0x454797,0x3,'NoAnswer');ami[_0xe9f0('0x64')](_0xe9f0('0xcd'),ut[_0xe9f0('0xb6')](_0x454797,_0xe9f0('0xce')));rpcDb[_0xe9f0('0x97')](_0x454797,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0xe9f0('0xa3')](_0x454797)>=_0x2eaead[_0xe9f0('0xa7')]){_0x3bb16d=ut['cloneAction'](_0x454797,0xf,_0xe9f0('0xc7'));rpcDb['createCustomerFinal'](_0x3bb16d,_0xe9f0('0xcf'));}else{if(_0x454797[_0xe9f0('0xcc')]>=_0x2eaead[_0xe9f0('0xd0')]){rpcDb['createCustomerFinal'](_0x454797,_0xe9f0('0xd1'));}else{rpcDb[_0xe9f0('0xc9')](ut[_0xe9f0('0xac')](_0x454797,'countnoanswerretry',_0x2eaead[_0xe9f0('0xd2')]),_0x454797[_0xe9f0('0xae')],_0x454797[_0xe9f0('0xd3')]);}}break;case _0xe9f0('0xd4'):_0x2eaead[_0xe9f0('0x3e')]+=0x1;_0x454797[_0xe9f0('0xd5')]+=0x1;_0x454797[_0xe9f0('0xa2')]=ut['totalGlobal'](_0x454797);ut['logCustomer'](_0x454797,0x8,_0xe9f0('0xd6'));ami[_0xe9f0('0x64')](_0xe9f0('0xd7'),ut['buildObj'](_0x454797,_0xe9f0('0xd8')));rpcDb[_0xe9f0('0x97')](_0x454797,_0xe9f0('0xd9'));if(ut[_0xe9f0('0xa3')](_0x454797)>=_0x2eaead['dialGlobalMaxRetry']){_0x3bb16d=ut['cloneAction'](_0x454797,0xf,_0xe9f0('0xc7'));rpcDb[_0xe9f0('0xa9')](_0x3bb16d,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x454797[_0xe9f0('0xd5')]>=_0x2eaead['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0x454797,_0xe9f0('0xd9'));}else{rpcDb[_0xe9f0('0xc9')](ut[_0xe9f0('0xac')](_0x454797,_0xe9f0('0xd5'),_0x2eaead[_0xe9f0('0xda')]),_0x454797['unlockAgent'],_0x454797['activeContact']);}}break;case _0xe9f0('0xdb'):_0x2eaead[_0xe9f0('0x46')]+=0x1;_0x454797[_0xe9f0('0xdc')]+=0x1;_0x454797[_0xe9f0('0xa2')]=ut[_0xe9f0('0xa3')](_0x454797);ut['logCustomer'](_0x454797,0x14,'AgentReject');ami['emit'](_0xe9f0('0xdd'),ut['buildObj'](_0x454797,_0xe9f0('0xde')));rpcDb[_0xe9f0('0x97')](_0x454797,_0xe9f0('0xdf'));if(ut[_0xe9f0('0xa3')](_0x454797)>=_0x2eaead[_0xe9f0('0xa7')]){_0x3bb16d=ut[_0xe9f0('0xa8')](_0x454797,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x3bb16d,_0xe9f0('0xe0'));}else{if(_0x454797[_0xe9f0('0xdc')]>=_0x2eaead[_0xe9f0('0xe1')]){rpcDb[_0xe9f0('0xa9')](_0x454797,_0xe9f0('0xe0'));}else{rpcDb[_0xe9f0('0xc9')](ut[_0xe9f0('0xac')](_0x454797,_0xe9f0('0xdc'),_0x2eaead[_0xe9f0('0xe2')]),_0x454797[_0xe9f0('0xae')],_0x454797[_0xe9f0('0xd3')]);}}break;case _0xe9f0('0xe3'):_0x2eaead[_0xe9f0('0x48')]+=0x1;_0x454797[_0xe9f0('0xe4')]+=0x1;_0x454797['countglobal']=ut[_0xe9f0('0xa3')](_0x454797);ut[_0xe9f0('0x93')](_0x454797,0xb,_0xe9f0('0xe5'));rpcDb[_0xe9f0('0x97')](_0x454797,_0xe9f0('0xe6'));if(ut[_0xe9f0('0xa3')](_0x454797)>=_0x2eaead[_0xe9f0('0xa7')]){_0x3bb16d=ut[_0xe9f0('0xa8')](_0x454797,0xf,_0xe9f0('0xc7'));rpcDb[_0xe9f0('0xa9')](_0x3bb16d,_0xe9f0('0xe6'));}else{if(_0x454797['countabandonedetry']>=_0x2eaead[_0xe9f0('0xe7')]){rpcDb[_0xe9f0('0xa9')](_0x454797,_0xe9f0('0xe6'));}else{rpcDb[_0xe9f0('0xc9')](ut[_0xe9f0('0xac')](_0x454797,_0xe9f0('0xe4'),_0x2eaead[_0xe9f0('0xe8')]),_0x454797[_0xe9f0('0xae')],_0x454797['activeContact']);}}break;default:if(_0x454797['dialAnswer']){ut[_0xe9f0('0x80')](_0x2eaead,_0xe9f0('0xe9'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x2eaead[_0xe9f0('0x28')],_0x388091);}_0x2eaead[_0xe9f0('0x47')]+=0x1;_0x454797[_0xe9f0('0xa2')]=ut[_0xe9f0('0xa3')](_0x454797);ut[_0xe9f0('0x93')](_0x454797,0xc,_0x388091[_0xe9f0('0xea')]||_0x388091['dialstatus']);rpcDb[_0xe9f0('0x97')](_0x454797,_0xe9f0('0xeb'));if(ut['totalGlobal'](_0x454797)>=_0x2eaead['dialGlobalMaxRetry']){_0x3bb16d=ut[_0xe9f0('0xa8')](_0x454797,0xf,_0xe9f0('0xc7'));rpcDb['createCustomerFinal'](_0x3bb16d,_0xe9f0('0xec'));}else{rpcDb[_0xe9f0('0xa9')](_0x454797,_0xe9f0('0xec'));}delete this['actions'][_0x388091[_0xe9f0('0xaf')]];}if(!(_0x454797[_0xe9f0('0x77')]&&_0x214ac0==='16')){ut[_0xe9f0('0xed')](_0x2eaead,_0xe9f0('0xee'));logger['info'](_0xe9f0('0xef'),_0x454797[_0xe9f0('0xb4')],_0xe9f0('0xb5'),_0x2eaead['name'],'originated:\x20',_0x2eaead['originated']);}if(_0x214ac0!==_0xe9f0('0xb0')){delete this['actions'][_0x388091['linkedid']];delete this[_0xe9f0('0x15')][_0x388091['destlinkedid']];}}};Preview[_0xe9f0('0xe')][_0xe9f0('0xf0')]=function(_0x1b9ce2,_0x396c1d,_0x5aefe3){if(_[_0xe9f0('0xf1')](_0x396c1d)&&_0xe9f0('0xf2')!==typeof _0x396c1d){return;}if(_[_0xe9f0('0xf1')](_0x5aefe3)&&_0xe9f0('0xf2')!==typeof _0x5aefe3){return;}switch(_0x5aefe3[_0xe9f0('0xf3')]){case'0':ut[_0xe9f0('0xf4')](_0x1b9ce2,0x0,_0xe9f0('0xa4'));rpcDb[_0xe9f0('0xf5')](_0x1b9ce2,_0xe9f0('0xf6'));break;case'3':ut[_0xe9f0('0xf4')](_0x1b9ce2,0x3,_0xe9f0('0xf7'));rpcDb[_0xe9f0('0xf5')](_0x1b9ce2,_0xe9f0('0xf8'));break;case'5':ut['logAgent'](_0x1b9ce2,0x5,_0xe9f0('0xc3'));rpcDb[_0xe9f0('0xf5')](_0x1b9ce2,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x1b9ce2,0x8,_0xe9f0('0xd6'));rpcDb[_0xe9f0('0xf5')](_0x1b9ce2,_0xe9f0('0xf9'));break;case'22':ut[_0xe9f0('0xf4')](_0x1b9ce2,0x16,'AnswerAGI');rpcDb[_0xe9f0('0xf5')](_0x1b9ce2,_0xe9f0('0xfa'));break;default:ut[_0xe9f0('0xf4')](_0x1b9ce2,0xc,_0x5aefe3['reason']);rpcDb[_0xe9f0('0xf5')](_0x1b9ce2,_0xe9f0('0xf9'));}ut[_0xe9f0('0xed')](_0x396c1d,_0xe9f0('0xfb'));logger[_0xe9f0('0x62')]('[originated][decrement][callProgressDetectingAgent]',_0x1b9ce2['uniqueid'],_0xe9f0('0xb5'),_0x396c1d[_0xe9f0('0x28')],_0xe9f0('0x73'),_0x396c1d[_0xe9f0('0x75')]);delete this[_0xe9f0('0x15')][_0x1b9ce2[_0xe9f0('0xb4')]];};Preview[_0xe9f0('0xe')][_0xe9f0('0xfc')]=function(_0x5ae9f1,_0x1aacfa,_0x4eea8f,_0x52e33e,_0x34e820){var _0x2eecd5=this;return new BPromise(function(_0x36c171,_0x59396b){if(_[_0xe9f0('0x88')](_0x1aacfa)||_[_0xe9f0('0x88')](_0x1aacfa['Contact'])||_[_0xe9f0('0x88')](_0x1aacfa[_0xe9f0('0xfd')][_0xe9f0('0xfe')])||_[_0xe9f0('0x88')](_0x1aacfa['VoiceQueueId'])){_0x59396b(ut[_0xe9f0('0x55')]('Contact\x20is\x20undefined',_0x52e33e,_0x34e820));return;}var _0x116a65=uuid['v4']();var _0x56e47c=_0x2eecd5['campaignsPreview'][_0x1aacfa['Queue'][_0xe9f0('0x28')]];var _0x35c8b9=_0x4eea8f?_0x2eecd5['agents'][_0x4eea8f]['id']:undefined;_0x2eecd5[_0xe9f0('0x15')][_0x116a65]=new Action(_0x1aacfa,_0x56e47c,_0x116a65,_0x4eea8f,_0x35c8b9);var _0x165624=_0x2eecd5[_0xe9f0('0x15')][_0x116a65];_0x165624[_0xe9f0('0xae')]=_0x52e33e;_0x165624[_0xe9f0('0xd3')]=_0x34e820;_0x165624[_0xe9f0('0xff')]=_0x4eea8f;if(_[_0xe9f0('0x100')](_0x5ae9f1)){_0x2eecd5['execCall'](_0x165624,_0x56e47c,_0x1aacfa,_0x4eea8f)[_0xe9f0('0x8d')](function(_0x702bcf){logger[_0xe9f0('0x62')]('[Preview][execCall][success]',_0xe9f0('0x101')+_0x165624[_0xe9f0('0x74')]+_0xe9f0('0x102')+_0x165624['idContact'],JSON[_0xe9f0('0x5d')](_0x702bcf));ami[_0xe9f0('0x64')]('custom:agentcalled',ut[_0xe9f0('0xb6')](_0x165624,'called',_0x2eecd5[_0xe9f0('0x26')][_0x165624[_0xe9f0('0x74')]]));_0x36c171(ut[_0xe9f0('0x55')](_0xe9f0('0x103')));})[_0xe9f0('0x7d')](function(_0x305d2f){ut['logger'](_0xe9f0('0x104'),_0x305d2f);_0x59396b(ut[_0xe9f0('0x55')](_0xe9f0('0x105'),_0x52e33e,_0x34e820));});}else{_0x56e47c[_0xe9f0('0x3d')]+=0x1;ut[_0xe9f0('0x106')](_0x165624);rpcDb[_0xe9f0('0x107')](_0x165624,_0xe9f0('0x108'));delete _0x2eecd5['actions'][_0x116a65];_0x59396b(ut['message'](_0xe9f0('0x109'),_0x52e33e,_0x34e820));}});};Preview[_0xe9f0('0xe')]['isTrunkReachable']=function(_0x1b2017){return!_['isNil'](_0x1b2017)&&!_[_0xe9f0('0x88')](_0x1b2017[_0xe9f0('0x28')])&&!_['isNil'](_0x1b2017['active'])&&_0x1b2017[_0xe9f0('0x5a')]&&!_[_0xe9f0('0x88')](this[_0xe9f0('0x14')][util['format']('SIP/%s',_0x1b2017[_0xe9f0('0x28')])])&&!_[_0xe9f0('0x88')](this[_0xe9f0('0x14')][util[_0xe9f0('0x5f')](_0xe9f0('0x10a'),_0x1b2017[_0xe9f0('0x28')])][_0xe9f0('0x10b')])&&(this[_0xe9f0('0x14')][util[_0xe9f0('0x5f')](_0xe9f0('0x10a'),_0x1b2017[_0xe9f0('0x28')])][_0xe9f0('0x10b')]===_0xe9f0('0x10c')||this[_0xe9f0('0x14')][util['format'](_0xe9f0('0x10a'),_0x1b2017['name'])][_0xe9f0('0x10b')]===_0xe9f0('0x10d'));};Preview[_0xe9f0('0xe')][_0xe9f0('0x10e')]=function(_0x166ff4,_0xc9bbf7){var _0x297e2b=this;return new BPromise(function(_0x114c65,_0x5df944){_0x297e2b[_0xe9f0('0x10f')](_0x166ff4,_0xc9bbf7)[_0xe9f0('0x8d')](function(_0x27bf7d){_0x114c65(_[_0xe9f0('0x110')](_0x27bf7d,[_0xe9f0('0x55')]));})[_0xe9f0('0x7d')](function(_0x1095d8){if(_0x1095d8[_0xe9f0('0x111')]){rpcDb[_0xe9f0('0x112')](_0x166ff4);}if(_0x1095d8[_0xe9f0('0x5a')]){rpcDb[_0xe9f0('0x90')](_0x166ff4);}_0x5df944(_[_0xe9f0('0x110')](_0x1095d8,[_0xe9f0('0x55')]));});});};Preview[_0xe9f0('0xe')][_0xe9f0('0x10f')]=function(_0x23be5b,_0x59f266){var _0x430b27=this;return new BPromise(function(_0x224300,_0x51515a){var _0x4491a3,_0x1c5fee;rpcDb[_0xe9f0('0x113')](_0x23be5b)[_0xe9f0('0x8d')](function(_0x5c34fa){if(!_[_0xe9f0('0x88')](_0x5c34fa[0x0])){_0x1c5fee=_0x5c34fa[0x0][_0xe9f0('0x114')]?![]:!![];_0x4491a3=_0x5c34fa[0x0][_0xe9f0('0x114')]?!![]:![];_0x4491a3=_0x59f266?!![]:_0x4491a3;}var _0x3c970a=_0x430b27['validateContact'](_0x5c34fa);if(_0x3c970a[_0xe9f0('0x115')]){rpcDb['checkIsBlackList'](_['pick'](_0x5c34fa[0x0],[_0xe9f0('0x7a'),'Contact.phone']))['then'](function(_0x2362f8){_0x430b27[_0xe9f0('0xfc')](_0x2362f8,_0x5c34fa[0x0],_0x59f266,_0x1c5fee,_0x4491a3)[_0xe9f0('0x8d')](function(_0x418053){_0x224300(_0x418053);})[_0xe9f0('0x7d')](function(_0x4ce4c5){_0x51515a(_0x4ce4c5);});})[_0xe9f0('0x7d')](function(_0x1acf79){ut['logger'](_0xe9f0('0x116'),_0x1acf79);_0x51515a(ut[_0xe9f0('0x55')](_0xe9f0('0x117'),_0x1c5fee,_0x4491a3));});}else{_0x51515a(ut[_0xe9f0('0x55')](_0x3c970a[_0xe9f0('0x55')],_0x1c5fee,_0x4491a3));}})[_0xe9f0('0x7d')](function(_0x44bdd8){ut[_0xe9f0('0x67')](_0xe9f0('0x118'),_0x44bdd8);_0x51515a(ut['message'](_0xe9f0('0x117'),![],!![]));});});};Preview[_0xe9f0('0xe')]['validateContact']=function(_0x352ebc){if(_[_0xe9f0('0x88')](_0x352ebc)||_[_0xe9f0('0x100')](_0x352ebc)||!_[_0xe9f0('0x88')](_0x352ebc[0x0][_0xe9f0('0x8c')])&&_['isNil'](_0x352ebc[0x0]['Agent'][_0xe9f0('0x28')])){ut[_0xe9f0('0x67')](_0xe9f0('0x119'),_0x352ebc);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x366ecb=this[_0xe9f0('0x26')][_0x352ebc[0x0][_0xe9f0('0x11a')][_0xe9f0('0x28')]];_0x366ecb[_0xe9f0('0x55')]=_0xe9f0('0x9f');if(_[_0xe9f0('0x88')](_0x366ecb)){ut[_0xe9f0('0x67')](_0xe9f0('0x11b'),_0x366ecb);return{'isValid':![],'message':_0xe9f0('0x11c')};}if(!this[_0xe9f0('0x9d')](_0x366ecb[_0xe9f0('0x59')])){ut[_0xe9f0('0x67')](_0xe9f0('0x11d'),_0xe9f0('0x11e')+_0x366ecb[_0xe9f0('0x28')]+_0xe9f0('0x11f'));if(!this['isTrunkReachable'](_0x366ecb[_0xe9f0('0x120')])){ut[_0xe9f0('0x67')](_0xe9f0('0x11d'),_0x366ecb['name']+_0xe9f0('0x121'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x366ecb[_0xe9f0('0x36')])){ut['logger'](_0xe9f0('0x122'),_0x366ecb['name']+'\x20Not\x20Active');return{'isValid':![],'message':_0xe9f0('0x11e')+_0x366ecb[_0xe9f0('0x28')]+_0xe9f0('0x123')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xe9f0('0xe')][_0xe9f0('0x124')]=function(_0xe10586,_0x291c68,_0x1646cb,_0x3957d7){var _0x9ff5c2=this;return new BPromise(function(_0x271c31,_0x2f54e6){var _0x430ec4=_0xe10586[_0xe9f0('0xb4')];var _0x360e00=_0x9ff5c2[_0xe9f0('0x9d')](_0x291c68[_0xe9f0('0x59')])?util['format'](_0xe9f0('0x125'),_0x291c68[_0xe9f0('0x59')][_0xe9f0('0x28')],_[_0xe9f0('0x88')](_0x291c68[_0xe9f0('0x3a')])?'':_0x291c68[_0xe9f0('0x3a')][_0xe9f0('0x126')]()||'',_0x291c68[_0xe9f0('0x127')]>0x0?_0x1646cb['Contact'][_0xe9f0('0xfe')]['substring'](_0x291c68[_0xe9f0('0x127')]):_0x1646cb[_0xe9f0('0xfd')][_0xe9f0('0xfe')]):util[_0xe9f0('0x5f')](_0xe9f0('0x125'),_[_0xe9f0('0x88')](_0x291c68[_0xe9f0('0x120')])?_0x291c68['Trunk'][_0xe9f0('0x28')]:_0x291c68['TrunkBackup'][_0xe9f0('0x28')],_[_0xe9f0('0x88')](_0x291c68['dialPrefix'])?'':_0x291c68['dialPrefix'][_0xe9f0('0x126')]()||'',_0x291c68[_0xe9f0('0x127')]>0x0?_0x1646cb[_0xe9f0('0xfd')][_0xe9f0('0xfe')][_0xe9f0('0x128')](_0x291c68[_0xe9f0('0x127')]):_0x1646cb[_0xe9f0('0xfd')][_0xe9f0('0xfe')]);var _0x408608=_0x9ff5c2[_0xe9f0('0x9d')](_0x291c68[_0xe9f0('0x59')])?ut[_0xe9f0('0x129')](_0x291c68[_0xe9f0('0x59')]['callerid'],_0x291c68[_0xe9f0('0x38')],_0x291c68['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x291c68[_0xe9f0('0x12a')],_0x291c68[_0xe9f0('0x12b')]):_0x291c68[_0xe9f0('0x12a')]):ut[_0xe9f0('0x129')](_['isNil'](_0x291c68[_0xe9f0('0x120')])?_0x291c68[_0xe9f0('0x59')][_0xe9f0('0x5b')]:_0x291c68[_0xe9f0('0x120')][_0xe9f0('0x5b')],_0x291c68['dialOriginateCallerIdName'],_0x291c68[_0xe9f0('0x12b')]>0x0?ut[_0xe9f0('0x12c')](_0x291c68['dialOriginateCallerIdNumber'],_0x291c68[_0xe9f0('0x12b')]):_0x291c68['dialOriginateCallerIdNumber']);if(_0x408608){_0xe10586[_0xe9f0('0x12d')]=ut[_0xe9f0('0x12e')](_0x408608);_0xe10586[_0xe9f0('0x12f')]=ut[_0xe9f0('0x130')](_0x408608);}var _0x37d082=ut[_0xe9f0('0x131')](_0x291c68,_0x1646cb,_0x360e00,_0x408608,_0x430ec4,_0xe10586);_[_0xe9f0('0x132')](_0xe10586,ut[_0xe9f0('0x133')](_0x37d082));_0xe10586[_0xe9f0('0x91')]=moment()[_0xe9f0('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0xe9f0('0x7b')](ut['variablesAction'](_0xe10586,_0x291c68,_0x37d082,_0xe10586[_0xe9f0('0xd3')],_0x3957d7))[_0xe9f0('0x8d')](function(_0x509bb7){_0x291c68['originated']+=0x1;logger['info'](_0xe9f0('0x134'),_0x430ec4,_0xe9f0('0xb5'),_0x291c68[_0xe9f0('0x28')],_0xe9f0('0x73'),_0x291c68[_0xe9f0('0x75')]);_0x271c31(_0x509bb7);})[_0xe9f0('0x7d')](function(_0x3e8f52){ut[_0xe9f0('0xf4')](_0xe10586,0xe,_0xe9f0('0x135'));rpcDb['createAgentHistory'](_0xe10586,'[originateFailure][logOriginateFailure]');_0x2f54e6(_0x3e8f52);});});};Preview[_0xe9f0('0xe')]['syncNewExten']=function(_0x27b28a){if(this[_0xe9f0('0x15')][_0x27b28a[_0xe9f0('0xaf')]]){this[_0xe9f0('0x15')][_0x27b28a[_0xe9f0('0xaf')]]['channel']=_0x27b28a[_0xe9f0('0x7c')];}};Preview[_0xe9f0('0xe')][_0xe9f0('0x136')]=function(_0x29d205){var _0x465592=this;var _0x55375b=this[_0xe9f0('0x15')][_0x29d205[_0xe9f0('0x137')]];if(_0x55375b){if(_0x55375b['lookAgent']&&this[_0xe9f0('0x16')][_0x55375b[_0xe9f0('0xff')]]){ut[_0xe9f0('0x138')](_0x55375b,this['agents'][_0x55375b['lookAgent']][_0xe9f0('0x28')],this[_0xe9f0('0x16')][_0x55375b[_0xe9f0('0xff')]]['id']);}var _0x4e4045=_['clone'](_0x55375b);_0x4e4045[_0xe9f0('0xb1')]=moment()[_0xe9f0('0x5f')](_0xe9f0('0x92'));var _0x4ee4f9=_0x465592[_0xe9f0('0x26')][_0x55375b[_0xe9f0('0x74')]];if(ut[_0xe9f0('0x139')](_0x29d205[_0xe9f0('0x13a')])){if(_0x55375b[_0xe9f0('0xae')]){rpcDb[_0xe9f0('0x112')](_0x55375b['idContact']);}if(_0x55375b[_0xe9f0('0xd3')]){rpcDb[_0xe9f0('0x90')](_0x55375b[_0xe9f0('0x13b')]);}ami[_0xe9f0('0x64')](_0xe9f0('0x13c'),ut[_0xe9f0('0xb6')](_0x55375b,_0xe9f0('0x13d'),this[_0xe9f0('0x26')][_0x55375b[_0xe9f0('0x74')]]));this[_0xe9f0('0xf0')](_0x4e4045,_0x4ee4f9,_0x29d205);}else{_0x55375b[_0xe9f0('0x91')]=moment()[_0xe9f0('0x5f')](_0xe9f0('0x92'));ut[_0xe9f0('0xf4')](_0x4e4045,0x4,_0xe9f0('0xbb'));rpcDb[_0xe9f0('0xf5')](_0x4e4045,_0xe9f0('0x13e'));}}};Preview['prototype']['syncHangup']=function(_0x52d6ae){var _0x1dd4e7=this;var _0xfa1b2=this['actions'][_0x52d6ae[_0xe9f0('0xaf')]];var _0x53375b;if(_0xfa1b2){_0x53375b=this[_0xe9f0('0x26')][_0xfa1b2[_0xe9f0('0x74')]];logger['info'](_0xe9f0('0x13f'),_0x52d6ae['linkedid'],_0xe9f0('0xb5'),_0x53375b['name'],'pTalking:\x20',_0x53375b[_0xe9f0('0x2c')]);}if(this[_0xe9f0('0x15')][_0x52d6ae['linkedid']]&&_0x52d6ae[_0xe9f0('0xaf')]!==_0x52d6ae[_0xe9f0('0xb4')]){if(_0x52d6ae[_0xe9f0('0x140')]==='16'&&this[_0xe9f0('0x15')][_0x52d6ae[_0xe9f0('0xaf')]][_0xe9f0('0x77')]){this['callProgressDetectingCustomer'](_0x52d6ae,_0x52d6ae[_0xe9f0('0xaf')],_0x52d6ae[_0xe9f0('0x140')]);}else if(this[_0xe9f0('0x15')][_0x52d6ae[_0xe9f0('0xaf')]]['dialAnswer']){logger[_0xe9f0('0x62')](_0xe9f0('0x141'),_0x52d6ae[_0xe9f0('0xaf')],_0x52d6ae[_0xe9f0('0x140')],_0xe9f0('0xb5'),_0x53375b[_0xe9f0('0x28')],_0xe9f0('0x76'),_0x53375b[_0xe9f0('0x2c')]);this[_0xe9f0('0xa0')](_0x52d6ae,_0x52d6ae[_0xe9f0('0xaf')],_0x52d6ae[_0xe9f0('0x140')]);}}else if(_0xfa1b2&&_[_0xe9f0('0x88')](_0xfa1b2['statedesc'])&&_0x53375b[_0xe9f0('0x142')]&&_0x52d6ae[_0xe9f0('0xaf')]===_0x52d6ae[_0xe9f0('0xb4')]&&_['isNil'](_0x52d6ae[_0xe9f0('0xf3')])&&_0x52d6ae[_0xe9f0('0x140')]==='16'&&_0x52d6ae['channelstate']==='6'&&_[_0xe9f0('0xf1')](_0xfa1b2[_0xe9f0('0x143')])){if(_0xfa1b2[_0xe9f0('0xae')]){rpcDb[_0xe9f0('0x112')](_0xfa1b2[_0xe9f0('0x13b')]);}if(_0xfa1b2[_0xe9f0('0xd3')]){rpcDb[_0xe9f0('0x90')](_0xfa1b2['idContact']);}_0x52d6ae['reason']='22';this[_0xe9f0('0xf0')](_0xfa1b2,_0x53375b,_0x52d6ae);}else if(_0xfa1b2&&_0xfa1b2[_0xe9f0('0x143')]){if(_0x52d6ae[_0xe9f0('0x140')]==='16'&&this['actions'][_0x52d6ae[_0xe9f0('0xaf')]]['dialAnswer']){logger['info'](_0xe9f0('0x144'),_0x52d6ae[_0xe9f0('0xaf')],_0x52d6ae['cause'],_0xe9f0('0xb5'),_0x53375b[_0xe9f0('0x28')],_0xe9f0('0x76'),_0x53375b[_0xe9f0('0x2c')]);this[_0xe9f0('0xa0')](_0x52d6ae,_0x52d6ae[_0xe9f0('0xaf')],_0x52d6ae[_0xe9f0('0x140')]);}else if(this[_0xe9f0('0x15')][_0x52d6ae[_0xe9f0('0xaf')]][_0xe9f0('0x77')]){logger[_0xe9f0('0x62')](_0xe9f0('0x141'),_0x52d6ae[_0xe9f0('0xaf')],_0x52d6ae[_0xe9f0('0x140')],_0xe9f0('0xb5'),_0x53375b[_0xe9f0('0x28')],'pTalking:\x20',_0x53375b['pTalking']);this[_0xe9f0('0xa0')](_0x52d6ae,_0x52d6ae[_0xe9f0('0xaf')],_0x52d6ae['cause']);}}};Preview[_0xe9f0('0xe')]['syncDialEnd']=function(_0x216fe9){if(this[_0xe9f0('0x15')][_0x216fe9[_0xe9f0('0x145')]]&&_0x216fe9['destlinkedid']!==_0x216fe9[_0xe9f0('0x146')]){this['callProgressDetectingCustomer'](_0x216fe9,_0x216fe9[_0xe9f0('0x145')],_0x216fe9[_0xe9f0('0x147')]);}};Preview[_0xe9f0('0xe')][_0xe9f0('0x1c')]=function(_0x43e7c4){if(this[_0xe9f0('0x15')][_0x43e7c4[_0xe9f0('0xaf')]]&&_0x43e7c4['linkedid']!==_0x43e7c4['uniqueid']&&!this[_0xe9f0('0x15')][_0x43e7c4[_0xe9f0('0xaf')]]['dialAnswer']){if(_0x43e7c4[_0xe9f0('0x140')]==='1'){this['callProgressDetectingCustomer'](_0x43e7c4,_0x43e7c4[_0xe9f0('0xaf')],_0x43e7c4[_0xe9f0('0x140')]);}}};Preview[_0xe9f0('0xe')][_0xe9f0('0x148')]=function(_0x5e0d9d,_0x44e55d,_0x12d5e4){if(this[_0xe9f0('0x15')][_0x5e0d9d]){if(_[_0xe9f0('0x88')](this[_0xe9f0('0x15')][_0x5e0d9d][_0xe9f0('0x149')])){this[_0xe9f0('0x15')][_0x5e0d9d][_0xe9f0('0x149')]={};}this['actions'][_0x5e0d9d]['variables'][_0x44e55d]=_0x12d5e4;}};Preview[_0xe9f0('0xe')][_0xe9f0('0x21')]=function(_0x2a88a3){try{if(!_['isNil'](_0x2a88a3)){if(ut[_0xe9f0('0x14a')](_[_0xe9f0('0x14b')](_0x2a88a3[_0xe9f0('0x14c')])[0x0])){this['addVariable'](_0x2a88a3[_0xe9f0('0xb4')],_[_0xe9f0('0x14b')](_0x2a88a3['variable'])[0x0],_0x2a88a3[_0xe9f0('0x14d')]);}}}catch(_0x333197){logger[_0xe9f0('0x14e')](_0xe9f0('0x14f'),util[_0xe9f0('0x150')](_0x333197,{'showHidden':![],'depth':null}));}};Preview[_0xe9f0('0xe')]['syncAttendedTransfer']=function(_0x242895){if(_0x242895){if(this[_0xe9f0('0x15')][_0x242895[_0xe9f0('0x151')]]){this[_0xe9f0('0x15')][_0x242895['transfertargetlinkedid']][_0xe9f0('0x143')]=!![];}}};Preview['prototype'][_0xe9f0('0x24')]=function(_0x388dad){if(_0x388dad){if(this[_0xe9f0('0x15')][_0x388dad[_0xe9f0('0x152')]]){this[_0xe9f0('0x15')][_0x388dad[_0xe9f0('0x152')]][_0xe9f0('0x143')]=!![];}}};module[_0xe9f0('0x153')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 74081be..95c14a3 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 _0x2bd8=['preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','then','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','from-sip','xcally-motion-preview','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','../../../config/logger'];(function(_0xa0b78a,_0x15e1df){var _0x1b7329=function(_0x1d9aba){while(--_0x1d9aba){_0xa0b78a['push'](_0xa0b78a['shift']());}};_0x1b7329(++_0x15e1df);}(_0x2bd8,0x130));var _0x82bd=function(_0x23e67d,_0x503f51){_0x23e67d=_0x23e67d-0x0;var _0x422e3c=_0x2bd8[_0x23e67d];return _0x422e3c;};'use strict';var util=require(_0x82bd('0x0'));var BPromise=require('bluebird');var logger=require(_0x82bd('0x1'))(_0x82bd('0x2'));var _=require(_0x82bd('0x3'));var cmHopper=require(_0x82bd('0x4'));var cmHopperFinal=require(_0x82bd('0x5'));var cmHopperHistory=require(_0x82bd('0x6'));var cmHopperBlack=require(_0x82bd('0x7'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x82bd('0x8'));var voiceQueueReport=require(_0x82bd('0x9'));function loggerCatch(_0x3bf810){return function(_0x5ceb60){logger[_0x82bd('0xa')](_0x3bf810,util[_0x82bd('0xb')](_0x5ceb60,{'showHidden':![],'depth':null}));};}function create(_0x226f60){return BPromise[_0x82bd('0xc')]()['then'](cmHopperHistory[_0x82bd('0xd')](_0x226f60))['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x51c6ea){return BPromise[_0x82bd('0xc')]()['then'](agentReportPreview['createHistory'](_0x51c6ea))[_0x82bd('0xe')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x4e50da){return BPromise[_0x82bd('0xc')]()[_0x82bd('0xf')](cmHopper['moveContactManagedDialer'](_0x4e50da,!![]))[_0x82bd('0xe')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x82bd('0x10')]=function(_0x51e17e){return BPromise[_0x82bd('0xc')]()[_0x82bd('0xf')](cmHopperBlack[_0x82bd('0x10')](_0x51e17e))[_0x82bd('0xe')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x82bd('0x11')]=function(_0xd43e79){return BPromise['resolve']()[_0x82bd('0xf')](cmHopper['getContactPreview'](_0xd43e79))[_0x82bd('0xe')](loggerCatch(_0x82bd('0x12')));};exports[_0x82bd('0xd')]=function(_0x300982,_0x209081){create(_0x300982)[_0x82bd('0xe')](loggerCatch(_0x209081));moveContact(_0x300982)[_0x82bd('0xe')](loggerCatch(_0x209081));};exports[_0x82bd('0x13')]=function(_0x31a350,_0xf180aa){createAgent(_0x31a350)[_0x82bd('0xe')](loggerCatch(_0xf180aa));};exports[_0x82bd('0x14')]=function(_0x1c3779,_0x253741){create(_0x1c3779)['catch'](loggerCatch(_0x253741));};exports['createCustomerFinal']=function(_0x283ce7,_0x3eb844){moveContact(_0x283ce7)[_0x82bd('0xe')](loggerCatch(_0x3eb844));};exports[_0x82bd('0x15')]=function(_0x34899b,_0x28a706,_0x2c1810){if(_0x28a706){_0x34899b[_0x82bd('0x16')]=null;}if(_0x2c1810){_0x34899b[_0x82bd('0x17')]=![];}return BPromise[_0x82bd('0xc')]()[_0x82bd('0xf')](cmHopper[_0x82bd('0x15')](_0x34899b))[_0x82bd('0xe')](loggerCatch(_0x82bd('0x18')));};exports[_0x82bd('0x19')]=function(_0x2d9d95){return BPromise[_0x82bd('0xc')]()[_0x82bd('0xf')](cmHopper[_0x82bd('0x19')](_0x2d9d95))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0x82bd('0x1a')]=function(_0x436ecd){return BPromise[_0x82bd('0xc')]()[_0x82bd('0xf')](cmHopper[_0x82bd('0x1a')]({'UserId':null},_0x436ecd,0x1))[_0x82bd('0xe')](loggerCatch(_0x82bd('0x1b')));};exports[_0x82bd('0x1c')]=function(_0x2f0bb6){return BPromise[_0x82bd('0xc')]()['then'](cmHopper['unlockContact']({'active':![]},_0x2f0bb6,0x1))['catch'](loggerCatch('[activeContact]\x20'));};exports[_0x82bd('0x1d')]=function(_0x52bcd8){var _0x351d3d={};_0x351d3d[_0x82bd('0x1e')]=_0x52bcd8[_0x82bd('0x1e')];_0x351d3d['uniqueid']=_0x52bcd8['uniqueid'];_0x351d3d['calleridnum']=_0x52bcd8[_0x82bd('0x1f')];_0x351d3d[_0x82bd('0x20')]=_0x52bcd8[_0x82bd('0x20')];_0x351d3d['queue']=_0x52bcd8[_0x82bd('0x21')];_0x351d3d['queuecallerjoinAt']=_0x52bcd8[_0x82bd('0x22')];_0x351d3d[_0x82bd('0x23')]=_0x52bcd8[_0x82bd('0x22')];_0x351d3d[_0x82bd('0x24')]=0x1;_0x351d3d[_0x82bd('0x25')]=_0x52bcd8[_0x82bd('0x26')];_0x351d3d['connectedlinename']=_0x52bcd8[_0x82bd('0x27')];_0x351d3d[_0x82bd('0x28')]=_0x82bd('0x29');_0x351d3d['exten']=_0x82bd('0x2a');_0x351d3d['holdtime']=0x0;_0x351d3d['assigned']=0x1;_0x351d3d[_0x82bd('0x2b')]=_0x52bcd8[_0x82bd('0x27')];_0x351d3d[_0x82bd('0x2c')]=_0x82bd('0x2d');return BPromise[_0x82bd('0xc')]()[_0x82bd('0xf')](voiceQueueReport[_0x82bd('0x2e')](_0x351d3d))[_0x82bd('0xe')](loggerCatch(_0x82bd('0x2f')));};exports[_0x82bd('0x30')]=function(_0x1ebf6f,_0xe666bd){return BPromise[_0x82bd('0xc')]()[_0x82bd('0xf')](cmHopper[_0x82bd('0x30')](_0x1ebf6f,_0xe666bd))[_0x82bd('0xe')](loggerCatch(_0x82bd('0x31')));};exports['rescheduleContactInQueue']=function(_0x59b7ca){return BPromise['resolve']()[_0x82bd('0xf')](cmHopper[_0x82bd('0x15')](_0x59b7ca,!![],!![]))['catch'](loggerCatch(_0x82bd('0x32')));}; \ 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(_0x57326a,_0x4682f5){var _0x24b1e7=function(_0x465727){while(--_0x465727){_0x57326a['push'](_0x57326a['shift']());}};_0x24b1e7(++_0x4682f5);}(_0x5089,0x1bb));var _0x9508=function(_0xf33afd,_0x2363b6){_0xf33afd=_0xf33afd-0x0;var _0x5f432a=_0x5089[_0xf33afd];return _0x5f432a;};'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 656ed3b..c934b65 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 _0x9330=['127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','inspect','loggerError','info','message','getCallerId','string','isEmpty','format','\x22%s\x22\x20<%s>','isUndefined','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','statedesc','Blacklist','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','responsetime','ringtime','starttime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','originate','channelAgent','timeout','countbusyretry','countnoanswerretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','active','scheduledat','minutes','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','mandatoryDisposition','buildAcw','agentReadyId','reachable','getDiff','createBody','CampaignId','idContact','campaigntype','dialAnswer','countcongestionretry','callback','callbackuniqueid','callbackat','recallme','xmd-phone','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','bridgepeer','bridgepvtcallid','state','\x5cw{0,','replace','random','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI'];(function(_0x2f302a,_0x57782d){var _0x1b3719=function(_0x5655d6){while(--_0x5655d6){_0x2f302a['push'](_0x2f302a['shift']());}};_0x1b3719(++_0x57782d);}(_0x9330,0x107));var _0x0933=function(_0x2682ed,_0x3c39b0){_0x2682ed=_0x2682ed-0x0;var _0x454785=_0x9330[_0x2682ed];return _0x454785;};'use strict';var util=require(_0x0933('0x0'));var _=require(_0x0933('0x1'));var moment=require(_0x0933('0x2'));var logger=require(_0x0933('0x3'))(_0x0933('0x4'));var ipAgi=process[_0x0933('0x5')][_0x0933('0x6')]||_0x0933('0x7');function getSeconds(_0x3dc2a0,_0x2a14ec){var _0x2de502=moment(_0x3dc2a0)[_0x0933('0x8')](0x0);var _0x490cae=moment(_0x2a14ec)[_0x0933('0x8')](0x0);return _0x2de502[_0x0933('0x9')](_0x490cae,_0x0933('0xa'));}exports[_0x0933('0xb')]=function(_0x43c3ee){return function(_0x547bb7){logger[_0x0933('0xc')](_0x43c3ee,util['inspect'](_0x547bb7,{'showHidden':![],'depth':null}));};};exports[_0x0933('0xd')]=function(_0x45d85,_0x4278c5){logger['info'](_0x45d85,util[_0x0933('0xe')](_0x4278c5,{'showHidden':![],'depth':null}));};exports[_0x0933('0xf')]=function(_0x222a5f,_0x32f8cf){logger[_0x0933('0xc')](_0x222a5f,util['inspect'](_0x32f8cf,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x48c406){return function(_0x4b3fad){logger[_0x0933('0x10')](_0x48c406,util['inspect'](_0x4b3fad,{'showHidden':![],'depth':null}));};};exports[_0x0933('0x11')]=function(_0x85e3d7,_0x2a4333,_0x25b0a9){return{'message':_0x85e3d7,'unlock':_0x2a4333,'active':_0x25b0a9};};exports[_0x0933('0x12')]=function(_0x1f13f5,_0x43507b,_0x9d4d09){if(!_['isUndefined'](_0x9d4d09)&&'string'===typeof _0x9d4d09&&!_['isEmpty'](_0x9d4d09)){if(!_['isUndefined'](_0x43507b)&&_0x0933('0x13')===typeof _0x43507b&&!_[_0x0933('0x14')](_0x43507b)){return util[_0x0933('0x15')](_0x0933('0x16'),_0x43507b,_0x9d4d09);}return util[_0x0933('0x15')]('\x22%s\x22\x20<%s>',_0x9d4d09,_0x9d4d09);}if(!_[_0x0933('0x17')](_0x1f13f5)&&_0x0933('0x13')===typeof _0x1f13f5&&!_[_0x0933('0x14')](_0x1f13f5)){return _0x1f13f5;}return _0x0933('0x18');};exports['isActive']=function(_0x44eff1){if(_[_0x0933('0x19')](_0x44eff1)){return![];}return _0x44eff1;};exports[_0x0933('0x1a')]=function(_0x249f3a,_0x1829fe,_0x169e31,_0x2edae4,_0x2ce831,_0x1bafff){var _0x3b9fd2={'XMD-QUEUE':_0x1829fe[_0x0933('0x1b')]?_0x1829fe[_0x0933('0x1b')][_0x0933('0x1c')]:'','XMD-CALLERID':_0x2edae4,'XMD-CALLERID-PREVIEW':_0x1bafff?util[_0x0933('0x15')](_0x0933('0x16'),_0x1bafff[_0x0933('0x1d')],_0x1bafff[_0x0933('0x1e')]):_0x2edae4,'XMD-DIALID':_0x2ce831,'XMD-CONTACTID':_0x1829fe[_0x0933('0x1f')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x2edae4,'XMD-VOICEQUEUEID':_0x1829fe['VoiceQueueId'],'XMD-DIALCHANNEL':_0x169e31,'XMD-DIALTIMEOUT':_0x249f3a['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x0933('0x15')](_0x0933('0x20'),_0x249f3a['dialQueueProject2']?'g':'',_[_0x0933('0x14')](_0x249f3a[_0x0933('0x21')])?'':_0x0933('0x22')),'XMD-DIALURL':_0x249f3a[_0x0933('0x23')]||'','XMD-AGI':_0x249f3a[_0x0933('0x24')]?util[_0x0933('0x15')](_0x0933('0x25'),ipAgi,_0x249f3a[_0x0933('0x24')]):_0x0933('0x26'),'XMD-AGIAFTER':_0x249f3a[_0x0933('0x27')]?util[_0x0933('0x15')]('\x22agi://%s/square,%s\x22',ipAgi,_0x249f3a[_0x0933('0x27')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x1bafff?_0x1bafff[_0x0933('0x28')]:'','XMD-ORIGINATECALLERIDNAME':_0x1bafff?_0x1bafff[_0x0933('0x29')]:'','XMD-DESTINATION':_0x0933('0x2a')};if(!_[_0x0933('0x14')](_0x249f3a[_0x0933('0x21')])){_0x3b9fd2[util[_0x0933('0x15')]('%s',_0x0933('0x2b'))]=_0x249f3a[_0x0933('0x21')];_0x3b9fd2[util[_0x0933('0x15')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x2ce831;}if(_0x1829fe&&_0x1829fe[_0x0933('0x2c')]){for(var _0x3dc1c9 in _0x1829fe[_0x0933('0x2c')]){if(_0x1829fe['Contact'][_0x0933('0x2d')](_0x3dc1c9)){if(!_[_0x0933('0x19')](_0x1829fe[_0x0933('0x2c')][_0x3dc1c9])&&_0x3dc1c9!=='id'&&_0x3dc1c9!==_0x0933('0x2e')&&_0x3dc1c9!=='createdAt'&&_0x3dc1c9!=='updatedAt'){_0x3b9fd2[util[_0x0933('0x15')](_0x0933('0x2f'),_0x0933('0x30'),_[_0x0933('0x31')](_0x3dc1c9))]=_0x1829fe[_0x0933('0x2c')][_0x3dc1c9];}}}}return _0x3b9fd2;};exports[_0x0933('0x32')]=function(_0x4a189d){var _0x323da8={};for(var _0x54dfcb in _0x4a189d){if(_0x4a189d[_0x0933('0x2d')](_0x54dfcb)){_0x323da8[util[_0x0933('0x15')]('%s',_['toLower'](_0x54dfcb))]=_0x4a189d[_0x54dfcb];}}return{'variables':_0x323da8};};exports[_0x0933('0x33')]=function(_0x1fdbde,_0x167ee6){if(!_['isNil'](_0x1fdbde)){if(_0x1fdbde['hasOwnProperty'](_0x0933('0x34'))){if(_0x1fdbde[_0x0933('0x34')]>0x0){_0x1fdbde[_0x0933('0x34')]-=0x1;}else{logger[_0x0933('0xc')](_0x0933('0x35'),_0x167ee6);}}}else{logger[_0x0933('0xc')](_0x0933('0x36'),_0x167ee6);}};exports['logBlacklist']=function(_0x10e766){var _0x4c3271=moment()[_0x0933('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x10e766['state']=0xd;_0x10e766[_0x0933('0x37')]=_0x0933('0x38');_0x10e766['starttime']=_0x4c3271;_0x10e766['responsetime']=_0x4c3271;_0x10e766[_0x0933('0x39')]=_0x4c3271;};exports[_0x0933('0x3a')]=function(_0xba5e97,_0x274cfa,_0x4e5ce8){var _0x5b1073=moment()['format'](_0x0933('0x3b'));_0xba5e97['state']=_0x274cfa;_0xba5e97[_0x0933('0x37')]=_0x4e5ce8;_0xba5e97[_0x0933('0x3c')]=_0x5b1073;_0xba5e97[_0x0933('0x3d')]=getSeconds(_0xba5e97['responsetime'],_0xba5e97[_0x0933('0x3e')]);};exports[_0x0933('0x3f')]=function(_0x18571a,_0x39d817,_0x208b5a){_0x18571a[_0x0933('0x40')]=_0x39d817;_0x18571a[_0x0933('0x41')]=_0x208b5a;};exports[_0x0933('0x42')]=function(_0x2d7893,_0xd3f21a,_0x3c142b){var _0xf0cca6=moment()[_0x0933('0x15')](_0x0933('0x3b'));_0x2d7893['state']=_0xd3f21a;_0x2d7893[_0x0933('0x37')]=_0x3c142b;_0x2d7893[_0x0933('0x3c')]=_0x2d7893[_0x0933('0x3c')]?_0x2d7893[_0x0933('0x3c')]:_0xf0cca6;_0x2d7893[_0x0933('0x39')]=_0x2d7893[_0x0933('0x39')]?_0x2d7893[_0x0933('0x39')]:_0xf0cca6;_0x2d7893[_0x0933('0x3d')]=getSeconds(_0x2d7893[_0x0933('0x3c')]||0x0,_0x2d7893[_0x0933('0x3e')]||0x0);_0x2d7893[_0x0933('0x43')]=_0x2d7893[_0x0933('0x44')]?getSeconds(_0x2d7893['endtime'],_0x2d7893[_0x0933('0x44')]):0x0;};exports[_0x0933('0x45')]=function(_0x11b7f2){return _0x11b7f2===_0x0933('0x46');};exports[_0x0933('0x47')]=function(_0x25d42f,_0x2650d8,_0x4422d9,_0x3f014f,_0x5bcff0){var _0x31a891=_0x3f014f?'RECALL':_0x25d42f[_0x0933('0x1d')];_0x31a891=_0x5bcff0?_0x0933('0x48'):_0x31a891;return{'actionid':_0x25d42f[_0x0933('0x49')],'action':_0x0933('0x4a'),'channel':_0x25d42f[_0x0933('0x4b')],'callerid':util[_0x0933('0x15')]('\x22%s\x22\x20<%s>',_0x31a891,_0x25d42f['calleridnum']),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x4422d9,'timeout':(_0x2650d8[_0x0933('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x25d42f['uniqueid']};};exports['totalGlobal']=function(_0x24c5bb){return _0x24c5bb[_0x0933('0x4d')]+_0x24c5bb['countcongestionretry']+_0x24c5bb[_0x0933('0x4e')]+_0x24c5bb['countagentrejectretry']+_0x24c5bb[_0x0933('0x4f')];};exports[_0x0933('0x50')]=function(_0x1a4ea1){var _0x42a2ed=_['clone'](_0x1a4ea1);_0x42a2ed['state']=0xf;_0x42a2ed[_0x0933('0x37')]=_0x0933('0x51');return _0x42a2ed;};exports[_0x0933('0x52')]=function(_0x276fbb,_0x32d069,_0x2f6140){var _0x28a1e2={};_0x28a1e2[_0x32d069]=_0x276fbb[_0x32d069];_0x28a1e2[_0x0933('0x53')]=![];_0x28a1e2[_0x0933('0x54')]=moment()['add'](_0x2f6140,_0x0933('0x55'))['format'](_0x0933('0x3b'));_0x28a1e2['ContactId']=_0x276fbb[_0x0933('0x1f')];_0x28a1e2['ListId']=_0x276fbb[_0x0933('0x56')];_0x28a1e2[_0x0933('0x57')]=_0x276fbb[_0x0933('0x57')]||undefined;return _0x28a1e2;};exports['decrementTalkink']=function(_0x5e558b,_0x4cedc2){if(!_['isNil'](_0x5e558b)){if(_0x5e558b['pTalking']>0x0){_0x5e558b[_0x0933('0x58')]-=0x1;}else{logger[_0x0933('0xc')](_0x4cedc2,_0x0933('0x59'));}}else{logger[_0x0933('0xc')](_0x4cedc2,_0x0933('0x5a'));}};exports[_0x0933('0x5b')]=function(_0x22b4e8){if(_0x22b4e8<=0x0){return!![];}return![];};exports[_0x0933('0x5c')]=function(_0x124e92,_0x136cfd,_0x4d3ee4){_0x124e92[_0x0933('0x5d')]=_0x136cfd;_0x124e92[_0x0933('0x1c')]=_0x124e92[_0x0933('0x5e')];_0x124e92[_0x0933('0x5f')]=_0x124e92[_0x0933('0x4b')];if(_0x4d3ee4){_0x124e92[_0x0933('0x60')]=_0x4d3ee4[_0x0933('0x60')];}return _0x124e92;};exports[_0x0933('0x61')]=function(_0x52f14b){var _0x1f811f={};_0x1f811f['queue']=_0x52f14b[_0x0933('0x5e')];_0x1f811f[_0x0933('0x5f')]=_0x52f14b[_0x0933('0x4b')];_0x1f811f[_0x0933('0x49')]=_0x52f14b[_0x0933('0x49')];return _0x1f811f;};exports[_0x0933('0x62')]=function(_0x566daf){var _0x35d693=[];for(var _0x4a29c4 in _0x566daf){if(_0x566daf[_0x0933('0x2d')](_0x4a29c4)){if(!_[_0x0933('0x19')](_0x566daf[_0x4a29c4])&&_0x566daf[_0x4a29c4]['state']==='not_inuse'&&_0x566daf[_0x4a29c4]['status']===_0x0933('0x63')){_0x35d693['push'](_0x566daf[_0x4a29c4]['id']);}}}return _0x35d693;};exports[_0x0933('0x64')]=function(_0x3055b9){var _0x55ea73=moment()[_0x0933('0x8')](0x0);var _0x6188b2=moment(_0x3055b9)['milliseconds'](0x0);return _0x55ea73['diff'](_0x6188b2,_0x0933('0xa'));};exports[_0x0933('0x65')]=function(_0x41bc88){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x41bc88['ContactId'],'ListId':_0x41bc88[_0x0933('0x56')],'VoiceQueueId':_0x41bc88[_0x0933('0x57')]||undefined,'CampaignId':_0x41bc88[_0x0933('0x66')]||undefined};};exports['filterKey']=function(_0x3af17f){if(_0x3af17f===_0x0933('0x49')||_0x3af17f===_0x0933('0x67')||_0x3af17f===_0x0933('0x5e')||_0x3af17f==='type'||_0x3af17f===_0x0933('0x68')||_0x3af17f===_0x0933('0x69')||_0x3af17f==='membername'||_0x3af17f===_0x0933('0x4b')||_0x3af17f===_0x0933('0x1d')||_0x3af17f===_0x0933('0x53')||_0x3af17f===_0x0933('0x1e')||_0x3af17f===_0x0933('0x54')||_0x3af17f==='countbusyretry'||_0x3af17f===_0x0933('0x6a')||_0x3af17f===_0x0933('0x4e')||_0x3af17f==='countglobal'||_0x3af17f===_0x0933('0x6b')||_0x3af17f===_0x0933('0x6c')||_0x3af17f===_0x0933('0x6d')||_0x3af17f===_0x0933('0x6e')||_0x3af17f===_0x0933('0x1f')||_0x3af17f===_0x0933('0x56')||_0x3af17f===_0x0933('0x41')||_0x3af17f===_0x0933('0x57')||_0x3af17f==='sipcallid'||_0x3af17f==='xmd-voicequeueid'||_0x3af17f==='xmd-queue'||_0x3af17f===_0x0933('0x6f')||_0x3af17f==='xmd-listid'||_0x3af17f==='xmd-dialurl'||_0x3af17f===_0x0933('0x70')||_0x3af17f===_0x0933('0x71')||_0x3af17f===_0x0933('0x72')||_0x3af17f===_0x0933('0x73')||_0x3af17f==='xmd-contactid'||_0x3af17f===_0x0933('0x74')||_0x3af17f==='xmd-callerid'||_0x3af17f===_0x0933('0x75')||_0x3af17f===_0x0933('0x76')||_0x3af17f===_0x0933('0x77')||_0x3af17f==='rtpaudioqosbridged'||_0x3af17f===_0x0933('0x78')||_0x3af17f===_0x0933('0x79')||_0x3af17f===_0x0933('0x7a')||_0x3af17f===_0x0933('0x7b')||_0x3af17f===_0x0933('0x7c')||_0x3af17f===_0x0933('0x7d')||_0x3af17f===_0x0933('0x77')||_0x3af17f===_0x0933('0x7e')||_0x3af17f==='rtpaudioqosjitter'||_0x3af17f===_0x0933('0x79')||_0x3af17f===_0x0933('0x7a')||_0x3af17f===_0x0933('0x7b')||_0x3af17f===_0x0933('0x7c')||_0x3af17f===_0x0933('0x7d')||_0x3af17f===_0x0933('0x7f')||_0x3af17f===_0x0933('0x80')||_0x3af17f===_0x0933('0x81')||_0x3af17f===_0x0933('0x37')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x3406f1,_0x464b34){var _0x125a58,_0x2f39c0,_0x400c77;if(_0x464b34<=0x0){_0x464b34=0x1;}_0x125a58=new RegExp(_0x0933('0x82')+_0x464b34+'}$');_0x2f39c0=Math['pow'](0xa,_0x464b34-0x1);_0x400c77=Math['pow'](0xa,_0x464b34)-0x1;return util[_0x0933('0x15')]('%s',_[_0x0933('0x83')](_0x3406f1,_0x125a58,_[_0x0933('0x84')](_0x2f39c0,_0x400c77)));};exports['extractCalleridName']=function(_0x3f58a0){var _0x1f8165=_0x3f58a0[_0x0933('0x85')](/"(.*?)"/);return _0x1f8165?_0x1f8165[0x1]:_0x3f58a0;};exports[_0x0933('0x86')]=function(_0x32b752){var _0x3b9d02=_0x32b752[_0x0933('0x85')](/<(.*?)>/);return _0x3b9d02?_0x3b9d02[0x1]:_0x32b752;}; \ No newline at end of file +var _0x2efa=['answertime','isFailure','Failure','RECALL','originate','from-sip','timeout','uniqueid','totalGlobal','countagentrejectretry','countnosuchnumberretry','clone','scheduledAt','active','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','channelAgent','mandatoryDisposition','buildAcw','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','membername','countcongestionretry','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-callerid','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','extractCalleridNumber','match','lodash','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','error','inspect','logger','info','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','responsetime','logAgent','ringtime','starttime','logLookAgent','UserId','logCustomer','statedesc','endtime','talktime'];(function(_0x2daea7,_0x41e7da){var _0x1f01bd=function(_0x39417b){while(--_0x39417b){_0x2daea7['push'](_0x2daea7['shift']());}};_0x1f01bd(++_0x41e7da);}(_0x2efa,0x160));var _0xa2ef=function(_0x23678e,_0x3606aa){_0x23678e=_0x23678e-0x0;var _0x58fa02=_0x2efa[_0x23678e];return _0x58fa02;};'use strict';var util=require('util');var _=require(_0xa2ef('0x0'));var moment=require('moment');var logger=require(_0xa2ef('0x1'))('preview');var ipAgi=process[_0xa2ef('0x2')][_0xa2ef('0x3')]||_0xa2ef('0x4');function getSeconds(_0x1c812d,_0x4183da){var _0x483415=moment(_0x1c812d)[_0xa2ef('0x5')](0x0);var _0x5b02df=moment(_0x4183da)[_0xa2ef('0x5')](0x0);return _0x483415[_0xa2ef('0x6')](_0x5b02df,'seconds');}exports[_0xa2ef('0x7')]=function(_0x54edcc){return function(_0x1941a8){logger[_0xa2ef('0x8')](_0x54edcc,util[_0xa2ef('0x9')](_0x1941a8,{'showHidden':![],'depth':null}));};};exports[_0xa2ef('0xa')]=function(_0x351e1f,_0x3d1ae4){logger[_0xa2ef('0xb')](_0x351e1f,util[_0xa2ef('0x9')](_0x3d1ae4,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x110684,_0x20caad){logger[_0xa2ef('0x8')](_0x110684,util['inspect'](_0x20caad,{'showHidden':![],'depth':null}));};exports[_0xa2ef('0xc')]=function(_0x2a6f52){return function(_0x2a5fbd){logger[_0xa2ef('0xb')](_0x2a6f52,util[_0xa2ef('0x9')](_0x2a5fbd,{'showHidden':![],'depth':null}));};};exports[_0xa2ef('0xd')]=function(_0x663bf,_0xa8b2b6,_0x4c0e6e){return{'message':_0x663bf,'unlock':_0xa8b2b6,'active':_0x4c0e6e};};exports[_0xa2ef('0xe')]=function(_0x372e69,_0xcb93a7,_0x3b2fc2){if(!_[_0xa2ef('0xf')](_0x3b2fc2)&&_0xa2ef('0x10')===typeof _0x3b2fc2&&!_[_0xa2ef('0x11')](_0x3b2fc2)){if(!_[_0xa2ef('0xf')](_0xcb93a7)&&'string'===typeof _0xcb93a7&&!_[_0xa2ef('0x11')](_0xcb93a7)){return util[_0xa2ef('0x12')](_0xa2ef('0x13'),_0xcb93a7,_0x3b2fc2);}return util[_0xa2ef('0x12')](_0xa2ef('0x13'),_0x3b2fc2,_0x3b2fc2);}if(!_[_0xa2ef('0xf')](_0x372e69)&&_0xa2ef('0x10')===typeof _0x372e69&&!_['isEmpty'](_0x372e69)){return _0x372e69;}return _0xa2ef('0x14');};exports[_0xa2ef('0x15')]=function(_0x396daf){if(_[_0xa2ef('0x16')](_0x396daf)){return![];}return _0x396daf;};exports[_0xa2ef('0x17')]=function(_0x1b06de,_0x8266a,_0x1385e2,_0x4be8f3,_0x138fc0,_0x34bcba){var _0x16f7a9={'XMD-QUEUE':_0x8266a[_0xa2ef('0x18')]?_0x8266a['Queue']['name']:'','XMD-CALLERID':_0x4be8f3,'XMD-CALLERID-PREVIEW':_0x34bcba?util[_0xa2ef('0x12')]('\x22%s\x22\x20<%s>',_0x34bcba[_0xa2ef('0x19')],_0x34bcba[_0xa2ef('0x1a')]):_0x4be8f3,'XMD-DIALID':_0x138fc0,'XMD-CONTACTID':_0x8266a['ContactId'],'XMD-CDRTYPE':_0xa2ef('0x1b'),'CALLERID(all)':_0x4be8f3,'XMD-VOICEQUEUEID':_0x8266a[_0xa2ef('0x1c')],'XMD-DIALCHANNEL':_0x1385e2,'XMD-DIALTIMEOUT':_0x1b06de['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xa2ef('0x12')](_0xa2ef('0x1d'),_0x1b06de[_0xa2ef('0x1e')]?'g':'',_[_0xa2ef('0x11')](_0x1b06de['monitor_format'])?'':_0xa2ef('0x1f')),'XMD-DIALURL':_0x1b06de[_0xa2ef('0x20')]||'','XMD-AGI':_0x1b06de[_0xa2ef('0x21')]?util[_0xa2ef('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1b06de[_0xa2ef('0x21')]):_0xa2ef('0x22'),'XMD-AGIAFTER':_0x1b06de['dialQueueProject2']?util['format'](_0xa2ef('0x23'),ipAgi,_0x1b06de[_0xa2ef('0x1e')]):_0xa2ef('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x34bcba?_0x34bcba[_0xa2ef('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x34bcba?_0x34bcba['originatecalleridname']:'','XMD-DESTINATION':_0xa2ef('0x25')};if(!_[_0xa2ef('0x11')](_0x1b06de[_0xa2ef('0x26')])){_0x16f7a9[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x1b06de[_0xa2ef('0x26')];_0x16f7a9[util['format']('%s',_0xa2ef('0x27'))]=_0x138fc0;}if(_0x8266a&&_0x8266a[_0xa2ef('0x28')]){for(var _0x436b7f in _0x8266a[_0xa2ef('0x28')]){if(_0x8266a[_0xa2ef('0x28')][_0xa2ef('0x29')](_0x436b7f)){if(!_[_0xa2ef('0x16')](_0x8266a[_0xa2ef('0x28')][_0x436b7f])&&_0x436b7f!=='id'&&_0x436b7f!=='tags'&&_0x436b7f!==_0xa2ef('0x2a')&&_0x436b7f!==_0xa2ef('0x2b')){_0x16f7a9[util[_0xa2ef('0x12')](_0xa2ef('0x2c'),_0xa2ef('0x2d'),_[_0xa2ef('0x2e')](_0x436b7f))]=_0x8266a[_0xa2ef('0x28')][_0x436b7f];}}}}return _0x16f7a9;};exports[_0xa2ef('0x2f')]=function(_0x266b2e){var _0x571551={};for(var _0x1d860a in _0x266b2e){if(_0x266b2e[_0xa2ef('0x29')](_0x1d860a)){_0x571551[util['format']('%s',_['toLower'](_0x1d860a))]=_0x266b2e[_0x1d860a];}}return{'variables':_0x571551};};exports[_0xa2ef('0x30')]=function(_0x25af62,_0xb13509){if(!_['isNil'](_0x25af62)){if(_0x25af62[_0xa2ef('0x29')](_0xa2ef('0x31'))){if(_0x25af62[_0xa2ef('0x31')]>0x0){_0x25af62[_0xa2ef('0x31')]-=0x1;}else{logger[_0xa2ef('0x8')](_0xa2ef('0x32'),_0xb13509);}}}else{logger[_0xa2ef('0x8')](_0xa2ef('0x33'),_0xb13509);}};exports[_0xa2ef('0x34')]=function(_0x5aab33){var _0x9765d0=moment()[_0xa2ef('0x12')](_0xa2ef('0x35'));_0x5aab33[_0xa2ef('0x36')]=0xd;_0x5aab33['statedesc']='Blacklist';_0x5aab33['starttime']=_0x9765d0;_0x5aab33[_0xa2ef('0x37')]=_0x9765d0;_0x5aab33['endtime']=_0x9765d0;};exports[_0xa2ef('0x38')]=function(_0x1ab441,_0x331550,_0x18fe68){var _0x248420=moment()[_0xa2ef('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ab441[_0xa2ef('0x36')]=_0x331550;_0x1ab441['statedesc']=_0x18fe68;_0x1ab441[_0xa2ef('0x37')]=_0x248420;_0x1ab441[_0xa2ef('0x39')]=getSeconds(_0x1ab441[_0xa2ef('0x37')],_0x1ab441[_0xa2ef('0x3a')]);};exports[_0xa2ef('0x3b')]=function(_0x4037a0,_0x2a2453,_0x227dd3){_0x4037a0['membername']=_0x2a2453;_0x4037a0[_0xa2ef('0x3c')]=_0x227dd3;};exports[_0xa2ef('0x3d')]=function(_0x213228,_0x4a7019,_0x18868a){var _0x83958a=moment()[_0xa2ef('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x213228[_0xa2ef('0x36')]=_0x4a7019;_0x213228[_0xa2ef('0x3e')]=_0x18868a;_0x213228[_0xa2ef('0x37')]=_0x213228[_0xa2ef('0x37')]?_0x213228['responsetime']:_0x83958a;_0x213228[_0xa2ef('0x3f')]=_0x213228['endtime']?_0x213228[_0xa2ef('0x3f')]:_0x83958a;_0x213228[_0xa2ef('0x39')]=getSeconds(_0x213228['responsetime']||0x0,_0x213228[_0xa2ef('0x3a')]||0x0);_0x213228[_0xa2ef('0x40')]=_0x213228[_0xa2ef('0x41')]?getSeconds(_0x213228[_0xa2ef('0x3f')],_0x213228['answertime']):0x0;};exports[_0xa2ef('0x42')]=function(_0x2aecae){return _0x2aecae===_0xa2ef('0x43');};exports['variablesAction']=function(_0x472673,_0x5060d2,_0x48412b,_0x2da467,_0x2660b7){var _0x4e53bd=_0x2da467?_0xa2ef('0x44'):_0x472673[_0xa2ef('0x19')];_0x4e53bd=_0x2660b7?'BOOKED':_0x4e53bd;return{'actionid':_0x472673['uniqueid'],'action':_0xa2ef('0x45'),'channel':_0x472673['channelAgent'],'callerid':util['format'](_0xa2ef('0x13'),_0x4e53bd,_0x472673['calleridnum']),'Exten':_0xa2ef('0x25'),'Context':_0xa2ef('0x46'),'Priority':'1','variable':_0x48412b,'timeout':(_0x5060d2[_0xa2ef('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x472673[_0xa2ef('0x48')]};};exports[_0xa2ef('0x49')]=function(_0xfa87ef){return _0xfa87ef['countbusyretry']+_0xfa87ef['countcongestionretry']+_0xfa87ef['countnoanswerretry']+_0xfa87ef[_0xa2ef('0x4a')]+_0xfa87ef[_0xa2ef('0x4b')];};exports['cloneAction']=function(_0x4815cb){var _0xd23f59=_[_0xa2ef('0x4c')](_0x4815cb);_0xd23f59['state']=0xf;_0xd23f59[_0xa2ef('0x3e')]='Global';return _0xd23f59;};exports[_0xa2ef('0x4d')]=function(_0x10e649,_0x286e4b,_0x4bdcc1){var _0x3d55e7={};_0x3d55e7[_0x286e4b]=_0x10e649[_0x286e4b];_0x3d55e7[_0xa2ef('0x4e')]=![];_0x3d55e7[_0xa2ef('0x4f')]=moment()[_0xa2ef('0x50')](_0x4bdcc1,_0xa2ef('0x51'))[_0xa2ef('0x12')](_0xa2ef('0x35'));_0x3d55e7['ContactId']=_0x10e649[_0xa2ef('0x52')];_0x3d55e7[_0xa2ef('0x53')]=_0x10e649[_0xa2ef('0x53')];_0x3d55e7[_0xa2ef('0x1c')]=_0x10e649[_0xa2ef('0x1c')]||undefined;return _0x3d55e7;};exports[_0xa2ef('0x54')]=function(_0x331ba1,_0x34732c){if(!_[_0xa2ef('0x16')](_0x331ba1)){if(_0x331ba1['pTalking']>0x0){_0x331ba1[_0xa2ef('0x55')]-=0x1;}else{logger[_0xa2ef('0x8')](_0x34732c,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xa2ef('0x8')](_0x34732c,_0xa2ef('0x56'));}};exports[_0xa2ef('0x57')]=function(_0x13ab33){if(_0x13ab33<=0x0){return!![];}return![];};exports[_0xa2ef('0x58')]=function(_0x399c39,_0x471c1b,_0x1803d1){_0x399c39[_0xa2ef('0x59')]=_0x471c1b;_0x399c39['name']=_0x399c39[_0xa2ef('0x5a')];_0x399c39[_0xa2ef('0x5b')]=_0x399c39[_0xa2ef('0x5c')];if(_0x1803d1){_0x399c39[_0xa2ef('0x5d')]=_0x1803d1[_0xa2ef('0x5d')];}return _0x399c39;};exports[_0xa2ef('0x5e')]=function(_0x35d1fa){var _0x4cc669={};_0x4cc669[_0xa2ef('0x5a')]=_0x35d1fa[_0xa2ef('0x5a')];_0x4cc669[_0xa2ef('0x5b')]=_0x35d1fa[_0xa2ef('0x5c')];_0x4cc669[_0xa2ef('0x48')]=_0x35d1fa[_0xa2ef('0x48')];return _0x4cc669;};exports['agentReadyId']=function(_0xcbf46f){var _0x377074=[];for(var _0x248a1c in _0xcbf46f){if(_0xcbf46f[_0xa2ef('0x29')](_0x248a1c)){if(!_[_0xa2ef('0x16')](_0xcbf46f[_0x248a1c])&&_0xcbf46f[_0x248a1c]['state']===_0xa2ef('0x5f')&&_0xcbf46f[_0x248a1c][_0xa2ef('0x60')]===_0xa2ef('0x61')){_0x377074[_0xa2ef('0x62')](_0xcbf46f[_0x248a1c]['id']);}}}return _0x377074;};exports[_0xa2ef('0x63')]=function(_0x4d95a2){var _0x26a652=moment()[_0xa2ef('0x5')](0x0);var _0x37dd0a=moment(_0x4d95a2)[_0xa2ef('0x5')](0x0);return _0x26a652[_0xa2ef('0x6')](_0x37dd0a,'seconds');};exports[_0xa2ef('0x64')]=function(_0x164ee8){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x164ee8[_0xa2ef('0x52')],'ListId':_0x164ee8[_0xa2ef('0x53')],'VoiceQueueId':_0x164ee8[_0xa2ef('0x1c')]||undefined,'CampaignId':_0x164ee8[_0xa2ef('0x65')]||undefined};};exports['filterKey']=function(_0x4a8f93){if(_0x4a8f93==='uniqueid'||_0x4a8f93===_0xa2ef('0x66')||_0x4a8f93===_0xa2ef('0x5a')||_0x4a8f93===_0xa2ef('0x67')||_0x4a8f93===_0xa2ef('0x68')||_0x4a8f93===_0xa2ef('0x69')||_0x4a8f93===_0xa2ef('0x6a')||_0x4a8f93==='channelAgent'||_0x4a8f93===_0xa2ef('0x19')||_0x4a8f93===_0xa2ef('0x4e')||_0x4a8f93===_0xa2ef('0x1a')||_0x4a8f93===_0xa2ef('0x4f')||_0x4a8f93==='countbusyretry'||_0x4a8f93===_0xa2ef('0x6b')||_0x4a8f93===_0xa2ef('0x6c')||_0x4a8f93===_0xa2ef('0x6d')||_0x4a8f93===_0xa2ef('0x6e')||_0x4a8f93===_0xa2ef('0x6f')||_0x4a8f93===_0xa2ef('0x70')||_0x4a8f93==='recallme'||_0x4a8f93===_0xa2ef('0x52')||_0x4a8f93===_0xa2ef('0x53')||_0x4a8f93===_0xa2ef('0x3c')||_0x4a8f93===_0xa2ef('0x1c')||_0x4a8f93===_0xa2ef('0x71')||_0x4a8f93===_0xa2ef('0x72')||_0x4a8f93===_0xa2ef('0x73')||_0x4a8f93===_0xa2ef('0x74')||_0x4a8f93==='xmd-listid'||_0x4a8f93===_0xa2ef('0x75')||_0x4a8f93===_0xa2ef('0x76')||_0x4a8f93===_0xa2ef('0x77')||_0x4a8f93===_0xa2ef('0x78')||_0x4a8f93===_0xa2ef('0x79')||_0x4a8f93==='xmd-contactid'||_0x4a8f93==='xmd-cdrtype'||_0x4a8f93===_0xa2ef('0x7a')||_0x4a8f93==='xmd-agiafter'||_0x4a8f93===_0xa2ef('0x7b')||_0x4a8f93==='rtpaudioqos'||_0x4a8f93===_0xa2ef('0x7c')||_0x4a8f93===_0xa2ef('0x7d')||_0x4a8f93===_0xa2ef('0x7e')||_0x4a8f93===_0xa2ef('0x7f')||_0x4a8f93==='rtpaudioqoslossbridged'||_0x4a8f93===_0xa2ef('0x80')||_0x4a8f93===_0xa2ef('0x81')||_0x4a8f93==='rtpaudioqos'||_0x4a8f93===_0xa2ef('0x7c')||_0x4a8f93==='rtpaudioqosjitter'||_0x4a8f93===_0xa2ef('0x7e')||_0x4a8f93===_0xa2ef('0x7f')||_0x4a8f93==='rtpaudioqoslossbridged'||_0x4a8f93===_0xa2ef('0x80')||_0x4a8f93===_0xa2ef('0x81')||_0x4a8f93===_0xa2ef('0x82')||_0x4a8f93===_0xa2ef('0x83')||_0x4a8f93==='state'||_0x4a8f93==='statedesc'){return![];}return!![];};exports[_0xa2ef('0x84')]=function(_0x4e4a28,_0x13389d){var _0x55f6f6,_0x1149bb,_0x40abcf;if(_0x13389d<=0x0){_0x13389d=0x1;}_0x55f6f6=new RegExp(_0xa2ef('0x85')+_0x13389d+'}$');_0x1149bb=Math[_0xa2ef('0x86')](0xa,_0x13389d-0x1);_0x40abcf=Math[_0xa2ef('0x86')](0xa,_0x13389d)-0x1;return util[_0xa2ef('0x12')]('%s',_[_0xa2ef('0x87')](_0x4e4a28,_0x55f6f6,_['random'](_0x1149bb,_0x40abcf)));};exports[_0xa2ef('0x88')]=function(_0x533edc){var _0xfe561a=_0x533edc['match'](/"(.*?)"/);return _0xfe561a?_0xfe561a[0x1]:_0x533edc;};exports[_0xa2ef('0x89')]=function(_0x32b5ee){var _0x37c1d2=_0x32b5ee[_0xa2ef('0x8a')](/<(.*?)>/);return _0x37c1d2?_0x37c1d2[0x1]:_0x32b5ee;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index abbdedb..7021c4d 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x428fbb,_0x395454){var _0x4ed8cc=function(_0x311e68){while(--_0x311e68){_0x428fbb['push'](_0x428fbb['shift']());}};_0x4ed8cc(++_0x395454);}(_0x5f2f,0x73));var _0xf5f2=function(_0xa46c62,_0x4dd30b){_0xa46c62=_0xa46c62-0x0;var _0x38652f=_0x5f2f[_0xa46c62];return _0x38652f;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x3856e9,_0x4fddd9){var _0x47b5fa=function(_0x3f8c2c){while(--_0x3f8c2c){_0x3856e9['push'](_0x3856e9['shift']());}};_0x47b5fa(++_0x4fddd9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4743a8,_0x528273){_0x4743a8=_0x4743a8-0x0;var _0x49aa2e=_0x5f2f[_0x4743a8];return _0x49aa2e;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 5be6637..f9a7bff 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 _0x45ba=['initSugarcrmAccounts','sugarcrmAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/servicenowAccount','agents','telephones','trunks','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','interface','total','answered','sumHoldTime','sumDuration','isEmpty','unmanaged','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isNil','isUndefined','initTelephones','initTrunks','initVoiceQueues','voiceQueues','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts'];(function(_0x6bec06,_0x30b172){var _0x30e317=function(_0x394570){while(--_0x394570){_0x6bec06['push'](_0x6bec06['shift']());}};_0x30e317(++_0x30b172);}(_0x45ba,0x1c0));var _0xa45b=function(_0x2e3359,_0x3fe704){_0x2e3359=_0x2e3359-0x0;var _0x135e3e=_0x45ba[_0x2e3359];return _0x135e3e;};'use strict';var BPromise=require(_0xa45b('0x0'));var util=require(_0xa45b('0x1'));var _=require(_0xa45b('0x2'));var moment=require(_0xa45b('0x3'));var Agent=require(_0xa45b('0x4'));var Telephone=require(_0xa45b('0x5'));var Trunk=require(_0xa45b('0x6'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xa45b('0x7'));var Template=require(_0xa45b('0x8'));var Campaign=require(_0xa45b('0x9'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xa45b('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xa45b('0xb'));var ZohoAccount=require(_0xa45b('0xc'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xa45b('0xd'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xa45b('0xe')]={};this[_0xa45b('0xf')]={};this[_0xa45b('0x10')]={};this['voiceQueues']={};this[_0xa45b('0x11')]={};this[_0xa45b('0x12')]={};this[_0xa45b('0x13')]={};this[_0xa45b('0x14')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xa45b('0x15')]={};this[_0xa45b('0x16')]={};this[_0xa45b('0x17')]={};this[_0xa45b('0x18')]={};this[_0xa45b('0x19')]={};this['zendeskAccounts']={};this[_0xa45b('0x1a')]={};this['sugarcrmAccounts']={};this[_0xa45b('0x1b')]={};this[_0xa45b('0x1c')]={};this[_0xa45b('0x1d')]={};this[_0xa45b('0x1e')]={};this[_0xa45b('0x1f')]={};this[_0xa45b('0x20')]={};this[_0xa45b('0x21')]={};this[_0xa45b('0x22')]={};};function freeIsNotKey(_0x1339c1,_0x30e1a1,_0xab8401){var _0xcd86e4=_[_0xa45b('0x23')](_0x1339c1,function(_0x204431,_0x8c37eb){return _0x204431[_0xab8401];});for(var _0x2a51a9 in _0x30e1a1){if(_0x30e1a1[_0xa45b('0x24')](_0x2a51a9)){if(!_0xcd86e4[_0x2a51a9]){delete _0x30e1a1[_0x2a51a9];}}}}function freeIsNotKeySip(_0x3c8963,_0x147bb9){var _0x494e4b=_[_0xa45b('0x23')](_0x3c8963,function(_0x87dbd0,_0x446887){return util[_0xa45b('0x25')](_0xa45b('0x26'),_0x87dbd0[_0xa45b('0x27')]);});for(var _0x5a9d6f in _0x147bb9){if(_0x147bb9[_0xa45b('0x24')](_0x5a9d6f)){if(!_0x494e4b[_0x5a9d6f]){delete _0x147bb9[_0x5a9d6f];}}}}function freeIsNotKeyAgent(_0x2e83f3,_0x9459a){var _0x2eb6e5=_['mapKeys'](_0x2e83f3,function(_0x4e3298,_0xc295e7){var _0x50f807=_['isNil'](_0x4e3298[_0xa45b('0x28')])?util[_0xa45b('0x25')](_0xa45b('0x26'),_0x4e3298[_0xa45b('0x27')]):_0x4e3298[_0xa45b('0x28')];return _0x50f807;});for(var _0x2f0476 in _0x9459a){if(_0x9459a[_0xa45b('0x24')](_0x2f0476)){if(!_0x2eb6e5[_0x2f0476]){delete _0x9459a[_0x2f0476];}}}}function clearVoiceCallReports(_0x277f48){_0x277f48[_0xa45b('0x29')]=0x0;_0x277f48[_0xa45b('0x2a')]=0x0;_0x277f48[_0xa45b('0x2b')]=0x0;_0x277f48[_0xa45b('0x2c')]=0x0;_0x277f48['sumBillable']=0x0;}function clearCampaigns(_0x1452f9){if(!_[_0xa45b('0x2d')](_0x1452f9)){for(var _0x43a072 in _0x1452f9){if(_0x1452f9[_0xa45b('0x24')](_0x43a072)){_0x1452f9[_0x43a072]['ivrTotalCallsDays']=0x0;_0x1452f9[_0x43a072]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x1a990a){if(!_[_0xa45b('0x2d')](_0x1a990a)){for(var _0x5abec8 in _0x1a990a){if(_0x1a990a[_0xa45b('0x24')](_0x5abec8)){_0x1a990a[_0x5abec8][_0xa45b('0x29')]=0x0;_0x1a990a[_0x5abec8][_0xa45b('0x2a')]=0x0;_0x1a990a[_0x5abec8][_0xa45b('0x2e')]=0x0;_0x1a990a[_0x5abec8][_0xa45b('0x2f')]=0x0;_0x1a990a[_0x5abec8][_0xa45b('0x2b')]=0x0;_0x1a990a[_0x5abec8][_0xa45b('0x2c')]=0x0;_0x1a990a[_0x5abec8][_0xa45b('0x30')]=0x0;_0x1a990a[_0x5abec8][_0xa45b('0x31')]=0x0;_0x1a990a[_0x5abec8][_0xa45b('0x32')]=0x0;_0x1a990a[_0x5abec8]['outboundBusyCallsDay']=0x0;_0x1a990a[_0x5abec8][_0xa45b('0x33')]=0x0;_0x1a990a[_0x5abec8][_0xa45b('0x34')]=0x0;_0x1a990a[_0x5abec8][_0xa45b('0x35')]=0x0;_0x1a990a[_0x5abec8]['outboundDropCallsDayTimeout']=0x0;_0x1a990a[_0x5abec8][_0xa45b('0x36')]=0x0;_0x1a990a[_0x5abec8][_0xa45b('0x37')]=0x0;_0x1a990a[_0x5abec8][_0xa45b('0x38')]=0x0;_0x1a990a[_0x5abec8][_0xa45b('0x39')]=0x0;_0x1a990a[_0x5abec8][_0xa45b('0x3a')]=0x0;_0x1a990a[_0x5abec8][_0xa45b('0x31')]=0x0;_0x1a990a[_0x5abec8][_0xa45b('0x3b')]=0x0;_0x1a990a[_0x5abec8][_0xa45b('0x3c')]=!![];}}}}Realtime[_0xa45b('0x3d')][_0xa45b('0x3e')]=function(_0x318a06,_0x22a128){for(var _0x496d18 in _0x22a128){if(_0x318a06[_0xa45b('0x24')](_0x496d18)){_0x318a06[_0x496d18]=_0x22a128[_0x496d18];}}};Realtime[_0xa45b('0x3d')][_0xa45b('0x3f')]=function(){var _0x49190f=this;return function(_0x1e9eaf){if(_0x1e9eaf){freeIsNotKeyAgent(_0x1e9eaf,_0x49190f['agents']);for(var _0x556d28=0x0,_0x39cebc={},_0x58672d={};_0x556d28<_0x1e9eaf[_0xa45b('0x40')];_0x556d28+=0x1){_0x39cebc=_0x1e9eaf[_0x556d28];var _0x50b923=_[_0xa45b('0x41')](_0x39cebc[_0xa45b('0x28')])?util[_0xa45b('0x25')]('SIP/%s',_0x39cebc[_0xa45b('0x27')]):_0x39cebc['interface'];if(_[_0xa45b('0x42')](_0x49190f[_0xa45b('0xe')][_0x50b923])){_0x49190f[_0xa45b('0xe')][_0x50b923]=new Agent(_0x39cebc);}else{_0x49190f['mergeFromDatabase'](_0x49190f[_0xa45b('0xe')][_0x50b923],_0x39cebc);}}}return _0x49190f[_0xa45b('0xe')];};};Realtime[_0xa45b('0x3d')][_0xa45b('0x43')]=function(){var _0x48b34d=this;return function(_0x3b7235){if(_0x3b7235){freeIsNotKeySip(_0x3b7235,_0x48b34d[_0xa45b('0xf')]);for(var _0x405983=0x0,_0x38b90={},_0x112482={};_0x405983<_0x3b7235['length'];_0x405983+=0x1){_0x38b90=_0x3b7235[_0x405983];if(_['isUndefined'](_0x48b34d['telephones'][util[_0xa45b('0x25')]('SIP/%s',_0x38b90[_0xa45b('0x27')])])){_0x48b34d[_0xa45b('0xf')][util[_0xa45b('0x25')](_0xa45b('0x26'),_0x38b90['name'])]=new Telephone(_0x38b90);}else{_0x48b34d['mergeFromDatabase'](_0x48b34d[_0xa45b('0xf')][util['format'](_0xa45b('0x26'),_0x38b90[_0xa45b('0x27')])],_0x38b90);}}}return _0x48b34d[_0xa45b('0xf')];};};Realtime[_0xa45b('0x3d')][_0xa45b('0x44')]=function(){var _0x687f92=this;return function(_0x33e732){if(_0x33e732){freeIsNotKeySip(_0x33e732,_0x687f92[_0xa45b('0x10')]);for(var _0x1f80b5=0x0,_0xc01466={},_0x297048={};_0x1f80b5<_0x33e732[_0xa45b('0x40')];_0x1f80b5+=0x1){_0xc01466=_0x33e732[_0x1f80b5];if(_['isUndefined'](_0x687f92['trunks'][util[_0xa45b('0x25')](_0xa45b('0x26'),_0xc01466[_0xa45b('0x27')])])){_0x687f92[_0xa45b('0x10')][util[_0xa45b('0x25')](_0xa45b('0x26'),_0xc01466[_0xa45b('0x27')])]=new Trunk(_0xc01466);}else{_0x687f92[_0xa45b('0x3e')](_0x687f92[_0xa45b('0x10')][util[_0xa45b('0x25')]('SIP/%s',_0xc01466['name'])],_0xc01466);}}}return _0x687f92[_0xa45b('0x10')];};};Realtime[_0xa45b('0x3d')][_0xa45b('0x45')]=function(){var _0x4213b1=this;return function(_0x27baf0){if(_0x27baf0){freeIsNotKey(_0x27baf0,_0x4213b1[_0xa45b('0x46')],'name');for(var _0x30eb5c=0x0,_0x563724={},_0x54584d={};_0x30eb5c<_0x27baf0[_0xa45b('0x40')];_0x30eb5c+=0x1){_0x563724=_0x27baf0[_0x30eb5c];if(_['isUndefined'](_0x4213b1[_0xa45b('0x46')][_0x563724[_0xa45b('0x27')]])){_0x4213b1['voiceQueues'][_0x563724[_0xa45b('0x27')]]=new VoiceQueue(_0x563724);}else{_0x4213b1[_0xa45b('0x3e')](_0x4213b1[_0xa45b('0x46')][_0x563724['name']],_0x563724);}}}return _0x4213b1[_0xa45b('0x46')];};};Realtime[_0xa45b('0x3d')]['initTriggers']=function(){var _0x2ef526=this;return function(_0x50fd08){if(_0x50fd08){freeIsNotKey(_0x50fd08,_0x2ef526[_0xa45b('0x11')],'id');for(var _0x25e313=0x0,_0x2a78c4={},_0x45e84d={};_0x25e313<_0x50fd08[_0xa45b('0x40')];_0x25e313+=0x1){_0x2a78c4=_0x50fd08[_0x25e313];if(_[_0xa45b('0x42')](_0x2ef526[_0xa45b('0x11')][_0x2a78c4['id']])){_0x2ef526[_0xa45b('0x11')][_0x2a78c4['id']]=new Trigger(_0x2a78c4);}else{_0x2ef526[_0xa45b('0x3e')](_0x2ef526[_0xa45b('0x11')][_0x2a78c4['id']],_0x2a78c4);}}}return _0x2ef526[_0xa45b('0x11')];};};Realtime['prototype'][_0xa45b('0x47')]=function(){var _0x42d714=this;return function(_0x340e83){if(_0x340e83){freeIsNotKey(_0x340e83,_0x42d714[_0xa45b('0x13')],'id');for(var _0x10873f=0x0,_0x1e81f0={},_0x5c9b0a={};_0x10873f<_0x340e83['length'];_0x10873f+=0x1){_0x1e81f0=_0x340e83[_0x10873f];if(_[_0xa45b('0x42')](_0x42d714[_0xa45b('0x13')][_0x1e81f0['id']])){_0x42d714[_0xa45b('0x13')][_0x1e81f0['id']]=new Template(_0x1e81f0);}else{_0x42d714['mergeFromDatabase'](_0x42d714[_0xa45b('0x13')][_0x1e81f0['id']],_0x1e81f0);}}}return _0x42d714['templates'];};};Realtime['prototype'][_0xa45b('0x48')]=function(){var _0xb4ca5a=this;return function(_0x1353b5){if(_0x1353b5){freeIsNotKey(_0x1353b5,_0xb4ca5a[_0xa45b('0x49')],'id');for(var _0x400822=0x0,_0x8fc0a2={},_0x1bc5eb={};_0x400822<_0x1353b5[_0xa45b('0x40')];_0x400822+=0x1){_0x8fc0a2=_0x1353b5[_0x400822];if(_[_0xa45b('0x42')](_0xb4ca5a[_0xa45b('0x49')][_0x8fc0a2['id']])){_0xb4ca5a[_0xa45b('0x49')][_0x8fc0a2['id']]=new ZendeskAccount(_0x8fc0a2);}else{_0xb4ca5a[_0xa45b('0x3e')](_0xb4ca5a[_0xa45b('0x49')][_0x8fc0a2['id']],_0x8fc0a2);}}}return _0xb4ca5a[_0xa45b('0x49')];};};Realtime[_0xa45b('0x3d')]['initSalesforceAccounts']=function(){var _0xe35abd=this;return function(_0xef1c5d){if(_0xef1c5d){freeIsNotKey(_0xef1c5d,_0xe35abd['salesforceAccounts'],'id');for(var _0xddbff7=0x0,_0x29e17c={},_0x1ccadd={};_0xddbff7<_0xef1c5d[_0xa45b('0x40')];_0xddbff7+=0x1){_0x29e17c=_0xef1c5d[_0xddbff7];if(_[_0xa45b('0x42')](_0xe35abd['salesforceAccounts'][_0x29e17c['id']])){_0xe35abd[_0xa45b('0x1a')][_0x29e17c['id']]=new SalesforceAccount(_0x29e17c);}else{_0xe35abd[_0xa45b('0x3e')](_0xe35abd[_0xa45b('0x1a')][_0x29e17c['id']],_0x29e17c);}}}return _0xe35abd[_0xa45b('0x1a')];};};Realtime[_0xa45b('0x3d')][_0xa45b('0x4a')]=function(){var _0x1c0a6c=this;return function(_0x3741bc){if(_0x3741bc){freeIsNotKey(_0x3741bc,_0x1c0a6c[_0xa45b('0x1b')],'id');for(var _0x2d5bbf=0x0,_0x3e67de={},_0x5c8b71={};_0x2d5bbf<_0x3741bc['length'];_0x2d5bbf+=0x1){_0x3e67de=_0x3741bc[_0x2d5bbf];if(_[_0xa45b('0x42')](_0x1c0a6c[_0xa45b('0x1b')][_0x3e67de['id']])){_0x1c0a6c['freshdeskAccounts'][_0x3e67de['id']]=new FreshdeskAccount(_0x3e67de);}else{_0x1c0a6c[_0xa45b('0x3e')](_0x1c0a6c[_0xa45b('0x1b')][_0x3e67de['id']],_0x3e67de);}}}return _0x1c0a6c[_0xa45b('0x1b')];};};Realtime['prototype'][_0xa45b('0x4b')]=function(){var _0x50f5c9=this;return function(_0x574b81){if(_0x574b81){freeIsNotKey(_0x574b81,_0x50f5c9[_0xa45b('0x1c')],'id');for(var _0x5926a2=0x0,_0x945ed1={},_0x42bc9a={};_0x5926a2<_0x574b81[_0xa45b('0x40')];_0x5926a2+=0x1){_0x945ed1=_0x574b81[_0x5926a2];if(_[_0xa45b('0x42')](_0x50f5c9[_0xa45b('0x1c')][_0x945ed1['id']])){_0x50f5c9[_0xa45b('0x1c')][_0x945ed1['id']]=new ZohoAccount(_0x945ed1);}else{_0x50f5c9[_0xa45b('0x3e')](_0x50f5c9[_0xa45b('0x1c')][_0x945ed1['id']],_0x945ed1);}}}return _0x50f5c9[_0xa45b('0x1c')];};};Realtime['prototype'][_0xa45b('0x4c')]=function(){var _0x7f3aa9=this;return function(_0x1fffe9){if(_0x1fffe9){freeIsNotKey(_0x1fffe9,_0x7f3aa9[_0xa45b('0x1d')],'id');for(var _0x50cb01=0x0,_0x2fca3d={},_0x47630e={};_0x50cb01<_0x1fffe9['length'];_0x50cb01+=0x1){_0x2fca3d=_0x1fffe9[_0x50cb01];if(_['isUndefined'](_0x7f3aa9[_0xa45b('0x1d')][_0x2fca3d['id']])){_0x7f3aa9['deskAccounts'][_0x2fca3d['id']]=new DeskAccount(_0x2fca3d);}else{_0x7f3aa9[_0xa45b('0x3e')](_0x7f3aa9['deskAccounts'][_0x2fca3d['id']],_0x2fca3d);}}}return _0x7f3aa9[_0xa45b('0x1d')];};};Realtime[_0xa45b('0x3d')][_0xa45b('0x4d')]=function(){var _0x1ea330=this;return function(_0x5b87a6){if(_0x5b87a6){freeIsNotKey(_0x5b87a6,_0x1ea330[_0xa45b('0x4e')],'id');for(var _0x4fbf48=0x0,_0x42b3ef={},_0x43d789={};_0x4fbf48<_0x5b87a6['length'];_0x4fbf48+=0x1){_0x42b3ef=_0x5b87a6[_0x4fbf48];if(_['isUndefined'](_0x1ea330[_0xa45b('0x4e')][_0x42b3ef['id']])){_0x1ea330['sugarcrmAccounts'][_0x42b3ef['id']]=new SugarcrmAccount(_0x42b3ef);}else{_0x1ea330['mergeFromDatabase'](_0x1ea330['sugarcrmAccounts'][_0x42b3ef['id']],_0x42b3ef);}}}return _0x1ea330[_0xa45b('0x4e')];};};Realtime[_0xa45b('0x3d')]['initVtigerAccounts']=function(){var _0x20629b=this;return function(_0x59151f){if(_0x59151f){freeIsNotKey(_0x59151f,_0x20629b['vtigerAccounts'],'id');for(var _0x30100d=0x0,_0x2cceed={},_0x4ce98c={};_0x30100d<_0x59151f[_0xa45b('0x40')];_0x30100d+=0x1){_0x2cceed=_0x59151f[_0x30100d];if(_[_0xa45b('0x42')](_0x20629b[_0xa45b('0x1e')][_0x2cceed['id']])){_0x20629b['vtigerAccounts'][_0x2cceed['id']]=new VtigerAccount(_0x2cceed);}else{_0x20629b['mergeFromDatabase'](_0x20629b['vtigerAccounts'][_0x2cceed['id']],_0x2cceed);}}}return _0x20629b[_0xa45b('0x1e')];};};Realtime[_0xa45b('0x3d')]['initServicenowAccounts']=function(){var _0x5ad97f=this;return function(_0xef2ff){if(_0xef2ff){freeIsNotKey(_0xef2ff,_0x5ad97f[_0xa45b('0x1f')],'id');for(var _0x17e377=0x0,_0x19b3e5={},_0x1bdf5e={};_0x17e377<_0xef2ff['length'];_0x17e377+=0x1){_0x19b3e5=_0xef2ff[_0x17e377];if(_[_0xa45b('0x42')](_0x5ad97f[_0xa45b('0x1f')][_0x19b3e5['id']])){_0x5ad97f[_0xa45b('0x1f')][_0x19b3e5['id']]=new ServicenowAccount(_0x19b3e5);}else{_0x5ad97f[_0xa45b('0x3e')](_0x5ad97f[_0xa45b('0x1f')][_0x19b3e5['id']],_0x19b3e5);}}}return _0x5ad97f['servicenowAccounts'];};};Realtime[_0xa45b('0x3d')][_0xa45b('0x4f')]=function(){var _0x313305=this;return function(_0x40d12f){if(_0x40d12f){freeIsNotKey(_0x40d12f,_0x313305[_0xa45b('0x20')],'id');for(var _0x11eee1=0x0,_0x134b44={},_0x31c6f3={};_0x11eee1<_0x40d12f[_0xa45b('0x40')];_0x11eee1+=0x1){_0x134b44=_0x40d12f[_0x11eee1];if(_['isUndefined'](_0x313305[_0xa45b('0x20')][_0x134b44['id']])){_0x313305['dynamics365Accounts'][_0x134b44['id']]=new Dynamics365Account(_0x134b44);}else{_0x313305['mergeFromDatabase'](_0x313305[_0xa45b('0x20')][_0x134b44['id']],_0x134b44);}}}return _0x313305['dynamics365Accounts'];};};Realtime['prototype'][_0xa45b('0x50')]=function(){var _0x239584=this;return function(_0x54be30){if(_0x54be30){freeIsNotKey(_0x54be30,_0x239584[_0xa45b('0x21')],'id');for(var _0x2e74ab=0x0,_0x1d500c={},_0x13a185={};_0x2e74ab<_0x54be30[_0xa45b('0x40')];_0x2e74ab+=0x1){_0x1d500c=_0x54be30[_0x2e74ab];if(_['isUndefined'](_0x239584[_0xa45b('0x21')][_0x1d500c['id']])){_0x239584['freshsalesAccounts'][_0x1d500c['id']]=new FreshsalesAccount(_0x1d500c);}else{_0x239584[_0xa45b('0x3e')](_0x239584[_0xa45b('0x21')][_0x1d500c['id']],_0x1d500c);}}}return _0x239584[_0xa45b('0x21')];};};Realtime[_0xa45b('0x3d')]['initVoiceQueueHopperHistory']=function(){var _0x5caff8=this;return function(_0x2af8ac){for(var _0x3f212d=0x0;_0x3f212d<_0x2af8ac[_0xa45b('0x40')];_0x3f212d+=0x1){_[_0xa45b('0x51')](_0x5caff8[_0xa45b('0x46')][_0x2af8ac[_0x3f212d][_0xa45b('0x27')]],_0x2af8ac[_0x3f212d]);}return _0x5caff8[_0xa45b('0x46')];};};Realtime[_0xa45b('0x3d')][_0xa45b('0x52')]=function(){var _0xf1a38e=this;return function(_0x38d7c7){clearVoiceQueues(_0xf1a38e[_0xa45b('0x46')]);if(_0x38d7c7){_0x38d7c7=_[_0xa45b('0x53')](_0x38d7c7,_0xa45b('0x54'));for(var _0x1af23e in _0x38d7c7){if(_0x38d7c7['hasOwnProperty'](_0x1af23e)){var _0x3913d8={};for(var _0x423181=0x0;_0x423181<_0x38d7c7[_0x1af23e][_0xa45b('0x40')];_0x423181+=0x1){var _0x24de2f=_0x38d7c7[_0x1af23e][_0x423181][_0xa45b('0x55')];if(_0xf1a38e['voiceQueues'][_0x24de2f]){if(_0x38d7c7[_0x1af23e][_0x423181][_0xa45b('0x56')]){_0xf1a38e[_0xa45b('0x46')][_0x24de2f]['unmanaged']+=0x1;}if(_0x38d7c7[_0x1af23e][_0x423181][_0xa45b('0x57')]){_0xf1a38e[_0xa45b('0x46')][_0x24de2f][_0xa45b('0x2f')]+=0x1;}_0xf1a38e[_0xa45b('0x46')][_0x24de2f][_0xa45b('0x2b')]+=moment(_0x38d7c7[_0x1af23e][_0x423181][_0xa45b('0x58')])[_0xa45b('0x59')](moment(_0x38d7c7[_0x1af23e][_0x423181]['queuecallerjoinAt']),_0xa45b('0x5a'))||0x0;if(_0x423181===_0x38d7c7[_0x1af23e][_0xa45b('0x40')]-0x1){_0xf1a38e[_0xa45b('0x46')][_0x24de2f]['sumDuration']+=moment(_0x38d7c7[_0x1af23e][_0x423181][_0xa45b('0x5b')]||_0x38d7c7[_0x1af23e][_0x423181][_0xa45b('0x5c')]||_0x38d7c7[_0x1af23e][_0x423181][_0xa45b('0x5d')])[_0xa45b('0x59')](moment(_0x38d7c7[_0x1af23e][_0x423181]['queuecallerjoinAt']),_0xa45b('0x5a'))||0x0;_0xf1a38e[_0xa45b('0x46')][_0x24de2f][_0xa45b('0x29')]+=0x1;if(_0x38d7c7[_0x1af23e][_0x423181][_0xa45b('0x5e')]){_0xf1a38e[_0xa45b('0x46')][_0x24de2f][_0xa45b('0x2a')]+=0x1;_0xf1a38e[_0xa45b('0x46')][_0x24de2f][_0xa45b('0x30')]+=moment(_0x38d7c7[_0x1af23e][_0x423181][_0xa45b('0x5b')])['diff'](moment(_0x38d7c7[_0x1af23e][_0x423181]['queuecallerleaveAt']),_0xa45b('0x5a'))||0x0;}}else{_0xf1a38e[_0xa45b('0x46')][_0x24de2f][_0xa45b('0x2c')]+=_0xf1a38e['voiceQueues'][_0x24de2f][_0xa45b('0x2b')]||0x0;}}}}}}return _0xf1a38e['voiceQueues'];};};Realtime[_0xa45b('0x3d')][_0xa45b('0x5f')]=function(){var _0x5d242a=this;return function(_0x1f33d4){clearVoiceCallReports(_0x5d242a['outbound']);if(_0x1f33d4){for(var _0x37dbb8=0x0;_0x37dbb8<_0x1f33d4[_0xa45b('0x40')];_0x37dbb8+=0x1){_0x5d242a[_0xa45b('0x14')]['total']+=0x1;_0x5d242a[_0xa45b('0x14')][_0xa45b('0x2c')]+=_0x1f33d4[_0x37dbb8][_0xa45b('0x60')];if(_0x1f33d4[_0x37dbb8][_0xa45b('0x61')]==='ANSWERED'){_0x5d242a[_0xa45b('0x14')][_0xa45b('0x2a')]+=0x1;_0x5d242a[_0xa45b('0x14')][_0xa45b('0x2b')]+=_0x1f33d4[_0x37dbb8][_0xa45b('0x60')]-_0x1f33d4[_0x37dbb8][_0xa45b('0x62')]||0x0;_0x5d242a[_0xa45b('0x14')][_0xa45b('0x30')]+=_0x1f33d4[_0x37dbb8][_0xa45b('0x62')];}}}return _0x5d242a[_0xa45b('0x14')];};};Realtime[_0xa45b('0x3d')][_0xa45b('0x63')]=function(){var _0x4e453f=this;return function(_0x137863){if(_0x137863){freeIsNotKey(_0x137863,_0x4e453f[_0xa45b('0x12')],'name');for(var _0x465b4a=0x0,_0x148530={};_0x465b4a<_0x137863[_0xa45b('0x40')];_0x465b4a+=0x1){_0x148530=_0x137863[_0x465b4a];if(_[_0xa45b('0x42')](_0x4e453f[_0xa45b('0x12')][_0x148530[_0xa45b('0x27')]])){_0x4e453f['campaigns'][_0x148530[_0xa45b('0x27')]]=new Campaign(_0x148530);}else{_0x4e453f['mergeFromDatabase'](_0x4e453f[_0xa45b('0x12')][_0x148530['name']],_0x148530);_0x4e453f['campaigns'][_0x148530['name']][_0xa45b('0x64')]=_0x148530[_0xa45b('0x65')]?_0x148530[_0xa45b('0x65')][_0xa45b('0x27')]:undefined;}}}return _0x4e453f[_0xa45b('0x12')];};};Realtime[_0xa45b('0x3d')][_0xa45b('0x66')]=function(){var _0x15409a=this;return function(_0x55448c){if(_0x55448c){freeIsNotKey(_0x55448c,_0x15409a[_0xa45b('0x15')],'id');for(var _0x91462b=0x0,_0x1c2c99={};_0x91462b<_0x55448c['length'];_0x91462b+=0x1){_0x1c2c99=_0x55448c[_0x91462b];if(_['isUndefined'](_0x15409a['voiceExtensions'][_0x1c2c99['id']])){_0x15409a[_0xa45b('0x15')][_0x1c2c99['id']]=new VoiceExtension(_0x1c2c99);}else{_0x15409a[_0xa45b('0x3e')](_0x15409a[_0xa45b('0x15')][_0x1c2c99['id']],_0x1c2c99);}}}return _0x15409a[_0xa45b('0x15')];};};Realtime['prototype'][_0xa45b('0x67')]=function(){var _0x31d5ef=this;return function(_0x19e978){clearCampaigns(_0x31d5ef[_0xa45b('0x12')]);for(var _0x5af6ea=0x0;_0x5af6ea<_0x19e978[_0xa45b('0x40')];_0x5af6ea+=0x1){_['merge'](_0x31d5ef[_0xa45b('0x12')][_0x19e978[_0x5af6ea]['name']],_0x19e978[_0x5af6ea]);}return _0x31d5ef[_0xa45b('0x12')];};};Realtime[_0xa45b('0x3d')][_0xa45b('0x68')]=function(){var _0x34f6c4=this;return function(_0x4aa230){if(_0x4aa230){freeIsNotKey(_0x4aa230,_0x34f6c4[_0xa45b('0x22')],'id');for(var _0x2d185b=0x0,_0x1a8194={},_0x3d7f6c={};_0x2d185b<_0x4aa230['length'];_0x2d185b+=0x1){_0x1a8194=_0x4aa230[_0x2d185b];if(_[_0xa45b('0x42')](_0x34f6c4[_0xa45b('0x22')][_0x1a8194['id']])){_0x34f6c4[_0xa45b('0x22')][_0x1a8194['id']]=new FaxAccount(_0x1a8194);}else{_0x34f6c4[_0xa45b('0x3e')](_0x34f6c4[_0xa45b('0x22')][_0x1a8194['id']],_0x1a8194);}}}return _0x34f6c4[_0xa45b('0x22')];};};module['exports']=Realtime; \ No newline at end of file +var _0xc8be=['queuecallerleaveAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallerjoinAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','triggers','campaigns','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','zendeskAccounts','sugarcrmAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','format','SIP/%s','name','mapKeys','isNil','interface','hasOwnProperty','total','answered','sumHoldTime','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','unmanaged','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','trunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerexit','queuecallerabandon','abandoned'];(function(_0x200351,_0x58f58d){var _0x196a0e=function(_0x1f1421){while(--_0x1f1421){_0x200351['push'](_0x200351['shift']());}};_0x196a0e(++_0x58f58d);}(_0xc8be,0x15d));var _0xec8b=function(_0x57b438,_0x4d72c5){_0x57b438=_0x57b438-0x0;var _0x4b9ba0=_0xc8be[_0x57b438];return _0x4b9ba0;};'use strict';var BPromise=require(_0xec8b('0x0'));var util=require(_0xec8b('0x1'));var _=require(_0xec8b('0x2'));var moment=require(_0xec8b('0x3'));var Agent=require(_0xec8b('0x4'));var Telephone=require(_0xec8b('0x5'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xec8b('0x6'));var Trigger=require(_0xec8b('0x7'));var Template=require(_0xec8b('0x8'));var Campaign=require(_0xec8b('0x9'));var VoiceExtension=require(_0xec8b('0xa'));var ZendeskAccount=require(_0xec8b('0xb'));var SalesforceAccount=require(_0xec8b('0xc'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xec8b('0xd'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xec8b('0xe'));var VtigerAccount=require(_0xec8b('0xf'));var ServicenowAccount=require(_0xec8b('0x10'));var Dynamics365Account=require(_0xec8b('0x11'));var FreshsalesAccount=require(_0xec8b('0x12'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xec8b('0x13')]={};this[_0xec8b('0x14')]={};this['trunks']={};this['voiceQueues']={};this[_0xec8b('0x15')]={};this[_0xec8b('0x16')]={};this[_0xec8b('0x17')]={};this[_0xec8b('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xec8b('0x19')]={};this['channels']={};this[_0xec8b('0x1a')]={};this[_0xec8b('0x1b')]={};this[_0xec8b('0x1c')]={};this[_0xec8b('0x1d')]={};this['salesforceAccounts']={};this[_0xec8b('0x1e')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this['deskAccounts']={};this[_0xec8b('0x1f')]={};this[_0xec8b('0x20')]={};this[_0xec8b('0x21')]={};this[_0xec8b('0x22')]={};this['faxAccounts']={};};function freeIsNotKey(_0x98b02f,_0x3a616d,_0x4e4c94){var _0x5513b0=_['mapKeys'](_0x98b02f,function(_0x5a8dce,_0x78c174){return _0x5a8dce[_0x4e4c94];});for(var _0x550cf7 in _0x3a616d){if(_0x3a616d['hasOwnProperty'](_0x550cf7)){if(!_0x5513b0[_0x550cf7]){delete _0x3a616d[_0x550cf7];}}}}function freeIsNotKeySip(_0x1669da,_0x5bfd3b){var _0x40f646=_['mapKeys'](_0x1669da,function(_0x333f71,_0x4c455c){return util[_0xec8b('0x23')](_0xec8b('0x24'),_0x333f71[_0xec8b('0x25')]);});for(var _0x3a4311 in _0x5bfd3b){if(_0x5bfd3b['hasOwnProperty'](_0x3a4311)){if(!_0x40f646[_0x3a4311]){delete _0x5bfd3b[_0x3a4311];}}}}function freeIsNotKeyAgent(_0x43cfbd,_0x336c2e){var _0x4728e1=_[_0xec8b('0x26')](_0x43cfbd,function(_0x2756e1,_0x5ba0ee){var _0x8d00d3=_[_0xec8b('0x27')](_0x2756e1[_0xec8b('0x28')])?util[_0xec8b('0x23')](_0xec8b('0x24'),_0x2756e1[_0xec8b('0x25')]):_0x2756e1['interface'];return _0x8d00d3;});for(var _0x5bbf97 in _0x336c2e){if(_0x336c2e[_0xec8b('0x29')](_0x5bbf97)){if(!_0x4728e1[_0x5bbf97]){delete _0x336c2e[_0x5bbf97];}}}}function clearVoiceCallReports(_0x5b5c78){_0x5b5c78[_0xec8b('0x2a')]=0x0;_0x5b5c78[_0xec8b('0x2b')]=0x0;_0x5b5c78[_0xec8b('0x2c')]=0x0;_0x5b5c78['sumDuration']=0x0;_0x5b5c78[_0xec8b('0x2d')]=0x0;}function clearCampaigns(_0xf98d65){if(!_['isEmpty'](_0xf98d65)){for(var _0x36d7a6 in _0xf98d65){if(_0xf98d65[_0xec8b('0x29')](_0x36d7a6)){_0xf98d65[_0x36d7a6][_0xec8b('0x2e')]=0x0;_0xf98d65[_0x36d7a6][_0xec8b('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x1e7b30){if(!_[_0xec8b('0x30')](_0x1e7b30)){for(var _0x3ad171 in _0x1e7b30){if(_0x1e7b30[_0xec8b('0x29')](_0x3ad171)){_0x1e7b30[_0x3ad171][_0xec8b('0x2a')]=0x0;_0x1e7b30[_0x3ad171][_0xec8b('0x2b')]=0x0;_0x1e7b30[_0x3ad171][_0xec8b('0x31')]=0x0;_0x1e7b30[_0x3ad171]['abandoned']=0x0;_0x1e7b30[_0x3ad171][_0xec8b('0x2c')]=0x0;_0x1e7b30[_0x3ad171][_0xec8b('0x32')]=0x0;_0x1e7b30[_0x3ad171]['sumBillable']=0x0;_0x1e7b30[_0x3ad171][_0xec8b('0x33')]=0x0;_0x1e7b30[_0x3ad171][_0xec8b('0x34')]=0x0;_0x1e7b30[_0x3ad171][_0xec8b('0x35')]=0x0;_0x1e7b30[_0x3ad171][_0xec8b('0x36')]=0x0;_0x1e7b30[_0x3ad171]['outboundNoSuchCallsDay']=0x0;_0x1e7b30[_0x3ad171]['outboundUnknownCallsDay']=0x0;_0x1e7b30[_0x3ad171][_0xec8b('0x37')]=0x0;_0x1e7b30[_0x3ad171][_0xec8b('0x38')]=0x0;_0x1e7b30[_0x3ad171]['outboundBlacklistCallsDay']=0x0;_0x1e7b30[_0x3ad171][_0xec8b('0x39')]=0x0;_0x1e7b30[_0x3ad171][_0xec8b('0x3a')]=0x0;_0x1e7b30[_0x3ad171][_0xec8b('0x3b')]=0x0;_0x1e7b30[_0x3ad171][_0xec8b('0x33')]=0x0;_0x1e7b30[_0x3ad171][_0xec8b('0x3c')]=0x0;_0x1e7b30[_0x3ad171][_0xec8b('0x3d')]=!![];}}}}Realtime[_0xec8b('0x3e')][_0xec8b('0x3f')]=function(_0x513695,_0x5c59c5){for(var _0x34e71a in _0x5c59c5){if(_0x513695[_0xec8b('0x29')](_0x34e71a)){_0x513695[_0x34e71a]=_0x5c59c5[_0x34e71a];}}};Realtime['prototype'][_0xec8b('0x40')]=function(){var _0x1fc576=this;return function(_0x32aab9){if(_0x32aab9){freeIsNotKeyAgent(_0x32aab9,_0x1fc576['agents']);for(var _0x52a0f0=0x0,_0x39ef13={},_0x31eb48={};_0x52a0f0<_0x32aab9[_0xec8b('0x41')];_0x52a0f0+=0x1){_0x39ef13=_0x32aab9[_0x52a0f0];var _0x289742=_[_0xec8b('0x27')](_0x39ef13[_0xec8b('0x28')])?util[_0xec8b('0x23')](_0xec8b('0x24'),_0x39ef13[_0xec8b('0x25')]):_0x39ef13['interface'];if(_[_0xec8b('0x42')](_0x1fc576[_0xec8b('0x13')][_0x289742])){_0x1fc576['agents'][_0x289742]=new Agent(_0x39ef13);}else{_0x1fc576[_0xec8b('0x3f')](_0x1fc576[_0xec8b('0x13')][_0x289742],_0x39ef13);}}}return _0x1fc576[_0xec8b('0x13')];};};Realtime[_0xec8b('0x3e')]['initTelephones']=function(){var _0x5b1175=this;return function(_0x33b59f){if(_0x33b59f){freeIsNotKeySip(_0x33b59f,_0x5b1175['telephones']);for(var _0x92977c=0x0,_0x3bea97={},_0x1009ad={};_0x92977c<_0x33b59f[_0xec8b('0x41')];_0x92977c+=0x1){_0x3bea97=_0x33b59f[_0x92977c];if(_['isUndefined'](_0x5b1175[_0xec8b('0x14')][util[_0xec8b('0x23')](_0xec8b('0x24'),_0x3bea97['name'])])){_0x5b1175['telephones'][util[_0xec8b('0x23')](_0xec8b('0x24'),_0x3bea97['name'])]=new Telephone(_0x3bea97);}else{_0x5b1175[_0xec8b('0x3f')](_0x5b1175[_0xec8b('0x14')][util[_0xec8b('0x23')](_0xec8b('0x24'),_0x3bea97[_0xec8b('0x25')])],_0x3bea97);}}}return _0x5b1175[_0xec8b('0x14')];};};Realtime['prototype']['initTrunks']=function(){var _0x13bdca=this;return function(_0x7e0cc5){if(_0x7e0cc5){freeIsNotKeySip(_0x7e0cc5,_0x13bdca[_0xec8b('0x43')]);for(var _0x3de636=0x0,_0x3706a7={},_0x11d88c={};_0x3de636<_0x7e0cc5[_0xec8b('0x41')];_0x3de636+=0x1){_0x3706a7=_0x7e0cc5[_0x3de636];if(_[_0xec8b('0x42')](_0x13bdca[_0xec8b('0x43')][util[_0xec8b('0x23')](_0xec8b('0x24'),_0x3706a7[_0xec8b('0x25')])])){_0x13bdca[_0xec8b('0x43')][util[_0xec8b('0x23')](_0xec8b('0x24'),_0x3706a7['name'])]=new Trunk(_0x3706a7);}else{_0x13bdca['mergeFromDatabase'](_0x13bdca[_0xec8b('0x43')][util[_0xec8b('0x23')]('SIP/%s',_0x3706a7[_0xec8b('0x25')])],_0x3706a7);}}}return _0x13bdca['trunks'];};};Realtime[_0xec8b('0x3e')][_0xec8b('0x44')]=function(){var _0x4b7c59=this;return function(_0x46f58b){if(_0x46f58b){freeIsNotKey(_0x46f58b,_0x4b7c59['voiceQueues'],_0xec8b('0x25'));for(var _0x4cabb9=0x0,_0x5b1a18={},_0x5736bd={};_0x4cabb9<_0x46f58b[_0xec8b('0x41')];_0x4cabb9+=0x1){_0x5b1a18=_0x46f58b[_0x4cabb9];if(_[_0xec8b('0x42')](_0x4b7c59[_0xec8b('0x45')][_0x5b1a18[_0xec8b('0x25')]])){_0x4b7c59['voiceQueues'][_0x5b1a18['name']]=new VoiceQueue(_0x5b1a18);}else{_0x4b7c59[_0xec8b('0x3f')](_0x4b7c59[_0xec8b('0x45')][_0x5b1a18[_0xec8b('0x25')]],_0x5b1a18);}}}return _0x4b7c59[_0xec8b('0x45')];};};Realtime['prototype'][_0xec8b('0x46')]=function(){var _0x500bb1=this;return function(_0x1f95d4){if(_0x1f95d4){freeIsNotKey(_0x1f95d4,_0x500bb1[_0xec8b('0x15')],'id');for(var _0x1c711d=0x0,_0x19008f={},_0x5583e3={};_0x1c711d<_0x1f95d4[_0xec8b('0x41')];_0x1c711d+=0x1){_0x19008f=_0x1f95d4[_0x1c711d];if(_[_0xec8b('0x42')](_0x500bb1['triggers'][_0x19008f['id']])){_0x500bb1['triggers'][_0x19008f['id']]=new Trigger(_0x19008f);}else{_0x500bb1[_0xec8b('0x3f')](_0x500bb1[_0xec8b('0x15')][_0x19008f['id']],_0x19008f);}}}return _0x500bb1[_0xec8b('0x15')];};};Realtime[_0xec8b('0x3e')][_0xec8b('0x47')]=function(){var _0x231929=this;return function(_0x1b85d0){if(_0x1b85d0){freeIsNotKey(_0x1b85d0,_0x231929[_0xec8b('0x17')],'id');for(var _0x182cca=0x0,_0x21d903={},_0x2af811={};_0x182cca<_0x1b85d0[_0xec8b('0x41')];_0x182cca+=0x1){_0x21d903=_0x1b85d0[_0x182cca];if(_[_0xec8b('0x42')](_0x231929[_0xec8b('0x17')][_0x21d903['id']])){_0x231929[_0xec8b('0x17')][_0x21d903['id']]=new Template(_0x21d903);}else{_0x231929[_0xec8b('0x3f')](_0x231929['templates'][_0x21d903['id']],_0x21d903);}}}return _0x231929[_0xec8b('0x17')];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x3fdcf=this;return function(_0x488304){if(_0x488304){freeIsNotKey(_0x488304,_0x3fdcf[_0xec8b('0x1d')],'id');for(var _0x43bc38=0x0,_0x31ae78={},_0x443f05={};_0x43bc38<_0x488304[_0xec8b('0x41')];_0x43bc38+=0x1){_0x31ae78=_0x488304[_0x43bc38];if(_[_0xec8b('0x42')](_0x3fdcf['zendeskAccounts'][_0x31ae78['id']])){_0x3fdcf[_0xec8b('0x1d')][_0x31ae78['id']]=new ZendeskAccount(_0x31ae78);}else{_0x3fdcf['mergeFromDatabase'](_0x3fdcf[_0xec8b('0x1d')][_0x31ae78['id']],_0x31ae78);}}}return _0x3fdcf[_0xec8b('0x1d')];};};Realtime['prototype'][_0xec8b('0x48')]=function(){var _0x1c48fa=this;return function(_0x4ff9da){if(_0x4ff9da){freeIsNotKey(_0x4ff9da,_0x1c48fa['salesforceAccounts'],'id');for(var _0x7884dc=0x0,_0x335d0c={},_0x32503={};_0x7884dc<_0x4ff9da[_0xec8b('0x41')];_0x7884dc+=0x1){_0x335d0c=_0x4ff9da[_0x7884dc];if(_[_0xec8b('0x42')](_0x1c48fa[_0xec8b('0x49')][_0x335d0c['id']])){_0x1c48fa[_0xec8b('0x49')][_0x335d0c['id']]=new SalesforceAccount(_0x335d0c);}else{_0x1c48fa[_0xec8b('0x3f')](_0x1c48fa[_0xec8b('0x49')][_0x335d0c['id']],_0x335d0c);}}}return _0x1c48fa[_0xec8b('0x49')];};};Realtime[_0xec8b('0x3e')][_0xec8b('0x4a')]=function(){var _0x2cd6e8=this;return function(_0x143984){if(_0x143984){freeIsNotKey(_0x143984,_0x2cd6e8[_0xec8b('0x4b')],'id');for(var _0x29a323=0x0,_0x23714d={},_0xa245c2={};_0x29a323<_0x143984[_0xec8b('0x41')];_0x29a323+=0x1){_0x23714d=_0x143984[_0x29a323];if(_[_0xec8b('0x42')](_0x2cd6e8[_0xec8b('0x4b')][_0x23714d['id']])){_0x2cd6e8[_0xec8b('0x4b')][_0x23714d['id']]=new FreshdeskAccount(_0x23714d);}else{_0x2cd6e8[_0xec8b('0x3f')](_0x2cd6e8[_0xec8b('0x4b')][_0x23714d['id']],_0x23714d);}}}return _0x2cd6e8[_0xec8b('0x4b')];};};Realtime[_0xec8b('0x3e')][_0xec8b('0x4c')]=function(){var _0x4f8908=this;return function(_0x827907){if(_0x827907){freeIsNotKey(_0x827907,_0x4f8908[_0xec8b('0x4d')],'id');for(var _0x1bdbd3=0x0,_0x30bc08={},_0x28253b={};_0x1bdbd3<_0x827907['length'];_0x1bdbd3+=0x1){_0x30bc08=_0x827907[_0x1bdbd3];if(_[_0xec8b('0x42')](_0x4f8908[_0xec8b('0x4d')][_0x30bc08['id']])){_0x4f8908['zohoAccounts'][_0x30bc08['id']]=new ZohoAccount(_0x30bc08);}else{_0x4f8908[_0xec8b('0x3f')](_0x4f8908[_0xec8b('0x4d')][_0x30bc08['id']],_0x30bc08);}}}return _0x4f8908[_0xec8b('0x4d')];};};Realtime[_0xec8b('0x3e')]['initDeskAccounts']=function(){var _0x80d7cc=this;return function(_0x2bd393){if(_0x2bd393){freeIsNotKey(_0x2bd393,_0x80d7cc[_0xec8b('0x4e')],'id');for(var _0x37287f=0x0,_0x484e29={},_0x3f525c={};_0x37287f<_0x2bd393[_0xec8b('0x41')];_0x37287f+=0x1){_0x484e29=_0x2bd393[_0x37287f];if(_[_0xec8b('0x42')](_0x80d7cc[_0xec8b('0x4e')][_0x484e29['id']])){_0x80d7cc['deskAccounts'][_0x484e29['id']]=new DeskAccount(_0x484e29);}else{_0x80d7cc[_0xec8b('0x3f')](_0x80d7cc['deskAccounts'][_0x484e29['id']],_0x484e29);}}}return _0x80d7cc[_0xec8b('0x4e')];};};Realtime['prototype'][_0xec8b('0x4f')]=function(){var _0x243718=this;return function(_0x8f2f23){if(_0x8f2f23){freeIsNotKey(_0x8f2f23,_0x243718['sugarcrmAccounts'],'id');for(var _0x576b09=0x0,_0x3b4cb3={},_0x49149c={};_0x576b09<_0x8f2f23[_0xec8b('0x41')];_0x576b09+=0x1){_0x3b4cb3=_0x8f2f23[_0x576b09];if(_[_0xec8b('0x42')](_0x243718[_0xec8b('0x1e')][_0x3b4cb3['id']])){_0x243718[_0xec8b('0x1e')][_0x3b4cb3['id']]=new SugarcrmAccount(_0x3b4cb3);}else{_0x243718[_0xec8b('0x3f')](_0x243718['sugarcrmAccounts'][_0x3b4cb3['id']],_0x3b4cb3);}}}return _0x243718['sugarcrmAccounts'];};};Realtime['prototype'][_0xec8b('0x50')]=function(){var _0x36c840=this;return function(_0x2dbb0a){if(_0x2dbb0a){freeIsNotKey(_0x2dbb0a,_0x36c840[_0xec8b('0x1f')],'id');for(var _0x4a03b8=0x0,_0xa7f4cd={},_0x34d7f3={};_0x4a03b8<_0x2dbb0a[_0xec8b('0x41')];_0x4a03b8+=0x1){_0xa7f4cd=_0x2dbb0a[_0x4a03b8];if(_[_0xec8b('0x42')](_0x36c840[_0xec8b('0x1f')][_0xa7f4cd['id']])){_0x36c840[_0xec8b('0x1f')][_0xa7f4cd['id']]=new VtigerAccount(_0xa7f4cd);}else{_0x36c840[_0xec8b('0x3f')](_0x36c840['vtigerAccounts'][_0xa7f4cd['id']],_0xa7f4cd);}}}return _0x36c840[_0xec8b('0x1f')];};};Realtime['prototype'][_0xec8b('0x51')]=function(){var _0x3c9af0=this;return function(_0x591c5f){if(_0x591c5f){freeIsNotKey(_0x591c5f,_0x3c9af0[_0xec8b('0x20')],'id');for(var _0x577967=0x0,_0x4172e3={},_0xa8cce6={};_0x577967<_0x591c5f['length'];_0x577967+=0x1){_0x4172e3=_0x591c5f[_0x577967];if(_[_0xec8b('0x42')](_0x3c9af0['servicenowAccounts'][_0x4172e3['id']])){_0x3c9af0[_0xec8b('0x20')][_0x4172e3['id']]=new ServicenowAccount(_0x4172e3);}else{_0x3c9af0[_0xec8b('0x3f')](_0x3c9af0[_0xec8b('0x20')][_0x4172e3['id']],_0x4172e3);}}}return _0x3c9af0['servicenowAccounts'];};};Realtime[_0xec8b('0x3e')][_0xec8b('0x52')]=function(){var _0x82c89e=this;return function(_0x5b78ef){if(_0x5b78ef){freeIsNotKey(_0x5b78ef,_0x82c89e[_0xec8b('0x21')],'id');for(var _0x185f0e=0x0,_0x38bc65={},_0x1ec4a6={};_0x185f0e<_0x5b78ef[_0xec8b('0x41')];_0x185f0e+=0x1){_0x38bc65=_0x5b78ef[_0x185f0e];if(_[_0xec8b('0x42')](_0x82c89e['dynamics365Accounts'][_0x38bc65['id']])){_0x82c89e['dynamics365Accounts'][_0x38bc65['id']]=new Dynamics365Account(_0x38bc65);}else{_0x82c89e[_0xec8b('0x3f')](_0x82c89e[_0xec8b('0x21')][_0x38bc65['id']],_0x38bc65);}}}return _0x82c89e['dynamics365Accounts'];};};Realtime['prototype'][_0xec8b('0x53')]=function(){var _0xd58095=this;return function(_0x1371ca){if(_0x1371ca){freeIsNotKey(_0x1371ca,_0xd58095[_0xec8b('0x22')],'id');for(var _0x2a048b=0x0,_0x58f2d0={},_0x2333b7={};_0x2a048b<_0x1371ca[_0xec8b('0x41')];_0x2a048b+=0x1){_0x58f2d0=_0x1371ca[_0x2a048b];if(_['isUndefined'](_0xd58095['freshsalesAccounts'][_0x58f2d0['id']])){_0xd58095[_0xec8b('0x22')][_0x58f2d0['id']]=new FreshsalesAccount(_0x58f2d0);}else{_0xd58095['mergeFromDatabase'](_0xd58095[_0xec8b('0x22')][_0x58f2d0['id']],_0x58f2d0);}}}return _0xd58095[_0xec8b('0x22')];};};Realtime[_0xec8b('0x3e')]['initVoiceQueueHopperHistory']=function(){var _0x37035c=this;return function(_0x4e1b24){for(var _0x84003a=0x0;_0x84003a<_0x4e1b24[_0xec8b('0x41')];_0x84003a+=0x1){_[_0xec8b('0x54')](_0x37035c[_0xec8b('0x45')][_0x4e1b24[_0x84003a][_0xec8b('0x25')]],_0x4e1b24[_0x84003a]);}return _0x37035c[_0xec8b('0x45')];};};Realtime[_0xec8b('0x3e')][_0xec8b('0x55')]=function(){var _0x3d565a=this;return function(_0x4126b6){clearVoiceQueues(_0x3d565a['voiceQueues']);if(_0x4126b6){_0x4126b6=_[_0xec8b('0x56')](_0x4126b6,_0xec8b('0x57'));for(var _0x3ea970 in _0x4126b6){if(_0x4126b6['hasOwnProperty'](_0x3ea970)){var _0x3c36fd={};for(var _0x4d70f0=0x0;_0x4d70f0<_0x4126b6[_0x3ea970][_0xec8b('0x41')];_0x4d70f0+=0x1){var _0x51729f=_0x4126b6[_0x3ea970][_0x4d70f0]['queue'];if(_0x3d565a[_0xec8b('0x45')][_0x51729f]){if(_0x4126b6[_0x3ea970][_0x4d70f0][_0xec8b('0x58')]){_0x3d565a[_0xec8b('0x45')][_0x51729f][_0xec8b('0x31')]+=0x1;}if(_0x4126b6[_0x3ea970][_0x4d70f0][_0xec8b('0x59')]){_0x3d565a[_0xec8b('0x45')][_0x51729f][_0xec8b('0x5a')]+=0x1;}_0x3d565a[_0xec8b('0x45')][_0x51729f][_0xec8b('0x2c')]+=moment(_0x4126b6[_0x3ea970][_0x4d70f0][_0xec8b('0x5b')])['diff'](moment(_0x4126b6[_0x3ea970][_0x4d70f0]['queuecallerjoinAt']),_0xec8b('0x5c'))||0x0;if(_0x4d70f0===_0x4126b6[_0x3ea970][_0xec8b('0x41')]-0x1){_0x3d565a[_0xec8b('0x45')][_0x51729f]['sumDuration']+=moment(_0x4126b6[_0x3ea970][_0x4d70f0][_0xec8b('0x5d')]||_0x4126b6[_0x3ea970][_0x4d70f0][_0xec8b('0x5e')]||_0x4126b6[_0x3ea970][_0x4d70f0][_0xec8b('0x5f')])[_0xec8b('0x60')](moment(_0x4126b6[_0x3ea970][_0x4d70f0][_0xec8b('0x61')]),_0xec8b('0x5c'))||0x0;_0x3d565a[_0xec8b('0x45')][_0x51729f][_0xec8b('0x2a')]+=0x1;if(_0x4126b6[_0x3ea970][_0x4d70f0]['queuecallercomplete']){_0x3d565a['voiceQueues'][_0x51729f][_0xec8b('0x2b')]+=0x1;_0x3d565a[_0xec8b('0x45')][_0x51729f]['sumBillable']+=moment(_0x4126b6[_0x3ea970][_0x4d70f0][_0xec8b('0x5d')])[_0xec8b('0x60')](moment(_0x4126b6[_0x3ea970][_0x4d70f0][_0xec8b('0x5b')]),_0xec8b('0x5c'))||0x0;}}else{_0x3d565a[_0xec8b('0x45')][_0x51729f][_0xec8b('0x32')]+=_0x3d565a[_0xec8b('0x45')][_0x51729f][_0xec8b('0x2c')]||0x0;}}}}}}return _0x3d565a['voiceQueues'];};};Realtime['prototype'][_0xec8b('0x62')]=function(){var _0x5d5983=this;return function(_0x3a8bcf){clearVoiceCallReports(_0x5d5983['outbound']);if(_0x3a8bcf){for(var _0x398f44=0x0;_0x398f44<_0x3a8bcf[_0xec8b('0x41')];_0x398f44+=0x1){_0x5d5983['outbound'][_0xec8b('0x2a')]+=0x1;_0x5d5983[_0xec8b('0x18')][_0xec8b('0x32')]+=_0x3a8bcf[_0x398f44][_0xec8b('0x63')];if(_0x3a8bcf[_0x398f44][_0xec8b('0x64')]===_0xec8b('0x65')){_0x5d5983['outbound'][_0xec8b('0x2b')]+=0x1;_0x5d5983[_0xec8b('0x18')][_0xec8b('0x2c')]+=_0x3a8bcf[_0x398f44][_0xec8b('0x63')]-_0x3a8bcf[_0x398f44][_0xec8b('0x66')]||0x0;_0x5d5983[_0xec8b('0x18')]['sumBillable']+=_0x3a8bcf[_0x398f44][_0xec8b('0x66')];}}}return _0x5d5983['outbound'];};};Realtime[_0xec8b('0x3e')][_0xec8b('0x67')]=function(){var _0x4e2d0c=this;return function(_0x11d2d6){if(_0x11d2d6){freeIsNotKey(_0x11d2d6,_0x4e2d0c[_0xec8b('0x16')],_0xec8b('0x25'));for(var _0x371c3a=0x0,_0x49b552={};_0x371c3a<_0x11d2d6['length'];_0x371c3a+=0x1){_0x49b552=_0x11d2d6[_0x371c3a];if(_[_0xec8b('0x42')](_0x4e2d0c['campaigns'][_0x49b552[_0xec8b('0x25')]])){_0x4e2d0c[_0xec8b('0x16')][_0x49b552[_0xec8b('0x25')]]=new Campaign(_0x49b552);}else{_0x4e2d0c['mergeFromDatabase'](_0x4e2d0c[_0xec8b('0x16')][_0x49b552[_0xec8b('0x25')]],_0x49b552);_0x4e2d0c[_0xec8b('0x16')][_0x49b552[_0xec8b('0x25')]]['dialQueueProject']=_0x49b552[_0xec8b('0x68')]?_0x49b552[_0xec8b('0x68')][_0xec8b('0x25')]:undefined;}}}return _0x4e2d0c['campaigns'];};};Realtime[_0xec8b('0x3e')][_0xec8b('0x69')]=function(){var _0xe8cb9=this;return function(_0x16d871){if(_0x16d871){freeIsNotKey(_0x16d871,_0xe8cb9[_0xec8b('0x19')],'id');for(var _0x31bee4=0x0,_0x938e79={};_0x31bee4<_0x16d871[_0xec8b('0x41')];_0x31bee4+=0x1){_0x938e79=_0x16d871[_0x31bee4];if(_[_0xec8b('0x42')](_0xe8cb9[_0xec8b('0x19')][_0x938e79['id']])){_0xe8cb9[_0xec8b('0x19')][_0x938e79['id']]=new VoiceExtension(_0x938e79);}else{_0xe8cb9['mergeFromDatabase'](_0xe8cb9[_0xec8b('0x19')][_0x938e79['id']],_0x938e79);}}}return _0xe8cb9[_0xec8b('0x19')];};};Realtime[_0xec8b('0x3e')][_0xec8b('0x6a')]=function(){var _0xfcd5c9=this;return function(_0x51700e){clearCampaigns(_0xfcd5c9[_0xec8b('0x16')]);for(var _0x239ac1=0x0;_0x239ac1<_0x51700e[_0xec8b('0x41')];_0x239ac1+=0x1){_[_0xec8b('0x54')](_0xfcd5c9[_0xec8b('0x16')][_0x51700e[_0x239ac1][_0xec8b('0x25')]],_0x51700e[_0x239ac1]);}return _0xfcd5c9[_0xec8b('0x16')];};};Realtime['prototype'][_0xec8b('0x6b')]=function(){var _0x2cb374=this;return function(_0x29bf6c){if(_0x29bf6c){freeIsNotKey(_0x29bf6c,_0x2cb374[_0xec8b('0x6c')],'id');for(var _0x2e9525=0x0,_0x1b09b1={},_0x455d84={};_0x2e9525<_0x29bf6c[_0xec8b('0x41')];_0x2e9525+=0x1){_0x1b09b1=_0x29bf6c[_0x2e9525];if(_['isUndefined'](_0x2cb374[_0xec8b('0x6c')][_0x1b09b1['id']])){_0x2cb374[_0xec8b('0x6c')][_0x1b09b1['id']]=new FaxAccount(_0x1b09b1);}else{_0x2cb374['mergeFromDatabase'](_0x2cb374[_0xec8b('0x6c')][_0x1b09b1['id']],_0x1b09b1);}}}return _0x2cb374['faxAccounts'];};};module[_0xec8b('0x6d')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 889ec90..b113d95 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 _0xb08f=['custom:voiceCallReport','bind','custom:voiceAgentReport','custom:voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','format','SIP/%s','length','connectedlinenum','lastAssignedTo','interface','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','voiceCallReport','destination','exten','type','dialer','queue','lastdata','context','from-voip-provider','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','callerid','disposition','ANSWERED','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','blindTransfer','create','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','voiceDialReport','startsWith','substring','indexOf','mobile','phone','transfererlinkedid','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','realtime','agents','telephones','prototype','sync','disabled','custom:voiceQueueReport','voiceQueueReport'];(function(_0x3292ec,_0x449e9b){var _0x9946bc=function(_0x2cb4cf){while(--_0x2cb4cf){_0x3292ec['push'](_0x3292ec['shift']());}};_0x9946bc(++_0x449e9b);}(_0xb08f,0x143));var _0xfb08=function(_0x461026,_0x1b39c1){_0x461026=_0x461026-0x0;var _0x11ddc2=_0xb08f[_0x461026];return _0x11ddc2;};'use strict';var _=require(_0xfb08('0x0'));var moment=require(_0xfb08('0x1'));var util=require(_0xfb08('0x2'));var config=require(_0xfb08('0x3'));var ami=require(_0xfb08('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xfb08('0x5'));var RpcVoiceDialReport=require(_0xfb08('0x6'));var RpcMemberReport=require(_0xfb08('0x7'));var RpcVoiceQueueReport=require(_0xfb08('0x8'));var RpcVoiceRecording=require(_0xfb08('0x9'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xfb08('0xa'));var VoiceCallReport=require(_0xfb08('0xb'));var VoiceAgentReport=require(_0xfb08('0xc'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x362be8){this[_0xfb08('0xd')]=_0x362be8;this['agents']=_0x362be8[_0xfb08('0xe')];this[_0xfb08('0xf')]=_0x362be8[_0xfb08('0xf')];}Report[_0xfb08('0x10')][_0xfb08('0x11')]=function(_0x179ffe){var _0x2553d3=new VoiceQueueReport(this['realtime']);var _0xbc9002=new VoiceAgentReport(this[_0xfb08('0xd')]);var _0x34f1ef=new VoiceDialReport(this[_0xfb08('0xd')]);var _0x3c4e36=new VoiceCallReport(this['realtime']);var _0x3fc690=new UserReport(this[_0xfb08('0xd')]);if(config['xdr']&&config['xdr'][_0xfb08('0x12')]){ami['on'](_0xfb08('0x13'),this[_0xfb08('0x14')]['bind'](this));ami['on'](_0xfb08('0x15'),this['voiceCallReport'][_0xfb08('0x16')](this));ami['on'](_0xfb08('0x17'),this['voiceAgentReport'][_0xfb08('0x16')](this));ami['on'](_0xfb08('0x18'),this['voiceDialReport']['bind'](this));ami['on'](_0xfb08('0x19'),this['blindTransfer'][_0xfb08('0x16')](this));ami['on'](_0xfb08('0x1a'),this[_0xfb08('0x1b')][_0xfb08('0x16')](this));}};Report[_0xfb08('0x10')][_0xfb08('0x1c')]=function(_0x41265c){var _0x3ddd91;_0x3ddd91=_[_0xfb08('0x1d')](this[_0xfb08('0xe')],function(_0x549e6c){return _0x549e6c[_0xfb08('0x1e')]==_0x41265c||_0x549e6c[_0xfb08('0x1f')]==_0x41265c;});if(_[_0xfb08('0x20')](_0x3ddd91)){var _0x50e66f=_['find'](this[_0xfb08('0xf')],function(_0x460170){return _0x460170['accountcode']==_0x41265c||_0x460170[_0xfb08('0x1f')]==_0x41265c;});if(_0x50e66f){_0x3ddd91=_[_0xfb08('0x1d')](this[_0xfb08('0xe')],function(_0x2b4de3){return _0x2b4de3['interface']==util[_0xfb08('0x21')](_0xfb08('0x22'),_0x50e66f['name']);});}}return _0x3ddd91;};Report[_0xfb08('0x10')][_0xfb08('0x14')]=function(_0x39105f){for(var _0x246c63=0x0;_0x246c63<_0x39105f[_0xfb08('0x23')];_0x246c63+=0x1){var _0xec304d=this['findAgent'](_0x39105f[_0x246c63][_0xfb08('0x24')]);if(_0xec304d){_0x39105f[_0x246c63]['accountcode']=_0xec304d[_0xfb08('0x1e')];_0x39105f[_0x246c63]['assigned']=!![];_0x39105f[_0x246c63][_0xfb08('0x25')]=_0xec304d[_0xfb08('0x1f')];_0x39105f[_0x246c63][_0xfb08('0x26')]=_[_0xfb08('0x20')](_0xec304d[_0xfb08('0x26')])?util[_0xfb08('0x21')](_0xfb08('0x22'),_0xec304d[_0xfb08('0x1f')]):_0xec304d[_0xfb08('0x26')];if(_0x39105f[_0x246c63]['queuecallercomplete']){_0x39105f[_0x246c63][_0xfb08('0x27')]=moment()['format'](_0xfb08('0x28'));}if(_0x39105f[_0x246c63][_0xfb08('0x29')]){_0x39105f[_0x246c63][_0xfb08('0x2a')]=moment()[_0xfb08('0x21')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xfb08('0x14')](_0x39105f[_0x246c63]);}RpcVoiceQueueReport['create'](_0x39105f[_0x246c63]);}};function extractCalleridNumber(_0x412776){var _0x1e86dc=_0x412776[_0xfb08('0x2b')](/<(.*?)>/);return _0x1e86dc?_0x1e86dc[0x1]:_0x412776;}Report[_0xfb08('0x10')][_0xfb08('0x2c')]=function(_0x41f6ff){_0x41f6ff['destination']=_0x41f6ff[_0xfb08('0x2d')]||_0x41f6ff[_0xfb08('0x2e')];if(_0x41f6ff[_0xfb08('0x2f')]==_0xfb08('0x30')){_0x41f6ff['lastapplication']=_0xfb08('0x31');_0x41f6ff[_0xfb08('0x32')]=_0x41f6ff[_0xfb08('0x31')];if(_0x41f6ff[_0xfb08('0x33')]==_0xfb08('0x34')){_0x41f6ff[_0xfb08('0x1e')]='';_0x41f6ff[_0xfb08('0x2d')]=extractCalleridNumber(_0x41f6ff['callerid']);}else if(_0x41f6ff['context']==_0xfb08('0x35')){if(_0x41f6ff['destination']==_0xfb08('0x36')){_0x41f6ff[_0xfb08('0x2d')]=extractCalleridNumber(_0x41f6ff[_0xfb08('0x37')]);_0x41f6ff[_0xfb08('0x38')]=_0x41f6ff[_0xfb08('0x39')];_0x41f6ff[_0xfb08('0x3a')]=[_0x41f6ff[_0xfb08('0x3b')],_0x41f6ff[_0xfb08('0x3b')]=_0x41f6ff[_0xfb08('0x3a')]][0x0];_0x41f6ff[_0xfb08('0x3c')]=_0x41f6ff['calleridpreview'];}else{_0x41f6ff[_0xfb08('0x2d')]=_0x41f6ff['calleridnum'];_0x41f6ff[_0xfb08('0x38')]=_0x41f6ff[_0xfb08('0x39')];if(_0x41f6ff[_0xfb08('0x3d')]==_0xfb08('0x3e')){_0x41f6ff['accountcode']=_0x41f6ff[_0xfb08('0x24')];}else{_0x41f6ff['accountcode']='';}}}}else{_0x41f6ff[_0xfb08('0x3c')]=util['format'](_0xfb08('0x3f'),_0x41f6ff['calleridname'],_0x41f6ff[_0xfb08('0x38')]);}if(RpcVoiceTransferReport[_0xfb08('0x40')][_0x41f6ff[_0xfb08('0x41')]]){var _0x223fd2=RpcVoiceTransferReport[_0xfb08('0x40')][_0x41f6ff[_0xfb08('0x41')]];_0x223fd2[_0xfb08('0x42')]=_0x41f6ff['uniqueid'];RpcVoiceTransferReport[_0xfb08('0x43')](_0x223fd2);delete RpcVoiceTransferReport[_0xfb08('0x40')][_0x41f6ff[_0xfb08('0x41')]];}RpcVoiceCallReport[_0xfb08('0x44')](_0x41f6ff);if(_0x41f6ff[_0xfb08('0x45')]){for(var _0x3f2ed8=0x0;_0x3f2ed8<_0x41f6ff[_0xfb08('0x46')][_0xfb08('0x23')];_0x3f2ed8+=0x1){_0x41f6ff[_0xfb08('0x47')]=_0x41f6ff['monitors'][_0x3f2ed8][_0xfb08('0x48')];_0x41f6ff[_0xfb08('0x49')]=_0x41f6ff['monitors'][_0x3f2ed8][_0xfb08('0x49')];if(_0x41f6ff[_0xfb08('0x2e')]==_0xfb08('0x36')){_0x41f6ff[_0xfb08('0x38')]=_0x41f6ff[_0xfb08('0x24')];_0x41f6ff['calleridname']=_0x41f6ff[_0xfb08('0x4a')];_0x41f6ff[_0xfb08('0x24')]=_0x41f6ff['accountcode'];_0x41f6ff[_0xfb08('0x4a')]=_0x41f6ff[_0xfb08('0x4b')];_0x41f6ff['exten']=_0x41f6ff['originatecalleridnum'];}else if(_0x41f6ff[_0xfb08('0x2e')]==_0xfb08('0x4c')){_0x41f6ff['calleridnum']=_0x41f6ff[_0xfb08('0x2d')];_0x41f6ff['exten']=_0x41f6ff[_0xfb08('0x39')];}RpcVoiceRecording[_0xfb08('0x44')](_0x41f6ff);}}};Report[_0xfb08('0x10')]['voiceAgentReport']=function(_0x2bf553){if(_[_0xfb08('0x4d')](_0x2bf553)){_0x2bf553[_0xfb08('0x4e')](function(_0x4b1451){RpcVoiceAgentReport[_0xfb08('0x44')](_0x4b1451);});}else{RpcVoiceAgentReport['create'](_0x2bf553);}};Report[_0xfb08('0x10')][_0xfb08('0x4f')]=function(_0x12cdcc){RpcVoiceDialReport[_0xfb08('0x44')](_0x12cdcc);var _0x34880c;var _0x355688;var _0x2fc7d8=_0x12cdcc['channel'];if(_[_0xfb08('0x50')](_0x2fc7d8,'Local')){_0x355688=_0x2fc7d8[_0xfb08('0x51')](_0x2fc7d8[_0xfb08('0x52')]('/')+0x1,_0x2fc7d8[_0xfb08('0x52')]('@'));_0x34880c=_['find'](this[_0xfb08('0xe')],function(_0x244ef3){return _0x244ef3[_0xfb08('0x53')]==_0x355688||_0x244ef3[_0xfb08('0x54')]==_0x355688||_0x244ef3[_0xfb08('0x1e')]==_0x355688;});}else{_0x355688=_0x2fc7d8[_0xfb08('0x51')](_0x2fc7d8[_0xfb08('0x52')]('/')+0x1,_0x2fc7d8['lastIndexOf']('-'));_0x34880c=this[_0xfb08('0x1c')](_0x355688);}if(_0x34880c){_0x12cdcc[_0xfb08('0x26')]=_[_0xfb08('0x20')](_0x34880c[_0xfb08('0x26')])?util[_0xfb08('0x21')](_0xfb08('0x22'),_0x34880c['name']):_0x34880c[_0xfb08('0x26')];_0x12cdcc[_0xfb08('0x4b')]=_0x34880c[_0xfb08('0x1f')];_0x12cdcc['accountcode']=_0x34880c['accountcode'];RpcMemberReport['voiceDialReport'](_0x12cdcc);}};Report[_0xfb08('0x10')][_0xfb08('0x43')]=function(_0x49ec71){RpcVoiceTransferReport[_0xfb08('0x40')][_0x49ec71[_0xfb08('0x55')]]=_0x49ec71;};Report[_0xfb08('0x10')]['attendedTransfer']=function(_0x3ec8b9){RpcVoiceTransferReport[_0xfb08('0x1b')](_0x3ec8b9);};module['exports']=Report; \ No newline at end of file +var _0x58d4=['transfererlinkedid','lodash','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceCallReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','name','isNil','find','interface','format','SIP/%s','length','connectedlinenum','assigned','queuecallercomplete','queuecallercompleteAt','queuecallerexit','YYYY-MM-DD\x20HH:mm:ss','create','match','destination','dialer','lastapplication','queue','from-voip-provider','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','ANSWERED','callerid','calleridname','transfers','linkedid','monitor','monitors','monitorFilename','filename','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','lastIndexOf'];(function(_0x393224,_0x48b2e9){var _0x301af4=function(_0x913c97){while(--_0x913c97){_0x393224['push'](_0x393224['shift']());}};_0x301af4(++_0x48b2e9);}(_0x58d4,0x1a5));var _0x458d=function(_0x379ec1,_0x3c3482){_0x379ec1=_0x379ec1-0x0;var _0x1cf808=_0x58d4[_0x379ec1];return _0x1cf808;};'use strict';var _=require(_0x458d('0x0'));var moment=require(_0x458d('0x1'));var util=require('util');var config=require(_0x458d('0x2'));var ami=require(_0x458d('0x3'));var RpcVoiceAgentReport=require(_0x458d('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x458d('0x5'));var RpcMemberReport=require(_0x458d('0x6'));var RpcVoiceQueueReport=require(_0x458d('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x458d('0x8'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x458d('0x9'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x458d('0xa'));function Report(_0x44d13c){this['realtime']=_0x44d13c;this[_0x458d('0xb')]=_0x44d13c[_0x458d('0xb')];this['telephones']=_0x44d13c[_0x458d('0xc')];}Report[_0x458d('0xd')][_0x458d('0xe')]=function(_0x597fd2){var _0x197dae=new VoiceQueueReport(this[_0x458d('0xf')]);var _0x107f21=new VoiceAgentReport(this['realtime']);var _0x1396ef=new VoiceDialReport(this[_0x458d('0xf')]);var _0x3534d9=new VoiceCallReport(this[_0x458d('0xf')]);var _0x540465=new UserReport(this['realtime']);if(config['xdr']&&config[_0x458d('0x10')][_0x458d('0x11')]){ami['on'](_0x458d('0x12'),this[_0x458d('0x13')][_0x458d('0x14')](this));ami['on'](_0x458d('0x15'),this[_0x458d('0x16')]['bind'](this));ami['on'](_0x458d('0x17'),this[_0x458d('0x18')]['bind'](this));ami['on'](_0x458d('0x19'),this[_0x458d('0x1a')][_0x458d('0x14')](this));ami['on'](_0x458d('0x1b'),this[_0x458d('0x1c')]['bind'](this));ami['on'](_0x458d('0x1d'),this[_0x458d('0x1e')][_0x458d('0x14')](this));}};Report[_0x458d('0xd')][_0x458d('0x1f')]=function(_0x1829a1){var _0x51a5ec;_0x51a5ec=_['find'](this[_0x458d('0xb')],function(_0xcc543d){return _0xcc543d[_0x458d('0x20')]==_0x1829a1||_0xcc543d[_0x458d('0x21')]==_0x1829a1;});if(_[_0x458d('0x22')](_0x51a5ec)){var _0x3274f2=_[_0x458d('0x23')](this[_0x458d('0xc')],function(_0x3204b1){return _0x3204b1[_0x458d('0x20')]==_0x1829a1||_0x3204b1['name']==_0x1829a1;});if(_0x3274f2){_0x51a5ec=_[_0x458d('0x23')](this[_0x458d('0xb')],function(_0x584fae){return _0x584fae[_0x458d('0x24')]==util[_0x458d('0x25')](_0x458d('0x26'),_0x3274f2[_0x458d('0x21')]);});}}return _0x51a5ec;};Report['prototype'][_0x458d('0x13')]=function(_0x7cdba1){for(var _0x1f65b0=0x0;_0x1f65b0<_0x7cdba1[_0x458d('0x27')];_0x1f65b0+=0x1){var _0x276348=this[_0x458d('0x1f')](_0x7cdba1[_0x1f65b0][_0x458d('0x28')]);if(_0x276348){_0x7cdba1[_0x1f65b0]['accountcode']=_0x276348[_0x458d('0x20')];_0x7cdba1[_0x1f65b0][_0x458d('0x29')]=!![];_0x7cdba1[_0x1f65b0]['lastAssignedTo']=_0x276348['name'];_0x7cdba1[_0x1f65b0][_0x458d('0x24')]=_[_0x458d('0x22')](_0x276348[_0x458d('0x24')])?util[_0x458d('0x25')]('SIP/%s',_0x276348[_0x458d('0x21')]):_0x276348[_0x458d('0x24')];if(_0x7cdba1[_0x1f65b0][_0x458d('0x2a')]){_0x7cdba1[_0x1f65b0][_0x458d('0x2b')]=moment()[_0x458d('0x25')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x7cdba1[_0x1f65b0][_0x458d('0x2c')]){_0x7cdba1[_0x1f65b0]['queuecallerexitAt']=moment()[_0x458d('0x25')](_0x458d('0x2d'));}RpcMemberReport[_0x458d('0x13')](_0x7cdba1[_0x1f65b0]);}RpcVoiceQueueReport[_0x458d('0x2e')](_0x7cdba1[_0x1f65b0]);}};function extractCalleridNumber(_0x97c993){var _0x542d47=_0x97c993[_0x458d('0x2f')](/<(.*?)>/);return _0x542d47?_0x542d47[0x1]:_0x97c993;}Report[_0x458d('0xd')][_0x458d('0x16')]=function(_0x187a90){_0x187a90[_0x458d('0x30')]=_0x187a90[_0x458d('0x30')]||_0x187a90['exten'];if(_0x187a90['type']==_0x458d('0x31')){_0x187a90[_0x458d('0x32')]='queue';_0x187a90['lastdata']=_0x187a90[_0x458d('0x33')];if(_0x187a90['context']==_0x458d('0x34')){_0x187a90['accountcode']='';_0x187a90[_0x458d('0x30')]=extractCalleridNumber(_0x187a90['callerid']);}else if(_0x187a90['context']==_0x458d('0x35')){if(_0x187a90[_0x458d('0x30')]==_0x458d('0x36')){_0x187a90[_0x458d('0x30')]=extractCalleridNumber(_0x187a90['calleridpreview']);_0x187a90[_0x458d('0x37')]=_0x187a90[_0x458d('0x38')];_0x187a90[_0x458d('0x39')]=[_0x187a90['channel'],_0x187a90[_0x458d('0x3a')]=_0x187a90[_0x458d('0x39')]][0x0];_0x187a90['callerid']=_0x187a90[_0x458d('0x3b')];}else{_0x187a90[_0x458d('0x30')]=_0x187a90[_0x458d('0x37')];_0x187a90[_0x458d('0x37')]=_0x187a90[_0x458d('0x38')];if(_0x187a90[_0x458d('0x3c')]==_0x458d('0x3d')){_0x187a90[_0x458d('0x20')]=_0x187a90[_0x458d('0x28')];}else{_0x187a90[_0x458d('0x20')]='';}}}}else{_0x187a90[_0x458d('0x3e')]=util[_0x458d('0x25')]('\x22%s\x22\x20<%s>',_0x187a90[_0x458d('0x3f')],_0x187a90[_0x458d('0x37')]);}if(RpcVoiceTransferReport[_0x458d('0x40')][_0x187a90['linkedid']]){var _0x28fa44=RpcVoiceTransferReport[_0x458d('0x40')][_0x187a90[_0x458d('0x41')]];_0x28fa44['transfereelinkedid']=_0x187a90['uniqueid'];RpcVoiceTransferReport[_0x458d('0x1c')](_0x28fa44);delete RpcVoiceTransferReport[_0x458d('0x40')][_0x187a90[_0x458d('0x41')]];}RpcVoiceCallReport[_0x458d('0x2e')](_0x187a90);if(_0x187a90[_0x458d('0x42')]){for(var _0x33cf3c=0x0;_0x33cf3c<_0x187a90[_0x458d('0x43')][_0x458d('0x27')];_0x33cf3c+=0x1){_0x187a90[_0x458d('0x44')]=_0x187a90[_0x458d('0x43')][_0x33cf3c][_0x458d('0x45')];_0x187a90[_0x458d('0x46')]=_0x187a90['monitors'][_0x33cf3c][_0x458d('0x46')];if(_0x187a90[_0x458d('0x47')]==_0x458d('0x36')){_0x187a90[_0x458d('0x37')]=_0x187a90[_0x458d('0x28')];_0x187a90[_0x458d('0x3f')]=_0x187a90[_0x458d('0x48')];_0x187a90[_0x458d('0x28')]=_0x187a90['accountcode'];_0x187a90[_0x458d('0x48')]=_0x187a90[_0x458d('0x49')];_0x187a90[_0x458d('0x47')]=_0x187a90['originatecalleridnum'];}else if(_0x187a90[_0x458d('0x47')]==_0x458d('0x4a')){_0x187a90[_0x458d('0x37')]=_0x187a90['destination'];_0x187a90[_0x458d('0x47')]=_0x187a90['originatecalleridnum'];}RpcVoiceRecording[_0x458d('0x2e')](_0x187a90);}}};Report[_0x458d('0xd')]['voiceAgentReport']=function(_0x13bf00){if(_[_0x458d('0x4b')](_0x13bf00)){_0x13bf00[_0x458d('0x4c')](function(_0x534b47){RpcVoiceAgentReport['create'](_0x534b47);});}else{RpcVoiceAgentReport[_0x458d('0x2e')](_0x13bf00);}};Report[_0x458d('0xd')][_0x458d('0x1a')]=function(_0x225ac0){RpcVoiceDialReport[_0x458d('0x2e')](_0x225ac0);var _0x176173;var _0x21cf79;var _0x5da9ce=_0x225ac0[_0x458d('0x3a')];if(_[_0x458d('0x4d')](_0x5da9ce,_0x458d('0x4e'))){_0x21cf79=_0x5da9ce[_0x458d('0x4f')](_0x5da9ce[_0x458d('0x50')]('/')+0x1,_0x5da9ce[_0x458d('0x50')]('@'));_0x176173=_['find'](this[_0x458d('0xb')],function(_0x4c73ed){return _0x4c73ed[_0x458d('0x51')]==_0x21cf79||_0x4c73ed['phone']==_0x21cf79||_0x4c73ed[_0x458d('0x20')]==_0x21cf79;});}else{_0x21cf79=_0x5da9ce[_0x458d('0x4f')](_0x5da9ce['indexOf']('/')+0x1,_0x5da9ce[_0x458d('0x52')]('-'));_0x176173=this[_0x458d('0x1f')](_0x21cf79);}if(_0x176173){_0x225ac0['interface']=_[_0x458d('0x22')](_0x176173[_0x458d('0x24')])?util[_0x458d('0x25')](_0x458d('0x26'),_0x176173[_0x458d('0x21')]):_0x176173[_0x458d('0x24')];_0x225ac0['membername']=_0x176173[_0x458d('0x21')];_0x225ac0['accountcode']=_0x176173[_0x458d('0x20')];RpcMemberReport[_0x458d('0x1a')](_0x225ac0);}};Report[_0x458d('0xd')][_0x458d('0x1c')]=function(_0x334db4){RpcVoiceTransferReport[_0x458d('0x40')][_0x334db4[_0x458d('0x53')]]=_0x334db4;};Report[_0x458d('0xd')][_0x458d('0x1e')]=function(_0x144657){RpcVoiceTransferReport[_0x458d('0x1e')](_0x144657);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 5975080..86352a8 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 _0xd7a5=['trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','toLowerCase','inuse','local','stateTime','toNumber','format','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','find','mobile','phone','accountcode','updateStatusRealtime','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','peerstatus','registered','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','actionDeviceStateList','[userReport][devicestatelist]','inspect','prototype','isNotNull','isUndefined','emit','info','username','[userReport][registry]','stateRegistry','state','merge','event','actionid','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xd7a5,0x1ad));var _0x5d7a=function(_0x4409e7,_0x307f17){_0x4409e7=_0x4409e7-0x0;var _0x24c751=_0xd7a5[_0x4409e7];return _0x24c751;};'use strict';var _=require(_0x5d7a('0x0'));var moment=require('moment');var util=require(_0x5d7a('0x1'));var Redis=require(_0x5d7a('0x2'));var BPromise=require('bluebird');var config=require(_0x5d7a('0x3'));var logger=require(_0x5d7a('0x4'))(_0x5d7a('0x5'));var ami=require(_0x5d7a('0x6'));config[_0x5d7a('0x7')]=_[_0x5d7a('0x8')](config[_0x5d7a('0x7')],{'host':_0x5d7a('0x9'),'port':0x18eb});var io=require(_0x5d7a('0xa'))(new Redis(config[_0x5d7a('0x7')]));function UserReport(_0x4b0523){this[_0x5d7a('0xb')]=_0x4b0523[_0x5d7a('0xb')];this['agents']=_0x4b0523[_0x5d7a('0xc')];this[_0x5d7a('0xd')]=_0x4b0523[_0x5d7a('0xd')];ami['on'](_0x5d7a('0xe'),this[_0x5d7a('0xf')][_0x5d7a('0x10')](this));ami['on'](_0x5d7a('0x11'),this['syncRegistry'][_0x5d7a('0x10')](this));ami['on'](_0x5d7a('0x12'),this[_0x5d7a('0x13')]['bind'](this));ami['on']('peerstatus',this[_0x5d7a('0x14')][_0x5d7a('0x10')](this));return this[_0x5d7a('0x15')]();}function showSipRegistrations(){Promise[_0x5d7a('0x16')]()[_0x5d7a('0x17')](ami[_0x5d7a('0x18')]())[_0x5d7a('0x19')](function(_0x3d45db){logger[_0x5d7a('0x1a')](_0x5d7a('0x1b'),util['inspect'](_0x3d45db,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x5d7a('0x16')]()[_0x5d7a('0x17')](ami[_0x5d7a('0x1c')]())['catch'](function(_0xa34b97){logger[_0x5d7a('0x1a')](_0x5d7a('0x1d'),util[_0x5d7a('0x1e')](_0xa34b97,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x5d7a('0x16')]()[_0x5d7a('0x17')](ami['actionSipPeerStatus']())['catch'](function(_0x5863d3){logger[_0x5d7a('0x1a')]('[userReport][sippeerstatus]',util[_0x5d7a('0x1e')](_0x5863d3,{'showHidden':![],'depth':null}));});}UserReport[_0x5d7a('0x1f')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x5d7a('0x16')]()[_0x5d7a('0x17')](showSipRegistrations())[_0x5d7a('0x17')](listDeviceStates())[_0x5d7a('0x17')](showPeersStatus());},0x32c8);};UserReport[_0x5d7a('0x1f')][_0x5d7a('0x20')]=function(_0x481670){return _0x481670!==null&&!_[_0x5d7a('0x21')](_0x481670);};UserReport[_0x5d7a('0x1f')][_0x5d7a('0x22')]=function(_0x19a845,_0x336180,_0x10b83c){io['to'](_0x19a845)[_0x5d7a('0x22')](_0x336180,_0x10b83c);};UserReport['prototype'][_0x5d7a('0xf')]=function(_0x434747){try{if(this[_0x5d7a('0x20')](_0x434747)){logger[_0x5d7a('0x23')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x434747[_0x5d7a('0x24')],_0x434747['state']);logger['debug'](_0x5d7a('0x25'),util[_0x5d7a('0x1e')](_0x434747,{'showHidden':![],'depth':null}));var _0x586e5a=_['find'](this[_0x5d7a('0xb')],{'registry':_0x434747[_0x5d7a('0x24')]});if(_0x586e5a){_0x434747[_0x5d7a('0x26')]=_0x434747[_0x5d7a('0x27')];_[_0x5d7a('0x28')](_0x586e5a,_['omit'](_0x434747,[_0x5d7a('0x29'),_0x5d7a('0x2a'),_0x5d7a('0x24'),'state']));logger[_0x5d7a('0x2b')](_0x5d7a('0x2c'),util['inspect'](_0x586e5a,{'showHidden':![],'depth':null}));this[_0x5d7a('0x22')](util['format'](_0x5d7a('0x2d'),_0x586e5a[_0x5d7a('0x2e')]),_0x5d7a('0x2f'),_0x586e5a);}}}catch(_0x4a26f8){logger[_0x5d7a('0x1a')](_0x5d7a('0x25'),util[_0x5d7a('0x1e')](_0x4a26f8,{'showHidden':![],'depth':null}));}};UserReport[_0x5d7a('0x1f')][_0x5d7a('0x13')]=function(_0x14c02e){try{if(this[_0x5d7a('0x20')](_0x14c02e)){logger['info'](_0x5d7a('0x30'),_0x14c02e[_0x5d7a('0x31')],_0x14c02e[_0x5d7a('0x27')]);logger[_0x5d7a('0x2b')](_0x5d7a('0x32'),util[_0x5d7a('0x1e')](_0x14c02e,{'showHidden':![],'depth':null}));if(this['agents'][_0x14c02e['device']]){if(!this[_0x5d7a('0xc')][_0x14c02e[_0x5d7a('0x31')]]['local']||_0x14c02e[_0x5d7a('0x27')][_0x5d7a('0x33')]()==_0x5d7a('0x34')){this['agents'][_0x14c02e['device']][_0x5d7a('0x35')]=![];if(this['agents'][_0x14c02e[_0x5d7a('0x31')]][_0x5d7a('0x27')]!==_0x14c02e['state'][_0x5d7a('0x33')]()){this[_0x5d7a('0xc')][_0x14c02e[_0x5d7a('0x31')]][_0x5d7a('0x36')]=_['toNumber'](moment()['format']('x'));}this['agents'][_0x14c02e[_0x5d7a('0x31')]][_0x5d7a('0x27')]=_0x14c02e[_0x5d7a('0x27')][_0x5d7a('0x33')]();this['agents'][_0x14c02e[_0x5d7a('0x31')]]['updateStatusRealtime'](_0x14c02e);}}else if(this[_0x5d7a('0xd')][_0x14c02e[_0x5d7a('0x31')]]){if(this['telephones'][_0x14c02e[_0x5d7a('0x31')]][_0x5d7a('0x27')]!==_0x14c02e[_0x5d7a('0x27')][_0x5d7a('0x33')]()){this['telephones'][_0x14c02e[_0x5d7a('0x31')]][_0x5d7a('0x36')]=_[_0x5d7a('0x37')](moment()[_0x5d7a('0x38')]('x'));}this[_0x5d7a('0xd')][_0x14c02e[_0x5d7a('0x31')]][_0x5d7a('0x27')]=_0x14c02e[_0x5d7a('0x27')][_0x5d7a('0x33')]();logger[_0x5d7a('0x2b')](_0x5d7a('0x39'),util['inspect'](this['telephones'][_0x14c02e[_0x5d7a('0x31')]],{'showHidden':![],'depth':null}));this[_0x5d7a('0x22')](util['format'](_0x5d7a('0x3a'),this[_0x5d7a('0xd')][_0x14c02e[_0x5d7a('0x31')]]['name']),_0x5d7a('0x3b'),this[_0x5d7a('0xd')][_0x14c02e[_0x5d7a('0x31')]]);}else if(this[_0x5d7a('0xb')][_0x14c02e['device']]){if(this[_0x5d7a('0xb')][_0x14c02e[_0x5d7a('0x31')]]['state']!==_0x14c02e[_0x5d7a('0x27')][_0x5d7a('0x33')]()){this[_0x5d7a('0xb')][_0x14c02e['device']]['stateTime']=_[_0x5d7a('0x37')](moment()[_0x5d7a('0x38')]('x'));}this['trunks'][_0x14c02e[_0x5d7a('0x31')]][_0x5d7a('0x27')]=_0x14c02e[_0x5d7a('0x27')][_0x5d7a('0x33')]();logger[_0x5d7a('0x2b')](_0x5d7a('0x3c'),util[_0x5d7a('0x1e')](this[_0x5d7a('0xb')][_0x14c02e[_0x5d7a('0x31')]],{'showHidden':![],'depth':null}));this[_0x5d7a('0x22')](util[_0x5d7a('0x38')](_0x5d7a('0x2d'),this[_0x5d7a('0xb')][_0x14c02e['device']][_0x5d7a('0x2e')]),'trunk:save',this[_0x5d7a('0xb')][_0x14c02e[_0x5d7a('0x31')]]);}else if(_[_0x5d7a('0x3d')](_0x14c02e[_0x5d7a('0x31')],_0x5d7a('0x3e'))){var _0x3913c9=_0x14c02e[_0x5d7a('0x31')];var _0x583f4a=_0x3913c9[_0x5d7a('0x3f')](_0x3913c9['indexOf']('/')+0x1,_0x3913c9[_0x5d7a('0x40')]('@'));var _0x3805d5=_[_0x5d7a('0x41')](this[_0x5d7a('0xc')],function(_0x49cce7){return _0x49cce7[_0x5d7a('0x42')]==_0x583f4a||_0x49cce7[_0x5d7a('0x43')]==_0x583f4a||_0x49cce7[_0x5d7a('0x44')]==_0x583f4a;});if(_0x3805d5){if(_0x3805d5[_0x5d7a('0x27')]!==_0x14c02e['state'][_0x5d7a('0x33')]()){_0x3805d5[_0x5d7a('0x36')]=_[_0x5d7a('0x37')](moment()[_0x5d7a('0x38')]('x'));}_0x3805d5[_0x5d7a('0x27')]=_0x14c02e[_0x5d7a('0x27')]['toLowerCase']();_0x3805d5[_0x5d7a('0x35')]=!![];_0x3805d5[_0x5d7a('0x45')](_0x14c02e);}}}}catch(_0x3821ed){logger[_0x5d7a('0x1a')](_0x5d7a('0x32'),util['inspect'](_0x3821ed,{'showHidden':![],'depth':null}));}};UserReport[_0x5d7a('0x1f')][_0x5d7a('0x14')]=function(_0x1cf48d){try{if(this['isNotNull'](_0x1cf48d)&&this[_0x5d7a('0x20')](_0x1cf48d['peerstatus'])){logger['info'](_0x5d7a('0x46'),_0x1cf48d[_0x5d7a('0x47')],_0x1cf48d[_0x5d7a('0x48')],_0x1cf48d['peerstatus']);logger[_0x5d7a('0x2b')](_0x5d7a('0x49'),util['inspect'](_0x1cf48d,{'showHidden':![],'depth':null}));if(this[_0x5d7a('0xc')][_0x1cf48d[_0x5d7a('0x47')]]){if(!this['agents'][_0x1cf48d['peer']]['local']||_0x1cf48d[_0x5d7a('0x4a')][_0x5d7a('0x33')]()==_0x5d7a('0x4b')){this[_0x5d7a('0xc')][_0x1cf48d[_0x5d7a('0x47')]][_0x5d7a('0x35')]=![];this[_0x5d7a('0xc')][_0x1cf48d[_0x5d7a('0x47')]][_0x5d7a('0x4c')]=_0x1cf48d[_0x5d7a('0x4a')]['toLowerCase']();this[_0x5d7a('0xc')][_0x1cf48d[_0x5d7a('0x47')]][_0x5d7a('0x48')]=_0x1cf48d[_0x5d7a('0x48')];this[_0x5d7a('0xc')][_0x1cf48d[_0x5d7a('0x47')]][_0x5d7a('0x45')](_0x1cf48d);}}else if(this[_0x5d7a('0xd')][_0x1cf48d[_0x5d7a('0x47')]]){this['telephones'][_0x1cf48d[_0x5d7a('0x47')]][_0x5d7a('0x4c')]=_0x1cf48d[_0x5d7a('0x4a')][_0x5d7a('0x33')]();this[_0x5d7a('0xd')][_0x1cf48d[_0x5d7a('0x47')]]['address']=_0x1cf48d['address'];logger['debug']('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x5d7a('0x1e')](this[_0x5d7a('0xd')][_0x1cf48d[_0x5d7a('0x47')]],{'showHidden':![],'depth':null}));this[_0x5d7a('0x22')](util['format'](_0x5d7a('0x3a'),this[_0x5d7a('0xd')][_0x1cf48d[_0x5d7a('0x47')]][_0x5d7a('0x2e')]),'telephone:save',this[_0x5d7a('0xd')][_0x1cf48d[_0x5d7a('0x47')]]);}else if(this['trunks'][_0x1cf48d['peer']]){this['trunks'][_0x1cf48d[_0x5d7a('0x47')]]['status']=_0x1cf48d[_0x5d7a('0x4a')][_0x5d7a('0x33')]();this[_0x5d7a('0xb')][_0x1cf48d[_0x5d7a('0x47')]][_0x5d7a('0x48')]=_0x1cf48d[_0x5d7a('0x48')];logger['debug'](_0x5d7a('0x4d'),util['inspect'](this['trunks'][_0x1cf48d['peer']],{'showHidden':![],'depth':null}));this[_0x5d7a('0x22')](util['format'](_0x5d7a('0x2d'),this[_0x5d7a('0xb')][_0x1cf48d[_0x5d7a('0x47')]][_0x5d7a('0x2e')]),_0x5d7a('0x2f'),this[_0x5d7a('0xb')][_0x1cf48d['peer']]);}}}catch(_0x437e28){logger[_0x5d7a('0x1a')](_0x5d7a('0x49'),util[_0x5d7a('0x1e')](_0x437e28,{'showHidden':![],'depth':null}));}};module[_0x5d7a('0x4e')]=UserReport; \ No newline at end of file +var _0x1e05=['bluebird','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','trunks','telephones','bind','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','then','actionSipShowRegistry','catch','[userReport][sipshowregistry]','resolve','error','[userReport][devicestatelist]','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','syncRegistry','info','[userReport][registry]\x20registry:%s\x20state:%s','debug','[userReport][registry]','find','stateRegistry','state','merge','omit','event','actionid','username','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]','device','agents','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','peer','registered','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1e05,0x170));var _0x51e0=function(_0x5106c1,_0x13233a){_0x5106c1=_0x5106c1-0x0;var _0x5bcaac=_0x1e05[_0x5106c1];return _0x5bcaac;};'use strict';var _=require(_0x51e0('0x0'));var moment=require(_0x51e0('0x1'));var util=require('util');var Redis=require('ioredis');var BPromise=require(_0x51e0('0x2'));var config=require(_0x51e0('0x3'));var logger=require(_0x51e0('0x4'))(_0x51e0('0x5'));var ami=require('../ami');config[_0x51e0('0x6')]=_[_0x51e0('0x7')](config[_0x51e0('0x6')],{'host':_0x51e0('0x8'),'port':0x18eb});var io=require(_0x51e0('0x9'))(new Redis(config[_0x51e0('0x6')]));function UserReport(_0x5b62d4){this['trunks']=_0x5b62d4[_0x51e0('0xa')];this['agents']=_0x5b62d4['agents'];this[_0x51e0('0xb')]=_0x5b62d4[_0x51e0('0xb')];ami['on']('registryentry',this['syncRegistry'][_0x51e0('0xc')](this));ami['on']('registry',this['syncRegistry'][_0x51e0('0xc')](this));ami['on']('devicestatechange',this[_0x51e0('0xd')][_0x51e0('0xc')](this));ami['on'](_0x51e0('0xe'),this[_0x51e0('0xf')][_0x51e0('0xc')](this));return this[_0x51e0('0x10')]();}function showSipRegistrations(){Promise['resolve']()[_0x51e0('0x11')](ami[_0x51e0('0x12')]())[_0x51e0('0x13')](function(_0x1c8e7c){logger['error'](_0x51e0('0x14'),util['inspect'](_0x1c8e7c,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x51e0('0x15')]()[_0x51e0('0x11')](ami['actionDeviceStateList']())[_0x51e0('0x13')](function(_0x280aba){logger[_0x51e0('0x16')](_0x51e0('0x17'),util[_0x51e0('0x18')](_0x280aba,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x51e0('0x15')]()[_0x51e0('0x11')](ami[_0x51e0('0x19')]())['catch'](function(_0x3a344d){logger[_0x51e0('0x16')](_0x51e0('0x1a'),util[_0x51e0('0x18')](_0x3a344d,{'showHidden':![],'depth':null}));});}UserReport[_0x51e0('0x1b')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x51e0('0x15')]()[_0x51e0('0x11')](showSipRegistrations())[_0x51e0('0x11')](listDeviceStates())[_0x51e0('0x11')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x51e0('0x1c')]=function(_0x3b0b8d){return _0x3b0b8d!==null&&!_[_0x51e0('0x1d')](_0x3b0b8d);};UserReport[_0x51e0('0x1b')][_0x51e0('0x1e')]=function(_0x358fc0,_0x2a6cf5,_0x597127){io['to'](_0x358fc0)[_0x51e0('0x1e')](_0x2a6cf5,_0x597127);};UserReport['prototype'][_0x51e0('0x1f')]=function(_0x2f80c0){try{if(this['isNotNull'](_0x2f80c0)){logger[_0x51e0('0x20')](_0x51e0('0x21'),_0x2f80c0['username'],_0x2f80c0['state']);logger[_0x51e0('0x22')](_0x51e0('0x23'),util['inspect'](_0x2f80c0,{'showHidden':![],'depth':null}));var _0x3aa636=_[_0x51e0('0x24')](this[_0x51e0('0xa')],{'registry':_0x2f80c0['username']});if(_0x3aa636){_0x2f80c0[_0x51e0('0x25')]=_0x2f80c0[_0x51e0('0x26')];_[_0x51e0('0x27')](_0x3aa636,_[_0x51e0('0x28')](_0x2f80c0,[_0x51e0('0x29'),_0x51e0('0x2a'),_0x51e0('0x2b'),'state']));logger['debug'](_0x51e0('0x2c'),util[_0x51e0('0x18')](_0x3aa636,{'showHidden':![],'depth':null}));this[_0x51e0('0x1e')](util[_0x51e0('0x2d')](_0x51e0('0x2e'),_0x3aa636[_0x51e0('0x2f')]),_0x51e0('0x30'),_0x3aa636);}}}catch(_0x1c7e88){logger[_0x51e0('0x16')](_0x51e0('0x23'),util[_0x51e0('0x18')](_0x1c7e88,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x51e0('0xd')]=function(_0x67e887){try{if(this['isNotNull'](_0x67e887)){logger[_0x51e0('0x20')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x67e887['device'],_0x67e887[_0x51e0('0x26')]);logger[_0x51e0('0x22')](_0x51e0('0x31'),util[_0x51e0('0x18')](_0x67e887,{'showHidden':![],'depth':null}));if(this['agents'][_0x67e887[_0x51e0('0x32')]]){if(!this[_0x51e0('0x33')][_0x67e887[_0x51e0('0x32')]][_0x51e0('0x34')]||_0x67e887[_0x51e0('0x26')][_0x51e0('0x35')]()==_0x51e0('0x36')){this[_0x51e0('0x33')][_0x67e887[_0x51e0('0x32')]][_0x51e0('0x34')]=![];if(this[_0x51e0('0x33')][_0x67e887['device']][_0x51e0('0x26')]!==_0x67e887[_0x51e0('0x26')]['toLowerCase']()){this[_0x51e0('0x33')][_0x67e887[_0x51e0('0x32')]][_0x51e0('0x37')]=_[_0x51e0('0x38')](moment()[_0x51e0('0x2d')]('x'));}this[_0x51e0('0x33')][_0x67e887[_0x51e0('0x32')]]['state']=_0x67e887[_0x51e0('0x26')][_0x51e0('0x35')]();this[_0x51e0('0x33')][_0x67e887[_0x51e0('0x32')]][_0x51e0('0x39')](_0x67e887);}}else if(this[_0x51e0('0xb')][_0x67e887[_0x51e0('0x32')]]){if(this[_0x51e0('0xb')][_0x67e887[_0x51e0('0x32')]][_0x51e0('0x26')]!==_0x67e887[_0x51e0('0x26')]['toLowerCase']()){this[_0x51e0('0xb')][_0x67e887[_0x51e0('0x32')]][_0x51e0('0x37')]=_[_0x51e0('0x38')](moment()[_0x51e0('0x2d')]('x'));}this[_0x51e0('0xb')][_0x67e887[_0x51e0('0x32')]][_0x51e0('0x26')]=_0x67e887['state']['toLowerCase']();logger[_0x51e0('0x22')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x51e0('0x18')](this[_0x51e0('0xb')][_0x67e887[_0x51e0('0x32')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x51e0('0x2d')](_0x51e0('0x3a'),this[_0x51e0('0xb')][_0x67e887[_0x51e0('0x32')]]['name']),_0x51e0('0x3b'),this[_0x51e0('0xb')][_0x67e887[_0x51e0('0x32')]]);}else if(this[_0x51e0('0xa')][_0x67e887[_0x51e0('0x32')]]){if(this[_0x51e0('0xa')][_0x67e887[_0x51e0('0x32')]][_0x51e0('0x26')]!==_0x67e887[_0x51e0('0x26')][_0x51e0('0x35')]()){this[_0x51e0('0xa')][_0x67e887[_0x51e0('0x32')]][_0x51e0('0x37')]=_[_0x51e0('0x38')](moment()['format']('x'));}this[_0x51e0('0xa')][_0x67e887['device']][_0x51e0('0x26')]=_0x67e887[_0x51e0('0x26')][_0x51e0('0x35')]();logger[_0x51e0('0x22')](_0x51e0('0x3c'),util[_0x51e0('0x18')](this[_0x51e0('0xa')][_0x67e887[_0x51e0('0x32')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x51e0('0x2d')](_0x51e0('0x2e'),this['trunks'][_0x67e887['device']][_0x51e0('0x2f')]),_0x51e0('0x30'),this[_0x51e0('0xa')][_0x67e887[_0x51e0('0x32')]]);}else if(_[_0x51e0('0x3d')](_0x67e887[_0x51e0('0x32')],_0x51e0('0x3e'))){var _0x2d5911=_0x67e887[_0x51e0('0x32')];var _0x409d5e=_0x2d5911[_0x51e0('0x3f')](_0x2d5911[_0x51e0('0x40')]('/')+0x1,_0x2d5911[_0x51e0('0x40')]('@'));var _0x380f7d=_[_0x51e0('0x24')](this['agents'],function(_0xbe547a){return _0xbe547a[_0x51e0('0x41')]==_0x409d5e||_0xbe547a['phone']==_0x409d5e||_0xbe547a[_0x51e0('0x42')]==_0x409d5e;});if(_0x380f7d){if(_0x380f7d[_0x51e0('0x26')]!==_0x67e887[_0x51e0('0x26')]['toLowerCase']()){_0x380f7d[_0x51e0('0x37')]=_['toNumber'](moment()[_0x51e0('0x2d')]('x'));}_0x380f7d[_0x51e0('0x26')]=_0x67e887[_0x51e0('0x26')][_0x51e0('0x35')]();_0x380f7d[_0x51e0('0x34')]=!![];_0x380f7d['updateStatusRealtime'](_0x67e887);}}}}catch(_0x1fe630){logger[_0x51e0('0x16')]('[userReport][devicestatechange]',util[_0x51e0('0x18')](_0x1fe630,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x51e0('0xf')]=function(_0x121856){try{if(this[_0x51e0('0x1c')](_0x121856)&&this['isNotNull'](_0x121856['peerstatus'])){logger['info'](_0x51e0('0x43'),_0x121856['peer'],_0x121856[_0x51e0('0x44')],_0x121856[_0x51e0('0xe')]);logger[_0x51e0('0x22')]('[userReport][peerstatus]',util[_0x51e0('0x18')](_0x121856,{'showHidden':![],'depth':null}));if(this['agents'][_0x121856['peer']]){if(!this[_0x51e0('0x33')][_0x121856[_0x51e0('0x45')]][_0x51e0('0x34')]||_0x121856['peerstatus']['toLowerCase']()==_0x51e0('0x46')){this[_0x51e0('0x33')][_0x121856[_0x51e0('0x45')]][_0x51e0('0x34')]=![];this[_0x51e0('0x33')][_0x121856[_0x51e0('0x45')]]['status']=_0x121856[_0x51e0('0xe')][_0x51e0('0x35')]();this[_0x51e0('0x33')][_0x121856['peer']][_0x51e0('0x44')]=_0x121856['address'];this['agents'][_0x121856[_0x51e0('0x45')]][_0x51e0('0x39')](_0x121856);}}else if(this[_0x51e0('0xb')][_0x121856[_0x51e0('0x45')]]){this[_0x51e0('0xb')][_0x121856['peer']][_0x51e0('0x47')]=_0x121856[_0x51e0('0xe')]['toLowerCase']();this[_0x51e0('0xb')][_0x121856[_0x51e0('0x45')]][_0x51e0('0x44')]=_0x121856[_0x51e0('0x44')];logger[_0x51e0('0x22')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x51e0('0x18')](this[_0x51e0('0xb')][_0x121856['peer']],{'showHidden':![],'depth':null}));this['emit'](util[_0x51e0('0x2d')](_0x51e0('0x3a'),this[_0x51e0('0xb')][_0x121856[_0x51e0('0x45')]][_0x51e0('0x2f')]),_0x51e0('0x3b'),this[_0x51e0('0xb')][_0x121856[_0x51e0('0x45')]]);}else if(this[_0x51e0('0xa')][_0x121856[_0x51e0('0x45')]]){this[_0x51e0('0xa')][_0x121856[_0x51e0('0x45')]][_0x51e0('0x47')]=_0x121856[_0x51e0('0xe')]['toLowerCase']();this['trunks'][_0x121856[_0x51e0('0x45')]][_0x51e0('0x44')]=_0x121856[_0x51e0('0x44')];logger[_0x51e0('0x22')](_0x51e0('0x48'),util[_0x51e0('0x18')](this[_0x51e0('0xa')][_0x121856[_0x51e0('0x45')]],{'showHidden':![],'depth':null}));this[_0x51e0('0x1e')](util[_0x51e0('0x2d')](_0x51e0('0x2e'),this['trunks'][_0x121856[_0x51e0('0x45')]][_0x51e0('0x2f')]),_0x51e0('0x30'),this[_0x51e0('0xa')][_0x121856[_0x51e0('0x45')]]);}}}catch(_0x4bfbc8){logger[_0x51e0('0x16')]('[userReport][peerstatus]',util[_0x51e0('0x18')](_0x4bfbc8,{'showHidden':![],'depth':null}));}};module[_0x51e0('0x49')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index f8bcd3d..b2cf7bb 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 _0x46d8=['interface','[%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','[%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','reason','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','agent','talktime','acwtime','acwTimeout','agentacw','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','user:agentcomplete','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','emit','isNotNull','isUndefined','prototype','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','format','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','inspect','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent'];(function(_0x1d08d9,_0x2f7178){var _0x147a0a=function(_0x5a03cb){while(--_0x5a03cb){_0x1d08d9['push'](_0x1d08d9['shift']());}};_0x147a0a(++_0x2f7178);}(_0x46d8,0xf6));var _0x846d=function(_0xb1473e,_0x3ed6d7){_0xb1473e=_0xb1473e-0x0;var _0x9760f4=_0x46d8[_0xb1473e];return _0x9760f4;};'use strict';var _=require(_0x846d('0x0'));var moment=require(_0x846d('0x1'));var util=require(_0x846d('0x2'));var Redis=require(_0x846d('0x3'));var config=require('../../../config/environment');var logger=require(_0x846d('0x4'))(_0x846d('0x5'));var ami=require(_0x846d('0x6'));config[_0x846d('0x7')]=_[_0x846d('0x8')](config[_0x846d('0x7')],{'host':_0x846d('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x846d('0x7')]));function VoiceAgentReport(_0x18ce32){this[_0x846d('0xa')]={};this[_0x846d('0xb')]=_0x18ce32[_0x846d('0xb')];this[_0x846d('0xc')]=_0x18ce32[_0x846d('0xc')];this[_0x846d('0xd')]={};ami['on'](_0x846d('0xe'),this[_0x846d('0xf')][_0x846d('0x10')](this));ami['on'](_0x846d('0x11'),this[_0x846d('0x12')][_0x846d('0x10')](this));ami['on'](_0x846d('0x13'),this[_0x846d('0x14')][_0x846d('0x10')](this));ami['on']('queuecallerabandon',this[_0x846d('0x15')][_0x846d('0x10')](this));ami['on'](_0x846d('0x16'),this[_0x846d('0x17')][_0x846d('0x10')](this));ami['on'](_0x846d('0x18'),this['syncVarSet'][_0x846d('0x10')](this));ami['on'](_0x846d('0x19'),this[_0x846d('0x1a')]['bind'](this));ami['on'](_0x846d('0x1b'),this[_0x846d('0x1c')][_0x846d('0x10')](this));ami['on'](_0x846d('0x1d'),this[_0x846d('0x1e')]['bind'](this));ami['on'](_0x846d('0x1f'),this[_0x846d('0x20')][_0x846d('0x10')](this));ami['on']('blindtransfer',this[_0x846d('0x21')]['bind'](this));}VoiceAgentReport['prototype'][_0x846d('0x22')]=function(_0x175f6e,_0x185d81,_0xe86430){io['to'](_0x175f6e)[_0x846d('0x22')](_0x185d81,_0xe86430);};VoiceAgentReport['prototype'][_0x846d('0x23')]=function(_0x52d18f){return _0x52d18f!==null&&!_[_0x846d('0x24')](_0x52d18f);};VoiceAgentReport[_0x846d('0x25')][_0x846d('0xf')]=function(_0xa2e44a){try{if(this[_0x846d('0x23')](_0xa2e44a)){logger[_0x846d('0x26')](_0x846d('0x27'),_0xa2e44a[_0x846d('0x28')],_0xa2e44a[_0x846d('0x29')],_0xa2e44a[_0x846d('0x2a')]);logger[_0x846d('0x2b')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0xa2e44a[_0x846d('0x28')],util['inspect'](_0xa2e44a,{'showHidden':![],'depth':null}));if(_[_0x846d('0x24')](this[_0x846d('0xa')][_0xa2e44a['uniqueid']])){this[_0x846d('0xa')][_0xa2e44a['uniqueid']]={};}if(_[_0x846d('0x24')](this['channels'][_0xa2e44a[_0x846d('0x28')]][_0xa2e44a[_0x846d('0x2a')]])){this[_0x846d('0xa')][_0xa2e44a['uniqueid']][_0xa2e44a[_0x846d('0x2a')]]={'agentcalledAt':moment()[_0x846d('0x2c')](_0x846d('0x2d')),'lastevent':'called','mandatoryDisposition':this['voiceQueues'][_0xa2e44a[_0x846d('0x2e')]]?this[_0x846d('0xb')][_0xa2e44a['queue']][_0x846d('0x2f')]||![]:![],'type':this['voiceQueues'][_0xa2e44a[_0x846d('0x2e')]]?this[_0x846d('0xb')][_0xa2e44a[_0x846d('0x2e')]][_0x846d('0x30')]||_0x846d('0x31'):_0x846d('0x31'),'variables':this['variables'][_0xa2e44a[_0x846d('0x28')]]};}_[_0x846d('0x32')](this[_0x846d('0xa')][_0xa2e44a[_0x846d('0x28')]][_0xa2e44a[_0x846d('0x2a')]],_[_0x846d('0x33')](_0xa2e44a,[_0x846d('0x34'),'privilege']));logger[_0x846d('0x2b')](_0x846d('0x35'),_0xa2e44a[_0x846d('0x28')],util[_0x846d('0x36')](this['channels'][_0xa2e44a[_0x846d('0x28')]][_0xa2e44a[_0x846d('0x2a')]],{'showHidden':![],'depth':null}));ami[_0x846d('0x22')](_0x846d('0x37'),this[_0x846d('0xa')][_0xa2e44a['uniqueid']][_0xa2e44a[_0x846d('0x2a')]]);logger[_0x846d('0x2b')](_0x846d('0x38'),_0xa2e44a[_0x846d('0x28')],util[_0x846d('0x36')](this[_0x846d('0xa')][_0xa2e44a[_0x846d('0x28')]][_0xa2e44a[_0x846d('0x2a')]],{'showHidden':![],'depth':null}));this[_0x846d('0x22')](util[_0x846d('0x2c')](_0x846d('0x39'),_0xa2e44a[_0x846d('0x29')]),_0x846d('0x3a'),this[_0x846d('0xa')][_0xa2e44a[_0x846d('0x28')]][_0xa2e44a[_0x846d('0x2a')]]);}}catch(_0x46b912){logger['error'](_0x846d('0x3b'),_0xa2e44a[_0x846d('0x28')],util[_0x846d('0x36')](_0x46b912,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x846d('0x25')][_0x846d('0x12')]=function(_0x3268be){try{if(this[_0x846d('0x23')](_0x3268be)){if(this[_0x846d('0xa')][_0x3268be[_0x846d('0x28')]]){logger[_0x846d('0x2b')](_0x846d('0x3c'),_0x3268be[_0x846d('0x28')],util[_0x846d('0x36')](_0x3268be,{'showHidden':![],'depth':null}));for(var _0x54ba60 in this[_0x846d('0xa')][_0x3268be[_0x846d('0x28')]]){if(this['channels'][_0x3268be['uniqueid']][_0x846d('0x3d')](_0x54ba60)){if(_0x3268be[_0x846d('0x2a')]===_0x54ba60){logger[_0x846d('0x26')](_0x846d('0x3e'),_0x3268be[_0x846d('0x28')],_0x3268be[_0x846d('0x29')],_0x3268be[_0x846d('0x2a')]);this[_0x846d('0xa')][_0x3268be[_0x846d('0x28')]][_0x54ba60][_0x846d('0x3f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x846d('0xa')][_0x3268be['uniqueid']][_0x54ba60][_0x846d('0x40')]=_0x3268be[_0x846d('0x40')];this[_0x846d('0xa')][_0x3268be[_0x846d('0x28')]][_0x54ba60][_0x846d('0x41')]=_0x3268be[_0x846d('0x41')];this[_0x846d('0xa')][_0x3268be[_0x846d('0x28')]][_0x54ba60][_0x846d('0x42')]=_0x3268be[_0x846d('0x42')];this['channels'][_0x3268be[_0x846d('0x28')]][_0x54ba60][_0x846d('0x43')]=_0x3268be[_0x846d('0x43')];this[_0x846d('0xa')][_0x3268be[_0x846d('0x28')]][_0x54ba60][_0x846d('0x44')]=_0x3268be['holdtime'];this['channels'][_0x3268be[_0x846d('0x28')]][_0x54ba60][_0x846d('0x45')]='connect';_[_0x846d('0x32')](this[_0x846d('0xc')][_0x3268be[_0x846d('0x46')]],_['pick'](_0x3268be,[_0x846d('0x2e'),'destconnectedlinenum']));logger[_0x846d('0x2b')](_0x846d('0x47'),_0x3268be[_0x846d('0x28')],util[_0x846d('0x36')](this['channels'][_0x3268be[_0x846d('0x28')]][_0x3268be[_0x846d('0x2a')]],{'showHidden':![],'depth':null}));ami[_0x846d('0x22')](_0x846d('0x48'),this[_0x846d('0xa')][_0x3268be[_0x846d('0x28')]][_0x3268be[_0x846d('0x2a')]]);logger['debug'](_0x846d('0x49'),_0x3268be[_0x846d('0x28')],util[_0x846d('0x36')](this[_0x846d('0xa')][_0x3268be['uniqueid']][_0x3268be['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x846d('0x22')](util[_0x846d('0x2c')]('user:%s',_0x3268be['membername']),_0x846d('0x4a'),this[_0x846d('0xa')][_0x3268be['uniqueid']][_0x3268be[_0x846d('0x2a')]]);}else if(!this[_0x846d('0xa')][_0x3268be[_0x846d('0x28')]][_0x54ba60]['agentringnoanswer']&&!this[_0x846d('0xa')][_0x3268be['uniqueid']][_0x54ba60]['agentcomplete']){logger['info'](_0x846d('0x4b'),_0x3268be['uniqueid'],this[_0x846d('0xa')][_0x3268be[_0x846d('0x28')]][_0x54ba60]['membername'],_0x54ba60);this[_0x846d('0xa')][_0x3268be[_0x846d('0x28')]][_0x54ba60][_0x846d('0x13')]=!![];this[_0x846d('0xa')][_0x3268be[_0x846d('0x28')]][_0x54ba60][_0x846d('0x4c')]=moment()['format'](_0x846d('0x2d'));this[_0x846d('0xa')][_0x3268be[_0x846d('0x28')]][_0x54ba60][_0x846d('0x4d')]=_0x3268be['destuniqueid'];this[_0x846d('0xa')][_0x3268be[_0x846d('0x28')]][_0x54ba60][_0x846d('0x4e')]=_0x3268be[_0x846d('0x29')];this[_0x846d('0xa')][_0x3268be[_0x846d('0x28')]][_0x54ba60]['lastevent']=_0x846d('0x4f');this[_0x846d('0xa')][_0x3268be[_0x846d('0x28')]][_0x54ba60]['reason']='answered_elsewhere';logger[_0x846d('0x2b')](_0x846d('0x50'),_0x3268be[_0x846d('0x28')],util['inspect'](this[_0x846d('0xa')][_0x3268be[_0x846d('0x28')]][_0x54ba60],{'showHidden':![],'depth':null}));ami['emit'](_0x846d('0x51'),this[_0x846d('0xa')][_0x3268be['uniqueid']][_0x54ba60]);}}}}}}catch(_0x5b9886){logger['error'](_0x846d('0x52'),_0x3268be[_0x846d('0x28')],util[_0x846d('0x36')](_0x5b9886,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x846d('0x25')][_0x846d('0x14')]=function(_0x31d562){try{if(this[_0x846d('0x23')](_0x31d562)){logger[_0x846d('0x2b')](_0x846d('0x53'),_0x31d562['uniqueid'],util[_0x846d('0x36')](_0x31d562,{'showHidden':![],'depth':null}));if(this[_0x846d('0xa')][_0x31d562['uniqueid']]&&this[_0x846d('0xa')][_0x31d562['uniqueid']][_0x31d562['destuniqueid']]){logger[_0x846d('0x26')](_0x846d('0x54'),_0x31d562[_0x846d('0x28')],_0x31d562[_0x846d('0x29')],_0x31d562[_0x846d('0x2a')]);this['channels'][_0x31d562['uniqueid']][_0x31d562[_0x846d('0x2a')]][_0x846d('0x13')]=!![];this[_0x846d('0xa')][_0x31d562[_0x846d('0x28')]][_0x31d562[_0x846d('0x2a')]][_0x846d('0x4c')]=moment()[_0x846d('0x2c')](_0x846d('0x2d'));this[_0x846d('0xa')][_0x31d562[_0x846d('0x28')]][_0x31d562[_0x846d('0x2a')]][_0x846d('0x45')]=_0x846d('0x55');this[_0x846d('0xa')][_0x31d562['uniqueid']][_0x31d562[_0x846d('0x2a')]][_0x846d('0x56')]=_0x846d('0x55');logger[_0x846d('0x2b')](_0x846d('0x57'),_0x31d562[_0x846d('0x28')],util[_0x846d('0x36')](this[_0x846d('0xa')][_0x31d562[_0x846d('0x28')]][_0x31d562[_0x846d('0x2a')]],{'showHidden':![],'depth':null}));ami[_0x846d('0x22')](_0x846d('0x58'),this[_0x846d('0xa')][_0x31d562[_0x846d('0x28')]][_0x31d562[_0x846d('0x2a')]]);}}}catch(_0x641983){logger[_0x846d('0x59')](_0x846d('0x5a'),_0x31d562[_0x846d('0x28')],util[_0x846d('0x36')](_0x641983,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x846d('0x25')]['syncQueueCallerAbandon']=function(_0x32ba46){try{if(this[_0x846d('0x23')](_0x32ba46)){logger[_0x846d('0x2b')](_0x846d('0x5b'),_0x32ba46[_0x846d('0x28')],util['inspect'](_0x32ba46,{'showHidden':![],'depth':null}));if(this[_0x846d('0xa')][_0x32ba46[_0x846d('0x28')]]){for(var _0x9cb90b in this[_0x846d('0xa')][_0x32ba46[_0x846d('0x28')]]){if(this[_0x846d('0xa')][_0x32ba46['uniqueid']][_0x846d('0x3d')](_0x9cb90b)&&!this['channels'][_0x32ba46['uniqueid']][_0x9cb90b][_0x846d('0x13')]&&!this[_0x846d('0xa')][_0x32ba46[_0x846d('0x28')]][_0x9cb90b][_0x846d('0x16')]){logger[_0x846d('0x26')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x32ba46[_0x846d('0x28')],this[_0x846d('0xa')][_0x32ba46[_0x846d('0x28')]][_0x9cb90b][_0x846d('0x29')],_0x9cb90b);this[_0x846d('0xa')][_0x32ba46['uniqueid']][_0x9cb90b][_0x846d('0x13')]=!![];this[_0x846d('0xa')][_0x32ba46[_0x846d('0x28')]][_0x9cb90b]['agentringnoanswerAt']=moment()[_0x846d('0x2c')](_0x846d('0x2d'));this[_0x846d('0xa')][_0x32ba46[_0x846d('0x28')]][_0x9cb90b]['lastevent']=_0x846d('0x5c');this[_0x846d('0xa')][_0x32ba46[_0x846d('0x28')]][_0x9cb90b][_0x846d('0x56')]=_0x846d('0x5c');logger[_0x846d('0x2b')](_0x846d('0x5d'),_0x32ba46[_0x846d('0x28')],util[_0x846d('0x36')](this['channels'][_0x32ba46[_0x846d('0x28')]][_0x9cb90b],{'showHidden':![],'depth':null}));ami[_0x846d('0x22')](_0x846d('0x5e'),this[_0x846d('0xa')][_0x32ba46[_0x846d('0x28')]][_0x9cb90b]);}}}}}catch(_0x4ada94){logger[_0x846d('0x59')](_0x846d('0x5f'),_0x32ba46[_0x846d('0x28')],util[_0x846d('0x36')](_0x4ada94,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentComplete']=function(_0x118787){try{if(this[_0x846d('0x23')](_0x118787)){logger[_0x846d('0x2b')](_0x846d('0x60'),_0x118787[_0x846d('0x28')],util[_0x846d('0x36')](_0x118787,{'showHidden':![],'depth':null}));if(this[_0x846d('0xa')][_0x118787[_0x846d('0x28')]]){for(var _0x2ee740 in this['channels'][_0x118787[_0x846d('0x28')]]){if(this['channels'][_0x118787[_0x846d('0x28')]][_0x846d('0x3d')](_0x2ee740)){if(this[_0x846d('0xa')][_0x118787[_0x846d('0x28')]][_0x2ee740]['agentconnectAt']&&!this[_0x846d('0xa')][_0x118787[_0x846d('0x28')]][_0x2ee740][_0x846d('0x16')]){logger[_0x846d('0x26')](_0x846d('0x61'),_0x118787[_0x846d('0x28')],this[_0x846d('0xa')][_0x118787[_0x846d('0x28')]][_0x2ee740]['membername'],_0x2ee740);this['channels'][_0x118787[_0x846d('0x28')]][_0x2ee740][_0x846d('0x16')]=!![];this[_0x846d('0xa')][_0x118787['uniqueid']][_0x2ee740][_0x846d('0x62')]=moment()[_0x846d('0x2c')](_0x846d('0x2d'));this['channels'][_0x118787[_0x846d('0x28')]][_0x2ee740]['lastevent']=_0x846d('0x63');this[_0x846d('0xa')][_0x118787['uniqueid']][_0x2ee740][_0x846d('0x56')]=_0x118787['reason']=='transfer'?_0x846d('0x64'):_0x118787[_0x846d('0x56')];this[_0x846d('0xa')][_0x118787[_0x846d('0x28')]][_0x2ee740][_0x846d('0x65')]=_0x118787[_0x846d('0x65')];if(this[_0x846d('0xb')][_0x118787[_0x846d('0x2e')]]&&this['voiceQueues'][_0x118787['queue']]['acw']){this[_0x846d('0xa')][_0x118787[_0x846d('0x28')]][_0x2ee740][_0x846d('0x66')]=this[_0x846d('0xb')][_0x118787[_0x846d('0x2e')]][_0x846d('0x67')];this[_0x846d('0xa')][_0x118787[_0x846d('0x28')]][_0x2ee740][_0x846d('0x68')]=!![];}this[_0x846d('0xc')][_0x118787['interface']]=_[_0x846d('0x33')](this[_0x846d('0xc')][_0x118787[_0x846d('0x46')]],[_0x846d('0x2e'),_0x846d('0x69')]);logger['debug'](_0x846d('0x6a'),_0x118787[_0x846d('0x28')],util['inspect'](this[_0x846d('0xa')][_0x118787[_0x846d('0x28')]][_0x2ee740],{'showHidden':![],'depth':null}));ami[_0x846d('0x22')](_0x846d('0x6b'),this[_0x846d('0xa')][_0x118787[_0x846d('0x28')]][_0x2ee740]);logger[_0x846d('0x2b')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x118787[_0x846d('0x28')],util['inspect'](this[_0x846d('0xa')][_0x118787[_0x846d('0x28')]][_0x2ee740],{'showHidden':![],'depth':null}));this[_0x846d('0x22')](util[_0x846d('0x2c')](_0x846d('0x39'),_0x118787[_0x846d('0x29')]),_0x846d('0x6c'),this['channels'][_0x118787[_0x846d('0x28')]][_0x2ee740]);}}}}}}catch(_0x1dbb94){logger[_0x846d('0x59')]('[%s][voiceAgentReport][agentcomplete]',_0x118787[_0x846d('0x28')],util[_0x846d('0x36')](_0x1dbb94,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x846d('0x6d')]=function(_0x5acd5c){try{if(this[_0x846d('0x23')](_0x5acd5c)){logger[_0x846d('0x2b')](_0x846d('0x6e'),_0x5acd5c['uniqueid'],util[_0x846d('0x36')](_0x5acd5c,{'showHidden':![],'depth':null}));this['addVariable'](_0x5acd5c['uniqueid'],_[_0x846d('0x6f')](_0x5acd5c[_0x846d('0x70')])[0x0],_0x5acd5c[_0x846d('0x71')]);if(this[_0x846d('0xa')][_0x5acd5c[_0x846d('0x28')]]){for(var _0xfdbedc in this[_0x846d('0xa')][_0x5acd5c[_0x846d('0x28')]]){if(this[_0x846d('0xa')][_0x5acd5c[_0x846d('0x28')]][_0x846d('0x3d')](_0xfdbedc)){logger[_0x846d('0x26')](_0x846d('0x72'),_0x5acd5c['uniqueid'],_0xfdbedc,_[_0x846d('0x6f')](_0x5acd5c[_0x846d('0x70')])[0x0],_0x5acd5c[_0x846d('0x71')]);if(_[_0x846d('0x24')](this[_0x846d('0xa')][_0x5acd5c[_0x846d('0x28')]][_0xfdbedc][_0x846d('0xd')])){this[_0x846d('0xa')][_0x5acd5c[_0x846d('0x28')]][_0xfdbedc][_0x846d('0xd')]={};}this[_0x846d('0xa')][_0x5acd5c[_0x846d('0x28')]][_0xfdbedc][_0x846d('0xd')]=this[_0x846d('0xd')][_0x5acd5c[_0x846d('0x28')]];}}}}}catch(_0x3590a4){logger[_0x846d('0x59')](_0x846d('0x73'),_0x5acd5c[_0x846d('0x28')],util[_0x846d('0x36')](_0x3590a4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x846d('0x25')][_0x846d('0x74')]=function(_0x2a440a,_0x394492,_0x284705){var _0xd1f19b=['rtpaudioqos',_0x846d('0x75'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x846d('0x76'),_0x846d('0x77'),_0x846d('0x78'),_0x846d('0x79'),_0x846d('0x7a'),_0x846d('0x7b'),_0x846d('0x7c'),'bridgepvtcallid','membercalls',_0x846d('0x7d'),'memberinterface',_0x846d('0x7e'),_0x846d('0x29'),_0x846d('0x7f'),_0x846d('0x80')];if(!_[_0x846d('0x81')](_0x394492)&&!_[_0x846d('0x82')](_0xd1f19b,_0x394492)){if(_[_0x846d('0x24')](this[_0x846d('0xd')][_0x2a440a])){this['variables'][_0x2a440a]={};}this[_0x846d('0xd')][_0x2a440a][_0x394492]=_0x284705;}};VoiceAgentReport[_0x846d('0x25')][_0x846d('0x1a')]=function(_0x11de0a){try{if(this[_0x846d('0x23')](_0x11de0a)){logger[_0x846d('0x2b')](_0x846d('0x83'),_0x11de0a[_0x846d('0x28')],util[_0x846d('0x36')](_0x11de0a,{'showHidden':![],'depth':null}));if(this[_0x846d('0xa')][_0x11de0a['uniqueid']]){for(var _0x3bb4a7 in this['channels'][_0x11de0a[_0x846d('0x28')]]){if(this[_0x846d('0xa')][_0x11de0a[_0x846d('0x28')]][_0x846d('0x3d')](_0x3bb4a7)){if(this[_0x846d('0xa')][_0x11de0a[_0x846d('0x28')]][_0x3bb4a7][_0x846d('0x56')]==_0x846d('0x84')&&this[_0x846d('0xa')][_0x11de0a['uniqueid']][_0x3bb4a7][_0x846d('0x16')]){logger[_0x846d('0x26')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x11de0a[_0x846d('0x28')],_0x3bb4a7);this['channels'][_0x11de0a[_0x846d('0x28')]][_0x3bb4a7][_0x846d('0x62')]=moment()[_0x846d('0x2c')](_0x846d('0x2d'));}}}logger[_0x846d('0x2b')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x11de0a[_0x846d('0x28')],util[_0x846d('0x36')](_[_0x846d('0x85')](this[_0x846d('0xa')][_0x11de0a[_0x846d('0x28')]]),{'showHidden':![],'depth':null}));ami['emit'](_0x846d('0x86'),_[_0x846d('0x85')](this[_0x846d('0xa')][_0x11de0a['uniqueid']]));delete this[_0x846d('0xa')][_0x11de0a[_0x846d('0x28')]];}if(this[_0x846d('0xd')][_0x11de0a[_0x846d('0x28')]]){delete this[_0x846d('0xd')][_0x11de0a[_0x846d('0x28')]];}}}catch(_0x493b2b){logger['error'](_0x846d('0x87'),_0x11de0a[_0x846d('0x28')],util[_0x846d('0x36')](_0x493b2b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x846d('0x25')][_0x846d('0x20')]=function(_0x43d1e4){try{if(this['isNotNull'](_0x43d1e4)){logger[_0x846d('0x2b')](_0x846d('0x88'),_0x43d1e4['uniqueid'],util[_0x846d('0x36')](_0x43d1e4,{'showHidden':![],'depth':null}));if(this['channels'][_0x43d1e4[_0x846d('0x89')]]){for(var _0x4778de in this[_0x846d('0xa')][_0x43d1e4[_0x846d('0x89')]]){if(this[_0x846d('0xa')][_0x43d1e4[_0x846d('0x89')]][_0x846d('0x3d')](_0x4778de)){if(_0x43d1e4[_0x846d('0x8a')]===_0x4778de){logger['info'](_0x846d('0x8b'),_0x43d1e4[_0x846d('0x28')],this[_0x846d('0xa')][_0x43d1e4['transfereeuniqueid']][_0x4778de][_0x846d('0x29')],_0x4778de);var _0x46a2bc=moment();this[_0x846d('0xa')][_0x43d1e4['transfereeuniqueid']][_0x4778de][_0x846d('0x16')]=!![];this[_0x846d('0xa')][_0x43d1e4[_0x846d('0x89')]][_0x4778de]['agentcompleteAt']=moment()[_0x846d('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x43d1e4[_0x846d('0x89')]][_0x4778de][_0x846d('0x45')]=_0x846d('0x63');this['channels'][_0x43d1e4[_0x846d('0x89')]][_0x4778de][_0x846d('0x56')]=_0x846d('0x84');this[_0x846d('0xa')][_0x43d1e4[_0x846d('0x89')]][_0x4778de]['talktime']=_0x46a2bc[_0x846d('0x8c')](this[_0x846d('0xa')][_0x43d1e4[_0x846d('0x89')]][_0x4778de][_0x846d('0x3f')],_0x846d('0x8d'));}}}}if(this['channels'][_0x43d1e4[_0x846d('0x8e')]]){var _0x949058=this[_0x846d('0xa')][_0x43d1e4['secondtransfereruniqueid']];this[_0x846d('0xa')][_0x43d1e4['secondtransfereruniqueid']]=this[_0x846d('0xa')][_0x43d1e4[_0x846d('0x89')]];this[_0x846d('0xa')][_0x43d1e4[_0x846d('0x89')]]=_0x949058;}}}catch(_0x1a2f58){logger[_0x846d('0x59')](_0x846d('0x8f'),_0x43d1e4['uniqueid'],util[_0x846d('0x36')](_0x1a2f58,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x846d('0x25')][_0x846d('0x21')]=function(_0x1b763e){try{if(this[_0x846d('0x23')](_0x1b763e)){logger[_0x846d('0x2b')](_0x846d('0x90'),_0x1b763e[_0x846d('0x28')],util[_0x846d('0x36')](_0x1b763e,{'showHidden':![],'depth':null}));if(this[_0x846d('0xa')][_0x1b763e[_0x846d('0x89')]]){for(var _0x5782ac in this['channels'][_0x1b763e[_0x846d('0x89')]]){if(this[_0x846d('0xa')][_0x1b763e[_0x846d('0x89')]]['hasOwnProperty'](_0x5782ac)){if(_0x1b763e[_0x846d('0x91')]===_0x5782ac){logger[_0x846d('0x26')](_0x846d('0x92'),_0x1b763e[_0x846d('0x28')],this[_0x846d('0xa')][_0x1b763e[_0x846d('0x89')]][_0x5782ac][_0x846d('0x29')],_0x5782ac);var _0x46f072=moment();this[_0x846d('0xa')][_0x1b763e[_0x846d('0x89')]][_0x5782ac][_0x846d('0x16')]=!![];this[_0x846d('0xa')][_0x1b763e[_0x846d('0x89')]][_0x5782ac][_0x846d('0x62')]=_0x46f072;this['channels'][_0x1b763e['transfereeuniqueid']][_0x5782ac]['lastevent']=_0x846d('0x63');this[_0x846d('0xa')][_0x1b763e[_0x846d('0x89')]][_0x5782ac][_0x846d('0x56')]=_0x846d('0x84');this[_0x846d('0xa')][_0x1b763e[_0x846d('0x89')]][_0x5782ac]['talktime']=_0x46f072['diff'](this[_0x846d('0xa')][_0x1b763e[_0x846d('0x89')]][_0x5782ac][_0x846d('0x3f')],'seconds');}}}}}}catch(_0x54fc00){logger['error'](_0x846d('0x93'),_0x1b763e[_0x846d('0x28')],util[_0x846d('0x36')](_0x54fc00,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x846d('0x1c')]=function(_0x5e9f43){var _0x261838='';try{if(this[_0x846d('0x23')](_0x5e9f43)){logger[_0x846d('0x2b')](_0x846d('0x94'),_0x5e9f43['uniqueid'],util[_0x846d('0x36')](_0x5e9f43,{'showHidden':![],'depth':null}));if(_0x5e9f43['channel']){_0x261838=_0x5e9f43[_0x846d('0x95')][_0x846d('0x96')](0x0,_0x5e9f43['channel'][_0x846d('0x97')]('-'));if(this['agents'][_0x261838]){logger[_0x846d('0x26')](_0x846d('0x98'),_0x5e9f43['uniqueid'],_0x261838);this['agents'][_0x261838][_0x846d('0x99')]=!![];}}}}catch(_0xc86b77){logger[_0x846d('0x59')](_0x846d('0x9a'),_0x5e9f43['uniqueid'],util[_0x846d('0x36')](_0xc86b77,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x846d('0x1e')]=function(_0x4db032){var _0x548e8b='';try{if(this[_0x846d('0x23')](_0x4db032)){logger['debug']('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x4db032[_0x846d('0x28')],util[_0x846d('0x36')](_0x4db032,{'showHidden':![],'depth':null}));if(_0x4db032[_0x846d('0x95')]){_0x548e8b=_0x4db032[_0x846d('0x95')][_0x846d('0x96')](0x0,_0x4db032['channel'][_0x846d('0x97')]('-'));if(this['agents'][_0x548e8b]){logger['info'](_0x846d('0x9b'),_0x4db032[_0x846d('0x28')],_0x548e8b);this[_0x846d('0xc')][_0x548e8b]['onhold']=![];}}}}catch(_0x1388ea){logger[_0x846d('0x59')](_0x846d('0x9c'),_0x4db032['uniqueid'],util[_0x846d('0x36')](_0x1388ea,{'showHidden':![],'depth':null}));}};module[_0x846d('0x9d')]=VoiceAgentReport; \ No newline at end of file +var _0x3369=['agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','varset','syncVarSet','hangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','omit','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','inspect','[%s][voiceAgentReport][agentconnect]\x20event:','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','lastevent','answered_elsewhere','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','user:agentcomplete','addVariable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','variable','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','memberdynamic','memberlastcall','isNil','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','agentcompleteAt','custom:voiceAgentReport','values','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','lodash','moment','util','../../../config/environment','../ami','redis','defaults','localhost','socket.io-emitter','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect'];(function(_0x50947a,_0x3c4ec2){var _0x3a01cc=function(_0x37d6ad){while(--_0x37d6ad){_0x50947a['push'](_0x50947a['shift']());}};_0x3a01cc(++_0x3c4ec2);}(_0x3369,0x123));var _0x9336=function(_0x367c07,_0x1fe766){_0x367c07=_0x367c07-0x0;var _0x12aab2=_0x3369[_0x367c07];return _0x12aab2;};'use strict';var _=require(_0x9336('0x0'));var moment=require(_0x9336('0x1'));var util=require(_0x9336('0x2'));var Redis=require('ioredis');var config=require(_0x9336('0x3'));var logger=require('../../../config/logger')('ami');var ami=require(_0x9336('0x4'));config[_0x9336('0x5')]=_[_0x9336('0x6')](config['redis'],{'host':_0x9336('0x7'),'port':0x18eb});var io=require(_0x9336('0x8'))(new Redis(config[_0x9336('0x5')]));function VoiceAgentReport(_0x12aef9){this['channels']={};this['voiceQueues']=_0x12aef9[_0x9336('0x9')];this[_0x9336('0xa')]=_0x12aef9[_0x9336('0xa')];this[_0x9336('0xb')]={};ami['on'](_0x9336('0xc'),this[_0x9336('0xd')][_0x9336('0xe')](this));ami['on'](_0x9336('0xf'),this[_0x9336('0x10')][_0x9336('0xe')](this));ami['on'](_0x9336('0x11'),this[_0x9336('0x12')][_0x9336('0xe')](this));ami['on'](_0x9336('0x13'),this['syncQueueCallerAbandon'][_0x9336('0xe')](this));ami['on'](_0x9336('0x14'),this['syncAgentComplete']['bind'](this));ami['on'](_0x9336('0x15'),this[_0x9336('0x16')]['bind'](this));ami['on'](_0x9336('0x17'),this['syncHangup'][_0x9336('0xe')](this));ami['on'](_0x9336('0x18'),this[_0x9336('0x19')][_0x9336('0xe')](this));ami['on'](_0x9336('0x1a'),this['syncMusicOnHoldStop']['bind'](this));ami['on'](_0x9336('0x1b'),this[_0x9336('0x1c')][_0x9336('0xe')](this));ami['on']('blindtransfer',this[_0x9336('0x1d')][_0x9336('0xe')](this));}VoiceAgentReport[_0x9336('0x1e')][_0x9336('0x1f')]=function(_0x7d565d,_0x2ba769,_0x1c17c9){io['to'](_0x7d565d)[_0x9336('0x1f')](_0x2ba769,_0x1c17c9);};VoiceAgentReport[_0x9336('0x1e')][_0x9336('0x20')]=function(_0x25591d){return _0x25591d!==null&&!_[_0x9336('0x21')](_0x25591d);};VoiceAgentReport['prototype'][_0x9336('0xd')]=function(_0x44c3ec){try{if(this[_0x9336('0x20')](_0x44c3ec)){logger['info'](_0x9336('0x22'),_0x44c3ec[_0x9336('0x23')],_0x44c3ec[_0x9336('0x24')],_0x44c3ec[_0x9336('0x25')]);logger[_0x9336('0x26')](_0x9336('0x27'),_0x44c3ec[_0x9336('0x23')],util['inspect'](_0x44c3ec,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x9336('0x28')][_0x44c3ec[_0x9336('0x23')]])){this[_0x9336('0x28')][_0x44c3ec[_0x9336('0x23')]]={};}if(_[_0x9336('0x21')](this['channels'][_0x44c3ec['uniqueid']][_0x44c3ec[_0x9336('0x25')]])){this[_0x9336('0x28')][_0x44c3ec[_0x9336('0x23')]][_0x44c3ec[_0x9336('0x25')]]={'agentcalledAt':moment()[_0x9336('0x29')](_0x9336('0x2a')),'lastevent':_0x9336('0x2b'),'mandatoryDisposition':this[_0x9336('0x9')][_0x44c3ec['queue']]?this[_0x9336('0x9')][_0x44c3ec[_0x9336('0x2c')]]['mandatoryDisposition']||![]:![],'type':this[_0x9336('0x9')][_0x44c3ec[_0x9336('0x2c')]]?this['voiceQueues'][_0x44c3ec[_0x9336('0x2c')]][_0x9336('0x2d')]||'inbound':_0x9336('0x2e'),'variables':this[_0x9336('0xb')][_0x44c3ec['uniqueid']]};}_[_0x9336('0x2f')](this[_0x9336('0x28')][_0x44c3ec[_0x9336('0x23')]][_0x44c3ec[_0x9336('0x25')]],_[_0x9336('0x30')](_0x44c3ec,['event','privilege']));logger[_0x9336('0x26')](_0x9336('0x31'),_0x44c3ec[_0x9336('0x23')],util['inspect'](this[_0x9336('0x28')][_0x44c3ec[_0x9336('0x23')]][_0x44c3ec[_0x9336('0x25')]],{'showHidden':![],'depth':null}));ami[_0x9336('0x1f')](_0x9336('0x32'),this['channels'][_0x44c3ec['uniqueid']][_0x44c3ec['destuniqueid']]);logger[_0x9336('0x26')](_0x9336('0x33'),_0x44c3ec['uniqueid'],util['inspect'](this[_0x9336('0x28')][_0x44c3ec[_0x9336('0x23')]][_0x44c3ec[_0x9336('0x25')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x9336('0x29')](_0x9336('0x34'),_0x44c3ec[_0x9336('0x24')]),_0x9336('0x35'),this[_0x9336('0x28')][_0x44c3ec[_0x9336('0x23')]][_0x44c3ec[_0x9336('0x25')]]);}}catch(_0x191f4e){logger[_0x9336('0x36')](_0x9336('0x37'),_0x44c3ec[_0x9336('0x23')],util[_0x9336('0x38')](_0x191f4e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9336('0x1e')][_0x9336('0x10')]=function(_0x21b930){try{if(this[_0x9336('0x20')](_0x21b930)){if(this[_0x9336('0x28')][_0x21b930[_0x9336('0x23')]]){logger[_0x9336('0x26')](_0x9336('0x39'),_0x21b930[_0x9336('0x23')],util[_0x9336('0x38')](_0x21b930,{'showHidden':![],'depth':null}));for(var _0x773598 in this[_0x9336('0x28')][_0x21b930[_0x9336('0x23')]]){if(this['channels'][_0x21b930['uniqueid']]['hasOwnProperty'](_0x773598)){if(_0x21b930[_0x9336('0x25')]===_0x773598){logger[_0x9336('0x3a')](_0x9336('0x3b'),_0x21b930[_0x9336('0x23')],_0x21b930['membername'],_0x21b930['destuniqueid']);this[_0x9336('0x28')][_0x21b930['uniqueid']][_0x773598][_0x9336('0x3c')]=moment()[_0x9336('0x29')](_0x9336('0x2a'));this[_0x9336('0x28')][_0x21b930['uniqueid']][_0x773598][_0x9336('0x3d')]=_0x21b930['connectedlinename'];this[_0x9336('0x28')][_0x21b930[_0x9336('0x23')]][_0x773598][_0x9336('0x3e')]=_0x21b930['connectedlinenum'];this['channels'][_0x21b930[_0x9336('0x23')]][_0x773598][_0x9336('0x3f')]=_0x21b930['destchannelstate'];this[_0x9336('0x28')][_0x21b930[_0x9336('0x23')]][_0x773598][_0x9336('0x40')]=_0x21b930[_0x9336('0x40')];this[_0x9336('0x28')][_0x21b930[_0x9336('0x23')]][_0x773598][_0x9336('0x41')]=_0x21b930[_0x9336('0x41')];this['channels'][_0x21b930[_0x9336('0x23')]][_0x773598]['lastevent']=_0x9336('0x42');_[_0x9336('0x2f')](this[_0x9336('0xa')][_0x21b930[_0x9336('0x43')]],_[_0x9336('0x44')](_0x21b930,['queue',_0x9336('0x45')]));logger['debug'](_0x9336('0x46'),_0x21b930[_0x9336('0x23')],util[_0x9336('0x38')](this[_0x9336('0x28')][_0x21b930[_0x9336('0x23')]][_0x21b930[_0x9336('0x25')]],{'showHidden':![],'depth':null}));ami[_0x9336('0x1f')](_0x9336('0x47'),this['channels'][_0x21b930[_0x9336('0x23')]][_0x21b930[_0x9336('0x25')]]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x21b930[_0x9336('0x23')],util[_0x9336('0x38')](this[_0x9336('0x28')][_0x21b930['uniqueid']][_0x21b930[_0x9336('0x25')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x9336('0x29')](_0x9336('0x34'),_0x21b930[_0x9336('0x24')]),_0x9336('0x48'),this[_0x9336('0x28')][_0x21b930[_0x9336('0x23')]][_0x21b930[_0x9336('0x25')]]);}else if(!this[_0x9336('0x28')][_0x21b930[_0x9336('0x23')]][_0x773598][_0x9336('0x11')]&&!this['channels'][_0x21b930[_0x9336('0x23')]][_0x773598]['agentcomplete']){logger['info'](_0x9336('0x49'),_0x21b930[_0x9336('0x23')],this[_0x9336('0x28')][_0x21b930['uniqueid']][_0x773598][_0x9336('0x24')],_0x773598);this[_0x9336('0x28')][_0x21b930[_0x9336('0x23')]][_0x773598][_0x9336('0x11')]=!![];this[_0x9336('0x28')][_0x21b930['uniqueid']][_0x773598][_0x9336('0x4a')]=moment()['format'](_0x9336('0x2a'));this[_0x9336('0x28')][_0x21b930[_0x9336('0x23')]][_0x773598][_0x9336('0x4b')]=_0x21b930[_0x9336('0x25')];this[_0x9336('0x28')][_0x21b930[_0x9336('0x23')]][_0x773598][_0x9336('0x4c')]=_0x21b930['membername'];this['channels'][_0x21b930[_0x9336('0x23')]][_0x773598][_0x9336('0x4d')]=_0x9336('0x4e');this[_0x9336('0x28')][_0x21b930['uniqueid']][_0x773598][_0x9336('0x4f')]='answered_elsewhere';logger[_0x9336('0x26')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x21b930[_0x9336('0x23')],util[_0x9336('0x38')](this[_0x9336('0x28')][_0x21b930[_0x9336('0x23')]][_0x773598],{'showHidden':![],'depth':null}));ami[_0x9336('0x1f')](_0x9336('0x50'),this[_0x9336('0x28')][_0x21b930[_0x9336('0x23')]][_0x773598]);}}}}}}catch(_0x547c33){logger['error'](_0x9336('0x51'),_0x21b930[_0x9336('0x23')],util[_0x9336('0x38')](_0x547c33,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9336('0x12')]=function(_0x31734d){try{if(this['isNotNull'](_0x31734d)){logger[_0x9336('0x26')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x31734d[_0x9336('0x23')],util[_0x9336('0x38')](_0x31734d,{'showHidden':![],'depth':null}));if(this[_0x9336('0x28')][_0x31734d[_0x9336('0x23')]]&&this[_0x9336('0x28')][_0x31734d[_0x9336('0x23')]][_0x31734d[_0x9336('0x25')]]){logger['info'](_0x9336('0x52'),_0x31734d[_0x9336('0x23')],_0x31734d[_0x9336('0x24')],_0x31734d[_0x9336('0x25')]);this[_0x9336('0x28')][_0x31734d['uniqueid']][_0x31734d[_0x9336('0x25')]][_0x9336('0x11')]=!![];this[_0x9336('0x28')][_0x31734d[_0x9336('0x23')]][_0x31734d[_0x9336('0x25')]][_0x9336('0x4a')]=moment()[_0x9336('0x29')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x9336('0x28')][_0x31734d[_0x9336('0x23')]][_0x31734d[_0x9336('0x25')]][_0x9336('0x4d')]=_0x9336('0x53');this[_0x9336('0x28')][_0x31734d[_0x9336('0x23')]][_0x31734d['destuniqueid']]['reason']=_0x9336('0x53');logger[_0x9336('0x26')](_0x9336('0x54'),_0x31734d[_0x9336('0x23')],util[_0x9336('0x38')](this[_0x9336('0x28')][_0x31734d['uniqueid']][_0x31734d['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x9336('0x55'),this['channels'][_0x31734d[_0x9336('0x23')]][_0x31734d[_0x9336('0x25')]]);}}}catch(_0x5b5b90){logger['error'](_0x9336('0x56'),_0x31734d[_0x9336('0x23')],util[_0x9336('0x38')](_0x5b5b90,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9336('0x57')]=function(_0x475dc5){try{if(this['isNotNull'](_0x475dc5)){logger[_0x9336('0x26')](_0x9336('0x58'),_0x475dc5[_0x9336('0x23')],util[_0x9336('0x38')](_0x475dc5,{'showHidden':![],'depth':null}));if(this[_0x9336('0x28')][_0x475dc5['uniqueid']]){for(var _0x136da6 in this['channels'][_0x475dc5[_0x9336('0x23')]]){if(this[_0x9336('0x28')][_0x475dc5[_0x9336('0x23')]][_0x9336('0x59')](_0x136da6)&&!this[_0x9336('0x28')][_0x475dc5[_0x9336('0x23')]][_0x136da6][_0x9336('0x11')]&&!this[_0x9336('0x28')][_0x475dc5['uniqueid']][_0x136da6][_0x9336('0x14')]){logger[_0x9336('0x3a')](_0x9336('0x5a'),_0x475dc5[_0x9336('0x23')],this[_0x9336('0x28')][_0x475dc5[_0x9336('0x23')]][_0x136da6]['membername'],_0x136da6);this[_0x9336('0x28')][_0x475dc5[_0x9336('0x23')]][_0x136da6]['agentringnoanswer']=!![];this['channels'][_0x475dc5['uniqueid']][_0x136da6]['agentringnoanswerAt']=moment()['format'](_0x9336('0x2a'));this[_0x9336('0x28')][_0x475dc5[_0x9336('0x23')]][_0x136da6][_0x9336('0x4d')]=_0x9336('0x5b');this[_0x9336('0x28')][_0x475dc5['uniqueid']][_0x136da6][_0x9336('0x4f')]=_0x9336('0x5b');logger['debug'](_0x9336('0x5c'),_0x475dc5['uniqueid'],util[_0x9336('0x38')](this[_0x9336('0x28')][_0x475dc5[_0x9336('0x23')]][_0x136da6],{'showHidden':![],'depth':null}));ami[_0x9336('0x1f')](_0x9336('0x5d'),this[_0x9336('0x28')][_0x475dc5[_0x9336('0x23')]][_0x136da6]);}}}}}catch(_0x3df3b4){logger[_0x9336('0x36')](_0x9336('0x5e'),_0x475dc5[_0x9336('0x23')],util[_0x9336('0x38')](_0x3df3b4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9336('0x1e')][_0x9336('0x5f')]=function(_0x316c0f){try{if(this['isNotNull'](_0x316c0f)){logger['debug'](_0x9336('0x60'),_0x316c0f[_0x9336('0x23')],util['inspect'](_0x316c0f,{'showHidden':![],'depth':null}));if(this['channels'][_0x316c0f[_0x9336('0x23')]]){for(var _0x1c7775 in this[_0x9336('0x28')][_0x316c0f[_0x9336('0x23')]]){if(this[_0x9336('0x28')][_0x316c0f['uniqueid']][_0x9336('0x59')](_0x1c7775)){if(this['channels'][_0x316c0f['uniqueid']][_0x1c7775][_0x9336('0x3c')]&&!this[_0x9336('0x28')][_0x316c0f[_0x9336('0x23')]][_0x1c7775]['agentcomplete']){logger['info'](_0x9336('0x61'),_0x316c0f['uniqueid'],this['channels'][_0x316c0f[_0x9336('0x23')]][_0x1c7775]['membername'],_0x1c7775);this['channels'][_0x316c0f[_0x9336('0x23')]][_0x1c7775]['agentcomplete']=!![];this['channels'][_0x316c0f[_0x9336('0x23')]][_0x1c7775]['agentcompleteAt']=moment()[_0x9336('0x29')](_0x9336('0x2a'));this[_0x9336('0x28')][_0x316c0f[_0x9336('0x23')]][_0x1c7775][_0x9336('0x4d')]=_0x9336('0x62');this[_0x9336('0x28')][_0x316c0f[_0x9336('0x23')]][_0x1c7775][_0x9336('0x4f')]=_0x316c0f[_0x9336('0x4f')]==_0x9336('0x63')?_0x9336('0x64'):_0x316c0f[_0x9336('0x4f')];this[_0x9336('0x28')][_0x316c0f[_0x9336('0x23')]][_0x1c7775][_0x9336('0x65')]=_0x316c0f[_0x9336('0x65')];if(this[_0x9336('0x9')][_0x316c0f[_0x9336('0x2c')]]&&this[_0x9336('0x9')][_0x316c0f['queue']][_0x9336('0x66')]){this['channels'][_0x316c0f['uniqueid']][_0x1c7775][_0x9336('0x67')]=this[_0x9336('0x9')][_0x316c0f[_0x9336('0x2c')]][_0x9336('0x68')];this[_0x9336('0x28')][_0x316c0f[_0x9336('0x23')]][_0x1c7775][_0x9336('0x69')]=!![];}this[_0x9336('0xa')][_0x316c0f['interface']]=_[_0x9336('0x30')](this[_0x9336('0xa')][_0x316c0f['interface']],['queue','destconnectedlinenum']);logger['debug'](_0x9336('0x6a'),_0x316c0f[_0x9336('0x23')],util[_0x9336('0x38')](this['channels'][_0x316c0f[_0x9336('0x23')]][_0x1c7775],{'showHidden':![],'depth':null}));ami[_0x9336('0x1f')](_0x9336('0x6b'),this['channels'][_0x316c0f[_0x9336('0x23')]][_0x1c7775]);logger[_0x9336('0x26')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x316c0f['uniqueid'],util[_0x9336('0x38')](this[_0x9336('0x28')][_0x316c0f[_0x9336('0x23')]][_0x1c7775],{'showHidden':![],'depth':null}));this[_0x9336('0x1f')](util[_0x9336('0x29')]('user:%s',_0x316c0f[_0x9336('0x24')]),_0x9336('0x6c'),this[_0x9336('0x28')][_0x316c0f[_0x9336('0x23')]][_0x1c7775]);}}}}}}catch(_0x3ae075){logger[_0x9336('0x36')]('[%s][voiceAgentReport][agentcomplete]',_0x316c0f[_0x9336('0x23')],util[_0x9336('0x38')](_0x3ae075,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9336('0x1e')]['syncVarSet']=function(_0x36582e){try{if(this[_0x9336('0x20')](_0x36582e)){logger['debug']('[%s][voiceAgentReport][varset]\x20event:',_0x36582e['uniqueid'],util[_0x9336('0x38')](_0x36582e,{'showHidden':![],'depth':null}));this[_0x9336('0x6d')](_0x36582e[_0x9336('0x23')],_['keys'](_0x36582e['variable'])[0x0],_0x36582e[_0x9336('0x6e')]);if(this[_0x9336('0x28')][_0x36582e[_0x9336('0x23')]]){for(var _0x4ecb92 in this['channels'][_0x36582e[_0x9336('0x23')]]){if(this[_0x9336('0x28')][_0x36582e[_0x9336('0x23')]]['hasOwnProperty'](_0x4ecb92)){logger['info'](_0x9336('0x6f'),_0x36582e[_0x9336('0x23')],_0x4ecb92,_[_0x9336('0x70')](_0x36582e[_0x9336('0x71')])[0x0],_0x36582e['value']);if(_['isUndefined'](this['channels'][_0x36582e[_0x9336('0x23')]][_0x4ecb92][_0x9336('0xb')])){this[_0x9336('0x28')][_0x36582e[_0x9336('0x23')]][_0x4ecb92][_0x9336('0xb')]={};}this['channels'][_0x36582e[_0x9336('0x23')]][_0x4ecb92]['variables']=this['variables'][_0x36582e[_0x9336('0x23')]];}}}}}catch(_0x712381){logger['error'](_0x9336('0x72'),_0x36582e[_0x9336('0x23')],util[_0x9336('0x38')](_0x712381,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9336('0x1e')][_0x9336('0x6d')]=function(_0x53245b,_0x111d43,_0x32fa5b){var _0x4d87ba=[_0x9336('0x73'),_0x9336('0x74'),_0x9336('0x75'),_0x9336('0x76'),_0x9336('0x77'),'rtpaudioqoslossbridged',_0x9336('0x78'),_0x9336('0x79'),_0x9336('0x7a'),_0x9336('0x7b'),_0x9336('0x7c'),'bridgepvtcallid','membercalls',_0x9336('0x7d'),'memberinterface',_0x9336('0x7e'),_0x9336('0x24'),'memberpenalty','memberrealtime'];if(!_[_0x9336('0x7f')](_0x111d43)&&!_[_0x9336('0x80')](_0x4d87ba,_0x111d43)){if(_[_0x9336('0x21')](this[_0x9336('0xb')][_0x53245b])){this['variables'][_0x53245b]={};}this['variables'][_0x53245b][_0x111d43]=_0x32fa5b;}};VoiceAgentReport[_0x9336('0x1e')][_0x9336('0x81')]=function(_0x4452ba){try{if(this['isNotNull'](_0x4452ba)){logger[_0x9336('0x26')](_0x9336('0x82'),_0x4452ba['uniqueid'],util[_0x9336('0x38')](_0x4452ba,{'showHidden':![],'depth':null}));if(this[_0x9336('0x28')][_0x4452ba[_0x9336('0x23')]]){for(var _0x4a9eb7 in this[_0x9336('0x28')][_0x4452ba['uniqueid']]){if(this[_0x9336('0x28')][_0x4452ba['uniqueid']][_0x9336('0x59')](_0x4a9eb7)){if(this[_0x9336('0x28')][_0x4452ba[_0x9336('0x23')]][_0x4a9eb7][_0x9336('0x4f')]==_0x9336('0x63')&&this['channels'][_0x4452ba[_0x9336('0x23')]][_0x4a9eb7][_0x9336('0x14')]){logger[_0x9336('0x3a')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4452ba['uniqueid'],_0x4a9eb7);this[_0x9336('0x28')][_0x4452ba[_0x9336('0x23')]][_0x4a9eb7][_0x9336('0x83')]=moment()[_0x9336('0x29')](_0x9336('0x2a'));}}}logger[_0x9336('0x26')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x4452ba['uniqueid'],util[_0x9336('0x38')](_['values'](this[_0x9336('0x28')][_0x4452ba[_0x9336('0x23')]]),{'showHidden':![],'depth':null}));ami[_0x9336('0x1f')](_0x9336('0x84'),_[_0x9336('0x85')](this[_0x9336('0x28')][_0x4452ba[_0x9336('0x23')]]));delete this[_0x9336('0x28')][_0x4452ba[_0x9336('0x23')]];}if(this[_0x9336('0xb')][_0x4452ba['uniqueid']]){delete this[_0x9336('0xb')][_0x4452ba[_0x9336('0x23')]];}}}catch(_0x2b6f84){logger[_0x9336('0x36')]('[%s][voiceAgentReport][hangup]',_0x4452ba[_0x9336('0x23')],util['inspect'](_0x2b6f84,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9336('0x1e')][_0x9336('0x1c')]=function(_0x6b471c){try{if(this[_0x9336('0x20')](_0x6b471c)){logger['debug'](_0x9336('0x86'),_0x6b471c['uniqueid'],util['inspect'](_0x6b471c,{'showHidden':![],'depth':null}));if(this[_0x9336('0x28')][_0x6b471c[_0x9336('0x87')]]){for(var _0xca3eac in this[_0x9336('0x28')][_0x6b471c[_0x9336('0x87')]]){if(this[_0x9336('0x28')][_0x6b471c[_0x9336('0x87')]][_0x9336('0x59')](_0xca3eac)){if(_0x6b471c[_0x9336('0x88')]===_0xca3eac){logger[_0x9336('0x3a')](_0x9336('0x89'),_0x6b471c[_0x9336('0x23')],this[_0x9336('0x28')][_0x6b471c[_0x9336('0x87')]][_0xca3eac][_0x9336('0x24')],_0xca3eac);var _0x20514b=moment();this['channels'][_0x6b471c[_0x9336('0x87')]][_0xca3eac][_0x9336('0x14')]=!![];this[_0x9336('0x28')][_0x6b471c[_0x9336('0x87')]][_0xca3eac][_0x9336('0x83')]=moment()[_0x9336('0x29')](_0x9336('0x2a'));this['channels'][_0x6b471c['transfereeuniqueid']][_0xca3eac][_0x9336('0x4d')]=_0x9336('0x62');this[_0x9336('0x28')][_0x6b471c['transfereeuniqueid']][_0xca3eac][_0x9336('0x4f')]='transfer';this[_0x9336('0x28')][_0x6b471c['transfereeuniqueid']][_0xca3eac]['talktime']=_0x20514b['diff'](this[_0x9336('0x28')][_0x6b471c[_0x9336('0x87')]][_0xca3eac][_0x9336('0x3c')],_0x9336('0x8a'));}}}}if(this[_0x9336('0x28')][_0x6b471c['secondtransfereruniqueid']]){var _0x575686=this[_0x9336('0x28')][_0x6b471c['secondtransfereruniqueid']];this['channels'][_0x6b471c[_0x9336('0x8b')]]=this[_0x9336('0x28')][_0x6b471c[_0x9336('0x87')]];this[_0x9336('0x28')][_0x6b471c['transfereeuniqueid']]=_0x575686;}}}catch(_0x346e8c){logger[_0x9336('0x36')](_0x9336('0x8c'),_0x6b471c['uniqueid'],util['inspect'](_0x346e8c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9336('0x1d')]=function(_0xc91856){try{if(this[_0x9336('0x20')](_0xc91856)){logger[_0x9336('0x26')](_0x9336('0x8d'),_0xc91856[_0x9336('0x23')],util[_0x9336('0x38')](_0xc91856,{'showHidden':![],'depth':null}));if(this['channels'][_0xc91856[_0x9336('0x87')]]){for(var _0x41521e in this['channels'][_0xc91856[_0x9336('0x87')]]){if(this[_0x9336('0x28')][_0xc91856[_0x9336('0x87')]][_0x9336('0x59')](_0x41521e)){if(_0xc91856[_0x9336('0x8e')]===_0x41521e){logger[_0x9336('0x3a')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xc91856[_0x9336('0x23')],this[_0x9336('0x28')][_0xc91856[_0x9336('0x87')]][_0x41521e][_0x9336('0x24')],_0x41521e);var _0x40b9bb=moment();this[_0x9336('0x28')][_0xc91856[_0x9336('0x87')]][_0x41521e][_0x9336('0x14')]=!![];this[_0x9336('0x28')][_0xc91856[_0x9336('0x87')]][_0x41521e]['agentcompleteAt']=_0x40b9bb;this[_0x9336('0x28')][_0xc91856[_0x9336('0x87')]][_0x41521e][_0x9336('0x4d')]='complete';this[_0x9336('0x28')][_0xc91856[_0x9336('0x87')]][_0x41521e]['reason']=_0x9336('0x63');this[_0x9336('0x28')][_0xc91856[_0x9336('0x87')]][_0x41521e][_0x9336('0x65')]=_0x40b9bb['diff'](this[_0x9336('0x28')][_0xc91856['transfereeuniqueid']][_0x41521e][_0x9336('0x3c')],'seconds');}}}}}}catch(_0x564504){logger[_0x9336('0x36')](_0x9336('0x8f'),_0xc91856['uniqueid'],util[_0x9336('0x38')](_0x564504,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9336('0x1e')]['syncMusicOnHoldStart']=function(_0x4be1bd){var _0x42357a='';try{if(this[_0x9336('0x20')](_0x4be1bd)){logger['debug'](_0x9336('0x90'),_0x4be1bd[_0x9336('0x23')],util['inspect'](_0x4be1bd,{'showHidden':![],'depth':null}));if(_0x4be1bd[_0x9336('0x91')]){_0x42357a=_0x4be1bd['channel'][_0x9336('0x92')](0x0,_0x4be1bd[_0x9336('0x91')][_0x9336('0x93')]('-'));if(this[_0x9336('0xa')][_0x42357a]){logger[_0x9336('0x3a')](_0x9336('0x94'),_0x4be1bd[_0x9336('0x23')],_0x42357a);this[_0x9336('0xa')][_0x42357a][_0x9336('0x95')]=!![];}}}}catch(_0x27a506){logger[_0x9336('0x36')](_0x9336('0x96'),_0x4be1bd[_0x9336('0x23')],util['inspect'](_0x27a506,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9336('0x97')]=function(_0x499195){var _0x278321='';try{if(this[_0x9336('0x20')](_0x499195)){logger[_0x9336('0x26')](_0x9336('0x98'),_0x499195['uniqueid'],util['inspect'](_0x499195,{'showHidden':![],'depth':null}));if(_0x499195[_0x9336('0x91')]){_0x278321=_0x499195[_0x9336('0x91')]['substring'](0x0,_0x499195[_0x9336('0x91')][_0x9336('0x93')]('-'));if(this[_0x9336('0xa')][_0x278321]){logger[_0x9336('0x3a')](_0x9336('0x99'),_0x499195['uniqueid'],_0x278321);this['agents'][_0x278321][_0x9336('0x95')]=![];}}}}catch(_0xaae32){logger[_0x9336('0x36')]('[%s][voiceAgentReport][musiconholdstop]',_0x499195[_0x9336('0x23')],util[_0x9336('0x38')](_0xaae32,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 915a4b3..c1690f6 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 _0xb412=['syncAttendedTransfer','blindtransfer','musiconholdstart','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','keys','[%s][voiceCallReport][newchannel]\x20event:','channel','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','pick','from-sip','split','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','appdata','applicationdata','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','includes','lastapplication','lastdata','set','startsWith','cdr(','match','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','diff','billableseconds','omit','destconnectedlinenum','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','transferconnectedlinenum','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','syncHangup','transfererchannel','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','isNil','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/logger','ami','../model/channel','not_inuse','inuse','busy','invalid','ringing','ringinuse','queue','agi','dial','voicemail','NO\x20ANSWER','ANSWERED','BUSY','FAILED','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','newcallerid','syncNewCallerId','attendedtransfer'];(function(_0xb4f240,_0x15f734){var _0x30682a=function(_0x349112){while(--_0x349112){_0xb4f240['push'](_0xb4f240['shift']());}};_0x30682a(++_0x15f734);}(_0xb412,0x94));var _0x2b41=function(_0x2287fe,_0x41d08c){_0x2287fe=_0x2287fe-0x0;var _0x2349fd=_0xb412[_0x2287fe];return _0x2349fd;};'use strict';var BPromise=require(_0x2b41('0x0'));var _=require(_0x2b41('0x1'));var moment=require(_0x2b41('0x2'));var util=require(_0x2b41('0x3'));var path=require(_0x2b41('0x4'));var Redis=require(_0x2b41('0x5'));var config=require('../../../config/environment');var logger=require(_0x2b41('0x6'))(_0x2b41('0x7'));var ami=require('../ami');var Channel=require(_0x2b41('0x8'));var statusDesc=['unknown',_0x2b41('0x9'),_0x2b41('0xa'),_0x2b41('0xb'),_0x2b41('0xc'),'unavailable',_0x2b41('0xd'),_0x2b41('0xe'),'onhold'];var applications=['set',_0x2b41('0xf'),_0x2b41('0x10'),_0x2b41('0x11'),'playback',_0x2b41('0x12')];var dispositions=[_0x2b41('0x13'),'FAILED','FAILED',_0x2b41('0x13'),_0x2b41('0x13'),_0x2b41('0x13'),_0x2b41('0x14'),_0x2b41('0x15'),_0x2b41('0x16'),_0x2b41('0x16'),_0x2b41('0x16')];var actions={};config[_0x2b41('0x17')]=_['defaults'](config[_0x2b41('0x17')],{'host':_0x2b41('0x18'),'port':0x18eb});var io=require(_0x2b41('0x19'))(new Redis(config[_0x2b41('0x17')]));function VoiceCallReport(_0x43e227){this['channels']=_0x43e227[_0x2b41('0x1a')];this[_0x2b41('0x1b')]=_0x43e227[_0x2b41('0x1b')];this[_0x2b41('0x1c')]={};ami['on'](_0x2b41('0x1d'),this[_0x2b41('0x1e')][_0x2b41('0x1f')](this));ami['on']('newexten',this[_0x2b41('0x1e')][_0x2b41('0x1f')](this));ami['on']('newchannel',this[_0x2b41('0x20')]['bind'](this));ami['on'](_0x2b41('0x21'),this[_0x2b41('0x22')][_0x2b41('0x1f')](this));ami['on'](_0x2b41('0x23'),this[_0x2b41('0x24')][_0x2b41('0x1f')](this));ami['on'](_0x2b41('0x25'),this['syncHangup'][_0x2b41('0x1f')](this));ami['on'](_0x2b41('0x26'),this[_0x2b41('0x27')][_0x2b41('0x1f')](this));ami['on'](_0x2b41('0x28'),this[_0x2b41('0x29')][_0x2b41('0x1f')](this));ami['on'](_0x2b41('0x2a'),this['syncBlindTransfer'][_0x2b41('0x1f')](this));ami['on'](_0x2b41('0x2b'),this['syncMusicOnHoldStart'][_0x2b41('0x1f')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0x2b41('0x1f')](this));try{logger[_0x2b41('0x2c')](_0x2b41('0x2d'));ami[_0x2b41('0x2e')]();}catch(_0x3ac52a){logger[_0x2b41('0x2f')](_0x2b41('0x30'),util[_0x2b41('0x31')](_0x3ac52a,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x2b41('0x32')][_0x2b41('0x33')]=function(_0x4736cc){return _0x4736cc!==null&&!_[_0x2b41('0x34')](_0x4736cc);};VoiceCallReport[_0x2b41('0x32')]['emit']=function(_0x2ca8b1,_0x26f4ca,_0x19a6c3){io['to'](_0x2ca8b1)[_0x2b41('0x35')](_0x26f4ca,_0x19a6c3);};VoiceCallReport['prototype']['syncNewCallerId']=function(_0x2f1c93){try{if(this[_0x2b41('0x33')](_0x2f1c93)){logger[_0x2b41('0x2c')](_0x2b41('0x36'),_0x2f1c93[_0x2b41('0x37')],_0x2f1c93[_0x2b41('0x38')],_0x2f1c93[_0x2b41('0x39')]);logger[_0x2b41('0x3a')](_0x2b41('0x3b'),_0x2f1c93[_0x2b41('0x37')],util['inspect'](_0x2f1c93,{'showHidden':![],'depth':null}));if(_0x2f1c93[_0x2b41('0x37')]===_0x2f1c93[_0x2b41('0x3c')]){if(!_['isUndefined'](this[_0x2b41('0x1a')][_0x2f1c93[_0x2b41('0x37')]])){_[_0x2b41('0x3d')](this[_0x2b41('0x1a')][_0x2f1c93['uniqueid']],_['pick'](_0x2f1c93,_[_0x2b41('0x3e')](this['channels'][_0x2f1c93[_0x2b41('0x37')]])));}}}}catch(_0x1355c2){logger[_0x2b41('0x2f')]('[%s][voiceCallReport][newcallerid]',_0x2f1c93[_0x2b41('0x37')],util[_0x2b41('0x31')](_0x1355c2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b41('0x32')][_0x2b41('0x20')]=function(_0x4dc97f){try{if(this[_0x2b41('0x33')](_0x4dc97f)){logger[_0x2b41('0x3a')](_0x2b41('0x3f'),_0x4dc97f[_0x2b41('0x37')],util[_0x2b41('0x31')](_0x4dc97f,{'showHidden':![],'depth':null}));if(_0x4dc97f['uniqueid']===_0x4dc97f['linkedid']&&_0x4dc97f[_0x2b41('0x40')]!='OutgoingSpoolFailed'){if(_[_0x2b41('0x34')](this[_0x2b41('0x1a')][_0x4dc97f['uniqueid']])){logger[_0x2b41('0x2c')](_0x2b41('0x41'),_0x4dc97f[_0x2b41('0x37')],_0x4dc97f[_0x2b41('0x42')],_0x4dc97f[_0x2b41('0x43')]);this[_0x2b41('0x1a')][_0x4dc97f[_0x2b41('0x37')]]=new Channel();this['channels'][_0x4dc97f['uniqueid']][_0x2b41('0x44')]=moment()[_0x2b41('0x45')](_0x2b41('0x46'));this['channels'][_0x4dc97f[_0x2b41('0x37')]][_0x2b41('0x47')]=dispositions[_[_0x2b41('0x48')](_0x4dc97f[_0x2b41('0x49')])];_['merge'](this[_0x2b41('0x1a')][_0x4dc97f[_0x2b41('0x37')]],_[_0x2b41('0x4a')](_0x4dc97f,_['keys'](this[_0x2b41('0x1a')][_0x4dc97f[_0x2b41('0x37')]])));if(_0x4dc97f[_0x2b41('0x42')]===_0x2b41('0x4b')){if(this[_0x2b41('0x1b')][_0x4dc97f[_0x2b41('0x40')]['split']('-')[0x0]]){this['agents'][_0x4dc97f[_0x2b41('0x40')][_0x2b41('0x4c')]('-')[0x0]]['destconnectedlinenum']=_0x4dc97f[_0x2b41('0x43')];logger[_0x2b41('0x3a')](_0x2b41('0x4d'),_0x4dc97f[_0x2b41('0x37')],util[_0x2b41('0x31')]({'destaccountcode':this[_0x2b41('0x1b')][_0x4dc97f[_0x2b41('0x40')][_0x2b41('0x4c')]('-')[0x0]][_0x2b41('0x4e')],'destconnectedlinenum':_0x4dc97f[_0x2b41('0x43')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x2b41('0x45')](_0x2b41('0x4f'),this['agents'][_0x4dc97f[_0x2b41('0x40')][_0x2b41('0x4c')]('-')[0x0]][_0x2b41('0x50')]),_0x2b41('0x51'),{'destaccountcode':this['agents'][_0x4dc97f[_0x2b41('0x40')][_0x2b41('0x4c')]('-')[0x0]][_0x2b41('0x4e')],'destconnectedlinenum':_0x4dc97f[_0x2b41('0x43')]});}}}}}}catch(_0xe34b75){logger[_0x2b41('0x2f')]('[%s][voiceCallReport][newchannel]',_0x4dc97f['uniqueid'],util[_0x2b41('0x31')](_0xe34b75,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewExten']=function(_0x19c341){try{if(this['isNotNull'](_0x19c341)){logger[_0x2b41('0x3a')](_0x2b41('0x52'),_0x19c341['uniqueid'],util[_0x2b41('0x31')](_0x19c341,{'showHidden':![],'depth':null}));if(_0x19c341[_0x2b41('0x37')]===_0x19c341['linkedid']&&_0x19c341[_0x2b41('0x43')]!='h'&&_0x19c341['channel']!=_0x2b41('0x53')){_0x19c341['application']=_0x19c341[_0x2b41('0x54')]['toLowerCase']();_0x19c341['applicationdata']=(_0x19c341[_0x2b41('0x55')]||_0x19c341[_0x2b41('0x56')])[_0x2b41('0x57')]();logger[_0x2b41('0x2c')](_0x2b41('0x58'),_0x19c341[_0x2b41('0x37')],_0x19c341[_0x2b41('0x54')],_0x19c341[_0x2b41('0x56')]);if(_['isUndefined'](this[_0x2b41('0x1a')][_0x19c341[_0x2b41('0x37')]])){this[_0x2b41('0x1a')][_0x19c341[_0x2b41('0x37')]]=new Channel();this[_0x2b41('0x1a')][_0x19c341[_0x2b41('0x37')]][_0x2b41('0x44')]=_0x19c341['duration']?moment()[_0x2b41('0x59')](moment['duration'](_0x19c341[_0x2b41('0x5a')])[_0x2b41('0x5b')](),_0x2b41('0x5b'))['format'](_0x2b41('0x46')):moment()[_0x2b41('0x45')](_0x2b41('0x46'));this[_0x2b41('0x1a')][_0x19c341[_0x2b41('0x37')]][_0x2b41('0x47')]=_0x2b41('0x13');}_[_0x2b41('0x3d')](this['channels'][_0x19c341[_0x2b41('0x37')]],_['pick'](_0x19c341,_[_0x2b41('0x3e')](this[_0x2b41('0x1a')][_0x19c341[_0x2b41('0x37')]])));if(_[_0x2b41('0x5c')](applications,_0x19c341[_0x2b41('0x54')])){this['channels'][_0x19c341['uniqueid']][_0x2b41('0x5d')]=_0x19c341[_0x2b41('0x54')];this[_0x2b41('0x1a')][_0x19c341[_0x2b41('0x37')]][_0x2b41('0x5e')]=_0x19c341[_0x2b41('0x56')];if(_0x19c341[_0x2b41('0x54')]===_0x2b41('0x5f')&&_[_0x2b41('0x60')](_0x19c341[_0x2b41('0x56')],_0x2b41('0x61'))){var _0x149eb2=_0x19c341[_0x2b41('0x56')][_0x2b41('0x4c')]('=');var _0x51e3f1=_0x149eb2[0x0][_0x2b41('0x62')](/cdr\((.*)\)/);if(_0x51e3f1){this['channels'][_0x19c341[_0x2b41('0x37')]][_0x51e3f1[0x1]]=_0x149eb2[0x1];}}else if(_0x19c341[_0x2b41('0x54')]===_0x2b41('0xf')){this[_0x2b41('0x1a')][_0x19c341[_0x2b41('0x37')]][_0x2b41('0xf')]=_0x19c341['applicationdata'][_0x2b41('0x4c')](',')[0x0];}}}}}catch(_0x262963){logger['error']('[%s][voiceCallReport][newexten]',_0x19c341[_0x2b41('0x37')],util['inspect'](_0x262963,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b41('0x32')][_0x2b41('0x22')]=function(_0x135217){try{if(this['isNotNull'](_0x135217)){logger[_0x2b41('0x2c')](_0x2b41('0x63'),_0x135217[_0x2b41('0x37')],_0x135217[_0x2b41('0x3c')],_0x135217[_0x2b41('0x38')],_0x135217[_0x2b41('0x39')]);logger[_0x2b41('0x3a')](_0x2b41('0x64'),_0x135217[_0x2b41('0x37')],util[_0x2b41('0x31')](_0x135217,{'showHidden':![],'depth':null}));if(_0x135217[_0x2b41('0x37')]!==_0x135217['linkedid']){if(this[_0x2b41('0x1a')][_0x135217[_0x2b41('0x3c')]]){if(_0x135217[_0x2b41('0x49')]==='6'){if(!this['channels'][_0x135217[_0x2b41('0x3c')]][_0x2b41('0x65')]){var _0x4f0eba=moment();this[_0x2b41('0x1a')][_0x135217[_0x2b41('0x3c')]][_0x2b41('0x65')]=!![];this['channels'][_0x135217[_0x2b41('0x3c')]][_0x2b41('0x66')]=_0x4f0eba[_0x2b41('0x45')](_0x2b41('0x46'));if(this[_0x2b41('0x1a')][_0x135217['linkedid']]['starttime']){this[_0x2b41('0x1a')][_0x135217[_0x2b41('0x3c')]][_0x2b41('0x67')]=_0x4f0eba['diff'](this[_0x2b41('0x1a')][_0x135217['linkedid']][_0x2b41('0x44')],_0x2b41('0x5b'));}}this[_0x2b41('0x1a')][_0x135217[_0x2b41('0x3c')]][_0x2b41('0x3c')]=_0x135217[_0x2b41('0x37')];if(_0x135217[_0x2b41('0x39')]!==_0x2b41('0x68')){this[_0x2b41('0x1a')][_0x135217['linkedid']][_0x2b41('0x69')]=_0x135217[_0x2b41('0x39')];}this[_0x2b41('0x1a')][_0x135217[_0x2b41('0x3c')]][_0x2b41('0x6a')]=_0x135217[_0x2b41('0x38')];this['channels'][_0x135217[_0x2b41('0x3c')]][_0x2b41('0x6b')]=_0x135217[_0x2b41('0x40')];this[_0x2b41('0x1a')][_0x135217[_0x2b41('0x3c')]]['disposition']=dispositions[_[_0x2b41('0x48')](_0x135217['channelstate'])];if(this['agents'][_0x135217['channel'][_0x2b41('0x4c')]('-')[0x0]]){this[_0x2b41('0x1a')][_0x135217[_0x2b41('0x3c')]][_0x2b41('0x6c')]=this[_0x2b41('0x1b')][_0x135217[_0x2b41('0x40')][_0x2b41('0x4c')]('-')[0x0]]['id'];this['channels'][_0x135217[_0x2b41('0x3c')]][_0x2b41('0x6d')]=this[_0x2b41('0x1b')][_0x135217[_0x2b41('0x40')][_0x2b41('0x4c')]('-')[0x0]][_0x2b41('0x50')];}}}}else{if(this['channels'][_0x135217[_0x2b41('0x37')]]){if(_0x135217[_0x2b41('0x49')]==='6'){if(this[_0x2b41('0x1b')][_0x135217['channel'][_0x2b41('0x4c')]('-')[0x0]]){this[_0x2b41('0x1a')][_0x135217[_0x2b41('0x37')]][_0x2b41('0x6c')]=this[_0x2b41('0x1b')][_0x135217[_0x2b41('0x40')][_0x2b41('0x4c')]('-')[0x0]]['id'];this['channels'][_0x135217[_0x2b41('0x37')]][_0x2b41('0x6d')]=this[_0x2b41('0x1b')][_0x135217['channel']['split']('-')[0x0]][_0x2b41('0x50')];}}}}}}catch(_0x239483){logger[_0x2b41('0x2f')](_0x2b41('0x6e'),_0x135217[_0x2b41('0x37')],util[_0x2b41('0x31')](_0x239483,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b41('0x32')][_0x2b41('0x6f')]=function(_0x3a351b,_0x1d194d){try{if(this[_0x2b41('0x1a')][_0x3a351b]){logger[_0x2b41('0x2c')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x3a351b,_0x1d194d);this[_0x2b41('0x1a')][_0x3a351b]['monitor']=!![];if(_[_0x2b41('0x70')](_0x1d194d,_0x2b41('0x71'))){_0x1d194d=_0x1d194d[_0x2b41('0x72')](_0x2b41('0x71'),_0x2b41('0x73'));}this[_0x2b41('0x1a')][_0x3a351b][_0x2b41('0x74')]=_0x1d194d;var _0x764744=_[_0x2b41('0x75')](this[_0x2b41('0x1a')][_0x3a351b][_0x2b41('0x76')],{'filename':_0x1d194d});if(_['isNil'](_0x764744)){this[_0x2b41('0x1a')][_0x3a351b][_0x2b41('0x76')][_0x2b41('0x77')]({'filename':_0x1d194d,'createdAt':moment()[_0x2b41('0x45')](_0x2b41('0x46')),'mixmonitorid':'','status':_0x2b41('0x78')});}}}catch(_0x3027b7){logger[_0x2b41('0x2f')](_0x2b41('0x79'),_0x3a351b,util[_0x2b41('0x31')](_0x3027b7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b41('0x32')]['syncVarSet']=function(_0x1022b6){try{if(this['isNotNull'](_0x1022b6)){logger[_0x2b41('0x3a')](_0x2b41('0x7a'),_0x1022b6['uniqueid'],util['inspect'](_0x1022b6,{'showHidden':![],'depth':null}));if(this[_0x2b41('0x1a')][_0x1022b6[_0x2b41('0x37')]]&&_0x1022b6[_0x2b41('0x40')]!='OutgoingSpoolFailed'){if(this['isNotNull'](_0x1022b6[_0x2b41('0x7b')])){if(this[_0x2b41('0x33')](_0x1022b6['variable'][_0x2b41('0x7c')])){logger[_0x2b41('0x2c')](_0x2b41('0x7d'),_0x1022b6[_0x2b41('0x37')],_0x1022b6['value']);this[_0x2b41('0x6f')](_0x1022b6[_0x2b41('0x37')],_0x1022b6[_0x2b41('0x7e')]);}else if(this[_0x2b41('0x33')](_0x1022b6[_0x2b41('0x7b')][_0x2b41('0x7f')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x1022b6[_0x2b41('0x37')],_0x1022b6[_0x2b41('0x7e')]);this[_0x2b41('0x1a')][_0x1022b6['uniqueid']][_0x2b41('0x39')]=_0x1022b6[_0x2b41('0x7e')];}else if(this[_0x2b41('0x33')](_0x1022b6[_0x2b41('0x7b')][_0x2b41('0x80')])){logger[_0x2b41('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x1022b6[_0x2b41('0x37')],_0x1022b6[_0x2b41('0x7e')]);this[_0x2b41('0x1a')][_0x1022b6['uniqueid']]['callerid']=_0x1022b6[_0x2b41('0x7e')];}else if(this['isNotNull'](_0x1022b6['variable']['xmd-cdrtype'])){logger[_0x2b41('0x2c')](_0x2b41('0x81'),_0x1022b6[_0x2b41('0x37')],_0x1022b6[_0x2b41('0x7e')]);this[_0x2b41('0x1a')][_0x1022b6[_0x2b41('0x37')]][_0x2b41('0x82')]=_0x1022b6[_0x2b41('0x7e')];}else if(this[_0x2b41('0x33')](_0x1022b6[_0x2b41('0x7b')]['xmd-queue'])){logger['info'](_0x2b41('0x83'),_0x1022b6['uniqueid'],_0x1022b6['value'][_0x2b41('0x4c')](',')[0x0]);this[_0x2b41('0x1a')][_0x1022b6[_0x2b41('0x37')]]['queue']=_0x1022b6['value'][_0x2b41('0x4c')](',')[0x0];}else if(this['isNotNull'](_0x1022b6[_0x2b41('0x7b')][_0x2b41('0x84')])){logger['info'](_0x2b41('0x85'),_0x1022b6[_0x2b41('0x37')],_0x1022b6['value']);this[_0x2b41('0x1a')][_0x1022b6[_0x2b41('0x37')]][_0x2b41('0x86')]=_0x1022b6[_0x2b41('0x7e')];}else if(this['isNotNull'](_0x1022b6[_0x2b41('0x7b')]['xmd-destination'])){logger[_0x2b41('0x2c')](_0x2b41('0x87'),_0x1022b6[_0x2b41('0x37')],_0x1022b6['value']);this[_0x2b41('0x1a')][_0x1022b6[_0x2b41('0x37')]][_0x2b41('0x88')]=_0x1022b6[_0x2b41('0x7e')];}else if(this['isNotNull'](_0x1022b6[_0x2b41('0x7b')][_0x2b41('0x89')])){logger[_0x2b41('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x1022b6[_0x2b41('0x37')],_0x1022b6[_0x2b41('0x7e')]);this[_0x2b41('0x1a')][_0x1022b6[_0x2b41('0x37')]][_0x2b41('0x8a')]=_0x1022b6['value'];}else if(this['isNotNull'](_0x1022b6[_0x2b41('0x7b')][_0x2b41('0x8b')])){logger[_0x2b41('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x1022b6[_0x2b41('0x37')],_0x1022b6[_0x2b41('0x7e')]);this[_0x2b41('0x1a')][_0x1022b6[_0x2b41('0x37')]][_0x2b41('0xf')]=_0x1022b6['value'];}else if(this[_0x2b41('0x33')](_0x1022b6[_0x2b41('0x7b')][_0x2b41('0x8c')])){logger['info'](_0x2b41('0x8d'),_0x1022b6[_0x2b41('0x37')],_0x1022b6[_0x2b41('0x7e')]);this['channels'][_0x1022b6[_0x2b41('0x37')]][_0x2b41('0x8e')]=_0x1022b6['value'];}}}else if(this[_0x2b41('0x33')](_0x1022b6[_0x2b41('0x7b')][_0x2b41('0x7c')])){if(_0x1022b6[_0x2b41('0x7e')]){var _0x14e450=path['parse'](_0x1022b6['value'])['name'];logger[_0x2b41('0x2c')](_0x2b41('0x7d'),_0x14e450,_0x1022b6[_0x2b41('0x7e')]);this[_0x2b41('0x6f')](_0x14e450,_0x1022b6[_0x2b41('0x7e')]);}}else if(this[_0x2b41('0x1a')][_0x1022b6[_0x2b41('0x3c')]]){if(this[_0x2b41('0x33')](_0x1022b6[_0x2b41('0x7b')])){if(this[_0x2b41('0x33')](_0x1022b6['variable'][_0x2b41('0x8c')])){logger[_0x2b41('0x2c')](_0x2b41('0x8d'),_0x1022b6[_0x2b41('0x3c')],_0x1022b6[_0x2b41('0x7e')]);this[_0x2b41('0x1a')][_0x1022b6[_0x2b41('0x3c')]][_0x2b41('0x8f')]=_0x1022b6[_0x2b41('0x7e')];}}}}}catch(_0x28aa12){logger['error'](_0x2b41('0x90'),_0x1022b6[_0x2b41('0x37')],util[_0x2b41('0x31')](_0x28aa12,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b41('0x32')]['syncHangup']=function(_0x568b85){try{if(this[_0x2b41('0x33')](_0x568b85)){logger[_0x2b41('0x3a')](_0x2b41('0x91'),_0x568b85[_0x2b41('0x37')],util['inspect'](_0x568b85,{'showHidden':![],'depth':null}));if(this[_0x2b41('0x1a')][_0x568b85[_0x2b41('0x37')]]){logger['info'](_0x2b41('0x92'),_0x568b85[_0x2b41('0x37')],_0x568b85[_0x2b41('0x93')]);var _0xe23fe7=moment();this[_0x2b41('0x1a')][_0x568b85['uniqueid']][_0x2b41('0x94')]=_0xe23fe7['format'](_0x2b41('0x46'));this[_0x2b41('0x1a')][_0x568b85['uniqueid']][_0x2b41('0x5a')]=_0xe23fe7[_0x2b41('0x95')](this[_0x2b41('0x1a')][_0x568b85['uniqueid']][_0x2b41('0x44')],_0x2b41('0x5b'));if(this[_0x2b41('0x1a')][_0x568b85[_0x2b41('0x37')]][_0x2b41('0x65')]){this[_0x2b41('0x1a')][_0x568b85[_0x2b41('0x37')]][_0x2b41('0x96')]=_0xe23fe7[_0x2b41('0x95')](this[_0x2b41('0x1a')][_0x568b85[_0x2b41('0x37')]][_0x2b41('0x66')],_0x2b41('0x5b'));this[_0x2b41('0x1a')][_0x568b85['uniqueid']][_0x2b41('0x67')]=this[_0x2b41('0x1a')][_0x568b85[_0x2b41('0x37')]][_0x2b41('0x5a')]-this[_0x2b41('0x1a')][_0x568b85['uniqueid']][_0x2b41('0x96')];}if(_0x568b85[_0x2b41('0x42')]===_0x2b41('0x4b')){if(this[_0x2b41('0x1b')][_0x568b85[_0x2b41('0x40')][_0x2b41('0x4c')]('-')[0x0]]){this['agents'][_0x568b85[_0x2b41('0x40')][_0x2b41('0x4c')]('-')[0x0]]=_[_0x2b41('0x97')](this[_0x2b41('0x1b')][_0x568b85[_0x2b41('0x40')][_0x2b41('0x4c')]('-')[0x0]],[_0x2b41('0x98')]);logger['debug'](_0x2b41('0x99'),_0x568b85[_0x2b41('0x37')],util[_0x2b41('0x31')]({'destaccountcode':this['agents'][_0x568b85['channel'][_0x2b41('0x4c')]('-')[0x0]][_0x2b41('0x4e')]},{'showHidden':![],'depth':null}));this[_0x2b41('0x35')](util[_0x2b41('0x45')](_0x2b41('0x4f'),this['agents'][_0x568b85['channel'][_0x2b41('0x4c')]('-')[0x0]][_0x2b41('0x50')]),_0x2b41('0x9a'),{'destaccountcode':this[_0x2b41('0x1b')][_0x568b85[_0x2b41('0x40')][_0x2b41('0x4c')]('-')[0x0]][_0x2b41('0x4e')]});}}if(_0x568b85[_0x2b41('0x9b')]===_0x2b41('0x9c')){this[_0x2b41('0x1c')][_0x568b85[_0x2b41('0x37')]]=this[_0x2b41('0x1a')][_0x568b85[_0x2b41('0x37')]];}else{if(this[_0x2b41('0x1a')][_0x568b85[_0x2b41('0x37')]]['type']===_0x2b41('0x9d')&&this[_0x2b41('0x1c')][_0x568b85[_0x2b41('0x37')]]){this[_0x2b41('0x1a')][_0x568b85['uniqueid']][_0x2b41('0x37')]=[this[_0x2b41('0x1a')][_0x568b85['uniqueid']][_0x2b41('0x3c')],this[_0x2b41('0x1a')][_0x568b85['uniqueid']][_0x2b41('0x3c')]=this[_0x2b41('0x1a')][_0x568b85[_0x2b41('0x37')]][_0x2b41('0x37')]][0x0];delete this[_0x2b41('0x1c')][_0x568b85['uniqueid']];}}logger['debug'](_0x2b41('0x9e'),_0x568b85[_0x2b41('0x37')],util[_0x2b41('0x31')](this[_0x2b41('0x1a')][_0x568b85[_0x2b41('0x37')]],{'showHidden':![],'depth':null}));ami[_0x2b41('0x35')](_0x2b41('0x9f'),this[_0x2b41('0x1a')][_0x568b85['uniqueid']]);delete this[_0x2b41('0x1a')][_0x568b85[_0x2b41('0x37')]];}}}catch(_0x2ef10a){logger[_0x2b41('0x2f')]('[%s][voiceCallReport][hangup]',_0x568b85[_0x2b41('0x37')],util[_0x2b41('0x31')](_0x2ef10a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2b41('0x29')]=function(_0x12f0c1){try{if(this[_0x2b41('0x33')](_0x12f0c1)){logger[_0x2b41('0x2c')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x12f0c1[_0x2b41('0x37')],_0x12f0c1[_0x2b41('0xa0')],_0x12f0c1[_0x2b41('0xa1')]);logger[_0x2b41('0x3a')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x12f0c1[_0x2b41('0x37')],util[_0x2b41('0x31')](_0x12f0c1,{'showHidden':![],'depth':null}));if(this[_0x2b41('0x1a')][_0x12f0c1[_0x2b41('0xa2')]]){this[_0x2b41('0x1a')][_0x12f0c1[_0x2b41('0xa2')]]['transfercalleridnum']=_0x12f0c1[_0x2b41('0xa0')];this[_0x2b41('0x1a')][_0x12f0c1['transfereeuniqueid']]['transferconnectedlinenum']=_0x12f0c1['transfertargetcalleridnum'];if(this[_0x2b41('0x1a')][_0x12f0c1[_0x2b41('0xa3')]]){var _0x33512c=this[_0x2b41('0x1a')][_0x12f0c1[_0x2b41('0xa3')]];this['channels'][_0x12f0c1['secondtransfereruniqueid']]=this[_0x2b41('0x1a')][_0x12f0c1[_0x2b41('0xa2')]];this[_0x2b41('0x1a')][_0x12f0c1['transfereeuniqueid']]=_0x33512c;}}else if(this[_0x2b41('0x1a')][_0x12f0c1['transfertargetuniqueid']]){this['channels'][_0x12f0c1[_0x2b41('0xa4')]][_0x2b41('0xa5')]=_0x12f0c1[_0x2b41('0xa0')];this[_0x2b41('0x1a')][_0x12f0c1['transfertargetuniqueid']][_0x2b41('0xa6')]=_0x12f0c1[_0x2b41('0xa1')];if(this[_0x2b41('0x1a')][_0x12f0c1[_0x2b41('0xa7')]]){var _0x33512c=this['channels'][_0x12f0c1[_0x2b41('0xa7')]];this['channels'][_0x12f0c1['origtransfereruniqueid']]=this[_0x2b41('0x1a')][_0x12f0c1[_0x2b41('0xa4')]];this['channels'][_0x12f0c1['transfertargetuniqueid']]=_0x33512c;}}}}catch(_0x5a34b9){logger[_0x2b41('0x2f')](_0x2b41('0xa8'),_0x12f0c1[_0x2b41('0x37')],util[_0x2b41('0x31')](_0x5a34b9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b41('0x32')][_0x2b41('0xa9')]=function(_0x595a3b){try{if(this[_0x2b41('0x33')](_0x595a3b)){logger[_0x2b41('0x2c')](_0x2b41('0xaa'),_0x595a3b['uniqueid'],_0x595a3b[_0x2b41('0xab')],_0x595a3b[_0x2b41('0xac')]);logger[_0x2b41('0x3a')](_0x2b41('0xad'),_0x595a3b['uniqueid'],util[_0x2b41('0x31')](_0x595a3b,{'showHidden':![],'depth':null}));if(this['channels'][_0x595a3b[_0x2b41('0xa2')]]){this[_0x2b41('0x1a')][_0x595a3b[_0x2b41('0xa2')]][_0x2b41('0xa5')]=_0x595a3b[_0x2b41('0xab')];this[_0x2b41('0x1a')][_0x595a3b[_0x2b41('0xa2')]][_0x2b41('0xa6')]=_0x595a3b['extension'];this[_0x2b41('0xae')]({'event':_0x2b41('0x9c'),'uniqueid':_0x595a3b[_0x2b41('0xa2')],'context':_0x595a3b[_0x2b41('0x42')],'channel':_0x595a3b[_0x2b41('0xaf')]});}}}catch(_0xca2303){logger[_0x2b41('0x2f')](_0x2b41('0xb0'),_0x595a3b[_0x2b41('0x37')],util[_0x2b41('0x31')](_0xca2303,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b41('0x32')][_0x2b41('0xb1')]=function(_0x5bccc6){try{if(this[_0x2b41('0x33')](_0x5bccc6)){logger[_0x2b41('0x3a')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x5bccc6['uniqueid'],util[_0x2b41('0x31')](_0x5bccc6,{'showHidden':![],'depth':null}));if(this[_0x2b41('0x1a')][_0x5bccc6[_0x2b41('0x37')]]){if(!_['isNil'](this[_0x2b41('0x1a')][_0x5bccc6[_0x2b41('0x37')]][_0x2b41('0x66')])){this[_0x2b41('0x1a')][_0x5bccc6[_0x2b41('0x37')]][_0x2b41('0xb2')]=moment()['format'](_0x2b41('0x46'));logger[_0x2b41('0x2c')](_0x2b41('0xb3'),_0x5bccc6[_0x2b41('0x37')],this[_0x2b41('0x1a')][_0x5bccc6[_0x2b41('0x37')]][_0x2b41('0xb2')]);}}}}catch(_0x2ff873){logger['error'](_0x2b41('0xb4'),_0x5bccc6['uniqueid'],util[_0x2b41('0x31')](_0x2ff873,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b41('0x32')][_0x2b41('0xb5')]=function(_0x3cddb6){try{if(this['isNotNull'](_0x3cddb6)){logger[_0x2b41('0x3a')](_0x2b41('0xb6'),_0x3cddb6[_0x2b41('0x37')],util[_0x2b41('0x31')](_0x3cddb6,{'showHidden':![],'depth':null}));if(this['channels'][_0x3cddb6[_0x2b41('0x37')]]){if(!_[_0x2b41('0xb7')](this['channels'][_0x3cddb6[_0x2b41('0x37')]][_0x2b41('0xb2')])){this[_0x2b41('0x1a')][_0x3cddb6['uniqueid']][_0x2b41('0xb8')]+=moment()[_0x2b41('0xb9')](0x0)[_0x2b41('0x95')](this['channels'][_0x3cddb6[_0x2b41('0x37')]]['mohstarttime'],_0x2b41('0x5b'));logger[_0x2b41('0x2c')](_0x2b41('0xba'),_0x3cddb6['uniqueid'],this['channels'][_0x3cddb6[_0x2b41('0x37')]][_0x2b41('0xb8')]);delete this[_0x2b41('0x1a')][_0x3cddb6[_0x2b41('0x37')]][_0x2b41('0xb2')];}}}}catch(_0xb64573){logger['error'](_0x2b41('0xbb'),_0x3cddb6[_0x2b41('0x37')],util[_0x2b41('0x31')](_0xb64573,{'showHidden':![],'depth':null}));}};module[_0x2b41('0xbc')]=VoiceCallReport; \ No newline at end of file +var _0xefef=['isNotNull','isUndefined','prototype','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','linkedid','merge','pick','[%s][voiceCallReport][newcallerid]','syncNewChannel','inspect','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','context','from-sip','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','duration','subtract','seconds','keys','includes','lastapplication','startsWith','match','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','UserId','name','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','find','monitors','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','[%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]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','event','BlindTransfer','blindTransfers','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','bluebird','lodash','moment','util','path','../../../config/logger','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','set','queue','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','newstate','syncNewState','varset','syncVarSet','syncHangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]'];(function(_0x4d3801,_0x4068d8){var _0x55d5a7=function(_0x181fcd){while(--_0x181fcd){_0x4d3801['push'](_0x4d3801['shift']());}};_0x55d5a7(++_0x4068d8);}(_0xefef,0x80));var _0xfefe=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xefef[_0x18a79d];return _0x4f8848;};'use strict';var BPromise=require(_0xfefe('0x0'));var _=require(_0xfefe('0x1'));var moment=require(_0xfefe('0x2'));var util=require(_0xfefe('0x3'));var path=require(_0xfefe('0x4'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xfefe('0x5'))('ami');var ami=require(_0xfefe('0x6'));var Channel=require(_0xfefe('0x7'));var statusDesc=[_0xfefe('0x8'),_0xfefe('0x9'),_0xfefe('0xa'),_0xfefe('0xb'),_0xfefe('0xc'),_0xfefe('0xd'),_0xfefe('0xe'),'ringinuse','onhold'];var applications=[_0xfefe('0xf'),_0xfefe('0x10'),_0xfefe('0x11'),_0xfefe('0x12'),_0xfefe('0x13'),_0xfefe('0x14')];var dispositions=['NO\x20ANSWER',_0xfefe('0x15'),_0xfefe('0x15'),_0xfefe('0x16'),_0xfefe('0x16'),_0xfefe('0x16'),_0xfefe('0x17'),_0xfefe('0x18'),_0xfefe('0x15'),_0xfefe('0x15'),_0xfefe('0x15')];var actions={};config[_0xfefe('0x19')]=_['defaults'](config[_0xfefe('0x19')],{'host':_0xfefe('0x1a'),'port':0x18eb});var io=require(_0xfefe('0x1b'))(new Redis(config[_0xfefe('0x19')]));function VoiceCallReport(_0x5322d5){this['channels']=_0x5322d5[_0xfefe('0x1c')];this[_0xfefe('0x1d')]=_0x5322d5[_0xfefe('0x1d')];this['blindTransfers']={};ami['on'](_0xfefe('0x1e'),this[_0xfefe('0x1f')][_0xfefe('0x20')](this));ami['on'](_0xfefe('0x21'),this[_0xfefe('0x1f')][_0xfefe('0x20')](this));ami['on'](_0xfefe('0x22'),this['syncNewChannel'][_0xfefe('0x20')](this));ami['on'](_0xfefe('0x23'),this[_0xfefe('0x24')][_0xfefe('0x20')](this));ami['on'](_0xfefe('0x25'),this[_0xfefe('0x26')]['bind'](this));ami['on']('hangup',this[_0xfefe('0x27')][_0xfefe('0x20')](this));ami['on']('newcallerid',this[_0xfefe('0x28')][_0xfefe('0x20')](this));ami['on'](_0xfefe('0x29'),this[_0xfefe('0x2a')][_0xfefe('0x20')](this));ami['on']('blindtransfer',this[_0xfefe('0x2b')][_0xfefe('0x20')](this));ami['on'](_0xfefe('0x2c'),this[_0xfefe('0x2d')]['bind'](this));ami['on'](_0xfefe('0x2e'),this[_0xfefe('0x2f')][_0xfefe('0x20')](this));try{logger[_0xfefe('0x30')](_0xfefe('0x31'));ami[_0xfefe('0x32')]();}catch(_0x47afdb){logger[_0xfefe('0x33')](_0xfefe('0x34'),util['inspect'](_0x47afdb,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0xfefe('0x35')]=function(_0x304e8f){return _0x304e8f!==null&&!_[_0xfefe('0x36')](_0x304e8f);};VoiceCallReport[_0xfefe('0x37')][_0xfefe('0x38')]=function(_0x508152,_0x44ba45,_0x58aa2b){io['to'](_0x508152)[_0xfefe('0x38')](_0x44ba45,_0x58aa2b);};VoiceCallReport['prototype'][_0xfefe('0x28')]=function(_0x2ed33f){try{if(this['isNotNull'](_0x2ed33f)){logger[_0xfefe('0x30')](_0xfefe('0x39'),_0x2ed33f[_0xfefe('0x3a')],_0x2ed33f[_0xfefe('0x3b')],_0x2ed33f[_0xfefe('0x3c')]);logger[_0xfefe('0x3d')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x2ed33f['uniqueid'],util['inspect'](_0x2ed33f,{'showHidden':![],'depth':null}));if(_0x2ed33f[_0xfefe('0x3a')]===_0x2ed33f[_0xfefe('0x3e')]){if(!_[_0xfefe('0x36')](this[_0xfefe('0x1c')][_0x2ed33f[_0xfefe('0x3a')]])){_[_0xfefe('0x3f')](this[_0xfefe('0x1c')][_0x2ed33f[_0xfefe('0x3a')]],_[_0xfefe('0x40')](_0x2ed33f,_['keys'](this[_0xfefe('0x1c')][_0x2ed33f[_0xfefe('0x3a')]])));}}}}catch(_0x42f04e){logger[_0xfefe('0x33')](_0xfefe('0x41'),_0x2ed33f[_0xfefe('0x3a')],util['inspect'](_0x42f04e,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xfefe('0x42')]=function(_0x22a002){try{if(this[_0xfefe('0x35')](_0x22a002)){logger[_0xfefe('0x3d')]('[%s][voiceCallReport][newchannel]\x20event:',_0x22a002[_0xfefe('0x3a')],util[_0xfefe('0x43')](_0x22a002,{'showHidden':![],'depth':null}));if(_0x22a002[_0xfefe('0x3a')]===_0x22a002[_0xfefe('0x3e')]&&_0x22a002[_0xfefe('0x44')]!=_0xfefe('0x45')){if(_[_0xfefe('0x36')](this[_0xfefe('0x1c')][_0x22a002[_0xfefe('0x3a')]])){logger['info'](_0xfefe('0x46'),_0x22a002[_0xfefe('0x3a')],_0x22a002['context'],_0x22a002[_0xfefe('0x47')]);this[_0xfefe('0x1c')][_0x22a002[_0xfefe('0x3a')]]=new Channel();this[_0xfefe('0x1c')][_0x22a002[_0xfefe('0x3a')]][_0xfefe('0x48')]=moment()[_0xfefe('0x49')](_0xfefe('0x4a'));this[_0xfefe('0x1c')][_0x22a002['uniqueid']][_0xfefe('0x4b')]=dispositions[_[_0xfefe('0x4c')](_0x22a002[_0xfefe('0x4d')])];_['merge'](this[_0xfefe('0x1c')][_0x22a002[_0xfefe('0x3a')]],_['pick'](_0x22a002,_['keys'](this['channels'][_0x22a002[_0xfefe('0x3a')]])));if(_0x22a002[_0xfefe('0x4e')]===_0xfefe('0x4f')){if(this[_0xfefe('0x1d')][_0x22a002[_0xfefe('0x44')]['split']('-')[0x0]]){this[_0xfefe('0x1d')][_0x22a002['channel'][_0xfefe('0x50')]('-')[0x0]][_0xfefe('0x51')]=_0x22a002[_0xfefe('0x47')];logger[_0xfefe('0x3d')](_0xfefe('0x52'),_0x22a002[_0xfefe('0x3a')],util[_0xfefe('0x43')]({'destaccountcode':this[_0xfefe('0x1d')][_0x22a002[_0xfefe('0x44')][_0xfefe('0x50')]('-')[0x0]][_0xfefe('0x53')],'destconnectedlinenum':_0x22a002[_0xfefe('0x47')]},{'showHidden':![],'depth':null}));this[_0xfefe('0x38')](util[_0xfefe('0x49')](_0xfefe('0x54'),this[_0xfefe('0x1d')][_0x22a002['channel'][_0xfefe('0x50')]('-')[0x0]]['name']),_0xfefe('0x55'),{'destaccountcode':this[_0xfefe('0x1d')][_0x22a002[_0xfefe('0x44')][_0xfefe('0x50')]('-')[0x0]][_0xfefe('0x53')],'destconnectedlinenum':_0x22a002['exten']});}}}}}}catch(_0xd3cda4){logger[_0xfefe('0x33')](_0xfefe('0x56'),_0x22a002[_0xfefe('0x3a')],util[_0xfefe('0x43')](_0xd3cda4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfefe('0x37')]['syncNewExten']=function(_0x3db33d){try{if(this[_0xfefe('0x35')](_0x3db33d)){logger['debug'](_0xfefe('0x57'),_0x3db33d['uniqueid'],util[_0xfefe('0x43')](_0x3db33d,{'showHidden':![],'depth':null}));if(_0x3db33d[_0xfefe('0x3a')]===_0x3db33d[_0xfefe('0x3e')]&&_0x3db33d[_0xfefe('0x47')]!='h'&&_0x3db33d['channel']!=_0xfefe('0x45')){_0x3db33d[_0xfefe('0x58')]=_0x3db33d['application'][_0xfefe('0x59')]();_0x3db33d[_0xfefe('0x5a')]=(_0x3db33d['appdata']||_0x3db33d[_0xfefe('0x5a')])[_0xfefe('0x59')]();logger[_0xfefe('0x30')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x3db33d[_0xfefe('0x3a')],_0x3db33d[_0xfefe('0x58')],_0x3db33d[_0xfefe('0x5a')]);if(_[_0xfefe('0x36')](this['channels'][_0x3db33d[_0xfefe('0x3a')]])){this[_0xfefe('0x1c')][_0x3db33d['uniqueid']]=new Channel();this['channels'][_0x3db33d[_0xfefe('0x3a')]][_0xfefe('0x48')]=_0x3db33d[_0xfefe('0x5b')]?moment()[_0xfefe('0x5c')](moment[_0xfefe('0x5b')](_0x3db33d[_0xfefe('0x5b')])[_0xfefe('0x5d')](),'seconds')[_0xfefe('0x49')](_0xfefe('0x4a')):moment()[_0xfefe('0x49')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xfefe('0x1c')][_0x3db33d[_0xfefe('0x3a')]][_0xfefe('0x4b')]='NO\x20ANSWER';}_[_0xfefe('0x3f')](this['channels'][_0x3db33d[_0xfefe('0x3a')]],_[_0xfefe('0x40')](_0x3db33d,_[_0xfefe('0x5e')](this[_0xfefe('0x1c')][_0x3db33d[_0xfefe('0x3a')]])));if(_[_0xfefe('0x5f')](applications,_0x3db33d[_0xfefe('0x58')])){this[_0xfefe('0x1c')][_0x3db33d['uniqueid']][_0xfefe('0x60')]=_0x3db33d[_0xfefe('0x58')];this[_0xfefe('0x1c')][_0x3db33d[_0xfefe('0x3a')]]['lastdata']=_0x3db33d[_0xfefe('0x5a')];if(_0x3db33d['application']===_0xfefe('0xf')&&_[_0xfefe('0x61')](_0x3db33d[_0xfefe('0x5a')],'cdr(')){var _0x4715c3=_0x3db33d['applicationdata'][_0xfefe('0x50')]('=');var _0x3616bf=_0x4715c3[0x0][_0xfefe('0x62')](/cdr\((.*)\)/);if(_0x3616bf){this[_0xfefe('0x1c')][_0x3db33d[_0xfefe('0x3a')]][_0x3616bf[0x1]]=_0x4715c3[0x1];}}else if(_0x3db33d[_0xfefe('0x58')]===_0xfefe('0x10')){this[_0xfefe('0x1c')][_0x3db33d['uniqueid']][_0xfefe('0x10')]=_0x3db33d[_0xfefe('0x5a')][_0xfefe('0x50')](',')[0x0];}}}}}catch(_0x9d7253){logger['error']('[%s][voiceCallReport][newexten]',_0x3db33d[_0xfefe('0x3a')],util[_0xfefe('0x43')](_0x9d7253,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfefe('0x37')][_0xfefe('0x24')]=function(_0x3ad092){try{if(this[_0xfefe('0x35')](_0x3ad092)){logger['info'](_0xfefe('0x63'),_0x3ad092[_0xfefe('0x3a')],_0x3ad092[_0xfefe('0x3e')],_0x3ad092[_0xfefe('0x3b')],_0x3ad092[_0xfefe('0x3c')]);logger[_0xfefe('0x3d')]('[%s][voiceCallReport][newstate]\x20event:',_0x3ad092[_0xfefe('0x3a')],util[_0xfefe('0x43')](_0x3ad092,{'showHidden':![],'depth':null}));if(_0x3ad092['uniqueid']!==_0x3ad092[_0xfefe('0x3e')]){if(this[_0xfefe('0x1c')][_0x3ad092['linkedid']]){if(_0x3ad092['channelstate']==='6'){if(!this[_0xfefe('0x1c')][_0x3ad092['linkedid']][_0xfefe('0x64')]){var _0x1165db=moment();this[_0xfefe('0x1c')][_0x3ad092[_0xfefe('0x3e')]][_0xfefe('0x64')]=!![];this['channels'][_0x3ad092[_0xfefe('0x3e')]][_0xfefe('0x65')]=_0x1165db['format'](_0xfefe('0x4a'));if(this[_0xfefe('0x1c')][_0x3ad092[_0xfefe('0x3e')]][_0xfefe('0x48')]){this[_0xfefe('0x1c')][_0x3ad092[_0xfefe('0x3e')]][_0xfefe('0x66')]=_0x1165db[_0xfefe('0x67')](this['channels'][_0x3ad092[_0xfefe('0x3e')]][_0xfefe('0x48')],_0xfefe('0x5d'));}}this['channels'][_0x3ad092[_0xfefe('0x3e')]][_0xfefe('0x3e')]=_0x3ad092[_0xfefe('0x3a')];if(_0x3ad092[_0xfefe('0x3c')]!==_0xfefe('0x68')){this['channels'][_0x3ad092['linkedid']][_0xfefe('0x69')]=_0x3ad092[_0xfefe('0x3c')];}this[_0xfefe('0x1c')][_0x3ad092[_0xfefe('0x3e')]][_0xfefe('0x6a')]=_0x3ad092[_0xfefe('0x3b')];this[_0xfefe('0x1c')][_0x3ad092[_0xfefe('0x3e')]][_0xfefe('0x6b')]=_0x3ad092['channel'];this[_0xfefe('0x1c')][_0x3ad092[_0xfefe('0x3e')]][_0xfefe('0x4b')]=dispositions[_[_0xfefe('0x4c')](_0x3ad092[_0xfefe('0x4d')])];if(this[_0xfefe('0x1d')][_0x3ad092[_0xfefe('0x44')]['split']('-')[0x0]]){this[_0xfefe('0x1c')][_0x3ad092['linkedid']][_0xfefe('0x6c')]=this[_0xfefe('0x1d')][_0x3ad092[_0xfefe('0x44')][_0xfefe('0x50')]('-')[0x0]]['id'];this[_0xfefe('0x1c')][_0x3ad092['linkedid']]['membername']=this[_0xfefe('0x1d')][_0x3ad092[_0xfefe('0x44')][_0xfefe('0x50')]('-')[0x0]][_0xfefe('0x6d')];}}}}else{if(this[_0xfefe('0x1c')][_0x3ad092[_0xfefe('0x3a')]]){if(_0x3ad092[_0xfefe('0x4d')]==='6'){if(this[_0xfefe('0x1d')][_0x3ad092[_0xfefe('0x44')]['split']('-')[0x0]]){this['channels'][_0x3ad092[_0xfefe('0x3a')]][_0xfefe('0x6c')]=this['agents'][_0x3ad092[_0xfefe('0x44')][_0xfefe('0x50')]('-')[0x0]]['id'];this['channels'][_0x3ad092[_0xfefe('0x3a')]]['membername']=this[_0xfefe('0x1d')][_0x3ad092['channel'][_0xfefe('0x50')]('-')[0x0]][_0xfefe('0x6d')];}}}}}}catch(_0x4d436d){logger[_0xfefe('0x33')](_0xfefe('0x6e'),_0x3ad092[_0xfefe('0x3a')],util['inspect'](_0x4d436d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfefe('0x37')][_0xfefe('0x6f')]=function(_0x44bf1e,_0x286922){try{if(this[_0xfefe('0x1c')][_0x44bf1e]){logger[_0xfefe('0x30')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x44bf1e,_0x286922);this['channels'][_0x44bf1e][_0xfefe('0x70')]=!![];if(_[_0xfefe('0x71')](_0x286922,_0xfefe('0x72'))){_0x286922=_0x286922[_0xfefe('0x73')](_0xfefe('0x72'),_0xfefe('0x74'));}this['channels'][_0x44bf1e]['monitorFilename']=_0x286922;var _0x1820c4=_[_0xfefe('0x75')](this['channels'][_0x44bf1e][_0xfefe('0x76')],{'filename':_0x286922});if(_['isNil'](_0x1820c4)){this[_0xfefe('0x1c')][_0x44bf1e][_0xfefe('0x76')][_0xfefe('0x77')]({'filename':_0x286922,'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0xfefe('0x78')});}}}catch(_0x17ffb8){logger[_0xfefe('0x33')]('[%s][voiceCallReport][mixMonitorFilename]',_0x44bf1e,util[_0xfefe('0x43')](_0x17ffb8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfefe('0x37')][_0xfefe('0x26')]=function(_0x121543){try{if(this['isNotNull'](_0x121543)){logger[_0xfefe('0x3d')](_0xfefe('0x79'),_0x121543[_0xfefe('0x3a')],util[_0xfefe('0x43')](_0x121543,{'showHidden':![],'depth':null}));if(this[_0xfefe('0x1c')][_0x121543[_0xfefe('0x3a')]]&&_0x121543['channel']!=_0xfefe('0x45')){if(this[_0xfefe('0x35')](_0x121543[_0xfefe('0x7a')])){if(this[_0xfefe('0x35')](_0x121543[_0xfefe('0x7a')][_0xfefe('0x7b')])){logger[_0xfefe('0x30')](_0xfefe('0x7c'),_0x121543['uniqueid'],_0x121543['value']);this[_0xfefe('0x6f')](_0x121543['uniqueid'],_0x121543[_0xfefe('0x7d')]);}else if(this['isNotNull'](_0x121543[_0xfefe('0x7a')]['xmd-phone'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x121543[_0xfefe('0x3a')],_0x121543[_0xfefe('0x7d')]);this['channels'][_0x121543['uniqueid']][_0xfefe('0x3c')]=_0x121543[_0xfefe('0x7d')];}else if(this[_0xfefe('0x35')](_0x121543[_0xfefe('0x7a')][_0xfefe('0x7e')])){logger[_0xfefe('0x30')](_0xfefe('0x7f'),_0x121543[_0xfefe('0x3a')],_0x121543[_0xfefe('0x7d')]);this['channels'][_0x121543[_0xfefe('0x3a')]][_0xfefe('0x80')]=_0x121543[_0xfefe('0x7d')];}else if(this[_0xfefe('0x35')](_0x121543[_0xfefe('0x7a')][_0xfefe('0x81')])){logger[_0xfefe('0x30')](_0xfefe('0x82'),_0x121543[_0xfefe('0x3a')],_0x121543[_0xfefe('0x7d')]);this['channels'][_0x121543['uniqueid']][_0xfefe('0x83')]=_0x121543[_0xfefe('0x7d')];}else if(this[_0xfefe('0x35')](_0x121543[_0xfefe('0x7a')][_0xfefe('0x84')])){logger[_0xfefe('0x30')](_0xfefe('0x85'),_0x121543[_0xfefe('0x3a')],_0x121543['value'][_0xfefe('0x50')](',')[0x0]);this[_0xfefe('0x1c')][_0x121543['uniqueid']][_0xfefe('0x10')]=_0x121543[_0xfefe('0x7d')][_0xfefe('0x50')](',')[0x0];}else if(this[_0xfefe('0x35')](_0x121543['variable'][_0xfefe('0x86')])){logger[_0xfefe('0x30')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x121543[_0xfefe('0x3a')],_0x121543[_0xfefe('0x7d')]);this[_0xfefe('0x1c')][_0x121543[_0xfefe('0x3a')]]['originatecalleridnum']=_0x121543[_0xfefe('0x7d')];}else if(this[_0xfefe('0x35')](_0x121543['variable'][_0xfefe('0x87')])){logger[_0xfefe('0x30')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x121543[_0xfefe('0x3a')],_0x121543['value']);this['channels'][_0x121543[_0xfefe('0x3a')]][_0xfefe('0x88')]=_0x121543[_0xfefe('0x7d')];}else if(this['isNotNull'](_0x121543[_0xfefe('0x7a')][_0xfefe('0x89')])){logger[_0xfefe('0x30')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x121543[_0xfefe('0x3a')],_0x121543['value']);this[_0xfefe('0x1c')][_0x121543[_0xfefe('0x3a')]][_0xfefe('0x8a')]=_0x121543[_0xfefe('0x7d')];}else if(this[_0xfefe('0x35')](_0x121543[_0xfefe('0x7a')][_0xfefe('0x8b')])){logger['info'](_0xfefe('0x8c'),_0x121543['uniqueid'],_0x121543[_0xfefe('0x7d')]);this[_0xfefe('0x1c')][_0x121543[_0xfefe('0x3a')]]['queue']=_0x121543[_0xfefe('0x7d')];}else if(this[_0xfefe('0x35')](_0x121543[_0xfefe('0x7a')][_0xfefe('0x8d')])){logger[_0xfefe('0x30')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x121543['uniqueid'],_0x121543[_0xfefe('0x7d')]);this['channels'][_0x121543['uniqueid']][_0xfefe('0x8e')]=_0x121543[_0xfefe('0x7d')];}}}else if(this[_0xfefe('0x35')](_0x121543['variable'][_0xfefe('0x7b')])){if(_0x121543['value']){var _0x35299f=path[_0xfefe('0x8f')](_0x121543[_0xfefe('0x7d')])[_0xfefe('0x6d')];logger[_0xfefe('0x30')](_0xfefe('0x7c'),_0x35299f,_0x121543[_0xfefe('0x7d')]);this[_0xfefe('0x6f')](_0x35299f,_0x121543['value']);}}else if(this[_0xfefe('0x1c')][_0x121543[_0xfefe('0x3e')]]){if(this[_0xfefe('0x35')](_0x121543[_0xfefe('0x7a')])){if(this['isNotNull'](_0x121543[_0xfefe('0x7a')][_0xfefe('0x8d')])){logger[_0xfefe('0x30')](_0xfefe('0x90'),_0x121543[_0xfefe('0x3e')],_0x121543[_0xfefe('0x7d')]);this[_0xfefe('0x1c')][_0x121543[_0xfefe('0x3e')]][_0xfefe('0x91')]=_0x121543['value'];}}}}}catch(_0x5f128){logger[_0xfefe('0x33')](_0xfefe('0x92'),_0x121543[_0xfefe('0x3a')],util[_0xfefe('0x43')](_0x5f128,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xfefe('0x27')]=function(_0x2c046f){try{if(this[_0xfefe('0x35')](_0x2c046f)){logger[_0xfefe('0x3d')](_0xfefe('0x93'),_0x2c046f[_0xfefe('0x3a')],util['inspect'](_0x2c046f,{'showHidden':![],'depth':null}));if(this[_0xfefe('0x1c')][_0x2c046f['uniqueid']]){logger['info'](_0xfefe('0x94'),_0x2c046f[_0xfefe('0x3a')],_0x2c046f['cause-txt']);var _0x41cf13=moment();this[_0xfefe('0x1c')][_0x2c046f[_0xfefe('0x3a')]][_0xfefe('0x95')]=_0x41cf13[_0xfefe('0x49')](_0xfefe('0x4a'));this[_0xfefe('0x1c')][_0x2c046f[_0xfefe('0x3a')]][_0xfefe('0x5b')]=_0x41cf13[_0xfefe('0x67')](this[_0xfefe('0x1c')][_0x2c046f['uniqueid']]['starttime'],_0xfefe('0x5d'));if(this[_0xfefe('0x1c')][_0x2c046f['uniqueid']]['answered']){this[_0xfefe('0x1c')][_0x2c046f[_0xfefe('0x3a')]][_0xfefe('0x96')]=_0x41cf13[_0xfefe('0x67')](this[_0xfefe('0x1c')][_0x2c046f[_0xfefe('0x3a')]][_0xfefe('0x65')],_0xfefe('0x5d'));this[_0xfefe('0x1c')][_0x2c046f[_0xfefe('0x3a')]][_0xfefe('0x66')]=this[_0xfefe('0x1c')][_0x2c046f[_0xfefe('0x3a')]][_0xfefe('0x5b')]-this[_0xfefe('0x1c')][_0x2c046f[_0xfefe('0x3a')]][_0xfefe('0x96')];}if(_0x2c046f['context']===_0xfefe('0x4f')){if(this[_0xfefe('0x1d')][_0x2c046f[_0xfefe('0x44')][_0xfefe('0x50')]('-')[0x0]]){this['agents'][_0x2c046f['channel'][_0xfefe('0x50')]('-')[0x0]]=_['omit'](this[_0xfefe('0x1d')][_0x2c046f[_0xfefe('0x44')][_0xfefe('0x50')]('-')[0x0]],[_0xfefe('0x51')]);logger[_0xfefe('0x3d')](_0xfefe('0x97'),_0x2c046f[_0xfefe('0x3a')],util['inspect']({'destaccountcode':this[_0xfefe('0x1d')][_0x2c046f['channel'][_0xfefe('0x50')]('-')[0x0]][_0xfefe('0x53')]},{'showHidden':![],'depth':null}));this[_0xfefe('0x38')](util[_0xfefe('0x49')](_0xfefe('0x54'),this['agents'][_0x2c046f[_0xfefe('0x44')]['split']('-')[0x0]][_0xfefe('0x6d')]),_0xfefe('0x98'),{'destaccountcode':this['agents'][_0x2c046f[_0xfefe('0x44')][_0xfefe('0x50')]('-')[0x0]][_0xfefe('0x53')]});}}if(_0x2c046f[_0xfefe('0x99')]===_0xfefe('0x9a')){this[_0xfefe('0x9b')][_0x2c046f['uniqueid']]=this['channels'][_0x2c046f['uniqueid']];}else{if(this[_0xfefe('0x1c')][_0x2c046f[_0xfefe('0x3a')]][_0xfefe('0x83')]===_0xfefe('0x9c')&&this['blindTransfers'][_0x2c046f[_0xfefe('0x3a')]]){this[_0xfefe('0x1c')][_0x2c046f[_0xfefe('0x3a')]][_0xfefe('0x3a')]=[this[_0xfefe('0x1c')][_0x2c046f[_0xfefe('0x3a')]]['linkedid'],this[_0xfefe('0x1c')][_0x2c046f[_0xfefe('0x3a')]][_0xfefe('0x3e')]=this[_0xfefe('0x1c')][_0x2c046f[_0xfefe('0x3a')]][_0xfefe('0x3a')]][0x0];delete this['blindTransfers'][_0x2c046f[_0xfefe('0x3a')]];}}logger[_0xfefe('0x3d')](_0xfefe('0x9d'),_0x2c046f['uniqueid'],util[_0xfefe('0x43')](this[_0xfefe('0x1c')][_0x2c046f[_0xfefe('0x3a')]],{'showHidden':![],'depth':null}));ami[_0xfefe('0x38')]('custom:voiceCallReport',this['channels'][_0x2c046f[_0xfefe('0x3a')]]);delete this[_0xfefe('0x1c')][_0x2c046f[_0xfefe('0x3a')]];}}}catch(_0xdcb5e9){logger[_0xfefe('0x33')](_0xfefe('0x9e'),_0x2c046f[_0xfefe('0x3a')],util['inspect'](_0xdcb5e9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfefe('0x37')][_0xfefe('0x2a')]=function(_0x4dac58){try{if(this[_0xfefe('0x35')](_0x4dac58)){logger[_0xfefe('0x30')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x4dac58[_0xfefe('0x3a')],_0x4dac58['origtransferercalleridnum'],_0x4dac58['transfertargetcalleridnum']);logger['debug'](_0xfefe('0x9f'),_0x4dac58[_0xfefe('0x3a')],util[_0xfefe('0x43')](_0x4dac58,{'showHidden':![],'depth':null}));if(this['channels'][_0x4dac58[_0xfefe('0xa0')]]){this[_0xfefe('0x1c')][_0x4dac58[_0xfefe('0xa0')]]['transfercalleridnum']=_0x4dac58['origtransferercalleridnum'];this[_0xfefe('0x1c')][_0x4dac58[_0xfefe('0xa0')]][_0xfefe('0xa1')]=_0x4dac58[_0xfefe('0xa2')];if(this['channels'][_0x4dac58[_0xfefe('0xa3')]]){var _0x2ad60f=this[_0xfefe('0x1c')][_0x4dac58[_0xfefe('0xa3')]];this[_0xfefe('0x1c')][_0x4dac58[_0xfefe('0xa3')]]=this[_0xfefe('0x1c')][_0x4dac58[_0xfefe('0xa0')]];this[_0xfefe('0x1c')][_0x4dac58[_0xfefe('0xa0')]]=_0x2ad60f;}}else if(this[_0xfefe('0x1c')][_0x4dac58['transfertargetuniqueid']]){this['channels'][_0x4dac58[_0xfefe('0xa4')]][_0xfefe('0xa5')]=_0x4dac58['origtransferercalleridnum'];this['channels'][_0x4dac58['transfertargetuniqueid']][_0xfefe('0xa1')]=_0x4dac58[_0xfefe('0xa2')];if(this[_0xfefe('0x1c')][_0x4dac58[_0xfefe('0xa6')]]){var _0x2ad60f=this[_0xfefe('0x1c')][_0x4dac58[_0xfefe('0xa6')]];this[_0xfefe('0x1c')][_0x4dac58[_0xfefe('0xa6')]]=this['channels'][_0x4dac58[_0xfefe('0xa4')]];this[_0xfefe('0x1c')][_0x4dac58[_0xfefe('0xa4')]]=_0x2ad60f;}}}}catch(_0x519b7e){logger[_0xfefe('0x33')](_0xfefe('0xa7'),_0x4dac58[_0xfefe('0x3a')],util[_0xfefe('0x43')](_0x519b7e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfefe('0x37')][_0xfefe('0x2b')]=function(_0x35c8e5){try{if(this['isNotNull'](_0x35c8e5)){logger[_0xfefe('0x30')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x35c8e5[_0xfefe('0x3a')],_0x35c8e5[_0xfefe('0xa8')],_0x35c8e5[_0xfefe('0xa9')]);logger[_0xfefe('0x3d')](_0xfefe('0xaa'),_0x35c8e5['uniqueid'],util[_0xfefe('0x43')](_0x35c8e5,{'showHidden':![],'depth':null}));if(this[_0xfefe('0x1c')][_0x35c8e5[_0xfefe('0xa0')]]){this[_0xfefe('0x1c')][_0x35c8e5[_0xfefe('0xa0')]]['transfercalleridnum']=_0x35c8e5[_0xfefe('0xa8')];this['channels'][_0x35c8e5[_0xfefe('0xa0')]][_0xfefe('0xa1')]=_0x35c8e5['extension'];this[_0xfefe('0x27')]({'event':_0xfefe('0x9a'),'uniqueid':_0x35c8e5['transfereeuniqueid'],'context':_0x35c8e5[_0xfefe('0x4e')],'channel':_0x35c8e5['transfererchannel']});}}}catch(_0x39c779){logger[_0xfefe('0x33')](_0xfefe('0xab'),_0x35c8e5['uniqueid'],util[_0xfefe('0x43')](_0x39c779,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfefe('0x37')][_0xfefe('0x2d')]=function(_0x1f170f){try{if(this['isNotNull'](_0x1f170f)){logger[_0xfefe('0x3d')](_0xfefe('0xac'),_0x1f170f[_0xfefe('0x3a')],util[_0xfefe('0x43')](_0x1f170f,{'showHidden':![],'depth':null}));if(this[_0xfefe('0x1c')][_0x1f170f[_0xfefe('0x3a')]]){if(!_[_0xfefe('0xad')](this[_0xfefe('0x1c')][_0x1f170f[_0xfefe('0x3a')]][_0xfefe('0x65')])){this['channels'][_0x1f170f['uniqueid']][_0xfefe('0xae')]=moment()[_0xfefe('0x49')](_0xfefe('0x4a'));logger[_0xfefe('0x30')](_0xfefe('0xaf'),_0x1f170f[_0xfefe('0x3a')],this[_0xfefe('0x1c')][_0x1f170f[_0xfefe('0x3a')]]['mohstarttime']);}}}}catch(_0xb1b78){logger['error'](_0xfefe('0xb0'),_0x1f170f[_0xfefe('0x3a')],util[_0xfefe('0x43')](_0xb1b78,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfefe('0x37')]['syncMusicOnHoldStop']=function(_0x1897a4){try{if(this[_0xfefe('0x35')](_0x1897a4)){logger[_0xfefe('0x3d')](_0xfefe('0xb1'),_0x1897a4[_0xfefe('0x3a')],util[_0xfefe('0x43')](_0x1897a4,{'showHidden':![],'depth':null}));if(this[_0xfefe('0x1c')][_0x1897a4['uniqueid']]){if(!_['isNil'](this[_0xfefe('0x1c')][_0x1897a4['uniqueid']]['mohstarttime'])){this[_0xfefe('0x1c')][_0x1897a4[_0xfefe('0x3a')]][_0xfefe('0xb2')]+=moment()[_0xfefe('0xb3')](0x0)['diff'](this[_0xfefe('0x1c')][_0x1897a4['uniqueid']][_0xfefe('0xae')],'seconds');logger[_0xfefe('0x30')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x1897a4[_0xfefe('0x3a')],this[_0xfefe('0x1c')][_0x1897a4[_0xfefe('0x3a')]][_0xfefe('0xb2')]);delete this['channels'][_0x1897a4[_0xfefe('0x3a')]]['mohstarttime'];}}}}catch(_0x3b90d9){logger[_0xfefe('0x33')](_0xfefe('0xb4'),_0x1897a4[_0xfefe('0x3a')],util[_0xfefe('0x43')](_0x3b90d9,{'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 5b4ed7c..ab4869f 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 _0xcbdd=['[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','[%s][voiceDialReport][hangup]','moment','util','ioredis','../../../config/environment','ami','redis','localhost','socket.io-emitter','channels','outboundChannels','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','syncHangup','isNotNull','isUndefined','emit','debug','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','substring','channel','lastIndexOf','omit','event','privilege','info','membername','interface','inspect','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialbegin]','prototype','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','keys','variable','value','outboundrouteid','variables','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepvtcallid','memberinterface','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','starttime','seconds','outbound','total','holdtime','diff','sumHoldTime','duration','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice:outbound','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify'];(function(_0xf034cc,_0x2ab7bf){var _0x3568d3=function(_0x212132){while(--_0x212132){_0xf034cc['push'](_0xf034cc['shift']());}};_0x3568d3(++_0x2ab7bf);}(_0xcbdd,0x118));var _0xdcbd=function(_0x93fe6b,_0x47ba1e){_0x93fe6b=_0x93fe6b-0x0;var _0x27dbf2=_0xcbdd[_0x93fe6b];return _0x27dbf2;};'use strict';var _=require('lodash');var moment=require(_0xdcbd('0x0'));var util=require(_0xdcbd('0x1'));var Redis=require(_0xdcbd('0x2'));var config=require(_0xdcbd('0x3'));var logger=require('../../../config/logger')(_0xdcbd('0x4'));var ami=require('../ami');config[_0xdcbd('0x5')]=_['defaults'](config['redis'],{'host':_0xdcbd('0x6'),'port':0x18eb});var io=require(_0xdcbd('0x7'))(new Redis(config['redis']));function VoiceDialReport(_0x6c678e){this[_0xdcbd('0x8')]=_0x6c678e[_0xdcbd('0x9')];this['outbound']=_0x6c678e['outbound'];this['variables']={};ami['on']('dialbegin',this[_0xdcbd('0xa')][_0xdcbd('0xb')](this));ami['on'](_0xdcbd('0xc'),this[_0xdcbd('0xd')][_0xdcbd('0xb')](this));ami['on'](_0xdcbd('0xe'),this[_0xdcbd('0xf')]['bind'](this));ami['on']('hangup',this[_0xdcbd('0x10')][_0xdcbd('0xb')](this));}VoiceDialReport['prototype'][_0xdcbd('0x11')]=function(_0x5da567){return _0x5da567!==null&&!_[_0xdcbd('0x12')](_0x5da567);};VoiceDialReport['prototype']['emit']=function(_0x4976d1,_0x5ebae8,_0x7f4621){io['to'](_0x4976d1)[_0xdcbd('0x13')](_0x5ebae8,_0x7f4621);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x30b67e){try{if(this[_0xdcbd('0x11')](_0x30b67e)){logger[_0xdcbd('0x14')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x30b67e[_0xdcbd('0x15')],util['inspect'](_0x30b67e,{'showHidden':![],'depth':null}));if(this[_0xdcbd('0x8')][_0x30b67e['uniqueid']]){_[_0xdcbd('0x16')](this[_0xdcbd('0x8')][_0x30b67e['uniqueid']],{'starttime':moment()[_0xdcbd('0x17')](_0xdcbd('0x18')),'lastevent':_0xdcbd('0x19'),'interface':_0x30b67e['channel'][_0xdcbd('0x1a')](0x0,_0x30b67e[_0xdcbd('0x1b')][_0xdcbd('0x1c')]('-')),'membername':_0x30b67e[_0xdcbd('0x1b')][_0xdcbd('0x1a')](_0x30b67e['channel']['lastIndexOf']('/')+0x1,_0x30b67e['channel'][_0xdcbd('0x1c')]('-'))},_[_0xdcbd('0x1d')](_0x30b67e,[_0xdcbd('0x1e'),_0xdcbd('0x1f')]));logger[_0xdcbd('0x20')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x30b67e[_0xdcbd('0x15')],this['channels'][_0x30b67e[_0xdcbd('0x15')]][_0xdcbd('0x21')],this['channels'][_0x30b67e[_0xdcbd('0x15')]][_0xdcbd('0x22')]);logger['debug']('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x30b67e['uniqueid'],util[_0xdcbd('0x23')](this['channels'][_0x30b67e[_0xdcbd('0x15')]],{'showHidden':![],'depth':null}));this[_0xdcbd('0x13')]('voice:outbound','voice_outbound_channel:save',this[_0xdcbd('0x8')][_0x30b67e[_0xdcbd('0x15')]]);logger[_0xdcbd('0x14')](_0xdcbd('0x24'),_0x30b67e[_0xdcbd('0x15')],util[_0xdcbd('0x23')](this[_0xdcbd('0x8')][_0x30b67e[_0xdcbd('0x15')]],{'showHidden':![],'depth':null}));ami[_0xdcbd('0x13')]('custom:dialbegin',this[_0xdcbd('0x8')][_0x30b67e[_0xdcbd('0x15')]]);}}}catch(_0x4de0eb){logger[_0xdcbd('0x25')](_0xdcbd('0x26'),_0x30b67e[_0xdcbd('0x15')],util[_0xdcbd('0x23')](_0x4de0eb,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdcbd('0x27')][_0xdcbd('0xd')]=function(_0xf1154){try{if(this['isNotNull'](_0xf1154)){logger[_0xdcbd('0x14')](_0xdcbd('0x28'),_0xf1154[_0xdcbd('0x15')],util[_0xdcbd('0x23')](_0xf1154,{'showHidden':![],'depth':null}));if(this[_0xdcbd('0x8')][_0xf1154[_0xdcbd('0x15')]]){this[_0xdcbd('0x8')][_0xf1154[_0xdcbd('0x15')]][_0xdcbd('0x29')]=_0xf1154[_0xdcbd('0x29')];if(_0xf1154[_0xdcbd('0x29')]===_0xdcbd('0x2a')){this[_0xdcbd('0x8')][_0xf1154[_0xdcbd('0x15')]][_0xdcbd('0x2b')]=_0xf1154[_0xdcbd('0x2b')];this[_0xdcbd('0x8')][_0xf1154[_0xdcbd('0x15')]][_0xdcbd('0x2c')]=_0xf1154[_0xdcbd('0x2c')];this[_0xdcbd('0x8')][_0xf1154['uniqueid']][_0xdcbd('0x2d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xdcbd('0x8')][_0xf1154[_0xdcbd('0x15')]][_0xdcbd('0x2e')]='connect';logger[_0xdcbd('0x20')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0xf1154[_0xdcbd('0x15')],_0xf1154['channel']['substring'](_0xf1154[_0xdcbd('0x1b')]['lastIndexOf']('/')+0x1,_0xf1154['channel']['lastIndexOf']('-')));logger[_0xdcbd('0x14')](_0xdcbd('0x2f'),_0xf1154[_0xdcbd('0x15')],util['inspect'](this[_0xdcbd('0x8')][_0xf1154[_0xdcbd('0x15')]],{'showHidden':![],'depth':null}));ami[_0xdcbd('0x13')]('custom:dialconnect',this[_0xdcbd('0x8')][_0xf1154[_0xdcbd('0x15')]]);}logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0xf1154[_0xdcbd('0x15')],util['inspect'](this[_0xdcbd('0x8')][_0xf1154['uniqueid']],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0xdcbd('0x30'),this[_0xdcbd('0x8')][_0xf1154[_0xdcbd('0x15')]]);}}}catch(_0x11b3db){logger[_0xdcbd('0x25')](_0xdcbd('0x31'),_0xf1154['uniqueid'],util[_0xdcbd('0x23')](_0x11b3db,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdcbd('0x27')]['syncVarSet']=function(_0x30238a){try{if(this[_0xdcbd('0x11')](_0x30238a)){logger[_0xdcbd('0x14')](_0xdcbd('0x32'),_0x30238a[_0xdcbd('0x15')],util[_0xdcbd('0x23')](_0x30238a,{'showHidden':![],'depth':null}));this['addVariable'](_0x30238a[_0xdcbd('0x15')],_[_0xdcbd('0x33')](_0x30238a[_0xdcbd('0x34')])[0x0],_0x30238a[_0xdcbd('0x35')]);if(this[_0xdcbd('0x11')](_0x30238a[_0xdcbd('0x34')])&&this[_0xdcbd('0x11')](_0x30238a[_0xdcbd('0x34')][_0xdcbd('0x36')])){if(_[_0xdcbd('0x12')](this[_0xdcbd('0x8')][_0x30238a['uniqueid']])){this['channels'][_0x30238a[_0xdcbd('0x15')]]={'routeId':_0x30238a[_0xdcbd('0x35')],'variables':this[_0xdcbd('0x37')][_0x30238a[_0xdcbd('0x15')]]};logger['info'](_0xdcbd('0x38'),_0x30238a[_0xdcbd('0x15')],_0x30238a[_0xdcbd('0x34')][_0xdcbd('0x36')],_[_0xdcbd('0x33')](_0x30238a[_0xdcbd('0x34')])[0x0],_0x30238a[_0xdcbd('0x35')]);logger[_0xdcbd('0x14')](_0xdcbd('0x39'),_0x30238a['uniqueid'],util[_0xdcbd('0x23')](this['channels'][_0x30238a['uniqueid']],{'showHidden':![],'depth':null}));this[_0xdcbd('0x13')]('voice:outbound','voice_outbound_channel:save',this[_0xdcbd('0x8')][_0x30238a[_0xdcbd('0x15')]]);}}}}catch(_0x5cf701){logger[_0xdcbd('0x25')]('[%s][voiceDialReport][varset]',_0x30238a['uniqueid'],util[_0xdcbd('0x23')](_0x5cf701,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdcbd('0x27')]['addVariable']=function(_0x374127,_0x207f03,_0x911db){var _0x20fba6=[_0xdcbd('0x3a'),_0xdcbd('0x3b'),_0xdcbd('0x3c'),'rtpaudioqosjitterbridged',_0xdcbd('0x3d'),_0xdcbd('0x3e'),_0xdcbd('0x3f'),_0xdcbd('0x40'),_0xdcbd('0x41'),'sipuri','bridgepeer',_0xdcbd('0x42'),'membercalls','memberdynamic',_0xdcbd('0x43'),'memberlastcall',_0xdcbd('0x21'),'memberpenalty',_0xdcbd('0x44')];if(!_[_0xdcbd('0x45')](_0x207f03)&&!_[_0xdcbd('0x46')](_0x20fba6,_0x207f03)){if(_[_0xdcbd('0x12')](this[_0xdcbd('0x37')][_0x374127])){this[_0xdcbd('0x37')][_0x374127]={};}this[_0xdcbd('0x37')][_0x374127][_0x207f03]=_0x911db;}};VoiceDialReport[_0xdcbd('0x27')][_0xdcbd('0x10')]=function(_0xca5ed){try{if(this[_0xdcbd('0x11')](_0xca5ed)){logger[_0xdcbd('0x14')]('[%s][voiceDialReport][hangup]\x20event:',_0xca5ed[_0xdcbd('0x15')],util[_0xdcbd('0x23')](_0xca5ed,{'showHidden':![],'depth':null}));if(this[_0xdcbd('0x8')][_0xca5ed[_0xdcbd('0x15')]]){logger[_0xdcbd('0x20')](_0xdcbd('0x47'),_0xca5ed[_0xdcbd('0x15')],_0xca5ed[_0xdcbd('0x48')]);this[_0xdcbd('0x8')][_0xca5ed[_0xdcbd('0x15')]][_0xdcbd('0x49')]=moment()[_0xdcbd('0x17')](_0xdcbd('0x18'));this['channels'][_0xca5ed['uniqueid']]['duration']=moment(this['channels'][_0xca5ed[_0xdcbd('0x15')]]['endtime'])['diff'](this[_0xdcbd('0x8')][_0xca5ed['uniqueid']][_0xdcbd('0x4a')],_0xdcbd('0x4b'));this[_0xdcbd('0x8')][_0xca5ed[_0xdcbd('0x15')]]['lastevent']='complete';this[_0xdcbd('0x4c')][_0xdcbd('0x4d')]+=0x1;if(this[_0xdcbd('0x8')][_0xca5ed['uniqueid']][_0xdcbd('0x2d')]){this[_0xdcbd('0x4c')]['answered']+=0x1;this[_0xdcbd('0x8')][_0xca5ed[_0xdcbd('0x15')]][_0xdcbd('0x4e')]=moment(this[_0xdcbd('0x8')][_0xca5ed['uniqueid']]['answertime'])[_0xdcbd('0x4f')](this[_0xdcbd('0x8')][_0xca5ed['uniqueid']][_0xdcbd('0x4a')],'seconds');this[_0xdcbd('0x8')][_0xca5ed[_0xdcbd('0x15')]]['billableseconds']=moment(this[_0xdcbd('0x8')][_0xca5ed[_0xdcbd('0x15')]][_0xdcbd('0x49')])['diff'](this[_0xdcbd('0x8')][_0xca5ed[_0xdcbd('0x15')]][_0xdcbd('0x2d')],'seconds');this[_0xdcbd('0x4c')][_0xdcbd('0x50')]+=this['channels'][_0xca5ed[_0xdcbd('0x15')]][_0xdcbd('0x4e')]||0x0;this['outbound']['sumBillable']+=this[_0xdcbd('0x8')][_0xca5ed[_0xdcbd('0x15')]]['billableseconds'];}this['outbound']['sumDuration']+=this[_0xdcbd('0x8')][_0xca5ed['uniqueid']][_0xdcbd('0x51')];logger[_0xdcbd('0x14')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0xca5ed[_0xdcbd('0x15')],util[_0xdcbd('0x23')](this[_0xdcbd('0x8')][_0xca5ed['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xdcbd('0x13')](_0xdcbd('0x52'),this[_0xdcbd('0x8')][_0xca5ed[_0xdcbd('0x15')]]);logger[_0xdcbd('0x14')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0xca5ed[_0xdcbd('0x15')],util['inspect'](this[_0xdcbd('0x8')][_0xca5ed[_0xdcbd('0x15')]],{'showHidden':![],'depth':null}));ami[_0xdcbd('0x13')](_0xdcbd('0x53'),this['channels'][_0xca5ed[_0xdcbd('0x15')]]);logger['debug'](_0xdcbd('0x54'),_0xca5ed[_0xdcbd('0x15')],util[_0xdcbd('0x23')](this['channels'][_0xca5ed[_0xdcbd('0x15')]],{'showHidden':![],'depth':null}));this[_0xdcbd('0x13')](_0xdcbd('0x55'),'voice_outbound:save',this[_0xdcbd('0x4c')]);logger['info'](_0xdcbd('0x56'),JSON[_0xdcbd('0x57')](this[_0xdcbd('0x8')][_0xca5ed[_0xdcbd('0x15')]]));logger[_0xdcbd('0x14')](_0xdcbd('0x58'),_0xca5ed[_0xdcbd('0x15')],util['inspect'](this[_0xdcbd('0x8')][_0xca5ed[_0xdcbd('0x15')]],{'showHidden':![],'depth':null}));this[_0xdcbd('0x13')]('voice:outbound',_0xdcbd('0x59'),this[_0xdcbd('0x8')][_0xca5ed[_0xdcbd('0x15')]]);delete this['channels'][_0xca5ed['uniqueid']];}else if(this[_0xdcbd('0x8')][_0xca5ed[_0xdcbd('0x5a')]]){this[_0xdcbd('0x8')][_0xca5ed[_0xdcbd('0x5a')]][_0xdcbd('0x15')]=this['channels'][_0xca5ed['linkedid']]['destuniqueid'];}if(this['variables'][_0xca5ed[_0xdcbd('0x15')]]){delete this['variables'][_0xca5ed['uniqueid']];}}}catch(_0x1f633e){logger[_0xdcbd('0x25')](_0xdcbd('0x5b'),_0xca5ed[_0xdcbd('0x15')],util[_0xdcbd('0x23')](_0x1f633e,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0x74fb=['localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','bind','syncDialEnd','varset','syncVarSet','hangup','prototype','isNotNull','isUndefined','emit','debug','inspect','uniqueid','merge','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','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','answertime','format','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','syncHangup','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','complete','answered','holdtime','starttime','seconds','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%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','exports','lodash','moment','../../../config/environment','ami','../ami','redis'];(function(_0x8983aa,_0x374f9a){var _0x23080f=function(_0x5b9a8e){while(--_0x5b9a8e){_0x8983aa['push'](_0x8983aa['shift']());}};_0x23080f(++_0x374f9a);}(_0x74fb,0x192));var _0xb74f=function(_0x1a7d96,_0xd0d9dd){_0x1a7d96=_0x1a7d96-0x0;var _0x5443ca=_0x74fb[_0x1a7d96];return _0x5443ca;};'use strict';var _=require(_0xb74f('0x0'));var moment=require(_0xb74f('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xb74f('0x2'));var logger=require('../../../config/logger')(_0xb74f('0x3'));var ami=require(_0xb74f('0x4'));config[_0xb74f('0x5')]=_['defaults'](config[_0xb74f('0x5')],{'host':_0xb74f('0x6'),'port':0x18eb});var io=require(_0xb74f('0x7'))(new Redis(config[_0xb74f('0x5')]));function VoiceDialReport(_0x4e8f30){this[_0xb74f('0x8')]=_0x4e8f30[_0xb74f('0x9')];this[_0xb74f('0xa')]=_0x4e8f30[_0xb74f('0xa')];this[_0xb74f('0xb')]={};ami['on']('dialbegin',this['syncDialBegin'][_0xb74f('0xc')](this));ami['on']('dialend',this[_0xb74f('0xd')][_0xb74f('0xc')](this));ami['on'](_0xb74f('0xe'),this[_0xb74f('0xf')]['bind'](this));ami['on'](_0xb74f('0x10'),this['syncHangup'][_0xb74f('0xc')](this));}VoiceDialReport[_0xb74f('0x11')][_0xb74f('0x12')]=function(_0x3caf1a){return _0x3caf1a!==null&&!_[_0xb74f('0x13')](_0x3caf1a);};VoiceDialReport[_0xb74f('0x11')][_0xb74f('0x14')]=function(_0x41bb9d,_0x2b933d,_0x188ff2){io['to'](_0x41bb9d)['emit'](_0x2b933d,_0x188ff2);};VoiceDialReport[_0xb74f('0x11')]['syncDialBegin']=function(_0x2b34f0){try{if(this['isNotNull'](_0x2b34f0)){logger[_0xb74f('0x15')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x2b34f0['uniqueid'],util[_0xb74f('0x16')](_0x2b34f0,{'showHidden':![],'depth':null}));if(this['channels'][_0x2b34f0[_0xb74f('0x17')]]){_[_0xb74f('0x18')](this['channels'][_0x2b34f0[_0xb74f('0x17')]],{'starttime':moment()['format'](_0xb74f('0x19')),'lastevent':_0xb74f('0x1a'),'interface':_0x2b34f0[_0xb74f('0x1b')][_0xb74f('0x1c')](0x0,_0x2b34f0[_0xb74f('0x1b')][_0xb74f('0x1d')]('-')),'membername':_0x2b34f0[_0xb74f('0x1b')][_0xb74f('0x1c')](_0x2b34f0[_0xb74f('0x1b')][_0xb74f('0x1d')]('/')+0x1,_0x2b34f0[_0xb74f('0x1b')]['lastIndexOf']('-'))},_[_0xb74f('0x1e')](_0x2b34f0,[_0xb74f('0x1f'),_0xb74f('0x20')]));logger[_0xb74f('0x21')](_0xb74f('0x22'),_0x2b34f0[_0xb74f('0x17')],this[_0xb74f('0x8')][_0x2b34f0[_0xb74f('0x17')]][_0xb74f('0x23')],this['channels'][_0x2b34f0[_0xb74f('0x17')]]['interface']);logger[_0xb74f('0x15')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x2b34f0[_0xb74f('0x17')],util[_0xb74f('0x16')](this[_0xb74f('0x8')][_0x2b34f0['uniqueid']],{'showHidden':![],'depth':null}));this[_0xb74f('0x14')](_0xb74f('0x24'),_0xb74f('0x25'),this['channels'][_0x2b34f0[_0xb74f('0x17')]]);logger[_0xb74f('0x15')](_0xb74f('0x26'),_0x2b34f0[_0xb74f('0x17')],util['inspect'](this[_0xb74f('0x8')][_0x2b34f0[_0xb74f('0x17')]],{'showHidden':![],'depth':null}));ami[_0xb74f('0x14')](_0xb74f('0x27'),this['channels'][_0x2b34f0[_0xb74f('0x17')]]);}}}catch(_0x5e507e){logger[_0xb74f('0x28')](_0xb74f('0x29'),_0x2b34f0['uniqueid'],util[_0xb74f('0x16')](_0x5e507e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb74f('0x11')][_0xb74f('0xd')]=function(_0x20de20){try{if(this['isNotNull'](_0x20de20)){logger[_0xb74f('0x15')](_0xb74f('0x2a'),_0x20de20[_0xb74f('0x17')],util['inspect'](_0x20de20,{'showHidden':![],'depth':null}));if(this[_0xb74f('0x8')][_0x20de20[_0xb74f('0x17')]]){this[_0xb74f('0x8')][_0x20de20['uniqueid']][_0xb74f('0x2b')]=_0x20de20[_0xb74f('0x2b')];if(_0x20de20[_0xb74f('0x2b')]===_0xb74f('0x2c')){this['channels'][_0x20de20[_0xb74f('0x17')]][_0xb74f('0x2d')]=_0x20de20[_0xb74f('0x2d')];this['channels'][_0x20de20[_0xb74f('0x17')]][_0xb74f('0x2e')]=_0x20de20[_0xb74f('0x2e')];this[_0xb74f('0x8')][_0x20de20[_0xb74f('0x17')]][_0xb74f('0x2f')]=moment()[_0xb74f('0x30')](_0xb74f('0x19'));this[_0xb74f('0x8')][_0x20de20[_0xb74f('0x17')]][_0xb74f('0x31')]=_0xb74f('0x32');logger['info'](_0xb74f('0x33'),_0x20de20[_0xb74f('0x17')],_0x20de20[_0xb74f('0x1b')][_0xb74f('0x1c')](_0x20de20['channel'][_0xb74f('0x1d')]('/')+0x1,_0x20de20[_0xb74f('0x1b')]['lastIndexOf']('-')));logger[_0xb74f('0x15')](_0xb74f('0x34'),_0x20de20['uniqueid'],util[_0xb74f('0x16')](this[_0xb74f('0x8')][_0x20de20[_0xb74f('0x17')]],{'showHidden':![],'depth':null}));ami[_0xb74f('0x14')](_0xb74f('0x35'),this[_0xb74f('0x8')][_0x20de20['uniqueid']]);}logger[_0xb74f('0x15')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x20de20['uniqueid'],util[_0xb74f('0x16')](this[_0xb74f('0x8')][_0x20de20[_0xb74f('0x17')]],{'showHidden':![],'depth':null}));this[_0xb74f('0x14')](_0xb74f('0x24'),'voice_outbound_channel:save',this[_0xb74f('0x8')][_0x20de20['uniqueid']]);}}}catch(_0x2001ec){logger[_0xb74f('0x28')]('[%s][voiceDialReport][dialend]',_0x20de20[_0xb74f('0x17')],util['inspect'](_0x2001ec,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb74f('0x11')][_0xb74f('0xf')]=function(_0x16a5af){try{if(this['isNotNull'](_0x16a5af)){logger[_0xb74f('0x15')](_0xb74f('0x36'),_0x16a5af[_0xb74f('0x17')],util[_0xb74f('0x16')](_0x16a5af,{'showHidden':![],'depth':null}));this[_0xb74f('0x37')](_0x16a5af['uniqueid'],_[_0xb74f('0x38')](_0x16a5af[_0xb74f('0x39')])[0x0],_0x16a5af[_0xb74f('0x3a')]);if(this[_0xb74f('0x12')](_0x16a5af[_0xb74f('0x39')])&&this['isNotNull'](_0x16a5af['variable'][_0xb74f('0x3b')])){if(_[_0xb74f('0x13')](this[_0xb74f('0x8')][_0x16a5af[_0xb74f('0x17')]])){this[_0xb74f('0x8')][_0x16a5af[_0xb74f('0x17')]]={'routeId':_0x16a5af['value'],'variables':this['variables'][_0x16a5af[_0xb74f('0x17')]]};logger['info'](_0xb74f('0x3c'),_0x16a5af['uniqueid'],_0x16a5af[_0xb74f('0x39')][_0xb74f('0x3b')],_[_0xb74f('0x38')](_0x16a5af['variable'])[0x0],_0x16a5af[_0xb74f('0x3a')]);logger[_0xb74f('0x15')](_0xb74f('0x3d'),_0x16a5af[_0xb74f('0x17')],util[_0xb74f('0x16')](this[_0xb74f('0x8')][_0x16a5af[_0xb74f('0x17')]],{'showHidden':![],'depth':null}));this[_0xb74f('0x14')]('voice:outbound',_0xb74f('0x25'),this[_0xb74f('0x8')][_0x16a5af[_0xb74f('0x17')]]);}}}}catch(_0x6525c0){logger['error'](_0xb74f('0x3e'),_0x16a5af[_0xb74f('0x17')],util['inspect'](_0x6525c0,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xb74f('0x37')]=function(_0x36c66d,_0x32682b,_0x29cf53){var _0x227f19=[_0xb74f('0x3f'),'rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss',_0xb74f('0x40'),_0xb74f('0x41'),'rtpaudioqosrttbridged',_0xb74f('0x42'),_0xb74f('0x43'),_0xb74f('0x44'),_0xb74f('0x45'),_0xb74f('0x46'),_0xb74f('0x47'),'memberinterface',_0xb74f('0x48'),_0xb74f('0x23'),_0xb74f('0x49'),_0xb74f('0x4a')];if(!_[_0xb74f('0x4b')](_0x32682b)&&!_[_0xb74f('0x4c')](_0x227f19,_0x32682b)){if(_[_0xb74f('0x13')](this[_0xb74f('0xb')][_0x36c66d])){this[_0xb74f('0xb')][_0x36c66d]={};}this[_0xb74f('0xb')][_0x36c66d][_0x32682b]=_0x29cf53;}};VoiceDialReport[_0xb74f('0x11')][_0xb74f('0x4d')]=function(_0x276229){try{if(this[_0xb74f('0x12')](_0x276229)){logger[_0xb74f('0x15')]('[%s][voiceDialReport][hangup]\x20event:',_0x276229[_0xb74f('0x17')],util['inspect'](_0x276229,{'showHidden':![],'depth':null}));if(this[_0xb74f('0x8')][_0x276229[_0xb74f('0x17')]]){logger[_0xb74f('0x21')](_0xb74f('0x4e'),_0x276229[_0xb74f('0x17')],_0x276229[_0xb74f('0x4f')]);this[_0xb74f('0x8')][_0x276229[_0xb74f('0x17')]][_0xb74f('0x50')]=moment()[_0xb74f('0x30')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb74f('0x8')][_0x276229[_0xb74f('0x17')]]['duration']=moment(this[_0xb74f('0x8')][_0x276229[_0xb74f('0x17')]][_0xb74f('0x50')])['diff'](this[_0xb74f('0x8')][_0x276229[_0xb74f('0x17')]]['starttime'],'seconds');this[_0xb74f('0x8')][_0x276229[_0xb74f('0x17')]][_0xb74f('0x31')]=_0xb74f('0x51');this[_0xb74f('0xa')]['total']+=0x1;if(this[_0xb74f('0x8')][_0x276229[_0xb74f('0x17')]][_0xb74f('0x2f')]){this[_0xb74f('0xa')][_0xb74f('0x52')]+=0x1;this[_0xb74f('0x8')][_0x276229['uniqueid']][_0xb74f('0x53')]=moment(this[_0xb74f('0x8')][_0x276229[_0xb74f('0x17')]]['answertime'])['diff'](this[_0xb74f('0x8')][_0x276229[_0xb74f('0x17')]][_0xb74f('0x54')],_0xb74f('0x55'));this[_0xb74f('0x8')][_0x276229[_0xb74f('0x17')]][_0xb74f('0x56')]=moment(this['channels'][_0x276229['uniqueid']][_0xb74f('0x50')])['diff'](this['channels'][_0x276229[_0xb74f('0x17')]]['answertime'],_0xb74f('0x55'));this[_0xb74f('0xa')][_0xb74f('0x57')]+=this['channels'][_0x276229[_0xb74f('0x17')]][_0xb74f('0x53')]||0x0;this[_0xb74f('0xa')][_0xb74f('0x58')]+=this['channels'][_0x276229[_0xb74f('0x17')]][_0xb74f('0x56')];}this[_0xb74f('0xa')][_0xb74f('0x59')]+=this['channels'][_0x276229[_0xb74f('0x17')]]['duration'];logger['debug'](_0xb74f('0x5a'),_0x276229[_0xb74f('0x17')],util[_0xb74f('0x16')](this[_0xb74f('0x8')][_0x276229[_0xb74f('0x17')]],{'showHidden':![],'depth':null}));ami[_0xb74f('0x14')](_0xb74f('0x5b'),this[_0xb74f('0x8')][_0x276229['uniqueid']]);logger[_0xb74f('0x15')](_0xb74f('0x5c'),_0x276229[_0xb74f('0x17')],util[_0xb74f('0x16')](this[_0xb74f('0x8')][_0x276229['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xb74f('0x5d'),this[_0xb74f('0x8')][_0x276229['uniqueid']]);logger['debug'](_0xb74f('0x5e'),_0x276229[_0xb74f('0x17')],util[_0xb74f('0x16')](this[_0xb74f('0x8')][_0x276229[_0xb74f('0x17')]],{'showHidden':![],'depth':null}));this['emit'](_0xb74f('0x24'),_0xb74f('0x5f'),this[_0xb74f('0xa')]);logger['info'](_0xb74f('0x60'),JSON[_0xb74f('0x61')](this[_0xb74f('0x8')][_0x276229[_0xb74f('0x17')]]));logger[_0xb74f('0x15')](_0xb74f('0x62'),_0x276229[_0xb74f('0x17')],util['inspect'](this['channels'][_0x276229[_0xb74f('0x17')]],{'showHidden':![],'depth':null}));this[_0xb74f('0x14')](_0xb74f('0x24'),_0xb74f('0x63'),this[_0xb74f('0x8')][_0x276229[_0xb74f('0x17')]]);delete this[_0xb74f('0x8')][_0x276229['uniqueid']];}else if(this[_0xb74f('0x8')][_0x276229['linkedid']]){this[_0xb74f('0x8')][_0x276229[_0xb74f('0x64')]][_0xb74f('0x17')]=this['channels'][_0x276229[_0xb74f('0x64')]]['destuniqueid'];}if(this[_0xb74f('0xb')][_0x276229[_0xb74f('0x17')]]){delete this[_0xb74f('0xb')][_0x276229[_0xb74f('0x17')]];}}}catch(_0x5e11e6){logger['error']('[%s][voiceDialReport][hangup]',_0x276229[_0xb74f('0x17')],util[_0xb74f('0x16')](_0x5e11e6,{'showHidden':![],'depth':null}));}};module[_0xb74f('0x65')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 5d96611..df48b05 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 _0x720c=['[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedin','emitVoiceQueueSummary','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','inbound','queuecallerjoinAt','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','push','[%s][voiceQueueReport][queuecallerabandon]','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitreason','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','last','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','[%s][voiceQueueReport][agentconnect]','queuecallercomplete','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexit','transfer','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','queuecallerexitAt','seconds','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','reason','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','addVariable','variable','value','CONTINUE','TIMEOUT','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberpenalty','memberrealtime','includes','[%s][voiceQueueReport][hangup]','length','diff','sumDuration','milliseconds','lastevent','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','syncAttendedTransfer','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','context','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','exports','lodash','util','md5','ioredis','../../../config/environment','ami','../ami','../model/queueReport','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','campaigns','variables','queuesummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncBlindTransfer','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','waiting','queueStatusComplete','clearZombieChannels','isNil','Action','status','channel','catch','No\x20such\x20channel','inspect','error','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','voice:queue:%s','name','voice_queue_channel:save','debug',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','voice_queue_presence:remove','type','strategy','answered','available','loggedIn','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','Trunk','callerid','Interval','stringify','[voiceQueueReport][','isNotNull','isUndefined','[voiceQueueReport][queues]','then','flagQueueSummary','[voiceQueueReport][queuesummary]','syncQueueSummary','queue'];(function(_0xfba99d,_0x479817){var _0x45694b=function(_0x6d9020){while(--_0x6d9020){_0xfba99d['push'](_0xfba99d['shift']());}};_0x45694b(++_0x479817);}(_0x720c,0x154));var _0xc720=function(_0x30a855,_0x18d680){_0x30a855=_0x30a855-0x0;var _0x342c97=_0x720c[_0x30a855];return _0x342c97;};'use strict';var _=require(_0xc720('0x0'));var moment=require('moment');var util=require(_0xc720('0x1'));var md5=require(_0xc720('0x2'));var Redis=require(_0xc720('0x3'));var config=require(_0xc720('0x4'));var logger=require('../../../config/logger')(_0xc720('0x5'));var ami=require(_0xc720('0x6'));var QueueReport=require(_0xc720('0x7'));config[_0xc720('0x8')]=_[_0xc720('0x9')](config[_0xc720('0x8')],{'host':_0xc720('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc720('0x8')]));var Sequence=function(){};Sequence[_0xc720('0xb')][_0xc720('0xc')]=function(_0x1a2a00){this[_0xc720('0xd')]=this['tail']?this['tail'][_0xc720('0xe')](_0x1a2a00):_0x1a2a00();};function VoiceQueueReport(_0x4bea5d){this[_0xc720('0xf')]=new Sequence();this[_0xc720('0x10')]={};this['agents']=_0x4bea5d[_0xc720('0x11')];this[_0xc720('0x12')]=_0x4bea5d[_0xc720('0x13')];this[_0xc720('0x14')]=_0x4bea5d[_0xc720('0x14')];this['flagQueueSummary']=!![];this[_0xc720('0x15')]=_0x4bea5d[_0xc720('0x15')];this[_0xc720('0x16')]={};ami['on'](_0xc720('0x17'),this['syncQueueSummary'][_0xc720('0x18')](this));ami['on'](_0xc720('0x19'),this[_0xc720('0x1a')]['bind'](this));ami['on'](_0xc720('0x1b'),this[_0xc720('0x1c')][_0xc720('0x18')](this));ami['on'](_0xc720('0x1d'),this[_0xc720('0x1e')]['bind'](this));ami['on']('queuecallerleave',this[_0xc720('0x1f')]['bind'](this));ami['on'](_0xc720('0x20'),this[_0xc720('0x21')]['bind'](this));ami['on'](_0xc720('0x22'),this[_0xc720('0x23')][_0xc720('0x18')](this));ami['on'](_0xc720('0x24'),this[_0xc720('0x25')][_0xc720('0x18')](this));ami['on'](_0xc720('0x26'),this[_0xc720('0x27')][_0xc720('0x18')](this));ami['on']('fullybooted',this['syncFullyBooted']['bind'](this));ami['on'](_0xc720('0x28'),this[_0xc720('0x29')][_0xc720('0x18')](this));ami['on'](_0xc720('0x2a'),this[_0xc720('0x2b')][_0xc720('0x18')](this));ami['on'](_0xc720('0x2c'),this['syncAttendedTransfer'][_0xc720('0x18')](this));ami['on']('blindtransfer',this[_0xc720('0x2d')][_0xc720('0x18')](this));this['loopQueueSummary']();this[_0xc720('0x2e')]();}function clearChannels(_0x2d6b3f){if(!_[_0xc720('0x2f')](_0x2d6b3f)){for(var _0x232cb1 in _0x2d6b3f){if(_0x2d6b3f[_0xc720('0x30')](_0x232cb1)){delete _0x2d6b3f[_0x232cb1];}}}}function clearCampaigns(_0x141cb5){if(!_[_0xc720('0x2f')](_0x141cb5)){for(var _0x5a8b03 in _0x141cb5){if(_0x141cb5[_0xc720('0x30')](_0x5a8b03)){_0x141cb5[_0x5a8b03][_0xc720('0x31')]=0x0;}}}}function clearVoiceQueues(_0x522428){if(!_[_0xc720('0x2f')](_0x522428)){for(var _0x2c7e75 in _0x522428){if(_0x522428['hasOwnProperty'](_0x2c7e75)){_0x522428[_0x2c7e75][_0xc720('0x31')]=0x0;_0x522428[_0x2c7e75]['talking']=0x0;_0x522428[_0x2c7e75][_0xc720('0x32')]=0x0;_0x522428[_0x2c7e75][_0xc720('0x33')]=0x0;_0x522428[_0x2c7e75][_0xc720('0x34')]=!![];}}}}function clearAgentBooked(_0x84d71e){if(!_[_0xc720('0x2f')](_0x84d71e)){for(var _0x4760a0 in _0x84d71e){if(_0x84d71e[_0xc720('0x30')](_0x4760a0)){_0x84d71e[_0x4760a0]['unlockRR']=!![];}}}}VoiceQueueReport['prototype'][_0xc720('0x35')]=function(){var _0x34e19d=this;for(var _0x531cee in this[_0xc720('0x12')]){if(this['channels'][_0xc720('0x30')](_0x531cee)&&!this[_0xc720('0x12')][_0x531cee]['switch']){this[_0xc720('0xf')][_0xc720('0xc')](function(){if(!_[_0xc720('0x36')](_0x34e19d[_0xc720('0x12')][_0x531cee])){return ami[_0xc720('0x37')]({'action':_0xc720('0x38'),'channel':_0x34e19d[_0xc720('0x12')][_0x531cee][_0xc720('0x39')]})[_0xc720('0x3a')](function(_0x422e01){if(_0x422e01['message']===_0xc720('0x3b')){setTimeout(function(){if(_0x34e19d['channels'][_0x531cee]){delete _0x34e19d[_0xc720('0x12')][_0x531cee];logger['error']('[%s][voiceQueueReport][checkChannel]',_0x531cee,util[_0xc720('0x3c')](_0x422e01,{'showHidden':![],'depth':null}));}if(_0x34e19d[_0xc720('0x10')][_0x531cee]){delete _0x34e19d[_0xc720('0x10')][_0x531cee];logger[_0xc720('0x3d')]('[%s][voiceQueueReport][checkQueueReport]',_0x531cee,util[_0xc720('0x3c')](_0x422e01,{'showHidden':![],'depth':null}));}if(_0x34e19d[_0xc720('0x16')][_0x531cee]){delete _0x34e19d['variables'][_0x531cee];logger[_0xc720('0x3d')](_0xc720('0x3e'),_0x531cee,util[_0xc720('0x3c')](_0x422e01,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xc720('0xb')]['syncFullyBooted']=function(){logger[_0xc720('0x3d')](_0xc720('0x3f'));clearChannels(this['channels']);this['clearQueueReport'](this[_0xc720('0x10')]);clearAgentBooked(this[_0xc720('0x11')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0xc720('0x15')]);};VoiceQueueReport['prototype'][_0xc720('0x40')]=function(_0x1bb558){var _0x25408e=this;if(!_[_0xc720('0x2f')](_0x1bb558)){for(var _0x4740db in _0x1bb558){if(_0x1bb558['hasOwnProperty'](_0x4740db)){_0x25408e[_0xc720('0x41')](_0x1bb558[_0x4740db],'clearqueuereport');delete _0x1bb558[_0x4740db];}}}};VoiceQueueReport[_0xc720('0xb')]['emit']=function(_0x57fa43,_0x407c47,_0x2b86e1){io['to'](_0x57fa43)[_0xc720('0x42')](_0x407c47,_0x2b86e1);};VoiceQueueReport[_0xc720('0xb')][_0xc720('0x43')]=function(_0x517536,_0x1d71f7){logger['debug'](_0xc720('0x44')+_0x1d71f7+_0xc720('0x45'),_0x517536['uniqueid'],util[_0xc720('0x3c')](_0x517536,{'showHidden':![],'depth':null}));this[_0xc720('0x42')](util[_0xc720('0x46')](_0xc720('0x47'),_0x517536[_0xc720('0x48')]),_0xc720('0x49'),_0x517536);io[_0xc720('0x42')]('voice_queue_presence:save',_0x517536);};VoiceQueueReport[_0xc720('0xb')][_0xc720('0x41')]=function(_0x20a18d,_0x5b1f21){logger[_0xc720('0x4a')](_0xc720('0x44')+_0x5b1f21+_0xc720('0x4b'),_0x20a18d[_0xc720('0x4c')],util[_0xc720('0x3c')](_0x20a18d,{'showHidden':![],'depth':null}));this[_0xc720('0x42')](util[_0xc720('0x46')](_0xc720('0x47'),_0x20a18d[_0xc720('0x48')]),'voice_queue_channel:remove',_0x20a18d);io[_0xc720('0x42')](_0xc720('0x4d'),_0x20a18d);};VoiceQueueReport[_0xc720('0xb')]['emitVoiceQueueSummary']=function(_0xfc9eac,_0x3e53f8){if(_0xfc9eac[_0xc720('0x4e')]==='inbound'){var _0x1b76ff={'id':_0xfc9eac['id'],'name':_0xfc9eac[_0xc720('0x48')],'strategy':_0xfc9eac[_0xc720('0x4f')],'answered':_0xfc9eac[_0xc720('0x50')],'available':_0xfc9eac[_0xc720('0x51')],'loggedIn':_0xfc9eac[_0xc720('0x52')],'pTalking':_0xfc9eac[_0xc720('0x32')],'sumBillable':_0xfc9eac[_0xc720('0x53')],'sumDuration':_0xfc9eac['sumDuration'],'sumHoldTime':_0xfc9eac[_0xc720('0x54')]||0x0,'talking':_0xfc9eac[_0xc720('0x55')],'total':_0xfc9eac[_0xc720('0x56')],'type':_0xfc9eac[_0xc720('0x4e')],'unmanaged':_0xfc9eac[_0xc720('0x57')],'abandoned':_0xfc9eac[_0xc720('0x58')],'waiting':_0xfc9eac['waiting']};if(_0xfc9eac[_0xc720('0x59')]){_0x1b76ff['Trunk']={'id':_0xfc9eac[_0xc720('0x59')]['id'],'name':_0xfc9eac[_0xc720('0x59')][_0xc720('0x48')],'active':_0xfc9eac[_0xc720('0x59')]['active'],'callerid':_0xfc9eac[_0xc720('0x59')][_0xc720('0x5a')]};}if(_0xfc9eac[_0xc720('0x5b')]){_0x1b76ff['Interval']={'id':_0xfc9eac['Interval']['id'],'name':_0xfc9eac['Interval']['name']};}var _0x4f152c=md5(JSON[_0xc720('0x5c')](_0x1b76ff));if(_0xfc9eac['md5']!==_0x4f152c){_0xfc9eac[_0xc720('0x2')]=_0x4f152c;logger['debug'](_0xc720('0x5d')+_0x3e53f8+']\x20sending\x20voice_queue:save\x20event:',util[_0xc720('0x3c')](_0x1b76ff,{'showHidden':![],'depth':null}));this[_0xc720('0x42')](util['format'](_0xc720('0x47'),_0x1b76ff[_0xc720('0x48')]),'voice_queue:save',_0x1b76ff);}}};VoiceQueueReport[_0xc720('0xb')][_0xc720('0x5e')]=function(_0x5dbed4){return _0x5dbed4!==null&&!_[_0xc720('0x5f')](_0x5dbed4);};VoiceQueueReport[_0xc720('0xb')][_0xc720('0x2e')]=function(){var _0x2980fb=this;setInterval(function(){_0x2980fb[_0xc720('0x35')]();ami[_0xc720('0x37')]({'action':'queues'})['catch'](function(_0x2d3c41){logger[_0xc720('0x3d')](_0xc720('0x60'),util[_0xc720('0x3c')](_0x2d3c41,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xc720('0xb')]['loopQueueSummary']=function(){var _0x3ed89b=this;setInterval(function(){if(_0x3ed89b['flagQueueSummary']){return ami[_0xc720('0x37')]({'action':_0xc720('0x17')})[_0xc720('0x61')](function(_0x3e9609){_0x3ed89b[_0xc720('0x62')]=![];})[_0xc720('0x3a')](function(_0x4200e1){logger[_0xc720('0x3d')](_0xc720('0x63'),util[_0xc720('0x3c')](_0x4200e1,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xc720('0xb')][_0xc720('0x64')]=function(_0x379edd){try{if(this[_0xc720('0x5e')](_0x379edd)&&this[_0xc720('0x5e')](_0x379edd[_0xc720('0x65')])){logger[_0xc720('0x4a')](_0xc720('0x66'),util[_0xc720('0x3c')](_0x379edd,{'showHidden':![],'depth':null}));if(this[_0xc720('0x14')][_0x379edd[_0xc720('0x65')]]){logger['info'](_0xc720('0x67'),_0x379edd[_0xc720('0x65')]);var _0x5b1751=_[_0xc720('0x68')](this[_0xc720('0x12')],_0xc720('0x65'))[_0x379edd['queue']]||0x0;var _0x47e7c5=_0x5b1751-_0x379edd['callers'];if(this[_0xc720('0x14')][_0x379edd[_0xc720('0x65')]]['waiting']!==_['toNumber'](_0x379edd[_0xc720('0x69')])||this[_0xc720('0x14')][_0x379edd['queue']]['loggedIn']!==_[_0xc720('0x6a')](_0x379edd[_0xc720('0x6b')])||this['voiceQueues'][_0x379edd[_0xc720('0x65')]][_0xc720('0x51')]!==_[_0xc720('0x6a')](_0x379edd[_0xc720('0x51')])||this[_0xc720('0x14')][_0x379edd[_0xc720('0x65')]][_0xc720('0x55')]!==_0x47e7c5){this['voiceQueues'][_0x379edd[_0xc720('0x65')]][_0xc720('0x33')]=_[_0xc720('0x6a')](_0x379edd[_0xc720('0x69')]);this[_0xc720('0x14')][_0x379edd[_0xc720('0x65')]]['loggedIn']=_[_0xc720('0x6a')](_0x379edd[_0xc720('0x6b')]);this[_0xc720('0x14')][_0x379edd[_0xc720('0x65')]][_0xc720('0x51')]=_[_0xc720('0x6a')](_0x379edd[_0xc720('0x51')]);this['voiceQueues'][_0x379edd[_0xc720('0x65')]][_0xc720('0x55')]=_0x47e7c5>0x0?_0x47e7c5:0x0;this['voiceQueues'][_0x379edd[_0xc720('0x65')]][_0xc720('0x55')]=this[_0xc720('0x14')][_0x379edd[_0xc720('0x65')]][_0xc720('0x55')]>_[_0xc720('0x6a')](_0x379edd['loggedin'])?_['toNumber'](_0x379edd[_0xc720('0x6b')]):this[_0xc720('0x14')][_0x379edd[_0xc720('0x65')]]['talking'];this[_0xc720('0x6c')](this['voiceQueues'][_0x379edd[_0xc720('0x65')]],_0xc720('0x17'));}logger[_0xc720('0x4a')](_0xc720('0x6d'),util[_0xc720('0x3c')](this[_0xc720('0x14')][_0x379edd['queue']],{'showHidden':![],'depth':null}));ami[_0xc720('0x42')](_0xc720('0x6e'),this['voiceQueues'][_0x379edd[_0xc720('0x65')]]);}}}catch(_0x4040e9){logger[_0xc720('0x3d')](_0xc720('0x63'),util[_0xc720('0x3c')](_0x4040e9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc720('0x1a')]=function(_0x35f916){logger[_0xc720('0x4a')](_0xc720('0x6f'),util[_0xc720('0x3c')](_0x35f916,{'showHidden':![],'depth':null}));this[_0xc720('0x62')]=!![];};VoiceQueueReport[_0xc720('0xb')][_0xc720('0x1c')]=function(_0x46e301){try{if(this[_0xc720('0x5e')](_0x46e301)){logger['debug'](_0xc720('0x70'),_0x46e301[_0xc720('0x4c')],util[_0xc720('0x3c')](_0x46e301,{'showHidden':![],'depth':null}));if(_[_0xc720('0x5f')](this[_0xc720('0x10')][_0x46e301[_0xc720('0x4c')]])){this[_0xc720('0x10')][_0x46e301[_0xc720('0x4c')]]=[];this[_0xc720('0x12')][_0x46e301[_0xc720('0x4c')]]={};}var _0xc29c71=new QueueReport();_0xc29c71[_0xc720('0x48')]=_0x46e301[_0xc720('0x65')];_0xc29c71['type']=this['voiceQueues'][_0xc29c71['name']]&&this[_0xc720('0x14')][_0xc29c71[_0xc720('0x48')]][_0xc720('0x4e')]?this['voiceQueues'][_0xc29c71['name']]['type']||_0xc720('0x71'):_0xc720('0x71');_0xc29c71['queue']=_0x46e301[_0xc720('0x65')];_0xc29c71[_0xc720('0x72')]=moment()[_0xc720('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0xc29c71[_0xc720('0x73')]=_0x46e301[_0xc720('0x73')];_0xc29c71[_0xc720('0x74')]=_0x46e301[_0xc720('0x74')];_0xc29c71[_0xc720('0x4c')]=_0x46e301['uniqueid'];logger[_0xc720('0x75')](_0xc720('0x76'),_0xc29c71[_0xc720('0x48')],_0xc29c71[_0xc720('0x4e')]);_[_0xc720('0x77')](_0xc29c71,_[_0xc720('0x78')](_0x46e301,_[_0xc720('0x79')](_0xc29c71)));this[_0xc720('0x10')][_0x46e301[_0xc720('0x4c')]][_0xc720('0x7a')](_0xc29c71);this['channels'][_0x46e301[_0xc720('0x4c')]]=_0xc29c71;this[_0xc720('0x43')](_0xc29c71,_0xc720('0x1b'));}}catch(_0x5b56b2){logger[_0xc720('0x3d')](_0xc720('0x70'),_0x46e301[_0xc720('0x4c')],util[_0xc720('0x3c')](_0x5b56b2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc720('0xb')][_0xc720('0x1e')]=function(_0x5bec36){try{if(this['isNotNull'](_0x5bec36)){logger[_0xc720('0x4a')](_0xc720('0x7b'),_0x5bec36[_0xc720('0x4c')],util[_0xc720('0x3c')](_0x5bec36,{'showHidden':![],'depth':null}));if(this[_0xc720('0x10')][_0x5bec36['uniqueid']]){var _0x240440=_['last'](this[_0xc720('0x10')][_0x5bec36[_0xc720('0x4c')]]);_0x240440['queuecallercomplete']=![];_0x240440[_0xc720('0x7c')]=null;_0x240440['holdtime']=_0x5bec36[_0xc720('0x7d')];_0x240440[_0xc720('0x7e')]=_0x5bec36['originalposition'];_0x240440['queuecallerabandon']=!![];_0x240440[_0xc720('0x7f')]=moment()[_0xc720('0x46')](_0xc720('0x80'));_0x240440[_0xc720('0x81')]=_0xc720('0x82');_0x240440[_0xc720('0x83')]=null;logger[_0xc720('0x75')](_0xc720('0x84'),_0x240440[_0xc720('0x48')],_0x240440[_0xc720('0x4e')]);this[_0xc720('0x12')][_0x5bec36['uniqueid']]=_0x240440;this['emitVoiceQueueChannelRemove'](_0x240440,_0xc720('0x1d'));}}}catch(_0x4e36aa){logger['error'](_0xc720('0x7b'),_0x5bec36[_0xc720('0x4c')],util[_0xc720('0x3c')](_0x4e36aa,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc720('0xb')][_0xc720('0x1f')]=function(_0x3d2996){try{if(this[_0xc720('0x5e')](_0x3d2996)){logger['debug'](_0xc720('0x85'),_0x3d2996[_0xc720('0x4c')],util[_0xc720('0x3c')](_0x3d2996,{'showHidden':![],'depth':null}));if(this[_0xc720('0x10')][_0x3d2996['uniqueid']]){var _0x308806=_[_0xc720('0x86')](this[_0xc720('0x10')][_0x3d2996[_0xc720('0x4c')]]);_0x308806[_0xc720('0x87')]=moment()[_0xc720('0x46')](_0xc720('0x80'));_0x308806[_0xc720('0x88')]=_0x3d2996[_0xc720('0x88')];_0x308806[_0xc720('0x89')]=_0x3d2996[_0xc720('0x89')];logger[_0xc720('0x75')](_0xc720('0x8a'),_0x308806[_0xc720('0x48')],_0x308806[_0xc720('0x4e')],_0x3d2996[_0xc720('0x88')],_0x3d2996['connectedlinename']);this[_0xc720('0x12')][_0x3d2996['uniqueid']]=_0x308806;this[_0xc720('0x43')](_0x308806,_0xc720('0x8b'));}}}catch(_0xb57e5f){logger[_0xc720('0x3d')](_0xc720('0x85'),_0x3d2996['uniqueid'],util[_0xc720('0x3c')](_0xb57e5f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x202891){try{if(this[_0xc720('0x5e')](_0x202891)){logger[_0xc720('0x4a')](_0xc720('0x8c'),_0x202891[_0xc720('0x4c')],util[_0xc720('0x3c')](_0x202891,{'showHidden':![],'depth':null}));if(this[_0xc720('0x10')][_0x202891[_0xc720('0x4c')]]){var _0xb3a698=_[_0xc720('0x86')](this[_0xc720('0x10')][_0x202891['uniqueid']]);_0xb3a698[_0xc720('0x8d')]=!![];_0xb3a698[_0xc720('0x81')]='COMPLETEDBYAGENT';logger['info'](_0xc720('0x8e'),_0xb3a698[_0xc720('0x48')],_0xb3a698['type']);}}}catch(_0x4118fe){logger[_0xc720('0x3d')](_0xc720('0x8c'),_0x202891[_0xc720('0x4c')],util['inspect'](_0x4118fe,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc720('0xb')][_0xc720('0x21')]=function(_0x5ad6e5){try{if(this[_0xc720('0x5e')](_0x5ad6e5)){logger[_0xc720('0x4a')](_0xc720('0x8f'),_0x5ad6e5['uniqueid'],util[_0xc720('0x3c')](_0x5ad6e5,{'showHidden':![],'depth':null}));if(this[_0xc720('0x10')][_0x5ad6e5[_0xc720('0x4c')]]){var _0x2091dc=_[_0xc720('0x86')](this[_0xc720('0x10')][_0x5ad6e5[_0xc720('0x4c')]]);_0x2091dc[_0xc720('0x1d')]=![];_0x2091dc[_0xc720('0x7f')]=null;_0x2091dc[_0xc720('0x90')]=!![];_0x2091dc[_0xc720('0x83')]=_0x5ad6e5[_0xc720('0x91')];_0x2091dc['holdtime']=_0x5ad6e5[_0xc720('0x7d')];_0x2091dc[_0xc720('0x8d')]=!![];_0x2091dc[_0xc720('0x92')]=![];_0x2091dc['queuecallerexitAt']=null;if(!_0x2091dc[_0xc720('0x93')]){if(_0x5ad6e5['reason']==_0xc720('0x93')){_0x2091dc['queuecallerexitreason']='COMPLETED';logger['info'](_0xc720('0x94'),_0x2091dc[_0xc720('0x48')],_0x2091dc[_0xc720('0x4e')]);}else{if(_[_0xc720('0x95')](_0x5ad6e5['channel'][_0xc720('0x96')](),_0xc720('0x97'))){if(this[_0xc720('0x10')][_0x5ad6e5['linkedid']]){var _0x506112=_[_0xc720('0x86')](this[_0xc720('0x10')][_0x5ad6e5[_0xc720('0x98')]]);_0x506112['queuecallercomplete']=![];_0x506112['queuecallerexit']=!![];_0x506112[_0xc720('0x99')]=moment(_0x2091dc[_0xc720('0x72')])['add'](_0x5ad6e5[_0xc720('0x7d')],_0xc720('0x9a'))[_0xc720('0x46')](_0xc720('0x80'));_0x506112[_0xc720('0x81')]='FORWARDTRANSFER';_0x506112[_0xc720('0x93')]=!![];_0x506112[_0xc720('0x9b')]=_0xc720('0x9c');_0x506112[_0xc720('0x9d')]=_0x5ad6e5[_0xc720('0x9e')];_0x506112[_0xc720('0x9f')]=_0x5ad6e5[_0xc720('0x4c')];logger[_0xc720('0x75')](_0xc720('0xa0'),_0x506112[_0xc720('0x48')],_0x506112[_0xc720('0x4e')]);var _0xf54775=this[_0xc720('0x10')][_0x5ad6e5['linkedid']];this['queueReports'][_0x5ad6e5['linkedid']]=this[_0xc720('0x10')][_0x5ad6e5[_0xc720('0x4c')]];this[_0xc720('0x10')][_0x5ad6e5['uniqueid']]=_0xf54775;}}else{_0x2091dc[_0xc720('0x81')]=_0xc720('0xa1')+_0x5ad6e5[_0xc720('0xa2')][_0xc720('0xa3')]();logger[_0xc720('0x75')](_0xc720('0xa4'),_0x2091dc['name'],_0x2091dc[_0xc720('0x4e')],_0x2091dc[_0xc720('0x81')]);}}}this[_0xc720('0x12')][_0x5ad6e5[_0xc720('0x4c')]]=_0x2091dc;this[_0xc720('0x41')](_0x2091dc,_0xc720('0x20'));}}}catch(_0x4a24a4){logger[_0xc720('0x3d')]('[%s][voiceQueueReport][agentcomplete]',_0x5ad6e5[_0xc720('0x4c')],util['inspect'](_0x4a24a4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc720('0xb')][_0xc720('0x25')]=function(_0x5d0e45){try{if(this[_0xc720('0x5e')](_0x5d0e45)){logger[_0xc720('0x4a')]('[%s][voiceQueueReport][varset]',_0x5d0e45[_0xc720('0x4c')],util['inspect'](_0x5d0e45,{'showHidden':![],'depth':null}));this[_0xc720('0xa5')](_0x5d0e45[_0xc720('0x4c')],_['keys'](_0x5d0e45['variable'])[0x0],_0x5d0e45['value']);if(this['queueReports'][_0x5d0e45['uniqueid']]){var _0x4ba3a0=_[_0xc720('0x86')](this[_0xc720('0x10')][_0x5d0e45[_0xc720('0x4c')]]);if(_0x4ba3a0){if(this['isNotNull'](_0x5d0e45[_0xc720('0xa6')])&&this[_0xc720('0x5e')](_0x5d0e45['variable']['queuestatus'])){switch(_0x5d0e45[_0xc720('0xa7')]){case _0xc720('0xa8'):_0x4ba3a0['queuecallerexit']=![];_0x4ba3a0['queuecallerexitAt']=null;break;case _0xc720('0xa9'):_0x4ba3a0['lastevent']=_0xc720('0xaa');_0x4ba3a0[_0xc720('0x92')]=!![];_0x4ba3a0['queuecallerexitAt']=moment()[_0xc720('0x46')](_0xc720('0x80'));_0x4ba3a0[_0xc720('0x87')]=moment()[_0xc720('0x46')](_0xc720('0x80'));logger['debug'](_0xc720('0xab'),_0x5d0e45['uniqueid'],util[_0xc720('0x3c')](_0x4ba3a0,{'showHidden':![],'depth':null}));ami[_0xc720('0x42')](_0xc720('0xac'),_0x4ba3a0);break;default:_0x4ba3a0['queuecallerexit']=!![];_0x4ba3a0['queuecallerexitAt']=moment()[_0xc720('0x46')](_0xc720('0x80'));_0x4ba3a0[_0xc720('0x87')]=moment()['format'](_0xc720('0x80'));}_0x4ba3a0[_0xc720('0x1d')]=![];_0x4ba3a0[_0xc720('0x7f')]=null;_0x4ba3a0[_0xc720('0x81')]=_0x5d0e45[_0xc720('0xa7')];this[_0xc720('0x12')][_0x5d0e45[_0xc720('0x4c')]]=_0x4ba3a0;this[_0xc720('0x41')](_0x4ba3a0,'varset');}else if(this[_0xc720('0x5e')](_0x5d0e45['variable'])&&this[_0xc720('0x5e')](_0x5d0e45[_0xc720('0xa6')]['queueposition'])){if(!_0x4ba3a0[_0xc720('0x1d')]){_0x4ba3a0[_0xc720('0x92')]=!![];_0x4ba3a0['queuecallerexitAt']=moment()[_0xc720('0x46')](_0xc720('0x80'));_0x4ba3a0[_0xc720('0x81')]=_0xc720('0xad');_0x4ba3a0[_0xc720('0x87')]=moment()[_0xc720('0x46')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc720('0x12')][_0x5d0e45['uniqueid']]=_0x4ba3a0;}}logger['info'](_0xc720('0xae'),_0x5d0e45[_0xc720('0x4c')],_0x4ba3a0['name'],_0x4ba3a0[_0xc720('0x4e')],_['keys'](_0x5d0e45[_0xc720('0xa6')])[0x0],_0x5d0e45['value']);_0x4ba3a0[_0xc720('0x16')]=this[_0xc720('0x16')][_0x5d0e45[_0xc720('0x4c')]];}}}}catch(_0x4f68d3){logger['error'](_0xc720('0xaf'),_0x5d0e45[_0xc720('0x4c')],util[_0xc720('0x3c')](_0x4f68d3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc720('0xb')][_0xc720('0xa5')]=function(_0x150369,_0x1b926a,_0x3dffa7){var _0x293a48=['rtpaudioqos','rtpaudioqosbridged',_0xc720('0xb0'),'rtpaudioqosjitterbridged',_0xc720('0xb1'),_0xc720('0xb2'),_0xc720('0xb3'),_0xc720('0xb4'),_0xc720('0xb5'),_0xc720('0xb6'),'bridgepeer',_0xc720('0xb7'),_0xc720('0xb8'),_0xc720('0xb9'),'memberinterface','memberlastcall',_0xc720('0x91'),_0xc720('0xba'),_0xc720('0xbb')];if(!_[_0xc720('0x36')](_0x1b926a)&&!_[_0xc720('0xbc')](_0x293a48,_0x1b926a)){if(_['isUndefined'](this[_0xc720('0x16')][_0x150369])){this[_0xc720('0x16')][_0x150369]={};}this[_0xc720('0x16')][_0x150369][_0x1b926a]=_0x3dffa7;}};VoiceQueueReport[_0xc720('0xb')][_0xc720('0x27')]=function(_0x37f8b7){try{if(this[_0xc720('0x5e')](_0x37f8b7)){logger[_0xc720('0x4a')](_0xc720('0xbd'),_0x37f8b7[_0xc720('0x4c')],util[_0xc720('0x3c')](_0x37f8b7,{'showHidden':![],'depth':null}));if(this[_0xc720('0x10')][_0x37f8b7[_0xc720('0x4c')]]){for(var _0x45bbd3=0x0,_0x5f3c1c={};_0x45bbd30x0?_0x54c675:0x0;this['voiceQueues'][_0x1505f3[_0x8c36('0x69')]][_0x8c36('0x32')]=this['voiceQueues'][_0x1505f3[_0x8c36('0x69')]][_0x8c36('0x32')]>_[_0x8c36('0x6d')](_0x1505f3['loggedin'])?_[_0x8c36('0x6d')](_0x1505f3[_0x8c36('0x6f')]):this[_0x8c36('0x11')][_0x1505f3[_0x8c36('0x69')]]['talking'];this[_0x8c36('0x52')](this[_0x8c36('0x11')][_0x1505f3['queue']],_0x8c36('0x15'));}logger[_0x8c36('0x47')](_0x8c36('0x70'),util['inspect'](this[_0x8c36('0x11')][_0x1505f3[_0x8c36('0x69')]],{'showHidden':![],'depth':null}));ami['emit'](_0x8c36('0x71'),this[_0x8c36('0x11')][_0x1505f3[_0x8c36('0x69')]]);}}}catch(_0x1ffa82){logger['error'](_0x8c36('0x68'),util['inspect'](_0x1ffa82,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8c36('0x9')][_0x8c36('0x19')]=function(_0x5a820a){logger[_0x8c36('0x47')](_0x8c36('0x72'),util[_0x8c36('0x3f')](_0x5a820a,{'showHidden':![],'depth':null}));this[_0x8c36('0x12')]=!![];};VoiceQueueReport[_0x8c36('0x9')][_0x8c36('0x73')]=function(_0x19bd1c){try{if(this[_0x8c36('0x64')](_0x19bd1c)){logger['debug'](_0x8c36('0x74'),_0x19bd1c[_0x8c36('0x4d')],util[_0x8c36('0x3f')](_0x19bd1c,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x8c36('0xd')][_0x19bd1c[_0x8c36('0x4d')]])){this[_0x8c36('0xd')][_0x19bd1c[_0x8c36('0x4d')]]=[];this[_0x8c36('0xf')][_0x19bd1c['uniqueid']]={};}var _0x291a1f=new QueueReport();_0x291a1f[_0x8c36('0x4a')]=_0x19bd1c[_0x8c36('0x69')];_0x291a1f['type']=this[_0x8c36('0x11')][_0x291a1f[_0x8c36('0x4a')]]&&this[_0x8c36('0x11')][_0x291a1f[_0x8c36('0x4a')]][_0x8c36('0x53')]?this['voiceQueues'][_0x291a1f[_0x8c36('0x4a')]][_0x8c36('0x53')]||_0x8c36('0x54'):'inbound';_0x291a1f[_0x8c36('0x69')]=_0x19bd1c[_0x8c36('0x69')];_0x291a1f[_0x8c36('0x75')]=moment()[_0x8c36('0x4e')](_0x8c36('0x76'));_0x291a1f[_0x8c36('0x77')]=_0x19bd1c[_0x8c36('0x77')];_0x291a1f['count']=_0x19bd1c['count'];_0x291a1f['uniqueid']=_0x19bd1c[_0x8c36('0x4d')];logger[_0x8c36('0x78')](_0x8c36('0x79'),_0x291a1f[_0x8c36('0x4a')],_0x291a1f[_0x8c36('0x53')]);_[_0x8c36('0x7a')](_0x291a1f,_[_0x8c36('0x7b')](_0x19bd1c,_[_0x8c36('0x7c')](_0x291a1f)));this[_0x8c36('0xd')][_0x19bd1c[_0x8c36('0x4d')]][_0x8c36('0x7d')](_0x291a1f);this[_0x8c36('0xf')][_0x19bd1c[_0x8c36('0x4d')]]=_0x291a1f;this[_0x8c36('0x46')](_0x291a1f,_0x8c36('0x1a'));}}catch(_0xbb35c){logger[_0x8c36('0x3d')](_0x8c36('0x74'),_0x19bd1c['uniqueid'],util[_0x8c36('0x3f')](_0xbb35c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x319bfe){try{if(this['isNotNull'](_0x319bfe)){logger[_0x8c36('0x47')](_0x8c36('0x7e'),_0x319bfe[_0x8c36('0x4d')],util[_0x8c36('0x3f')](_0x319bfe,{'showHidden':![],'depth':null}));if(this[_0x8c36('0xd')][_0x319bfe[_0x8c36('0x4d')]]){var _0xf6760b=_['last'](this['queueReports'][_0x319bfe[_0x8c36('0x4d')]]);_0xf6760b[_0x8c36('0x7f')]=![];_0xf6760b['queuecallercompleteAt']=null;_0xf6760b[_0x8c36('0x80')]=_0x319bfe[_0x8c36('0x80')];_0xf6760b[_0x8c36('0x81')]=_0x319bfe[_0x8c36('0x81')];_0xf6760b['queuecallerabandon']=!![];_0xf6760b[_0x8c36('0x82')]=moment()[_0x8c36('0x4e')](_0x8c36('0x76'));_0xf6760b[_0x8c36('0x83')]=_0x8c36('0x84');_0xf6760b[_0x8c36('0x85')]=null;logger['info'](_0x8c36('0x86'),_0xf6760b[_0x8c36('0x4a')],_0xf6760b[_0x8c36('0x53')]);this[_0x8c36('0xf')][_0x319bfe[_0x8c36('0x4d')]]=_0xf6760b;this[_0x8c36('0x43')](_0xf6760b,_0x8c36('0x1b'));}}}catch(_0x1dd208){logger[_0x8c36('0x3d')](_0x8c36('0x7e'),_0x319bfe['uniqueid'],util['inspect'](_0x1dd208,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8c36('0x9')]['syncQueueCallerLeave']=function(_0x4dbf66){try{if(this[_0x8c36('0x64')](_0x4dbf66)){logger[_0x8c36('0x47')]('[%s][voiceQueueReport][queuecallerleave]',_0x4dbf66[_0x8c36('0x4d')],util[_0x8c36('0x3f')](_0x4dbf66,{'showHidden':![],'depth':null}));if(this[_0x8c36('0xd')][_0x4dbf66[_0x8c36('0x4d')]]){var _0x1e6059=_[_0x8c36('0x87')](this['queueReports'][_0x4dbf66['uniqueid']]);_0x1e6059[_0x8c36('0x88')]=moment()[_0x8c36('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1e6059[_0x8c36('0x89')]=_0x4dbf66[_0x8c36('0x89')];_0x1e6059[_0x8c36('0x8a')]=_0x4dbf66[_0x8c36('0x8a')];logger[_0x8c36('0x78')](_0x8c36('0x8b'),_0x1e6059['name'],_0x1e6059[_0x8c36('0x53')],_0x4dbf66[_0x8c36('0x89')],_0x4dbf66[_0x8c36('0x8a')]);this[_0x8c36('0xf')][_0x4dbf66[_0x8c36('0x4d')]]=_0x1e6059;this[_0x8c36('0x46')](_0x1e6059,'queuecallerleave');}}}catch(_0x4822cb){logger[_0x8c36('0x3d')](_0x8c36('0x8c'),_0x4dbf66[_0x8c36('0x4d')],util[_0x8c36('0x3f')](_0x4822cb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8c36('0x9')]['syncAgentConnect']=function(_0x53278d){try{if(this[_0x8c36('0x64')](_0x53278d)){logger[_0x8c36('0x47')](_0x8c36('0x8d'),_0x53278d['uniqueid'],util[_0x8c36('0x3f')](_0x53278d,{'showHidden':![],'depth':null}));if(this[_0x8c36('0xd')][_0x53278d[_0x8c36('0x4d')]]){var _0x1a7211=_[_0x8c36('0x87')](this[_0x8c36('0xd')][_0x53278d[_0x8c36('0x4d')]]);_0x1a7211[_0x8c36('0x7f')]=!![];_0x1a7211[_0x8c36('0x83')]=_0x8c36('0x8e');logger[_0x8c36('0x78')](_0x8c36('0x8f'),_0x1a7211['name'],_0x1a7211[_0x8c36('0x53')]);}}}catch(_0x50539b){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x53278d[_0x8c36('0x4d')],util[_0x8c36('0x3f')](_0x50539b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8c36('0x9')]['syncAgentComplete']=function(_0x7d675c){try{if(this[_0x8c36('0x64')](_0x7d675c)){logger[_0x8c36('0x47')](_0x8c36('0x90'),_0x7d675c['uniqueid'],util[_0x8c36('0x3f')](_0x7d675c,{'showHidden':![],'depth':null}));if(this[_0x8c36('0xd')][_0x7d675c['uniqueid']]){var _0x3e1fa3=_[_0x8c36('0x87')](this['queueReports'][_0x7d675c[_0x8c36('0x4d')]]);_0x3e1fa3[_0x8c36('0x1b')]=![];_0x3e1fa3[_0x8c36('0x82')]=null;_0x3e1fa3[_0x8c36('0x91')]=!![];_0x3e1fa3[_0x8c36('0x85')]=_0x7d675c[_0x8c36('0x92')];_0x3e1fa3[_0x8c36('0x80')]=_0x7d675c['holdtime'];_0x3e1fa3['queuecallercomplete']=!![];_0x3e1fa3['queuecallerexit']=![];_0x3e1fa3[_0x8c36('0x93')]=null;if(!_0x3e1fa3[_0x8c36('0x94')]){if(_0x7d675c[_0x8c36('0x95')]==_0x8c36('0x94')){_0x3e1fa3[_0x8c36('0x83')]=_0x8c36('0x96');logger['info'](_0x8c36('0x97'),_0x3e1fa3[_0x8c36('0x4a')],_0x3e1fa3[_0x8c36('0x53')]);}else{if(_[_0x8c36('0x98')](_0x7d675c['channel']['toLowerCase'](),_0x8c36('0x99'))){if(this[_0x8c36('0xd')][_0x7d675c[_0x8c36('0x9a')]]){var _0x4926ef=_[_0x8c36('0x87')](this[_0x8c36('0xd')][_0x7d675c[_0x8c36('0x9a')]]);_0x4926ef['queuecallercomplete']=![];_0x4926ef[_0x8c36('0x9b')]=!![];_0x4926ef['queuecallerexitAt']=moment(_0x3e1fa3[_0x8c36('0x75')])[_0x8c36('0x9c')](_0x7d675c['holdtime'],_0x8c36('0x9d'))[_0x8c36('0x4e')](_0x8c36('0x76'));_0x4926ef[_0x8c36('0x83')]=_0x8c36('0x9e');_0x4926ef[_0x8c36('0x94')]=!![];_0x4926ef[_0x8c36('0x9f')]=_0x8c36('0xa0');_0x4926ef['transferexten']=_0x7d675c['destexten'];_0x4926ef[_0x8c36('0xa1')]=_0x7d675c[_0x8c36('0x4d')];logger[_0x8c36('0x78')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x4926ef[_0x8c36('0x4a')],_0x4926ef[_0x8c36('0x53')]);var _0x50c9d7=this['queueReports'][_0x7d675c[_0x8c36('0x9a')]];this[_0x8c36('0xd')][_0x7d675c['linkedid']]=this[_0x8c36('0xd')][_0x7d675c[_0x8c36('0x4d')]];this[_0x8c36('0xd')][_0x7d675c[_0x8c36('0x4d')]]=_0x50c9d7;}}else{_0x3e1fa3['queuecallerexitreason']=_0x8c36('0xa2')+_0x7d675c[_0x8c36('0x95')][_0x8c36('0xa3')]();logger[_0x8c36('0x78')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x3e1fa3[_0x8c36('0x4a')],_0x3e1fa3[_0x8c36('0x53')],_0x3e1fa3[_0x8c36('0x83')]);}}}this[_0x8c36('0xf')][_0x7d675c[_0x8c36('0x4d')]]=_0x3e1fa3;this['emitVoiceQueueChannelRemove'](_0x3e1fa3,_0x8c36('0x1f'));}}}catch(_0x44a5d4){logger[_0x8c36('0x3d')]('[%s][voiceQueueReport][agentcomplete]',_0x7d675c[_0x8c36('0x4d')],util[_0x8c36('0x3f')](_0x44a5d4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8c36('0x9')]['syncVarSet']=function(_0x4be6a3){try{if(this['isNotNull'](_0x4be6a3)){logger['debug'](_0x8c36('0xa4'),_0x4be6a3['uniqueid'],util['inspect'](_0x4be6a3,{'showHidden':![],'depth':null}));this[_0x8c36('0xa5')](_0x4be6a3['uniqueid'],_[_0x8c36('0x7c')](_0x4be6a3[_0x8c36('0xa6')])[0x0],_0x4be6a3[_0x8c36('0xa7')]);if(this[_0x8c36('0xd')][_0x4be6a3['uniqueid']]){var _0x36b1c9=_[_0x8c36('0x87')](this[_0x8c36('0xd')][_0x4be6a3['uniqueid']]);if(_0x36b1c9){if(this[_0x8c36('0x64')](_0x4be6a3[_0x8c36('0xa6')])&&this[_0x8c36('0x64')](_0x4be6a3[_0x8c36('0xa6')][_0x8c36('0xa8')])){switch(_0x4be6a3[_0x8c36('0xa7')]){case _0x8c36('0xa9'):_0x36b1c9['queuecallerexit']=![];_0x36b1c9[_0x8c36('0x93')]=null;break;case _0x8c36('0xaa'):_0x36b1c9[_0x8c36('0xab')]=_0x8c36('0xac');_0x36b1c9[_0x8c36('0x9b')]=!![];_0x36b1c9[_0x8c36('0x93')]=moment()[_0x8c36('0x4e')](_0x8c36('0x76'));_0x36b1c9[_0x8c36('0x88')]=moment()[_0x8c36('0x4e')](_0x8c36('0x76'));logger[_0x8c36('0x47')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x4be6a3['uniqueid'],util[_0x8c36('0x3f')](_0x36b1c9,{'showHidden':![],'depth':null}));ami[_0x8c36('0x45')](_0x8c36('0xad'),_0x36b1c9);break;default:_0x36b1c9[_0x8c36('0x9b')]=!![];_0x36b1c9[_0x8c36('0x93')]=moment()[_0x8c36('0x4e')](_0x8c36('0x76'));_0x36b1c9['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x36b1c9[_0x8c36('0x1b')]=![];_0x36b1c9[_0x8c36('0x82')]=null;_0x36b1c9[_0x8c36('0x83')]=_0x4be6a3[_0x8c36('0xa7')];this['channels'][_0x4be6a3[_0x8c36('0x4d')]]=_0x36b1c9;this[_0x8c36('0x43')](_0x36b1c9,_0x8c36('0x23'));}else if(this[_0x8c36('0x64')](_0x4be6a3[_0x8c36('0xa6')])&&this[_0x8c36('0x64')](_0x4be6a3[_0x8c36('0xa6')]['queueposition'])){if(!_0x36b1c9[_0x8c36('0x1b')]){_0x36b1c9[_0x8c36('0x9b')]=!![];_0x36b1c9[_0x8c36('0x93')]=moment()[_0x8c36('0x4e')](_0x8c36('0x76'));_0x36b1c9[_0x8c36('0x83')]=_0x8c36('0xae');_0x36b1c9[_0x8c36('0x88')]=moment()['format'](_0x8c36('0x76'));this[_0x8c36('0xf')][_0x4be6a3[_0x8c36('0x4d')]]=_0x36b1c9;}}logger[_0x8c36('0x78')](_0x8c36('0xaf'),_0x4be6a3['uniqueid'],_0x36b1c9[_0x8c36('0x4a')],_0x36b1c9[_0x8c36('0x53')],_[_0x8c36('0x7c')](_0x4be6a3[_0x8c36('0xa6')])[0x0],_0x4be6a3[_0x8c36('0xa7')]);_0x36b1c9[_0x8c36('0x14')]=this[_0x8c36('0x14')][_0x4be6a3[_0x8c36('0x4d')]];}}}}catch(_0x56c11f){logger[_0x8c36('0x3d')]('[%s][voiceQueueReport][varset]',_0x4be6a3['uniqueid'],util['inspect'](_0x56c11f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8c36('0x9')][_0x8c36('0xa5')]=function(_0x36e76b,_0x58b524,_0x101b04){var _0x1d8d2c=[_0x8c36('0xb0'),'rtpaudioqosbridged','rtpaudioqosjitter',_0x8c36('0xb1'),'rtpaudioqosloss',_0x8c36('0xb2'),_0x8c36('0xb3'),_0x8c36('0xb4'),'sipcallid',_0x8c36('0xb5'),_0x8c36('0xb6'),_0x8c36('0xb7'),'membercalls',_0x8c36('0xb8'),_0x8c36('0xb9'),_0x8c36('0xba'),_0x8c36('0x92'),_0x8c36('0xbb'),_0x8c36('0xbc')];if(!_['isNil'](_0x58b524)&&!_[_0x8c36('0xbd')](_0x1d8d2c,_0x58b524)){if(_[_0x8c36('0x65')](this[_0x8c36('0x14')][_0x36e76b])){this[_0x8c36('0x14')][_0x36e76b]={};}this[_0x8c36('0x14')][_0x36e76b][_0x58b524]=_0x101b04;}};VoiceQueueReport['prototype']['syncHangup']=function(_0x4f8653){try{if(this['isNotNull'](_0x4f8653)){logger[_0x8c36('0x47')]('[%s][voiceQueueReport][hangup]',_0x4f8653[_0x8c36('0x4d')],util[_0x8c36('0x3f')](_0x4f8653,{'showHidden':![],'depth':null}));if(this[_0x8c36('0xd')][_0x4f8653['uniqueid']]){for(var _0x10ed2c=0x0,_0x4d7474={};_0x10ed2c=0x0?moment(_0x5e0a04[_0x22ff('0x17')])['diff'](_0x5e0a04[_0x22ff('0x16')],_0x22ff('0x18')):null,'data1':_0x22ff('0x19'),'data2':_0x5e0a04[_0x22ff('0x12')],'data3':_0x5e0a04[_0x22ff('0x10')],'data4':_0x5e0a04[_0x22ff('0x1a')]||null,'role':'agent','internal':_0x5e0a04[_0x22ff('0x12')]?_['toNumber'](_0x5e0a04[_0x22ff('0x12')]):undefined,'uniqueid':_0x5e0a04['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x98b1=['util','../client','voiceQueueReport','queuecallerexitAt','Request','CreateMemberReport','voice','isNil','format','lastAssignedTo','interface','queuecallerleaveAt','diff','seconds','inbound','calleridnum','queue','accountcode','toNumber','voiceDialReport','membername','TALKING','endtime','starttime','outbound','exten','agent','moment','lodash'];(function(_0x21051a,_0x286a63){var _0x50c08b=function(_0x3999e5){while(--_0x3999e5){_0x21051a['push'](_0x21051a['shift']());}};_0x50c08b(++_0x286a63);}(_0x98b1,0x177));var _0x198b=function(_0x38f5b5,_0x4037d0){_0x38f5b5=_0x38f5b5-0x0;var _0x5b23a3=_0x98b1[_0x38f5b5];return _0x5b23a3;};'use strict';var moment=require(_0x198b('0x0'));var _=require(_0x198b('0x1'));var util=require(_0x198b('0x2'));var client=require(_0x198b('0x3'));exports[_0x198b('0x4')]=function(_0x164810){var _0x49b0bb=_0x164810['queuecallercompleteAt']||_0x164810[_0x198b('0x5')];return client[_0x198b('0x6')](_0x198b('0x7'),{'body':{'channel':_0x198b('0x8'),'membername':_0x164810['lastAssignedTo'],'interface':_[_0x198b('0x9')](_0x164810['interface'])?util[_0x198b('0xa')]('SIP/%s',_0x164810[_0x198b('0xb')]):_0x164810[_0x198b('0xc')],'type':'TALKING','enterAt':_0x164810[_0x198b('0xd')],'exitAt':_0x49b0bb,'duration':moment(_0x49b0bb)[_0x198b('0xe')](_0x164810[_0x198b('0xd')],_0x198b('0xf')),'data1':_0x198b('0x10'),'data2':_0x164810[_0x198b('0x11')],'data3':_0x164810['exten'],'data4':null,'data5':_0x164810[_0x198b('0x12')],'role':'agent','internal':_0x164810[_0x198b('0x13')]?_[_0x198b('0x14')](_0x164810['accountcode']):undefined,'uniqueid':_0x164810['uniqueid']},'log':_0x198b('0x7')});};exports[_0x198b('0x15')]=function(_0x34b2f7){return client[_0x198b('0x6')]('CreateMemberReport',{'body':{'channel':_0x198b('0x8'),'membername':_0x34b2f7[_0x198b('0x16')],'interface':_0x34b2f7[_0x198b('0xc')],'type':_0x198b('0x17'),'enterAt':_0x34b2f7['starttime'],'exitAt':_0x34b2f7['endtime'],'duration':moment(_0x34b2f7[_0x198b('0x18')])[_0x198b('0xe')](_0x34b2f7['starttime'],_0x198b('0xf'))>=0x0?moment(_0x34b2f7[_0x198b('0x18')])[_0x198b('0xe')](_0x34b2f7[_0x198b('0x19')],_0x198b('0xf')):null,'data1':_0x198b('0x1a'),'data2':_0x34b2f7[_0x198b('0x13')],'data3':_0x34b2f7[_0x198b('0x1b')],'data4':_0x34b2f7['dialstring']||null,'role':_0x198b('0x1c'),'internal':_0x34b2f7[_0x198b('0x13')]?_[_0x198b('0x14')](_0x34b2f7[_0x198b('0x13')]):undefined,'uniqueid':_0x34b2f7['uniqueid']},'log':_0x198b('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index a553f8f..7c5fdd3 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 _0x8b29=['html','../client','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8b29,0xbe));var _0x98b2=function(_0x525a1c,_0x1ead2d){_0x525a1c=_0x525a1c-0x0;var _0x8ccc9=_0x8b29[_0x525a1c];return _0x8ccc9;};'use strict';var client=require(_0x98b2('0x0'));exports['getTemplates']=function(_0xc35914){return function(_0x328554){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x98b2('0x1'),_0x98b2('0x2')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x4ded=['name','html','../client','getTemplates','Request','GetTemplate'];(function(_0x2427c4,_0x242752){var _0x51622f=function(_0x406a5c){while(--_0x406a5c){_0x2427c4['push'](_0x2427c4['shift']());}};_0x51622f(++_0x242752);}(_0x4ded,0x116));var _0xd4de=function(_0x65d6c8,_0x3c77b9){_0x65d6c8=_0x65d6c8-0x0;var _0x3bac87=_0x4ded[_0x65d6c8];return _0x3bac87;};'use strict';var client=require(_0xd4de('0x0'));exports[_0xd4de('0x1')]=function(_0x117357){return function(_0x1fa334){return client[_0xd4de('0x2')](_0xd4de('0x3'),{'options':{'raw':!![],'attributes':['id',_0xd4de('0x4'),_0xd4de('0x5')]},'log':_0xd4de('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index e3c1fcc..3a1d7a7 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 _0x3ee1=['Request','name','status','Condition','field','operator','value','Action','Actions','action','data1','data2','data3','data4','data6','GetTrigger','getTriggers'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x3ee1,0x142));var _0x13ee=function(_0x31a2f2,_0x29cdac){_0x31a2f2=_0x31a2f2-0x0;var _0x1e405d=_0x3ee1[_0x31a2f2];return _0x1e405d;};'use strict';var client=require('../client');exports[_0x13ee('0x0')]=function(_0x3cf454){return function(_0x1cca92){return client[_0x13ee('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x13ee('0x2'),'channel',_0x13ee('0x3')],'include':[{'model':_0x13ee('0x4'),'as':'AllConditions','attributes':['id',_0x13ee('0x5'),_0x13ee('0x6'),_0x13ee('0x7')]},{'model':_0x13ee('0x4'),'as':'AnyConditions','attributes':['id','field',_0x13ee('0x6'),_0x13ee('0x7')]},{'model':_0x13ee('0x8'),'as':_0x13ee('0x9'),'attributes':['id',_0x13ee('0xa'),_0x13ee('0xb'),_0x13ee('0xc'),_0x13ee('0xd'),_0x13ee('0xe'),'data5',_0x13ee('0xf'),'data7']}]},'log':_0x13ee('0x10')});};}; \ No newline at end of file +var _0x050a=['data5','data6','data7','../client','getTriggers','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','AnyConditions','value','Action','Actions','action','data1','data2','data4'];(function(_0x5e7944,_0x5c77d1){var _0x31b0e7=function(_0x166142){while(--_0x166142){_0x5e7944['push'](_0x5e7944['shift']());}};_0x31b0e7(++_0x5c77d1);}(_0x050a,0x1d1));var _0xa050=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x050a[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xa050('0x0'));exports[_0xa050('0x1')]=function(_0xbc8612){return function(_0x542736){return client['Request'](_0xa050('0x2'),{'options':{'raw':![],'attributes':['id',_0xa050('0x3'),_0xa050('0x4'),_0xa050('0x5')],'include':[{'model':_0xa050('0x6'),'as':_0xa050('0x7'),'attributes':['id',_0xa050('0x8'),_0xa050('0x9'),'value']},{'model':_0xa050('0x6'),'as':_0xa050('0xa'),'attributes':['id',_0xa050('0x8'),_0xa050('0x9'),_0xa050('0xb')]},{'model':_0xa050('0xc'),'as':_0xa050('0xd'),'attributes':['id',_0xa050('0xe'),_0xa050('0xf'),_0xa050('0x10'),'data3',_0xa050('0x11'),_0xa050('0x12'),_0xa050('0x13'),_0xa050('0x14')]}]},'log':_0xa050('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 62dc31c..ea8c37d 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 _0x12b7=['name','registry','../client','getTrunks','GetTrunk'];(function(_0x1730dd,_0x3cacb2){var _0x15a53c=function(_0x470500){while(--_0x470500){_0x1730dd['push'](_0x1730dd['shift']());}};_0x15a53c(++_0x3cacb2);}(_0x12b7,0x19c));var _0x712b=function(_0x3c23ae,_0x157afd){_0x3c23ae=_0x3c23ae-0x0;var _0x2e0b3f=_0x12b7[_0x3c23ae];return _0x2e0b3f;};'use strict';var client=require(_0x712b('0x0'));exports[_0x712b('0x1')]=function(_0x2adb2c){return function(_0xc174c4){return client['Request'](_0x712b('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x712b('0x3'),_0x712b('0x4')]},'log':_0x712b('0x2')});};}; \ No newline at end of file +var _0x757f=['GetTrunk','Request','name','registry'];(function(_0xca4e57,_0x96310e){var _0x5cdb8e=function(_0x2e653d){while(--_0x2e653d){_0xca4e57['push'](_0xca4e57['shift']());}};_0x5cdb8e(++_0x96310e);}(_0x757f,0xe5));var _0xf757=function(_0x114c1c,_0x5bfd6d){_0x114c1c=_0x114c1c-0x0;var _0x50a0a6=_0x757f[_0x114c1c];return _0x50a0a6;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x508a4b){return function(_0x1ca94d){return client[_0xf757('0x0')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xf757('0x1'),_0xf757('0x2')]},'log':_0xf757('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 77bf141..c97955f 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 _0x88ff=['../client','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','telephone','savePause','saveUnpause','UnpauseUser','getAgent'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x88ff,0x176));var _0xf88f=function(_0x373814,_0x12af54){_0x373814=_0x373814-0x0;var _0x2aab5d=_0x88ff[_0x373814];return _0x2aab5d;};'use strict';var client=require(_0xf88f('0x0'));exports[_0xf88f('0x1')]=function(){return function(){return client[_0xf88f('0x2')](_0xf88f('0x3'),{'options':{'raw':![],'where':{'role':_0xf88f('0x4')},'attributes':['id',_0xf88f('0x5'),_0xf88f('0x6'),_0xf88f('0x7'),_0xf88f('0x8'),_0xf88f('0x9'),_0xf88f('0xa'),_0xf88f('0xb'),_0xf88f('0xc'),_0xf88f('0xd'),_0xf88f('0xe'),_0xf88f('0xf'),_0xf88f('0x10')]},'log':'getAgents'});};};exports['getTelephones']=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0xf88f('0x11')},'attributes':['id','name',_0xf88f('0x7'),'internal']},'log':'getTelephones'});};};exports[_0xf88f('0x12')]=function(_0x3e93a,_0x3f2860,_0x294792){return client[_0xf88f('0x2')]('PauseUser',{'body':{'type':_0x3f2860,'uniqueid':_0x294792},'options':{'where':{'id':_0x3e93a['id']}},'log':'savePause'});};exports[_0xf88f('0x13')]=function(_0x19c310){return client['Request'](_0xf88f('0x14'),{'body':{},'options':{'where':{'id':_0x19c310['id']}},'log':'savePause'});};exports['getAgent']=function(_0x4215d6){return client[_0xf88f('0x2')]('ShowUser',{'options':{'raw':![],'where':{'role':'agent','id':_0x4215d6},'attributes':['id',_0xf88f('0x5'),_0xf88f('0x6'),_0xf88f('0x7'),_0xf88f('0x8'),_0xf88f('0x9'),_0xf88f('0xa'),_0xf88f('0xb'),_0xf88f('0xc'),_0xf88f('0xd'),_0xf88f('0x10')]},'log':_0xf88f('0x15')});}; \ No newline at end of file +var _0x15f6=['interface','getTelephones','GetUser','telephone','internal','savePause','saveUnpause','UnpauseUser','ShowUser','lastLoginAt','voicePause','getAgent','getAgents','Request','name','accountcode','fullname','online','pauseType','lastPauseAt','phone','mobile'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x15f6,0x1da));var _0x615f=function(_0x21f4f9,_0x5812aa){_0x21f4f9=_0x21f4f9-0x0;var _0x4d302a=_0x15f6[_0x21f4f9];return _0x4d302a;};'use strict';var client=require('../client');exports[_0x615f('0x0')]=function(){return function(){return client[_0x615f('0x1')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x615f('0x2'),'email',_0x615f('0x3'),_0x615f('0x4'),_0x615f('0x5'),'lastLoginAt',_0x615f('0x6'),_0x615f('0x7'),'voicePause',_0x615f('0x8'),_0x615f('0x9'),_0x615f('0xa')]},'log':_0x615f('0x0')});};};exports[_0x615f('0xb')]=function(){return function(){return client[_0x615f('0x1')](_0x615f('0xc'),{'options':{'raw':!![],'where':{'role':_0x615f('0xd')},'attributes':['id','name','accountcode',_0x615f('0xe')]},'log':_0x615f('0xb')});};};exports['savePause']=function(_0x31b795,_0x442605,_0x3f4f7e){return client['Request']('PauseUser',{'body':{'type':_0x442605,'uniqueid':_0x3f4f7e},'options':{'where':{'id':_0x31b795['id']}},'log':_0x615f('0xf')});};exports[_0x615f('0x10')]=function(_0x5c31ca){return client[_0x615f('0x1')](_0x615f('0x11'),{'body':{},'options':{'where':{'id':_0x5c31ca['id']}},'log':_0x615f('0xf')});};exports['getAgent']=function(_0x746047){return client[_0x615f('0x1')](_0x615f('0x12'),{'options':{'raw':![],'where':{'role':'agent','id':_0x746047},'attributes':['id','name','email','accountcode',_0x615f('0x4'),_0x615f('0x5'),_0x615f('0x13'),'pauseType','lastPauseAt',_0x615f('0x14'),'interface']},'log':_0x615f('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 15d1e8c..4c278fb 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 _0x04f4=['update','UpdateVoiceAgentReport','create','Request','CreateVoiceAgentReport'];(function(_0x2f7e2e,_0x10ccf5){var _0x3960dd=function(_0x13c97e){while(--_0x13c97e){_0x2f7e2e['push'](_0x2f7e2e['shift']());}};_0x3960dd(++_0x10ccf5);}(_0x04f4,0xfc));var _0x404f=function(_0xbae572,_0x45ffcb){_0xbae572=_0xbae572-0x0;var _0x58777d=_0x04f4[_0xbae572];return _0x58777d;};'use strict';var client=require('../client');exports[_0x404f('0x0')]=function(_0x9995fc){return client[_0x404f('0x1')](_0x404f('0x2'),{'body':_0x9995fc,'log':_0x404f('0x2')});};exports[_0x404f('0x3')]=function(_0x25fb8e,_0x1a28c3,_0x5f282c){return client[_0x404f('0x1')](_0x404f('0x4'),{'body':_0x25fb8e,'options':{'where':{'uniqueid':_0x1a28c3,'interface':_0x5f282c,'agentcomplete':!![]}},'log':_0x404f('0x4')});}; \ No newline at end of file +var _0xa4b1=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x5c76c5,_0x3a40ae){var _0xa71069=function(_0x188612){while(--_0x188612){_0x5c76c5['push'](_0x5c76c5['shift']());}};_0xa71069(++_0x3a40ae);}(_0xa4b1,0x133));var _0x1a4b=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa4b1[_0x37bd26];return _0xe83dc4;};'use strict';var client=require(_0x1a4b('0x0'));exports[_0x1a4b('0x1')]=function(_0x2c8c7b){return client[_0x1a4b('0x2')](_0x1a4b('0x3'),{'body':_0x2c8c7b,'log':'CreateVoiceAgentReport'});};exports[_0x1a4b('0x4')]=function(_0x243220,_0x4c6e86,_0x350c22){return client[_0x1a4b('0x2')](_0x1a4b('0x5'),{'body':_0x243220,'options':{'where':{'uniqueid':_0x4c6e86,'interface':_0x350c22,'agentcomplete':!![]}},'log':_0x1a4b('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 0f414ca..96e25d6 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 _0x4384=['moment','util','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','GetVoiceCallReports'];(function(_0x43d520,_0x535434){var _0x509641=function(_0x55a2e1){while(--_0x55a2e1){_0x43d520['push'](_0x43d520['shift']());}};_0x509641(++_0x535434);}(_0x4384,0xf0));var _0x4438=function(_0x58859d,_0x1157c7){_0x58859d=_0x58859d-0x0;var _0xbba7ed=_0x4384[_0x58859d];return _0xbba7ed;};'use strict';var moment=require(_0x4438('0x0'));var util=require(_0x4438('0x1'));var _=require('lodash');var client=require(_0x4438('0x2'));exports[_0x4438('0x3')]=function(_0x326779){return client[_0x4438('0x4')](_0x4438('0x5'),{'body':_[_0x4438('0x6')](_0x326779,{'source':_0x326779[_0x4438('0x7')],'destinationcontext':_0x326779[_0x4438('0x8')],'callerid':_0x326779[_0x4438('0x9')],'amaflags':_0x4438('0xa')}),'log':'CreateVoiceCallReport'});};exports[_0x4438('0xb')]=function(){return function(){return client[_0x4438('0x4')](_0x4438('0xc'),{'options':{'where':{'type':[_0x4438('0xd')],'createdAt':{'$between':[moment()['startOf'](_0x4438('0xe'))[_0x4438('0xf')](_0x4438('0x10')),moment()[_0x4438('0x11')](_0x4438('0xe'))[_0x4438('0xf')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x4438('0x12'),'duration','billableseconds']},'log':_0x4438('0x13')});};}; \ No newline at end of file +var _0xdea8=['callerid','getVoiceCallReports','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','create','Request','CreateVoiceCallReport','merge','calleridnum'];(function(_0x195b71,_0x48bec4){var _0xd719d3=function(_0x5f2092){while(--_0x5f2092){_0x195b71['push'](_0x195b71['shift']());}};_0xd719d3(++_0x48bec4);}(_0xdea8,0xfc));var _0x8dea=function(_0x5967e5,_0x32f467){_0x5967e5=_0x5967e5-0x0;var _0x26f83c=_0xdea8[_0x5967e5];return _0x26f83c;};'use strict';var moment=require(_0x8dea('0x0'));var util=require(_0x8dea('0x1'));var _=require(_0x8dea('0x2'));var client=require('../client');exports[_0x8dea('0x3')]=function(_0x50bb5e){return client[_0x8dea('0x4')](_0x8dea('0x5'),{'body':_[_0x8dea('0x6')](_0x50bb5e,{'source':_0x50bb5e[_0x8dea('0x7')],'destinationcontext':_0x50bb5e['context'],'callerid':_0x50bb5e[_0x8dea('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0x8dea('0x5')});};exports[_0x8dea('0x9')]=function(){return function(){return client[_0x8dea('0x4')](_0x8dea('0xa'),{'options':{'where':{'type':[_0x8dea('0xb')],'createdAt':{'$between':[moment()['startOf'](_0x8dea('0xc'))[_0x8dea('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf']('day')['format'](_0x8dea('0xe'))]}},'attributes':[_0x8dea('0xf'),_0x8dea('0x10'),_0x8dea('0x11'),_0x8dea('0x12')]},'log':_0x8dea('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 904b226..fdbc452 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 _0x18b4=['CreateVoiceDialReport'];(function(_0x2906a6,_0x21cef9){var _0x41f77e=function(_0x37e3a8){while(--_0x37e3a8){_0x2906a6['push'](_0x2906a6['shift']());}};_0x41f77e(++_0x21cef9);}(_0x18b4,0x1bb));var _0x418b=function(_0x34c1b5,_0x3171ab){_0x34c1b5=_0x34c1b5-0x0;var _0x1bac02=_0x18b4[_0x34c1b5];return _0x1bac02;};'use strict';var client=require('../client');exports['create']=function(_0x5e8e52){return client['Request'](_0x418b('0x0'),{'body':_0x5e8e52,'log':_0x418b('0x0')});}; \ No newline at end of file +var _0x5666=['create','Request','CreateVoiceDialReport'];(function(_0x48918e,_0x5917e7){var _0x2668d8=function(_0x374e44){while(--_0x374e44){_0x48918e['push'](_0x48918e['shift']());}};_0x2668d8(++_0x5917e7);}(_0x5666,0xd8));var _0x6566=function(_0x390b66,_0x2d43be){_0x390b66=_0x390b66-0x0;var _0x1df96a=_0x5666[_0x390b66];return _0x1df96a;};'use strict';var client=require('../client');exports[_0x6566('0x0')]=function(_0x3643e6){return client[_0x6566('0x1')](_0x6566('0x2'),{'body':_0x3643e6,'log':_0x6566('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index d3437f6..3b45fe0 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 _0x4f08=['../client','getVoiceExtensions','GetVoiceExtension','exten'];(function(_0x5e66cc,_0x6be9dd){var _0x37d5b8=function(_0x2ad7e3){while(--_0x2ad7e3){_0x5e66cc['push'](_0x5e66cc['shift']());}};_0x37d5b8(++_0x6be9dd);}(_0x4f08,0x194));var _0x84f0=function(_0x275094,_0x18ca32){_0x275094=_0x275094-0x0;var _0x3acbe0=_0x4f08[_0x275094];return _0x3acbe0;};'use strict';var client=require(_0x84f0('0x0'));exports[_0x84f0('0x1')]=function(){return function(){return client['Request'](_0x84f0('0x2'),{'options':{'raw':!![],'attributes':['id',_0x84f0('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x84f0('0x1')});};}; \ No newline at end of file +var _0x8109=['Request','GetVoiceExtension','recordingFormat','getVoiceExtensions','../client'];(function(_0x5bf4fa,_0xc0399f){var _0x519465=function(_0x57f937){while(--_0x57f937){_0x5bf4fa['push'](_0x5bf4fa['shift']());}};_0x519465(++_0xc0399f);}(_0x8109,0xa9));var _0x9810=function(_0x1c0ff1,_0x2a2878){_0x1c0ff1=_0x1c0ff1-0x0;var _0x3715b7=_0x8109[_0x1c0ff1];return _0x3715b7;};'use strict';var client=require(_0x9810('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x9810('0x1')](_0x9810('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0x9810('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x9810('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index cb875f3..969d40c 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 _0xa75c=['dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitQueue','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout'];(function(_0x386718,_0x4a6062){var _0xd26248=function(_0x302700){while(--_0x302700){_0x386718['push'](_0x386718['shift']());}};_0xd26248(++_0x4a6062);}(_0xa75c,0x8f));var _0xca75=function(_0x1ca9eb,_0x99a10b){_0x1ca9eb=_0x1ca9eb-0x0;var _0x2e284e=_0xa75c[_0x1ca9eb];return _0x2e284e;};'use strict';var client=require(_0xca75('0x0'));exports[_0xca75('0x1')]=function(){return function(){return client[_0xca75('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xca75('0x3'),_0xca75('0x4'),_0xca75('0x5'),_0xca75('0x6'),_0xca75('0x7'),'type',_0xca75('0x8'),_0xca75('0x9'),'dialLimitChannel',_0xca75('0xa'),'dialPowerLevel','dialPredictiveOptimization',_0xca75('0xb'),'dialPredictiveInterval',_0xca75('0xc'),_0xca75('0xd'),_0xca75('0xe'),_0xca75('0xf'),_0xca75('0x10'),_0xca75('0x11'),_0xca75('0x12'),_0xca75('0x13'),'dialBusyMaxRetry',_0xca75('0x14'),_0xca75('0x15'),_0xca75('0x16'),_0xca75('0x17'),_0xca75('0x18'),'dialGlobalInterval',_0xca75('0x19'),_0xca75('0x1a'),_0xca75('0x1b'),'dialAMDInitialSilence',_0xca75('0x1c'),_0xca75('0x1d'),'dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0xca75('0x1e'),_0xca75('0x1f'),_0xca75('0x20'),_0xca75('0x21'),_0xca75('0x22'),_0xca75('0x23'),'dialOrderByScheduledAt',_0xca75('0x24'),_0xca75('0x25'),_0xca75('0x26'),'monitor_format',_0xca75('0x27'),_0xca75('0x28'),'dialCutDigit','dialNoSuchNumberMaxRetry',_0xca75('0x29'),_0xca75('0x2a'),_0xca75('0x2b'),_0xca75('0x2c'),'dialAbandonedRetryFrequency','dialMachineMaxRetry',_0xca75('0x2d'),_0xca75('0x2e'),_0xca75('0x2f'),'mandatoryDisposition',_0xca75('0x30'),_0xca75('0x31')],'include':[{'model':_0xca75('0x32'),'as':'Trunk','attributes':['id',_0xca75('0x3'),_0xca75('0x33'),_0xca75('0x34')]},{'model':_0xca75('0x35'),'as':_0xca75('0x36'),'attributes':['id',_0xca75('0x3')]},{'model':'Trunk','as':_0xca75('0x37'),'attributes':['id',_0xca75('0x3'),'callerid',_0xca75('0x34')]},{'model':'Interval','as':_0xca75('0x38'),'attributes':['id',_0xca75('0x3')],'include':[{'model':_0xca75('0x38'),'as':_0xca75('0x39'),'attributes':['id',_0xca75('0x3'),_0xca75('0x3a')]}]}]},'log':_0xca75('0x1')});};}; \ No newline at end of file +var _0xa816=['dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','Trunk','callerid','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval','Intervals','interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','autopause','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateTimeout','dialQueueOptions','dialCongestionMaxRetry'];(function(_0x2abcfb,_0x63de19){var _0x13f3a5=function(_0x2a18d2){while(--_0x2a18d2){_0x2abcfb['push'](_0x2abcfb['shift']());}};_0x13f3a5(++_0x63de19);}(_0xa816,0xd7));var _0x6a81=function(_0x1f530d,_0x18a19e){_0x1f530d=_0x1f530d-0x0;var _0x22103f=_0xa816[_0x1f530d];return _0x22103f;};'use strict';var client=require(_0x6a81('0x0'));exports[_0x6a81('0x1')]=function(){return function(){return client[_0x6a81('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x6a81('0x3'),_0x6a81('0x4'),_0x6a81('0x5'),_0x6a81('0x6'),'monitor_format',_0x6a81('0x7'),_0x6a81('0x8'),'dialMethod',_0x6a81('0x9'),_0x6a81('0xa'),_0x6a81('0xb'),_0x6a81('0xc'),_0x6a81('0xd'),'dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0x6a81('0xe'),_0x6a81('0xf'),'dialQueueTimeout','dialQueueProject',_0x6a81('0x10'),_0x6a81('0x11'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0x6a81('0x12'),_0x6a81('0x13'),_0x6a81('0x14'),'dialTimezone',_0x6a81('0x15'),_0x6a81('0x16'),_0x6a81('0x17'),'dialAMDActive','dialAMDInitialSilence',_0x6a81('0x18'),_0x6a81('0x19'),_0x6a81('0x1a'),_0x6a81('0x1b'),_0x6a81('0x1c'),_0x6a81('0x1d'),_0x6a81('0x1e'),_0x6a81('0x1f'),'timeout',_0x6a81('0x20'),_0x6a81('0x21'),_0x6a81('0x22'),'dialAgiAfterHangupAgent',_0x6a81('0x23'),_0x6a81('0x24'),_0x6a81('0x25'),_0x6a81('0x26'),_0x6a81('0x27'),_0x6a81('0x28'),_0x6a81('0x29'),_0x6a81('0x2a'),'dialDropMaxRetry',_0x6a81('0x2b'),_0x6a81('0x2c'),_0x6a81('0x2d'),_0x6a81('0x2e'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x6a81('0x2f'),'mandatoryDisposition',_0x6a81('0x30'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x6a81('0x31'),'as':_0x6a81('0x31'),'attributes':['id',_0x6a81('0x3'),_0x6a81('0x32'),'active']},{'model':_0x6a81('0x33'),'as':_0x6a81('0x34'),'attributes':['id','name']},{'model':_0x6a81('0x31'),'as':_0x6a81('0x35'),'attributes':['id',_0x6a81('0x3'),_0x6a81('0x32'),_0x6a81('0x36')]},{'model':_0x6a81('0x37'),'as':_0x6a81('0x37'),'attributes':['id',_0x6a81('0x3')],'include':[{'model':_0x6a81('0x37'),'as':_0x6a81('0x38'),'attributes':['id',_0x6a81('0x3'),_0x6a81('0x39')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 79f9c7e..5843673 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 _0x6eeb=['queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','create','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x487e24,_0x489736){var _0x372f73=function(_0x16c7d8){while(--_0x16c7d8){_0x487e24['push'](_0x487e24['shift']());}};_0x372f73(++_0x489736);}(_0x6eeb,0x1f1));var _0xb6ee=function(_0x447d73,_0x50f8c7){_0x447d73=_0x447d73-0x0;var _0x343b07=_0x6eeb[_0x447d73];return _0x343b07;};'use strict';var moment=require(_0xb6ee('0x0'));var _=require(_0xb6ee('0x1'));var client=require(_0xb6ee('0x2'));exports[_0xb6ee('0x3')]=function(_0x34392b){return client['Request'](_0xb6ee('0x4'),{'body':_0x34392b,'log':'CreateVoiceQueueReport'});};exports[_0xb6ee('0x5')]=function(){return function(){return client['Request'](_0xb6ee('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xb6ee('0x7')](_0xb6ee('0x8'))[_0xb6ee('0x9')](_0xb6ee('0xa')),moment()[_0xb6ee('0xb')](_0xb6ee('0x8'))[_0xb6ee('0x9')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['uniqueid','queue',_0xb6ee('0xc'),_0xb6ee('0xd'),_0xb6ee('0xe'),_0xb6ee('0xf'),'queuecallerexit','queuecallerexitAt',_0xb6ee('0x10'),_0xb6ee('0x11')]},'log':_0xb6ee('0x12')});};}; \ No newline at end of file +var _0x2ec5=['queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','create','CreateVoiceQueueReport','getVoiceQueueReports','Request','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0x2ec5,0x76));var _0x52ec=function(_0x1b363d,_0x472d4e){_0x1b363d=_0x1b363d-0x0;var _0x5e3e32=_0x2ec5[_0x1b363d];return _0x5e3e32;};'use strict';var moment=require(_0x52ec('0x0'));var _=require(_0x52ec('0x1'));var client=require(_0x52ec('0x2'));exports[_0x52ec('0x3')]=function(_0x1efda7){return client['Request']('CreateVoiceQueueReport',{'body':_0x1efda7,'log':_0x52ec('0x4')});};exports[_0x52ec('0x5')]=function(){return function(){return client[_0x52ec('0x6')](_0x52ec('0x7'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x52ec('0x8')](_0x52ec('0x9'))[_0x52ec('0xa')](_0x52ec('0xb')),moment()[_0x52ec('0xc')]('day')['format'](_0x52ec('0xb'))]}},'attributes':[_0x52ec('0xd'),'queue',_0x52ec('0xe'),'queuecallerleaveAt',_0x52ec('0xf'),_0x52ec('0x10'),_0x52ec('0x11'),_0x52ec('0x12'),_0x52ec('0x13'),_0x52ec('0x14')]},'log':_0x52ec('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index df3da16..c62174e 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 _0x945a=['getVoiceQueueRtPauses','Request'];(function(_0x2045dc,_0x5ea4f5){var _0x3734ab=function(_0x3d778e){while(--_0x3d778e){_0x2045dc['push'](_0x2045dc['shift']());}};_0x3734ab(++_0x5ea4f5);}(_0x945a,0x1d2));var _0xa945=function(_0x363115,_0x57df71){_0x363115=_0x363115-0x0;var _0x1554d3=_0x945a[_0x363115];return _0x1554d3;};'use strict';var client=require('../client');exports[_0xa945('0x0')]=function(_0x2f8a86){return function(){return client[_0xa945('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x2f8a86,'paused':!![]},'raw':!![]},'log':_0xa945('0x0')});};}; \ No newline at end of file +var _0x4faa=['getVoiceQueueRtPauses','../client'];(function(_0x235bf6,_0x437d56){var _0x1b1f0d=function(_0x15c20b){while(--_0x15c20b){_0x235bf6['push'](_0x235bf6['shift']());}};_0x1b1f0d(++_0x437d56);}(_0x4faa,0x8f));var _0xa4fa=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x4faa[_0xbca1b1];return _0x4e1686;};'use strict';var client=require(_0xa4fa('0x0'));exports[_0xa4fa('0x1')]=function(_0x49ba6c){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x49ba6c,'paused':!![]},'raw':!![]},'log':_0xa4fa('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 5e69c6e..1fb25f6 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 _0x3ba1=['merge','lodash','create','Request','CreateVoiceRecording'];(function(_0x26f7a1,_0x549e62){var _0x58a0e7=function(_0x420c67){while(--_0x420c67){_0x26f7a1['push'](_0x26f7a1['shift']());}};_0x58a0e7(++_0x549e62);}(_0x3ba1,0x1d7));var _0x13ba=function(_0x4e3f51,_0x271183){_0x4e3f51=_0x4e3f51-0x0;var _0xffbbb9=_0x3ba1[_0x4e3f51];return _0xffbbb9;};'use strict';var _=require(_0x13ba('0x0'));var client=require('../client');exports[_0x13ba('0x1')]=function(_0x3e1bfc){return client[_0x13ba('0x2')](_0x13ba('0x3'),{'body':_[_0x13ba('0x4')](_0x3e1bfc,{'value':_0x3e1bfc['monitorFilename']}),'log':_0x13ba('0x3')});}; \ No newline at end of file +var _0x2df8=['merge','monitorFilename','lodash','create','Request','CreateVoiceRecording'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x2df8,0x9e));var _0x82df=function(_0x33022e,_0x3c99b3){_0x33022e=_0x33022e-0x0;var _0x28358b=_0x2df8[_0x33022e];return _0x28358b;};'use strict';var _=require(_0x82df('0x0'));var client=require('../client');exports[_0x82df('0x1')]=function(_0x241618){return client[_0x82df('0x2')](_0x82df('0x3'),{'body':_[_0x82df('0x4')](_0x241618,{'value':_0x241618[_0x82df('0x5')]}),'log':_0x82df('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 8eb29d3..00bdf09 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 _0xb7db=['transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','transfers','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','isexternal','context','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','transfertargetcalleridnum'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0xb7db,0x19e));var _0xbb7d=function(_0xb7f47f,_0x8bd255){_0xb7f47f=_0xb7f47f-0x0;var _0x398ff5=_0xb7db[_0xb7f47f];return _0x398ff5;};'use strict';var client=require('../client');exports[_0xbb7d('0x0')]={};exports['blindTransfer']=function(_0x4e9689){return client[_0xbb7d('0x1')](_0xbb7d('0x2'),{'body':{'result':_0x4e9689[_0xbb7d('0x3')],'transfererchannel':_0x4e9689[_0xbb7d('0x4')],'transferercalleridnum':_0x4e9689[_0xbb7d('0x5')],'transferercalleridname':_0x4e9689['transferercalleridname'],'transfererconnectedlinenum':_0x4e9689[_0xbb7d('0x6')],'transfererconnectedlinename':_0x4e9689[_0xbb7d('0x7')],'transfereraccountcode':_0x4e9689[_0xbb7d('0x8')],'transferercontext':_0x4e9689[_0xbb7d('0x9')],'transfererexten':_0x4e9689['transfererexten'],'transfererlinkedid':_0x4e9689[_0xbb7d('0xa')],'transfereechannel':_0x4e9689['transfereechannel'],'transfereecalleridnum':_0x4e9689[_0xbb7d('0xb')],'transfereecalleridname':_0x4e9689[_0xbb7d('0xc')],'transfereeconnectedlinenum':_0x4e9689[_0xbb7d('0xd')],'transfereeconnectedlinename':_0x4e9689[_0xbb7d('0xe')],'transfereeaccountcode':_0x4e9689[_0xbb7d('0xf')],'transfereecontext':_0x4e9689['transfereecontext'],'transfereeexten':_0x4e9689[_0xbb7d('0x10')],'transfereelinkedid':_0x4e9689['transfereelinkedid'],'isexternal':_0x4e9689[_0xbb7d('0x11')],'context':_0x4e9689[_0xbb7d('0x12')],'extension':_0x4e9689['extension'],'type':_0xbb7d('0x13')},'log':'CreateVoiceTransferReport'});};exports[_0xbb7d('0x14')]=function(_0x596237){return client[_0xbb7d('0x1')](_0xbb7d('0x2'),{'body':{'result':_0x596237['result'],'transfererchannel':_0x596237[_0xbb7d('0x15')],'transferercalleridnum':_0x596237[_0xbb7d('0x16')],'transferercalleridname':_0x596237[_0xbb7d('0x17')],'transfererconnectedlinenum':_0x596237['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x596237[_0xbb7d('0x18')],'transfereraccountcode':_0x596237['origtransfereraccountcode'],'transferercontext':_0x596237[_0xbb7d('0x19')],'transfererexten':_0x596237[_0xbb7d('0x1a')],'transfererlinkedid':_0x596237['origtransfererlinkedid'],'transfereechannel':_0x596237['transfertargetchannel'],'transfereecalleridnum':_0x596237[_0xbb7d('0x1b')],'transfereecalleridname':_0x596237['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x596237[_0xbb7d('0x1c')],'transfereeconnectedlinename':_0x596237['transfertargetconnectedlinename'],'transfereeaccountcode':_0x596237['transfertargetaccountcode'],'transfereecontext':_0x596237[_0xbb7d('0x1d')],'transfereeexten':_0x596237[_0xbb7d('0x1e')],'transfereelinkedid':_0x596237[_0xbb7d('0x1f')],'isexternal':_0x596237['isexternal'],'context':_0x596237['origtransferercontext'],'extension':_0x596237[_0xbb7d('0x20')],'type':_0xbb7d('0x21')},'log':_0xbb7d('0x2')});}; \ No newline at end of file +var _0xc869=['transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xc869,0x173));var _0x9c86=function(_0x160d97,_0x3409d1){_0x160d97=_0x160d97-0x0;var _0x35ed19=_0xc869[_0x160d97];return _0x35ed19;};'use strict';var client=require(_0x9c86('0x0'));exports['transfers']={};exports[_0x9c86('0x1')]=function(_0x1005d0){return client[_0x9c86('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x1005d0[_0x9c86('0x3')],'transfererchannel':_0x1005d0[_0x9c86('0x4')],'transferercalleridnum':_0x1005d0[_0x9c86('0x5')],'transferercalleridname':_0x1005d0[_0x9c86('0x6')],'transfererconnectedlinenum':_0x1005d0['transfererconnectedlinenum'],'transfererconnectedlinename':_0x1005d0['transfererconnectedlinename'],'transfereraccountcode':_0x1005d0['transfereraccountcode'],'transferercontext':_0x1005d0[_0x9c86('0x7')],'transfererexten':_0x1005d0[_0x9c86('0x8')],'transfererlinkedid':_0x1005d0[_0x9c86('0x9')],'transfereechannel':_0x1005d0['transfereechannel'],'transfereecalleridnum':_0x1005d0[_0x9c86('0xa')],'transfereecalleridname':_0x1005d0['transfereecalleridname'],'transfereeconnectedlinenum':_0x1005d0[_0x9c86('0xb')],'transfereeconnectedlinename':_0x1005d0[_0x9c86('0xc')],'transfereeaccountcode':_0x1005d0[_0x9c86('0xd')],'transfereecontext':_0x1005d0[_0x9c86('0xe')],'transfereeexten':_0x1005d0[_0x9c86('0xf')],'transfereelinkedid':_0x1005d0[_0x9c86('0x10')],'isexternal':_0x1005d0['isexternal'],'context':_0x1005d0[_0x9c86('0x11')],'extension':_0x1005d0[_0x9c86('0x12')],'type':_0x9c86('0x13')},'log':_0x9c86('0x14')});};exports[_0x9c86('0x15')]=function(_0x17179b){return client['Request'](_0x9c86('0x14'),{'body':{'result':_0x17179b[_0x9c86('0x3')],'transfererchannel':_0x17179b[_0x9c86('0x16')],'transferercalleridnum':_0x17179b[_0x9c86('0x17')],'transferercalleridname':_0x17179b[_0x9c86('0x18')],'transfererconnectedlinenum':_0x17179b[_0x9c86('0x19')],'transfererconnectedlinename':_0x17179b['secondtransfererconnectedlinename'],'transfereraccountcode':_0x17179b[_0x9c86('0x1a')],'transferercontext':_0x17179b[_0x9c86('0x1b')],'transfererexten':_0x17179b['secondtransfererexten'],'transfererlinkedid':_0x17179b[_0x9c86('0x1c')],'transfereechannel':_0x17179b['transfertargetchannel'],'transfereecalleridnum':_0x17179b[_0x9c86('0x1d')],'transfereecalleridname':_0x17179b[_0x9c86('0x1e')],'transfereeconnectedlinenum':_0x17179b[_0x9c86('0x1f')],'transfereeconnectedlinename':_0x17179b[_0x9c86('0x20')],'transfereeaccountcode':_0x17179b[_0x9c86('0x21')],'transfereecontext':_0x17179b[_0x9c86('0x22')],'transfereeexten':_0x17179b[_0x9c86('0x23')],'transfereelinkedid':_0x17179b[_0x9c86('0x24')],'isexternal':_0x17179b['isexternal'],'context':_0x17179b[_0x9c86('0x25')],'extension':_0x17179b[_0x9c86('0x26')],'type':_0x9c86('0x27')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 8b2a6f2..afd249c 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 _0xb44f=['destinationchannel','stop','%s.%s','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','exten','context','telephones','trunks','outboundChannels','run','event','Event\x20name\x20mandatory','faxAccounts','checkAfterSend','server','http','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','bluebird','moment','../../../config/environment','../ami','listen','format','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','keys','action','Reload','Action','then','message','catch','join','pick','command','Command','content','voiceQueues','hasOwnProperty','answered','available','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','type','outbound','dialActive','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','Interval','push','values','voicechannel','validate','channels','filename','uniqueid','wav','channel','ai(mixmonitorid)','find','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','length','map','resolve','StopMixMonitor'];(function(_0x4c013a,_0x487a2e){var _0xcea9b=function(_0x5f599d){while(--_0x5f599d){_0x4c013a['push'](_0x4c013a['shift']());}};_0xcea9b(++_0x487a2e);}(_0xb44f,0x123));var _0xfb44=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xb44f[_0xbca1b1];return _0x4e1686;};'use strict';var _=require('lodash');var util=require(_0xfb44('0x0'));var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require(_0xfb44('0x1'));var moment=require(_0xfb44('0x2'));var config=require(_0xfb44('0x3'));var properties=require('../properties');var ami=require(_0xfb44('0x4'));exports[_0xfb44('0x5')]=function(_0x51ecaf,_0x152d5d,_0x316b8b){return new BPromise(function(_0x1908ac,_0x2d5b63){var _0x601109={'QueuePause':function(_0x30b3c5){return new Promise(function(_0x5eaa0b,_0x361948){var _0x5d163=util[_0xfb44('0x6')]('%s/%s',_0xfb44('0x7'),_0x30b3c5[_0xfb44('0x8')]);if(_0x51ecaf[_0xfb44('0x9')]&&_0x51ecaf[_0xfb44('0x9')][_0x5d163]&&_0x51ecaf[_0xfb44('0x9')][_0x5d163][_0xfb44('0xa')]){_0x51ecaf[_0xfb44('0x9')][_0x5d163][_0xfb44('0xb')]();}if(_0x51ecaf['agents'][_0x5d163]){_0x51ecaf[_0xfb44('0xc')][_0x5d163][_0xfb44('0xd')]({'statePause':_0x30b3c5[_0xfb44('0xe')]?!![]:![]});}_0x5eaa0b({'code':0xc8,'message':_0xfb44('0xf')});});},'Reload':function(_0x14e6b7){var _0x26a03b=this;return new Promise(function(_0x459cdb,_0x389eb7){if(ami[_0xfb44('0x10')]()==![]){return _0x389eb7(_0x26a03b[_0xfb44('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xfb44('0x12')][_0xfb44('0x13')],_0xfb44('0x14')]['join']('\x20')));}_0x14e6b7=_['pick'](_0x14e6b7,_[_0xfb44('0x15')](properties['module']));_0x14e6b7[_0xfb44('0x16')]=_0xfb44('0x17');return ami[_0xfb44('0x18')](_0x14e6b7)[_0xfb44('0x19')](function(_0x51d932){_0x459cdb({'code':0xc8,'message':_0x51d932[_0xfb44('0x1a')]});})[_0xfb44('0x1b')](function(_0xce14f8){_0x389eb7(_0x26a03b[_0xfb44('0x11')](0x1f5,_0xce14f8[_0xfb44('0x1a')]));});});},'Command':function(_0x37c57f){var _0x25e581=this;return new Promise(function(_0x5ad8de,_0x32e0fd){if(ami[_0xfb44('0x10')]()==![]){return _0x32e0fd(_0x25e581[_0xfb44('0x11')](0x1f4,[config[_0xfb44('0x12')]['ip'],config['asterisk'][_0xfb44('0x13')],_0xfb44('0x14')][_0xfb44('0x1c')]('\x20')));}_0x37c57f=_[_0xfb44('0x1d')](_0x37c57f,_0xfb44('0x1e'));_0x37c57f['action']=_0xfb44('0x1f');return ami[_0xfb44('0x18')](_0x37c57f)[_0xfb44('0x19')](function(_0x48082e){_0x5ad8de({'code':0xc8,'message':_0x48082e[_0xfb44('0x20')]});})['catch'](function(_0xd0c110){_0x32e0fd(_0x25e581['error'](0x1f5,_0xd0c110[_0xfb44('0x1a')]));});});},'VoiceQueues':function(_0x171910){return new Promise(function(_0xae6712,_0x218db1){var _0x3522b0=[];for(var _0x1f3cbd in _0x51ecaf[_0xfb44('0x21')]){if(_0x51ecaf[_0xfb44('0x21')][_0xfb44('0x22')](_0x1f3cbd)){var _0x2aa728=_0x51ecaf['voiceQueues'][_0x1f3cbd];var _0xd39048={'id':_0x2aa728['id'],'name':_0x2aa728[_0xfb44('0x8')],'strategy':_0x2aa728['strategy'],'answered':_0x2aa728[_0xfb44('0x23')],'available':_0x2aa728[_0xfb44('0x24')],'loggedIn':_0x2aa728['loggedIn'],'pTalking':_0x2aa728['pTalking'],'sumBillable':_0x2aa728[_0xfb44('0x25')],'sumDuration':_0x2aa728[_0xfb44('0x26')],'sumHoldTime':_0x2aa728[_0xfb44('0x27')]||0x0,'talking':_0x2aa728[_0xfb44('0x28')],'total':_0x2aa728[_0xfb44('0x29')],'type':_0x2aa728['type'],'unmanaged':_0x2aa728[_0xfb44('0x2a')],'abandoned':_0x2aa728[_0xfb44('0x2b')],'waiting':_0x2aa728['waiting'],'loggedInDb':_0x2aa728[_0xfb44('0x2c')]};if(_0x2aa728[_0xfb44('0x2d')]===_0xfb44('0x2e')){_0xd39048[_0xfb44('0x2f')]=_0x2aa728[_0xfb44('0x2f')];_0xd39048['dialMethod']=_0x2aa728['dialMethod'];_0xd39048['dialOriginateCallerIdName']=_0x2aa728['dialOriginateCallerIdName'];_0xd39048[_0xfb44('0x30')]=_0x2aa728[_0xfb44('0x30')];_0xd39048[_0xfb44('0x31')]=_0x2aa728[_0xfb44('0x31')];_0xd39048[_0xfb44('0x32')]=_0x2aa728[_0xfb44('0x32')];_0xd39048[_0xfb44('0x33')]=_0x2aa728['outboundAnswerAgiCallsDay'];_0xd39048['outboundAnswerCallsDay']=_0x2aa728[_0xfb44('0x34')];_0xd39048[_0xfb44('0x35')]=_0x2aa728[_0xfb44('0x35')];_0xd39048[_0xfb44('0x36')]=_0x2aa728[_0xfb44('0x36')];_0xd39048[_0xfb44('0x37')]=_0x2aa728[_0xfb44('0x37')];_0xd39048[_0xfb44('0x38')]=_0x2aa728['outboundDropCallsDayACS'];_0xd39048['outboundDropCallsDayCallersExit']=_0x2aa728[_0xfb44('0x39')];_0xd39048[_0xfb44('0x3a')]=_0x2aa728['outboundDropCallsDayTimeout'];_0xd39048[_0xfb44('0x3b')]=_0x2aa728['outboundNoAnswerCallsDay'];_0xd39048[_0xfb44('0x3c')]=_0x2aa728[_0xfb44('0x3c')];_0xd39048[_0xfb44('0x3d')]=_0x2aa728[_0xfb44('0x3d')];_0xd39048[_0xfb44('0x3e')]=_0x2aa728[_0xfb44('0x3e')];_0xd39048['outboundRejectCallsDay']=_0x2aa728[_0xfb44('0x3f')];_0xd39048[_0xfb44('0x40')]=_0x2aa728['outboundUnknownCallsDay'];_0xd39048[_0xfb44('0x41')]=_0x2aa728[_0xfb44('0x41')];_0xd39048['predictiveIntervalAvgHoldtime']=_0x2aa728[_0xfb44('0x42')];_0xd39048[_0xfb44('0x43')]=_0x2aa728[_0xfb44('0x43')];_0xd39048['predictiveIntervalDroppedCallsCallersExit']=_0x2aa728[_0xfb44('0x44')];_0xd39048[_0xfb44('0x45')]=_0x2aa728['predictiveIntervalDroppedCallsTimeout'];_0xd39048['predictiveIntervalErlangCalls']=_0x2aa728[_0xfb44('0x46')];_0xd39048[_0xfb44('0x47')]=_0x2aa728[_0xfb44('0x47')];_0xd39048[_0xfb44('0x48')]=_0x2aa728['predictiveIntervalHitRate'];_0xd39048[_0xfb44('0x49')]=_0x2aa728[_0xfb44('0x49')];_0xd39048['predictiveIntervalPauses']=_0x2aa728[_0xfb44('0x4a')];_0xd39048[_0xfb44('0x4b')]=_0x2aa728[_0xfb44('0x4b')];_0xd39048[_0xfb44('0x4c')]=_0x2aa728['predictiveIntervalTotalCalls'];_0xd39048[_0xfb44('0x1a')]=_0x2aa728['message'];_0xd39048[_0xfb44('0x4d')]=_0x2aa728['originated'];_0xd39048[_0xfb44('0x4e')]=_0x2aa728[_0xfb44('0x4e')];_0xd39048[_0xfb44('0x4f')]=_0x2aa728['erlangCallToSecond'];_0xd39048[_0xfb44('0x50')]=_0x2aa728[_0xfb44('0x50')];_0xd39048[_0xfb44('0x51')]=_0x2aa728[_0xfb44('0x51')];_0xd39048[_0xfb44('0x52')]=_0x2aa728[_0xfb44('0x52')];_0xd39048[_0xfb44('0x53')]=_0x2aa728[_0xfb44('0x53')];}if(_0x2aa728['Trunk']){_0xd39048[_0xfb44('0x54')]={'id':_0x2aa728['Trunk']['id'],'name':_0x2aa728['Trunk'][_0xfb44('0x8')],'active':_0x2aa728[_0xfb44('0x54')]['active'],'callerid':_0x2aa728['Trunk']['callerid']};}if(_0x2aa728[_0xfb44('0x55')]){_0xd39048[_0xfb44('0x55')]={'id':_0x2aa728[_0xfb44('0x55')]['id'],'name':_0x2aa728['Interval'][_0xfb44('0x8')]};}_0x3522b0[_0xfb44('0x56')](_0xd39048);}}_0xae6712({'count':_0x3522b0['length'],'rows':_0x3522b0});});},'VoiceChannels':function(_0x3b1261){return new Promise(function(_0x7d04de,_0x38da67){var _0x2f1575=_[_0xfb44('0x57')](_0x51ecaf['channels']);_0x7d04de({'count':_0x2f1575['length'],'rows':_0x2f1575});});},'VoiceChannelMixMonitor':function(_0x262498){var _0x1bcbfc=this;return new Promise(function(_0x4d579a,_0x173f72){if(ami[_0xfb44('0x10')]()==![]){return _0x173f72(_0x1bcbfc[_0xfb44('0x11')](0x1f4,[config[_0xfb44('0x12')]['ip'],config['asterisk'][_0xfb44('0x13')],_0xfb44('0x14')]['join']('\x20')));}var _0x1aec7b=schema(properties[_0xfb44('0x58')])[_0xfb44('0x59')](_0x262498);if(_0x1aec7b['length']>0x0){return _0x173f72(_0x1bcbfc['error'](0x1f4,_['map'](_0x1aec7b,_0xfb44('0x1a'))[_0xfb44('0x1c')](',\x20')));}var _0x182343=_['find'](_0x51ecaf[_0xfb44('0x5a')],{'uniqueid':_0x262498['uniqueid']});if(_0x182343&&_0x182343['channel']){var _0x3d5bb8=util['format']('%s.%s',_0x262498[_0xfb44('0x5b')]||_0x262498[_0xfb44('0x5c')],_0x262498[_0xfb44('0x6')]||_0xfb44('0x5d'));return ami['Action']({'action':'MixMonitor','channel':_0x182343[_0xfb44('0x5e')],'file':_0x3d5bb8,'options':_0xfb44('0x5f')})[_0xfb44('0x19')](function(_0x298a6f){var _0x1e025b=_[_0xfb44('0x60')](_0x182343[_0xfb44('0x61')],{'filename':'/var/spool/asterisk/monitor/'+_0x3d5bb8[_0xfb44('0x62')]()});if(_[_0xfb44('0x63')](_0x1e025b)){_0x182343[_0xfb44('0x61')][_0xfb44('0x56')]({'filename':_0xfb44('0x64')+_0x3d5bb8[_0xfb44('0x62')](),'createdAt':moment()[_0xfb44('0x6')](_0xfb44('0x65')),'mixmonitorid':_0x298a6f[_0xfb44('0x66')],'status':_0xfb44('0x67')});}else{_0x1e025b[_0xfb44('0x66')]=_0x298a6f['mixmonitorid'];_0x1e025b[_0xfb44('0x68')]=_0xfb44('0x67');}_0x4d579a({'code':0xc8,'message':[_0x262498['uniqueid'],_0xfb44('0x69'),_0x298a6f['mixmonitorid']][_0xfb44('0x1c')]('\x20'),'mixmonitorid':_0x298a6f['mixmonitorid']});})[_0xfb44('0x1b')](function(_0x15aca1){_0x173f72(_0x1bcbfc['error'](0x1f5,[_0x262498['uniqueid'],_0x15aca1['message'][_0xfb44('0x62')]()][_0xfb44('0x1c')]('\x20')));});}else{return _0x173f72(_0x1bcbfc['error'](0x1f5,_0xfb44('0x6a')));}});},'VoiceChannelStopMixMonitor':function(_0xfcc9fe){var _0x4403b5=this;return new Promise(function(_0x5b8ac4,_0x29bc04){if(ami[_0xfb44('0x10')]()==![]){return _0x29bc04(_0x4403b5[_0xfb44('0x11')](0x1f4,[config[_0xfb44('0x12')]['ip'],config[_0xfb44('0x12')][_0xfb44('0x13')],_0xfb44('0x14')][_0xfb44('0x1c')]('\x20')));}var _0x4cda77=schema(properties[_0xfb44('0x58')])[_0xfb44('0x59')](_0xfcc9fe);if(_0x4cda77[_0xfb44('0x6b')]>0x0){return _0x29bc04(_0x4403b5[_0xfb44('0x11')](0x1f4,_[_0xfb44('0x6c')](_0x4cda77,_0xfb44('0x1a'))[_0xfb44('0x1c')](',\x20')));}var _0x1cacf6=_['find'](_0x51ecaf[_0xfb44('0x5a')],{'uniqueid':_0xfcc9fe[_0xfb44('0x5c')]});if(_0x1cacf6){return BPromise[_0xfb44('0x6d')]()['then'](function(){if(_0x1cacf6[_0xfb44('0x5e')]){return ami[_0xfb44('0x18')]({'action':_0xfb44('0x6e'),'channel':_0x1cacf6[_0xfb44('0x5e')],'mixmonitorid':_0xfcc9fe[_0xfb44('0x66')]})['catch'](function(_0x1c032c){});}})[_0xfb44('0x19')](function(){if(_0x1cacf6[_0xfb44('0x6f')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x1cacf6[_0xfb44('0x6f')],'mixmonitorid':_0xfcc9fe[_0xfb44('0x66')]})[_0xfb44('0x1b')](function(_0x50bd1c){});}})[_0xfb44('0x19')](function(_0x29bd59){var _0x4474f3=_[_0xfb44('0x60')](_0x1cacf6['monitors'],{'mixmonitorid':_0xfcc9fe[_0xfb44('0x66')]});if(_0x4474f3){_0x4474f3[_0xfb44('0x68')]=_0xfb44('0x70');}})[_0xfb44('0x19')](function(){var _0x3bdc9a=util[_0xfb44('0x6')](_0xfb44('0x71'),_0xfcc9fe[_0xfb44('0x5b')]||_0xfcc9fe[_0xfb44('0x5c')],_0xfcc9fe[_0xfb44('0x6')]||_0xfb44('0x5d'));var _0x434d55=_['find'](_0x1cacf6[_0xfb44('0x61')],{'filename':_0xfb44('0x64')+_0x3bdc9a[_0xfb44('0x62')]()});if(_0x434d55){_0x434d55[_0xfb44('0x68')]=_0xfb44('0x70');}})[_0xfb44('0x19')](function(){_0x5b8ac4({'code':0xc8,'message':[_0xfcc9fe['uniqueid'],_0xfb44('0x72')][_0xfb44('0x1c')]('\x20')});})[_0xfb44('0x1b')](function(_0x491775){_0x29bc04(_0x4403b5[_0xfb44('0x11')](0x1f5,[_0xfcc9fe[_0xfb44('0x5c')],_0x491775[_0xfb44('0x1a')]['toLowerCase']()][_0xfb44('0x1c')]('\x20')));});}else{return _0x29bc04(_0x4403b5[_0xfb44('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x38a412){return new Promise(function(_0x4c046f,_0x212897){var _0x45ebd1=_['values'](_0x51ecaf[_0xfb44('0x73')]);_0x4c046f({'count':_0x45ebd1[_0xfb44('0x6b')],'rows':_0x45ebd1});});},'VoiceQueuesChannel':function(_0x1c9714){var _0xd900f6=this;return new Promise(function(_0x1f5b6c,_0x23c104){var _0x2428fa=schema(properties[_0xfb44('0x74')])[_0xfb44('0x59')](_0x1c9714);if(_0x2428fa[_0xfb44('0x6b')]>0x0){return _0x23c104(_0xd900f6[_0xfb44('0x11')](0x1f4,_[_0xfb44('0x6c')](_0x2428fa,_0xfb44('0x1a'))['join'](',\x20')));}var _0x3bfa16=_[_0xfb44('0x60')](_0x51ecaf[_0xfb44('0x73')],{'uniqueid':_0x1c9714['uniqueid']});if(_0x3bfa16){_0x1f5b6c(_0x3bfa16);}else{return _0x23c104(_0xd900f6[_0xfb44('0x11')](0x1f5,_0xfb44('0x6a')));}});},'VoiceQueuesChannelHangup':function(_0x56e75e){var _0x4bc443=this;return new Promise(function(_0x51ec66,_0x6bb77c){if(ami[_0xfb44('0x10')]()==![]){return _0x6bb77c(_0x4bc443[_0xfb44('0x11')](0x1f4,[config[_0xfb44('0x12')]['ip'],config['asterisk'][_0xfb44('0x13')],_0xfb44('0x14')][_0xfb44('0x1c')]('\x20')));}var _0x46574b=schema(properties[_0xfb44('0x75')])[_0xfb44('0x59')](_0x56e75e);if(_0x46574b['length']>0x0){return _0x6bb77c(_0x4bc443[_0xfb44('0x11')](0x1f4,_[_0xfb44('0x6c')](_0x46574b,_0xfb44('0x1a'))[_0xfb44('0x1c')](',\x20')));}var _0x1bd2fc=_[_0xfb44('0x60')](_0x51ecaf[_0xfb44('0x73')],{'uniqueid':_0x56e75e[_0xfb44('0x5c')]});if(_0x1bd2fc&&_0x1bd2fc[_0xfb44('0x5e')]){return ami[_0xfb44('0x18')]({'action':_0xfb44('0x76'),'channel':_0x1bd2fc['channel']})[_0xfb44('0x19')](function(_0xfcb54a){_0x51ec66({'code':0xc8,'message':[_0x56e75e[_0xfb44('0x5c')],_0xfcb54a[_0xfb44('0x1a')]['toLowerCase']()][_0xfb44('0x1c')]('\x20')});})[_0xfb44('0x1b')](function(_0x2baeb3){_0x6bb77c(_0x4bc443['error'](0x1f5,[_0x56e75e[_0xfb44('0x5c')],_0x2baeb3[_0xfb44('0x1a')]['toLowerCase']()][_0xfb44('0x1c')]('\x20')));});}else{return _0x6bb77c(_0x4bc443[_0xfb44('0x11')](0x1f5,_0xfb44('0x6a')));}});},'VoiceQueuesChannelRedirect':function(_0x3b1a8c){var _0x9d1115=this;return new Promise(function(_0xbc472d,_0x3315be){if(ami[_0xfb44('0x10')]()==![]){return _0x3315be(_0x9d1115[_0xfb44('0x11')](0x1f4,[config[_0xfb44('0x12')]['ip'],config['asterisk'][_0xfb44('0x13')],_0xfb44('0x14')][_0xfb44('0x1c')]('\x20')));}var _0x3a8bc2=schema(properties[_0xfb44('0x77')])['validate'](_0x3b1a8c);if(_0x3a8bc2[_0xfb44('0x6b')]>0x0){return _0x3315be(_0x9d1115[_0xfb44('0x11')](0x1f4,_[_0xfb44('0x6c')](_0x3a8bc2,_0xfb44('0x1a'))[_0xfb44('0x1c')](',\x20')));}var _0x198ad7=_[_0xfb44('0x60')](_0x51ecaf[_0xfb44('0x73')],{'uniqueid':_0x3b1a8c[_0xfb44('0x5c')]});if(_0x198ad7&&_0x198ad7[_0xfb44('0x5e')]){return ami['Action']({'action':'Redirect','channel':_0x198ad7[_0xfb44('0x5e')],'exten':_0x3b1a8c[_0xfb44('0x78')],'context':_0x3b1a8c[_0xfb44('0x79')]||_0x198ad7[_0xfb44('0x79')],'priority':0x1})[_0xfb44('0x19')](function(_0xf6f37c){_0xbc472d({'code':0xc8,'message':[_0x3b1a8c[_0xfb44('0x5c')],_0xf6f37c[_0xfb44('0x1a')][_0xfb44('0x62')]()][_0xfb44('0x1c')]('\x20')});})['catch'](function(_0x1965ca){_0x3315be(_0x9d1115['error'](0x1f5,[_0x3b1a8c[_0xfb44('0x5c')],_0x1965ca['message'][_0xfb44('0x62')]()][_0xfb44('0x1c')]('\x20')));});}else{return _0x3315be(_0x9d1115['error'](0x1f5,_0xfb44('0x6a')));}});},'Agents':function(_0x29a80c){return new Promise(function(_0xda44d0,_0x530124){var _0x408aca=_[_0xfb44('0x57')](_0x51ecaf['agents']);_0xda44d0({'count':_0x408aca[_0xfb44('0x6b')],'rows':_0x408aca});});},'Telephones':function(_0x35a463){return new Promise(function(_0x1f0930,_0x4ed074){var _0x30dea6=_[_0xfb44('0x57')](_0x51ecaf[_0xfb44('0x7a')]);_0x1f0930({'count':_0x30dea6[_0xfb44('0x6b')],'rows':_0x30dea6});});},'Trunks':function(_0x5b2824){return new Promise(function(_0x4a5715,_0x1dfcb7){var _0x3e78c4=_[_0xfb44('0x57')](_0x51ecaf[_0xfb44('0x7b')]);_0x4a5715({'count':_0x3e78c4['length'],'rows':_0x3e78c4});});},'OutboundChannels':function(_0x4b69b0){return new Promise(function(_0xc24f66,_0x276b4c){var _0x1688c3=_[_0xfb44('0x57')](_0x51ecaf[_0xfb44('0x7c')]);_0xc24f66({'count':_0x1688c3[_0xfb44('0x6b')],'rows':_0x1688c3});});},'Outbound':function(_0x12284b){return new Promise(function(_0x25d80a,_0x386af7){_0x25d80a(_0x51ecaf['outbound']);});},'Campaigns':function(_0xb1563f){return new Promise(function(_0x5c9584,_0x48aeee){var _0x56c70c=_[_0xfb44('0x57')](_0x51ecaf['campaigns']);_0x5c9584({'count':_0x56c70c['length'],'rows':_0x56c70c});});},'VoiceQueuesPreview':function(_0x1a7a1f){var _0x8e1ae6=this;return new Promise(function(_0x387e9a,_0xc71dac){_0x152d5d[_0xfb44('0x7d')](_0x1a7a1f['id'])[_0xfb44('0x19')](function(_0x25d3a6){_0x387e9a({'code':0xc8,'message':_0x25d3a6[_0xfb44('0x1a')]});})[_0xfb44('0x1b')](function(_0x55dd0d){_0xc71dac(_0x8e1ae6['error'](0x1f4,_0x55dd0d[_0xfb44('0x1a')]));});});},'EventManager':function(_0x5af3ad){var _0xd41b6d=this;return new Promise(function(_0x5ed6d1,_0x4190f2){if(!_0x5af3ad[_0xfb44('0x7e')]){return _0x4190f2(_0xd41b6d[_0xfb44('0x11')](0x1f4,_0xfb44('0x7f')));}ami['emit']('custom:'+_0x5af3ad['event'],_0x5af3ad['message']);_0x5ed6d1({'code':0xc8,'message':_0x5af3ad});});},'FaxAccounts':function(_0x565b5b){return new Promise(function(_0x22d73a,_0x77fae9){var _0x2ea1bd=_[_0xfb44('0x57')](_0x51ecaf[_0xfb44('0x80')]);_0x22d73a({'count':_0x2ea1bd[_0xfb44('0x6b')],'rows':_0x2ea1bd});});},'SendFax':function(_0x15e4d3){var _0x5d3707=this;return new Promise(function(_0x198e11,_0x207b70){_0x316b8b['send'](_0x15e4d3)[_0xfb44('0x19')](function(_0x760fd){_0x198e11({'code':0xc8,'message':_0x760fd[_0xfb44('0x1a')]});})[_0xfb44('0x1b')](function(_0x1fb0fa){_0x207b70(_0x5d3707[_0xfb44('0x11')](0x1f4,_0x1fb0fa['message']));});});},'CheckAfterSend':function(_0x2fac8a){var _0x10d1ba=this;return new Promise(function(_0x10decc,_0x2a6191){_0x316b8b[_0xfb44('0x81')](_0x2fac8a)['then'](function(_0xe64331){_0x10decc({'code':0xc8,'message':_0xe64331[_0xfb44('0x1a')]});})[_0xfb44('0x1b')](function(_0x1702d5){_0x2a6191(_0x10d1ba['error'](0x1f4,_0x1702d5[_0xfb44('0x1a')]));});});}};var _0x3b339d=jayson[_0xfb44('0x82')](_0x601109)[_0xfb44('0x83')]();_0x3b339d['on']('error',function(_0x674b18){return _0x2d5b63(_0x674b18);});_0x3b339d[_0xfb44('0x5')](0x232a,'127.0.0.1',function(){console['log'](_0xfb44('0x84'),0x232a);return _0x1908ac(_0xfb44('0x85')+0x232a);});});}; \ No newline at end of file +var _0xb478=['push','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','StopMixMonitor','destinationchannel','stop','%s.%s','StopMixMonitor\x20Success','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','outboundChannels','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','validate','bluebird','../../../config/environment','../properties','../ami','listen','format','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','Reload','message','username','command','then','content','catch','voiceQueues','hasOwnProperty','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','length','values','voicechannel','map','find','channels','channel','filename','uniqueid','wav','Action','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase'];(function(_0x55352a,_0x63f3d3){var _0x598374=function(_0x4e4ee3){while(--_0x4e4ee3){_0x55352a['push'](_0x55352a['shift']());}};_0x598374(++_0x63f3d3);}(_0xb478,0x11a));var _0x8b47=function(_0x2730ad,_0x4d247d){_0x2730ad=_0x2730ad-0x0;var _0x1d4363=_0xb478[_0x2730ad];return _0x1d4363;};'use strict';var _=require('lodash');var util=require(_0x8b47('0x0'));var jayson=require('jayson/promise');var schema=require(_0x8b47('0x1'));var BPromise=require(_0x8b47('0x2'));var moment=require('moment');var config=require(_0x8b47('0x3'));var properties=require(_0x8b47('0x4'));var ami=require(_0x8b47('0x5'));exports[_0x8b47('0x6')]=function(_0x34f386,_0x2307f9,_0x1f759e){return new BPromise(function(_0x2c83d0,_0x344174){var _0x4d6b30={'QueuePause':function(_0x481faa){return new Promise(function(_0x58c897,_0x5ec4ef){var _0x4ad7ee=util[_0x8b47('0x7')]('%s/%s','SIP',_0x481faa[_0x8b47('0x8')]);if(_0x34f386[_0x8b47('0x9')]&&_0x34f386[_0x8b47('0x9')][_0x4ad7ee]&&_0x34f386[_0x8b47('0x9')][_0x4ad7ee][_0x8b47('0xa')]){_0x34f386[_0x8b47('0x9')][_0x4ad7ee][_0x8b47('0xb')]();}if(_0x34f386[_0x8b47('0xc')][_0x4ad7ee]){_0x34f386[_0x8b47('0xc')][_0x4ad7ee][_0x8b47('0xd')]({'statePause':_0x481faa[_0x8b47('0xe')]?!![]:![]});}_0x58c897({'code':0xc8,'message':_0x8b47('0xf')});});},'Reload':function(_0x5dc84d){var _0x1e8122=this;return new Promise(function(_0x30fe20,_0x5dd6d0){if(ami[_0x8b47('0x10')]()==![]){return _0x5dd6d0(_0x1e8122[_0x8b47('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x8b47('0x12')]['username'],_0x8b47('0x13')][_0x8b47('0x14')]('\x20')));}_0x5dc84d=_[_0x8b47('0x15')](_0x5dc84d,_[_0x8b47('0x16')](properties['module']));_0x5dc84d['action']=_0x8b47('0x17');return ami['Action'](_0x5dc84d)['then'](function(_0x3ae2bd){_0x30fe20({'code':0xc8,'message':_0x3ae2bd[_0x8b47('0x18')]});})['catch'](function(_0x1fe515){_0x5dd6d0(_0x1e8122[_0x8b47('0x11')](0x1f5,_0x1fe515['message']));});});},'Command':function(_0x32ab1d){var _0xf054c=this;return new Promise(function(_0x3e5db0,_0x2f81de){if(ami[_0x8b47('0x10')]()==![]){return _0x2f81de(_0xf054c[_0x8b47('0x11')](0x1f4,[config[_0x8b47('0x12')]['ip'],config['asterisk'][_0x8b47('0x19')],_0x8b47('0x13')][_0x8b47('0x14')]('\x20')));}_0x32ab1d=_['pick'](_0x32ab1d,_0x8b47('0x1a'));_0x32ab1d['action']='Command';return ami['Action'](_0x32ab1d)[_0x8b47('0x1b')](function(_0x51326c){_0x3e5db0({'code':0xc8,'message':_0x51326c[_0x8b47('0x1c')]});})[_0x8b47('0x1d')](function(_0x2ed798){_0x2f81de(_0xf054c[_0x8b47('0x11')](0x1f5,_0x2ed798[_0x8b47('0x18')]));});});},'VoiceQueues':function(_0x5eaab7){return new Promise(function(_0x33d9e2,_0xd2d8f8){var _0x186e37=[];for(var _0x14261d in _0x34f386['voiceQueues']){if(_0x34f386[_0x8b47('0x1e')][_0x8b47('0x1f')](_0x14261d)){var _0x50b9cb=_0x34f386[_0x8b47('0x1e')][_0x14261d];var _0x2437ff={'id':_0x50b9cb['id'],'name':_0x50b9cb[_0x8b47('0x8')],'strategy':_0x50b9cb['strategy'],'answered':_0x50b9cb[_0x8b47('0x20')],'available':_0x50b9cb[_0x8b47('0x21')],'loggedIn':_0x50b9cb[_0x8b47('0x22')],'pTalking':_0x50b9cb['pTalking'],'sumBillable':_0x50b9cb[_0x8b47('0x23')],'sumDuration':_0x50b9cb[_0x8b47('0x24')],'sumHoldTime':_0x50b9cb[_0x8b47('0x25')]||0x0,'talking':_0x50b9cb[_0x8b47('0x26')],'total':_0x50b9cb[_0x8b47('0x27')],'type':_0x50b9cb['type'],'unmanaged':_0x50b9cb['unmanaged'],'abandoned':_0x50b9cb['abandoned'],'waiting':_0x50b9cb['waiting'],'loggedInDb':_0x50b9cb[_0x8b47('0x28')]};if(_0x50b9cb['type']===_0x8b47('0x29')){_0x2437ff[_0x8b47('0x2a')]=_0x50b9cb[_0x8b47('0x2a')];_0x2437ff[_0x8b47('0x2b')]=_0x50b9cb['dialMethod'];_0x2437ff[_0x8b47('0x2c')]=_0x50b9cb[_0x8b47('0x2c')];_0x2437ff[_0x8b47('0x2d')]=_0x50b9cb[_0x8b47('0x2d')];_0x2437ff['dialOriginateTimeout']=_0x50b9cb[_0x8b47('0x2e')];_0x2437ff[_0x8b47('0x2f')]=_0x50b9cb[_0x8b47('0x2f')];_0x2437ff[_0x8b47('0x30')]=_0x50b9cb['outboundAnswerAgiCallsDay'];_0x2437ff[_0x8b47('0x31')]=_0x50b9cb[_0x8b47('0x31')];_0x2437ff['outboundBlacklistCallsDay']=_0x50b9cb['outboundBlacklistCallsDay'];_0x2437ff[_0x8b47('0x32')]=_0x50b9cb[_0x8b47('0x32')];_0x2437ff['outboundCongestionCallsDay']=_0x50b9cb[_0x8b47('0x33')];_0x2437ff[_0x8b47('0x34')]=_0x50b9cb[_0x8b47('0x34')];_0x2437ff[_0x8b47('0x35')]=_0x50b9cb['outboundDropCallsDayCallersExit'];_0x2437ff[_0x8b47('0x36')]=_0x50b9cb[_0x8b47('0x36')];_0x2437ff[_0x8b47('0x37')]=_0x50b9cb['outboundNoAnswerCallsDay'];_0x2437ff[_0x8b47('0x38')]=_0x50b9cb['outboundNoSuchCallsDay'];_0x2437ff['outboundOriginateFailureCallsDay']=_0x50b9cb[_0x8b47('0x39')];_0x2437ff['outboundReCallsDay']=_0x50b9cb[_0x8b47('0x3a')];_0x2437ff[_0x8b47('0x3b')]=_0x50b9cb[_0x8b47('0x3b')];_0x2437ff[_0x8b47('0x3c')]=_0x50b9cb['outboundUnknownCallsDay'];_0x2437ff['predictiveIntervalAnsweredCalls']=_0x50b9cb[_0x8b47('0x3d')];_0x2437ff['predictiveIntervalAvgHoldtime']=_0x50b9cb[_0x8b47('0x3e')];_0x2437ff[_0x8b47('0x3f')]=_0x50b9cb['predictiveIntervalAvgTalktime'];_0x2437ff[_0x8b47('0x40')]=_0x50b9cb[_0x8b47('0x40')];_0x2437ff['predictiveIntervalDroppedCallsTimeout']=_0x50b9cb[_0x8b47('0x41')];_0x2437ff[_0x8b47('0x42')]=_0x50b9cb['predictiveIntervalErlangCalls'];_0x2437ff['predictiveIntervalErlangCallsDroppedCalls']=_0x50b9cb[_0x8b47('0x43')];_0x2437ff[_0x8b47('0x44')]=_0x50b9cb[_0x8b47('0x44')];_0x2437ff[_0x8b47('0x45')]=_0x50b9cb['predictiveIntervalMultiplicativeFactor'];_0x2437ff[_0x8b47('0x46')]=_0x50b9cb[_0x8b47('0x46')];_0x2437ff['predictiveIntervalAvailable']=_0x50b9cb[_0x8b47('0x47')];_0x2437ff[_0x8b47('0x48')]=_0x50b9cb['predictiveIntervalTotalCalls'];_0x2437ff[_0x8b47('0x18')]=_0x50b9cb[_0x8b47('0x18')];_0x2437ff['originated']=_0x50b9cb[_0x8b47('0x49')];_0x2437ff[_0x8b47('0x4a')]=_0x50b9cb[_0x8b47('0x4a')];_0x2437ff['erlangCallToSecond']=_0x50b9cb[_0x8b47('0x4b')];_0x2437ff['erlangAbandonmentRate']=_0x50b9cb[_0x8b47('0x4c')];_0x2437ff[_0x8b47('0x4d')]=_0x50b9cb[_0x8b47('0x4d')];_0x2437ff[_0x8b47('0x4e')]=_0x50b9cb['startPredictive'];_0x2437ff['startProgressive']=_0x50b9cb[_0x8b47('0x4f')];}if(_0x50b9cb['Trunk']){_0x2437ff['Trunk']={'id':_0x50b9cb[_0x8b47('0x50')]['id'],'name':_0x50b9cb['Trunk'][_0x8b47('0x8')],'active':_0x50b9cb['Trunk']['active'],'callerid':_0x50b9cb[_0x8b47('0x50')][_0x8b47('0x51')]};}if(_0x50b9cb['Interval']){_0x2437ff[_0x8b47('0x52')]={'id':_0x50b9cb[_0x8b47('0x52')]['id'],'name':_0x50b9cb[_0x8b47('0x52')][_0x8b47('0x8')]};}_0x186e37['push'](_0x2437ff);}}_0x33d9e2({'count':_0x186e37[_0x8b47('0x53')],'rows':_0x186e37});});},'VoiceChannels':function(_0x4ebbd8){return new Promise(function(_0x55fa59,_0x48f1c4){var _0x1c7da6=_[_0x8b47('0x54')](_0x34f386['channels']);_0x55fa59({'count':_0x1c7da6[_0x8b47('0x53')],'rows':_0x1c7da6});});},'VoiceChannelMixMonitor':function(_0x2a1219){var _0xc4ced8=this;return new Promise(function(_0x3e81f6,_0x56fef1){if(ami[_0x8b47('0x10')]()==![]){return _0x56fef1(_0xc4ced8[_0x8b47('0x11')](0x1f4,[config[_0x8b47('0x12')]['ip'],config['asterisk'][_0x8b47('0x19')],'ami\x20disconnected'][_0x8b47('0x14')]('\x20')));}var _0x368cb7=schema(properties[_0x8b47('0x55')])['validate'](_0x2a1219);if(_0x368cb7[_0x8b47('0x53')]>0x0){return _0x56fef1(_0xc4ced8[_0x8b47('0x11')](0x1f4,_[_0x8b47('0x56')](_0x368cb7,_0x8b47('0x18'))[_0x8b47('0x14')](',\x20')));}var _0x4e143b=_[_0x8b47('0x57')](_0x34f386[_0x8b47('0x58')],{'uniqueid':_0x2a1219['uniqueid']});if(_0x4e143b&&_0x4e143b[_0x8b47('0x59')]){var _0x35ffbb=util[_0x8b47('0x7')]('%s.%s',_0x2a1219[_0x8b47('0x5a')]||_0x2a1219[_0x8b47('0x5b')],_0x2a1219['format']||_0x8b47('0x5c'));return ami[_0x8b47('0x5d')]({'action':_0x8b47('0x5e'),'channel':_0x4e143b[_0x8b47('0x59')],'file':_0x35ffbb,'options':_0x8b47('0x5f')})['then'](function(_0x5a7eb6){var _0x27e21b=_['find'](_0x4e143b[_0x8b47('0x60')],{'filename':_0x8b47('0x61')+_0x35ffbb[_0x8b47('0x62')]()});if(_['isNil'](_0x27e21b)){_0x4e143b[_0x8b47('0x60')][_0x8b47('0x63')]({'filename':_0x8b47('0x61')+_0x35ffbb['toLowerCase'](),'createdAt':moment()[_0x8b47('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x5a7eb6[_0x8b47('0x64')],'status':'rec'});}else{_0x27e21b['mixmonitorid']=_0x5a7eb6['mixmonitorid'];_0x27e21b[_0x8b47('0x65')]=_0x8b47('0x66');}_0x3e81f6({'code':0xc8,'message':[_0x2a1219[_0x8b47('0x5b')],_0x8b47('0x67'),_0x5a7eb6[_0x8b47('0x64')]][_0x8b47('0x14')]('\x20'),'mixmonitorid':_0x5a7eb6[_0x8b47('0x64')]});})['catch'](function(_0x159528){_0x56fef1(_0xc4ced8[_0x8b47('0x11')](0x1f5,[_0x2a1219[_0x8b47('0x5b')],_0x159528[_0x8b47('0x18')]['toLowerCase']()][_0x8b47('0x14')]('\x20')));});}else{return _0x56fef1(_0xc4ced8['error'](0x1f5,_0x8b47('0x68')));}});},'VoiceChannelStopMixMonitor':function(_0x1ece67){var _0x1dac79=this;return new Promise(function(_0x582ae5,_0x34338e){if(ami[_0x8b47('0x10')]()==![]){return _0x34338e(_0x1dac79[_0x8b47('0x11')](0x1f4,[config[_0x8b47('0x12')]['ip'],config['asterisk'][_0x8b47('0x19')],_0x8b47('0x13')]['join']('\x20')));}var _0x25a236=schema(properties[_0x8b47('0x55')])[_0x8b47('0x1')](_0x1ece67);if(_0x25a236[_0x8b47('0x53')]>0x0){return _0x34338e(_0x1dac79[_0x8b47('0x11')](0x1f4,_['map'](_0x25a236,_0x8b47('0x18'))['join'](',\x20')));}var _0x5ecd92=_[_0x8b47('0x57')](_0x34f386[_0x8b47('0x58')],{'uniqueid':_0x1ece67[_0x8b47('0x5b')]});if(_0x5ecd92){return BPromise['resolve']()[_0x8b47('0x1b')](function(){if(_0x5ecd92[_0x8b47('0x59')]){return ami[_0x8b47('0x5d')]({'action':_0x8b47('0x69'),'channel':_0x5ecd92[_0x8b47('0x59')],'mixmonitorid':_0x1ece67[_0x8b47('0x64')]})[_0x8b47('0x1d')](function(_0x30c361){});}})[_0x8b47('0x1b')](function(){if(_0x5ecd92['destinationchannel']){return ami['Action']({'action':_0x8b47('0x69'),'channel':_0x5ecd92[_0x8b47('0x6a')],'mixmonitorid':_0x1ece67[_0x8b47('0x64')]})[_0x8b47('0x1d')](function(_0x4feb26){});}})[_0x8b47('0x1b')](function(_0x18c6f8){var _0x4aef0a=_[_0x8b47('0x57')](_0x5ecd92['monitors'],{'mixmonitorid':_0x1ece67[_0x8b47('0x64')]});if(_0x4aef0a){_0x4aef0a[_0x8b47('0x65')]=_0x8b47('0x6b');}})[_0x8b47('0x1b')](function(){var _0x295952=util['format'](_0x8b47('0x6c'),_0x1ece67['filename']||_0x1ece67['uniqueid'],_0x1ece67[_0x8b47('0x7')]||_0x8b47('0x5c'));var _0x28c039=_[_0x8b47('0x57')](_0x5ecd92[_0x8b47('0x60')],{'filename':_0x8b47('0x61')+_0x295952[_0x8b47('0x62')]()});if(_0x28c039){_0x28c039[_0x8b47('0x65')]=_0x8b47('0x6b');}})['then'](function(){_0x582ae5({'code':0xc8,'message':[_0x1ece67[_0x8b47('0x5b')],_0x8b47('0x6d')][_0x8b47('0x14')]('\x20')});})[_0x8b47('0x1d')](function(_0x313bdf){_0x34338e(_0x1dac79[_0x8b47('0x11')](0x1f5,[_0x1ece67[_0x8b47('0x5b')],_0x313bdf['message'][_0x8b47('0x62')]()]['join']('\x20')));});}else{return _0x34338e(_0x1dac79[_0x8b47('0x11')](0x1f5,_0x8b47('0x68')));}});},'VoiceQueuesChannels':function(_0x6bc046){return new Promise(function(_0x27a590,_0xba9309){var _0x2480d6=_[_0x8b47('0x54')](_0x34f386[_0x8b47('0x6e')]);_0x27a590({'count':_0x2480d6[_0x8b47('0x53')],'rows':_0x2480d6});});},'VoiceQueuesChannel':function(_0xa8ea10){var _0x3561d4=this;return new Promise(function(_0xfb4f3c,_0x126f73){var _0x46c7d4=schema(properties['voicequeuechannel'])[_0x8b47('0x1')](_0xa8ea10);if(_0x46c7d4[_0x8b47('0x53')]>0x0){return _0x126f73(_0x3561d4[_0x8b47('0x11')](0x1f4,_[_0x8b47('0x56')](_0x46c7d4,_0x8b47('0x18'))[_0x8b47('0x14')](',\x20')));}var _0x1fee89=_[_0x8b47('0x57')](_0x34f386[_0x8b47('0x6e')],{'uniqueid':_0xa8ea10[_0x8b47('0x5b')]});if(_0x1fee89){_0xfb4f3c(_0x1fee89);}else{return _0x126f73(_0x3561d4['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x21a270){var _0x576144=this;return new Promise(function(_0x5369a5,_0xedf4ad){if(ami[_0x8b47('0x10')]()==![]){return _0xedf4ad(_0x576144[_0x8b47('0x11')](0x1f4,[config[_0x8b47('0x12')]['ip'],config[_0x8b47('0x12')][_0x8b47('0x19')],_0x8b47('0x13')][_0x8b47('0x14')]('\x20')));}var _0x328abe=schema(properties['voicequeuechannelhangup'])['validate'](_0x21a270);if(_0x328abe[_0x8b47('0x53')]>0x0){return _0xedf4ad(_0x576144[_0x8b47('0x11')](0x1f4,_[_0x8b47('0x56')](_0x328abe,'message')[_0x8b47('0x14')](',\x20')));}var _0x3431e5=_['find'](_0x34f386['queueChannels'],{'uniqueid':_0x21a270[_0x8b47('0x5b')]});if(_0x3431e5&&_0x3431e5[_0x8b47('0x59')]){return ami[_0x8b47('0x5d')]({'action':_0x8b47('0x6f'),'channel':_0x3431e5[_0x8b47('0x59')]})[_0x8b47('0x1b')](function(_0x459be0){_0x5369a5({'code':0xc8,'message':[_0x21a270[_0x8b47('0x5b')],_0x459be0['message'][_0x8b47('0x62')]()][_0x8b47('0x14')]('\x20')});})[_0x8b47('0x1d')](function(_0x4b8970){_0xedf4ad(_0x576144[_0x8b47('0x11')](0x1f5,[_0x21a270[_0x8b47('0x5b')],_0x4b8970[_0x8b47('0x18')][_0x8b47('0x62')]()][_0x8b47('0x14')]('\x20')));});}else{return _0xedf4ad(_0x576144[_0x8b47('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x29982a){var _0x14c909=this;return new Promise(function(_0x4f1c1c,_0x3cf160){if(ami[_0x8b47('0x10')]()==![]){return _0x3cf160(_0x14c909[_0x8b47('0x11')](0x1f4,[config[_0x8b47('0x12')]['ip'],config[_0x8b47('0x12')]['username'],_0x8b47('0x13')]['join']('\x20')));}var _0xd8cb98=schema(properties[_0x8b47('0x70')])['validate'](_0x29982a);if(_0xd8cb98['length']>0x0){return _0x3cf160(_0x14c909[_0x8b47('0x11')](0x1f4,_['map'](_0xd8cb98,'message')['join'](',\x20')));}var _0x458c77=_[_0x8b47('0x57')](_0x34f386[_0x8b47('0x6e')],{'uniqueid':_0x29982a[_0x8b47('0x5b')]});if(_0x458c77&&_0x458c77['channel']){return ami['Action']({'action':_0x8b47('0x71'),'channel':_0x458c77['channel'],'exten':_0x29982a[_0x8b47('0x72')],'context':_0x29982a[_0x8b47('0x73')]||_0x458c77[_0x8b47('0x73')],'priority':0x1})[_0x8b47('0x1b')](function(_0x1b4951){_0x4f1c1c({'code':0xc8,'message':[_0x29982a['uniqueid'],_0x1b4951['message']['toLowerCase']()][_0x8b47('0x14')]('\x20')});})[_0x8b47('0x1d')](function(_0x1e0a32){_0x3cf160(_0x14c909[_0x8b47('0x11')](0x1f5,[_0x29982a[_0x8b47('0x5b')],_0x1e0a32[_0x8b47('0x18')][_0x8b47('0x62')]()]['join']('\x20')));});}else{return _0x3cf160(_0x14c909['error'](0x1f5,_0x8b47('0x68')));}});},'Agents':function(_0x164c67){return new Promise(function(_0x27866f,_0x5d2ee8){var _0x1ae9ad=_['values'](_0x34f386[_0x8b47('0xc')]);_0x27866f({'count':_0x1ae9ad[_0x8b47('0x53')],'rows':_0x1ae9ad});});},'Telephones':function(_0x93a10e){return new Promise(function(_0x21829d,_0x5ab13b){var _0x76c52c=_[_0x8b47('0x54')](_0x34f386['telephones']);_0x21829d({'count':_0x76c52c[_0x8b47('0x53')],'rows':_0x76c52c});});},'Trunks':function(_0x20cc01){return new Promise(function(_0x30d95a,_0x3812d1){var _0x230027=_[_0x8b47('0x54')](_0x34f386['trunks']);_0x30d95a({'count':_0x230027[_0x8b47('0x53')],'rows':_0x230027});});},'OutboundChannels':function(_0x2312c8){return new Promise(function(_0x5e310b,_0x10cc1f){var _0x23f7a3=_['values'](_0x34f386[_0x8b47('0x74')]);_0x5e310b({'count':_0x23f7a3['length'],'rows':_0x23f7a3});});},'Outbound':function(_0x4954ac){return new Promise(function(_0x39b844,_0x1e4d1c){_0x39b844(_0x34f386[_0x8b47('0x29')]);});},'Campaigns':function(_0x4cf405){return new Promise(function(_0x1c0b4c,_0xd06957){var _0x111e3f=_['values'](_0x34f386['campaigns']);_0x1c0b4c({'count':_0x111e3f['length'],'rows':_0x111e3f});});},'VoiceQueuesPreview':function(_0x1f44ed){var _0x4a0047=this;return new Promise(function(_0x3106b9,_0x5081c7){_0x2307f9['run'](_0x1f44ed['id'])[_0x8b47('0x1b')](function(_0xae324f){_0x3106b9({'code':0xc8,'message':_0xae324f[_0x8b47('0x18')]});})['catch'](function(_0x207c5d){_0x5081c7(_0x4a0047[_0x8b47('0x11')](0x1f4,_0x207c5d[_0x8b47('0x18')]));});});},'EventManager':function(_0x4be59a){var _0x34ca95=this;return new Promise(function(_0x17e425,_0xbd176c){if(!_0x4be59a[_0x8b47('0x75')]){return _0xbd176c(_0x34ca95[_0x8b47('0x11')](0x1f4,_0x8b47('0x76')));}ami['emit'](_0x8b47('0x77')+_0x4be59a[_0x8b47('0x75')],_0x4be59a['message']);_0x17e425({'code':0xc8,'message':_0x4be59a});});},'FaxAccounts':function(_0x232689){return new Promise(function(_0x36688f,_0x3077a3){var _0x3e87f4=_[_0x8b47('0x54')](_0x34f386[_0x8b47('0x78')]);_0x36688f({'count':_0x3e87f4[_0x8b47('0x53')],'rows':_0x3e87f4});});},'SendFax':function(_0x49a2a8){var _0x5c7ee2=this;return new Promise(function(_0x114881,_0x10c766){_0x1f759e[_0x8b47('0x79')](_0x49a2a8)[_0x8b47('0x1b')](function(_0x345148){_0x114881({'code':0xc8,'message':_0x345148[_0x8b47('0x18')]});})[_0x8b47('0x1d')](function(_0x21ddb8){_0x10c766(_0x5c7ee2[_0x8b47('0x11')](0x1f4,_0x21ddb8['message']));});});},'CheckAfterSend':function(_0x16bd3c){var _0x449d02=this;return new Promise(function(_0x6ec561,_0x3622dc){_0x1f759e[_0x8b47('0x7a')](_0x16bd3c)[_0x8b47('0x1b')](function(_0x209bfb){_0x6ec561({'code':0xc8,'message':_0x209bfb[_0x8b47('0x18')]});})['catch'](function(_0x3c2490){_0x3622dc(_0x449d02['error'](0x1f4,_0x3c2490[_0x8b47('0x18')]));});});}};var _0x4db279=jayson['server'](_0x4d6b30)['http']();_0x4db279['on'](_0x8b47('0x11'),function(_0x123fd8){return _0x344174(_0x123fd8);});_0x4db279[_0x8b47('0x6')](0x232a,_0x8b47('0x7b'),function(){console[_0x8b47('0x7c')](_0x8b47('0x7d'),0x232a);return _0x2c83d0(_0x8b47('0x7e')+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 7539cc4..d559a27 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 _0xd7cc=['info','[CM][%s][%s]','emit','data1','data2','xmd-contactid','ListId','data3','split','$or','map','routeId','calleridnum','firstName','lastName','phone','createdAt','scheduledAt','resolve','getContacts','then','isEmpty','length','uniqueid','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','destcalleridnum','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','name','format','trigger:%s','merge','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost'];(function(_0x5bc141,_0x42561b){var _0x42bce1=function(_0x2bef5c){while(--_0x2bef5c){_0x5bc141['push'](_0x5bc141['shift']());}};_0x42bce1(++_0x42561b);}(_0xd7cc,0x11d));var _0xcd7c=function(_0x594b8b,_0x206cb6){_0x594b8b=_0x594b8b-0x0;var _0x119d69=_0xd7cc[_0x594b8b];return _0x119d69;};'use strict';var _=require(_0xcd7c('0x0'));var BPromise=require('bluebird');var Redis=require(_0xcd7c('0x1'));var util=require(_0xcd7c('0x2'));var config=require(_0xcd7c('0x3'));var logger=require(_0xcd7c('0x4'))('trigger');var cmContactRpc=require(_0xcd7c('0x5'));config[_0xcd7c('0x6')]=_[_0xcd7c('0x7')](config[_0xcd7c('0x6')],{'host':_0xcd7c('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcd7c('0x6')]));function emit(_0x1d947d,_0x4f4c4a,_0x370dcd,_0x4e4aca,_0xc2a4b0){logger[_0xcd7c('0x9')](_0xcd7c('0xa'),_0x1d947d,_0x4f4c4a['id'],_0x370dcd,_0x4e4aca,JSON['stringify'](_0xc2a4b0));io['to'](_0x370dcd)[_0xcd7c('0xb')](_0x4e4aca,_0xc2a4b0);}exports['exec']=function(_0x25381b,_0x5d84b1,_0x8a5356,_0x2e3c80){var _0x37da9f,_0x2de168;var _0xbc6b31={};var _0x258a64=Number(_0x8a5356[_0xcd7c('0xc')]);var _0xbad189=_0x8a5356['data2']?Boolean(Number(_0x8a5356[_0xcd7c('0xd')])):![];var _0x3f1139;if(_0x2e3c80[_0xcd7c('0xe')]){_0xbc6b31['id']=_0x2e3c80[_0xcd7c('0xe')];}if(!_0xbc6b31['id']){_0xbc6b31[_0xcd7c('0xf')]=_0x258a64;_0x3f1139=_0x8a5356[_0xcd7c('0x10')]&&_0x8a5356['data3']!=='0'?_0x8a5356['data3'][_0xcd7c('0x11')](','):['phone'];_0xbc6b31[_0xcd7c('0x12')]=_[_0xcd7c('0x13')](_0x3f1139,function(_0x1d72b4){var _0xf1aa05={};_0xf1aa05[_0x1d72b4]=_0x2e3c80[_0xcd7c('0x14')]?_0x2e3c80['destcalleridnum']:_0x2e3c80[_0xcd7c('0x15')];return _0xf1aa05;});}var _0x1c84c7=['id',_0xcd7c('0x16'),_0xcd7c('0x17'),_0xcd7c('0x18'),'mobile','fax',_0xcd7c('0xf'),_0xcd7c('0x19'),_0xcd7c('0x1a'),'updatedAt'];var _0x395b=_['union'](_0x1c84c7,_0x3f1139);BPromise[_0xcd7c('0x1b')]()['then'](cmContactRpc[_0xcd7c('0x1c')]({'attributes':_0x395b,'where':_0xbc6b31}))[_0xcd7c('0x1d')](function(_0x4163ab){_0x2de168=_0x4163ab;if(!_[_0xcd7c('0x1e')](_0x2de168)){if(_0x2de168[_0xcd7c('0x1f')]===0x1){_0x37da9f=_0x2de168[0x0];logger['info']('[CM][%s][%s]\x20Contact\x20found:%s',_0x2e3c80[_0xcd7c('0x20')],_0x5d84b1['id'],_0x37da9f['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x2e3c80['uniqueid'],_0x5d84b1['id'],_['map'](_0x2de168,'id')[_0xcd7c('0x21')](','));}return;}else{logger[_0xcd7c('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x2e3c80[_0xcd7c('0x20')],_0x5d84b1['id']);var _0x287abd={'ListId':_0x258a64};var _0x19cf26=_0x8a5356[_0xcd7c('0x22')]&&_0x8a5356['data4']!=='0'?_0x8a5356['data4']:_0xcd7c('0x18');if(_0xbad189){logger['info'](_0xcd7c('0x23'),_0x2e3c80[_0xcd7c('0x20')],_0x5d84b1['id']);_0x287abd[_0x19cf26]=_[_0xcd7c('0x24')](_0x2e3c80['routeId'])?_0x2e3c80['calleridnum']:_0x2e3c80[_0xcd7c('0x25')];if(_[_0xcd7c('0x24')](_0x2e3c80[_0xcd7c('0x14')])){_0x287abd['firstName']=_0x2e3c80[_0xcd7c('0x26')]&&_0x2e3c80[_0xcd7c('0x26')]!==_0xcd7c('0x27')?_0x2e3c80[_0xcd7c('0x26')]:_0xcd7c('0x28');}else{_0x287abd[_0xcd7c('0x16')]=_0x2e3c80[_0xcd7c('0x29')]&&_0x2e3c80['destcalleridname']!==_0xcd7c('0x27')?_0x2e3c80['destcalleridname']:'Unknown';}return BPromise[_0xcd7c('0x1b')]()[_0xcd7c('0x1d')](cmContactRpc[_0xcd7c('0x2a')](_0x287abd))[_0xcd7c('0x1d')](function(_0x13af64){_0x37da9f=_0x13af64;_0x2de168[_0xcd7c('0x2b')](_0x13af64);if(_0x37da9f){logger[_0xcd7c('0x9')](_0xcd7c('0x2c'),_0x2e3c80[_0xcd7c('0x20')],_0x5d84b1['id'],_0x37da9f['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x2e3c80[_0xcd7c('0x20')],_0x5d84b1['id']);_0x287abd[_0x19cf26]=_[_0xcd7c('0x24')](_0x2e3c80[_0xcd7c('0x14')])?_0x2e3c80[_0xcd7c('0x15')]:_0x2e3c80[_0xcd7c('0x25')];if(_[_0xcd7c('0x24')](_0x2e3c80['routeId'])){_0x287abd['firstName']=_0x2e3c80[_0xcd7c('0x26')]&&_0x2e3c80[_0xcd7c('0x26')]!==_0xcd7c('0x27')?_0x2e3c80['calleridname']:_0xcd7c('0x28');}else{_0x287abd[_0xcd7c('0x16')]=_0x2e3c80['destcalleridname']&&_0x2e3c80[_0xcd7c('0x29')]!==_0xcd7c('0x27')?_0x2e3c80['destcalleridname']:'Unknown';}_0x37da9f=_0x287abd;_0x2de168[_0xcd7c('0x2b')](_0x287abd);return;}}})['then'](function(){if(_0x25381b){emit(_0x2e3c80[_0xcd7c('0x20')],_0x5d84b1,util['format']('user:%s',_0x25381b[_0xcd7c('0x2d')]),util[_0xcd7c('0x2e')](_0xcd7c('0x2f'),_0x8a5356['action']['toLowerCase']()),{'evt':_[_0xcd7c('0x30')](_0x2e3c80,{'autoCreate':_0xbad189}),'contact':_0x37da9f===undefined?{}:_0x37da9f,'contacts':_0x2de168[_0xcd7c('0x1f')]===0x0?undefined:_0x2de168});}});}; \ No newline at end of file +var _0xd937=['trigger:%s','action','toLowerCase','length','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','info','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','createdAt','scheduledAt','resolve','then','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name'];(function(_0x1b699c,_0x43b7a7){var _0x7d1082=function(_0xaebd95){while(--_0xaebd95){_0x1b699c['push'](_0x1b699c['shift']());}};_0x7d1082(++_0x43b7a7);}(_0xd937,0xdc));var _0x7d93=function(_0x284b88,_0x3adbb2){_0x284b88=_0x284b88-0x0;var _0x44489d=_0xd937[_0x284b88];return _0x44489d;};'use strict';var _=require(_0x7d93('0x0'));var BPromise=require(_0x7d93('0x1'));var Redis=require(_0x7d93('0x2'));var util=require(_0x7d93('0x3'));var config=require(_0x7d93('0x4'));var logger=require(_0x7d93('0x5'))(_0x7d93('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0x7d93('0x7')]=_[_0x7d93('0x8')](config['redis'],{'host':_0x7d93('0x9'),'port':0x18eb});var io=require(_0x7d93('0xa'))(new Redis(config[_0x7d93('0x7')]));function emit(_0x3880ac,_0x5944de,_0x75f4ae,_0x31e1ff,_0x374d6d){logger[_0x7d93('0xb')]('[CM][%s][%s]',_0x3880ac,_0x5944de['id'],_0x75f4ae,_0x31e1ff,JSON[_0x7d93('0xc')](_0x374d6d));io['to'](_0x75f4ae)[_0x7d93('0xd')](_0x31e1ff,_0x374d6d);}exports[_0x7d93('0xe')]=function(_0x12fa1d,_0x56dcd2,_0x12024f,_0x4b38ef){var _0x2b19dd,_0xbea31e;var _0x13f42e={};var _0x19c9e2=Number(_0x12024f[_0x7d93('0xf')]);var _0x727594=_0x12024f[_0x7d93('0x10')]?Boolean(Number(_0x12024f[_0x7d93('0x10')])):![];var _0x4f96b7;if(_0x4b38ef[_0x7d93('0x11')]){_0x13f42e['id']=_0x4b38ef['xmd-contactid'];}if(!_0x13f42e['id']){_0x13f42e[_0x7d93('0x12')]=_0x19c9e2;_0x4f96b7=_0x12024f[_0x7d93('0x13')]&&_0x12024f['data3']!=='0'?_0x12024f['data3']['split'](','):[_0x7d93('0x14')];_0x13f42e[_0x7d93('0x15')]=_[_0x7d93('0x16')](_0x4f96b7,function(_0x550e40){var _0x160771={};_0x160771[_0x550e40]=_0x4b38ef[_0x7d93('0x17')]?_0x4b38ef[_0x7d93('0x18')]:_0x4b38ef[_0x7d93('0x19')];return _0x160771;});}var _0x19bb76=['id',_0x7d93('0x1a'),_0x7d93('0x1b'),_0x7d93('0x14'),_0x7d93('0x1c'),'fax','ListId',_0x7d93('0x1d'),_0x7d93('0x1e'),'updatedAt'];var _0x5133d3=_['union'](_0x19bb76,_0x4f96b7);BPromise[_0x7d93('0x1f')]()[_0x7d93('0x20')](cmContactRpc['getContacts']({'attributes':_0x5133d3,'where':_0x13f42e}))[_0x7d93('0x20')](function(_0x57b57a){_0xbea31e=_0x57b57a;if(!_['isEmpty'](_0xbea31e)){if(_0xbea31e['length']===0x1){_0x2b19dd=_0xbea31e[0x0];logger[_0x7d93('0xb')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x4b38ef[_0x7d93('0x21')],_0x56dcd2['id'],_0x2b19dd['id']);}else{logger['info'](_0x7d93('0x22'),_0x4b38ef[_0x7d93('0x21')],_0x56dcd2['id'],_[_0x7d93('0x16')](_0xbea31e,'id')[_0x7d93('0x23')](','));}return;}else{logger[_0x7d93('0xb')](_0x7d93('0x24'),_0x4b38ef[_0x7d93('0x21')],_0x56dcd2['id']);var _0x9213b0={'ListId':_0x19c9e2};var _0x3aeeca=_0x12024f[_0x7d93('0x25')]&&_0x12024f['data4']!=='0'?_0x12024f[_0x7d93('0x25')]:_0x7d93('0x14');if(_0x727594){logger[_0x7d93('0xb')](_0x7d93('0x26'),_0x4b38ef[_0x7d93('0x21')],_0x56dcd2['id']);_0x9213b0[_0x3aeeca]=_[_0x7d93('0x27')](_0x4b38ef[_0x7d93('0x17')])?_0x4b38ef[_0x7d93('0x19')]:_0x4b38ef[_0x7d93('0x18')];if(_[_0x7d93('0x27')](_0x4b38ef[_0x7d93('0x17')])){_0x9213b0[_0x7d93('0x1a')]=_0x4b38ef[_0x7d93('0x28')]&&_0x4b38ef[_0x7d93('0x28')]!==_0x7d93('0x29')?_0x4b38ef[_0x7d93('0x28')]:_0x7d93('0x2a');}else{_0x9213b0['firstName']=_0x4b38ef[_0x7d93('0x2b')]&&_0x4b38ef[_0x7d93('0x2b')]!==''?_0x4b38ef[_0x7d93('0x2b')]:_0x7d93('0x2a');}return BPromise['resolve']()['then'](cmContactRpc[_0x7d93('0x2c')](_0x9213b0))[_0x7d93('0x20')](function(_0x3e8227){_0x2b19dd=_0x3e8227;_0xbea31e[_0x7d93('0x2d')](_0x3e8227);if(_0x2b19dd){logger['info'](_0x7d93('0x2e'),_0x4b38ef[_0x7d93('0x21')],_0x56dcd2['id'],_0x2b19dd['id']);}return;});}else{logger[_0x7d93('0xb')](_0x7d93('0x2f'),_0x4b38ef[_0x7d93('0x21')],_0x56dcd2['id']);_0x9213b0[_0x3aeeca]=_[_0x7d93('0x27')](_0x4b38ef[_0x7d93('0x17')])?_0x4b38ef['calleridnum']:_0x4b38ef[_0x7d93('0x18')];if(_[_0x7d93('0x27')](_0x4b38ef[_0x7d93('0x17')])){_0x9213b0[_0x7d93('0x1a')]=_0x4b38ef['calleridname']&&_0x4b38ef[_0x7d93('0x28')]!==_0x7d93('0x29')?_0x4b38ef[_0x7d93('0x28')]:_0x7d93('0x2a');}else{_0x9213b0[_0x7d93('0x1a')]=_0x4b38ef[_0x7d93('0x2b')]&&_0x4b38ef[_0x7d93('0x2b')]!==_0x7d93('0x29')?_0x4b38ef[_0x7d93('0x2b')]:_0x7d93('0x2a');}_0x2b19dd=_0x9213b0;_0xbea31e[_0x7d93('0x2d')](_0x9213b0);return;}}})[_0x7d93('0x20')](function(){if(_0x12fa1d){emit(_0x4b38ef[_0x7d93('0x21')],_0x56dcd2,util[_0x7d93('0x30')]('user:%s',_0x12fa1d[_0x7d93('0x31')]),util['format'](_0x7d93('0x32'),_0x12024f[_0x7d93('0x33')][_0x7d93('0x34')]()),{'evt':_['merge'](_0x4b38ef,{'autoCreate':_0x727594}),'contact':_0x2b19dd===undefined?{}:_0x2b19dd,'contacts':_0xbea31e[_0x7d93('0x35')]===0x0?undefined:_0xbea31e});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index d141eec..670aba8 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 _0x684d=['bind','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:newinteraction','custom:incomingmessage','custom:outgoingmessage','info','stringify','emit','prototype','interface','checkTriggers','hasOwnProperty','checkTrigger','variables','Actions','length','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winApplication','winArguments','format','user:%s','name','action','merge','jscripty','trigger:%s','exec','queue','urlforward','script','parse','query','search','AllConditions','every','checkConditions','channel','AnyConditions','some','field','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','event','agent','membername','lastevent','routeId','exports','util','lodash','mustache','ioredis','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','popup','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','accounts','sugarcrmAccounts','servicenowAccounts','custom:agentcalled'];(function(_0x8f4851,_0x45b202){var _0x43eac2=function(_0x4b0b9a){while(--_0x4b0b9a){_0x8f4851['push'](_0x8f4851['shift']());}};_0x43eac2(++_0x45b202);}(_0x684d,0xcf));var _0xd684=function(_0x30dea6,_0xf4d4e9){_0x30dea6=_0x30dea6-0x0;var _0x19bb16=_0x684d[_0x30dea6];return _0x19bb16;};'use strict';var util=require(_0xd684('0x0'));var _=require(_0xd684('0x1'));var url=require('url');var Mustache=require(_0xd684('0x2'));var Redis=require(_0xd684('0x3'));var urlforward=require('./urlforward');var integration=require(_0xd684('0x4'));var cmContact=require(_0xd684('0x5'));var script=require(_0xd684('0x6'));var config=require(_0xd684('0x7'));var logger=require(_0xd684('0x8'))(_0xd684('0x9'));var ami=require(_0xd684('0xa'));config[_0xd684('0xb')]=_[_0xd684('0xc')](config[_0xd684('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var operators={'equals':function(_0x3ca481,_0x20eb22){return _0x3ca481==_0x20eb22;},'not_equals':function(_0x275397,_0x82fb84){return _0x275397!=_0x82fb84;}};var barAndWebActions=[_0xd684('0xd'),_0xd684('0xe'),_0xd684('0xf')];function Trigger(_0x6899ec){this[_0xd684('0x10')]=_0x6899ec['triggers'];this[_0xd684('0x11')]=_0x6899ec[_0xd684('0x11')];this[_0xd684('0x12')]=_0x6899ec[_0xd684('0x12')];this[_0xd684('0x13')]=_0x6899ec[_0xd684('0x13')];this[_0xd684('0x14')]=_0x6899ec[_0xd684('0x14')];this[_0xd684('0x15')]=_0x6899ec[_0xd684('0x15')];this[_0xd684('0x16')]=_0x6899ec[_0xd684('0x16')];this[_0xd684('0x17')]=_0x6899ec[_0xd684('0x17')];this['sugarcrmAccounts']=_0x6899ec['sugarcrmAccounts'];this[_0xd684('0x18')]=_0x6899ec[_0xd684('0x18')];this[_0xd684('0x19')]=_0x6899ec['deskAccounts'];this[_0xd684('0x1a')]=_0x6899ec['vtigerAccounts'];this['servicenowAccounts']=_0x6899ec['servicenowAccounts'];this[_0xd684('0x1b')]=_0x6899ec[_0xd684('0x1b')];this[_0xd684('0x1c')]=_0x6899ec[_0xd684('0x1c')];this[_0xd684('0x1d')]={'zendesk':this[_0xd684('0x15')],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xd684('0x1e')],'zoho':this['zohoAccounts'],'desk':this['deskAccounts'],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xd684('0x1b')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0xd684('0x1f')]};ami['on'](_0xd684('0x20'),this['syncCustomEvent'][_0xd684('0x21')](this));ami['on']('custom:agentconnect',this[_0xd684('0x22')][_0xd684('0x21')](this));ami['on'](_0xd684('0x23'),this[_0xd684('0x22')]['bind'](this));ami['on'](_0xd684('0x24'),this[_0xd684('0x22')][_0xd684('0x21')](this));ami['on'](_0xd684('0x25'),this[_0xd684('0x22')][_0xd684('0x21')](this));ami['on'](_0xd684('0x26'),this[_0xd684('0x22')][_0xd684('0x21')](this));ami['on'](_0xd684('0x27'),this[_0xd684('0x22')]['bind'](this));ami['on'](_0xd684('0x28'),this[_0xd684('0x22')]['bind'](this));ami['on'](_0xd684('0x29'),this[_0xd684('0x22')][_0xd684('0x21')](this));ami['on'](_0xd684('0x2a'),this[_0xd684('0x22')][_0xd684('0x21')](this));ami['on'](_0xd684('0x2b'),this['syncCustomEvent'][_0xd684('0x21')](this));ami['on'](_0xd684('0x2c'),this['syncAgentDial']['bind'](this));ami['on']('custom:dialconnect',this[_0xd684('0x2d')][_0xd684('0x21')](this));ami['on'](_0xd684('0x2e'),this['syncAgentDial'][_0xd684('0x21')](this));ami['on'](_0xd684('0x2f'),this[_0xd684('0x22')][_0xd684('0x21')](this));ami['on']('custom:closedinteraction',this[_0xd684('0x22')][_0xd684('0x21')](this));ami['on'](_0xd684('0x30'),this[_0xd684('0x22')][_0xd684('0x21')](this));ami['on'](_0xd684('0x31'),this[_0xd684('0x22')]['bind'](this));ami['on']('custom:acceptmessage',this[_0xd684('0x22')][_0xd684('0x21')](this));ami['on']('custom:rejectmessage',this[_0xd684('0x22')]['bind'](this));}Trigger['prototype']['emit']=function(_0x29662e,_0x4cad15,_0x5896f0){logger[_0xd684('0x32')](_0x29662e,_0x4cad15,JSON[_0xd684('0x33')](_0x5896f0));io['to'](_0x29662e)[_0xd684('0x34')](_0x4cad15,_0x5896f0);};Trigger[_0xd684('0x35')]['syncCustomEvent']=function(_0x41bb08){var _0xdd2c5=_['clone'](_0x41bb08);this['checkTriggers'](_0xdd2c5);};Trigger[_0xd684('0x35')]['syncAgentDial']=function(_0x3a5c5b){if(this[_0xd684('0x11')][_0x3a5c5b[_0xd684('0x36')]]){this[_0xd684('0x22')](_0x3a5c5b);}};Trigger[_0xd684('0x35')][_0xd684('0x37')]=function(_0x1282cf){var _0x139f66;for(var _0x522a55 in this[_0xd684('0x10')]){if(this[_0xd684('0x10')][_0xd684('0x38')](_0x522a55)){if(this[_0xd684('0x10')][_0x522a55]['status']){_0x139f66=this[_0xd684('0x39')](this[_0xd684('0x10')][_0x522a55],_0x1282cf);if(_0x139f66){_['merge'](_0x1282cf,_0x1282cf[_0xd684('0x3a')]);for(var _0x3806cf=0x0,_0xf70ab2,_0x49dbca,_0x1e60a6;_0x3806cf0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file +var _0xa9e0=['Getting\x20agent\x20with\x20email','format','total_entries','find','_embedded','entries','then','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','%s/customers/search','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','work','length','map','forEach','type','string','customField','nameField','toLowerCase','content','toString','idField','variable','variableName','custom_fields','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','phone','Motion','CTI','Tags','Descriptions','user','Fields','%s/customers/%d/cases','POST','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','catch','monitor_format','lastevent','lodash','request-promise','md5','./util','../../../../config/logger','desk','redis','defaults','socket.io-emitter','emit','validateEmail','info'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var md5=require(_0x0a9e('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x0a9e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));config[_0x0a9e('0x6')]=_[_0x0a9e('0x7')](config[_0x0a9e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0x8'))(new Redis(config[_0x0a9e('0x6')]));function emit(_0x2cc193,_0x5f41ea,_0x503809){io['to'](_0x2cc193)[_0x0a9e('0x9')](_0x5f41ea,_0x503809);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x39753a,_0xf81284){if(intUtil[_0x0a9e('0xa')](_0xf81284)===!![]){logger[_0x0a9e('0xb')](_0x0a9e('0xc'),_0xf81284);return request({'uri':util[_0x0a9e('0xd')]('%s/users',_0x39753a['remoteUri'])})['then'](function(_0x4cfe67){if(_0x4cfe67[_0x0a9e('0xe')]){return _[_0x0a9e('0xf')](_0x4cfe67[_0x0a9e('0x10')][_0x0a9e('0x11')],{'email':_0xf81284});}})[_0x0a9e('0x12')](function(_0x69aeb7){if(_0x69aeb7){logger['info'](_0x0a9e('0x13'));return _0x69aeb7;}else{logger[_0x0a9e('0xb')](_0x0a9e('0x14'));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x15'),_0x39753a[_0x0a9e('0x16')])});}});}else{logger['info'](_0x0a9e('0x17'));return request({'uri':util['format'](_0x0a9e('0x15'),_0x39753a['remoteUri'])});}}function request(_0x16033c){logger[_0x0a9e('0x18')]('[HTTP]',JSON[_0x0a9e('0x19')](_0x16033c));return rp(_['defaults'](_0x16033c,{'method':_0x0a9e('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x478723){var _0x106033;if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x1c')){_0x106033=util[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x1f')]);}else if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x20')){_0x106033=util[_0x0a9e('0xd')]('%s/token:%s',_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x20')]);}return util['format'](_0x0a9e('0x21'),new Buffer(_0x106033)['toString']('base64'));}function getEndUser(_0x3a02e1,_0x432e56,_0x38e7c4){logger[_0x0a9e('0xb')]('Searching\x20enduser\x20with\x20phone',_0x38e7c4);return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x22'),_0x3a02e1[_0x0a9e('0x16')]),'qs':{'phone':_0x38e7c4}})[_0x0a9e('0x12')](function(_0x370d86){if(_0x370d86[_0x0a9e('0xe')]){logger[_0x0a9e('0xb')]('Enduser\x20found!');return _0x370d86['_embedded'][_0x0a9e('0x11')][0x0];}else{logger[_0x0a9e('0xb')](_0x0a9e('0x23'));return request({'uri':util[_0x0a9e('0xd')]('%s/customers',_0x3a02e1[_0x0a9e('0x16')]),'method':'POST','body':{'first_name':_0x432e56,'title':_0x432e56,'phone_numbers':[{'type':_0x0a9e('0x24'),'value':_0x38e7c4}]}});}});}function getTags(_0x5bfb33,_0x1dc186){var _0x34dc65=[];if(_0x5bfb33&&_0x5bfb33[_0x0a9e('0x25')]>0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index f4869b3..17c0a72 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 _0x4511=['phonecall','phonecalls','assign','callDirection','queue','ticketId','format','user:%s','trigger:browser:url','remoteUri','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]','Recording\x20is\x20enabled!','recordingURL','recordingFormat',']\x20The\x20User\x20ID\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','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','username','password','clientSecret','then','toUpperCase',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','4.0','validateEmail','email','userEmail','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','catch','outbound','destcalleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','value','toLowerCase','calleridnum','telephone1',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','type','nameField','customField','idField','indexOf','ticketType','incident','incidents','getString','Subjects','Descriptions','/contacts(','Fields'];(function(_0x10809e,_0x2a9481){var _0x188612=function(_0x4a887b){while(--_0x4a887b){_0x10809e['push'](_0x10809e['shift']());}};_0x188612(++_0x2a9481);}(_0x4511,0x1ac));var _0x1451=function(_0x1b9dfb,_0x223d52){_0x1b9dfb=_0x1b9dfb-0x0;var _0x1dddff=_0x4511[_0x1b9dfb];return _0x1dddff;};'use strict';var _=require(_0x1451('0x0'));var BPromise=require(_0x1451('0x1'));var rp=require(_0x1451('0x2'));var util=require(_0x1451('0x3'));var intUtil=require(_0x1451('0x4'));var md5=require(_0x1451('0x5'));var Redis=require(_0x1451('0x6'));var logger=require(_0x1451('0x7'))(_0x1451('0x8'));var config=require(_0x1451('0x9'));config[_0x1451('0xa')]=_[_0x1451('0xb')](config[_0x1451('0xa')],{'host':_0x1451('0xc'),'port':0x18eb});var io=require(_0x1451('0xd'))(new Redis(config[_0x1451('0xa')]));function getAuthToken(_0x381e7b,_0x3b4bd1,_0x4b74ce){var _0x546363={'method':_0x1451('0xe'),'uri':_0x3b4bd1,'form':{'client_id':_0x381e7b[_0x1451('0xf')],'resource':_0x381e7b['remoteUri'],'username':_0x381e7b[_0x1451('0x10')],'password':_0x381e7b[_0x1451('0x11')],'grant_type':'password','client_secret':_0x381e7b[_0x1451('0x12')]},'json':!![]};return rp(_0x546363)[_0x1451('0x13')](function(_0x3f22b8){return _0x3f22b8['access_token'];})['catch'](function(_0xfe183e){logger['error']('['+[_0x4b74ce[_0x1451('0x14')]()]+_0x1451('0x15'));return _0xfe183e[_0x1451('0x16')];});}function getUser(_0x22edf5,_0x461e9e,_0x452cc2,_0xe32821,_0x56609f,_0x2c5f90){return new BPromise(function(_0x4d9e82,_0x49c1fa){return getAuthToken(_0x461e9e,_0xe32821,_0x2c5f90)[_0x1451('0x13')](function(_0xe5aa01){var _0x3b3890={'method':_0x1451('0x17'),'uri':_0x56609f+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x1451('0x18')+_0xe5aa01,'OData-Version':_0x1451('0x19')},'json':!![]};return rp(_0x3b3890);})[_0x1451('0x13')](function(_0x558a58){var _0x4370a4=_0x558a58['value'];var _0x38c364=![];var _0x545ba8=null;if(!_['isNil'](_0x452cc2)){if(intUtil[_0x1451('0x1a')](_0x452cc2[_0x1451('0x1b')])){_0x22edf5[_0x1451('0x1c')]=_0x452cc2[_0x1451('0x1b')];for(_0x545ba8=0x0;_0x545ba8<_0x4370a4[_0x1451('0x1d')];_0x545ba8++){if(_0x4370a4[_0x545ba8]['internalemailaddress']===_0x452cc2['email']&&!_0x4370a4[_0x545ba8][_0x1451('0x1e')]){_0x38c364=!![];logger[_0x1451('0x1f')]('['+[_0x2c5f90[_0x1451('0x14')]()]+_0x1451('0x20')+_0x4370a4[_0x545ba8][_0x1451('0x21')]+'!');_0x22edf5[_0x1451('0x22')]=_0x4370a4[_0x545ba8]['systemuserid'];}}}}if(!_0x38c364){logger['info']('['+[_0x2c5f90['toUpperCase']()]+_0x1451('0x23'));_0x22edf5['userEmail']=_0x461e9e[_0x1451('0x10')];for(_0x545ba8=0x0;_0x545ba8<_0x4370a4[_0x1451('0x1d')];_0x545ba8++){if(_0x4370a4[_0x545ba8][_0x1451('0x24')]===_0x461e9e[_0x1451('0x10')]){_0x22edf5[_0x1451('0x22')]=_0x4370a4[_0x545ba8][_0x1451('0x21')];}}}_0x4d9e82(_0x22edf5);})[_0x1451('0x25')](function(_0x3fc40e){_0x49c1fa(_0x3fc40e[_0x1451('0x16')]);});});}function createEndUser(_0xfa45af,_0x5a1516,_0x308c17,_0x4359f9,_0x1b512c,_0x605fdf){return new BPromise(function(_0x15b588,_0x150b5f){return getAuthToken(_0x5a1516,_0x308c17,_0x605fdf)[_0x1451('0x13')](function(_0x12a4d1){var _0x1691fb=_0x605fdf['toLowerCase']()===_0x1451('0x26')?_0x1b512c[_0x1451('0x27')]:_0x1b512c['calleridnum'];var _0x36a42f={'method':_0x1451('0xe'),'uri':_0x4359f9+_0x1451('0x28'),'body':{'telephone1':_0x1691fb,'fullname':_0x1691fb,'firstname':_0x1691fb,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x1451('0x29')+_0xfa45af[_0x1451('0x22')]+')'},'headers':{'Authorization':_0x1451('0x18')+_0x12a4d1,'OData-Version':_0x1451('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x36a42f);})[_0x1451('0x13')](function(_0x31cd20){var _0x43268d=_0x31cd20[_0x1451('0x2a')][_0x1451('0x2b')];var _0x488772=_0x43268d[_0x1451('0x2c')](_0x43268d['lastIndexOf']('(')+0x1,_0x43268d[_0x1451('0x2d')](')'));_0xfa45af[_0x1451('0x2e')]=_0x488772;_0x15b588(_0xfa45af);})[_0x1451('0x25')](function(_0x3f98dd){_0x150b5f(_0x3f98dd['message']);});});}function getEndUser(_0x269933,_0x3d7447,_0x5b28fb,_0x2d7fdc,_0x183b8d,_0x4fe7b9){return new BPromise(function(_0x3260d8,_0x143db6){return getAuthToken(_0x3d7447,_0x5b28fb,_0x4fe7b9)[_0x1451('0x13')](function(_0x954cd2){var _0x48ff53={'method':_0x1451('0x17'),'uri':_0x2d7fdc+_0x1451('0x2f'),'headers':{'Authorization':_0x1451('0x18')+_0x954cd2,'If-None-Match':null,'OData-Version':_0x1451('0x19')},'json':!![]};return rp(_0x48ff53);})[_0x1451('0x13')](function(_0x1a7ef){var _0xce6668=null;if(_0x1a7ef){var _0x4473fa=_0x1a7ef[_0x1451('0x30')];var _0x1fa9ff=![];for(_0xce6668=0x0;_0xce6668<_0x4473fa[_0x1451('0x1d')];_0xce6668++){var _0x546c3b=_0x4fe7b9[_0x1451('0x31')]()===_0x1451('0x26')?_0x183b8d[_0x1451('0x27')]:_0x183b8d[_0x1451('0x32')];if(_0x4473fa[_0xce6668][_0x1451('0x33')]===_0x546c3b){_0x1fa9ff=!![];_0x269933[_0x1451('0x2e')]=_0x4473fa[_0xce6668]['contactid'];}}if(_0x1fa9ff){_0x3260d8(_0x269933);}else{return createEndUser(_0x269933,_0x3d7447,_0x5b28fb,_0x2d7fdc,_0x183b8d,_0x4fe7b9)[_0x1451('0x13')](function(_0x3a6d87){logger[_0x1451('0x1f')]('['+[_0x4fe7b9['toUpperCase']()]+_0x1451('0x34'),_0x3a6d87['enduserId']);_0x3260d8(_0x3a6d87);});}}else{return createEndUser(_0x269933,_0x3d7447,_0x5b28fb,_0x2d7fdc,_0x183b8d,_0x4fe7b9)[_0x1451('0x13')](function(_0x1e218b){logger[_0x1451('0x1f')]('['+[_0x4fe7b9['toUpperCase']()]+_0x1451('0x35'),_0x1e218b[_0x1451('0x2e')]);_0x3260d8(_0x1e218b);});}});});}function getCustomFields(_0x5a2908,_0x16e87d,_0xab44d9){var _0x1cd550={};if(_0x5a2908[_0x1451('0x1d')]>0x0){_['forEach'](_0x5a2908,function(_0x2b94ca){if(_0x2b94ca[_0x1451('0x36')]==='string'&&_0x2b94ca[_0x1451('0x37')]&&!_0x2b94ca[_0x1451('0x38')]){var _0x31e216=_0x2b94ca[_0x1451('0x39')][_0x1451('0x31')]();var _0x10cecd=_0x31e216[_0x1451('0x2c')](0x0,_0x31e216['indexOf']('_'));var _0x43b347=_0x31e216[_0x1451('0x2c')](_0x31e216[_0x1451('0x3a')]('_')+0x1);if(_0x10cecd===_0xab44d9){_0x1cd550[_0x43b347]=_0x2b94ca['content'];}}});}return _0x1cd550;}function getTicket(_0x26581a,_0x59caf0,_0x150672,_0xc3d704,_0x4b21b9,_0x2ebc0e,_0x965e4){return new BPromise(function(_0x1ba869,_0x1c3c09){var _0x5a5c05;return getAuthToken(_0x59caf0,_0x150672,_0x965e4)[_0x1451('0x13')](function(_0x3cbad2){if(_0x2ebc0e[_0x1451('0x3b')]===_0x1451('0x3c')){_0x5a5c05={'method':_0x1451('0xe'),'uri':_0xc3d704+_0x1451('0x3d'),'body':Object['assign']({},{'title':intUtil[_0x1451('0x3e')](_0x2ebc0e[_0x1451('0x3f')],_0x4b21b9,'\x20'),'description':intUtil[_0x1451('0x3e')](_0x2ebc0e[_0x1451('0x40')],_0x4b21b9,'\x0a'),'customerid_contact@odata.bind':_0x1451('0x41')+_0x26581a['enduserId']+')','ownerid@odata.bind':_0x1451('0x29')+_0x26581a[_0x1451('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x2ebc0e[_0x1451('0x42')],_0x4b21b9,_0x2ebc0e[_0x1451('0x3b')])),'headers':{'Authorization':_0x1451('0x18')+_0x3cbad2,'OData-Version':_0x1451('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2ebc0e[_0x1451('0x3b')]===_0x1451('0x43')){_0x5a5c05={'method':'POST','uri':_0xc3d704+_0x1451('0x44'),'body':Object[_0x1451('0x45')]({},{'subject':intUtil[_0x1451('0x3e')](_0x2ebc0e[_0x1451('0x3f')],_0x4b21b9,'\x20'),'phonenumber':String(_0x4b21b9[_0x1451('0x32')]),'description':intUtil['getString'](_0x2ebc0e['Descriptions'],_0x4b21b9,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1451('0x41')+_0x26581a[_0x1451('0x2e')]+')','ownerid@odata.bind':_0x1451('0x29')+_0x26581a[_0x1451('0x22')]+')','directioncode':_0x26581a[_0x1451('0x46')]===_0x1451('0x47')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x1451('0x29')+_0x26581a[_0x1451('0x22')]+')','participationtypemask':_0x26581a[_0x1451('0x46')]===_0x1451('0x47')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x26581a[_0x1451('0x2e')]+')','participationtypemask':_0x26581a[_0x1451('0x46')]==='queue'?0x1:0x2}]},getCustomFields(_0x2ebc0e[_0x1451('0x42')],_0x4b21b9,_0x2ebc0e[_0x1451('0x3b')])),'headers':{'Authorization':_0x1451('0x18')+_0x3cbad2,'OData-Version':_0x1451('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5a5c05);})[_0x1451('0x13')](function(_0x34a23a){var _0x25213d=_0x34a23a['headers'][_0x1451('0x2b')];var _0x4898fe=_0x25213d[_0x1451('0x2c')](_0x25213d[_0x1451('0x2d')]('(')+0x1,_0x25213d['lastIndexOf'](')'));_0x26581a[_0x1451('0x48')]=_0x4898fe;_0x1ba869(_0x26581a);})[_0x1451('0x25')](function(_0x47a040){_0x1c3c09(_0x47a040[_0x1451('0x16')]);});});}function emit(_0xe85e51,_0x85fca7,_0x23e337,_0x2bb585){var _0x359b45={'uri':util[_0x1451('0x49')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0xe85e51,_0x23e337,_0x2bb585)};io['to'](util[_0x1451('0x49')](_0x1451('0x4a'),_0x85fca7))['emit'](_0x1451('0x4b'),_0x359b45);}exports['cs']=function(_0x1f31b1,_0x1e04d8,_0x40b56b,_0x2b3d25,_0x45f9ab,_0x1ed9bf,_0x58f618,_0x2b76e7){var _0x347548={};_0x1ed9bf['remoteUri']=intUtil['stripTrailingSlash'](_0x1ed9bf[_0x1451('0x4c')]);_0x1ed9bf['serverUrl']=intUtil[_0x1451('0x4d')](_0x1ed9bf['serverUrl']);_0x347548[_0x1451('0x46')]=_0x2b76e7===_0x1451('0x47')||_0x2b76e7===_0x1451('0x4e')?'queue':_0x1451('0x26');var _0x1c5bfb=util[_0x1451('0x49')](_0x1451('0x4f'),_0x1ed9bf[_0x1451('0x4c')]);var _0x5148d0=util[_0x1451('0x49')](_0x1451('0x50'),_0x1ed9bf['tenantId']);var _0x824e71=util[_0x1451('0x49')](_0x1451('0x51'),_0x1ed9bf[_0x1451('0x52')],_0x1e04d8[_0x1451('0x53')],md5(_0x1e04d8['uniqueid']));if(_0x45f9ab&&_0x45f9ab[_0x1451('0x54')]){logger[_0x1451('0x1f')](_0x1451('0x55'),_0x1451('0x56'));_0x1e04d8[_0x1451('0x57')]=_0x824e71;}else if(_0x58f618&&_0x58f618[_0x1451('0x58')]&&_0x58f618['recordingFormat']!=='none'){logger[_0x1451('0x1f')]('[OUTBOUND]',_0x1451('0x56'));_0x1e04d8[_0x1451('0x57')]=_0x824e71;}else{_0x1e04d8[_0x1451('0x57')]='';}return getUser(_0x347548,_0x1ed9bf,_0x2b3d25,_0x5148d0,_0x1c5bfb,_0x2b76e7)[_0x1451('0x13')](function(_0xc5f2a9){logger[_0x1451('0x1f')]('['+_0x2b76e7[_0x1451('0x14')]()+_0x1451('0x59'),_0xc5f2a9[_0x1451('0x22')]);logger[_0x1451('0x1f')]('['+_0x2b76e7[_0x1451('0x14')]()+']\x20The\x20User\x20email\x20is:',_0xc5f2a9[_0x1451('0x1c')]);return getEndUser(_0xc5f2a9,_0x1ed9bf,_0x5148d0,_0x1c5bfb,_0x1e04d8,_0x2b76e7);})[_0x1451('0x13')](function(_0x5170e1){logger[_0x1451('0x1f')]('['+_0x2b76e7['toUpperCase']()+_0x1451('0x5a'),_0x5170e1[_0x1451('0x2e')]);logger['info']('['+_0x2b76e7['toUpperCase']()+_0x1451('0x5b'),_0x1e04d8['calleridnum']);return getTicket(_0x5170e1,_0x1ed9bf,_0x5148d0,_0x1c5bfb,_0x1e04d8,_0x40b56b,_0x2b76e7);})['then'](function(_0x2c610b){logger[_0x1451('0x1f')](util['format']('['+_0x2b76e7[_0x1451('0x14')]()+_0x1451('0x5c'),_0x40b56b['ticketType'],_0x2c610b[_0x1451('0x48')]));logger['info'](util['format']('['+_0x2b76e7['toUpperCase']()+_0x1451('0x5d'),_0x2b76e7));if(_0x2b76e7!==_0x1451('0x4e')){logger['info']('['+_0x2b76e7[_0x1451('0x14')]()+']',_0x1451('0x5e'));emit(_0x1ed9bf[_0x1451('0x4c')],_0x2b3d25[_0x1451('0x5f')],_0x40b56b[_0x1451('0x3b')],_0x2c610b[_0x1451('0x48')]);}})[_0x1451('0x25')](function(_0x4309d0){logger[_0x1451('0x60')]('['+_0x2b76e7['toUpperCase']()+_0x1451('0x61'),util[_0x1451('0x62')](_0x4309d0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x996e=['ioredis','dynamics365','redis','defaults','socket.io-emitter','remoteUri','username','password','clientSecret','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','catch','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','4.0','headers','odata-entityid','lastIndexOf','GET','contacts?$select=telephone1','calleridnum','enduserId','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','customField','substring','indexOf','content','ticketType','POST','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecalls','callDirection','ticketId','format','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','queue','unmanaged','%s/api/data/v9.0/','%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\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','./util','md5'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x996e,0x1d1));var _0xe996=function(_0x2c512a,_0x478ddf){_0x2c512a=_0x2c512a-0x0;var _0x2c39d8=_0x996e[_0x2c512a];return _0x2c39d8;};'use strict';var _=require(_0xe996('0x0'));var BPromise=require(_0xe996('0x1'));var rp=require(_0xe996('0x2'));var util=require('util');var intUtil=require(_0xe996('0x3'));var md5=require(_0xe996('0x4'));var Redis=require(_0xe996('0x5'));var logger=require('../../../../config/logger')(_0xe996('0x6'));var config=require('../../../../config/environment');config[_0xe996('0x7')]=_[_0xe996('0x8')](config[_0xe996('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xe996('0x9'))(new Redis(config[_0xe996('0x7')]));function getAuthToken(_0xfac7b9,_0x5d2169,_0x522bd2){var _0x19b8b1={'method':'POST','uri':_0x5d2169,'form':{'client_id':_0xfac7b9['clientId'],'resource':_0xfac7b9[_0xe996('0xa')],'username':_0xfac7b9[_0xe996('0xb')],'password':_0xfac7b9['password'],'grant_type':_0xe996('0xc'),'client_secret':_0xfac7b9[_0xe996('0xd')]},'json':!![]};return rp(_0x19b8b1)[_0xe996('0xe')](function(_0x1cc826){return _0x1cc826[_0xe996('0xf')];})['catch'](function(_0x2d8ef4){logger[_0xe996('0x10')]('['+[_0x522bd2[_0xe996('0x11')]()]+_0xe996('0x12'));return _0x2d8ef4[_0xe996('0x13')];});}function getUser(_0x3ed5da,_0x31893f,_0x2e9dc1,_0x4ec8bc,_0x55fdee,_0x20805e){return new BPromise(function(_0x4d69e2,_0x24c209){return getAuthToken(_0x31893f,_0x4ec8bc,_0x20805e)[_0xe996('0xe')](function(_0x51136e){var _0xa19741={'method':'GET','uri':_0x55fdee+_0xe996('0x14'),'headers':{'Authorization':_0xe996('0x15')+_0x51136e,'OData-Version':'4.0'},'json':!![]};return rp(_0xa19741);})[_0xe996('0xe')](function(_0x16d69){var _0x4a8b03=_0x16d69[_0xe996('0x16')];var _0x37a7ad=![];var _0x1fa019=null;if(!_[_0xe996('0x17')](_0x2e9dc1)){if(intUtil[_0xe996('0x18')](_0x2e9dc1['email'])){_0x3ed5da['userEmail']=_0x2e9dc1[_0xe996('0x19')];for(_0x1fa019=0x0;_0x1fa019<_0x4a8b03[_0xe996('0x1a')];_0x1fa019++){if(_0x4a8b03[_0x1fa019][_0xe996('0x1b')]===_0x2e9dc1['email']&&!_0x4a8b03[_0x1fa019][_0xe996('0x1c')]){_0x37a7ad=!![];logger[_0xe996('0x1d')]('['+[_0x20805e[_0xe996('0x11')]()]+_0xe996('0x1e')+_0x4a8b03[_0x1fa019]['systemuserid']+'!');_0x3ed5da[_0xe996('0x1f')]=_0x4a8b03[_0x1fa019][_0xe996('0x20')];}}}}if(!_0x37a7ad){logger[_0xe996('0x1d')]('['+[_0x20805e[_0xe996('0x11')]()]+_0xe996('0x21'));_0x3ed5da[_0xe996('0x22')]=_0x31893f[_0xe996('0xb')];for(_0x1fa019=0x0;_0x1fa019<_0x4a8b03['length'];_0x1fa019++){if(_0x4a8b03[_0x1fa019][_0xe996('0x1b')]===_0x31893f['username']){_0x3ed5da['userId']=_0x4a8b03[_0x1fa019][_0xe996('0x20')];}}}_0x4d69e2(_0x3ed5da);})[_0xe996('0x23')](function(_0x1b8890){_0x24c209(_0x1b8890[_0xe996('0x13')]);});});}function createEndUser(_0x32e43e,_0x1f5f20,_0x11d3d9,_0x30d050,_0x338dab,_0x4bcf3d){return new BPromise(function(_0xd2c9e0,_0x109aae){return getAuthToken(_0x1f5f20,_0x11d3d9,_0x4bcf3d)[_0xe996('0xe')](function(_0xca78d2){var _0x412877=_0x4bcf3d[_0xe996('0x24')]()===_0xe996('0x25')?_0x338dab[_0xe996('0x26')]:_0x338dab['calleridnum'];var _0x50a39a={'method':'POST','uri':_0x30d050+_0xe996('0x27'),'body':{'telephone1':_0x412877,'fullname':_0x412877,'firstname':_0x412877,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xe996('0x28')+_0x32e43e[_0xe996('0x1f')]+')'},'headers':{'Authorization':_0xe996('0x15')+_0xca78d2,'OData-Version':_0xe996('0x29')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x50a39a);})[_0xe996('0xe')](function(_0x232c14){var _0x554309=_0x232c14[_0xe996('0x2a')][_0xe996('0x2b')];var _0x79ad58=_0x554309['substring'](_0x554309[_0xe996('0x2c')]('(')+0x1,_0x554309['lastIndexOf'](')'));_0x32e43e['enduserId']=_0x79ad58;_0xd2c9e0(_0x32e43e);})['catch'](function(_0x354375){_0x109aae(_0x354375['message']);});});}function getEndUser(_0x14e43a,_0x187969,_0x7a04d0,_0x5df52e,_0x3a3963,_0x2ad750){return new BPromise(function(_0x5f0d8d,_0x1583c7){return getAuthToken(_0x187969,_0x7a04d0,_0x2ad750)['then'](function(_0x3b8bd4){var _0x5acf72={'method':_0xe996('0x2d'),'uri':_0x5df52e+_0xe996('0x2e'),'headers':{'Authorization':'Bearer\x20'+_0x3b8bd4,'If-None-Match':null,'OData-Version':_0xe996('0x29')},'json':!![]};return rp(_0x5acf72);})[_0xe996('0xe')](function(_0x1e466d){var _0x50821d=null;if(_0x1e466d){var _0x1163f1=_0x1e466d[_0xe996('0x16')];var _0x2d3233=![];for(_0x50821d=0x0;_0x50821d<_0x1163f1[_0xe996('0x1a')];_0x50821d++){var _0x3edc72=_0x2ad750[_0xe996('0x24')]()===_0xe996('0x25')?_0x3a3963['destcalleridnum']:_0x3a3963[_0xe996('0x2f')];if(_0x1163f1[_0x50821d]['telephone1']===_0x3edc72){_0x2d3233=!![];_0x14e43a[_0xe996('0x30')]=_0x1163f1[_0x50821d][_0xe996('0x31')];}}if(_0x2d3233){_0x5f0d8d(_0x14e43a);}else{return createEndUser(_0x14e43a,_0x187969,_0x7a04d0,_0x5df52e,_0x3a3963,_0x2ad750)[_0xe996('0xe')](function(_0x12c6bf){logger[_0xe996('0x1d')]('['+[_0x2ad750[_0xe996('0x11')]()]+_0xe996('0x32'),_0x12c6bf['enduserId']);_0x5f0d8d(_0x12c6bf);});}}else{return createEndUser(_0x14e43a,_0x187969,_0x7a04d0,_0x5df52e,_0x3a3963,_0x2ad750)['then'](function(_0x510715){logger[_0xe996('0x1d')]('['+[_0x2ad750[_0xe996('0x11')]()]+_0xe996('0x33'),_0x510715[_0xe996('0x30')]);_0x5f0d8d(_0x510715);});}});});}function getCustomFields(_0x9513c8,_0x5efb2c,_0x1ccde5){var _0x1b2f5d={};if(_0x9513c8[_0xe996('0x1a')]>0x0){_[_0xe996('0x34')](_0x9513c8,function(_0x5ceaad){if(_0x5ceaad[_0xe996('0x35')]==='string'&&_0x5ceaad['nameField']&&!_0x5ceaad[_0xe996('0x36')]){var _0x2e6ef2=_0x5ceaad['idField'][_0xe996('0x24')]();var _0x286e94=_0x2e6ef2[_0xe996('0x37')](0x0,_0x2e6ef2[_0xe996('0x38')]('_'));var _0x1db7d6=_0x2e6ef2[_0xe996('0x37')](_0x2e6ef2['indexOf']('_')+0x1);if(_0x286e94===_0x1ccde5){_0x1b2f5d[_0x1db7d6]=_0x5ceaad[_0xe996('0x39')];}}});}return _0x1b2f5d;}function getTicket(_0x1cdc17,_0x7dd7e0,_0x4578cf,_0x375283,_0x24dd43,_0x8be9de,_0x4a5df2){return new BPromise(function(_0x41f422,_0x22148b){var _0x37c55a;return getAuthToken(_0x7dd7e0,_0x4578cf,_0x4a5df2)['then'](function(_0x5d8add){if(_0x8be9de[_0xe996('0x3a')]==='incident'){_0x37c55a={'method':_0xe996('0x3b'),'uri':_0x375283+_0xe996('0x3c'),'body':Object[_0xe996('0x3d')]({},{'title':intUtil[_0xe996('0x3e')](_0x8be9de[_0xe996('0x3f')],_0x24dd43,'\x20'),'description':intUtil[_0xe996('0x3e')](_0x8be9de[_0xe996('0x40')],_0x24dd43,'\x0a'),'customerid_contact@odata.bind':_0xe996('0x41')+_0x1cdc17[_0xe996('0x30')]+')','ownerid@odata.bind':_0xe996('0x28')+_0x1cdc17['userId']+')','caseorigincode':'1'},getCustomFields(_0x8be9de[_0xe996('0x42')],_0x24dd43,_0x8be9de['ticketType'])),'headers':{'Authorization':_0xe996('0x15')+_0x5d8add,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x8be9de[_0xe996('0x3a')]==='phonecall'){_0x37c55a={'method':_0xe996('0x3b'),'uri':_0x375283+_0xe996('0x43'),'body':Object[_0xe996('0x3d')]({},{'subject':intUtil[_0xe996('0x3e')](_0x8be9de['Subjects'],_0x24dd43,'\x20'),'phonenumber':String(_0x24dd43[_0xe996('0x2f')]),'description':intUtil[_0xe996('0x3e')](_0x8be9de[_0xe996('0x40')],_0x24dd43,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x1cdc17[_0xe996('0x30')]+')','ownerid@odata.bind':'/systemusers('+_0x1cdc17['userId']+')','directioncode':_0x1cdc17[_0xe996('0x44')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xe996('0x28')+_0x1cdc17[_0xe996('0x1f')]+')','participationtypemask':_0x1cdc17['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xe996('0x41')+_0x1cdc17['enduserId']+')','participationtypemask':_0x1cdc17['callDirection']==='queue'?0x1:0x2}]},getCustomFields(_0x8be9de[_0xe996('0x42')],_0x24dd43,_0x8be9de[_0xe996('0x3a')])),'headers':{'Authorization':'Bearer\x20'+_0x5d8add,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x37c55a);})['then'](function(_0x84ce6c){var _0x2d8e1b=_0x84ce6c[_0xe996('0x2a')]['odata-entityid'];var _0x876323=_0x2d8e1b[_0xe996('0x37')](_0x2d8e1b[_0xe996('0x2c')]('(')+0x1,_0x2d8e1b[_0xe996('0x2c')](')'));_0x1cdc17[_0xe996('0x45')]=_0x876323;_0x41f422(_0x1cdc17);})[_0xe996('0x23')](function(_0x456076){_0x22148b(_0x456076[_0xe996('0x13')]);});});}function emit(_0x23352f,_0x4eb56a,_0x5b04b2,_0x50333f){var _0x2ace88={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x23352f,_0x5b04b2,_0x50333f)};io['to'](util[_0xe996('0x46')](_0xe996('0x47'),_0x4eb56a))['emit'](_0xe996('0x48'),_0x2ace88);}exports['cs']=function(_0x4cea3b,_0x5c484b,_0x525ae2,_0x390432,_0x377206,_0x4530fd,_0x514106,_0x3e95df){var _0x22f7c8={};_0x4530fd[_0xe996('0xa')]=intUtil[_0xe996('0x49')](_0x4530fd['remoteUri']);_0x4530fd[_0xe996('0x4a')]=intUtil['stripTrailingSlash'](_0x4530fd[_0xe996('0x4a')]);_0x22f7c8['callDirection']=_0x3e95df===_0xe996('0x4b')||_0x3e95df===_0xe996('0x4c')?'queue':'outbound';var _0x5d62ec=util[_0xe996('0x46')](_0xe996('0x4d'),_0x4530fd[_0xe996('0xa')]);var _0x4c173c=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x4530fd['tenantId']);var _0x392918=util['format'](_0xe996('0x4e'),_0x4530fd[_0xe996('0x4a')],_0x5c484b[_0xe996('0x4f')],md5(_0x5c484b[_0xe996('0x4f')]));if(_0x377206&&_0x377206[_0xe996('0x50')]){logger[_0xe996('0x1d')](_0xe996('0x51'),_0xe996('0x52'));_0x5c484b[_0xe996('0x53')]=_0x392918;}else if(_0x514106&&_0x514106[_0xe996('0x54')]&&_0x514106[_0xe996('0x54')]!==_0xe996('0x55')){logger['info'](_0xe996('0x56'),_0xe996('0x52'));_0x5c484b['recordingURL']=_0x392918;}else{_0x5c484b[_0xe996('0x53')]='';}return getUser(_0x22f7c8,_0x4530fd,_0x390432,_0x4c173c,_0x5d62ec,_0x3e95df)[_0xe996('0xe')](function(_0x17e66c){logger['info']('['+_0x3e95df[_0xe996('0x11')]()+_0xe996('0x57'),_0x17e66c[_0xe996('0x1f')]);logger[_0xe996('0x1d')]('['+_0x3e95df[_0xe996('0x11')]()+']\x20The\x20User\x20email\x20is:',_0x17e66c[_0xe996('0x22')]);return getEndUser(_0x17e66c,_0x4530fd,_0x4c173c,_0x5d62ec,_0x5c484b,_0x3e95df);})[_0xe996('0xe')](function(_0xc68d37){logger[_0xe996('0x1d')]('['+_0x3e95df['toUpperCase']()+_0xe996('0x58'),_0xc68d37[_0xe996('0x30')]);logger[_0xe996('0x1d')]('['+_0x3e95df[_0xe996('0x11')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x5c484b[_0xe996('0x2f')]);return getTicket(_0xc68d37,_0x4530fd,_0x4c173c,_0x5d62ec,_0x5c484b,_0x525ae2,_0x3e95df);})[_0xe996('0xe')](function(_0x14fee1){logger['info'](util[_0xe996('0x46')]('['+_0x3e95df[_0xe996('0x11')]()+_0xe996('0x59'),_0x525ae2[_0xe996('0x3a')],_0x14fee1[_0xe996('0x45')]));logger[_0xe996('0x1d')](util[_0xe996('0x46')]('['+_0x3e95df[_0xe996('0x11')]()+']\x20Call\x20direction:\x20%s',_0x3e95df));if(_0x3e95df!==_0xe996('0x4c')){logger[_0xe996('0x1d')]('['+_0x3e95df['toUpperCase']()+']',_0xe996('0x5a'));emit(_0x4530fd[_0xe996('0xa')],_0x390432[_0xe996('0x5b')],_0x525ae2[_0xe996('0x3a')],_0x14fee1[_0xe996('0x45')]);}})[_0xe996('0x23')](function(_0x5f09c9){logger[_0xe996('0x10')]('['+_0x3e95df[_0xe996('0x11')]()+_0xe996('0x5c'),util[_0xe996('0x5d')](_0x5f09c9,{'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 6955c89..67ffa9c 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 _0x721b=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','unmanaged','lastevent','toUpperCase','recordingURL','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','merge','format','calleridnum','getString','Subjects','Descriptions','
','Tags','name','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','info','Agent\x20found!','find','contact','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','map','type','string','nameField','customField','toLowerCase','content','idField','push','toString','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','[OUTBOUND]'];(function(_0x51d6e1,_0x166d18){var _0x509eed=function(_0x4c91d0){while(--_0x4c91d0){_0x51d6e1['push'](_0x51d6e1['shift']());}};_0x509eed(++_0x166d18);}(_0x721b,0x69));var _0xb721=function(_0x2baf90,_0x61f835){_0x2baf90=_0x2baf90-0x0;var _0x21710a=_0x721b[_0x2baf90];return _0x21710a;};'use strict';var _=require(_0xb721('0x0'));var rp=require(_0xb721('0x1'));var md5=require(_0xb721('0x2'));var util=require(_0xb721('0x3'));var Redis=require(_0xb721('0x4'));var intUtil=require(_0xb721('0x5'));var config=require(_0xb721('0x6'));var logger=require(_0xb721('0x7'))(_0xb721('0x8'));config['redis']=_[_0xb721('0x9')](config[_0xb721('0xa')],{'host':_0xb721('0xb'),'port':0x18eb});var io=require(_0xb721('0xc'))(new Redis(config[_0xb721('0xa')]));var headers={'Content-Type':_0xb721('0xd'),'Accept':_0xb721('0xd')};function emit(_0x6ea524,_0x47e217,_0x22d909){io['to'](_0x6ea524)['emit'](_0x47e217,_0x22d909);}function getTicket(_0x57de23,_0x1becb7,_0xe89263,_0x2cb2a6,_0x481574){logger['info'](_0xb721('0xe'));var _0x43278b=_[_0xb721('0xf')]({'responder_id':_0x1becb7['id'],'requester_id':_0xe89263['id'],'name':util[_0xb721('0x10')]('Caller\x20-\x20%s',_0x481574['calleridname']),'phone':_0x481574[_0xb721('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xb721('0x12')](_0x2cb2a6[_0xb721('0x13')],_0x481574,'\x20'),'description':intUtil[_0xb721('0x12')](_0x2cb2a6[_0xb721('0x14')],_0x481574,_0xb721('0x15')),'tags':getTags(_0x2cb2a6[_0xb721('0x16')],_0xb721('0x17'))},getCustomFields(_0x2cb2a6['Fields'],_0x481574));_0x43278b[_0xb721('0x18')]=_[_0xb721('0x19')](_['keyBy'](_0x43278b[_0xb721('0x18')],'id'),_0xb721('0x1a'));return request({'uri':util[_0xb721('0x10')](_0xb721('0x1b'),_0x57de23[_0xb721('0x1c')]),'method':_0xb721('0x1d'),'body':_0x43278b})[_0xb721('0x1e')](function(_0x4f5fad){logger['info'](_0xb721('0x1f'));return _0x4f5fad;});}function getUser(_0x3cbb56,_0x5b661b){if(intUtil[_0xb721('0x20')](_0x5b661b)){return request({'uri':util['format'](_0xb721('0x21'),_0x3cbb56[_0xb721('0x1c')]),'qs':{'email':_0x5b661b}})[_0xb721('0x1e')](function(_0x5cebc4){if(_0x5cebc4[_0xb721('0x22')]){logger[_0xb721('0x23')](_0xb721('0x24'));return _[_0xb721('0x25')](_0x5cebc4,function(_0x4962ec){return _0x4962ec[_0xb721('0x26')]['email']===_0x5b661b;});}else{logger[_0xb721('0x23')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb721('0x10')](_0xb721('0x27'),_0x3cbb56['remoteUri'])})[_0xb721('0x1e')](function(_0x55c370){logger[_0xb721('0x23')](_0xb721('0x28'));return _0x55c370;});}});}else{logger[_0xb721('0x23')](_0xb721('0x29'));return request({'uri':util[_0xb721('0x10')](_0xb721('0x27'),_0x3cbb56[_0xb721('0x1c')])})[_0xb721('0x1e')](function(_0x128752){logger['info'](_0xb721('0x28'));return _0x128752;});}}function getEndUser(_0x4a9879,_0x4be80c,_0x1f56cc){logger[_0xb721('0x23')](_0xb721('0x2a'),_0x1f56cc);return request({'uri':util['format'](_0xb721('0x2b'),_0x4a9879[_0xb721('0x1c')]),'qs':{'phone':_0x1f56cc}})[_0xb721('0x1e')](function(_0x203384){if(_0x203384['length']){logger[_0xb721('0x23')](_0xb721('0x2c'));return _[_0xb721('0x25')](_0x203384,{'phone':_0x1f56cc});}else{logger[_0xb721('0x23')](_0xb721('0x2d'));return request({'uri':util[_0xb721('0x10')](_0xb721('0x2b'),_0x4a9879[_0xb721('0x1c')]),'method':'POST','body':{'name':_0x4be80c,'phone':_0x1f56cc}})['then'](function(_0x11b7a1){logger[_0xb721('0x23')](_0xb721('0x2e'));return _0x11b7a1;});}});}function getAuth(_0x49bb18){return util['format'](_0xb721('0x2f'),new Buffer(_0x49bb18['apiKey']+':X')['toString'](_0xb721('0x30')));}function request(_0x760f76){logger[_0xb721('0x31')](_0xb721('0x32'),JSON[_0xb721('0x33')](_0x760f76));return rp(_[_0xb721('0x9')](_0x760f76,{'method':_0xb721('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x154b2e,_0x491974){var _0xe6df69=[];if(_0x154b2e&&_0x154b2e[_0xb721('0x22')]>0x0){_0xe6df69=_[_0xb721('0x35')](_0x154b2e,_0x491974);}return _0xe6df69;}function getCustomFields(_0x26c124,_0x14989b){var _0x41ba92=[];var _0xf315d0={'custom_fields':[]};if(_0x26c124[_0xb721('0x22')]>0x0){_['forEach'](_0x26c124,function(_0x5d306a){if(_0x5d306a[_0xb721('0x36')]===_0xb721('0x37')&&_0x5d306a[_0xb721('0x38')]&&!_0x5d306a[_0xb721('0x39')]){_0xf315d0[_0x5d306a[_0xb721('0x38')][_0xb721('0x3a')]()]=_0x5d306a[_0xb721('0x3b')]['toString']();}else if(_0x5d306a[_0xb721('0x36')]==='string'&&_0x5d306a[_0xb721('0x3c')]&&_0x5d306a[_0xb721('0x39')]){_0xf315d0['custom_fields'][_0xb721('0x3d')]({'id':_0x5d306a[_0xb721('0x3c')],'value':_0x5d306a[_0xb721('0x3b')][_0xb721('0x3e')]()});}else if(_0x5d306a[_0xb721('0x36')]==='variable'&&_0x5d306a[_0xb721('0x3f')]&&_0x5d306a['idField']&&_0x5d306a[_0xb721('0x39')]){_0x14989b[_0x5d306a[_0xb721('0x3f')]]&&_0xf315d0[_0xb721('0x18')]['push']({'id':_0x5d306a[_0xb721('0x3c')],'value':_0x14989b[_0x5d306a[_0xb721('0x3f')]]['toString']()});}else if(_0x5d306a['type']===_0xb721('0x40')&&_0x5d306a[_0xb721('0x41')]&&_0x5d306a[_0xb721('0x41')]['name']&&_0x5d306a[_0xb721('0x3c')]&&_0x5d306a[_0xb721('0x39')]){_0x14989b[_0x5d306a[_0xb721('0x41')][_0xb721('0x17')][_0xb721('0x3a')]()]&&_0xf315d0[_0xb721('0x18')][_0xb721('0x3d')]({'id':_0x5d306a[_0xb721('0x3c')],'value':_0x14989b[_0x5d306a[_0xb721('0x41')][_0xb721('0x17')][_0xb721('0x3a')]()]['toString']()});}});}return _0xf315d0;}exports['queue']=function(_0x36ef07,_0x520770,_0x1cd21e,_0x332ad8,_0x128e34,_0x56d222){var _0x2a3e14,_0x110e3a;_0x56d222[_0xb721('0x1c')]=intUtil[_0xb721('0x42')](_0x56d222['remoteUri']);_0x56d222[_0xb721('0x43')]=intUtil[_0xb721('0x42')](_0x56d222[_0xb721('0x43')]);if(_0x128e34&&_0x128e34[_0xb721('0x44')]){logger[_0xb721('0x23')](_0xb721('0x45'),_0xb721('0x46'));_0x520770['recordingURL']=util[_0xb721('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x56d222[_0xb721('0x43')],_0x520770[_0xb721('0x47')],md5(_0x520770[_0xb721('0x47')]));}else{_0x520770['recordingURL']='';}headers[_0xb721('0x48')]=getAuth(_0x56d222);return getUser(_0x56d222,_0x332ad8[_0xb721('0x49')])[_0xb721('0x1e')](function(_0x2b544b){_0x2a3e14=_0x2b544b;logger[_0xb721('0x23')](_0xb721('0x4a'),_0x2a3e14['id']);return getEndUser(_0x56d222,_0x520770['calleridname'],_0x520770['calleridnum']);})[_0xb721('0x1e')](function(_0x114d5c){_0x110e3a=_0x114d5c;logger[_0xb721('0x23')]('The\x20Enduser\x20ID\x20is:',_0x110e3a['id']);return getTicket(_0x56d222,_0x2a3e14,_0x110e3a,_0x1cd21e,_0x520770);})['then'](function(_0x5d7211){if(_0x5d7211&&_0x5d7211['id']){logger[_0xb721('0x23')]('Ticket\x20created!');logger[_0xb721('0x23')](_0xb721('0x4b'),_0x5d7211['id']);logger[_0xb721('0x23')](_0xb721('0x45'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb721('0x10')](_0xb721('0x4c'),_0x332ad8['name']),'trigger:browser:url',{'uri':util[_0xb721('0x10')](_0xb721('0x4d'),_0x56d222[_0xb721('0x1c')],_0x5d7211['id'])});}})[_0xb721('0x4e')](function(_0x436fac){logger['error'](_0xb721('0x45'),JSON['stringify'](_0x436fac));});};exports[_0xb721('0x4f')]=function(_0x3d20e2,_0x3f0133,_0x42d3ad,_0x23d38d,_0x33eb33,_0x404a63,_0x22df70){var _0x40b53b,_0x3333d1;_0x404a63[_0xb721('0x1c')]=intUtil[_0xb721('0x42')](_0x404a63['remoteUri']);_0x404a63[_0xb721('0x43')]=intUtil['stripTrailingSlash'](_0x404a63[_0xb721('0x43')]);if(_0x22df70&&_0x22df70[_0xb721('0x50')]&&_0x22df70[_0xb721('0x50')]!==_0xb721('0x51')){logger[_0xb721('0x23')](_0xb721('0x52'),_0xb721('0x46'));_0x3f0133['recordingURL']=util['format'](_0xb721('0x53'),_0x404a63[_0xb721('0x43')],_0x3f0133[_0xb721('0x47')],md5(_0x3f0133[_0xb721('0x47')]));}headers[_0xb721('0x48')]=getAuth(_0x404a63);return getUser(_0x404a63,_0x23d38d[_0xb721('0x49')])['then'](function(_0x1822d3){_0x40b53b=_0x1822d3;logger[_0xb721('0x23')](_0xb721('0x4a'),_0x40b53b['id']);return getEndUser(_0x404a63,_0x3f0133[_0xb721('0x54')],_0x3f0133[_0xb721('0x55')]);})[_0xb721('0x1e')](function(_0x371c26){_0x3333d1=_0x371c26;logger[_0xb721('0x23')](_0xb721('0x56'),_0x3333d1['id']);return getTicket(_0x404a63,_0x40b53b,_0x3333d1,_0x42d3ad,_0x3f0133);})[_0xb721('0x1e')](function(_0x33493d){if(_0x33493d&&_0x33493d['id']){logger[_0xb721('0x23')](_0xb721('0x1f'));logger[_0xb721('0x23')](_0xb721('0x4b'),_0x33493d['id']);logger['info'](_0xb721('0x52'),_0xb721('0x57'));emit(util[_0xb721('0x10')](_0xb721('0x4c'),_0x23d38d['name']),_0xb721('0x58'),{'uri':util[_0xb721('0x10')](_0xb721('0x4d'),_0x404a63[_0xb721('0x1c')],_0x33493d['id'])});}})['catch'](function(_0x2c0f8f){logger[_0xb721('0x59')](_0xb721('0x52'),JSON[_0xb721('0x33')](_0x2c0f8f));});};exports[_0xb721('0x5a')]=function(_0x1e1bc8,_0x4ddb14,_0x50fa00,_0x18fca9,_0x5bc135,_0x18a5f4){var _0x5374fb,_0x67caa2;_0x18a5f4[_0xb721('0x1c')]=intUtil[_0xb721('0x42')](_0x18a5f4[_0xb721('0x1c')]);_0x18a5f4[_0xb721('0x43')]=intUtil[_0xb721('0x42')](_0x18a5f4[_0xb721('0x43')]);if(_0x5bc135&&_0x5bc135['monitor_format']){logger[_0xb721('0x23')]('['+_0x4ddb14[_0xb721('0x5b')][_0xb721('0x5c')]()+']',_0xb721('0x46'));_0x4ddb14[_0xb721('0x5d')]=util[_0xb721('0x10')](_0xb721('0x53'),_0x18a5f4[_0xb721('0x43')],_0x4ddb14[_0xb721('0x47')],md5(_0x4ddb14[_0xb721('0x47')]));}else{_0x4ddb14['recordingURL']='';}headers[_0xb721('0x48')]=getAuth(_0x18a5f4);return getUser(_0x18a5f4,'')[_0xb721('0x1e')](function(_0x563883){_0x5374fb=_0x563883;logger[_0xb721('0x23')](_0xb721('0x4a'),_0x5374fb['id']);return getEndUser(_0x18a5f4,_0x4ddb14['calleridname'],_0x4ddb14[_0xb721('0x11')]);})[_0xb721('0x1e')](function(_0x136401){_0x67caa2=_0x136401;logger[_0xb721('0x23')](_0xb721('0x56'),_0x67caa2['id']);return getTicket(_0x18a5f4,_0x5374fb,_0x67caa2,_0x50fa00,_0x4ddb14);})[_0xb721('0x1e')](function(_0x5d69dc){if(_0x5d69dc){logger['info'](_0xb721('0x1f'));logger[_0xb721('0x23')]('The\x20Ticket\x20ID\x20is:',_0x5d69dc['id']);}})[_0xb721('0x4e')](function(_0x42efda){logger[_0xb721('0x59')]('['+_0x4ddb14[_0xb721('0x5b')]['toUpperCase']()+']',JSON['stringify'](_0x42efda));});}; \ No newline at end of file +var _0x55c8=['Enduser\x20created.','Basic\x20%s','toString','debug','stringify','defaults','map','forEach','type','string','customField','toLowerCase','content','idField','custom_fields','push','variableName','Variable','queue','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','trigger:browser:url','unmanaged','toUpperCase','lastevent','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','info','Creating\x20new\x20ticket...','merge','format','calleridname','Subjects','getString','Descriptions','
','name','Fields','mapValues','keyBy','value','remoteUri','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','Agent\x20found!','find','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!'];(function(_0x148dfa,_0x4c1266){var _0x39d953=function(_0x419042){while(--_0x419042){_0x148dfa['push'](_0x148dfa['shift']());}};_0x39d953(++_0x4c1266);}(_0x55c8,0x12c));var _0x855c=function(_0x2d9b4e,_0x334967){_0x2d9b4e=_0x2d9b4e-0x0;var _0x29afef=_0x55c8[_0x2d9b4e];return _0x29afef;};'use strict';var _=require(_0x855c('0x0'));var rp=require(_0x855c('0x1'));var md5=require('md5');var util=require(_0x855c('0x2'));var Redis=require(_0x855c('0x3'));var intUtil=require(_0x855c('0x4'));var config=require(_0x855c('0x5'));var logger=require(_0x855c('0x6'))(_0x855c('0x7'));config[_0x855c('0x8')]=_['defaults'](config['redis'],{'host':_0x855c('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x855c('0x8')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x2e7b7c,_0x356f75,_0x5ea077){io['to'](_0x2e7b7c)['emit'](_0x356f75,_0x5ea077);}function getTicket(_0x2b628f,_0x3c089f,_0x53d02e,_0x58db02,_0x132a1d){logger[_0x855c('0xa')](_0x855c('0xb'));var _0x5d622b=_[_0x855c('0xc')]({'responder_id':_0x3c089f['id'],'requester_id':_0x53d02e['id'],'name':util[_0x855c('0xd')]('Caller\x20-\x20%s',_0x132a1d[_0x855c('0xe')]),'phone':_0x132a1d['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x58db02[_0x855c('0xf')],_0x132a1d,'\x20'),'description':intUtil[_0x855c('0x10')](_0x58db02[_0x855c('0x11')],_0x132a1d,_0x855c('0x12')),'tags':getTags(_0x58db02['Tags'],_0x855c('0x13'))},getCustomFields(_0x58db02[_0x855c('0x14')],_0x132a1d));_0x5d622b['custom_fields']=_[_0x855c('0x15')](_[_0x855c('0x16')](_0x5d622b['custom_fields'],'id'),_0x855c('0x17'));return request({'uri':util[_0x855c('0xd')]('%s/api/v2/tickets',_0x2b628f[_0x855c('0x18')]),'method':_0x855c('0x19'),'body':_0x5d622b})['then'](function(_0x58fbd3){logger[_0x855c('0xa')](_0x855c('0x1a'));return _0x58fbd3;});}function getUser(_0xbc8654,_0x36aaba){if(intUtil[_0x855c('0x1b')](_0x36aaba)){return request({'uri':util[_0x855c('0xd')](_0x855c('0x1c'),_0xbc8654[_0x855c('0x18')]),'qs':{'email':_0x36aaba}})[_0x855c('0x1d')](function(_0xd302c4){if(_0xd302c4[_0x855c('0x1e')]){logger[_0x855c('0xa')](_0x855c('0x1f'));return _[_0x855c('0x20')](_0xd302c4,function(_0x869bbf){return _0x869bbf['contact'][_0x855c('0x21')]===_0x36aaba;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x855c('0xd')](_0x855c('0x22'),_0xbc8654[_0x855c('0x18')])})[_0x855c('0x1d')](function(_0x5e61ef){logger['info'](_0x855c('0x23'));return _0x5e61ef;});}});}else{logger['info'](_0x855c('0x24'));return request({'uri':util[_0x855c('0xd')]('%s/api/v2/agents/me',_0xbc8654['remoteUri'])})['then'](function(_0x37459c){logger[_0x855c('0xa')](_0x855c('0x23'));return _0x37459c;});}}function getEndUser(_0x138ed6,_0x4f29a4,_0x5b9a3d){logger[_0x855c('0xa')]('Searching\x20enduser\x20with\x20phone',_0x5b9a3d);return request({'uri':util['format'](_0x855c('0x25'),_0x138ed6[_0x855c('0x18')]),'qs':{'phone':_0x5b9a3d}})[_0x855c('0x1d')](function(_0x106dd9){if(_0x106dd9[_0x855c('0x1e')]){logger[_0x855c('0xa')](_0x855c('0x26'));return _[_0x855c('0x20')](_0x106dd9,{'phone':_0x5b9a3d});}else{logger[_0x855c('0xa')](_0x855c('0x27'));return request({'uri':util[_0x855c('0xd')](_0x855c('0x25'),_0x138ed6['remoteUri']),'method':_0x855c('0x19'),'body':{'name':_0x4f29a4,'phone':_0x5b9a3d}})['then'](function(_0x3e5462){logger['info'](_0x855c('0x28'));return _0x3e5462;});}});}function getAuth(_0x58a063){return util[_0x855c('0xd')](_0x855c('0x29'),new Buffer(_0x58a063['apiKey']+':X')[_0x855c('0x2a')]('base64'));}function request(_0x2dca7c){logger[_0x855c('0x2b')]('[HTTP]',JSON[_0x855c('0x2c')](_0x2dca7c));return rp(_[_0x855c('0x2d')](_0x2dca7c,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3463e7,_0xb990dc){var _0x2f13e3=[];if(_0x3463e7&&_0x3463e7[_0x855c('0x1e')]>0x0){_0x2f13e3=_[_0x855c('0x2e')](_0x3463e7,_0xb990dc);}return _0x2f13e3;}function getCustomFields(_0x22008d,_0x466d3e){var _0x9988e8=[];var _0x169d6d={'custom_fields':[]};if(_0x22008d['length']>0x0){_[_0x855c('0x2f')](_0x22008d,function(_0x5835f4){if(_0x5835f4[_0x855c('0x30')]===_0x855c('0x31')&&_0x5835f4['nameField']&&!_0x5835f4[_0x855c('0x32')]){_0x169d6d[_0x5835f4['nameField'][_0x855c('0x33')]()]=_0x5835f4[_0x855c('0x34')]['toString']();}else if(_0x5835f4[_0x855c('0x30')]===_0x855c('0x31')&&_0x5835f4[_0x855c('0x35')]&&_0x5835f4['customField']){_0x169d6d[_0x855c('0x36')][_0x855c('0x37')]({'id':_0x5835f4[_0x855c('0x35')],'value':_0x5835f4[_0x855c('0x34')]['toString']()});}else if(_0x5835f4['type']==='variable'&&_0x5835f4[_0x855c('0x38')]&&_0x5835f4['idField']&&_0x5835f4[_0x855c('0x32')]){_0x466d3e[_0x5835f4[_0x855c('0x38')]]&&_0x169d6d[_0x855c('0x36')]['push']({'id':_0x5835f4[_0x855c('0x35')],'value':_0x466d3e[_0x5835f4[_0x855c('0x38')]][_0x855c('0x2a')]()});}else if(_0x5835f4[_0x855c('0x30')]==='customVariable'&&_0x5835f4[_0x855c('0x39')]&&_0x5835f4[_0x855c('0x39')][_0x855c('0x13')]&&_0x5835f4['idField']&&_0x5835f4[_0x855c('0x32')]){_0x466d3e[_0x5835f4[_0x855c('0x39')][_0x855c('0x13')][_0x855c('0x33')]()]&&_0x169d6d[_0x855c('0x36')][_0x855c('0x37')]({'id':_0x5835f4[_0x855c('0x35')],'value':_0x466d3e[_0x5835f4[_0x855c('0x39')][_0x855c('0x13')][_0x855c('0x33')]()]['toString']()});}});}return _0x169d6d;}exports[_0x855c('0x3a')]=function(_0x5aadd6,_0x218d8e,_0x33cf18,_0x5a2237,_0x156689,_0x1ad4cb){var _0x1e2589,_0x3f3120;_0x1ad4cb[_0x855c('0x18')]=intUtil['stripTrailingSlash'](_0x1ad4cb['remoteUri']);_0x1ad4cb[_0x855c('0x3b')]=intUtil[_0x855c('0x3c')](_0x1ad4cb[_0x855c('0x3b')]);if(_0x156689&&_0x156689['monitor_format']){logger[_0x855c('0xa')](_0x855c('0x3d'),'Recording\x20is\x20enabled!');_0x218d8e[_0x855c('0x3e')]=util['format'](_0x855c('0x3f'),_0x1ad4cb[_0x855c('0x3b')],_0x218d8e[_0x855c('0x40')],md5(_0x218d8e[_0x855c('0x40')]));}else{_0x218d8e[_0x855c('0x3e')]='';}headers[_0x855c('0x41')]=getAuth(_0x1ad4cb);return getUser(_0x1ad4cb,_0x5a2237[_0x855c('0x21')])[_0x855c('0x1d')](function(_0x4606f9){_0x1e2589=_0x4606f9;logger[_0x855c('0xa')](_0x855c('0x42'),_0x1e2589['id']);return getEndUser(_0x1ad4cb,_0x218d8e['calleridname'],_0x218d8e[_0x855c('0x43')]);})[_0x855c('0x1d')](function(_0x31e6f4){_0x3f3120=_0x31e6f4;logger[_0x855c('0xa')](_0x855c('0x44'),_0x3f3120['id']);return getTicket(_0x1ad4cb,_0x1e2589,_0x3f3120,_0x33cf18,_0x218d8e);})[_0x855c('0x1d')](function(_0xaab7f8){if(_0xaab7f8&&_0xaab7f8['id']){logger['info'](_0x855c('0x1a'));logger[_0x855c('0xa')](_0x855c('0x45'),_0xaab7f8['id']);logger[_0x855c('0xa')](_0x855c('0x3d'),_0x855c('0x46'));emit(util['format'](_0x855c('0x47'),_0x5a2237['name']),'trigger:browser:url',{'uri':util['format'](_0x855c('0x48'),_0x1ad4cb[_0x855c('0x18')],_0xaab7f8['id'])});}})[_0x855c('0x49')](function(_0x3d14d5){logger[_0x855c('0x4a')](_0x855c('0x3d'),JSON[_0x855c('0x2c')](_0x3d14d5));});};exports[_0x855c('0x4b')]=function(_0x13af2d,_0x4f8198,_0x38d5f2,_0x384f46,_0x325065,_0x1b46dd,_0x8de330){var _0x302dbb,_0x113010;_0x1b46dd['remoteUri']=intUtil['stripTrailingSlash'](_0x1b46dd[_0x855c('0x18')]);_0x1b46dd[_0x855c('0x3b')]=intUtil[_0x855c('0x3c')](_0x1b46dd[_0x855c('0x3b')]);if(_0x8de330&&_0x8de330['recordingFormat']&&_0x8de330[_0x855c('0x4c')]!==_0x855c('0x4d')){logger[_0x855c('0xa')](_0x855c('0x4e'),_0x855c('0x4f'));_0x4f8198[_0x855c('0x3e')]=util[_0x855c('0xd')](_0x855c('0x3f'),_0x1b46dd[_0x855c('0x3b')],_0x4f8198[_0x855c('0x40')],md5(_0x4f8198[_0x855c('0x40')]));}headers[_0x855c('0x41')]=getAuth(_0x1b46dd);return getUser(_0x1b46dd,_0x384f46['email'])[_0x855c('0x1d')](function(_0x350b08){_0x302dbb=_0x350b08;logger[_0x855c('0xa')](_0x855c('0x42'),_0x302dbb['id']);return getEndUser(_0x1b46dd,_0x4f8198[_0x855c('0x50')],_0x4f8198['destcalleridnum']);})[_0x855c('0x1d')](function(_0x18df4f){_0x113010=_0x18df4f;logger[_0x855c('0xa')]('The\x20Enduser\x20ID\x20is:',_0x113010['id']);return getTicket(_0x1b46dd,_0x302dbb,_0x113010,_0x38d5f2,_0x4f8198);})[_0x855c('0x1d')](function(_0x290943){if(_0x290943&&_0x290943['id']){logger[_0x855c('0xa')](_0x855c('0x1a'));logger[_0x855c('0xa')](_0x855c('0x45'),_0x290943['id']);logger[_0x855c('0xa')](_0x855c('0x4e'),_0x855c('0x46'));emit(util['format'](_0x855c('0x47'),_0x384f46[_0x855c('0x13')]),_0x855c('0x51'),{'uri':util['format'](_0x855c('0x48'),_0x1b46dd['remoteUri'],_0x290943['id'])});}})['catch'](function(_0x4f9142){logger['error'](_0x855c('0x4e'),JSON[_0x855c('0x2c')](_0x4f9142));});};exports[_0x855c('0x52')]=function(_0x22137b,_0x2bc32c,_0x2f4566,_0x17a988,_0x3b781f,_0x207173){var _0x51f5f7,_0x4aca1b;_0x207173[_0x855c('0x18')]=intUtil['stripTrailingSlash'](_0x207173[_0x855c('0x18')]);_0x207173[_0x855c('0x3b')]=intUtil[_0x855c('0x3c')](_0x207173[_0x855c('0x3b')]);if(_0x3b781f&&_0x3b781f['monitor_format']){logger[_0x855c('0xa')]('['+_0x2bc32c['lastevent'][_0x855c('0x53')]()+']',_0x855c('0x4f'));_0x2bc32c[_0x855c('0x3e')]=util[_0x855c('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x207173[_0x855c('0x3b')],_0x2bc32c[_0x855c('0x40')],md5(_0x2bc32c[_0x855c('0x40')]));}else{_0x2bc32c['recordingURL']='';}headers[_0x855c('0x41')]=getAuth(_0x207173);return getUser(_0x207173,'')[_0x855c('0x1d')](function(_0x467cbe){_0x51f5f7=_0x467cbe;logger[_0x855c('0xa')](_0x855c('0x42'),_0x51f5f7['id']);return getEndUser(_0x207173,_0x2bc32c[_0x855c('0xe')],_0x2bc32c[_0x855c('0x43')]);})['then'](function(_0x4f7f2d){_0x4aca1b=_0x4f7f2d;logger['info'](_0x855c('0x44'),_0x4aca1b['id']);return getTicket(_0x207173,_0x51f5f7,_0x4aca1b,_0x2f4566,_0x2bc32c);})[_0x855c('0x1d')](function(_0x32952e){if(_0x32952e){logger['info'](_0x855c('0x1a'));logger[_0x855c('0xa')](_0x855c('0x45'),_0x32952e['id']);}})['catch'](function(_0x3881a9){logger[_0x855c('0x4a')]('['+_0x2bc32c[_0x855c('0x54')][_0x855c('0x53')]()+']',JSON[_0x855c('0x2c')](_0x3881a9));});}; \ 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 2bd372e..694fc79 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 _0x363e=['POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','headers','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Descriptions','Contact','add','ticketId','Task\x20created:','/contacts/','trigger:browser:url','apiKey','stripTrailingSlash','remoteUri','serverUrl','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','Getting\x20user\x20list','then','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','message','/api/lookup?q=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','endUserId'];(function(_0x28e3cb,_0x2e75dc){var _0x4f0ee7=function(_0x162607){while(--_0x162607){_0x28e3cb['push'](_0x28e3cb['shift']());}};_0x4f0ee7(++_0x2e75dc);}(_0x363e,0x179));var _0xe363=function(_0xeb046f,_0xbac84e){_0xeb046f=_0xeb046f-0x0;var _0x58b4a8=_0x363e[_0xeb046f];return _0x58b4a8;};'use strict';var _=require(_0xe363('0x0'));var rp=require(_0xe363('0x1'));var md5=require('md5');var util=require(_0xe363('0x2'));var moment=require(_0xe363('0x3'));var Promise=require(_0xe363('0x4'));var Redis=require(_0xe363('0x5'));var intUtil=require(_0xe363('0x6'));var config=require(_0xe363('0x7'));var logger=require(_0xe363('0x8'))(_0xe363('0x9'));config[_0xe363('0xa')]=_[_0xe363('0xb')](config[_0xe363('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xe363('0xc'))(new Redis(config[_0xe363('0xa')]));function getAdminId(_0xc5df66,_0x29d330,_0x515185,_0x24255d){return new Promise(function(_0x308de7,_0x18cfa8){var _0x46076b=![];var _0x29a78c={'method':_0xe363('0xd'),'uri':_0x24255d+_0xe363('0xe'),'json':!![]};_0x29a78c['headers']=_0x515185;logger[_0xe363('0xf')](_0xe363('0x10'));return rp(_0x29a78c)['then'](function(_0x393a1f){if(_0x393a1f){var _0x5d031e=_0x393a1f['users'];var _0x8b6974=null;for(_0x8b6974=0x0;_0x8b6974<_0x5d031e[_0xe363('0x11')];_0x8b6974++){if(_0x5d031e[_0x8b6974][_0xe363('0x12')]===_0xc5df66[_0xe363('0x13')]){_0xc5df66[_0xe363('0x14')]=_0x5d031e[_0x8b6974]['id'];_0x46076b=!![];}}if(_0x46076b){logger['info'](_0xe363('0x15'),_0xc5df66[_0xe363('0x14')]);_0x308de7(_0xc5df66);}else{_0x18cfa8({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x18cfa8({'statusCode':0x194,'message':_0xe363('0x16')});}})[_0xe363('0x17')](function(_0x52e6c6){logger[_0xe363('0x18')]('['+[_0x29d330[_0xe363('0x19')]()]+']',_0x52e6c6['message']);_0x18cfa8(_0x52e6c6);});});}function getUser(_0xd9d1b1,_0xc94d0a,_0x5e148d){return function(_0xecbe2c){return new Promise(function(_0x17606f,_0x2f2c20){var _0x4dcba0={'method':_0xe363('0xd'),'uri':_0x5e148d+_0xe363('0xe'),'json':!![]};_0x4dcba0['headers']=_0xc94d0a;logger[_0xe363('0xf')](_0xe363('0x1a'));return rp(_0x4dcba0)[_0xe363('0x1b')](function(_0x7d407d){if(_0x7d407d){var _0x2d47cc=_0x7d407d[_0xe363('0x1c')];var _0x4ee855=![];var _0x3bed39=null;if(_0xecbe2c[_0xe363('0x1d')]!==null){logger[_0xe363('0xf')](_0xe363('0x1e'),_0xecbe2c[_0xe363('0x1d')]);_0xecbe2c[_0xe363('0x1f')]=_0xecbe2c[_0xe363('0x1d')];for(_0x3bed39=0x0;_0x3bed39<_0x2d47cc[_0xe363('0x11')];_0x3bed39++){if(_0x2d47cc[_0x3bed39][_0xe363('0x12')]===_0xecbe2c[_0xe363('0x1d')]){_0x4ee855=!![];_0xecbe2c[_0xe363('0x20')]=_0x2d47cc[_0x3bed39]['id'];logger[_0xe363('0xf')](_0xe363('0x21'),_0xecbe2c[_0xe363('0x20')]);}}}if(!_0x4ee855){logger[_0xe363('0xf')](_0xe363('0x22'));_0xecbe2c[_0xe363('0x1f')]=_0xecbe2c[_0xe363('0x13')];_0xecbe2c[_0xe363('0x20')]=_0xecbe2c[_0xe363('0x14')];_0x4ee855=!![];}if(_0x4ee855){_0x17606f(_0xecbe2c);}else{_0x2f2c20({'statusCode':0x194,'message':_0xe363('0x16')});}}else{_0x2f2c20({'statusCode':0x194,'message':_0xe363('0x16')});}})['catch'](function(_0xbdfae9){logger[_0xe363('0x18')]('['+[_0xd9d1b1[_0xe363('0x19')]()]+']',_0xbdfae9[_0xe363('0x23')]);_0x2f2c20(_0xbdfae9);});});};}function searchContact(_0x335c60,_0x52cafe,_0x33b50c,_0x291841){return new Promise(function(_0x4dc950,_0x3cc130){var _0x5a790c={'method':_0xe363('0xd'),'headers':_0x52cafe,'uri':_0x335c60+_0xe363('0x24')+_0x291841+'&f='+_0x33b50c+_0xe363('0x25'),'json':!![]};rp(_0x5a790c)[_0xe363('0x1b')](function(_0x441476){var _0x54c76c=_[_0xe363('0x26')](_0x441476[_0xe363('0x27')][_0xe363('0x27')],[_0x33b50c,_0x291841]);_0x4dc950(_0x54c76c);})[_0xe363('0x17')](function(_0x4c6946){_0x3cc130(_0x4c6946);});});}function getEndUser(_0x2b395e,_0x3869bd,_0x404b32){return function(_0x187a23){return new Promise(function(_0x26ac10,_0x12b603){logger[_0xe363('0xf')](util[_0xe363('0x28')](_0xe363('0x29'),_0x187a23[_0xe363('0x2a')]));searchContact(_0x404b32,_0x3869bd,'mobile_number',_0x187a23['contactNumber'])[_0xe363('0x1b')](function(_0x295088){if(_0x295088){_0x187a23['endUserId']=_0x295088['id'];logger[_0xe363('0xf')](_0xe363('0x2b'),_0x187a23['endUserId']);return _0x26ac10(_0x187a23);}searchContact(_0x404b32,_0x3869bd,_0xe363('0x2c'),_0x187a23[_0xe363('0x2a')])[_0xe363('0x1b')](function(_0x1ed87e){if(_0x1ed87e){_0x187a23['endUserId']=_0x1ed87e['id'];logger['info'](_0xe363('0x2d'),_0x187a23['endUserId']);return _0x26ac10(_0x187a23);}createEndUser(_0x187a23,_0x2b395e,_0x3869bd,_0x404b32)['then'](function(_0x12f56b){logger[_0xe363('0xf')](_0xe363('0x2e'),_0x12f56b[_0xe363('0x2f')]);return _0x26ac10(_0x12f56b);});});})[_0xe363('0x17')](function(_0x1ad258){_0x12b603(_0x1ad258);});});};}function createEndUser(_0x249aa3,_0x8afbe2,_0x377e5e,_0x1a3389){return new Promise(function(_0x6268a8,_0x2a8703){var _0x544532=moment();var _0x574af3={'method':_0xe363('0x30'),'uri':_0x1a3389+_0xe363('0x31'),'body':{'contact':{'last_name':_0x249aa3[_0xe363('0x2a')],'work_number':_0x249aa3['contactNumber'],'mobile_number':_0x249aa3['contactNumber'],'owner_id':_0x249aa3[_0xe363('0x20')],'created_at':_0x544532[_0xe363('0x28')](_0xe363('0x32'))}},'json':!![]};_0x574af3[_0xe363('0x33')]=_0x377e5e;logger['info'](_0xe363('0x34'));return rp(_0x574af3)['then'](function(_0x1aa63a){_0x249aa3[_0xe363('0x2f')]=_0x1aa63a[_0xe363('0x35')]['id'];_0x6268a8(_0x249aa3);})[_0xe363('0x17')](function(_0x387ce0){logger[_0xe363('0x18')]('['+[_0x8afbe2[_0xe363('0x19')]()]+']',_0x387ce0[_0xe363('0x23')]);_0x2a8703(_0x387ce0[_0xe363('0x23')]);});});}function getTicket(_0x518694,_0x52fc17,_0x3ddc38,_0x44be85,_0xc7d891){return function(_0x34a043){logger[_0xe363('0xf')](_0xe363('0x36'));return new Promise(function(_0x1a2476,_0x393145){var _0x41bceb=moment();var _0x4b8238={'method':_0xe363('0x30'),'uri':_0x3ddc38+'/api/tasks','body':{'title':intUtil[_0xe363('0x37')](_0x44be85['Subjects'],_0xc7d891,'\x20'),'description':intUtil[_0xe363('0x37')](_0x44be85[_0xe363('0x38')],_0xc7d891,'\x0a'),'owner_id':_0x34a043['userId'],'creater_id':_0x34a043[_0xe363('0x14')],'targetable_id':_0x34a043[_0xe363('0x2f')],'targetable_type':_0xe363('0x39'),'created_at':_0x41bceb[_0xe363('0x28')](_0xe363('0x32')),'due_date':_0x41bceb[_0xe363('0x3a')](0x1e,'m')['format'](_0xe363('0x32'))},'json':!![]};_0x4b8238[_0xe363('0x33')]=_0x52fc17;return rp(_0x4b8238)[_0xe363('0x1b')](function(_0xcab016){_0x34a043[_0xe363('0x3b')]=_0xcab016['task']['id'];logger[_0xe363('0xf')](_0xe363('0x3c'),_0x34a043[_0xe363('0x3b')]);_0x1a2476(_0x34a043);})[_0xe363('0x17')](function(_0x6b3e5b){logger[_0xe363('0x18')]('['+[_0x518694[_0xe363('0x19')]()]+']',_0x6b3e5b['message']);_0x393145(_0x6b3e5b['message']);});});};}function emit(_0x234523,_0x23d249,_0x8f6a76){var _0x4aa733={'uri':_0x234523+_0xe363('0x3d')+_0x8f6a76};io['to'](util[_0xe363('0x28')]('user:%s',_0x23d249))['emit'](_0xe363('0x3e'),_0x4aa733);}exports['cs']=function(_0x34e08b,_0x1a6c70,_0x2a31fb,_0x4bdb73,_0x40f7c7,_0x2ec9d0,_0x5173fb,_0x4fbdbb){var _0x306afd={};var _0x238d4a={'Authorization':'Token\x20token='+_0x2ec9d0[_0xe363('0x3f')]};_0x2ec9d0['remoteUri']=intUtil[_0xe363('0x40')](_0x2ec9d0[_0xe363('0x41')]);_0x2ec9d0['serverUrl']=intUtil[_0xe363('0x40')](_0x2ec9d0[_0xe363('0x42')]);var _0x5ad432=_0x2ec9d0[_0xe363('0x41')];_0x306afd[_0xe363('0x13')]=_0x2ec9d0['username'];_0x306afd[_0xe363('0x2a')]=_0x4fbdbb['toLowerCase']()===_0xe363('0x43')?_0x1a6c70[_0xe363('0x44')]:_0x1a6c70[_0xe363('0x45')];_0x306afd[_0xe363('0x46')]=_0x4fbdbb==='queue'||_0x4fbdbb===_0xe363('0x47')?_0xe363('0x48'):_0xe363('0x43');if(_0x4bdb73){_0x306afd['agentEmail']=_0x4bdb73[_0xe363('0x12')];}var _0x4051d4=util[_0xe363('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2ec9d0[_0xe363('0x42')],_0x1a6c70[_0xe363('0x49')],md5(_0x1a6c70['uniqueid']));if(_0x40f7c7&&_0x40f7c7[_0xe363('0x4a')]){logger[_0xe363('0xf')](_0xe363('0x4b'),_0xe363('0x4c'));_0x1a6c70[_0xe363('0x4d')]=_0x4051d4;}else if(_0x5173fb&&_0x5173fb[_0xe363('0x4e')]&&_0x5173fb[_0xe363('0x4e')]!==_0xe363('0x4f')){logger[_0xe363('0xf')](_0xe363('0x50'),_0xe363('0x4c'));_0x1a6c70[_0xe363('0x4d')]=_0x4051d4;}else{_0x1a6c70[_0xe363('0x4d')]='';}return getAdminId(_0x306afd,_0x4fbdbb,_0x238d4a,_0x5ad432)['then'](getUser(_0x4fbdbb,_0x238d4a,_0x5ad432))['then'](getEndUser(_0x4fbdbb,_0x238d4a,_0x5ad432))[_0xe363('0x1b')](getTicket(_0x4fbdbb,_0x238d4a,_0x5ad432,_0x2a31fb,_0x1a6c70))[_0xe363('0x1b')](function(_0x24ec95){logger[_0xe363('0xf')](util[_0xe363('0x28')](_0xe363('0x51'),_0x24ec95[_0xe363('0x3b')]));if(_0x4fbdbb!==_0xe363('0x47')){logger[_0xe363('0xf')]('['+[_0x4fbdbb[_0xe363('0x19')]()]+']',_0xe363('0x52'));emit(_0x5ad432,_0x4bdb73[_0xe363('0x53')],_0x24ec95[_0xe363('0x2f')]);}})['catch'](function(_0x1cbad3){logger[_0xe363('0x18')]('['+[_0x4fbdbb[_0xe363('0x19')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xe363('0x54')](_0x1cbad3,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8e0f=['POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','moment','bluebird','ioredis','../../../../config/environment','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','toUpperCase','message','Getting\x20user\x20with\x20email','userEmail','agentEmail','email','userId','Admin\x20selected','error','/api/lookup?q=','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','catch'];(function(_0x1ceb5c,_0x33ed0b){var _0x6240ed=function(_0x25d506){while(--_0x25d506){_0x1ceb5c['push'](_0x1ceb5c['shift']());}};_0x6240ed(++_0x33ed0b);}(_0x8e0f,0x12f));var _0xf8e0=function(_0x3f9fad,_0x5c0f30){_0x3f9fad=_0x3f9fad-0x0;var _0x2d17b7=_0x8e0f[_0x3f9fad];return _0x2d17b7;};'use strict';var _=require(_0xf8e0('0x0'));var rp=require(_0xf8e0('0x1'));var md5=require(_0xf8e0('0x2'));var util=require(_0xf8e0('0x3'));var moment=require(_0xf8e0('0x4'));var Promise=require(_0xf8e0('0x5'));var Redis=require(_0xf8e0('0x6'));var intUtil=require('./util');var config=require(_0xf8e0('0x7'));var logger=require('../../../../config/logger')(_0xf8e0('0x8'));config[_0xf8e0('0x9')]=_['defaults'](config[_0xf8e0('0x9')],{'host':_0xf8e0('0xa'),'port':0x18eb});var io=require(_0xf8e0('0xb'))(new Redis(config[_0xf8e0('0x9')]));function getAdminId(_0x518aec,_0x12a7b5,_0x10f0eb,_0x5c644c){return new Promise(function(_0x51677a,_0x30ca95){var _0x17e783=![];var _0x9df814={'method':_0xf8e0('0xc'),'uri':_0x5c644c+_0xf8e0('0xd'),'json':!![]};_0x9df814[_0xf8e0('0xe')]=_0x10f0eb;logger[_0xf8e0('0xf')](_0xf8e0('0x10'));return rp(_0x9df814)[_0xf8e0('0x11')](function(_0x5649f6){if(_0x5649f6){var _0x1272ff=_0x5649f6[_0xf8e0('0x12')];var _0x3edb60=null;for(_0x3edb60=0x0;_0x3edb60<_0x1272ff[_0xf8e0('0x13')];_0x3edb60++){if(_0x1272ff[_0x3edb60]['email']===_0x518aec[_0xf8e0('0x14')]){_0x518aec['adminId']=_0x1272ff[_0x3edb60]['id'];_0x17e783=!![];}}if(_0x17e783){logger[_0xf8e0('0xf')](_0xf8e0('0x15'),_0x518aec[_0xf8e0('0x16')]);_0x51677a(_0x518aec);}else{_0x30ca95({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x30ca95({'statusCode':0x194,'message':_0xf8e0('0x17')});}})['catch'](function(_0x151990){logger['error']('['+[_0x12a7b5[_0xf8e0('0x18')]()]+']',_0x151990[_0xf8e0('0x19')]);_0x30ca95(_0x151990);});});}function getUser(_0x3a5140,_0x32715f,_0x26a459){return function(_0x49e649){return new Promise(function(_0x616054,_0x54ee7c){var _0x410c3c={'method':_0xf8e0('0xc'),'uri':_0x26a459+_0xf8e0('0xd'),'json':!![]};_0x410c3c[_0xf8e0('0xe')]=_0x32715f;logger['info']('Getting\x20user\x20list');return rp(_0x410c3c)[_0xf8e0('0x11')](function(_0x2711e2){if(_0x2711e2){var _0x46f109=_0x2711e2[_0xf8e0('0x12')];var _0x5e5ad6=![];var _0x21831e=null;if(_0x49e649['agentEmail']!==null){logger[_0xf8e0('0xf')](_0xf8e0('0x1a'),_0x49e649['agentEmail']);_0x49e649[_0xf8e0('0x1b')]=_0x49e649[_0xf8e0('0x1c')];for(_0x21831e=0x0;_0x21831e<_0x46f109[_0xf8e0('0x13')];_0x21831e++){if(_0x46f109[_0x21831e][_0xf8e0('0x1d')]===_0x49e649['agentEmail']){_0x5e5ad6=!![];_0x49e649[_0xf8e0('0x1e')]=_0x46f109[_0x21831e]['id'];logger[_0xf8e0('0xf')]('User\x20found:',_0x49e649['userId']);}}}if(!_0x5e5ad6){logger['info'](_0xf8e0('0x1f'));_0x49e649[_0xf8e0('0x1b')]=_0x49e649[_0xf8e0('0x14')];_0x49e649[_0xf8e0('0x1e')]=_0x49e649[_0xf8e0('0x16')];_0x5e5ad6=!![];}if(_0x5e5ad6){_0x616054(_0x49e649);}else{_0x54ee7c({'statusCode':0x194,'message':_0xf8e0('0x17')});}}else{_0x54ee7c({'statusCode':0x194,'message':_0xf8e0('0x17')});}})['catch'](function(_0x26494f){logger[_0xf8e0('0x20')]('['+[_0x3a5140['toUpperCase']()]+']',_0x26494f[_0xf8e0('0x19')]);_0x54ee7c(_0x26494f);});});};}function searchContact(_0x17436a,_0x37bacd,_0x257362,_0x585d58){return new Promise(function(_0x318ca5,_0x517f2f){var _0x4ec8df={'method':_0xf8e0('0xc'),'headers':_0x37bacd,'uri':_0x17436a+_0xf8e0('0x21')+_0x585d58+_0xf8e0('0x22')+_0x257362+_0xf8e0('0x23'),'json':!![]};rp(_0x4ec8df)[_0xf8e0('0x11')](function(_0x33177d){var _0x2af277=_[_0xf8e0('0x24')](_0x33177d[_0xf8e0('0x25')][_0xf8e0('0x25')],[_0x257362,_0x585d58]);_0x318ca5(_0x2af277);})['catch'](function(_0x373cea){_0x517f2f(_0x373cea);});});}function getEndUser(_0x36c35d,_0x4328c5,_0x5cd9ef){return function(_0x6e73ac){return new Promise(function(_0x5364ab,_0x14ed80){logger[_0xf8e0('0xf')](util['format'](_0xf8e0('0x26'),_0x6e73ac[_0xf8e0('0x27')]));searchContact(_0x5cd9ef,_0x4328c5,'mobile_number',_0x6e73ac[_0xf8e0('0x27')])[_0xf8e0('0x11')](function(_0x5661b3){if(_0x5661b3){_0x6e73ac[_0xf8e0('0x28')]=_0x5661b3['id'];logger['info'](_0xf8e0('0x29'),_0x6e73ac['endUserId']);return _0x5364ab(_0x6e73ac);}searchContact(_0x5cd9ef,_0x4328c5,'work_number',_0x6e73ac[_0xf8e0('0x27')])[_0xf8e0('0x11')](function(_0x2a7ed2){if(_0x2a7ed2){_0x6e73ac[_0xf8e0('0x28')]=_0x2a7ed2['id'];logger[_0xf8e0('0xf')](_0xf8e0('0x2a'),_0x6e73ac[_0xf8e0('0x28')]);return _0x5364ab(_0x6e73ac);}createEndUser(_0x6e73ac,_0x36c35d,_0x4328c5,_0x5cd9ef)[_0xf8e0('0x11')](function(_0x1b338c){logger[_0xf8e0('0xf')](_0xf8e0('0x2b'),_0x1b338c[_0xf8e0('0x28')]);return _0x5364ab(_0x1b338c);});});})[_0xf8e0('0x2c')](function(_0x5431dc){_0x14ed80(_0x5431dc);});});};}function createEndUser(_0x2266b0,_0x2270ef,_0x531da7,_0x4b900e){return new Promise(function(_0x3fea0b,_0x4c9280){var _0x4ada71=moment();var _0x42f1ed={'method':_0xf8e0('0x2d'),'uri':_0x4b900e+_0xf8e0('0x2e'),'body':{'contact':{'last_name':_0x2266b0[_0xf8e0('0x27')],'work_number':_0x2266b0['contactNumber'],'mobile_number':_0x2266b0[_0xf8e0('0x27')],'owner_id':_0x2266b0[_0xf8e0('0x1e')],'created_at':_0x4ada71[_0xf8e0('0x2f')](_0xf8e0('0x30'))}},'json':!![]};_0x42f1ed[_0xf8e0('0xe')]=_0x531da7;logger['info'](_0xf8e0('0x31'));return rp(_0x42f1ed)[_0xf8e0('0x11')](function(_0x8b9478){_0x2266b0[_0xf8e0('0x28')]=_0x8b9478[_0xf8e0('0x32')]['id'];_0x3fea0b(_0x2266b0);})[_0xf8e0('0x2c')](function(_0x749915){logger[_0xf8e0('0x20')]('['+[_0x2270ef[_0xf8e0('0x18')]()]+']',_0x749915[_0xf8e0('0x19')]);_0x4c9280(_0x749915[_0xf8e0('0x19')]);});});}function getTicket(_0x4cfc38,_0x4a32b6,_0x2c3505,_0x404149,_0x3a190e){return function(_0x4e1e2f){logger[_0xf8e0('0xf')]('Creating\x20new\x20task');return new Promise(function(_0x56c379,_0x3e8280){var _0x24aac7=moment();var _0x72f05d={'method':_0xf8e0('0x2d'),'uri':_0x2c3505+_0xf8e0('0x33'),'body':{'title':intUtil[_0xf8e0('0x34')](_0x404149[_0xf8e0('0x35')],_0x3a190e,'\x20'),'description':intUtil[_0xf8e0('0x34')](_0x404149[_0xf8e0('0x36')],_0x3a190e,'\x0a'),'owner_id':_0x4e1e2f[_0xf8e0('0x1e')],'creater_id':_0x4e1e2f[_0xf8e0('0x16')],'targetable_id':_0x4e1e2f[_0xf8e0('0x28')],'targetable_type':_0xf8e0('0x37'),'created_at':_0x24aac7[_0xf8e0('0x2f')](_0xf8e0('0x30')),'due_date':_0x24aac7[_0xf8e0('0x38')](0x1e,'m')[_0xf8e0('0x2f')](_0xf8e0('0x30'))},'json':!![]};_0x72f05d[_0xf8e0('0xe')]=_0x4a32b6;return rp(_0x72f05d)[_0xf8e0('0x11')](function(_0x19e979){_0x4e1e2f[_0xf8e0('0x39')]=_0x19e979[_0xf8e0('0x3a')]['id'];logger[_0xf8e0('0xf')](_0xf8e0('0x3b'),_0x4e1e2f['ticketId']);_0x56c379(_0x4e1e2f);})[_0xf8e0('0x2c')](function(_0x4dc2b8){logger[_0xf8e0('0x20')]('['+[_0x4cfc38[_0xf8e0('0x18')]()]+']',_0x4dc2b8[_0xf8e0('0x19')]);_0x3e8280(_0x4dc2b8[_0xf8e0('0x19')]);});});};}function emit(_0x320d3f,_0x2f2a24,_0x4790f7){var _0x44b9e0={'uri':_0x320d3f+_0xf8e0('0x3c')+_0x4790f7};io['to'](util[_0xf8e0('0x2f')](_0xf8e0('0x3d'),_0x2f2a24))[_0xf8e0('0x3e')](_0xf8e0('0x3f'),_0x44b9e0);}exports['cs']=function(_0x49cc39,_0x3f3a8a,_0x37ff90,_0x4bbdc0,_0x11e049,_0x2d6b59,_0x222f72,_0x1e4767){var _0x24a838={};var _0x1a1ae5={'Authorization':_0xf8e0('0x40')+_0x2d6b59[_0xf8e0('0x41')]};_0x2d6b59['remoteUri']=intUtil['stripTrailingSlash'](_0x2d6b59[_0xf8e0('0x42')]);_0x2d6b59['serverUrl']=intUtil[_0xf8e0('0x43')](_0x2d6b59[_0xf8e0('0x44')]);var _0x143a81=_0x2d6b59[_0xf8e0('0x42')];_0x24a838['adminEmail']=_0x2d6b59[_0xf8e0('0x45')];_0x24a838[_0xf8e0('0x27')]=_0x1e4767[_0xf8e0('0x46')]()===_0xf8e0('0x47')?_0x3f3a8a['destcalleridnum']:_0x3f3a8a[_0xf8e0('0x48')];_0x24a838[_0xf8e0('0x49')]=_0x1e4767===_0xf8e0('0x4a')||_0x1e4767===_0xf8e0('0x4b')?'queue':_0xf8e0('0x47');if(_0x4bbdc0){_0x24a838[_0xf8e0('0x1c')]=_0x4bbdc0['email'];}var _0x13ea16=util[_0xf8e0('0x2f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2d6b59[_0xf8e0('0x44')],_0x3f3a8a[_0xf8e0('0x4c')],md5(_0x3f3a8a[_0xf8e0('0x4c')]));if(_0x11e049&&_0x11e049[_0xf8e0('0x4d')]){logger[_0xf8e0('0xf')](_0xf8e0('0x4e'),_0xf8e0('0x4f'));_0x3f3a8a[_0xf8e0('0x50')]=_0x13ea16;}else if(_0x222f72&&_0x222f72[_0xf8e0('0x51')]&&_0x222f72[_0xf8e0('0x51')]!==_0xf8e0('0x52')){logger[_0xf8e0('0xf')](_0xf8e0('0x53'),_0xf8e0('0x4f'));_0x3f3a8a[_0xf8e0('0x50')]=_0x13ea16;}else{_0x3f3a8a[_0xf8e0('0x50')]='';}return getAdminId(_0x24a838,_0x1e4767,_0x1a1ae5,_0x143a81)[_0xf8e0('0x11')](getUser(_0x1e4767,_0x1a1ae5,_0x143a81))[_0xf8e0('0x11')](getEndUser(_0x1e4767,_0x1a1ae5,_0x143a81))[_0xf8e0('0x11')](getTicket(_0x1e4767,_0x1a1ae5,_0x143a81,_0x37ff90,_0x3f3a8a))['then'](function(_0x124538){logger[_0xf8e0('0xf')](util[_0xf8e0('0x2f')](_0xf8e0('0x54'),_0x124538['ticketId']));if(_0x1e4767!==_0xf8e0('0x4b')){logger[_0xf8e0('0xf')]('['+[_0x1e4767[_0xf8e0('0x18')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x143a81,_0x4bbdc0[_0xf8e0('0x55')],_0x124538[_0xf8e0('0x28')]);}})[_0xf8e0('0x2c')](function(_0x4f0b7c){logger['error']('['+[_0x1e4767['toUpperCase']()]+_0xf8e0('0x56'),util['inspect'](_0x4f0b7c,{'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 5c69557..dc66b64 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 _0x6e6c=['dynamics365','log','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./salesforce','./sugarcrm','./desk','./servicenow','./freshsales','zendesk','sugarcrm','freshdesk','desk','vtiger','freshsales','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','zoho','servicenow'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0xc6e6('0x2'));var sugarcrm=require(_0xc6e6('0x3'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require(_0xc6e6('0x4'));var vtiger=require('./vtiger');var servicenow=require(_0xc6e6('0x5'));var dynamics365=require('./dynamics365');var freshsales=require(_0xc6e6('0x6'));var integrations=[_0xc6e6('0x7'),'salesforce',_0xc6e6('0x8'),_0xc6e6('0x9'),'zoho',_0xc6e6('0xa'),_0xc6e6('0xb'),'dynamics365',_0xc6e6('0xc'),'servicenow'];exports[_0xc6e6('0xd')]=function(_0x3b2f50,_0x29f78a,_0x3ddf6f,_0x12596b,_0xbf9ffc,_0x1f9ed3){if(_0x3ddf6f){if(_[_0xc6e6('0xe')](integrations,_0x3b2f50[_0xc6e6('0xf')]['toLowerCase']())){try{var _0x3ac3a5=null;var _0x525d60='';var _0x3a30ce=_0x3ddf6f[_0x3b2f50[_0xc6e6('0xf')][_0xc6e6('0x10')]()];if(_0x3a30ce){var _0x13c8d5=_0x3a30ce[_0x3b2f50['data2']];if(_0x13c8d5){var _0x149ac6=_[_0xc6e6('0x11')](_0x13c8d5[_0xc6e6('0x12')],{'id':parseInt(_0x3b2f50[_0xc6e6('0x13')],0xa)});if(_0x149ac6){if(_0x12596b){if(_0xbf9ffc&&_0x29f78a[_0xc6e6('0x14')]){_0x525d60='queue';}else if(_0x29f78a[_0xc6e6('0x15')]){_0x525d60=_0xc6e6('0x16');}else{console['log'](_0xc6e6('0x17'),_0x29f78a);}}else{_0x525d60=_0xc6e6('0x18');}switch(_0x3b2f50[_0xc6e6('0xf')]['toLowerCase']()){case'zendesk':zendesk[_0x525d60](_0x3b2f50,_0x29f78a,_0x149ac6,_0x12596b,_0xbf9ffc,_0x13c8d5,_0x1f9ed3);break;case'salesforce':salesforce[_0x525d60](_0x3b2f50,_0x29f78a,_0x149ac6,_0x12596b,_0xbf9ffc,_0x13c8d5,_0x1f9ed3);break;case _0xc6e6('0x8'):sugarcrm[_0x525d60](_0x3b2f50,_0x29f78a,_0x149ac6,_0x12596b,_0xbf9ffc,_0x13c8d5,_0x1f9ed3);break;case'freshdesk':freshdesk[_0x525d60](_0x3b2f50,_0x29f78a,_0x149ac6,_0x12596b,_0xbf9ffc,_0x13c8d5,_0x1f9ed3);break;case _0xc6e6('0x19'):zoho[_0x525d60](_0x3b2f50,_0x29f78a,_0x149ac6,_0x12596b,_0xbf9ffc,_0x13c8d5,_0x1f9ed3);break;case _0xc6e6('0xa'):desk[_0x525d60](_0x3b2f50,_0x29f78a,_0x149ac6,_0x12596b,_0xbf9ffc,_0x13c8d5,_0x1f9ed3);break;case _0xc6e6('0xb'):vtiger[_0x525d60](_0x3b2f50,_0x29f78a,_0x149ac6,_0x12596b,_0xbf9ffc,_0x13c8d5,_0x1f9ed3);break;case _0xc6e6('0xc'):freshsales['cs'](_0x3b2f50,_0x29f78a,_0x149ac6,_0x12596b,_0xbf9ffc,_0x13c8d5,_0x1f9ed3,_0x525d60);break;case _0xc6e6('0x1a'):servicenow['cs'](_0x3b2f50,_0x29f78a,_0x149ac6,_0x12596b,_0xbf9ffc,_0x13c8d5,_0x1f9ed3,_0x525d60);break;case _0xc6e6('0x1b'):dynamics365['cs'](_0x3b2f50,_0x29f78a,_0x149ac6,_0x12596b,_0xbf9ffc,_0x13c8d5,_0x1f9ed3,_0x525d60);break;default:console[_0xc6e6('0x1c')](_0xc6e6('0x1d'));}}else{_0x3ac3a5=require(_0xc6e6('0x1e'))(_0x3b2f50[_0xc6e6('0xf')]['toLowerCase']());_0x3ac3a5[_0xc6e6('0x1f')]('[EXEC]',util[_0xc6e6('0x20')](_0xc6e6('0x21'),_0x3b2f50[_0xc6e6('0xf')][_0xc6e6('0x10')](),_0x3b2f50['data3']));}}else{_0x3ac3a5=require(_0xc6e6('0x1e'))(_0x3b2f50[_0xc6e6('0xf')][_0xc6e6('0x10')]());_0x3ac3a5[_0xc6e6('0x1f')](_0xc6e6('0x22'),util['format'](_0xc6e6('0x23'),_0x3b2f50['data1'][_0xc6e6('0x10')](),_0x3b2f50[_0xc6e6('0x24')]));}}else{}}catch(_0x2e5e0e){console[_0xc6e6('0x1f')](_0x2e5e0e);}}}}; \ No newline at end of file +var _0x1775=['queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','data1','data2','find','Configurations','data3'];(function(_0x25b4a4,_0x2e081b){var _0x707267=function(_0x440123){while(--_0x440123){_0x25b4a4['push'](_0x25b4a4['shift']());}};_0x707267(++_0x2e081b);}(_0x1775,0x1db));var _0x5177=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1775[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var zendesk=require(_0x5177('0x1'));var salesforce=require(_0x5177('0x2'));var sugarcrm=require(_0x5177('0x3'));var freshdesk=require(_0x5177('0x4'));var zoho=require(_0x5177('0x5'));var desk=require(_0x5177('0x6'));var vtiger=require(_0x5177('0x7'));var servicenow=require(_0x5177('0x8'));var dynamics365=require(_0x5177('0x9'));var freshsales=require(_0x5177('0xa'));var integrations=[_0x5177('0xb'),_0x5177('0xc'),_0x5177('0xd'),_0x5177('0xe'),_0x5177('0xf'),_0x5177('0x10'),_0x5177('0x11'),_0x5177('0x12'),_0x5177('0x13'),_0x5177('0x14')];exports[_0x5177('0x15')]=function(_0x5bdca9,_0x4ae3d2,_0x13c7f6,_0x1d7116,_0xf3ce11,_0x227316){if(_0x13c7f6){if(_[_0x5177('0x16')](integrations,_0x5bdca9['data1'][_0x5177('0x17')]())){try{var _0x22fe21=null;var _0xc613b9='';var _0x3c4ced=_0x13c7f6[_0x5bdca9[_0x5177('0x18')][_0x5177('0x17')]()];if(_0x3c4ced){var _0x1ab4f1=_0x3c4ced[_0x5bdca9[_0x5177('0x19')]];if(_0x1ab4f1){var _0x3e6224=_[_0x5177('0x1a')](_0x1ab4f1[_0x5177('0x1b')],{'id':parseInt(_0x5bdca9[_0x5177('0x1c')],0xa)});if(_0x3e6224){if(_0x1d7116){if(_0xf3ce11&&_0x4ae3d2[_0x5177('0x1d')]){_0xc613b9=_0x5177('0x1d');}else if(_0x4ae3d2[_0x5177('0x1e')]){_0xc613b9=_0x5177('0x1f');}else{console[_0x5177('0x20')](_0x5177('0x21'),_0x4ae3d2);}}else{_0xc613b9=_0x5177('0x22');}switch(_0x5bdca9['data1'][_0x5177('0x17')]()){case _0x5177('0xb'):zendesk[_0xc613b9](_0x5bdca9,_0x4ae3d2,_0x3e6224,_0x1d7116,_0xf3ce11,_0x1ab4f1,_0x227316);break;case _0x5177('0xc'):salesforce[_0xc613b9](_0x5bdca9,_0x4ae3d2,_0x3e6224,_0x1d7116,_0xf3ce11,_0x1ab4f1,_0x227316);break;case _0x5177('0xd'):sugarcrm[_0xc613b9](_0x5bdca9,_0x4ae3d2,_0x3e6224,_0x1d7116,_0xf3ce11,_0x1ab4f1,_0x227316);break;case'freshdesk':freshdesk[_0xc613b9](_0x5bdca9,_0x4ae3d2,_0x3e6224,_0x1d7116,_0xf3ce11,_0x1ab4f1,_0x227316);break;case _0x5177('0xf'):zoho[_0xc613b9](_0x5bdca9,_0x4ae3d2,_0x3e6224,_0x1d7116,_0xf3ce11,_0x1ab4f1,_0x227316);break;case _0x5177('0x10'):desk[_0xc613b9](_0x5bdca9,_0x4ae3d2,_0x3e6224,_0x1d7116,_0xf3ce11,_0x1ab4f1,_0x227316);break;case _0x5177('0x11'):vtiger[_0xc613b9](_0x5bdca9,_0x4ae3d2,_0x3e6224,_0x1d7116,_0xf3ce11,_0x1ab4f1,_0x227316);break;case'freshsales':freshsales['cs'](_0x5bdca9,_0x4ae3d2,_0x3e6224,_0x1d7116,_0xf3ce11,_0x1ab4f1,_0x227316,_0xc613b9);break;case _0x5177('0x14'):servicenow['cs'](_0x5bdca9,_0x4ae3d2,_0x3e6224,_0x1d7116,_0xf3ce11,_0x1ab4f1,_0x227316,_0xc613b9);break;case'dynamics365':dynamics365['cs'](_0x5bdca9,_0x4ae3d2,_0x3e6224,_0x1d7116,_0xf3ce11,_0x1ab4f1,_0x227316,_0xc613b9);break;default:console[_0x5177('0x20')](_0x5177('0x23'));}}else{_0x22fe21=require(_0x5177('0x24'))(_0x5bdca9[_0x5177('0x18')][_0x5177('0x17')]());_0x22fe21[_0x5177('0x25')](_0x5177('0x26'),util[_0x5177('0x27')](_0x5177('0x28'),_0x5bdca9[_0x5177('0x18')][_0x5177('0x17')](),_0x5bdca9[_0x5177('0x1c')]));}}else{_0x22fe21=require('../../../../config/logger')(_0x5bdca9[_0x5177('0x18')]['toLowerCase']());_0x22fe21[_0x5177('0x25')](_0x5177('0x26'),util[_0x5177('0x27')](_0x5177('0x29'),_0x5bdca9['data1'][_0x5177('0x17')](),_0x5bdca9['data2']));}}else{}}catch(_0x564139){console[_0x5177('0x25')](_0x564139);}}}}; \ 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 cf25896..4a15726 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 _0x9afd=['Contact','Lead','lead','contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','No\x20Company','upperFirst','create','forEach','idField','content','toString','type','variable','variableName','customVariable','Variable','toLowerCase','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','error','catch','stringify','recordingFormat','none','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','moment','md5','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','Task','assign','getString','Subjects','Descriptions','WhoId','ticketType','Case','sobject','isNil','validateEmail','User','execute','then','length','find','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead'];(function(_0x48b819,_0x5159df){var _0x16b470=function(_0x46083e){while(--_0x46083e){_0x48b819['push'](_0x48b819['shift']());}};_0x16b470(++_0x5159df);}(_0x9afd,0x1f1));var _0xd9af=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0x9afd[_0x351509];return _0x4e9861;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0xd9af('0x0'));var BPromise=require('bluebird');var md5=require(_0xd9af('0x1'));var jsforce=require('jsforce');var util=require(_0xd9af('0x2'));var Redis=require(_0xd9af('0x3'));var intUtil=require('./util');var config=require(_0xd9af('0x4'));var logger=require(_0xd9af('0x5'))('salesforce');config[_0xd9af('0x6')]=_[_0xd9af('0x7')](config['redis'],{'host':_0xd9af('0x8'),'port':0x18eb});var io=require(_0xd9af('0x9'))(new Redis(config[_0xd9af('0x6')]));function emit(_0x18cf46,_0x46b3de,_0x21a7c6){io['to'](_0x18cf46)['emit'](_0x46b3de,_0x21a7c6);}function getTicket(_0x225a6e,_0x200d98,_0x420d62,_0x4b5579,_0x3c2749,_0xcc66b7,_0x4b8d85,_0x94b89c){var _0x51cfaf={};if(_0x4b5579['ticketType']===_0xd9af('0xa')){_0x51cfaf=Object[_0xd9af('0xb')]({},{'OwnerId':_0x200d98['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xd9af('0xc')](_0x4b5579[_0xd9af('0xd')],_0x3c2749,'\x20'),'Description':intUtil['getString'](_0x4b5579[_0xd9af('0xe')],_0x3c2749,'\x0a')},getCustomFields(_0xcc66b7,_0x3c2749));if(_0x420d62){_0x51cfaf[_0xd9af('0xf')]=_0x420d62['id'];}}else if(_0x4b5579[_0xd9af('0x10')]===_0xd9af('0x11')){_0x51cfaf=Object['assign']({},{'OwnerId':_0x200d98['id'],'Subject':intUtil[_0xd9af('0xc')](_0x4b5579[_0xd9af('0xd')],_0x3c2749,'\x20'),'Description':intUtil[_0xd9af('0xc')](_0x4b5579[_0xd9af('0xe')],_0x3c2749,'\x0a')},getCustomFields(_0xcc66b7,_0x3c2749));if(_0x420d62){_0x51cfaf['ContactId']=_0x420d62['id'];}}return _0x4b8d85[_0xd9af('0x12')](_0x4b5579['ticketType'])['create'](_0x51cfaf);}function getUser(_0x1dc368,_0xeac7e9,_0x27c00f){if(!_[_0xd9af('0x13')](_0xeac7e9)&&intUtil[_0xd9af('0x14')](_0xeac7e9)){var _0x45e794={'Email':_0xeac7e9};var _0x75cfd7={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x27c00f['sobject'](_0xd9af('0x15'))['find'](_0x45e794,_0x75cfd7)[_0xd9af('0x16')]()[_0xd9af('0x17')](function(_0x10a1d4){if(_0x10a1d4[_0xd9af('0x18')]){var _0x6e24e6=_[_0xd9af('0x19')](_0x10a1d4,function(_0x3050de){return _0x3050de[_0xd9af('0x1a')]===_0xeac7e9;});if(_0x6e24e6){logger[_0xd9af('0x1b')](_0xd9af('0x1c'),_0xeac7e9);return BPromise[_0xd9af('0x1d')]({'id':_0x6e24e6['Id'],'name':_0x6e24e6[_0xd9af('0x1e')]});}}else{logger[_0xd9af('0x1b')](_0xd9af('0x1f'),_0xeac7e9);return _0x27c00f[_0xd9af('0x20')]()['then'](function(_0x34b331){return BPromise[_0xd9af('0x1d')]({'id':_0x34b331[_0xd9af('0x21')],'name':_0x34b331[_0xd9af('0x22')]});});}});}else{logger[_0xd9af('0x1b')](_0xd9af('0x1f'),_0xeac7e9);return _0x27c00f[_0xd9af('0x20')]()['then'](function(_0x39da72){return BPromise[_0xd9af('0x1d')]({'id':_0x39da72[_0xd9af('0x21')],'name':_0x39da72[_0xd9af('0x22')]});});}}function getEndUser(_0x3bd929,_0x3bae3f,_0x4ea167,_0x257ebf,_0x1fe17e){var _0x390e2={'Phone':_0x257ebf};var _0x524e89={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xd9af('0x1d')]()[_0xd9af('0x17')](function(){if(_0x3bae3f[_0xd9af('0x10')]===_0xd9af('0xa')){logger['info'](_0xd9af('0x23'),_0x257ebf,_0x3bae3f[_0xd9af('0x24')]);switch(_0x3bae3f[_0xd9af('0x24')]){case _0xd9af('0x25'):return _0x1fe17e[_0xd9af('0x12')](_0xd9af('0x26'))['find'](_0x390e2,_0x524e89)[_0xd9af('0x16')]()[_0xd9af('0x17')](function(_0x14ba3a){if(_0x14ba3a&&_0x14ba3a[_0xd9af('0x18')]){return _0x14ba3a;}else{return _0x1fe17e['sobject'](_0xd9af('0x27'))[_0xd9af('0x19')](_0x390e2,_0x524e89);}});case'contact':return _0x1fe17e[_0xd9af('0x12')](_0xd9af('0x26'))[_0xd9af('0x19')](_0x390e2,_0x524e89)[_0xd9af('0x16')]();case _0xd9af('0x28'):return _0x1fe17e[_0xd9af('0x12')](_0xd9af('0x27'))[_0xd9af('0x19')](_0x390e2,_0x524e89);default:return null;}}else if(_0x3bae3f['ticketType']==='Case'){logger[_0xd9af('0x1b')](_0xd9af('0x23'),_0x257ebf,_0xd9af('0x29'));return _0x1fe17e[_0xd9af('0x12')](_0xd9af('0x26'))['find'](_0x390e2,_0x524e89)[_0xd9af('0x16')]();}})[_0xd9af('0x17')](function(_0x11a233){if(_0x11a233&&_0x11a233[_0xd9af('0x18')]){var _0x2354b4=_[_0xd9af('0x19')](_0x11a233,function(_0x2cd477){return _0x2cd477[_0xd9af('0x2a')]===_0x257ebf;});if(_0x2354b4){return BPromise[_0xd9af('0x1d')]({'id':_0x2354b4['Id'],'name':_0x2354b4[_0xd9af('0x1e')],'phone':_0x2354b4[_0xd9af('0x2a')]});}}})[_0xd9af('0x17')](function(_0x30357d){if(_0x30357d){logger[_0xd9af('0x1b')](_0xd9af('0x2b'),_0x257ebf);return BPromise[_0xd9af('0x1d')](_0x30357d);}else{logger[_0xd9af('0x1b')](_0xd9af('0x2c'),_0x257ebf);var _0x52d011={'LastName':_0x4ea167!==_0xd9af('0x2d')?_0x4ea167:util[_0xd9af('0x2e')](_0xd9af('0x2f'),_0x257ebf),'Phone':_0x257ebf};if(_0x3bae3f[_0xd9af('0x30')]){if(_0x3bae3f[_0xd9af('0x30')]===_0xd9af('0x29')){logger[_0xd9af('0x1b')](_0xd9af('0x31'),_0x257ebf,_0x3bae3f[_0xd9af('0x30')]);}else if(_0x3bae3f[_0xd9af('0x30')]===_0xd9af('0x28')&&_0x3bae3f[_0xd9af('0x10')]===_0xd9af('0xa')){logger[_0xd9af('0x1b')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x257ebf,_0x3bae3f[_0xd9af('0x30')]);_0x52d011['Company']=_0xd9af('0x32');}else{return null;}}return _0x1fe17e[_0xd9af('0x12')](_[_0xd9af('0x33')](_0x3bae3f[_0xd9af('0x30')]))[_0xd9af('0x34')](_0x52d011);}});}function getCustomFields(_0x2b9da4,_0x410aa9){var _0x3077bc={};if(_0x2b9da4[_0xd9af('0x18')]>0x0){_[_0xd9af('0x35')](_0x2b9da4,function(_0x20a7d8){if(_0x20a7d8['type']==='string'&&_0x20a7d8[_0xd9af('0x36')]){_0x3077bc[_0x20a7d8['idField']]=_0x20a7d8[_0xd9af('0x37')][_0xd9af('0x38')]();}else if(_0x20a7d8[_0xd9af('0x39')]===_0xd9af('0x3a')&&_0x20a7d8['variableName']&&_0x20a7d8[_0xd9af('0x36')]){_0x410aa9[_0x20a7d8['variableName']]&&(_0x3077bc[_0x20a7d8[_0xd9af('0x36')]]=_0x410aa9[_0x20a7d8[_0xd9af('0x3b')]][_0xd9af('0x38')]());}else if(_0x20a7d8[_0xd9af('0x39')]===_0xd9af('0x3c')&&_0x20a7d8[_0xd9af('0x3d')]&&_0x20a7d8[_0xd9af('0x3d')]['name']&&_0x20a7d8['idField']){_0x410aa9[_0x20a7d8['Variable']['name'][_0xd9af('0x3e')]()]&&(_0x3077bc[_0x20a7d8[_0xd9af('0x36')]]=_0x410aa9[_0x20a7d8['Variable'][_0xd9af('0x3f')]['toLowerCase']()][_0xd9af('0x38')]());}});}return _0x3077bc;}function getConnection(_0x141c2e){var _0xd33eed=_0x141c2e[_0xd9af('0x40')][_0xd9af('0x41')](_0x141c2e[_0xd9af('0x42')]);var _0x1c574e=new jsforce['Connection']({'oauth2':{'loginUrl':_0x141c2e[_0xd9af('0x43')]||_0xd9af('0x44'),'clientId':_0x141c2e['clientId'],'clientSecret':_0x141c2e[_0xd9af('0x45')]}});return _0x1c574e[_0xd9af('0x46')](_0x141c2e[_0xd9af('0x47')],_0xd33eed)[_0xd9af('0x17')](function(){logger[_0xd9af('0x1b')]('Connection\x20established.');return _0x1c574e;});}exports[_0xd9af('0x48')]=function(_0x6f3000,_0x18fa26,_0x5de11a,_0x361687,_0x21c8ae,_0x445eca){var _0x21997e,_0x3392a1,_0x7a872e,_0x910a67;_0x445eca[_0xd9af('0x49')]=intUtil['stripTrailingSlash'](_0x445eca[_0xd9af('0x49')]);_0x445eca[_0xd9af('0x43')]=intUtil[_0xd9af('0x4a')](_0x445eca['remoteUri']);if(_0x21c8ae&&_0x21c8ae[_0xd9af('0x4b')]){logger[_0xd9af('0x1b')](_0xd9af('0x4c'),_0xd9af('0x4d'));_0x18fa26[_0xd9af('0x4e')]=util[_0xd9af('0x2e')](_0xd9af('0x4f'),_0x445eca[_0xd9af('0x49')],_0x18fa26[_0xd9af('0x50')],md5(_0x18fa26[_0xd9af('0x50')]));}else{_0x18fa26['recordingURL']='';}return getConnection(_0x445eca)[_0xd9af('0x17')](function(_0xcb588d){_0x910a67=_0xcb588d;return getUser(_0x445eca,_0x361687[_0xd9af('0x51')],_0x910a67);})[_0xd9af('0x17')](function(_0x14856e){_0x21997e=_0x14856e;return getEndUser(_0x445eca,_0x5de11a,_0x18fa26[_0xd9af('0x52')],_0x18fa26[_0xd9af('0x53')],_0x910a67);})['then'](function(_0x3aff8b){_0x3392a1=_0x3aff8b;return getTicket(_0x445eca,_0x21997e,_0x3392a1,_0x5de11a,_0x18fa26,_0x5de11a[_0xd9af('0x54')],_0x910a67,_0xd9af('0x48'));})[_0xd9af('0x17')](function(_0x5c35a7){_0x7a872e=_0x5c35a7;logger[_0xd9af('0x1b')](_0xd9af('0x55'),_0x7a872e['id']);logger['info'](_0xd9af('0x56'),_0x7a872e['id'],_0x361687[_0xd9af('0x3f')],_0x445eca[_0xd9af('0x39')]);switch(_0x445eca[_0xd9af('0x39')]){case _0xd9af('0x57'):emit(util[_0xd9af('0x2e')](_0xd9af('0x58'),_0x361687['name']),_0xd9af('0x59'),{'recordId':_0x7a872e['id']});break;case _0xd9af('0x5a'):emit(util[_0xd9af('0x2e')](_0xd9af('0x58'),_0x361687['name']),'trigger:browser:url',{'uri':util[_0xd9af('0x2e')](_0xd9af('0x5b'),_0x910a67['instanceUrl'],_0x7a872e['id'])});break;default:logger[_0xd9af('0x5c')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xd9af('0x5d')](function(_0x2a337b){logger[_0xd9af('0x5c')](_0xd9af('0x4c'),JSON[_0xd9af('0x5e')](_0x2a337b));});};exports['outbound']=function(_0x5defa9,_0x13394f,_0x50cf88,_0x31d50d,_0x51d2d6,_0x564448,_0x580172){var _0x1483fb,_0x5ecd2b,_0x4d4cde,_0x1ac958;_0x564448['serverUrl']=intUtil[_0xd9af('0x4a')](_0x564448[_0xd9af('0x49')]);_0x564448[_0xd9af('0x43')]=intUtil['stripTrailingSlash'](_0x564448[_0xd9af('0x43')]);if(_0x580172&&_0x580172['recordingFormat']&&_0x580172[_0xd9af('0x5f')]!==_0xd9af('0x60')){logger['info']('[OUTBOUND]',_0xd9af('0x4d'));_0x13394f['recordingURL']=util[_0xd9af('0x2e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x564448[_0xd9af('0x49')],_0x13394f['uniqueid'],md5(_0x13394f[_0xd9af('0x50')]));}return getConnection(_0x564448)[_0xd9af('0x17')](function(_0x29a8d9){_0x1ac958=_0x29a8d9;return getUser(_0x564448,_0x31d50d[_0xd9af('0x51')],_0x1ac958);})['then'](function(_0x4f4f39){_0x1483fb=_0x4f4f39;return getEndUser(_0x564448,_0x50cf88,_0x13394f[_0xd9af('0x61')],_0x13394f[_0xd9af('0x62')],_0x1ac958);})[_0xd9af('0x17')](function(_0x3052c3){_0x5ecd2b=_0x3052c3;return getTicket(_0x564448,_0x1483fb,_0x5ecd2b,_0x50cf88,_0x13394f,_0x50cf88['Fields'],_0x1ac958,_0xd9af('0x63'));})[_0xd9af('0x17')](function(_0x4945c0){_0x4d4cde=_0x4945c0;logger['info'](_0xd9af('0x64'),_0x4d4cde['id']);logger[_0xd9af('0x1b')](_0xd9af('0x65'),_0x4d4cde['id'],_0x31d50d[_0xd9af('0x3f')],_0x564448['type']);switch(_0x564448[_0xd9af('0x39')]){case _0xd9af('0x57'):emit(util[_0xd9af('0x2e')](_0xd9af('0x58'),_0x31d50d[_0xd9af('0x3f')]),'trigger:salesforce:display',{'recordId':_0x4d4cde['id']});break;case _0xd9af('0x5a'):emit(util[_0xd9af('0x2e')]('user:%s',_0x31d50d[_0xd9af('0x3f')]),'trigger:browser:url',{'uri':util[_0xd9af('0x2e')](_0xd9af('0x5b'),_0x1ac958['instanceUrl'],_0x4d4cde['id'])});break;default:logger[_0xd9af('0x5c')](_0xd9af('0x66'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xd9af('0x5d')](function(_0x39436a){logger[_0xd9af('0x5c')]('[OUTBOUND]',JSON['stringify'](_0x39436a));});};exports[_0xd9af('0x67')]=function(_0x44bf33,_0x2c6643,_0x52e4ab,_0x197241,_0x305c93,_0x515ef1){var _0x9370fa,_0x120353,_0x37d7b0,_0x304862;_0x515ef1['serverUrl']=intUtil[_0xd9af('0x4a')](_0x515ef1[_0xd9af('0x49')]);_0x515ef1[_0xd9af('0x43')]=intUtil['stripTrailingSlash'](_0x515ef1[_0xd9af('0x43')]);if(_0x305c93&&_0x305c93['monitor_format']){logger[_0xd9af('0x1b')]('['+_0x2c6643[_0xd9af('0x68')][_0xd9af('0x69')]()+']',_0xd9af('0x4d'));_0x2c6643[_0xd9af('0x4e')]=util[_0xd9af('0x2e')](_0xd9af('0x4f'),_0x515ef1[_0xd9af('0x49')],_0x2c6643[_0xd9af('0x50')],md5(_0x2c6643[_0xd9af('0x50')]));}else{_0x2c6643['recordingURL']='';}return getConnection(_0x515ef1)[_0xd9af('0x17')](function(_0x1fe7de){_0x304862=_0x1fe7de;if(!_[_0xd9af('0x13')](_0x197241)){return getUser(_0x515ef1,_0x197241[_0xd9af('0x3f')],_0x304862);}else{return getUser(_0x515ef1,null,_0x304862);}})[_0xd9af('0x17')](function(_0x1b3440){_0x9370fa=_0x1b3440;return getEndUser(_0x515ef1,_0x52e4ab,_0x2c6643[_0xd9af('0x52')],_0x2c6643['calleridnum'],_0x304862);})[_0xd9af('0x17')](function(_0x137d8a){_0x120353=_0x137d8a;return getTicket(_0x515ef1,_0x9370fa,_0x120353,_0x52e4ab,_0x2c6643,_0x52e4ab['Fields'],_0x304862);})['then'](function(_0x236912){_0x37d7b0=_0x236912;logger[_0xd9af('0x1b')]('['+_0x2c6643['lastevent'][_0xd9af('0x69')]()+_0xd9af('0x6a'),_0x37d7b0['id']);logger[_0xd9af('0x1b')]('['+_0x2c6643['lastevent'][_0xd9af('0x69')]()+']\x20Integration\x20account\x20type\x20%s.',_0x515ef1[_0xd9af('0x39')]);})[_0xd9af('0x5d')](function(_0x39f399){logger[_0xd9af('0x5c')]('['+_0x2c6643[_0xd9af('0x68')]['toUpperCase']()+']',JSON[_0xd9af('0x5e')](_0x39f399));});}; \ No newline at end of file +var _0x7b4a=['uniqueid','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','toUpperCase','recordingURL','lastevent',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','./util','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','emit','ticketType','Task','assign','utc','getString','Subjects','Descriptions','WhoId','Case','ContactId','create','isNil','validateEmail','User','find','execute','then','length','Email','info','resolve','Name','identity','user_id','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','sobject','Contact','Lead','contact','lead','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','forEach','type','string','idField','content','variable','variableName','Variable','name','toLowerCase','toString','password','concat','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!'];(function(_0x16de68,_0x33d7ff){var _0x1c277e=function(_0x1d8549){while(--_0x1d8549){_0x16de68['push'](_0x16de68['shift']());}};_0x1c277e(++_0x33d7ff);}(_0x7b4a,0x7b));var _0xa7b4=function(_0x46afa4,_0x55f3e6){_0x46afa4=_0x46afa4-0x0;var _0x4430de=_0x7b4a[_0x46afa4];return _0x4430de;};'use strict';var _=require(_0xa7b4('0x0'));var rp=require(_0xa7b4('0x1'));var moment=require(_0xa7b4('0x2'));var BPromise=require(_0xa7b4('0x3'));var md5=require(_0xa7b4('0x4'));var jsforce=require(_0xa7b4('0x5'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa7b4('0x6'));var config=require(_0xa7b4('0x7'));var logger=require('../../../../config/logger')(_0xa7b4('0x8'));config[_0xa7b4('0x9')]=_[_0xa7b4('0xa')](config[_0xa7b4('0x9')],{'host':_0xa7b4('0xb'),'port':0x18eb});var io=require(_0xa7b4('0xc'))(new Redis(config['redis']));function emit(_0x4cef27,_0x50f8a3,_0x4cda46){io['to'](_0x4cef27)[_0xa7b4('0xd')](_0x50f8a3,_0x4cda46);}function getTicket(_0xead04e,_0xa89955,_0x25f613,_0x1a7f49,_0x41e855,_0xc4fbfd,_0x874b2c,_0x58052b){var _0x53977e={};if(_0x1a7f49[_0xa7b4('0xe')]===_0xa7b4('0xf')){_0x53977e=Object[_0xa7b4('0x10')]({},{'OwnerId':_0xa89955['id'],'ActivityDate':moment[_0xa7b4('0x11')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xa7b4('0x12')](_0x1a7f49[_0xa7b4('0x13')],_0x41e855,'\x20'),'Description':intUtil[_0xa7b4('0x12')](_0x1a7f49[_0xa7b4('0x14')],_0x41e855,'\x0a')},getCustomFields(_0xc4fbfd,_0x41e855));if(_0x25f613){_0x53977e[_0xa7b4('0x15')]=_0x25f613['id'];}}else if(_0x1a7f49[_0xa7b4('0xe')]===_0xa7b4('0x16')){_0x53977e=Object['assign']({},{'OwnerId':_0xa89955['id'],'Subject':intUtil[_0xa7b4('0x12')](_0x1a7f49[_0xa7b4('0x13')],_0x41e855,'\x20'),'Description':intUtil[_0xa7b4('0x12')](_0x1a7f49[_0xa7b4('0x14')],_0x41e855,'\x0a')},getCustomFields(_0xc4fbfd,_0x41e855));if(_0x25f613){_0x53977e[_0xa7b4('0x17')]=_0x25f613['id'];}}return _0x874b2c['sobject'](_0x1a7f49[_0xa7b4('0xe')])[_0xa7b4('0x18')](_0x53977e);}function getUser(_0x428e52,_0x2d4ce7,_0x2458ad){if(!_[_0xa7b4('0x19')](_0x2d4ce7)&&intUtil[_0xa7b4('0x1a')](_0x2d4ce7)){var _0x8e85eb={'Email':_0x2d4ce7};var _0x2b82bf={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2458ad['sobject'](_0xa7b4('0x1b'))[_0xa7b4('0x1c')](_0x8e85eb,_0x2b82bf)[_0xa7b4('0x1d')]()[_0xa7b4('0x1e')](function(_0x431d4d){if(_0x431d4d[_0xa7b4('0x1f')]){var _0x5a2e6d=_['find'](_0x431d4d,function(_0x787559){return _0x787559[_0xa7b4('0x20')]===_0x2d4ce7;});if(_0x5a2e6d){logger[_0xa7b4('0x21')]('Agent\x20%s\x20found.',_0x2d4ce7);return BPromise[_0xa7b4('0x22')]({'id':_0x5a2e6d['Id'],'name':_0x5a2e6d[_0xa7b4('0x23')]});}}else{logger[_0xa7b4('0x21')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x2d4ce7);return _0x2458ad[_0xa7b4('0x24')]()[_0xa7b4('0x1e')](function(_0x17d3f9){return BPromise['resolve']({'id':_0x17d3f9[_0xa7b4('0x25')],'name':_0x17d3f9['display_name']});});}});}else{logger['info'](_0xa7b4('0x26'),_0x2d4ce7);return _0x2458ad[_0xa7b4('0x24')]()[_0xa7b4('0x1e')](function(_0x31648f){return BPromise['resolve']({'id':_0x31648f[_0xa7b4('0x25')],'name':_0x31648f['display_name']});});}}function getEndUser(_0x29724b,_0x2b9a6c,_0x29b672,_0x408713,_0x50a248){var _0x403a74={'Phone':_0x408713};var _0xfb80d8={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xa7b4('0x22')]()[_0xa7b4('0x1e')](function(){if(_0x2b9a6c['ticketType']==='Task'){logger[_0xa7b4('0x21')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x408713,_0x2b9a6c['moduleSearch']);switch(_0x2b9a6c['moduleSearch']){case'contact_lead':return _0x50a248[_0xa7b4('0x27')](_0xa7b4('0x28'))['find'](_0x403a74,_0xfb80d8)[_0xa7b4('0x1d')]()['then'](function(_0x5200be){if(_0x5200be&&_0x5200be['length']){return _0x5200be;}else{return _0x50a248[_0xa7b4('0x27')](_0xa7b4('0x29'))[_0xa7b4('0x1c')](_0x403a74,_0xfb80d8);}});case _0xa7b4('0x2a'):return _0x50a248['sobject']('Contact')[_0xa7b4('0x1c')](_0x403a74,_0xfb80d8)[_0xa7b4('0x1d')]();case _0xa7b4('0x2b'):return _0x50a248[_0xa7b4('0x27')](_0xa7b4('0x29'))[_0xa7b4('0x1c')](_0x403a74,_0xfb80d8);default:return null;}}else if(_0x2b9a6c[_0xa7b4('0xe')]==='Case'){logger['info'](_0xa7b4('0x2c'),_0x408713,'contact');return _0x50a248[_0xa7b4('0x27')](_0xa7b4('0x28'))[_0xa7b4('0x1c')](_0x403a74,_0xfb80d8)['execute']();}})[_0xa7b4('0x1e')](function(_0x3147b5){if(_0x3147b5&&_0x3147b5[_0xa7b4('0x1f')]){var _0x354e36=_['find'](_0x3147b5,function(_0x55d8f3){return _0x55d8f3[_0xa7b4('0x2d')]===_0x408713;});if(_0x354e36){return BPromise[_0xa7b4('0x22')]({'id':_0x354e36['Id'],'name':_0x354e36[_0xa7b4('0x23')],'phone':_0x354e36['Phone']});}}})[_0xa7b4('0x1e')](function(_0x2b1191){if(_0x2b1191){logger['info']('Enduser\x20with\x20phone\x20%s\x20found.',_0x408713);return BPromise[_0xa7b4('0x22')](_0x2b1191);}else{logger[_0xa7b4('0x21')](_0xa7b4('0x2e'),_0x408713);var _0x280355={'LastName':_0x29b672!==_0xa7b4('0x2f')?_0x29b672:util[_0xa7b4('0x30')](_0xa7b4('0x31'),_0x408713),'Phone':_0x408713};if(_0x2b9a6c[_0xa7b4('0x32')]){if(_0x2b9a6c[_0xa7b4('0x32')]===_0xa7b4('0x2a')){logger[_0xa7b4('0x21')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x408713,_0x2b9a6c[_0xa7b4('0x32')]);}else if(_0x2b9a6c[_0xa7b4('0x32')]===_0xa7b4('0x2b')&&_0x2b9a6c[_0xa7b4('0xe')]===_0xa7b4('0xf')){logger[_0xa7b4('0x21')](_0xa7b4('0x33'),_0x408713,_0x2b9a6c[_0xa7b4('0x32')]);_0x280355[_0xa7b4('0x34')]=_0xa7b4('0x35');}else{return null;}}return _0x50a248['sobject'](_['upperFirst'](_0x2b9a6c[_0xa7b4('0x32')]))[_0xa7b4('0x18')](_0x280355);}});}function getCustomFields(_0x5d1a15,_0x25aa62){var _0x246a6c={};if(_0x5d1a15[_0xa7b4('0x1f')]>0x0){_[_0xa7b4('0x36')](_0x5d1a15,function(_0x15bbaa){if(_0x15bbaa[_0xa7b4('0x37')]===_0xa7b4('0x38')&&_0x15bbaa[_0xa7b4('0x39')]){_0x246a6c[_0x15bbaa[_0xa7b4('0x39')]]=_0x15bbaa[_0xa7b4('0x3a')]['toString']();}else if(_0x15bbaa['type']===_0xa7b4('0x3b')&&_0x15bbaa[_0xa7b4('0x3c')]&&_0x15bbaa[_0xa7b4('0x39')]){_0x25aa62[_0x15bbaa['variableName']]&&(_0x246a6c[_0x15bbaa[_0xa7b4('0x39')]]=_0x25aa62[_0x15bbaa[_0xa7b4('0x3c')]]['toString']());}else if(_0x15bbaa[_0xa7b4('0x37')]==='customVariable'&&_0x15bbaa[_0xa7b4('0x3d')]&&_0x15bbaa['Variable'][_0xa7b4('0x3e')]&&_0x15bbaa['idField']){_0x25aa62[_0x15bbaa[_0xa7b4('0x3d')][_0xa7b4('0x3e')][_0xa7b4('0x3f')]()]&&(_0x246a6c[_0x15bbaa['idField']]=_0x25aa62[_0x15bbaa[_0xa7b4('0x3d')][_0xa7b4('0x3e')][_0xa7b4('0x3f')]()][_0xa7b4('0x40')]());}});}return _0x246a6c;}function getConnection(_0x43a5db){var _0xa458e8=_0x43a5db[_0xa7b4('0x41')][_0xa7b4('0x42')](_0x43a5db['securityToken']);var _0x1dce41=new jsforce[(_0xa7b4('0x43'))]({'oauth2':{'loginUrl':_0x43a5db[_0xa7b4('0x44')]||_0xa7b4('0x45'),'clientId':_0x43a5db['clientId'],'clientSecret':_0x43a5db[_0xa7b4('0x46')]}});return _0x1dce41[_0xa7b4('0x47')](_0x43a5db['username'],_0xa458e8)['then'](function(){logger[_0xa7b4('0x21')](_0xa7b4('0x48'));return _0x1dce41;});}exports[_0xa7b4('0x49')]=function(_0x502abf,_0x32933c,_0xa85917,_0x77dfdc,_0x27ccd5,_0x5f268f){var _0x2b9aa6,_0x57b4f1,_0x1f58ab,_0x1f0167;_0x5f268f[_0xa7b4('0x4a')]=intUtil[_0xa7b4('0x4b')](_0x5f268f[_0xa7b4('0x4a')]);_0x5f268f[_0xa7b4('0x44')]=intUtil[_0xa7b4('0x4b')](_0x5f268f[_0xa7b4('0x44')]);if(_0x27ccd5&&_0x27ccd5['monitor_format']){logger[_0xa7b4('0x21')](_0xa7b4('0x4c'),'Recording\x20is\x20enabled!');_0x32933c['recordingURL']=util['format'](_0xa7b4('0x4d'),_0x5f268f[_0xa7b4('0x4a')],_0x32933c['uniqueid'],md5(_0x32933c['uniqueid']));}else{_0x32933c['recordingURL']='';}return getConnection(_0x5f268f)[_0xa7b4('0x1e')](function(_0x1c4ee4){_0x1f0167=_0x1c4ee4;return getUser(_0x5f268f,_0x77dfdc[_0xa7b4('0x4e')],_0x1f0167);})[_0xa7b4('0x1e')](function(_0x1acd5c){_0x2b9aa6=_0x1acd5c;return getEndUser(_0x5f268f,_0xa85917,_0x32933c[_0xa7b4('0x4f')],_0x32933c[_0xa7b4('0x50')],_0x1f0167);})[_0xa7b4('0x1e')](function(_0x277f16){_0x57b4f1=_0x277f16;return getTicket(_0x5f268f,_0x2b9aa6,_0x57b4f1,_0xa85917,_0x32933c,_0xa85917[_0xa7b4('0x51')],_0x1f0167,_0xa7b4('0x49'));})['then'](function(_0x66a248){_0x1f58ab=_0x66a248;logger[_0xa7b4('0x21')](_0xa7b4('0x52'),_0x1f58ab['id']);logger[_0xa7b4('0x21')](_0xa7b4('0x53'),_0x1f58ab['id'],_0x77dfdc['name'],_0x5f268f[_0xa7b4('0x37')]);switch(_0x5f268f[_0xa7b4('0x37')]){case _0xa7b4('0x54'):emit(util[_0xa7b4('0x30')](_0xa7b4('0x55'),_0x77dfdc['name']),'trigger:salesforce:display',{'recordId':_0x1f58ab['id']});break;case _0xa7b4('0x56'):emit(util[_0xa7b4('0x30')](_0xa7b4('0x55'),_0x77dfdc['name']),_0xa7b4('0x57'),{'uri':util['format']('%s/%s/e',_0x1f0167[_0xa7b4('0x58')],_0x1f58ab['id'])});break;default:logger[_0xa7b4('0x59')](_0xa7b4('0x5a'));}})[_0xa7b4('0x5b')](function(_0x205b3c){logger[_0xa7b4('0x59')](_0xa7b4('0x4c'),JSON[_0xa7b4('0x5c')](_0x205b3c));});};exports[_0xa7b4('0x5d')]=function(_0x490ae6,_0x32ac83,_0x132e8e,_0x58b26c,_0x424ec2,_0x3ac4cf,_0x57d0df){var _0x1ded22,_0x2dc39d,_0x4703a2,_0x934f46;_0x3ac4cf[_0xa7b4('0x4a')]=intUtil[_0xa7b4('0x4b')](_0x3ac4cf['serverUrl']);_0x3ac4cf['remoteUri']=intUtil[_0xa7b4('0x4b')](_0x3ac4cf[_0xa7b4('0x44')]);if(_0x57d0df&&_0x57d0df[_0xa7b4('0x5e')]&&_0x57d0df[_0xa7b4('0x5e')]!=='none'){logger[_0xa7b4('0x21')](_0xa7b4('0x5f'),_0xa7b4('0x60'));_0x32ac83['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac4cf[_0xa7b4('0x4a')],_0x32ac83[_0xa7b4('0x61')],md5(_0x32ac83['uniqueid']));}return getConnection(_0x3ac4cf)[_0xa7b4('0x1e')](function(_0x2e3a75){_0x934f46=_0x2e3a75;return getUser(_0x3ac4cf,_0x58b26c[_0xa7b4('0x4e')],_0x934f46);})['then'](function(_0x456a02){_0x1ded22=_0x456a02;return getEndUser(_0x3ac4cf,_0x132e8e,_0x32ac83[_0xa7b4('0x62')],_0x32ac83[_0xa7b4('0x63')],_0x934f46);})[_0xa7b4('0x1e')](function(_0x183845){_0x2dc39d=_0x183845;return getTicket(_0x3ac4cf,_0x1ded22,_0x2dc39d,_0x132e8e,_0x32ac83,_0x132e8e[_0xa7b4('0x51')],_0x934f46,_0xa7b4('0x5d'));})['then'](function(_0x116b98){_0x4703a2=_0x116b98;logger[_0xa7b4('0x21')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x4703a2['id']);logger[_0xa7b4('0x21')](_0xa7b4('0x64'),_0x4703a2['id'],_0x58b26c['name'],_0x3ac4cf[_0xa7b4('0x37')]);switch(_0x3ac4cf[_0xa7b4('0x37')]){case'integrationTab':emit(util[_0xa7b4('0x30')](_0xa7b4('0x55'),_0x58b26c['name']),_0xa7b4('0x65'),{'recordId':_0x4703a2['id']});break;case _0xa7b4('0x56'):emit(util['format'](_0xa7b4('0x55'),_0x58b26c['name']),_0xa7b4('0x57'),{'uri':util[_0xa7b4('0x30')](_0xa7b4('0x66'),_0x934f46[_0xa7b4('0x58')],_0x4703a2['id'])});break;default:logger[_0xa7b4('0x59')](_0xa7b4('0x5f'),_0xa7b4('0x67'));}})[_0xa7b4('0x5b')](function(_0x2b0aa4){logger[_0xa7b4('0x59')](_0xa7b4('0x5f'),JSON[_0xa7b4('0x5c')](_0x2b0aa4));});};exports[_0xa7b4('0x68')]=function(_0x981381,_0x356c0c,_0x3ec26b,_0x508fcc,_0x2139ea,_0x45a3a5){var _0x5d51e9,_0x2ae045,_0x9dd346,_0x1cb5bd;_0x45a3a5['serverUrl']=intUtil[_0xa7b4('0x4b')](_0x45a3a5['serverUrl']);_0x45a3a5[_0xa7b4('0x44')]=intUtil[_0xa7b4('0x4b')](_0x45a3a5[_0xa7b4('0x44')]);if(_0x2139ea&&_0x2139ea[_0xa7b4('0x69')]){logger[_0xa7b4('0x21')]('['+_0x356c0c['lastevent'][_0xa7b4('0x6a')]()+']',_0xa7b4('0x60'));_0x356c0c['recordingURL']=util[_0xa7b4('0x30')](_0xa7b4('0x4d'),_0x45a3a5['serverUrl'],_0x356c0c[_0xa7b4('0x61')],md5(_0x356c0c['uniqueid']));}else{_0x356c0c[_0xa7b4('0x6b')]='';}return getConnection(_0x45a3a5)['then'](function(_0x3f2f2e){_0x1cb5bd=_0x3f2f2e;if(!_[_0xa7b4('0x19')](_0x508fcc)){return getUser(_0x45a3a5,_0x508fcc['name'],_0x1cb5bd);}else{return getUser(_0x45a3a5,null,_0x1cb5bd);}})[_0xa7b4('0x1e')](function(_0x27de72){_0x5d51e9=_0x27de72;return getEndUser(_0x45a3a5,_0x3ec26b,_0x356c0c['calleridname'],_0x356c0c[_0xa7b4('0x50')],_0x1cb5bd);})[_0xa7b4('0x1e')](function(_0x4fb9cf){_0x2ae045=_0x4fb9cf;return getTicket(_0x45a3a5,_0x5d51e9,_0x2ae045,_0x3ec26b,_0x356c0c,_0x3ec26b[_0xa7b4('0x51')],_0x1cb5bd);})[_0xa7b4('0x1e')](function(_0x159db1){_0x9dd346=_0x159db1;logger[_0xa7b4('0x21')]('['+_0x356c0c[_0xa7b4('0x6c')][_0xa7b4('0x6a')]()+']\x20Ticket\x20%s\x20created.',_0x9dd346['id']);logger[_0xa7b4('0x21')]('['+_0x356c0c[_0xa7b4('0x6c')][_0xa7b4('0x6a')]()+_0xa7b4('0x6d'),_0x45a3a5[_0xa7b4('0x37')]);})[_0xa7b4('0x5b')](function(_0xe41764){logger[_0xa7b4('0x59')]('['+_0x356c0c[_0xa7b4('0x6c')][_0xa7b4('0x6a')]()+']',JSON['stringify'](_0xe41764));});}; \ 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 471de24..fecb97a 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 _0x1261=['recordingURL','The\x20ticket\x20ID\x20is:\x20%s','format','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','GET','],\x20getUser\x20rp\x20obj','then','length','active','true','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','string','nameField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','customField','name',']\x20getTicket\x20input\x20crm','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','Incident\x20-\x20',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','emit','username','password','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','userEmail','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none'];(function(_0x2484e6,_0x2cbe6c){var _0x20efaf=function(_0x15499e){while(--_0x15499e){_0x2484e6['push'](_0x2484e6['shift']());}};_0x20efaf(++_0x2cbe6c);}(_0x1261,0x144));var _0x1126=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0x1261[_0x190ff6];return _0x5356d2;};'use strict';var _=require('lodash');var Promise=require(_0x1126('0x0'));var rp=require(_0x1126('0x1'));var util=require(_0x1126('0x2'));var md5=require(_0x1126('0x3'));var Redis=require(_0x1126('0x4'));var intUtil=require(_0x1126('0x5'));var config=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));config[_0x1126('0x9')]=_['defaults'](config['redis'],{'host':_0x1126('0xa'),'port':0x18eb});var io=require(_0x1126('0xb'))(new Redis(config['redis']));function getAdminUser(_0x17e5f0,_0x28772d,_0x245be9,_0x3abb0b,_0x2d9033,_0x59cfa1){return new Promise(function(_0x3f09ac,_0x18dbe6){var _0x167ef1={'method':'GET','uri':_0x3abb0b+_0x1126('0xc')+'&'+_0x2d9033+'&'+_0x59cfa1,'auth':_0x28772d,'json':!![]};return rp(_0x167ef1)['then'](function(_0x52ef15){if(_0x52ef15[_0x1126('0xd')]['length']>0x0){_0x245be9[_0x1126('0xe')]=_0x52ef15[_0x1126('0xd')][0x0][_0x1126('0xf')];}logger[_0x1126('0x10')]('['+[_0x17e5f0[_0x1126('0x11')]()]+_0x1126('0x12'),_0x245be9);_0x3f09ac(_0x245be9);})[_0x1126('0x13')](function(_0x2048ad){logger[_0x1126('0x14')]('['+[_0x17e5f0['toUpperCase']()]+']',_0x2048ad['message']);_0x18dbe6(_0x2048ad[_0x1126('0x15')]);});});}function getUser(_0x154e20,_0x279455,_0x4be0c6,_0x45149c,_0x4794a7){return function(_0x35fe9f){logger[_0x1126('0x10')]('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x35fe9f);return new Promise(function(_0x245cd7,_0x1695f6){if(intUtil['validateEmail'](_0x35fe9f['userEmail'])){var _0x22ae0b={'method':_0x1126('0x16'),'uri':_0x4be0c6+'sys_user?sysparm_query=email%3D'+_0x35fe9f['userEmail']+'&'+_0x45149c+'&'+_0x4794a7,'auth':_0x279455,'json':!![]};logger[_0x1126('0x10')]('['+[_0x154e20['toUpperCase']()]+_0x1126('0x17'),_0x22ae0b);return rp(_0x22ae0b)[_0x1126('0x18')](function(_0x2f70ac){logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20entity',_0x2f70ac);if(_0x2f70ac['result'][_0x1126('0x19')]>0x0&&String(_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0x1a')])===_0x1126('0x1b')){_0x35fe9f['userId']=_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0xf')];}else{_0x35fe9f['userId']=_0x35fe9f[_0x1126('0xe')];_0x35fe9f['userEmail']=_0x35fe9f['adminEmail'];}logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1c'),_0x35fe9f);_0x245cd7(_0x35fe9f);})[_0x1126('0x13')](function(_0x34bcf1){logger[_0x1126('0x14')]('['+[_0x154e20[_0x1126('0x11')]()]+']',_0x34bcf1[_0x1126('0x15')]);_0x1695f6(_0x34bcf1[_0x1126('0x15')]);});}else{logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1d'));_0x35fe9f[_0x1126('0x1e')]=_0x35fe9f['adminId'];_0x35fe9f['userEmail']=_0x35fe9f[_0x1126('0x1f')];_0x245cd7(_0x35fe9f);}});};}function createEndUser(_0x39bf0e,_0x55e195,_0x2fb797,_0x23d2bc,_0x4a334a){logger[_0x1126('0x10')]('['+[_0x39bf0e['toUpperCase']()]+_0x1126('0x20'),_0x2fb797);return new Promise(function(_0x4bd50b,_0x771bb8){var _0x583ce6={'method':_0x1126('0x21'),'uri':_0x23d2bc+'sys_user?'+_0x4a334a,'body':{'user_name':_0x2fb797['endUserNumber'],'roles':'user','first_name':_0x2fb797[_0x1126('0x22')],'active':_0x1126('0x1b'),'date_format':_0x1126('0x23'),'phone':_0x2fb797['endUserNumber']},'auth':_0x55e195,'json':!![]};return rp(_0x583ce6)[_0x1126('0x18')](function(_0x226afb){logger['info']('['+[_0x39bf0e[_0x1126('0x11')]()]+_0x1126('0x24'),_0x226afb[_0x1126('0xd')]);_0x2fb797[_0x1126('0x25')]=_0x226afb['result']['sys_id'];_0x4bd50b(_0x2fb797);})[_0x1126('0x13')](function(_0x19e6e4){logger[_0x1126('0x14')]('['+[_0x39bf0e[_0x1126('0x11')]()]+']',_0x19e6e4['message']);_0x771bb8(_0x19e6e4[_0x1126('0x15')]);});});}function getEndUser(_0x6f4312,_0x313ebe,_0x22436c,_0x3b0f79,_0x5df232){return function(_0x2a0dfe){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x26'),_0x2a0dfe);return new Promise(function(_0x5c019d,_0x4ca51c){var _0x22827a={'method':_0x1126('0x16'),'uri':_0x22436c+'sys_user?sysparm_query=phone%3D'+_0x2a0dfe[_0x1126('0x22')]+'&'+_0x3b0f79+'&'+_0x5df232,'auth':_0x313ebe,'json':!![]};return rp(_0x22827a)[_0x1126('0x18')](function(_0x11b0f6){if(_0x11b0f6['result']['length']>0x0){_0x2a0dfe[_0x1126('0x25')]=_0x11b0f6[_0x1126('0xd')][0x0][_0x1126('0xf')];logger[_0x1126('0x10')]('['+[_0x6f4312['toUpperCase']()]+_0x1126('0x27'),_0x2a0dfe);_0x5c019d(_0x2a0dfe);}else{return createEndUser(_0x6f4312,_0x313ebe,_0x2a0dfe,_0x22436c,_0x3b0f79)['then'](function(_0x8abfe3){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x28'),_0x8abfe3);_0x5c019d(_0x8abfe3);});}})[_0x1126('0x13')](function(_0x5746f6){logger[_0x1126('0x14')]('['+[_0x6f4312[_0x1126('0x11')]()]+']',_0x5746f6[_0x1126('0x15')]);_0x4ca51c(_0x5746f6[_0x1126('0x15')]);});});};}function getCustomFields(_0x3469a2,_0x3442b8){var _0x3052f9={};if(_0x3469a2['length']>0x0){_[_0x1126('0x29')](_0x3469a2,function(_0x154c28){if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x2c')]&&!_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x154c28[_0x1126('0x2e')][_0x1126('0x2f')]();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField']['toLowerCase']()]=_0x154c28[_0x1126('0x2e')]['toString']();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x31')&&_0x154c28[_0x1126('0x32')]&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x3442b8[_0x154c28[_0x1126('0x32')]][_0x1126('0x2f')]();}else if(_0x154c28['type']===_0x1126('0x33')&&_0x154c28['Variable']&&_0x154c28[_0x1126('0x34')]['name']&&_0x154c28[_0x1126('0x30')]&&_0x154c28[_0x1126('0x35')]){_0x3052f9[_0x154c28[_0x1126('0x30')]['toLowerCase']()]=_0x3442b8[_0x154c28[_0x1126('0x34')][_0x1126('0x36')][_0x1126('0x2d')]()]['toString']();}});}return _0x3052f9;}function getTicket(_0x58ff3a,_0x4dd7f5,_0x6e78cf,_0x520b62,_0x1e197e,_0x507568){return function(_0x2f45b9){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x37'),_0x2f45b9);return new Promise(function(_0xede3d8,_0x56732f){var _0x198173=_0x58ff3a[_0x1126('0x2d')]()==='outbound'?_0x2f45b9[_0x1126('0x1e')]:_0x2f45b9[_0x1126('0x25')];var _0x575f79={'method':_0x1126('0x21'),'uri':_0x6e78cf+_0x1126('0x38')+'?'+_0x507568,'body':Object['assign']({},{'active':_0x1126('0x1b'),'caller_id':_0x198173,'assigned_to':_0x2f45b9[_0x1126('0x1e')],'short_description':intUtil[_0x1126('0x39')](_0x520b62['Subjects'],_0x1e197e,'\x20'),'description':intUtil[_0x1126('0x39')](_0x520b62[_0x1126('0x3a')],_0x1e197e,'\x0a')},getCustomFields(_0x520b62[_0x1126('0x3b')],_0x1e197e)),'auth':_0x4dd7f5,'json':!![]};return rp(_0x575f79)[_0x1126('0x18')](function(_0x224456){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3c'),_0x224456['result']);_0x2f45b9[_0x1126('0x3d')]=_0x224456['result'][_0x1126('0xf')];_0x2f45b9[_0x1126('0x3e')]=_0x224456['result']['number'];logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3f'),_0x2f45b9);_0xede3d8(_0x2f45b9);})['catch'](function(_0x3cb44c){logger[_0x1126('0x14')]('['+[_0x58ff3a[_0x1126('0x11')]()]+']',_0x3cb44c[_0x1126('0x15')]);_0x56732f(_0x3cb44c['message']);});});};}function createRemoteTag(_0x30d1b3,_0x46551f,_0x5c36b9,_0x4bcc08){return new Promise(function(_0x4abb4d,_0x526b07){var _0x386c10={'method':_0x1126('0x21'),'uri':_0x5c36b9+'label'+'?'+_0x4bcc08,'body':{'short_description':_0x30d1b3,'global':!![],'active':!![],'name':_0x30d1b3},'auth':_0x46551f,'json':!![]};return rp(_0x386c10)[_0x1126('0x18')](function(_0x1c7a2b){var _0x38093e=_0x1c7a2b[_0x1126('0xd')][_0x1126('0xf')];_0x4abb4d(_0x38093e);});});}function getRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414,_0x322016){return new Promise(function(_0x476aca,_0xcc9499){var _0x36b61={'method':_0x1126('0x16'),'uri':_0x267592+'label'+_0x1126('0x40')+_0x4e4d49+'&'+_0x5d6414,'auth':_0x41cbb6,'json':!![]};return rp(_0x36b61)['then'](function(_0x868b2c){if(_0x868b2c[_0x1126('0xd')][_0x1126('0x19')]>0x0){var _0x590bc2=_0x868b2c[_0x1126('0xd')][0x0][_0x1126('0xf')];_0x476aca(_0x590bc2);}else{return createRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414)['then'](function(_0x30812d){_0x476aca(_0x30812d);});}});});}function assignTagToIncident(_0x25038f,_0x9bad53,_0x5a5340,_0x2fe6dc,_0x3377db){return new Promise(function(_0x22ab18,_0x308ee4){var _0x128c94={'method':_0x1126('0x21'),'uri':_0x5a5340+_0x1126('0x41')+'?'+_0x3377db,'body':{'label':_0x25038f,'table':_0x1126('0x38'),'id_type':'Incident','table_key':_0x2fe6dc[_0x1126('0x3d')],'title':_0x1126('0x42')+_0x2fe6dc[_0x1126('0x3e')],'id_display':_0x2fe6dc[_0x1126('0x3e')]},'auth':_0x9bad53,'json':!![]};return rp(_0x128c94)[_0x1126('0x18')](function(_0x4f5772){_0x22ab18();})[_0x1126('0x13')](function(){_0x22ab18();});});}function manageTags(_0x315386,_0x5e0ea1,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91,_0x478806){return new Promise(function(_0x3062d6,_0x21d4ef){var _0x375b76=[];_0x5e0ea1['forEach'](function(_0x13394f){_0x375b76['push'](getRemoteTag(_0x13394f,_0x3767e4,_0x5246aa,_0x10ff91,_0x478806));});return Promise['all'](_0x375b76)[_0x1126('0x18')](function(_0x40185f){if(_0x40185f[_0x1126('0x19')]){logger[_0x1126('0x10')]('['+[_0x315386[_0x1126('0x11')]()]+_0x1126('0x43'),_0x40185f);var _0x1a0e26=[];_0x40185f['forEach'](function(_0x191307){_0x1a0e26[_0x1126('0x44')](assignTagToIncident(_0x191307,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91));});return Promise[_0x1126('0x45')](_0x1a0e26)[_0x1126('0x18')](function(){_0x3062d6();})[_0x1126('0x13')](function(){_0x3062d6();});}else{_0x3062d6();}});});}function getTags(_0x3cd788,_0x5a0804,_0x5b17d6,_0x16a343,_0x3921c2,_0x4bf2b3){return function(_0x5ee130){return new Promise(function(_0x5e9260,_0x51a28d){var _0x964a2=[];var _0x37b1ab=_0x16a343[_0x1126('0x46')];if(_0x37b1ab&&_0x37b1ab['length']>0x0){_0x964a2=_[_0x1126('0x47')](_0x37b1ab,_0x1126('0x36'));}if(_0x964a2[_0x1126('0x19')]>0x0){return manageTags(_0x3cd788,_0x964a2,_0x5a0804,_0x5b17d6,_0x5ee130,_0x3921c2,_0x4bf2b3)[_0x1126('0x18')](function(){_0x5e9260(_0x5ee130);});}else{_0x5e9260(_0x5ee130);}});};}function emit(_0x22d403,_0x3f007b,_0x131056){var _0x49a0a3=_0x1126('0x48')+_0x1126('0x49')+_0x1126('0x4a')+_0x1126('0x4b');var _0x288b9b={'uri':_0x22d403+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x131056+_0x49a0a3};io['to'](util['format'](_0x1126('0x4c'),_0x3f007b))[_0x1126('0x4d')]('trigger:browser:url',_0x288b9b);}exports['cs']=function(_0x3bf25d,_0x1fb2f0,_0x366675,_0x6a41c0,_0x2828d4,_0x30d240,_0x41ce78,_0x247f12){var _0xd20fbe={};var _0x3d5e15={'user':_0x30d240[_0x1126('0x4e')],'pass':_0x30d240[_0x1126('0x4f')]};var _0x3dad39='sysparm_limit=1';var _0x111f49=_0x1126('0x50');_0x30d240[_0x1126('0x51')]=intUtil['stripTrailingSlash'](_0x30d240['remoteUri']);_0x30d240[_0x1126('0x52')]=intUtil[_0x1126('0x53')](_0x30d240[_0x1126('0x52')]);var _0x3bfeb8=util['format']('%s/api/now/table/',_0x30d240['remoteUri']);_0xd20fbe[_0x1126('0x54')]=!_[_0x1126('0x55')](_0x6a41c0)?_0x6a41c0[_0x1126('0x56')]:null;_0xd20fbe[_0x1126('0x1f')]=_0x30d240['email'];_0xd20fbe[_0x1126('0x22')]=_0x247f12['toLowerCase']()===_0x1126('0x57')?_0x1fb2f0[_0x1126('0x58')]:_0x1fb2f0[_0x1126('0x59')];_0xd20fbe[_0x1126('0x5a')]=_0x247f12===_0x1126('0x5b')||_0x247f12===_0x1126('0x5c')?_0x1126('0x5b'):'outbound';var _0xfd2d9=util['format'](_0x1126('0x5d'),_0x30d240[_0x1126('0x52')],_0x1fb2f0['uniqueid'],md5(_0x1fb2f0[_0x1126('0x5e')]));if(_0x2828d4&&_0x2828d4[_0x1126('0x5f')]){logger['info'](_0x1126('0x60'),_0x1126('0x61'));_0x1fb2f0['recordingURL']=_0xfd2d9;}else if(_0x41ce78&&_0x41ce78['recordingFormat']&&_0x41ce78[_0x1126('0x62')]!==_0x1126('0x63')){logger[_0x1126('0x10')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1fb2f0['recordingURL']=_0xfd2d9;}else{_0x1fb2f0[_0x1126('0x64')]='';}return getAdminUser(_0x247f12,_0x3d5e15,_0xd20fbe,_0x3bfeb8,_0x111f49,_0x3dad39)['then'](getUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))['then'](getEndUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))[_0x1126('0x18')](getTicket(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x366675,_0x1fb2f0,_0x111f49))['then'](function(_0x1f320e){logger[_0x1126('0x10')](util['format'](_0x1126('0x65'),_0x1f320e[_0x1126('0x3d')]));logger[_0x1126('0x10')](util[_0x1126('0x66')](_0x1126('0x67'),_0x247f12));if(_0x247f12!=='unmanaged'){logger[_0x1126('0x10')]('['+[_0x247f12[_0x1126('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x30d240[_0x1126('0x51')],_0x6a41c0[_0x1126('0x36')],_0x1f320e[_0x1126('0x3d')]);}})[_0x1126('0x13')](function(_0x2598a7){logger[_0x1126('0x14')]('['+[_0x247f12[_0x1126('0x11')]()]+_0x1126('0x68'),util[_0x1126('0x69')](_0x2598a7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x326f=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','then','result','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','message','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','type','nameField','customField','idField','toLowerCase','toString','string','content','variable','variableName','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident\x20-\x20','forEach','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','email','destcalleridnum','callDirection','queue','unmanaged'];(function(_0x48910d,_0xe8d0e1){var _0x1b4c22=function(_0x4d41a6){while(--_0x4d41a6){_0x48910d['push'](_0x48910d['shift']());}};_0x1b4c22(++_0xe8d0e1);}(_0x326f,0xd1));var _0xf326=function(_0x18d364,_0x156ad7){_0x18d364=_0x18d364-0x0;var _0x4af688=_0x326f[_0x18d364];return _0x4af688;};'use strict';var _=require(_0xf326('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0xf326('0x1'));var md5=require(_0xf326('0x2'));var Redis=require(_0xf326('0x3'));var intUtil=require(_0xf326('0x4'));var config=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));config[_0xf326('0x8')]=_[_0xf326('0x9')](config[_0xf326('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xf326('0xa'))(new Redis(config[_0xf326('0x8')]));function getAdminUser(_0x165f95,_0x1e7b8a,_0x515bfa,_0x4c206c,_0x592975,_0x3bacf2){return new Promise(function(_0x1fc80e,_0x163416){var _0x2686e1={'method':_0xf326('0xb'),'uri':_0x4c206c+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x592975+'&'+_0x3bacf2,'auth':_0x1e7b8a,'json':!![]};return rp(_0x2686e1)[_0xf326('0xc')](function(_0x53cbcd){if(_0x53cbcd[_0xf326('0xd')]['length']>0x0){_0x515bfa[_0xf326('0xe')]=_0x53cbcd['result'][0x0][_0xf326('0xf')];}logger[_0xf326('0x10')]('['+[_0x165f95['toUpperCase']()]+_0xf326('0x11'),_0x515bfa);_0x1fc80e(_0x515bfa);})[_0xf326('0x12')](function(_0x3504eb){logger[_0xf326('0x13')]('['+[_0x165f95['toUpperCase']()]+']',_0x3504eb[_0xf326('0x14')]);_0x163416(_0x3504eb['message']);});});}function getUser(_0x54bd1a,_0xdf21d9,_0x11f6d2,_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+_0xf326('0x16'),_0x292f4b);return new Promise(function(_0x5a682a,_0x3ad7da){if(intUtil[_0xf326('0x17')](_0x292f4b[_0xf326('0x18')])){var _0x31ffb9={'method':_0xf326('0xb'),'uri':_0x11f6d2+_0xf326('0x19')+_0x292f4b['userEmail']+'&'+_0x1f2e5a+'&'+_0xa63d1a,'auth':_0xdf21d9,'json':!![]};logger['info']('['+[_0x54bd1a['toUpperCase']()]+_0xf326('0x1a'),_0x31ffb9);return rp(_0x31ffb9)[_0xf326('0xc')](function(_0x484cbe){logger['info']('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20entity',_0x484cbe);if(_0x484cbe['result'][_0xf326('0x1b')]>0x0&&String(_0x484cbe[_0xf326('0xd')][0x0]['active'])==='true'){_0x292f4b[_0xf326('0x1c')]=_0x484cbe[_0xf326('0xd')][0x0]['sys_id'];}else{_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b[_0xf326('0x1d')];}logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20crm',_0x292f4b);_0x5a682a(_0x292f4b);})['catch'](function(_0x4f31f6){logger[_0xf326('0x13')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']',_0x4f31f6[_0xf326('0x14')]);_0x3ad7da(_0x4f31f6[_0xf326('0x14')]);});}else{logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']\x20using\x20admin\x20profile');_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b['adminEmail'];_0x5a682a(_0x292f4b);}});};}function createEndUser(_0x1617d2,_0x55ad0f,_0x4a9abf,_0x6a8e89,_0x1ae23a){logger[_0xf326('0x10')]('['+[_0x1617d2['toUpperCase']()]+_0xf326('0x1e'),_0x4a9abf);return new Promise(function(_0x292500,_0x55790d){var _0x225776={'method':_0xf326('0x1f'),'uri':_0x6a8e89+_0xf326('0x20')+_0x1ae23a,'body':{'user_name':_0x4a9abf[_0xf326('0x21')],'roles':_0xf326('0x22'),'first_name':_0x4a9abf[_0xf326('0x21')],'active':_0xf326('0x23'),'date_format':_0xf326('0x24'),'phone':_0x4a9abf[_0xf326('0x21')]},'auth':_0x55ad0f,'json':!![]};return rp(_0x225776)[_0xf326('0xc')](function(_0x4b52f2){logger[_0xf326('0x10')]('['+[_0x1617d2[_0xf326('0x15')]()]+_0xf326('0x25'),_0x4b52f2['result']);_0x4a9abf[_0xf326('0x26')]=_0x4b52f2[_0xf326('0xd')][_0xf326('0xf')];_0x292500(_0x4a9abf);})['catch'](function(_0x5b101d){logger[_0xf326('0x13')]('['+[_0x1617d2[_0xf326('0x15')]()]+']',_0x5b101d[_0xf326('0x14')]);_0x55790d(_0x5b101d[_0xf326('0x14')]);});});}function getEndUser(_0x30694f,_0x2e8a64,_0x62585a,_0x2d5f20,_0x580374){return function(_0x461e93){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x27'),_0x461e93);return new Promise(function(_0x4e5d7c,_0xce1cbb){var _0x481b64={'method':'GET','uri':_0x62585a+_0xf326('0x28')+_0x461e93['endUserNumber']+'&'+_0x2d5f20+'&'+_0x580374,'auth':_0x2e8a64,'json':!![]};return rp(_0x481b64)[_0xf326('0xc')](function(_0x57aa27){if(_0x57aa27[_0xf326('0xd')][_0xf326('0x1b')]>0x0){_0x461e93[_0xf326('0x26')]=_0x57aa27['result'][0x0][_0xf326('0xf')];logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x29'),_0x461e93);_0x4e5d7c(_0x461e93);}else{return createEndUser(_0x30694f,_0x2e8a64,_0x461e93,_0x62585a,_0x2d5f20)[_0xf326('0xc')](function(_0x40fa7a){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x2a'),_0x40fa7a);_0x4e5d7c(_0x40fa7a);});}})[_0xf326('0x12')](function(_0x1e69b1){logger[_0xf326('0x13')]('['+[_0x30694f[_0xf326('0x15')]()]+']',_0x1e69b1['message']);_0xce1cbb(_0x1e69b1[_0xf326('0x14')]);});});};}function getCustomFields(_0x1b7bf6,_0x5cfb97){var _0x4dd361={};if(_0x1b7bf6[_0xf326('0x1b')]>0x0){_['forEach'](_0x1b7bf6,function(_0x55dfa8){if(_0x55dfa8[_0xf326('0x2b')]==='string'&&_0x55dfa8[_0xf326('0x2c')]&&!_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8['content'][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x31')&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8[_0xf326('0x32')][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x33')&&_0x55dfa8[_0xf326('0x34')]&&_0x55dfa8['idField']&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x34')]][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]==='customVariable'&&_0x55dfa8[_0xf326('0x35')]&&_0x55dfa8[_0xf326('0x35')]['name']&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x35')]['name']['toLowerCase']()][_0xf326('0x30')]();}});}return _0x4dd361;}function getTicket(_0x44e101,_0x5ed62e,_0x4bd865,_0x8e318d,_0x269e89,_0x21c98e){return function(_0x5b3705){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x36'),_0x5b3705);return new Promise(function(_0xc43507,_0xc99be){var _0x2d9bba=_0x44e101[_0xf326('0x2f')]()===_0xf326('0x37')?_0x5b3705[_0xf326('0x1c')]:_0x5b3705[_0xf326('0x26')];var _0x1c76c8={'method':_0xf326('0x1f'),'uri':_0x4bd865+_0xf326('0x38')+'?'+_0x21c98e,'body':Object[_0xf326('0x39')]({},{'active':_0xf326('0x23'),'caller_id':_0x2d9bba,'assigned_to':_0x5b3705['userId'],'short_description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3b')],_0x269e89,'\x20'),'description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3c')],_0x269e89,'\x0a')},getCustomFields(_0x8e318d['Fields'],_0x269e89)),'auth':_0x5ed62e,'json':!![]};return rp(_0x1c76c8)[_0xf326('0xc')](function(_0x2f5511){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x2f5511[_0xf326('0xd')]);_0x5b3705[_0xf326('0x3d')]=_0x2f5511[_0xf326('0xd')][_0xf326('0xf')];_0x5b3705[_0xf326('0x3e')]=_0x2f5511['result']['number'];logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x3f'),_0x5b3705);_0xc43507(_0x5b3705);})['catch'](function(_0x102fba){logger[_0xf326('0x13')]('['+[_0x44e101[_0xf326('0x15')]()]+']',_0x102fba['message']);_0xc99be(_0x102fba['message']);});});};}function createRemoteTag(_0x36ef89,_0x5b4832,_0x1cf58f,_0x554277){return new Promise(function(_0x458e5f,_0x7ee57){var _0x28c959={'method':_0xf326('0x1f'),'uri':_0x1cf58f+_0xf326('0x40')+'?'+_0x554277,'body':{'short_description':_0x36ef89,'global':!![],'active':!![],'name':_0x36ef89},'auth':_0x5b4832,'json':!![]};return rp(_0x28c959)[_0xf326('0xc')](function(_0x7f7ece){var _0x495a16=_0x7f7ece[_0xf326('0xd')][_0xf326('0xf')];_0x458e5f(_0x495a16);});});}function getRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f,_0x3b8635){return new Promise(function(_0x16c578,_0x1159e){var _0x58fcf0={'method':_0xf326('0xb'),'uri':_0x208ba4+_0xf326('0x40')+_0xf326('0x41')+_0x424d24+'&'+_0x3a832f,'auth':_0x4b0d8e,'json':!![]};return rp(_0x58fcf0)[_0xf326('0xc')](function(_0x50690e){if(_0x50690e[_0xf326('0xd')][_0xf326('0x1b')]>0x0){var _0x227850=_0x50690e[_0xf326('0xd')][0x0]['sys_id'];_0x16c578(_0x227850);}else{return createRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f)['then'](function(_0x18b46e){_0x16c578(_0x18b46e);});}});});}function assignTagToIncident(_0x44d2ed,_0x55ca96,_0x3cf6fa,_0x29de71,_0x316609){return new Promise(function(_0x1258d1,_0x5765b0){var _0xb1c18c={'method':'POST','uri':_0x3cf6fa+'label_entry'+'?'+_0x316609,'body':{'label':_0x44d2ed,'table':_0xf326('0x38'),'id_type':'Incident','table_key':_0x29de71[_0xf326('0x3d')],'title':_0xf326('0x42')+_0x29de71[_0xf326('0x3e')],'id_display':_0x29de71['ticketNumber']},'auth':_0x55ca96,'json':!![]};return rp(_0xb1c18c)['then'](function(_0x1fd9c9){_0x1258d1();})[_0xf326('0x12')](function(){_0x1258d1();});});}function manageTags(_0x33b259,_0x5d0177,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c,_0x131184){return new Promise(function(_0x217897,_0xbd3a01){var _0x18dbfc=[];_0x5d0177[_0xf326('0x43')](function(_0x3aeb20){_0x18dbfc[_0xf326('0x44')](getRemoteTag(_0x3aeb20,_0x2759d7,_0x487020,_0x40929c,_0x131184));});return Promise[_0xf326('0x45')](_0x18dbfc)[_0xf326('0xc')](function(_0x1e56fb){if(_0x1e56fb[_0xf326('0x1b')]){logger['info']('['+[_0x33b259[_0xf326('0x15')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x1e56fb);var _0x6ac6=[];_0x1e56fb[_0xf326('0x43')](function(_0x5e858d){_0x6ac6[_0xf326('0x44')](assignTagToIncident(_0x5e858d,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c));});return Promise['all'](_0x6ac6)[_0xf326('0xc')](function(){_0x217897();})[_0xf326('0x12')](function(){_0x217897();});}else{_0x217897();}});});}function getTags(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x51ff5e,_0x4ec099,_0x1209ca){return function(_0x32fe3a){return new Promise(function(_0x15a538,_0x21b3cc){var _0x1fc586=[];var _0x579d2c=_0x51ff5e[_0xf326('0x46')];if(_0x579d2c&&_0x579d2c[_0xf326('0x1b')]>0x0){_0x1fc586=_['map'](_0x579d2c,'name');}if(_0x1fc586['length']>0x0){return manageTags(_0x28f3cb,_0x1fc586,_0x2d45c9,_0x31b6dd,_0x32fe3a,_0x4ec099,_0x1209ca)[_0xf326('0xc')](function(){_0x15a538(_0x32fe3a);});}else{_0x15a538(_0x32fe3a);}});};}function emit(_0x7edf5,_0x4150fa,_0x235525){var _0x240ce5=_0xf326('0x47')+_0xf326('0x48')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xf326('0x49');var _0x588d26={'uri':_0x7edf5+_0xf326('0x4a')+_0x235525+_0x240ce5};io['to'](util[_0xf326('0x4b')]('user:%s',_0x4150fa))[_0xf326('0x4c')]('trigger:browser:url',_0x588d26);}exports['cs']=function(_0x499b59,_0x2dd9e4,_0x540fa0,_0x78ba34,_0x3411a4,_0x461059,_0x2ea5a2,_0x17cd36){var _0x541491={};var _0x4a053c={'user':_0x461059['username'],'pass':_0x461059[_0xf326('0x4d')]};var _0x307441=_0xf326('0x4e');var _0x180616=_0xf326('0x4f');_0x461059['remoteUri']=intUtil[_0xf326('0x50')](_0x461059[_0xf326('0x51')]);_0x461059[_0xf326('0x52')]=intUtil['stripTrailingSlash'](_0x461059['serverUrl']);var _0x830c9f=util[_0xf326('0x4b')]('%s/api/now/table/',_0x461059['remoteUri']);_0x541491[_0xf326('0x18')]=!_['isNil'](_0x78ba34)?_0x78ba34[_0xf326('0x53')]:null;_0x541491['adminEmail']=_0x461059['email'];_0x541491['endUserNumber']=_0x17cd36[_0xf326('0x2f')]()===_0xf326('0x37')?_0x2dd9e4[_0xf326('0x54')]:_0x2dd9e4['calleridnum'];_0x541491[_0xf326('0x55')]=_0x17cd36===_0xf326('0x56')||_0x17cd36===_0xf326('0x57')?_0xf326('0x56'):_0xf326('0x37');var _0x39e73d=util[_0xf326('0x4b')](_0xf326('0x58'),_0x461059[_0xf326('0x52')],_0x2dd9e4['uniqueid'],md5(_0x2dd9e4[_0xf326('0x59')]));if(_0x3411a4&&_0x3411a4['monitor_format']){logger[_0xf326('0x10')](_0xf326('0x5a'),_0xf326('0x5b'));_0x2dd9e4['recordingURL']=_0x39e73d;}else if(_0x2ea5a2&&_0x2ea5a2[_0xf326('0x5c')]&&_0x2ea5a2[_0xf326('0x5c')]!==_0xf326('0x5d')){logger['info'](_0xf326('0x5e'),_0xf326('0x5b'));_0x2dd9e4[_0xf326('0x5f')]=_0x39e73d;}else{_0x2dd9e4[_0xf326('0x5f')]='';}return getAdminUser(_0x17cd36,_0x4a053c,_0x541491,_0x830c9f,_0x180616,_0x307441)['then'](getUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))[_0xf326('0xc')](getEndUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))['then'](getTicket(_0x17cd36,_0x4a053c,_0x830c9f,_0x540fa0,_0x2dd9e4,_0x180616))['then'](function(_0x32d9c5){logger[_0xf326('0x10')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x32d9c5['ticketId']));logger[_0xf326('0x10')](util['format'](_0xf326('0x60'),_0x17cd36));if(_0x17cd36!==_0xf326('0x57')){logger[_0xf326('0x10')]('['+[_0x17cd36[_0xf326('0x15')]()]+']',_0xf326('0x61'));emit(_0x461059[_0xf326('0x51')],_0x78ba34['name'],_0x32d9c5[_0xf326('0x3d')]);}})[_0xf326('0x12')](function(_0x5f1724){logger['error']('['+[_0x17cd36[_0xf326('0x15')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xf326('0x62')](_0x5f1724,{'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 87773e4..89595dd 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 _0x1ddf=['idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','Agent\x20found!','name_value_list','value','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','resolve','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','string','nameField','toLowerCase','customField','custom_fields','push','content','type','Variable','login','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','remoteUri','%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','recordingFormat','none','[OUTBOUND]','destcalleridnum','Outbound','The\x20Ticket\x20ID\x20is:','charAt','catch','lastevent','toUpperCase','lodash','request-promise','util','ioredis','./util','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','info','Subjects','assigned_user_id','created_by','getString','date_start','slice','replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','name','direction','length','forEach','variableName'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x1ddf,0x1ab));var _0xf1dd=function(_0x179d07,_0x29431a){_0x179d07=_0x179d07-0x0;var _0xbcbe0b=_0x1ddf[_0x179d07];return _0xbcbe0b;};'use strict';var _=require(_0xf1dd('0x0'));var rp=require(_0xf1dd('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0xf1dd('0x2'));var Redis=require(_0xf1dd('0x3'));var intUtil=require(_0xf1dd('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xf1dd('0x5'));config[_0xf1dd('0x6')]=_[_0xf1dd('0x7')](config[_0xf1dd('0x6')],{'host':_0xf1dd('0x8'),'port':0x18eb});var io=require(_0xf1dd('0x9'))(new Redis(config['redis']));var def={'method':_0xf1dd('0xa'),'json':!![]};function emit(_0x274339,_0x16572a,_0x5578d6){io['to'](_0x274339)['emit'](_0x16572a,_0x5578d6);}function getTicket(_0x57ab5d,_0x5e216d,_0x4a72bc,_0x1c93d1,_0x5ce40f,_0x56027f,_0xc1c5ad,_0x49d9fc){logger[_0xf1dd('0xb')]('Creating\x20new\x20ticket...');var _0x302169=new Date();var _0x18cdfb=[{'name':'name','value':intUtil['getString'](_0x1c93d1[_0xf1dd('0xc')],_0x5ce40f,'\x20')},{'name':_0xf1dd('0xd'),'value':_0x5e216d['id']},{'name':_0xf1dd('0xe'),'value':_0x5e216d['id']},{'name':'description','value':intUtil[_0xf1dd('0xf')](_0x1c93d1['Descriptions'],_0x5ce40f,'\x0a')},{'name':_0xf1dd('0x10'),'value':_0x302169['toISOString']()[_0xf1dd('0x11')](0x0,0x13)[_0xf1dd('0x12')]('T','\x20')},{'name':_0xf1dd('0x13'),'value':'0'},{'name':_0xf1dd('0x14'),'value':'15'},{'name':'parent_id','value':_0x4a72bc['id']},{'name':_0xf1dd('0x15'),'value':_0xf1dd('0x16')},{'name':_0xf1dd('0x17'),'value':_0x4a72bc[_0xf1dd('0x18')]},{'name':_0xf1dd('0x19'),'value':_0x49d9fc}];if(_0x56027f[_0xf1dd('0x1a')]){_[_0xf1dd('0x1b')](_0x56027f,function(_0x2ec939){if(_0x5ce40f[_0x2ec939[_0xf1dd('0x1c')]]){_0x18cdfb['push']({'name':_0x2ec939[_0xf1dd('0x1d')],'value':_0x5ce40f[_0x2ec939['variableName']]});}});}return request({'form':{'method':_0xf1dd('0x1e'),'input_type':_0xf1dd('0x1f'),'response_type':_0xf1dd('0x1f'),'rest_data':JSON[_0xf1dd('0x20')]({'session':_0xc1c5ad['id'],'module_name':_0xf1dd('0x21'),'name_value_list':_0x18cdfb})}});}function getAuth(_0x45dbbc){return util[_0xf1dd('0x22')](_0xf1dd('0x23'),new Buffer(_0x45dbbc[_0xf1dd('0x24')]+':X')[_0xf1dd('0x25')](_0xf1dd('0x26')));}function getServerInfo(_0x475261){return request({'form':{'method':_0xf1dd('0x27'),'input_type':_0xf1dd('0x1f'),'response_type':_0xf1dd('0x1f'),'rest_data':JSON['stringify']({'session':_0x475261['id']})}});}function getUser(_0x1df481,_0x4328f2,_0x5bf48d){if(!_[_0xf1dd('0x28')](_0x4328f2)){logger[_0xf1dd('0xb')](_0xf1dd('0x29'),_0x4328f2);return request({'form':{'method':'get_entry_list','input_type':_0xf1dd('0x1f'),'response_type':'JSON','rest_data':JSON[_0xf1dd('0x20')]({'session':_0x5bf48d['id'],'module_name':'Employees','query':util[_0xf1dd('0x22')](_0xf1dd('0x2a'),_0x4328f2),'order_by':'','offset':'0','select_fields':['id',_0xf1dd('0x18'),_0xf1dd('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3e8e3b){if(_0x3e8e3b[_0xf1dd('0x2c')]['length']){var _0x1b0a1a=_[_0xf1dd('0x2d')](_0x3e8e3b[_0xf1dd('0x2c')],function(_0x241462){return _0x241462['name_value_list'][_0xf1dd('0x2b')]['value']===_0x4328f2;});if(_0x1b0a1a){logger['info'](_0xf1dd('0x2e'));return BPromise['resolve']({'id':_0x1b0a1a[_0xf1dd('0x2f')]['id'][_0xf1dd('0x30')],'name':_0x1b0a1a[_0xf1dd('0x2f')]['name'][_0xf1dd('0x30')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x5bf48d[_0xf1dd('0x2f')]['user_id']['value'],'name':_0x5bf48d[_0xf1dd('0x2f')][_0xf1dd('0x2b')][_0xf1dd('0x30')]});});}else{logger[_0xf1dd('0xb')](_0xf1dd('0x31'));return BPromise[_0xf1dd('0x32')]({'id':_0x5bf48d[_0xf1dd('0x2f')][_0xf1dd('0x33')][_0xf1dd('0x30')],'name':_0x5bf48d[_0xf1dd('0x2f')][_0xf1dd('0x2b')]['value']});}}function getEndUser(_0x22613f,_0x4859d5,_0x5d8b8e,_0xca9cfd){logger[_0xf1dd('0xb')](_0xf1dd('0x34'),_0x5d8b8e);return request({'form':{'method':_0xf1dd('0x35'),'input_type':_0xf1dd('0x1f'),'response_type':_0xf1dd('0x1f'),'rest_data':JSON[_0xf1dd('0x20')]({'session':_0xca9cfd['id'],'module_name':'Contacts','query':util[_0xf1dd('0x22')](_0xf1dd('0x36'),_0x5d8b8e),'order_by':'','offset':'0','select_fields':['id',_0xf1dd('0x18'),_0xf1dd('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf1dd('0x38')](function(_0x1da0a5){if(_0x1da0a5[_0xf1dd('0x2c')]['length']){var _0x11ae06=_[_0xf1dd('0x2d')](_0x1da0a5[_0xf1dd('0x2c')],function(_0x693919){return _0x693919['name_value_list'][_0xf1dd('0x37')][_0xf1dd('0x30')]===_0x5d8b8e;});if(_0x11ae06){logger[_0xf1dd('0xb')](_0xf1dd('0x39'));return BPromise[_0xf1dd('0x32')]({'id':_0x11ae06[_0xf1dd('0x2f')]['id'][_0xf1dd('0x30')],'name':_0x11ae06[_0xf1dd('0x2f')][_0xf1dd('0x18')]['value'],'phone':_0x11ae06[_0xf1dd('0x2f')][_0xf1dd('0x37')][_0xf1dd('0x30')]});}}else{logger[_0xf1dd('0xb')](_0xf1dd('0x3a'));return request({'form':{'method':'set_entry','input_type':_0xf1dd('0x1f'),'response_type':_0xf1dd('0x1f'),'rest_data':JSON[_0xf1dd('0x20')]({'session':_0xca9cfd['id'],'module_name':'Contacts','name_value_list':[{'name':_0xf1dd('0x3b'),'value':_0x4859d5!==''?_0x4859d5:util[_0xf1dd('0x22')](_0xf1dd('0x3c'),_0x5d8b8e)},{'name':_0xf1dd('0x37'),'value':_0x5d8b8e}]})}})['then'](function(_0x35ab0a){logger['info'](_0xf1dd('0x3d'));return BPromise[_0xf1dd('0x32')]({'id':_0x35ab0a['id'],'name':_0x35ab0a[_0xf1dd('0x2c')][_0xf1dd('0x3b')][_0xf1dd('0x30')],'phone':_0x35ab0a['entry_list']['phone_home'][_0xf1dd('0x30')]});});}});}function request(_0x182ccd){logger[_0xf1dd('0x3e')](_0xf1dd('0x3f'),JSON[_0xf1dd('0x20')](_0x182ccd));return rp(_[_0xf1dd('0x40')](def,_0x182ccd));}function getTags(_0x1dbb9f,_0x5c4832){var _0x161aba=[];if(_0x1dbb9f&&_0x1dbb9f['length']>0x0){_0x161aba=_['map'](_0x1dbb9f,_0x5c4832);}return _0x161aba;}function getCustomFields(_0x262100,_0x2a68e2){var _0x342db0=[];var _0x3d1e4d={'custom_fields':[]};if(_0x262100[_0xf1dd('0x1a')]>0x0){_[_0xf1dd('0x1b')](_0x262100,function(_0x1ad4df){if(_0x1ad4df['type']===_0xf1dd('0x41')&&_0x1ad4df[_0xf1dd('0x42')]&&!_0x1ad4df['customField']){_0x3d1e4d[_0x1ad4df[_0xf1dd('0x42')][_0xf1dd('0x43')]()]=_0x1ad4df['content'][_0xf1dd('0x25')]();}else if(_0x1ad4df['type']===_0xf1dd('0x41')&&_0x1ad4df[_0xf1dd('0x1d')]&&_0x1ad4df[_0xf1dd('0x44')]){_0x3d1e4d[_0xf1dd('0x45')][_0xf1dd('0x46')]({'id':_0x1ad4df[_0xf1dd('0x1d')],'value':_0x1ad4df[_0xf1dd('0x47')][_0xf1dd('0x25')]()});}else if(_0x1ad4df[_0xf1dd('0x48')]==='variable'&&_0x1ad4df['variableName']&&_0x1ad4df[_0xf1dd('0x1d')]&&_0x1ad4df[_0xf1dd('0x44')]){_0x2a68e2[_0x1ad4df['variableName']]&&_0x3d1e4d[_0xf1dd('0x45')][_0xf1dd('0x46')]({'id':_0x1ad4df[_0xf1dd('0x1d')],'value':_0x2a68e2[_0x1ad4df['variableName']][_0xf1dd('0x25')]()});}else if(_0x1ad4df[_0xf1dd('0x48')]==='customVariable'&&_0x1ad4df['Variable']&&_0x1ad4df['Variable'][_0xf1dd('0x18')]&&_0x1ad4df[_0xf1dd('0x1d')]&&_0x1ad4df[_0xf1dd('0x44')]){_0x2a68e2[_0x1ad4df[_0xf1dd('0x49')][_0xf1dd('0x18')][_0xf1dd('0x43')]()]&&_0x3d1e4d[_0xf1dd('0x45')][_0xf1dd('0x46')]({'id':_0x1ad4df['idField'],'value':_0x2a68e2[_0x1ad4df[_0xf1dd('0x49')][_0xf1dd('0x18')]['toLowerCase']()][_0xf1dd('0x25')]()});}});}return _0x3d1e4d;}function getConnection(_0x100451){return request({'method':'POST','form':{'method':_0xf1dd('0x4a'),'input_type':'JSON','response_type':_0xf1dd('0x1f'),'rest_data':JSON[_0xf1dd('0x20')]({'user_auth':{'user_name':_0x100451['username'],'password':_0x100451[_0xf1dd('0x4b')],'encryption':'PLAIN'},'application':_0xf1dd('0x4c')})}})[_0xf1dd('0x38')](function(_0x3e5d55){var _0x42f70e=_0x3e5d55;if(_0x42f70e['id']){def[_0xf1dd('0x4d')]=_0x42f70e['id'];return BPromise[_0xf1dd('0x32')](_0x42f70e);}else{throw new Error(util['format'](_0xf1dd('0x4e'),_0x100451['id']));}});}function setRelationship(_0x5b2749,_0x355893,_0x17cc43,_0x5310ee){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x5b2749['id'],'module_name':_0xf1dd('0x21'),'module_id':_0x17cc43['id'],'link_field_name':_0x5310ee,'related_ids':[_0x355893['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x2dac2f,_0x57c3ea,_0x206d7c,_0x211aaa,_0x8233e,_0x2e8fff){var _0x527dc8,_0x284478,_0x359e7a,_0x4c5a67;_0x2e8fff['remoteUri']=intUtil[_0xf1dd('0x4f')](_0x2e8fff['remoteUri']);_0x2e8fff[_0xf1dd('0x50')]=intUtil[_0xf1dd('0x4f')](_0x2e8fff[_0xf1dd('0x50')]);def['uri']=util[_0xf1dd('0x22')](_0xf1dd('0x51'),_0x2e8fff['remoteUri']);if(_0x8233e&&_0x8233e['monitor_format']){logger[_0xf1dd('0xb')](_0xf1dd('0x52'),_0xf1dd('0x53'));_0x57c3ea[_0xf1dd('0x54')]=util[_0xf1dd('0x22')](_0xf1dd('0x55'),_0x2e8fff[_0xf1dd('0x50')],_0x57c3ea[_0xf1dd('0x56')],md5(_0x57c3ea[_0xf1dd('0x56')]));}else{_0x57c3ea['recordingURL']='';}return getConnection(_0x2e8fff)[_0xf1dd('0x38')](function(_0x14589c){_0x4c5a67=_0x14589c;return getUser(_0x2e8fff,_0x211aaa['name'],_0x4c5a67);})[_0xf1dd('0x38')](function(_0x575575){_0x527dc8=_0x575575;logger[_0xf1dd('0xb')](_0xf1dd('0x57'),_0x527dc8['id']);return getEndUser(_0x2e8fff,_0x57c3ea[_0xf1dd('0x58')],_0x57c3ea[_0xf1dd('0x59')],_0x4c5a67);})[_0xf1dd('0x38')](function(_0x5eceab){_0x284478=_0x5eceab;logger['info'](_0xf1dd('0x5a'),_0x284478['id']);return getTicket(_0x2e8fff,_0x527dc8,_0x284478,_0x206d7c,_0x57c3ea,_0x206d7c[_0xf1dd('0x5b')],_0x4c5a67,'Inbound');})[_0xf1dd('0x38')](function(_0x2e10fa){_0x359e7a=_0x2e10fa;logger[_0xf1dd('0xb')](_0xf1dd('0x5c'));logger[_0xf1dd('0xb')]('The\x20Ticket\x20ID\x20is:',_0x359e7a['id']);return setRelationship(_0x4c5a67,_0x527dc8,_0x359e7a,_0xf1dd('0x5d'));})['then'](function(){return setRelationship(_0x4c5a67,_0x284478,_0x359e7a,_0xf1dd('0x5e'));})['then'](function(){return getServerInfo(_0x4c5a67);})[_0xf1dd('0x38')](function(_0x170727){var _0x365a74=parseInt(_0x170727[_0xf1dd('0x5f')]['charAt'](0x0));var _0x217325=util[_0xf1dd('0x22')](_0xf1dd('0x60'),_0x2e8fff[_0xf1dd('0x61')],_0x359e7a['id']);if(_0x365a74>0x6){_0x217325=util['format'](_0xf1dd('0x62'),_0x2e8fff[_0xf1dd('0x61')],_0x359e7a['id']);}logger[_0xf1dd('0xb')](_0xf1dd('0x52'),_0xf1dd('0x63'));emit(util[_0xf1dd('0x22')](_0xf1dd('0x64'),_0x211aaa['name']),_0xf1dd('0x65'),{'uri':_0x217325});})['catch'](function(_0x134424){logger[_0xf1dd('0x66')]('[QUEUE]',JSON[_0xf1dd('0x20')](_0x134424));});};exports[_0xf1dd('0x67')]=function(_0x4d5f3e,_0x3d5ea4,_0x2cceac,_0x462b99,_0x2b2c94,_0xd9beae,_0x1fd4f3){var _0x473171,_0x2dae45,_0x5dbc2a,_0x4434bb;_0xd9beae[_0xf1dd('0x61')]=intUtil['stripTrailingSlash'](_0xd9beae[_0xf1dd('0x61')]);_0xd9beae[_0xf1dd('0x50')]=intUtil['stripTrailingSlash'](_0xd9beae[_0xf1dd('0x50')]);def['uri']=util[_0xf1dd('0x22')](_0xf1dd('0x51'),_0xd9beae[_0xf1dd('0x61')]);if(_0x1fd4f3&&_0x1fd4f3[_0xf1dd('0x68')]&&_0x1fd4f3[_0xf1dd('0x68')]!==_0xf1dd('0x69')){logger[_0xf1dd('0xb')](_0xf1dd('0x6a'),_0xf1dd('0x53'));_0x3d5ea4[_0xf1dd('0x54')]=util[_0xf1dd('0x22')](_0xf1dd('0x55'),_0xd9beae['serverUrl'],_0x3d5ea4[_0xf1dd('0x56')],md5(_0x3d5ea4['uniqueid']));}return getConnection(_0xd9beae)[_0xf1dd('0x38')](function(_0x4624e9){_0x4434bb=_0x4624e9;return getUser(_0xd9beae,_0x462b99[_0xf1dd('0x18')],_0x4434bb);})['then'](function(_0x31f79b){_0x473171=_0x31f79b;logger[_0xf1dd('0xb')](_0xf1dd('0x57'),_0x473171['id']);return getEndUser(_0xd9beae,_0x3d5ea4['destcalleridname'],_0x3d5ea4[_0xf1dd('0x6b')],_0x4434bb);})[_0xf1dd('0x38')](function(_0xcbc704){_0x2dae45=_0xcbc704;logger[_0xf1dd('0xb')](_0xf1dd('0x5a'),_0x2dae45['id']);return getTicket(_0xd9beae,_0x473171,_0x2dae45,_0x2cceac,_0x3d5ea4,_0x2cceac[_0xf1dd('0x5b')],_0x4434bb,_0xf1dd('0x6c'));})[_0xf1dd('0x38')](function(_0x46b354){_0x5dbc2a=_0x46b354;logger[_0xf1dd('0xb')](_0xf1dd('0x5c'));logger[_0xf1dd('0xb')](_0xf1dd('0x6d'),_0x5dbc2a['id']);return setRelationship(_0x4434bb,_0x473171,_0x5dbc2a,_0xf1dd('0x5d'));})[_0xf1dd('0x38')](function(){return setRelationship(_0x4434bb,_0x2dae45,_0x5dbc2a,_0xf1dd('0x5e'));})[_0xf1dd('0x38')](function(){return getServerInfo(_0x4434bb);})[_0xf1dd('0x38')](function(_0x303dea){var _0x9b1b7d=parseInt(_0x303dea[_0xf1dd('0x5f')][_0xf1dd('0x6e')](0x0));var _0x45b4c0=util['format'](_0xf1dd('0x60'),_0xd9beae['remoteUri'],_0x5dbc2a['id']);if(_0x9b1b7d>0x6){_0x45b4c0=util[_0xf1dd('0x22')](_0xf1dd('0x62'),_0xd9beae[_0xf1dd('0x61')],_0x5dbc2a['id']);}logger[_0xf1dd('0xb')](_0xf1dd('0x6a'),_0xf1dd('0x63'));emit(util[_0xf1dd('0x22')](_0xf1dd('0x64'),_0x462b99[_0xf1dd('0x18')]),_0xf1dd('0x65'),{'uri':_0x45b4c0});})[_0xf1dd('0x6f')](function(_0x73d71f){logger[_0xf1dd('0x66')](_0xf1dd('0x6a'),JSON[_0xf1dd('0x20')](_0x73d71f));});};exports['unmanaged']=function(_0x277d7b,_0x49113c,_0x274cb1,_0x3b7500,_0x3f4161,_0x18fb07){var _0x2ff8d6,_0x1e2563,_0x5bea97,_0x396e68;_0x18fb07[_0xf1dd('0x61')]=intUtil['stripTrailingSlash'](_0x18fb07['remoteUri']);_0x18fb07[_0xf1dd('0x50')]=intUtil[_0xf1dd('0x4f')](_0x18fb07[_0xf1dd('0x50')]);def['uri']=util[_0xf1dd('0x22')](_0xf1dd('0x51'),_0x18fb07[_0xf1dd('0x61')]);if(_0x3f4161&&_0x3f4161['monitor_format']){logger[_0xf1dd('0xb')]('['+_0x49113c[_0xf1dd('0x70')][_0xf1dd('0x71')]()+']',_0xf1dd('0x53'));_0x49113c[_0xf1dd('0x54')]=util[_0xf1dd('0x22')](_0xf1dd('0x55'),_0x18fb07['serverUrl'],_0x49113c[_0xf1dd('0x56')],md5(_0x49113c[_0xf1dd('0x56')]));}else{_0x49113c[_0xf1dd('0x54')]='';}return getConnection(_0x18fb07)[_0xf1dd('0x38')](function(_0x5a5cc7){_0x396e68=_0x5a5cc7;if(!_[_0xf1dd('0x28')](_0x3b7500)){return getUser(_0x18fb07,_0x3b7500[_0xf1dd('0x18')],_0x396e68);}else{return getUser(_0x18fb07,null,_0x396e68);}})[_0xf1dd('0x38')](function(_0x561961){_0x2ff8d6=_0x561961;logger[_0xf1dd('0xb')]('The\x20User\x20ID\x20is:',_0x2ff8d6['id']);return getEndUser(_0x18fb07,_0x49113c[_0xf1dd('0x58')],_0x49113c['calleridnum'],_0x396e68);})['then'](function(_0x186426){_0x1e2563=_0x186426;logger[_0xf1dd('0xb')](_0xf1dd('0x5a'),_0x1e2563['id']);return getTicket(_0x18fb07,_0x2ff8d6,_0x1e2563,_0x274cb1,_0x49113c,_0x274cb1[_0xf1dd('0x5b')],_0x396e68,'Inbound');})[_0xf1dd('0x38')](function(_0x58a8ed){_0x5bea97=_0x58a8ed;logger[_0xf1dd('0xb')](_0xf1dd('0x5c'));logger['info'](_0xf1dd('0x6d'),_0x5bea97['id']);return setRelationship(_0x396e68,_0x2ff8d6,_0x5bea97,_0xf1dd('0x5d'));})[_0xf1dd('0x38')](function(){return setRelationship(_0x396e68,_0x1e2563,_0x5bea97,_0xf1dd('0x5e'));})['then'](function(){return getServerInfo(_0x396e68);})[_0xf1dd('0x6f')](function(_0x194aa7){logger[_0xf1dd('0x66')]('['+_0x49113c[_0xf1dd('0x70')][_0xf1dd('0x71')]()+']',JSON[_0xf1dd('0x20')](_0x194aa7));});}; \ No newline at end of file +var _0x70b7=['users','error','unmanaged','uri','lastevent','toUpperCase','calleridname','calleridnum','Ticket\x20created!','request-promise','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','POST','emit','info','Creating\x20new\x20ticket...','Subjects','created_by','description','getString','date_start','toISOString','slice','replace','duration_minutes','parent_id','Contacts','parent_name','name','direction','length','forEach','variableName','push','JSON','Calls','format','Basic\x20%s','toString','get_server_info','Getting\x20agent\x20with\x20name','stringify','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','entry_list','find','name_value_list','user_name','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','then','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','idField','variable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Fields','Outbound'];(function(_0x18ae58,_0x242c57){var _0x37dd9e=function(_0x2b2d6f){while(--_0x2b2d6f){_0x18ae58['push'](_0x18ae58['shift']());}};_0x37dd9e(++_0x242c57);}(_0x70b7,0x1e9));var _0x770b=function(_0x3cf4d3,_0x48065e){_0x3cf4d3=_0x3cf4d3-0x0;var _0x4e547b=_0x70b7[_0x3cf4d3];return _0x4e547b;};'use strict';var _=require('lodash');var rp=require(_0x770b('0x0'));var BPromise=require('bluebird');var md5=require(_0x770b('0x1'));var util=require(_0x770b('0x2'));var Redis=require(_0x770b('0x3'));var intUtil=require(_0x770b('0x4'));var config=require(_0x770b('0x5'));var logger=require('../../../../config/logger')('sugarcrm');config[_0x770b('0x6')]=_[_0x770b('0x7')](config['redis'],{'host':_0x770b('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':_0x770b('0x9'),'json':!![]};function emit(_0x5d8632,_0x40bea8,_0x4533d4){io['to'](_0x5d8632)[_0x770b('0xa')](_0x40bea8,_0x4533d4);}function getTicket(_0x164dcd,_0x1e77e9,_0x3ab5bf,_0x3cce32,_0x25addf,_0x3b9b8d,_0x1cd372,_0x36dd47){logger[_0x770b('0xb')](_0x770b('0xc'));var _0x5ce683=new Date();var _0x34e268=[{'name':'name','value':intUtil['getString'](_0x3cce32[_0x770b('0xd')],_0x25addf,'\x20')},{'name':'assigned_user_id','value':_0x1e77e9['id']},{'name':_0x770b('0xe'),'value':_0x1e77e9['id']},{'name':_0x770b('0xf'),'value':intUtil[_0x770b('0x10')](_0x3cce32['Descriptions'],_0x25addf,'\x0a')},{'name':_0x770b('0x11'),'value':_0x5ce683[_0x770b('0x12')]()[_0x770b('0x13')](0x0,0x13)[_0x770b('0x14')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x770b('0x15'),'value':'15'},{'name':_0x770b('0x16'),'value':_0x3ab5bf['id']},{'name':'parent_type','value':_0x770b('0x17')},{'name':_0x770b('0x18'),'value':_0x3ab5bf[_0x770b('0x19')]},{'name':_0x770b('0x1a'),'value':_0x36dd47}];if(_0x3b9b8d[_0x770b('0x1b')]){_[_0x770b('0x1c')](_0x3b9b8d,function(_0x60e94c){if(_0x25addf[_0x60e94c[_0x770b('0x1d')]]){_0x34e268[_0x770b('0x1e')]({'name':_0x60e94c['idField'],'value':_0x25addf[_0x60e94c['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':_0x770b('0x1f'),'response_type':_0x770b('0x1f'),'rest_data':JSON['stringify']({'session':_0x1cd372['id'],'module_name':_0x770b('0x20'),'name_value_list':_0x34e268})}});}function getAuth(_0x4fd438){return util[_0x770b('0x21')](_0x770b('0x22'),new Buffer(_0x4fd438['apiKey']+':X')[_0x770b('0x23')]('base64'));}function getServerInfo(_0x21862a){return request({'form':{'method':_0x770b('0x24'),'input_type':_0x770b('0x1f'),'response_type':_0x770b('0x1f'),'rest_data':JSON['stringify']({'session':_0x21862a['id']})}});}function getUser(_0x3d6613,_0x3fcd5f,_0x575eb2){if(!_['isNil'](_0x3fcd5f)){logger['info'](_0x770b('0x25'),_0x3fcd5f);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x770b('0x1f'),'rest_data':JSON[_0x770b('0x26')]({'session':_0x575eb2['id'],'module_name':_0x770b('0x27'),'query':util[_0x770b('0x21')](_0x770b('0x28'),_0x3fcd5f),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0xd57aab){if(_0xd57aab[_0x770b('0x29')][_0x770b('0x1b')]){var _0x33ff06=_[_0x770b('0x2a')](_0xd57aab[_0x770b('0x29')],function(_0x3cc9b9){return _0x3cc9b9[_0x770b('0x2b')][_0x770b('0x2c')][_0x770b('0x2d')]===_0x3fcd5f;});if(_0x33ff06){logger[_0x770b('0xb')](_0x770b('0x2e'));return BPromise['resolve']({'id':_0x33ff06['name_value_list']['id'][_0x770b('0x2d')],'name':_0x33ff06[_0x770b('0x2b')][_0x770b('0x19')][_0x770b('0x2d')]});}}logger[_0x770b('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x770b('0x2f')]({'id':_0x575eb2['name_value_list'][_0x770b('0x30')][_0x770b('0x2d')],'name':_0x575eb2[_0x770b('0x2b')][_0x770b('0x2c')][_0x770b('0x2d')]});});}else{logger['info'](_0x770b('0x31'));return BPromise[_0x770b('0x2f')]({'id':_0x575eb2[_0x770b('0x2b')][_0x770b('0x30')][_0x770b('0x2d')],'name':_0x575eb2[_0x770b('0x2b')][_0x770b('0x2c')][_0x770b('0x2d')]});}}function getEndUser(_0x22aec9,_0x2380bf,_0x1a9bca,_0x44b15e){logger[_0x770b('0xb')](_0x770b('0x32'),_0x1a9bca);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x770b('0x1f'),'rest_data':JSON[_0x770b('0x26')]({'session':_0x44b15e['id'],'module_name':'Contacts','query':util[_0x770b('0x21')](_0x770b('0x33'),_0x1a9bca),'order_by':'','offset':'0','select_fields':['id',_0x770b('0x19'),_0x770b('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x2195f7){if(_0x2195f7[_0x770b('0x29')][_0x770b('0x1b')]){var _0x305e70=_['find'](_0x2195f7[_0x770b('0x29')],function(_0x52393b){return _0x52393b[_0x770b('0x2b')][_0x770b('0x34')][_0x770b('0x2d')]===_0x1a9bca;});if(_0x305e70){logger['info'](_0x770b('0x35'));return BPromise[_0x770b('0x2f')]({'id':_0x305e70[_0x770b('0x2b')]['id'][_0x770b('0x2d')],'name':_0x305e70[_0x770b('0x2b')]['name'][_0x770b('0x2d')],'phone':_0x305e70[_0x770b('0x2b')][_0x770b('0x34')][_0x770b('0x2d')]});}}else{logger[_0x770b('0xb')](_0x770b('0x36'));return request({'form':{'method':_0x770b('0x37'),'input_type':_0x770b('0x1f'),'response_type':_0x770b('0x1f'),'rest_data':JSON[_0x770b('0x26')]({'session':_0x44b15e['id'],'module_name':_0x770b('0x17'),'name_value_list':[{'name':_0x770b('0x38'),'value':_0x2380bf!==_0x770b('0x39')?_0x2380bf:util['format'](_0x770b('0x3a'),_0x1a9bca)},{'name':_0x770b('0x34'),'value':_0x1a9bca}]})}})[_0x770b('0x3b')](function(_0xf73ce6){logger[_0x770b('0xb')](_0x770b('0x3c'));return BPromise['resolve']({'id':_0xf73ce6['id'],'name':_0xf73ce6[_0x770b('0x29')][_0x770b('0x38')][_0x770b('0x2d')],'phone':_0xf73ce6[_0x770b('0x29')][_0x770b('0x34')][_0x770b('0x2d')]});});}});}function request(_0x1cffe0){logger[_0x770b('0x3d')](_0x770b('0x3e'),JSON['stringify'](_0x1cffe0));return rp(_[_0x770b('0x3f')](def,_0x1cffe0));}function getTags(_0x55e175,_0x14b303){var _0x4b024d=[];if(_0x55e175&&_0x55e175[_0x770b('0x1b')]>0x0){_0x4b024d=_[_0x770b('0x40')](_0x55e175,_0x14b303);}return _0x4b024d;}function getCustomFields(_0x46952a,_0x24a7f6){var _0xe32df=[];var _0x4b9a4d={'custom_fields':[]};if(_0x46952a['length']>0x0){_[_0x770b('0x1c')](_0x46952a,function(_0x454432){if(_0x454432[_0x770b('0x41')]===_0x770b('0x42')&&_0x454432[_0x770b('0x43')]&&!_0x454432[_0x770b('0x44')]){_0x4b9a4d[_0x454432[_0x770b('0x43')][_0x770b('0x45')]()]=_0x454432[_0x770b('0x46')]['toString']();}else if(_0x454432[_0x770b('0x41')]===_0x770b('0x42')&&_0x454432['idField']&&_0x454432[_0x770b('0x44')]){_0x4b9a4d[_0x770b('0x47')][_0x770b('0x1e')]({'id':_0x454432[_0x770b('0x48')],'value':_0x454432['content'][_0x770b('0x23')]()});}else if(_0x454432[_0x770b('0x41')]===_0x770b('0x49')&&_0x454432[_0x770b('0x1d')]&&_0x454432['idField']&&_0x454432[_0x770b('0x44')]){_0x24a7f6[_0x454432[_0x770b('0x1d')]]&&_0x4b9a4d[_0x770b('0x47')]['push']({'id':_0x454432['idField'],'value':_0x24a7f6[_0x454432[_0x770b('0x1d')]]['toString']()});}else if(_0x454432[_0x770b('0x41')]==='customVariable'&&_0x454432[_0x770b('0x4a')]&&_0x454432[_0x770b('0x4a')]['name']&&_0x454432[_0x770b('0x48')]&&_0x454432[_0x770b('0x44')]){_0x24a7f6[_0x454432[_0x770b('0x4a')]['name']['toLowerCase']()]&&_0x4b9a4d[_0x770b('0x47')][_0x770b('0x1e')]({'id':_0x454432[_0x770b('0x48')],'value':_0x24a7f6[_0x454432[_0x770b('0x4a')][_0x770b('0x19')][_0x770b('0x45')]()][_0x770b('0x23')]()});}});}return _0x4b9a4d;}function getConnection(_0x123136){return request({'method':'POST','form':{'method':_0x770b('0x4b'),'input_type':'JSON','response_type':_0x770b('0x1f'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x123136['username'],'password':_0x123136[_0x770b('0x4c')],'encryption':_0x770b('0x4d')},'application':_0x770b('0x4e')})}})[_0x770b('0x3b')](function(_0x5d3d24){var _0x468dd0=_0x5d3d24;if(_0x468dd0['id']){def[_0x770b('0x4f')]=_0x468dd0['id'];return BPromise[_0x770b('0x2f')](_0x468dd0);}else{throw new Error(util['format'](_0x770b('0x50'),_0x123136['id']));}});}function setRelationship(_0x3b7c6e,_0x528a7a,_0x4bc451,_0x3c65c4){return request({'form':{'method':'set_relationship','input_type':_0x770b('0x1f'),'response_type':_0x770b('0x1f'),'rest_data':JSON[_0x770b('0x26')]({'session':_0x3b7c6e['id'],'module_name':_0x770b('0x20'),'module_id':_0x4bc451['id'],'link_field_name':_0x3c65c4,'related_ids':[_0x528a7a['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x770b('0x51')]=function(_0xd53d13,_0x507f34,_0x4a4f01,_0x486edc,_0x1b2b01,_0x5c0fbb){var _0x5b3c12,_0x5b5d04,_0x176df4,_0x575f37;_0x5c0fbb[_0x770b('0x52')]=intUtil[_0x770b('0x53')](_0x5c0fbb['remoteUri']);_0x5c0fbb['serverUrl']=intUtil['stripTrailingSlash'](_0x5c0fbb[_0x770b('0x54')]);def['uri']=util[_0x770b('0x21')](_0x770b('0x55'),_0x5c0fbb[_0x770b('0x52')]);if(_0x1b2b01&&_0x1b2b01[_0x770b('0x56')]){logger[_0x770b('0xb')](_0x770b('0x57'),_0x770b('0x58'));_0x507f34[_0x770b('0x59')]=util['format'](_0x770b('0x5a'),_0x5c0fbb[_0x770b('0x54')],_0x507f34[_0x770b('0x5b')],md5(_0x507f34[_0x770b('0x5b')]));}else{_0x507f34[_0x770b('0x59')]='';}return getConnection(_0x5c0fbb)[_0x770b('0x3b')](function(_0x277b26){_0x575f37=_0x277b26;return getUser(_0x5c0fbb,_0x486edc[_0x770b('0x19')],_0x575f37);})[_0x770b('0x3b')](function(_0x4abe28){_0x5b3c12=_0x4abe28;logger[_0x770b('0xb')]('The\x20User\x20ID\x20is:',_0x5b3c12['id']);return getEndUser(_0x5c0fbb,_0x507f34['calleridname'],_0x507f34['calleridnum'],_0x575f37);})[_0x770b('0x3b')](function(_0x4a9a0d){_0x5b5d04=_0x4a9a0d;logger[_0x770b('0xb')](_0x770b('0x5c'),_0x5b5d04['id']);return getTicket(_0x5c0fbb,_0x5b3c12,_0x5b5d04,_0x4a4f01,_0x507f34,_0x4a4f01['Fields'],_0x575f37,'Inbound');})['then'](function(_0x22eac5){_0x176df4=_0x22eac5;logger[_0x770b('0xb')]('Ticket\x20created!');logger[_0x770b('0xb')](_0x770b('0x5d'),_0x176df4['id']);return setRelationship(_0x575f37,_0x5b3c12,_0x176df4,'users');})['then'](function(){return setRelationship(_0x575f37,_0x5b5d04,_0x176df4,_0x770b('0x5e'));})[_0x770b('0x3b')](function(){return getServerInfo(_0x575f37);})[_0x770b('0x3b')](function(_0x41136c){var _0x5c9475=parseInt(_0x41136c[_0x770b('0x5f')][_0x770b('0x60')](0x0));var _0x2a24f1=util[_0x770b('0x21')](_0x770b('0x61'),_0x5c0fbb['remoteUri'],_0x176df4['id']);if(_0x5c9475>0x6){_0x2a24f1=util[_0x770b('0x21')](_0x770b('0x62'),_0x5c0fbb[_0x770b('0x52')],_0x176df4['id']);}logger['info']('[QUEUE]',_0x770b('0x63'));emit(util[_0x770b('0x21')](_0x770b('0x64'),_0x486edc[_0x770b('0x19')]),_0x770b('0x65'),{'uri':_0x2a24f1});})[_0x770b('0x66')](function(_0x17731b){logger['error']('[QUEUE]',JSON[_0x770b('0x26')](_0x17731b));});};exports[_0x770b('0x67')]=function(_0xdc3dc6,_0x1f0be0,_0x5d740f,_0x30628f,_0x2d7603,_0x4d34ae,_0x404087){var _0x12fb34,_0x41f076,_0x570132,_0x3a0f12;_0x4d34ae[_0x770b('0x52')]=intUtil['stripTrailingSlash'](_0x4d34ae[_0x770b('0x52')]);_0x4d34ae[_0x770b('0x54')]=intUtil[_0x770b('0x53')](_0x4d34ae['serverUrl']);def['uri']=util['format'](_0x770b('0x55'),_0x4d34ae[_0x770b('0x52')]);if(_0x404087&&_0x404087[_0x770b('0x68')]&&_0x404087[_0x770b('0x68')]!=='none'){logger[_0x770b('0xb')](_0x770b('0x69'),'Recording\x20is\x20enabled!');_0x1f0be0[_0x770b('0x59')]=util[_0x770b('0x21')](_0x770b('0x5a'),_0x4d34ae[_0x770b('0x54')],_0x1f0be0[_0x770b('0x5b')],md5(_0x1f0be0[_0x770b('0x5b')]));}return getConnection(_0x4d34ae)[_0x770b('0x3b')](function(_0x35e638){_0x3a0f12=_0x35e638;return getUser(_0x4d34ae,_0x30628f['name'],_0x3a0f12);})[_0x770b('0x3b')](function(_0x4780d0){_0x12fb34=_0x4780d0;logger[_0x770b('0xb')](_0x770b('0x6a'),_0x12fb34['id']);return getEndUser(_0x4d34ae,_0x1f0be0[_0x770b('0x6b')],_0x1f0be0[_0x770b('0x6c')],_0x3a0f12);})['then'](function(_0x976a3a){_0x41f076=_0x976a3a;logger[_0x770b('0xb')]('The\x20Enduser\x20ID\x20is:',_0x41f076['id']);return getTicket(_0x4d34ae,_0x12fb34,_0x41f076,_0x5d740f,_0x1f0be0,_0x5d740f[_0x770b('0x6d')],_0x3a0f12,_0x770b('0x6e'));})[_0x770b('0x3b')](function(_0x24d6fd){_0x570132=_0x24d6fd;logger['info']('Ticket\x20created!');logger['info'](_0x770b('0x5d'),_0x570132['id']);return setRelationship(_0x3a0f12,_0x12fb34,_0x570132,_0x770b('0x6f'));})[_0x770b('0x3b')](function(){return setRelationship(_0x3a0f12,_0x41f076,_0x570132,_0x770b('0x5e'));})['then'](function(){return getServerInfo(_0x3a0f12);})['then'](function(_0x4cb57f){var _0x3f7c3b=parseInt(_0x4cb57f[_0x770b('0x5f')]['charAt'](0x0));var _0x100fa5=util[_0x770b('0x21')](_0x770b('0x61'),_0x4d34ae[_0x770b('0x52')],_0x570132['id']);if(_0x3f7c3b>0x6){_0x100fa5=util[_0x770b('0x21')](_0x770b('0x62'),_0x4d34ae[_0x770b('0x52')],_0x570132['id']);}logger[_0x770b('0xb')]('[OUTBOUND]',_0x770b('0x63'));emit(util[_0x770b('0x21')](_0x770b('0x64'),_0x30628f[_0x770b('0x19')]),'trigger:browser:url',{'uri':_0x100fa5});})[_0x770b('0x66')](function(_0x4e61d6){logger[_0x770b('0x70')](_0x770b('0x69'),JSON[_0x770b('0x26')](_0x4e61d6));});};exports[_0x770b('0x71')]=function(_0x4681d3,_0x2e7dbe,_0x224012,_0x35b04c,_0x55cdb5,_0x474c17){var _0x22041c,_0x2cfec8,_0xe484f8,_0xed7c9;_0x474c17[_0x770b('0x52')]=intUtil[_0x770b('0x53')](_0x474c17[_0x770b('0x52')]);_0x474c17['serverUrl']=intUtil[_0x770b('0x53')](_0x474c17[_0x770b('0x54')]);def[_0x770b('0x72')]=util['format'](_0x770b('0x55'),_0x474c17['remoteUri']);if(_0x55cdb5&&_0x55cdb5[_0x770b('0x56')]){logger[_0x770b('0xb')]('['+_0x2e7dbe[_0x770b('0x73')][_0x770b('0x74')]()+']',_0x770b('0x58'));_0x2e7dbe[_0x770b('0x59')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x474c17[_0x770b('0x54')],_0x2e7dbe[_0x770b('0x5b')],md5(_0x2e7dbe[_0x770b('0x5b')]));}else{_0x2e7dbe[_0x770b('0x59')]='';}return getConnection(_0x474c17)[_0x770b('0x3b')](function(_0x5bac36){_0xed7c9=_0x5bac36;if(!_['isNil'](_0x35b04c)){return getUser(_0x474c17,_0x35b04c[_0x770b('0x19')],_0xed7c9);}else{return getUser(_0x474c17,null,_0xed7c9);}})[_0x770b('0x3b')](function(_0x2922e9){_0x22041c=_0x2922e9;logger[_0x770b('0xb')]('The\x20User\x20ID\x20is:',_0x22041c['id']);return getEndUser(_0x474c17,_0x2e7dbe[_0x770b('0x75')],_0x2e7dbe[_0x770b('0x76')],_0xed7c9);})[_0x770b('0x3b')](function(_0x42a91f){_0x2cfec8=_0x42a91f;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2cfec8['id']);return getTicket(_0x474c17,_0x22041c,_0x2cfec8,_0x224012,_0x2e7dbe,_0x224012[_0x770b('0x6d')],_0xed7c9,'Inbound');})['then'](function(_0x453f9c){_0xe484f8=_0x453f9c;logger[_0x770b('0xb')](_0x770b('0x77'));logger[_0x770b('0xb')](_0x770b('0x5d'),_0xe484f8['id']);return setRelationship(_0xed7c9,_0x22041c,_0xe484f8,'users');})[_0x770b('0x3b')](function(){return setRelationship(_0xed7c9,_0x2cfec8,_0xe484f8,_0x770b('0x5e'));})['then'](function(){return getServerInfo(_0xed7c9);})[_0x770b('0x66')](function(_0x2fb89c){logger[_0x770b('0x70')]('['+_0x2e7dbe['lastevent'][_0x770b('0x74')]()+']',JSON[_0x770b('0x26')](_0x2fb89c));});}; \ 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 b57503b..465884b 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 _0xf904=['customVariable','Variable','toLowerCase','keyType','string','format','%s:\x20%s','key','keyContent','name','stripTrailingSlash','slice','substring','validateEmail','isNil','test','util','getString','length','sortBy','push','content','type','variable','variableName','toString'];(function(_0x15ffe6,_0x590d76){var _0x681bb4=function(_0x178ad4){while(--_0x178ad4){_0x15ffe6['push'](_0x15ffe6['shift']());}};_0x681bb4(++_0x590d76);}(_0xf904,0xfa));var _0x4f90=function(_0x946156,_0x4902e0){_0x946156=_0x946156-0x0;var _0x5a7488=_0xf904[_0x946156];return _0x5a7488;};'use strict';var _=require('lodash');var util=require(_0x4f90('0x0'));exports[_0x4f90('0x1')]=function(_0x49cc4e,_0x4f92d4,_0x572b89){var _0x43777a=[];if(_0x49cc4e[_0x4f90('0x2')]>0x0){var _0x300cbe=_[_0x4f90('0x3')](_0x49cc4e,['id']);for(var _0x5b5106=0x0;_0x5b5106<_0x300cbe['length'];_0x5b5106++){var _0x1d8686=_0x300cbe[_0x5b5106];if(_0x1d8686['type']==='string'){_0x43777a[_0x4f90('0x4')](_0x1d8686[_0x4f90('0x5')]);}else if(_0x1d8686[_0x4f90('0x6')]===_0x4f90('0x7')&&_0x1d8686['variableName']){_0x4f92d4[_0x1d8686['variableName']]&&_0x43777a[_0x4f90('0x4')](_0x4f92d4[_0x1d8686[_0x4f90('0x8')]][_0x4f90('0x9')]());}else if(_0x1d8686[_0x4f90('0x6')]===_0x4f90('0xa')&&_0x1d8686['Variable']&&_0x1d8686[_0x4f90('0xb')]['name']){_0x4f92d4[_0x1d8686['Variable']['name'][_0x4f90('0xc')]()]&&_0x43777a[_0x4f90('0x4')](_0x4f92d4[_0x1d8686['Variable']['name']['toLowerCase']()][_0x4f90('0x9')]());}else if(_0x1d8686[_0x4f90('0x6')]==='keyValue'){if(_0x1d8686[_0x4f90('0xd')]===_0x4f90('0xe')&&_0x1d8686['key']){_0x43777a[_0x4f90('0x4')](util[_0x4f90('0xf')](_0x4f90('0x10'),_0x1d8686[_0x4f90('0x11')],_0x1d8686[_0x4f90('0x12')]));}else if(_0x1d8686[_0x4f90('0xd')]===_0x4f90('0x7')&&_0x1d8686[_0x4f90('0x8')]&&_0x1d8686[_0x4f90('0x11')]){_0x4f92d4[_0x1d8686['variableName']]&&_0x43777a['push'](util[_0x4f90('0xf')]('%s:\x20%s',_0x1d8686[_0x4f90('0x11')],_0x4f92d4[_0x1d8686[_0x4f90('0x8')]]));}else if(_0x1d8686['keyType']==='customVariable'&&_0x1d8686[_0x4f90('0xb')]&&_0x1d8686[_0x4f90('0xb')][_0x4f90('0x13')]&&_0x1d8686['key']){_0x4f92d4[_0x1d8686[_0x4f90('0xb')][_0x4f90('0x13')]['toLowerCase']()]&&_0x43777a[_0x4f90('0x4')](util['format'](_0x4f90('0x10'),_0x1d8686[_0x4f90('0x11')],_0x4f92d4[_0x1d8686['Variable'][_0x4f90('0x13')][_0x4f90('0xc')]()]));}}}}return _0x43777a['join'](_0x572b89);};exports[_0x4f90('0x14')]=function(_0x5f324f){var _0x155569=_0x5f324f[_0x4f90('0x15')](-0x1);if(_0x155569==='/'){_0x5f324f=_0x5f324f[_0x4f90('0x16')](0x0,_0x5f324f['lastIndexOf'](_0x155569));}return _0x5f324f;};exports[_0x4f90('0x17')]=function(_0x5e2ad4){if(!_[_0x4f90('0x18')](_0x5e2ad4)&&_0x5e2ad4!==''){var _0x17f051=/^(([^<>()\[\]\\.,;:\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 _0x17f051[_0x4f90('0x19')](String(_0x5e2ad4)[_0x4f90('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x21b7=['substring','lastIndexOf','isNil','test','lodash','getString','sortBy','length','type','string','push','content','variable','variableName','toString','Variable','name','toLowerCase','keyValue','key','format','%s:\x20%s','keyContent','keyType','customVariable','join'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x21b7,0x122));var _0x721b=function(_0x4830f5,_0x2d047c){_0x4830f5=_0x4830f5-0x0;var _0x2d3080=_0x21b7[_0x4830f5];return _0x2d3080;};'use strict';var _=require(_0x721b('0x0'));var util=require('util');exports[_0x721b('0x1')]=function(_0x500a2a,_0x11ca07,_0x231ea2){var _0x3ebf09=[];if(_0x500a2a['length']>0x0){var _0x36d985=_[_0x721b('0x2')](_0x500a2a,['id']);for(var _0x399ad3=0x0;_0x399ad3<_0x36d985[_0x721b('0x3')];_0x399ad3++){var _0x2f36ff=_0x36d985[_0x399ad3];if(_0x2f36ff[_0x721b('0x4')]===_0x721b('0x5')){_0x3ebf09[_0x721b('0x6')](_0x2f36ff[_0x721b('0x7')]);}else if(_0x2f36ff['type']===_0x721b('0x8')&&_0x2f36ff[_0x721b('0x9')]){_0x11ca07[_0x2f36ff[_0x721b('0x9')]]&&_0x3ebf09[_0x721b('0x6')](_0x11ca07[_0x2f36ff[_0x721b('0x9')]][_0x721b('0xa')]());}else if(_0x2f36ff['type']==='customVariable'&&_0x2f36ff[_0x721b('0xb')]&&_0x2f36ff['Variable']['name']){_0x11ca07[_0x2f36ff[_0x721b('0xb')][_0x721b('0xc')][_0x721b('0xd')]()]&&_0x3ebf09[_0x721b('0x6')](_0x11ca07[_0x2f36ff['Variable']['name'][_0x721b('0xd')]()][_0x721b('0xa')]());}else if(_0x2f36ff[_0x721b('0x4')]===_0x721b('0xe')){if(_0x2f36ff['keyType']===_0x721b('0x5')&&_0x2f36ff[_0x721b('0xf')]){_0x3ebf09['push'](util[_0x721b('0x10')](_0x721b('0x11'),_0x2f36ff[_0x721b('0xf')],_0x2f36ff[_0x721b('0x12')]));}else if(_0x2f36ff[_0x721b('0x13')]===_0x721b('0x8')&&_0x2f36ff['variableName']&&_0x2f36ff[_0x721b('0xf')]){_0x11ca07[_0x2f36ff['variableName']]&&_0x3ebf09[_0x721b('0x6')](util[_0x721b('0x10')]('%s:\x20%s',_0x2f36ff[_0x721b('0xf')],_0x11ca07[_0x2f36ff[_0x721b('0x9')]]));}else if(_0x2f36ff[_0x721b('0x13')]===_0x721b('0x14')&&_0x2f36ff[_0x721b('0xb')]&&_0x2f36ff[_0x721b('0xb')]['name']&&_0x2f36ff[_0x721b('0xf')]){_0x11ca07[_0x2f36ff['Variable'][_0x721b('0xc')]['toLowerCase']()]&&_0x3ebf09[_0x721b('0x6')](util[_0x721b('0x10')](_0x721b('0x11'),_0x2f36ff[_0x721b('0xf')],_0x11ca07[_0x2f36ff[_0x721b('0xb')][_0x721b('0xc')][_0x721b('0xd')]()]));}}}}return _0x3ebf09[_0x721b('0x15')](_0x231ea2);};exports['stripTrailingSlash']=function(_0xb0a9e2){var _0x43f0b0=_0xb0a9e2['slice'](-0x1);if(_0x43f0b0==='/'){_0xb0a9e2=_0xb0a9e2[_0x721b('0x16')](0x0,_0xb0a9e2[_0x721b('0x17')](_0x43f0b0));}return _0xb0a9e2;};exports['validateEmail']=function(_0x33fe9c){if(!_[_0x721b('0x18')](_0x33fe9c)&&_0x33fe9c!==''){var _0x1bb2b7=/^(([^<>()\[\]\\.,;:\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 _0x1bb2b7[_0x721b('0x19')](String(_0x33fe9c)[_0x721b('0xd')]());}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 71ff0bb..3b2ead6 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 _0xb03f=['userId','admin','getUser','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','POST','Contacts','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[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','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','type','string','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','merge','Open','getString','Descriptions','format','%s/webservice.php','remoteUri','create','username','sessionName','stringify','then','success','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','info','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name'];(function(_0x543181,_0x33e32e){var _0x32404a=function(_0x22e9c3){while(--_0x22e9c3){_0x543181['push'](_0x543181['shift']());}};_0x32404a(++_0x33e32e);}(_0xb03f,0x160));var _0xfb03=function(_0x17a32f,_0x5a51a){_0x17a32f=_0x17a32f-0x0;var _0x15a293=_0xb03f[_0x17a32f];return _0x15a293;};'use strict';var _=require(_0xfb03('0x0'));var rp=require(_0xfb03('0x1'));var BPromise=require(_0xfb03('0x2'));var md5=require('md5');var util=require(_0xfb03('0x3'));var Redis=require(_0xfb03('0x4'));var intUtil=require(_0xfb03('0x5'));var config=require(_0xfb03('0x6'));var logger=require(_0xfb03('0x7'))(_0xfb03('0x8'));config[_0xfb03('0x9')]=_[_0xfb03('0xa')](config[_0xfb03('0x9')],{'host':_0xfb03('0xb'),'port':0x18eb});var io=require(_0xfb03('0xc'))(new Redis(config[_0xfb03('0x9')]));function emit(_0xf0514e,_0x22a69c,_0x9b1a02){io['to'](_0xf0514e)[_0xfb03('0xd')](_0x22a69c,_0x9b1a02);}function getCustomFields(_0x58ce01,_0x4409d2){var _0x30ea37={};if(_0x58ce01[_0xfb03('0xe')]>0x0){_[_0xfb03('0xf')](_0x58ce01,function(_0x3701de){if(_0x3701de[_0xfb03('0x10')]===_0xfb03('0x11')&&_0x3701de[_0xfb03('0x12')]){_0x30ea37[_0x3701de[_0xfb03('0x12')]]=_0x3701de[_0xfb03('0x13')]['toString']();}else if(_0x3701de['type']===_0xfb03('0x14')&&_0x3701de['variableName']&&_0x3701de[_0xfb03('0x12')]&&_0x4409d2[_0x3701de[_0xfb03('0x15')]]){_0x30ea37[_0x3701de[_0xfb03('0x12')]]=_0x4409d2[_0x3701de[_0xfb03('0x15')]][_0xfb03('0x16')]();}else if(_0x3701de[_0xfb03('0x10')]===_0xfb03('0x17')&&_0x3701de['Variable']&&_0x3701de[_0xfb03('0x18')][_0xfb03('0x19')]&&_0x3701de['idField']&&_0x4409d2[_0x3701de[_0xfb03('0x18')][_0xfb03('0x19')][_0xfb03('0x1a')]()]){_0x30ea37[_0x3701de[_0xfb03('0x12')]]=_0x4409d2[_0x3701de[_0xfb03('0x18')][_0xfb03('0x19')][_0xfb03('0x1a')]()][_0xfb03('0x16')]();}});}return _0x30ea37;}function createTicket(_0x1c1b6e,_0x9e0435,_0xbb534b,_0x28c646,_0x223e6b,_0x2b841c,_0x1746d1){logger['info']('Creating\x20new\x20ticket...');var _0x194e93=_[_0xfb03('0x1b')]({'parent_id':'','assigned_user_id':_0x9e0435['id'],'ticketpriorities':'Normal','ticketstatus':_0xfb03('0x1c'),'ticket_title':intUtil[_0xfb03('0x1d')](_0x28c646['Subjects'],_0x223e6b,'\x20'),'description':intUtil[_0xfb03('0x1d')](_0x28c646[_0xfb03('0x1e')],_0x223e6b,'\x0a'),'contact_id':_0xbb534b['id']},getCustomFields(_0x2b841c,_0x223e6b));var _0x238102={'method':'POST','uri':util[_0xfb03('0x1f')](_0xfb03('0x20'),_0x1c1b6e[_0xfb03('0x21')]),'form':{'operation':_0xfb03('0x22'),'username':_0x1c1b6e[_0xfb03('0x23')],'sessionName':_0x1746d1[_0xfb03('0x24')],'elementType':'HelpDesk','element':JSON[_0xfb03('0x25')](_0x194e93)},'json':!![]};return request(_0x238102)[_0xfb03('0x26')](function(_0x1bfbc2){if(_0x1bfbc2[_0xfb03('0x27')]){return BPromise['resolve']({'id':_0x1bfbc2['result']['id']});}else{throw new Error(util[_0xfb03('0x1f')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0xfb03('0x25')](_0x1bfbc2[_0xfb03('0x28')])));}})[_0xfb03('0x29')](function(_0x16d30a){var _0x2677d1=_0x16d30a[_0xfb03('0x2a')]||0x1f4;logger[_0xfb03('0x28')](_0xfb03('0x2b'),'createTicket',_0x2677d1,JSON[_0xfb03('0x25')](_0x16d30a));});}function getUser(_0x233bde,_0x5217f5,_0x3dd3c7){if(intUtil[_0xfb03('0x2c')](_0x5217f5)){logger[_0xfb03('0x2d')](_0xfb03('0x2e'),_0x5217f5);return request({'method':_0xfb03('0x2f'),'uri':util[_0xfb03('0x1f')](_0xfb03('0x20'),_0x233bde[_0xfb03('0x21')]),'qs':{'operation':_0xfb03('0x30'),'username':_0x233bde[_0xfb03('0x23')],'sessionName':_0x3dd3c7[_0xfb03('0x24')],'query':util[_0xfb03('0x1f')](_0xfb03('0x31'),_0x5217f5)},'json':!![]})[_0xfb03('0x26')](function(_0x480277){if(_0x480277[_0xfb03('0x27')]&&_0x480277[_0xfb03('0x32')][_0xfb03('0xe')]){logger[_0xfb03('0x2d')](_0xfb03('0x33'));return BPromise[_0xfb03('0x34')]({'id':_0x480277[_0xfb03('0x32')][0x0]['id'],'email':_0x480277[_0xfb03('0x32')][0x0][_0xfb03('0x35')],'name':_0x480277[_0xfb03('0x32')][0x0][_0xfb03('0x36')]+'\x20'+_0x480277[_0xfb03('0x32')][_0xfb03('0x37')]});}else{logger[_0xfb03('0x2d')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xfb03('0x34')]({'id':_0x3dd3c7[_0xfb03('0x38')],'email':_0x233bde[_0xfb03('0x23')],'name':_0xfb03('0x39')});}})[_0xfb03('0x29')](function(_0x257e4e){var _0x5686de=_0x257e4e[_0xfb03('0x2a')]||0x1f4;logger[_0xfb03('0x28')](_0xfb03('0x2b'),_0xfb03('0x3a'),_0x5686de,JSON[_0xfb03('0x25')](_0x257e4e));});}else{logger[_0xfb03('0x2d')](_0xfb03('0x3b'));return BPromise[_0xfb03('0x34')]({'id':_0x3dd3c7['userId'],'email':_0x233bde[_0xfb03('0x23')],'name':_0xfb03('0x39')})[_0xfb03('0x29')](function(_0xa4781a){var _0x354194=_0xa4781a['statusCode']||0x1f4;logger[_0xfb03('0x28')](_0xfb03('0x2b'),_0xfb03('0x3a'),_0x354194,JSON[_0xfb03('0x25')](_0xa4781a));});}}function getEndUser(_0x21babe,_0x5801f6,_0x125202,_0x363357){logger[_0xfb03('0x2d')](_0xfb03('0x3c'),_0x125202);return request({'method':'GET','uri':util[_0xfb03('0x1f')](_0xfb03('0x20'),_0x21babe['remoteUri']),'qs':{'operation':_0xfb03('0x30'),'username':_0x21babe['username'],'sessionName':_0x363357['sessionName'],'query':util[_0xfb03('0x1f')](_0xfb03('0x3d'),_0x125202,_0x125202,_0x125202,_0x125202,_0x125202)},'json':!![]})[_0xfb03('0x26')](function(_0x1f70cb){if(_0x1f70cb['success']&&_0x1f70cb['result'][_0xfb03('0xe')]){logger['info'](_0xfb03('0x3e'));return BPromise[_0xfb03('0x34')]({'id':_0x1f70cb[_0xfb03('0x32')][0x0]['id'],'name':_0x1f70cb[_0xfb03('0x32')][0x0][_0xfb03('0x3f')]+'\x20'+_0x1f70cb['result'][0x0][_0xfb03('0x40')],'phone':_0x125202});}else{logger[_0xfb03('0x2d')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0xfb03('0x41'),'uri':util[_0xfb03('0x1f')](_0xfb03('0x20'),_0x21babe[_0xfb03('0x21')]),'form':{'operation':_0xfb03('0x22'),'sessionName':_0x363357[_0xfb03('0x24')],'elementType':_0xfb03('0x42'),'element':JSON['stringify']({'lastname':_0x5801f6,'phone':_0x125202,'assigned_user_id':'\x20'})},'json':!![]})[_0xfb03('0x26')](function(_0x45f812){logger[_0xfb03('0x2d')]('Enduser\x20created.');return BPromise[_0xfb03('0x34')]({'id':_0x45f812[_0xfb03('0x32')]['id'],'name':_0x45f812['result'][_0xfb03('0x40')],'phone':_0x45f812[_0xfb03('0x32')][_0xfb03('0x43')]});})[_0xfb03('0x29')](function(_0x44392f){var _0x5229d7=_0x44392f[_0xfb03('0x2a')]||0x1f4;logger['error'](_0xfb03('0x2b'),_0xfb03('0x44'),_0x5229d7,JSON[_0xfb03('0x25')](_0x44392f));});}});}function getConnection(_0x39350c){var _0x176945=_0x39350c[_0xfb03('0x23')];var _0x47879f=_0x39350c[_0xfb03('0x45')];return request({'method':_0xfb03('0x2f'),'uri':util[_0xfb03('0x1f')](_0xfb03('0x20'),_0x39350c[_0xfb03('0x21')]),'qs':{'operation':_0xfb03('0x46'),'username':_0x176945},'json':!![]})['then'](function(_0x4ad75a){if(_0x4ad75a[_0xfb03('0x27')]){return request({'method':'POST','uri':util[_0xfb03('0x1f')](_0xfb03('0x20'),_0x39350c[_0xfb03('0x21')]),'form':{'operation':_0xfb03('0x47'),'username':_0x176945,'accessKey':md5(_0x4ad75a[_0xfb03('0x32')][_0xfb03('0x48')]+_0x47879f)},'json':!![]});}})[_0xfb03('0x26')](function(_0x45c164){if(_0x45c164[_0xfb03('0x27')]){return BPromise['resolve'](_0x45c164['result']);}else{throw new Error(util[_0xfb03('0x1f')](_0xfb03('0x49'),_0x39350c['id']));}})[_0xfb03('0x29')](function(_0x18d8a3){var _0x1b2547=_0x18d8a3[_0xfb03('0x2a')]||0x1f4;logger[_0xfb03('0x28')](_0xfb03('0x2b'),'getConnection',_0x1b2547,JSON['stringify'](_0x18d8a3));});}function request(_0x2df758){logger[_0xfb03('0x2d')](_0xfb03('0x4a'),JSON['stringify'](_0x2df758));return rp(_0x2df758);}exports[_0xfb03('0x4b')]=function(_0xe42488,_0x2d749f,_0x43edec,_0x229747,_0x21b514,_0x1915b3){var _0x3ab4ab,_0x5bf62e,_0xe016b7,_0x3105bc;_0x1915b3['remoteUri']=intUtil[_0xfb03('0x4c')](_0x1915b3['remoteUri']);if(_0x21b514&&_0x21b514[_0xfb03('0x4d')]){logger[_0xfb03('0x2d')](_0xfb03('0x4e'),'Recording\x20is\x20enabled!');_0x2d749f[_0xfb03('0x4f')]=util[_0xfb03('0x1f')](_0xfb03('0x50'),_0x1915b3[_0xfb03('0x51')],_0x2d749f[_0xfb03('0x52')],md5(_0x2d749f['uniqueid']));}else{_0x2d749f['recordingURL']='';}return getConnection(_0x1915b3)['then'](function(_0x3fb87d){_0x3105bc=_0x3fb87d;return getUser(_0x1915b3,_0x229747[_0xfb03('0x53')],_0x3105bc);})['then'](function(_0x43caef){_0x3ab4ab=_0x43caef;logger[_0xfb03('0x2d')](_0xfb03('0x54'),_0x3ab4ab['id']);return getEndUser(_0x1915b3,_0x2d749f[_0xfb03('0x55')],_0x2d749f['calleridnum'],_0x3105bc);})[_0xfb03('0x26')](function(_0x26a7aa){_0x5bf62e=_0x26a7aa;logger[_0xfb03('0x2d')](_0xfb03('0x56'),_0x5bf62e['id']);return createTicket(_0x1915b3,_0x3ab4ab,_0x5bf62e,_0x43edec,_0x2d749f,_0x43edec[_0xfb03('0x57')],_0x3105bc);})['then'](function(_0x526f30){_0xe016b7=_0x526f30;logger['info'](_0xfb03('0x58'));logger[_0xfb03('0x2d')]('The\x20Ticket\x20ID\x20is:',_0xe016b7['id']);var _0xe0d734=util[_0xfb03('0x1f')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x1915b3[_0xfb03('0x21')],_[_0xfb03('0x59')](_0xe016b7['id'],'x')[0x1]);logger['info'](_0xfb03('0x4e'),_0xfb03('0x5a'));emit(util[_0xfb03('0x1f')](_0xfb03('0x5b'),_0x229747[_0xfb03('0x19')]),_0xfb03('0x5c'),{'uri':_0xe0d734});})[_0xfb03('0x29')](function(_0x1a4051){logger[_0xfb03('0x28')](_0xfb03('0x4e'),JSON['stringify'](_0x1a4051));});};exports['outbound']=function(_0x4b5766,_0x5557ad,_0x295422,_0x3e786b,_0x497d61,_0x479ec7,_0x2feca9){var _0x1e17c6,_0x1af596,_0x2123fc,_0x4dc573;_0x479ec7['remoteUri']=intUtil[_0xfb03('0x4c')](_0x479ec7[_0xfb03('0x21')]);_0x479ec7[_0xfb03('0x51')]=intUtil[_0xfb03('0x4c')](_0x479ec7[_0xfb03('0x51')]);if(_0x2feca9&&_0x2feca9[_0xfb03('0x5d')]&&_0x2feca9[_0xfb03('0x5d')]!=='none'){logger[_0xfb03('0x2d')](_0xfb03('0x5e'),_0xfb03('0x5f'));_0x5557ad['recordingURL']=util[_0xfb03('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x479ec7[_0xfb03('0x51')],_0x5557ad['uniqueid'],md5(_0x5557ad[_0xfb03('0x52')]));}return getConnection(_0x479ec7)[_0xfb03('0x26')](function(_0x4f30d0){_0x4dc573=_0x4f30d0;return getUser(_0x479ec7,_0x3e786b['email'],_0x4dc573);})[_0xfb03('0x26')](function(_0x4b0482){_0x1e17c6=_0x4b0482;logger[_0xfb03('0x2d')](_0xfb03('0x54'),_0x1e17c6['id']);return getEndUser(_0x479ec7,_0x5557ad['destcalleridname'],_0x5557ad[_0xfb03('0x60')],_0x4dc573);})[_0xfb03('0x26')](function(_0x2b1913){_0x1af596=_0x2b1913;logger[_0xfb03('0x2d')]('The\x20Enduser\x20ID\x20is:',_0x1af596['id']);return createTicket(_0x479ec7,_0x1e17c6,_0x1af596,_0x295422,_0x5557ad,_0x295422[_0xfb03('0x57')],_0x4dc573);})[_0xfb03('0x26')](function(_0xeef430){_0x2123fc=_0xeef430;logger[_0xfb03('0x2d')](_0xfb03('0x58'));logger[_0xfb03('0x2d')](_0xfb03('0x61'),_0x2123fc['id']);var _0x156ff8=util[_0xfb03('0x1f')](_0xfb03('0x62'),_0x479ec7['remoteUri'],_[_0xfb03('0x59')](_0x2123fc['id'],'x')[0x1]);logger['info'](_0xfb03('0x5e'),_0xfb03('0x5a'));emit(util[_0xfb03('0x1f')](_0xfb03('0x5b'),_0x3e786b[_0xfb03('0x19')]),_0xfb03('0x5c'),{'uri':_0x156ff8});})[_0xfb03('0x29')](function(_0xde9912){logger['error'](_0xfb03('0x5e'),JSON[_0xfb03('0x25')](_0xde9912));});};exports[_0xfb03('0x63')]=function(_0x497795,_0x335377,_0x3a14d1,_0x36d2e9,_0x387546,_0x42b867){var _0x4b2130,_0x27ea7c,_0xa14418,_0xf2e897;_0x42b867[_0xfb03('0x21')]=intUtil[_0xfb03('0x4c')](_0x42b867[_0xfb03('0x21')]);_0x42b867[_0xfb03('0x51')]=intUtil[_0xfb03('0x4c')](_0x42b867[_0xfb03('0x51')]);if(_0x387546&&_0x387546[_0xfb03('0x4d')]){logger[_0xfb03('0x2d')]('['+_0x335377[_0xfb03('0x64')][_0xfb03('0x65')]()+']',_0xfb03('0x5f'));_0x335377[_0xfb03('0x4f')]=util[_0xfb03('0x1f')](_0xfb03('0x50'),_0x42b867[_0xfb03('0x51')],_0x335377[_0xfb03('0x52')],md5(_0x335377['uniqueid']));}else{_0x335377['recordingURL']='';}return getConnection(_0x42b867)[_0xfb03('0x26')](function(_0x462622){_0xf2e897=_0x462622;return getUser(_0x42b867,'',_0xf2e897);})['then'](function(_0x1dccba){_0x4b2130=_0x1dccba;logger['info']('The\x20User\x20ID\x20is:',_0x4b2130['id']);return getEndUser(_0x42b867,_0x335377['calleridname'],_0x335377['calleridnum'],_0xf2e897);})[_0xfb03('0x26')](function(_0x270f8e){_0x27ea7c=_0x270f8e;logger['info'](_0xfb03('0x56'),_0x27ea7c['id']);return createTicket(_0x42b867,_0x4b2130,_0x27ea7c,_0x3a14d1,_0x335377,_0x3a14d1[_0xfb03('0x57')],_0xf2e897);})[_0xfb03('0x26')](function(_0x3e5bcd){_0xa14418=_0x3e5bcd;logger['info'](_0xfb03('0x58'));logger[_0xfb03('0x2d')]('The\x20Ticket\x20ID\x20is:',_0xa14418['id']);})[_0xfb03('0x29')](function(_0x368d3d){logger['error']('['+_0x335377['lastevent'][_0xfb03('0x65')]()+']',JSON[_0xfb03('0x25')](_0x368d3d));});}; \ No newline at end of file +var _0x8796=['%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','user:%s','trigger:browser:url','outbound','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridnum','split','[OUTBOUND]','unmanaged','lastevent','toUpperCase','calleridname','calleridnum','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','forEach','type','string','idField','content','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','Descriptions','POST','%s/webservice.php','remoteUri','sessionName','HelpDesk','stringify','success','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','length','Agent\x20found!','email1','first_name','last_name','username','admin','getUser','statusCode','Searching\x20end\x20user\x20with\x20phone','query','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;','then','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','create','Contacts','Enduser\x20created.','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8796,0xdf));var _0x6879=function(_0x25e8fd,_0x409eaa){_0x25e8fd=_0x25e8fd-0x0;var _0xa9ccab=_0x8796[_0x25e8fd];return _0xa9ccab;};'use strict';var _=require(_0x6879('0x0'));var rp=require('request-promise');var BPromise=require(_0x6879('0x1'));var md5=require(_0x6879('0x2'));var util=require(_0x6879('0x3'));var Redis=require(_0x6879('0x4'));var intUtil=require(_0x6879('0x5'));var config=require(_0x6879('0x6'));var logger=require(_0x6879('0x7'))('vTiger');config[_0x6879('0x8')]=_[_0x6879('0x9')](config[_0x6879('0x8')],{'host':_0x6879('0xa'),'port':0x18eb});var io=require(_0x6879('0xb'))(new Redis(config['redis']));function emit(_0x41d71d,_0x486fc8,_0x3771a2){io['to'](_0x41d71d)[_0x6879('0xc')](_0x486fc8,_0x3771a2);}function getCustomFields(_0x365fb5,_0x4aaaf2){var _0x177f4f={};if(_0x365fb5['length']>0x0){_[_0x6879('0xd')](_0x365fb5,function(_0x2122dd){if(_0x2122dd[_0x6879('0xe')]===_0x6879('0xf')&&_0x2122dd[_0x6879('0x10')]){_0x177f4f[_0x2122dd[_0x6879('0x10')]]=_0x2122dd[_0x6879('0x11')][_0x6879('0x12')]();}else if(_0x2122dd[_0x6879('0xe')]==='variable'&&_0x2122dd['variableName']&&_0x2122dd[_0x6879('0x10')]&&_0x4aaaf2[_0x2122dd[_0x6879('0x13')]]){_0x177f4f[_0x2122dd[_0x6879('0x10')]]=_0x4aaaf2[_0x2122dd[_0x6879('0x13')]][_0x6879('0x12')]();}else if(_0x2122dd[_0x6879('0xe')]==='customVariable'&&_0x2122dd['Variable']&&_0x2122dd[_0x6879('0x14')]['name']&&_0x2122dd[_0x6879('0x10')]&&_0x4aaaf2[_0x2122dd[_0x6879('0x14')][_0x6879('0x15')][_0x6879('0x16')]()]){_0x177f4f[_0x2122dd[_0x6879('0x10')]]=_0x4aaaf2[_0x2122dd[_0x6879('0x14')][_0x6879('0x15')][_0x6879('0x16')]()][_0x6879('0x12')]();}});}return _0x177f4f;}function createTicket(_0x16d9e1,_0x2eedcf,_0x432356,_0xb6435e,_0x420106,_0x172733,_0x26f4b6){logger[_0x6879('0x17')](_0x6879('0x18'));var _0xb296e8=_[_0x6879('0x19')]({'parent_id':'','assigned_user_id':_0x2eedcf['id'],'ticketpriorities':_0x6879('0x1a'),'ticketstatus':_0x6879('0x1b'),'ticket_title':intUtil[_0x6879('0x1c')](_0xb6435e[_0x6879('0x1d')],_0x420106,'\x20'),'description':intUtil[_0x6879('0x1c')](_0xb6435e[_0x6879('0x1e')],_0x420106,'\x0a'),'contact_id':_0x432356['id']},getCustomFields(_0x172733,_0x420106));var _0x1ca774={'method':_0x6879('0x1f'),'uri':util['format'](_0x6879('0x20'),_0x16d9e1[_0x6879('0x21')]),'form':{'operation':'create','username':_0x16d9e1['username'],'sessionName':_0x26f4b6[_0x6879('0x22')],'elementType':_0x6879('0x23'),'element':JSON[_0x6879('0x24')](_0xb296e8)},'json':!![]};return request(_0x1ca774)['then'](function(_0x4d677b){if(_0x4d677b[_0x6879('0x25')]){return BPromise[_0x6879('0x26')]({'id':_0x4d677b[_0x6879('0x27')]['id']});}else{throw new Error(util[_0x6879('0x28')](_0x6879('0x29'),JSON['stringify'](_0x4d677b[_0x6879('0x2a')])));}})[_0x6879('0x2b')](function(_0x347556){var _0x196790=_0x347556['statusCode']||0x1f4;logger[_0x6879('0x2a')](_0x6879('0x2c'),_0x6879('0x2d'),_0x196790,JSON[_0x6879('0x24')](_0x347556));});}function getUser(_0x24519e,_0xfec522,_0x288353){if(intUtil[_0x6879('0x2e')](_0xfec522)){logger['info'](_0x6879('0x2f'),_0xfec522);return request({'method':_0x6879('0x30'),'uri':util[_0x6879('0x28')](_0x6879('0x20'),_0x24519e[_0x6879('0x21')]),'qs':{'operation':'query','username':_0x24519e['username'],'sessionName':_0x288353[_0x6879('0x22')],'query':util[_0x6879('0x28')](_0x6879('0x31'),_0xfec522)},'json':!![]})['then'](function(_0x5c544a){if(_0x5c544a['success']&&_0x5c544a[_0x6879('0x27')][_0x6879('0x32')]){logger[_0x6879('0x17')](_0x6879('0x33'));return BPromise[_0x6879('0x26')]({'id':_0x5c544a[_0x6879('0x27')][0x0]['id'],'email':_0x5c544a['result'][0x0][_0x6879('0x34')],'name':_0x5c544a[_0x6879('0x27')][0x0][_0x6879('0x35')]+'\x20'+_0x5c544a[_0x6879('0x27')][_0x6879('0x36')]});}else{logger[_0x6879('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x6879('0x26')]({'id':_0x288353['userId'],'email':_0x24519e[_0x6879('0x37')],'name':_0x6879('0x38')});}})[_0x6879('0x2b')](function(_0x1af998){var _0x503e73=_0x1af998['statusCode']||0x1f4;logger[_0x6879('0x2a')](_0x6879('0x2c'),_0x6879('0x39'),_0x503e73,JSON['stringify'](_0x1af998));});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x6879('0x26')]({'id':_0x288353['userId'],'email':_0x24519e[_0x6879('0x37')],'name':_0x6879('0x38')})['catch'](function(_0x16614a){var _0x10987f=_0x16614a[_0x6879('0x3a')]||0x1f4;logger[_0x6879('0x2a')](_0x6879('0x2c'),_0x6879('0x39'),_0x10987f,JSON[_0x6879('0x24')](_0x16614a));});}}function getEndUser(_0x19b045,_0x51a120,_0x1e7fd3,_0x4f59a6){logger[_0x6879('0x17')](_0x6879('0x3b'),_0x1e7fd3);return request({'method':_0x6879('0x30'),'uri':util[_0x6879('0x28')](_0x6879('0x20'),_0x19b045['remoteUri']),'qs':{'operation':_0x6879('0x3c'),'username':_0x19b045[_0x6879('0x37')],'sessionName':_0x4f59a6[_0x6879('0x22')],'query':util[_0x6879('0x28')](_0x6879('0x3d'),_0x1e7fd3,_0x1e7fd3,_0x1e7fd3,_0x1e7fd3,_0x1e7fd3)},'json':!![]})[_0x6879('0x3e')](function(_0xad9916){if(_0xad9916[_0x6879('0x25')]&&_0xad9916[_0x6879('0x27')][_0x6879('0x32')]){logger[_0x6879('0x17')](_0x6879('0x3f'));return BPromise['resolve']({'id':_0xad9916[_0x6879('0x27')][0x0]['id'],'name':_0xad9916[_0x6879('0x27')][0x0][_0x6879('0x40')]+'\x20'+_0xad9916[_0x6879('0x27')][0x0][_0x6879('0x41')],'phone':_0x1e7fd3});}else{logger[_0x6879('0x17')](_0x6879('0x42'));return request({'method':_0x6879('0x1f'),'uri':util[_0x6879('0x28')](_0x6879('0x20'),_0x19b045[_0x6879('0x21')]),'form':{'operation':_0x6879('0x43'),'sessionName':_0x4f59a6['sessionName'],'elementType':_0x6879('0x44'),'element':JSON[_0x6879('0x24')]({'lastname':_0x51a120,'phone':_0x1e7fd3,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x4c7bd3){logger['info'](_0x6879('0x45'));return BPromise['resolve']({'id':_0x4c7bd3['result']['id'],'name':_0x4c7bd3[_0x6879('0x27')][_0x6879('0x41')],'phone':_0x4c7bd3[_0x6879('0x27')]['phone']});})[_0x6879('0x2b')](function(_0x186ebb){var _0x21bcb9=_0x186ebb[_0x6879('0x3a')]||0x1f4;logger[_0x6879('0x2a')](_0x6879('0x2c'),'getEndUser',_0x21bcb9,JSON[_0x6879('0x24')](_0x186ebb));});}});}function getConnection(_0x542a74){var _0x3013da=_0x542a74[_0x6879('0x37')];var _0x57bf1f=_0x542a74['accessKey'];return request({'method':_0x6879('0x30'),'uri':util[_0x6879('0x28')](_0x6879('0x20'),_0x542a74[_0x6879('0x21')]),'qs':{'operation':_0x6879('0x46'),'username':_0x3013da},'json':!![]})[_0x6879('0x3e')](function(_0x5516e1){if(_0x5516e1[_0x6879('0x25')]){return request({'method':_0x6879('0x1f'),'uri':util[_0x6879('0x28')](_0x6879('0x20'),_0x542a74[_0x6879('0x21')]),'form':{'operation':'login','username':_0x3013da,'accessKey':md5(_0x5516e1['result'][_0x6879('0x47')]+_0x57bf1f)},'json':!![]});}})[_0x6879('0x3e')](function(_0x871270){if(_0x871270[_0x6879('0x25')]){return BPromise['resolve'](_0x871270[_0x6879('0x27')]);}else{throw new Error(util['format'](_0x6879('0x48'),_0x542a74['id']));}})[_0x6879('0x2b')](function(_0x4593b2){var _0x1ab2ea=_0x4593b2[_0x6879('0x3a')]||0x1f4;logger[_0x6879('0x2a')](_0x6879('0x2c'),_0x6879('0x49'),_0x1ab2ea,JSON[_0x6879('0x24')](_0x4593b2));});}function request(_0x23949e){logger[_0x6879('0x17')](_0x6879('0x4a'),JSON[_0x6879('0x24')](_0x23949e));return rp(_0x23949e);}exports[_0x6879('0x4b')]=function(_0x3b0c9e,_0x394f32,_0x3df07f,_0x115812,_0x49e78a,_0x58364f){var _0x4e51d3,_0x2ad28e,_0xce6731,_0x1ec8f3;_0x58364f['remoteUri']=intUtil[_0x6879('0x4c')](_0x58364f['remoteUri']);if(_0x49e78a&&_0x49e78a[_0x6879('0x4d')]){logger['info'](_0x6879('0x4e'),_0x6879('0x4f'));_0x394f32[_0x6879('0x50')]=util[_0x6879('0x28')](_0x6879('0x51'),_0x58364f[_0x6879('0x52')],_0x394f32[_0x6879('0x53')],md5(_0x394f32[_0x6879('0x53')]));}else{_0x394f32[_0x6879('0x50')]='';}return getConnection(_0x58364f)[_0x6879('0x3e')](function(_0x350cd5){_0x1ec8f3=_0x350cd5;return getUser(_0x58364f,_0x115812[_0x6879('0x54')],_0x1ec8f3);})[_0x6879('0x3e')](function(_0x74640f){_0x4e51d3=_0x74640f;logger['info']('The\x20User\x20ID\x20is:',_0x4e51d3['id']);return getEndUser(_0x58364f,_0x394f32['calleridname'],_0x394f32['calleridnum'],_0x1ec8f3);})[_0x6879('0x3e')](function(_0x12258b){_0x2ad28e=_0x12258b;logger['info'](_0x6879('0x55'),_0x2ad28e['id']);return createTicket(_0x58364f,_0x4e51d3,_0x2ad28e,_0x3df07f,_0x394f32,_0x3df07f[_0x6879('0x56')],_0x1ec8f3);})[_0x6879('0x3e')](function(_0x1ea1b8){_0xce6731=_0x1ea1b8;logger[_0x6879('0x17')](_0x6879('0x57'));logger['info'](_0x6879('0x58'),_0xce6731['id']);var _0xeb84d=util[_0x6879('0x28')](_0x6879('0x59'),_0x58364f['remoteUri'],_['split'](_0xce6731['id'],'x')[0x1]);logger['info'](_0x6879('0x4e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6879('0x28')](_0x6879('0x5a'),_0x115812['name']),_0x6879('0x5b'),{'uri':_0xeb84d});})[_0x6879('0x2b')](function(_0x2c68d2){logger[_0x6879('0x2a')](_0x6879('0x4e'),JSON[_0x6879('0x24')](_0x2c68d2));});};exports[_0x6879('0x5c')]=function(_0x46a50c,_0x538a44,_0x58fb1b,_0x1a10e4,_0x1b7276,_0x5b0880,_0x42641a){var _0x36723f,_0x10b577,_0x1da7dd,_0x44b3e8;_0x5b0880[_0x6879('0x21')]=intUtil[_0x6879('0x4c')](_0x5b0880[_0x6879('0x21')]);_0x5b0880['serverUrl']=intUtil[_0x6879('0x4c')](_0x5b0880[_0x6879('0x52')]);if(_0x42641a&&_0x42641a[_0x6879('0x5d')]&&_0x42641a['recordingFormat']!==_0x6879('0x5e')){logger[_0x6879('0x17')]('[OUTBOUND]',_0x6879('0x4f'));_0x538a44[_0x6879('0x50')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5b0880[_0x6879('0x52')],_0x538a44[_0x6879('0x53')],md5(_0x538a44[_0x6879('0x53')]));}return getConnection(_0x5b0880)[_0x6879('0x3e')](function(_0x22346b){_0x44b3e8=_0x22346b;return getUser(_0x5b0880,_0x1a10e4[_0x6879('0x54')],_0x44b3e8);})[_0x6879('0x3e')](function(_0x2dff58){_0x36723f=_0x2dff58;logger[_0x6879('0x17')](_0x6879('0x5f'),_0x36723f['id']);return getEndUser(_0x5b0880,_0x538a44['destcalleridname'],_0x538a44[_0x6879('0x60')],_0x44b3e8);})['then'](function(_0x21cb0a){_0x10b577=_0x21cb0a;logger[_0x6879('0x17')](_0x6879('0x55'),_0x10b577['id']);return createTicket(_0x5b0880,_0x36723f,_0x10b577,_0x58fb1b,_0x538a44,_0x58fb1b[_0x6879('0x56')],_0x44b3e8);})['then'](function(_0x49abf8){_0x1da7dd=_0x49abf8;logger[_0x6879('0x17')](_0x6879('0x57'));logger[_0x6879('0x17')]('The\x20Ticket\x20ID\x20is:',_0x1da7dd['id']);var _0xbd7667=util[_0x6879('0x28')](_0x6879('0x59'),_0x5b0880[_0x6879('0x21')],_[_0x6879('0x61')](_0x1da7dd['id'],'x')[0x1]);logger[_0x6879('0x17')](_0x6879('0x62'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6879('0x28')](_0x6879('0x5a'),_0x1a10e4['name']),_0x6879('0x5b'),{'uri':_0xbd7667});})[_0x6879('0x2b')](function(_0x54d8b6){logger[_0x6879('0x2a')](_0x6879('0x62'),JSON['stringify'](_0x54d8b6));});};exports[_0x6879('0x63')]=function(_0xd19d0b,_0x22d9ad,_0x323119,_0x5bb272,_0x2396ff,_0x482343){var _0x31e87f,_0x2acf96,_0x1cac46,_0x56b998;_0x482343[_0x6879('0x21')]=intUtil['stripTrailingSlash'](_0x482343[_0x6879('0x21')]);_0x482343[_0x6879('0x52')]=intUtil['stripTrailingSlash'](_0x482343['serverUrl']);if(_0x2396ff&&_0x2396ff['monitor_format']){logger['info']('['+_0x22d9ad[_0x6879('0x64')][_0x6879('0x65')]()+']',_0x6879('0x4f'));_0x22d9ad[_0x6879('0x50')]=util['format'](_0x6879('0x51'),_0x482343['serverUrl'],_0x22d9ad[_0x6879('0x53')],md5(_0x22d9ad[_0x6879('0x53')]));}else{_0x22d9ad['recordingURL']='';}return getConnection(_0x482343)[_0x6879('0x3e')](function(_0x4954cc){_0x56b998=_0x4954cc;return getUser(_0x482343,'',_0x56b998);})['then'](function(_0x28fcb8){_0x31e87f=_0x28fcb8;logger[_0x6879('0x17')]('The\x20User\x20ID\x20is:',_0x31e87f['id']);return getEndUser(_0x482343,_0x22d9ad[_0x6879('0x66')],_0x22d9ad[_0x6879('0x67')],_0x56b998);})[_0x6879('0x3e')](function(_0x2c7a91){_0x2acf96=_0x2c7a91;logger[_0x6879('0x17')](_0x6879('0x55'),_0x2acf96['id']);return createTicket(_0x482343,_0x31e87f,_0x2acf96,_0x323119,_0x22d9ad,_0x323119[_0x6879('0x56')],_0x56b998);})['then'](function(_0x558a14){_0x1cac46=_0x558a14;logger['info'](_0x6879('0x57'));logger[_0x6879('0x17')](_0x6879('0x58'),_0x1cac46['id']);})[_0x6879('0x2b')](function(_0x7e5778){logger[_0x6879('0x2a')]('['+_0x22d9ad[_0x6879('0x64')][_0x6879('0x65')]()+']',JSON['stringify'](_0x7e5778));});}; \ 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 c02d8dd..031062f 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 _0x624c=['string','customField','custom_fields','push','idField','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','Authorization','email','calleridname','calleridnum','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','inspect','request-promise','md5','util','ioredis','./util','../../../../config/logger','redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','name','getString','Fields','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','Basic\x20%s','toString','base64','[HTTP]','GET','map','type','nameField','toLowerCase','content'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x624c,0x1ee));var _0xc624=function(_0x22089b,_0x2e9648){_0x22089b=_0x22089b-0x0;var _0x403a74=_0x624c[_0x22089b];return _0x403a74;};'use strict';var _=require('lodash');var rp=require(_0xc624('0x0'));var md5=require(_0xc624('0x1'));var util=require(_0xc624('0x2'));var Redis=require(_0xc624('0x3'));var intUtil=require(_0xc624('0x4'));var config=require('../../../../config/environment');var logger=require(_0xc624('0x5'))('zendesk');config[_0xc624('0x6')]=_['defaults'](config[_0xc624('0x6')],{'host':_0xc624('0x7'),'port':0x18eb});var io=require(_0xc624('0x8'))(new Redis(config[_0xc624('0x6')]));function emit(_0x195296,_0x6cd772,_0x2ba147){io['to'](_0x195296)['emit'](_0x6cd772,_0x2ba147);}var headers={'Content-Type':_0xc624('0x9'),'Accept':_0xc624('0x9')};function getTicket(_0x424940,_0x542c5e,_0x44e4d9,_0x2ad32e,_0x4a7cf1){logger[_0xc624('0xa')](_0xc624('0xb'));return request({'uri':util[_0xc624('0xc')](_0xc624('0xd'),_0x424940[_0xc624('0xe')]),'method':'POST','body':{'ticket':_[_0xc624('0xf')]({'requester_id':_0x44e4d9['id'],'submitter_id':_0x542c5e?_0x542c5e['id']:undefined,'assignee_id':_0x542c5e?_0x542c5e['id']:undefined,'tags':getTags(_0x2ad32e[_0xc624('0x10')],_0xc624('0x11')),'subject':intUtil[_0xc624('0x12')](_0x2ad32e['Subjects'],_0x4a7cf1,'\x20'),'description':intUtil['getString'](_0x2ad32e['Descriptions'],_0x4a7cf1,'\x0a'),'comment':{'public':![],'body':intUtil[_0xc624('0x12')](_0x2ad32e['Descriptions'],_0x4a7cf1,'\x0a')}},getCustomFields(_0x2ad32e[_0xc624('0x13')],_0x4a7cf1))}})[_0xc624('0x14')](function(_0x2fff92){logger[_0xc624('0xa')](_0xc624('0x15'));return _0x2fff92[_0xc624('0x16')];});}function getUser(_0x5834f0,_0x3ad051){if(intUtil[_0xc624('0x17')](_0x3ad051)){logger[_0xc624('0xa')]('Getting\x20agent\x20with\x20email',_0x3ad051);return request({'uri':util[_0xc624('0xc')](_0xc624('0x18'),_0x5834f0['remoteUri']),'qs':{'query':util[_0xc624('0xc')](_0xc624('0x19'),_0x3ad051)}})['then'](function(_0x3dad91){if(_0x3dad91['count']){logger['info'](_0xc624('0x1a'));return _[_0xc624('0x1b')](_0x3dad91[_0xc624('0x1c')],{'email':_0x3ad051,'role':_0xc624('0x1d')});}else{logger[_0xc624('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xc624('0xc')](_0xc624('0x1e'),_0x5834f0[_0xc624('0xe')])})['then'](function(_0x400d46){logger['info'](_0xc624('0x1f'));return _0x400d46['user'];});}});}else{logger[_0xc624('0xa')](_0xc624('0x20'));return request({'uri':util[_0xc624('0xc')]('%s/users/me.json',_0x5834f0['remoteUri'])})[_0xc624('0x14')](function(_0x24ed8e){logger[_0xc624('0xa')](_0xc624('0x1f'));return _0x24ed8e[_0xc624('0x21')];});}}function getEndUser(_0x3ed4dd,_0xef8a37,_0x905330){logger[_0xc624('0xa')](_0xc624('0x22'),_0x905330);return request({'uri':util['format'](_0xc624('0x18'),_0x3ed4dd[_0xc624('0xe')]),'qs':{'query':util[_0xc624('0xc')](_0xc624('0x23'),_0x905330)}})[_0xc624('0x14')](function(_0x5a660c){var _0x4da11b;if(_0x5a660c['results'][_0xc624('0x24')]){_0x5a660c['results']=_[_0xc624('0x25')](_0x5a660c[_0xc624('0x1c')],{'suspended':![],'role':_0xc624('0x26')});if(_0x5a660c['results'][_0xc624('0x24')]){_0x4da11b=_[_0xc624('0x27')](_0x5a660c[_0xc624('0x1c')]);}}if(_0x4da11b){logger[_0xc624('0xa')](_0xc624('0x28'));return _0x4da11b;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xc624('0x29'),_0x3ed4dd[_0xc624('0xe')]),'method':_0xc624('0x2a'),'body':{'user':{'role':_0xc624('0x26'),'name':util[_0xc624('0xc')](_0xc624('0x2b'),_0xef8a37||_0x905330),'phone':_0x905330}}})[_0xc624('0x14')](function(_0x5cade8){logger[_0xc624('0xa')](_0xc624('0x2c'));return _0x5cade8[_0xc624('0x21')];});}});}function getAuth(_0x2e4e9d){var _0x30c4c2;if(_0x2e4e9d[_0xc624('0x2d')]===_0xc624('0x2e')){_0x30c4c2=util[_0xc624('0xc')](_0xc624('0x2f'),_0x2e4e9d['username'],_0x2e4e9d['password']);}else if(_0x2e4e9d[_0xc624('0x2d')]===_0xc624('0x30')){_0x30c4c2=util[_0xc624('0xc')](_0xc624('0x31'),_0x2e4e9d[_0xc624('0x32')],_0x2e4e9d[_0xc624('0x30')]);}return util[_0xc624('0xc')](_0xc624('0x33'),new Buffer(_0x30c4c2)[_0xc624('0x34')](_0xc624('0x35')));}function request(_0x35596c){logger['debug'](_0xc624('0x36'),JSON['stringify'](_0x35596c));return rp(_['defaults'](_0x35596c,{'method':_0xc624('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x3f37ae,_0x2fa86c){var _0x5b0783=[];if(_0x3f37ae&&_0x3f37ae['length']>0x0){_0x5b0783=_[_0xc624('0x38')](_0x3f37ae,_0x2fa86c);}return _0x5b0783;}function getCustomFields(_0x5f7f3a,_0x18f81a){var _0x5f1a5e=[];var _0x5341b0={'custom_fields':[]};if(_0x5f7f3a[_0xc624('0x24')]>0x0){_['forEach'](_0x5f7f3a,function(_0x43d194){if(_0x43d194[_0xc624('0x39')]==='string'&&_0x43d194[_0xc624('0x3a')]&&!_0x43d194['customField']){_0x5341b0[_0x43d194['nameField'][_0xc624('0x3b')]()]=_0x43d194[_0xc624('0x3c')][_0xc624('0x34')]();}else if(_0x43d194[_0xc624('0x39')]===_0xc624('0x3d')&&_0x43d194['idField']&&_0x43d194[_0xc624('0x3e')]){_0x5341b0[_0xc624('0x3f')][_0xc624('0x40')]({'id':_0x43d194[_0xc624('0x41')],'value':_0x43d194[_0xc624('0x3c')][_0xc624('0x34')]()});}else if(_0x43d194[_0xc624('0x39')]===_0xc624('0x42')&&_0x43d194[_0xc624('0x43')]&&_0x43d194[_0xc624('0x41')]&&_0x43d194['customField']){_0x18f81a[_0x43d194[_0xc624('0x43')]]&&_0x5341b0[_0xc624('0x3f')][_0xc624('0x40')]({'id':_0x43d194[_0xc624('0x41')],'value':_0x18f81a[_0x43d194[_0xc624('0x43')]][_0xc624('0x34')]()});}else if(_0x43d194[_0xc624('0x39')]===_0xc624('0x44')&&_0x43d194[_0xc624('0x45')]&&_0x43d194[_0xc624('0x45')][_0xc624('0x11')]&&_0x43d194['idField']&&_0x43d194[_0xc624('0x3e')]){_0x18f81a[_0x43d194['Variable']['name'][_0xc624('0x3b')]()]&&_0x5341b0[_0xc624('0x3f')]['push']({'id':_0x43d194[_0xc624('0x41')],'value':_0x18f81a[_0x43d194[_0xc624('0x45')][_0xc624('0x11')]['toLowerCase']()][_0xc624('0x34')]()});}});}return _0x5341b0;}exports[_0xc624('0x46')]=function(_0x4fa829,_0x4f71f1,_0x3749b5,_0x5f0949,_0x4d93ef,_0x3ba089){var _0x3dc4f3,_0x3aa568;_0x3ba089[_0xc624('0xe')]=intUtil[_0xc624('0x47')](_0x3ba089[_0xc624('0xe')]);_0x3ba089[_0xc624('0x48')]=intUtil[_0xc624('0x47')](_0x3ba089[_0xc624('0x48')]);if(_0x4d93ef&&_0x4d93ef[_0xc624('0x49')]){logger[_0xc624('0xa')](_0xc624('0x4a'),_0xc624('0x4b'));_0x4f71f1[_0xc624('0x4c')]=util[_0xc624('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ba089['serverUrl'],_0x4f71f1['uniqueid'],md5(_0x4f71f1['uniqueid']));}else{_0x4f71f1[_0xc624('0x4c')]='';}headers[_0xc624('0x4d')]=getAuth(_0x3ba089);return getUser(_0x3ba089,_0x5f0949[_0xc624('0x4e')])[_0xc624('0x14')](function(_0x13b4c9){_0x3dc4f3=_0x13b4c9;logger[_0xc624('0xa')]('The\x20User\x20ID\x20is:',_0x3dc4f3['id']);return getEndUser(_0x3ba089,_0x4f71f1[_0xc624('0x4f')],_0x4f71f1[_0xc624('0x50')]);})['then'](function(_0x5762a6){_0x3aa568=_0x5762a6;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3aa568['id']);return getTicket(_0x3ba089,_0x3dc4f3,_0x3aa568,_0x3749b5,_0x4f71f1);})[_0xc624('0x14')](function(_0x1e0d72){if(_0x1e0d72){logger[_0xc624('0xa')]('The\x20Ticket\x20ID\x20is:',_0x1e0d72['id']);switch(_0x3ba089['type']){case'integrationTab':logger['info'](_0xc624('0x4a'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xc624('0xc')](_0xc624('0x51'),_0x3ba089[_0xc624('0xe')],_0x3dc4f3['id'],_0x1e0d72['id']),'method':_0xc624('0x2a')});case _0xc624('0x52'):logger[_0xc624('0xa')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc624('0xc')](_0xc624('0x53'),_0x5f0949[_0xc624('0x11')]),_0xc624('0x54'),{'uri':util['format'](_0xc624('0x55'),_0x3ba089[_0xc624('0xe')][_0xc624('0x56')](_0xc624('0x57'),''),_0x1e0d72['id'])});break;default:logger[_0xc624('0x58')]('[QUEUE]',_0xc624('0x59'));}}})[_0xc624('0x5a')](function(_0x1fd18e){logger[_0xc624('0x58')](_0xc624('0x5b'),util['inspect'](_0x1fd18e,{'showHidden':!![],'depth':null}));});};exports[_0xc624('0x5c')]=function(_0x4d9d47,_0x59119c,_0x17508c,_0x30bf90,_0x153b7b,_0x3c9c81,_0x35790a){var _0x4be5e7,_0x4403c6;_0x3c9c81[_0xc624('0xe')]=intUtil[_0xc624('0x47')](_0x3c9c81[_0xc624('0xe')]);_0x3c9c81[_0xc624('0x48')]=intUtil[_0xc624('0x47')](_0x3c9c81[_0xc624('0x48')]);if(_0x35790a&&_0x35790a[_0xc624('0x5d')]&&_0x35790a['recordingFormat']!==_0xc624('0x5e')){logger[_0xc624('0xa')](_0xc624('0x5f'),_0xc624('0x4b'));_0x59119c[_0xc624('0x4c')]=util[_0xc624('0xc')](_0xc624('0x60'),_0x3c9c81[_0xc624('0x48')],_0x59119c[_0xc624('0x61')],md5(_0x59119c[_0xc624('0x61')]));}headers['Authorization']=getAuth(_0x3c9c81);return getUser(_0x3c9c81,_0x30bf90[_0xc624('0x4e')])['then'](function(_0x5766a4){_0x4be5e7=_0x5766a4;logger[_0xc624('0xa')](_0xc624('0x62'),_0x4be5e7['id']);return getEndUser(_0x3c9c81,_0x59119c[_0xc624('0x63')],_0x59119c[_0xc624('0x64')]);})['then'](function(_0x2bdaad){_0x4403c6=_0x2bdaad;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4403c6['id']);return getTicket(_0x3c9c81,_0x4be5e7,_0x4403c6,_0x17508c,_0x59119c);})[_0xc624('0x14')](function(_0x203f96){if(_0x203f96){logger['info'](_0xc624('0x65'),_0x203f96['id']);switch(_0x3c9c81[_0xc624('0x39')]){case _0xc624('0x66'):logger[_0xc624('0xa')](_0xc624('0x5f'),_0xc624('0x67'));return request({'uri':util[_0xc624('0xc')](_0xc624('0x51'),_0x3c9c81[_0xc624('0xe')],_0x4be5e7['id'],_0x203f96['id']),'method':_0xc624('0x2a')});case _0xc624('0x52'):logger[_0xc624('0xa')](_0xc624('0x5f'),_0xc624('0x68'));emit(util[_0xc624('0xc')]('user:%s',_0x30bf90['name']),_0xc624('0x54'),{'uri':util['format'](_0xc624('0x55'),_0x3c9c81[_0xc624('0xe')][_0xc624('0x56')](_0xc624('0x57'),''),_0x203f96['id'])});break;default:logger[_0xc624('0x58')](_0xc624('0x5f'),_0xc624('0x59'));}}})[_0xc624('0x5a')](function(_0x104de7){logger['error'](_0xc624('0x69'),util['inspect'](_0x104de7,{'showHidden':!![],'depth':null}));});};exports[_0xc624('0x6a')]=function(_0x2a5368,_0x511052,_0x51fd86,_0x1aa93c,_0x3cfc22,_0xe0f1ec){var _0x3c7c53,_0x206dc0;_0xe0f1ec[_0xc624('0xe')]=intUtil[_0xc624('0x47')](_0xe0f1ec[_0xc624('0xe')]);_0xe0f1ec[_0xc624('0x48')]=intUtil[_0xc624('0x47')](_0xe0f1ec[_0xc624('0x48')]);if(_0x3cfc22&&_0x3cfc22['monitor_format']){logger[_0xc624('0xa')]('['+_0x511052['lastevent'][_0xc624('0x6b')]()+']',_0xc624('0x4b'));_0x511052[_0xc624('0x4c')]=util[_0xc624('0xc')](_0xc624('0x60'),_0xe0f1ec['serverUrl'],_0x511052[_0xc624('0x61')],md5(_0x511052[_0xc624('0x61')]));}else{_0x511052[_0xc624('0x4c')]='';}headers[_0xc624('0x4d')]=getAuth(_0xe0f1ec);return getUser(_0xe0f1ec)['then'](function(_0x43d3cf){_0x3c7c53=_0x43d3cf;logger[_0xc624('0xa')](_0xc624('0x62'),_0x3c7c53['id']);return getEndUser(_0xe0f1ec,_0x511052['calleridname'],_0x511052['calleridnum']);})[_0xc624('0x14')](function(_0x16f902){_0x206dc0=_0x16f902;logger[_0xc624('0xa')]('The\x20Enduser\x20ID\x20is:',_0x206dc0['id']);return getTicket(_0xe0f1ec,_0x3c7c53,_0x206dc0,_0x51fd86,_0x511052);})[_0xc624('0x14')](function(_0x41fd1f){if(_0x41fd1f){logger[_0xc624('0xa')](_0xc624('0x65'),_0x41fd1f['id']);}})['catch'](function(_0x5243df){logger[_0xc624('0x58')]('['+_0x511052[_0xc624('0x6c')]['toUpperCase']()+']'+_0xc624('0x6d'),util[_0xc624('0x6e')](_0x5243df,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9a4b=['ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','then','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','results','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','length','map','forEach','type','string','nameField','customField','idField','custom_fields','push','content','variable','variableName','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','newTab','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridnum','The\x20Enduser\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','emit','application/json','format','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','info','Ticket\x20created!'];(function(_0x3c0ae4,_0x50cccc){var _0x5e2998=function(_0x474b80){while(--_0x474b80){_0x3c0ae4['push'](_0x3c0ae4['shift']());}};_0x5e2998(++_0x50cccc);}(_0x9a4b,0x134));var _0xb9a4=function(_0x28107d,_0x2ec8b3){_0x28107d=_0x28107d-0x0;var _0x2b1cbe=_0x9a4b[_0x28107d];return _0x2b1cbe;};'use strict';var _=require(_0xb9a4('0x0'));var rp=require(_0xb9a4('0x1'));var md5=require(_0xb9a4('0x2'));var util=require(_0xb9a4('0x3'));var Redis=require(_0xb9a4('0x4'));var intUtil=require(_0xb9a4('0x5'));var config=require(_0xb9a4('0x6'));var logger=require(_0xb9a4('0x7'))(_0xb9a4('0x8'));config[_0xb9a4('0x9')]=_[_0xb9a4('0xa')](config[_0xb9a4('0x9')],{'host':_0xb9a4('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x18f6e2,_0x15f18c,_0xb210a4){io['to'](_0x18f6e2)[_0xb9a4('0xc')](_0x15f18c,_0xb210a4);}var headers={'Content-Type':_0xb9a4('0xd'),'Accept':'application/json'};function getTicket(_0x5e56b3,_0x3a5645,_0x571a4d,_0x7641b5,_0x1643be){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0xb9a4('0xe')]('%s/tickets.json',_0x5e56b3['remoteUri']),'method':_0xb9a4('0xf'),'body':{'ticket':_[_0xb9a4('0x10')]({'requester_id':_0x571a4d['id'],'submitter_id':_0x3a5645?_0x3a5645['id']:undefined,'assignee_id':_0x3a5645?_0x3a5645['id']:undefined,'tags':getTags(_0x7641b5[_0xb9a4('0x11')],_0xb9a4('0x12')),'subject':intUtil[_0xb9a4('0x13')](_0x7641b5[_0xb9a4('0x14')],_0x1643be,'\x20'),'description':intUtil[_0xb9a4('0x13')](_0x7641b5[_0xb9a4('0x15')],_0x1643be,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x7641b5['Descriptions'],_0x1643be,'\x0a')}},getCustomFields(_0x7641b5[_0xb9a4('0x16')],_0x1643be))}})['then'](function(_0x3b575b){logger[_0xb9a4('0x17')](_0xb9a4('0x18'));return _0x3b575b[_0xb9a4('0x19')];});}function getUser(_0x5e62b7,_0x5c987c){if(intUtil[_0xb9a4('0x1a')](_0x5c987c)){logger[_0xb9a4('0x17')](_0xb9a4('0x1b'),_0x5c987c);return request({'uri':util[_0xb9a4('0xe')](_0xb9a4('0x1c'),_0x5e62b7[_0xb9a4('0x1d')]),'qs':{'query':util[_0xb9a4('0xe')](_0xb9a4('0x1e'),_0x5c987c)}})['then'](function(_0x178738){if(_0x178738['count']){logger[_0xb9a4('0x17')](_0xb9a4('0x1f'));return _['find'](_0x178738['results'],{'email':_0x5c987c,'role':'agent'});}else{logger['info'](_0xb9a4('0x20'));return request({'uri':util['format'](_0xb9a4('0x21'),_0x5e62b7['remoteUri'])})[_0xb9a4('0x22')](function(_0x2776ae){logger[_0xb9a4('0x17')](_0xb9a4('0x23'));return _0x2776ae['user'];});}});}else{logger[_0xb9a4('0x17')](_0xb9a4('0x20'));return request({'uri':util[_0xb9a4('0xe')](_0xb9a4('0x21'),_0x5e62b7[_0xb9a4('0x1d')])})[_0xb9a4('0x22')](function(_0x2ed562){logger['info'](_0xb9a4('0x23'));return _0x2ed562[_0xb9a4('0x24')];});}}function getEndUser(_0x58ff4c,_0x2971e1,_0x53e367){logger[_0xb9a4('0x17')](_0xb9a4('0x25'),_0x53e367);return request({'uri':util[_0xb9a4('0xe')](_0xb9a4('0x1c'),_0x58ff4c[_0xb9a4('0x1d')]),'qs':{'query':util[_0xb9a4('0xe')]('type:user\x20role:end-user\x20phone:%s',_0x53e367)}})[_0xb9a4('0x22')](function(_0x26360b){var _0x12451c;if(_0x26360b[_0xb9a4('0x26')]['length']){_0x26360b['results']=_[_0xb9a4('0x27')](_0x26360b['results'],{'suspended':![],'role':_0xb9a4('0x28')});if(_0x26360b[_0xb9a4('0x26')]['length']){_0x12451c=_[_0xb9a4('0x29')](_0x26360b[_0xb9a4('0x26')]);}}if(_0x12451c){logger[_0xb9a4('0x17')](_0xb9a4('0x2a'));return _0x12451c;}else{logger[_0xb9a4('0x17')](_0xb9a4('0x2b'));return request({'uri':util[_0xb9a4('0xe')]('%s/users.json',_0x58ff4c[_0xb9a4('0x1d')]),'method':'POST','body':{'user':{'role':_0xb9a4('0x28'),'name':util['format'](_0xb9a4('0x2c'),_0x2971e1||_0x53e367),'phone':_0x53e367}}})[_0xb9a4('0x22')](function(_0x3bac5a){logger[_0xb9a4('0x17')]('Enduser\x20created.');return _0x3bac5a[_0xb9a4('0x24')];});}});}function getAuth(_0x2f97f8){var _0x46023d;if(_0x2f97f8[_0xb9a4('0x2d')]===_0xb9a4('0x2e')){_0x46023d=util[_0xb9a4('0xe')](_0xb9a4('0x2f'),_0x2f97f8[_0xb9a4('0x30')],_0x2f97f8[_0xb9a4('0x2e')]);}else if(_0x2f97f8[_0xb9a4('0x2d')]===_0xb9a4('0x31')){_0x46023d=util[_0xb9a4('0xe')](_0xb9a4('0x32'),_0x2f97f8[_0xb9a4('0x30')],_0x2f97f8['token']);}return util[_0xb9a4('0xe')](_0xb9a4('0x33'),new Buffer(_0x46023d)[_0xb9a4('0x34')](_0xb9a4('0x35')));}function request(_0x3f2b58){logger['debug'](_0xb9a4('0x36'),JSON[_0xb9a4('0x37')](_0x3f2b58));return rp(_['defaults'](_0x3f2b58,{'method':_0xb9a4('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x4a9eb0,_0xa2e724){var _0x1af848=[];if(_0x4a9eb0&&_0x4a9eb0[_0xb9a4('0x39')]>0x0){_0x1af848=_[_0xb9a4('0x3a')](_0x4a9eb0,_0xa2e724);}return _0x1af848;}function getCustomFields(_0x328cf1,_0x1be7f6){var _0x2217b0=[];var _0x526279={'custom_fields':[]};if(_0x328cf1[_0xb9a4('0x39')]>0x0){_[_0xb9a4('0x3b')](_0x328cf1,function(_0x5757fa){if(_0x5757fa[_0xb9a4('0x3c')]===_0xb9a4('0x3d')&&_0x5757fa[_0xb9a4('0x3e')]&&!_0x5757fa[_0xb9a4('0x3f')]){_0x526279[_0x5757fa['nameField']['toLowerCase']()]=_0x5757fa['content']['toString']();}else if(_0x5757fa['type']===_0xb9a4('0x3d')&&_0x5757fa[_0xb9a4('0x40')]&&_0x5757fa[_0xb9a4('0x3f')]){_0x526279[_0xb9a4('0x41')][_0xb9a4('0x42')]({'id':_0x5757fa[_0xb9a4('0x40')],'value':_0x5757fa[_0xb9a4('0x43')]['toString']()});}else if(_0x5757fa[_0xb9a4('0x3c')]===_0xb9a4('0x44')&&_0x5757fa[_0xb9a4('0x45')]&&_0x5757fa[_0xb9a4('0x40')]&&_0x5757fa['customField']){_0x1be7f6[_0x5757fa['variableName']]&&_0x526279[_0xb9a4('0x41')][_0xb9a4('0x42')]({'id':_0x5757fa[_0xb9a4('0x40')],'value':_0x1be7f6[_0x5757fa['variableName']]['toString']()});}else if(_0x5757fa[_0xb9a4('0x3c')]==='customVariable'&&_0x5757fa[_0xb9a4('0x46')]&&_0x5757fa[_0xb9a4('0x46')][_0xb9a4('0x12')]&&_0x5757fa['idField']&&_0x5757fa['customField']){_0x1be7f6[_0x5757fa['Variable'][_0xb9a4('0x12')][_0xb9a4('0x47')]()]&&_0x526279['custom_fields'][_0xb9a4('0x42')]({'id':_0x5757fa['idField'],'value':_0x1be7f6[_0x5757fa[_0xb9a4('0x46')][_0xb9a4('0x12')][_0xb9a4('0x47')]()][_0xb9a4('0x34')]()});}});}return _0x526279;}exports[_0xb9a4('0x48')]=function(_0x5c73b5,_0x90e873,_0x3dcb04,_0x501a34,_0x359468,_0x1f63a9){var _0x5aa488,_0x31cfc8;_0x1f63a9['remoteUri']=intUtil[_0xb9a4('0x49')](_0x1f63a9[_0xb9a4('0x1d')]);_0x1f63a9[_0xb9a4('0x4a')]=intUtil[_0xb9a4('0x49')](_0x1f63a9['serverUrl']);if(_0x359468&&_0x359468[_0xb9a4('0x4b')]){logger[_0xb9a4('0x17')](_0xb9a4('0x4c'),_0xb9a4('0x4d'));_0x90e873[_0xb9a4('0x4e')]=util[_0xb9a4('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1f63a9[_0xb9a4('0x4a')],_0x90e873[_0xb9a4('0x4f')],md5(_0x90e873[_0xb9a4('0x4f')]));}else{_0x90e873[_0xb9a4('0x4e')]='';}headers[_0xb9a4('0x50')]=getAuth(_0x1f63a9);return getUser(_0x1f63a9,_0x501a34[_0xb9a4('0x51')])[_0xb9a4('0x22')](function(_0x313a0d){_0x5aa488=_0x313a0d;logger[_0xb9a4('0x17')](_0xb9a4('0x52'),_0x5aa488['id']);return getEndUser(_0x1f63a9,_0x90e873[_0xb9a4('0x53')],_0x90e873['calleridnum']);})[_0xb9a4('0x22')](function(_0x6063a9){_0x31cfc8=_0x6063a9;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31cfc8['id']);return getTicket(_0x1f63a9,_0x5aa488,_0x31cfc8,_0x3dcb04,_0x90e873);})[_0xb9a4('0x22')](function(_0x1112ad){if(_0x1112ad){logger[_0xb9a4('0x17')]('The\x20Ticket\x20ID\x20is:',_0x1112ad['id']);switch(_0x1f63a9['type']){case _0xb9a4('0x54'):logger[_0xb9a4('0x17')]('[QUEUE]',_0xb9a4('0x55'));return request({'uri':util[_0xb9a4('0xe')](_0xb9a4('0x56'),_0x1f63a9['remoteUri'],_0x5aa488['id'],_0x1112ad['id']),'method':_0xb9a4('0xf')});case'newTab':logger[_0xb9a4('0x17')](_0xb9a4('0x4c'),_0xb9a4('0x57'));emit(util['format'](_0xb9a4('0x58'),_0x501a34[_0xb9a4('0x12')]),'trigger:browser:url',{'uri':util['format'](_0xb9a4('0x59'),_0x1f63a9['remoteUri'][_0xb9a4('0x5a')]('/api/v2',''),_0x1112ad['id'])});break;default:logger['error']('[QUEUE]',_0xb9a4('0x5b'));}}})[_0xb9a4('0x5c')](function(_0x2ab6da){logger[_0xb9a4('0x5d')](_0xb9a4('0x5e'),util[_0xb9a4('0x5f')](_0x2ab6da,{'showHidden':!![],'depth':null}));});};exports[_0xb9a4('0x60')]=function(_0x2d3faf,_0x16a8e9,_0x3f614a,_0x3e1764,_0x38257b,_0x4a623f,_0xff7123){var _0x5099bd,_0x5b87af;_0x4a623f[_0xb9a4('0x1d')]=intUtil[_0xb9a4('0x49')](_0x4a623f[_0xb9a4('0x1d')]);_0x4a623f[_0xb9a4('0x4a')]=intUtil[_0xb9a4('0x49')](_0x4a623f[_0xb9a4('0x4a')]);if(_0xff7123&&_0xff7123[_0xb9a4('0x61')]&&_0xff7123['recordingFormat']!==_0xb9a4('0x62')){logger[_0xb9a4('0x17')](_0xb9a4('0x63'),'Recording\x20is\x20enabled!');_0x16a8e9[_0xb9a4('0x4e')]=util[_0xb9a4('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a623f['serverUrl'],_0x16a8e9['uniqueid'],md5(_0x16a8e9[_0xb9a4('0x4f')]));}headers[_0xb9a4('0x50')]=getAuth(_0x4a623f);return getUser(_0x4a623f,_0x3e1764[_0xb9a4('0x51')])[_0xb9a4('0x22')](function(_0xccc0d3){_0x5099bd=_0xccc0d3;logger[_0xb9a4('0x17')]('The\x20User\x20ID\x20is:',_0x5099bd['id']);return getEndUser(_0x4a623f,_0x16a8e9[_0xb9a4('0x64')],_0x16a8e9[_0xb9a4('0x65')]);})[_0xb9a4('0x22')](function(_0x24ed01){_0x5b87af=_0x24ed01;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5b87af['id']);return getTicket(_0x4a623f,_0x5099bd,_0x5b87af,_0x3f614a,_0x16a8e9);})[_0xb9a4('0x22')](function(_0x333440){if(_0x333440){logger[_0xb9a4('0x17')](_0xb9a4('0x66'),_0x333440['id']);switch(_0x4a623f[_0xb9a4('0x3c')]){case _0xb9a4('0x54'):logger[_0xb9a4('0x17')](_0xb9a4('0x63'),_0xb9a4('0x55'));return request({'uri':util[_0xb9a4('0xe')](_0xb9a4('0x56'),_0x4a623f[_0xb9a4('0x1d')],_0x5099bd['id'],_0x333440['id']),'method':_0xb9a4('0xf')});case _0xb9a4('0x67'):logger[_0xb9a4('0x17')](_0xb9a4('0x63'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x3e1764[_0xb9a4('0x12')]),'trigger:browser:url',{'uri':util[_0xb9a4('0xe')](_0xb9a4('0x59'),_0x4a623f[_0xb9a4('0x1d')][_0xb9a4('0x5a')]('/api/v2',''),_0x333440['id'])});break;default:logger[_0xb9a4('0x5d')]('[OUTBOUND]',_0xb9a4('0x5b'));}}})[_0xb9a4('0x5c')](function(_0x4d1700){logger[_0xb9a4('0x5d')](_0xb9a4('0x68'),util[_0xb9a4('0x5f')](_0x4d1700,{'showHidden':!![],'depth':null}));});};exports[_0xb9a4('0x69')]=function(_0x255b60,_0x116d65,_0xf80993,_0x57563e,_0x4c9183,_0x3020eb){var _0x3dbb44,_0xd8f852;_0x3020eb['remoteUri']=intUtil[_0xb9a4('0x49')](_0x3020eb[_0xb9a4('0x1d')]);_0x3020eb[_0xb9a4('0x4a')]=intUtil['stripTrailingSlash'](_0x3020eb[_0xb9a4('0x4a')]);if(_0x4c9183&&_0x4c9183[_0xb9a4('0x4b')]){logger[_0xb9a4('0x17')]('['+_0x116d65[_0xb9a4('0x6a')][_0xb9a4('0x6b')]()+']','Recording\x20is\x20enabled!');_0x116d65[_0xb9a4('0x4e')]=util[_0xb9a4('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3020eb[_0xb9a4('0x4a')],_0x116d65[_0xb9a4('0x4f')],md5(_0x116d65['uniqueid']));}else{_0x116d65['recordingURL']='';}headers[_0xb9a4('0x50')]=getAuth(_0x3020eb);return getUser(_0x3020eb)[_0xb9a4('0x22')](function(_0x94fa42){_0x3dbb44=_0x94fa42;logger['info'](_0xb9a4('0x52'),_0x3dbb44['id']);return getEndUser(_0x3020eb,_0x116d65['calleridname'],_0x116d65[_0xb9a4('0x6c')]);})[_0xb9a4('0x22')](function(_0x92c121){_0xd8f852=_0x92c121;logger[_0xb9a4('0x17')](_0xb9a4('0x6d'),_0xd8f852['id']);return getTicket(_0x3020eb,_0x3dbb44,_0xd8f852,_0xf80993,_0x116d65);})[_0xb9a4('0x22')](function(_0x53e1b0){if(_0x53e1b0){logger[_0xb9a4('0x17')](_0xb9a4('0x66'),_0x53e1b0['id']);}})[_0xb9a4('0x5c')](function(_0x57214f){logger[_0xb9a4('0x5d')]('['+_0x116d65[_0xb9a4('0x6a')]['toUpperCase']()+']'+_0xb9a4('0x6e'),util[_0xb9a4('0x5f')](_0x57214f,{'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 d3c8931..10951c3 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 _0x3ce9=['stringify','string','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','startCase','moduleCreate','role','first_name','last_name','code','details','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','contact','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Descriptions','Who_Id','First_Name','Last_Name','Full_Name','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','lastevent','called','complete','connect','Call_Result','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','merge','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','toUpperCase','lodash','md5','util','./util','moment','ioredis','bluebird','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug'];(function(_0x324b31,_0x4c39fb){var _0x34f504=function(_0x42a933){while(--_0x42a933){_0x324b31['push'](_0x324b31['shift']());}};_0x34f504(++_0x4c39fb);}(_0x3ce9,0x85));var _0x93ce=function(_0x2a5470,_0x84d1ee){_0x2a5470=_0x2a5470-0x0;var _0x117527=_0x3ce9[_0x2a5470];return _0x117527;};'use strict';var _=require(_0x93ce('0x0'));var rp=require('request-promise');var md5=require(_0x93ce('0x1'));var util=require(_0x93ce('0x2'));var intUtil=require(_0x93ce('0x3'));var moment=require(_0x93ce('0x4'));var Redis=require(_0x93ce('0x5'));var BPromise=require(_0x93ce('0x6'));var config=require('../../../../config/environment');var logger=require(_0x93ce('0x7'))(_0x93ce('0x8'));config[_0x93ce('0x9')]=_[_0x93ce('0xa')](config[_0x93ce('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x93ce('0xb'))(new Redis(config[_0x93ce('0x9')]));function emit(_0x4a112a,_0x5605fe,_0x5769fb){io['to'](_0x4a112a)[_0x93ce('0xc')](_0x5605fe,_0x5769fb);}function request(_0x5e3f70){logger[_0x93ce('0xd')]('[HTTP]',JSON[_0x93ce('0xe')](_0x5e3f70));return rp(_0x5e3f70);}function getCustomFields(_0x5a125f,_0x354cad){var _0x57ca8f={};if(_0x5a125f['length']>0x0){_['forEach'](_0x5a125f,function(_0x47cca0){if(_0x47cca0['type']===_0x93ce('0xf')&&_0x47cca0[_0x93ce('0x10')]){_0x57ca8f[_0x47cca0[_0x93ce('0x10')]]=_0x47cca0['content'][_0x93ce('0x11')]();}else if(_0x47cca0['type']===_0x93ce('0x12')&&_0x47cca0[_0x93ce('0x13')]&&_0x47cca0['idField']&&_0x354cad[_0x47cca0['variableName']]){_0x57ca8f[_0x47cca0[_0x93ce('0x10')]]=_0x354cad[_0x47cca0['variableName']][_0x93ce('0x11')]();}else if(_0x47cca0['type']===_0x93ce('0x14')&&_0x47cca0['Variable']&&_0x47cca0[_0x93ce('0x15')][_0x93ce('0x16')]&&_0x47cca0[_0x93ce('0x10')]&&_0x354cad[_0x47cca0[_0x93ce('0x15')][_0x93ce('0x16')]['toLowerCase']()]){_0x57ca8f[_0x47cca0[_0x93ce('0x10')]]=_0x354cad[_0x47cca0[_0x93ce('0x15')][_0x93ce('0x16')][_0x93ce('0x17')]()][_0x93ce('0x11')]();}});}return _0x57ca8f;}function getName(_0x25be3b){if(_0x25be3b['indexOf']('\x20')>0x0){var _0x4d33de=_0x25be3b[_0x93ce('0x18')](/ (.+)/);if(_0x4d33de[0x1]){return _0x4d33de;}}return[_0x25be3b,_0x25be3b];}var accountsTokens={};function getAccessToken(_0x31d670){return new Promise(function(_0x11c534,_0x1b46a4){if(!_[_0x93ce('0x19')](accountsTokens[_0x31d670['id']])&&!_[_0x93ce('0x19')](accountsTokens[_0x31d670['id']][_0x93ce('0x1a')])){if(moment()[_0x93ce('0x1b')](accountsTokens[_0x31d670['id']]['expires_in'])){_0x11c534(accountsTokens[_0x31d670['id']][_0x93ce('0x1a')]);}}var _0x2c8595;switch(_0x31d670[_0x93ce('0x1c')]){case'US':_0x2c8595=_0x93ce('0x1d');break;case'AU':_0x2c8595='https://accounts.zoho.com.au';break;case'EU':_0x2c8595=_0x93ce('0x1e');break;case'IN':_0x2c8595='https://accounts.zoho.in';break;case'CN':_0x2c8595=_0x93ce('0x1f');break;default:_0x2c8595=_0x93ce('0x1e');break;}var _0x58dd54={'method':_0x93ce('0x20'),'uri':_0x2c8595+_0x93ce('0x21'),'qs':{'refresh_token':_0x31d670[_0x93ce('0x22')],'client_id':_0x31d670[_0x93ce('0x23')],'client_secret':_0x31d670[_0x93ce('0x24')],'grant_type':_0x93ce('0x25')},'json':!![]};return rp(_0x58dd54)[_0x93ce('0x26')](function(_0xdaae17){accountsTokens[_0x31d670['id']]={'access_token':_0xdaae17['access_token'],'expires_in':moment()[_0x93ce('0x27')](_0xdaae17[_0x93ce('0x28')],_0x93ce('0x29'))};_0x11c534(_0xdaae17['access_token']);})[_0x93ce('0x2a')](function(_0x6eaecb){logger[_0x93ce('0x2b')](_0x93ce('0x2c'),_0x6eaecb[_0x93ce('0x2d')]);_0x1b46a4(_0x6eaecb);});});}function getUser(_0x532fcd,_0x27f208,_0x212e9e,_0x165873){logger['info'](_0x93ce('0x2e'));return request({'method':_0x93ce('0x2f'),'uri':util[_0x93ce('0x30')](_0x93ce('0x31'),_0x27f208),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x93ce('0x32')+_0x532fcd},'json':!![]})[_0x93ce('0x26')](function(_0x19335e){if(_0x19335e[_0x93ce('0x33')]){var _0x72b859=-0x1;if(_['isArrayLikeObject'](_0x19335e[_0x93ce('0x33')])){if(!_['isNil'](_0x165873)){_0x72b859=_[_0x93ce('0x34')](_0x19335e[_0x93ce('0x33')],function(_0x50e5d0){return _0x50e5d0[_0x93ce('0x35')]===_0x165873;});}if(_0x72b859>=0x0){logger[_0x93ce('0x36')](_0x93ce('0x37'));}else{logger[_0x93ce('0x36')](_0x93ce('0x38'));_0x72b859=_[_0x93ce('0x34')](_0x19335e[_0x93ce('0x33')],function(_0x58fb6d){return _0x58fb6d['profile'][_0x93ce('0x16')]===_0x93ce('0x39');});}return _0x19335e[_0x93ce('0x33')][_0x72b859];}else{if(_0x19335e[_0x93ce('0x3a')][_0x93ce('0x3b')][_0x93ce('0x16')]===_0x93ce('0x39')){logger[_0x93ce('0x36')](_0x93ce('0x38'));user=_0x19335e[_0x93ce('0x3a')];return user;}else{logger[_0x93ce('0x2b')]('The\x20failing\x20result\x20is',JSON[_0x93ce('0xe')](_0x19335e));throw new Error(_0x93ce('0x3c')+JSON[_0x93ce('0xe')](_0x19335e));}}}else{logger[_0x93ce('0x2b')](_0x93ce('0x3d'),JSON[_0x93ce('0xe')](_0x19335e));throw new Error(_0x93ce('0x3c')+JSON[_0x93ce('0xe')](_0x19335e));}})['catch'](function(_0x188c7e){console[_0x93ce('0x2b')](_0x188c7e);});}function getZohoUser(_0x570950,_0x5e8c62){return new BPromise(function(_0x1fcca7,_0x217511){request(_0x570950)[_0x93ce('0x26')](function(_0x1e5339){var _0x46d1b6=null;if(_0x1e5339){_0x46d1b6=_0x1e5339[_0x93ce('0x3e')][0x0];_0x46d1b6[_0x93ce('0x3f')]=_0x5e8c62;}_0x1fcca7(_0x46d1b6);})[_0x93ce('0x2a')](function(_0xf83548){_0x217511(_0xf83548);});});}function createEndUser(_0x1a2ccb,_0x38fef6,_0x29fd9a,_0x20092f,_0x313dcd,_0x56a581){var _0x29fd9a=getName(_0x29fd9a);return request({'method':_0x93ce('0x20'),'uri':'https://www.zohoapis.'+_0x38fef6+'/crm/v2/'+_[_0x93ce('0x40')](_0x56a581[_0x93ce('0x41')])+'s','body':{'data':[{'Last_Name':_0x29fd9a[0x1],'First_Name':_0x29fd9a[0x0],'Phone':_0x20092f,'Owner':{'name':!_[_0x93ce('0x19')](_0x313dcd[_0x93ce('0x42')]['name'])?_0x313dcd[_0x93ce('0x42')][_0x93ce('0x16')]:!_[_0x93ce('0x19')](_0x313dcd[_0x93ce('0x43')])?_0x313dcd[_0x93ce('0x43')]+'\x20'+_0x313dcd[_0x93ce('0x44')]:_0x313dcd[_0x93ce('0x44')],'id':_0x313dcd['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1a2ccb},'json':!![]})[_0x93ce('0x26')](function(_0x2ef8a2){if(_0x2ef8a2&&_0x2ef8a2[_0x93ce('0x3e')][0x0][_0x93ce('0x45')]==='SUCCESS'){var _0x98095d=_0x2ef8a2['data'][0x0][_0x93ce('0x46')];_0x98095d['enduserType']=_[_0x93ce('0x40')](_0x56a581['moduleCreate'])+'s';return _0x98095d;}logger['error'](_0x93ce('0x3d'),JSON[_0x93ce('0xe')](data));throw new Error(_0x93ce('0x47')+JSON['stringify'](data));})['catch'](function(_0x8425e4){console[_0x93ce('0x48')](_0x93ce('0x49'),_0x8425e4);});}function getEndUser(_0x133154,_0x4acad7,_0x2b0d26,_0x257e5c,_0x45cdec,_0x53879d,_0x2810a7){var _0x345cfd={'method':_0x93ce('0x2f'),'uri':'','headers':{'Authorization':_0x93ce('0x32')+_0x133154},'json':!![]};switch(_0x2810a7['moduleSearch']){case _0x93ce('0x4a'):_0x345cfd[_0x93ce('0x4b')]=_0x93ce('0x4c')+_0x4acad7+_0x93ce('0x4d')+_0x45cdec+'))';return getZohoUser(_0x345cfd,_0x93ce('0x4e'))[_0x93ce('0x26')](function(_0x5cd491){if(_0x5cd491)return _0x5cd491;_0x345cfd[_0x93ce('0x4b')]='https://www.zohoapis.'+_0x4acad7+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x45cdec+'))';return getZohoUser(_0x345cfd,_0x93ce('0x4f'))[_0x93ce('0x26')](function(_0x58e5e3){if(_0x58e5e3)return _0x58e5e3;if(_0x2810a7[_0x93ce('0x41')]!='nothing'){return createEndUser(_0x133154,_0x4acad7,_0x257e5c,_0x45cdec,_0x53879d,_0x2810a7);}else{return{};}});});break;case _0x93ce('0x50'):_0x345cfd[_0x93ce('0x4b')]=_0x93ce('0x4c')+_0x4acad7+_0x93ce('0x4d')+_0x45cdec+'))';return getZohoUser(_0x345cfd,_0x93ce('0x4e'))[_0x93ce('0x26')](function(_0x13239c){if(_0x13239c)return _0x13239c;if(_0x2810a7[_0x93ce('0x41')]!=_0x93ce('0x51')){return createEndUser(_0x133154,_0x4acad7,_0x257e5c,_0x45cdec,_0x53879d,_0x2810a7);}else{return{};}});break;case _0x93ce('0x52'):_0x345cfd['uri']=_0x93ce('0x4c')+_0x4acad7+_0x93ce('0x53')+_0x45cdec+'))';return getZohoUser(_0x345cfd,_0x93ce('0x4f'))[_0x93ce('0x26')](function(_0x109208){if(_0x109208)return _0x109208;if(_0x2810a7[_0x93ce('0x41')]!=_0x93ce('0x51')){return createEndUser(_0x133154,_0x4acad7,_0x257e5c,_0x45cdec,_0x53879d,_0x2810a7);}else{return{};}});break;}}function getCall(_0x3bbafc,_0x357e75,_0x469665,_0x40d6cd,_0x30f542,_0xb1ad76,_0x4c3e4b,_0xf66210){logger[_0x93ce('0x36')](_0x93ce('0x54'));var _0x21f7a9={};_0x21f7a9[_0x93ce('0x55')]={'name':!_[_0x93ce('0x19')](_0x40d6cd[_0x93ce('0x42')][_0x93ce('0x16')])&&!_[_0x93ce('0x19')](_0x40d6cd[_0x93ce('0x3b')]['name'])&&_0x40d6cd[_0x93ce('0x3b')][_0x93ce('0x16')]===_0x93ce('0x56')?_0x40d6cd[_0x93ce('0x42')][_0x93ce('0x16')]:!_[_0x93ce('0x19')](_0x40d6cd[_0x93ce('0x43')])?_0x40d6cd[_0x93ce('0x43')]+'\x20'+_0x40d6cd[_0x93ce('0x44')]:_0x40d6cd[_0x93ce('0x44')],'id':_0x40d6cd['id']};_0x21f7a9['Subject']=intUtil[_0x93ce('0x57')](_0xb1ad76[_0x93ce('0x58')],_0x4c3e4b,'\x20');_0x21f7a9[_0x93ce('0x59')]=intUtil['getString'](_0xb1ad76[_0x93ce('0x5a')],_0x4c3e4b,'\x0a');if(_0x30f542[_0x93ce('0x3f')]===_0x93ce('0x4e')){_0x21f7a9[_0x93ce('0x5b')]={'name':!_[_0x93ce('0x19')](_0x30f542['Full_Name'])?_0x30f542['Full_Name']:!_[_0x93ce('0x19')](_0x30f542[_0x93ce('0x5c')])?_0x30f542['First_Name']+'\x20'+_0x30f542['Last_Name']:_0x30f542[_0x93ce('0x5d')],'id':_0x30f542['id']};}if(_0x30f542[_0x93ce('0x3f')]===_0x93ce('0x4f')){_0x21f7a9['What_Id']={'name':!_[_0x93ce('0x19')](_0x30f542[_0x93ce('0x5e')])?_0x30f542[_0x93ce('0x5e')]:!_[_0x93ce('0x19')](_0x30f542[_0x93ce('0x5c')])?_0x30f542[_0x93ce('0x5c')]+'\x20'+_0x30f542[_0x93ce('0x5d')]:_0x30f542[_0x93ce('0x5d')],'id':_0x30f542['id']};_0x21f7a9['$se_module']=_[_0x93ce('0x40')](_0x30f542[_0x93ce('0x3f')]);}if(_0x4c3e4b[_0x93ce('0x5f')]){_0x21f7a9[_0x93ce('0x60')]=moment[_0x93ce('0x61')](parseInt(_0x4c3e4b['talktime'])*0x3e8)[_0x93ce('0x30')](_0x93ce('0x62'));}else if(_0x4c3e4b[_0x93ce('0x63')]&&_0x4c3e4b[_0x93ce('0x64')]){_0x21f7a9[_0x93ce('0x60')]=moment[_0x93ce('0x61')](moment(_0x4c3e4b[_0x93ce('0x64')],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x4c3e4b['starttime'],_0x93ce('0x65'))))[_0x93ce('0x30')]('mm:ss');}switch(_0x4c3e4b[_0x93ce('0x66')]){case _0x93ce('0x67'):_0x21f7a9['Call_Result']='Called';break;case _0x93ce('0x68'):case _0x93ce('0x69'):_0x21f7a9[_0x93ce('0x6a')]='Answered';break;case'rejected':_0x21f7a9['Call_Result']='Rejected';break;case'abandoned':_0x21f7a9[_0x93ce('0x6a')]='Abandoned';break;case _0x93ce('0x6b'):_0x21f7a9[_0x93ce('0x6a')]=_0x93ce('0x6c');default:}_0x21f7a9[_0x93ce('0x6d')]=(_0xf66210===_0x93ce('0x6e')?moment(_0x4c3e4b[_0x93ce('0x6f')])['format'](_0x93ce('0x65')):moment(_0x4c3e4b[_0x93ce('0x70')])[_0x93ce('0x30')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x93ce('0x30')](_0x93ce('0x65'));_0x21f7a9[_0x93ce('0x71')]=_0xf66210||_0x93ce('0x72');_0x21f7a9=_[_0x93ce('0x73')](_0x21f7a9,getCustomFields(_0xb1ad76['Fields'],_0x4c3e4b));return request({'method':_0x93ce('0x20'),'uri':_0x93ce('0x4c')+_0x357e75+'/crm/v2/Calls','headers':{'Authorization':_0x93ce('0x32')+_0x3bbafc},'body':{'data':[_0x21f7a9]},'json':!![]})[_0x93ce('0x26')](function(_0xd52fe7){if(_0xd52fe7&&_0xd52fe7[_0x93ce('0x3e')][0x0][_0x93ce('0x45')]==='SUCCESS'){logger['info'](_0x93ce('0x74'));return{'id':_0xd52fe7[_0x93ce('0x3e')][0x0][_0x93ce('0x46')]['id']};}})[_0x93ce('0x2a')](function(_0x4a0687){logger[_0x93ce('0x36')](_0x93ce('0x75'),_0x4a0687[_0x93ce('0x2d')]);console[_0x93ce('0x48')](_0x93ce('0x75'),_0x4a0687);});}exports[_0x93ce('0x76')]=function(_0x38bdbe,_0xd99a3f,_0x2113bf,_0x5a28dd,_0x255200,_0x204ee0){var _0x1ec9ae,_0x94e92b,_0x3a2b9b;_0x204ee0[_0x93ce('0x77')]=intUtil[_0x93ce('0x78')](_0x204ee0[_0x93ce('0x77')]);_0x204ee0[_0x93ce('0x79')]=intUtil[_0x93ce('0x78')](_0x204ee0['serverUrl']);if(_0x255200&&_0x255200[_0x93ce('0x7a')]){logger[_0x93ce('0x36')](_0x93ce('0x7b'),_0x93ce('0x7c'));_0xd99a3f[_0x93ce('0x7d')]=_0x204ee0[_0x93ce('0x79')]+'/api/voice/recordings/'+_0xd99a3f[_0x93ce('0x7e')]+_0x93ce('0x7f')+md5(_0xd99a3f[_0x93ce('0x7e')]);}else{_0xd99a3f[_0x93ce('0x7d')]='';}var _0x5e121c=_0x204ee0['host']===_0x93ce('0x80')?'eu':_0x93ce('0x81');return getAccessToken(_0x204ee0)[_0x93ce('0x26')](function(_0x3c31bc){_0x3a2b9b=_0x3c31bc;return getUser(_0x3a2b9b,_0x5e121c,_0x204ee0,_0x5a28dd[_0x93ce('0x35')]);})[_0x93ce('0x26')](function(_0x4f479c){_0x1ec9ae=_0x4f479c;logger[_0x93ce('0x36')]('The\x20User\x20ID\x20is:',_0x1ec9ae['id']);return getEndUser(_0x3a2b9b,_0x5e121c,_0x204ee0,_0xd99a3f[_0x93ce('0x82')],_0xd99a3f[_0x93ce('0x83')],_0x1ec9ae,_0x2113bf);})[_0x93ce('0x26')](function(_0x37748b){_0x94e92b=_0x37748b;return getCall(_0x3a2b9b,_0x5e121c,_0x204ee0,_0x1ec9ae,_0x94e92b,_0x2113bf,_0xd99a3f,_0x93ce('0x72'));})[_0x93ce('0x26')](function(_0x356cf9){if(_0x356cf9){logger['info'](_0x93ce('0x84'),_0x356cf9['id']);logger[_0x93ce('0x36')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x93ce('0x30')]('user:%s',_0x5a28dd[_0x93ce('0x16')]),_0x93ce('0x85'),{'uri':_0x93ce('0x86')+_0x204ee0['host']+_0x93ce('0x87')+_0x356cf9['id']});}})[_0x93ce('0x2a')](function(_0x341850){logger[_0x93ce('0x2b')](_0x93ce('0x7b'),JSON[_0x93ce('0xe')](_0x341850));});};exports[_0x93ce('0x6e')]=function(_0x5b2430,_0x54d72b,_0x6a1e29,_0x5ca59c,_0x5162a1,_0x11f6fb,_0x3453f3){var _0xeaba4,_0x57a4e5,_0x6f67bb;_0x11f6fb['host']=intUtil['stripTrailingSlash'](_0x11f6fb['host']);_0x11f6fb['serverUrl']=intUtil[_0x93ce('0x78')](_0x11f6fb[_0x93ce('0x79')]);if(_0x3453f3&&_0x3453f3['recordingFormat']&&_0x3453f3[_0x93ce('0x88')]!==_0x93ce('0x89')){logger['info'](_0x93ce('0x8a'),_0x93ce('0x7c'));_0x54d72b[_0x93ce('0x7d')]=_0x11f6fb['serverUrl']+_0x93ce('0x8b')+_0x54d72b[_0x93ce('0x7e')]+'/downloads?type=uniqueid&token='+md5(_0x54d72b[_0x93ce('0x7e')]);}var _0x136af9=_0x11f6fb['host']===_0x93ce('0x80')?'eu':_0x93ce('0x81');return getAccessToken(_0x11f6fb)[_0x93ce('0x26')](function(_0x356b41){_0x6f67bb=_0x356b41;return getUser(_0x6f67bb,_0x136af9,_0x11f6fb,_0x5ca59c[_0x93ce('0x35')]);})[_0x93ce('0x26')](function(_0x3c0c2f){_0xeaba4=_0x3c0c2f;logger[_0x93ce('0x36')](_0x93ce('0x8c'),_0xeaba4['id']);return getEndUser(_0x6f67bb,_0x136af9,_0x11f6fb,_0x54d72b[_0x93ce('0x8d')],_0x54d72b[_0x93ce('0x8e')],_0xeaba4,_0x6a1e29);})['then'](function(_0x35e1fd){_0x57a4e5=_0x35e1fd;return getCall(_0x6f67bb,_0x136af9,_0x11f6fb,_0xeaba4,_0x57a4e5,_0x6a1e29,_0x54d72b,_0x93ce('0x8f'));})['then'](function(_0x4ddf08){if(_0x4ddf08){logger[_0x93ce('0x36')]('The\x20Call\x20ID\x20is:',_0x4ddf08['id']);logger[_0x93ce('0x36')](_0x93ce('0x8a'),_0x93ce('0x90'));emit(util[_0x93ce('0x30')](_0x93ce('0x91'),_0x5ca59c[_0x93ce('0x16')]),_0x93ce('0x85'),{'uri':_0x93ce('0x86')+_0x11f6fb[_0x93ce('0x77')]+'/crm/EntityInfo.do?module=Calls&id='+_0x4ddf08['id']});}})['catch'](function(_0x11eceb){logger[_0x93ce('0x2b')](_0x93ce('0x8a'),JSON[_0x93ce('0xe')](_0x11eceb));});};exports['unmanaged']=function(_0xd1fb1e,_0x590d5d,_0xd989d3,_0x20c176,_0x20ae0c,_0x23cdd1){var _0x4aa1e5,_0xd2e310,_0x1b2b93;_0x23cdd1[_0x93ce('0x77')]=intUtil[_0x93ce('0x78')](_0x23cdd1['host']);_0x23cdd1[_0x93ce('0x79')]=intUtil[_0x93ce('0x78')](_0x23cdd1[_0x93ce('0x79')]);if(_0x20ae0c&&_0x20ae0c['monitor_format']){logger[_0x93ce('0x36')]('['+_0x590d5d['lastevent'][_0x93ce('0x92')]()+']','Recording\x20is\x20enabled!');_0x590d5d[_0x93ce('0x7d')]=_0x23cdd1[_0x93ce('0x79')]+_0x93ce('0x8b')+_0x590d5d[_0x93ce('0x7e')]+_0x93ce('0x7f')+md5(_0x590d5d['uniqueid']);}else{_0x590d5d[_0x93ce('0x7d')]='';}var _0x28ff34=_0x23cdd1['host']===_0x93ce('0x80')?'eu':_0x93ce('0x81');return getAccessToken(_0x23cdd1)[_0x93ce('0x26')](function(_0x2d80c4){_0x1b2b93=_0x2d80c4;return getUser(_0x1b2b93,_0x28ff34,_0x23cdd1);})[_0x93ce('0x26')](function(_0x37091c){_0x4aa1e5=_0x37091c;logger['info'](_0x93ce('0x8c'),_0x4aa1e5['id']);return getEndUser(_0x1b2b93,_0x28ff34,_0x23cdd1,_0x590d5d['calleridname'],_0x590d5d[_0x93ce('0x83')],_0x4aa1e5,_0xd989d3);})[_0x93ce('0x26')](function(_0x23b08d){_0xd2e310=_0x23b08d;return getCall(_0x1b2b93,_0x28ff34,_0x23cdd1,_0x4aa1e5,_0xd2e310,_0xd989d3,_0x590d5d,_0x93ce('0x72'));})[_0x93ce('0x26')](function(_0x4c5f5b){if(_0x4c5f5b){logger[_0x93ce('0x36')](_0x93ce('0x84'),_0x4c5f5b['id']);}})[_0x93ce('0x2a')](function(_0x292356){logger[_0x93ce('0x2b')]('['+_0x590d5d[_0x93ce('0x66')][_0x93ce('0x92')]()+']',JSON['stringify'](_0x292356));});}; \ No newline at end of file +var _0xc9de=['/downloads?type=uniqueid&token=','com','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','unmanaged','toUpperCase','zoho.eu','calleridnum','lodash','request-promise','md5','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','stringify','length','forEach','type','string','idField','content','variable','variableName','toString','Variable','name','toLowerCase','indexOf','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','then','data','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','enduserType','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','Contacts','nothing','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Descriptions','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','mm:ss','answertime','endtime','utc','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','connect','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','format','agentcalledAt','Call_Type','merge','Fields','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','Inbound','The\x20Call\x20ID\x20is:','https://crm.','/crm/EntityInfo.do?module=Calls&id=','[QUEUE]','recordingFormat','none','[OUTBOUND]'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc9de,0x140));var _0xec9d=function(_0x6dee2c,_0x1a2373){_0x6dee2c=_0x6dee2c-0x0;var _0x4119b2=_0xc9de[_0x6dee2c];return _0x4119b2;};'use strict';var _=require(_0xec9d('0x0'));var rp=require(_0xec9d('0x1'));var md5=require(_0xec9d('0x2'));var util=require('util');var intUtil=require(_0xec9d('0x3'));var moment=require(_0xec9d('0x4'));var Redis=require(_0xec9d('0x5'));var BPromise=require(_0xec9d('0x6'));var config=require(_0xec9d('0x7'));var logger=require(_0xec9d('0x8'))(_0xec9d('0x9'));config[_0xec9d('0xa')]=_['defaults'](config[_0xec9d('0xa')],{'host':_0xec9d('0xb'),'port':0x18eb});var io=require(_0xec9d('0xc'))(new Redis(config[_0xec9d('0xa')]));function emit(_0x5a781b,_0x19b61b,_0x552d43){io['to'](_0x5a781b)[_0xec9d('0xd')](_0x19b61b,_0x552d43);}function request(_0x56f2be){logger['debug']('[HTTP]',JSON[_0xec9d('0xe')](_0x56f2be));return rp(_0x56f2be);}function getCustomFields(_0x120698,_0x4faf62){var _0x42abe5={};if(_0x120698[_0xec9d('0xf')]>0x0){_[_0xec9d('0x10')](_0x120698,function(_0x5627e9){if(_0x5627e9[_0xec9d('0x11')]===_0xec9d('0x12')&&_0x5627e9[_0xec9d('0x13')]){_0x42abe5[_0x5627e9['idField']]=_0x5627e9[_0xec9d('0x14')]['toString']();}else if(_0x5627e9[_0xec9d('0x11')]===_0xec9d('0x15')&&_0x5627e9['variableName']&&_0x5627e9[_0xec9d('0x13')]&&_0x4faf62[_0x5627e9[_0xec9d('0x16')]]){_0x42abe5[_0x5627e9[_0xec9d('0x13')]]=_0x4faf62[_0x5627e9[_0xec9d('0x16')]][_0xec9d('0x17')]();}else if(_0x5627e9[_0xec9d('0x11')]==='customVariable'&&_0x5627e9[_0xec9d('0x18')]&&_0x5627e9[_0xec9d('0x18')][_0xec9d('0x19')]&&_0x5627e9['idField']&&_0x4faf62[_0x5627e9[_0xec9d('0x18')][_0xec9d('0x19')][_0xec9d('0x1a')]()]){_0x42abe5[_0x5627e9[_0xec9d('0x13')]]=_0x4faf62[_0x5627e9[_0xec9d('0x18')]['name']['toLowerCase']()][_0xec9d('0x17')]();}});}return _0x42abe5;}function getName(_0xcb7cb7){if(_0xcb7cb7[_0xec9d('0x1b')]('\x20')>0x0){var _0x33a967=_0xcb7cb7['split'](/ (.+)/);if(_0x33a967[0x1]){return _0x33a967;}}return[_0xcb7cb7,_0xcb7cb7];}var accountsTokens={};function getAccessToken(_0x3c525f){return new Promise(function(_0x4d930f,_0x463cbc){if(!_[_0xec9d('0x1c')](accountsTokens[_0x3c525f['id']])&&!_[_0xec9d('0x1c')](accountsTokens[_0x3c525f['id']][_0xec9d('0x1d')])){if(moment()['isBefore'](accountsTokens[_0x3c525f['id']][_0xec9d('0x1e')])){_0x4d930f(accountsTokens[_0x3c525f['id']][_0xec9d('0x1d')]);}}var _0x51ee86;switch(_0x3c525f[_0xec9d('0x1f')]){case'US':_0x51ee86=_0xec9d('0x20');break;case'AU':_0x51ee86='https://accounts.zoho.com.au';break;case'EU':_0x51ee86=_0xec9d('0x21');break;case'IN':_0x51ee86=_0xec9d('0x22');break;case'CN':_0x51ee86=_0xec9d('0x23');break;default:_0x51ee86=_0xec9d('0x21');break;}var _0x4f9b69={'method':_0xec9d('0x24'),'uri':_0x51ee86+_0xec9d('0x25'),'qs':{'refresh_token':_0x3c525f[_0xec9d('0x26')],'client_id':_0x3c525f['clientId'],'client_secret':_0x3c525f[_0xec9d('0x27')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x4f9b69)['then'](function(_0x183ffb){accountsTokens[_0x3c525f['id']]={'access_token':_0x183ffb[_0xec9d('0x1d')],'expires_in':moment()[_0xec9d('0x28')](_0x183ffb[_0xec9d('0x1e')],_0xec9d('0x29'))};_0x4d930f(_0x183ffb['access_token']);})[_0xec9d('0x2a')](function(_0x5c4e9d){logger[_0xec9d('0x2b')](_0xec9d('0x2c'),_0x5c4e9d[_0xec9d('0x2d')]);_0x463cbc(_0x5c4e9d);});});}function getUser(_0x3bfc0c,_0x62d4ea,_0x5a311a,_0x383d6e){logger[_0xec9d('0x2e')]('Search\x20user');return request({'method':_0xec9d('0x2f'),'uri':util['format'](_0xec9d('0x30'),_0x62d4ea),'qs':{'type':_0xec9d('0x31')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3bfc0c},'json':!![]})['then'](function(_0x58307a){if(_0x58307a[_0xec9d('0x32')]){var _0xc44fc4=-0x1;if(_[_0xec9d('0x33')](_0x58307a['users'])){if(!_[_0xec9d('0x1c')](_0x383d6e)){_0xc44fc4=_[_0xec9d('0x34')](_0x58307a[_0xec9d('0x32')],function(_0x191be3){return _0x191be3[_0xec9d('0x35')]===_0x383d6e;});}if(_0xc44fc4>=0x0){logger[_0xec9d('0x2e')](_0xec9d('0x36'));}else{logger[_0xec9d('0x2e')](_0xec9d('0x37'));_0xc44fc4=_[_0xec9d('0x34')](_0x58307a['users'],function(_0x728515){return _0x728515[_0xec9d('0x38')][_0xec9d('0x19')]===_0xec9d('0x39');});}return _0x58307a[_0xec9d('0x32')][_0xc44fc4];}else{if(_0x58307a[_0xec9d('0x3a')][_0xec9d('0x38')]['name']==='Administrator'){logger[_0xec9d('0x2e')](_0xec9d('0x37'));user=_0x58307a[_0xec9d('0x3a')];return user;}else{logger['error'](_0xec9d('0x3b'),JSON[_0xec9d('0xe')](_0x58307a));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xec9d('0xe')](_0x58307a));}}}else{logger['error'](_0xec9d('0x3b'),JSON[_0xec9d('0xe')](_0x58307a));throw new Error(_0xec9d('0x3c')+JSON[_0xec9d('0xe')](_0x58307a));}})[_0xec9d('0x2a')](function(_0xaf92b8){console[_0xec9d('0x2b')](_0xaf92b8);});}function getZohoUser(_0x404478,_0xdfd2fd){return new BPromise(function(_0x2b0516,_0x5cbb39){request(_0x404478)[_0xec9d('0x3d')](function(_0x5c6c59){var _0x126c8c=null;if(_0x5c6c59){_0x126c8c=_0x5c6c59[_0xec9d('0x3e')][0x0];_0x126c8c['enduserType']=_0xdfd2fd;}_0x2b0516(_0x126c8c);})[_0xec9d('0x2a')](function(_0x2b4a55){_0x5cbb39(_0x2b4a55);});});}function createEndUser(_0x4a81bb,_0x4ee4c0,_0x4caa31,_0x501c0c,_0x8c6d9a,_0xe890e1){var _0x4caa31=getName(_0x4caa31);return request({'method':_0xec9d('0x24'),'uri':'https://www.zohoapis.'+_0x4ee4c0+_0xec9d('0x3f')+_[_0xec9d('0x40')](_0xe890e1[_0xec9d('0x41')])+'s','body':{'data':[{'Last_Name':_0x4caa31[0x1],'First_Name':_0x4caa31[0x0],'Phone':_0x501c0c,'Owner':{'name':!_[_0xec9d('0x1c')](_0x8c6d9a[_0xec9d('0x42')][_0xec9d('0x19')])?_0x8c6d9a[_0xec9d('0x42')]['name']:!_[_0xec9d('0x1c')](_0x8c6d9a[_0xec9d('0x43')])?_0x8c6d9a[_0xec9d('0x43')]+'\x20'+_0x8c6d9a[_0xec9d('0x44')]:_0x8c6d9a['last_name'],'id':_0x8c6d9a['id']}}]},'headers':{'Authorization':_0xec9d('0x45')+_0x4a81bb},'json':!![]})[_0xec9d('0x3d')](function(_0x20eefb){if(_0x20eefb&&_0x20eefb[_0xec9d('0x3e')][0x0][_0xec9d('0x46')]===_0xec9d('0x47')){var _0xc92998=_0x20eefb[_0xec9d('0x3e')][0x0]['details'];_0xc92998[_0xec9d('0x48')]=_[_0xec9d('0x40')](_0xe890e1[_0xec9d('0x41')])+'s';return _0xc92998;}logger[_0xec9d('0x2b')](_0xec9d('0x3b'),JSON[_0xec9d('0xe')](data));throw new Error(_0xec9d('0x49')+JSON[_0xec9d('0xe')](data));})[_0xec9d('0x2a')](function(_0x5e7c54){console[_0xec9d('0x4a')](_0xec9d('0x4b'),_0x5e7c54);});}function getEndUser(_0x1b27ca,_0x1d9e49,_0x22184e,_0x6ca6dc,_0x12c9dd,_0x1e6926,_0x3b696d){var _0x895100={'method':_0xec9d('0x2f'),'uri':'','headers':{'Authorization':_0xec9d('0x45')+_0x1b27ca},'json':!![]};switch(_0x3b696d['moduleSearch']){case _0xec9d('0x4c'):_0x895100[_0xec9d('0x4d')]=_0xec9d('0x4e')+_0x1d9e49+_0xec9d('0x4f')+_0x12c9dd+'))';return getZohoUser(_0x895100,'Contacts')['then'](function(_0x467d5f){if(_0x467d5f)return _0x467d5f;_0x895100[_0xec9d('0x4d')]='https://www.zohoapis.'+_0x1d9e49+_0xec9d('0x50')+_0x12c9dd+'))';return getZohoUser(_0x895100,_0xec9d('0x51'))[_0xec9d('0x3d')](function(_0x32e3a8){if(_0x32e3a8)return _0x32e3a8;if(_0x3b696d[_0xec9d('0x41')]!='nothing'){return createEndUser(_0x1b27ca,_0x1d9e49,_0x6ca6dc,_0x12c9dd,_0x1e6926,_0x3b696d);}else{return{};}});});break;case _0xec9d('0x52'):_0x895100[_0xec9d('0x4d')]=_0xec9d('0x4e')+_0x1d9e49+_0xec9d('0x4f')+_0x12c9dd+'))';return getZohoUser(_0x895100,_0xec9d('0x53'))[_0xec9d('0x3d')](function(_0x6c6fb7){if(_0x6c6fb7)return _0x6c6fb7;if(_0x3b696d['moduleCreate']!=_0xec9d('0x54')){return createEndUser(_0x1b27ca,_0x1d9e49,_0x6ca6dc,_0x12c9dd,_0x1e6926,_0x3b696d);}else{return{};}});break;case _0xec9d('0x55'):_0x895100['uri']=_0xec9d('0x4e')+_0x1d9e49+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x12c9dd+'))';return getZohoUser(_0x895100,_0xec9d('0x51'))[_0xec9d('0x3d')](function(_0x308e60){if(_0x308e60)return _0x308e60;if(_0x3b696d[_0xec9d('0x41')]!=_0xec9d('0x54')){return createEndUser(_0x1b27ca,_0x1d9e49,_0x6ca6dc,_0x12c9dd,_0x1e6926,_0x3b696d);}else{return{};}});break;}}function getCall(_0x50b249,_0x990cb3,_0x53845a,_0x28c56f,_0x2cb698,_0x162027,_0x85defa,_0x40d48a){logger[_0xec9d('0x2e')](_0xec9d('0x56'));var _0x3579d6={};_0x3579d6[_0xec9d('0x57')]={'name':!_['isNil'](_0x28c56f[_0xec9d('0x42')][_0xec9d('0x19')])&&!_[_0xec9d('0x1c')](_0x28c56f[_0xec9d('0x38')][_0xec9d('0x19')])&&_0x28c56f[_0xec9d('0x38')][_0xec9d('0x19')]===_0xec9d('0x58')?_0x28c56f['role'][_0xec9d('0x19')]:!_[_0xec9d('0x1c')](_0x28c56f[_0xec9d('0x43')])?_0x28c56f[_0xec9d('0x43')]+'\x20'+_0x28c56f[_0xec9d('0x44')]:_0x28c56f[_0xec9d('0x44')],'id':_0x28c56f['id']};_0x3579d6[_0xec9d('0x59')]=intUtil[_0xec9d('0x5a')](_0x162027[_0xec9d('0x5b')],_0x85defa,'\x20');_0x3579d6['Description']=intUtil['getString'](_0x162027[_0xec9d('0x5c')],_0x85defa,'\x0a');if(_0x2cb698['enduserType']===_0xec9d('0x53')){_0x3579d6['Who_Id']={'name':!_[_0xec9d('0x1c')](_0x2cb698[_0xec9d('0x5d')])?_0x2cb698[_0xec9d('0x5d')]:!_[_0xec9d('0x1c')](_0x2cb698[_0xec9d('0x5e')])?_0x2cb698[_0xec9d('0x5e')]+'\x20'+_0x2cb698[_0xec9d('0x5f')]:_0x2cb698[_0xec9d('0x5f')],'id':_0x2cb698['id']};}if(_0x2cb698[_0xec9d('0x48')]===_0xec9d('0x51')){_0x3579d6[_0xec9d('0x60')]={'name':!_[_0xec9d('0x1c')](_0x2cb698[_0xec9d('0x5d')])?_0x2cb698[_0xec9d('0x5d')]:!_[_0xec9d('0x1c')](_0x2cb698[_0xec9d('0x5e')])?_0x2cb698['First_Name']+'\x20'+_0x2cb698[_0xec9d('0x5f')]:_0x2cb698[_0xec9d('0x5f')],'id':_0x2cb698['id']};_0x3579d6['$se_module']=_['startCase'](_0x2cb698[_0xec9d('0x48')]);}if(_0x85defa[_0xec9d('0x61')]){_0x3579d6[_0xec9d('0x62')]=moment['utc'](parseInt(_0x85defa[_0xec9d('0x61')])*0x3e8)['format'](_0xec9d('0x63'));}else if(_0x85defa[_0xec9d('0x64')]&&_0x85defa[_0xec9d('0x65')]){_0x3579d6[_0xec9d('0x62')]=moment[_0xec9d('0x66')](moment(_0x85defa[_0xec9d('0x65')],'YYYY-MM-DDTHH:mm:ss')[_0xec9d('0x67')](moment(_0x85defa[_0xec9d('0x68')],_0xec9d('0x69'))))['format'](_0xec9d('0x63'));}switch(_0x85defa[_0xec9d('0x6a')]){case _0xec9d('0x6b'):_0x3579d6[_0xec9d('0x6c')]=_0xec9d('0x6d');break;case _0xec9d('0x6e'):case _0xec9d('0x6f'):_0x3579d6[_0xec9d('0x6c')]='Answered';break;case _0xec9d('0x70'):_0x3579d6[_0xec9d('0x6c')]=_0xec9d('0x71');break;case _0xec9d('0x72'):_0x3579d6[_0xec9d('0x6c')]=_0xec9d('0x73');break;case _0xec9d('0x74'):_0x3579d6[_0xec9d('0x6c')]=_0xec9d('0x75');default:}_0x3579d6[_0xec9d('0x76')]=(_0x40d48a===_0xec9d('0x77')?moment(_0x85defa[_0xec9d('0x68')])[_0xec9d('0x78')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x85defa[_0xec9d('0x79')])[_0xec9d('0x78')](_0xec9d('0x69')))||moment()[_0xec9d('0x78')]('YYYY-MM-DDTHH:mm:ss');_0x3579d6[_0xec9d('0x7a')]=_0x40d48a||'Inbound';_0x3579d6=_[_0xec9d('0x7b')](_0x3579d6,getCustomFields(_0x162027[_0xec9d('0x7c')],_0x85defa));return request({'method':'POST','uri':_0xec9d('0x4e')+_0x990cb3+'/crm/v2/Calls','headers':{'Authorization':_0xec9d('0x45')+_0x50b249},'body':{'data':[_0x3579d6]},'json':!![]})[_0xec9d('0x3d')](function(_0x4cd029){if(_0x4cd029&&_0x4cd029[_0xec9d('0x3e')][0x0][_0xec9d('0x46')]==='SUCCESS'){logger[_0xec9d('0x2e')]('Call\x20created!');return{'id':_0x4cd029['data'][0x0]['details']['id']};}})[_0xec9d('0x2a')](function(_0xf27573){logger[_0xec9d('0x2e')](_0xec9d('0x7d'),_0xf27573[_0xec9d('0x2d')]);console[_0xec9d('0x4a')]('err',_0xf27573);});}exports[_0xec9d('0x7e')]=function(_0x273906,_0x5233b6,_0x6ee416,_0x53c3d7,_0xe4b9de,_0x3bd692){var _0x52eda2,_0x3f246f,_0x36ceb3;_0x3bd692[_0xec9d('0x7f')]=intUtil[_0xec9d('0x80')](_0x3bd692[_0xec9d('0x7f')]);_0x3bd692['serverUrl']=intUtil[_0xec9d('0x80')](_0x3bd692[_0xec9d('0x81')]);if(_0xe4b9de&&_0xe4b9de[_0xec9d('0x82')]){logger[_0xec9d('0x2e')]('[QUEUE]',_0xec9d('0x83'));_0x5233b6['recordingURL']=_0x3bd692[_0xec9d('0x81')]+_0xec9d('0x84')+_0x5233b6['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x5233b6[_0xec9d('0x85')]);}else{_0x5233b6[_0xec9d('0x86')]='';}var _0x3e9b53=_0x3bd692[_0xec9d('0x7f')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x3bd692)['then'](function(_0xf8de6f){_0x36ceb3=_0xf8de6f;return getUser(_0x36ceb3,_0x3e9b53,_0x3bd692,_0x53c3d7[_0xec9d('0x35')]);})[_0xec9d('0x3d')](function(_0x46cb4a){_0x52eda2=_0x46cb4a;logger[_0xec9d('0x2e')](_0xec9d('0x87'),_0x52eda2['id']);return getEndUser(_0x36ceb3,_0x3e9b53,_0x3bd692,_0x5233b6[_0xec9d('0x88')],_0x5233b6['calleridnum'],_0x52eda2,_0x6ee416);})[_0xec9d('0x3d')](function(_0x3f012f){_0x3f246f=_0x3f012f;return getCall(_0x36ceb3,_0x3e9b53,_0x3bd692,_0x52eda2,_0x3f246f,_0x6ee416,_0x5233b6,_0xec9d('0x89'));})[_0xec9d('0x3d')](function(_0x2d0b34){if(_0x2d0b34){logger[_0xec9d('0x2e')](_0xec9d('0x8a'),_0x2d0b34['id']);logger['info']('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xec9d('0x78')]('user:%s',_0x53c3d7[_0xec9d('0x19')]),'trigger:browser:url',{'uri':_0xec9d('0x8b')+_0x3bd692[_0xec9d('0x7f')]+_0xec9d('0x8c')+_0x2d0b34['id']});}})[_0xec9d('0x2a')](function(_0x44b30d){logger[_0xec9d('0x2b')](_0xec9d('0x8d'),JSON[_0xec9d('0xe')](_0x44b30d));});};exports['outbound']=function(_0x1b2b9c,_0x2b5352,_0xc8b77d,_0x2db73e,_0x3ca0af,_0x117a96,_0x3abb86){var _0x4a760a,_0x2a3945,_0x933aa5;_0x117a96[_0xec9d('0x7f')]=intUtil[_0xec9d('0x80')](_0x117a96['host']);_0x117a96[_0xec9d('0x81')]=intUtil[_0xec9d('0x80')](_0x117a96['serverUrl']);if(_0x3abb86&&_0x3abb86[_0xec9d('0x8e')]&&_0x3abb86[_0xec9d('0x8e')]!==_0xec9d('0x8f')){logger[_0xec9d('0x2e')](_0xec9d('0x90'),_0xec9d('0x83'));_0x2b5352[_0xec9d('0x86')]=_0x117a96[_0xec9d('0x81')]+_0xec9d('0x84')+_0x2b5352[_0xec9d('0x85')]+_0xec9d('0x91')+md5(_0x2b5352[_0xec9d('0x85')]);}var _0x5bc67a=_0x117a96[_0xec9d('0x7f')]==='zoho.eu'?'eu':_0xec9d('0x92');return getAccessToken(_0x117a96)[_0xec9d('0x3d')](function(_0x37ab09){_0x933aa5=_0x37ab09;return getUser(_0x933aa5,_0x5bc67a,_0x117a96,_0x2db73e['email']);})[_0xec9d('0x3d')](function(_0x517501){_0x4a760a=_0x517501;logger[_0xec9d('0x2e')]('The\x20User\x20ID\x20is:',_0x4a760a['id']);return getEndUser(_0x933aa5,_0x5bc67a,_0x117a96,_0x2b5352['destcalleridname'],_0x2b5352[_0xec9d('0x93')],_0x4a760a,_0xc8b77d);})['then'](function(_0x5599ec){_0x2a3945=_0x5599ec;return getCall(_0x933aa5,_0x5bc67a,_0x117a96,_0x4a760a,_0x2a3945,_0xc8b77d,_0x2b5352,_0xec9d('0x94'));})[_0xec9d('0x3d')](function(_0x2d06cc){if(_0x2d06cc){logger[_0xec9d('0x2e')](_0xec9d('0x8a'),_0x2d06cc['id']);logger[_0xec9d('0x2e')]('[OUTBOUND]',_0xec9d('0x95'));emit(util[_0xec9d('0x78')]('user:%s',_0x2db73e[_0xec9d('0x19')]),_0xec9d('0x96'),{'uri':_0xec9d('0x8b')+_0x117a96[_0xec9d('0x7f')]+_0xec9d('0x8c')+_0x2d06cc['id']});}})[_0xec9d('0x2a')](function(_0x254eb1){logger['error'](_0xec9d('0x90'),JSON[_0xec9d('0xe')](_0x254eb1));});};exports[_0xec9d('0x97')]=function(_0x178802,_0x440977,_0x5a68ef,_0x52add2,_0x21c037,_0x54ab92){var _0x5cf082,_0xafb31,_0x91460e;_0x54ab92[_0xec9d('0x7f')]=intUtil[_0xec9d('0x80')](_0x54ab92[_0xec9d('0x7f')]);_0x54ab92[_0xec9d('0x81')]=intUtil['stripTrailingSlash'](_0x54ab92[_0xec9d('0x81')]);if(_0x21c037&&_0x21c037[_0xec9d('0x82')]){logger[_0xec9d('0x2e')]('['+_0x440977['lastevent'][_0xec9d('0x98')]()+']',_0xec9d('0x83'));_0x440977[_0xec9d('0x86')]=_0x54ab92['serverUrl']+_0xec9d('0x84')+_0x440977[_0xec9d('0x85')]+'/downloads?type=uniqueid&token='+md5(_0x440977[_0xec9d('0x85')]);}else{_0x440977[_0xec9d('0x86')]='';}var _0x12ff68=_0x54ab92[_0xec9d('0x7f')]===_0xec9d('0x99')?'eu':'com';return getAccessToken(_0x54ab92)[_0xec9d('0x3d')](function(_0x153456){_0x91460e=_0x153456;return getUser(_0x91460e,_0x12ff68,_0x54ab92);})[_0xec9d('0x3d')](function(_0x938332){_0x5cf082=_0x938332;logger[_0xec9d('0x2e')](_0xec9d('0x87'),_0x5cf082['id']);return getEndUser(_0x91460e,_0x12ff68,_0x54ab92,_0x440977[_0xec9d('0x88')],_0x440977[_0xec9d('0x9a')],_0x5cf082,_0x5a68ef);})[_0xec9d('0x3d')](function(_0xecefa2){_0xafb31=_0xecefa2;return getCall(_0x91460e,_0x12ff68,_0x54ab92,_0x5cf082,_0xafb31,_0x5a68ef,_0x440977,'Inbound');})['then'](function(_0x442d4b){if(_0x442d4b){logger[_0xec9d('0x2e')]('The\x20Call\x20ID\x20is:',_0x442d4b['id']);}})[_0xec9d('0x2a')](function(_0x3d02e1){logger[_0xec9d('0x2b')]('['+_0x440977['lastevent'][_0xec9d('0x98')]()+']',JSON[_0xec9d('0xe')](_0x3d02e1));});}; \ 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 f23db73..24c9378 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(_0x2984f8,_0x2ff9b8){var _0x31335c=function(_0x37b5ce){while(--_0x37b5ce){_0x2984f8['push'](_0x2984f8['shift']());}};_0x31335c(++_0x2ff9b8);}(_0x7a54,0x106));var _0x47a5=function(_0x22f783,_0x22eb48){_0x22f783=_0x22f783-0x0;var _0x23d87b=_0x7a54[_0x22f783];return _0x23d87b;};'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(_0x865a61,_0x4b70b6){var _0x2190b5=function(_0x2b17af){while(--_0x2b17af){_0x865a61['push'](_0x865a61['shift']());}};_0x2190b5(++_0x4b70b6);}(_0x7a54,0x106));var _0x47a5=function(_0x5c6a34,_0x25d3cf){_0x5c6a34=_0x5c6a34-0x0;var _0xc3e937=_0x7a54[_0x5c6a34];return _0xc3e937;};'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 6f193af..3348075 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 _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x557f87,_0x2f054e){var _0x5ae4b8=function(_0x47601c){while(--_0x47601c){_0x557f87['push'](_0x557f87['shift']());}};_0x5ae4b8(++_0x2f054e);}(_0xb10b,0x12a));var _0xbb10=function(_0x73ea6d,_0x57d5bd){_0x73ea6d=_0x73ea6d-0x0;var _0x4c3a66=_0xb10b[_0x73ea6d];return _0x4c3a66;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x6aff0a,_0x182b4c){var _0x2e631d=function(_0x260c7f){while(--_0x260c7f){_0x6aff0a['push'](_0x6aff0a['shift']());}};_0x2e631d(++_0x182b4c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x7b92d7,_0x37466a){_0x7b92d7=_0x7b92d7-0x0;var _0x132089=_0x5f2f[_0x7b92d7];return _0x132089;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 9787733..aa6c5cd 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 _0xf483=['bluebird','routing','client','http','Request','then','rpc','error','message','catch','exports'];(function(_0x27fdc6,_0xc36ece){var _0x32db5d=function(_0x9246a1){while(--_0x9246a1){_0x27fdc6['push'](_0x27fdc6['shift']());}};_0x32db5d(++_0xc36ece);}(_0xf483,0xf2));var _0x3f48=function(_0x41ff02,_0x14ef9f){_0x41ff02=_0x41ff02-0x0;var _0x281626=_0xf483[_0x41ff02];return _0x281626;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x3f48('0x0'));var logger=require('../../config/logger')(_0x3f48('0x1'));var client=jayson[_0x3f48('0x2')][_0x3f48('0x3')]({'port':0x2329});client[_0x3f48('0x4')]=function(_0x169391,_0x312d9c){return new BPromise(function(_0x5deb61,_0x49f64a){return client['request'](_0x169391,_0x312d9c)[_0x3f48('0x5')](function(_0x16905e){logger['debug'](_0x3f48('0x6'),_0x3f48('0x1'),_0x169391,_0x312d9c,_0x16905e);if(_0x16905e[_0x3f48('0x7')]){logger[_0x3f48('0x7')](_0x3f48('0x6'),_0x3f48('0x1'),_0x169391,_0x16905e[_0x3f48('0x7')]['message'],_0x312d9c);return _0x49f64a(_0x16905e[_0x3f48('0x7')][_0x3f48('0x8')]);}else{return _0x5deb61(_0x16905e['result']);}})[_0x3f48('0x9')](function(_0x5bf756){logger[_0x3f48('0x7')](_0x3f48('0x6'),_0x3f48('0x1'),_0x169391,_0x5bf756,_0x312d9c);return _0x49f64a(_0x5bf756);});});};module[_0x3f48('0xa')]=client; \ No newline at end of file +var _0x8f7d=['error','message','result','catch','exports','jayson/promise','bluebird','routing','Request','request','debug','rpc'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x8f7d,0xf5));var _0xd8f7=function(_0x4ab440,_0x43d110){_0x4ab440=_0x4ab440-0x0;var _0x10b67d=_0x8f7d[_0x4ab440];return _0x10b67d;};'use strict';var jayson=require(_0xd8f7('0x0'));var BPromise=require(_0xd8f7('0x1'));var logger=require('../../config/logger')(_0xd8f7('0x2'));var client=jayson['client']['http']({'port':0x2329});client[_0xd8f7('0x3')]=function(_0x530e1b,_0x9558b6){return new BPromise(function(_0x338be3,_0x1b9964){return client[_0xd8f7('0x4')](_0x530e1b,_0x9558b6)['then'](function(_0x4090c9){logger[_0xd8f7('0x5')](_0xd8f7('0x6'),_0xd8f7('0x2'),_0x530e1b,_0x9558b6,_0x4090c9);if(_0x4090c9[_0xd8f7('0x7')]){logger[_0xd8f7('0x7')](_0xd8f7('0x6'),_0xd8f7('0x2'),_0x530e1b,_0x4090c9['error'][_0xd8f7('0x8')],_0x9558b6);return _0x1b9964(_0x4090c9['error'][_0xd8f7('0x8')]);}else{return _0x338be3(_0x4090c9[_0xd8f7('0x9')]);}})[_0xd8f7('0xa')](function(_0x25e4d3){logger[_0xd8f7('0x7')](_0xd8f7('0x6'),_0xd8f7('0x2'),_0x530e1b,_0x25e4d3,_0x9558b6);return _0x1b9964(_0x25e4d3);});});};module[_0xd8f7('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index f6ab5aa..1562087 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 _0xdbf7=['mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','then','refresh'];(function(_0x2d24e2,_0x38c3af){var _0x330f61=function(_0x15c233){while(--_0x15c233){_0x2d24e2['push'](_0x2d24e2['shift']());}};_0x330f61(++_0x38c3af);}(_0xdbf7,0x8d));var _0x7dbf=function(_0x80196d,_0x552875){_0x80196d=_0x80196d-0x0;var _0x28e74e=_0xdbf7[_0x80196d];return _0x28e74e;};'use strict';var BPromise=require(_0x7dbf('0x0'));var server=require(_0x7dbf('0x1'));var Realtime=require(_0x7dbf('0x2'));var EmailChannel=require(_0x7dbf('0x3'));var mailAccount=require(_0x7dbf('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x7dbf('0x5'))['db'];function initRealtime(){return BPromise[_0x7dbf('0x6')]()[_0x7dbf('0x7')](mailAccount['getMailAccounts']())[_0x7dbf('0x7')](realtime['initMailAccounts']())['then'](function(){email[_0x7dbf('0x8')](realtime[_0x7dbf('0x9')]);return realtime;});}function main(){return server[_0x7dbf('0xa')](realtime,email)[_0x7dbf('0x7')](function(_0x29f02b){return initRealtime();})[_0x7dbf('0x7')](function(_0x3f4efe){return db[_0x7dbf('0xb')][_0x7dbf('0xc')]({'attributes':['id',_0x7dbf('0xd')],'raw':!![]});})[_0x7dbf('0x7')](function(_0x406ad4){return setInterval(initRealtime,_0x406ad4[_0x7dbf('0xd')]*0x3e8);})[_0x7dbf('0xe')](function(_0x3a27c8){console['log'](_0x3a27c8);});}main(); \ No newline at end of file +var _0xb1a3=['bluebird','./server','./realtime','./rpc/mailAccount','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','loginMailFrequency'];(function(_0xc07e39,_0x5a6204){var _0x570daf=function(_0x44ba66){while(--_0x44ba66){_0xc07e39['push'](_0xc07e39['shift']());}};_0x570daf(++_0x5a6204);}(_0xb1a3,0x1cc));var _0x3b1a=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0xb1a3[_0x56f7e2];return _0x36240b;};'use strict';var BPromise=require(_0x3b1a('0x0'));var server=require(_0x3b1a('0x1'));var Realtime=require(_0x3b1a('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x3b1a('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise['resolve']()[_0x3b1a('0x4')](mailAccount[_0x3b1a('0x5')]())[_0x3b1a('0x4')](realtime[_0x3b1a('0x6')]())[_0x3b1a('0x4')](function(){email[_0x3b1a('0x7')](realtime[_0x3b1a('0x8')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x3b1a('0x4')](function(_0x40db87){return initRealtime();})[_0x3b1a('0x4')](function(_0x2ee89f){return db['Setting']['findOne']({'attributes':['id',_0x3b1a('0x9')],'raw':!![]});})[_0x3b1a('0x4')](function(_0x4cd175){return setInterval(initRealtime,_0x4cd175[_0x3b1a('0x9')]*0x3e8);})['catch'](function(_0xc6d255){console['log'](_0xc6d255);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index afa2c79..8c29000 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 _0x686b=['verify','Smtp','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','defaults','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','email','box','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send'];(function(_0x48ea46,_0x2fdb2a){var _0x1cbb34=function(_0x8e156c){while(--_0x8e156c){_0x48ea46['push'](_0x48ea46['shift']());}};_0x1cbb34(++_0x2fdb2a);}(_0x686b,0x70));var _0xb686=function(_0x453bdc,_0x131979){_0x453bdc=_0x453bdc-0x0;var _0x4941f3=_0x686b[_0x453bdc];return _0x4941f3;};'use strict';var _=require(_0xb686('0x0'));var moment=require(_0xb686('0x1'));var BPromise=require(_0xb686('0x2'));var md5=require(_0xb686('0x3'));var Redis=require(_0xb686('0x4'));var config=require(_0xb686('0x5'));var logger=require(_0xb686('0x6'))('email');config['redis']=_[_0xb686('0x7')](config[_0xb686('0x8')],{'host':_0xb686('0x9'),'port':0x18eb});var io=require(_0xb686('0xa'))(new Redis(config[_0xb686('0x8')]));var EmailImap=require(_0xb686('0xb'));var EmailSmtp=require(_0xb686('0xc'));var mailAccount=require(_0xb686('0xd'));var md5Accounts={};function EmailChannel(_0x2e097c){logger[_0xb686('0xe')](_0xb686('0xf'));this[_0xb686('0x10')]=_0x2e097c[_0xb686('0x10')];this[_0xb686('0x11')]={};this[_0xb686('0x12')]=new EmailSmtp();}EmailChannel[_0xb686('0x13')][_0xb686('0x14')]=function(_0xd21031){var _0xbf78a9=this[_0xb686('0x10')][_0xd21031];var _0x18dad5={'id':_0xbf78a9['id'],'name':_0xbf78a9[_0xb686('0x15')],'key':_0xbf78a9['key'],'active':_0xbf78a9['active'],'Imap':{'status':_0xbf78a9[_0xb686('0x16')][_0xb686('0x17')],'messageStatus':_0xbf78a9[_0xb686('0x16')][_0xb686('0x18')],'total':_0xbf78a9['Imap'][_0xb686('0x19')]}};if(_[_0xb686('0x1a')](md5Accounts[_0xd21031])){md5Accounts[_0xd21031]={};}var _0x340c58=md5(JSON[_0xb686('0x1b')](_0x18dad5));if(md5Accounts[_0xd21031][_0xb686('0x3')]!==_0x340c58){md5Accounts[_0xd21031][_0xb686('0x3')]=_0x340c58;io['emit'](_0xb686('0x1c'),_0x18dad5);}};EmailChannel[_0xb686('0x13')][_0xb686('0x1d')]=function(_0x283f0c){for(var _0x32fa23 in _0x283f0c){if(_0x283f0c[_0xb686('0x1e')](_0x32fa23)){if(_0x283f0c[_0x32fa23][_0xb686('0x16')]&&_0x283f0c[_0x32fa23]['active']){var _0x352668=_0x283f0c[_0x32fa23]['Imap'];if(!this[_0xb686('0x11')][_0xb686('0x1e')](_0x352668['id'])){this[_0xb686('0x11')][_0x352668['id']]=new EmailImap(_0x352668,_0x283f0c[_0x32fa23][_0xb686('0x1f')]);this['imapAccounts'][_0x352668['id']]['on'](_0xb686('0x20'),this['handleImapBox'][_0xb686('0x21')](this,_0x32fa23));this[_0xb686('0x11')][_0x352668['id']]['on'](_0xb686('0x1f'),this[_0xb686('0x22')]['bind'](this,_0x32fa23));this['imapAccounts'][_0x352668['id']]['on'](_0xb686('0x23'),this[_0xb686('0x24')][_0xb686('0x21')](this,_0x32fa23));this[_0xb686('0x11')][_0x352668['id']]['on'](_0xb686('0x25'),this[_0xb686('0x26')][_0xb686('0x21')](this,_0x32fa23));}}else{if(_['isNil'](this[_0xb686('0x10')][_0x32fa23][_0xb686('0x16')])){this[_0xb686('0x10')][_0x32fa23][_0xb686('0x16')]={};}this[_0xb686('0x10')][_0x32fa23][_0xb686('0x16')][_0xb686('0x17')]=_0xb686('0x27');this[_0xb686('0x10')][_0x32fa23][_0xb686('0x16')]['messageStatus']='';this['emit'](_0x32fa23);}}}};EmailChannel[_0xb686('0x13')][_0xb686('0x28')]=function(_0xd9b48b,_0x551fad){if(this['mailAccounts'][_0xd9b48b]){this['mailAccounts'][_0xd9b48b][_0xb686('0x16')][_0xb686('0x17')]=_0xb686('0x29');this[_0xb686('0x10')][_0xd9b48b][_0xb686('0x16')][_0xb686('0x18')]=_0x551fad[_0xb686('0x15')];if(_0x551fad['messages']){this['mailAccounts'][_0xd9b48b][_0xb686('0x16')][_0xb686('0x19')]=_0x551fad[_0xb686('0x2a')][_0xb686('0x19')];}return this[_0xb686('0x14')](_0xd9b48b);}};EmailChannel[_0xb686('0x13')][_0xb686('0x22')]=function(_0x262657,_0x4bdf8b){logger[_0xb686('0xe')](_0xb686('0x2b'),_0x4bdf8b['firstName'],_0x4bdf8b[_0xb686('0x2c')],_0x4bdf8b['from'],_0x262657);if(this[_0xb686('0x10')][_0x262657]){return mailAccount[_0xb686('0x2d')](_0x262657,_0x4bdf8b)[_0xb686('0x2e')](function(_0x209779){if(_0x209779){logger[_0xb686('0xe')](_0xb686('0x2f'));}})[_0xb686('0x30')](function(_0x32e954){logger['error'](_0xb686('0x31'),JSON[_0xb686('0x1b')](_0x32e954));});}};EmailChannel['prototype'][_0xb686('0x24')]=function(_0x32371e){if(this[_0xb686('0x10')][_0x32371e]&&this[_0xb686('0x10')][_0x32371e][_0xb686('0x16')]){if(this[_0xb686('0x11')][this[_0xb686('0x10')][_0x32371e][_0xb686('0x16')]['id']]){delete this[_0xb686('0x11')][this[_0xb686('0x10')][_0x32371e]['Imap']['id']];}this[_0xb686('0x10')][_0x32371e][_0xb686('0x16')][_0xb686('0x32')]=moment();this['emit'](_0x32371e);}};EmailChannel[_0xb686('0x13')]['handleImapError']=function(_0x31bb4e,_0x1f1fb4){if(this[_0xb686('0x10')][_0x31bb4e]){this[_0xb686('0x10')][_0x31bb4e][_0xb686('0x16')]['status']=_0xb686('0x25');this[_0xb686('0x10')][_0x31bb4e][_0xb686('0x16')][_0xb686('0x18')]=_0x1f1fb4;return this['emit'](_0x31bb4e);}};EmailChannel['prototype'][_0xb686('0x33')]=function(_0x43d0e1,_0x226f18){return this[_0xb686('0x12')][_0xb686('0x34')](_0x43d0e1,_0x226f18);};EmailChannel[_0xb686('0x13')]['verifySmtp']=function(_0x13a713){var _0x5b924d=this;if(this['mailAccounts'][_0x13a713['id']]){if(_[_0xb686('0x1a')](this[_0xb686('0x10')][_0x13a713['id']]['Smtp'])){this[_0xb686('0x10')][_0x13a713['id']]['Smtp']={};}this[_0xb686('0x10')][_0x13a713['id']]['Smtp'][_0xb686('0x32')]=moment();return new BPromise(function(_0x487926,_0x58528d){return _0x5b924d[_0xb686('0x12')][_0xb686('0x35')](_0x13a713)[_0xb686('0x2e')](function(_0x1169ce){_0x5b924d[_0xb686('0x10')][_0x13a713['id']][_0xb686('0x36')][_0xb686('0x17')]='verified';_0x5b924d['mailAccounts'][_0x13a713['id']]['Smtp'][_0xb686('0x18')]='';_0x5b924d[_0xb686('0x14')](_0x13a713['id']);_0x487926(_0x1169ce);})[_0xb686('0x30')](function(_0x18cceb){_0x5b924d[_0xb686('0x10')][_0x13a713['id']][_0xb686('0x36')]['status']=_0xb686('0x25');_0x5b924d[_0xb686('0x10')][_0x13a713['id']][_0xb686('0x36')][_0xb686('0x18')]=_0x18cceb;_0x5b924d[_0xb686('0x14')](_0x13a713['id']);_0x58528d(_0x18cceb);});});}return this['smtp'][_0xb686('0x35')](_0x13a713);};module['exports']=EmailChannel; \ No newline at end of file +var _0xa3b6=['active','Imap','status','messageStatus','total','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','handleImapBox','bind','end','handleImapEnd','error','handleImapError','isNil','emit','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','send','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','../../../config/environment','email','defaults','redis','localhost','socket.io-emitter','info','mailAccounts','imapAccounts','smtp','name','key'];(function(_0x3120a1,_0x1eeb17){var _0x32f8ac=function(_0x4ad0c0){while(--_0x4ad0c0){_0x3120a1['push'](_0x3120a1['shift']());}};_0x32f8ac(++_0x1eeb17);}(_0xa3b6,0x110));var _0x6a3b=function(_0x1faa21,_0x286b42){_0x1faa21=_0x1faa21-0x0;var _0x551876=_0xa3b6[_0x1faa21];return _0x551876;};'use strict';var _=require(_0x6a3b('0x0'));var moment=require(_0x6a3b('0x1'));var BPromise=require(_0x6a3b('0x2'));var md5=require(_0x6a3b('0x3'));var Redis=require('ioredis');var config=require(_0x6a3b('0x4'));var logger=require('../../../config/logger')(_0x6a3b('0x5'));config['redis']=_[_0x6a3b('0x6')](config[_0x6a3b('0x7')],{'host':_0x6a3b('0x8'),'port':0x18eb});var io=require(_0x6a3b('0x9'))(new Redis(config[_0x6a3b('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x5bc72b){logger[_0x6a3b('0xa')]('start\x20email\x20channel');this[_0x6a3b('0xb')]=_0x5bc72b[_0x6a3b('0xb')];this[_0x6a3b('0xc')]={};this[_0x6a3b('0xd')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x46e386){var _0x2f4e1b=this[_0x6a3b('0xb')][_0x46e386];var _0x241c9c={'id':_0x2f4e1b['id'],'name':_0x2f4e1b[_0x6a3b('0xe')],'key':_0x2f4e1b[_0x6a3b('0xf')],'active':_0x2f4e1b[_0x6a3b('0x10')],'Imap':{'status':_0x2f4e1b[_0x6a3b('0x11')][_0x6a3b('0x12')],'messageStatus':_0x2f4e1b[_0x6a3b('0x11')][_0x6a3b('0x13')],'total':_0x2f4e1b['Imap'][_0x6a3b('0x14')]}};if(_['isNil'](md5Accounts[_0x46e386])){md5Accounts[_0x46e386]={};}var _0x330367=md5(JSON[_0x6a3b('0x15')](_0x241c9c));if(md5Accounts[_0x46e386][_0x6a3b('0x3')]!==_0x330367){md5Accounts[_0x46e386][_0x6a3b('0x3')]=_0x330367;io['emit'](_0x6a3b('0x16'),_0x241c9c);}};EmailChannel[_0x6a3b('0x17')][_0x6a3b('0x18')]=function(_0x312cd7){for(var _0x96dd9f in _0x312cd7){if(_0x312cd7[_0x6a3b('0x19')](_0x96dd9f)){if(_0x312cd7[_0x96dd9f][_0x6a3b('0x11')]&&_0x312cd7[_0x96dd9f]['active']){var _0x4cfdad=_0x312cd7[_0x96dd9f]['Imap'];if(!this[_0x6a3b('0xc')][_0x6a3b('0x19')](_0x4cfdad['id'])){this[_0x6a3b('0xc')][_0x4cfdad['id']]=new EmailImap(_0x4cfdad,_0x312cd7[_0x96dd9f][_0x6a3b('0x5')]);this[_0x6a3b('0xc')][_0x4cfdad['id']]['on']('box',this[_0x6a3b('0x1a')][_0x6a3b('0x1b')](this,_0x96dd9f));this[_0x6a3b('0xc')][_0x4cfdad['id']]['on'](_0x6a3b('0x5'),this['handleImapEmail']['bind'](this,_0x96dd9f));this[_0x6a3b('0xc')][_0x4cfdad['id']]['on'](_0x6a3b('0x1c'),this[_0x6a3b('0x1d')][_0x6a3b('0x1b')](this,_0x96dd9f));this[_0x6a3b('0xc')][_0x4cfdad['id']]['on'](_0x6a3b('0x1e'),this[_0x6a3b('0x1f')]['bind'](this,_0x96dd9f));}}else{if(_[_0x6a3b('0x20')](this[_0x6a3b('0xb')][_0x96dd9f][_0x6a3b('0x11')])){this[_0x6a3b('0xb')][_0x96dd9f][_0x6a3b('0x11')]={};}this[_0x6a3b('0xb')][_0x96dd9f][_0x6a3b('0x11')][_0x6a3b('0x12')]='disabled';this['mailAccounts'][_0x96dd9f][_0x6a3b('0x11')]['messageStatus']='';this[_0x6a3b('0x21')](_0x96dd9f);}}}};EmailChannel[_0x6a3b('0x17')]['handleImapBox']=function(_0x1cf1e2,_0x3ffcbf){if(this[_0x6a3b('0xb')][_0x1cf1e2]){this['mailAccounts'][_0x1cf1e2][_0x6a3b('0x11')][_0x6a3b('0x12')]='connected';this[_0x6a3b('0xb')][_0x1cf1e2]['Imap'][_0x6a3b('0x13')]=_0x3ffcbf['name'];if(_0x3ffcbf[_0x6a3b('0x22')]){this[_0x6a3b('0xb')][_0x1cf1e2][_0x6a3b('0x11')]['total']=_0x3ffcbf['messages']['total'];}return this['emit'](_0x1cf1e2);}};EmailChannel[_0x6a3b('0x17')][_0x6a3b('0x23')]=function(_0x23bb17,_0xeffa6f){logger[_0x6a3b('0xa')](_0x6a3b('0x24'),_0xeffa6f['firstName'],_0xeffa6f[_0x6a3b('0x25')],_0xeffa6f['from'],_0x23bb17);if(this[_0x6a3b('0xb')][_0x23bb17]){return mailAccount['notify'](_0x23bb17,_0xeffa6f)[_0x6a3b('0x26')](function(_0x2bcdd5){if(_0x2bcdd5){logger[_0x6a3b('0xa')](_0x6a3b('0x27'));}})[_0x6a3b('0x28')](function(_0x10817c){logger[_0x6a3b('0x1e')](_0x6a3b('0x29'),JSON[_0x6a3b('0x15')](_0x10817c));});}};EmailChannel[_0x6a3b('0x17')][_0x6a3b('0x1d')]=function(_0x4e8837){if(this['mailAccounts'][_0x4e8837]&&this['mailAccounts'][_0x4e8837][_0x6a3b('0x11')]){if(this['imapAccounts'][this[_0x6a3b('0xb')][_0x4e8837][_0x6a3b('0x11')]['id']]){delete this[_0x6a3b('0xc')][this[_0x6a3b('0xb')][_0x4e8837][_0x6a3b('0x11')]['id']];}this[_0x6a3b('0xb')][_0x4e8837][_0x6a3b('0x11')][_0x6a3b('0x2a')]=moment();this['emit'](_0x4e8837);}};EmailChannel[_0x6a3b('0x17')][_0x6a3b('0x1f')]=function(_0x179b2c,_0x25bd2f){if(this[_0x6a3b('0xb')][_0x179b2c]){this[_0x6a3b('0xb')][_0x179b2c][_0x6a3b('0x11')][_0x6a3b('0x12')]=_0x6a3b('0x1e');this['mailAccounts'][_0x179b2c][_0x6a3b('0x11')][_0x6a3b('0x13')]=_0x25bd2f;return this[_0x6a3b('0x21')](_0x179b2c);}};EmailChannel[_0x6a3b('0x17')]['sendMail']=function(_0x5713cb,_0x198e45){return this[_0x6a3b('0xd')][_0x6a3b('0x2b')](_0x5713cb,_0x198e45);};EmailChannel['prototype']['verifySmtp']=function(_0x23b380){var _0x1ac393=this;if(this[_0x6a3b('0xb')][_0x23b380['id']]){if(_[_0x6a3b('0x20')](this[_0x6a3b('0xb')][_0x23b380['id']]['Smtp'])){this['mailAccounts'][_0x23b380['id']][_0x6a3b('0x2c')]={};}this[_0x6a3b('0xb')][_0x23b380['id']][_0x6a3b('0x2c')][_0x6a3b('0x2a')]=moment();return new BPromise(function(_0x3c1228,_0x3d590f){return _0x1ac393[_0x6a3b('0xd')][_0x6a3b('0x2d')](_0x23b380)['then'](function(_0x37c0b2){_0x1ac393[_0x6a3b('0xb')][_0x23b380['id']]['Smtp'][_0x6a3b('0x12')]=_0x6a3b('0x2e');_0x1ac393[_0x6a3b('0xb')][_0x23b380['id']][_0x6a3b('0x2c')][_0x6a3b('0x13')]='';_0x1ac393['emit'](_0x23b380['id']);_0x3c1228(_0x37c0b2);})[_0x6a3b('0x28')](function(_0x1c3c2a){_0x1ac393['mailAccounts'][_0x23b380['id']][_0x6a3b('0x2c')][_0x6a3b('0x12')]=_0x6a3b('0x1e');_0x1ac393['mailAccounts'][_0x23b380['id']][_0x6a3b('0x2c')][_0x6a3b('0x13')]=_0x1c3c2a;_0x1ac393[_0x6a3b('0x21')](_0x23b380['id']);_0x3d590f(_0x1c3c2a);});});}return this[_0x6a3b('0xd')][_0x6a3b('0x2d')](_0x23b380);};module[_0x6a3b('0x2f')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 0ff5dcf..5288136 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 _0xb59c=['Iconv','events','EventEmitter','../../../config/logger','email','mailbox','account','once','ready','handleReady','bind','handleEnd','handleError','inherits','getAccount','connTimeout','authTimeout','isNil','service','authentication','user','host','port','tls','autotls','required','password','anonymous@xcally.com','prototype','handleOpenBox','emit','box','handleCloseBox','readUnseen','handleReadUnseen','length','fetch','message','error','handleFetchError','end','handleFetchEnd','handleFetchMessage','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','closeBox','textCode','hasOwnProperty','upperFirst','exports','path','imap','lodash','mailparser','simpleParser','iconv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb59c,0x70));var _0xcb59=function(_0x35f15b,_0x387db3){_0x35f15b=_0x35f15b-0x0;var _0x262619=_0xb59c[_0x35f15b];return _0x262619;};'use strict';var fs=require('fs');var path=require(_0xcb59('0x0'));var util=require('util');var Imap=require(_0xcb59('0x1'));var _=require(_0xcb59('0x2'));var rs=require('randomstring');var simpleParser=require(_0xcb59('0x3'))[_0xcb59('0x4')];var Iconv=require(_0xcb59('0x5'))[_0xcb59('0x6')];var EventEmitter=require(_0xcb59('0x7'))[_0xcb59('0x8')];var utils=require('./utils');var logger=require(_0xcb59('0x9'))(_0xcb59('0xa'));function EmailImap(_0x1224af,_0x5c52fd){this[_0xcb59('0xb')]='INBOX';this[_0xcb59('0xc')]=this['getAccount'](_0x1224af,_0x5c52fd);this[_0xcb59('0x1')]=new Imap(this[_0xcb59('0xc')]);this[_0xcb59('0x1')][_0xcb59('0xd')](_0xcb59('0xe'),this[_0xcb59('0xf')][_0xcb59('0x10')](this));this[_0xcb59('0x1')][_0xcb59('0xd')]('end',this[_0xcb59('0x11')][_0xcb59('0x10')](this));this[_0xcb59('0x1')]['on']('error',this[_0xcb59('0x12')][_0xcb59('0x10')](this));this[_0xcb59('0x1')]['connect']();}util[_0xcb59('0x13')](EmailImap,EventEmitter);EmailImap['prototype'][_0xcb59('0x14')]=function(_0x312186,_0x200c01){var _0x420e5a={'connTimeout':_0x312186[_0xcb59('0x15')]?_0x312186[_0xcb59('0x15')]*0x3e8:0x2710,'authTimeout':_0x312186['authTimeout']?_0x312186[_0xcb59('0x16')]*0x3e8:0x1388};if(_[_0xcb59('0x17')](_0x312186[_0xcb59('0x18')])){if(_0x312186[_0xcb59('0x19')]){_0x420e5a[_0xcb59('0x1a')]=_0x312186[_0xcb59('0x1a')];_0x420e5a['password']=_0x312186['password'];}_0x420e5a[_0xcb59('0x1b')]=_0x312186[_0xcb59('0x1b')];_0x420e5a[_0xcb59('0x1c')]=_0x312186[_0xcb59('0x1c')]||0x3e1;if(_0x312186[_0xcb59('0x1d')]){_0x420e5a[_0xcb59('0x1d')]=!![];}else{_0x420e5a['tls']=![];_0x420e5a[_0xcb59('0x1e')]=_0xcb59('0x1f');}}else{_0x420e5a[_0xcb59('0x1a')]=_0x312186[_0xcb59('0x1a')];_0x420e5a[_0xcb59('0x20')]=_0x312186[_0xcb59('0x20')];_0x420e5a[_0xcb59('0x1b')]=utils['getHost'](_0x312186['service']);_0x420e5a[_0xcb59('0x1c')]=0x3e1;_0x420e5a[_0xcb59('0x1d')]=!![];}_0x420e5a[_0xcb59('0xa')]=_0x200c01||_0x312186[_0xcb59('0x1a')]||_0xcb59('0x21');return _0x420e5a;};EmailImap[_0xcb59('0x22')]['handleReady']=function(){this['imap']['openBox'](this[_0xcb59('0xb')],![],this[_0xcb59('0x23')][_0xcb59('0x10')](this));};EmailImap[_0xcb59('0x22')][_0xcb59('0x23')]=function(_0x301a20,_0x3b7635){if(_0x301a20){this['handleError'](_0x301a20,!![]);}else{this[_0xcb59('0x24')](_0xcb59('0x25'),_0x3b7635);this['readUnseen']();}};EmailImap[_0xcb59('0x22')][_0xcb59('0x26')]=function(_0x3bdad9){if(_0x3bdad9){this[_0xcb59('0x12')](_0x3bdad9,!![]);}else{this['imap']['end']();}};EmailImap['prototype'][_0xcb59('0x27')]=function(){this[_0xcb59('0x1')]['search'](['UNSEEN'],this[_0xcb59('0x28')]['bind'](this));};EmailImap[_0xcb59('0x22')][_0xcb59('0x28')]=function(_0x3d47d5,_0x583172){if(_0x3d47d5){this['handleError'](_0x3d47d5,!![]);}else{if(_0x583172[_0xcb59('0x29')]){try{var _0x624527=this[_0xcb59('0x1')][_0xcb59('0x2a')](_0x583172,{'bodies':'','markSeen':!![]});_0x624527['on'](_0xcb59('0x2b'),this['handleFetchMessage'][_0xcb59('0x10')](this));_0x624527[_0xcb59('0xd')](_0xcb59('0x2c'),this[_0xcb59('0x2d')]['bind'](this));_0x624527[_0xcb59('0xd')](_0xcb59('0x2e'),this[_0xcb59('0x2f')][_0xcb59('0x10')](this));}catch(_0x40bf25){logger[_0xcb59('0x2c')](_0x40bf25);}}else{this[_0xcb59('0x1')]['closeBox'](!![],this['handleCloseBox'][_0xcb59('0x10')](this));}}};EmailImap[_0xcb59('0x22')][_0xcb59('0x30')]=function(_0x11fe11,_0x3092f6){_0x11fe11['on']('body',this['handleMessageBody'][_0xcb59('0x10')](this));_0x11fe11[_0xcb59('0xd')](_0xcb59('0x31'),this[_0xcb59('0x32')][_0xcb59('0x10')](this));_0x11fe11['once'](_0xcb59('0x2e'),this[_0xcb59('0x33')]['bind'](this));};EmailImap[_0xcb59('0x22')]['handleMessageBody']=function(_0x241118,_0xc2c2e8){simpleParser(_0x241118,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap[_0xcb59('0x22')][_0xcb59('0x32')]=function(_0x3b4e5b){};EmailImap[_0xcb59('0x22')][_0xcb59('0x33')]=function(){};EmailImap[_0xcb59('0x22')][_0xcb59('0x34')]=function(_0x2ba2b4,_0x467fd0){if(_0x2ba2b4){logger[_0xcb59('0x2c')](_0x2ba2b4);}else{var _0x17658b=this;utils[_0xcb59('0x35')](this[_0xcb59('0xc')],_0x467fd0,function(_0x3fe533){_0x17658b[_0xcb59('0x24')](_0xcb59('0xa'),_0x3fe533);});}};EmailImap[_0xcb59('0x22')][_0xcb59('0x2f')]=function(){this[_0xcb59('0x1')][_0xcb59('0x36')](!![],this[_0xcb59('0x26')][_0xcb59('0x10')](this));};EmailImap[_0xcb59('0x22')][_0xcb59('0x2d')]=function(_0x537050){this[_0xcb59('0x12')](_0x537050);this['imap']['closeBox'](!![],this['handleCloseBox'][_0xcb59('0x10')](this));};EmailImap['prototype'][_0xcb59('0x11')]=function(){this['emit'](_0xcb59('0x2e'));};EmailImap[_0xcb59('0x22')][_0xcb59('0x12')]=function(_0x4c709a,_0x80803f){logger[_0xcb59('0x2c')](_0xcb59('0x12'),this[_0xcb59('0xc')][_0xcb59('0xa')],JSON['stringify'](_0x4c709a));var _0x152d35='';if(_0x4c709a){if(_0x4c709a['textCode']){_0x152d35=_0x4c709a[_0xcb59('0x37')];}else{for(var _0x2f2e28 in _0x4c709a){if(_0x4c709a[_0xcb59('0x38')](_0x2f2e28)){_0x152d35+=_[_0xcb59('0x39')](_0x2f2e28)+':\x20'+_0x4c709a[_0x2f2e28]+'\x0a';}}}}if(_0x80803f){this[_0xcb59('0x1')]['end']();}else{this[_0xcb59('0x24')](_0xcb59('0x2c'),_0x152d35);this['emit'](_0xcb59('0x2e'));}};module[_0xcb59('0x3a')]=EmailImap; \ No newline at end of file +var _0x560d=['search','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','emit','email','closeBox','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','imap','lodash','randomstring','mailparser','EventEmitter','./utils','../../../config/logger','mailbox','INBOX','account','once','ready','handleReady','bind','end','handleEnd','error','handleError','prototype','getAccount','connTimeout','authTimeout','isNil','service','authentication','user','host','port','tls','autotls','required','password','getHost','openBox','handleOpenBox','box','readUnseen','handleCloseBox'];(function(_0x241d88,_0x5f2c46){var _0x58215e=function(_0x645177){while(--_0x645177){_0x241d88['push'](_0x241d88['shift']());}};_0x58215e(++_0x5f2c46);}(_0x560d,0x8c));var _0xd560=function(_0x23a589,_0x1e6f1e){_0x23a589=_0x23a589-0x0;var _0x2d2325=_0x560d[_0x23a589];return _0x2d2325;};'use strict';var fs=require('fs');var path=require(_0xd560('0x0'));var util=require(_0xd560('0x1'));var Imap=require(_0xd560('0x2'));var _=require(_0xd560('0x3'));var rs=require(_0xd560('0x4'));var simpleParser=require(_0xd560('0x5'))['simpleParser'];var Iconv=require('iconv')['Iconv'];var EventEmitter=require('events')[_0xd560('0x6')];var utils=require(_0xd560('0x7'));var logger=require(_0xd560('0x8'))('email');function EmailImap(_0x18b79a,_0x151d38){this[_0xd560('0x9')]=_0xd560('0xa');this[_0xd560('0xb')]=this['getAccount'](_0x18b79a,_0x151d38);this[_0xd560('0x2')]=new Imap(this[_0xd560('0xb')]);this[_0xd560('0x2')][_0xd560('0xc')](_0xd560('0xd'),this[_0xd560('0xe')][_0xd560('0xf')](this));this[_0xd560('0x2')][_0xd560('0xc')](_0xd560('0x10'),this[_0xd560('0x11')]['bind'](this));this[_0xd560('0x2')]['on'](_0xd560('0x12'),this[_0xd560('0x13')]['bind'](this));this['imap']['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xd560('0x14')][_0xd560('0x15')]=function(_0x20684f,_0x2f9e47){var _0x43b936={'connTimeout':_0x20684f[_0xd560('0x16')]?_0x20684f[_0xd560('0x16')]*0x3e8:0x2710,'authTimeout':_0x20684f[_0xd560('0x17')]?_0x20684f['authTimeout']*0x3e8:0x1388};if(_[_0xd560('0x18')](_0x20684f[_0xd560('0x19')])){if(_0x20684f[_0xd560('0x1a')]){_0x43b936[_0xd560('0x1b')]=_0x20684f[_0xd560('0x1b')];_0x43b936['password']=_0x20684f['password'];}_0x43b936[_0xd560('0x1c')]=_0x20684f[_0xd560('0x1c')];_0x43b936[_0xd560('0x1d')]=_0x20684f[_0xd560('0x1d')]||0x3e1;if(_0x20684f[_0xd560('0x1e')]){_0x43b936['tls']=!![];}else{_0x43b936['tls']=![];_0x43b936[_0xd560('0x1f')]=_0xd560('0x20');}}else{_0x43b936['user']=_0x20684f[_0xd560('0x1b')];_0x43b936[_0xd560('0x21')]=_0x20684f[_0xd560('0x21')];_0x43b936[_0xd560('0x1c')]=utils[_0xd560('0x22')](_0x20684f['service']);_0x43b936['port']=0x3e1;_0x43b936[_0xd560('0x1e')]=!![];}_0x43b936['email']=_0x2f9e47||_0x20684f[_0xd560('0x1b')]||'anonymous@xcally.com';return _0x43b936;};EmailImap[_0xd560('0x14')][_0xd560('0xe')]=function(){this['imap'][_0xd560('0x23')](this[_0xd560('0x9')],![],this['handleOpenBox']['bind'](this));};EmailImap[_0xd560('0x14')][_0xd560('0x24')]=function(_0x365333,_0x30de02){if(_0x365333){this[_0xd560('0x13')](_0x365333,!![]);}else{this['emit'](_0xd560('0x25'),_0x30de02);this[_0xd560('0x26')]();}};EmailImap['prototype'][_0xd560('0x27')]=function(_0x100d79){if(_0x100d79){this['handleError'](_0x100d79,!![]);}else{this[_0xd560('0x2')]['end']();}};EmailImap[_0xd560('0x14')][_0xd560('0x26')]=function(){this['imap'][_0xd560('0x28')](['UNSEEN'],this[_0xd560('0x29')][_0xd560('0xf')](this));};EmailImap[_0xd560('0x14')][_0xd560('0x29')]=function(_0x315e89,_0x246f4c){if(_0x315e89){this[_0xd560('0x13')](_0x315e89,!![]);}else{if(_0x246f4c[_0xd560('0x2a')]){try{var _0x21eef6=this[_0xd560('0x2')][_0xd560('0x2b')](_0x246f4c,{'bodies':'','markSeen':!![]});_0x21eef6['on']('message',this[_0xd560('0x2c')][_0xd560('0xf')](this));_0x21eef6[_0xd560('0xc')](_0xd560('0x12'),this[_0xd560('0x2d')][_0xd560('0xf')](this));_0x21eef6[_0xd560('0xc')](_0xd560('0x10'),this[_0xd560('0x2e')][_0xd560('0xf')](this));}catch(_0x28924c){logger['error'](_0x28924c);}}else{this[_0xd560('0x2')]['closeBox'](!![],this['handleCloseBox']['bind'](this));}}};EmailImap[_0xd560('0x14')][_0xd560('0x2c')]=function(_0x380bb7,_0x85f620){_0x380bb7['on'](_0xd560('0x2f'),this[_0xd560('0x30')][_0xd560('0xf')](this));_0x380bb7[_0xd560('0xc')](_0xd560('0x31'),this[_0xd560('0x32')][_0xd560('0xf')](this));_0x380bb7[_0xd560('0xc')](_0xd560('0x10'),this['handleMessageEnd']['bind'](this));};EmailImap[_0xd560('0x14')][_0xd560('0x30')]=function(_0x4d4fdd,_0x17f907){simpleParser(_0x4d4fdd,{'Iconv':Iconv},this[_0xd560('0x33')][_0xd560('0xf')](this));};EmailImap[_0xd560('0x14')][_0xd560('0x32')]=function(_0x2563d2){};EmailImap[_0xd560('0x14')]['handleMessageEnd']=function(){};EmailImap['prototype'][_0xd560('0x33')]=function(_0x1cc9d6,_0xe86f21){if(_0x1cc9d6){logger[_0xd560('0x12')](_0x1cc9d6);}else{var _0x23eb4b=this;utils['parser'](this['account'],_0xe86f21,function(_0x7dabdc){_0x23eb4b[_0xd560('0x34')](_0xd560('0x35'),_0x7dabdc);});}};EmailImap['prototype'][_0xd560('0x2e')]=function(){this[_0xd560('0x2')][_0xd560('0x36')](!![],this[_0xd560('0x27')]['bind'](this));};EmailImap['prototype'][_0xd560('0x2d')]=function(_0x417852){this[_0xd560('0x13')](_0x417852);this[_0xd560('0x2')][_0xd560('0x36')](!![],this[_0xd560('0x27')][_0xd560('0xf')](this));};EmailImap[_0xd560('0x14')][_0xd560('0x11')]=function(){this['emit'](_0xd560('0x10'));};EmailImap[_0xd560('0x14')][_0xd560('0x13')]=function(_0x3760a4,_0x13e64d){logger[_0xd560('0x12')](_0xd560('0x13'),this[_0xd560('0xb')][_0xd560('0x35')],JSON[_0xd560('0x37')](_0x3760a4));var _0xf57071='';if(_0x3760a4){if(_0x3760a4[_0xd560('0x38')]){_0xf57071=_0x3760a4[_0xd560('0x38')];}else{for(var _0x46bad1 in _0x3760a4){if(_0x3760a4[_0xd560('0x39')](_0x46bad1)){_0xf57071+=_[_0xd560('0x3a')](_0x46bad1)+':\x20'+_0x3760a4[_0x46bad1]+'\x0a';}}}}if(_0x13e64d){this[_0xd560('0x2')][_0xd560('0x10')]();}else{this['emit']('error',_0xf57071);this[_0xd560('0x34')](_0xd560('0x10'));}};module[_0xd560('0x3b')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 4f5ef1f..cde2eb9 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 _0xe32c=['verify','toString','Not\x20verifired','nodemailer-plugin-inline-base64','send','createTransport','use','compile','sendMail','prototype'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe32c,0x14d));var _0xce32=function(_0x86c6cb,_0x30bb53){_0x86c6cb=_0x86c6cb-0x0;var _0x1b1592=_0xe32c[_0x86c6cb];return _0x1b1592;};'use strict';var nodemailer=require('nodemailer');var BPromise=require('bluebird');var inlineBase64=require(_0xce32('0x0'));function EmailSmtp(){}EmailSmtp['prototype'][_0xce32('0x1')]=function(_0x36bd84,_0x476b32){return new BPromise(function(_0x41c444,_0x3800f1){var _0x4fa4e3=nodemailer[_0xce32('0x2')](_0x36bd84);_0x4fa4e3[_0xce32('0x3')](_0xce32('0x4'),inlineBase64());_0x4fa4e3[_0xce32('0x5')](_0x476b32,function(_0x3c10be,_0x1751e8){if(_0x3c10be){_0x3800f1(_0x3c10be['toString']());}else{_0x41c444(_0x1751e8);}});});};EmailSmtp[_0xce32('0x6')][_0xce32('0x7')]=function(_0x167363){return new BPromise(function(_0xeb481c,_0x5ed9da){var _0x4e9f7c=nodemailer[_0xce32('0x2')](_0x167363);_0x4e9f7c[_0xce32('0x7')](function(_0x42f31a,_0x5e5828){if(_0x42f31a){_0x5ed9da(_0x42f31a[_0xce32('0x8')]());}else{if(_0x5e5828){_0xeb481c(_0x5e5828);}else{_0x5ed9da(_0xce32('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x1d9d=['Not\x20verifired','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','use','toString','prototype','createTransport','verify'];(function(_0xc78172,_0x151a58){var _0x1c2154=function(_0x817362){while(--_0x817362){_0xc78172['push'](_0xc78172['shift']());}};_0x1c2154(++_0x151a58);}(_0x1d9d,0x70));var _0xd1d9=function(_0x3a5c39,_0x37a813){_0x3a5c39=_0x3a5c39-0x0;var _0x4f0d59=_0x1d9d[_0x3a5c39];return _0x4f0d59;};'use strict';var nodemailer=require(_0xd1d9('0x0'));var BPromise=require(_0xd1d9('0x1'));var inlineBase64=require(_0xd1d9('0x2'));function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x4b3627,_0x12d2b7){return new BPromise(function(_0xa49249,_0x1b4c24){var _0x5a40de=nodemailer['createTransport'](_0x4b3627);_0x5a40de[_0xd1d9('0x3')]('compile',inlineBase64());_0x5a40de['sendMail'](_0x12d2b7,function(_0x1216c0,_0x43c00f){if(_0x1216c0){_0x1b4c24(_0x1216c0[_0xd1d9('0x4')]());}else{_0xa49249(_0x43c00f);}});});};EmailSmtp[_0xd1d9('0x5')]['verify']=function(_0x4d1a65){return new BPromise(function(_0x53e3a2,_0x38db6a){var _0x1bfd30=nodemailer[_0xd1d9('0x6')](_0x4d1a65);_0x1bfd30[_0xd1d9('0x7')](function(_0x3184aa,_0x15f20f){if(_0x3184aa){_0x38db6a(_0x3184aa['toString']());}else{if(_0x15f20f){_0x53e3a2(_0x15f20f);}else{_0x38db6a(_0xd1d9('0x8'));}}});});};module[_0xd1d9('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 5f09a15..765bd91 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 _0xe480=['inReplyTo','date','filter','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','yahoo','imap.mail.yahoo.com','hotmail','outlook365','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','address','anonymous','generate','@xcally.com','head','name','split','length','slice','join','Anonymous','pop','value','html','test','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x589ec4[_0x0e48('0x13')]():'';}return'';}function getMails(_0x32ddd5,_0x406aca){var _0x303675='';for(var _0x293e72=0x0;_0x293e72<_0x406aca['value'][_0x0e48('0xf')];_0x293e72+=0x1){if(_0x406aca[_0x0e48('0x14')][_0x293e72][_0x0e48('0x8')]!==_0x32ddd5){if(!_['isEmpty'](_0x303675)){_0x303675+=',';}_0x303675+=_0x406aca['value'][_0x293e72][_0x0e48('0xd')]||_0x406aca[_0x0e48('0x14')][_0x293e72][_0x0e48('0x8')]||'';_0x303675+='\x20<';_0x303675+=_0x406aca[_0x0e48('0x14')][_0x293e72][_0x0e48('0x8')]?_0x406aca[_0x0e48('0x14')][_0x293e72][_0x0e48('0x8')]:_0x0e48('0x9')+random[_0x0e48('0xa')](0x6)+_0x0e48('0xb');_0x303675+='>';}}return _0x303675;}function parseEmail(_0x959276,_0x393af0,_0x4c3b4e){if(_0x393af0[_0x0e48('0x15')]){var _0x356cb7=/)<[^<]*)*<\/script>/gi;while(_0x356cb7[_0x0e48('0x16')](_0x393af0[_0x0e48('0x15')])){_0x393af0[_0x0e48('0x15')]=_0x393af0[_0x0e48('0x15')]['replace'](_0x356cb7,'');}if(_0x393af0['html']['includes'](_0x0e48('0x17'))){var _0x489757=[];_0x393af0[_0x0e48('0x18')][_0x0e48('0x19')](_0x4dd75e=>{_0x489757[_0x0e48('0x1a')](_0x4dd75e[_0x0e48('0x1b')]);});var _0x3598a5=/]+>/g;var _0x899b79=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x2c5193=_0x393af0[_0x0e48('0x15')][_0x0e48('0x1c')](_0x899b79,_0x0e48('0x1d'));var _0x539c72=_0x2c5193[_0x0e48('0x1c')](_0x3598a5,_0x0e48('0x1e'));for(let _0x5a6786=0x0;_0x5a6786<_0x489757['length'];_0x5a6786++){var _0x242ed1=_0x539c72['replace'](_0x0e48('0x1e'),_0x0e48('0x1f')+_0x489757[_0x5a6786]+_0x0e48('0x20'));_0x539c72=_0x242ed1;}_0x393af0[_0x0e48('0x15')]=_0x539c72;}_0x4c3b4e[_0x0e48('0x21')]=_0x393af0['html'];}else{_0x4c3b4e['body']=_0x393af0[_0x0e48('0x22')];}if(_0x4c3b4e[_0x0e48('0x21')]){_0x4c3b4e[_0x0e48('0x21')]=_0x4c3b4e[_0x0e48('0x21')][_0x0e48('0x1c')](/\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Data','imap.gmail.com','yahoo','imap.mail.yahoo.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','path'];(function(_0x540da8,_0x35e3f3){var _0x1cacce=function(_0x5a81f3){while(--_0x5a81f3){_0x540da8['push'](_0x540da8['shift']());}};_0x1cacce(++_0x35e3f3);}(_0xb99d,0x87));var _0xdb99=function(_0x57e009,_0x4c5e53){_0x57e009=_0x57e009-0x0;var _0x26ab88=_0xb99d[_0x57e009];return _0x26ab88;};'use strict';var _=require(_0xdb99('0x0'));var moment=require(_0xdb99('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0xdb99('0x2'));var util=require(_0xdb99('0x3'));var tnef=require(_0xdb99('0x4'));var logger=require(_0xdb99('0x5'))(_0xdb99('0x6'));var config=require(_0xdb99('0x7'));function getAddress(_0x11fef1){var _0x2f8eea=_[_0xdb99('0x8')](_0x11fef1['value']);return _0x2f8eea&&_0x2f8eea[_0xdb99('0x9')]?_0x2f8eea['address']:'anonymous'+random[_0xdb99('0xa')](0x6)+_0xdb99('0xb');}function getFirstName(_0x49695b){var _0x1b03ed=_[_0xdb99('0x8')](_0x49695b[_0xdb99('0xc')]);if(_0x1b03ed&&_0x1b03ed[_0xdb99('0xd')]){var _0x9292dd=_0x1b03ed[_0xdb99('0xd')][_0xdb99('0xe')](/\s+/);return _0x9292dd[_0xdb99('0xf')]?_0x9292dd[_0xdb99('0x10')](0x0,-0x1)[_0xdb99('0x11')]('\x20'):_0x1b03ed[_0xdb99('0xd')];}return'Anonymous';}function getLastName(_0x705308){var _0x2f71a7=_[_0xdb99('0x8')](_0x705308['value']);if(_0x2f71a7&&_0x2f71a7[_0xdb99('0xd')]){var _0x36bb09=_0x2f71a7[_0xdb99('0xd')][_0xdb99('0xe')](/\s+/);return _0x36bb09[_0xdb99('0xf')]>0x1?_0x36bb09[_0xdb99('0x12')]():'';}return'';}function getMails(_0x4ae8d4,_0x52a632){var _0xf26c89='';for(var _0x2cdb06=0x0;_0x2cdb06<_0x52a632[_0xdb99('0xc')]['length'];_0x2cdb06+=0x1){if(_0x52a632[_0xdb99('0xc')][_0x2cdb06][_0xdb99('0x9')]!==_0x4ae8d4){if(!_[_0xdb99('0x13')](_0xf26c89)){_0xf26c89+=',';}_0xf26c89+=_0x52a632[_0xdb99('0xc')][_0x2cdb06][_0xdb99('0xd')]||_0x52a632[_0xdb99('0xc')][_0x2cdb06][_0xdb99('0x9')]||'';_0xf26c89+='\x20<';_0xf26c89+=_0x52a632[_0xdb99('0xc')][_0x2cdb06][_0xdb99('0x9')]?_0x52a632[_0xdb99('0xc')][_0x2cdb06][_0xdb99('0x9')]:_0xdb99('0x14')+random[_0xdb99('0xa')](0x6)+_0xdb99('0xb');_0xf26c89+='>';}}return _0xf26c89;}function parseEmail(_0x8c63bd,_0xe33395,_0x4acab0){if(_0xe33395['html']){var _0x4383ac=/)<[^<]*)*<\/script>/gi;while(_0x4383ac['test'](_0xe33395[_0xdb99('0x15')])){_0xe33395['html']=_0xe33395[_0xdb99('0x15')][_0xdb99('0x16')](_0x4383ac,'');}if(_0xe33395['html']['includes'](_0xdb99('0x17'))){var _0x54d782=[];_0xe33395[_0xdb99('0x18')][_0xdb99('0x19')](_0x5e86f0=>{_0x54d782['push'](_0x5e86f0[_0xdb99('0x1a')]);});var _0x4c46a4=/]+>/g;var _0x1ecf3a=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x38230f=_0xe33395[_0xdb99('0x15')]['replace'](_0x1ecf3a,_0xdb99('0x1b'));var _0x2bfa74=_0x38230f[_0xdb99('0x16')](_0x4c46a4,_0xdb99('0x1c'));for(let _0x287b95=0x0;_0x287b95<_0x54d782[_0xdb99('0xf')];_0x287b95++){var _0x1fce6d=_0x2bfa74['replace'](_0xdb99('0x1c'),_0xdb99('0x1d')+_0x54d782[_0x287b95]+_0xdb99('0x1e'));_0x2bfa74=_0x1fce6d;}_0xe33395['html']=_0x2bfa74;}_0x4acab0[_0xdb99('0x1f')]=_0xe33395['html'];}else{_0x4acab0[_0xdb99('0x1f')]=_0xe33395[_0xdb99('0x20')];}if(_0x4acab0[_0xdb99('0x1f')]){_0x4acab0['body']=_0x4acab0[_0xdb99('0x1f')][_0xdb99('0x16')](/0x0){if(this[_0x4df8c6+_0x7269('0x25')]>0x0&&this[_0x4df8c6+'CurrentCapacity']>=this[_0x4df8c6+_0x7269('0x25')]){return _0x7269('0x26');}else{return'working';}}else{return _0x7269('0x27');}};Agent[_0x7269('0x28')][_0x7269('0x22')]=function(){var _0x383fde=['mail',_0x7269('0x29'),_0x7269('0x2a'),_0x7269('0x2b'),_0x7269('0x2c'),_0x7269('0x2d')];for(var _0x3d72c9=0x0;_0x3d72c9<_0x383fde['length'];_0x3d72c9+=0x1){var _0x198b59=this[_0x7269('0x23')](_0x383fde[_0x3d72c9]);if(this[_0x383fde[_0x3d72c9]+_0x7269('0x2e')]!==_0x198b59){this[_0x383fde[_0x3d72c9]+_0x7269('0x2f')]=_[_0x7269('0x30')](moment()['format']('x'));}this[_0x383fde[_0x3d72c9]+_0x7269('0x2e')]=_0x198b59;}var _0x470e5c={'id':this['id'],'name':this['name'],'online':this[_0x7269('0x7')],'voicePause':this['voicePause'],'chatPause':this[_0x7269('0x9')],'mailPause':this[_0x7269('0xa')],'smsPause':this[_0x7269('0xc')],'faxPause':this[_0x7269('0xb')],'openchannelPause':this[_0x7269('0xd')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x7269('0xf')],'chatCapacity':this[_0x7269('0x10')],'chatCurrentCapacity':this[_0x7269('0x31')],'mailStatus':this[_0x7269('0x11')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x7269('0x13')],'mailCurrentCapacity':this[_0x7269('0x14')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x7269('0x16')],'faxCurrentCapacity':this[_0x7269('0x17')],'smsStatus':this[_0x7269('0x18')],'smsStatusTime':this[_0x7269('0x19')],'smsCapacity':this[_0x7269('0x1a')],'smsCurrentCapacity':this[_0x7269('0x1b')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x7269('0x32')],'whatsappCurrentCapacity':this[_0x7269('0x1d')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x7269('0x1f')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x7269('0x21')],'busy':this[_0x7269('0x33')],'busyQueue':this[_0x7269('0x34')]};var _0x2daaaf=md5(JSON[_0x7269('0x35')](_0x470e5c));if(this[_0x7269('0x1')]!==_0x2daaaf){this[_0x7269('0x1')]=_0x2daaaf;io['emit'](_0x7269('0x36'),_0x470e5c);}};module[_0x7269('0x37')]=Agent; \ No newline at end of file +var _0xd7a0=['chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','md5','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','chat','openchannel','fax','sms','length','Status','StatusTime','toNumber','format','mailCurrentCapacity','faxStatus','faxStatusTime','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','busyQueue','stringify','emit','user:save','exports','lodash','moment','ioredis','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown'];(function(_0x436eee,_0x363a28){var _0x4996fc=function(_0x2098ab){while(--_0x2098ab){_0x436eee['push'](_0x436eee['shift']());}};_0x4996fc(++_0x363a28);}(_0xd7a0,0x163));var _0x0d7a=function(_0x6eeee,_0x17fbc7){_0x6eeee=_0x6eeee-0x0;var _0x6ea63b=_0xd7a0[_0x6eeee];return _0x6ea63b;};'use strict';var _=require(_0x0d7a('0x0'));var moment=require(_0x0d7a('0x1'));var md5=require('md5');var Redis=require(_0x0d7a('0x2'));var config=require('../../../config/environment');config[_0x0d7a('0x3')]=_[_0x0d7a('0x4')](config[_0x0d7a('0x3')],{'host':_0x0d7a('0x5'),'port':0x18eb});var io=require(_0x0d7a('0x6'))(new Redis(config['redis']));function Agent(_0x34f0f8){this['id']=_0x34f0f8['id']||0x0;this[_0x0d7a('0x7')]=_0x34f0f8[_0x0d7a('0x7')]||'';this[_0x0d7a('0x8')]=_0x34f0f8[_0x0d7a('0x8')]||!![];this[_0x0d7a('0x9')]=_0x34f0f8[_0x0d7a('0x9')]||![];this['chatPause']=_0x34f0f8[_0x0d7a('0xa')]||![];this[_0x0d7a('0xb')]=_0x34f0f8[_0x0d7a('0xb')]||![];this[_0x0d7a('0xc')]=_0x34f0f8['faxPause']||![];this[_0x0d7a('0xd')]=_0x34f0f8[_0x0d7a('0xd')]||![];this['openchannelPause']=_0x34f0f8[_0x0d7a('0xe')]||![];this[_0x0d7a('0xf')]=_0x0d7a('0x10');this[_0x0d7a('0x11')]=0x0;this[_0x0d7a('0x12')]=_0x34f0f8['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0x0d7a('0x13')]=_0x0d7a('0x10');this[_0x0d7a('0x14')]=0x0;this['mailCapacity']=_0x34f0f8[_0x0d7a('0x15')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0x0d7a('0x10');this['faxStatusTime']=0x0;this[_0x0d7a('0x16')]=_0x34f0f8[_0x0d7a('0x16')]||0x0;this[_0x0d7a('0x17')]=0x0;this[_0x0d7a('0x18')]='unknown';this[_0x0d7a('0x19')]=0x0;this[_0x0d7a('0x1a')]=_0x34f0f8['smsCapacity']||0x0;this[_0x0d7a('0x1b')]=0x0;this[_0x0d7a('0x1c')]=_0x0d7a('0x10');this[_0x0d7a('0x1d')]=0x0;this['whatsappCapacity']=_0x34f0f8[_0x0d7a('0x1e')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']='unknown';this['openchannelStatusTime']=0x0;this[_0x0d7a('0x1f')]=_0x34f0f8['openchannelCapacity']||0x0;this[_0x0d7a('0x20')]=0x0;this[_0x0d7a('0x21')]=![];this['busyQueue']=undefined;this[_0x0d7a('0x22')]='';this[_0x0d7a('0x23')]();}Agent[_0x0d7a('0x24')][_0x0d7a('0x25')]=function(_0x542a24){if(this[_0x542a24+_0x0d7a('0x26')]>0x0){if(this[_0x542a24+_0x0d7a('0x27')]>0x0&&this[_0x542a24+_0x0d7a('0x26')]>=this[_0x542a24+'Capacity']){return'maxcapacity';}else{return _0x0d7a('0x28');}}else{return _0x0d7a('0x29');}};Agent[_0x0d7a('0x24')][_0x0d7a('0x23')]=function(){var _0x9c73d4=['mail',_0x0d7a('0x2a'),_0x0d7a('0x2b'),_0x0d7a('0x2c'),_0x0d7a('0x2d'),'whatsapp'];for(var _0x59dc3a=0x0;_0x59dc3a<_0x9c73d4[_0x0d7a('0x2e')];_0x59dc3a+=0x1){var _0x2d34fe=this[_0x0d7a('0x25')](_0x9c73d4[_0x59dc3a]);if(this[_0x9c73d4[_0x59dc3a]+_0x0d7a('0x2f')]!==_0x2d34fe){this[_0x9c73d4[_0x59dc3a]+_0x0d7a('0x30')]=_[_0x0d7a('0x31')](moment()[_0x0d7a('0x32')]('x'));}this[_0x9c73d4[_0x59dc3a]+_0x0d7a('0x2f')]=_0x2d34fe;}var _0x4c8e8b={'id':this['id'],'name':this[_0x0d7a('0x7')],'online':this['online'],'voicePause':this[_0x0d7a('0x9')],'chatPause':this[_0x0d7a('0xa')],'mailPause':this[_0x0d7a('0xb')],'smsPause':this[_0x0d7a('0xd')],'faxPause':this[_0x0d7a('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x0d7a('0xf')],'chatStatusTime':this[_0x0d7a('0x11')],'chatCapacity':this[_0x0d7a('0x12')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x0d7a('0x13')],'mailStatusTime':this[_0x0d7a('0x14')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x0d7a('0x33')],'faxStatus':this[_0x0d7a('0x34')],'faxStatusTime':this[_0x0d7a('0x35')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x0d7a('0x17')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x0d7a('0x19')],'smsCapacity':this[_0x0d7a('0x1a')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x0d7a('0x1c')],'whatsappStatusTime':this[_0x0d7a('0x1d')],'whatsappCapacity':this[_0x0d7a('0x1e')],'whatsappCurrentCapacity':this[_0x0d7a('0x36')],'openchannelStatus':this[_0x0d7a('0x37')],'openchannelStatusTime':this[_0x0d7a('0x38')],'openchannelCapacity':this[_0x0d7a('0x1f')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x0d7a('0x21')],'busyQueue':this[_0x0d7a('0x39')]};var _0x5af272=md5(JSON[_0x0d7a('0x3a')](_0x4c8e8b));if(this['md5']!==_0x5af272){this['md5']=_0x5af272;io[_0x0d7a('0x3b')](_0x0d7a('0x3c'),_0x4c8e8b);}};module[_0x0d7a('0x3d')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 4747b86..a16be16 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 _0x3b41=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','chatPause','available','stringify','emit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x3b41,0x166));var _0x13b4=function(_0x326e69,_0x1f015a){_0x326e69=_0x326e69-0x0;var _0x313cc2=_0x3b41[_0x326e69];return _0x313cc2;};'use strict';var _=require(_0x13b4('0x0'));var md5=require(_0x13b4('0x1'));var util=require('util');var Redis=require(_0x13b4('0x2'));var config=require(_0x13b4('0x3'));config[_0x13b4('0x4')]=_[_0x13b4('0x5')](config[_0x13b4('0x4')],{'host':_0x13b4('0x6'),'port':0x18eb});var io=require(_0x13b4('0x7'))(new Redis(config['redis']));function ChatQueue(_0x17f89a){this['id']=_0x17f89a['id']||0x0;this['name']=_0x17f89a[_0x13b4('0x8')]||'';this[_0x13b4('0x9')]=_0x17f89a[_0x13b4('0x9')]||0xa;this['strategy']=_0x17f89a[_0x13b4('0xa')]||_0x13b4('0xb');this['Agents']=_0x17f89a[_0x13b4('0xc')];this[_0x13b4('0xd')]={};this[_0x13b4('0xe')]=0x0;this[_0x13b4('0x1')]='';this[_0x13b4('0xf')]();this[_0x13b4('0x10')]();}ChatQueue[_0x13b4('0x11')][_0x13b4('0xf')]=function(){var _0x35b57f=this[_0x13b4('0xd')][_0x13b4('0x12')];this[_0x13b4('0xd')]=_['map'](this['Agents'],'id');this[_0x13b4('0xd')][_0x13b4('0x12')]=_0x35b57f;};ChatQueue[_0x13b4('0x11')][_0x13b4('0x10')]=function(){this[_0x13b4('0x13')]=0x0;this[_0x13b4('0x14')]=0x0;for(var _0x14a830=0x0;_0x14a830=0x0?this[_0x13b4('0x18')]:0x0;var _0x3d2cb9={'id':this['id'],'available':this[_0x13b4('0x18')],'loggedIn':this[_0x13b4('0x13')],'name':this[_0x13b4('0x8')],'paused':this[_0x13b4('0x14')],'waiting':this[_0x13b4('0xe')]};var _0x14733d=md5(JSON[_0x13b4('0x19')](_0x3d2cb9));if(this['md5']!==_0x14733d){this[_0x13b4('0x1')]=_0x14733d;io['to'](util['format']('chat:queue:%s',_0x3d2cb9[_0x13b4('0x8')]))[_0x13b4('0x1a')]('chat_queue:save',_0x3d2cb9);}};module[_0x13b4('0x1b')]=ChatQueue; \ No newline at end of file +var _0xb416=['format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','chatPause','available','stringify'];(function(_0x5b708e,_0x505c9f){var _0x2aa5ec=function(_0x461d7a){while(--_0x461d7a){_0x5b708e['push'](_0x5b708e['shift']());}};_0x2aa5ec(++_0x505c9f);}(_0xb416,0x198));var _0x6b41=function(_0x3dcc21,_0x9363d5){_0x3dcc21=_0x3dcc21-0x0;var _0x5abf6e=_0xb416[_0x3dcc21];return _0x5abf6e;};'use strict';var _=require(_0x6b41('0x0'));var md5=require(_0x6b41('0x1'));var util=require(_0x6b41('0x2'));var Redis=require(_0x6b41('0x3'));var config=require(_0x6b41('0x4'));config['redis']=_[_0x6b41('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x6b41('0x6'))(new Redis(config[_0x6b41('0x7')]));function ChatQueue(_0x57a9f3){this['id']=_0x57a9f3['id']||0x0;this[_0x6b41('0x8')]=_0x57a9f3[_0x6b41('0x8')]||'';this[_0x6b41('0x9')]=_0x57a9f3['timeout']||0xa;this[_0x6b41('0xa')]=_0x57a9f3[_0x6b41('0xa')]||_0x6b41('0xb');this[_0x6b41('0xc')]=_0x57a9f3['Agents'];this[_0x6b41('0xd')]={};this[_0x6b41('0xe')]=0x0;this['md5']='';this['updateRouting']();this[_0x6b41('0xf')]();}ChatQueue[_0x6b41('0x10')][_0x6b41('0x11')]=function(){var _0x56b1ab=this[_0x6b41('0xd')][_0x6b41('0x12')];this[_0x6b41('0xd')]=_[_0x6b41('0x13')](this[_0x6b41('0xc')],'id');this[_0x6b41('0xd')]['_rr']=_0x56b1ab;};ChatQueue['prototype'][_0x6b41('0xf')]=function(){this[_0x6b41('0x14')]=0x0;this[_0x6b41('0x15')]=0x0;for(var _0x12a34b=0x0;_0x12a34b=0x0?this[_0x6b41('0x18')]:0x0;var _0x4dbc64={'id':this['id'],'available':this[_0x6b41('0x18')],'loggedIn':this[_0x6b41('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x6b41('0xe')]};var _0x12c462=md5(JSON[_0x6b41('0x19')](_0x4dbc64));if(this[_0x6b41('0x1')]!==_0x12c462){this[_0x6b41('0x1')]=_0x12c462;io['to'](util[_0x6b41('0x1a')](_0x6b41('0x1b'),_0x4dbc64[_0x6b41('0x8')]))[_0x6b41('0x1c')](_0x6b41('0x1d'),_0x4dbc64);}};module[_0x6b41('0x1e')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 4644c6b..9c6e7a3 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(_0x1bb424,_0x5bec9d){var _0x22eba2=function(_0x2cffb6){while(--_0x2cffb6){_0x1bb424['push'](_0x1bb424['shift']());}};_0x22eba2(++_0x5bec9d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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(_0x9322f3,_0x518a09){var _0x5682d0=function(_0x3f172e){while(--_0x3f172e){_0x9322f3['push'](_0x9322f3['shift']());}};_0x5682d0(++_0x518a09);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 303f57e..fe6cf3b 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 _0x8c82=['name','Intervals','exports'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x8c82,0xae));var _0x28c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c82[_0x3dd15e];return _0x231fd0;};'use strict';function Interval(_0x57f5d5){this['id']=_0x57f5d5['id']||0x0;this[_0x28c8('0x0')]=_0x57f5d5[_0x28c8('0x0')]||'';this[_0x28c8('0x1')]=_0x57f5d5[_0x28c8('0x1')]||{};}module[_0x28c8('0x2')]=Interval; \ No newline at end of file +var _0xd050=['Intervals','exports','name'];(function(_0x3faad2,_0x2d7f65){var _0x3ddd22=function(_0x112c4f){while(--_0x112c4f){_0x3faad2['push'](_0x3faad2['shift']());}};_0x3ddd22(++_0x2d7f65);}(_0xd050,0x158));var _0x0d05=function(_0xac6d04,_0x277078){_0xac6d04=_0xac6d04-0x0;var _0x2ca7b7=_0xd050[_0xac6d04];return _0x2ca7b7;};'use strict';function Interval(_0x1d629b){this['id']=_0x1d629b['id']||0x0;this['name']=_0x1d629b[_0x0d05('0x0')]||'';this[_0x0d05('0x1')]=_0x1d629b[_0x0d05('0x1')]||{};}module[_0x0d05('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 8d38ee0..7e2cbb3 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 _0x8eb7=['length','mailPause','available','waiting','stringify','format','mail:queue:%s','emit','lodash','util','ioredis','redis','defaults','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused'];(function(_0x5b34c0,_0x3ad403){var _0x242bd3=function(_0x51d0ce){while(--_0x51d0ce){_0x5b34c0['push'](_0x5b34c0['shift']());}};_0x242bd3(++_0x3ad403);}(_0x8eb7,0xfb));var _0x78eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8eb7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x78eb('0x0'));var md5=require('md5');var util=require(_0x78eb('0x1'));var Redis=require(_0x78eb('0x2'));var config=require('../../../config/environment');config[_0x78eb('0x3')]=_[_0x78eb('0x4')](config[_0x78eb('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x78eb('0x3')]));function MailQueue(_0x15f4ff){this['id']=_0x15f4ff['id']||0x0;this[_0x78eb('0x5')]=_0x15f4ff[_0x78eb('0x5')]||'';this[_0x78eb('0x6')]=_0x15f4ff[_0x78eb('0x6')]||0xa;this[_0x78eb('0x7')]=_0x15f4ff[_0x78eb('0x7')]||_0x78eb('0x8');this['Agents']=_0x15f4ff[_0x78eb('0x9')];this[_0x78eb('0xa')]={};this['waiting']=0x0;this[_0x78eb('0xb')]='';this[_0x78eb('0xc')]();this[_0x78eb('0xd')]();}MailQueue['prototype']['updateRouting']=function(){var _0x10e577=this[_0x78eb('0xa')][_0x78eb('0xe')];this[_0x78eb('0xa')]=_[_0x78eb('0xf')](this[_0x78eb('0x9')],'id');this[_0x78eb('0xa')][_0x78eb('0xe')]=_0x10e577;};MailQueue[_0x78eb('0x10')][_0x78eb('0xd')]=function(){this[_0x78eb('0x11')]=0x0;this[_0x78eb('0x12')]=0x0;for(var _0x134e87=0x0;_0x134e87=0x0?this[_0x78eb('0x15')]:0x0;var _0x3c4179={'id':this['id'],'available':this[_0x78eb('0x15')],'loggedIn':this[_0x78eb('0x11')],'name':this[_0x78eb('0x5')],'paused':this[_0x78eb('0x12')],'waiting':this[_0x78eb('0x16')]};var _0x41be4d=md5(JSON[_0x78eb('0x17')](_0x3c4179));if(this[_0x78eb('0xb')]!==_0x41be4d){this[_0x78eb('0xb')]=_0x41be4d;io['to'](util[_0x78eb('0x18')](_0x78eb('0x19'),_0x3c4179[_0x78eb('0x5')]))[_0x78eb('0x1a')]('mail_queue:save',_0x3c4179);}};module['exports']=MailQueue; \ No newline at end of file +var _0xe622=['updateRealtime','loggedIn','paused','length','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr'];(function(_0x14a611,_0x1f04a8){var _0x35fbf0=function(_0x1057e2){while(--_0x1057e2){_0x14a611['push'](_0x14a611['shift']());}};_0x35fbf0(++_0x1f04a8);}(_0xe622,0x1e8));var _0x2e62=function(_0x5a5d41,_0x2edeb7){_0x5a5d41=_0x5a5d41-0x0;var _0x4f31b9=_0xe622[_0x5a5d41];return _0x4f31b9;};'use strict';var _=require(_0x2e62('0x0'));var md5=require(_0x2e62('0x1'));var util=require(_0x2e62('0x2'));var Redis=require('ioredis');var config=require(_0x2e62('0x3'));config[_0x2e62('0x4')]=_[_0x2e62('0x5')](config[_0x2e62('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2e62('0x4')]));function MailQueue(_0xa4ce23){this['id']=_0xa4ce23['id']||0x0;this['name']=_0xa4ce23[_0x2e62('0x6')]||'';this[_0x2e62('0x7')]=_0xa4ce23['timeout']||0xa;this[_0x2e62('0x8')]=_0xa4ce23['strategy']||_0x2e62('0x9');this[_0x2e62('0xa')]=_0xa4ce23['Agents'];this['mapAgentsId']={};this[_0x2e62('0xb')]=0x0;this[_0x2e62('0x1')]='';this[_0x2e62('0xc')]();this['updateRealtime']();}MailQueue[_0x2e62('0xd')][_0x2e62('0xc')]=function(){var _0x551775=this[_0x2e62('0xe')][_0x2e62('0xf')];this[_0x2e62('0xe')]=_['map'](this[_0x2e62('0xa')],'id');this[_0x2e62('0xe')][_0x2e62('0xf')]=_0x551775;};MailQueue[_0x2e62('0xd')][_0x2e62('0x10')]=function(){this[_0x2e62('0x11')]=0x0;this[_0x2e62('0x12')]=0x0;for(var _0x2e1c4f=0x0;_0x2e1c4f=0x0?this['available']:0x0;var _0x53ad6a={'id':this['id'],'available':this[_0x2e62('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x2e62('0x6')],'paused':this[_0x2e62('0x12')],'waiting':this[_0x2e62('0xb')]};var _0x2c4500=md5(JSON[_0x2e62('0x16')](_0x53ad6a));if(this[_0x2e62('0x1')]!==_0x2c4500){this['md5']=_0x2c4500;io['to'](util[_0x2e62('0x17')](_0x2e62('0x18'),_0x53ad6a['name']))[_0x2e62('0x19')](_0x2e62('0x1a'),_0x53ad6a);}};module[_0x2e62('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 5aff3fd..5c383f9 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 _0xb443=['lodash','md5','util','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','loggedIn','online','openchannelPause','paused','available','stringify','format','emit','openchannel_queue:save','exports'];(function(_0x395491,_0x487845){var _0x599658=function(_0x36ac1f){while(--_0x36ac1f){_0x395491['push'](_0x395491['shift']());}};_0x599658(++_0x487845);}(_0xb443,0xc4));var _0x3b44=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xb443[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0x3b44('0x0'));var md5=require(_0x3b44('0x1'));var util=require(_0x3b44('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x3b44('0x3')]=_[_0x3b44('0x4')](config[_0x3b44('0x3')],{'host':_0x3b44('0x5'),'port':0x18eb});var io=require(_0x3b44('0x6'))(new Redis(config[_0x3b44('0x3')]));function OpenchannelQueue(_0x15cc82){this['id']=_0x15cc82['id']||0x0;this['name']=_0x15cc82[_0x3b44('0x7')]||'';this[_0x3b44('0x8')]=_0x15cc82[_0x3b44('0x8')]||0xa;this['strategy']=_0x15cc82[_0x3b44('0x9')]||_0x3b44('0xa');this['Agents']=_0x15cc82[_0x3b44('0xb')];this[_0x3b44('0xc')]={};this[_0x3b44('0xd')]=0x0;this[_0x3b44('0x1')]='';this['updateRouting']();this[_0x3b44('0xe')]();}OpenchannelQueue[_0x3b44('0xf')][_0x3b44('0x10')]=function(){var _0x26301e=this[_0x3b44('0xc')]['_rr'];this[_0x3b44('0xc')]=_['map'](this[_0x3b44('0xb')],'id');this['mapAgentsId'][_0x3b44('0x11')]=_0x26301e;};OpenchannelQueue['prototype']['updateRealtime']=function(){this[_0x3b44('0x12')]=0x0;this['paused']=0x0;for(var _0x218a00=0x0;_0x218a00=0x0?this[_0x3b44('0x16')]:0x0;var _0x5e60a5={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3b44('0x12')],'name':this[_0x3b44('0x7')],'paused':this[_0x3b44('0x15')],'waiting':this['waiting']};var _0x4fdd10=md5(JSON[_0x3b44('0x17')](_0x5e60a5));if(this[_0x3b44('0x1')]!==_0x4fdd10){this[_0x3b44('0x1')]=_0x4fdd10;io['to'](util[_0x3b44('0x18')]('openchannel:queue:%s',_0x5e60a5[_0x3b44('0x7')]))[_0x3b44('0x19')](_0x3b44('0x1a'),_0x5e60a5);}};module[_0x3b44('0x1b')]=OpenchannelQueue; \ No newline at end of file +var _0xe9e1=['paused','length','online','loggedIn','available','stringify','format','openchannel:queue:%s','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','waiting','md5','updateRouting','prototype','mapAgentsId','_rr','map','Agents','updateRealtime'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xe9e1,0x140));var _0x1e9e=function(_0x3984ba,_0x5d3c07){_0x3984ba=_0x3984ba-0x0;var _0x55815f=_0xe9e1[_0x3984ba];return _0x55815f;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x1e9e('0x0'));var Redis=require(_0x1e9e('0x1'));var config=require('../../../config/environment');config[_0x1e9e('0x2')]=_[_0x1e9e('0x3')](config[_0x1e9e('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x1e9e('0x4'))(new Redis(config[_0x1e9e('0x2')]));function OpenchannelQueue(_0x315c7d){this['id']=_0x315c7d['id']||0x0;this[_0x1e9e('0x5')]=_0x315c7d[_0x1e9e('0x5')]||'';this[_0x1e9e('0x6')]=_0x315c7d[_0x1e9e('0x6')]||0xa;this[_0x1e9e('0x7')]=_0x315c7d['strategy']||_0x1e9e('0x8');this['Agents']=_0x315c7d['Agents'];this['mapAgentsId']={};this[_0x1e9e('0x9')]=0x0;this[_0x1e9e('0xa')]='';this[_0x1e9e('0xb')]();this['updateRealtime']();}OpenchannelQueue[_0x1e9e('0xc')][_0x1e9e('0xb')]=function(){var _0x316df6=this[_0x1e9e('0xd')][_0x1e9e('0xe')];this[_0x1e9e('0xd')]=_[_0x1e9e('0xf')](this[_0x1e9e('0x10')],'id');this[_0x1e9e('0xd')][_0x1e9e('0xe')]=_0x316df6;};OpenchannelQueue[_0x1e9e('0xc')][_0x1e9e('0x11')]=function(){this['loggedIn']=0x0;this[_0x1e9e('0x12')]=0x0;for(var _0x383ef7=0x0;_0x383ef7=0x0?this[_0x1e9e('0x16')]:0x0;var _0x442cc3={'id':this['id'],'available':this[_0x1e9e('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x1e9e('0x5')],'paused':this[_0x1e9e('0x12')],'waiting':this[_0x1e9e('0x9')]};var _0x14cf48=md5(JSON[_0x1e9e('0x17')](_0x442cc3));if(this[_0x1e9e('0xa')]!==_0x14cf48){this['md5']=_0x14cf48;io['to'](util[_0x1e9e('0x18')](_0x1e9e('0x19'),_0x442cc3['name']))['emit']('openchannel_queue:save',_0x442cc3);}};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 c602afa..46d8bf8 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 _0xe706=['prototype','_rr','map','online','loggedIn','smsPause','available','paused','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x5e3191,_0x47fe85){var _0xc8d5e6=function(_0x478881){while(--_0x478881){_0x5e3191['push'](_0x5e3191['shift']());}};_0xc8d5e6(++_0x47fe85);}(_0xe706,0xa3));var _0x6e70=function(_0x8e7772,_0x9d77b0){_0x8e7772=_0x8e7772-0x0;var _0x408200=_0xe706[_0x8e7772];return _0x408200;};'use strict';var _=require(_0x6e70('0x0'));var md5=require(_0x6e70('0x1'));var util=require(_0x6e70('0x2'));var Redis=require('ioredis');var config=require(_0x6e70('0x3'));config[_0x6e70('0x4')]=_[_0x6e70('0x5')](config[_0x6e70('0x4')],{'host':_0x6e70('0x6'),'port':0x18eb});var io=require(_0x6e70('0x7'))(new Redis(config[_0x6e70('0x4')]));function SmsQueue(_0x506db9){this['id']=_0x506db9['id']||0x0;this[_0x6e70('0x8')]=_0x506db9[_0x6e70('0x8')]||'';this[_0x6e70('0x9')]=_0x506db9[_0x6e70('0x9')]||0xa;this[_0x6e70('0xa')]=_0x506db9[_0x6e70('0xa')]||_0x6e70('0xb');this[_0x6e70('0xc')]=_0x506db9[_0x6e70('0xc')];this[_0x6e70('0xd')]={};this[_0x6e70('0xe')]=0x0;this[_0x6e70('0x1')]='';this[_0x6e70('0xf')]();this[_0x6e70('0x10')]();}SmsQueue[_0x6e70('0x11')][_0x6e70('0xf')]=function(){var _0x5b3d07=this['mapAgentsId'][_0x6e70('0x12')];this[_0x6e70('0xd')]=_[_0x6e70('0x13')](this[_0x6e70('0xc')],'id');this[_0x6e70('0xd')][_0x6e70('0x12')]=_0x5b3d07;};SmsQueue[_0x6e70('0x11')][_0x6e70('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x48bc72=0x0;_0x48bc72=0x0?this['available']:0x0;var _0x28a21f={'id':this['id'],'available':this[_0x6e70('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x6e70('0x18')],'waiting':this[_0x6e70('0xe')]};var _0x2368eb=md5(JSON[_0x6e70('0x19')](_0x28a21f));if(this[_0x6e70('0x1')]!==_0x2368eb){this[_0x6e70('0x1')]=_0x2368eb;io['to'](util[_0x6e70('0x1a')](_0x6e70('0x1b'),_0x28a21f[_0x6e70('0x8')]))[_0x6e70('0x1c')]('sms_queue:save',_0x28a21f);}};module[_0x6e70('0x1d')]=SmsQueue; \ No newline at end of file +var _0xb10b=['length','online','loggedIn','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','_rr','map','updateRealtime','paused'];(function(_0x2d3ab3,_0x47d90b){var _0x321f9e=function(_0x50a53d){while(--_0x50a53d){_0x2d3ab3['push'](_0x2d3ab3['shift']());}};_0x321f9e(++_0x47d90b);}(_0xb10b,0x12a));var _0xbb10=function(_0x514532,_0x1985d6){_0x514532=_0x514532-0x0;var _0x4ae990=_0xb10b[_0x514532];return _0x4ae990;};'use strict';var _=require(_0xbb10('0x0'));var md5=require('md5');var util=require(_0xbb10('0x1'));var Redis=require(_0xbb10('0x2'));var config=require(_0xbb10('0x3'));config['redis']=_[_0xbb10('0x4')](config[_0xbb10('0x5')],{'host':_0xbb10('0x6'),'port':0x18eb});var io=require(_0xbb10('0x7'))(new Redis(config[_0xbb10('0x5')]));function SmsQueue(_0x312b72){this['id']=_0x312b72['id']||0x0;this['name']=_0x312b72[_0xbb10('0x8')]||'';this[_0xbb10('0x9')]=_0x312b72['timeout']||0xa;this[_0xbb10('0xa')]=_0x312b72[_0xbb10('0xa')]||_0xbb10('0xb');this[_0xbb10('0xc')]=_0x312b72[_0xbb10('0xc')];this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]=0x0;this[_0xbb10('0xf')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xbb10('0x10')][_0xbb10('0x11')]=function(){var _0xce64f3=this['mapAgentsId'][_0xbb10('0x12')];this['mapAgentsId']=_[_0xbb10('0x13')](this[_0xbb10('0xc')],'id');this[_0xbb10('0xd')][_0xbb10('0x12')]=_0xce64f3;};SmsQueue[_0xbb10('0x10')][_0xbb10('0x14')]=function(){this['loggedIn']=0x0;this[_0xbb10('0x15')]=0x0;for(var _0x42d7e4=0x0;_0x42d7e4=0x0?this[_0xbb10('0x1a')]:0x0;var _0x1682a4={'id':this['id'],'available':this[_0xbb10('0x1a')],'loggedIn':this[_0xbb10('0x18')],'name':this[_0xbb10('0x8')],'paused':this[_0xbb10('0x15')],'waiting':this['waiting']};var _0x5ff0cf=md5(JSON[_0xbb10('0x1b')](_0x1682a4));if(this[_0xbb10('0xf')]!==_0x5ff0cf){this[_0xbb10('0xf')]=_0x5ff0cf;io['to'](util[_0xbb10('0x1c')](_0xbb10('0x1d'),_0x1682a4['name']))[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x1682a4);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 8bcb4e3..9d63292 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 _0xaa0b=['loggedIn','available','stringify','format','emit','whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','map','paused','length','online'];(function(_0x24b477,_0x30393b){var _0x4041a6=function(_0x2d64de){while(--_0x2d64de){_0x24b477['push'](_0x24b477['shift']());}};_0x4041a6(++_0x30393b);}(_0xaa0b,0x10b));var _0xbaa0=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xaa0b[_0xfa634c];return _0x73e478;};'use strict';var _=require(_0xbaa0('0x0'));var md5=require(_0xbaa0('0x1'));var util=require(_0xbaa0('0x2'));var Redis=require(_0xbaa0('0x3'));var config=require(_0xbaa0('0x4'));config[_0xbaa0('0x5')]=_[_0xbaa0('0x6')](config['redis'],{'host':_0xbaa0('0x7'),'port':0x18eb});var io=require(_0xbaa0('0x8'))(new Redis(config['redis']));function WhatsappQueue(_0x103bd9){this['id']=_0x103bd9['id']||0x0;this[_0xbaa0('0x9')]=_0x103bd9[_0xbaa0('0x9')]||'';this['timeout']=_0x103bd9[_0xbaa0('0xa')]||0xa;this[_0xbaa0('0xb')]=_0x103bd9[_0xbaa0('0xb')]||_0xbaa0('0xc');this[_0xbaa0('0xd')]=_0x103bd9[_0xbaa0('0xd')];this[_0xbaa0('0xe')]={};this[_0xbaa0('0xf')]=0x0;this[_0xbaa0('0x1')]='';this['updateRouting']();this[_0xbaa0('0x10')]();}WhatsappQueue[_0xbaa0('0x11')]['updateRouting']=function(){var _0x1eb908=this[_0xbaa0('0xe')][_0xbaa0('0x12')];this[_0xbaa0('0xe')]=_[_0xbaa0('0x13')](this[_0xbaa0('0xd')],'id');this['mapAgentsId'][_0xbaa0('0x12')]=_0x1eb908;};WhatsappQueue[_0xbaa0('0x11')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xbaa0('0x14')]=0x0;for(var _0x4cb742=0x0;_0x4cb742=0x0?this[_0xbaa0('0x18')]:0x0;var _0x38d3dc={'id':this['id'],'available':this['available'],'loggedIn':this[_0xbaa0('0x17')],'name':this[_0xbaa0('0x9')],'paused':this['paused'],'waiting':this[_0xbaa0('0xf')]};var _0x95f3b=md5(JSON[_0xbaa0('0x19')](_0x38d3dc));if(this['md5']!==_0x95f3b){this[_0xbaa0('0x1')]=_0x95f3b;io['to'](util[_0xbaa0('0x1a')]('whatsapp:queue:%s',_0x38d3dc[_0xbaa0('0x9')]))[_0xbaa0('0x1b')](_0xbaa0('0x1c'),_0x38d3dc);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x3791=['emit','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','updateRealtime','length','online','loggedIn','whatsappPause','paused','available','stringify','whatsapp:queue:%s'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3791,0x16a));var _0x1379=function(_0x2e0bbd,_0x23e35e){_0x2e0bbd=_0x2e0bbd-0x0;var _0x385990=_0x3791[_0x2e0bbd];return _0x385990;};'use strict';var _=require(_0x1379('0x0'));var md5=require('md5');var util=require(_0x1379('0x1'));var Redis=require(_0x1379('0x2'));var config=require(_0x1379('0x3'));config[_0x1379('0x4')]=_[_0x1379('0x5')](config[_0x1379('0x4')],{'host':_0x1379('0x6'),'port':0x18eb});var io=require(_0x1379('0x7'))(new Redis(config[_0x1379('0x4')]));function WhatsappQueue(_0x1a227d){this['id']=_0x1a227d['id']||0x0;this['name']=_0x1a227d[_0x1379('0x8')]||'';this[_0x1379('0x9')]=_0x1a227d[_0x1379('0x9')]||0xa;this[_0x1379('0xa')]=_0x1a227d[_0x1379('0xa')]||_0x1379('0xb');this[_0x1379('0xc')]=_0x1a227d['Agents'];this[_0x1379('0xd')]={};this[_0x1379('0xe')]=0x0;this[_0x1379('0xf')]='';this[_0x1379('0x10')]();this['updateRealtime']();}WhatsappQueue[_0x1379('0x11')][_0x1379('0x10')]=function(){var _0x375582=this['mapAgentsId'][_0x1379('0x12')];this[_0x1379('0xd')]=_['map'](this[_0x1379('0xc')],'id');this[_0x1379('0xd')][_0x1379('0x12')]=_0x375582;};WhatsappQueue['prototype'][_0x1379('0x13')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x40c33b=0x0;_0x40c33b=0x0?this[_0x1379('0x19')]:0x0;var _0x5504cc={'id':this['id'],'available':this[_0x1379('0x19')],'loggedIn':this[_0x1379('0x16')],'name':this[_0x1379('0x8')],'paused':this[_0x1379('0x18')],'waiting':this[_0x1379('0xe')]};var _0x594e46=md5(JSON[_0x1379('0x1a')](_0x5504cc));if(this[_0x1379('0xf')]!==_0x594e46){this[_0x1379('0xf')]=_0x594e46;io['to'](util['format'](_0x1379('0x1b'),_0x5504cc[_0x1379('0x8')]))[_0x1379('0x1c')]('whatsapp_queue:save',_0x5504cc);}};module[_0x1379('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index aa707b5..bd8ef34 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','mergeFromDatabase','initOpenchannelQueues','updateRouting','updateRealtime','initFaxQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7217,0x19e));var _0x7721=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x7217[_0xa1e3e3];return _0xc980e9;};'use strict';var BPromise=require(_0x7721('0x0'));var util=require('util');var _=require(_0x7721('0x1'));var moment=require(_0x7721('0x2'));var Agent=require(_0x7721('0x3'));var Interval=require(_0x7721('0x4'));var OpenchannelQueue=require(_0x7721('0x5'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x7721('0x6'));var FaxQueue=require(_0x7721('0x7'));var WhatsappQueue=require(_0x7721('0x8'));var Realtime=function(){this[_0x7721('0x9')]={};this[_0x7721('0xa')]={};this[_0x7721('0xb')]={};this[_0x7721('0xc')]={};this[_0x7721('0xd')]={};this[_0x7721('0xe')]={};this[_0x7721('0xf')]={};this[_0x7721('0x10')]={};this[_0x7721('0x11')]={};this[_0x7721('0x12')]={};this[_0x7721('0x13')]={};this[_0x7721('0x14')]={};this['faxQueuesWaitingInteractions']={};this[_0x7721('0x15')]={};};function freeIsNotKey(_0x29bc8f,_0x8729a6,_0xf78099){var _0xa8977c=_[_0x7721('0x16')](_0x29bc8f,function(_0x1e7fd7,_0x27b36b){return _0x1e7fd7[_0xf78099];});for(var _0x55b4ca in _0x8729a6){if(_0x8729a6[_0x7721('0x17')](_0x55b4ca)){if(!_0xa8977c[_0x55b4ca]){delete _0x8729a6[_0x55b4ca];}}}}Realtime[_0x7721('0x18')]['mergeFromDatabase']=function(_0x109900,_0x30da54){for(var _0x3f01c5 in _0x30da54){if(_0x109900[_0x7721('0x17')](_0x3f01c5)){_0x109900[_0x3f01c5]=_0x30da54[_0x3f01c5];}}};Realtime['prototype'][_0x7721('0x19')]=function(){var _0x25b1c0=this;return function(_0x534f1b){if(_0x534f1b){freeIsNotKey(_0x534f1b,_0x25b1c0['agents'],'id');for(var _0x4b183e=0x0,_0x5ed54={},_0x25a628={};_0x4b183e<_0x534f1b[_0x7721('0x1a')];_0x4b183e+=0x1){_0x5ed54=_0x534f1b[_0x4b183e];if(_[_0x7721('0x1b')](_0x25b1c0['agents'][_0x5ed54['id']])){_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']]=new Agent(_0x5ed54);}else{_0x25b1c0['mergeFromDatabase'](_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']],_0x5ed54);}}}return _0x25b1c0['agents'];};};Realtime[_0x7721('0x18')][_0x7721('0x1c')]=function(){var _0x3ab5a5=this;return function(_0x3e140d){if(_0x3e140d){freeIsNotKey(_0x3e140d,_0x3ab5a5[_0x7721('0xa')],'id');for(var _0x40af90=0x0,_0x402820={},_0x413263={};_0x40af90<_0x3e140d[_0x7721('0x1a')];_0x40af90+=0x1){_0x402820=_0x3e140d[_0x40af90];if(_[_0x7721('0x1b')](_0x3ab5a5['intervals'][_0x402820['id']])){_0x3ab5a5[_0x7721('0xa')][_0x402820['id']]=new Interval(_0x402820);}else{_0x3ab5a5[_0x7721('0x1d')](_0x3ab5a5[_0x7721('0xa')][_0x402820['id']],_0x402820);}}}return _0x3ab5a5[_0x7721('0xa')];};};Realtime['prototype'][_0x7721('0x1e')]=function(){var _0x512f31=this;return function(_0xb9e9dd){if(_0xb9e9dd){freeIsNotKey(_0xb9e9dd,_0x512f31[_0x7721('0xb')],'id');for(var _0x3e8a4e=0x0,_0x1caad8={},_0x121cc4={};_0x3e8a4e<_0xb9e9dd[_0x7721('0x1a')];_0x3e8a4e+=0x1){_0x1caad8=_0xb9e9dd[_0x3e8a4e];if(_[_0x7721('0x1b')](_0x512f31['openchannelQueues'][_0x1caad8['id']])){_0x512f31[_0x7721('0xb')][_0x1caad8['id']]=new OpenchannelQueue(_0x1caad8);}else{_0x512f31[_0x7721('0x1d')](_0x512f31[_0x7721('0xb')][_0x1caad8['id']],_0x1caad8);}_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x1f')]();_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x20')]();}}return _0x512f31[_0x7721('0xb')];};};Realtime[_0x7721('0x18')]['initChatQueues']=function(){var _0x258ddf=this;return function(_0x5b0551){if(_0x5b0551){freeIsNotKey(_0x5b0551,_0x258ddf['chatQueues'],'id');for(var _0x315202=0x0,_0x343c19={},_0x53c904={};_0x315202<_0x5b0551[_0x7721('0x1a')];_0x315202+=0x1){_0x343c19=_0x5b0551[_0x315202];if(_[_0x7721('0x1b')](_0x258ddf[_0x7721('0xc')][_0x343c19['id']])){_0x258ddf[_0x7721('0xc')][_0x343c19['id']]=new ChatQueue(_0x343c19);}else{_0x258ddf[_0x7721('0x1d')](_0x258ddf['chatQueues'][_0x343c19['id']],_0x343c19);}_0x258ddf[_0x7721('0xc')][_0x343c19['id']][_0x7721('0x1f')]();_0x258ddf['chatQueues'][_0x343c19['id']]['updateRealtime']();}}return _0x258ddf[_0x7721('0xc')];};};Realtime[_0x7721('0x18')]['initSmsQueues']=function(){var _0x46f772=this;return function(_0x4651b5){if(_0x4651b5){freeIsNotKey(_0x4651b5,_0x46f772[_0x7721('0xd')],'id');for(var _0x58d54b=0x0,_0x3d9a32={},_0x1ff31b={};_0x58d54b<_0x4651b5[_0x7721('0x1a')];_0x58d54b+=0x1){_0x3d9a32=_0x4651b5[_0x58d54b];if(_[_0x7721('0x1b')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']])){_0x46f772['smsQueues'][_0x3d9a32['id']]=new SmsQueue(_0x3d9a32);}else{_0x46f772[_0x7721('0x1d')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']],_0x3d9a32);}_0x46f772[_0x7721('0xd')][_0x3d9a32['id']]['updateRouting']();_0x46f772[_0x7721('0xd')][_0x3d9a32['id']][_0x7721('0x20')]();}}return _0x46f772['smsQueues'];};};Realtime[_0x7721('0x18')]['initMailQueues']=function(){var _0x2d6ba0=this;return function(_0x326c50){if(_0x326c50){freeIsNotKey(_0x326c50,_0x2d6ba0[_0x7721('0xe')],'id');for(var _0x1d894b=0x0,_0x1c84c0={},_0x13c635={};_0x1d894b<_0x326c50[_0x7721('0x1a')];_0x1d894b+=0x1){_0x1c84c0=_0x326c50[_0x1d894b];if(_[_0x7721('0x1b')](_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']])){_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]=new MailQueue(_0x1c84c0);}else{_0x2d6ba0[_0x7721('0x1d')](_0x2d6ba0['mailQueues'][_0x1c84c0['id']],_0x1c84c0);}_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]['updateRouting']();_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']][_0x7721('0x20')]();}}return _0x2d6ba0[_0x7721('0xe')];};};Realtime[_0x7721('0x18')][_0x7721('0x21')]=function(){var _0x378ba5=this;return function(_0x482b70){if(_0x482b70){freeIsNotKey(_0x482b70,_0x378ba5['faxQueues'],'id');for(var _0x4cadef=0x0,_0x539560={},_0x18001c={};_0x4cadef<_0x482b70[_0x7721('0x1a')];_0x4cadef+=0x1){_0x539560=_0x482b70[_0x4cadef];if(_[_0x7721('0x1b')](_0x378ba5[_0x7721('0xf')][_0x539560['id']])){_0x378ba5['faxQueues'][_0x539560['id']]=new FaxQueue(_0x539560);}else{_0x378ba5[_0x7721('0x1d')](_0x378ba5['faxQueues'][_0x539560['id']],_0x539560);}_0x378ba5[_0x7721('0xf')][_0x539560['id']][_0x7721('0x1f')]();_0x378ba5['faxQueues'][_0x539560['id']][_0x7721('0x20')]();}}return _0x378ba5[_0x7721('0xf')];};};Realtime['prototype']['initWhatsappQueues']=function(){var _0x3d84d3=this;return function(_0xfc4dc4){if(_0xfc4dc4){freeIsNotKey(_0xfc4dc4,_0x3d84d3[_0x7721('0x10')],'id');for(var _0x15e34d=0x0,_0x577af9={},_0x2db173={};_0x15e34d<_0xfc4dc4[_0x7721('0x1a')];_0x15e34d+=0x1){_0x577af9=_0xfc4dc4[_0x15e34d];if(_[_0x7721('0x1b')](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']])){_0x3d84d3[_0x7721('0x10')][_0x577af9['id']]=new WhatsappQueue(_0x577af9);}else{_0x3d84d3['mergeFromDatabase'](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']],_0x577af9);}_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x1f')]();_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x20')]();}}return _0x3d84d3[_0x7721('0x10')];};};module[_0x7721('0x22')]=Realtime; \ No newline at end of file +var _0x7217=['../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','mergeFromDatabase','initOpenchannelQueues','updateRouting','updateRealtime','initFaxQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7217,0x19e));var _0x7721=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x7217[_0x5037ab];return _0x512adb;};'use strict';var BPromise=require(_0x7721('0x0'));var util=require('util');var _=require(_0x7721('0x1'));var moment=require(_0x7721('0x2'));var Agent=require(_0x7721('0x3'));var Interval=require(_0x7721('0x4'));var OpenchannelQueue=require(_0x7721('0x5'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x7721('0x6'));var FaxQueue=require(_0x7721('0x7'));var WhatsappQueue=require(_0x7721('0x8'));var Realtime=function(){this[_0x7721('0x9')]={};this[_0x7721('0xa')]={};this[_0x7721('0xb')]={};this[_0x7721('0xc')]={};this[_0x7721('0xd')]={};this[_0x7721('0xe')]={};this[_0x7721('0xf')]={};this[_0x7721('0x10')]={};this[_0x7721('0x11')]={};this[_0x7721('0x12')]={};this[_0x7721('0x13')]={};this[_0x7721('0x14')]={};this['faxQueuesWaitingInteractions']={};this[_0x7721('0x15')]={};};function freeIsNotKey(_0x29bc8f,_0x8729a6,_0xf78099){var _0xa8977c=_[_0x7721('0x16')](_0x29bc8f,function(_0x1e7fd7,_0x27b36b){return _0x1e7fd7[_0xf78099];});for(var _0x55b4ca in _0x8729a6){if(_0x8729a6[_0x7721('0x17')](_0x55b4ca)){if(!_0xa8977c[_0x55b4ca]){delete _0x8729a6[_0x55b4ca];}}}}Realtime[_0x7721('0x18')]['mergeFromDatabase']=function(_0x109900,_0x30da54){for(var _0x3f01c5 in _0x30da54){if(_0x109900[_0x7721('0x17')](_0x3f01c5)){_0x109900[_0x3f01c5]=_0x30da54[_0x3f01c5];}}};Realtime['prototype'][_0x7721('0x19')]=function(){var _0x25b1c0=this;return function(_0x534f1b){if(_0x534f1b){freeIsNotKey(_0x534f1b,_0x25b1c0['agents'],'id');for(var _0x4b183e=0x0,_0x5ed54={},_0x25a628={};_0x4b183e<_0x534f1b[_0x7721('0x1a')];_0x4b183e+=0x1){_0x5ed54=_0x534f1b[_0x4b183e];if(_[_0x7721('0x1b')](_0x25b1c0['agents'][_0x5ed54['id']])){_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']]=new Agent(_0x5ed54);}else{_0x25b1c0['mergeFromDatabase'](_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']],_0x5ed54);}}}return _0x25b1c0['agents'];};};Realtime[_0x7721('0x18')][_0x7721('0x1c')]=function(){var _0x3ab5a5=this;return function(_0x3e140d){if(_0x3e140d){freeIsNotKey(_0x3e140d,_0x3ab5a5[_0x7721('0xa')],'id');for(var _0x40af90=0x0,_0x402820={},_0x413263={};_0x40af90<_0x3e140d[_0x7721('0x1a')];_0x40af90+=0x1){_0x402820=_0x3e140d[_0x40af90];if(_[_0x7721('0x1b')](_0x3ab5a5['intervals'][_0x402820['id']])){_0x3ab5a5[_0x7721('0xa')][_0x402820['id']]=new Interval(_0x402820);}else{_0x3ab5a5[_0x7721('0x1d')](_0x3ab5a5[_0x7721('0xa')][_0x402820['id']],_0x402820);}}}return _0x3ab5a5[_0x7721('0xa')];};};Realtime['prototype'][_0x7721('0x1e')]=function(){var _0x512f31=this;return function(_0xb9e9dd){if(_0xb9e9dd){freeIsNotKey(_0xb9e9dd,_0x512f31[_0x7721('0xb')],'id');for(var _0x3e8a4e=0x0,_0x1caad8={},_0x121cc4={};_0x3e8a4e<_0xb9e9dd[_0x7721('0x1a')];_0x3e8a4e+=0x1){_0x1caad8=_0xb9e9dd[_0x3e8a4e];if(_[_0x7721('0x1b')](_0x512f31['openchannelQueues'][_0x1caad8['id']])){_0x512f31[_0x7721('0xb')][_0x1caad8['id']]=new OpenchannelQueue(_0x1caad8);}else{_0x512f31[_0x7721('0x1d')](_0x512f31[_0x7721('0xb')][_0x1caad8['id']],_0x1caad8);}_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x1f')]();_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x20')]();}}return _0x512f31[_0x7721('0xb')];};};Realtime[_0x7721('0x18')]['initChatQueues']=function(){var _0x258ddf=this;return function(_0x5b0551){if(_0x5b0551){freeIsNotKey(_0x5b0551,_0x258ddf['chatQueues'],'id');for(var _0x315202=0x0,_0x343c19={},_0x53c904={};_0x315202<_0x5b0551[_0x7721('0x1a')];_0x315202+=0x1){_0x343c19=_0x5b0551[_0x315202];if(_[_0x7721('0x1b')](_0x258ddf[_0x7721('0xc')][_0x343c19['id']])){_0x258ddf[_0x7721('0xc')][_0x343c19['id']]=new ChatQueue(_0x343c19);}else{_0x258ddf[_0x7721('0x1d')](_0x258ddf['chatQueues'][_0x343c19['id']],_0x343c19);}_0x258ddf[_0x7721('0xc')][_0x343c19['id']][_0x7721('0x1f')]();_0x258ddf['chatQueues'][_0x343c19['id']]['updateRealtime']();}}return _0x258ddf[_0x7721('0xc')];};};Realtime[_0x7721('0x18')]['initSmsQueues']=function(){var _0x46f772=this;return function(_0x4651b5){if(_0x4651b5){freeIsNotKey(_0x4651b5,_0x46f772[_0x7721('0xd')],'id');for(var _0x58d54b=0x0,_0x3d9a32={},_0x1ff31b={};_0x58d54b<_0x4651b5[_0x7721('0x1a')];_0x58d54b+=0x1){_0x3d9a32=_0x4651b5[_0x58d54b];if(_[_0x7721('0x1b')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']])){_0x46f772['smsQueues'][_0x3d9a32['id']]=new SmsQueue(_0x3d9a32);}else{_0x46f772[_0x7721('0x1d')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']],_0x3d9a32);}_0x46f772[_0x7721('0xd')][_0x3d9a32['id']]['updateRouting']();_0x46f772[_0x7721('0xd')][_0x3d9a32['id']][_0x7721('0x20')]();}}return _0x46f772['smsQueues'];};};Realtime[_0x7721('0x18')]['initMailQueues']=function(){var _0x2d6ba0=this;return function(_0x326c50){if(_0x326c50){freeIsNotKey(_0x326c50,_0x2d6ba0[_0x7721('0xe')],'id');for(var _0x1d894b=0x0,_0x1c84c0={},_0x13c635={};_0x1d894b<_0x326c50[_0x7721('0x1a')];_0x1d894b+=0x1){_0x1c84c0=_0x326c50[_0x1d894b];if(_[_0x7721('0x1b')](_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']])){_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]=new MailQueue(_0x1c84c0);}else{_0x2d6ba0[_0x7721('0x1d')](_0x2d6ba0['mailQueues'][_0x1c84c0['id']],_0x1c84c0);}_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]['updateRouting']();_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']][_0x7721('0x20')]();}}return _0x2d6ba0[_0x7721('0xe')];};};Realtime[_0x7721('0x18')][_0x7721('0x21')]=function(){var _0x378ba5=this;return function(_0x482b70){if(_0x482b70){freeIsNotKey(_0x482b70,_0x378ba5['faxQueues'],'id');for(var _0x4cadef=0x0,_0x539560={},_0x18001c={};_0x4cadef<_0x482b70[_0x7721('0x1a')];_0x4cadef+=0x1){_0x539560=_0x482b70[_0x4cadef];if(_[_0x7721('0x1b')](_0x378ba5[_0x7721('0xf')][_0x539560['id']])){_0x378ba5['faxQueues'][_0x539560['id']]=new FaxQueue(_0x539560);}else{_0x378ba5[_0x7721('0x1d')](_0x378ba5['faxQueues'][_0x539560['id']],_0x539560);}_0x378ba5[_0x7721('0xf')][_0x539560['id']][_0x7721('0x1f')]();_0x378ba5['faxQueues'][_0x539560['id']][_0x7721('0x20')]();}}return _0x378ba5[_0x7721('0xf')];};};Realtime['prototype']['initWhatsappQueues']=function(){var _0x3d84d3=this;return function(_0xfc4dc4){if(_0xfc4dc4){freeIsNotKey(_0xfc4dc4,_0x3d84d3[_0x7721('0x10')],'id');for(var _0x15e34d=0x0,_0x577af9={},_0x2db173={};_0x15e34d<_0xfc4dc4[_0x7721('0x1a')];_0x15e34d+=0x1){_0x577af9=_0xfc4dc4[_0x15e34d];if(_[_0x7721('0x1b')](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']])){_0x3d84d3[_0x7721('0x10')][_0x577af9['id']]=new WhatsappQueue(_0x577af9);}else{_0x3d84d3['mergeFromDatabase'](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']],_0x577af9);}_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x1f')]();_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x20')]();}}return _0x3d84d3[_0x7721('0x10')];};};module[_0x7721('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index f18804b..043c566 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 _0x8194=['Request','AddTagsToChatInteraction','../client','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x225854,_0x34df43){var _0x38c977=function(_0x935c14){while(--_0x935c14){_0x225854['push'](_0x225854['shift']());}};_0x38c977(++_0x34df43);}(_0x8194,0xce));var _0x4819=function(_0xca8f32,_0xe6ba73){_0xca8f32=_0xca8f32-0x0;var _0x4c23f8=_0x8194[_0xca8f32];return _0x4c23f8;};'use strict';var client=require(_0x4819('0x0'));exports['update']=function(_0x98d359,_0x4aff14){return client['Request'](_0x4819('0x1'),{'body':_0x4aff14,'options':{'where':{'id':_0x98d359}},'log':_0x4819('0x2')});};exports[_0x4819('0x3')]=function(_0x1b12a2,_0x3b12e9){return client[_0x4819('0x4')](_0x4819('0x5'),{'body':_0x3b12e9,'options':{'where':{'id':_0x1b12a2}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x306a=['update','Request','../client'];(function(_0x13a14d,_0x1e10d2){var _0x4772c6=function(_0xe45e19){while(--_0xe45e19){_0x13a14d['push'](_0x13a14d['shift']());}};_0x4772c6(++_0x1e10d2);}(_0x306a,0x15e));var _0xa306=function(_0x50f0a9,_0x2b0c57){_0x50f0a9=_0x50f0a9-0x0;var _0x5a33d9=_0x306a[_0x50f0a9];return _0x5a33d9;};'use strict';var client=require(_0xa306('0x0'));exports[_0xa306('0x1')]=function(_0x436eb2,_0xfe01d){return client['Request']('UpdateChatInteraction',{'body':_0xfe01d,'options':{'where':{'id':_0x436eb2}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x2c4fa0,_0xab1459){return client[_0xa306('0x2')]('AddTagsToChatInteraction',{'body':_0xab1459,'options':{'where':{'id':_0x2c4fa0}},'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 298f99f..4cf847f 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 _0x34c1=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x34c1,0x1d3));var _0x134c=function(_0x1798cb,_0xafe39f){_0x1798cb=_0x1798cb-0x0;var _0x4a68ed=_0x34c1[_0x1798cb];return _0x4a68ed;};'use strict';var client=require(_0x134c('0x0'));exports[_0x134c('0x1')]=function(_0x13675d){return client[_0x134c('0x2')](_0x134c('0x3'),{'body':_0x13675d,'log':_0x134c('0x4')});}; \ No newline at end of file +var _0xa37c=['createChatMessage'];(function(_0x2640be,_0x441b26){var _0x45b690=function(_0x503335){while(--_0x503335){_0x2640be['push'](_0x2640be['shift']());}};_0x45b690(++_0x441b26);}(_0xa37c,0x16b));var _0xca37=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xa37c[_0x46e363];return _0x3fb059;};'use strict';var client=require('../client');exports['create']=function(_0xd4a8d2){return client['Request']('CreateChatMessage',{'body':_0xd4a8d2,'log':_0xca37('0x0')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 3a0efe8..51285e4 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 _0x9ca9=['getChatQueues','Request','GetChatQueue','name','timeout','strategy','User','Agents','online','chatPause','../client'];(function(_0x43e53e,_0x346f3f){var _0x487bf0=function(_0x2d3213){while(--_0x2d3213){_0x43e53e['push'](_0x43e53e['shift']());}};_0x487bf0(++_0x346f3f);}(_0x9ca9,0x154));var _0x99ca=function(_0x5823f4,_0x52844b){_0x5823f4=_0x5823f4-0x0;var _0x119b48=_0x9ca9[_0x5823f4];return _0x119b48;};'use strict';var client=require(_0x99ca('0x0'));exports[_0x99ca('0x1')]=function(){return function(){return client[_0x99ca('0x2')](_0x99ca('0x3'),{'options':{'raw':![],'attributes':['id',_0x99ca('0x4'),_0x99ca('0x5'),_0x99ca('0x6')],'include':[{'model':_0x99ca('0x7'),'as':_0x99ca('0x8'),'attributes':['id',_0x99ca('0x4'),_0x99ca('0x9'),_0x99ca('0xa')]}]},'log':_0x99ca('0x1')});};}; \ No newline at end of file +var _0x5eee=['Agents','chatPause','../client','getChatQueues','GetChatQueue','name','timeout'];(function(_0x90a87a,_0x589161){var _0x4d797f=function(_0xbbf15a){while(--_0xbbf15a){_0x90a87a['push'](_0x90a87a['shift']());}};_0x4d797f(++_0x589161);}(_0x5eee,0xa3));var _0xe5ee=function(_0x33d11d,_0x486cd5){_0x33d11d=_0x33d11d-0x0;var _0x274321=_0x5eee[_0x33d11d];return _0x274321;};'use strict';var client=require(_0xe5ee('0x0'));exports[_0xe5ee('0x1')]=function(){return function(){return client['Request'](_0xe5ee('0x2'),{'options':{'raw':![],'attributes':['id',_0xe5ee('0x3'),_0xe5ee('0x4'),'strategy'],'include':[{'model':'User','as':_0xe5ee('0x5'),'attributes':['id','name','online',_0xe5ee('0x6')]}]},'log':_0xe5ee('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 09fb14c..4e268d0 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 _0x33a4=['DESC','create','Request','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x33a4,0x88));var _0x433a=function(_0xddf24f,_0xacac45){_0xddf24f=_0xddf24f-0x0;var _0x131184=_0x33a4[_0xddf24f];return _0x131184;};'use strict';var client=require('../client');exports[_0x433a('0x0')]=function(_0x5cc62d){return client[_0x433a('0x1')](_0x433a('0x2'),{'body':_0x5cc62d,'log':_0x433a('0x2')});};exports['update']=function(_0x4b7aef,_0x4f5bc0){return client[_0x433a('0x1')](_0x433a('0x3'),{'body':_0x4f5bc0,'options':{'where':{'uniqueid':_0x4b7aef},'order':[['id',_0x433a('0x4')]],'limit':0x1},'log':_0x433a('0x3')});}; \ No newline at end of file +var _0xaa7c=['../client','CreateChatQueueReport','update','Request','UpdateChatQueueReport','DESC'];(function(_0x1820df,_0x4bf574){var _0x27f090=function(_0x1c949f){while(--_0x1c949f){_0x1820df['push'](_0x1820df['shift']());}};_0x27f090(++_0x4bf574);}(_0xaa7c,0x1ec));var _0xcaa7=function(_0x167c5b,_0x32f06d){_0x167c5b=_0x167c5b-0x0;var _0x8b3368=_0xaa7c[_0x167c5b];return _0x8b3368;};'use strict';var client=require(_0xcaa7('0x0'));exports['create']=function(_0x564e4c){return client['Request']('CreateChatQueueReport',{'body':_0x564e4c,'log':_0xcaa7('0x1')});};exports[_0xcaa7('0x2')]=function(_0x4f837e,_0xd4ca36){return client[_0xcaa7('0x3')](_0xcaa7('0x4'),{'body':_0xd4ca36,'options':{'where':{'uniqueid':_0x4f837e},'order':[['id',_0xcaa7('0x5')]],'limit':0x1},'log':_0xcaa7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 39da4d1..15b0902 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 _0x6913=['Request','updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','update'];(function(_0x287957,_0x5909af){var _0x53b245=function(_0x274bee){while(--_0x274bee){_0x287957['push'](_0x287957['shift']());}};_0x53b245(++_0x5909af);}(_0x6913,0x16d));var _0x3691=function(_0x10d610,_0x293b5b){_0x10d610=_0x10d610-0x0;var _0x15b3ba=_0x6913[_0x10d610];return _0x15b3ba;};'use strict';var client=require('../client');exports[_0x3691('0x0')]=function(_0x466743,_0x4a5135){return client[_0x3691('0x1')]('UpdateFaxInteraction',{'body':_0x4a5135,'options':{'where':{'id':_0x466743}},'log':_0x3691('0x2')});};exports[_0x3691('0x3')]=function(_0x2347d2,_0x5898fc){return client[_0x3691('0x1')](_0x3691('0x4'),{'body':_0x5898fc,'options':{'where':{'id':_0x2347d2}},'log':_0x3691('0x5')});}; \ No newline at end of file +var _0x012e=['Request','UpdateFaxInteraction','updateFaxInteraction','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update'];(function(_0x4dd4b0,_0x45921e){var _0x8eccfe=function(_0x437fc5){while(--_0x437fc5){_0x4dd4b0['push'](_0x4dd4b0['shift']());}};_0x8eccfe(++_0x45921e);}(_0x012e,0x147));var _0xe012=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x012e[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0xe012('0x0'));exports[_0xe012('0x1')]=function(_0x8454a6,_0xe3e71d){return client[_0xe012('0x2')](_0xe012('0x3'),{'body':_0xe3e71d,'options':{'where':{'id':_0x8454a6}},'log':_0xe012('0x4')});};exports['addTags']=function(_0x802203,_0x349800){return client[_0xe012('0x2')](_0xe012('0x5'),{'body':_0x349800,'options':{'where':{'id':_0x802203}},'log':_0xe012('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 3395612..eab57d3 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 _0x21f2=['../client','create','CreateFaxMessage'];(function(_0x5d3a12,_0x7a300e){var _0x2f70f3=function(_0x15d4c0){while(--_0x15d4c0){_0x5d3a12['push'](_0x5d3a12['shift']());}};_0x2f70f3(++_0x7a300e);}(_0x21f2,0xe7));var _0x221f=function(_0x3b6859,_0x47b309){_0x3b6859=_0x3b6859-0x0;var _0xd24583=_0x21f2[_0x3b6859];return _0xd24583;};'use strict';var client=require(_0x221f('0x0'));exports[_0x221f('0x1')]=function(_0x48f9e5){return client['Request'](_0x221f('0x2'),{'body':_0x48f9e5,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x7b29=['createFaxMessage','../client','CreateFaxMessage'];(function(_0x4e158a,_0x31b81e){var _0x168261=function(_0xdfa847){while(--_0xdfa847){_0x4e158a['push'](_0x4e158a['shift']());}};_0x168261(++_0x31b81e);}(_0x7b29,0x13c));var _0x97b2=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x7b29[_0x126558];return _0x1f6d14;};'use strict';var client=require(_0x97b2('0x0'));exports['create']=function(_0x2dd411){return client['Request'](_0x97b2('0x1'),{'body':_0x2dd411,'log':_0x97b2('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index bd51b4a..fb20b52 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 _0x230b=['Agents','online','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x230b,0x1a3));var _0xb230=function(_0x2dba02,_0xb6504f){_0x2dba02=_0x2dba02-0x0;var _0x29a7cf=_0x230b[_0x2dba02];return _0x29a7cf;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0xb230('0x0')](_0xb230('0x1'),{'options':{'raw':![],'attributes':['id',_0xb230('0x2'),_0xb230('0x3'),_0xb230('0x4')],'include':[{'model':'User','as':_0xb230('0x5'),'attributes':['id',_0xb230('0x2'),_0xb230('0x6'),'faxPause']}]},'log':_0xb230('0x7')});};}; \ No newline at end of file +var _0x7f17=['faxPause','getFaxQueues','Request','GetFaxQueue','name','timeout','User','Agents','online'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0x7f17,0x1f0));var _0x77f1=function(_0x213aac,_0x30117f){_0x213aac=_0x213aac-0x0;var _0x20bc6f=_0x7f17[_0x213aac];return _0x20bc6f;};'use strict';var client=require('../client');exports[_0x77f1('0x0')]=function(){return function(){return client[_0x77f1('0x1')](_0x77f1('0x2'),{'options':{'raw':![],'attributes':['id',_0x77f1('0x3'),_0x77f1('0x4'),'strategy'],'include':[{'model':_0x77f1('0x5'),'as':_0x77f1('0x6'),'attributes':['id',_0x77f1('0x3'),_0x77f1('0x7'),_0x77f1('0x8')]}]},'log':_0x77f1('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 4c51f23..565e9e5 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 _0x5b47=['create','Request','CreateFaxQueueReport','UpdateFaxQueueReport','DESC'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5b47,0x11d));var _0x75b4=function(_0x4e6003,_0x12bc78){_0x4e6003=_0x4e6003-0x0;var _0x52fb2e=_0x5b47[_0x4e6003];return _0x52fb2e;};'use strict';var client=require('../client');exports[_0x75b4('0x0')]=function(_0x38b4ff){return client[_0x75b4('0x1')](_0x75b4('0x2'),{'body':_0x38b4ff,'log':_0x75b4('0x2')});};exports['update']=function(_0x17874d,_0x4fede5){return client[_0x75b4('0x1')](_0x75b4('0x3'),{'body':_0x4fede5,'options':{'where':{'uniqueid':_0x17874d},'order':[['id',_0x75b4('0x4')]],'limit':0x1},'log':_0x75b4('0x3')});}; \ No newline at end of file +var _0x5b4b=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','Request'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0x5b4b,0xdb));var _0xb5b4=function(_0x2676e8,_0x392259){_0x2676e8=_0x2676e8-0x0;var _0x17a24b=_0x5b4b[_0x2676e8];return _0x17a24b;};'use strict';var client=require('../client');exports['create']=function(_0x41155e){return client[_0xb5b4('0x0')](_0xb5b4('0x1'),{'body':_0x41155e,'log':'CreateFaxQueueReport'});};exports[_0xb5b4('0x2')]=function(_0x54b313,_0x38e56a){return client['Request'](_0xb5b4('0x3'),{'body':_0x38e56a,'options':{'where':{'uniqueid':_0x54b313},'order':[['id',_0xb5b4('0x4')]],'limit':0x1},'log':_0xb5b4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index b89b911..5d73c5c 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(_0x11da30,_0x407461){var _0x252c22=function(_0x426db7){while(--_0x426db7){_0x11da30['push'](_0x11da30['shift']());}};_0x252c22(++_0x407461);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x2f3dfa,_0x40bce2){_0x2f3dfa=_0x2f3dfa-0x0;var _0x30f3de=_0x1d2d[_0x2f3dfa];return _0x30f3de;};'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 _0xb03e=['interval','getIntervals','Request','GetInterval','name','Interval','Intervals'];(function(_0x3cfa1f,_0x32b4ab){var _0x11a72b=function(_0x9ce418){while(--_0x9ce418){_0x3cfa1f['push'](_0x3cfa1f['shift']());}};_0x11a72b(++_0x32b4ab);}(_0xb03e,0x1eb));var _0xeb03=function(_0x2c07ab,_0x424407){_0x2c07ab=_0x2c07ab-0x0;var _0x7dd727=_0xb03e[_0x2c07ab];return _0x7dd727;};'use strict';var client=require('../client');exports[_0xeb03('0x0')]=function(){return function(){return client[_0xeb03('0x1')](_0xeb03('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xeb03('0x3')],'include':[{'model':_0xeb03('0x4'),'as':_0xeb03('0x5'),'attributes':['id',_0xeb03('0x3'),_0xeb03('0x6')]}]},'log':_0xeb03('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 70ca941..f29a2cb 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 _0x9658=['Request','AddTagsToMailInteraction','addTagsToChatInteraction','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x3e0763,_0x3d12be){var _0x351ca2=function(_0x9beae7){while(--_0x9beae7){_0x3e0763['push'](_0x3e0763['shift']());}};_0x351ca2(++_0x3d12be);}(_0x9658,0x11d));var _0x8965=function(_0x337a10,_0x5191c7){_0x337a10=_0x337a10-0x0;var _0x575f98=_0x9658[_0x337a10];return _0x575f98;};'use strict';var client=require('../client');exports['update']=function(_0x28efc3,_0x1ec221){return client['Request'](_0x8965('0x0'),{'body':_0x1ec221,'options':{'where':{'id':_0x28efc3}},'log':_0x8965('0x1')});};exports[_0x8965('0x2')]=function(_0x3136c1,_0x278ab1){return client[_0x8965('0x3')](_0x8965('0x4'),{'body':_0x278ab1,'options':{'where':{'id':_0x3136c1}},'log':_0x8965('0x5')});}; \ No newline at end of file +var _0xef3e=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','UpdateMailInteraction'];(function(_0x4ac890,_0x4c9a1a){var _0x7be2e0=function(_0x4ad586){while(--_0x4ad586){_0x4ac890['push'](_0x4ac890['shift']());}};_0x7be2e0(++_0x4c9a1a);}(_0xef3e,0x17a));var _0xeef3=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xef3e[_0x160c73];return _0xd9302;};'use strict';var client=require(_0xeef3('0x0'));exports['update']=function(_0x196553,_0x2da0ff){return client['Request'](_0xeef3('0x1'),{'body':_0x2da0ff,'options':{'where':{'id':_0x196553}},'log':'updateMailInteraction'});};exports[_0xeef3('0x2')]=function(_0x16c4d5,_0x258d00){return client['Request'](_0xeef3('0x3'),{'body':_0x258d00,'options':{'where':{'id':_0x16c4d5}},'log':_0xeef3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 1277530..284b50b 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 _0x4f0f=['create','Request','CreateMailMessage','createMailMessage'];(function(_0x259c39,_0x2e4cb9){var _0x2ab027=function(_0x833995){while(--_0x833995){_0x259c39['push'](_0x259c39['shift']());}};_0x2ab027(++_0x2e4cb9);}(_0x4f0f,0xc4));var _0xf4f0=function(_0x516875,_0x44b996){_0x516875=_0x516875-0x0;var _0x1fda16=_0x4f0f[_0x516875];return _0x1fda16;};'use strict';var client=require('../client');exports[_0xf4f0('0x0')]=function(_0x12b38d){return client[_0xf4f0('0x1')](_0xf4f0('0x2'),{'body':_0x12b38d,'log':_0xf4f0('0x3')});}; \ No newline at end of file +var _0x9f9c=['create','Request','../client'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x9f9c,0xb3));var _0xc9f9=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x9f9c[_0x178e48];return _0x440d7e;};'use strict';var client=require(_0xc9f9('0x0'));exports[_0xc9f9('0x1')]=function(_0x3ec1bb){return client[_0xc9f9('0x2')]('CreateMailMessage',{'body':_0x3ec1bb,'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 9de5ed5..e9e2125 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 _0x2941=['getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents','mailPause','../client'];(function(_0x304df4,_0x1fa493){var _0x577618=function(_0x5f3aa3){while(--_0x5f3aa3){_0x304df4['push'](_0x304df4['shift']());}};_0x577618(++_0x1fa493);}(_0x2941,0x9f));var _0x1294=function(_0x5b7ccf,_0x2f1b30){_0x5b7ccf=_0x5b7ccf-0x0;var _0x1db839=_0x2941[_0x5b7ccf];return _0x1db839;};'use strict';var client=require(_0x1294('0x0'));exports[_0x1294('0x1')]=function(){return function(){return client[_0x1294('0x2')](_0x1294('0x3'),{'options':{'raw':![],'attributes':['id',_0x1294('0x4'),_0x1294('0x5'),_0x1294('0x6')],'include':[{'model':_0x1294('0x7'),'as':_0x1294('0x8'),'attributes':['id',_0x1294('0x4'),'online',_0x1294('0x9')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x15ce=['GetMailQueue','name','timeout','strategy','User','online','mailPause','../client','getMailQueues','Request'];(function(_0x3f25c4,_0x7d5eb5){var _0x2b213d=function(_0x4d0381){while(--_0x4d0381){_0x3f25c4['push'](_0x3f25c4['shift']());}};_0x2b213d(++_0x7d5eb5);}(_0x15ce,0x1a1));var _0xe15c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x15ce[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xe15c('0x0'));exports[_0xe15c('0x1')]=function(){return function(){return client[_0xe15c('0x2')](_0xe15c('0x3'),{'options':{'raw':![],'attributes':['id',_0xe15c('0x4'),_0xe15c('0x5'),_0xe15c('0x6')],'include':[{'model':_0xe15c('0x7'),'as':'Agents','attributes':['id',_0xe15c('0x4'),_0xe15c('0x8'),_0xe15c('0x9')]}]},'log':_0xe15c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index bf38f79..8a8352e 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 _0x8b34=['CreateMailQueueReport','update','Request','UpdateMailQueueReport'];(function(_0x1c5385,_0x3aba1a){var _0x478ddb=function(_0x7ca4a6){while(--_0x7ca4a6){_0x1c5385['push'](_0x1c5385['shift']());}};_0x478ddb(++_0x3aba1a);}(_0x8b34,0x188));var _0x48b3=function(_0x35eeee,_0x352b5a){_0x35eeee=_0x35eeee-0x0;var _0x4a8cca=_0x8b34[_0x35eeee];return _0x4a8cca;};'use strict';var client=require('../client');exports['create']=function(_0x5f6437){return client['Request'](_0x48b3('0x0'),{'body':_0x5f6437,'log':_0x48b3('0x0')});};exports[_0x48b3('0x1')]=function(_0x4d016a,_0x4d2f1d){return client[_0x48b3('0x2')](_0x48b3('0x3'),{'body':_0x4d2f1d,'options':{'where':{'uniqueid':_0x4d016a},'order':[['id','DESC']],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xecfc=['DESC','../client','Request','update','UpdateMailQueueReport'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0xecfc,0x164));var _0xcecf=function(_0x22843f,_0x58787b){_0x22843f=_0x22843f-0x0;var _0x3b27df=_0xecfc[_0x22843f];return _0x3b27df;};'use strict';var client=require(_0xcecf('0x0'));exports['create']=function(_0x329e2c){return client[_0xcecf('0x1')]('CreateMailQueueReport',{'body':_0x329e2c,'log':'CreateMailQueueReport'});};exports[_0xcecf('0x2')]=function(_0x2f581a,_0x34acd8){return client[_0xcecf('0x1')](_0xcecf('0x3'),{'body':_0x34acd8,'options':{'where':{'uniqueid':_0x2f581a},'order':[['id',_0xcecf('0x4')]],'limit':0x1},'log':_0xcecf('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index f21f73a..72d10c7 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 _0x03b9=['AddTagsToOpenchannelInteraction','../client','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x24472a,_0x473b74){var _0x473ea6=function(_0x2d5109){while(--_0x2d5109){_0x24472a['push'](_0x24472a['shift']());}};_0x473ea6(++_0x473b74);}(_0x03b9,0x1c3));var _0x903b=function(_0x2b3b64,_0x1e7590){_0x2b3b64=_0x2b3b64-0x0;var _0x3b58ba=_0x03b9[_0x2b3b64];return _0x3b58ba;};'use strict';var client=require(_0x903b('0x0'));exports['update']=function(_0x115e7d,_0x4153fc){return client[_0x903b('0x1')](_0x903b('0x2'),{'body':_0x4153fc,'options':{'where':{'id':_0x115e7d}},'log':_0x903b('0x3')});};exports[_0x903b('0x4')]=function(_0x1a4abe,_0xabbc70){return client[_0x903b('0x1')](_0x903b('0x5'),{'body':_0xabbc70,'options':{'where':{'id':_0x1a4abe}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x208f=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x2c88c8,_0x4a71e6){var _0x320739=function(_0x21c85d){while(--_0x21c85d){_0x2c88c8['push'](_0x2c88c8['shift']());}};_0x320739(++_0x4a71e6);}(_0x208f,0xa6));var _0xf208=function(_0x19d17a,_0x178c40){_0x19d17a=_0x19d17a-0x0;var _0x27780c=_0x208f[_0x19d17a];return _0x27780c;};'use strict';var client=require(_0xf208('0x0'));exports[_0xf208('0x1')]=function(_0x1bbb6d,_0x270ace){return client[_0xf208('0x2')](_0xf208('0x3'),{'body':_0x270ace,'options':{'where':{'id':_0x1bbb6d}},'log':_0xf208('0x4')});};exports[_0xf208('0x5')]=function(_0x187ed7,_0x165d6a){return client[_0xf208('0x2')](_0xf208('0x6'),{'body':_0x165d6a,'options':{'where':{'id':_0x187ed7}},'log':_0xf208('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 513b87e..22e38ec 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 _0xb43b=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb43b,0x1b2));var _0xbb43=function(_0x17d944,_0x174b32){_0x17d944=_0x17d944-0x0;var _0x4ef27b=_0xb43b[_0x17d944];return _0x4ef27b;};'use strict';var client=require(_0xbb43('0x0'));exports[_0xbb43('0x1')]=function(_0x5c45dd){return client[_0xbb43('0x2')](_0xbb43('0x3'),{'body':_0x5c45dd,'log':_0xbb43('0x4')});}; \ No newline at end of file +var _0xb43b=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb43b,0x1b2));var _0xbb43=function(_0x757ea8,_0x37b493){_0x757ea8=_0x757ea8-0x0;var _0x302355=_0xb43b[_0x757ea8];return _0x302355;};'use strict';var client=require(_0xbb43('0x0'));exports[_0xbb43('0x1')]=function(_0x5c45dd){return client[_0xbb43('0x2')](_0xbb43('0x3'),{'body':_0x5c45dd,'log':_0xbb43('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 268f1df..d9163ae 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 _0x5aea=['Request','GetOpenchannelQueue','timeout','strategy','User','Agents','name','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0x416326,_0xd2abb0){var _0xa70bf5=function(_0x2a2d1b){while(--_0x2a2d1b){_0x416326['push'](_0x416326['shift']());}};_0xa70bf5(++_0xd2abb0);}(_0x5aea,0x98));var _0xa5ae=function(_0x1e2234,_0x2dd55c){_0x1e2234=_0x1e2234-0x0;var _0x183a42=_0x5aea[_0x1e2234];return _0x183a42;};'use strict';var client=require(_0xa5ae('0x0'));exports[_0xa5ae('0x1')]=function(){return function(){return client[_0xa5ae('0x2')](_0xa5ae('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xa5ae('0x4'),_0xa5ae('0x5')],'include':[{'model':_0xa5ae('0x6'),'as':_0xa5ae('0x7'),'attributes':['id',_0xa5ae('0x8'),_0xa5ae('0x9'),_0xa5ae('0xa')]}]},'log':_0xa5ae('0x1')});};}; \ No newline at end of file +var _0xa526=['timeout','strategy','User','Agents','name','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa526,0x130));var _0x6a52=function(_0x5575cd,_0x73ab7a){_0x5575cd=_0x5575cd-0x0;var _0x4979a0=_0xa526[_0x5575cd];return _0x4979a0;};'use strict';var client=require(_0x6a52('0x0'));exports[_0x6a52('0x1')]=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name',_0x6a52('0x2'),_0x6a52('0x3')],'include':[{'model':_0x6a52('0x4'),'as':_0x6a52('0x5'),'attributes':['id',_0x6a52('0x6'),_0x6a52('0x7'),_0x6a52('0x8')]}]},'log':_0x6a52('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 329a8c2..9966526 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 _0x0222=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x0222,0x121));var _0x2022=function(_0x2d9326,_0x40a59c){_0x2d9326=_0x2d9326-0x0;var _0x2eaf26=_0x0222[_0x2d9326];return _0x2eaf26;};'use strict';var client=require(_0x2022('0x0'));exports['create']=function(_0x4973d3){return client['Request'](_0x2022('0x1'),{'body':_0x4973d3,'log':_0x2022('0x1')});};exports[_0x2022('0x2')]=function(_0x32706,_0x5adaba){return client['Request'](_0x2022('0x3'),{'body':_0x5adaba,'options':{'where':{'uniqueid':_0x32706},'order':[['id',_0x2022('0x4')]],'limit':0x1},'log':_0x2022('0x3')});}; \ No newline at end of file +var _0x33ff=['update','UpdateOpenchannelQueueReport','DESC','../client','Request','CreateOpenchannelQueueReport'];(function(_0x2e7087,_0x112eec){var _0xb5b3a6=function(_0x296310){while(--_0x296310){_0x2e7087['push'](_0x2e7087['shift']());}};_0xb5b3a6(++_0x112eec);}(_0x33ff,0xf3));var _0xf33f=function(_0x447f6d,_0x36fc29){_0x447f6d=_0x447f6d-0x0;var _0x56a9b8=_0x33ff[_0x447f6d];return _0x56a9b8;};'use strict';var client=require(_0xf33f('0x0'));exports['create']=function(_0xee827c){return client[_0xf33f('0x1')](_0xf33f('0x2'),{'body':_0xee827c,'log':_0xf33f('0x2')});};exports[_0xf33f('0x3')]=function(_0x2557f2,_0x439eec){return client['Request'](_0xf33f('0x4'),{'body':_0x439eec,'options':{'where':{'uniqueid':_0x2557f2},'order':[['id',_0xf33f('0x5')]],'limit':0x1},'log':_0xf33f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index e10d7f7..5cb6202 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 _0xa6ee=['UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','../client','update'];(function(_0x18bfca,_0x5efe70){var _0xe8b18b=function(_0x20ff83){while(--_0x20ff83){_0x18bfca['push'](_0x18bfca['shift']());}};_0xe8b18b(++_0x5efe70);}(_0xa6ee,0x1ed));var _0xea6e=function(_0x546dc5,_0xbc1195){_0x546dc5=_0x546dc5-0x0;var _0x176ee9=_0xa6ee[_0x546dc5];return _0x176ee9;};'use strict';var client=require(_0xea6e('0x0'));exports[_0xea6e('0x1')]=function(_0x5756f4,_0x52ea0d){return client['Request'](_0xea6e('0x2'),{'body':_0x52ea0d,'options':{'where':{'id':_0x5756f4}},'log':'updateSmsInteraction'});};exports[_0xea6e('0x3')]=function(_0x106312,_0x5bb9d8){return client['Request'](_0xea6e('0x4'),{'body':_0x5bb9d8,'options':{'where':{'id':_0x106312}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x94c1=['AddTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0xa15d3,_0x585c76){var _0x225fd7=function(_0x1e7f90){while(--_0x1e7f90){_0xa15d3['push'](_0xa15d3['shift']());}};_0x225fd7(++_0x585c76);}(_0x94c1,0x8d));var _0x194c=function(_0x5136b6,_0x2f05b9){_0x5136b6=_0x5136b6-0x0;var _0x2c000b=_0x94c1[_0x5136b6];return _0x2c000b;};'use strict';var client=require(_0x194c('0x0'));exports[_0x194c('0x1')]=function(_0x882e37,_0x212086){return client[_0x194c('0x2')](_0x194c('0x3'),{'body':_0x212086,'options':{'where':{'id':_0x882e37}},'log':_0x194c('0x4')});};exports[_0x194c('0x5')]=function(_0x7a1394,_0x5c869e){return client[_0x194c('0x2')](_0x194c('0x6'),{'body':_0x5c869e,'options':{'where':{'id':_0x7a1394}},'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 7b4d74a..206b90a 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 _0xee8e=['createSmsMessage','create','CreateSmsMessage'];(function(_0x40e1ef,_0x224045){var _0x3067e2=function(_0x8a2880){while(--_0x8a2880){_0x40e1ef['push'](_0x40e1ef['shift']());}};_0x3067e2(++_0x224045);}(_0xee8e,0x106));var _0xeee8=function(_0x208373,_0x36b626){_0x208373=_0x208373-0x0;var _0x1dfcca=_0xee8e[_0x208373];return _0x1dfcca;};'use strict';var client=require('../client');exports[_0xeee8('0x0')]=function(_0x3e32f4){return client['Request'](_0xeee8('0x1'),{'body':_0x3e32f4,'log':_0xeee8('0x2')});}; \ No newline at end of file +var _0xbb31=['CreateSmsMessage','createSmsMessage','Request'];(function(_0x234a8e,_0x3ffff9){var _0x291a0b=function(_0x100547){while(--_0x100547){_0x234a8e['push'](_0x234a8e['shift']());}};_0x291a0b(++_0x3ffff9);}(_0xbb31,0x1d6));var _0x1bb3=function(_0x4be2ef,_0x155aa7){_0x4be2ef=_0x4be2ef-0x0;var _0x4db7e0=_0xbb31[_0x4be2ef];return _0x4db7e0;};'use strict';var client=require('../client');exports['create']=function(_0x1b0b6c){return client[_0x1bb3('0x0')](_0x1bb3('0x1'),{'body':_0x1b0b6c,'log':_0x1bb3('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 133eb9d..143f300 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 _0x94ff=['timeout','online','smsPause','../client','getSmsQueues','Request','GetSmsQueue','name'];(function(_0x2491e4,_0x5e8f9c){var _0x49244a=function(_0x4d630e){while(--_0x4d630e){_0x2491e4['push'](_0x2491e4['shift']());}};_0x49244a(++_0x5e8f9c);}(_0x94ff,0x83));var _0xf94f=function(_0x47564a,_0x3f6670){_0x47564a=_0x47564a-0x0;var _0x4f1707=_0x94ff[_0x47564a];return _0x4f1707;};'use strict';var client=require(_0xf94f('0x0'));exports[_0xf94f('0x1')]=function(){return function(){return client[_0xf94f('0x2')](_0xf94f('0x3'),{'options':{'raw':![],'attributes':['id',_0xf94f('0x4'),_0xf94f('0x5'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0xf94f('0x4'),_0xf94f('0x6'),_0xf94f('0x7')]}]},'log':_0xf94f('0x1')});};}; \ No newline at end of file +var _0xadf6=['../client','getSmsQueues','Request','name','timeout','User','Agents','online'];(function(_0xf7a9cf,_0x2cfa33){var _0x7fdc45=function(_0x44b354){while(--_0x44b354){_0xf7a9cf['push'](_0xf7a9cf['shift']());}};_0x7fdc45(++_0x2cfa33);}(_0xadf6,0x78));var _0x6adf=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xadf6[_0x9aada2];return _0x196dff;};'use strict';var client=require(_0x6adf('0x0'));exports[_0x6adf('0x1')]=function(){return function(){return client[_0x6adf('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6adf('0x3'),_0x6adf('0x4'),'strategy'],'include':[{'model':_0x6adf('0x5'),'as':_0x6adf('0x6'),'attributes':['id','name',_0x6adf('0x7'),'smsPause']}]},'log':_0x6adf('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 305c9de..894a074 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 _0xc65d=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x34ecd4,_0x3f9685){var _0x224c67=function(_0x19280b){while(--_0x19280b){_0x34ecd4['push'](_0x34ecd4['shift']());}};_0x224c67(++_0x3f9685);}(_0xc65d,0xba));var _0xdc65=function(_0x42d064,_0x5e7bde){_0x42d064=_0x42d064-0x0;var _0x3691ee=_0xc65d[_0x42d064];return _0x3691ee;};'use strict';var client=require('../client');exports[_0xdc65('0x0')]=function(_0x2a8fa5){return client[_0xdc65('0x1')](_0xdc65('0x2'),{'body':_0x2a8fa5,'log':_0xdc65('0x2')});};exports[_0xdc65('0x3')]=function(_0x5bd435,_0xedebe3){return client['Request'](_0xdc65('0x4'),{'body':_0xedebe3,'options':{'where':{'uniqueid':_0x5bd435},'order':[['id',_0xdc65('0x5')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x5c82=['UpdateSmsQueueReport','DESC','../client','create','Request','CreateSmsQueueReport','update'];(function(_0x45e836,_0x541164){var _0x527ce7=function(_0x1911d5){while(--_0x1911d5){_0x45e836['push'](_0x45e836['shift']());}};_0x527ce7(++_0x541164);}(_0x5c82,0x198));var _0x25c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c82[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x25c8('0x0'));exports[_0x25c8('0x1')]=function(_0x3c64df){return client[_0x25c8('0x2')](_0x25c8('0x3'),{'body':_0x3c64df,'log':_0x25c8('0x3')});};exports[_0x25c8('0x4')]=function(_0x2dced6,_0x3167d2){return client[_0x25c8('0x2')](_0x25c8('0x5'),{'body':_0x3167d2,'options':{'where':{'uniqueid':_0x2dced6},'order':[['id',_0x25c8('0x6')]],'limit':0x1},'log':_0x25c8('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index aacfe4b..d9bbe6a 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 _0xda28=['smsCapacity','openchannelCapacity','getAgents','../client','Request','GetUser','agent','name','online','pauseType','voicePause','chatPause','faxPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity'];(function(_0x1706d7,_0x525d2e){var _0xf339d0=function(_0x88afa9){while(--_0x88afa9){_0x1706d7['push'](_0x1706d7['shift']());}};_0xf339d0(++_0x525d2e);}(_0xda28,0x135));var _0x8da2=function(_0x42694d,_0x1907b6){_0x42694d=_0x42694d-0x0;var _0x23a8b9=_0xda28[_0x42694d];return _0x23a8b9;};'use strict';var client=require(_0x8da2('0x0'));exports['getAgents']=function(){return function(){return client[_0x8da2('0x1')](_0x8da2('0x2'),{'options':{'raw':!![],'where':{'role':_0x8da2('0x3')},'attributes':['id',_0x8da2('0x4'),_0x8da2('0x5'),_0x8da2('0x6'),'lastPauseAt',_0x8da2('0x7'),_0x8da2('0x8'),'mailPause',_0x8da2('0x9'),'smsPause',_0x8da2('0xa'),_0x8da2('0xb'),_0x8da2('0xc'),_0x8da2('0xd'),_0x8da2('0xe'),_0x8da2('0xf'),'whatsappCapacity',_0x8da2('0x10')]},'log':_0x8da2('0x11')});};}; \ No newline at end of file +var _0x0fd9=['Request','GetUser','name','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents'];(function(_0x47bb30,_0x544ca6){var _0x5c552e=function(_0x258208){while(--_0x258208){_0x47bb30['push'](_0x47bb30['shift']());}};_0x5c552e(++_0x544ca6);}(_0x0fd9,0x11e));var _0x90fd=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x0fd9[_0x2d34d6];return _0x1d3d12;};'use strict';var client=require(_0x90fd('0x0'));exports[_0x90fd('0x1')]=function(){return function(){return client[_0x90fd('0x2')](_0x90fd('0x3'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x90fd('0x4'),'online','pauseType','lastPauseAt',_0x90fd('0x5'),_0x90fd('0x6'),'mailPause',_0x90fd('0x7'),_0x90fd('0x8'),'whatsappPause',_0x90fd('0x9'),_0x90fd('0xa'),_0x90fd('0xb'),_0x90fd('0xc'),_0x90fd('0xd'),_0x90fd('0xe'),_0x90fd('0xf')]},'log':_0x90fd('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index ae3f3fb..f56b7aa 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 _0x3036=['updateWhatsappInteraction','addTagsToWhatsappInteraction','Request'];(function(_0x3b2855,_0x259dae){var _0x9d2dc1=function(_0x305f42){while(--_0x305f42){_0x3b2855['push'](_0x3b2855['shift']());}};_0x9d2dc1(++_0x259dae);}(_0x3036,0x1a9));var _0x6303=function(_0x3ddf06,_0x367b64){_0x3ddf06=_0x3ddf06-0x0;var _0x522c01=_0x3036[_0x3ddf06];return _0x522c01;};'use strict';var client=require('../client');exports['update']=function(_0x7aa5f9,_0xd38168){return client[_0x6303('0x0')]('UpdateWhatsappInteraction',{'body':_0xd38168,'options':{'where':{'id':_0x7aa5f9}},'log':_0x6303('0x1')});};exports['addTags']=function(_0x48aa0c,_0x4d040b){return client[_0x6303('0x0')]('AddTagsToWhatsappInteraction',{'body':_0x4d040b,'options':{'where':{'id':_0x48aa0c}},'log':_0x6303('0x2')});}; \ No newline at end of file +var _0xa8eb=['updateWhatsappInteraction','AddTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8eb,0x179));var _0xba8e=function(_0x2ad313,_0x1bde39){_0x2ad313=_0x2ad313-0x0;var _0x2061f7=_0xa8eb[_0x2ad313];return _0x2061f7;};'use strict';var client=require(_0xba8e('0x0'));exports['update']=function(_0x26595f,_0x5757ad){return client[_0xba8e('0x1')](_0xba8e('0x2'),{'body':_0x5757ad,'options':{'where':{'id':_0x26595f}},'log':_0xba8e('0x3')});};exports['addTags']=function(_0x353df2,_0x368ce6){return client['Request'](_0xba8e('0x4'),{'body':_0x368ce6,'options':{'where':{'id':_0x353df2}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 2629562..fbb7518 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 _0xf7b0=['createWhatsappMessage','../client','Request'];(function(_0x4592c1,_0x42da6c){var _0x207a18=function(_0x1aaefc){while(--_0x1aaefc){_0x4592c1['push'](_0x4592c1['shift']());}};_0x207a18(++_0x42da6c);}(_0xf7b0,0x82));var _0x0f7b=function(_0x50391e,_0x977121){_0x50391e=_0x50391e-0x0;var _0x2de2e5=_0xf7b0[_0x50391e];return _0x2de2e5;};'use strict';var client=require(_0x0f7b('0x0'));exports['create']=function(_0x21a027){return client[_0x0f7b('0x1')]('CreateWhatsappMessage',{'body':_0x21a027,'log':_0x0f7b('0x2')});}; \ No newline at end of file +var _0xfb63=['CreateWhatsappMessage','createWhatsappMessage','Request'];(function(_0x390f31,_0x351a9c){var _0x46e2d9=function(_0x27165b){while(--_0x27165b){_0x390f31['push'](_0x390f31['shift']());}};_0x46e2d9(++_0x351a9c);}(_0xfb63,0x1af));var _0x3fb6=function(_0x148b53,_0x2d1d80){_0x148b53=_0x148b53-0x0;var _0x2d8d30=_0xfb63[_0x148b53];return _0x2d8d30;};'use strict';var client=require('../client');exports['create']=function(_0x38f169){return client[_0x3fb6('0x0')](_0x3fb6('0x1'),{'body':_0x38f169,'log':_0x3fb6('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 14fb367..34cb95c 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 _0x44a3=['timeout','strategy','User','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x44a3,0x1a9));var _0x344a=function(_0x3b8c97,_0x55e350){_0x3b8c97=_0x3b8c97-0x0;var _0x2d94e1=_0x44a3[_0x3b8c97];return _0x2d94e1;};'use strict';var client=require(_0x344a('0x0'));exports[_0x344a('0x1')]=function(){return function(){return client[_0x344a('0x2')](_0x344a('0x3'),{'options':{'raw':![],'attributes':['id',_0x344a('0x4'),_0x344a('0x5'),_0x344a('0x6')],'include':[{'model':_0x344a('0x7'),'as':'Agents','attributes':['id',_0x344a('0x4'),_0x344a('0x8'),_0x344a('0x9')]}]},'log':_0x344a('0x1')});};}; \ No newline at end of file +var _0x878f=['whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','online'];(function(_0x43e62e,_0x42f4fb){var _0x501114=function(_0x53ecfb){while(--_0x53ecfb){_0x43e62e['push'](_0x43e62e['shift']());}};_0x501114(++_0x42f4fb);}(_0x878f,0x173));var _0xf878=function(_0x55d981,_0x2c22ec){_0x55d981=_0x55d981-0x0;var _0x28542e=_0x878f[_0x55d981];return _0x28542e;};'use strict';var client=require('../client');exports[_0xf878('0x0')]=function(){return function(){return client[_0xf878('0x1')](_0xf878('0x2'),{'options':{'raw':![],'attributes':['id',_0xf878('0x3'),_0xf878('0x4'),_0xf878('0x5')],'include':[{'model':_0xf878('0x6'),'as':_0xf878('0x7'),'attributes':['id',_0xf878('0x3'),_0xf878('0x8'),_0xf878('0x9')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index e16eb7f..eabe95b 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 _0x1991=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1991,0x108));var _0x1199=function(_0x4a4e87,_0xa8501f){_0x4a4e87=_0x4a4e87-0x0;var _0x54716c=_0x1991[_0x4a4e87];return _0x54716c;};'use strict';var client=require(_0x1199('0x0'));exports[_0x1199('0x1')]=function(_0x16a353){return client[_0x1199('0x2')](_0x1199('0x3'),{'body':_0x16a353,'log':_0x1199('0x3')});};exports[_0x1199('0x4')]=function(_0x54fd83,_0x5be4fc){return client[_0x1199('0x2')](_0x1199('0x5'),{'body':_0x5be4fc,'options':{'where':{'uniqueid':_0x54fd83},'order':[['id',_0x1199('0x6')]],'limit':0x1},'log':_0x1199('0x5')});}; \ No newline at end of file +var _0xa606=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0xd9098d,_0x3707c7){var _0x474f24=function(_0x5edadd){while(--_0x5edadd){_0xd9098d['push'](_0xd9098d['shift']());}};_0x474f24(++_0x3707c7);}(_0xa606,0x8a));var _0x6a60=function(_0xc4ad36,_0x182bc9){_0xc4ad36=_0xc4ad36-0x0;var _0x5cc21e=_0xa606[_0xc4ad36];return _0x5cc21e;};'use strict';var client=require(_0x6a60('0x0'));exports[_0x6a60('0x1')]=function(_0x15b98f){return client[_0x6a60('0x2')]('CreateWhatsappQueueReport',{'body':_0x15b98f,'log':_0x6a60('0x3')});};exports[_0x6a60('0x4')]=function(_0x288a10,_0x31ea25){return client[_0x6a60('0x2')](_0x6a60('0x5'),{'body':_0x31ea25,'options':{'where':{'uniqueid':_0x288a10},'order':[['id',_0x6a60('0x6')]],'limit':0x1},'log':_0x6a60('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 2bdc1fc..21fea2f 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 _0xee77=['[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','timeout','createQueue','atimeout','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent'];(function(_0x5e8b64,_0x3b0ad7){var _0x57cf34=function(_0x261cda){while(--_0x261cda){_0x5e8b64['push'](_0x5e8b64['shift']());}};_0x57cf34(++_0x3b0ad7);}(_0xee77,0x15a));var _0x7ee7=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xee77[_0xaa0309];return _0x5de7ce;};'use strict';var schema=require(_0x7ee7('0x0'));var _=require('lodash');var util=require(_0x7ee7('0x1'));var seqqueue=require(_0x7ee7('0x2'));var logger=require(_0x7ee7('0x3'))(_0x7ee7('0x4'));var strategy=require(_0x7ee7('0x5'));var queue=schema({'name':{'type':_0x7ee7('0x6'),'required':!![],'message':_0x7ee7('0x7')},'timeout':{'type':_0x7ee7('0x8'),'message':_0x7ee7('0x9')}});function writeLog(_0xff9742,_0x2ba5b6,_0x342b98){return logger[_0x7ee7('0xa')](util['format'](_0x7ee7('0xb'),_0xff9742,_0x2ba5b6[_0x7ee7('0xc')],_0x342b98));}function handleFindAgent(_0x1fd1f0){return function(_0x663b5d){return _0x663b5d['name'][_0x7ee7('0xd')]()===_0x1fd1f0[_0x7ee7('0xd')]();};}exports[_0x7ee7('0xe')]=function(_0x5c1de6,_0x40cab2,_0x46f532,_0x4ea530){return function(_0x517789){try{var _0x437109={'name':_0x40cab2[0x0],'timeout':_0x40cab2[0x1]};var _0x1bdd8d=queue[_0x7ee7('0x0')](_0x437109,{'typecast':!![]});if(_0x1bdd8d[_0x7ee7('0xf')]){logger[_0x7ee7('0x10')](_0x7ee7('0x11'),_0x5c1de6,_[_0x7ee7('0x12')](_0x1bdd8d,_0x7ee7('0x13'))[_0x7ee7('0x14')](',\x20'));_0x517789[_0x7ee7('0x15')]();}else{var _0x2126ad=_['find'](_0x46f532['agents'],handleFindAgent(_0x437109['name']));if(_0x2126ad){var _0x3ef194=(_0x437109[_0x7ee7('0x16')]||0xa)*0x3e8;var _0x534f09,_0x5bfae4;var _0xf29c9b=seqqueue[_0x7ee7('0x17')](_0x3ef194);_0xf29c9b['id']=_0x5c1de6;_0xf29c9b[_0x7ee7('0x18')]=_0x3ef194;_0xf29c9b['channel']=_0x4ea530['channel'];writeLog(_0x5c1de6,_0x2126ad,util['format'](_0x7ee7('0x19'),_0x3ef194));_0x46f532[_0x7ee7('0x1a')][_0x5c1de6]['on'](_0x7ee7('0x1b'),function(){logger[_0x7ee7('0xa')](_0x7ee7('0x1c'),_0x5c1de6);clearTimeout(_0x5bfae4);_0x5bfae4=undefined;_0xf29c9b['close']();if(_0x46f532[_0x7ee7('0x1a')][_0x5c1de6]){delete _0x46f532[_0x7ee7('0x1a')][_0x5c1de6];}_0x517789[_0x7ee7('0x15')]();});_0x46f532[_0x7ee7('0x1a')][_0x5c1de6]['on'](_0x7ee7('0x1d'),function(){if(_0x46f532[_0x7ee7('0x1a')][_0x5c1de6]){delete _0x46f532[_0x7ee7('0x1a')][_0x5c1de6];}});_0x5bfae4=setTimeout(function(){logger[_0x7ee7('0xa')](_0x7ee7('0x1e'),_0x5c1de6);clearTimeout(_0x5bfae4);_0xf29c9b[_0x7ee7('0x1f')]();_0x517789[_0x7ee7('0x20')]();},_0x3ef194);strategy[_0x7ee7('0x21')](_0xf29c9b,_0x2126ad,_0x46f532,_0x4ea530);}else{logger['error'](_0x7ee7('0x22'),_0x5c1de6,_0x437109[_0x7ee7('0xc')]);_0x517789[_0x7ee7('0x15')]();}}}catch(_0x58f8c0){console[_0x7ee7('0x23')](_0x58f8c0);logger['error'](_0x7ee7('0x24'),_0x5c1de6,_0x58f8c0[_0x7ee7('0x25')]);_0x517789[_0x7ee7('0x15')]();}};}; \ No newline at end of file +var _0x825f=['toLowerCase','consequence','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','error','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x825f,0x67));var _0xf825=function(_0xca1748,_0x3915a4){_0xca1748=_0xca1748-0x0;var _0x178410=_0x825f[_0xca1748];return _0x178410;};'use strict';var schema=require(_0xf825('0x0'));var _=require(_0xf825('0x1'));var util=require(_0xf825('0x2'));var seqqueue=require(_0xf825('0x3'));var logger=require(_0xf825('0x4'))(_0xf825('0x5'));var strategy=require(_0xf825('0x6'));var queue=schema({'name':{'type':_0xf825('0x7'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xf825('0x8'),'message':_0xf825('0x9')}});function writeLog(_0x4bbc71,_0x58c30a,_0x4354f2){return logger[_0xf825('0xa')](util[_0xf825('0xb')](_0xf825('0xc'),_0x4bbc71,_0x58c30a[_0xf825('0xd')],_0x4354f2));}function handleFindAgent(_0x174ba1){return function(_0x2092e8){return _0x2092e8[_0xf825('0xd')][_0xf825('0xe')]()===_0x174ba1['toLowerCase']();};}exports[_0xf825('0xf')]=function(_0x1e8abf,_0x503b92,_0x7845a8,_0x2adc7f){return function(_0x4788e9){try{var _0x4b66be={'name':_0x503b92[0x0],'timeout':_0x503b92[0x1]};var _0x1464f0=queue['validate'](_0x4b66be,{'typecast':!![]});if(_0x1464f0['length']){logger['error'](_0xf825('0x10'),_0x1e8abf,_[_0xf825('0x11')](_0x1464f0,_0xf825('0x12'))[_0xf825('0x13')](',\x20'));_0x4788e9[_0xf825('0x14')]();}else{var _0x14cf2a=_[_0xf825('0x15')](_0x7845a8[_0xf825('0x16')],handleFindAgent(_0x4b66be[_0xf825('0xd')]));if(_0x14cf2a){var _0x114960=(_0x4b66be[_0xf825('0x17')]||0xa)*0x3e8;var _0x49068f,_0x1ebcd6;var _0x35bec6=seqqueue[_0xf825('0x18')](_0x114960);_0x35bec6['id']=_0x1e8abf;_0x35bec6[_0xf825('0x19')]=_0x114960;_0x35bec6[_0xf825('0x1a')]=_0x2adc7f[_0xf825('0x1a')];writeLog(_0x1e8abf,_0x14cf2a,util[_0xf825('0xb')]('START:%s',_0x114960));_0x7845a8['rules'][_0x1e8abf]['on'](_0xf825('0x1b'),function(){logger['info'](_0xf825('0x1c'),_0x1e8abf);clearTimeout(_0x1ebcd6);_0x1ebcd6=undefined;_0x35bec6[_0xf825('0x1d')]();if(_0x7845a8['rules'][_0x1e8abf]){delete _0x7845a8[_0xf825('0x1e')][_0x1e8abf];}_0x4788e9[_0xf825('0x14')]();});_0x7845a8[_0xf825('0x1e')][_0x1e8abf]['on'](_0xf825('0x1f'),function(){if(_0x7845a8['rules'][_0x1e8abf]){delete _0x7845a8[_0xf825('0x1e')][_0x1e8abf];}});_0x1ebcd6=setTimeout(function(){logger[_0xf825('0xa')]('[%s][AGENT]\x20ROUTING\x20END',_0x1e8abf);clearTimeout(_0x1ebcd6);_0x35bec6[_0xf825('0x1d')]();_0x4788e9[_0xf825('0x20')]();},_0x114960);strategy[_0xf825('0x21')](_0x35bec6,_0x14cf2a,_0x7845a8,_0x2adc7f);}else{logger['error'](_0xf825('0x22'),_0x1e8abf,_0x4b66be[_0xf825('0xd')]);_0x4788e9[_0xf825('0x14')]();}}}catch(_0x3e5467){console[_0xf825('0x23')](_0x3e5467);logger[_0xf825('0x24')](_0xf825('0x25'),_0x1e8abf,_0x3e5467[_0xf825('0x26')]);_0x4788e9[_0xf825('0x14')]();}};}; \ 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 7559bf4..b07005e 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 _0xf46d=['isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','stop','$LATEST','message','toString','amazonlex','providerResponse','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence'];(function(_0x187311,_0x3963a5){var _0x1a136f=function(_0x4dfebe){while(--_0x4dfebe){_0x187311['push'](_0x187311['shift']());}};_0x1a136f(++_0x3963a5);}(_0xf46d,0x1a5));var _0xdf46=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0xf46d[_0x1db831];return _0x39ba56;};'use strict';var _=require(_0xdf46('0x0'));var moment=require(_0xdf46('0x1'));var AWS=require(_0xdf46('0x2'));var utils=require(_0xdf46('0x3'));var logger=require(_0xdf46('0x4'))(_0xdf46('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xdf46('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xdf46('0x7')),'faxMessage':require(_0xdf46('0x8')),'whatsappMessage':require(_0xdf46('0x9'))};exports[_0xdf46('0xa')]=function(_0x2f4d68,_0x1badbd){return function(_0x3ad1cf){try{if(!_[_0xdf46('0xb')](this[_0xdf46('0xc')][_0xdf46('0xd')])){logger[_0xdf46('0xe')](_0xdf46('0xf'),_0x2f4d68,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3ad1cf[_0xdf46('0x10')]();}var _0x3828a1={'ContactId':this[_0xdf46('0x11')]['id'],'sentAt':moment()['format'](_0xdf46('0x12')),'direction':_0xdf46('0x13')};if(this['channel']===_0xdf46('0x14')||this[_0xdf46('0x15')]===_0xdf46('0x16')){_0x3828a1[_0xdf46('0x17')]=this[_0xdf46('0xc')][_0xdf46('0x17')];}var _0xc858a=this['channel'];if(_0xc858a===_0xdf46('0x18')){_0x3828a1['ChatWebsiteId']=this[_0xdf46('0x19')]['id'];}else{_0x3828a1[_[_0xdf46('0x1a')](_0xc858a)+_0xdf46('0x1b')]=this[_0xdf46('0x19')]['id'];}_0x3828a1[_[_0xdf46('0x1a')](_0xc858a)+_0xdf46('0x1c')]=this[_0xdf46('0xc')]['id'];if(this[_0xdf46('0xc')][_0xdf46('0x1d')]){var _0x59addf=_0x1badbd[0x4];if(!_[_0xdf46('0x1e')](_0x59addf)){_0x3828a1[_0xdf46('0x1f')]=utils[_0xdf46('0x20')](_0x59addf,this);return rpc[_0xc858a+_0xdf46('0x21')][_0xdf46('0x22')](_0x3828a1)[_0xdf46('0x23')](function(_0x2b1913){logger['info']('[%s][AMAZONLEX]\x20%s',_0x2f4d68,_0x3828a1['body']);})[_0xdf46('0x24')](function(_0x3b08bc){logger[_0xdf46('0x25')]('[%s][AMAZONLEX]\x20%s',_0x2f4d68,JSON[_0xdf46('0x26')](_0x3b08bc));})[_0xdf46('0x27')](function(){logger[_0xdf46('0xe')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2f4d68);_0x3ad1cf[_0xdf46('0x28')]();});}else{logger[_0xdf46('0xe')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2f4d68);_0x3ad1cf['stop']();}}else{var _0x45ab68=this;var _0x4f1c60=new AWS['LexRuntime']({'accessKeyId':_0x1badbd[0x0],'secretAccessKey':_0x1badbd[0x1],'region':_0x1badbd[0x2]});var _0x329640={'botAlias':_0xdf46('0x29'),'botName':_0x1badbd[0x3],'inputText':this[_0xdf46('0x2a')][_0xdf46('0x1f')],'userId':this[_0xdf46('0x15')]+':'+this['interaction']['id'][_0xdf46('0x2b')]()};_0x4f1c60['postText'](_0x329640,function(_0x2b051b,_0x2478cc){if(_0x2b051b){logger[_0xdf46('0x25')](_0xdf46('0xf'),_0x2f4d68,_0x2b051b[_0xdf46('0x2a')]);_0x3ad1cf['next']();}else if(_0x2478cc&&_0x2478cc[_0xdf46('0x2a')]){_0x45ab68[_0xdf46('0x1f')][_0xdf46('0x2c')]=_0x2478cc;_0x3828a1[_0xdf46('0x1f')]=_0x2478cc['message'];_0x3828a1['providerName']=_0xdf46('0x2c');_0x3828a1[_0xdf46('0x2d')]=JSON['stringify'](_0x2478cc);return rpc[_0xc858a+_0xdf46('0x21')][_0xdf46('0x22')](_0x3828a1)['then'](function(_0x13a48f){logger['info']('[%s][AMAZONLEX]\x20%s',_0x2f4d68,_0x3828a1['body']);if(_0x2478cc[_0xdf46('0x2e')]==_0xdf46('0x2f')){_0x3ad1cf[_0xdf46('0x10')]();}else{_0x3ad1cf['stop']();}})[_0xdf46('0x24')](function(_0x10992a){logger[_0xdf46('0x25')]('[%s][AMAZONLEX]\x20%s',_0x2f4d68,JSON[_0xdf46('0x26')](_0x10992a));_0x3ad1cf['next']();});}else{_0x3ad1cf['next']();}});}}catch(_0x39a439){logger[_0xdf46('0x25')](_0xdf46('0xf'),_0x2f4d68,JSON['stringify'](_0x39a439));_0x3ad1cf[_0xdf46('0x28')]();}};}; \ No newline at end of file +var _0xb634=['[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','create','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','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','account','upperFirst','AccountId','created','body','Message','catch','error','stringify','finally'];(function(_0x3a1d4a,_0x3883d){var _0x5dc004=function(_0x4f0f54){while(--_0x4f0f54){_0x3a1d4a['push'](_0x3a1d4a['shift']());}};_0x5dc004(++_0x3883d);}(_0xb634,0xa3));var _0x4b63=function(_0x4a806e,_0x5d47a8){_0x4a806e=_0x4a806e-0x0;var _0x29aa5b=_0xb634[_0x4a806e];return _0x29aa5b;};'use strict';var _=require(_0x4b63('0x0'));var moment=require(_0x4b63('0x1'));var AWS=require(_0x4b63('0x2'));var utils=require(_0x4b63('0x3'));var logger=require(_0x4b63('0x4'))('routing');var rpc={'chatMessage':require(_0x4b63('0x5')),'openchannelMessage':require(_0x4b63('0x6')),'mailMessage':require(_0x4b63('0x7')),'smsMessage':require(_0x4b63('0x8')),'faxMessage':require(_0x4b63('0x9')),'whatsappMessage':require(_0x4b63('0xa'))};exports[_0x4b63('0xb')]=function(_0x178a1d,_0x21d63b){return function(_0x38fb18){try{if(!_[_0x4b63('0xc')](this[_0x4b63('0xd')]['UserId'])){logger[_0x4b63('0xe')](_0x4b63('0xf'),_0x178a1d,_0x4b63('0x10'));return _0x38fb18[_0x4b63('0x11')]();}var _0x5dc945={'ContactId':this[_0x4b63('0x12')]['id'],'sentAt':moment()[_0x4b63('0x13')](_0x4b63('0x14')),'direction':_0x4b63('0x15')};if(this[_0x4b63('0x16')]===_0x4b63('0x17')||this['channel']===_0x4b63('0x18')){_0x5dc945[_0x4b63('0x19')]=this[_0x4b63('0xd')][_0x4b63('0x19')];}var _0x3e5987=this['channel'];if(_0x3e5987===_0x4b63('0x1a')){_0x5dc945['ChatWebsiteId']=this[_0x4b63('0x1b')]['id'];}else{_0x5dc945[_[_0x4b63('0x1c')](_0x3e5987)+_0x4b63('0x1d')]=this[_0x4b63('0x1b')]['id'];}_0x5dc945[_['upperFirst'](_0x3e5987)+'InteractionId']=this[_0x4b63('0xd')]['id'];if(this[_0x4b63('0xd')][_0x4b63('0x1e')]){var _0x5f28bb=_0x21d63b[0x4];if(!_['isEmpty'](_0x5f28bb)){_0x5dc945[_0x4b63('0x1f')]=utils['getMustacheRender'](_0x5f28bb,this);return rpc[_0x3e5987+_0x4b63('0x20')]['create'](_0x5dc945)['then'](function(_0x1b3a9e){logger[_0x4b63('0xe')]('[%s][AMAZONLEX]\x20%s',_0x178a1d,_0x5dc945[_0x4b63('0x1f')]);})[_0x4b63('0x21')](function(_0x1ad90c){logger[_0x4b63('0x22')]('[%s][AMAZONLEX]\x20%s',_0x178a1d,JSON[_0x4b63('0x23')](_0x1ad90c));})[_0x4b63('0x24')](function(){logger['info'](_0x4b63('0x25'),_0x178a1d);_0x38fb18[_0x4b63('0x26')]();});}else{logger[_0x4b63('0xe')](_0x4b63('0x27'),_0x178a1d);_0x38fb18[_0x4b63('0x26')]();}}else{var _0x19edfb=this;var _0x32d332=new AWS[(_0x4b63('0x28'))]({'accessKeyId':_0x21d63b[0x0],'secretAccessKey':_0x21d63b[0x1],'region':_0x21d63b[0x2]});var _0x5a8e96={'botAlias':_0x4b63('0x29'),'botName':_0x21d63b[0x3],'inputText':this[_0x4b63('0x2a')][_0x4b63('0x1f')],'userId':this[_0x4b63('0x16')]+':'+this[_0x4b63('0xd')]['id'][_0x4b63('0x2b')]()};_0x32d332[_0x4b63('0x2c')](_0x5a8e96,function(_0x2aad3e,_0xad6cef){if(_0x2aad3e){logger[_0x4b63('0x22')](_0x4b63('0xf'),_0x178a1d,_0x2aad3e['message']);_0x38fb18[_0x4b63('0x11')]();}else if(_0xad6cef&&_0xad6cef[_0x4b63('0x2a')]){_0x19edfb[_0x4b63('0x1f')][_0x4b63('0x2d')]=_0xad6cef;_0x5dc945[_0x4b63('0x1f')]=_0xad6cef[_0x4b63('0x2a')];_0x5dc945[_0x4b63('0x2e')]=_0x4b63('0x2d');_0x5dc945['providerResponse']=JSON[_0x4b63('0x23')](_0xad6cef);return rpc[_0x3e5987+_0x4b63('0x20')][_0x4b63('0x2f')](_0x5dc945)['then'](function(_0x15eff0){logger[_0x4b63('0xe')](_0x4b63('0xf'),_0x178a1d,_0x5dc945[_0x4b63('0x1f')]);if(_0xad6cef[_0x4b63('0x30')]==_0x4b63('0x31')){_0x38fb18[_0x4b63('0x11')]();}else{_0x38fb18[_0x4b63('0x26')]();}})['catch'](function(_0x434c23){logger[_0x4b63('0x22')](_0x4b63('0xf'),_0x178a1d,JSON[_0x4b63('0x23')](_0x434c23));_0x38fb18['next']();});}else{_0x38fb18['next']();}});}}catch(_0x413680){logger[_0x4b63('0x22')](_0x4b63('0xf'),_0x178a1d,JSON[_0x4b63('0x23')](_0x413680));_0x38fb18[_0x4b63('0x26')]();}};}; \ 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 f196dd1..914321a 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 _0xdc36=['error','[RPC][%s][AUTOREPLY]\x20%s','finally','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','isNil','created','interaction','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','upperFirst','AccountId','account','InteractionId','Message','Smtp','service','port','authentication','pass','','replace','';_0x4c0c7b[_0x6dc3('0x2d')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x6dc3('0x2e'),'Precedence':_0x6dc3('0x2f')};return mailRpc[_0x6dc3('0x30')](_0x12455c,_0x4c0c7b)[_0x6dc3('0x31')](function(_0x38f7ce){logger[_0x6dc3('0xc')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x2fa0ae);_0x4c0c7b['messageId']=_0x38f7ce[_0x6dc3('0x18')][_0x6dc3('0x32')];return rpc[_0x55c3e9+_0x6dc3('0x24')]['create'](_0x4c0c7b);})[_0x6dc3('0x31')](function(_0x3adcbd){logger[_0x6dc3('0xc')](_0x6dc3('0xd'),_0x2fa0ae,JSON['stringify'](_0x3adcbd));})[_0x6dc3('0x33')](function(_0x7e0e95){logger[_0x6dc3('0x34')](_0x6dc3('0x35'),_0x2fa0ae,JSON['stringify'](_0x7e0e95));})[_0x6dc3('0x36')](function(){_0x17cbce['next']();});}else{return rpc[this[_0x6dc3('0x10')]+_0x6dc3('0x24')]['create'](_0x4c0c7b)[_0x6dc3('0x31')](function(_0x2602a5){logger['info']('[%s][AUTOREPLY]\x20%s',_0x2fa0ae,_0x4c0c7b['body']);})[_0x6dc3('0x33')](function(_0x212d2a){logger['error'](_0x6dc3('0xd'),_0x2fa0ae,JSON['stringify'](_0x212d2a));})[_0x6dc3('0x36')](function(){_0x17cbce['next']();});}}}catch(_0x4ca1dc){logger['error'](_0x6dc3('0xd'),_0x2fa0ae,JSON['stringify'](_0x4ca1dc));_0x17cbce[_0x6dc3('0x37')]();}};}; \ No newline at end of file +var _0xc264=['message','from','phone','read','subject','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','InteractionId','Message','Smtp','service','host','port','authentication','user','pass','inReplyTo','','','headers','auto-replied','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','catch','error','stringify','finally','next','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','created','interaction','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','mail','getMustacheRender','body'];(function(_0x574429,_0x302956){var _0x212d25=function(_0x4e7620){while(--_0x4e7620){_0x574429['push'](_0x574429['shift']());}};_0x212d25(++_0x302956);}(_0xc264,0x1a6));var _0x4c26=function(_0x4fb789,_0x6b8092){_0x4fb789=_0x4fb789-0x0;var _0x49b5e4=_0xc264[_0x4fb789];return _0x49b5e4;};'use strict';var _=require(_0x4c26('0x0'));var moment=require(_0x4c26('0x1'));var utils=require(_0x4c26('0x2'));var logger=require(_0x4c26('0x3'))(_0x4c26('0x4'));var rpc={'chatMessage':require(_0x4c26('0x5')),'openchannelMessage':require(_0x4c26('0x6')),'mailMessage':require(_0x4c26('0x7')),'smsMessage':require(_0x4c26('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x4c26('0x9'))};var mailRpc=require(_0x4c26('0xa'));exports[_0x4c26('0xb')]=function(_0xcc60a7,_0x208947){return function(_0x54730d){try{if(_0x208947[0x0]==='1'&&(_[_0x4c26('0xc')](this['interaction'][_0x4c26('0xd')])||!this[_0x4c26('0xe')][_0x4c26('0xd')])){logger[_0x4c26('0xf')](_0x4c26('0x10'),_0xcc60a7,_0x4c26('0x11'));return _0x54730d['next']();}var _0x2fe8c3=this['channel'];var _0x51b687={'ContactId':this[_0x4c26('0x12')]['id'],'sentAt':moment()[_0x4c26('0x13')](_0x4c26('0x14')),'direction':_0x4c26('0x15')};if(this[_0x4c26('0x16')]===_0x4c26('0x17')){_0x51b687['body']=utils[_0x4c26('0x18')](_0x208947[0x2],this);}else{_0x51b687[_0x4c26('0x19')]=utils[_0x4c26('0x18')](_0x208947[0x1],this);}if(this[_0x4c26('0x1a')]){_0x51b687['to']=this[_0x4c26('0x1a')][_0x4c26('0x1b')]||'';if(this[_0x4c26('0x16')]==='mail'&&_0x208947[0x1]==='1'){_0x51b687['cc']=this[_0x4c26('0x1a')]['cc']||'';}_0x51b687['from']=this[_0x4c26('0x1a')]['to']||'';_0x51b687['phone']=this[_0x4c26('0x1a')][_0x4c26('0x1c')]||'';_0x51b687[_0x4c26('0x1d')]=!![];if(this[_0x4c26('0x1a')][_0x4c26('0x1e')]){_0x51b687['subject']='';_0x51b687['subject']+=_['startsWith'](this['message'][_0x4c26('0x1e')],_0x4c26('0x1f'))?'':_0x4c26('0x20');_0x51b687[_0x4c26('0x1e')]+=this[_0x4c26('0x1a')][_0x4c26('0x1e')];}}if(this[_0x4c26('0x16')]==='chat'){_0x51b687[_0x4c26('0x21')]=this[_0x4c26('0x22')]['id'];}else{_0x51b687[_['upperFirst'](this[_0x4c26('0x16')])+'AccountId']=this['account']['id'];}_0x51b687[_[_0x4c26('0x23')](this[_0x4c26('0x16')])+_0x4c26('0x24')]=this[_0x4c26('0xe')]['id'];if(rpc[this[_0x4c26('0x16')]+_0x4c26('0x25')]){if(this['channel']===_0x4c26('0x17')){var _0x3bb44c={'tls':{'rejectUnauthorized':![]}};if(this[_0x4c26('0x22')][_0x4c26('0x26')][_0x4c26('0x27')]){_0x3bb44c[_0x4c26('0x27')]=this[_0x4c26('0x22')][_0x4c26('0x26')][_0x4c26('0x27')];}else{_0x3bb44c[_0x4c26('0x28')]=this[_0x4c26('0x22')][_0x4c26('0x26')]['host'];_0x3bb44c[_0x4c26('0x29')]=this[_0x4c26('0x22')][_0x4c26('0x26')][_0x4c26('0x29')];_0x3bb44c['secure']=this[_0x4c26('0x22')][_0x4c26('0x26')]['secure'];}if(this['account'][_0x4c26('0x26')][_0x4c26('0x2a')]){_0x3bb44c['auth']={'user':this['account'][_0x4c26('0x26')][_0x4c26('0x2b')],'pass':this[_0x4c26('0x22')]['Smtp'][_0x4c26('0x2c')]};}_0x51b687[_0x4c26('0x2d')]=this[_0x4c26('0x1a')]['messageId'];_0x51b687['html']=_0x4c26('0x2e')+_['replace'](_0x51b687[_0x4c26('0x19')],_0x4c26('0x2f'),_0x4c26('0x30'))+_0x4c26('0x31');_0x51b687[_0x4c26('0x32')]={'Auto-Submitted':_0x4c26('0x33'),'X-Auto-Response-Suppress':'All','Precedence':_0x4c26('0x34')};return mailRpc[_0x4c26('0x35')](_0x3bb44c,_0x51b687)[_0x4c26('0x36')](function(_0x36ac0c){logger['info'](_0x4c26('0x37'),_0xcc60a7);_0x51b687[_0x4c26('0x38')]=_0x36ac0c['message']['messageId'];return rpc[_0x2fe8c3+_0x4c26('0x25')][_0x4c26('0x39')](_0x51b687);})[_0x4c26('0x36')](function(_0x5d4e1d){logger[_0x4c26('0xf')](_0x4c26('0x10'),_0xcc60a7,JSON['stringify'](_0x5d4e1d));})[_0x4c26('0x3a')](function(_0x37ea70){logger[_0x4c26('0x3b')]('[RPC][%s][AUTOREPLY]\x20%s',_0xcc60a7,JSON[_0x4c26('0x3c')](_0x37ea70));})[_0x4c26('0x3d')](function(){_0x54730d[_0x4c26('0x3e')]();});}else{return rpc[this[_0x4c26('0x16')]+_0x4c26('0x25')][_0x4c26('0x39')](_0x51b687)[_0x4c26('0x36')](function(_0x3ffcb8){logger[_0x4c26('0xf')]('[%s][AUTOREPLY]\x20%s',_0xcc60a7,_0x51b687[_0x4c26('0x19')]);})[_0x4c26('0x3a')](function(_0x23b3c1){logger[_0x4c26('0x3b')](_0x4c26('0x10'),_0xcc60a7,JSON[_0x4c26('0x3c')](_0x23b3c1));})[_0x4c26('0x3d')](function(){_0x54730d[_0x4c26('0x3e')]();});}}}catch(_0x3d526f){logger[_0x4c26('0x3b')](_0x4c26('0x10'),_0xcc60a7,JSON[_0x4c26('0x3c')](_0x3d526f));_0x54730d[_0x4c26('0x3f')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index f17d356..bc582a9 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2484=['finally','stop','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','[%s][CLOSE]\x20%s','stringify'];(function(_0x18dabd,_0x2e7be1){var _0x3c6642=function(_0x442ff4){while(--_0x442ff4){_0x18dabd['push'](_0x18dabd['shift']());}};_0x3c6642(++_0x2e7be1);}(_0x2484,0x178));var _0x4248=function(_0x5ecaab,_0x2f3053){_0x5ecaab=_0x5ecaab-0x0;var _0x3db1a8=_0x2484[_0x5ecaab];return _0x3db1a8;};'use strict';var moment=require(_0x4248('0x0'));var logger=require(_0x4248('0x1'))('routing');var rpc={'chatInteraction':require(_0x4248('0x2')),'openchannelInteraction':require(_0x4248('0x3')),'smsInteraction':require(_0x4248('0x4')),'mailInteraction':require(_0x4248('0x5')),'faxInteraction':require(_0x4248('0x6')),'whatsappInteraction':require(_0x4248('0x7'))};exports[_0x4248('0x8')]=function(_0x588b99,_0x377653,_0x2d220,_0x43e730){return function(_0x189f42){try{logger[_0x4248('0x9')](_0x4248('0xa'),_0x588b99,_0x377653[0x0]);var _0x5c1284={'closed':0x1,'closedAt':moment()[_0x4248('0xb')](_0x4248('0xc')),'closeReason':_0x4248('0xd'),'disposition':_0x377653[0x0]};if(rpc[_0x43e730[_0x4248('0xe')]+_0x4248('0xf')]){rpc[_0x43e730[_0x4248('0xe')]+_0x4248('0xf')]['update'](_0x43e730[_0x4248('0x10')]['id'],_0x5c1284)['then'](function(_0x3927b1){logger[_0x4248('0x9')](_0x4248('0x11'),_0x588b99,_0x43e730['interaction']['id']);})['catch'](function(_0xeb5fd1){logger['error'](_0x4248('0x12'),_0x588b99,JSON[_0x4248('0x13')](_0xeb5fd1));})[_0x4248('0x14')](function(){_0x189f42[_0x4248('0x15')]();});}}catch(_0x3a557b){logger['error'](_0x4248('0x12'),_0x588b99,JSON[_0x4248('0x13')](_0x3a557b));_0x189f42[_0x4248('0x15')]();}};}; \ No newline at end of file +var _0xc14a=['system','channel','Interaction','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','stringify','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x631a3c,_0x1b61b6){var _0x2bdfa3=function(_0x21711b){while(--_0x21711b){_0x631a3c['push'](_0x631a3c['shift']());}};_0x2bdfa3(++_0x1b61b6);}(_0xc14a,0xa9));var _0xac14=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc14a[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require(_0xac14('0x0'));var logger=require(_0xac14('0x1'))(_0xac14('0x2'));var rpc={'chatInteraction':require(_0xac14('0x3')),'openchannelInteraction':require(_0xac14('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xac14('0x5')),'faxInteraction':require(_0xac14('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xac14('0x7')]=function(_0x525320,_0xb345ea,_0x244723,_0x3c2415){return function(_0x59a627){try{logger[_0xac14('0x8')](_0xac14('0x9'),_0x525320,_0xb345ea[0x0]);var _0x257a68={'closed':0x1,'closedAt':moment()['format'](_0xac14('0xa')),'closeReason':_0xac14('0xb'),'disposition':_0xb345ea[0x0]};if(rpc[_0x3c2415[_0xac14('0xc')]+_0xac14('0xd')]){rpc[_0x3c2415['channel']+_0xac14('0xd')]['update'](_0x3c2415[_0xac14('0xe')]['id'],_0x257a68)[_0xac14('0xf')](function(_0x5a93bb){logger['info'](_0xac14('0x10'),_0x525320,_0x3c2415[_0xac14('0xe')]['id']);})['catch'](function(_0x11d522){logger[_0xac14('0x11')]('[%s][CLOSE]\x20%s',_0x525320,JSON[_0xac14('0x12')](_0x11d522));})['finally'](function(){_0x59a627[_0xac14('0x13')]();});}}catch(_0x3a171d){logger[_0xac14('0x11')]('[%s][CLOSE]\x20%s',_0x525320,JSON['stringify'](_0x3a171d));_0x59a627[_0xac14('0x13')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 52ead6c..aae21b0 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6325=['catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','result','fulfillment','providerName','dialogflow','providerResponse','create','metadata','endConversation','lodash','moment','apiai-promise','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','consequence','isNil','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','channel','sms','whatsapp','chat','account','upperFirst','InteractionId','created','body','Message','then','[%s][DIALOGFLOW]\x20%s'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0x6325,0x18a));var _0x5632=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6325[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x5632('0x0'));var moment=require(_0x5632('0x1'));var apiai=require(_0x5632('0x2'));var md5=require('md5');var utils=require('./utils');var logger=require(_0x5632('0x3'))(_0x5632('0x4'));var rpc={'chatMessage':require(_0x5632('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x5632('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x5632('0x7')]=function(_0x1216b6,_0x29c306){return function(_0x4839c2){try{if(!_[_0x5632('0x8')](this[_0x5632('0x9')]['UserId'])){logger[_0x5632('0xa')]('[%s][DIALOGFLOW]\x20%s',_0x1216b6,_0x5632('0xb'));return _0x4839c2[_0x5632('0xc')]();}var _0x28f39e={'ContactId':this[_0x5632('0xd')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x5632('0xe')]===_0x5632('0xf')||this['channel']===_0x5632('0x10')){_0x28f39e['phone']=this['interaction']['phone'];}var _0x601bc0=this['channel'];if(_0x601bc0===_0x5632('0x11')){_0x28f39e['ChatWebsiteId']=this[_0x5632('0x12')]['id'];}else{_0x28f39e[_['upperFirst'](_0x601bc0)+'AccountId']=this['account']['id'];}_0x28f39e[_[_0x5632('0x13')](_0x601bc0)+_0x5632('0x14')]=this[_0x5632('0x9')]['id'];if(this[_0x5632('0x9')][_0x5632('0x15')]){var _0x67185f=_0x29c306[0x2];if(!_['isEmpty'](_0x67185f)){_0x28f39e[_0x5632('0x16')]=utils['getMustacheRender'](_0x67185f,this);return rpc[_0x601bc0+_0x5632('0x17')]['create'](_0x28f39e)[_0x5632('0x18')](function(_0x2ef7db){logger[_0x5632('0xa')](_0x5632('0x19'),_0x1216b6,_0x28f39e[_0x5632('0x16')]);})[_0x5632('0x1a')](function(_0x46500a){logger[_0x5632('0x1b')](_0x5632('0x19'),_0x1216b6,JSON[_0x5632('0x1c')](_0x46500a));})[_0x5632('0x1d')](function(){logger[_0x5632('0xa')](_0x5632('0x1e'),_0x1216b6);_0x4839c2[_0x5632('0x1f')]();});}else{logger[_0x5632('0xa')](_0x5632('0x20'),_0x1216b6);_0x4839c2[_0x5632('0x1f')]();}}else{var _0x99fe0a=this;var _0x2703fa=apiai(_0x29c306[0x0],{'language':_0x29c306[0x1]||'en'});return _0x2703fa['textRequest'](this[_0x5632('0x21')][_0x5632('0x16')],{'sessionId':md5(this['interaction']['id'])})['then'](function(_0x121661){_0x99fe0a['body']['dialogflow']=_0x121661;_0x28f39e[_0x5632('0x16')]=_0x121661[_0x5632('0x22')][_0x5632('0x23')]['speech'];_0x28f39e[_0x5632('0x24')]=_0x5632('0x25');_0x28f39e[_0x5632('0x26')]=JSON[_0x5632('0x1c')](_0x121661);return rpc[_0x601bc0+_0x5632('0x17')][_0x5632('0x27')](_0x28f39e)[_0x5632('0x18')](function(_0x5988c9){logger[_0x5632('0xa')](_0x5632('0x19'),_0x1216b6,_0x28f39e[_0x5632('0x16')]);if(_0x121661[_0x5632('0x22')][_0x5632('0x28')][_0x5632('0x29')]){_0x4839c2[_0x5632('0xc')]();}else{_0x4839c2[_0x5632('0x1f')]();}})[_0x5632('0x1a')](function(_0x196883){logger[_0x5632('0x1b')](_0x5632('0x19'),_0x1216b6,JSON[_0x5632('0x1c')](_0x196883));_0x4839c2['next']();});})[_0x5632('0x1a')](function(_0x32b436){logger[_0x5632('0x1b')]('[%s][DIALOGFLOW]\x20%s',_0x1216b6,_0x32b436[_0x5632('0x21')]);_0x4839c2[_0x5632('0xc')]();});}}catch(_0x4009bc){logger[_0x5632('0x1b')](_0x5632('0x19'),_0x1216b6,JSON[_0x5632('0x1c')](_0x4009bc));_0x4839c2[_0x5632('0x1f')]();}};}; \ No newline at end of file +var _0x9cae=['whatsapp','upperFirst','InteractionId','isEmpty','body','Message','create','then','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','result','speech','providerName','dialogflow','providerResponse','endConversation','message','moment','apiai-promise','md5','./utils','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms'];(function(_0xf26d40,_0x2f4f46){var _0x50b68c=function(_0x10aa58){while(--_0x10aa58){_0xf26d40['push'](_0xf26d40['shift']());}};_0x50b68c(++_0x2f4f46);}(_0x9cae,0xb9));var _0xe9ca=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9cae[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var moment=require(_0xe9ca('0x0'));var apiai=require(_0xe9ca('0x1'));var md5=require(_0xe9ca('0x2'));var utils=require(_0xe9ca('0x3'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xe9ca('0x4')),'smsMessage':require(_0xe9ca('0x5')),'faxMessage':require(_0xe9ca('0x6')),'whatsappMessage':require(_0xe9ca('0x7'))};exports['consequence']=function(_0x244138,_0x470d75){return function(_0x439c40){try{if(!_[_0xe9ca('0x8')](this[_0xe9ca('0x9')][_0xe9ca('0xa')])){logger[_0xe9ca('0xb')](_0xe9ca('0xc'),_0x244138,_0xe9ca('0xd'));return _0x439c40[_0xe9ca('0xe')]();}var _0x49a0f9={'ContactId':this['contact']['id'],'sentAt':moment()[_0xe9ca('0xf')](_0xe9ca('0x10')),'direction':_0xe9ca('0x11')};if(this[_0xe9ca('0x12')]===_0xe9ca('0x13')||this[_0xe9ca('0x12')]===_0xe9ca('0x14')){_0x49a0f9['phone']=this[_0xe9ca('0x9')]['phone'];}var _0x223bc1=this['channel'];if(_0x223bc1==='chat'){_0x49a0f9['ChatWebsiteId']=this['account']['id'];}else{_0x49a0f9[_[_0xe9ca('0x15')](_0x223bc1)+'AccountId']=this['account']['id'];}_0x49a0f9[_[_0xe9ca('0x15')](_0x223bc1)+_0xe9ca('0x16')]=this[_0xe9ca('0x9')]['id'];if(this[_0xe9ca('0x9')]['created']){var _0x5a6e71=_0x470d75[0x2];if(!_[_0xe9ca('0x17')](_0x5a6e71)){_0x49a0f9[_0xe9ca('0x18')]=utils['getMustacheRender'](_0x5a6e71,this);return rpc[_0x223bc1+_0xe9ca('0x19')][_0xe9ca('0x1a')](_0x49a0f9)[_0xe9ca('0x1b')](function(_0x332ad1){logger[_0xe9ca('0xb')](_0xe9ca('0xc'),_0x244138,_0x49a0f9[_0xe9ca('0x18')]);})[_0xe9ca('0x1c')](function(_0x4fe72f){logger[_0xe9ca('0x1d')](_0xe9ca('0xc'),_0x244138,JSON[_0xe9ca('0x1e')](_0x4fe72f));})['finally'](function(){logger[_0xe9ca('0xb')](_0xe9ca('0x1f'),_0x244138);_0x439c40[_0xe9ca('0x20')]();});}else{logger[_0xe9ca('0xb')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x244138);_0x439c40['stop']();}}else{var _0x3621e0=this;var _0x5dffab=apiai(_0x470d75[0x0],{'language':_0x470d75[0x1]||'en'});return _0x5dffab[_0xe9ca('0x21')](this['message'][_0xe9ca('0x18')],{'sessionId':md5(this[_0xe9ca('0x9')]['id'])})[_0xe9ca('0x1b')](function(_0x562373){_0x3621e0[_0xe9ca('0x18')]['dialogflow']=_0x562373;_0x49a0f9[_0xe9ca('0x18')]=_0x562373[_0xe9ca('0x22')]['fulfillment'][_0xe9ca('0x23')];_0x49a0f9[_0xe9ca('0x24')]=_0xe9ca('0x25');_0x49a0f9[_0xe9ca('0x26')]=JSON['stringify'](_0x562373);return rpc[_0x223bc1+_0xe9ca('0x19')][_0xe9ca('0x1a')](_0x49a0f9)[_0xe9ca('0x1b')](function(_0x19a706){logger[_0xe9ca('0xb')](_0xe9ca('0xc'),_0x244138,_0x49a0f9[_0xe9ca('0x18')]);if(_0x562373[_0xe9ca('0x22')]['metadata'][_0xe9ca('0x27')]){_0x439c40[_0xe9ca('0xe')]();}else{_0x439c40[_0xe9ca('0x20')]();}})[_0xe9ca('0x1c')](function(_0xdc6424){logger['error'](_0xe9ca('0xc'),_0x244138,JSON['stringify'](_0xdc6424));_0x439c40[_0xe9ca('0xe')]();});})[_0xe9ca('0x1c')](function(_0x3f457b){logger[_0xe9ca('0x1d')](_0xe9ca('0xc'),_0x244138,_0x3f457b[_0xe9ca('0x28')]);_0x439c40[_0xe9ca('0xe')]();});}}catch(_0x484b74){logger[_0xe9ca('0x1d')]('[%s][DIALOGFLOW]\x20%s',_0x244138,JSON[_0xe9ca('0x1e')](_0x484b74));_0x439c40['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 5f97fbe..067e1d6 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4364=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','body','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','chat','upperFirst','AccountId','account','InteractionId','created','error','stringify','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','SessionsClient','sessionPath','detectIntent','length','dialogflowV2','diagnosticInfo','fields','queryResult','boolValue','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','providerName','fulfillmentText','all','next','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing'];(function(_0x46e62f,_0x5a763e){var _0x370496=function(_0x54a854){while(--_0x54a854){_0x46e62f['push'](_0x46e62f['shift']());}};_0x370496(++_0x5a763e);}(_0x4364,0x12f));var _0x4436=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x4364[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x4436('0x0'));var dialogflow=require(_0x4436('0x1'));var md5=require(_0x4436('0x2'));var moment=require(_0x4436('0x3'));var Promise=require(_0x4436('0x4'));var logger=require(_0x4436('0x5'))(_0x4436('0x6'));var utils=require('./utils');var rpc={'chatMessage':require(_0x4436('0x7')),'openchannelMessage':require(_0x4436('0x8')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x4436('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x4436('0xa'))};function createMessage(_0x554c3c,_0x578bb7,_0x360875,_0x1d8e4b){return new Promise(function(_0x2a4781,_0x1ac125){var _0x1f1c33=_['clone'](_0x360875);_0x1f1c33[_0x4436('0xb')]=_0x1d8e4b;return rpc[_0x578bb7+_0x4436('0xc')]['create'](_0x1f1c33)[_0x4436('0xd')](function(){logger[_0x4436('0xe')](_0x4436('0xf'),_0x554c3c,_0x1f1c33[_0x4436('0xb')]);_0x2a4781();})[_0x4436('0x10')](function(_0x36ea4f){logger['error'](_0x4436('0xf'),_0x554c3c,JSON['stringify'](_0x36ea4f));_0x1ac125(_0x36ea4f);});});}exports['consequence']=function(_0x2378e9,_0x232747){return function(_0x122c78){try{if(!_[_0x4436('0x11')](this[_0x4436('0x12')]['UserId'])){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x2378e9,_0x4436('0x13'));return _0x122c78['next']();}var _0x29501c={'ContactId':this[_0x4436('0x14')]['id'],'sentAt':moment()[_0x4436('0x15')](_0x4436('0x16')),'direction':_0x4436('0x17')};if(this[_0x4436('0x18')]==='sms'||this[_0x4436('0x18')]===_0x4436('0x19')){_0x29501c['phone']=this['interaction']['phone'];}var _0x6f26e=this[_0x4436('0x18')];if(_0x6f26e===_0x4436('0x1a')){_0x29501c['ChatWebsiteId']=this['account']['id'];}else{_0x29501c[_[_0x4436('0x1b')](_0x6f26e)+_0x4436('0x1c')]=this[_0x4436('0x1d')]['id'];}_0x29501c[_[_0x4436('0x1b')](_0x6f26e)+_0x4436('0x1e')]=this[_0x4436('0x12')]['id'];if(this[_0x4436('0x12')][_0x4436('0x1f')]){var _0x24c06e=_0x232747[0x4];if(!_['isEmpty'](_0x24c06e)){_0x29501c[_0x4436('0xb')]=utils['getMustacheRender'](_0x24c06e,this);return rpc[_0x6f26e+'Message']['create'](_0x29501c)['then'](function(_0x74df5){logger['info'](_0x4436('0xf'),_0x2378e9,_0x29501c[_0x4436('0xb')]);})[_0x4436('0x10')](function(_0x473359){logger[_0x4436('0x20')](_0x4436('0xf'),_0x2378e9,JSON[_0x4436('0x21')](_0x473359));})['finally'](function(){logger[_0x4436('0xe')](_0x4436('0x22'),_0x2378e9);_0x122c78['stop']();});}else{logger[_0x4436('0xe')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2378e9);_0x122c78[_0x4436('0x23')]();}}else{var _0x248941=this;var _0x311fb2=_0x232747[0x2]['replace'](/\\n/g,'\x0a');var _0x340a09={'credentials':{'private_key':_0x311fb2,'client_email':_0x232747[0x1]}};var _0x497ebf=new dialogflow[(_0x4436('0x24'))](_0x340a09);var _0x370c5c=_0x497ebf[_0x4436('0x25')](_0x232747[0x0],md5(_0x248941[_0x4436('0x12')]['id']));var _0x371323={'session':_0x370c5c,'queryInput':{'text':{'text':_0x248941['message'][_0x4436('0xb')],'languageCode':_0x232747[0x3]||'en'}}};return _0x497ebf[_0x4436('0x26')](_0x371323)[_0x4436('0xd')](function(_0x2bcfa4){if(_0x2bcfa4&&_0x2bcfa4[_0x4436('0x27')]){_0x248941['body'][_0x4436('0x28')]=_0x2bcfa4;var _0x42b65=_0x2bcfa4[0x0];var _0x2c8800=_0x42b65['queryResult']['diagnosticInfo']&&_0x42b65['queryResult'][_0x4436('0x29')][_0x4436('0x2a')]?_0x42b65[_0x4436('0x2b')][_0x4436('0x29')]['fields']['end_conversation'][_0x4436('0x2c')]:![];_0x248941['body']['DIALOGFLOWV2_ACTION']=_0x42b65['queryResult'][_0x4436('0x2d')];_0x248941[_0x4436('0xb')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x42b65[_0x4436('0x2b')][_0x4436('0x2e')];_0x248941[_0x4436('0xb')][_0x4436('0x2f')]=_0x42b65[_0x4436('0x2b')][_0x4436('0x29')]&&_0x42b65[_0x4436('0x2b')][_0x4436('0x29')][_0x4436('0x2a')]?_0x42b65[_0x4436('0x2b')]['diagnosticInfo'][_0x4436('0x2a')][_0x4436('0x30')][_0x4436('0x2c')]:![];_0x248941['body'][_0x4436('0x31')]=_0x42b65[_0x4436('0x2b')][_0x4436('0x32')]['name'];_0x248941[_0x4436('0xb')][_0x4436('0x33')]=_0x42b65['queryResult']['intent'][_0x4436('0x34')];_0x248941[_0x4436('0xb')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x42b65[_0x4436('0x2b')]['intent'][_0x4436('0x35')];_0x248941[_0x4436('0xb')][_0x4436('0x36')]=_0x42b65[_0x4436('0x2b')][_0x4436('0x37')];_0x248941['body'][_0x4436('0x38')]=_0x42b65[_0x4436('0x2b')]['queryText'];_0x248941[_0x4436('0xb')][_0x4436('0x39')]=_0x42b65['queryResult']['intentDetectionConfidence'];_0x29501c[_0x4436('0x3a')]=_0x4436('0x28');_0x29501c['providerResponse']=JSON['stringify'](_0x2bcfa4);var _0x1ea2e5=[];for(var _0x107fe7=0x0;_0x107fe7<_0x2bcfa4['length'];_0x107fe7++){var _0x184218=_0x2bcfa4[_0x107fe7];if(_0x184218&&_0x184218[_0x4436('0x2b')]&&_0x184218[_0x4436('0x2b')][_0x4436('0x3b')]){_0x1ea2e5['push'](createMessage(_0x2378e9,_0x6f26e,_0x29501c,_0x184218[_0x4436('0x2b')][_0x4436('0x3b')]));}}return Promise[_0x4436('0x3c')](_0x1ea2e5)[_0x4436('0xd')](function(){if(_0x2c8800){_0x122c78[_0x4436('0x3d')]();}else{_0x122c78[_0x4436('0x23')]();}})[_0x4436('0x10')](function(_0x3dff43){logger['error'](_0x4436('0xf'),_0x2378e9,JSON[_0x4436('0x21')](_0x3dff43));_0x122c78['next']();});}})[_0x4436('0x10')](function(_0x43ff49){logger['error'](_0x4436('0xf'),_0x2378e9,_0x43ff49['message']);_0x122c78[_0x4436('0x3d')]();});}}catch(_0x2b7201){logger[_0x4436('0x20')](_0x4436('0xf'),_0x2378e9,JSON['stringify'](_0x2b7201));_0x122c78[_0x4436('0x23')]();}};}; \ No newline at end of file +var _0xa6d6=['body','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','next','contact','format','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','message','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','fulfillmentText','push','lodash','dialogflow','md5','moment','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x3f5394,_0x1d2969){var _0x2a66cd=function(_0x592b67){while(--_0x592b67){_0x3f5394['push'](_0x3f5394['shift']());}};_0x2a66cd(++_0x1d2969);}(_0xa6d6,0x110));var _0x6a6d=function(_0x4aa411,_0x11583d){_0x4aa411=_0x4aa411-0x0;var _0x4c7f7f=_0xa6d6[_0x4aa411];return _0x4c7f7f;};'use strict';var _=require(_0x6a6d('0x0'));var dialogflow=require(_0x6a6d('0x1'));var md5=require(_0x6a6d('0x2'));var moment=require(_0x6a6d('0x3'));var Promise=require('bluebird');var logger=require(_0x6a6d('0x4'))(_0x6a6d('0x5'));var utils=require(_0x6a6d('0x6'));var rpc={'chatMessage':require(_0x6a6d('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x6a6d('0x8')),'smsMessage':require(_0x6a6d('0x9')),'faxMessage':require(_0x6a6d('0xa')),'whatsappMessage':require(_0x6a6d('0xb'))};function createMessage(_0x4e2800,_0x15c174,_0x5846de,_0x34edb5){return new Promise(function(_0x30e0cd,_0x398062){var _0x3ab91d=_['clone'](_0x5846de);_0x3ab91d[_0x6a6d('0xc')]=_0x34edb5;return rpc[_0x15c174+'Message'][_0x6a6d('0xd')](_0x3ab91d)[_0x6a6d('0xe')](function(){logger[_0x6a6d('0xf')](_0x6a6d('0x10'),_0x4e2800,_0x3ab91d['body']);_0x30e0cd();})[_0x6a6d('0x11')](function(_0xb21a0){logger[_0x6a6d('0x12')](_0x6a6d('0x10'),_0x4e2800,JSON[_0x6a6d('0x13')](_0xb21a0));_0x398062(_0xb21a0);});});}exports[_0x6a6d('0x14')]=function(_0x376896,_0x199be5){return function(_0x2e8503){try{if(!_[_0x6a6d('0x15')](this[_0x6a6d('0x16')][_0x6a6d('0x17')])){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x376896,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2e8503[_0x6a6d('0x18')]();}var _0x51f90f={'ContactId':this[_0x6a6d('0x19')]['id'],'sentAt':moment()[_0x6a6d('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x6a6d('0x1b')};if(this[_0x6a6d('0x1c')]==='sms'||this[_0x6a6d('0x1c')]===_0x6a6d('0x1d')){_0x51f90f[_0x6a6d('0x1e')]=this[_0x6a6d('0x16')][_0x6a6d('0x1e')];}var _0xd72b63=this[_0x6a6d('0x1c')];if(_0xd72b63===_0x6a6d('0x1f')){_0x51f90f[_0x6a6d('0x20')]=this[_0x6a6d('0x21')]['id'];}else{_0x51f90f[_[_0x6a6d('0x22')](_0xd72b63)+_0x6a6d('0x23')]=this[_0x6a6d('0x21')]['id'];}_0x51f90f[_[_0x6a6d('0x22')](_0xd72b63)+_0x6a6d('0x24')]=this[_0x6a6d('0x16')]['id'];if(this[_0x6a6d('0x16')]['created']){var _0x5c0ef0=_0x199be5[0x4];if(!_[_0x6a6d('0x25')](_0x5c0ef0)){_0x51f90f[_0x6a6d('0xc')]=utils['getMustacheRender'](_0x5c0ef0,this);return rpc[_0xd72b63+'Message'][_0x6a6d('0xd')](_0x51f90f)['then'](function(_0x4a6dc0){logger[_0x6a6d('0xf')](_0x6a6d('0x10'),_0x376896,_0x51f90f['body']);})['catch'](function(_0x390499){logger[_0x6a6d('0x12')](_0x6a6d('0x10'),_0x376896,JSON[_0x6a6d('0x13')](_0x390499));})['finally'](function(){logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x376896);_0x2e8503[_0x6a6d('0x26')]();});}else{logger['info'](_0x6a6d('0x27'),_0x376896);_0x2e8503[_0x6a6d('0x26')]();}}else{var _0x5e2e3c=this;var _0x36f7e6=_0x199be5[0x2][_0x6a6d('0x28')](/\\n/g,'\x0a');var _0x40b74e={'credentials':{'private_key':_0x36f7e6,'client_email':_0x199be5[0x1]}};var _0x424773=new dialogflow[(_0x6a6d('0x29'))](_0x40b74e);var _0x186963=_0x424773['sessionPath'](_0x199be5[0x0],md5(_0x5e2e3c['interaction']['id']));var _0x160071={'session':_0x186963,'queryInput':{'text':{'text':_0x5e2e3c[_0x6a6d('0x2a')][_0x6a6d('0xc')],'languageCode':_0x199be5[0x3]||'en'}}};return _0x424773['detectIntent'](_0x160071)[_0x6a6d('0xe')](function(_0x26252a){if(_0x26252a&&_0x26252a[_0x6a6d('0x2b')]){_0x5e2e3c[_0x6a6d('0xc')][_0x6a6d('0x2c')]=_0x26252a;var _0x340d4e=_0x26252a[0x0];var _0x176039=_0x340d4e[_0x6a6d('0x2d')][_0x6a6d('0x2e')]&&_0x340d4e[_0x6a6d('0x2d')][_0x6a6d('0x2e')][_0x6a6d('0x2f')]?_0x340d4e['queryResult']['diagnosticInfo'][_0x6a6d('0x2f')][_0x6a6d('0x30')]['boolValue']:![];_0x5e2e3c[_0x6a6d('0xc')][_0x6a6d('0x31')]=_0x340d4e[_0x6a6d('0x2d')][_0x6a6d('0x32')];_0x5e2e3c[_0x6a6d('0xc')][_0x6a6d('0x33')]=_0x340d4e[_0x6a6d('0x2d')][_0x6a6d('0x34')];_0x5e2e3c[_0x6a6d('0xc')][_0x6a6d('0x35')]=_0x340d4e[_0x6a6d('0x2d')]['diagnosticInfo']&&_0x340d4e[_0x6a6d('0x2d')][_0x6a6d('0x2e')][_0x6a6d('0x2f')]?_0x340d4e[_0x6a6d('0x2d')][_0x6a6d('0x2e')]['fields'][_0x6a6d('0x30')][_0x6a6d('0x36')]:![];_0x5e2e3c[_0x6a6d('0xc')][_0x6a6d('0x37')]=_0x340d4e[_0x6a6d('0x2d')][_0x6a6d('0x38')][_0x6a6d('0x39')];_0x5e2e3c[_0x6a6d('0xc')][_0x6a6d('0x3a')]=_0x340d4e[_0x6a6d('0x2d')][_0x6a6d('0x38')][_0x6a6d('0x3b')];_0x5e2e3c[_0x6a6d('0xc')][_0x6a6d('0x3c')]=_0x340d4e[_0x6a6d('0x2d')][_0x6a6d('0x38')][_0x6a6d('0x3d')];_0x5e2e3c[_0x6a6d('0xc')][_0x6a6d('0x3e')]=_0x340d4e[_0x6a6d('0x2d')][_0x6a6d('0x3f')];_0x5e2e3c[_0x6a6d('0xc')][_0x6a6d('0x40')]=_0x340d4e['queryResult'][_0x6a6d('0x41')];_0x5e2e3c[_0x6a6d('0xc')][_0x6a6d('0x42')]=_0x340d4e[_0x6a6d('0x2d')][_0x6a6d('0x43')];_0x51f90f[_0x6a6d('0x44')]=_0x6a6d('0x2c');_0x51f90f['providerResponse']=JSON[_0x6a6d('0x13')](_0x26252a);var _0x70c00f=[];for(var _0x306a77=0x0;_0x306a77<_0x26252a[_0x6a6d('0x2b')];_0x306a77++){var _0x247347=_0x26252a[_0x306a77];if(_0x247347&&_0x247347[_0x6a6d('0x2d')]&&_0x247347[_0x6a6d('0x2d')][_0x6a6d('0x45')]){_0x70c00f[_0x6a6d('0x46')](createMessage(_0x376896,_0xd72b63,_0x51f90f,_0x247347['queryResult'][_0x6a6d('0x45')]));}}return Promise['all'](_0x70c00f)[_0x6a6d('0xe')](function(){if(_0x176039){_0x2e8503[_0x6a6d('0x18')]();}else{_0x2e8503[_0x6a6d('0x26')]();}})[_0x6a6d('0x11')](function(_0x434c8c){logger[_0x6a6d('0x12')](_0x6a6d('0x10'),_0x376896,JSON[_0x6a6d('0x13')](_0x434c8c));_0x2e8503[_0x6a6d('0x18')]();});}})[_0x6a6d('0x11')](function(_0x55de96){logger[_0x6a6d('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x376896,_0x55de96['message']);_0x2e8503[_0x6a6d('0x18')]();});}}catch(_0x4435c1){logger[_0x6a6d('0x12')](_0x6a6d('0x10'),_0x376896,JSON['stringify'](_0x4435c1));_0x2e8503[_0x6a6d('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 492b1e8..6bde841 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa58=['consequence','fromString','getMustacheRender','replace','error','map','message','join','stop','condition','priorityTrue','priorityFalse','info','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number'];(function(_0x2c8802,_0x367ffd){var _0x306649=function(_0x4ee5b4){while(--_0x4ee5b4){_0x2c8802['push'](_0x2c8802['shift']());}};_0x306649(++_0x367ffd);}(_0xaa58,0xed));var _0x8aa5=function(_0x3a737f,_0x2015a2){_0x3a737f=_0x3a737f-0x0;var _0x371231=_0xaa58[_0x3a737f];return _0x371231;};'use strict';var schema=require(_0x8aa5('0x0'));var _=require(_0x8aa5('0x1'));var htmlToText=require(_0x8aa5('0x2'));var utils=require(_0x8aa5('0x3'));var logger=require(_0x8aa5('0x4'))(_0x8aa5('0x5'));var gotoif=schema({'condition':{'type':_0x8aa5('0x6'),'required':!![],'message':_0x8aa5('0x7')},'priorityTrue':{'type':_0x8aa5('0x8'),'message':_0x8aa5('0x9')},'priorityFalse':{'type':_0x8aa5('0x8'),'message':_0x8aa5('0xa')}});exports[_0x8aa5('0xb')]=function(_0x31f8b4,_0x241e10){return function(_0x342fcc){try{var _0x1d1a53={'condition':htmlToText[_0x8aa5('0xc')](utils[_0x8aa5('0xd')](_0x241e10[0x0],this),{'wordwrap':![]})[_0x8aa5('0xe')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x241e10[0x1],'priorityFalse':_0x241e10[0x2]};var _0x41e7a3=gotoif[_0x8aa5('0x0')](_0x1d1a53,{'typecast':!![]});if(_0x41e7a3['length']){logger[_0x8aa5('0xf')]('[%s][GOTOIF]\x20%s',_0x31f8b4,_[_0x8aa5('0x10')](_0x41e7a3,_0x8aa5('0x11'))[_0x8aa5('0x12')](',\x20'));_0x342fcc[_0x8aa5('0x13')]();}else{try{var _0x232223=eval('('+_0x1d1a53[_0x8aa5('0x14')]+')');var _0x1969fe=_0x232223?_0x1d1a53[_0x8aa5('0x15')]:_0x1d1a53[_0x8aa5('0x16')];logger[_0x8aa5('0x17')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x31f8b4,_0x1d1a53['condition'],_0x232223,_0x1969fe||_0x8aa5('0x18'));if(_0x1969fe){var _0x59c52f=_[_0x8aa5('0x19')](_0x342fcc[_0x8aa5('0x1a')](),{'p':_0x1969fe});if(_0x59c52f>=0x0){logger[_0x8aa5('0x17')](_0x8aa5('0x1b'),_0x31f8b4,_0x1969fe||_0x8aa5('0x18'),_0x59c52f);_0x342fcc[_0x8aa5('0x18')](_0x59c52f);}else{logger['info'](_0x8aa5('0x1c'),_0x31f8b4,_0x1969fe||'next');_0x342fcc[_0x8aa5('0x13')]();}}else{_0x342fcc['next']();}}catch(_0x3d2f9d){logger[_0x8aa5('0xf')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x31f8b4,_0x3d2f9d['message']);_0x342fcc['stop']();}}}catch(_0x293db2){logger['error'](_0x8aa5('0x1d'),_0x31f8b4,JSON[_0x8aa5('0x1e')](_0x293db2));_0x342fcc[_0x8aa5('0x13')]();}};}; \ No newline at end of file +var _0x1c0d=['length','error','map','join','stop','condition','priorityTrue','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','message','[%s][GOTOIF]\x20%s','stringify','validate','lodash','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','fromString','getMustacheRender','replace'];(function(_0x314917,_0x5dd071){var _0x3e014e=function(_0x4473b0){while(--_0x4473b0){_0x314917['push'](_0x314917['shift']());}};_0x3e014e(++_0x5dd071);}(_0x1c0d,0x196));var _0xd1c0=function(_0x7c8321,_0x4af5de){_0x7c8321=_0x7c8321-0x0;var _0x1cb00a=_0x1c0d[_0x7c8321];return _0x1cb00a;};'use strict';var schema=require(_0xd1c0('0x0'));var _=require(_0xd1c0('0x1'));var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require(_0xd1c0('0x2'))('routing');var gotoif=schema({'condition':{'type':_0xd1c0('0x3'),'required':!![],'message':_0xd1c0('0x4')},'priorityTrue':{'type':_0xd1c0('0x5'),'message':_0xd1c0('0x6')},'priorityFalse':{'type':_0xd1c0('0x5'),'message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x551d72,_0x516966){return function(_0x500402){try{var _0x5e4f91={'condition':htmlToText[_0xd1c0('0x7')](utils[_0xd1c0('0x8')](_0x516966[0x0],this),{'wordwrap':![]})[_0xd1c0('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x516966[0x1],'priorityFalse':_0x516966[0x2]};var _0x2eead9=gotoif['validate'](_0x5e4f91,{'typecast':!![]});if(_0x2eead9[_0xd1c0('0xa')]){logger[_0xd1c0('0xb')]('[%s][GOTOIF]\x20%s',_0x551d72,_[_0xd1c0('0xc')](_0x2eead9,'message')[_0xd1c0('0xd')](',\x20'));_0x500402[_0xd1c0('0xe')]();}else{try{var _0x1c0042=eval('('+_0x5e4f91[_0xd1c0('0xf')]+')');var _0x41109c=_0x1c0042?_0x5e4f91[_0xd1c0('0x10')]:_0x5e4f91['priorityFalse'];logger['info'](_0xd1c0('0x11'),_0x551d72,_0x5e4f91[_0xd1c0('0xf')],_0x1c0042,_0x41109c||_0xd1c0('0x12'));if(_0x41109c){var _0x4d2b75=_[_0xd1c0('0x13')](_0x500402[_0xd1c0('0x14')](),{'p':_0x41109c});if(_0x4d2b75>=0x0){logger[_0xd1c0('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x551d72,_0x41109c||'next',_0x4d2b75);_0x500402['next'](_0x4d2b75);}else{logger[_0xd1c0('0x15')](_0xd1c0('0x16'),_0x551d72,_0x41109c||_0xd1c0('0x12'));_0x500402[_0xd1c0('0xe')]();}}else{_0x500402[_0xd1c0('0x12')]();}}catch(_0x30864d){logger[_0xd1c0('0xb')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x551d72,_0x30864d[_0xd1c0('0x17')]);_0x500402[_0xd1c0('0xe')]();}}}catch(_0x361807){logger['error'](_0xd1c0('0x18'),_0x551d72,JSON[_0xd1c0('0x19')](_0x361807));_0x500402['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 7a91e00..0a668f4 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 _0x013a=['length','error','[%s][GOTOP]\x20%s','message','join','stop','info','findIndex','priority','next','stringify','validate','lodash','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x175ce5,_0x152fe8){var _0x4ca75f=function(_0x5e1c4a){while(--_0x5e1c4a){_0x175ce5['push'](_0x175ce5['shift']());}};_0x4ca75f(++_0x152fe8);}(_0x013a,0xfb));var _0xa013=function(_0x38192c,_0x231e41){_0x38192c=_0x38192c-0x0;var _0x31d64e=_0x013a[_0x38192c];return _0x31d64e;};'use strict';var schema=require(_0xa013('0x0'));var _=require(_0xa013('0x1'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':_0xa013('0x2'),'required':!![],'message':_0xa013('0x3')}});exports['consequence']=function(_0x206056,_0x479b76){return function(_0x520386){try{var _0x2ac5ed={'priority':_0x479b76[0x0]};var _0xb71791=gotop[_0xa013('0x0')](_0x2ac5ed,{'typecast':!![]});if(_0xb71791[_0xa013('0x4')]){logger[_0xa013('0x5')](_0xa013('0x6'),_0x206056,_['map'](_0xb71791,_0xa013('0x7'))[_0xa013('0x8')](',\x20'));_0x520386[_0xa013('0x9')]();}else{logger[_0xa013('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x206056,_0x2ac5ed['priority']);if(_0x2ac5ed['priority']){var _0x53a242=_[_0xa013('0xb')](_0x520386['rules'](),{'p':_0x2ac5ed[_0xa013('0xc')]});if(_0x53a242>=0x0){logger[_0xa013('0xa')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x206056,_0x2ac5ed[_0xa013('0xc')]||_0xa013('0xd'),_0x53a242);_0x520386[_0xa013('0xd')](_0x53a242);}else{logger[_0xa013('0xa')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x206056,_0x2ac5ed[_0xa013('0xc')]||_0xa013('0xd'));_0x520386[_0xa013('0x9')]();}}else{_0x520386[_0xa013('0xd')]();}}}catch(_0x11c8fd){logger[_0xa013('0x5')]('[%s][GOTOP]\x20%s',_0x206056,JSON[_0xa013('0xe')](_0x11c8fd));_0x520386[_0xa013('0x9')]();}};}; \ No newline at end of file +var _0x7b79=['[%s][GOTOP]\x20%s','map','message','join','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','../../../../config/logger','routing','number','consequence','length'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x7b79,0xe4));var _0x97b7=function(_0x58bf72,_0x270672){_0x58bf72=_0x58bf72-0x0;var _0x5ac3aa=_0x7b79[_0x58bf72];return _0x5ac3aa;};'use strict';var schema=require(_0x97b7('0x0'));var _=require('lodash');var logger=require(_0x97b7('0x1'))(_0x97b7('0x2'));var gotop=schema({'priority':{'type':_0x97b7('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x97b7('0x4')]=function(_0x287335,_0x1d60b0){return function(_0x5a2a46){try{var _0x18b7ad={'priority':_0x1d60b0[0x0]};var _0x3dc7da=gotop[_0x97b7('0x0')](_0x18b7ad,{'typecast':!![]});if(_0x3dc7da[_0x97b7('0x5')]){logger['error'](_0x97b7('0x6'),_0x287335,_[_0x97b7('0x7')](_0x3dc7da,_0x97b7('0x8'))[_0x97b7('0x9')](',\x20'));_0x5a2a46[_0x97b7('0xa')]();}else{logger[_0x97b7('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x287335,_0x18b7ad[_0x97b7('0xc')]);if(_0x18b7ad[_0x97b7('0xc')]){var _0x304d9a=_[_0x97b7('0xd')](_0x5a2a46[_0x97b7('0xe')](),{'p':_0x18b7ad[_0x97b7('0xc')]});if(_0x304d9a>=0x0){logger[_0x97b7('0xb')](_0x97b7('0xf'),_0x287335,_0x18b7ad[_0x97b7('0xc')]||'next',_0x304d9a);_0x5a2a46['next'](_0x304d9a);}else{logger[_0x97b7('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x287335,_0x18b7ad['priority']||_0x97b7('0x10'));_0x5a2a46['stop']();}}else{_0x5a2a46[_0x97b7('0x10')]();}}}catch(_0x641b44){logger['error']('[%s][GOTOP]\x20%s',_0x287335,JSON[_0x97b7('0x11')](_0x641b44));_0x5a2a46['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index de40011..dc58f23 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 _0x07c8=['InteractionId','Message','then','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst'];(function(_0x4f78a8,_0x5e7afd){var _0x46f268=function(_0x5ee6d5){while(--_0x5ee6d5){_0x4f78a8['push'](_0x4f78a8['shift']());}};_0x46f268(++_0x5e7afd);}(_0x07c8,0x1aa));var _0x807c=function(_0x585d86,_0x1704ed){_0x585d86=_0x585d86-0x0;var _0x28ecff=_0x07c8[_0x585d86];return _0x28ecff;};'use strict';var _=require(_0x807c('0x0'));var utils=require('./utils');var logger=require(_0x807c('0x1'))(_0x807c('0x2'));var rpc={'chatMessage':require(_0x807c('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x807c('0x4')),'smsMessage':require(_0x807c('0x5')),'faxMessage':require(_0x807c('0x6')),'whatsappMessage':require(_0x807c('0x7'))};exports[_0x807c('0x8')]=function(_0x44d06f,_0x2e5230){return function(_0xc67ed8){try{var _0xa3f4b0={'body':utils[_0x807c('0x9')](_0x2e5230[0x0],this),'ContactId':this[_0x807c('0xa')]['id']};if(this[_0x807c('0xb')]===_0x807c('0xc')){_0xa3f4b0[_0x807c('0xd')]=this[_0x807c('0xe')]['id'];}else{_0xa3f4b0[_[_0x807c('0xf')](this[_0x807c('0xb')])+'AccountId']=this[_0x807c('0xe')]['id'];}_0xa3f4b0[_['upperFirst'](this['channel'])+_0x807c('0x10')]=this['interaction']['id'];if(rpc[this['channel']+'Message']){return rpc[this[_0x807c('0xb')]+_0x807c('0x11')]['create'](_0xa3f4b0)[_0x807c('0x12')](function(_0x2f1833){logger[_0x807c('0x13')](_0x807c('0x14'),_0x44d06f,_0xa3f4b0[_0x807c('0x15')]);_0xc67ed8['next']();})[_0x807c('0x16')](function(_0x2c306c){logger[_0x807c('0x17')]('[%s][MESSAGE]\x20%s',_0x44d06f,JSON[_0x807c('0x18')](_0x2c306c));_0xc67ed8['stop']();});}}catch(_0x57f897){logger[_0x807c('0x17')]('[%s][MESSAGE]\x20%s',_0x44d06f,JSON[_0x807c('0x18')](_0x57f897));_0xc67ed8[_0x807c('0x19')]();}};}; \ No newline at end of file +var _0x94a9=['Message','create','info','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','interaction'];(function(_0x37f71f,_0x5c5e66){var _0x3d65c2=function(_0x40b587){while(--_0x40b587){_0x37f71f['push'](_0x37f71f['shift']());}};_0x3d65c2(++_0x5c5e66);}(_0x94a9,0x127));var _0x994a=function(_0x4841ee,_0x19326b){_0x4841ee=_0x4841ee-0x0;var _0x3b34ee=_0x94a9[_0x4841ee];return _0x3b34ee;};'use strict';var _=require('lodash');var utils=require(_0x994a('0x0'));var logger=require(_0x994a('0x1'))(_0x994a('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x994a('0x3')),'mailMessage':require(_0x994a('0x4')),'smsMessage':require(_0x994a('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x994a('0x6'))};exports[_0x994a('0x7')]=function(_0x411023,_0x190ad0){return function(_0x5e71b8){try{var _0xaa33f4={'body':utils[_0x994a('0x8')](_0x190ad0[0x0],this),'ContactId':this[_0x994a('0x9')]['id']};if(this[_0x994a('0xa')]===_0x994a('0xb')){_0xaa33f4[_0x994a('0xc')]=this['account']['id'];}else{_0xaa33f4[_[_0x994a('0xd')](this['channel'])+_0x994a('0xe')]=this[_0x994a('0xf')]['id'];}_0xaa33f4[_[_0x994a('0xd')](this[_0x994a('0xa')])+'InteractionId']=this[_0x994a('0x10')]['id'];if(rpc[this['channel']+_0x994a('0x11')]){return rpc[this['channel']+_0x994a('0x11')][_0x994a('0x12')](_0xaa33f4)['then'](function(_0x2f22d0){logger[_0x994a('0x13')](_0x994a('0x14'),_0x411023,_0xaa33f4[_0x994a('0x15')]);_0x5e71b8[_0x994a('0x16')]();})['catch'](function(_0x1a4397){logger[_0x994a('0x17')](_0x994a('0x14'),_0x411023,JSON[_0x994a('0x18')](_0x1a4397));_0x5e71b8['stop']();});}}catch(_0x5ef505){logger[_0x994a('0x17')]('[%s][MESSAGE]\x20%s',_0x411023,JSON['stringify'](_0x5ef505));_0x5e71b8[_0x994a('0x19')]();}};}; \ 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 7e2a871..301d7bf 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 _0xa7d4=['[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','routing'];(function(_0x4b78f2,_0x44786e){var _0x45245b=function(_0x39c269){while(--_0x39c269){_0x4b78f2['push'](_0x4b78f2['shift']());}};_0x45245b(++_0x44786e);}(_0xa7d4,0x186));var _0x4a7d=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xa7d4[_0xb0f7c3];return _0x28ea68;};'use strict';var utils=require(_0x4a7d('0x0'));var logger=require('../../../../config/logger')(_0x4a7d('0x1'));exports['consequence']=function(_0x2b81f3,_0x39a133){return function(_0x3780b4){try{logger['info'](_0x4a7d('0x2'),_0x2b81f3,utils[_0x4a7d('0x3')](_0x39a133[0x0],this));_0x3780b4[_0x4a7d('0x4')]();}catch(_0x162bef){logger[_0x4a7d('0x5')]('[%s][NOOP]\x20%s',_0x2b81f3,JSON[_0x4a7d('0x6')](_0x162bef));_0x3780b4[_0x4a7d('0x7')]();}};}; \ No newline at end of file +var _0x49a3=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','stringify','stop','./utils','../../../../config/logger'];(function(_0x4c48bd,_0x4cce5a){var _0x534eb5=function(_0x29a22e){while(--_0x29a22e){_0x4c48bd['push'](_0x4c48bd['shift']());}};_0x534eb5(++_0x4cce5a);}(_0x49a3,0x11e));var _0x349a=function(_0x5e87ed,_0x5f0bb8){_0x5e87ed=_0x5e87ed-0x0;var _0xe24450=_0x49a3[_0x5e87ed];return _0xe24450;};'use strict';var utils=require(_0x349a('0x0'));var logger=require(_0x349a('0x1'))('routing');exports[_0x349a('0x2')]=function(_0x3784b5,_0x2517c2){return function(_0x1e558f){try{logger[_0x349a('0x3')](_0x349a('0x4'),_0x3784b5,utils[_0x349a('0x5')](_0x2517c2[0x0],this));_0x1e558f[_0x349a('0x6')]();}catch(_0x1468e7){logger['error'](_0x349a('0x4'),_0x3784b5,JSON[_0x349a('0x7')](_0x1468e7));_0x1e558f[_0x349a('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 9f40958..b4c0491 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 _0x008c=['contact','list','upperFirst','QueueId','InteractionId','interaction','message','channel','info','[%s][START:QUEUE][NAME:%s]','name','account','QueueReport','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','body','update','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','timeout','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','rrmemory','beepall','log','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','queue','clone','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x384e89,_0x538490){var _0x3b9ed3=function(_0x54a4cd){while(--_0x54a4cd){_0x384e89['push'](_0x384e89['shift']());}};_0x3b9ed3(++_0x538490);}(_0x008c,0x188));var _0xc008=function(_0x25ab51,_0x4f84f5){_0x25ab51=_0x25ab51-0x0;var _0x3b4aa0=_0x008c[_0x25ab51];return _0x3b4aa0;};'use strict';var schema=require(_0xc008('0x0'));var _=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var seqqueue=require(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var Redis=require('ioredis');var config=require(_0xc008('0x5'));var logger=require(_0xc008('0x6'))(_0xc008('0x7'));var strategy=require(_0xc008('0x8'));config[_0xc008('0x9')]=_[_0xc008('0xa')](config[_0xc008('0x9')],{'host':_0xc008('0xb'),'port':0x18eb});var io=require(_0xc008('0xc'))(new Redis(config['redis']));var attributes=['id',_0xc008('0xd'),'account',_0xc008('0xe'),'from','joinAt'];function emit(_0x27830d,_0x7231b4,_0x57c46d){io['to'](_0x27830d)['emit'](_0x7231b4,_0x57c46d);}function emitChannelQueueInteraction(_0x543eb8,_0x1eacfa,_0xc881aa,_0x5b2004,_0xae2dab,_0x332fd4,_0x2ea200,_0x2a5b4e){var _0x9ffa93=_[_0xc008('0xf')](_0xc881aa);_0x9ffa93[_0xc008('0xd')]=_0x2a5b4e;_0x9ffa93['queue']=_0x1eacfa;_0x9ffa93['account']=_0x5b2004;_0x9ffa93['id']=_0xae2dab;if(_0x332fd4){_0x2ea200[util[_0xc008('0x10')]('%sQueuesWaitingInteractions',_0x543eb8)][_0xae2dab]=_[_0xc008('0x11')](_0x9ffa93,attributes);}else{delete _0x2ea200[util[_0xc008('0x10')](_0xc008('0x12'),_0x543eb8)][_0xae2dab];}emit(util[_0xc008('0x10')](_0xc008('0x13'),_0x543eb8,_0x1eacfa),util['format']('%s_queue_waiting_interaction:%s',_0x543eb8,_0x332fd4?'save':_0xc008('0x14')),_[_0xc008('0x11')](_0x9ffa93,attributes));}var rpc={'openchannelQueueReport':require(_0xc008('0x15')),'mailQueueReport':require(_0xc008('0x16')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xc008('0x17'),'required':!![],'message':_0xc008('0x18')},'timeout':{'type':'number','message':_0xc008('0x19')}});function startRouting(_0x5906e6,_0x4bd611,_0x543e5d,_0x50261c){if(_0x5906e6&&_0x4bd611&&_0x543e5d){_0x4bd611[_0xc008('0x1a')]+=0x1;var _0x4b9726={'uniqueid':_0x5906e6,'from':_0x543e5d['body']?_0x543e5d['body']['from']:'','joinAt':moment()['format'](_0xc008('0x1b')),'ContactId':_0x543e5d[_0xc008('0x1c')]?_0x543e5d[_0xc008('0x1c')]['id']:null,'ListId':_0x543e5d[_0xc008('0x1d')]?_0x543e5d[_0xc008('0x1d')]['id']:null};_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+_0xc008('0x1f')]=_0x4bd611['id']||null;_0x4b9726[_['upperFirst'](_0x543e5d['channel'])+_0xc008('0x20')]=_0x543e5d[_0xc008('0x21')]?_0x543e5d[_0xc008('0x21')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+'MessageId']=_0x543e5d['message']?_0x543e5d[_0xc008('0x22')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d[_0xc008('0x23')])+(_0x543e5d[_0xc008('0x23')]!=='chat'?'AccountId':'WebsiteId')]=_0x543e5d['account']?_0x543e5d['account']['id']:null;logger[_0xc008('0x24')](util[_0xc008('0x10')](_0xc008('0x25'),_0x5906e6,_0x4bd611['name']));emitChannelQueueInteraction(_0x543e5d[_0xc008('0x23')],_0x4bd611[_0xc008('0x26')],_0x4b9726,_0x543e5d[_0xc008('0x27')][_0xc008('0x26')],_0x543e5d['message']['id'],!![],_0x50261c,_0x4bd611['id']);if(rpc[_0x543e5d[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x543e5d['channel']+'QueueReport']['create'](_0x4b9726)[_0xc008('0x29')](function(_0x267abd){logger[_0xc008('0x2a')](_0xc008('0x2b'));});}}}function stopRouting(_0x1de04b,_0xceebc3,_0x294f97,_0x22d8e8){if(_0x1de04b&&_0xceebc3){_0xceebc3[_0xc008('0x1a')]-=0x1;var _0x2b862d={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'acceptAt':moment()['format'](_0xc008('0x1b')),'reason':_0xc008('0x2c')};logger['info'](util[_0xc008('0x10')](_0xc008('0x2d'),_0x1de04b,_0xceebc3[_0xc008('0x26')]));emitChannelQueueInteraction(_0x294f97[_0xc008('0x23')],_0xceebc3[_0xc008('0x26')],_0x294f97[_0xc008('0x2e')],_0x294f97[_0xc008('0x27')][_0xc008('0x26')],_0x294f97[_0xc008('0x22')]['id'],![],_0x22d8e8,_0xceebc3['id']);if(rpc[_0x294f97['channel']+_0xc008('0x28')]){return rpc[_0x294f97[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x1de04b,_0x2b862d)[_0xc008('0x29')](function(_0x315562){logger[_0xc008('0x2a')]('update\x20queue\x20report');});}}}function endRouting(_0x35f360,_0x21763f,_0x50e1d4,_0x399b64){if(_0x35f360&&_0x21763f){_0x21763f[_0xc008('0x1a')]-=0x1;var _0x5e38d5={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'exitAt':moment()[_0xc008('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger['info'](util[_0xc008('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x35f360,_0x21763f[_0xc008('0x26')]));emitChannelQueueInteraction(_0x50e1d4[_0xc008('0x23')],_0x21763f[_0xc008('0x26')],_0x50e1d4[_0xc008('0x2e')],_0x50e1d4[_0xc008('0x27')][_0xc008('0x26')],_0x50e1d4[_0xc008('0x22')]['id'],![],_0x399b64);if(rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x35f360,_0x5e38d5)[_0xc008('0x29')](function(_0x2bf3fd){logger['error'](_0xc008('0x30'));});}}}function handleFindQueue(_0x23c4db){return function(_0x30b7df){return _0x30b7df[_0xc008('0x26')]['toLowerCase']()===_0x23c4db[_0xc008('0x31')]();};}exports[_0xc008('0x32')]=function(_0xc8cb91,_0x36e7ae,_0x2d142d,_0x5706bb){return function(_0x398cdd){try{var _0x3323f4={'name':_0x36e7ae[0x0],'timeout':_0x36e7ae[0x1]};var _0x3794b0=queue[_0xc008('0x0')](_0x3323f4,{'typecast':!![]});if(_0x3794b0[_0xc008('0x33')]){logger['error'](_0xc008('0x34'),_0xc8cb91,_[_0xc008('0x35')](_0x3794b0,_0xc008('0x22'))[_0xc008('0x36')](',\x20'));_0x398cdd['stop']();}else{var _0x26cd05=_[_0xc008('0x37')](_0x2d142d[_0x5706bb[_0xc008('0x23')]+'Queues'],handleFindQueue(_0x3323f4[_0xc008('0x26')]));if(_0x26cd05){startRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);var _0x49a176=(_0x26cd05[_0xc008('0x38')]||0xa)*0x3e8;var _0x5d3a72=(_0x3323f4[_0xc008('0x38')]||0x14)*0x3e8;var _0x213014,_0x5a5d85;if(_0x49a176>_0x5d3a72){_0x5d3a72=_0x49a176;}var _0x31007c=seqqueue[_0xc008('0x39')](_0x49a176);_0x31007c['id']=_0xc8cb91;_0x31007c[_0xc008('0x3a')]=_0x49a176;_0x31007c['qtimeout']=_0x5d3a72;_0x31007c[_0xc008('0x23')]=_0x5706bb[_0xc008('0x23')];_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3c'),function(){logger[_0xc008('0x24')](_0xc008('0x3d'),_0xc8cb91);stopRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x213014=undefined;_0x31007c['close'](!![]);if(_0x2d142d['rules'][_0xc8cb91]){delete _0x2d142d['rules'][_0xc8cb91];}_0x398cdd[_0xc008('0x3e')]();});_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3f'),function(){if(_0x2d142d[_0xc008('0x3b')][_0xc8cb91]){delete _0x2d142d[_0xc008('0x3b')][_0xc8cb91];}});_0x213014=setTimeout(function(){logger[_0xc008('0x24')](_0xc008('0x40'),_0xc8cb91);endRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x31007c[_0xc008('0x41')](!![]);_0x398cdd['next']();},_0x5d3a72);switch(_0x26cd05['strategy']){case'rrmemory':strategy[_0xc008('0x42')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);break;default:strategy[_0xc008('0x43')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);}}else{logger[_0xc008('0x2a')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xc8cb91,_0x3323f4[_0xc008('0x26')]);_0x398cdd[_0xc008('0x3e')]();}}}catch(_0x17ab1a){console[_0xc008('0x44')](_0x17ab1a);logger[_0xc008('0x2a')](_0xc008('0x34'),_0xc8cb91,_0x17ab1a[_0xc008('0x45')]);_0x398cdd[_0xc008('0x3e')]();}};}; \ No newline at end of file +var _0x55ca=['../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','QueueId','interaction','channel','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','create','catch','error','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','QueueReport','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','map','join','find','Queues','createQueue','atimeout','rules','end','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','from','joinAt','emit','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove'];(function(_0x52ffbe,_0x302515){var _0x56407e=function(_0x591330){while(--_0x591330){_0x52ffbe['push'](_0x52ffbe['shift']());}};_0x56407e(++_0x302515);}(_0x55ca,0x126));var _0xa55c=function(_0x5b7963,_0x10bff5){_0x5b7963=_0x5b7963-0x0;var _0x57f611=_0x55ca[_0x5b7963];return _0x57f611;};'use strict';var schema=require(_0xa55c('0x0'));var _=require(_0xa55c('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));var strategy=require(_0xa55c('0x5'));config[_0xa55c('0x6')]=_[_0xa55c('0x7')](config[_0xa55c('0x6')],{'host':_0xa55c('0x8'),'port':0x18eb});var io=require(_0xa55c('0x9'))(new Redis(config['redis']));var attributes=['id',_0xa55c('0xa'),_0xa55c('0xb'),'queue',_0xa55c('0xc'),_0xa55c('0xd')];function emit(_0x52a3bc,_0x5849ad,_0x473d0e){io['to'](_0x52a3bc)[_0xa55c('0xe')](_0x5849ad,_0x473d0e);}function emitChannelQueueInteraction(_0x381d07,_0x5d8e5a,_0x31646d,_0xe6d826,_0x508342,_0x70c2de,_0x3998f7,_0x15eec8){var _0x5d47ff=_['clone'](_0x31646d);_0x5d47ff[_0xa55c('0xa')]=_0x15eec8;_0x5d47ff['queue']=_0x5d8e5a;_0x5d47ff['account']=_0xe6d826;_0x5d47ff['id']=_0x508342;if(_0x70c2de){_0x3998f7[util['format'](_0xa55c('0xf'),_0x381d07)][_0x508342]=_[_0xa55c('0x10')](_0x5d47ff,attributes);}else{delete _0x3998f7[util[_0xa55c('0x11')](_0xa55c('0xf'),_0x381d07)][_0x508342];}emit(util[_0xa55c('0x11')](_0xa55c('0x12'),_0x381d07,_0x5d8e5a),util['format'](_0xa55c('0x13'),_0x381d07,_0x70c2de?_0xa55c('0x14'):_0xa55c('0x15')),_[_0xa55c('0x10')](_0x5d47ff,attributes));}var rpc={'openchannelQueueReport':require(_0xa55c('0x16')),'mailQueueReport':require(_0xa55c('0x17')),'chatQueueReport':require(_0xa55c('0x18')),'smsQueueReport':require(_0xa55c('0x19')),'faxQueueReport':require(_0xa55c('0x1a')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xa55c('0x1b'),'required':!![],'message':_0xa55c('0x1c')},'timeout':{'type':_0xa55c('0x1d'),'message':_0xa55c('0x1e')}});function startRouting(_0x23a1ae,_0x5426e5,_0x4c0daf,_0x5f5158){if(_0x23a1ae&&_0x5426e5&&_0x4c0daf){_0x5426e5[_0xa55c('0x1f')]+=0x1;var _0x3776ac={'uniqueid':_0x23a1ae,'from':_0x4c0daf[_0xa55c('0x20')]?_0x4c0daf['body'][_0xa55c('0xc')]:'','joinAt':moment()[_0xa55c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c0daf[_0xa55c('0x21')]?_0x4c0daf[_0xa55c('0x21')]['id']:null,'ListId':_0x4c0daf[_0xa55c('0x22')]?_0x4c0daf[_0xa55c('0x22')]['id']:null};_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf['channel'])+_0xa55c('0x24')]=_0x5426e5['id']||null;_0x3776ac[_['upperFirst'](_0x4c0daf['channel'])+'InteractionId']=_0x4c0daf[_0xa55c('0x25')]?_0x4c0daf['interaction']['id']:null;_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf[_0xa55c('0x26')])+_0xa55c('0x27')]=_0x4c0daf[_0xa55c('0x28')]?_0x4c0daf[_0xa55c('0x28')]['id']:null;_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf[_0xa55c('0x26')])+(_0x4c0daf[_0xa55c('0x26')]!==_0xa55c('0x29')?_0xa55c('0x2a'):_0xa55c('0x2b'))]=_0x4c0daf['account']?_0x4c0daf[_0xa55c('0xb')]['id']:null;logger[_0xa55c('0x2c')](util[_0xa55c('0x11')](_0xa55c('0x2d'),_0x23a1ae,_0x5426e5['name']));emitChannelQueueInteraction(_0x4c0daf[_0xa55c('0x26')],_0x5426e5[_0xa55c('0x2e')],_0x3776ac,_0x4c0daf[_0xa55c('0xb')][_0xa55c('0x2e')],_0x4c0daf[_0xa55c('0x28')]['id'],!![],_0x5f5158,_0x5426e5['id']);if(rpc[_0x4c0daf[_0xa55c('0x26')]+'QueueReport']){return rpc[_0x4c0daf[_0xa55c('0x26')]+'QueueReport'][_0xa55c('0x2f')](_0x3776ac)[_0xa55c('0x30')](function(_0x1cc53e){logger[_0xa55c('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x3d28fb,_0x2096ae,_0x331e58,_0x20da31){if(_0x3d28fb&&_0x2096ae){_0x2096ae[_0xa55c('0x1f')]-=0x1;var _0x1225c3={'leaveAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'acceptAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'reason':_0xa55c('0x33')};logger['info'](util['format'](_0xa55c('0x34'),_0x3d28fb,_0x2096ae[_0xa55c('0x2e')]));emitChannelQueueInteraction(_0x331e58['channel'],_0x2096ae[_0xa55c('0x2e')],_0x331e58[_0xa55c('0x20')],_0x331e58[_0xa55c('0xb')][_0xa55c('0x2e')],_0x331e58[_0xa55c('0x28')]['id'],![],_0x20da31,_0x2096ae['id']);if(rpc[_0x331e58[_0xa55c('0x26')]+_0xa55c('0x35')]){return rpc[_0x331e58[_0xa55c('0x26')]+_0xa55c('0x35')]['update'](_0x3d28fb,_0x1225c3)['catch'](function(_0x4b23d3){logger[_0xa55c('0x31')](_0xa55c('0x36'));});}}}function endRouting(_0x2bb4f0,_0x5802e4,_0x768408,_0x547930){if(_0x2bb4f0&&_0x5802e4){_0x5802e4[_0xa55c('0x1f')]-=0x1;var _0x4ad813={'leaveAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'exitAt':moment()[_0xa55c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa55c('0x37')};logger[_0xa55c('0x2c')](util['format'](_0xa55c('0x38'),_0x2bb4f0,_0x5802e4[_0xa55c('0x2e')]));emitChannelQueueInteraction(_0x768408['channel'],_0x5802e4['name'],_0x768408[_0xa55c('0x20')],_0x768408['account'][_0xa55c('0x2e')],_0x768408[_0xa55c('0x28')]['id'],![],_0x547930);if(rpc[_0x768408['channel']+'QueueReport']){return rpc[_0x768408['channel']+'QueueReport'][_0xa55c('0x39')](_0x2bb4f0,_0x4ad813)[_0xa55c('0x30')](function(_0x429336){logger[_0xa55c('0x31')](_0xa55c('0x36'));});}}}function handleFindQueue(_0x56d17c){return function(_0x3d52d8){return _0x3d52d8[_0xa55c('0x2e')][_0xa55c('0x3a')]()===_0x56d17c[_0xa55c('0x3a')]();};}exports[_0xa55c('0x3b')]=function(_0x23cef5,_0x554620,_0x386e34,_0x5ee63d){return function(_0x57a972){try{var _0x404e7f={'name':_0x554620[0x0],'timeout':_0x554620[0x1]};var _0x1f63d8=queue['validate'](_0x404e7f,{'typecast':!![]});if(_0x1f63d8[_0xa55c('0x3c')]){logger['error']('[%s][QUEUE]\x20%s',_0x23cef5,_[_0xa55c('0x3d')](_0x1f63d8,_0xa55c('0x28'))[_0xa55c('0x3e')](',\x20'));_0x57a972['stop']();}else{var _0x1b2708=_[_0xa55c('0x3f')](_0x386e34[_0x5ee63d['channel']+_0xa55c('0x40')],handleFindQueue(_0x404e7f['name']));if(_0x1b2708){startRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);var _0x39886a=(_0x1b2708[_0xa55c('0x37')]||0xa)*0x3e8;var _0x5be43f=(_0x404e7f[_0xa55c('0x37')]||0x14)*0x3e8;var _0x1dae70,_0x5d834d;if(_0x39886a>_0x5be43f){_0x5be43f=_0x39886a;}var _0x40c352=seqqueue[_0xa55c('0x41')](_0x39886a);_0x40c352['id']=_0x23cef5;_0x40c352[_0xa55c('0x42')]=_0x39886a;_0x40c352['qtimeout']=_0x5be43f;_0x40c352[_0xa55c('0x26')]=_0x5ee63d['channel'];_0x386e34[_0xa55c('0x43')][_0x23cef5]['on'](_0xa55c('0x44'),function(){logger[_0xa55c('0x2c')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x23cef5);stopRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);clearTimeout(_0x1dae70);_0x1dae70=undefined;_0x40c352[_0xa55c('0x45')](!![]);if(_0x386e34[_0xa55c('0x43')][_0x23cef5]){delete _0x386e34['rules'][_0x23cef5];}_0x57a972[_0xa55c('0x46')]();});_0x386e34[_0xa55c('0x43')][_0x23cef5]['on']('complete',function(){if(_0x386e34[_0xa55c('0x43')][_0x23cef5]){delete _0x386e34[_0xa55c('0x43')][_0x23cef5];}});_0x1dae70=setTimeout(function(){logger['info'](_0xa55c('0x47'),_0x23cef5);endRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);clearTimeout(_0x1dae70);_0x40c352[_0xa55c('0x45')](!![]);_0x57a972[_0xa55c('0x48')]();},_0x5be43f);switch(_0x1b2708[_0xa55c('0x49')]){case'rrmemory':strategy[_0xa55c('0x4a')](_0x40c352,_0x1b2708,_0x386e34,_0x5ee63d);break;default:strategy['beepall'](_0x40c352,_0x1b2708,_0x386e34,_0x5ee63d);}}else{logger[_0xa55c('0x31')](_0xa55c('0x4b'),_0x23cef5,_0x404e7f[_0xa55c('0x2e')]);_0x57a972['stop']();}}}catch(_0x39bd3d){console[_0xa55c('0x4c')](_0x39bd3d);logger['error'](_0xa55c('0x4d'),_0x23cef5,_0x39bd3d[_0xa55c('0x4e')]);_0x57a972[_0xa55c('0x46')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index c778a21..3dbe2b2 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 _0x6bdc=['prototype','push','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busy','busyQueue','showNotification',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','writeLog','STOP','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','realtime','routing','handleRun','bind','handleTimeout','timeout','drained','handleDrained'];(function(_0x2305dd,_0xf939bb){var _0x1d5a76=function(_0x4381c1){while(--_0x4381c1){_0x2305dd['push'](_0x2305dd['shift']());}};_0x1d5a76(++_0xf939bb);}(_0x6bdc,0x1e1));var _0xc6bd=function(_0x1f36e9,_0x12254e){_0x1f36e9=_0x1f36e9-0x0;var _0x17535c=_0x6bdc[_0x1f36e9];return _0x17535c;};'use strict';var _=require(_0xc6bd('0x0'));var uuid=require(_0xc6bd('0x1'));var util=require(_0xc6bd('0x2'));var logger=require(_0xc6bd('0x3'))('routing');var Agent=function(_0x3524db,_0x48fb3e,_0x541696,_0x9c4e0d){this[_0xc6bd('0x4')]=uuid['v4']();this[_0xc6bd('0x5')]=_0x3524db;this['agent']=_0x48fb3e;this[_0xc6bd('0x6')]=_0x541696;this[_0xc6bd('0x7')]=_0x9c4e0d;this[_0xc6bd('0x5')]['push'](this[_0xc6bd('0x8')][_0xc6bd('0x9')](this),this[_0xc6bd('0xa')]['bind'](this));this[_0xc6bd('0x5')]['on'](_0xc6bd('0xb'),this['handleTimeout'][_0xc6bd('0x9')](this));this[_0xc6bd('0x5')]['on'](_0xc6bd('0xc'),this[_0xc6bd('0xd')][_0xc6bd('0x9')](this));};Agent[_0xc6bd('0xe')][_0xc6bd('0xf')]=function(){this[_0xc6bd('0x5')][_0xc6bd('0xf')](this[_0xc6bd('0x8')][_0xc6bd('0x9')](this),this[_0xc6bd('0xa')][_0xc6bd('0x9')](this));};Agent[_0xc6bd('0xe')][_0xc6bd('0xd')]=function(){this['handleTimeout'](!![]);};Agent[_0xc6bd('0xe')][_0xc6bd('0x8')]=function(_0x1626b9){logger[_0xc6bd('0x10')](_0xc6bd('0x11'),this[_0xc6bd('0x5')]['id'],this[_0xc6bd('0x12')]['id']);if(_[_0xc6bd('0x13')](this['realtime']['agents'][this['agent']['id']])){logger['info'](_0xc6bd('0x14'),this[_0xc6bd('0x5')]['id'],this[_0xc6bd('0x12')]['id']);setTimeout(this[_0xc6bd('0xf')][_0xc6bd('0x9')](this),0x3e8);}else{if(this[_0xc6bd('0x7')][_0xc6bd('0x15')]||util[_0xc6bd('0x16')](this['squeue']['id'],this['realtime'][_0xc6bd('0x17')][this[_0xc6bd('0x12')]['id']],this[_0xc6bd('0x5')][_0xc6bd('0x18')],![])){this['realtime'][_0xc6bd('0x17')][this[_0xc6bd('0x12')]['id']][_0xc6bd('0x19')]=!![];this[_0xc6bd('0x6')]['agents'][this[_0xc6bd('0x12')]['id']][_0xc6bd('0x1a')]=undefined;util[_0xc6bd('0x1b')](this[_0xc6bd('0x4')],this[_0xc6bd('0x5')]['id'],this[_0xc6bd('0x6')][_0xc6bd('0x17')][this[_0xc6bd('0x12')]['id']],null,this[_0xc6bd('0x7')]);util['writeLog'](this[_0xc6bd('0x5')]['id'],this[_0xc6bd('0x6')]['agents'][this['agent']['id']],'RINGING'+(this['routing']['forcedOwnership']?_0xc6bd('0x1c'):''));}else{logger[_0xc6bd('0x10')](_0xc6bd('0x1d'),this[_0xc6bd('0x5')]['id'],this[_0xc6bd('0x12')]['id']);setTimeout(this[_0xc6bd('0xf')]['bind'](this),0x3e8);}}};Agent[_0xc6bd('0xe')][_0xc6bd('0xa')]=function(_0x36f1b4){if(_[_0xc6bd('0x13')](this[_0xc6bd('0x6')][_0xc6bd('0x17')][this[_0xc6bd('0x12')]['id']])){return logger[_0xc6bd('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xc6bd('0x5')]['id'],this['agent']['id']);}else{logger[_0xc6bd('0x10')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xc6bd('0x5')]['id'],this['agent']['id']);util[_0xc6bd('0x1e')](this[_0xc6bd('0x4')],this[_0xc6bd('0x5')]['id'],this[_0xc6bd('0x6')][_0xc6bd('0x17')][this[_0xc6bd('0x12')]['id']],null,this[_0xc6bd('0x7')]);this[_0xc6bd('0x6')][_0xc6bd('0x17')][this[_0xc6bd('0x12')]['id']][_0xc6bd('0x19')]=![];this[_0xc6bd('0x6')][_0xc6bd('0x17')][this['agent']['id']][_0xc6bd('0x1a')]=undefined;util[_0xc6bd('0x1f')](this['squeue']['id'],this[_0xc6bd('0x6')][_0xc6bd('0x17')][this[_0xc6bd('0x12')]['id']],_0x36f1b4?_0xc6bd('0x20'):'TIMEOUT');}if(!_0x36f1b4){setTimeout(this[_0xc6bd('0xf')][_0xc6bd('0x9')](this),0x3e8);}};function agent(_0x2de544,_0x1ec0ee,_0x288c9b,_0x3a74ef){return new Agent(_0x2de544,_0x1ec0ee,_0x288c9b,_0x3a74ef);}module['exports']=agent; \ No newline at end of file +var _0x2d88=['push','handleRun','bind','timeout','handleTimeout','drained','prototype','info','isNil','realtime','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','agents','channel','busy','busyQueue','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','notificationId','STOP','exports','lodash','uuid','./util','../../../../../config/logger','routing','squeue','agent'];(function(_0x2302c4,_0x19e0a6){var _0x2d7c3f=function(_0x3c909c){while(--_0x3c909c){_0x2302c4['push'](_0x2302c4['shift']());}};_0x2d7c3f(++_0x19e0a6);}(_0x2d88,0x110));var _0x82d8=function(_0x14c093,_0x12cae1){_0x14c093=_0x14c093-0x0;var _0x473746=_0x2d88[_0x14c093];return _0x473746;};'use strict';var _=require(_0x82d8('0x0'));var uuid=require(_0x82d8('0x1'));var util=require(_0x82d8('0x2'));var logger=require(_0x82d8('0x3'))(_0x82d8('0x4'));var Agent=function(_0x13ab3e,_0x407e78,_0x2923d2,_0x21346c){this['notificationId']=uuid['v4']();this[_0x82d8('0x5')]=_0x13ab3e;this[_0x82d8('0x6')]=_0x407e78;this['realtime']=_0x2923d2;this[_0x82d8('0x4')]=_0x21346c;this[_0x82d8('0x5')][_0x82d8('0x7')](this[_0x82d8('0x8')][_0x82d8('0x9')](this),this['handleTimeout'][_0x82d8('0x9')](this));this[_0x82d8('0x5')]['on'](_0x82d8('0xa'),this[_0x82d8('0xb')]['bind'](this));this[_0x82d8('0x5')]['on'](_0x82d8('0xc'),this['handleDrained'][_0x82d8('0x9')](this));};Agent[_0x82d8('0xd')][_0x82d8('0x7')]=function(){this[_0x82d8('0x5')]['push'](this[_0x82d8('0x8')]['bind'](this),this[_0x82d8('0xb')]['bind'](this));};Agent[_0x82d8('0xd')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0x82d8('0xd')][_0x82d8('0x8')]=function(_0x5e62a8){logger[_0x82d8('0xe')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x82d8('0x5')]['id'],this[_0x82d8('0x6')]['id']);if(_[_0x82d8('0xf')](this[_0x82d8('0x10')]['agents'][this['agent']['id']])){logger[_0x82d8('0xe')](_0x82d8('0x11'),this[_0x82d8('0x5')]['id'],this[_0x82d8('0x6')]['id']);setTimeout(this['push'][_0x82d8('0x9')](this),0x3e8);}else{if(this[_0x82d8('0x4')]['forcedOwnership']||util['isAgentAvailable'](this['squeue']['id'],this[_0x82d8('0x10')][_0x82d8('0x12')][this[_0x82d8('0x6')]['id']],this[_0x82d8('0x5')][_0x82d8('0x13')],![])){this[_0x82d8('0x10')][_0x82d8('0x12')][this[_0x82d8('0x6')]['id']][_0x82d8('0x14')]=!![];this[_0x82d8('0x10')]['agents'][this[_0x82d8('0x6')]['id']][_0x82d8('0x15')]=undefined;util['showNotification'](this['notificationId'],this['squeue']['id'],this[_0x82d8('0x10')]['agents'][this[_0x82d8('0x6')]['id']],null,this[_0x82d8('0x4')]);util[_0x82d8('0x16')](this[_0x82d8('0x5')]['id'],this[_0x82d8('0x10')][_0x82d8('0x12')][this[_0x82d8('0x6')]['id']],_0x82d8('0x17')+(this[_0x82d8('0x4')][_0x82d8('0x18')]?_0x82d8('0x19'):''));}else{logger[_0x82d8('0xe')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0x82d8('0x6')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0x82d8('0xd')][_0x82d8('0xb')]=function(_0x5f1384){if(_[_0x82d8('0xf')](this[_0x82d8('0x10')][_0x82d8('0x12')][this[_0x82d8('0x6')]['id']])){return logger[_0x82d8('0xe')](_0x82d8('0x11'),this[_0x82d8('0x5')]['id'],this[_0x82d8('0x6')]['id']);}else{logger[_0x82d8('0xe')](_0x82d8('0x1a'),this[_0x82d8('0x5')]['id'],this[_0x82d8('0x6')]['id']);util[_0x82d8('0x1b')](this[_0x82d8('0x1c')],this[_0x82d8('0x5')]['id'],this['realtime']['agents'][this[_0x82d8('0x6')]['id']],null,this[_0x82d8('0x4')]);this['realtime'][_0x82d8('0x12')][this[_0x82d8('0x6')]['id']][_0x82d8('0x14')]=![];this['realtime'][_0x82d8('0x12')][this[_0x82d8('0x6')]['id']][_0x82d8('0x15')]=undefined;util['writeLog'](this[_0x82d8('0x5')]['id'],this[_0x82d8('0x10')]['agents'][this[_0x82d8('0x6')]['id']],_0x5f1384?_0x82d8('0x1d'):'TIMEOUT');}if(!_0x5f1384){setTimeout(this[_0x82d8('0x7')][_0x82d8('0x9')](this),0x3e8);}};function agent(_0x44bb7e,_0x23628e,_0x5cb3d8,_0x4ff117){return new Agent(_0x44bb7e,_0x23628e,_0x5cb3d8,_0x4ff117);}module[_0x82d8('0x1e')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index f3835de..4ce62a1 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 _0xed02=['notificationId','squeue','queue','realtime','routing','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','isNil','Agents','length','agents','info','isAgentAvailable','writeLog','RINGING','busy','busyQueue','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','STOP','TIMEOUT','lodash','uuid','./util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed02,0x190));var _0x2ed0=function(_0x1fb932,_0xfa56d4){_0x1fb932=_0x1fb932-0x0;var _0x25ce50=_0xed02[_0x1fb932];return _0x25ce50;};'use strict';var _=require(_0x2ed0('0x0'));var uuid=require(_0x2ed0('0x1'));var util=require(_0x2ed0('0x2'));var logger=require('../../../../../config/logger')('routing');var Beepall=function(_0x3f57cb,_0x786eeb,_0x48ce66,_0xc08b55){this[_0x2ed0('0x3')]=uuid['v4']();this[_0x2ed0('0x4')]=_0x3f57cb;this[_0x2ed0('0x5')]=_0x786eeb;this[_0x2ed0('0x6')]=_0x48ce66;this[_0x2ed0('0x7')]=_0xc08b55;this[_0x2ed0('0x4')][_0x2ed0('0x8')](this['handleRun'][_0x2ed0('0x9')](this),this[_0x2ed0('0xa')][_0x2ed0('0x9')](this));this[_0x2ed0('0x4')]['on'](_0x2ed0('0xb'),this[_0x2ed0('0xa')][_0x2ed0('0x9')](this));this[_0x2ed0('0x4')]['on'](_0x2ed0('0xc'),this[_0x2ed0('0xd')]['bind'](this));};Beepall[_0x2ed0('0xe')][_0x2ed0('0x8')]=function(){this['squeue'][_0x2ed0('0x8')](this[_0x2ed0('0xf')][_0x2ed0('0x9')](this),this[_0x2ed0('0xa')]['bind'](this));};Beepall[_0x2ed0('0xe')][_0x2ed0('0xd')]=function(_0x8e91d5){this[_0x2ed0('0xa')](!![]);};Beepall['prototype']['handleRun']=function(_0x5701a2){var _0x180bc5=!![];if(!_[_0x2ed0('0x10')](this[_0x2ed0('0x5')])&&!_[_0x2ed0('0x10')](this[_0x2ed0('0x5')][_0x2ed0('0x11')])&&this[_0x2ed0('0x5')][_0x2ed0('0x11')][_0x2ed0('0x12')]>0x0){for(var _0x2fe6b8=0x0,_0x309bef;_0x2fe6b80x0){for(var _0x3acba9=0x0,_0x578987;_0x3acba90x0&&_0x509d06[_0x3d4941+_0x366d('0x25')]>=_0x509d06[_0x3d4941+'Capacity']){writeLog(_0x3c540d,_0x509d06,_0x3d4941['toUpperCase']()+_0x366d('0x26'));return![];}}return!![];};exports[_0x366d('0x27')]=function(_0x31957c,_0x2c6637,_0x552c86,_0x413307,_0x5dc954){return sendNotification(!![],_0x31957c,_0x2c6637,_0x552c86,_0x413307,_0x5dc954);};exports[_0x366d('0x28')]=function(_0x13a6b2,_0x594d42,_0x535b26,_0xa856fa,_0x13aaca){return sendNotification(![],_0x13a6b2,_0x594d42,_0x535b26,_0xa856fa,_0x13aaca);};exports[_0x366d('0x29')]=writeLog; \ No newline at end of file +var _0xdbe1=['showNotification','hideNotification','writeLog','lodash','../utils','ioredis','../../../../../config/environment','routing','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','name','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','OFFLINE','Pause','PAUSE','Capacity','CurrentCapacity','toUpperCase'];(function(_0x3a805b,_0x22617d){var _0x815aca=function(_0x1d5295){while(--_0x1d5295){_0x3a805b['push'](_0x3a805b['shift']());}};_0x815aca(++_0x22617d);}(_0xdbe1,0x137));var _0x1dbe=function(_0x336c55,_0x53db5e){_0x336c55=_0x336c55-0x0;var _0x1d9337=_0xdbe1[_0x336c55];return _0x1d9337;};'use strict';var _=require(_0x1dbe('0x0'));var util=require('util');var utils=require(_0x1dbe('0x1'));var Mustache=require('mustache');var Redis=require(_0x1dbe('0x2'));var config=require(_0x1dbe('0x3'));var logger=require('../../../../../config/logger')(_0x1dbe('0x4'));config[_0x1dbe('0x5')]=_[_0x1dbe('0x6')](config['redis'],{'host':_0x1dbe('0x7'),'port':0x18eb});var io=require(_0x1dbe('0x8'))(new Redis(config[_0x1dbe('0x5')]));function emit(_0xbf2b82,_0x273807,_0x41d38d){io['to'](_0xbf2b82)[_0x1dbe('0x9')](_0x273807,_0x41d38d);}function sendNotification(_0x3267cf,_0xa25384,_0x3cf8cb,_0x246d18,_0x8c6c59,_0x108e08){io['to'](util[_0x1dbe('0xa')](_0x1dbe('0xb'),_0x246d18[_0x1dbe('0xc')]))['emit'](_0x1dbe('0xd'),_0x246d18);var _0x40d270=_0x108e08||{};var _0x25a170=_0x3cf8cb[_0x1dbe('0xe')]('.');var _0x2ab040={'uniqueid':_0xa25384,'channel':_0x25a170[0x0],'id':_0x25a170[0x1],'title':_0x25a170[0x0]+_0x1dbe('0xf'),'interactionId':_0x25a170[0x2],'queue':_0x8c6c59?_0x8c6c59['name']:null,'sound':_0x40d270[_0x1dbe('0x10')][_0x1dbe('0x11')],'shake':_0x40d270[_0x1dbe('0x10')][_0x1dbe('0x12')]};try{if(!_0x40d270[_0x1dbe('0x13')]){_0x40d270[_0x1dbe('0x13')]={};}if(_0x8c6c59){_0x40d270[_0x1dbe('0x13')][_0x1dbe('0x14')]=_0x8c6c59;}else if(_0x40d270[_0x1dbe('0x13')][_0x1dbe('0x14')]){delete _0x40d270[_0x1dbe('0x13')][_0x1dbe('0x14')];}_0x2ab040[_0x1dbe('0x15')]=utils[_0x1dbe('0x16')](_0x40d270[_0x1dbe('0x10')][_0x1dbe('0x17')],_0x40d270);}catch(_0x1d30c5){_0x2ab040[_0x1dbe('0x15')]=_0x1dbe('0x18');logger['error'](util['format'](_0x1dbe('0x19'),_0xa25384,_0x1d30c5[_0x1dbe('0x1a')]));}io['to'](util[_0x1dbe('0xa')]('user:%s',_0x246d18['name']))[_0x1dbe('0x9')](util[_0x1dbe('0xa')](_0x1dbe('0x1b'),_0x3267cf?_0x1dbe('0x1c'):_0x1dbe('0x1d')),_0x2ab040);}function writeLog(_0x7e22ad,_0x3abcff,_0x192c75){return logger[_0x1dbe('0x1e')](util[_0x1dbe('0xa')](_0x1dbe('0x1f'),_0x7e22ad,_0x3abcff[_0x1dbe('0xc')],_0x192c75));}exports[_0x1dbe('0x20')]=function(_0x1f6230,_0x3e4e31,_0x110b52,_0x44a9ce){if(_0x3e4e31[_0x1dbe('0x21')]){writeLog(_0x1f6230,_0x3e4e31,_0x1dbe('0x22'));return![];}if(!_0x3e4e31['online']){writeLog(_0x1f6230,_0x3e4e31,_0x1dbe('0x23'));return![];}if(_0x3e4e31[_0x110b52+_0x1dbe('0x24')]){writeLog(_0x1f6230,_0x3e4e31,_0x1dbe('0x25'));return![];}if(_0x44a9ce&&_0x3e4e31['hasOwnProperty'](_0x110b52+_0x1dbe('0x26'))&&_0x3e4e31['hasOwnProperty'](_0x110b52+_0x1dbe('0x27'))){if(_0x3e4e31[_0x110b52+_0x1dbe('0x26')]>0x0&&_0x3e4e31[_0x110b52+_0x1dbe('0x27')]>=_0x3e4e31[_0x110b52+_0x1dbe('0x26')]){writeLog(_0x1f6230,_0x3e4e31,_0x110b52[_0x1dbe('0x28')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x1dbe('0x29')]=function(_0x25be03,_0x552bf7,_0x5230d8,_0x177f59,_0x5754ef){return sendNotification(!![],_0x25be03,_0x552bf7,_0x5230d8,_0x177f59,_0x5754ef);};exports[_0x1dbe('0x2a')]=function(_0xd200cd,_0xc315b6,_0x3498f5,_0x1da31d,_0x56004a){return sendNotification(![],_0xd200cd,_0xc315b6,_0x3498f5,_0x1da31d,_0x56004a);};exports[_0x1dbe('0x2b')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index da63184..632eee0 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 _0x0e86=['[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim'];(function(_0xaf7223,_0x3972c0){var _0x4562db=function(_0x3d7891){while(--_0x3d7891){_0xaf7223['push'](_0xaf7223['shift']());}};_0x4562db(++_0x3972c0);}(_0x0e86,0x19d));var _0x60e8=function(_0x245217,_0x2083a1){_0x245217=_0x245217-0x0;var _0x3e53fe=_0x0e86[_0x245217];return _0x3e53fe;};'use strict';var schema=require(_0x60e8('0x0'));var sh=require(_0x60e8('0x1'));var _=require(_0x60e8('0x2'));var utils=require(_0x60e8('0x3'));var logger=require(_0x60e8('0x4'))(_0x60e8('0x5'));var system=schema({'command':{'type':_0x60e8('0x6'),'required':!![],'message':_0x60e8('0x7')}});exports[_0x60e8('0x8')]=function(_0x189910,_0x50f17a){return function(_0x1a43e1){try{var _0x4d6cf1={'command':_0x50f17a[0x0]};var _0xc114c2=system[_0x60e8('0x0')](_0x4d6cf1,{'typecast':!![]});if(_0xc114c2[_0x60e8('0x9')]){logger[_0x60e8('0xa')](_0x60e8('0xb'),_0x189910,_[_0x60e8('0xc')](_0xc114c2,_0x60e8('0xd'))[_0x60e8('0xe')](',\x20'));logger['info'](_0x60e8('0xf'),_0x189910);_0x1a43e1[_0x60e8('0x10')]();}else{var _0x2e08af=this;var _0x470e2d=utils[_0x60e8('0x11')](_0x50f17a[0x0],this);logger[_0x60e8('0x12')](_0x60e8('0x13'),_0x189910,_0x470e2d);sh[_0x60e8('0x14')](_[_0x60e8('0x15')](_0x470e2d),function(_0x687983,_0x36dd32){logger[_0x60e8('0x12')](_0x60e8('0x16'),_0x189910,_0x687983);if(_0x687983==0x0){var _0x310682=_0x36dd32['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x60e8('0x17')](_0x50f17a[0x1])||_[_0x60e8('0x18')](_0x50f17a[0x1])){logger[_0x60e8('0x12')]('[%s][SYSTEM]\x20no\x20variable',_0x189910);_0x2e08af['body'][_0x50f17a[0x1]]=_0x310682;}else{logger[_0x60e8('0x12')](_0x60e8('0x19'),_0x189910,_0x50f17a[0x1],_0x310682);_0x2e08af[_0x60e8('0x1a')][_0x50f17a[0x1]]=_0x310682;}}_0x1a43e1['next']();});}}catch(_0x358ae9){logger[_0x60e8('0xa')](_0x60e8('0xb'),_0x189910,_[_0x60e8('0x1b')](_0x358ae9)?JSON[_0x60e8('0x1c')](_0x358ae9):_0x358ae9);logger[_0x60e8('0x12')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x189910);_0x1a43e1[_0x60e8('0x10')]();}};}; \ No newline at end of file +var _0xbfb1=['replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','validate','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','trim','[%s][SYSTEM]\x20result\x20code:\x20%s'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xbfb1,0x1b6));var _0x1bfb=function(_0x16d911,_0x4026a1){_0x16d911=_0x16d911-0x0;var _0x1e9d6e=_0xbfb1[_0x16d911];return _0x1e9d6e;};'use strict';var schema=require(_0x1bfb('0x0'));var sh=require(_0x1bfb('0x1'));var _=require(_0x1bfb('0x2'));var utils=require(_0x1bfb('0x3'));var logger=require(_0x1bfb('0x4'))(_0x1bfb('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':_0x1bfb('0x6')}});exports['consequence']=function(_0x28d6a7,_0x2b33d9){return function(_0x232713){try{var _0x27dd2a={'command':_0x2b33d9[0x0]};var _0x1fd8a5=system[_0x1bfb('0x0')](_0x27dd2a,{'typecast':!![]});if(_0x1fd8a5[_0x1bfb('0x7')]){logger[_0x1bfb('0x8')](_0x1bfb('0x9'),_0x28d6a7,_[_0x1bfb('0xa')](_0x1fd8a5,_0x1bfb('0xb'))['join'](',\x20'));logger[_0x1bfb('0xc')](_0x1bfb('0xd'),_0x28d6a7);_0x232713[_0x1bfb('0xe')]();}else{var _0x24639a=this;var _0x2ac33c=utils[_0x1bfb('0xf')](_0x2b33d9[0x0],this);logger[_0x1bfb('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x28d6a7,_0x2ac33c);sh['exec'](_[_0x1bfb('0x10')](_0x2ac33c),function(_0x34e2db,_0x356cca){logger['info'](_0x1bfb('0x11'),_0x28d6a7,_0x34e2db);if(_0x34e2db==0x0){var _0x1a29a1=_0x356cca[_0x1bfb('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x1bfb('0x13')](_0x2b33d9[0x1])||_[_0x1bfb('0x14')](_0x2b33d9[0x1])){logger[_0x1bfb('0xc')](_0x1bfb('0x15'),_0x28d6a7);_0x24639a[_0x1bfb('0x16')][_0x2b33d9[0x1]]=_0x1a29a1;}else{logger[_0x1bfb('0xc')](_0x1bfb('0x17'),_0x28d6a7,_0x2b33d9[0x1],_0x1a29a1);_0x24639a[_0x1bfb('0x16')][_0x2b33d9[0x1]]=_0x1a29a1;}}_0x232713['next']();});}}catch(_0x58e3b6){logger[_0x1bfb('0x8')]('[%s][SYSTEM]\x20%s',_0x28d6a7,_['isObject'](_0x58e3b6)?JSON['stringify'](_0x58e3b6):_0x58e3b6);logger[_0x1bfb('0xc')](_0x1bfb('0xd'),_0x28d6a7);_0x232713['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 2adb5ac..6705130 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 _0x9f88=['then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','[%s][TAG]\x20%s','stringify','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','consequence','length','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction'];(function(_0x130fad,_0x42d9f6){var _0x58114c=function(_0x4694be){while(--_0x4694be){_0x130fad['push'](_0x130fad['shift']());}};_0x58114c(++_0x42d9f6);}(_0x9f88,0x1b0));var _0x89f8=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9f88[_0x3947c9];return _0x2e7871;};'use strict';var schema=require(_0x89f8('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x89f8('0x1')),'openchannelInteraction':require(_0x89f8('0x2')),'smsInteraction':require(_0x89f8('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x89f8('0x4')),'whatsappInteraction':require(_0x89f8('0x5'))};var logger=require(_0x89f8('0x6'))('routing');var tag=schema({'tag':{'type':_0x89f8('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x89f8('0x8')]=function(_0x435e29,_0x1d0ab2,_0x924570,_0x27dac7){return function(_0x11a374){try{var _0x4b9bc3={'tag':_0x1d0ab2[0x0]};var _0x9c7596=tag['validate'](_0x4b9bc3,{'typecast':!![]});if(_0x9c7596[_0x89f8('0x9')]){logger['error']('[%s][TAG]\x20%s',_0x435e29,_['map'](_0x9c7596,'message')[_0x89f8('0xa')](',\x20'));logger[_0x89f8('0xb')](_0x89f8('0xc'),_0x435e29);_0x11a374[_0x89f8('0xd')]();}else{var _0x3cf129={'ids':[_0x1d0ab2[0x0]]};if(rpc[_0x27dac7[_0x89f8('0xe')]+'Interaction']){rpc[_0x27dac7[_0x89f8('0xe')]+_0x89f8('0xf')][_0x89f8('0x10')](_0x27dac7[_0x89f8('0x11')]['id'],_0x3cf129)[_0x89f8('0x12')](function(_0xded174){logger[_0x89f8('0xb')](_0x89f8('0x13'),_0x435e29,_0x1d0ab2[0x1],_0x27dac7[_0x89f8('0xe')],_0x27dac7[_0x89f8('0x11')]['id']);})[_0x89f8('0x14')](function(_0x34d166){logger[_0x89f8('0x15')](_0x89f8('0x16'),_0x435e29,JSON[_0x89f8('0x17')](_0x34d166));logger['info'](_0x89f8('0xc'),_0x435e29);})['finally'](function(){_0x11a374[_0x89f8('0xd')]();});}}}catch(_0x1c4efe){logger['error'](_0x89f8('0x16'),_0x435e29,_[_0x89f8('0x18')](_0x1c4efe)?JSON[_0x89f8('0x17')](_0x1c4efe):_0x1c4efe);logger[_0x89f8('0xb')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x435e29);_0x11a374[_0x89f8('0xd')]();}};}; \ No newline at end of file +var _0x1983=['info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','message','join'];(function(_0x2a8778,_0xdf321b){var _0xefe26a=function(_0xd83b4d){while(--_0xd83b4d){_0x2a8778['push'](_0x2a8778['shift']());}};_0xefe26a(++_0xdf321b);}(_0x1983,0x185));var _0x3198=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x1983[_0x3826ad];return _0x17b900;};'use strict';var schema=require(_0x3198('0x0'));var _=require(_0x3198('0x1'));var rpc={'chatInteraction':require(_0x3198('0x2')),'openchannelInteraction':require(_0x3198('0x3')),'smsInteraction':require(_0x3198('0x4')),'mailInteraction':require(_0x3198('0x5')),'faxInteraction':require(_0x3198('0x6')),'whatsappInteraction':require(_0x3198('0x7'))};var logger=require(_0x3198('0x8'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0x3198('0x9')}});exports[_0x3198('0xa')]=function(_0x2c399,_0x5738d6,_0x4c4e97,_0xff4a6){return function(_0x202929){try{var _0x23ffc3={'tag':_0x5738d6[0x0]};var _0x1c6473=tag[_0x3198('0x0')](_0x23ffc3,{'typecast':!![]});if(_0x1c6473[_0x3198('0xb')]){logger[_0x3198('0xc')](_0x3198('0xd'),_0x2c399,_['map'](_0x1c6473,_0x3198('0xe'))[_0x3198('0xf')](',\x20'));logger[_0x3198('0x10')](_0x3198('0x11'),_0x2c399);_0x202929[_0x3198('0x12')]();}else{var _0x49d87d={'ids':[_0x5738d6[0x0]]};if(rpc[_0xff4a6[_0x3198('0x13')]+'Interaction']){rpc[_0xff4a6[_0x3198('0x13')]+_0x3198('0x14')][_0x3198('0x15')](_0xff4a6['interaction']['id'],_0x49d87d)['then'](function(_0x4c82ff){logger[_0x3198('0x10')](_0x3198('0x16'),_0x2c399,_0x5738d6[0x1],_0xff4a6[_0x3198('0x13')],_0xff4a6[_0x3198('0x17')]['id']);})['catch'](function(_0x1a1fd1){logger[_0x3198('0xc')](_0x3198('0xd'),_0x2c399,JSON[_0x3198('0x18')](_0x1a1fd1));logger[_0x3198('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2c399);})[_0x3198('0x19')](function(){_0x202929['next']();});}}}catch(_0x26e83d){logger[_0x3198('0xc')](_0x3198('0xd'),_0x2c399,_[_0x3198('0x1a')](_0x26e83d)?JSON['stringify'](_0x26e83d):_0x26e83d);logger[_0x3198('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2c399);_0x202929[_0x3198('0x12')]();}};}; \ 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 766d1a6..f7a9a14 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 _0xa8eb=['exports','render','merge','contact','message','interaction','mustache'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8eb,0x179));var _0xba8e=function(_0x6b9f95,_0x1020e5){_0x6b9f95=_0x6b9f95-0x0;var _0x487a7b=_0xa8eb[_0x6b9f95];return _0x487a7b;};'use strict';var Mustache=require(_0xba8e('0x0'));var _=require('lodash');module[_0xba8e('0x1')]={'getMustacheRender':function(_0x5757ad,_0xd7f19f){return Mustache[_0xba8e('0x2')](_0x5757ad,_[_0xba8e('0x3')](_0xd7f19f['body'],{'contact':_0xd7f19f[_0xba8e('0x4')],'message':_0xd7f19f[_0xba8e('0x5')],'account':_0xd7f19f['account'],'interaction':_0xd7f19f[_0xba8e('0x6')],'list':_0xd7f19f['list']}))||'';}}; \ No newline at end of file +var _0x3dd5=['render','merge','body','contact','message','account','list','mustache','exports'];(function(_0x4843c,_0x157391){var _0x5a27bb=function(_0x40710a){while(--_0x40710a){_0x4843c['push'](_0x4843c['shift']());}};_0x5a27bb(++_0x157391);}(_0x3dd5,0x73));var _0x53dd=function(_0x920149,_0x3891aa){_0x920149=_0x920149-0x0;var _0xf2a9aa=_0x3dd5[_0x920149];return _0xf2a9aa;};'use strict';var Mustache=require(_0x53dd('0x0'));var _=require('lodash');module[_0x53dd('0x1')]={'getMustacheRender':function(_0x3e9198,_0x45d521){return Mustache[_0x53dd('0x2')](_0x3e9198,_[_0x53dd('0x3')](_0x45d521[_0x53dd('0x4')],{'contact':_0x45d521[_0x53dd('0x5')],'message':_0x45d521[_0x53dd('0x6')],'account':_0x45d521[_0x53dd('0x7')],'interaction':_0x45d521['interaction'],'list':_0x45d521[_0x53dd('0x8')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 9797076..01a0bb0 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 _0x3561=['./applications/','priority','Push\x20new\x20rule','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','isNil','IntervalId','Intervals','interval','listen','rules','message','interaction','applications','isArray','length','existsSync','.js','app','toLowerCase','autoreply','split','channel','push','join','appdata','slice','dialogflowv2','amazonlex','tag','TagId','format','%s:%s:%s','condition','intervals'];(function(_0x141843,_0xa3a75b){var _0x1b3637=function(_0xbeb60){while(--_0xbeb60){_0x141843['push'](_0x141843['shift']());}};_0x1b3637(++_0xa3a75b);}(_0x3561,0x94));var _0x1356=function(_0x2bf1e1,_0x1dec7b){_0x2bf1e1=_0x2bf1e1-0x0;var _0x14f886=_0x3561[_0x2bf1e1];return _0x14f886;};'use strict';var _=require(_0x1356('0x0'));var util=require('util');var path=require(_0x1356('0x1'));var fs=require('fs');var jayson=require(_0x1356('0x2'));var BPromise=require(_0x1356('0x3'));var uuid=require(_0x1356('0x4'));var config=require(_0x1356('0x5'));var logger=require(_0x1356('0x6'))(_0x1356('0x7'));var rpc={'openchannelQueueReport':require(_0x1356('0x8')),'mailQueueReport':require(_0x1356('0x9')),'chatQueueReport':require(_0x1356('0xa')),'smsQueueReport':require(_0x1356('0xb')),'faxQueueReport':require(_0x1356('0xc')),'whatsappQueueReport':require(_0x1356('0xd'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x105aaf,_0x33529f,_0x1e98ae){return util['format']('%s.%s.%s',_0x105aaf,_0x33529f||0x0,_0x1e98ae||0x0);}function getIntervals(_0x4e1adb,_0x101c23){var _0x4f2abe=[];if(!_[_0x1356('0xe')](_0x101c23['IntervalId'])&&!_[_0x1356('0xe')](_0x4e1adb[_0x101c23[_0x1356('0xf')]])&&!_['isNil'](_0x4e1adb[_0x101c23[_0x1356('0xf')]][_0x1356('0x10')])){_0x4f2abe=_['map'](_0x4e1adb[_0x101c23[_0x1356('0xf')]][_0x1356('0x10')],_0x1356('0x11'));}else if(!_[_0x1356('0xe')](_0x101c23[_0x1356('0x11')])){_0x4f2abe=[_0x101c23[_0x1356('0x11')]];}return _0x4f2abe;}exports[_0x1356('0x12')]=function(_0x3c8b32){_0x3c8b32[_0x1356('0x13')]={};return new BPromise(function(_0x324102,_0x396402){var _0xdeeff2={'Start':function(_0x58975b){var _0x47a952=this;return new Promise(function(_0x593f6d,_0x61991a){if(_0x58975b){try{var _0x3c2adc=[];var _0x11fdf2=getId(_0x58975b['channel'],_0x58975b[_0x1356('0x14')]?_0x58975b[_0x1356('0x14')]['id']:0x0,_0x58975b[_0x1356('0x15')]?_0x58975b[_0x1356('0x15')]['id']:0x0);if(_0x58975b[_0x1356('0x16')]&&_[_0x1356('0x17')](_0x58975b[_0x1356('0x16')])&&_0x58975b[_0x1356('0x16')][_0x1356('0x18')]){for(var _0x370a91=0x0;_0x370a91<_0x58975b[_0x1356('0x16')][_0x1356('0x18')];_0x370a91+=0x1){var _0x1915b5=_0x58975b['applications'][_0x370a91];if(fs[_0x1356('0x19')](path['join'](__dirname,_0x1356('0x16'),_0x1915b5['app']+_0x1356('0x1a')))){var _0x36adc3=[];switch(_0x1915b5[_0x1356('0x1b')][_0x1356('0x1c')]()){case _0x1356('0x1d'):var _0x43e3b2=_0x1915b5['appdata'][_0x1356('0x1e')](',');if(_0x58975b[_0x1356('0x1f')]==='mail'){_0x36adc3[_0x1356('0x20')](_0x43e3b2[0x0]);_0x36adc3[_0x1356('0x20')](_0x43e3b2[0x1]);_0x36adc3[_0x1356('0x20')](_0x43e3b2['slice'](0x2,_0x43e3b2[_0x1356('0x18')])[_0x1356('0x21')](','));}else{_0x36adc3[_0x1356('0x20')](_0x43e3b2[0x0]);_0x36adc3[_0x1356('0x20')](_0x43e3b2['slice'](0x1,_0x43e3b2['length'])[_0x1356('0x21')](','));}break;case'dialogflow':var _0x9961c3=_0x1915b5[_0x1356('0x22')][_0x1356('0x1e')](',');_0x36adc3[_0x1356('0x20')](_0x9961c3[0x0]);_0x36adc3[_0x1356('0x20')](_0x9961c3[0x1]);_0x36adc3['push'](_0x9961c3[_0x1356('0x23')](0x2,_0x9961c3[_0x1356('0x18')])[_0x1356('0x21')](','));break;case _0x1356('0x24'):var _0x3a479f=_0x1915b5[_0x1356('0x22')]['split'](',');_0x36adc3[_0x1356('0x20')](_0x3a479f[0x0]);_0x36adc3['push'](_0x3a479f[0x1]);_0x36adc3[_0x1356('0x20')](_0x3a479f[0x2]);_0x36adc3['push'](_0x3a479f[0x3]);_0x36adc3['push'](_0x3a479f[_0x1356('0x23')](0x4,_0x3a479f[_0x1356('0x18')])['join'](','));break;case _0x1356('0x25'):var _0x4279ce=_0x1915b5[_0x1356('0x22')][_0x1356('0x1e')](',');_0x36adc3[_0x1356('0x20')](_0x4279ce[0x0]);_0x36adc3[_0x1356('0x20')](_0x4279ce[0x1]);_0x36adc3[_0x1356('0x20')](_0x4279ce[0x2]);_0x36adc3['push'](_0x4279ce[0x3]);_0x36adc3[_0x1356('0x20')](_0x4279ce[_0x1356('0x23')](0x4,_0x4279ce[_0x1356('0x18')])[_0x1356('0x21')](','));break;case'message':_0x36adc3[_0x1356('0x20')](_0x1915b5[_0x1356('0x22')]);break;case _0x1356('0x26'):_0x36adc3[_0x1356('0x20')](_0x1915b5[_0x1356('0x27')]);_0x36adc3['push'](_0x1915b5[_0x1356('0x22')]);break;default:_0x36adc3=_['isNil'](_0x1915b5[_0x1356('0x22')])?[]:_0x1915b5[_0x1356('0x22')][_0x1356('0x1e')](',');}var _0x2acf0d={'id':util[_0x1356('0x28')](_0x1356('0x29'),_0x11fdf2,_0x1915b5['id'],_0x1915b5[_0x1356('0x1b')]),'condition':require('./interval')[_0x1356('0x2a')](_0x11fdf2,getIntervals(_0x3c8b32[_0x1356('0x2b')],_0x1915b5),_0x3c8b32),'consequence':require(_0x1356('0x2c')+_0x1915b5[_0x1356('0x1b')])['consequence'](_0x11fdf2,_0x36adc3,_0x3c8b32,_0x58975b),'p':_0x1915b5[_0x1356('0x2d')]||0x0};logger['info'](_0x1356('0x2e'),_0x2acf0d['id'],'on\x20interval',getIntervals(_0x3c8b32[_0x1356('0x2b')],_0x1915b5)[_0x1356('0x21')]('\x20|\x20'));_0x3c2adc[_0x1356('0x20')](_0x2acf0d);}else{logger['error'](_0x1356('0x2f'),path[_0x1356('0x21')](__dirname,_0x1356('0x16'),_0x1915b5[_0x1356('0x1b')]+'.js'));}}_0x3c8b32[_0x1356('0x13')][_0x11fdf2]=new RuleEngine(_0x3c2adc);_0x3c8b32['rules'][_0x11fdf2][_0x1356('0x30')](_0x58975b,function(_0x2c0bf6){logger[_0x1356('0x31')](_0x1356('0x32'),JSON[_0x1356('0x33')](_0x2c0bf6[_0x1356('0x34')]));if(_0x3c8b32[_0x1356('0x13')][_0x11fdf2]){_0x3c8b32[_0x1356('0x13')][_0x11fdf2][_0x1356('0x35')](_0x1356('0x36'));}});return _0x593f6d({'code':0xc8,'message':_0x58975b});}else{logger[_0x1356('0x31')](_0x1356('0x37'));return _0x593f6d({'code':0xc8,'message':_0x58975b});}}catch(_0x467c11){logger[_0x1356('0x38')](_0x467c11['stack']);return _0x61991a(_0x47a952[_0x1356('0x38')](0x1f4,_0x467c11));}}return _0x61991a(_0x1356('0x39'));});},'AcceptMessage':function(_0xa65ce2){var _0x36ee6a=this;return new Promise(function(_0x21559e,_0x2231b6){if(_0xa65ce2[_0x1356('0x3a')]&&_0xa65ce2[_0x1356('0x3a')]['id']){if(_0x3c8b32['agents'][_0xa65ce2['agent']['id']]){_0x3c8b32[_0x1356('0x3b')][_0xa65ce2[_0x1356('0x3a')]['id']]['busy']=![];_0x3c8b32[_0x1356('0x3b')][_0xa65ce2[_0x1356('0x3a')]['id']][_0x1356('0x3c')]=undefined;}}if(_0xa65ce2[_0x1356('0x14')]&&_0xa65ce2[_0x1356('0x14')]['id']){try{var _0x4ab592=getId(_0xa65ce2[_0x1356('0x1f')],_0xa65ce2[_0x1356('0x14')]?_0xa65ce2['message']['id']:0x0,_0xa65ce2[_0x1356('0x15')]?_0xa65ce2['interaction']['id']:0x0);if(_0x3c8b32[_0x1356('0x13')][_0x4ab592]){_0x3c8b32[_0x1356('0x13')][_0x4ab592][_0x1356('0x35')](_0x1356('0x3d'));if(rpc[_0xa65ce2[_0x1356('0x1f')]+'QueueReport']){rpc[_0xa65ce2['channel']+_0x1356('0x3e')][_0x1356('0x3f')](_0x4ab592,{'UserId':_0xa65ce2[_0x1356('0x14')][_0x1356('0x40')]})[_0x1356('0x41')](function(_0xf66f43){logger['error'](_0x1356('0x42'));});}}return _0x21559e({'code':0xc8,'message':_0xa65ce2});}catch(_0x570603){logger['error'](_0x570603[_0x1356('0x43')]);return _0x2231b6(_0x36ee6a[_0x1356('0x38')](0x1f4,_0x570603));}}logger[_0x1356('0x38')](_0x1356('0x44'));return _0x2231b6(_0x36ee6a['error'](0x1f4,_0x1356('0x44')));});},'RejectMessage':function(_0xe8714d){var _0x197272=this;return new Promise(function(_0x305fde,_0x58e775){if(_0xe8714d['agent']&&_0xe8714d[_0x1356('0x3a')]['id']){try{if(_0x3c8b32[_0x1356('0x3b')][_0xe8714d[_0x1356('0x3a')]['id']]){_0x3c8b32[_0x1356('0x3b')][_0xe8714d[_0x1356('0x3a')]['id']][_0x1356('0x45')]=![];_0x3c8b32['agents'][_0xe8714d[_0x1356('0x3a')]['id']][_0x1356('0x3c')]=undefined;}return _0x305fde({'code':0xc8,'message':_0xe8714d});}catch(_0x532205){logger[_0x1356('0x38')](_0x532205[_0x1356('0x43')]);return _0x58e775(_0x197272[_0x1356('0x38')](0x1f4,_0x532205));}}logger[_0x1356('0x38')]('message\x20is\x20empty');return _0x58e775(_0x197272['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x3239c1){var _0x4b03c1=this;return new Promise(function(_0x368d44,_0x21ce0e){if(_0x3239c1[_0x1356('0x1f')]&&_0x3239c1['interaction']&&_0x3239c1[_0x1356('0x15')]['id']){try{var _0x10b5c1=getId(_0x3239c1[_0x1356('0x1f')],_0x3239c1[_0x1356('0x14')]?_0x3239c1[_0x1356('0x14')]['id']:0x0,_0x3239c1[_0x1356('0x15')]?_0x3239c1['interaction']['id']:0x0);if(_0x3c8b32['rules'][_0x10b5c1]){_0x3c8b32[_0x1356('0x13')][_0x10b5c1][_0x1356('0x35')](_0x1356('0x3d'));}return _0x368d44({'code':0xc8,'message':_0x3239c1});}catch(_0x2104e9){logger[_0x1356('0x38')](_0x2104e9[_0x1356('0x43')]);return _0x21ce0e(_0x4b03c1[_0x1356('0x38')](0x1f4,_0x2104e9));}}logger['error'](_0x1356('0x44'));return _0x21ce0e(_0x4b03c1[_0x1356('0x38')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x55a772){var _0xa85e53=this;return new Promise(function(_0x629d26,_0x39f327){if(_0x3c8b32[_0x1356('0x3b')][_0x1356('0x46')](_0x55a772['id'])){for(var _0x2102a0 in _0x55a772[_0x1356('0x47')]){if(_0x55a772['capacity']['hasOwnProperty'](_0x2102a0)){if(_0x3c8b32[_0x1356('0x3b')][_0x55a772['id']][_0x1356('0x46')](_0x2102a0+_0x1356('0x48'))){_0x3c8b32[_0x1356('0x3b')][_0x55a772['id']][_0x2102a0+'CurrentCapacity']=parseInt(_0x55a772[_0x1356('0x47')][_0x2102a0],0xa);}}}_0x3c8b32[_0x1356('0x3b')][_0x55a772['id']][_0x1356('0x49')]();return _0x629d26({'code':0xc8,'message':_0x3c8b32[_0x1356('0x3b')][_0x55a772['id']]});}else{return _0x39f327(_0xa85e53['error'](0x1f4,_0x1356('0x4a')));}});},'Agents':function(_0x529933){return new Promise(function(_0x79bd86,_0x14c9ad){var _0x2da393=_[_0x1356('0x4b')](_0x3c8b32[_0x1356('0x3b')]);_0x79bd86({'count':_0x2da393[_0x1356('0x18')],'rows':_0x2da393});});},'ChatQueues':function(_0x398e63){return new Promise(function(_0x41334c,_0x280124){var _0x4972b0=[];for(var _0x23aa46 in _0x3c8b32[_0x1356('0x4c')]){if(_0x3c8b32[_0x1356('0x4c')]['hasOwnProperty'](_0x23aa46)){var _0x3f2a4d=_0x3c8b32[_0x1356('0x4c')][_0x23aa46];var _0x3a78ee={'id':_0x3f2a4d['id'],'available':_0x3f2a4d[_0x1356('0x4d')],'loggedIn':_0x3f2a4d['loggedIn'],'name':_0x3f2a4d[_0x1356('0x4e')],'paused':_0x3f2a4d[_0x1356('0x4f')],'waiting':_0x3f2a4d[_0x1356('0x50')]};_0x4972b0[_0x1356('0x20')](_0x3a78ee);}}_0x41334c({'count':_0x4972b0[_0x1356('0x18')],'rows':_0x4972b0});});},'MailQueues':function(_0x1c95db){return new Promise(function(_0x22154d,_0x2ed251){var _0x5bdd6d=[];for(var _0x598342 in _0x3c8b32[_0x1356('0x51')]){if(_0x3c8b32['mailQueues'][_0x1356('0x46')](_0x598342)){var _0x4d1e48=_0x3c8b32[_0x1356('0x51')][_0x598342];var _0x568c45={'id':_0x4d1e48['id'],'available':_0x4d1e48['available'],'loggedIn':_0x4d1e48[_0x1356('0x52')],'name':_0x4d1e48[_0x1356('0x4e')],'paused':_0x4d1e48[_0x1356('0x4f')],'waiting':_0x4d1e48[_0x1356('0x50')]};_0x5bdd6d[_0x1356('0x20')](_0x568c45);}}_0x22154d({'count':_0x5bdd6d[_0x1356('0x18')],'rows':_0x5bdd6d});});},'OpenchannelQueues':function(_0x44bc18){return new Promise(function(_0x3e47c9,_0x594792){var _0x2f365e=[];for(var _0x1b9468 in _0x3c8b32[_0x1356('0x53')]){if(_0x3c8b32[_0x1356('0x53')][_0x1356('0x46')](_0x1b9468)){var _0x3cb608=_0x3c8b32['openchannelQueues'][_0x1b9468];var _0x490277={'id':_0x3cb608['id'],'available':_0x3cb608[_0x1356('0x4d')],'loggedIn':_0x3cb608['loggedIn'],'name':_0x3cb608[_0x1356('0x4e')],'paused':_0x3cb608[_0x1356('0x4f')],'waiting':_0x3cb608['waiting']};_0x2f365e[_0x1356('0x20')](_0x490277);}}_0x3e47c9({'count':_0x2f365e[_0x1356('0x18')],'rows':_0x2f365e});});},'SmsQueues':function(_0x356bac){return new Promise(function(_0x5252cd,_0x54f950){var _0x2e6c61=[];for(var _0x57554b in _0x3c8b32[_0x1356('0x54')]){if(_0x3c8b32['smsQueues']['hasOwnProperty'](_0x57554b)){var _0x3e3609=_0x3c8b32[_0x1356('0x54')][_0x57554b];var _0x286f56={'id':_0x3e3609['id'],'available':_0x3e3609[_0x1356('0x4d')],'loggedIn':_0x3e3609[_0x1356('0x52')],'name':_0x3e3609[_0x1356('0x4e')],'paused':_0x3e3609[_0x1356('0x4f')],'waiting':_0x3e3609['waiting']};_0x2e6c61[_0x1356('0x20')](_0x286f56);}}_0x5252cd({'count':_0x2e6c61[_0x1356('0x18')],'rows':_0x2e6c61});});},'FaxQueues':function(_0x13b84e){return new Promise(function(_0x219695,_0x2071fa){var _0x1ef6e9=[];for(var _0x1d2a9f in _0x3c8b32['faxQueues']){if(_0x3c8b32[_0x1356('0x55')][_0x1356('0x46')](_0x1d2a9f)){var _0x1a898d=_0x3c8b32[_0x1356('0x55')][_0x1d2a9f];var _0x667135={'id':_0x1a898d['id'],'available':_0x1a898d[_0x1356('0x4d')],'loggedIn':_0x1a898d['loggedIn'],'name':_0x1a898d['name'],'paused':_0x1a898d[_0x1356('0x4f')],'waiting':_0x1a898d[_0x1356('0x50')]};_0x1ef6e9[_0x1356('0x20')](_0x667135);}}_0x219695({'count':_0x1ef6e9[_0x1356('0x18')],'rows':_0x1ef6e9});});},'WhatsappQueues':function(_0x1f8aab){return new Promise(function(_0x4b4601,_0x325e23){var _0x3dbfdc=[];for(var _0x44fb7b in _0x3c8b32['whatsappQueues']){if(_0x3c8b32['whatsappQueues'][_0x1356('0x46')](_0x44fb7b)){var _0x24f046=_0x3c8b32[_0x1356('0x56')][_0x44fb7b];var _0x5bb015={'id':_0x24f046['id'],'available':_0x24f046[_0x1356('0x4d')],'loggedIn':_0x24f046[_0x1356('0x52')],'name':_0x24f046['name'],'paused':_0x24f046[_0x1356('0x4f')],'waiting':_0x24f046[_0x1356('0x50')]};_0x3dbfdc['push'](_0x5bb015);}}_0x4b4601({'count':_0x3dbfdc['length'],'rows':_0x3dbfdc});});},'ChatQueuesWaitingInteractions':function(_0x2215b9){return new Promise(function(_0x3c29f4,_0x43b9f2){var _0x4d6e72=_['values'](_0x3c8b32[_0x1356('0x57')]);_0x3c29f4({'count':_0x4d6e72['length'],'rows':_0x4d6e72});});},'MailQueuesWaitingInteractions':function(_0x5b143e){return new Promise(function(_0x5efafe,_0x20583c){var _0x3cbb5c=_[_0x1356('0x4b')](_0x3c8b32['mailQueuesWaitingInteractions']);_0x5efafe({'count':_0x3cbb5c[_0x1356('0x18')],'rows':_0x3cbb5c});});},'OpenchannelQueuesWaitingInteractions':function(_0x5df947){return new Promise(function(_0x4585d8,_0x4dd88d){var _0x143216=_[_0x1356('0x4b')](_0x3c8b32[_0x1356('0x58')]);_0x4585d8({'count':_0x143216[_0x1356('0x18')],'rows':_0x143216});});},'SmsQueuesWaitingInteractions':function(_0x34ae68){return new Promise(function(_0x4ef8a7,_0x461e62){var _0x271071=_['values'](_0x3c8b32[_0x1356('0x59')]);_0x4ef8a7({'count':_0x271071[_0x1356('0x18')],'rows':_0x271071});});},'FaxQueuesWaitingInteractions':function(_0x17b673){return new Promise(function(_0x25f6bd,_0x2ed128){var _0xadcb7f=_[_0x1356('0x4b')](_0x3c8b32[_0x1356('0x5a')]);_0x25f6bd({'count':_0xadcb7f[_0x1356('0x18')],'rows':_0xadcb7f});});},'WhatsappQueuesWaitingInteractions':function(_0x305470){return new Promise(function(_0xb15e0c,_0x2efad3){var _0xe6e11e=_['values'](_0x3c8b32[_0x1356('0x5b')]);_0xb15e0c({'count':_0xe6e11e[_0x1356('0x18')],'rows':_0xe6e11e});});}};var _0x3cb7e2=jayson[_0x1356('0x5c')](_0xdeeff2)[_0x1356('0x5d')]();_0x3cb7e2['on'](_0x1356('0x38'),function(_0xad1bf5){logger['error'](JSON[_0x1356('0x33')](_0xad1bf5));return _0x396402(_0xad1bf5);});_0x3cb7e2[_0x1356('0x12')](0x232c,'127.0.0.1',function(){console[_0x1356('0x5e')](_0x1356('0x5f'),0x232c);return _0x324102('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xf72b=['openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','listen','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','path','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','channel','message','interaction','applications','length','existsSync','join','app','.js','toLowerCase','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','rules','Applications\x20executed','stringify','complete','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busy','emit','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','waiting','mailQueues','name'];(function(_0x471d11,_0x35393c){var _0x13662a=function(_0x4a196d){while(--_0x4a196d){_0x471d11['push'](_0x471d11['shift']());}};_0x13662a(++_0x35393c);}(_0xf72b,0x1d9));var _0xbf72=function(_0x4ed51f,_0x58f7ab){_0x4ed51f=_0x4ed51f-0x0;var _0x49783f=_0xf72b[_0x4ed51f];return _0x49783f;};'use strict';var _=require(_0xbf72('0x0'));var util=require('util');var path=require(_0xbf72('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xbf72('0x2'));var uuid=require(_0xbf72('0x3'));var config=require('../../../config/environment');var logger=require(_0xbf72('0x4'))(_0xbf72('0x5'));var rpc={'openchannelQueueReport':require(_0xbf72('0x6')),'mailQueueReport':require(_0xbf72('0x7')),'chatQueueReport':require(_0xbf72('0x8')),'smsQueueReport':require(_0xbf72('0x9')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xbf72('0xa'))};var RuleEngine=require(_0xbf72('0xb'));function getId(_0x119807,_0xd0402c,_0xdd6177){return util[_0xbf72('0xc')]('%s.%s.%s',_0x119807,_0xd0402c||0x0,_0xdd6177||0x0);}function getIntervals(_0x455891,_0x52418f){var _0x2ca1f8=[];if(!_[_0xbf72('0xd')](_0x52418f['IntervalId'])&&!_[_0xbf72('0xd')](_0x455891[_0x52418f[_0xbf72('0xe')]])&&!_[_0xbf72('0xd')](_0x455891[_0x52418f[_0xbf72('0xe')]][_0xbf72('0xf')])){_0x2ca1f8=_[_0xbf72('0x10')](_0x455891[_0x52418f[_0xbf72('0xe')]][_0xbf72('0xf')],'interval');}else if(!_[_0xbf72('0xd')](_0x52418f[_0xbf72('0x11')])){_0x2ca1f8=[_0x52418f[_0xbf72('0x11')]];}return _0x2ca1f8;}exports['listen']=function(_0x25255e){_0x25255e['rules']={};return new BPromise(function(_0x5625b3,_0x4a79df){var _0x32a0a5={'Start':function(_0xb96906){var _0x3af48d=this;return new Promise(function(_0x723eb1,_0x39d0cd){if(_0xb96906){try{var _0x160d61=[];var _0x566075=getId(_0xb96906[_0xbf72('0x12')],_0xb96906[_0xbf72('0x13')]?_0xb96906[_0xbf72('0x13')]['id']:0x0,_0xb96906[_0xbf72('0x14')]?_0xb96906[_0xbf72('0x14')]['id']:0x0);if(_0xb96906['applications']&&_['isArray'](_0xb96906[_0xbf72('0x15')])&&_0xb96906[_0xbf72('0x15')][_0xbf72('0x16')]){for(var _0x2584d9=0x0;_0x2584d9<_0xb96906[_0xbf72('0x15')][_0xbf72('0x16')];_0x2584d9+=0x1){var _0x1e2bfb=_0xb96906['applications'][_0x2584d9];if(fs[_0xbf72('0x17')](path[_0xbf72('0x18')](__dirname,_0xbf72('0x15'),_0x1e2bfb[_0xbf72('0x19')]+_0xbf72('0x1a')))){var _0x5f2537=[];switch(_0x1e2bfb[_0xbf72('0x19')][_0xbf72('0x1b')]()){case'autoreply':var _0x35c40f=_0x1e2bfb[_0xbf72('0x1c')][_0xbf72('0x1d')](',');if(_0xb96906['channel']===_0xbf72('0x1e')){_0x5f2537[_0xbf72('0x1f')](_0x35c40f[0x0]);_0x5f2537[_0xbf72('0x1f')](_0x35c40f[0x1]);_0x5f2537[_0xbf72('0x1f')](_0x35c40f['slice'](0x2,_0x35c40f[_0xbf72('0x16')])[_0xbf72('0x18')](','));}else{_0x5f2537[_0xbf72('0x1f')](_0x35c40f[0x0]);_0x5f2537['push'](_0x35c40f[_0xbf72('0x20')](0x1,_0x35c40f[_0xbf72('0x16')])[_0xbf72('0x18')](','));}break;case _0xbf72('0x21'):var _0x15d60d=_0x1e2bfb[_0xbf72('0x1c')][_0xbf72('0x1d')](',');_0x5f2537[_0xbf72('0x1f')](_0x15d60d[0x0]);_0x5f2537[_0xbf72('0x1f')](_0x15d60d[0x1]);_0x5f2537[_0xbf72('0x1f')](_0x15d60d[_0xbf72('0x20')](0x2,_0x15d60d[_0xbf72('0x16')])[_0xbf72('0x18')](','));break;case _0xbf72('0x22'):var _0x37a233=_0x1e2bfb['appdata'][_0xbf72('0x1d')](',');_0x5f2537[_0xbf72('0x1f')](_0x37a233[0x0]);_0x5f2537[_0xbf72('0x1f')](_0x37a233[0x1]);_0x5f2537[_0xbf72('0x1f')](_0x37a233[0x2]);_0x5f2537[_0xbf72('0x1f')](_0x37a233[0x3]);_0x5f2537[_0xbf72('0x1f')](_0x37a233[_0xbf72('0x20')](0x4,_0x37a233[_0xbf72('0x16')])[_0xbf72('0x18')](','));break;case _0xbf72('0x23'):var _0x440bee=_0x1e2bfb[_0xbf72('0x1c')][_0xbf72('0x1d')](',');_0x5f2537[_0xbf72('0x1f')](_0x440bee[0x0]);_0x5f2537['push'](_0x440bee[0x1]);_0x5f2537[_0xbf72('0x1f')](_0x440bee[0x2]);_0x5f2537[_0xbf72('0x1f')](_0x440bee[0x3]);_0x5f2537[_0xbf72('0x1f')](_0x440bee['slice'](0x4,_0x440bee['length'])['join'](','));break;case _0xbf72('0x13'):_0x5f2537[_0xbf72('0x1f')](_0x1e2bfb[_0xbf72('0x1c')]);break;case'tag':_0x5f2537[_0xbf72('0x1f')](_0x1e2bfb[_0xbf72('0x24')]);_0x5f2537['push'](_0x1e2bfb[_0xbf72('0x1c')]);break;default:_0x5f2537=_['isNil'](_0x1e2bfb[_0xbf72('0x1c')])?[]:_0x1e2bfb[_0xbf72('0x1c')]['split'](',');}var _0x4aac2f={'id':util[_0xbf72('0xc')](_0xbf72('0x25'),_0x566075,_0x1e2bfb['id'],_0x1e2bfb[_0xbf72('0x19')]),'condition':require(_0xbf72('0x26'))[_0xbf72('0x27')](_0x566075,getIntervals(_0x25255e[_0xbf72('0x28')],_0x1e2bfb),_0x25255e),'consequence':require(_0xbf72('0x29')+_0x1e2bfb[_0xbf72('0x19')])[_0xbf72('0x2a')](_0x566075,_0x5f2537,_0x25255e,_0xb96906),'p':_0x1e2bfb['priority']||0x0};logger[_0xbf72('0x2b')](_0xbf72('0x2c'),_0x4aac2f['id'],_0xbf72('0x2d'),getIntervals(_0x25255e[_0xbf72('0x28')],_0x1e2bfb)['join'](_0xbf72('0x2e')));_0x160d61[_0xbf72('0x1f')](_0x4aac2f);}else{logger['error'](_0xbf72('0x2f'),path['join'](__dirname,'applications',_0x1e2bfb['app']+'.js'));}}_0x25255e[_0xbf72('0x30')][_0x566075]=new RuleEngine(_0x160d61);_0x25255e['rules'][_0x566075]['execute'](_0xb96906,function(_0x176d91){logger['info'](_0xbf72('0x31'),JSON[_0xbf72('0x32')](_0x176d91['matchPath']));if(_0x25255e[_0xbf72('0x30')][_0x566075]){_0x25255e['rules'][_0x566075]['emit'](_0xbf72('0x33'));}});return _0x723eb1({'code':0xc8,'message':_0xb96906});}else{logger[_0xbf72('0x2b')](_0xbf72('0x34'));return _0x723eb1({'code':0xc8,'message':_0xb96906});}}catch(_0x259c7d){logger[_0xbf72('0x35')](_0x259c7d[_0xbf72('0x36')]);return _0x39d0cd(_0x3af48d[_0xbf72('0x35')](0x1f4,_0x259c7d));}}return _0x39d0cd(_0xbf72('0x37'));});},'AcceptMessage':function(_0x53030b){var _0x311a0c=this;return new Promise(function(_0x3831b9,_0x58d4e8){if(_0x53030b[_0xbf72('0x38')]&&_0x53030b['agent']['id']){if(_0x25255e['agents'][_0x53030b[_0xbf72('0x38')]['id']]){_0x25255e[_0xbf72('0x39')][_0x53030b[_0xbf72('0x38')]['id']][_0xbf72('0x3a')]=![];_0x25255e[_0xbf72('0x39')][_0x53030b['agent']['id']]['busyQueue']=undefined;}}if(_0x53030b['message']&&_0x53030b[_0xbf72('0x13')]['id']){try{var _0x3a7828=getId(_0x53030b[_0xbf72('0x12')],_0x53030b[_0xbf72('0x13')]?_0x53030b['message']['id']:0x0,_0x53030b['interaction']?_0x53030b[_0xbf72('0x14')]['id']:0x0);if(_0x25255e['rules'][_0x3a7828]){_0x25255e[_0xbf72('0x30')][_0x3a7828][_0xbf72('0x3b')](_0xbf72('0x3c'));if(rpc[_0x53030b[_0xbf72('0x12')]+'QueueReport']){rpc[_0x53030b[_0xbf72('0x12')]+_0xbf72('0x3d')][_0xbf72('0x3e')](_0x3a7828,{'UserId':_0x53030b[_0xbf72('0x13')]['UserId']})[_0xbf72('0x3f')](function(_0x1353be){logger['error'](_0xbf72('0x40'));});}}return _0x3831b9({'code':0xc8,'message':_0x53030b});}catch(_0x1baebe){logger[_0xbf72('0x35')](_0x1baebe[_0xbf72('0x36')]);return _0x58d4e8(_0x311a0c[_0xbf72('0x35')](0x1f4,_0x1baebe));}}logger[_0xbf72('0x35')](_0xbf72('0x41'));return _0x58d4e8(_0x311a0c['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x5b4bbb){var _0x3bd313=this;return new Promise(function(_0x4b95b2,_0x2c9891){if(_0x5b4bbb['agent']&&_0x5b4bbb['agent']['id']){try{if(_0x25255e['agents'][_0x5b4bbb[_0xbf72('0x38')]['id']]){_0x25255e[_0xbf72('0x39')][_0x5b4bbb[_0xbf72('0x38')]['id']][_0xbf72('0x3a')]=![];_0x25255e[_0xbf72('0x39')][_0x5b4bbb[_0xbf72('0x38')]['id']]['busyQueue']=undefined;}return _0x4b95b2({'code':0xc8,'message':_0x5b4bbb});}catch(_0x3ffa72){logger['error'](_0x3ffa72[_0xbf72('0x36')]);return _0x2c9891(_0x3bd313['error'](0x1f4,_0x3ffa72));}}logger[_0xbf72('0x35')](_0xbf72('0x41'));return _0x2c9891(_0x3bd313[_0xbf72('0x35')](0x1f4,_0xbf72('0x41')));});},'AbandonInteraction':function(_0x26ce94){var _0x75cf1=this;return new Promise(function(_0x578b07,_0x176a59){if(_0x26ce94[_0xbf72('0x12')]&&_0x26ce94['interaction']&&_0x26ce94[_0xbf72('0x14')]['id']){try{var _0x2f9816=getId(_0x26ce94[_0xbf72('0x12')],_0x26ce94['message']?_0x26ce94[_0xbf72('0x13')]['id']:0x0,_0x26ce94[_0xbf72('0x14')]?_0x26ce94[_0xbf72('0x14')]['id']:0x0);if(_0x25255e[_0xbf72('0x30')][_0x2f9816]){_0x25255e[_0xbf72('0x30')][_0x2f9816]['emit'](_0xbf72('0x3c'));}return _0x578b07({'code':0xc8,'message':_0x26ce94});}catch(_0xad005){logger['error'](_0xad005[_0xbf72('0x36')]);return _0x176a59(_0x75cf1['error'](0x1f4,_0xad005));}}logger['error'](_0xbf72('0x41'));return _0x176a59(_0x75cf1[_0xbf72('0x35')](0x1f4,_0xbf72('0x41')));});},'AgentCapacity':function(_0x162b3a){var _0x2da903=this;return new Promise(function(_0x527061,_0x5c4e57){if(_0x25255e['agents'][_0xbf72('0x42')](_0x162b3a['id'])){for(var _0x238de3 in _0x162b3a[_0xbf72('0x43')]){if(_0x162b3a[_0xbf72('0x43')]['hasOwnProperty'](_0x238de3)){if(_0x25255e['agents'][_0x162b3a['id']][_0xbf72('0x42')](_0x238de3+_0xbf72('0x44'))){_0x25255e[_0xbf72('0x39')][_0x162b3a['id']][_0x238de3+'CurrentCapacity']=parseInt(_0x162b3a[_0xbf72('0x43')][_0x238de3],0xa);}}}_0x25255e['agents'][_0x162b3a['id']][_0xbf72('0x45')]();return _0x527061({'code':0xc8,'message':_0x25255e[_0xbf72('0x39')][_0x162b3a['id']]});}else{return _0x5c4e57(_0x2da903['error'](0x1f4,_0xbf72('0x46')));}});},'Agents':function(_0x441908){return new Promise(function(_0x55ac06,_0x3c3e31){var _0x46f908=_[_0xbf72('0x47')](_0x25255e['agents']);_0x55ac06({'count':_0x46f908['length'],'rows':_0x46f908});});},'ChatQueues':function(_0x48530e){return new Promise(function(_0x452847,_0x5aa272){var _0x28eb87=[];for(var _0x29ff55 in _0x25255e[_0xbf72('0x48')]){if(_0x25255e[_0xbf72('0x48')][_0xbf72('0x42')](_0x29ff55)){var _0x201342=_0x25255e[_0xbf72('0x48')][_0x29ff55];var _0x56d6f2={'id':_0x201342['id'],'available':_0x201342[_0xbf72('0x49')],'loggedIn':_0x201342[_0xbf72('0x4a')],'name':_0x201342['name'],'paused':_0x201342[_0xbf72('0x4b')],'waiting':_0x201342[_0xbf72('0x4c')]};_0x28eb87[_0xbf72('0x1f')](_0x56d6f2);}}_0x452847({'count':_0x28eb87[_0xbf72('0x16')],'rows':_0x28eb87});});},'MailQueues':function(_0x403cea){return new Promise(function(_0x14f8d0,_0x2caf40){var _0x433d32=[];for(var _0x26e2ec in _0x25255e['mailQueues']){if(_0x25255e['mailQueues'][_0xbf72('0x42')](_0x26e2ec)){var _0x2fa719=_0x25255e[_0xbf72('0x4d')][_0x26e2ec];var _0x26c25c={'id':_0x2fa719['id'],'available':_0x2fa719[_0xbf72('0x49')],'loggedIn':_0x2fa719[_0xbf72('0x4a')],'name':_0x2fa719[_0xbf72('0x4e')],'paused':_0x2fa719[_0xbf72('0x4b')],'waiting':_0x2fa719['waiting']};_0x433d32[_0xbf72('0x1f')](_0x26c25c);}}_0x14f8d0({'count':_0x433d32[_0xbf72('0x16')],'rows':_0x433d32});});},'OpenchannelQueues':function(_0x3fe70d){return new Promise(function(_0xe4a99f,_0x3d51a9){var _0x41c207=[];for(var _0x1ba67d in _0x25255e['openchannelQueues']){if(_0x25255e[_0xbf72('0x4f')][_0xbf72('0x42')](_0x1ba67d)){var _0x23550f=_0x25255e[_0xbf72('0x4f')][_0x1ba67d];var _0x44e62f={'id':_0x23550f['id'],'available':_0x23550f[_0xbf72('0x49')],'loggedIn':_0x23550f[_0xbf72('0x4a')],'name':_0x23550f[_0xbf72('0x4e')],'paused':_0x23550f['paused'],'waiting':_0x23550f[_0xbf72('0x4c')]};_0x41c207[_0xbf72('0x1f')](_0x44e62f);}}_0xe4a99f({'count':_0x41c207[_0xbf72('0x16')],'rows':_0x41c207});});},'SmsQueues':function(_0x5472db){return new Promise(function(_0xcb2987,_0x35a535){var _0x59c26a=[];for(var _0x143b0b in _0x25255e[_0xbf72('0x50')]){if(_0x25255e['smsQueues'][_0xbf72('0x42')](_0x143b0b)){var _0x36f101=_0x25255e['smsQueues'][_0x143b0b];var _0x39f734={'id':_0x36f101['id'],'available':_0x36f101[_0xbf72('0x49')],'loggedIn':_0x36f101[_0xbf72('0x4a')],'name':_0x36f101[_0xbf72('0x4e')],'paused':_0x36f101[_0xbf72('0x4b')],'waiting':_0x36f101[_0xbf72('0x4c')]};_0x59c26a[_0xbf72('0x1f')](_0x39f734);}}_0xcb2987({'count':_0x59c26a['length'],'rows':_0x59c26a});});},'FaxQueues':function(_0xe122fb){return new Promise(function(_0x1dacae,_0x57943a){var _0x3d62eb=[];for(var _0x5ea590 in _0x25255e['faxQueues']){if(_0x25255e[_0xbf72('0x51')][_0xbf72('0x42')](_0x5ea590)){var _0x3f9b8b=_0x25255e[_0xbf72('0x51')][_0x5ea590];var _0x37428a={'id':_0x3f9b8b['id'],'available':_0x3f9b8b[_0xbf72('0x49')],'loggedIn':_0x3f9b8b['loggedIn'],'name':_0x3f9b8b[_0xbf72('0x4e')],'paused':_0x3f9b8b[_0xbf72('0x4b')],'waiting':_0x3f9b8b[_0xbf72('0x4c')]};_0x3d62eb[_0xbf72('0x1f')](_0x37428a);}}_0x1dacae({'count':_0x3d62eb['length'],'rows':_0x3d62eb});});},'WhatsappQueues':function(_0x47732d){return new Promise(function(_0xf4706,_0x44d3ea){var _0x320351=[];for(var _0x4bdf6c in _0x25255e[_0xbf72('0x52')]){if(_0x25255e['whatsappQueues'][_0xbf72('0x42')](_0x4bdf6c)){var _0x221de8=_0x25255e[_0xbf72('0x52')][_0x4bdf6c];var _0x53bd1c={'id':_0x221de8['id'],'available':_0x221de8[_0xbf72('0x49')],'loggedIn':_0x221de8[_0xbf72('0x4a')],'name':_0x221de8[_0xbf72('0x4e')],'paused':_0x221de8[_0xbf72('0x4b')],'waiting':_0x221de8[_0xbf72('0x4c')]};_0x320351[_0xbf72('0x1f')](_0x53bd1c);}}_0xf4706({'count':_0x320351[_0xbf72('0x16')],'rows':_0x320351});});},'ChatQueuesWaitingInteractions':function(_0x432acd){return new Promise(function(_0x9b2e45,_0x285a95){var _0x9eeeb3=_[_0xbf72('0x47')](_0x25255e['chatQueuesWaitingInteractions']);_0x9b2e45({'count':_0x9eeeb3[_0xbf72('0x16')],'rows':_0x9eeeb3});});},'MailQueuesWaitingInteractions':function(_0x172688){return new Promise(function(_0x94103f,_0x594b73){var _0x2311ff=_['values'](_0x25255e[_0xbf72('0x53')]);_0x94103f({'count':_0x2311ff[_0xbf72('0x16')],'rows':_0x2311ff});});},'OpenchannelQueuesWaitingInteractions':function(_0x11cf76){return new Promise(function(_0x476e19,_0x473c4b){var _0x379efb=_['values'](_0x25255e[_0xbf72('0x54')]);_0x476e19({'count':_0x379efb['length'],'rows':_0x379efb});});},'SmsQueuesWaitingInteractions':function(_0xe2f9b){return new Promise(function(_0x4c6c69,_0x2a77c4){var _0x45d1a4=_[_0xbf72('0x47')](_0x25255e[_0xbf72('0x55')]);_0x4c6c69({'count':_0x45d1a4[_0xbf72('0x16')],'rows':_0x45d1a4});});},'FaxQueuesWaitingInteractions':function(_0x1c18c5){return new Promise(function(_0x3ba2f9,_0x139448){var _0x2f75bd=_[_0xbf72('0x47')](_0x25255e[_0xbf72('0x56')]);_0x3ba2f9({'count':_0x2f75bd[_0xbf72('0x16')],'rows':_0x2f75bd});});},'WhatsappQueuesWaitingInteractions':function(_0x28d94b){return new Promise(function(_0x40a6eb,_0x29deb0){var _0x5463d3=_['values'](_0x25255e[_0xbf72('0x57')]);_0x40a6eb({'count':_0x5463d3['length'],'rows':_0x5463d3});});}};var _0x47488c=jayson[_0xbf72('0x58')](_0x32a0a5)['http']();_0x47488c['on'](_0xbf72('0x35'),function(_0xffecec){logger[_0xbf72('0x35')](JSON['stringify'](_0xffecec));return _0x4a79df(_0xffecec);});_0x47488c[_0xbf72('0x59')](0x232c,'127.0.0.1',function(){console[_0xbf72('0x5a')](_0xbf72('0x5b'),0x232c);return _0x5625b3('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 8ad66a6..443373c 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 _0xd6da=['error','message','condition','stop','length','push','Command','true','[%s][INTERVAL]\x20%s','some','\x20|\x20','when','catch','join','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','request','then'];(function(_0xf4fee8,_0x5951ce){var _0x1303d7=function(_0x56e749){while(--_0x56e749){_0xf4fee8['push'](_0xf4fee8['shift']());}};_0x1303d7(++_0x5951ce);}(_0xd6da,0xb0));var _0xad6d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd6da[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xad6d('0x0'));var BPromise=require(_0xad6d('0x1'));var jayson=require(_0xad6d('0x2'));var _=require(_0xad6d('0x3'));var logger=require(_0xad6d('0x4'))(_0xad6d('0x5'));var client=jayson['client']['http']({'port':0x232a});function request(_0x1cd5b1,_0x568788){return new BPromise(function(_0xfdc3a2,_0x35421d){return client[_0xad6d('0x6')](_0x1cd5b1,_0x568788)[_0xad6d('0x7')](function(_0xf71239){if(_0xf71239[_0xad6d('0x8')]){return _0x35421d(_0xf71239['error'][_0xad6d('0x9')]);}else{return _0xfdc3a2(_0xf71239['result']);}})['catch'](function(_0x5ec40e){return _0x35421d(_0x5ec40e);});});}exports[_0xad6d('0xa')]=function(_0x5d3f7d,_0x31625a,_0x136394){return function(_0x15aba8){if(_0x136394['rules']&&!_0x136394['rules'][_0x5d3f7d]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x5d3f7d);return _0x15aba8[_0xad6d('0xb')]();}var _0x4ffe02=[];for(var _0x298879=0x0;_0x298879<_0x31625a[_0xad6d('0xc')];_0x298879+=0x1){_0x4ffe02[_0xad6d('0xd')](request(_0xad6d('0xe'),{'command':util['format']('iftime\x20%s',_0x31625a[_0x298879])})[_0xad6d('0x7')](function(_0xcfd9a8){return _0xcfd9a8&&_0xcfd9a8[_0xad6d('0x9')]&&_0xcfd9a8[_0xad6d('0x9')]['indexOf'](_0xad6d('0xf'))>=0x0?!![]:![];})['catch'](function(_0x27938f){logger[_0xad6d('0x8')](_0xad6d('0x10'),_0x5d3f7d,_0x31625a[_0x298879]);}));}BPromise['all'](_0x4ffe02)[_0xad6d('0x7')](function(_0x40aa0f){var _0x3db749=_[_0xad6d('0x11')](_0x40aa0f);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x5d3f7d,_0x31625a['join'](_0xad6d('0x12')),_0x3db749);_0x15aba8[_0xad6d('0x13')](_0x3db749);})[_0xad6d('0x14')](function(_0x587031){console['log'](_0x587031);logger[_0xad6d('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x5d3f7d,_0x31625a[_0xad6d('0x15')](_0xad6d('0x12')),_0x587031[_0xad6d('0x16')]);_0x15aba8['stop']();});};}; \ No newline at end of file +var _0x8fe7=['util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','message','indexOf','true','all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join'];(function(_0x3dad79,_0x42b44b){var _0xe075a5=function(_0x37335f){while(--_0x37335f){_0x3dad79['push'](_0x3dad79['shift']());}};_0xe075a5(++_0x42b44b);}(_0x8fe7,0xf0));var _0x78fe=function(_0x38a610,_0x8f7819){_0x38a610=_0x38a610-0x0;var _0x16d7cb=_0x8fe7[_0x38a610];return _0x16d7cb;};'use strict';var util=require(_0x78fe('0x0'));var BPromise=require(_0x78fe('0x1'));var jayson=require(_0x78fe('0x2'));var _=require(_0x78fe('0x3'));var logger=require(_0x78fe('0x4'))(_0x78fe('0x5'));var client=jayson[_0x78fe('0x6')][_0x78fe('0x7')]({'port':0x232a});function request(_0x56b63e,_0x4d4a58){return new BPromise(function(_0x3f1c52,_0x467a51){return client[_0x78fe('0x8')](_0x56b63e,_0x4d4a58)[_0x78fe('0x9')](function(_0x3b3db1){if(_0x3b3db1[_0x78fe('0xa')]){return _0x467a51(_0x3b3db1['error']['message']);}else{return _0x3f1c52(_0x3b3db1[_0x78fe('0xb')]);}})[_0x78fe('0xc')](function(_0x505e7a){return _0x467a51(_0x505e7a);});});}exports[_0x78fe('0xd')]=function(_0x5d0ccf,_0x5b2147,_0x342b10){return function(_0x42cc27){if(_0x342b10['rules']&&!_0x342b10[_0x78fe('0xe')][_0x5d0ccf]){logger[_0x78fe('0xf')](_0x78fe('0x10'),_0x5d0ccf);return _0x42cc27[_0x78fe('0x11')]();}var _0x2cd9d0=[];for(var _0x26c045=0x0;_0x26c045<_0x5b2147[_0x78fe('0x12')];_0x26c045+=0x1){_0x2cd9d0[_0x78fe('0x13')](request('Command',{'command':util['format']('iftime\x20%s',_0x5b2147[_0x26c045])})[_0x78fe('0x9')](function(_0x3d3b79){return _0x3d3b79&&_0x3d3b79[_0x78fe('0x14')]&&_0x3d3b79[_0x78fe('0x14')][_0x78fe('0x15')](_0x78fe('0x16'))>=0x0?!![]:![];})['catch'](function(_0x218220){logger[_0x78fe('0xa')]('[%s][INTERVAL]\x20%s',_0x5d0ccf,_0x5b2147[_0x26c045]);}));}BPromise[_0x78fe('0x17')](_0x2cd9d0)['then'](function(_0x531891){var _0x25dc3a=_[_0x78fe('0x18')](_0x531891);logger[_0x78fe('0xf')](_0x78fe('0x19'),_0x5d0ccf,_0x5b2147['join'](_0x78fe('0x1a')),_0x25dc3a);_0x42cc27[_0x78fe('0x1b')](_0x25dc3a);})[_0x78fe('0xc')](function(_0xfeda59){console[_0x78fe('0x1c')](_0xfeda59);logger[_0x78fe('0xa')](_0x78fe('0x19'),_0x5d0ccf,_0x5b2147[_0x78fe('0x1d')]('\x20|\x20'),_0xfeda59['stack']);_0x42cc27[_0x78fe('0x11')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index b203d4c..a122205 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 _0x939f=['transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridname','secondtransfererexten','transfertargetuniqueid','agententerreason','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','complete','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwTimeout','request','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentringnoanswer]','agentringnoanswer','agentringnoanswerAt','now','timeout','reason','talktime','push','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','holdtime','connect','ringtime','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','[%s][agents][agentcomplete]','blindtransfer'];(function(_0x328d95,_0x135ab8){var _0x3f0885=function(_0x2458c3){while(--_0x2458c3){_0x328d95['push'](_0x328d95['shift']());}};_0x3f0885(++_0x135ab8);}(_0x939f,0xc6));var _0xf939=function(_0x787d44,_0x36fea9){_0x787d44=_0x787d44-0x0;var _0x1c1430=_0x939f[_0x787d44];return _0x1c1430;};'use strict';var _=require(_0xf939('0x0'));var util=require('util');var utils=require(_0xf939('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3dacbb,_0x43cc16){utils[_0xf939('0x2')](util[_0xf939('0x3')](_0xf939('0x4'),_0x3dacbb[_0xf939('0x5')],_0x3dacbb[_0xf939('0x6')],_0x3dacbb[_0xf939('0x7')],_0x3dacbb[_0xf939('0x8')],_0x3dacbb['interface'],_0x3dacbb[_0xf939('0x9')],_0x3dacbb[_0xf939('0xa')],_0x3dacbb[_0xf939('0xb')]));if(_0x3dacbb[_0xf939('0x7')]){utils[_0xf939('0xc')](_0x3dacbb[_0xf939('0x7')])[_0xf939('0xd')](function(_0x388706){if(_0x388706){_0x3dacbb[_0xf939('0xe')]=_0x388706[_0xf939('0xe')];_0x3dacbb[_0xf939('0xf')]=_0x3dacbb[_0xf939('0x10')]?_0x388706['acw']:![];_0x3dacbb['acwtime']=_0x3dacbb[_0xf939('0xf')]?_0x388706[_0xf939('0x11')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x3dacbb);});}else{utils[_0xf939('0x12')]('CreateVoiceAgentReport',_0x3dacbb);}if(_0x43cc16){delete transfers[_0x3dacbb[_0xf939('0x5')]];}else{delete agents[_0x3dacbb[_0xf939('0x13')]];}}exports[_0xf939('0x14')]=function(_0x1452fc){try{utils[_0xf939('0x15')](util['format'](_0xf939('0x16'),_0x1452fc[_0xf939('0x5')]),_0x1452fc);agents[_0x1452fc[_0xf939('0x13')]]=_0x1452fc;agents[_0x1452fc[_0xf939('0x13')]][_0xf939('0x17')]=utils['now']();agents[_0x1452fc[_0xf939('0x13')]][_0xf939('0xb')]=_0xf939('0x18');agents[_0x1452fc[_0xf939('0x13')]][_0xf939('0xa')]=null;agents[_0x1452fc['destuniqueid']][_0xf939('0x19')]=null;utils['info'](util[_0xf939('0x3')](_0xf939('0x1a'),_0x1452fc[_0xf939('0x5')],agents[_0x1452fc[_0xf939('0x13')]][_0xf939('0x8')],_0x1452fc[_0xf939('0x13')]));}catch(_0x4ba157){utils[_0xf939('0x1b')](util[_0xf939('0x3')]('[%s][agents][agentcalled]',_0x1452fc[_0xf939('0x5')]),_0x4ba157);}};exports['agentringnoanswer']=function(_0x294b51){try{if(!_['isNil'](agents[_0x294b51['destuniqueid']])){utils[_0xf939('0x15')](util[_0xf939('0x3')](_0xf939('0x1c'),_0x294b51['uniqueid']),_0x294b51);utils[_0xf939('0x2')](util[_0xf939('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x294b51[_0xf939('0x5')],agents[_0x294b51[_0xf939('0x13')]][_0xf939('0x8')],_0x294b51['destuniqueid']));agents[_0x294b51[_0xf939('0x13')]][_0xf939('0x1d')]=!![];agents[_0x294b51['destuniqueid']][_0xf939('0x1e')]=utils[_0xf939('0x1f')]();agents[_0x294b51[_0xf939('0x13')]][_0xf939('0xb')]=_0xf939('0x20');agents[_0x294b51['destuniqueid']][_0xf939('0x21')]=_0xf939('0x20');agents[_0x294b51[_0xf939('0x13')]]['holdtime']=_0x294b51['ringtime']?parseInt(_0x294b51['ringtime'])/0x3e8:0x0;agents[_0x294b51['destuniqueid']][_0xf939('0x22')]=0x0;unanswered[_0xf939('0x23')](_0x294b51[_0xf939('0x13')]);}}catch(_0x1cff7d){utils['error'](util[_0xf939('0x3')](_0xf939('0x1c'),_0x294b51[_0xf939('0x5')]),_0x1cff7d);}};exports[_0xf939('0x24')]=function(_0x54be79){try{_[_0xf939('0x25')](agents,function(_0x3a9c9a,_0x2d4731){if(_0x3a9c9a[_0xf939('0x5')]==_0x54be79[_0xf939('0x5')]&&!_['includes'](unanswered,_0x3a9c9a[_0xf939('0x13')])){utils[_0xf939('0x15')](util[_0xf939('0x3')](_0xf939('0x26'),_0x54be79['uniqueid']),_0x54be79);utils['info'](util['format'](_0xf939('0x27'),_0x54be79['uniqueid'],_0x3a9c9a[_0xf939('0x8')],_0x3a9c9a[_0xf939('0x13')]));_0x3a9c9a[_0xf939('0x1d')]=!![];_0x3a9c9a[_0xf939('0x1e')]=utils[_0xf939('0x1f')]();_0x3a9c9a[_0xf939('0xb')]=_0xf939('0x28');_0x3a9c9a['reason']=_0xf939('0x28');_0x3a9c9a['holdtime']=_0x54be79['holdtime'];_0x3a9c9a['talktime']=0x0;writeDB(_0x3a9c9a);}});}catch(_0x4faec1){utils[_0xf939('0x1b')](util[_0xf939('0x3')](_0xf939('0x26'),_0x54be79[_0xf939('0x5')]),_0x4faec1);}};exports[_0xf939('0x29')]=function(_0x11a471){try{if(agents[_0x11a471[_0xf939('0x13')]]){utils['debug'](util[_0xf939('0x3')](_0xf939('0x2a'),_0x11a471[_0xf939('0x5')]),_0x11a471);utils[_0xf939('0x2')](util[_0xf939('0x3')](_0xf939('0x2b'),_0x11a471[_0xf939('0x5')],agents[_0x11a471[_0xf939('0x13')]][_0xf939('0x8')],_0x11a471[_0xf939('0x13')]));agents[_0x11a471[_0xf939('0x13')]][_0xf939('0x2c')]=utils[_0xf939('0x1f')]();agents[_0x11a471[_0xf939('0x13')]][_0xf939('0xa')]=_0x11a471[_0xf939('0xa')];agents[_0x11a471[_0xf939('0x13')]][_0xf939('0x19')]=_0x11a471['connectedlinename'];agents[_0x11a471[_0xf939('0x13')]][_0xf939('0x2d')]=_0x11a471['ringtime'];agents[_0x11a471['destuniqueid']]['lastevent']=_0xf939('0x2e');_['forIn'](agents,function(_0x527ee4,_0xf9f327){if(_0x527ee4[_0xf939('0x13')]!=_0x11a471['destuniqueid']&&_0x527ee4[_0xf939('0x5')]==_0x11a471[_0xf939('0x5')]){_0x527ee4[_0xf939('0x22')]=0x0;_0x527ee4['holdtime']=_0x11a471[_0xf939('0x2f')];_0x527ee4[_0xf939('0x1d')]=!![];_0x527ee4[_0xf939('0x1e')]=utils[_0xf939('0x1f')]();_0x527ee4[_0xf939('0xb')]='answered_elsewhere';_0x527ee4['reason']=_0xf939('0x30');_0x527ee4[_0xf939('0x31')]=_0x11a471['destuniqueid'];_0x527ee4[_0xf939('0x32')]=_0x11a471[_0xf939('0x8')];writeDB(_0x527ee4);}});}}catch(_0x11826d){utils[_0xf939('0x1b')](util[_0xf939('0x3')]('[%s][agents][agentconnect]',_0x11a471[_0xf939('0x5')]),_0x11826d);}};exports[_0xf939('0x10')]=function(_0x574149){try{if(!_[_0xf939('0x33')](agents[_0x574149[_0xf939('0x13')]])){utils[_0xf939('0x15')](util[_0xf939('0x3')]('[%s][agents][agentcomplete]',_0x574149['uniqueid']),_0x574149);utils[_0xf939('0x2')](util[_0xf939('0x3')](_0xf939('0x34'),_0x574149[_0xf939('0x5')],agents[_0x574149[_0xf939('0x13')]][_0xf939('0x8')],_0x574149['destuniqueid']));agents[_0x574149['destuniqueid']]['agentcomplete']=!![];agents[_0x574149[_0xf939('0x13')]][_0xf939('0x35')]=utils[_0xf939('0x1f')]();agents[_0x574149[_0xf939('0x13')]][_0xf939('0x22')]=utils[_0xf939('0x36')](agents[_0x574149[_0xf939('0x13')]][_0xf939('0x35')],agents[_0x574149[_0xf939('0x13')]][_0xf939('0x2c')]);agents[_0x574149[_0xf939('0x13')]][_0xf939('0x21')]=_0x574149[_0xf939('0x21')];agents[_0x574149[_0xf939('0x13')]][_0xf939('0xb')]='complete';writeDB(agents[_0x574149[_0xf939('0x13')]]);}}catch(_0x586244){utils[_0xf939('0x1b')](util[_0xf939('0x3')](_0xf939('0x37'),_0x574149[_0xf939('0x5')]),_0x586244);}};exports[_0xf939('0x38')]=function(_0x534baa){try{if(!_[_0xf939('0x33')](agents[_0x534baa[_0xf939('0x39')]])){utils[_0xf939('0x15')](util['format'](_0xf939('0x3a'),_0x534baa[_0xf939('0x5')]),_0x534baa);utils[_0xf939('0x2')](util[_0xf939('0x3')](_0xf939('0x3b'),_0x534baa[_0xf939('0x5')],agents[_0x534baa[_0xf939('0x39')]][_0xf939('0x8')],agents[_0x534baa['transfereruniqueid']][_0xf939('0x5')]));agents[_0x534baa['transfereruniqueid']][_0xf939('0x3c')]=!![];agents[_0x534baa[_0xf939('0x39')]][_0xf939('0x3d')]=_0xf939('0x3e');agents[_0x534baa[_0xf939('0x39')]][_0xf939('0x3f')]=_0x534baa[_0xf939('0x40')];agents[_0x534baa[_0xf939('0x39')]][_0xf939('0x41')]=agents[_0x534baa['transfereruniqueid']][_0xf939('0x5')];}}catch(_0x1636e6){utils[_0xf939('0x1b')](util[_0xf939('0x3')](_0xf939('0x3a'),_0x534baa['uniqueid']),_0x1636e6);}};exports['attendedtransfer']=function(_0x508bde){try{utils[_0xf939('0x15')](util[_0xf939('0x3')](_0xf939('0x42'),_0x508bde['origtransfereruniqueid']),_0x508bde);if(_0x508bde['origtransfereruniqueid']==_0x508bde[_0xf939('0x43')]){if(!_[_0xf939('0x33')](agents[_0x508bde[_0xf939('0x44')]])){utils[_0xf939('0x2')](util[_0xf939('0x3')](_0xf939('0x45'),_0x508bde[_0xf939('0x46')],agents[_0x508bde[_0xf939('0x44')]][_0xf939('0x8')]));agents[_0x508bde['secondtransfereruniqueid']][_0xf939('0x3c')]=!![];agents[_0x508bde[_0xf939('0x44')]]['transfertype']=_0xf939('0x47');agents[_0x508bde[_0xf939('0x44')]][_0xf939('0x3f')]=_0x508bde[_0xf939('0x48')];agents[_0x508bde[_0xf939('0x44')]]['transferuniqueid']=_0x508bde[_0xf939('0x46')];}if(_0x508bde[_0xf939('0x49')]&&agents[_0x508bde[_0xf939('0x49')]]){agents[_0x508bde[_0xf939('0x49')]]['agententerreason']=0x1;transfers[_0x508bde[_0xf939('0x49')]]=_[_0xf939('0x4a')](agents[_0x508bde[_0xf939('0x49')]]);transfers[_0x508bde[_0xf939('0x49')]]['calleridnum']=agents[_0x508bde['secondtransfereruniqueid']]['calleridnum'];transfers[_0x508bde[_0xf939('0x49')]][_0xf939('0x4b')]=agents[_0x508bde[_0xf939('0x44')]][_0xf939('0x4b')];transfers[_0x508bde[_0xf939('0x49')]][_0xf939('0x17')]=utils[_0xf939('0x1f')]();transfers[_0x508bde[_0xf939('0x49')]][_0xf939('0x2c')]=utils[_0xf939('0x1f')]();transfers[_0x508bde['transfereeuniqueid']][_0xf939('0x2d')]=0x0;transfers[_0x508bde['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x508bde['secondtransfereruniqueid']==_0x508bde['secondtransfererlinkedid']){if(!_['isNil'](agents[_0x508bde[_0xf939('0x46')]])){utils['info'](util[_0xf939('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x508bde[_0xf939('0x46')],agents[_0x508bde[_0xf939('0x46')]]['membername']));agents[_0x508bde[_0xf939('0x46')]]['transfer']=!![];agents[_0x508bde[_0xf939('0x46')]]['transfertype']=_0xf939('0x47');agents[_0x508bde[_0xf939('0x46')]][_0xf939('0x3f')]=_0x508bde[_0xf939('0x4c')];agents[_0x508bde[_0xf939('0x46')]]['transferuniqueid']=_0x508bde[_0xf939('0x44')];}if(_0x508bde['transfertargetuniqueid']&&agents[_0x508bde[_0xf939('0x4d')]]){agents[_0x508bde[_0xf939('0x4d')]]['agententerreason']=0x1;transfers[_0x508bde[_0xf939('0x4d')]]=_['clone'](agents[_0x508bde[_0xf939('0x4d')]]);transfers[_0x508bde[_0xf939('0x4d')]]['calleridnum']=agents[_0x508bde[_0xf939('0x46')]][_0xf939('0x9')];transfers[_0x508bde['transfertargetuniqueid']][_0xf939('0x4b')]=agents[_0x508bde[_0xf939('0x46')]][_0xf939('0x4b')];transfers[_0x508bde[_0xf939('0x4d')]]['agentcalledAt']=utils[_0xf939('0x1f')]();transfers[_0x508bde[_0xf939('0x4d')]][_0xf939('0x2c')]=utils[_0xf939('0x1f')]();transfers[_0x508bde[_0xf939('0x4d')]][_0xf939('0x2d')]=0x0;transfers[_0x508bde['transfertargetuniqueid']][_0xf939('0x4e')]=0x2;}}}catch(_0x421100){utils['error'](util[_0xf939('0x3')](_0xf939('0x42'),_0x508bde[_0xf939('0x46')]),_0x421100);}};exports['hangup']=function(_0x54fa3e){try{utils[_0xf939('0x15')](util[_0xf939('0x3')](_0xf939('0x4f'),_0x54fa3e['uniqueid']),_0x54fa3e);if(agents[_0x54fa3e[_0xf939('0x5')]]&&agents[_0x54fa3e[_0xf939('0x5')]][_0xf939('0x21')]===_0xf939('0x20')){if(_0x54fa3e['cause']==='21'){agents[_0x54fa3e[_0xf939('0x5')]][_0xf939('0x21')]=_0xf939('0x50');agents[_0x54fa3e[_0xf939('0x5')]]['lastevent']=_0xf939('0x50');}utils[_0xf939('0x2')](util[_0xf939('0x3')](_0xf939('0x51'),_0x54fa3e[_0xf939('0x5')],agents[_0x54fa3e[_0xf939('0x5')]][_0xf939('0x8')],agents[_0x54fa3e[_0xf939('0x5')]][_0xf939('0x21')],agents[_0x54fa3e['uniqueid']]['lastevent']));writeDB(agents[_0x54fa3e[_0xf939('0x5')]]);var _0x4276a7=unanswered[_0xf939('0x52')](_0x54fa3e[_0xf939('0x5')]);if(_0x4276a7>-0x1){unanswered[_0xf939('0x53')](_0x4276a7,0x1);}}if(transfers[_0x54fa3e[_0xf939('0x5')]]){transfers[_0x54fa3e[_0xf939('0x5')]][_0xf939('0x10')]=!![];transfers[_0x54fa3e[_0xf939('0x5')]]['agentcompleteAt']=utils[_0xf939('0x1f')]();transfers[_0x54fa3e[_0xf939('0x5')]][_0xf939('0x22')]=utils[_0xf939('0x36')](transfers[_0x54fa3e['uniqueid']][_0xf939('0x35')],transfers[_0x54fa3e[_0xf939('0x5')]][_0xf939('0x2c')]);transfers[_0x54fa3e['uniqueid']][_0xf939('0x21')]='agent';transfers[_0x54fa3e[_0xf939('0x5')]]['lastevent']=_0xf939('0x54');utils[_0xf939('0x2')](util['format'](_0xf939('0x51'),_0x54fa3e[_0xf939('0x5')],transfers[_0x54fa3e['uniqueid']][_0xf939('0x8')],transfers[_0x54fa3e['uniqueid']]['reason'],transfers[_0x54fa3e['uniqueid']][_0xf939('0xb')]));writeDB(transfers[_0x54fa3e[_0xf939('0x5')]],!![]);}if(agents[_0x54fa3e[_0xf939('0x5')]]&&agents[_0x54fa3e[_0xf939('0x5')]][_0xf939('0x2c')]){agents[_0x54fa3e[_0xf939('0x5')]]['agentcomplete']=!![];agents[_0x54fa3e[_0xf939('0x5')]][_0xf939('0x35')]=utils[_0xf939('0x1f')]();agents[_0x54fa3e[_0xf939('0x5')]][_0xf939('0x22')]=utils['diffTime'](agents[_0x54fa3e[_0xf939('0x5')]][_0xf939('0x35')],agents[_0x54fa3e[_0xf939('0x5')]][_0xf939('0x2c')]);agents[_0x54fa3e[_0xf939('0x5')]][_0xf939('0x21')]=agents[_0x54fa3e['uniqueid']][_0xf939('0x3c')]?_0xf939('0x3c'):'agent';agents[_0x54fa3e[_0xf939('0x5')]][_0xf939('0xb')]=_0xf939('0x54');utils['info'](util['format'](_0xf939('0x51'),_0x54fa3e[_0xf939('0x5')],agents[_0x54fa3e[_0xf939('0x5')]][_0xf939('0x8')],agents[_0x54fa3e['uniqueid']][_0xf939('0x21')],agents[_0x54fa3e[_0xf939('0x5')]][_0xf939('0xb')]));writeDB(agents[_0x54fa3e['uniqueid']]);}}catch(_0x5366f9){utils[_0xf939('0x1b')](util[_0xf939('0x3')](_0xf939('0x4f'),_0x54fa3e[_0xf939('0x5')]),_0x5366f9);}}; \ No newline at end of file +var _0x778f=['./utils','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','format','[%s][agents][agentcalled]','agentcalledAt','called','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','[%s][agents][agentringnoanswer]','agentringnoanswer','timeout','reason','holdtime','ringtime','talktime','push','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','agentconnectAt','now','connect','forIn','agentringnoanswerAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transferexten','origtransfererexten','transferuniqueid','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','complete','lodash','util'];(function(_0x389b07,_0x817969){var _0x43b730=function(_0x74def0){while(--_0x74def0){_0x389b07['push'](_0x389b07['shift']());}};_0x43b730(++_0x817969);}(_0x778f,0x1a7));var _0xf778=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x778f[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0xf778('0x0'));var util=require(_0xf778('0x1'));var utils=require(_0xf778('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5da8b0,_0x5c4af1){utils['info'](util['format'](_0xf778('0x3'),_0x5da8b0[_0xf778('0x4')],_0x5da8b0[_0xf778('0x5')],_0x5da8b0[_0xf778('0x6')],_0x5da8b0[_0xf778('0x7')],_0x5da8b0['interface'],_0x5da8b0[_0xf778('0x8')],_0x5da8b0[_0xf778('0x9')],_0x5da8b0[_0xf778('0xa')]));if(_0x5da8b0[_0xf778('0x6')]){utils[_0xf778('0xb')](_0x5da8b0['queue'])['then'](function(_0x35df3a){if(_0x35df3a){_0x5da8b0[_0xf778('0xc')]=_0x35df3a['type'];_0x5da8b0[_0xf778('0xd')]=_0x5da8b0[_0xf778('0xe')]?_0x35df3a[_0xf778('0xf')]:![];_0x5da8b0['acwtime']=_0x5da8b0[_0xf778('0xd')]?_0x35df3a[_0xf778('0x10')]:0x0;}utils[_0xf778('0x11')](_0xf778('0x12'),_0x5da8b0);});}else{utils[_0xf778('0x11')](_0xf778('0x12'),_0x5da8b0);}if(_0x5c4af1){delete transfers[_0x5da8b0[_0xf778('0x4')]];}else{delete agents[_0x5da8b0[_0xf778('0x13')]];}}exports[_0xf778('0x14')]=function(_0x12a99a){try{utils[_0xf778('0x15')](util[_0xf778('0x16')](_0xf778('0x17'),_0x12a99a[_0xf778('0x4')]),_0x12a99a);agents[_0x12a99a[_0xf778('0x13')]]=_0x12a99a;agents[_0x12a99a[_0xf778('0x13')]][_0xf778('0x18')]=utils['now']();agents[_0x12a99a[_0xf778('0x13')]][_0xf778('0xa')]=_0xf778('0x19');agents[_0x12a99a[_0xf778('0x13')]]['connectedlinenum']=null;agents[_0x12a99a['destuniqueid']][_0xf778('0x1a')]=null;utils[_0xf778('0x1b')](util[_0xf778('0x16')](_0xf778('0x1c'),_0x12a99a[_0xf778('0x4')],agents[_0x12a99a['destuniqueid']][_0xf778('0x7')],_0x12a99a[_0xf778('0x13')]));}catch(_0xe0dcf1){utils[_0xf778('0x1d')](util['format'](_0xf778('0x17'),_0x12a99a[_0xf778('0x4')]),_0xe0dcf1);}};exports['agentringnoanswer']=function(_0x5da539){try{if(!_[_0xf778('0x1e')](agents[_0x5da539[_0xf778('0x13')]])){utils[_0xf778('0x15')](util['format'](_0xf778('0x1f'),_0x5da539[_0xf778('0x4')]),_0x5da539);utils[_0xf778('0x1b')](util[_0xf778('0x16')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x5da539['uniqueid'],agents[_0x5da539['destuniqueid']][_0xf778('0x7')],_0x5da539[_0xf778('0x13')]));agents[_0x5da539['destuniqueid']][_0xf778('0x20')]=!![];agents[_0x5da539['destuniqueid']]['agentringnoanswerAt']=utils['now']();agents[_0x5da539[_0xf778('0x13')]][_0xf778('0xa')]=_0xf778('0x21');agents[_0x5da539[_0xf778('0x13')]][_0xf778('0x22')]=_0xf778('0x21');agents[_0x5da539[_0xf778('0x13')]][_0xf778('0x23')]=_0x5da539[_0xf778('0x24')]?parseInt(_0x5da539[_0xf778('0x24')])/0x3e8:0x0;agents[_0x5da539[_0xf778('0x13')]][_0xf778('0x25')]=0x0;unanswered[_0xf778('0x26')](_0x5da539[_0xf778('0x13')]);}}catch(_0x178cf0){utils[_0xf778('0x1d')](util[_0xf778('0x16')](_0xf778('0x1f'),_0x5da539['uniqueid']),_0x178cf0);}};exports['queuecallerabandon']=function(_0x31041f){try{_['forIn'](agents,function(_0x11d110,_0x449ee3){if(_0x11d110[_0xf778('0x4')]==_0x31041f[_0xf778('0x4')]&&!_['includes'](unanswered,_0x11d110[_0xf778('0x13')])){utils[_0xf778('0x15')](util[_0xf778('0x16')](_0xf778('0x27'),_0x31041f[_0xf778('0x4')]),_0x31041f);utils[_0xf778('0x1b')](util[_0xf778('0x16')](_0xf778('0x28'),_0x31041f[_0xf778('0x4')],_0x11d110[_0xf778('0x7')],_0x11d110[_0xf778('0x13')]));_0x11d110[_0xf778('0x20')]=!![];_0x11d110['agentringnoanswerAt']=utils['now']();_0x11d110[_0xf778('0xa')]=_0xf778('0x29');_0x11d110[_0xf778('0x22')]='abandoned';_0x11d110[_0xf778('0x23')]=_0x31041f[_0xf778('0x23')];_0x11d110['talktime']=0x0;writeDB(_0x11d110);}});}catch(_0x4113d0){utils[_0xf778('0x1d')](util[_0xf778('0x16')](_0xf778('0x27'),_0x31041f['uniqueid']),_0x4113d0);}};exports[_0xf778('0x2a')]=function(_0x4e57e5){try{if(agents[_0x4e57e5[_0xf778('0x13')]]){utils[_0xf778('0x15')](util['format'](_0xf778('0x2b'),_0x4e57e5[_0xf778('0x4')]),_0x4e57e5);utils[_0xf778('0x1b')](util[_0xf778('0x16')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x4e57e5[_0xf778('0x4')],agents[_0x4e57e5['destuniqueid']][_0xf778('0x7')],_0x4e57e5[_0xf778('0x13')]));agents[_0x4e57e5['destuniqueid']][_0xf778('0x2c')]=utils[_0xf778('0x2d')]();agents[_0x4e57e5['destuniqueid']][_0xf778('0x9')]=_0x4e57e5[_0xf778('0x9')];agents[_0x4e57e5[_0xf778('0x13')]]['connectedlinename']=_0x4e57e5[_0xf778('0x1a')];agents[_0x4e57e5[_0xf778('0x13')]]['holdtime']=_0x4e57e5['ringtime'];agents[_0x4e57e5[_0xf778('0x13')]][_0xf778('0xa')]=_0xf778('0x2e');_[_0xf778('0x2f')](agents,function(_0x3544ff,_0x4993e0){if(_0x3544ff[_0xf778('0x13')]!=_0x4e57e5[_0xf778('0x13')]&&_0x3544ff[_0xf778('0x4')]==_0x4e57e5['uniqueid']){_0x3544ff[_0xf778('0x25')]=0x0;_0x3544ff[_0xf778('0x23')]=_0x4e57e5['ringtime'];_0x3544ff[_0xf778('0x20')]=!![];_0x3544ff[_0xf778('0x30')]=utils[_0xf778('0x2d')]();_0x3544ff['lastevent']=_0xf778('0x31');_0x3544ff['reason']='answered_elsewhere';_0x3544ff[_0xf778('0x32')]=_0x4e57e5[_0xf778('0x13')];_0x3544ff[_0xf778('0x33')]=_0x4e57e5[_0xf778('0x7')];writeDB(_0x3544ff);}});}}catch(_0x599c19){utils['error'](util[_0xf778('0x16')](_0xf778('0x2b'),_0x4e57e5[_0xf778('0x4')]),_0x599c19);}};exports[_0xf778('0xe')]=function(_0x3dd55b){try{if(!_[_0xf778('0x1e')](agents[_0x3dd55b[_0xf778('0x13')]])){utils['debug'](util[_0xf778('0x16')](_0xf778('0x34'),_0x3dd55b[_0xf778('0x4')]),_0x3dd55b);utils[_0xf778('0x1b')](util['format'](_0xf778('0x35'),_0x3dd55b[_0xf778('0x4')],agents[_0x3dd55b[_0xf778('0x13')]]['membername'],_0x3dd55b[_0xf778('0x13')]));agents[_0x3dd55b['destuniqueid']][_0xf778('0xe')]=!![];agents[_0x3dd55b['destuniqueid']][_0xf778('0x36')]=utils[_0xf778('0x2d')]();agents[_0x3dd55b[_0xf778('0x13')]][_0xf778('0x25')]=utils[_0xf778('0x37')](agents[_0x3dd55b[_0xf778('0x13')]][_0xf778('0x36')],agents[_0x3dd55b['destuniqueid']][_0xf778('0x2c')]);agents[_0x3dd55b[_0xf778('0x13')]][_0xf778('0x22')]=_0x3dd55b[_0xf778('0x22')];agents[_0x3dd55b[_0xf778('0x13')]][_0xf778('0xa')]='complete';writeDB(agents[_0x3dd55b['destuniqueid']]);}}catch(_0xdd3476){utils['error'](util[_0xf778('0x16')]('[%s][agents][agentcomplete]',_0x3dd55b[_0xf778('0x4')]),_0xdd3476);}};exports['blindtransfer']=function(_0x2dcad1){try{if(!_[_0xf778('0x1e')](agents[_0x2dcad1[_0xf778('0x38')]])){utils['debug'](util[_0xf778('0x16')](_0xf778('0x39'),_0x2dcad1[_0xf778('0x4')]),_0x2dcad1);utils[_0xf778('0x1b')](util[_0xf778('0x16')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x2dcad1['uniqueid'],agents[_0x2dcad1['transfereruniqueid']][_0xf778('0x7')],agents[_0x2dcad1['transfereruniqueid']][_0xf778('0x4')]));agents[_0x2dcad1[_0xf778('0x38')]][_0xf778('0x3a')]=!![];agents[_0x2dcad1[_0xf778('0x38')]][_0xf778('0x3b')]='blind';agents[_0x2dcad1[_0xf778('0x38')]]['transferexten']=_0x2dcad1[_0xf778('0x3c')];agents[_0x2dcad1['transfereruniqueid']]['transferuniqueid']=agents[_0x2dcad1['transfereruniqueid']][_0xf778('0x4')];}}catch(_0x233253){utils[_0xf778('0x1d')](util[_0xf778('0x16')](_0xf778('0x39'),_0x2dcad1[_0xf778('0x4')]),_0x233253);}};exports[_0xf778('0x3d')]=function(_0x36c0ab){try{utils[_0xf778('0x15')](util[_0xf778('0x16')](_0xf778('0x3e'),_0x36c0ab[_0xf778('0x3f')]),_0x36c0ab);if(_0x36c0ab[_0xf778('0x3f')]==_0x36c0ab[_0xf778('0x40')]){if(!_['isNil'](agents[_0x36c0ab[_0xf778('0x41')]])){utils['info'](util[_0xf778('0x16')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x36c0ab[_0xf778('0x3f')],agents[_0x36c0ab[_0xf778('0x41')]][_0xf778('0x7')]));agents[_0x36c0ab[_0xf778('0x41')]][_0xf778('0x3a')]=!![];agents[_0x36c0ab[_0xf778('0x41')]][_0xf778('0x3b')]='ATTENDED';agents[_0x36c0ab[_0xf778('0x41')]][_0xf778('0x42')]=_0x36c0ab[_0xf778('0x43')];agents[_0x36c0ab['secondtransfereruniqueid']][_0xf778('0x44')]=_0x36c0ab[_0xf778('0x3f')];}if(_0x36c0ab['transfereeuniqueid']&&agents[_0x36c0ab[_0xf778('0x45')]]){agents[_0x36c0ab[_0xf778('0x45')]]['agententerreason']=0x1;transfers[_0x36c0ab['transfereeuniqueid']]=_[_0xf778('0x46')](agents[_0x36c0ab[_0xf778('0x45')]]);transfers[_0x36c0ab[_0xf778('0x45')]]['calleridnum']=agents[_0x36c0ab['secondtransfereruniqueid']][_0xf778('0x8')];transfers[_0x36c0ab[_0xf778('0x45')]][_0xf778('0x47')]=agents[_0x36c0ab[_0xf778('0x41')]]['calleridname'];transfers[_0x36c0ab[_0xf778('0x45')]][_0xf778('0x18')]=utils[_0xf778('0x2d')]();transfers[_0x36c0ab[_0xf778('0x45')]][_0xf778('0x2c')]=utils['now']();transfers[_0x36c0ab[_0xf778('0x45')]][_0xf778('0x23')]=0x0;transfers[_0x36c0ab[_0xf778('0x45')]][_0xf778('0x48')]=0x2;}}else if(_0x36c0ab[_0xf778('0x41')]==_0x36c0ab[_0xf778('0x49')]){if(!_[_0xf778('0x1e')](agents[_0x36c0ab[_0xf778('0x3f')]])){utils[_0xf778('0x1b')](util[_0xf778('0x16')](_0xf778('0x4a'),_0x36c0ab[_0xf778('0x3f')],agents[_0x36c0ab[_0xf778('0x3f')]]['membername']));agents[_0x36c0ab[_0xf778('0x3f')]][_0xf778('0x3a')]=!![];agents[_0x36c0ab[_0xf778('0x3f')]]['transfertype']='ATTENDED';agents[_0x36c0ab[_0xf778('0x3f')]]['transferexten']=_0x36c0ab[_0xf778('0x4b')];agents[_0x36c0ab[_0xf778('0x3f')]][_0xf778('0x44')]=_0x36c0ab[_0xf778('0x41')];}if(_0x36c0ab[_0xf778('0x4c')]&&agents[_0x36c0ab[_0xf778('0x4c')]]){agents[_0x36c0ab[_0xf778('0x4c')]]['agententerreason']=0x1;transfers[_0x36c0ab['transfertargetuniqueid']]=_['clone'](agents[_0x36c0ab['transfertargetuniqueid']]);transfers[_0x36c0ab[_0xf778('0x4c')]][_0xf778('0x8')]=agents[_0x36c0ab[_0xf778('0x3f')]][_0xf778('0x8')];transfers[_0x36c0ab[_0xf778('0x4c')]][_0xf778('0x47')]=agents[_0x36c0ab['origtransfereruniqueid']][_0xf778('0x47')];transfers[_0x36c0ab['transfertargetuniqueid']]['agentcalledAt']=utils[_0xf778('0x2d')]();transfers[_0x36c0ab[_0xf778('0x4c')]][_0xf778('0x2c')]=utils[_0xf778('0x2d')]();transfers[_0x36c0ab[_0xf778('0x4c')]]['holdtime']=0x0;transfers[_0x36c0ab[_0xf778('0x4c')]][_0xf778('0x48')]=0x2;}}}catch(_0x106f46){utils[_0xf778('0x1d')](util[_0xf778('0x16')]('[%s][agents][attendedtransfer]',_0x36c0ab[_0xf778('0x3f')]),_0x106f46);}};exports[_0xf778('0x4d')]=function(_0x1e8985){try{utils['debug'](util['format'](_0xf778('0x4e'),_0x1e8985[_0xf778('0x4')]),_0x1e8985);if(agents[_0x1e8985['uniqueid']]&&agents[_0x1e8985[_0xf778('0x4')]][_0xf778('0x22')]==='timeout'){if(_0x1e8985[_0xf778('0x4f')]==='21'){agents[_0x1e8985[_0xf778('0x4')]]['reason']=_0xf778('0x50');agents[_0x1e8985[_0xf778('0x4')]][_0xf778('0xa')]='rejected';}utils[_0xf778('0x1b')](util[_0xf778('0x16')](_0xf778('0x51'),_0x1e8985[_0xf778('0x4')],agents[_0x1e8985[_0xf778('0x4')]][_0xf778('0x7')],agents[_0x1e8985[_0xf778('0x4')]][_0xf778('0x22')],agents[_0x1e8985['uniqueid']][_0xf778('0xa')]));writeDB(agents[_0x1e8985[_0xf778('0x4')]]);var _0x23bd66=unanswered['indexOf'](_0x1e8985[_0xf778('0x4')]);if(_0x23bd66>-0x1){unanswered[_0xf778('0x52')](_0x23bd66,0x1);}}if(transfers[_0x1e8985['uniqueid']]){transfers[_0x1e8985[_0xf778('0x4')]][_0xf778('0xe')]=!![];transfers[_0x1e8985[_0xf778('0x4')]][_0xf778('0x36')]=utils[_0xf778('0x2d')]();transfers[_0x1e8985[_0xf778('0x4')]]['talktime']=utils[_0xf778('0x37')](transfers[_0x1e8985[_0xf778('0x4')]]['agentcompleteAt'],transfers[_0x1e8985['uniqueid']][_0xf778('0x2c')]);transfers[_0x1e8985[_0xf778('0x4')]]['reason']=_0xf778('0x53');transfers[_0x1e8985['uniqueid']]['lastevent']='complete';utils['info'](util[_0xf778('0x16')](_0xf778('0x51'),_0x1e8985[_0xf778('0x4')],transfers[_0x1e8985[_0xf778('0x4')]][_0xf778('0x7')],transfers[_0x1e8985[_0xf778('0x4')]][_0xf778('0x22')],transfers[_0x1e8985[_0xf778('0x4')]][_0xf778('0xa')]));writeDB(transfers[_0x1e8985[_0xf778('0x4')]],!![]);}if(agents[_0x1e8985[_0xf778('0x4')]]&&agents[_0x1e8985[_0xf778('0x4')]][_0xf778('0x2c')]){agents[_0x1e8985['uniqueid']][_0xf778('0xe')]=!![];agents[_0x1e8985[_0xf778('0x4')]][_0xf778('0x36')]=utils[_0xf778('0x2d')]();agents[_0x1e8985[_0xf778('0x4')]]['talktime']=utils[_0xf778('0x37')](agents[_0x1e8985[_0xf778('0x4')]][_0xf778('0x36')],agents[_0x1e8985[_0xf778('0x4')]]['agentconnectAt']);agents[_0x1e8985['uniqueid']][_0xf778('0x22')]=agents[_0x1e8985['uniqueid']][_0xf778('0x3a')]?_0xf778('0x3a'):_0xf778('0x53');agents[_0x1e8985[_0xf778('0x4')]][_0xf778('0xa')]=_0xf778('0x54');utils[_0xf778('0x1b')](util[_0xf778('0x16')](_0xf778('0x51'),_0x1e8985[_0xf778('0x4')],agents[_0x1e8985[_0xf778('0x4')]]['membername'],agents[_0x1e8985['uniqueid']][_0xf778('0x22')],agents[_0x1e8985[_0xf778('0x4')]][_0xf778('0xa')]));writeDB(agents[_0x1e8985['uniqueid']]);}}catch(_0x4ea866){utils[_0xf778('0x1d')](util[_0xf778('0x16')]('[%s][agents][hangup]',_0x1e8985['uniqueid']),_0x4ea866);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index b0e8215..fb3a22d 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 _0xe596=['interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','channelstate','info','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','util','./utils','NO\x20ANSWER','FAILED','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel'];(function(_0x1deb72,_0x3f6338){var _0x18bbdf=function(_0x1b4b9b){while(--_0x1b4b9b){_0x1deb72['push'](_0x1deb72['shift']());}};_0x18bbdf(++_0x3f6338);}(_0xe596,0x146));var _0x6e59=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xe596[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require(_0x6e59('0x0'));var utils=require(_0x6e59('0x1'));var dispositions=[_0x6e59('0x2'),_0x6e59('0x3'),_0x6e59('0x3'),'NO\x20ANSWER','NO\x20ANSWER',_0x6e59('0x2'),'ANSWERED','BUSY',_0x6e59('0x3'),_0x6e59('0x3'),'FAILED'];var channels={};function writeDB(_0x5a5d56){utils['info'](util[_0x6e59('0x4')](_0x6e59('0x5'),_0x5a5d56['uniqueid'],_0x5a5d56[_0x6e59('0x6')],_0x5a5d56['queue'],_0x5a5d56['membername'],_0x5a5d56[_0x6e59('0x7')],_0x5a5d56[_0x6e59('0x8')],_0x5a5d56[_0x6e59('0x9')],_0x5a5d56[_0x6e59('0xa')]));if(_0x5a5d56[_0x6e59('0xb')]){utils[_0x6e59('0xc')](_0x5a5d56[_0x6e59('0xb')])[_0x6e59('0xd')](function(_0x1982f6){if(_0x1982f6){_0x5a5d56[_0x6e59('0xe')]=_0x1982f6['id'];}utils[_0x6e59('0xf')](_0x6e59('0x10'),_0x5a5d56);});}else{utils[_0x6e59('0xf')](_0x6e59('0x10'),_0x5a5d56);}if(channels[_0x5a5d56[_0x6e59('0x11')]]){delete channels[_0x5a5d56[_0x6e59('0x11')]];}}exports[_0x6e59('0x12')]=function(_0x1fd746){try{utils[_0x6e59('0x13')](util[_0x6e59('0x4')](_0x6e59('0x14'),_0x1fd746[_0x6e59('0x11')]),_0x1fd746);if(_0x1fd746[_0x6e59('0x11')]==_0x1fd746[_0x6e59('0x15')]&&_0x1fd746[_0x6e59('0x6')]!=_0x6e59('0x16')){utils['info'](util[_0x6e59('0x4')](_0x6e59('0x17'),_0x1fd746[_0x6e59('0x11')],_0x1fd746[_0x6e59('0x18')],_0x1fd746[_0x6e59('0x19')]));channels[_0x1fd746[_0x6e59('0x11')]]={'uniqueid':_0x1fd746['uniqueid'],'accountcode':_0x1fd746['accountcode'],'source':_0x1fd746['calleridnum'],'destination':_0x1fd746[_0x6e59('0x19')],'destinationcontext':_0x1fd746[_0x6e59('0x18')],'channel':_0x1fd746['channel'],'starttime':utils[_0x6e59('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x6e59('0x2'),'amaflags':_0x6e59('0x1b')};}}catch(_0x481701){utils[_0x6e59('0x1c')](util[_0x6e59('0x4')]('[%s][calls][newchannel]',_0x1fd746[_0x6e59('0x11')]),_0x481701);}};exports[_0x6e59('0x1d')]=function(_0x13184d){try{utils[_0x6e59('0x13')](util[_0x6e59('0x4')](_0x6e59('0x1e'),_0x13184d['uniqueid']),_0x13184d);if(!_['isNil'](channels[_0x13184d[_0x6e59('0x11')]])&&_0x13184d[_0x6e59('0x1f')]==0x6){utils[_0x6e59('0x20')](util[_0x6e59('0x4')](_0x6e59('0x21'),_0x13184d['uniqueid'],_0x13184d['context'],_0x13184d[_0x6e59('0x6')]));if(_[_0x6e59('0x22')](channels[_0x13184d[_0x6e59('0x11')]]['systemanswertime'])){channels[_0x13184d[_0x6e59('0x11')]]['systemanswertime']=utils['now']();}}else if(!_[_0x6e59('0x22')](channels[_0x13184d['linkedid']])&&_0x13184d[_0x6e59('0x1f')]==0x6&&_0x13184d[_0x6e59('0x18')]!=_0x6e59('0x23')){utils['info'](util[_0x6e59('0x4')](_0x6e59('0x24'),_0x13184d['uniqueid'],_0x13184d[_0x6e59('0x15')],_0x13184d[_0x6e59('0x18')],_0x13184d[_0x6e59('0x6')]));channels[_0x13184d[_0x6e59('0x15')]][_0x6e59('0xb')]=_0x13184d['accountcode'];channels[_0x13184d['linkedid']][_0x6e59('0x25')]=_0x13184d['channel'];if(_[_0x6e59('0x22')](channels[_0x13184d[_0x6e59('0x15')]]['answertime'])){channels[_0x13184d[_0x6e59('0x15')]][_0x6e59('0x26')]=utils[_0x6e59('0x1a')]();}channels[_0x13184d[_0x6e59('0x15')]][_0x6e59('0x27')]=dispositions[_[_0x6e59('0x28')](_0x13184d[_0x6e59('0x1f')])]||_0x6e59('0x29');}}catch(_0x23827e){utils[_0x6e59('0x1c')](util[_0x6e59('0x4')]('[%s][calls][newstate]',_0x13184d[_0x6e59('0x11')]),_0x23827e);}};exports[_0x6e59('0x2a')]=function(_0x2a9c78){try{if(!_['isNil'](channels[_0x2a9c78[_0x6e59('0x11')]])){utils[_0x6e59('0x13')](util[_0x6e59('0x4')](_0x6e59('0x2b'),_0x2a9c78[_0x6e59('0x11')]),_0x2a9c78);if(_[_0x6e59('0x22')](channels[_0x2a9c78['uniqueid']][_0x6e59('0x2c')])){channels[_0x2a9c78[_0x6e59('0x11')]][_0x6e59('0x2c')]=_0x2a9c78[_0x6e59('0x2d')]+'\x20<'+_0x2a9c78['calleridnum']+'>';}utils['info'](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x2a9c78[_0x6e59('0x11')],channels[_0x2a9c78[_0x6e59('0x11')]][_0x6e59('0x2c')],_0x2a9c78['cause-txt']));channels[_0x2a9c78[_0x6e59('0x11')]][_0x6e59('0x2e')]=utils[_0x6e59('0x1a')]();channels[_0x2a9c78[_0x6e59('0x11')]][_0x6e59('0x2f')]=utils[_0x6e59('0x30')](channels[_0x2a9c78[_0x6e59('0x11')]][_0x6e59('0x2e')],channels[_0x2a9c78[_0x6e59('0x11')]][_0x6e59('0x31')]);channels[_0x2a9c78[_0x6e59('0x11')]][_0x6e59('0x32')]=channels[_0x2a9c78[_0x6e59('0x11')]][_0x6e59('0x26')]?utils['diffTime'](channels[_0x2a9c78['uniqueid']]['endtime'],channels[_0x2a9c78[_0x6e59('0x11')]][_0x6e59('0x26')]):0x0;writeDB(channels[_0x2a9c78[_0x6e59('0x11')]]);}}catch(_0x200644){utils[_0x6e59('0x1c')](util[_0x6e59('0x4')](_0x6e59('0x2b'),_0x2a9c78['uniqueid']),_0x200644);}};exports[_0x6e59('0x33')]=function(_0x3dc579){try{if(!_['isNil'](channels[_0x3dc579[_0x6e59('0x34')]])){utils[_0x6e59('0x13')](util[_0x6e59('0x4')](_0x6e59('0x35'),_0x3dc579[_0x6e59('0x36')]),_0x3dc579);if(channels[_0x3dc579[_0x6e59('0x34')]][_0x6e59('0x6')]==_0x3dc579[_0x6e59('0x37')]){utils[_0x6e59('0x20')](util[_0x6e59('0x4')](_0x6e59('0x38'),_0x3dc579[_0x6e59('0x36')],_0x3dc579[_0x6e59('0x34')],_0x3dc579[_0x6e59('0x39')]));channels[_0x3dc579[_0x6e59('0x34')]][_0x6e59('0x25')]=_0x3dc579[_0x6e59('0x39')];channels[_0x3dc579['localtwolinkedid']][_0x6e59('0x3a')]=_0x6e59('0x3b');}else if(channels[_0x3dc579[_0x6e59('0x34')]][_0x6e59('0x6')]=_0x3dc579[_0x6e59('0x3c')]){utils[_0x6e59('0x20')](util[_0x6e59('0x4')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x3dc579[_0x6e59('0x36')],_0x3dc579['localtwolinkedid'],_0x3dc579['origtransfererchannel']));channels[_0x3dc579[_0x6e59('0x34')]][_0x6e59('0x25')]=_0x3dc579[_0x6e59('0x3d')];channels[_0x3dc579[_0x6e59('0x34')]][_0x6e59('0x3a')]=_0x6e59('0x3b');}}}catch(_0x5b7999){utils[_0x6e59('0x1c')](util[_0x6e59('0x4')](_0x6e59('0x35'),_0x3dc579['origtransfereruniqueid']),_0x5b7999);}};exports[_0x6e59('0x3e')]=function(_0x578b63){try{if(!_[_0x6e59('0x22')](channels[_0x578b63[_0x6e59('0x11')]])){utils[_0x6e59('0x13')](util['format'](_0x6e59('0x3f'),_0x578b63[_0x6e59('0x11')]),_0x578b63);channels[_0x578b63['uniqueid']][_0x6e59('0x40')]=utils['now']();utils[_0x6e59('0x20')](util['format'](_0x6e59('0x41'),_0x578b63[_0x6e59('0x11')],channels[_0x578b63[_0x6e59('0x11')]][_0x6e59('0x40')]));}}catch(_0x4f5213){utils[_0x6e59('0x1c')](util[_0x6e59('0x4')](_0x6e59('0x3f'),_0x578b63[_0x6e59('0x11')]),_0x4f5213);}};exports['musiconholdstop']=function(_0x53cf38){try{if(!_['isNil'](channels[_0x53cf38['uniqueid']])){utils['debug'](util[_0x6e59('0x4')](_0x6e59('0x42'),_0x53cf38['uniqueid']),_0x53cf38);if(!_['isNil'](channels[_0x53cf38[_0x6e59('0x11')]][_0x6e59('0x40')])){channels[_0x53cf38[_0x6e59('0x11')]][_0x6e59('0x43')]+=utils[_0x6e59('0x30')](utils['now'](),channels[_0x53cf38[_0x6e59('0x11')]][_0x6e59('0x40')]);utils[_0x6e59('0x20')](util['format'](_0x6e59('0x44'),_0x53cf38[_0x6e59('0x11')],channels[_0x53cf38[_0x6e59('0x11')]]['mohtime']));delete channels[_0x53cf38[_0x6e59('0x11')]][_0x6e59('0x40')];}}}catch(_0x2363aa){utils[_0x6e59('0x1c')](util[_0x6e59('0x4')](_0x6e59('0x42'),_0x53cf38[_0x6e59('0x11')]),_0x2363aa);}};exports['varset']=function(_0x156757){try{if(!_[_0x6e59('0x22')](channels[_0x156757['uniqueid']])){utils[_0x6e59('0x13')](util['format'](_0x6e59('0x45'),_0x156757['uniqueid']),_0x156757);if(!_[_0x6e59('0x22')](_0x156757[_0x6e59('0x46')][_0x6e59('0x47')])){utils[_0x6e59('0x20')](util[_0x6e59('0x4')](_0x6e59('0x48'),_0x156757[_0x6e59('0x11')],_0x156757[_0x6e59('0x49')]));channels[_0x156757['uniqueid']][_0x6e59('0x4a')]=_0x156757['value'];}if(!_['isNil'](_0x156757[_0x6e59('0x46')]['xmd-phone'])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x156757['uniqueid'],_0x156757[_0x6e59('0x49')]));channels[_0x156757['uniqueid']][_0x6e59('0x4b')]=_0x156757['value'];channels[_0x156757[_0x6e59('0x11')]][_0x6e59('0x2c')]='\x22'+_0x156757[_0x6e59('0x49')]+_0x6e59('0x4c')+_0x156757[_0x6e59('0x49')]+'>';}if(!_[_0x6e59('0x22')](_0x156757[_0x6e59('0x46')][_0x6e59('0x4d')])||!_[_0x6e59('0x22')](_0x156757['variable'][_0x6e59('0x4e')])){utils[_0x6e59('0x20')](util[_0x6e59('0x4')](_0x6e59('0x4f'),_0x156757[_0x6e59('0x11')],!_[_0x6e59('0x22')](_0x156757[_0x6e59('0x46')][_0x6e59('0x4d')])?_0x6e59('0x4d'):_0x6e59('0x4e'),_0x156757['value']));channels[_0x156757['uniqueid']][_0x6e59('0x2c')]=_0x156757[_0x6e59('0x49')];}if(!_['isNil'](_0x156757[_0x6e59('0x46')][_0x6e59('0x50')])||!_[_0x6e59('0x22')](_0x156757[_0x6e59('0x46')][_0x6e59('0x51')])){utils[_0x6e59('0x20')](util[_0x6e59('0x4')](_0x6e59('0x4f'),_0x156757[_0x6e59('0x11')],!_[_0x6e59('0x22')](_0x156757[_0x6e59('0x46')]['xmd-queue'])?'xmd-queue':_0x6e59('0x51'),_0x156757[_0x6e59('0x49')]));channels[_0x156757['uniqueid']][_0x6e59('0x52')]=_0x6e59('0x53');channels[_0x156757[_0x6e59('0x11')]][_0x6e59('0x54')]=_0x156757[_0x6e59('0x49')];channels[_0x156757[_0x6e59('0x11')]][_0x6e59('0x55')]=!![];}if(!_['isNil'](_0x156757[_0x6e59('0x46')][_0x6e59('0x56')])){utils[_0x6e59('0x20')](util[_0x6e59('0x4')](_0x6e59('0x57'),_0x156757['uniqueid'],_0x156757[_0x6e59('0x49')]));channels[_0x156757[_0x6e59('0x11')]][_0x6e59('0x58')]=_0x156757[_0x6e59('0x49')];}if(!_['isNil'](_0x156757[_0x6e59('0x46')][_0x6e59('0x59')])){utils[_0x6e59('0x20')](util[_0x6e59('0x4')](_0x6e59('0x5a'),_0x156757[_0x6e59('0x11')],_0x156757[_0x6e59('0x49')]));channels[_0x156757[_0x6e59('0x11')]]['type']=_0x156757[_0x6e59('0x49')];}if(!_[_0x6e59('0x22')](_0x156757[_0x6e59('0x46')]['outboundrouteid'])){utils['info'](util[_0x6e59('0x4')](_0x6e59('0x5b'),_0x156757[_0x6e59('0x11')],_0x156757[_0x6e59('0x49')]));channels[_0x156757[_0x6e59('0x11')]][_0x6e59('0x5c')]=_0x156757[_0x6e59('0x49')];}if(!_[_0x6e59('0x22')](_0x156757[_0x6e59('0x46')][_0x6e59('0x5d')])){utils[_0x6e59('0x20')](util[_0x6e59('0x4')](_0x6e59('0x5e'),_0x156757[_0x6e59('0x11')],_0x156757['value']));channels[_0x156757[_0x6e59('0x11')]]['sipcallid']=_0x156757[_0x6e59('0x49')];}}}catch(_0x124cc8){utils[_0x6e59('0x1c')](util[_0x6e59('0x4')](_0x6e59('0x45'),_0x156757[_0x6e59('0x11')]),_0x124cc8);}};exports[_0x6e59('0x5f')]=function(_0x132745){try{if(!_[_0x6e59('0x22')](channels[_0x132745[_0x6e59('0x11')]])){utils['debug'](util[_0x6e59('0x4')](_0x6e59('0x60'),_0x132745['uniqueid']),_0x132745);utils[_0x6e59('0x20')](util[_0x6e59('0x4')](_0x6e59('0x61'),_0x132745[_0x6e59('0x11')],_0x132745[_0x6e59('0x62')],_0x132745['appdata']));if(_0x132745[_0x6e59('0x62')][_0x6e59('0x63')]()==_0x6e59('0x64')&&_[_0x6e59('0x65')](_0x132745[_0x6e59('0x66')][_0x6e59('0x63')](),_0x6e59('0x67'))){var _0x42c574=_0x132745[_0x6e59('0x66')][_0x6e59('0x68')]('=');var _0x21b527=_0x42c574[0x0][_0x6e59('0x69')](_0x42c574[0x0][_0x6e59('0x6a')]('(')+0x1,_0x42c574[0x0][_0x6e59('0x6a')](')'));var _0x245195=_0x42c574[0x1];channels[_0x132745['uniqueid']][_0x21b527]=_0x245195;}if(!_[_0x6e59('0x6b')](['hangup',_0x6e59('0x6c'),_0x6e59('0x6d'),_0x6e59('0x64'),_0x6e59('0x6e')],_0x132745[_0x6e59('0x62')][_0x6e59('0x63')]())){channels[_0x132745[_0x6e59('0x11')]][_0x6e59('0x52')]=_0x132745[_0x6e59('0x62')];channels[_0x132745[_0x6e59('0x11')]]['lastdata']=_0x132745[_0x6e59('0x66')];}}}catch(_0x28a8b9){utils[_0x6e59('0x1c')](util[_0x6e59('0x4')](_0x6e59('0x60'),_0x132745[_0x6e59('0x11')]),_0x28a8b9);}}; \ No newline at end of file +var _0xa679=['routeid','sipcallid','newexten','application','appdata','set','startsWith','cdr','substring','lastIndexOf','execif','gotoif','toLowerCase','lastapplication','[%s][calls][newexten]','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','channel','queue','interface','calleridnum','connectedlinenum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','debug','format','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','diffTime','endtime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','Queue','lastdata','xmd-contactid','ContactId','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s'];(function(_0x56b5d1,_0x59be02){var _0x5bfe4a=function(_0x9ed053){while(--_0x9ed053){_0x56b5d1['push'](_0x56b5d1['shift']());}};_0x5bfe4a(++_0x59be02);}(_0xa679,0x1a3));var _0x9a67=function(_0x4583f6,_0x3dae7e){_0x4583f6=_0x4583f6-0x0;var _0x10c5a1=_0xa679[_0x4583f6];return _0x10c5a1;};'use strict';var _=require(_0x9a67('0x0'));var util=require('util');var utils=require(_0x9a67('0x1'));var dispositions=[_0x9a67('0x2'),_0x9a67('0x3'),_0x9a67('0x3'),_0x9a67('0x2'),_0x9a67('0x2'),_0x9a67('0x2'),_0x9a67('0x4'),_0x9a67('0x5'),_0x9a67('0x3'),_0x9a67('0x3'),_0x9a67('0x3')];var channels={};function writeDB(_0x23b432){utils['info'](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x23b432['uniqueid'],_0x23b432[_0x9a67('0x6')],_0x23b432[_0x9a67('0x7')],_0x23b432['membername'],_0x23b432[_0x9a67('0x8')],_0x23b432[_0x9a67('0x9')],_0x23b432[_0x9a67('0xa')],_0x23b432[_0x9a67('0xb')]));if(_0x23b432[_0x9a67('0xc')]){utils['getUserByInternal'](_0x23b432[_0x9a67('0xc')])[_0x9a67('0xd')](function(_0x449970){if(_0x449970){_0x23b432[_0x9a67('0xe')]=_0x449970['id'];}utils[_0x9a67('0xf')](_0x9a67('0x10'),_0x23b432);});}else{utils[_0x9a67('0xf')]('CreateVoiceCallReport',_0x23b432);}if(channels[_0x23b432['uniqueid']]){delete channels[_0x23b432[_0x9a67('0x11')]];}}exports[_0x9a67('0x12')]=function(_0x252f8e){try{utils[_0x9a67('0x13')](util[_0x9a67('0x14')]('[%s][calls][newchannel]',_0x252f8e[_0x9a67('0x11')]),_0x252f8e);if(_0x252f8e[_0x9a67('0x11')]==_0x252f8e[_0x9a67('0x15')]&&_0x252f8e[_0x9a67('0x6')]!=_0x9a67('0x16')){utils[_0x9a67('0x17')](util[_0x9a67('0x14')](_0x9a67('0x18'),_0x252f8e[_0x9a67('0x11')],_0x252f8e['context'],_0x252f8e[_0x9a67('0x19')]));channels[_0x252f8e[_0x9a67('0x11')]]={'uniqueid':_0x252f8e[_0x9a67('0x11')],'accountcode':_0x252f8e[_0x9a67('0xc')],'source':_0x252f8e[_0x9a67('0x9')],'destination':_0x252f8e[_0x9a67('0x19')],'destinationcontext':_0x252f8e[_0x9a67('0x1a')],'channel':_0x252f8e[_0x9a67('0x6')],'starttime':utils[_0x9a67('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9a67('0x2'),'amaflags':_0x9a67('0x1c')};}}catch(_0xb78fb6){utils[_0x9a67('0x1d')](util['format']('[%s][calls][newchannel]',_0x252f8e[_0x9a67('0x11')]),_0xb78fb6);}};exports[_0x9a67('0x1e')]=function(_0x5a1677){try{utils[_0x9a67('0x13')](util['format'](_0x9a67('0x1f'),_0x5a1677['uniqueid']),_0x5a1677);if(!_[_0x9a67('0x20')](channels[_0x5a1677[_0x9a67('0x11')]])&&_0x5a1677[_0x9a67('0x21')]==0x6){utils['info'](util[_0x9a67('0x14')](_0x9a67('0x22'),_0x5a1677[_0x9a67('0x11')],_0x5a1677['context'],_0x5a1677[_0x9a67('0x6')]));if(_[_0x9a67('0x20')](channels[_0x5a1677[_0x9a67('0x11')]]['systemanswertime'])){channels[_0x5a1677[_0x9a67('0x11')]][_0x9a67('0x23')]=utils[_0x9a67('0x1b')]();}}else if(!_[_0x9a67('0x20')](channels[_0x5a1677['linkedid']])&&_0x5a1677['channelstate']==0x6&&_0x5a1677['context']!=_0x9a67('0x24')){utils['info'](util[_0x9a67('0x14')](_0x9a67('0x25'),_0x5a1677[_0x9a67('0x11')],_0x5a1677['linkedid'],_0x5a1677[_0x9a67('0x1a')],_0x5a1677[_0x9a67('0x6')]));channels[_0x5a1677['linkedid']][_0x9a67('0xc')]=_0x5a1677['accountcode'];channels[_0x5a1677['linkedid']][_0x9a67('0x26')]=_0x5a1677['channel'];if(_[_0x9a67('0x20')](channels[_0x5a1677[_0x9a67('0x15')]]['answertime'])){channels[_0x5a1677['linkedid']][_0x9a67('0x27')]=utils[_0x9a67('0x1b')]();}channels[_0x5a1677[_0x9a67('0x15')]][_0x9a67('0x28')]=dispositions[_['toNumber'](_0x5a1677[_0x9a67('0x21')])]||'ANSWERED';}}catch(_0xc47f0e){utils[_0x9a67('0x1d')](util[_0x9a67('0x14')]('[%s][calls][newstate]',_0x5a1677['uniqueid']),_0xc47f0e);}};exports['hangup']=function(_0x537640){try{if(!_[_0x9a67('0x20')](channels[_0x537640[_0x9a67('0x11')]])){utils[_0x9a67('0x13')](util[_0x9a67('0x14')](_0x9a67('0x29'),_0x537640[_0x9a67('0x11')]),_0x537640);if(_[_0x9a67('0x20')](channels[_0x537640[_0x9a67('0x11')]][_0x9a67('0x2a')])){channels[_0x537640[_0x9a67('0x11')]][_0x9a67('0x2a')]=_0x537640['calleridname']+'\x20<'+_0x537640['calleridnum']+'>';}utils['info'](util['format'](_0x9a67('0x2b'),_0x537640[_0x9a67('0x11')],channels[_0x537640['uniqueid']]['callerid'],_0x537640[_0x9a67('0x2c')]));channels[_0x537640[_0x9a67('0x11')]]['endtime']=utils['now']();channels[_0x537640[_0x9a67('0x11')]]['duration']=utils[_0x9a67('0x2d')](channels[_0x537640[_0x9a67('0x11')]][_0x9a67('0x2e')],channels[_0x537640['uniqueid']][_0x9a67('0x2f')]);channels[_0x537640[_0x9a67('0x11')]][_0x9a67('0x30')]=channels[_0x537640[_0x9a67('0x11')]][_0x9a67('0x27')]?utils[_0x9a67('0x2d')](channels[_0x537640[_0x9a67('0x11')]][_0x9a67('0x2e')],channels[_0x537640[_0x9a67('0x11')]][_0x9a67('0x27')]):0x0;writeDB(channels[_0x537640[_0x9a67('0x11')]]);}}catch(_0x175e65){utils['error'](util[_0x9a67('0x14')](_0x9a67('0x29'),_0x537640[_0x9a67('0x11')]),_0x175e65);}};exports['attendedtransfer']=function(_0xf8a57b){try{if(!_[_0x9a67('0x20')](channels[_0xf8a57b[_0x9a67('0x31')]])){utils[_0x9a67('0x13')](util[_0x9a67('0x14')](_0x9a67('0x32'),_0xf8a57b[_0x9a67('0x33')]),_0xf8a57b);if(channels[_0xf8a57b[_0x9a67('0x31')]][_0x9a67('0x6')]==_0xf8a57b[_0x9a67('0x34')]){utils[_0x9a67('0x17')](util[_0x9a67('0x14')](_0x9a67('0x35'),_0xf8a57b[_0x9a67('0x33')],_0xf8a57b[_0x9a67('0x31')],_0xf8a57b[_0x9a67('0x36')]));channels[_0xf8a57b[_0x9a67('0x31')]][_0x9a67('0x26')]=_0xf8a57b[_0x9a67('0x36')];channels[_0xf8a57b[_0x9a67('0x31')]][_0x9a67('0x37')]=_0x9a67('0x38');}else if(channels[_0xf8a57b[_0x9a67('0x31')]][_0x9a67('0x6')]=_0xf8a57b['transfertargetchannel']){utils[_0x9a67('0x17')](util[_0x9a67('0x14')](_0x9a67('0x35'),_0xf8a57b[_0x9a67('0x33')],_0xf8a57b['localtwolinkedid'],_0xf8a57b['origtransfererchannel']));channels[_0xf8a57b[_0x9a67('0x31')]]['destinationchannel']=_0xf8a57b[_0x9a67('0x39')];channels[_0xf8a57b[_0x9a67('0x31')]][_0x9a67('0x37')]='_attended';}}}catch(_0x37e635){utils['error'](util[_0x9a67('0x14')](_0x9a67('0x32'),_0xf8a57b['origtransfereruniqueid']),_0x37e635);}};exports['musiconholdstart']=function(_0x599653){try{if(!_[_0x9a67('0x20')](channels[_0x599653[_0x9a67('0x11')]])){utils[_0x9a67('0x13')](util[_0x9a67('0x14')](_0x9a67('0x3a'),_0x599653[_0x9a67('0x11')]),_0x599653);channels[_0x599653[_0x9a67('0x11')]][_0x9a67('0x3b')]=utils[_0x9a67('0x1b')]();utils[_0x9a67('0x17')](util[_0x9a67('0x14')](_0x9a67('0x3c'),_0x599653[_0x9a67('0x11')],channels[_0x599653['uniqueid']][_0x9a67('0x3b')]));}}catch(_0x2e1d1e){utils['error'](util[_0x9a67('0x14')](_0x9a67('0x3a'),_0x599653[_0x9a67('0x11')]),_0x2e1d1e);}};exports[_0x9a67('0x3d')]=function(_0x2fcfe8){try{if(!_['isNil'](channels[_0x2fcfe8['uniqueid']])){utils[_0x9a67('0x13')](util['format'](_0x9a67('0x3e'),_0x2fcfe8[_0x9a67('0x11')]),_0x2fcfe8);if(!_[_0x9a67('0x20')](channels[_0x2fcfe8[_0x9a67('0x11')]][_0x9a67('0x3b')])){channels[_0x2fcfe8['uniqueid']][_0x9a67('0x3f')]+=utils['diffTime'](utils[_0x9a67('0x1b')](),channels[_0x2fcfe8[_0x9a67('0x11')]][_0x9a67('0x3b')]);utils['info'](util[_0x9a67('0x14')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x2fcfe8[_0x9a67('0x11')],channels[_0x2fcfe8[_0x9a67('0x11')]][_0x9a67('0x3f')]));delete channels[_0x2fcfe8['uniqueid']]['musiconholdstartAt'];}}}catch(_0x416f67){utils[_0x9a67('0x1d')](util[_0x9a67('0x14')](_0x9a67('0x3e'),_0x2fcfe8['uniqueid']),_0x416f67);}};exports[_0x9a67('0x40')]=function(_0xbe83da){try{if(!_[_0x9a67('0x20')](channels[_0xbe83da['uniqueid']])){utils[_0x9a67('0x13')](util['format'](_0x9a67('0x41'),_0xbe83da['uniqueid']),_0xbe83da);if(!_['isNil'](_0xbe83da[_0x9a67('0x42')][_0x9a67('0x43')])){utils['info'](util[_0x9a67('0x14')](_0x9a67('0x44'),_0xbe83da[_0x9a67('0x11')],_0xbe83da[_0x9a67('0x45')]));channels[_0xbe83da[_0x9a67('0x11')]][_0x9a67('0x46')]=_0xbe83da['value'];}if(!_[_0x9a67('0x20')](_0xbe83da[_0x9a67('0x42')][_0x9a67('0x47')])){utils[_0x9a67('0x17')](util[_0x9a67('0x14')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0xbe83da['uniqueid'],_0xbe83da[_0x9a67('0x45')]));channels[_0xbe83da[_0x9a67('0x11')]][_0x9a67('0x48')]=_0xbe83da[_0x9a67('0x45')];channels[_0xbe83da[_0x9a67('0x11')]][_0x9a67('0x2a')]='\x22'+_0xbe83da[_0x9a67('0x45')]+_0x9a67('0x49')+_0xbe83da[_0x9a67('0x45')]+'>';}if(!_['isNil'](_0xbe83da[_0x9a67('0x42')][_0x9a67('0x4a')])||!_[_0x9a67('0x20')](_0xbe83da[_0x9a67('0x42')][_0x9a67('0x4b')])){utils['info'](util[_0x9a67('0x14')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0xbe83da[_0x9a67('0x11')],!_[_0x9a67('0x20')](_0xbe83da[_0x9a67('0x42')]['xmd-callerid-preview'])?'xmd-callerid-preview':'xmd-callerid',_0xbe83da[_0x9a67('0x45')]));channels[_0xbe83da[_0x9a67('0x11')]][_0x9a67('0x2a')]=_0xbe83da[_0x9a67('0x45')];}if(!_[_0x9a67('0x20')](_0xbe83da['variable'][_0x9a67('0x4c')])||!_['isNil'](_0xbe83da[_0x9a67('0x42')][_0x9a67('0x4d')])){utils['info'](util[_0x9a67('0x14')](_0x9a67('0x4e'),_0xbe83da[_0x9a67('0x11')],!_[_0x9a67('0x20')](_0xbe83da[_0x9a67('0x42')][_0x9a67('0x4c')])?_0x9a67('0x4c'):_0x9a67('0x4d'),_0xbe83da['value']));channels[_0xbe83da[_0x9a67('0x11')]]['lastapplication']=_0x9a67('0x4f');channels[_0xbe83da[_0x9a67('0x11')]][_0x9a67('0x50')]=_0xbe83da[_0x9a67('0x45')];channels[_0xbe83da[_0x9a67('0x11')]][_0x9a67('0x7')]=!![];}if(!_[_0x9a67('0x20')](_0xbe83da[_0x9a67('0x42')][_0x9a67('0x51')])){utils[_0x9a67('0x17')](util[_0x9a67('0x14')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0xbe83da['uniqueid'],_0xbe83da[_0x9a67('0x45')]));channels[_0xbe83da['uniqueid']][_0x9a67('0x52')]=_0xbe83da[_0x9a67('0x45')];}if(!_[_0x9a67('0x20')](_0xbe83da[_0x9a67('0x42')]['xmd-cdrtype'])){utils['info'](util[_0x9a67('0x14')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0xbe83da['uniqueid'],_0xbe83da[_0x9a67('0x45')]));channels[_0xbe83da[_0x9a67('0x11')]][_0x9a67('0x53')]=_0xbe83da[_0x9a67('0x45')];}if(!_[_0x9a67('0x20')](_0xbe83da[_0x9a67('0x42')][_0x9a67('0x54')])){utils[_0x9a67('0x17')](util[_0x9a67('0x14')](_0x9a67('0x55'),_0xbe83da[_0x9a67('0x11')],_0xbe83da[_0x9a67('0x45')]));channels[_0xbe83da[_0x9a67('0x11')]][_0x9a67('0x56')]=_0xbe83da[_0x9a67('0x45')];}if(!_[_0x9a67('0x20')](_0xbe83da[_0x9a67('0x42')]['sipcallid'])){utils[_0x9a67('0x17')](util['format']('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0xbe83da[_0x9a67('0x11')],_0xbe83da[_0x9a67('0x45')]));channels[_0xbe83da['uniqueid']][_0x9a67('0x57')]=_0xbe83da['value'];}}}catch(_0x2a886a){utils['error'](util['format'](_0x9a67('0x41'),_0xbe83da['uniqueid']),_0x2a886a);}};exports[_0x9a67('0x58')]=function(_0x3032d0){try{if(!_[_0x9a67('0x20')](channels[_0x3032d0['uniqueid']])){utils[_0x9a67('0x13')](util[_0x9a67('0x14')]('[%s][calls][newexten]',_0x3032d0['uniqueid']),_0x3032d0);utils[_0x9a67('0x17')](util[_0x9a67('0x14')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x3032d0[_0x9a67('0x11')],_0x3032d0[_0x9a67('0x59')],_0x3032d0[_0x9a67('0x5a')]));if(_0x3032d0[_0x9a67('0x59')]['toLowerCase']()==_0x9a67('0x5b')&&_[_0x9a67('0x5c')](_0x3032d0[_0x9a67('0x5a')]['toLowerCase'](),_0x9a67('0x5d'))){var _0x546e7a=_0x3032d0[_0x9a67('0x5a')]['split']('=');var _0x2131ad=_0x546e7a[0x0][_0x9a67('0x5e')](_0x546e7a[0x0][_0x9a67('0x5f')]('(')+0x1,_0x546e7a[0x0][_0x9a67('0x5f')](')'));var _0x50a594=_0x546e7a[0x1];channels[_0x3032d0[_0x9a67('0x11')]][_0x2131ad]=_0x50a594;}if(!_['includes'](['hangup','noop',_0x9a67('0x60'),_0x9a67('0x5b'),_0x9a67('0x61')],_0x3032d0['application'][_0x9a67('0x62')]())){channels[_0x3032d0[_0x9a67('0x11')]][_0x9a67('0x63')]=_0x3032d0[_0x9a67('0x59')];channels[_0x3032d0[_0x9a67('0x11')]][_0x9a67('0x50')]=_0x3032d0[_0x9a67('0x5a')];}}}catch(_0x197330){utils[_0x9a67('0x1d')](util[_0x9a67('0x14')](_0x9a67('0x64'),_0x3032d0[_0x9a67('0x11')]),_0x197330);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index c10a0b8..d69d4bb 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 _0x1309=['error','[core]\x20error','close','[core]\x20close','./utils','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted'];(function(_0x2fbcc0,_0x4227ae){var _0x214e60=function(_0x100a4c){while(--_0x100a4c){_0x2fbcc0['push'](_0x2fbcc0['shift']());}};_0x214e60(++_0x4227ae);}(_0x1309,0x10c));var _0x9130=function(_0x4dd4f1,_0xb36bae){_0x4dd4f1=_0x4dd4f1-0x0;var _0x24f712=_0x1309[_0x4dd4f1];return _0x24f712;};'use strict';var utils=require(_0x9130('0x0'));exports[_0x9130('0x1')]=function(){utils[_0x9130('0x2')](_0x9130('0x3'));};exports['shutdown']=function(){utils['info'](_0x9130('0x4'));};exports[_0x9130('0x5')]=function(){utils[_0x9130('0x2')](_0x9130('0x6'));};exports[_0x9130('0x7')]=function(_0x147924){utils[_0x9130('0x7')](_0x9130('0x8'),_0x147924);};exports[_0x9130('0x9')]=function(){utils[_0x9130('0x2')](_0x9130('0xa'));};exports['managerevent']=function(_0x51dd39){}; \ No newline at end of file +var _0xdb8b=['close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error'];(function(_0x5efa89,_0x44392b){var _0x493f8b=function(_0x11aed0){while(--_0x11aed0){_0x5efa89['push'](_0x5efa89['shift']());}};_0x493f8b(++_0x44392b);}(_0xdb8b,0x183));var _0xbdb8=function(_0x19251c,_0x99005f){_0x19251c=_0x19251c-0x0;var _0x2b7381=_0xdb8b[_0x19251c];return _0x2b7381;};'use strict';var utils=require(_0xbdb8('0x0'));exports[_0xbdb8('0x1')]=function(){utils[_0xbdb8('0x2')](_0xbdb8('0x3'));};exports[_0xbdb8('0x4')]=function(){utils[_0xbdb8('0x2')]('[core]\x20shutdown');};exports[_0xbdb8('0x5')]=function(){utils[_0xbdb8('0x2')](_0xbdb8('0x6'));};exports[_0xbdb8('0x7')]=function(_0x22e7a6){utils[_0xbdb8('0x7')](_0xbdb8('0x8'),_0x22e7a6);};exports[_0xbdb8('0x9')]=function(){utils[_0xbdb8('0x2')](_0xbdb8('0xa'));};exports[_0xbdb8('0xb')]=function(_0x50d054){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index ad2ad33..865b1fc 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 _0x56e4=['cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','dialstatus','uniqueid','newexten','[%s][dials][newexten]','info','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','starttime','now','lastevent','dialend','debug','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname'];(function(_0x656467,_0xcd5939){var _0x3d3ba1=function(_0x1ff341){while(--_0x1ff341){_0x656467['push'](_0x656467['shift']());}};_0x3d3ba1(++_0xcd5939);}(_0x56e4,0x165));var _0x456e=function(_0x460425,_0x3a736f){_0x460425=_0x460425-0x0;var _0x2558bd=_0x56e4[_0x460425];return _0x2558bd;};'use strict';var _=require(_0x456e('0x0'));var util=require('util');var utils=require(_0x456e('0x1'));var dials={};function writeDB(_0x15ea64){utils['info'](util[_0x456e('0x2')](_0x456e('0x3'),_0x15ea64['uniqueid'],_0x15ea64[_0x456e('0x4')],_0x15ea64[_0x456e('0x5')],_0x15ea64[_0x456e('0x6')],_0x15ea64['connectedlinenum'],_0x15ea64[_0x456e('0x7')]));utils['request']('CreateVoiceDialReport',_0x15ea64);delete dials[_0x15ea64[_0x456e('0x8')]];}exports[_0x456e('0x9')]=function(_0x4f9cf3){try{utils['debug'](util['format'](_0x456e('0xa'),_0x4f9cf3['uniqueid']),_0x4f9cf3);utils[_0x456e('0xb')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x4f9cf3[_0x456e('0x8')],_0x4f9cf3[_0x456e('0xc')],_0x4f9cf3['appdata']));if(_0x4f9cf3['application'][_0x456e('0xd')]()==_0x456e('0xe')&&_[_0x456e('0xf')](_0x4f9cf3[_0x456e('0x10')][_0x456e('0xd')](),_0x456e('0x11'))){var _0x55eb95=_0x4f9cf3[_0x456e('0x10')][_0x456e('0x12')]('=');dials[_0x4f9cf3[_0x456e('0x8')]]={'routeId':_0x55eb95[0x1]};}}catch(_0x4eb8e1){utils[_0x456e('0x13')](util[_0x456e('0x2')](_0x456e('0xa'),_0x4f9cf3[_0x456e('0x8')]),_0x4eb8e1);}};exports[_0x456e('0x14')]=function(_0x5bd3ad){try{utils['debug'](util['format'](_0x456e('0x15'),_0x5bd3ad['uniqueid']),_0x5bd3ad);if(!_[_0x456e('0x16')](_0x5bd3ad['variable']['outboundrouteid'])){utils['info'](util[_0x456e('0x2')](_0x456e('0x17'),_0x5bd3ad[_0x456e('0x8')],_0x5bd3ad['value']));dials[_0x5bd3ad[_0x456e('0x8')]]={'routeId':_0x5bd3ad[_0x456e('0x18')]};}}catch(_0x54092e){utils[_0x456e('0x13')](util['format']('[%s][dials][varset]',_0x5bd3ad['uniqueid']),_0x54092e);}};exports[_0x456e('0x19')]=function(_0x17c979){try{if(!_[_0x456e('0x16')](dials[_0x17c979[_0x456e('0x8')]])){utils['debug'](util[_0x456e('0x2')](_0x456e('0x1a'),_0x17c979[_0x456e('0x8')]),_0x17c979);dials[_0x17c979[_0x456e('0x8')]]=_['assign'](dials[_0x17c979[_0x456e('0x8')]],_0x17c979);dials[_0x17c979['uniqueid']][_0x456e('0x1b')]=utils[_0x456e('0x1c')]();dials[_0x17c979[_0x456e('0x8')]][_0x456e('0x1d')]='called';utils[_0x456e('0xb')](util[_0x456e('0x2')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x17c979[_0x456e('0x8')],dials[_0x17c979[_0x456e('0x8')]][_0x456e('0x1b')]));}}catch(_0x17df50){utils[_0x456e('0x13')](util[_0x456e('0x2')](_0x456e('0x1a'),_0x17c979[_0x456e('0x8')]),_0x17df50);}};exports[_0x456e('0x1e')]=function(_0x451119){try{if(!_[_0x456e('0x16')](dials[_0x451119[_0x456e('0x8')]])){utils[_0x456e('0x1f')](util[_0x456e('0x2')]('[%s][dials][dialend]',_0x451119[_0x456e('0x8')]),_0x451119);dials[_0x451119[_0x456e('0x8')]]['dialstatus']=_0x451119[_0x456e('0x7')];if(_0x451119['dialstatus']==_0x456e('0x20')){dials[_0x451119[_0x456e('0x8')]]=_[_0x456e('0x21')](dials[_0x451119['uniqueid']],_0x451119);dials[_0x451119[_0x456e('0x8')]][_0x456e('0x22')]=utils[_0x456e('0x1c')]();dials[_0x451119[_0x456e('0x8')]][_0x456e('0x1d')]=_0x456e('0x23');utils['info'](util[_0x456e('0x2')](_0x456e('0x24'),_0x451119[_0x456e('0x8')],_0x451119[_0x456e('0x7')],dials[_0x451119[_0x456e('0x8')]]['answertime']));}else{utils['info'](util[_0x456e('0x2')](_0x456e('0x25'),_0x451119['uniqueid'],_0x451119['dialstatus']));}}}catch(_0x51831a){utils[_0x456e('0x13')](util[_0x456e('0x2')](_0x456e('0x26'),_0x451119[_0x456e('0x8')]),_0x51831a);}};exports[_0x456e('0x27')]=function(_0x5f3472){try{if(!_[_0x456e('0x16')](dials[_0x5f3472[_0x456e('0x8')]])){utils[_0x456e('0x1f')](util['format'](_0x456e('0x28'),_0x5f3472[_0x456e('0x8')]),_0x5f3472);utils[_0x456e('0xb')](util[_0x456e('0x2')](_0x456e('0x29'),_0x5f3472[_0x456e('0x8')],_0x5f3472[_0x456e('0x6')],_0x5f3472[_0x456e('0x2a')],_0x5f3472[_0x456e('0x2b')]));dials[_0x5f3472['uniqueid']]=_[_0x456e('0x21')](dials[_0x5f3472['uniqueid']],{'endtime':utils[_0x456e('0x1c')](),'lastevent':_0x456e('0x2c')});dials[_0x5f3472[_0x456e('0x8')]][_0x456e('0x2d')]=utils[_0x456e('0x2e')](dials[_0x5f3472[_0x456e('0x8')]][_0x456e('0x2f')],dials[_0x5f3472[_0x456e('0x8')]][_0x456e('0x1b')]);dials[_0x5f3472[_0x456e('0x8')]][_0x456e('0x30')]=utils[_0x456e('0x2e')](dials[_0x5f3472['uniqueid']][_0x456e('0x22')]||dials[_0x5f3472[_0x456e('0x8')]][_0x456e('0x2f')],dials[_0x5f3472['uniqueid']][_0x456e('0x1b')]);dials[_0x5f3472[_0x456e('0x8')]][_0x456e('0x31')]=dials[_0x5f3472[_0x456e('0x8')]][_0x456e('0x22')]?utils[_0x456e('0x2e')](dials[_0x5f3472[_0x456e('0x8')]][_0x456e('0x2f')],dials[_0x5f3472[_0x456e('0x8')]]['answertime']):0x0;writeDB(dials[_0x5f3472[_0x456e('0x8')]]);}}catch(_0x3f81a9){utils[_0x456e('0x13')](util[_0x456e('0x2')]('[%s][dials][hangup]',_0x5f3472[_0x456e('0x8')]),_0x3f81a9);}}; \ No newline at end of file +var _0x25f6=['cause-txt','complete','diffTime','endtime','billableseconds','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','appdata','cdr(routeid)','split','error','debug','[%s][dials][varset]','isNil','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','now','starttime','dialend','[%s][dials][dialend]','ANSWER','answertime','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','calleridname'];(function(_0x442252,_0xff6748){var _0x4be7e2=function(_0x56989b){while(--_0x56989b){_0x442252['push'](_0x442252['shift']());}};_0x4be7e2(++_0xff6748);}(_0x25f6,0x1e5));var _0x625f=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0x25f6[_0x425716];return _0x2d39af;};'use strict';var _=require('lodash');var util=require(_0x625f('0x0'));var utils=require(_0x625f('0x1'));var dials={};function writeDB(_0x19f87d){utils[_0x625f('0x2')](util[_0x625f('0x3')](_0x625f('0x4'),_0x19f87d[_0x625f('0x5')],_0x19f87d[_0x625f('0x6')],_0x19f87d['dialstring'],_0x19f87d[_0x625f('0x7')],_0x19f87d[_0x625f('0x8')],_0x19f87d[_0x625f('0x9')]));utils[_0x625f('0xa')](_0x625f('0xb'),_0x19f87d);delete dials[_0x19f87d[_0x625f('0x5')]];}exports[_0x625f('0xc')]=function(_0x3fc426){try{utils['debug'](util[_0x625f('0x3')](_0x625f('0xd'),_0x3fc426['uniqueid']),_0x3fc426);utils[_0x625f('0x2')](util[_0x625f('0x3')](_0x625f('0xe'),_0x3fc426[_0x625f('0x5')],_0x3fc426[_0x625f('0xf')],_0x3fc426['appdata']));if(_0x3fc426[_0x625f('0xf')][_0x625f('0x10')]()==_0x625f('0x11')&&_['startsWith'](_0x3fc426[_0x625f('0x12')][_0x625f('0x10')](),_0x625f('0x13'))){var _0x6967b6=_0x3fc426[_0x625f('0x12')][_0x625f('0x14')]('=');dials[_0x3fc426[_0x625f('0x5')]]={'routeId':_0x6967b6[0x1]};}}catch(_0x6cbece){utils[_0x625f('0x15')](util[_0x625f('0x3')](_0x625f('0xd'),_0x3fc426[_0x625f('0x5')]),_0x6cbece);}};exports['varset']=function(_0x4a9e35){try{utils[_0x625f('0x16')](util['format'](_0x625f('0x17'),_0x4a9e35[_0x625f('0x5')]),_0x4a9e35);if(!_[_0x625f('0x18')](_0x4a9e35['variable'][_0x625f('0x19')])){utils[_0x625f('0x2')](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x4a9e35[_0x625f('0x5')],_0x4a9e35['value']));dials[_0x4a9e35['uniqueid']]={'routeId':_0x4a9e35[_0x625f('0x1a')]};}}catch(_0x41f4e2){utils[_0x625f('0x15')](util['format']('[%s][dials][varset]',_0x4a9e35[_0x625f('0x5')]),_0x41f4e2);}};exports[_0x625f('0x1b')]=function(_0x5b7a31){try{if(!_[_0x625f('0x18')](dials[_0x5b7a31['uniqueid']])){utils['debug'](util[_0x625f('0x3')](_0x625f('0x1c'),_0x5b7a31['uniqueid']),_0x5b7a31);dials[_0x5b7a31[_0x625f('0x5')]]=_[_0x625f('0x1d')](dials[_0x5b7a31[_0x625f('0x5')]],_0x5b7a31);dials[_0x5b7a31['uniqueid']]['starttime']=utils[_0x625f('0x1e')]();dials[_0x5b7a31[_0x625f('0x5')]]['lastevent']='called';utils[_0x625f('0x2')](util[_0x625f('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x5b7a31['uniqueid'],dials[_0x5b7a31[_0x625f('0x5')]][_0x625f('0x1f')]));}}catch(_0x25afb5){utils[_0x625f('0x15')](util[_0x625f('0x3')](_0x625f('0x1c'),_0x5b7a31[_0x625f('0x5')]),_0x25afb5);}};exports[_0x625f('0x20')]=function(_0x3ce77c){try{if(!_[_0x625f('0x18')](dials[_0x3ce77c[_0x625f('0x5')]])){utils[_0x625f('0x16')](util['format'](_0x625f('0x21'),_0x3ce77c[_0x625f('0x5')]),_0x3ce77c);dials[_0x3ce77c[_0x625f('0x5')]][_0x625f('0x9')]=_0x3ce77c['dialstatus'];if(_0x3ce77c[_0x625f('0x9')]==_0x625f('0x22')){dials[_0x3ce77c[_0x625f('0x5')]]=_[_0x625f('0x1d')](dials[_0x3ce77c['uniqueid']],_0x3ce77c);dials[_0x3ce77c['uniqueid']][_0x625f('0x23')]=utils[_0x625f('0x1e')]();dials[_0x3ce77c[_0x625f('0x5')]][_0x625f('0x24')]='connect';utils[_0x625f('0x2')](util['format'](_0x625f('0x25'),_0x3ce77c[_0x625f('0x5')],_0x3ce77c[_0x625f('0x9')],dials[_0x3ce77c[_0x625f('0x5')]][_0x625f('0x23')]));}else{utils[_0x625f('0x2')](util[_0x625f('0x3')](_0x625f('0x26'),_0x3ce77c[_0x625f('0x5')],_0x3ce77c['dialstatus']));}}}catch(_0x4a6a3c){utils[_0x625f('0x15')](util[_0x625f('0x3')](_0x625f('0x21'),_0x3ce77c[_0x625f('0x5')]),_0x4a6a3c);}};exports[_0x625f('0x27')]=function(_0x27b065){try{if(!_['isNil'](dials[_0x27b065[_0x625f('0x5')]])){utils[_0x625f('0x16')](util['format'](_0x625f('0x28'),_0x27b065[_0x625f('0x5')]),_0x27b065);utils['info'](util['format'](_0x625f('0x29'),_0x27b065[_0x625f('0x5')],_0x27b065[_0x625f('0x7')],_0x27b065[_0x625f('0x2a')],_0x27b065[_0x625f('0x2b')]));dials[_0x27b065[_0x625f('0x5')]]=_['assign'](dials[_0x27b065[_0x625f('0x5')]],{'endtime':utils[_0x625f('0x1e')](),'lastevent':_0x625f('0x2c')});dials[_0x27b065[_0x625f('0x5')]]['duration']=utils[_0x625f('0x2d')](dials[_0x27b065[_0x625f('0x5')]][_0x625f('0x2e')],dials[_0x27b065[_0x625f('0x5')]][_0x625f('0x1f')]);dials[_0x27b065[_0x625f('0x5')]]['holdtime']=utils[_0x625f('0x2d')](dials[_0x27b065[_0x625f('0x5')]][_0x625f('0x23')]||dials[_0x27b065[_0x625f('0x5')]][_0x625f('0x2e')],dials[_0x27b065['uniqueid']][_0x625f('0x1f')]);dials[_0x27b065[_0x625f('0x5')]][_0x625f('0x2f')]=dials[_0x27b065[_0x625f('0x5')]][_0x625f('0x23')]?utils['diffTime'](dials[_0x27b065[_0x625f('0x5')]]['endtime'],dials[_0x27b065['uniqueid']][_0x625f('0x23')]):0x0;writeDB(dials[_0x27b065[_0x625f('0x5')]]);}}catch(_0x33f6b2){utils['error'](util[_0x625f('0x3')](_0x625f('0x28'),_0x27b065['uniqueid']),_0x33f6b2);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 68bf6c8..f48187c 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 _0x480c=['agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','asterisk','port','username','password','keepConnected','xdr','info','XDR\x20DISABLED','./agents.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','format'];(function(_0x1602fb,_0x20b6b3){var _0x461831=function(_0x4a19f1){while(--_0x4a19f1){_0x1602fb['push'](_0x1602fb['shift']());}};_0x461831(++_0x20b6b3);}(_0x480c,0x12f));var _0xc480=function(_0x1e7c38,_0x5593f7){_0x1e7c38=_0x1e7c38-0x0;var _0x4e3d13=_0x480c[_0x1e7c38];return _0x4e3d13;};var AsteriskManager=require('asterisk-manager');var config=require(_0xc480('0x0'));var utils=require(_0xc480('0x1'));var util=require(_0xc480('0x2'));var ami=new AsteriskManager(config[_0xc480('0x3')][_0xc480('0x4')],config['asterisk']['ip'],config[_0xc480('0x3')][_0xc480('0x5')],config[_0xc480('0x3')][_0xc480('0x6')],!![]);ami[_0xc480('0x7')]();if(config['xdr']&&config[_0xc480('0x8')]['disabled']){utils[_0xc480('0x9')](_0xc480('0xa'));}else{var agents=require(_0xc480('0xb'));var calls=require('./calls.controller');var queues=require(_0xc480('0xc'));var recordings=require(_0xc480('0xd'));var members=require('./members.controller');var dials=require(_0xc480('0xe'));var transfers=require(_0xc480('0xf'));var core=require(_0xc480('0x10'));ami['on'](_0xc480('0x11'),core[_0xc480('0x11')]);ami['on'](_0xc480('0x12'),core[_0xc480('0x12')]);ami['on'](_0xc480('0x13'),core[_0xc480('0x13')]);ami['on'](_0xc480('0x14'),core['error']);ami['on'](_0xc480('0x15'),core[_0xc480('0x15')]);ami['on'](_0xc480('0x16'),core[_0xc480('0x16')]);ami['on'](_0xc480('0x17'),function(_0x2e9c28){try{utils['debug'](util['format'](_0xc480('0x18'),_0x2e9c28[_0xc480('0x19')]),_0x2e9c28);members[_0xc480('0x17')](_0x2e9c28);}catch(_0x1aa67f){utils[_0xc480('0x14')](util[_0xc480('0x1a')]('[%s][index][devicestatechange]',_0x2e9c28['device']),_0x1aa67f);}});ami['on'](_0xc480('0x1b'),function(_0x1e6e7b){try{utils[_0xc480('0x1c')](util['format'](_0xc480('0x1d'),_0x1e6e7b['uniqueid']),_0x1e6e7b);agents[_0xc480('0x1b')](_0x1e6e7b);}catch(_0x59f560){utils[_0xc480('0x14')](util[_0xc480('0x1a')](_0xc480('0x1d'),_0x1e6e7b[_0xc480('0x1e')]),_0x59f560);}});ami['on'](_0xc480('0x1f'),function(_0x19cba3){try{utils[_0xc480('0x1c')](util[_0xc480('0x1a')]('[%s][index][agentringnoanswer]',_0x19cba3[_0xc480('0x1e')]),_0x19cba3);agents[_0xc480('0x1f')](_0x19cba3);}catch(_0x3fe012){utils[_0xc480('0x14')](util[_0xc480('0x1a')](_0xc480('0x20'),_0x19cba3[_0xc480('0x1e')]),_0x3fe012);}});ami['on'](_0xc480('0x21'),function(_0x385bf2){try{utils[_0xc480('0x1c')](util[_0xc480('0x1a')]('[%s][index][agentconnect]',_0x385bf2['uniqueid']),_0x385bf2);agents[_0xc480('0x21')](_0x385bf2);queues['agentconnect'](_0x385bf2);}catch(_0xdac297){utils[_0xc480('0x14')](util['format'](_0xc480('0x22'),_0x385bf2[_0xc480('0x1e')]),_0xdac297);}});ami['on']('agentcomplete',function(_0x459caa){try{utils['debug'](util[_0xc480('0x1a')]('[%s][index][agentcomplete]',_0x459caa[_0xc480('0x1e')]),_0x459caa);agents['agentcomplete'](_0x459caa);queues[_0xc480('0x23')](_0x459caa);members[_0xc480('0x23')](_0x459caa);}catch(_0x2879f1){utils[_0xc480('0x14')](util[_0xc480('0x1a')](_0xc480('0x24'),_0x459caa[_0xc480('0x1e')]),_0x2879f1);}});ami['on'](_0xc480('0x25'),function(_0x13dfb0){try{utils[_0xc480('0x1c')](util['format']('[%s][index][queuecallerabandon]',_0x13dfb0[_0xc480('0x1e')]),_0x13dfb0);agents[_0xc480('0x25')](_0x13dfb0);queues['queuecallerabandon'](_0x13dfb0);}catch(_0x2f2911){utils[_0xc480('0x14')](util[_0xc480('0x1a')]('[%s][index][queuecallerabandon]',_0x13dfb0[_0xc480('0x1e')]),_0x2f2911);}});ami['on'](_0xc480('0x26'),function(_0xb2ba26){try{utils['debug'](util['format'](_0xc480('0x27'),_0xb2ba26['uniqueid']),_0xb2ba26);queues[_0xc480('0x26')](_0xb2ba26);recordings[_0xc480('0x26')](_0xb2ba26);}catch(_0x17b96d){utils[_0xc480('0x14')](util['format'](_0xc480('0x27'),_0xb2ba26[_0xc480('0x1e')]),_0x17b96d);}});ami['on'](_0xc480('0x28'),function(_0x2baba8){try{utils['debug'](util[_0xc480('0x1a')](_0xc480('0x29'),_0x2baba8[_0xc480('0x1e')]),_0x2baba8);queues[_0xc480('0x28')](_0x2baba8);}catch(_0x46d257){utils[_0xc480('0x14')](util[_0xc480('0x1a')](_0xc480('0x29'),_0x2baba8['uniqueid']),_0x46d257);}});ami['on']('musiconholdstart',function(_0x2f6ac1){try{utils[_0xc480('0x1c')](util['format'](_0xc480('0x2a'),_0x2f6ac1[_0xc480('0x1e')]),_0x2f6ac1);queues[_0xc480('0x2b')](_0x2f6ac1);calls[_0xc480('0x2b')](_0x2f6ac1);}catch(_0x4c76c0){utils[_0xc480('0x14')](util[_0xc480('0x1a')](_0xc480('0x2a'),_0x2f6ac1['uniqueid']),_0x4c76c0);}});ami['on'](_0xc480('0x2c'),function(_0x1e044c){try{utils[_0xc480('0x1c')](util['format']('[%s][index][musiconholdstop]',_0x1e044c[_0xc480('0x1e')]),_0x1e044c);queues['musiconholdstop'](_0x1e044c);calls[_0xc480('0x2c')](_0x1e044c);}catch(_0x4c595f){utils[_0xc480('0x14')](util[_0xc480('0x1a')](_0xc480('0x2d'),_0x1e044c['uniqueid']),_0x4c595f);}});ami['on'](_0xc480('0x2e'),function(_0x4f4019){try{utils[_0xc480('0x1c')](util[_0xc480('0x1a')](_0xc480('0x2f'),_0x4f4019[_0xc480('0x1e')]),_0x4f4019);calls[_0xc480('0x2e')](_0x4f4019);recordings['newstate'](_0x4f4019);}catch(_0x3a2746){utils['error'](util[_0xc480('0x1a')](_0xc480('0x2f'),_0x4f4019[_0xc480('0x1e')]),_0x3a2746);}});ami['on'](_0xc480('0x30'),function(_0x40d57b){try{utils[_0xc480('0x1c')](util[_0xc480('0x1a')](_0xc480('0x31'),_0x40d57b[_0xc480('0x1e')]),_0x40d57b);calls['hangup'](_0x40d57b);recordings[_0xc480('0x30')](_0x40d57b);dials[_0xc480('0x30')](_0x40d57b);agents[_0xc480('0x30')](_0x40d57b);queues[_0xc480('0x30')](_0x40d57b);}catch(_0x3ad54c){utils[_0xc480('0x14')](util[_0xc480('0x1a')](_0xc480('0x31'),_0x40d57b[_0xc480('0x1e')]),_0x3ad54c);}});ami['on'](_0xc480('0x32'),function(_0x51262e){try{utils[_0xc480('0x1c')](util['format'](_0xc480('0x33'),_0x51262e[_0xc480('0x1e')]),_0x51262e);members[_0xc480('0x32')](_0x51262e);}catch(_0x2dd11){utils[_0xc480('0x14')](util[_0xc480('0x1a')](_0xc480('0x33'),_0x51262e['uniqueid']),_0x2dd11);}});ami['on'](_0xc480('0x34'),function(_0x39b797){try{utils['debug'](util[_0xc480('0x1a')](_0xc480('0x35'),_0x39b797[_0xc480('0x1e')]),_0x39b797);queues[_0xc480('0x34')](_0x39b797);agents[_0xc480('0x34')](_0x39b797);transfers[_0xc480('0x34')](_0x39b797);}catch(_0x458095){utils['error'](util[_0xc480('0x1a')]('[%s][index][blindtransfer]',_0x39b797[_0xc480('0x1e')]),_0x458095);}});ami['on'](_0xc480('0x36'),function(_0x2001dd){try{utils[_0xc480('0x1c')](util[_0xc480('0x1a')](_0xc480('0x37'),_0x2001dd['origtransfereruniqueid']),_0x2001dd);queues[_0xc480('0x36')](_0x2001dd);transfers['attendedtransfer'](_0x2001dd);agents[_0xc480('0x36')](_0x2001dd);calls[_0xc480('0x36')](_0x2001dd);}catch(_0x26ee95){utils['error'](util[_0xc480('0x1a')](_0xc480('0x37'),_0x2001dd[_0xc480('0x38')]),_0x26ee95);}});ami['on']('varset',function(_0x43b102){try{utils[_0xc480('0x1c')](util[_0xc480('0x1a')]('[%s][index][varset]',_0x43b102['uniqueid']),_0x43b102);queues[_0xc480('0x39')](_0x43b102);recordings[_0xc480('0x39')](_0x43b102);calls[_0xc480('0x39')](_0x43b102);dials['varset'](_0x43b102);}catch(_0x5f41b8){utils[_0xc480('0x14')](util[_0xc480('0x1a')](_0xc480('0x3a'),_0x43b102['uniqueid']),_0x5f41b8);}});ami['on'](_0xc480('0x3b'),function(_0x4dbb9a){try{utils[_0xc480('0x1c')](util[_0xc480('0x1a')](_0xc480('0x3c'),_0x4dbb9a[_0xc480('0x1e')]),_0x4dbb9a);calls[_0xc480('0x3b')](_0x4dbb9a);recordings['newexten'](_0x4dbb9a);dials[_0xc480('0x3b')](_0x4dbb9a);}catch(_0x4522a9){utils[_0xc480('0x14')](util[_0xc480('0x1a')]('[%s][index][newexten]',_0x4dbb9a['uniqueid']),_0x4522a9);}});ami['on'](_0xc480('0x3d'),function(_0x3c654e){try{utils[_0xc480('0x1c')](util['format']('[%s][index][newchannel]',_0x3c654e['uniqueid']),_0x3c654e);calls[_0xc480('0x3d')](_0x3c654e);recordings[_0xc480('0x3d')](_0x3c654e);}catch(_0x20580c){utils[_0xc480('0x14')](util[_0xc480('0x1a')]('[%s][index][newchannel]',_0x3c654e[_0xc480('0x1e')]),_0x20580c);}});ami['on']('dialbegin',function(_0x1adcd8){try{utils[_0xc480('0x1c')](util['format']('[%s][index][dialbegin]',_0x1adcd8[_0xc480('0x1e')]),_0x1adcd8);dials[_0xc480('0x3e')](_0x1adcd8);}catch(_0x958e8f){utils['error'](util[_0xc480('0x1a')](_0xc480('0x3f'),_0x1adcd8['uniqueid']),_0x958e8f);}});ami['on'](_0xc480('0x40'),function(_0x1ee343){try{utils[_0xc480('0x1c')](util[_0xc480('0x1a')](_0xc480('0x41'),_0x1ee343[_0xc480('0x1e')]),_0x1ee343);dials['dialend'](_0x1ee343);}catch(_0x4e1411){utils['error'](util[_0xc480('0x1a')](_0xc480('0x41'),_0x1ee343[_0xc480('0x1e')]),_0x4e1411);}});} \ No newline at end of file +var _0xced9=['queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','port','asterisk','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','error','close','managerevent','format','[%s][index][devicestatechange]','devicestatechange','device','agentcalled','debug','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon'];(function(_0x33865f,_0x1b6b7c){var _0x352a77=function(_0x33aef5){while(--_0x33aef5){_0x33865f['push'](_0x33865f['shift']());}};_0x352a77(++_0x1b6b7c);}(_0xced9,0x162));var _0x9ced=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xced9[_0x18cd5b];return _0x5eaa52;};var AsteriskManager=require('asterisk-manager');var config=require(_0x9ced('0x0'));var utils=require(_0x9ced('0x1'));var util=require('util');var ami=new AsteriskManager(config['asterisk'][_0x9ced('0x2')],config[_0x9ced('0x3')]['ip'],config['asterisk'][_0x9ced('0x4')],config[_0x9ced('0x3')][_0x9ced('0x5')],!![]);ami[_0x9ced('0x6')]();if(config[_0x9ced('0x7')]&&config[_0x9ced('0x7')][_0x9ced('0x8')]){utils[_0x9ced('0x9')](_0x9ced('0xa'));}else{var agents=require(_0x9ced('0xb'));var calls=require('./calls.controller');var queues=require(_0x9ced('0xc'));var recordings=require('./recordings.controller');var members=require(_0x9ced('0xd'));var dials=require(_0x9ced('0xe'));var transfers=require(_0x9ced('0xf'));var core=require('./core.controller');ami['on'](_0x9ced('0x10'),core[_0x9ced('0x10')]);ami['on'](_0x9ced('0x11'),core[_0x9ced('0x11')]);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0x9ced('0x12'),core[_0x9ced('0x12')]);ami['on'](_0x9ced('0x13'),core[_0x9ced('0x13')]);ami['on'](_0x9ced('0x14'),core['managerevent']);ami['on']('devicestatechange',function(_0x4f521e){try{utils['debug'](util[_0x9ced('0x15')](_0x9ced('0x16'),_0x4f521e['device']),_0x4f521e);members[_0x9ced('0x17')](_0x4f521e);}catch(_0x2747ab){utils[_0x9ced('0x12')](util[_0x9ced('0x15')](_0x9ced('0x16'),_0x4f521e[_0x9ced('0x18')]),_0x2747ab);}});ami['on'](_0x9ced('0x19'),function(_0x3c5fd0){try{utils[_0x9ced('0x1a')](util[_0x9ced('0x15')]('[%s][index][agentcalled]',_0x3c5fd0[_0x9ced('0x1b')]),_0x3c5fd0);agents['agentcalled'](_0x3c5fd0);}catch(_0x599662){utils[_0x9ced('0x12')](util[_0x9ced('0x15')]('[%s][index][agentcalled]',_0x3c5fd0['uniqueid']),_0x599662);}});ami['on'](_0x9ced('0x1c'),function(_0x403207){try{utils[_0x9ced('0x1a')](util[_0x9ced('0x15')](_0x9ced('0x1d'),_0x403207['uniqueid']),_0x403207);agents[_0x9ced('0x1c')](_0x403207);}catch(_0x449f14){utils['error'](util[_0x9ced('0x15')](_0x9ced('0x1d'),_0x403207[_0x9ced('0x1b')]),_0x449f14);}});ami['on'](_0x9ced('0x1e'),function(_0x320dd1){try{utils[_0x9ced('0x1a')](util[_0x9ced('0x15')](_0x9ced('0x1f'),_0x320dd1['uniqueid']),_0x320dd1);agents[_0x9ced('0x1e')](_0x320dd1);queues[_0x9ced('0x1e')](_0x320dd1);}catch(_0x5d7765){utils[_0x9ced('0x12')](util['format'](_0x9ced('0x1f'),_0x320dd1['uniqueid']),_0x5d7765);}});ami['on'](_0x9ced('0x20'),function(_0x5b6e2b){try{utils[_0x9ced('0x1a')](util[_0x9ced('0x15')](_0x9ced('0x21'),_0x5b6e2b[_0x9ced('0x1b')]),_0x5b6e2b);agents[_0x9ced('0x20')](_0x5b6e2b);queues[_0x9ced('0x20')](_0x5b6e2b);members['agentcomplete'](_0x5b6e2b);}catch(_0x2c760a){utils[_0x9ced('0x12')](util[_0x9ced('0x15')](_0x9ced('0x21'),_0x5b6e2b[_0x9ced('0x1b')]),_0x2c760a);}});ami['on']('queuecallerabandon',function(_0x555393){try{utils['debug'](util[_0x9ced('0x15')](_0x9ced('0x22'),_0x555393[_0x9ced('0x1b')]),_0x555393);agents[_0x9ced('0x23')](_0x555393);queues[_0x9ced('0x23')](_0x555393);}catch(_0x398982){utils[_0x9ced('0x12')](util['format'](_0x9ced('0x22'),_0x555393[_0x9ced('0x1b')]),_0x398982);}});ami['on'](_0x9ced('0x24'),function(_0x13f5a4){try{utils[_0x9ced('0x1a')](util[_0x9ced('0x15')](_0x9ced('0x25'),_0x13f5a4[_0x9ced('0x1b')]),_0x13f5a4);queues['queuecallerjoin'](_0x13f5a4);recordings['queuecallerjoin'](_0x13f5a4);}catch(_0x3f454b){utils[_0x9ced('0x12')](util['format'](_0x9ced('0x25'),_0x13f5a4[_0x9ced('0x1b')]),_0x3f454b);}});ami['on']('queuecallerleave',function(_0x4fda8){try{utils[_0x9ced('0x1a')](util[_0x9ced('0x15')](_0x9ced('0x26'),_0x4fda8[_0x9ced('0x1b')]),_0x4fda8);queues[_0x9ced('0x27')](_0x4fda8);}catch(_0x1e466e){utils[_0x9ced('0x12')](util[_0x9ced('0x15')](_0x9ced('0x26'),_0x4fda8[_0x9ced('0x1b')]),_0x1e466e);}});ami['on'](_0x9ced('0x28'),function(_0xede981){try{utils[_0x9ced('0x1a')](util[_0x9ced('0x15')](_0x9ced('0x29'),_0xede981[_0x9ced('0x1b')]),_0xede981);queues[_0x9ced('0x28')](_0xede981);calls[_0x9ced('0x28')](_0xede981);}catch(_0x3e293e){utils[_0x9ced('0x12')](util['format'](_0x9ced('0x29'),_0xede981[_0x9ced('0x1b')]),_0x3e293e);}});ami['on'](_0x9ced('0x2a'),function(_0x43276f){try{utils[_0x9ced('0x1a')](util[_0x9ced('0x15')](_0x9ced('0x2b'),_0x43276f[_0x9ced('0x1b')]),_0x43276f);queues[_0x9ced('0x2a')](_0x43276f);calls['musiconholdstop'](_0x43276f);}catch(_0x12a752){utils[_0x9ced('0x12')](util['format'](_0x9ced('0x2b'),_0x43276f[_0x9ced('0x1b')]),_0x12a752);}});ami['on'](_0x9ced('0x2c'),function(_0x515497){try{utils['debug'](util[_0x9ced('0x15')](_0x9ced('0x2d'),_0x515497[_0x9ced('0x1b')]),_0x515497);calls['newstate'](_0x515497);recordings[_0x9ced('0x2c')](_0x515497);}catch(_0x2adde0){utils[_0x9ced('0x12')](util[_0x9ced('0x15')](_0x9ced('0x2d'),_0x515497['uniqueid']),_0x2adde0);}});ami['on'](_0x9ced('0x2e'),function(_0x4f9e66){try{utils[_0x9ced('0x1a')](util[_0x9ced('0x15')](_0x9ced('0x2f'),_0x4f9e66[_0x9ced('0x1b')]),_0x4f9e66);calls[_0x9ced('0x2e')](_0x4f9e66);recordings[_0x9ced('0x2e')](_0x4f9e66);dials[_0x9ced('0x2e')](_0x4f9e66);agents[_0x9ced('0x2e')](_0x4f9e66);queues[_0x9ced('0x2e')](_0x4f9e66);}catch(_0x392fc9){utils[_0x9ced('0x12')](util[_0x9ced('0x15')](_0x9ced('0x2f'),_0x4f9e66['uniqueid']),_0x392fc9);}});ami['on']('cdr',function(_0x3ee5ac){try{utils[_0x9ced('0x1a')](util[_0x9ced('0x15')]('[%s][index][cdr]',_0x3ee5ac[_0x9ced('0x1b')]),_0x3ee5ac);members['cdr'](_0x3ee5ac);}catch(_0x5708e6){utils[_0x9ced('0x12')](util[_0x9ced('0x15')](_0x9ced('0x30'),_0x3ee5ac[_0x9ced('0x1b')]),_0x5708e6);}});ami['on'](_0x9ced('0x31'),function(_0x3c2977){try{utils[_0x9ced('0x1a')](util[_0x9ced('0x15')](_0x9ced('0x32'),_0x3c2977[_0x9ced('0x1b')]),_0x3c2977);queues[_0x9ced('0x31')](_0x3c2977);agents[_0x9ced('0x31')](_0x3c2977);transfers[_0x9ced('0x31')](_0x3c2977);}catch(_0x3c6d2b){utils[_0x9ced('0x12')](util[_0x9ced('0x15')](_0x9ced('0x32'),_0x3c2977[_0x9ced('0x1b')]),_0x3c6d2b);}});ami['on'](_0x9ced('0x33'),function(_0x2e8323){try{utils[_0x9ced('0x1a')](util['format'](_0x9ced('0x34'),_0x2e8323[_0x9ced('0x35')]),_0x2e8323);queues[_0x9ced('0x33')](_0x2e8323);transfers['attendedtransfer'](_0x2e8323);agents['attendedtransfer'](_0x2e8323);calls[_0x9ced('0x33')](_0x2e8323);}catch(_0x59a554){utils['error'](util['format'](_0x9ced('0x34'),_0x2e8323[_0x9ced('0x35')]),_0x59a554);}});ami['on'](_0x9ced('0x36'),function(_0x4ad424){try{utils[_0x9ced('0x1a')](util[_0x9ced('0x15')](_0x9ced('0x37'),_0x4ad424[_0x9ced('0x1b')]),_0x4ad424);queues[_0x9ced('0x36')](_0x4ad424);recordings['varset'](_0x4ad424);calls[_0x9ced('0x36')](_0x4ad424);dials[_0x9ced('0x36')](_0x4ad424);}catch(_0xd4c999){utils[_0x9ced('0x12')](util[_0x9ced('0x15')](_0x9ced('0x37'),_0x4ad424[_0x9ced('0x1b')]),_0xd4c999);}});ami['on'](_0x9ced('0x38'),function(_0xa40dd2){try{utils[_0x9ced('0x1a')](util['format']('[%s][index][newexten]',_0xa40dd2['uniqueid']),_0xa40dd2);calls[_0x9ced('0x38')](_0xa40dd2);recordings[_0x9ced('0x38')](_0xa40dd2);dials[_0x9ced('0x38')](_0xa40dd2);}catch(_0x2fc792){utils[_0x9ced('0x12')](util[_0x9ced('0x15')](_0x9ced('0x39'),_0xa40dd2[_0x9ced('0x1b')]),_0x2fc792);}});ami['on'](_0x9ced('0x3a'),function(_0x1ad1c1){try{utils[_0x9ced('0x1a')](util[_0x9ced('0x15')](_0x9ced('0x3b'),_0x1ad1c1[_0x9ced('0x1b')]),_0x1ad1c1);calls[_0x9ced('0x3a')](_0x1ad1c1);recordings[_0x9ced('0x3a')](_0x1ad1c1);}catch(_0x333390){utils[_0x9ced('0x12')](util[_0x9ced('0x15')](_0x9ced('0x3b'),_0x1ad1c1[_0x9ced('0x1b')]),_0x333390);}});ami['on'](_0x9ced('0x3c'),function(_0x560bb9){try{utils[_0x9ced('0x1a')](util[_0x9ced('0x15')](_0x9ced('0x3d'),_0x560bb9[_0x9ced('0x1b')]),_0x560bb9);dials[_0x9ced('0x3c')](_0x560bb9);}catch(_0x3725e7){utils['error'](util[_0x9ced('0x15')](_0x9ced('0x3e'),_0x560bb9[_0x9ced('0x1b')]),_0x3725e7);}});ami['on'](_0x9ced('0x3f'),function(_0x238603){try{utils[_0x9ced('0x1a')](util['format'](_0x9ced('0x40'),_0x238603['uniqueid']),_0x238603);dials[_0x9ced('0x3f')](_0x238603);}catch(_0x3a17d2){utils[_0x9ced('0x12')](util[_0x9ced('0x15')](_0x9ced('0x40'),_0x238603[_0x9ced('0x1b')]),_0x3a17d2);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 427a867..311c1ab 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 _0x88ae=['BUSY','voice','TALKING','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','error','cdr','data1','type','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data2','destinationchannel','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','split','catch','uniqueid','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE'];(function(_0x440030,_0xaeec43){var _0x40d6b4=function(_0x5eb186){while(--_0x5eb186){_0x440030['push'](_0x440030['shift']());}};_0x40d6b4(++_0xaeec43);}(_0x88ae,0xf6));var _0xe88a=function(_0x3b00a8,_0x2e6beb){_0x3b00a8=_0x3b00a8-0x0;var _0x1cdb63=_0x88ae[_0x3b00a8];return _0x1cdb63;};'use strict';var _=require(_0xe88a('0x0'));var util=require(_0xe88a('0x1'));var utils=require(_0xe88a('0x2'));var members={};var exclude=[_0xe88a('0x3'),_0xe88a('0x4')];function writeDB(_0x30f6b2){utils['info'](util[_0xe88a('0x5')](_0xe88a('0x6'),_0x30f6b2['uniqueid'],_0x30f6b2[_0xe88a('0x7')],_0x30f6b2[_0xe88a('0x8')],_0x30f6b2['data2'],_0x30f6b2['membername'],_0x30f6b2['type']));if(_0x30f6b2[_0xe88a('0x7')]){utils[_0xe88a('0x9')](_0x30f6b2[_0xe88a('0x7')])[_0xe88a('0xa')](function(_0x25388d){if(_0x25388d){_0x30f6b2[_0xe88a('0xb')]=_0x25388d[_0xe88a('0xc')];_0x30f6b2[_0xe88a('0xd')]=_0x25388d[_0xe88a('0xd')];utils[_0xe88a('0xe')](_0xe88a('0xf'),_0x30f6b2);}else{utils['getUserByName'](_0x30f6b2['interface'][_0xe88a('0x10')]('/')[0x1])[_0xe88a('0xa')](function(_0x58230b){if(_0x58230b){_0x30f6b2['membername']=_0x58230b[_0xe88a('0xc')];_0x30f6b2['internal']=_0x58230b['internal'];utils[_0xe88a('0xe')](_0xe88a('0xf'),_0x30f6b2);}});}})[_0xe88a('0x11')](function(_0x10cb8b){utils['error'](util['format']('[%s][members][writeDB]',_0x30f6b2[_0xe88a('0x12')]),_0x10cb8b);});}delete members[_0x30f6b2[_0xe88a('0x7')]];}function startsWith(_0x355ac7,_0x55834d){return _[_0xe88a('0x13')](_0x355ac7,function(_0x32ffe8){return _[_0xe88a('0x14')](_0x55834d,_0x32ffe8);});}exports[_0xe88a('0x15')]=function(_0x2f50ac){try{utils[_0xe88a('0x16')](util[_0xe88a('0x5')](_0xe88a('0x17'),members[_0x2f50ac[_0xe88a('0x18')]]?members[_0x2f50ac[_0xe88a('0x18')]][_0xe88a('0x12')]:_0x2f50ac[_0xe88a('0x18')]),_0x2f50ac);utils[_0xe88a('0x19')](util[_0xe88a('0x5')](_0xe88a('0x1a'),members[_0x2f50ac[_0xe88a('0x18')]]?members[_0x2f50ac['device']][_0xe88a('0x12')]:_0x2f50ac[_0xe88a('0x18')],_0x2f50ac[_0xe88a('0x1b')],_0x2f50ac[_0xe88a('0x18')]));switch(_0x2f50ac[_0xe88a('0x1b')]){case _0xe88a('0x1c'):case _0xe88a('0x1d'):if(!startsWith(exclude,_0x2f50ac[_0xe88a('0x18')])){members[_0x2f50ac[_0xe88a('0x18')]]={'channel':_0xe88a('0x1e'),'interface':_0x2f50ac['device'],'type':_0xe88a('0x1f'),'enterAt':utils['now'](),'role':_0xe88a('0x20')};}break;case _0xe88a('0x21'):if(!_[_0xe88a('0x22')](members[_0x2f50ac[_0xe88a('0x18')]])){members[_0x2f50ac[_0xe88a('0x18')]][_0xe88a('0x23')]=utils['now']();members[_0x2f50ac[_0xe88a('0x18')]][_0xe88a('0x24')]=utils[_0xe88a('0x25')](members[_0x2f50ac['device']]['exitAt'],members[_0x2f50ac[_0xe88a('0x18')]][_0xe88a('0x26')]);if(members[_0x2f50ac[_0xe88a('0x18')]][_0xe88a('0x12')]){writeDB(members[_0x2f50ac['device']]);}}break;default:break;}}catch(_0x5c2c51){utils['error'](util['format'](_0xe88a('0x17'),members[_0x2f50ac['device']]?members[_0x2f50ac['device']][_0xe88a('0x12')]:_0x2f50ac['device']),_0x5c2c51);}};exports[_0xe88a('0x27')]=function(_0x426ae4){try{if(!_[_0xe88a('0x22')](members[_0x426ae4['interface']])){utils['debug'](util[_0xe88a('0x5')](_0xe88a('0x28'),_0x426ae4['uniqueid']),_0x426ae4);utils[_0xe88a('0x19')](util[_0xe88a('0x5')](_0xe88a('0x29'),_0x426ae4[_0xe88a('0x12')],_0x426ae4[_0xe88a('0x7')],_0x426ae4[_0xe88a('0x2a')]));members[_0x426ae4['interface']]=_[_0xe88a('0x2b')](members[_0x426ae4[_0xe88a('0x7')]],{'data4':_0x426ae4['queue'],'uniqueid':_0x426ae4[_0xe88a('0x12')]});}}catch(_0x4c12ec){utils[_0xe88a('0x2c')](util[_0xe88a('0x5')]('[%s][members][agentcomplete]',_0x426ae4[_0xe88a('0x12')]),_0x4c12ec);}};exports[_0xe88a('0x2d')]=function(_0x2dc2e7){try{utils[_0xe88a('0x16')](util[_0xe88a('0x5')]('[%s][members][cdr]',_0x2dc2e7[_0xe88a('0x12')]),_0x2dc2e7);if(_0x2dc2e7[_0xe88a('0x8')]){var _0x1bd78d=_0x2dc2e7[_0xe88a('0x8')][_0xe88a('0x10')]('-')[0x0];if(!_[_0xe88a('0x22')](members[_0x1bd78d])){members[_0x1bd78d]=_[_0xe88a('0x2b')](members[_0x1bd78d],{'data1':members[_0x1bd78d][_0xe88a('0x2e')]||_0x2dc2e7[_0xe88a('0x2f')],'data2':members[_0x1bd78d]['data2']||_0x2dc2e7[_0xe88a('0x30')],'data3':members[_0x1bd78d][_0xe88a('0x31')]||_0x2dc2e7[_0xe88a('0x32')],'uniqueid':members[_0x1bd78d][_0xe88a('0x12')]||_0x2dc2e7[_0xe88a('0x12')]});utils[_0xe88a('0x19')](util[_0xe88a('0x5')](_0xe88a('0x33'),_0x2dc2e7['uniqueid'],members[_0x1bd78d][_0xe88a('0x2e')],members[_0x1bd78d][_0xe88a('0x34')],members[_0x1bd78d]['data3']));if(members[_0x1bd78d][_0xe88a('0x23')]){writeDB(members[_0x1bd78d]);}}}if(_0x2dc2e7[_0xe88a('0x35')]){var _0x2ac6d4=_0x2dc2e7[_0xe88a('0x35')]['split']('-')[0x0];if(!_[_0xe88a('0x22')](members[_0x2ac6d4])){members[_0x2ac6d4]=_[_0xe88a('0x2b')](members[_0x2ac6d4],{'data1':members[_0x2ac6d4][_0xe88a('0x2e')]||_0x2dc2e7[_0xe88a('0x2f')],'data2':members[_0x2ac6d4]['data2']||_0x2dc2e7[_0xe88a('0x30')],'data3':members[_0x2ac6d4][_0xe88a('0x31')]||_0x2dc2e7[_0xe88a('0x32')],'uniqueid':members[_0x2ac6d4][_0xe88a('0x12')]||_0x2dc2e7[_0xe88a('0x12')]});utils[_0xe88a('0x19')](util[_0xe88a('0x5')](_0xe88a('0x33'),_0x2dc2e7[_0xe88a('0x12')],members[_0x2ac6d4][_0xe88a('0x2e')],members[_0x2ac6d4][_0xe88a('0x34')],members[_0x2ac6d4][_0xe88a('0x31')]));if(members[_0x2ac6d4]['exitAt']){writeDB(members[_0x2ac6d4]);}}}}catch(_0x1a7127){utils['error'](util[_0xe88a('0x5')](_0xe88a('0x36'),_0x2dc2e7[_0xe88a('0x12')]),_0x1a7127);}}; \ No newline at end of file +var _0xa8db=['type','getUserByInterface','then','name','internal','CreateMemberReport','split','request','catch','error','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','channel','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','data3','./utils','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername'];(function(_0x2b30b2,_0x598261){var _0x1be3cd=function(_0x3019db){while(--_0x3019db){_0x2b30b2['push'](_0x2b30b2['shift']());}};_0x1be3cd(++_0x598261);}(_0xa8db,0x15d));var _0xba8d=function(_0x33bcdb,_0x11846b){_0x33bcdb=_0x33bcdb-0x0;var _0x18a9bf=_0xa8db[_0x33bcdb];return _0x18a9bf;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xba8d('0x0'));var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x3f70e4){utils[_0xba8d('0x1')](util[_0xba8d('0x2')](_0xba8d('0x3'),_0x3f70e4[_0xba8d('0x4')],_0x3f70e4[_0xba8d('0x5')],_0x3f70e4['channel'],_0x3f70e4[_0xba8d('0x6')],_0x3f70e4[_0xba8d('0x7')],_0x3f70e4[_0xba8d('0x8')]));if(_0x3f70e4['interface']){utils[_0xba8d('0x9')](_0x3f70e4[_0xba8d('0x5')])[_0xba8d('0xa')](function(_0x354ca0){if(_0x354ca0){_0x3f70e4[_0xba8d('0x7')]=_0x354ca0[_0xba8d('0xb')];_0x3f70e4[_0xba8d('0xc')]=_0x354ca0['internal'];utils['request'](_0xba8d('0xd'),_0x3f70e4);}else{utils['getUserByName'](_0x3f70e4[_0xba8d('0x5')][_0xba8d('0xe')]('/')[0x1])[_0xba8d('0xa')](function(_0x19dc1e){if(_0x19dc1e){_0x3f70e4[_0xba8d('0x7')]=_0x19dc1e['name'];_0x3f70e4['internal']=_0x19dc1e['internal'];utils[_0xba8d('0xf')](_0xba8d('0xd'),_0x3f70e4);}});}})[_0xba8d('0x10')](function(_0x2ea85b){utils[_0xba8d('0x11')](util['format']('[%s][members][writeDB]',_0x3f70e4['uniqueid']),_0x2ea85b);});}delete members[_0x3f70e4[_0xba8d('0x5')]];}function startsWith(_0x3c45f2,_0x13d7dd){return _[_0xba8d('0x12')](_0x3c45f2,function(_0x20306f){return _[_0xba8d('0x13')](_0x13d7dd,_0x20306f);});}exports[_0xba8d('0x14')]=function(_0x519ed0){try{utils[_0xba8d('0x15')](util['format'](_0xba8d('0x16'),members[_0x519ed0[_0xba8d('0x17')]]?members[_0x519ed0[_0xba8d('0x17')]][_0xba8d('0x4')]:_0x519ed0[_0xba8d('0x17')]),_0x519ed0);utils[_0xba8d('0x1')](util[_0xba8d('0x2')](_0xba8d('0x18'),members[_0x519ed0[_0xba8d('0x17')]]?members[_0x519ed0[_0xba8d('0x17')]]['uniqueid']:_0x519ed0['device'],_0x519ed0['state'],_0x519ed0[_0xba8d('0x17')]));switch(_0x519ed0[_0xba8d('0x19')]){case'INUSE':case _0xba8d('0x1a'):if(!startsWith(exclude,_0x519ed0[_0xba8d('0x17')])){members[_0x519ed0[_0xba8d('0x17')]]={'channel':_0xba8d('0x1b'),'interface':_0x519ed0['device'],'type':_0xba8d('0x1c'),'enterAt':utils[_0xba8d('0x1d')](),'role':_0xba8d('0x1e')};}break;case _0xba8d('0x1f'):if(!_[_0xba8d('0x20')](members[_0x519ed0[_0xba8d('0x17')]])){members[_0x519ed0['device']][_0xba8d('0x21')]=utils['now']();members[_0x519ed0['device']][_0xba8d('0x22')]=utils[_0xba8d('0x23')](members[_0x519ed0['device']][_0xba8d('0x21')],members[_0x519ed0['device']][_0xba8d('0x24')]);if(members[_0x519ed0[_0xba8d('0x17')]][_0xba8d('0x4')]){writeDB(members[_0x519ed0[_0xba8d('0x17')]]);}}break;default:break;}}catch(_0x5e2ab2){utils[_0xba8d('0x11')](util[_0xba8d('0x2')](_0xba8d('0x16'),members[_0x519ed0[_0xba8d('0x17')]]?members[_0x519ed0['device']][_0xba8d('0x4')]:_0x519ed0['device']),_0x5e2ab2);}};exports[_0xba8d('0x25')]=function(_0x5887d7){try{if(!_[_0xba8d('0x20')](members[_0x5887d7['interface']])){utils[_0xba8d('0x15')](util[_0xba8d('0x2')](_0xba8d('0x26'),_0x5887d7[_0xba8d('0x4')]),_0x5887d7);utils[_0xba8d('0x1')](util[_0xba8d('0x2')](_0xba8d('0x27'),_0x5887d7[_0xba8d('0x4')],_0x5887d7[_0xba8d('0x5')],_0x5887d7[_0xba8d('0x28')]));members[_0x5887d7[_0xba8d('0x5')]]=_[_0xba8d('0x29')](members[_0x5887d7[_0xba8d('0x5')]],{'data4':_0x5887d7[_0xba8d('0x28')],'uniqueid':_0x5887d7[_0xba8d('0x4')]});}}catch(_0xe189cc){utils[_0xba8d('0x11')](util['format'](_0xba8d('0x26'),_0x5887d7[_0xba8d('0x4')]),_0xe189cc);}};exports[_0xba8d('0x2a')]=function(_0x1d6def){try{utils[_0xba8d('0x15')](util[_0xba8d('0x2')](_0xba8d('0x2b'),_0x1d6def[_0xba8d('0x4')]),_0x1d6def);if(_0x1d6def[_0xba8d('0x2c')]){var _0x2ef99e=_0x1d6def[_0xba8d('0x2c')]['split']('-')[0x0];if(!_['isNil'](members[_0x2ef99e])){members[_0x2ef99e]=_[_0xba8d('0x29')](members[_0x2ef99e],{'data1':members[_0x2ef99e]['data1']||_0x1d6def[_0xba8d('0x8')],'data2':members[_0x2ef99e][_0xba8d('0x6')]||_0x1d6def[_0xba8d('0x2d')],'data3':members[_0x2ef99e]['data3']||_0x1d6def[_0xba8d('0x2e')],'uniqueid':members[_0x2ef99e][_0xba8d('0x4')]||_0x1d6def[_0xba8d('0x4')]});utils[_0xba8d('0x1')](util['format'](_0xba8d('0x2f'),_0x1d6def['uniqueid'],members[_0x2ef99e][_0xba8d('0x30')],members[_0x2ef99e]['data2'],members[_0x2ef99e]['data3']));if(members[_0x2ef99e][_0xba8d('0x21')]){writeDB(members[_0x2ef99e]);}}}if(_0x1d6def[_0xba8d('0x31')]){var _0x5a491a=_0x1d6def['destinationchannel'][_0xba8d('0xe')]('-')[0x0];if(!_[_0xba8d('0x20')](members[_0x5a491a])){members[_0x5a491a]=_[_0xba8d('0x29')](members[_0x5a491a],{'data1':members[_0x5a491a][_0xba8d('0x30')]||_0x1d6def[_0xba8d('0x8')],'data2':members[_0x5a491a][_0xba8d('0x6')]||_0x1d6def[_0xba8d('0x2d')],'data3':members[_0x5a491a][_0xba8d('0x32')]||_0x1d6def['destination'],'uniqueid':members[_0x5a491a][_0xba8d('0x4')]||_0x1d6def[_0xba8d('0x4')]});utils[_0xba8d('0x1')](util[_0xba8d('0x2')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1d6def[_0xba8d('0x4')],members[_0x5a491a][_0xba8d('0x30')],members[_0x5a491a][_0xba8d('0x6')],members[_0x5a491a]['data3']));if(members[_0x5a491a][_0xba8d('0x21')]){writeDB(members[_0x5a491a]);}}}}catch(_0x3fa1a8){utils[_0xba8d('0x11')](util[_0xba8d('0x2')](_0xba8d('0x2b'),_0x1d6def['uniqueid']),_0x3fa1a8);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 5169d38..f266bd2 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 _0x676c=['[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','diffTime','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','name','queuecallerenterreason','varset','variable','queuestatus','value','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queuecallerabandon','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinename','holdtime','queuecallerjoinAt','count','connectedlinenum','membername','assigned','lastAssignedTo','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','transfer','COMPLETEDBY','reason','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','origtransfererlinkedid','secondtransfererlinkedid','origtransfereruniqueid','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt'];(function(_0x456604,_0x49e7b9){var _0x2e19d9=function(_0x1906c3){while(--_0x1906c3){_0x456604['push'](_0x456604['shift']());}};_0x2e19d9(++_0x49e7b9);}(_0x676c,0x198));var _0xc676=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x676c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc676('0x0'));var util=require(_0xc676('0x1'));var utils=require(_0xc676('0x2'));var queues={};function writeDB(_0x55ab03){utils[_0xc676('0x3')](util[_0xc676('0x4')](_0xc676('0x5'),_0x55ab03[_0xc676('0x6')],_0x55ab03[_0xc676('0x7')],_0x55ab03[_0xc676('0x8')],_0x55ab03['lastAssignedTo'],_0x55ab03[_0xc676('0x9')],_0x55ab03[_0xc676('0xa')],_0x55ab03[_0xc676('0xb')]));if(_0x55ab03[_0xc676('0x8')]){utils[_0xc676('0xc')](_0x55ab03['queue'])[_0xc676('0xd')](function(_0x5e8ad4){if(_0x5e8ad4){_0x55ab03['type']=_0x5e8ad4[_0xc676('0xe')];}utils[_0xc676('0xf')]('CreateVoiceQueueReport',_0x55ab03);});}else{utils['request'](_0xc676('0x10'),_0x55ab03);}if(_0x55ab03[_0xc676('0x11')]){delete queues[_0x55ab03[_0xc676('0x11')]];}else{delete queues[_0x55ab03['uniqueid']];}}exports['queuecallerjoin']=function(_0xee69aa){try{utils[_0xc676('0x12')](util[_0xc676('0x4')](_0xc676('0x13'),_0xee69aa['uniqueid']),_0xee69aa);utils[_0xc676('0x3')](util[_0xc676('0x4')](_0xc676('0x14'),_0xee69aa[_0xc676('0x6')],_0xee69aa[_0xc676('0x8')],_0xee69aa[_0xc676('0x15')]));queues[_0xee69aa[_0xc676('0x6')]]=_['assign'](_0xee69aa,{'originalposition':_0xee69aa[_0xc676('0x15')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x59deda){utils[_0xc676('0x16')](util['format']('[%s][queues][queuecallerjoin]',_0xee69aa['uniqueid']),_0x59deda);}};exports[_0xc676('0x17')]=function(_0x4ee99d){try{if(!_[_0xc676('0x18')](queues[_0x4ee99d[_0xc676('0x6')]])){utils[_0xc676('0x12')](util[_0xc676('0x4')](_0xc676('0x19'),_0x4ee99d[_0xc676('0x6')]),_0x4ee99d);if(queues[_0x4ee99d['uniqueid']][_0xc676('0x1a')]){if(!queues[_0x4ee99d[_0xc676('0x6')]]['queuecallerabandon']&&!queues[_0x4ee99d[_0xc676('0x6')]][_0xc676('0x1b')]){queues[_0x4ee99d[_0xc676('0x6')]][_0xc676('0x1c')]=!![];queues[_0x4ee99d[_0xc676('0x6')]][_0xc676('0x1d')]=utils[_0xc676('0x1e')]();queues[_0x4ee99d[_0xc676('0x6')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils['info'](util[_0xc676('0x4')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x4ee99d[_0xc676('0x6')],queues[_0x4ee99d['uniqueid']]['name'],queues[_0x4ee99d[_0xc676('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x4ee99d[_0xc676('0x6')]]);}else if(queues[_0x4ee99d[_0xc676('0x6')]][_0xc676('0x11')]){utils[_0xc676('0x3')](util[_0xc676('0x4')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x4ee99d[_0xc676('0x6')],queues[_0x4ee99d[_0xc676('0x6')]][_0xc676('0x1f')],queues[_0x4ee99d['uniqueid']][_0xc676('0x11')]));queues[queues[_0x4ee99d['uniqueid']][_0xc676('0x11')]]=queues[_0x4ee99d[_0xc676('0x6')]];queues[queues[_0x4ee99d['uniqueid']][_0xc676('0x11')]][_0xc676('0x20')]=0x2;delete queues[_0x4ee99d['uniqueid']];}}}catch(_0x39ecac){utils[_0xc676('0x16')](util[_0xc676('0x4')]('[%s][queues][hangup]',_0x4ee99d[_0xc676('0x6')]),_0x39ecac);}};exports[_0xc676('0x21')]=function(_0x181e3d){try{utils[_0xc676('0x12')](util[_0xc676('0x4')]('[%s][queues][varset]',_0x181e3d[_0xc676('0x6')]),_0x181e3d);if(!_[_0xc676('0x18')](_0x181e3d[_0xc676('0x22')][_0xc676('0x23')])&&_0x181e3d[_0xc676('0x24')]['toUpperCase']()!==_0xc676('0x25')){if(!_[_0xc676('0x18')](queues[_0x181e3d[_0xc676('0x6')]])){queues[_0x181e3d[_0xc676('0x6')]]['queuecallerabandon']=![];queues[_0x181e3d[_0xc676('0x6')]][_0xc676('0x26')]=null;queues[_0x181e3d[_0xc676('0x6')]][_0xc676('0x1b')]=!![];queues[_0x181e3d[_0xc676('0x6')]][_0xc676('0x27')]=utils[_0xc676('0x1e')]();queues[_0x181e3d[_0xc676('0x6')]][_0xc676('0xb')]=_0x181e3d['value']['toUpperCase']();utils['info'](util[_0xc676('0x4')](_0xc676('0x28'),_0x181e3d[_0xc676('0x6')],queues[_0x181e3d[_0xc676('0x6')]]['name'],_0x181e3d[_0xc676('0x24')],queues[_0x181e3d[_0xc676('0x6')]][_0xc676('0xb')]));writeDB(queues[_0x181e3d[_0xc676('0x6')]]);}}else if(!_[_0xc676('0x18')](_0x181e3d[_0xc676('0x22')]['queueposition'])){if(!_['isNil'](queues[_0x181e3d[_0xc676('0x6')]])&&!queues[_0x181e3d['uniqueid']][_0xc676('0x29')]){queues[_0x181e3d[_0xc676('0x6')]][_0xc676('0x29')]=![];queues[_0x181e3d[_0xc676('0x6')]]['queuecallerabandonAt']=null;queues[_0x181e3d['uniqueid']]['queuecallerexit']=!![];queues[_0x181e3d[_0xc676('0x6')]][_0xc676('0x27')]=utils[_0xc676('0x1e')]();queues[_0x181e3d[_0xc676('0x6')]][_0xc676('0xb')]=_0xc676('0x2a');utils[_0xc676('0x3')](util[_0xc676('0x4')](_0xc676('0x2b'),_0x181e3d[_0xc676('0x6')],queues[_0x181e3d[_0xc676('0x6')]][_0xc676('0x1f')],_0x181e3d[_0xc676('0x24')],queues[_0x181e3d[_0xc676('0x6')]][_0xc676('0xb')]));}}}catch(_0x2cba1a){utils[_0xc676('0x16')](util['format'](_0xc676('0x2c'),_0x181e3d[_0xc676('0x6')]),_0x2cba1a);}};exports[_0xc676('0x29')]=function(_0x584058){try{if(!_[_0xc676('0x18')](queues[_0x584058[_0xc676('0x6')]])){utils[_0xc676('0x12')](util[_0xc676('0x4')](_0xc676('0x2d'),_0x584058[_0xc676('0x6')]),_0x584058);queues[_0x584058[_0xc676('0x6')]]['queuecallerexit']=![];queues[_0x584058[_0xc676('0x6')]]['queuecallerexitAt']=null;queues[_0x584058[_0xc676('0x6')]][_0xc676('0x29')]=!![];queues[_0x584058['uniqueid']][_0xc676('0x26')]=utils[_0xc676('0x1e')]();queues[_0x584058[_0xc676('0x6')]][_0xc676('0xb')]=_0xc676('0x2e');utils['info'](util[_0xc676('0x4')](_0xc676('0x2f'),_0x584058[_0xc676('0x6')],queues[_0x584058['uniqueid']][_0xc676('0x1f')],queues[_0x584058[_0xc676('0x6')]][_0xc676('0xb')]));}}catch(_0x40cbeb){utils['error'](util[_0xc676('0x4')]('[%s][queues][queuecallerabandon]',_0x584058[_0xc676('0x6')]),_0x40cbeb);}};exports[_0xc676('0x30')]=function(_0x3b15f9){try{if(!_['isNil'](queues[_0x3b15f9[_0xc676('0x6')]])){utils['debug'](util['format'](_0xc676('0x31'),_0x3b15f9['uniqueid']),_0x3b15f9);utils[_0xc676('0x3')](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x3b15f9[_0xc676('0x6')],queues[_0x3b15f9['uniqueid']][_0xc676('0x1f')],_0x3b15f9['connectedlinenum'],_0x3b15f9[_0xc676('0x32')]));queues[_0x3b15f9[_0xc676('0x6')]][_0xc676('0x30')]=!![];queues[_0x3b15f9[_0xc676('0x6')]]['queuecallerleaveAt']=utils['now']();queues[_0x3b15f9[_0xc676('0x6')]][_0xc676('0x33')]=utils['diffTime'](queues[_0x3b15f9[_0xc676('0x6')]][_0xc676('0x1a')],queues[_0x3b15f9['uniqueid']][_0xc676('0x34')]);queues[_0x3b15f9[_0xc676('0x6')]][_0xc676('0x15')]=_0x3b15f9[_0xc676('0x15')];queues[_0x3b15f9[_0xc676('0x6')]]['count']=_0x3b15f9[_0xc676('0x35')];queues[_0x3b15f9[_0xc676('0x6')]]['connectedlinenum']=_0x3b15f9[_0xc676('0x36')];queues[_0x3b15f9[_0xc676('0x6')]][_0xc676('0x32')]=_0x3b15f9[_0xc676('0x32')];}}catch(_0x5c643e){utils[_0xc676('0x16')](util[_0xc676('0x4')](_0xc676('0x31'),_0x3b15f9[_0xc676('0x6')]),_0x5c643e);}};exports['agentconnect']=function(_0x370f80){try{if(!_[_0xc676('0x18')](queues[_0x370f80[_0xc676('0x6')]])){utils[_0xc676('0x12')](util[_0xc676('0x4')]('[%s][queues][agentconnect]',_0x370f80[_0xc676('0x6')]),_0x370f80);utils[_0xc676('0x3')](util[_0xc676('0x4')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x370f80[_0xc676('0x6')],queues[_0x370f80[_0xc676('0x6')]]['name'],_0x370f80[_0xc676('0x37')],_0x370f80['destaccountcode']));queues[_0x370f80[_0xc676('0x6')]][_0xc676('0x29')]=![];queues[_0x370f80[_0xc676('0x6')]][_0xc676('0x29')]=![];queues[_0x370f80[_0xc676('0x6')]][_0xc676('0x26')]=null;queues[_0x370f80[_0xc676('0x6')]][_0xc676('0x1b')]=![];queues[_0x370f80[_0xc676('0x6')]]['queuecallerexitreason']=null;queues[_0x370f80['uniqueid']][_0xc676('0x27')]=null;queues[_0x370f80[_0xc676('0x6')]][_0xc676('0x38')]=!![];queues[_0x370f80['uniqueid']][_0xc676('0xa')]=_0x370f80['destaccountcode'];queues[_0x370f80[_0xc676('0x6')]][_0xc676('0x39')]=_0x370f80[_0xc676('0x37')];}}catch(_0x3a1e9d){utils[_0xc676('0x16')](util[_0xc676('0x4')](_0xc676('0x3a'),_0x370f80[_0xc676('0x6')]),_0x3a1e9d);}};exports[_0xc676('0x3b')]=function(_0x1dd47e){try{if(!_[_0xc676('0x18')](queues[_0x1dd47e[_0xc676('0x6')]])){if(queues[_0x1dd47e[_0xc676('0x6')]]['queuecallerleaveAt']){utils['debug'](util['format'](_0xc676('0x3c'),_0x1dd47e[_0xc676('0x6')]),_0x1dd47e);queues[_0x1dd47e[_0xc676('0x6')]][_0xc676('0x29')]=![];queues[_0x1dd47e[_0xc676('0x6')]][_0xc676('0x29')]=![];queues[_0x1dd47e['uniqueid']]['queuecallerabandonAt']=null;queues[_0x1dd47e[_0xc676('0x6')]][_0xc676('0x1b')]=![];queues[_0x1dd47e[_0xc676('0x6')]][_0xc676('0x27')]=null;queues[_0x1dd47e[_0xc676('0x6')]][_0xc676('0x38')]=!![];queues[_0x1dd47e[_0xc676('0x6')]][_0xc676('0x39')]=_0x1dd47e[_0xc676('0x37')];queues[_0x1dd47e['uniqueid']][_0xc676('0x1c')]=!![];queues[_0x1dd47e[_0xc676('0x6')]][_0xc676('0x1d')]=utils[_0xc676('0x1e')]();if(_0x1dd47e['reason']=='transfer'){if(!queues[_0x1dd47e[_0xc676('0x6')]][_0xc676('0x3d')]){queues[_0x1dd47e[_0xc676('0x6')]][_0xc676('0xb')]='TRANSFER';}}else{queues[_0x1dd47e[_0xc676('0x6')]][_0xc676('0xb')]=_0xc676('0x3e')+_0x1dd47e[_0xc676('0x3f')][_0xc676('0x40')]();}utils[_0xc676('0x3')](util[_0xc676('0x4')](_0xc676('0x41'),_0x1dd47e['uniqueid'],queues[_0x1dd47e[_0xc676('0x6')]][_0xc676('0x1f')],_0x1dd47e[_0xc676('0x37')],queues[_0x1dd47e[_0xc676('0x6')]][_0xc676('0xb')]));writeDB(queues[_0x1dd47e[_0xc676('0x6')]]);}}}catch(_0x3df7bd){utils[_0xc676('0x16')](util[_0xc676('0x4')](_0xc676('0x3c'),_0x1dd47e[_0xc676('0x6')]),_0x3df7bd);}};exports[_0xc676('0x42')]=function(_0x45b0d9){try{if(!_['isNil'](queues[_0x45b0d9['transfereeuniqueid']])){utils[_0xc676('0x12')](util['format'](_0xc676('0x43'),_0x45b0d9[_0xc676('0x6')]),_0x45b0d9);queues[_0x45b0d9[_0xc676('0x44')]][_0xc676('0x3d')]=!![];queues[_0x45b0d9[_0xc676('0x44')]][_0xc676('0x45')]=_0xc676('0x46');queues[_0x45b0d9[_0xc676('0x44')]][_0xc676('0x47')]=_0x45b0d9[_0xc676('0x48')];queues[_0x45b0d9[_0xc676('0x44')]]['transferuniqueid']=_0x45b0d9[_0xc676('0x44')];queues[_0x45b0d9['transfereeuniqueid']][_0xc676('0xb')]=_0xc676('0x49');utils['info'](util[_0xc676('0x4')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x45b0d9['uniqueid'],queues[_0x45b0d9[_0xc676('0x44')]][_0xc676('0x1f')],_0x45b0d9[_0xc676('0x44')],_0x45b0d9[_0xc676('0x48')]));}}catch(_0x51bbd0){utils[_0xc676('0x16')](util['format'](_0xc676('0x43'),_0x45b0d9[_0xc676('0x6')]),_0x51bbd0);}};exports['attendedtransfer']=function(_0x1c5abb){try{utils['debug'](util[_0xc676('0x4')]('[%s][queues][attendedtransfer]',_0x1c5abb['origtransfereruniqueid']),_0x1c5abb);if(_0x1c5abb['origtransfereruniqueid']==_0x1c5abb[_0xc676('0x4a')]){if(!_['isNil'](queues[_0x1c5abb[_0xc676('0x4b')]])){utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x1c5abb[_0xc676('0x4c')],queues[_0x1c5abb[_0xc676('0x4b')]]['name'],_0x1c5abb[_0xc676('0x4d')]));queues[_0x1c5abb[_0xc676('0x4b')]][_0xc676('0x3d')]=!![];queues[_0x1c5abb[_0xc676('0x4b')]][_0xc676('0x45')]=_0xc676('0x4e');queues[_0x1c5abb['secondtransfererlinkedid']][_0xc676('0x47')]=_0x1c5abb[_0xc676('0x4d')];queues[_0x1c5abb[_0xc676('0x4b')]][_0xc676('0x4f')]=_0x1c5abb['origtransfereruniqueid'];queues[_0x1c5abb[_0xc676('0x4b')]][_0xc676('0xb')]=_0xc676('0x50');}if(!_['isNil'](queues[_0x1c5abb['origtransfererlinkedid']])){if(_0x1c5abb[_0xc676('0x51')]&&queues[_0x1c5abb[_0xc676('0x51')]]){queues[_0x1c5abb['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x1c5abb[_0xc676('0x44')]]=_[_0xc676('0x52')](queues[_0x1c5abb[_0xc676('0x51')]]);queues[_0x1c5abb[_0xc676('0x44')]][_0xc676('0x11')]=_0x1c5abb[_0xc676('0x53')];queues[_0x1c5abb[_0xc676('0x44')]][_0xc676('0x20')]=0x2;queues[_0x1c5abb[_0xc676('0x44')]]['calleridnum']=queues[_0x1c5abb[_0xc676('0x4b')]][_0xc676('0x9')];queues[_0x1c5abb[_0xc676('0x44')]][_0xc676('0x54')]=queues[_0x1c5abb[_0xc676('0x4b')]][_0xc676('0x54')];queues[_0x1c5abb[_0xc676('0x44')]][_0xc676('0x34')]=utils[_0xc676('0x1e')]();queues[_0x1c5abb[_0xc676('0x44')]][_0xc676('0x1a')]=utils[_0xc676('0x1e')]();queues[_0x1c5abb[_0xc676('0x44')]][_0xc676('0x33')]=0x0;queues[_0x1c5abb['transfereeuniqueid']][_0xc676('0x55')]=0x0;utils['info'](util[_0xc676('0x4')](_0xc676('0x56'),_0x1c5abb[_0xc676('0x4c')],queues[_0x1c5abb['transfereeuniqueid']]['name'],queues[_0x1c5abb['transfereeuniqueid']]['calleridnum'],queues[_0x1c5abb[_0xc676('0x44')]]['calleridname']));}else{utils[_0xc676('0x3')](util[_0xc676('0x4')](_0xc676('0x57'),_0x1c5abb[_0xc676('0x4c')],queues[_0x1c5abb[_0xc676('0x4a')]][_0xc676('0x1f')],_0x1c5abb['secondtransfererlinkedid']));queues[_0x1c5abb[_0xc676('0x4a')]][_0xc676('0x11')]=_0x1c5abb[_0xc676('0x4b')];}}}else if(_0x1c5abb[_0xc676('0x58')]==_0x1c5abb[_0xc676('0x4b')]){if(!_[_0xc676('0x18')](queues[_0x1c5abb['origtransfererlinkedid']])){utils[_0xc676('0x3')](util['format'](_0xc676('0x59'),_0x1c5abb[_0xc676('0x4c')],queues[_0x1c5abb[_0xc676('0x4a')]]['name'],_0x1c5abb[_0xc676('0x58')],_0x1c5abb[_0xc676('0x5a')]));queues[_0x1c5abb[_0xc676('0x4a')]][_0xc676('0x3d')]=!![];queues[_0x1c5abb['origtransfererlinkedid']][_0xc676('0x45')]=_0xc676('0x4e');queues[_0x1c5abb['origtransfererlinkedid']]['transferexten']=_0x1c5abb[_0xc676('0x5a')];queues[_0x1c5abb[_0xc676('0x4a')]][_0xc676('0x4f')]=_0x1c5abb[_0xc676('0x58')];queues[_0x1c5abb['origtransfererlinkedid']][_0xc676('0xb')]=_0xc676('0x50');}if(!_[_0xc676('0x18')](queues[_0x1c5abb[_0xc676('0x4b')]])){if(_0x1c5abb[_0xc676('0x5b')]&&queues[_0x1c5abb['transfertargetlinkedid']]){queues[_0x1c5abb[_0xc676('0x5b')]][_0xc676('0x20')]=0x1;queues[_0x1c5abb[_0xc676('0x53')]]=_[_0xc676('0x52')](queues[_0x1c5abb[_0xc676('0x5b')]]);queues[_0x1c5abb[_0xc676('0x53')]][_0xc676('0x11')]=_0x1c5abb[_0xc676('0x53')];queues[_0x1c5abb[_0xc676('0x53')]][_0xc676('0x20')]=0x2;queues[_0x1c5abb[_0xc676('0x53')]][_0xc676('0x9')]=queues[_0x1c5abb[_0xc676('0x4a')]][_0xc676('0x9')];queues[_0x1c5abb[_0xc676('0x53')]][_0xc676('0x54')]=queues[_0x1c5abb[_0xc676('0x4a')]][_0xc676('0x54')];queues[_0x1c5abb[_0xc676('0x53')]]['queuecallerjoinAt']=utils[_0xc676('0x1e')]();queues[_0x1c5abb['transfertargetuniqueid']]['queuecallerleaveAt']=utils[_0xc676('0x1e')]();queues[_0x1c5abb[_0xc676('0x53')]][_0xc676('0x33')]=0x0;queues[_0x1c5abb[_0xc676('0x53')]][_0xc676('0x55')]=0x0;utils[_0xc676('0x3')](util[_0xc676('0x4')](_0xc676('0x5c'),_0x1c5abb[_0xc676('0x4c')],queues[_0x1c5abb[_0xc676('0x53')]][_0xc676('0x1f')],queues[_0x1c5abb[_0xc676('0x53')]][_0xc676('0x11')],queues[_0x1c5abb[_0xc676('0x53')]]['calleridnum'],queues[_0x1c5abb[_0xc676('0x53')]][_0xc676('0x54')]));}else{utils[_0xc676('0x3')](util[_0xc676('0x4')](_0xc676('0x57'),_0x1c5abb[_0xc676('0x4c')],queues[_0x1c5abb['secondtransfererlinkedid']][_0xc676('0x1f')],_0x1c5abb['origtransfererlinkedid']));queues[_0x1c5abb[_0xc676('0x4b')]][_0xc676('0x11')]=_0x1c5abb['origtransfererlinkedid'];}}}}catch(_0x31511a){utils['error'](util[_0xc676('0x4')](_0xc676('0x5d'),_0x1c5abb[_0xc676('0x4c')]),_0x31511a);}};exports[_0xc676('0x5e')]=function(_0x1097e9){try{if(!_[_0xc676('0x18')](queues[_0x1097e9[_0xc676('0x6')]])){utils[_0xc676('0x12')](util[_0xc676('0x4')](_0xc676('0x5f'),_0x1097e9[_0xc676('0x6')]),_0x1097e9);queues[_0x1097e9[_0xc676('0x6')]][_0xc676('0x60')]=utils[_0xc676('0x1e')]();utils[_0xc676('0x3')](util['format'](_0xc676('0x61'),_0x1097e9['uniqueid'],queues[_0x1097e9[_0xc676('0x6')]]['name'],queues[_0x1097e9['uniqueid']]['musiconholdstartAt']));}}catch(_0x29ecf5){utils['error'](util[_0xc676('0x4')](_0xc676('0x5f'),_0x1097e9[_0xc676('0x6')]),_0x29ecf5);}};exports[_0xc676('0x62')]=function(_0x162963){try{if(!_[_0xc676('0x18')](queues[_0x162963[_0xc676('0x6')]])){if(!_[_0xc676('0x18')](queues[_0x162963[_0xc676('0x6')]]['musiconholdstartAt'])){utils[_0xc676('0x12')](util[_0xc676('0x4')]('[%s][queues][musiconholdstop]',_0x162963['uniqueid']),_0x162963);queues[_0x162963[_0xc676('0x6')]][_0xc676('0x55')]+=utils[_0xc676('0x63')](utils[_0xc676('0x1e')](),queues[_0x162963[_0xc676('0x6')]][_0xc676('0x60')]);utils[_0xc676('0x3')](util[_0xc676('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x162963[_0xc676('0x6')],queues[_0x162963[_0xc676('0x6')]]['name'],queues[_0x162963[_0xc676('0x6')]]['mohtime']));delete queues[_0x162963[_0xc676('0x6')]][_0xc676('0x60')];}}}catch(_0x101370){utils[_0xc676('0x16')](util[_0xc676('0x4')](_0xc676('0x64'),_0x162963[_0xc676('0x6')]),_0x101370);}}; \ No newline at end of file +var _0xa7ee=['COMPLETEDBY','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','transferexten','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','[%s][queues][attendedtransfer]','origtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','format','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','queue','then','type','CreateVoiceQueueReport','transfereduniqueid','uniqueid','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','hangup','debug','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','isNil','queuestatus','value','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerleave','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','[%s][queues][agentcomplete]','assigned','queuecallercompleteAt','reason','transfer'];(function(_0xaeed75,_0x32ec25){var _0x136c83=function(_0x3d642a){while(--_0x3d642a){_0xaeed75['push'](_0xaeed75['shift']());}};_0x136c83(++_0x32ec25);}(_0xa7ee,0x159));var _0xea7e=function(_0x1c2051,_0x4cb6b9){_0x1c2051=_0x1c2051-0x0;var _0x2b58a0=_0xa7ee[_0x1c2051];return _0x2b58a0;};'use strict';var _=require(_0xea7e('0x0'));var util=require('util');var utils=require(_0xea7e('0x1'));var queues={};function writeDB(_0x130c9e){utils[_0xea7e('0x2')](util[_0xea7e('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x130c9e['uniqueid'],_0x130c9e[_0xea7e('0x4')],_0x130c9e['queue'],_0x130c9e[_0xea7e('0x5')],_0x130c9e[_0xea7e('0x6')],_0x130c9e[_0xea7e('0x7')],_0x130c9e[_0xea7e('0x8')]));if(_0x130c9e['queue']){utils[_0xea7e('0x9')](_0x130c9e[_0xea7e('0xa')])[_0xea7e('0xb')](function(_0x38d996){if(_0x38d996){_0x130c9e[_0xea7e('0xc')]=_0x38d996['type'];}utils['request'](_0xea7e('0xd'),_0x130c9e);});}else{utils['request'](_0xea7e('0xd'),_0x130c9e);}if(_0x130c9e[_0xea7e('0xe')]){delete queues[_0x130c9e[_0xea7e('0xe')]];}else{delete queues[_0x130c9e[_0xea7e('0xf')]];}}exports['queuecallerjoin']=function(_0x625e0c){try{utils['debug'](util[_0xea7e('0x3')](_0xea7e('0x10'),_0x625e0c[_0xea7e('0xf')]),_0x625e0c);utils[_0xea7e('0x2')](util[_0xea7e('0x3')](_0xea7e('0x11'),_0x625e0c[_0xea7e('0xf')],_0x625e0c[_0xea7e('0xa')],_0x625e0c['position']));queues[_0x625e0c[_0xea7e('0xf')]]=_[_0xea7e('0x12')](_0x625e0c,{'originalposition':_0x625e0c[_0xea7e('0x13')],'queuecallerjoinAt':utils[_0xea7e('0x14')](),'mohtime':0x0});}catch(_0x57d27e){utils[_0xea7e('0x15')](util['format']('[%s][queues][queuecallerjoin]',_0x625e0c[_0xea7e('0xf')]),_0x57d27e);}};exports[_0xea7e('0x16')]=function(_0x162c47){try{if(!_['isNil'](queues[_0x162c47['uniqueid']])){utils[_0xea7e('0x17')](util['format'](_0xea7e('0x18'),_0x162c47[_0xea7e('0xf')]),_0x162c47);if(queues[_0x162c47['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x162c47[_0xea7e('0xf')]]['queuecallerabandon']&&!queues[_0x162c47['uniqueid']][_0xea7e('0x19')]){queues[_0x162c47['uniqueid']][_0xea7e('0x1a')]=!![];queues[_0x162c47[_0xea7e('0xf')]]['queuecallercompleteAt']=utils[_0xea7e('0x14')]();queues[_0x162c47['uniqueid']][_0xea7e('0x8')]=_0xea7e('0x1b');}utils[_0xea7e('0x2')](util[_0xea7e('0x3')](_0xea7e('0x1c'),_0x162c47[_0xea7e('0xf')],queues[_0x162c47['uniqueid']][_0xea7e('0x1d')],queues[_0x162c47[_0xea7e('0xf')]]['queuecallerexitreason']));writeDB(queues[_0x162c47[_0xea7e('0xf')]]);}else if(queues[_0x162c47[_0xea7e('0xf')]][_0xea7e('0xe')]){utils['info'](util[_0xea7e('0x3')](_0xea7e('0x1e'),_0x162c47[_0xea7e('0xf')],queues[_0x162c47['uniqueid']][_0xea7e('0x1d')],queues[_0x162c47[_0xea7e('0xf')]][_0xea7e('0xe')]));queues[queues[_0x162c47[_0xea7e('0xf')]][_0xea7e('0xe')]]=queues[_0x162c47[_0xea7e('0xf')]];queues[queues[_0x162c47[_0xea7e('0xf')]][_0xea7e('0xe')]][_0xea7e('0x1f')]=0x2;delete queues[_0x162c47[_0xea7e('0xf')]];}}}catch(_0x4a23a9){utils[_0xea7e('0x15')](util[_0xea7e('0x3')]('[%s][queues][hangup]',_0x162c47[_0xea7e('0xf')]),_0x4a23a9);}};exports[_0xea7e('0x20')]=function(_0x1951c0){try{utils[_0xea7e('0x17')](util[_0xea7e('0x3')]('[%s][queues][varset]',_0x1951c0[_0xea7e('0xf')]),_0x1951c0);if(!_[_0xea7e('0x21')](_0x1951c0['variable'][_0xea7e('0x22')])&&_0x1951c0[_0xea7e('0x23')]['toUpperCase']()!==_0xea7e('0x24')){if(!_['isNil'](queues[_0x1951c0[_0xea7e('0xf')]])){queues[_0x1951c0[_0xea7e('0xf')]][_0xea7e('0x25')]=![];queues[_0x1951c0[_0xea7e('0xf')]][_0xea7e('0x26')]=null;queues[_0x1951c0[_0xea7e('0xf')]]['queuecallerexit']=!![];queues[_0x1951c0[_0xea7e('0xf')]][_0xea7e('0x27')]=utils[_0xea7e('0x14')]();queues[_0x1951c0[_0xea7e('0xf')]][_0xea7e('0x8')]=_0x1951c0[_0xea7e('0x23')]['toUpperCase']();utils['info'](util[_0xea7e('0x3')](_0xea7e('0x28'),_0x1951c0[_0xea7e('0xf')],queues[_0x1951c0['uniqueid']][_0xea7e('0x1d')],_0x1951c0[_0xea7e('0x23')],queues[_0x1951c0[_0xea7e('0xf')]][_0xea7e('0x8')]));writeDB(queues[_0x1951c0[_0xea7e('0xf')]]);}}else if(!_[_0xea7e('0x21')](_0x1951c0[_0xea7e('0x29')][_0xea7e('0x2a')])){if(!_[_0xea7e('0x21')](queues[_0x1951c0[_0xea7e('0xf')]])&&!queues[_0x1951c0[_0xea7e('0xf')]][_0xea7e('0x25')]){queues[_0x1951c0[_0xea7e('0xf')]][_0xea7e('0x25')]=![];queues[_0x1951c0[_0xea7e('0xf')]]['queuecallerabandonAt']=null;queues[_0x1951c0[_0xea7e('0xf')]][_0xea7e('0x19')]=!![];queues[_0x1951c0[_0xea7e('0xf')]][_0xea7e('0x27')]=utils['now']();queues[_0x1951c0[_0xea7e('0xf')]]['queuecallerexitreason']=_0xea7e('0x2b');utils['info'](util[_0xea7e('0x3')](_0xea7e('0x2c'),_0x1951c0[_0xea7e('0xf')],queues[_0x1951c0[_0xea7e('0xf')]][_0xea7e('0x1d')],_0x1951c0[_0xea7e('0x23')],queues[_0x1951c0['uniqueid']][_0xea7e('0x8')]));}}}catch(_0x369cad){utils['error'](util[_0xea7e('0x3')]('[%s][queues][varset]',_0x1951c0[_0xea7e('0xf')]),_0x369cad);}};exports[_0xea7e('0x25')]=function(_0x513c72){try{if(!_[_0xea7e('0x21')](queues[_0x513c72[_0xea7e('0xf')]])){utils[_0xea7e('0x17')](util[_0xea7e('0x3')](_0xea7e('0x2d'),_0x513c72[_0xea7e('0xf')]),_0x513c72);queues[_0x513c72[_0xea7e('0xf')]][_0xea7e('0x19')]=![];queues[_0x513c72[_0xea7e('0xf')]][_0xea7e('0x27')]=null;queues[_0x513c72[_0xea7e('0xf')]][_0xea7e('0x25')]=!![];queues[_0x513c72[_0xea7e('0xf')]][_0xea7e('0x26')]=utils['now']();queues[_0x513c72['uniqueid']]['queuecallerexitreason']='ABANDONED';utils['info'](util['format'](_0xea7e('0x2e'),_0x513c72['uniqueid'],queues[_0x513c72[_0xea7e('0xf')]][_0xea7e('0x1d')],queues[_0x513c72['uniqueid']]['queuecallerexitreason']));}}catch(_0x1ac12d){utils[_0xea7e('0x15')](util[_0xea7e('0x3')](_0xea7e('0x2d'),_0x513c72['uniqueid']),_0x1ac12d);}};exports['queuecallerleave']=function(_0x1d4998){try{if(!_['isNil'](queues[_0x1d4998[_0xea7e('0xf')]])){utils[_0xea7e('0x17')](util['format'](_0xea7e('0x2f'),_0x1d4998[_0xea7e('0xf')]),_0x1d4998);utils['info'](util[_0xea7e('0x3')](_0xea7e('0x30'),_0x1d4998['uniqueid'],queues[_0x1d4998['uniqueid']][_0xea7e('0x1d')],_0x1d4998[_0xea7e('0x31')],_0x1d4998['connectedlinename']));queues[_0x1d4998[_0xea7e('0xf')]][_0xea7e('0x32')]=!![];queues[_0x1d4998['uniqueid']][_0xea7e('0x33')]=utils[_0xea7e('0x14')]();queues[_0x1d4998[_0xea7e('0xf')]][_0xea7e('0x34')]=utils[_0xea7e('0x35')](queues[_0x1d4998[_0xea7e('0xf')]][_0xea7e('0x33')],queues[_0x1d4998['uniqueid']][_0xea7e('0x36')]);queues[_0x1d4998[_0xea7e('0xf')]][_0xea7e('0x13')]=_0x1d4998[_0xea7e('0x13')];queues[_0x1d4998[_0xea7e('0xf')]][_0xea7e('0x37')]=_0x1d4998['count'];queues[_0x1d4998[_0xea7e('0xf')]][_0xea7e('0x31')]=_0x1d4998[_0xea7e('0x31')];queues[_0x1d4998[_0xea7e('0xf')]][_0xea7e('0x38')]=_0x1d4998[_0xea7e('0x38')];}}catch(_0x5318b4){utils[_0xea7e('0x15')](util[_0xea7e('0x3')](_0xea7e('0x2f'),_0x1d4998['uniqueid']),_0x5318b4);}};exports[_0xea7e('0x39')]=function(_0x171950){try{if(!_['isNil'](queues[_0x171950[_0xea7e('0xf')]])){utils[_0xea7e('0x17')](util[_0xea7e('0x3')](_0xea7e('0x3a'),_0x171950[_0xea7e('0xf')]),_0x171950);utils[_0xea7e('0x2')](util[_0xea7e('0x3')](_0xea7e('0x3b'),_0x171950[_0xea7e('0xf')],queues[_0x171950['uniqueid']]['name'],_0x171950[_0xea7e('0x3c')],_0x171950[_0xea7e('0x3d')]));queues[_0x171950['uniqueid']][_0xea7e('0x25')]=![];queues[_0x171950['uniqueid']][_0xea7e('0x25')]=![];queues[_0x171950[_0xea7e('0xf')]][_0xea7e('0x26')]=null;queues[_0x171950['uniqueid']][_0xea7e('0x19')]=![];queues[_0x171950[_0xea7e('0xf')]][_0xea7e('0x8')]=null;queues[_0x171950[_0xea7e('0xf')]][_0xea7e('0x27')]=null;queues[_0x171950['uniqueid']]['assigned']=!![];queues[_0x171950[_0xea7e('0xf')]][_0xea7e('0x7')]=_0x171950[_0xea7e('0x3d')];queues[_0x171950[_0xea7e('0xf')]]['lastAssignedTo']=_0x171950[_0xea7e('0x3c')];}}catch(_0x28529b){utils[_0xea7e('0x15')](util[_0xea7e('0x3')](_0xea7e('0x3a'),_0x171950['uniqueid']),_0x28529b);}};exports['agentcomplete']=function(_0xca2af3){try{if(!_[_0xea7e('0x21')](queues[_0xca2af3['uniqueid']])){if(queues[_0xca2af3[_0xea7e('0xf')]][_0xea7e('0x33')]){utils[_0xea7e('0x17')](util[_0xea7e('0x3')](_0xea7e('0x3e'),_0xca2af3['uniqueid']),_0xca2af3);queues[_0xca2af3['uniqueid']][_0xea7e('0x25')]=![];queues[_0xca2af3[_0xea7e('0xf')]][_0xea7e('0x25')]=![];queues[_0xca2af3[_0xea7e('0xf')]][_0xea7e('0x26')]=null;queues[_0xca2af3[_0xea7e('0xf')]][_0xea7e('0x19')]=![];queues[_0xca2af3['uniqueid']]['queuecallerexitAt']=null;queues[_0xca2af3['uniqueid']][_0xea7e('0x3f')]=!![];queues[_0xca2af3[_0xea7e('0xf')]]['lastAssignedTo']=_0xca2af3[_0xea7e('0x3c')];queues[_0xca2af3[_0xea7e('0xf')]]['queuecallercomplete']=!![];queues[_0xca2af3[_0xea7e('0xf')]][_0xea7e('0x40')]=utils['now']();if(_0xca2af3[_0xea7e('0x41')]==_0xea7e('0x42')){if(!queues[_0xca2af3[_0xea7e('0xf')]][_0xea7e('0x42')]){queues[_0xca2af3[_0xea7e('0xf')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0xca2af3[_0xea7e('0xf')]][_0xea7e('0x8')]=_0xea7e('0x43')+_0xca2af3['reason'][_0xea7e('0x44')]();}utils[_0xea7e('0x2')](util[_0xea7e('0x3')](_0xea7e('0x45'),_0xca2af3[_0xea7e('0xf')],queues[_0xca2af3['uniqueid']]['name'],_0xca2af3[_0xea7e('0x3c')],queues[_0xca2af3[_0xea7e('0xf')]]['queuecallerexitreason']));writeDB(queues[_0xca2af3[_0xea7e('0xf')]]);}}}catch(_0x1907d1){utils['error'](util[_0xea7e('0x3')](_0xea7e('0x3e'),_0xca2af3[_0xea7e('0xf')]),_0x1907d1);}};exports[_0xea7e('0x46')]=function(_0x210935){try{if(!_[_0xea7e('0x21')](queues[_0x210935['transfereeuniqueid']])){utils[_0xea7e('0x17')](util['format'](_0xea7e('0x47'),_0x210935[_0xea7e('0xf')]),_0x210935);queues[_0x210935[_0xea7e('0x48')]][_0xea7e('0x42')]=!![];queues[_0x210935['transfereeuniqueid']][_0xea7e('0x49')]='BLIND';queues[_0x210935[_0xea7e('0x48')]][_0xea7e('0x4a')]=_0x210935['extension'];queues[_0x210935[_0xea7e('0x48')]][_0xea7e('0x4b')]=_0x210935[_0xea7e('0x48')];queues[_0x210935['transfereeuniqueid']][_0xea7e('0x8')]='BLINDTRANSFER';utils['info'](util['format'](_0xea7e('0x4c'),_0x210935['uniqueid'],queues[_0x210935['transfereeuniqueid']][_0xea7e('0x1d')],_0x210935[_0xea7e('0x48')],_0x210935[_0xea7e('0x4d')]));}}catch(_0x201175){utils[_0xea7e('0x15')](util['format'](_0xea7e('0x47'),_0x210935['uniqueid']),_0x201175);}};exports['attendedtransfer']=function(_0x3e49bd){try{utils[_0xea7e('0x17')](util['format'](_0xea7e('0x4e'),_0x3e49bd[_0xea7e('0x4f')]),_0x3e49bd);if(_0x3e49bd['origtransfereruniqueid']==_0x3e49bd['origtransfererlinkedid']){if(!_['isNil'](queues[_0x3e49bd['secondtransfererlinkedid']])){utils[_0xea7e('0x2')](util['format'](_0xea7e('0x50'),_0x3e49bd[_0xea7e('0x4f')],queues[_0x3e49bd[_0xea7e('0x51')]]['name'],_0x3e49bd['origtransfererexten']));queues[_0x3e49bd[_0xea7e('0x51')]][_0xea7e('0x42')]=!![];queues[_0x3e49bd['secondtransfererlinkedid']][_0xea7e('0x49')]=_0xea7e('0x52');queues[_0x3e49bd[_0xea7e('0x51')]][_0xea7e('0x4a')]=_0x3e49bd[_0xea7e('0x53')];queues[_0x3e49bd[_0xea7e('0x51')]][_0xea7e('0x4b')]=_0x3e49bd[_0xea7e('0x4f')];queues[_0x3e49bd[_0xea7e('0x51')]][_0xea7e('0x8')]=_0xea7e('0x54');}if(!_['isNil'](queues[_0x3e49bd[_0xea7e('0x55')]])){if(_0x3e49bd[_0xea7e('0x56')]&&queues[_0x3e49bd[_0xea7e('0x56')]]){queues[_0x3e49bd['transfereelinkedid']][_0xea7e('0x1f')]=0x1;queues[_0x3e49bd[_0xea7e('0x48')]]=_[_0xea7e('0x57')](queues[_0x3e49bd[_0xea7e('0x56')]]);queues[_0x3e49bd[_0xea7e('0x48')]][_0xea7e('0xe')]=_0x3e49bd[_0xea7e('0x58')];queues[_0x3e49bd[_0xea7e('0x48')]][_0xea7e('0x1f')]=0x2;queues[_0x3e49bd['transfereeuniqueid']][_0xea7e('0x6')]=queues[_0x3e49bd['secondtransfererlinkedid']][_0xea7e('0x6')];queues[_0x3e49bd[_0xea7e('0x48')]]['calleridname']=queues[_0x3e49bd['secondtransfererlinkedid']][_0xea7e('0x59')];queues[_0x3e49bd['transfereeuniqueid']]['queuecallerjoinAt']=utils[_0xea7e('0x14')]();queues[_0x3e49bd['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0xea7e('0x14')]();queues[_0x3e49bd[_0xea7e('0x48')]][_0xea7e('0x34')]=0x0;queues[_0x3e49bd[_0xea7e('0x48')]][_0xea7e('0x5a')]=0x0;utils[_0xea7e('0x2')](util[_0xea7e('0x3')](_0xea7e('0x5b'),_0x3e49bd[_0xea7e('0x4f')],queues[_0x3e49bd['transfereeuniqueid']]['name'],queues[_0x3e49bd[_0xea7e('0x48')]][_0xea7e('0x6')],queues[_0x3e49bd[_0xea7e('0x48')]][_0xea7e('0x59')]));}else{utils[_0xea7e('0x2')](util[_0xea7e('0x3')](_0xea7e('0x5c'),_0x3e49bd[_0xea7e('0x4f')],queues[_0x3e49bd[_0xea7e('0x55')]][_0xea7e('0x1d')],_0x3e49bd[_0xea7e('0x51')]));queues[_0x3e49bd['origtransfererlinkedid']][_0xea7e('0xe')]=_0x3e49bd[_0xea7e('0x51')];}}}else if(_0x3e49bd[_0xea7e('0x5d')]==_0x3e49bd[_0xea7e('0x51')]){if(!_[_0xea7e('0x21')](queues[_0x3e49bd[_0xea7e('0x55')]])){utils[_0xea7e('0x2')](util[_0xea7e('0x3')](_0xea7e('0x5e'),_0x3e49bd['origtransfereruniqueid'],queues[_0x3e49bd[_0xea7e('0x55')]][_0xea7e('0x1d')],_0x3e49bd[_0xea7e('0x5d')],_0x3e49bd[_0xea7e('0x5f')]));queues[_0x3e49bd[_0xea7e('0x55')]][_0xea7e('0x42')]=!![];queues[_0x3e49bd[_0xea7e('0x55')]][_0xea7e('0x49')]=_0xea7e('0x52');queues[_0x3e49bd['origtransfererlinkedid']][_0xea7e('0x4a')]=_0x3e49bd[_0xea7e('0x5f')];queues[_0x3e49bd['origtransfererlinkedid']][_0xea7e('0x4b')]=_0x3e49bd['secondtransfereruniqueid'];queues[_0x3e49bd[_0xea7e('0x55')]]['queuecallerexitreason']=_0xea7e('0x54');}if(!_[_0xea7e('0x21')](queues[_0x3e49bd[_0xea7e('0x51')]])){if(_0x3e49bd[_0xea7e('0x60')]&&queues[_0x3e49bd['transfertargetlinkedid']]){queues[_0x3e49bd['transfertargetlinkedid']][_0xea7e('0x1f')]=0x1;queues[_0x3e49bd[_0xea7e('0x58')]]=_['clone'](queues[_0x3e49bd[_0xea7e('0x60')]]);queues[_0x3e49bd['transfertargetuniqueid']][_0xea7e('0xe')]=_0x3e49bd[_0xea7e('0x58')];queues[_0x3e49bd['transfertargetuniqueid']][_0xea7e('0x1f')]=0x2;queues[_0x3e49bd[_0xea7e('0x58')]][_0xea7e('0x6')]=queues[_0x3e49bd[_0xea7e('0x55')]]['calleridnum'];queues[_0x3e49bd[_0xea7e('0x58')]][_0xea7e('0x59')]=queues[_0x3e49bd[_0xea7e('0x55')]]['calleridname'];queues[_0x3e49bd[_0xea7e('0x58')]][_0xea7e('0x36')]=utils['now']();queues[_0x3e49bd['transfertargetuniqueid']][_0xea7e('0x33')]=utils[_0xea7e('0x14')]();queues[_0x3e49bd['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x3e49bd['transfertargetuniqueid']][_0xea7e('0x5a')]=0x0;utils[_0xea7e('0x2')](util[_0xea7e('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x3e49bd[_0xea7e('0x4f')],queues[_0x3e49bd[_0xea7e('0x58')]][_0xea7e('0x1d')],queues[_0x3e49bd['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x3e49bd[_0xea7e('0x58')]][_0xea7e('0x6')],queues[_0x3e49bd[_0xea7e('0x58')]]['calleridname']));}else{utils[_0xea7e('0x2')](util[_0xea7e('0x3')](_0xea7e('0x5c'),_0x3e49bd[_0xea7e('0x4f')],queues[_0x3e49bd[_0xea7e('0x51')]][_0xea7e('0x1d')],_0x3e49bd[_0xea7e('0x55')]));queues[_0x3e49bd[_0xea7e('0x51')]][_0xea7e('0xe')]=_0x3e49bd['origtransfererlinkedid'];}}}}catch(_0x3d436c){utils['error'](util[_0xea7e('0x3')](_0xea7e('0x4e'),_0x3e49bd[_0xea7e('0x4f')]),_0x3d436c);}};exports[_0xea7e('0x61')]=function(_0x59dd3e){try{if(!_[_0xea7e('0x21')](queues[_0x59dd3e[_0xea7e('0xf')]])){utils['debug'](util[_0xea7e('0x3')](_0xea7e('0x62'),_0x59dd3e[_0xea7e('0xf')]),_0x59dd3e);queues[_0x59dd3e['uniqueid']]['musiconholdstartAt']=utils[_0xea7e('0x14')]();utils[_0xea7e('0x2')](util[_0xea7e('0x3')](_0xea7e('0x63'),_0x59dd3e[_0xea7e('0xf')],queues[_0x59dd3e['uniqueid']][_0xea7e('0x1d')],queues[_0x59dd3e[_0xea7e('0xf')]]['musiconholdstartAt']));}}catch(_0x531c06){utils[_0xea7e('0x15')](util[_0xea7e('0x3')]('[%s][queues][musiconholdstart]',_0x59dd3e[_0xea7e('0xf')]),_0x531c06);}};exports['musiconholdstop']=function(_0x27feb2){try{if(!_[_0xea7e('0x21')](queues[_0x27feb2[_0xea7e('0xf')]])){if(!_[_0xea7e('0x21')](queues[_0x27feb2[_0xea7e('0xf')]][_0xea7e('0x64')])){utils[_0xea7e('0x17')](util[_0xea7e('0x3')](_0xea7e('0x65'),_0x27feb2[_0xea7e('0xf')]),_0x27feb2);queues[_0x27feb2['uniqueid']]['mohtime']+=utils[_0xea7e('0x35')](utils[_0xea7e('0x14')](),queues[_0x27feb2[_0xea7e('0xf')]][_0xea7e('0x64')]);utils[_0xea7e('0x2')](util[_0xea7e('0x3')](_0xea7e('0x66'),_0x27feb2[_0xea7e('0xf')],queues[_0x27feb2['uniqueid']]['name'],queues[_0x27feb2[_0xea7e('0xf')]]['mohtime']));delete queues[_0x27feb2[_0xea7e('0xf')]][_0xea7e('0x64')];}}}catch(_0x248725){utils[_0xea7e('0x15')](util[_0xea7e('0x3')](_0xea7e('0x65'),_0x27feb2[_0xea7e('0xf')]),_0x248725);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index a9fa203..8c68e7f 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 _0x14e0=['request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','uniqueid','linkedid','info','context','exten','channel','error','newstate','debug','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]','varset','variable','[%s][recordings][varset]','value','.wav49','replace','.WAV','find','monitors','push','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','lodash','util','./utils','format','[%s][recordings][writeDB]','getUserByInternal','accountcode','name'];(function(_0x1a379a,_0x2868e0){var _0x528c58=function(_0x25a00a){while(--_0x25a00a){_0x1a379a['push'](_0x1a379a['shift']());}};_0x528c58(++_0x2868e0);}(_0x14e0,0x6e));var _0x014e=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0x14e0[_0x3bab09];return _0x164376;};'use strict';var _=require(_0x014e('0x0'));var util=require(_0x014e('0x1'));var utils=require(_0x014e('0x2'));var recordings={};function writeDB(_0x41c648){utils['info'](util[_0x014e('0x3')](_0x014e('0x4'),_0x41c648['uniqueid']));if(_0x41c648['accountcode']){utils[_0x014e('0x5')](_0x41c648[_0x014e('0x6')])['then'](function(_0x58cdc6){if(_0x58cdc6){_0x41c648['membername']=_0x58cdc6[_0x014e('0x7')];_0x41c648['UserId']=_0x58cdc6['id'];}utils[_0x014e('0x8')](_0x014e('0x9'),_0x41c648);});}else{utils[_0x014e('0x8')](_0x014e('0x9'),_0x41c648);}}exports[_0x014e('0xa')]=function(_0x36fa78){try{utils['debug'](util[_0x014e('0x3')](_0x014e('0xb'),_0x36fa78[_0x014e('0xc')]),_0x36fa78);if(_0x36fa78['uniqueid']==_0x36fa78[_0x014e('0xd')]){utils[_0x014e('0xe')](util[_0x014e('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x36fa78[_0x014e('0xc')],_0x36fa78[_0x014e('0xf')],_0x36fa78[_0x014e('0x10')]));recordings[_0x36fa78[_0x014e('0xc')]]={'uniqueid':_0x36fa78[_0x014e('0xc')],'accountcode':_0x36fa78[_0x014e('0x6')],'exten':_0x36fa78['exten'],'context':_0x36fa78['context'],'channel':_0x36fa78[_0x014e('0x11')],'monitors':[]};}}catch(_0x2c0f44){utils[_0x014e('0x12')](util[_0x014e('0x3')](_0x014e('0xb'),_0x36fa78['uniqueid']),_0x2c0f44);}};exports[_0x014e('0x13')]=function(_0x1ec5c9){try{utils[_0x014e('0x14')](util[_0x014e('0x3')]('[%s][recordings][newstate]',_0x1ec5c9['uniqueid']),_0x1ec5c9);if(!_[_0x014e('0x15')](recordings[_0x1ec5c9['uniqueid']])&&_0x1ec5c9['channelstate']==0x6){utils[_0x014e('0xe')](util[_0x014e('0x3')](_0x014e('0x16'),_0x1ec5c9['uniqueid'],_0x1ec5c9['context'],_0x1ec5c9[_0x014e('0x11')]));}else if(!_[_0x014e('0x15')](recordings[_0x1ec5c9[_0x014e('0xd')]])&&_0x1ec5c9['channelstate']==0x6&&_0x1ec5c9['context']!=_0x014e('0x17')){utils['info'](util[_0x014e('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1ec5c9[_0x014e('0xc')],_0x1ec5c9[_0x014e('0xd')],_0x1ec5c9['context'],_0x1ec5c9[_0x014e('0x11')]));recordings[_0x1ec5c9[_0x014e('0xd')]][_0x014e('0x6')]=_0x1ec5c9[_0x014e('0x6')];}}catch(_0x39f8d4){utils[_0x014e('0x12')](util[_0x014e('0x3')](_0x014e('0x18'),_0x1ec5c9[_0x014e('0xc')]),_0x39f8d4);}};exports[_0x014e('0x19')]=function(_0x592bf9){try{if(!_['isNil'](_0x592bf9[_0x014e('0x1a')])&&!_[_0x014e('0x15')](_0x592bf9['variable']['mixmonitor_filename'])){utils[_0x014e('0x14')](util[_0x014e('0x3')](_0x014e('0x1b'),_0x592bf9['uniqueid']),_0x592bf9);utils['info'](util[_0x014e('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x592bf9[_0x014e('0xc')],_0x592bf9['variable'],_0x592bf9['value']));if(_['endsWith'](_0x592bf9[_0x014e('0x1c')],_0x014e('0x1d'))){_0x592bf9['value']=_0x592bf9[_0x014e('0x1c')][_0x014e('0x1e')]('.wav49',_0x014e('0x1f'));}if(recordings[_0x592bf9['linkedid']]){var _0x2d7994=_[_0x014e('0x20')](recordings[_0x592bf9[_0x014e('0xd')]]['monitors'],{'value':_0x592bf9['value']});if(_[_0x014e('0x15')](_0x2d7994)){recordings[_0x592bf9[_0x014e('0xd')]][_0x014e('0x21')][_0x014e('0x22')]({'value':_0x592bf9[_0x014e('0x1c')]});}}}}catch(_0x44d085){utils[_0x014e('0x12')](util[_0x014e('0x3')]('[%s][recordings][varset]',_0x592bf9[_0x014e('0xc')]),_0x44d085);}};exports['hangup']=function(_0x17d49c){try{if(!_[_0x014e('0x15')](recordings[_0x17d49c[_0x014e('0xc')]])){utils[_0x014e('0x14')](util[_0x014e('0x3')]('[%s][recordings][hangup]',_0x17d49c['uniqueid']),_0x17d49c);utils[_0x014e('0xe')](util[_0x014e('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x17d49c[_0x014e('0xc')],_0x17d49c[_0x014e('0x23')],_0x17d49c[_0x014e('0x24')],_0x17d49c[_0x014e('0x25')]));recordings[_0x17d49c[_0x014e('0xc')]][_0x014e('0x23')]=_0x17d49c['calleridnum'];recordings[_0x17d49c[_0x014e('0xc')]][_0x014e('0x24')]=_0x17d49c[_0x014e('0x24')];recordings[_0x17d49c[_0x014e('0xc')]]['connectedlinenum']=_0x17d49c[_0x014e('0x26')];recordings[_0x17d49c['uniqueid']]['connectedlinename']=_0x17d49c[_0x014e('0x27')];if(recordings[_0x17d49c[_0x014e('0xc')]][_0x014e('0x28')]==_0x014e('0x29')&&recordings[_0x17d49c[_0x014e('0xc')]][_0x014e('0x6')]){recordings[_0x17d49c[_0x014e('0xc')]]['connectedlinenum']=recordings[_0x17d49c[_0x014e('0xc')]][_0x014e('0x6')];recordings[_0x17d49c[_0x014e('0xc')]][_0x014e('0x27')]='';}recordings[_0x17d49c[_0x014e('0xc')]]['monitors'][_0x014e('0x2a')](function(_0x505124){var _0x5eed99=_[_0x014e('0x2b')](recordings[_0x17d49c[_0x014e('0xc')]]);_0x5eed99['value']=_0x505124[_0x014e('0x1c')];writeDB(_0x5eed99);});delete recordings[_0x17d49c[_0x014e('0xc')]];}}catch(_0x4dbef5){utils[_0x014e('0x12')](util['format'](_0x014e('0x2c'),_0x17d49c[_0x014e('0xc')]),_0x4dbef5);}};exports['newexten']=function(_0x3ba970){try{if(!_[_0x014e('0x15')](recordings[_0x3ba970[_0x014e('0xc')]])){utils[_0x014e('0x14')](util[_0x014e('0x3')](_0x014e('0x2d'),_0x3ba970['uniqueid']),_0x3ba970);utils[_0x014e('0xe')](util[_0x014e('0x3')](_0x014e('0x2e'),_0x3ba970['uniqueid'],_0x3ba970[_0x014e('0x2f')],_0x3ba970[_0x014e('0x30')]));if(_0x3ba970[_0x014e('0x2f')][_0x014e('0x31')]()=='set'&&_[_0x014e('0x32')](_0x3ba970[_0x014e('0x30')][_0x014e('0x31')](),_0x014e('0x33'))){var _0x19a152=_0x3ba970['appdata'][_0x014e('0x34')]('=');var _0x124137=_0x19a152[0x0][_0x014e('0x35')](_0x19a152[0x0][_0x014e('0x36')]('(')+0x1,_0x19a152[0x0][_0x014e('0x36')](')'));var _0x5e2d38=_0x19a152[0x1];recordings[_0x3ba970[_0x014e('0xc')]][_0x124137]=_0x5e2d38;}}}catch(_0x468925){utils[_0x014e('0x12')](util['format'](_0x014e('0x2d'),_0x3ba970['uniqueid']),_0x468925);}};exports[_0x014e('0x37')]=function(_0x5a3a95){try{if(!_[_0x014e('0x15')](recordings[_0x5a3a95[_0x014e('0xc')]])){utils['debug'](util[_0x014e('0x3')]('[%s][recordings][queuecallerjoin]',_0x5a3a95[_0x014e('0xc')]),_0x5a3a95);utils['info'](util[_0x014e('0x3')](_0x014e('0x38'),_0x5a3a95[_0x014e('0xc')],_0x5a3a95['queue']));recordings[_0x5a3a95[_0x014e('0xc')]][_0x014e('0x39')]=_0x5a3a95[_0x014e('0x39')];}}catch(_0x24796c){utils[_0x014e('0x12')](util[_0x014e('0x3')](_0x014e('0x3a'),_0x5a3a95[_0x014e('0xc')]),_0x24796c);}}; \ No newline at end of file +var _0x9007=['toLowerCase','startsWith','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','./utils','format','[%s][recordings][writeDB]','uniqueid','accountcode','then','membername','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','channel','error','[%s][recordings][newstate]','channelstate','info','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','varset','isNil','variable','mixmonitor_filename','debug','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','replace','.wav49','.WAV','monitors','push','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata'];(function(_0x484470,_0x394668){var _0x5bced6=function(_0x259ad2){while(--_0x259ad2){_0x484470['push'](_0x484470['shift']());}};_0x5bced6(++_0x394668);}(_0x9007,0xb3));var _0x7900=function(_0x1bff41,_0x386880){_0x1bff41=_0x1bff41-0x0;var _0x4db66b=_0x9007[_0x1bff41];return _0x4db66b;};'use strict';var _=require(_0x7900('0x0'));var util=require('util');var utils=require(_0x7900('0x1'));var recordings={};function writeDB(_0x5822a8){utils['info'](util[_0x7900('0x2')](_0x7900('0x3'),_0x5822a8[_0x7900('0x4')]));if(_0x5822a8[_0x7900('0x5')]){utils['getUserByInternal'](_0x5822a8[_0x7900('0x5')])[_0x7900('0x6')](function(_0x5cddef){if(_0x5cddef){_0x5822a8[_0x7900('0x7')]=_0x5cddef['name'];_0x5822a8[_0x7900('0x8')]=_0x5cddef['id'];}utils['request']('CreateVoiceRecording',_0x5822a8);});}else{utils[_0x7900('0x9')](_0x7900('0xa'),_0x5822a8);}}exports[_0x7900('0xb')]=function(_0x6c07e4){try{utils['debug'](util['format'](_0x7900('0xc'),_0x6c07e4[_0x7900('0x4')]),_0x6c07e4);if(_0x6c07e4[_0x7900('0x4')]==_0x6c07e4[_0x7900('0xd')]){utils['info'](util[_0x7900('0x2')](_0x7900('0xe'),_0x6c07e4[_0x7900('0x4')],_0x6c07e4[_0x7900('0xf')],_0x6c07e4['exten']));recordings[_0x6c07e4['uniqueid']]={'uniqueid':_0x6c07e4[_0x7900('0x4')],'accountcode':_0x6c07e4[_0x7900('0x5')],'exten':_0x6c07e4['exten'],'context':_0x6c07e4[_0x7900('0xf')],'channel':_0x6c07e4[_0x7900('0x10')],'monitors':[]};}}catch(_0x10ee4c){utils[_0x7900('0x11')](util[_0x7900('0x2')](_0x7900('0xc'),_0x6c07e4[_0x7900('0x4')]),_0x10ee4c);}};exports['newstate']=function(_0x18dcd8){try{utils['debug'](util[_0x7900('0x2')](_0x7900('0x12'),_0x18dcd8[_0x7900('0x4')]),_0x18dcd8);if(!_['isNil'](recordings[_0x18dcd8[_0x7900('0x4')]])&&_0x18dcd8[_0x7900('0x13')]==0x6){utils[_0x7900('0x14')](util[_0x7900('0x2')](_0x7900('0x15'),_0x18dcd8[_0x7900('0x4')],_0x18dcd8[_0x7900('0xf')],_0x18dcd8[_0x7900('0x10')]));}else if(!_['isNil'](recordings[_0x18dcd8[_0x7900('0xd')]])&&_0x18dcd8['channelstate']==0x6&&_0x18dcd8[_0x7900('0xf')]!=_0x7900('0x16')){utils[_0x7900('0x14')](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x18dcd8[_0x7900('0x4')],_0x18dcd8['linkedid'],_0x18dcd8[_0x7900('0xf')],_0x18dcd8[_0x7900('0x10')]));recordings[_0x18dcd8[_0x7900('0xd')]]['accountcode']=_0x18dcd8[_0x7900('0x5')];}}catch(_0x45030e){utils['error'](util[_0x7900('0x2')](_0x7900('0x12'),_0x18dcd8['uniqueid']),_0x45030e);}};exports[_0x7900('0x17')]=function(_0x1d3544){try{if(!_[_0x7900('0x18')](_0x1d3544[_0x7900('0x19')])&&!_['isNil'](_0x1d3544['variable'][_0x7900('0x1a')])){utils[_0x7900('0x1b')](util[_0x7900('0x2')]('[%s][recordings][varset]',_0x1d3544[_0x7900('0x4')]),_0x1d3544);utils[_0x7900('0x14')](util['format'](_0x7900('0x1c'),_0x1d3544[_0x7900('0x4')],_0x1d3544[_0x7900('0x19')],_0x1d3544[_0x7900('0x1d')]));if(_['endsWith'](_0x1d3544[_0x7900('0x1d')],'.wav49')){_0x1d3544[_0x7900('0x1d')]=_0x1d3544[_0x7900('0x1d')][_0x7900('0x1e')](_0x7900('0x1f'),_0x7900('0x20'));}if(recordings[_0x1d3544[_0x7900('0xd')]]){var _0x37a1ce=_['find'](recordings[_0x1d3544[_0x7900('0xd')]][_0x7900('0x21')],{'value':_0x1d3544['value']});if(_[_0x7900('0x18')](_0x37a1ce)){recordings[_0x1d3544[_0x7900('0xd')]][_0x7900('0x21')][_0x7900('0x22')]({'value':_0x1d3544[_0x7900('0x1d')]});}}}}catch(_0x2b9cc7){utils['error'](util[_0x7900('0x2')]('[%s][recordings][varset]',_0x1d3544[_0x7900('0x4')]),_0x2b9cc7);}};exports['hangup']=function(_0x1c0063){try{if(!_[_0x7900('0x18')](recordings[_0x1c0063[_0x7900('0x4')]])){utils[_0x7900('0x1b')](util['format']('[%s][recordings][hangup]',_0x1c0063[_0x7900('0x4')]),_0x1c0063);utils['info'](util[_0x7900('0x2')](_0x7900('0x23'),_0x1c0063[_0x7900('0x4')],_0x1c0063[_0x7900('0x24')],_0x1c0063[_0x7900('0x25')],_0x1c0063[_0x7900('0x26')]));recordings[_0x1c0063[_0x7900('0x4')]]['calleridnum']=_0x1c0063[_0x7900('0x24')];recordings[_0x1c0063[_0x7900('0x4')]][_0x7900('0x25')]=_0x1c0063[_0x7900('0x25')];recordings[_0x1c0063[_0x7900('0x4')]][_0x7900('0x27')]=_0x1c0063[_0x7900('0x27')];recordings[_0x1c0063['uniqueid']]['connectedlinename']=_0x1c0063[_0x7900('0x28')];if(recordings[_0x1c0063[_0x7900('0x4')]][_0x7900('0x29')]==_0x7900('0x2a')&&recordings[_0x1c0063['uniqueid']][_0x7900('0x5')]){recordings[_0x1c0063['uniqueid']][_0x7900('0x27')]=recordings[_0x1c0063['uniqueid']][_0x7900('0x5')];recordings[_0x1c0063['uniqueid']][_0x7900('0x28')]='';}recordings[_0x1c0063[_0x7900('0x4')]]['monitors']['forEach'](function(_0x1a173e){var _0x2b410e=_[_0x7900('0x2b')](recordings[_0x1c0063[_0x7900('0x4')]]);_0x2b410e[_0x7900('0x1d')]=_0x1a173e[_0x7900('0x1d')];writeDB(_0x2b410e);});delete recordings[_0x1c0063['uniqueid']];}}catch(_0x3a206a){utils[_0x7900('0x11')](util['format']('[%s][recordings][hangup]',_0x1c0063[_0x7900('0x4')]),_0x3a206a);}};exports[_0x7900('0x2c')]=function(_0xd6e814){try{if(!_[_0x7900('0x18')](recordings[_0xd6e814[_0x7900('0x4')]])){utils[_0x7900('0x1b')](util[_0x7900('0x2')](_0x7900('0x2d'),_0xd6e814[_0x7900('0x4')]),_0xd6e814);utils['info'](util[_0x7900('0x2')](_0x7900('0x2e'),_0xd6e814[_0x7900('0x4')],_0xd6e814[_0x7900('0x2f')],_0xd6e814[_0x7900('0x30')]));if(_0xd6e814['application'][_0x7900('0x31')]()=='set'&&_[_0x7900('0x32')](_0xd6e814[_0x7900('0x30')]['toLowerCase'](),'cdr')){var _0x2450c0=_0xd6e814[_0x7900('0x30')][_0x7900('0x33')]('=');var _0x43469f=_0x2450c0[0x0][_0x7900('0x34')](_0x2450c0[0x0]['lastIndexOf']('(')+0x1,_0x2450c0[0x0][_0x7900('0x35')](')'));var _0x313da2=_0x2450c0[0x1];recordings[_0xd6e814['uniqueid']][_0x43469f]=_0x313da2;}}}catch(_0x1133e6){utils[_0x7900('0x11')](util[_0x7900('0x2')](_0x7900('0x2d'),_0xd6e814[_0x7900('0x4')]),_0x1133e6);}};exports[_0x7900('0x36')]=function(_0x43fba1){try{if(!_[_0x7900('0x18')](recordings[_0x43fba1[_0x7900('0x4')]])){utils['debug'](util[_0x7900('0x2')](_0x7900('0x37'),_0x43fba1[_0x7900('0x4')]),_0x43fba1);utils[_0x7900('0x14')](util[_0x7900('0x2')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x43fba1['uniqueid'],_0x43fba1['queue']));recordings[_0x43fba1[_0x7900('0x4')]][_0x7900('0x38')]=_0x43fba1[_0x7900('0x38')];}}catch(_0x4f7fe6){utils[_0x7900('0x11')](util[_0x7900('0x2')](_0x7900('0x37'),_0x43fba1[_0x7900('0x4')]),_0x4f7fe6);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 07d172c..2405799 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 _0x022e=['transfertargetexten','lodash','util','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetconnectedlinename'];(function(_0x23c052,_0x529c10){var _0x4f9d57=function(_0x2dac0d){while(--_0x2dac0d){_0x23c052['push'](_0x23c052['shift']());}};_0x4f9d57(++_0x529c10);}(_0x022e,0x161));var _0xe022=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x022e[_0x35da42];return _0x370035;};'use strict';var _=require(_0xe022('0x0'));var util=require(_0xe022('0x1'));var utils=require('./utils');function writeDB(_0x447fd3){utils[_0xe022('0x2')](util[_0xe022('0x3')](_0xe022('0x4'),_0x447fd3[_0xe022('0x5')]===_0xe022('0x6')?_0x447fd3[_0xe022('0x7')]:_0x447fd3[_0xe022('0x8')],_0x447fd3['type']));utils[_0xe022('0x9')]('CreateVoiceTransferReport',_0x447fd3);}exports['blindtransfer']=function(_0x133ed4){try{utils[_0xe022('0xa')](util['format']('[%s][transfers][blindtransfer]',_0x133ed4[_0xe022('0x8')]),_0x133ed4);utils['info'](util[_0xe022('0x3')](_0xe022('0xb'),_0x133ed4[_0xe022('0x8')],_0x133ed4['transferercalleridnum'],_0x133ed4[_0xe022('0xc')],_0x133ed4[_0xe022('0xd')],_0x133ed4[_0xe022('0xe')]));_0x133ed4['type']=_0xe022('0xf');writeDB(_0x133ed4);}catch(_0x23e400){utils['error'](util[_0xe022('0x3')]('[%s][transfers][blindtransfer]',_0x133ed4[_0xe022('0x8')]),_0x23e400);}};exports[_0xe022('0x10')]=function(_0x3aad43){try{utils[_0xe022('0xa')](util[_0xe022('0x3')](_0xe022('0x11'),_0x3aad43[_0xe022('0x7')]),_0x3aad43);utils[_0xe022('0x2')](util[_0xe022('0x3')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x3aad43[_0xe022('0x7')],_0x3aad43[_0xe022('0x12')],_0x3aad43[_0xe022('0x13')],_0x3aad43['transfertargetcalleridnum'],_0x3aad43[_0xe022('0x14')]));_0x3aad43=_['assign'](_0x3aad43,{'transfererchannel':_0x3aad43['origtransfererchannel'],'transferercalleridnum':_0x3aad43[_0xe022('0x12')],'transferercalleridname':_0x3aad43['origtransferercalleridname'],'transfererconnectedlinenum':_0x3aad43[_0xe022('0x15')],'transfererconnectedlinename':_0x3aad43[_0xe022('0x16')],'transfereraccountcode':_0x3aad43[_0xe022('0x17')],'transferercontext':_0x3aad43[_0xe022('0x18')],'transfererexten':_0x3aad43[_0xe022('0x19')],'transfererlinkedid':_0x3aad43['origtransfererlinkedid'],'context':_0x3aad43[_0xe022('0x1a')],'extension':_0x3aad43[_0xe022('0x1b')],'type':'attended'});if(_['isNil'](_0x3aad43[_0xe022('0x1c')])){_0x3aad43=_['assign'](_0x3aad43,{'transfereechannel':_0x3aad43[_0xe022('0x1d')],'transfereecalleridnum':_0x3aad43['transfertargetcalleridnum'],'transfereecalleridname':_0x3aad43['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3aad43['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3aad43[_0xe022('0x1e')],'transfereeaccountcode':_0x3aad43['transfertargetaccountcode'],'transfereecontext':_0x3aad43['transfertargetcontext'],'transfereeexten':_0x3aad43[_0xe022('0x1f')],'transfereelinkedid':_0x3aad43['transfertargetlinkedid']});}writeDB(_0x3aad43);}catch(_0x435122){utils['error'](util['format'](_0xe022('0x11'),_0x3aad43[_0xe022('0x7')]),_0x435122);}}; \ No newline at end of file +var _0xbb9b=['format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','request','CreateVoiceTransferReport','blindtransfer','[%s][transfers][blindtransfer]','uniqueid','transferercalleridnum','transfereecalleridname','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','attended','isNil','transfereechannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','lodash','./utils','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb9b,0xb1));var _0xbbb9=function(_0x13d905,_0x4093f6){_0x13d905=_0x13d905-0x0;var _0x308b2f=_0xbb9b[_0x13d905];return _0x308b2f;};'use strict';var _=require(_0xbbb9('0x0'));var util=require('util');var utils=require(_0xbbb9('0x1'));function writeDB(_0x5cb838){utils[_0xbbb9('0x2')](util[_0xbbb9('0x3')](_0xbbb9('0x4'),_0x5cb838[_0xbbb9('0x5')]==='attended'?_0x5cb838[_0xbbb9('0x6')]:_0x5cb838['uniqueid'],_0x5cb838[_0xbbb9('0x5')]));utils[_0xbbb9('0x7')](_0xbbb9('0x8'),_0x5cb838);}exports[_0xbbb9('0x9')]=function(_0x4ce4b1){try{utils['debug'](util[_0xbbb9('0x3')](_0xbbb9('0xa'),_0x4ce4b1['uniqueid']),_0x4ce4b1);utils[_0xbbb9('0x2')](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4ce4b1[_0xbbb9('0xb')],_0x4ce4b1[_0xbbb9('0xc')],_0x4ce4b1['transferercalleridname'],_0x4ce4b1['transfereecalleridnum'],_0x4ce4b1[_0xbbb9('0xd')]));_0x4ce4b1['type']='blind';writeDB(_0x4ce4b1);}catch(_0x506785){utils[_0xbbb9('0xe')](util[_0xbbb9('0x3')](_0xbbb9('0xa'),_0x4ce4b1[_0xbbb9('0xb')]),_0x506785);}};exports[_0xbbb9('0xf')]=function(_0x1ca159){try{utils[_0xbbb9('0x10')](util['format'](_0xbbb9('0x11'),_0x1ca159['origtransfereruniqueid']),_0x1ca159);utils['info'](util[_0xbbb9('0x3')](_0xbbb9('0x12'),_0x1ca159[_0xbbb9('0x6')],_0x1ca159[_0xbbb9('0x13')],_0x1ca159['origtransferercalleridname'],_0x1ca159[_0xbbb9('0x14')],_0x1ca159[_0xbbb9('0x15')]));_0x1ca159=_[_0xbbb9('0x16')](_0x1ca159,{'transfererchannel':_0x1ca159[_0xbbb9('0x17')],'transferercalleridnum':_0x1ca159[_0xbbb9('0x13')],'transferercalleridname':_0x1ca159['origtransferercalleridname'],'transfererconnectedlinenum':_0x1ca159['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1ca159[_0xbbb9('0x18')],'transfereraccountcode':_0x1ca159[_0xbbb9('0x19')],'transferercontext':_0x1ca159['secondtransferercontext'],'transfererexten':_0x1ca159[_0xbbb9('0x1a')],'transfererlinkedid':_0x1ca159[_0xbbb9('0x1b')],'context':_0x1ca159[_0xbbb9('0x1c')],'extension':_0x1ca159['origtransfererexten'],'type':_0xbbb9('0x1d')});if(_[_0xbbb9('0x1e')](_0x1ca159[_0xbbb9('0x1f')])){_0x1ca159=_[_0xbbb9('0x16')](_0x1ca159,{'transfereechannel':_0x1ca159['transfertargetchannel'],'transfereecalleridnum':_0x1ca159[_0xbbb9('0x14')],'transfereecalleridname':_0x1ca159[_0xbbb9('0x15')],'transfereeconnectedlinenum':_0x1ca159[_0xbbb9('0x20')],'transfereeconnectedlinename':_0x1ca159[_0xbbb9('0x21')],'transfereeaccountcode':_0x1ca159['transfertargetaccountcode'],'transfereecontext':_0x1ca159['transfertargetcontext'],'transfereeexten':_0x1ca159[_0xbbb9('0x22')],'transfereelinkedid':_0x1ca159[_0xbbb9('0x23')]});}writeDB(_0x1ca159);}catch(_0x499027){utils['error'](util[_0xbbb9('0x3')](_0xbbb9('0x11'),_0x1ca159[_0xbbb9('0x6')]),_0x499027);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index ec3008e..c42a663 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(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xb10b,0x12a));var _0xbb10=function(_0x482c95,_0x504190){_0x482c95=_0x482c95-0x0;var _0x38c2e8=_0xb10b[_0x482c95];return _0x38c2e8;};'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 _0x7a54=['result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','xdr','info','debug','error','inspect','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify'];(function(_0x4bcfcd,_0x5cf858){var _0x5e3bd8=function(_0x1730e2){while(--_0x1730e2){_0x4bcfcd['push'](_0x4bcfcd['shift']());}};_0x5e3bd8(++_0x5cf858);}(_0x7a54,0x106));var _0x47a5=function(_0x5eec69,_0x4fafab){_0x5eec69=_0x5eec69-0x0;var _0x269514=_0x7a54[_0x5eec69];return _0x269514;};'use strict';var BPromise=require(_0x47a5('0x0'));var jayson=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var util=require('util');var client=jayson[_0x47a5('0x3')][_0x47a5('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x47a5('0x5'));exports[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){logger[_0x47a5('0x6')](_0x2a1a7e,_0x3717e1?util['inspect'](_0x3717e1,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x7')]=function(_0x59199c,_0x343372){logger[_0x47a5('0x7')](_0x59199c,_0x343372?util['inspect'](_0x343372,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x8')]=function(_0x5077f3,_0x5d90b3){logger['error'](_0x5077f3,_0x5d90b3?util[_0x47a5('0x9')](_0x5d90b3,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0xa')]=function(_0x5e31dd,_0x2eb0dd){return client['request'](_0x5e31dd,{'body':_0x2eb0dd})['then'](function(_0x1f47f4){logger[_0x47a5('0x7')](_0x47a5('0xb'),_0x5e31dd,_0x1f47f4?util[_0x47a5('0x9')](_0x1f47f4,{'showHidden':![],'depth':null}):'');})[_0x47a5('0xc')](function(_0xd308b8){logger[_0x47a5('0x8')]('[utils][request]\x20name:%s',_0x5e31dd,_0xd308b8?util[_0x47a5('0x9')](_0xd308b8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x221b54){return client[_0x47a5('0xa')](_0x47a5('0xd'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xe'),_0x47a5('0xf'),_0x47a5('0x10')],'where':_0x221b54,'limit':0x1}})[_0x47a5('0x11')](function(_0x4e99a8){logger[_0x47a5('0x7')](_0x47a5('0x12'),JSON[_0x47a5('0x13')](_0x221b54),_0x4e99a8?util[_0x47a5('0x9')](_0x4e99a8,{'showHidden':![],'depth':null}):'');return _0x4e99a8[_0x47a5('0x14')]['length']?_0x4e99a8['result'][0x0]:null;});}exports[_0x47a5('0x15')]=function(_0x4b966e){return new BPromise(function(_0x5247fd,_0x423a81){if(_0x4b966e){return getUser({'internal':_0x4b966e})[_0x47a5('0x11')](function(_0x2ce454){logger[_0x47a5('0x6')](_0x47a5('0x16'),_0x4b966e,_0x2ce454?_0x47a5('0x17'):_0x47a5('0x18'));return _0x5247fd(_0x2ce454);})[_0x47a5('0xc')](function(_0x3aed38){logger['error'](_0x47a5('0x19'),_0x3aed38?util[_0x47a5('0x9')](_0x3aed38,{'showHidden':![],'depth':null}):'');return _0x5247fd(null);});}return _0x5247fd(null);});};exports['getUserByInterface']=function(_0x2b0360){return new BPromise(function(_0x1f03f7,_0x36874d){if(_0x2b0360){return getUser({'interface':_0x2b0360})['then'](function(_0xb8ae6c){logger[_0x47a5('0x6')](_0x47a5('0x1a'),_0x2b0360,_0xb8ae6c?_0x47a5('0x17'):'notfound');return _0x1f03f7(_0xb8ae6c);})[_0x47a5('0xc')](function(_0x385687){logger['error'](_0x47a5('0x1b'),_0x385687?util[_0x47a5('0x9')](_0x385687,{'showHidden':![],'depth':null}):'');return _0x1f03f7(null);});}return _0x1f03f7(null);});};exports[_0x47a5('0x1c')]=function(_0x129ce5){return new BPromise(function(_0x3abd6a,_0x50bf17){if(_0x129ce5){return getUser({'name':_0x129ce5})['then'](function(_0x136745){logger['info'](_0x47a5('0x1d'),_0x129ce5,_0x136745?'found':_0x47a5('0x18'));return _0x3abd6a(_0x136745);})[_0x47a5('0xc')](function(_0x36ad34){logger[_0x47a5('0x8')](_0x47a5('0x1e'),_0x36ad34?util[_0x47a5('0x9')](_0x36ad34,{'showHidden':![],'depth':null}):'');return _0x3abd6a(null);});}return _0x3abd6a(null);});};exports[_0x47a5('0x1f')]=function(_0x136b14){return new BPromise(function(_0x16631f,_0x361bfa){if(_0x136b14){return client[_0x47a5('0xa')](_0x47a5('0x20'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xf'),'type',_0x47a5('0x21'),'acwTimeout'],'where':{'name':_0x136b14},'limit':0x1}})[_0x47a5('0x11')](function(_0x9ac908){logger[_0x47a5('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x136b14,_0x9ac908?util[_0x47a5('0x9')](_0x9ac908,{'showHidden':![],'depth':null}):'');logger[_0x47a5('0x6')](_0x47a5('0x22'),_0x136b14,_0x9ac908?_0x47a5('0x17'):'notfound');return _0x16631f(_0x9ac908['result'][_0x47a5('0x23')]?_0x9ac908[_0x47a5('0x14')][0x0]:null);})['catch'](function(_0x4e1006){logger[_0x47a5('0x8')](_0x47a5('0x24'),_0x4e1006?util['inspect'](_0x4e1006,{'showHidden':![],'depth':null}):'');return _0x16631f(null);});}return _0x16631f(null);});};exports[_0x47a5('0x25')]=function(_0x53119b,_0x122ed6){return moment(_0x53119b)[_0x47a5('0x26')](_0x122ed6,'seconds')['format'](_0x47a5('0x27'));};exports['subtractTime']=function(_0x403028,_0x87e4c9){return moment(_0x403028)[_0x47a5('0x28')](_0x87e4c9,'seconds')[_0x47a5('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x65542e,_0x5a8a7c){return moment(_0x65542e)[_0x47a5('0x2a')](moment(_0x5a8a7c),'seconds');};exports[_0x47a5('0x2b')]=function(_0x3534cb,_0x38c8d4){return parseInt(_0x3534cb,0xa)+parseInt(_0x38c8d4,0xa);};exports[_0x47a5('0x2c')]=function(){return moment()[_0x47a5('0x29')](_0x47a5('0x27'));};exports[_0x47a5('0x2d')]=function(_0x452be5,_0x1a0d23){if(_0x1a0d23){return moment(_0x452be5)['isAfter'](_0x1a0d23);}return!![];};exports[_0x47a5('0x2e')]=function(_0x10f136,_0x511c06){if(_0x511c06){return moment(_0x10f136)[_0x47a5('0x2e')](_0x511c06);}else if(_0x10f136){return!![];}return![];}; \ No newline at end of file